diff --git a/static/js/libs/webodf.js b/static/js/libs/webodf.js index 610a9d8a..95e55b48 100644 --- a/static/js/libs/webodf.js +++ b/static/js/libs/webodf.js @@ -40,602 +40,608 @@ @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){}; +var webodf_version="0.5.2";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,d,b){};Runtime.prototype.readFile=function(f,k,d){};Runtime.prototype.readFileSync=function(f,k){};Runtime.prototype.loadXML=function(f,k){};Runtime.prototype.writeFile=function(f,k,d){}; 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;eq?c.push(q):(l+=1,e=b[l],194<=q&&224>q?c.push((q&31)<<6|e&63):(l+=1,a=b[l],224<=q&&240>q?c.push((q&15)<<12|(e&63)<<6|a&63):(l+=1,m=b[l],240<=q&&245>q&&(q=(q&7)<<18|(e&63)<<12|(a&63)<<6|m&63,q-=65536,c.push((q>>10)+55296,(q&1023)+56320))))),1E3<=c.length&&(d+=String.fromCharCode.apply(null, +c),c.length=0);return d+String.fromCharCode.apply(null,c)}var c;"utf8"===k?c=b(f):("binary"!==k&&this.log("Unsupported encoding: "+k),c=d(f));return c};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(q){var e=q.length,a,m,g=0;for(a=0;am&&(g+=1,a+=1);return g}function d(q,e,a){var m=q.length,g,b;e=new Uint8Array(new ArrayBuffer(e));a?(e[0]=239,e[1]=187,e[2]=191,b=3):b=0;for(a=0;ag?(e[b]=g,b+=1):2048>g?(e[b]=192|g>>>6,e[b+1]=128|g&63,b+=2):55040>=g||57344<=g?(e[b]=224|g>>>12&15,e[b+1]=128|g>>>6&63,e[b+2]=128|g&63,b+=3):(a+=1,g=(g-55296<<10|q.charCodeAt(a)-56320)+65536, +e[b]=240|g>>>18&7,e[b+1]=128|g>>>12&63,e[b+2]=128|g>>>6&63,e[b+3]=128|g&63,b+=4);return e}function b(b){var e=b.length,a=new Uint8Array(new ArrayBuffer(e)),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=e.buffer&&!m.sendAsBinary?e.buffer:p.byteArrayToString(e,"binary");try{m.sendAsBinary?m.sendAsBinary(g):m.send(g)}catch(d){p.log("HUH? "+d+" "+e),a(d.message)}};this.deleteFile=function(b,e){delete n[b];var a=new XMLHttpRequest;a.open("DELETE",b,!0);a.onreadystatechange= +function(){4===a.readyState&&(200>a.status&&300<=a.status?e(a.responseText):e(null))};a.send(null)};this.loadXML=function(b,e){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?e(null,a.responseXML):e(a.responseText,null):e("File "+b+" is empty.",null))};try{a.send(null)}catch(m){e(m.message,null)}};this.isFile=function(b,e){p.getFileSize(b,function(a){e(-1!== +a)})};this.getFileSize=function(b,e){if(n.hasOwnProperty(b)&&"string"!==typeof n[b])e(n[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?e(parseInt(m,10)):l(b,"binary",function(a,m){a?e(-1):e(m.length)})}};a.send(null)}};this.log=c;this.assert=function(b,e,a){if(!b)throw c("alert","ASSERTION FAILED:\n"+e),a&&a(),e;};this.setTimeout=function(b,e){return setTimeout(function(){b()},e)};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){c("Calling exit with code "+String(b)+", but exit() is not implemented.")};this.getWindow=function(){return window};this.requestAnimationFrame= +function(b){var e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame,a=0;if(e)e.bind(window),a=e(b);else return setTimeout(b,15);return a};this.cancelAnimationFrame=function(b){var e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame;e?(e.bind(window),e(b)):clearTimeout(b)}} +function NodeJSRuntime(){function f(b){var d=b.length,l,e=new Uint8Array(new ArrayBuffer(d));for(l=0;l").implementation} +function RhinoRuntime(){function f(b,d){var c;void 0!==d?c=b:d=b;"alert"===c&&print("\n!!!!! ALERT !!!!!");print(d);"alert"===c&&print("!!!!! ALERT !!!!!")}var k=this,d={},b=d.javax.xml.parsers.DocumentBuilderFactory.newInstance(),c,h,r="";b.setValidating(!1);b.setNamespaceAware(!0);b.setExpandEntityReferences(!1);b.setSchema(null);h=d.org.xml.sax.EntityResolver({resolveEntity:function(b,c){var h=new d.java.io.FileReader(c);return new d.org.xml.sax.InputSource(h)}});c=b.newDocumentBuilder();c.setEntityResolver(h); +this.byteArrayFromString=function(b,d){var c,q=b.length,e=new Uint8Array(new ArrayBuffer(q));for(c=0;c>>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<>>18],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g>>>12&63],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g>>>6&63],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g& +63];e===b+1?(g=a[e]<<4,m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g>>>6],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g&63],m+="=="):e===b&&(g=a[e]<<10|a[e+1]<<2,m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g>>>12],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g>>>6&63],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g&63],m+="=");return m}function d(a){a=a.replace(/[^A-Za-z0-9+\/]+/g, +"");var m=a.length,e=new Uint8Array(new ArrayBuffer(3*m)),b=a.length%4,d=0,c,H;for(c=0;c>16,e[d+1]=H>>8&255,e[d+2]=H&255,d+=3;m=3*m-[0,0,2,1][b];return e.subarray(0,m)}function b(a){var g,m,e=a.length,b=0,d=new Uint8Array(new ArrayBuffer(3*e));for(g=0;gm?d[b++]=m:(2048>m?d[b++]=192|m>>>6:(d[b++]=224|m>>>12&15,d[b++]=128|m>>>6&63),d[b++]=128|m&63);return d.subarray(0, +b)}function c(a){var g,m,e,b,d=a.length,H=new Uint8Array(new ArrayBuffer(d)),c=0;for(g=0;gm?H[c++]=m:(g+=1,e=a[g],224>m?H[c++]=(m&31)<<6|e&63:(g+=1,b=a[g],H[c++]=(m&15)<<12|(e&63)<<6|b&63));return H.subarray(0,c)}function h(a){return k(f(a))}function r(a){return String.fromCharCode.apply(String,d(a))}function l(a){return c(f(a))}function p(a){a=c(a);for(var g="",m=0;mg?H+=String.fromCharCode(g):(d+=1,e=a.charCodeAt(d)&255,224>g?H+=String.fromCharCode((g&31)<<6|e&63):(d+=1,b=a.charCodeAt(d)&255,H+=String.fromCharCode((g&15)<<12|(e&63)<<6|b&63)));return H}function q(a,g){function m(){var d=b+1E5;d>a.length&&(d=a.length);e+=n(a,b,d);b=d;d=b===a.length;g(e,d)&&!d&&runtime.setTimeout(m,0)}var e="",b=0;1E5>a.length?g(n(a,0,a.length),!0):("string"!==typeof a&&(a=a.slice()),m())}function e(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,e;m=0;for(e=a.length;mc-b&&(c=Math.max(2*c,b+d),d=new Uint8Array(new ArrayBuffer(c)),d.set(h),h=d)}var d=this,b=0,c=1024,h=new Uint8Array(new ArrayBuffer(c));this.appendByteArrayWriter=function(b){d.appendByteArray(b.getByteArray())};this.appendByteArray=function(d){var c=d.length;k(c);h.set(d,b);b+=c};this.appendArray=function(d){var c=d.length;k(c);h.set(d,b);b+=c};this.appendUInt16LE=function(b){d.appendArray([b&255,b>>8&255])};this.appendUInt32LE=function(b){d.appendArray([b& +255,b>>8&255,b>>16&255,b>>24&255])};this.appendString=function(b){d.appendByteArray(runtime.byteArrayFromString(b,f))};this.getLength=function(){return b};this.getByteArray=function(){var d=new Uint8Array(new ArrayBuffer(b));d.set(h.subarray(0,b));return d}};core.CSSUnits=function(){var f=this,k={"in":1,cm:2.54,mm:25.4,pt:72,pc:12,px:96};this.convert=function(d,b,c){return d*k[c]/k[b]};this.convertMeasure=function(d,b){var c,h;d&&b&&(c=parseFloat(d),h=d.replace(c.toString(),""),c=f.convert(c,h,b));return c};this.getUnits=function(d){return d.substr(d.length-2,d.length)}};(function(){function f(){var b,c,h,f,l,p,k,q,e;void 0===d&&(c=(b=runtime.getWindow())&&b.document,p=c.documentElement,k=c.body,d={rangeBCRIgnoresElementBCR:!1,unscaledRangeClientRects:!1,elementBCRIgnoresBodyScroll:!1},c&&(f=c.createElement("div"),f.style.position="absolute",f.style.left="-99999px",f.style.transform="scale(2)",f.style["-webkit-transform"]="scale(2)",l=c.createElement("div"),f.appendChild(l),k.appendChild(f),b=c.createRange(),b.selectNode(l),d.rangeBCRIgnoresElementBCR=0===b.getClientRects().length, +l.appendChild(c.createTextNode("Rect transform test")),c=l.getBoundingClientRect(),h=b.getBoundingClientRect(),d.unscaledRangeClientRects=2=a.compareBoundaryPoints(Range.START_TO_START,g)&&0<=a.compareBoundaryPoints(Range.END_TO_END,g)}function h(a,g){return 0>=a.compareBoundaryPoints(Range.END_TO_START,g)&&0<=a.compareBoundaryPoints(Range.START_TO_END,g)}function r(a,g){var e=null;a.nodeType===Node.TEXT_NODE&&(0===a.length?(a.parentNode.removeChild(a),g.nodeType===Node.TEXT_NODE&&(e=g)):(g.nodeType===Node.TEXT_NODE&&(a.appendData(g.data),g.parentNode.removeChild(g)),e=a));return e} +function l(a){for(var g=a.parentNode;a.firstChild;)g.insertBefore(a.firstChild,a);g.removeChild(a);return g}function p(a,g){for(var e=a.parentNode,b=a.firstChild,d;b;)d=b.nextSibling,p(b,g),b=d;e&&g(a)&&l(a);return e}function n(a,g){return a===g||Boolean(a.compareDocumentPosition(g)&Node.DOCUMENT_POSITION_CONTAINED_BY)}function q(a,g){return f().unscaledRangeClientRects?a:a/g}function e(a,g,b){Object.keys(g).forEach(function(d){var c=d.split(":"),h=c[1],l=b(c[0]),c=g[d],f=typeof c;"object"===f?Object.keys(c).length&& +(d=l?a.getElementsByTagNameNS(l,h)[0]||a.ownerDocument.createElementNS(l,d):a.getElementsByTagName(h)[0]||a.ownerDocument.createElement(d),a.appendChild(d),e(d,c,b)):l&&(runtime.assert("number"===f||"string"===f,"attempting to map unsupported type '"+f+"' (key: "+d+")"),a.setAttributeNS(l,d,String(c)))})}var a=null;this.splitBoundaries=function(a){var g,e=[],d,c,h;if(a.startContainer.nodeType===Node.TEXT_NODE||a.endContainer.nodeType===Node.TEXT_NODE){d=a.endContainer;c=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,d,b){function c(){this.acceptNode=function(a){return!a||a.nodeType===m&&0===a.length?t:z}}function h(a){this.acceptNode=function(e){return!e||e.nodeType===m&&0===e.length?t:a.acceptNode(e)}}function r(){var a=q.currentNode,b=a.nodeType;e=b===m?a.length-1:b===g?1:0}function l(){if(null===q.previousSibling()){if(!q.parentNode()||q.currentNode===f)return q.firstChild(),!1;e=0}else r();return!0}function p(){var g=q.currentNode,b;b=a(g);if(g!==f)for(g=g.parentNode;g&& +g!==f;)a(g)===t&&(q.currentNode=g,b=t),g=g.parentNode;b===t?(e=1,g=n.nextPosition()):g=b===z?!0:n.nextPosition();g&&runtime.assert(a(q.currentNode)===z,"moveToAcceptedNode did not result in walker being on an accepted node");return g}var n=this,q,e,a,m=Node.TEXT_NODE,g=Node.ELEMENT_NODE,z=NodeFilter.FILTER_ACCEPT,t=NodeFilter.FILTER_REJECT;this.nextPosition=function(){var a=q.currentNode,b=a.nodeType;if(a===f)return!1;if(0===e&&b===g)null===q.firstChild()&&(e=1);else if(b===m&&e+1 "+a.length), +runtime.assert(0<=g,"Error in setPosition: "+g+" < 0"),g===a.length&&(q.nextSibling()?e=0:q.parentNode()?e=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 e;this.strm.avail_out=0;g=f.inflateInit2(this.strm,b.windowBits);if(g!==n.Z_OK)throw Error(q[g]);this.header=new a;f.inflateGetHeader(this.strm,this.header)};m.prototype.push=function(a,e){var b=this.strm,m=this.options.chunkSize,d,c,h,q,A;if(this.ended)return!1;c=e===~~e?e:!0===e?n.Z_FINISH:n.Z_NO_FLUSH;b.input="string"===typeof a?p.binstring2buf(a):a;b.next_in=0;b.avail_in=b.input.length;do{0===b.avail_out&&(b.output=new l.Buf8(m),b.next_out=0,b.avail_out=m);d=f.inflate(b,n.Z_NO_FLUSH); +if(d!==n.Z_STREAM_END&&d!==n.Z_OK)return this.onEnd(d),this.ended=!0,!1;if(b.next_out&&(0===b.avail_out||d===n.Z_STREAM_END||0===b.avail_in&&c===n.Z_FINISH))if("string"===this.options.to)h=p.utf8border(b.output,b.next_out),q=b.next_out-h,A=p.buf2string(b.output,h),b.next_out=q,b.avail_out=m-q,q&&l.arraySet(b.output,b.output,h,q,0),this.onData(A);else this.onData(l.shrinkBuf(b.output,b.next_out))}while((0e&&(a.subarray&&p||!a.subarray&&l))return String.fromCharCode.apply(null,f.shrinkBuf(a,e));for(var b="",d=0;dd;d++)e[d]=252<=d?6:248<= +d?5:240<=d?4:224<=d?3:192<=d?2:1;e[254]=e[254]=1;c.string2buf=function(a){var e,b,d,c,h,l=a.length,q=0;for(c=0;cb?1:2048>b?2:65536>b?3:4;e=new f.Buf8(q);for(c=h=0;hb?e[h++]=b:(2048>b?e[h++]=192|b>>>6:(65536>b?e[h++]=224|b>>>12:(e[h++]= +240|b>>>18,e[h++]=128|b>>>12&63),e[h++]=128|b>>>6&63),e[h++]=128|b&63);return e};c.buf2binstring=function(a){return h(a,a.length)};c.binstring2buf=function(a){for(var e=new f.Buf8(a.length),b=0,d=e.length;bc)q[d++]=c;else if(f=e[c],4c?q[d++]=c:(c-=65536,q[d++]= +55296|c>>10&1023,q[d++]=56320|c&1023)}return h(q,d)};c.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+e[a[g]]>b?g:b}},{"./common":2}],4:[function(d,b,c){b.exports=function(b,d,c,f){var n=b&65535|0;b=b>>>16&65535|0;for(var q=0;0!==c;){q=2E3c;c++){b=c;for(var h=0;8>h;h++)b=b&1?3988292384^b>>>1:b>>>1;d[c]=b}return d}();b.exports=function(b,d,c,f){c=f+c;for(b^= +-1;f>>8^h[(b^d[f])&255];return b^-1}},{}],7:[function(d,b,c){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(d,b,c){b.exports=function(b,d){var c,f,n,q,e,a,m,g,z,t,v,y,s,x,w,A,G,E,F,H,N,I,U,B;c=b.state;f=b.next_in;U=b.input;n=f+(b.avail_in-5);q=b.next_out;B=b.output;e=q-(d-b.avail_out);a=q+(b.avail_out-257);m=c.dmax;g=c.wsize;z=c.whave;t=c.wnext;v=c.window;y=c.hold;s=c.bits; +x=c.lencode;w=c.distcode;A=(1<s&&(y+=U[f++]<>>24;y>>>=F;s-=F;F=E>>>16&255;if(0===F)B[q++]=E&65535;else if(F&16){H=E&65535;if(F&=15)s>>=F,s-=F;15>s&&(y+=U[f++]<>>24;y>>>=F;s-=F;F=E>>>16&255;if(F&16){E&=65535;F&=15;sm){b.msg="invalid distance too far back"; +c.mode=30;break a}y>>>=F;s-=F;F=q-e;if(E>F){F=E-F;if(F>z&&c.sane){b.msg="invalid distance too far back";c.mode=30;break a}N=0;I=v;if(0===t){if(N+=g-F,F>3;f-=H;s-=H<<3;b.next_in=f;b.next_out=q;b.avail_in=f>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}function f(){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 e.Buf16(320);this.work= +new e.Buf16(288);this.distdyn=this.lendyn=null;this.was=this.back=this.sane=0}function l(a){var b;if(!a||!a.state)return v;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 e.Buf32(s);b.distcode=b.distdyn=new e.Buf32(x);b.sane=1;b.back=-1;return t}function p(a){var b;if(!a||!a.state)return v;b=a.state;b.wsize=0;b.whave=0;b.wnext=0;return l(a)}function n(a,b){var e,g;if(!a|| +!a.state)return v;g=a.state;0>b?(e=0,b=-b):(e=(b>>4)+1,48>b&&(b&=15));if(b&&(8>b||15s;){if(0===p)break a;p--;u+=f[l++]<>>8&255;c.check=m(c.check,O,2,0);s=u=0;c.mode=2;break}c.flags=0;c.head&&(c.head.done=!1);if(!(c.wrap&1)||(((u&255)<<8)+(u>>8))%31){b.msg="incorrect header check";c.mode=30;break}if(8!==(u&15)){b.msg="unknown compression method";c.mode=30;break}u>>>=4;s-=4;P=(u&15)+8;if(0===c.wbits)c.wbits=P;else if(P>c.wbits){b.msg="invalid window size";c.mode=30;break}c.dmax=1<s;){if(0===p)break a;p--;u+=f[l++]<>8&1);c.flags&512&&(O[0]=u&255,O[1]=u>>>8&255,c.check=m(c.check,O,2,0));s=u=0;c.mode=3;case 3:for(;32>s;){if(0===p)break a;p--;u+=f[l++]<>>8&255,O[2]=u>>>16&255,O[3]=u>>>24&255,c.check=m(c.check,O,4,0));s=u=0;c.mode=4;case 4:for(;16>s;){if(0===p)break a;p--;u+=f[l++]<>8);c.flags&512&&(O[0]=u&255,O[1]=u>>>8&255,c.check=m(c.check,O,2,0));s=u=0;c.mode=5;case 5:if(c.flags&1024){for(;16>s;){if(0===p)break a;p--;u+=f[l++]<>>8&255,c.check=m(c.check,O,2,0));s=u=0}else c.head&&(c.head.extra=null);c.mode=6;case 6:if(c.flags&1024&&(D=c.length,D>p&&(D=p),D&&(c.head&&(P=c.head.extra_len-c.length,c.head.extra||(c.head.extra=Array(c.head.extra_len)),e.arraySet(c.head.extra, +f,l,D,P)),c.flags&512&&(c.check=m(c.check,f,D,l)),p-=D,l+=D,c.length-=D),c.length))break a;c.length=0;c.mode=7;case 7:if(c.flags&2048){if(0===p)break a;D=0;do P=f[l+D++],c.head&&P&&65536>c.length&&(c.head.name+=String.fromCharCode(P));while(P&&Dc.length&&(c.head.comment+=String.fromCharCode(P));while(P&&D< +p);c.flags&512&&(c.check=m(c.check,f,D,l));p-=D;l+=D;if(P)break a}else c.head&&(c.head.comment=null);c.mode=9;case 9:if(c.flags&512){for(;16>s;){if(0===p)break a;p--;u+=f[l++]<>9&1,c.head.done=!0);b.adler=c.check=0;c.mode=12;break;case 10:for(;32>s;){if(0===p)break a;p--;u+=f[l++]<>>=s&7;s-=s&7;c.mode=27;break}for(;3>s;){if(0===p)break a;p--;u+=f[l++]<>>=1;s-=1;switch(u&3){case 0:c.mode=14;break;case 1:D=c;if(w){P=void 0;A=new e.Buf32(512);G=new e.Buf32(32);for(P=0;144>P;)D.lens[P++]=8;for(;256>P;)D.lens[P++]=9;for(;280>P;)D.lens[P++]=7;for(;288>P;)D.lens[P++]=8;z(1,D.lens,0,288,A,0,D.work,{bits:9});for(P=0;32>P;)D.lens[P++]=5;z(2,D.lens, +0,32,G,0,D.work,{bits:5});w=!1}D.lencode=A;D.lenbits=9;D.distcode=G;D.distbits=5;c.mode=20;if(6===d){u>>>=2;s-=2;break a}break;case 2:c.mode=17;break;case 3:b.msg="invalid block type",c.mode=30}u>>>=2;s-=2;break;case 14:u>>>=s&7;for(s-=s&7;32>s;){if(0===p)break a;p--;u+=f[l++]<>>16^65535)){b.msg="invalid stored block lengths";c.mode=30;break}c.length=u&65535;s=u=0;c.mode=15;if(6===d)break a;case 15:c.mode=16;case 16:if(D=c.length){D>p&&(D=p);D>n&&(D=n);if(0===D)break a;e.arraySet(q, +f,l,D,r);p-=D;l+=D;n-=D;r+=D;c.length-=D;break}c.mode=12;break;case 17:for(;14>s;){if(0===p)break a;p--;u+=f[l++]<>>=5;s-=5;c.ndist=(u&31)+1;u>>>=5;s-=5;c.ncode=(u&15)+4;u>>>=4;s-=4;if(286s;){if(0===p)break a;p--;u+=f[l++]<>>=3;s-=3}for(;19>c.have;)c.lens[V[c.have++]]=0;c.lencode=c.lendyn;c.lenbits=7; +D={bits:c.lenbits};J=z(0,c.lens,0,19,c.lencode,0,c.work,D);c.lenbits=D.bits;if(J){b.msg="invalid code lengths set";c.mode=30;break}c.have=0;c.mode=19;case 19:for(;c.have>>24;T=D>>>16&255;L=D&65535;if(C<=s)break;if(0===p)break a;p--;u+=f[l++]<L)u>>>=C,s-=C,c.lens[c.have++]=L;else{if(16===L){for(D=C+2;s>>=C;s-=C;if(0===c.have){b.msg="invalid bit length repeat";c.mode=30;break}P= +c.lens[c.have-1];D=3+(u&3);u>>>=2;s-=2}else if(17===L){for(D=C+3;s>>=C;s-=C;P=0;D=3+(u&7);u>>>=3;s-=3}else{for(D=C+7;s>>=C;s-=C;P=0;D=11+(u&127);u>>>=7;s-=7}if(c.have+D>c.nlen+c.ndist){b.msg="invalid bit length repeat";c.mode=30;break}for(;D--;)c.lens[c.have++]=P}}if(30===c.mode)break;if(0===c.lens[256]){b.msg="invalid code -- missing end-of-block";c.mode=30;break}c.lenbits=9;D={bits:c.lenbits};J=z(1,c.lens, +0,c.nlen,c.lencode,0,c.work,D);c.lenbits=D.bits;if(J){b.msg="invalid literal/lengths set";c.mode=30;break}c.distbits=6;c.distcode=c.distdyn;D={bits:c.distbits};J=z(2,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,D);c.distbits=D.bits;if(J){b.msg="invalid distances set";c.mode=30;break}c.mode=20;if(6===d)break a;case 20:c.mode=21;case 21:if(6<=p&&258<=n){b.next_out=r;b.avail_out=n;b.next_in=l;b.avail_in=p;c.hold=u;c.bits=s;g(b,x);r=b.next_out;q=b.output;n=b.avail_out;l=b.next_in;f=b.input;p=b.avail_in; +u=c.hold;s=c.bits;12===c.mode&&(c.back=-1);break}for(c.back=0;;){D=c.lencode[u&(1<>>24;T=D>>>16&255;L=D&65535;if(C<=s)break;if(0===p)break a;p--;u+=f[l++]<>P)];C=D>>>24;T=D>>>16&255;L=D&65535;if(P+C<=s)break;if(0===p)break a;p--;u+=f[l++]<>>=P;s-=P;c.back+=P}u>>>=C;s-=C;c.back+=C;c.length=L;if(0===T){c.mode=26;break}if(T&32){c.back=-1;c.mode=12;break}if(T&64){b.msg="invalid literal/length code"; +c.mode=30;break}c.extra=T&15;c.mode=22;case 22:if(c.extra){for(D=c.extra;s>>=c.extra;s-=c.extra;c.back+=c.extra}c.was=c.length;c.mode=23;case 23:for(;;){D=c.distcode[u&(1<>>24;T=D>>>16&255;L=D&65535;if(C<=s)break;if(0===p)break a;p--;u+=f[l++]<>P)];C=D>>>24;T=D>>>16&255;L=D&65535;if(P+C<=s)break;if(0===p)break a;p--;u+=f[l++]<>>=P;s-=P;c.back+=P}u>>>=C;s-=C;c.back+=C;if(T&64){b.msg="invalid distance code";c.mode=30;break}c.offset=L;c.extra=T&15;c.mode=24;case 24:if(c.extra){for(D=c.extra;s>>=c.extra;s-=c.extra;c.back+=c.extra}if(c.offset>c.dmax){b.msg="invalid distance too far back";c.mode=30;break}c.mode=25;case 25:if(0===n)break a;D=x-n;if(c.offset>D){D=c.offset-D;if(D>c.whave&&c.sane){b.msg="invalid distance too far back";c.mode=30;break}D> +c.wnext?(D-=c.wnext,P=c.wsize-D):P=c.wnext-D;D>c.length&&(D=c.length);X=c.window}else X=q,P=r-c.offset,D=c.length;D>n&&(D=n);n-=D;c.length-=D;do q[r++]=X[P++];while(--D);0===c.length&&(c.mode=21);break;case 26:if(0===n)break a;q[r++]=c.length;n--;c.mode=21;break;case 27:if(c.wrap){for(;32>s;){if(0===p)break a;p--;u|=f[l++]<s;){if(0===p)break a;p--;u+=f[l++]<c.mode&&(27>c.mode||4!==d))f=b.output,l=b.next_out,r=x-b.avail_out,n=b.state,null===n.window&&(n.wsize=1<=n.wsize?(e.arraySet(n.window,f,l-n.wsize,n.wsize,0),n.wnext=0,n.whave=n.wsize):(p=n.wsize-n.wnext,p>r&&(p=r),e.arraySet(n.window,f,l-r,p,n.wnext),(r-=p)?(e.arraySet(n.window,f,l-r,r,0),n.wnext=r,n.whave=n.wsize):(n.wnext+=p,n.wnext===n.wsize&&(n.wnext=0),n.whave=s;s++)Y[s]=0;for(x=0;xA&&(G=A);if(0===A)return g[d++]=20971520,g[d++]=20971520,v.bits=1,0;for(w=1;w=s;s++)if(H<<=1,H-=Y[s],0>H)return-1;if(0s;s++)E[s+1]=E[s]+Y[s];for(x=0;xu?(P=$[ea+t[x]],X=Z[Q+t[x]]):(P=96,X=0);H=1<>F)+U]=D<<24|P<<16|X|0;while(0!==U);for(H=1<>=1;0!==H?(I&=H-1,I+=H):I=0;x++;if(0===--Y[s]){if(s===A)break;s=e[a+t[x]]}if(s>G&&(I&c)!==B){0===F&&(F=G);y+=w;E=s-F;for(H=1<=H)break;E++;H<<=1}N+=1<";return runtime.parseXML(b)}; +core.UnitTest.cleanupTestAreaDiv=function(){var f=runtime.getWindow().document,k=f.getElementById("testarea");runtime.assert(!!k&&k.parentNode===f.body,'Test environment broken, found no div with id "testarea" below body.');f.body.removeChild(k)};core.UnitTest.createXmlDocument=function(f,k,d){var b="",b=b+("<"+f);Object.keys(d).forEach(function(c){b+=" xmlns:"+c+'="'+d[c]+'"'});b+=">";b+=k;b+="";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;x1/h?"-0":String(h),d(b+" should be "+a+". Was "+e+".")):d(b+" should be "+a+" (of type "+typeof a+"). Was "+ +h+" (of type "+typeof h+").")}var p=0,n,q,e=!1;this.resourcePrefix=function(){return f};this.beginExpectFail=function(){n=p;e=!0};this.endExpectFail=function(){var a=n===p;e=!1;p=n;a&&(p+=1,k.fail("Expected at least one failed test, but none registered."))};q=function(a,e){var c=Object.keys(a),f=Object.keys(e);c.sort();f.sort();return b(c,f)&&Object.keys(a).every(function(b){var c=a[b],g=e[b];return r(c,g)?!0:(d(c+" should be "+g+" for key "+b),!1)})};this.areNodesEqual=h;this.shouldBeNull=function(a, +b){l(a,b,"null")};this.shouldBeNonNull=function(a,b){var e,c;try{c=eval(b)}catch(f){e=f}e?d(b+" should be non-null. Threw exception "+e):null!==c?k.pass(b+" is non-null."):d(b+" should be non-null. Was "+c)};this.shouldBe=l;this.testFailed=d;this.countFailedTests=function(){return p};this.name=function(a){var b,e,c=[],d=a.length;c.length=d;for(b=0;b"+b+""}function k(b){d.reporter&&d.reporter(b)}var d=this,b=0,c=new core.UnitTestLogger,h={},r="BrowserRuntime"===runtime.type();this.resourcePrefix="";this.reporter=function(b){var c,d;r?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(e,'runSuite("'+e+'");')+": "+m.description()+""):runtime.log("Running "+e+": "+m.description);v=m.tests();for(z=0;z>>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", +2932959818,3654703836,1088359270,936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],e,c,g=a.length,d=0,d=0;e=-1;for(c=0;c>>8^d;return e^-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 c(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 h(a,e){var c,d,m,f,h,l,q,p=this;this.load=function(b){if(null!==p.data)b(null,p.data);else{var e=h+34+d+m+256;e+q>g&&(e=g-q);runtime.read(a,q,e,function(e,c){if(e||null===c)b(e,c);else a:{var g=c,d=new core.ByteArray(g),m=d.readUInt32LE(),q;if(67324752!==m)b("File entry signature is wrong."+m.toString()+" "+g.length.toString(),null);else{d.pos+=22;m=d.readUInt16LE();q=d.readUInt16LE();d.pos+=m+q;if(f){g= +g.subarray(d.pos,d.pos+h);if(h!==g.length){b("The amount of compressed bytes read was "+g.length.toString()+" instead of "+h.toString()+" for "+p.filename+" in "+a+".",null);break a}g=t(g,l)}else g=g.subarray(d.pos,d.pos+l);l!==g.length?b("The amount of bytes read was "+g.length.toString()+" instead of "+l.toString()+" for "+p.filename+" in "+a+".",null):(p.data=g,b(null,g))}}})}};this.set=function(a,b,e,c){p.filename=a;p.data=b;p.compressed=e;p.date=c};this.error=null;e&&(c=e.readUInt32LE(),33639248!== +c?this.error="Central directory entry has wrong signature at position "+(e.pos-4).toString()+' for file "'+a+'": '+e.data.length.toString():(e.pos+=6,f=e.readUInt16LE(),this.date=b(e.readUInt32LE()),e.readUInt32LE(),h=e.readUInt32LE(),l=e.readUInt32LE(),d=e.readUInt16LE(),m=e.readUInt16LE(),c=e.readUInt16LE(),e.pos+=8,q=e.readUInt32LE(),this.filename=runtime.byteArrayToString(e.data.subarray(e.pos,e.pos+d),"utf8"),this.data=null,e.pos+=d+m+c))}function r(a,b){if(22!==a.length)b("Central directory length should be 22.", +v);else{var e=new core.ByteArray(a),c;c=e.readUInt32LE();101010256!==c?b("Central directory signature is wrong: "+c.toString(),v):(c=e.readUInt16LE(),0!==c?b("Zip files with non-zero disk numbers are not supported.",v):(c=e.readUInt16LE(),0!==c?b("Zip files with non-zero disk numbers are not supported.",v):(c=e.readUInt16LE(),z=e.readUInt16LE(),c!==z?b("Number of entries is inconsistent.",v):(c=e.readUInt32LE(),e=e.readUInt16LE(),e=g-22-c,runtime.read(f,e,g-e,function(a,e){if(a||null===e)b(a,v);else a:{var c= +new core.ByteArray(e),g,d;m=[];for(g=0;gg?k("File '"+f+"' cannot be read.",v):runtime.read(f,g-22,22,function(a,b){a||null===k||null===b?k(a,v): +r(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,d.register(b))}var k={},d=new core.EventNotifier;this.registerConstraint=f;this.subscribe=function(b,c){f(b);d.subscribe(b,c)};this.unsubscribe=function(b,c){d.unsubscribe(b,c)};this.setState=function(b,c){runtime.assert(!0===k.hasOwnProperty(b),"No such constraint");k[b]!==c&&(k[b]=c,d.emit(b,c))};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}; +(function(){var f=odf.Namespaces.namespaceMap,k=odf.Namespaces.prefixMap,d;for(d in f)f.hasOwnProperty(d)&&(k[f[d]]=d)})();odf.Namespaces.forEachPrefix=function(f){var k=odf.Namespaces.namespaceMap,d;for(d in k)k.hasOwnProperty(d)&&f(d,k[d])};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=d&&a.push(k(b.substring(e,c)))):"["===b[c]&&(0>=d&&(e=c+1),d+=1),c+=1;return c};p=function(d,e,a){var f,g,h,p;for(f=0;f/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(" "), +{ens:g,en:"line",ans:y,a:"style-name"},{ens:g,en:"measure",ans:y,a:"style-name"},{ens:g,en:"page-thumbnail",ans:y,a:"style-name"},{ens:g,en:"path",ans:y,a:"style-name"},{ens:g,en:"polygon",ans:y,a:"style-name"},{ens:g,en:"polyline",ans:y,a:"style-name"},{ens:g,en:"rect",ans:y,a:"style-name"},{ens:g,en:"regular-polygon",ans:y,a:"style-name"},{ens:v,en:"annotation",ans:y,a:"style-name"}],"drawing-page":[{ens:g,en:"page",ans:g,a:"style-name"},{ens:y,en:"notes",ans:g,a:"style-name"},{ens:s,en:"handout-master", +ans:g,a:"style-name"},{ens:s,en:"master-page",ans:g,a:"style-name"}],"list-style":[{ens:w,en:"list",ans:w,a:"style-name"},{ens:w,en:"numbered-paragraph",ans:w,a:"style-name"},{ens:w,en:"list-item",ans:w,a:"style-override"},{ens:s,en:"style",ans:s,a:"list-style-name"}],data:[{ens:s,en:"style",ans:s,a:"data-style-name"},{ens:s,en:"style",ans:s,a:"percentage-data-style-name"},{ens:y,en:"date-time-decl",ans:s,a:"data-style-name"},{ens:w,en:"creation-date",ans:s,a:"data-style-name"},{ens:w,en:"creation-time", +ans:s,a:"data-style-name"},{ens:w,en:"database-display",ans:s,a:"data-style-name"},{ens:w,en:"date",ans:s,a:"data-style-name"},{ens:w,en:"editing-duration",ans:s,a:"data-style-name"},{ens:w,en:"expression",ans:s,a:"data-style-name"},{ens:w,en:"meta-field",ans:s,a:"data-style-name"},{ens:w,en:"modification-date",ans:s,a:"data-style-name"},{ens:w,en:"modification-time",ans:s,a:"data-style-name"},{ens:w,en:"print-date",ans:s,a:"data-style-name"},{ens:w,en:"print-time",ans:s,a:"data-style-name"},{ens:w, +en:"table-formula",ans:s,a:"data-style-name"},{ens:w,en:"time",ans:s,a:"data-style-name"},{ens:w,en:"user-defined",ans:s,a:"data-style-name"},{ens:w,en:"user-field-get",ans:s,a:"data-style-name"},{ens:w,en:"user-field-input",ans:s,a:"data-style-name"},{ens:w,en:"variable-get",ans:s,a:"data-style-name"},{ens:w,en:"variable-input",ans:s,a:"data-style-name"},{ens:w,en:"variable-set",ans:s,a:"data-style-name"}],"page-layout":[{ens:y,en:"notes",ans:s,a:"page-layout-name"},{ens:s,en:"handout-master",ans:s, +a:"page-layout-name"},{ens:s,en:"master-page",ans:s,a:"page-layout-name"}]},E,F=xmldom.XPath;this.collectUsedFontFaces=n;this.changeFontFaceNames=q;this.UsedStyleList=function(a,e){var c={};this.uses=function(a){var b=a.localName,e=a.getAttributeNS(g,"name")||a.getAttributeNS(s,"name");a="style"===b?a.getAttributeNS(s,"family"):a.namespaceURI===t?"data":b;return(a=c[a])?0/g,">").replace(/'/g,"'").replace(/"/g,""")}function d(c,f){var r="",l=b.filter?b.filter.acceptNode(f):NodeFilter.FILTER_ACCEPT,p;if(l===NodeFilter.FILTER_ACCEPT&&f.nodeType===Node.ELEMENT_NODE){c.push();p=c.getQName(f);var n,q=f.attributes,e,a,m,g="",z;n="<"+p;e=q.length;for(a=0;a")}if(l===NodeFilter.FILTER_ACCEPT||l===NodeFilter.FILTER_SKIP){for(l=f.firstChild;l;)r+=d(c,l),l=l.nextSibling;f.nodeValue&&(r+=k(f.nodeValue))}p&&(r+="",c.pop());return r}var b=this;this.filter=null;this.writeToString=function(b,h){if(!b)return"";var k=new f(h);return d(k,b)}};(function(){function f(b){var e,a=l.length;for(e=0;ea)break;d=d.nextSibling}b.insertBefore(e,d)}}}var c=new odf.StyleInfo,h=new core.DomUtils,r=odf.Namespaces.stylens,l="meta settings scripts font-face-decls styles automatic-styles master-styles body".split(" "), +p=Date.now()+"_webodf_",n=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,e,a,c){var d=this;this.size=0;this.type=null;this.name=b;this.container=a;this.url=null;this.mimetype=e;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=e,c.loadAsDataURL(b,e,function(a,b){a&&runtime.log(a);d.url=b;if(d.onchange)d.onchange(d);if(d.onstatereadychange)d.onstatereadychange(d)}))}};odf.OdfPart.prototype.load=function(){}; +odf.OdfPart.prototype.getUrl=function(){return this.data?"data:;base64,"+n.toBase64(this.data):null};odf.OdfContainer=function e(a,f){function g(a){for(var b=a.firstChild,e;b;)e=b.nextSibling,b.nodeType===Node.ELEMENT_NODE?g(b):b.nodeType===Node.PROCESSING_INSTRUCTION_NODE&&a.removeChild(b),b=e}function l(a){var b={},e,c,d=a.ownerDocument.createNodeIterator(a,NodeFilter.SHOW_ELEMENT,null,!1);for(a=d.nextNode();a;)"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI&&("annotation"=== +a.localName?(e=a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","name"))&&(b.hasOwnProperty(e)?runtime.log("Warning: annotation name used more than once with : '"+e+"'"):b[e]=a):"annotation-end"===a.localName&&((e=a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","name"))?b.hasOwnProperty(e)?(c=b[e],c.annotationEndElement?runtime.log("Warning: annotation name used more than once with : '"+e+"'"):c.annotationEndElement= +a):runtime.log("Warning: annotation end without an annotation start, name: '"+e+"'"):runtime.log("Warning: annotation end without a name found"))),a=d.nextNode()}function t(a,b){for(var e=a&&a.firstChild;e;)e.nodeType===Node.ELEMENT_NODE&&e.setAttributeNS("urn:webodf:names:scope","scope",b),e=e.nextSibling}function v(a,b){for(var e=J.rootElement.meta,e=e&&e.firstChild;e&&(e.namespaceURI!==a||e.localName!==b);)e=e.nextSibling;for(e=e&&e.firstChild;e&&e.nodeType!==Node.TEXT_NODE;)e=e.nextSibling;return e? +e.data:null}function y(a){var b={},e;for(a=a.firstChild;a;)a.nodeType===Node.ELEMENT_NODE&&a.namespaceURI===r&&"font-face"===a.localName&&(e=a.getAttributeNS(r,"name"),b[e]=a),a=a.nextSibling;return b}function s(a,b){var e=null,c,d,g;if(a)for(e=a.cloneNode(!0),c=e.firstElementChild;c;)d=c.nextElementSibling,(g=c.getAttributeNS("urn:webodf:names:scope","scope"))&&g!==b&&e.removeChild(c),c=d;return e}function x(a,b){var e,d,g,f=null,m={};if(a)for(b.forEach(function(a){c.collectUsedFontFaces(m,a)}), +f=a.cloneNode(!0),e=f.firstElementChild;e;)d=e.nextElementSibling,g=e.getAttributeNS(r,"name"),m[g]||f.removeChild(e),e=d;return f}function w(a){var b=J.rootElement.ownerDocument,e;if(a){g(a.documentElement);try{e=b.importNode(a.documentElement,!0)}catch(c){}}return e}function A(a){J.state=a;if(J.onchange)J.onchange(J);if(J.onstatereadychange)J.onstatereadychange(J)}function G(a){aa=null;J.rootElement=a;a.fontFaceDecls=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls"); +a.styles=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","styles");a.automaticStyles=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles");a.masterStyles=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles");a.body=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","body");a.meta=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta");a.settings=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0", +"settings");a.scripts=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","scripts");l(a)}function E(a){var d=w(a),g=J.rootElement,f;d&&"document-styles"===d.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===d.namespaceURI?(g.fontFaceDecls=h.getDirectChild(d,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls"),b(g,g.fontFaceDecls),f=h.getDirectChild(d,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","styles"),g.styles=f||a.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0", +"styles"),b(g,g.styles),f=h.getDirectChild(d,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles"),g.automaticStyles=f||a.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles"),t(g.automaticStyles,"document-styles"),b(g,g.automaticStyles),d=h.getDirectChild(d,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles"),g.masterStyles=d||a.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles"),b(g,g.masterStyles), +c.prefixStyleNames(g.automaticStyles,p,g.masterStyles)):A(e.INVALID)}function F(a){a=w(a);var d,g,f,m;if(a&&"document-content"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI){d=J.rootElement;f=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls");if(d.fontFaceDecls&&f){m=d.fontFaceDecls;var l,p,k,n,E={};g=y(m);n=y(f);for(f=f.firstElementChild;f;){l=f.nextElementSibling;if(f.namespaceURI===r&&"font-face"===f.localName)if(p=f.getAttributeNS(r, +"name"),g.hasOwnProperty(p)){if(!f.isEqualNode(g[p])){k=p;for(var s=g,z=n,U=0,F=void 0,F=k=k.replace(/\d+$/,"");s.hasOwnProperty(F)||z.hasOwnProperty(F);)U+=1,F=k+U;k=F;f.setAttributeNS(r,"style:name",k);m.appendChild(f);g[k]=f;delete n[p];E[p]=k}}else m.appendChild(f),g[p]=f,delete n[p];f=l}m=E}else f&&(d.fontFaceDecls=f,b(d,f));g=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles");t(g,"document-content");m&&c.changeFontFaceNames(g,m);if(d.automaticStyles&&g)for(m= +g.firstChild;m;)d.automaticStyles.appendChild(m),m=g.firstChild;else g&&(d.automaticStyles=g,b(d,g));a=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","body");if(null===a)throw" tag is mising.";d.body=a;b(d,d.body)}else A(e.INVALID)}function H(a){a=w(a);var e;a&&"document-meta"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI&&(e=J.rootElement,e.meta=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta"), +b(e,e.meta))}function N(a){a=w(a);var e;a&&"document-settings"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI&&(e=J.rootElement,e.settings=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","settings"),b(e,e.settings))}function I(a){a=w(a);var b;if(a&&"manifest"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"===a.namespaceURI)for(b=J.rootElement,b.manifest=a,a=b.manifest.firstElementChild;a;)"file-entry"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"=== +a.namespaceURI&&(V[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,e){a=h.getElementsByTagName(a,b);var c;for(c=0;c'}function Y(){var a=new xmldom.LSSerializer,b=u("document-meta");a.filter=new odf.OdfNodeFilter;b+=a.writeToString(J.rootElement.meta,odf.Namespaces.namespaceMap);return b+""}function $(a,b){var e=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","manifest:file-entry");e.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","manifest:full-path",a);e.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0", +"manifest:media-type",b);return e}function ea(){var a=runtime.parseXML(''),b=a.documentElement,e=new xmldom.LSSerializer,c;for(c in V)V.hasOwnProperty(c)&&b.appendChild($(c,V[c]));e.filter=new odf.OdfNodeFilter;return'\n'+e.writeToString(a,odf.Namespaces.namespaceMap)}function D(){var a,b,e,d=odf.Namespaces.namespaceMap, +g=new xmldom.LSSerializer,f=u("document-styles");b=s(J.rootElement.automaticStyles,"document-styles");e=J.rootElement.masterStyles.cloneNode(!0);a=x(J.rootElement.fontFaceDecls,[e,J.rootElement.styles,b]);c.removePrefixFromStyleNames(b,p,e);g.filter=new k(e,b);f+=g.writeToString(a,d);f+=g.writeToString(J.rootElement.styles,d);f+=g.writeToString(b,d);f+=g.writeToString(e,d);return f+""}function P(){var a,b,e=odf.Namespaces.namespaceMap,c=new xmldom.LSSerializer,g=u("document-content"); +b=s(J.rootElement.automaticStyles,"document-content");a=x(J.rootElement.fontFaceDecls,[b]);c.filter=new d(J.rootElement.body,b);g+=c.writeToString(a,e);g+=c.writeToString(b,e);g+=c.writeToString(J.rootElement.body,e);return g+""}function X(a,b){runtime.loadXML(a,function(a,c){if(a)b(a);else if(c){B(c);Z(c.documentElement);var d=w(c);d&&"document"===d.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===d.namespaceURI?(G(d),A(e.DONE)):A(e.INVALID)}else b("No DOM was loaded.")})} +function C(a,e){var c;c=J.rootElement;var d=c.meta;d||(c.meta=d=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta"),b(c,d));c=d;a&&h.mapKeyValObjOntoNode(c,a,odf.Namespaces.lookupNamespaceURI);e&&h.removeKeyElementsFromNode(c,e,odf.Namespaces.lookupNamespaceURI)}function T(a){function b(a,e){var c;e||(e=a);c=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",e);g[a]=c;g.appendChild(c)}var c=new core.Zip("",null),d=runtime.byteArrayFromString("application/vnd.oasis.opendocument."+ +a,"utf8"),g=J.rootElement,f=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",a);c.save("mimetype",d,!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");g.body.appendChild(f);V["/"]="application/vnd.oasis.opendocument."+a;V["settings.xml"]="text/xml";V["meta.xml"]="text/xml";V["styles.xml"]="text/xml";V["content.xml"]="text/xml";A(e.DONE);return c} +function L(){var a,b=new Date,e="";J.rootElement.settings&&J.rootElement.settings.firstElementChild&&(a=new xmldom.LSSerializer,e=u("document-settings"),a.filter=new odf.OdfNodeFilter,e+=a.writeToString(J.rootElement.settings,odf.Namespaces.namespaceMap),e+="");(a=e)?(a=runtime.byteArrayFromString(a,"utf8"),O.save("settings.xml",a,!0,b)):O.remove("settings.xml");e=runtime.getWindow();a="WebODF/"+webodf.Version;e&&(a=a+" "+e.navigator.userAgent);C({"meta:generator":a},null); +a=runtime.byteArrayFromString(Y(),"utf8");O.save("meta.xml",a,!0,b);a=runtime.byteArrayFromString(D(),"utf8");O.save("styles.xml",a,!0,b);a=runtime.byteArrayFromString(P(),"utf8");O.save("content.xml",a,!0,b);a=runtime.byteArrayFromString(ea(),"utf8");O.save("META-INF/manifest.xml",a,!0,b)}function S(a,b){L();O.writeAs(a,function(a){b(a)})}var J=this,O,V={},aa,ba="";this.onstatereadychange=f;this.state=this.onchange=null;this.getMetadata=v;this.setRootElement=G;this.getContentElement=function(){var a; +aa||(a=J.rootElement.body,aa=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","text")||h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","presentation")||h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","spreadsheet"));if(!aa)throw"Could not find content element in .";return aa};this.getDocumentType=function(){var a=J.getContentElement();return a&&a.localName};this.getPart=function(a){return new odf.OdfPart(a,V[a],J,O)};this.getPartData= +function(a,b){O.load(a,b)};this.setMetadata=C;this.incrementEditingCycles=function(){var a=v(odf.Namespaces.metans,"editing-cycles"),a=a?parseInt(a,10):0;isNaN(a)&&(a=0);C({"meta:editing-cycles":a+1},null);return a+1};this.createByteArray=function(a,b){L();O.createByteArray(a,b)};this.saveAs=S;this.save=function(a){S(ba,a)};this.getUrl=function(){return ba};this.setBlob=function(a,b,e){e=n.convertBase64ToByteArray(e);O.save(a,e,!1,new Date);V.hasOwnProperty(a)&&runtime.log(a+" has been overwritten."); +V[a]=b};this.removeBlob=function(a){var b=O.remove(a);runtime.assert(b,"file is not found: "+a);delete V[a]};this.state=e.LOADING;this.rootElement=function(a){var b=document.createElementNS(a.namespaceURI,a.localName),e;a=new a.Type;for(e in a)a.hasOwnProperty(e)&&(b[e]=a[e]);return b}({Type:odf.ODFDocumentElement,namespaceURI:odf.ODFDocumentElement.namespaceURI,localName:odf.ODFDocumentElement.localName});a===odf.OdfContainer.DocumentType.TEXT?O=T("text"):a===odf.OdfContainer.DocumentType.PRESENTATION? +O=T("presentation"):a===odf.OdfContainer.DocumentType.SPREADSHEET?O=T("spreadsheet"):(ba=a,O=new core.Zip(ba,function(a,b){O=b;a?X(ba,function(b){a&&(O.error=a+"\n"+b,A(e.INVALID))}):Q([{path:"styles.xml",handler:E},{path:"content.xml",handler:F},{path:"meta.xml",handler:H},{path:"settings.xml",handler:N},{path:"META-INF/manifest.xml",handler:I}])}))};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===Z}function k(a){return null!==a&&a.nodeType===Node.ELEMENT_NODE&&"frame"===a.localName&&a.namespaceURI===Z&&"as-char"===a.getAttributeNS(B,"anchor-type")}function d(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===B}function c(a){var b=a&& +a.localName;return("p"===b||"h"===b)&&a.namespaceURI===B}function h(a,b){for(a&&void 0!==b&&!c(a)&&a.childNodes.item(b)&&(a=a.childNodes.item(b));a&&!c(a);)a=a.parentNode;return a}function r(a,b){for(;a&&a!==b;){if(a.namespaceURI===odf.Namespaces.officens&&"annotation"===a.localName)return a;a=a.parentNode}return null}function l(a){return/^[ \t\r\n]+$/.test(a)}function p(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=== +B||"span"===b&&"webodf-annotationHighlight"===a.className}function n(a){var b=a&&a.localName,e=!1;b&&(a=a.namespaceURI,a===B&&(e="s"===b||"tab"===b||"line-break"===b));return e}function q(a){return n(a)||k(a)||d(a)}function e(a){var b=a&&a.localName,e=!1;b&&(a=a.namespaceURI,a===B&&(e="s"===b));return e}function a(a){return-1!==Y.indexOf(a.namespaceURI)}function m(b){if(n(b))return!1;if(p(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&&p(a);)a=a.firstChild;return a}function z(a){for(;null!==a.lastChild&&p(a);)a=a.lastChild;return a}function t(a){for(;!c(a)&&null===a.previousSibling;)a=a.parentNode;return c(a)?null:z(a.previousSibling)}function v(a){for(;!c(a)&&null===a.nextSibling;)a=a.parentNode;return c(a)?null:g(a.nextSibling)}function y(a){for(var b=!1;a;)if(a.nodeType===Node.TEXT_NODE)if(0===a.length)a=t(a);else return!l(a.data.substr(a.length-1,1));else q(a)? +(b=!1===e(a),a=null):a=t(a);return b}function s(a){var b=!1,e;for(a=a&&g(a);a;){e=a.nodeType===Node.TEXT_NODE?a.length:0;if(0a.value||"%"===a.unit)?null:a}function E(a){return(a=A(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 H(a,b){for(;0=b.value||"%"===b.unit)?null:b;return b||E(a)};this.parseFoLineHeight=function(a){return G(a)||E(a)};this.isTextContentContainingNode=F;this.getTextNodes=function(a,b){var e;e=u.getNodesInRange(a,function(a){var b=NodeFilter.FILTER_REJECT;a.nodeType===Node.TEXT_NODE?Boolean(h(a)&&(!l(a.textContent)||w(a,0)))&&(b=NodeFilter.FILTER_ACCEPT):F(a)&&(b=NodeFilter.FILTER_SKIP);return b},NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);b||H(a,e);return e};this.getTextElements=N;this.getParagraphElements= +function(a){var b;b=u.getNodesInRange(a,function(a){var b=NodeFilter.FILTER_REJECT;if(c(a))b=NodeFilter.FILTER_ACCEPT;else if(F(a)||p(a))b=NodeFilter.FILTER_SKIP;return b},NodeFilter.SHOW_ELEMENT);I(a.startContainer,b,c);return b};this.getImageElements=function(a){var b;b=u.getNodesInRange(a,function(a){var b=NodeFilter.FILTER_SKIP;f(a)&&(b=NodeFilter.FILTER_ACCEPT);return b},NodeFilter.SHOW_ELEMENT);I(a.startContainer,b,f);return b};this.getHyperlinkElements=function(a){var e=[],d=a.cloneRange(); +a.collapsed&&a.endContainer.nodeType===Node.ELEMENT_NODE&&(a=U(a.endContainer,a.endOffset),a.nodeType===Node.TEXT_NODE&&d.setEnd(a,1));N(d,!0,!1).forEach(function(a){for(a=a.parentNode;!c(a);){if(b(a)&&-1===e.indexOf(a)){e.push(a);break}a=a.parentNode}});d.detach();return e};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,d,b){function c(b){var e=b.annotationEndElement,c=n.createRange(),d=b.getAttributeNS(odf.Namespaces.officens,"name");e&&(c.setStart(b,b.childNodes.length),c.setEnd(e,0),b=q.getTextNodes(c,!1),b.forEach(function(b){var e;a:{for(e=b.parentNode;e.namespaceURI!==odf.Namespaces.officens||"body"!==e.localName;){if(e.namespaceURI===a&&"webodf-annotationHighlight"===e.className&&e.getAttribute("annotation")===d){e=!0;break a}e=e.parentNode}e=!1}e||(e=n.createElement("span"), +e.className="webodf-annotationHighlight",e.setAttribute("annotation",d),b.parentNode.replaceChild(e,b),e.appendChild(b))}));c.detach()}function h(a){var b=f.getSizer();a?(d.style.display="inline-block",b.style.paddingRight=e.getComputedStyle(d).width):(d.style.display="none",b.style.paddingRight=0);f.refreshSize()}function r(){p.sort(function(a,b){return 0!==(a.compareDocumentPosition(b)&Node.DOCUMENT_POSITION_FOLLOWING)?-1:1})}function l(){var a;for(a=0;a=(l.getBoundingClientRect().top-k.bottom)/b?e.style.top=Math.abs(l.getBoundingClientRect().top-k.bottom)/b+20+"px":e.style.top="0px");h.style.left=c.getBoundingClientRect().width/ +b+"px";var c=h.style,l=h.getBoundingClientRect().left/b,q=h.getBoundingClientRect().top/b,k=e.getBoundingClientRect().left/b,n=e.getBoundingClientRect().top/b,r=0,G=0,r=k-l,r=r*r,G=n-q,G=G*G,l=Math.sqrt(r+G);c.width=l+"px";q=Math.asin((e.getBoundingClientRect().top-h.getBoundingClientRect().top)/(b*parseFloat(h.style.width)));h.style.transform="rotate("+q+"rad)";h.style.MozTransform="rotate("+q+"rad)";h.style.WebkitTransform="rotate("+q+"rad)";h.style.msTransform="rotate("+q+"rad)"}}var p=[],n=k.ownerDocument, +q=new odf.OdfUtils,e=runtime.getWindow(),a="http://www.w3.org/1999/xhtml";runtime.assert(Boolean(e),"Expected to be run in an environment which has a global window, like a browser.");this.rerenderAnnotations=l;this.rehighlightAnnotations=function(){p.forEach(function(a){c(a)})};this.getMinimumHeightForAnnotationPane=function(){return"none"!==d.style.display&&0 text|list-item:first-child > :not(text|list):first-child:before',x+="{",x+="counter-increment: "+s+" 0;",x+="}",f(b,x));for(;k.counterIdStack.length>=r;)k.counterIdStack.pop();k.counterIdStack.push(s);w=k.contentRules[r.toString()]||"";for(x=1;x<=r;x+=1)w=w.replace(x+"webodf-listLevel",k.counterIdStack[x-1]);x='text|list[webodfhelper|counter-id="'+q+'"] > text|list-item > :not(text|list):first-child:before'; +x+="{";x+=w;x+="counter-increment: "+s+";";x+="}";f(b,x)}for(d=d.firstElementChild;d;)c(a,d,l,k),d=d.nextElementSibling}else k.continuedCounterIdStack=[]}var d=0,e="",a={};this.createCounterRules=function(b,e,f){var h=e.getAttributeNS(r,"id"),l=[];f&&(f=f.getAttributeNS("urn:webodf:names:helper","counter-id"),l=a[f].slice(0));b=new k(b,l);h?h="Y"+h:(d+=1,h="X"+d);c(h,e,0,b);a[h+"-level1-1"]=b.counterIdStack};this.initialiseCreatedCounters=function(){var a;a="office|document{"+("counter-reset: "+e+ +";");a+="}";f(b,a)}}var b=odf.Namespaces.fons,c=odf.Namespaces.stylens,h=odf.Namespaces.textns,r=odf.Namespaces.xmlns,l={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"};odf.ListStyleToCss=function(){function p(b){var e=m.parseLength(b);return e?a.convert(e.value,e.unit,"px"):(runtime.log("Could not parse value '"+b+"'."),0)}function k(a){return a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function q(a,b){var e;a&&(e=a.getAttributeNS(h,"style-name"));return e===b}function e(a, +b,e){b=b.getElementsByTagNameNS(h,"list");a=new d(a);var f,m,p,x,w,A,G={},E;for(E=0;E text|list-item > text|list",z-=1;z=t&&t.getAttributeNS(b,"text-align")||"left";switch(z){case "end":z="right";break;case "start":z="left"}"label-alignment"===N?(U=I&&I.getAttributeNS(b,"margin-left")||"0px",Q=I&&I.getAttributeNS(b,"text-indent")||"0px",u=I&&I.getAttributeNS(h,"label-followed-by"),I=p(U)):(U=t&&t.getAttributeNS(h,"space-before")||"0px",B=t&&t.getAttributeNS(h,"min-label-width")||"0px", +Z=t&&t.getAttributeNS(h,"min-label-distance")||"0px",I=p(U)+p(B));t=q+" > text|list-item";t+="{";t+="margin-left: "+I+"px;";t+="}";f(m,t);t=q+" > text|list-item > text|list";t+="{";t+="margin-left: "+-I+"px;";t+="}";f(m,t);t=q+" > text|list-item > :not(text|list):first-child:before";t+="{";t+="text-align: "+z+";";t+="display: inline-block;";"label-alignment"===N?(t+="margin-left: "+Q+";","listtab"===u&&(t+="padding-right: 0.2cm;")):(t+="min-width: "+B+";",t+="margin-left: "+(0===parseFloat(B)?"": +"-")+B+";",t+="padding-right: "+Z+";");t+="}";f(m,t)}d=d.nextElementSibling}});e(a,m,l)}}})();odf.Style2CSS=function(){function f(a,b,e){var c=[];e=e.derivedStyles;var d;var g=t[a],h;void 0===g?b=null:(h=b?"["+g+'|style-name="'+b+'"]':"","presentation"===g&&(g="draw",h=b?'[presentation|style-name="'+b+'"]':""),b=g+"|"+v[a].join(h+","+g+"|")+h);null!==b&&c.push(b);for(d in e)e.hasOwnProperty(d)&&(b=f(a,d,e[d]),c=c.concat(b));return c}function k(a,b){var e="",c,d,g;for(c=0;ch.value&&(g="0.75pt"+m)}d[2]&&(e+=d[2]+":"+g+";")}return e}function d(a){return(a=z.getDirectChild(a,q,"text-properties"))?B.parseFoFontSize(a.getAttributeNS(p,"font-size")):null}function b(a,b,e,c){return b+b+e+e+c+c}function c(a,b){var e=[a],d=b.derivedStyles;Object.keys(d).forEach(function(a){a=c(a,d[a]);e=e.concat(a)});return e}function h(a,b,e,d){function f(b,e){var c=[],d;b.forEach(function(a){h.forEach(function(b){c.push("draw|page[webodfhelper|page-style-name='"+ +b+"'] draw|frame[presentation|class='"+a+"']")})});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=e?f=c(a,e-1,d,!0):a.nodeType===Node.TEXT_NODE&& +0a?-1:1;for(a=Math.abs(a);0q?n.previousPosition():n.nextPosition());)if(Q.check(),p.acceptPosition(n)===e&&(A+=1,r=n.container(),H=c(r,n.unfilteredDomOffset(),Z),H.top!==I)){if(H.top!==B&&B!==I)break;B=H.top;H=Math.abs(U-H.left);if(null===G||Ha?(g=p.previousPosition, +f=-1):(g=p.nextPosition,f=1);for(h=c(p.container(),p.unfilteredDomOffset(),w);g.call(p);)if(b.acceptPosition(p)===e){if(n.getParagraphElement(p.getCurrentNode())!==q)break;l=c(p.container(),p.unfilteredDomOffset(),w);if(l.bottom!==h.bottom&&(h=l.top>=h.top&&l.bottomh.bottom,!h))break;r+=f;h=l}w.detach();return r}var n=new odf.OdfUtils,q,e=core.PositionFilter.FilterResult.FILTER_ACCEPT;this.getStepCounter=function(){return{convertForwardStepsBetweenFilters:h,convertBackwardStepsBetweenFilters:r, +countLinesSteps:l,countStepsToLineBoundary:p}};(function(){q=gui.SelectionMover.createPositionIterator(k);var a=k.ownerDocument.createRange();a.setStart(q.container(),q.unfilteredDomOffset());a.collapse(!0);f.setSelectedRange(a)})()}; +gui.SelectionMover.createPositionIterator=function(f){var k=new function(){this.acceptNode=function(d){return d&&"urn:webodf:names:cursor"!==d.namespaceURI&&"urn:webodf:names:editinfo"!==d.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 d=this,b={},c,h,r,l=new core.EventNotifier([ops.OdtCursor.signalCursorUpdated]);this.removeFromDocument=function(){r.remove()};this.subscribe=function(b,c){l.subscribe(b,c)};this.unsubscribe=function(b,c){l.unsubscribe(b,c)};this.getStepCounter=function(){return h.getStepCounter()};this.getMemberId=function(){return f};this.getNode=function(){return r.getNode()};this.getAnchorNode=function(){return r.getAnchorNode()};this.getSelectedRange=function(){return r.getSelectedRange()}; +this.setSelectedRange=function(b,c){r.setSelectedRange(b,c);l.emit(ops.OdtCursor.signalCursorUpdated,d)};this.hasForwardSelection=function(){return r.hasForwardSelection()};this.getDocument=function(){return k};this.getSelectionType=function(){return c};this.setSelectionType=function(d){b.hasOwnProperty(d)?c=d:runtime.log("Invalid selection type: "+d)};this.resetSelectionType=function(){d.setSelectionType(ops.OdtCursor.RangeSelection)};r=new core.Cursor(k.getDOMDocument(),f);h=new gui.SelectionMover(r, +k.getRootNode());b[ops.OdtCursor.RangeSelection]=!0;b[ops.OdtCursor.RegionSelection]=!0;d.resetSelectionType()};ops.OdtCursor.RangeSelection="Range";ops.OdtCursor.RegionSelection="Region";ops.OdtCursor.signalCursorUpdated="cursorUpdated";(function(){var f=0;ops.StepsCache=function(k,d,b){function c(a,e){var c=this;this.nodeId=a;this.steps=-1;this.node=e;this.previousBookmark=this.nextBookmark=null;this.setIteratorPosition=function(a){a.setPositionBeforeElement(e);b(c.steps,a)}}function h(a,e,c){var d=this;this.nodeId=a;this.steps=e;this.node=c;this.previousBookmark=this.nextBookmark=null;this.setIteratorPosition=function(a){a.setUnfilteredPosition(c,0);b(d.steps,a)}}function r(a,b){var e="["+a.nodeId;b&&(e+=" => "+b.nodeId);return e+ +"]"}function l(){for(var a=v,b,e,c,d=new core.LoopWatchDog(0,1E5),f={};a;){d.check();(b=a.previousBookmark)?runtime.assert(b.nextBookmark===a,"Broken bookmark link to previous @"+r(b,a)):(runtime.assert(a===v,"Broken bookmark link @"+r(a)),runtime.assert(void 0===y||v===v||v.steps<=y,"Base point is damaged @"+r(a)));(e=a.nextBookmark)&&runtime.assert(e.previousBookmark===a,"Broken bookmark link to next @"+r(a,e));if(void 0===y||a===v||a.steps<=y)runtime.assert(t.containsNode(k,a.node),"Disconnected node is being reported as undamaged @"+ +r(a)),b&&(c=a.node.compareDocumentPosition(b.node),runtime.assert(0===c||0!==(c&x),"Bookmark order with previous does not reflect DOM order @"+r(b,a))),e&&t.containsNode(k,e.node)&&(c=a.node.compareDocumentPosition(e.node),runtime.assert(0===c||0!==(c&s),"Bookmark order with next does not reflect DOM order @"+r(a,e)));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+" @"+r(b)); +runtime.assert(!1===f.hasOwnProperty(b.nodeId),"Bookmark "+r(b)+" appears twice in cached step lookup at steps "+f[b.nodeId]+" and "+a);f[b.nodeId]=a})}function p(a){var b="";a.nodeType===Node.ELEMENT_NODE&&(b=a.getAttributeNS(m,"nodeId")||"");return b}function n(a){var b=f.toString();a.setAttributeNS(m,"nodeId",b);f+=1;return b}function q(a){var b,e,c=new core.LoopWatchDog(0,1E4);void 0!==y&&a>y&&(a=y);for(b=Math.floor(a/d)*d;!e&&0<=b;)e=g[b],b-=d;for(e=e||v;e.nextBookmark&&e.nextBookmark.steps<= +a;)c.check(),e=e.nextBookmark;runtime.assert(-1===a||e.steps<=a,"Bookmark @"+r(e)+" at step "+e.steps+" exceeds requested step of "+a);return e}function e(a){a.previousBookmark&&(a.previousBookmark.nextBookmark=a.nextBookmark);a.nextBookmark&&(a.nextBookmark.previousBookmark=a.previousBookmark)}function a(a){for(var b,e=null;!e&&a&&a!==k;)(b=p(a))&&(e=z[b])&&e.node!==a&&(runtime.log("Cloned node detected. Creating new bookmark"),e=null,a.removeAttributeNS(m,"nodeId")),a=a.parentNode;return e}var m= +"urn:webodf:names:steps",g={},z={},t=new core.DomUtils,v,y,s=Node.DOCUMENT_POSITION_FOLLOWING,x=Node.DOCUMENT_POSITION_PRECEDING,w;this.updateBookmark=function(a,b){var f,h=Math.ceil(a/d)*d,l,m,r;if(void 0!==y&&yl.steps)g[h]=m;w()};this.setToClosestStep=function(a,b){var e;w();e=q(a);e.setIteratorPosition(b); +return e.steps};this.setToClosestDomPoint=function(b,e,c){var d,f;w();if(b===k&&0===e)d=v;else if(b===k&&e===k.childNodes.length)for(f in d=v,g)g.hasOwnProperty(f)&&(b=g[f],b.steps>d.steps&&(d=b));else if(d=a(b.childNodes.item(e)||b),!d)for(c.setUnfilteredPosition(b,e);!d&&c.previousNode();)d=a(c.getCurrentNode());d=d||v;void 0!==y&&d.steps>y&&(d=q(y));d.setIteratorPosition(c);return d.steps};this.damageCacheAfterStep=function(a){0>a&&(a=-1);void 0===y?y=a:ab)throw new RangeError("Requested steps is negative ("+b+")");r();for(e=n.setToClosestStep(b,a);ee.comparePoints(p,0,b,f),b=p,f=f?0:p.childNodes.length);a.setUnfilteredPosition(b,f);l(a,h)||a.setUnfilteredPosition(b,f);h=a.container();f=a.unfilteredDomOffset();b=n.setToClosestDomPoint(h,f,a);if(0>e.comparePoints(a.container(), +a.unfilteredDomOffset(),h,f))return 0=n.textNode.length?null:n.textNode.splitText(n.offset));for(a=n.textNode;a!==e;){a=a.parentNode;m=a.cloneNode(!1);g&&m.appendChild(g);if(z)for(;z&&z.nextSibling;)m.appendChild(z.nextSibling);else for(;a.firstChild;)m.appendChild(a.firstChild);a.parentNode.insertBefore(m,a.nextSibling);z=a;g=m}r.isListItem(g)&&(g=g.childNodes.item(0));h?g.setAttributeNS(l,"text:style-name",h):g.removeAttributeNS(l,"style-name");0===n.textNode.length&& +n.textNode.parentNode.removeChild(n.textNode);d.emit(ops.OdtDocument.signalStepsInserted,{position:b});t&&c&&(d.moveCursor(f,b+1,0),d.emit(ops.Document.signalCursorMoved,t));d.fixCursorPositions();d.getOdfCanvas().refreshSize();d.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:q,memberId:f,timeStamp:k});d.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:g,memberId:f,timeStamp:k});d.getOdfCanvas().rerenderAnnotations();return!0};this.spec=function(){return{optype:"SplitParagraph", +memberid:f,timestamp:k,position:b,sourceParagraphPosition:d,paragraphStyleName:h,moveCursor:c}}};ops.OpUpdateMember=function(){function f(c){var d="//dc:creator[@editinfo:memberid='"+k+"']";c=xmldom.XPath.getODFElementsWithXPath(c.getRootNode(),d,function(b){return"editinfo"===b?"urn:webodf:names:editinfo":odf.Namespaces.lookupNamespaceURI(b)});for(d=0;d=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")||"";0=h.width&&(h=null),f.detach();else if(k.isCharacterElement(c.container)||k.isCharacterFrame(c.container))h=b.getBoundingClientRect(c.container); +return h}var k=new odf.OdfUtils,d=new odf.StepUtils,b=new core.DomUtils,c=core.StepDirection.NEXT,h=gui.StepInfo.VisualDirection.LEFT_TO_RIGHT,r=gui.StepInfo.VisualDirection.RIGHT_TO_LEFT;this.getContentRect=f;this.moveToFilteredStep=function(b,d,k){function q(a,b){b.process(y,g,z)&&(a=!0,!t&&b.token&&(t=b.token));return a}var e=d===c,a,m,g,z,t,v=b.snapshot();a=!1;var y;do a=f(b),y={token:b.snapshot(),container:b.container,offset:b.offset,direction:d,visualDirection:d===c?h:r},m=b.nextStep()?f(b): +null,b.restore(y.token),e?(g=a,z=m):(g=m,z=a),a=k.reduce(q,!1);while(!a&&b.advanceStep(d));a||k.forEach(function(a){!t&&a.token&&(t=a.token)});b.restore(t||v);return Boolean(t)}};gui.Caret=function(f,k,d){function b(){n.style.opacity="0"===n.style.opacity?"1":"0";s.trigger()}function c(){m.selectNodeContents(a);return m.getBoundingClientRect()}function h(){Object.keys(G).forEach(function(a){E[a]=G[a]})}function r(){var a,b,m,l;if(!1===G.isShown||f.getSelectionType()!==ops.OdtCursor.RangeSelection||!d&&!f.getSelectedRange().collapsed)G.visibility="hidden",n.style.visibility="hidden",s.cancel();else{G.visibility="visible";n.style.visibility="visible";if(!1===G.isFocused)n.style.opacity= +"1",s.cancel();else{if(x||E.visibility!==G.visibility)n.style.opacity="1",s.cancel();s.trigger()}if(A||w||E.visibility!==G.visibility){a=f.getNode();var k;m=z.getBoundingClientRect(g.getSizer());l=!1;if(0a.height&&(a={top:a.top-(8-a.height)/2,height:8,right:a.right});p.style.height=a.height+"px";p.style.top=a.top+"px";p.style.left=a.right+"px";e&&(a=runtime.getWindow().getComputedStyle(f.getNode(),null),a.font?e.style.font=a.font:(e.style.fontStyle=a.fontStyle,e.style.fontVariant=a.fontVariant,e.style.fontWeight= +a.fontWeight,e.style.fontSize=a.fontSize,e.style.lineHeight=a.lineHeight,e.style.fontFamily=a.fontFamily))}if(w){k=f.getDocument().getCanvas().getElement().parentNode;var r;m=k.offsetWidth-k.clientWidth+5;l=k.offsetHeight-k.clientHeight+5;r=n.getBoundingClientRect();a=r.left-m;b=r.top-l;m=r.right+m;l=r.bottom+l;r=k.getBoundingClientRect();br.bottom&&(k.scrollTop+=l-r.bottom);ar.right&&(k.scrollLeft+=m-r.right)}}E.isFocused!==G.isFocused&& +q.markAsFocussed(G.isFocused);h();A=w=x=!1}function l(b){p.parentNode.removeChild(p);a.parentNode.removeChild(a);b()}var p,n,q,e,a,m,g=f.getDocument().getCanvas(),z=new core.DomUtils,t=new gui.GuiStepUtils,v,y,s,x=!1,w=!1,A=!1,G={isFocused:!1,isShown:!0,visibility:"hidden"},E={isFocused:!G.isFocused,isShown:!G.isShown,visibility:"hidden"};this.handleUpdate=function(){A=!0;"hidden"!==G.visibility&&(G.visibility="hidden",n.style.visibility="hidden",f.getNode().removeAttributeNS("urn:webodf:names:cursor", +"caret-sizer-active"));y.trigger()};this.refreshCursorBlinking=function(){x=!0;y.trigger()};this.setFocus=function(){G.isFocused=!0;y.trigger()};this.removeFocus=function(){G.isFocused=!1;y.trigger()};this.show=function(){G.isShown=!0;y.trigger()};this.hide=function(){G.isShown=!1;y.trigger()};this.setAvatarImageUrl=function(a){q.setImageUrl(a)};this.setColor=function(a){n.style.borderColor=a;q.setColor(a)};this.getCursor=function(){return f};this.getFocusElement=function(){return n};this.toggleHandleVisibility= +function(){q.isVisible()?q.hide():q.show()};this.showHandle=function(){q.show()};this.hideHandle=function(){q.hide()};this.setOverlayElement=function(a){e=a;p.appendChild(a);A=!0;y.trigger()};this.ensureVisible=function(){w=!0;y.trigger()};this.getBoundingClientRect=function(){return z.getBoundingClientRect(p)};this.destroy=function(a){core.Async.destroyAll([y.destroy,s.destroy,q.destroy,l],a)};(function(){var e=f.getDocument(),c=[e.createRootFilter(f.getMemberId()),e.getPositionFilter()],d=e.getDOMDocument(); +m=d.createRange();a=d.createElement("span");a.className="webodf-caretSizer";a.textContent="|";f.getNode().appendChild(a);p=d.createElement("div");p.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",f.getMemberId());p.className="webodf-caretOverlay";n=d.createElement("div");n.className="caret";p.appendChild(n);q=new gui.Avatar(p,k);g.getSizer().appendChild(p);v=e.createStepIterator(f.getNode(),0,c,e.getRootNode());y=core.Task.createRedrawTask(r);s=core.Task.createTimeoutTask(b,500);y.triggerImmediate()})()};odf.TextSerializer=function(){function f(b){var c="",h=k.filter?k.filter.acceptNode(b):NodeFilter.FILTER_ACCEPT,r=b.nodeType,l;if((h===NodeFilter.FILTER_ACCEPT||h===NodeFilter.FILTER_SKIP)&&d.isTextContentContainingNode(b))for(l=b.firstChild;l;)c+=f(l),l=l.nextSibling;h===NodeFilter.FILTER_ACCEPT&&(r===Node.ELEMENT_NODE&&d.isParagraph(b)?c+="\n":r===Node.TEXT_NODE&&b.textContent&&(c+=b.textContent));return c}var k=this,d=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,d){var b;b=d.startContainer.ownerDocument.createElement("span");b.appendChild(d.cloneContents());b=f.writeToString(b);try{k.setData("text/plain",b)}catch(c){k.setData("Text",b)}};f=new odf.TextSerializer;f.filter=new odf.OdfNodeFilter};gui.Clipboard=function(f){this.setDataFromRange=function(k,d){var b,c=k.clipboardData;b=runtime.getWindow();!c&&b&&(c=b.clipboardData);c?(b=!0,f.exportRangeToDataTransfer(c,d),k.preventDefault()):b=!1;return b}};gui.SessionContext=function(f,k){var d=f.getOdtDocument(),b=new odf.OdfUtils;this.isLocalCursorWithinOwnAnnotation=function(){var c=d.getCursor(k),f;if(!c)return!1;f=c&&c.getNode();c=d.getMember(k).getProperties().fullName;return(f=b.getParentAnnotation(f,d.getRootNode()))&&b.getAnnotationCreator(f)===c?!0:!1}};gui.StyleSummary=function(f){function k(b,d){var k=b+"|"+d,p;c.hasOwnProperty(k)||(p=[],f.forEach(function(c){c=(c=c.styleProperties[b])&&c[d];-1===p.indexOf(c)&&p.push(c)}),c[k]=p);return c[k]}function d(b,c,d){return function(){var f=k(b,c);return d.length>=f.length&&f.every(function(b){return-1!==d.indexOf(b)})}}function b(b,c){var d=k(b,c);return 1===d.length?d[0]:void 0}var c={};this.getPropertyValues=k;this.getCommonValue=b;this.isBold=d("style:text-properties","fo:font-weight",["bold"]);this.isItalic= +d("style:text-properties","fo:font-style",["italic"]);this.hasUnderline=d("style:text-properties","style:text-underline-style",["solid"]);this.hasStrikeThrough=d("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=d("style:paragraph-properties","fo:text-align",["left","start"]);this.isAlignedCenter= +d("style:paragraph-properties","fo:text-align",["center"]);this.isAlignedRight=d("style:paragraph-properties","fo:text-align",["right","end"]);this.isAlignedJustified=d("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,d,b,c,h,r){function l(){return T.value().styleSummary}function p(a){var b;a.collapsed?(b=a.startContainer,b.hasChildNodes()&&a.startOffseta.clientWidth||a.scrollHeight>a.clientHeight)&&b.push(new q(a)),a=a.parentNode;b.push(new n(s));return b}function y(){var a; +g()||(a=v(E),t(),E.focus(),a.forEach(function(a){a.restore()}))}var s=runtime.getWindow(),x={beforecut:!0,beforepaste:!0,longpress:!0,drag:!0,dragstop:!0},w={mousedown:!0,mouseup:!0,focus:!0},A={},G={},E,F=f.getCanvas().getElement(),H=this,N={};this.addFilter=function(a,b){e(a,!0).filters.push(b)};this.removeFilter=function(a,b){var c=e(a,!0),d=c.filters.indexOf(b);-1!==d&&c.filters.splice(d,1)};this.subscribe=a;this.unsubscribe=m;this.hasFocus=g;this.focus=y;this.getEventTrap=function(){return E}; +this.setEditing=function(a){var b=g();b&&E.blur();a?E.removeAttribute("readOnly"):E.setAttribute("readOnly","true");b&&y()};this.destroy=function(a){m("touchstart",p);Object.keys(N).forEach(function(a){b(parseInt(a,10))});N.length=0;Object.keys(A).forEach(function(a){A[a].destroy()});A={};m("mousedown",z);m("mouseup",t);m("contextmenu",t);Object.keys(G).forEach(function(a){G[a].destroy()});G={};E.parentNode.removeChild(E);a()};(function(){var b=f.getOdfCanvas().getSizer(),e=b.ownerDocument;runtime.assert(Boolean(s), +"EventManager requires a window object to operate correctly");E=e.createElement("input");E.id="eventTrap";E.setAttribute("tabindex","-1");E.setAttribute("readOnly","true");b.appendChild(E);a("mousedown",z);a("mouseup",t);a("contextmenu",t);A.longpress=new d("longpress",["touchstart","touchmove","touchend"],h);A.drag=new d("drag",["touchstart","touchmove","touchend"],r);A.dragstop=new d("dragstop",["drag","touchend"],l);a("touchstart",p)})()};gui.IOSSafariSupport=function(f){function k(){d.innerHeight!==d.outerHeight&&(b.style.display="none",runtime.requestAnimationFrame(function(){b.style.display="block"}))}var d=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,d,b){function c(){var b=!0;!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)&&(b=d.isLocalCursorWithinOwnAnnotation());b!==n&&(n=b,p.emit(gui.HyperlinkController.enabledChanged,n))}function h(d){d.getMemberId()===b&&c()}var r=new odf.OdfUtils,l=f.getOdtDocument(),p=new core.EventNotifier([gui.HyperlinkController.enabledChanged]),n=!1;this.isEnabled=function(){return n};this.subscribe=function(b,e){p.subscribe(b,e)};this.unsubscribe=function(b,e){p.unsubscribe(b, +e)};this.addHyperlink=function(c,e){if(n){var a=l.getCursorSelection(b),d=new ops.OpApplyHyperlink,g=[];if(0===a.length||e)e=e||c,d=new ops.OpInsertText,d.init({memberid:b,position:a.position,text:e}),a.length=e.length,g.push(d);d=new ops.OpApplyHyperlink;d.init({memberid:b,position:a.position,length:a.length,hyperlink:c});g.push(d);f.enqueue(g)}};this.removeHyperlinks=function(){if(n){var c=gui.SelectionMover.createPositionIterator(l.getRootNode()),e=l.getCursor(b).getSelectedRange(),a=r.getHyperlinkElements(e), +d=e.collapsed&&1===a.length,g=l.getDOMDocument().createRange(),h=[],k,p;0!==a.length&&(a.forEach(function(a){g.selectNodeContents(a);k=l.convertDomToCursorRange({anchorNode:g.startContainer,anchorOffset:g.startOffset,focusNode:g.endContainer,focusOffset:g.endOffset});p=new ops.OpRemoveHyperlink;p.init({memberid:b,position:k.position,length:k.length});h.push(p)}),d||(d=a[0],-1===e.comparePoint(d,0)&&(g.setStart(d,0),g.setEnd(e.startContainer,e.startOffset),k=l.convertDomToCursorRange({anchorNode:g.startContainer, +anchorOffset:g.startOffset,focusNode:g.endContainer,focusOffset:g.endOffset}),0h.width&&(r=h.width/k.width);k.height>h.height&&(y=h.height/k.height);h=Math.min(r,y);k={width:k.width*h,height:k.height*h}}h=k.width+ +"px";k=k.height+"px";var s=n.getOdfCanvas().odfContainer().rootElement.styles,r=e.toLowerCase(),y=l.hasOwnProperty(r)?l[r]:null,x,r=[];runtime.assert(null!==y,"Image type is not supported: "+e);y="Pictures/"+c.generateImageName()+y;x=new ops.OpSetBlob;x.init({memberid:b,filename:y,mimetype:e,content:d});r.push(x);q.getStyleElement("Graphics","graphic",[s])||(e=new ops.OpAddStyle,e.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"}}}),r.push(e));e=c.generateStyleName();d=new ops.OpAddStyle;d.init({memberid:b,styleName:e,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"}}});r.push(d);x=new ops.OpInsertImage;x.init({memberid:b,position:n.getCursorPosition(b), +filename:y,frameWidth:h,frameHeight:k,frameStyleName:e,frameName:c.generateFrameName()});r.push(x);f.enqueue(r)}};this.destroy=function(a){n.unsubscribe(ops.Document.signalCursorMoved,r);k.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,h);a()};n.subscribe(ops.Document.signalCursorMoved,r);k.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,h);h()};gui.ImageController.enabledChanged="enabled/changed";gui.ImageSelector=function(f){function k(){var d=f.getSizer(),h=c.createElement("div");h.id="imageSelector";h.style.borderWidth="1px";d.appendChild(h);b.forEach(function(b){var d=c.createElement("div");d.className=b;h.appendChild(d)});return h}var d=odf.Namespaces.svgns,b="topLeft topRight bottomRight bottomLeft topMiddle rightMiddle bottomMiddle leftMiddle".split(" "),c=f.getElement().ownerDocument,h=!1;this.select=function(b){var l,p,n=c.getElementById("imageSelector");n||(n=k());h=!0;l=n.parentNode; +p=b.getBoundingClientRect();var q=l.getBoundingClientRect(),e=f.getZoomLevel();l=(p.left-q.left)/e-1;p=(p.top-q.top)/e-1;n.style.display="block";n.style.left=l+"px";n.style.top=p+"px";n.style.width=b.getAttributeNS(d,"width");n.style.height=b.getAttributeNS(d,"height")};this.clearSelection=function(){var b;h&&(b=c.getElementById("imageSelector"))&&(b.style.display="none");h=!1};this.isSelectorElement=function(b){var d=c.getElementById("imageSelector");return d?b===d||b.parentNode===d:!1}};(function(){function f(f){function d(b){r=b.which&&String.fromCharCode(b.which)===h;h=void 0;return!1===r}function b(){r=!1}function c(b){h=b.data;r=!1}var h,r=!1;this.destroy=function(h){f.unsubscribe("textInput",b);f.unsubscribe("compositionend",c);f.removeFilter("keypress",d);h()};f.subscribe("textInput",b);f.subscribe("compositionend",c);f.addFilter("keypress",d)}gui.InputMethodEditor=function(k,d){function b(b){a&&(b?a.getNode().setAttributeNS(e,"composing","true"):(a.getNode().removeAttributeNS(e, +"composing"),z.textContent=""))}function c(){y&&(y=!1,b(!1),x.emit(gui.InputMethodEditor.signalCompositionEnd,{data:s}),s="")}function h(){c();a&&a.getSelectedRange().collapsed?m.value="":m.value=t;m.setSelectionRange(0,m.value.length)}function r(){d.hasFocus()&&v.trigger()}function l(){w=void 0;v.cancel();b(!0);y||x.emit(gui.InputMethodEditor.signalCompositionStart,{data:""})}function p(a){a=w=a.data;y=!0;s+=a;v.trigger()}function n(a){a.data!==w&&(a=a.data,y=!0,s+=a,v.trigger());w=void 0}function q(){z.textContent= +m.value}var e="urn:webodf:names:cursor",a=null,m=d.getEventTrap(),g=m.ownerDocument,z,t="b",v,y=!1,s="",x=new core.EventNotifier([gui.InputMethodEditor.signalCompositionStart,gui.InputMethodEditor.signalCompositionEnd]),w,A=[],G;this.subscribe=x.subscribe;this.unsubscribe=x.unsubscribe;this.registerCursor=function(b){b.getMemberId()===k&&(a=b,a.getNode().appendChild(z),b.subscribe(ops.OdtCursor.signalCursorUpdated,r),d.subscribe("input",q),d.subscribe("compositionupdate",q))};this.removeCursor=function(b){a&& +b===k&&(a.getNode().removeChild(z),a.unsubscribe(ops.OdtCursor.signalCursorUpdated,r),d.unsubscribe("input",q),d.unsubscribe("compositionupdate",q),a=null)};this.destroy=function(a){d.unsubscribe("compositionstart",l);d.unsubscribe("compositionend",p);d.unsubscribe("textInput",n);d.unsubscribe("keypress",c);d.unsubscribe("focus",h);core.Async.destroyAll(G,a)};(function(){d.subscribe("compositionstart",l);d.subscribe("compositionend",p);d.subscribe("textInput",n);d.subscribe("keypress",c);d.subscribe("focus", +h);A.push(new f(d));G=A.map(function(a){return a.destroy});z=g.createElement("span");z.setAttribute("id","composer");v=core.Task.createTimeoutTask(h,1);G.push(v.destroy)})()};gui.InputMethodEditor.signalCompositionStart="input/compositionstart";gui.InputMethodEditor.signalCompositionEnd="input/compositionend"})();gui.MetadataController=function(f,k){function d(b){h.emit(gui.MetadataController.signalMetadataChanged,b)}function b(b){var c=-1===r.indexOf(b);c||runtime.log("Setting "+b+" is restricted.");return c}var c=f.getOdtDocument(),h=new core.EventNotifier([gui.MetadataController.signalMetadataChanged]),r=["dc:creator","dc:date","meta:editing-cycles","meta:editing-duration","meta:document-statistic"];this.setMetadata=function(c,d){var h={},r="",e;c&&Object.keys(c).filter(b).forEach(function(a){h[a]=c[a]}); +d&&(r=d.filter(b).join(","));if(0c:!1}function d(b){null!==b&&!1===k(b)&&(c=Math.abs(b-f))}var b=this,c,h=gui.StepInfo.VisualDirection.LEFT_TO_RIGHT;this.token=void 0;this.process=function(c,f,p){var n,q;c.visualDirection===h?(n=f&&f.right,q=p&&p.left):(n=f&&f.left,q=p&&p.right);if(k(n)||k(q))return!0;if(f||p)d(n),d(q),b.token=c.token;return!1}};gui.LineBoundaryScanner=function(){var f=this,k=null;this.token=void 0;this.process=function(d,b,c){var h;if(h=c)if(k){var r=k;h=Math.min(r.bottom-r.top,c.bottom-c.top);var l=Math.max(r.top,c.top),r=Math.min(r.bottom,c.bottom)-l;h=0.4>=(0b?a.previousSibling:a.nextSibling,e(h)===NodeFilter.FILTER_ACCEPT&&(c=h),a=a.parentNode;return c}function b(a,b){var e;return null===a?m.NO_NEIGHBOUR:r.isCharacterElement(a)?m.SPACE_CHAR:a.nodeType===c||r.isTextSpan(a)||r.isHyperlink(a)?(e=a.textContent.charAt(b()),p.test(e)?m.SPACE_CHAR:l.test(e)?m.PUNCTUATION_CHAR:m.WORD_CHAR):m.OTHER}var c=Node.TEXT_NODE,h=Node.ELEMENT_NODE, +r=new odf.OdfUtils,l=/[!-#%-*,-\/:-;?-@\[-\]_{}\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]/, +p=/\s/,n=core.PositionFilter.FilterResult.FILTER_ACCEPT,q=core.PositionFilter.FilterResult.FILTER_REJECT,e=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(c){var f=c.container(),l=c.leftNode(),r=c.rightNode(),p=c.unfilteredDomOffset,s=function(){return c.unfilteredDomOffset()-1};f.nodeType===h&&(null===r&&(r=d(f,1,c.getNodeFilter())),null===l&&(l= +d(f,-1,c.getNodeFilter())));f!==r&&(p=function(){return 0});f!==l&&null!==l&&(s=function(){return l.textContent.length-1});f=b(l,s);r=b(r,p);return f===m.WORD_CHAR&&r===m.WORD_CHAR||f===m.PUNCTUATION_CHAR&&r===m.PUNCTUATION_CHAR||k===e&&f!==m.NO_NEIGHBOUR&&r===m.SPACE_CHAR||k===a&&f===m.SPACE_CHAR&&r!==m.NO_NEIGHBOUR?q:n}};odf.WordBoundaryFilter.IncludeWhitespace={None:0,TRAILING:1,LEADING:2};gui.SelectionController=function(f,k){function d(a){var b=a.spec();if(a.isEdit||b.memberid===k)G=void 0,E.cancel()}function b(){var a=t.getCursor(k).getNode();return t.createStepIterator(a,0,[s,w],t.getRootElement(a))}function c(a,b,e){e=new odf.WordBoundaryFilter(t,e);var c=t.getRootElement(a)||t.getRootNode(),d=t.createRootFilter(c);return t.createStepIterator(a,b,[s,d,e],c)}function h(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 r(a,b,e){var c=new ops.OpMoveCursor;c.init({memberid:k,position:a,length:b||0,selectionType:e});return c}function l(a,b,e){var c;c=t.getCursor(k);c=h(c.getSelectedRange(),c.hasForwardSelection());c.focusNode=a;c.focusOffset=b;e||(c.anchorNode=c.focusNode,c.anchorOffset=c.focusOffset);a=t.convertDomToCursorRange(c);f.enqueue([r(a.position,a.length)])}function p(a){var b;b=c(a.startContainer, +a.startOffset,F);b.roundToPreviousStep()&&a.setStart(b.container(),b.offset());b=c(a.endContainer,a.endOffset,H);b.roundToNextStep()&&a.setEnd(b.container(),b.offset())}function n(a){var b=y.getParagraphElements(a),e=b[0],b=b[b.length-1];e&&a.setStart(e,0);b&&(y.isParagraph(a.endContainer)&&0===a.endOffset?a.setEndBefore(b):a.setEnd(b,b.childNodes.length))}function q(a,b,e,c){var d,f;c?(d=e.startContainer,f=e.startOffset):(d=e.endContainer,f=e.endOffset);v.containsNode(a,d)||(f=0>v.comparePoints(a, +0,d,f)?0:a.childNodes.length,d=a);a=t.createStepIterator(d,f,b,y.getParagraphElement(d)||a);a.roundToClosestStep()||runtime.assert(!1,"No step found in requested range");c?e.setStart(a.container(),a.offset()):e.setEnd(a.container(),a.offset())}function e(a,e){var c=b();c.advanceStep(a)&&l(c.container(),c.offset(),e)}function a(a,e){var c,d=G,f=[new gui.LineBoundaryScanner,new gui.ParagraphBoundaryScanner];void 0===d&&A&&(d=A());isNaN(d)||(c=b(),x.moveToFilteredStep(c,a,f)&&c.advanceStep(a)&&(f=[new gui.ClosestXOffsetScanner(d), +new gui.LineBoundaryScanner,new gui.ParagraphBoundaryScanner],x.moveToFilteredStep(c,a,f)&&(l(c.container(),c.offset(),e),G=d,E.restart())))}function m(a,e){var c=b(),d=[new gui.LineBoundaryScanner,new gui.ParagraphBoundaryScanner];x.moveToFilteredStep(c,a,d)&&l(c.container(),c.offset(),e)}function g(a,b){var e=t.getCursor(k),e=h(e.getSelectedRange(),e.hasForwardSelection()),e=c(e.focusNode,e.focusOffset,F);e.advanceStep(a)&&l(e.container(),e.offset(),b)}function z(a,b,e){var c=!1,d=t.getCursor(k), +d=h(d.getSelectedRange(),d.hasForwardSelection()),c=t.getRootElement(d.focusNode);runtime.assert(Boolean(c),"SelectionController: Cursor outside root");d=t.createStepIterator(d.focusNode,d.focusOffset,[s,w],c);d.roundToClosestStep();d.advanceStep(a)&&(e=e(d.container()))&&(a===N?(d.setPosition(e,0),c=d.roundToNextStep()):(d.setPosition(e,e.childNodes.length),c=d.roundToPreviousStep()),c&&l(d.container(),d.offset(),b))}var t=f.getOdtDocument(),v=new core.DomUtils,y=new odf.OdfUtils,s=t.getPositionFilter(), +x=new gui.GuiStepUtils,w=t.createRootFilter(k),A=null,G,E,F=odf.WordBoundaryFilter.IncludeWhitespace.TRAILING,H=odf.WordBoundaryFilter.IncludeWhitespace.LEADING,N=core.StepDirection.PREVIOUS,I=core.StepDirection.NEXT;this.selectionToRange=function(a){var b=0<=v.comparePoints(a.anchorNode,a.anchorOffset,a.focusNode,a.focusOffset),e=a.focusNode.ownerDocument.createRange();b?(e.setStart(a.anchorNode,a.anchorOffset),e.setEnd(a.focusNode,a.focusOffset)):(e.setStart(a.focusNode,a.focusOffset),e.setEnd(a.anchorNode, +a.anchorOffset));return{range:e,hasForwardSelection:b}};this.rangeToSelection=h;this.selectImage=function(a){var b=t.getRootElement(a),e=t.createRootFilter(b),b=t.createStepIterator(a,0,[e,t.getPositionFilter()],b),c;b.roundToPreviousStep()||runtime.assert(!1,"No walkable position before frame");e=b.container();c=b.offset();b.setPosition(a,a.childNodes.length);b.roundToNextStep()||runtime.assert(!1,"No walkable position after frame");a=t.convertDomToCursorRange({anchorNode:e,anchorOffset:c,focusNode:b.container(), +focusOffset:b.offset()});a=r(a.position,a.length,ops.OdtCursor.RegionSelection);f.enqueue([a])};this.expandToWordBoundaries=p;this.expandToParagraphBoundaries=n;this.selectRange=function(a,b,e){var c=t.getOdfCanvas().getElement(),d,g=[s];d=v.containsNode(c,a.startContainer);c=v.containsNode(c,a.endContainer);if(d||c)if(d&&c&&(2===e?p(a):3<=e&&n(a)),(e=b?t.getRootElement(a.startContainer):t.getRootElement(a.endContainer))||(e=t.getRootNode()),g.push(t.createRootFilter(e)),q(e,g,a,!0),q(e,g,a,!1),a= +h(a,b),b=t.convertDomToCursorRange(a),a=t.getCursorSelection(k),b.position!==a.position||b.length!==a.length)a=r(b.position,b.length,ops.OdtCursor.RangeSelection),f.enqueue([a])};this.moveCursorToLeft=function(){e(N,!1);return!0};this.moveCursorToRight=function(){e(I,!1);return!0};this.extendSelectionToLeft=function(){e(N,!0);return!0};this.extendSelectionToRight=function(){e(I,!0);return!0};this.setCaretXPositionLocator=function(a){A=a};this.moveCursorUp=function(){a(N,!1);return!0};this.moveCursorDown= +function(){a(I,!1);return!0};this.extendSelectionUp=function(){a(N,!0);return!0};this.extendSelectionDown=function(){a(I,!0);return!0};this.moveCursorBeforeWord=function(){g(N,!1);return!0};this.moveCursorPastWord=function(){g(I,!1);return!0};this.extendSelectionBeforeWord=function(){g(N,!0);return!0};this.extendSelectionPastWord=function(){g(I,!0);return!0};this.moveCursorToLineStart=function(){m(N,!1);return!0};this.moveCursorToLineEnd=function(){m(I,!1);return!0};this.extendSelectionToLineStart= +function(){m(N,!0);return!0};this.extendSelectionToLineEnd=function(){m(I,!0);return!0};this.extendSelectionToParagraphStart=function(){z(N,!0,t.getParagraphElement);return!0};this.extendSelectionToParagraphEnd=function(){z(I,!0,t.getParagraphElement);return!0};this.moveCursorToParagraphStart=function(){z(N,!1,t.getParagraphElement);return!0};this.moveCursorToParagraphEnd=function(){z(I,!1,t.getParagraphElement);return!0};this.moveCursorToDocumentStart=function(){z(N,!1,t.getRootElement);return!0}; +this.moveCursorToDocumentEnd=function(){z(I,!1,t.getRootElement);return!0};this.extendSelectionToDocumentStart=function(){z(N,!0,t.getRootElement);return!0};this.extendSelectionToDocumentEnd=function(){z(I,!0,t.getRootElement);return!0};this.extendSelectionToEntireDocument=function(){var a=t.getCursor(k),a=t.getRootElement(a.getNode()),b,e,c;runtime.assert(Boolean(a),"SelectionController: Cursor outside root");c=t.createStepIterator(a,0,[s,w],a);c.roundToClosestStep();b=c.container();e=c.offset(); +c.setPosition(a,a.childNodes.length);c.roundToClosestStep();a=t.convertDomToCursorRange({anchorNode:b,anchorOffset:e,focusNode:c.container(),focusOffset:c.offset()});f.enqueue([r(a.position,a.length)]);return!0};this.destroy=function(a){t.unsubscribe(ops.OdtDocument.signalOperationStart,d);core.Async.destroyAll([E.destroy],a)};(function(){E=core.Task.createTimeoutTask(function(){G=void 0},2E3);t.subscribe(ops.OdtDocument.signalOperationStart,d)})()};gui.TextController=function(f,k,d,b,c,h){function r(){t=!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)?d.isLocalCursorWithinOwnAnnotation():!0}function l(a){a.getMemberId()===b&&r()}function p(a){return a===ops.OdtStepsTranslator.NEXT_STEP}function n(a,b,e){var c=[m.getPositionFilter()];e&&c.push(m.createRootFilter(a.startContainer));e=m.createStepIterator(a.startContainer,a.startOffset,c,b);e.roundToClosestStep()||runtime.assert(!1,"No walkable step found in paragraph element at range start"); +b=m.convertDomPointToCursorStep(e.container(),e.offset());a.collapsed?a=b:(e.setPosition(a.endContainer,a.endOffset),e.roundToClosestStep()||runtime.assert(!1,"No walkable step found in paragraph element at range end"),a=m.convertDomPointToCursorStep(e.container(),e.offset()));return{position:b,length:a-b}}function q(a){var e,c,d,f=g.getParagraphElements(a),h=a.cloneRange(),k=[];e=f[0];1a.length&&(a.position+=a.length,a.length=-a.length);return a} +function a(a){if(!t)return!1;var c,d=m.getCursor(b).getSelectedRange().cloneRange(),g=e(m.getCursorSelection(b)),h;if(0===g.length){g=void 0;c=m.getCursor(b).getNode();h=m.getRootElement(c);var k=[m.getPositionFilter(),m.createRootFilter(h)];h=m.createStepIterator(c,0,k,h);h.roundToClosestStep()&&(a?h.nextStep():h.previousStep())&&(g=e(m.convertDomToCursorRange({anchorNode:c,anchorOffset:0,focusNode:h.container(),focusOffset:h.offset()})),a?(d.setStart(c,0),d.setEnd(h.container(),h.offset())):(d.setStart(h.container(), +h.offset()),d.setEnd(c,0)))}g&&f.enqueue(q(d));return void 0!==g}var m=f.getOdtDocument(),g=new odf.OdfUtils,z=new core.DomUtils,t=!1,v=odf.Namespaces.textns;this.isEnabled=function(){return t};this.enqueueParagraphSplittingOps=function(){if(!t)return!1;var a=m.getCursor(b),c=a.getSelectedRange(),d=e(m.getCursorSelection(b)),g=[],a=m.getParagraphElement(a.getNode()),k=a.getAttributeNS(v,"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):ac.left&&(c=x(d)))b.focusNode=c.container,b.focusOffset=c.offset,e&&(b.anchorNode=b.focusNode,b.anchorOffset=b.focusOffset)}else D.isImage(b.focusNode.firstChild)&&1===b.focusOffset&&D.isCharacterFrame(b.focusNode)&&(c=x(b.focusNode))&&(b.anchorNode=b.focusNode=c.container,b.anchorOffset=b.focusOffset=c.offset);b.anchorNode&&b.focusNode&&(b=W.selectionToRange(b),W.selectRange(b.range,b.hasForwardSelection,0===a.button?a.detail:0));R.focus()}function A(a){var b;if(b=r(a.clientX,a.clientY))a= +b.container,b=b.offset,a={anchorNode:a,anchorOffset:b,focusNode:a,focusOffset:b},a=W.selectionToRange(a),W.selectRange(a.range,a.hasForwardSelection,2),R.focus()}function G(a){var e=h(a),c,d,f;ja.processRequests();S&&(D.isImage(e)&&D.isCharacterFrame(e.parentNode)&&Q.getSelection().isCollapsed?(W.selectImage(e.parentNode),R.focus()):la.isSelectorElement(e)?R.focus():O?(e=b.getSelectedRange(),d=e.collapsed,D.isImage(e.endContainer)&&0===e.endOffset&&D.isCharacterFrame(e.endContainer.parentNode)&&(f= +e.endContainer.parentNode,f=x(f))&&(e.setEnd(f.container,f.offset),d&&e.collapse(!1)),W.selectRange(e,b.hasForwardSelection(),0===a.button?a.detail:0),R.focus()):ua?w(a):(c=ea.cloneEvent(a),aa=runtime.setTimeout(function(){w(c)},0)),oa=0,O=S=!1)}function E(a){var b=u.getCursor(d).getSelectedRange();b.collapsed||P.exportRangeToDataTransfer(a.dataTransfer,b)}function F(){S&&R.focus();oa=0;O=S=!1}function H(a){G(a)}function N(a){var b=h(a),e=null;"annotationRemoveButton"===b.className?(runtime.assert(ha, +"Remove buttons are displayed on annotations while annotation editing is disabled in the controller."),e=ea.getElementsByTagNameNS(b.parentNode,odf.Namespaces.officens,"annotation")[0],ga.removeAnnotation(e),R.focus()):"webodf-draggable"!==b.getAttribute("class")&&G(a)}function I(a){(a=a.data)&&(-1===a.indexOf("\n")?fa.insertText(a):ra.paste(a))}function U(a){return function(){a();return!0}}function B(a){return function(b){return u.getCursor(d).getSelectionType()===ops.OdtCursor.RangeSelection?a(b): +!0}}function Z(b){R.unsubscribe("keydown",C.handleEvent);R.unsubscribe("keypress",T.handleEvent);R.unsubscribe("keyup",L.handleEvent);R.unsubscribe("copy",n);R.unsubscribe("mousedown",s);R.unsubscribe("mousemove",ja.trigger);R.unsubscribe("mouseup",N);R.unsubscribe("contextmenu",H);R.unsubscribe("dragstart",E);R.unsubscribe("dragend",F);R.unsubscribe("click",ma.handleClick);R.unsubscribe("longpress",A);R.unsubscribe("drag",t);R.unsubscribe("dragstop",v);u.unsubscribe(ops.OdtDocument.signalOperationEnd, +da.trigger);u.unsubscribe(ops.Document.signalCursorAdded,ka.registerCursor);u.unsubscribe(ops.Document.signalCursorRemoved,ka.removeCursor);u.unsubscribe(ops.OdtDocument.signalOperationEnd,a);b()}var Q=runtime.getWindow(),u=k.getOdtDocument(),Y=new gui.SessionConstraints,$=new gui.SessionContext(k,d),ea=new core.DomUtils,D=new odf.OdfUtils,P=new gui.MimeDataExporter,X=new gui.Clipboard(P),C=new gui.KeyboardHandler,T=new gui.KeyboardHandler,L=new gui.KeyboardHandler,S=!1,J=new odf.ObjectNameGenerator(u.getOdfCanvas().odfContainer(), +d),O=!1,V=null,aa,ba=null,R=new gui.EventManager(u),ha=c.annotationsEnabled,ga=new gui.AnnotationController(k,Y,d),ca=new gui.DirectFormattingController(k,Y,$,d,J,c.directTextStylingEnabled,c.directParagraphStylingEnabled),fa=new gui.TextController(k,Y,$,d,ca.createCursorStyleOp,ca.createParagraphStyleOps),na=new gui.ImageController(k,Y,$,d,J),la=new gui.ImageSelector(u.getOdfCanvas()),ia=gui.SelectionMover.createPositionIterator(u.getRootNode()),ja,da,ra=new gui.PasteController(k,Y,$,d),ka=new gui.InputMethodEditor(d, +R),oa=0,ma=new gui.HyperlinkClickHandler(u.getOdfCanvas().getElement,C,L),ta=new gui.HyperlinkController(k,Y,$,d),W=new gui.SelectionController(k,d),sa=new gui.MetadataController(k,d),K=gui.KeyboardHandler.Modifier,M=gui.KeyboardHandler.KeyCode,pa=-1!==Q.navigator.appVersion.toLowerCase().indexOf("mac"),ua=-1!==["iPad","iPod","iPhone"].indexOf(Q.navigator.platform),qa;runtime.assert(null!==Q,"Expected to be run in an environment which has a global window, like a browser.");this.undo=g;this.redo=z; +this.insertLocalCursor=function(){runtime.assert(void 0===k.getOdtDocument().getCursor(d),"Inserting local cursor a second time.");var a=new ops.OpAddCursor;a.init({memberid:d});k.enqueue([a]);R.focus()};this.removeLocalCursor=function(){runtime.assert(void 0!==k.getOdtDocument().getCursor(d),"Removing local cursor without inserting before.");var a=new ops.OpRemoveCursor;a.init({memberid:d});k.enqueue([a])};this.startEditing=function(){ka.subscribe(gui.InputMethodEditor.signalCompositionStart,fa.removeCurrentSelection); +ka.subscribe(gui.InputMethodEditor.signalCompositionEnd,I);R.subscribe("beforecut",p);R.subscribe("cut",l);R.subscribe("beforepaste",e);R.subscribe("paste",q);ba&&ba.initialize();R.setEditing(!0);ma.setModifier(pa?K.Meta:K.Ctrl);C.bind(M.Backspace,K.None,U(fa.removeTextByBackspaceKey),!0);C.bind(M.Delete,K.None,fa.removeTextByDeleteKey);C.bind(M.Tab,K.None,B(function(){fa.insertText("\t");return!0}));pa?(C.bind(M.Clear,K.None,fa.removeCurrentSelection),C.bind(M.B,K.Meta,B(ca.toggleBold)),C.bind(M.I, +K.Meta,B(ca.toggleItalic)),C.bind(M.U,K.Meta,B(ca.toggleUnderline)),C.bind(M.L,K.MetaShift,B(ca.alignParagraphLeft)),C.bind(M.E,K.MetaShift,B(ca.alignParagraphCenter)),C.bind(M.R,K.MetaShift,B(ca.alignParagraphRight)),C.bind(M.J,K.MetaShift,B(ca.alignParagraphJustified)),ha&&C.bind(M.C,K.MetaShift,ga.addAnnotation),C.bind(M.Z,K.Meta,g),C.bind(M.Z,K.MetaShift,z)):(C.bind(M.B,K.Ctrl,B(ca.toggleBold)),C.bind(M.I,K.Ctrl,B(ca.toggleItalic)),C.bind(M.U,K.Ctrl,B(ca.toggleUnderline)),C.bind(M.L,K.CtrlShift, +B(ca.alignParagraphLeft)),C.bind(M.E,K.CtrlShift,B(ca.alignParagraphCenter)),C.bind(M.R,K.CtrlShift,B(ca.alignParagraphRight)),C.bind(M.J,K.CtrlShift,B(ca.alignParagraphJustified)),ha&&C.bind(M.C,K.CtrlAlt,ga.addAnnotation),C.bind(M.Z,K.Ctrl,g),C.bind(M.Z,K.CtrlShift,z));T.setDefault(B(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:(fa.insertText(b),!0)})); +T.bind(M.Enter,K.None,B(fa.enqueueParagraphSplittingOps))};this.endEditing=function(){ka.unsubscribe(gui.InputMethodEditor.signalCompositionStart,fa.removeCurrentSelection);ka.unsubscribe(gui.InputMethodEditor.signalCompositionEnd,I);R.unsubscribe("cut",l);R.unsubscribe("beforecut",p);R.unsubscribe("paste",q);R.unsubscribe("beforepaste",e);R.setEditing(!1);ma.setModifier(K.None);C.bind(M.Backspace,K.None,function(){return!0},!0);C.unbind(M.Delete,K.None);C.unbind(M.Tab,K.None);pa?(C.unbind(M.Clear, +K.None),C.unbind(M.B,K.Meta),C.unbind(M.I,K.Meta),C.unbind(M.U,K.Meta),C.unbind(M.L,K.MetaShift),C.unbind(M.E,K.MetaShift),C.unbind(M.R,K.MetaShift),C.unbind(M.J,K.MetaShift),ha&&C.unbind(M.C,K.MetaShift),C.unbind(M.Z,K.Meta),C.unbind(M.Z,K.MetaShift)):(C.unbind(M.B,K.Ctrl),C.unbind(M.I,K.Ctrl),C.unbind(M.U,K.Ctrl),C.unbind(M.L,K.CtrlShift),C.unbind(M.E,K.CtrlShift),C.unbind(M.R,K.CtrlShift),C.unbind(M.J,K.CtrlShift),ha&&C.unbind(M.C,K.CtrlAlt),C.unbind(M.Z,K.Ctrl),C.unbind(M.Z,K.CtrlShift));T.setDefault(null); +T.unbind(M.Enter,K.None)};this.getInputMemberId=function(){return d};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(u),ba.setPlaybackFunction(k.enqueue),ba.subscribe(gui.UndoManager.signalUndoStackChanged,m)};this.getUndoManager=function(){return ba};this.getMetadataController=function(){return sa};this.getAnnotationController=function(){return ga}; +this.getDirectFormattingController=function(){return ca};this.getHyperlinkClickHandler=function(){return ma};this.getHyperlinkController=function(){return ta};this.getImageController=function(){return na};this.getSelectionController=function(){return W};this.getTextController=function(){return fa};this.getEventManager=function(){return R};this.getKeyboardHandlers=function(){return{keydown:C,keypress:T}};this.destroy=function(a){var b=[ja.destroy,da.destroy,ca.destroy,ka.destroy,R.destroy,ma.destroy, +ta.destroy,sa.destroy,W.destroy,fa.destroy,Z];qa&&b.unshift(qa.destroy);runtime.clearTimeout(aa);core.Async.destroyAll(b,a)};ja=core.Task.createRedrawTask(y);da=core.Task.createRedrawTask(function(){var a=u.getCursor(d);if(a&&a.getSelectionType()===ops.OdtCursor.RegionSelection&&(a=D.getImageElements(a.getSelectedRange())[0])){la.select(a.parentNode);return}la.clearSelection()});C.bind(M.Left,K.None,B(W.moveCursorToLeft));C.bind(M.Right,K.None,B(W.moveCursorToRight));C.bind(M.Up,K.None,B(W.moveCursorUp)); +C.bind(M.Down,K.None,B(W.moveCursorDown));C.bind(M.Left,K.Shift,B(W.extendSelectionToLeft));C.bind(M.Right,K.Shift,B(W.extendSelectionToRight));C.bind(M.Up,K.Shift,B(W.extendSelectionUp));C.bind(M.Down,K.Shift,B(W.extendSelectionDown));C.bind(M.Home,K.None,B(W.moveCursorToLineStart));C.bind(M.End,K.None,B(W.moveCursorToLineEnd));C.bind(M.Home,K.Ctrl,B(W.moveCursorToDocumentStart));C.bind(M.End,K.Ctrl,B(W.moveCursorToDocumentEnd));C.bind(M.Home,K.Shift,B(W.extendSelectionToLineStart));C.bind(M.End, +K.Shift,B(W.extendSelectionToLineEnd));C.bind(M.Up,K.CtrlShift,B(W.extendSelectionToParagraphStart));C.bind(M.Down,K.CtrlShift,B(W.extendSelectionToParagraphEnd));C.bind(M.Home,K.CtrlShift,B(W.extendSelectionToDocumentStart));C.bind(M.End,K.CtrlShift,B(W.extendSelectionToDocumentEnd));pa?(C.bind(M.Left,K.Alt,B(W.moveCursorBeforeWord)),C.bind(M.Right,K.Alt,B(W.moveCursorPastWord)),C.bind(M.Left,K.Meta,B(W.moveCursorToLineStart)),C.bind(M.Right,K.Meta,B(W.moveCursorToLineEnd)),C.bind(M.Home,K.Meta, +B(W.moveCursorToDocumentStart)),C.bind(M.End,K.Meta,B(W.moveCursorToDocumentEnd)),C.bind(M.Left,K.AltShift,B(W.extendSelectionBeforeWord)),C.bind(M.Right,K.AltShift,B(W.extendSelectionPastWord)),C.bind(M.Left,K.MetaShift,B(W.extendSelectionToLineStart)),C.bind(M.Right,K.MetaShift,B(W.extendSelectionToLineEnd)),C.bind(M.Up,K.AltShift,B(W.extendSelectionToParagraphStart)),C.bind(M.Down,K.AltShift,B(W.extendSelectionToParagraphEnd)),C.bind(M.Up,K.MetaShift,B(W.extendSelectionToDocumentStart)),C.bind(M.Down, +K.MetaShift,B(W.extendSelectionToDocumentEnd)),C.bind(M.A,K.Meta,B(W.extendSelectionToEntireDocument))):(C.bind(M.Left,K.Ctrl,B(W.moveCursorBeforeWord)),C.bind(M.Right,K.Ctrl,B(W.moveCursorPastWord)),C.bind(M.Left,K.CtrlShift,B(W.extendSelectionBeforeWord)),C.bind(M.Right,K.CtrlShift,B(W.extendSelectionPastWord)),C.bind(M.A,K.Ctrl,B(W.extendSelectionToEntireDocument)));ua&&(qa=new gui.IOSSafariSupport(R));R.subscribe("keydown",C.handleEvent);R.subscribe("keypress",T.handleEvent);R.subscribe("keyup", +L.handleEvent);R.subscribe("copy",n);R.subscribe("mousedown",s);R.subscribe("mousemove",ja.trigger);R.subscribe("mouseup",N);R.subscribe("contextmenu",H);R.subscribe("dragstart",E);R.subscribe("dragend",F);R.subscribe("click",ma.handleClick);R.subscribe("longpress",A);R.subscribe("drag",t);R.subscribe("dragstop",v);u.subscribe(ops.OdtDocument.signalOperationEnd,da.trigger);u.subscribe(ops.Document.signalCursorAdded,ka.registerCursor);u.subscribe(ops.Document.signalCursorRemoved,ka.removeCursor);u.subscribe(ops.OdtDocument.signalOperationEnd, +a)}})();gui.CaretManager=function(f){function k(a){return m.hasOwnProperty(a)?m[a]:null}function d(){var a=k(f.getInputMemberId()),b;a&&(b=a.getBoundingClientRect());return b?b.right:void 0}function b(){return Object.keys(m).map(function(a){return m[a]})}function c(a){var b=m[a];b&&(delete m[a],a===f.getInputMemberId()&&f.getEventManager().unsubscribe("compositionupdate",b.handleUpdate),b.destroy(function(){}))}function h(a){a=a.getMemberId();a===f.getInputMemberId()&&(a=k(a))&&a.refreshCursorBlinking()} +function r(){var a=k(f.getInputMemberId());t=!1;a&&a.ensureVisible()}function l(){var a=k(f.getInputMemberId());a&&(a.handleUpdate(),t||(t=!0,z=runtime.setTimeout(r,50)))}function p(a){a.memberId===f.getInputMemberId()&&l()}function n(){var a=k(f.getInputMemberId());a&&a.setFocus()}function q(){var a=k(f.getInputMemberId());a&&a.removeFocus()}function e(){var a=k(f.getInputMemberId());a&&a.show()}function a(){var a=k(f.getInputMemberId());a&&a.hide()}var m={},g=runtime.getWindow(),z,t=!1;this.registerCursor= +function(a,b,e){var c=a.getMemberId();b=new gui.Caret(a,b,e);e=f.getEventManager();m[c]=b;c===f.getInputMemberId()?(runtime.log("Starting to track input on new cursor of "+c),a.subscribe(ops.OdtCursor.signalCursorUpdated,l),e.subscribe("compositionupdate",b.handleUpdate),b.setOverlayElement(e.getEventTrap())):a.subscribe(ops.OdtCursor.signalCursorUpdated,b.handleUpdate);return b};this.getCaret=k;this.getCarets=b;this.destroy=function(d){var k=f.getSession().getOdtDocument(),l=f.getEventManager(), +r=b().map(function(a){return a.destroy});f.getSelectionController().setCaretXPositionLocator(null);runtime.clearTimeout(z);k.unsubscribe(ops.OdtDocument.signalParagraphChanged,p);k.unsubscribe(ops.Document.signalCursorMoved,h);k.unsubscribe(ops.Document.signalCursorRemoved,c);l.unsubscribe("focus",n);l.unsubscribe("blur",q);g.removeEventListener("focus",e,!1);g.removeEventListener("blur",a,!1);m={};core.Async.destroyAll(r,d)};(function(){var b=f.getSession().getOdtDocument(),k=f.getEventManager(); +f.getSelectionController().setCaretXPositionLocator(d);b.subscribe(ops.OdtDocument.signalParagraphChanged,p);b.subscribe(ops.Document.signalCursorMoved,h);b.subscribe(ops.Document.signalCursorRemoved,c);k.subscribe("focus",n);k.subscribe("blur",q);g.addEventListener("focus",e,!1);g.addEventListener("blur",a,!1)})()};gui.EditInfoHandle=function(f){var k=[],d,b=f.ownerDocument,c=b.documentElement.namespaceURI;this.setEdits=function(f){k=f;var r,l,p,n;d.innerHTML="";for(f=0;fa?(l=d(1,0),p=d(0.5,1E4-a),n=d(0.2,2E4-a)):1E4<=a&&2E4>a?(l=d(0.5,0),n=d(0.2,2E4-a)):l=d(0.2,0)};this.getEdits=function(){return f.getEdits()};this.clearEdits= +function(){f.clearEdits();h.setEdits([]);r.hasAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")&&r.removeAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")};this.getEditInfo=function(){return f};this.show=function(){r.style.display="block"};this.hide=function(){b.hideHandle();r.style.display="none"};this.showHandle=function(){h.show()};this.hideHandle=function(){h.hide()};this.destroy=function(b){runtime.clearTimeout(l);runtime.clearTimeout(p);runtime.clearTimeout(n);c.removeChild(r); +h.destroy(function(e){e?b(e):f.destroy(b)})};(function(){var d=f.getOdtDocument().getDOMDocument();r=d.createElementNS(d.documentElement.namespaceURI,"div");r.setAttribute("class","editInfoMarker");r.onmouseover=function(){b.showHandle()};r.onmouseout=function(){b.hideHandle()};c=f.getNode();c.appendChild(r);h=new gui.EditInfoHandle(c);k||b.hide()})()};gui.HyperlinkTooltipView=function(f,k){var d=new core.DomUtils,b=new odf.OdfUtils,c=runtime.getWindow(),h,r,l;runtime.assert(null!==c,"Expected to be run in an environment which has a global window, like a browser.");this.showTooltip=function(p){var n=p.target||p.srcElement,q=f.getSizer(),e=f.getZoomLevel(),a;a:{for(;n;){if(b.isHyperlink(n))break a;if(b.isParagraph(n)||b.isInlineRoot(n))break;n=n.parentNode}n=null}if(n){d.containsNode(q,l)||q.appendChild(l);a=r;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;h.textContent=b.getHyperlinkTarget(n);l.style.display="block";a=c.innerWidth-l.offsetWidth-15;n=p.clientX>a?a:p.clientX+15;a=c.innerHeight-l.offsetHeight-10;p=p.clientY>a?a:p.clientY+10;q=q.getBoundingClientRect();n=(n-q.left)/e;p=(p-q.top)/e;l.style.left=n+"px";l.style.top=p+"px"}};this.hideTooltip=function(){l.style.display="none"};this.destroy= +function(b){l.parentNode&&l.parentNode.removeChild(l);b()};(function(){var b=f.getElement().ownerDocument;h=b.createElement("span");r=b.createElement("span");h.className="webodf-hyperlinkTooltipLink";r.className="webodf-hyperlinkTooltipText";l=b.createElement("div");l.className="webodf-hyperlinkTooltip";l.appendChild(h);l.appendChild(r);f.getElement().appendChild(l)})()};gui.ShadowCursor=function(f){var k=f.getDOMDocument().createRange(),d=!0;this.removeFromDocument=function(){};this.getMemberId=function(){return gui.ShadowCursor.ShadowCursorMemberId};this.getSelectedRange=function(){return k};this.setSelectedRange=function(b,c){k=b;d=!1!==c};this.hasForwardSelection=function(){return d};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(d).map(function(b){return d[b]})}var d={};this.getSelectionView=function(b){return d.hasOwnProperty(b)?d[b]:null};this.getSelectionViews=k;this.removeSelectionView=function(b){d.hasOwnProperty(b)&&(d[b].destroy(function(){}),delete d[b])};this.hideSelectionView=function(b){d.hasOwnProperty(b)&&d[b].hide()};this.showSelectionView=function(b){d.hasOwnProperty(b)&&d[b].show()};this.rerenderSelectionViews=function(){Object.keys(d).forEach(function(b){d[b].rerender()})}; +this.registerCursor=function(b,c){var h=b.getMemberId(),k=new f(b);c?k.show():k.hide();return d[h]=k};this.destroy=function(b){function c(f,k){k?b(k):f .webodf-draggable"),a=gui.ShadowCursor.ShadowCursorMemberId,c(".webodf-selectionOverlay","{ fill: "+e+"; stroke: "+e+";}",""), +c(".webodf-touchEnabled .webodf-selectionOverlay","{ display: block; }"," > .webodf-draggable"))}function p(a){var b,e;for(e in x)x.hasOwnProperty(e)&&(b=x[e],a?b.show():b.hide())}function n(a){c.getCarets().forEach(function(b){a?b.showHandle():b.hideHandle()})}function q(a){var b=a.getMemberId();a=a.getProperties();l(b,a.fullName,a.color)}function e(a){var b=a.getMemberId(),e=d.getOdtDocument().getMember(b).getProperties();c.registerCursor(a,F,H);h.registerCursor(a,!0);if(a=c.getCaret(b))a.setAvatarImageUrl(e.imageUrl), +a.setColor(e.color);runtime.log("+++ View here +++ eagerly created an Caret for '"+b+"'! +++")}function a(a){a=a.getMemberId();var b=h.getSelectionView(k),e=h.getSelectionView(gui.ShadowCursor.ShadowCursorMemberId),d=c.getCaret(k);a===k?(e.hide(),b&&b.show(),d&&d.show()):a===gui.ShadowCursor.ShadowCursorMemberId&&(e.show(),b&&b.hide(),d&&d.hide())}function m(a){h.removeSelectionView(a)}function g(a){var b=a.paragraphElement,e=a.memberId;a=a.timeStamp;var c,f="",g=b.getElementsByTagNameNS(s,"editinfo").item(0); +g?(f=g.getAttributeNS(s,"id"),c=x[f]):(f=Math.random().toString(),c=new ops.EditInfo(b,d.getOdtDocument()),c=new gui.EditInfoMarker(c,E),g=b.getElementsByTagNameNS(s,"editinfo").item(0),g.setAttributeNS(s,"id",f),x[f]=c);c.addEdit(e,new Date(a));G.trigger()}function z(){var a;""!==y.innerHTML&&(y.innerHTML="");!0===b.getState(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN)&&(a=d.getOdtDocument().getMember(k))&&(a=a.getProperties().fullName,y.appendChild(document.createTextNode(".annotationWrapper:not([creator = '"+ +a+"']) .annotationRemoveButton { display: none; }")))}function t(c){var d=Object.keys(x).map(function(a){return x[a]});w.unsubscribe(ops.Document.signalMemberAdded,q);w.unsubscribe(ops.Document.signalMemberUpdated,q);w.unsubscribe(ops.Document.signalCursorAdded,e);w.unsubscribe(ops.Document.signalCursorRemoved,m);w.unsubscribe(ops.OdtDocument.signalParagraphChanged,g);w.unsubscribe(ops.Document.signalCursorMoved,a);w.unsubscribe(ops.OdtDocument.signalParagraphChanged,h.rerenderSelectionViews);w.unsubscribe(ops.OdtDocument.signalTableAdded, +h.rerenderSelectionViews);w.unsubscribe(ops.OdtDocument.signalParagraphStyleModified,h.rerenderSelectionViews);b.unsubscribe(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN,z);w.unsubscribe(ops.Document.signalMemberAdded,z);w.unsubscribe(ops.Document.signalMemberUpdated,z);v.parentNode.removeChild(v);y.parentNode.removeChild(y);(function B(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"; +odf.StyleCache=function(f){function k(a,b,e,c){b=e.getAttributeNS(b,"class-names");var d;if(b)for(b=b.split(" "),d=0;db.length;a&&f(b);return a}function d(b,a){function c(f){b[f]===a&&d.push(f)}var d=[];b&&["style:parent-style-name","style:next-style-name"].forEach(c);return d}function b(b,a){function c(d){b[d]===a&&delete b[d]}b&&["style:parent-style-name","style:next-style-name"].forEach(c)}function c(b){var a={};Object.keys(b).forEach(function(d){a[d]="object"===typeof b[d]?c(b[d]):b[d]});return a}function h(b, +a,c,d){var f,h=!1,k=!1,l,n=[];d&&d.attributes&&(n=d.attributes.split(","));b&&(c||0=a.position+a.length)){f=d?b:a;h=d?a:b;if(b.position!==a.position||b.length!==a.length)q=c(f),x=c(h);a=p(h.setProperties,null,f.setProperties,null,"style:text-properties");if(a.majorChanged||a.minorChanged)k=[],b=[],l=f.position+f.length,n=h.position+h.length,h.positionl?a.minorChanged&&(q=x,q.position=l,q.length=n-l,b.push(q),h.length=l-h.position):l>n&&a.majorChanged&&(q.position=n,q.length=l-n,k.push(q),f.length=n-f.position),f.setProperties&&r(f.setProperties)&&k.push(f),h.setProperties&&r(h.setProperties)&&b.push(h),d?(l=k,k=b):l=b}return{opSpecsA:l,opSpecsB:k}},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,d=b.position+b.length;c>=a.sourceStartPosition&&(c-=1);d>=a.sourceStartPosition&&(d-=1);b.position=c;b.length=d-c;return{opSpecsA:[b],opSpecsB:[a]}},MoveCursor:n,RemoveCursor:n,RemoveStyle:n,RemoveText:function(b,a){var c=b.position+b.length,d=a.position+a.length,f=[b],h=[a];d<=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:n,RemoveMember:n,RemoveStyle:n,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:d}},SplitParagraph:function(b,a){var c,d=[b],f=[a];a.position=b.destinationStartPosition&&a.position=b.sourceStartPosition&&(a.position-=1,a.sourceParagraphPosition-=1);return{opSpecsA:d,opSpecsB:f}}, +UpdateMember:n,UpdateMetadata:n,UpdateParagraphStyle:n},MoveCursor:{MoveCursor:n,RemoveCursor:function(b,a){return{opSpecsA:b.memberid===a.memberid?[]:[b],opSpecsB:[a]}},RemoveMember:n,RemoveStyle:n,RemoveText:function(b,a){var c=k(b),d=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=c(b),h.position=a.position+1,d.push(h));return{opSpecsA:d,opSpecsB:f}},UpdateMember:n,UpdateMetadata:n,UpdateParagraphStyle:n},SplitParagraph:{SplitParagraph:function(b, +a,c){var d,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";