antosdk-apps/OpenPage/build/debug/main.js
2020-06-25 16:23:33 +00:00

81 lines
429 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(function(){var e,t,n;n=class n extends this.OS.application.BaseApplication{constructor(e){super("OpenPage",e)}main(){return this.eventSubscriptions=new core.EventSubscriptions,this.initToolbox(),this.userid=`${this.systemsetting.user.username}@${this.pid}`,this.currentStyle="",this.args&&this.args.length>0?this.open(this.args[0].path):this.newdoc(),this.resource={fonts:[],formats:[]},this.bindKey("ALT-N",()=>this.actionFile(this.name+"-New")),this.bindKey("ALT-O",()=>this.actionFile(this.name+"-Open")),this.bindKey("CTRL-S",()=>this.actionFile(this.name+"-Save")),this.bindKey("ALT-W",()=>this.actionFile(this.name+"-Saveas"))}menu(){return[{text:"__(File)",nodes:[{text:"__(New)",dataid:this.name+"-New",shortcut:"A-N"},{text:"__(Open)",dataid:this.name+"-Open",shortcut:"A-O"},{text:"__(Save)",dataid:this.name+"-Save",shortcut:"C-S"},{text:"__(Save as)",dataid:this.name+"-Saveas",shortcut:"A-W"}],onchildselect:e=>this.actionFile(e.data.item.data.dataid)}]}actionFile(e){var t;switch(t=()=>this.openDialog("FileDialog",{title:__("Save as"),file:this.currfile}).then(e=>{var t;return t=e.file.path.asFileHandle(),"file"===e.file.type&&(t=t.parent()),this.currfile.setPath(`${t.path}/${e.name}`),this.save()}),e){case this.name+"-Open":return this.openDialog("FileDialog",{title:__("Open file"),mimes:this.meta().mimes}).then(e=>this.open(e.file.path));case this.name+"-Save":return this.currfile.basename?this.save():t();case this.name+"-Saveas":return t();case this.name+"-New":return this.newdoc()}}newdoc(){var e;return e=this.meta().path+"/blank.odt",this.open(e,!0)}open(e,t){return this.pathAsDataURL(e).then(n=>(this.editorSession&&this.closeDocument(),this.initCanvas(),new odf.OdfContainer(n.data,n=>(this.canvas.setOdfContainer(n,!1),t?this.currfile="Untitled".asFileHandle():(this.currfile?this.currfile.setPath(e):this.currfile=e.asFileHandle(),this.scheme.apptitle=this.currfile.basename,this.notify(__("File {0} opened",e))))))).catch(e=>this.error(__("Problem read file {0}",e.toString()),e))}save(){var e;if(this.editorSession)return(e=this.canvas.odfContainer())?e.createByteArray(e=>(this.currfile.cache=new Blob([e],{type:"application/vnd.oasis.opendocument.text"}),this.currfile.write("application/vnd.oasis.opendocument.text").then(e=>(this.notify(__("File {0} saved",this.currfile.basename)),this.scheme.apptitle=this.currfile.basename,this.currfile.dirty=!1,this.editorFocus())).catch(e=>this.error(__("Cannot save file: {0}",e.toString()),e))),e=>this.error(__("Cannot create byte array from container: {0}",e.toString()||""),e)):this.error(__("No document container found"))}initToolbox(){var e,t,n;for(t in this.basictool={undo:this.find("btundo"),redo:this.find("btredo"),bold:this.find("btbold"),italic:this.find("btitalic"),underline:this.find("btunderline"),strike:this.find("btstrike"),note:this.find("btnote"),link:this.find("btlink"),unlink:this.find("btunlink"),image:this.find("btimage"),ac:this.find("btac"),al:this.find("btal"),ar:this.find("btar"),aj:this.find("btaj"),indent:this.find("btindent"),outdent:this.find("btoutdent"),fonts:this.find("font-list"),fontsize:this.find("font-size"),styles:this.find("format-list"),zoom:this.find("slzoom"),format:this.find("btformat")},e=(e,t)=>t["fonts"===e||"styles"===e?"onlistselect":"fontsize"===e||"zoom"===e?"onvaluechange":"onbtclick"]=t=>{if(this.directFormattingCtl&&this[e])return this[e](t),this.editorFocus()},n=this.basictool)e(t,n[t]);return this.find("btzoomfix").onbtclick=e=>this.zoom({data:100}),this.basictool.zoom.onvaluechanging=e=>this.find("lbzoom").text=Math.floor(e.data)+"%"}initCanvas(){var e;return(e=this.find("odfcanvas")).setAttribute("translate","no"),e.classList.add("notranslate"),this.canvas=new odf.OdfCanvas(e),this.documentChanged=e=>{if(!this.currfile.dirty)return this.currfile.dirty=!0,this.scheme.apptitle=this.currfile.basename+"*"},this.metaChanged=e=>{if(!this.currfile.dirty)return this.currfile.dirty=!0,this.scheme.apptitle=this.currfile.basename+"*"},this.textStylingChanged=e=>this.updateToolbar(e),this.paragrahStyleChanged=e=>{var t,n,i,o,r;if("style"===e.type){for(t=o=0,r=(i=this.basictool.styles.data).length;o<r;t=++o)i[t].name===e.styleName&&(n=t);if(void 0!==n)return this.currentStyle=e.styleName,this.basictool.styles.selected=n}},this.styleAdded=t=>{var n,i,o,r,a,s;if("paragraph"===t.family){for(r=0,a=(o=this.basictool.styles.data).length;r<a;r++)(s=o[r]).name===t.name&&(i=s);if(!i)return n=(e=this.editorSession.getParagraphStyleElement(t.name)).getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","display-name"),this.basictool.styles.push({text:n,name:t.name},!0)}},this.updateSlider=e=>{var t;return t=Math.floor(100*e),this.basictool.zoom.value=t,this.find("lbzoom").text=t+"%"},this.canvas.enableAnnotations(!0,!0),this.canvas.addListener("statereadychange",()=>{var e,t;return this.session=new ops.Session(this.canvas),t={editInfoMarkersInitiallyVisible:!1,caretAvatarsInitiallyVisible:!1,caretBlinksOnRangeSelect:!0},this.editorSession=new n.EditorSession(this.session,this.userid,{viewOptions:t,directTextStylingEnabled:!0,directParagraphStylingEnabled:!0,paragraphStyleSelectingEnabled:!0,paragraphStyleEditingEnabled:!0,imageEditingEnabled:!0,hyperlinkEditingEnabled:!0,annotationsEnabled:!0,zoomingEnabled:!0,reviewModeEnabled:!1}),this.initFontList(this.editorSession.getDeclaredFonts()),this.initStyles(this.editorSession.getAvailableParagraphStyles()),this.directFormattingCtl=this.editorSession.sessionController.getDirectFormattingController(),this.directFormattingCtl.subscribe(gui.DirectFormattingController.textStylingChanged,this.textStylingChanged),this.directFormattingCtl.subscribe(gui.DirectFormattingController.paragraphStylingChanged,this.textStylingChanged),this.editorSession.subscribe(n.EditorSession.signalParagraphChanged,this.paragrahStyleChanged),this.hyperlinkController=this.editorSession.sessionController.getHyperlinkController(),this.eventSubscriptions.addFrameSubscription(this.editorSession,n.EditorSession.signalCursorMoved,()=>this.updateHyperlinkButtons()),this.eventSubscriptions.addFrameSubscription(this.editorSession,n.EditorSession.signalParagraphChanged,()=>this.updateHyperlinkButtons()),this.eventSubscriptions.addFrameSubscription(this.editorSession,n.EditorSession.signalParagraphStyleModified,()=>this.updateHyperlinkButtons()),this.annotationController=this.editorSession.sessionController.getAnnotationController(),this.imageController=this.editorSession.sessionController.getImageController(),this.textController=this.editorSession.sessionController.getTextController(),this.zoomHelper=this.editorSession.getOdfCanvas().getZoomHelper(),this.zoomHelper.subscribe(gui.ZoomHelper.signalZoomChanged,this.updateSlider),this.updateSlider(this.zoomHelper.getZoomLevel()),this.editorSession.subscribe(n.EditorSession.signalCommonStyleCreated,this.styleAdded),this.editorSession.sessionController.setUndoManager(new gui.TrivialUndoManager),this.editorSession.sessionController.getUndoManager().subscribe(gui.UndoManager.signalDocumentModifiedChanged,this.documentChanged),this.editorSession.sessionController.getMetadataController().subscribe(gui.MetadataController.signalMetadataChanged,this.metaChanged),(e=new ops.OpAddMember).init({memberid:this.userid,setProperties:{fullName:this.userid,color:"blue"}}),this.session.enqueue([e]),this.editorSession.sessionController.insertLocalCursor(),this.editorSession.sessionController.startEditing(),this.fontsize({data:this.basictool.fontsize.value})})}initFontList(e){var t,n,i,o,r;for(t=0,i=e.length;t<i;t++)(r=e[t]).text=r.name;for(this.resource.fonts=[],n=0,o=e.length;n<o;n++)r=e[n],this.resource.fonts.push({text:r.text,name:r.family});return this.basictool.fonts.data=e}initStyles(e){var t,n,i,o,r;for(e.unshift({name:"",displayName:"Default style"}),t=0,i=e.length;t<i;t++)(r=e[t]).text=r.displayName;for(n=0,o=e.length;n<o;n++)r=e[n],this.resource.formats.push({text:r.text,name:r.name});return this.basictool.styles.data=e}updateToolbar(e){var t;if(e.hasOwnProperty("isBold")&&(this.basictool.bold.selected=e.isBold),e.hasOwnProperty("isItalic")&&(this.basictool.italic.selected=e.isItalic),e.hasOwnProperty("hasUnderline")&&(this.basictool.underline.selected=e.hasUnderline),e.hasOwnProperty("hasStrikeThrough")&&(this.basictool.strike.selected=e.hasStrikeThrough),e.hasOwnProperty("fontSize")&&(void 0===(t=e.fontSize)&&(t=12),this.basictool.fontsize.value!==t&&(this.basictool.fontsize.value=t)),e.hasOwnProperty("fontName")&&this.selectFont(e.fontName),e.hasOwnProperty("isAlignedLeft")&&(this.basictool.al.selected=e.isAlignedLeft),e.hasOwnProperty("isAlignedRight")&&(this.basictool.ar.selected=e.isAlignedRight),e.hasOwnProperty("isAlignedCenter")&&(this.basictool.ac.selected=e.isAlignedCenter),e.hasOwnProperty("isAlignedJustified"))return this.basictool.aj.selected=e.isAlignedJustified}updateHyperlinkButtons(e){var t;return t=this.editorSession.getSelectedHyperlinks(),this.basictool.unlink.enable=t.length>0}selectFont(e){var t,n,i,o,r;for(t=o=0,r=(i=this.basictool.fonts.data).length;o<r;t=++o)i[t].name===e&&(n=t);if(void 0!==n)return this.basictool.fonts.selected=n}editorFocus(){return this.editorSession.sessionController.getEventManager().focus()}bold(e){return this.directFormattingCtl.setBold(!this.basictool.bold.selected)}italic(e){return this.directFormattingCtl.setItalic(!this.basictool.italic.selected)}underline(e){return this.directFormattingCtl.setHasUnderline(!this.basictool.underline.selected)}strike(e){return this.directFormattingCtl.setHasStrikethrough(!this.basictool.strike.selected)}fonts(e){return this.directFormattingCtl.setFontName(e.data.item.data.name)}fontsize(e){return this.directFormattingCtl.setFontSize(e.data)}al(e){return this.directFormattingCtl.alignParagraphLeft()}ar(e){return this.directFormattingCtl.alignParagraphRight()}ac(e){return this.directFormattingCtl.alignParagraphCenter()}note(e){return this.annotationController.addAnnotation()}aj(e){return this.directFormattingCtl.alignParagraphJustified()}indent(e){return this.directFormattingCtl.indent()}outdent(e){return this.directFormattingCtl.outdent()}link(e){var n,i,o,r;return r=new odf.TextSerializer,o=this.editorSession.getSelectedRange(),n={link:(i=this.editorSession.getSelectedHyperlinks())[0]?odf.OdfUtils.getHyperlinkTarget(i[0]):"http://",text:"",readonly:!0,action:"new"},o&&o.collapsed&&1===i.length?(n.text=r.writeToString(i[0]),n.action="edit"):o&&!o.collapsed?n.text=r.writeToString(o.cloneContents()):n.readonly=!1,this.openDialog(new t,{title:"__(Insert/edit link)",data:n}).then(e=>{var t,n;return n=this.editorSession.sessionController.getSelectionController(),e.readonly?("edit"===e.action&&((t=o.cloneRange()).selectNode(i[0]),n.selectRange(t,!0)),this.hyperlinkController.removeHyperlinks(),this.hyperlinkController.addHyperlink(e.link)):(this.hyperlinkController.addHyperlink(e.link,e.text),i=this.editorSession.getSelectedHyperlinks(),(t=o.cloneRange()).selectNode(i[0]),n.selectRange(t,!0))})}unlink(e){return this.hyperlinkController.removeHyperlinks()}undo(e){return this.editorSession.undo()}redo(e){return this.editorSession.redo()}pathAsDataURL(e){return new Promise((t,n)=>{var i;return(i=e.asFileHandle()).read("binary").then(o=>{var r,a;return r=new Blob([o],{type:i.info.mime}),(a=new FileReader).onloadend=()=>2!==a.readyState?n(this.throwe(__("Unable to load file {0}",e))):t({data:a.result,fp:i}),a.readAsDataURL(r)}).catch(e=>n(__e(e)))})}image(e){return this.openDialog("FileDialog",{title:__("Select image file"),mimes:["image/.*"]}).then(e=>{var t;return t=e.file.path,this.pathAsDataURL(t).then(e=>{var t;return(t=new Image).style.position="absolute",t.style.left="-99999px",document.body.appendChild(t),t.onload=()=>{var n;return n=e.data.substring(e.data.indexOf(",")+1),this.textController.removeCurrentSelection(),this.imageController.insertImage(e.fp.info.mime,n,t.width,t.height),document.body.removeChild(t)},t.src=e.data}).catch(e=>this.error(__("Couldnt load image {0}",t),e))})}styles(e){if(e.data.item.data.name!==this.currentStyle)return this.editorSession.setCurrentParagraphStyle(e.data.item.data.name)}zoom(e){if(this.zoomHelper)return this.zoomHelper.setZoomLevel(e.data/100)}format(t){return this.openDialog(new e,{title:__("Add/Modify paragraph format"),data:this.resource}).then(e=>{})}closeDocument(e){var t;if(this.editorSession&&this.session)return this.eventSubscriptions.unsubscribeAll(),this.editorSession.sessionController.endEditing(),this.editorSession.sessionController.removeLocalCursor(),(t=new ops.OpRemoveMember).init({memberid:this.userid}),this.session.enqueue([t]),this.session.close(t=>t?this.error(__("Cannot close session {0}",t.toString()),t):(this.editorSession.sessionController.getMetadataController().unsubscribe(gui.MetadataController.signalMetadataChanged,this.metaChanged),this.editorSession.sessionController.getUndoManager().unsubscribe(gui.UndoManager.signalDocumentModifiedChanged,this.documentChanged),this.directFormattingCtl.unsubscribe(gui.DirectFormattingController.textStylingChanged,this.textStylingChanged),this.directFormattingCtl.unsubscribe(gui.DirectFormattingController.paragraphStylingChanged,this.textStylingChanged),this.editorSession.unsubscribe(n.EditorSession.signalParagraphChanged,this.paragrahStyleChanged),this.zoomHelper.unsubscribe(gui.ZoomHelper.signalZoomChanged,this.updateSlider),this.editorSession.unsubscribe(n.EditorSession.signalCommonStyleCreated,this.styleAdded),this.editorSession.destroy(t=>t?this.error(__("Cannot destroy editor session {0}",t.toString()),t):(this.editorSession=void 0,this.session.destroy(t=>t?this.error(__("Cannot destroy document session {0}",t.toString()),t):(core.Async.destroyAll([this.canvas.destroy],t=>t?this.error(__("Cannot destroy canvas {0}",t.toString()),t):(this.notify("Document closed"),e?e():void 0)),this.session=void 0,this.annotationController=void 0,this.directFormattingCtl=void 0,this.textController=void 0,this.imageController=void 0,this.ZoomHelper=void 0,this.metaChanged=void 0,this.documentChanged=void 0,this.textStylingChanged=void 0,this.paragrahStyleChanged=void 0,this.updateSlider=void 0,this.styleAdded=void 0,this.basictool.fonts.selected=-1,this.basictool.styles.selected=-1))))))}cleanup(e){if(this.editorSession)return e.preventDefault(),this.closeDocument(()=>this.quit())}},this.OS.register("OpenPage",n),(t=class e extends this.OS.GUI.BasicDialog{constructor(){super("HyperLinkDialog",e.scheme)}main(){var e,t;return super.main(),t=this.find("txtText"),e=this.find("txtLink"),this.data&&this.data.data&&(t.value=this.data.data.text,e.value=this.data.data.link,$(t).prop("disabled",this.data.data.readonly)),this.find("btnCancel").onbtclick=e=>this.quit(),this.find("btnOk").onbtclick=n=>{var i;return i={text:t.value,link:e.value,readonly:this.data.data.readonly,action:this.data.data.action},this.handle&&this.handle(i),this.quit()}}}).scheme='<afx-app-window width=\'350\' height=\'150\' apptitle = "Hyperlink">\n <afx-vbox>\n <afx-hbox>\n <div data-width = "10" />\n <afx-vbox>\n <div data-height="10" />\n <afx-label class="header" text = "__(Text)" data-height="23" />\n <input data-height = "30" data-id = "txtText" />\n <afx-label class="header" text = "__(Link)" data-height="23" />\n <input data-height = "30" data-id = "txtLink" />\n <div data-height="10" />\n <afx-hbox data-height="30">\n <div />\n <afx-button data-id = "btnOk" text = "__(Ok)" data-width = "40" />\n <afx-button data-id = "btnCancel" text = "__(Cancel)" data-width = "40" />\n <div data-width = "10" />\n </afx-hbox>\n </afx-vbox>\n <div data-width = "10" />\n </afx-hbox>\n </afx-vbox>\n</afx-app-window>',(e=class e extends this.OS.GUI.BasicDialog{constructor(){super("FormatDialog",e.scheme)}main(){return super.main(),this.ui={aligment:{left:this.find("swleft"),right:this.find("swright"),center:this.find("swcenter"),justify:this.find("swjustify")},spacing:{left:this.find("spnleft"),right:this.find("spnright"),top:this.find("spntop"),bottom:this.find("spnbottom"),lineheight:this.find("spnlheight")},padding:{left:this.find("pspnleft"),right:this.find("pspnright"),top:this.find("pspntop"),bottom:this.find("pspnbottom")},style:{bold:this.find("swbold"),italic:this.find("switalic"),underline:this.find("swunderline"),color:this.find("txtcolor"),bgcolor:this.find("bgcolor")},font:{family:this.find("lstfont"),size:this.find("spnfsize")},formats:this.find("lstformats")},this.initStyleObject(),this.preview=$(this.find("preview")).find("p")[0],$(this.preview).css("padding","0").css("margin","0"),this.initUIEvent()}initStyleObject(){return this.currentStyle={aligment:this._api.switcher("left","right","center","justify"),spacing:{left:0,top:0,right:0,bottom:0,lineheight:0},padding:{left:0,top:0,right:0,bottom:0},style:{bold:!1,italic:!1,underline:!1,color:void 0,bgcolor:void 0},font:{family:void 0,size:12}}}initUIEvent(){var e,t,n,i,o,r;for(e in r=(e,t,n,i)=>this.ui[t][n][e]=e=>{var o;return o=e,i&&(o=i(e)),this.currentStyle[t][n]=o,this.previewStyle()},t=this.ui.aligment)t[e],r("onswchange","aligment",e,e=>e.data);for(e in n=this.ui.spacing)n[e],r("onvaluechange","spacing",e,e=>e.data);for(e in i=this.ui.padding)i[e],r("onvaluechange","padding",e,e=>e.data);for(e in o=this.ui.style)o[e],"color"!==e&&"bgcolor"!==e&&r("onswchange","style",e,e=>e.data);return r("onvaluechange","font","size"),$(this.ui.style.color).click(e=>this.openDialog("ColorPickerDialog").then(e=>(this.currentStyle.style.color=e,this.previewStyle()))),$(this.ui.style.bgcolor).click(e=>this.openDialog("ColorPickerDialog").then(e=>(this.currentStyle.style.bgcolor=e,this.previewStyle()))),this.data.data&&this.data.data.fonts&&(this.ui.font.family.data=this.data.data.fonts),r("onlistselect","font","family",e=>e.data.item.data),this.ui.formats.selected=-1,this.data.data&&this.data.data.formats&&(this.ui.formats.data=this.data.data.formats),this.ui.formats.onlistselect=e=>this.fromODFStyleFormat(e.data.item.data),this.ui.formats.selected=0,this.find("btok").onbtclick=e=>this.saveCurrentStyle(),this.find("btx").onbtclick=e=>this.quit(),this.find("bt-clone").onbtclick=e=>this.clone()}clone(){var e;if(e=this.ui.formats.selectedItem)return e=e.data,this.openDialog("PromptDialog",{title:__("Clone style: {0}",e.text),label:__("New style name:")}).then(t=>{var n;return t&&""!==t.trim()?(n=this.parent.editorSession.cloneParagraphStyle(e.name,t),this.ui.formats.push({text:t,name:n}),this.ui.formats.selected=this.ui.formats.data.length-1,this.notify(__("New style: {0} added",n))):this.notify(__("Abort: no style name is specified"))})}saveCurrentStyle(){var e,t;if(t=this.ui.formats.selectedItem)return t=t.data,e={"style:paragraph-properties":{"fo:margin-top":this.currentStyle.spacing.top+"mm","fo:margin-left":this.currentStyle.spacing.left+"mm","fo:margin-bottom":this.currentStyle.spacing.bottom+"mm","fo:margin-right":this.currentStyle.spacing.right+"mm","fo:padding-top":this.currentStyle.padding.top+"mm","fo:padding-left":this.currentStyle.padding.left+"mm","fo:padding-bottom":this.currentStyle.padding.bottom+"mm","fo:padding-right":this.currentStyle.padding.right+"mm","fo:line-height":this.currentStyle.spacing.lineheight>0?this.currentStyle.spacing.lineheight+"mm":"normal","fo:text-align":this.currentStyle.aligment.selected||"left"},"style:text-properties":{"fo:font-weight":this.currentStyle.style.bold?"bold":"normal","fo:font-style":this.currentStyle.style.italic?"italic":"normal","style:text-underline-style":this.currentStyle.style.underline?"solid":"none","fo:font-size":this.currentStyle.font.size+"pt","fo:font-name":this.currentStyle.font.family.text,"fo:color":this.currentStyle.style.color?this.currentStyle.style.color.hex:"#000000","fo:background-color":this.currentStyle.style.bgcolor?this.currentStyle.style.bgcolor.hex:"transparent"}},this.parent.editorSession.updateParagraphStyle(t.name,e),this.notify(__("Paragraph format [{0}] is saved",t.text))}fromODFStyleFormat(e){var t,n,i;return this.initStyleObject(),t=new core.CSSUnits,n=e=>{var t,n,i,o,r;for(i=0,o=(n=this.ui.font.family.data).length;i<o;i++)(r=n[i]).text===e&&(t=r);if(t)return t},(i=this.parent.editorSession.getParagraphStyleAttributes(e.name)["style:paragraph-properties"])&&(this.currentStyle.spacing.top=t.convertMeasure(i["fo:margin-top"],"mm")||0,this.currentStyle.spacing.left=t.convertMeasure(i["fo:margin-left"],"mm")||0,this.currentStyle.spacing.right=t.convertMeasure(i["fo:margin-right"],"mm")||0,this.currentStyle.spacing.bottom=t.convertMeasure(i["fo:margin-bottom"],"mm")||0,this.currentStyle.padding.top=t.convertMeasure(i["fo:padding-top"],"mm")||0,this.currentStyle.padding.left=t.convertMeasure(i["fo:padding-left"],"mm")||0,this.currentStyle.padding.right=t.convertMeasure(i["fo:padding-right"],"mm")||0,this.currentStyle.padding.bottom=t.convertMeasure(i["fo:padding-bottom"],"mm")||0,this.currentStyle.spacing.lineheight=t.convertMeasure(i["fo:line-height"],"mm")||4.2,i["fo:text-align"]&&(this.currentStyle.aligment[i["fo:text-align"]]=!0)),(i=this.parent.editorSession.getParagraphStyleAttributes(e.name)["style:text-properties"])&&(this.currentStyle.style.bold="bold"===i["fo:font-weight"],this.currentStyle.style.italic="italic"===i["fo:font-style"],i["style:text-underline-style"]&&"none"!==i["style:text-underline-style"]&&(this.currentStyle.style.underline=!0),this.currentStyle.font.size=parseFloat(i["fo:font-size"]),this.currentStyle.font.family=n(i["style:font-name"]),i["fo:color"]&&(this.currentStyle.style.color={hex:i["fo:color"]}),i["fo:background-color"]&&(this.currentStyle.style.bgcolor={hex:i["fo:background-color"]})),this.previewStyle()}previewStyle(){var e,t,n,i,o,r;if(this.ui.aligment.left.swon=this.currentStyle.aligment.left,this.ui.aligment.right.swon=this.currentStyle.aligment.right,this.ui.aligment.center.swon=this.currentStyle.aligment.center,this.ui.aligment.justify.swon=this.currentStyle.aligment.justify,this.ui.spacing.left.value=this.currentStyle.spacing.left,this.ui.spacing.right.value=this.currentStyle.spacing.right,this.ui.spacing.top.value=this.currentStyle.spacing.top,this.ui.spacing.bottom.value=this.currentStyle.spacing.bottom,this.ui.spacing.lineheight.value=this.currentStyle.spacing.lineheight,this.ui.padding.left.value=this.currentStyle.padding.left,this.ui.padding.right.value=this.currentStyle.padding.right,this.ui.padding.top.value=this.currentStyle.padding.top,this.ui.padding.bottom.value=this.currentStyle.padding.bottom,this.ui.style.bold.swon=this.currentStyle.style.bold,this.ui.style.italic.swon=this.currentStyle.style.italic,this.ui.style.underline.swon=this.currentStyle.style.underline,this.ui.font.size.value=this.currentStyle.font.size,this.currentStyle.font.family){for(t=o=0,r=(i=this.ui.font.family.data).length;o<r;t=++o)i[t].text===this.currentStyle.font.family.text&&(n=t);n>=0&&(this.ui.font.family.selected=n)}if($(this.ui.style.color).css("background-color",this.currentStyle.style.color?this.currentStyle.style.color.hex:"#000000"),$(this.ui.style.bgcolor).css("background-color",this.currentStyle.style.bgcolor?this.currentStyle.style.bgcolor.hex:"transparent"),(e=$(this.preview)).css("text-align",this.currentStyle.aligment.selected?this.currentStyle.aligment.selected:"left"),e.css("margin-left",this.currentStyle.spacing.left+"mm"),e.css("margin-right",this.currentStyle.spacing.right+"mm"),e.css("margin-top",this.currentStyle.spacing.top+"mm"),e.css("margin-bottom",this.currentStyle.spacing.bottom+"mm"),e.css("padding-left",this.currentStyle.padding.left+"mm"),e.css("padding-right",this.currentStyle.padding.right+"mm"),e.css("padding-top",this.currentStyle.padding.top+"mm"),e.css("padding-bottom",this.currentStyle.padding.bottom+"mm"),e.css("font-weight","normal").css("font-style","normal").css("text-decoration","none").css("line-height","normal"),this.currentStyle.style.bold&&e.css("font-weight","bold"),this.currentStyle.style.italic&&e.css("font-style","italic"),this.currentStyle.style.underline&&e.css("text-decoration","underline"),e.css("color",this.currentStyle.style.color?this.currentStyle.style.color.hex:"#000000"),e.css("background-color",this.currentStyle.style.bgcolor?this.currentStyle.style.bgcolor.hex:"transparent"),e.css("font-size",this.currentStyle.font.size+"pt"),this.currentStyle.font.family&&e.css("font-family",this.currentStyle.font.family.name),this.currentStyle.spacing.lineheight>0)return e.css("line-height",this.currentStyle.spacing.lineheight+"mm")}}).scheme='<afx-app-window apptitle="__(Format Dialog)" width="500" height="500" data-id="FormatDialog">\n <afx-vbox>\n <div data-height="5"></div>\n <afx-hbox data-height="30">\n <div data-width="5"></div>\n <afx-list-view data-id="lstformats" dropdown = "true"></afx-list-view>\n <div data-width="5" ></div>\n <afx-button text="clone" data-id="bt-clone" iconclass = "fa fa-copy" data-width="65"></afx-button>\n <div data-width="5"></div>\n </afx-hbox>\n <afx-label text="__(Aligment)" class="header" data-height="20"></afx-label>\n <afx-hbox data-height="23" data-id="aligmentbox">\n <div data-width="20" ></div>\n <afx-switch data-width="30" data-id="swleft"></afx-switch>\n <afx-label text="__(Left)"></afx-label>\n <afx-switch data-width="30" data-id="swright"></afx-switch>\n <afx-label text="__(Right)"></afx-label>\n <afx-switch data-width="30" data-id="swcenter"></afx-switch>\n <afx-label text="__(Center)"></afx-label>\n <afx-switch data-width="30" data-id="swjustify"></afx-switch>\n <afx-label text="__(Justify)"></afx-label>\n <div data-width="20" ></div>\n </afx-hbox>\n <div data-height="5"></div>\n <afx-label text="__(Margin)" class="header" data-height="20"></afx-label>\n <div data-height="5"></div>\n <afx-hbox data-height="23" data-id="spacingbox">\n <div ></div>\n <afx-label data-width="50" text="__(Left:)"></afx-label>\n <afx-nspinner data-width="50" data-id="spnleft" value = "0" step="0.5"></afx-nspinner>\n <div></div>\n <afx-label data-width="50" text="__(Right:)"></afx-label>\n <afx-nspinner data-width="50" data-id="spnright" value = "0" step="0.5"></afx-nspinner>\n <div></div>\n <afx-label data-width="50" text="__(Top:)"></afx-label>\n <afx-nspinner data-width="50" data-id="spntop" value = "0" step="0.5"></afx-nspinner>\n <div></div>\n <afx-label data-width="50" text="__(Bottom:)"></afx-label>\n <afx-nspinner data-width="50" data-id="spnbottom" value = "0" step="0.5"></afx-nspinner>\n <div ></div>\n </afx-hbox>\n <div data-height="5"></div>\n <afx-label text="__(Padding)" class="header" data-height="20"></afx-label>\n <div data-height="5"></div>\n <afx-hbox data-height="23" data-id="spacingbox">\n <div ></div>\n <afx-label data-width="50" text="__(Left:)"></afx-label>\n <afx-nspinner data-width="50" data-id="pspnleft" value = "0" step="0.5"></afx-nspinner>\n <div></div>\n <afx-label data-width="50" text="__(Right:)"></afx-label>\n <afx-nspinner data-width="50" value = "0" data-id="pspnright" step="0.5"></afx-nspinner>\n <div></div>\n <afx-label data-width="50" text="__(Top:)"></afx-label>\n <afx-nspinner data-width="50" value = "0" data-id="pspntop" step="0.5"></afx-nspinner>\n <div></div>\n <afx-label data-width="50" text="__(Bottom:)"></afx-label>\n <afx-nspinner data-width="50" value = "0" data-id="pspnbottom" step="0.5"></afx-nspinner>\n <div ></div>\n </afx-hbox>\n \n <div data-height="5"></div>\n <afx-label text="__(Style)" class="header" data-height="20"></afx-label>\n <div data-height="5"></div>\n <afx-hbox data-height="23" data-id="stylebox">\n <div data-width="5"></div>\n <afx-switch data-width="30" data-id="swbold"></afx-switch>\n <afx-label text="__(Bold)"></afx-label>\n <afx-switch data-width="30" data-id="switalic"></afx-switch>\n <afx-label text="__(Italic)"></afx-label>\n <afx-switch data-width="30" data-id="swunderline"></afx-switch>\n <afx-label text="__(Underline)"></afx-label>\n <afx-label data-width="35" text="__(Text:)"></afx-label>\n <div data-width="30" data-id="txtcolor"></div>\n <div data-width="5"></div>\n <afx-label data-width="80" text="__(Background:)"></afx-label>\n <div data-width="30" data-id="bgcolor"></div>\n <div data-width="5"></div>\n </afx-hbox>\n <div data-height="5"></div>\n <afx-label text="__(Font)" class="header" data-height="20"></afx-label>\n <div data-height="5"></div>\n <afx-hbox data-height="30" data-id="font-box">\n <div data-width="5"></div>\n <afx-list-view data-id="lstfont" dropdown = "true"></afx-list-view>\n <div data-width="5" ></div>\n <afx-label data-width="35" text="__(Size:)"></afx-label>\n <afx-nspinner data-width="50" value = "12" data-id="spnfsize"></afx-nspinner>\n <div data-width="5" ></div>\n <afx-label data-width="80" text="__(Line Height:)"></afx-label>\n <afx-nspinner data-width="50" data-id="spnlheight" value="4.2" step="0.2"></afx-nspinner>\n <div data-width="5"></div>\n </afx-hbox>\n <div data-height="5"></div>\n <afx-label text="__(Preview)" class="header" data-height="20"></afx-label>\n <div data-height="5"></div>\n <afx-hbox>\n <div data-width="5"></div>\n <div data-id="preview" style="background-color: white;">\n <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce laoreet diam vestibulum massa malesuada quis dignissim libero blandit. Duis sit amet volutpat nisl.</p>\n </div>\n <div data-width="5"></div>\n </afx-hbox>\n \n <div data-height="5"></div>\n <afx-hbox data-height="30">\n <div></div>\n <afx-button text="__(Save)" data-width="35" data-id="btok"></afx-button>\n <div data-width="5"></div>\n <afx-button text="__(Cancel)" data-width="55" data-id="btx"></afx-button>\n </afx-hbox>\n <div data-height="5"></div>\n </afx-vbox>\n</afx-app-window>'}).call(this);
/*
This is a generated file. DO NOT EDIT.
Copyright (C) 2010-2015 KO GmbH <copyright@kogmbh.com>
@licstart
The code in this file is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License (GNU AGPL)
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
The code in this file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with WebODF. If not, see <http://www.gnu.org/licenses/>.
As additional permission under GNU AGPL version 3 section 7, you
may distribute UNMODIFIED VERSIONS OF THIS file without the copy of the GNU AGPL normally
required by section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
As a special exception to the AGPL, any HTML file which merely makes function
calls to this code, and for that purpose includes it in unmodified form by reference or in-line shall be
deemed a separate work for copyright law purposes. In addition, the copyright
holders of this code give you permission to combine this code with free
software libraries that are released under the GNU LGPL. You may copy and
distribute such a system following the terms of the GNU AGPL for this code
and the LGPL for the libraries. If you modify this code, you may extend this
exception to your version of the code, but you are not obligated to do so.
If you do not wish to do so, delete this exception statement from your
version.
This license applies to this entire compilation.
@licend
@source: http://www.webodf.org/
@source: https://github.com/kogmbh/WebODF/
*/
var webodf_version="0.5.9";function Runtime(){}Runtime.prototype.getVariable=function(e){},Runtime.prototype.toJson=function(e){},Runtime.prototype.fromJson=function(e){},Runtime.prototype.byteArrayFromString=function(e,t){},Runtime.prototype.byteArrayToString=function(e,t){},Runtime.prototype.read=function(e,t,n,i){},Runtime.prototype.readFile=function(e,t,n){},Runtime.prototype.readFileSync=function(e,t){},Runtime.prototype.loadXML=function(e,t){},Runtime.prototype.writeFile=function(e,t,n){},Runtime.prototype.deleteFile=function(e,t){},Runtime.prototype.log=function(e,t){},Runtime.prototype.setTimeout=function(e,t){},Runtime.prototype.clearTimeout=function(e){},Runtime.prototype.libraryPaths=function(){},Runtime.prototype.currentDirectory=function(){},Runtime.prototype.setCurrentDirectory=function(e){},Runtime.prototype.type=function(){},Runtime.prototype.getDOMImplementation=function(){},Runtime.prototype.parseXML=function(e){},Runtime.prototype.exit=function(e){},Runtime.prototype.getWindow=function(){},Runtime.prototype.requestAnimationFrame=function(e){},Runtime.prototype.cancelAnimationFrame=function(e){},Runtime.prototype.assert=function(e,t){};var IS_COMPILED_CODE=!0;function BrowserRuntime(){function e(e){var t,n,i=e.length,o=0;for(t=0;t<i;t+=1)o+=1+(128<(n=e.charCodeAt(t)))+(2048<n),55040<n&&57344>n&&(o+=1,t+=1);return o}function t(e,t,n){var i,o,r=e.length;for(t=new Uint8Array(new ArrayBuffer(t)),n?(t[0]=239,t[1]=187,t[2]=191,o=3):o=0,n=0;n<r;n+=1)128>(i=e.charCodeAt(n))?(t[o]=i,o+=1):2048>i?(t[o]=192|i>>>6,t[o+1]=128|63&i,o+=2):55040>=i||57344<=i?(t[o]=224|i>>>12&15,t[o+1]=128|i>>>6&63,t[o+2]=128|63&i,o+=3):(n+=1,i=65536+(i-55296<<10|e.charCodeAt(n)-56320),t[o]=240|i>>>18&7,t[o+1]=128|i>>>12&63,t[o+2]=128|i>>>6&63,t[o+3]=128|63&i,o+=4);return t}function n(e){var t,n=e.length,i=new Uint8Array(new ArrayBuffer(n));for(t=0;t<n;t+=1)i[t]=255&e.charCodeAt(t);return i}function i(e,t){var n;void 0!==t?n=e:t=e,console.log(t),s.enableAlerts&&"alert"===n&&alert(t)}function o(i,o,r){if(0!==r.status||r.responseText)if(200===r.status||0===r.status){if(r.response&&"string"!=typeof r.response)"binary"===o?(r=r.response,r=new Uint8Array(r)):r=String(r.response);else if("binary"===o)if(null!==r.responseBody&&"undefined"!==String(typeof VBArray)){var a=(r=new VBArray(r.responseBody).toArray()).length;for(o=new Uint8Array(new ArrayBuffer(a)),i=0;i<a;i+=1)o[i]=r[i];r=o}else{if((i=r.getResponseHeader("Content-Length"))&&(i=parseInt(i,10)),i&&i!==r.responseText.length)e:{o=!1;var s=e(a=r.responseText);if("number"==typeof i){if(i!==s&&i!==s+3){a=void 0;break e}o=s+3===i,s=i}a=t(a,s,o)}void 0===a&&(a=n(r.responseText)),r=a}else r=r.responseText;r={err:null,data:r}}else r={err:r.responseText||r.statusText,data:null};else r={err:"File "+i+" is empty.",data:null};return r}function r(e,t,n){var i=new XMLHttpRequest;return i.open("GET",e,n),i.overrideMimeType&&("binary"!==t?i.overrideMimeType("text/plain; charset="+t):i.overrideMimeType("text/plain; charset=x-user-defined")),i}function a(e,t,n){var i=r(e,t,!0);i.onreadystatechange=function(){var r;4===i.readyState&&(r=o(e,t,i),n(r.err,r.data))};try{i.send(null)}catch(e){n(e.message,null)}}var s=this;this.byteArrayFromString=function(i,o){var r;return"utf8"===o?r=t(i,e(i),!1):("binary"!==o&&s.log("unknown encoding: "+o),r=n(i)),r},this.byteArrayToString=Runtime.byteArrayToString,this.getVariable=Runtime.getVariable,this.fromJson=Runtime.fromJson,this.toJson=Runtime.toJson,this.readFile=a,this.read=function(e,t,n,i){a(e,"binary",(function(e,o){var r=null;if(o){if("string"==typeof o)throw"This should not happen.";r=o.subarray(t,t+n)}i(e,r)}))},this.readFileSync=function(e,t){var n,i=r(e,t,!1);try{if(i.send(null),(n=o(e,t,i)).err)throw n.err;if(null===n.data)throw"No data read from "+e+"."}catch(e){throw e}return n.data},this.writeFile=function(e,t,n){var i,o=new XMLHttpRequest;o.open("PUT",e,!0),o.onreadystatechange=function(){4===o.readyState&&(0!==o.status||o.responseText?200<=o.status&&300>o.status||0===o.status?n(null):n("Status "+String(o.status)+": "+o.responseText||o.statusText):n("File "+e+" is empty."))},i=t.buffer&&!o.sendAsBinary?t.buffer:s.byteArrayToString(t,"binary");try{o.sendAsBinary?o.sendAsBinary(i):o.send(i)}catch(e){s.log("HUH? "+e+" "+t),n(e.message)}},this.deleteFile=function(e,t){var n=new XMLHttpRequest;n.open("DELETE",e,!0),n.onreadystatechange=function(){4===n.readyState&&(200>n.status&&300<=n.status?t(n.responseText):t(null))},n.send(null)},this.loadXML=function(e,t){var n=new XMLHttpRequest;n.open("GET",e,!0),n.overrideMimeType&&n.overrideMimeType("text/xml"),n.onreadystatechange=function(){4===n.readyState&&(0!==n.status||n.responseText?200===n.status||0===n.status?t(null,n.responseXML):t(n.responseText,null):t("File "+e+" is empty.",null))};try{n.send(null)}catch(e){t(e.message,null)}},this.log=i,this.enableAlerts=!0,this.assert=Runtime.assert,this.setTimeout=function(e,t){return setTimeout((function(){e()}),t)},this.clearTimeout=function(e){clearTimeout(e)},this.libraryPaths=function(){return["lib"]},this.setCurrentDirectory=function(){},this.currentDirectory=function(){return""},this.type=function(){return"BrowserRuntime"},this.getDOMImplementation=function(){return window.document.implementation},this.parseXML=function(e){return(new DOMParser).parseFromString(e,"text/xml")},this.exit=function(e){i("Calling exit with code "+String(e)+", but exit() is not implemented.")},this.getWindow=function(){return window},this.requestAnimationFrame=function(e){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame;return t?(t.bind(window),t(e)):setTimeout(e,15)},this.cancelAnimationFrame=function(e){var t=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame;t?(t.bind(window),t(e)):clearTimeout(e)}}function NodeJSRuntime(){function e(e){var t,n=e.length,i=new Uint8Array(new ArrayBuffer(n));for(t=0;t<n;t+=1)i[t]=e[t];return i}function t(t,n,i){function o(n,o){return n?i(n,null):o?"string"==typeof o?i(n,o):void i(n,e(o)):i("No data for "+t+".",null)}t=a.resolve(s,t),"binary"!==n?r.readFile(t,n,o):r.readFile(t,null,o)}var n,i,o=this,r=require("fs"),a=require("path"),s="";this.byteArrayFromString=function(e,t){var n,i=new Buffer(e,t),o=i.length,r=new Uint8Array(new ArrayBuffer(o));for(n=0;n<o;n+=1)r[n]=i[n];return r},this.byteArrayToString=Runtime.byteArrayToString,this.getVariable=Runtime.getVariable,this.fromJson=Runtime.fromJson,this.toJson=Runtime.toJson,this.readFile=t,this.loadXML=function(e,n){t(e,"utf-8",(function(t,i){return t?n(t,null):i?void n(null,o.parseXML(i)):n("No data for "+e+".",null)}))},this.writeFile=function(e,t,n){t=new Buffer(t),e=a.resolve(s,e),r.writeFile(e,t,"binary",(function(e){n(e||null)}))},this.deleteFile=function(e,t){e=a.resolve(s,e),r.unlink(e,t)},this.read=function(t,n,i,o){t=a.resolve(s,t),r.open(t,"r+",666,(function(t,a){if(t)o(t,null);else{var s=new Buffer(i);r.read(a,s,0,i,n,(function(t){r.close(a),o(t,e(s))}))}}))},this.readFileSync=function(t,n){var i;if(null===(i=r.readFileSync(t,"binary"===n?null:n)))throw"File "+t+" could not be read.";return"binary"===n&&(i=e(i)),i},this.log=function(e,t){var n;void 0!==t?n=e:t=e,"alert"===n&&process.stderr.write("\n!!!!! ALERT !!!!!\n"),process.stderr.write(t+"\n"),"alert"===n&&process.stderr.write("!!!!! ALERT !!!!!\n")},this.assert=Runtime.assert,this.setTimeout=function(e,t){return setTimeout((function(){e()}),t)},this.clearTimeout=function(e){clearTimeout(e)},this.libraryPaths=function(){return[__dirname]},this.setCurrentDirectory=function(e){s=e},this.currentDirectory=function(){return s},this.type=function(){return"NodeJSRuntime"},this.getDOMImplementation=function(){return i},this.parseXML=function(e){return n.parseFromString(e,"text/xml")},this.exit=process.exit,this.getWindow=function(){return null},this.requestAnimationFrame=function(e){return setTimeout(e,15)},this.cancelAnimationFrame=function(e){clearTimeout(e)},n=new(require("xmldom").DOMParser),i=o.parseXML("<a/>").implementation}function RhinoRuntime(){var e,t,n=this,i={},o=i.javax.xml.parsers.DocumentBuilderFactory.newInstance(),r="";o.setValidating(!1),o.setNamespaceAware(!0),o.setExpandEntityReferences(!1),o.setSchema(null),t=i.org.xml.sax.EntityResolver({resolveEntity:function(e,t){var n=new i.java.io.FileReader(t);return new i.org.xml.sax.InputSource(n)}}),(e=o.newDocumentBuilder()).setEntityResolver(t),this.byteArrayFromString=function(e,t){var n,i=e.length,o=new Uint8Array(new ArrayBuffer(i));for(n=0;n<i;n+=1)o[n]=255&e.charCodeAt(n);return o},this.byteArrayToString=Runtime.byteArrayToString,this.getVariable=Runtime.getVariable,this.fromJson=Runtime.fromJson,this.toJson=Runtime.toJson,this.loadXML=function(t,n){var o=new i.java.io.File(t),r=null;try{r=e.parse(o)}catch(e){return print(e),n(e,null)}n(null,r)},this.readFile=function(e,t,o){r&&(e=r+"/"+e);var a="binary"===t?"latin1":t;new i.java.io.File(e).isFile()?((e=readFile(e,a))&&"binary"===t&&(e=n.byteArrayFromString(e,"binary")),o(null,e)):o(e+" is not a file.",null)},this.writeFile=function(e,t,n){r&&(e=r+"/"+e),e=new i.java.io.FileOutputStream(e);var o,a=t.length;for(o=0;o<a;o+=1)e.write(t[o]);e.close(),n(null)},this.deleteFile=function(e,t){r&&(e=r+"/"+e);var n=new i.java.io.File(e),o=e+Math.random();o=new i.java.io.File(o),n.rename(o)?(o.deleteOnExit(),t(null)):t("Could not delete "+e)},this.read=function(e,t,n,o){var a;r&&(e=r+"/"+e),a=e;var s="binary";new i.java.io.File(a).isFile()?("binary"===s&&(s="latin1"),a=readFile(a,s)):a=null,a?o(null,this.byteArrayFromString(a.substring(t,t+n),"binary")):o("Cannot read "+e,null)},this.readFileSync=function(e,t){if(!t)return"";var n=readFile(e,t);if(null===n)throw"File could not be read.";return n},this.log=function(e,t){var n;void 0!==t?n=e:t=e,"alert"===n&&print("\n!!!!! ALERT !!!!!"),print(t),"alert"===n&&print("!!!!! ALERT !!!!!")},this.assert=Runtime.assert,this.setTimeout=function(e){return e(),0},this.clearTimeout=function(){},this.libraryPaths=function(){return["lib"]},this.setCurrentDirectory=function(e){r=e},this.currentDirectory=function(){return r},this.type=function(){return"RhinoRuntime"},this.getDOMImplementation=function(){return e.getDOMImplementation()},this.parseXML=function(t){return t=new i.java.io.StringReader(t),t=new i.org.xml.sax.InputSource(t),e.parse(t)},this.exit=quit,this.getWindow=function(){return null},this.requestAnimationFrame=function(e){return e(),0},this.cancelAnimationFrame=function(){}}Runtime.byteArrayToString=function(e,t){var n;return"utf8"===t?n=function(e){var t,n,i,o,r,a="",s=e.length,l=[];for(t=3<=s&&239===e[0]&&187===e[1]&&191===e[2]?3:0;t<s;t+=1)128>(n=e[t])?l.push(n):(i=e[t+=1],194<=n&&224>n?l.push((31&n)<<6|63&i):(o=e[t+=1],224<=n&&240>n?l.push((15&n)<<12|(63&i)<<6|63&o):(r=e[t+=1],240<=n&&245>n&&(n=(7&n)<<18|(63&i)<<12|(63&o)<<6|63&r,n-=65536,l.push(55296+(n>>10),56320+(1023&n)))))),1e3<=l.length&&(a+=String.fromCharCode.apply(null,l),l.length=0);return a+String.fromCharCode.apply(null,l)}(e):("binary"!==t&&this.log("Unsupported encoding: "+t),n=function(e){var t,n="",i=e.length;for(t=0;t<i;t+=1)n+=String.fromCharCode(255&e[t]);return n}(e)),n},Runtime.getVariable=function(g){try{return eval(g)}catch(e){}},Runtime.toJson=function(e){return JSON.stringify(e)},Runtime.fromJson=function(e){return JSON.parse(e)},Runtime.getFunctionName=function(e){return void 0===e.name?(e=/function\s+(\w+)/.exec(e))&&e[1]:e.name},Runtime.assert=function(e,t){if(!e)throw this.log("alert","ASSERTION FAILED:\n"+t),Error(t)},Runtime.create=function(){return"undefined"!==String(typeof window)?new BrowserRuntime:"undefined"!==String(typeof require)?new NodeJSRuntime:new RhinoRuntime};var runtime=Runtime.create(),core={},gui={},xmldom={},odf={},ops={},webodf={},g;function makeBase64(){function e(e){var t,n=e.length,i=new Uint8Array(new ArrayBuffer(n));for(t=0;t<n;t+=1)i[t]=255&e.charCodeAt(t);return i}function t(e){var t,n,i="",o=e.length-2;for(n=0;n<o;n+=3)i+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(t=e[n]<<16|e[n+1]<<8|e[n+2])>>>18],i+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t>>>12&63],i+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t>>>6&63],i+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&t];return n===o+1?(i+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(t=e[n]<<4)>>>6],i+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&t],i+="=="):n===o&&(i+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(t=e[n]<<10|e[n+1]<<2)>>>12],i+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t>>>6&63],i+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&t],i+="="),i}function n(e){var t,n,i=(e=e.replace(/[^A-Za-z0-9+\/]+/g,"")).length,o=new Uint8Array(new ArrayBuffer(3*i)),r=e.length%4,a=0;for(t=0;t<i;t+=4)n=(y[e.charAt(t)]||0)<<18|(y[e.charAt(t+1)]||0)<<12|(y[e.charAt(t+2)]||0)<<6|(y[e.charAt(t+3)]||0),o[a]=n>>16,o[a+1]=n>>8&255,o[a+2]=255&n,a+=3;return i=3*i-[0,0,2,1][r],o.subarray(0,i)}function i(e){var t,n,i=e.length,o=0,r=new Uint8Array(new ArrayBuffer(3*i));for(t=0;t<i;t+=1)128>(n=e[t])?r[o++]=n:(2048>n?r[o++]=192|n>>>6:(r[o++]=224|n>>>12&15,r[o++]=128|n>>>6&63),r[o++]=128|63&n);return r.subarray(0,o)}function o(e){var t,n,i,o,r=e.length,a=new Uint8Array(new ArrayBuffer(r)),s=0;for(t=0;t<r;t+=1)128>(n=e[t])?a[s++]=n:(i=e[t+=1],224>n?a[s++]=(31&n)<<6|63&i:(o=e[t+=1],a[s++]=(15&n)<<12|(63&i)<<6|63&o));return a.subarray(0,s)}function r(n){return t(e(n))}function a(e){return String.fromCharCode.apply(String,n(e))}function s(t){return o(e(t))}function l(e){e=o(e);for(var t="",n=0;n<e.length;)t+=String.fromCharCode.apply(String,e.subarray(n,n+45e3)),n+=45e3;return t}function u(e,t,n){var i,o,r,a="";for(r=t;r<n;r+=1)128>(t=255&e.charCodeAt(r))?a+=String.fromCharCode(t):(r+=1,i=255&e.charCodeAt(r),224>t?a+=String.fromCharCode((31&t)<<6|63&i):(r+=1,o=255&e.charCodeAt(r),a+=String.fromCharCode((15&t)<<12|(63&i)<<6|63&o)));return a}function d(e,t){var n="",i=0;1e5>e.length?t(u(e,0,e.length),!0):("string"!=typeof e&&(e=e.slice()),function o(){var r=i+1e5;r>e.length&&(r=e.length),n+=u(e,i,r),r=(i=r)===e.length,t(n,r)&&!r&&runtime.setTimeout(o,0)}())}function c(t){return i(e(t))}function f(e){return String.fromCharCode.apply(String,i(e))}function p(t){return String.fromCharCode.apply(String,i(e(t)))}var h,m,g,b,y=function(e){var t,n,i={};for(t=0,n=e.length;t<n;t+=1)i[e.charAt(t)]=t;return i}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),v=runtime.getWindow();return v&&v.btoa?(g=v.btoa,h=function(e){return g(p(e))}):(g=r,h=function(e){return t(c(e))}),v&&v.atob?(b=v.atob,m=function(e){return u(e=b(e),0,e.length)}):(b=a,m=function(e){return l(n(e))}),core.Base64=function(){return this.convertByteArrayToBase64=this.convertUTF8ArrayToBase64=t,this.convertBase64ToByteArray=this.convertBase64ToUTF8Array=n,this.convertUTF16ArrayToByteArray=this.convertUTF16ArrayToUTF8Array=i,this.convertByteArrayToUTF16Array=this.convertUTF8ArrayToUTF16Array=o,this.convertUTF8StringToBase64=r,this.convertBase64ToUTF8String=a,this.convertUTF8StringToUTF16Array=s,this.convertByteArrayToUTF16String=this.convertUTF8ArrayToUTF16String=l,this.convertUTF8StringToUTF16String=d,this.convertUTF16StringToByteArray=this.convertUTF16StringToUTF8Array=c,this.convertUTF16ArrayToUTF8String=f,this.convertUTF16StringToUTF8String=p,this.convertUTF16StringToBase64=h,this.convertBase64ToUTF16String=m,this.fromBase64=a,this.toBase64=r,this.atob=b,this.btoa=g,this.utob=p,this.btou=d,this.encode=h,this.encodeURI=function(e){return h(e).replace(/[+\/]/g,(function(e){return"+"===e?"-":"_"})).replace(/\\=+$/,"")},this.decode=function(e){return m(e.replace(/[\-_]/g,(function(e){return"-"===e?"+":"/"})))},this},core.Base64}function createXPathSingleton(){function e(e,t,n){return-1!==e&&(e<t||-1===t)&&(e<n||-1===n)}function t(t){for(var n,i=[],o=0,r=t.length;o<r;){var a=t,s=r,l=i,d="",c=[],f=a.indexOf("[",o),p=a.indexOf("/",o),h=a.indexOf("=",o);if(e(p,f,h)?(d=a.substring(o,p),o=p+1):e(f,p,h)?(d=a.substring(o,f),o=u(a,f,c)):e(h,p,f)?(d=a.substring(o,h),o=h):(d=a.substring(o,s),o=s),l.push({location:d,predicates:c}),o<r&&"="===t[o]){if(2<(n=t.substring(o+1,r)).length&&("'"===n[0]||'"'===n[0]))n=n.slice(1,n.length-1);else try{n=parseInt(n,10)}catch(e){}o=r}}return{steps:i,value:n}}function n(){var e=null,t=!1;this.setNode=function(t){e=t},this.reset=function(){t=!1},this.next=function(){var n=t?null:e;return t=!0,n}}function i(e,t,n){this.reset=function(){e.reset()},this.next=function(){for(var i=e.next();i&&(i.nodeType===Node.ELEMENT_NODE&&(i=i.getAttributeNodeNS(t,n)),!i);)i=e.next();return i}}function o(e,t){var n=e.next(),i=null;this.reset=function(){e.reset(),n=e.next(),i=null},this.next=function(){for(;n;){if(i)if(t&&i.firstChild)i=i.firstChild;else{for(;!i.nextSibling&&i!==n;)i=i.parentNode;i===n?n=e.next():i=i.nextSibling}else do{(i=n.firstChild)||(n=e.next())}while(n&&!i);if(i&&i.nodeType===Node.ELEMENT_NODE)return i}return null}}function r(e,t){this.reset=function(){e.reset()},this.next=function(){for(var n=e.next();n&&!t(n);)n=e.next();return n}}function a(e,t,n){var i=n((t=t.split(":",2))[0]),o=t[1];return new r(e,(function(e){return e.localName===o&&e.namespaceURI===i}))}function s(e,t,i){var o=new n,a=l(o,t,i),s=t.value;return new r(e,void 0===s?function(e){return o.setNode(e),a.reset(),null!==a.next()}:function(e){return o.setNode(e),a.reset(),!!(e=a.next())&&e.nodeValue===s})}var l,u;return u=function(e,n,i){for(var o=n,r=e.length,a=0;o<r;)"]"===e[o]?0>=--a&&i.push(t(e.substring(n,o))):"["===e[o]&&(0>=a&&(n=o+1),a+=1),o+=1;return o},l=function(e,t,n){var r,l,u,d;for(r=0;r<t.steps.length;r+=1){if(""===(l=(u=t.steps[r]).location))e=new o(e,!1);else if("@"===l[0]){if(!(d=n((l=l.substr(1).split(":",2))[0])))throw"No namespace associated with the prefix "+l[0];e=new i(e,d,l[1])}else"."!==l&&(e=new o(e,!1),-1!==l.indexOf(":")&&(e=a(e,l,n)));for(l=0;l<u.predicates.length;l+=1)e=s(e,d=u.predicates[l],n)}return e},{getODFElementsWithXPath:function(e,i,o){var r=e.ownerDocument,a=[],s=null;if(r&&"function"==typeof r.evaluate)for(s=(o=r.evaluate(i,e,o,XPathResult.UNORDERED_NODE_ITERATOR_TYPE,null)).iterateNext();null!==s;)s.nodeType===Node.ELEMENT_NODE&&a.push(s),s=o.iterateNext();else{for((a=new n).setNode(e),e=t(i),a=l(a,e,o),e=[],o=a.next();o;)e.push(o),o=a.next();a=e}return a}}}function RootFilter(e,t,n){var i=core.PositionFilter.FilterResult.FILTER_ACCEPT,o=core.PositionFilter.FilterResult.FILTER_REJECT;this.acceptPosition=function(r){var a;return r=r.container(),a="string"==typeof e?t[e].getNode():e,n(r)===n(a)?i:o}}webodf.Version="undefined"!==String(typeof webodf_version)?webodf_version:"From Source",function(){function g(e,t,n){var i,o,r=e+"/manifest.json";runtime.log("Loading manifest: "+r);try{i=runtime.readFileSync(r,"utf-8")}catch(e){if(!n)throw console.log(String(e)),e;return void runtime.log("No loadable manifest found.")}for(o in n=JSON.parse(i))n.hasOwnProperty(o)&&(t[o]={dir:e,deps:n[o]})}function k(e,t,n){var i=[],o={},r={};return e.forEach((function e(a){if(!r[a]&&!n(a)){if(o[a])throw"Circular dependency detected for "+a+".";if(o[a]=!0,!t[a])throw"Missing dependency information for class "+a+".";var s,l=t[a],u=l.deps,d=u.length;for(s=0;s<d;s+=1)e(u[s]);o[a]=!1,r[a]=!0,i.push(l.dir+"/"+a.replace(".","/")+".js")}})),i}function d(e,t){return t+"\n//# sourceURL="+e}function b(b){var f,e;for(f=0;f<b.length;f+=1)e=runtime.readFileSync(b[f],"utf-8"),e=d(b[f],e),eval(e)}function f(e){e=e.split(".");var t,n=p,i=e.length;for(t=0;t<i;t+=1){if(!n.hasOwnProperty(e[t]))return!1;n=n[e[t]]}return!0}var n,p={core:core,gui:gui,xmldom:xmldom,odf:odf,ops:ops};runtime.loadClasses=function(e,t){if(IS_COMPILED_CODE||0===e.length)return t&&t();var i;if(!(i=n)){i=[];var o,r=runtime.libraryPaths();for(runtime.currentDirectory()&&-1===r.indexOf(runtime.currentDirectory())&&g(runtime.currentDirectory(),i,!0),o=0;o<r.length;o+=1)g(r[o],i)}if(0===(e=k(e,n=i,f)).length)return t&&t();if("BrowserRuntime"===runtime.type()&&t){var a,s;for(i=e,r=document.currentScript||document.documentElement.lastChild,o=document.createDocumentFragment(),s=0;s<i.length;s+=1)(a=document.createElement("script")).type="text/javascript",a.charset="utf-8",a.async=!1,a.setAttribute("src",i[s]),o.appendChild(a);t&&(a.onload=t),r.parentNode.insertBefore(o,r)}else b(e),t&&t()},runtime.loadClass=function(e,t){runtime.loadClasses([e],t)}}(),g=function(e){return e},runtime.getTranslator=function(){return g},runtime.setTranslator=function(e){g=e},runtime.tr=function(e){var t=g(e);return t&&"string"===String(typeof t)?t:e},function(g){function k(d){if(d.length){var b=d[0];runtime.readFile(b,"utf8",(function(f,n){function g(){var b;(b=eval(k))&&runtime.exit(b)}var r="",r=b.lastIndexOf("/"),k=n,r=-1!==r?b.substring(0,r):".";runtime.setCurrentDirectory(r),f?(runtime.log(f),runtime.exit(1)):null===k?(runtime.log("No code found for "+b),runtime.exit(1)):g.apply(null,d)}))}}g=g?Array.prototype.slice.call(g):[],"NodeJSRuntime"===runtime.type()?k(process.argv.slice(2)):"RhinoRuntime"===runtime.type()?k(g):k(g.slice(1))}("undefined"!==String(typeof arguments)&&arguments),core.Async={forEach:function(e,t,n){function i(e){a!==r&&(e?(a=r,n(e)):(a+=1)===r&&n(null))}var o,r=e.length,a=0;for(o=0;o<r;o+=1)t(e[o],i)},destroyAll:function(e,t){!function n(i,o){o?t(o):i<e.length?e[i]((function(e){n(i+1,e)})):t()}(0,void 0)}},core.Base64=makeBase64(),core.CSSUnits=function(){var e=this,t={in:1,cm:2.54,mm:25.4,pt:72,pc:12,px:96};this.convert=function(e,n,i){return e*t[i]/t[n]},this.convertMeasure=function(t,n){var i,o;return t&&n&&(i=parseFloat(t),o=t.replace(i.toString(),""),i=e.convert(i,o,n)),i},this.getUnits=function(e){return e.substr(e.length-2,e.length)}},function(){function e(){var e,t,i,o,r,a,s,l,u;return void 0===n&&(a=(t=(e=runtime.getWindow())&&e.document).documentElement,s=t.body,n={rangeBCRIgnoresElementBCR:!1,unscaledRangeClientRects:!1,elementBCRIgnoresBodyScroll:!1},t&&((o=t.createElement("div")).style.position="absolute",o.style.left="-99999px",o.style.transform="scale(2)",o.style["-webkit-transform"]="scale(2)",r=t.createElement("div"),o.appendChild(r),s.appendChild(o),(e=t.createRange()).selectNode(r),n.rangeBCRIgnoresElementBCR=0===e.getClientRects().length,r.appendChild(t.createTextNode("Rect transform test")),t=r.getBoundingClientRect(),i=e.getBoundingClientRect(),n.unscaledRangeClientRects=2<Math.abs(t.height-i.height),o.style.transform="",o.style["-webkit-transform"]="",t=a.style.overflow,i=s.style.overflow,l=s.style.height,u=s.scrollTop,a.style.overflow="visible",s.style.overflow="visible",s.style.height="200%",s.scrollTop=s.scrollHeight,n.elementBCRIgnoresBodyScroll=e.getBoundingClientRect().top!==r.getBoundingClientRect().top,s.scrollTop=u,s.style.height=l,s.style.overflow=i,a.style.overflow=t,e.detach(),s.removeChild(o),e=Object.keys(n).map((function(e){return e+":"+String(n[e])})).join(", "),runtime.log("Detected browser quirks - "+e))),n}function t(e,t,n){for(e=e?e.firstElementChild:null;e;){if(e.localName===n&&e.namespaceURI===t)return e;e=e.nextElementSibling}return null}var n;core.DomUtilsImpl=function(){function n(e,t){for(var n,i=0;e.parentNode!==t;)runtime.assert(null!==e.parentNode,"parent is null"),e=e.parentNode;for(n=t.firstChild;n!==e;)i+=1,n=n.nextSibling;return i}function i(e,t){return 0>=e.compareBoundaryPoints(Range.START_TO_START,t)&&0<=e.compareBoundaryPoints(Range.END_TO_END,t)}function o(e,t){return 0>=e.compareBoundaryPoints(Range.END_TO_START,t)&&0<=e.compareBoundaryPoints(Range.START_TO_END,t)}function r(e,t){var n=null;return e.nodeType===Node.TEXT_NODE&&(0===e.length?(e.parentNode.removeChild(e),t.nodeType===Node.TEXT_NODE&&(n=t)):(t.nodeType===Node.TEXT_NODE&&(e.appendData(t.data),t.parentNode.removeChild(t)),n=e)),n}function a(e){for(var t=e.parentNode;e.firstChild;)t.insertBefore(e.firstChild,e);return t.removeChild(e),t}function s(e,t){return e===t||Boolean(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY)}function l(t,n){return e().unscaledRangeClientRects?t:t/n}var u=null;this.splitBoundaries=function(e){var t,i,o,r,a=[];if(e.startContainer.nodeType===Node.TEXT_NODE||e.endContainer.nodeType===Node.TEXT_NODE){if(i=e.endContainer,o=e.endContainer.nodeType!==Node.TEXT_NODE&&e.endOffset===e.endContainer.childNodes.length,(r=e.endOffset)<(t=e.endContainer).childNodes.length)for(t=t.childNodes.item(r),r=0;t.firstChild;)t=t.firstChild;else for(;t.lastChild;)r=(t=t.lastChild).nodeType===Node.TEXT_NODE?t.textContent.length:t.childNodes.length;if(t===i&&(i=null),e.setEnd(t,r),r=e.endContainer,0!==e.endOffset&&r.nodeType===Node.TEXT_NODE&&(t=r,e.endOffset!==t.length&&(a.push(t.splitText(e.endOffset)),a.push(t))),r=e.startContainer,0!==e.startOffset&&r.nodeType===Node.TEXT_NODE&&(t=r,e.startOffset!==t.length&&(r=t.splitText(e.startOffset),a.push(t),a.push(r),e.setStart(r,0))),null!==i){for(r=e.endContainer;r.parentNode&&r.parentNode!==i;)r=r.parentNode;o=o?i.childNodes.length:n(r,i),e.setEnd(i,o)}}return a},this.containsRange=i,this.rangesIntersect=o,this.rangeIntersection=function(e,t){var n;return o(e,t)&&(n=e.cloneRange(),-1===e.compareBoundaryPoints(Range.START_TO_START,t)&&n.setStart(t.startContainer,t.startOffset),1===e.compareBoundaryPoints(Range.END_TO_END,t)&&n.setEnd(t.endContainer,t.endOffset)),n},this.getNodesInRange=function(e,t,n){var i,o,r=[],a=(a=e.commonAncestorContainer).nodeType===Node.TEXT_NODE?a.parentNode:a;if(n=e.startContainer.ownerDocument.createTreeWalker(a,n,t,!1),e.endContainer.childNodes[e.endOffset-1]?(i=e.endContainer.childNodes[e.endOffset-1],o=Node.DOCUMENT_POSITION_PRECEDING|Node.DOCUMENT_POSITION_CONTAINED_BY):(i=e.endContainer,o=Node.DOCUMENT_POSITION_PRECEDING),e.startContainer.childNodes[e.startOffset])e=e.startContainer.childNodes[e.startOffset],n.currentNode=e;else{var s=e.startContainer;e.startOffset===(s.nodeType===Node.TEXT_NODE?s.length:s.childNodes.length)?(e=e.startContainer,n.currentNode=e,n.lastChild(),e=n.nextNode()):(e=e.startContainer,n.currentNode=e)}if(e){if((e=n.currentNode)!==a)for(e=e.parentNode;e&&e!==a;)t(e)===NodeFilter.FILTER_REJECT&&(n.currentNode=e),e=e.parentNode;switch(t(e=n.currentNode)){case NodeFilter.FILTER_REJECT:for(e=n.nextSibling();!e&&n.parentNode();)e=n.nextSibling();break;case NodeFilter.FILTER_SKIP:e=n.nextNode()}for(;e&&(0===(t=i.compareDocumentPosition(e))||0!=(t&o));)r.push(e),e=n.nextNode()}return r},this.normalizeTextNodes=function(e){e&&e.nextSibling&&(e=r(e,e.nextSibling)),e&&e.previousSibling&&r(e.previousSibling,e)},this.rangeContainsNode=function(e,t){var n,o=t.ownerDocument.createRange(),r=t.ownerDocument.createRange();return o.setStart(e.startContainer,e.startOffset),o.setEnd(e.endContainer,e.endOffset),r.selectNodeContents(t),n=i(o,r),o.detach(),r.detach(),n},this.mergeIntoParent=a,this.removeUnwantedNodes=function e(t,n){var i,o=t.parentNode,r=t.firstChild,s=n(t);if(s===NodeFilter.FILTER_SKIP)return o;for(;r;)i=r.nextSibling,e(r,n),r=i;return o&&s===NodeFilter.FILTER_REJECT&&a(t),o},this.removeAllChildNodes=function(e){for(;e.firstChild;)e.removeChild(e.firstChild)},this.getElementsByTagNameNS=function(e,t,n){var i=[];for(e=e.getElementsByTagNameNS(t,n),i.length=n=e.length,t=0;t<n;t+=1)i[t]=e.item(t);return i},this.getElementsByTagName=function(e,t){var n,i,o,r=[];for(n=e.getElementsByTagName(t),r.length=o=n.length,i=0;i<o;i+=1)r[i]=n.item(i);return r},this.containsNode=function(e,t){return e===t||e.contains(t)},this.comparePoints=function(e,t,i,o){if(e===i)return o-t;var r=e.compareDocumentPosition(i);return 2===r?-1:4===r?1:10===r?(t=n(e,i))<o?1:-1:(o=n(i,e))<t?-1:1},this.adaptRangeDifferenceToZoomLevel=l,this.translateRect=function(e,t,n){return{top:l(e.top-t.top,n),left:l(e.left-t.left,n),bottom:l(e.bottom-t.top,n),right:l(e.right-t.left,n),width:l(e.width,n),height:l(e.height,n)}},this.getBoundingClientRect=function(t){var n,i=t.ownerDocument,o=e(),r=i.body;return!1!==o.unscaledRangeClientRects&&!o.rangeBCRIgnoresElementBCR||t.nodeType!==Node.ELEMENT_NODE?(u?n=u:u=n=i.createRange(),(o=n).selectNode(t),o.getBoundingClientRect()):(t=t.getBoundingClientRect(),o.elementBCRIgnoresBodyScroll?{left:t.left+r.scrollLeft,right:t.right+r.scrollLeft,top:t.top+r.scrollTop,bottom:t.bottom+r.scrollTop,width:t.width,height:t.height}:t)},this.mapKeyValObjOntoNode=function(e,t,n){Object.keys(t).forEach((function(i){var o=(r=i.split(":"))[1],r=n(r[0]),a=t[i];r?((o=e.getElementsByTagNameNS(r,o)[0])||(o=e.ownerDocument.createElementNS(r,i),e.appendChild(o)),o.textContent=a):runtime.log("Key ignored: "+i)}))},this.removeKeyElementsFromNode=function(e,t,n){t.forEach((function(t){var i=t.split(":"),o=i[1];(i=n(i[0]))?(o=e.getElementsByTagNameNS(i,o)[0])?o.parentNode.removeChild(o):runtime.log("Element for "+t+" not found."):runtime.log("Property Name ignored: "+t)}))},this.getKeyValRepresentationOfNode=function(e,t){for(var n,i={},o=e.firstElementChild;o;)(n=t(o.namespaceURI))&&(i[n+":"+o.localName]=o.textContent),o=o.nextElementSibling;return i},this.mapObjOntoNode=function e(t,n,i){Object.keys(n).forEach((function(o){var r,a=(r=o.split(":"))[1],s=i(r[0]),l=typeof(r=n[o]);"object"===l?Object.keys(r).length&&(o=s?t.getElementsByTagNameNS(s,a)[0]||t.ownerDocument.createElementNS(s,o):t.getElementsByTagName(a)[0]||t.ownerDocument.createElement(o),t.appendChild(o),e(o,r,i)):s&&(runtime.assert("number"===l||"string"===l,"attempting to map unsupported type '"+l+"' (key: "+o+")"),t.setAttributeNS(s,o,String(r)))}))},this.cloneEvent=function(e){var t=Object.create(null);return Object.keys(e.constructor.prototype).forEach((function(n){t[n]=e[n]})),t.prototype=e.constructor.prototype,t},this.getDirectChild=t,function(e){var t,n;null!==(n=runtime.getWindow())&&(t=n.navigator.appVersion.toLowerCase(),n=-1===t.indexOf("chrome")&&(-1!==t.indexOf("applewebkit")||-1!==t.indexOf("safari")),t=-1!==t.indexOf("msie")||-1!==t.indexOf("trident"),n||t)&&(e.containsNode=s)}(this)},core.DomUtils=new core.DomUtilsImpl}(),core.Cursor=function(e,t){function n(e){e.parentNode&&(l.push(e.previousSibling),l.push(e.nextSibling),e.parentNode.removeChild(e))}function i(e,t,n){if(t.nodeType===Node.TEXT_NODE){runtime.assert(Boolean(t),"putCursorIntoTextNode: invalid container");var i=t.parentNode;runtime.assert(Boolean(i),"putCursorIntoTextNode: container without parent"),runtime.assert(0<=n&&n<=t.length,"putCursorIntoTextNode: offset is out of bounds"),0===n?i.insertBefore(e,t):(n!==t.length&&t.splitText(n),i.insertBefore(e,t.nextSibling))}else t.nodeType===Node.ELEMENT_NODE&&t.insertBefore(e,t.childNodes.item(n));l.push(e.previousSibling),l.push(e.nextSibling)}var o,r,a=e.createElementNS("urn:webodf:names:cursor","cursor"),s=e.createElementNS("urn:webodf:names:cursor","anchor"),l=[],u=e.createRange(),d=core.DomUtils;this.getNode=function(){return a},this.getAnchorNode=function(){return s.parentNode?s:a},this.getSelectedRange=function(){return r?(u.setStartBefore(a),u.collapse(!0)):(u.setStartAfter(o?s:a),u.setEndBefore(o?a:s)),u},this.setSelectedRange=function(e,t){u&&u!==e&&u.detach(),u=e,o=!1!==t,(r=e.collapsed)?(n(s),n(a),i(a,e.startContainer,e.startOffset)):(n(s),n(a),i(o?a:s,e.endContainer,e.endOffset),i(o?s:a,e.startContainer,e.startOffset)),l.forEach(d.normalizeTextNodes),l.length=0},this.hasForwardSelection=function(){return o},this.remove=function(){n(a),l.forEach(d.normalizeTextNodes),l.length=0},a.setAttributeNS("urn:webodf:names:cursor","memberId",t),s.setAttributeNS("urn:webodf:names:cursor","memberId",t)},core.Destroyable=function(){},core.Destroyable.prototype.destroy=function(e){},core.EventSource=function(){},core.EventSource.prototype.subscribe=function(e,t){},core.EventSource.prototype.unsubscribe=function(e,t){},core.EventNotifier=function(e){function t(e){runtime.assert(!n.hasOwnProperty(e),'Duplicated event ids: "'+e+'" registered more than once.'),n[e]=[]}var n={};this.emit=function(e,t){var i,o;for(runtime.assert(n.hasOwnProperty(e),'unknown event fired "'+e+'"'),o=n[e],i=0;i<o.length;i+=1)o[i](t)},this.subscribe=function(e,t){runtime.assert(n.hasOwnProperty(e),'tried to subscribe to unknown event "'+e+'"'),n[e].push(t)},this.unsubscribe=function(e,t){var i;runtime.assert(n.hasOwnProperty(e),'tried to unsubscribe from unknown event "'+e+'"'),i=n[e].indexOf(t),runtime.assert(-1!==i,'tried to unsubscribe unknown callback from event "'+e+'"'),-1!==i&&n[e].splice(i,1)},this.register=t,e&&e.forEach(t)},core.ScheduledTask=function(e,t,n){function i(){a&&(n(r),a=!1)}function o(){i(),e.apply(void 0,s),s=null}var r,a=!1,s=[],l=!1;this.trigger=function(){runtime.assert(!1===l,"Can't trigger destroyed ScheduledTask instance"),s=Array.prototype.slice.call(arguments),a||(a=!0,r=t(o))},this.triggerImmediate=function(){runtime.assert(!1===l,"Can't trigger destroyed ScheduledTask instance"),s=Array.prototype.slice.call(arguments),o()},this.processRequests=function(){a&&o()},this.cancel=i,this.restart=function(){runtime.assert(!1===l,"Can't trigger destroyed ScheduledTask instance"),i(),a=!0,r=t(o)},this.destroy=function(e){i(),l=!0,e()}},function(){var e;core.Task={},core.Task.SUPPRESS_MANUAL_PROCESSING=!1,core.Task.processTasks=function(){core.Task.SUPPRESS_MANUAL_PROCESSING||e.performRedraw()},core.Task.createRedrawTask=function(t){return new core.ScheduledTask(t,e.requestRedrawTask,e.cancelRedrawTask)},core.Task.createTimeoutTask=function(e,t){return new core.ScheduledTask(e,(function(e){return runtime.setTimeout(e,t)}),runtime.clearTimeout)},e=new function(){var e={};this.requestRedrawTask=function(t){var n=runtime.requestAnimationFrame((function(){t(),delete e[n]}));return e[n]=t,n},this.performRedraw=function(){Object.keys(e).forEach((function(t){e[t](),runtime.cancelAnimationFrame(parseInt(t,10))})),e={}},this.cancelRedrawTask=function(t){runtime.cancelAnimationFrame(t),delete e[t]}}}(),core.EventSubscriptions=function(){function e(e,t,i){e.subscribe(t,i),n.push({eventSource:e,eventid:t,callback:i})}function t(){var e=[];n.forEach((function(e){e.eventSource.unsubscribe(e.eventid,e.callback)})),n.length=0,Object.keys(o).forEach((function(t){o[t].forEach((function(t){e.push(t.task.destroy)})),delete o[t]})),core.Async.destroyAll(e,(function(){})),i=new core.EventNotifier}var n=[],i=new core.EventNotifier,o={},r=0;this.addSubscription=e,this.addFrameSubscription=function(t,n,a){var s,l,u,d;for(o.hasOwnProperty(n)||(o[n]=[]),u=o[n],d=0;d<u.length;d+=1)if(u[d].eventSource===t){s=u[d];break}s||(l="s"+r,r+=1,i.register(l),s={frameEventId:l,eventSource:t,task:core.Task.createRedrawTask((function(){i.emit(l,void 0)}))},u.push(s),e(t,n,s.task.trigger)),i.subscribe(s.frameEventId,a)},this.unsubscribeAll=t,this.destroy=function(e){t(),e()}},core.LazyProperty=function(e){var t,n=!1;this.value=function(){return n||(t=e(),n=!0),t},this.reset=function(){n=!1}},core.LoopWatchDog=function(e,t){var n=Date.now(),i=0;this.check=function(){if(e&&Date.now()-n>e)throw runtime.log("alert","watchdog timeout"),"timeout!";if(0<t&&(i+=1)>t)throw runtime.log("alert","watchdog loop overflow"),"loop overflow"}},core.NodeFilterChain=function(e){var t=NodeFilter.FILTER_REJECT,n=NodeFilter.FILTER_ACCEPT;this.acceptNode=function(i){var o;for(o=0;o<e.length;o+=1)if(e[o].acceptNode(i)===t)return t;return n}},core.PositionIterator=function(e,t,n,i){function o(){var e=s.currentNode,t=e.nodeType;l=t===c?e.length-1:t===f?1:0}function r(){if(null===s.previousSibling()){if(!s.parentNode()||s.currentNode===e)return s.firstChild(),!1;l=0}else o();return!0}function a(){var t,n=s.currentNode;if(t=u(n),n!==e)for(n=n.parentNode;n&&n!==e;)u(n)===h&&(s.currentNode=n,t=h),n=n.parentNode;return t===h?(l=s.currentNode.nodeType===c?n.length:1,n=d.nextPosition()):n=t===p||d.nextPosition(),n&&runtime.assert(u(s.currentNode)===p,"moveToAcceptedNode did not result in walker being on an accepted node"),n}var s,l,u,d=this,c=Node.TEXT_NODE,f=Node.ELEMENT_NODE,p=NodeFilter.FILTER_ACCEPT,h=NodeFilter.FILTER_REJECT;this.nextPosition=function(){var t=s.currentNode,n=t.nodeType;if(t===e)return!1;if(0===l&&n===f)null===s.firstChild()&&(l=1);else if(n===c&&l+1<t.length)l+=1;else if(null!==s.nextSibling())l=0;else{if(!s.parentNode())return!1;l=1}return!0},this.previousPosition=function(){var t=!0,n=s.currentNode;return 0===l?t=r():n.nodeType===c?--l:null!==s.lastChild()?o():n===e?t=!1:l=0,t},this.previousNode=r,this.container=function(){var e=s.currentNode,t=e.nodeType;return 0===l&&t!==c&&(e=e.parentNode),e},this.rightNode=function(){var e=s.currentNode,t=e.nodeType;if(t===c&&l===e.length)for(e=e.nextSibling;e&&u(e)!==p;)e=e.nextSibling;else t===f&&1===l&&(e=null);return e},this.leftNode=function(){var e=s.currentNode;if(0===l)for(e=e.previousSibling;e&&u(e)!==p;)e=e.previousSibling;else if(e.nodeType===f)for(e=e.lastChild;e&&u(e)!==p;)e=e.previousSibling;return e},this.getCurrentNode=function(){return s.currentNode},this.unfilteredDomOffset=function(){if(s.currentNode.nodeType===c)return l;var e=0,t=s.currentNode;for(t=1===l?t.lastChild:t.previousSibling;t;)e+=1,t=t.previousSibling;return e},this.getPreviousSibling=function(){var e=s.currentNode,t=s.previousSibling();return s.currentNode=e,t},this.getNextSibling=function(){var e=s.currentNode,t=s.nextSibling();return s.currentNode=e,t},this.setPositionBeforeElement=function(e){return runtime.assert(Boolean(e),"setPositionBeforeElement called without element"),s.currentNode=e,l=0,a()},this.setUnfilteredPosition=function(e,t){return runtime.assert(Boolean(e),"PositionIterator.setUnfilteredPosition called without container"),s.currentNode=e,e.nodeType===c?(l=t,runtime.assert(t<=e.length,"Error in setPosition: "+t+" > "+e.length),runtime.assert(0<=t,"Error in setPosition: "+t+" < 0"),t===e.length&&(s.nextSibling()?l=0:s.parentNode()?l=1:runtime.assert(!1,"Error in setUnfilteredPosition: position not valid."))):t<e.childNodes.length?(s.currentNode=e.childNodes.item(t),l=0):l=1,a()},this.moveToEnd=function(){s.currentNode=e,l=1},this.moveToEndOfNode=function(e){e.nodeType===c?d.setUnfilteredPosition(e,e.length):(s.currentNode=e,l=1)},this.isBeforeNode=function(){return 0===l},this.getNodeFilter=function(){return u},(u=(n?new function(e){this.acceptNode=function(t){return!t||t.nodeType===c&&0===t.length?h:e.acceptNode(t)}}(n):new function(){this.acceptNode=function(e){return!e||e.nodeType===c&&0===e.length?h:p}}).acceptNode).acceptNode=u,t=t||NodeFilter.SHOW_ALL,runtime.assert(e.nodeType!==Node.TEXT_NODE,"Internet Explorer doesn't allow tree walker roots to be text nodes"),s=e.ownerDocument.createTreeWalker(e,t,u,i),l=0,null===s.firstChild()&&(l=1)},core.PositionFilter=function(){},core.PositionFilter.FilterResult={FILTER_ACCEPT:1,FILTER_REJECT:2,FILTER_SKIP:3},core.PositionFilter.prototype.acceptPosition=function(e){},core.PositionFilterChain=function(){var e=[],t=core.PositionFilter.FilterResult.FILTER_ACCEPT,n=core.PositionFilter.FilterResult.FILTER_REJECT;this.acceptPosition=function(i){var o;for(o=0;o<e.length;o+=1)if(e[o].acceptPosition(i)===n)return n;return t},this.addFilter=function(t){e.push(t)}},core.StepDirection={PREVIOUS:1,NEXT:2},core.StepIterator=function(e,t){function n(){u=null,c=d=void 0}function i(){return void 0===c&&(c=e.acceptPosition(t)===f),c}function o(e,i){return n(),t.setUnfilteredPosition(e,i)}function r(){return u||(u=t.container()),u}function a(){return void 0===d&&(d=t.unfilteredDomOffset()),d}function s(){for(n();t.nextPosition();)if(n(),i())return!0;return!1}function l(){for(n();t.previousPosition();)if(n(),i())return!0;return!1}var u,d,c,f=core.PositionFilter.FilterResult.FILTER_ACCEPT,p=core.StepDirection.NEXT;this.isStep=i,this.setPosition=o,this.container=r,this.offset=a,this.nextStep=s,this.previousStep=l,this.advanceStep=function(e){return e===p?s():l()},this.roundToClosestStep=function(){var e,t,n=i();return n||(e=r(),t=a(),(n=l())||(o(e,t),n=s())),n},this.roundToPreviousStep=function(){var e=i();return e||(e=l()),e},this.roundToNextStep=function(){var e=i();return e||(e=s()),e},this.leftNode=function(){return t.leftNode()},this.snapshot=function(){return new core.StepIterator.StepSnapshot(r(),a())},this.restore=function(e){o(e.container,e.offset)}},core.StepIterator.StepSnapshot=function(e,t){this.container=e,this.offset=t},core.Utils=function(){this.hashString=function(e){var t,n,i=0;for(t=0,n=e.length;t<n;t+=1)i=(i<<5)-i+e.charCodeAt(t),i|=0;return i},this.mergeObjects=function(e,t){return Object.keys(t).forEach((function(n){e[n]=function e(t,n){if(n&&Array.isArray(n)){if(t=t||[],!Array.isArray(t))throw"Destination is not an array.";t=t.concat(n.map((function(t){return e(null,t)})))}else if(n&&"object"==typeof n){if("object"!=typeof(t=t||{}))throw"Destination is not an object.";Object.keys(n).forEach((function(i){t[i]=e(t[i],n[i])}))}else t=n;return t}(e[n],t[n])})),e}},core.Zip=function(e,t){function n(e,t){var n=a.file(e);n?t(null,n.asUint8Array()):t(e+" not found.",null)}function i(e,t){n(e,(function(e,n){if(e||null===n)return t(e,null);var i=runtime.byteArrayToString(n,"utf8");t(null,i)}))}function o(e,t){try{e(a.generate({type:"uint8array",compression:"STORE"}))}catch(e){t(e.message)}}function r(e,t){o((function(n){runtime.writeFile(e,n,t)}),t)}var a,s=this,l=new core.Base64;this.load=n,this.save=function(e,t,n,i){a.file(e,t,{date:i,compression:n?"DEFLATE":"STORE"})},this.remove=function(e){var t=null!==a.file(e);return a.remove(e),t},this.write=function(t){r(e,t)},this.writeAs=r,this.createByteArray=o,this.loadContentXmlAsFragments=function(e,t){i(e,(function(e,n){if(e)return t.rootElementReady(e);t.rootElementReady(null,n,!0)}))},this.loadAsString=i,this.loadAsDOM=function(e,t){i(e,(function(e,n){if(e||null===n)t(e,null);else{var i=(new DOMParser).parseFromString(n,"text/xml");t(null,i)}}))},this.loadAsDataURL=function(e,t,i){n(e,(function(e,n){if(e||!n)return i(e,null);var o,r=0;for(t||(t=80===n[1]&&78===n[2]&&71===n[3]?"image/png":255===n[0]&&216===n[1]&&255===n[2]?"image/jpeg":71===n[0]&&73===n[1]&&70===n[2]?"image/gif":""),o="data:"+t+";base64,";r<n.length;)o+=l.convertUTF8ArrayToBase64(n.subarray(r,Math.min(r+45e3,n.length))),r+=45e3;i(null,o)}))},this.getEntries=function(){return Object.keys(a.files).map((function(e){return{filename:e,date:a.files[e].date}}))},a=new externs.JSZip,null!==t&&runtime.readFile(e,"binary",(function(n,i){if("string"==typeof i&&(n="file was read as a string. Should be Uint8Array."),n||!i||0===i.length)t("File '"+e+"' cannot be read. Err: "+(n||"[none]"),s);else try{a.load(i,{checkCRC32:!1}),t(null,s)}catch(e){t(e.message,s)}}))},core.SimpleClientRect=null,gui.CommonConstraints={EDIT:{ANNOTATIONS:{ONLY_DELETE_OWN:"onlyDeleteOwn"},REVIEW_MODE:"reviewMode"}},gui.SessionConstraints=function(){function e(e){t.hasOwnProperty(e)||(t[e]=!1,n.register(e))}var t={},n=new core.EventNotifier;this.registerConstraint=e,this.subscribe=function(t,i){e(t),n.subscribe(t,i)},this.unsubscribe=function(e,t){n.unsubscribe(e,t)},this.setState=function(e,i){runtime.assert(!0===t.hasOwnProperty(e),"No such constraint"),t[e]!==i&&(t[e]=i,n.emit(e,i))},this.getState=function(e){return runtime.assert(!0===t.hasOwnProperty(e),"No such constraint"),t[e]}},gui.BlacklistNamespaceNodeFilter=function(e){var t={},n=NodeFilter.FILTER_REJECT,i=NodeFilter.FILTER_ACCEPT;this.acceptNode=function(e){return!e||t.hasOwnProperty(e.namespaceURI)?n:i},e.forEach((function(e){t[e]=!0}))},odf.Namespaces={namespaceMap:{config:"urn:oasis:names:tc:opendocument:xmlns:config:1.0",db:"urn:oasis:names:tc:opendocument:xmlns:database:1.0",dc:"http://purl.org/dc/elements/1.1/",dr3d:"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0",draw:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",chart:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",fo:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",form:"urn:oasis:names:tc:opendocument:xmlns:form:1.0",math:"http://www.w3.org/1998/Math/MathML",meta:"urn:oasis:names:tc:opendocument:xmlns:meta:1.0",number:"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0",office:"urn:oasis:names:tc:opendocument:xmlns:office:1.0",presentation:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",style:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",svg:"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0",table:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",text:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",xforms:"http://www.w3.org/2002/xforms",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},prefixMap:{},configns:"urn:oasis:names:tc:opendocument:xmlns:config:1.0",dbns:"urn:oasis:names:tc:opendocument:xmlns:database:1.0",dcns:"http://purl.org/dc/elements/1.1/",dr3dns:"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0",drawns:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",chartns:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",fons:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",formns:"urn:oasis:names:tc:opendocument:xmlns:form:1.0",mathns:"http://www.w3.org/1998/Math/MathML",metans:"urn:oasis:names:tc:opendocument:xmlns:meta:1.0",numberns:"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0",officens:"urn:oasis:names:tc:opendocument:xmlns:office:1.0",presentationns:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",stylens:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",svgns:"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0",tablens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",textns:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",xformsns:"http://www.w3.org/2002/xforms",xlinkns:"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/XML/1998/namespace"},function(){var e,t=odf.Namespaces.namespaceMap,n=odf.Namespaces.prefixMap;for(e in t)t.hasOwnProperty(e)&&(n[t[e]]=e)}(),odf.Namespaces.forEachPrefix=function(e){var t,n=odf.Namespaces.namespaceMap;for(t in n)n.hasOwnProperty(t)&&e(t,n[t])},odf.Namespaces.lookupNamespaceURI=function(e){var t=null;return odf.Namespaces.namespaceMap.hasOwnProperty(e)&&(t=odf.Namespaces.namespaceMap[e]),t},odf.Namespaces.lookupPrefix=function(e){var t=odf.Namespaces.prefixMap;return t.hasOwnProperty(e)?t[e]:null},odf.Namespaces.lookupNamespaceURI.lookupNamespaceURI=odf.Namespaces.lookupNamespaceURI,odf.OdfSchemaImpl=function(){var e=[["config:config-item","uncategorized"],["form:item","object"],["form:option","uncategorized"],["math:math","field"],["meta:user-defined","uncategorized"],["number:currency-symbol","uncategorized"],["number:embedded-text","uncategorized"],["number:text","uncategorized"],["presentation:date-time-decl","uncategorized"],["presentation:footer-decl","uncategorized"],["presentation:header-decl","uncategorized"],["svg:desc","text"],["svg:title","text"],["table:desc","uncategorized"],["table:title","uncategorized"],["text:a","text"],["text:author-initials","field"],["text:author-name","field"],["text:bibliography-mark","field"],["text:bookmark-ref","field"],["text:chapter","field"],["text:character-count","field"],["text:conditional-text","field"],["text:creation-date","field"],["text:creation-time","field"],["text:creator","field"],["text:database-display","field"],["text:database-name","field"],["text:database-row-number","field"],["text:date","field"],["text:dde-connection","field"],["text:description","field"],["text:editing-cycles","field"],["text:editing-duration","field"],["text:execute-macro","uncategorized"],["text:expression","uncategorized"],["text:file-name","field"],["text:h","text"],["text:hidden-paragraph","text"],["text:hidden-text","text"],["text:image-count","field"],["text:index-entry-span","uncategorized"],["text:index-title-template","uncategorized"],["text:initial-creator","field"],["text:keywords","field"],["text:linenumbering-separator","style"],["text:measure","uncategorized"],["text:meta","uncategorized"],["text:meta-field","uncategorized"],["text:modification-date","field"],["text:modification-time","field"],["text:note-citation","field"],["text:note-continuation-notice-backward","style"],["text:note-continuation-notice-forward","style"],["text:note-ref","field"],["text:object-count","field"],["text:p","text"],["text:page-continuation","uncategorized"],["text:page-count","field"],["text:page-number","field"],["text:page-variable-get","field"],["text:page-variable-set","field"],["text:paragraph-count","field"],["text:placeholder","field"],["text:print-date","field"],["text:print-time","field"],["text:printed-by","field"],["text:reference-ref","field"],["text:ruby-base","text"],["text:ruby-text","text"],["text:script","text"],["text:sender-city","field"],["text:sender-company","field"],["text:sender-country","field"],["text:sender-email","field"],["text:sender-fax","field"],["text:sender-firstname","field"],["text:sender-initials","field"],["text:sender-lastname","field"],["text:sender-phone-private","field"],["text:sender-phone-work","field"],["text:sender-position","field"],["text:sender-postal-code","field"],["text:sender-state-or-province","field"],["text:sender-street","field"],["text:sender-title","field"],["text:sequence","uncategorized"],["text:sequence-ref","uncategorized"],["text:sheet-name","uncategorized"],["text:span","text"],["text:subject","field"],["text:table-count","field"],["text:table-formula","deprecated"],["text:template-name","uncategorized"],["text:text-input","field"],["text:time","field"],["text:title","field"],["text:user-defined","field"],["text:user-field-get","field"],["text:user-field-input","field"],["text:variable-get","field"],["text:variable-input","field"],["text:variable-set","field"],["text:word-count","field"],["xforms:model","uncategorized"]],t={};this.isTextContainer=function(e,n){return"text"===t[e+":"+n]},this.isField=function(e,n){return"field"===t[e+":"+n]},this.getFields=function(){return e.filter((function(e){return"field"===e[1]})).map((function(e){return e[0]}))},e.forEach((function(e){var n=e[1],i=e[0].split(":");e=i[0],i=i[1];var o=odf.Namespaces.lookupNamespaceURI(e);o?t[o+":"+i]=n:runtime.log("DEBUG: OdfSchema - unknown prefix '"+e+"'")}))},odf.OdfSchema=new odf.OdfSchemaImpl,odf.OdfUtilsImpl=function(){function e(e){return"image"===(e&&e.localName)&&e.namespaceURI===P}function t(e){return null!==e&&e.nodeType===Node.ELEMENT_NODE&&"frame"===e.localName&&e.namespaceURI===P&&"as-char"===e.getAttributeNS(_,"anchor-type")}function n(e){var t;return(t="annotation"===(e&&e.localName)&&e.namespaceURI===odf.Namespaces.officens)||(t="div"===(e&&e.localName)&&"annotationWrapper"===e.className),t}function i(e){return"a"===(e&&e.localName)&&e.namespaceURI===_}function o(e){var t=e&&e.localName;return("p"===t||"h"===t)&&e.namespaceURI===_}function r(e,t){for(e&&void 0!==t&&!o(e)&&e.childNodes.item(t)&&(e=e.childNodes.item(t));e&&!o(e);)e=e.parentNode;return e}function a(e,t){for(;e&&e!==t;){if(e.namespaceURI===odf.Namespaces.officens&&"annotation"===e.localName)return e;e=e.parentNode}return null}function s(e){return/^[ \t\r\n]+$/.test(e)}function l(e){if(null===e||e.nodeType!==Node.ELEMENT_NODE)return!1;var t=e.localName;return F.isTextContainer(e.namespaceURI,t)||"span"===t&&"webodf-annotationHighlight"===e.className}function u(e){return null!==e&&e.nodeType===Node.ELEMENT_NODE&&F.isField(e.namespaceURI,e.localName)}function d(e){var t=e&&e.localName,n=!1;return t&&(e=e.namespaceURI)===_&&(n="s"===t||"tab"===t||"line-break"===t),n}function c(e){return d(e)||u(e)||t(e)||n(e)}function f(e){var t=e&&e.localName,n=!1;return t&&(e=e.namespaceURI)===_&&(n="s"===t),n}function p(e){return-1!==I.indexOf(e.namespaceURI)}function h(e){for(;null!==e.firstChild&&l(e);)e=e.firstChild;return e}function m(e){for(;null!==e.lastChild&&l(e);)e=e.lastChild;return e}function g(e){for(;!o(e)&&null===e.previousSibling;)e=e.parentNode;return o(e)?null:m(e.previousSibling)}function b(e){for(;!o(e)&&null===e.nextSibling;)e=e.parentNode;return o(e)?null:h(e.nextSibling)}function y(e){for(var t=!1;e;)if(e.nodeType===Node.TEXT_NODE){if(0!==e.length)return!s(e.data.substr(e.length-1,1));e=g(e)}else c(e)?(t=!1===f(e),e=null):e=g(e);return t}function v(e){var t=!1;for(e=e&&h(e);e;){if(0<(e.nodeType===Node.TEXT_NODE?e.length:0)&&!s(e.data)){t=!0;break}if(c(e)){t=!0;break}e=b(e)}return t}function S(e,t){return!!s(e.data.substr(t))&&!v(b(e))}function C(e,t){var n,i=e.data;return!(!s(i[t])||c(e.parentNode)||(0<t?s(i[t-1])||(n=!0):y(g(e))&&(n=!0),!0!==n||S(e,t)))}function N(e){return(e=/(-?[0-9]*[0-9][0-9]*(\.[0-9]*)?|0+\.[0-9]*[1-9][0-9]*|\.[0-9]*[1-9][0-9]*)((cm)|(mm)|(in)|(pt)|(pc)|(px)|(%))/.exec(e))?{value:parseFloat(e[1]),unit:e[3]}:null}function x(e){return(e=N(e))&&(0>e.value||"%"===e.unit)?null:e}function w(e){return(e=N(e))&&"%"!==e.unit?null:e}function E(e){switch(e.namespaceURI){case odf.Namespaces.drawns:case odf.Namespaces.svgns:case odf.Namespaces.dr3dns:return!1;case odf.Namespaces.textns:switch(e.localName){case"note-body":case"ruby-text":return!1}break;case odf.Namespaces.officens:switch(e.localName){case"annotation":case"binary-data":case"event-listeners":return!1}break;default:switch(e.localName){case"cursor":case"editinfo":return!1}}return!0}function T(e){return Boolean(r(e)&&(!s(e.textContent)||C(e,0)))}function O(e,t){for(;0<t.length&&!k.rangeContainsNode(e,t[0]);)t.shift();for(;0<t.length&&!k.rangeContainsNode(e,t[t.length-1]);)t.pop()}function A(e,t,i){var o;return o=k.getNodesInRange(e,(function(e){var t=NodeFilter.FILTER_REJECT;return d(e.parentNode)||u(e.parentNode)||n(e)?t=NodeFilter.FILTER_REJECT:e.nodeType===Node.TEXT_NODE?(i||T(e))&&(t=NodeFilter.FILTER_ACCEPT):c(e)?t=NodeFilter.FILTER_ACCEPT:(E(e)||l(e))&&(t=NodeFilter.FILTER_SKIP),t}),NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT),t||O(e,o),o}function R(e,t,i){for(;e;){if(i(e)){t[0]!==e&&t.unshift(e);break}if(n(e))break;e=e.parentNode}}var _=odf.Namespaces.textns,P=odf.Namespaces.drawns,D=odf.Namespaces.xlinkns,k=core.DomUtils,I=[odf.Namespaces.dbns,odf.Namespaces.dcns,odf.Namespaces.dr3dns,odf.Namespaces.drawns,odf.Namespaces.chartns,odf.Namespaces.formns,odf.Namespaces.numberns,odf.Namespaces.officens,odf.Namespaces.presentationns,odf.Namespaces.stylens,odf.Namespaces.svgns,odf.Namespaces.tablens,odf.Namespaces.textns],F=odf.OdfSchema;this.isImage=e,this.isCharacterFrame=t,this.isInlineRoot=n,this.isTextSpan=function(e){return"span"===(e&&e.localName)&&e.namespaceURI===_},this.isHyperlink=i,this.getHyperlinkTarget=function(e){return e.getAttributeNS(D,"href")||""},this.isParagraph=o,this.getParagraphElement=r,this.getParentAnnotation=a,this.isWithinAnnotation=function(e,t){return Boolean(a(e,t))},this.getAnnotationCreator=function(e){return e.getElementsByTagNameNS(odf.Namespaces.dcns,"creator")[0].textContent},this.isListItem=function(e){return"list-item"===(e&&e.localName)&&e.namespaceURI===_},this.isLineBreak=function(e){return"line-break"===(e&&e.localName)&&e.namespaceURI===_},this.isODFWhitespace=s,this.isGroupingElement=l,this.isFieldElement=u,this.isCharacterElement=d,this.isAnchoredAsCharacterElement=c,this.isSpaceElement=f,this.isODFNode=p,this.hasNoODFContent=function e(t){if(d(t)||u(t))return!1;if(l(t.parentNode)&&t.nodeType===Node.TEXT_NODE)return 0===t.textContent.length;for(t=t.firstChild;t;){if(p(t)||!e(t))return!1;t=t.nextSibling}return!0},this.firstChild=h,this.lastChild=m,this.previousNode=g,this.nextNode=b,this.scanLeftForNonSpace=y,this.lookLeftForCharacter=function(e){var t,n=t=0;return e.nodeType===Node.TEXT_NODE&&(n=e.length),0<n?t=s((t=e.data).substr(n-1,1))?1===n?y(g(e))?2:0:s(t.substr(n-2,1))?0:2:1:c(e)&&(t=1),t},this.lookRightForCharacter=function(e){var t=!1,n=0;return e&&e.nodeType===Node.TEXT_NODE&&(n=e.length),0<n?t=!s(e.data.substr(0,1)):c(e)&&(t=!0),t},this.scanLeftForAnyCharacter=function(e){var t=!1;for(e=e&&m(e);e;){if(0<(e.nodeType===Node.TEXT_NODE?e.length:0)&&!s(e.data)){t=!0;break}if(c(e)){t=!0;break}e=g(e)}return t},this.scanRightForAnyCharacter=v,this.isTrailingWhitespace=S,this.isSignificantWhitespace=C,this.isDowngradableSpaceElement=function(e){return!!f(e)&&y(g(e))&&v(b(e))},this.parseLength=N,this.parseNonNegativeLength=x,this.parseFoFontSize=function(e){var t;return(t=(t=N(e))&&(0>=t.value||"%"===t.unit)?null:t)||w(e)},this.parseFoLineHeight=function(e){return x(e)||w(e)},this.isTextContentContainingNode=E,this.getTextNodes=function(e,t){var n;return n=k.getNodesInRange(e,(function(e){var t=NodeFilter.FILTER_REJECT;return e.nodeType===Node.TEXT_NODE?T(e)&&(t=NodeFilter.FILTER_ACCEPT):E(e)&&(t=NodeFilter.FILTER_SKIP),t}),NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT),t||O(e,n),n},this.getTextElements=A,this.getParagraphElements=function(e){var t;return t=k.getNodesInRange(e,(function(e){var t=NodeFilter.FILTER_REJECT;return o(e)?t=NodeFilter.FILTER_ACCEPT:(E(e)||l(e))&&(t=NodeFilter.FILTER_SKIP),t}),NodeFilter.SHOW_ELEMENT),R(e.startContainer,t,o),t},this.getImageElements=function(t){var n;return n=k.getNodesInRange(t,(function(t){var n=NodeFilter.FILTER_SKIP;return e(t)&&(n=NodeFilter.FILTER_ACCEPT),n}),NodeFilter.SHOW_ELEMENT),R(t.startContainer,n,e),n},this.getHyperlinkElements=function(e){var t=[],n=e.cloneRange();return e.collapsed&&e.endContainer.nodeType===Node.ELEMENT_NODE&&(e=function(e,t){var n=e;if(t<n.childNodes.length-1)n=n.childNodes[t+1];else{for(;!n.nextSibling;)n=n.parentNode;n=n.nextSibling}for(;n.firstChild;)n=n.firstChild;return n}(e.endContainer,e.endOffset)).nodeType===Node.TEXT_NODE&&n.setEnd(e,1),A(n,!0,!1).forEach((function(e){for(e=e.parentNode;!o(e);){if(i(e)&&-1===t.indexOf(e)){t.push(e);break}e=e.parentNode}})),n.detach(),t},this.getNormalizedFontFamilyName=function(e){return/^(["'])(?:.|[\n\r])*?\1$/.test(e)||(e=e.replace(/^[ \t\r\n\f]*((?:.|[\n\r])*?)[ \t\r\n\f]*$/,"$1"),/[ \t\r\n\f]/.test(e)&&(e="'"+e.replace(/[ \t\r\n\f]+/g," ")+"'")),e}},odf.OdfUtils=new odf.OdfUtilsImpl,gui.OdfTextBodyNodeFilter=function(){var e=odf.OdfUtils,t=Node.TEXT_NODE,n=NodeFilter.FILTER_REJECT,i=NodeFilter.FILTER_ACCEPT,o=odf.Namespaces.textns;this.acceptNode=function(r){if(r.nodeType===t){if(!e.isGroupingElement(r.parentNode))return n}else if(r.namespaceURI===o&&"tracked-changes"===r.localName)return n;return i}},xmldom.LSSerializerFilter=function(){},xmldom.LSSerializerFilter.prototype.acceptNode=function(e){},odf.OdfNodeFilter=function(){this.acceptNode=function(e){return"http://www.w3.org/1999/xhtml"===e.namespaceURI?NodeFilter.FILTER_SKIP:e.namespaceURI&&e.namespaceURI.match(/^urn:webodf:/)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}},xmldom.XPathIterator=function(){},xmldom.XPathIterator.prototype.next=function(){},xmldom.XPathIterator.prototype.reset=function(){},xmldom.XPath=createXPathSingleton(),odf.StyleInfo=function(){function e(t,n){var i,o,r,s,l,u=0;for((i=a[t.localName])&&(r=i[t.namespaceURI])&&(u=r.length),i=0;i<u;i+=1)s=(o=r[i]).ns,l=o.localname,(o=t.getAttributeNS(s,l))&&t.setAttributeNS(s,y[s]+l,n+o);for(r=t.firstElementChild;r;)e(r,n),r=r.nextElementSibling}function t(e,n){var i,o,r,s,l,u=0;for((i=a[e.localName])&&(r=i[e.namespaceURI])&&(u=r.length),i=0;i<u;i+=1)s=(o=r[i]).ns,l=o.localname,(o=e.getAttributeNS(s,l))&&(o=o.replace(n,""),e.setAttributeNS(s,y[s]+l,o));for(r=e.firstElementChild;r;)t(r,n),r=r.nextElementSibling}function n(e,t){var n,i,o,r,s,l=0;for((n=a[e.localName])&&(o=n[e.namespaceURI])&&(l=o.length),n=0;n<l;n+=1)i=(r=o[n]).ns,s=r.localname,(i=e.getAttributeNS(i,s))&&(t=t||{},r=r.keyname,t.hasOwnProperty(r)?t[r][i]=1:((s={})[i]=1,t[r]=s));return t}function i(e,t){var o;for(n(e,t),o=e.firstChild;o;)o.nodeType===Node.ELEMENT_NODE&&i(o,t),o=o.nextSibling}function o(e,t,n){this.key=e,this.name=t,this.family=n,this.requires={}}function r(e,t,n){var i=e+'"'+t,r=n[i];return r||(r=n[i]=new o(i,e,t)),r}var a,s=odf.Namespaces.chartns,l=odf.Namespaces.dbns,u=odf.Namespaces.dr3dns,d=odf.Namespaces.drawns,c=odf.Namespaces.formns,f=odf.Namespaces.numberns,p=odf.Namespaces.officens,h=odf.Namespaces.presentationns,m=odf.Namespaces.stylens,g=odf.Namespaces.tablens,b=odf.Namespaces.textns,y={"urn:oasis:names:tc:opendocument:xmlns:chart:1.0":"chart:","urn:oasis:names:tc:opendocument:xmlns:database:1.0":"db:","urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0":"dr3d:","urn:oasis:names:tc:opendocument:xmlns:drawing:1.0":"draw:","urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0":"fo:","urn:oasis:names:tc:opendocument:xmlns:form:1.0":"form:","urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0":"number:","urn:oasis:names:tc:opendocument:xmlns:office:1.0":"office:","urn:oasis:names:tc:opendocument:xmlns:presentation:1.0":"presentation:","urn:oasis:names:tc:opendocument:xmlns:style:1.0":"style:","urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0":"svg:","urn:oasis:names:tc:opendocument:xmlns:table:1.0":"table:","urn:oasis:names:tc:opendocument:xmlns:text:1.0":"chart:","http://www.w3.org/XML/1998/namespace":"xml:"},v={text:[{ens:m,en:"tab-stop",ans:m,a:"leader-text-style"},{ens:m,en:"drop-cap",ans:m,a:"style-name"},{ens:b,en:"notes-configuration",ans:b,a:"citation-body-style-name"},{ens:b,en:"notes-configuration",ans:b,a:"citation-style-name"},{ens:b,en:"a",ans:b,a:"style-name"},{ens:b,en:"alphabetical-index",ans:b,a:"style-name"},{ens:b,en:"linenumbering-configuration",ans:b,a:"style-name"},{ens:b,en:"list-level-style-number",ans:b,a:"style-name"},{ens:b,en:"ruby-text",ans:b,a:"style-name"},{ens:b,en:"span",ans:b,a:"style-name"},{ens:b,en:"a",ans:b,a:"visited-style-name"},{ens:m,en:"text-properties",ans:m,a:"text-line-through-text-style"},{ens:b,en:"alphabetical-index-source",ans:b,a:"main-entry-style-name"},{ens:b,en:"index-entry-bibliography",ans:b,a:"style-name"},{ens:b,en:"index-entry-chapter",ans:b,a:"style-name"},{ens:b,en:"index-entry-link-end",ans:b,a:"style-name"},{ens:b,en:"index-entry-link-start",ans:b,a:"style-name"},{ens:b,en:"index-entry-page-number",ans:b,a:"style-name"},{ens:b,en:"index-entry-span",ans:b,a:"style-name"},{ens:b,en:"index-entry-tab-stop",ans:b,a:"style-name"},{ens:b,en:"index-entry-text",ans:b,a:"style-name"},{ens:b,en:"index-title-template",ans:b,a:"style-name"},{ens:b,en:"list-level-style-bullet",ans:b,a:"style-name"},{ens:b,en:"outline-level-style",ans:b,a:"style-name"}],paragraph:[{ens:d,en:"caption",ans:d,a:"text-style-name"},{ens:d,en:"circle",ans:d,a:"text-style-name"},{ens:d,en:"connector",ans:d,a:"text-style-name"},{ens:d,en:"control",ans:d,a:"text-style-name"},{ens:d,en:"custom-shape",ans:d,a:"text-style-name"},{ens:d,en:"ellipse",ans:d,a:"text-style-name"},{ens:d,en:"frame",ans:d,a:"text-style-name"},{ens:d,en:"line",ans:d,a:"text-style-name"},{ens:d,en:"measure",ans:d,a:"text-style-name"},{ens:d,en:"path",ans:d,a:"text-style-name"},{ens:d,en:"polygon",ans:d,a:"text-style-name"},{ens:d,en:"polyline",ans:d,a:"text-style-name"},{ens:d,en:"rect",ans:d,a:"text-style-name"},{ens:d,en:"regular-polygon",ans:d,a:"text-style-name"},{ens:p,en:"annotation",ans:d,a:"text-style-name"},{ens:c,en:"column",ans:c,a:"text-style-name"},{ens:m,en:"style",ans:m,a:"next-style-name"},{ens:g,en:"body",ans:g,a:"paragraph-style-name"},{ens:g,en:"even-columns",ans:g,a:"paragraph-style-name"},{ens:g,en:"even-rows",ans:g,a:"paragraph-style-name"},{ens:g,en:"first-column",ans:g,a:"paragraph-style-name"},{ens:g,en:"first-row",ans:g,a:"paragraph-style-name"},{ens:g,en:"last-column",ans:g,a:"paragraph-style-name"},{ens:g,en:"last-row",ans:g,a:"paragraph-style-name"},{ens:g,en:"odd-columns",ans:g,a:"paragraph-style-name"},{ens:g,en:"odd-rows",ans:g,a:"paragraph-style-name"},{ens:b,en:"notes-configuration",ans:b,a:"default-style-name"},{ens:b,en:"alphabetical-index-entry-template",ans:b,a:"style-name"},{ens:b,en:"bibliography-entry-template",ans:b,a:"style-name"},{ens:b,en:"h",ans:b,a:"style-name"},{ens:b,en:"illustration-index-entry-template",ans:b,a:"style-name"},{ens:b,en:"index-source-style",ans:b,a:"style-name"},{ens:b,en:"object-index-entry-template",ans:b,a:"style-name"},{ens:b,en:"p",ans:b,a:"style-name"},{ens:b,en:"table-index-entry-template",ans:b,a:"style-name"},{ens:b,en:"table-of-content-entry-template",ans:b,a:"style-name"},{ens:b,en:"table-index-entry-template",ans:b,a:"style-name"},{ens:b,en:"user-index-entry-template",ans:b,a:"style-name"},{ens:m,en:"page-layout-properties",ans:m,a:"register-truth-ref-style-name"}],chart:[{ens:s,en:"axis",ans:s,a:"style-name"},{ens:s,en:"chart",ans:s,a:"style-name"},{ens:s,en:"data-label",ans:s,a:"style-name"},{ens:s,en:"data-point",ans:s,a:"style-name"},{ens:s,en:"equation",ans:s,a:"style-name"},{ens:s,en:"error-indicator",ans:s,a:"style-name"},{ens:s,en:"floor",ans:s,a:"style-name"},{ens:s,en:"footer",ans:s,a:"style-name"},{ens:s,en:"grid",ans:s,a:"style-name"},{ens:s,en:"legend",ans:s,a:"style-name"},{ens:s,en:"mean-value",ans:s,a:"style-name"},{ens:s,en:"plot-area",ans:s,a:"style-name"},{ens:s,en:"regression-curve",ans:s,a:"style-name"},{ens:s,en:"series",ans:s,a:"style-name"},{ens:s,en:"stock-gain-marker",ans:s,a:"style-name"},{ens:s,en:"stock-loss-marker",ans:s,a:"style-name"},{ens:s,en:"stock-range-line",ans:s,a:"style-name"},{ens:s,en:"subtitle",ans:s,a:"style-name"},{ens:s,en:"title",ans:s,a:"style-name"},{ens:s,en:"wall",ans:s,a:"style-name"}],section:[{ens:b,en:"alphabetical-index",ans:b,a:"style-name"},{ens:b,en:"bibliography",ans:b,a:"style-name"},{ens:b,en:"illustration-index",ans:b,a:"style-name"},{ens:b,en:"index-title",ans:b,a:"style-name"},{ens:b,en:"object-index",ans:b,a:"style-name"},{ens:b,en:"section",ans:b,a:"style-name"},{ens:b,en:"table-of-content",ans:b,a:"style-name"},{ens:b,en:"table-index",ans:b,a:"style-name"},{ens:b,en:"user-index",ans:b,a:"style-name"}],ruby:[{ens:b,en:"ruby",ans:b,a:"style-name"}],table:[{ens:l,en:"query",ans:l,a:"style-name"},{ens:l,en:"table-representation",ans:l,a:"style-name"},{ens:g,en:"background",ans:g,a:"style-name"},{ens:g,en:"table",ans:g,a:"style-name"}],"table-column":[{ens:l,en:"column",ans:l,a:"style-name"},{ens:g,en:"table-column",ans:g,a:"style-name"}],"table-row":[{ens:l,en:"query",ans:l,a:"default-row-style-name"},{ens:l,en:"table-representation",ans:l,a:"default-row-style-name"},{ens:g,en:"table-row",ans:g,a:"style-name"}],"table-cell":[{ens:l,en:"column",ans:l,a:"default-cell-style-name"},{ens:g,en:"table-column",ans:g,a:"default-cell-style-name"},{ens:g,en:"table-row",ans:g,a:"default-cell-style-name"},{ens:g,en:"body",ans:g,a:"style-name"},{ens:g,en:"covered-table-cell",ans:g,a:"style-name"},{ens:g,en:"even-columns",ans:g,a:"style-name"},{ens:g,en:"covered-table-cell",ans:g,a:"style-name"},{ens:g,en:"even-columns",ans:g,a:"style-name"},{ens:g,en:"even-rows",ans:g,a:"style-name"},{ens:g,en:"first-column",ans:g,a:"style-name"},{ens:g,en:"first-row",ans:g,a:"style-name"},{ens:g,en:"last-column",ans:g,a:"style-name"},{ens:g,en:"last-row",ans:g,a:"style-name"},{ens:g,en:"odd-columns",ans:g,a:"style-name"},{ens:g,en:"odd-rows",ans:g,a:"style-name"},{ens:g,en:"table-cell",ans:g,a:"style-name"}],graphic:[{ens:u,en:"cube",ans:d,a:"style-name"},{ens:u,en:"extrude",ans:d,a:"style-name"},{ens:u,en:"rotate",ans:d,a:"style-name"},{ens:u,en:"scene",ans:d,a:"style-name"},{ens:u,en:"sphere",ans:d,a:"style-name"},{ens:d,en:"caption",ans:d,a:"style-name"},{ens:d,en:"circle",ans:d,a:"style-name"},{ens:d,en:"connector",ans:d,a:"style-name"},{ens:d,en:"control",ans:d,a:"style-name"},{ens:d,en:"custom-shape",ans:d,a:"style-name"},{ens:d,en:"ellipse",ans:d,a:"style-name"},{ens:d,en:"frame",ans:d,a:"style-name"},{ens:d,en:"g",ans:d,a:"style-name"},{ens:d,en:"line",ans:d,a:"style-name"},{ens:d,en:"measure",ans:d,a:"style-name"},{ens:d,en:"page-thumbnail",ans:d,a:"style-name"},{ens:d,en:"path",ans:d,a:"style-name"},{ens:d,en:"polygon",ans:d,a:"style-name"},{ens:d,en:"polyline",ans:d,a:"style-name"},{ens:d,en:"rect",ans:d,a:"style-name"},{ens:d,en:"regular-polygon",ans:d,a:"style-name"},{ens:p,en:"annotation",ans:d,a:"style-name"}],presentation:[{ens:u,en:"cube",ans:h,a:"style-name"},{ens:u,en:"extrude",ans:h,a:"style-name"},{ens:u,en:"rotate",ans:h,a:"style-name"},{ens:u,en:"scene",ans:h,a:"style-name"},{ens:u,en:"sphere",ans:h,a:"style-name"},{ens:d,en:"caption",ans:h,a:"style-name"},{ens:d,en:"circle",ans:h,a:"style-name"},{ens:d,en:"connector",ans:h,a:"style-name"},{ens:d,en:"control",ans:h,a:"style-name"},{ens:d,en:"custom-shape",ans:h,a:"style-name"},{ens:d,en:"ellipse",ans:h,a:"style-name"},{ens:d,en:"frame",ans:h,a:"style-name"},{ens:d,en:"g",ans:h,a:"style-name"},{ens:d,en:"line",ans:h,a:"style-name"},{ens:d,en:"measure",ans:h,a:"style-name"},{ens:d,en:"page-thumbnail",ans:h,a:"style-name"},{ens:d,en:"path",ans:h,a:"style-name"},{ens:d,en:"polygon",ans:h,a:"style-name"},{ens:d,en:"polyline",ans:h,a:"style-name"},{ens:d,en:"rect",ans:h,a:"style-name"},{ens:d,en:"regular-polygon",ans:h,a:"style-name"},{ens:p,en:"annotation",ans:h,a:"style-name"}],"drawing-page":[{ens:d,en:"page",ans:d,a:"style-name"},{ens:h,en:"notes",ans:d,a:"style-name"},{ens:m,en:"handout-master",ans:d,a:"style-name"},{ens:m,en:"master-page",ans:d,a:"style-name"}],"list-style":[{ens:b,en:"list",ans:b,a:"style-name"},{ens:b,en:"numbered-paragraph",ans:b,a:"style-name"},{ens:b,en:"list-item",ans:b,a:"style-override"},{ens:m,en:"style",ans:m,a:"list-style-name"}],data:[{ens:m,en:"style",ans:m,a:"data-style-name"},{ens:m,en:"style",ans:m,a:"percentage-data-style-name"},{ens:h,en:"date-time-decl",ans:m,a:"data-style-name"},{ens:b,en:"creation-date",ans:m,a:"data-style-name"},{ens:b,en:"creation-time",ans:m,a:"data-style-name"},{ens:b,en:"database-display",ans:m,a:"data-style-name"},{ens:b,en:"date",ans:m,a:"data-style-name"},{ens:b,en:"editing-duration",ans:m,a:"data-style-name"},{ens:b,en:"expression",ans:m,a:"data-style-name"},{ens:b,en:"meta-field",ans:m,a:"data-style-name"},{ens:b,en:"modification-date",ans:m,a:"data-style-name"},{ens:b,en:"modification-time",ans:m,a:"data-style-name"},{ens:b,en:"print-date",ans:m,a:"data-style-name"},{ens:b,en:"print-time",ans:m,a:"data-style-name"},{ens:b,en:"table-formula",ans:m,a:"data-style-name"},{ens:b,en:"time",ans:m,a:"data-style-name"},{ens:b,en:"user-defined",ans:m,a:"data-style-name"},{ens:b,en:"user-field-get",ans:m,a:"data-style-name"},{ens:b,en:"user-field-input",ans:m,a:"data-style-name"},{ens:b,en:"variable-get",ans:m,a:"data-style-name"},{ens:b,en:"variable-input",ans:m,a:"data-style-name"},{ens:b,en:"variable-set",ans:m,a:"data-style-name"}],"page-layout":[{ens:h,en:"notes",ans:m,a:"page-layout-name"},{ens:m,en:"handout-master",ans:m,a:"page-layout-name"},{ens:m,en:"master-page",ans:m,a:"page-layout-name"}]},S=xmldom.XPath;this.collectUsedFontFaces=function e(t,n){function i(e){(e=r.getAttributeNS(m,e))&&(t[e]=!0)}var o,r,a=["font-name","font-name-asian","font-name-complex"];for(o=n&&n.firstElementChild;o;)r=o,a.forEach(i),e(t,r),o=o.nextElementSibling},this.changeFontFaceNames=function e(t,n){function i(e){var t=r.getAttributeNS(m,e);t&&n.hasOwnProperty(t)&&r.setAttributeNS(m,"style:"+e,n[t])}var o,r,a=["font-name","font-name-asian","font-name-complex"];for(o=t&&t.firstElementChild;o;)r=o,a.forEach(i),e(r,n),o=o.nextElementSibling},this.UsedStyleList=function(e,t){var n={};this.uses=function(e){var t=e.localName,i=e.getAttributeNS(d,"name")||e.getAttributeNS(m,"name");return e="style"===t?e.getAttributeNS(m,"family"):e.namespaceURI===f?"data":t,!!(e=n[e])&&0<e[i]},i(e,n),t&&function(e,t){var n=function e(t,n,i){var o,s,l,u,d,c=0;if(o=t.getAttributeNS(m,"name"),u=t.getAttributeNS(m,"family"),o&&u&&(n=r(o,u,i)),n)for((o=a[t.localName])&&(l=o[t.namespaceURI])&&(c=l.length),o=0;o<c;o+=1)s=(u=l[o]).ns,d=u.localname,(s=t.getAttributeNS(s,d))&&(u=r(s,u=u.keyname,i),n.requires[u.key]=u);for(t=t.firstElementChild;t;)e(t,n,i),t=t.nextElementSibling;return i}(e,null,{});Object.keys(n).forEach((function(e){e=n[e];var i=t[e.family];i&&i.hasOwnProperty(e.name)&&function e(t,n){var i=n[t.family];i||(i=n[t.family]={}),i[t.name]=1,Object.keys(t.requires).forEach((function(i){e(t.requires[i],n)}))}(e,t)}))}(t,n)},this.getStyleName=function(e,t){var n,i,o=a[t.localName];if(o&&(o=o[t.namespaceURI]))for(i=0;i<o.length;i+=1)if(o[i].keyname===e&&(o=o[i],t.hasAttributeNS(o.ns,o.localname))){n=t.getAttributeNS(o.ns,o.localname);break}return n},this.hasDerivedStyles=function(e,t,n){var i=n.getAttributeNS(m,"name");return n=n.getAttributeNS(m,"family"),!!S.getODFElementsWithXPath(e,'//style:*[@style:parent-style-name="'+i+'"][@style:family="'+n+'"]',t).length},this.prefixStyleNames=function(t,n,i){var o;if(t){for(o=t.firstChild;o;){if(o.nodeType===Node.ELEMENT_NODE){var r=o,a=n,s=r.getAttributeNS(d,"name"),l=void 0;s?l=d:(s=r.getAttributeNS(m,"name"))&&(l=m),l&&r.setAttributeNS(l,y[l]+"name",a+s)}o=o.nextSibling}e(t,n),i&&e(i,n)}},this.removePrefixFromStyleNames=function(e,n,i){var o=new RegExp("^"+n);if(e){for(n=e.firstChild;n;){if(n.nodeType===Node.ELEMENT_NODE){var r=n,a=o,s=r.getAttributeNS(d,"name"),l=void 0;s?l=d:(s=r.getAttributeNS(m,"name"))&&(l=m),l&&(s=s.replace(a,""),r.setAttributeNS(l,y[l]+"name",s))}n=n.nextSibling}t(e,o),i&&t(i,o)}},this.determineStylesForNode=n,a=function(){var e,t,n,i,o,r,a,s,l,u={};for(n in v)if(v.hasOwnProperty(n))for(t=(i=v[n]).length,e=0;e<t;e+=1)s=(o=i[e]).en,l=o.ens,u.hasOwnProperty(s)?r=u[s]:u[s]=r={},r.hasOwnProperty(l)?a=r[l]:r[l]=a=[],a.push({ns:o.ans,localname:o.a,keyname:n});return u}()},"function"!=typeof Object.create&&(Object.create=function(e){var t=function(){};return t.prototype=e,new t}),xmldom.LSSerializer=function(){function e(e){var t=e||{},n=function(e){var t,n={};for(t in e)e.hasOwnProperty(t)&&(n[e[t]]=t);return n}(e),i=[t],o=[n],r=0;this.push=function(){t=i[r+=1]=Object.create(t),n=o[r]=Object.create(n)},this.pop=function(){i.pop(),o.pop(),--r,t=i[r],n=o[r]},this.getLocalNamespaceDefinitions=function(){return n},this.getQName=function(e){var i,o=e.namespaceURI,r=0;if(!o)return e.localName;if(i=n[o])return i+":"+e.localName;do{if(i||!e.prefix?(i="ns"+r,r+=1):i=e.prefix,t[i]===o)break;if(!t[i]){t[i]=o,n[o]=i;break}i=null}while(null===i);return i+":"+e.localName}}function t(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&apos;").replace(/"/g,"&quot;")}function n(e,o){var r,a="",s=i.filter?i.filter.acceptNode(o):NodeFilter.FILTER_ACCEPT;if(s===NodeFilter.FILTER_ACCEPT&&o.nodeType===Node.ELEMENT_NODE){e.push(),r=e.getQName(o);var l,u,d,c,f=o.attributes,p="";for(l="<"+r,u=f.length,d=0;d<u;d+=1)"http://www.w3.org/2000/xmlns/"!==(c=f.item(d)).namespaceURI&&(i.filter?i.filter.acceptNode(c):NodeFilter.FILTER_ACCEPT)===NodeFilter.FILTER_ACCEPT&&(p+=" "+e.getQName(c)+'="'+(c="string"==typeof c.value?t(c.value):c.value)+'"');for(d in u=e.getLocalNamespaceDefinitions())u.hasOwnProperty(d)&&((f=u[d])?"xmlns"!==f&&(l+=" xmlns:"+u[d]+'="'+d+'"'):l+=' xmlns="'+d+'"');a+=l+(p+">")}if(s===NodeFilter.FILTER_ACCEPT||s===NodeFilter.FILTER_SKIP){for(s=o.firstChild;s;)a+=n(e,s),s=s.nextSibling;o.nodeValue&&(a+=t(o.nodeValue))}return r&&(a+="</"+r+">",e.pop()),a}var i=this;this.filter=null,this.writeToString=function(t,i){return t?n(new e(i),t):""}},function(){function e(e){var t,n=s.length;for(t=0;t<n;t+=1)if("urn:oasis:names:tc:opendocument:xmlns:office:1.0"===e.namespaceURI&&e.localName===s[t])return t;return-1}function t(e,t){var n=new o.UsedStyleList(e,t),i=new odf.OdfNodeFilter;this.acceptNode=function(e){var o=i.acceptNode(e);return o===NodeFilter.FILTER_ACCEPT&&e.parentNode===t&&e.nodeType===Node.ELEMENT_NODE&&(o=n.uses(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT),o}}function n(e,n){var i=new t(e,n);this.acceptNode=function(e){var t=i.acceptNode(e);return t!==NodeFilter.FILTER_ACCEPT||!e.parentNode||e.parentNode.namespaceURI!==odf.Namespaces.textns||"s"!==e.parentNode.localName&&"tab"!==e.parentNode.localName||(t=NodeFilter.FILTER_REJECT),t}}function i(t,n){if(n){var i,o=e(n),r=t.firstChild;if(-1!==o){for(;r&&!(-1!==(i=e(r))&&i>o);)r=r.nextSibling;t.insertBefore(n,r)}}}var o=new odf.StyleInfo,r=core.DomUtils,a=odf.Namespaces.stylens,s="meta settings scripts font-face-decls styles automatic-styles master-styles body".split(" "),l=Date.now()+"_webodf_",u=new core.Base64;odf.ODFElement=function(){},odf.ODFDocumentElement=function(){},odf.ODFDocumentElement.prototype=new odf.ODFElement,odf.ODFDocumentElement.prototype.constructor=odf.ODFDocumentElement,odf.ODFDocumentElement.prototype.fontFaceDecls=null,odf.ODFDocumentElement.prototype.manifest=null,odf.ODFDocumentElement.prototype.settings=null,odf.ODFDocumentElement.namespaceURI="urn:oasis:names:tc:opendocument:xmlns:office:1.0",odf.ODFDocumentElement.localName="document",odf.AnnotationElement=function(){},odf.OdfPart=function(e,t,n,i){var o=this;this.size=0,this.type=null,this.name=e,this.container=n,this.url=null,this.mimetype=t,this.onstatereadychange=this.document=null,this.EMPTY=0,this.LOADING=1,this.DONE=2,this.state=this.EMPTY,this.data="",this.load=function(){null!==i&&(this.mimetype=t,i.loadAsDataURL(e,t,(function(e,t){e&&runtime.log(e),o.url=t,o.onchange&&o.onchange(o),o.onstatereadychange&&o.onstatereadychange(o)})))}},odf.OdfPart.prototype.load=function(){},odf.OdfPart.prototype.getUrl=function(){return this.data?"data:;base64,"+u.toBase64(this.data):null},odf.OdfContainer=function e(s,d){function c(e){var t,n,i={},o=e.ownerDocument.createNodeIterator(e,NodeFilter.SHOW_ELEMENT,null,!1);for(e=o.nextNode();e;)"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===e.namespaceURI&&("annotation"===e.localName?(t=e.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","name"))&&(i.hasOwnProperty(t)?runtime.log("Warning: annotation name used more than once with <office:annotation/>: '"+t+"'"):i[t]=e):"annotation-end"===e.localName&&((t=e.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","name"))?i.hasOwnProperty(t)?(n=i[t]).annotationEndElement?runtime.log("Warning: annotation name used more than once with <office:annotation-end/>: '"+t+"'"):n.annotationEndElement=e:runtime.log("Warning: annotation end without an annotation start, name: '"+t+"'"):runtime.log("Warning: annotation end without a name found"))),e=o.nextNode()}function f(e,t){for(var n=e&&e.firstChild;n;)n.nodeType===Node.ELEMENT_NODE&&n.setAttributeNS("urn:webodf:names:scope","scope",t),n=n.nextSibling}function p(e,t){for(var n=(n=M.rootElement.meta)&&n.firstChild;n&&(n.namespaceURI!==e||n.localName!==t);)n=n.nextSibling;for(n=n&&n.firstChild;n&&n.nodeType!==Node.TEXT_NODE;)n=n.nextSibling;return n?n.data:null}function h(e){var t={};for(e=e.firstChild;e;)e.nodeType===Node.ELEMENT_NODE&&e.namespaceURI===a&&"font-face"===e.localName&&(t[e.getAttributeNS(a,"name")]=e),e=e.nextSibling;return t}function m(e,t){var n,i,o,r=null;if(e)for(n=(r=e.cloneNode(!0)).firstElementChild;n;)i=n.nextElementSibling,(o=n.getAttributeNS("urn:webodf:names:scope","scope"))&&o!==t&&r.removeChild(n),n=i;return r}function g(e,t){var n,i,r,s=null,l={};if(e)for(t.forEach((function(e){o.collectUsedFontFaces(l,e)})),n=(s=e.cloneNode(!0)).firstElementChild;n;)i=n.nextElementSibling,r=n.getAttributeNS(a,"name"),l[r]||s.removeChild(n),n=i;return s}function b(e){var t,n=M.rootElement.ownerDocument;if(e){!function e(t){for(var n,i=t.firstChild;i;)n=i.nextSibling,i.nodeType===Node.ELEMENT_NODE?e(i):i.nodeType===Node.PROCESSING_INSTRUCTION_NODE&&t.removeChild(i),i=n}(e.documentElement);try{t=n.importNode(e.documentElement,!0)}catch(e){}}return t}function y(e){M.state=e,M.onchange&&M.onchange(M),M.onstatereadychange&&M.onstatereadychange(M)}function v(e){F=null,M.rootElement=e,e.fontFaceDecls=r.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls"),e.styles=r.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","styles"),e.automaticStyles=r.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles"),e.masterStyles=r.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles"),e.body=r.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","body"),e.meta=r.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta"),e.settings=r.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","settings"),e.scripts=r.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","scripts"),c(e)}function S(t){var n,a=b(t),s=M.rootElement;a&&"document-styles"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI?(s.fontFaceDecls=r.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls"),i(s,s.fontFaceDecls),n=r.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","styles"),s.styles=n||t.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","styles"),i(s,s.styles),n=r.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles"),s.automaticStyles=n||t.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles"),f(s.automaticStyles,"document-styles"),i(s,s.automaticStyles),a=r.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles"),s.masterStyles=a||t.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles"),i(s,s.masterStyles),o.prefixStyleNames(s.automaticStyles,l,s.masterStyles)):y(e.INVALID)}function C(t){var n,s,l,u;if((t=b(t))&&"document-content"===t.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===t.namespaceURI){if(n=M.rootElement,l=r.getDirectChild(t,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls"),n.fontFaceDecls&&l){var d,c,p,m,g={};for(s=h(u=n.fontFaceDecls),m=h(l),l=l.firstElementChild;l;){if(d=l.nextElementSibling,l.namespaceURI===a&&"font-face"===l.localName)if(c=l.getAttributeNS(a,"name"),s.hasOwnProperty(c)){if(!l.isEqualNode(s[c])){var v=s,S=m,C=0,N=void 0;for(N=p=(p=c).replace(/\d+$/,"");v.hasOwnProperty(N)||S.hasOwnProperty(N);)N=p+(C+=1);p=N,l.setAttributeNS(a,"style:name",p),u.appendChild(l),s[p]=l,delete m[c],g[c]=p}}else u.appendChild(l),s[c]=l,delete m[c];l=d}u=g}else l&&(n.fontFaceDecls=l,i(n,l));if(f(s=r.getDirectChild(t,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles"),"document-content"),u&&o.changeFontFaceNames(s,u),n.automaticStyles&&s)for(u=s.firstChild;u;)n.automaticStyles.appendChild(u),u=s.firstChild;else s&&(n.automaticStyles=s,i(n,s));if(null===(t=r.getDirectChild(t,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","body")))throw"<office:body/> tag is mising.";n.body=t,i(n,n.body)}else y(e.INVALID)}function N(e){var t;(e=b(e))&&"document-meta"===e.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===e.namespaceURI&&((t=M.rootElement).meta=r.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta"),i(t,t.meta))}function x(e){var t;(e=b(e))&&"document-settings"===e.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===e.namespaceURI&&((t=M.rootElement).settings=r.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","settings"),i(t,t.settings))}function w(e){var t;if((e=b(e))&&"manifest"===e.localName&&"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"===e.namespaceURI)for((t=M.rootElement).manifest=e,e=t.manifest.firstElementChild;e;)"file-entry"===e.localName&&"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"===e.namespaceURI&&(B[e.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","full-path")]=e.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","media-type")),e=e.nextElementSibling}function E(e,t,n){var i;for(e=r.getElementsByTagName(e,t),i=0;i<e.length;i+=1)t=e[i],n.hasOwnProperty(t.namespaceURI)||t.parentNode.removeChild(t)}function T(e){E(e,"script",{"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0":!0,"urn:oasis:names:tc:opendocument:xmlns:office:1.0":!0,"urn:oasis:names:tc:opendocument:xmlns:table:1.0":!0,"urn:oasis:names:tc:opendocument:xmlns:text:1.0":!0,"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0":!0}),E(e,"style",{"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0":!0,"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0":!0,"urn:oasis:names:tc:opendocument:xmlns:style:1.0":!0})}function O(e){var t,n,i,o=e.firstElementChild,r=[],a=e.attributes,s=a.length;for(t=0;t<s;t+=1)n=(i=a.item(t)).localName.substr(0,2).toLowerCase(),null===i.namespaceURI&&"on"===n&&r.push(i);for(s=r.length,t=0;t<s;t+=1)e.removeAttributeNode(r[t]);for(;o;)O(o),o=o.nextElementSibling}function A(e){var t="";return odf.Namespaces.forEachPrefix((function(e,n){t+=" xmlns:"+e+'="'+n+'"'})),'<?xml version="1.0" encoding="UTF-8"?><office:'+e+" "+t+' office:version="1.2">'}function R(e,t){var n=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","manifest:file-entry");return n.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","manifest:full-path",e),n.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","manifest:media-type",t),n}function _(e,t){var n,o=(n=M.rootElement).meta;o||(n.meta=o=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta"),i(n,o)),n=o,e&&r.mapKeyValObjOntoNode(n,e,odf.Namespaces.lookupNamespaceURI),t&&r.removeKeyElementsFromNode(n,t,odf.Namespaces.lookupNamespaceURI)}function P(t,n){function i(e,t){var n;t||(t=e),n=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",t),s[e]=n,s.appendChild(n)}var o=new core.Zip("",null),r="application/vnd.oasis.opendocument."+t+(!0===n?"-template":""),a=runtime.byteArrayFromString(r,"utf8"),s=M.rootElement,l=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",t);return o.save("mimetype",a,!1,new Date),i("meta"),i("settings"),i("scripts"),i("fontFaceDecls","font-face-decls"),i("styles"),i("automaticStyles","automatic-styles"),i("masterStyles","master-styles"),i("body"),s.body.appendChild(l),B["/"]=r,B["settings.xml"]="text/xml",B["meta.xml"]="text/xml",B["styles.xml"]="text/xml",B["content.xml"]="text/xml",y(e.DONE),o}function D(){var e,i=new Date,r="";M.rootElement.settings&&M.rootElement.settings.firstElementChild&&(e=new xmldom.LSSerializer,r=A("document-settings"),e.filter=new odf.OdfNodeFilter,r+=e.writeToString(M.rootElement.settings,odf.Namespaces.namespaceMap),r+="</office:document-settings>"),(e=r)?(e=runtime.byteArrayFromString(e,"utf8"),I.save("settings.xml",e,!0,i)):I.remove("settings.xml"),r=runtime.getWindow(),e="WebODF/"+webodf.Version,r&&(e=e+" "+r.navigator.userAgent),_({"meta:generator":e},null),e=runtime.byteArrayFromString(function(){var e=new xmldom.LSSerializer,t=A("document-meta");return e.filter=new odf.OdfNodeFilter,(t+=e.writeToString(M.rootElement.meta,odf.Namespaces.namespaceMap))+"</office:document-meta>"}(),"utf8"),I.save("meta.xml",e,!0,i),e=runtime.byteArrayFromString(function(){var e,n,i,r=odf.Namespaces.namespaceMap,a=new xmldom.LSSerializer,s=A("document-styles");return n=m(M.rootElement.automaticStyles,"document-styles"),i=M.rootElement.masterStyles.cloneNode(!0),e=g(M.rootElement.fontFaceDecls,[i,M.rootElement.styles,n]),o.removePrefixFromStyleNames(n,l,i),a.filter=new t(i,n),s+=a.writeToString(e,r),s+=a.writeToString(M.rootElement.styles,r),s+=a.writeToString(n,r),(s+=a.writeToString(i,r))+"</office:document-styles>"}(),"utf8"),I.save("styles.xml",e,!0,i),e=runtime.byteArrayFromString(function(){var e,t,i=odf.Namespaces.namespaceMap,o=new xmldom.LSSerializer,r=A("document-content");return t=m(M.rootElement.automaticStyles,"document-content"),e=g(M.rootElement.fontFaceDecls,[t]),o.filter=new n(M.rootElement.body,t),r+=o.writeToString(e,i),r+=o.writeToString(t,i),(r+=o.writeToString(M.rootElement.body,i))+"</office:document-content>"}(),"utf8"),I.save("content.xml",e,!0,i),e=runtime.byteArrayFromString(function(){var e,t=runtime.parseXML('<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2"></manifest:manifest>'),n=t.documentElement,i=new xmldom.LSSerializer;for(e in B)B.hasOwnProperty(e)&&n.appendChild(R(e,B[e]));return i.filter=new odf.OdfNodeFilter,'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n'+i.writeToString(t,odf.Namespaces.namespaceMap)}(),"utf8"),I.save("META-INF/manifest.xml",e,!0,i)}function k(e,t){D(),I.writeAs(e,(function(e){t(e)}))}var I,F,M=this,B={},U="";this.onstatereadychange=d,this.state=this.onchange=null,this.getMetadata=p,this.setRootElement=v,this.getContentElement=function(){var e;if(F||(e=M.rootElement.body,F=r.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","text")||r.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","presentation")||r.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","spreadsheet")),!F)throw"Could not find content element in <office:body/>.";return F},this.getDocumentType=function(){var e=M.getContentElement();return e&&e.localName},this.isTemplate=function(){return"-template"===B["/"].substr(-9)},this.setIsTemplate=function(e){var t=B["/"];e!==("-template"===t.substr(-9))&&(t=e?t+"-template":t.substr(0,t.length-9),B["/"]=t,e=runtime.byteArrayFromString(t,"utf8"),I.save("mimetype",e,!1,new Date))},this.getPart=function(e){return new odf.OdfPart(e,B[e],M,I)},this.getPartData=function(e,t){I.load(e,t)},this.setMetadata=_,this.incrementEditingCycles=function(){var e=(e=p(odf.Namespaces.metans,"editing-cycles"))?parseInt(e,10):0;return isNaN(e)&&(e=0),_({"meta:editing-cycles":e+1},null),e+1},this.createByteArray=function(e,t){D(),I.createByteArray(e,t)},this.saveAs=k,this.save=function(e){k(U,e)},this.getUrl=function(){return U},this.setBlob=function(e,t,n){n=u.convertBase64ToByteArray(n),I.save(e,n,!1,new Date),B.hasOwnProperty(e)&&runtime.log(e+" has been overwritten."),B[e]=t},this.removeBlob=function(e){var t=I.remove(e);runtime.assert(t,"file is not found: "+e),delete B[e]},this.state=e.LOADING,this.rootElement=function(e){var t,n=document.createElementNS(e.namespaceURI,e.localName);for(t in e=new e.Type)e.hasOwnProperty(t)&&(n[t]=e[t]);return n}({Type:odf.ODFDocumentElement,namespaceURI:odf.ODFDocumentElement.namespaceURI,localName:odf.ODFDocumentElement.localName}),s===odf.OdfContainer.DocumentType.TEXT?I=P("text"):s===odf.OdfContainer.DocumentType.TEXT_TEMPLATE?I=P("text",!0):s===odf.OdfContainer.DocumentType.PRESENTATION?I=P("presentation"):s===odf.OdfContainer.DocumentType.PRESENTATION_TEMPLATE?I=P("presentation",!0):s===odf.OdfContainer.DocumentType.SPREADSHEET?I=P("spreadsheet"):s===odf.OdfContainer.DocumentType.SPREADSHEET_TEMPLATE?I=P("spreadsheet",!0):(U=s,I=new core.Zip(U,(function(t,n){I=n,t?function(t,n){runtime.loadXML(t,(function(t,i){if(t)n(t);else if(i){T(i),O(i.documentElement);var o=b(i);o&&"document"===o.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===o.namespaceURI?(v(o),y(e.DONE)):y(e.INVALID)}else n("No DOM was loaded.")}))}(U,(function(n){t&&(I.error=t+"\n"+n,y(e.INVALID))})):function t(n){var i=n.shift();i?I.loadAsDOM(i.path,(function(o,r){r&&(T(r),O(r.documentElement)),i.handler(r),M.state===e.INVALID?o?runtime.log("ERROR: Unable to load "+i.path+" - "+o):runtime.log("ERROR: Unable to load "+i.path):(o&&runtime.log("DEBUG: Unable to load "+i.path+" - "+o),t(n))})):(c(M.rootElement),y(e.DONE))}([{path:"styles.xml",handler:S},{path:"content.xml",handler:C},{path:"meta.xml",handler:N},{path:"settings.xml",handler:x},{path:"META-INF/manifest.xml",handler:w}])})))},odf.OdfContainer.EMPTY=0,odf.OdfContainer.LOADING=1,odf.OdfContainer.DONE=2,odf.OdfContainer.INVALID=3,odf.OdfContainer.SAVING=4,odf.OdfContainer.MODIFIED=5,odf.OdfContainer.getContainer=function(e){return new odf.OdfContainer(e,null)}}(),odf.OdfContainer.DocumentType={TEXT:1,TEXT_TEMPLATE:2,PRESENTATION:3,PRESENTATION_TEMPLATE:4,SPREADSHEET:5,SPREADSHEET_TEMPLATE:6},gui.AnnotatableCanvas=function(){},gui.AnnotatableCanvas.prototype.refreshSize=function(){},gui.AnnotatableCanvas.prototype.getZoomLevel=function(){},gui.AnnotatableCanvas.prototype.getSizer=function(){},gui.AnnotationViewManager=function(e,t,n,i){function o(e){var t=e.annotationEndElement,n=u.createRange(),i=e.getAttributeNS(odf.Namespaces.officens,"name");t&&(n.setStart(e,e.childNodes.length),n.setEnd(t,0),(e=d.getTextNodes(n,!1)).forEach((function(e){var t;e:{for(t=e.parentNode;t.namespaceURI!==odf.Namespaces.officens||"body"!==t.localName;){if("http://www.w3.org/1999/xhtml"===t.namespaceURI&&"webodf-annotationHighlight"===t.className&&t.getAttribute("annotation")===i){t=!0;break e}t=t.parentNode}t=!1}t||((t=u.createElement("span")).className="webodf-annotationHighlight",t.setAttribute("annotation",i),e.parentNode.replaceChild(t,e),t.appendChild(e))}))),n.detach()}function r(t){var i=e.getSizer();t?(n.style.display="inline-block",i.style.paddingRight=c.getComputedStyle(n).width):(n.style.display="none",i.style.paddingRight=0),e.refreshSize()}function a(){var t;for(t=0;t<l.length;t+=1){var i=(u=l[t]).parentNode,o=(d=i.nextElementSibling).nextElementSibling,r=i.parentNode,a=0,s=void(a=l[l.indexOf(u)-1]),u=e.getZoomLevel();i.style.left=(n.getBoundingClientRect().left-r.getBoundingClientRect().left)/u+"px",i.style.width=n.getBoundingClientRect().width/u+"px",d.style.width=parseFloat(i.style.left)-30+"px",a?(s=a.parentNode.getBoundingClientRect(),20>=(r.getBoundingClientRect().top-s.bottom)/u?i.style.top=Math.abs(r.getBoundingClientRect().top-s.bottom)/u+20+"px":i.style.top="0px"):i.style.top="0px",o.style.left=d.getBoundingClientRect().width/u+"px";var d=o.style,c=(r=o.getBoundingClientRect().left/u,a=o.getBoundingClientRect().top/u,0),f=0;c=(c=(s=i.getBoundingClientRect().left/u)-r)*c,f=(f=i.getBoundingClientRect().top/u-a)*f,r=Math.sqrt(c+f),d.width=r+"px",a=Math.asin((i.getBoundingClientRect().top-o.getBoundingClientRect().top)/(u*parseFloat(o.style.width))),o.style.transform="rotate("+a+"rad)",o.style.MozTransform="rotate("+a+"rad)",o.style.WebkitTransform="rotate("+a+"rad)",o.style.msTransform="rotate("+a+"rad)"}}function s(e){var t=l.indexOf(e);"div"===(i=e.parentNode.parentNode).localName&&(i.parentNode.insertBefore(e,i),i.parentNode.removeChild(i)),e=e.getAttributeNS(odf.Namespaces.officens,"name"),e=u.querySelectorAll('span.webodf-annotationHighlight[annotation="'+e+'"]');for(var n,i=0;i<e.length;i+=1){for(n=e.item(i);n.firstChild;)n.parentNode.insertBefore(n.firstChild,n);n.parentNode.removeChild(n)}-1!==t&&l.splice(t,1),0===l.length&&r(!1)}var l=[],u=t.ownerDocument,d=odf.OdfUtils,c=runtime.getWindow();runtime.assert(Boolean(c),"Expected to be run in an environment which has a global window, like a browser."),this.rerenderAnnotations=a,this.rehighlightAnnotations=function(){l.forEach((function(e){o(e)}))},this.getMinimumHeightForAnnotationPane=function(){return"none"!==n.style.display&&0<l.length?(l[l.length-1].parentNode.getBoundingClientRect().bottom-n.getBoundingClientRect().top)/e.getZoomLevel()+"px":null},this.addAnnotations=function(e){0!==e.length&&(r(!0),e.forEach((function(e){l.push(e);var t,n=u.createElement("div"),r=u.createElement("div"),a=u.createElement("div"),s=u.createElement("div");n.className="annotationWrapper",n.setAttribute("creator",d.getAnnotationCreator(e)),e.parentNode.insertBefore(n,e),r.className="annotationNote",r.appendChild(e),i&&((t=u.createElement("div")).className="annotationRemoveButton",r.appendChild(t)),a.className="annotationConnector horizontal",s.className="annotationConnector angular",n.appendChild(r),n.appendChild(a),n.appendChild(s),e.annotationEndElement&&o(e)})),l.sort((function(e,t){return 0!=(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING)?-1:1})),a())},this.forgetAnnotation=s,this.forgetAnnotations=function(){for(;l.length;)s(l[0])}},gui.Viewport=function(){},gui.Viewport.prototype.scrollIntoView=function(e,t){},gui.SingleScrollViewport=function(e){this.scrollIntoView=function(t,n){var i,o,r,a;a=e.offsetHeight-e.clientHeight,r=e.offsetWidth-e.clientWidth;var s=e.getBoundingClientRect();t&&s&&(i=s.left+5,o=s.top+5,r=s.right-(r+5),a=s.bottom-(a+5),n||t.top<o?e.scrollTop-=o-t.top:(t.top>a||t.bottom>a)&&(e.scrollTop=t.bottom-t.top<=a-o?e.scrollTop+(t.bottom-a):e.scrollTop+(t.top-o)),t.left<i?e.scrollLeft-=i-t.left:t.right>r&&(e.scrollLeft=t.right-t.left<=r-i?e.scrollLeft+(t.right-r):e.scrollLeft-(i-t.left)))}},function(){function e(t,n,o,r,a){var s,l,u=0;for(l in t)if(t.hasOwnProperty(l)){if(u===o){s=l;break}u+=1}s?n.getPartData(t[s].href,(function(l,u){if(l)runtime.log(l);else if(u){var d="@font-face { font-family: "+(t[s].family||s)+"; src: url(data:application/x-font-ttf;charset=binary;base64,"+i.convertUTF8ArrayToBase64(u)+') format("truetype"); }';try{r.insertRule(d,r.cssRules.length)}catch(e){runtime.log("Problem inserting rule in CSS: "+runtime.toJson(e)+"\nRule: "+d)}}else runtime.log("missing font data for "+t[s].href);e(t,n,o+1,r,a)})):a&&a()}var t=xmldom.XPath,n=odf.OdfUtils,i=new core.Base64;odf.FontLoader=function(){this.loadFonts=function(i,o){for(var r=i.rootElement.fontFaceDecls;o.cssRules.length;)o.deleteRule(o.cssRules.length-1);if(r){var a,s,l,u,d={};if(r)for(r=t.getODFElementsWithXPath(r,"style:font-face[svg:font-face-src]",odf.Namespaces.lookupNamespaceURI),a=0;a<r.length;a+=1)l=(s=r[a]).getAttributeNS(odf.Namespaces.stylens,"name"),u=n.getNormalizedFontFamilyName(s.getAttributeNS(odf.Namespaces.svgns,"font-family")),0<(s=t.getODFElementsWithXPath(s,"svg:font-face-src/svg:font-face-uri",odf.Namespaces.lookupNamespaceURI)).length&&(s=s[0].getAttributeNS(odf.Namespaces.xlinkns,"href"),d[l]={href:s,family:u});e(d,i,0,o)}}}}(),odf.Formatting=function(){function e(e){return(e=N[e])?S.mergeObjects({},e):{}}function t(){for(var e,t,n={},i=(i=c.rootElement.fontFaceDecls)&&i.firstElementChild;i;)(e=i.getAttributeNS(h,"name"))&&((t=i.getAttributeNS(p,"font-family"))||0<i.getElementsByTagNameNS(p,"font-face-uri").length)&&(n[e]=t),i=i.nextElementSibling;return n}function n(e){for(var t=c.rootElement.styles.firstElementChild;t;){if(t.namespaceURI===h&&"default-style"===t.localName&&t.getAttributeNS(h,"family")===e)return t;t=t.nextElementSibling}return null}function i(e,t,n){var i,o,r;for(n=n||[c.rootElement.automaticStyles,c.rootElement.styles],r=0;r<n.length;r+=1)for(i=(i=n[r]).firstElementChild;i;){if(o=i.getAttributeNS(h,"name"),i.namespaceURI===h&&"style"===i.localName&&i.getAttributeNS(h,"family")===t&&o===e||"list-style"===t&&i.namespaceURI===m&&"list-style"===i.localName&&o===e||"data"===t&&i.namespaceURI===g&&o===e)return i;i=i.nextElementSibling}return null}function o(e){for(var t,n,i,o,r={},a=e.firstElementChild;a;){if(a.namespaceURI===h)for(i=r[a.nodeName]={},n=a.attributes,t=0;t<n.length;t+=1)i[(o=n.item(t)).name]=o.value;a=a.nextElementSibling}for(n=e.attributes,t=0;t<n.length;t+=1)r[(o=n.item(t)).name]=o.value;return r}function r(t,r){for(var a,s=c.rootElement.styles,l={},u=t.getAttributeNS(h,"family"),d=t;d;)a=o(d),l=S.mergeObjects(a,l),d=(a=d.getAttributeNS(h,"parent-style-name"))?i(a,u,[s]):null;return(d=n(u))&&(a=o(d),l=S.mergeObjects(a,l)),!1!==r&&(a=e(u),l=S.mergeObjects(a,l)),l}function a(e,t){for(var n,i=e.nodeType===Node.TEXT_NODE?e.parentNode:e,o=[],r="",a=!1;i&&!y.isInlineRoot(i)&&i.parentNode!==c.rootElement;)!a&&y.isGroupingElement(i)&&(a=!0),(n=f.determineStylesForNode(i))&&o.push(n),i=i.parentNode;return a&&(o.forEach((function(e){Object.keys(e).forEach((function(t){Object.keys(e[t]).forEach((function(e){r+="|"+t+":"+e+"|"}))}))})),t&&(t[r]=o)),a?o:void 0}function s(e){var t={orderedStyles:[],styleProperties:{}};return e.forEach((function(e){Object.keys(e).forEach((function(n){var o,a=Object.keys(e[n])[0],s={name:a,family:n,displayName:void 0,isCommonStyle:!1};(o=i(a,n))?(n=r(o),t.styleProperties=S.mergeObjects(n,t.styleProperties),s.displayName=o.getAttributeNS(h,"display-name")||void 0,s.isCommonStyle=o.parentNode===c.rootElement.styles):runtime.log("No style element found for '"+a+"' of family '"+n+"'"),t.orderedStyles.push(s)}))})),t}function l(e,t){var n={},i=[];return t||(t={}),e.forEach((function(e){a(e,n)})),Object.keys(n).forEach((function(e){t[e]||(t[e]=s(n[e])),i.push(t[e])})),i}function u(e){for(var t=c.rootElement.masterStyles.firstElementChild;t&&(t.namespaceURI!==h||"master-page"!==t.localName||t.getAttributeNS(h,"name")!==e);)t=t.nextElementSibling;return t}function d(e,t){var n;return e&&(n=C.convertMeasure(e,"px")),void 0===n&&t&&(n=C.convertMeasure(t,"px")),n}var c,f=new odf.StyleInfo,p=odf.Namespaces.svgns,h=odf.Namespaces.stylens,m=odf.Namespaces.textns,g=odf.Namespaces.numberns,b=odf.Namespaces.fons,y=odf.OdfUtils,v=core.DomUtils,S=new core.Utils,C=new core.CSSUnits,N={paragraph:{"style:paragraph-properties":{"fo:text-align":"left"}}};this.getSystemDefaultStyleAttributes=e,this.setOdfContainer=function(e){c=e},this.getFontMap=t,this.getAvailableParagraphStyles=function(){for(var e,t,n=[],i=(i=c.rootElement.styles)&&i.firstElementChild;i;)"style"===i.localName&&i.namespaceURI===h&&"paragraph"===(e=i.getAttributeNS(h,"family"))&&(e=i.getAttributeNS(h,"name"),t=i.getAttributeNS(h,"display-name")||e,e&&t&&n.push({name:e,displayName:t})),i=i.nextElementSibling;return n},this.isStyleUsed=function(e){var t,n=c.rootElement;return t=f.hasDerivedStyles(n,odf.Namespaces.lookupNamespaceURI,e),e=new f.UsedStyleList(n.styles).uses(e)||new f.UsedStyleList(n.automaticStyles).uses(e)||new f.UsedStyleList(n.body).uses(e),t||e},this.getDefaultStyleElement=n,this.getStyleElement=i,this.getStyleAttributes=o,this.getInheritedStyleAttributes=r,this.getFirstCommonParentStyleNameOrSelf=function(e){var t,n=c.rootElement.styles;return(t=i(e,"paragraph",[c.rootElement.automaticStyles]))&&!(e=t.getAttributeNS(h,"parent-style-name"))?null:(t=i(e,"paragraph",[n]))?e:null},this.hasParagraphStyle=function(e){return Boolean(i(e,"paragraph"))},this.getAppliedStyles=l,this.getAppliedStylesForElement=function(e,t){return l([e],t)[0]},this.updateStyle=function(e,n){var i,o;v.mapObjOntoNode(e,n,odf.Namespaces.lookupNamespaceURI),(i=(i=n["style:text-properties"])&&i["style:font-name"])&&!t().hasOwnProperty(i)&&((o=e.ownerDocument.createElementNS(h,"style:font-face")).setAttributeNS(h,"style:name",i),o.setAttributeNS(p,"svg:font-family",i),c.rootElement.fontFaceDecls.appendChild(o))},this.createDerivedStyleObject=function(e,t,n){var r=i(e,t);return runtime.assert(Boolean(r),"No style element found for '"+e+"' of family '"+t+"'"),(e=r.parentNode===c.rootElement.styles?{"style:parent-style-name":e}:o(r))["style:family"]=t,S.mergeObjects(e,n),e},this.getDefaultTabStopDistance=function(){for(var e,t=(t=n("paragraph"))&&t.firstElementChild;t;)t.namespaceURI===h&&"paragraph-properties"===t.localName&&(e=t.getAttributeNS(h,"tab-stop-distance")),t=t.nextElementSibling;return e||(e="1.25cm"),y.parseNonNegativeLength(e)},this.getMasterPageElement=u,this.getContentSize=function(e,t){var n,o,r,a,s,l,f,p,m,g;e:{if(o=i(e,t),runtime.assert("paragraph"===t||"table"===t,"styleFamily must be either paragraph or table"),o&&((o=o.getAttributeNS(h,"master-page-name"))&&((n=u(o))||runtime.log("WARN: No master page definition found for "+o)),n||(n=u("Standard")),n||(n=c.rootElement.masterStyles.getElementsByTagNameNS(h,"master-page")[0])||runtime.log("WARN: Document has no master pages defined"),n))for(o=n.getAttributeNS(h,"page-layout-name"),r=c.rootElement.automaticStyles.getElementsByTagNameNS(h,"page-layout"),a=0;a<r.length;a+=1)if((n=r.item(a)).getAttributeNS(h,"name")===o)break e;n=null}return n||(n=v.getDirectChild(c.rootElement.styles,h,"default-page-layout")),(n=v.getDirectChild(n,h,"page-layout-properties"))?("landscape"===n.getAttributeNS(h,"print-orientation")?(o="29.7cm",r="21.001cm"):(o="21.001cm",r="29.7cm"),o=d(n.getAttributeNS(b,"page-width"),o),r=d(n.getAttributeNS(b,"page-height"),r),void 0===(a=d(n.getAttributeNS(b,"margin")))?(a=d(n.getAttributeNS(b,"margin-left"),"2cm"),s=d(n.getAttributeNS(b,"margin-right"),"2cm"),l=d(n.getAttributeNS(b,"margin-top"),"2cm"),f=d(n.getAttributeNS(b,"margin-bottom"),"2cm")):a=s=l=f=a,void 0===(p=d(n.getAttributeNS(b,"padding")))?(p=d(n.getAttributeNS(b,"padding-left"),"0cm"),m=d(n.getAttributeNS(b,"padding-right"),"0cm"),g=d(n.getAttributeNS(b,"padding-top"),"0cm"),n=d(n.getAttributeNS(b,"padding-bottom"),"0cm")):p=m=g=n=p):(o=d("21.001cm"),r=d("29.7cm"),a=s=l=f=a=d("2cm"),p=m=g=n=p=d("0cm")),{width:o-a-s-p-m,height:r-l-f-g-n}}},function(){var e=odf.Namespaces.stylens,t=odf.Namespaces.textns,n={graphic:"draw","drawing-page":"draw",paragraph:"text",presentation:"presentation",ruby:"text",section:"text",table:"table","table-cell":"table","table-column":"table","table-row":"table",text:"text",list:"text",page:"office"};odf.StyleTreeNode=function(e){this.derivedStyles={},this.element=e},odf.StyleTree=function(i,o){function r(n){var i,o,r,a={};if(!n)return a;for(n=n.firstElementChild;n;)(o=n.namespaceURI!==e||"style"!==n.localName&&"default-style"!==n.localName?n.namespaceURI===t&&"list-style"===n.localName?"list":n.namespaceURI!==e||"page-layout"!==n.localName&&"default-page-layout"!==n.localName?void 0:"page":n.getAttributeNS(e,"family"))&&((i=n.getAttributeNS(e,"name"))||(i=""),a.hasOwnProperty(o)?r=a[o]:a[o]=r={},r[i]=n),n=n.nextElementSibling;return a}function a(t,n){t&&Object.keys(t).forEach((function(i){!function t(n,i,o){var r,a,s;return i.hasOwnProperty(n)?(s=null,(a=(r=new odf.StyleTreeNode(i[n])).element.getAttributeNS(e,"parent-style-name"))&&(s=function e(t,n){if(t.hasOwnProperty(n))return t[n];var i,o=null,r=Object.keys(t);for(i=0;i<r.length&&!(o=e(t[r[i]].derivedStyles,n));i+=1);return o}(o,a)||t(a,i,o)),s?s.derivedStyles[n]=r:o[n]=r,delete i[n],r):null}(i,t,n)}))}var s,l,u,d={};this.getStyleTree=function(){return d},l=r(i),u=r(o),Object.keys(n).forEach((function(e){s=d[e]={},a(l[e],s),a(u[e],s)}))}}(),function(){function e(e,t){try{e.insertRule(t,e.cssRules.length)}catch(e){runtime.log("cannot load rule: "+t+" - "+e)}}function t(e,t){this.listCounterCount=0,this.contentRules=e,this.counterIdStack=[],this.continuedCounterIdStack=t}function n(n){function i(t,o,a,l){var u=o.namespaceURI===r&&"list"===o.localName,d=o.namespaceURI===r&&"list-item"===o.localName;if(u||d){if(u){var c,f,p;for(u=a+=1,l.listCounterCount+=1,d=t+"-level"+u+"-"+l.listCounterCount,o.setAttributeNS("urn:webodf:names:helper","counter-id",d),(c=l.continuedCounterIdStack.shift())||(s+=d+" 1 ",f='text|list[webodfhelper|counter-id="'+d+'"] > text|list-item:first-child > :not(text|list):first-child:before',f+="{",f+="counter-increment: "+(c=d)+" 0;",e(n,f+="}"));l.counterIdStack.length>=u;)l.counterIdStack.pop();for(l.counterIdStack.push(c),p=l.contentRules[u.toString()]||"",f=1;f<=u;f+=1)p=p.replace(f+"webodf-listLevel",l.counterIdStack[f-1]);f='text|list[webodfhelper|counter-id="'+d+'"] > text|list-item > :not(text|list):first-child:before',f+="{",f+=p,f+="counter-increment: "+c+";",e(n,f+="}")}for(o=o.firstElementChild;o;)i(t,o,a,l),o=o.nextElementSibling}else l.continuedCounterIdStack=[]}var o=0,s="",l={};this.createCounterRules=function(e,n,r){var s=n.getAttributeNS(a,"id"),u=[];r&&(r=r.getAttributeNS("urn:webodf:names:helper","counter-id"),u=l[r].slice(0)),e=new t(e,u),i(s=s?"Y"+s:"X"+(o+=1),n,0,e),l[s+"-level1-1"]=e.counterIdStack},this.initialiseCreatedCounters=function(){var t;t="office|document{counter-reset: "+s+";",e(n,t+="}")}}var i=odf.Namespaces.fons,o=odf.Namespaces.stylens,r=odf.Namespaces.textns,a=odf.Namespaces.xmlns,s={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"};odf.ListStyleToCss=function(){function t(e){var t=f.parseLength(e);return t?c.convert(t.value,t.unit,"px"):(runtime.log("Could not parse value '"+e+"'."),0)}function l(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function u(e,t){var n;return e&&(n=e.getAttributeNS(r,"style-name")),n===t}function d(e,t,i){t=t.getElementsByTagNameNS(r,"list"),e=new n(e);var d,c,f,p,h,m,g,b={};for(g=0;g<t.length;g+=1)if(m=(d=t.item(g)).getAttributeNS(r,"style-name")){f=d.getAttributeNS(r,"continue-numbering"),p=d.getAttributeNS(r,"continue-list"),(h=d.getAttributeNS(a,"id"))&&(b[h]=d),h=i[m].element.firstElementChild;for(var y=void 0,v={};h;){y=(y=h.getAttributeNS(r,"level"))&&parseInt(y,10);var S=h,C="",N=void 0,x=void 0,w=N=void 0;if("list-level-style-number"===S.localName){C=(O=S).getAttributeNS(o,"num-format"),N=O.getAttributeNS(o,"num-suffix")||"",x=O.getAttributeNS(o,"num-prefix")||"";var E="",T=O.getAttributeNS(r,"level"),O=O.getAttributeNS(r,"display-levels");if(x&&(E+='"'+l(x)+'"\n'),s.hasOwnProperty(C))for(T=T?parseInt(T,10):1,O=O?parseInt(O,10):1;0<O;)E+=" counter("+(T-O+1)+"webodf-listLevel,"+s[C]+")",1<O&&(E+='"."'),--O;else E=C?E+' "'+C+'"':E+' ""';C="content:"+E+' "'+l(N)+'"'}else"list-level-style-image"===S.localName?C="content: none":"list-level-style-bullet"===S.localName&&(C='content: "'+l(C=S.getAttributeNS(r,"bullet-char"))+'"');(N=S.getElementsByTagNameNS(o,"list-level-properties")[0])&&"label-alignment"===(x=N.getAttributeNS(r,"list-level-position-and-space-mode"))&&((N=N.getElementsByTagNameNS(o,"list-level-label-alignment")[0])&&(w=N.getAttributeNS(r,"label-followed-by")),"space"===w&&(C+=' "\\a0"')),v[y]="\n"+C+";\n",h=h.nextElementSibling}h=v,f&&!p&&u(c,m)?e.createCounterRules(h,d,c):p&&u(b[p],m)?e.createCounterRules(h,d,b[p]):e.createCounterRules(h,d),c=d}e.initialiseCreatedCounters()}var c=new core.CSSUnits,f=odf.OdfUtils;this.applyListStyles=function(n,a,s){var l;(l=a.list)&&Object.keys(l).forEach((function(a){for(var s=l[a].element.firstElementChild;s;){if(s.namespaceURI===r){var u=n,d=s,c='text|list[text|style-name="'+a+'"]',f=d.getAttributeNS(r,"level"),p=void 0,h=void 0,m=h=void 0,g=void 0,b=void 0,y=p=void 0,v=void 0,S=void 0,C=void 0;for(g=void 0,m=(h=d.getElementsByTagNameNS(o,"list-level-properties")[0])&&h.getAttributeNS(r,"list-level-position-and-space-mode"),g=h&&h.getElementsByTagNameNS(o,"list-level-label-alignment")[0],p=f=f&&parseInt(f,10);1<p;)c+=" > text|list-item > text|list",--p;switch(p=h&&h.getAttributeNS(i,"text-align")||"left"){case"end":p="right";break;case"start":p="left"}"label-alignment"===m?(b=g&&g.getAttributeNS(i,"margin-left")||"0px",S=g&&g.getAttributeNS(i,"text-indent")||"0px",C=g&&g.getAttributeNS(r,"label-followed-by"),g=t(b)):(b=h&&h.getAttributeNS(r,"space-before")||"0px",y=h&&h.getAttributeNS(r,"min-label-width")||"0px",v=h&&h.getAttributeNS(r,"min-label-distance")||"0px",g=t(b)+t(y)),h=c+" > text|list-item",h+="{",h+="margin-left: "+g+"px;",e(u,h+="}"),h=c+" > text|list-item > text|list",h+="{",h+="margin-left: "+-g+"px;",e(u,h+="}"),h=c+" > text|list-item > :not(text|list):first-child:before",h+="{",h+="text-align: "+p+";",h+="display: inline-block;","label-alignment"===m?(h+="margin-left: "+S+";","listtab"===C&&(h+="padding-right: 0.2cm;")):(h+="min-width: "+y+";",h+="margin-left: "+(0===parseFloat(y)?"":"-")+y+";",h+="padding-right: "+v+";"),e(u,h+="}")}s=s.nextElementSibling}})),d(n,s,l)}}}(),odf.LazyStyleProperties=function(e,t){var n={};this.value=function(i){var o;return n.hasOwnProperty(i)?o=n[i]:(void 0===(o=t[i]())&&e&&(o=e.value(i)),n[i]=o),o},this.reset=function(t){e=t,n={}}},odf.StyleParseUtils=function(){function e(e){var t,n;return"px"===(n=(e=(e=/(-?[0-9]*[0-9][0-9]*(\.[0-9]*)?|0+\.[0-9]*[1-9][0-9]*|\.[0-9]*[1-9][0-9]*)((cm)|(mm)|(in)|(pt)|(pc)|(px))/.exec(e))?{value:parseFloat(e[1]),unit:e[3]}:null)&&e.unit)?t=e.value:"cm"===n?t=e.value/2.54*96:"mm"===n?t=e.value/25.4*96:"in"===n?t=96*e.value:"pt"===n?t=e.value/.75:"pc"===n&&(t=16*e.value),t}var t=odf.Namespaces.stylens;this.parseLength=e,this.parsePositiveLengthOrPercent=function(t,n,i){var o,r;return t&&(o=parseFloat(t.substr(0,t.indexOf("%"))),isNaN(o)&&(o=void 0)),void 0!==o?(i&&(r=i.value(n)),o=void 0===r?void 0:r/100*o):o=e(t),o},this.getPropertiesElement=function(e,n,i){for(n=i?i.nextElementSibling:n.firstElementChild;null!==n&&(n.localName!==e||n.namespaceURI!==t);)n=n.nextElementSibling;return n},this.parseAttributeList=function(e){return e&&(e=e.replace(/^\s*(.*?)\s*$/g,"$1")),e&&0<e.length?e.split(/\s+/):[]}},odf.Style2CSS=function(){function e(t,n,i){var o,r=[];i=i.derivedStyles;var a,s=y[t];for(o in void 0===s?n=null:(a=n?"["+s+'|style-name="'+n+'"]':"","presentation"===s&&(s="draw",a=n?'[presentation|style-name="'+n+'"]':""),n=s+"|"+v[t].join(a+","+s+"|")+a),null!==n&&r.push(n),i)i.hasOwnProperty(o)&&(n=e(t,o,i[o]),r=r.concat(n));return r}function t(e){var t,n="";return n=null,"default-style"===e.localName?null:(n=e.getAttributeNS(c,"parent-style-name"),t=e.getAttributeNS(c,"family"),I.getODFElementsWithXPath(a,n?"//style:*[@style:name='"+n+"'][@style:family='"+t+"']":"//style:default-style[@style:family='"+t+"']",odf.Namespaces.lookupNamespaceURI)[0])}function n(e,n){var i,o,r,a="";for(i=0;i<n.length;i+=1)if(o=n[i],r=e.getAttributeNS(o[0],o[1])){if(r=r.trim(),_.hasOwnProperty(o[1])){var s=r,l=void 0;r=void 0,-1!==(u=s.indexOf(" "))?(l=s.substring(0,u),r=s.substring(u)):(l=s,r=""),(l=k.parseLength(l))&&"pt"===l.unit&&.75>l.value&&(s="0.75pt"+r),r=s}else if(P.hasOwnProperty(o[1])){s=e;var u=o[0],d=(l=o[1],k.parseLength(r)),f=void 0,p=void 0,h=void 0,m=void 0;if(h=void 0,d&&"%"===d.unit){for(f=d.value/100,p=t(s.parentNode),m="0";p;){if((h=g.getDirectChild(p,c,"paragraph-properties"))&&(h=k.parseLength(h.getAttributeNS(u,l)))){if("%"!==h.unit){m=h.value*f+h.unit;break}f*=h.value/100}p=t(p)}r=m}}o[2]&&(a+=o[2]+":"+r+";")}return a}function i(e,t,n,i){return t+t+n+n+i+i}function o(a,f,y,v){var _,P;if("page"===f){var I,M,B,U=v.element,L="";if(M=I="",y=g.getDirectChild(U,c,"page-layout-properties"))if(B=U.getAttributeNS(c,"name"),L+=n(y,A),(I=g.getDirectChild(y,c,"background-image"))&&(M=I.getAttributeNS(h,"href"))&&(L=L+"background-image: url('odfkit:"+M+"');"+n(I,C)),"presentation"===r)for(U=(U=g.getDirectChild(U.parentNode.parentNode,d,"master-styles"))&&U.firstElementChild;U;)U.namespaceURI===c&&"master-page"===U.localName&&U.getAttributeNS(c,"page-layout-name")===B&&(I='draw|page[draw|master-page-name="'+(M=U.getAttributeNS(c,"name"))+'"] {'+L+"}",M='office|body, draw|page[draw|master-page-name="'+M+'"] {'+n(y,R)+" }",a.insertRule(I,a.cssRules.length),a.insertRule(M,a.cssRules.length)),U=U.nextElementSibling;else"text"===r&&(I="office|text {"+L+"}",M="office|body {width: "+y.getAttributeNS(u,"page-width")+";}",a.insertRule(I,a.cssRules.length),a.insertRule(M,a.cssRules.length))}else{if(L=e(f,y,v).join(","),B="",U=g.getDirectChild(v.element,c,"text-properties")){var z=U,H=P="";switch(I="",M=1,U=""+n(z,S),"solid"===(_=z.getAttributeNS(c,"text-underline-style"))&&(P+=" underline"),"solid"===(_=z.getAttributeNS(c,"text-line-through-style"))&&(P+=" line-through"),P.length&&(U=U+"text-decoration:"+P+";\ntext-decoration-line:"+P+";\n",U+="-moz-text-decoration-line:"+P+";\n"),_=z.getAttributeNS(c,"text-line-through-type")){case"double":H+=" double";break;case"single":H+=" single"}if(H&&(U+="text-decoration-style:"+H+";\n",U+="-moz-text-decoration-style:"+H+";\n"),(P=z.getAttributeNS(c,"font-name")||z.getAttributeNS(u,"font-family"))&&(U+="font-family: "+((_=D[P])||P)+";"),(_=z.getAttributeNS(c,"text-position"))&&(U+="vertical-align: "+(_=(P=b.parseAttributeList(_))[0])+"\n; ",(P=P[1])&&(M=parseFloat(P)/100)),z.hasAttributeNS(u,"font-size")||1!==M){for(z=z.parentNode;z;){if(_=(_=g.getDirectChild(z,c,"text-properties"))?k.parseFoFontSize(_.getAttributeNS(u,"font-size")):null){if("%"!==_.unit){I="font-size: "+_.value*M+_.unit+";";break}M*=_.value/100}z=t(z)}I||(I="font-size: "+parseFloat(s)*M+F.getUnits(s)+";")}B+=U+=I}(U=g.getDirectChild(v.element,c,"paragraph-properties"))&&(U=""+n(I=U,N),(M=g.getDirectChild(I,c,"background-image"))&&(z=M.getAttributeNS(h,"href"))&&(U=U+"background-image: url('odfkit:"+z+"');"+n(M,C)),(I=I.getAttributeNS(u,"line-height"))&&"normal"!==I&&(U="%"!==(I=k.parseFoLineHeight(I)).unit?U+"line-height: "+I.value+I.unit+";":U+"line-height: "+I.value/100+";"),B+=U),(U=g.getDirectChild(v.element,c,"graphic-properties"))&&(U=""+n(z=U,x),I=z.getAttributeNS(l,"opacity"),M=z.getAttributeNS(l,"fill"),z=z.getAttributeNS(l,"fill-color"),"solid"===M||"hatch"===M?z&&"none"!==z?(I=isNaN(parseFloat(I))?1:parseFloat(I)/100,M=z.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,i),(z=(M=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(M))?{r:parseInt(M[1],16),g:parseInt(M[2],16),b:parseInt(M[3],16)}:null)&&(U+="background-color: rgba("+z.r+","+z.g+","+z.b+","+I+");")):U+="background: none;":"none"===M&&(U+="background: none;"),B+=U),(U=g.getDirectChild(v.element,c,"drawing-page-properties"))&&(M=""+n(I=U,x),"true"===I.getAttributeNS(m,"background-visible")&&(M+="background: none;"),B+=M,function(e,t,n,i){function o(t,n){var i,o=[];t.forEach((function(e){r.forEach((function(t){o.push('draw|page[webodfhelper|page-style-name="'+t+'"] draw|frame[presentation|class="'+e+'"]')}))})),0<o.length&&(i=o.join(",")+"{visibility:"+n+";}",e.insertRule(i,e.cssRules.length))}var r=function e(t,n){var i=[t],o=n.derivedStyles;return Object.keys(o).forEach((function(t){t=e(t,o[t]),i=i.concat(t)})),i}(t,i),a=[],s=[];["page-number","date-time","header","footer"].forEach((function(e){var t;"true"===(t=n.getAttributeNS(m,"display-"+e))?a.push(e):"false"===t&&s.push(e)})),o(a,"visible"),o(s,"hidden")}(a,y,U,v)),(U=g.getDirectChild(v.element,c,"table-cell-properties"))&&(B=(y=B)+(B=""+n(U,w))),(U=g.getDirectChild(v.element,c,"table-row-properties"))&&(B=(y=B)+(B=""+n(U,T))),(U=g.getDirectChild(v.element,c,"table-column-properties"))&&(B=(y=B)+(B=""+n(U,E))),(U=g.getDirectChild(v.element,c,"table-properties"))&&(y=B,B=""+n(U,O),"collapsing"===(U=U.getAttributeNS(p,"border-model"))?B+="border-collapse:collapse;":"separating"===U&&(B+="border-collapse:separate;"),B=y+B),0!==B.length&&a.insertRule(L+"{"+B+"}",a.cssRules.length)}for(var W in v.derivedStyles)v.derivedStyles.hasOwnProperty(W)&&o(a,f,W,v.derivedStyles[W])}var r,a,s,l=odf.Namespaces.drawns,u=odf.Namespaces.fons,d=odf.Namespaces.officens,c=odf.Namespaces.stylens,f=odf.Namespaces.svgns,p=odf.Namespaces.tablens,h=odf.Namespaces.xlinkns,m=odf.Namespaces.presentationns,g=core.DomUtils,b=new odf.StyleParseUtils,y={graphic:"draw","drawing-page":"draw",paragraph:"text",presentation:"presentation",ruby:"text",section:"text",table:"table","table-cell":"table","table-column":"table","table-row":"table",text:"text",list:"text",page:"office"},v={graphic:"circle connected control custom-shape ellipse frame g line measure page page-thumbnail path polygon polyline rect regular-polygon".split(" "),paragraph:"alphabetical-index-entry-template h illustration-index-entry-template index-source-style object-index-entry-template p table-index-entry-template table-of-content-entry-template user-index-entry-template".split(" "),presentation:"caption circle connector control custom-shape ellipse frame g line measure page-thumbnail path polygon polyline rect regular-polygon".split(" "),"drawing-page":"caption circle connector control page custom-shape ellipse frame g line measure page-thumbnail path polygon polyline rect regular-polygon".split(" "),ruby:["ruby","ruby-text"],section:"alphabetical-index bibliography illustration-index index-title object-index section table-of-content table-index user-index".split(" "),table:["background","table"],"table-cell":"body covered-table-cell even-columns even-rows first-column first-row last-column last-row odd-columns odd-rows table-cell".split(" "),"table-column":["table-column"],"table-row":["table-row"],text:"a index-entry-chapter index-entry-link-end index-entry-link-start index-entry-page-number index-entry-span index-entry-tab-stop index-entry-text index-title-template linenumbering-configuration list-level-style-number list-level-style-bullet outline-level-style span".split(" "),list:["list-item"]},S=[[u,"color","color"],[u,"background-color","background-color"],[u,"font-weight","font-weight"],[u,"font-style","font-style"]],C=[[c,"repeat","background-repeat"]],N=[[u,"background-color","background-color"],[u,"text-align","text-align"],[u,"text-indent","text-indent"],[u,"padding","padding"],[u,"padding-left","padding-left"],[u,"padding-right","padding-right"],[u,"padding-top","padding-top"],[u,"padding-bottom","padding-bottom"],[u,"border-left","border-left"],[u,"border-right","border-right"],[u,"border-top","border-top"],[u,"border-bottom","border-bottom"],[u,"margin","margin"],[u,"margin-left","margin-left"],[u,"margin-right","margin-right"],[u,"margin-top","margin-top"],[u,"margin-bottom","margin-bottom"],[u,"border","border"]],x=[[u,"background-color","background-color"],[u,"min-height","min-height"],[l,"stroke","border"],[f,"stroke-color","border-color"],[f,"stroke-width","border-width"],[u,"border","border"],[u,"border-left","border-left"],[u,"border-right","border-right"],[u,"border-top","border-top"],[u,"border-bottom","border-bottom"]],w=[[u,"background-color","background-color"],[u,"border-left","border-left"],[u,"border-right","border-right"],[u,"border-top","border-top"],[u,"border-bottom","border-bottom"],[u,"border","border"]],E=[[c,"column-width","width"]],T=[[c,"row-height","height"],[u,"keep-together",null]],O=[[c,"width","width"],[u,"margin-left","margin-left"],[u,"margin-right","margin-right"],[u,"margin-top","margin-top"],[u,"margin-bottom","margin-bottom"]],A=[[u,"background-color","background-color"],[u,"padding","padding"],[u,"padding-left","padding-left"],[u,"padding-right","padding-right"],[u,"padding-top","padding-top"],[u,"padding-bottom","padding-bottom"],[u,"border","border"],[u,"border-left","border-left"],[u,"border-right","border-right"],[u,"border-top","border-top"],[u,"border-bottom","border-bottom"],[u,"margin","margin"],[u,"margin-left","margin-left"],[u,"margin-right","margin-right"],[u,"margin-top","margin-top"],[u,"margin-bottom","margin-bottom"]],R=[[u,"page-width","width"],[u,"page-height","height"]],_={border:!0,"border-left":!0,"border-right":!0,"border-top":!0,"border-bottom":!0,"stroke-width":!0},P={margin:!0,"margin-left":!0,"margin-right":!0,"margin-top":!0,"margin-bottom":!0},D={},k=odf.OdfUtils,I=xmldom.XPath,F=new core.CSSUnits;this.style2css=function(e,t,n,i,l){function u(e,t){d="@namespace "+e+" url("+t+");";try{n.insertRule(d,n.cssRules.length)}catch(e){}}var d,c,f;for(a=t;n.cssRules.length;)n.deleteRule(n.cssRules.length-1);for(f in odf.Namespaces.forEachPrefix(u),u("webodfhelper","urn:webodf:names:helper"),D=i,r=e,s=runtime.getWindow().getComputedStyle(document.body,null).getPropertyValue("font-size")||"12pt",y)if(y.hasOwnProperty(f))for(c in e=l[f])e.hasOwnProperty(c)&&o(n,f,c,e[c])}},function(){function e(t,n){var i=this;this.getDistance=function(e){var t=i.x-e.x;return e=i.y-e.y,Math.sqrt(t*t+e*e)},this.getCenter=function(t){return new e((i.x+t.x)/2,(i.y+t.y)/2)},i.x=t,i.y=n}gui.ZoomHelper=function(){function t(e,t,n,i){e=i?"translate3d("+e+"px, "+t+"px, 0) scale3d("+n+", "+n+", 1)":"translate("+e+"px, "+t+"px) scale("+n+")",f.style.WebkitTransform=e,f.style.MozTransform=e,f.style.msTransform=e,f.style.OTransform=e,f.style.transform=e}function n(e){e?t(-p.x,-p.y,g,!0):(t(0,0,g,!0),t(0,0,g,!1))}function i(e){if(y&&x){var t=y.style.overflow,n=y.classList.contains("webodf-customScrollbars");e&&n||!e&&!n||(e?(y.classList.add("webodf-customScrollbars"),y.style.overflow="hidden",runtime.requestAnimationFrame((function(){y.style.overflow=t}))):y.classList.remove("webodf-customScrollbars"))}}function o(){t(-p.x,-p.y,g,!0),y.scrollLeft=0,y.scrollTop=0,w=v.style.overflow,v.style.overflow="visible",i(!1)}function r(){t(0,0,g,!0),y.scrollLeft=p.x,y.scrollTop=p.y,v.style.overflow=w||"",i(!0)}function a(t){return new e(t.pageX-f.offsetLeft,t.pageY-f.offsetTop)}function s(t){if(h){p.x-=t.x-h.x,p.y-=t.y-h.y;var n=p;p=new e(Math.min(Math.max(n.x,f.offsetLeft),(f.offsetLeft+f.offsetWidth)*g-y.clientWidth),Math.min(Math.max(n.y,f.offsetTop),(f.offsetTop+f.offsetHeight)*g-y.clientHeight))}h=t}function l(e){var t=e.touches.length,n=0<t?a(e.touches[0]):null;e=1<t?a(e.touches[1]):null,n&&e?(m=n.getDistance(e),b=g,h=n.getCenter(e),o(),N=C.PINCH):n&&(h=n,N=C.SCROLL)}function u(e){var t=0<(i=e.touches.length)?a(e.touches[0]):null,i=1<i?a(e.touches[1]):null;if(t&&i)if(e.preventDefault(),N===C.SCROLL)N=C.PINCH,o(),m=t.getDistance(i);else{e=t.getCenter(i),t=t.getDistance(i)/m,s(e),i=g;var l=Math.min(4,f.offsetParent.clientWidth/f.offsetWidth);g=b*t,t=(g=Math.min(Math.max(g,l),4))/i,p.x+=(t-1)*(e.x+p.x),p.y+=(t-1)*(e.y+p.y),n(!0)}else t&&(N===C.PINCH?(N=C.SCROLL,r()):s(t))}function d(){N===C.PINCH&&(S.emit(gui.ZoomHelper.signalZoomChanged,g),r(),n(!1)),N=C.NONE}function c(){y&&(y.removeEventListener("touchstart",l,!1),y.removeEventListener("touchmove",u,!1),y.removeEventListener("touchend",d,!1))}var f,p,h,m,g,b,y,v,S=new core.EventNotifier([gui.ZoomHelper.signalZoomChanged]),C={NONE:0,SCROLL:1,PINCH:2},N=C.NONE,x=runtime.getWindow().hasOwnProperty("ontouchstart"),w="";this.subscribe=function(e,t){S.subscribe(e,t)},this.unsubscribe=function(e,t){S.unsubscribe(e,t)},this.getZoomLevel=function(){return g},this.setZoomLevel=function(e){f&&(g=e,n(!1),S.emit(gui.ZoomHelper.signalZoomChanged,g))},this.destroy=function(e){c(),i(!1),e()},this.setZoomableElement=function(e){c(),y=(f=e).offsetParent,v=f.parentNode,n(!1),y&&(y.addEventListener("touchstart",l,!1),y.addEventListener("touchmove",u,!1),y.addEventListener("touchend",d,!1)),i(!0)},b=g=1,p=new e(0,0)},gui.ZoomHelper.signalZoomChanged="zoomChanged"}(),ops.Canvas=function(){},ops.Canvas.prototype.getZoomLevel=function(){},ops.Canvas.prototype.getElement=function(){},ops.Canvas.prototype.getSizer=function(){},ops.Canvas.prototype.getZoomHelper=function(){},function(){function e(){var e=[],t=!1;this.clearQueue=function(){e.length=0},this.addToQueue=function(n){if(0===e.length&&!t)return function n(i){t=!0,runtime.setTimeout((function(){try{i()}catch(e){runtime.log(String(e)+"\n"+e.stack)}t=!1,0<e.length&&n(e.pop())}),10)}(n);e.push(n)}}function t(e){function t(){for(;0<n.cssRules.length;)n.deleteRule(0);n.insertRule("#shadowContent draw|page {display:none;}",0),n.insertRule("office|presentation draw|page {display:none;}",1),n.insertRule("#shadowContent draw|page:nth-of-type("+i+") {display:block;}",2),n.insertRule("office|presentation draw|page:nth-of-type("+i+") {display:block;}",3)}var n=e.sheet,i=1;this.showFirstPage=function(){i=1,t()},this.showNextPage=function(){i+=1,t()},this.showPreviousPage=function(){1<i&&(--i,t())},this.showPage=function(e){0<e&&(i=e,t())},this.css=e,this.destroy=function(t){e.parentNode.removeChild(e),t()}}function n(e){for(var t=(e=e.sheet).cssRules;t.length;)e.deleteRule(t.length-1)}function i(e,t,n){var i=new odf.Style2CSS,o=new odf.ListStyleToCss;n=n.sheet;var r=new odf.StyleTree(e.rootElement.styles,e.rootElement.automaticStyles).getStyleTree();i.style2css(e.getDocumentType(),e.rootElement,n,t.getFontMap(),r),o.applyListStyles(n,r,e.rootElement.body)}function o(e,t,n){var i,o=null;if(e=e.rootElement.body.getElementsByTagNameNS(v,n+"-decl"),(n=t.getAttributeNS(v,"use-"+n+"-name"))&&0<e.length)for(t=0;t<e.length;t+=1)if((i=e[t]).getAttributeNS(v,"name")===n){o=i.textContent;break}return o}function r(e,t,n,i){var o=e.ownerDocument;for(t=C.getElementsByTagNameNS(e,t,n),e=0;e<t.length;e+=1)C.removeAllChildNodes(t[e]),i&&(n=t[e]).appendChild(o.createTextNode(i))}function a(e,t,n){t.setAttributeNS("urn:webodf:names:helper","styleid",e);var i,o=t.getAttributeNS(b,"anchor-type"),r=t.getAttributeNS(m,"x"),a=t.getAttributeNS(m,"y"),s=t.getAttributeNS(m,"width"),l=t.getAttributeNS(m,"height"),u=t.getAttributeNS(f,"min-height"),d=t.getAttributeNS(f,"min-width");"as-char"===o?i="display: inline-block;":o||r||a?i="position: absolute;":(s||l||u||d)&&(i="display: block;"),r&&(i+="left: "+r+";"),a&&(i+="top: "+a+";"),s&&(i+="width: "+s+";"),l&&(i+="height: "+l+";"),u&&(i+="min-height: "+u+";"),d&&(i+="min-width: "+d+";"),i&&(i="draw|"+t.localName+'[webodfhelper|styleid="'+e+'"] {'+i+"}",n.insertRule(i,n.cssRules.length))}function s(e){for(e=e.firstChild;e;){if(e.namespaceURI===p&&"binary-data"===e.localName)return"data:image/png;base64,"+e.textContent.replace(/[\r\n\s]/g,"");e=e.nextSibling}return""}function l(e,t,n,i){function o(t){t&&(t='draw|image[webodfhelper|styleid="'+e+'"] {background-image: url('+t+");}",i.insertRule(t,i.cssRules.length))}n.setAttributeNS("urn:webodf:names:helper","styleid",e);var r,a=n.getAttributeNS(y,"href");if(a)try{(r=t.getPart(a)).onchange=function(e){o(e.url)},r.load()}catch(e){runtime.log("slight problem: "+String(e))}else o(a=s(n))}function u(e,t){function n(e,n){var r=l.documentElement.namespaceURI;"video/"===n.substr(0,6)?((i=l.createElementNS(r,"video")).setAttribute("controls","controls"),o=l.createElementNS(r,"source"),e&&o.setAttribute("src",e),o.setAttribute("type",n),i.appendChild(o),t.parentNode.appendChild(i)):t.innerHtml="Unrecognised Plugin"}var i,o,r,a,l=t.ownerDocument;if(r=t.getAttributeNS(y,"href"))try{(a=e.getPart(r)).onchange=function(e){n(e.url,e.mimetype)},a.load()}catch(e){runtime.log("slight problem: "+String(e))}else runtime.log("using MP4 data fallback"),n(r=s(t),"video/mp4")}function d(e){var t=e.getElementsByTagName("head")[0],n=e.createElementNS(t.namespaceURI,"style"),i="";return n.setAttribute("type","text/css"),n.setAttribute("media","screen, print, handheld, projection"),odf.Namespaces.forEachPrefix((function(e,t){i+="@namespace "+e+" url("+t+");\n"})),i+="@namespace webodfhelper url(urn:webodf:names:helper);\n",n.appendChild(e.createTextNode(i)),t.appendChild(n),n}var c=odf.Namespaces.drawns,f=odf.Namespaces.fons,p=odf.Namespaces.officens,h=odf.Namespaces.stylens,m=odf.Namespaces.svgns,g=odf.Namespaces.tablens,b=odf.Namespaces.textns,y=odf.Namespaces.xlinkns,v=odf.Namespaces.presentationns,S=xmldom.XPath,C=core.DomUtils;odf.OdfCanvas=function(s,f){function m(e,t,n){function i(e,t,n,i){V.addToQueue((function(){l(e,t,n,i)}))}var o,r;for(o=t.getElementsByTagNameNS(c,"image"),t=0;t<o.length;t+=1)r=o.item(t),i("image"+String(t),e,r,n)}function y(e,t){function n(e,t){V.addToQueue((function(){u(e,t)}))}var i,o;for(o=t.getElementsByTagNameNS(c,"plugin"),i=0;i<o.length;i+=1)n(e,o.item(i))}function N(){var e;e=B.firstChild;var t=Z.getZoomLevel();e&&(B.style.WebkitTransformOrigin="0% 0%",B.style.MozTransformOrigin="0% 0%",B.style.msTransformOrigin="0% 0%",B.style.OTransformOrigin="0% 0%",B.style.transformOrigin="0% 0%",H&&((e=H.getMinimumHeightForAnnotationPane())?B.style.minHeight=e:B.style.removeProperty("min-height")),s.style.width=Math.round(t*B.offsetWidth)+"px",s.style.height=Math.round(t*B.offsetHeight)+"px",s.style.display="inline-block")}function x(e){L?(U.parentNode||B.appendChild(U),H&&H.forgetAnnotations(),H=new gui.AnnotationViewManager(I,e.body,U,z),e=C.getElementsByTagNameNS(e.body,p,"annotation"),H.addAnnotations(e),N()):U.parentNode&&(B.removeChild(U),H.forgetAnnotations(),N())}function w(e){function t(){n(A),n(R),n(_),C.removeAllChildNodes(s),s.style.display="inline-block";var t=E.rootElement;s.ownerDocument.importNode(t,!0),M.setOdfContainer(E),function(e,t){(new odf.FontLoader).loadFonts(e,t.sheet)}(E,A),i(E,M,R),function(e,t){var n=_.sheet;C.removeAllChildNodes(s),(B=F.createElementNS(s.namespaceURI,"div")).style.display="inline-block",B.style.background="white",B.style.setProperty("float","left","important"),B.appendChild(t),s.appendChild(B),(U=F.createElementNS(s.namespaceURI,"div")).id="annotationsPane",(P=F.createElementNS(s.namespaceURI,"div")).id="shadowContent",P.style.position="absolute",P.style.top=0,P.style.left=0,e.getContentElement().appendChild(P);var i,l,u=t.body,d=[];for(i=u.firstElementChild;i&&i!==u;)if(i.namespaceURI===c&&(d[d.length]=i),i.firstElementChild)i=i.firstElementChild;else{for(;i&&i!==u&&!i.nextElementSibling;)i=i.parentNode;i&&i.nextElementSibling&&(i=i.nextElementSibling)}for(l=0;l<d.length;l+=1)i=d[l],a("frame"+String(l),i,n);for(d=S.getODFElementsWithXPath(u,".//*[*[@text:anchor-type='paragraph']]",odf.Namespaces.lookupNamespaceURI),i=0;i<d.length;i+=1)(u=d[i]).setAttributeNS&&u.setAttributeNS("urn:webodf:names:helper","containsparagraphanchor",!0);u=M,i=P;var f,N,x,w,E,T,O,A=0;if(l=e.rootElement.ownerDocument,(d=t.body.firstElementChild)&&d.namespaceURI===p&&("presentation"===d.localName||"drawing"===d.localName))for(d=d.firstElementChild;d;){if(f=(f=d.getAttributeNS(c,"master-page-name"))?u.getMasterPageElement(f):null){for(N=d.getAttributeNS("urn:webodf:names:helper","styleid"),x=l.createElementNS(c,"draw:page"),E=f.firstElementChild,A=0;E;)"true"!==E.getAttributeNS(v,"placeholder")&&(w=E.cloneNode(!0),x.appendChild(w)),E=E.nextElementSibling,A+=1;E=w=A=void 0;var R=C.getElementsByTagNameNS(x,c,"frame");for(A=0;A<R.length;A+=1)(E=(w=R[A]).getAttributeNS(v,"class"))&&!/^(date-time|footer|header|page-number)$/.test(E)&&w.parentNode.removeChild(w);for(w=C.getElementsByTagNameNS(x,c,"*"),A=0;A<w.length;A+=1)a(N+"_"+A,w[A],n);i.appendChild(x),A=String(i.getElementsByTagNameNS(c,"page").length),r(x,b,"page-number",A),r(x,v,"header",o(e,d,"header")),r(x,v,"footer",o(e,d,"footer")),a(N,x,n),x.setAttributeNS("urn:webodf:names:helper","page-style-name",d.getAttributeNS(c,"style-name")),x.setAttributeNS(c,"draw:master-page-name",f.getAttributeNS(h,"name"))}d=d.nextElementSibling}for(u=s.namespaceURI,d=C.getElementsByTagNameNS(t.body,g,"table-cell"),i=0;i<d.length;i+=1)(l=d[i]).hasAttributeNS(g,"number-columns-spanned")&&l.setAttributeNS(u,"colspan",l.getAttributeNS(g,"number-columns-spanned")),l.hasAttributeNS(g,"number-rows-spanned")&&l.setAttributeNS(u,"rowspan",l.getAttributeNS(g,"number-rows-spanned"));T=t.body,O=T.ownerDocument,C.getElementsByTagNameNS(T,b,"line-break").forEach((function(e){e.hasChildNodes()||e.appendChild(O.createElement("br"))})),function(e){var t=e.ownerDocument;C.getElementsByTagNameNS(e,b,"s").forEach((function(e){var n,i;if(C.removeAllChildNodes(e),e.appendChild(t.createTextNode(" ")),1<(i=parseInt(e.getAttributeNS(b,"c"),10)))for(e.removeAttributeNS(b,"c"),n=1;n<i;n+=1)e.parentNode.insertBefore(e.cloneNode(!0),e)}))}(t.body),function(e){C.getElementsByTagNameNS(e,b,"tab").forEach((function(e){e.textContent="\t"}))}(t.body),m(e,t.body,n),y(e,t.body),B.insertBefore(P,B.firstChild),Z.setZoomableElement(B)}(E,t),x(t),e||V.addToQueue((function(){var e=[E];if(W.hasOwnProperty("statereadychange")){var t,n=W.statereadychange;for(t=0;t<n.length;t+=1)n[t].apply(null,e)}}))}E.state===odf.OdfContainer.DONE?t():(runtime.log("WARNING: refreshOdf called but ODF was not DONE."),D=runtime.setTimeout((function e(){E.state===odf.OdfContainer.DONE?t():(runtime.log("will be back later..."),D=runtime.setTimeout(e,500))}),100))}runtime.assert(null!=s,"odf.OdfCanvas constructor needs DOM element"),runtime.assert(null!==s.ownerDocument&&void 0!==s.ownerDocument,"odf.OdfCanvas constructor needs DOM");var E,T,O,A,R,_,P,D,k,I=this,F=s.ownerDocument,M=new odf.Formatting,B=null,U=null,L=!1,z=!1,H=null,W={},j=!1,X=!1,V=new e,Z=new gui.ZoomHelper,q=f||new gui.SingleScrollViewport(s.parentNode);this.refreshCSS=function(){j=!0,k.trigger()},this.refreshSize=function(){k.trigger()},this.odfContainer=function(){return E},this.setOdfContainer=function(e,t){E=e,w(!0===t)},this.load=this.load=function(e){V.clearQueue(),C.removeAllChildNodes(s),s.appendChild(s.ownerDocument.createTextNode(runtime.tr("Loading")+e+"...")),s.removeAttribute("style"),E=new odf.OdfContainer(e,(function(e){E=e,w(!1)}))},this.save=function(e){E.save(e)},this.addListener=function(e,t){switch(e){case"click":var n=e;s.addEventListener?s.addEventListener(n,t,!1):s.attachEvent?s.attachEvent("on"+n,t):s["on"+n]=t;break;default:n=W.hasOwnProperty(e)?W[e]:W[e]=[],t&&-1===n.indexOf(t)&&n.push(t)}},this.getFormatting=function(){return M},this.getAnnotationViewManager=function(){return H},this.refreshAnnotations=function(){x(E.rootElement)},this.rerenderAnnotations=function(){H&&(X=!0,k.trigger())},this.getSizer=function(){return B},this.enableAnnotations=function(e,t){e!==L&&(L=e,z=t,E&&x(E.rootElement))},this.addAnnotation=function(e){H&&(H.addAnnotations([e]),N())},this.forgetAnnotation=function(e){H&&(H.forgetAnnotation(e),N())},this.getZoomHelper=function(){return Z},this.setZoomLevel=function(e){Z.setZoomLevel(e)},this.getZoomLevel=function(){return Z.getZoomLevel()},this.fitToContainingElement=function(e,t){var n=Z.getZoomLevel(),i=s.offsetHeight/n;t/i<(n=e/(s.offsetWidth/n))&&(n=t/i),Z.setZoomLevel(n)},this.fitToWidth=function(e){var t=s.offsetWidth/Z.getZoomLevel();Z.setZoomLevel(e/t)},this.fitSmart=function(e,t){var n,i;i=Z.getZoomLevel(),n=s.offsetWidth/i,i=s.offsetHeight/i,n=e/n,void 0!==t&&t/i<n&&(n=t/i),Z.setZoomLevel(Math.min(1,n))},this.fitToHeight=function(e){var t=s.offsetHeight/Z.getZoomLevel();Z.setZoomLevel(e/t)},this.showFirstPage=function(){T.showFirstPage()},this.showNextPage=function(){T.showNextPage()},this.showPreviousPage=function(){T.showPreviousPage()},this.showPage=function(e){T.showPage(e),N()},this.getElement=function(){return s},this.getViewport=function(){return q},this.addCssForFrameWithImage=function(e){var t=e.getAttributeNS(c,"name"),n=e.firstElementChild;a(t,e,_.sheet),n&&l(t+"img",E,n,_.sheet)},this.destroy=function(e){var t=F.getElementsByTagName("head")[0],n=[T.destroy,k.destroy];runtime.clearTimeout(D),U&&U.parentNode&&U.parentNode.removeChild(U),Z.destroy((function(){B&&(s.removeChild(B),B=null)})),function(e){var t=parseInt(e.getAttribute("webodfcss"),10);1===t?e.parentNode.removeChild(e):e.setAttribute("count",t-1)}(O),t.removeChild(A),t.removeChild(R),t.removeChild(_),core.Async.destroyAll(n,e)},O=function(e){var t,n,i=e.getElementsByTagName("head")[0];for(t=e.styleSheets.length,n=i.firstElementChild;n&&("style"!==n.localName||!n.hasAttribute("webodfcss"));)n=n.nextElementSibling;return n?(t=parseInt(n.getAttribute("webodfcss"),10),n.setAttribute("webodfcss",t+1),n):("string"===String(typeof webodf_css)?t=webodf_css:(n="webodf.css",runtime.currentDirectory&&(0<(n=runtime.currentDirectory()).length&&"/"!==n.substr(-1)&&(n+="/"),n+="../webodf.css"),t=runtime.readFileSync(n,"utf-8")),(n=e.createElementNS(i.namespaceURI,"style")).setAttribute("media","screen, print, handheld, projection"),n.setAttribute("type","text/css"),n.setAttribute("webodfcss","1"),n.appendChild(e.createTextNode(t)),i.appendChild(n),n)}(F),T=new t(d(F)),A=d(F),R=d(F),_=d(F),k=core.Task.createRedrawTask((function(){j&&(i(E,M,R),j=!1),X&&(H&&H.rerenderAnnotations(),X=!1),N()})),Z.subscribe(gui.ZoomHelper.signalZoomChanged,N)}}(),odf.StepUtils=function(){this.getContentBounds=function(e){var t,n,i=e.container();return runtime.assert(e.isStep(),"Step iterator must be on a step"),i.nodeType===Node.TEXT_NODE&&0<e.offset()?t=e.offset():(i=e.leftNode())&&i.nodeType===Node.TEXT_NODE&&(t=i.length),i&&(i.nodeType===Node.TEXT_NODE?(runtime.assert(0<t,"Empty text node found"),n={container:i,startOffset:t-1,endOffset:t}):n={container:i,startOffset:0,endOffset:i.childNodes.length}),n}},ops.MemberProperties=function(){},ops.Member=function(e,t){var n=new ops.MemberProperties;this.getMemberId=function(){return e},this.getProperties=function(){return n},this.setProperties=function(e){Object.keys(e).forEach((function(t){n[t]=e[t]}))},this.removeProperties=function(e){Object.keys(e).forEach((function(e){"fullName"!==e&&"color"!==e&&"imageUrl"!==e&&n.hasOwnProperty(e)&&delete n[e]}))},runtime.assert(Boolean(e),"No memberId was supplied!"),t.fullName||(t.fullName=runtime.tr("Unknown Author")),t.color||(t.color="black"),t.imageUrl||(t.imageUrl="avatar-joe.png"),n=t},ops.Document=function(){},ops.Document.prototype.getMemberIds=function(){},ops.Document.prototype.removeCursor=function(e){},ops.Document.prototype.getDocumentElement=function(){},ops.Document.prototype.getRootNode=function(){},ops.Document.prototype.getDOMDocument=function(){},ops.Document.prototype.cloneDocumentElement=function(){},ops.Document.prototype.setDocumentElement=function(e){},ops.Document.prototype.subscribe=function(e,t){},ops.Document.prototype.unsubscribe=function(e,t){},ops.Document.prototype.getCanvas=function(){},ops.Document.prototype.createRootFilter=function(e){},ops.Document.prototype.createPositionIterator=function(e){},ops.Document.prototype.hasCursor=function(e){},ops.Document.signalCursorAdded="cursor/added",ops.Document.signalCursorRemoved="cursor/removed",ops.Document.signalCursorMoved="cursor/moved",ops.Document.signalMemberAdded="member/added",ops.Document.signalMemberUpdated="member/updated",ops.Document.signalMemberRemoved="member/removed",ops.OdtCursor=function(e,t){var n,i,o=this,r={},a=new core.EventNotifier([ops.OdtCursor.signalCursorUpdated]);this.removeFromDocument=function(){i.remove()},this.subscribe=function(e,t){a.subscribe(e,t)},this.unsubscribe=function(e,t){a.unsubscribe(e,t)},this.getMemberId=function(){return e},this.getNode=function(){return i.getNode()},this.getAnchorNode=function(){return i.getAnchorNode()},this.getSelectedRange=function(){return i.getSelectedRange()},this.setSelectedRange=function(e,t){i.setSelectedRange(e,t),a.emit(ops.OdtCursor.signalCursorUpdated,o)},this.hasForwardSelection=function(){return i.hasForwardSelection()},this.getDocument=function(){return t},this.getSelectionType=function(){return n},this.setSelectionType=function(e){r.hasOwnProperty(e)?n=e:runtime.log("Invalid selection type: "+e)},this.resetSelectionType=function(){o.setSelectionType(ops.OdtCursor.RangeSelection)},i=new core.Cursor(t.getDOMDocument(),e),r[ops.OdtCursor.RangeSelection]=!0,r[ops.OdtCursor.RegionSelection]=!0,o.resetSelectionType()},ops.OdtCursor.RangeSelection="Range",ops.OdtCursor.RegionSelection="Region",ops.OdtCursor.signalCursorUpdated="cursorUpdated",function(){var e=0;ops.StepsCache=function(t,n,i){function o(e,t){var n=this;this.nodeId=e,this.steps=-1,this.node=t,this.previousBookmark=this.nextBookmark=null,this.setIteratorPosition=function(e){e.setPositionBeforeElement(t),i(n.steps,e)}}function r(e,t,n){var o=this;this.nodeId=e,this.steps=t,this.node=n,this.previousBookmark=this.nextBookmark=null,this.setIteratorPosition=function(e){e.setUnfilteredPosition(n,0),i(o.steps,e)}}function a(e,t){var n="["+e.nodeId;return t&&(n+=" => "+t.nodeId),n+"]"}function s(){if(!0===ops.StepsCache.ENABLE_CACHE_VERIFICATION){for(var e,n,i,o=p,r=new core.LoopWatchDog(0,1e5),s={};o;)r.check(),(e=o.previousBookmark)?runtime.assert(e.nextBookmark===o,"Broken bookmark link to previous @"+a(e,o)):(runtime.assert(o===p,"Broken bookmark link @"+a(o)),runtime.assert(void 0===h||p==p||p.steps<=h,"Base point is damaged @"+a(o))),(n=o.nextBookmark)&&runtime.assert(n.previousBookmark===o,"Broken bookmark link to next @"+a(o,n)),(void 0===h||o===p||o.steps<=h)&&(runtime.assert(b.containsNode(t,o.node),"Disconnected node is being reported as undamaged @"+a(o)),e&&(i=o.node.compareDocumentPosition(e.node),runtime.assert(0===i||0!=(i&v),"Bookmark order with previous does not reflect DOM order @"+a(e,o))),n&&b.containsNode(t,n.node)&&(i=o.node.compareDocumentPosition(n.node),runtime.assert(0===i||0!=(i&y),"Bookmark order with next does not reflect DOM order @"+a(o,n)))),o=o.nextBookmark;Object.keys(m).forEach((function(e){var t=m[e];(void 0===h||e<=h)&&runtime.assert(t.steps<=e,"Bookmark step of "+t.steps+" exceeds cached step lookup for "+e+" @"+a(t)),runtime.assert(!1===s.hasOwnProperty(t.nodeId),"Bookmark "+a(t)+" appears twice in cached step lookup at steps "+s[t.nodeId]+" and "+e),s[t.nodeId]=e}))}}function l(e){var t="";return e.nodeType===Node.ELEMENT_NODE&&(t=e.getAttributeNS("urn:webodf:names:steps","nodeId")||""),t}function u(t){var n=e.toString();return t.setAttributeNS("urn:webodf:names:steps","nodeId",n),e+=1,n}function d(e){var t,i,o=new core.LoopWatchDog(0,1e4);for(void 0!==h&&e>h&&(e=h),t=Math.floor(e/n)*n;!i&&0<=t;)i=m[t],t-=n;for(i=i||p;i.nextBookmark&&i.nextBookmark.steps<=e;)o.check(),i=i.nextBookmark;return runtime.assert(-1===e||i.steps<=e,"Bookmark @"+a(i)+" at step "+i.steps+" exceeds requested step of "+e),i}function c(e){e.previousBookmark&&(e.previousBookmark.nextBookmark=e.nextBookmark),e.nextBookmark&&(e.nextBookmark.previousBookmark=e.previousBookmark)}function f(e){for(var n,i=null;!i&&e&&e!==t;)(n=l(e))&&(i=g[n])&&i.node!==e&&(runtime.log("Cloned node detected. Creating new bookmark"),i=null,e.removeAttributeNS("urn:webodf:names:steps","nodeId")),e=e.parentNode;return i}var p,h,m={},g={},b=core.DomUtils,y=Node.DOCUMENT_POSITION_FOLLOWING,v=Node.DOCUMENT_POSITION_PRECEDING;this.updateBookmark=function(e,i){var r,a,f,v,S=Math.ceil(e/n)*n;if(void 0!==h&&h<e){for(f=(a=d(h)).nextBookmark;f&&f.steps<=e;)r=f.nextBookmark,v=Math.ceil(f.steps/n)*n,m[v]===f&&delete m[v],b.containsNode(t,f.node)?f.steps=e+1:(c(f),delete g[f.nodeId]),f=r;h=e}else a=d(e);if(f=l(i)||u(i),(r=g[f])?r.node!==i&&(runtime.log("Cloned node detected. Creating new bookmark"),f=u(i),r=g[f]=new o(f,i)):r=g[f]=new o(f,i),(f=r).steps!==e&&((r=Math.ceil(f.steps/n)*n)!==S&&m[r]===f&&delete m[r],f.steps=e),a!==f&&a.nextBookmark!==f){if(a.steps===f.steps)for(;0!=(f.node.compareDocumentPosition(a.node)&y)&&a!==p;)a=a.previousBookmark;a!==f&&a.nextBookmark!==f&&(c(f),r=a.nextBookmark,f.nextBookmark=a.nextBookmark,f.previousBookmark=a,a.nextBookmark=f,r&&(r.previousBookmark=f))}(!(a=m[S])||f.steps>a.steps)&&(m[S]=f),s()},this.setToClosestStep=function(e,t){var n;return s(),(n=d(e)).setIteratorPosition(t),n.steps},this.setToClosestDomPoint=function(e,n,i){var o,r;if(s(),e===t&&0===n)o=p;else if(e===t&&n===t.childNodes.length)for(r in o=p,m)m.hasOwnProperty(r)&&(e=m[r]).steps>o.steps&&(o=e);else if(!(o=f(e.childNodes.item(n)||e)))for(i.setUnfilteredPosition(e,n);!o&&i.previousNode();)o=f(i.getCurrentNode());return o=o||p,void 0!==h&&o.steps>h&&(o=d(h)),o.setIteratorPosition(i),o.steps},this.damageCacheAfterStep=function(e){0>e&&(e=-1),(void 0===h||e<h)&&(h=e),s()},function(){var e=l(t)||u(t);p=new r(e,0,t)}()},ops.StepsCache.ENABLE_CACHE_VERIFICATION=!1,ops.StepsCache.Bookmark=function(){},ops.StepsCache.Bookmark.prototype.setIteratorPosition=function(e){}}(),ops.OdtStepsTranslator=function(e,t,n,i){function o(e,t,n){var i=t.getCurrentNode();t.isBeforeNode()&&s.isParagraph(i)&&(n||(e+=1),a.updateBookmark(e,i))}function r(e,t){if(!t||n.acceptPosition(e)===u)return!0;for(;e.previousPosition();)if(n.acceptPosition(e)===u){if(t(d,e.container(),e.unfilteredDomOffset()))return!0;break}for(;e.nextPosition();)if(n.acceptPosition(e)===u){if(t(c,e.container(),e.unfilteredDomOffset()))return!0;break}return!1}var a,s=odf.OdfUtils,l=core.DomUtils,u=core.PositionFilter.FilterResult.FILTER_ACCEPT,d=core.StepDirection.PREVIOUS,c=core.StepDirection.NEXT;this.convertStepsToDomPoint=function(e){var i,r;if(isNaN(e))throw new TypeError("Requested steps is not numeric ("+e+")");if(0>e)throw new RangeError("Requested steps is negative ("+e+")");for(i=a.setToClosestStep(e,t);i<e&&t.nextPosition();)(r=n.acceptPosition(t)===u)&&(i+=1),o(i,t,r);if(i!==e)throw new RangeError("Requested steps ("+e+") exceeds available steps ("+i+")");return{node:t.container(),offset:t.unfilteredDomOffset()}},this.convertDomPointToSteps=function(i,s,d){var c;if(l.containsNode(e,i)||(s=0>l.comparePoints(e,0,i,s),i=e,s=s?0:e.childNodes.length),t.setUnfilteredPosition(i,s),r(t,d)||t.setUnfilteredPosition(i,s),d=t.container(),s=t.unfilteredDomOffset(),i=a.setToClosestDomPoint(d,s,t),0>l.comparePoints(t.container(),t.unfilteredDomOffset(),d,s))return 0<i?i-1:i;for(;(t.container()!==d||t.unfilteredDomOffset()!==s)&&t.nextPosition();)(c=n.acceptPosition(t)===u)&&(i+=1),o(i,t,c);return i+0},this.prime=function(){var e,i;for(e=a.setToClosestStep(0,t);t.nextPosition();)(i=n.acceptPosition(t)===u)&&(e+=1),o(e,t,i)},this.handleStepsInserted=function(e){a.damageCacheAfterStep(e.position)},this.handleStepsRemoved=function(e){a.damageCacheAfterStep(e.position-1)},a=new ops.StepsCache(e,i,(function(e,t){do{if(n.acceptPosition(t)===u){o(e,t,!0);break}o(e-1,t,!1)}while(t.nextPosition())}))},ops.Operation=function(){},ops.Operation.prototype.init=function(e){},ops.Operation.prototype.execute=function(e){},ops.Operation.prototype.spec=function(){},ops.TextPositionFilter=function(){function e(e,n,i,a){var s;if(n){if(t.isInlineRoot(n)&&t.isGroupingElement(i))return r;if(1===(a=t.lookLeftForCharacter(n))||2===a&&(t.scanRightForAnyCharacter(i)||t.scanRightForAnyCharacter(t.nextNode(e))))return o}else if(t.isGroupingElement(e)&&t.isInlineRoot(function(e,t){for(;e&&t(e)!==o;)e=e.previousSibling;return e}(e.previousSibling,a)))return o;return a=null===n&&t.isParagraph(e),s=t.lookRightForCharacter(i),a?s?o:t.scanRightForAnyCharacter(i)?r:o:s?(n=n||t.previousNode(e),t.scanLeftForAnyCharacter(n)?r:o):r}var t=odf.OdfUtils,n=Node.ELEMENT_NODE,i=Node.TEXT_NODE,o=core.PositionFilter.FilterResult.FILTER_ACCEPT,r=core.PositionFilter.FilterResult.FILTER_REJECT;this.acceptPosition=function(a){var s,l,u,d=a.container(),c=d.nodeType;if(c!==n&&c!==i)return r;if(c===i){if(c=a.unfilteredDomOffset(),s=d.data,runtime.assert(c!==s.length,"Unexpected offset."),0<c){if(a=s[c-1],!t.isODFWhitespace(a))return o;if(1<c)if(a=s[c-2],t.isODFWhitespace(a)){if(!t.isODFWhitespace(s.substr(0,c)))return r}else u=o;else l=t.previousNode(d),t.scanLeftForNonSpace(l)&&(u=o);return u===o?t.isTrailingWhitespace(d,c)?r:o:(a=s[c],t.isODFWhitespace(a)||t.scanLeftForAnyCharacter(t.previousNode(d))?r:o)}l=a.leftNode(),u=d,u=e(d=d.parentNode,l,u,a.getNodeFilter())}else u=t.isGroupingElement(d)?e(d,l=a.leftNode(),u=a.rightNode(),a.getNodeFilter()):r;return u}},ops.OdtDocument=function(e){function t(e){return new core.PositionIterator(e,N,E,!1)}function n(){var t=e.odfContainer().getContentElement(),n=t&&t.localName;return runtime.assert("text"===n,"Unsupported content element type '"+n+"' for OdtDocument"),t}function i(){return m.getDocumentElement().ownerDocument}function o(e){for(;e&&!(e.namespaceURI===odf.Namespaces.officens&&"text"===e.localName||e.namespaceURI===odf.Namespaces.officens&&"annotation"===e.localName);)e=e.parentNode;return e}function r(e,n,i,o){var r;return o=t(o),1===i.length?r=i[0]:(r=new core.PositionFilterChain,i.forEach(r.addFilter)),(i=new core.StepIterator(r,o)).setPosition(e,n),i}function a(e){var i=t(n());return e=p.convertStepsToDomPoint(e),i.setUnfilteredPosition(e.node,e.offset),i}function s(e){return e===C}function l(t){var n=(o=t.spec()).memberid,i=new Date(o.timestamp).toISOString(),o=e.odfContainer();t.isEdit&&(n=m.getMember(n).getProperties().fullName,o.setMetadata({"dc:creator":n,"dc:date":i},null),n={setProperties:{"dc:creator":n,"dc:date":i},removedProperties:[]},h||(n.setProperties["meta:editing-cycles"]=o.incrementEditingCycles(),o.setMetadata(null,["meta:editing-duration","meta:document-statistic"])),h=t,m.emit(ops.OdtDocument.signalMetadataUpdated,n))}function u(e){var t,n,i=[],o=2;runtime.assert(e.isStep(),"positionIterator is not at a step");do{if((t=c.getContentBounds(e))&&(t=t.container,g.isDowngradableSpaceElement(t))){for(n=t.lastChild;t.firstChild;)i.push(t.firstChild),t.parentNode.insertBefore(t.firstChild,t);t.parentNode.removeChild(t),e.setPosition(n,n.nodeType===Node.TEXT_NODE?n.length:n.childNodes.length),e.roundToPreviousStep()}--o}while(0<o&&e.nextStep());i.forEach(b.normalizeTextNodes)}function d(e,t,n){return e=e.childNodes.item(t)||e,(e=g.getParagraphElement(e))&&b.containsNode(n,e)?e:n}var c,f,p,h,m=this,g=odf.OdfUtils,b=core.DomUtils,y={},v={},S=new core.EventNotifier([ops.Document.signalMemberAdded,ops.Document.signalMemberUpdated,ops.Document.signalMemberRemoved,ops.Document.signalCursorAdded,ops.Document.signalCursorRemoved,ops.Document.signalCursorMoved,ops.OdtDocument.signalParagraphChanged,ops.OdtDocument.signalParagraphStyleModified,ops.OdtDocument.signalCommonStyleCreated,ops.OdtDocument.signalCommonStyleDeleted,ops.OdtDocument.signalTableAdded,ops.OdtDocument.signalOperationStart,ops.OdtDocument.signalOperationEnd,ops.OdtDocument.signalProcessingBatchStart,ops.OdtDocument.signalProcessingBatchEnd,ops.OdtDocument.signalUndoStackChanged,ops.OdtDocument.signalStepsInserted,ops.OdtDocument.signalStepsRemoved,ops.OdtDocument.signalMetadataUpdated,ops.OdtDocument.signalAnnotationAdded]),C=core.StepDirection.NEXT,N=NodeFilter.SHOW_ALL,x=new gui.BlacklistNamespaceNodeFilter(["urn:webodf:names:cursor","urn:webodf:names:editinfo"]),w=new gui.OdfTextBodyNodeFilter,E=new core.NodeFilterChain([x,w]);this.createPositionIterator=t,this.getDocumentElement=function(){return e.odfContainer().rootElement},this.cloneDocumentElement=function(){var t=m.getDocumentElement(),n=e.getAnnotationViewManager();return n&&n.forgetAnnotations(),t=t.cloneNode(!0),e.refreshAnnotations(),m.fixCursorPositions(),t},this.setDocumentElement=function(i){var o=e.odfContainer();S.unsubscribe(ops.OdtDocument.signalStepsInserted,p.handleStepsInserted),S.unsubscribe(ops.OdtDocument.signalStepsRemoved,p.handleStepsRemoved),o.setRootElement(i),e.setOdfContainer(o,!0),e.refreshCSS(),i=n(),p=new ops.OdtStepsTranslator(i,t(i),f,500),S.subscribe(ops.OdtDocument.signalStepsInserted,p.handleStepsInserted),S.subscribe(ops.OdtDocument.signalStepsRemoved,p.handleStepsRemoved)},this.getDOMDocument=i,this.getRootElement=o,this.createStepIterator=r,this.getIteratorAtPosition=a,this.convertCursorStepToDomPoint=function(e){return p.convertStepsToDomPoint(e)},this.convertDomPointToCursorStep=function(e,t,n){var i;return n===C&&(i=s),p.convertDomPointToSteps(e,t,i)},this.convertDomToCursorRange=function(e){var t;return{position:t=p.convertDomPointToSteps(e.anchorNode,e.anchorOffset),length:(e=e.anchorNode===e.focusNode&&e.anchorOffset===e.focusOffset?t:p.convertDomPointToSteps(e.focusNode,e.focusOffset))-t}},this.convertCursorToDomRange=function(e,t){var n,o,r=i().createRange();return n=p.convertStepsToDomPoint(e),t?(o=p.convertStepsToDomPoint(e+t),0<t?(r.setStart(n.node,n.offset),r.setEnd(o.node,o.offset)):(r.setStart(o.node,o.offset),r.setEnd(n.node,n.offset))):r.setStart(n.node,n.offset),r},this.upgradeWhitespacesAtPosition=function(e){var t,n=a(e),i=(n=new core.StepIterator(f,n),2);runtime.assert(n.isStep(),"positionIterator is not at a step (requested step: "+e+")");do{if((t=c.getContentBounds(n))&&(e=t.container,t=t.startOffset,e.nodeType===Node.TEXT_NODE&&g.isSignificantWhitespace(e,t))){runtime.assert(" "===e.data[t],"upgradeWhitespaceToElement: textNode.data[offset] should be a literal space");var o=e.ownerDocument.createElementNS(odf.Namespaces.textns,"text:s"),r=e.parentNode,s=e;o.appendChild(e.ownerDocument.createTextNode(" ")),1===e.length?r.replaceChild(o,e):(e.deleteData(t,1),0<t&&(t<e.length&&e.splitText(t),s=e.nextSibling),r.insertBefore(o,s)),e=o,n.setPosition(e,e.childNodes.length),n.roundToPreviousStep()}--i}while(0<i&&n.nextStep())},this.downgradeWhitespaces=u,this.downgradeWhitespacesAtPosition=function(e){e=a(e),u(e=new core.StepIterator(f,e))},this.getTextNodeAtStep=function(e,t){var n,o=a(e),r=o.container(),s=0,l=null;if(r.nodeType===Node.TEXT_NODE?(n=r,s=o.unfilteredDomOffset(),0<n.length&&(0<s&&(n=n.splitText(s)),n.parentNode.insertBefore(i().createTextNode(""),n),n=n.previousSibling,s=0)):(n=i().createTextNode(""),s=0,r.insertBefore(n,o.rightNode())),t){if(y[t]&&m.getCursorPosition(t)===e){for(l=y[t].getNode();l.nextSibling&&"cursor"===l.nextSibling.localName;)l.parentNode.insertBefore(l.nextSibling,l);0<n.length&&n.nextSibling!==l&&(n=i().createTextNode(""),s=0),l.parentNode.insertBefore(n,l)}}else for(;n.nextSibling&&"cursor"===n.nextSibling.localName;)n.parentNode.insertBefore(n.nextSibling,n);for(;n.previousSibling&&n.previousSibling.nodeType===Node.TEXT_NODE;)(o=n.previousSibling).appendData(n.data),s=o.length,(n=o).parentNode.removeChild(n.nextSibling);for(;n.nextSibling&&n.nextSibling.nodeType===Node.TEXT_NODE;)o=n.nextSibling,n.appendData(o.data),n.parentNode.removeChild(o);return{textNode:n,offset:s}},this.fixCursorPositions=function(){Object.keys(y).forEach((function(e){var t,n,i,a=y[e],s=o(a.getNode()),l=m.createRootFilter(s),u=!1;t=d((i=a.getSelectedRange()).startContainer,i.startOffset,s),n=r(i.startContainer,i.startOffset,[f,l],t),i.collapsed?s=n:(t=d(i.endContainer,i.endOffset,s),s=r(i.endContainer,i.endOffset,[f,l],t)),n.isStep()&&s.isStep()?n.container()!==s.container()||n.offset()!==s.offset()||i.collapsed&&a.getAnchorNode()===a.getNode()||(u=!0,i.setStart(n.container(),n.offset()),i.collapse(!0)):(u=!0,runtime.assert(n.roundToClosestStep(),"No walkable step found for cursor owned by "+e),i.setStart(n.container(),n.offset()),runtime.assert(s.roundToClosestStep(),"No walkable step found for cursor owned by "+e),i.setEnd(s.container(),s.offset())),u&&(a.setSelectedRange(i,a.hasForwardSelection()),m.emit(ops.Document.signalCursorMoved,a))}))},this.getCursorPosition=function(e){return(e=y[e])?p.convertDomPointToSteps(e.getNode(),0):0},this.getCursorSelection=function(e){var t=0,n=0;return(e=y[e])&&(t=p.convertDomPointToSteps(e.getNode(),0),n=p.convertDomPointToSteps(e.getAnchorNode(),0)),{position:n,length:t-n}},this.getPositionFilter=function(){return f},this.getOdfCanvas=function(){return e},this.getCanvas=function(){return e},this.getRootNode=n,this.addMember=function(e){runtime.assert(void 0===v[e.getMemberId()],"This member already exists"),v[e.getMemberId()]=e},this.getMember=function(e){return v.hasOwnProperty(e)?v[e]:null},this.removeMember=function(e){delete v[e]},this.getCursor=function(e){return y[e]},this.hasCursor=function(e){return y.hasOwnProperty(e)},this.getMemberIds=function(){return Object.keys(v)},this.addCursor=function(e){runtime.assert(Boolean(e),"OdtDocument::addCursor without cursor");var t=e.getMemberId(),n=m.convertCursorToDomRange(0,0);runtime.assert("string"==typeof t,"OdtDocument::addCursor has cursor without memberid"),runtime.assert(!y[t],"OdtDocument::addCursor is adding a duplicate cursor with memberid "+t),e.setSelectedRange(n,!0),y[t]=e},this.removeCursor=function(e){var t=y[e];return!!t&&(t.removeFromDocument(),delete y[e],m.emit(ops.Document.signalCursorRemoved,e),!0)},this.moveCursor=function(e,t,n,i){e=y[e],t=m.convertCursorToDomRange(t,n),e&&(e.setSelectedRange(t,0<=n),e.setSelectionType(i||ops.OdtCursor.RangeSelection))},this.getFormatting=function(){return e.getFormatting()},this.emit=function(e,t){S.emit(e,t)},this.subscribe=function(e,t){S.subscribe(e,t)},this.unsubscribe=function(e,t){S.unsubscribe(e,t)},this.createRootFilter=function(e){return new RootFilter(e,y,o)},this.close=function(e){e()},this.destroy=function(e){e()},function(){var e=n();f=new ops.TextPositionFilter,c=new odf.StepUtils,p=new ops.OdtStepsTranslator(e,t(e),f,500),S.subscribe(ops.OdtDocument.signalStepsInserted,p.handleStepsInserted),S.subscribe(ops.OdtDocument.signalStepsRemoved,p.handleStepsRemoved),S.subscribe(ops.OdtDocument.signalOperationEnd,l),S.subscribe(ops.OdtDocument.signalProcessingBatchEnd,core.Task.processTasks)}()},ops.OdtDocument.signalParagraphChanged="paragraph/changed",ops.OdtDocument.signalTableAdded="table/added",ops.OdtDocument.signalCommonStyleCreated="style/created",ops.OdtDocument.signalCommonStyleDeleted="style/deleted",ops.OdtDocument.signalParagraphStyleModified="paragraphstyle/modified",ops.OdtDocument.signalOperationStart="operation/start",ops.OdtDocument.signalOperationEnd="operation/end",ops.OdtDocument.signalProcessingBatchStart="router/batchstart",ops.OdtDocument.signalProcessingBatchEnd="router/batchend",ops.OdtDocument.signalUndoStackChanged="undo/changed",ops.OdtDocument.signalStepsInserted="steps/inserted",ops.OdtDocument.signalStepsRemoved="steps/removed",ops.OdtDocument.signalMetadataUpdated="metadata/updated",ops.OdtDocument.signalAnnotationAdded="annotation/added",ops.OpAddAnnotation=function(){function e(e,n,i){var o=e.getTextNodeAtStep(i,t);o&&(i=(e=o.textNode).parentNode,o.offset!==e.length&&e.splitText(o.offset),i.insertBefore(n,e.nextSibling),0===e.length&&i.removeChild(e))}var t,n,i,o,r,a;this.init=function(e){t=e.memberid,n=parseInt(e.timestamp,10),i=parseInt(e.position,10),o=void 0!==e.length?parseInt(e.length,10)||0:void 0,r=e.name},this.isEdit=!0,this.group=void 0,this.execute=function(s){var l,u,d=s.getCursor(t);a=s.getDOMDocument();var c,f,p,h=new Date(n);return(c=a.createElementNS(odf.Namespaces.officens,"office:annotation")).setAttributeNS(odf.Namespaces.officens,"office:name",r),(l=a.createElementNS(odf.Namespaces.dcns,"dc:creator")).setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",t),l.textContent=s.getMember(t).getProperties().fullName,(u=a.createElementNS(odf.Namespaces.dcns,"dc:date")).appendChild(a.createTextNode(h.toISOString())),h=a.createElementNS(odf.Namespaces.textns,"text:list"),f=a.createElementNS(odf.Namespaces.textns,"text:list-item"),p=a.createElementNS(odf.Namespaces.textns,"text:p"),f.appendChild(p),h.appendChild(f),c.appendChild(l),c.appendChild(u),c.appendChild(h),void 0!==o&&((l=a.createElementNS(odf.Namespaces.officens,"office:annotation-end")).setAttributeNS(odf.Namespaces.officens,"office:name",r),c.annotationEndElement=l,e(s,l,i+o)),e(s,c,i),s.emit(ops.OdtDocument.signalStepsInserted,{position:i}),d&&(l=a.createRange(),u=c.getElementsByTagNameNS(odf.Namespaces.textns,"p")[0],l.selectNodeContents(u),d.setSelectedRange(l,!1),d.setSelectionType(ops.OdtCursor.RangeSelection),s.emit(ops.Document.signalCursorMoved,d)),s.getOdfCanvas().addAnnotation(c),s.fixCursorPositions(),s.emit(ops.OdtDocument.signalAnnotationAdded,{memberId:t,annotation:c}),!0},this.spec=function(){return{optype:"AddAnnotation",memberid:t,timestamp:n,position:i,length:o,name:r}}},ops.OpAddCursor=function(){var e,t;this.init=function(n){e=n.memberid,t=n.timestamp},this.isEdit=!1,this.group=void 0,this.execute=function(t){var n=t.getCursor(e);return!n&&(n=new ops.OdtCursor(e,t),t.addCursor(n),t.emit(ops.Document.signalCursorAdded,n),!0)},this.spec=function(){return{optype:"AddCursor",memberid:e,timestamp:t}}},ops.OpAddMember=function(){var e,t,n;this.init=function(i){e=i.memberid,t=parseInt(i.timestamp,10),n=i.setProperties},this.isEdit=!1,this.group=void 0,this.execute=function(t){var i;return!t.getMember(e)&&(i=new ops.Member(e,n),t.addMember(i),t.emit(ops.Document.signalMemberAdded,i),!0)},this.spec=function(){return{optype:"AddMember",memberid:e,timestamp:t,setProperties:n}}},ops.OpAddStyle=function(){var e,t,n,i,o,r,a=odf.Namespaces.stylens;this.init=function(a){e=a.memberid,t=a.timestamp,n=a.styleName,i=a.styleFamily,o="true"===a.isAutomaticStyle||!0===a.isAutomaticStyle,r=a.setProperties},this.isEdit=!0,this.group=void 0,this.execute=function(e){var t=e.getOdfCanvas().odfContainer(),s=e.getFormatting(),l=e.getDOMDocument().createElementNS(a,"style:style");return!!l&&(r&&s.updateStyle(l,r),l.setAttributeNS(a,"style:family",i),l.setAttributeNS(a,"style:name",n),o?t.rootElement.automaticStyles.appendChild(l):t.rootElement.styles.appendChild(l),e.getOdfCanvas().refreshCSS(),o||e.emit(ops.OdtDocument.signalCommonStyleCreated,{name:n,family:i}),!0)},this.spec=function(){return{optype:"AddStyle",memberid:e,timestamp:t,styleName:n,styleFamily:i,isAutomaticStyle:o,setProperties:r}}},odf.ObjectNameGenerator=function(e,t){function n(e,t){var n={};this.generateName=function(){var i,o=t(),r=0;do{i=e+r,r+=1}while(n[i]||o[i]);return n[i]=!0,i}}var i=odf.Namespaces.stylens,o=odf.Namespaces.drawns,r=odf.Namespaces.xlinkns,a=(new core.Utils).hashString(t),s=null,l=null,u=null,d={},c={};this.generateStyleName=function(){return null===s&&(s=new n("auto"+a+"_",(function(){return function(){var t={};return[e.rootElement.automaticStyles,e.rootElement.styles].forEach((function(e){for(e=e.firstElementChild;e;)e.namespaceURI===i&&"style"===e.localName&&(t[e.getAttributeNS(i,"name")]=!0),e=e.nextElementSibling})),t}()}))),s.generateName()},this.generateFrameName=function(){var t,i,r;if(null===l){for(i=e.rootElement.body.getElementsByTagNameNS(o,"frame"),t=0;t<i.length;t+=1)r=i.item(t),d[r.getAttributeNS(o,"name")]=!0;l=new n("fr"+a+"_",(function(){return d}))}return l.generateName()},this.generateImageName=function(){var t,i,s;if(null===u){for(s=e.rootElement.body.getElementsByTagNameNS(o,"image"),t=0;t<s.length;t+=1)i=(i=(i=s.item(t)).getAttributeNS(r,"href")).substring(9,i.lastIndexOf(".")),c[i]=!0;u=new n("img"+a+"_",(function(){return c}))}return u.generateName()}},odf.TextStyleApplicator=function(e,t,n){function i(e){var n={};this.isStyleApplied=function(i){return i=t.getAppliedStylesForElement(i,n).styleProperties,function e(t,n){return"object"==typeof t&&"object"==typeof n?Object.keys(t).every((function(i){return e(t[i],n[i])})):t===n}(e,i)}}function o(i){var o={};this.applyStyleToContainer=function(r){var a;a=r.getAttributeNS(s,"style-name");var u=r.ownerDocument;if(a=a||"",!o.hasOwnProperty(a)){var d,c=a;d=a?t.createDerivedStyleObject(a,"text",i):i,u=u.createElementNS(l,"style:style"),t.updateStyle(u,d),u.setAttributeNS(l,"style:name",e.generateStyleName()),u.setAttributeNS(l,"style:family","text"),u.setAttributeNS("urn:webodf:names:scope","scope","document-content"),n.appendChild(u),o[c]=u}a=o[a].getAttributeNS(l,"name"),r.setAttributeNS(s,"text:style-name",a)}}function r(e,t){var n,i,o,r=e.ownerDocument,l=e.parentNode,u=new core.LoopWatchDog(1e4);for((i=[]).push(e),o=e.nextSibling;o&&a.rangeContainsNode(t,o);)u.check(),i.push(o),o=o.nextSibling;if("span"!==l.localName||l.namespaceURI!==s?(n=r.createElementNS(s,"text:span"),l.insertBefore(n,e),r=!1):(e.previousSibling&&!a.rangeContainsNode(t,l.firstChild)?(n=l.cloneNode(!1),l.parentNode.insertBefore(n,l.nextSibling)):n=l,r=!0),i.forEach((function(e){e.parentNode!==n&&n.appendChild(e)})),o&&r)for(i=n.cloneNode(!1),n.parentNode.insertBefore(i,n.nextSibling);o;)u.check(),r=o.nextSibling,i.appendChild(o),o=r;return n}var a=core.DomUtils,s=odf.Namespaces.textns,l=odf.Namespaces.stylens;this.applyStyle=function(e,t,n){var a,s,l,u={};runtime.assert(n&&n.hasOwnProperty("style:text-properties"),"applyStyle without any text properties"),u["style:text-properties"]=n["style:text-properties"],s=new o(u),l=new i(u),e.forEach((function(e){!1===l.isStyleApplied(e)&&(a=r(e,t),s.applyStyleToContainer(a))}))}},ops.OpApplyDirectStyling=function(){function e(e,n,i){var o=e.getOdfCanvas().odfContainer(),r=s.splitBoundaries(n),l=a.getTextNodes(n,!1);new odf.TextStyleApplicator(new odf.ObjectNameGenerator(o,t),e.getFormatting(),o.rootElement.automaticStyles).applyStyle(l,n,i),r.forEach(s.normalizeTextNodes)}var t,n,i,o,r,a=odf.OdfUtils,s=core.DomUtils;this.init=function(e){t=e.memberid,n=e.timestamp,i=parseInt(e.position,10),o=parseInt(e.length,10),r=e.setProperties},this.isEdit=!0,this.group=void 0,this.execute=function(s){var l=s.convertCursorToDomRange(i,o),u=a.getParagraphElements(l);return e(s,l,r),l.detach(),s.getOdfCanvas().refreshCSS(),s.fixCursorPositions(),u.forEach((function(e){s.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:e,memberId:t,timeStamp:n})})),s.getOdfCanvas().rerenderAnnotations(),!0},this.spec=function(){return{optype:"ApplyDirectStyling",memberid:t,timestamp:n,position:i,length:o,setProperties:r}}},ops.OpApplyHyperlink=function(){var e,t,n,i,o,r=core.DomUtils,a=odf.OdfUtils;this.init=function(r){e=r.memberid,t=r.timestamp,n=r.position,i=r.length,o=r.hyperlink},this.isEdit=!0,this.group=void 0,this.execute=function(s){var l=s.getDOMDocument(),u=s.convertCursorToDomRange(n,i),d=r.splitBoundaries(u),c=[],f=a.getTextNodes(u,!1);return 0!==f.length&&(f.forEach((function(e){var t=a.getParagraphElement(e);runtime.assert(!1===function(e){for(;e;){if(a.isHyperlink(e))return!0;e=e.parentNode}return!1}(e),"The given range should not contain any link.");var n=o,i=l.createElementNS(odf.Namespaces.textns,"text:a");i.setAttributeNS(odf.Namespaces.xlinkns,"xlink:type","simple"),i.setAttributeNS(odf.Namespaces.xlinkns,"xlink:href",n),e.parentNode.insertBefore(i,e),i.appendChild(e),-1===c.indexOf(t)&&c.push(t)})),d.forEach(r.normalizeTextNodes),u.detach(),s.fixCursorPositions(),s.getOdfCanvas().refreshSize(),s.getOdfCanvas().rerenderAnnotations(),c.forEach((function(n){s.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:n,memberId:e,timeStamp:t})})),!0)},this.spec=function(){return{optype:"ApplyHyperlink",memberid:e,timestamp:t,position:n,length:i,hyperlink:o}}},ops.OpInsertImage=function(){var e,t,n,i,o,r,a,s,l=odf.Namespaces.drawns,u=odf.Namespaces.svgns,d=odf.Namespaces.textns,c=odf.Namespaces.xlinkns,f=odf.OdfUtils;this.init=function(l){e=l.memberid,t=l.timestamp,n=l.position,i=l.filename,o=l.frameWidth,r=l.frameHeight,a=l.frameStyleName,s=l.frameName},this.isEdit=!0,this.group=void 0,this.execute=function(p){var h,m,g=p.getOdfCanvas();if(!(b=p.getTextNodeAtStep(n,e)))return!1;h=b.textNode,m=f.getParagraphElement(h);var b=b.offset!==h.length?h.splitText(b.offset):h.nextSibling,y=(v=p.getDOMDocument()).createElementNS(l,"draw:image"),v=v.createElementNS(l,"draw:frame");return y.setAttributeNS(c,"xlink:href",i),y.setAttributeNS(c,"xlink:type","simple"),y.setAttributeNS(c,"xlink:show","embed"),y.setAttributeNS(c,"xlink:actuate","onLoad"),v.setAttributeNS(l,"draw:style-name",a),v.setAttributeNS(l,"draw:name",s),v.setAttributeNS(d,"text:anchor-type","as-char"),v.setAttributeNS(u,"svg:width",o),v.setAttributeNS(u,"svg:height",r),v.appendChild(y),h.parentNode.insertBefore(v,b),p.emit(ops.OdtDocument.signalStepsInserted,{position:n}),0===h.length&&h.parentNode.removeChild(h),g.addCssForFrameWithImage(v),g.refreshCSS(),p.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:m,memberId:e,timeStamp:t}),g.rerenderAnnotations(),!0},this.spec=function(){return{optype:"InsertImage",memberid:e,timestamp:t,filename:i,position:n,frameWidth:o,frameHeight:r,frameStyleName:a,frameName:s}}},ops.OpInsertTable=function(){function e(e,t){var n;if(1===u.length)n=u[0];else if(3===u.length)switch(e){case 0:n=u[0];break;case i-1:n=u[2];break;default:n=u[1]}else n=u[e];if(1===n.length)return n[0];if(3===n.length)switch(t){case 0:return n[0];case o-1:return n[2];default:return n[1]}return n[t]}var t,n,i,o,r,a,s,l,u,d=odf.OdfUtils;this.init=function(e){t=e.memberid,n=e.timestamp,r=e.position,i=e.initialRows,o=e.initialColumns,a=e.tableName,s=e.tableStyleName,l=e.tableColumnStyleName,u=e.tableCellStyleMatrix},this.isEdit=!0,this.group=void 0,this.execute=function(u){var c=u.getTextNodeAtStep(r),f=u.getRootNode();if(c){var p,h,m,g,b=u.getDOMDocument(),y=b.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table"),v=b.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table-column");for(s&&y.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:style-name",s),a&&y.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:name",a),v.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:number-columns-repeated",o),l&&v.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:style-name",l),y.appendChild(v),m=0;m<i;m+=1){for(v=b.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table-row"),g=0;g<o;g+=1)p=b.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table-cell"),(h=e(m,g))&&p.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:style-name",h),h=b.createElementNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:p"),p.appendChild(h),v.appendChild(p);y.appendChild(v)}return c=d.getParagraphElement(c.textNode),f.insertBefore(y,c.nextSibling),u.emit(ops.OdtDocument.signalStepsInserted,{position:r}),u.getOdfCanvas().refreshSize(),u.emit(ops.OdtDocument.signalTableAdded,{tableElement:y,memberId:t,timeStamp:n}),u.getOdfCanvas().rerenderAnnotations(),!0}return!1},this.spec=function(){return{optype:"InsertTable",memberid:t,timestamp:n,position:r,initialRows:i,initialColumns:o,tableName:a,tableStyleName:s,tableColumnStyleName:l,tableCellStyleMatrix:u}}},ops.OpInsertText=function(){function e(e){return"\t"!==e&&a.isODFWhitespace(e)}var t,n,i,o,r,a=odf.OdfUtils;this.init=function(e){t=e.memberid,n=e.timestamp,i=e.position,r=e.text,o="true"===e.moveCursor||!0===e.moveCursor},this.isEdit=!0,this.group=void 0,this.execute=function(s){var l,u,d,c,f,p,h=null,m=s.getDOMDocument(),g=0,b=s.getCursor(t);if(s.upgradeWhitespacesAtPosition(i),l=s.getTextNodeAtStep(i)){for(h=(u=l.textNode).nextSibling,d=u.parentNode,c=a.getParagraphElement(u),p=0;p<r.length;p+=1){if(!(f="\t"===r[p])){var y=p;f=e((f=r)[y])&&(0===y||y===f.length-1||e(f[y-1]))}f&&(0===g?(l.offset!==u.length&&(h=u.splitText(l.offset)),0<p&&u.appendData(r.substring(0,p))):g<p&&(g=r.substring(g,p),d.insertBefore(m.createTextNode(g),h)),g=p+1,"\t"===r[p]?(f=m.createElementNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:tab")).appendChild(m.createTextNode("\t")):(" "!==r[p]&&runtime.log("WARN: InsertText operation contains non-tab, non-space whitespace character (character code "+r.charCodeAt(p)+")"),(f=m.createElementNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:s")).appendChild(m.createTextNode(" "))),d.insertBefore(f,h))}return 0===g?u.insertData(l.offset,r):g<r.length&&(l=r.substring(g),d.insertBefore(m.createTextNode(l),h)),d=u.parentNode,h=u.nextSibling,d.removeChild(u),d.insertBefore(u,h),0===u.length&&u.parentNode.removeChild(u),s.emit(ops.OdtDocument.signalStepsInserted,{position:i}),b&&o&&(s.moveCursor(t,i+r.length,0),s.emit(ops.Document.signalCursorMoved,b)),s.downgradeWhitespacesAtPosition(i),s.downgradeWhitespacesAtPosition(i+r.length),s.getOdfCanvas().refreshSize(),s.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:c,memberId:t,timeStamp:n}),s.getOdfCanvas().rerenderAnnotations(),!0}return!1},this.spec=function(){return{optype:"InsertText",memberid:t,timestamp:n,position:i,text:r,moveCursor:o}}},odf.CollapsingRules=function(e){function t(e){return n.isODFNode(e)||"br"===e.localName&&n.isLineBreak(e.parentNode)||e.nodeType===Node.TEXT_NODE&&n.isODFNode(e.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}var n=odf.OdfUtils,i=core.DomUtils;this.mergeChildrenIntoParent=function o(r){var a;return r.nodeType===Node.TEXT_NODE?(a=r.parentNode).removeChild(r):a=i.removeUnwantedNodes(r,t),(r=a)&&(r=a,r=!n.isParagraph(r)&&r!==e&&n.hasNoODFContent(r)),r?o(a):a}},ops.OpMergeParagraph=function(){function e(e){return odf.OdfUtils.isInlineRoot(e)?NodeFilter.FILTER_SKIP:d.isGroupingElement(e)&&d.hasNoODFContent(e)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}function t(e){if(e.nodeType===Node.TEXT_NODE){if(0===e.length)return runtime.log("WARN: Empty text node found during merge operation"),!0;if(d.isODFWhitespace(e.data)&&!1===d.isSignificantWhitespace(e,0))return!0;e="#text"}else e=(e.prefix?e.prefix+":":"")+e.localName;return runtime.log("WARN: Unexpected text element found near paragraph boundary ["+e+"]"),!1}function n(e){e.collapsed||(c.splitBoundaries(e),(e=d.getTextElements(e,!1,!0).filter(t)).forEach((function(e){e.parentNode.removeChild(e)})))}function i(e,t,n){e=e.convertCursorStepToDomPoint(t);var i=d.getParagraphElement(e.node,e.offset);return runtime.assert(Boolean(i),"Paragraph not found at step "+t),n&&n.setPosition(e.node,e.offset),i}var o,r,a,s,l,u,d=odf.OdfUtils,c=core.DomUtils,f=odf.Namespaces.textns;this.init=function(e){o=e.memberid,r=e.timestamp,a=e.moveCursor,s=e.paragraphStyleName,l=parseInt(e.sourceStartPosition,10),u=parseInt(e.destinationStartPosition,10)},this.isEdit=!0,this.group=void 0,this.execute=function(t){var d,p,h=t.getCursor(o);d=t.getRootNode();var m,g=new odf.CollapsingRules(d),b=t.createStepIterator(d,0,[t.getPositionFilter()],d);runtime.assert(u<l,"Destination paragraph ("+u+") must be before source paragraph ("+l+")"),p=i(t,u),d=i(t,l,b),b.previousStep(),runtime.assert(c.containsNode(p,b.container()),"Destination paragraph must be adjacent to the source paragraph"),m=p.ownerDocument.createRange(),b.setPosition(p,p.childNodes.length),b.roundToPreviousStep(),m.setStart(b.container(),b.offset()),m.setEnd(p,p.childNodes.length),n(m),m=p.childNodes.length;var y=d.ownerDocument.createRange();for(b.setPosition(d,0),b.roundToNextStep(),y.setStart(d,0),y.setEnd(b.container(),b.offset()),n(y),y=d.firstChild;y;)"editinfo"===y.localName?d.removeChild(y):(p.appendChild(y),c.removeUnwantedNodes(y,e)),y=d.firstChild;return runtime.assert(0===d.childNodes.length,"Source paragraph should be empty before it is removed"),g.mergeChildrenIntoParent(d),t.emit(ops.OdtDocument.signalStepsRemoved,{position:l-1}),b.setPosition(p,m),b.roundToClosestStep(),b.previousStep()||b.roundToNextStep(),t.downgradeWhitespaces(b),s?p.setAttributeNS(f,"text:style-name",s):p.removeAttributeNS(f,"style-name"),h&&a&&(t.moveCursor(o,l-1,0),t.emit(ops.Document.signalCursorMoved,h)),t.fixCursorPositions(),t.getOdfCanvas().refreshSize(),t.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:p,memberId:o,timeStamp:r}),t.getOdfCanvas().rerenderAnnotations(),!0},this.spec=function(){return{optype:"MergeParagraph",memberid:o,timestamp:r,moveCursor:a,paragraphStyleName:s,sourceStartPosition:l,destinationStartPosition:u}}},ops.OpMoveCursor=function(){var e,t,n,i,o;this.init=function(r){e=r.memberid,t=r.timestamp,n=r.position,i=r.length||0,o=r.selectionType||ops.OdtCursor.RangeSelection},this.isEdit=!1,this.group=void 0,this.execute=function(t){var r,a=t.getCursor(e);return!!a&&(r=t.convertCursorToDomRange(n,i),a.setSelectedRange(r,0<=i),a.setSelectionType(o),t.emit(ops.Document.signalCursorMoved,a),!0)},this.spec=function(){return{optype:"MoveCursor",memberid:e,timestamp:t,position:n,length:i,selectionType:o}}},ops.OpRemoveAnnotation=function(){var e,t,n,i,o=core.DomUtils;this.init=function(o){e=o.memberid,t=o.timestamp,n=parseInt(o.position,10),i=parseInt(o.length,10)},this.isEdit=!0,this.group=void 0,this.execute=function(e){function t(e){i.parentNode.insertBefore(e,i)}for(var i,r=e.getIteratorAtPosition(n).container();r.namespaceURI!==odf.Namespaces.officens||"annotation"!==r.localName;)r=r.parentNode;return null!==r&&(r=(i=r).annotationEndElement,e.getOdfCanvas().forgetAnnotation(i),o.getElementsByTagNameNS(i,"urn:webodf:names:cursor","cursor").forEach(t),o.getElementsByTagNameNS(i,"urn:webodf:names:cursor","anchor").forEach(t),i.parentNode.removeChild(i),r&&r.parentNode.removeChild(r),e.emit(ops.OdtDocument.signalStepsRemoved,{position:0<n?n-1:n}),e.getOdfCanvas().rerenderAnnotations(),e.fixCursorPositions(),!0)},this.spec=function(){return{optype:"RemoveAnnotation",memberid:e,timestamp:t,position:n,length:i}}},ops.OpRemoveBlob=function(){var e,t,n;this.init=function(i){e=i.memberid,t=i.timestamp,n=i.filename},this.isEdit=!0,this.group=void 0,this.execute=function(e){return e.getOdfCanvas().odfContainer().removeBlob(n),!0},this.spec=function(){return{optype:"RemoveBlob",memberid:e,timestamp:t,filename:n}}},ops.OpRemoveCursor=function(){var e,t;this.init=function(n){e=n.memberid,t=n.timestamp},this.isEdit=!1,this.group=void 0,this.execute=function(t){return!!t.removeCursor(e)},this.spec=function(){return{optype:"RemoveCursor",memberid:e,timestamp:t}}},ops.OpRemoveHyperlink=function(){var e,t,n,i,o=core.DomUtils,r=odf.OdfUtils;this.init=function(o){e=o.memberid,t=o.timestamp,n=o.position,i=o.length},this.isEdit=!0,this.group=void 0,this.execute=function(a){var s=a.convertCursorToDomRange(n,i),l=r.getHyperlinkElements(s);return runtime.assert(1===l.length,"The given range should only contain a single link."),l=o.mergeIntoParent(l[0]),s.detach(),a.fixCursorPositions(),a.getOdfCanvas().refreshSize(),a.getOdfCanvas().rerenderAnnotations(),a.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:r.getParagraphElement(l),memberId:e,timeStamp:t}),!0},this.spec=function(){return{optype:"RemoveHyperlink",memberid:e,timestamp:t,position:n,length:i}}},ops.OpRemoveMember=function(){var e,t;this.init=function(n){e=n.memberid,t=parseInt(n.timestamp,10)},this.isEdit=!1,this.group=void 0,this.execute=function(t){return!!t.getMember(e)&&(t.removeMember(e),t.emit(ops.Document.signalMemberRemoved,e),!0)},this.spec=function(){return{optype:"RemoveMember",memberid:e,timestamp:t}}},ops.OpRemoveStyle=function(){var e,t,n,i;this.init=function(o){e=o.memberid,t=o.timestamp,n=o.styleName,i=o.styleFamily},this.isEdit=!0,this.group=void 0,this.execute=function(e){var t=e.getFormatting().getStyleElement(n,i);return!!t&&(t.parentNode.removeChild(t),e.getOdfCanvas().refreshCSS(),e.emit(ops.OdtDocument.signalCommonStyleDeleted,{name:n,family:i}),!0)},this.spec=function(){return{optype:"RemoveStyle",memberid:e,timestamp:t,styleName:n,styleFamily:i}}},ops.OpRemoveText=function(){var e,t,n,i,o=odf.OdfUtils,r=core.DomUtils;this.init=function(o){runtime.assert(0<=o.length,"OpRemoveText only supports positive lengths"),e=o.memberid,t=o.timestamp,n=parseInt(o.position,10),i=parseInt(o.length,10)},this.isEdit=!0,this.group=void 0,this.execute=function(a){var s,l,u,d=a.getCursor(e),c=new odf.CollapsingRules(a.getRootNode());return a.upgradeWhitespacesAtPosition(n),a.upgradeWhitespacesAtPosition(n+i),s=a.convertCursorToDomRange(n,i),r.splitBoundaries(s),l=o.getTextElements(s,!1,!0),u=o.getParagraphElement(s.startContainer,s.startOffset),runtime.assert(void 0!==u,"Attempting to remove text outside a paragraph element"),s.detach(),l.forEach((function(e){e.parentNode?(runtime.assert(r.containsNode(u,e),"RemoveText only supports removing elements within the same paragraph"),c.mergeChildrenIntoParent(e)):runtime.log("WARN: text element has already been removed from it's container")})),a.emit(ops.OdtDocument.signalStepsRemoved,{position:n}),a.downgradeWhitespacesAtPosition(n),a.fixCursorPositions(),a.getOdfCanvas().refreshSize(),a.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:u,memberId:e,timeStamp:t}),d&&(d.resetSelectionType(),a.emit(ops.Document.signalCursorMoved,d)),a.getOdfCanvas().rerenderAnnotations(),!0},this.spec=function(){return{optype:"RemoveText",memberid:e,timestamp:t,position:n,length:i}}},ops.OpSetBlob=function(){var e,t,n,i,o;this.init=function(r){e=r.memberid,t=r.timestamp,n=r.filename,i=r.mimetype,o=r.content},this.isEdit=!0,this.group=void 0,this.execute=function(e){return e.getOdfCanvas().odfContainer().setBlob(n,i,o),!0},this.spec=function(){return{optype:"SetBlob",memberid:e,timestamp:t,filename:n,mimetype:i,content:o}}},ops.OpSetParagraphStyle=function(){var e,t,n,i,o=odf.OdfUtils;this.init=function(o){e=o.memberid,t=o.timestamp,n=o.position,i=o.styleName},this.isEdit=!0,this.group=void 0,this.execute=function(r){var a,s;return a=r.getIteratorAtPosition(n),!!(s=o.getParagraphElement(a.container()))&&(runtime.assert(function(e,t,n){var i=[e.getPositionFilter()],o=n.container();return n=n.unfilteredDomOffset(),!1===e.createStepIterator(o,n,i,t).previousStep()}(r,s,a),"SetParagraphStyle position should be the first position in the paragraph"),i?s.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:style-name",i):s.removeAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","style-name"),r.getOdfCanvas().refreshSize(),r.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:s,timeStamp:t,memberId:e}),r.getOdfCanvas().rerenderAnnotations(),!0)},this.spec=function(){return{optype:"SetParagraphStyle",memberid:e,timestamp:t,position:n,styleName:i}}},ops.OpSplitParagraph=function(){var e,t,n,i,o,r,a=odf.OdfUtils,s=odf.Namespaces.textns;this.init=function(a){e=a.memberid,t=a.timestamp,i=a.position,n=a.sourceParagraphPosition,r=a.paragraphStyleName,o="true"===a.moveCursor||!0===a.moveCursor},this.isEdit=!0,this.group=void 0,this.execute=function(n){var l,u,d,c,f,p,h,m=n.getCursor(e);if(n.upgradeWhitespacesAtPosition(i),!(l=n.getTextNodeAtStep(i)))return!1;if(!(u=a.getParagraphElement(l.textNode)))return!1;for(d=a.isListItem(u.parentNode)?u.parentNode:u,0===l.offset?(h=l.textNode.previousSibling,p=null):(h=l.textNode,p=l.offset>=l.textNode.length?null:l.textNode.splitText(l.offset)),c=l.textNode;c!==d;){if(f=(c=c.parentNode).cloneNode(!1),p&&f.appendChild(p),h)for(;h&&h.nextSibling;)f.appendChild(h.nextSibling);else for(;c.firstChild;)f.appendChild(c.firstChild);c.parentNode.insertBefore(f,c.nextSibling),h=c,p=f}return a.isListItem(p)&&(p=p.childNodes.item(0)),r?p.setAttributeNS(s,"text:style-name",r):p.removeAttributeNS(s,"style-name"),0===l.textNode.length&&l.textNode.parentNode.removeChild(l.textNode),n.emit(ops.OdtDocument.signalStepsInserted,{position:i}),m&&o&&(n.moveCursor(e,i+1,0),n.emit(ops.Document.signalCursorMoved,m)),n.fixCursorPositions(),n.getOdfCanvas().refreshSize(),n.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:u,memberId:e,timeStamp:t}),n.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:p,memberId:e,timeStamp:t}),n.getOdfCanvas().rerenderAnnotations(),!0},this.spec=function(){return{optype:"SplitParagraph",memberid:e,timestamp:t,position:i,sourceParagraphPosition:n,paragraphStyleName:r,moveCursor:o}}},ops.OpUpdateMember=function(){var e,t,n,i;this.init=function(o){e=o.memberid,t=parseInt(o.timestamp,10),n=o.setProperties,i=o.removedProperties},this.isEdit=!1,this.group=void 0,this.execute=function(t){var o=t.getMember(e);return!!o&&(i&&o.removeProperties(i),n&&(o.setProperties(n),n.fullName&&function(t){var i="//dc:creator[@editinfo:memberid='"+e+"']";for(t=xmldom.XPath.getODFElementsWithXPath(t.getRootNode(),i,(function(e){return"editinfo"===e?"urn:webodf:names:editinfo":odf.Namespaces.lookupNamespaceURI(e)})),i=0;i<t.length;i+=1)t[i].textContent=n.fullName}(t)),t.emit(ops.Document.signalMemberUpdated,o),!0)},this.spec=function(){return{optype:"UpdateMember",memberid:e,timestamp:t,setProperties:n,removedProperties:i}}},ops.OpUpdateMetadata=function(){var e,t,n,i;this.init=function(o){e=o.memberid,t=parseInt(o.timestamp,10),n=o.setProperties,i=o.removedProperties},this.isEdit=!0,this.group=void 0,this.execute=function(e){var t=e.getOdfCanvas().odfContainer(),o=null;return i&&(o=i.attributes.split(",")),t.setMetadata(n,o),e.emit(ops.OdtDocument.signalMetadataUpdated,{setProperties:null!==n?n:{},removedProperties:null!==o?o:[]}),!0},this.spec=function(){return{optype:"UpdateMetadata",memberid:e,timestamp:t,setProperties:n,removedProperties:i}}},ops.OpUpdateParagraphStyle=function(){function e(e,t){var n,i,o=t?t.split(","):[];for(n=0;n<o.length;n+=1)i=o[n].split(":"),e.removeAttributeNS(odf.Namespaces.lookupNamespaceURI(i[0]),i[1])}var t,n,i,o,r,a=odf.Namespaces.stylens;this.init=function(e){t=e.memberid,n=e.timestamp,i=e.styleName,o=e.setProperties,r=e.removedProperties},this.isEdit=!0,this.group=void 0,this.execute=function(t){var n,s,l,u=t.getFormatting();return!!(n=""!==i?u.getStyleElement(i,"paragraph"):u.getDefaultStyleElement("paragraph"))&&(s=n.getElementsByTagNameNS(a,"paragraph-properties").item(0),l=n.getElementsByTagNameNS(a,"text-properties").item(0),o&&u.updateStyle(n,o),r&&(u=r["style:paragraph-properties"],s&&u&&(e(s,u.attributes),0===s.attributes.length&&n.removeChild(s)),u=r["style:text-properties"],l&&u&&(e(l,u.attributes),0===l.attributes.length&&n.removeChild(l)),e(n,r.attributes)),t.getOdfCanvas().refreshCSS(),t.emit(ops.OdtDocument.signalParagraphStyleModified,i),t.getOdfCanvas().rerenderAnnotations(),!0)},this.spec=function(){return{optype:"UpdateParagraphStyle",memberid:t,timestamp:n,styleName:i,setProperties:o,removedProperties:r}}},ops.OperationFactory=function(){function e(e){return function(t){return new e}}var t;this.register=function(e,n){t[e]=n},this.create=function(e){var n=null,i=t[e.optype];return i&&(n=i(e)).init(e),n},t={AddMember:e(ops.OpAddMember),UpdateMember:e(ops.OpUpdateMember),RemoveMember:e(ops.OpRemoveMember),AddCursor:e(ops.OpAddCursor),ApplyDirectStyling:e(ops.OpApplyDirectStyling),SetBlob:e(ops.OpSetBlob),RemoveBlob:e(ops.OpRemoveBlob),InsertImage:e(ops.OpInsertImage),InsertTable:e(ops.OpInsertTable),InsertText:e(ops.OpInsertText),RemoveText:e(ops.OpRemoveText),MergeParagraph:e(ops.OpMergeParagraph),SplitParagraph:e(ops.OpSplitParagraph),SetParagraphStyle:e(ops.OpSetParagraphStyle),UpdateParagraphStyle:e(ops.OpUpdateParagraphStyle),AddStyle:e(ops.OpAddStyle),RemoveStyle:e(ops.OpRemoveStyle),MoveCursor:e(ops.OpMoveCursor),RemoveCursor:e(ops.OpRemoveCursor),AddAnnotation:e(ops.OpAddAnnotation),RemoveAnnotation:e(ops.OpRemoveAnnotation),UpdateMetadata:e(ops.OpUpdateMetadata),ApplyHyperlink:e(ops.OpApplyHyperlink),RemoveHyperlink:e(ops.OpRemoveHyperlink)}},ops.OperationRouter=function(){},ops.OperationRouter.prototype.setOperationFactory=function(e){},ops.OperationRouter.prototype.setPlaybackFunction=function(e){},ops.OperationRouter.prototype.push=function(e){},ops.OperationRouter.prototype.close=function(e){},ops.OperationRouter.prototype.subscribe=function(e,t){},ops.OperationRouter.prototype.unsubscribe=function(e,t){},ops.OperationRouter.prototype.hasLocalUnsyncedOps=function(){},ops.OperationRouter.prototype.hasSessionHostConnection=function(){},ops.OperationRouter.signalProcessingBatchStart="router/batchstart",ops.OperationRouter.signalProcessingBatchEnd="router/batchend",ops.TrivialOperationRouter=function(){var e,t,n=new core.EventNotifier([ops.OperationRouter.signalProcessingBatchStart,ops.OperationRouter.signalProcessingBatchEnd]),i=0;this.setOperationFactory=function(t){e=t},this.setPlaybackFunction=function(e){t=e},this.push=function(o){i+=1,n.emit(ops.OperationRouter.signalProcessingBatchStart,{}),o.forEach((function(n){(n=n.spec()).timestamp=Date.now(),(n=e.create(n)).group="g"+i,t(n)})),n.emit(ops.OperationRouter.signalProcessingBatchEnd,{})},this.close=function(e){e()},this.subscribe=function(e,t){n.subscribe(e,t)},this.unsubscribe=function(e,t){n.unsubscribe(e,t)},this.hasLocalUnsyncedOps=function(){return!1},this.hasSessionHostConnection=function(){return!0}},ops.Session=function(e){function t(e){o.emit(ops.OdtDocument.signalProcessingBatchStart,e)}function n(e){o.emit(ops.OdtDocument.signalProcessingBatchEnd,e)}var i=new ops.OperationFactory,o=new ops.OdtDocument(e),r=null;this.setOperationFactory=function(e){i=e,r&&r.setOperationFactory(i)},this.setOperationRouter=function(e){r&&(r.unsubscribe(ops.OperationRouter.signalProcessingBatchStart,t),r.unsubscribe(ops.OperationRouter.signalProcessingBatchEnd,n)),(r=e).subscribe(ops.OperationRouter.signalProcessingBatchStart,t),r.subscribe(ops.OperationRouter.signalProcessingBatchEnd,n),e.setPlaybackFunction((function(e){return o.emit(ops.OdtDocument.signalOperationStart,e),!!e.execute(o)&&(o.emit(ops.OdtDocument.signalOperationEnd,e),!0)})),e.setOperationFactory(i)},this.getOperationFactory=function(){return i},this.getOdtDocument=function(){return o},this.enqueue=function(e){r.push(e)},this.close=function(e){r.close((function(t){t?e(t):o.close(e)}))},this.destroy=function(e){o.destroy(e)},this.setOperationRouter(new ops.TrivialOperationRouter)},gui.AnnotationController=function(e,t,n){function i(){var e,t=!1;(e=(e=s.getCursor(n))&&e.getNode())&&(t=!d.isWithinAnnotation(e,s.getRootNode())),t!==l&&(l=t,u.emit(gui.AnnotationController.annotatableChanged,l))}function o(e){e.getMemberId()===n&&i()}function r(e){e===n&&i()}function a(e){e.getMemberId()===n&&i()}var s=e.getOdtDocument(),l=!1,u=new core.EventNotifier([gui.AnnotationController.annotatableChanged]),d=odf.OdfUtils,c=core.StepDirection.NEXT;this.isAnnotatable=function(){return l},this.addAnnotation=function(){var t=new ops.OpAddAnnotation,i=(o=s.getCursorSelection(n)).length,o=o.position;l&&(0===i?i=void 0:(o=0<=i?o:o+i,i=Math.abs(i)),t.init({memberid:n,position:o,length:i,name:n+Date.now()}),e.enqueue([t]))},this.removeAnnotation=function(i){var o,r;o=s.getMember(n).getProperties().fullName,!0===t.getState(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN)&&o!==d.getAnnotationCreator(i)||(o=s.convertDomPointToCursorStep(i,0,c),r=s.convertDomPointToCursorStep(i,i.childNodes.length),(i=new ops.OpRemoveAnnotation).init({memberid:n,position:o,length:r-o}),(r=new ops.OpMoveCursor).init({memberid:n,position:0<o?o-1:o,length:0}),e.enqueue([i,r]))},this.subscribe=function(e,t){u.subscribe(e,t)},this.unsubscribe=function(e,t){u.unsubscribe(e,t)},this.destroy=function(e){s.unsubscribe(ops.Document.signalCursorAdded,o),s.unsubscribe(ops.Document.signalCursorRemoved,r),s.unsubscribe(ops.Document.signalCursorMoved,a),e()},t.registerConstraint(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN),s.subscribe(ops.Document.signalCursorAdded,o),s.subscribe(ops.Document.signalCursorRemoved,r),s.subscribe(ops.Document.signalCursorMoved,a),i()},gui.AnnotationController.annotatableChanged="annotatable/changed",gui.Avatar=function(e,t){var n,i,o,r=this;this.setColor=function(e){i.style.borderColor=e},this.setImageUrl=function(e){r.isVisible()?i.src=e:o=e},this.isVisible=function(){return"block"===n.style.display},this.show=function(){o&&(i.src=o,o=void 0),n.style.display="block"},this.hide=function(){n.style.display="none"},this.markAsFocussed=function(e){e?n.classList.add("active"):n.classList.remove("active")},this.destroy=function(t){e.removeChild(n),t()},function(){var o=e.ownerDocument;n=o.createElement("div"),i=o.createElement("img"),n.appendChild(i),n.style.display=t?"block":"none",n.className="handle",e.appendChild(n)}()},gui.StepInfo=function(){},gui.StepInfo.VisualDirection={LEFT_TO_RIGHT:0,RIGHT_TO_LEFT:1},gui.StepInfo.prototype.container=function(){},gui.StepInfo.prototype.offset=function(){},gui.VisualStepScanner=function(){},gui.VisualStepScanner.prototype.process=function(e,t,n){},gui.GuiStepUtils=function(){function e(e){var o,r=null;return(e=n.getContentBounds(e))&&(e.container.nodeType===Node.TEXT_NODE?((o=e.container.ownerDocument.createRange()).setStart(e.container,e.startOffset),o.setEnd(e.container,e.endOffset),(r=0<o.getClientRects().length?o.getBoundingClientRect():null)&&" "===e.container.data.substring(e.startOffset,e.endOffset)&&1>=r.width&&(r=null),o.detach()):(t.isCharacterElement(e.container)||t.isCharacterFrame(e.container))&&(r=i.getBoundingClientRect(e.container))),r}var t=odf.OdfUtils,n=new odf.StepUtils,i=core.DomUtils,o=core.StepDirection.NEXT,r=gui.StepInfo.VisualDirection.LEFT_TO_RIGHT,a=gui.StepInfo.VisualDirection.RIGHT_TO_LEFT;this.getContentRect=e,this.moveToFilteredStep=function(t,n,i){function s(e,t){return t.process(p,d,c)&&(e=!0,!f&&t.token&&(f=t.token)),e}var l,u,d,c,f,p,h=n===o,m=t.snapshot();l=!1;do{l=e(t),p={token:t.snapshot(),container:t.container,offset:t.offset,direction:n,visualDirection:n===o?r:a},u=t.nextStep()?e(t):null,t.restore(p.token),h?(d=l,c=u):(d=u,c=l),l=i.reduce(s,!1)}while(!l&&t.advanceStep(n));return l||i.forEach((function(e){!f&&e.token&&(f=e.token)})),t.restore(f||m),Boolean(f)}},gui.Caret=function(e,t,n,i){function o(){d.style.opacity="0"===d.style.opacity?"1":"0",b.trigger()}function r(){return h.selectNodeContents(p),h.getBoundingClientRect()}function a(e){return E[e]!==w[e]}function s(){if(!1===w.isShown||e.getSelectionType()!==ops.OdtCursor.RangeSelection||!i&&!e.getSelectedRange().collapsed?(w.visibility="hidden",d.style.visibility="hidden",b.cancel()):(w.visibility="visible",d.style.visibility="visible",!1===w.isFocused?(d.style.opacity="1",b.cancel()):((C||a("visibility"))&&(d.style.opacity="1",b.cancel()),b.trigger())),x||N){var n;n=e.getNode();var o,s,l=v.getBoundingClientRect(y.getSizer()),p=!1,h=0;if(n.removeAttributeNS("urn:webodf:names:cursor","caret-sizer-active"),0<n.getClientRects().length)h=(s=r()).left-v.getBoundingClientRect(n).left,p=!0;else if(m.setPosition(n,0),!(s=S.getContentRect(m))&&m.nextStep()&&(o=S.getContentRect(m))&&(s=o,p=!0),s||(n.setAttributeNS("urn:webodf:names:cursor","caret-sizer-active","true"),s=r(),p=!0),!s)for(runtime.log("WARN: No suitable client rectangle found for visual caret for "+e.getMemberId());n;){if(0<n.getClientRects().length){s=v.getBoundingClientRect(n),p=!0;break}n=n.parentNode}8>(n={top:(s=v.translateRect(s,l,y.getZoomLevel())).top,height:s.height,right:p?s.left:s.right,width:v.adaptRangeDifferenceToZoomLevel(h,y.getZoomLevel())}).height&&(n={top:n.top-(8-n.height)/2,height:8,right:n.right}),u.style.height=n.height+"px",u.style.top=n.top+"px",u.style.left=n.right-n.width+"px",u.style.width=n.width?n.width+"px":"",f&&((n=runtime.getWindow().getComputedStyle(e.getNode(),null)).font?f.style.font=n.font:(f.style.fontStyle=n.fontStyle,f.style.fontVariant=n.fontVariant,f.style.fontWeight=n.fontWeight,f.style.fontSize=n.fontSize,f.style.lineHeight=n.lineHeight,f.style.fontFamily=n.fontFamily))}w.isShown&&N&&t.scrollIntoView(d.getBoundingClientRect()),a("isFocused")&&c.markAsFocussed(w.isFocused),Object.keys(w).forEach((function(e){E[e]=w[e]})),x=N=C=!1}function l(e){u.parentNode.removeChild(u),p.parentNode.removeChild(p),e()}var u,d,c,f,p,h,m,g,b,y=e.getDocument().getCanvas(),v=core.DomUtils,S=new gui.GuiStepUtils,C=!1,N=!1,x=!1,w={isFocused:!1,isShown:!0,visibility:"hidden"},E={isFocused:!w.isFocused,isShown:!w.isShown,visibility:"hidden"};this.handleUpdate=function(){x=!0,g.trigger()},this.refreshCursorBlinking=function(){C=!0,g.trigger()},this.setFocus=function(){w.isFocused=!0,g.trigger()},this.removeFocus=function(){w.isFocused=!1,g.trigger()},this.show=function(){w.isShown=!0,g.trigger()},this.hide=function(){w.isShown=!1,g.trigger()},this.setAvatarImageUrl=function(e){c.setImageUrl(e)},this.setColor=function(e){d.style.borderColor=e,c.setColor(e)},this.getCursor=function(){return e},this.getFocusElement=function(){return d},this.toggleHandleVisibility=function(){c.isVisible()?c.hide():c.show()},this.showHandle=function(){c.show()},this.hideHandle=function(){c.hide()},this.setOverlayElement=function(e){f=e,u.appendChild(e),x=!0,g.trigger()},this.ensureVisible=function(){N=!0,g.trigger()},this.getBoundingClientRect=function(){return v.getBoundingClientRect(u)},this.destroy=function(e){core.Async.destroyAll([g.destroy,b.destroy,c.destroy,l],e)},function(){var t=e.getDocument(),i=[t.createRootFilter(e.getMemberId()),t.getPositionFilter()],r=t.getDOMDocument();h=r.createRange(),(p=r.createElement("span")).className="webodf-caretSizer",p.textContent="|",e.getNode().appendChild(p),(u=r.createElement("div")).setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",e.getMemberId()),u.className="webodf-caretOverlay",(d=r.createElement("div")).className="caret",u.appendChild(d),c=new gui.Avatar(u,n),y.getSizer().appendChild(u),m=t.createStepIterator(e.getNode(),0,i,t.getRootNode()),g=core.Task.createRedrawTask(s),b=core.Task.createTimeoutTask(o,500),g.triggerImmediate()}()},odf.TextSerializer=function(){var e=this,t=odf.OdfUtils;this.filter=null,this.writeToString=function(n){return n?("\n"===(n=function n(i){var o,r="",a=e.filter?e.filter.acceptNode(i):NodeFilter.FILTER_ACCEPT,s=i.nodeType;if((a===NodeFilter.FILTER_ACCEPT||a===NodeFilter.FILTER_SKIP)&&t.isTextContentContainingNode(i))for(o=i.firstChild;o;)r+=n(o),o=o.nextSibling;return a===NodeFilter.FILTER_ACCEPT&&(s===Node.ELEMENT_NODE&&t.isParagraph(i)?r+="\n":s===Node.TEXT_NODE&&i.textContent&&(r+=i.textContent)),r}(n))[n.length-1]&&(n=n.substr(0,n.length-1)),n):""}},gui.MimeDataExporter=function(){var e;this.exportRangeToDataTransfer=function(t,n){var i;(i=n.startContainer.ownerDocument.createElement("span")).appendChild(n.cloneContents()),i=e.writeToString(i);try{t.setData("text/plain",i)}catch(e){t.setData("Text",i)}},(e=new odf.TextSerializer).filter=new odf.OdfNodeFilter},gui.Clipboard=function(e){this.setDataFromRange=function(t,n){var i,o=t.clipboardData;return i=runtime.getWindow(),!o&&i&&(o=i.clipboardData),o?(i=!0,e.exportRangeToDataTransfer(o,n),t.preventDefault()):i=!1,i}},gui.SessionContext=function(e,t){var n=e.getOdtDocument(),i=odf.OdfUtils;this.isLocalCursorWithinOwnAnnotation=function(){var e,o=n.getCursor(t);return!(!o||(e=o&&o.getNode(),o=n.getMember(t).getProperties().fullName,!(e=i.getParentAnnotation(e,n.getRootNode()))||i.getAnnotationCreator(e)!==o))}},gui.StyleSummary=function(e){function t(t,n){var i,r=t+"|"+n;return o.hasOwnProperty(r)||(i=[],e.forEach((function(e){e=(e=e.styleProperties[t])&&e[n],-1===i.indexOf(e)&&i.push(e)})),o[r]=i),o[r]}function n(e,n,i){return function(){var o=t(e,n);return i.length>=o.length&&o.every((function(e){return-1!==i.indexOf(e)}))}}function i(e,n){var i=t(e,n);return 1===i.length?i[0]:void 0}var o={};this.getPropertyValues=t,this.getCommonValue=i,this.isBold=n("style:text-properties","fo:font-weight",["bold"]),this.isItalic=n("style:text-properties","fo:font-style",["italic"]),this.hasUnderline=n("style:text-properties","style:text-underline-style",["solid"]),this.hasStrikeThrough=n("style:text-properties","style:text-line-through-style",["solid"]),this.fontSize=function(){var e=i("style:text-properties","fo:font-size");return e&&parseFloat(e)},this.fontName=function(){return i("style:text-properties","style:font-name")},this.isAlignedLeft=n("style:paragraph-properties","fo:text-align",["left","start"]),this.isAlignedCenter=n("style:paragraph-properties","fo:text-align",["center"]),this.isAlignedRight=n("style:paragraph-properties","fo:text-align",["right","end"]),this.isAlignedJustified=n("style:paragraph-properties","fo:text-align",["justify"]),this.text={isBold:this.isBold,isItalic:this.isItalic,hasUnderline:this.hasUnderline,hasStrikeThrough:this.hasStrikeThrough,fontSize:this.fontSize,fontName:this.fontName},this.paragraph={isAlignedLeft:this.isAlignedLeft,isAlignedCenter:this.isAlignedCenter,isAlignedRight:this.isAlignedRight,isAlignedJustified:this.isAlignedJustified}},gui.DirectFormattingController=function(e,t,n,i,o,r,a){function s(){return D.value().styleSummary}function l(){return D.value().enabledFeatures}function u(e){var t;return e.collapsed?((t=e.startContainer).hasChildNodes()&&e.startOffset<t.childNodes.length&&(t=t.childNodes.item(e.startOffset)),e=[t]):e=M.getTextElements(e,!0,!1),e}function d(e,t){var n={};return Object.keys(e).forEach((function(i){var o=e[i](),r=t[i]();o!==r&&(n[i]=r)})),n}function c(){var e,t;t=P.styleSummary;var n=D.value(),i=n.styleSummary,o=P.enabledFeatures,r=n.enabledFeatures;e=d(t.text,i.text),t=d(t.paragraph,i.paragraph),o=!(r.directTextStyling===o.directTextStyling&&r.directParagraphStyling===o.directParagraphStyling),P=n,o&&B.emit(gui.DirectFormattingController.enabledChanged,r),0<Object.keys(e).length&&B.emit(gui.DirectFormattingController.textStylingChanged,e),0<Object.keys(t).length&&B.emit(gui.DirectFormattingController.paragraphStylingChanged,t)}function f(){D.reset(),c()}function p(e){("string"==typeof e?e:e.getMemberId())===i&&D.reset()}function h(){D.reset()}function m(e){var t=I.getCursor(i);e=e.paragraphElement,t&&M.getParagraphElement(t.getNode())===e&&D.reset()}function g(e,t){return t(!e()),!0}function b(t){if(l().directTextStyling){var n=I.getCursorSelection(i),o={"style:text-properties":t};0!==n.length?((t=new ops.OpApplyDirectStyling).init({memberid:i,position:n.position,length:n.length,setProperties:o}),e.enqueue([t])):(z=F.mergeObjects(z||{},o),D.reset())}}function y(e,t){var n={};n[e]=t,b(n)}function v(e){e=e.spec(),z&&e.memberid===i&&"SplitParagraph"!==e.optype&&(z=null,D.reset())}function S(e){y("fo:font-weight",e?"bold":"normal")}function C(e){y("fo:font-style",e?"italic":"normal")}function N(e){y("style:text-underline-style",e?"solid":"none")}function x(e){y("style:text-line-through-style",e?"solid":"none")}function w(t){if(l().directParagraphStyling){var n,r=I.getCursor(i).getSelectedRange(),a=(r=M.getParagraphElements(r),I.getFormatting()),s=[],u={};r.forEach((function(e){var r,l=I.convertDomPointToCursorStep(e,0,L),d=e.getAttributeNS(odf.Namespaces.textns,"style-name");(e=d?u.hasOwnProperty(d)?u[d]:void 0:n)||(e=o.generateStyleName(),d?(u[d]=e,r=a.createDerivedStyleObject(d,"paragraph",{})):(n=e,r={}),r=t(r),(d=new ops.OpAddStyle).init({memberid:i,styleName:e.toString(),styleFamily:"paragraph",isAutomaticStyle:!0,setProperties:r}),s.push(d)),(d=new ops.OpSetParagraphStyle).init({memberid:i,styleName:e.toString(),position:l}),s.push(d)})),e.enqueue(s)}}function E(e){!function(e){w((function(t){return F.mergeObjects(t,e)}))}({"style:paragraph-properties":{"fo:text-align":e}})}function T(e,t){var n,i=I.getFormatting().getDefaultTabStopDistance(),o=t["style:paragraph-properties"];return o&&(o=o["fo:margin-left"],n=M.parseLength(o)),F.mergeObjects(t,{"style:paragraph-properties":{"fo:margin-left":n&&n.unit===i.unit?n.value+e*i.value+n.unit:e*i.value+i.unit}})}function O(e,t){var n=0===(n=u(e)).length?[e.startContainer]:n,i=0<(n=I.getFormatting().getAppliedStyles(n)).length?n[0].styleProperties:void 0,o=I.getFormatting().getAppliedStylesForElement(t).styleProperties;return!(!i||"text"!==i["style:family"]||!i["style:text-properties"]||o&&o["style:text-properties"]&&(i=i["style:text-properties"],o=o["style:text-properties"],Object.keys(i).every((function(e){return i[e]===o[e]}))))}function A(){}function R(){return!1}function _(){return!1}var P,D,k=this,I=e.getOdtDocument(),F=new core.Utils,M=odf.OdfUtils,B=new core.EventNotifier([gui.DirectFormattingController.enabledChanged,gui.DirectFormattingController.textStylingChanged,gui.DirectFormattingController.paragraphStylingChanged]),U=odf.Namespaces.textns,L=core.StepDirection.NEXT,z=null;this.enabledFeatures=l,this.formatTextSelection=b,this.createCursorStyleOp=function(e,t,n){var o=null,r=z;return n&&(r=(n=D.value().appliedStyles[0])&&n.styleProperties),r&&r["style:text-properties"]&&((o=new ops.OpApplyDirectStyling).init({memberid:i,position:e,length:t,setProperties:{"style:text-properties":r["style:text-properties"]}}),z=null,D.reset()),o},this.setBold=S,this.setItalic=C,this.setHasUnderline=N,this.setHasStrikethrough=x,this.setFontSize=function(e){y("fo:font-size",e+"pt")},this.setFontName=function(e){y("style:font-name",e)},this.getAppliedStyles=function(){return D.value().appliedStyles},this.toggleBold=g.bind(k,(function(){return s().isBold()}),S),this.toggleItalic=g.bind(k,(function(){return s().isItalic()}),C),this.toggleUnderline=g.bind(k,(function(){return s().hasUnderline()}),N),this.toggleStrikethrough=g.bind(k,(function(){return s().hasStrikeThrough()}),x),this.isBold=function(){return s().isBold()},this.isItalic=function(){return s().isItalic()},this.hasUnderline=function(){return s().hasUnderline()},this.hasStrikeThrough=function(){return s().hasStrikeThrough()},this.fontSize=function(){return s().fontSize()},this.fontName=function(){return s().fontName()},this.isAlignedLeft=function(){return s().isAlignedLeft()},this.isAlignedCenter=function(){return s().isAlignedCenter()},this.isAlignedRight=function(){return s().isAlignedRight()},this.isAlignedJustified=function(){return s().isAlignedJustified()},this.alignParagraphLeft=function(){return E("left"),!0},this.alignParagraphCenter=function(){return E("center"),!0},this.alignParagraphRight=function(){return E("right"),!0},this.alignParagraphJustified=function(){return E("justify"),!0},this.indent=function(){return w(T.bind(null,1)),!0},this.outdent=function(){return w(T.bind(null,-1)),!0},this.createParagraphStyleOps=function(e){if(!l().directParagraphStyling)return[];var t,n,r=I.getCursor(i),a=r.getSelectedRange(),s=[];r.hasForwardSelection()?(t=r.getAnchorNode(),n=r.getNode()):(t=r.getNode(),n=r.getAnchorNode()),r=M.getParagraphElement(n),runtime.assert(Boolean(r),"DirectFormattingController: Cursor outside paragraph");var u=r,d=[I.getPositionFilter(),I.createRootFilter(i)];return!1!==I.createStepIterator(a.endContainer,a.endOffset,d,u).nextStep()?s:(n!==t&&(r=M.getParagraphElement(t)),(z||O(a,r))&&(a=(a=D.value().appliedStyles[0])&&a.styleProperties)?((r=r.getAttributeNS(U,"style-name"))&&(a={"style:text-properties":a["style:text-properties"]},a=I.getFormatting().createDerivedStyleObject(r,"paragraph",a)),t=o.generateStyleName(),(r=new ops.OpAddStyle).init({memberid:i,styleName:t,styleFamily:"paragraph",isAutomaticStyle:!0,setProperties:a}),s.push(r),(r=new ops.OpSetParagraphStyle).init({memberid:i,styleName:t,position:e}),s.push(r),s):s)},this.subscribe=function(e,t){B.subscribe(e,t)},this.unsubscribe=function(e,t){B.unsubscribe(e,t)},this.destroy=function(e){I.unsubscribe(ops.Document.signalCursorAdded,p),I.unsubscribe(ops.Document.signalCursorRemoved,p),I.unsubscribe(ops.Document.signalCursorMoved,p),I.unsubscribe(ops.OdtDocument.signalParagraphStyleModified,h),I.unsubscribe(ops.OdtDocument.signalParagraphChanged,m),I.unsubscribe(ops.OdtDocument.signalOperationEnd,v),I.unsubscribe(ops.OdtDocument.signalProcessingBatchEnd,c),t.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,f),e()},I.subscribe(ops.Document.signalCursorAdded,p),I.subscribe(ops.Document.signalCursorRemoved,p),I.subscribe(ops.Document.signalCursorMoved,p),I.subscribe(ops.OdtDocument.signalParagraphStyleModified,h),I.subscribe(ops.OdtDocument.signalParagraphChanged,m),I.subscribe(ops.OdtDocument.signalOperationEnd,v),I.subscribe(ops.OdtDocument.signalProcessingBatchEnd,c),t.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,f),D=new core.LazyProperty((function(){var e=I.getCursor(i),o=e&&e.getSelectedRange(),r=[],a=(r=[],!0),s={directTextStyling:!0,directParagraphStyling:!0};return o&&(0===(r=u(o)).length&&(r=[o.startContainer,o.endContainer],a=!1),r=I.getFormatting().getAppliedStyles(r)),void 0!==r[0]&&z&&(r[0].styleProperties=F.mergeObjects(r[0].styleProperties,z)),!0===t.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)&&(s.directTextStyling=s.directParagraphStyling=n.isLocalCursorWithinOwnAnnotation()),s.directTextStyling&&(s.directTextStyling=a&&void 0!==e&&e.getSelectionType()===ops.OdtCursor.RangeSelection),{enabledFeatures:s,appliedStyles:r,styleSummary:new gui.StyleSummary(r)}})),P=D.value(),r||(k.formatTextSelection=A,k.setBold=A,k.setItalic=A,k.setHasUnderline=A,k.setHasStrikethrough=A,k.setFontSize=A,k.setFontName=A,k.toggleBold=_,k.toggleItalic=_,k.toggleUnderline=_,k.toggleStrikethrough=_),a||(k.alignParagraphCenter=R,k.alignParagraphJustified=R,k.alignParagraphLeft=R,k.alignParagraphRight=R,k.createParagraphStyleOps=function(){return[]},k.indent=R,k.outdent=R)},gui.DirectFormattingController.enabledChanged="enabled/changed",gui.DirectFormattingController.textStylingChanged="textStyling/changed",gui.DirectFormattingController.paragraphStylingChanged="paragraphStyling/changed",gui.DirectFormattingController.SelectionInfo=function(){},gui.KeyboardHandler=function(){function e(e,n){switch(n||(n=t.None),e){case gui.KeyboardHandler.KeyCode.LeftMeta:case gui.KeyboardHandler.KeyCode.RightMeta:case gui.KeyboardHandler.KeyCode.MetaInMozilla:n|=t.Meta;break;case gui.KeyboardHandler.KeyCode.Ctrl:n|=t.Ctrl;break;case gui.KeyboardHandler.KeyCode.Alt:n|=t.Alt;break;case gui.KeyboardHandler.KeyCode.Shift:n|=t.Shift}return e+":"+n}var t=gui.KeyboardHandler.Modifier,n=null,i={};this.setDefault=function(e){n=e},this.bind=function(t,n,o,r){t=e(t,n),runtime.assert(r||!1===i.hasOwnProperty(t),"tried to overwrite the callback handler of key combo: "+t),i[t]=o},this.unbind=function(t,n){var o=e(t,n);delete i[o]},this.reset=function(){n=null,i={}},this.handleEvent=function(o){var r=o.keyCode,a=t.None;o.metaKey&&(a|=t.Meta),o.ctrlKey&&(a|=t.Ctrl),o.altKey&&(a|=t.Alt),o.shiftKey&&(a|=t.Shift),r=e(r,a),a=!1,(r=i[r])?a=r():null!==n&&(a=n(o)),a&&(o.preventDefault?o.preventDefault():o.returnValue=!1)}},gui.KeyboardHandler.Modifier={None:0,Meta:1,Ctrl:2,Alt:4,CtrlAlt:6,Shift:8,MetaShift:9,CtrlShift:10,AltShift:12},gui.KeyboardHandler.KeyCode={Backspace:8,Tab:9,Clear:12,Enter:13,Shift:16,Ctrl:17,Alt:18,End:35,Home:36,Left:37,Up:38,Right:39,Down:40,Delete:46,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,LeftMeta:91,RightMeta:93,MetaInMozilla:224},gui.HyperlinkClickHandler=function(e,t,n){function i(){var t=e();runtime.assert(Boolean(t.classList),"Document container has no classList element"),t.classList.remove("webodf-inactiveLinks")}function o(){var t=e();runtime.assert(Boolean(t.classList),"Document container has no classList element"),t.classList.add("webodf-inactiveLinks")}function r(){c.removeEventListener("focus",o,!1),p.forEach((function(e){t.unbind(e.keyCode,e.modifier),n.unbind(e.keyCode,e.modifier)})),p.length=0}function a(e){if(r(),e!==s.None){switch(c.addEventListener("focus",o,!1),e){case s.Ctrl:p.push({keyCode:l.Ctrl,modifier:s.None});break;case s.Meta:p.push({keyCode:l.LeftMeta,modifier:s.None}),p.push({keyCode:l.RightMeta,modifier:s.None}),p.push({keyCode:l.MetaInMozilla,modifier:s.None})}p.forEach((function(e){t.bind(e.keyCode,e.modifier,i),n.bind(e.keyCode,e.modifier,o)}))}}var s=gui.KeyboardHandler.Modifier,l=gui.KeyboardHandler.KeyCode,u=xmldom.XPath,d=odf.OdfUtils,c=runtime.getWindow(),f=s.None,p=[];runtime.assert(null!==c,"Expected to be run in an environment which has a global window, like a browser."),this.handleClick=function(t){var n,i,o=t.target||t.srcElement;if(t.ctrlKey?n=s.Ctrl:t.metaKey&&(n=s.Meta),f===s.None||f===n){e:{for(;null!==o;){if(d.isHyperlink(o))break e;if(d.isParagraph(o))break;o=o.parentNode}o=null}o&&""!==(o=d.getHyperlinkTarget(o))&&("#"===o[0]?(o=o.substring(1),n=e(),0===(i=u.getODFElementsWithXPath(n,"//text:bookmark-start[@text:name='"+o+"']",odf.Namespaces.lookupNamespaceURI)).length&&(i=u.getODFElementsWithXPath(n,"//text:bookmark[@text:name='"+o+"']",odf.Namespaces.lookupNamespaceURI)),0<i.length&&i[0].scrollIntoView(!0)):/^\s*(javascript|data):/.test(o)?runtime.log("WARN:","potentially malicious URL ignored"):c.open(o),t.preventDefault?t.preventDefault():t.returnValue=!1)}},this.setModifier=function(e){f!==e&&(runtime.assert(e===s.None||e===s.Ctrl||e===s.Meta,"Unsupported KeyboardHandler.Modifier value: "+e),(f=e)!==s.None?o():i(),a(f))},this.getModifier=function(){return f},this.destroy=function(e){o(),r(),e()}},gui.EventManager=function(e){function t(e){function t(e,t,n){var i,o=!1;i="on"+t,e.attachEvent&&(e.attachEvent(i,n),o=!0),!o&&e.addEventListener&&(e.addEventListener(t,n,!1),o=!0),o&&!v[t]||!e.hasOwnProperty(i)||(e[i]=n)}function n(e,t,n){var i="on"+t;e.detachEvent&&e.detachEvent(i,n),e.removeEventListener&&e.removeEventListener(t,n,!1),e[i]===n&&(e[i]=null)}function i(t){if(-1===r.indexOf(t)){if(r.push(t),o.filters.every((function(e){return e(t)})))try{a.emit(e,t)}catch(t){runtime.log("Error occurred while processing "+e+":\n"+t.message+"\n"+t.stack)}runtime.setTimeout((function(){r.splice(r.indexOf(t),1)}),0)}}var o=this,r=[],a=new core.EventNotifier([e]);this.filters=[],this.subscribe=function(t){a.subscribe(e,t)},this.unsubscribe=function(t){a.unsubscribe(e,t)},this.destroy=function(){n(y,e,i),n(b,e,i),n(x,e,i)},S[e]&&t(y,e,i),t(b,e,i),t(x,e,i)}function n(e,t,n){function i(t){n(t,o,(function(t){t.type=e,r.emit(e,t)}))}var o={},r=new core.EventNotifier([e]);this.subscribe=function(t){r.subscribe(e,t)},this.unsubscribe=function(t){r.unsubscribe(e,t)},this.destroy=function(){t.forEach((function(e){w.unsubscribe(e,i)}))},t.forEach((function(e){w.subscribe(e,i)}))}function i(e){runtime.clearTimeout(e),delete E[e]}function o(e,t,n){var o=e.touches.length,r=e.touches[0],a=t.timer;"touchmove"===e.type||"touchend"===e.type?a&&i(a):"touchstart"===e.type&&(1!==o?runtime.clearTimeout(a):a=function(e,t){var n=runtime.setTimeout((function(){e(),i(n)}),400);return E[n]=!0,n}((function(){n({clientX:r.clientX,clientY:r.clientY,pageX:r.pageX,pageY:r.pageY,target:e.target||e.srcElement||null,detail:1})}))),t.timer=a}function r(e,t,n){var i=e.touches[0],o=e.target||e.srcElement||null,r=t.target;1!==e.touches.length||"touchend"===e.type?r=null:"touchstart"===e.type&&"webodf-draggable"===o.getAttribute("class")?r=o:"touchmove"===e.type&&r&&(e.preventDefault(),e.stopPropagation(),n({clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,target:r,detail:1})),t.target=r}function a(e,t,n){var i=e.target||e.srcElement||null,o=t.dragging;"drag"===e.type?o=!0:"touchend"===e.type&&o&&(o=!1,n({clientX:(e=e.changedTouches[0]).clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,target:i,detail:1})),t.dragging=o}function s(){x.classList.add("webodf-touchEnabled"),w.unsubscribe("touchstart",s)}function l(e){var t=e.scrollX,n=e.scrollY;this.restore=function(){e.scrollX===t&&e.scrollY===n||e.scrollTo(t,n)}}function u(e){var t=e.scrollTop,n=e.scrollLeft;this.restore=function(){e.scrollTop===t&&e.scrollLeft===n||(e.scrollTop=t,e.scrollLeft=n)}}function d(e,n){var i=N[e]||C[e]||null;return!i&&n&&(i=N[e]=new t(e)),i}function c(e,t){d(e,!0).subscribe(t)}function f(e,t){var n=d(e,!1);n&&n.unsubscribe(t)}function p(){return e.getDOMDocument().activeElement===b}function h(){p()&&b.blur(),b.setAttribute("disabled","true")}function m(){b.removeAttribute("disabled")}function g(){var e;p()||(e=function(e){for(var t=[];e;)(e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight)&&t.push(new u(e)),e=e.parentNode;return t.push(new l(y)),t}(b),m(),b.focus(),e.forEach((function(e){e.restore()})))}var b,y=runtime.getWindow(),v={beforecut:!0,beforepaste:!0,longpress:!0,drag:!0,dragstop:!0},S={mousedown:!0,mouseup:!0,focus:!0},C={},N={},x=e.getCanvas().getElement(),w=this,E={};this.addFilter=function(e,t){d(e,!0).filters.push(t)},this.removeFilter=function(e,t){var n=d(e,!0),i=n.filters.indexOf(t);-1!==i&&n.filters.splice(i,1)},this.subscribe=c,this.unsubscribe=f,this.hasFocus=p,this.focus=g,this.getEventTrap=function(){return b},this.setEditing=function(e){var t=p();t&&b.blur(),e?b.removeAttribute("readOnly"):b.setAttribute("readOnly","true"),t&&g()},this.destroy=function(e){f("touchstart",s),Object.keys(E).forEach((function(e){i(parseInt(e,10))})),E.length=0,Object.keys(C).forEach((function(e){C[e].destroy()})),C={},f("mousedown",h),f("mouseup",m),f("contextmenu",m),Object.keys(N).forEach((function(e){N[e].destroy()})),N={},b.parentNode.removeChild(b),e()},function(){var t=e.getOdfCanvas().getSizer(),i=t.ownerDocument;runtime.assert(Boolean(y),"EventManager requires a window object to operate correctly"),(b=i.createElement("textarea")).id="eventTrap",b.setAttribute("tabindex","-1"),b.setAttribute("readOnly","true"),b.setAttribute("rows","1"),t.appendChild(b),c("mousedown",h),c("mouseup",m),c("contextmenu",m),C.longpress=new n("longpress",["touchstart","touchmove","touchend"],o),C.drag=new n("drag",["touchstart","touchmove","touchend"],r),C.dragstop=new n("dragstop",["drag","touchend"],a),c("touchstart",s)}()},gui.IOSSafariSupport=function(e){function t(){n.innerHeight!==n.outerHeight&&(i.style.display="none",runtime.requestAnimationFrame((function(){i.style.display="block"})))}var n=runtime.getWindow(),i=e.getEventTrap();this.destroy=function(n){e.unsubscribe("focus",t),i.removeAttribute("autocapitalize"),i.style.WebkitTransform="",n()},e.subscribe("focus",t),i.setAttribute("autocapitalize","off"),i.style.WebkitTransform="translateX(-10000px)"},gui.HyperlinkController=function(e,t,n,i){function o(){var e=!0;!0===t.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)&&(e=n.isLocalCursorWithinOwnAnnotation()),e!==u&&(u=e,l.emit(gui.HyperlinkController.enabledChanged,u))}function r(e){e.getMemberId()===i&&o()}var a=odf.OdfUtils,s=e.getOdtDocument(),l=new core.EventNotifier([gui.HyperlinkController.enabledChanged]),u=!1;this.isEnabled=function(){return u},this.subscribe=function(e,t){l.subscribe(e,t)},this.unsubscribe=function(e,t){l.unsubscribe(e,t)},this.addHyperlink=function(t,n){if(u){var o=s.getCursorSelection(i),r=new ops.OpApplyHyperlink,a=[];(0===o.length||n)&&(n=n||t,(r=new ops.OpInsertText).init({memberid:i,position:o.position,text:n}),o.length=n.length,a.push(r)),(r=new ops.OpApplyHyperlink).init({memberid:i,position:o.position,length:o.length,hyperlink:t}),a.push(r),e.enqueue(a)}},this.removeHyperlinks=function(){if(u){var t,n,o=s.createPositionIterator(s.getRootNode()),r=s.getCursor(i).getSelectedRange(),l=a.getHyperlinkElements(r),d=r.collapsed&&1===l.length,c=s.getDOMDocument().createRange(),f=[];0!==l.length&&(l.forEach((function(e){c.selectNodeContents(e),t=s.convertDomToCursorRange({anchorNode:c.startContainer,anchorOffset:c.startOffset,focusNode:c.endContainer,focusOffset:c.endOffset}),(n=new ops.OpRemoveHyperlink).init({memberid:i,position:t.position,length:t.length}),f.push(n)})),d||(d=l[0],-1===r.comparePoint(d,0)&&(c.setStart(d,0),c.setEnd(r.startContainer,r.startOffset),0<(t=s.convertDomToCursorRange({anchorNode:c.startContainer,anchorOffset:c.startOffset,focusNode:c.endContainer,focusOffset:c.endOffset})).length&&((n=new ops.OpApplyHyperlink).init({memberid:i,position:t.position,length:t.length,hyperlink:a.getHyperlinkTarget(d)}),f.push(n))),l=l[l.length-1],o.moveToEndOfNode(l),o=o.unfilteredDomOffset(),1===r.comparePoint(l,o)&&(c.setStart(r.endContainer,r.endOffset),c.setEnd(l,o),0<(t=s.convertDomToCursorRange({anchorNode:c.startContainer,anchorOffset:c.startOffset,focusNode:c.endContainer,focusOffset:c.endOffset})).length&&((n=new ops.OpApplyHyperlink).init({memberid:i,position:t.position,length:t.length,hyperlink:a.getHyperlinkTarget(l)}),f.push(n)))),e.enqueue(f),c.detach())}},this.destroy=function(e){s.unsubscribe(ops.Document.signalCursorMoved,r),t.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,o),e()},s.subscribe(ops.Document.signalCursorMoved,r),t.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,o),o()},gui.HyperlinkController.enabledChanged="enabled/changed",gui.ImageController=function(e,t,n,i,o){function r(){var e=!0;!0===t.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)&&(e=n.isLocalCursorWithinOwnAnnotation()),e!==p&&(p=e,f.emit(gui.ImageController.enabledChanged,p))}function a(e){e.getMemberId()===i&&r()}var s={"image/gif":".gif","image/jpeg":".jpg","image/png":".png"},l=odf.Namespaces.textns,u=e.getOdtDocument(),d=odf.OdfUtils,c=u.getFormatting(),f=new core.EventNotifier([gui.HyperlinkController.enabledChanged]),p=!1;this.isEnabled=function(){return p},this.subscribe=function(e,t){f.subscribe(e,t)},this.unsubscribe=function(e,t){f.unsubscribe(e,t)},this.insertImage=function(t,n,r,a){if(p){var f,h=new core.CSSUnits;if(runtime.assert(0<r&&0<a,"Both width and height of the image should be greater than 0px."),a={width:r,height:a},r=d.getParagraphElement(u.getCursor(i).getNode()).getAttributeNS(l,"style-name")){r=c.getContentSize(r,"paragraph");var m=1,g=1;a.width>r.width&&(m=r.width/a.width),a.height>r.height&&(g=r.height/a.height),r=Math.min(m,g),a={width:a.width*r,height:a.height*r}}r=h.convert(a.width,"px","cm")+"cm",h=h.convert(a.height,"px","cm")+"cm",g=u.getOdfCanvas().odfContainer().rootElement.styles,a=t.toLowerCase(),m=s.hasOwnProperty(a)?s[a]:null,a=[],runtime.assert(null!==m,"Image type is not supported: "+t),m="Pictures/"+o.generateImageName()+m,(f=new ops.OpSetBlob).init({memberid:i,filename:m,mimetype:t,content:n}),a.push(f),c.getStyleElement("Graphics","graphic",[g])||((t=new ops.OpAddStyle).init({memberid:i,styleName:"Graphics",styleFamily:"graphic",isAutomaticStyle:!1,setProperties:{"style:graphic-properties":{"text:anchor-type":"paragraph","svg:x":"0cm","svg:y":"0cm","style:wrap":"dynamic","style:number-wrapped-paragraphs":"no-limit","style:wrap-contour":"false","style:vertical-pos":"top","style:vertical-rel":"paragraph","style:horizontal-pos":"center","style:horizontal-rel":"paragraph"}}}),a.push(t)),t=o.generateStyleName(),(n=new ops.OpAddStyle).init({memberid:i,styleName:t,styleFamily:"graphic",isAutomaticStyle:!0,setProperties:{"style:parent-style-name":"Graphics","style:graphic-properties":{"style:vertical-pos":"top","style:vertical-rel":"baseline","style:horizontal-pos":"center","style:horizontal-rel":"paragraph","fo:background-color":"transparent","style:background-transparency":"100%","style:shadow":"none","style:mirror":"none","fo:clip":"rect(0cm, 0cm, 0cm, 0cm)","draw:luminance":"0%","draw:contrast":"0%","draw:red":"0%","draw:green":"0%","draw:blue":"0%","draw:gamma":"100%","draw:color-inversion":"false","draw:image-opacity":"100%","draw:color-mode":"standard"}}}),a.push(n),(f=new ops.OpInsertImage).init({memberid:i,position:u.getCursorPosition(i),filename:m,frameWidth:r,frameHeight:h,frameStyleName:t,frameName:o.generateFrameName()}),a.push(f),e.enqueue(a)}},this.destroy=function(e){u.unsubscribe(ops.Document.signalCursorMoved,a),t.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,r),e()},u.subscribe(ops.Document.signalCursorMoved,a),t.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,r),r()},gui.ImageController.enabledChanged="enabled/changed",gui.ImageSelector=function(e){function t(){var t=e.getSizer(),n=o.createElement("div");return n.id="imageSelector",n.style.borderWidth="1px",t.appendChild(n),i.forEach((function(e){var t=o.createElement("div");t.className=e,n.appendChild(t)})),n}var n=odf.Namespaces.svgns,i="topLeft topRight bottomRight bottomLeft topMiddle rightMiddle bottomMiddle leftMiddle".split(" "),o=e.getElement().ownerDocument,r=!1;this.select=function(i){var a,s,l=o.getElementById("imageSelector");l||(l=t()),r=!0,a=l.parentNode,s=i.getBoundingClientRect();var u=a.getBoundingClientRect(),d=e.getZoomLevel();a=(s.left-u.left)/d-1,s=(s.top-u.top)/d-1,l.style.display="block",l.style.left=a+"px",l.style.top=s+"px",l.style.width=i.getAttributeNS(n,"width"),l.style.height=i.getAttributeNS(n,"height")},this.clearSelection=function(){var e;r&&(e=o.getElementById("imageSelector"))&&(e.style.display="none"),r=!1},this.isSelectorElement=function(e){var t=o.getElementById("imageSelector");return!!t&&(e===t||e.parentNode===t)}},function(){function e(e){function t(e){return r=e.which&&String.fromCharCode(e.which)===o,o=void 0,!1===r}function n(){r=!1}function i(e){o=e.data,r=!1}var o,r=!1;this.destroy=function(o){e.unsubscribe("textInput",n),e.unsubscribe("compositionend",i),e.removeFilter("keypress",t),o()},e.subscribe("textInput",n),e.subscribe("compositionend",i),e.addFilter("keypress",t)}gui.InputMethodEditor=function(t,n){function i(e){g&&(e?g.getNode().setAttributeNS("urn:webodf:names:cursor","composing","true"):(g.getNode().removeAttributeNS("urn:webodf:names:cursor","composing"),c.textContent=""))}function o(){v&&(v=!1,i(!1),C.emit(gui.InputMethodEditor.signalCompositionEnd,{data:S}),S="")}function r(){x||(x=!0,o(),g&&g.getSelectedRange().collapsed?b.value="":b.value=h.writeToString(g.getSelectedRange().cloneContents()),b.setSelectionRange(0,b.value.length),x=!1)}function a(){n.hasFocus()&&f.trigger()}function s(){p=void 0,f.cancel(),i(!0),v||C.emit(gui.InputMethodEditor.signalCompositionStart,{data:""})}function l(e){e=p=e.data,v=!0,S+=e,f.trigger()}function u(e){e.data!==p&&(e=e.data,v=!0,S+=e,f.trigger()),p=void 0}function d(){c.textContent=b.value}var c,f,p,h,m,g=null,b=n.getEventTrap(),y=b.ownerDocument,v=!1,S="",C=new core.EventNotifier([gui.InputMethodEditor.signalCompositionStart,gui.InputMethodEditor.signalCompositionEnd]),N=[],x=!1;this.subscribe=C.subscribe,this.unsubscribe=C.unsubscribe,this.registerCursor=function(e){e.getMemberId()===t&&((g=e).getNode().appendChild(c),e.subscribe(ops.OdtCursor.signalCursorUpdated,a),n.subscribe("input",d),n.subscribe("compositionupdate",d))},this.removeCursor=function(e){g&&e===t&&(g.getNode().removeChild(c),g.unsubscribe(ops.OdtCursor.signalCursorUpdated,a),n.unsubscribe("input",d),n.unsubscribe("compositionupdate",d),g=null)},this.destroy=function(e){n.unsubscribe("compositionstart",s),n.unsubscribe("compositionend",l),n.unsubscribe("textInput",u),n.unsubscribe("keypress",o),n.unsubscribe("focus",r),core.Async.destroyAll(m,e)},(h=new odf.TextSerializer).filter=new odf.OdfNodeFilter,n.subscribe("compositionstart",s),n.subscribe("compositionend",l),n.subscribe("textInput",u),n.subscribe("keypress",o),n.subscribe("focus",r),N.push(new e(n)),m=N.map((function(e){return e.destroy})),(c=y.createElement("span")).setAttribute("id","composer"),f=core.Task.createTimeoutTask(r,1),m.push(f.destroy)},gui.InputMethodEditor.signalCompositionStart="input/compositionstart",gui.InputMethodEditor.signalCompositionEnd="input/compositionend"}(),gui.MetadataController=function(e,t){function n(e){r.emit(gui.MetadataController.signalMetadataChanged,e)}function i(e){var t=-1===a.indexOf(e);return t||runtime.log("Setting "+e+" is restricted."),t}var o=e.getOdtDocument(),r=new core.EventNotifier([gui.MetadataController.signalMetadataChanged]),a=["dc:creator","dc:date","meta:editing-cycles","meta:editing-duration","meta:document-statistic"];this.setMetadata=function(n,o){var r,a={},s="";n&&Object.keys(n).filter(i).forEach((function(e){a[e]=n[e]})),o&&(s=o.filter(i).join(",")),(0<s.length||0<Object.keys(a).length)&&((r=new ops.OpUpdateMetadata).init({memberid:t,setProperties:a,removedProperties:0<s.length?{attributes:s}:null}),e.enqueue([r]))},this.getMetadata=function(e){var t;return runtime.assert("string"==typeof e,"Property must be a string"),t=e.split(":"),runtime.assert(2===t.length,"Property must be a namespace-prefixed string"),e=odf.Namespaces.lookupNamespaceURI(t[0]),runtime.assert(Boolean(e),"Prefix must be for an ODF namespace."),o.getOdfCanvas().odfContainer().getMetadata(e,t[1])},this.subscribe=function(e,t){r.subscribe(e,t)},this.unsubscribe=function(e,t){r.unsubscribe(e,t)},this.destroy=function(e){o.unsubscribe(ops.OdtDocument.signalMetadataUpdated,n),e()},o.subscribe(ops.OdtDocument.signalMetadataUpdated,n)},gui.MetadataController.signalMetadataChanged="metadata/changed",gui.PasteController=function(e,t,n,i){function o(){s=!0!==t.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)||n.isLocalCursorWithinOwnAnnotation()}function r(e){e.getMemberId()===i&&o()}var a=e.getOdtDocument(),s=!1,l=odf.Namespaces.textns,u=core.StepDirection.NEXT,d=odf.OdfUtils;this.isEnabled=function(){return s},this.paste=function(t){if(s){var n=a.getCursorPosition(i),o=a.getCursor(i).getNode(),r=(o=d.getParagraphElement(o)).getAttributeNS(l,"style-name")||"",c=n,f=[],p=a.convertDomPointToCursorStep(o,0,u);t.replace(/\r/g,"").split("\n").forEach((function(e){var t=new ops.OpInsertText,n=new ops.OpSplitParagraph;t.init({memberid:i,position:c,text:e,moveCursor:!0}),f.push(t),c+=e.length,n.init({memberid:i,position:c,paragraphStyleName:r,sourceParagraphPosition:p,moveCursor:!0}),f.push(n),p=c+=1})),f.pop(),e.enqueue(f)}},this.destroy=function(e){a.unsubscribe(ops.Document.signalCursorMoved,r),t.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,o),e()},a.subscribe(ops.Document.signalCursorMoved,r),t.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,o),o()},gui.ClosestXOffsetScanner=function(e){function t(t){return null!==t&&void 0!==i&&Math.abs(t-e)>i}function n(n){null!==n&&!1===t(n)&&(i=Math.abs(n-e))}var i,o=this,r=gui.StepInfo.VisualDirection.LEFT_TO_RIGHT;this.token=void 0,this.process=function(e,i,a){var s,l;return e.visualDirection===r?(s=i&&i.right,l=a&&a.left):(s=i&&i.left,l=a&&a.right),!(!t(s)&&!t(l)&&((i||a)&&(n(s),n(l),o.token=e.token),1))}},gui.LineBoundaryScanner=function(){var e=this,t=null;this.token=void 0,this.process=function(n,i,o){var r;if(r=o)if(t){var a=t;r=Math.min(a.bottom-a.top,o.bottom-o.top);var s=Math.max(a.top,o.top);a=Math.min(a.bottom,o.bottom)-s,r=.4>=(0<r?a/r:0)}else r=!1;return!i||o&&!r||(e.token=n.token),!!r||(t=(n=t)&&i?{left:Math.min(n.left,i.left),right:Math.max(n.right,i.right),top:Math.min(n.top,i.top),bottom:Math.min(n.bottom,i.bottom)}:n||i,!1)}},gui.ParagraphBoundaryScanner=function(){var e,t=this,n=!1,i=odf.OdfUtils;this.token=void 0,this.process=function(o){var r=i.getParagraphElement(o.container());return n||(e=r,n=!0),e!==r||(t.token=o.token,!1)}},odf.WordBoundaryFilter=function(e,t){function n(t,n,i){for(var o,r=null,a=e.getRootNode();t!==a&&null!==t&&null===r;)i(o=0>n?t.previousSibling:t.nextSibling)===NodeFilter.FILTER_ACCEPT&&(r=o),t=t.parentNode;return r}function i(e,t){var n;return null===e?p.NO_NEIGHBOUR:a.isCharacterElement(e)?p.SPACE_CHAR:e.nodeType===o||a.isTextSpan(e)||a.isHyperlink(e)?(n=e.textContent.charAt(t()),l.test(n)?p.SPACE_CHAR:s.test(n)?p.PUNCTUATION_CHAR:p.WORD_CHAR):p.OTHER}var o=Node.TEXT_NODE,r=Node.ELEMENT_NODE,a=odf.OdfUtils,s=/[!-#%-*,-\/:-;?-@\[-\]_{}\u00a1\u00ab\u00b7\u00bb\u00bf;\u00b7\u055a-\u055f\u0589-\u058a\u05be\u05c0\u05c3\u05c6\u05f3-\u05f4\u0609-\u060a\u060c-\u060d\u061b\u061e-\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0964-\u0965\u0970\u0df4\u0e4f\u0e5a-\u0e5b\u0f04-\u0f12\u0f3a-\u0f3d\u0f85\u0fd0-\u0fd4\u104a-\u104f\u10fb\u1361-\u1368\u166d-\u166e\u169b-\u169c\u16eb-\u16ed\u1735-\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u180a\u1944-\u1945\u19de-\u19df\u1a1e-\u1a1f\u1b5a-\u1b60\u1c3b-\u1c3f\u1c7e-\u1c7f\u2000-\u206e\u207d-\u207e\u208d-\u208e\u3008-\u3009\u2768-\u2775\u27c5-\u27c6\u27e6-\u27ef\u2983-\u2998\u29d8-\u29db\u29fc-\u29fd\u2cf9-\u2cfc\u2cfe-\u2cff\u2e00-\u2e7e\u3000-\u303f\u30a0\u30fb\ua60d-\ua60f\ua673\ua67e\ua874-\ua877\ua8ce-\ua8cf\ua92e-\ua92f\ua95f\uaa5c-\uaa5f\ufd3e-\ufd3f\ufe10-\ufe19\ufe30-\ufe52\ufe54-\ufe61\ufe63\ufe68\ufe6a-\ufe6b\uff01-\uff03\uff05-\uff0a\uff0c-\uff0f\uff1a-\uff1b\uff1f-\uff20\uff3b-\uff3d\uff3f\uff5b\uff5d\uff5f-\uff65]|\ud800[\udd00-\udd01\udf9f\udfd0]|\ud802[\udd1f\udd3f\ude50-\ude58]|\ud809[\udc00-\udc7e]/,l=/\s/,u=core.PositionFilter.FilterResult.FILTER_ACCEPT,d=core.PositionFilter.FilterResult.FILTER_REJECT,c=odf.WordBoundaryFilter.IncludeWhitespace.TRAILING,f=odf.WordBoundaryFilter.IncludeWhitespace.LEADING,p={NO_NEIGHBOUR:0,SPACE_CHAR:1,PUNCTUATION_CHAR:2,WORD_CHAR:3,OTHER:4};this.acceptPosition=function(e){var o=e.container(),a=e.leftNode(),s=e.rightNode(),l=e.unfilteredDomOffset,h=function(){return e.unfilteredDomOffset()-1};return o.nodeType===r&&(null===s&&(s=n(o,1,e.getNodeFilter())),null===a&&(a=n(o,-1,e.getNodeFilter()))),o!==s&&(l=function(){return 0}),o!==a&&null!==a&&(h=function(){return a.textContent.length-1}),o=i(a,h),s=i(s,l),o===p.WORD_CHAR&&s===p.WORD_CHAR||o===p.PUNCTUATION_CHAR&&s===p.PUNCTUATION_CHAR||t===c&&o!==p.NO_NEIGHBOUR&&s===p.SPACE_CHAR||t===f&&o===p.SPACE_CHAR&&s!==p.NO_NEIGHBOUR?d:u}},odf.WordBoundaryFilter.IncludeWhitespace={None:0,TRAILING:1,LEADING:2},gui.SelectionController=function(e,t){function n(e){var n=e.spec();(e.isEdit||n.memberid===t)&&(g=void 0,b.cancel())}function i(){var e=y.getCursor(t).getNode();return y.createStepIterator(e,0,[C,x],y.getRootElement(e))}function o(e,t,n){n=new odf.WordBoundaryFilter(y,n);var i=y.getRootElement(e)||y.getRootNode(),o=y.createRootFilter(i);return y.createStepIterator(e,t,[C,o,n],i)}function r(e,t){return t?{anchorNode:e.startContainer,anchorOffset:e.startOffset,focusNode:e.endContainer,focusOffset:e.endOffset}:{anchorNode:e.endContainer,anchorOffset:e.endOffset,focusNode:e.startContainer,focusOffset:e.startOffset}}function a(e,n,i){var o=new ops.OpMoveCursor;return o.init({memberid:t,position:e,length:n||0,selectionType:i}),o}function s(n,i,o){var s;(s=r((s=y.getCursor(t)).getSelectedRange(),s.hasForwardSelection())).focusNode=n,s.focusOffset=i,o||(s.anchorNode=s.focusNode,s.anchorOffset=s.focusOffset),n=y.convertDomToCursorRange(s),e.enqueue([a(n.position,n.length)])}function l(e){var t;(t=o(e.startContainer,e.startOffset,E)).roundToPreviousStep()&&e.setStart(t.container(),t.offset()),(t=o(e.endContainer,e.endOffset,T)).roundToNextStep()&&e.setEnd(t.container(),t.offset())}function u(e){var t=(n=S.getParagraphElements(e))[0],n=n[n.length-1];t&&e.setStart(t,0),n&&(S.isParagraph(e.endContainer)&&0===e.endOffset?e.setEndBefore(n):e.setEnd(n,n.childNodes.length))}function d(e,t,n,i){var o,r;i?(o=n.startContainer,r=n.startOffset):(o=n.endContainer,r=n.endOffset),v.containsNode(e,o)||(r=0>v.comparePoints(e,0,o,r)?0:e.childNodes.length,o=e),(e=y.createStepIterator(o,r,t,S.getParagraphElement(o)||e)).roundToClosestStep()||runtime.assert(!1,"No step found in requested range"),i?n.setStart(e.container(),e.offset()):n.setEnd(e.container(),e.offset())}function c(e,t){var n=i();n.advanceStep(e)&&s(n.container(),n.offset(),t)}function f(e,t){var n,o=g,r=[new gui.LineBoundaryScanner,new gui.ParagraphBoundaryScanner];void 0===o&&w&&(o=w()),isNaN(o)||(n=i(),N.moveToFilteredStep(n,e,r)&&n.advanceStep(e)&&(r=[new gui.ClosestXOffsetScanner(o),new gui.LineBoundaryScanner,new gui.ParagraphBoundaryScanner],N.moveToFilteredStep(n,e,r)&&(s(n.container(),n.offset(),t),g=o,b.restart())))}function p(e,t){var n=i(),o=[new gui.LineBoundaryScanner,new gui.ParagraphBoundaryScanner];N.moveToFilteredStep(n,e,o)&&s(n.container(),n.offset(),t)}function h(e,n){var i;(i=o((i=r((i=y.getCursor(t)).getSelectedRange(),i.hasForwardSelection())).focusNode,i.focusOffset,E)).advanceStep(e)&&s(i.container(),i.offset(),n)}function m(e,n,i){var o=!1,a=r((a=y.getCursor(t)).getSelectedRange(),a.hasForwardSelection());o=y.getRootElement(a.focusNode),runtime.assert(Boolean(o),"SelectionController: Cursor outside root"),(a=y.createStepIterator(a.focusNode,a.focusOffset,[C,x],o)).roundToClosestStep(),a.advanceStep(e)&&(i=i(a.container()))&&(e===O?(a.setPosition(i,0),o=a.roundToNextStep()):(a.setPosition(i,i.childNodes.length),o=a.roundToPreviousStep()),o&&s(a.container(),a.offset(),n))}var g,b,y=e.getOdtDocument(),v=core.DomUtils,S=odf.OdfUtils,C=y.getPositionFilter(),N=new gui.GuiStepUtils,x=y.createRootFilter(t),w=null,E=odf.WordBoundaryFilter.IncludeWhitespace.TRAILING,T=odf.WordBoundaryFilter.IncludeWhitespace.LEADING,O=core.StepDirection.PREVIOUS,A=core.StepDirection.NEXT;this.selectionToRange=function(e){var t=0<=v.comparePoints(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset),n=e.focusNode.ownerDocument.createRange();return t?(n.setStart(e.anchorNode,e.anchorOffset),n.setEnd(e.focusNode,e.focusOffset)):(n.setStart(e.focusNode,e.focusOffset),n.setEnd(e.anchorNode,e.anchorOffset)),{range:n,hasForwardSelection:t}},this.rangeToSelection=r,this.selectImage=function(t){var n,i=y.getRootElement(t),o=y.createRootFilter(i);(i=y.createStepIterator(t,0,[o,y.getPositionFilter()],i)).roundToPreviousStep()||runtime.assert(!1,"No walkable position before frame"),o=i.container(),n=i.offset(),i.setPosition(t,t.childNodes.length),i.roundToNextStep()||runtime.assert(!1,"No walkable position after frame"),t=a((t=y.convertDomToCursorRange({anchorNode:o,anchorOffset:n,focusNode:i.container(),focusOffset:i.offset()})).position,t.length,ops.OdtCursor.RegionSelection),e.enqueue([t])},this.expandToWordBoundaries=l,this.expandToParagraphBoundaries=u,this.selectRange=function(n,i,o){var s,c=y.getOdfCanvas().getElement(),f=[C];s=v.containsNode(c,n.startContainer),c=v.containsNode(c,n.endContainer),(s||c)&&(s&&c&&(2===o?l(n):3<=o&&u(n)),(o=i?y.getRootElement(n.startContainer):y.getRootElement(n.endContainer))||(o=y.getRootNode()),f.push(y.createRootFilter(o)),d(o,f,n,!0),d(o,f,n,!1),n=r(n,i),i=y.convertDomToCursorRange(n),n=y.getCursorSelection(t),(i.position!==n.position||i.length!==n.length)&&(n=a(i.position,i.length,ops.OdtCursor.RangeSelection),e.enqueue([n])))},this.moveCursorToLeft=function(){return c(O,!1),!0},this.moveCursorToRight=function(){return c(A,!1),!0},this.extendSelectionToLeft=function(){return c(O,!0),!0},this.extendSelectionToRight=function(){return c(A,!0),!0},this.setCaretXPositionLocator=function(e){w=e},this.moveCursorUp=function(){return f(O,!1),!0},this.moveCursorDown=function(){return f(A,!1),!0},this.extendSelectionUp=function(){return f(O,!0),!0},this.extendSelectionDown=function(){return f(A,!0),!0},this.moveCursorBeforeWord=function(){return h(O,!1),!0},this.moveCursorPastWord=function(){return h(A,!1),!0},this.extendSelectionBeforeWord=function(){return h(O,!0),!0},this.extendSelectionPastWord=function(){return h(A,!0),!0},this.moveCursorToLineStart=function(){return p(O,!1),!0},this.moveCursorToLineEnd=function(){return p(A,!1),!0},this.extendSelectionToLineStart=function(){return p(O,!0),!0},this.extendSelectionToLineEnd=function(){return p(A,!0),!0},this.extendSelectionToParagraphStart=function(){return m(O,!0,S.getParagraphElement),!0},this.extendSelectionToParagraphEnd=function(){return m(A,!0,S.getParagraphElement),!0},this.moveCursorToParagraphStart=function(){return m(O,!1,S.getParagraphElement),!0},this.moveCursorToParagraphEnd=function(){return m(A,!1,S.getParagraphElement),!0},this.moveCursorToDocumentStart=function(){return m(O,!1,y.getRootElement),!0},this.moveCursorToDocumentEnd=function(){return m(A,!1,y.getRootElement),!0},this.extendSelectionToDocumentStart=function(){return m(O,!0,y.getRootElement),!0},this.extendSelectionToDocumentEnd=function(){return m(A,!0,y.getRootElement),!0},this.extendSelectionToEntireDocument=function(){var n,i,o,r=y.getCursor(t);return r=y.getRootElement(r.getNode()),runtime.assert(Boolean(r),"SelectionController: Cursor outside root"),(o=y.createStepIterator(r,0,[C,x],r)).roundToClosestStep(),n=o.container(),i=o.offset(),o.setPosition(r,r.childNodes.length),o.roundToClosestStep(),r=y.convertDomToCursorRange({anchorNode:n,anchorOffset:i,focusNode:o.container(),focusOffset:o.offset()}),e.enqueue([a(r.position,r.length)]),!0},this.destroy=function(e){y.unsubscribe(ops.OdtDocument.signalOperationStart,n),core.Async.destroyAll([b.destroy],e)},b=core.Task.createTimeoutTask((function(){g=void 0}),2e3),y.subscribe(ops.OdtDocument.signalOperationStart,n)},gui.TextController=function(e,t,n,i,o,r){function a(){m=!0!==t.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)||n.isLocalCursorWithinOwnAnnotation()}function s(e){e.getMemberId()===i&&a()}function l(e,t,n){var i=[f.getPositionFilter()];return n&&i.push(f.createRootFilter(e.startContainer)),(n=f.createStepIterator(e.startContainer,e.startOffset,i,t)).roundToClosestStep()||runtime.assert(!1,"No walkable step found in paragraph element at range start"),t=f.convertDomPointToCursorStep(n.container(),n.offset()),e.collapsed?e=t:(n.setPosition(e.endContainer,e.endOffset),n.roundToClosestStep()||runtime.assert(!1,"No walkable step found in paragraph element at range end"),e=f.convertDomPointToCursorStep(n.container(),n.offset())),{position:t,length:e-t}}function u(e){var t,n,o,r=p.getParagraphElements(e),a=e.cloneRange(),s=[];return t=r[0],1<r.length&&(p.hasNoODFContent(t)&&(t=r[r.length-1]),n=t.getAttributeNS(odf.Namespaces.textns,"style-name")||""),r.forEach((function(t,r){var u,d;a.setStart(t,0),a.collapse(!0),u=l(a,t,!1).position,0<r&&((d=new ops.OpMergeParagraph).init({memberid:i,paragraphStyleName:n,destinationStartPosition:o,sourceStartPosition:u,moveCursor:1===r}),s.unshift(d)),o=u,a.selectNodeContents(t),(u=h.rangeIntersection(a,e))&&0<(u=l(u,t,!0)).length&&((d=new ops.OpRemoveText).init({memberid:i,position:u.position,length:u.length}),s.unshift(d))})),s}function d(e){return 0>e.length&&(e.position+=e.length,e.length=-e.length),e}function c(t){if(!m)return!1;var n,o,r=f.getCursor(i).getSelectedRange().cloneRange(),a=d(f.getCursorSelection(i));if(0===a.length){a=void 0,n=f.getCursor(i).getNode(),o=f.getRootElement(n);var s=[f.getPositionFilter(),f.createRootFilter(o)];(o=f.createStepIterator(n,0,s,o)).roundToClosestStep()&&(t?o.nextStep():o.previousStep())&&(a=d(f.convertDomToCursorRange({anchorNode:n,anchorOffset:0,focusNode:o.container(),focusOffset:o.offset()})),t?(r.setStart(n,0),r.setEnd(o.container(),o.offset())):(r.setStart(o.container(),o.offset()),r.setEnd(n,0)))}return a&&e.enqueue(u(r)),void 0!==a}var f=e.getOdtDocument(),p=odf.OdfUtils,h=core.DomUtils,m=!1,g=odf.Namespaces.textns,b=core.StepDirection.NEXT;this.isEnabled=function(){return m},this.enqueueParagraphSplittingOps=function(){if(!m)return!1;var t,n=(t=f.getCursor(i)).getSelectedRange(),o=d(f.getCursorSelection(i)),a=[],s=(t=p.getParagraphElement(t.getNode())).getAttributeNS(g,"style-name")||"";return 0<o.length&&(a=a.concat(u(n))),(n=new ops.OpSplitParagraph).init({memberid:i,position:o.position,paragraphStyleName:s,sourceParagraphPosition:f.convertDomPointToCursorStep(t,0,b),moveCursor:!0}),a.push(n),r&&(o=r(o.position+1),a=a.concat(o)),e.enqueue(a),!0},this.removeTextByBackspaceKey=function(){return c(!1)},this.removeTextByDeleteKey=function(){return c(!0)},this.removeCurrentSelection=function(){if(!m)return!1;var t=f.getCursor(i).getSelectedRange();return e.enqueue(u(t)),!0},this.insertText=function(t){if(m){var n=f.getCursor(i).getSelectedRange(),r=d(f.getCursorSelection(i)),a=[],s=!1;0<r.length&&(a=a.concat(u(n)),s=!0),(n=new ops.OpInsertText).init({memberid:i,position:r.position,text:t,moveCursor:!0}),a.push(n),o&&(t=o(r.position,t.length,s))&&a.push(t),e.enqueue(a)}},this.destroy=function(e){f.unsubscribe(ops.Document.signalCursorMoved,s),t.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,a),e()},f.subscribe(ops.Document.signalCursorMoved,s),t.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,a),a()},gui.UndoManager=function(){},gui.UndoManager.prototype.subscribe=function(e,t){},gui.UndoManager.prototype.unsubscribe=function(e,t){},gui.UndoManager.prototype.setDocument=function(e){},gui.UndoManager.prototype.setInitialState=function(){},gui.UndoManager.prototype.initialize=function(){},gui.UndoManager.prototype.purgeInitialState=function(){},gui.UndoManager.prototype.setPlaybackFunction=function(e){},gui.UndoManager.prototype.hasUndoStates=function(){},gui.UndoManager.prototype.hasRedoStates=function(){},gui.UndoManager.prototype.moveForward=function(e){},gui.UndoManager.prototype.moveBackward=function(e){},gui.UndoManager.prototype.onOperationExecuted=function(e){},gui.UndoManager.prototype.isDocumentModified=function(){},gui.UndoManager.prototype.setDocumentModified=function(e){},gui.UndoManager.signalUndoStackChanged="undoStackChanged",gui.UndoManager.signalUndoStateCreated="undoStateCreated",gui.UndoManager.signalUndoStateModified="undoStateModified",gui.UndoManager.signalDocumentModifiedChanged="documentModifiedChanged",gui.SessionControllerOptions=function(){this.annotationsEnabled=this.directParagraphStylingEnabled=this.directTextStylingEnabled=!1},function(){var e=core.PositionFilter.FilterResult.FILTER_ACCEPT;gui.SessionController=function(t,n,i,o){function r(e,t){var n=F.getDOMDocument(),i=null;return n.caretRangeFromPoint?i={container:(n=n.caretRangeFromPoint(e,t)).startContainer,offset:n.startOffset}:n.caretPositionFromPoint&&(n=n.caretPositionFromPoint(e,t))&&n.offsetNode&&(i={container:n.offsetNode,offset:n.offset}),i}function a(e){var t=F.getCursor(n).getSelectedRange();t.collapsed?e.preventDefault():H.setDataFromRange(e,t)?ee.removeCurrentSelection():runtime.log("Cut operation failed")}function s(){return!1!==F.getCursor(n).getSelectedRange().collapsed}function l(e){var t=F.getCursor(n).getSelectedRange();t.collapsed?e.preventDefault():H.setDataFromRange(e,t)||runtime.log("Copy operation failed")}function u(e){var t;I.clipboardData&&I.clipboardData.getData?t=I.clipboardData.getData("Text"):e.clipboardData&&e.clipboardData.getData&&(t=e.clipboardData.getData("text/plain")),t&&(ee.removeCurrentSelection(),oe.paste(t)),e.preventDefault?e.preventDefault():e.returnValue=!1}function d(){return!1}function c(e){J&&J.onOperationExecuted(e)}function f(e){F.emit(ops.OdtDocument.signalUndoStackChanged,e)}function p(){var e;return!!J&&(e=G.hasFocus(),J.moveBackward(1),e&&G.focus(),!0)}function h(){var e;return!!J&&(e=G.hasFocus(),J.moveForward(1),e&&G.focus(),!0)}function m(t){var o=F.getCursor(n).getSelectedRange(),a=(t.target||t.srcElement||null).getAttribute("end");o&&a&&(t=r(t.clientX,t.clientY))&&(ie.setUnfilteredPosition(t.container,t.offset),K.acceptPosition(ie)===e&&(o=o.cloneRange(),"left"===a?o.setStart(ie.container(),ie.unfilteredDomOffset()):o.setEnd(ie.container(),ie.unfilteredDomOffset()),i.setSelectedRange(o,"right"===a),F.emit(ops.Document.signalCursorMoved,i)))}function g(){ue.selectRange(i.getSelectedRange(),i.hasForwardSelection(),1)}function b(){var t=I.getSelection(),n=0<t.rangeCount&&ue.selectionToRange(t);V&&n&&(q=!0,ne.clearSelection(),ie.setUnfilteredPosition(t.focusNode,t.focusOffset),K.acceptPosition(ie)===e&&(2===ae?ue.expandToWordBoundaries(n.range):3<=ae&&ue.expandToParagraphBoundaries(n.range),i.setSelectedRange(n.range,n.hasForwardSelection),F.emit(ops.Document.signalCursorMoved,i)))}function y(e){var t=e.target||e.srcElement||null,i=F.getCursor(n);(V=null!==t&&U.containsNode(F.getOdfCanvas().getElement(),t))&&(q=!1,t=F.getRootElement(t)||F.getRootNode(),K=F.createRootFilter(t),ae=0===e.button?e.detail:0,i&&e.shiftKey?I.getSelection().collapse(i.getAnchorNode(),0):(e=I.getSelection(),t=i.getSelectedRange(),e.extend?i.hasForwardSelection()?(e.collapse(t.startContainer,t.startOffset),e.extend(t.endContainer,t.endOffset)):(e.collapse(t.endContainer,t.endOffset),e.extend(t.startContainer,t.startOffset)):(e.removeAllRanges(),e.addRange(t.cloneRange()))),1<ae&&b())}function v(e){var t=F.getRootElement(e),n=F.createRootFilter(t);return(t=F.createStepIterator(e,0,[n,F.getPositionFilter()],t)).setPosition(e,e.childNodes.length),t.roundToNextStep()?{container:t.container(),offset:t.offset()}:null}function S(e){var t;t=(t=I.getSelection())?{anchorNode:t.anchorNode,anchorOffset:t.anchorOffset,focusNode:t.focusNode,focusOffset:t.focusOffset}:null;var n,i,o=I.getSelection().isCollapsed;t.anchorNode||t.focusNode||!(n=r(e.clientX,e.clientY))||(t.anchorNode=n.container,t.anchorOffset=n.offset,t.focusNode=t.anchorNode,t.focusOffset=t.anchorOffset),L.isImage(t.focusNode)&&0===t.focusOffset&&L.isCharacterFrame(t.focusNode.parentNode)?(n=(i=t.focusNode.parentNode).getBoundingClientRect(),e.clientX>n.left&&(n=v(i))&&(t.focusNode=n.container,t.focusOffset=n.offset,o&&(t.anchorNode=t.focusNode,t.anchorOffset=t.focusOffset))):L.isImage(t.focusNode.firstChild)&&1===t.focusOffset&&L.isCharacterFrame(t.focusNode)&&(n=v(t.focusNode))&&(t.anchorNode=t.focusNode=n.container,t.anchorOffset=t.focusOffset=n.offset),t.anchorNode&&t.focusNode&&(t=ue.selectionToRange(t),ue.selectRange(t.range,t.hasForwardSelection,0===e.button?e.detail:0)),G.focus()}function C(e){var t;(t=r(e.clientX,e.clientY))&&(e={anchorNode:e=t.container,anchorOffset:t=t.offset,focusNode:e,focusOffset:t},e=ue.selectionToRange(e),ue.selectRange(e.range,e.hasForwardSelection,2),G.focus())}function N(e){var t,n,o,r=e.target||e.srcElement||null;P.processRequests(),V&&(L.isImage(r)&&L.isCharacterFrame(r.parentNode)&&I.getSelection().isCollapsed?(ue.selectImage(r.parentNode),G.focus()):ne.isSelectorElement(r)?G.focus():q?(n=(r=i.getSelectedRange()).collapsed,L.isImage(r.endContainer)&&0===r.endOffset&&L.isCharacterFrame(r.endContainer.parentNode)&&(o=v(o=r.endContainer.parentNode))&&(r.setEnd(o.container,o.offset),n&&r.collapse(!1)),ue.selectRange(r,i.hasForwardSelection(),0===e.button?e.detail:0),G.focus()):he?S(e):(t=U.cloneEvent(e),_=runtime.setTimeout((function(){S(t)}),0)),ae=0,q=V=!1)}function x(e){var t=F.getCursor(n).getSelectedRange();t.collapsed||z.exportRangeToDataTransfer(e.dataTransfer,t)}function w(){V&&G.focus(),ae=0,q=V=!1}function E(e){N(e)}function T(e){var t=e.target||e.srcElement||null,n=null;"annotationRemoveButton"===t.className?(runtime.assert(Y,"Remove buttons are displayed on annotations while annotation editing is disabled in the controller."),n=t.parentNode.getElementsByTagNameNS(odf.Namespaces.officens,"annotation").item(0),$.removeAnnotation(n),G.focus()):"webodf-draggable"!==t.getAttribute("class")&&N(e)}function O(e){(e=e.data)&&(-1===e.indexOf("\n")?ee.insertText(e):oe.paste(e))}function A(e){return function(t){return F.getCursor(n).getSelectionType()!==ops.OdtCursor.RangeSelection||e(t)}}function R(e){G.unsubscribe("keydown",W.handleEvent),G.unsubscribe("keypress",j.handleEvent),G.unsubscribe("keyup",X.handleEvent),G.unsubscribe("copy",l),G.unsubscribe("mousedown",y),G.unsubscribe("mousemove",P.trigger),G.unsubscribe("mouseup",T),G.unsubscribe("contextmenu",E),G.unsubscribe("dragstart",x),G.unsubscribe("dragend",w),G.unsubscribe("click",se.handleClick),G.unsubscribe("longpress",C),G.unsubscribe("drag",m),G.unsubscribe("dragstop",g),F.unsubscribe(ops.OdtDocument.signalOperationEnd,D.trigger),F.unsubscribe(ops.Document.signalCursorAdded,re.registerCursor),F.unsubscribe(ops.Document.signalCursorRemoved,re.removeCursor),F.unsubscribe(ops.OdtDocument.signalOperationEnd,c),e()}var _,P,D,k,I=runtime.getWindow(),F=t.getOdtDocument(),M=new gui.SessionConstraints,B=new gui.SessionContext(t,n),U=core.DomUtils,L=odf.OdfUtils,z=new gui.MimeDataExporter,H=new gui.Clipboard(z),W=new gui.KeyboardHandler,j=new gui.KeyboardHandler,X=new gui.KeyboardHandler,V=!1,Z=new odf.ObjectNameGenerator(F.getOdfCanvas().odfContainer(),n),q=!1,K=null,J=null,G=new gui.EventManager(F),Y=o.annotationsEnabled,$=new gui.AnnotationController(t,M,n),Q=new gui.DirectFormattingController(t,M,B,n,Z,o.directTextStylingEnabled,o.directParagraphStylingEnabled),ee=new gui.TextController(t,M,B,n,Q.createCursorStyleOp,Q.createParagraphStyleOps),te=new gui.ImageController(t,M,B,n,Z),ne=new gui.ImageSelector(F.getOdfCanvas()),ie=F.createPositionIterator(F.getRootNode()),oe=new gui.PasteController(t,M,B,n),re=new gui.InputMethodEditor(n,G),ae=0,se=new gui.HyperlinkClickHandler(F.getOdfCanvas().getElement,W,X),le=new gui.HyperlinkController(t,M,B,n),ue=new gui.SelectionController(t,n),de=new gui.MetadataController(t,n),ce=gui.KeyboardHandler.Modifier,fe=gui.KeyboardHandler.KeyCode,pe=-1!==I.navigator.appVersion.toLowerCase().indexOf("mac"),he=-1!==["iPad","iPod","iPhone"].indexOf(I.navigator.platform);runtime.assert(null!==I,"Expected to be run in an environment which has a global window, like a browser."),this.undo=p,this.redo=h,this.insertLocalCursor=function(){runtime.assert(void 0===t.getOdtDocument().getCursor(n),"Inserting local cursor a second time.");var e=new ops.OpAddCursor;e.init({memberid:n}),t.enqueue([e]),G.focus()},this.removeLocalCursor=function(){runtime.assert(void 0!==t.getOdtDocument().getCursor(n),"Removing local cursor without inserting before.");var e=new ops.OpRemoveCursor;e.init({memberid:n}),t.enqueue([e])},this.startEditing=function(){re.subscribe(gui.InputMethodEditor.signalCompositionStart,ee.removeCurrentSelection),re.subscribe(gui.InputMethodEditor.signalCompositionEnd,O),G.subscribe("beforecut",s),G.subscribe("cut",a),G.subscribe("beforepaste",d),G.subscribe("paste",u),J&&J.initialize(),G.setEditing(!0),se.setModifier(pe?ce.Meta:ce.Ctrl),W.bind(fe.Backspace,ce.None,function(e){return function(){return e(),!0}}(ee.removeTextByBackspaceKey),!0),W.bind(fe.Delete,ce.None,ee.removeTextByDeleteKey),W.bind(fe.Tab,ce.None,A((function(){return ee.insertText("\t"),!0}))),pe?(W.bind(fe.Clear,ce.None,ee.removeCurrentSelection),W.bind(fe.B,ce.Meta,A(Q.toggleBold)),W.bind(fe.I,ce.Meta,A(Q.toggleItalic)),W.bind(fe.U,ce.Meta,A(Q.toggleUnderline)),W.bind(fe.L,ce.MetaShift,A(Q.alignParagraphLeft)),W.bind(fe.E,ce.MetaShift,A(Q.alignParagraphCenter)),W.bind(fe.R,ce.MetaShift,A(Q.alignParagraphRight)),W.bind(fe.J,ce.MetaShift,A(Q.alignParagraphJustified)),Y&&W.bind(fe.C,ce.MetaShift,$.addAnnotation),W.bind(fe.Z,ce.Meta,p),W.bind(fe.Z,ce.MetaShift,h)):(W.bind(fe.B,ce.Ctrl,A(Q.toggleBold)),W.bind(fe.I,ce.Ctrl,A(Q.toggleItalic)),W.bind(fe.U,ce.Ctrl,A(Q.toggleUnderline)),W.bind(fe.L,ce.CtrlShift,A(Q.alignParagraphLeft)),W.bind(fe.E,ce.CtrlShift,A(Q.alignParagraphCenter)),W.bind(fe.R,ce.CtrlShift,A(Q.alignParagraphRight)),W.bind(fe.J,ce.CtrlShift,A(Q.alignParagraphJustified)),Y&&W.bind(fe.C,ce.CtrlAlt,$.addAnnotation),W.bind(fe.Z,ce.Ctrl,p),W.bind(fe.Z,ce.CtrlShift,h)),j.setDefault(A((function(e){var t;return!(!(t=null===e.which||void 0===e.which?String.fromCharCode(e.keyCode):0!==e.which&&0!==e.charCode?String.fromCharCode(e.which):null)||e.altKey||e.ctrlKey||e.metaKey||(ee.insertText(t),0))}))),j.bind(fe.Enter,ce.None,A(ee.enqueueParagraphSplittingOps))},this.endEditing=function(){re.unsubscribe(gui.InputMethodEditor.signalCompositionStart,ee.removeCurrentSelection),re.unsubscribe(gui.InputMethodEditor.signalCompositionEnd,O),G.unsubscribe("cut",a),G.unsubscribe("beforecut",s),G.unsubscribe("paste",u),G.unsubscribe("beforepaste",d),G.setEditing(!1),se.setModifier(ce.None),W.bind(fe.Backspace,ce.None,(function(){return!0}),!0),W.unbind(fe.Delete,ce.None),W.unbind(fe.Tab,ce.None),pe?(W.unbind(fe.Clear,ce.None),W.unbind(fe.B,ce.Meta),W.unbind(fe.I,ce.Meta),W.unbind(fe.U,ce.Meta),W.unbind(fe.L,ce.MetaShift),W.unbind(fe.E,ce.MetaShift),W.unbind(fe.R,ce.MetaShift),W.unbind(fe.J,ce.MetaShift),Y&&W.unbind(fe.C,ce.MetaShift),W.unbind(fe.Z,ce.Meta),W.unbind(fe.Z,ce.MetaShift)):(W.unbind(fe.B,ce.Ctrl),W.unbind(fe.I,ce.Ctrl),W.unbind(fe.U,ce.Ctrl),W.unbind(fe.L,ce.CtrlShift),W.unbind(fe.E,ce.CtrlShift),W.unbind(fe.R,ce.CtrlShift),W.unbind(fe.J,ce.CtrlShift),Y&&W.unbind(fe.C,ce.CtrlAlt),W.unbind(fe.Z,ce.Ctrl),W.unbind(fe.Z,ce.CtrlShift)),j.setDefault(null),j.unbind(fe.Enter,ce.None)},this.getInputMemberId=function(){return n},this.getSession=function(){return t},this.getSessionConstraints=function(){return M},this.setUndoManager=function(e){J&&J.unsubscribe(gui.UndoManager.signalUndoStackChanged,f),(J=e)&&(J.setDocument(F),J.setPlaybackFunction(t.enqueue),J.subscribe(gui.UndoManager.signalUndoStackChanged,f))},this.getUndoManager=function(){return J},this.getMetadataController=function(){return de},this.getAnnotationController=function(){return $},this.getDirectFormattingController=function(){return Q},this.getHyperlinkClickHandler=function(){return se},this.getHyperlinkController=function(){return le},this.getImageController=function(){return te},this.getSelectionController=function(){return ue},this.getTextController=function(){return ee},this.getEventManager=function(){return G},this.getKeyboardHandlers=function(){return{keydown:W,keypress:j}},this.destroy=function(e){var t=[P.destroy,D.destroy,Q.destroy,re.destroy,G.destroy,se.destroy,le.destroy,de.destroy,ue.destroy,ee.destroy,R];k&&t.unshift(k.destroy),runtime.clearTimeout(_),core.Async.destroyAll(t,e)},P=core.Task.createRedrawTask(b),D=core.Task.createRedrawTask((function(){var e=F.getCursor(n);e&&e.getSelectionType()===ops.OdtCursor.RegionSelection&&(e=L.getImageElements(e.getSelectedRange())[0])?ne.select(e.parentNode):ne.clearSelection()})),W.bind(fe.Left,ce.None,A(ue.moveCursorToLeft)),W.bind(fe.Right,ce.None,A(ue.moveCursorToRight)),W.bind(fe.Up,ce.None,A(ue.moveCursorUp)),W.bind(fe.Down,ce.None,A(ue.moveCursorDown)),W.bind(fe.Left,ce.Shift,A(ue.extendSelectionToLeft)),W.bind(fe.Right,ce.Shift,A(ue.extendSelectionToRight)),W.bind(fe.Up,ce.Shift,A(ue.extendSelectionUp)),W.bind(fe.Down,ce.Shift,A(ue.extendSelectionDown)),W.bind(fe.Home,ce.None,A(ue.moveCursorToLineStart)),W.bind(fe.End,ce.None,A(ue.moveCursorToLineEnd)),W.bind(fe.Home,ce.Ctrl,A(ue.moveCursorToDocumentStart)),W.bind(fe.End,ce.Ctrl,A(ue.moveCursorToDocumentEnd)),W.bind(fe.Home,ce.Shift,A(ue.extendSelectionToLineStart)),W.bind(fe.End,ce.Shift,A(ue.extendSelectionToLineEnd)),W.bind(fe.Up,ce.CtrlShift,A(ue.extendSelectionToParagraphStart)),W.bind(fe.Down,ce.CtrlShift,A(ue.extendSelectionToParagraphEnd)),W.bind(fe.Home,ce.CtrlShift,A(ue.extendSelectionToDocumentStart)),W.bind(fe.End,ce.CtrlShift,A(ue.extendSelectionToDocumentEnd)),pe?(W.bind(fe.Left,ce.Alt,A(ue.moveCursorBeforeWord)),W.bind(fe.Right,ce.Alt,A(ue.moveCursorPastWord)),W.bind(fe.Left,ce.Meta,A(ue.moveCursorToLineStart)),W.bind(fe.Right,ce.Meta,A(ue.moveCursorToLineEnd)),W.bind(fe.Home,ce.Meta,A(ue.moveCursorToDocumentStart)),W.bind(fe.End,ce.Meta,A(ue.moveCursorToDocumentEnd)),W.bind(fe.Left,ce.AltShift,A(ue.extendSelectionBeforeWord)),W.bind(fe.Right,ce.AltShift,A(ue.extendSelectionPastWord)),W.bind(fe.Left,ce.MetaShift,A(ue.extendSelectionToLineStart)),W.bind(fe.Right,ce.MetaShift,A(ue.extendSelectionToLineEnd)),W.bind(fe.Up,ce.AltShift,A(ue.extendSelectionToParagraphStart)),W.bind(fe.Down,ce.AltShift,A(ue.extendSelectionToParagraphEnd)),W.bind(fe.Up,ce.MetaShift,A(ue.extendSelectionToDocumentStart)),W.bind(fe.Down,ce.MetaShift,A(ue.extendSelectionToDocumentEnd)),W.bind(fe.A,ce.Meta,A(ue.extendSelectionToEntireDocument))):(W.bind(fe.Left,ce.Ctrl,A(ue.moveCursorBeforeWord)),W.bind(fe.Right,ce.Ctrl,A(ue.moveCursorPastWord)),W.bind(fe.Left,ce.CtrlShift,A(ue.extendSelectionBeforeWord)),W.bind(fe.Right,ce.CtrlShift,A(ue.extendSelectionPastWord)),W.bind(fe.A,ce.Ctrl,A(ue.extendSelectionToEntireDocument))),he&&(k=new gui.IOSSafariSupport(G)),G.subscribe("keydown",W.handleEvent),G.subscribe("keypress",j.handleEvent),G.subscribe("keyup",X.handleEvent),G.subscribe("copy",l),G.subscribe("mousedown",y),G.subscribe("mousemove",P.trigger),G.subscribe("mouseup",T),G.subscribe("contextmenu",E),G.subscribe("dragstart",x),G.subscribe("dragend",w),G.subscribe("click",se.handleClick),G.subscribe("longpress",C),G.subscribe("drag",m),G.subscribe("dragstop",g),F.subscribe(ops.OdtDocument.signalOperationEnd,D.trigger),F.subscribe(ops.Document.signalCursorAdded,re.registerCursor),F.subscribe(ops.Document.signalCursorRemoved,re.removeCursor),F.subscribe(ops.OdtDocument.signalOperationEnd,c)}}(),gui.CaretManager=function(e,t){function n(e){return r.hasOwnProperty(e)?r[e]:null}function i(){return Object.keys(r).map((function(e){return r[e]}))}function o(t){var n=r[t];n&&(delete r[t],t===e.getInputMemberId()?(s.unsubscribe(ops.OdtDocument.signalProcessingBatchEnd,n.ensureVisible),s.unsubscribe(ops.Document.signalCursorMoved,n.refreshCursorBlinking),l.unsubscribe("compositionupdate",n.handleUpdate),l.unsubscribe("compositionend",n.handleUpdate),l.unsubscribe("focus",n.setFocus),l.unsubscribe("blur",n.removeFocus),a.removeEventListener("focus",n.show,!1),a.removeEventListener("blur",n.hide,!1)):s.unsubscribe(ops.OdtDocument.signalProcessingBatchEnd,n.handleUpdate),n.destroy((function(){})))}var r={},a=runtime.getWindow(),s=e.getSession().getOdtDocument(),l=e.getEventManager();this.registerCursor=function(n,i,o){var u=n.getMemberId();return n=new gui.Caret(n,t,i,o),r[u]=n,u===e.getInputMemberId()?(runtime.log("Starting to track input on new cursor of "+u),s.subscribe(ops.OdtDocument.signalProcessingBatchEnd,n.ensureVisible),s.subscribe(ops.Document.signalCursorMoved,n.refreshCursorBlinking),l.subscribe("compositionupdate",n.handleUpdate),l.subscribe("compositionend",n.handleUpdate),l.subscribe("focus",n.setFocus),l.subscribe("blur",n.removeFocus),a.addEventListener("focus",n.show,!1),a.addEventListener("blur",n.hide,!1),n.setOverlayElement(l.getEventTrap())):s.subscribe(ops.OdtDocument.signalProcessingBatchEnd,n.handleUpdate),n},this.getCaret=n,this.getCarets=i,this.destroy=function(t){var n=i().map((function(e){return e.destroy}));e.getSelectionController().setCaretXPositionLocator(null),s.unsubscribe(ops.Document.signalCursorRemoved,o),r={},core.Async.destroyAll(n,t)},e.getSelectionController().setCaretXPositionLocator((function(){var t,i=n(e.getInputMemberId());return i&&(t=i.getBoundingClientRect()),t?t.right:void 0})),s.subscribe(ops.Document.signalCursorRemoved,o)},gui.EditInfoHandle=function(e){var t,n=[],i=e.ownerDocument,o=i.documentElement.namespaceURI;this.setEdits=function(e){var r,a,s,l;for(n=e,core.DomUtils.removeAllChildNodes(t),e=0;e<n.length;e+=1)(r=i.createElementNS(o,"div")).className="editInfo",(a=i.createElementNS(o,"span")).className="editInfoColor",a.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",n[e].memberid),(s=i.createElementNS(o,"span")).className="editInfoAuthor",s.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",n[e].memberid),(l=i.createElementNS(o,"span")).className="editInfoTime",l.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",n[e].memberid),l.appendChild(i.createTextNode(n[e].time.toString())),r.appendChild(a),r.appendChild(s),r.appendChild(l),t.appendChild(r)},this.show=function(){t.style.display="block"},this.hide=function(){t.style.display="none"},this.destroy=function(n){e.removeChild(t),n()},(t=i.createElementNS(o,"div")).setAttribute("class","editInfoHandle"),t.style.display="none",e.appendChild(t)},ops.EditInfo=function(e,t){var n,i={};this.getNode=function(){return n},this.getOdtDocument=function(){return t},this.getEdits=function(){return i},this.getSortedEdits=function(){return function(){var e,t=[];for(e in i)i.hasOwnProperty(e)&&t.push({memberid:e,time:i[e].time});return t.sort((function(e,t){return e.time-t.time})),t}()},this.addEdit=function(e,t){i[e]={time:t}},this.clearEdits=function(){i={}},this.destroy=function(t){e.parentNode&&e.removeChild(n),t()},n=t.getDOMDocument().createElementNS("urn:webodf:names:editinfo","editinfo"),e.insertBefore(n,e.firstChild)},gui.EditInfoMarker=function(e,t){function n(e,t){return runtime.setTimeout((function(){r.style.opacity=e}),t)}var i,o,r,a,s,l,u=this;this.addEdit=function(t,i){var u=Date.now()-i;e.addEdit(t,i),o.setEdits(e.getSortedEdits()),r.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",t),runtime.clearTimeout(s),runtime.clearTimeout(l),1e4>u?(a=n(1,0),s=n(.5,1e4-u),l=n(.2,2e4-u)):1e4<=u&&2e4>u?(a=n(.5,0),l=n(.2,2e4-u)):a=n(.2,0)},this.getEdits=function(){return e.getEdits()},this.clearEdits=function(){e.clearEdits(),o.setEdits([]),r.hasAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")&&r.removeAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")},this.getEditInfo=function(){return e},this.show=function(){r.style.display="block"},this.hide=function(){u.hideHandle(),r.style.display="none"},this.showHandle=function(){o.show()},this.hideHandle=function(){o.hide()},this.destroy=function(t){runtime.clearTimeout(a),runtime.clearTimeout(s),runtime.clearTimeout(l),i.removeChild(r),o.destroy((function(n){n?t(n):e.destroy(t)}))},function(){var n=e.getOdtDocument().getDOMDocument();(r=n.createElementNS(n.documentElement.namespaceURI,"div")).setAttribute("class","editInfoMarker"),r.onmouseover=function(){u.showHandle()},r.onmouseout=function(){u.hideHandle()},(i=e.getNode()).appendChild(r),o=new gui.EditInfoHandle(i),t||u.hide()}()},gui.HyperlinkTooltipView=function(e,t){var n,i,o,r=core.DomUtils,a=odf.OdfUtils,s=runtime.getWindow();runtime.assert(null!==s,"Expected to be run in an environment which has a global window, like a browser."),this.showTooltip=function(l){var u,d=l.target||l.srcElement,c=e.getSizer(),f=e.getZoomLevel();e:{for(;d;){if(a.isHyperlink(d))break e;if(a.isParagraph(d)||a.isInlineRoot(d))break;d=d.parentNode}d=null}if(d){var p;switch(r.containsNode(c,o)||c.appendChild(o),u=i,t()){case gui.KeyboardHandler.Modifier.Ctrl:p=runtime.tr("Ctrl-click to follow link");break;case gui.KeyboardHandler.Modifier.Meta:p=runtime.tr("⌘-click to follow link");break;default:p=""}u.textContent=p,n.textContent=a.getHyperlinkTarget(d),o.style.display="block",u=s.innerWidth-o.offsetWidth-15,d=l.clientX>u?u:l.clientX+15,u=s.innerHeight-o.offsetHeight-10,l=l.clientY>u?u:l.clientY+10,d=(d-(c=c.getBoundingClientRect()).left)/f,l=(l-c.top)/f,o.style.left=d+"px",o.style.top=l+"px"}},this.hideTooltip=function(){o.style.display="none"},this.destroy=function(e){o.parentNode&&o.parentNode.removeChild(o),e()},function(){var t=e.getElement().ownerDocument;n=t.createElement("span"),i=t.createElement("span"),n.className="webodf-hyperlinkTooltipLink",i.className="webodf-hyperlinkTooltipText",(o=t.createElement("div")).className="webodf-hyperlinkTooltip",o.appendChild(n),o.appendChild(i),e.getElement().appendChild(o)}()},gui.OdfFieldView=function(e){var t,n=e.getElement().ownerDocument;this.showFieldHighlight=function(){t.appendChild(n.createTextNode(function(){var e;return(e=odf.OdfSchema.getFields().map((function(e){return e.replace(":","|")}))).join(",\n")+"\n{ background-color: #D0D0D0; }\n\n"+e.map((function(e){return e+":empty::after"})).join(",\n")+"\n{ content:' '; white-space: pre; }\n"}()))},this.hideFieldHighlight=function(){for(var e=t.sheet,n=e.cssRules;n.length;)e.deleteRule(n.length-1)},this.destroy=function(e){t.parentNode&&t.parentNode.removeChild(t),e()},t=function(){var e=n.getElementsByTagName("head").item(0),t=n.createElement("style"),i="";return t.type="text/css",t.media="screen, print, handheld, projection",odf.Namespaces.forEachPrefix((function(e,t){i+="@namespace "+e+" url("+t+");\n"})),t.appendChild(n.createTextNode(i)),e.appendChild(t),t}()},gui.ShadowCursor=function(e){var t=e.getDOMDocument().createRange(),n=!0;this.removeFromDocument=function(){},this.getMemberId=function(){return gui.ShadowCursor.ShadowCursorMemberId},this.getSelectedRange=function(){return t},this.setSelectedRange=function(e,i){t=e,n=!1!==i},this.hasForwardSelection=function(){return n},this.getDocument=function(){return e},this.getSelectionType=function(){return ops.OdtCursor.RangeSelection},t.setStart(e.getRootNode(),0)},gui.ShadowCursor.ShadowCursorMemberId="",gui.SelectionView=function(e){},gui.SelectionView.prototype.rerender=function(){},gui.SelectionView.prototype.show=function(){},gui.SelectionView.prototype.hide=function(){},gui.SelectionView.prototype.destroy=function(e){},gui.SelectionViewManager=function(e){function t(){return Object.keys(n).map((function(e){return n[e]}))}var n={};this.getSelectionView=function(e){return n.hasOwnProperty(e)?n[e]:null},this.getSelectionViews=t,this.removeSelectionView=function(e){n.hasOwnProperty(e)&&(n[e].destroy((function(){})),delete n[e])},this.hideSelectionView=function(e){n.hasOwnProperty(e)&&n[e].hide()},this.showSelectionView=function(e){n.hasOwnProperty(e)&&n[e].show()},this.rerenderSelectionViews=function(){Object.keys(n).forEach((function(e){n[e].rerender()}))},this.registerCursor=function(t,i){var o=t.getMemberId(),r=new e(t);return i?r.show():r.hide(),n[o]=r},this.destroy=function(e){var n=t();!function t(i,o){o?e(o):i<n.length?n[i].destroy((function(e){t(i+1,e)})):e()}(0,void 0)}},gui.SessionViewOptions=function(){this.caretBlinksOnRangeSelect=this.caretAvatarsInitiallyVisible=this.editInfoMarkersInitiallyVisible=!0},function(){function e(e,t){return void 0!==e?Boolean(e):t}gui.SessionView=function(t,n,i,o,r,a){function s(e){e.memberId===n&&C.getViewport().scrollIntoView(e.annotation.getBoundingClientRect())}function l(){var e=document.getElementsByTagName("head").item(0),t=document.createElement("style");return t.type="text/css",t.media="screen, print, handheld, projection",e.appendChild(t),t}function u(e){var t,n;for(n in x)x.hasOwnProperty(n)&&(t=x[n],e?t.show():t.hide())}function d(e){r.getCarets().forEach((function(t){e?t.showHandle():t.hideHandle()}))}function c(e){!function(e,t,i){function o(t,n,i){n=t+'[editinfo|memberid="'+e+'"]'+i+n;e:{var o=y.firstChild;for(t=t+'[editinfo|memberid="'+e+'"]'+i+"{";o;){if(o.nodeType===Node.TEXT_NODE&&0===o.data.indexOf(t)){t=o;break e}o=o.nextSibling}t=null}t?t.data=n:y.appendChild(document.createTextNode(n))}o("div.editInfoMarker","{ background-color: "+i+"; }",""),o("span.editInfoColor","{ background-color: "+i+"; }",""),o("span.editInfoAuthor",'{ content: "'+t+'"; }',":before"),o("dc|creator","{ background-color: "+i+"; }",""),o(".webodf-selectionOverlay","{ fill: "+i+"; stroke: "+i+";}",""),e===n&&(o(".webodf-touchEnabled .webodf-selectionOverlay","{ display: block; }"," > .webodf-draggable"),e=gui.ShadowCursor.ShadowCursorMemberId,o(".webodf-selectionOverlay","{ fill: "+i+"; stroke: "+i+";}",""),o(".webodf-touchEnabled .webodf-selectionOverlay","{ display: block; }"," > .webodf-draggable"))}(e.getMemberId(),(e=e.getProperties()).fullName,e.color)}function f(e){var t=e.getMemberId(),n=i.getOdtDocument().getMember(t).getProperties();r.registerCursor(e,E,T),a.registerCursor(e,!0),(e=r.getCaret(t))&&(e.setAvatarImageUrl(n.imageUrl),e.setColor(n.color)),runtime.log("+++ View here +++ eagerly created an Caret for '"+t+"'! +++")}function p(e){e=e.getMemberId();var t=a.getSelectionView(n),i=a.getSelectionView(gui.ShadowCursor.ShadowCursorMemberId),o=r.getCaret(n);e===n?(i.hide(),t&&t.show(),o&&o.show()):e===gui.ShadowCursor.ShadowCursorMemberId&&(i.show(),t&&t.hide(),o&&o.hide())}function h(e){a.removeSelectionView(e)}function m(e){var t=e.paragraphElement,n=e.memberId;e=e.timeStamp;var o,r="",a=t.getElementsByTagNameNS("urn:webodf:names:editinfo","editinfo").item(0);a?(r=a.getAttributeNS("urn:webodf:names:editinfo","id"),o=x[r]):(r=Math.random().toString(),o=new ops.EditInfo(t,i.getOdtDocument()),o=new gui.EditInfoMarker(o,w),(a=t.getElementsByTagNameNS("urn:webodf:names:editinfo","editinfo").item(0)).setAttributeNS("urn:webodf:names:editinfo","id",r),x[r]=o),o.addEdit(n,new Date(e)),N.trigger()}function g(){var e;v.hasChildNodes()&&core.DomUtils.removeAllChildNodes(v),!0===o.getState(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN)&&(e=i.getOdtDocument().getMember(n))&&(e=e.getProperties().fullName,v.appendChild(document.createTextNode(".annotationWrapper:not([creator = '"+e+"']) .annotationRemoveButton { display: none; }")))}function b(e){var t=Object.keys(x).map((function(e){return x[e]}));S.unsubscribe(ops.Document.signalMemberAdded,c),S.unsubscribe(ops.Document.signalMemberUpdated,c),S.unsubscribe(ops.Document.signalCursorAdded,f),S.unsubscribe(ops.Document.signalCursorRemoved,h),S.unsubscribe(ops.OdtDocument.signalParagraphChanged,m),S.unsubscribe(ops.Document.signalCursorMoved,p),S.unsubscribe(ops.OdtDocument.signalParagraphChanged,a.rerenderSelectionViews),S.unsubscribe(ops.OdtDocument.signalTableAdded,a.rerenderSelectionViews),S.unsubscribe(ops.OdtDocument.signalParagraphStyleModified,a.rerenderSelectionViews),o.unsubscribe(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN,g),S.unsubscribe(ops.Document.signalMemberAdded,g),S.unsubscribe(ops.Document.signalMemberUpdated,g),y.parentNode.removeChild(y),v.parentNode.removeChild(v),function n(i,o){o?e(o):i<t.length?t[i].destroy((function(e){n(i+1,e)})):e()}(0,void 0)}var y,v,S,C,N,x={},w=e(t.editInfoMarkersInitiallyVisible,!0),E=e(t.caretAvatarsInitiallyVisible,!0),T=e(t.caretBlinksOnRangeSelect,!0);this.showEditInfoMarkers=function(){w||u(w=!0)},this.hideEditInfoMarkers=function(){w&&u(w=!1)},this.showCaretAvatars=function(){E||d(E=!0)},this.hideCaretAvatars=function(){E&&d(E=!1)},this.getSession=function(){return i},this.getCaret=function(e){return r.getCaret(e)},this.destroy=function(e){var t=[N.destroy,b];S.unsubscribe(ops.OdtDocument.signalAnnotationAdded,s),core.Async.destroyAll(t,e)},S=i.getOdtDocument(),C=S.getOdfCanvas(),S.subscribe(ops.OdtDocument.signalAnnotationAdded,s),S.subscribe(ops.Document.signalMemberAdded,c),S.subscribe(ops.Document.signalMemberUpdated,c),S.subscribe(ops.Document.signalCursorAdded,f),S.subscribe(ops.Document.signalCursorRemoved,h),S.subscribe(ops.OdtDocument.signalParagraphChanged,m),S.subscribe(ops.Document.signalCursorMoved,p),S.subscribe(ops.OdtDocument.signalParagraphChanged,a.rerenderSelectionViews),S.subscribe(ops.OdtDocument.signalTableAdded,a.rerenderSelectionViews),S.subscribe(ops.OdtDocument.signalParagraphStyleModified,a.rerenderSelectionViews),o.subscribe(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN,g),S.subscribe(ops.Document.signalMemberAdded,g),S.subscribe(ops.Document.signalMemberUpdated,g),(y=l()).appendChild(document.createTextNode("@namespace editinfo url(urn:webodf:names:editinfo);")),y.appendChild(document.createTextNode("@namespace dc url(http://purl.org/dc/elements/1.1/);")),v=l(),g(),N=core.Task.createRedrawTask((function(){var e=C.getAnnotationViewManager();e&&(e.rehighlightAnnotations(),S.fixCursorPositions())}))}}(),gui.SvgSelectionView=function(e){function t(){var e=m.getRootNode();f!==e&&(f=e,(p=m.getCanvas().getSizer()).appendChild(b),b.setAttribute("class","webodf-selectionOverlay"),v.setAttribute("class","webodf-draggable"),S.setAttribute("class","webodf-draggable"),v.setAttribute("end","left"),S.setAttribute("end","right"),v.setAttribute("r",8),S.setAttribute("r",8),b.appendChild(y),b.appendChild(v),b.appendChild(S))}function n(e){return e=e.getBoundingClientRect(),Boolean(e&&0!==e.height)}function i(e){var t,i=C.getTextElements(e,!0,!1),o=e.cloneRange(),r=e.cloneRange();if(e=e.cloneRange(),!i.length)return null;e:{var a=i[t=0],s=o.startContainer===a?o.startOffset:0,l=s;for(o.setStart(a,s),o.setEnd(a,l);!n(o);){if(a.nodeType===Node.ELEMENT_NODE&&l<a.childNodes.length)l=a.childNodes.length;else if(a.nodeType===Node.TEXT_NODE&&l<a.length)l+=1;else{if(!i[t]){t=!1;break e}a=i[t],t+=1,s=l=0}o.setStart(a,s),o.setEnd(a,l)}t=!0}if(!t)return null;e:{for(a=i[t=i.length-1],l=s=r.endContainer===a?r.endOffset:a.nodeType===Node.TEXT_NODE?a.length:a.childNodes.length,r.setStart(a,s),r.setEnd(a,l);!n(r);){if(a.nodeType===Node.ELEMENT_NODE&&0<s)s=0;else if(a.nodeType===Node.TEXT_NODE&&0<s)--s;else{if(!i[t]){i=!1;break e}a=i[t],--t,s=l=a.length||a.childNodes.length}r.setStart(a,s),r.setEnd(a,l)}i=!0}return i?(e.setStart(o.startContainer,o.startOffset),e.setEnd(r.endContainer,r.endOffset),{firstRange:o,lastRange:r,fillerRange:e}):null}function o(e,t){var n={};return n.top=Math.min(e.top,t.top),n.left=Math.min(e.left,t.left),n.right=Math.max(e.right,t.right),n.bottom=Math.max(e.bottom,t.bottom),n.width=n.right-n.left,n.height=n.bottom-n.top,n}function r(e,t){return t&&0<t.width&&0<t.height&&(e=e?o(e,t):t),e}function a(e){function t(e){return E.setUnfilteredPosition(e,0),b.acceptNode(e)===T&&a.acceptPosition(E)===T?T:O}function n(e){var n=null;return t(e)===T&&(n=N.getBoundingClientRect(e)),n}var i,o,a,s,l=e.commonAncestorContainer,u=e.startContainer,d=e.endContainer,c=e.startOffset,f=e.endOffset,p=null,h=g.createRange(),b=new odf.OdfNodeFilter;if(u===l||d===l)return p=(h=e.cloneRange()).getBoundingClientRect(),h.detach(),p;for(e=u;e.parentNode!==l;)e=e.parentNode;for(o=d;o.parentNode!==l;)o=o.parentNode;for(a=m.createRootFilter(u),l=e.nextSibling;l&&l!==o;)p=r(p,n(l)),l=l.nextSibling;if(C.isParagraph(e))p=r(p,N.getBoundingClientRect(e));else if(e.nodeType===Node.TEXT_NODE)l=e,h.setStart(l,c),h.setEnd(l,l===o?f:l.length),p=r(p,h.getBoundingClientRect());else for(l=(s=g.createTreeWalker(e,NodeFilter.SHOW_TEXT,t,!1)).currentNode=u;l&&l!==d;)h.setStart(l,c),h.setEnd(l,l.length),p=r(p,h.getBoundingClientRect()),i=l,c=0,l=s.nextNode();if(i||(i=u),C.isParagraph(o))p=r(p,N.getBoundingClientRect(o));else if(o.nodeType===Node.TEXT_NODE)l=o,h.setStart(l,l===e?c:0),h.setEnd(l,f),p=r(p,h.getBoundingClientRect());else for(l=(s=g.createTreeWalker(o,NodeFilter.SHOW_TEXT,t,!1)).currentNode=d;l&&l!==i;)h.setStart(l,0),h.setEnd(l,f),p=r(p,h.getBoundingClientRect()),(l=s.previousNode())&&(f=l.length);return p}function s(e,t){var n=e.getBoundingClientRect(),i={width:0};return i.top=n.top,i.bottom=n.bottom,i.height=n.height,i.left=i.right=t?n.right:n.left,i}function l(){var n,r=e.getSelectedRange();if(n=w&&e.getSelectionType()===ops.OdtCursor.RangeSelection&&!r.collapsed){t();var l,u,d,c,f,h,m=N.getBoundingClientRect(p),g=x.getZoomLevel();if(r=i(r)){var C;for(n=r.firstRange,l=r.lastRange,u=r.fillerRange,d=N.translateRect(s(n,!1),m,g),f=N.translateRect(s(l,!0),m,g),h=(c=(c=a(u))?N.translateRect(c,m,g):o(d,f)).left,c=d.left+Math.max(0,c.width-(d.left-c.left)),m=Math.min(d.top,f.top),g=f.top+f.height,h=[{x:d.left,y:m+d.height},{x:d.left,y:m},{x:c,y:m},{x:c,y:g-f.height},{x:f.right,y:g-f.height},{x:f.right,y:g},{x:h,y:g},{x:h,y:m+d.height},{x:d.left,y:m+d.height}],c="",C=0;C<h.length;C+=1)c+=h[C].x+","+h[C].y+" ";y.setAttribute("points",c),v.setAttribute("cx",d.left),v.setAttribute("cy",m+d.height/2),S.setAttribute("cx",f.right),S.setAttribute("cy",g-f.height/2),n.detach(),l.detach(),u.detach()}n=Boolean(r)}b.style.display=n?"block":"none"}function u(t){w&&t===e&&h.trigger()}function d(e){e=8/e,v.setAttribute("r",e),S.setAttribute("r",e)}function c(t){p.removeChild(b),p.classList.remove("webodf-virtualSelections"),e.getDocument().unsubscribe(ops.Document.signalCursorMoved,u),x.unsubscribe(gui.ZoomHelper.signalZoomChanged,d),t()}var f,p,h,m=e.getDocument(),g=m.getDOMDocument(),b=g.createElementNS("http://www.w3.org/2000/svg","svg"),y=g.createElementNS("http://www.w3.org/2000/svg","polygon"),v=g.createElementNS("http://www.w3.org/2000/svg","circle"),S=g.createElementNS("http://www.w3.org/2000/svg","circle"),C=odf.OdfUtils,N=core.DomUtils,x=m.getCanvas().getZoomHelper(),w=!0,E=e.getDocument().createPositionIterator(m.getRootNode()),T=NodeFilter.FILTER_ACCEPT,O=NodeFilter.FILTER_REJECT;this.rerender=function(){w&&h.trigger()},this.show=function(){w=!0,h.trigger()},this.hide=function(){w=!1,h.trigger()},this.destroy=function(e){core.Async.destroyAll([h.destroy,c],e)},function(){var n=e.getMemberId();h=core.Task.createRedrawTask(l),t(),b.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",n),p.classList.add("webodf-virtualSelections"),e.getDocument().subscribe(ops.Document.signalCursorMoved,u),x.subscribe(gui.ZoomHelper.signalZoomChanged,d),d(x.getZoomLevel())}()},gui.UndoStateRules=function(){function e(e,t){var n=e.length;this.previous=function(){for(--n;0<=n;--n)if(t(e[n]))return e[n];return null}}function t(e){var t;return(e=e.spec()).hasOwnProperty("position")&&(t=e.position),t}function n(e){return e.isEdit}function i(e,n,i){return i?(e=t(e))-(n=t(n))==n-(i=t(i)):0==(i=t(e)-t(n))||1===Math.abs(i)}this.isEditOperation=n,this.isPartOfOperationSet=function(t,o){var r,a=void 0!==t.group;if(!t.isEdit||0===o.length)return!0;if(r=o[o.length-1],a&&t.group===r.group)return!0;e:switch(t.spec().optype){case"RemoveText":case"InsertText":r=!0;break e;default:r=!1}if(r&&o.some(n)){if(a){var s;a=t.spec().optype;var l,u,d=(r=new e(o,n)).previous(),c=null;for(runtime.assert(Boolean(d),"No edit operations found in state"),u=d.group,runtime.assert(void 0!==u,"Operation has no group"),l=1;d&&d.group===u;){if(a===d.spec().optype){s=d;break}d=r.previous()}if(s){for(d=r.previous();d;){if(d.group!==u){if(2===l)break;u=d.group,l+=1}if(a===d.spec().optype){c=d;break}d=r.previous()}s=i(t,s,c)}else s=!1;return s}return s=t.spec().optype,r=(a=new e(o,n)).previous(),runtime.assert(Boolean(r),"No edit operations found in state"),s===r.spec().optype&&i(t,r,a.previous())}return!1}},function(){function e(e,t){this.mainId=void 0!==e?e:-1,this.subId=void 0!==t?t:-1}function t(t,i,o){var r,a,s;this.addOperation=function(e){t.isEditOperation(e)&&(s+=1),a.push(e)},this.isNextStateId=function(e){return e.mainId===r&&e.subId===s},this.getNextStateId=function(){return new e(r,s)},this.getOperations=function(){return a},r=n+=1,a=i||[],s=i&&o?i.reduce((function(e,n){return e+(t.isEditOperation(n)?1:0)}),0):0}var n=0;gui.TrivialUndoManager=function(n){function i(){return!0!==g.isNextStateId(m)}function o(e){0<(e=e.getOperations()).length&&(x=!0,p(e),x=!1)}function r(){C.emit(gui.UndoManager.signalUndoStackChanged,{undoAvailable:b.hasUndoStates(),redoAvailable:b.hasRedoStates()})}function a(e){var t=i();e!==t&&C.emit(gui.UndoManager.signalDocumentModifiedChanged,t)}function s(){g!==f&&g!==v[v.length-1]&&v.push(g)}function l(e){var t=e.previousSibling||e.nextSibling;e.parentNode.removeChild(e),y.normalizeTextNodes(t)}function u(e){return Object.keys(e).map((function(t){return e[t]}))}function d(){var e=i(),n=c=h.cloneDocumentElement();y.getElementsByTagNameNS(n,"urn:webodf:names:cursor","cursor").forEach(l),y.getElementsByTagNameNS(n,"urn:webodf:names:cursor","anchor").forEach(l),s(),g=f=function(e){function n(e){var t=e.spec();if(s[t.memberid])switch(t.optype){case"AddCursor":r[t.memberid]||(r[t.memberid]=e,delete s[t.memberid],--i);break;case"MoveCursor":a[t.memberid]||(a[t.memberid]=e)}}var i,o,r={},a={},s={};for(o=e.pop(),h.getMemberIds().forEach((function(e){s[e]=!0})),i=Object.keys(s).length;o&&0<i;)(o=o.getOperations()).reverse(),o.forEach(n),o=e.pop();return new t(N,u(r).concat(u(a)))}([f].concat(v)),v.length=0,S.length=0,e||(m=g.getNextStateId()),r(),a(e)}var c,f,p,h,m,g,b=this,y=core.DomUtils,v=[],S=[],C=new core.EventNotifier([gui.UndoManager.signalUndoStackChanged,gui.UndoManager.signalUndoStateCreated,gui.UndoManager.signalUndoStateModified,gui.UndoManager.signalDocumentModifiedChanged,gui.TrivialUndoManager.signalDocumentRootReplaced]),N=n||new gui.UndoStateRules,x=!1;this.subscribe=function(e,t){C.subscribe(e,t)},this.unsubscribe=function(e,t){C.unsubscribe(e,t)},this.isDocumentModified=i,this.setDocumentModified=function(t){i()!==t&&(m=t?new e:g.getNextStateId(),C.emit(gui.UndoManager.signalDocumentModifiedChanged,t))},this.hasUndoStates=function(){return 0<v.length},this.hasRedoStates=function(){return 0<S.length},this.setDocument=function(e){h=e},this.purgeInitialState=function(){var e=i();v.length=0,S.length=0,g=f=new t(N),m=g.getNextStateId(),c=null,r(),a(e)},this.setInitialState=d,this.initialize=function(){c||d()},this.setPlaybackFunction=function(e){p=e},this.onOperationExecuted=function(e){if(!x){var n=i();N.isEditOperation(e)&&(g===f||0<S.length)||!N.isPartOfOperationSet(e,g.getOperations())?(S.length=0,s(),g=new t(N,[e],!0),v.push(g),C.emit(gui.UndoManager.signalUndoStateCreated,{operations:g.getOperations()}),r()):(g.addOperation(e),C.emit(gui.UndoManager.signalUndoStateModified,{operations:g.getOperations()})),a(n)}},this.moveForward=function(e){for(var t,n=0,s=i();e&&S.length;)t=S.pop(),v.push(t),o(t),--e,n+=1;return n&&(g=v[v.length-1],r(),a(s)),n},this.moveBackward=function(e){for(var t=0,n=i();e&&v.length;)S.push(v.pop()),--e,t+=1;return t&&(h.getMemberIds().forEach((function(e){h.hasCursor(e)&&h.removeCursor(e)})),h.setDocumentElement(c.cloneNode(!0)),C.emit(gui.TrivialUndoManager.signalDocumentRootReplaced,{}),o(f),v.forEach(o),g=v[v.length-1]||f,r(),a(n)),t},g=f=new t(N),m=g.getNextStateId()},gui.TrivialUndoManager.signalDocumentRootReplaced="documentRootReplaced"}(),odf.GraphicProperties=function(e,t,n){var i=this,o=odf.Namespaces.stylens,r=odf.Namespaces.svgns;this.verticalPos=function(){return i.data.value("verticalPos")},this.verticalRel=function(){return i.data.value("verticalRel")},this.horizontalPos=function(){return i.data.value("horizontalPos")},this.horizontalRel=function(){return i.data.value("horizontalRel")},this.strokeWidth=function(){return i.data.value("strokeWidth")},i.data=new odf.LazyStyleProperties(void 0===n?void 0:n.data,{verticalPos:function(){var t=e.getAttributeNS(o,"vertical-pos");return""===t?void 0:t},verticalRel:function(){var t=e.getAttributeNS(o,"vertical-rel");return""===t?void 0:t},horizontalPos:function(){var t=e.getAttributeNS(o,"horizontal-pos");return""===t?void 0:t},horizontalRel:function(){var t=e.getAttributeNS(o,"horizontal-rel");return""===t?void 0:t},strokeWidth:function(){var n=e.getAttributeNS(r,"stroke-width");return t.parseLength(n)}})},odf.ComputedGraphicProperties=function(){var e;this.setGraphicProperties=function(t){e=t},this.verticalPos=function(){return e&&e.verticalPos()||"from-top"},this.verticalRel=function(){return e&&e.verticalRel()||"page"},this.horizontalPos=function(){return e&&e.horizontalPos()||"from-left"},this.horizontalRel=function(){return e&&e.horizontalRel()||"page"}},odf.PageLayoutProperties=function(e,t,n){var i=this,o=odf.Namespaces.fons;this.pageHeight=function(){return i.data.value("pageHeight")||1123},this.pageWidth=function(){return i.data.value("pageWidth")||794},i.data=new odf.LazyStyleProperties(void 0===n?void 0:n.data,{pageHeight:function(){var n;return e&&(n=e.getAttributeNS(o,"page-height"),n=t.parseLength(n)),n},pageWidth:function(){var n;return e&&(n=e.getAttributeNS(o,"page-width"),n=t.parseLength(n)),n}})},odf.PageLayout=function(e,t,n){var i=null;e&&(i=t.getPropertiesElement("page-layout-properties",e)),this.pageLayout=new odf.PageLayoutProperties(i,t,n&&n.pageLayout)},odf.PageLayoutCache=function(){},odf.PageLayoutCache.prototype.getPageLayout=function(e){},odf.PageLayoutCache.prototype.getDefaultPageLayout=function(){},odf.ParagraphProperties=function(e,t,n){var i=this,o=odf.Namespaces.fons;this.marginTop=function(){return i.data.value("marginTop")},i.data=new odf.LazyStyleProperties(void 0===n?void 0:n.data,{marginTop:function(){var i=e.getAttributeNS(o,"margin-top");return t.parsePositiveLengthOrPercent(i,"marginTop",n&&n.data)}})},odf.ComputedParagraphProperties=function(){var e={},t=[];this.setStyleChain=function(n){t=n,e={}},this.marginTop=function(){var n,i;if(e.hasOwnProperty("marginTop"))n=e.marginTop;else{for(i=0;void 0===n&&i<t.length;i+=1)n=t[i].marginTop();e.marginTop=n}return n||0}},odf.TextProperties=function(e,t,n){var i=this,o=odf.Namespaces.fons;this.fontSize=function(){return i.data.value("fontSize")},i.data=new odf.LazyStyleProperties(void 0===n?void 0:n.data,{fontSize:function(){var i=e.getAttributeNS(o,"font-size");return t.parsePositiveLengthOrPercent(i,"fontSize",n&&n.data)}})},odf.ComputedTextProperties=function(){var e={},t=[];this.setStyleChain=function(n){t=n,e={}},this.fontSize=function(){var n,i;if(e.hasOwnProperty("fontSize"))n=e.fontSize;else{for(i=0;void 0===n&&i<t.length;i+=1)n=t[i].fontSize();e.fontSize=n}return n||12}},odf.MasterPage=function(e,t){var n;e?(n=e.getAttributeNS(odf.Namespaces.stylens,"page-layout-name"),this.pageLayout=t.getPageLayout(n)):this.pageLayout=t.getDefaultPageLayout()},odf.MasterPageCache=function(){},odf.MasterPageCache.prototype.getMasterPage=function(e){},odf.StylePileEntry=function(e,t,n,i){this.masterPage=function(){var t=e.getAttributeNS(odf.Namespaces.stylens,"master-page-name"),i=null;return t&&(i=n.getMasterPage(t)),i},function(n){var o=e.getAttributeNS(odf.Namespaces.stylens,"family"),r=null;"graphic"!==o&&"chart"!==o||(n.graphic=void 0===i?void 0:i.graphic,null!==(r=t.getPropertiesElement("graphic-properties",e,r))&&(n.graphic=new odf.GraphicProperties(r,t,n.graphic))),"paragraph"!==o&&"table-cell"!==o&&"graphic"!==o&&"presentation"!==o&&"chart"!==o||(n.paragraph=void 0===i?void 0:i.paragraph,null!==(r=t.getPropertiesElement("paragraph-properties",e,r))&&(n.paragraph=new odf.ParagraphProperties(r,t,n.paragraph))),"text"!==o&&"paragraph"!==o&&"table-cell"!==o&&"graphic"!==o&&"presentation"!==o&&"chart"!==o||(n.text=void 0===i?void 0:i.text,null!==(r=t.getPropertiesElement("text-properties",e,r))&&(n.text=new odf.TextProperties(r,t,n.text)))}(this)},odf.StylePile=function(e,t){function n(n,i){var a,s;return n.hasAttributeNS(r,"parent-style-name")&&(s=n.getAttributeNS(r,"parent-style-name"),-1===i.indexOf(s)&&(a=o(s,i))),new odf.StylePileEntry(n,e,t,a)}var i,o,r=odf.Namespaces.stylens,a={},s={},l={},u={};o=function(e,t){var i,o=l[e];return!o&&(i=a[e])&&(t.push(e),o=n(i,t),l[e]=o),o},this.getStyle=function(e){var t,i=u[e]||l[e],o=[];return i||((t=s[e])||(t=a[e])&&o.push(e),t&&(i=n(t,o))),i},this.addCommonStyle=function(e){var t;e.hasAttributeNS(r,"name")&&(t=e.getAttributeNS(r,"name"),a.hasOwnProperty(t)||(a[t]=e))},this.addAutomaticStyle=function(e){var t;e.hasAttributeNS(r,"name")&&(t=e.getAttributeNS(r,"name"),s.hasOwnProperty(t)||(s[t]=e))},this.setDefaultStyle=function(e){void 0===i&&(i=n(e,[]))},this.getDefaultStyle=function(){return i}},odf.ComputedGraphicStyle=function(){this.text=new odf.ComputedTextProperties,this.paragraph=new odf.ComputedParagraphProperties,this.graphic=new odf.ComputedGraphicProperties},odf.ComputedParagraphStyle=function(){this.text=new odf.ComputedTextProperties,this.paragraph=new odf.ComputedParagraphProperties},odf.ComputedTextStyle=function(){this.text=new odf.ComputedTextProperties},odf.StyleCache=function(e){function t(e,t,n,i){var o;if(t=n.getAttributeNS(t,"class-names"))for(t=t.split(" "),o=0;o<t.length;o+=1)(n=t[o])&&(i.push(e),i.push(n))}function n(e,n){var i=N.getStyleName("paragraph",e);return void 0!==i&&(n.push("paragraph"),n.push(i)),e.namespaceURI!==S||"h"!==e.localName&&"p"!==e.localName||t("paragraph",S,e,n),n}function i(e,t,n){var i,o,r,s,l=[];for(i=0;i<e.length;i+=2)r=e[i],s=e[i+1],void 0!==(s=(r=a[r]).getStyle(s))&&void 0!==(s=s[t])&&s!==o&&(l.push(s),o=s);return(s=(r=a[n]).getDefaultStyle())&&void 0!==(s=s[t])&&s!==o&&l.push(s),l}function o(i,r){var a=N.getStyleName("text",i),s=i.parentNode;return void 0!==a&&(r.push("text"),r.push(a)),"span"===i.localName&&i.namespaceURI===S&&t("text",S,i,r),s&&s!==e?(s.namespaceURI!==S||"p"!==s.localName&&"h"!==s.localName?o(s,r):n(s,r),r):r}function r(e){return e=e.getAttributeNS(C,"family"),a[e]}var a,s,l,u,d,c,f,p,h,m,g,b,y,v=this,S=odf.Namespaces.textns,C=odf.Namespaces.stylens,N=new odf.StyleInfo,x=new odf.StyleParseUtils;this.getComputedGraphicStyle=function(e){var t=[];void 0!==(e=N.getStyleName("graphic",e))&&(t.push("graphic"),t.push(e)),e=t.join("/");var n=u[e];return runtime.assert(0==t.length%2,"Invalid style chain."),void 0===n&&((n=new odf.ComputedGraphicStyle).graphic.setGraphicProperties(i(t,"graphic","graphic")[0]),n.text.setStyleChain(i(t,"text","graphic")),n.paragraph.setStyleChain(i(t,"paragraph","graphic")),u[e]=n),n},this.getComputedParagraphStyle=function(e){var t=(e=n(e,[])).join("/"),o=l[t];return runtime.assert(0==e.length%2,"Invalid style chain."),void 0===o&&((o=new odf.ComputedParagraphStyle).text.setStyleChain(i(e,"text","paragraph")),o.paragraph.setStyleChain(i(e,"paragraph","paragraph")),l[t]=o),o},this.getComputedTextStyle=function(e){var t=(e=o(e,[])).join("/"),n=s[t];return runtime.assert(0==e.length%2,"Invalid style chain."),void 0===n&&((n=new odf.ComputedTextStyle).text.setStyleChain(i(e,"text","text")),s[t]=n),n},this.getPageLayout=function(e){var t=y[e];return t||((t=b[e])?(t=new odf.PageLayout(t,x,g),y[e]=t):t=g),t},this.getDefaultPageLayout=function(){return g},this.getMasterPage=function(e){var t=h[e];return void 0===t&&((t=p[e])?(t=new odf.MasterPage(t,v),h[e]=t):t=null),t},this.getDefaultMasterPage=function(){return m},this.update=function(){var t,n,i=null,o=null;for(s={},l={},u={},p={},h={},y={},b={},d=new odf.StylePile(x,v),c=new odf.StylePile(x,v),f=new odf.StylePile(x,v),a={text:d,paragraph:c,graphic:f},t=e.styles.firstElementChild;t;)t.namespaceURI===C&&((n=r(t))?"style"===t.localName?n.addCommonStyle(t):"default-style"===t.localName&&n.setDefaultStyle(t):"default-page-layout"===t.localName&&(i=t)),t=t.nextElementSibling;for(g=new odf.PageLayout(i,x),t=e.automaticStyles.firstElementChild;t;)t.namespaceURI===C&&((n=r(t))&&"style"===t.localName?n.addAutomaticStyle(t):"page-layout"===t.localName&&(b[t.getAttributeNS(C,"name")]=t)),t=t.nextElementSibling;for(t=e.masterStyles.firstElementChild;t;)t.namespaceURI===C&&"master-page"===t.localName&&(o=o||t,0<(i=(n=t).getAttributeNS(C,"name")).length&&!p.hasOwnProperty(i)&&(p[i]=n)),t=t.nextElementSibling;m=new odf.MasterPage(o,v)}},ops.OperationTransformMatrix=function(){function e(e){e.position+=e.length,e.length*=-1}function t(t){var n=0>t.length;return n&&e(t),n}function n(e,t){var n=[];return e&&["style:parent-style-name","style:next-style-name"].forEach((function(i){e[i]===t&&n.push(i)})),n}function i(e,t){e&&["style:parent-style-name","style:next-style-name"].forEach((function(n){e[n]===t&&delete e[n]}))}function o(e){var t={};return Object.keys(e).forEach((function(n){t[n]="object"==typeof e[n]?o(e[n]):e[n]})),t}function r(e,t,n,i){var o,r,a=!1,s=!1,l=[];if(i&&i.attributes&&(l=i.attributes.split(",")),e&&(n||0<l.length)&&Object.keys(e).forEach((function(t){var i,o=e[t];"object"!=typeof o&&(n&&(i=n[t]),void 0!==i?(delete e[t],s=!0,i===o&&(delete n[t],a=!0)):-1!==l.indexOf(t)&&(delete e[t],s=!0))})),t&&t.attributes&&(n||0<l.length)){for(r=t.attributes.split(","),i=0;i<r.length;i+=1)o=r[i],(n&&void 0!==n[o]||l&&-1!==l.indexOf(o))&&(r.splice(i,1),--i,s=!0);0<r.length?t.attributes=r.join(","):delete t.attributes}return{majorChanged:a,minorChanged:s}}function a(e){for(var t in e)if(e.hasOwnProperty(t))return!0;return!1}function s(e){for(var t in e)if(e.hasOwnProperty(t)&&("attributes"!==t||0<e.attributes.length))return!0;return!1}function l(e,t,n,i,o){var l,u=e?e[o]:null,d=t?t[o]:null,c=n?n[o]:null,f=i?i[o]:null;return l=r(u,d,c,f),u&&!a(u)&&delete e[o],d&&!s(d)&&delete t[o],c&&!a(c)&&delete n[o],f&&!s(f)&&delete i[o],l}function u(e,t){return{opSpecsA:[e],opSpecsB:[t]}}var d;d={AddAnnotation:{AddAnnotation:function(e,t,n){var i;return e.position<t.position?(i=e,n=t):t.position<e.position?(i=t,n=e):(i=n?e:t,n=n?t:e),n.position<i.position+i.length&&(i.length+=2),n.position+=2,{opSpecsA:[e],opSpecsB:[t]}},AddCursor:u,AddMember:u,AddStyle:u,ApplyDirectStyling:function(e,t){return e.position<=t.position?t.position+=2:e.position<=t.position+t.length&&(t.length+=2),{opSpecsA:[e],opSpecsB:[t]}},InsertText:function(e,t){return t.position<=e.position?e.position+=t.text.length:(void 0!==e.length&&t.position<=e.position+e.length&&(e.length+=t.text.length),t.position+=2),{opSpecsA:[e],opSpecsB:[t]}},MergeParagraph:function(e,t){return t.sourceStartPosition<=e.position?--e.position:(void 0!==e.length&&t.sourceStartPosition<=e.position+e.length&&--e.length,t.sourceStartPosition+=2,e.position<t.destinationStartPosition&&(t.destinationStartPosition+=2)),{opSpecsA:[e],opSpecsB:[t]}},MoveCursor:function(n,i){var o=t(i);return n.position<i.position?i.position+=2:n.position<i.position+i.length&&(i.length+=2),o&&e(i),{opSpecsA:[n],opSpecsB:[i]}},RemoveAnnotation:function(e,t){return e.position<t.position?(t.position<e.position+e.length&&(e.length-=t.length+2),t.position+=2):e.position-=t.length+2,{opSpecsA:[e],opSpecsB:[t]}},RemoveCursor:u,RemoveMember:u,RemoveStyle:u,RemoveText:function(e,t){var n,i=t.position,o=t.position+t.length,r=[e],a=[t];return e.position<=t.position?t.position+=2:e.position<o&&(t.length=e.position-t.position,n={optype:"RemoveText",memberid:t.memberid,timestamp:t.timestamp,position:e.position+2,length:o-e.position},a.unshift(n)),t.position+t.length<=e.position?(e.position-=t.length,void 0!==e.length&&n&&(e.length=n.length>=e.length?0:e.length-n.length)):void 0!==e.length&&(o<=(n=e.position+e.length)?e.length-=t.length:i<n&&(e.length=i-e.position)),{opSpecsA:r,opSpecsB:a}},SetParagraphStyle:function(e,t){return e.position<t.position&&(t.position+=2),{opSpecsA:[e],opSpecsB:[t]}},SplitParagraph:function(e,t){return e.position<t.sourceParagraphPosition&&(t.sourceParagraphPosition+=2),t.position<=e.position?e.position+=1:(void 0!==e.length&&t.position<=e.position+e.length&&(e.length+=1),t.position+=2),{opSpecsA:[e],opSpecsB:[t]}},UpdateMember:u,UpdateMetadata:u,UpdateParagraphStyle:u},AddCursor:{AddCursor:u,AddMember:u,AddStyle:u,ApplyDirectStyling:u,InsertText:u,MergeParagraph:u,MoveCursor:u,RemoveAnnotation:u,RemoveCursor:u,RemoveMember:u,RemoveStyle:u,RemoveText:u,SetParagraphStyle:u,SplitParagraph:u,UpdateMember:u,UpdateMetadata:u,UpdateParagraphStyle:u},AddMember:{AddStyle:u,ApplyDirectStyling:u,InsertText:u,MergeParagraph:u,MoveCursor:u,RemoveAnnotation:u,RemoveCursor:u,RemoveStyle:u,RemoveText:u,SetParagraphStyle:u,SplitParagraph:u,UpdateMetadata:u,UpdateParagraphStyle:u},AddStyle:{AddStyle:u,ApplyDirectStyling:u,InsertText:u,MergeParagraph:u,MoveCursor:u,RemoveAnnotation:u,RemoveCursor:u,RemoveMember:u,RemoveStyle:function(e,t){var o,r=[e],a=[t];return e.styleFamily===t.styleFamily&&(0<(o=n(e.setProperties,t.styleName)).length&&(o={optype:"UpdateParagraphStyle",memberid:t.memberid,timestamp:t.timestamp,styleName:e.styleName,removedProperties:{attributes:o.join(",")}},a.unshift(o)),i(e.setProperties,t.styleName)),{opSpecsA:r,opSpecsB:a}},RemoveText:u,SetParagraphStyle:u,SplitParagraph:u,UpdateMember:u,UpdateMetadata:u,UpdateParagraphStyle:u},ApplyDirectStyling:{ApplyDirectStyling:function(e,t,n){var i,r,s,u,d,c,f,p;return u=[e],s=[t],e.position+e.length<=t.position||e.position>=t.position+t.length||(i=n?e:t,r=n?t:e,e.position===t.position&&e.length===t.length||(c=o(i),f=o(r)),((t=l(r.setProperties,null,i.setProperties,null,"style:text-properties")).majorChanged||t.minorChanged)&&(s=[],e=[],u=i.position+i.length,d=r.position+r.length,r.position<i.position?t.minorChanged&&((p=o(f)).length=i.position-r.position,e.push(p),r.position=i.position,r.length=d-r.position):i.position<r.position&&t.majorChanged&&((p=o(c)).length=r.position-i.position,s.push(p),i.position=r.position,i.length=u-i.position),d>u?t.minorChanged&&((c=f).position=u,c.length=d-u,e.push(c),r.length=u-r.position):u>d&&t.majorChanged&&(c.position=d,c.length=u-d,s.push(c),i.length=d-i.position),i.setProperties&&a(i.setProperties)&&s.push(i),r.setProperties&&a(r.setProperties)&&e.push(r),n?(u=s,s=e):u=e)),{opSpecsA:u,opSpecsB:s}},InsertText:function(e,t){return t.position<=e.position?e.position+=t.text.length:t.position<=e.position+e.length&&(e.length+=t.text.length),{opSpecsA:[e],opSpecsB:[t]}},MergeParagraph:function(e,t){var n=e.position,i=e.position+e.length;return n>=t.sourceStartPosition&&--n,i>=t.sourceStartPosition&&--i,e.position=n,e.length=i-n,{opSpecsA:[e],opSpecsB:[t]}},MoveCursor:u,RemoveAnnotation:function(e,t){var n=e.position,i=e.position+e.length,o=t.position+t.length,r=[e],a=[t];return t.position<=n&&i<=o?r=[]:(o<n&&(n-=t.length+2),o<i&&(i-=t.length+2),e.position=n,e.length=i-n),{opSpecsA:r,opSpecsB:a}},RemoveCursor:u,RemoveMember:u,RemoveStyle:u,RemoveText:function(e,t){var n=e.position+e.length,i=t.position+t.length,o=[e],r=[t];return i<=e.position?e.position-=t.length:t.position<n&&(e.position<t.position?e.length=i<n?e.length-t.length:t.position-e.position:(e.position=t.position,i<n?e.length=n-i:o=[])),{opSpecsA:o,opSpecsB:r}},SetParagraphStyle:u,SplitParagraph:function(e,t){return t.position<e.position?e.position+=1:t.position<e.position+e.length&&(e.length+=1),{opSpecsA:[e],opSpecsB:[t]}},UpdateMember:u,UpdateMetadata:u,UpdateParagraphStyle:u},InsertText:{InsertText:function(e,t,n){return e.position<t.position?t.position+=e.text.length:e.position>t.position?e.position+=t.text.length:n?t.position+=e.text.length:e.position+=t.text.length,{opSpecsA:[e],opSpecsB:[t]}},MergeParagraph:function(e,t){return e.position>=t.sourceStartPosition?--e.position:(e.position<t.sourceStartPosition&&(t.sourceStartPosition+=e.text.length),e.position<t.destinationStartPosition&&(t.destinationStartPosition+=e.text.length)),{opSpecsA:[e],opSpecsB:[t]}},MoveCursor:function(n,i){var o=t(i);return n.position<i.position?i.position+=n.text.length:n.position<i.position+i.length&&(i.length+=n.text.length),o&&e(i),{opSpecsA:[n],opSpecsB:[i]}},RemoveAnnotation:function(e,t){var n=e.position,i=t.position+t.length,o=[e],r=[t];return t.position<=n&&n<=i?(o=[],t.length+=e.text.length):i<e.position?e.position-=t.length+2:t.position+=e.text.length,{opSpecsA:o,opSpecsB:r}},RemoveCursor:u,RemoveMember:u,RemoveStyle:u,RemoveText:function(e,t){var n,i=[e],o=[t];return(n=t.position+t.length)<=e.position?e.position-=t.length:e.position<=t.position?t.position+=e.text.length:(t.length=e.position-t.position,n={optype:"RemoveText",memberid:t.memberid,timestamp:t.timestamp,position:e.position+e.text.length,length:n-e.position},o.unshift(n),e.position=t.position),{opSpecsA:i,opSpecsB:o}},SetParagraphStyle:function(e,t){return t.position>e.position&&(t.position+=e.text.length),{opSpecsA:[e],opSpecsB:[t]}},SplitParagraph:function(e,t){return e.position<t.sourceParagraphPosition&&(t.sourceParagraphPosition+=e.text.length),e.position<=t.position?t.position+=e.text.length:e.position+=1,{opSpecsA:[e],opSpecsB:[t]}},UpdateMember:u,UpdateMetadata:u,UpdateParagraphStyle:u},MergeParagraph:{MergeParagraph:function(e,t,n){var i,o=[e],r=[t];return e.destinationStartPosition===t.destinationStartPosition?(o=[],r=[],e.moveCursor&&(i={optype:"MoveCursor",memberid:e.memberid,timestamp:e.timestamp,position:e.sourceStartPosition-1},o.push(i)),t.moveCursor&&(i={optype:"MoveCursor",memberid:t.memberid,timestamp:t.timestamp,position:t.sourceStartPosition-1},r.push(i)),e={optype:"SetParagraphStyle",memberid:(e=n?e:t).memberid,timestamp:e.timestamp,position:e.destinationStartPosition,styleName:e.paragraphStyleName},n?o.push(e):r.push(e)):t.sourceStartPosition===e.destinationStartPosition?(e.destinationStartPosition=t.destinationStartPosition,--e.sourceStartPosition,e.paragraphStyleName=t.paragraphStyleName):e.sourceStartPosition===t.destinationStartPosition?(t.destinationStartPosition=e.destinationStartPosition,--t.sourceStartPosition,t.paragraphStyleName=e.paragraphStyleName):e.destinationStartPosition<t.destinationStartPosition?(--t.destinationStartPosition,--t.sourceStartPosition):(--e.destinationStartPosition,--e.sourceStartPosition),{opSpecsA:o,opSpecsB:r}},MoveCursor:function(e,t){var n=t.position,i=t.position+t.length,o=Math.min(n,i);return n=Math.max(n,i),o>=e.sourceStartPosition&&--o,n>=e.sourceStartPosition&&--n,0<=t.length?(t.position=o,t.length=n-o):(t.position=n,t.length=o-n),{opSpecsA:[e],opSpecsB:[t]}},RemoveAnnotation:function(e,t){var n=t.position+t.length,i=[e],o=[t];return t.position<=e.destinationStartPosition&&e.sourceStartPosition<=n?(i=[],--t.length):e.sourceStartPosition<t.position?--t.position:(n<e.destinationStartPosition&&(e.destinationStartPosition-=t.length+2),n<e.sourceStartPosition&&(e.sourceStartPosition-=t.length+2)),{opSpecsA:i,opSpecsB:o}},RemoveCursor:u,RemoveMember:u,RemoveStyle:u,RemoveText:function(e,t){return t.position>=e.sourceStartPosition?--t.position:(t.position<e.destinationStartPosition&&(e.destinationStartPosition-=t.length),t.position<e.sourceStartPosition&&(e.sourceStartPosition-=t.length)),{opSpecsA:[e],opSpecsB:[t]}},SetParagraphStyle:function(e,t){var n=[e],i=[t];return t.position>e.sourceStartPosition?--t.position:t.position!==e.destinationStartPosition&&t.position!==e.sourceStartPosition||(t.position=e.destinationStartPosition,e.paragraphStyleName=t.styleName),{opSpecsA:n,opSpecsB:i}},SplitParagraph:function(e,t){var n,i=[e],o=[t];return t.position<e.destinationStartPosition?(e.destinationStartPosition+=1,e.sourceStartPosition+=1):t.position>=e.destinationStartPosition&&t.position<e.sourceStartPosition?(t.paragraphStyleName=e.paragraphStyleName,n={optype:"SetParagraphStyle",memberid:e.memberid,timestamp:e.timestamp,position:e.destinationStartPosition,styleName:e.paragraphStyleName},i.push(n),t.position===e.sourceStartPosition-1&&e.moveCursor&&(n={optype:"MoveCursor",memberid:e.memberid,timestamp:e.timestamp,position:t.position,length:0},i.push(n)),e.destinationStartPosition=t.position+1,e.sourceStartPosition+=1):t.position>=e.sourceStartPosition&&(--t.position,--t.sourceParagraphPosition),{opSpecsA:i,opSpecsB:o}},UpdateMember:u,UpdateMetadata:u,UpdateParagraphStyle:u},MoveCursor:{MoveCursor:u,RemoveAnnotation:function(n,i){var o=t(n),r=n.position+n.length,a=i.position+i.length;return i.position<=n.position&&r<=a?(n.position=i.position-1,n.length=0):(a<n.position?n.position-=i.length+2:a<r&&(n.length-=i.length+2),o&&e(n)),{opSpecsA:[n],opSpecsB:[i]}},RemoveCursor:function(e,t){return{opSpecsA:e.memberid===t.memberid?[]:[e],opSpecsB:[t]}},RemoveMember:u,RemoveStyle:u,RemoveText:function(n,i){var o=t(n),r=n.position+n.length,a=i.position+i.length;return a<=n.position?n.position-=i.length:i.position<r&&(n.position<i.position?n.length=a<r?n.length-i.length:i.position-n.position:(n.position=i.position,n.length=a<r?r-a:0)),o&&e(n),{opSpecsA:[n],opSpecsB:[i]}},SetParagraphStyle:u,SplitParagraph:function(n,i){var o=t(n);return i.position<n.position?n.position+=1:i.position<n.position+n.length&&(n.length+=1),o&&e(n),{opSpecsA:[n],opSpecsB:[i]}},UpdateMember:u,UpdateMetadata:u,UpdateParagraphStyle:u},RemoveAnnotation:{RemoveAnnotation:function(e,t){var n=[e],i=[t];return e.position===t.position&&e.length===t.length?(n=[],i=[]):e.position<t.position?t.position-=e.length+2:e.position-=t.length+2,{opSpecsA:n,opSpecsB:i}},RemoveCursor:u,RemoveMember:u,RemoveStyle:u,RemoveText:function(e,t){var n=e.position+e.length,i=t.position+t.length,o=[e],r=[t];return e.position<=t.position&&i<=n?(r=[],e.length-=t.length):i<e.position?e.position-=t.length:t.position<e.position?(e.position=t.position+1,t.length-=e.length+2):t.position-=e.length+2,{opSpecsA:o,opSpecsB:r}},SetParagraphStyle:function(e,t){var n=t.position,i=e.position+e.length,o=[e],r=[t];return e.position<=n&&n<=i?r=[]:i<n&&(t.position-=e.length+2),{opSpecsA:o,opSpecsB:r}},SplitParagraph:function(e,t){var n=t.position,i=e.position+e.length,o=[e],r=[t];return e.position<=n&&n<=i?(r=[],e.length+=1):(i<t.sourceParagraphPosition&&(t.sourceParagraphPosition-=e.length+2),i<n?t.position-=e.length+2:e.position+=1),{opSpecsA:o,opSpecsB:r}},UpdateMember:u,UpdateMetadata:u,UpdateParagraphStyle:u},RemoveCursor:{RemoveCursor:function(e,t){var n=e.memberid===t.memberid;return{opSpecsA:n?[]:[e],opSpecsB:n?[]:[t]}},RemoveMember:u,RemoveStyle:u,RemoveText:u,SetParagraphStyle:u,SplitParagraph:u,UpdateMember:u,UpdateMetadata:u,UpdateParagraphStyle:u},RemoveMember:{RemoveStyle:u,RemoveText:u,SetParagraphStyle:u,SplitParagraph:u,UpdateMetadata:u,UpdateParagraphStyle:u},RemoveStyle:{RemoveStyle:function(e,t){var n=e.styleName===t.styleName&&e.styleFamily===t.styleFamily;return{opSpecsA:n?[]:[e],opSpecsB:n?[]:[t]}},RemoveText:u,SetParagraphStyle:function(e,t){var n,i=[e],o=[t];return"paragraph"===e.styleFamily&&e.styleName===t.styleName&&(n={optype:"SetParagraphStyle",memberid:e.memberid,timestamp:e.timestamp,position:t.position,styleName:""},i.unshift(n),t.styleName=""),{opSpecsA:i,opSpecsB:o}},SplitParagraph:u,UpdateMember:u,UpdateMetadata:u,UpdateParagraphStyle:function(e,t){var o,r=[e],a=[t];return"paragraph"===e.styleFamily&&(0<(o=n(t.setProperties,e.styleName)).length&&(o={optype:"UpdateParagraphStyle",memberid:e.memberid,timestamp:e.timestamp,styleName:t.styleName,removedProperties:{attributes:o.join(",")}},r.unshift(o)),e.styleName===t.styleName?a=[]:i(t.setProperties,e.styleName)),{opSpecsA:r,opSpecsB:a}}},RemoveText:{RemoveText:function(e,t){var n=e.position+e.length,i=t.position+t.length,o=[e],r=[t];return i<=e.position?e.position-=t.length:n<=t.position?t.position-=e.length:t.position<n&&(e.position<t.position?(e.length=i<n?e.length-t.length:t.position-e.position,n<i?(t.position=e.position,t.length=i-n):r=[]):(n<i?t.length-=e.length:t.position<e.position?t.length=e.position-t.position:r=[],i<n?(e.position=t.position,e.length=n-i):o=[])),{opSpecsA:o,opSpecsB:r}},SetParagraphStyle:function(e,t){return e.position<t.position&&(t.position-=e.length),{opSpecsA:[e],opSpecsB:[t]}},SplitParagraph:function(e,t){var n=e.position+e.length,i=[e],o=[t];return t.position<=e.position?e.position+=1:t.position<n&&(e.length=t.position-e.position,n={optype:"RemoveText",memberid:e.memberid,timestamp:e.timestamp,position:t.position+1,length:n-t.position},i.unshift(n)),e.position+e.length<=t.position?t.position-=e.length:e.position<t.position&&(t.position=e.position),e.position+e.length<t.sourceParagraphPosition&&(t.sourceParagraphPosition-=e.length),{opSpecsA:i,opSpecsB:o}},UpdateMember:u,UpdateMetadata:u,UpdateParagraphStyle:u},SetParagraphStyle:{SetParagraphStyle:function(e,t,n){return e.position===t.position&&(n?t.styleName=e.styleName:e.styleName=t.styleName),{opSpecsA:[e],opSpecsB:[t]}},SplitParagraph:function(e,t){var n,i=[e],r=[t];return e.position>t.position?e.position+=1:e.position===t.sourceParagraphPosition&&(t.paragraphStyleName=e.styleName,(n=o(e)).position=t.position+1,i.push(n)),{opSpecsA:i,opSpecsB:r}},UpdateMember:u,UpdateMetadata:u,UpdateParagraphStyle:u},SplitParagraph:{SplitParagraph:function(e,t,n){var i,o;return e.position<t.position?i=!0:t.position<e.position?o=!0:e.position===t.position&&(n?i=!0:o=!0),i?(t.position+=1,t.sourceParagraphPosition=e.position<t.sourceParagraphPosition?t.sourceParagraphPosition+1:e.position+1):o&&(e.position+=1,e.sourceParagraphPosition=t.position<t.sourceParagraphPosition?e.sourceParagraphPosition+1:t.position+1),{opSpecsA:[e],opSpecsB:[t]}},UpdateMember:u,UpdateMetadata:u,UpdateParagraphStyle:u},UpdateMember:{UpdateMetadata:u,UpdateParagraphStyle:u},UpdateMetadata:{UpdateMetadata:function(e,t,n){var i,o=[e],l=[t];return i=n?e:t,r((e=n?t:e).setProperties||null,e.removedProperties||null,i.setProperties||null,i.removedProperties||null),i.setProperties&&a(i.setProperties)||i.removedProperties&&s(i.removedProperties)||(n?o=[]:l=[]),e.setProperties&&a(e.setProperties)||e.removedProperties&&s(e.removedProperties)||(n?l=[]:o=[]),{opSpecsA:o,opSpecsB:l}},UpdateParagraphStyle:u},UpdateParagraphStyle:{UpdateParagraphStyle:function(e,t,n){var i,o=[e],u=[t];return e.styleName===t.styleName&&(i=n?e:t,l((e=n?t:e).setProperties,e.removedProperties,i.setProperties,i.removedProperties,"style:paragraph-properties"),l(e.setProperties,e.removedProperties,i.setProperties,i.removedProperties,"style:text-properties"),r(e.setProperties||null,e.removedProperties||null,i.setProperties||null,i.removedProperties||null),i.setProperties&&a(i.setProperties)||i.removedProperties&&s(i.removedProperties)||(n?o=[]:u=[]),e.setProperties&&a(e.setProperties)||e.removedProperties&&s(e.removedProperties)||(n?u=[]:o=[])),{opSpecsA:o,opSpecsB:u}}}},this.passUnchanged=u,this.extendTransformations=function(e){Object.keys(e).forEach((function(t){var n,i=e[t],o=d.hasOwnProperty(t);runtime.log((o?"Extending":"Adding")+" map for optypeA: "+t),o||(d[t]={}),n=d[t],Object.keys(i).forEach((function(e){var o=n.hasOwnProperty(e);runtime.assert(t<=e,"Wrong order:"+t+", "+e),runtime.log(" "+(o?"Overwriting":"Adding")+" entry for optypeB: "+e),n[e]=i[e]}))}))},this.transformOpspecVsOpspec=function(e,t){var n,i=e.optype<=t.optype;return runtime.log("Crosstransforming:"),runtime.log(runtime.toJson(e)),runtime.log(runtime.toJson(t)),i||(n=e,e=t,t=n),(n=(n=d[e.optype])&&n[t.optype])?(n=n(e,t,!i),i||null===n||(n={opSpecsA:n.opSpecsB,opSpecsB:n.opSpecsA})):n=null,runtime.log("result:"),n?(runtime.log(runtime.toJson(n.opSpecsA)),runtime.log(runtime.toJson(n.opSpecsB))):runtime.log("null"),n}},ops.OperationTransformer=function(){function e(n,i){for(var o,r,a=[],s=[];0<n.length&&i;){if(o=n.shift(),!(o=t.transformOpspecVsOpspec(o,i)))return null;if(a=a.concat(o.opSpecsA),0===o.opSpecsB.length){a=a.concat(n),i=null;break}for(;1<o.opSpecsB.length;){if(!(r=e(n,o.opSpecsB.shift())))return null;s=s.concat(r.opSpecsB),n=r.opSpecsA}i=o.opSpecsB.pop()}return i&&s.push(i),{opSpecsA:a,opSpecsB:s}}var t=new ops.OperationTransformMatrix;this.getOperationTransformMatrix=function(){return t},this.transform=function(t,n){for(var i,o=[];0<n.length;){if(!(i=e(t,n.shift())))return null;t=i.opSpecsA,o=o.concat(i.opSpecsB)}return{opSpecsA:t,opSpecsB:o}}};var webodf_css='@namespace draw url(urn:oasis:names:tc:opendocument:xmlns:drawing:1.0);@namespace fo url(urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0);@namespace office url(urn:oasis:names:tc:opendocument:xmlns:office:1.0);@namespace presentation url(urn:oasis:names:tc:opendocument:xmlns:presentation:1.0);@namespace style url(urn:oasis:names:tc:opendocument:xmlns:style:1.0);@namespace svg url(urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0);@namespace table url(urn:oasis:names:tc:opendocument:xmlns:table:1.0);@namespace text url(urn:oasis:names:tc:opendocument:xmlns:text:1.0);@namespace webodfhelper url(urn:webodf:names:helper);@namespace cursor url(urn:webodf:names:cursor);@namespace editinfo url(urn:webodf:names:editinfo);@namespace annotation url(urn:webodf:names:annotation);@namespace dc url(http://purl.org/dc/elements/1.1/);@namespace svgns url(http://www.w3.org/2000/svg);office|document > *, office|document-content > * {display: none;}office|body, office|document {display: inline-block;position: relative;}text|p, text|h {display: block;padding: 0;margin: 0;line-height: normal;position: relative;}text|p::after, text|h::after {content: "\\200B";white-space: pre;}*[webodfhelper|containsparagraphanchor] {position: relative;}text|s {white-space: pre;}text|tab {display: inline;white-space: pre;}text|tracked-changes {display: none;}office|binary-data {display: none;}office|text {display: block;text-align: left;overflow: visible;word-wrap: break-word;}office|text::selection {background: transparent;}.webodf-virtualSelections *::selection {background: transparent;}.webodf-virtualSelections *::-moz-selection {background: transparent;}office|text * draw|text-box {display: block;border: 1px solid #d3d3d3;}office|text draw|frame {z-index: 1;}office|spreadsheet {display: block;border-collapse: collapse;empty-cells: show;font-family: sans-serif;font-size: 10pt;text-align: left;page-break-inside: avoid;overflow: hidden;}office|presentation {display: inline-block;text-align: left;}#shadowContent {display: inline-block;text-align: left;}draw|page {display: block;position: relative;overflow: hidden;}presentation|notes, presentation|footer-decl, presentation|date-time-decl {display: none;}@media print {draw|page {border: 1pt solid black;page-break-inside: avoid;}presentation|notes {}}office|spreadsheet text|p {border: 0px;padding: 1px;margin: 0px;}office|spreadsheet table|table {margin: 3px;}office|spreadsheet table|table:after {}office|spreadsheet table|table-row {counter-increment: row;}office|spreadsheet table|table-row:before {width: 3em;background: #cccccc;border: 1px solid black;text-align: center;content: counter(row);display: table-cell;}office|spreadsheet table|table-cell {border: 1px solid #cccccc;}table|table {display: table;}draw|frame table|table {width: 100%;height: 100%;background: white;}table|table-header-rows {display: table-header-group;}table|table-row {display: table-row;}table|table-column {display: table-column;}table|table-cell {width: 0.889in;display: table-cell;word-break: break-all;}draw|frame {display: block;}draw|image {display: block;width: 100%;height: 100%;top: 0px;left: 0px;background-repeat: no-repeat;background-size: 100% 100%;-moz-background-size: 100% 100%;}draw|frame > draw|image:nth-of-type(n+2) {display: none;}text|list:before {display: none;content:"";}text|list {display: block;}text|list-item {display: block;}text|number {display:none;}text|a {color: blue;text-decoration: underline;cursor: pointer;}.webodf-inactiveLinks text|a {cursor: text;}text|note-citation {vertical-align: super;font-size: smaller;}text|note-body {display: none;}text|note:hover text|note-citation {background: #dddddd;}text|note:hover text|note-body {display: block;left:1em;max-width: 80%;position: absolute;background: #ffffaa;}text|bibliography-source {display: none;}svg|title, svg|desc {display: none;}video {width: 100%;height: 100%}cursor|anchor {display: none;}cursor|cursor {display: none;}.webodf-caretOverlay {position: absolute;top: 5%;height: 1em;z-index: 10;padding-left: 1px;pointer-events: none;}.webodf-caretOverlay .caret {position: absolute;border-left: 2px solid black;top: 0;bottom: 0;right: 0;}.webodf-caretOverlay .handle {position: absolute;margin-top: 5px;padding-top: 3px;margin-left: auto;margin-right: auto;width: 64px;height: 68px;border-radius: 5px;opacity: 0.3;text-align: center;background-color: black;box-shadow: 0px 0px 5px rgb(90, 90, 90);border: 1px solid black;top: -85px;right: -32px;}.webodf-caretOverlay .handle > img {box-shadow: 0px 0px 5px rgb(90, 90, 90) inset;background-color: rgb(200, 200, 200);border-radius: 5px;border: 2px solid;height: 60px;width: 60px;display: block;margin: auto;}.webodf-caretOverlay .handle.active {opacity: 0.8;}.webodf-caretOverlay .handle:after {content: " ";position: absolute;width: 0px;height: 0px;border-style: solid;border-width: 8.7px 5px 0 5px;border-color: black transparent transparent transparent;top: 100%;left: 43%;}.webodf-caretSizer {display: inline-block;width: 0;visibility: hidden;}#eventTrap {display: block;position: absolute;bottom: 0;left: 0;outline: none;opacity: 0;color: rgba(255, 255, 255, 0);pointer-events: none;white-space: pre;overflow: hidden;}cursor|cursor > #composer {text-decoration: underline;}cursor|cursor[cursor|caret-sizer-active="true"],cursor|cursor[cursor|composing="true"] {display: inline;}editinfo|editinfo {display: inline-block;}.editInfoMarker {position: absolute;width: 10px;height: 100%;left: -20px;opacity: 0.8;top: 0;border-radius: 5px;background-color: transparent;box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);}.editInfoMarker:hover {box-shadow: 0px 0px 8px rgba(0, 0, 0, 1);}.editInfoHandle {position: absolute;background-color: black;padding: 5px;border-radius: 5px;opacity: 0.8;box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);bottom: 100%;margin-bottom: 10px;z-index: 3;left: -25px;}.editInfoHandle:after {content: " ";position: absolute;width: 0px;height: 0px;border-style: solid;border-width: 8.7px 5px 0 5px;border-color: black transparent transparent transparent;top: 100%;left: 5px;}.editInfo {font-family: sans-serif;font-weight: normal;font-style: normal;text-decoration: none;color: white;width: 100%;height: 12pt;}.editInfoColor {float: left;width: 10pt;height: 10pt;border: 1px solid white;}.editInfoAuthor {float: left;margin-left: 5pt;font-size: 10pt;text-align: left;height: 12pt;line-height: 12pt;}.editInfoTime {float: right;margin-left: 30pt;font-size: 8pt;font-style: italic;color: yellow;height: 12pt;line-height: 12pt;}.annotationWrapper {display: inline;position: relative;}.annotationRemoveButton:before {content: "×";color: white;padding: 5px;line-height: 1em;}.annotationRemoveButton {width: 20px;height: 20px;border-radius: 10px;background-color: black;box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);position: absolute;top: -10px;left: -10px;z-index: 3;text-align: center;font-family: sans-serif;font-style: normal;font-weight: normal;text-decoration: none;font-size: 15px;}.annotationRemoveButton:hover {cursor: pointer;box-shadow: 0px 0px 5px rgba(0, 0, 0, 1);}.annotationNote {width: 4cm;position: absolute;display: inline;z-index: 10;top: 0;}.annotationNote > office|annotation {display: block;text-align: left;}.annotationConnector {position: absolute;display: inline;top: 0;z-index: 2;border-top: 1px dashed brown;}.annotationConnector.angular {-moz-transform-origin: left top;-webkit-transform-origin: left top;-ms-transform-origin: left top;transform-origin: left top;}.annotationConnector.horizontal {left: 0;}.annotationConnector.horizontal:before {content: "";display: inline;position: absolute;width: 0px;height: 0px;border-style: solid;border-width: 8.7px 5px 0 5px;border-color: brown transparent transparent transparent;top: -1px;left: -5px;}office|annotation {width: 100%;height: 100%;display: none;background: rgb(198, 238, 184);background: -moz-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);background: -webkit-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);background: -o-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);background: -ms-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);background: linear-gradient(180deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);box-shadow: 0 3px 4px -3px #ccc;}office|annotation > dc|creator {display: block;font-size: 10pt;font-weight: normal;font-style: normal;font-family: sans-serif;color: white;background-color: brown;padding: 4px;}office|annotation > dc|date {display: block;font-size: 10pt;font-weight: normal;font-style: normal;font-family: sans-serif;border: 4px solid transparent;color: black;}office|annotation > text|list {display: block;padding: 5px;}office|annotation text|p {font-size: 10pt;color: black;font-weight: normal;font-style: normal;text-decoration: none;font-family: sans-serif;}#annotationsPane {background-color: #EAEAEA;width: 4cm;height: 100%;display: none;position: absolute;outline: 1px solid #ccc;}.webodf-annotationHighlight {background-color: yellow;position: relative;}.webodf-selectionOverlay {position: absolute;pointer-events: none;top: 0;left: 0;top: 0;left: 0;width: 100%;height: 100%;z-index: 15;}.webodf-selectionOverlay > polygon {fill-opacity: 0.3;stroke-opacity: 0.8;stroke-width: 1;fill-rule: evenodd;}.webodf-selectionOverlay > .webodf-draggable {fill-opacity: 0.8;stroke-opacity: 0;stroke-width: 8;pointer-events: all;display: none;-moz-transform-origin: center center;-webkit-transform-origin: center center;-ms-transform-origin: center center;transform-origin: center center;}#imageSelector {display: none;position: absolute;border-style: solid;border-color: black;}#imageSelector > div {width: 5px;height: 5px;display: block;position: absolute;border: 1px solid black;background-color: #ffffff;}#imageSelector > .topLeft {top: -4px;left: -4px;}#imageSelector > .topRight {top: -4px;right: -4px;}#imageSelector > .bottomRight {right: -4px;bottom: -4px;}#imageSelector > .bottomLeft {bottom: -4px;left: -4px;}#imageSelector > .topMiddle {top: -4px;left: 50%;margin-left: -2.5px;}#imageSelector > .rightMiddle {top: 50%;right: -4px;margin-top: -2.5px;}#imageSelector > .bottomMiddle {bottom: -4px;left: 50%;margin-left: -2.5px;}#imageSelector > .leftMiddle {top: 50%;left: -4px;margin-top: -2.5px;}div.webodf-customScrollbars::-webkit-scrollbar{width: 8px;height: 8px;background-color: transparent;}div.webodf-customScrollbars::-webkit-scrollbar-track{background-color: transparent;}div.webodf-customScrollbars::-webkit-scrollbar-thumb{background-color: #444;border-radius: 4px;}.webodf-hyperlinkTooltip {display: none;color: white;background-color: black;border-radius: 5px;box-shadow: 2px 2px 5px gray;padding: 3px;position: absolute;max-width: 210px;text-align: left;word-break: break-all;z-index: 16;}.webodf-hyperlinkTooltipText {display: block;font-weight: bold;}',globalScope;
/*
@licstart
JSZip - A Javascript class for generating and reading zip files
<http://stuartk.com/jszip>
(c) 2009-2014 Stuart Knightley <stuart [at] stuartk.com>
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown.
JSZip uses the library pako released under the MIT license :
https://github.com/nodeca/pako/blob/master/LICENSE
@licend
*/globalScope="undefined"!=typeof window?window:"undefined"!=typeof global?global:{},(globalScope.externs||(globalScope.externs={})).JSZip=function e(t,n,i){function o(a,s){if(!n[a]){if(!t[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(r)return r(a,!0);throw new Error("Cannot find module '"+a+"'")}var u=n[a]={exports:{}};t[a][0].call(u.exports,(function(e){return o(t[a][1][e]||e)}),u,u.exports,e,t,n,i)}return n[a].exports}for(var r="function"==typeof require&&require,a=0;a<i.length;a++)o(i[a]);return o}({1:[function(e,t,n){var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.encode=function(e,t){for(var n,o,r,a,s,l,u,d="",c=0;c<e.length;)a=(n=e.charCodeAt(c++))>>2,s=(3&n)<<4|(o=e.charCodeAt(c++))>>4,l=(15&o)<<2|(r=e.charCodeAt(c++))>>6,u=63&r,isNaN(o)?l=u=64:isNaN(r)&&(u=64),d=d+i.charAt(a)+i.charAt(s)+i.charAt(l)+i.charAt(u);return d},n.decode=function(e,t){var n,o,r,a,s,l,u="",d=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");d<e.length;)n=i.indexOf(e.charAt(d++))<<2|(a=i.indexOf(e.charAt(d++)))>>4,o=(15&a)<<4|(s=i.indexOf(e.charAt(d++)))>>2,r=(3&s)<<6|(l=i.indexOf(e.charAt(d++))),u+=String.fromCharCode(n),64!=s&&(u+=String.fromCharCode(o)),64!=l&&(u+=String.fromCharCode(r));return u}},{}],2:[function(e,t,n){function i(){this.compressedSize=0,this.uncompressedSize=0,this.crc32=0,this.compressionMethod=null,this.compressedContent=null}i.prototype={getContent:function(){return null},getCompressedContent:function(){return null}},t.exports=i},{}],3:[function(e,t,n){n.STORE={magic:"\0\0",compress:function(e){return e},uncompress:function(e){return e},compressInputType:null,uncompressInputType:null},n.DEFLATE=e("./flate")},{"./flate":8}],4:[function(e,t,n){var i=e("./utils"),o=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];t.exports=function(e,t){if(void 0===e||!e.length)return 0;var n="string"!==i.getTypeOf(e);void 0===t&&(t=0);var r=0;t^=-1;for(var a=0,s=e.length;a<s;a++)r=n?e[a]:e.charCodeAt(a),t=t>>>8^o[255&(t^r)];return-1^t}},{"./utils":21}],5:[function(e,t,n){var i=e("./utils");function o(e){this.data=null,this.length=0,this.index=0}o.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(e){},readInt:function(e){var t,n=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return i.transformTo("string",this.readData(e))},readData:function(e){},lastIndexOfSignature:function(e){},readDate:function(){var e=this.readInt(4);return new Date(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1)}},t.exports=o},{"./utils":21}],6:[function(e,t,n){n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!1,n.date=null,n.compression=null,n.comment=null},{}],7:[function(e,t,n){var i=e("./utils");n.string2binary=function(e){return i.string2binary(e)},n.string2Uint8Array=function(e){return i.transformTo("uint8array",e)},n.uint8Array2String=function(e){return i.transformTo("string",e)},n.string2Blob=function(e){var t=i.transformTo("arraybuffer",e);return i.arrayBuffer2Blob(t)},n.arrayBuffer2Blob=function(e){return i.arrayBuffer2Blob(e)},n.transformTo=function(e,t){return i.transformTo(e,t)},n.getTypeOf=function(e){return i.getTypeOf(e)},n.checkSupport=function(e){return i.checkSupport(e)},n.MAX_VALUE_16BITS=i.MAX_VALUE_16BITS,n.MAX_VALUE_32BITS=i.MAX_VALUE_32BITS,n.pretty=function(e){return i.pretty(e)},n.findCompression=function(e){return i.findCompression(e)},n.isRegExp=function(e){return i.isRegExp(e)}},{"./utils":21}],8:[function(e,t,n){var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,o=e("pako");n.uncompressInputType=i?"uint8array":"array",n.compressInputType=i?"uint8array":"array",n.magic="\b\0",n.compress=function(e){return o.deflateRaw(e)},n.uncompress=function(e){return o.inflateRaw(e)}},{pako:24}],9:[function(e,t,n){var i=e("./base64");function o(e,t){if(!(this instanceof o))return new o(e,t);this.files={},this.comment=null,this.root="",e&&this.load(e,t),this.clone=function(){var e=new o;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}o.prototype=e("./object"),o.prototype.load=e("./load"),o.support=e("./support"),o.defaults=e("./defaults"),o.utils=e("./deprecatedPublicUtils"),o.base64={encode:function(e){return i.encode(e)},decode:function(e){return i.decode(e)}},o.compressions=e("./compressions"),t.exports=o},{"./base64":1,"./compressions":3,"./defaults":6,"./deprecatedPublicUtils":7,"./load":10,"./object":13,"./support":17}],10:[function(e,t,n){var i=e("./base64"),o=e("./zipEntries");t.exports=function(e,t){var n,r,a,s;for((t=t||{}).base64&&(e=i.decode(e)),n=(r=new o(e,t)).files,a=0;a<n.length;a++)s=n[a],this.file(s.fileName,s.decompressed,{binary:!0,optimizedBinaryString:!0,date:s.date,dir:s.dir,comment:s.fileComment.length?s.fileComment:null,createFolders:t.createFolders});return r.zipComment.length&&(this.comment=r.zipComment),this}},{"./base64":1,"./zipEntries":22}],11:[function(e,t,n){(function(e){t.exports=function(t,n){return new e(t,n)},t.exports.test=function(t){return e.isBuffer(t)}}).call(this,"undefined"!=typeof Buffer?Buffer:void 0)},{}],12:[function(e,t,n){var i=e("./uint8ArrayReader");function o(e){this.data=e,this.length=this.data.length,this.index=0}o.prototype=new i,o.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.index,this.index+e);return this.index+=e,t},t.exports=o},{"./uint8ArrayReader":18}],13:[function(e,t,n){var i=e("./support"),o=e("./utils"),r=e("./crc32"),a=e("./signature"),s=e("./defaults"),l=e("./base64"),u=e("./compressions"),d=e("./compressedObject"),c=e("./nodeBuffer"),f=e("./utf8"),p=e("./stringWriter"),h=e("./uint8ArrayWriter"),m=function(e){if(e._data instanceof d&&(e._data=e._data.getContent(),e.options.binary=!0,e.options.base64=!1,"uint8array"===o.getTypeOf(e._data))){var t=e._data;e._data=new Uint8Array(t.length),0!==t.length&&e._data.set(t,0)}return e._data},g=function(e){var t=m(e);return"string"===o.getTypeOf(t)?!e.options.binary&&i.nodebuffer?c(t,"utf-8"):e.asBinary():t},b=function(e){var t=m(this);return null==t?"":(this.options.base64&&(t=l.decode(t)),t=e&&this.options.binary?T.utf8decode(t):o.transformTo("string",t),e||this.options.binary||(t=o.transformTo("string",T.utf8encode(t))),t)},y=function(e,t,n){this.name=e,this.dir=n.dir,this.date=n.date,this.comment=n.comment,this._data=t,this.options=n,this._initialMetadata={dir:n.dir,date:n.date}};y.prototype={asText:function(){return b.call(this,!0)},asBinary:function(){return b.call(this,!1)},asNodeBuffer:function(){var e=g(this);return o.transformTo("nodebuffer",e)},asUint8Array:function(){var e=g(this);return o.transformTo("uint8array",e)},asArrayBuffer:function(){return this.asUint8Array().buffer}};var v=function(e,t){var n,i="";for(n=0;n<t;n++)i+=String.fromCharCode(255&e),e>>>=8;return i},S=function(){var e,t,n={};for(e=0;e<arguments.length;e++)for(t in arguments[e])arguments[e].hasOwnProperty(t)&&void 0===n[t]&&(n[t]=arguments[e][t]);return n},C=function(e,t,n){var i,r=o.getTypeOf(t);if((n=function(e){return!0!==(e=e||{}).base64||null!==e.binary&&void 0!==e.binary||(e.binary=!0),(e=S(e,s)).date=e.date||new Date,null!==e.compression&&(e.compression=e.compression.toUpperCase()),e}(n)).createFolders&&(i=N(e))&&x.call(this,i,!0),n.dir||null==t)n.base64=!1,n.binary=!1,t=null;else if("string"===r)n.binary&&!n.base64&&!0!==n.optimizedBinaryString&&(t=o.string2binary(t));else{if(n.base64=!1,n.binary=!0,!(r||t instanceof d))throw new Error("The data of '"+e+"' is in an unsupported format !");"arraybuffer"===r&&(t=o.transformTo("uint8array",t))}var a=new y(e,t,n);return this.files[e]=a,a},N=function(e){"/"==e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return t>0?e.substring(0,t):""},x=function(e,t){return"/"!=e.slice(-1)&&(e+="/"),t=void 0!==t&&t,this.files[e]||C.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]},w=function(e,t){var n,i=new d;return e._data instanceof d?(i.uncompressedSize=e._data.uncompressedSize,i.crc32=e._data.crc32,0===i.uncompressedSize||e.dir?(t=u.STORE,i.compressedContent="",i.crc32=0):e._data.compressionMethod===t.magic?i.compressedContent=e._data.getCompressedContent():(n=e._data.getContent(),i.compressedContent=t.compress(o.transformTo(t.compressInputType,n)))):((n=g(e))&&0!==n.length&&!e.dir||(t=u.STORE,n=""),i.uncompressedSize=n.length,i.crc32=r(n),i.compressedContent=t.compress(o.transformTo(t.compressInputType,n))),i.compressedSize=i.compressedContent.length,i.compressionMethod=t.magic,i},E=function(e,t,n,i){n.compressedContent;var s,l,u,d,c=o.transformTo("string",f.utf8encode(t.name)),p=t.comment||"",h=o.transformTo("string",f.utf8encode(p)),m=c.length!==t.name.length,g=h.length!==p.length,b=t.options,y="",S="",C="";u=t._initialMetadata.dir!==t.dir?t.dir:b.dir,s=(d=t._initialMetadata.date!==t.date?t.date:b.date).getHours(),s<<=6,s|=d.getMinutes(),s<<=5,s|=d.getSeconds()/2,l=d.getFullYear()-1980,l<<=4,l|=d.getMonth()+1,l<<=5,l|=d.getDate(),m&&(S=v(1,1)+v(r(c),4)+c,y+="up"+v(S.length,2)+S),g&&(C=v(1,1)+v(this.crc32(h),4)+h,y+="uc"+v(C.length,2)+C);var N="";return N+="\n\0",N+=m||g?"\0\b":"\0\0",N+=n.compressionMethod,N+=v(s,2),N+=v(l,2),N+=v(n.crc32,4),N+=v(n.compressedSize,4),N+=v(n.uncompressedSize,4),N+=v(c.length,2),N+=v(y.length,2),{fileRecord:a.LOCAL_FILE_HEADER+N+c+y,dirRecord:a.CENTRAL_FILE_HEADER+"\0"+N+v(h.length,2)+"\0\0\0\0"+(!0===u?"\0\0\0":"\0\0\0\0")+v(i,4)+c+y+h,compressedObject:n}},T={load:function(e,t){throw new Error("Load method is not defined. Is the file jszip-load.js included ?")},filter:function(e){var t,n,i,o,r=[];for(t in this.files)this.files.hasOwnProperty(t)&&(i=this.files[t],o=new y(i.name,i._data,S(i.options)),n=t.slice(this.root.length,t.length),t.slice(0,this.root.length)===this.root&&e(n,o)&&r.push(o));return r},file:function(e,t,n){if(1===arguments.length){if(o.isRegExp(e)){var i=e;return this.filter((function(e,t){return!t.dir&&i.test(e)}))}return this.filter((function(t,n){return!n.dir&&t===e}))[0]||null}return e=this.root+e,C.call(this,e,t,n),this},folder:function(e){if(!e)return this;if(o.isRegExp(e))return this.filter((function(t,n){return n.dir&&e.test(t)}));var t=this.root+e,n=x.call(this,t),i=this.clone();return i.root=n.name,i},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!=e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var n=this.filter((function(t,n){return n.name.slice(0,e.length)===e})),i=0;i<n.length;i++)delete this.files[n[i].name];return this},generate:function(e){e=S(e||{},{base64:!0,compression:"STORE",type:"base64",comment:null}),o.checkSupport(e.type);var t,n,i,r=[],s=0,d=0,c=o.transformTo("string",this.utf8encode(e.comment||this.comment||""));for(var f in this.files)if(this.files.hasOwnProperty(f)){var m=this.files[f],g=m.options.compression||e.compression.toUpperCase(),b=u[g];if(!b)throw new Error(g+" is not a valid compression method !");var y=w.call(this,m,b),C=E.call(this,f,m,y,s);s+=C.fileRecord.length+y.compressedSize,d+=C.dirRecord.length,r.push(C)}i=a.CENTRAL_DIRECTORY_END+"\0\0\0\0"+v(r.length,2)+v(r.length,2)+v(d,4)+v(s,4)+v(c.length,2)+c;var N=e.type.toLowerCase();for(t="uint8array"===N||"arraybuffer"===N||"blob"===N||"nodebuffer"===N?new h(s+d+i.length):new p(s+d+i.length),n=0;n<r.length;n++)t.append(r[n].fileRecord),t.append(r[n].compressedObject.compressedContent);for(n=0;n<r.length;n++)t.append(r[n].dirRecord);t.append(i);var x=t.finalize();switch(e.type.toLowerCase()){case"uint8array":case"arraybuffer":case"nodebuffer":return o.transformTo(e.type.toLowerCase(),x);case"blob":return o.arrayBuffer2Blob(o.transformTo("arraybuffer",x));case"base64":return e.base64?l.encode(x):x;default:return x}},crc32:function(e,t){return r(e,t)},utf8encode:function(e){return o.transformTo("string",f.utf8encode(e))},utf8decode:function(e){return f.utf8decode(e)}};t.exports=T},{"./base64":1,"./compressedObject":2,"./compressions":3,"./crc32":4,"./defaults":6,"./nodeBuffer":11,"./signature":14,"./stringWriter":16,"./support":17,"./uint8ArrayWriter":19,"./utf8":20,"./utils":21}],14:[function(e,t,n){n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\b"},{}],15:[function(e,t,n){var i=e("./dataReader"),o=e("./utils");function r(e,t){this.data=e,t||(this.data=o.string2binary(this.data)),this.length=this.data.length,this.index=0}r.prototype=new i,r.prototype.byteAt=function(e){return this.data.charCodeAt(e)},r.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)},r.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.index,this.index+e);return this.index+=e,t},t.exports=r},{"./dataReader":5,"./utils":21}],16:[function(e,t,n){var i=e("./utils"),o=function(){this.data=[]};o.prototype={append:function(e){e=i.transformTo("string",e),this.data.push(e)},finalize:function(){return this.data.join("")}},t.exports=o},{"./utils":21}],17:[function(e,t,n){(function(e){if(n.base64=!0,n.array=!0,n.string=!0,n.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,n.nodebuffer=void 0!==e,n.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)n.blob=!1;else{var t=new ArrayBuffer(0);try{n.blob=0===new Blob([t],{type:"application/zip"}).size}catch(e){try{var i=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder);i.append(t),n.blob=0===i.getBlob("application/zip").size}catch(e){n.blob=!1}}}}).call(this,"undefined"!=typeof Buffer?Buffer:void 0)},{}],18:[function(e,t,n){var i=e("./dataReader");function o(e){e&&(this.data=e,this.length=this.data.length,this.index=0)}o.prototype=new i,o.prototype.byteAt=function(e){return this.data[e]},o.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),n=e.charCodeAt(1),i=e.charCodeAt(2),o=e.charCodeAt(3),r=this.length-4;r>=0;--r)if(this.data[r]===t&&this.data[r+1]===n&&this.data[r+2]===i&&this.data[r+3]===o)return r;return-1},o.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.index,this.index+e);return this.index+=e,t},t.exports=o},{"./dataReader":5}],19:[function(e,t,n){var i=e("./utils"),o=function(e){this.data=new Uint8Array(e),this.index=0};o.prototype={append:function(e){0!==e.length&&(e=i.transformTo("uint8array",e),this.data.set(e,this.index),this.index+=e.length)},finalize:function(){return this.data}},t.exports=o},{"./utils":21}],20:[function(e,t,n){for(var i=e("./utils"),o=e("./support"),r=e("./nodeBuffer"),a=new Array(256),s=0;s<256;s++)a[s]=s>=252?6:s>=248?5:s>=240?4:s>=224?3:s>=192?2:1;a[254]=a[254]=1;var l=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+a[e[n]]>t?n:t},u=function(e){var t,n,o,r,s=e.length,l=new Array(2*s);for(n=0,t=0;t<s;)if((o=e[t++])<128)l[n++]=o;else if((r=a[o])>4)l[n++]=65533,t+=r-1;else{for(o&=2===r?31:3===r?15:7;r>1&&t<s;)o=o<<6|63&e[t++],r--;r>1?l[n++]=65533:o<65536?l[n++]=o:(o-=65536,l[n++]=55296|o>>10&1023,l[n++]=56320|1023&o)}return l.length!==n&&(l.subarray?l=l.subarray(0,n):l.length=n),i.applyFromCharCode(l)};n.utf8encode=function(e){return o.nodebuffer?r(e,"utf-8"):function(e){var t,n,i,r,a,s=e.length,l=0;for(r=0;r<s;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<s&&56320==(64512&(i=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(i-56320),r++),l+=n<128?1:n<2048?2:n<65536?3:4;for(t=o.uint8array?new Uint8Array(l):new Array(l),a=0,r=0;a<l;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<s&&56320==(64512&(i=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(i-56320),r++),n<128?t[a++]=n:n<2048?(t[a++]=192|n>>>6,t[a++]=128|63&n):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|63&n):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|63&n);return t}(e)},n.utf8decode=function(e){if(o.nodebuffer)return i.transformTo("nodebuffer",e).toString("utf-8");for(var t=[],n=0,r=(e=i.transformTo(o.uint8array?"uint8array":"array",e)).length;n<r;){var a=l(e,Math.min(n+65536,r));o.uint8array?t.push(u(e.subarray(n,a))):t.push(u(e.slice(n,a))),n=a}return t.join("")}},{"./nodeBuffer":11,"./support":17,"./utils":21}],21:[function(e,t,n){var i=e("./support"),o=e("./compressions"),r=e("./nodeBuffer");function a(e){return e}function s(e,t){for(var n=0;n<e.length;++n)t[n]=255&e.charCodeAt(n);return t}function l(e){var t=65536,i=[],o=e.length,a=n.getTypeOf(e),s=0,l=!0;try{switch(a){case"uint8array":String.fromCharCode.apply(null,new Uint8Array(0));break;case"nodebuffer":String.fromCharCode.apply(null,r(0))}}catch(e){l=!1}if(!l){for(var u="",d=0;d<e.length;d++)u+=String.fromCharCode(e[d]);return u}for(;s<o&&t>1;)try{"array"===a||"nodebuffer"===a?i.push(String.fromCharCode.apply(null,e.slice(s,Math.min(s+t,o)))):i.push(String.fromCharCode.apply(null,e.subarray(s,Math.min(s+t,o)))),s+=t}catch(e){t=Math.floor(t/2)}return i.join("")}function u(e,t){for(var n=0;n<e.length;n++)t[n]=e[n];return t}n.string2binary=function(e){for(var t="",n=0;n<e.length;n++)t+=String.fromCharCode(255&e.charCodeAt(n));return t},n.arrayBuffer2Blob=function(e){n.checkSupport("blob");try{return new Blob([e],{type:"application/zip"})}catch(n){try{var t=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder);return t.append(e),t.getBlob("application/zip")}catch(e){throw new Error("Bug : can't construct the Blob.")}}},n.applyFromCharCode=l;var d={};d.string={string:a,array:function(e){return s(e,new Array(e.length))},arraybuffer:function(e){return d.string.uint8array(e).buffer},uint8array:function(e){return s(e,new Uint8Array(e.length))},nodebuffer:function(e){return s(e,r(e.length))}},d.array={string:l,array:a,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return r(e)}},d.arraybuffer={string:function(e){return l(new Uint8Array(e))},array:function(e){return u(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:a,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return r(new Uint8Array(e))}},d.uint8array={string:l,array:function(e){return u(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:a,nodebuffer:function(e){return r(e)}},d.nodebuffer={string:l,array:function(e){return u(e,new Array(e.length))},arraybuffer:function(e){return d.nodebuffer.uint8array(e).buffer},uint8array:function(e){return u(e,new Uint8Array(e.length))},nodebuffer:a},n.transformTo=function(e,t){if(t||(t=""),!e)return t;n.checkSupport(e);var i=n.getTypeOf(t);return d[i][e](t)},n.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":i.nodebuffer&&r.test(e)?"nodebuffer":i.uint8array&&e instanceof Uint8Array?"uint8array":i.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},n.checkSupport=function(e){if(!i[e.toLowerCase()])throw new Error(e+" is not supported by this browser")},n.MAX_VALUE_16BITS=65535,n.MAX_VALUE_32BITS=-1,n.pretty=function(e){var t,n,i="";for(n=0;n<(e||"").length;n++)i+="\\x"+((t=e.charCodeAt(n))<16?"0":"")+t.toString(16).toUpperCase();return i},n.findCompression=function(e){for(var t in o)if(o.hasOwnProperty(t)&&o[t].magic===e)return o[t];return null},n.isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)}},{"./compressions":3,"./nodeBuffer":11,"./support":17}],22:[function(e,t,n){var i=e("./stringReader"),o=e("./nodeBufferReader"),r=e("./uint8ArrayReader"),a=e("./utils"),s=e("./signature"),l=e("./zipEntry"),u=e("./support"),d=e("./object");function c(e,t){this.files=[],this.loadOptions=t,e&&this.load(e)}c.prototype={checkSignature:function(e){var t=this.reader.readString(4);if(t!==e)throw new Error("Corrupted zip or bug : unexpected signature ("+a.pretty(t)+", expected "+a.pretty(e)+")")},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2),this.zipComment=this.reader.readString(this.zipCommentLength),this.zipComment=d.utf8decode(this.zipComment)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.versionMadeBy=this.reader.readString(2),this.versionNeeded=this.reader.readInt(2),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,n,i=this.zip64EndOfCentralSize-44;0<i;)e=this.reader.readInt(2),t=this.reader.readInt(4),n=this.reader.readString(t),this.zip64ExtensibleData[e]={id:e,length:t,value:n}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(s.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readString(4)===s.CENTRAL_FILE_HEADER;)(e=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);if(-1===e)throw new Error("Corrupted zip : can't find end of central directory");if(this.reader.setIndex(e),this.checkSignature(s.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a.MAX_VALUE_16BITS||this.centralDirRecords===a.MAX_VALUE_16BITS||this.centralDirSize===a.MAX_VALUE_32BITS||this.centralDirOffset===a.MAX_VALUE_32BITS){if(this.zip64=!0,-1===(e=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR)))throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator");this.reader.setIndex(e),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}},prepareReader:function(e){var t=a.getTypeOf(e);"string"!==t||u.uint8array?this.reader="nodebuffer"===t?new o(e):new r(a.transformTo("uint8array",e)):this.reader=new i(e,this.loadOptions.optimizedBinaryString)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=c},{"./nodeBufferReader":12,"./object":13,"./signature":14,"./stringReader":15,"./support":17,"./uint8ArrayReader":18,"./utils":21,"./zipEntry":23}],23:[function(e,t,n){var i=e("./stringReader"),o=e("./utils"),r=e("./compressedObject"),a=e("./object");function s(e,t){this.options=e,this.loadOptions=t}s.prototype={isEncrypted:function(){return 1==(1&this.bitFlag)},useUTF8:function(){return 2048==(2048&this.bitFlag)},prepareCompressedContent:function(e,t,n){return function(){var i=e.index;e.setIndex(t);var o=e.readData(n);return e.setIndex(i),o}},prepareContent:function(e,t,n,i,r){return function(){var e=o.transformTo(i.uncompressInputType,this.getCompressedContent()),t=i.uncompress(e);if(t.length!==r)throw new Error("Bug : uncompressed data size mismatch");return t}},readLocalPart:function(e){var t,n;if(e.skip(22),this.fileNameLength=e.readInt(2),n=e.readInt(2),this.fileName=e.readString(this.fileNameLength),e.skip(n),-1==this.compressedSize||-1==this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory (compressedSize == -1 || uncompressedSize == -1)");if(null===(t=o.findCompression(this.compressionMethod)))throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+this.fileName+")");if(this.decompressed=new r,this.decompressed.compressedSize=this.compressedSize,this.decompressed.uncompressedSize=this.uncompressedSize,this.decompressed.crc32=this.crc32,this.decompressed.compressionMethod=this.compressionMethod,this.decompressed.getCompressedContent=this.prepareCompressedContent(e,e.index,this.compressedSize,t),this.decompressed.getContent=this.prepareContent(e,e.index,this.compressedSize,t,this.uncompressedSize),this.loadOptions.checkCRC32&&(this.decompressed=o.transformTo("string",this.decompressed.getContent()),a.crc32(this.decompressed)!==this.crc32))throw new Error("Corrupted zip : CRC32 mismatch")},readCentralPart:function(e){if(this.versionMadeBy=e.readString(2),this.versionNeeded=e.readInt(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4),this.fileNameLength=e.readInt(2),this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");this.fileName=e.readString(this.fileNameLength),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readString(this.fileCommentLength),this.dir=!!(16&this.externalFileAttributes)},parseZIP64ExtraField:function(e){if(this.extraFields[1]){var t=new i(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=t.readInt(4))}},readExtraFields:function(e){var t,n,i,o=e.index;for(this.extraFields=this.extraFields||{};e.index<o+this.extraFieldsLength;)t=e.readInt(2),n=e.readInt(2),i=e.readString(n),this.extraFields[t]={id:t,length:n,value:i}},handleUTF8:function(){if(this.useUTF8())this.fileName=a.utf8decode(this.fileName),this.fileComment=a.utf8decode(this.fileComment);else{var e=this.findExtraFieldUnicodePath();null!==e&&(this.fileName=e);var t=this.findExtraFieldUnicodeComment();null!==t&&(this.fileComment=t)}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=new i(e.value);return 1!==t.readInt(1)||a.crc32(this.fileName)!==t.readInt(4)?null:a.utf8decode(t.readString(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=new i(e.value);return 1!==t.readInt(1)||a.crc32(this.fileComment)!==t.readInt(4)?null:a.utf8decode(t.readString(e.length-5))}return null}},t.exports=s},{"./compressedObject":2,"./object":13,"./stringReader":15,"./utils":21}],24:[function(e,t,n){var i={};(0,e("./lib/utils/common").assign)(i,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=i},{"./lib/deflate":25,"./lib/inflate":26,"./lib/utils/common":27,"./lib/zlib/constants":30}],25:[function(e,t,n){var i=e("./zlib/deflate.js"),o=e("./utils/common"),r=e("./utils/strings"),a=e("./zlib/messages"),s=e("./zlib/zstream"),l=function(e){this.options=o.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var n=i.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==n)throw new Error(a[n]);t.header&&i.deflateSetHeader(this.strm,t.header)};function u(e,t){var n=new l(t);if(n.push(e,!0),n.err)throw n.msg;return n.result}l.prototype.push=function(e,t){var n,a,s=this.strm,l=this.options.chunkSize;if(this.ended)return!1;a=t===~~t?t:!0===t?4:0,s.input="string"==typeof e?r.string2buf(e):e,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new o.Buf8(l),s.next_out=0,s.avail_out=l),1!==(n=i.deflate(s,a))&&0!==n)return this.onEnd(n),this.ended=!0,!1;(0===s.avail_out||0===s.avail_in&&4===a)&&("string"===this.options.to?this.onData(r.buf2binstring(o.shrinkBuf(s.output,s.next_out))):this.onData(o.shrinkBuf(s.output,s.next_out)))}while((s.avail_in>0||0===s.avail_out)&&1!==n);return 4!==a||(n=i.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,0===n)},l.prototype.onData=function(e){this.chunks.push(e)},l.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Deflate=l,n.deflate=u,n.deflateRaw=function(e,t){return(t=t||{}).raw=!0,u(e,t)},n.gzip=function(e,t){return(t=t||{}).gzip=!0,u(e,t)}},{"./utils/common":27,"./utils/strings":28,"./zlib/deflate.js":32,"./zlib/messages":37,"./zlib/zstream":39}],26:[function(e,t,n){var i=e("./zlib/inflate.js"),o=e("./utils/common"),r=e("./utils/strings"),a=e("./zlib/constants"),s=e("./zlib/messages"),l=e("./zlib/zstream"),u=e("./zlib/gzheader"),d=function(e){this.options=o.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var n=i.inflateInit2(this.strm,t.windowBits);if(n!==a.Z_OK)throw new Error(s[n]);this.header=new u,i.inflateGetHeader(this.strm,this.header)};function c(e,t){var n=new d(t);if(n.push(e,!0),n.err)throw n.msg;return n.result}d.prototype.push=function(e,t){var n,s,l,u,d,c=this.strm,f=this.options.chunkSize;if(this.ended)return!1;s=t===~~t?t:!0===t?a.Z_FINISH:a.Z_NO_FLUSH,c.input="string"==typeof e?r.binstring2buf(e):e,c.next_in=0,c.avail_in=c.input.length;do{if(0===c.avail_out&&(c.output=new o.Buf8(f),c.next_out=0,c.avail_out=f),(n=i.inflate(c,a.Z_NO_FLUSH))!==a.Z_STREAM_END&&n!==a.Z_OK)return this.onEnd(n),this.ended=!0,!1;c.next_out&&(0===c.avail_out||n===a.Z_STREAM_END||0===c.avail_in&&s===a.Z_FINISH)&&("string"===this.options.to?(l=r.utf8border(c.output,c.next_out),u=c.next_out-l,d=r.buf2string(c.output,l),c.next_out=u,c.avail_out=f-u,u&&o.arraySet(c.output,c.output,l,u,0),this.onData(d)):this.onData(o.shrinkBuf(c.output,c.next_out)))}while(c.avail_in>0&&n!==a.Z_STREAM_END);return n===a.Z_STREAM_END&&(s=a.Z_FINISH),s!==a.Z_FINISH||(n=i.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===a.Z_OK)},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){e===a.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Inflate=d,n.inflate=c,n.inflateRaw=function(e,t){return(t=t||{}).raw=!0,c(e,t)},n.ungzip=c},{"./utils/common":27,"./utils/strings":28,"./zlib/constants":30,"./zlib/gzheader":33,"./zlib/inflate.js":35,"./zlib/messages":37,"./zlib/zstream":39}],27:[function(e,t,n){var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;n.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])}}return e},n.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var o={arraySet:function(e,t,n,i,o){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+i),o);else for(var r=0;r<i;r++)e[o+r]=t[n+r]},flattenChunks:function(e){var t,n,i,o,r,a;for(i=0,t=0,n=e.length;t<n;t++)i+=e[t].length;for(a=new Uint8Array(i),o=0,t=0,n=e.length;t<n;t++)r=e[t],a.set(r,o),o+=r.length;return a}},r={arraySet:function(e,t,n,i,o){for(var r=0;r<i;r++)e[o+r]=t[n+r]},flattenChunks:function(e){return[].concat.apply([],e)}};n.setTyped=function(e){e?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,o)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,r))},n.setTyped(i)},{}],28:[function(e,t,n){var i=e("./common"),o=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch(e){o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){r=!1}for(var a=new i.Buf8(256),s=0;s<256;s++)a[s]=s>=252?6:s>=248?5:s>=240?4:s>=224?3:s>=192?2:1;function l(e,t){if(t<65537&&(e.subarray&&r||!e.subarray&&o))return String.fromCharCode.apply(null,i.shrinkBuf(e,t));for(var n="",a=0;a<t;a++)n+=String.fromCharCode(e[a]);return n}a[254]=a[254]=1,n.string2buf=function(e){var t,n,o,r,a,s=e.length,l=0;for(r=0;r<s;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<s&&56320==(64512&(o=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(o-56320),r++),l+=n<128?1:n<2048?2:n<65536?3:4;for(t=new i.Buf8(l),a=0,r=0;a<l;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<s&&56320==(64512&(o=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(o-56320),r++),n<128?t[a++]=n:n<2048?(t[a++]=192|n>>>6,t[a++]=128|63&n):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|63&n):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|63&n);return t},n.buf2binstring=function(e){return l(e,e.length)},n.binstring2buf=function(e){for(var t=new i.Buf8(e.length),n=0,o=t.length;n<o;n++)t[n]=e.charCodeAt(n);return t},n.buf2string=function(e,t){var n,i,o,r,s=t||e.length,u=new Array(2*s);for(i=0,n=0;n<s;)if((o=e[n++])<128)u[i++]=o;else if((r=a[o])>4)u[i++]=65533,n+=r-1;else{for(o&=2===r?31:3===r?15:7;r>1&&n<s;)o=o<<6|63&e[n++],r--;r>1?u[i++]=65533:o<65536?u[i++]=o:(o-=65536,u[i++]=55296|o>>10&1023,u[i++]=56320|1023&o)}return l(u,i)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+a[e[n]]>t?n:t}},{"./common":27}],29:[function(e,t,n){t.exports=function(e,t,n,i){for(var o=65535&e|0,r=e>>>16&65535|0,a=0;0!==n;){n-=a=n>2e3?2e3:n;do{r=r+(o=o+t[i++]|0)|0}while(--a);o%=65521,r%=65521}return o|r<<16|0}},{}],30:[function(e,t,n){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],31:[function(e,t,n){var i=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,o){var r=i,a=o+n;e^=-1;for(var s=o;s<a;s++)e=e>>>8^r[255&(e^t[s])];return-1^e}},{}],32:[function(e,t,n){var i=e("../utils/common"),o=e("./trees"),r=e("./adler32"),a=e("./crc32"),s=e("./messages");function l(e,t){return e.msg=s[t],t}function u(e){return(e<<1)-(e>4?9:0)}function d(e){for(var t=e.length;--t>=0;)e[t]=0}function c(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(i.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function f(e,t){o._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,c(e.strm)}function p(e,t){e.pending_buf[e.pending++]=t}function h(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function m(e,t){var n,i,o=e.max_chain_length,r=e.strstart,a=e.prev_length,s=e.nice_match,l=e.strstart>e.w_size-262?e.strstart-(e.w_size-262):0,u=e.window,d=e.w_mask,c=e.prev,f=e.strstart+258,p=u[r+a-1],h=u[r+a];e.prev_length>=e.good_match&&(o>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(n=t)+a]===h&&u[n+a-1]===p&&u[n]===u[r]&&u[++n]===u[r+1]){r+=2,n++;do{}while(u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&r<f);if(i=258-(f-r),r=f-258,i>a){if(e.match_start=t,a=i,i>=s)break;p=u[r+a-1],h=u[r+a]}}}while((t=c[t&d])>l&&0!=--o);return a<=e.lookahead?a:e.lookahead}function g(e){var t,n,o,s,l,u,d,c,f,p,h=e.w_size;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=h+(h-262)){i.arraySet(e.window,e.window,h,h,0),e.match_start-=h,e.strstart-=h,e.block_start-=h,t=n=e.hash_size;do{o=e.head[--t],e.head[t]=o>=h?o-h:0}while(--n);t=n=h;do{o=e.prev[--t],e.prev[t]=o>=h?o-h:0}while(--n);s+=h}if(0===e.strm.avail_in)break;if(u=e.strm,d=e.window,c=e.strstart+e.lookahead,f=s,p=void 0,(p=u.avail_in)>f&&(p=f),n=0===p?0:(u.avail_in-=p,i.arraySet(d,u.input,u.next_in,p,c),1===u.state.wrap?u.adler=r(u.adler,d,p,c):2===u.state.wrap&&(u.adler=a(u.adler,d,p,c)),u.next_in+=p,u.total_in+=p,p),e.lookahead+=n,e.lookahead+e.insert>=3)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+3-1])&e.hash_mask,e.prev[l&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=l,l++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<262&&0!==e.strm.avail_in)}function b(e,t){for(var n,i;;){if(e.lookahead<262){if(g(e),e.lookahead<262&&0===t)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-262&&(e.match_length=m(e,n)),e.match_length>=3)if(i=o._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else i=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(f(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(f(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(f(e,!1),0===e.strm.avail_out)?1:2}function y(e,t){for(var n,i,r;;){if(e.lookahead<262){if(g(e),e.lookahead<262&&0===t)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-262&&(e.match_length=m(e,n),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-3,i=o._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=r&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(f(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((i=o._tr_tally(e,0,e.window[e.strstart-1]))&&f(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=o._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(f(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(f(e,!1),0===e.strm.avail_out)?1:2}var v,S=function(e,t,n,i,o){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=i,this.func=o};function C(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(1146),this.dyn_dtree=new i.Buf16(122),this.bl_tree=new i.Buf16(78),d(this.dyn_ltree),d(this.dyn_dtree),d(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(16),this.heap=new i.Buf16(573),d(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(573),d(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function N(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:113,e.adler=2===t.wrap?0:1,t.last_flush=0,o._tr_init(t),0):l(e,-2)}function x(e){var t,n=N(e);return 0===n&&((t=e.state).window_size=2*t.w_size,d(t.head),t.max_lazy_match=v[t.level].max_lazy,t.good_match=v[t.level].good_length,t.nice_match=v[t.level].nice_length,t.max_chain_length=v[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),n}function w(e,t,n,o,r,a){if(!e)return-2;var s=1;if(-1===t&&(t=6),o<0?(s=0,o=-o):o>15&&(s=2,o-=16),r<1||r>9||8!==n||o<8||o>15||t<0||t>9||a<0||a>4)return l(e,-2);8===o&&(o=9);var u=new C;return e.state=u,u.strm=e,u.wrap=s,u.gzhead=null,u.w_bits=o,u.w_size=1<<u.w_bits,u.w_mask=u.w_size-1,u.hash_bits=r+7,u.hash_size=1<<u.hash_bits,u.hash_mask=u.hash_size-1,u.hash_shift=~~((u.hash_bits+3-1)/3),u.window=new i.Buf8(2*u.w_size),u.head=new i.Buf16(u.hash_size),u.prev=new i.Buf16(u.w_size),u.lit_bufsize=1<<r+6,u.pending_buf_size=4*u.lit_bufsize,u.pending_buf=new i.Buf8(u.pending_buf_size),u.d_buf=u.lit_bufsize>>1,u.l_buf=3*u.lit_bufsize,u.level=t,u.strategy=a,u.method=n,x(e)}v=[new S(0,0,0,0,(function(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(g(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+n;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,f(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-262&&(f(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(f(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(f(e,!1),e.strm.avail_out),1)})),new S(4,4,8,4,b),new S(4,5,16,8,b),new S(4,6,32,32,b),new S(4,4,16,16,y),new S(8,16,32,32,y),new S(8,16,128,128,y),new S(8,32,128,256,y),new S(32,128,258,1024,y),new S(32,258,258,4096,y)],n.deflateInit=function(e,t){return w(e,t,8,15,8,0)},n.deflateInit2=w,n.deflateReset=x,n.deflateResetKeep=N,n.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?-2:(e.state.gzhead=t,0):-2},n.deflate=function(e,t){var n,i,r,s;if(!e||!e.state||t>5||t<0)return e?l(e,-2):-2;if(i=e.state,!e.output||!e.input&&0!==e.avail_in||666===i.status&&4!==t)return l(e,0===e.avail_out?-5:-2);if(i.strm=e,n=i.last_flush,i.last_flush=t,42===i.status)if(2===i.wrap)e.adler=0,p(i,31),p(i,139),p(i,8),i.gzhead?(p(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),p(i,255&i.gzhead.time),p(i,i.gzhead.time>>8&255),p(i,i.gzhead.time>>16&255),p(i,i.gzhead.time>>24&255),p(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),p(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(p(i,255&i.gzhead.extra.length),p(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=a(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(p(i,0),p(i,0),p(i,0),p(i,0),p(i,0),p(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),p(i,3),i.status=113);else{var m=8+(i.w_bits-8<<4)<<8;m|=(i.strategy>=2||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(m|=32),m+=31-m%31,i.status=113,h(i,m),0!==i.strstart&&(h(i,e.adler>>>16),h(i,65535&e.adler)),e.adler=1}if(69===i.status)if(i.gzhead.extra){for(r=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>r&&(e.adler=a(e.adler,i.pending_buf,i.pending-r,r)),c(e),r=i.pending,i.pending!==i.pending_buf_size));)p(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>r&&(e.adler=a(e.adler,i.pending_buf,i.pending-r,r)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){r=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(e.adler=a(e.adler,i.pending_buf,i.pending-r,r)),c(e),r=i.pending,i.pending===i.pending_buf_size)){s=1;break}s=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,p(i,s)}while(0!==s);i.gzhead.hcrc&&i.pending>r&&(e.adler=a(e.adler,i.pending_buf,i.pending-r,r)),0===s&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){r=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(e.adler=a(e.adler,i.pending_buf,i.pending-r,r)),c(e),r=i.pending,i.pending===i.pending_buf_size)){s=1;break}s=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,p(i,s)}while(0!==s);i.gzhead.hcrc&&i.pending>r&&(e.adler=a(e.adler,i.pending_buf,i.pending-r,r)),0===s&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&c(e),i.pending+2<=i.pending_buf_size&&(p(i,255&e.adler),p(i,e.adler>>8&255),e.adler=0,i.status=113)):i.status=113),0!==i.pending){if(c(e),0===e.avail_out)return i.last_flush=-1,0}else if(0===e.avail_in&&u(t)<=u(n)&&4!==t)return l(e,-5);if(666===i.status&&0!==e.avail_in)return l(e,-5);if(0!==e.avail_in||0!==i.lookahead||0!==t&&666!==i.status){var b=2===i.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&(g(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,n=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(f(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(f(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(f(e,!1),0===e.strm.avail_out)?1:2}(i,t):3===i.strategy?function(e,t){for(var n,i,r,a,s=e.window;;){if(e.lookahead<=258){if(g(e),e.lookahead<=258&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=s[r=e.strstart-1])===s[++r]&&i===s[++r]&&i===s[++r]){a=e.strstart+258;do{}while(i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&r<a);e.match_length=258-(a-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=o._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(f(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(f(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(f(e,!1),0===e.strm.avail_out)?1:2}(i,t):v[i.level].func(i,t);if(3!==b&&4!==b||(i.status=666),1===b||3===b)return 0===e.avail_out&&(i.last_flush=-1),0;if(2===b&&(1===t?o._tr_align(i):5!==t&&(o._tr_stored_block(i,0,0,!1),3===t&&(d(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),c(e),0===e.avail_out))return i.last_flush=-1,0}return 4!==t?0:i.wrap<=0?1:(2===i.wrap?(p(i,255&e.adler),p(i,e.adler>>8&255),p(i,e.adler>>16&255),p(i,e.adler>>24&255),p(i,255&e.total_in),p(i,e.total_in>>8&255),p(i,e.total_in>>16&255),p(i,e.total_in>>24&255)):(h(i,e.adler>>>16),h(i,65535&e.adler)),c(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?0:1)},n.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&113!==t&&666!==t?l(e,-2):(e.state=null,113===t?l(e,-3):0):-2},n.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":27,"./adler32":29,"./crc32":31,"./messages":37,"./trees":38}],33:[function(e,t,n){t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],34:[function(e,t,n){t.exports=function(e,t){var n,i,o,r,a,s,l,u,d,c,f,p,h,m,g,b,y,v,S,C,N,x,w,E,T;n=e.state,i=e.next_in,E=e.input,o=i+(e.avail_in-5),r=e.next_out,T=e.output,a=r-(t-e.avail_out),s=r+(e.avail_out-257),l=n.dmax,u=n.wsize,d=n.whave,c=n.wnext,f=n.window,p=n.hold,h=n.bits,m=n.lencode,g=n.distcode,b=(1<<n.lenbits)-1,y=(1<<n.distbits)-1;e:do{h<15&&(p+=E[i++]<<h,h+=8,p+=E[i++]<<h,h+=8),v=m[p&b];t:for(;;){if(p>>>=S=v>>>24,h-=S,0==(S=v>>>16&255))T[r++]=65535&v;else{if(!(16&S)){if(0==(64&S)){v=m[(65535&v)+(p&(1<<S)-1)];continue t}if(32&S){n.mode=12;break e}e.msg="invalid literal/length code",n.mode=30;break e}C=65535&v,(S&=15)&&(h<S&&(p+=E[i++]<<h,h+=8),C+=p&(1<<S)-1,p>>>=S,h-=S),h<15&&(p+=E[i++]<<h,h+=8,p+=E[i++]<<h,h+=8),v=g[p&y];n:for(;;){if(p>>>=S=v>>>24,h-=S,!(16&(S=v>>>16&255))){if(0==(64&S)){v=g[(65535&v)+(p&(1<<S)-1)];continue n}e.msg="invalid distance code",n.mode=30;break e}if(N=65535&v,h<(S&=15)&&(p+=E[i++]<<h,(h+=8)<S&&(p+=E[i++]<<h,h+=8)),(N+=p&(1<<S)-1)>l){e.msg="invalid distance too far back",n.mode=30;break e}if(p>>>=S,h-=S,N>(S=r-a)){if((S=N-S)>d&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(x=0,w=f,0===c){if(x+=u-S,S<C){C-=S;do{T[r++]=f[x++]}while(--S);x=r-N,w=T}}else if(c<S){if(x+=u+c-S,(S-=c)<C){C-=S;do{T[r++]=f[x++]}while(--S);if(x=0,c<C){C-=S=c;do{T[r++]=f[x++]}while(--S);x=r-N,w=T}}}else if(x+=c-S,S<C){C-=S;do{T[r++]=f[x++]}while(--S);x=r-N,w=T}for(;C>2;)T[r++]=w[x++],T[r++]=w[x++],T[r++]=w[x++],C-=3;C&&(T[r++]=w[x++],C>1&&(T[r++]=w[x++]))}else{x=r-N;do{T[r++]=T[x++],T[r++]=T[x++],T[r++]=T[x++],C-=3}while(C>2);C&&(T[r++]=T[x++],C>1&&(T[r++]=T[x++]))}break}}break}}while(i<o&&r<s);i-=C=h>>3,p&=(1<<(h-=C<<3))-1,e.next_in=i,e.next_out=r,e.avail_in=i<o?o-i+5:5-(i-o),e.avail_out=r<s?s-r+257:257-(r-s),n.hold=p,n.bits=h}},{}],35:[function(e,t,n){var i=e("../utils/common"),o=e("./adler32"),r=e("./crc32"),a=e("./inffast"),s=e("./inftrees");function l(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function u(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function d(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new i.Buf32(852),t.distcode=t.distdyn=new i.Buf32(592),t.sane=1,t.back=-1,0):-2}function c(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,d(e)):-2}function f(e,t){var n,i;return e&&e.state?(i=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?-2:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,c(e))):-2}function p(e,t){var n,i;return e?(i=new u,e.state=i,i.window=null,0!==(n=f(e,t))&&(e.state=null),n):-2}var h,m,g=!0;function b(e){if(g){var t;for(h=new i.Buf32(512),m=new i.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(s(1,e.lens,0,288,h,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;s(2,e.lens,0,32,m,0,e.work,{bits:5}),g=!1}e.lencode=h,e.lenbits=9,e.distcode=m,e.distbits=5}n.inflateReset=c,n.inflateReset2=f,n.inflateResetKeep=d,n.inflateInit=function(e){return p(e,15)},n.inflateInit2=p,n.inflate=function(e,t){var n,u,d,c,f,p,h,m,g,y,v,S,C,N,x,w,E,T,O,A,R,_,P,D,k=0,I=new i.Buf8(4),F=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return-2;12===(n=e.state).mode&&(n.mode=13),f=e.next_out,d=e.output,h=e.avail_out,c=e.next_in,u=e.input,p=e.avail_in,m=n.hold,g=n.bits,y=p,v=h,_=0;e:for(;;)switch(n.mode){case 1:if(0===n.wrap){n.mode=13;break}for(;g<16;){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}if(2&n.wrap&&35615===m){n.check=0,I[0]=255&m,I[1]=m>>>8&255,n.check=r(n.check,I,2,0),m=0,g=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&m)<<8)+(m>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&m)){e.msg="unknown compression method",n.mode=30;break}if(g-=4,R=8+(15&(m>>>=4)),0===n.wbits)n.wbits=R;else if(R>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<<R,e.adler=n.check=1,n.mode=512&m?10:12,m=0,g=0;break;case 2:for(;g<16;){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}if(n.flags=m,8!=(255&n.flags)){e.msg="unknown compression method",n.mode=30;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=30;break}n.head&&(n.head.text=m>>8&1),512&n.flags&&(I[0]=255&m,I[1]=m>>>8&255,n.check=r(n.check,I,2,0)),m=0,g=0,n.mode=3;case 3:for(;g<32;){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}n.head&&(n.head.time=m),512&n.flags&&(I[0]=255&m,I[1]=m>>>8&255,I[2]=m>>>16&255,I[3]=m>>>24&255,n.check=r(n.check,I,4,0)),m=0,g=0,n.mode=4;case 4:for(;g<16;){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}n.head&&(n.head.xflags=255&m,n.head.os=m>>8),512&n.flags&&(I[0]=255&m,I[1]=m>>>8&255,n.check=r(n.check,I,2,0)),m=0,g=0,n.mode=5;case 5:if(1024&n.flags){for(;g<16;){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}n.length=m,n.head&&(n.head.extra_len=m),512&n.flags&&(I[0]=255&m,I[1]=m>>>8&255,n.check=r(n.check,I,2,0)),m=0,g=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((S=n.length)>p&&(S=p),S&&(n.head&&(R=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),i.arraySet(n.head.extra,u,c,S,R)),512&n.flags&&(n.check=r(n.check,u,S,c)),p-=S,c+=S,n.length-=S),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===p)break e;S=0;do{R=u[c+S++],n.head&&R&&n.length<65536&&(n.head.name+=String.fromCharCode(R))}while(R&&S<p);if(512&n.flags&&(n.check=r(n.check,u,S,c)),p-=S,c+=S,R)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===p)break e;S=0;do{R=u[c+S++],n.head&&R&&n.length<65536&&(n.head.comment+=String.fromCharCode(R))}while(R&&S<p);if(512&n.flags&&(n.check=r(n.check,u,S,c)),p-=S,c+=S,R)break e}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;g<16;){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}if(m!==(65535&n.check)){e.msg="header crc mismatch",n.mode=30;break}m=0,g=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;g<32;){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}e.adler=n.check=l(m),m=0,g=0,n.mode=11;case 11:if(0===n.havedict)return e.next_out=f,e.avail_out=h,e.next_in=c,e.avail_in=p,n.hold=m,n.bits=g,2;e.adler=n.check=1,n.mode=12;case 12:if(5===t||6===t)break e;case 13:if(n.last){m>>>=7&g,g-=7&g,n.mode=27;break}for(;g<3;){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}switch(n.last=1&m,g-=1,3&(m>>>=1)){case 0:n.mode=14;break;case 1:if(b(n),n.mode=20,6===t){m>>>=2,g-=2;break e}break;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}m>>>=2,g-=2;break;case 14:for(m>>>=7&g,g-=7&g;g<32;){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}if((65535&m)!=(m>>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&m,m=0,g=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(S=n.length){if(S>p&&(S=p),S>h&&(S=h),0===S)break e;i.arraySet(d,u,c,S,f),p-=S,c+=S,h-=S,f+=S,n.length-=S;break}n.mode=12;break;case 17:for(;g<14;){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}if(n.nlen=257+(31&m),m>>>=5,g-=5,n.ndist=1+(31&m),m>>>=5,g-=5,n.ncode=4+(15&m),m>>>=4,g-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=30;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;g<3;){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}n.lens[F[n.have++]]=7&m,m>>>=3,g-=3}for(;n.have<19;)n.lens[F[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,P={bits:n.lenbits},_=s(0,n.lens,0,19,n.lencode,0,n.work,P),n.lenbits=P.bits,_){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;w=(k=n.lencode[m&(1<<n.lenbits)-1])>>>16&255,E=65535&k,!((x=k>>>24)<=g);){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}if(E<16)m>>>=x,g-=x,n.lens[n.have++]=E;else{if(16===E){for(D=x+2;g<D;){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}if(m>>>=x,g-=x,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}R=n.lens[n.have-1],S=3+(3&m),m>>>=2,g-=2}else if(17===E){for(D=x+3;g<D;){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}g-=x,R=0,S=3+(7&(m>>>=x)),m>>>=3,g-=3}else{for(D=x+7;g<D;){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}g-=x,R=0,S=11+(127&(m>>>=x)),m>>>=7,g-=7}if(n.have+S>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;S--;)n.lens[n.have++]=R}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,P={bits:n.lenbits},_=s(1,n.lens,0,n.nlen,n.lencode,0,n.work,P),n.lenbits=P.bits,_){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,P={bits:n.distbits},_=s(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,P),n.distbits=P.bits,_){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(p>=6&&h>=258){e.next_out=f,e.avail_out=h,e.next_in=c,e.avail_in=p,n.hold=m,n.bits=g,a(e,v),f=e.next_out,d=e.output,h=e.avail_out,c=e.next_in,u=e.input,p=e.avail_in,m=n.hold,g=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;w=(k=n.lencode[m&(1<<n.lenbits)-1])>>>16&255,E=65535&k,!((x=k>>>24)<=g);){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}if(w&&0==(240&w)){for(T=x,O=w,A=E;w=(k=n.lencode[A+((m&(1<<T+O)-1)>>T)])>>>16&255,E=65535&k,!(T+(x=k>>>24)<=g);){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}m>>>=T,g-=T,n.back+=T}if(m>>>=x,g-=x,n.back+=x,n.length=E,0===w){n.mode=26;break}if(32&w){n.back=-1,n.mode=12;break}if(64&w){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&w,n.mode=22;case 22:if(n.extra){for(D=n.extra;g<D;){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}n.length+=m&(1<<n.extra)-1,m>>>=n.extra,g-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;w=(k=n.distcode[m&(1<<n.distbits)-1])>>>16&255,E=65535&k,!((x=k>>>24)<=g);){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}if(0==(240&w)){for(T=x,O=w,A=E;w=(k=n.distcode[A+((m&(1<<T+O)-1)>>T)])>>>16&255,E=65535&k,!(T+(x=k>>>24)<=g);){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}m>>>=T,g-=T,n.back+=T}if(m>>>=x,g-=x,n.back+=x,64&w){e.msg="invalid distance code",n.mode=30;break}n.offset=E,n.extra=15&w,n.mode=24;case 24:if(n.extra){for(D=n.extra;g<D;){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}n.offset+=m&(1<<n.extra)-1,m>>>=n.extra,g-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===h)break e;if(S=v-h,n.offset>S){if((S=n.offset-S)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}S>n.wnext?(S-=n.wnext,C=n.wsize-S):C=n.wnext-S,S>n.length&&(S=n.length),N=n.window}else N=d,C=f-n.offset,S=n.length;S>h&&(S=h),h-=S,n.length-=S;do{d[f++]=N[C++]}while(--S);0===n.length&&(n.mode=21);break;case 26:if(0===h)break e;d[f++]=n.length,h--,n.mode=21;break;case 27:if(n.wrap){for(;g<32;){if(0===p)break e;p--,m|=u[c++]<<g,g+=8}if(v-=h,e.total_out+=v,n.total+=v,v&&(e.adler=n.check=n.flags?r(n.check,d,v,f-v):o(n.check,d,v,f-v)),v=h,(n.flags?m:l(m))!==n.check){e.msg="incorrect data check",n.mode=30;break}m=0,g=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;g<32;){if(0===p)break e;p--,m+=u[c++]<<g,g+=8}if(m!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=30;break}m=0,g=0}n.mode=29;case 29:_=1;break e;case 30:_=-3;break e;case 31:return-4;case 32:default:return-2}return e.next_out=f,e.avail_out=h,e.next_in=c,e.avail_in=p,n.hold=m,n.bits=g,(n.wsize||v!==e.avail_out&&n.mode<30&&(n.mode<27||4!==t))&&function(e,t,n,o){var r,a=e.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new i.Buf8(a.wsize)),o>=a.wsize?(i.arraySet(a.window,t,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):((r=a.wsize-a.wnext)>o&&(r=o),i.arraySet(a.window,t,n-o,r,a.wnext),(o-=r)?(i.arraySet(a.window,t,n-o,o,0),a.wnext=o,a.whave=a.wsize):(a.wnext+=r,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=r))),0}(e,e.output,e.next_out,v-e.avail_out)?(n.mode=31,-4):(y-=e.avail_in,v-=e.avail_out,e.total_in+=y,e.total_out+=v,n.total+=v,n.wrap&&v&&(e.adler=n.check=n.flags?r(n.check,d,v,e.next_out-v):o(n.check,d,v,e.next_out-v)),e.data_type=n.bits+(n.last?64:0)+(12===n.mode?128:0)+(20===n.mode||15===n.mode?256:0),(0===y&&0===v||4===t)&&0===_&&(_=-5),_)},n.inflateEnd=function(e){if(!e||!e.state)return-2;var t=e.state;return t.window&&(t.window=null),e.state=null,0},n.inflateGetHeader=function(e,t){var n;return e&&e.state?0==(2&(n=e.state).wrap)?-2:(n.head=t,t.done=!1,0):-2},n.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":27,"./adler32":29,"./crc32":31,"./inffast":34,"./inftrees":36}],36:[function(e,t,n){var i=e("../utils/common"),o=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],r=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],a=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],s=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,n,l,u,d,c,f){var p,h,m,g,b,y,v,S,C,N=f.bits,x=0,w=0,E=0,T=0,O=0,A=0,R=0,_=0,P=0,D=0,k=null,I=0,F=new i.Buf16(16),M=new i.Buf16(16),B=null,U=0;for(x=0;x<=15;x++)F[x]=0;for(w=0;w<l;w++)F[t[n+w]]++;for(O=N,T=15;T>=1&&0===F[T];T--);if(O>T&&(O=T),0===T)return u[d++]=20971520,u[d++]=20971520,f.bits=1,0;for(E=1;E<T&&0===F[E];E++);for(O<E&&(O=E),_=1,x=1;x<=15;x++)if(_<<=1,(_-=F[x])<0)return-1;if(_>0&&(0===e||1!==T))return-1;for(M[1]=0,x=1;x<15;x++)M[x+1]=M[x]+F[x];for(w=0;w<l;w++)0!==t[n+w]&&(c[M[t[n+w]]++]=w);if(0===e?(k=B=c,y=19):1===e?(k=o,I-=257,B=r,U-=257,y=256):(k=a,B=s,y=-1),D=0,w=0,x=E,b=d,A=O,R=0,m=-1,g=(P=1<<O)-1,1===e&&P>852||2===e&&P>592)return 1;for(;;){v=x-R,c[w]<y?(S=0,C=c[w]):c[w]>y?(S=B[U+c[w]],C=k[I+c[w]]):(S=96,C=0),p=1<<x-R,E=h=1<<A;do{u[b+(D>>R)+(h-=p)]=v<<24|S<<16|C|0}while(0!==h);for(p=1<<x-1;D&p;)p>>=1;if(0!==p?(D&=p-1,D+=p):D=0,w++,0==--F[x]){if(x===T)break;x=t[n+c[w]]}if(x>O&&(D&g)!==m){for(0===R&&(R=O),b+=E,_=1<<(A=x-R);A+R<T&&!((_-=F[A+R])<=0);)A++,_<<=1;if(P+=1<<A,1===e&&P>852||2===e&&P>592)return 1;u[m=D&g]=O<<24|A<<16|b-d|0}}return 0!==D&&(u[b+D]=x-R<<24|64<<16|0),f.bits=O,0}},{"../utils/common":27}],37:[function(e,t,n){t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],38:[function(e,t,n){var i=e("../utils/common");function o(e){for(var t=e.length;--t>=0;)e[t]=0}var r=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],a=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],l=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],u=new Array(576);o(u);var d=new Array(60);o(d);var c=new Array(512);o(c);var f=new Array(256);o(f);var p=new Array(29);o(p);var h=new Array(30);o(h);var m,g,b,y=function(e,t,n,i,o){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=i,this.max_length=o,this.has_stree=e&&e.length},v=function(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t};function S(e){return e<256?c[e]:c[256+(e>>>7)]}function C(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function N(e,t,n){e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,C(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function x(e,t,n){N(e,n[2*t],n[2*t+1])}function w(e,t){var n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1}function E(e,t,n){var i,o,r=new Array(16),a=0;for(i=1;i<=15;i++)r[i]=a=a+n[i-1]<<1;for(o=0;o<=t;o++){var s=e[2*o+1];0!==s&&(e[2*o]=w(r[s]++,s))}}function T(e){var t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function O(e){e.bi_valid>8?C(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function A(e,t,n,i){var o=2*t,r=2*n;return e[o]<e[r]||e[o]===e[r]&&i[t]<=i[n]}function R(e,t,n){for(var i=e.heap[n],o=n<<1;o<=e.heap_len&&(o<e.heap_len&&A(t,e.heap[o+1],e.heap[o],e.depth)&&o++,!A(t,i,e.heap[o],e.depth));)e.heap[n]=e.heap[o],n=o,o<<=1;e.heap[n]=i}function _(e,t,n){var i,o,s,l,u=0;if(0!==e.last_lit)do{i=e.pending_buf[e.d_buf+2*u]<<8|e.pending_buf[e.d_buf+2*u+1],o=e.pending_buf[e.l_buf+u],u++,0===i?x(e,o,t):(x(e,(s=f[o])+256+1,t),0!==(l=r[s])&&N(e,o-=p[s],l),x(e,s=S(--i),n),0!==(l=a[s])&&N(e,i-=h[s],l))}while(u<e.last_lit);x(e,256,t)}function P(e,t){var n,i,o,r=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,l=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=573,n=0;n<l;n++)0!==r[2*n]?(e.heap[++e.heap_len]=u=n,e.depth[n]=0):r[2*n+1]=0;for(;e.heap_len<2;)r[2*(o=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[o]=0,e.opt_len--,s&&(e.static_len-=a[2*o+1]);for(t.max_code=u,n=e.heap_len>>1;n>=1;n--)R(e,r,n);o=l;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],R(e,r,1),i=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=i,r[2*o]=r[2*n]+r[2*i],e.depth[o]=(e.depth[n]>=e.depth[i]?e.depth[n]:e.depth[i])+1,r[2*n+1]=r[2*i+1]=o,e.heap[1]=o++,R(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,i,o,r,a,s,l=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,c=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,h=t.stat_desc.max_length,m=0;for(r=0;r<=15;r++)e.bl_count[r]=0;for(l[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n<573;n++)(r=l[2*l[2*(i=e.heap[n])+1]+1]+1)>h&&(r=h,m++),l[2*i+1]=r,i>u||(e.bl_count[r]++,a=0,i>=p&&(a=f[i-p]),s=l[2*i],e.opt_len+=s*(r+a),c&&(e.static_len+=s*(d[2*i+1]+a)));if(0!==m){do{for(r=h-1;0===e.bl_count[r];)r--;e.bl_count[r]--,e.bl_count[r+1]+=2,e.bl_count[h]--,m-=2}while(m>0);for(r=h;0!==r;r--)for(i=e.bl_count[r];0!==i;)(o=e.heap[--n])>u||(l[2*o+1]!==r&&(e.opt_len+=(r-l[2*o+1])*l[2*o],l[2*o+1]=r),i--)}}(e,t),E(r,u,e.bl_count)}function D(e,t,n){var i,o,r=-1,a=t[1],s=0,l=7,u=4;for(0===a&&(l=138,u=3),t[2*(n+1)+1]=65535,i=0;i<=n;i++)o=a,a=t[2*(i+1)+1],++s<l&&o===a||(s<u?e.bl_tree[2*o]+=s:0!==o?(o!==r&&e.bl_tree[2*o]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,r=o,0===a?(l=138,u=3):o===a?(l=6,u=3):(l=7,u=4))}function k(e,t,n){var i,o,r=-1,a=t[1],s=0,l=7,u=4;for(0===a&&(l=138,u=3),i=0;i<=n;i++)if(o=a,a=t[2*(i+1)+1],!(++s<l&&o===a)){if(s<u)do{x(e,o,e.bl_tree)}while(0!=--s);else 0!==o?(o!==r&&(x(e,o,e.bl_tree),s--),x(e,16,e.bl_tree),N(e,s-3,2)):s<=10?(x(e,17,e.bl_tree),N(e,s-3,3)):(x(e,18,e.bl_tree),N(e,s-11,7));s=0,r=o,0===a?(l=138,u=3):o===a?(l=6,u=3):(l=7,u=4)}}var I=!1;function F(e,t,n,o){N(e,0+(o?1:0),3),function(e,t,n,o){O(e),C(e,n),C(e,~n),i.arraySet(e.pending_buf,e.window,t,n,e.pending),e.pending+=n}(e,t,n)}n._tr_init=function(e){I||(function(){var e,t,n,i,o,l=new Array(16);for(n=0,i=0;i<28;i++)for(p[i]=n,e=0;e<1<<r[i];e++)f[n++]=i;for(f[n-1]=i,o=0,i=0;i<16;i++)for(h[i]=o,e=0;e<1<<a[i];e++)c[o++]=i;for(o>>=7;i<30;i++)for(h[i]=o<<7,e=0;e<1<<a[i]-7;e++)c[256+o++]=i;for(t=0;t<=15;t++)l[t]=0;for(e=0;e<=143;)u[2*e+1]=8,e++,l[8]++;for(;e<=255;)u[2*e+1]=9,e++,l[9]++;for(;e<=279;)u[2*e+1]=7,e++,l[7]++;for(;e<=287;)u[2*e+1]=8,e++,l[8]++;for(E(u,287,l),e=0;e<30;e++)d[2*e+1]=5,d[2*e]=w(e,5);m=new y(u,r,257,286,15),g=new y(d,a,0,30,15),b=new y(new Array(0),s,0,19,7)}(),I=!0),e.l_desc=new v(e.dyn_ltree,m),e.d_desc=new v(e.dyn_dtree,g),e.bl_desc=new v(e.bl_tree,b),e.bi_buf=0,e.bi_valid=0,T(e)},n._tr_stored_block=F,n._tr_flush_block=function(e,t,n,i){var o,r,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),P(e,e.l_desc),P(e,e.d_desc),a=function(e){var t;for(D(e,e.dyn_ltree,e.l_desc.max_code),D(e,e.dyn_dtree,e.d_desc.max_code),P(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*l[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),o=e.opt_len+3+7>>>3,(r=e.static_len+3+7>>>3)<=o&&(o=r)):o=r=n+5,n+4<=o&&-1!==t?F(e,t,n,i):4===e.strategy||r===o?(N(e,2+(i?1:0),3),_(e,u,d)):(N(e,4+(i?1:0),3),function(e,t,n,i){var o;for(N(e,t-257,5),N(e,n-1,5),N(e,i-4,4),o=0;o<i;o++)N(e,e.bl_tree[2*l[o]+1],3);k(e,e.dyn_ltree,t-1),k(e,e.dyn_dtree,n-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),_(e,e.dyn_ltree,e.dyn_dtree)),T(e),i&&O(e)},n._tr_tally=function(e,t,n){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(f[n]+256+1)]++,e.dyn_dtree[2*S(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){N(e,2,3),x(e,256,u),function(e){16===e.bi_valid?(C(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":27}],39:[function(e,t,n){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}]},{},[9])(9),
/**
* Copyright (C) 2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
* This file is part of WebODF.
*
* WebODF is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License (GNU AGPL)
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* WebODF is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with WebODF. If not, see <http://www.gnu.org/licenses/>.
* @licend
*
* @source: http://www.webodf.org/
* @source: https://github.com/kogmbh/WebODF/
*/
this.OS.application.OpenPage.EditorSession=function(e){"use strict";runtime.loadClass("core.Async"),runtime.loadClass("core.DomUtils"),runtime.loadClass("odf.OdfUtils"),runtime.loadClass("ops.OdtDocument"),runtime.loadClass("ops.OdtStepsTranslator"),runtime.loadClass("ops.Session"),runtime.loadClass("odf.Namespaces"),runtime.loadClass("odf.OdfCanvas"),runtime.loadClass("odf.OdfUtils"),runtime.loadClass("gui.CaretManager"),runtime.loadClass("gui.Caret"),runtime.loadClass("gui.OdfFieldView"),runtime.loadClass("gui.SessionController"),runtime.loadClass("gui.SessionView"),runtime.loadClass("gui.HyperlinkTooltipView"),runtime.loadClass("gui.TrivialUndoManager"),runtime.loadClass("gui.SvgSelectionView"),runtime.loadClass("gui.SelectionViewManager"),runtime.loadClass("core.EventNotifier"),runtime.loadClass("gui.ShadowCursor"),runtime.loadClass("gui.CommonConstraints");var t=function e(t,n,i){var o,r,a,s,l,u,d,c,f=this,p=null,h=null,m=null,g=t.getOdtDocument(),b=odf.Namespaces.textns,y=document.createElement("style"),v=g.getFormatting(),S=core.DomUtils,C=odf.OdfUtils,N=new core.EventNotifier([e.signalMemberAdded,e.signalMemberUpdated,e.signalMemberRemoved,e.signalCursorAdded,e.signalCursorMoved,e.signalCursorRemoved,e.signalParagraphChanged,e.signalCommonStyleCreated,e.signalCommonStyleDeleted,e.signalParagraphStyleModified,e.signalUndoStackChanged]),x=new gui.ShadowCursor(g),w=core.StepDirection.NEXT;function E(){var t,n;if((t=p.getAttributeNS(b,"style-name"))!==m){if(m=t,!(n=v.getFirstCommonParentStyleNameOrSelf(t)))return h=t=m="",void f.emit(e.signalParagraphChanged,{type:"style",node:p,styleName:h});n!==h&&(h=n,f.emit(e.signalParagraphChanged,{type:"style",node:p,styleName:h}))}}function T(e){var t,n,i="";for(n=0;n<e.length;n+=1)null!==(t=e[n]).match(/[a-zA-Z0-9.-_]/)?i+=t:i+="_"+t.charCodeAt(0).toString(16)+"_";return null===i.match(/^[a-zA-Z_]/)&&(i="_"+i),i}function O(e){var t;(t=C.getParagraphElement(e.getNode()))&&(p=t,E())}function A(t){var i=g.getCursor(n),o=i&&i.getSelectedRange(),r=g.getDOMDocument().createRange();r.selectNode(t.paragraphElement),(o&&S.rangesIntersect(o,r)||t.paragraphElement===p)&&(f.emit(e.signalParagraphChanged,t),E()),r.detach()}function R(t){f.emit(e.signalMemberAdded,t.getMemberId())}function _(t){f.emit(e.signalMemberUpdated,t.getMemberId())}function P(t){f.emit(e.signalMemberRemoved,t)}function D(t){f.emit(e.signalCursorAdded,t.getMemberId()),O(t)}function k(t){f.emit(e.signalCursorRemoved,t)}function I(t){t.getMemberId()===n&&(f.emit(e.signalCursorMoved,t),O(t))}function F(t){f.emit(e.signalCommonStyleCreated,t)}function M(t){f.emit(e.signalCommonStyleDeleted,t)}function B(t){f.emit(e.signalParagraphStyleModified,t)}function U(e){return""===e?v.getDefaultStyleElement("paragraph"):v.getStyleElement(e,"paragraph")}function L(t){f.emit(e.signalUndoStackChanged,t)}function z(e){var t=document.getElementsByTagName("head")[0],n=f.sessionController.getEventManager();t.removeChild(y),g.unsubscribe(ops.Document.signalMemberAdded,R),g.unsubscribe(ops.Document.signalMemberUpdated,_),g.unsubscribe(ops.Document.signalMemberRemoved,P),g.unsubscribe(ops.Document.signalCursorAdded,D),g.unsubscribe(ops.Document.signalCursorRemoved,k),g.unsubscribe(ops.Document.signalCursorMoved,I),g.unsubscribe(ops.OdtDocument.signalCommonStyleCreated,F),g.unsubscribe(ops.OdtDocument.signalCommonStyleDeleted,M),g.unsubscribe(ops.OdtDocument.signalParagraphStyleModified,B),g.unsubscribe(ops.OdtDocument.signalParagraphChanged,A),g.unsubscribe(ops.OdtDocument.signalUndoStackChanged,L),n.unsubscribe("mousemove",a.showTooltip),n.unsubscribe("mouseout",a.hideTooltip),delete f.sessionView,delete f.sessionController,e()}this.emit=function(e,t){N.emit(e,t)},this.subscribe=function(e,t){N.subscribe(e,t)},this.unsubscribe=function(e,t){N.unsubscribe(e,t)},this.getCursorPosition=function(){return g.getCursorPosition(n)},this.getCursorSelection=function(){return g.getCursorSelection(n)},this.getOdfCanvas=function(){return g.getOdfCanvas()},this.getCurrentParagraph=function(){return p},this.getAvailableParagraphStyles=function(){return v.getAvailableParagraphStyles()},this.getCurrentParagraphStyle=function(){return h},this.setCurrentParagraphStyle=function(e){var i=g.getCursor(n).getSelectedRange(),o=C.getParagraphElements(i),r=[];o.forEach((function(t){var i,o=g.convertDomPointToCursorStep(t,0,w);t.getAttributeNS(odf.Namespaces.textns,"style-name")!==e&&((i=new ops.OpSetParagraphStyle).init({memberid:n,styleName:e,position:o}),r.push(i))})),r.length>0&&t.enqueue(r)},this.insertTable=function(e,i,o,r,a){var s=new ops.OpInsertTable;s.init({memberid:n,position:f.getCursorPosition(),initialRows:e,initialColumns:i,tableStyleName:o,tableColumnStyleName:r,tableCellStyleMatrix:a}),t.enqueue([s])},this.getParagraphStyleElement=U,this.isStyleUsed=function(e){return v.isStyleUsed(e)},this.getParagraphStyleAttributes=function(e){var t=U(e),n=""===e;return t?v.getInheritedStyleAttributes(t,n):null},this.updateParagraphStyle=function(e,i,o){var r;(r=new ops.OpUpdateParagraphStyle).init({memberid:n,styleName:e,setProperties:i,removedProperties:o||{}}),t.enqueue([r])},this.cloneParagraphStyle=function(e,i){var o,r,a,s,l=function(e){var t,i=0,o=T(n),r=T(e);for(t=r+"_"+o;v.hasParagraphStyle(t);)t=r+"_"+i+"_"+o,i+=1;return t}(i),u=U(e);for(r=v.getStyleAttributes(u),a=u.attributes,s=0;s<a.length;s+=1)/^(style:display-name|style:name|style:family)/.test(a[s].name)||(r[a[s].name]=a[s].value);return r["style:display-name"]=i,(o=new ops.OpAddStyle).init({memberid:n,styleName:l,styleFamily:"paragraph",setProperties:r}),t.enqueue([o]),l},this.deleteStyle=function(e){var i;(i=new ops.OpRemoveStyle).init({memberid:n,styleName:e,styleFamily:"paragraph"}),t.enqueue([i])},this.getDeclaredFonts=function(){var e,t,n,i,o=v.getFontMap(),r=[],a=[];for((e=Object.keys(o)).sort(),i=0;i<e.length;i+=1)n=o[t=e[i]],-1===r.indexOf(n)&&(a.push({name:t,family:n}),n&&r.push(n));return a},this.getSelectedHyperlinks=function(){var e=g.getCursor(n);return e?C.getHyperlinkElements(e.getSelectedRange()):[]},this.getSelectedRange=function(){var e=g.getCursor(n);return e&&e.getSelectedRange()},this.undo=function(){f.sessionController.undo()},this.redo=function(){f.sessionController.redo()},this.getMember=function(e){return g.getMember(e)},this.destroy=function(e){var t=[f.sessionView.destroy,o.destroy,r.destroy,f.sessionController.destroy,a.destroy,s.destroy,z];core.Async.destroyAll(t,e)},d=document.getElementsByTagName("head")[0],c=t.getOdtDocument().getOdfCanvas(),y.type="text/css",y.media="screen, print, handheld, projection",y.appendChild(document.createTextNode("")),d.appendChild(y),(s=new gui.OdfFieldView(c)).showFieldHighlight(),f.sessionController=new gui.SessionController(t,n,x,{annotationsEnabled:i.annotationsEnabled,directTextStylingEnabled:i.directTextStylingEnabled,directParagraphStylingEnabled:i.directParagraphStylingEnabled}),l=f.sessionController.getSessionConstraints(),u=f.sessionController.getEventManager(),a=new gui.HyperlinkTooltipView(c,f.sessionController.getHyperlinkClickHandler().getModifier),u.subscribe("mousemove",a.showTooltip),u.subscribe("mouseout",a.hideTooltip),o=new gui.CaretManager(f.sessionController,c.getViewport()),r=new gui.SelectionViewManager(gui.SvgSelectionView),f.sessionView=new gui.SessionView(i.viewOptions,n,t,l,o,r),f.availableFonts=function(){var e,t,n;for(e={},n=(t=/font-family *: *(?:\'([^']*)\'|\"([^"]*)\")/gm).exec("");n;)e[n[1]||n[2]]=1,n=t.exec("");return Object.keys(e)}(),r.registerCursor(x,!0),i.reviewModeEnabled&&(l.setState(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN,!0),l.setState(gui.CommonConstraints.EDIT.REVIEW_MODE,!0)),g.subscribe(ops.Document.signalMemberAdded,R),g.subscribe(ops.Document.signalMemberUpdated,_),g.subscribe(ops.Document.signalMemberRemoved,P),g.subscribe(ops.Document.signalCursorAdded,D),g.subscribe(ops.Document.signalCursorRemoved,k),g.subscribe(ops.Document.signalCursorMoved,I),g.subscribe(ops.OdtDocument.signalCommonStyleCreated,F),g.subscribe(ops.OdtDocument.signalCommonStyleDeleted,M),g.subscribe(ops.OdtDocument.signalParagraphStyleModified,B),g.subscribe(ops.OdtDocument.signalParagraphChanged,A),g.subscribe(ops.OdtDocument.signalUndoStackChanged,L)};return t.signalMemberAdded="memberAdded",t.signalMemberUpdated="memberUpdated",t.signalMemberRemoved="memberRemoved",t.signalCursorAdded="cursorAdded",t.signalCursorRemoved="cursorRemoved",t.signalCursorMoved="cursorMoved",t.signalParagraphChanged="paragraphChanged",t.signalCommonStyleCreated="styleCreated",t.signalCommonStyleDeleted="styleDeleted",t.signalParagraphStyleModified="paragraphStyleModified",t.signalUndoStackChanged="signalUndoStackChanged",t}();