UNPKG

node-viewerjs

Version:

Document viewer component for PDF and ODF documents. Done with just HTML5, CSS3, and JavaScript. Powered by pdf.js and WebODF.

134 lines (127 loc) 438 kB
/* This is a generated file. DO NOT EDIT. Copyright (C) 2010-2015 KO GmbH <copyright@kogmbh.com> @licstart This file is the compiled version of the WebODF library. WebODF is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License (GNU AGPL) as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WebODF is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with WebODF. If not, see <http://www.gnu.org/licenses/>. @licend @source: http://www.webodf.org/ @source: https://github.com/kogmbh/WebODF/ */ var webodf_version="0.5.10";function Runtime(){}Runtime.prototype.getVariable=function(g){};Runtime.prototype.toJson=function(g){};Runtime.prototype.fromJson=function(g){};Runtime.prototype.byteArrayFromString=function(g,k){};Runtime.prototype.byteArrayToString=function(g,k){};Runtime.prototype.read=function(g,k,d,b){};Runtime.prototype.readFile=function(g,k,d){};Runtime.prototype.readFileSync=function(g,k){};Runtime.prototype.loadXML=function(g,k){};Runtime.prototype.writeFile=function(g,k,d){}; Runtime.prototype.deleteFile=function(g,k){};Runtime.prototype.log=function(g,k){};Runtime.prototype.setTimeout=function(g,k){};Runtime.prototype.clearTimeout=function(g){};Runtime.prototype.libraryPaths=function(){};Runtime.prototype.currentDirectory=function(){};Runtime.prototype.setCurrentDirectory=function(g){};Runtime.prototype.type=function(){};Runtime.prototype.getDOMImplementation=function(){};Runtime.prototype.parseXML=function(g){};Runtime.prototype.exit=function(g){}; Runtime.prototype.getWindow=function(){};Runtime.prototype.requestAnimationFrame=function(g){};Runtime.prototype.cancelAnimationFrame=function(g){};Runtime.prototype.assert=function(g,k){};var IS_COMPILED_CODE=!0; Runtime.byteArrayToString=function(g,k){function d(b){var d="",r,q=b.length;for(r=0;r<q;r+=1)d+=String.fromCharCode(b[r]&255);return d}function b(b){var d="",r,q=b.length,e=[],l,a,c,m;for(r=3<=q&&239===b[0]&&187===b[1]&&191===b[2]?3:0;r<q;r+=1)l=b[r],128>l?e.push(l):(r+=1,a=b[r],194<=l&&224>l?e.push((l&31)<<6|a&63):(r+=1,c=b[r],224<=l&&240>l?e.push((l&15)<<12|(a&63)<<6|c&63):(r+=1,m=b[r],240<=l&&245>l&&(l=(l&7)<<18|(a&63)<<12|(c&63)<<6|m&63,l-=65536,e.push((l>>10)+55296,(l&1023)+56320))))),1E3<=e.length&& (d+=String.fromCharCode.apply(null,e),e.length=0);return d+String.fromCharCode.apply(null,e)}var f;"utf8"===k?f=b(g):("binary"!==k&&this.log("Unsupported encoding: "+k),f=d(g));return f};Runtime.getVariable=function(g){try{return eval(g)}catch(k){}};Runtime.toJson=function(g){return JSON.stringify(g)};Runtime.fromJson=function(g){return JSON.parse(g)};Runtime.getFunctionName=function(g){return void 0===g.name?(g=/function\s+(\w+)/.exec(g))&&g[1]:g.name}; Runtime.assert=function(g,k){if(!g)throw this.log("alert","ASSERTION FAILED:\n"+k),Error(k);}; function BrowserRuntime(){function g(b){var e=b.length,l,a,c=0;for(l=0;l<e;l+=1)a=b.charCodeAt(l),c+=1+(128<a)+(2048<a),55040<a&&57344>a&&(c+=1,l+=1);return c}function k(b,e,l){var a=b.length,c,m;e=new Uint8Array(new ArrayBuffer(e));l?(e[0]=239,e[1]=187,e[2]=191,m=3):m=0;for(l=0;l<a;l+=1)c=b.charCodeAt(l),128>c?(e[m]=c,m+=1):2048>c?(e[m]=192|c>>>6,e[m+1]=128|c&63,m+=2):55040>=c||57344<=c?(e[m]=224|c>>>12&15,e[m+1]=128|c>>>6&63,e[m+2]=128|c&63,m+=3):(l+=1,c=(c-55296<<10|b.charCodeAt(l)-56320)+65536, e[m]=240|c>>>18&7,e[m+1]=128|c>>>12&63,e[m+2]=128|c>>>6&63,e[m+3]=128|c&63,m+=4);return e}function d(b){var e=b.length,l=new Uint8Array(new ArrayBuffer(e)),a;for(a=0;a<e;a+=1)l[a]=b.charCodeAt(a)&255;return l}function b(b,e){var l;void 0!==e?l=b:e=b;console.log(e);r.enableAlerts&&"alert"===l&&alert(e)}function f(b,e,l){if(0!==l.status||l.responseText)if(200===l.status||0===l.status){if(l.response&&"string"!==typeof l.response)"binary"===e?(l=l.response,l=new Uint8Array(l)):l=String(l.response);else if("binary"=== e)if(null!==l.responseBody&&"undefined"!==String(typeof VBArray)){l=(new VBArray(l.responseBody)).toArray();var a=l.length;e=new Uint8Array(new ArrayBuffer(a));for(b=0;b<a;b+=1)e[b]=l[b];l=e}else{(b=l.getResponseHeader("Content-Length"))&&(b=parseInt(b,10));if(b&&b!==l.responseText.length)a:{a=l.responseText;e=!1;var c=g(a);if("number"===typeof b){if(b!==c&&b!==c+3){a=void 0;break a}e=c+3===b;c=b}a=k(a,c,e)}void 0===a&&(a=d(l.responseText));l=a}else l=l.responseText;l={err:null,data:l}}else l={err:l.responseText|| l.statusText,data:null};else l={err:"File "+b+" is empty.",data:null};return l}function n(b,e,l){var a=new XMLHttpRequest;a.open("GET",b,l);a.overrideMimeType&&("binary"!==e?a.overrideMimeType("text/plain; charset="+e):a.overrideMimeType("text/plain; charset=x-user-defined"));return a}function p(b,e,l){var a=n(b,e,!0);a.onreadystatechange=function(){var c;4===a.readyState&&(c=f(b,e,a),l(c.err,c.data))};try{a.send(null)}catch(c){l(c.message,null)}}var r=this;this.byteArrayFromString=function(b,e){var l; "utf8"===e?l=k(b,g(b),!1):("binary"!==e&&r.log("unknown encoding: "+e),l=d(b));return l};this.byteArrayToString=Runtime.byteArrayToString;this.getVariable=Runtime.getVariable;this.fromJson=Runtime.fromJson;this.toJson=Runtime.toJson;this.readFile=p;this.read=function(b,e,l,a){p(b,"binary",function(c,m){var h=null;if(m){if("string"===typeof m)throw"This should not happen.";h=m.subarray(e,e+l)}a(c,h)})};this.readFileSync=function(b,e){var l=n(b,e,!1),a;try{l.send(null);a=f(b,e,l);if(a.err)throw a.err; if(null===a.data)throw"No data read from "+b+".";}catch(c){throw c;}return a.data};this.writeFile=function(b,e,l){var a=new XMLHttpRequest,c;a.open("PUT",b,!0);a.onreadystatechange=function(){4===a.readyState&&(0!==a.status||a.responseText?200<=a.status&&300>a.status||0===a.status?l(null):l("Status "+String(a.status)+": "+a.responseText||a.statusText):l("File "+b+" is empty."))};c=e.buffer&&!a.sendAsBinary?e.buffer:r.byteArrayToString(e,"binary");try{a.sendAsBinary?a.sendAsBinary(c):a.send(c)}catch(m){r.log("HUH? "+ m+" "+e),l(m.message)}};this.deleteFile=function(b,e){var l=new XMLHttpRequest;l.open("DELETE",b,!0);l.onreadystatechange=function(){4===l.readyState&&(200>l.status&&300<=l.status?e(l.responseText):e(null))};l.send(null)};this.loadXML=function(b,e){var l=new XMLHttpRequest;l.open("GET",b,!0);l.overrideMimeType&&l.overrideMimeType("text/xml");l.onreadystatechange=function(){4===l.readyState&&(0!==l.status||l.responseText?200===l.status||0===l.status?e(null,l.responseXML):e(l.responseText,null):e("File "+ b+" is empty.",null))};try{l.send(null)}catch(a){e(a.message,null)}};this.log=b;this.enableAlerts=!0;this.assert=Runtime.assert;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(d){b("Calling exit with code "+String(d)+", but exit() is not implemented.")};this.getWindow=function(){return window};this.requestAnimationFrame=function(b){var e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame,l=0;if(e)e.bind(window),l=e(b);else return setTimeout(b,15);return l};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 g(b){var e=b.length,l,a=new Uint8Array(new ArrayBuffer(e));for(l=0;l<e;l+=1)a[l]=b[l];return a}function k(d,e,l){function a(a,m){if(a)return l(a,null);if(!m)return l("No data for "+d+".",null);if("string"===typeof m)return l(a,m);l(a,g(m))}d=f.resolve(n,d);"binary"!==e?b.readFile(d,e,a):b.readFile(d,null,a)}var d=this,b=require("fs"),f=require("path"),n="",p,r;this.byteArrayFromString=function(b,e){var l=new Buffer(b,e),a,c=l.length,m=new Uint8Array(new ArrayBuffer(c)); for(a=0;a<c;a+=1)m[a]=l[a];return m};this.byteArrayToString=Runtime.byteArrayToString;this.getVariable=Runtime.getVariable;this.fromJson=Runtime.fromJson;this.toJson=Runtime.toJson;this.readFile=k;this.loadXML=function(b,e){k(b,"utf-8",function(l,a){if(l)return e(l,null);if(!a)return e("No data for "+b+".",null);e(null,d.parseXML(a))})};this.writeFile=function(d,e,l){e=new Buffer(e);d=f.resolve(n,d);b.writeFile(d,e,"binary",function(a){l(a||null)})};this.deleteFile=function(d,e){d=f.resolve(n,d); b.unlink(d,e)};this.read=function(d,e,l,a){d=f.resolve(n,d);b.open(d,"r+",666,function(c,m){if(c)a(c,null);else{var h=new Buffer(l);b.read(m,h,0,l,e,function(c){b.close(m);a(c,g(h))})}})};this.readFileSync=function(d,e){var l;l=b.readFileSync(d,"binary"===e?null:e);if(null===l)throw"File "+d+" could not be read.";"binary"===e&&(l=g(l));return l};this.log=function(b,e){var l;void 0!==e?l=b:e=b;"alert"===l&&process.stderr.write("\n!!!!! ALERT !!!!!\n");process.stderr.write(e+"\n");"alert"===l&&process.stderr.write("!!!!! ALERT !!!!!\n")}; this.assert=Runtime.assert;this.setTimeout=function(b,e){return setTimeout(function(){b()},e)};this.clearTimeout=function(b){clearTimeout(b)};this.libraryPaths=function(){return[__dirname]};this.setCurrentDirectory=function(b){n=b};this.currentDirectory=function(){return n};this.type=function(){return"NodeJSRuntime"};this.getDOMImplementation=function(){return r};this.parseXML=function(b){return p.parseFromString(b,"text/xml")};this.exit=process.exit;this.getWindow=function(){return null};this.requestAnimationFrame= function(b){return setTimeout(b,15)};this.cancelAnimationFrame=function(b){clearTimeout(b)};p=new (require("xmldom").DOMParser);r=d.parseXML("<a/>").implementation} function RhinoRuntime(){var g=this,k={},d=k.javax.xml.parsers.DocumentBuilderFactory.newInstance(),b,f,n="";d.setValidating(!1);d.setNamespaceAware(!0);d.setExpandEntityReferences(!1);d.setSchema(null);f=k.org.xml.sax.EntityResolver({resolveEntity:function(b,d){var f=new k.java.io.FileReader(d);return new k.org.xml.sax.InputSource(f)}});b=d.newDocumentBuilder();b.setEntityResolver(f);this.byteArrayFromString=function(b,d){var f,e=b.length,l=new Uint8Array(new ArrayBuffer(e));for(f=0;f<e;f+=1)l[f]= b.charCodeAt(f)&255;return l};this.byteArrayToString=Runtime.byteArrayToString;this.getVariable=Runtime.getVariable;this.fromJson=Runtime.fromJson;this.toJson=Runtime.toJson;this.loadXML=function(d,f){var n=new k.java.io.File(d),e=null;try{e=b.parse(n)}catch(l){return print(l),f(l,null)}f(null,e)};this.readFile=function(b,d,f){n&&(b=n+"/"+b);var e=new k.java.io.File(b),l="binary"===d?"latin1":d;e.isFile()?((b=readFile(b,l))&&"binary"===d&&(b=g.byteArrayFromString(b,"binary")),f(null,b)):f(b+" is not a file.", null)};this.writeFile=function(b,d,f){n&&(b=n+"/"+b);b=new k.java.io.FileOutputStream(b);var e,l=d.length;for(e=0;e<l;e+=1)b.write(d[e]);b.close();f(null)};this.deleteFile=function(b,d){n&&(b=n+"/"+b);var f=new k.java.io.File(b),e=b+Math.random(),e=new k.java.io.File(e);f.rename(e)?(e.deleteOnExit(),d(null)):d("Could not delete "+b)};this.read=function(b,d,f,e){n&&(b=n+"/"+b);var l;l=b;var a="binary";(new k.java.io.File(l)).isFile()?("binary"===a&&(a="latin1"),l=readFile(l,a)):l=null;l?e(null,this.byteArrayFromString(l.substring(d, d+f),"binary")):e("Cannot read "+b,null)};this.readFileSync=function(b,d){if(!d)return"";var f=readFile(b,d);if(null===f)throw"File could not be read.";return f};this.log=function(b,d){var f;void 0!==d?f=b:d=b;"alert"===f&&print("\n!!!!! ALERT !!!!!");print(d);"alert"===f&&print("!!!!! ALERT !!!!!")};this.assert=Runtime.assert;this.setTimeout=function(b){b();return 0};this.clearTimeout=function(){};this.libraryPaths=function(){return["lib"]};this.setCurrentDirectory=function(b){n=b};this.currentDirectory= function(){return n};this.type=function(){return"RhinoRuntime"};this.getDOMImplementation=function(){return b.getDOMImplementation()};this.parseXML=function(d){d=new k.java.io.StringReader(d);d=new k.org.xml.sax.InputSource(d);return b.parse(d)};this.exit=quit;this.getWindow=function(){return null};this.requestAnimationFrame=function(b){b();return 0};this.cancelAnimationFrame=function(){}} Runtime.create=function(){return"undefined"!==String(typeof window)?new BrowserRuntime:"undefined"!==String(typeof require)?new NodeJSRuntime:new RhinoRuntime};var runtime=Runtime.create(),core={},gui={},xmldom={},odf={},ops={},webodf={};(function(){webodf.Version="undefined"!==String(typeof webodf_version)?webodf_version:"From Source"})(); (function(){function g(b,d,e){var l=b+"/manifest.json",a,c;runtime.log("Loading manifest: "+l);try{a=runtime.readFileSync(l,"utf-8")}catch(m){if(e)runtime.log("No loadable manifest found.");else throw console.log(String(m)),m;return}e=JSON.parse(a);for(c in e)e.hasOwnProperty(c)&&(d[c]={dir:b,deps:e[c]})}function k(b,d,e){function l(h){if(!m[h]&&!e(h)){if(c[h])throw"Circular dependency detected for "+h+".";c[h]=!0;if(!d[h])throw"Missing dependency information for class "+h+".";var b=d[h],f=b.deps, n,r=f.length;for(n=0;n<r;n+=1)l(f[n]);c[h]=!1;m[h]=!0;a.push(b.dir+"/"+h.replace(".","/")+".js")}}var a=[],c={},m={};b.forEach(l);return a}function d(b,d){return d+("\n//# sourceURL="+b)}function b(b){var f,e;for(f=0;f<b.length;f+=1)e=runtime.readFileSync(b[f],"utf-8"),e=d(b[f],e),eval(e)}function f(b){b=b.split(".");var d,e=p,l=b.length;for(d=0;d<l;d+=1){if(!e.hasOwnProperty(b[d]))return!1;e=e[b[d]]}return!0}var n,p={core:core,gui:gui,xmldom:xmldom,odf:odf,ops:ops};runtime.loadClasses=function(d, p){if(IS_COMPILED_CODE||0===d.length)return p&&p();var e;if(!(e=n)){e=[];var l=runtime.libraryPaths(),a;runtime.currentDirectory()&&-1===l.indexOf(runtime.currentDirectory())&&g(runtime.currentDirectory(),e,!0);for(a=0;a<l.length;a+=1)g(l[a],e)}n=e;d=k(d,n,f);if(0===d.length)return p&&p();if("BrowserRuntime"===runtime.type()&&p){e=d;l=document.currentScript||document.documentElement.lastChild;a=document.createDocumentFragment();var c,m;for(m=0;m<e.length;m+=1)c=document.createElement("script"),c.type= "text/javascript",c.charset="utf-8",c.async=!1,c.setAttribute("src",e[m]),a.appendChild(c);p&&(c.onload=p);l.parentNode.insertBefore(a,l)}else b(d),p&&p()};runtime.loadClass=function(b,d){runtime.loadClasses([b],d)}})();(function(){var g=function(g){return g};runtime.getTranslator=function(){return g};runtime.setTranslator=function(k){g=k};runtime.tr=function(k){var d=g(k);return d&&"string"===String(typeof d)?d:k}})(); (function(g){function k(d){if(d.length){var b=d[0];runtime.readFile(b,"utf8",function(f,n){function g(){var b;(b=eval(k))&&runtime.exit(b)}var r="",r=b.lastIndexOf("/"),k=n,r=-1!==r?b.substring(0,r):".";runtime.setCurrentDirectory(r);f?(runtime.log(f),runtime.exit(1)):null===k?(runtime.log("No code found for "+b),runtime.exit(1)):g.apply(null,d)})}}g=g?Array.prototype.slice.call(g):[];"NodeJSRuntime"===runtime.type()?k(process.argv.slice(2)):"RhinoRuntime"===runtime.type()?k(g):k(g.slice(1))})("undefined"!== String(typeof arguments)&&arguments);(function(){core.Async=function(){return{forEach:function(g,k,d){function b(b){p!==n&&(b?(p=n,d(b)):(p+=1,p===n&&d(null)))}var f,n=g.length,p=0;for(f=0;f<n;f+=1)k(g[f],b)},destroyAll:function(g,k){function d(b,f){if(f)k(f);else if(b<g.length)g[b](function(f){d(b+1,f)});else k()}d(0,void 0)}}}()})(); function makeBase64(){function g(a){var c,m=a.length,h=new Uint8Array(new ArrayBuffer(m));for(c=0;c<m;c+=1)h[c]=a.charCodeAt(c)&255;return h}function k(a){var c,m="",h,b=a.length-2;for(h=0;h<b;h+=3)c=a[h]<<16|a[h+1]<<8|a[h+2],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[c>>>18],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[c>>>12&63],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[c>>>6&63],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[c& 63];h===b+1?(c=a[h]<<4,m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[c>>>6],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[c&63],m+="=="):h===b&&(c=a[h]<<10|a[h+1]<<2,m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[c>>>12],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[c>>>6&63],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[c&63],m+="=");return m}function d(a){a=a.replace(/[^A-Za-z0-9+\/]+/g, "");var c=a.length,m=new Uint8Array(new ArrayBuffer(3*c)),b=a.length%4,d=0,l,e;for(l=0;l<c;l+=4)e=(h[a.charAt(l)]||0)<<18|(h[a.charAt(l+1)]||0)<<12|(h[a.charAt(l+2)]||0)<<6|(h[a.charAt(l+3)]||0),m[d]=e>>16,m[d+1]=e>>8&255,m[d+2]=e&255,d+=3;c=3*c-[0,0,2,1][b];return m.subarray(0,c)}function b(a){var c,m,h=a.length,b=0,d=new Uint8Array(new ArrayBuffer(3*h));for(c=0;c<h;c+=1)m=a[c],128>m?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 f(a){var c,m,h,b,d=a.length,l=new Uint8Array(new ArrayBuffer(d)),e=0;for(c=0;c<d;c+=1)m=a[c],128>m?l[e++]=m:(c+=1,h=a[c],224>m?l[e++]=(m&31)<<6|h&63:(c+=1,b=a[c],l[e++]=(m&15)<<12|(h&63)<<6|b&63));return l.subarray(0,e)}function n(a){return k(g(a))}function p(a){return String.fromCharCode.apply(String,d(a))}function r(a){return f(g(a))}function q(a){a=f(a);for(var c="",m=0;m<a.length;)c+=String.fromCharCode.apply(String,a.subarray(m,m+45E3)),m+=45E3;return c}function e(a,c,m){var h,b, d,l="";for(d=c;d<m;d+=1)c=a.charCodeAt(d)&255,128>c?l+=String.fromCharCode(c):(d+=1,h=a.charCodeAt(d)&255,224>c?l+=String.fromCharCode((c&31)<<6|h&63):(d+=1,b=a.charCodeAt(d)&255,l+=String.fromCharCode((c&15)<<12|(h&63)<<6|b&63)));return l}function l(a,c){function m(){var d=b+1E5;d>a.length&&(d=a.length);h+=e(a,b,d);b=d;d=b===a.length;c(h,d)&&!d&&runtime.setTimeout(m,0)}var h="",b=0;1E5>a.length?c(e(a,0,a.length),!0):("string"!==typeof a&&(a=a.slice()),m())}function a(a){return b(g(a))}function c(a){return String.fromCharCode.apply(String, b(a))}function m(a){return String.fromCharCode.apply(String,b(g(a)))}var h=function(a){var c={},m,h;m=0;for(h=a.length;m<h;m+=1)c[a.charAt(m)]=m;return c}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),y,x,z=runtime.getWindow(),w,v;z&&z.btoa?(w=z.btoa,y=function(a){return w(m(a))}):(w=n,y=function(c){return k(a(c))});z&&z.atob?(v=z.atob,x=function(a){a=v(a);return e(a,0,a.length)}):(v=p,x=function(a){return q(d(a))});core.Base64=function(){this.convertByteArrayToBase64=this.convertUTF8ArrayToBase64= k;this.convertBase64ToByteArray=this.convertBase64ToUTF8Array=d;this.convertUTF16ArrayToByteArray=this.convertUTF16ArrayToUTF8Array=b;this.convertByteArrayToUTF16Array=this.convertUTF8ArrayToUTF16Array=f;this.convertUTF8StringToBase64=n;this.convertBase64ToUTF8String=p;this.convertUTF8StringToUTF16Array=r;this.convertByteArrayToUTF16String=this.convertUTF8ArrayToUTF16String=q;this.convertUTF8StringToUTF16String=l;this.convertUTF16StringToByteArray=this.convertUTF16StringToUTF8Array=a;this.convertUTF16ArrayToUTF8String= c;this.convertUTF16StringToUTF8String=m;this.convertUTF16StringToBase64=y;this.convertBase64ToUTF16String=x;this.fromBase64=p;this.toBase64=n;this.atob=v;this.btoa=w;this.utob=m;this.btou=l;this.encode=y;this.encodeURI=function(a){return y(a).replace(/[+\/]/g,function(a){return"+"===a?"-":"_"}).replace(/\\=+$/,"")};this.decode=function(a){return x(a.replace(/[\-_]/g,function(a){return"-"===a?"+":"/"}))};return this};return core.Base64}core.Base64=makeBase64(); core.CSSUnits=function(){var g=this,k={"in":1,cm:2.54,mm:25.4,pt:72,pc:12,px:96};this.convert=function(d,b,f){return d*k[f]/k[b]};this.convertMeasure=function(d,b){var f,n;d&&b&&(f=parseFloat(d),n=d.replace(f.toString(),""),f=g.convert(f,n,b));return f};this.getUnits=function(d){return d.substr(d.length-2,d.length)}}; (function(){function g(){var b,f,n,g,r,k,e,l,a;void 0===d&&(f=(b=runtime.getWindow())&&b.document,k=f.documentElement,e=f.body,d={rangeBCRIgnoresElementBCR:!1,unscaledRangeClientRects:!1,elementBCRIgnoresBodyScroll:!1},f&&(g=f.createElement("div"),g.style.position="absolute",g.style.left="-99999px",g.style.transform="scale(2)",g.style["-webkit-transform"]="scale(2)",r=f.createElement("div"),g.appendChild(r),e.appendChild(g),b=f.createRange(),b.selectNode(r),d.rangeBCRIgnoresElementBCR=0===b.getClientRects().length, r.appendChild(f.createTextNode("Rect transform test")),f=r.getBoundingClientRect(),n=b.getBoundingClientRect(),d.unscaledRangeClientRects=2<Math.abs(f.height-n.height),g.style.transform="",g.style["-webkit-transform"]="",f=k.style.overflow,n=e.style.overflow,l=e.style.height,a=e.scrollTop,k.style.overflow="visible",e.style.overflow="visible",e.style.height="200%",e.scrollTop=e.scrollHeight,d.elementBCRIgnoresBodyScroll=b.getBoundingClientRect().top!==r.getBoundingClientRect().top,e.scrollTop=a,e.style.height= l,e.style.overflow=n,k.style.overflow=f,b.detach(),e.removeChild(g),b=Object.keys(d).map(function(a){return a+":"+String(d[a])}).join(", "),runtime.log("Detected browser quirks - "+b)));return d}function k(b,d,n){for(b=b?b.firstElementChild:null;b;){if(b.localName===n&&b.namespaceURI===d)return b;b=b.nextElementSibling}return null}var d;core.DomUtilsImpl=function(){function b(a,c){for(var b=0,d;a.parentNode!==c;)runtime.assert(null!==a.parentNode,"parent is null"),a=a.parentNode;for(d=c.firstChild;d!== a;)b+=1,d=d.nextSibling;return b}function d(a,c){return 0>=a.compareBoundaryPoints(Range.START_TO_START,c)&&0<=a.compareBoundaryPoints(Range.END_TO_END,c)}function n(a,c){return 0>=a.compareBoundaryPoints(Range.END_TO_START,c)&&0<=a.compareBoundaryPoints(Range.START_TO_END,c)}function p(a,c){var b=null;a.nodeType===Node.TEXT_NODE&&(0===a.length?(a.parentNode.removeChild(a),c.nodeType===Node.TEXT_NODE&&(b=c)):(c.nodeType===Node.TEXT_NODE&&(a.appendData(c.data),c.parentNode.removeChild(c)),b=a));return b} function r(a){for(var c=a.parentNode;a.firstChild;)c.insertBefore(a.firstChild,a);c.removeChild(a);return c}function q(a,c){var b=a.parentNode,d=a.firstChild,l=c(a),e;if(l===NodeFilter.FILTER_SKIP)return b;for(;d;)e=d.nextSibling,q(d,c),d=e;b&&l===NodeFilter.FILTER_REJECT&&r(a);return b}function e(a,c){return a===c||Boolean(a.compareDocumentPosition(c)&Node.DOCUMENT_POSITION_CONTAINED_BY)}function l(a,c){return g().unscaledRangeClientRects?a:a/c}function a(c,h,b){Object.keys(h).forEach(function(d){var l= d.split(":"),e=l[1],f=b(l[0]),l=h[d],n=typeof l;"object"===n?Object.keys(l).length&&(d=f?c.getElementsByTagNameNS(f,e)[0]||c.ownerDocument.createElementNS(f,d):c.getElementsByTagName(e)[0]||c.ownerDocument.createElement(d),c.appendChild(d),a(d,l,b)):f&&(runtime.assert("number"===n||"string"===n,"attempting to map unsupported type '"+n+"' (key: "+d+")"),c.setAttributeNS(f,d,String(l)))})}var c=null;this.splitBoundaries=function(a){var c,d=[],l,e,f;if(a.startContainer.nodeType===Node.TEXT_NODE||a.endContainer.nodeType=== Node.TEXT_NODE){l=a.endContainer;e=a.endContainer.nodeType!==Node.TEXT_NODE?a.endOffset===a.endContainer.childNodes.length:!1;f=a.endOffset;c=a.endContainer;if(f<c.childNodes.length)for(c=c.childNodes.item(f),f=0;c.firstChild;)c=c.firstChild;else for(;c.lastChild;)c=c.lastChild,f=c.nodeType===Node.TEXT_NODE?c.textContent.length:c.childNodes.length;c===l&&(l=null);a.setEnd(c,f);f=a.endContainer;0!==a.endOffset&&f.nodeType===Node.TEXT_NODE&&(c=f,a.endOffset!==c.length&&(d.push(c.splitText(a.endOffset)), d.push(c)));f=a.startContainer;0!==a.startOffset&&f.nodeType===Node.TEXT_NODE&&(c=f,a.startOffset!==c.length&&(f=c.splitText(a.startOffset),d.push(c),d.push(f),a.setStart(f,0)));if(null!==l){for(f=a.endContainer;f.parentNode&&f.parentNode!==l;)f=f.parentNode;e=e?l.childNodes.length:b(f,l);a.setEnd(l,e)}}return d};this.containsRange=d;this.rangesIntersect=n;this.rangeIntersection=function(a,c){var b;n(a,c)&&(b=a.cloneRange(),-1===a.compareBoundaryPoints(Range.START_TO_START,c)&&b.setStart(c.startContainer, c.startOffset),1===a.compareBoundaryPoints(Range.END_TO_END,c)&&b.setEnd(c.endContainer,c.endOffset));return b};this.getNodesInRange=function(a,c,b){var d=[],l=a.commonAncestorContainer,l=l.nodeType===Node.TEXT_NODE?l.parentNode:l;b=a.startContainer.ownerDocument.createTreeWalker(l,b,c,!1);var e,f;a.endContainer.childNodes[a.endOffset-1]?(e=a.endContainer.childNodes[a.endOffset-1],f=Node.DOCUMENT_POSITION_PRECEDING|Node.DOCUMENT_POSITION_CONTAINED_BY):(e=a.endContainer,f=Node.DOCUMENT_POSITION_PRECEDING); if(a.startContainer.childNodes[a.startOffset])a=a.startContainer.childNodes[a.startOffset],b.currentNode=a;else{var n=a.startContainer;a.startOffset===(n.nodeType===Node.TEXT_NODE?n.length:n.childNodes.length)?(a=a.startContainer,b.currentNode=a,b.lastChild(),a=b.nextNode()):(a=a.startContainer,b.currentNode=a)}if(a){a=b.currentNode;if(a!==l)for(a=a.parentNode;a&&a!==l;)c(a)===NodeFilter.FILTER_REJECT&&(b.currentNode=a),a=a.parentNode;a=b.currentNode;switch(c(a)){case NodeFilter.FILTER_REJECT:for(a= b.nextSibling();!a&&b.parentNode();)a=b.nextSibling();break;case NodeFilter.FILTER_SKIP:a=b.nextNode()}for(;a;){c=e.compareDocumentPosition(a);if(0!==c&&0===(c&f))break;d.push(a);a=b.nextNode()}}return d};this.normalizeTextNodes=function(a){a&&a.nextSibling&&(a=p(a,a.nextSibling));a&&a.previousSibling&&p(a.previousSibling,a)};this.rangeContainsNode=function(a,c){var b=c.ownerDocument.createRange(),l=c.ownerDocument.createRange(),e;b.setStart(a.startContainer,a.startOffset);b.setEnd(a.endContainer, a.endOffset);l.selectNodeContents(c);e=d(b,l);b.detach();l.detach();return e};this.mergeIntoParent=r;this.removeUnwantedNodes=q;this.removeAllChildNodes=function(a){for(;a.firstChild;)a.removeChild(a.firstChild)};this.getElementsByTagNameNS=function(a,c,b){var d=[];a=a.getElementsByTagNameNS(c,b);d.length=b=a.length;for(c=0;c<b;c+=1)d[c]=a.item(c);return d};this.getElementsByTagName=function(a,c){var b=[],d,l,e;d=a.getElementsByTagName(c);b.length=e=d.length;for(l=0;l<e;l+=1)b[l]=d.item(l);return b}; this.containsNode=function(a,c){return a===c||a.contains(c)};this.comparePoints=function(a,c,d,l){if(a===d)return l-c;var e=a.compareDocumentPosition(d);2===e?e=-1:4===e?e=1:10===e?(c=b(a,d),e=c<l?1:-1):(l=b(d,a),e=l<c?-1:1);return e};this.adaptRangeDifferenceToZoomLevel=l;this.translateRect=function(a,c,b){return{top:l(a.top-c.top,b),left:l(a.left-c.left,b),bottom:l(a.bottom-c.top,b),right:l(a.right-c.left,b),width:l(a.width,b),height:l(a.height,b)}};this.getBoundingClientRect=function(a){var b= a.ownerDocument,d=g(),l=b.body;if((!1===d.unscaledRangeClientRects||d.rangeBCRIgnoresElementBCR)&&a.nodeType===Node.ELEMENT_NODE)return a=a.getBoundingClientRect(),d.elementBCRIgnoresBodyScroll?{left:a.left+l.scrollLeft,right:a.right+l.scrollLeft,top:a.top+l.scrollTop,bottom:a.bottom+l.scrollTop,width:a.width,height:a.height}:a;var e;c?e=c:c=e=b.createRange();d=e;d.selectNode(a);return d.getBoundingClientRect()};this.mapKeyValObjOntoNode=function(a,c,b){Object.keys(c).forEach(function(d){var l=d.split(":"), e=l[1],l=b(l[0]),f=c[d];l?(e=a.getElementsByTagNameNS(l,e)[0],e||(e=a.ownerDocument.createElementNS(l,d),a.appendChild(e)),e.textContent=f):runtime.log("Key ignored: "+d)})};this.removeKeyElementsFromNode=function(a,c,b){c.forEach(function(c){var d=c.split(":"),h=d[1];(d=b(d[0]))?(h=a.getElementsByTagNameNS(d,h)[0])?h.parentNode.removeChild(h):runtime.log("Element for "+c+" not found."):runtime.log("Property Name ignored: "+c)})};this.getKeyValRepresentationOfNode=function(a,c){for(var b={},d=a.firstElementChild, l;d;){if(l=c(d.namespaceURI))b[l+":"+d.localName]=d.textContent;d=d.nextElementSibling}return b};this.mapObjOntoNode=a;this.cloneEvent=function(a){var c=Object.create(null);Object.keys(a.constructor.prototype).forEach(function(b){c[b]=a[b]});c.prototype=a.constructor.prototype;return c};this.getDirectChild=k;(function(a){var c,b;b=runtime.getWindow();null!==b&&(c=b.navigator.appVersion.toLowerCase(),b=-1===c.indexOf("chrome")&&(-1!==c.indexOf("applewebkit")||-1!==c.indexOf("safari")),c=-1!==c.indexOf("msie")|| -1!==c.indexOf("trident"),b||c)&&(a.containsNode=e)})(this)};core.DomUtils=new core.DomUtilsImpl})(); core.Cursor=function(g,k){function d(a){a.parentNode&&(r.push(a.previousSibling),r.push(a.nextSibling),a.parentNode.removeChild(a))}function b(a,c,b){if(c.nodeType===Node.TEXT_NODE){runtime.assert(Boolean(c),"putCursorIntoTextNode: invalid container");var d=c.parentNode;runtime.assert(Boolean(d),"putCursorIntoTextNode: container without parent");runtime.assert(0<=b&&b<=c.length,"putCursorIntoTextNode: offset is out of bounds");0===b?d.insertBefore(a,c):(b!==c.length&&c.splitText(b),d.insertBefore(a, c.nextSibling))}else c.nodeType===Node.ELEMENT_NODE&&c.insertBefore(a,c.childNodes.item(b));r.push(a.previousSibling);r.push(a.nextSibling)}var f=g.createElementNS("urn:webodf:names:cursor","cursor"),n=g.createElementNS("urn:webodf:names:cursor","anchor"),p,r=[],q=g.createRange(),e,l=core.DomUtils;this.getNode=function(){return f};this.getAnchorNode=function(){return n.parentNode?n:f};this.getSelectedRange=function(){e?(q.setStartBefore(f),q.collapse(!0)):(q.setStartAfter(p?n:f),q.setEndBefore(p? f:n));return q};this.setSelectedRange=function(a,c){q&&q!==a&&q.detach();q=a;p=!1!==c;(e=a.collapsed)?(d(n),d(f),b(f,a.startContainer,a.startOffset)):(d(n),d(f),b(p?f:n,a.endContainer,a.endOffset),b(p?n:f,a.startContainer,a.startOffset));r.forEach(l.normalizeTextNodes);r.length=0};this.hasForwardSelection=function(){return p};this.remove=function(){d(f);r.forEach(l.normalizeTextNodes);r.length=0};f.setAttributeNS("urn:webodf:names:cursor","memberId",k);n.setAttributeNS("urn:webodf:names:cursor","memberId", k)};core.Destroyable=function(){};core.Destroyable.prototype.destroy=function(g){};core.EventSource=function(){};core.EventSource.prototype.subscribe=function(g,k){};core.EventSource.prototype.unsubscribe=function(g,k){}; core.EventNotifier=function(g){function k(b){runtime.assert(!d.hasOwnProperty(b),'Duplicated event ids: "'+b+'" registered more than once.');d[b]=[]}var d={};this.emit=function(b,f){var n,g;runtime.assert(d.hasOwnProperty(b),'unknown event fired "'+b+'"');g=d[b];for(n=0;n<g.length;n+=1)g[n](f)};this.subscribe=function(b,f){runtime.assert(d.hasOwnProperty(b),'tried to subscribe to unknown event "'+b+'"');d[b].push(f)};this.unsubscribe=function(b,f){var n;runtime.assert(d.hasOwnProperty(b),'tried to unsubscribe from unknown event "'+ b+'"');n=d[b].indexOf(f);runtime.assert(-1!==n,'tried to unsubscribe unknown callback from event "'+b+'"');-1!==n&&d[b].splice(n,1)};this.register=k;g&&g.forEach(k)}; core.ScheduledTask=function(g,k,d){function b(){p&&(d(n),p=!1)}function f(){b();g.apply(void 0,r);r=null}var n,p=!1,r=[],q=!1;this.trigger=function(){runtime.assert(!1===q,"Can't trigger destroyed ScheduledTask instance");r=Array.prototype.slice.call(arguments);p||(p=!0,n=k(f))};this.triggerImmediate=function(){runtime.assert(!1===q,"Can't trigger destroyed ScheduledTask instance");r=Array.prototype.slice.call(arguments);f()};this.processRequests=function(){p&&f()};this.cancel=b;this.restart=function(){runtime.assert(!1=== q,"Can't trigger destroyed ScheduledTask instance");b();p=!0;n=k(f)};this.destroy=function(d){b();q=!0;d()}}; (function(){var g;core.Task={};core.Task.SUPPRESS_MANUAL_PROCESSING=!1;core.Task.processTasks=function(){core.Task.SUPPRESS_MANUAL_PROCESSING||g.performRedraw()};core.Task.createRedrawTask=function(k){return new core.ScheduledTask(k,g.requestRedrawTask,g.cancelRedrawTask)};core.Task.createTimeoutTask=function(g,d){return new core.ScheduledTask(g,function(b){return runtime.setTimeout(b,d)},runtime.clearTimeout)};g=new function(){var g={};this.requestRedrawTask=function(d){var b=runtime.requestAnimationFrame(function(){d(); delete g[b]});g[b]=d;return b};this.performRedraw=function(){Object.keys(g).forEach(function(d){g[d]();runtime.cancelAnimationFrame(parseInt(d,10))});g={}};this.cancelRedrawTask=function(d){runtime.cancelAnimationFrame(d);delete g[d]}}})(); core.EventSubscriptions=function(){function g(b,f,n){b.subscribe(f,n);d.push({eventSource:b,eventid:f,callback:n})}function k(){var n=[];d.forEach(function(b){b.eventSource.unsubscribe(b.eventid,b.callback)});d.length=0;Object.keys(f).forEach(function(b){f[b].forEach(function(b){n.push(b.task.destroy)});delete f[b]});core.Async.destroyAll(n,function(){});b=new core.EventNotifier}var d=[],b=new core.EventNotifier,f={},n=0;this.addSubscription=g;this.addFrameSubscription=function(d,k,q){var e,l,a,c; f.hasOwnProperty(k)||(f[k]=[]);a=f[k];for(c=0;c<a.length;c+=1)if(a[c].eventSource===d){e=a[c];break}e||(l="s"+n,n+=1,b.register(l),e={frameEventId:l,eventSource:d,task:core.Task.createRedrawTask(function(){b.emit(l,void 0)})},a.push(e),g(d,k,e.task.trigger));b.subscribe(e.frameEventId,q)};this.unsubscribeAll=k;this.destroy=function(b){k();b()}};core.LazyProperty=function(g){var k,d=!1;this.value=function(){d||(k=g(),d=!0);return k};this.reset=function(){d=!1}}; core.LoopWatchDog=function(g,k){var d=Date.now(),b=0;this.check=function(){var f;if(g&&(f=Date.now(),f-d>g))throw runtime.log("alert","watchdog timeout"),"timeout!";if(0<k&&(b+=1,b>k))throw runtime.log("alert","watchdog loop overflow"),"loop overflow";}};core.NodeFilterChain=function(g){var k=NodeFilter.FILTER_REJECT,d=NodeFilter.FILTER_ACCEPT;this.acceptNode=function(b){var f;for(f=0;f<g.length;f+=1)if(g[f].acceptNode(b)===k)return k;return d}}; core.PositionIterator=function(g,k,d,b){function f(){this.acceptNode=function(a){return!a||a.nodeType===m&&0===a.length?x:y}}function n(a){this.acceptNode=function(c){return!c||c.nodeType===m&&0===c.length?x:a.acceptNode(c)}}function p(){var c=l.currentNode,b=c.nodeType;a=b===m?c.length-1:b===h?1:0}function r(){if(null===l.previousSibling()){if(!l.parentNode()||l.currentNode===g)return l.firstChild(),!1;a=0}else p();return!0}function q(){var b=l.currentNode,d;d=c(b);if(b!==g)for(b=b.parentNode;b&& b!==g;)c(b)===x&&(l.currentNode=b,d=x),b=b.parentNode;d===x?(a=l.currentNode.nodeType===m?b.length:1,b=e.nextPosition()):b=d===y?!0:e.nextPosition();b&&runtime.assert(c(l.currentNode)===y,"moveToAcceptedNode did not result in walker being on an accepted node");return b}var e=this,l,a,c,m=Node.TEXT_NODE,h=Node.ELEMENT_NODE,y=NodeFilter.FILTER_ACCEPT,x=NodeFilter.FILTER_REJECT;this.nextPosition=function(){var c=l.currentNode,b=c.nodeType;if(c===g)return!1;if(0===a&&b===h)null===l.firstChild()&&(a=1); else if(b===m&&a+1<c.length)a+=1;else if(null!==l.nextSibling())a=0;else if(l.parentNode())a=1;else return!1;return!0};this.previousPosition=function(){var c=!0,b=l.currentNode;0===a?c=r():b.nodeType===m?--a:null!==l.lastChild()?p():b===g?c=!1:a=0;return c};this.previousNode=r;this.container=function(){var c=l.currentNode,b=c.nodeType;0===a&&b!==m&&(c=c.parentNode);return c};this.rightNode=function(){var b=l.currentNode,d=b.nodeType;if(d===m&&a===b.length)for(b=b.nextSibling;b&&c(b)!==y;)b=b.nextSibling; else d===h&&1===a&&(b=null);return b};this.leftNode=function(){var b=l.currentNode;if(0===a)for(b=b.previousSibling;b&&c(b)!==y;)b=b.previousSibling;else if(b.nodeType===h)for(b=b.lastChild;b&&c(b)!==y;)b=b.previousSibling;return b};this.getCurrentNode=function(){return l.currentNode};this.unfilteredDomOffset=function(){if(l.currentNode.nodeType===m)return a;for(var c=0,b=l.currentNode,b=1===a?b.lastChild:b.previousSibling;b;)c+=1,b=b.previousSibling;return c};this.getPreviousSibling=function(){var a= l.currentNode,c=l.previousSibling();l.currentNode=a;return c};this.getNextSibling=function(){var a=l.currentNode,c=l.nextSibling();l.currentNode=a;return c};this.setPositionBeforeElement=function(c){runtime.assert(Boolean(c),"setPositionBeforeElement called without element");l.currentNode=c;a=0;return q()};this.setUnfilteredPosition=function(c,b){runtime.assert(Boolean(c),"PositionIterator.setUnfilteredPosition called without container");l.currentNode=c;c.nodeType===m?(a=b,runtime.assert(b<=c.length, "Error in setPosition: "+b+" > "+c.length),runtime.assert(0<=b,"Error in setPosition: "+b+" < 0"),b===c.length&&(l.nextSibling()?a=0:l.parentNode()?a=1:runtime.assert(!1,"Error in setUnfilteredPosition: position not valid."))):b<c.childNodes.length?(l.currentNode=c.childNodes.item(b),a=0):a=1;return q()};this.moveToEnd=function(){l.currentNode=g;a=1};this.moveToEndOfNode=function(c){c.nodeType===m?e.setUnfilteredPosition(c,c.length):(l.currentNode=c,a=1)};this.isBeforeNode=function(){return 0===a}; this.getNodeFilter=function(){return c};c=(d?new n(d):new f).acceptNode;c.acceptNode=c;k=k||NodeFilter.SHOW_ALL;runtime.assert(g.nodeType!==Node.TEXT_NODE,"Internet Explorer doesn't allow tree walker roots to be text nodes");l=g.ownerDocument.createTreeWalker(g,k,c,b);a=0;null===l.firstChild()&&(a=1)};core.PositionFilter=function(){};core.PositionFilter.FilterResult={FILTER_ACCEPT:1,FILTER_REJECT:2,FILTER_SKIP:3};core.PositionFilter.prototype.acceptPosition=function(g){}; core.PositionFilterChain=function(){var g=[],k=core.PositionFilter.FilterResult.FILTER_ACCEPT,d=core.PositionFilter.FilterResult.FILTER_REJECT;this.acceptPosition=function(b){var f;for(f=0;f<g.length;f+=1)if(g[f].acceptPosition(b)===d)return d;return k};this.addFilter=function(b){g.push(b)}};core.StepDirection={PREVIOUS:1,NEXT:2}; core.StepIterator=function(g,k){function d(){a=null;m=c=void 0}function b(){void 0===m&&(m=g.acceptPosition(k)===e);return m}function f(a,c){d();return k.setUnfilteredPosition(a,c)}function n(){a||(a=k.container());return a}function p(){void 0===c&&(c=k.unfilteredDomOffset());return c}function r(){for(d();k.nextPosition();)if(d(),b())return!0;return!1}function q(){for(d();k.previousPosition();)if(d(),b())return!0;return!1}var e=core.PositionFilter.FilterResult.FILTER_ACCEPT,l=core.StepDirection.NEXT, a,c,m;this.isStep=b;this.setPosition=f;this.container=n;this.offset=p;this.nextStep=r;this.previousStep=q;this.advanceStep=function(a){return a===l?r():q()};this.roundToClosestStep=function(){var a,c,d=b();d||(a=n(),c=p(),d=q(),d||(f(a,c),d=r()));return d};this.roundToPreviousStep=function(){var a=b();a||(a=q());return a};this.roundToNextStep=function(){var a=b();a||(a=r());return a};this.leftNode=function(){return k.leftNode()};this.snapshot=function(){return new core.StepIterator.StepSnapshot(n(), p())};this.restore=function(a){f(a.container,a.offset)}};core.StepIterator.StepSnapshot=function(g,k){this.container=g;this.offset=k}; core.Utils=function(){function g(k,d){if(d&&Array.isArray(d)){k=k||[];if(!Array.isArray(k))throw"Destination is not an array.";k=k.concat(d.map(function(b){return g(null,b)}))}else if(d&&"object"===typeof d){k=k||{};if("object"!==typeof k)throw"Destination is not an object.";Object.keys(d).forEach(function(b){k[b]=g(k[b],d[b])})}else k=d;return k}this.hashString=function(g){var d=0,b,f;b=0;for(f=g.length;b<f;b+=1)d=(d<<5)-d+g.charCodeAt(b),d|=0;return d};this.mergeObjects=function(k,d){Object.keys(d).forEach(function(b){k[b]= g(k[b],d[b])});return k}}; core.Zip=function(g,k){function d(b,d){var a=r.file(b);a?d(null,a.asUint8Array()):d(b+" not found.",null)}function b(b,l){d(b,function(a,c){if(a||null===c)return l(a,null);var b=runtime.byteArrayToString(c,"utf8");l(null,b)})}function f(b,d){try{b(r.generate({type:"uint8array",compression:"STORE"}))}catch(a){d(a.message)}}function n(b,d){f(function(a){runtime.writeFile(b,a,d)},d)}var p=this,r,q=new core.Base64;this.load=d;this.save=function(b,d,a,c){r.file(b,d,{date:c,compression:a?"DEFLATE":"STORE"})}; this.remove=function(b){var d=null!==r.file(b);r.remove(b);return d};this.write=function(b){n(g,b)};this.writeAs=n;this.createByteArray=f;this.loadContentXmlAsFragments=function(d,l){b(d,function(a,c){if(a)return l.rootElementReady(a);l.rootElementReady(null,c,!0)})};this.loadAsString=b;this.loadAsDOM=function(d,l){b(d,function(a,c){if(a||null===c)l(a,null);else{var b=(new DOMParser).parseFromString(c,"text/xml");l(null,b)}})};this.loadAsDataURL=function(b,l,a){d(b,function(c,b){if(c||!b)return a(c, null);var d=0,e;l||(l=80===b[1]&&78===b[2]&&71===b[3]?"image/png":255===b[0]&&216===b[1]&&255===b[2]?"image/jpeg":71===b[0]&&73===b[1]&&70===b[2]?"image/gif":"");for(e="data:"+l+";base64,";d<b.length;)e+=q.convertUTF8ArrayToBase64(b.subarray(d,Math.min(d+45E3,b.length))),d+=45E3;a(null,e)})};this.getEntries=function(){return Object.keys(r.files).map(function(b){return{filename:b,date:r.files[b].date}})};r=new externs.JSZip;null!==k&&runtime.readFile(g,"binary",function(b,d){"string"===typeof d&&(b= "file was read as a string. Should be Uint8Array.");if(b||!d||0===d.length)k("File '"+g+"' cannot be read. Err: "+(b||"[none]"),p);else try{r.load(d,{checkCRC32:!1}),k(null,p)}catch(a){k(a.message,p)}})};core.SimpleClientRect=null;gui.CommonConstraints={EDIT:{ANNOTATIONS:{ONLY_DELETE_OWN:"onlyDeleteOwn"},REVIEW_MODE:"reviewMode"}}; gui.SessionConstraints=function(){function g(b){k.hasOwnProperty(b)||(k[b]=!1,d.register(b))}var k={},d=new core.EventNotifier;this.registerConstraint=g;this.subscribe=function(b,f){g(b);d.subscribe(b,f)};this.unsubscribe=function(b,f){d.unsubscribe(b,f)};this.setState=function(b,f){runtime.assert(!0===k.hasOwnProperty(b),"No such constraint");k[b]!==f&&(k[b]=f,d.emit(b,f))};this.getState=function(b){runtime.assert(!0===k.hasOwnProperty(b),"No such constraint");return k[b]}}; gui.BlacklistNamespaceNodeFilter=function(g){var k={},d=NodeFilter.FILTER_REJECT,b=NodeFilter.FILTER_ACCEPT;this.acceptNode=function(f){return!f||k.hasOwnProperty(f.namespaceURI)?d:b};(function(){g.forEach(function(b){k[b]=!0})})()}; odf.Namespaces={namespaceMap:{config:"urn:oasis:names:tc:opendocument:xmlns:config:1.0",db:"urn:oasis:names:tc:opendocument:xmlns:database:1.0",dc:"http://purl.org/dc/elements/1.1/",dr3d:"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0",draw:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",chart:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",fo:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",form:"urn:oasis:names:tc:opendocument:xmlns:form:1.0",math:"http://www.w3.org/1998/Math/MathML", meta:"urn:oasis:names:tc:opendocument:xmlns:meta:1.0",number:"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0",office:"urn:oasis:names:tc:opendocument:xmlns:office:1.0",presentation:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",style:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",svg:"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0",table:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",text:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",xforms:"http://www.w3.org/2002/xforms", xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},prefixMap:{},configns:"urn:oasis:names:tc:opendocument:xmlns:config:1.0",dbns:"urn:oasis:names:tc:opendocument:xmlns:database:1.0",dcns:"http://purl.org/dc/elements/1.1/",dr3dns:"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0",drawns:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",chartns:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",fons:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",formns:"urn:oasis:names:tc:opendocument:xmlns:form:1.0", mathns:"http://www.w3.org/1998/Math/MathML",metans:"urn:oasis:names:tc:opendocument:xmlns:meta:1.0",numberns:"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0",officens:"urn:oasis:names:tc:opendocument:xmlns:office:1.0",presentationns:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",stylens:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",svgns:"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0",tablens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",textns:"urn:oasis:names:tc:opendocument:xmlns:text:1.0", xformsns:"http://www.w3.org/2002/xforms",xlinkns:"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/XML/1998/namespace"};(function(){var g=odf.Namespaces.namespaceMap,k=odf.Namespaces.prefixMap,d;for(d in g)g.hasOwnProperty(d)&&(k[g[d]]=d)})();odf.Namespaces.forEachPrefix=function(g){var k=odf.Namespaces.namespaceMap,d;for(d in k)k.hasOwnProperty(d)&&g(d,k[d])}; odf.Namespaces.lookupNamespaceURI=function(g){var k=null;odf.Namespaces.namespaceMap.hasOwnProperty(g)&&(k=odf.Namespaces.namespaceMap[g]);return k};odf.Namespaces.lookupPrefix=function(g){var k=odf.Namespaces.prefixMap;return k.hasOwnProperty(g)?k[g]:null};odf.Namespaces.lookupNamespaceURI.lookupNamespaceURI=odf.Namespaces.lookupNamespaceURI; (function(){odf.OdfSchemaImpl=function(){var g=[["config:config-item","uncategorized"],["form:item","object"],["form:option","uncategorized"],["math:math","field"],["meta:user-defined","uncategorized"],["number:currency-symbol","uncategorized"],["number:embedded-text","uncategorized"],["number:text","uncategorized"],["presentation:date-time-decl","uncategorized"],["presentation:footer-decl","uncategorized"],["presentation:header-decl","uncategorized"],["svg:desc","text"],["svg:title","text"],["table:desc", "uncategorized"],["table:title","uncategorized"],["text:a","text"],["text:author-initials","field"],["text:author-name","field"],["text:bibliography-mark","field"],["text:bookmark-ref","field"],["text:chapter","field"],["text:character-count","field"],["text:conditional-text","field"],["text:creation-date","field"],["text:creation-time","field"],["text:creator","field"],["text:database-display","field"],["text:database-name","field"],["text:database-row-number","field"],["text:date","field"],["text:dde-connection", "field"],["text:description","field"],["text:editing-cycles","field"],["text:editing-duration","field"],["text:execute-macro","uncategorized"],["text:expression","uncategorized"],["text:file-name","field"],["text:h","text"],["text:hidden-paragraph","text"],["text:hidden-text","text"],["text:image-count","field"],["text:index-entry-span","uncategorized"],["text:index-title-template","uncategorized"],["text:initial-creator","field"],["text:keywords","field"],["text:linenumbering-separator","style"], ["text:measure","uncategorized"],["text:meta","uncategorized"],["text:meta-field","uncategorized"],["text:modification-date","field"],["text:modification-time","field"],["text:note-citation","field"],["text:note-continuation-notice-backward","style"],["text:note-continuation-notice-forward","style"],["text:note-ref","field"],["text:object-count","field"],["text:p","text"],["text:page-continuation","uncategorized"],["text:page-count","field"],["text:page-number","field"],["text:page-variable-get", "field"],["text:page-variable-set","field"],["text:paragraph-count","field"],["text:placeholder","field"],["text:print-date","field"],["text:print-time","field"],["text:printed-by","field"],["text:reference-ref","field"],["text:ruby-base","text"],["text:ruby-text","text"],["text:script","text"],["text:sender-city","field"],["text:sender-company","field"],["text:sender-country","field"],["text:sender-email","field"],["text:sender-fax","field"],["text:sender-firstname","field"],["text:sender-initials", "field"],["text:sender-lastname","field"],["text:sender-phone-private","field"],["text:sender-phone-work","field"],["text:sender-position","field"],["text:sender-postal-code","field"],["text:sender-state-or-province","field"],["text:sender-street","field"],["text:sender-title","field"],["text:sequence","uncategorized"],["text:sequence-ref","uncategorized"],["text:sheet-name","uncategorized"],["text:span","text"],["text:subject","field"],["text:table-count","field"],["text:table-formula","deprecated"], ["text:template-name","uncategorized"],["text:text-input","field"],["text:time","field"],["text:title","field"],["text:user-defined","field"],["text:user-field-get","field"],["text:user-field-input","field"],["text:variable-get","field"],["text:variable-input","field"],["text:variable-set","field"],["text:word-count","field"],["xforms:model","uncategorized"]],k={};this.isTextContainer=function(d,b){return"text"===k[d+":"+b]};this.isField=function(d,b){return"field"===k[d+":"+b]};this.getFields=function(){return g.filter(function(d){return"field"=== d[1]}).map(function(d){return d[0]})};(function(){g.forEach(function(d){var b=d[1],f=d[0].split(":");d=f[0];var f=f[1],n=odf.Namespaces.lookupNamespaceURI(d);n?k[n+":"+f]=b:runtime.log("DEBUG: OdfSchema - unknown prefix '"+d+"'")})})()};odf.OdfSchema=new odf.OdfSchemaImpl})(); odf.OdfUtilsImpl=function(){function g(a){return"image"===(a&&a.localName)&&a.namespaceURI===R}function k(a){return null!==a&&a.nodeType===Node.ELEMENT_NODE&&"frame"===a.localName&&a.namespaceURI===R&&"as-char"===a.getAttributeNS(J,"anchor-type")}function d(a){var c;(c="annotation"===(a&&a.localName)&&a.namespaceURI===odf.Namespaces.officens)||(c="div"===(a&&a.localName)&&"annotationWrapper"===a.className);return c}function b(a){return"a"===(a&&a.localName)&&a.namespaceURI===J}function f(a){var c= a&&a.localName;return("p"===c||"h"===c)&&a.namespaceURI===J}function n(a,c){for(a&&void 0!==c&&!f(a)&&a.childNodes.item(c)&&(a=a.childNodes.item(c));a&&!f(a);)a=a.parentNode;return a}function p(a,c){for(;a&&a!==c;){if(a.namespaceURI===odf.Namespaces.officens&&"annotation"===a.localName)return a;a=a.parentNode}return null}function r(a){return/^[ \t\r\n]+$/.test(a)}function q(a){if(null===a||a.nodeType!==Node.ELEMENT_NODE)return!1;var c=a.localName;return fa.isTextContainer(a.namespaceURI,c)||"span"=== c&&"webodf-annotationHighlight"===a.className}function e(a){return null===a||a.nodeType!==Node.ELEMENT_NODE?!1:fa.isField(a.namespaceURI,a.localName)}function l(a){var c=a&&a.localName,b=!1;c&&(a=a.namespaceURI,a===J&&(b="s"===c||"tab"===c||"line-break"===c));return b}function a(a){return l(a)|