/* This is a generated file. DO NOT EDIT. Copyright (C) 2010-2014 KO GmbH @licstart This file is the compiled version of the WebODF library. 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 . @licend @source: http://www.webodf.org/ @source: https://github.com/kogmbh/WebODF/ */ var webodf_version="0.5.1";function Runtime(){}Runtime.prototype.getVariable=function(f){};Runtime.prototype.toJson=function(f){};Runtime.prototype.fromJson=function(f){};Runtime.prototype.byteArrayFromString=function(f,k){};Runtime.prototype.byteArrayToString=function(f,k){};Runtime.prototype.read=function(f,k,c,b){};Runtime.prototype.readFile=function(f,k,c){};Runtime.prototype.readFileSync=function(f,k){};Runtime.prototype.loadXML=function(f,k){};Runtime.prototype.writeFile=function(f,k,c){}; Runtime.prototype.isFile=function(f,k){};Runtime.prototype.getFileSize=function(f,k){};Runtime.prototype.deleteFile=function(f,k){};Runtime.prototype.log=function(f,k){};Runtime.prototype.setTimeout=function(f,k){};Runtime.prototype.clearTimeout=function(f){};Runtime.prototype.libraryPaths=function(){};Runtime.prototype.currentDirectory=function(){};Runtime.prototype.setCurrentDirectory=function(f){};Runtime.prototype.type=function(){};Runtime.prototype.getDOMImplementation=function(){}; Runtime.prototype.parseXML=function(f){};Runtime.prototype.exit=function(f){};Runtime.prototype.getWindow=function(){};Runtime.prototype.requestAnimationFrame=function(f){};Runtime.prototype.cancelAnimationFrame=function(f){};Runtime.prototype.assert=function(f,k,c){};var IS_COMPILED_CODE=!0; Runtime.byteArrayToString=function(f,k){function c(b){var c="",n,e=b.length;for(n=0;nr?l.push(r):(n+=1,d=b[n],194<=r&&224>r?l.push((r&31)<<6|d&63):(n+=1,a=b[n],224<=r&&240>r?l.push((r&15)<<12|(d&63)<<6|a&63):(n+=1,m=b[n],240<=r&&245>r&&(r=(r&7)<<18|(d&63)<<12|(a&63)<<6|m&63,r-=65536,l.push((r>>10)+55296,(r&1023)+56320))))),1E3<=l.length&&(c+=String.fromCharCode.apply(null, l),l.length=0);return c+String.fromCharCode.apply(null,l)}var e;"utf8"===k?e=b(f):("binary"!==k&&this.log("Unsupported encoding: "+k),e=c(f));return e};Runtime.getVariable=function(f){try{return eval(f)}catch(k){}};Runtime.toJson=function(f){return JSON.stringify(f)};Runtime.fromJson=function(f){return JSON.parse(f)};Runtime.getFunctionName=function(f){return void 0===f.name?(f=/function\s+(\w+)/.exec(f))&&f[1]:f.name}; function BrowserRuntime(f){function k(b){var d=b.length,a,m,g=0;for(a=0;am&&(g+=1,a+=1);return g}function c(b,d,a){var m=b.length,g,c;d=new Uint8Array(new ArrayBuffer(d));a?(d[0]=239,d[1]=187,d[2]=191,c=3):c=0;for(a=0;ag?(d[c]=g,c+=1):2048>g?(d[c]=192|g>>>6,d[c+1]=128|g&63,c+=2):55040>=g||57344<=g?(d[c]=224|g>>>12&15,d[c+1]=128|g>>>6&63,d[c+2]=128|g&63,c+=3):(a+=1,g=(g-55296<<10|b.charCodeAt(a)-56320)+65536, d[c]=240|g>>>18&7,d[c+1]=128|g>>>12&63,d[c+2]=128|g>>>6&63,d[c+3]=128|g&63,c+=4);return d}function b(b){var d=b.length,a=new Uint8Array(new ArrayBuffer(d)),m;for(m=0;mm.status||0===m.status?a(null):a("Status "+String(m.status)+": "+m.responseText||m.statusText):a("File "+b+" is empty."))};g=d.buffer&&!m.sendAsBinary?d.buffer:s.byteArrayToString(d,"binary");try{m.sendAsBinary?m.sendAsBinary(g):m.send(g)}catch(c){s.log("HUH? "+c+" "+d),a(c.message)}};this.deleteFile=function(b,d){delete l[b];var a=new XMLHttpRequest;a.open("DELETE",b,!0);a.onreadystatechange= function(){4===a.readyState&&(200>a.status&&300<=a.status?d(a.responseText):d(null))};a.send(null)};this.loadXML=function(b,d){var a=new XMLHttpRequest;a.open("GET",b,!0);a.overrideMimeType&&a.overrideMimeType("text/xml");a.onreadystatechange=function(){4===a.readyState&&(0!==a.status||a.responseText?200===a.status||0===a.status?d(null,a.responseXML):d(a.responseText,null):d("File "+b+" is empty.",null))};try{a.send(null)}catch(m){d(m.message,null)}};this.isFile=function(b,d){s.getFileSize(b,function(a){d(-1!== a)})};this.getFileSize=function(b,d){if(l.hasOwnProperty(b)&&"string"!==typeof l[b])d(l[b].length);else{var a=new XMLHttpRequest;a.open("HEAD",b,!0);a.onreadystatechange=function(){if(4===a.readyState){var m=a.getResponseHeader("Content-Length");m?d(parseInt(m,10)):n(b,"binary",function(a,m){a?d(-1):d(m.length)})}};a.send(null)}};this.log=e;this.assert=function(b,d,a){if(!b)throw e("alert","ASSERTION FAILED:\n"+d),a&&a(),d;};this.setTimeout=function(b,d){return setTimeout(function(){b()},d)};this.clearTimeout= function(b){clearTimeout(b)};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(b){return(new DOMParser).parseFromString(b,"text/xml")};this.exit=function(b){e("Calling exit with code "+String(b)+", but exit() is not implemented.")};this.getWindow=function(){return window};this.requestAnimationFrame= function(b){var d=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame,a=0;if(d)d.bind(window),a=d(b);else return setTimeout(b,15);return a};this.cancelAnimationFrame=function(b){var d=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame;d?(d.bind(window),d(b)):clearTimeout(b)}} function NodeJSRuntime(){function f(b){var c=b.length,n,d=new Uint8Array(new ArrayBuffer(c));for(n=0;n").implementation} function RhinoRuntime(){function f(b,c){var e;void 0!==c?e=b:c=b;"alert"===e&&print("\n!!!!! ALERT !!!!!");print(c);"alert"===e&&print("!!!!! ALERT !!!!!")}var k=this,c={},b=c.javax.xml.parsers.DocumentBuilderFactory.newInstance(),e,p,h="";b.setValidating(!1);b.setNamespaceAware(!0);b.setExpandEntityReferences(!1);b.setSchema(null);p=c.org.xml.sax.EntityResolver({resolveEntity:function(b,e){var h=new c.java.io.FileReader(e);return new c.org.xml.sax.InputSource(h)}});e=b.newDocumentBuilder();e.setEntityResolver(p); this.byteArrayFromString=function(b,c){var e,h=b.length,d=new Uint8Array(new ArrayBuffer(h));for(e=0;e>>18],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g>>>12&63],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g>>>6&63],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g& 63];d===b+1?(g=a[d]<<4,m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g>>>6],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g&63],m+="=="):d===b&&(g=a[d]<<10|a[d+1]<<2,m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g>>>12],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g>>>6&63],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g&63],m+="=");return m}function c(a){a=a.replace(/[^A-Za-z0-9+\/]+/g, "");var m=a.length,d=new Uint8Array(new ArrayBuffer(3*m)),b=a.length%4,c=0,e,q;for(e=0;e>16,d[c+1]=q>>8&255,d[c+2]=q&255,c+=3;m=3*m-[0,0,2,1][b];return d.subarray(0,m)}function b(a){var m,g,d=a.length,b=0,c=new Uint8Array(new ArrayBuffer(3*d));for(m=0;mg?c[b++]=g:(2048>g?c[b++]=192|g>>>6:(c[b++]=224|g>>>12&15,c[b++]=128|g>>>6&63),c[b++]=128|g&63);return c.subarray(0, b)}function e(a){var g,m,d,b,c=a.length,q=new Uint8Array(new ArrayBuffer(c)),e=0;for(g=0;gm?q[e++]=m:(g+=1,d=a[g],224>m?q[e++]=(m&31)<<6|d&63:(g+=1,b=a[g],q[e++]=(m&15)<<12|(d&63)<<6|b&63));return q.subarray(0,e)}function p(a){return k(f(a))}function h(a){return String.fromCharCode.apply(String,c(a))}function n(a){return e(f(a))}function s(a){a=e(a);for(var g="",m=0;mg?q+=String.fromCharCode(g):(c+=1,d=a.charCodeAt(c)&255,224>g?q+=String.fromCharCode((g&31)<<6|d&63):(c+=1,b=a.charCodeAt(c)&255,q+=String.fromCharCode((g&15)<<12|(d&63)<<6|b&63)));return q}function r(a,g){function m(){var c=b+1E5;c>a.length&&(c=a.length);d+=l(a,b,c);b=c;c=b===a.length;g(d,c)&&!c&&runtime.setTimeout(m,0)}var d="",b=0;1E5>a.length?g(l(a,0,a.length),!0):("string"!==typeof a&&(a=a.slice()),m())}function d(a){return b(f(a))}function a(a){return String.fromCharCode.apply(String, b(a))}function m(a){return String.fromCharCode.apply(String,b(f(a)))}var g=function(a){var g={},m,d;m=0;for(d=a.length;me-b&&(e=Math.max(2*e,b+c),c=new Uint8Array(new ArrayBuffer(e)),c.set(p),p=c)}var c=this,b=0,e=1024,p=new Uint8Array(new ArrayBuffer(e));this.appendByteArrayWriter=function(b){c.appendByteArray(b.getByteArray())};this.appendByteArray=function(c){var e=c.length;k(e);p.set(c,b);b+=e};this.appendArray=function(c){var e=c.length;k(e);p.set(c,b);b+=e};this.appendUInt16LE=function(b){c.appendArray([b&255,b>>8&255])};this.appendUInt32LE=function(b){c.appendArray([b& 255,b>>8&255,b>>16&255,b>>24&255])};this.appendString=function(b){c.appendByteArray(runtime.byteArrayFromString(b,f))};this.getLength=function(){return b};this.getByteArray=function(){var c=new Uint8Array(new ArrayBuffer(b));c.set(p.subarray(0,b));return c}};core.CSSUnits=function(){var f=this,k={"in":1,cm:2.54,mm:25.4,pt:72,pc:12,px:96};this.convert=function(c,b,e){return c*k[e]/k[b]};this.convertMeasure=function(c,b){var e,p;c&&b&&(e=parseFloat(c),p=c.replace(e.toString(),""),e=f.convert(e,p,b));return e};this.getUnits=function(c){return c.substr(c.length-2,c.length)}};(function(){function f(){var b,e,p,h,f,k,l,r,d;void 0===c&&(e=(b=runtime.getWindow())&&b.document,k=e.documentElement,l=e.body,c={rangeBCRIgnoresElementBCR:!1,unscaledRangeClientRects:!1,elementBCRIgnoresBodyScroll:!1},e&&(h=e.createElement("div"),h.style.position="absolute",h.style.left="-99999px",h.style.transform="scale(2)",h.style["-webkit-transform"]="scale(2)",f=e.createElement("div"),h.appendChild(f),l.appendChild(h),b=e.createRange(),b.selectNode(f),c.rangeBCRIgnoresElementBCR=0===b.getClientRects().length, f.appendChild(e.createTextNode("Rect transform test")),e=f.getBoundingClientRect(),p=b.getBoundingClientRect(),c.unscaledRangeClientRects=2=a.compareBoundaryPoints(Range.START_TO_START,g)&&0<=a.compareBoundaryPoints(Range.END_TO_END,g)}function p(a,g){return 0>=a.compareBoundaryPoints(Range.END_TO_START,g)&&0<=a.compareBoundaryPoints(Range.START_TO_END,g)}function h(a,g){var d=null;a.nodeType===Node.TEXT_NODE&&(0===a.length?(a.parentNode.removeChild(a),g.nodeType===Node.TEXT_NODE&&(d=g)):(g.nodeType===Node.TEXT_NODE&&(a.appendData(g.data),g.parentNode.removeChild(g)),d=a));return d} function n(a){for(var g=a.parentNode;a.firstChild;)g.insertBefore(a.firstChild,a);g.removeChild(a);return g}function s(a,g){for(var d=a.parentNode,b=a.firstChild,c;b;)c=b.nextSibling,s(b,g),b=c;d&&g(a)&&n(a);return d}function l(a,g){return a===g||Boolean(a.compareDocumentPosition(g)&Node.DOCUMENT_POSITION_CONTAINED_BY)}function r(a,g){return f().unscaledRangeClientRects?a:a/g}function d(a,g,b){Object.keys(g).forEach(function(c){var e=c.split(":"),h=e[1],f=b(e[0]),e=g[c],p=typeof e;"object"===p?Object.keys(e).length&& (c=f?a.getElementsByTagNameNS(f,h)[0]||a.ownerDocument.createElementNS(f,c):a.getElementsByTagName(h)[0]||a.ownerDocument.createElement(c),a.appendChild(c),d(c,e,b)):f&&(runtime.assert("number"===p||"string"===p,"attempting to map unsupported type '"+p+"' (key: "+c+")"),a.setAttributeNS(f,c,String(e)))})}var a=null;this.splitBoundaries=function(a){var g,d=[],c,e,h;if(a.startContainer.nodeType===Node.TEXT_NODE||a.endContainer.nodeType===Node.TEXT_NODE){c=a.endContainer;e=a.endContainer.nodeType!== Node.TEXT_NODE?a.endOffset===a.endContainer.childNodes.length:!1;h=a.endOffset;g=a.endContainer;if(hf))throw runtime.log("alert","watchdog timeout"),"timeout!";if(0k))throw runtime.log("alert","watchdog loop overflow"),"loop overflow";}};core.PositionIterator=function(f,k,c,b){function e(){this.acceptNode=function(a){return!a||a.nodeType===m&&0===a.length?v:x}}function p(a){this.acceptNode=function(d){return!d||d.nodeType===m&&0===d.length?v:a.acceptNode(d)}}function h(){var a=r.currentNode,b=a.nodeType;d=b===m?a.length-1:b===g?1:0}function n(){if(null===r.previousSibling()){if(!r.parentNode()||r.currentNode===f)return r.firstChild(),!1;d=0}else h();return!0}function s(){var g=r.currentNode,b;b=a(g);if(g!==f)for(g=g.parentNode;g&& g!==f;)a(g)===v&&(r.currentNode=g,b=v),g=g.parentNode;b===v?(d=1,g=l.nextPosition()):g=b===x?!0:l.nextPosition();g&&runtime.assert(a(r.currentNode)===x,"moveToAcceptedNode did not result in walker being on an accepted node");return g}var l=this,r,d,a,m=Node.TEXT_NODE,g=Node.ELEMENT_NODE,x=NodeFilter.FILTER_ACCEPT,v=NodeFilter.FILTER_REJECT;this.nextPosition=function(){var a=r.currentNode,b=a.nodeType;if(a===f)return!1;if(0===d&&b===g)null===r.firstChild()&&(d=1);else if(b===m&&d+1 "+a.length), runtime.assert(0<=g,"Error in setPosition: "+g+" < 0"),g===a.length&&(r.nextSibling()?d=0:r.parentNode()?d=1:runtime.assert(!1,"Error in setUnfilteredPosition: position not valid.")),!0;gb.windowBits&&(b.windowBits=-b.windowBits,0===b.windowBits&&(b.windowBits=-15));!(0<=b.windowBits&&16>b.windowBits)||g&&g.windowBits||(b.windowBits+=32);15b.windowBits&&0===(b.windowBits&15)&&(b.windowBits|=15);this.err=0;this.msg="";this.ended=!1;this.chunks= [];this.strm=new d;this.strm.avail_out=0;g=h.inflateInit2(this.strm,b.windowBits);if(g!==l.Z_OK)throw Error(r[g]);this.header=new a;h.inflateGetHeader(this.strm,this.header)};m.prototype.push=function(a,d){var b=this.strm,c=this.options.chunkSize,m,e,f,p,r;if(this.ended)return!1;e=d===~~d?d:!0===d?l.Z_FINISH:l.Z_NO_FLUSH;b.input="string"===typeof a?s.binstring2buf(a):a;b.next_in=0;b.avail_in=b.input.length;do{0===b.avail_out&&(b.output=new n.Buf8(c),b.next_out=0,b.avail_out=c);m=h.inflate(b,l.Z_NO_FLUSH); if(m!==l.Z_STREAM_END&&m!==l.Z_OK)return this.onEnd(m),this.ended=!0,!1;if(b.next_out&&(0===b.avail_out||m===l.Z_STREAM_END||0===b.avail_in&&e===l.Z_FINISH))if("string"===this.options.to)f=s.utf8border(b.output,b.next_out),p=b.next_out-f,r=s.buf2string(b.output,f),b.next_out=p,b.avail_out=c-p,p&&n.arraySet(b.output,b.output,f,p,0),this.onData(r);else this.onData(n.shrinkBuf(b.output,b.next_out))}while((0d&&(a.subarray&&s||!a.subarray&&n))return String.fromCharCode.apply(null,h.shrinkBuf(a,d));for(var b="",c=0;cc;c++)d[c]=252<=c?6:248<= c?5:240<=c?4:224<=c?3:192<=c?2:1;d[254]=d[254]=1;e.string2buf=function(a){var d,b,c,e,f,p=a.length,n=0;for(e=0;eb?1:2048>b?2:65536>b?3:4;d=new h.Buf8(n);for(e=f=0;fb?d[f++]=b:(2048>b?d[f++]=192|b>>>6:(65536>b?d[f++]=224|b>>>12:(d[f++]= 240|b>>>18,d[f++]=128|b>>>12&63),d[f++]=128|b>>>6&63),d[f++]=128|b&63);return d};e.buf2binstring=function(a){return f(a,a.length)};e.binstring2buf=function(a){for(var d=new h.Buf8(a.length),b=0,c=d.length;be)r[c++]=e;else if(h=d[e],4e?r[c++]=e:(e-=65536,r[c++]= 55296|e>>10&1023,r[c++]=56320|e&1023)}return f(r,c)};e.utf8border=function(a,b){var g;b=b||a.length;b>a.length&&(b=a.length);for(g=b-1;0<=g&&128===(a[g]&192);)g--;return 0>g||0===g?b:g+d[a[g]]>b?g:b}},{"./common":2}],4:[function(c,b,e){b.exports=function(b,c,e,f){var l=b&65535|0;b=b>>>16&65535|0;for(var r=0;0!==e;){r=2E3e;e++){b=e;for(var f=0;8>f;f++)b=b&1?3988292384^b>>>1:b>>>1;c[e]=b}return c}();b.exports=function(b,c,e,l){e=l+e;for(b^= -1;l>>8^f[(b^c[l])&255];return b^-1}},{}],7:[function(c,b,e){b.exports=function(){this.os=this.xflags=this.time=this.text=0;this.extra=null;this.extra_len=0;this.comment=this.name="";this.hcrc=0;this.done=!1}},{}],8:[function(c,b,e){b.exports=function(b,c){var e,f,l,r,d,a,m,g,x,v,z,y,t,u,w,B,I,D,F,q,Q,N,U,C;e=b.state;f=b.next_in;U=b.input;l=f+(b.avail_in-5);r=b.next_out;C=b.output;d=r-(c-b.avail_out);a=r+(b.avail_out-257);m=e.dmax;g=e.wsize;x=e.whave;v=e.wnext;z=e.window;y=e.hold;t=e.bits; u=e.lencode;w=e.distcode;B=(1<t&&(y+=U[f++]<>>24;y>>>=F;t-=F;F=D>>>16&255;if(0===F)C[r++]=D&65535;else if(F&16){q=D&65535;if(F&=15)t>>=F,t-=F;15>t&&(y+=U[f++]<>>24;y>>>=F;t-=F;F=D>>>16&255;if(F&16){D&=65535;F&=15;tm){b.msg="invalid distance too far back"; e.mode=30;break a}y>>>=F;t-=F;F=r-d;if(D>F){F=D-F;if(F>x&&e.sane){b.msg="invalid distance too far back";e.mode=30;break a}Q=0;N=z;if(0===v){if(Q+=g-F,F>3;f-=q;t-=q<<3;b.next_in=f;b.next_out=r;b.avail_in=f>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}function h(){this.mode=0;this.last=!1;this.wrap=0;this.havedict=!1;this.total=this.check=this.dmax=this.flags=0;this.head=null;this.wnext=this.whave=this.wsize=this.wbits=0;this.window=null;this.extra=this.offset=this.length=this.bits=this.hold=0;this.distcode=this.lencode=null;this.have=this.ndist=this.nlen=this.ncode=this.distbits=this.lenbits=0;this.next=null;this.lens=new d.Buf16(320);this.work= new d.Buf16(288);this.distdyn=this.lendyn=null;this.was=this.back=this.sane=0}function n(a){var b;if(!a||!a.state)return z;b=a.state;a.total_in=a.total_out=b.total=0;a.msg="";b.wrap&&(a.adler=b.wrap&1);b.mode=y;b.last=0;b.havedict=0;b.dmax=32768;b.head=null;b.hold=0;b.bits=0;b.lencode=b.lendyn=new d.Buf32(t);b.distcode=b.distdyn=new d.Buf32(u);b.sane=1;b.back=-1;return v}function s(a){var b;if(!a||!a.state)return z;b=a.state;b.wsize=0;b.whave=0;b.wnext=0;return n(a)}function l(a,b){var d,g;if(!a|| !a.state)return z;g=a.state;0>b?(d=0,b=-b):(d=(b>>4)+1,48>b&&(b&=15));if(b&&(8>b||15u;){if(0===l)break a;l--;t+=e[r++]<>>8&255;q.check=m(q.check,T,2,0);u=t=0;q.mode=2;break}q.flags=0;q.head&&(q.head.done=!1);if(!(q.wrap&1)||(((t&255)<<8)+(t>>8))%31){b.msg="incorrect header check";q.mode=30;break}if(8!==(t&15)){b.msg="unknown compression method";q.mode=30;break}t>>>=4;u-=4;G=(t&15)+8;if(0===q.wbits)q.wbits=G;else if(G>q.wbits){b.msg="invalid window size";q.mode=30;break}q.dmax=1<u;){if(0===l)break a;l--;t+=e[r++]<>8&1);q.flags&512&&(T[0]=t&255,T[1]=t>>>8&255,q.check=m(q.check,T,2,0));u=t=0;q.mode=3;case 3:for(;32>u;){if(0===l)break a;l--;t+=e[r++]<>>8&255,T[2]=t>>>16&255,T[3]=t>>>24&255,q.check=m(q.check,T,4,0));u=t=0;q.mode=4;case 4:for(;16>u;){if(0===l)break a;l--;t+=e[r++]<>8);q.flags&512&&(T[0]=t&255,T[1]=t>>>8&255,q.check=m(q.check,T,2,0));u=t=0;q.mode=5;case 5:if(q.flags&1024){for(;16>u;){if(0===l)break a;l--;t+=e[r++]<>>8&255,q.check=m(q.check,T,2,0));u=t=0}else q.head&&(q.head.extra=null);q.mode=6;case 6:if(q.flags&1024&&(E=q.length,E>l&&(E=l),E&&(q.head&&(G=q.head.extra_len-q.length,q.head.extra||(q.head.extra=Array(q.head.extra_len)),d.arraySet(q.head.extra, e,r,E,G)),q.flags&512&&(q.check=m(q.check,e,E,r)),l-=E,r+=E,q.length-=E),q.length))break a;q.length=0;q.mode=7;case 7:if(q.flags&2048){if(0===l)break a;E=0;do G=e[r+E++],q.head&&G&&65536>q.length&&(q.head.name+=String.fromCharCode(G));while(G&&Eq.length&&(q.head.comment+=String.fromCharCode(G));while(G&&E< l);q.flags&512&&(q.check=m(q.check,e,E,r));l-=E;r+=E;if(G)break a}else q.head&&(q.head.comment=null);q.mode=9;case 9:if(q.flags&512){for(;16>u;){if(0===l)break a;l--;t+=e[r++]<>9&1,q.head.done=!0);b.adler=q.check=0;q.mode=12;break;case 10:for(;32>u;){if(0===l)break a;l--;t+=e[r++]<>>=u&7;u-=u&7;q.mode=27;break}for(;3>u;){if(0===l)break a;l--;t+=e[r++]<>>=1;u-=1;switch(t&3){case 0:q.mode=14;break;case 1:E=q;if(w){G=void 0;B=new d.Buf32(512);I=new d.Buf32(32);for(G=0;144>G;)E.lens[G++]=8;for(;256>G;)E.lens[G++]=9;for(;280>G;)E.lens[G++]=7;for(;288>G;)E.lens[G++]=8;x(1,E.lens,0,288,B,0,E.work,{bits:9});for(G=0;32>G;)E.lens[G++]=5;x(2,E.lens, 0,32,I,0,E.work,{bits:5});w=!1}E.lencode=B;E.lenbits=9;E.distcode=I;E.distbits=5;q.mode=20;if(6===c){t>>>=2;u-=2;break a}break;case 2:q.mode=17;break;case 3:b.msg="invalid block type",q.mode=30}t>>>=2;u-=2;break;case 14:t>>>=u&7;for(u-=u&7;32>u;){if(0===l)break a;l--;t+=e[r++]<>>16^65535)){b.msg="invalid stored block lengths";q.mode=30;break}q.length=t&65535;u=t=0;q.mode=15;if(6===c)break a;case 15:q.mode=16;case 16:if(E=q.length){E>l&&(E=l);E>s&&(E=s);if(0===E)break a;d.arraySet(h, e,r,E,n);l-=E;r+=E;s-=E;n+=E;q.length-=E;break}q.mode=12;break;case 17:for(;14>u;){if(0===l)break a;l--;t+=e[r++]<>>=5;u-=5;q.ndist=(t&31)+1;t>>>=5;u-=5;q.ncode=(t&15)+4;t>>>=4;u-=4;if(286u;){if(0===l)break a;l--;t+=e[r++]<>>=3;u-=3}for(;19>q.have;)q.lens[Z[q.have++]]=0;q.lencode=q.lendyn;q.lenbits=7; E={bits:q.lenbits};M=x(0,q.lens,0,19,q.lencode,0,q.work,E);q.lenbits=E.bits;if(M){b.msg="invalid code lengths set";q.mode=30;break}q.have=0;q.mode=19;case 19:for(;q.have>>24;P=E>>>16&255;J=E&65535;if(A<=u)break;if(0===l)break a;l--;t+=e[r++]<J)t>>>=A,u-=A,q.lens[q.have++]=J;else{if(16===J){for(E=A+2;u>>=A;u-=A;if(0===q.have){b.msg="invalid bit length repeat";q.mode=30;break}G= q.lens[q.have-1];E=3+(t&3);t>>>=2;u-=2}else if(17===J){for(E=A+3;u>>=A;u-=A;G=0;E=3+(t&7);t>>>=3;u-=3}else{for(E=A+7;u>>=A;u-=A;G=0;E=11+(t&127);t>>>=7;u-=7}if(q.have+E>q.nlen+q.ndist){b.msg="invalid bit length repeat";q.mode=30;break}for(;E--;)q.lens[q.have++]=G}}if(30===q.mode)break;if(0===q.lens[256]){b.msg="invalid code -- missing end-of-block";q.mode=30;break}q.lenbits=9;E={bits:q.lenbits};M=x(1,q.lens, 0,q.nlen,q.lencode,0,q.work,E);q.lenbits=E.bits;if(M){b.msg="invalid literal/lengths set";q.mode=30;break}q.distbits=6;q.distcode=q.distdyn;E={bits:q.distbits};M=x(2,q.lens,q.nlen,q.ndist,q.distcode,0,q.work,E);q.distbits=E.bits;if(M){b.msg="invalid distances set";q.mode=30;break}q.mode=20;if(6===c)break a;case 20:q.mode=21;case 21:if(6<=l&&258<=s){b.next_out=n;b.avail_out=s;b.next_in=r;b.avail_in=l;q.hold=t;q.bits=u;g(b,W);n=b.next_out;h=b.output;s=b.avail_out;r=b.next_in;e=b.input;l=b.avail_in; t=q.hold;u=q.bits;12===q.mode&&(q.back=-1);break}for(q.back=0;;){E=q.lencode[t&(1<>>24;P=E>>>16&255;J=E&65535;if(A<=u)break;if(0===l)break a;l--;t+=e[r++]<>G)];A=E>>>24;P=E>>>16&255;J=E&65535;if(G+A<=u)break;if(0===l)break a;l--;t+=e[r++]<>>=G;u-=G;q.back+=G}t>>>=A;u-=A;q.back+=A;q.length=J;if(0===P){q.mode=26;break}if(P&32){q.back=-1;q.mode=12;break}if(P&64){b.msg="invalid literal/length code"; q.mode=30;break}q.extra=P&15;q.mode=22;case 22:if(q.extra){for(E=q.extra;u>>=q.extra;u-=q.extra;q.back+=q.extra}q.was=q.length;q.mode=23;case 23:for(;;){E=q.distcode[t&(1<>>24;P=E>>>16&255;J=E&65535;if(A<=u)break;if(0===l)break a;l--;t+=e[r++]<>G)];A=E>>>24;P=E>>>16&255;J=E&65535;if(G+A<=u)break;if(0===l)break a;l--;t+=e[r++]<>>=G;u-=G;q.back+=G}t>>>=A;u-=A;q.back+=A;if(P&64){b.msg="invalid distance code";q.mode=30;break}q.offset=J;q.extra=P&15;q.mode=24;case 24:if(q.extra){for(E=q.extra;u>>=q.extra;u-=q.extra;q.back+=q.extra}if(q.offset>q.dmax){b.msg="invalid distance too far back";q.mode=30;break}q.mode=25;case 25:if(0===s)break a;E=W-s;if(q.offset>E){E=q.offset-E;if(E>q.whave&&q.sane){b.msg="invalid distance too far back";q.mode=30;break}E> q.wnext?(E-=q.wnext,G=q.wsize-E):G=q.wnext-E;E>q.length&&(E=q.length);O=q.window}else O=h,G=n-q.offset,E=q.length;E>s&&(E=s);s-=E;q.length-=E;do h[n++]=O[G++];while(--E);0===q.length&&(q.mode=21);break;case 26:if(0===s)break a;h[n++]=q.length;s--;q.mode=21;break;case 27:if(q.wrap){for(;32>u;){if(0===l)break a;l--;t|=e[r++]<u;){if(0===l)break a;l--;t+=e[r++]<q.mode&&(27>q.mode||4!==c))e=b.output,r=b.next_out,n=W-b.avail_out,s=b.state,null===s.window&&(s.wsize=1<=s.wsize?(d.arraySet(s.window,e,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(l=s.wsize-s.wnext,l>n&&(l=n),d.arraySet(s.window,e,r-n,l,s.wnext),(n-=l)?(d.arraySet(s.window,e,r-n,n,0),s.wnext=n,s.whave=s.wsize):(s.wnext+=l,s.wnext===s.wsize&&(s.wnext=0),s.whave=t;t++)Y[t]=0;for(u=0;uB&&(I=B);if(0===B)return g[e++]=20971520,g[e++]=20971520,z.bits=1,0;for(w=1;w=t;t++)if(q<<=1,q-=Y[t],0>q)return-1;if(0t;t++)D[t+1]=D[t]+Y[t];for(u=0;uH?(G=aa[W+v[u]],O=$[S+v[u]]):(G=96,O=0);q=1<>F)+U]=E<<24|G<<16|O|0;while(0!==U);for(q=1<>=1;0!==q?(N&=q-1,N+=q):N=0;u++;if(0===--Y[t]){if(t===B)break;t=d[a+v[u]]}if(t>I&&(N&c)!==C){0===F&&(F=I);y+=w;D=t-F;for(q=1<=q)break;D++;q<<=1}Q+=1<";return runtime.parseXML(b)}; core.UnitTest.createOdtDocument=function(f,k){return core.UnitTest.createXmlDocument("office:document",f,k)}; core.UnitTestLogger=function(){var f=[],k=0,c=0,b="",e="";this.startTest=function(p,h){f=[];k=0;b=p;e=h;c=Date.now()};this.endTest=function(){var p=Date.now();return{description:e,suite:[b,e],success:0===k,log:f,time:p-c}};this.debug=function(b){f.push({category:"debug",message:b})};this.fail=function(b){k+=1;f.push({category:"fail",message:b})};this.pass=function(b){f.push({category:"pass",message:b})}}; core.UnitTestRunner=function(f,k){function c(a){s+=1;d?k.debug(a):k.fail(a)}function b(a,b){var d;try{if(a.length!==b.length)return c("array of length "+a.length+" should be "+b.length+" long"),!1;for(d=0;d1/l?"-0":String(l),c(b+" should be "+a+". Was "+d+".")):c(b+" should be "+a+" (of type "+typeof a+"). Was "+ l+" (of type "+typeof l+").")}var s=0,l,r,d=!1;this.resourcePrefix=function(){return f};this.beginExpectFail=function(){l=s;d=!0};this.endExpectFail=function(){var a=l===s;d=!1;s=l;a&&(s+=1,k.fail("Expected at least one failed test, but none registered."))};r=function(a,d){var g=Object.keys(a),e=Object.keys(d);g.sort();e.sort();return b(g,e)&&Object.keys(a).every(function(b){var g=a[b],e=d[b];return h(g,e)?!0:(c(g+" should be "+e+" for key "+b),!1)})};this.areNodesEqual=p;this.shouldBeNull=function(a, b){n(a,b,"null")};this.shouldBeNonNull=function(a,b){var d,e;try{e=eval(b)}catch(f){d=f}d?c(b+" should be non-null. Threw exception "+d):null!==e?k.pass(b+" is non-null."):c(b+" should be non-null. Was "+e)};this.shouldBe=n;this.testFailed=c;this.countFailedTests=function(){return s};this.name=function(a){var b,d,c=[],e=a.length;c.length=e;for(b=0;b"+b+""}function k(b){c.reporter&&c.reporter(b)}var c=this,b=0,e=new core.UnitTestLogger,p={},h="BrowserRuntime"===runtime.type();this.resourcePrefix="";this.reporter=function(b){var c,e;h?runtime.log("Running "+f(b.description,'runTest("'+b.suite[0]+'","'+b.description+'")')+""):runtime.log("Running "+b.description);if(!b.success)for(c=0;cRunning "+f(d,'runSuite("'+d+'");')+": "+m.description()+""):runtime.log("Running "+d+": "+m.description);z=m.tests();for(x=0;x>>8^e;return d^-1}function b(a){return new Date((a>>25&127)+1980,(a>>21&15)-1,a>>16&31,a>>11&15,a>>5&63,(a&31)<<1)}function e(a){var b=a.getFullYear();return 1980>b?0:b-1980<< 25|a.getMonth()+1<<21|a.getDate()<<16|a.getHours()<<11|a.getMinutes()<<5|a.getSeconds()>>1}function p(a,d){var c,e,m,f,h,q,l,r=this;this.load=function(b){if(null!==r.data)b(null,r.data);else{var d=h+34+e+m+256;d+l>g&&(d=g-l);runtime.read(a,l,d,function(d,g){if(d||null===g)b(d,g);else a:{var c=g,e=new core.ByteArray(c),m=e.readUInt32LE(),l;if(67324752!==m)b("File entry signature is wrong."+m.toString()+" "+c.length.toString(),null);else{e.pos+=22;m=e.readUInt16LE();l=e.readUInt16LE();e.pos+=m+l;if(f){c= c.subarray(e.pos,e.pos+h);if(h!==c.length){b("The amount of compressed bytes read was "+c.length.toString()+" instead of "+h.toString()+" for "+r.filename+" in "+a+".",null);break a}c=v(c,q)}else c=c.subarray(e.pos,e.pos+q);q!==c.length?b("The amount of bytes read was "+c.length.toString()+" instead of "+q.toString()+" for "+r.filename+" in "+a+".",null):(r.data=c,b(null,c))}}})}};this.set=function(a,b,d,g){r.filename=a;r.data=b;r.compressed=d;r.date=g};this.error=null;d&&(c=d.readUInt32LE(),33639248!== c?this.error="Central directory entry has wrong signature at position "+(d.pos-4).toString()+' for file "'+a+'": '+d.data.length.toString():(d.pos+=6,f=d.readUInt16LE(),this.date=b(d.readUInt32LE()),d.readUInt32LE(),h=d.readUInt32LE(),q=d.readUInt32LE(),e=d.readUInt16LE(),m=d.readUInt16LE(),c=d.readUInt16LE(),d.pos+=8,l=d.readUInt32LE(),this.filename=runtime.byteArrayToString(d.data.subarray(d.pos,d.pos+e),"utf8"),this.data=null,d.pos+=e+m+c))}function h(a,b){if(22!==a.length)b("Central directory length should be 22.", z);else{var d=new core.ByteArray(a),c;c=d.readUInt32LE();101010256!==c?b("Central directory signature is wrong: "+c.toString(),z):(c=d.readUInt16LE(),0!==c?b("Zip files with non-zero disk numbers are not supported.",z):(c=d.readUInt16LE(),0!==c?b("Zip files with non-zero disk numbers are not supported.",z):(c=d.readUInt16LE(),x=d.readUInt16LE(),c!==x?b("Number of entries is inconsistent.",z):(c=d.readUInt32LE(),d=d.readUInt16LE(),d=g-22-c,runtime.read(f,d,g-d,function(a,d){if(a||null===d)b(a,z);else a:{var c= new core.ByteArray(d),g,e;m=[];for(g=0;gg?k("File '"+f+"' cannot be read.",z):runtime.read(f,g-22,22,function(a,b){a||null===k||null===b?k(a,z): h(b,k)})})};gui.CommonConstraints={EDIT:{ANNOTATIONS:{ONLY_DELETE_OWN:"onlyDeleteOwn"},REVIEW_MODE:"reviewMode"}};gui.SessionConstraints=function(){function f(b){k.hasOwnProperty(b)||(k[b]=!1,c.register(b))}var k={},c=new core.EventNotifier;this.registerConstraint=f;this.subscribe=function(b,e){f(b);c.subscribe(b,e)};this.unsubscribe=function(b,e){c.unsubscribe(b,e)};this.setState=function(b,e){runtime.assert(!0===k.hasOwnProperty(b),"No such constraint");k[b]!==e&&(k[b]=e,c.emit(b,e))};this.getState=function(b){runtime.assert(!0===k.hasOwnProperty(b),"No such constraint");return k[b]}};xmldom.LSSerializerFilter=function(){};xmldom.LSSerializerFilter.prototype.acceptNode=function(f){};odf.OdfNodeFilter=function(){this.acceptNode=function(f){return"http://www.w3.org/1999/xhtml"===f.namespaceURI?NodeFilter.FILTER_SKIP:f.namespaceURI&&f.namespaceURI.match(/^urn:webodf:/)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}};odf.Namespaces={namespaceMap:{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",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",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},prefixMap:{},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",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",xlinkns:"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/XML/1998/namespace"}; (function(){var f=odf.Namespaces.namespaceMap,k=odf.Namespaces.prefixMap,c;for(c in f)f.hasOwnProperty(c)&&(k[f[c]]=c)})();odf.Namespaces.forEachPrefix=function(f){var k=odf.Namespaces.namespaceMap,c;for(c in k)k.hasOwnProperty(c)&&f(c,k[c])};odf.Namespaces.lookupNamespaceURI=function(f){var k=null;odf.Namespaces.namespaceMap.hasOwnProperty(f)&&(k=odf.Namespaces.namespaceMap[f]);return k};odf.Namespaces.lookupPrefix=function(f){var k=odf.Namespaces.prefixMap;return k.hasOwnProperty(f)?k[f]:null}; odf.Namespaces.lookupNamespaceURI.lookupNamespaceURI=odf.Namespaces.lookupNamespaceURI;xmldom.XPathIterator=function(){};xmldom.XPathIterator.prototype.next=function(){};xmldom.XPathIterator.prototype.reset=function(){}; function createXPathSingleton(){function f(b,d,a){return-1!==b&&(b=e&&a.push(k(b.substring(d,c)))):"["===b[c]&&(0>=e&&(d=c+1),e+=1),c+=1;return c};s=function(c,d,a){var m,g,f,l;for(m=0;m/g,">").replace(/'/g,"'").replace(/"/g,""")}function c(e,f){var h="",n=b.filter?b.filter.acceptNode(f):NodeFilter.FILTER_ACCEPT,s;if(n===NodeFilter.FILTER_ACCEPT&&f.nodeType===Node.ELEMENT_NODE){e.push();s=e.getQName(f);var l,r=f.attributes,d,a,m,g="",x;l="<"+s;d=r.length;for(a=0;a")}if(n===NodeFilter.FILTER_ACCEPT||n===NodeFilter.FILTER_SKIP){for(n=f.firstChild;n;)h+=c(e,n),n=n.nextSibling;f.nodeValue&&(h+=k(f.nodeValue))}s&&(h+="",e.pop());return h}var b=this;this.filter=null;this.writeToString=function(b,p){if(!b)return"";var h=new f(p);return c(h,b)}};(function(){function f(b){var d,a=n.length;for(d=0;da)break;g=g.nextSibling}b.insertBefore(d,g)}}}var e=new odf.StyleInfo,p=new core.DomUtils,h=odf.Namespaces.stylens,n="meta settings scripts font-face-decls styles automatic-styles master-styles body".split(" "), s=Date.now()+"_webodf_",l=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(b,d,a,c){var g=this;this.size=0;this.type=null;this.name=b;this.container=a;this.url=null;this.mimetype=d;this.onstatereadychange=this.document=null;this.EMPTY=0;this.LOADING=1;this.DONE=2;this.state=this.EMPTY;this.data="";this.load=function(){null!==c&&(this.mimetype=d,c.loadAsDataURL(b,d,function(a,b){a&&runtime.log(a);g.url=b;if(g.onchange)g.onchange(g);if(g.onstatereadychange)g.onstatereadychange(g)}))}};odf.OdfPart.prototype.load=function(){}; odf.OdfPart.prototype.getUrl=function(){return this.data?"data:;base64,"+l.toBase64(this.data):null};odf.OdfContainer=function d(a,f){function g(a){for(var b=a.firstChild,d;b;)d=b.nextSibling,b.nodeType===Node.ELEMENT_NODE?g(b):b.nodeType===Node.PROCESSING_INSTRUCTION_NODE&&a.removeChild(b),b=d}function n(a){var b={},d,c,g=a.ownerDocument.createNodeIterator(a,NodeFilter.SHOW_ELEMENT,null,!1);for(a=g.nextNode();a;)"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI&&("annotation"=== a.localName?(d=a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","name"))&&(b.hasOwnProperty(d)?runtime.log("Warning: annotation name used more than once with : '"+d+"'"):b[d]=a):"annotation-end"===a.localName&&((d=a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","name"))?b.hasOwnProperty(d)?(c=b[d],c.annotationEndElement?runtime.log("Warning: annotation name used more than once with : '"+d+"'"):c.annotationEndElement= a):runtime.log("Warning: annotation end without an annotation start, name: '"+d+"'"):runtime.log("Warning: annotation end without a name found"))),a=g.nextNode()}function v(a,b){for(var d=a&&a.firstChild;d;)d.nodeType===Node.ELEMENT_NODE&&d.setAttributeNS("urn:webodf:names:scope","scope",b),d=d.nextSibling}function z(a,b){for(var d=M.rootElement.meta,d=d&&d.firstChild;d&&(d.namespaceURI!==a||d.localName!==b);)d=d.nextSibling;for(d=d&&d.firstChild;d&&d.nodeType!==Node.TEXT_NODE;)d=d.nextSibling;return d? d.data:null}function y(a){var b={},d;for(a=a.firstChild;a;)a.nodeType===Node.ELEMENT_NODE&&a.namespaceURI===h&&"font-face"===a.localName&&(d=a.getAttributeNS(h,"name"),b[d]=a),a=a.nextSibling;return b}function t(a,b){var d=null,c,g,e;if(a)for(d=a.cloneNode(!0),c=d.firstElementChild;c;)g=c.nextElementSibling,(e=c.getAttributeNS("urn:webodf:names:scope","scope"))&&e!==b&&d.removeChild(c),c=g;return d}function u(a,b){var d,c,g,q=null,f={};if(a)for(b.forEach(function(a){e.collectUsedFontFaces(f,a)}), q=a.cloneNode(!0),d=q.firstElementChild;d;)c=d.nextElementSibling,g=d.getAttributeNS(h,"name"),f[g]||q.removeChild(d),d=c;return q}function w(a){var b=M.rootElement.ownerDocument,d;if(a){g(a.documentElement);try{d=b.importNode(a.documentElement,!0)}catch(c){}}return d}function B(a){M.state=a;if(M.onchange)M.onchange(M);if(M.onstatereadychange)M.onstatereadychange(M)}function I(a){ia=null;M.rootElement=a;a.fontFaceDecls=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls"); a.styles=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","styles");a.automaticStyles=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles");a.masterStyles=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles");a.body=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","body");a.meta=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta");a.settings=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0", "settings");a.scripts=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","scripts");n(a)}function D(a){var c=w(a),g=M.rootElement,q;c&&"document-styles"===c.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===c.namespaceURI?(g.fontFaceDecls=p.getDirectChild(c,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls"),b(g,g.fontFaceDecls),q=p.getDirectChild(c,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","styles"),g.styles=q||a.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0", "styles"),b(g,g.styles),q=p.getDirectChild(c,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles"),g.automaticStyles=q||a.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles"),v(g.automaticStyles,"document-styles"),b(g,g.automaticStyles),c=p.getDirectChild(c,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles"),g.masterStyles=c||a.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles"),b(g,g.masterStyles), e.prefixStyleNames(g.automaticStyles,s,g.masterStyles)):B(d.INVALID)}function F(a){a=w(a);var c,g,q,f;if(a&&"document-content"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI){c=M.rootElement;q=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls");if(c.fontFaceDecls&&q){f=c.fontFaceDecls;var m,l,n,k,s={};g=y(f);k=y(q);for(q=q.firstElementChild;q;){m=q.nextElementSibling;if(q.namespaceURI===h&&"font-face"===q.localName)if(l=q.getAttributeNS(h, "name"),g.hasOwnProperty(l)){if(!q.isEqualNode(g[l])){n=l;for(var D=g,N=k,t=0,x=void 0,x=n=n.replace(/\d+$/,"");D.hasOwnProperty(x)||N.hasOwnProperty(x);)t+=1,x=n+t;n=x;q.setAttributeNS(h,"style:name",n);f.appendChild(q);g[n]=q;delete k[l];s[l]=n}}else f.appendChild(q),g[l]=q,delete k[l];q=m}f=s}else q&&(c.fontFaceDecls=q,b(c,q));g=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles");v(g,"document-content");f&&e.changeFontFaceNames(g,f);if(c.automaticStyles&&g)for(f= g.firstChild;f;)c.automaticStyles.appendChild(f),f=g.firstChild;else g&&(c.automaticStyles=g,b(c,g));a=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","body");if(null===a)throw" tag is mising.";c.body=a;b(c,c.body)}else B(d.INVALID)}function q(a){a=w(a);var d;a&&"document-meta"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI&&(d=M.rootElement,d.meta=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta"), b(d,d.meta))}function Q(a){a=w(a);var d;a&&"document-settings"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI&&(d=M.rootElement,d.settings=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","settings"),b(d,d.settings))}function N(a){a=w(a);var b;if(a&&"manifest"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"===a.namespaceURI)for(b=M.rootElement,b.manifest=a,a=b.manifest.firstElementChild;a;)"file-entry"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"=== a.namespaceURI&&(Z[a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","full-path")]=a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","media-type")),a=a.nextElementSibling}function U(a,b,d){a=p.getElementsByTagName(a,b);var c;for(c=0;c'}function Y(){var a=new xmldom.LSSerializer,b=H("document-meta");a.filter=new odf.OdfNodeFilter;b+=a.writeToString(M.rootElement.meta,odf.Namespaces.namespaceMap);return b+""}function aa(a,b){var d=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","manifest:file-entry");d.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","manifest:full-path",a);d.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0", "manifest:media-type",b);return d}function W(){var a=runtime.parseXML(''),b=a.documentElement,d=new xmldom.LSSerializer,c;for(c in Z)Z.hasOwnProperty(c)&&b.appendChild(aa(c,Z[c]));d.filter=new odf.OdfNodeFilter;return'\n'+d.writeToString(a,odf.Namespaces.namespaceMap)}function E(){var a,b,d,c=odf.Namespaces.namespaceMap, g=new xmldom.LSSerializer,q=H("document-styles");b=t(M.rootElement.automaticStyles,"document-styles");d=M.rootElement.masterStyles.cloneNode(!0);a=u(M.rootElement.fontFaceDecls,[d,M.rootElement.styles,b]);e.removePrefixFromStyleNames(b,s,d);g.filter=new k(d,b);q+=g.writeToString(a,c);q+=g.writeToString(M.rootElement.styles,c);q+=g.writeToString(b,c);q+=g.writeToString(d,c);return q+""}function G(){var a,b,d=odf.Namespaces.namespaceMap,g=new xmldom.LSSerializer,e=H("document-content"); b=t(M.rootElement.automaticStyles,"document-content");a=u(M.rootElement.fontFaceDecls,[b]);g.filter=new c(M.rootElement.body,b);e+=g.writeToString(a,d);e+=g.writeToString(b,d);e+=g.writeToString(M.rootElement.body,d);return e+""}function O(a,b){runtime.loadXML(a,function(a,c){if(a)b(a);else if(c){C(c);$(c.documentElement);var g=w(c);g&&"document"===g.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===g.namespaceURI?(I(g),B(d.DONE)):B(d.INVALID)}else b("No DOM was loaded.")})} function A(a,d){var c;c=M.rootElement;var g=c.meta;g||(c.meta=g=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta"),b(c,g));c=g;a&&p.mapKeyValObjOntoNode(c,a,odf.Namespaces.lookupNamespaceURI);d&&p.removeKeyElementsFromNode(c,d,odf.Namespaces.lookupNamespaceURI)}function P(a){function b(a,d){var c;d||(d=a);c=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",d);e[a]=c;e.appendChild(c)}var c=new core.Zip("",null),g=runtime.byteArrayFromString("application/vnd.oasis.opendocument."+ a,"utf8"),e=M.rootElement,q=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",a);c.save("mimetype",g,!1,new Date);b("meta");b("settings");b("scripts");b("fontFaceDecls","font-face-decls");b("styles");b("automaticStyles","automatic-styles");b("masterStyles","master-styles");b("body");e.body.appendChild(q);Z["/"]="application/vnd.oasis.opendocument."+a;Z["settings.xml"]="text/xml";Z["meta.xml"]="text/xml";Z["styles.xml"]="text/xml";Z["content.xml"]="text/xml";B(d.DONE);return c} function J(){var a,b=new Date,d="";M.rootElement.settings&&M.rootElement.settings.firstElementChild&&(a=new xmldom.LSSerializer,d=H("document-settings"),a.filter=new odf.OdfNodeFilter,d+=a.writeToString(M.rootElement.settings,odf.Namespaces.namespaceMap),d+="");(a=d)?(a=runtime.byteArrayFromString(a,"utf8"),T.save("settings.xml",a,!0,b)):T.remove("settings.xml");d=runtime.getWindow();a="WebODF/"+webodf.Version;d&&(a=a+" "+d.navigator.userAgent);A({"meta:generator":a},null); a=runtime.byteArrayFromString(Y(),"utf8");T.save("meta.xml",a,!0,b);a=runtime.byteArrayFromString(E(),"utf8");T.save("styles.xml",a,!0,b);a=runtime.byteArrayFromString(G(),"utf8");T.save("content.xml",a,!0,b);a=runtime.byteArrayFromString(W(),"utf8");T.save("META-INF/manifest.xml",a,!0,b)}function X(a,b){J();T.writeAs(a,function(a){b(a)})}var M=this,T,Z={},ia,ba="";this.onstatereadychange=f;this.state=this.onchange=null;this.getMetadata=z;this.setRootElement=I;this.getContentElement=function(){var a; ia||(a=M.rootElement.body,ia=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","text")||p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","presentation")||p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","spreadsheet"));if(!ia)throw"Could not find content element in .";return ia};this.getDocumentType=function(){var a=M.getContentElement();return a&&a.localName};this.getPart=function(a){return new odf.OdfPart(a,Z[a],M,T)};this.getPartData= function(a,b){T.load(a,b)};this.setMetadata=A;this.incrementEditingCycles=function(){var a=z(odf.Namespaces.metans,"editing-cycles"),a=a?parseInt(a,10):0;isNaN(a)&&(a=0);A({"meta:editing-cycles":a+1},null);return a+1};this.createByteArray=function(a,b){J();T.createByteArray(a,b)};this.saveAs=X;this.save=function(a){X(ba,a)};this.getUrl=function(){return ba};this.setBlob=function(a,b,d){d=l.convertBase64ToByteArray(d);T.save(a,d,!1,new Date);Z.hasOwnProperty(a)&&runtime.log(a+" has been overwritten."); Z[a]=b};this.removeBlob=function(a){var b=T.remove(a);runtime.assert(b,"file is not found: "+a);delete Z[a]};this.state=d.LOADING;this.rootElement=function(a){var b=document.createElementNS(a.namespaceURI,a.localName),d;a=new a.Type;for(d in a)a.hasOwnProperty(d)&&(b[d]=a[d]);return b}({Type:odf.ODFDocumentElement,namespaceURI:odf.ODFDocumentElement.namespaceURI,localName:odf.ODFDocumentElement.localName});a===odf.OdfContainer.DocumentType.TEXT?T=P("text"):a===odf.OdfContainer.DocumentType.PRESENTATION? T=P("presentation"):a===odf.OdfContainer.DocumentType.SPREADSHEET?T=P("spreadsheet"):(ba=a,T=new core.Zip(ba,function(a,b){T=b;a?O(ba,function(b){a&&(T.error=a+"\n"+b,B(d.INVALID))}):S([{path:"styles.xml",handler:D},{path:"content.xml",handler:F},{path:"meta.xml",handler:q},{path:"settings.xml",handler:Q},{path:"META-INF/manifest.xml",handler:N}])}))};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(b){return new odf.OdfContainer(b,null)}})();odf.OdfContainer.DocumentType={TEXT:1,PRESENTATION:2,SPREADSHEET:3};odf.OdfUtils=function(){function f(a){return"image"===(a&&a.localName)&&a.namespaceURI===$}function k(a){return null!==a&&a.nodeType===Node.ELEMENT_NODE&&"frame"===a.localName&&a.namespaceURI===$&&"as-char"===a.getAttributeNS(C,"anchor-type")}function c(a){var b;(b="annotation"===(a&&a.localName)&&a.namespaceURI===odf.Namespaces.officens)||(b="div"===(a&&a.localName)&&"annotationWrapper"===a.className);return b}function b(a){return"a"===(a&&a.localName)&&a.namespaceURI===C}function e(a){var b=a&& a.localName;return("p"===b||"h"===b)&&a.namespaceURI===C}function p(a,b){for(a&&void 0!==b&&!e(a)&&a.childNodes.item(b)&&(a=a.childNodes.item(b));a&&!e(a);)a=a.parentNode;return a}function h(a,b){for(;a&&a!==b;){if(a.namespaceURI===odf.Namespaces.officens&&"annotation"===a.localName)return a;a=a.parentNode}return null}function n(a){return/^[ \t\r\n]+$/.test(a)}function s(a){if(null===a||a.nodeType!==Node.ELEMENT_NODE)return!1;var b=a.localName;return/^(span|p|h|a|meta)$/.test(b)&&a.namespaceURI=== C||"span"===b&&"webodf-annotationHighlight"===a.className}function l(a){var b=a&&a.localName,d=!1;b&&(a=a.namespaceURI,a===C&&(d="s"===b||"tab"===b||"line-break"===b));return d}function r(a){return l(a)||k(a)||c(a)}function d(a){var b=a&&a.localName,d=!1;b&&(a=a.namespaceURI,a===C&&(d="s"===b));return d}function a(a){return-1!==Y.indexOf(a.namespaceURI)}function m(b){if(l(b))return!1;if(s(b.parentNode)&&b.nodeType===Node.TEXT_NODE)return 0===b.textContent.length;for(b=b.firstChild;b;){if(a(b)||!m(b))return!1; b=b.nextSibling}return!0}function g(a){for(;null!==a.firstChild&&s(a);)a=a.firstChild;return a}function x(a){for(;null!==a.lastChild&&s(a);)a=a.lastChild;return a}function v(a){for(;!e(a)&&null===a.previousSibling;)a=a.parentNode;return e(a)?null:x(a.previousSibling)}function z(a){for(;!e(a)&&null===a.nextSibling;)a=a.parentNode;return e(a)?null:g(a.nextSibling)}function y(a){for(var b=!1;a;)if(a.nodeType===Node.TEXT_NODE)if(0===a.length)a=v(a);else return!n(a.data.substr(a.length-1,1));else r(a)? (b=!1===d(a),a=null):a=v(a);return b}function t(a){var b=!1,d;for(a=a&&g(a);a;){d=a.nodeType===Node.TEXT_NODE?a.length:0;if(0a.value||"%"===a.unit)?null:a}function D(a){return(a=B(a))&&"%"!==a.unit?null:a}function F(a){switch(a.namespaceURI){case odf.Namespaces.drawns:case odf.Namespaces.svgns:case odf.Namespaces.dr3dns:return!1;case odf.Namespaces.textns:switch(a.localName){case "note-body":case "ruby-text":return!1}break;case odf.Namespaces.officens:switch(a.localName){case "annotation":case "binary-data":case "event-listeners":return!1}break;default:switch(a.localName){case "cursor":case "editinfo":return!1}}return!0} function q(a,b){for(;0=b.value||"%"===b.unit)?null:b;return b||D(a)};this.parseFoLineHeight=function(a){return I(a)||D(a)};this.isTextContentContainingNode=F;this.getTextNodes=function(a,b){var d;d=H.getNodesInRange(a,function(a){var b=NodeFilter.FILTER_REJECT;a.nodeType===Node.TEXT_NODE?Boolean(p(a)&&(!n(a.textContent)||w(a,0)))&&(b=NodeFilter.FILTER_ACCEPT):F(a)&&(b=NodeFilter.FILTER_SKIP);return b},NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);b||q(a,d);return d};this.getTextElements=Q;this.getParagraphElements= function(a){var b;b=H.getNodesInRange(a,function(a){var b=NodeFilter.FILTER_REJECT;if(e(a))b=NodeFilter.FILTER_ACCEPT;else if(F(a)||s(a))b=NodeFilter.FILTER_SKIP;return b},NodeFilter.SHOW_ELEMENT);N(a.startContainer,b,e);return b};this.getImageElements=function(a){var b;b=H.getNodesInRange(a,function(a){var b=NodeFilter.FILTER_SKIP;f(a)&&(b=NodeFilter.FILTER_ACCEPT);return b},NodeFilter.SHOW_ELEMENT);N(a.startContainer,b,f);return b};this.getHyperlinkElements=function(a){var d=[],c=a.cloneRange(); a.collapsed&&a.endContainer.nodeType===Node.ELEMENT_NODE&&(a=U(a.endContainer,a.endOffset),a.nodeType===Node.TEXT_NODE&&c.setEnd(a,1));Q(c,!0,!1).forEach(function(a){for(a=a.parentNode;!e(a);){if(b(a)&&-1===d.indexOf(a)){d.push(a);break}a=a.parentNode}});c.detach();return d};this.getNormalizedFontFamilyName=function(a){/^(["'])(?:.|[\n\r])*?\1$/.test(a)||(a=a.replace(/^[ \t\r\n\f]*((?:.|[\n\r])*?)[ \t\r\n\f]*$/,"$1"),/[ \t\r\n\f]/.test(a)&&(a="'"+a.replace(/[ \t\r\n\f]+/g," ")+"'"));return a}};gui.AnnotatableCanvas=function(){};gui.AnnotatableCanvas.prototype.refreshSize=function(){};gui.AnnotatableCanvas.prototype.getZoomLevel=function(){};gui.AnnotatableCanvas.prototype.getSizer=function(){}; gui.AnnotationViewManager=function(f,k,c,b){function e(b){var d=b.annotationEndElement,c=l.createRange(),e=b.getAttributeNS(odf.Namespaces.officens,"name");d&&(c.setStart(b,b.childNodes.length),c.setEnd(d,0),b=r.getTextNodes(c,!1),b.forEach(function(b){var d;a:{for(d=b.parentNode;d.namespaceURI!==odf.Namespaces.officens||"body"!==d.localName;){if(d.namespaceURI===a&&"webodf-annotationHighlight"===d.className&&d.getAttribute("annotation")===e){d=!0;break a}d=d.parentNode}d=!1}d||(d=l.createElement("span"), d.className="webodf-annotationHighlight",d.setAttribute("annotation",e),b.parentNode.replaceChild(d,b),d.appendChild(b))}));c.detach()}function p(a){var b=f.getSizer();a?(c.style.display="inline-block",b.style.paddingRight=d.getComputedStyle(c).width):(c.style.display="none",b.style.paddingRight=0);f.refreshSize()}function h(){s.sort(function(a,b){return 0!==(a.compareDocumentPosition(b)&Node.DOCUMENT_POSITION_FOLLOWING)?-1:1})}function n(){var a;for(a=0;a=(l.getBoundingClientRect().top-p.bottom)/b?d.style.top=Math.abs(l.getBoundingClientRect().top-p.bottom)/b+20+"px":d.style.top="0px");h.style.left=e.getBoundingClientRect().width/ b+"px";var e=h.style,l=h.getBoundingClientRect().left/b,n=h.getBoundingClientRect().top/b,p=d.getBoundingClientRect().left/b,k=d.getBoundingClientRect().top/b,r=0,I=0,r=p-l,r=r*r,I=k-n,I=I*I,l=Math.sqrt(r+I);e.width=l+"px";n=Math.asin((d.getBoundingClientRect().top-h.getBoundingClientRect().top)/(b*parseFloat(h.style.width)));h.style.transform="rotate("+n+"rad)";h.style.MozTransform="rotate("+n+"rad)";h.style.WebkitTransform="rotate("+n+"rad)";h.style.msTransform="rotate("+n+"rad)"}}var s=[],l=k.ownerDocument, r=new odf.OdfUtils,d=runtime.getWindow(),a="http://www.w3.org/1999/xhtml";runtime.assert(Boolean(d),"Expected to be run in an environment which has a global window, like a browser.");this.rerenderAnnotations=n;this.rehighlightAnnotations=function(){s.forEach(function(a){e(a)})};this.getMinimumHeightForAnnotationPane=function(){return"none"!==c.style.display&&0 text|list-item:first-child > :not(text|list):first-child:before',u+="{",u+="counter-increment: "+r+" 0;",u+="}",f(b,u));for(;h.counterIdStack.length>=n;)h.counterIdStack.pop();h.counterIdStack.push(r);w=h.contentRules[n.toString()]||"";for(u=1;u<=n;u+=1)w=w.replace(u+"webodf-listLevel",h.counterIdStack[u-1]);u='text|list[webodfhelper|counter-id="'+k+'"] > text|list-item > :not(text|list):first-child:before'; u+="{";u+=w;u+="counter-increment: "+r+";";u+="}";f(b,u)}for(g=g.firstElementChild;g;)c(a,g,e,h),g=g.nextElementSibling}else h.continuedCounterIdStack=[]}var e=0,d="",a={};this.createCounterRules=function(b,d,f){var n=d.getAttributeNS(h,"id"),p=[];f&&(f=f.getAttributeNS("urn:webodf:names:helper","counter-id"),p=a[f].slice(0));b=new k(b,p);n?n="Y"+n:(e+=1,n="X"+e);c(n,d,0,b);a[n+"-level1-1"]=b.counterIdStack};this.initialiseCreatedCounters=function(){var a;a="office|document{"+("counter-reset: "+d+ ";");a+="}";f(b,a)}}var b=odf.Namespaces.fons,e=odf.Namespaces.stylens,p=odf.Namespaces.textns,h=odf.Namespaces.xmlns,n={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"};odf.ListStyleToCss=function(){function k(b){var d=m.parseLength(b);return d?a.convert(d.value,d.unit,"px"):(runtime.log("Could not parse value '"+b+"'."),0)}function l(a){return a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function r(a,b){var d;a&&(d=a.getAttributeNS(p,"style-name"));return d===b}function d(a, b,d){b=b.getElementsByTagNameNS(p,"list");a=new c(a);var f,m,k,s,w,B,I={},D;for(D=0;D text|list-item > text|list",x-=1;x=q&&q.getAttributeNS(b,"text-align")||"left";switch(x){case "end":x="right";break;case "start":x="left"}"label-alignment"===v?(U=N&&N.getAttributeNS(b,"margin-left")||"0px",S=N&&N.getAttributeNS(b,"text-indent")||"0px",H=N&&N.getAttributeNS(p,"label-followed-by"),N=k(U)):(U=q&&q.getAttributeNS(p,"space-before")||"0px",C=q&&q.getAttributeNS(p,"min-label-width")||"0px", $=q&&q.getAttributeNS(p,"min-label-distance")||"0px",N=k(U)+k(C));q=r+" > text|list-item";q+="{";q+="margin-left: "+N+"px;";q+="}";f(h,q);q=r+" > text|list-item > text|list";q+="{";q+="margin-left: "+-N+"px;";q+="}";f(h,q);q=r+" > text|list-item > :not(text|list):first-child:before";q+="{";q+="text-align: "+x+";";q+="display: inline-block;";"label-alignment"===v?(q+="margin-left: "+S+";","listtab"===H&&(q+="padding-right: 0.2cm;")):(q+="min-width: "+C+";",q+="margin-left: "+(0===parseFloat(C)?"": "-")+C+";",q+="padding-right: "+$+";");q+="}";f(h,q)}c=c.nextElementSibling}});d(a,h,m)}}})();odf.Style2CSS=function(){function f(a,b,d){var c=[];d=d.derivedStyles;var e;var q=g[a],h;void 0===q?b=null:(h=b?"["+q+'|style-name="'+b+'"]':"","presentation"===q&&(q="draw",h=b?'[presentation|style-name="'+b+'"]':""),b=q+"|"+x[a].join(h+","+q+"|")+h);null!==b&&c.push(b);for(e in d)d.hasOwnProperty(e)&&(b=f(a,e,d[e]),c=c.concat(b));return c}function k(a,b){var d="",c,g,e;for(c=0;ch.value&&(e="0.75pt"+m)}g[2]&&(d+=g[2]+":"+e+";")}return d}function c(a){return(a=m.getDirectChild(a,s,"text-properties"))?N.parseFoFontSize(a.getAttributeNS(h,"font-size")):null}function b(a,b,d,c){return b+b+d+d+c+c}function e(g,q,l,x){if("page"===q){var G=x.element;l="";var O,A;A=O="";var P=m.getDirectChild(G,s,"page-layout-properties"),J;if(P)if(J=G.getAttributeNS(s,"name"),l+=k(P,D),(O= m.getDirectChild(P,s,"background-image"))&&(A=O.getAttributeNS(d,"href"))&&(l=l+("background-image: url('odfkit:"+A+"');")+k(O,z)),"presentation"===U)for(G=(G=m.getDirectChild(G.parentNode.parentNode,n,"master-styles"))&&G.firstElementChild;G;)G.namespaceURI===s&&"master-page"===G.localName&&G.getAttributeNS(s,"page-layout-name")===J&&(A=G.getAttributeNS(s,"name"),O="draw|page[draw|master-page-name="+A+"] {"+l+"}",A="office|body, draw|page[draw|master-page-name="+A+"] {"+k(P,F)+" }",g.insertRule(O, g.cssRules.length),g.insertRule(A,g.cssRules.length)),G=G.nextElementSibling;else"text"===U&&(O="office|text {"+l+"}",A="office|body {width: "+P.getAttributeNS(h,"page-width")+";}",g.insertRule(O,g.cssRules.length),g.insertRule(A,g.cssRules.length))}else{l=f(q,l,x).join(",");P="";if(J=m.getDirectChild(x.element,s,"text-properties")){A=J;var X,M,G=X="";O=1;J=""+k(A,v);M=A.getAttributeNS(s,"text-underline-style");"solid"===M&&(X+=" underline");M=A.getAttributeNS(s,"text-line-through-style");"solid"=== M&&(X+=" line-through");X.length&&(J+="text-decoration:"+X+";");if(X=A.getAttributeNS(s,"font-name")||A.getAttributeNS(h,"font-family"))M=Q[X],J+="font-family: "+(M||X)+";";M=A.parentNode;if(A=c(M)){for(;M;){if(A=c(M)){if("%"!==A.unit){G="font-size: "+A.value*O+A.unit+";";break}O*=A.value/100}A=M;X=M="";M=null;"default-style"===A.localName?M=null:(M=A.getAttributeNS(s,"parent-style-name"),X=A.getAttributeNS(s,"family"),M=S.getODFElementsWithXPath(C,M?"//style:*[@style:name='"+M+"'][@style:family='"+ X+"']":"//style:default-style[@style:family='"+X+"']",odf.Namespaces.lookupNamespaceURI)[0])}G||(G="font-size: "+parseFloat($)*O+H.getUnits($)+";");J+=G}P+=J}if(J=m.getDirectChild(x.element,s,"paragraph-properties"))G=J,J=""+k(G,y),(O=m.getDirectChild(G,s,"background-image"))&&(A=O.getAttributeNS(d,"href"))&&(J=J+("background-image: url('odfkit:"+A+"');")+k(O,z)),(G=G.getAttributeNS(h,"line-height"))&&"normal"!==G&&(G=N.parseFoLineHeight(G),J="%"!==G.unit?J+("line-height: "+G.value+G.unit+";"):J+ ("line-height: "+G.value/100+";")),P+=J;if(J=m.getDirectChild(x.element,s,"graphic-properties"))A=J,J=""+k(A,t),G=A.getAttributeNS(p,"opacity"),O=A.getAttributeNS(p,"fill"),A=A.getAttributeNS(p,"fill-color"),"solid"===O||"hatch"===O?A&&"none"!==A?(G=isNaN(parseFloat(G))?1:parseFloat(G)/100,O=A.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,b),(A=(O=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(O))?{r:parseInt(O[1],16),g:parseInt(O[2],16),b:parseInt(O[3],16)}:null)&&(J+="background-color: rgba("+A.r+ ","+A.g+","+A.b+","+G+");")):J+="background: none;":"none"===O&&(J+="background: none;"),P+=J;if(J=m.getDirectChild(x.element,s,"drawing-page-properties"))G=""+k(J,t),"true"===J.getAttributeNS(a,"background-visible")&&(G+="background: none;"),P+=G;if(J=m.getDirectChild(x.element,s,"table-cell-properties"))J=""+k(J,u),P+=J;if(J=m.getDirectChild(x.element,s,"table-row-properties"))J=""+k(J,B),P+=J;if(J=m.getDirectChild(x.element,s,"table-column-properties"))J=""+k(J,w),P+=J;if(J=m.getDirectChild(x.element, s,"table-properties"))G=J,J=""+k(G,I),G=G.getAttributeNS(r,"border-model"),"collapsing"===G?J+="border-collapse:collapse;":"separating"===G&&(J+="border-collapse:separate;"),P+=J;0!==P.length&&g.insertRule(l+"{"+P+"}",g.cssRules.length)}for(var T in x.derivedStyles)x.derivedStyles.hasOwnProperty(T)&&e(g,q,T,x.derivedStyles[T])}var p=odf.Namespaces.drawns,h=odf.Namespaces.fons,n=odf.Namespaces.officens,s=odf.Namespaces.stylens,l=odf.Namespaces.svgns,r=odf.Namespaces.tablens,d=odf.Namespaces.xlinkns, a=odf.Namespaces.presentationns,m=new core.DomUtils,g={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"},x={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"]},v=[[h,"color","color"],[h,"background-color","background-color"],[h,"font-weight","font-weight"],[h,"font-style","font-style"]],z=[[s,"repeat","background-repeat"]],y=[[h,"background-color","background-color"],[h,"text-align","text-align"],[h,"text-indent","text-indent"],[h,"padding","padding"],[h,"padding-left","padding-left"],[h,"padding-right","padding-right"],[h,"padding-top","padding-top"],[h,"padding-bottom","padding-bottom"],[h,"border-left","border-left"],[h,"border-right", "border-right"],[h,"border-top","border-top"],[h,"border-bottom","border-bottom"],[h,"margin","margin"],[h,"margin-left","margin-left"],[h,"margin-right","margin-right"],[h,"margin-top","margin-top"],[h,"margin-bottom","margin-bottom"],[h,"border","border"]],t=[[h,"background-color","background-color"],[h,"min-height","min-height"],[p,"stroke","border"],[l,"stroke-color","border-color"],[l,"stroke-width","border-width"],[h,"border","border"],[h,"border-left","border-left"],[h,"border-right","border-right"], [h,"border-top","border-top"],[h,"border-bottom","border-bottom"]],u=[[h,"background-color","background-color"],[h,"border-left","border-left"],[h,"border-right","border-right"],[h,"border-top","border-top"],[h,"border-bottom","border-bottom"],[h,"border","border"]],w=[[s,"column-width","width"]],B=[[s,"row-height","height"],[h,"keep-together",null]],I=[[s,"width","width"],[h,"margin-left","margin-left"],[h,"margin-right","margin-right"],[h,"margin-top","margin-top"],[h,"margin-bottom","margin-bottom"]], D=[[h,"background-color","background-color"],[h,"padding","padding"],[h,"padding-left","padding-left"],[h,"padding-right","padding-right"],[h,"padding-top","padding-top"],[h,"padding-bottom","padding-bottom"],[h,"border","border"],[h,"border-left","border-left"],[h,"border-right","border-right"],[h,"border-top","border-top"],[h,"border-bottom","border-bottom"],[h,"margin","margin"],[h,"margin-left","margin-left"],[h,"margin-right","margin-right"],[h,"margin-top","margin-top"],[h,"margin-bottom","margin-bottom"]], F=[[h,"page-width","width"],[h,"page-height","height"]],q={border:!0,"border-left":!0,"border-right":!0,"border-top":!0,"border-bottom":!0,"stroke-width":!0},Q={},N=new odf.OdfUtils,U,C,$,S=xmldom.XPath,H=new core.CSSUnits;this.style2css=function(a,b,d,c,f){var q,h,m;for(C=b;d.cssRules.length;)d.deleteRule(d.cssRules.length-1);odf.Namespaces.forEachPrefix(function(a,b){q="@namespace "+a+" url("+b+");";try{d.insertRule(q,d.cssRules.length)}catch(c){}});Q=c;U=a;$=runtime.getWindow().getComputedStyle(document.body, null).getPropertyValue("font-size")||"12pt";for(m in g)if(g.hasOwnProperty(m))for(h in a=f[m],a)a.hasOwnProperty(h)&&e(d,m,h,a[h])}};(function(){function f(k,c){var b=this;this.getDistance=function(c){var f=b.x-c.x;c=b.y-c.y;return Math.sqrt(f*f+c*c)};this.getCenter=function(c){return new f((b.x+c.x)/2,(b.y+c.y)/2)};b.x=k;b.y=c}gui.ZoomHelper=function(){function k(b,d,c,g){b=g?"translate3d("+b+"px, "+d+"px, 0) scale3d("+c+", "+c+", 1)":"translate("+b+"px, "+d+"px) scale("+c+")";a.style.WebkitTransform=b;a.style.MozTransform=b;a.style.msTransform=b;a.style.OTransform=b;a.style.transform=b}function c(a){a?k(-m.x,-m.y,v,!0):(k(0, 0,v,!0),k(0,0,v,!1))}function b(a){if(t&&D){var b=t.style.overflow,d=t.classList.contains("webodf-customScrollbars");a&&d||!a&&!d||(a?(t.classList.add("webodf-customScrollbars"),t.style.overflow="hidden",runtime.requestAnimationFrame(function(){t.style.overflow=b})):t.classList.remove("webodf-customScrollbars"))}}function e(){k(-m.x,-m.y,v,!0);t.scrollLeft=0;t.scrollTop=0;F=u.style.overflow;u.style.overflow="visible";b(!1)}function p(){k(0,0,v,!0);t.scrollLeft=m.x;t.scrollTop=m.y;u.style.overflow= F||"";b(!0)}function h(b){return new f(b.pageX-a.offsetLeft,b.pageY-a.offsetTop)}function n(b){g&&(m.x-=b.x-g.x,m.y-=b.y-g.y,m=new f(Math.min(Math.max(m.x,a.offsetLeft),(a.offsetLeft+a.offsetWidth)*v-t.clientWidth),Math.min(Math.max(m.y,a.offsetTop),(a.offsetTop+a.offsetHeight)*v-t.clientHeight)));g=b}function s(a){var b=a.touches.length,d=0=d?f=e(a,d-1,c,!0):a.nodeType===Node.TEXT_NODE&& 0a?-1:1;for(a=Math.abs(a);0n?r.previousPosition():r.nextPosition());)if(S.check(),p.acceptPosition(r)===d&&(B+=1,s=r.container(),q=e(s,r.unfilteredDomOffset(),$),q.top!==N)){if(q.top!==C&&C!==N)break;C=q.top;q=Math.abs(U-q.left);if(null===I||qa?(g=n.previousPosition, f=-1):(g=n.nextPosition,f=1);for(h=e(n.container(),n.unfilteredDomOffset(),w);g.call(n);)if(b.acceptPosition(n)===d){if(l.getParagraphElement(n.getCurrentNode())!==r)break;p=e(n.container(),n.unfilteredDomOffset(),w);if(p.bottom!==h.bottom&&(h=p.top>=h.top&&p.bottomh.bottom,!h))break;s+=f;h=p}w.detach();return s}var l=new odf.OdfUtils,r,d=core.PositionFilter.FilterResult.FILTER_ACCEPT;this.getStepCounter=function(){return{convertForwardStepsBetweenFilters:p,convertBackwardStepsBetweenFilters:h, countLinesSteps:n,countStepsToLineBoundary:s}};(function(){r=gui.SelectionMover.createPositionIterator(k);var a=k.ownerDocument.createRange();a.setStart(r.container(),r.unfilteredDomOffset());a.collapse(!0);f.setSelectedRange(a)})()}; gui.SelectionMover.createPositionIterator=function(f){var k=new function(){this.acceptNode=function(c){return c&&"urn:webodf:names:cursor"!==c.namespaceURI&&"urn:webodf:names:editinfo"!==c.namespaceURI?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}};return new core.PositionIterator(f,5,k,!1)};ops.Document=function(){};ops.Document.prototype.getMemberIds=function(){};ops.Document.prototype.removeCursor=function(f){};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(f){};ops.Document.prototype.subscribe=function(f,k){};ops.Document.prototype.unsubscribe=function(f,k){}; ops.Document.prototype.getCanvas=function(){};ops.Document.prototype.createRootFilter=function(f){};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(f,k){var c=this,b={},e,p,h,n=new core.EventNotifier([ops.OdtCursor.signalCursorUpdated]);this.removeFromDocument=function(){h.remove()};this.subscribe=function(b,c){n.subscribe(b,c)};this.unsubscribe=function(b,c){n.unsubscribe(b,c)};this.getStepCounter=function(){return p.getStepCounter()};this.getMemberId=function(){return f};this.getNode=function(){return h.getNode()};this.getAnchorNode=function(){return h.getAnchorNode()};this.getSelectedRange=function(){return h.getSelectedRange()}; this.setSelectedRange=function(b,e){h.setSelectedRange(b,e);n.emit(ops.OdtCursor.signalCursorUpdated,c)};this.hasForwardSelection=function(){return h.hasForwardSelection()};this.getDocument=function(){return k};this.getSelectionType=function(){return e};this.setSelectionType=function(c){b.hasOwnProperty(c)?e=c:runtime.log("Invalid selection type: "+c)};this.resetSelectionType=function(){c.setSelectionType(ops.OdtCursor.RangeSelection)};h=new core.Cursor(k.getDOMDocument(),f);p=new gui.SelectionMover(h, k.getRootNode());b[ops.OdtCursor.RangeSelection]=!0;b[ops.OdtCursor.RegionSelection]=!0;c.resetSelectionType()};ops.OdtCursor.RangeSelection="Range";ops.OdtCursor.RegionSelection="Region";ops.OdtCursor.signalCursorUpdated="cursorUpdated";(function(){var f=0;ops.StepsCache=function(k,c,b){function e(a,d){var c=this;this.nodeId=a;this.steps=-1;this.node=d;this.previousBookmark=this.nextBookmark=null;this.setIteratorPosition=function(a){a.setPositionBeforeElement(d);b(c.steps,a)}}function p(a,d,c){var g=this;this.nodeId=a;this.steps=d;this.node=c;this.previousBookmark=this.nextBookmark=null;this.setIteratorPosition=function(a){a.setUnfilteredPosition(c,0);b(g.steps,a)}}function h(a,b){var d="["+a.nodeId;b&&(d+=" => "+b.nodeId);return d+ "]"}function n(){for(var a=z,b,d,c,e=new core.LoopWatchDog(0,1E5),f={};a;){e.check();(b=a.previousBookmark)?runtime.assert(b.nextBookmark===a,"Broken bookmark link to previous @"+h(b,a)):(runtime.assert(a===z,"Broken bookmark link @"+h(a)),runtime.assert(void 0===y||z===z||z.steps<=y,"Base point is damaged @"+h(a)));(d=a.nextBookmark)&&runtime.assert(d.previousBookmark===a,"Broken bookmark link to next @"+h(a,d));if(void 0===y||a===z||a.steps<=y)runtime.assert(v.containsNode(k,a.node),"Disconnected node is being reported as undamaged @"+ h(a)),b&&(c=a.node.compareDocumentPosition(b.node),runtime.assert(0===c||0!==(c&u),"Bookmark order with previous does not reflect DOM order @"+h(b,a))),d&&v.containsNode(k,d.node)&&(c=a.node.compareDocumentPosition(d.node),runtime.assert(0===c||0!==(c&t),"Bookmark order with next does not reflect DOM order @"+h(a,d)));a=a.nextBookmark}Object.keys(g).forEach(function(a){var b=g[a];(void 0===y||a<=y)&&runtime.assert(b.steps<=a,"Bookmark step of "+b.steps+" exceeds cached step lookup for "+a+" @"+h(b)); runtime.assert(!1===f.hasOwnProperty(b.nodeId),"Bookmark "+h(b)+" appears twice in cached step lookup at steps "+f[b.nodeId]+" and "+a);f[b.nodeId]=a})}function s(a){var b="";a.nodeType===Node.ELEMENT_NODE&&(b=a.getAttributeNS(m,"nodeId")||"");return b}function l(a){var b=f.toString();a.setAttributeNS(m,"nodeId",b);f+=1;return b}function r(a){var b,d,e=new core.LoopWatchDog(0,1E4);void 0!==y&&a>y&&(a=y);for(b=Math.floor(a/c)*c;!d&&0<=b;)d=g[b],b-=c;for(d=d||z;d.nextBookmark&&d.nextBookmark.steps<= a;)e.check(),d=d.nextBookmark;runtime.assert(-1===a||d.steps<=a,"Bookmark @"+h(d)+" at step "+d.steps+" exceeds requested step of "+a);return d}function d(a){a.previousBookmark&&(a.previousBookmark.nextBookmark=a.nextBookmark);a.nextBookmark&&(a.nextBookmark.previousBookmark=a.previousBookmark)}function a(a){for(var b,d=null;!d&&a&&a!==k;)(b=s(a))&&(d=x[b])&&d.node!==a&&(runtime.log("Cloned node detected. Creating new bookmark"),d=null,a.removeAttributeNS(m,"nodeId")),a=a.parentNode;return d}var m= "urn:webodf:names:steps",g={},x={},v=new core.DomUtils,z,y,t=Node.DOCUMENT_POSITION_FOLLOWING,u=Node.DOCUMENT_POSITION_PRECEDING,w;this.updateBookmark=function(a,b){var f,h=Math.ceil(a/c)*c,q,m,n;if(void 0!==y&&yq.steps)g[h]=m;w()};this.setToClosestStep=function(a,b){var d;w();d=r(a);d.setIteratorPosition(b); return d.steps};this.setToClosestDomPoint=function(b,d,c){var e,f;w();if(b===k&&0===d)e=z;else if(b===k&&d===k.childNodes.length)for(f in e=z,g)g.hasOwnProperty(f)&&(b=g[f],b.steps>e.steps&&(e=b));else if(e=a(b.childNodes.item(d)||b),!e)for(c.setUnfilteredPosition(b,d);!e&&c.previousNode();)e=a(c.getCurrentNode());e=e||z;void 0!==y&&e.steps>y&&(e=r(y));e.setIteratorPosition(c);return e.steps};this.damageCacheAfterStep=function(a){0>a&&(a=-1);void 0===y?y=a:ab)throw new RangeError("Requested steps is negative ("+b+")");h();for(d=l.setToClosestStep(b,a);dd.comparePoints(s,0,b,f),b=s,f=f?0:s.childNodes.length);a.setUnfilteredPosition(b,f);n(a,p)||a.setUnfilteredPosition(b,f);p=a.container();f=a.unfilteredDomOffset();b=l.setToClosestDomPoint(p,f,a);if(0>d.comparePoints(a.container(), a.unfilteredDomOffset(),p,f))return 0=l.textNode.length?null:l.textNode.splitText(l.offset));for(a=l.textNode;a!==d;){a=a.parentNode;m=a.cloneNode(!1);g&&m.appendChild(g);if(x)for(;x&&x.nextSibling;)m.appendChild(x.nextSibling);else for(;a.firstChild;)m.appendChild(a.firstChild);a.parentNode.insertBefore(m,a.nextSibling);x=a;g=m}h.isListItem(g)&&(g=g.childNodes.item(0));p?g.setAttributeNS(n,"text:style-name",p):g.removeAttributeNS(n,"style-name");0===l.textNode.length&& l.textNode.parentNode.removeChild(l.textNode);c.emit(ops.OdtDocument.signalStepsInserted,{position:b});v&&e&&(c.moveCursor(f,b+1,0),c.emit(ops.Document.signalCursorMoved,v));c.fixCursorPositions();c.getOdfCanvas().refreshSize();c.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:r,memberId:f,timeStamp:k});c.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:g,memberId:f,timeStamp:k});c.getOdfCanvas().rerenderAnnotations();return!0};this.spec=function(){return{optype:"SplitParagraph", memberid:f,timestamp:k,position:b,sourceParagraphPosition:c,paragraphStyleName:p,moveCursor:e}}};ops.OpUpdateMember=function(){function f(c){var e="//dc:creator[@editinfo:memberid='"+k+"']";c=xmldom.XPath.getODFElementsWithXPath(c.getRootNode(),e,function(b){return"editinfo"===b?"urn:webodf:names:editinfo":odf.Namespaces.lookupNamespaceURI(b)});for(e=0;e=p.width&&(p=null),e.detach();else if(f.isCharacterElement(b.container)|| f.isCharacterFrame(b.container))p=c.getBoundingClientRect(b.container);return p}};gui.Caret=function(f,k,c){function b(){l.style.opacity="0"===l.style.opacity?"1":"0";t.trigger()}function e(){m.selectNodeContents(a);return m.getBoundingClientRect()}function p(){Object.keys(I).forEach(function(a){D[a]=I[a]})}function h(){var a,b,h,m;if(!1===I.isShown||f.getSelectionType()!==ops.OdtCursor.RangeSelection||!c&&!f.getSelectedRange().collapsed)I.visibility="hidden",l.style.visibility="hidden",t.cancel();else{I.visibility="visible";l.style.visibility="visible";if(!1===I.isFocused)l.style.opacity= "1",t.cancel();else{if(u||D.visibility!==I.visibility)l.style.opacity="1",t.cancel();t.trigger()}if(B||w||D.visibility!==I.visibility){a=f.getNode();var k;h=x.getBoundingClientRect(g.getSizer());m=!1;if(0a.height&&(a={top:a.top-(8-a.height)/2,height:8,right:a.right});s.style.height=a.height+"px";s.style.top=a.top+"px";s.style.left=a.right+"px";d&&(a=runtime.getWindow().getComputedStyle(f.getNode(),null),a.font?d.style.font=a.font:(d.style.fontStyle=a.fontStyle,d.style.fontVariant=a.fontVariant,d.style.fontWeight= a.fontWeight,d.style.fontSize=a.fontSize,d.style.lineHeight=a.lineHeight,d.style.fontFamily=a.fontFamily))}if(w){k=f.getDocument().getCanvas().getElement().parentNode;var n;h=k.offsetWidth-k.clientWidth+5;m=k.offsetHeight-k.clientHeight+5;n=l.getBoundingClientRect();a=n.left-h;b=n.top-m;h=n.right+h;m=n.bottom+m;n=k.getBoundingClientRect();bn.bottom&&(k.scrollTop+=m-n.bottom);an.right&&(k.scrollLeft+=h-n.right)}}D.isFocused!==I.isFocused&& r.markAsFocussed(I.isFocused);p();B=w=u=!1}function n(b){s.parentNode.removeChild(s);a.parentNode.removeChild(a);b()}var s,l,r,d,a,m,g=f.getDocument().getCanvas(),x=new core.DomUtils,v=new gui.GuiStepUtils,z,y,t,u=!1,w=!1,B=!1,I={isFocused:!1,isShown:!0,visibility:"hidden"},D={isFocused:!I.isFocused,isShown:!I.isShown,visibility:"hidden"};this.handleUpdate=function(){B=!0;"hidden"!==I.visibility&&(I.visibility="hidden",l.style.visibility="hidden",f.getNode().removeAttributeNS("urn:webodf:names:cursor", "caret-sizer-active"));y.trigger()};this.refreshCursorBlinking=function(){u=!0;y.trigger()};this.setFocus=function(){I.isFocused=!0;y.trigger()};this.removeFocus=function(){I.isFocused=!1;y.trigger()};this.show=function(){I.isShown=!0;y.trigger()};this.hide=function(){I.isShown=!1;y.trigger()};this.setAvatarImageUrl=function(a){r.setImageUrl(a)};this.setColor=function(a){l.style.borderColor=a;r.setColor(a)};this.getCursor=function(){return f};this.getFocusElement=function(){return l};this.toggleHandleVisibility= function(){r.isVisible()?r.hide():r.show()};this.showHandle=function(){r.show()};this.hideHandle=function(){r.hide()};this.setOverlayElement=function(a){d=a;s.appendChild(a);B=!0;y.trigger()};this.ensureVisible=function(){w=!0;y.trigger()};this.destroy=function(a){core.Async.destroyAll([y.destroy,t.destroy,r.destroy,n],a)};(function(){var d=f.getDocument(),c=[d.createRootFilter(f.getMemberId()),d.getPositionFilter()],e=d.getDOMDocument();m=e.createRange();a=e.createElement("span");a.className="webodf-caretSizer"; a.textContent="|";f.getNode().appendChild(a);s=e.createElement("div");s.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",f.getMemberId());s.className="webodf-caretOverlay";l=e.createElement("div");l.className="caret";s.appendChild(l);r=new gui.Avatar(s,k);g.getSizer().appendChild(s);z=d.createStepIterator(f.getNode(),0,c,d.getRootNode());y=core.Task.createRedrawTask(h);t=core.Task.createTimeoutTask(b,500);y.triggerImmediate()})()};odf.TextSerializer=function(){function f(b){var e="",p=k.filter?k.filter.acceptNode(b):NodeFilter.FILTER_ACCEPT,h=b.nodeType,n;if((p===NodeFilter.FILTER_ACCEPT||p===NodeFilter.FILTER_SKIP)&&c.isTextContentContainingNode(b))for(n=b.firstChild;n;)e+=f(n),n=n.nextSibling;p===NodeFilter.FILTER_ACCEPT&&(h===Node.ELEMENT_NODE&&c.isParagraph(b)?e+="\n":h===Node.TEXT_NODE&&b.textContent&&(e+=b.textContent));return e}var k=this,c=new odf.OdfUtils;this.filter=null;this.writeToString=function(b){if(!b)return""; b=f(b);"\n"===b[b.length-1]&&(b=b.substr(0,b.length-1));return b}};gui.MimeDataExporter=function(){var f;this.exportRangeToDataTransfer=function(k,c){var b;b=c.startContainer.ownerDocument.createElement("span");b.appendChild(c.cloneContents());b=f.writeToString(b);try{k.setData("text/plain",b)}catch(e){k.setData("Text",b)}};f=new odf.TextSerializer;f.filter=new odf.OdfNodeFilter};gui.Clipboard=function(f){this.setDataFromRange=function(k,c){var b,e=k.clipboardData;b=runtime.getWindow();!e&&b&&(e=b.clipboardData);e?(b=!0,f.exportRangeToDataTransfer(e,c),k.preventDefault()):b=!1;return b}};gui.SessionContext=function(f,k){var c=f.getOdtDocument(),b=new odf.OdfUtils;this.isLocalCursorWithinOwnAnnotation=function(){var e=c.getCursor(k),f;if(!e)return!1;f=e&&e.getNode();e=c.getMember(k).getProperties().fullName;return(f=b.getParentAnnotation(f,c.getRootNode()))&&b.getAnnotationCreator(f)===e?!0:!1}};gui.StyleSummary=function(f){function k(b,c){var k=b+"|"+c,s;e.hasOwnProperty(k)||(s=[],f.forEach(function(e){e=(e=e.styleProperties[b])&&e[c];-1===s.indexOf(e)&&s.push(e)}),e[k]=s);return e[k]}function c(b,c,e){return function(){var f=k(b,c);return e.length>=f.length&&f.every(function(b){return-1!==e.indexOf(b)})}}function b(b,c){var e=k(b,c);return 1===e.length?e[0]:void 0}var e={};this.getPropertyValues=k;this.getCommonValue=b;this.isBold=c("style:text-properties","fo:font-weight",["bold"]);this.isItalic= c("style:text-properties","fo:font-style",["italic"]);this.hasUnderline=c("style:text-properties","style:text-underline-style",["solid"]);this.hasStrikeThrough=c("style:text-properties","style:text-line-through-style",["solid"]);this.fontSize=function(){var c=b("style:text-properties","fo:font-size");return c&&parseFloat(c)};this.fontName=function(){return b("style:text-properties","style:font-name")};this.isAlignedLeft=c("style:paragraph-properties","fo:text-align",["left","start"]);this.isAlignedCenter= c("style:paragraph-properties","fo:text-align",["center"]);this.isAlignedRight=c("style:paragraph-properties","fo:text-align",["right","end"]);this.isAlignedJustified=c("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(f,k,c,b,e,p,h){function n(){return P.value().styleSummary}function s(a){var b;a.collapsed?(b=a.startContainer,b.hasChildNodes()&&a.startOffseta.clientWidth||a.scrollHeight>a.clientHeight)&&b.push(new r(a)),a=a.parentNode;b.push(new l(t));return b}function y(){var a; g()||(a=z(D),v(),D.focus(),a.forEach(function(a){a.restore()}))}var t=runtime.getWindow(),u={beforecut:!0,beforepaste:!0,longpress:!0,drag:!0,dragstop:!0},w={mousedown:!0,mouseup:!0,focus:!0},B={},I={},D,F=f.getCanvas().getElement(),q=this,Q={};this.addFilter=function(a,b){d(a,!0).filters.push(b)};this.removeFilter=function(a,b){var c=d(a,!0),e=c.filters.indexOf(b);-1!==e&&c.filters.splice(e,1)};this.subscribe=a;this.unsubscribe=m;this.hasFocus=g;this.focus=y;this.getEventTrap=function(){return D}; this.setEditing=function(a){var b=g();b&&D.blur();a?D.removeAttribute("readOnly"):D.setAttribute("readOnly","true");b&&y()};this.destroy=function(a){m("touchstart",s);Object.keys(Q).forEach(function(a){b(parseInt(a,10))});Q.length=0;Object.keys(B).forEach(function(a){B[a].destroy()});B={};m("mousedown",x);m("mouseup",v);m("contextmenu",v);Object.keys(I).forEach(function(a){I[a].destroy()});I={};D.parentNode.removeChild(D);a()};(function(){var b=f.getOdfCanvas().getSizer(),d=b.ownerDocument;runtime.assert(Boolean(t), "EventManager requires a window object to operate correctly");D=d.createElement("input");D.id="eventTrap";D.setAttribute("tabindex","-1");D.setAttribute("readOnly","true");b.appendChild(D);a("mousedown",x);a("mouseup",v);a("contextmenu",v);B.longpress=new c("longpress",["touchstart","touchmove","touchend"],p);B.drag=new c("drag",["touchstart","touchmove","touchend"],h);B.dragstop=new c("dragstop",["drag","touchend"],n);a("touchstart",s)})()};gui.IOSSafariSupport=function(f){function k(){c.innerHeight!==c.outerHeight&&(b.style.display="none",runtime.requestAnimationFrame(function(){b.style.display="block"}))}var c=runtime.getWindow(),b=f.getEventTrap();this.destroy=function(c){f.unsubscribe("focus",k);b.removeAttribute("autocapitalize");b.style.WebkitTransform="";c()};f.subscribe("focus",k);b.setAttribute("autocapitalize","off");b.style.WebkitTransform="translateX(-10000px)"};gui.HyperlinkController=function(f,k,c,b){function e(){var b=!0;!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)&&(b=c.isLocalCursorWithinOwnAnnotation());b!==l&&(l=b,s.emit(gui.HyperlinkController.enabledChanged,l))}function p(c){c.getMemberId()===b&&e()}var h=new odf.OdfUtils,n=f.getOdtDocument(),s=new core.EventNotifier([gui.HyperlinkController.enabledChanged]),l=!1;this.isEnabled=function(){return l};this.subscribe=function(b,d){s.subscribe(b,d)};this.unsubscribe=function(b,d){s.unsubscribe(b, d)};this.addHyperlink=function(c,d){if(l){var a=n.getCursorSelection(b),e=new ops.OpApplyHyperlink,g=[];if(0===a.length||d)d=d||c,e=new ops.OpInsertText,e.init({memberid:b,position:a.position,text:d}),a.length=d.length,g.push(e);e=new ops.OpApplyHyperlink;e.init({memberid:b,position:a.position,length:a.length,hyperlink:c});g.push(e);f.enqueue(g)}};this.removeHyperlinks=function(){if(l){var c=gui.SelectionMover.createPositionIterator(n.getRootNode()),d=n.getCursor(b).getSelectedRange(),a=h.getHyperlinkElements(d), e=d.collapsed&&1===a.length,g=n.getDOMDocument().createRange(),k=[],p,s;0!==a.length&&(a.forEach(function(a){g.selectNodeContents(a);p=n.convertDomToCursorRange({anchorNode:g.startContainer,anchorOffset:g.startOffset,focusNode:g.endContainer,focusOffset:g.endOffset});s=new ops.OpRemoveHyperlink;s.init({memberid:b,position:p.position,length:p.length});k.push(s)}),e||(e=a[0],-1===d.comparePoint(e,0)&&(g.setStart(e,0),g.setEnd(d.startContainer,d.startOffset),p=n.convertDomToCursorRange({anchorNode:g.startContainer, anchorOffset:g.startOffset,focusNode:g.endContainer,focusOffset:g.endOffset}),0h.width&&(p=h.width/k.width);k.height>h.height&&(y=h.height/k.height);h=Math.min(p,y);k={width:k.width*h,height:k.height*h}}h=k.width+ "px";k=k.height+"px";var t=l.getOdfCanvas().odfContainer().rootElement.styles,p=d.toLowerCase(),y=n.hasOwnProperty(p)?n[p]:null,u,p=[];runtime.assert(null!==y,"Image type is not supported: "+d);y="Pictures/"+e.generateImageName()+y;u=new ops.OpSetBlob;u.init({memberid:b,filename:y,mimetype:d,content:c});p.push(u);r.getStyleElement("Graphics","graphic",[t])||(d=new ops.OpAddStyle,d.init({memberid:b,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"}}}),p.push(d));d=e.generateStyleName();c=new ops.OpAddStyle;c.init({memberid:b,styleName:d,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"}}});p.push(c);u=new ops.OpInsertImage;u.init({memberid:b,position:l.getCursorPosition(b), filename:y,frameWidth:h,frameHeight:k,frameStyleName:d,frameName:e.generateFrameName()});p.push(u);f.enqueue(p)}};this.destroy=function(a){l.unsubscribe(ops.Document.signalCursorMoved,h);k.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,p);a()};l.subscribe(ops.Document.signalCursorMoved,h);k.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,p);p()};gui.ImageController.enabledChanged="enabled/changed";gui.ImageSelector=function(f){function k(){var c=f.getSizer(),k=e.createElement("div");k.id="imageSelector";k.style.borderWidth="1px";c.appendChild(k);b.forEach(function(b){var c=e.createElement("div");c.className=b;k.appendChild(c)});return k}var c=odf.Namespaces.svgns,b="topLeft topRight bottomRight bottomLeft topMiddle rightMiddle bottomMiddle leftMiddle".split(" "),e=f.getElement().ownerDocument,p=!1;this.select=function(b){var n,s,l=e.getElementById("imageSelector");l||(l=k());p=!0;n=l.parentNode; s=b.getBoundingClientRect();var r=n.getBoundingClientRect(),d=f.getZoomLevel();n=(s.left-r.left)/d-1;s=(s.top-r.top)/d-1;l.style.display="block";l.style.left=n+"px";l.style.top=s+"px";l.style.width=b.getAttributeNS(c,"width");l.style.height=b.getAttributeNS(c,"height")};this.clearSelection=function(){var b;p&&(b=e.getElementById("imageSelector"))&&(b.style.display="none");p=!1};this.isSelectorElement=function(b){var c=e.getElementById("imageSelector");return c?b===c||b.parentNode===c:!1}};(function(){function f(f){function c(b){h=b.which&&String.fromCharCode(b.which)===p;p=void 0;return!1===h}function b(){h=!1}function e(b){p=b.data;h=!1}var p,h=!1;this.destroy=function(h){f.unsubscribe("textInput",b);f.unsubscribe("compositionend",e);f.removeFilter("keypress",c);h()};f.subscribe("textInput",b);f.subscribe("compositionend",e);f.addFilter("keypress",c)}gui.InputMethodEditor=function(k,c){function b(b){a&&(b?a.getNode().setAttributeNS(d,"composing","true"):(a.getNode().removeAttributeNS(d, "composing"),x.textContent=""))}function e(){y&&(y=!1,b(!1),u.emit(gui.InputMethodEditor.signalCompositionEnd,{data:t}),t="")}function p(){e();a&&a.getSelectedRange().collapsed?m.value="":m.value=v;m.setSelectionRange(0,m.value.length)}function h(){c.hasFocus()&&z.trigger()}function n(){w=void 0;z.cancel();b(!0);y||u.emit(gui.InputMethodEditor.signalCompositionStart,{data:""})}function s(a){a=w=a.data;y=!0;t+=a;z.trigger()}function l(a){a.data!==w&&(a=a.data,y=!0,t+=a,z.trigger());w=void 0}function r(){x.textContent= m.value}var d="urn:webodf:names:cursor",a=null,m=c.getEventTrap(),g=m.ownerDocument,x,v="b",z,y=!1,t="",u=new core.EventNotifier([gui.InputMethodEditor.signalCompositionStart,gui.InputMethodEditor.signalCompositionEnd]),w,B=[],I;this.subscribe=u.subscribe;this.unsubscribe=u.unsubscribe;this.registerCursor=function(b){b.getMemberId()===k&&(a=b,a.getNode().appendChild(x),b.subscribe(ops.OdtCursor.signalCursorUpdated,h),c.subscribe("input",r),c.subscribe("compositionupdate",r))};this.removeCursor=function(b){a&& b===k&&(a.getNode().removeChild(x),a.unsubscribe(ops.OdtCursor.signalCursorUpdated,h),c.unsubscribe("input",r),c.unsubscribe("compositionupdate",r),a=null)};this.destroy=function(a){c.unsubscribe("compositionstart",n);c.unsubscribe("compositionend",s);c.unsubscribe("textInput",l);c.unsubscribe("keypress",e);c.unsubscribe("focus",p);core.Async.destroyAll(I,a)};(function(){c.subscribe("compositionstart",n);c.subscribe("compositionend",s);c.subscribe("textInput",l);c.subscribe("keypress",e);c.subscribe("focus", p);B.push(new f(c));I=B.map(function(a){return a.destroy});x=g.createElement("span");x.setAttribute("id","composer");z=core.Task.createTimeoutTask(p,1);I.push(z.destroy)})()};gui.InputMethodEditor.signalCompositionStart="input/compositionstart";gui.InputMethodEditor.signalCompositionEnd="input/compositionend"})();gui.MetadataController=function(f,k){function c(b){p.emit(gui.MetadataController.signalMetadataChanged,b)}function b(b){var c=-1===h.indexOf(b);c||runtime.log("Setting "+b+" is restricted.");return c}var e=f.getOdtDocument(),p=new core.EventNotifier([gui.MetadataController.signalMetadataChanged]),h=["dc:creator","dc:date","meta:editing-cycles","meta:editing-duration","meta:document-statistic"];this.setMetadata=function(c,e){var h={},p="",d;c&&Object.keys(c).filter(b).forEach(function(a){h[a]=c[a]}); e&&(p=e.filter(b).join(","));if(0b?a.previousSibling:a.nextSibling,d(h)===NodeFilter.FILTER_ACCEPT&&(c=h),a=a.parentNode;return c}function b(a,b){var d;return null===a?m.NO_NEIGHBOUR:h.isCharacterElement(a)?m.SPACE_CHAR:a.nodeType===e||h.isTextSpan(a)||h.isHyperlink(a)?(d=a.textContent.charAt(b()),s.test(d)?m.SPACE_CHAR:n.test(d)?m.PUNCTUATION_CHAR:m.WORD_CHAR):m.OTHER}var e=Node.TEXT_NODE,p=Node.ELEMENT_NODE, h=new odf.OdfUtils,n=/[!-#%-*,-\/:-;?-@\[-\]_{}\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]/, s=/\s/,l=core.PositionFilter.FilterResult.FILTER_ACCEPT,r=core.PositionFilter.FilterResult.FILTER_REJECT,d=odf.WordBoundaryFilter.IncludeWhitespace.TRAILING,a=odf.WordBoundaryFilter.IncludeWhitespace.LEADING,m={NO_NEIGHBOUR:0,SPACE_CHAR:1,PUNCTUATION_CHAR:2,WORD_CHAR:3,OTHER:4};this.acceptPosition=function(e){var f=e.container(),h=e.leftNode(),n=e.rightNode(),s=e.unfilteredDomOffset,t=function(){return e.unfilteredDomOffset()-1};f.nodeType===p&&(null===n&&(n=c(f,1,e.getNodeFilter())),null===h&&(h= c(f,-1,e.getNodeFilter())));f!==n&&(s=function(){return 0});f!==h&&null!==h&&(t=function(){return h.textContent.length-1});f=b(h,t);n=b(n,s);return f===m.WORD_CHAR&&n===m.WORD_CHAR||f===m.PUNCTUATION_CHAR&&n===m.PUNCTUATION_CHAR||k===d&&f!==m.NO_NEIGHBOUR&&n===m.SPACE_CHAR||k===a&&f===m.SPACE_CHAR&&n!==m.NO_NEIGHBOUR?r:l}};odf.WordBoundaryFilter.IncludeWhitespace={None:0,TRAILING:1,LEADING:2};gui.SelectionController=function(f,k){function c(a,b,d){d=new odf.WordBoundaryFilter(v,d);var c=v.getRootElement(a)||v.getRootNode(),e=v.createRootFilter(c);return v.createStepIterator(a,b,[t,e,d],c)}function b(a,b){return b?{anchorNode:a.startContainer,anchorOffset:a.startOffset,focusNode:a.endContainer,focusOffset:a.endOffset}:{anchorNode:a.endContainer,anchorOffset:a.endOffset,focusNode:a.startContainer,focusOffset:a.startOffset}}function e(a,b,d){var c=new ops.OpMoveCursor;c.init({memberid:k, position:a,length:b||0,selectionType:d});return c}function p(a,d,c){var g;g=v.getCursor(k);g=b(g.getSelectedRange(),g.hasForwardSelection());g.focusNode=a;g.focusOffset=d;c||(g.anchorNode=g.focusNode,g.anchorOffset=g.focusOffset);a=v.convertDomToCursorRange(g);f.enqueue([e(a.position,a.length)])}function h(a){var b;b=c(a.startContainer,a.startOffset,B);b.roundToPreviousStep()&&a.setStart(b.container(),b.offset());b=c(a.endContainer,a.endOffset,I);b.roundToNextStep()&&a.setEnd(b.container(),b.offset())} function n(a){var b=y.getParagraphElements(a),d=b[0],b=b[b.length-1];d&&a.setStart(d,0);b&&(y.isParagraph(a.endContainer)&&0===a.endOffset?a.setEndBefore(b):a.setEnd(b,b.childNodes.length))}function s(a,b,d,c){var e,f;c?(e=d.startContainer,f=d.startOffset):(e=d.endContainer,f=d.endOffset);z.containsNode(a,e)||(f=0>z.comparePoints(a,0,e,f)?0:a.childNodes.length,e=a);a=v.createStepIterator(e,f,b,y.getParagraphElement(e)||a);a.roundToClosestStep()||runtime.assert(!1,"No step found in requested range"); c?d.setStart(a.container(),a.offset()):d.setEnd(a.container(),a.offset())}function l(a){var b=v.getCursorSelection(k),d=v.getCursor(k).getStepCounter();0!==a&&(a=0a.length&&(a.position+=a.length,a.length=-a.length);return a} function a(a){if(!v)return!1;var c,e=m.getCursor(b).getSelectedRange().cloneRange(),g=d(m.getCursorSelection(b)),h;if(0===g.length){g=void 0;c=m.getCursor(b).getNode();h=m.getRootElement(c);var l=[m.getPositionFilter(),m.createRootFilter(h)];h=m.createStepIterator(c,0,l,h);h.roundToClosestStep()&&(a?h.nextStep():h.previousStep())&&(g=d(m.convertDomToCursorRange({anchorNode:c,anchorOffset:0,focusNode:h.container(),focusOffset:h.offset()})),a?(e.setStart(c,0),e.setEnd(h.container(),h.offset())):(e.setStart(h.container(), h.offset()),e.setEnd(c,0)))}g&&f.enqueue(r(e));return void 0!==g}var m=f.getOdtDocument(),g=new odf.OdfUtils,x=new core.DomUtils,v=!1,z=odf.Namespaces.textns;this.isEnabled=function(){return v};this.enqueueParagraphSplittingOps=function(){if(!v)return!1;var a=m.getCursor(b),c=a.getSelectedRange(),e=d(m.getCursorSelection(b)),g=[],a=m.getParagraphElement(a.getNode()),h=a.getAttributeNS(z,"style-name")||"";0c.left&&(c=u(e)))b.focusNode=c.container,b.focusOffset=c.offset,d&&(b.anchorNode=b.focusNode,b.anchorOffset=b.focusOffset)}else E.isImage(b.focusNode.firstChild)&&1===b.focusOffset&&E.isCharacterFrame(b.focusNode)&&(c=u(b.focusNode))&&(b.anchorNode=b.focusNode=c.container,b.anchorOffset=b.focusOffset=c.offset);b.anchorNode&&b.focusNode&&(b=V.selectionToRange(b),V.selectRange(b.range,b.hasForwardSelection,0===a.button?a.detail:0));R.focus()}function B(a){var b;if(b=h(a.clientX,a.clientY))a= b.container,b=b.offset,a={anchorNode:a,anchorOffset:b,focusNode:a,focusOffset:b},a=V.selectionToRange(a),V.selectRange(a.range,a.hasForwardSelection,2),R.focus()}function I(a){var d=p(a),c,e,f;ja.processRequests();X&&(E.isImage(d)&&E.isCharacterFrame(d.parentNode)&&S.getSelection().isCollapsed?(V.selectImage(d.parentNode),R.focus()):la.isSelectorElement(d)?R.focus():T?(d=b.getSelectedRange(),e=d.collapsed,E.isImage(d.endContainer)&&0===d.endOffset&&E.isCharacterFrame(d.endContainer.parentNode)&&(f= d.endContainer.parentNode,f=u(f))&&(d.setEnd(f.container,f.offset),e&&d.collapse(!1)),V.selectRange(d,b.hasForwardSelection(),0===a.button?a.detail:0),R.focus()):ua?w(a):(c=W.cloneEvent(a),ia=runtime.setTimeout(function(){w(c)},0)),oa=0,T=X=!1)}function D(a){var b=H.getCursor(c).getSelectedRange();b.collapsed||G.exportRangeToDataTransfer(a.dataTransfer,b)}function F(){X&&R.focus();oa=0;T=X=!1}function q(a){I(a)}function Q(a){var b=p(a),d=null;"annotationRemoveButton"===b.className?(runtime.assert(ga, "Remove buttons are displayed on annotations while annotation editing is disabled in the controller."),d=W.getElementsByTagNameNS(b.parentNode,odf.Namespaces.officens,"annotation")[0],fa.removeAnnotation(d),R.focus()):"webodf-draggable"!==b.getAttribute("class")&&I(a)}function N(a){(a=a.data)&&(-1===a.indexOf("\n")?ea.insertText(a):ra.paste(a))}function U(a){return function(){a();return!0}}function C(a){return function(b){return H.getCursor(c).getSelectionType()===ops.OdtCursor.RangeSelection?a(b): !0}}function $(b){R.unsubscribe("keydown",A.handleEvent);R.unsubscribe("keypress",P.handleEvent);R.unsubscribe("keyup",J.handleEvent);R.unsubscribe("copy",l);R.unsubscribe("mousedown",t);R.unsubscribe("mousemove",ja.trigger);R.unsubscribe("mouseup",Q);R.unsubscribe("contextmenu",q);R.unsubscribe("dragstart",D);R.unsubscribe("dragend",F);R.unsubscribe("click",ma.handleClick);R.unsubscribe("longpress",B);R.unsubscribe("drag",v);R.unsubscribe("dragstop",z);H.unsubscribe(ops.OdtDocument.signalOperationEnd, da.trigger);H.unsubscribe(ops.Document.signalCursorAdded,ka.registerCursor);H.unsubscribe(ops.Document.signalCursorRemoved,ka.removeCursor);H.unsubscribe(ops.OdtDocument.signalOperationEnd,a);b()}var S=runtime.getWindow(),H=k.getOdtDocument(),Y=new gui.SessionConstraints,aa=new gui.SessionContext(k,c),W=new core.DomUtils,E=new odf.OdfUtils,G=new gui.MimeDataExporter,O=new gui.Clipboard(G),A=new gui.KeyboardHandler,P=new gui.KeyboardHandler,J=new gui.KeyboardHandler,X=!1,M=new odf.ObjectNameGenerator(H.getOdfCanvas().odfContainer(), c),T=!1,Z=null,ia,ba=null,R=new gui.EventManager(H),ga=e.annotationsEnabled,fa=new gui.AnnotationController(k,Y,c),ca=new gui.DirectFormattingController(k,Y,aa,c,M,e.directTextStylingEnabled,e.directParagraphStylingEnabled),ea=new gui.TextController(k,Y,aa,c,ca.createCursorStyleOp,ca.createParagraphStyleOps),na=new gui.ImageController(k,Y,aa,c,M),la=new gui.ImageSelector(H.getOdfCanvas()),ha=gui.SelectionMover.createPositionIterator(H.getRootNode()),ja,da,ra=new gui.PasteController(k,Y,aa,c),ka=new gui.InputMethodEditor(c, R),oa=0,ma=new gui.HyperlinkClickHandler(H.getOdfCanvas().getElement,A,J),ta=new gui.HyperlinkController(k,Y,aa,c),V=new gui.SelectionController(k,c),sa=new gui.MetadataController(k,c),K=gui.KeyboardHandler.Modifier,L=gui.KeyboardHandler.KeyCode,pa=-1!==S.navigator.appVersion.toLowerCase().indexOf("mac"),ua=-1!==["iPad","iPod","iPhone"].indexOf(S.navigator.platform),qa;runtime.assert(null!==S,"Expected to be run in an environment which has a global window, like a browser.");this.undo=g;this.redo= x;this.insertLocalCursor=function(){runtime.assert(void 0===k.getOdtDocument().getCursor(c),"Inserting local cursor a second time.");var a=new ops.OpAddCursor;a.init({memberid:c});k.enqueue([a]);R.focus()};this.removeLocalCursor=function(){runtime.assert(void 0!==k.getOdtDocument().getCursor(c),"Removing local cursor without inserting before.");var a=new ops.OpRemoveCursor;a.init({memberid:c});k.enqueue([a])};this.startEditing=function(){ka.subscribe(gui.InputMethodEditor.signalCompositionStart,ea.removeCurrentSelection); ka.subscribe(gui.InputMethodEditor.signalCompositionEnd,N);R.subscribe("beforecut",s);R.subscribe("cut",n);R.subscribe("beforepaste",d);R.subscribe("paste",r);ba&&ba.initialize();R.setEditing(!0);ma.setModifier(pa?K.Meta:K.Ctrl);A.bind(L.Backspace,K.None,U(ea.removeTextByBackspaceKey),!0);A.bind(L.Delete,K.None,ea.removeTextByDeleteKey);A.bind(L.Tab,K.None,C(function(){ea.insertText("\t");return!0}));pa?(A.bind(L.Clear,K.None,ea.removeCurrentSelection),A.bind(L.B,K.Meta,C(ca.toggleBold)),A.bind(L.I, K.Meta,C(ca.toggleItalic)),A.bind(L.U,K.Meta,C(ca.toggleUnderline)),A.bind(L.L,K.MetaShift,C(ca.alignParagraphLeft)),A.bind(L.E,K.MetaShift,C(ca.alignParagraphCenter)),A.bind(L.R,K.MetaShift,C(ca.alignParagraphRight)),A.bind(L.J,K.MetaShift,C(ca.alignParagraphJustified)),ga&&A.bind(L.C,K.MetaShift,fa.addAnnotation),A.bind(L.Z,K.Meta,g),A.bind(L.Z,K.MetaShift,x)):(A.bind(L.B,K.Ctrl,C(ca.toggleBold)),A.bind(L.I,K.Ctrl,C(ca.toggleItalic)),A.bind(L.U,K.Ctrl,C(ca.toggleUnderline)),A.bind(L.L,K.CtrlShift, C(ca.alignParagraphLeft)),A.bind(L.E,K.CtrlShift,C(ca.alignParagraphCenter)),A.bind(L.R,K.CtrlShift,C(ca.alignParagraphRight)),A.bind(L.J,K.CtrlShift,C(ca.alignParagraphJustified)),ga&&A.bind(L.C,K.CtrlAlt,fa.addAnnotation),A.bind(L.Z,K.Ctrl,g),A.bind(L.Z,K.CtrlShift,x));P.setDefault(C(function(a){var b;b=null===a.which||void 0===a.which?String.fromCharCode(a.keyCode):0!==a.which&&0!==a.charCode?String.fromCharCode(a.which):null;return!b||a.altKey||a.ctrlKey||a.metaKey?!1:(ea.insertText(b),!0)})); P.bind(L.Enter,K.None,C(ea.enqueueParagraphSplittingOps))};this.endEditing=function(){ka.unsubscribe(gui.InputMethodEditor.signalCompositionStart,ea.removeCurrentSelection);ka.unsubscribe(gui.InputMethodEditor.signalCompositionEnd,N);R.unsubscribe("cut",n);R.unsubscribe("beforecut",s);R.unsubscribe("paste",r);R.unsubscribe("beforepaste",d);R.setEditing(!1);ma.setModifier(K.None);A.bind(L.Backspace,K.None,function(){return!0},!0);A.unbind(L.Delete,K.None);A.unbind(L.Tab,K.None);pa?(A.unbind(L.Clear, K.None),A.unbind(L.B,K.Meta),A.unbind(L.I,K.Meta),A.unbind(L.U,K.Meta),A.unbind(L.L,K.MetaShift),A.unbind(L.E,K.MetaShift),A.unbind(L.R,K.MetaShift),A.unbind(L.J,K.MetaShift),ga&&A.unbind(L.C,K.MetaShift),A.unbind(L.Z,K.Meta),A.unbind(L.Z,K.MetaShift)):(A.unbind(L.B,K.Ctrl),A.unbind(L.I,K.Ctrl),A.unbind(L.U,K.Ctrl),A.unbind(L.L,K.CtrlShift),A.unbind(L.E,K.CtrlShift),A.unbind(L.R,K.CtrlShift),A.unbind(L.J,K.CtrlShift),ga&&A.unbind(L.C,K.CtrlAlt),A.unbind(L.Z,K.Ctrl),A.unbind(L.Z,K.CtrlShift));P.setDefault(null); P.unbind(L.Enter,K.None)};this.getInputMemberId=function(){return c};this.getSession=function(){return k};this.getSessionConstraints=function(){return Y};this.setUndoManager=function(a){ba&&ba.unsubscribe(gui.UndoManager.signalUndoStackChanged,m);if(ba=a)ba.setDocument(H),ba.setPlaybackFunction(k.enqueue),ba.subscribe(gui.UndoManager.signalUndoStackChanged,m)};this.getUndoManager=function(){return ba};this.getMetadataController=function(){return sa};this.getAnnotationController=function(){return fa}; this.getDirectFormattingController=function(){return ca};this.getHyperlinkClickHandler=function(){return ma};this.getHyperlinkController=function(){return ta};this.getImageController=function(){return na};this.getSelectionController=function(){return V};this.getTextController=function(){return ea};this.getEventManager=function(){return R};this.getKeyboardHandlers=function(){return{keydown:A,keypress:P}};this.destroy=function(a){var b=[ja.destroy,da.destroy,ca.destroy,ka.destroy,R.destroy,ma.destroy, ta.destroy,sa.destroy,ea.destroy,$];qa&&b.unshift(qa.destroy);runtime.clearTimeout(ia);core.Async.destroyAll(b,a)};ja=core.Task.createRedrawTask(y);da=core.Task.createRedrawTask(function(){var a=H.getCursor(c);if(a&&a.getSelectionType()===ops.OdtCursor.RegionSelection&&(a=E.getImageElements(a.getSelectedRange())[0])){la.select(a.parentNode);return}la.clearSelection()});A.bind(L.Left,K.None,C(V.moveCursorToLeft));A.bind(L.Right,K.None,C(V.moveCursorToRight));A.bind(L.Up,K.None,C(V.moveCursorUp));A.bind(L.Down, K.None,C(V.moveCursorDown));A.bind(L.Left,K.Shift,C(V.extendSelectionToLeft));A.bind(L.Right,K.Shift,C(V.extendSelectionToRight));A.bind(L.Up,K.Shift,C(V.extendSelectionUp));A.bind(L.Down,K.Shift,C(V.extendSelectionDown));A.bind(L.Home,K.None,C(V.moveCursorToLineStart));A.bind(L.End,K.None,C(V.moveCursorToLineEnd));A.bind(L.Home,K.Ctrl,C(V.moveCursorToDocumentStart));A.bind(L.End,K.Ctrl,C(V.moveCursorToDocumentEnd));A.bind(L.Home,K.Shift,C(V.extendSelectionToLineStart));A.bind(L.End,K.Shift,C(V.extendSelectionToLineEnd)); A.bind(L.Up,K.CtrlShift,C(V.extendSelectionToParagraphStart));A.bind(L.Down,K.CtrlShift,C(V.extendSelectionToParagraphEnd));A.bind(L.Home,K.CtrlShift,C(V.extendSelectionToDocumentStart));A.bind(L.End,K.CtrlShift,C(V.extendSelectionToDocumentEnd));pa?(A.bind(L.Left,K.Alt,C(V.moveCursorBeforeWord)),A.bind(L.Right,K.Alt,C(V.moveCursorPastWord)),A.bind(L.Left,K.Meta,C(V.moveCursorToLineStart)),A.bind(L.Right,K.Meta,C(V.moveCursorToLineEnd)),A.bind(L.Home,K.Meta,C(V.moveCursorToDocumentStart)),A.bind(L.End, K.Meta,C(V.moveCursorToDocumentEnd)),A.bind(L.Left,K.AltShift,C(V.extendSelectionBeforeWord)),A.bind(L.Right,K.AltShift,C(V.extendSelectionPastWord)),A.bind(L.Left,K.MetaShift,C(V.extendSelectionToLineStart)),A.bind(L.Right,K.MetaShift,C(V.extendSelectionToLineEnd)),A.bind(L.Up,K.AltShift,C(V.extendSelectionToParagraphStart)),A.bind(L.Down,K.AltShift,C(V.extendSelectionToParagraphEnd)),A.bind(L.Up,K.MetaShift,C(V.extendSelectionToDocumentStart)),A.bind(L.Down,K.MetaShift,C(V.extendSelectionToDocumentEnd)), A.bind(L.A,K.Meta,C(V.extendSelectionToEntireDocument))):(A.bind(L.Left,K.Ctrl,C(V.moveCursorBeforeWord)),A.bind(L.Right,K.Ctrl,C(V.moveCursorPastWord)),A.bind(L.Left,K.CtrlShift,C(V.extendSelectionBeforeWord)),A.bind(L.Right,K.CtrlShift,C(V.extendSelectionPastWord)),A.bind(L.A,K.Ctrl,C(V.extendSelectionToEntireDocument)));ua&&(qa=new gui.IOSSafariSupport(R));R.subscribe("keydown",A.handleEvent);R.subscribe("keypress",P.handleEvent);R.subscribe("keyup",J.handleEvent);R.subscribe("copy",l);R.subscribe("mousedown", t);R.subscribe("mousemove",ja.trigger);R.subscribe("mouseup",Q);R.subscribe("contextmenu",q);R.subscribe("dragstart",D);R.subscribe("dragend",F);R.subscribe("click",ma.handleClick);R.subscribe("longpress",B);R.subscribe("drag",v);R.subscribe("dragstop",z);H.subscribe(ops.OdtDocument.signalOperationEnd,da.trigger);H.subscribe(ops.Document.signalCursorAdded,ka.registerCursor);H.subscribe(ops.Document.signalCursorRemoved,ka.removeCursor);H.subscribe(ops.OdtDocument.signalOperationEnd,a)}})();gui.CaretManager=function(f){function k(b){return a.hasOwnProperty(b)?a[b]:null}function c(){return Object.keys(a).map(function(b){return a[b]})}function b(b){var d=a[b];d&&(delete a[b],b===f.getInputMemberId()&&f.getEventManager().unsubscribe("compositionupdate",d.handleUpdate),d.destroy(function(){}))}function e(a){a=a.getMemberId();a===f.getInputMemberId()&&(a=k(a))&&a.refreshCursorBlinking()}function p(){var a=k(f.getInputMemberId());x=!1;a&&a.ensureVisible()}function h(){var a=k(f.getInputMemberId()); a&&(a.handleUpdate(),x||(x=!0,g=runtime.setTimeout(p,50)))}function n(a){a.memberId===f.getInputMemberId()&&h()}function s(){var a=k(f.getInputMemberId());a&&a.setFocus()}function l(){var a=k(f.getInputMemberId());a&&a.removeFocus()}function r(){var a=k(f.getInputMemberId());a&&a.show()}function d(){var a=k(f.getInputMemberId());a&&a.hide()}var a={},m=runtime.getWindow(),g,x=!1;this.registerCursor=function(b,d,c){var e=b.getMemberId();d=new gui.Caret(b,d,c);c=f.getEventManager();a[e]=d;e===f.getInputMemberId()? (runtime.log("Starting to track input on new cursor of "+e),b.subscribe(ops.OdtCursor.signalCursorUpdated,h),c.subscribe("compositionupdate",d.handleUpdate),d.setOverlayElement(c.getEventTrap())):b.subscribe(ops.OdtCursor.signalCursorUpdated,d.handleUpdate);return d};this.getCaret=k;this.getCarets=c;this.destroy=function(h){var k=f.getSession().getOdtDocument(),p=f.getEventManager(),t=c().map(function(a){return a.destroy});runtime.clearTimeout(g);k.unsubscribe(ops.OdtDocument.signalParagraphChanged, n);k.unsubscribe(ops.Document.signalCursorMoved,e);k.unsubscribe(ops.Document.signalCursorRemoved,b);p.unsubscribe("focus",s);p.unsubscribe("blur",l);m.removeEventListener("focus",r,!1);m.removeEventListener("blur",d,!1);a={};core.Async.destroyAll(t,h)};(function(){var a=f.getSession().getOdtDocument(),c=f.getEventManager();a.subscribe(ops.OdtDocument.signalParagraphChanged,n);a.subscribe(ops.Document.signalCursorMoved,e);a.subscribe(ops.Document.signalCursorRemoved,b);c.subscribe("focus",s);c.subscribe("blur", l);m.addEventListener("focus",r,!1);m.addEventListener("blur",d,!1)})()};gui.EditInfoHandle=function(f){var k=[],c,b=f.ownerDocument,e=b.documentElement.namespaceURI;this.setEdits=function(f){k=f;var h,n,s,l;c.innerHTML="";for(f=0;fa?(n=c(1,0),s=c(0.5,1E4-a),l=c(0.2,2E4-a)):1E4<=a&&2E4>a?(n=c(0.5,0),l=c(0.2,2E4-a)):n=c(0.2,0)};this.getEdits=function(){return f.getEdits()};this.clearEdits= function(){f.clearEdits();p.setEdits([]);h.hasAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")&&h.removeAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")};this.getEditInfo=function(){return f};this.show=function(){h.style.display="block"};this.hide=function(){b.hideHandle();h.style.display="none"};this.showHandle=function(){p.show()};this.hideHandle=function(){p.hide()};this.destroy=function(b){runtime.clearTimeout(n);runtime.clearTimeout(s);runtime.clearTimeout(l);e.removeChild(h); p.destroy(function(d){d?b(d):f.destroy(b)})};(function(){var c=f.getOdtDocument().getDOMDocument();h=c.createElementNS(c.documentElement.namespaceURI,"div");h.setAttribute("class","editInfoMarker");h.onmouseover=function(){b.showHandle()};h.onmouseout=function(){b.hideHandle()};e=f.getNode();e.appendChild(h);p=new gui.EditInfoHandle(e);k||b.hide()})()};gui.HyperlinkTooltipView=function(f,k){var c=new core.DomUtils,b=new odf.OdfUtils,e=runtime.getWindow(),p,h,n;runtime.assert(null!==e,"Expected to be run in an environment which has a global window, like a browser.");this.showTooltip=function(s){var l=s.target||s.srcElement,r=f.getSizer(),d=f.getZoomLevel(),a;a:{for(;l;){if(b.isHyperlink(l))break a;if(b.isParagraph(l)||b.isInlineRoot(l))break;l=l.parentNode}l=null}if(l){c.containsNode(r,n)||r.appendChild(n);a=h;var m;switch(k()){case gui.KeyboardHandler.Modifier.Ctrl:m= runtime.tr("Ctrl-click to follow link");break;case gui.KeyboardHandler.Modifier.Meta:m=runtime.tr("\u2318-click to follow link");break;default:m=""}a.textContent=m;p.textContent=b.getHyperlinkTarget(l);n.style.display="block";a=e.innerWidth-n.offsetWidth-15;l=s.clientX>a?a:s.clientX+15;a=e.innerHeight-n.offsetHeight-10;s=s.clientY>a?a:s.clientY+10;r=r.getBoundingClientRect();l=(l-r.left)/d;s=(s-r.top)/d;n.style.left=l+"px";n.style.top=s+"px"}};this.hideTooltip=function(){n.style.display="none"};this.destroy= function(b){n.parentNode&&n.parentNode.removeChild(n);b()};(function(){var b=f.getElement().ownerDocument;p=b.createElement("span");h=b.createElement("span");p.className="webodf-hyperlinkTooltipLink";h.className="webodf-hyperlinkTooltipText";n=b.createElement("div");n.className="webodf-hyperlinkTooltip";n.appendChild(p);n.appendChild(h);f.getElement().appendChild(n)})()};gui.ShadowCursor=function(f){var k=f.getDOMDocument().createRange(),c=!0;this.removeFromDocument=function(){};this.getMemberId=function(){return gui.ShadowCursor.ShadowCursorMemberId};this.getSelectedRange=function(){return k};this.setSelectedRange=function(b,e){k=b;c=!1!==e};this.hasForwardSelection=function(){return c};this.getDocument=function(){return f};this.getSelectionType=function(){return ops.OdtCursor.RangeSelection};k.setStart(f.getRootNode(),0)};gui.ShadowCursor.ShadowCursorMemberId="";gui.SelectionView=function(f){};gui.SelectionView.prototype.rerender=function(){};gui.SelectionView.prototype.show=function(){};gui.SelectionView.prototype.hide=function(){};gui.SelectionView.prototype.destroy=function(f){};gui.SelectionViewManager=function(f){function k(){return Object.keys(c).map(function(b){return c[b]})}var c={};this.getSelectionView=function(b){return c.hasOwnProperty(b)?c[b]:null};this.getSelectionViews=k;this.removeSelectionView=function(b){c.hasOwnProperty(b)&&(c[b].destroy(function(){}),delete c[b])};this.hideSelectionView=function(b){c.hasOwnProperty(b)&&c[b].hide()};this.showSelectionView=function(b){c.hasOwnProperty(b)&&c[b].show()};this.rerenderSelectionViews=function(){Object.keys(c).forEach(function(b){c[b].rerender()})}; this.registerCursor=function(b,e){var k=b.getMemberId(),h=new f(b);e?h.show():h.hide();return c[k]=h};this.destroy=function(b){function c(h,k){k?b(k):h .webodf-draggable")}function s(a){var b,d;for(d in u)u.hasOwnProperty(d)&&(b=u[d],a? b.show():b.hide())}function l(a){e.getCarets().forEach(function(b){a?b.showHandle():b.hideHandle()})}function r(a){var b=a.getMemberId();a=a.getProperties();n(b,a.fullName,a.color);k===b&&n("","",a.color)}function d(a){var b=a.getMemberId(),d=c.getOdtDocument().getMember(b).getProperties();e.registerCursor(a,F,q);p.registerCursor(a,!0);if(a=e.getCaret(b))a.setAvatarImageUrl(d.imageUrl),a.setColor(d.color);runtime.log("+++ View here +++ eagerly created an Caret for '"+b+"'! +++")}function a(a){a=a.getMemberId(); var b=p.getSelectionView(k),d=p.getSelectionView(gui.ShadowCursor.ShadowCursorMemberId),c=e.getCaret(k);a===k?(d.hide(),b&&b.show(),c&&c.show()):a===gui.ShadowCursor.ShadowCursorMemberId&&(d.show(),b&&b.hide(),c&&c.hide())}function m(a){p.removeSelectionView(a)}function g(a){var b=a.paragraphElement,d=a.memberId;a=a.timeStamp;var e,f="",g=b.getElementsByTagNameNS(t,"editinfo").item(0);g?(f=g.getAttributeNS(t,"id"),e=u[f]):(f=Math.random().toString(),e=new ops.EditInfo(b,c.getOdtDocument()),e=new gui.EditInfoMarker(e, D),g=b.getElementsByTagNameNS(t,"editinfo").item(0),g.setAttributeNS(t,"id",f),u[f]=e);e.addEdit(d,new Date(a));I.trigger()}function x(){var a;""!==y.innerHTML&&(y.innerHTML="");!0===b.getState(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN)&&(a=c.getOdtDocument().getMember(k))&&(a=a.getProperties().fullName,y.appendChild(document.createTextNode(".annotationWrapper:not([creator = '"+a+"']) .annotationRemoveButton { display: none; }")))}function v(c){var e=Object.keys(u).map(function(a){return u[a]}); w.unsubscribe(ops.Document.signalMemberAdded,r);w.unsubscribe(ops.Document.signalMemberUpdated,r);w.unsubscribe(ops.Document.signalCursorAdded,d);w.unsubscribe(ops.Document.signalCursorRemoved,m);w.unsubscribe(ops.OdtDocument.signalParagraphChanged,g);w.unsubscribe(ops.Document.signalCursorMoved,a);w.unsubscribe(ops.OdtDocument.signalParagraphChanged,p.rerenderSelectionViews);w.unsubscribe(ops.OdtDocument.signalTableAdded,p.rerenderSelectionViews);w.unsubscribe(ops.OdtDocument.signalParagraphStyleModified, p.rerenderSelectionViews);b.unsubscribe(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN,x);w.unsubscribe(ops.Document.signalMemberAdded,x);w.unsubscribe(ops.Document.signalMemberUpdated,x);z.parentNode.removeChild(z);y.parentNode.removeChild(y);(function C(a,b){b?c(b):ab.length;a&&f(b);return a}function c(b,a){function c(f){b[f]===a&&e.push(f)}var e=[];b&&["style:parent-style-name","style:next-style-name"].forEach(c);return e}function b(b,a){function c(e){b[e]===a&&delete b[e]}b&&["style:parent-style-name","style:next-style-name"].forEach(c)}function e(b){var a={};Object.keys(b).forEach(function(c){a[c]="object"===typeof b[c]?e(b[c]):b[c]});return a}function p(b, a,c,e){var f,h=!1,k=!1,l,n=[];e&&e.attributes&&(n=e.attributes.split(","));b&&(c||0=a.position+a.length)){f=c?b:a;k=c?a:b;if(b.position!==a.position||b.length!==a.length)r=e(f),u=e(k);a=s(k.setProperties,null,f.setProperties,null,"style:text-properties");if(a.majorChanged||a.minorChanged)l=[],b=[],n=f.position+f.length,p=k.position+k.length,k.positionn?a.minorChanged&&(r=u,r.position=n,r.length=p-n,b.push(r),k.length=n-k.position):n>p&&a.majorChanged&&(r.position=p,r.length=n-p,l.push(r),f.length=p-f.position),f.setProperties&&h(f.setProperties)&&l.push(f),k.setProperties&&h(k.setProperties)&&b.push(k),c?(n=l,l=b):n=b}return{opSpecsA:n,opSpecsB:l}},InsertText:function(b,a){a.position<=b.position?b.position+=a.text.length:a.position<=b.position+b.length&&(b.length+= a.text.length);return{opSpecsA:[b],opSpecsB:[a]}},MergeParagraph:function(b,a){var c=b.position,e=b.position+b.length;c>=a.sourceStartPosition&&(c-=1);e>=a.sourceStartPosition&&(e-=1);b.position=c;b.length=e-c;return{opSpecsA:[b],opSpecsB:[a]}},MoveCursor:l,RemoveCursor:l,RemoveStyle:l,RemoveText:function(b,a){var c=b.position+b.length,e=a.position+a.length,f=[b],h=[a];e<=b.position?b.position-=a.length:a.positiona.position?b.position+=a.text.length:c?a.position+=b.text.length:b.position+=a.text.length;return{opSpecsA:[b],opSpecsB:[a]}},MergeParagraph:function(b, a){b.position>=a.sourceStartPosition?b.position-=1:(b.positionb.position&&(a.position+=b.text.length);return{opSpecsA:[b],opSpecsB:[a]}},SplitParagraph:function(b,a){b.position=b.sourceStartPosition&&(f-=1);c>=b.sourceStartPosition&&(c-=1);0<=a.length?(a.position=f,a.length=c-f):(a.position=c,a.length=f-c);return{opSpecsA:[b],opSpecsB:[a]}},RemoveCursor:l,RemoveMember:l,RemoveStyle:l,RemoveText:function(b,a){a.position>=b.sourceStartPosition?a.position-=1:(a.positionb.sourceStartPosition)a.position-=1;else if(a.position===b.destinationStartPosition||a.position===b.sourceStartPosition)a.position=b.destinationStartPosition,b.paragraphStyleName=a.styleName;return{opSpecsA:c,opSpecsB:e}},SplitParagraph:function(b,a){var c,e=[b],f=[a];a.position=b.destinationStartPosition&&a.position=b.sourceStartPosition&&(a.position-=1,a.sourceParagraphPosition-=1);return{opSpecsA:e,opSpecsB:f}}, UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},MoveCursor:{MoveCursor:l,RemoveCursor:function(b,a){return{opSpecsA:b.memberid===a.memberid?[]:[b],opSpecsB:[a]}},RemoveMember:l,RemoveStyle:l,RemoveText:function(b,a){var c=k(b),e=b.position+b.length,h=a.position+a.length;h<=b.position?b.position-=a.length:a.positiona.position?b.position+=1:b.position===a.sourceParagraphPosition&&(a.paragraphStyleName=b.styleName,h=e(b),h.position=a.position+1,c.push(h));return{opSpecsA:c,opSpecsB:f}},UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},SplitParagraph:{SplitParagraph:function(b, a,c){var e,f;b.position img {\n box-shadow: 0px 0px 5px rgb(90, 90, 90) inset;\n background-color: rgb(200, 200, 200);\n border-radius: 5px;\n border: 2px solid;\n height: 60px !important;\n width: 60px !important;\n display: block;\n margin: auto;\n}\n\n.webodf-caretOverlay .handle.active {\n opacity: 0.8;\n}\n\n.webodf-caretOverlay .handle:after {\n content: ' ';\n position: absolute;\n width: 0px;\n height: 0px;\n border-style: solid;\n border-width: 8.7px 5px 0 5px;\n border-color: black transparent transparent transparent;\n\n top: 100%;\n left: 43%;\n}\n\n.webodf-caretSizer {\n display: inline-block; /* inline-block is necessary so the width can be set to 0 */\n width: 0; /* the caret sizer shouldn't take up any horizontal space */\n visibility: hidden; /* \"hidden\" means the client rects are still calculated, but the node content is not shown */\n}\n\n/** Input Method Editor input pane & behaviours */\n/* not within a cursor */\n#eventTrap {\n height: auto;\n display: block;\n position: absolute;\n bottom: 0;\n right: 0;\n width: 1px;\n outline: none;\n opacity: 0;\n color: rgba(255, 255, 255, 0); /* hide the blinking caret by setting the colour to fully transparent */\n overflow: hidden; /* The overflow visibility is used to hide and show characters being entered */\n pointer-events: none;\n}\n\n/* within a cursor */\ncursor|cursor > #composer {\n text-decoration: underline;\n}\n\ncursor|cursor[cursor|caret-sizer-active=\"true\"],\ncursor|cursor[cursor|composing=\"true\"] {\n display: inline;\n}\n\neditinfo|editinfo {\n /* Empty or invisible display:inline elements respond very badly to mouse selection.\n Inline blocks are much more reliably selectable in Chrome & friends */\n display: inline-block;\n}\n\n.editInfoMarker {\n position: absolute;\n width: 10px;\n height: 100%;\n left: -20px;\n opacity: 0.8;\n top: 0;\n border-radius: 5px;\n background-color: transparent;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n}\n.editInfoMarker:hover {\n box-shadow: 0px 0px 8px rgba(0, 0, 0, 1);\n}\n\n.editInfoHandle {\n position: absolute;\n background-color: black;\n padding: 5px;\n border-radius: 5px;\n opacity: 0.8;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n bottom: 100%;\n margin-bottom: 10px;\n z-index: 3;\n left: -25px;\n}\n.editInfoHandle:after {\n content: ' ';\n position: absolute;\n width: 0px;\n height: 0px;\n border-style: solid;\n border-width: 8.7px 5px 0 5px;\n border-color: black transparent transparent transparent;\n\n top: 100%;\n left: 5px;\n}\n.editInfo {\n font-family: sans-serif;\n font-weight: normal;\n font-style: normal;\n text-decoration: none;\n color: white;\n width: 100%;\n height: 12pt;\n}\n.editInfoColor {\n float: left;\n width: 10pt;\n height: 10pt;\n border: 1px solid white;\n}\n.editInfoAuthor {\n float: left;\n margin-left: 5pt;\n font-size: 10pt;\n text-align: left;\n height: 12pt;\n line-height: 12pt;\n}\n.editInfoTime {\n float: right;\n margin-left: 30pt;\n font-size: 8pt;\n font-style: italic;\n color: yellow;\n height: 12pt;\n line-height: 12pt;\n}\n\n.annotationWrapper {\n display: inline;\n position: relative;\n}\n\n.annotationRemoveButton:before {\n content: '\u00d7';\n color: white;\n padding: 5px;\n line-height: 1em;\n}\n\n.annotationRemoveButton {\n width: 20px;\n height: 20px;\n border-radius: 10px;\n background-color: black;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n position: absolute;\n top: -10px;\n left: -10px;\n z-index: 3;\n text-align: center;\n font-family: sans-serif;\n font-style: normal;\n font-weight: normal;\n text-decoration: none;\n font-size: 15px;\n}\n.annotationRemoveButton:hover {\n cursor: pointer;\n box-shadow: 0px 0px 5px rgba(0, 0, 0, 1);\n}\n\n.annotationNote {\n width: 4cm;\n position: absolute;\n display: inline;\n z-index: 10;\n top: 0;\n}\n.annotationNote > office|annotation {\n display: block;\n text-align: left;\n}\n\n.annotationConnector {\n position: absolute;\n display: inline;\n top: 0;\n z-index: 2;\n border-top: 1px dashed brown;\n}\n.annotationConnector.angular {\n -moz-transform-origin: left top;\n -webkit-transform-origin: left top;\n -ms-transform-origin: left top;\n transform-origin: left top;\n}\n.annotationConnector.horizontal {\n left: 0;\n}\n.annotationConnector.horizontal:before {\n content: '';\n display: inline;\n position: absolute;\n width: 0px;\n height: 0px;\n border-style: solid;\n border-width: 8.7px 5px 0 5px;\n border-color: brown transparent transparent transparent;\n top: -1px;\n left: -5px;\n}\n\noffice|annotation {\n width: 100%;\n height: 100%;\n display: none;\n background: rgb(198, 238, 184);\n background: -moz-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: -webkit-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: -o-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: -ms-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: linear-gradient(180deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n box-shadow: 0 3px 4px -3px #ccc;\n}\n\noffice|annotation > dc|creator {\n display: block;\n font-size: 10pt;\n font-weight: normal;\n font-style: normal;\n font-family: sans-serif;\n color: white;\n background-color: brown;\n padding: 4px;\n}\noffice|annotation > dc|date {\n display: block;\n font-size: 10pt;\n font-weight: normal;\n font-style: normal;\n font-family: sans-serif;\n border: 4px solid transparent;\n color: black;\n}\noffice|annotation > text|list {\n display: block;\n padding: 5px;\n}\n\n/* This is very temporary CSS. This must go once\n * we start bundling webodf-default ODF styles for annotations.\n */\noffice|annotation text|p {\n font-size: 10pt;\n color: black;\n font-weight: normal;\n font-style: normal;\n text-decoration: none;\n font-family: sans-serif;\n}\n\n#annotationsPane {\n background-color: #EAEAEA;\n width: 4cm;\n height: 100%;\n display: none;\n position: absolute;\n outline: 1px solid #ccc;\n}\n\n.webodf-annotationHighlight {\n background-color: yellow;\n position: relative;\n}\n\n.webodf-selectionOverlay {\n position: absolute;\n pointer-events: none;\n top: 0;\n left: 0;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 15;\n}\n.webodf-selectionOverlay > polygon {\n fill-opacity: 0.3;\n stroke-opacity: 0.8;\n stroke-width: 1;\n fill-rule: evenodd;\n}\n\n.webodf-selectionOverlay > .webodf-draggable {\n fill-opacity: 0.8;\n stroke-opacity: 0;\n stroke-width: 8;\n pointer-events: all;\n display: none;\n\n -moz-transform-origin: center center;\n -webkit-transform-origin: center center;\n -ms-transform-origin: center center;\n transform-origin: center center;\n}\n\n#imageSelector {\n display: none;\n position: absolute;\n border-style: solid;\n border-color: black;\n}\n\n#imageSelector > div {\n width: 5px;\n height: 5px;\n display: block;\n position: absolute;\n border: 1px solid black;\n background-color: #ffffff;\n}\n\n#imageSelector > .topLeft {\n top: -4px;\n left: -4px;\n}\n\n#imageSelector > .topRight {\n top: -4px;\n right: -4px;\n}\n\n#imageSelector > .bottomRight {\n right: -4px;\n bottom: -4px;\n}\n\n#imageSelector > .bottomLeft {\n bottom: -4px;\n left: -4px;\n}\n\n#imageSelector > .topMiddle {\n top: -4px;\n left: 50%;\n margin-left: -2.5px; /* half of the width defined in #imageSelector > div */\n}\n\n#imageSelector > .rightMiddle {\n top: 50%;\n right: -4px;\n margin-top: -2.5px; /* half of the height defined in #imageSelector > div */\n}\n\n#imageSelector > .bottomMiddle {\n bottom: -4px;\n left: 50%;\n margin-left: -2.5px; /* half of the width defined in #imageSelector > div */\n}\n\n#imageSelector > .leftMiddle {\n top: 50%;\n left: -4px;\n margin-top: -2.5px; /* half of the height defined in #imageSelector > div */\n}\n\ndiv.webodf-customScrollbars::-webkit-scrollbar\n{\n width: 8px;\n height: 8px;\n background-color: transparent;\n}\n\ndiv.webodf-customScrollbars::-webkit-scrollbar-track\n{\n background-color: transparent;\n}\n\ndiv.webodf-customScrollbars::-webkit-scrollbar-thumb\n{\n background-color: #444;\n border-radius: 4px;\n}\n\n.webodf-hyperlinkTooltip {\n display: none;\n color: white;\n background-color: black;\n border-radius: 5px;\n box-shadow: 2px 2px 5px gray;\n padding: 3px;\n position: absolute;\n max-width: 210px;\n text-align: left;\n word-break: break-all;\n z-index: 16;\n}\n\n.webodf-hyperlinkTooltipText {\n display: block;\n font-weight: bold;\n}\n";