oasis-editor 0.0.26 → 0.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{OasisEditorApp-DiKFbvcS.js → OasisEditorApp-TgBKJPpl.js} +1 -1
- package/dist/{index-nYpJ3a_R.js → index-BaKkmGAh.js} +51 -54
- package/dist/oasis-editor.css +1 -1
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +1 -1
- package/dist/ui/editorLayoutConstants.d.ts +6 -19
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
JSZip uses the library pako released under the MIT license :
|
|
11
11
|
https://github.com/nodeca/pako/blob/main/LICENSE
|
|
12
|
-
*/Yp.exports=function t(e,a,n){function r(i,l){if(!a[i]){if(!e[i]){if(!l&&Jp)return Jp(i);if(o)return o(i,!0);var s=new Error("Cannot find module '"+i+"'");throw s.code="MODULE_NOT_FOUND",s}var d=a[i]={exports:{}};e[i][0].call(d.exports,function(t){return r(e[i][1][t]||t)},d,d.exports,t,e,a,n)}return a[i].exports}for(var o=Jp,i=0;i<n.length;i++)r(n[i]);return r}({1:[function(t,e,a){var n=t("./utils"),r=t("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";a.encode=function(t){for(var e,a,r,i,l,s,d,c=[],h=0,p=t.length,u=p,f="string"!==n.getTypeOf(t);h<t.length;)u=p-h,r=f?(e=t[h++],a=h<p?t[h++]:0,h<p?t[h++]:0):(e=t.charCodeAt(h++),a=h<p?t.charCodeAt(h++):0,h<p?t.charCodeAt(h++):0),i=e>>2,l=(3&e)<<4|a>>4,s=1<u?(15&a)<<2|r>>6:64,d=2<u?63&r:64,c.push(o.charAt(i)+o.charAt(l)+o.charAt(s)+o.charAt(d));return c.join("")},a.decode=function(t){var e,a,n,i,l,s,d=0,c=0,h="data:";if(t.substr(0,h.length)===h)throw new Error("Invalid base64 input, it looks like a data url.");var p,u=3*(t=t.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(t.charAt(t.length-1)===o.charAt(64)&&u--,t.charAt(t.length-2)===o.charAt(64)&&u--,u%1!=0)throw new Error("Invalid base64 input, bad content length.");for(p=r.uint8array?new Uint8Array(0|u):new Array(0|u);d<t.length;)e=o.indexOf(t.charAt(d++))<<2|(i=o.indexOf(t.charAt(d++)))>>4,a=(15&i)<<4|(l=o.indexOf(t.charAt(d++)))>>2,n=(3&l)<<6|(s=o.indexOf(t.charAt(d++))),p[c++]=e,64!==l&&(p[c++]=a),64!==s&&(p[c++]=n);return p}},{"./support":30,"./utils":32}],2:[function(t,e,a){var n=t("./external"),r=t("./stream/DataWorker"),o=t("./stream/Crc32Probe"),i=t("./stream/DataLengthProbe");function l(t,e,a,n,r){this.compressedSize=t,this.uncompressedSize=e,this.crc32=a,this.compression=n,this.compressedContent=r}l.prototype={getContentWorker:function(){var t=new r(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new i("data_length")),e=this;return t.on("end",function(){if(this.streamInfo.data_length!==e.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),t},getCompressedWorker:function(){return new r(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},l.createWorkerFrom=function(t,e,a){return t.pipe(new o).pipe(new i("uncompressedSize")).pipe(e.compressWorker(a)).pipe(new i("compressedSize")).withStreamInfo("compression",e)},e.exports=l},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,e,a){var n=t("./stream/GenericWorker");a.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},a.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,e,a){var n=t("./utils"),r=function(){for(var t,e=[],a=0;a<256;a++){t=a;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t}return e}();e.exports=function(t,e){return void 0!==t&&t.length?"string"!==n.getTypeOf(t)?function(t,e,a,n){var o=r,i=n+a;t^=-1;for(var l=n;l<i;l++)t=t>>>8^o[255&(t^e[l])];return-1^t}(0|e,t,t.length,0):function(t,e,a,n){var o=r,i=n+a;t^=-1;for(var l=n;l<i;l++)t=t>>>8^o[255&(t^e.charCodeAt(l))];return-1^t}(0|e,t,t.length,0):0}},{"./utils":32}],5:[function(t,e,a){a.base64=!1,a.binary=!1,a.dir=!1,a.createFolders=!0,a.date=null,a.compression=null,a.compressionOptions=null,a.comment=null,a.unixPermissions=null,a.dosPermissions=null},{}],6:[function(t,e,a){var n=null;n="undefined"!=typeof Promise?Promise:t("lie"),e.exports={Promise:n}},{lie:37}],7:[function(t,e,a){var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,r=t("pako"),o=t("./utils"),i=t("./stream/GenericWorker"),l=n?"uint8array":"array";function s(t,e){i.call(this,"FlateWorker/"+t),this._pako=null,this._pakoAction=t,this._pakoOptions=e,this.meta={}}a.magic="\b\0",o.inherits(s,i),s.prototype.processChunk=function(t){this.meta=t.meta,null===this._pako&&this._createPako(),this._pako.push(o.transformTo(l,t.data),!1)},s.prototype.flush=function(){i.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},s.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this._pako=null},s.prototype._createPako=function(){this._pako=new r[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},a.compressWorker=function(t){return new s("Deflate",t)},a.uncompressWorker=function(){return new s("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,e,a){function n(t,e){var a,n="";for(a=0;a<e;a++)n+=String.fromCharCode(255&t),t>>>=8;return n}function r(t,e,a,r,i,c){var h,p,u=t.file,f=t.compression,g=c!==l.utf8encode,m=o.transformTo("string",c(u.name)),v=o.transformTo("string",l.utf8encode(u.name)),b=u.comment,y=o.transformTo("string",c(b)),M=o.transformTo("string",l.utf8encode(b)),x=v.length!==u.name.length,w=M.length!==b.length,S="",A="",I="",T=u.dir,C=u.date,k={crc32:0,compressedSize:0,uncompressedSize:0};e&&!a||(k.crc32=t.crc32,k.compressedSize=t.compressedSize,k.uncompressedSize=t.uncompressedSize);var V=0;e&&(V|=8),g||!x&&!w||(V|=2048);var E,R,L,z=0,N=0;T&&(z|=16),"UNIX"===i?(N=798,z|=(E=u.unixPermissions,R=T,L=E,E||(L=R?16893:33204),(65535&L)<<16)):(N=20,z|=function(t){return 63&(t||0)}(u.dosPermissions)),h=C.getUTCHours(),h<<=6,h|=C.getUTCMinutes(),h<<=5,h|=C.getUTCSeconds()/2,p=C.getUTCFullYear()-1980,p<<=4,p|=C.getUTCMonth()+1,p<<=5,p|=C.getUTCDate(),x&&(A=n(1,1)+n(s(m),4)+v,S+="up"+n(A.length,2)+A),w&&(I=n(1,1)+n(s(y),4)+M,S+="uc"+n(I.length,2)+I);var q="";return q+="\n\0",q+=n(V,2),q+=f.magic,q+=n(h,2),q+=n(p,2),q+=n(k.crc32,4),q+=n(k.compressedSize,4),q+=n(k.uncompressedSize,4),q+=n(m.length,2),q+=n(S.length,2),{fileRecord:d.LOCAL_FILE_HEADER+q+m+S,dirRecord:d.CENTRAL_FILE_HEADER+n(N,2)+q+n(y.length,2)+"\0\0\0\0"+n(z,4)+n(r,4)+m+S+y}}var o=t("../utils"),i=t("../stream/GenericWorker"),l=t("../utf8"),s=t("../crc32"),d=t("../signature");function c(t,e,a,n){i.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=e,this.zipPlatform=a,this.encodeFileName=n,this.streamFiles=t,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(c,i),c.prototype.push=function(t){var e=t.meta.percent||0,a=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(t):(this.bytesWritten+=t.data.length,i.prototype.push.call(this,{data:t.data,meta:{currentFile:this.currentFile,percent:a?(e+100*(a-n-1))/a:100}}))},c.prototype.openedSource=function(t){this.currentSourceOffset=this.bytesWritten,this.currentFile=t.file.name;var e=this.streamFiles&&!t.file.dir;if(e){var a=r(t,e,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:a.fileRecord,meta:{percent:0}})}else this.accumulate=!0},c.prototype.closedSource=function(t){this.accumulate=!1;var e,a=this.streamFiles&&!t.file.dir,o=r(t,a,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(o.dirRecord),a)this.push({data:(e=t,d.DATA_DESCRIPTOR+n(e.crc32,4)+n(e.compressedSize,4)+n(e.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:o.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},c.prototype.flush=function(){for(var t=this.bytesWritten,e=0;e<this.dirRecords.length;e++)this.push({data:this.dirRecords[e],meta:{percent:100}});var a,r,i,l,s,c,h=this.bytesWritten-t,p=(a=this.dirRecords.length,r=h,i=t,l=this.zipComment,s=this.encodeFileName,c=o.transformTo("string",s(l)),d.CENTRAL_DIRECTORY_END+"\0\0\0\0"+n(a,2)+n(a,2)+n(r,4)+n(i,4)+n(c.length,2)+c);this.push({data:p,meta:{percent:100}})},c.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},c.prototype.registerPrevious=function(t){this._sources.push(t);var e=this;return t.on("data",function(t){e.processChunk(t)}),t.on("end",function(){e.closedSource(e.previous.streamInfo),e._sources.length?e.prepareNextSource():e.end()}),t.on("error",function(t){e.error(t)}),this},c.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},c.prototype.error=function(t){var e=this._sources;if(!i.prototype.error.call(this,t))return!1;for(var a=0;a<e.length;a++)try{e[a].error(t)}catch(n){}return!0},c.prototype.lock=function(){i.prototype.lock.call(this);for(var t=this._sources,e=0;e<t.length;e++)t[e].lock()},e.exports=c},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,e,a){var n=t("../compressions"),r=t("./ZipFileWorker");a.generateWorker=function(t,e,a){var o=new r(e.streamFiles,a,e.platform,e.encodeFileName),i=0;try{t.forEach(function(t,a){i++;var r=function(t,e){var a=t||e,r=n[a];if(!r)throw new Error(a+" is not a valid compression method !");return r}(a.options.compression,e.compression),l=a.options.compressionOptions||e.compressionOptions||{},s=a.dir,d=a.date;a._compressWorker(r,l).withStreamInfo("file",{name:t,dir:s,date:d,comment:a.comment||"",unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions}).pipe(o)}),o.entriesCount=i}catch(l){o.error(l)}return o}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,e,a){function n(){if(!(this instanceof n))return new n;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var t=new n;for(var e in this)"function"!=typeof this[e]&&(t[e]=this[e]);return t}}(n.prototype=t("./object")).loadAsync=t("./load"),n.support=t("./support"),n.defaults=t("./defaults"),n.version="3.10.1",n.loadAsync=function(t,e){return(new n).loadAsync(t,e)},n.external=t("./external"),e.exports=n},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,e,a){var n=t("./utils"),r=t("./external"),o=t("./utf8"),i=t("./zipEntries"),l=t("./stream/Crc32Probe"),s=t("./nodejsUtils");function d(t){return new r.Promise(function(e,a){var n=t.decompressed.getContentWorker().pipe(new l);n.on("error",function(t){a(t)}).on("end",function(){n.streamInfo.crc32!==t.decompressed.crc32?a(new Error("Corrupted zip : CRC32 mismatch")):e()}).resume()})}e.exports=function(t,e){var a=this;return e=n.extend(e||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),s.isNode&&s.isStream(t)?r.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",t,!0,e.optimizedBinaryString,e.base64).then(function(t){var a=new i(e);return a.load(t),a}).then(function(t){var a=[r.Promise.resolve(t)],n=t.files;if(e.checkCRC32)for(var o=0;o<n.length;o++)a.push(d(n[o]));return r.Promise.all(a)}).then(function(t){for(var r=t.shift(),o=r.files,i=0;i<o.length;i++){var l=o[i],s=l.fileNameStr,d=n.resolve(l.fileNameStr);a.file(d,l.decompressed,{binary:!0,optimizedBinaryString:!0,date:l.date,dir:l.dir,comment:l.fileCommentStr.length?l.fileCommentStr:null,unixPermissions:l.unixPermissions,dosPermissions:l.dosPermissions,createFolders:e.createFolders}),l.dir||(a.file(d).unsafeOriginalName=s)}return r.zipComment.length&&(a.comment=r.zipComment),a})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,e,a){var n=t("../utils"),r=t("../stream/GenericWorker");function o(t,e){r.call(this,"Nodejs stream input adapter for "+t),this._upstreamEnded=!1,this._bindStream(e)}n.inherits(o,r),o.prototype._bindStream=function(t){var e=this;(this._stream=t).pause(),t.on("data",function(t){e.push({data:t,meta:{percent:0}})}).on("error",function(t){e.isPaused?this.generatedError=t:e.error(t)}).on("end",function(){e.isPaused?e._upstreamEnded=!0:e.end()})},o.prototype.pause=function(){return!!r.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},e.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,e,a){var n=t("readable-stream").Readable;function r(t,e,a){n.call(this,e),this._helper=t;var r=this;t.on("data",function(t,e){r.push(t)||r._helper.pause(),a&&a(e)}).on("error",function(t){r.emit("error",t)}).on("end",function(){r.push(null)})}t("../utils").inherits(r,n),r.prototype._read=function(){this._helper.resume()},e.exports=r},{"../utils":32,"readable-stream":16}],14:[function(t,e,a){e.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(t,e){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(t,e);if("number"==typeof t)throw new Error('The "data" argument must not be a number');return new Buffer(t,e)},allocBuffer:function(t){if(Buffer.alloc)return Buffer.alloc(t);var e=new Buffer(t);return e.fill(0),e},isBuffer:function(t){return Buffer.isBuffer(t)},isStream:function(t){return t&&"function"==typeof t.on&&"function"==typeof t.pause&&"function"==typeof t.resume}}},{}],15:[function(t,e,a){function n(t,e,a){var n,r=o.getTypeOf(e),l=o.extend(a||{},s);l.date=l.date||new Date,null!==l.compression&&(l.compression=l.compression.toUpperCase()),"string"==typeof l.unixPermissions&&(l.unixPermissions=parseInt(l.unixPermissions,8)),l.unixPermissions&&16384&l.unixPermissions&&(l.dir=!0),l.dosPermissions&&16&l.dosPermissions&&(l.dir=!0),l.dir&&(t=g(t)),l.createFolders&&(n=f(t))&&m.call(this,n,!0);var h="string"===r&&!1===l.binary&&!1===l.base64;a&&void 0!==a.binary||(l.binary=!h),(e instanceof d&&0===e.uncompressedSize||l.dir||!e||0===e.length)&&(l.base64=!1,l.binary=!0,e="",l.compression="STORE",r="string");var v=null;v=e instanceof d||e instanceof i?e:p.isNode&&p.isStream(e)?new u(t,e):o.prepareContent(t,e,l.binary,l.optimizedBinaryString,l.base64);var b=new c(t,v,l);this.files[t]=b}var r=t("./utf8"),o=t("./utils"),i=t("./stream/GenericWorker"),l=t("./stream/StreamHelper"),s=t("./defaults"),d=t("./compressedObject"),c=t("./zipObject"),h=t("./generate"),p=t("./nodejsUtils"),u=t("./nodejs/NodejsStreamInputAdapter"),f=function(t){"/"===t.slice(-1)&&(t=t.substring(0,t.length-1));var e=t.lastIndexOf("/");return 0<e?t.substring(0,e):""},g=function(t){return"/"!==t.slice(-1)&&(t+="/"),t},m=function(t,e){return e=void 0!==e?e:s.createFolders,t=g(t),this.files[t]||n.call(this,t,null,{dir:!0,createFolders:e}),this.files[t]};function v(t){return"[object RegExp]"===Object.prototype.toString.call(t)}var b={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(t){var e,a,n;for(e in this.files)n=this.files[e],(a=e.slice(this.root.length,e.length))&&e.slice(0,this.root.length)===this.root&&t(a,n)},filter:function(t){var e=[];return this.forEach(function(a,n){t(a,n)&&e.push(n)}),e},file:function(t,e,a){if(1!==arguments.length)return t=this.root+t,n.call(this,t,e,a),this;if(v(t)){var r=t;return this.filter(function(t,e){return!e.dir&&r.test(t)})}var o=this.files[this.root+t];return o&&!o.dir?o:null},folder:function(t){if(!t)return this;if(v(t))return this.filter(function(e,a){return a.dir&&t.test(e)});var e=this.root+t,a=m.call(this,e),n=this.clone();return n.root=a.name,n},remove:function(t){t=this.root+t;var e=this.files[t];if(e||("/"!==t.slice(-1)&&(t+="/"),e=this.files[t]),e&&!e.dir)delete this.files[t];else for(var a=this.filter(function(e,a){return a.name.slice(0,t.length)===t}),n=0;n<a.length;n++)delete this.files[a[n].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(t){var e,a={};try{if((a=o.extend(t||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:r.utf8encode})).type=a.type.toLowerCase(),a.compression=a.compression.toUpperCase(),"binarystring"===a.type&&(a.type="string"),!a.type)throw new Error("No output type specified.");o.checkSupport(a.type),"darwin"!==a.platform&&"freebsd"!==a.platform&&"linux"!==a.platform&&"sunos"!==a.platform||(a.platform="UNIX"),"win32"===a.platform&&(a.platform="DOS");var n=a.comment||this.comment||"";e=h.generateWorker(this,a,n)}catch(s){(e=new i("error")).error(s)}return new l(e,a.type||"string",a.mimeType)},generateAsync:function(t,e){return this.generateInternalStream(t).accumulate(e)},generateNodeStream:function(t,e){return(t=t||{}).type||(t.type="nodebuffer"),this.generateInternalStream(t).toNodejsStream(e)}};e.exports=b},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(t,e,a){e.exports=t("stream")},{stream:void 0}],17:[function(t,e,a){var n=t("./DataReader");function r(t){n.call(this,t);for(var e=0;e<this.data.length;e++)t[e]=255&t[e]}t("../utils").inherits(r,n),r.prototype.byteAt=function(t){return this.data[this.zero+t]},r.prototype.lastIndexOfSignature=function(t){for(var e=t.charCodeAt(0),a=t.charCodeAt(1),n=t.charCodeAt(2),r=t.charCodeAt(3),o=this.length-4;0<=o;--o)if(this.data[o]===e&&this.data[o+1]===a&&this.data[o+2]===n&&this.data[o+3]===r)return o-this.zero;return-1},r.prototype.readAndCheckSignature=function(t){var e=t.charCodeAt(0),a=t.charCodeAt(1),n=t.charCodeAt(2),r=t.charCodeAt(3),o=this.readData(4);return e===o[0]&&a===o[1]&&n===o[2]&&r===o[3]},r.prototype.readData=function(t){if(this.checkOffset(t),0===t)return[];var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=r},{"../utils":32,"./DataReader":18}],18:[function(t,e,a){var n=t("../utils");function r(t){this.data=t,this.length=t.length,this.index=0,this.zero=0}r.prototype={checkOffset:function(t){this.checkIndex(this.index+t)},checkIndex:function(t){if(this.length<this.zero+t||t<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+t+"). Corrupted zip ?")},setIndex:function(t){this.checkIndex(t),this.index=t},skip:function(t){this.setIndex(this.index+t)},byteAt:function(){},readInt:function(t){var e,a=0;for(this.checkOffset(t),e=this.index+t-1;e>=this.index;e--)a=(a<<8)+this.byteAt(e);return this.index+=t,a},readString:function(t){return n.transformTo("string",this.readData(t))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var t=this.readInt(4);return new Date(Date.UTC(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1))}},e.exports=r},{"../utils":32}],19:[function(t,e,a){var n=t("./Uint8ArrayReader");function r(t){n.call(this,t)}t("../utils").inherits(r,n),r.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=r},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,e,a){var n=t("./DataReader");function r(t){n.call(this,t)}t("../utils").inherits(r,n),r.prototype.byteAt=function(t){return this.data.charCodeAt(this.zero+t)},r.prototype.lastIndexOfSignature=function(t){return this.data.lastIndexOf(t)-this.zero},r.prototype.readAndCheckSignature=function(t){return t===this.readData(4)},r.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=r},{"../utils":32,"./DataReader":18}],21:[function(t,e,a){var n=t("./ArrayReader");function r(t){n.call(this,t)}t("../utils").inherits(r,n),r.prototype.readData=function(t){if(this.checkOffset(t),0===t)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=r},{"../utils":32,"./ArrayReader":17}],22:[function(t,e,a){var n=t("../utils"),r=t("../support"),o=t("./ArrayReader"),i=t("./StringReader"),l=t("./NodeBufferReader"),s=t("./Uint8ArrayReader");e.exports=function(t){var e=n.getTypeOf(t);return n.checkSupport(e),"string"!==e||r.uint8array?"nodebuffer"===e?new l(t):r.uint8array?new s(n.transformTo("uint8array",t)):new o(n.transformTo("array",t)):new i(t)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,e,a){a.LOCAL_FILE_HEADER="PK",a.CENTRAL_FILE_HEADER="PK",a.CENTRAL_DIRECTORY_END="PK",a.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",a.ZIP64_CENTRAL_DIRECTORY_END="PK",a.DATA_DESCRIPTOR="PK\b"},{}],24:[function(t,e,a){var n=t("./GenericWorker"),r=t("../utils");function o(t){n.call(this,"ConvertWorker to "+t),this.destType=t}r.inherits(o,n),o.prototype.processChunk=function(t){this.push({data:r.transformTo(this.destType,t.data),meta:t.meta})},e.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,e,a){var n=t("./GenericWorker"),r=t("../crc32");function o(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(o,n),o.prototype.processChunk=function(t){this.streamInfo.crc32=r(t.data,this.streamInfo.crc32||0),this.push(t)},e.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,e,a){var n=t("../utils"),r=t("./GenericWorker");function o(t){r.call(this,"DataLengthProbe for "+t),this.propName=t,this.withStreamInfo(t,0)}n.inherits(o,r),o.prototype.processChunk=function(t){if(t){var e=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=e+t.data.length}r.prototype.processChunk.call(this,t)},e.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,e,a){var n=t("../utils"),r=t("./GenericWorker");function o(t){r.call(this,"DataWorker");var e=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,t.then(function(t){e.dataIsReady=!0,e.data=t,e.max=t&&t.length||0,e.type=n.getTypeOf(t),e.isPaused||e._tickAndRepeat()},function(t){e.error(t)})}n.inherits(o,r),o.prototype.cleanUp=function(){r.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var t=null,e=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,e);break;case"uint8array":t=this.data.subarray(this.index,e);break;case"array":case"nodebuffer":t=this.data.slice(this.index,e)}return this.index=e,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})},e.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(t,e,a){function n(t){this.name=t||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(t){this.emit("data",t)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(t){this.emit("error",t)}return!0},error:function(t){return!this.isFinished&&(this.isPaused?this.generatedError=t:(this.isFinished=!0,this.emit("error",t),this.previous&&this.previous.error(t),this.cleanUp()),!0)},on:function(t,e){return this._listeners[t].push(e),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(t,e){if(this._listeners[t])for(var a=0;a<this._listeners[t].length;a++)this._listeners[t][a].call(this,e)},pipe:function(t){return t.registerPrevious(this)},registerPrevious:function(t){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=t.streamInfo,this.mergeStreamInfo(),this.previous=t;var e=this;return t.on("data",function(t){e.processChunk(t)}),t.on("end",function(){e.end()}),t.on("error",function(t){e.error(t)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var t=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),t=!0),this.previous&&this.previous.resume(),!t},flush:function(){},processChunk:function(t){this.push(t)},withStreamInfo:function(t,e){return this.extraStreamInfo[t]=e,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var t in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,t)&&(this.streamInfo[t]=this.extraStreamInfo[t])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var t="Worker "+this.name;return this.previous?this.previous+" -> "+t:t}},e.exports=n},{}],29:[function(t,e,a){var n=t("../utils"),r=t("./ConvertWorker"),o=t("./GenericWorker"),i=t("../base64"),l=t("../support"),s=t("../external"),d=null;if(l.nodestream)try{d=t("../nodejs/NodejsStreamOutputAdapter")}catch(p){}function c(t,e){return new s.Promise(function(a,r){var o=[],l=t._internalType,s=t._outputType,d=t._mimeType;t.on("data",function(t,a){o.push(t),e&&e(a)}).on("error",function(t){o=[],r(t)}).on("end",function(){try{var t=function(t,e,a){switch(t){case"blob":return n.newBlob(n.transformTo("arraybuffer",e),a);case"base64":return i.encode(e);default:return n.transformTo(t,e)}}(s,function(t,e){var a,n=0,r=null,o=0;for(a=0;a<e.length;a++)o+=e[a].length;switch(t){case"string":return e.join("");case"array":return Array.prototype.concat.apply([],e);case"uint8array":for(r=new Uint8Array(o),a=0;a<e.length;a++)r.set(e[a],n),n+=e[a].length;return r;case"nodebuffer":return Buffer.concat(e);default:throw new Error("concat : unsupported type '"+t+"'")}}(l,o),d);a(t)}catch(e){r(e)}o=[]}).resume()})}function h(t,e,a){var i=e;switch(e){case"blob":case"arraybuffer":i="uint8array";break;case"base64":i="string"}try{this._internalType=i,this._outputType=e,this._mimeType=a,n.checkSupport(i),this._worker=t.pipe(new r(i)),t.lock()}catch(l){this._worker=new o("error"),this._worker.error(l)}}h.prototype={accumulate:function(t){return c(this,t)},on:function(t,e){var a=this;return"data"===t?this._worker.on(t,function(t){e.call(a,t.data,t.meta)}):this._worker.on(t,function(){n.delay(e,arguments,a)}),this},resume:function(){return n.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(t){if(n.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new d(this,{objectMode:"nodebuffer"!==this._outputType},t)}},e.exports=h},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,e,a){if(a.base64=!0,a.array=!0,a.string=!0,a.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,a.nodebuffer="undefined"!=typeof Buffer,a.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)a.blob=!1;else{var n=new ArrayBuffer(0);try{a.blob=0===new Blob([n],{type:"application/zip"}).size}catch(o){try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);r.append(n),a.blob=0===r.getBlob("application/zip").size}catch(i){a.blob=!1}}}try{a.nodestream=!!t("readable-stream").Readable}catch(o){a.nodestream=!1}},{"readable-stream":16}],31:[function(t,e,a){for(var n=t("./utils"),r=t("./support"),o=t("./nodejsUtils"),i=t("./stream/GenericWorker"),l=new Array(256),s=0;s<256;s++)l[s]=252<=s?6:248<=s?5:240<=s?4:224<=s?3:192<=s?2:1;function d(){i.call(this,"utf-8 decode"),this.leftOver=null}function c(){i.call(this,"utf-8 encode")}l[254]=l[254]=1,a.utf8encode=function(t){return r.nodebuffer?o.newBufferFrom(t,"utf-8"):function(t){var e,a,n,o,i,l=t.length,s=0;for(o=0;o<l;o++)55296==(64512&(a=t.charCodeAt(o)))&&o+1<l&&56320==(64512&(n=t.charCodeAt(o+1)))&&(a=65536+(a-55296<<10)+(n-56320),o++),s+=a<128?1:a<2048?2:a<65536?3:4;for(e=r.uint8array?new Uint8Array(s):new Array(s),o=i=0;i<s;o++)55296==(64512&(a=t.charCodeAt(o)))&&o+1<l&&56320==(64512&(n=t.charCodeAt(o+1)))&&(a=65536+(a-55296<<10)+(n-56320),o++),a<128?e[i++]=a:(a<2048?e[i++]=192|a>>>6:(a<65536?e[i++]=224|a>>>12:(e[i++]=240|a>>>18,e[i++]=128|a>>>12&63),e[i++]=128|a>>>6&63),e[i++]=128|63&a);return e}(t)},a.utf8decode=function(t){return r.nodebuffer?n.transformTo("nodebuffer",t).toString("utf-8"):function(t){var e,a,r,o,i=t.length,s=new Array(2*i);for(e=a=0;e<i;)if((r=t[e++])<128)s[a++]=r;else if(4<(o=l[r]))s[a++]=65533,e+=o-1;else{for(r&=2===o?31:3===o?15:7;1<o&&e<i;)r=r<<6|63&t[e++],o--;1<o?s[a++]=65533:r<65536?s[a++]=r:(r-=65536,s[a++]=55296|r>>10&1023,s[a++]=56320|1023&r)}return s.length!==a&&(s.subarray?s=s.subarray(0,a):s.length=a),n.applyFromCharCode(s)}(t=n.transformTo(r.uint8array?"uint8array":"array",t))},n.inherits(d,i),d.prototype.processChunk=function(t){var e=n.transformTo(r.uint8array?"uint8array":"array",t.data);if(this.leftOver&&this.leftOver.length){if(r.uint8array){var o=e;(e=new Uint8Array(o.length+this.leftOver.length)).set(this.leftOver,0),e.set(o,this.leftOver.length)}else e=this.leftOver.concat(e);this.leftOver=null}var i=function(t,e){var a;for((e=e||t.length)>t.length&&(e=t.length),a=e-1;0<=a&&128==(192&t[a]);)a--;return a<0||0===a?e:a+l[t[a]]>e?a:e}(e),s=e;i!==e.length&&(r.uint8array?(s=e.subarray(0,i),this.leftOver=e.subarray(i,e.length)):(s=e.slice(0,i),this.leftOver=e.slice(i,e.length))),this.push({data:a.utf8decode(s),meta:t.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:a.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},a.Utf8DecodeWorker=d,n.inherits(c,i),c.prototype.processChunk=function(t){this.push({data:a.utf8encode(t.data),meta:t.meta})},a.Utf8EncodeWorker=c},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,e,a){var n=t("./support"),r=t("./base64"),o=t("./nodejsUtils"),i=t("./external");function l(t){return t}function s(t,e){for(var a=0;a<t.length;++a)e[a]=255&t.charCodeAt(a);return e}t("setimmediate"),a.newBlob=function(t,e){a.checkSupport("blob");try{return new Blob([t],{type:e})}catch(r){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return n.append(t),n.getBlob(e)}catch(o){throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(t,e,a){var n=[],r=0,o=t.length;if(o<=a)return String.fromCharCode.apply(null,t);for(;r<o;)"array"===e||"nodebuffer"===e?n.push(String.fromCharCode.apply(null,t.slice(r,Math.min(r+a,o)))):n.push(String.fromCharCode.apply(null,t.subarray(r,Math.min(r+a,o)))),r+=a;return n.join("")},stringifyByChar:function(t){for(var e="",a=0;a<t.length;a++)e+=String.fromCharCode(t[a]);return e},applyCanBeUsed:{uint8array:function(){try{return n.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(t){return!1}}(),nodebuffer:function(){try{return n.nodebuffer&&1===String.fromCharCode.apply(null,o.allocBuffer(1)).length}catch(t){return!1}}()}};function c(t){var e=65536,n=a.getTypeOf(t),r=!0;if("uint8array"===n?r=d.applyCanBeUsed.uint8array:"nodebuffer"===n&&(r=d.applyCanBeUsed.nodebuffer),r)for(;1<e;)try{return d.stringifyByChunk(t,n,e)}catch(o){e=Math.floor(e/2)}return d.stringifyByChar(t)}function h(t,e){for(var a=0;a<t.length;a++)e[a]=t[a];return e}a.applyFromCharCode=c;var p={};p.string={string:l,array:function(t){return s(t,new Array(t.length))},arraybuffer:function(t){return p.string.uint8array(t).buffer},uint8array:function(t){return s(t,new Uint8Array(t.length))},nodebuffer:function(t){return s(t,o.allocBuffer(t.length))}},p.array={string:c,array:l,arraybuffer:function(t){return new Uint8Array(t).buffer},uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return o.newBufferFrom(t)}},p.arraybuffer={string:function(t){return c(new Uint8Array(t))},array:function(t){return h(new Uint8Array(t),new Array(t.byteLength))},arraybuffer:l,uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return o.newBufferFrom(new Uint8Array(t))}},p.uint8array={string:c,array:function(t){return h(t,new Array(t.length))},arraybuffer:function(t){return t.buffer},uint8array:l,nodebuffer:function(t){return o.newBufferFrom(t)}},p.nodebuffer={string:c,array:function(t){return h(t,new Array(t.length))},arraybuffer:function(t){return p.nodebuffer.uint8array(t).buffer},uint8array:function(t){return h(t,new Uint8Array(t.length))},nodebuffer:l},a.transformTo=function(t,e){if(e=e||"",!t)return e;a.checkSupport(t);var n=a.getTypeOf(e);return p[n][t](e)},a.resolve=function(t){for(var e=t.split("/"),a=[],n=0;n<e.length;n++){var r=e[n];"."===r||""===r&&0!==n&&n!==e.length-1||(".."===r?a.pop():a.push(r))}return a.join("/")},a.getTypeOf=function(t){return"string"==typeof t?"string":"[object Array]"===Object.prototype.toString.call(t)?"array":n.nodebuffer&&o.isBuffer(t)?"nodebuffer":n.uint8array&&t instanceof Uint8Array?"uint8array":n.arraybuffer&&t instanceof ArrayBuffer?"arraybuffer":void 0},a.checkSupport=function(t){if(!n[t.toLowerCase()])throw new Error(t+" is not supported by this platform")},a.MAX_VALUE_16BITS=65535,a.MAX_VALUE_32BITS=-1,a.pretty=function(t){var e,a,n="";for(a=0;a<(t||"").length;a++)n+="\\x"+((e=t.charCodeAt(a))<16?"0":"")+e.toString(16).toUpperCase();return n},a.delay=function(t,e,a){setImmediate(function(){t.apply(a||null,e||[])})},a.inherits=function(t,e){function a(){}a.prototype=e.prototype,t.prototype=new a},a.extend=function(){var t,e,a={};for(t=0;t<arguments.length;t++)for(e in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],e)&&void 0===a[e]&&(a[e]=arguments[t][e]);return a},a.prepareContent=function(t,e,o,l,d){return i.Promise.resolve(e).then(function(t){return n.blob&&(t instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(t)))&&"undefined"!=typeof FileReader?new i.Promise(function(e,a){var n=new FileReader;n.onload=function(t){e(t.target.result)},n.onerror=function(t){a(t.target.error)},n.readAsArrayBuffer(t)}):t}).then(function(e){var c,h=a.getTypeOf(e);return h?("arraybuffer"===h?e=a.transformTo("uint8array",e):"string"===h&&(d?e=r.decode(e):o&&!0!==l&&(e=s(c=e,n.uint8array?new Uint8Array(c.length):new Array(c.length)))),e):i.Promise.reject(new Error("Can't read the data of '"+t+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,e,a){var n=t("./reader/readerFor"),r=t("./utils"),o=t("./signature"),i=t("./zipEntry"),l=t("./support");function s(t){this.files=[],this.loadOptions=t}s.prototype={checkSignature:function(t){if(!this.reader.readAndCheckSignature(t)){this.reader.index-=4;var e=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+r.pretty(e)+", expected "+r.pretty(t)+")")}},isSignature:function(t,e){var a=this.reader.index;this.reader.setIndex(t);var n=this.reader.readString(4)===e;return this.reader.setIndex(a),n},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var t=this.reader.readData(this.zipCommentLength),e=l.uint8array?"uint8array":"array",a=r.transformTo(e,t);this.zipComment=this.loadOptions.decodeFileName(a)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var t,e,a,n=this.zip64EndOfCentralSize-44;0<n;)t=this.reader.readInt(2),e=this.reader.readInt(4),a=this.reader.readData(e),this.zip64ExtensibleData[t]={id:t,length:e,value:a}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var t,e;for(t=0;t<this.files.length;t++)e=this.files[t],this.reader.setIndex(e.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),e.readLocalPart(this.reader),e.handleUTF8(),e.processAttributes()},readCentralDir:function(){var t;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(t=new i({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(t);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var t=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(t<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(t);var e=t;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===r.MAX_VALUE_16BITS||this.diskWithCentralDirStart===r.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===r.MAX_VALUE_16BITS||this.centralDirRecords===r.MAX_VALUE_16BITS||this.centralDirSize===r.MAX_VALUE_32BITS||this.centralDirOffset===r.MAX_VALUE_32BITS){if(this.zip64=!0,(t=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(t),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var a=this.centralDirOffset+this.centralDirSize;this.zip64&&(a+=20,a+=12+this.zip64EndOfCentralSize);var n=e-a;if(0<n)this.isSignature(e,o.CENTRAL_FILE_HEADER)||(this.reader.zero=n);else if(n<0)throw new Error("Corrupted zip: missing "+Math.abs(n)+" bytes.")},prepareReader:function(t){this.reader=n(t)},load:function(t){this.prepareReader(t),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},e.exports=s},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,e,a){var n=t("./reader/readerFor"),r=t("./utils"),o=t("./compressedObject"),i=t("./crc32"),l=t("./utf8"),s=t("./compressions"),d=t("./support");function c(t,e){this.options=t,this.loadOptions=e}c.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(t){var e,a;if(t.skip(22),this.fileNameLength=t.readInt(2),a=t.readInt(2),this.fileName=t.readData(this.fileNameLength),t.skip(a),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(e=function(t){for(var e in s)if(Object.prototype.hasOwnProperty.call(s,e)&&s[e].magic===t)return s[e];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+r.pretty(this.compressionMethod)+" unknown (inner file : "+r.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,e,t.readData(this.compressedSize))},readCentralPart:function(t){this.versionMadeBy=t.readInt(2),t.skip(2),this.bitFlag=t.readInt(2),this.compressionMethod=t.readString(2),this.date=t.readDate(),this.crc32=t.readInt(4),this.compressedSize=t.readInt(4),this.uncompressedSize=t.readInt(4);var e=t.readInt(2);if(this.extraFieldsLength=t.readInt(2),this.fileCommentLength=t.readInt(2),this.diskNumberStart=t.readInt(2),this.internalFileAttributes=t.readInt(2),this.externalFileAttributes=t.readInt(4),this.localHeaderOffset=t.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");t.skip(e),this.readExtraFields(t),this.parseZIP64ExtraField(t),this.fileComment=t.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var t=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==t&&(this.dosPermissions=63&this.externalFileAttributes),3==t&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var t=n(this.extraFields[1].value);this.uncompressedSize===r.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===r.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===r.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===r.MAX_VALUE_32BITS&&(this.diskNumberStart=t.readInt(4))}},readExtraFields:function(t){var e,a,n,r=t.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});t.index+4<r;)e=t.readInt(2),a=t.readInt(2),n=t.readData(a),this.extraFields[e]={id:e,length:a,value:n};t.setIndex(r)},handleUTF8:function(){var t=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=l.utf8decode(this.fileName),this.fileCommentStr=l.utf8decode(this.fileComment);else{var e=this.findExtraFieldUnicodePath();if(null!==e)this.fileNameStr=e;else{var a=r.transformTo(t,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(a)}var n=this.findExtraFieldUnicodeComment();if(null!==n)this.fileCommentStr=n;else{var o=r.transformTo(t,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(o)}}},findExtraFieldUnicodePath:function(){var t=this.extraFields[28789];if(t){var e=n(t.value);return 1!==e.readInt(1)||i(this.fileName)!==e.readInt(4)?null:l.utf8decode(e.readData(t.length-5))}return null},findExtraFieldUnicodeComment:function(){var t=this.extraFields[25461];if(t){var e=n(t.value);return 1!==e.readInt(1)||i(this.fileComment)!==e.readInt(4)?null:l.utf8decode(e.readData(t.length-5))}return null}},e.exports=c},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,e,a){function n(t,e,a){this.name=t,this.dir=a.dir,this.date=a.date,this.comment=a.comment,this.unixPermissions=a.unixPermissions,this.dosPermissions=a.dosPermissions,this._data=e,this._dataBinary=a.binary,this.options={compression:a.compression,compressionOptions:a.compressionOptions}}var r=t("./stream/StreamHelper"),o=t("./stream/DataWorker"),i=t("./utf8"),l=t("./compressedObject"),s=t("./stream/GenericWorker");n.prototype={internalStream:function(t){var e=null,a="string";try{if(!t)throw new Error("No output type specified.");var n="string"===(a=t.toLowerCase())||"text"===a;"binarystring"!==a&&"text"!==a||(a="string"),e=this._decompressWorker();var o=!this._dataBinary;o&&!n&&(e=e.pipe(new i.Utf8EncodeWorker)),!o&&n&&(e=e.pipe(new i.Utf8DecodeWorker))}catch(l){(e=new s("error")).error(l)}return new r(e,a,"")},async:function(t,e){return this.internalStream(t).accumulate(e)},nodeStream:function(t,e){return this.internalStream(t||"nodebuffer").toNodejsStream(e)},_compressWorker:function(t,e){if(this._data instanceof l&&this._data.compression.magic===t.magic)return this._data.getCompressedWorker();var a=this._decompressWorker();return this._dataBinary||(a=a.pipe(new i.Utf8EncodeWorker)),l.createWorkerFrom(a,t,e)},_decompressWorker:function(){return this._data instanceof l?this._data.getContentWorker():this._data instanceof s?this._data:new o(this._data)}};for(var d=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],c=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},h=0;h<d.length;h++)n.prototype[d[h]]=c;e.exports=n},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,e,a){(function(t){var a,n,r=t.MutationObserver||t.WebKitMutationObserver;if(r){var o=0,i=new r(c),l=t.document.createTextNode("");i.observe(l,{characterData:!0}),a=function(){l.data=o=++o%2}}else if(t.setImmediate||void 0===t.MessageChannel)a="document"in t&&"onreadystatechange"in t.document.createElement("script")?function(){var e=t.document.createElement("script");e.onreadystatechange=function(){c(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},t.document.documentElement.appendChild(e)}:function(){setTimeout(c,0)};else{var s=new t.MessageChannel;s.port1.onmessage=c,a=function(){s.port2.postMessage(0)}}var d=[];function c(){var t,e;n=!0;for(var a=d.length;a;){for(e=d,d=[],t=-1;++t<a;)e[t]();a=d.length}n=!1}e.exports=function(t){1!==d.push(t)||n||a()}}).call(this,void 0!==Sn?Sn:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(t,e,a){var n=t("immediate");function r(){}var o={},i=["REJECTED"],l=["FULFILLED"],s=["PENDING"];function d(t){if("function"!=typeof t)throw new TypeError("resolver must be a function");this.state=s,this.queue=[],this.outcome=void 0,t!==r&&u(this,t)}function c(t,e,a){this.promise=t,"function"==typeof e&&(this.onFulfilled=e,this.callFulfilled=this.otherCallFulfilled),"function"==typeof a&&(this.onRejected=a,this.callRejected=this.otherCallRejected)}function h(t,e,a){n(function(){var n;try{n=e(a)}catch(r){return o.reject(t,r)}n===t?o.reject(t,new TypeError("Cannot resolve promise with itself")):o.resolve(t,n)})}function p(t){var e=t&&t.then;if(t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof e)return function(){e.apply(t,arguments)}}function u(t,e){var a=!1;function n(e){a||(a=!0,o.reject(t,e))}function r(e){a||(a=!0,o.resolve(t,e))}var i=f(function(){e(r,n)});"error"===i.status&&n(i.value)}function f(t,e){var a={};try{a.value=t(e),a.status="success"}catch(n){a.status="error",a.value=n}return a}(e.exports=d).prototype.finally=function(t){if("function"!=typeof t)return this;var e=this.constructor;return this.then(function(a){return e.resolve(t()).then(function(){return a})},function(a){return e.resolve(t()).then(function(){throw a})})},d.prototype.catch=function(t){return this.then(null,t)},d.prototype.then=function(t,e){if("function"!=typeof t&&this.state===l||"function"!=typeof e&&this.state===i)return this;var a=new this.constructor(r);return this.state!==s?h(a,this.state===l?t:e,this.outcome):this.queue.push(new c(a,t,e)),a},c.prototype.callFulfilled=function(t){o.resolve(this.promise,t)},c.prototype.otherCallFulfilled=function(t){h(this.promise,this.onFulfilled,t)},c.prototype.callRejected=function(t){o.reject(this.promise,t)},c.prototype.otherCallRejected=function(t){h(this.promise,this.onRejected,t)},o.resolve=function(t,e){var a=f(p,e);if("error"===a.status)return o.reject(t,a.value);var n=a.value;if(n)u(t,n);else{t.state=l,t.outcome=e;for(var r=-1,i=t.queue.length;++r<i;)t.queue[r].callFulfilled(e)}return t},o.reject=function(t,e){t.state=i,t.outcome=e;for(var a=-1,n=t.queue.length;++a<n;)t.queue[a].callRejected(e);return t},d.resolve=function(t){return t instanceof this?t:o.resolve(new this(r),t)},d.reject=function(t){var e=new this(r);return o.reject(e,t)},d.all=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var a=t.length,n=!1;if(!a)return this.resolve([]);for(var i=new Array(a),l=0,s=-1,d=new this(r);++s<a;)c(t[s],s);return d;function c(t,r){e.resolve(t).then(function(t){i[r]=t,++l!==a||n||(n=!0,o.resolve(d,i))},function(t){n||(n=!0,o.reject(d,t))})}},d.race=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var a=t.length,n=!1;if(!a)return this.resolve([]);for(var i,l=-1,s=new this(r);++l<a;)i=t[l],e.resolve(i).then(function(t){n||(n=!0,o.resolve(s,t))},function(t){n||(n=!0,o.reject(s,t))});return s}},{immediate:36}],38:[function(t,e,a){var n={};(0,t("./lib/utils/common").assign)(n,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),e.exports=n},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,e,a){var n=t("./zlib/deflate"),r=t("./utils/common"),o=t("./utils/strings"),i=t("./zlib/messages"),l=t("./zlib/zstream"),s=Object.prototype.toString,d=0,c=-1,h=0,p=8;function u(t){if(!(this instanceof u))return new u(t);this.options=r.assign({level:c,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:h,to:""},t||{});var e=this.options;e.raw&&0<e.windowBits?e.windowBits=-e.windowBits:e.gzip&&0<e.windowBits&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var a=n.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(a!==d)throw new Error(i[a]);if(e.header&&n.deflateSetHeader(this.strm,e.header),e.dictionary){var f;if(f="string"==typeof e.dictionary?o.string2buf(e.dictionary):"[object ArrayBuffer]"===s.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,(a=n.deflateSetDictionary(this.strm,f))!==d)throw new Error(i[a]);this._dict_set=!0}}function f(t,e){var a=new u(e);if(a.push(t,!0),a.err)throw a.msg||i[a.err];return a.result}u.prototype.push=function(t,e){var a,i,l=this.strm,c=this.options.chunkSize;if(this.ended)return!1;i=e===~~e?e:!0===e?4:0,"string"==typeof t?l.input=o.string2buf(t):"[object ArrayBuffer]"===s.call(t)?l.input=new Uint8Array(t):l.input=t,l.next_in=0,l.avail_in=l.input.length;do{if(0===l.avail_out&&(l.output=new r.Buf8(c),l.next_out=0,l.avail_out=c),1!==(a=n.deflate(l,i))&&a!==d)return this.onEnd(a),!(this.ended=!0);0!==l.avail_out&&(0!==l.avail_in||4!==i&&2!==i)||("string"===this.options.to?this.onData(o.buf2binstring(r.shrinkBuf(l.output,l.next_out))):this.onData(r.shrinkBuf(l.output,l.next_out)))}while((0<l.avail_in||0===l.avail_out)&&1!==a);return 4===i?(a=n.deflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===d):2!==i||(this.onEnd(d),!(l.avail_out=0))},u.prototype.onData=function(t){this.chunks.push(t)},u.prototype.onEnd=function(t){t===d&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},a.Deflate=u,a.deflate=f,a.deflateRaw=function(t,e){return(e=e||{}).raw=!0,f(t,e)},a.gzip=function(t,e){return(e=e||{}).gzip=!0,f(t,e)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,e,a){var n=t("./zlib/inflate"),r=t("./utils/common"),o=t("./utils/strings"),i=t("./zlib/constants"),l=t("./zlib/messages"),s=t("./zlib/zstream"),d=t("./zlib/gzheader"),c=Object.prototype.toString;function h(t){if(!(this instanceof h))return new h(t);this.options=r.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&0<=e.windowBits&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(0<=e.windowBits&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),15<e.windowBits&&e.windowBits<48&&!(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var a=n.inflateInit2(this.strm,e.windowBits);if(a!==i.Z_OK)throw new Error(l[a]);this.header=new d,n.inflateGetHeader(this.strm,this.header)}function p(t,e){var a=new h(e);if(a.push(t,!0),a.err)throw a.msg||l[a.err];return a.result}h.prototype.push=function(t,e){var a,l,s,d,h,p,u=this.strm,f=this.options.chunkSize,g=this.options.dictionary,m=!1;if(this.ended)return!1;l=e===~~e?e:!0===e?i.Z_FINISH:i.Z_NO_FLUSH,"string"==typeof t?u.input=o.binstring2buf(t):"[object ArrayBuffer]"===c.call(t)?u.input=new Uint8Array(t):u.input=t,u.next_in=0,u.avail_in=u.input.length;do{if(0===u.avail_out&&(u.output=new r.Buf8(f),u.next_out=0,u.avail_out=f),(a=n.inflate(u,i.Z_NO_FLUSH))===i.Z_NEED_DICT&&g&&(p="string"==typeof g?o.string2buf(g):"[object ArrayBuffer]"===c.call(g)?new Uint8Array(g):g,a=n.inflateSetDictionary(this.strm,p)),a===i.Z_BUF_ERROR&&!0===m&&(a=i.Z_OK,m=!1),a!==i.Z_STREAM_END&&a!==i.Z_OK)return this.onEnd(a),!(this.ended=!0);u.next_out&&(0!==u.avail_out&&a!==i.Z_STREAM_END&&(0!==u.avail_in||l!==i.Z_FINISH&&l!==i.Z_SYNC_FLUSH)||("string"===this.options.to?(s=o.utf8border(u.output,u.next_out),d=u.next_out-s,h=o.buf2string(u.output,s),u.next_out=d,u.avail_out=f-d,d&&r.arraySet(u.output,u.output,s,d,0),this.onData(h)):this.onData(r.shrinkBuf(u.output,u.next_out)))),0===u.avail_in&&0===u.avail_out&&(m=!0)}while((0<u.avail_in||0===u.avail_out)&&a!==i.Z_STREAM_END);return a===i.Z_STREAM_END&&(l=i.Z_FINISH),l===i.Z_FINISH?(a=n.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===i.Z_OK):l!==i.Z_SYNC_FLUSH||(this.onEnd(i.Z_OK),!(u.avail_out=0))},h.prototype.onData=function(t){this.chunks.push(t)},h.prototype.onEnd=function(t){t===i.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},a.Inflate=h,a.inflate=p,a.inflateRaw=function(t,e){return(e=e||{}).raw=!0,p(t,e)},a.ungzip=p},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,e,a){var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;a.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var a=e.shift();if(a){if("object"!=typeof a)throw new TypeError(a+"must be non-object");for(var n in a)a.hasOwnProperty(n)&&(t[n]=a[n])}}return t},a.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var r={arraySet:function(t,e,a,n,r){if(e.subarray&&t.subarray)t.set(e.subarray(a,a+n),r);else for(var o=0;o<n;o++)t[r+o]=e[a+o]},flattenChunks:function(t){var e,a,n,r,o,i;for(e=n=0,a=t.length;e<a;e++)n+=t[e].length;for(i=new Uint8Array(n),e=r=0,a=t.length;e<a;e++)o=t[e],i.set(o,r),r+=o.length;return i}},o={arraySet:function(t,e,a,n,r){for(var o=0;o<n;o++)t[r+o]=e[a+o]},flattenChunks:function(t){return[].concat.apply([],t)}};a.setTyped=function(t){t?(a.Buf8=Uint8Array,a.Buf16=Uint16Array,a.Buf32=Int32Array,a.assign(a,r)):(a.Buf8=Array,a.Buf16=Array,a.Buf32=Array,a.assign(a,o))},a.setTyped(n)},{}],42:[function(t,e,a){var n=t("./common"),r=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(d){r=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(d){o=!1}for(var i=new n.Buf8(256),l=0;l<256;l++)i[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function s(t,e){if(e<65537&&(t.subarray&&o||!t.subarray&&r))return String.fromCharCode.apply(null,n.shrinkBuf(t,e));for(var a="",i=0;i<e;i++)a+=String.fromCharCode(t[i]);return a}i[254]=i[254]=1,a.string2buf=function(t){var e,a,r,o,i,l=t.length,s=0;for(o=0;o<l;o++)55296==(64512&(a=t.charCodeAt(o)))&&o+1<l&&56320==(64512&(r=t.charCodeAt(o+1)))&&(a=65536+(a-55296<<10)+(r-56320),o++),s+=a<128?1:a<2048?2:a<65536?3:4;for(e=new n.Buf8(s),o=i=0;i<s;o++)55296==(64512&(a=t.charCodeAt(o)))&&o+1<l&&56320==(64512&(r=t.charCodeAt(o+1)))&&(a=65536+(a-55296<<10)+(r-56320),o++),a<128?e[i++]=a:(a<2048?e[i++]=192|a>>>6:(a<65536?e[i++]=224|a>>>12:(e[i++]=240|a>>>18,e[i++]=128|a>>>12&63),e[i++]=128|a>>>6&63),e[i++]=128|63&a);return e},a.buf2binstring=function(t){return s(t,t.length)},a.binstring2buf=function(t){for(var e=new n.Buf8(t.length),a=0,r=e.length;a<r;a++)e[a]=t.charCodeAt(a);return e},a.buf2string=function(t,e){var a,n,r,o,l=e||t.length,d=new Array(2*l);for(a=n=0;a<l;)if((r=t[a++])<128)d[n++]=r;else if(4<(o=i[r]))d[n++]=65533,a+=o-1;else{for(r&=2===o?31:3===o?15:7;1<o&&a<l;)r=r<<6|63&t[a++],o--;1<o?d[n++]=65533:r<65536?d[n++]=r:(r-=65536,d[n++]=55296|r>>10&1023,d[n++]=56320|1023&r)}return s(d,n)},a.utf8border=function(t,e){var a;for((e=e||t.length)>t.length&&(e=t.length),a=e-1;0<=a&&128==(192&t[a]);)a--;return a<0||0===a?e:a+i[t[a]]>e?a:e}},{"./common":41}],43:[function(t,e,a){e.exports=function(t,e,a,n){for(var r=65535&t,o=t>>>16&65535,i=0;0!==a;){for(a-=i=2e3<a?2e3:a;o=o+(r=r+e[n++]|0)|0,--i;);r%=65521,o%=65521}return r|o<<16}},{}],44:[function(t,e,a){e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(t,e,a){var n=function(){for(var t,e=[],a=0;a<256;a++){t=a;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t}return e}();e.exports=function(t,e,a,r){var o=n,i=r+a;t^=-1;for(var l=r;l<i;l++)t=t>>>8^o[255&(t^e[l])];return-1^t}},{}],46:[function(t,e,a){var n,r=t("../utils/common"),o=t("./trees"),i=t("./adler32"),l=t("./crc32"),s=t("./messages"),d=0,c=4,h=0,p=-2,u=-1,f=4,g=2,m=8,v=9,b=286,y=30,M=19,x=2*b+1,w=15,S=3,A=258,I=A+S+1,T=42,C=113,k=1,V=2,E=3,R=4;function L(t,e){return t.msg=s[e],e}function z(t){return(t<<1)-(4<t?9:0)}function N(t){for(var e=t.length;0<=--e;)t[e]=0}function q(t){var e=t.state,a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(r.arraySet(t.output,e.pending_buf,e.pending_out,a,t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0))}function O(t,e){o._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,q(t.strm)}function P(t,e){t.pending_buf[t.pending++]=e}function W(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function H(t,e){var a,n,r=t.max_chain_length,o=t.strstart,i=t.prev_length,l=t.nice_match,s=t.strstart>t.w_size-I?t.strstart-(t.w_size-I):0,d=t.window,c=t.w_mask,h=t.prev,p=t.strstart+A,u=d[o+i-1],f=d[o+i];t.prev_length>=t.good_match&&(r>>=2),l>t.lookahead&&(l=t.lookahead);do{if(d[(a=e)+i]===f&&d[a+i-1]===u&&d[a]===d[o]&&d[++a]===d[o+1]){o+=2,a++;do{}while(d[++o]===d[++a]&&d[++o]===d[++a]&&d[++o]===d[++a]&&d[++o]===d[++a]&&d[++o]===d[++a]&&d[++o]===d[++a]&&d[++o]===d[++a]&&d[++o]===d[++a]&&o<p);if(n=A-(p-o),o=p-A,i<n){if(t.match_start=e,l<=(i=n))break;u=d[o+i-1],f=d[o+i]}}}while((e=h[e&c])>s&&0!=--r);return i<=t.lookahead?i:t.lookahead}function U(t){var e,a,n,o,s,d,c,h,p,u,f=t.w_size;do{if(o=t.window_size-t.lookahead-t.strstart,t.strstart>=f+(f-I)){for(r.arraySet(t.window,t.window,f,f,0),t.match_start-=f,t.strstart-=f,t.block_start-=f,e=a=t.hash_size;n=t.head[--e],t.head[e]=f<=n?n-f:0,--a;);for(e=a=f;n=t.prev[--e],t.prev[e]=f<=n?n-f:0,--a;);o+=f}if(0===t.strm.avail_in)break;if(d=t.strm,c=t.window,h=t.strstart+t.lookahead,u=void 0,(p=o)<(u=d.avail_in)&&(u=p),a=0===u?0:(d.avail_in-=u,r.arraySet(c,d.input,d.next_in,u,h),1===d.state.wrap?d.adler=i(d.adler,c,u,h):2===d.state.wrap&&(d.adler=l(d.adler,c,u,h)),d.next_in+=u,d.total_in+=u,u),t.lookahead+=a,t.lookahead+t.insert>=S)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=(t.ins_h<<t.hash_shift^t.window[s+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[s+S-1])&t.hash_mask,t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<S)););}while(t.lookahead<I&&0!==t.strm.avail_in)}function F(t,e){for(var a,n;;){if(t.lookahead<I){if(U(t),t.lookahead<I&&e===d)return k;if(0===t.lookahead)break}if(a=0,t.lookahead>=S&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+S-1])&t.hash_mask,a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-I&&(t.match_length=H(t,a)),t.match_length>=S)if(n=o._tr_tally(t,t.strstart-t.match_start,t.match_length-S),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=S){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+S-1])&t.hash_mask,a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart,0!=--t.match_length;);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else n=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(O(t,!1),0===t.strm.avail_out))return k}return t.insert=t.strstart<S-1?t.strstart:S-1,e===c?(O(t,!0),0===t.strm.avail_out?E:R):t.last_lit&&(O(t,!1),0===t.strm.avail_out)?k:V}function B(t,e){for(var a,n,r;;){if(t.lookahead<I){if(U(t),t.lookahead<I&&e===d)return k;if(0===t.lookahead)break}if(a=0,t.lookahead>=S&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+S-1])&t.hash_mask,a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=S-1,0!==a&&t.prev_length<t.max_lazy_match&&t.strstart-a<=t.w_size-I&&(t.match_length=H(t,a),t.match_length<=5&&(1===t.strategy||t.match_length===S&&4096<t.strstart-t.match_start)&&(t.match_length=S-1)),t.prev_length>=S&&t.match_length<=t.prev_length){for(r=t.strstart+t.lookahead-S,n=o._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-S),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=r&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+S-1])&t.hash_mask,a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!=--t.prev_length;);if(t.match_available=0,t.match_length=S-1,t.strstart++,n&&(O(t,!1),0===t.strm.avail_out))return k}else if(t.match_available){if((n=o._tr_tally(t,0,t.window[t.strstart-1]))&&O(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return k}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=o._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<S-1?t.strstart:S-1,e===c?(O(t,!0),0===t.strm.avail_out?E:R):t.last_lit&&(O(t,!1),0===t.strm.avail_out)?k:V}function G(t,e,a,n,r){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=n,this.func=r}function Z(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=m,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new r.Buf16(2*x),this.dyn_dtree=new r.Buf16(2*(2*y+1)),this.bl_tree=new r.Buf16(2*(2*M+1)),N(this.dyn_ltree),N(this.dyn_dtree),N(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new r.Buf16(w+1),this.heap=new r.Buf16(2*b+1),N(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new r.Buf16(2*b+1),N(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function K(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=g,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?T:C,t.adler=2===e.wrap?0:1,e.last_flush=d,o._tr_init(e),h):L(t,p)}function D(t){var e,a=K(t);return a===h&&((e=t.state).window_size=2*e.w_size,N(e.head),e.max_lazy_match=n[e.level].max_lazy,e.good_match=n[e.level].good_length,e.nice_match=n[e.level].nice_length,e.max_chain_length=n[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=S-1,e.match_available=0,e.ins_h=0),a}function j(t,e,a,n,o,i){if(!t)return p;var l=1;if(e===u&&(e=6),n<0?(l=0,n=-n):15<n&&(l=2,n-=16),o<1||v<o||a!==m||n<8||15<n||e<0||9<e||i<0||f<i)return L(t,p);8===n&&(n=9);var s=new Z;return(t.state=s).strm=t,s.wrap=l,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=o+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+S-1)/S),s.window=new r.Buf8(2*s.w_size),s.head=new r.Buf16(s.hash_size),s.prev=new r.Buf16(s.w_size),s.lit_bufsize=1<<o+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new r.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=e,s.strategy=i,s.method=a,D(t)}n=[new G(0,0,0,0,function(t,e){var a=65535;for(a>t.pending_buf_size-5&&(a=t.pending_buf_size-5);;){if(t.lookahead<=1){if(U(t),0===t.lookahead&&e===d)return k;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+a;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,O(t,!1),0===t.strm.avail_out))return k;if(t.strstart-t.block_start>=t.w_size-I&&(O(t,!1),0===t.strm.avail_out))return k}return t.insert=0,e===c?(O(t,!0),0===t.strm.avail_out?E:R):(t.strstart>t.block_start&&(O(t,!1),t.strm.avail_out),k)}),new G(4,4,8,4,F),new G(4,5,16,8,F),new G(4,6,32,32,F),new G(4,4,16,16,B),new G(8,16,32,32,B),new G(8,16,128,128,B),new G(8,32,128,256,B),new G(32,128,258,1024,B),new G(32,258,258,4096,B)],a.deflateInit=function(t,e){return j(t,e,m,15,8,0)},a.deflateInit2=j,a.deflateReset=D,a.deflateResetKeep=K,a.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?p:(t.state.gzhead=e,h):p},a.deflate=function(t,e){var a,r,i,s;if(!t||!t.state||5<e||e<0)return t?L(t,p):p;if(r=t.state,!t.output||!t.input&&0!==t.avail_in||666===r.status&&e!==c)return L(t,0===t.avail_out?-5:p);if(r.strm=t,a=r.last_flush,r.last_flush=e,r.status===T)if(2===r.wrap)t.adler=0,P(r,31),P(r,139),P(r,8),r.gzhead?(P(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),P(r,255&r.gzhead.time),P(r,r.gzhead.time>>8&255),P(r,r.gzhead.time>>16&255),P(r,r.gzhead.time>>24&255),P(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),P(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(P(r,255&r.gzhead.extra.length),P(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=l(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(P(r,0),P(r,0),P(r,0),P(r,0),P(r,0),P(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),P(r,3),r.status=C);else{var u=m+(r.w_bits-8<<4)<<8;u|=(2<=r.strategy||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(u|=32),u+=31-u%31,r.status=C,W(r,u),0!==r.strstart&&(W(r,t.adler>>>16),W(r,65535&t.adler)),t.adler=1}if(69===r.status)if(r.gzhead.extra){for(i=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>i&&(t.adler=l(t.adler,r.pending_buf,r.pending-i,i)),q(t),i=r.pending,r.pending!==r.pending_buf_size));)P(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>i&&(t.adler=l(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=l(t.adler,r.pending_buf,r.pending-i,i)),q(t),i=r.pending,r.pending===r.pending_buf_size)){s=1;break}s=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,P(r,s)}while(0!==s);r.gzhead.hcrc&&r.pending>i&&(t.adler=l(t.adler,r.pending_buf,r.pending-i,i)),0===s&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=l(t.adler,r.pending_buf,r.pending-i,i)),q(t),i=r.pending,r.pending===r.pending_buf_size)){s=1;break}s=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,P(r,s)}while(0!==s);r.gzhead.hcrc&&r.pending>i&&(t.adler=l(t.adler,r.pending_buf,r.pending-i,i)),0===s&&(r.status=103)}else r.status=103;if(103===r.status&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&q(t),r.pending+2<=r.pending_buf_size&&(P(r,255&t.adler),P(r,t.adler>>8&255),t.adler=0,r.status=C)):r.status=C),0!==r.pending){if(q(t),0===t.avail_out)return r.last_flush=-1,h}else if(0===t.avail_in&&z(e)<=z(a)&&e!==c)return L(t,-5);if(666===r.status&&0!==t.avail_in)return L(t,-5);if(0!==t.avail_in||0!==r.lookahead||e!==d&&666!==r.status){var f=2===r.strategy?function(t,e){for(var a;;){if(0===t.lookahead&&(U(t),0===t.lookahead)){if(e===d)return k;break}if(t.match_length=0,a=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(O(t,!1),0===t.strm.avail_out))return k}return t.insert=0,e===c?(O(t,!0),0===t.strm.avail_out?E:R):t.last_lit&&(O(t,!1),0===t.strm.avail_out)?k:V}(r,e):3===r.strategy?function(t,e){for(var a,n,r,i,l=t.window;;){if(t.lookahead<=A){if(U(t),t.lookahead<=A&&e===d)return k;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=S&&0<t.strstart&&(n=l[r=t.strstart-1])===l[++r]&&n===l[++r]&&n===l[++r]){i=t.strstart+A;do{}while(n===l[++r]&&n===l[++r]&&n===l[++r]&&n===l[++r]&&n===l[++r]&&n===l[++r]&&n===l[++r]&&n===l[++r]&&r<i);t.match_length=A-(i-r),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=S?(a=o._tr_tally(t,1,t.match_length-S),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(O(t,!1),0===t.strm.avail_out))return k}return t.insert=0,e===c?(O(t,!0),0===t.strm.avail_out?E:R):t.last_lit&&(O(t,!1),0===t.strm.avail_out)?k:V}(r,e):n[r.level].func(r,e);if(f!==E&&f!==R||(r.status=666),f===k||f===E)return 0===t.avail_out&&(r.last_flush=-1),h;if(f===V&&(1===e?o._tr_align(r):5!==e&&(o._tr_stored_block(r,0,0,!1),3===e&&(N(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),q(t),0===t.avail_out))return r.last_flush=-1,h}return e!==c?h:r.wrap<=0?1:(2===r.wrap?(P(r,255&t.adler),P(r,t.adler>>8&255),P(r,t.adler>>16&255),P(r,t.adler>>24&255),P(r,255&t.total_in),P(r,t.total_in>>8&255),P(r,t.total_in>>16&255),P(r,t.total_in>>24&255)):(W(r,t.adler>>>16),W(r,65535&t.adler)),q(t),0<r.wrap&&(r.wrap=-r.wrap),0!==r.pending?h:1)},a.deflateEnd=function(t){var e;return t&&t.state?(e=t.state.status)!==T&&69!==e&&73!==e&&91!==e&&103!==e&&e!==C&&666!==e?L(t,p):(t.state=null,e===C?L(t,-3):h):p},a.deflateSetDictionary=function(t,e){var a,n,o,l,s,d,c,u,f=e.length;if(!t||!t.state)return p;if(2===(l=(a=t.state).wrap)||1===l&&a.status!==T||a.lookahead)return p;for(1===l&&(t.adler=i(t.adler,e,f,0)),a.wrap=0,f>=a.w_size&&(0===l&&(N(a.head),a.strstart=0,a.block_start=0,a.insert=0),u=new r.Buf8(a.w_size),r.arraySet(u,e,f-a.w_size,a.w_size,0),e=u,f=a.w_size),s=t.avail_in,d=t.next_in,c=t.input,t.avail_in=f,t.next_in=0,t.input=e,U(a);a.lookahead>=S;){for(n=a.strstart,o=a.lookahead-(S-1);a.ins_h=(a.ins_h<<a.hash_shift^a.window[n+S-1])&a.hash_mask,a.prev[n&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=n,n++,--o;);a.strstart=n,a.lookahead=S-1,U(a)}return a.strstart+=a.lookahead,a.block_start=a.strstart,a.insert=a.lookahead,a.lookahead=0,a.match_length=a.prev_length=S-1,a.match_available=0,t.next_in=d,t.input=c,t.avail_in=s,a.wrap=l,h},a.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,e,a){e.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(t,e,a){e.exports=function(t,e){var a,n,r,o,i,l,s,d,c,h,p,u,f,g,m,v,b,y,M,x,w,S,A,I,T;a=t.state,n=t.next_in,I=t.input,r=n+(t.avail_in-5),o=t.next_out,T=t.output,i=o-(e-t.avail_out),l=o+(t.avail_out-257),s=a.dmax,d=a.wsize,c=a.whave,h=a.wnext,p=a.window,u=a.hold,f=a.bits,g=a.lencode,m=a.distcode,v=(1<<a.lenbits)-1,b=(1<<a.distbits)-1;t:do{f<15&&(u+=I[n++]<<f,f+=8,u+=I[n++]<<f,f+=8),y=g[u&v];e:for(;;){if(u>>>=M=y>>>24,f-=M,0==(M=y>>>16&255))T[o++]=65535&y;else{if(!(16&M)){if(!(64&M)){y=g[(65535&y)+(u&(1<<M)-1)];continue e}if(32&M){a.mode=12;break t}t.msg="invalid literal/length code",a.mode=30;break t}x=65535&y,(M&=15)&&(f<M&&(u+=I[n++]<<f,f+=8),x+=u&(1<<M)-1,u>>>=M,f-=M),f<15&&(u+=I[n++]<<f,f+=8,u+=I[n++]<<f,f+=8),y=m[u&b];a:for(;;){if(u>>>=M=y>>>24,f-=M,!(16&(M=y>>>16&255))){if(!(64&M)){y=m[(65535&y)+(u&(1<<M)-1)];continue a}t.msg="invalid distance code",a.mode=30;break t}if(w=65535&y,f<(M&=15)&&(u+=I[n++]<<f,(f+=8)<M&&(u+=I[n++]<<f,f+=8)),s<(w+=u&(1<<M)-1)){t.msg="invalid distance too far back",a.mode=30;break t}if(u>>>=M,f-=M,(M=o-i)<w){if(c<(M=w-M)&&a.sane){t.msg="invalid distance too far back",a.mode=30;break t}if(A=p,(S=0)===h){if(S+=d-M,M<x){for(x-=M;T[o++]=p[S++],--M;);S=o-w,A=T}}else if(h<M){if(S+=d+h-M,(M-=h)<x){for(x-=M;T[o++]=p[S++],--M;);if(S=0,h<x){for(x-=M=h;T[o++]=p[S++],--M;);S=o-w,A=T}}}else if(S+=h-M,M<x){for(x-=M;T[o++]=p[S++],--M;);S=o-w,A=T}for(;2<x;)T[o++]=A[S++],T[o++]=A[S++],T[o++]=A[S++],x-=3;x&&(T[o++]=A[S++],1<x&&(T[o++]=A[S++]))}else{for(S=o-w;T[o++]=T[S++],T[o++]=T[S++],T[o++]=T[S++],2<(x-=3););x&&(T[o++]=T[S++],1<x&&(T[o++]=T[S++]))}break}}break}}while(n<r&&o<l);n-=x=f>>3,u&=(1<<(f-=x<<3))-1,t.next_in=n,t.next_out=o,t.avail_in=n<r?r-n+5:5-(n-r),t.avail_out=o<l?l-o+257:257-(o-l),a.hold=u,a.bits=f}},{}],49:[function(t,e,a){var n=t("../utils/common"),r=t("./adler32"),o=t("./crc32"),i=t("./inffast"),l=t("./inftrees"),s=1,d=2,c=0,h=-2,p=1,u=852,f=592;function g(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function m(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function v(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=p,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new n.Buf32(u),e.distcode=e.distdyn=new n.Buf32(f),e.sane=1,e.back=-1,c):h}function b(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,v(t)):h}function y(t,e){var a,n;return t&&t.state?(n=t.state,e<0?(a=0,e=-e):(a=1+(e>>4),e<48&&(e&=15)),e&&(e<8||15<e)?h:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=a,n.wbits=e,b(t))):h}function M(t,e){var a,n;return t?(n=new m,(t.state=n).window=null,(a=y(t,e))!==c&&(t.state=null),a):h}var x,w,S=!0;function A(t){if(S){var e;for(x=new n.Buf32(512),w=new n.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(l(s,t.lens,0,288,x,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;l(d,t.lens,0,32,w,0,t.work,{bits:5}),S=!1}t.lencode=x,t.lenbits=9,t.distcode=w,t.distbits=5}function I(t,e,a,r){var o,i=t.state;return null===i.window&&(i.wsize=1<<i.wbits,i.wnext=0,i.whave=0,i.window=new n.Buf8(i.wsize)),r>=i.wsize?(n.arraySet(i.window,e,a-i.wsize,i.wsize,0),i.wnext=0,i.whave=i.wsize):(r<(o=i.wsize-i.wnext)&&(o=r),n.arraySet(i.window,e,a-r,o,i.wnext),(r-=o)?(n.arraySet(i.window,e,a-r,r,0),i.wnext=r,i.whave=i.wsize):(i.wnext+=o,i.wnext===i.wsize&&(i.wnext=0),i.whave<i.wsize&&(i.whave+=o))),0}a.inflateReset=b,a.inflateReset2=y,a.inflateResetKeep=v,a.inflateInit=function(t){return M(t,15)},a.inflateInit2=M,a.inflate=function(t,e){var a,u,f,m,v,b,y,M,x,w,S,T,C,k,V,E,R,L,z,N,q,O,P,W,H=0,U=new n.Buf8(4),F=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return h;12===(a=t.state).mode&&(a.mode=13),v=t.next_out,f=t.output,y=t.avail_out,m=t.next_in,u=t.input,b=t.avail_in,M=a.hold,x=a.bits,w=b,S=y,O=c;t:for(;;)switch(a.mode){case p:if(0===a.wrap){a.mode=13;break}for(;x<16;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}if(2&a.wrap&&35615===M){U[a.check=0]=255&M,U[1]=M>>>8&255,a.check=o(a.check,U,2,0),x=M=0,a.mode=2;break}if(a.flags=0,a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&M)<<8)+(M>>8))%31){t.msg="incorrect header check",a.mode=30;break}if(8!=(15&M)){t.msg="unknown compression method",a.mode=30;break}if(x-=4,q=8+(15&(M>>>=4)),0===a.wbits)a.wbits=q;else if(q>a.wbits){t.msg="invalid window size",a.mode=30;break}a.dmax=1<<q,t.adler=a.check=1,a.mode=512&M?10:12,x=M=0;break;case 2:for(;x<16;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}if(a.flags=M,8!=(255&a.flags)){t.msg="unknown compression method",a.mode=30;break}if(57344&a.flags){t.msg="unknown header flags set",a.mode=30;break}a.head&&(a.head.text=M>>8&1),512&a.flags&&(U[0]=255&M,U[1]=M>>>8&255,a.check=o(a.check,U,2,0)),x=M=0,a.mode=3;case 3:for(;x<32;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}a.head&&(a.head.time=M),512&a.flags&&(U[0]=255&M,U[1]=M>>>8&255,U[2]=M>>>16&255,U[3]=M>>>24&255,a.check=o(a.check,U,4,0)),x=M=0,a.mode=4;case 4:for(;x<16;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}a.head&&(a.head.xflags=255&M,a.head.os=M>>8),512&a.flags&&(U[0]=255&M,U[1]=M>>>8&255,a.check=o(a.check,U,2,0)),x=M=0,a.mode=5;case 5:if(1024&a.flags){for(;x<16;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}a.length=M,a.head&&(a.head.extra_len=M),512&a.flags&&(U[0]=255&M,U[1]=M>>>8&255,a.check=o(a.check,U,2,0)),x=M=0}else a.head&&(a.head.extra=null);a.mode=6;case 6:if(1024&a.flags&&(b<(T=a.length)&&(T=b),T&&(a.head&&(q=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Array(a.head.extra_len)),n.arraySet(a.head.extra,u,m,T,q)),512&a.flags&&(a.check=o(a.check,u,T,m)),b-=T,m+=T,a.length-=T),a.length))break t;a.length=0,a.mode=7;case 7:if(2048&a.flags){if(0===b)break t;for(T=0;q=u[m+T++],a.head&&q&&a.length<65536&&(a.head.name+=String.fromCharCode(q)),q&&T<b;);if(512&a.flags&&(a.check=o(a.check,u,T,m)),b-=T,m+=T,q)break t}else a.head&&(a.head.name=null);a.length=0,a.mode=8;case 8:if(4096&a.flags){if(0===b)break t;for(T=0;q=u[m+T++],a.head&&q&&a.length<65536&&(a.head.comment+=String.fromCharCode(q)),q&&T<b;);if(512&a.flags&&(a.check=o(a.check,u,T,m)),b-=T,m+=T,q)break t}else a.head&&(a.head.comment=null);a.mode=9;case 9:if(512&a.flags){for(;x<16;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}if(M!==(65535&a.check)){t.msg="header crc mismatch",a.mode=30;break}x=M=0}a.head&&(a.head.hcrc=a.flags>>9&1,a.head.done=!0),t.adler=a.check=0,a.mode=12;break;case 10:for(;x<32;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}t.adler=a.check=g(M),x=M=0,a.mode=11;case 11:if(0===a.havedict)return t.next_out=v,t.avail_out=y,t.next_in=m,t.avail_in=b,a.hold=M,a.bits=x,2;t.adler=a.check=1,a.mode=12;case 12:if(5===e||6===e)break t;case 13:if(a.last){M>>>=7&x,x-=7&x,a.mode=27;break}for(;x<3;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}switch(a.last=1&M,x-=1,3&(M>>>=1)){case 0:a.mode=14;break;case 1:if(A(a),a.mode=20,6!==e)break;M>>>=2,x-=2;break t;case 2:a.mode=17;break;case 3:t.msg="invalid block type",a.mode=30}M>>>=2,x-=2;break;case 14:for(M>>>=7&x,x-=7&x;x<32;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}if((65535&M)!=(M>>>16^65535)){t.msg="invalid stored block lengths",a.mode=30;break}if(a.length=65535&M,x=M=0,a.mode=15,6===e)break t;case 15:a.mode=16;case 16:if(T=a.length){if(b<T&&(T=b),y<T&&(T=y),0===T)break t;n.arraySet(f,u,m,T,v),b-=T,m+=T,y-=T,v+=T,a.length-=T;break}a.mode=12;break;case 17:for(;x<14;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}if(a.nlen=257+(31&M),M>>>=5,x-=5,a.ndist=1+(31&M),M>>>=5,x-=5,a.ncode=4+(15&M),M>>>=4,x-=4,286<a.nlen||30<a.ndist){t.msg="too many length or distance symbols",a.mode=30;break}a.have=0,a.mode=18;case 18:for(;a.have<a.ncode;){for(;x<3;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}a.lens[F[a.have++]]=7&M,M>>>=3,x-=3}for(;a.have<19;)a.lens[F[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,P={bits:a.lenbits},O=l(0,a.lens,0,19,a.lencode,0,a.work,P),a.lenbits=P.bits,O){t.msg="invalid code lengths set",a.mode=30;break}a.have=0,a.mode=19;case 19:for(;a.have<a.nlen+a.ndist;){for(;E=(H=a.lencode[M&(1<<a.lenbits)-1])>>>16&255,R=65535&H,!((V=H>>>24)<=x);){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}if(R<16)M>>>=V,x-=V,a.lens[a.have++]=R;else{if(16===R){for(W=V+2;x<W;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}if(M>>>=V,x-=V,0===a.have){t.msg="invalid bit length repeat",a.mode=30;break}q=a.lens[a.have-1],T=3+(3&M),M>>>=2,x-=2}else if(17===R){for(W=V+3;x<W;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}x-=V,q=0,T=3+(7&(M>>>=V)),M>>>=3,x-=3}else{for(W=V+7;x<W;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}x-=V,q=0,T=11+(127&(M>>>=V)),M>>>=7,x-=7}if(a.have+T>a.nlen+a.ndist){t.msg="invalid bit length repeat",a.mode=30;break}for(;T--;)a.lens[a.have++]=q}}if(30===a.mode)break;if(0===a.lens[256]){t.msg="invalid code -- missing end-of-block",a.mode=30;break}if(a.lenbits=9,P={bits:a.lenbits},O=l(s,a.lens,0,a.nlen,a.lencode,0,a.work,P),a.lenbits=P.bits,O){t.msg="invalid literal/lengths set",a.mode=30;break}if(a.distbits=6,a.distcode=a.distdyn,P={bits:a.distbits},O=l(d,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,P),a.distbits=P.bits,O){t.msg="invalid distances set",a.mode=30;break}if(a.mode=20,6===e)break t;case 20:a.mode=21;case 21:if(6<=b&&258<=y){t.next_out=v,t.avail_out=y,t.next_in=m,t.avail_in=b,a.hold=M,a.bits=x,i(t,S),v=t.next_out,f=t.output,y=t.avail_out,m=t.next_in,u=t.input,b=t.avail_in,M=a.hold,x=a.bits,12===a.mode&&(a.back=-1);break}for(a.back=0;E=(H=a.lencode[M&(1<<a.lenbits)-1])>>>16&255,R=65535&H,!((V=H>>>24)<=x);){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}if(E&&!(240&E)){for(L=V,z=E,N=R;E=(H=a.lencode[N+((M&(1<<L+z)-1)>>L)])>>>16&255,R=65535&H,!(L+(V=H>>>24)<=x);){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}M>>>=L,x-=L,a.back+=L}if(M>>>=V,x-=V,a.back+=V,a.length=R,0===E){a.mode=26;break}if(32&E){a.back=-1,a.mode=12;break}if(64&E){t.msg="invalid literal/length code",a.mode=30;break}a.extra=15&E,a.mode=22;case 22:if(a.extra){for(W=a.extra;x<W;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}a.length+=M&(1<<a.extra)-1,M>>>=a.extra,x-=a.extra,a.back+=a.extra}a.was=a.length,a.mode=23;case 23:for(;E=(H=a.distcode[M&(1<<a.distbits)-1])>>>16&255,R=65535&H,!((V=H>>>24)<=x);){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}if(!(240&E)){for(L=V,z=E,N=R;E=(H=a.distcode[N+((M&(1<<L+z)-1)>>L)])>>>16&255,R=65535&H,!(L+(V=H>>>24)<=x);){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}M>>>=L,x-=L,a.back+=L}if(M>>>=V,x-=V,a.back+=V,64&E){t.msg="invalid distance code",a.mode=30;break}a.offset=R,a.extra=15&E,a.mode=24;case 24:if(a.extra){for(W=a.extra;x<W;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}a.offset+=M&(1<<a.extra)-1,M>>>=a.extra,x-=a.extra,a.back+=a.extra}if(a.offset>a.dmax){t.msg="invalid distance too far back",a.mode=30;break}a.mode=25;case 25:if(0===y)break t;if(T=S-y,a.offset>T){if((T=a.offset-T)>a.whave&&a.sane){t.msg="invalid distance too far back",a.mode=30;break}C=T>a.wnext?(T-=a.wnext,a.wsize-T):a.wnext-T,T>a.length&&(T=a.length),k=a.window}else k=f,C=v-a.offset,T=a.length;for(y<T&&(T=y),y-=T,a.length-=T;f[v++]=k[C++],--T;);0===a.length&&(a.mode=21);break;case 26:if(0===y)break t;f[v++]=a.length,y--,a.mode=21;break;case 27:if(a.wrap){for(;x<32;){if(0===b)break t;b--,M|=u[m++]<<x,x+=8}if(S-=y,t.total_out+=S,a.total+=S,S&&(t.adler=a.check=a.flags?o(a.check,f,S,v-S):r(a.check,f,S,v-S)),S=y,(a.flags?M:g(M))!==a.check){t.msg="incorrect data check",a.mode=30;break}x=M=0}a.mode=28;case 28:if(a.wrap&&a.flags){for(;x<32;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}if(M!==(4294967295&a.total)){t.msg="incorrect length check",a.mode=30;break}x=M=0}a.mode=29;case 29:O=1;break t;case 30:O=-3;break t;case 31:return-4;default:return h}return t.next_out=v,t.avail_out=y,t.next_in=m,t.avail_in=b,a.hold=M,a.bits=x,(a.wsize||S!==t.avail_out&&a.mode<30&&(a.mode<27||4!==e))&&I(t,t.output,t.next_out,S-t.avail_out)?(a.mode=31,-4):(w-=t.avail_in,S-=t.avail_out,t.total_in+=w,t.total_out+=S,a.total+=S,a.wrap&&S&&(t.adler=a.check=a.flags?o(a.check,f,S,t.next_out-S):r(a.check,f,S,t.next_out-S)),t.data_type=a.bits+(a.last?64:0)+(12===a.mode?128:0)+(20===a.mode||15===a.mode?256:0),(0==w&&0===S||4===e)&&O===c&&(O=-5),O)},a.inflateEnd=function(t){if(!t||!t.state)return h;var e=t.state;return e.window&&(e.window=null),t.state=null,c},a.inflateGetHeader=function(t,e){var a;return t&&t.state&&2&(a=t.state).wrap?((a.head=e).done=!1,c):h},a.inflateSetDictionary=function(t,e){var a,n=e.length;return t&&t.state?0!==(a=t.state).wrap&&11!==a.mode?h:11===a.mode&&r(1,e,n,0)!==a.check?-3:I(t,e,n,n)?(a.mode=31,-4):(a.havedict=1,c):h},a.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,e,a){var n=t("../utils/common"),r=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],i=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],l=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(t,e,a,s,d,c,h,p){var u,f,g,m,v,b,y,M,x,w=p.bits,S=0,A=0,I=0,T=0,C=0,k=0,V=0,E=0,R=0,L=0,z=null,N=0,q=new n.Buf16(16),O=new n.Buf16(16),P=null,W=0;for(S=0;S<=15;S++)q[S]=0;for(A=0;A<s;A++)q[e[a+A]]++;for(C=w,T=15;1<=T&&0===q[T];T--);if(T<C&&(C=T),0===T)return d[c++]=20971520,d[c++]=20971520,p.bits=1,0;for(I=1;I<T&&0===q[I];I++);for(C<I&&(C=I),S=E=1;S<=15;S++)if(E<<=1,(E-=q[S])<0)return-1;if(0<E&&(0===t||1!==T))return-1;for(O[1]=0,S=1;S<15;S++)O[S+1]=O[S]+q[S];for(A=0;A<s;A++)0!==e[a+A]&&(h[O[e[a+A]]++]=A);if(b=0===t?(z=P=h,19):1===t?(z=r,N-=257,P=o,W-=257,256):(z=i,P=l,-1),S=I,v=c,V=A=L=0,g=-1,m=(R=1<<(k=C))-1,1===t&&852<R||2===t&&592<R)return 1;for(;;){for(y=S-V,x=h[A]<b?(M=0,h[A]):h[A]>b?(M=P[W+h[A]],z[N+h[A]]):(M=96,0),u=1<<S-V,I=f=1<<k;d[v+(L>>V)+(f-=u)]=y<<24|M<<16|x,0!==f;);for(u=1<<S-1;L&u;)u>>=1;if(0!==u?(L&=u-1,L+=u):L=0,A++,0==--q[S]){if(S===T)break;S=e[a+h[A]]}if(C<S&&(L&m)!==g){for(0===V&&(V=C),v+=I,E=1<<(k=S-V);k+V<T&&!((E-=q[k+V])<=0);)k++,E<<=1;if(R+=1<<k,1===t&&852<R||2===t&&592<R)return 1;d[g=L&m]=C<<24|k<<16|v-c}}return 0!==L&&(d[v+L]=S-V<<24|64<<16),p.bits=C,0}},{"../utils/common":41}],51:[function(t,e,a){e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(t,e,a){var n=t("../utils/common"),r=0,o=1;function i(t){for(var e=t.length;0<=--e;)t[e]=0}var l=0,s=29,d=256,c=d+1+s,h=30,p=19,u=2*c+1,f=15,g=16,m=7,v=256,b=16,y=17,M=18,x=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],w=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],S=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],A=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],I=new Array(2*(c+2));i(I);var T=new Array(2*h);i(T);var C=new Array(512);i(C);var k=new Array(256);i(k);var V=new Array(s);i(V);var E,R,L,z=new Array(h);function N(t,e,a,n,r){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=n,this.max_length=r,this.has_stree=t&&t.length}function q(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function O(t){return t<256?C[t]:C[256+(t>>>7)]}function P(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function W(t,e,a){t.bi_valid>g-a?(t.bi_buf|=e<<t.bi_valid&65535,P(t,t.bi_buf),t.bi_buf=e>>g-t.bi_valid,t.bi_valid+=a-g):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=a)}function H(t,e,a){W(t,a[2*e],a[2*e+1])}function U(t,e){for(var a=0;a|=1&t,t>>>=1,a<<=1,0<--e;);return a>>>1}function F(t,e,a){var n,r,o=new Array(f+1),i=0;for(n=1;n<=f;n++)o[n]=i=i+a[n-1]<<1;for(r=0;r<=e;r++){var l=t[2*r+1];0!==l&&(t[2*r]=U(o[l]++,l))}}function B(t){var e;for(e=0;e<c;e++)t.dyn_ltree[2*e]=0;for(e=0;e<h;e++)t.dyn_dtree[2*e]=0;for(e=0;e<p;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*v]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function G(t){8<t.bi_valid?P(t,t.bi_buf):0<t.bi_valid&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function Z(t,e,a,n){var r=2*e,o=2*a;return t[r]<t[o]||t[r]===t[o]&&n[e]<=n[a]}function K(t,e,a){for(var n=t.heap[a],r=a<<1;r<=t.heap_len&&(r<t.heap_len&&Z(e,t.heap[r+1],t.heap[r],t.depth)&&r++,!Z(e,n,t.heap[r],t.depth));)t.heap[a]=t.heap[r],a=r,r<<=1;t.heap[a]=n}function D(t,e,a){var n,r,o,i,l=0;if(0!==t.last_lit)for(;n=t.pending_buf[t.d_buf+2*l]<<8|t.pending_buf[t.d_buf+2*l+1],r=t.pending_buf[t.l_buf+l],l++,0===n?H(t,r,e):(H(t,(o=k[r])+d+1,e),0!==(i=x[o])&&W(t,r-=V[o],i),H(t,o=O(--n),a),0!==(i=w[o])&&W(t,n-=z[o],i)),l<t.last_lit;);H(t,v,e)}function j(t,e){var a,n,r,o=e.dyn_tree,i=e.stat_desc.static_tree,l=e.stat_desc.has_stree,s=e.stat_desc.elems,d=-1;for(t.heap_len=0,t.heap_max=u,a=0;a<s;a++)0!==o[2*a]?(t.heap[++t.heap_len]=d=a,t.depth[a]=0):o[2*a+1]=0;for(;t.heap_len<2;)o[2*(r=t.heap[++t.heap_len]=d<2?++d:0)]=1,t.depth[r]=0,t.opt_len--,l&&(t.static_len-=i[2*r+1]);for(e.max_code=d,a=t.heap_len>>1;1<=a;a--)K(t,o,a);for(r=s;a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],K(t,o,1),n=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=n,o[2*r]=o[2*a]+o[2*n],t.depth[r]=(t.depth[a]>=t.depth[n]?t.depth[a]:t.depth[n])+1,o[2*a+1]=o[2*n+1]=r,t.heap[1]=r++,K(t,o,1),2<=t.heap_len;);t.heap[--t.heap_max]=t.heap[1],function(t,e){var a,n,r,o,i,l,s=e.dyn_tree,d=e.max_code,c=e.stat_desc.static_tree,h=e.stat_desc.has_stree,p=e.stat_desc.extra_bits,g=e.stat_desc.extra_base,m=e.stat_desc.max_length,v=0;for(o=0;o<=f;o++)t.bl_count[o]=0;for(s[2*t.heap[t.heap_max]+1]=0,a=t.heap_max+1;a<u;a++)m<(o=s[2*s[2*(n=t.heap[a])+1]+1]+1)&&(o=m,v++),s[2*n+1]=o,d<n||(t.bl_count[o]++,i=0,g<=n&&(i=p[n-g]),l=s[2*n],t.opt_len+=l*(o+i),h&&(t.static_len+=l*(c[2*n+1]+i)));if(0!==v){do{for(o=m-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[m]--,v-=2}while(0<v);for(o=m;0!==o;o--)for(n=t.bl_count[o];0!==n;)d<(r=t.heap[--a])||(s[2*r+1]!==o&&(t.opt_len+=(o-s[2*r+1])*s[2*r],s[2*r+1]=o),n--)}}(t,e),F(o,d,t.bl_count)}function X(t,e,a){var n,r,o=-1,i=e[1],l=0,s=7,d=4;for(0===i&&(s=138,d=3),e[2*(a+1)+1]=65535,n=0;n<=a;n++)r=i,i=e[2*(n+1)+1],++l<s&&r===i||(l<d?t.bl_tree[2*r]+=l:0!==r?(r!==o&&t.bl_tree[2*r]++,t.bl_tree[2*b]++):l<=10?t.bl_tree[2*y]++:t.bl_tree[2*M]++,o=r,d=(l=0)===i?(s=138,3):r===i?(s=6,3):(s=7,4))}function J(t,e,a){var n,r,o=-1,i=e[1],l=0,s=7,d=4;for(0===i&&(s=138,d=3),n=0;n<=a;n++)if(r=i,i=e[2*(n+1)+1],!(++l<s&&r===i)){if(l<d)for(;H(t,r,t.bl_tree),0!=--l;);else 0!==r?(r!==o&&(H(t,r,t.bl_tree),l--),H(t,b,t.bl_tree),W(t,l-3,2)):l<=10?(H(t,y,t.bl_tree),W(t,l-3,3)):(H(t,M,t.bl_tree),W(t,l-11,7));o=r,d=(l=0)===i?(s=138,3):r===i?(s=6,3):(s=7,4)}}i(z);var Y=!1;function Q(t,e,a,r){var o,i,s;W(t,(l<<1)+(r?1:0),3),i=e,s=a,G(o=t),P(o,s),P(o,~s),n.arraySet(o.pending_buf,o.window,i,s,o.pending),o.pending+=s}a._tr_init=function(t){Y||(function(){var t,e,a,n,r,o=new Array(f+1);for(n=a=0;n<s-1;n++)for(V[n]=a,t=0;t<1<<x[n];t++)k[a++]=n;for(k[a-1]=n,n=r=0;n<16;n++)for(z[n]=r,t=0;t<1<<w[n];t++)C[r++]=n;for(r>>=7;n<h;n++)for(z[n]=r<<7,t=0;t<1<<w[n]-7;t++)C[256+r++]=n;for(e=0;e<=f;e++)o[e]=0;for(t=0;t<=143;)I[2*t+1]=8,t++,o[8]++;for(;t<=255;)I[2*t+1]=9,t++,o[9]++;for(;t<=279;)I[2*t+1]=7,t++,o[7]++;for(;t<=287;)I[2*t+1]=8,t++,o[8]++;for(F(I,c+1,o),t=0;t<h;t++)T[2*t+1]=5,T[2*t]=U(t,5);E=new N(I,x,d+1,c,f),R=new N(T,w,0,h,f),L=new N(new Array(0),S,0,p,m)}(),Y=!0),t.l_desc=new q(t.dyn_ltree,E),t.d_desc=new q(t.dyn_dtree,R),t.bl_desc=new q(t.bl_tree,L),t.bi_buf=0,t.bi_valid=0,B(t)},a._tr_stored_block=Q,a._tr_flush_block=function(t,e,a,n){var i,l,s=0;0<t.level?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,a=4093624447;for(e=0;e<=31;e++,a>>>=1)if(1&a&&0!==t.dyn_ltree[2*e])return r;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return o;for(e=32;e<d;e++)if(0!==t.dyn_ltree[2*e])return o;return r}(t)),j(t,t.l_desc),j(t,t.d_desc),s=function(t){var e;for(X(t,t.dyn_ltree,t.l_desc.max_code),X(t,t.dyn_dtree,t.d_desc.max_code),j(t,t.bl_desc),e=p-1;3<=e&&0===t.bl_tree[2*A[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),i=t.opt_len+3+7>>>3,(l=t.static_len+3+7>>>3)<=i&&(i=l)):i=l=a+5,a+4<=i&&-1!==e?Q(t,e,a,n):4===t.strategy||l===i?(W(t,2+(n?1:0),3),D(t,I,T)):(W(t,4+(n?1:0),3),function(t,e,a,n){var r;for(W(t,e-257,5),W(t,a-1,5),W(t,n-4,4),r=0;r<n;r++)W(t,t.bl_tree[2*A[r]+1],3);J(t,t.dyn_ltree,e-1),J(t,t.dyn_dtree,a-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),D(t,t.dyn_ltree,t.dyn_dtree)),B(t),n&&G(t)},a._tr_tally=function(t,e,a){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&a,t.last_lit++,0===e?t.dyn_ltree[2*a]++:(t.matches++,e--,t.dyn_ltree[2*(k[a]+d+1)]++,t.dyn_dtree[2*O(e)]++),t.last_lit===t.lit_bufsize-1},a._tr_align=function(t){var e;W(t,2,3),H(t,v,I),16===(e=t).bi_valid?(P(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":41}],53:[function(t,e,a){e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,e,a){(function(t){!function(t,e){if(!t.setImmediate){var a,n,r,o,i=1,l={},s=!1,d=t.document,c=Object.getPrototypeOf&&Object.getPrototypeOf(t);c=c&&c.setTimeout?c:t,a="[object process]"==={}.toString.call(t.process)?function(t){process.nextTick(function(){p(t)})}:function(){if(t.postMessage&&!t.importScripts){var e=!0,a=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=a,e}}()?(o="setImmediate$"+Math.random()+"$",t.addEventListener?t.addEventListener("message",u,!1):t.attachEvent("onmessage",u),function(e){t.postMessage(o+e,"*")}):t.MessageChannel?((r=new MessageChannel).port1.onmessage=function(t){p(t.data)},function(t){r.port2.postMessage(t)}):d&&"onreadystatechange"in d.createElement("script")?(n=d.documentElement,function(t){var e=d.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,n.removeChild(e),e=null},n.appendChild(e)}):function(t){setTimeout(p,0,t)},c.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var r={callback:t,args:e};return l[i]=r,a(i),i++},c.clearImmediate=h}function h(t){delete l[t]}function p(t){if(s)setTimeout(p,0,t);else{var a=l[t];if(a){s=!0;try{!function(t){var a=t.callback,n=t.args;switch(n.length){case 0:a();break;case 1:a(n[0]);break;case 2:a(n[0],n[1]);break;case 3:a(n[0],n[1],n[2]);break;default:a.apply(e,n)}}(a)}finally{h(t),s=!1}}}}function u(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(o)&&p(+e.data.slice(o.length))}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,void 0!==Sn?Sn:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10);const Qp=An(Yp.exports);var _p={};function $p(t,e){return void 0===e&&(e=Object),e&&"function"==typeof e.getOwnPropertyDescriptors&&(t=e.create(null,e.getOwnPropertyDescriptors(t))),e&&"function"==typeof e.freeze?e.freeze(t):t}function tu(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var eu=$p({allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0});var au=$p({area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});var nu=$p({script:!1,style:!1,textarea:!0,title:!0});function ru(t){return t===ou.HTML}var ou=$p({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),iu=Object.keys(ou).map(function(t){return ou[t]});var lu=$p({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});_p.assign=function(t,e){if(null===t||"object"!=typeof t)throw new TypeError("target is not an object");for(var a in e)tu(e,a)&&(t[a]=e[a]);return t},_p.find=function(t,e,a){if(void 0===a&&(a=Array.prototype),t&&"function"==typeof a.find)return a.find.call(t,e);for(var n=0;n<t.length;n++)if(tu(t,n)){var r=t[n];if(e.call(void 0,r,n,t))return r}},_p.freeze=$p,_p.HTML_BOOLEAN_ATTRIBUTES=eu,_p.HTML_RAW_TEXT_ELEMENTS=nu,_p.HTML_VOID_ELEMENTS=au,_p.hasDefaultHTMLNamespace=function(t){return ru(t)||t===ou.XML_XHTML_APPLICATION},_p.hasOwn=tu,_p.isHTMLBooleanAttribute=function(t){return tu(eu,t.toLowerCase())},_p.isHTMLRawTextElement=function(t){var e=t.toLowerCase();return tu(nu,e)&&!nu[e]},_p.isHTMLEscapableRawTextElement=function(t){var e=t.toLowerCase();return tu(nu,e)&&nu[e]},_p.isHTMLMimeType=ru,_p.isHTMLVoidElement=function(t){return tu(au,t.toLowerCase())},_p.isValidMimeType=function(t){return iu.indexOf(t)>-1},_p.MIME_TYPE=ou,_p.NAMESPACE=lu;var su={};function du(t,e){t.prototype=Object.create(Error.prototype,{constructor:{value:t},name:{value:t.name,enumerable:!0,writable:e}})}var cu=_p.freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),hu=Object.keys(cu);function pu(t){return"number"==typeof t&&t>=1&&t<=25}function uu(t,e){var a;pu(t)?(this.name=hu[t],this.message=e||""):(this.message=t,this.name="string"==typeof(a=e)&&a.substring(a.length-cu.Error.length)===cu.Error?e:cu.Error),Error.captureStackTrace&&Error.captureStackTrace(this,uu)}du(uu,!0),Object.defineProperties(uu.prototype,{code:{enumerable:!0,get:function(){var t=hu.indexOf(this.name);return pu(t)?t:0}}});for(var fu={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},gu=Object.entries(fu),mu=0;mu<gu.length;mu++){uu[gu[mu][0]]=gu[mu][1]}function vu(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,vu)}du(vu),su.DOMException=uu,su.DOMExceptionName=cu,su.ExceptionCode=fu,su.ParseError=vu;var bu={},yu={};function Mu(t){try{"function"!=typeof t&&(t=RegExp);var e=new t("𝌆","u").exec("𝌆");return!!e&&2===e[0].length}catch(a){}return!1}var xu=Mu();function wu(t){if("["!==t.source[0])throw new Error(t+" can not be used with chars");return t.source.slice(1,t.source.lastIndexOf("]"))}function Su(t,e){if("["!==t.source[0])throw new Error("/"+t.source+"/ can not be used with chars_without");if(!e||"string"!=typeof e)throw new Error(JSON.stringify(e)+" is not a valid search");if(-1===t.source.indexOf(e))throw new Error('"'+e+'" is not is /'+t.source+"/");if("-"===e&&1!==t.source.indexOf(e))throw new Error('"'+e+'" is not at the first postion of /'+t.source+"/");return new RegExp(t.source.replace(e,""),xu?"u":"")}function Au(t){var e=this;return new RegExp(Array.prototype.slice.call(arguments).map(function(t){var a="string"==typeof t;if(a&&void 0===e&&"|"===t)throw new Error("use regg instead of reg to wrap expressions with `|`!");return a?t:t.source}).join(""),xu?"mu":"m")}function Iu(t){if(0===arguments.length)throw new Error("no parameters provided");return Au.apply(Iu,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var Tu=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;xu&&(Tu=Au("[",wu(Tu),"\\u{10000}-\\u{10FFFF}","]"));var Cu=new RegExp("[^"+wu(Tu)+"]",xu?"u":""),ku=/[\x20\x09\x0D\x0A]/,Vu=wu(ku),Eu=Au(ku,"+"),Ru=Au(ku,"*"),Lu=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;xu&&(Lu=Au("[",wu(Lu),"\\u{10000}-\\u{10FFFF}","]"));var zu=Au("[",wu(Lu),wu(/[-.0-9\xB7]/),wu(/[\u0300-\u036F\u203F-\u2040]/),"]"),Nu=Au(Lu,zu,"*"),qu=Au(zu,"+"),Ou=Au("&",Nu,";"),Pu=Iu(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),Wu=Iu(Ou,"|",Pu),Hu=Au("%",Nu,";"),Uu=Iu(Au('"',Iu(/[^%&"]/,"|",Hu,"|",Wu),"*",'"'),"|",Au("'",Iu(/[^%&']/,"|",Hu,"|",Wu),"*","'")),Fu=Iu('"',Iu(/[^<&"]/,"|",Wu),"*",'"',"|","'",Iu(/[^<&']/,"|",Wu),"*","'"),Bu=Au(Su(Lu,":"),Su(zu,":"),"*"),Gu=Au(Bu,Iu(":",Bu),"?"),Zu=Au("^",Gu,"$"),Ku=Au("(",Gu,")"),Du=Iu(/"[^"]*"|'[^']*'/),ju=Au(/^<\?/,"(",Nu,")",Iu(Eu,"(",Tu,"*?)"),"?",/\?>/),Xu=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,Ju=Iu('"',Xu,'*"',"|","'",Su(Xu,"'"),"*'"),Yu="\x3c!--",Qu=Au(Yu,Iu(Su(Tu,"-"),"|",Au("-",Su(Tu,"-"))),"*","--\x3e"),_u="#PCDATA",$u=Iu(Au(/\(/,Ru,_u,Iu(Ru,/\|/,Ru,Gu),"*",Ru,/\)\*/),"|",Au(/\(/,Ru,_u,Ru,/\)/)),tf=Iu("EMPTY","|","ANY","|",$u,"|",Au(/\([^>]+\)/,/[?*+]?/)),ef=Au("<!ELEMENT",Eu,Iu(Gu,"|",Hu),Eu,Iu(tf,"|",Hu),Ru,">"),af=Au("NOTATION",Eu,/\(/,Ru,Nu,Iu(Ru,/\|/,Ru,Nu),"*",Ru,/\)/),nf=Au(/\(/,Ru,qu,Iu(Ru,/\|/,Ru,qu),"*",Ru,/\)/),rf=Iu(af,"|",nf),of=Iu(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",rf),lf=Iu(/#REQUIRED|#IMPLIED/,"|",Iu(Iu("#FIXED",Eu),"?",Fu)),sf=Au("<!ATTLIST",Eu,Nu,Iu(Eu,Nu,Eu,of,Eu,lf),"*",Ru,">"),df="about:legacy-compat",cf=Iu('"'+df+'"',"|","'"+df+"'"),hf="SYSTEM",pf="PUBLIC",uf=Iu(Iu(hf,Eu,Du),"|",Iu(pf,Eu,Ju,Eu,Du)),ff=Au("^",Iu(Iu(hf,Eu,"(?<SystemLiteralOnly>",Du,")"),"|",Iu(pf,Eu,"(?<PubidLiteral>",Ju,")",Eu,"(?<SystemLiteral>",Du,")"))),gf=Au("^",Ju,"$"),mf=Au("^",Du,"$"),vf=Iu(Eu,"NDATA",Eu,Nu),bf="<!ENTITY",yf=Au(bf,Eu,Nu,Eu,Iu(Uu,"|",Iu(uf,vf,"?")),Ru,">"),Mf=Iu(Uu,"|",uf),xf=Iu(yf,"|",Au(bf,Eu,"%",Eu,Nu,Eu,Mf,Ru,">")),wf=Au(pf,Eu,Ju),Sf=Au("<!NOTATION",Eu,Nu,Eu,Iu(uf,"|",wf),Ru,">"),Af=Au(Ru,"=",Ru),If=/1[.]\d+/,Tf=Au(Eu,"version",Af,Iu("'",If,"'","|",'"',If,'"')),Cf=/[A-Za-z][-A-Za-z0-9._]*/,kf=Au(/^<\?xml/,Tf,Iu(Eu,"encoding",Af,Iu('"',Cf,'"',"|","'",Cf,"'")),"?",Iu(Eu,"standalone",Af,Iu("'",Iu("yes","|","no"),"'","|",'"',Iu("yes","|","no"),'"')),"?",Ru,/\?>/),Vf=Au(Tu,"*?",/\]\]>/),Ef=Au(/<!\[CDATA\[/,Vf);yu.chars=wu,yu.chars_without=Su,yu.detectUnicodeSupport=Mu,yu.reg=Au,yu.regg=Iu,yu.ABOUT_LEGACY_COMPAT=df,yu.ABOUT_LEGACY_COMPAT_SystemLiteral=cf,yu.AttlistDecl=sf,yu.CDATA_START="<![CDATA[",yu.CDATA_END="]]>",yu.CDSect=Ef,yu.Char=Tu,yu.Comment=Qu,yu.COMMENT_START=Yu,yu.COMMENT_END="--\x3e",yu.DOCTYPE_DECL_START="<!DOCTYPE",yu.elementdecl=ef,yu.EntityDecl=xf,yu.EntityValue=Uu,yu.ExternalID=uf,yu.ExternalID_match=ff,yu.Name=Nu,yu.NotationDecl=Sf,yu.Reference=Wu,yu.PEReference=Hu,yu.PI=ju,yu.PUBLIC=pf,yu.PubidLiteral=Ju,yu.PubidLiteral_match=gf,yu.QName=Gu,yu.QName_exact=Zu,yu.QName_group=Ku,yu.S=Eu,yu.SChar_s=Vu,yu.S_OPT=Ru,yu.SYSTEM=hf,yu.SystemLiteral=Du,yu.SystemLiteral_match=mf,yu.InvalidChar=Cu,yu.UNICODE_REPLACEMENT_CHARACTER="�",yu.UNICODE_SUPPORT=xu,yu.XMLDecl=kf;var Rf=_p,Lf=Rf.find,zf=Rf.hasDefaultHTMLNamespace,Nf=Rf.hasOwn,qf=Rf.isHTMLMimeType,Of=Rf.isHTMLRawTextElement,Pf=Rf.isHTMLVoidElement,Wf=Rf.MIME_TYPE,Hf=Rf.NAMESPACE,Uf=Symbol(),Ff=su,Bf=Ff.DOMException,Gf=Ff.DOMExceptionName,Zf=yu;function Kf(t){if(t!==Uf)throw new TypeError("Illegal constructor")}function Df(t){return""!==t}function jf(t,e){return Nf(t,e)||(t[e]=!0),t}function Xf(t){if(!t)return[];var e=function(t){return t?t.split(/[\t\n\f\r ]+/).filter(Df):[]}(t);return Object.keys(e.reduce(jf,{}))}function Jf(t){if(!Zf.QName_exact.test(t))throw new Bf(Bf.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+t+'"')}function Yf(t,e){Jf(e),t=t||null;var a=null,n=e;if(e.indexOf(":")>=0){var r=e.split(":");a=r[0],n=r[1]}if(null!==a&&null===t)throw new Bf(Bf.NAMESPACE_ERR,"prefix is non-null and namespace is null");if("xml"===a&&t!==Rf.NAMESPACE.XML)throw new Bf(Bf.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if(("xmlns"===a||"xmlns"===e)&&t!==Rf.NAMESPACE.XMLNS)throw new Bf(Bf.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(t===Rf.NAMESPACE.XMLNS&&"xmlns"!==a&&"xmlns"!==e)throw new Bf(Bf.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[t,a,n]}function Qf(t,e){for(var a in t)Nf(t,a)&&(e[a]=t[a])}function _f(t,e){var a=t.prototype;if(!(a instanceof e)){let n=function(){};n.prototype=e.prototype,n=new n,Qf(a,n),t.prototype=a=n}a.constructor!=t&&("function"!=typeof t&&console.error("unknown Class:"+t),a.constructor=t)}var $f={},tg=$f.ELEMENT_NODE=1,eg=$f.ATTRIBUTE_NODE=2,ag=$f.TEXT_NODE=3,ng=$f.CDATA_SECTION_NODE=4,rg=$f.ENTITY_REFERENCE_NODE=5,og=$f.ENTITY_NODE=6,ig=$f.PROCESSING_INSTRUCTION_NODE=7,lg=$f.COMMENT_NODE=8,sg=$f.DOCUMENT_NODE=9,dg=$f.DOCUMENT_TYPE_NODE=10,cg=$f.DOCUMENT_FRAGMENT_NODE=11,hg=$f.NOTATION_NODE=12,pg=Rf.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function ug(t,e){if(e.length<t.length)return ug(e,t);var a=null;for(var n in t){if(t[n]!==e[n])return a;a=t[n]}return a}function fg(t){return t.guid||(t.guid=Math.random()),t.guid}function gg(){}function mg(t,e){this._node=t,this._refresh=e,vg(this)}function vg(t){var e=t._node._inc||t._node.ownerDocument._inc;if(t._inc!==e){var a=t._refresh(t._node);if(rm(t,"length",a.length),!t.$$length||a.length<t.$$length)for(var n=a.length;n in t;n++)Nf(t,n)&&delete t[n];Qf(a,t),t._inc=e}}function bg(){}function yg(t,e){for(var a=0;a<t.length;){if(t[a]===e)return a;a++}}function Mg(t,e,a,n){if(n?e[yg(e,n)]=a:(e[e.length]=a,e.length++),t){a.ownerElement=t;var r=t.ownerDocument;r&&(n&&kg(r,t,n),function(t,e,a){t&&t._inc++;var n=a.namespaceURI;n===Hf.XMLNS&&(e._nsMap[a.prefix?a.localName:""]=a.value)}(r,t,a))}}function xg(t,e,a){var n=yg(e,a);if(n>=0){for(var r=e.length-1;n<=r;)e[n]=e[++n];if(e.length=r,t){var o=t.ownerDocument;o&&kg(o,t,a),a.ownerElement=null}}}function wg(){}function Sg(t){Kf(t)}function Ag(t){return("<"==t?"<":">"==t&&">")||"&"==t&&"&"||'"'==t&&"""||"&#"+t.charCodeAt()+";"}function Ig(t,e){Tg(t,null,{enter:function(t){return!e(t)||Tg.STOP}})}function Tg(t,e,a){for(var n=[{node:t,context:e,phase:Tg.ENTER}];n.length>0;){var r=n.pop();if(r.phase===Tg.ENTER){var o=a.enter(r.node,r.context);if(o===Tg.STOP)return Tg.STOP;if(n.push({node:r.node,context:o,phase:Tg.EXIT}),null==o)continue;for(var i=r.node.lastChild;i;)n.push({node:i,context:o,phase:Tg.ENTER}),i=i.previousSibling}else a.exit&&a.exit(r.node,r.context)}}function Cg(t,e){Kf(t);var a=e||{};this.ownerDocument=this,this.contentType=a.contentType||Wf.XML_APPLICATION,this.type=qf(this.contentType)?"html":"xml"}function kg(t,e,a,n){t&&t._inc++,a.namespaceURI===Hf.XMLNS&&delete e._nsMap[a.prefix?a.localName:""]}function Vg(t,e,a){if(t&&t._inc){t._inc++;var n=e.childNodes;if(a&&!a.nextSibling)n[n.length++]=a;else{for(var r=e.firstChild,o=0;r;)n[o++]=r,r=r.nextSibling;n.length=o,delete n[n.length]}}}function Eg(t,e){if(t!==e.parentNode)throw new Bf(Bf.NOT_FOUND_ERR,"child's parent is not parent");var a=e.previousSibling,n=e.nextSibling;return a?a.nextSibling=n:t.firstChild=n,n?n.previousSibling=a:t.lastChild=a,Vg(t.ownerDocument,t),e.parentNode=null,e.previousSibling=null,e.nextSibling=null,e}function Rg(t){return t&&t.nodeType===Sg.DOCUMENT_TYPE_NODE}function Lg(t){return t&&t.nodeType===Sg.ELEMENT_NODE}function zg(t){return t&&t.nodeType===Sg.TEXT_NODE}function Ng(t,e){var a=t.childNodes||[];if(Lf(a,Lg)||Rg(e))return!1;var n=Lf(a,Rg);return!(e&&n&&a.indexOf(n)>a.indexOf(e))}function qg(t,e){var a=t.childNodes||[];if(Lf(a,function(t){return Lg(t)&&t!==e}))return!1;var n=Lf(a,Rg);return!(e&&n&&a.indexOf(n)>a.indexOf(e))}function Og(t,e,a){if(!function(t){return t&&(t.nodeType===Sg.DOCUMENT_NODE||t.nodeType===Sg.DOCUMENT_FRAGMENT_NODE||t.nodeType===Sg.ELEMENT_NODE)}(t))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+t.nodeType);if(a&&a.parentNode!==t)throw new Bf(Bf.NOT_FOUND_ERR,"child not in parent");if(!function(t){return t&&(t.nodeType===Sg.CDATA_SECTION_NODE||t.nodeType===Sg.COMMENT_NODE||t.nodeType===Sg.DOCUMENT_FRAGMENT_NODE||t.nodeType===Sg.DOCUMENT_TYPE_NODE||t.nodeType===Sg.ELEMENT_NODE||t.nodeType===Sg.PROCESSING_INSTRUCTION_NODE||t.nodeType===Sg.TEXT_NODE)}(e)||Rg(e)&&t.nodeType!==Sg.DOCUMENT_NODE)throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function Pg(t,e,a){var n=t.childNodes||[],r=e.childNodes||[];if(e.nodeType===Sg.DOCUMENT_FRAGMENT_NODE){var o=r.filter(Lg);if(o.length>1||Lf(r,zg))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(1===o.length&&!Ng(t,a))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(Lg(e)&&!Ng(t,a))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Rg(e)){if(Lf(n,Rg))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var i=Lf(n,Lg);if(a&&n.indexOf(i)<n.indexOf(a))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!a&&i)throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}function Wg(t,e,a){var n=t.childNodes||[],r=e.childNodes||[];if(e.nodeType===Sg.DOCUMENT_FRAGMENT_NODE){var o=r.filter(Lg);if(o.length>1||Lf(r,zg))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(1===o.length&&!qg(t,a))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(Lg(e)&&!qg(t,a))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Rg(e)){if(Lf(n,function(t){return Rg(t)&&t!==a}))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var i=Lf(n,Lg);if(a&&n.indexOf(i)<n.indexOf(a))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}function Hg(t,e,a,n){Og(t,e,a),t.nodeType===Sg.DOCUMENT_NODE&&(n||Pg)(t,e,a);var r=e.parentNode;if(r&&r.removeChild(e),e.nodeType===cg){var o=e.firstChild;if(null==o)return e;var i=e.lastChild}else o=i=e;var l=a?a.previousSibling:t.lastChild;o.previousSibling=l,i.nextSibling=a,l?l.nextSibling=o:t.firstChild=o,null==a?t.lastChild=i:a.previousSibling=i;do{o.parentNode=t}while(o!==i&&(o=o.nextSibling));return Vg(t.ownerDocument||t,t,e),e.nodeType==cg&&(e.firstChild=e.lastChild=null),e}function Ug(t){Kf(t),this._nsMap=Object.create(null)}function Fg(t){Kf(t),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}function Bg(t){Kf(t)}function Gg(t){Kf(t)}function Zg(t){Kf(t)}function Kg(t){Kf(t)}function Dg(t){Kf(t)}function jg(t){Kf(t)}function Xg(t){Kf(t)}function Jg(t){Kf(t)}function Yg(t){Kf(t)}function Qg(t){Kf(t)}function _g(){}function $g(t){var e;e="function"==typeof t?{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:t}:null!=t?{requireWellFormed:!!t.requireWellFormed,splitCDATASections:!1!==t.splitCDATASections,nodeFilter:t.nodeFilter||null}:{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};var a=[],n=this.nodeType===sg&&this.documentElement||this,r=n.prefix,o=n.namespaceURI;if(o&&null==r&&null==(r=n.lookupPrefix(o)))var i=[{namespace:o,prefix:null}];return am(this,a,i,e),a.join("")}function tm(t,e,a){var n=t.prefix||"",r=t.namespaceURI;if(!r)return!1;if("xml"===n&&r===Hf.XML||r===Hf.XMLNS)return!1;for(var o=a.length;o--;){var i=a[o];if(i.prefix===n)return i.namespace!==r}return!0}function em(t,e,a){t.push(" ",e,'="',a.replace(/[<>&"\t\n\r]/g,Ag),'"')}function am(t,e,a,n){a||(a=[]);var r=n.nodeFilter,o=n.requireWellFormed,i=n.splitCDATASections,l="html"===(t.nodeType===sg?t:t.ownerDocument).type;Tg(t,{ns:a},{enter:function(t,a){var s=a.ns;if(r){if(!(t=r(t)))return null;if("string"==typeof t)return e.push(t),null}switch(t.nodeType){case tg:var d=t.attributes,c=d.length,h=t.tagName,p=h;if(!l&&!t.prefix&&t.namespaceURI){for(var u,f=0;f<d.length;f++)if("xmlns"===d.item(f).name){u=d.item(f).value;break}if(!u)for(var g=s.length-1;g>=0;g--){if(""===(m=s[g]).prefix&&m.namespace===t.namespaceURI){u=m.namespace;break}}if(u!==t.namespaceURI)for(g=s.length-1;g>=0;g--){var m;if((m=s[g]).namespace===t.namespaceURI){m.prefix&&(p=m.prefix+":"+h);break}}}e.push("<",p);for(var v=s.slice(),b=0;b<c;b++){"xmlns"==(y=d.item(b)).prefix?v.push({prefix:y.localName,namespace:y.value}):"xmlns"==y.nodeName&&v.push({prefix:"",namespace:y.value})}for(b=0;b<c;b++){var y;if(tm(y=d.item(b),0,v)){var M=y.prefix||"",x=y.namespaceURI;em(e,M?"xmlns:"+M:"xmlns",x),v.push({prefix:M,namespace:x})}var w=r?r(y):y;w&&("string"==typeof w?e.push(w):em(e,w.name,w.value))}if(h===p&&tm(t,0,v)){var S=t.prefix||"";x=t.namespaceURI;em(e,S?"xmlns:"+S:"xmlns",x),v.push({prefix:S,namespace:x})}var A=!t.firstChild;if(A&&(l||t.namespaceURI===Hf.HTML)&&(A=Pf(h)),A)return e.push("/>"),null;if(e.push(">"),l&&Of(h)){for(var I=t.firstChild;I;)I.data?e.push(I.data):am(I,e,v.slice(),n),I=I.nextSibling;return e.push("</",p,">"),null}return{ns:v,tag:p};case sg:case cg:if(o&&t.nodeType===sg&&null==t.documentElement)throw new Bf("The Document has no documentElement",Gf.InvalidStateError);return{ns:s};case eg:return em(e,t.name,t.value),null;case ag:if(o&&Zf.InvalidChar.test(t.data))throw new Bf("The Text node data contains characters outside the XML Char production",Gf.InvalidStateError);return e.push(t.data.replace(/[<&>]/g,Ag)),null;case ng:if(o&&-1!==t.data.indexOf("]]>"))throw new Bf('The CDATASection data contains "]]>"',Gf.InvalidStateError);return i?e.push(Zf.CDATA_START,t.data.replace(/]]>/g,"]]]]><![CDATA[>"),Zf.CDATA_END):e.push(Zf.CDATA_START,t.data,Zf.CDATA_END),null;case lg:if(o){if(Zf.InvalidChar.test(t.data))throw new Bf("The comment node data contains characters outside the XML Char production",Gf.InvalidStateError);if(-1!==t.data.indexOf("--")||"-"===t.data[t.data.length-1])throw new Bf('The comment node data contains "--" or ends with "-"',Gf.InvalidStateError)}return e.push(Zf.COMMENT_START,t.data,Zf.COMMENT_END),null;case dg:var T=t.publicId,C=t.systemId;if(o){if(T&&!Zf.PubidLiteral_match.test(T))throw new Bf("DocumentType publicId is not a valid PubidLiteral",Gf.InvalidStateError);if(C&&"."!==C&&!Zf.SystemLiteral_match.test(C))throw new Bf("DocumentType systemId is not a valid SystemLiteral",Gf.InvalidStateError);if(t.internalSubset&&-1!==t.internalSubset.indexOf("]>"))throw new Bf('DocumentType internalSubset contains "]>"',Gf.InvalidStateError)}return e.push(Zf.DOCTYPE_DECL_START," ",t.name),T?(e.push(" ",Zf.PUBLIC," ",T),C&&"."!==C&&e.push(" ",C)):C&&"."!==C&&e.push(" ",Zf.SYSTEM," ",C),t.internalSubset&&e.push(" [",t.internalSubset,"]"),e.push(">"),null;case ig:if(o){if(-1!==t.target.indexOf(":")||"xml"===t.target.toLowerCase())throw new Bf("The ProcessingInstruction target is not well-formed",Gf.InvalidStateError);if(Zf.InvalidChar.test(t.data))throw new Bf("The ProcessingInstruction data contains characters outside the XML Char production",Gf.InvalidStateError);if(-1!==t.data.indexOf("?>"))throw new Bf('The ProcessingInstruction data contains "?>"',Gf.InvalidStateError)}return e.push("<?",t.target," ",t.data,"?>"),null;case rg:return e.push("&",t.nodeName,";"),null;default:return e.push("??",t.nodeName),null}},exit:function(t,a){a&&a.tag&&e.push("</",a.tag,">")}})}function nm(t,e,a){var n;return Tg(e,null,{enter:function(e,r){var o=new e.constructor(Uf);for(var i in e)if(Nf(e,i)){var l=e[i];"object"!=typeof l&&l!=o[i]&&(o[i]=l)}e.childNodes&&(o.childNodes=new gg),o.ownerDocument=t;var s=a;switch(o.nodeType){case tg:var d=e.attributes,c=o.attributes=new bg,h=d.length;c._ownerElement=o;for(var p=0;p<h;p++)o.setAttributeNode(nm(t,d.item(p),!0));break;case eg:s=!0}return null!==r?r.appendChild(o):n=o,s?o:null}}),n}function rm(t,e,a){t[e]=a}function om(t){for(var e=[],a=t.firstChild;a;)a.nodeType===tg&&e.push(a),a=a.nextSibling;return e}gg.prototype={length:0,item:function(t){return t>=0&&t<this.length?this[t]:null},toString:function(t){var e;e="function"==typeof t?{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:t}:t?{requireWellFormed:!!t.requireWellFormed,splitCDATASections:!1!==t.splitCDATASections,nodeFilter:t.nodeFilter||null}:{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};for(var a=[],n=0;n<this.length;n++)am(this[n],a,null,e);return a.join("")},filter:function(t){return Array.prototype.filter.call(this,t)},indexOf:function(t){return Array.prototype.indexOf.call(this,t)}},gg.prototype[Symbol.iterator]=function(){var t=this,e=0;return{next:function(){return e<t.length?{value:t[e++],done:!1}:{done:!0}},return:function(){return{done:!0}}}},mg.prototype.item=function(t){return vg(this),this[t]||null},_f(mg,gg),bg.prototype={length:0,item:gg.prototype.item,getNamedItem:function(t){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(t=t.toLowerCase());for(var e=0;e<this.length;){var a=this[e];if(a.nodeName===t)return a;e++}return null},setNamedItem:function(t){var e=t.ownerElement;if(e&&e!==this._ownerElement)throw new Bf(Bf.INUSE_ATTRIBUTE_ERR);var a=this.getNamedItemNS(t.namespaceURI,t.localName);return a===t?t:(Mg(this._ownerElement,this,t,a),a)},setNamedItemNS:function(t){return this.setNamedItem(t)},removeNamedItem:function(t){var e=this.getNamedItem(t);if(!e)throw new Bf(Bf.NOT_FOUND_ERR,t);return xg(this._ownerElement,this,e),e},removeNamedItemNS:function(t,e){var a=this.getNamedItemNS(t,e);if(!a)throw new Bf(Bf.NOT_FOUND_ERR,t?t+" : "+e:e);return xg(this._ownerElement,this,a),a},getNamedItemNS:function(t,e){t||(t=null);for(var a=0;a<this.length;){var n=this[a];if(n.localName===e&&n.namespaceURI===t)return n;a++}return null}},bg.prototype[Symbol.iterator]=function(){var t=this,e=0;return{next:function(){return e<t.length?{value:t[e++],done:!1}:{done:!0}},return:function(){return{done:!0}}}},wg.prototype={hasFeature:function(t,e){return!0},createDocument:function(t,e,a){var n=Wf.XML_APPLICATION;t===Hf.HTML?n=Wf.XML_XHTML_APPLICATION:t===Hf.SVG&&(n=Wf.XML_SVG_IMAGE);var r=new Cg(Uf,{contentType:n});if(r.implementation=this,r.childNodes=new gg,r.doctype=a||null,a&&r.appendChild(a),e){var o=r.createElementNS(t,e);r.appendChild(o)}return r},createDocumentType:function(t,e,a,n){Jf(t);var r=new Dg(Uf);return r.name=t,r.nodeName=t,r.publicId=e||"",r.systemId=a||"",r.internalSubset=n||"",r.childNodes=new gg,r},createHTMLDocument:function(t){var e=new Cg(Uf,{contentType:Wf.HTML});if(e.implementation=this,e.childNodes=new gg,!1!==t){e.doctype=this.createDocumentType("html"),e.doctype.ownerDocument=e,e.appendChild(e.doctype);var a=e.createElement("html");e.appendChild(a);var n=e.createElement("head");if(a.appendChild(n),"string"==typeof t){var r=e.createElement("title");r.appendChild(e.createTextNode(t)),n.appendChild(r)}a.appendChild(e.createElement("body"))}return e}},Sg.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:"about:blank",get isConnected(){var t=this.getRootNode();return t&&t.nodeType===t.DOCUMENT_NODE},contains:function(t){if(!t)return!1;var e=t;do{if(this===e)return!0;e=e.parentNode}while(e);return!1},getRootNode:function(t){var e=this;do{if(!e.parentNode)return e;e=e.parentNode}while(e)},isEqualNode:function(t){if(!t)return!1;for(var e=[{node:this,other:t}];e.length>0;){var a=e.pop(),n=a.node,r=a.other;if(n.nodeType!==r.nodeType)return!1;switch(n.nodeType){case n.DOCUMENT_TYPE_NODE:if(n.name!==r.name)return!1;if(n.publicId!==r.publicId)return!1;if(n.systemId!==r.systemId)return!1;break;case n.ELEMENT_NODE:if(n.namespaceURI!==r.namespaceURI)return!1;if(n.prefix!==r.prefix)return!1;if(n.localName!==r.localName)return!1;if(n.attributes.length!==r.attributes.length)return!1;for(var o=0;o<n.attributes.length;o++){var i=n.attributes.item(o),l=r.getAttributeNodeNS(i.namespaceURI,i.localName);if(!l)return!1;e.push({node:i,other:l})}break;case n.ATTRIBUTE_NODE:if(n.namespaceURI!==r.namespaceURI)return!1;if(n.localName!==r.localName)return!1;if(n.value!==r.value)return!1;break;case n.PROCESSING_INSTRUCTION_NODE:if(n.target!==r.target||n.data!==r.data)return!1;break;case n.TEXT_NODE:case n.CDATA_SECTION_NODE:case n.COMMENT_NODE:if(n.data!==r.data)return!1}if(n.childNodes.length!==r.childNodes.length)return!1;for(o=n.childNodes.length-1;o>=0;o--)e.push({node:n.childNodes[o],other:r.childNodes[o]})}return!0},isSameNode:function(t){return this===t},insertBefore:function(t,e){return Hg(this,t,e)},replaceChild:function(t,e){Hg(this,t,e,Wg),e&&this.removeChild(e)},removeChild:function(t){return Eg(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(t){return nm(this.ownerDocument||this,this,t)},normalize:function(){Tg(this,null,{enter:function(t){for(var e=t.firstChild;e;){var a=e.nextSibling;null!==a&&a.nodeType===ag&&e.nodeType===ag?(t.removeChild(a),e.appendData(a.data)):e=a}return!0}})},isSupported:function(t,e){return this.ownerDocument.implementation.hasFeature(t,e)},lookupPrefix:function(t){for(var e=this;e;){var a=e._nsMap;if(a)for(var n in a)if(Nf(a,n)&&a[n]===t)return n;e=e.nodeType==eg?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var a=e._nsMap;if(a&&Nf(a,t))return a[t];e=e.nodeType==eg?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){return null==this.lookupPrefix(t)},compareDocumentPosition:function(t){if(this===t)return 0;var e=t,a=this,n=null,r=null;if(e instanceof Fg&&(e=(n=e).ownerElement),a instanceof Fg&&(a=(r=a).ownerElement,n&&e&&a===e))for(var o,i=0;o=a.attributes[i];i++){if(o===n)return pg.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+pg.DOCUMENT_POSITION_PRECEDING;if(o===r)return pg.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+pg.DOCUMENT_POSITION_FOLLOWING}if(!e||!a||a.ownerDocument!==e.ownerDocument)return pg.DOCUMENT_POSITION_DISCONNECTED+pg.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(fg(a.ownerDocument)>fg(e.ownerDocument)?pg.DOCUMENT_POSITION_FOLLOWING:pg.DOCUMENT_POSITION_PRECEDING);if(r&&e===a)return pg.DOCUMENT_POSITION_CONTAINS+pg.DOCUMENT_POSITION_PRECEDING;if(n&&e===a)return pg.DOCUMENT_POSITION_CONTAINED_BY+pg.DOCUMENT_POSITION_FOLLOWING;for(var l=[],s=e.parentNode;s;){if(!r&&s===a)return pg.DOCUMENT_POSITION_CONTAINED_BY+pg.DOCUMENT_POSITION_FOLLOWING;l.push(s),s=s.parentNode}l.reverse();for(var d=[],c=a.parentNode;c;){if(!n&&c===e)return pg.DOCUMENT_POSITION_CONTAINS+pg.DOCUMENT_POSITION_PRECEDING;d.push(c),c=c.parentNode}d.reverse();var h=ug(l,d);for(var p in h.childNodes){var u=h.childNodes[p];if(u===a)return pg.DOCUMENT_POSITION_FOLLOWING;if(u===e)return pg.DOCUMENT_POSITION_PRECEDING;if(d.indexOf(u)>=0)return pg.DOCUMENT_POSITION_FOLLOWING;if(l.indexOf(u)>=0)return pg.DOCUMENT_POSITION_PRECEDING}return 0}},Qf($f,Sg),Qf($f,Sg.prototype),Qf(pg,Sg),Qf(pg,Sg.prototype),Tg.STOP=Symbol("walkDOM.STOP"),Tg.ENTER=0,Tg.EXIT=1,Cg.prototype={implementation:null,nodeName:"#document",nodeType:sg,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType===cg){for(var a=t.firstChild;a;){var n=a.nextSibling;this.insertBefore(a,e),a=n}return t}return Hg(this,t,e),t.ownerDocument=this,null===this.documentElement&&t.nodeType===tg&&(this.documentElement=t),t},removeChild:function(t){var e=Eg(this,t);return e===this.documentElement&&(this.documentElement=null),e},replaceChild:function(t,e){Hg(this,t,e,Wg),t.ownerDocument=this,e&&this.removeChild(e),Lg(t)&&(this.documentElement=t)},importNode:function(t,e){return function(t,e,a){var n;return Tg(e,null,{enter:function(e,r){var o=e.cloneNode(!1);return o.ownerDocument=t,o.parentNode=null,null===r?n=o:r.appendChild(o),e.nodeType===eg||a?o:null}}),n}(this,t,e)},getElementById:function(t){var e=null;return Ig(this.documentElement,function(a){if(a.nodeType==tg&&a.getAttribute("id")==t)return e=a,!0}),e},createElement:function(t){var e=new Ug(Uf);return e.ownerDocument=this,"html"===this.type&&(t=t.toLowerCase()),zf(this.contentType)&&(e.namespaceURI=Hf.HTML),e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new gg,(e.attributes=new bg)._ownerElement=e,e},createDocumentFragment:function(){var t=new Yg(Uf);return t.ownerDocument=this,t.childNodes=new gg,t},createTextNode:function(t){var e=new Gg(Uf);return e.ownerDocument=this,e.childNodes=new gg,e.appendData(t),e},createComment:function(t){var e=new Zg(Uf);return e.ownerDocument=this,e.childNodes=new gg,e.appendData(t),e},createCDATASection:function(t){if(-1!==t.indexOf("]]>"))throw new Bf(Bf.INVALID_CHARACTER_ERR,'data contains "]]>"');var e=new Kg(Uf);return e.ownerDocument=this,e.childNodes=new gg,e.appendData(t),e},createProcessingInstruction:function(t,e){var a=new Qg(Uf);return a.ownerDocument=this,a.childNodes=new gg,a.nodeName=a.target=t,a.nodeValue=a.data=e,a},createAttribute:function(t){if(!Zf.QName_exact.test(t))throw new Bf(Bf.INVALID_CHARACTER_ERR,'invalid character in name "'+t+'"');return"html"===this.type&&(t=t.toLowerCase()),this._createAttribute(t)},_createAttribute:function(t){var e=new Fg(Uf);return e.ownerDocument=this,e.childNodes=new gg,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){if(!Zf.Name.test(t))throw new Bf(Bf.INVALID_CHARACTER_ERR,'not a valid xml name "'+t+'"');if("html"===this.type)throw new Bf("document is an html document",Gf.NotSupportedError);var e=new Jg(Uf);return e.ownerDocument=this,e.childNodes=new gg,e.nodeName=t,e},createElementNS:function(t,e){var a=Yf(t,e),n=new Ug(Uf),r=n.attributes=new bg;return n.childNodes=new gg,n.ownerDocument=this,n.nodeName=e,n.tagName=e,n.namespaceURI=a[0],n.prefix=a[1],n.localName=a[2],r._ownerElement=n,n},createAttributeNS:function(t,e){var a=Yf(t,e),n=new Fg(Uf);return n.ownerDocument=this,n.childNodes=new gg,n.nodeName=e,n.name=e,n.specified=!0,n.namespaceURI=a[0],n.prefix=a[1],n.localName=a[2],n}},_f(Cg,Sg),Ug.prototype={nodeType:tg,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return"html"===this.ownerDocument.type&&this.namespaceURI===Hf.HTML},hasAttributes:function(){return!(!this.attributes||!this.attributes.length)},hasAttribute:function(t){return!!this.getAttributeNode(t)},getAttribute:function(t){var e=this.getAttributeNode(t);return e?e.value:null},getAttributeNode:function(t){return this._isInHTMLDocumentAndNamespace()&&(t=t.toLowerCase()),this.attributes.getNamedItem(t)},setAttribute:function(t,e){this._isInHTMLDocumentAndNamespace()&&(t=t.toLowerCase());var a=this.getAttributeNode(t);a?a.value=a.nodeValue=""+e:((a=this.ownerDocument._createAttribute(t)).value=a.nodeValue=""+e,this.setAttributeNode(a))},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var a=this.getAttributeNodeNS(t,e);a&&this.removeAttributeNode(a)},hasAttributeNS:function(t,e){return null!=this.getAttributeNodeNS(t,e)},getAttributeNS:function(t,e){var a=this.getAttributeNodeNS(t,e);return a?a.value:null},setAttributeNS:function(t,e,a){var n=Yf(t,e)[2],r=this.getAttributeNodeNS(t,n);r?r.value=r.nodeValue=""+a:((r=this.ownerDocument.createAttributeNS(t,e)).value=r.nodeValue=""+a,this.setAttributeNode(r))},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByClassName:function(t){var e=Xf(t);return new mg(this,function(a){var n=[];return e.length>0&&Ig(a,function(r){if(r!==a&&r.nodeType===tg){var o=r.getAttribute("class");if(o){var i=t===o;if(!i){var l=Xf(o);i=e.every((s=l,function(t){return s&&-1!==s.indexOf(t)}))}i&&n.push(r)}}var s}),n})},getElementsByTagName:function(t){var e="html"===(this.nodeType===sg?this:this.ownerDocument).type,a=t.toLowerCase();return new mg(this,function(n){var r=[];return Ig(n,function(o){o!==n&&o.nodeType===tg&&(("*"===t||o.getQualifiedName()===(e&&o.namespaceURI===Hf.HTML?a:t))&&r.push(o))}),r})},getElementsByTagNameNS:function(t,e){return new mg(this,function(a){var n=[];return Ig(a,function(r){r===a||r.nodeType!==tg||"*"!==t&&r.namespaceURI!==t||"*"!==e&&r.localName!=e||n.push(r)}),n})}},Cg.prototype.getElementsByClassName=Ug.prototype.getElementsByClassName,Cg.prototype.getElementsByTagName=Ug.prototype.getElementsByTagName,Cg.prototype.getElementsByTagNameNS=Ug.prototype.getElementsByTagNameNS,_f(Ug,Sg),Fg.prototype.nodeType=eg,_f(Fg,Sg),Bg.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,a){a=this.data.substring(0,t)+a+this.data.substring(t+e),this.nodeValue=this.data=a,this.length=a.length}},_f(Bg,Sg),Gg.prototype={nodeName:"#text",nodeType:ag,splitText:function(t){var e=this.data,a=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var n=this.ownerDocument.createTextNode(a);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}},_f(Gg,Bg),Zg.prototype={nodeName:"#comment",nodeType:lg},_f(Zg,Bg),Kg.prototype={nodeName:"#cdata-section",nodeType:ng},_f(Kg,Gg),Dg.prototype.nodeType=dg,_f(Dg,Sg),jg.prototype.nodeType=hg,_f(jg,Sg),Xg.prototype.nodeType=og,_f(Xg,Sg),Jg.prototype.nodeType=rg,_f(Jg,Sg),Yg.prototype.nodeName="#document-fragment",Yg.prototype.nodeType=cg,_f(Yg,Sg),Qg.prototype.nodeType=ig,_f(Qg,Bg),_g.prototype.serializeToString=function(t,e){return $g.call(t,e)},Sg.prototype.toString=$g;try{Object.defineProperty&&(Object.defineProperty(mg.prototype,"length",{get:function(){return vg(this),this.$$length}}),Object.defineProperty(Sg.prototype,"textContent",{get:function(){if(this.nodeType===tg||this.nodeType===cg){var t=[];return Tg(this,null,{enter:function(e){return e.nodeType===tg||e.nodeType===cg||(e.nodeType===ig||e.nodeType===lg?null:void t.push(e.nodeValue))}}),t.join("")}return this.nodeValue},set:function(t){switch(this.nodeType){case tg:case cg:for(;this.firstChild;)this.removeChild(this.firstChild);(t||String(t))&&this.appendChild(this.ownerDocument.createTextNode(t));break;default:this.data=t,this.value=t,this.nodeValue=t}}}),Object.defineProperty(Ug.prototype,"children",{get:function(){return new mg(this,om)}}),Object.defineProperty(Cg.prototype,"children",{get:function(){return new mg(this,om)}}),Object.defineProperty(Yg.prototype,"children",{get:function(){return new mg(this,om)}}),rm=function(t,e,a){t["$$"+e]=a})}catch(rN){}bu._updateLiveList=vg,bu.Attr=Fg,bu.CDATASection=Kg,bu.CharacterData=Bg,bu.Comment=Zg,bu.Document=Cg,bu.DocumentFragment=Yg,bu.DocumentType=Dg,bu.DOMImplementation=wg,bu.Element=Ug,bu.Entity=Xg,bu.EntityReference=Jg,bu.LiveNodeList=mg,bu.NamedNodeMap=bg,bu.Node=Sg,bu.NodeList=gg,bu.Notation=jg,bu.Text=Gg,bu.ProcessingInstruction=Qg,bu.walkDOM=Tg,bu.XMLSerializer=_g;var im,lm,sm={},dm={};im=dm,lm=_p.freeze,im.XML_ENTITIES=lm({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),im.HTML_ENTITIES=lm({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),im.entityMap=im.HTML_ENTITIES;var cm={},hm=_p,pm=yu,um=su,fm=hm.isHTMLEscapableRawTextElement,gm=hm.isHTMLMimeType,mm=hm.isHTMLRawTextElement,vm=hm.hasOwn,bm=hm.NAMESPACE,ym=um.ParseError,Mm=um.DOMException;function xm(){}xm.prototype={parse:function(t,e,a){var n=this.domBuilder;n.startDocument(),Cm(e,e=Object.create(null)),function(t,e,a,n,r){var o=gm(n.mimeType);t.indexOf(pm.UNICODE_REPLACEMENT_CHARACTER)>=0&&r.warning("Unicode replacement character detected, source encoding issues?");function i(t){if(t>65535){var e=55296+((t-=65536)>>10),a=56320+(1023&t);return String.fromCharCode(e,a)}return String.fromCharCode(t)}function l(t){var e=";"===t[t.length-1]?t:t+";";if(!o&&e!==t)return r.error("EntityRef: expecting ;"),t;var n=pm.Reference.exec(e);if(!n||n[0].length!==e.length)return r.error("entity not matching Reference production: "+t),t;var l=e.slice(1,-1);return vm(a,l)?a[l]:"#"===l.charAt(0)?i(parseInt(l.substring(1).replace("x","0x"))):(r.error("entity not found:"+t),t)}function s(e){if(e>m){var a=t.substring(m,e).replace(wm,l);p&&u(m),n.characters(a,0,e-m),m=e}}var d=0,c=0,h=/\r\n?|\n|$/g,p=n.locator;function u(e,a){for(;e>=c&&(a=h.exec(t));)d=c,c=a.index+a[0].length,p.lineNumber++;p.columnNumber=e-d+1}var f=[{currentNSMap:e}],g=[],m=0;for(;;){try{var v=t.indexOf("<",m);if(v<0){if(!o&&g.length>0)return r.fatalError("unclosed xml tag(s): "+g.join(", "));if(!t.substring(m).match(/^\s*$/)){var b=n.doc,y=b.createTextNode(t.substring(m));if(b.documentElement)return r.error("Extra content at the end of the document");b.appendChild(y),n.currentElement=y}return}if(v>m){var M=t.substring(m,v);o||0!==g.length||(M=M.replace(new RegExp(pm.S_OPT.source,"g"),""))&&r.error("Unexpected content outside root element: '"+M+"'"),s(v)}switch(t.charAt(v+1)){case"/":var x=t.indexOf(">",v+2),w=t.substring(v+2,x>0?x:void 0);if(!w)return r.fatalError("end tag name missing");var S=x>0&&pm.reg("^",pm.QName_group,pm.S_OPT,"$").exec(w);if(!S)return r.fatalError('end tag name contains invalid characters: "'+w+'"');if(!n.currentElement&&!n.doc.documentElement)return;var A=g[g.length-1]||n.currentElement.tagName||n.doc.documentElement.tagName||"";if(A!==S[1]){var I=S[1].toLowerCase();if(!o||A.toLowerCase()!==I)return r.fatalError('Opening and ending tag mismatch: "'+A+'" != "'+w+'"')}var T=f.pop();g.pop();var C=T.localNSMap;if(n.endElement(T.uri,T.localName,A),C)for(var k in C)vm(C,k)&&n.endPrefixMapping(k);x++;break;case"?":p&&u(v),x=Em(t,v,n,r);break;case"!":p&&u(v),x=Vm(t,v,n,r,o);break;default:p&&u(v);var V=new Rm,E=f[f.length-1].currentNSMap,R=(x=Am(t,v,V,E,l,r,o),V.length);if(V.closed||(o&&hm.isHTMLVoidElement(V.tagName)?V.closed=!0:g.push(V.tagName)),p&&R){for(var L=Sm(p,{}),z=0;z<R;z++){var N=V[z];u(N.offset),N.locator=Sm(p,{})}n.locator=L,Im(V,n,E)&&f.push(V),n.locator=p}else Im(V,n,E)&&f.push(V);o&&!V.closed?x=Tm(t,x,V.tagName,l,n):x++}}catch(rN){if(rN instanceof ym)throw rN;if(rN instanceof Mm)throw new ym(rN.name+": "+rN.message,n.locator,rN);r.error("element parse error: "+rN),x=-1}x>m?m=x:s(Math.max(v,m)+1)}}(t,e,a,n,this.errorHandler),n.endDocument()}};var wm=/&#?\w+;?/g;function Sm(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function Am(t,e,a,n,r,o,i){function l(t,e,n){return vm(a.attributeNames,t)?o.fatalError("Attribute "+t+" redefined"):!i&&e.indexOf("<")>=0?o.fatalError("Unescaped '<' not allowed in attributes values"):void a.addValue(t,e.replace(/[\t\n\r]/g," ").replace(wm,r),n)}for(var s,d=++e,c=0;;){var h=t.charAt(d);switch(h){case"=":if(1===c)s=t.slice(e,d),c=3;else{if(2!==c)throw new Error("attribute equal must after attrName");c=3}break;case"'":case'"':if(3===c||1===c){if(1===c&&(o.warning('attribute value must after "="'),s=t.slice(e,d)),e=d+1,!((d=t.indexOf(h,e))>0))throw new Error("attribute value no end '"+h+"' match");l(s,p=t.slice(e,d),e-1),c=5}else{if(4!=c)throw new Error('attribute value must after "="');l(s,p=t.slice(e,d),e),o.warning('attribute "'+s+'" missed start quot('+h+")!!"),e=d+1,c=5}break;case"/":switch(c){case 0:a.setTagName(t.slice(e,d));case 5:case 6:case 7:c=7,a.closed=!0;case 4:case 1:break;case 2:a.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return o.error("unexpected end of input"),0==c&&a.setTagName(t.slice(e,d)),d;case">":switch(c){case 0:a.setTagName(t.slice(e,d));case 5:case 6:case 7:break;case 4:case 1:"/"===(p=t.slice(e,d)).slice(-1)&&(a.closed=!0,p=p.slice(0,-1));case 2:2===c&&(p=s),4==c?(o.warning('attribute "'+p+'" missed quot(")!'),l(s,p,e)):(i||o.warning('attribute "'+p+'" missed value!! "'+p+'" instead!!'),l(p,p,e));break;case 3:if(!i)return o.fatalError("AttValue: ' or \" expected")}return d;case"":h=" ";default:if(h<=" ")switch(c){case 0:a.setTagName(t.slice(e,d)),c=6;break;case 1:s=t.slice(e,d),c=2;break;case 4:var p=t.slice(e,d);o.warning('attribute "'+p+'" missed quot(")!!'),l(s,p,e);case 5:c=6}else switch(c){case 2:i||o.warning('attribute "'+s+'" missed value!! "'+s+'" instead2!!'),l(s,s,e),e=d,c=1;break;case 5:o.warning('attribute space is required"'+s+'"!!');case 6:c=1,e=d;break;case 3:c=4,e=d;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}d++}}function Im(t,e,a){for(var n=t.tagName,r=null,o=t.length;o--;){var i=t[o],l=i.qName,s=i.value;if((p=l.indexOf(":"))>0)var d=i.prefix=l.slice(0,p),c=l.slice(p+1),h="xmlns"===d&&c;else c=l,d=null,h="xmlns"===l&&"";i.localName=c,!1!==h&&(null==r&&(r=Object.create(null),Cm(a,a=Object.create(null))),a[h]=r[h]=s,i.uri=bm.XMLNS,e.startPrefixMapping(h,s))}for(o=t.length;o--;)(i=t[o]).prefix&&("xml"===i.prefix&&(i.uri=bm.XML),"xmlns"!==i.prefix&&(i.uri=a[i.prefix]));var p;(p=n.indexOf(":"))>0?(d=t.prefix=n.slice(0,p),c=t.localName=n.slice(p+1)):(d=null,c=t.localName=n);var u=t.uri=a[d||""];if(e.startElement(u,c,n,t),!t.closed)return t.currentNSMap=a,t.localNSMap=r,!0;if(e.endElement(u,c,n),r)for(d in r)vm(r,d)&&e.endPrefixMapping(d)}function Tm(t,e,a,n,r){var o=fm(a);if(o||mm(a)){var i=t.indexOf("</"+a+">",e),l=t.substring(e+1,i);return o&&(l=l.replace(wm,n)),r.characters(l,0,l.length),i}return e+1}function Cm(t,e){for(var a in t)vm(t,a)&&(e[a]=t[a])}function km(t,e){var a=e;function n(e){return e=e||0,t.charAt(a+e)}function r(t){a+=t=t||1}function o(){return t.substring(a)}return{char:n,getIndex:function(){return a},getMatch:function(t){var e=pm.reg("^",t).exec(o());return e?(r(e[0].length),e[0]):null},getSource:function(){return t},skip:r,skipBlanks:function(){for(var e=0;a<t.length;){var o=n();if(" "!==o&&"\n"!==o&&"\t"!==o&&"\r"!==o)return e;e++,r()}return-1},substringFromIndex:o,substringStartsWith:function(e){return t.substring(a,a+e.length)===e},substringStartsWithCaseInsensitive:function(e){return t.substring(a,a+e.length).toUpperCase()===e.toUpperCase()}}}function Vm(t,e,a,n,r){var o=km(t,e);switch(r?o.char(2).toUpperCase():o.char(2)){case"-":var i=o.getMatch(pm.Comment);return i?(a.comment(i,pm.COMMENT_START.length,i.length-pm.COMMENT_START.length-pm.COMMENT_END.length),o.getIndex()):n.fatalError("comment is not well-formed at position "+o.getIndex());case"[":var l=o.getMatch(pm.CDSect);return l?r||a.currentElement?(a.startCDATA(),a.characters(l,pm.CDATA_START.length,l.length-pm.CDATA_START.length-pm.CDATA_END.length),a.endCDATA(),o.getIndex()):n.fatalError("CDATA outside of element"):n.fatalError("Invalid CDATA starting at position "+e);case"D":if(a.doc&&a.doc.documentElement)return n.fatalError("Doctype not allowed inside or after documentElement at position "+o.getIndex());if(r?!o.substringStartsWithCaseInsensitive(pm.DOCTYPE_DECL_START):!o.substringStartsWith(pm.DOCTYPE_DECL_START))return n.fatalError("Expected "+pm.DOCTYPE_DECL_START+" at position "+o.getIndex());if(o.skip(pm.DOCTYPE_DECL_START.length),o.skipBlanks()<1)return n.fatalError("Expected whitespace after "+pm.DOCTYPE_DECL_START+" at position "+o.getIndex());var s={name:void 0,publicId:void 0,systemId:void 0,internalSubset:void 0};if(s.name=o.getMatch(pm.Name),!s.name)return n.fatalError("doctype name missing or contains unexpected characters at position "+o.getIndex());if(r&&"html"!==s.name.toLowerCase()&&n.warning("Unexpected DOCTYPE in HTML document at position "+o.getIndex()),o.skipBlanks(),o.substringStartsWith(pm.PUBLIC)||o.substringStartsWith(pm.SYSTEM)){var d=pm.ExternalID_match.exec(o.substringFromIndex());if(!d)return n.fatalError("doctype external id is not well-formed at position "+o.getIndex());void 0!==d.groups.SystemLiteralOnly?s.systemId=d.groups.SystemLiteralOnly:(s.systemId=d.groups.SystemLiteral,s.publicId=d.groups.PubidLiteral),o.skip(d[0].length)}else if(r&&o.substringStartsWithCaseInsensitive(pm.SYSTEM)){if(o.skip(pm.SYSTEM.length),o.skipBlanks()<1)return n.fatalError("Expected whitespace after "+pm.SYSTEM+" at position "+o.getIndex());if(s.systemId=o.getMatch(pm.ABOUT_LEGACY_COMPAT_SystemLiteral),!s.systemId)return n.fatalError("Expected "+pm.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+pm.SYSTEM+" at position "+o.getIndex())}return r&&s.systemId&&!pm.ABOUT_LEGACY_COMPAT_SystemLiteral.test(s.systemId)&&n.warning("Unexpected doctype.systemId in HTML document at position "+o.getIndex()),r||(o.skipBlanks(),s.internalSubset=function(t,e){function a(t,e){var a=pm.PI.exec(t.substringFromIndex());return a?"xml"===a[1].toLowerCase()?e.fatalError("xml declaration is only allowed at the start of the document, but found at position "+t.getIndex()):(t.skip(a[0].length),a[0]):e.fatalError("processing instruction is not well-formed at position "+t.getIndex())}var n=t.getSource();if("["===t.char()){t.skip(1);for(var r=t.getIndex();t.getIndex()<n.length;){if(t.skipBlanks(),"]"===t.char()){var o=n.substring(r,t.getIndex());return t.skip(1),o}var i=null;if("<"===t.char()&&"!"===t.char(1))switch(t.char(2)){case"E":"L"===t.char(3)?i=t.getMatch(pm.elementdecl):"N"===t.char(3)&&(i=t.getMatch(pm.EntityDecl));break;case"A":i=t.getMatch(pm.AttlistDecl);break;case"N":i=t.getMatch(pm.NotationDecl);break;case"-":i=t.getMatch(pm.Comment)}else if("<"===t.char()&&"?"===t.char(1))i=a(t,e);else{if("%"!==t.char())return e.fatalError("Error detected in Markup declaration");i=t.getMatch(pm.PEReference)}if(!i)return e.fatalError("Error in internal subset at position "+t.getIndex())}return e.fatalError("doctype internal subset is not well-formed, missing ]")}}(o,n)),o.skipBlanks(),">"!==o.char()?n.fatalError("doctype not terminated with > at position "+o.getIndex()):(o.skip(1),a.startDTD(s.name,s.publicId,s.systemId,s.internalSubset),a.endDTD(),o.getIndex());default:return n.fatalError('Not well-formed XML starting with "<!" at position '+e)}}function Em(t,e,a,n){var r=t.substring(e).match(pm.PI);if(!r)return n.fatalError("Invalid processing instruction starting at position "+e);if("xml"===r[1].toLowerCase()){if(e>0)return n.fatalError("processing instruction at position "+e+" is an xml declaration which is only at the start of the document");if(!pm.XMLDecl.test(t.substring(e)))return n.fatalError("xml declaration is not well-formed")}return a.processingInstruction(r[1],r[2]),e+r[0].length}function Rm(){this.attributeNames=Object.create(null)}Rm.prototype={setTagName:function(t){if(!pm.QName_exact.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,a){if(!pm.QName_exact.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:a}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}},cm.XMLReader=xm,cm.parseUtils=km,cm.parseDoctypeCommentOrCData=Vm;var Lm=_p,zm=su,Nm=dm,qm=cm,Om=bu.DOMImplementation,Pm=Lm.hasDefaultHTMLNamespace,Wm=Lm.isHTMLMimeType,Hm=Lm.isValidMimeType,Um=Lm.MIME_TYPE,Fm=Lm.NAMESPACE,Bm=zm.ParseError,Gm=qm.XMLReader;function Zm(t){return t.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028\u2029]/g,"\n")}function Km(t){if(void 0===(t=t||{}).locator&&(t.locator=!0),this.assign=t.assign||Lm.assign,this.domHandler=t.domHandler||Dm,this.onError=t.onError||t.errorHandler,t.errorHandler&&"function"!=typeof t.errorHandler)throw new TypeError("errorHandler object is no longer supported, switch to onError!");t.errorHandler&&t.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=t.normalizeLineEndings||Zm,this.locator=!!t.locator,this.xmlns=this.assign(Object.create(null),t.xmlns)}function Dm(t){var e=t||{};this.mimeType=e.mimeType||Um.XML_APPLICATION,this.defaultNamespace=e.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=e.onError}function jm(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}function Xm(t,e,a){return"string"==typeof t?t.substr(e,a):t.length>=e+a||e?new java.lang.String(t,e,a)+"":t}function Jm(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}Km.prototype.parseFromString=function(t,e){if(!Hm(e))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+e+'" is not valid.');var a=this.assign(Object.create(null),this.xmlns),n=Nm.XML_ENTITIES,r=a[""]||null;Pm(e)?(n=Nm.HTML_ENTITIES,r=Fm.HTML):e===Um.XML_SVG_IMAGE&&(r=Fm.SVG),a[""]=r,a.xml=a.xml||Fm.XML;var o=new this.domHandler({mimeType:e,defaultNamespace:r,onError:this.onError}),i=this.locator?{}:void 0;this.locator&&o.setDocumentLocator(i);var l=new Gm;return l.errorHandler=o,l.domBuilder=o,!Lm.isHTMLMimeType(e)&&"string"!=typeof t&&l.errorHandler.fatalError("source is not a string"),l.parse(this.normalizeLineEndings(String(t)),a,n),o.doc.documentElement||l.errorHandler.fatalError("missing root element"),o.doc},Dm.prototype={startDocument:function(){var t=new Om;this.doc=Wm(this.mimeType)?t.createHTMLDocument(!1):t.createDocument(this.defaultNamespace,"")},startElement:function(t,e,a,n){var r=this.doc,o=r.createElementNS(t,a||e),i=n.length;Jm(this,o),this.currentElement=o,this.locator&&jm(this.locator,o);for(var l=0;l<i;l++){t=n.getURI(l);var s=n.getValue(l),d=(a=n.getQName(l),r.createAttributeNS(t,a));this.locator&&jm(n.getLocator(l),d),d.value=d.nodeValue=s,o.setAttributeNode(d)}},endElement:function(t,e,a){this.currentElement=this.currentElement.parentNode},startPrefixMapping:function(t,e){},endPrefixMapping:function(t){},processingInstruction:function(t,e){var a=this.doc.createProcessingInstruction(t,e);this.locator&&jm(this.locator,a),Jm(this,a)},ignorableWhitespace:function(t,e,a){},characters:function(t,e,a){if(t=Xm.apply(this,arguments)){if(this.cdata)var n=this.doc.createCDATASection(t);else n=this.doc.createTextNode(t);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(t)&&this.doc.appendChild(n),this.locator&&jm(this.locator,n)}},skippedEntity:function(t){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(t){t&&(t.lineNumber=0),this.locator=t},comment:function(t,e,a){t=Xm.apply(this,arguments);var n=this.doc.createComment(t);this.locator&&jm(this.locator,n),Jm(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(t,e,a,n){var r=this.doc.implementation;if(r&&r.createDocumentType){var o=r.createDocumentType(t,e,a,n);this.locator&&jm(this.locator,o),Jm(this,o),this.doc.doctype=o}},reportError:function(t,e){if("function"==typeof this.onError)try{this.onError(t,e,this)}catch(rN){throw new Bm("Reporting "+t+' "'+e+'" caused '+rN,this.locator)}else console.error("[xmldom "+t+"]\t"+e,function(t){if(t)return"\n@#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}(this.locator))},warning:function(t){this.reportError("warning",t)},error:function(t){this.reportError("error",t)},fatalError:function(t){throw this.reportError("fatalError",t),new Bm(t,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(t){Dm.prototype[t]=function(){return null}}),sm.__DOMHandler=Dm,sm.DOMParser=Km,sm.normalizeLineEndings=Zm,sm.onErrorStopParsing=function(t){if("error"===t)throw"onErrorStopParsing"},sm.onWarningStopParsing=function(){throw"onWarningStopParsing"};var Ym=_p;Ym.assign,Ym.hasDefaultHTMLNamespace,Ym.isHTMLMimeType,Ym.isValidMimeType,Ym.MIME_TYPE,Ym.NAMESPACE;var Qm=bu.XMLSerializer,_m=sm.DOMParser;const $m="http://schemas.openxmlformats.org/wordprocessingml/2006/main",tv="http://schemas.openxmlformats.org/drawingml/2006/main",ev="http://schemas.microsoft.com/office/word/2010/wordml";function av(t,e,a){if(!t)return[];const n=[];for(let r=0;r<t.childNodes.length;r+=1){const o=t.childNodes[r];(null==o?void 0:o.nodeType)===o.ELEMENT_NODE&&o.namespaceURI===e&&o.localName===a&&n.push(o)}return n}const nv=["lrTb","tbRl","btLr","lrTbV","tbRlV"];function rv(t){return nv.includes(t)?t:void 0}function ov(t,e,a){return av(t,e,a)[0]??null}function iv(t,e){return t?t.getAttributeNS($m,e)??t.getAttributeNS(ev,e)??t.getAttribute(`w:${e}`)??t.getAttribute(`w14:${e}`)??t.getAttribute(e):null}function lv(t,e){for(let a=0;a<t.childNodes.length;a+=1){const n=t.childNodes[a];if(1===(null==n?void 0:n.nodeType)){const t=n;if(t.localName===e)return t;const a=lv(t,e);if(a)return a}}return null}function sv(t){return"1"===t||"true"===t||"on"===t}function dv(t,e){const a=ov(t,$m,e);if(!a)return;const n=iv(a,"val");return null==n||"0"!==n&&"false"!==n&&"off"!==n&&sv(n)}function cv(t,e){return iv(ov(t,$m,e),"val")??void 0}async function hv(t,e){e>0&&e%t===0&&await new Promise(t=>setTimeout(t,0))}function pv(t){var e;const a=new Map;if(!t)return a;const n=null==(e=(new _m).parseFromString(t,"application/xml").documentElement)?void 0:e.childNodes;if(!n)return a;for(let r=0;r<n.length;r+=1){const t=n[r];if(1===(null==t?void 0:t.nodeType)){const e=t;if("Relationship"===e.localName){const t=e.getAttribute("Id"),n=e.getAttribute("Target");t&&n&&a.set(t,n)}}}return a}async function uv(t,e){var a;const n=e.lastIndexOf("/"),r=n>=0?e.slice(0,n):"",o=n>=0?e.slice(n+1):e,i=r?`${r}/_rels/${o}.rels`:`_rels/${o}.rels`;return pv(await(null==(a=t.file(i))?void 0:a.async("string")))}const fv=t=>{var e;const a=ov(t,tv,"latin");return(null==(e=null==a?void 0:a.getAttribute("typeface"))?void 0:e.trim())||void 0},gv=t=>{var e;const a=ov(t,tv,"cs");return(null==(e=null==a?void 0:a.getAttribute("typeface"))?void 0:e.trim())||fv(t)},mv=t=>{var e;const a=ov(t,tv,"ea");return(null==(e=null==a?void 0:a.getAttribute("typeface"))?void 0:e.trim())||fv(t)};function vv(t){const e=ov(t,tv,"fontScheme"),a=ov(e,tv,"majorFont"),n=ov(e,tv,"minorFont");return{majorHAnsi:fv(a),minorHAnsi:fv(n),majorEastAsia:mv(a),minorEastAsia:mv(n),majorBidi:gv(a),minorBidi:gv(n)}}function bv(t,e){const a=t?Number(t):Number.NaN;return Number.isFinite(a)?Math.round(a/1440*96):e}function yv(t){const e=t?Number(t):Number.NaN;if(Number.isFinite(e))return Math.round(e/20*1e4)/1e4}function Mv(t){const e=null==t?void 0:t.trim();if(e&&"auto"!==e&&"none"!==e)return e.startsWith("#")?e:`#${e.toUpperCase()}`}const xv=["dk1","lt1","dk2","lt2","accent1","accent2","accent3","accent4","accent5","accent6","hlink","folHlink"];function wv(t){const e=ov(t,tv,"srgbClr");if(e)return Mv(iv(e,"val"));const a=ov(t,tv,"sysClr");return a?Mv(iv(a,"lastClr")):void 0}function Sv(t){const e=ov(t,tv,"clrScheme");if(!e)return{};const a={};for(const n of xv){const t=wv(ov(e,tv,n));t&&(a[n]=t)}return a}function Av(t){if(!t)return;const e=Number.parseInt(t,16);return Number.isFinite(e)?e/255:void 0}function Iv(t,e,a){const n=t=>{return(e=t,Math.min(255,Math.max(0,Math.round(e)))).toString(16).padStart(2,"0").toUpperCase();var e};return`#${n(t)}${n(e)}${n(a)}`}const Tv={decimal:"decimal",lowerRoman:"lowerRoman",upperRoman:"upperRoman",lowerLetter:"lowerLetter",upperLetter:"upperLetter",symbol:"symbol"},Cv={continuous:"continuous",eachSect:"eachSection"};function kv(t){if(!t)return;const e={},a=iv(ov(t,$m,"numFmt"),"val");a&&Tv[a]&&(e.numberFormat=Tv[a]);const n=Number.parseInt(iv(ov(t,$m,"numStart"),"val")??"",10);Number.isFinite(n)&&n>0&&(e.startAt=n);const r=iv(ov(t,$m,"numRestart"),"val");return r&&Cv[r]&&(e.restart=Cv[r]),Object.keys(e).length>0?e:void 0}const Vv={decimal:"decimal",lowerLetter:"lowerLetter",upperLetter:"upperLetter",lowerRoman:"lowerRoman",upperRoman:"upperRoman",bullet:"bullet"};function Ev(t){const e=Object.entries(t).filter(([,t])=>void 0!==t);return e.length>0?Object.fromEntries(e):void 0}function Rv(t){return Object.keys(t).length>0?t:void 0}function Lv(t,e){return Rv({...t??{},...e??{}})}function zv(t){return Mv(iv(t,"fill"))}function Nv(t,e){if(!t)return;const a=Ne(t,e,Ia),n=Ne(void 0,e,Ia),r=(t,e)=>t!==e?t:void 0,o=(t,e,a)=>void 0!==t?t:r(e,a);return Ev({styleId:t.styleId,bold:o(t.bold,a.bold,n.bold),italic:o(t.italic,a.italic,n.italic),underline:r(a.underline,n.underline),underlineStyle:r(a.underlineStyle,n.underlineStyle),underlineColor:r(a.underlineColor,n.underlineColor),strike:o(t.strike,a.strike,n.strike),doubleStrike:o(t.doubleStrike,a.doubleStrike,n.doubleStrike),superscript:r(a.superscript,n.superscript),subscript:r(a.subscript,n.subscript),smallCaps:o(t.smallCaps,a.smallCaps,n.smallCaps),allCaps:o(t.allCaps,a.allCaps,n.allCaps),hidden:o(t.hidden,a.hidden,n.hidden),noProof:o(t.noProof,a.noProof,n.noProof),webHidden:o(t.webHidden,a.webHidden,n.webHidden),specVanish:o(t.specVanish,a.specVanish,n.specVanish),textEffect:r(a.textEffect,n.textEffect),characterScale:r(a.characterScale,n.characterScale),characterSpacing:r(a.characterSpacing,n.characterSpacing),baselineShift:r(a.baselineShift,n.baselineShift),kerningThreshold:r(a.kerningThreshold,n.kerningThreshold),ligatures:r(a.ligatures,n.ligatures),numberSpacing:r(a.numberSpacing,n.numberSpacing),numberForm:r(a.numberForm,n.numberForm),stylisticSet:r(a.stylisticSet,n.stylisticSet),contextualAlternates:r(a.contextualAlternates,n.contextualAlternates),fontFamily:o(t.fontFamily,a.fontFamily,n.fontFamily),fontSize:o(t.fontSize,a.fontSize,n.fontSize),color:r(a.color,n.color),highlight:r(a.highlight,n.highlight),shading:r(a.shading,n.shading),language:r(a.language,n.language),link:r(a.link,n.link)})}function qv(t,e){if(!t)return;const a={},n=cv(t,"rStyle");n&&(a.styleId=n);const r=dv(t,"b"),o=dv(t,"bCs");void 0===r&&void 0===o||(a.bold=!0===r||!0===o);const i=dv(t,"i"),l=dv(t,"iCs");void 0===i&&void 0===l||(a.italic=!0===i||!0===l);const s=dv(t,"strike");void 0!==s&&(a.strike=s);const d=dv(t,"dstrike");void 0!==d&&(a.doubleStrike=d);const c=dv(t,"smallCaps");void 0!==c&&(a.smallCaps=c);const h=dv(t,"caps");void 0!==h&&(a.allCaps=h);const p=dv(t,"vanish");void 0!==p&&(a.hidden=p);const u=dv(t,"noProof");void 0!==u&&(a.noProof=u);const f=dv(t,"webHidden");void 0!==f&&(a.webHidden=f);const g=dv(t,"specVanish");void 0!==g&&(a.specVanish=g);const m=iv(ov(t,$m,"effect"),"val");m&&(a.textEffect=m);const v=iv(ov(t,$m,"w"),"val");if(v){const t=Number(v);Number.isFinite(t)&&t>0&&(a.characterScale=t)}const b=iv(ov(t,$m,"spacing"),"val");if(b){const t=yv(b);void 0!==t&&(a.characterSpacing=t)}const y=iv(ov(t,$m,"position"),"val");if(y){const t=Number(y);Number.isFinite(t)&&(a.baselineShift=t/2)}const M=iv(ov(t,$m,"kern"),"val");if(M){const t=Number(M);Number.isFinite(t)&&t>=0&&(a.kerningThreshold=t/2)}const x=iv(ov(t,ev,"ligatures"),"val");"none"!==x&&"standard"!==x&&"contextual"!==x&&"historical"!==x&&"standardContextual"!==x||(a.ligatures=x);const w=iv(ov(t,ev,"numSpacing"),"val");"proportional"!==w&&"tabular"!==w||(a.numberSpacing=w);const S=iv(ov(t,ev,"numForm"),"val");"lining"!==S&&"oldStyle"!==S||(a.numberForm=S);const A=iv(ov(t,ev,"stylisticSets"),"val");if(A){const t=/^[0-9a-fA-F]+$/.test(A)&&A.length>2?Number.parseInt(A,16):Number(A);if(Number.isFinite(t)&&t>0)for(let e=1;e<=20;e+=1)if(t&1<<e-1){a.stylisticSet=e;break}}const I=iv(ov(t,ev,"cntxtAlts"),"val");null===I?ov(t,ev,"cntxtAlts")&&(a.contextualAlternates=!0):sv(I)&&(a.contextualAlternates=!0);const T=ov(t,$m,"u"),C=iv(T,"val");if(T&&"none"!==C){a.underline=!0,C&&"single"!==C&&(a.underlineStyle=C);const t=iv(T,"color");t&&"auto"!==t&&(a.underlineColor=Mv(t))}const k=iv(ov(t,$m,"vertAlign"),"val");"superscript"===k&&(a.superscript=!0),"subscript"===k&&(a.subscript=!0);const V=ov(t,$m,"rFonts"),E=iv(V,"ascii")??iv(V,"hAnsi")??iv(V,"cs")??iv(V,"eastAsia")??function(t,e){const a=iv(t,"asciiTheme")??iv(t,"hAnsiTheme")??iv(t,"eastAsiaTheme")??iv(t,"cstheme");if(!a)return;const n="majorAscii"===a||"majorHAnsi"===a?"majorHAnsi":"minorAscii"===a||"minorHAnsi"===a?"minorHAnsi":"majorEastAsia"===a?"majorEastAsia":"minorEastAsia"===a?"minorEastAsia":"majorBidi"===a?"majorBidi":"minorBidi"===a?"minorBidi":void 0;return n?e[n]:void 0}(V,e.fonts);E&&(a.fontFamily=function(t){const e=null==t?void 0:t.trim();if(!e)return;return`${/[\s,]/.test(e)?`"${e.replace(/"/g,'\\"')}"`:e}, ${/times/i.test(e)?"serif":"sans-serif"}`}(E));const R=iv(ov(t,$m,"sz")??ov(t,$m,"szCs"),"val");if(R){const t=function(t){const e=t?Number(t):Number.NaN;return Number.isFinite(e)?Math.round(e/2/72*96*1e4)/1e4:null}(R);null!==t&&(a.fontSize=t)}const L=ov(t,$m,"color"),z=iv(L,"val");if(z&&"auto"!==z)a.color=Mv(z);else if("auto"!==z){const t=function(t,e){const a=iv(t,"themeColor");if(!a)return;const n=function(t){switch(t){case"dark1":case"text1":return"dk1";case"light1":case"background1":return"lt1";case"dark2":case"text2":return"dk2";case"light2":case"background2":return"lt2";case"accent1":case"accent2":case"accent3":case"accent4":case"accent5":case"accent6":return t;case"hyperlink":return"hlink";case"followedHyperlink":return"folHlink";default:return}}(a),r=n?e[n]:void 0;if(!r)return;let o=Number.parseInt(r.slice(1,3),16),i=Number.parseInt(r.slice(3,5),16),l=Number.parseInt(r.slice(5,7),16);const s=Av(iv(t,"themeShade"));void 0!==s&&(o*=s,i*=s,l*=s);const d=Av(iv(t,"themeTint"));if(void 0!==d){const t=255*(1-d);o=o*d+t,i=i*d+t,l=l*d+t}return Iv(o,i,l)}(L,e.colors);t&&(a.color=t)}const N=iv(ov(t,$m,"highlight"),"val");N&&"none"!==N&&(a.highlight=N);const q=zv(ov(t,$m,"shd"));q&&(a.shading=q);const O=ov(t,$m,"lang");if(O){const t=iv(O,"val"),e=iv(O,"eastAsia"),n=iv(O,"bidi"),r={};t&&(r.value=t),e&&(r.eastAsia=e),n&&(r.bidi=n),Object.keys(r).length>0&&(a.language=r)}return Rv(a)}function Ov(t){if(!t)return;const e=iv(t,"val");if("nil"===e||"none"===e)return{width:0,type:"none",color:"transparent"};const a=Number(iv(t,"sz")),n=Number.isFinite(a)&&a>0?Math.round(a/8*1e4)/1e4:.75,r=Mv(iv(t,"color"))??"#000000",o=(null==e?void 0:e.toLowerCase())??"single";return{width:n,type:o.includes("dotted")||o.includes("dot")?"dotted":o.includes("dash")?"dashed":"solid",color:r}}function Pv(t){return t?{borderTop:Ov(ov(t,$m,"top")),borderRight:Ov(ov(t,$m,"right")),borderBottom:Ov(ov(t,$m,"bottom")),borderLeft:Ov(ov(t,$m,"left")),borderStart:Ov(ov(t,$m,"start")),borderEnd:Ov(ov(t,$m,"end")),borderTopLeftToBottomRight:Ov(ov(t,$m,"tl2br")),borderTopRightToBottomLeft:Ov(ov(t,$m,"tr2bl"))}:{}}function Wv(t){return void 0!==(null==t?void 0:t.lineHeight)?t:{...t??{},lineHeight:1.1}}function Hv(t){const e=ov(t,$m,"spacing");return{before:sv(iv(e,"beforeAutospacing")),after:sv(iv(e,"afterAutospacing"))}}function Uv(t){if(!t)return;const e={},a=cv(t,"pStyle");a&&(e.styleId=a);const n=iv(ov(t,$m,"jc"),"val");"left"===n||"start"===n||"center"===n||"right"===n||"end"===n||"justify"===n?e.align="start"===n?"left":"end"===n?"right":n:"both"!==n&&"distribute"!==n||(e.align="justify");const r=ov(t,$m,"spacing"),o=iv(r,"before"),i=iv(r,"after"),l=iv(r,"line"),s=iv(r,"lineRule");o&&(e.spacingBefore=bv(o,0)),i&&(e.spacingAfter=bv(i,0)),l&&("exact"===s||"atLeast"===s?(e.lineHeight=Math.round(Number(l)/1440*96*1e4)/1e4,e.lineRule=s):e.lineHeight=Number(l)/240);const d=dv(t,"contextualSpacing");void 0!==d&&(e.contextualSpacing=d);const c=dv(t,"snapToGrid");void 0!==c&&(e.snapToGrid=c);const h=ov(t,$m,"ind"),p=iv(h,"start")??iv(h,"left"),u=iv(h,"end")??iv(h,"right"),f=iv(h,"firstLine"),g=iv(h,"hanging");p&&(e.indentLeft=bv(p,0)),u&&(e.indentRight=bv(u,0)),g?(e.indentHanging=bv(g,0),e.indentFirstLine=void 0):f&&(e.indentFirstLine=bv(f,0));const m=function(t){const e=ov(t,$m,"tabs");if(!e)return[];const a=[];for(const n of av(e,$m,"tab")){const t=yv(iv(n,"pos"));if(void 0===t)continue;const e=iv(n,"val"),r="center"===e||"right"===e||"decimal"===e||"bar"===e||"clear"===e?e:"left",o=iv(n,"leader"),i="dot"===o||"hyphen"===o||"underscore"===o||"heavy"===o||"middleDot"===o?o:"none"===o?"none":void 0;a.push({position:t,type:r,...void 0!==i?{leader:i}:{}})}return a}(t);m.length>0&&(e.tabs=m);const v=dv(t,"pageBreakBefore");void 0!==v&&(e.pageBreakBefore=v);const b=dv(t,"keepNext");void 0!==b&&(e.keepWithNext=b);const y=dv(t,"keepLines");void 0!==y&&(e.keepLinesTogether=y);const M=dv(t,"widowControl");void 0!==M&&(e.widowControl=M);const x=ov(t,$m,"pBdr");if(x){const{borderTop:t,borderRight:a,borderBottom:n,borderLeft:r}=Pv(x);t&&(e.borderTop=t),a&&(e.borderRight=a),n&&(e.borderBottom=n),r&&(e.borderLeft=r)}const w=zv(ov(t,$m,"shd"));w&&(e.shading=w);const S=rv(iv(ov(t,$m,"textDirection"),"val"));S&&(e.textDirection=S);const A=iv(ov(t,$m,"outlineLvl"),"val");if(void 0!==A){const t=Number(A);Number.isFinite(t)&&t>=0&&t<=8&&(e.outlineLevel=t)}return Rv(e)}function Fv(t){if(!t)return;const e={},a=ov(t,$m,"trHeight");if(a){const t=yv(iv(a,"val"));void 0!==t&&(e.height=t);const n=iv(a,"hRule");"auto"!==n&&"exact"!==n&&"atLeast"!==n||(e.heightRule=n)}const n=dv(t,"cantSplit");void 0!==n&&(e.cantSplit=n);const r=dv(t,"hidden");return void 0!==r&&(e.hidden=r),Object.keys(e).length>0?e:void 0}function Bv(t){return"1"===t||"true"===t||"on"===t}function Gv(t){const e=ov(t,$m,"cols");if(!e)return;const a=Number.parseInt(iv(e,"num")??"1",10);if(!Number.isFinite(a)||a<=1)return;const n=bv(iv(e,"space"),0),r=iv(e,"sep"),o=iv(e,"equalWidth"),i=av(e,$m,"col").map(t=>({width:bv(iv(t,"w"),0),space:bv(iv(t,"space"),n)})),l=null==o||Bv(o);return{count:a,space:n,...Bv(r)?{separator:!0}:{},...l?{}:{equalWidth:!1},...!l&&i.length>0?{columns:i}:{}}}function Zv(t){const e=ov(t,$m,"pgSz"),a=ov(t,$m,"pgMar"),n=Gv(t);let r;if(e||a||n){const t=bv(iv(e,"w"),816),o=bv(iv(e,"h"),1056),i=iv(e,"orient");r={width:t,height:o,orientation:"landscape"===i?"landscape":"portrait"===i?"portrait":t>o?"landscape":"portrait",margins:{top:bv(iv(a,"top"),96),right:bv(iv(a,"right"),96),bottom:bv(iv(a,"bottom"),96),left:bv(iv(a,"left"),96),header:bv(iv(a,"header"),48),footer:bv(iv(a,"footer"),48),gutter:bv(iv(a,"gutter"),0)},...n?{columns:n}:{}}}const o=e=>{const a={};for(const n of av(t,$m,e)){const t=iv(n,"type")??"default";if("default"!==t&&"first"!==t&&"even"!==t)continue;const e=n.getAttribute("r:id")??n.getAttributeNS("http://schemas.openxmlformats.org/officeDocument/2006/relationships","id")??null;e&&(a[t]=e)}return a},i=o("headerReference"),l=o("footerReference"),s=ov(t,$m,"docGrid"),d=iv(s,"type"),c=bv(iv(s,"linePitch"),Number.NaN);return{pageSettings:r,headerRIds:i,footerRIds:l,docGridLinePitchPx:Number.isFinite(c)&&c>0?c:void 0,docGridMode:"lines"===d||"linesAndChars"===d?"explicit":void 0,docGridType:d}}function Kv(t){if(!t)return;const e=ov(t,$m,"sectPr");if(!e)return;const a=ov(e,$m,"pgSz"),n=ov(e,$m,"pgMar"),r=Gv(e);if(!a&&!n&&!r)return;const o=bv(iv(a,"w"),816),i=bv(iv(a,"h"),1056),l=iv(a,"orient");return{width:o,height:i,orientation:"landscape"===l?"landscape":"portrait"===l?"portrait":o>i?"landscape":"portrait",margins:{top:bv(iv(n,"top"),96),right:bv(iv(n,"right"),96),bottom:bv(iv(n,"bottom"),96),left:bv(iv(n,"left"),96),header:bv(iv(n,"header"),48),footer:bv(iv(n,"footer"),48),gutter:bv(iv(n,"gutter"),0)},...r?{columns:r}:{}}}function Dv(t,e,a,n,r){var o,i,l;if(e&&a)for(const s of t){if("paragraph"===s.type){const t=(null==(o=s.style)?void 0:o.styleId)&&/heading/i.test(s.style.styleId);void 0!==(null==(i=s.style)?void 0:i.lineHeight)||!1===(null==(l=s.style)?void 0:l.snapToGrid)||t||(s.style={...s.style??{},lineGridPitch:e,lineGridType:n});continue}if(r.adjustLineHeightInTable)for(const t of s.rows)for(const o of t.cells)Dv(o.blocks,e,a,n,r)}}const jv=9525,Xv=96/72;function Jv(t){const e=Yv(t);return void 0===e?void 0:Math.round(e/jv)}function Yv(t){if(null==t||""===t)return;const e=parseInt(t,10);return Number.isFinite(e)?e:void 0}function Qv(t){const e=null==t?void 0:t.trim();if(!e)return null;const a=e.match(/^(-?\d+(?:\.\d+)?)(pt|px|in|cm|mm|pc)?$/i);if(!a)return null;const n=Number(a[1]);if(!Number.isFinite(n)||n<=0)return null;switch((a[2]??"px").toLowerCase()){case"pt":return Math.round(n*Xv);case"in":return Math.round(96*n);case"cm":return Math.round(n/2.54*96);case"mm":return Math.round(n/25.4*96);case"pc":return Math.round(12*n*Xv);default:return Math.round(n)}}function _v(t){const e=null==t?void 0:t.trim();if(e&&/^[0-9a-fA-F]{6}$/.test(e))return`#${e.toUpperCase()}`}const $v={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",tif:"image/tiff",tiff:"image/tiff",svg:"image/svg+xml",emf:"image/x-emf",wmf:"image/x-wmf"},tb={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/bmp":"bmp","image/tiff":"tif","image/svg+xml":"svg","image/x-emf":"emf","image/x-wmf":"wmf"};function eb(t){return tb[t.toLowerCase()]??null}async function ab(t,e,a){let n=a;n.startsWith("/")&&(n=n.slice(1)),n.startsWith("word/")||(n="word/"+a);const r=t.file(n),o=function(t){var e;const a=null==(e=t.split(".").pop())?void 0:e.toLowerCase();return a?$v[a]??null:null}(a)??"image/png",i=await(null==r?void 0:r.async("base64"));if(i)return function(t,e,a){const n=t.byPath.get(e);if(n)return`${ce}${n}`;const r=`img-${t.nextId}`;return t.nextId+=1,t.assets[r]={id:r,url:a},t.byPath.set(e,r),`${ce}${r}`}(e,n,`data:${o};base64,${i}`)}function nb(t){return"1"===t||"true"===t||"0"!==t&&"false"!==t&&void 0}function rb(t,e){var a,n,r,o;const i=lv(t,e);if(!i)return;const l=null==(n=null==(a=lv(i,"align"))?void 0:a.textContent)?void 0:n.trim(),s=ob(null==(o=null==(r=lv(i,"posOffset"))?void 0:r.textContent)?void 0:o.trim()),d={relativeFrom:i.getAttribute("relativeFrom")??void 0,...l?{align:l}:{},...void 0!==s?{offset:s}:{}};return void 0!==d.relativeFrom||void 0!==d.align||void 0!==d.offset?d:void 0}function ob(t){if(null==t||""===t)return;const e=parseInt(t,10);return Number.isFinite(e)?e:void 0}function ib(t){const e=rb(t,"positionH"),a=rb(t,"positionV"),n=function(t){return lv(t,"wrapSquare")?"square":lv(t,"wrapTight")?"tight":lv(t,"wrapThrough")?"through":lv(t,"wrapTopAndBottom")?"topAndBottom":lv(t,"wrapNone")?"none":void 0}(t),r=ob(t.getAttribute("distT")),o=ob(t.getAttribute("distB")),i=ob(t.getAttribute("distL")),l=ob(t.getAttribute("distR")),s=nb(t.getAttribute("simplePos")),d=ob(t.getAttribute("relativeHeight")),c=nb(t.getAttribute("behindDoc")),h=nb(t.getAttribute("locked")),p=nb(t.getAttribute("layoutInCell")),u=nb(t.getAttribute("allowOverlap"));return{type:"floating",...void 0!==r?{distT:r}:{},...void 0!==o?{distB:o}:{},...void 0!==i?{distL:i}:{},...void 0!==l?{distR:l}:{},...void 0!==s?{simplePos:s}:{},...void 0!==d?{relativeHeight:d}:{},...void 0!==c?{behindDoc:c}:{},...void 0!==h?{locked:h}:{},...void 0!==p?{layoutInCell:p}:{},...void 0!==u?{allowOverlap:u}:{},...e?{positionH:e}:{},...a?{positionV:a}:{},...n?{wrap:n}:{}}}async function lb(t,e,a,n){const r=lv(t,"blip");if(!r)return{text:"",image:void 0};const{embed:o,link:i}=function(t){const e={};for(let a=0;a<t.attributes.length;a+=1){const n=t.attributes[a];n&&("embed"===n.localName||"r:embed"===n.name?e.embed=n.value:"link"!==n.localName&&"r:link"!==n.name||(e.link=n.value))}return e}(r),l=function(t){for(let e=0;e<t.childNodes.length;e+=1){const a=t.childNodes[e];if((null==a?void 0:a.nodeType)!==a.ELEMENT_NODE)continue;const n=a;if("inline"===n.localName||"anchor"===n.localName)return{element:n,kind:n.localName}}}(t),s=(null==l?void 0:l.element)??t,d=lv(s,"extent"),c=lv(s,"docPr");let h=300,p=300;if(d){const t=d.getAttribute("cx"),e=d.getAttribute("cy");t&&(h=Math.round(parseInt(t,10)/jv)),e&&(p=Math.round(parseInt(e,10)/jv))}const u=c?iv(c,"descr")??iv(c,"title"):null,f=function(t){const e=lv(t,"srcRect");if(!e)return;const a=t=>{const a=e.getAttribute(t);if(null===a||""===a)return;const n=parseInt(a,10);return Number.isFinite(n)&&0!==n?n/1e5:void 0},n={left:a("l"),top:a("t"),right:a("r"),bottom:a("b")};return void 0!==n.left||void 0!==n.top||void 0!==n.right||void 0!==n.bottom?n:void 0}(t),g=function(t){if(lv(t,"tile"))return"tile"}(t),m=function(t){const e=lv(t,"xfrm");if(!e)return{};const a={},n=e.getAttribute("rot");if(n){const t=parseInt(n,10);Number.isFinite(t)&&0!==t&&(a.rotation=t/6e4)}const r=e.getAttribute("flipH");"1"!==r&&"true"!==r||(a.flipH=!0);const o=e.getAttribute("flipV");return"1"!==o&&"true"!==o||(a.flipV=!0),a}(t),v="anchor"===(null==l?void 0:l.kind)?ib(l.element):void 0,b="anchor"===(null==l?void 0:l.kind)?function(t){const e=lv(t,"wrapPolygon");if(!e)return;const a=[];for(let n=0;n<e.childNodes.length;n+=1){const t=e.childNodes[n];if(1!==(null==t?void 0:t.nodeType))continue;const r=t;if("start"!==r.localName&&"lineTo"!==r.localName)continue;const o=ob(r.getAttribute("x")),i=ob(r.getAttribute("y"));void 0!==o&&void 0!==i&&a.push({x:o/21600,y:i/21600})}if(a.length>=2){const t=a[0],e=a[a.length-1];Math.abs(t.x-e.x)<1e-6&&Math.abs(t.y-e.y)<1e-6&&a.pop()}return a.length>=3?a:void 0}(l.element):void 0,y={width:h,height:p,...null!==u?{alt:u}:{},...f?{crop:f}:{},...g?{fillMode:g}:{},...void 0!==m.rotation?{rotation:m.rotation}:{},...m.flipH?{flipH:!0}:{},...m.flipV?{flipV:!0}:{},...v?{floating:v}:{},...b?{wrapPolygon:b}:{}},M=o?a.get(o):void 0,x=i?a.get(i):void 0;if(x&&function(t){return/^[a-z][a-z0-9+.-]*:\/\//i.test(t)||t.startsWith("//")}(x))return{text:"",image:{src:"",linkedSrc:x,...y}};const w=M??x;if(w){const t=await ab(e,n,w);if(t)return{text:"",image:{src:t,...y}}}return{text:"",image:void 0}}function sb(t){const e=null==t?void 0:t.trim();if(!e)return;if(e.endsWith("%")){const t=Number(e.slice(0,-1));return Number.isFinite(t)&&0!==t?t/100:void 0}if(/f$/i.test(e)){const t=Number(e.slice(0,-1));return Number.isFinite(t)&&0!==t?t/65536:void 0}const a=Number(e);return Number.isFinite(a)&&0!==a?a/65536:void 0}async function db(t,e,a,n){const r=lv(t,"imagedata");if(!r)return;const o=function(t){for(let e=0;e<t.attributes.length;e+=1){const a=t.attributes[e];if(a&&("id"===a.localName||"r:id"===a.name))return a.value}}(r),i=o?a.get(o):void 0;if(!i)return;const l=lv(t,"shape"),s=function(t){const e={};if(!t)return e;for(const a of t.split(";")){const t=a.indexOf(":");if(t<0)continue;const n=a.slice(0,t).trim().toLowerCase(),r=a.slice(t+1).trim();if("width"===n){const t=Qv(r);null!==t&&(e.width=t)}else if("height"===n){const t=Qv(r);null!==t&&(e.height=t)}}return e}(null==l?void 0:l.getAttribute("style")),d=function(t){const e={left:sb(iv(t,"cropleft")),top:sb(iv(t,"croptop")),right:sb(iv(t,"cropright")),bottom:sb(iv(t,"cropbottom"))};if(void 0!==e.left||void 0!==e.top||void 0!==e.right||void 0!==e.bottom)return e}(r),c=iv(r,"title")??r.getAttribute("o:title"),h=await ab(e,n,i);return h?{src:h,width:s.width??300,height:s.height??300,...c?{alt:c}:{},...d?{crop:d}:{}}:void 0}function cb(t){return"1"===t||"true"===t||"0"!==t&&"false"!==t&&void 0}function hb(t,e){var a,n,r,o;const i=lv(t,e);if(!i)return;const l=null==(n=null==(a=lv(i,"align"))?void 0:a.textContent)?void 0:n.trim(),s=Yv(null==(o=null==(r=lv(i,"posOffset"))?void 0:r.textContent)?void 0:o.trim()),d={relativeFrom:i.getAttribute("relativeFrom")??void 0,...l?{align:l}:{},...void 0!==s?{offset:s}:{}};return void 0!==d.relativeFrom||void 0!==d.align||void 0!==d.offset?d:void 0}function pb(t){const e=hb(t,"positionH"),a=hb(t,"positionV"),n=function(t){return lv(t,"wrapSquare")?"square":lv(t,"wrapTight")?"tight":lv(t,"wrapThrough")?"through":lv(t,"wrapTopAndBottom")?"topAndBottom":lv(t,"wrapNone")?"none":void 0}(t),r=Yv(t.getAttribute("distT")),o=Yv(t.getAttribute("distB")),i=Yv(t.getAttribute("distL")),l=Yv(t.getAttribute("distR")),s=cb(t.getAttribute("simplePos")),d=Yv(t.getAttribute("relativeHeight")),c=cb(t.getAttribute("behindDoc")),h=cb(t.getAttribute("locked")),p=cb(t.getAttribute("layoutInCell")),u=cb(t.getAttribute("allowOverlap"));return{type:"floating",...void 0!==r?{distT:r}:{},...void 0!==o?{distB:o}:{},...void 0!==i?{distL:i}:{},...void 0!==l?{distR:l}:{},...void 0!==s?{simplePos:s}:{},...void 0!==d?{relativeHeight:d}:{},...void 0!==c?{behindDoc:c}:{},...void 0!==h?{locked:h}:{},...void 0!==p?{layoutInCell:p}:{},...void 0!==u?{allowOverlap:u}:{},...e?{positionH:e}:{},...a?{positionV:a}:{},...n?{wrap:n}:{}}}async function ub(t,e){const a=lv(t,"wsp");if(!a)return;const n=function(t){for(let e=0;e<t.childNodes.length;e+=1){const a=t.childNodes[e];if((null==a?void 0:a.nodeType)!==a.ELEMENT_NODE)continue;const n=a;if("inline"===n.localName||"anchor"===n.localName)return{element:n,kind:n.localName}}}(t),r=(null==n?void 0:n.element)??t,o=lv(r,"extent"),i=Jv(null==o?void 0:o.getAttribute("cx"))??300,l=Jv(null==o?void 0:o.getAttribute("cy"))??300,s=lv(r,"docPr"),d=s?iv(s,"name"):null,c=s?iv(s,"descr")??iv(s,"title"):null,h="anchor"===(null==n?void 0:n.kind)?pb(n.element):void 0,p=lv(a,"txbxContent"),u=p&&e?await e(p):[],f=function(t){var e,a;const n=lv(t,"spPr");if(!n)return;const r={},o=lv(n,"prstGeom"),i=null==o?void 0:o.getAttribute("prst");i&&(r.preset=i);for(let l=0;l<n.childNodes.length;l+=1){const t=n.childNodes[l];if((null==t?void 0:t.nodeType)!==t.ELEMENT_NODE)continue;const o=t;if("solidFill"===o.localName){const t=_v(null==(e=lv(o,"srgbClr"))?void 0:e.getAttribute("val"));t&&(r.fill=t)}else if("ln"===o.localName){const t=Yv(o.getAttribute("w"));void 0!==t&&(r.borderWidthPt=Math.round(t/12700*100)/100);const e=_v(null==(a=lv(o,"srgbClr"))?void 0:a.getAttribute("val"));e&&(r.borderColor=e)}}return Object.keys(r).length>0?r:void 0}(a),g=function(t){const e=lv(t,"bodyPr");if(!e)return;const a={},n=Jv(e.getAttribute("lIns")),r=Jv(e.getAttribute("tIns")),o=Jv(e.getAttribute("rIns")),i=Jv(e.getAttribute("bIns"));void 0!==n&&(a.paddingLeft=n),void 0!==r&&(a.paddingTop=r),void 0!==o&&(a.paddingRight=o),void 0!==i&&(a.paddingBottom=i);const l=e.getAttribute("anchor");l&&(a.anchor=l);const s=e.getAttribute("wrap");s&&(a.wrap=s);const d=e.getAttribute("vert");return"vert"!==d&&"vert270"!==d&&"wordArtVert"!==d||(a.vert=d),lv(e,"spAutoFit")&&(a.autoFit=!0),Object.keys(a).length>0?a:void 0}(a),m=function(t){const e=lv(t,"spPr");if(!e)return;const a=lv(e,"xfrm"),n=Yv(null==a?void 0:a.getAttribute("rot"));return void 0!==n&&0!==n&&(Math.round(n/6e4)%360+360)%360||void 0}(a);return{width:i,height:l,blocks:u,...h?{floating:h}:{},...void 0!==m?{rotation:m}:{},...d?{name:d}:{},...c?{alt:c}:{},...f?{shape:f}:{},...g?{body:g}:{}}}function fb(t){let e;for(let a=0;a<t.childNodes.length;a+=1){const n=t.childNodes[a];if((null==n?void 0:n.nodeType)!==n.ELEMENT_NODE)continue;const r=n;if("Choice"!==r.localName)continue;const o=lv(r,"drawing");if(!o)continue;void 0===e&&(e=o);const i=r.getAttribute("Requires")??"";if(/\bwps\b/.test(i))return o}return e}function gb(t){const e=iv(t,"id");if(!e)return;if("bookmarkEnd"===t.localName)return{kind:"end",docxId:e};const a=iv(t,"name")??void 0,n=iv(t,"colFirst"),r=iv(t,"colLast"),o=null!==n?Number.parseInt(n,10):void 0,i=null!==r?Number.parseInt(r,10):void 0;return{kind:"start",docxId:e,...void 0!==a?{name:a}:{},...void 0===o||Number.isNaN(o)?{}:{colFirst:o},...void 0===i||Number.isNaN(i)?{}:{colLast:i}}}function mb(t){const e=iv(t,"id");if(e)return{kind:"commentRangeEnd"===t.localName?"end":"start",docxId:e}}async function vb(t,e,a,n,r){const o=[];let i,l,s,d=0;const c=[],h=[],p=t=>{o.push(t),d+=t.length},u=t.childNodes;for(let f=0;f<u.length;f+=1){const t=u[f];if((null==t?void 0:t.nodeType)!==t.ELEMENT_NODE)continue;const o=t;if(o.namespaceURI===$m)if("t"===o.localName)p(o.textContent??"");else if("tab"===o.localName)p("\t");else if("noBreakHyphen"===o.localName)p("‑");else if("softHyphen"===o.localName)p("");else if("br"===o.localName)p("page"===iv(o,"type")?"\f":"\n");else{if("lastRenderedPageBreak"===o.localName)continue;if("bookmarkStart"===o.localName||"bookmarkEnd"===o.localName){const t=gb(o);t&&c.push({offset:d,marker:t});continue}if("commentRangeStart"===o.localName||"commentRangeEnd"===o.localName){const t=mb(o);t&&h.push({offset:d,marker:t});continue}if("proofErr"===o.localName||"commentReference"===o.localName||"permStart"===o.localName||"permEnd"===o.localName)continue;if("cr"===o.localName)p("\n");else if("drawing"===o.localName){const t=await lb(o,e,a,n);if(t.image)p(t.text),i=t.image;else{const t=await ub(o,r);t&&(p(""),l=t)}}else if("pict"===o.localName){const t=await db(o,e,a,n);t&&(p(""),i=t)}else if("sym"===o.localName){const t=iv(o,"font")??"",e=iv(o,"char")??"",a=parseInt(e,16);p(Number.isFinite(a)&&a>0?String.fromCodePoint(a):"?"),s={font:t,char:e}}}else if("AlternateContent"===o.localName){const t=fb(o);if(t){const e=await ub(t,r);e&&(p(""),l=e)}}}return{text:o.join(""),image:i,...l?{textBox:l}:{},...c.length>0?{innerBookmarks:c}:{},...h.length>0?{innerComments:h}:{},...s?{sym:s}:{}}}async function bb(t,e,a,n,r,o,i,l){var s,d,c;const h=[],p=[],u=(t,e)=>{const a=iv(t,"fldCharType"),n=iv(t,"fldLock"),r=iv(t,"dirty"),o="true"===n||"1"===n,i="true"===r||"1"===r;if("begin"===a)h.push({text:"",fieldChar:{kind:"begin",...o?{fieldLock:!0}:{},...i?{dirty:!0}:{}},...e?{styles:e}:{}}),p.push({beginIndex:h.length-1,instruction:"",...e?{beginStyles:e}:{}});else if("separate"===a)h.push({text:"",fieldChar:{kind:"separate"},...e?{styles:e}:{}});else if("end"===a){h.push({text:"",fieldChar:{kind:"end"},...e?{styles:e}:{}});const t=p.pop();t&&(t=>{var e;const a=/\bNUMPAGES\b/i.test(t.instruction)?"NUMPAGES":/\bPAGE\b/i.test(t.instruction)?"PAGE":null;if(!a)return;const n=h.slice(t.beginIndex);if(n.some(t=>t.bookmark))return;const r=n.filter(t=>!t.fieldChar&&void 0===t.fieldInstruction),o=r.map(t=>t.text).join("")||"1",i=(null==(e=r.find(t=>t.styles))?void 0:e.styles)??t.beginStyles;h.length=t.beginIndex,h.push({text:o,...i?{styles:i}:{},field:{type:a}})})(t)}},f=(t,e)=>{const a=t.textContent??"";h.push({text:"",fieldInstruction:a,...e?{styles:e}:{}});const n=p[p.length-1];n&&(n.instruction+=a)};for(let g=0;g<t.childNodes.length;g+=1){const p=t.childNodes[g];if((null==p?void 0:p.nodeType)!==p.ELEMENT_NODE)continue;const m=p;if(m.namespaceURI===$m){if("bookmarkStart"===m.localName||"bookmarkEnd"===m.localName){const t=gb(m);if(!t)continue;h.push({text:"",bookmark:t});continue}if("commentRangeStart"===m.localName||"commentRangeEnd"===m.localName){const t=mb(m);if(!t)continue;h.push({text:"",comment:t});continue}if("r"===m.localName){const t=qv(ov(m,$m,"rPr"),o);if(av(m,$m,"fldChar").length>0||av(m,$m,"instrText").length>0){for(let e=0;e<m.childNodes.length;e+=1){const a=m.childNodes[e];if((null==a?void 0:a.nodeType)!==a.ELEMENT_NODE)continue;const n=a;n.namespaceURI===$m&&("fldChar"===n.localName?u(n,t):"instrText"===n.localName&&f(n,t))}continue}const e=ov(m,$m,"footnoteReference");if(e){const a=iv(e,"id");if(!a)continue;const n=iv(e,"customMarkFollows");let r=t;(s=r??(r={})).styleId??(s.styleId="footnoteReference"),void 0===r.superscript&&(r.superscript=!0),h.push({text:"?",styles:r,footnoteReference:{docxId:a,...n?{customMark:n}:{}}});continue}const c=ov(m,$m,"endnoteReference");if(c){const e=iv(c,"id");if(!e)continue;const a=iv(c,"customMarkFollows");let n=t;(d=n??(n={})).styleId??(d.styleId="endnoteReference"),void 0===n.superscript&&(n.superscript=!0),h.push({text:"?",styles:n,endnoteReference:{docxId:e,...a?{customMark:a}:{}}});continue}const{text:p,image:g,textBox:v,innerBookmarks:b,innerComments:y,sym:M}=await vb(m,a,n,r,l);let x=t;M&&!(null==x?void 0:x.fontFamily)&&((x??(x={})).fontFamily=M.font),i&&((x??(x={})).link=i);const w=[...(b??[]).map(t=>({offset:t.offset,run:{text:"",bookmark:t.marker}})),...(y??[]).map(t=>({offset:t.offset,run:{text:"",comment:t.marker}}))];if(w.length>0&&!g&&!v){w.sort((t,e)=>t.offset-e.offset);let t=0;for(const a of w){const e=p.slice(t,a.offset);e.length>0&&h.push({text:e,...x?{styles:x}:{}}),h.push(a.run),t=a.offset}const e=p.slice(t);e.length>0&&h.push({text:e,...x?{styles:x}:{}});continue}if(0===p.length&&!g&&!v)continue;if(h.push({text:p,...g?{image:g}:{},...v?{textBox:v}:{},...M?{sym:M}:{},...x?{styles:x}:{}}),b)for(const a of b)h.push({text:"",bookmark:a.marker});continue}if("fldSimple"===m.localName){const t=m.getAttribute("w:instr")??m.getAttributeNS($m,"instr")??m.getAttribute("instr")??"",s=/\bNUMPAGES\b/i.test(t)?"NUMPAGES":/\bPAGE\b/i.test(t)?"PAGE":null,d=await bb(m,e,a,n,r,o,i,l);if(s){const t=d.map(t=>t.text).join("")||"1",e=null==(c=d.find(t=>t.styles))?void 0:c.styles;h.push({text:t,styles:e,field:{type:s}})}else h.push({text:"",fieldChar:{kind:"begin"}}),h.push({text:"",fieldInstruction:t}),h.push({text:"",fieldChar:{kind:"separate"}}),h.push(...d),h.push({text:"",fieldChar:{kind:"end"}});continue}if("hyperlink"===m.localName){let t=n.get(m.getAttribute("r:id")??m.getAttributeNS("http://schemas.openxmlformats.org/officeDocument/2006/relationships","id")??"")??null;if(!t){const e=iv(m,"anchor");e&&(t=`#${e}`)}h.push(...await bb(m,e,a,n,r,o,t,l))}}}return h}function yb(t){if(!t)return;const e=iv(t,"type"),a=iv(t,"w");if("auto"===e)return"auto";if("pct"===e){if(!a)return;const t=a.trim().endsWith("%")?Number.parseFloat(a):Number(a)/50;return Number.isFinite(t)?Math.round(1e4*t)/1e4+"%":void 0}return yv(a)}function Mb(t,e){const a=iv(ov(t,$m,e),"val"),n=a?Number(a):Number.NaN;return Number.isFinite(n)&&n>0?Math.floor(n):void 0}function xb(t,e){if(!t)return;const a=new Set(e),n=new Qm,r=[],o=t.childNodes;for(let i=0;i<o.length;i+=1){const t=o[i];(null==t?void 0:t.nodeType)===t.ELEMENT_NODE&&t.namespaceURI===$m&&a.has(t.localName??"")&&r.push(n.serializeToString(t))}return r.length>0?r:void 0}function wb(t){if(!t)return;const e=e=>yv(iv(ov(t,$m,e),"w")),a={},n=e("top"),r=e("right"),o=e("bottom"),i=e("left"),l=e("start"),s=e("end");return void 0!==n&&(a.top=n),void 0!==r&&(a.right=r),void 0!==o&&(a.bottom=o),void 0!==i&&(a.left=i),void 0!==l&&(a.start=l),void 0!==s&&(a.end=s),Object.keys(a).length>0?a:void 0}function Sb(t,e){const a={};e&&(a.styleId=e);const n=iv(ov(t,$m,"tblCaption"),"val");n&&(a.altTitle=n);const r=iv(ov(t,$m,"tblDescription"),"val");r&&(a.altDescription=r);const o=yb(ov(t,$m,"tblW"));void 0!==o&&(a.width=o);const i=yb(ov(t,$m,"tblInd"));void 0!==i&&(a.indentLeft=i);const l=iv(ov(t,$m,"jc"),"val");"left"!==l&&"center"!==l&&"right"!==l||(a.align=l);const s=function(t){const e=iv(ov(t,$m,"tblLayout"),"type");return"fixed"===e||"autofit"===e?e:void 0}(t);s&&(a.layout=s);const d=yb(ov(t,$m,"tblCellSpacing"));void 0!==d&&(a.cellSpacing=d);const c=wb(ov(t,$m,"tblCellMar"));c&&(a.defaultCellMargins=c);const h=t?dv(t,"bidiVisual"):void 0;void 0!==h&&(a.bidiVisual=h);const p=iv(ov(t,$m,"tblOverlap"),"val");p&&(a.tblOverlap=p);const u=function(t){const e=ov(t,$m,"tblpPr");if(!e||!e.attributes||0===e.attributes.length)return;const a={};for(let n=0;n<e.attributes.length;n+=1){const t=e.attributes.item(n);(null==t?void 0:t.namespaceURI)!==$m&&"w"!==(null==t?void 0:t.prefix)||(a[t.localName||t.name.replace(/^w:/,"")]=t.value)}return Object.keys(a).length>0?a:void 0}(t);u&&(a.floating=u);const f=xb(t,["tblPrChange"]);return f&&(a.revisionXml=f),Rv(a)}function Ab(t){if(!t)return;const e={},a=Mb(t,"gridBefore");void 0!==a&&(e.gridBefore=a);const n=Mb(t,"gridAfter");void 0!==n&&(e.gridAfter=n);const r=yb(ov(t,$m,"wBefore"));void 0!==r&&(e.widthBefore=r);const o=yb(ov(t,$m,"wAfter"));void 0!==o&&(e.widthAfter=o);const i=ov(t,$m,"trHeight"),l=yv(iv(i,"val"));void 0!==l&&(e.height=l);const s=iv(i,"hRule");"auto"!==s&&"exact"!==s&&"atLeast"!==s||(e.heightRule=s);const d=yb(ov(t,$m,"tblCellSpacing"));void 0!==d&&(e.cellSpacing=d);const c=dv(t,"cantSplit");void 0!==c&&(e.cantSplit=c);const h=dv(t,"hidden");void 0!==h&&(e.hidden=h);const p=xb(t,["trPrChange","ins","del"]);return p&&(e.revisionXml=p),Rv(e)}function Ib(t){if(!t)return 1;const e=iv(ov(t,$m,"gridSpan"),"val"),a=e?Number(e):1;return Number.isFinite(a)&&a>1?Math.floor(a):1}function Tb(t){if(!t)return;const e=ov(t,$m,"vMerge");if(!e)return;return"restart"===iv(e,"val")?"restart":"continue"}function Cb(t,e){if(!t){if(!e)return;return Rv({paddingTop:e.top,paddingRight:e.right,paddingBottom:e.bottom,paddingLeft:e.left,paddingStart:e.start,paddingEnd:e.end})}const a={...void 0!==(null==e?void 0:e.top)?{paddingTop:e.top}:{},...void 0!==(null==e?void 0:e.right)?{paddingRight:e.right}:{},...void 0!==(null==e?void 0:e.bottom)?{paddingBottom:e.bottom}:{},...void 0!==(null==e?void 0:e.left)?{paddingLeft:e.left}:{},...void 0!==(null==e?void 0:e.start)?{paddingStart:e.start}:{},...void 0!==(null==e?void 0:e.end)?{paddingEnd:e.end}:{}},n=zv(ov(t,$m,"shd"));n&&(a.shading=n);const r=ov(t,$m,"tcW"),o=iv(r,"type"),i=iv(r,"w");if("dxa"===o){const t=yv(i);void 0!==t&&(a.width=t)}else if("pct"===o&&i){const t=Number(i);Number.isFinite(t)&&(a.width=Math.round(t/50*1e4)/1e4+"%")}const l=wb(ov(t,$m,"tcMar"));l&&(void 0!==l.top&&(a.paddingTop=l.top),void 0!==l.bottom&&(a.paddingBottom=l.bottom),void 0!==l.left&&(a.paddingLeft=l.left),void 0!==l.right&&(a.paddingRight=l.right),void 0!==l.start&&(a.paddingStart=l.start),void 0!==l.end&&(a.paddingEnd=l.end));const s=function(t){if(!t)return;const e=iv(ov(t,$m,"vAlign"),"val");return"top"===e||"bottom"===e?e:"center"===e?"middle":void 0}(t);s&&(a.verticalAlign=s);const d=rv(iv(ov(t,$m,"textDirection"),"val"));d&&(a.textDirection=d);const c=dv(t,"noWrap");void 0!==c&&(a.noWrap=c);const h=dv(t,"tcFitText");void 0!==h&&(a.fitText=h);const p=dv(t,"hideMark");void 0!==p&&(a.hideMark=p);const u=iv(ov(t,$m,"headers"),"val");u&&(a.headers=u);const f=xb(t,["tcPrChange","cellIns","cellDel","cellMerge"]);f&&(a.revisionXml=f);for(const[g,m]of Object.entries(function(t){return t?Pv(ov(t,$m,"tcBorders")):{}}(t)))m&&(a[g]=m);return Rv(a)}function kb(t){const e=ov(t,$m,"trPr");return!!e&&!0===dv(e,"tblHeader")}function Vb(t,e){var a,n;const r=t=>t.style??(t.style={}),o=t.length-1;for(let i=0;i<t.length;i+=1){const a=e[i];a&&(0===i&&a.before&&(r(t[i]).spacingBefore=0),i===o&&a.after&&(r(t[i]).spacingAfter=0))}for(let i=0;i<o;i+=1){if(!(null==(a=e[i])?void 0:a.after)||!(null==(n=e[i+1])?void 0:n.before))continue;const o=r(t[i]),l=r(t[i+1]);(o.spacingAfter??0)>=(l.spacingBefore??0)?l.spacingBefore=0:o.spacingAfter=0}}function Eb(t,e,a,n,r,o,i){const l=r.firstRow&&0===t,s=r.lastRow&&t===a-1&&0!==t,d=r.firstCol&&0===e,c=r.lastCol&&e===n-1&&0!==e,h=[];if(!r.noHBand&&!l&&!s){const e=t-(r.firstRow?1:0),a=Math.floor(e/Math.max(1,o))%2;h.push(0===a?"band1Horz":"band2Horz")}if(!r.noVBand&&!d&&!c){const t=e-(r.firstCol?1:0),a=Math.floor(t/Math.max(1,i))%2;h.push(0===a?"band1Vert":"band2Vert")}return c&&h.push("lastCol"),d&&h.push("firstCol"),s&&h.push("lastRow"),l&&h.push("firstRow"),l&&d&&h.push("nwCell"),l&&c&&h.push("neCell"),s&&d&&h.push("swCell"),s&&c&&h.push("seCell"),h}function Rb(t,e){const a={};if(!e)return a;for(const n of t){const t=e[n];t&&(t.shading&&(a.shading=t.shading),t.textStyle&&(a.textStyle={...a.textStyle,...t.textStyle}),t.borders&&(a.borders={...a.borders,...t.borders}),t.paragraphStyle&&(a.paragraphStyle={...a.paragraphStyle,...t.paragraphStyle}),t.rowStyle&&(a.rowStyle={...a.rowStyle,...t.rowStyle}))}return a}function Lb(t,e){if(e&&0!==Object.keys(e).length)for(const a of t)for(const t of a.runs)t.styles={...e,...t.styles}}async function zb(t,e,a,n,r,o,i){var l,s;const d=[],c=ov(t,$m,"tblGrid");if(c)for(const V of av(c,$m,"gridCol")){const t=yv(iv(V,"w"));void 0!==t&&d.push(t)}const h=ov(c,$m,"tblGridChange"),p=ov(t,$m,"tblPr"),u=iv(ov(p,$m,"tblStyle"),"val"),f=u&&(null==(l=null==i?void 0:i[u])?void 0:l.paragraphStyle)?i[u].paragraphStyle:void 0,g=(m=ov(p,$m,"tblBorders"))?{...Pv(m),borderInsideH:Ov(ov(m,$m,"insideH")),borderInsideV:Ov(ov(m,$m,"insideV"))}:{};var m;const v=u?null==(s=null==i?void 0:i[u])?void 0:s.tableStyle:void 0,b=Sb(p,u??void 0),y=null==b?void 0:b.defaultCellMargins,M=(null==v?void 0:v.conditionalFormats)??void 0,x=function(t){const e=ov(t,$m,"tblLook"),a=t=>{const a=iv(e,t);return null===a||""===a?void 0:sv(a)},n=iv(e,"val"),r=n?Number.parseInt(n,16):Number.NaN,o=t=>Number.isFinite(r)?0!==(r&t):void 0;return{firstRow:a("firstRow")??o(32)??!0,lastRow:a("lastRow")??o(64)??!1,firstCol:a("firstColumn")??o(128)??!0,lastCol:a("lastColumn")??o(256)??!1,noHBand:a("noHBand")??o(512)??!1,noVBand:a("noVBand")??o(1024)??!1}}(p),w=(null==v?void 0:v.rowBandSize)??1,S=(null==v?void 0:v.colBandSize)??1,A=av(t,$m,"tr"),I=A.length,T=d.length>0?d.length:A.reduce((t,e)=>Math.max(t,av(e,$m,"tc").length),0),C=[];for(let V=0;V<A.length;V+=1){const t=A[V],i=ov(t,$m,"trPr"),l=ov(i,$m,"cnfStyle"),s=[];"1"===iv(l,"firstRow")&&s.push("firstRow"),"1"===iv(l,"lastRow")&&s.push("lastRow");const d=av(t,$m,"tc"),c=[];for(let g=0;g<d.length;g+=1){const t=d[g],i=[],l=[],h=ov(t,$m,"tcPr");for(const s of av(t,$m,"p"))i.push(await Pb(s,e,a,n,r,o,f)),l.push(Hv(ov(s,$m,"pPr")));Vb(i,l);const p=Ib(h),u=Tb(h),m=Cb(h,y),v=Rb([...Eb(V,g,I,T,x,w,S),...s],M);if(Lb(i,v.textStyle),v.paragraphStyle){const t=v.paragraphStyle;for(const e of i)e.style={...t,...e.style}}const b=Ma(i.length>0?i:[ya([{text:""}])],p,"restart"===u?{rowSpan:1,vMerge:u}:u?{vMerge:u}:void 0),A={...m??{}},C=(null==m?void 0:m.shading)??v.shading;if(C&&(A.shading=C),v.borders)for(const e of["borderTop","borderRight","borderBottom","borderLeft"]){const t=v.borders[e];void 0===A[e]&&t&&(A[e]=t)}Object.keys(A).length>0&&(b.style=A),"continue"===u&&(b.blocks=[]),c.push(b)}const h=xa(c,kb(t)?{isHeader:!0}:void 0),p=Ab(i);if(p&&(h.style=p),M){const t=Eb(V,0,I,Math.max(1,T),x,w,S).filter(t=>"firstRow"===t||"lastRow"===t||"band1Horz"===t||"band2Horz"===t),e=Rb([...s,...t],M);e.rowStyle&&(h.style={...e.rowStyle,...h.style})}const u=ov(t,$m,"tblPrEx");u&&(h.tblPrExXml=(new Qm).serializeToString(u)),C.push(h)}!function(t,e){if(0===Object.keys(e).length)return;const a=t.length-1;for(let n=0;n<=a;n+=1){const r=t[n],o=r.cells.length-1;for(let t=0;t<=o;t+=1){const i=r.cells[t],l=i.style??{};0===n&&void 0===l.borderTop&&e.borderTop&&(l.borderTop=e.borderTop),n===a&&void 0===l.borderBottom&&e.borderBottom&&(l.borderBottom=e.borderBottom),0===t&&void 0===l.borderLeft&&e.borderLeft&&(l.borderLeft=e.borderLeft),t===o&&void 0===l.borderRight&&e.borderRight&&(l.borderRight=e.borderRight),n<a&&void 0===l.borderBottom&&e.borderInsideH&&(l.borderBottom=e.borderInsideH),t<o&&void 0===l.borderRight&&e.borderInsideV&&(l.borderRight=e.borderInsideV),Object.keys(l).length>0&&i.style!==l&&(i.style=l)}}}(C,g);for(let V=0;V<C.length;V+=1){const t=C[V];for(let e=0;e<t.cells.length;e+=1){const a=t.cells[e];if("restart"!==a.vMerge)continue;let n=1;for(let t=V+1;t<C.length;t+=1){const a=C[t].cells[e];if(!a||"continue"!==a.vMerge)break;n+=1}n>1&&(a.rowSpan=n)}}const k=wa(C,d.length>0?d:void 0);return b&&(k.style=b),k.style?k.style.tblLook=x:u&&(k.style={tblLook:x}),h&&(k.tblGridChangeXml=(new Qm).serializeToString(h)),k}function Nb(t,e,a,n){var r;const o=ya(t.length>0?t.map(t=>({text:t.text,styles:t.styles,image:t.image})):[{text:"",styles:n}]);t.forEach((t,e)=>{t.field&&(o.runs[e].field={...t.field}),t.fieldChar&&(o.runs[e].fieldChar={...t.fieldChar}),void 0!==t.fieldInstruction&&(o.runs[e].fieldInstruction=t.fieldInstruction),t.textBox&&(o.runs[e].textBox=t.textBox),t.footnoteReference&&(o.runs[e].__importedFootnoteRef={...t.footnoteReference}),t.endnoteReference&&(o.runs[e].__importedEndnoteRef={...t.endnoteReference}),t.bookmark&&(o.runs[e].__importedBookmark={...t.bookmark}),t.comment&&(o.runs[e].__importedComment={...t.comment}),t.sym&&(o.runs[e].sym={...t.sym})}),o.style=e?{...e}:void 0;for(const i of o.runs)i.styles=Nv(i.styles,null==(r=o.style)?void 0:r.styleId);return o.list=a?{...a}:void 0,o}function qb(t){return t.some(t=>t.image||t.textBox||t.field||t.fieldChar||void 0!==t.fieldInstruction||t.bookmark||t.comment||t.text.replace(/\s/g,"").length>0)}async function Ob(t,e,a,n,r,o,i){const l=ov(t,$m,"pPr"),s=await bb(t,e,a,n,r,o,void 0,t=>async function(t,e,a,n,r,o){const i=[];for(let l=0;l<t.childNodes.length;l+=1){const s=t.childNodes[l];if((null==s?void 0:s.nodeType)!==s.ELEMENT_NODE)continue;const d=s;if(d.namespaceURI===$m)if("p"===d.localName){const t=await Ob(d,e,a,n,r,o);for(const e of t.paragraphs)i.push(e)}else"tbl"===d.localName&&i.push(await zb(d,e,a,n,r,o))}return i}(t,e,a,n,r,o)),d=Wv(Uv(l)),c=qv(ov(l,$m,"rPr"),o),h=function(t,e){if(!t)return;const a=ov(t,$m,"numPr");if(!a)return;const n=iv(ov(a,$m,"numId"),"val");if(!n)return;const r=iv(ov(a,$m,"ilvl"),"val")??"0",o=Number(r),i=e.numToAbstractId.get(n),l=i?`${i}:${r}`:void 0,s=l?e.abstractIndents.get(l):void 0,d=(l?e.abstractSuffixes.get(l):void 0)??"tab",c=l?e.abstractFormats.get(l):void 0,h=l?e.abstractBulletGlyphs.get(l):void 0,p=l?e.abstractBulletFonts.get(l):void 0,u=`${n}:${r}`,f=!e.seenInstances.has(u);let g;if(e.seenInstances.add(u),f){const t=e.numStartOverrides.get(u),a=l?e.abstractStarts.get(l):void 0,n=t??a??1;1!==n&&(g=n)}return{list:{kind:e.numKinds.get(n)??"ordered",level:Number.isFinite(o)?o:0,suffix:d,...void 0!==c&&{format:c},...void 0!==g&&{startAt:g},...void 0!==h&&{bulletGlyph:h},...void 0!==p&&{bulletFont:p}},indent:s}}(l,e),p=null==h?void 0:h.list;let u=d;if(null==h?void 0:h.indent){const{left:t,hanging:e}=h.indent,a=d??{};u={...a,...void 0===a.indentLeft&&void 0!==t?{indentLeft:t}:{},...void 0===a.indentHanging&&void 0!==e?{indentHanging:e}:{}}}const f=function(t){if(!t)return;const e=qe(t,Ia),a=qe(void 0,Ia);return Ev({styleId:t.styleId,align:e.align!==a.align?e.align:void 0,spacingBefore:e.spacingBefore!==a.spacingBefore?e.spacingBefore:void 0,spacingAfter:e.spacingAfter!==a.spacingAfter?e.spacingAfter:void 0,contextualSpacing:void 0!==t.contextualSpacing||e.contextualSpacing!==a.contextualSpacing?e.contextualSpacing:void 0,lineHeight:e.lineHeight!==a.lineHeight?e.lineHeight:void 0,lineRule:e.lineRule??void 0,lineGridPitch:t.lineGridPitch??void 0,snapToGrid:void 0!==t.snapToGrid||e.snapToGrid!==a.snapToGrid?e.snapToGrid:void 0,indentLeft:void 0!==t.indentLeft||e.indentLeft!==a.indentLeft?e.indentLeft:void 0,indentRight:void 0!==t.indentRight||e.indentRight!==a.indentRight?e.indentRight:void 0,indentFirstLine:void 0!==t.indentFirstLine||e.indentFirstLine!==a.indentFirstLine?e.indentFirstLine:void 0,indentHanging:void 0!==t.indentHanging||e.indentHanging!==a.indentHanging?e.indentHanging:void 0,pageBreakBefore:void 0!==t.pageBreakBefore||e.pageBreakBefore!==a.pageBreakBefore?e.pageBreakBefore:void 0,keepWithNext:void 0!==t.keepWithNext||e.keepWithNext!==a.keepWithNext?e.keepWithNext:void 0,keepLinesTogether:void 0!==t.keepLinesTogether||e.keepLinesTogether!==a.keepLinesTogether?e.keepLinesTogether:void 0,widowControl:void 0!==t.widowControl||e.widowControl!==a.widowControl?e.widowControl:void 0,shading:t.shading??void 0,borderTop:t.borderTop??void 0,borderRight:t.borderRight??void 0,borderBottom:t.borderBottom??void 0,borderLeft:t.borderLeft??void 0,tabs:t.tabs??void 0,textDirection:t.textDirection??void 0,outlineLevel:t.outlineLevel??void 0})}(i?{...i,...u??{}}:u),g=function(t,e){var a;const n=ov(t,$m,"framePr");if(!n)return null;const r=iv(n,"dropCap");if(!r||"none"===r)return null;const o=e.map(t=>t.text).join("");if(0===o.length)return null;const i=Number(iv(n,"lines"));return{text:o,lines:Number.isFinite(i)&&i>0?i:3,type:"margin"===r?"margin":"drop",style:null==(a=e[0])?void 0:a.styles}}(l,s);if(g)return{paragraphs:[],pageBreakAfter:!1,dropCapFrame:g};const{segments:m,hasPageBreak:v}=function(t){const e=[[]];let a=!1;const n=(t,a)=>{(0!==a.length||t.image||t.textBox||t.field||t.fieldChar||void 0!==t.fieldInstruction||t.bookmark||t.comment)&&e[e.length-1].push({...t,text:a})};for(const r of t){if(!r.text.includes("\f")){n(r,r.text);continue}const t=r.text.split("\f");t.forEach((o,i)=>{n(r,o),i<t.length-1&&(a=!0,e.push([]))})}return{segments:e,hasPageBreak:a}}(s);if(!v)return{paragraphs:[Nb(s,f,p,c)],pageBreakAfter:!1};const b=[];let y=!1;for(let M=0;M<m.length;M+=1){const t=m[M];if(M>0&&(y=!0),!qb(t))continue;const e=y?{...f??{},pageBreakBefore:!0}:f;b.push(Nb(t,e,p,c)),y=!1}return{paragraphs:b,pageBreakAfter:y}}async function Pb(t,e,a,n,r,o,i){return(await Ob(t,e,a,n,r,o,i)).paragraphs[0]??ya([{text:""}])}async function Wb(t,e,a,n,r,o,i){if(!t)return[];const l=(new _m).parseFromString(t,"application/xml").documentElement;if(!l)return[];const s=[];for(let d=0;d<l.childNodes.length;d+=1){const t=l.childNodes[d];if((null==t?void 0:t.nodeType)!==t.ELEMENT_NODE)continue;const c=t;"p"===c.localName&&c.namespaceURI===$m?s.push(await Pb(c,e,a,n,r,o)):"tbl"===c.localName&&c.namespaceURI===$m&&s.push(await zb(c,e,a,n,r,o,i))}return s}const Hb=new Set(["separator","continuationSeparator","continuationNotice"]);const Ub=new Set(["separator","continuationSeparator","continuationNotice"]);const Fb=new Set(["_GoBack"]);function Bb(t,e,a){if("paragraph"===t.type){let n=0;const r=[];for(const o of t.runs){const i=o.__importedBookmark;i?(e.push({marker:i,anchor:{paragraphId:t.id,offset:n,seq:a.value}}),a.value+=1):(n+=o.text.length,r.push(o))}return void(r.length!==t.runs.length&&(t.runs=r.length>0?r:[ma("")]))}for(const n of t.rows)for(const t of n.cells)for(const n of t.blocks)Bb(n,e,a)}function Gb(t){var e;const a=[],n={value:0},r=t=>{null==t||t.forEach(t=>Bb(t,a,n))};for(const c of t)r(c.blocks),r(c.header),r(c.firstPageHeader),r(c.evenPageHeader),r(c.footer),r(c.firstPageFooter),r(c.evenPageFooter);if(0===a.length)return;const o=new Map,i=new Map;for(const c of a){const t="start"===c.marker.kind?o:i,e=t.get(c.marker.docxId);e?e.push(c):t.set(c.marker.docxId,[c])}const l={},s=[],d=a.filter(t=>"start"===t.marker.kind);for(const c of d){const{marker:t,anchor:a}=c,n=t.name;if(!n||Fb.has(n))continue;const r=Number.parseInt(t.docxId,10),o=null==(e=i.get(t.docxId))?void 0:e.shift(),d=fa(),h={id:d,name:n,start:a};n.startsWith("_")&&(h.hidden=!0),Number.isNaN(r)||(h.docxIdHint=r),void 0!==t.colFirst&&(h.colFirst=t.colFirst),void 0!==t.colLast&&(h.colLast=t.colLast),o&&(h.end=o.anchor),l[d]=h,s.push(d)}return 0!==s.length?{items:l,order:s}:void 0}function Zb(t,e,a){if("paragraph"===t.type){let n=0;const r=[];for(const o of t.runs){const i=o.__importedComment;i?(e.push({marker:i,anchor:{paragraphId:t.id,offset:n,seq:a.value}}),a.value+=1):(n+=o.text.length,r.push(o))}return void(r.length!==t.runs.length&&(t.runs=r.length>0?r:[ma("")]))}for(const n of t.rows)for(const t of n.cells)for(const n of t.blocks)Zb(n,e,a)}function Kb(t){const e=[],a={value:0},n=t=>{null==t||t.forEach(t=>Zb(t,e,a))};for(const o of t)n(o.blocks),n(o.header),n(o.firstPageHeader),n(o.evenPageHeader),n(o.footer),n(o.firstPageFooter),n(o.evenPageFooter);const r=new Map;for(const{marker:o,anchor:i}of e){const t=r.get(o.docxId)??{};"start"===o.kind?t.start=i:t.end=i,r.set(o.docxId,t)}return r}const Db="http://schemas.microsoft.com/office/word/2012/wordml";function jb(t){let e="";for(let a=0;a<t.childNodes.length;a+=1){const n=t.childNodes[a];if((null==n?void 0:n.nodeType)!==n.ELEMENT_NODE)continue;const r=n;if(r.namespaceURI===$m){if("t"===r.localName){e+=r.textContent??"";continue}if("tab"===r.localName){e+="\t";continue}if("br"===r.localName||"cr"===r.localName){e+="\n";continue}}e+=jb(r)}return e}function Xb(t){if(!t)return;const e=Date.parse(t);return Number.isNaN(e)?void 0:e}function Jb(t,e){const a=new Map;if(!t)return a;const n=(new _m).parseFromString(t,"application/xml").documentElement;if(!n)return a;const r=function(t){const e=new Map;if(!t)return e;const a=(new _m).parseFromString(t,"application/xml").documentElement;if(!a)return e;for(const n of av(a,Db,"commentEx")){const t=n.getAttributeNS(Db,"paraId");if(!t)continue;const a=n.getAttributeNS(Db,"done");e.set(t,"1"===a||"true"===a)}return e}(e);for(const o of av(n,$m,"comment")){const t=iv(o,"id");if(null===t)continue;const e=iv(o,"author")??"",n=iv(o,"initials")??void 0,i=Xb(iv(o,"date")),l=av(o,$m,"p"),s=l.map(t=>jb(t)).join("\n").trim(),d=l.length>0?iv(l[0],"paraId")??void 0:void 0,c=void 0!==d?r.get(d):void 0;a.set(t,{author:e,...n?{initials:n}:{},...void 0!==i?{date:i}:{},text:s,...c?{resolved:c}:{},...d?{paraId:d}:{}})}return a}async function Yb(t,e={}){var a,n,r,o,i,l,s,d,c,h,p,u,f;null==(a=e.onProgress)||a.call(e,"opening-docx");const g=await Qp.loadAsync(t),m=await(null==(n=g.file("word/document.xml"))?void 0:n.async("string"));if(!m)throw new Error("Missing word/document.xml");const v=pv(await(null==(r=g.file("word/_rels/document.xml.rels"))?void 0:r.async("string"))),b=function(t){const e=new Map,a=new Map,n=new Map,r=new Map,o=new Map,i=new Map,l=new Map,s=new Map,d=new Map,c=new Map,h=new Set,p=()=>({abstractKinds:e,numKinds:a,abstractIndents:n,abstractSuffixes:r,abstractFormats:o,abstractStarts:i,abstractBulletGlyphs:l,abstractBulletFonts:s,numStartOverrides:d,numToAbstractId:c,seenInstances:h});if(!t)return p();const u=(new _m).parseFromString(t,"application/xml").documentElement;if(!u)return p();const f=u.getElementsByTagNameNS($m,"abstractNum");for(let m=0;m<f.length;m+=1){const t=f[m],a=iv(t,"abstractNumId");if(a)for(const d of av(t,$m,"lvl")){const t=iv(d,"ilvl")??"0",c=`${a}:${t}`,h=iv(ov(d,$m,"numFmt"),"val");if(h){e.set(c,"bullet"===h?"bullet":"ordered"),"0"===t&&e.set(a,"bullet"===h?"bullet":"ordered");const n=Vv[h];n&&o.set(c,n)}const p=iv(ov(d,$m,"suff"),"val");"space"!==p&&"nothing"!==p&&"tab"!==p||r.set(c,p);const u=iv(ov(d,$m,"start"),"val");if(null!=u){const t=parseInt(u,10);isNaN(t)||i.set(c,t)}if("bullet"===h){const t=iv(ov(d,$m,"lvlText"),"val");t&&l.set(c,t)}const f=ov(d,$m,"rPr"),g=ov(f,$m,"rFonts"),m=iv(g,"ascii")??iv(g,"hAnsi");m&&s.set(c,m);const v=ov(d,$m,"pPr"),b=ov(v,$m,"ind");if(b){const t=iv(b,"left")??iv(b,"start"),e=iv(b,"hanging"),a=null!=t?bv(t,0):void 0,r=null!=e?bv(e,0):void 0;void 0===a&&void 0===r||n.set(c,{left:a,hanging:r})}}}const g=u.getElementsByTagNameNS($m,"num");for(let m=0;m<g.length;m+=1){const t=g[m],n=iv(t,"numId"),r=iv(ov(t,$m,"abstractNumId"),"val");if(n&&r){c.set(n,r),a.set(n,e.get(r)??"ordered");for(const e of av(t,$m,"lvlOverride")){const t=iv(e,"ilvl");if(!t)continue;const a=iv(ov(e,$m,"startOverride"),"val");if(null!=a){const e=parseInt(a,10);isNaN(e)||d.set(`${n}:${t}`,e)}}}}return{abstractKinds:e,numKinds:a,abstractIndents:n,abstractSuffixes:r,abstractFormats:o,abstractStarts:i,abstractBulletGlyphs:l,abstractBulletFonts:s,numStartOverrides:d,numToAbstractId:c,seenInstances:h}}(await(null==(o=g.file("word/numbering.xml"))?void 0:o.async("string"))??null),y=function(t){const e={adjustLineHeightInTable:!0};if(!t)return e;const a=(new _m).parseFromString(t,"application/xml"),n=yv(iv(ov(a.documentElement,$m,"defaultTabStop"),"val"));void 0!==n&&(e.defaultTabStop=n),e.footnoteSettings=kv(ov(a.documentElement,$m,"footnotePr")),e.endnoteSettings=kv(ov(a.documentElement,$m,"endnotePr"));const r=ov(a.documentElement,$m,"compat");if(r){const t=ov(r,$m,"adjustLineHeightInTable");if(t){const a=iv(t,"val");e.adjustLineHeightInTable="0"!==a&&"false"!==a}}return e}(await(null==(i=g.file("word/settings.xml"))?void 0:i.async("string"))??null),M=await(null==(l=g.file("word/styles.xml"))?void 0:l.async("string"))??null,x=function(t){if(!t)return{fonts:{},colors:{}};const e=(new _m).parseFromString(t,"application/xml").documentElement,a=e?av(e,tv,"themeElements")[0]??null:null;return{fonts:vv(a),colors:Sv(a)}}(await(null==(s=g.file("word/theme/theme1.xml"))?void 0:s.async("string"))??null),w=function(t,e){if(!t)return;const a=(new _m).parseFromString(t,"application/xml").documentElement;if(!a)return;const n=ov(a,$m,"docDefaults"),r=ov(ov(n,$m,"pPrDefault"),$m,"pPr"),o=ov(ov(n,$m,"rPrDefault"),$m,"rPr"),i=r?{spacingBefore:0,spacingAfter:0,...Wv(Uv(r))}:Wv(Uv(r)),l=qv(o,e),s={};let d;for(const c of av(a,$m,"style")){const t=iv(c,"styleId"),a=iv(c,"type");if(!t||"paragraph"!==a&&"character"!==a&&"table"!==a)continue;const n=iv(ov(c,$m,"name"),"val")??t,r=iv(ov(c,$m,"basedOn"),"val")??void 0,o=iv(ov(c,$m,"next"),"val")??void 0,h=Wv(Uv(ov(c,$m,"pPr"))),p=qv(ov(c,$m,"rPr"),e);let u;if("table"===a){const a=ov(c,$m,"tblPr"),n=yv(iv(ov(a,$m,"tblInd"),"w")),r=t=>{const e=iv(ov(a,$m,t),"val"),n=e?Number(e):Number.NaN;return Number.isFinite(n)&&n>0?Math.floor(n):void 0},o=r("tblStyleRowBandSize"),i=r("tblStyleColBandSize"),l={};for(const t of av(c,$m,"tblStylePr")){const a=iv(t,"type");if(!a)continue;const n=ov(t,$m,"tcPr"),r=zv(ov(n,$m,"shd")),o=qv(ov(t,$m,"rPr"),e),i=Rv(Pv(ov(n,$m,"tcBorders"))),s=Uv(ov(t,$m,"pPr")),d=Fv(ov(t,$m,"trPr"));(r||o||i||s||d)&&(l[a]={...r?{shading:r}:{},...o?{textStyle:o}:{},...i?{borders:i}:{},...s?{paragraphStyle:s}:{},...d?{rowStyle:d}:{}})}u={styleId:t,indentLeft:n,...void 0!==o?{rowBandSize:o}:{},...void 0!==i?{colBandSize:i}:{},...Object.keys(l).length>0?{conditionalFormats:l}:{}}}const f="paragraph"===a&&sv(iv(c,"default"));f&&(d=t),s[t]={id:t,name:n,type:a,basedOn:r,nextStyle:o,paragraphStyle:"paragraph"===a&&f?Lv(i,h):h,textStyle:"paragraph"===a&&f?Lv(l,p):p,tableStyle:u}}return d&&s[d]?s:((i||l)&&(s.Normal={id:"Normal",name:"Normal",type:"paragraph",paragraphStyle:i,textStyle:l}),Rv(s))}(M,x);null==(d=e.onProgress)||d.call(e,"parsing-document");const S=(new _m).parseFromString(m,"application/xml").getElementsByTagNameNS($m,"body")[0];if(!S)return Ta([ya([{text:""}])]);const A={assets:{},byPath:new Map,nextId:1},I=[],T=[[]];let C=!1,k=null;const V=t=>{C&&(t.style={...t.style??{},pageBreakBefore:!0},C=!1),k&&"paragraph"===t.type&&(t.dropCap=k,k=null),T[T.length-1].push(t)};let E=0;for(let $=0;$<S.childNodes.length;$+=1){const t=S.childNodes[$];if((null==t?void 0:t.nodeType)===t.ELEMENT_NODE){const e=t;e.namespaceURI===$m&&"sectPr"!==e.localName&&(E+=1)}}let R=0;const L=()=>{var t;R+=1,E>0&&(null==(t=e.onProgress)||t.call(e,"parsing-document",R/E))};for(let $=0;$<S.childNodes.length;$+=1){const t=S.childNodes[$];if((null==t?void 0:t.nodeType)!==t.ELEMENT_NODE)continue;const e=t;if(e.namespaceURI===$m){if("sectPr"===e.localName)I.push(Zv(e)),T.push([]),C=!1;else if("p"===e.localName){const t=await Ob(e,b,g,v,A,x);for(const e of t.paragraphs)V(e);t.dropCapFrame&&(k=t.dropCapFrame),t.pageBreakAfter&&(C=!0),L()}else"tbl"===e.localName&&(V(await zb(e,b,g,v,A,x,w)),L());await hv(50,R)}}if(0===I.length){const t=ov(S,$m,"sectPr");I.push(t?Zv(t):{pageSettings:Kv(S),headerRIds:{},footerRIds:{}})}null==(c=e.onProgress)||c.call(e,"parsing-headers-footers");const z=[],N=t=>Object.keys(t.headerRIds).length>0||Object.keys(t.footerRIds).length>0,q=I.filter(N).length;let O=0;const P=()=>{var t;O+=1,q>0&&(null==(t=e.onProgress)||t.call(e,"parsing-headers-footers",O/q))};for(let $=0;$<I.length;$+=1){const t=I[$],e=T[$]??[];Dv(e,t.docGridLinePitchPx,t.docGridMode,t.docGridType,y);const a=async e=>{var a;if(!e)return[];const n=v.get(e);if(!n)return[];let r=n.startsWith("/")?n.slice(1):n;r.startsWith("word/")||(r=`word/${n}`);const o=await(null==(a=g.file(r))?void 0:a.async("string")),i=await uv(g,r),l=await Wb(o??null,b,g,i,A,x,w);return Dv(l,t.docGridLinePitchPx,t.docGridMode,t.docGridType,y),l},n=await a(t.headerRIds.default),r=await a(t.headerRIds.first),o=await a(t.headerRIds.even),i=await a(t.footerRIds.default),l=await a(t.footerRIds.first),s=await a(t.footerRIds.even);N(t)&&P(),await hv(2,O);const d=ge(t.pageSettings??{width:816,height:1056,orientation:"portrait",margins:{top:96,right:96,bottom:96,left:96,header:48,footer:48,gutter:0}});z.push({id:`section:${$+1}`,blocks:e.length>0?e:[ya([{text:""}])],pageSettings:d,header:n.length>0?n:void 0,firstPageHeader:r.length>0?r:void 0,evenPageHeader:o.length>0?o:void 0,footer:i.length>0?i:void 0,firstPageFooter:l.length>0?l:void 0,evenPageFooter:s.length>0?s:void 0})}const W=await(null==(h=g.file("word/footnotes.xml"))?void 0:h.async("string"))??null,H=W?await uv(g,"word/footnotes.xml"):new Map,U=await async function(t,e,a,n,r,o,i){const l={byDocxId:new Map,footnotes:{items:{}}};if(!t)return l;const s=(new _m).parseFromString(t,"application/xml").documentElement;if(!s)return l;const d={},c=new Map;let h,p;const u=av(s,$m,"footnote");let f=0;for(const g of u){const t=iv(g,"id")??"",l=iv(g,"type")??"",s=[];for(let d=0;d<g.childNodes.length;d+=1){const t=g.childNodes[d];if((null==t?void 0:t.nodeType)!==t.ELEMENT_NODE)continue;const l=t;l.namespaceURI===$m&&("p"===l.localName?s.push(await Pb(l,e,a,n,r,o)):"tbl"===l.localName&&s.push(await zb(l,e,a,n,r,o,i)))}if(Hb.has(l)){"separator"===l?h=s:"continuationSeparator"===l&&(p=s);continue}if(("-1"===t||"0"===t)&&0===s.length)continue;f+=1;const u=`footnote:imported:${f}`,m=Number.parseInt(t,10),v={id:u,blocks:s.length>0?s:[],docxId:Number.isFinite(m)?m:void 0};d[u]=v,t&&c.set(t,v)}return{byDocxId:c,footnotes:{items:d,separator:h,continuationSeparator:p},separator:h,continuationSeparator:p}}(W,b,g,H,A,x,w);y.footnoteSettings&&(U.footnotes.settings=y.footnoteSettings);const F=Object.keys(U.footnotes.items).length>0||U.footnotes.separator||U.footnotes.continuationSeparator||U.footnotes.settings?U.footnotes:void 0;!function(t,e){var a,n,r,o,i,l;const s=t=>{if("paragraph"!==t.type)for(const e of t.rows)for(const t of e.cells)for(const e of t.blocks)s(e);else for(const a of t.runs){const t=a,n=t.__importedFootnoteRef;if(!n)continue;delete t.__importedFootnoteRef;const r=e.get(n.docxId);r&&(a.footnoteReference={footnoteId:r.id,...n.customMark?{customMark:n.customMark}:{}})}};for(const d of t)d.blocks.forEach(s),null==(a=d.header)||a.forEach(s),null==(n=d.firstPageHeader)||n.forEach(s),null==(r=d.evenPageHeader)||r.forEach(s),null==(o=d.footer)||o.forEach(s),null==(i=d.firstPageFooter)||i.forEach(s),null==(l=d.evenPageFooter)||l.forEach(s)}(z,U.byDocxId);const B=await(null==(p=g.file("word/endnotes.xml"))?void 0:p.async("string"))??null,G=B?await uv(g,"word/endnotes.xml"):new Map,Z=await async function(t,e,a,n,r,o,i){const l={byDocxId:new Map,endnotes:{items:{}}};if(!t)return l;const s=(new _m).parseFromString(t,"application/xml").documentElement;if(!s)return l;const d={},c=new Map;let h,p;const u=av(s,$m,"endnote");let f=0;for(const g of u){const t=iv(g,"id")??"",l=iv(g,"type")??"",s=[];for(let d=0;d<g.childNodes.length;d+=1){const t=g.childNodes[d];if((null==t?void 0:t.nodeType)!==t.ELEMENT_NODE)continue;const l=t;l.namespaceURI===$m&&("p"===l.localName?s.push(await Pb(l,e,a,n,r,o)):"tbl"===l.localName&&s.push(await zb(l,e,a,n,r,o,i)))}if(Ub.has(l)){"separator"===l?h=s:"continuationSeparator"===l&&(p=s);continue}if(("-1"===t||"0"===t)&&0===s.length)continue;f+=1;const u=`endnote:imported:${f}`,m=Number.parseInt(t,10),v={id:u,blocks:s.length>0?s:[],docxId:Number.isFinite(m)?m:void 0};d[u]=v,t&&c.set(t,v)}return{byDocxId:c,endnotes:{items:d,separator:h,continuationSeparator:p},separator:h,continuationSeparator:p}}(B,b,g,G,A,x,w);y.endnoteSettings&&(Z.endnotes.settings=y.endnoteSettings);const K=Object.keys(Z.endnotes.items).length>0||Z.endnotes.separator||Z.endnotes.continuationSeparator||Z.endnotes.settings?Z.endnotes:void 0;!function(t,e){var a,n,r,o,i,l;const s=t=>{if("paragraph"!==t.type)for(const e of t.rows)for(const t of e.cells)for(const e of t.blocks)s(e);else for(const a of t.runs){const t=a,n=t.__importedEndnoteRef;if(!n)continue;delete t.__importedEndnoteRef;const r=e.get(n.docxId);r&&(a.endnoteReference={endnoteId:r.id,...n.customMark?{customMark:n.customMark}:{}})}};for(const d of t)d.blocks.forEach(s),null==(a=d.header)||a.forEach(s),null==(n=d.firstPageHeader)||n.forEach(s),null==(r=d.evenPageHeader)||r.forEach(s),null==(o=d.footer)||o.forEach(s),null==(i=d.firstPageFooter)||i.forEach(s),null==(l=d.evenPageFooter)||l.forEach(s)}(z,Z.byDocxId);const D=Gb(z),j=function(t,e){const a=new Set([...t.keys(),...e.keys()]);if(0===a.size)return;const n=[...a].sort((t,e)=>{const a=Number.parseInt(t,10),n=Number.parseInt(e,10);return Number.isNaN(a)||Number.isNaN(n)?t.localeCompare(e):a-n}),r={},o=[];for(const i of n){const a=t.get(i),n=e.get(i);if(!a&&!n)continue;const l=ga(),s=Number.parseInt(i,10);r[l]={id:l,author:(null==n?void 0:n.author)??"",...(null==n?void 0:n.initials)?{initials:n.initials}:{},...void 0!==(null==n?void 0:n.date)?{date:n.date}:{},...(null==n?void 0:n.resolved)?{resolved:n.resolved}:{},text:(null==n?void 0:n.text)??"",...(null==a?void 0:a.start)?{start:a.start}:{},...(null==a?void 0:a.end)?{end:a.end}:{},...Number.isNaN(s)?{}:{docxIdHint:s}},o.push(l)}return o.length>0?{items:r,order:o}:void 0}(Kb(z),Jb(await(null==(u=g.file("word/comments.xml"))?void 0:u.async("string"))??null,await(null==(f=g.file("word/commentsExtended.xml"))?void 0:f.async("string"))??null)),X=z.length>1||z.some(t=>{var e,a,n,r,o,i;return((null==(e=t.header)?void 0:e.length)??0)>0||((null==(a=t.firstPageHeader)?void 0:a.length)??0)>0||((null==(n=t.evenPageHeader)?void 0:n.length)??0)>0||((null==(r=t.footer)?void 0:r.length)??0)>0||((null==(o=t.firstPageFooter)?void 0:o.length)??0)>0||((null==(i=t.evenPageFooter)?void 0:i.length)??0)>0}),J=Object.keys(A.assets).length>0,Y=t=>{void 0!==y.defaultTabStop&&(t.settings={...t.settings??{},defaultTabStop:y.defaultTabStop});let e=t;return F&&(e.footnotes=F,e=Jl(e)),K&&(e.endnotes=K,e=function(t){var e,a;const n=t.endnotes;if(!n||0===Object.keys(n.items).length)return t;const r=(null==(e=n.settings)?void 0:e.numberFormat)??"decimal",o=(null==(a=n.settings)?void 0:a.startAt)??1,i=new Set,l=new Map;let s=o-1;for(const{run:u}of Ql(t)){const t=u.endnoteReference;t&&(i.add(t.endnoteId),t.customMark?l.set(t.endnoteId,t.customMark):l.has(t.endnoteId)||(s+=1,l.set(t.endnoteId,jl(s,r))))}let d=!1;const c=Pe(t).map(t=>{const e=t=>{if(!t)return t;let e=!1;const a=t.map(t=>{if("paragraph"===t.type){const a=_l(t,l);return a!==t&&(e=!0),a}let a=!1;const n=t.rows.map(t=>{let e=!1;const n=t.cells.map(t=>{let a=!1;const n=t.blocks.map(t=>{const e=_l(t,l);return e!==t&&(a=!0),e});return a?(e=!0,{...t,blocks:n}):t});return e?(a=!0,{...t,cells:n}):t});return a?(e=!0,{...t,rows:n}):t});return e?(d=!0,a):t};return{...t,blocks:e(t.blocks)??t.blocks,header:e(t.header),firstPageHeader:e(t.firstPageHeader),evenPageHeader:e(t.evenPageHeader),footer:e(t.footer),firstPageFooter:e(t.firstPageFooter),evenPageFooter:e(t.evenPageFooter)}}),h={};let p=!1;for(const[u,f]of Object.entries(n.items))i.has(u)?h[u]=f:p=!0;return d||p?{...t,sections:d?c:t.sections,endnotes:{...n,items:p?h:n.items}}:t}(e)),D&&(e.bookmarks=D),j&&(e.comments=j),e};if(X){const t=Ta([]);return t.sections=z,1===z.length&&(t.pageSettings=z[0].pageSettings),w&&(t.styles=w),J&&(t.assets=A.assets),Y(t)}const Q=z[0],_=Ta((null==Q?void 0:Q.blocks.length)>0?Q.blocks:[ya([{text:""}])],null==Q?void 0:Q.pageSettings);return J&&(_.assets=A.assets),w&&(_.styles=w),Y(_)}let Qb=1;function _b(t,e={}){if("undefined"==typeof Worker||"undefined"==typeof URL)return Yb(t,e);const a=Qb;return Qb+=1,new Promise((r,o)=>{const i=new Worker(new URL(""+("undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__dirname+"/assets/importDocxWorker-DcrboJNQ.js").href:new URL("assets/importDocxWorker-DcrboJNQ.js","undefined"==typeof document?location.href:document.currentScript&&"SCRIPT"===document.currentScript.tagName.toUpperCase()&&document.currentScript.src||document.baseURI).href),"undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:n&&"SCRIPT"===n.tagName.toUpperCase()&&n.src||new URL("oasis-editor.umd.cjs",document.baseURI).href),{type:"module"}),l=()=>{i.removeEventListener("message",d),i.removeEventListener("error",s),i.terminate()},s=t=>{l(),o(t.error instanceof Error?t.error:new Error(t.message))},d=t=>{var n;const i=t.data;i&&i.id===a&&("progress"!==i.type?(l(),"done"===i.type?r(i.document):o(new Error(i.error))):null==(n=e.onProgress)||n.call(e,i.stage,i.progress))};i.addEventListener("message",d),i.addEventListener("error",s),i.postMessage({type:"import-docx",id:a,buffer:t},[t])})}const $b={"opening-docx":"opening","parsing-document":"parsing","parsing-headers-footers":"finishing"};function ty(t){const e={},a=t.style;return function(t,e){switch(t.tagName){case"B":case"STRONG":e.bold=!0;break;case"I":case"EM":case"CITE":case"VAR":e.italic=!0;break;case"U":case"INS":e.underline=!0;break;case"S":case"STRIKE":case"DEL":e.strike=!0}}(t,e),function(t,e){const a=t.fontFamily.trim();a&&(e.fontFamily=a);const n=t.fontSize.trim();if(n.endsWith("px")){const t=Number.parseFloat(n);Number.isFinite(t)&&(e.fontSize=t)}const r=t.color.trim();r&&(e.color=r);const o=t.backgroundColor.trim();o&&(e.highlight=o)}(a,e),function(t,e){const a=t.getAttribute("data-oasis-lang-value")??t.getAttribute("lang"),n=t.getAttribute("data-oasis-lang-east-asia"),r=t.getAttribute("data-oasis-lang-bidi");(a||n||r)&&(e.language={},a&&(e.language.value=a),n&&(e.language.eastAsia=n),r&&(e.language.bidi=r))}(t,e),function(t,e){var a,n;const r=t.textDecoration.toLowerCase();if(r.includes("underline")){e.underline=!0;switch(null==(a=t.textDecorationStyle)?void 0:a.toLowerCase()){case"double":e.underlineStyle="double";break;case"dotted":e.underlineStyle="dotted";break;case"dashed":e.underlineStyle="dash";break;case"wavy":e.underlineStyle="wave"}}r.includes("line-through")&&(e.strike=!0);const o=null==(n=t.textDecorationColor)?void 0:n.trim();o&&(e.underlineColor=o)}(a,e),function(t,e){const a=t.fontWeight.trim();("bold"===a||Number.parseInt(a,10)>=600)&&(e.bold=!0);const n=t.fontStyle.trim();"italic"===n&&(e.italic=!0);"none"===t.display.trim().toLowerCase()&&(e.hidden=!0);"uppercase"===t.textTransform.trim().toLowerCase()&&(e.allCaps=!0);t.fontVariant.trim().toLowerCase().includes("small-caps")&&(e.smallCaps=!0);const r=t.letterSpacing.trim();if(r.endsWith("pt")){const t=Number.parseFloat(r);Number.isFinite(t)&&(e.characterSpacing=t)}const o=t.fontStretch.trim();if(o.endsWith("%")){const t=Number.parseFloat(o);Number.isFinite(t)&&t>0&&(e.characterScale=t)}}(a,e),function(t,e){const a=t.fontVariantLigatures.trim().toLowerCase();"none"===a?e.ligatures="none":a.includes("historical")?e.ligatures="historical":a.includes("common-ligatures")&&a.includes("contextual")?e.ligatures="standardContextual":a.includes("common-ligatures")?e.ligatures="standard":a.includes("contextual")&&(e.ligatures="contextual");const n=t.fontVariantNumeric.trim().toLowerCase();n.includes("proportional-nums")?e.numberSpacing="proportional":n.includes("tabular-nums")&&(e.numberSpacing="tabular");n.includes("lining-nums")?e.numberForm="lining":n.includes("oldstyle-nums")&&(e.numberForm="oldStyle");const r=t.fontFeatureSettings.trim().toLowerCase(),o=r.match(/["']ss(0[1-9]|1[0-9]|20)["']\s+1/);(null==o?void 0:o[1])&&(e.stylisticSet=Number(o[1]));/["']calt["']\s+1/.test(r)&&(e.contextualAlternates=!0)}(a,e),function(t,e,a){"SUP"===t.tagName&&(a.superscript=!0);"SUB"===t.tagName&&(a.subscript=!0);const n=e.verticalAlign.trim();if(n.endsWith("pt")){const t=Number.parseFloat(n);Number.isFinite(t)&&(a.baselineShift=t)}}(t,a,e),function(t,e){var a;const n="A"===t.tagName?(null==(a=t.getAttribute("href"))?void 0:a.trim())??"":"";n&&(e.link=n,e.underline=!0)}(t,e),Object.keys(e).length>0?e:void 0}function ey(t,e){if(t.nodeType===Node.TEXT_NODE){const a=t.textContent??"";return a.length>0?[va(a,e)]:[]}if(t.nodeType!==Node.ELEMENT_NODE)return[];const a=t;if("BR"===a.tagName)return[va("\n",e)];const n=function(t){var e,a,n;if("IMG"!==t.tagName)return;const r=t,o=(null==(e=r.getAttribute("src"))?void 0:e.trim())??"";if(!o)return;const i=(null==(a=r.getAttribute("width"))?void 0:a.trim())??"",l=(null==(n=r.getAttribute("height"))?void 0:n.trim())??"",s=r.style.width.trim(),d=r.style.height.trim(),c=s.endsWith("px")?Number.parseFloat(s):Number.NaN,h=d.endsWith("px")?Number.parseFloat(d):Number.NaN,p=Number.parseFloat(i),u=Number.parseFloat(l),f=Number.isFinite(c)?c:Number.isFinite(p)?p:100,g=Number.isFinite(h)?h:Number.isFinite(u)?u:100,m=r.getAttribute("alt"),v={src:o,width:Math.max(1,Math.round(f)),height:Math.max(1,Math.round(g))};return null!==m&&(v.alt=m),v}(a);if(n)return[va("",e,n)];const r={...e??{},...ty(a)??{}},o=[];for(const i of Array.from(a.childNodes))o.push(...ey(i,r));return o}function ay(t){return"P"===t||"DIV"===t||"LI"===t||/^H[1-6]$/.test(t)}function ny(t){return"UL"===t?"bullet":"OL"===t?"ordered":null}function ry(t){const e=t.style,a={},n=e.textAlign.trim();"left"!==n&&"center"!==n&&"right"!==n&&"justify"!==n||(a.align=n);const r=e.lineHeight.trim();if(r){const t=Number.parseFloat(r);Number.isFinite(t)&&(a.lineHeight=t,r.endsWith("px")&&(a.lineRule="exact"))}const o=e.paddingTop.trim();if(o.endsWith("px")){const t=Number.parseFloat(o);Number.isFinite(t)&&(a.spacingBefore=t)}const i=e.paddingBottom.trim();if(i.endsWith("px")){const t=Number.parseFloat(i);Number.isFinite(t)&&(a.spacingAfter=t)}const l=e.paddingLeft.trim();if(l.endsWith("px")){const t=Number.parseFloat(l);Number.isFinite(t)&&(a.indentLeft=t)}const s=e.paddingRight.trim();if(s.endsWith("px")){const t=Number.parseFloat(s);Number.isFinite(t)&&(a.indentRight=t)}const d=e.textIndent.trim();if(d.endsWith("px")){const t=Number.parseFloat(d);Number.isFinite(t)&&(a.indentFirstLine=t)}return"page"!==e.breakBefore&&"true"!==t.dataset.oasisPageBreakBefore||(a.pageBreakBefore=!0),"true"===t.dataset.oasisKeepWithNext&&(a.keepWithNext=!0),Object.keys(a).length>0?a:void 0}const oy={H1:"heading1",H2:"heading2",H3:"heading3",H4:"heading3",H5:"heading3",H6:"heading3"};function iy(t){return t.map(t=>({text:t.text,styles:t.styles,image:t.image}))}function ly(t,e){const a=ya(iy(ey(t,void 0))),n=ry(t),r=oy[t.tagName];return(n||r)&&(a.style={...r?{styleId:r}:{},...n??{}}),e&&(a.list=e),a}function sy(t,e,a){const n=[];for(const r of Array.from(t.children))if("LI"===r.tagName){n.push(ly(r,{kind:e,level:a}));for(const t of Array.from(r.children)){const e=ny(t.tagName);e&&n.push(...sy(t,e,a+1))}}return n}function dy(t){const e=py(t).filter(t=>"paragraph"===t.type),a=Number.parseInt(t.getAttribute("colspan")??"",10),n=Number.parseInt(t.getAttribute("rowspan")??"",10);return Ma(e.length>0?e:[ba("")],Number.isFinite(a)&&a>1?a:1,Number.isFinite(n)&&n>1?{rowSpan:n}:void 0)}function cy(t){const e=[];let a=!0;for(const n of Array.from(t.children))"TD"!==n.tagName&&"TH"!==n.tagName||(e.push(dy(n)),"TH"!==n.tagName&&(a=!1));return 0===e.length?null:xa(e,a?{isHeader:!0}:void 0)}function hy(t){const e=[],a=Array.from(t.querySelectorAll("tr")).filter(e=>e.closest("table")===t);for(const n of a){const t=cy(n);t&&e.push(t)}return 0===e.length?null:wa(e)}function py(t){const e=[];for(const a of Array.from(t.childNodes)){if(a.nodeType===Node.TEXT_NODE){(a.textContent??"").trim().length>0&&e.push(uy(ey(a,void 0)));continue}if(a.nodeType!==Node.ELEMENT_NODE)continue;const t=a;if("TABLE"===t.tagName){const a=hy(t);a&&e.push(a);continue}const n=ny(t.tagName);if(n){e.push(...sy(t,n,0));continue}if(ay(t.tagName)){e.push(ly(t));continue}if(t.children.length>0){e.push(...py(t));continue}const r=ey(t,void 0);r.length>0&&e.push(uy(r))}return e}function uy(t){return ya(iy(t))}const fy=[{id:"docx",accept:[".docx"],matches(t){return this.accept.includes(Xp(t.name))},import:(t,e)=>_b(t,{onProgress:e?(t,a)=>e($b[t],a):void 0})},{id:"html",accept:[".html",".htm"],matches(t){return this.accept.includes(Xp(t.name))},async import(t,e){null==e||e("opening");const a=function(t){var e;const a=new Uint8Array(t),n=new TextDecoder("utf-8").decode(a.subarray(0,2048)).match(/charset\s*=\s*["']?([\w-]+)/i),r=null==(e=null==n?void 0:n[1])?void 0:e.toLowerCase();if(r&&"utf-8"!==r&&"utf8"!==r)try{return new TextDecoder(r).decode(a)}catch{}return new TextDecoder("utf-8").decode(a)}(t);null==e||e("parsing");const n=function(t){if("undefined"==typeof document)throw new Error("importHtmlToEditorDocument requires a DOM environment");const e=(new DOMParser).parseFromString(t,"text/html"),a=e.body,n=a?py(a):[];0===n.length&&n.push(ba(""));const r=e.title.trim();return Ta(n,void 0,void 0,void 0,r?{title:r}:void 0)}(a);return null==e||e("finishing"),n}}];const gy=["nw","n","ne","e","se","s","sw","w"],my=24;function vy(t,e,a){const n=Math.max(e,t);return void 0===a?n:Math.min(a,n)}function by(t,e){return"x"===e?t.includes("e")?1:t.includes("w")?-1:0:t.includes("s")?1:t.includes("n")?-1:0}var yy=pt("<button aria-hidden=true class=oasis-editor-rotate-handle tabindex=-1 type=button>"),My=pt("<div aria-hidden=true style=transform-origin:center>"),xy=pt("<button aria-hidden=true class=oasis-editor-resize-handle tabindex=-1 type=button>");function wy(t){return(e=My()).$$mousedown=e=>{!t.readOnly&&t.box()&&t.onBodyMouseDown&&(e.preventDefault(),t.onBodyMouseDown(e))},wt(e,Z(et,{get when(){return!t.readOnly},get children(){return[Z($,{each:gy,children:e=>{return(a=xy()).$$mousedown=a=>{t.box()&&t.onResizeStart(e,a)},ft(a,"data-direction",e),a;var a}}),Z(et,{get when(){return t.onRotateStart},get children(){var e=yy();return e.$$mousedown=e=>{var a;t.box()&&(e.preventDefault(),e.stopPropagation(),null==(a=t.onRotateStart)||a.call(t,e))},e}})]}})),M(a=>{var n,r,o,i,l,s=`oasis-editor-selection-overlay ${t.variantClass}`,d=t.box()?void 0:"none",c=`${(null==(n=t.box())?void 0:n.left)??0}px`,h=`${(null==(r=t.box())?void 0:r.top)??0}px`,p=`${(null==(o=t.box())?void 0:o.width)??0}px`,u=`${(null==(i=t.box())?void 0:i.height)??0}px`,f=(null==(l=t.rotation)?void 0:l.call(t))?`rotate(${t.rotation()}deg)`:void 0,g=!t.readOnly&&t.box()?"auto":"none";return s!==a.e&>(e,a.e=s),d!==a.t&&yt(e,"display",a.t=d),c!==a.a&&yt(e,"left",a.a=c),h!==a.o&&yt(e,"top",a.o=h),p!==a.i&&yt(e,"width",a.i=p),u!==a.n&&yt(e,"height",a.n=u),f!==a.s&&yt(e,"transform",a.s=f),g!==a.h&&yt(e,"pointer-events",a.h=g),a},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),e;var e}ut(["mousedown"]);function Sy(t){return Number.isFinite(t)?Math.min(200,Math.max(50,Math.round(t))):100}var Ay=pt('<div data-testid=editor-editor-shell><div class=oasis-editor-editor data-testid=editor-editor><div class=oasis-editor-editor-zoom-sizer><div class=oasis-editor-editor-scroll-content data-testid=editor-editor-scroll-content style="position:absolute;top:0px;transform-origin:top left"><textarea aria-label="Editor input"autocomplete=off autocapitalize=off class=oasis-editor-input data-testid=editor-input value style=pointer-events:none></textarea><input data-testid=editor-import-docx-input type=file style=display:none><input accept="image/png, image/jpeg, image/gif"data-testid=editor-insert-image-input type=file style=display:none></div></div></div><div class=oasis-editor-statusbar data-testid=editor-statusbar><span class=oasis-editor-statusbar-item data-testid=editor-statusbar-word-count></span><span class=oasis-editor-statusbar-item data-testid=editor-statusbar-character-count></span><span class=oasis-editor-statusbar-item></span><div class=oasis-editor-statusbar-zoom data-testid=editor-statusbar-zoom-control><button type=button class=oasis-editor-zoom-button>−</button><input class=oasis-editor-zoom-slider type=range><button type=button class=oasis-editor-zoom-button>+</button><span class="oasis-editor-statusbar-item oasis-editor-zoom-value"data-testid=editor-statusbar-zoom>%'),Iy=pt("<div class=oasis-editor-import-overlay data-testid=editor-import-overlay role=status aria-live=polite><div class=oasis-editor-import-card><div class=oasis-editor-import-title></div><div class=oasis-editor-import-phase data-testid=editor-import-phase></div><div class=oasis-editor-import-progress-track><div class=oasis-editor-import-progress-bar data-testid=editor-import-progress-bar></div></div><div class=oasis-editor-import-progress-label>"),Ty=pt("<span class=oasis-editor-import-done-icon>"),Cy=pt("<span class=oasis-editor-import-error-icon>"),ky=pt("<span>");function Vy(t){const e=()=>t.layout??{},a=()=>t.overlays,n=()=>t.refs??{},r=()=>t.surfaceHandlers,o=()=>t.inputHandlers,i=()=>t.fileHandlers;let l,s;const[d,c]=y(),h=()=>We(t.state().document).reduce((t,e)=>Math.max(t,e.pageSettings.width),0)||me(t.state().document).width,p=()=>{const t=e().viewportHeight;return"number"==typeof t?`${t}px`:t??"min(72vh, 920px)"},u=w(()=>({width:`min(${h()+68+10}px, 100%)`,height:"100%","max-height":p(),...e().style??{}})),f=w(()=>t.state().document),g=w(()=>Ze(f()).reduce((t,e)=>t+Ae(e),0)),m=w(()=>function(t){const e=Ze(t);let a=0;for(const n of e){const t=n.runs.reduce((t,e)=>t+e.text,"");t.trim()&&(a+=t.split(/[\s\p{P}]+/u).filter(t=>t.length>0).length)}return a}(f())),[v,b]=y(100),S=()=>{var t,a;return(null==(a=(t=e()).zoomPercent)?void 0:a.call(t))??v()},A=t=>{const a=Sy(t),n=e().setZoomPercent;n?n(a):b(a)},I=t=>A(S()+t),C=w(()=>Sy(S())/100),k=()=>{var t,a;return(null==(a=(t=e()).zoomFactor)?void 0:a.call(t))??C()},[V,E]=y(0),[R,L]=y({width:0,height:0}),z=()=>h()+68,N=w(()=>Math.max(z()*k(),R().width)),q=w(()=>Math.max(V()*k(),R().height)),O=w(()=>Math.max(0,(N()-z()*k())/2));let P=k();x(()=>{const t=k(),e=P;if(P=t,t===e||e<=0)return;const a=s;if(!a)return;const n=t/e,r=a.clientWidth/2,o=a.clientHeight/2,i=(a.scrollLeft+r)*n-r,l=(a.scrollTop+o)*n-o;requestAnimationFrame(()=>{a.scrollLeft=i,a.scrollTop=l})});const W=w(()=>{var t,a,n,r;return os(f(),void 0,null==(a=(t=e()).measuredBlockHeights)?void 0:a.call(t),null==(r=(n=e()).measuredParagraphLayouts)?void 0:r.call(n))}),[H,U]=y(null),F=()=>{const t=s;if(!t)return void U(null);const e=Array.from(t.querySelectorAll(".oasis-editor-paper[data-page-index]"));if(0===e.length)return void U(null);const a=t.getBoundingClientRect(),n=a.top+.5*a.height;let r=0,o=Number.POSITIVE_INFINITY;for(const i of e){const t=i.getBoundingClientRect(),e=t.top+.5*t.height,a=Math.abs(e-n);a<o&&(o=a,r=Number(i.dataset.pageIndex??"0"))}U(Number.isFinite(r)?r:null)},B=()=>{const e=H();if(null!==e)return Math.max(1,e+1);const a=W(),n=t.state().selection.focus.paragraphId,r=a.pages.findIndex(t=>t.blocks.some(t=>t.sourceBlockId===n));return-1===r?1:r+1},G=w(()=>a().selectedImageBox()),K=w(()=>a().selectedTextBoxBox()),D=w(()=>{var e;return(null==(e=t.state().document.comments)?void 0:e.items)??{}});return x(()=>{W(),queueMicrotask(F)}),(()=>{var h=Ay(),p=h.firstChild,f=p.firstChild,v=f.firstChild,b=v.firstChild,y=b.nextSibling,x=y.nextSibling,w=p.nextSibling,C=w.firstChild,V=C.nextSibling,P=V.nextSibling,H=P.nextSibling,U=H.firstChild,j=U.nextSibling,X=j.nextSibling,J=X.nextSibling,Y=J.firstChild;wt(h,Z(et,{get when(){return dt(()=>!!e().showHorizontalRuler)()&&a().toolbarHost},get children(){return Z(xp,{get state(){return t.state},get toolbarHost(){return a().toolbarHost},viewportRef:d,readOnly:()=>Boolean(e().readOnly),zoomFactor:k})}}),p),mt(p,"contextmenu",r().onEditorContextMenu,!0),mt(p,"mousedown",r().onEditorMouseDown,!0),mt(p,"drop",r().onDrop),mt(p,"dragover",r().onDragOver),xt(t=>{var e,a;s=t,c(t),null==(a=(e=n()).onViewportRef)||a.call(e,t);const r=()=>{F()};t.addEventListener("scroll",r,{passive:!0}),queueMicrotask(F);const o=()=>{L({width:t.clientWidth,height:t.clientHeight})};let i;o(),"undefined"!=typeof ResizeObserver&&(i=new ResizeObserver(o),i.observe(t)),T(()=>{t.removeEventListener("scroll",r),null==i||i.disconnect()})},p),xt(t=>{var e,a;l=t,null==(a=(e=n()).onSurfaceRef)||a.call(e,t);const r=()=>{E(t.offsetHeight)};let o;r(),queueMicrotask(r),"undefined"!=typeof ResizeObserver&&(o=new ResizeObserver(r),o.observe(t)),T(()=>null==o?void 0:o.disconnect())},v),wt(v,Z(ap,{get state(){return t.state},get measuredBlockHeights(){return e().measuredBlockHeights},get measuredParagraphLayouts(){return e().measuredParagraphLayouts},viewportRef:()=>s??void 0,get onSurfaceMouseDown(){return r().onSurfaceMouseDown},get onSurfaceClick(){return r().onSurfaceClick},get onSurfaceMouseMove(){return r().onSurfaceMouseMove},get onSurfaceDblClick(){return r().onSurfaceDblClick},get onParagraphMouseDown(){return r().onParagraphMouseDown},get onImageMouseDown(){return r().onImageMouseDown},get onImageResizeHandleMouseDown(){return r().onImageResizeHandleMouseDown},get onTextBoxResizeHandleMouseDown(){return r().onTextBoxResizeHandleMouseDown},get onTableDragHandleMouseDown(){return r().onTableDragHandleMouseDown},get onRevisionMouseEnter(){return r().onRevisionMouseEnter},get onRevisionMouseLeave(){return r().onRevisionMouseLeave}}),b),wt(v,Z(et,{get when(){return a().hoveredRevision()},children:t=>Z(kp,{get box(){return t()}})}),b),wt(v,Z(et,{get when(){return a().selectionBoxes().length>0},get children(){return Z(Tp,{get boxes(){return a().selectionBoxes()}})}}),b),wt(v,Z(et,{get when(){return a().commentHighlights().length>0},get children(){return Z(Np,{get boxes(){return a().commentHighlights},commentsById:D})}}),b),wt(v,Z(wy,{box:G,get readOnly(){return Boolean(e().readOnly)},variantClass:"oasis-editor-image-selection-overlay",rotation:()=>{var t;return(null==(t=G())?void 0:t.rotation)??0},onResizeStart:(t,e)=>{const a=G();a&&(e.preventDefault(),e.stopPropagation(),r().onImageResizeHandleMouseDown(a.paragraphId,a.startOffset,t,e))},onRotateStart:t=>{const e=G();e&&r().onImageRotateHandleMouseDown(e.paragraphId,e.startOffset,t)},onBodyMouseDown:t=>{const e=G();e&&r().onImageMouseDown(e.paragraphId,e.startOffset,t)}}),b),wt(v,Z(wy,{box:K,get readOnly(){return Boolean(e().readOnly)},variantClass:"oasis-editor-textbox-selection-overlay",rotation:()=>{var t;return(null==(t=K())?void 0:t.rotation)??0},onResizeStart:(t,e)=>{const a=K();a&&(e.preventDefault(),e.stopPropagation(),r().onTextBoxResizeHandleMouseDown(a.paragraphId,a.startOffset,t,e))},onRotateStart:t=>{const e=K();e&&r().onTextBoxRotateHandleMouseDown(e.paragraphId,e.startOffset,t)}}),b),wt(v,Z(et,{get when(){return dt(()=>!!a().toolbarHost)()&&a().showFloatingTableToolbar},get children(){return Z(Op,{get host(){return a().toolbarHost},get selectionBoxes(){return a().selectionBoxes},get visible(){return a().showFloatingTableToolbar},surfaceRef:()=>l})}}),b),wt(v,Z(et,{get when(){return a().layoutOptions},children:t=>Z(jp,{box:()=>G()??K(),get layoutOptions(){return t()},surfaceRef:()=>l,get readOnly(){return Boolean(e().readOnly)}})}),b),wt(v,Z(et,{get when(){return a().showCaret()},get children(){return Z(Sp,{get active(){return a().focused()},get left(){return a().caretBox().left},get top(){return a().caretBox().top},get height(){return a().caretBox().height}})}}),b),mt(b,"paste",o().onPaste),mt(b,"keydown",o().onKeyDown,!0),mt(b,"input",o().onInput,!0),mt(b,"focus",o().onInputFocus),mt(b,"cut",o().onCut),mt(b,"copy",o().onCopy),mt(b,"compositionstart",o().onCompositionStart),mt(b,"compositionend",o().onCompositionEnd),mt(b,"blur",o().onInputBlur);var Q=n().onTextareaRef;"function"==typeof Q?xt(Q,b):n().onTextareaRef=b,ft(b,"spellcheck",!1),mt(y,"change",i().onImportInputChange);var _=n().onImportInputRef;"function"==typeof _?xt(_,y):n().onImportInputRef=y,mt(x,"change",i().onImageInputChange);var $=n().onImageInputRef;return"function"==typeof $?xt($,x):n().onImageInputRef=x,wt(h,Z(et,{get when(){var t,e;return null==(e=(t=a()).importProgress)?void 0:e.call(t)},children:t=>{const e="done"===t().phase,a="error"===t().phase;return o=Iy(),i=o.firstChild,l=i.firstChild,s=l.nextSibling,d=s.nextSibling,c=d.firstChild,h=d.nextSibling,o.classList.toggle("oasis-editor-import-overlay-done",!!e),o.classList.toggle("oasis-editor-import-overlay-error",!!a),ft(o,"aria-busy",!e&&!a),wt(i,Z(Ht,{height:40,class:"oasis-editor-loading-mark"}),l),wt(l,()=>Pt("import.overlay.title")),wt(s,()=>Pt(`import.phase.${t().phase}`)),c.classList.toggle("oasis-editor-import-progress-bar-done",!!e),c.classList.toggle("oasis-editor-import-progress-bar-error",!!a),wt(h,e?(wt(r=Ty(),()=>Pt("import.phase.done")),r):a?(wt(n=Cy(),()=>Pt("import.phase.error")),n):[dt(()=>Math.round(t().progress)),"%"]),M(e=>{var a=!("applying-editor-state"!==t().phase&&"stabilizing-layout"!==t().phase),n=`${t().progress}%`;return a!==e.e&&c.classList.toggle("oasis-editor-import-progress-bar-indeterminate",e.e=a),n!==e.t&&yt(c,"width",e.t=n),e},{e:void 0,t:void 0}),o;var n,r,o,i,l,s,d,c,h}}),w),wt(C,()=>Pt("status.words",[m()])),wt(V,()=>Pt("status.characters",[g()])),wt(P,()=>Pt("status.page",[B(),Math.max(1,W().pages.length)])),U.$$click=()=>I(-10),j.$$input=t=>A(Sy(t.currentTarget.valueAsNumber)),ft(j,"min",50),ft(j,"max",200),ft(j,"step",10),X.$$click=()=>I(10),wt(J,S,Y),wt(w,Z(et,{get when(){return a().persistenceStatus},get children(){return(()=>{const t=a().persistenceStatus().toLowerCase(),e=t.includes("saved")?"status.saved":t.includes("saving")?"status.saving":t.includes("error")?"status.error":null;return Z(et,{when:e,get children(){var a=ky();return wt(a,()=>Pt(e)),M(()=>gt(a,`oasis-editor-statusbar-item oasis-editor-persistence-status oasis-editor-status-${t.replace("...","ing").replace(".","")}`)),a}})})()}}),null),M(t=>{var n="oasis-editor-editor-shell"+(e().class?` ${e().class}`:""),r=u(),o=`${N()}px`,i=`${q()}px`,l=`${O()}px`,s=`${z()}px`,d=R().height/k()+"px",c=`scale(${k()})`,p=e().readOnly,g=`${a().inputBox().left}px`,m=`${a().inputBox().top}px`,M=`${a().inputBox().height}px`,x=fy.flatMap(t=>t.accept).join(","),w=Pt("status.zoom"),A=`${Pt("status.zoom")} -`,I=S()<=50,T=Pt("status.zoom"),C=`${S()}%`,V=`${Pt("status.zoom")} +`,E=S()>=200;return n!==t.e&>(h,t.e=n),t.t=bt(h,r,t.t),o!==t.a&&yt(f,"width",t.a=o),i!==t.o&&yt(f,"height",t.o=i),l!==t.i&&yt(v,"left",t.i=l),s!==t.n&&yt(v,"width",t.n=s),d!==t.s&&yt(v,"min-height",t.s=d),c!==t.h&&yt(v,"transform",t.h=c),p!==t.r&&(b.readOnly=t.r=p),g!==t.d&&yt(b,"left",t.d=g),m!==t.l&&yt(b,"top",t.l=m),M!==t.u&&yt(b,"height",t.u=M),x!==t.c&&ft(y,"accept",t.c=x),w!==t.w&&ft(H,"aria-label",t.w=w),A!==t.m&&ft(U,"aria-label",t.m=A),I!==t.f&&(U.disabled=t.f=I),T!==t.y&&ft(j,"aria-label",t.y=T),C!==t.g&&ft(j,"aria-valuetext",t.g=C),V!==t.p&&ft(X,"aria-label",t.p=V),E!==t.b&&(X.disabled=t.b=E),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0,w:void 0,m:void 0,f:void 0,y:void 0,g:void 0,p:void 0,b:void 0}),M(()=>j.value=S()),h})()}ut(["mousedown","contextmenu","input","keydown","click"]);var Ey=pt("<button>");function Ry(t){const[e,a]=Y(t,["type","icon","label","active","class","classList"]);return Mt(n=Ey(),J({get type(){return e.type??"button"},get class(){return`oasis-editor-plugin-floating-action ${e.class??""}`},get classList(){return{"is-active":e.active,...e.classList}},get"aria-label"(){return e.label},get title(){return e.label}},a),!1,!0),wt(n,Z(Ga,{get name(){return e.icon}})),n;var n}var Ly=pt("<aside>"),zy=pt("<div>");function Ny(t){const[e,a]=Y(t,["mode","width","class","classList","children","style"]);return Mt(n=Ly(),J({get class(){return`oasis-editor-plugin-side-panel ${e.class??""}`},get classList(){return{[`oasis-editor-plugin-side-panel-${e.mode??"dock"}`]:!0,...e.classList}},get style(){return{"--oasis-plugin-side-panel-width":"number"==typeof e.width?`${e.width}px`:e.width??"360px",...e.style}}},a),!1,!0),wt(n,()=>e.children),n;var n}function qy(t){const[e,a]=Y(t,["class","children"]);return Mt(n=zy(),J({get class(){return`oasis-editor-plugin-side-panel-header ${e.class??""}`}},a),!1,!0),wt(n,()=>e.children),n;var n}function Oy(t){const[e,a]=Y(t,["class","children"]);return Mt(n=zy(),J({get class(){return`oasis-editor-plugin-side-panel-body ${e.class??""}`}},a),!1,!0),wt(n,()=>e.children),n;var n}var Py=pt("<button>");function Wy(t){const[e,a]=Y(t,["type","icon","label","active","variant","size","class","classList"]);return Mt(n=Py(),J({get type(){return e.type??"button"},get class(){return`oasis-editor-ui-icon-button ${e.class??""}`},get classList(){return{[`oasis-editor-ui-icon-button-${e.variant??"ghost"}`]:!0,[`oasis-editor-ui-icon-button-${e.size??"md"}`]:!0,"is-active":e.active,...e.classList}},get"aria-label"(){return e.label},get title(){return e.label}},a),!1,!0),wt(n,Z(Ga,{get name(){return e.icon}})),n;var n}var Hy=pt("<div class=oasis-editor-plugin-floating-actions>"),Uy=pt("<div class=oasis-editor-plugin-ui-host><div class=oasis-editor-plugin-ui-main>"),Fy=pt("<div class=oasis-editor-plugin-side-panel-overlay>"),By=pt("<span class=oasis-editor-plugin-side-panel-icon>"),Gy=pt("<div class=oasis-editor-plugin-side-panel-title><span>");const Zy={floatingActions:[],sidePanels:[],activeSidePanelId:null};function Ky(t){const e=k(()=>t.children),[a,n]=y(Zy);x(()=>{const e=t.editor();n(e.ui.getSnapshot());T(e.ui.onChange(()=>{n(e.ui.getSnapshot())}))});const r=w(()=>a().sidePanels.find(t=>t.id===a().activeSidePanelId)),o=()=>{var t;return(null==(t=r())?void 0:t.mode)??"dock"},i=()=>"dock"===o()?r():void 0,l=()=>a().floatingActions.filter(t=>"container"===(t.scope??"container")),s=()=>a().floatingActions.filter(t=>"viewport"===t.scope),d=(e,a=!1)=>Z($,{get each(){return function(t){const e=new Map;for(const a of t){const t=a.placement??"bottom-right";e.set(t,[...e.get(t)??[],a])}return Array.from(e.entries()).map(([t,e])=>({placement:t,actions:e}))}(e())},children:e=>{return wt(n=Hy(),Z($,{get each(){return e.actions},children:e=>Z(Ry,{get icon(){return e.icon??"sparkles"},get label(){return function(t){return t.tooltip?t.tooltip:t.labelKey?Pt(t.labelKey):t.label??t.id}(e)},get disabled(){return!function(t,e){const a=Dt(e.command);return t.commands.canExecute(a.name,a.payload)}(t.editor(),e)},get"data-testid"(){return`plugin-floating-action-${e.id}`},onClick:()=>function(t,e){const a=Dt(e.command);t.commands.execute(a.name,a.payload)}(t.editor(),e)})})),M(t=>vt(n,{[`oasis-editor-plugin-floating-actions-${e.placement}`]:!0,"oasis-editor-plugin-floating-actions-viewport":a},t)),n;var n}});return wt((c=Uy()).firstChild,e),wt(c,Z(et,{get when(){return i()},children:e=>Dy(t.editor,e())}),null),wt(c,Z(et,{get when(){return"overlay"===o()?r():void 0},children:e=>{return wt(a=Fy(),()=>Dy(t.editor,e())),a;var a}}),null),wt(c,()=>d(l),null),wt(c,Z(et,{get when(){return s().length>0},get children(){return Z(Rt,{get children(){return d(s,!0)}})}}),null),M(()=>c.classList.toggle("has-docked-side-panel",!!Boolean(i()))),c;var c}function Dy(t,e){const a=()=>t().ui.closeSidePanel(e.id);return Z(Ny,{get mode(){return e.mode??"dock"},get width(){return e.width},get"data-testid"(){return`plugin-side-panel-${e.id}`},get children(){return[Z(qy,{get children(){return[(n=Gy(),r=n.firstChild,wt(n,Z(et,{get when(){return e.icon},get children(){var t=By();return wt(t,Z(Ga,{get name(){return e.icon}})),t}}),r),wt(r,(t=dt(()=>!!e.titleKey),()=>t()?Pt(e.titleKey):e.title)),n),Z(Wy,{icon:"x",label:"Close panel",size:"sm",onClick:a})];var t,n,r}}),Z(Oy,{get children(){return e.render({editor:t(),commands:t().commands,ui:t().ui,panelId:e.id,closePanel:a,getState:()=>t().state,getDocument:()=>t().state.document,getSelection:()=>t().state.selection})}})]}})}var jy=pt("<div class=oasis-editor-main-container><section class=oasis-editor-stage>");function Xy(t){let e,a;const n=a=>{var n,r;e=a,null==(r=(n=t.refs).onSurfaceRef)||r.call(n,a)},r=e=>{var n,r;a=e,null==(r=(n=t.refs).onViewportRef)||r.call(n,e)},o=n=>{if(!e)return;const r=Yd({surface:e,state:t.state});if(!r)return;const o=_d(r,n)[0];if(!o)return;const i=a,l=o.top;if(i){const t=i.getBoundingClientRect();return void i.scrollTo({top:i.scrollTop+(l-t.top)-24,behavior:"smooth"})}window.scrollTo({top:window.scrollY+l-24,behavior:"smooth"})};return[Z(et,{get when(){return t.showChrome},get children(){return[Z(et,{get when(){return"compact"===t.toolbarView},get children(){return Z(et,{get when(){return t.showTitleBar},get fallback(){return Z(et,{get when(){return t.showMenubar},get children(){return Z(tn,{get host(){return t.toolbarHost},get registry(){return t.menuRegistry}})}})},get children(){return Z(nn,{get children(){return Z(et,{get when(){return t.showMenubar},get children(){return Z(tn,{get host(){return t.toolbarHost},get registry(){return t.menuRegistry}})}})}})}})}}),Z(et,{get when(){return t.showToolbar},get children(){return Z(xh,{get host(){return t.toolbarHost},get registry(){return t.toolbarRegistry},get showFileGroup(){return!!dt(()=>"ribbon"===t.toolbarView)()||!t.showMenubar},get view(){return t.toolbarView},get layout(){return t.toolbarLayout}})}})]}}),Z(Ky,{get editor(){return t.runtimeEditor},get children(){var i=jy(),l=i.firstChild;return wt(i,Z(et,{get when(){return dt(()=>!!t.showChrome)()&&t.showOutline},get children(){return Z(rc,{get state(){return t.state},onNavigate:o,surfaceRef:()=>e,viewportRef:()=>a})}}),l),wt(l,Z(Vy,{state:()=>t.state,get layout(){return{...t.layout,showHorizontalRuler:t.showChrome,measuredBlockHeights:()=>t.measuredBlockHeights(),measuredParagraphLayouts:()=>t.measuredParagraphLayouts(),viewportHeight:t.viewportHeight(),readOnly:t.isReadOnly}},get overlays(){return{...t.overlays,toolbarHost:t.toolbarHost,persistenceStatus:()=>t.persistenceStatus(),showFloatingTableToolbar:()=>t.showFloatingTableToolbar()}},get refs(){return{...t.refs,onViewportRef:r,onSurfaceRef:n}},get surfaceHandlers(){return t.surfaceHandlers},get inputHandlers(){return t.inputHandlers},get fileHandlers(){return t.fileHandlers}})),i}})]}var Jy=pt("<div class=oasis-editor-main-container><section class=oasis-editor-stage style=padding:0>"),Yy=pt('<div class=oasis-inline-shell style="border:1px solid var(--oasis-toolbar-border);border-radius:var(--oasis-radius);overflow:hidden;display:flex;flex-direction:column">');function Qy(t){return wt(e=Yy(),Z(et,{get when(){return dt(()=>!!t.showChrome)()&&t.showToolbar},get children(){return Z(xh,{get host(){return t.toolbarHost},get registry(){return t.toolbarRegistry},get view(){return t.toolbarView},get layout(){return t.toolbarLayout}})}}),null),wt(e,Z(Ky,{get editor(){return t.runtimeEditor},get children(){var e=Jy();return wt(e.firstChild,Z(Vy,{state:()=>t.state,get layout(){return{...t.layout,measuredBlockHeights:()=>t.measuredBlockHeights(),measuredParagraphLayouts:()=>t.measuredParagraphLayouts(),viewportHeight:t.viewportHeight(),readOnly:t.isReadOnly}},get overlays(){return{...t.overlays,toolbarHost:t.toolbarHost,persistenceStatus:()=>t.persistenceStatus(),showFloatingTableToolbar:()=>t.showFloatingTableToolbar()}},get refs(){return t.refs},get surfaceHandlers(){return t.surfaceHandlers},get inputHandlers(){return t.inputHandlers},get fileHandlers(){return t.fileHandlers}})),e}}),null),e;var e}var _y=pt("<div class=oasis-editor-main-container><section class=oasis-editor-stage style=padding:0>"),$y=pt("<div class=oasis-balloon-shell>");function tM(t){return wt(e=$y(),Z(Ky,{get editor(){return t.runtimeEditor},get children(){var e=_y();return wt(e.firstChild,Z(Vy,{state:()=>t.state,get layout(){return{...t.layout,measuredBlockHeights:()=>t.measuredBlockHeights(),measuredParagraphLayouts:()=>t.measuredParagraphLayouts(),viewportHeight:t.viewportHeight(),readOnly:t.isReadOnly}},get overlays(){return{...t.overlays,toolbarHost:t.toolbarHost,persistenceStatus:()=>t.persistenceStatus(),showFloatingTableToolbar:()=>t.showFloatingTableToolbar()}},get refs(){return t.refs},get surfaceHandlers(){return t.surfaceHandlers},get inputHandlers(){return t.inputHandlers},get fileHandlers(){return t.fileHandlers}})),e}})),e;var e}var eM=pt("<div class=oasis-editor-dialog-footer data-testid=editor-dialog-footer>"),aM=pt("<div class=oasis-editor-dialog-overlay><div role=dialog aria-modal=true data-testid=editor-dialog><div class=oasis-editor-dialog-header><h3 class=oasis-editor-dialog-title></h3><button class=oasis-editor-dialog-close data-testid=editor-dialog-close><i data-lucide=x></i></button></div><div data-testid=editor-dialog-body>");function nM(t){let e;const a=_(),n=w(()=>t.titleId??a),r=w(()=>t.size??"md"),o=w(()=>["oasis-editor-dialog",`oasis-editor-dialog-${r()}`,t.class].filter(Boolean).join(" ")),i=w(()=>["oasis-editor-dialog-body",t.bodyClass].filter(Boolean).join(" ")),l=e=>{"Escape"===e.key&&t.isOpen&&t.onClose()};return I(()=>{window.addEventListener("keydown",l)}),T(()=>{window.removeEventListener("keydown",l)}),Z(et,{get when(){return t.isOpen},get children(){var a=aM(),r=a.firstChild,l=r.firstChild,s=l.firstChild,d=s.nextSibling,c=l.nextSibling;a.$$click=()=>{(t.closeOnOverlayClick??1)&&t.onClose()},r.$$click=t=>t.stopPropagation();return"function"==typeof e?xt(e,r):e=r,wt(s,()=>t.title),mt(d,"click",t.onClose,!0),wt(c,()=>t.children),wt(r,Z(et,{get when(){return t.footer},get children(){var e=eM();return wt(e,()=>t.footer),e}}),null),M(e=>{var a=o(),l=t.ariaLabel,h=t.ariaLabel?void 0:n(),p=t.ariaDescribedBy,u=n(),f=Pt("generic.close"),g=i();return a!==e.e&>(r,e.e=a),l!==e.t&&ft(r,"aria-label",e.t=l),h!==e.a&&ft(r,"aria-labelledby",e.a=h),p!==e.o&&ft(r,"aria-describedby",e.o=p),u!==e.i&&ft(s,"id",e.i=u),f!==e.n&&ft(d,"title",e.n=f),g!==e.s&>(c,e.s=g),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),a}})}ut(["click"]);var rM=pt("<div><div class=oasis-editor-tabs-list role=tablist>"),oM=pt("<button type=button role=tab class=oasis-editor-tabs-tab>"),iM=pt("<div role=tabpanel class=oasis-editor-tabs-panel>");function lM(t,e,a){if(t.length)for(let n=0;n<t.length;n+=1){const r=t[(e+n*a+t.length)%t.length];if(r&&!r.disabled)return r}}function sM(t){const e=_(),a=w(()=>t.items),n=w(()=>{var t,e;return(null==(t=a().find(t=>!t.disabled))?void 0:t.id)??(null==(e=a()[0])?void 0:e.id)??""}),[r,o]=y(t.defaultValue??n()),i=w(()=>t.value??r()??n()),l=w(()=>a().find(t=>t.id===i()&&!t.disabled)??a().find(t=>!t.disabled)),s=w(()=>["oasis-editor-tabs",t.class].filter(Boolean).join(" ")),d=[],c=(e,n=!1)=>{var r;e&&!e.disabled&&(void 0===t.value&&o(e.id),null==(r=t.onChange)||r.call(t,e.id),n&&queueMicrotask(()=>{var t;return null==(t=d[a().findIndex(t=>t.id===e.id)])?void 0:t.focus()}))},h=t=>{if("ArrowRight"!==t.key&&"ArrowLeft"!==t.key&&"Home"!==t.key&&"End"!==t.key)return;t.preventDefault();const e=Math.max(0,a().findIndex(t=>{var e;return t.id===(null==(e=l())?void 0:e.id)}));if("Home"===t.key)return c(lM(a(),0,1),!0);if("End"===t.key)return c(lM(a(),a().length-1,-1),!0);const n="ArrowRight"===t.key?1:-1;c(lM(a(),e+n,n),!0)};return p=rM(),(u=p.firstChild).$$keydown=h,wt(u,Z($,{get each(){return a()},children:(t,a)=>{const n=`${e}-${t.id}-tab`,r=`${e}-${t.id}-panel`;return(o=oM()).$$click=()=>c(t),xt(t=>{d[a()]=t},o),ft(o,"id",n),ft(o,"aria-controls",r),wt(o,()=>t.label),M(e=>{var a,n,r,i=(null==(a=l())?void 0:a.id)===t.id,s=t.disabled?"true":void 0,d=t.disabled,c=(null==(n=l())?void 0:n.id)===t.id?0:-1,h=!((null==(r=l())?void 0:r.id)!==t.id),p=t.testId;return i!==e.e&&ft(o,"aria-selected",e.e=i),s!==e.t&&ft(o,"aria-disabled",e.t=s),d!==e.a&&(o.disabled=e.a=d),c!==e.o&&ft(o,"tabindex",e.o=c),h!==e.i&&o.classList.toggle("is-active",e.i=h),p!==e.n&&ft(o,"data-testid",e.n=p),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),o;var o}})),wt(p,Z($,{get each(){return a()},children:t=>{return wt(a=iM(),()=>t.panel),M(n=>{var r,o,i=`${e}-${t.id}-panel`,s=`${e}-${t.id}-tab`,d=(null==(r=l())?void 0:r.id)!==t.id,c=!((null==(o=l())?void 0:o.id)!==t.id);return i!==n.e&&ft(a,"id",n.e=i),s!==n.t&&ft(a,"aria-labelledby",n.t=s),d!==n.a&&(a.hidden=n.a=d),c!==n.o&&a.classList.toggle("is-active",n.o=c),n},{e:void 0,t:void 0,a:void 0,o:void 0}),a;var a}}),null),M(e=>{var a=s(),n=t.ariaLabel;return a!==e.e&>(p,e.e=a),n!==e.t&&ft(u,"aria-label",e.t=n),e},{e:void 0,t:void 0}),p;var p,u}ut(["keydown","click"]);var dM=pt("<button><span class=oasis-editor-ui-button-label>");var cM=pt("<span class=oasis-editor-ui-field-label>"),hM=pt("<span class=oasis-editor-ui-field-description>"),pM=pt("<span class=oasis-editor-ui-field-error>"),uM=pt("<label><input class=oasis-editor-ui-input>");ut(["input"]);var fM=pt("<span class=oasis-editor-ui-field-description>"),gM=pt("<span class=oasis-editor-ui-field-error>"),mM=pt("<label><input type=checkbox class=oasis-editor-ui-checkbox-input><span class=oasis-editor-ui-checkbox-copy><span class=oasis-editor-ui-field-label>");var vM=pt("<span class=oasis-editor-ui-field-label>"),bM=pt("<span class=oasis-editor-ui-field-description>"),yM=pt("<span class=oasis-editor-ui-field-error>"),MM=pt("<label><select class=oasis-editor-ui-select>"),xM=pt("<option>");var wM=pt("<div>");const SM=Number.MAX_SAFE_INTEGER;class AM{constructor(){a(this,"entries",[]),a(this,"listeners",new Set)}register(t){const e=this.entries.findIndex(e=>e.id===t.id);e>=0?this.entries[e]=t:this.entries.push(t),this.sortByOrder(),this.emit()}insertBefore(t,e){this.spliceRelative(t,e,0)}insertAfter(t,e){this.spliceRelative(t,e,1)}replace(t,e){const a=this.entries.findIndex(e=>e.id===t);a<0?this.register(e):(this.entries[a]=e,this.emit())}remove(t){const e=this.entries.filter(e=>e.id!==t);e.length!==this.entries.length&&(this.entries=e,this.emit())}move(t,e){const a=this.entries.findIndex(e=>e.id===t);if(a<0)return;const[n]=this.entries.splice(a,1),r=this.resolveMoveIndex(e);if(null===r)return void this.entries.splice(a,0,n);const o=Math.max(0,Math.min(r,this.entries.length));this.entries.splice(o,0,n),this.emit()}get(t){return this.entries.find(e=>e.id===t)}getOrdered(){return[...this.entries]}getItems(){return this.getOrdered()}clear(){0!==this.entries.length&&(this.entries=[],this.emit())}onChange(t){return this.listeners.add(t),()=>this.listeners.delete(t)}spliceRelative(t,e,a){this.entries=this.entries.filter(t=>t.id!==e.id);const n=this.entries.findIndex(e=>e.id===t);n<0?this.entries.push(e):this.entries.splice(n+a,0,e),this.emit()}resolveMoveIndex(t){if("number"==typeof t)return t;if("before"in t){const e=this.entries.findIndex(e=>e.id===t.before);return e>=0?e:null}const e=this.entries.findIndex(e=>e.id===t.after);return e>=0?e+1:null}sortByOrder(){this.entries=this.entries.map((t,e)=>({item:t,index:e})).sort((t,e)=>(t.item.order??SM)-(e.item.order??SM)||t.index-e.index).map(t=>t.item)}emit(){for(const t of this.listeners)t()}}function IM(){return new AM}const TM=14.6667;function CM(t){return Number.isFinite(t)?.75*t:0}function kM(t){return CM(t.fontSize??TM)}const VM=[8,9,10,11,12,14,16,18,20,24,28,32,36,48,72];function EM(t){return Math.round(100*CM(t))/100}function RM(t){return Math.round(1e4*(e=t,Number.isFinite(e)?e/.75:0))/1e4;var e}function LM(t){const e=Number(t);return!Number.isFinite(e)||e<=0?"":String(EM(e))}function zM(t){const e=Number(t);return!Number.isFinite(e)||e<=0?null:RM(e)}const NM=[{value:"single",labelKey:"underline.style.single",preview:{borderStyle:"solid"}},{value:"double",labelKey:"underline.style.double",preview:{borderStyle:"double",borderBottomWidth:"3px"}},{value:"thick",labelKey:"underline.style.thick",preview:{borderStyle:"solid",borderBottomWidth:"3px"}},{value:"dotted",labelKey:"underline.style.dotted",preview:{borderStyle:"dotted"}},{value:"dottedHeavy",labelKey:"underline.style.dottedHeavy",preview:{borderStyle:"dotted",borderBottomWidth:"3px"}},{value:"dash",labelKey:"underline.style.dashed",preview:{borderStyle:"dashed"}},{value:"dashedHeavy",labelKey:"underline.style.dashedHeavy",preview:{borderStyle:"dashed",borderBottomWidth:"3px"}},{value:"dashLong",labelKey:"underline.style.longDashes",preview:{borderStyle:"dashed"}},{value:"dashLongHeavy",labelKey:"underline.style.longDashesHeavy",preview:{borderStyle:"dashed",borderBottomWidth:"3px"}},{value:"dotDash",labelKey:"underline.style.dotDash",preview:{borderStyle:"dashed"}},{value:"dashDotHeavy",labelKey:"underline.style.dotDashHeavy",preview:{borderStyle:"dashed",borderBottomWidth:"3px"}},{value:"dotDotDash",labelKey:"underline.style.dotDotDash",preview:{borderStyle:"dashed"}},{value:"dashDotDotHeavy",labelKey:"underline.style.dotDotDashHeavy",preview:{borderStyle:"dashed",borderBottomWidth:"3px"}},{value:"wave",labelKey:"underline.style.wave",preview:{borderStyle:"wavy",svg:'<svg width="100%" height="6" viewBox="0 0 60 6" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 3 Q 5 0 10 3 T 20 3 T 30 3 T 40 3 T 50 3 T 60 3" fill="none" stroke="currentColor" stroke-width="1"/></svg>'}},{value:"wavyHeavy",labelKey:"underline.style.waveHeavy",preview:{borderStyle:"wavy",svg:'<svg width="100%" height="6" viewBox="0 0 60 6" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 3 Q 5 0 10 3 T 20 3 T 30 3 T 40 3 T 50 3 T 60 3" fill="none" stroke="currentColor" stroke-width="2"/></svg>'}},{value:"wavyDouble",labelKey:"underline.style.waveDouble",preview:{borderStyle:"wavy",svg:'<svg width="100%" height="9" viewBox="0 0 60 9" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 2 Q 5 -1 10 2 T 20 2 T 30 2 T 40 2 T 50 2 T 60 2" fill="none" stroke="currentColor" stroke-width="1"/><path d="M0 7 Q 5 4 10 7 T 20 7 T 30 7 T 40 7 T 50 7 T 60 7" fill="none" stroke="currentColor" stroke-width="1"/></svg>'}}];var qM=pt("<button type=button class=oasis-editor-color-menu-action data-testid=editor-toolbar-underline-remove role=menuitem><span class=oasis-editor-color-menu-action-swatch><i data-lucide=slash></i></span><span>"),OM=pt("<div class=oasis-editor-underline-menu-list>"),PM=pt('<span class="oasis-editor-color-split-icon oasis-editor-underline-split-icon"><span class=oasis-editor-underline-split-glyph aria-hidden=true>U</span><span class=oasis-editor-underline-split-indicator>'),WM=pt('<span class="oasis-editor-underline-menu-stroke oasis-editor-underline-menu-stroke-svg">'),HM=pt("<button type=button class=oasis-editor-underline-menu-item role=menuitemradio><span class=oasis-editor-underline-menu-preview></span><span class=oasis-editor-underline-menu-label>"),UM=pt("<span class=oasis-editor-underline-menu-stroke>");const FM=/Mac/i.test(navigator.userAgent)?"⌘":"Ctrl",BM=`${Pt("toolbar.underline")} (${FM}+U)`,GM="editor-toolbar-underline";function ZM(t){const e=t.api,[a,n]=y("single"),[r,o]=y(!1),i=()=>e.commands.state("underline").isActive,l=()=>String(e.commands.state("setUnderlineStyle").value??"");return Z(Ec,{get open(){return r()},onOpenChange:o,tooltip:BM,get rootActive(){return r()||i()},mainTestId:GM,get mainPressed(){return i()},onMain:()=>{if(!i()){const t=a();"single"===t||l()||e.commands.execute("setUnderlineStyle",t)}e.commands.execute("underline")},menuTestId:`${GM}-dropdown`,panelClass:"oasis-editor-color-menu oasis-editor-underline-menu",panelRole:"menu",get mainContent(){return t=PM(),e=t.firstChild.nextSibling,M(()=>ft(e,"data-style",(l()||a()||"single").toLowerCase())),t;var t,e},get children(){return[(a=qM(),r=a.firstChild.nextSibling,a.$$click=()=>{i()&&e.commands.execute("underline"),e.commands.execute("setUnderlineStyle",null),o(!1)},wt(r,()=>Pt("toolbar.underlineRemove")),a),(t=OM(),wt(t,Z($,{each:NM,children:t=>{const a=()=>i()&&(l()||(i()?"single":"")).toLowerCase()===t.value.toLowerCase();return r=HM(),s=r.firstChild,d=s.nextSibling,r.$$click=()=>{(t=>{n(t);const a=i();e.commands.execute("setUnderlineStyle","single"===t?null:t),a||e.commands.execute("underline")})(t.value),o(!1)},wt(s,Z(et,{get when(){return t.preview.svg},get fallback(){return e=UM(),M(a=>bt(e,"wavy"===t.preview.borderStyle?void 0:{"border-bottom-style":t.preview.borderStyle,"border-bottom-width":t.preview.borderBottomWidth??"1px"},a)),e;var e},get children(){var e=WM();return M(()=>e.innerHTML=t.preview.svg),e}})),wt(d,()=>Pt(t.labelKey)),M(e=>{var n=!!a(),o=a(),i=`${GM}-style-${t.value}`,l=Pt(t.labelKey);return n!==e.e&&r.classList.toggle("oasis-editor-underline-menu-item-active",e.e=n),o!==e.t&&ft(r,"aria-checked",e.t=o),i!==e.a&&ft(r,"data-testid",e.a=i),l!==e.o&&ft(r,"title",e.o=l),e},{e:void 0,t:void 0,a:void 0,o:void 0}),r;var r,s,d}})),t)];var t,a,r}})}ut(["click"]);var KM=pt("<option value=decimal>"),DM=pt("<option value=lowerLetter>"),jM=pt("<option value=upperLetter>"),XM=pt("<option value=lowerRoman>"),JM=pt("<option value=upperRoman>"),YM=pt("<option value=bullet>"),QM=pt("<div class=oasis-editor-toolbar-list-options><label class=oasis-editor-toolbar-field><span></span></label><label class=oasis-editor-toolbar-field><span></span><input type=number class=oasis-editor-tool-number data-testid=editor-toolbar-list-start-at min=1 step=1 placeholder=1>");var _M=pt('<div class=oasis-editor-dialog-row><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><input type=number class=oasis-editor-dialog-input min=0.5 step=0.05 data-testid=editor-line-spacing-dialog-line-height>'),$M=pt('<div class=oasis-editor-dialog-row><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><input type=number class=oasis-editor-dialog-input min=0 step=1 data-testid=editor-line-spacing-dialog-spacing-before></div><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><input type=number class=oasis-editor-dialog-input min=0 step=1 data-testid=editor-line-spacing-dialog-spacing-after>'),tx=pt("<div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><div class=oasis-editor-dialog-preview data-testid=editor-line-spacing-dialog-preview><br>"),ex=pt('<button class="oasis-editor-dialog-button oasis-editor-dialog-button-secondary"data-testid=editor-line-spacing-dialog-cancel>'),ax=pt('<button class="oasis-editor-dialog-button oasis-editor-dialog-button-primary"data-testid=editor-line-spacing-dialog-apply>');function nx(t){const[e,a]=y(""),[n,r]=y(""),[o,i]=y("");x(()=>{t.isOpen&&(a(t.initial.lineHeight??""),r(t.initial.spacingBefore??""),i(t.initial.spacingAfter??""))});const l=t=>{if(""===t.trim())return null;const e=Number(t);return Number.isFinite(e)?e:null},s=w(()=>{const t=l(e());return{"line-height":null!==t&&t>0?String(t):void 0}}),d=()=>{t.onApply({lineHeight:l(e()),spacingBefore:l(n()),spacingAfter:l(o())},t.initial),t.onClose()};return Z(nM,{get isOpen(){return t.isOpen},get title(){return Pt("lineSpacing.title")},get onClose(){return t.onClose},get footer(){return[(a=ex(),mt(a,"click",t.onClose,!0),wt(a,()=>Pt("generic.cancel")),a),(e=ax(),e.$$click=d,wt(e,()=>Pt("generic.apply")),e)];var e,a},get children(){return[(v=_M(),b=v.firstChild.firstChild,y=b.nextSibling,wt(b,()=>Pt("lineSpacing.lineSpacingLabel")),y.$$input=t=>a(t.currentTarget.value),M(()=>y.value=e()),v),(h=$M(),p=h.firstChild,u=p.firstChild,f=u.nextSibling,g=p.nextSibling.firstChild,m=g.nextSibling,wt(u,()=>Pt("lineSpacing.spacingBeforeLabel")),f.$$input=t=>r(t.currentTarget.value),wt(g,()=>Pt("lineSpacing.spacingAfterLabel")),m.$$input=t=>i(t.currentTarget.value),M(()=>f.value=n()),M(()=>m.value=o()),h),(t=tx(),l=t.firstChild,d=l.nextSibling,c=d.firstChild,wt(l,()=>Pt("lineSpacing.preview")),wt(d,()=>Pt("lineSpacing.previewText"),c),wt(d,()=>Pt("lineSpacing.previewText"),null),M(t=>bt(d,s(),t)),t)];var t,l,d,c,h,p,u,f,g,m,v,b,y}})}ut(["input","click"]);var rx=pt("<div class=oasis-editor-line-spacing-menu-separator role=separator>"),ox=pt('<button type=button class="oasis-editor-line-spacing-item oasis-editor-line-spacing-item-more"role=menuitem data-testid=editor-toolbar-line-spacing-options><span class=oasis-editor-line-spacing-item-check aria-hidden=true></span><span class=oasis-editor-line-spacing-item-label>'),ix=pt("<div class=oasis-editor-toolbar-dropdown>"),lx=pt('<button type=button class="oasis-editor-tool-button oasis-editor-tool-button-dropdown oasis-editor-line-spacing-button"aria-haspopup=menu data-testid=editor-toolbar-line-spacing><span class=oasis-editor-line-spacing-icon aria-hidden=true><svg xmlns=http://www.w3.org/2000/svg width=18 height=18 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><polyline points="4 7 7 4 10 7"></polyline><line x1=7 y1=4 x2=7 y2=20></line><polyline points="4 17 7 20 10 17"></polyline><line x1=13 y1=6 x2=21 y2=6></line><line x1=13 y1=12 x2=21 y2=12></line><line x1=13 y1=18 x2=21 y2=18>'),sx=pt('<svg xmlns=http://www.w3.org/2000/svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2.5 stroke-linecap=round stroke-linejoin=round><polyline points="20 6 9 17 4 12">'),dx=pt("<button type=button class=oasis-editor-line-spacing-item role=menuitemradio><span class=oasis-editor-line-spacing-item-check aria-hidden=true></span><span class=oasis-editor-line-spacing-item-label>");const cx=[1,1.15,1.5,2,2.5,3];function hx(t){return null==t?"":String(t)}function px(t){const e=t.api,[a,n]=y(!1),[r,o]=y(!1),[i,l]=y({lineHeight:"",spacingBefore:"",spacingAfter:""}),s=w(()=>{const t=hx(e.commands.state("setLineHeight").value);if(""===t)return null;const a=Number(t);return Number.isFinite(a)?a:null}),d=()=>n(!1),c=()=>{l({lineHeight:hx(e.commands.state("setLineHeight").value),spacingBefore:hx(e.commands.state("setSpacingBefore").value),spacingAfter:hx(e.commands.state("setSpacingAfter").value)}),o(!0),d()},h=(t,a)=>{const n=a.lineHeight?Number(a.lineHeight):null,r=a.spacingBefore?Number(a.spacingBefore):null,o=a.spacingAfter?Number(a.spacingAfter):null;t.lineHeight!==n&&e.commands.execute("setLineHeight",t.lineHeight),t.spacingBefore!==r&&e.commands.execute("setSpacingBefore",t.spacingBefore),t.spacingAfter!==o&&e.commands.execute("setSpacingAfter",t.spacingAfter),e.focusEditor()};return wt(p=ix(),Z(vc,{get open(){return a()},onOpenChange:n,panelRole:"menu",panelClass:"oasis-editor-toolbar-dropdown-menu oasis-editor-line-spacing-menu",trigger:t=>{return(e=lx()).$$click=()=>t.toggle(),xt(e=>t.ref(e),e),M(a=>{var n=!!t.open,r=Pt("metric.lineSpacing"),o=Pt("metric.lineSpacing"),i=t.open;return n!==a.e&&e.classList.toggle("oasis-editor-tool-button-active",a.e=n),r!==a.t&&ft(e,"title",a.t=r),o!==a.a&&ft(e,"aria-label",a.a=o),i!==a.o&&ft(e,"aria-expanded",a.o=i),a},{e:void 0,t:void 0,a:void 0,o:void 0}),e;var e},get children(){return[Z($,{each:cx,children:t=>{const a=function(t){return t.toFixed(t===Math.floor(t)?1:2)}(t),n=()=>{const e=s();return null!==e&&(a=e,n=t,Math.abs(a-n)<.001);var a,n};return r=dx(),o=r.firstChild,i=o.nextSibling,r.$$click=()=>(t=>{e.commands.execute("setLineHeight",t),e.focusEditor(),d()})(t),wt(o,Z(et,{get when(){return n()},get children(){return sx()}})),wt(i,a),M(t=>{var e=!!n(),o=n(),i=`editor-toolbar-line-spacing-${a.replace(".","_")}`,l=Pt("metric.lineSpacingOption",[a]);return e!==t.e&&r.classList.toggle("oasis-editor-line-spacing-item-active",t.e=e),o!==t.t&&ft(r,"aria-checked",t.t=o),i!==t.a&&ft(r,"data-testid",t.a=i),l!==t.o&&ft(r,"title",t.o=l),t},{e:void 0,t:void 0,a:void 0,o:void 0}),r;var r,o,i}}),rx(),(t=ox(),a=t.firstChild.nextSibling,t.$$click=c,wt(a,()=>Pt("metric.lineSpacingOptions")),t)];var t,a}}),null),wt(p,Z(et,{get when(){return r()},get children(){return Z(Rt,{get children(){return Z(nx,{get isOpen(){return r()},get initial(){return i()},onClose:()=>o(!1),onApply:h})}})}}),null),p;var p}ut(["click"]);var ux=pt('<div class="oasis-editor-toolbar-panel-section oasis-editor-toolbar-panel-actions">'),fx=pt("<div class=oasis-editor-toolbar-panel-grid><label class=oasis-editor-tool-metric><span></span><input type=number class=oasis-editor-tool-number data-testid=editor-toolbar-spacing-after min=0 step=1></label><label class=oasis-editor-tool-metric><span></span><input type=number class=oasis-editor-tool-number data-testid=editor-toolbar-indent-left min=0 step=1></label><label class=oasis-editor-tool-metric><span></span><input type=number class=oasis-editor-tool-number data-testid=editor-toolbar-indent-first-line step=1></label><label class=oasis-editor-tool-metric><span></span><input type=number class=oasis-editor-tool-number data-testid=editor-toolbar-indent-hanging min=0 step=1></label><label class=oasis-editor-tool-color><span></span><input type=color class=oasis-editor-tool-color-input data-testid=editor-toolbar-paragraph-shading>");const gx=(t,e)=>{const a=t.commands.state(e).value;return null==a?"":String(a)};ut(["input"]);var mx=pt('<div class="oasis-editor-toolbar-panel-section oasis-editor-toolbar-panel-actions">'),vx=pt("<div class=oasis-editor-toolbar-badge data-testid=editor-table-selection-label>");function bx(t){const e=t.api,a=t=>!e.commands.state(t).isEnabled;return Z(Ac,{icon:"table-properties",testId:"editor-toolbar-table-dropdown",get tooltip(){return Pt("toolbar.table")},hideChevron:!0,panelClass:"oasis-editor-toolbar-panel oasis-editor-toolbar-table-panel",keepMounted:!0,get children(){return[(l=mx(),wt(l,Z(fc,{icon:"combine","data-testid":"editor-toolbar-merge-table",get disabled(){return a("tableMerge")},onClick:()=>e.commands.execute("tableMerge"),get tooltip(){return Pt("table.mergeTooltip")}}),null),wt(l,Z(fc,{icon:"split","data-testid":"editor-toolbar-split-table",get disabled(){return a("tableSplit")},onClick:()=>e.commands.execute("tableSplit"),get tooltip(){return Pt("table.splitTooltip")}}),null),l),(i=mx(),wt(i,Z(fc,{icon:"columns","data-testid":"editor-toolbar-insert-table-column-before",get disabled(){return a("tableInsertColumnBefore")},onClick:()=>e.commands.execute("tableInsertColumnBefore"),get tooltip(){return Pt("table.insertColumnLeft")}}),null),wt(i,Z(fc,{icon:"columns","data-testid":"editor-toolbar-insert-table-column-after",get disabled(){return a("tableInsertColumnAfter")},onClick:()=>e.commands.execute("tableInsertColumnAfter"),get tooltip(){return Pt("table.insertColumnRight")}}),null),wt(i,Z(fc,{icon:"trash-2","data-testid":"editor-toolbar-delete-table-column",get disabled(){return a("tableDeleteColumn")},onClick:()=>e.commands.execute("tableDeleteColumn"),get tooltip(){return Pt("table.deleteColumn")}}),null),i),(o=mx(),wt(o,Z(fc,{icon:"rows","data-testid":"editor-toolbar-insert-table-row-before",get disabled(){return a("tableInsertRowBefore")},onClick:()=>e.commands.execute("tableInsertRowBefore"),get tooltip(){return Pt("table.insertRowAbove")}}),null),wt(o,Z(fc,{icon:"rows","data-testid":"editor-toolbar-insert-table-row-after",get disabled(){return a("tableInsertRowAfter")},onClick:()=>e.commands.execute("tableInsertRowAfter"),get tooltip(){return Pt("table.insertRowBelow")}}),null),wt(o,Z(fc,{icon:"trash-2","data-testid":"editor-toolbar-delete-table-row",get disabled(){return a("tableDeleteRow")},onClick:()=>e.commands.execute("tableDeleteRow"),get tooltip(){return Pt("table.deleteRow")}}),null),o),(r=mx(),wt(r,Z(fc,{icon:"palette","data-testid":"editor-toolbar-table-shading",onClick:()=>{const t=prompt(Pt("table.cellBgColorPrompt"),"#f1f5f9");null!==t&&e.commands.execute("tableCellShading",t)},get tooltip(){return Pt("table.cellColor")}}),null),wt(r,Z(fc,{icon:"frame","data-testid":"editor-toolbar-table-borders",onClick:()=>e.commands.execute("tableCellBorders"),get tooltip(){return Pt("table.applyBorders")}}),null),wt(r,Z(fc,{icon:"square","data-testid":"editor-toolbar-table-no-borders",onClick:()=>e.commands.execute("tableCellNoBorders"),get tooltip(){return Pt("table.removeBorders")}}),null),r),(n=mx(),wt(n,Z(fc,{icon:"maximize","data-testid":"editor-toolbar-table-width-100",onClick:()=>e.commands.execute("tableWidth100"),get tooltip(){return Pt("table.width100Tooltip")}})),n),(t=mx(),wt(t,Z(fc,{icon:"align-left","data-testid":"editor-toolbar-table-align-left",onClick:()=>e.commands.execute("tableAlignLeft"),get tooltip(){return Pt("table.alignLeft")}}),null),wt(t,Z(fc,{icon:"align-center","data-testid":"editor-toolbar-table-align-center",onClick:()=>e.commands.execute("tableAlignCenter"),get tooltip(){return Pt("table.alignCenter")}}),null),wt(t,Z(fc,{icon:"align-right","data-testid":"editor-toolbar-table-align-right",onClick:()=>e.commands.execute("tableAlignRight"),get tooltip(){return Pt("table.alignRight")}}),null),wt(t,Z(fc,{icon:"move-horizontal","data-testid":"editor-toolbar-table-cell-width",onClick:()=>{const t=prompt(Pt("table.cellWidthPrompt"));t&&e.commands.execute("tableSetCellWidth",t)},get tooltip(){return Pt("table.cellWidth")}}),null),t),Z(et,{get when(){return e.commands.state("tableContext").value},children:t=>{return wt(e=vx(),t),e;var e}})];var t,n,r,o,i,l}})}var yx=pt('<div class="oasis-editor-toolbar-panel-section oasis-editor-toolbar-panel-actions">');const Mx=96/2.54;function xx(t){return Math.round(t*Mx)}function wx(t){return Math.round(t/Mx*100)/100}const Sx=[{id:"normal",labelKey:"section.marginPreset.normal",top:2.5,bottom:2.5,left:3,right:3},{id:"narrow",labelKey:"section.marginPreset.narrow",top:1.27,bottom:1.27,left:1.27,right:1.27},{id:"moderate",labelKey:"section.marginPreset.moderate",top:2.54,bottom:2.54,left:1.91,right:1.91},{id:"wide",labelKey:"section.marginPreset.wide",top:2.54,bottom:2.54,left:5.08,right:5.08},{id:"mirrored",labelKey:"section.marginPreset.mirrored",top:2.54,bottom:2.54,left:3.18,right:2.54}];function Ax(t){return{top:xx(t.top),bottom:xx(t.bottom),left:xx(t.left),right:xx(t.right)}}var Ix=pt("<div class=oasis-editor-margins-list>"),Tx=pt("<div class=oasis-editor-margins-custom-form>"),Cx=pt("<div class=oasis-editor-toolbar-list-options><button type=button class=oasis-editor-margins-custom-toggle data-testid=editor-toolbar-margins-custom><i data-lucide=sliders-horizontal></i><span>"),kx=pt("<div class=oasis-editor-margins-custom-actions><button type=button class=oasis-editor-margins-custom-apply data-testid=editor-toolbar-margins-custom-apply>"),Vx=pt("<button type=button class=oasis-editor-margins-item><span class=oasis-editor-margins-item-name></span><span class=oasis-editor-margins-item-values><br>"),Ex=pt("<label class=oasis-editor-margins-custom-field><span></span><input type=number min=0 step=0.1>");const Rx=[{key:"top",labelKey:"section.marginField.top"},{key:"bottom",labelKey:"section.marginField.bottom"},{key:"left",labelKey:"section.marginField.left"},{key:"right",labelKey:"section.marginField.right"}];function Lx(t){return Pt("section.marginValue",[String(t).replace(".",Pt("number.decimalSeparator"))])}function zx(t){const e=t.api,[a,n]=y(!1),[r,o]=y({}),i=w(()=>e.commands.state("setPageMargins").value),l=w(()=>{var t;const e=i();if(e)return null==(t=Sx.find(t=>function(t,e){const a=Ax(e);return Math.abs(t.top-a.top)<=1&&Math.abs(t.bottom-a.bottom)<=1&&Math.abs(t.left-a.left)<=1&&Math.abs(t.right-a.right)<=1}(e,t)))?void 0:t.id}),s=()=>{const t=i();o({top:t?String(wx(t.top)):"",bottom:t?String(wx(t.bottom)):"",left:t?String(wx(t.left)):"",right:t?String(wx(t.right)):""}),n(t=>!t)},d=()=>{const t=r(),a={};for(const{key:e}of Rx){const n=t[e];if(null==n||""===n)continue;const r=Number(n.replace(",","."));Number.isFinite(r)&&r>=0&&(a[e]=xx(r))}Object.keys(a).length>0&&e.commands.execute("setPageMargins",a),e.focusEditor()};return Z(Ac,{icon:"square-dashed",get label(){return Pt("section.margins")},testId:"editor-toolbar-margins-dropdown",get tooltip(){return Pt("section.margins")},panelClass:"oasis-editor-toolbar-panel oasis-editor-margins-panel",keepMounted:!0,get children(){return[(c=Ix(),wt(c,Z($,{each:Sx,children:t=>{return a=Vx(),n=a.firstChild,r=n.nextSibling,o=r.firstChild,a.$$click=()=>(t=>{e.commands.execute("setPageMargins",Ax(t)),e.focusEditor()})(t),wt(n,()=>Pt(t.labelKey)),wt(r,()=>`${Pt("section.marginField.top")} ${Lx(t.top)} ${Pt("section.marginField.bottom")} ${Lx(t.bottom)}`,o),wt(r,()=>`${Pt("section.marginField.left")} ${Lx(t.left)} ${Pt("section.marginField.right")} ${Lx(t.right)}`,null),M(e=>{var n=!(l()!==t.id),r=`editor-toolbar-margins-${t.id}`;return n!==e.e&&a.classList.toggle("oasis-editor-margins-item-active",e.e=n),r!==e.t&&ft(a,"data-testid",e.t=r),e},{e:void 0,t:void 0}),a;var a,n,r,o}})),c),(t=Cx(),n=t.firstChild,i=n.firstChild.nextSibling,n.$$click=s,wt(i,()=>Pt("section.marginPreset.custom")),wt(t,Z(et,{get when(){return a()},get children(){var t=Tx();return wt(t,Z($,{each:Rx,children:t=>{return e=Ex(),a=e.firstChild,n=a.nextSibling,wt(a,()=>Pt(t.labelKey)),n.$$input=e=>o(a=>({...a,[t.key]:e.currentTarget.value})),M(()=>n.value=r()[t.key]??""),e;var e,a,n}})),t}}),null),t),Z(et,{get when(){return a()},get children(){var t=kx(),e=t.firstChild;return e.$$click=d,wt(e,()=>Pt("section.marginApply")),t}})];var t,n,i,c}})}ut(["click","input"]);const Nx=/Mac/i.test(navigator.userAgent)?"⌘":"Ctrl",qx=t=>t.commands.state("documentStyles").value??[],Ox=t=>{const e=new Set(["Arial","Calibri, sans-serif","Calibri Light, sans-serif","Georgia","Inter","Open Sans, sans-serif","Times New Roman","Courier New"]);for(const n of qx(t))n.fontFamily&&e.add(n.fontFamily);const a=String(t.commands.state("setFontFamily").value??"").trim();return a&&e.add(a),Array.from(e).sort((t,e)=>t.localeCompare(e)).map(t=>({value:t,label:t}))},Px=t=>{const e=new Set(VM);for(const n of qx(t))"number"==typeof n.fontSize&&Number.isFinite(n.fontSize)&&e.add(EM(n.fontSize));const a=Number(t.commands.state("setFontSize").value);return Number.isFinite(a)&&a>0&&e.add(a),Array.from(e).sort((t,e)=>t-e).map(t=>({value:String(t),label:String(t)}))},Wx=t=>qx(t).map(t=>({value:t.id,label:t.name})),Hx=[{command:"alignLeft",icon:"align-left",testId:"editor-toolbar-align-left",tooltipKey:"toolbar.alignLeft"},{command:"alignCenter",icon:"align-center",testId:"editor-toolbar-align-center",tooltipKey:"toolbar.alignCenter"},{command:"alignRight",icon:"align-right",testId:"editor-toolbar-align-right",tooltipKey:"toolbar.alignRight"},{command:"alignJustify",icon:"align-justify",testId:"editor-toolbar-align-justify",tooltipKey:"toolbar.justify"}],Ux=[{command:"bulletList",icon:"list",testId:"editor-toolbar-list-bullet",tooltipKey:"toolbar.bulletList"},{command:"orderedList",icon:"list-ordered",testId:"editor-toolbar-list-ordered",tooltipKey:"toolbar.numberedList"}],Fx={"editor-toolbar-file-dropdown":{tab:"file",group:"document",row:1},"sep-file":{tab:"file",group:"document",row:1},"editor-toolbar-undo":{tab:"home",group:"clipboard",row:1},"editor-toolbar-redo":{tab:"home",group:"clipboard",row:2},"sep-history":{tab:"home",group:"clipboard",row:2},"editor-toolbar-style":{tab:"home",group:"styles",row:1},"editor-toolbar-font-family":{tab:"home",group:"font",row:1},"editor-toolbar-font-size":{tab:"home",group:"font",row:1},"editor-toolbar-font-increase":{tab:"home",group:"font",row:1},"editor-toolbar-font-decrease":{tab:"home",group:"font",row:1},"editor-toolbar-change-case":{tab:"home",group:"font",row:1},"editor-toolbar-clear-formatting":{tab:"home",group:"font",row:1},"editor-toolbar-color":{tab:"home",group:"font",row:2},"editor-toolbar-highlight":{tab:"home",group:"font",row:2},"editor-toolbar-text-shading":{tab:"home",group:"font",row:2},"sep-style":{tab:"home",group:"font",row:2},"editor-toolbar-bold":{tab:"home",group:"font",row:2},"editor-toolbar-italic":{tab:"home",group:"font",row:2},"editor-toolbar-underline-control":{tab:"home",group:"font",row:2},"editor-toolbar-strike":{tab:"home",group:"font",row:2},"editor-toolbar-superscript":{tab:"home",group:"font",row:2},"editor-toolbar-subscript":{tab:"home",group:"font",row:2},"sep-format":{tab:"home",group:"font",row:2},"editor-toolbar-insert-image":{tab:"insert",group:"illustrations",row:1},"editor-toolbar-insert-shape":{tab:"insert",group:"illustrations",row:2},"editor-toolbar-insert-table":{tab:"insert",group:"tables",row:1},"editor-toolbar-link":{tab:"insert",group:"links",row:1},"editor-toolbar-unlink":{tab:"insert",group:"links",row:2},"editor-toolbar-footnote":{tab:"references",group:"footnotes",row:1},"editor-toolbar-image-alt":{tab:"insert",group:"accessibility",row:2},"editor-toolbar-image-caption":{tab:"insert",group:"accessibility",row:1},"sep-insert":{tab:"insert",group:"accessibility",row:2},"editor-toolbar-align-left":{tab:"home",group:"paragraph",row:2},"editor-toolbar-align-center":{tab:"home",group:"paragraph",row:2},"editor-toolbar-align-right":{tab:"home",group:"paragraph",row:2},"editor-toolbar-align-justify":{tab:"home",group:"paragraph",row:2},"editor-toolbar-list-bullet":{tab:"home",group:"paragraph",row:1},"editor-toolbar-list-ordered":{tab:"home",group:"paragraph",row:1},"editor-toolbar-list-outdent":{tab:"home",group:"paragraph",row:1},"editor-toolbar-list-indent":{tab:"home",group:"paragraph",row:1},"editor-toolbar-list-options":{tab:"home",group:"paragraph",row:1},"editor-toolbar-special-indent":{tab:"home",group:"paragraph",row:1},"editor-toolbar-line-spacing-control":{tab:"home",group:"paragraph",row:2},"sep-paragraph":{tab:"home",group:"paragraph",row:2},"editor-toolbar-metrics":{tab:"layout",group:"paragraph",row:1},"sep-metrics":{tab:"layout",group:"paragraph",row:2},"editor-toolbar-table":{tab:"layout",group:"table",row:1},"sep-table":{tab:"layout",group:"table",row:2},"editor-toolbar-margins":{tab:"layout",group:"section",row:1},"editor-toolbar-section":{tab:"layout",group:"section",row:1}};function Bx(){const t=[];t.push({type:"menu",id:"editor-toolbar-file-dropdown",group:"file",iconName:"file",tooltipKey:"toolbar.file",content:{kind:"items",items:[{type:"button",id:"editor-toolbar-export-docx",testId:"editor-toolbar-export-docx",iconName:"file-text",labelKey:"toolbar.exportDocx",wide:!0,tooltipKey:"toolbar.exportDocx",command:"exportDocx"},{type:"button",id:"editor-toolbar-export-pdf",testId:"editor-toolbar-export-pdf",iconName:"file-down",labelKey:"toolbar.exportPdf",wide:!0,tooltipKey:"toolbar.exportPdf",command:"exportPdf"},{type:"button",id:"editor-toolbar-import-document",testId:"editor-toolbar-import-document",iconName:"upload",labelKey:"toolbar.import",wide:!0,tooltipKey:"toolbar.import",command:"importDocument"}]}}),t.push({type:"separator",id:"sep-file",group:"file"}),t.push({type:"button",id:"editor-toolbar-undo",testId:"editor-toolbar-undo",iconName:"undo",command:"undo",tooltip:`${Pt("toolbar.undo")} (${Nx}+Z)`}),t.push({type:"button",id:"editor-toolbar-redo",testId:"editor-toolbar-redo",iconName:"redo",command:"redo",tooltip:`${Pt("toolbar.redo")} (${Nx}+Shift+Z)`}),t.push({type:"separator",id:"sep-history"}),t.push({type:"select",id:"editor-toolbar-style",testId:"editor-toolbar-style",width:"wide",tooltipKey:"toolbar.style",command:"setStyleId",options:Wx}),t.push({type:"select",id:"editor-toolbar-font-family",testId:"editor-toolbar-font-family",tooltipKey:"toolbar.fontFamily",placeholder:Pt("toolbar.font"),command:"setFontFamily",options:Ox}),t.push({type:"select",id:"editor-toolbar-font-size",testId:"editor-toolbar-font-size",width:"small",tooltipKey:"toolbar.fontSize",command:"setFontSize",options:Px}),t.push({type:"button",id:"editor-toolbar-font-increase",testId:"editor-toolbar-font-increase",iconName:"a-arrow-up",command:"increaseFontSize",tooltipKey:"toolbar.increaseFontSize"}),t.push({type:"button",id:"editor-toolbar-font-decrease",testId:"editor-toolbar-font-decrease",iconName:"a-arrow-down",command:"decreaseFontSize",tooltipKey:"toolbar.decreaseFontSize"}),t.push({type:"menu",id:"editor-toolbar-change-case",testId:"editor-toolbar-change-case",iconName:"case-sensitive",tooltipKey:"toolbar.changeCase",isDisabled:t=>!t.commands.state({name:"changeTextCase"}).isEnabled,content:{kind:"items",items:[{type:"button",id:"editor-toolbar-case-sentence",testId:"editor-toolbar-case-sentence",labelKey:"toolbar.caseSentence",wide:!0,tooltipKey:"toolbar.caseSentence",command:{name:"changeTextCase",payload:"sentence"}},{type:"button",id:"editor-toolbar-case-lower",testId:"editor-toolbar-case-lower",labelKey:"toolbar.caseLower",wide:!0,tooltipKey:"toolbar.caseLower",command:{name:"changeTextCase",payload:"lower"}},{type:"button",id:"editor-toolbar-case-upper",testId:"editor-toolbar-case-upper",labelKey:"toolbar.caseUpper",wide:!0,tooltipKey:"toolbar.caseUpper",command:{name:"changeTextCase",payload:"upper"}},{type:"button",id:"editor-toolbar-case-capitalize",testId:"editor-toolbar-case-capitalize",labelKey:"toolbar.caseCapitalize",wide:!0,tooltipKey:"toolbar.caseCapitalize",command:{name:"changeTextCase",payload:"capitalize"}},{type:"button",id:"editor-toolbar-case-toggle",testId:"editor-toolbar-case-toggle",labelKey:"toolbar.caseToggle",wide:!0,tooltipKey:"toolbar.caseToggle",command:{name:"changeTextCase",payload:"toggle"}}]}}),t.push({type:"button",id:"editor-toolbar-clear-formatting",testId:"editor-toolbar-clear-formatting",iconName:"remove-formatting",command:"clearFormatting",tooltipKey:"toolbar.clearFormatting"}),t.push({type:"toggle",id:"editor-toolbar-bold",testId:"editor-toolbar-bold",iconName:"bold",command:"bold",tooltipKey:"toolbar.bold"}),t.push({type:"toggle",id:"editor-toolbar-italic",testId:"editor-toolbar-italic",iconName:"italic",command:"italic",tooltipKey:"toolbar.italic"}),t.push({type:"custom",id:"editor-toolbar-underline-control",render:t=>ZM({api:t})}),t.push({type:"toggle",id:"editor-toolbar-strike",testId:"editor-toolbar-strike",iconName:"strikethrough",command:"strike",tooltipKey:"toolbar.strike"}),t.push({type:"toggle",id:"editor-toolbar-subscript",testId:"editor-toolbar-subscript",iconName:"subscript",command:"subscript",tooltipKey:"toolbar.subscript"}),t.push({type:"toggle",id:"editor-toolbar-superscript",testId:"editor-toolbar-superscript",iconName:"superscript",command:"superscript",tooltipKey:"toolbar.superscript"}),t.push({type:"separator",id:"sep-format"}),t.push({type:"colorPicker",id:"editor-toolbar-color",testId:"editor-toolbar-color",kind:"color",iconName:"type",defaultValue:"#111827",tooltipKey:"toolbar.color",command:"setColor"}),t.push({type:"colorPicker",id:"editor-toolbar-highlight",testId:"editor-toolbar-highlight",kind:"highlight",iconName:"highlighter",defaultValue:"#fef08a",tooltipKey:"toolbar.highlight",command:"setHighlight"}),t.push({type:"colorPicker",id:"editor-toolbar-text-shading",testId:"editor-toolbar-text-shading",kind:"shading",iconName:"paint-bucket",defaultValue:"#fef3c7",tooltipKey:"toolbar.textShading",command:"setTextShading"}),t.push({type:"separator",id:"sep-style"}),t.push({type:"button",id:"editor-toolbar-insert-image",testId:"editor-toolbar-insert-image",iconName:"image",tooltipKey:"toolbar.image",command:"insertImage"}),t.push({type:"menu",id:"editor-toolbar-insert-shape",testId:"editor-toolbar-insert-shape",iconName:"shapes",tooltipKey:"toolbar.shapes",content:{kind:"items",items:[{type:"button",id:"editor-toolbar-shape-rect",testId:"editor-toolbar-shape-rect",labelKey:"toolbar.shape.rect",wide:!0,tooltipKey:"toolbar.shape.rect",command:{name:"insertShape",payload:"rect"}},{type:"button",id:"editor-toolbar-shape-roundRect",testId:"editor-toolbar-shape-roundRect",labelKey:"toolbar.shape.roundRect",wide:!0,tooltipKey:"toolbar.shape.roundRect",command:{name:"insertShape",payload:"roundRect"}},{type:"button",id:"editor-toolbar-shape-ellipse",testId:"editor-toolbar-shape-ellipse",labelKey:"toolbar.shape.ellipse",wide:!0,tooltipKey:"toolbar.shape.ellipse",command:{name:"insertShape",payload:"ellipse"}},{type:"button",id:"editor-toolbar-shape-triangle",testId:"editor-toolbar-shape-triangle",labelKey:"toolbar.shape.triangle",wide:!0,tooltipKey:"toolbar.shape.triangle",command:{name:"insertShape",payload:"triangle"}},{type:"button",id:"editor-toolbar-shape-rtTriangle",testId:"editor-toolbar-shape-rtTriangle",labelKey:"toolbar.shape.rtTriangle",wide:!0,tooltipKey:"toolbar.shape.rtTriangle",command:{name:"insertShape",payload:"rtTriangle"}},{type:"button",id:"editor-toolbar-shape-diamond",testId:"editor-toolbar-shape-diamond",labelKey:"toolbar.shape.diamond",wide:!0,tooltipKey:"toolbar.shape.diamond",command:{name:"insertShape",payload:"diamond"}}]}}),t.push({type:"gridPicker",id:"editor-toolbar-insert-table",testId:"editor-toolbar-insert-table",tooltipKey:"toolbar.table",command:"insertTable"}),t.push({type:"button",id:"editor-toolbar-link",testId:"editor-toolbar-link",iconName:"link",command:"link",tooltip:`${Pt("toolbar.link")} (${Nx}+K)`}),t.push({type:"button",id:"editor-toolbar-unlink",testId:"editor-toolbar-unlink",iconName:"unlink",command:"unlink",tooltipKey:"toolbar.unlink"}),t.push({type:"button",id:"editor-toolbar-footnote",testId:"editor-toolbar-footnote",iconName:"footnote",command:"insertFootnote",tooltip:`${Pt("toolbar.footnote")} (${Nx}+Alt+F)`}),t.push({type:"button",id:"editor-toolbar-image-alt",testId:"editor-toolbar-image-alt",iconName:"file-text",tooltipKey:"toolbar.alt",command:"editImageAlt",isVisible:t=>t.commands.state("editImageAlt").isEnabled}),t.push({type:"button",id:"editor-toolbar-image-caption",testId:"editor-toolbar-image-caption",iconName:"subtitles",tooltipKey:"toolbar.imageCaption",command:"insertImageCaption",isVisible:t=>t.commands.state("insertImageCaption").isEnabled}),t.push({type:"separator",id:"sep-insert"});for(const e of Hx)t.push({type:"toggle",id:e.testId,testId:e.testId,iconName:e.icon,command:e.command,tooltipKey:e.tooltipKey});for(const e of Ux)t.push({type:"toggle",id:e.testId,testId:e.testId,iconName:e.icon,command:e.command,tooltipKey:e.tooltipKey});return t.push({type:"button",id:"editor-toolbar-list-outdent",testId:"editor-toolbar-list-outdent",iconName:"indent-decrease",tooltipKey:"toolbar.decreaseIndent",command:"outdent"}),t.push({type:"button",id:"editor-toolbar-list-indent",testId:"editor-toolbar-list-indent",iconName:"indent-increase",tooltipKey:"toolbar.increaseIndent",command:"indent"}),t.push({type:"custom",id:"editor-toolbar-list-options",render:t=>function(t){const e=t.api;return Z(Ac,{icon:"list-filter",get tooltip(){return Pt("toolbar.listFormat")},testId:"editor-toolbar-list-options-dropdown",hideChevron:!0,get children(){var t=QM(),a=t.firstChild,n=a.firstChild,r=a.nextSibling.firstChild,o=r.nextSibling;return wt(n,()=>Pt("toolbar.listFormat")),wt(a,Z(Tc,{"data-testid":"editor-toolbar-list-format",onChange:t=>e.commands.execute("setListFormat",t.currentTarget.value),get tooltip(){return Pt("toolbar.listFormat")},get children(){return[(o=KM(),wt(o,()=>Pt("toolbar.formatDecimal")),o),(r=DM(),wt(r,()=>Pt("toolbar.formatLowerLetter")),r),(n=jM(),wt(n,()=>Pt("toolbar.formatUpperLetter")),n),(a=XM(),wt(a,()=>Pt("toolbar.formatLowerRoman")),a),(e=JM(),wt(e,()=>Pt("toolbar.formatUpperRoman")),e),(t=YM(),wt(t,()=>Pt("toolbar.formatBullet")),t)];var t,e,a,n,r,o}}),null),wt(r,()=>Pt("toolbar.listStartAt")),o.addEventListener("change",t=>e.commands.execute("setListStartAt",t.currentTarget.value)),M(()=>ft(o,"title",Pt("toolbar.listStartAt"))),t}})}({api:t})}),t.push({type:"split",id:"editor-toolbar-special-indent",testId:"editor-toolbar-special-indent",iconName:"specialIndentFirstLine",tooltipKey:"toolbar.specialIndent",command:{name:"setSpecialIndent",payload:{kind:"firstLine"}},isActive:()=>!1,panelClass:"oasis-editor-toolbar-dropdown-menu oasis-editor-special-indent-menu",menu:{kind:"items",items:[{type:"button",id:"editor-toolbar-special-indent-none",testId:"editor-toolbar-special-indent-none",iconName:"minus",labelKey:"toolbar.specialIndentNone",tooltipKey:"toolbar.specialIndentNone",command:{name:"setSpecialIndent",payload:{kind:"none"}},wide:!0},{type:"button",id:"editor-toolbar-special-indent-first-line",testId:"editor-toolbar-special-indent-first-line",iconName:"list-collapse",labelKey:"toolbar.specialIndentFirstLine",tooltipKey:"toolbar.specialIndentFirstLine",command:{name:"setSpecialIndent",payload:{kind:"firstLine"}},wide:!0},{type:"button",id:"editor-toolbar-special-indent-hanging",testId:"editor-toolbar-special-indent-hanging",iconName:"list-indent-increase",labelKey:"toolbar.specialIndentHanging",tooltipKey:"toolbar.specialIndentHanging",command:{name:"setSpecialIndent",payload:{kind:"hanging"}},wide:!0}]}}),t.push({type:"custom",id:"editor-toolbar-line-spacing-control",render:t=>px({api:t})}),t.push({type:"separator",id:"sep-paragraph"}),t.push({type:"custom",id:"editor-toolbar-metrics",render:t=>function(t){const e=t.api,a=t=>a=>e.commands.execute(t,a.currentTarget.value);return Z(Ac,{icon:"sliders-horizontal",testId:"editor-toolbar-metrics-dropdown",get tooltip(){return Pt("metric.leftIndent")},hideChevron:!0,panelClass:"oasis-editor-toolbar-panel",keepMounted:!0,get children(){return[(b=ux(),wt(b,Z(fc,{icon:"file-up",get active(){return e.commands.state("togglePageBreakBefore").isActive},"data-testid":"editor-toolbar-page-break-before",onClick:()=>e.commands.execute("togglePageBreakBefore"),get tooltip(){return Pt("metric.pageBreakBefore")}}),null),wt(b,Z(fc,{icon:"link-2",get active(){return e.commands.state("toggleKeepWithNext").isActive},"data-testid":"editor-toolbar-keep-with-next",onClick:()=>e.commands.execute("toggleKeepWithNext"),get tooltip(){return Pt("metric.keepWithNext")}}),null),b),(t=fx(),n=t.firstChild,r=n.firstChild,o=r.nextSibling,i=n.nextSibling,l=i.firstChild,s=l.nextSibling,d=i.nextSibling,c=d.firstChild,h=c.nextSibling,p=d.nextSibling,u=p.firstChild,f=u.nextSibling,g=p.nextSibling,m=g.firstChild,v=m.nextSibling,wt(r,()=>Pt("metric.after")),mt(o,"change",a("setSpacingAfter")),wt(l,()=>Pt("metric.indent")),mt(s,"change",a("setIndentLeft")),wt(c,()=>Pt("metric.first")),mt(h,"change",a("setIndentFirstLine")),wt(u,()=>Pt("metric.hang")),mt(f,"change",a("setIndentHanging")),wt(m,()=>Pt("metric.paraBg")),v.$$input=t=>e.commands.execute("setParagraphShading",t.currentTarget.value),wt(t,Z(fc,{icon:"frame","data-testid":"editor-toolbar-paragraph-borders",onClick:()=>e.commands.execute("applyParagraphBorders"),get tooltip(){return Pt("metric.applyBorders")}}),null),M(t=>{var e=Pt("metric.spacingAfter"),a=Pt("metric.leftIndent"),r=Pt("metric.firstLineIndent"),o=Pt("metric.hangingIndent"),l=Pt("metric.paragraphBgColor");return e!==t.e&&ft(n,"title",t.e=e),a!==t.t&&ft(i,"title",t.t=a),r!==t.a&&ft(d,"title",t.a=r),o!==t.o&&ft(p,"title",t.o=o),l!==t.i&&ft(g,"title",t.i=l),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),M(()=>o.value=gx(e,"setSpacingAfter")),M(()=>s.value=gx(e,"setIndentLeft")),M(()=>h.value=gx(e,"setIndentFirstLine")),M(()=>f.value=gx(e,"setIndentHanging")),M(()=>v.value=gx(e,"setParagraphShading")||"#ffffff"),t)];var t,n,r,o,i,l,s,d,c,h,p,u,f,g,m,v,b}})}({api:t})}),t.push({type:"separator",id:"sep-metrics"}),t.push({type:"custom",id:"editor-toolbar-table",isVisible:t=>t.commands.state("tableContext").isActive,render:t=>bx({api:t})}),t.push({type:"separator",id:"sep-table",isVisible:t=>t.commands.state("tableContext").isActive}),t.push({type:"custom",id:"editor-toolbar-margins",ribbonSize:"large",render:t=>zx({api:t})}),t.push({type:"custom",id:"editor-toolbar-section",ribbonSize:"large",render:t=>function(t){const e=t.api;return Z(Ac,{icon:"layout-template",get label(){return Pt("section.orientation")},testId:"editor-toolbar-section-dropdown",get tooltip(){return Pt("section.pageSetup")},panelClass:"oasis-editor-toolbar-panel",keepMounted:!0,get children(){return[(a=yx(),wt(a,Z(fc,{icon:"rectangle-vertical",get active(){return!e.commands.state("toggleOrientation").isActive},"data-testid":"editor-toolbar-orientation-portrait",onClick:()=>e.commands.execute({name:"setOrientation",payload:"portrait"}),get tooltip(){return Pt("section.portrait")}}),null),wt(a,Z(fc,{icon:"rectangle-horizontal",get active(){return e.commands.state("toggleOrientation").isActive},"data-testid":"editor-toolbar-orientation-landscape",onClick:()=>e.commands.execute({name:"setOrientation",payload:"landscape"}),get tooltip(){return Pt("section.landscape")}}),null),a),(t=yx(),wt(t,Z(fc,{icon:"scissors","data-testid":"editor-toolbar-section-break-next",onClick:()=>e.commands.execute("sectionBreakNextPage"),get tooltip(){return Pt("section.secNextTooltip")}}),null),wt(t,Z(fc,{icon:"scissors","data-testid":"editor-toolbar-section-break-continuous",onClick:()=>e.commands.execute("sectionBreakContinuous"),get tooltip(){return Pt("section.secContTooltip")}}),null),t)];var t,a}})}({api:t})}),function(t){return t.map((t,e)=>{const a=Fx[t.id]??{tab:"plugins",group:t.group??"general",row:1};return{...t,tab:t.tab??a.tab,group:a.group,row:t.row??a.row,order:t.order??e}})}(t)}function Gx(t,e){const a=ra(t);if(a.isCollapsed||a.startIndex!==a.endIndex||a.endParagraphOffset-a.startParagraphOffset!==1)return null;const n=_e(t)[a.startIndex];if(!n)return null;let r=0;for(let o=0;o<n.runs.length;o+=1){const t=n.runs[o],i=r;if(r+=t.text.length,e(t)&&1===t.text.length&&i===a.startParagraphOffset)return{paragraph:n,paragraphIndex:a.startIndex,run:t,runIndex:o,offset:i}}return null}function Zx(t,e){if("inline"===e)return;const a={...t??{type:"floating",allowOverlap:!0,positionH:{relativeFrom:"column",offset:0},positionV:{relativeFrom:"paragraph",offset:0}},type:"floating"};switch(e){case"square":case"tight":case"through":case"topAndBottom":return{...a,wrap:e,behindDoc:!1};case"behind":return{...a,wrap:"none",behindDoc:!0};case"front":return{...a,wrap:"none",behindDoc:!1}}}function Kx(t){return t?t.behindDoc?"behind":t.wrap&&"none"!==t.wrap?t.wrap:"front":"inline"}function Dx(t,e){return{...t,positionV:{...t.positionV??{},relativeFrom:e?"page":"paragraph"}}}function jx(t){var e;return"page"===(null==(e=null==t?void 0:t.positionV)?void 0:e.relativeFrom)}function Xx(t){return t?{...t}:void 0}function Jx(t,e){return JSON.stringify(t??null)===JSON.stringify(e??null)}function Yx(t,e,a){const n={...t??{}};return a?n[e]=!0:delete n[e],Object.keys(n).length>0?n:void 0}function Qx(t,e,a){const n={...t??{}};return null==a||""===a?delete n[e]:n[e]=a,Object.keys(n).length>0?n:void 0}function _x(t,e,a){const n={...t??{}};return null==a?delete n[e]:n[e]=a,Object.keys(n).length>0?n:void 0}function $x(t){return{...t,floating:t.floating?{...t.floating,positionH:t.floating.positionH?{...t.floating.positionH}:void 0,positionV:t.floating.positionV?{...t.floating.positionV}:void 0}:void 0,shape:t.shape?{...t.shape}:void 0,body:t.body?{...t.body}:void 0,blocks:rw(t.blocks)}}function tw(t){return{...t,styles:Xx(t.styles),image:t.image?{...t.image}:void 0,textBox:t.textBox?$x(t.textBox):void 0,field:t.field?{...t.field}:void 0,fieldChar:t.fieldChar?{...t.fieldChar}:void 0,revision:t.revision?{...t.revision}:void 0,footnoteReference:t.footnoteReference?{...t.footnoteReference}:void 0,endnoteReference:t.endnoteReference?{...t.endnoteReference}:void 0}}function ew(t){return{...t,runs:t.runs.map(tw),style:t.style?{...t.style}:void 0,list:t.list?{...t.list}:void 0}}function aw(t){return t?{...t}:void 0}function nw(t){return t.map(ew)}function rw(t){return t.map(t=>"paragraph"===t.type?ew(t):{...t,style:t.style?{...t.style,defaultCellMargins:t.style.defaultCellMargins?{...t.style.defaultCellMargins}:void 0,floating:t.style.floating?{...t.style.floating}:void 0,revisionXml:t.style.revisionXml?[...t.style.revisionXml]:void 0}:void 0,tblGridChangeXml:t.tblGridChangeXml,rows:t.rows.map(t=>({...t,style:t.style?{...t.style,revisionXml:t.style.revisionXml?[...t.style.revisionXml]:void 0}:void 0,cells:t.cells.map(t=>({...t,style:t.style?{...t.style,revisionXml:t.style.revisionXml?[...t.style.revisionXml]:void 0}:void 0,blocks:nw(t.blocks)}))}))})}function ow(t){const e=ma("");return e.fieldChar={kind:t},e}function iw(t){const e=ma("");return e.fieldInstruction=t,e}function lw(t,e,a){const n=ya([{text:`${e} `},{text:String(a)},{text:t?`: ${t}`:""}]);return n.style={styleId:"Caption",align:"center"},n.runs=[n.runs[0],ow("begin"),iw(" SEQ Figure \\* ARABIC "),ow("separate"),n.runs[1],ow("end"),n.runs[2]],n}function sw(t){var e,a;if(!t)return!1;return"caption"===(null==(a=null==(e=t.style)?void 0:e.styleId)?void 0:a.toLowerCase())&&t.runs.some(t=>void 0!==t.fieldInstruction&&new RegExp("\\bSEQ\\s+Figure\\b","i").test(t.fieldInstruction))}function dw(t,e){if(!sw(t))return ew(t);let a=!1,n=!1;const r=t.runs.map(t=>{var r,o;return"separate"===(null==(r=t.fieldChar)?void 0:r.kind)?(a=!0,{...t,fieldChar:{...t.fieldChar}}):"end"===(null==(o=t.fieldChar)?void 0:o.kind)?(a=!1,{...t,fieldChar:{...t.fieldChar}}):a&&""!==t.text?t.text===String(e)?{...t}:(n=!0,{...t,text:String(e)}):{...t}});return n?{...ew(t),runs:r}:ew(t)}function cw(t,e){return t.map(t=>"paragraph"===t.type?sw(t)?dw(t,e.next++):ew(t):{...t,rows:t.rows.map(t=>({...t,cells:t.cells.map(t=>({...t,blocks:cw(t.blocks,e)}))}))})}function hw(t){const e={next:1},a=We(t).map(t=>({...t,blocks:cw(t.blocks,e),header:t.header?rw(t.header):void 0,footer:t.footer?rw(t.footer):void 0}));return{...t,sections:a}}function pw(t){return Boolean(t.image||t.textBox)}function uw(t,e){const a=[];for(const n of t){if(0===n.text.length)continue;const t=a[a.length-1];!t||pw(n)||pw(t)||!Jx(t.styles,n.styles)?a.push({...n,styles:Xx(n.styles)}):t.text+=n.text}return a.length>0?a:[va("",e)]}function fw(t,e,a){return{...t,runs:uw(e,a),style:t.style?{...t.style}:void 0}}function gw(t){return ya(t)}function mw(t,e){const a=gw(e);return a.style=t.style?{...t.style}:void 0,a.list=aw(t.list),a}function vw(t,e){const a=ew(t);return a.list?(a.list={...a.list,level:Math.max(0,e)},a):a}function bw(t){const e=ew(t);return delete e.list,e}function yw(t,e){var a;if(0===t.runs.length)return;let n=0;for(let r=0;r<t.runs.length;r+=1){const a=t.runs[r],o=n+a.text.length;if(e<o)return Xx(a.styles);if(e===o){if(a.text.length>0)return Xx(a.styles);const e=t.runs[r+1];return Xx((null==e?void 0:e.styles)??a.styles)}n=o}return Xx(null==(a=t.runs[t.runs.length-1])?void 0:a.styles)}function Mw(t,e){var a,n,r;const o=function(t,e){let a=0;for(let n=0;n<t.runs.length;n+=1){const r=t.runs[n],o=a,i=a+r.text.length;if(e<i)return{run:r,startOffset:o,endOffset:i};if(e===i){if(r.text.length>0)return{run:r,startOffset:o,endOffset:i};const e=t.runs[n+1];return e?{run:e,startOffset:i,endOffset:i+e.text.length}:{run:r,startOffset:o,endOffset:i}}a=i}return null}(t,e),i=null==(a=null==o?void 0:o.run.styles)?void 0:a.link;if(!o||!i||o.run.image)return null;let l=o.startOffset,s=o.endOffset,d=0;const c=t.runs,h=c.findIndex(t=>t.id===o.run.id);if(-1===h)return null;for(let p=0;p<h;p+=1)d+=c[p].text.length;l=d,s=d+o.run.text.length;for(let p=h-1;p>=0;p-=1){const t=c[p];if(t.image||(null==(n=t.styles)?void 0:n.link)!==i)break;l-=t.text.length}for(let p=h+1;p<c.length;p+=1){const t=c[p];if(t.image||(null==(r=t.styles)?void 0:r.link)!==i)break;s+=t.text.length}return{href:i,startOffset:l,endOffset:s}}function xw(t,e,a){const n=Math.max(0,Math.min(e,Ae(t))),r=Math.max(n,Math.min(a,Ae(t))),o=[];let i=0;for(const l of t.runs){const t=i,e=i+l.text.length,a=Math.max(n,t),s=Math.min(r,e);if(a<s){const e=Boolean(l.image||l.textBox),n={id:`run:${Math.random().toString(36).slice(2,9)}`,text:e?"":l.text.slice(a-t,s-t)};l.styles&&(n.styles={...l.styles}),l.image&&(n.image={...l.image}),l.textBox&&(n.textBox=$x(l.textBox)),l.revision&&(n.revision={...l.revision}),l.field&&(n.field={...l.field}),l.footnoteReference&&(n.footnoteReference={...l.footnoteReference}),l.endnoteReference&&(n.endnoteReference={...l.endnoteReference}),o.push(n)}i=e}return o}function ww(t,e,a){const n=xw(t,0,e),r=xw(t,e,Ae(t)),o=yw(t,e);return fw(t,[...n,...a.map(t=>({...t,styles:Xx(t.styles??o)})),...r],o)}function Sw(t){const e=[],a=new Map,n=[];let r=0;for(const o of t){const t=Se(o);e.push({id:o.id,base:r,length:t.length}),a.has(o.id)||a.set(o.id,r),n.push(t),r+=t.length+1}return{text:n.join("\n"),spans:e,baseById:a}}function Aw(t,e,a){return t<e?e:t>a?a:t}function Iw(t,e,a){const n=Sw(e);let r=!1;for(const f of t.order){const e=t.items[f];if(e&&(e.start&&n.baseById.has(e.start.paragraphId)||e.end&&n.baseById.has(e.end.paragraphId))){r=!0;break}}if(!r)return t;const o=Sw(a);if(n.text===o.text)return t;const i=n.text.length,l=o.text.length,s=Math.min(i,l),d=function(t,e,a){let n=0;for(;n<a&&t.charCodeAt(t.length-1-n)===e.charCodeAt(e.length-1-n);)n+=1;return n}(n.text,o.text,s),c=function(t,e,a){let n=0;for(;n<a&&t.charCodeAt(n)===e.charCodeAt(n);)n+=1;return n}(n.text,o.text,s-d),h=t=>{const e=n.baseById.get(t.paragraphId);if(void 0===e)return t;const a=e+Aw(t.offset,0,i-e),r=Aw(function(t,e,a,n,r){return t<=n?t:t>=e-r?t+(a-e):n}(a,i,l,c,d),0,l),s=function(t,e){for(const n of e)if(t<=n.base+n.length)return{paragraphId:n.id,offset:Math.max(0,t-n.base)};const a=e[e.length-1];return{paragraphId:a.id,offset:a.length}}(r,o.spans);return s.paragraphId===t.paragraphId&&s.offset===t.offset?t:{...t,paragraphId:s.paragraphId,offset:s.offset}};let p=!1;const u={...t.items};for(const f of t.order){const e=t.items[f];if(!e)continue;let a=e;if(e.start&&n.baseById.has(e.start.paragraphId)){const t=h(e.start);t!==e.start&&(a={...a,start:t})}if(e.end&&n.baseById.has(e.end.paragraphId)){const t=h(e.end);t!==e.end&&(a={...a,end:t})}a!==e&&(u[f]=a,p=!0)}return p?{...t,items:u}:t}function Tw(t,e){if(!function(t){for(const e of t)if("table"===e.type)return!0;return!1}(t))return e;let a=0;const n=t=>{let r=!1;const o=t.map(t=>{if("paragraph"===t.type){const n=e[a++]??t;return n!==t&&(r=!0),n}let o=!1;const i=t.rows.map(t=>{let e=!1;const a=t.cells.map(t=>{const a=n(t.blocks);return a===t.blocks?t:(e=!0,{...t,blocks:a})});return e?(o=!0,{...t,cells:a}):t});return o?(r=!0,{...t,rows:i}):t});return r?o:t};return n(t)}function Cw(t,e,a){const n=Ye(t);if("footnote"===n){const n=t.activeFootnoteId,r=t.document.footnotes;if(!n||!r||!r.items[n])return{...t,selection:a};const o=r.items[n],i=Tw(o.blocks,e);return{...t,document:{...t.document,footnotes:{...r,items:{...r.items,[n]:{...o,blocks:i}}}},selection:a}}const r=We(t.document),o=Math.max(0,Math.min(Je(t),r.length-1)),i=r[o];if(!i)return{...t,selection:a};const l=function(t,e,a){return"header"===a?{...t,header:Tw(t.header??[],e)}:"footer"===a?{...t,footer:Tw(t.footer??[],e)}:{...t,blocks:Tw(t.blocks,e)}}(i,e,n),s=[...r];s[o]=l;const d=t.document.bookmarks,c=d&&d.order.length>0?Iw(d,_e(t),e):d;return{...t,document:{...t.document,sections:s,...c!==d?{bookmarks:c}:{}},selection:a}}function kw(t,e,a){let n=!1;const r=t.map(t=>{if("paragraph"===t.type)return t;let r=!1;const o=t.rows.map(t=>{let n=!1;const o=t.cells.map(t=>{if(!t.blocks.some(t=>e.has(t.id)))return t;const r=a(t);return r!==t&&(n=!0),r});return n?(r=!0,{...t,cells:o}):t});return r?(n=!0,{...t,rows:o}):t});return n?r:t}function Vw(t){return aa(t)}function Ew(t){const e=_e(t),a=ta(t,t.selection.focus),n=$e(e,a.paragraphId),r=e[n];return{paragraph:r,index:n,offset:Te(r,a)}}function Rw(t){const e=ra(t);if(e.isCollapsed)return t;const a=_e(t);if(t.trackChangesEnabled){const n=`rev:${Math.random().toString(36).slice(2,9)}`,r="User",o=Date.now();return Cw(t,a.map((t,a)=>{if(a<e.startIndex||a>e.endIndex)return ew(t);return Lw(t,a===e.startIndex?e.startParagraphOffset:0,a===e.endIndex?e.endParagraphOffset:Ae(t),t=>{var e;return"insert"===(null==(e=t.revision)?void 0:e.type)?{...t,text:""}:{...t,revision:{id:n,type:"delete",author:r,date:o}}})}),Vw(e.start))}const n=a[e.startIndex],r=a[e.endIndex],o=Te(n,e.start),i=Te(r,e.end),l=fw(n,[...xw(n,0,o),...xw(r,i,Ae(r))]);return Cw(t,[...nw(a.slice(0,e.startIndex)),l,...nw(a.slice(e.endIndex+1))],Vw(Ie(l,o)))}function Lw(t,e,a,n){return fw(t,[...xw(t,0,e),...xw(t,e,a).map(n),...xw(t,a,Ae(t))])}function zw(t,e){const a=t[e.startIndex],n=t[e.endIndex];return{anchor:Ie(a,e.startParagraphOffset),focus:Ie(n,e.endParagraphOffset)}}function Nw(t,e){const a=ra(t);return a.isCollapsed?t:{document:t.document,selection:Vw("start"===e?a.start:a.end)}}function qw(t){return Gx(t,t=>Boolean(t.image))}function Ow(t,e){const a=qw(t);if(!a)return t;const n=function(t){if(!Number.isFinite(t))return;const e=(Math.round(t)%360+360)%360;return 0===e?void 0:e}(e),r=_e(t),{paragraphIndex:o,run:i}=a,l=r.map((t,e)=>e!==o?ew(t):{...ew(t),runs:t.runs.map(t=>t.id===i.id&&t.image?{...t,image:{...t.image,rotation:n}}:tw(t))});return Cw(t,l,zw(l,ra(t)))}function Pw(t,e){const a=qw(t);if(!(null==a?void 0:a.run.image))return t;const n=_e(t),{paragraphIndex:r,run:o}=a,i=n.map((t,a)=>a!==r?ew(t):{...ew(t),runs:t.runs.map(t=>{if(t.id!==o.id||!t.image)return tw(t);const a=e(t.image.floating),n={...t.image};return a?n.floating=a:delete n.floating,{...t,image:n}})});return Cw(t,i,zw(i,ra(t)))}function Ww(t){const e=qw(t);if(!(null==e?void 0:e.run.image))return null;return function(t){var e;if(!sw(t))return"";let a=!1,n="";for(const r of t.runs)a?n+=r.text:"end"===(null==(e=r.fieldChar)?void 0:e.kind)&&(a=!0);return n.replace(/^[:\-\s]+/,"")}(_e(t)[e.paragraphIndex+1])}function Hw(t,e,a){const n=qw(t);if(!(null==n?void 0:n.run.image))return t;const r=_e(t),o=n.paragraphIndex+1,i=o<r.length&&sw(r[o])?function(t,e,a){var n;const r=(null==(n=t.runs.find(t=>/^\d+$/.test(t.text)))?void 0:n.text)??"1",o=lw(e,a,Number.parseInt(r,10)||1);return o.id=t.id,o}(r[o],e,a):lw(e,a,1),l=function(t){let e=1;return t.map(t=>sw(t)?dw(t,e++):ew(t))}(o<r.length&&sw(r[o])?[...nw(r.slice(0,o)),i,...nw(r.slice(o+1))]:[...nw(r.slice(0,o)),i,...nw(r.slice(o))]),s=l[o]??i;return Cw(t,l,Vw(Ie(s,Ae(s))))}function Uw(t,e){const a=qw(t);if(!a)return t;const n=_e(t),{paragraphIndex:r,offset:o,run:i}=a,l=$e(n,e.paragraphId);if(l<0)return t;const s=Te(n[l],e),d=l===r&&s>o?s-1:s;if(l===r&&d===o)return t;const c=t=>fw(t,[...xw(t,0,o),...xw(t,o+1,Ae(t))]),h=(t,e)=>ww(t,Math.max(0,Math.min(e,Ae(t))),[va("",yw(t,e),i.image)]),p=n.map((t,e)=>e===r&&e===l?h(c(t),d):e===r?c(t):e===l?h(t,d):nw([t])[0]),u=p[l];return Cw(t,p,Vw(Ie(u,Math.max(0,Math.min(d+1,Ae(u))))))}function Fw(t){return Gx(t,t=>Boolean(t.textBox))}function Bw(t,e){const a=Fw(t);if(!a||!a.run.textBox)return t;const n=function(t){if(!Number.isFinite(t))return;const e=(Math.round(t)%360+360)%360;return 0===e?void 0:e}(e),{paragraphIndex:r,run:o}=a,i=_e(t).map((t,e)=>e!==r?ew(t):{...ew(t),runs:t.runs.map(t=>t.id===o.id&&t.textBox?{...t,textBox:{...t.textBox,rotation:n}}:tw(t))});return Cw(t,i,zw(i,ra(t)))}function Gw(t,e){const a=Fw(t);if(!(null==a?void 0:a.run.textBox))return t;const{paragraphIndex:n,run:r}=a,o=_e(t).map((t,a)=>a!==n?ew(t):{...ew(t),runs:t.runs.map(t=>{if(t.id!==r.id||!t.textBox)return tw(t);const a=e(t.textBox.floating),n={...t.textBox};return a?n.floating=a:delete n.floating,{...t,textBox:n}})});return Cw(t,o,zw(o,ra(t)))}function Zw(t){return t.map(tw)}function Kw(t){return t.reduce((t,e)=>t+e.text.length,0)}function Dw(t,e,a){if(0===a.length)return t;const n=_e(t),r=n.findIndex(t=>t.id===e.paragraphId);if(-1===r)return t;const o=n[r],i=Te(o,e),l=Zw(a[0].runs);if(1===a.length){const e=ww(o,i,l),a=n.map((t,a)=>a===r?e:t),s=Kw(l);return Cw(t,a,{anchor:Ie(e,i),focus:Ie(e,i+s)})}const s=xw(o,0,i),d=xw(o,i,Ae(o)),c=a[a.length-1],h=a.slice(1,-1),p=fw(ew(a[0].paragraphTemplate),[...s,...l],yw(o,i)),u=h.map(t=>fw(ew(t.paragraphTemplate),Zw(t.runs))),f=fw(ew(c.paragraphTemplate),[...Zw(c.runs),...d],yw(o,i));return Cw(t,[...n.slice(0,r),p,...u,f,...n.slice(r+1)],{anchor:Ie(p,Kw(s)),focus:Ie(f,Kw(c.runs))})}function jw(t,e,a={}){if(ra(t).isCollapsed)return t;if(function(t,e){const a=ra(t);if(a.isCollapsed)return!1;const n=_e(t),r=n.findIndex(t=>t.id===e.paragraphId);if(-1===r)return!1;if(r<a.startIndex||r>a.endIndex)return!1;const o=Te(n[r],e);return!(r===a.startIndex&&o<a.startParagraphOffset||r===a.endIndex&&o>a.endParagraphOffset)}(t,e))return t;const n=function(t){const e=ra(t);if(e.isCollapsed)return[];const a=_e(t),n=[];for(let r=e.startIndex;r<=e.endIndex;r+=1){const t=a[r],o=xw(t,r===e.startIndex?e.startParagraphOffset:0,r===e.endIndex?e.endParagraphOffset:Ae(t));n.push({paragraphTemplate:ew(t),runs:o})}return n}(t);if(0===n.length)return t;if(a.copy)return Dw(t,e,n);const r=function(t,e){const a=ra(t),n=_e(t),r=n.findIndex(t=>t.id===e.paragraphId);if(-1===r)return e;const o=Te(n[r],e);if(a.startIndex===a.endIndex)return r!==a.startIndex||o<=a.endParagraphOffset?e:Ie(n[a.startIndex],o-(a.endParagraphOffset-a.startParagraphOffset));return e}(t,e);return Dw(Rw(t),r,n)}function Xw(t,e,a){if(0===e.length)return t;const n=na(t.selection)?t:Rw(t),{paragraph:r,index:o,offset:i}=Ew(n),l=a?{...a}:yw(r,i),s={id:`run:${Math.random().toString(36).slice(2,9)}`,text:e,styles:l};n.trackChangesEnabled&&(s.revision={id:`rev:${Math.random().toString(36).slice(2,9)}`,type:"insert",author:"User",date:Date.now()});const d=ww(r,i,[s]);return Cw(n,_e(n).map((t,e)=>e===o?d:t),Vw(Ie(d,i+e.length)))}function Jw(t,e,a){if(0===e.length)return t;const n=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n");if(!n.includes("\n"))return Xw(t,n,a);const r=na(t.selection)?t:Rw(t),{paragraph:o,index:i,offset:l}=Ew(r),s=n.split("\n"),d=yw(o,l),c=fw(o,[...xw(o,0,l),va(s[0],d)],d),h=xw(o,l,Ae(o)),p=s.slice(1,-1).map(t=>gw([{text:t,styles:d}])),u=gw([{text:s[s.length-1],styles:d},...h.map(t=>({text:t.text,styles:t.styles}))]),f=_e(r);return Cw(r,[...f.slice(0,i),c,...p,u,...f.slice(i+1)],Vw(Ie(u,s[s.length-1].length)))}function Yw(t){var e;if(!na(t.selection))return Rw(t);const{paragraph:a,index:n,offset:r}=Ew(t),o=_e(t);if(r>0){if(t.trackChangesEnabled){const i=a.runs;let l=0,s=-1,d=-1;for(let t=0;t<i.length;t+=1){const e=l+i[t].text.length;if(r<=e){s=t,d=r-l;break}l=e}if(-1!==s){const l=i[s];if("insert"===(null==(e=l.revision)?void 0:e.type)){const e=fw(a,[...xw(a,0,r-1),...xw(a,r,Ae(a))]);return Cw(t,o.map((t,a)=>a===n?e:t),Vw(Ie(e,r-1)))}const c=l.text[d-1],h={id:`run:${Math.random().toString(36).slice(2,9)}`,text:c,styles:{...l.styles},revision:{id:`rev:${Math.random().toString(36).slice(2,9)}`,type:"delete",author:"User",date:Date.now()}},p=fw(a,[...xw(a,0,r-1),h,...xw(a,r,Ae(a))]);return Cw(t,o.map((t,e)=>e===n?p:t),Vw(Ie(p,r-1)))}}const i=fw(a,[...xw(a,0,r-1),...xw(a,r,Ae(a))],yw(a,r-1));return Cw(t,o.map((t,e)=>e===n?i:t),Vw(Ie(i,r-1)))}if(0===n)return t;const i=o[n-1],l=fw(i,[...i.runs.map(tw),...a.runs.map(tw)]);return Cw(t,[...o.slice(0,n-1),l,...o.slice(n+1)],Vw(Ie(l,Ae(i))))}function Qw(t){var e;if(!na(t.selection))return Rw(t);const{paragraph:a,index:n,offset:r}=Ew(t),o=_e(t);if(r<Ae(a)){if(t.trackChangesEnabled){const i=a.runs;let l=0,s=-1,d=-1;for(let t=0;t<i.length;t+=1){const e=l+i[t].text.length;if(r<e){s=t,d=r-l;break}l=e}if(-1!==s){const l=i[s];if("insert"===(null==(e=l.revision)?void 0:e.type)){const e=fw(a,[...xw(a,0,r),...xw(a,r+1,Ae(a))]);return Cw(t,o.map((t,a)=>a===n?e:t),Vw(Ie(e,r)))}const c=l.text[d],h={id:`run:${Math.random().toString(36).slice(2,9)}`,text:c,styles:{...l.styles},revision:{id:`rev:${Math.random().toString(36).slice(2,9)}`,type:"delete",author:"User",date:Date.now()}},p=fw(a,[...xw(a,0,r),h,...xw(a,r+1,Ae(a))]);return Cw(t,o.map((t,e)=>e===n?p:t),Vw(Ie(p,r)))}}const i=fw(a,[...xw(a,0,r),...xw(a,r+1,Ae(a))],yw(a,r));return Cw(t,o.map((t,e)=>e===n?i:t),Vw(Ie(i,r)))}if(n>=o.length-1)return t;const i=o[n+1],l=fw(a,[...a.runs.map(tw),...i.runs.map(tw)]);return Cw(t,[...o.slice(0,n),l,...o.slice(n+2)],Vw(Ie(l,r)))}function _w(t,e){const a=ra(t);if(a.isCollapsed)return t;const n=_e(t),r=n.slice(a.startIndex,a.endIndex+1).flatMap((t,e)=>{const n=a.startIndex+e;return xw(t,n===a.startIndex?a.startParagraphOffset:0,n===a.endIndex?a.endParagraphOffset:Ae(t))}).filter(t=>t.text.length>0);if(0===r.length)return t;const o=!r.every(t=>{var a;return Boolean(null==(a=t.styles)?void 0:a[e])}),i=n.map((t,n)=>{if(n<a.startIndex||n>a.endIndex)return t;return Lw(t,n===a.startIndex?a.startParagraphOffset:0,n===a.endIndex?a.endParagraphOffset:Ae(t),t=>({...t,styles:Yx(t.styles,e,o)}))});return Cw(t,i,zw(i,a))}function $w(t){return new RegExp("\\p{L}","u").test(t)}function tS(t,e){switch(e){case"lower":return t.toLowerCase();case"upper":return t.toUpperCase();case"capitalize":return function(t){let e="",a=!1;for(const n of t){const t=$w(n);e+=t&&!a?n.toUpperCase():n,a=t}return e}(t);case"toggle":return function(t){let e="";for(const a of t){const t=a.toUpperCase(),n=a.toLowerCase();e+=a===n&&a!==t?t:a===t&&a!==n?n:a}return e}(t);default:return function(t){let e="",a=!0;for(const n of t.toLowerCase())a&&$w(n)?(e+=n.toUpperCase(),a=!1):(e+=n,"."!==n&&"!"!==n&&"?"!==n||(a=!0));return e}(t)}}function eS(t,e){return function(t,e){const a=ra(t);if(a.isCollapsed)return t;const n=_e(t).map((t,n)=>{if(n<a.startIndex||n>a.endIndex)return t;const r=n===a.startIndex?a.startParagraphOffset:0,o=n===a.endIndex?a.endParagraphOffset:Ae(t),i=xw(t,r,o).map(t=>t.text).join(""),l=e(i);let s=0;return Lw(t,r,o,t=>{const e=t.text.length,a=l.slice(s,s+e);return s+=e,{...t,text:a}})});return Cw(t,n,zw(n,a))}(t,t=>tS(t,e))}function aS(t,e,a){const n=ra(t);if(n.isCollapsed)return t;const r=_e(t).map((t,r)=>{if(r<n.startIndex||r>n.endIndex)return t;return Lw(t,r===n.startIndex?n.startParagraphOffset:0,r===n.endIndex?n.endParagraphOffset:Ae(t),t=>({...t,styles:Qx(t.styles,e,a)}))});return Cw(t,r,zw(r,n))}function nS(t,e,a){var n;let r;const o=t=>{const a=t.findIndex(t=>t.id===e);return a>=0?(r=t[a],[...t.slice(0,a),...t.slice(a+1)]):t},i={...t.document};if(i.sections&&i.sections.length>0&&(i.sections=i.sections.map(t=>({...t,blocks:o(t.blocks),header:t.header?o(t.header):void 0,footer:t.footer?o(t.footer):void 0}))),!r)return t;const l=a.paragraphId;if("table"===r.type){if(He(r).some(t=>t.id===l))return t}const s=t=>{const e=t.findIndex(t=>t.id===l||"table"===t.type&&He(t).some(t=>t.id===l));if(e<0)return{nextBlocks:t,found:!1};return{nextBlocks:[...t.slice(0,e),r,...t.slice(e)],found:!0}},d=Je(t),c=Ye(t),h={...null==(n=i.sections)?void 0:n[d]};let p=!1;if("header"===c){const t=s(h.header??[]);h.header=t.nextBlocks,p=t.found}else if("footer"===c){const t=s(h.footer??[]);h.footer=t.nextBlocks,p=t.found}else{const t=s(h.blocks);h.blocks=t.nextBlocks,p=t.found}return p||(h.blocks=[...h.blocks,r]),i.sections=[...i.sections??[]],i.sections[d]=h,{...t,document:i}}function rS(t){const e=na(t.selection)?t:Rw(t),{paragraph:a,index:n,offset:r}=Ew(e),o=fw(a,xw(a,0,r),yw(a,r)),i=xw(a,r,Ae(a)),l=i.length>0?mw(a,i.map(t=>({text:t.text,styles:t.styles}))):(()=>{const t=ba("");return t.style=a.style?{...a.style}:void 0,t.list=a.list?{...a.list}:void 0,t})(),s=_e(e);return Cw(e,[...nw(s.slice(0,n)),o,l,...nw(s.slice(n+1))],Vw(Ie(l,0)))}function oS(t){const e=na(t.selection)?t:Rw(t),{paragraph:a,index:n,offset:r}=Ew(e),o=fw(a,xw(a,0,r),yw(a,r)),i=xw(a,r,Ae(a)),l=i.length>0?mw(a,i.map(t=>({text:t.text,styles:t.styles}))):(()=>{const t=ba("");return t.style=a.style?{...a.style}:void 0,t.list=a.list?{...a.list}:void 0,t})();l.style={...a.style??{},pageBreakBefore:!0};const s=_e(e);return Cw(e,[...nw(s.slice(0,n)),o,l,...nw(s.slice(n+1))],Vw(Ie(l,0)))}function iS(t,e,a){const n=ra(t),r=_e(t),o=n.startIndex,i=n.endIndex,l=r.map((t,n)=>n<o||n>i?ew(t):{...ew(t),style:_x(t.style,e,a)});return Cw(t,l,zw(l,n))}function lS(t){const e=ra(t),a=_e(t).map((t,a)=>{if(a<e.startIndex||a>e.endIndex)return ew(t);if(!t.list)return ew(t);const n=t.list.level??0;return n<=0?bw(t):vw(t,n-1)});return Cw(t,a,zw(a,e))}function sS(t,e,a){const n={...t??{}};return null===a?delete n[e]:n[e]=a,Object.keys(n).length>0?n:void 0}function dS(t,e){const a=We(t.document).map(t=>({...t,blocks:e(t.blocks),header:t.header?e(t.header):void 0,footer:t.footer?e(t.footer):void 0}));return{...t,document:{...t.document,sections:a}}}function cS(t,e){return t.map(t=>"table"===t.type?e(t):t)}function hS(t,e){return t.map(t=>"paragraph"===t.type?t:{...e(t),rows:t.rows.map(t=>({...t,cells:t.cells.map(t=>({...t,blocks:hS(t.blocks,e)}))}))})}function pS(t){const e=Je(t),a=Xe(t.document,t.selection.focus.paragraphId,e);return a?{activeSectionIndex:e,loc:a}:null}function uS(t,e){const a=pS(t);if(!a)return t;const{activeSectionIndex:n,loc:r}=a,o=Ye(t),i=(t,a)=>t.map((t,n)=>"table"===t.type&&n===r.blockIndex&&a===r.zone?e(t):t),l=We(t.document).map((t,e)=>e!==n?t:{...t,blocks:"main"===o?i(t.blocks,"main"):t.blocks,header:"header"===o&&t.header?i(t.header,"header"):t.header,footer:"footer"===o&&t.footer?i(t.footer,"footer"):t.footer});return{...t,document:{...t.document,sections:l}}}function fS(t){const e=new Set,a=Je(t),n=Xe(t.document,t.selection.anchor.paragraphId,a),r=Xe(t.document,t.selection.focus.paragraphId,a);if(!n||!r||n.blockIndex!==r.blockIndex||n.zone!==r.zone)return e;const o=function(t,e,a){const n=We(t)[e];if(n)return"header"===a?n.header:"footer"===a?n.footer:n.blocks}(t.document,a,n.zone),i=null==o?void 0:o[n.blockIndex];if(!i||"table"!==i.type)return e;const l=on(i),s=l.find(t=>t.rowIndex===n.rowIndex&&t.cellIndex===n.cellIndex),d=l.find(t=>t.rowIndex===r.rowIndex&&t.cellIndex===r.cellIndex);if(!s||!d)return e;const c=Math.min(s.visualRowIndex,d.visualRowIndex),h=Math.max(s.visualRowIndex+s.rowSpan-1,d.visualRowIndex+d.rowSpan-1),p=Math.min(s.visualColumnIndex,d.visualColumnIndex),u=Math.max(s.visualColumnIndex+s.colSpan-1,d.visualColumnIndex+d.colSpan-1),f=l.filter(t=>t.visualRowIndex<=h&&t.visualRowIndex+t.rowSpan-1>=c&&t.visualColumnIndex<=u&&t.visualColumnIndex+t.colSpan-1>=p);for(const g of f)for(const t of g.cell.blocks)e.add(t.id);return e}function gS(t,e,a){const n=fS(t);if(0===n.size)for(const i of function(t){const e=new Set,a=ra(t),n=_e(t);for(let r=a.startIndex;r<=a.endIndex;r+=1)e.add(n[r].id);return e}(t))n.add(i);const r=t=>({...t,style:sS(t.style,e,a)}),o=We(t.document).map(t=>({...t,blocks:kw(t.blocks,n,r),header:t.header?kw(t.header,n,r):void 0,footer:t.footer?kw(t.footer,n,r):void 0}));return{...t,document:{...t.document,sections:o}}}function mS(t,e){let a=gS(t,"borderTop",e);return a=gS(a,"borderRight",e),a=gS(a,"borderBottom",e),a=gS(a,"borderLeft",e),a}function vS(t,e,a){const n=function(t){const e=ra(t),a=_e(t),n=new Set;for(let r=e.startIndex;r<=e.endIndex;r+=1)n.add(a[r].id);return n}(t),r=t=>t.map(t=>{if("paragraph"===t.type)return t;const o=He(t).some(t=>n.has(t.id)),i=t.rows.map(t=>({...t,cells:t.cells.map(t=>({...t,blocks:r(t.blocks)}))})),l={...t,rows:i};return o?(s=l,{...s,style:sS(s.style,e,a)}):l;var s});return dS(t,r)}function bS(t,e,a,n){const r=t=>t.id!==e?t:{...t,style:sS(t.style,a,n)};return dS(t,t=>hS(t,r))}function yS(t,e,a){const n=pS(t);if(!n)return t;return uS(t,t=>{const r=t.rows.map((t,r)=>r===n.loc.rowIndex?{...t,style:sS(t.style,e,a)}:t);return{...t,rows:r}})}function MS(t){if("number"==typeof t&&Number.isFinite(t))return t;if("string"!=typeof t)return null;const e=t.trim().toLowerCase();if(!e||e.includes("%"))return null;if(e.endsWith("pt")){const t=Number.parseFloat(e.slice(0,-2));return Number.isFinite(t)?t:null}if(e.endsWith("px")){const t=Number.parseFloat(e.slice(0,-2));return Number.isFinite(t)?.75*t:null}if(!/^[+-]?\d+(\.\d+)?$/.test(e))return null;const a=Number.parseFloat(e);return Number.isFinite(a)?a:null}function xS(t,e,a,n,r){const o=t=>{var o;if(t.id!==e)return t;const i=on(t),l=Math.max(1,...i.map(t=>t.visualColumnIndex+Math.max(1,t.colSpan))),s=Array(l);let d=!1,c=!0;for(let e=0;e<l;e+=1){const n=MS(a[e]);if(null!==n){s[e]=Math.max(1,n),d=!0;continue}const r=null==(o=t.gridCols)?void 0:o[e];if(!("number"==typeof r&&Number.isFinite(r)&&r>0)){c=!1;break}s[e]=r}const h=t.rows.map((t,e)=>{const n=t.cells.map((t,n)=>{const r=i.find(t=>t.rowIndex===e&&t.cellIndex===n);if(!r)return t;const o=r.visualColumnIndex+r.colSpan-1,l=a[o];return void 0!==l&&1===r.colSpan?{...t,style:{...t.style??{},width:l}}:t});return{...t,cells:n}}),p={...t.style??{}};return void 0!==n&&(p.width=n),void 0!==r&&(p.indentLeft="number"==typeof r?r:Number(r)),{...t,rows:h,gridCols:d&&c?s:t.gridCols,style:Object.keys(p).length>0?p:void 0}};return dS(t,t=>cS(t,o))}function wS(t,e){return{document:t.document,selection:e}}function SS(t,e){if(!na(t.selection))return Nw(t,e<0?"start":"end");const{index:a,offset:n}=Ew(t),r=_e(t),o=a+e;if(o<0||o>=r.length)return t;const i=r[o];return wS(t,Vw(Ie(i,Math.min(n,Ae(i)))))}function AS(t,e){const a=ta(t,t.selection.focus),n=_e(t),r=$e(n,a.paragraphId),o=n[r],i=Te(o,a),l=Ae(o);if(e<0&&i>0)return wS(t,{anchor:t.selection.anchor,focus:Ie(o,i-1)});if(e>0&&i<l)return wS(t,{anchor:t.selection.anchor,focus:Ie(o,i+1)});if(e<0&&r>0){const e=n[r-1];return wS(t,{anchor:t.selection.anchor,focus:Ie(e,Ae(e))})}if(e>0&&r<n.length-1){const e=n[r+1];return wS(t,{anchor:t.selection.anchor,focus:Ie(e,0)})}return t}function IS(t,e){const a=ta(t,t.selection.focus),n=_e(t),r=$e(n,a.paragraphId),o=Te(n[r],a),i=r+e;if(i<0||i>=n.length)return t;const l=n[i];return wS(t,{anchor:t.selection.anchor,focus:Ie(l,Math.min(o,Ae(l)))})}function TS(t){const e=ra(t);if(e.isCollapsed)return"";const a=_e(t);if(e.startIndex===e.endIndex){return Se(a[e.startIndex]).slice(e.startParagraphOffset,e.endParagraphOffset)}const n=[],r=a[e.startIndex],o=a[e.endIndex];n.push(Se(r).slice(e.startParagraphOffset));for(let i=e.startIndex+1;i<e.endIndex;i+=1)n.push(Se(a[i]));return n.push(Se(o).slice(0,e.endParagraphOffset)),n.join("\n")}function CS(t,e){return{...t,selection:{anchor:ta(t,e.anchor),focus:ta(t,e.focus)}}}function kS(t){if(!na(t.selection))return Nw(t,"start");const{paragraph:e,index:a,offset:n}=Ew(t),r=_e(t);if(n>0)return{document:t.document,selection:Vw(Ie(e,n-1))};if(0===a)return t;const o=r[a-1];return{document:t.document,selection:Vw(Ie(o,Ae(o)))}}function VS(t){if(!na(t.selection))return Nw(t,"end");const{paragraph:e,index:a,offset:n}=Ew(t),r=_e(t);if(n<Ae(e))return{document:t.document,selection:Vw(Ie(e,n+1))};if(a>=r.length-1)return t;const o=r[a+1];return{document:t.document,selection:Vw(Ie(o,0))}}function ES(t){var e,a,n;const r=ra(t),o=_e(t);if(r.isCollapsed){const t=o[r.startIndex];return t?(null==(e=Mw(t,r.startParagraphOffset))?void 0:e.href)??null:null}const i=o.slice(r.startIndex,r.endIndex+1).flatMap((t,e)=>{const a=r.startIndex+e;return xw(t,a===r.startIndex?r.startParagraphOffset:0,a===r.endIndex?r.endParagraphOffset:Ae(t))}).filter(t=>t.text.length>0&&!t.image);if(0===i.length)return null;const l=null==(n=null==(a=i[0])?void 0:a.styles)?void 0:n.link;return l&&i.every(t=>{var e;return(null==(e=t.styles)?void 0:e.link)===l})?l:null}function RS(t,e){const a=_e(t).map(t=>{const a=t.runs.filter(t=>{var a;return!((null==(a=t.revision)?void 0:a.id)===e&&"delete"===t.revision.type)}).map(t=>{var a;if((null==(a=t.revision)?void 0:a.id)===e&&"insert"===t.revision.type){const e={...t};return delete e.revision,e}return t});return a.length===t.runs.length&&a.every((e,a)=>e===t.runs[a])?t:fw(t,a)});return Cw(t,a,zw(a,ra(t)))}function LS(t,e){const a=_e(t).map(t=>{const a=t.runs.filter(t=>{var a;return!((null==(a=t.revision)?void 0:a.id)===e&&"insert"===t.revision.type)}).map(t=>{var a;if((null==(a=t.revision)?void 0:a.id)===e&&"delete"===t.revision.type){const e={...t};return delete e.revision,e}return t});return a.length===t.runs.length&&a.every((e,a)=>e===t.runs[a])?t:fw(t,a)});return Cw(t,a,zw(a,ra(t)))}function zS(t){if(!t)return"";const e=[];t.fontFamily&&e.push(`font-family:${t.fontFamily}`),void 0!==t.fontSize&&null!==t.fontSize&&e.push(`font-size:${t.fontSize}px`),t.color&&e.push(`color:${t.color}`),t.highlight?e.push(`background-color:${t.highlight}`):t.shading&&e.push(`background-color:${t.shading}`),t.superscript?(e.push("vertical-align:super"),e.push("font-size:0.75em")):t.subscript&&(e.push("vertical-align:sub"),e.push("font-size:0.75em")),t.bold&&e.push("font-weight:700"),t.italic&&e.push("font-style:italic"),t.hidden&&e.push("display:none"),t.allCaps&&e.push("text-transform:uppercase"),t.smallCaps&&e.push("font-variant:small-caps"),void 0!==t.characterScale&&null!==t.characterScale&&e.push(`font-stretch:${t.characterScale}%`),void 0!==t.characterSpacing&&null!==t.characterSpacing&&e.push(`letter-spacing:${t.characterSpacing}pt`),NS(t.language)&&e.push("hyphens:auto"),void 0!==t.baselineShift&&null!==t.baselineShift&&e.push(`vertical-align:${t.baselineShift}pt`);const a=function(t){switch(t){case"none":return"none";case"standard":return"common-ligatures";case"contextual":return"contextual";case"historical":return"historical-ligatures";case"standardContextual":return"common-ligatures contextual";default:return null}}(t.ligatures);a&&e.push(`font-variant-ligatures:${a}`);const n=function(t,e){const a=[];"proportional"===t&&a.push("proportional-nums");"tabular"===t&&a.push("tabular-nums");"lining"===e&&a.push("lining-nums");"oldStyle"===e&&a.push("oldstyle-nums");return a.join(" ")||null}(t.numberSpacing,t.numberForm);n&&e.push(`font-variant-numeric:${n}`);const r=function(t,e){const a=[];"number"==typeof t&&t>=1&&t<=20&&a.push(`"ss${String(t).padStart(2,"0")}" 1`);e&&a.push('"calt" 1');return a.join(", ")||null}(t.stylisticSet,t.contextualAlternates);r&&e.push(`font-feature-settings:${r}`);const o=[];if((t.underline||t.link)&&o.push("underline"),t.strike&&o.push("line-through"),t.doubleStrike&&o.push("line-through"),o.length>0&&(e.push(`text-decoration:${o.join(" ")}`),t.underline||t.link)){const a=function(t){switch(t){case"double":case"wavyDouble":return"double";case"dotted":case"dottedHeavy":return"dotted";case"dash":case"dashedHeavy":case"dashLong":case"dashLongHeavy":case"dotDash":case"dashDotHeavy":case"dotDotDash":case"dashDotDotHeavy":return"dashed";case"wave":case"wavyHeavy":return"wavy";default:return null}}(t.underlineStyle);a&&e.push(`text-decoration-style:${a}`),t.underlineColor&&e.push(`text-decoration-color:${t.underlineColor}`)}return e.join(";")}function NS(t){return(null==t?void 0:t.value)??(null==t?void 0:t.bidi)??(null==t?void 0:t.eastAsia)??null}function qS(t){if(!t)return"";const e=[];if(t.align&&e.push(`text-align:${t.align}`),void 0!==t.lineHeight&&null!==t.lineHeight){const a="exact"===t.lineRule||"atLeast"===t.lineRule;e.push(`line-height:${t.lineHeight}${a?"px":""}`)}return void 0!==t.spacingBefore&&null!==t.spacingBefore&&e.push(`padding-top:${t.spacingBefore}px`),void 0!==t.spacingAfter&&null!==t.spacingAfter&&e.push(`padding-bottom:${t.spacingAfter}px`),void 0!==t.indentLeft&&null!==t.indentLeft&&e.push(`padding-left:${t.indentLeft}px`),void 0!==t.indentRight&&null!==t.indentRight&&e.push(`padding-right:${t.indentRight}px`),void 0!==t.indentFirstLine&&null!==t.indentFirstLine&&e.push(`text-indent:${t.indentFirstLine}px`),e.join(";")}function OS(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function PS(t,e){if(t.image)return function(t,e){var a;if(!t.image)return"";const n=Oe(e,t.image.src),r=void 0!==t.image.alt?` alt="${OS(t.image.alt)}"`:"",o=`<img src="${OS(n)}" width="${Math.max(1,Math.round(t.image.width))}" height="${Math.max(1,Math.round(t.image.height))}"${r}>`;return(null==(a=t.styles)?void 0:a.link)?`<a href="${OS(t.styles.link)}">${o}</a>`:o}(t,e);let a=OS(t.text).replace(/\n/g,"<br>");const n=t.styles??void 0;(null==n?void 0:n.strike)&&(a=`<s>${a}</s>`),(null==n?void 0:n.underline)&&(a=`<u>${a}</u>`),(null==n?void 0:n.italic)&&(a=`<em>${a}</em>`),(null==n?void 0:n.bold)&&(a=`<strong>${a}</strong>`),(null==n?void 0:n.superscript)?a=`<sup>${a}</sup>`:(null==n?void 0:n.subscript)&&(a=`<sub>${a}</sub>`);const r=zS(n),o=function(t){if(!t)return"";const e=[],a=NS(t);return a&&e.push(`lang="${OS(a)}"`),t.value&&e.push(`data-oasis-lang-value="${OS(t.value)}"`),t.eastAsia&&e.push(`data-oasis-lang-east-asia="${OS(t.eastAsia)}"`),t.bidi&&e.push(`data-oasis-lang-bidi="${OS(t.bidi)}"`),e.length>0?` ${e.join(" ")}`:""}(null==n?void 0:n.language);if(r.length>0||o.length>0){a=`<span${r.length>0?` style="${r}"`:""}${o}>${a}</span>`}return(null==n?void 0:n.link)&&(a=`<a href="${OS(n.link)}">${a}</a>`),a}function WS(t,e){return t.map(t=>PS(t,e)).join("")||"<br>"}function HS(t){var e;const a=ra(t);if(a.isCollapsed)return"";const n=_e(t),r=[];let o=null;const i=()=>{o&&(r.push("bullet"===o?"</ul>":"</ol>"),o=null)};for(let l=a.startIndex;l<=a.endIndex;l+=1){const s=n[l];if(!s)continue;const d=xw(s,l===a.startIndex?a.startParagraphOffset:0,l===a.endIndex?a.endParagraphOffset:Ae(s)),c=qS(s.style),h=c.length>0?` style="${c}"`:"",p=WS(d,t.document);if(null==(e=s.list)?void 0:e.kind){const t="bullet"===s.list.kind?"ul":"ol";o!==s.list.kind&&(i(),r.push(`<${t}>`),o=s.list.kind),r.push(`<li${h}>${p}</li>`);continue}i(),r.push(`<p${h}>${p}</p>`)}return i(),r.join("")}function US(t,e){if(0===e.length)return t;const a=na(t.selection)?t:Rw(t),{paragraph:n,index:r,offset:o}=Ew(a),i=_e(a),l=xw(n,0,o),s=xw(n,o,Ae(n)),d=e.map(t=>{const e=ya(t.runs.map(t=>({text:t.text,styles:Xx(t.styles),image:t.image?{...t.image}:void 0})));return e.style=t.style?{...t.style}:void 0,e.list=t.list?{...t.list}:void 0,e});let c,h=Vw(Ie(n,o));if(1===d.length){const t=d[0],e=t.runs.reduce((t,e)=>t+e.text.length,0),a=fw(n,[...l,...t.runs.map(tw),...s],yw(n,o));a.style=n.style?{...n.style}:t.style?{...t.style}:void 0,a.list=n.list?{...n.list}:t.list?{...t.list}:void 0,c=[...nw(i.slice(0,r)),a,...nw(i.slice(r+1))],h=Vw(Ie(a,l.reduce((t,e)=>t+e.text.length,0)+e))}else{const t=d[0],e=d[d.length-1],a=e.runs.reduce((t,e)=>t+e.text.length,0),p=fw(n,[...l,...t.runs.map(tw)],yw(n,o));p.style=n.style?{...n.style}:t.style?{...t.style}:void 0,p.list=n.list?{...n.list}:t.list?{...t.list}:void 0;const u=d.slice(1,-1).map(ew),f=fw(e,[...e.runs.map(tw),...s],void 0);f.list=e.list?{...e.list}:void 0,c=[...nw(i.slice(0,r)),p,...u,f,...nw(i.slice(r+1))],h=Vw(Ie(f,a))}return Cw(a,c,h)}function FS(t){if("main"!==(t.activeZone??"main"))return t;const e=na(t.selection)?t:Rw(t),{paragraph:a,index:n,offset:r}=Ew(e),o=function(){const t=[Aa("",{styleId:"footnoteText"})];return{id:Sa(),blocks:t}}(),i=function(t){var e,a;const n=t.footnotes,r=(null==(e=null==n?void 0:n.settings)?void 0:e.numberFormat)??"decimal";let o=((null==(a=null==n?void 0:n.settings)?void 0:a.startAt)??1)-1;const i=new Set;for(const{run:l}of Bl(t)){const t=l.footnoteReference;t&&!t.customMark&&(i.has(t.footnoteId)||(i.add(t.footnoteId),o+=1))}return jl(o+1,r)}(e.document),l=function(t,e){const a=va(e,{styleId:"footnoteReference",superscript:!0}),n={footnoteId:t};return a.footnoteReference=n,a}(o.id,i),s=ww(a,r,[l]),d=Cw(e,_e(e).map((t,e)=>e===n?s:t),aa(Ie(s,r+i.length))),c=function(t){return t||{items:{}}}(d.document.footnotes),h=Jl({...d.document,footnotes:{...c,items:{...c.items,[o.id]:o}}}),p=o.blocks.flatMap(He).find(Boolean);return p?{...d,document:h,selection:aa(Ie(p,0)),activeZone:"footnote",activeFootnoteId:o.id}:{...d,document:h}}const BS=[{x:0,y:0},{x:1,y:0},{x:1,y:1},{x:0,y:1}],GS=new Map;function ZS(){return BS.map(t=>({...t}))}const KS=[[0,-1],[1,-1],[1,0],[1,1],[0,1],[-1,1],[-1,0],[-1,-1]];function DS(t,e,a){const[n,r]=t,[o,i]=e,[l,s]=a,d=l-o,c=s-i,h=d*d+c*c;if(0===h)return Math.hypot(n-o,r-i);return Math.abs(d*(i-r)-c*(o-n))/Math.sqrt(h)}function jS(t,e){if(t.length<3)return t.slice();let a=0,n=0;const r=t[0],o=t[t.length-1];for(let s=1;s<t.length-1;s+=1){const e=DS(t[s],r,o);e>a&&(a=e,n=s)}if(a<=e)return[r,o];const i=jS(t.slice(0,n+1),e),l=jS(t.slice(n),e);return[...i.slice(0,-1),...l]}function XS(t,e,a){let n=0;for(let s=0;s<t.length;s+=1)1===t[s]&&(n+=1);if(e<=0||a<=0||0===n||n/(e*a)>=.985)return ZS();const r=function(t,e,a){const n=(n,r)=>n>=0&&n<e&&r>=0&&r<a&&1===t[r*e+n];let r=-1,o=-1;for(let h=0;h<a&&o<0;h+=1)for(let a=0;a<e;a+=1)if(1===t[h*e+a]){r=a,o=h;break}if(r<0)return[];const i=[];let l=r,s=o,d=6;const c=e*a*4;for(let h=0;h<c;h+=1){let t=!1;for(let e=1;e<=8;e+=1){const a=(d+e)%8,[r,o]=KS[a],c=l+r,h=s+o;if(n(c,h)){i.push([l,s]),d=(a+4)%8,l=c,s=h,t=!0;break}}if(!t){i.push([l,s]);break}if(l===r&&s===o&&i.length>1)break}return i}(t,e,a);if(r.length<3)return ZS();const o=.012*Math.max(e,a);let i=jS(r,o),l=o;for(;i.length>40;)l*=1.6,i=jS(r,l);return i.length<3?ZS():i.map(([t,n])=>({x:Math.min(1,Math.max(0,t/e)),y:Math.min(1,Math.max(0,n/a))}))}function JS(t){const e=t.src,a=GS.get(e);if(a)return a.map(t=>({...t}));const n=function(t){const e=t.naturalWidth||t.width,a=t.naturalHeight||t.height;if(!e||!a)return null;const n=Math.min(1,256/Math.max(e,a)),r=Math.max(1,Math.round(e*n)),o=Math.max(1,Math.round(a*n)),i=document.createElement("canvas");i.width=r,i.height=o;const l=i.getContext("2d",{willReadFrequently:!0});if(!l)return null;let s;l.drawImage(t,0,0,r,o);try{s=l.getImageData(0,0,r,o).data}catch{return null}const d=new Uint8Array(r*o);let c=0;for(let h=0;h<d.length;h+=1)s[4*h+3]>=128&&(d[h]=1,c+=1);return{mask:d,width:r,height:o,foreground:c}}(t);if(!n)return ZS();const r=XS(n.mask,n.width,n.height);return GS.set(e,r),r.map(t=>({...t}))}function YS(t){return"paragraph"===t.type?{...t,runs:t.runs.map(t=>({...t,styles:t.styles?{...t.styles}:void 0,image:t.image?{...t.image}:void 0,field:t.field?{...t.field}:void 0,revision:t.revision?{...t.revision}:void 0,footnoteReference:t.footnoteReference?{...t.footnoteReference}:void 0,endnoteReference:t.endnoteReference?{...t.endnoteReference}:void 0})),style:t.style?{...t.style}:void 0,list:t.list?{...t.list}:void 0}:{...t,style:t.style?{...t.style,defaultCellMargins:t.style.defaultCellMargins?{...t.style.defaultCellMargins}:void 0,floating:t.style.floating?{...t.style.floating}:void 0,revisionXml:t.style.revisionXml?[...t.style.revisionXml]:void 0}:void 0,tblGridChangeXml:t.tblGridChangeXml,rows:t.rows.map(t=>({...t,style:t.style?{...t.style,revisionXml:t.style.revisionXml?[...t.style.revisionXml]:void 0}:void 0,cells:t.cells.map(t=>({...t,colSpan:t.colSpan??void 0,rowSpan:t.rowSpan??void 0,vMerge:t.vMerge??void 0,style:t.style?{...t.style,revisionXml:t.style.revisionXml?[...t.style.revisionXml]:void 0}:void 0,blocks:t.blocks.map(t=>({...t,runs:t.runs.map(t=>({...t,styles:t.styles?{...t.styles}:void 0,image:t.image?{...t.image}:void 0,field:t.field?{...t.field}:void 0,revision:t.revision?{...t.revision}:void 0,footnoteReference:t.footnoteReference?{...t.footnoteReference}:void 0,endnoteReference:t.endnoteReference?{...t.endnoteReference}:void 0})),style:t.style?{...t.style}:void 0,list:t.list?{...t.list}:void 0}))}))}))}}function QS(t){var e,a,n,r,o,i;return{...t,blocks:t.blocks.map(YS),header:null==(e=t.header)?void 0:e.map(YS),firstPageHeader:null==(a=t.firstPageHeader)?void 0:a.map(YS),evenPageHeader:null==(n=t.evenPageHeader)?void 0:n.map(YS),footer:null==(r=t.footer)?void 0:r.map(YS),firstPageFooter:null==(o=t.firstPageFooter)?void 0:o.map(YS),evenPageFooter:null==(i=t.evenPageFooter)?void 0:i.map(YS)}}function _S(t){return{...t,blocks:t.blocks.map(YS)}}function $S(t){var e,a;if(!t)return;const n={};for(const[r,o]of Object.entries(t.items))n[r]=_S(o);return{items:n,settings:t.settings?{...t.settings}:void 0,separator:null==(e=t.separator)?void 0:e.map(YS),continuationSeparator:null==(a=t.continuationSeparator)?void 0:a.map(YS)}}function tA(t){return{...t,blocks:t.blocks.map(YS)}}function eA(t){var e,a;if(!t)return;const n={};for(const[r,o]of Object.entries(t.items))n[r]=tA(o);return{items:n,settings:t.settings?{...t.settings}:void 0,separator:null==(e=t.separator)?void 0:e.map(YS),continuationSeparator:null==(a=t.continuationSeparator)?void 0:a.map(YS)}}function aA(t){var e;return{...t,document:{...t.document,sections:null==(e=t.document.sections)?void 0:e.map(QS),footnotes:$S(t.document.footnotes),endnotes:eA(t.document.endnotes)},selection:{anchor:{...t.selection.anchor},focus:{...t.selection.focus}},activeSectionIndex:t.activeSectionIndex??0,activeZone:t.activeZone??"main",activeFootnoteId:t.activeFootnoteId}}function nA(t){const{state:e,logger:a,applyState:n,applyTransactionalState:r,applySelectionAwareTextCommand:o,applySelectionAwareParagraphCommand:i,applyTableAwareParagraphEdit:l,focusInput:s,clearPreferredColumn:d,resetTransactionGrouping:c,toolbarStyleState:h,selectionCollapsed:p,selectedImageRun:u}=t,f=()=>(()=>{const t=ra(e);return _e(e).slice(t.startIndex,t.endIndex+1)})().some(t=>Boolean(t.list)),g=()=>{const t=e.selection.focus.paragraphId;return _e(e).find(e=>e.id===t)??null},m=()=>{const t=e.selection,a=Je(e),n=Xe(e.document,t.anchor.paragraphId,a),r=Xe(e.document,t.focus.paragraphId,a);return n&&r&&n.blockIndex===r.blockIndex?` [table b${n.blockIndex} r${n.rowIndex}:c${n.cellIndex}→r${r.rowIndex}:c${r.cellIndex}]`:""},v=(t,e)=>{d(),c(),i(a=>iS(a,t,e)),s()},b=()=>"main"===(e.activeZone??"main"),y=t=>{const a=ES(e);p()&&!a||(d(),c(),r(e=>function(t,e){const a=ra(t);if(!a.isCollapsed)return aS(t,"link",e);const n=_e(t)[a.startIndex];if(!n)return t;const r=Mw(n,a.startParagraphOffset);if(!r)return t;const o=aS(CS(t,{anchor:Ie(n,r.startOffset),focus:Ie(n,r.endOffset)}),"link",e),i=_e(o)[a.startIndex];return i?{...o,selection:{anchor:Ie(i,r.startOffset),focus:Ie(i,r.endOffset)}}:o}(e,t),{mergeKey:"link"}),s())};return{applyBooleanStyleCommand:t=>{if(p())return;const n=e.selection;a.info(`toggleStyle:${t} at ${n.anchor.paragraphId}:${n.anchor.runId}[${n.anchor.offset}..${n.focus.offset}]${m()}`),d(),c(),o(e=>_w(e,t)),s()},applyValueStyleCommand:(t,n)=>{if(p())return;const r=e.selection;a.info(`setStyle:${t}=${JSON.stringify(n)} at ${r.anchor.paragraphId}:${r.anchor.runId}[${r.anchor.offset}..${r.focus.offset}]${m()}`),d(),c(),o(e=>aS(e,t,n)),s()},applyChangeTextCaseCommand:t=>{p()||(d(),c(),o(e=>eS(e,t)),s())},applyClearFormattingCommand:()=>{p()||(d(),c(),o(t=>function(t){const e=ra(t);if(e.isCollapsed)return t;const a=_e(t).map((t,a)=>a<e.startIndex||a>e.endIndex?t:Lw(t,a===e.startIndex?e.startParagraphOffset:0,a===e.endIndex?e.endParagraphOffset:Ae(t),t=>{var e;const a=null==(e=t.styles)?void 0:e.link,n=null!=a&&""!==a?{link:a}:{};return{...t,styles:n}}));return Cw(t,a,zw(a,e))}(t)),s())},applyParagraphStyleCommand:v,toggleParagraphFlagCommand:t=>{const e=!h()[t];v(t,!!e||null)},applyParagraphListCommand:t=>{d(),c(),i(e=>function(t,e){const a=ra(t),n=_e(t),r=a.startIndex,o=a.endIndex,i=n.slice(r,o+1),l=i.length>0&&i.every(t=>{var a;return(null==(a=t.list)?void 0:a.kind)===e}),s=n.map((t,a)=>{var n,i,s;if(a<r||a>o)return ew(t);const d=ew(t);return l?(delete d.list,d):(d.list={kind:e,level:(null==(n=t.list)?void 0:n.level)??0,format:null==(i=t.list)?void 0:i.format,startAt:null==(s=t.list)?void 0:s.startAt},d)});return Cw(t,s,zw(s,a))}(e,t)),s()},handleListFormatChange:t=>{d(),c(),i(e=>function(t,e){const a=ra(t),n=_e(t).map((t,n)=>n<a.startIndex||n>a.endIndex?ew(t):t.list?{...ew(t),list:{...t.list,format:e||void 0}}:ew(t));return Cw(t,n,zw(n,a))}(e,t)),s()},handleListStartAtChange:t=>{d(),c(),i(e=>function(t,e){const a=ra(t),n=_e(t).map((t,n)=>n<a.startIndex||n>a.endIndex?ew(t):t.list?{...ew(t),list:{...t.list,startAt:null!==e?e:void 0}}:ew(t));return Cw(t,n,zw(n,a))}(e,t)),s()},applyInsertSectionBreakCommand:t=>{d(),c(),n(function(t,e){const a=na(t.selection)?t:Rw(t),{paragraph:n,offset:r}=Ew(a),o=We(a.document),i=Je(a);if("main"!==Ye(a))return t;const l=o[i];if(!l)return t;const s=l.blocks.findIndex(t=>"paragraph"===t.type&&t.id===n.id);if(-1===s)return t;const d=l.blocks.slice(0,s),c=l.blocks.slice(s+1),h=fw(n,xw(n,0,r),yw(n,r)),p=xw(n,r,Ae(n)),u=p.length>0?mw(n,p.map(t=>({text:t.text,styles:t.styles}))):(()=>{const t=ba("");return t.style=n.style?{...n.style}:void 0,t.list=n.list?{...n.list}:void 0,t})(),f={id:`section:${Math.random().toString(36).slice(2,9)}`,blocks:[u,...c],pageSettings:{...l.pageSettings},header:l.header?rw(l.header):void 0,footer:l.footer?rw(l.footer):void 0,breakType:e},g={...l,blocks:[...d,h]},m=[...o.slice(0,i),g,f,...o.slice(i+1)];return{...a,document:{...a.document,sections:m},activeSectionIndex:i+1,selection:Vw(Ie(u,0))}}(e,t)),s()},applyInsertPageBreakCommand:()=>{d(),c(),r(t=>l(t,t=>oS(t))),s()},canInsertFootnoteCommand:b,applyInsertFootnoteCommand:()=>{b()&&(d(),c(),r(t=>FS(t)),s())},handleStyleChange:t=>{d(),c(),i(e=>function(t,e){return iS(t,"styleId",e)}(e,t||null)),s()},applyUpdateSectionSettingsCommand:(t,a)=>{d(),c(),n(function(t,e,a){var n;const r=We(t.document);if(e<0||e>=r.length)return t;const o=[...r];return o[e]={...o[e],...a,pageSettings:{...o[e].pageSettings,...a.pageSettings??{},margins:{...o[e].pageSettings.margins,...(null==(n=a.pageSettings)?void 0:n.margins)??{}}}},{...t,document:{...t.document,sections:o}}}(e,t,a)),s()},applyToggleTrackChangesCommand:()=>{d(),c(),n(function(t){return{...t,trackChangesEnabled:!t.trackChangesEnabled}}(e)),s()},applyToggleShowMarginsCommand:()=>{n({...e,showMargins:!e.showMargins}),s()},applyToggleShowParagraphMarksCommand:()=>{n({...e,showParagraphMarks:!e.showParagraphMarks}),s()},applyAcceptRevisionsCommand:()=>{d(),c(),n(function(t){var e;const a=ra(t),n=_e(t),r=new Set;for(let i=a.startIndex;i<=a.endIndex;i+=1){const t=n[i],o=xw(t,i===a.startIndex?a.startParagraphOffset:0,i===a.endIndex?a.endParagraphOffset:Ae(t));for(const a of o)(null==(e=a.revision)?void 0:e.id)&&r.add(a.revision.id)}let o=t;for(const i of r)o=RS(o,i);return o}(e)),s()},applyRejectRevisionsCommand:()=>{d(),c(),n(function(t){var e;const a=ra(t),n=_e(t),r=new Set;for(let i=a.startIndex;i<=a.endIndex;i+=1){const t=n[i],o=xw(t,i===a.startIndex?a.startParagraphOffset:0,i===a.endIndex?a.endParagraphOffset:Ae(t));for(const a of o)(null==(e=a.revision)?void 0:e.id)&&r.add(a.revision.id)}let o=t;for(const i of r)o=LS(o,i);return o}(e)),s()},applyLinkCommand:y,promptForLink:()=>{const a=ES(e)??"";p()&&!a||t.openLinkDialog(a)},removeLinkCommand:()=>{y(null)},applyImageAltCommand:t=>{u()&&(d(),c(),r(e=>function(t,e){const a=qw(t);if(!(null==a?void 0:a.run.image))return t;const n=_e(t).map((t,n)=>n!==a.paragraphIndex?ew(t):{...ew(t),runs:t.runs.map(t=>t.id===a.run.id&&t.image?{...t,image:{...t.image,alt:e??void 0}}:tw(t))});return Cw(t,n,zw(n,ra(t)))}(e,t),{mergeKey:"imageAlt"}),s())},promptForImageAlt:()=>{var e;const a=u();if(!a)return;const n=(null==(e=a.run.image)?void 0:e.alt)??"";t.openImageAltDialog(n)},applyImageCaptionCommand:e=>{u()&&(d(),c(),r(a=>Hw(a,e,t.imageCaptionLabel()),{mergeKey:"imageCaption"}),s())},promptForImageCaption:()=>{u()&&t.openImageCaptionDialog(Ww(e)??"")},handleListTab:t=>!Xe(e.document,e.selection.focus.paragraphId,Je(e))&&(!!f()&&(d(),c(),i(e=>"indent"===t?function(t){const e=ra(t),a=_e(t).map((t,a)=>a<e.startIndex||a>e.endIndex?ew(t):t.list?vw(t,(t.list.level??0)+1):ew(t));return Cw(t,a,zw(a,e))}(e):lS(e)),s(),!0)),handleListEnter:()=>{const t=g();return!!(null==t?void 0:t.list)&&(d(),c(),p()&&0===Se(t).length?i(t=>function(t){const e=ra(t),a=_e(t).map((t,a)=>a<e.startIndex||a>e.endIndex?ew(t):bw(t));return Cw(t,a,zw(a,e))}(t)):r(t=>l(t,t=>function(t){const e=na(t.selection)?t:Rw(t),{paragraph:a,index:n,offset:r}=Ew(e),o=fw(a,xw(a,0,r),yw(a,r)),i=xw(a,r,Ae(a)),l=i.length>0?mw(a,i.map(t=>({text:t.text,styles:t.styles}))):(()=>{const t=ba("");return t.style=a.style?{...a.style}:void 0,t.list=aw(a.list),t})(),s=_e(e);return Cw(e,[...nw(s.slice(0,n)),o,l,...nw(s.slice(n+1))],Vw(Ie(l,0)))}(t)),{mergeKey:"splitListItem"}),s(),!0)},handleListBoundaryBackspace:t=>{const a=g();if(!(null==a?void 0:a.list)||!p())return!1;return 0===Te(a,e.selection.focus)&&(d(),c(),i(t=>lS(t)),t.currentTarget.value="",s(),!0)}}}function rA(t){return/[\p{L}\p{N}_]/u.test(t)}function oA(t,e){if(0===t.length)return{start:0,end:0};const a=Math.max(0,Math.min(e,t.length)),n=a===t.length?Math.max(0,a-1):a,r=t[n];if(!r||!rA(r))return{start:a,end:Math.min(t.length,a+1)};let o=n,i=n+1;for(;o>0&&rA(t[o-1]);)o-=1;for(;i<t.length&&rA(t[i]);)i+=1;return{start:o,end:i}}class iA{constructor(){a(this,"bindings",new Map)}register(t){this.bindings.set(t.id,t)}unregister(t){this.bindings.delete(t)}getBindings(){return Array.from(this.bindings.values())}execute(t,e,a){var n;const r=t.ctrlKey||t.metaKey,o=t.key.toLowerCase();for(const i of this.bindings.values())if(i.key.toLowerCase()===o&&Boolean(i.ctrlOrMeta)===r&&Boolean(i.shift)===t.shiftKey&&Boolean(i.alt)===t.altKey){if(i.command&&a){if((null==(n=a.canExecuteCommand)?void 0:n.call(a,i.command))??!0)return a.executeCommand(i.command),t.preventDefault(),!0}if(!1!==i.execute(e,t))return t.preventDefault(),!0}return!1}}const lA=[{id:"selectAll",command:"selectAll",key:"a",ctrlOrMeta:!0,execute:t=>{const e=t.state(),a=_e(e);if(0===a.length)return!1;const n=a[0],r=a[a.length-1];return t.clearPreferredColumn(),t.applyState(CS(e,{anchor:Ie(n,0),focus:Ie(r,Se(r).length)})),t.focusInput(),!0}},{id:"editImageAlt",command:"editImageAlt",key:"a",ctrlOrMeta:!0,alt:!0,execute:t=>!!t.selectedImageRun()&&(t.commandsController.promptForImageAlt(),!0)},{id:"insertFootnote",command:"insertFootnote",key:"f",ctrlOrMeta:!0,alt:!0,execute:t=>(t.commandsController.applyInsertFootnoteCommand(),!0)},{id:"pastePlainText",command:"pastePlainText",key:"v",ctrlOrMeta:!0,shift:!0,execute:t=>(t.setForcePlainTextPaste(!0),t.focusInput(),!0)},{id:"bold",command:"bold",key:"b",ctrlOrMeta:!0,execute:t=>(t.commandsController.applyBooleanStyleCommand("bold"),!0)},{id:"italic",command:"italic",key:"i",ctrlOrMeta:!0,execute:t=>(t.commandsController.applyBooleanStyleCommand("italic"),!0)},{id:"underline",command:"underline",key:"u",ctrlOrMeta:!0,execute:t=>(t.commandsController.applyBooleanStyleCommand("underline"),!0)},{id:"link",command:"link",key:"k",ctrlOrMeta:!0,execute:t=>(t.commandsController.promptForLink(),!0)},{id:"orderedList",command:"orderedList",key:"7",ctrlOrMeta:!0,shift:!0,execute:t=>(t.commandsController.applyParagraphListCommand("ordered"),!0)},{id:"bulletList",command:"bulletList",key:"8",ctrlOrMeta:!0,shift:!0,execute:t=>(t.commandsController.applyParagraphListCommand("bullet"),!0)},{id:"find",command:"find",key:"f",ctrlOrMeta:!0,execute:t=>(t.toggleFindReplace(!0),!0)},{id:"replace",command:"replace",key:"h",ctrlOrMeta:!0,execute:t=>(t.toggleReplace(!0),!0)},{id:"undo",command:"undo",key:"z",ctrlOrMeta:!0,execute:t=>(t.performUndo(),!0)},{id:"redo",command:"redo",key:"z",ctrlOrMeta:!0,shift:!0,execute:t=>(t.performRedo(),!0)},{id:"redoAlternative",command:"redo",key:"y",ctrlOrMeta:!0,execute:t=>(t.performRedo(),!0)},{id:"pageBreak",command:"pageBreak",key:"Enter",ctrlOrMeta:!0,execute:t=>(t.clearPreferredColumn(),t.resetTransactionGrouping(),t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>oS(t))),t.focusInput(),!0)},{id:"lineBreak",command:"lineBreak",key:"Enter",shift:!0,execute:t=>(t.clearPreferredColumn(),t.resetTransactionGrouping(),t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>Xw(t,"\n"))),t.focusInput(),!0)},{id:"splitBlock",command:"splitBlock",key:"Enter",execute:t=>(t.commandsController.handleListEnter()||(t.clearPreferredColumn(),t.resetTransactionGrouping(),t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>rS(t))),t.focusInput()),!0)}];function sA(t){const e=new iA;lA.forEach(t=>e.register(t));return{handleKeyDown:a=>{const n=t.state();if(t.isReadOnly()){const t=a.key,e=t.toLowerCase(),n="ArrowLeft"===t||"ArrowRight"===t||"ArrowUp"===t||"ArrowDown"===t||"Home"===t||"End"===t||"PageUp"===t||"PageDown"===t,r="Shift"===t||"Control"===t||"Meta"===t||"Alt"===t,o=(a.ctrlKey||a.metaKey)&&("a"===e||"c"===e);return void(n||r||o||a.preventDefault())}const r=t.executeCommand?{executeCommand:(e,a)=>{var n;return null==(n=t.executeCommand)?void 0:n.call(t,e,a)},canExecuteCommand:(e,a)=>{var n;return null==(n=t.canExecuteCommand)?void 0:n.call(t,e,a)}}:void 0;if(!e.execute(a,t,r)){if((a.ctrlKey||a.metaKey)&&!a.altKey){if(("ArrowLeft"===a.key||"ArrowRight"===a.key)&&(a.preventDefault(),t.resetTransactionGrouping(),t.moveSelectionByWord("ArrowLeft"===a.key?"left":"right",a.shiftKey)))return void t.focusInput();if("Backspace"===a.key||"Delete"===a.key){if(a.preventDefault(),t.clearPreferredColumn(),t.resetTransactionGrouping(),!na(n.selection))return t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>Yw(t))),a.currentTarget.value="",void t.focusInput();const e=_e(n),r=e.findIndex(t=>t.id===n.selection.focus.paragraphId),o=e[r];if(!o)return a.currentTarget.value="",void t.focusInput();if("Backspace"===a.key&&o.list){if(0===Te(o,n.selection.focus))return t.applySelectionAwareParagraphCommand(t=>lS(t)),a.currentTarget.value="",void t.focusInput()}const i=n.selection.focus.offset,l=Se(o),s=oA(l,i);return"Backspace"===a.key?0===i||s.start===i?t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>Yw(t))):t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(CS(e,{anchor:Ie(o,s.start),focus:Ie(o,i)}),t=>Yw(t))):i>=l.length?t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>Qw(t))):s.end>i?t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(CS(e,{anchor:Ie(o,i),focus:Ie(o,s.end)}),t=>Yw(t))):t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>Qw(t))),a.currentTarget.value="",void t.focusInput()}}if("Home"===a.key||"End"===a.key){a.preventDefault(),t.resetTransactionGrouping();const e="Home"===a.key?"start":"end";return a.ctrlKey||a.metaKey?t.moveSelectionToDocumentBoundary(e,a.shiftKey):t.moveSelectionToParagraphBoundary(e,a.shiftKey),void t.focusInput()}if(!a.altKey||a.ctrlKey||a.metaKey||"ArrowUp"!==a.key&&"ArrowDown"!==a.key||(a.preventDefault(),t.resetTransactionGrouping(),t.clearPreferredColumn(),!t.moveSelectedImageByParagraph("ArrowUp"===a.key?-1:1)))switch(a.key){case"Backspace":return t.commandsController.handleListBoundaryBackspace(a)?void a.preventDefault():(a.preventDefault(),t.clearPreferredColumn(),t.resetTransactionGrouping(),t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>Yw(t))),a.currentTarget.value="",void t.focusInput());case"Delete":return a.preventDefault(),t.clearPreferredColumn(),t.resetTransactionGrouping(),t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>Qw(t))),a.currentTarget.value="",void t.focusInput();case"Tab":{if(t.commandsController.handleListTab(a.shiftKey?"outdent":"indent"))return void a.preventDefault();const e=t.resolveAdjacentTableCellPosition(n.document,n.selection.focus.paragraphId,a.shiftKey?-1:1);if(e)return a.preventDefault(),t.clearPreferredColumn(),t.resetTransactionGrouping(),t.applySelectionPreservingStructure({anchor:e,focus:e}),void t.focusInput();break}case"ArrowLeft":return a.preventDefault(),t.resetTransactionGrouping(),a.shiftKey?(t.clearPreferredColumn(),t.applyState(AS(n,-1))):(t.clearPreferredColumn(),t.applyState(kS(n))),void t.focusInput();case"ArrowRight":return a.preventDefault(),t.resetTransactionGrouping(),a.shiftKey?(t.clearPreferredColumn(),t.applyState(function(t){return AS(t,1)}(n))):(t.clearPreferredColumn(),t.applyState(VS(n))),void t.focusInput();case"ArrowUp":return a.preventDefault(),t.resetTransactionGrouping(),void(a.shiftKey?t.moveVerticalSelection(-1,!0)||(t.applyState(function(t){return IS(t,-1)}(n)),t.focusInput()):t.moveVerticalByBlock(-1)||(t.applyState(function(t){return SS(t,-1)}(n)),t.focusInput()));case"ArrowDown":return a.preventDefault(),t.resetTransactionGrouping(),void(a.shiftKey?t.moveVerticalSelection(1,!0)||(t.applyState(function(t){return IS(t,1)}(n)),t.focusInput()):t.moveVerticalByBlock(1)||(t.applyState(function(t){return SS(t,1)}(n)),t.focusInput()));default:return}}},registry:e}}function dA(t,e){return t.paragraph.runs.map(t=>t.text).join("")[e]??""}function cA(t){return" "===t||"\t"===t||"\n"===t}function hA(t,e,a){if(a.isCollapsed)return null;const n=e.get(t);return void 0===n||n<a.startIndex||n>a.endIndex?null:a.startIndex===a.endIndex?{start:a.startParagraphOffset,end:a.endParagraphOffset}:t===a.start.paragraphId?{start:a.startParagraphOffset,end:Number.POSITIVE_INFINITY}:t===a.end.paragraphId?{start:0,end:a.endParagraphOffset}:{start:0,end:Number.POSITIVE_INFINITY}}function pA(t,e){var a,n,r,o;const i=ra(e),l=[],s=t.surfaceRect,d=new Map(_e(e).map((t,e)=>[t.id,e]));let c=null,h=null;if(!i.isCollapsed&&i.startIndex===i.endIndex&&i.endParagraphOffset-i.startParagraphOffset===1){const e=t=>t.paragraphId===i.start.paragraphId&&t.startOffset===i.startParagraphOffset&&t.endOffset===i.endParagraphOffset,a=t.inlineImages.find(e)??t.floatingImages.find(e);if(a&&(c={paragraphId:a.paragraphId,startOffset:a.startOffset,endOffset:a.endOffset,left:a.left-s.left,top:a.top-s.top,width:a.width,height:a.height,rotation:a.rotation??0}),!c){const e=t=>t.paragraphId===i.start.paragraphId&&t.startOffset===i.startParagraphOffset&&t.endOffset===i.endParagraphOffset,a=t.floatingTextBoxes.find(e),n=a?void 0:t.inlineTextBoxes.find(e),r=a??n;r&&(h={paragraphId:r.paragraphId,startOffset:r.startOffset,endOffset:r.endOffset,left:r.left-s.left,top:r.top-s.top,width:r.width,height:r.height,rotation:r.rotation??0,floating:Boolean(a)})}}const p=Je(e),u=Xe(e.document,e.selection.anchor.paragraphId,p),f=Xe(e.document,e.selection.focus.paragraphId,p);let g=!1;if(u&&f&&u.blockIndex===f.blockIndex&&u.zone===f.zone&&(u.rowIndex!==f.rowIndex||u.cellIndex!==f.cellIndex)){const o=We(e.document)[p];let i;if(i="header"===u.zone?null==(a=null==o?void 0:o.header)?void 0:a[u.blockIndex]:"footer"===u.zone?null==(n=null==o?void 0:o.footer)?void 0:n[u.blockIndex]:null==(r=null==o?void 0:o.blocks)?void 0:r[u.blockIndex],i&&"table"===i.type){g=!0;const e=on(i),a=e.find(t=>t.rowIndex===u.rowIndex&&t.cellIndex===u.cellIndex),n=e.find(t=>t.rowIndex===f.rowIndex&&t.cellIndex===f.cellIndex);if(a&&n){const r=Math.min(a.visualRowIndex,n.visualRowIndex),o=Math.max(a.visualRowIndex+a.rowSpan-1,n.visualRowIndex+n.rowSpan-1),d=Math.min(a.visualColumnIndex,n.visualColumnIndex),c=Math.max(a.visualColumnIndex+a.colSpan-1,n.visualColumnIndex+n.colSpan-1),h=new Set;for(const a of t.paragraphs)if(a.tableCell&&a.tableCell.tableId===i.id){const t=e.find(t=>t.rowIndex===a.tableCell.rowIndex&&t.cellIndex===a.tableCell.cellIndex);if(t){const e=t.visualRowIndex<=o&&t.visualRowIndex+t.rowSpan-1>=r,n=t.visualColumnIndex<=c&&t.visualColumnIndex+t.colSpan-1>=d;if(e&&n){const e=`${t.rowIndex}:${t.cellIndex}`;h.has(e)||(h.add(e),l.push({left:a.tableCell.left-s.left,top:a.tableCell.top-s.top,width:a.tableCell.width,height:a.tableCell.height}))}}}}}}if(!(g||i.isCollapsed||c||h))for(const S of t.paragraphs){const t=hA(S.paragraphId,d,i);if(!t)continue;const e=Math.max(t.start,S.startOffset),a=Math.min(t.end,S.endOffset);if(!(e>=a))for(const n of S.lines){let t=Math.max(e,n.startOffset),r=Math.min(a,n.endOffset);for(;t<r&&cA(dA(S,t));)t+=1;for(;r>t&&cA(dA(S,r-1));)r-=1;if(t>=r)continue;const o=n.slots.find(e=>e.offset===t),i=n.slots.find(t=>t.offset===r)??n.slots[n.slots.length-1];if(!o||!i)continue;const d=0===S.startOffset&&n.startOffset===S.startOffset&&n.top>S.top,c=d?S.top:n.top,h=d?n.top+n.height-S.top:n.height;l.push({left:o.left-s.left+1,top:c-s.top,width:Math.max(1,i.left-o.left+1-1),height:h})}}const m=e.selection.focus.paragraphId,v=t.paragraphsById.get(m)??[],b=null==(o=v[0])?void 0:o.paragraph,y=function(t,e){if(0===t.length)return null;const a=t.find(t=>e>=t.startOffset&&e<=t.endOffset)??t[t.length-1],n=a.lines.flatMap(t=>t.slots);if(0===n.length)return{left:a.left,top:a.top,height:Math.max(18,a.height)};let r=n[0],o=Math.abs(e-r.offset);for(const l of n){const t=Math.abs(e-l.offset);t<o&&(r=l,o=t)}const i=a.lines[0];return 0===a.startOffset&&void 0!==i&&e>=i.startOffset&&e<=i.endOffset&&r.top>a.top?{left:r.left,top:a.top,height:r.top+r.height-a.top}:{left:r.left,top:r.top,height:r.height}}(v,b?Te(b,e.selection.focus):e.selection.focus.offset),M=((null==y?void 0:y.left)??s.left)-s.left,x=((null==y?void 0:y.top)??s.top)-s.top,w=Math.max(18,(null==y?void 0:y.height)??28);return{selectionBoxes:l,inputBox:{left:M,top:x,height:w},caretBox:{left:M,top:x,height:w,visible:v.length>0&&!g&&!c&&!h},selectedImageBox:c,selectedTextBoxBox:h}}function uA(t,e){if(0===e.length)return t;const a={...t};for(const n of e)delete a[n];return a}function fA(t){const[e,a]=y({}),[n,r]=y({}),[o,i]=y({left:0,top:0,height:28}),[l,s]=y([]),[d,c]=y([]),[h,p]=y(null),[u,f]=y(null),[g,m]=y({left:0,top:0,height:28,visible:!1}),[v,b]=y(null);let M=0;const w=(a="selection")=>{var r;const o=t.surfaceRef();if(!o)return s([]),c([]),p(null),f(null),void m(t=>({...t,visible:!1}));const l=Yd({surface:o,state:t.state,measuredBlockHeights:e(),measuredParagraphLayouts:n(),zoomFactor:null==(r=t.zoomFactor)?void 0:r.call(t)});if(!l)return s([]),c([]),p(null),f(null),void m(t=>({...t,visible:!1}));const d=pA(l,t.state);s(d.selectionBoxes),c(function(t,e){const a=e.document.comments;if(!a||0===a.order.length)return[];const n=t.surfaceRect,r=new Map(_e(e).map((t,e)=>[t.id,e])),o=[];for(const i of a.order){const e=a.items[i];if(!(null==e?void 0:e.start)||!(null==e?void 0:e.end))continue;const l=r.get(e.start.paragraphId),s=r.get(e.end.paragraphId);if(void 0!==l&&void 0!==s)for(const a of t.paragraphs){const t=r.get(a.paragraphId);if(void 0===t||t<l||t>s)continue;const d=t===l?e.start.offset:0,c=t===s?e.end.offset:Number.POSITIVE_INFINITY,h=Math.max(d,a.startOffset),p=Math.min(c,a.endOffset);if(!(h>=p))for(const e of a.lines){const t=Math.max(h,e.startOffset),a=Math.min(p,e.endOffset);if(t>=a)continue;const r=e.slots.find(e=>e.offset===t),l=e.slots.find(t=>t.offset===a)??e.slots[e.slots.length-1];r&&l&&o.push({commentId:i,left:r.left-n.left,top:e.top-n.top,width:Math.max(1,l.left-r.left),height:e.height})}}}return o}(l,t.state)),p(d.selectedImageBox),f(d.selectedTextBoxBox),i(d.inputBox),m(d.caretBox)},S=(t="selection")=>{const e=++M;queueMicrotask(()=>{e===M&&w(t)})};x(()=>{t.state.selection.anchor.paragraphId,t.state.selection.anchor.runId,t.state.selection.anchor.offset,t.state.selection.focus.paragraphId,t.state.selection.focus.runId,t.state.selection.focus.offset,S("selection")}),x(()=>{var e;t.state.document,t.state.activeSectionIndex,t.state.activeZone,(null==(e=t.isImporting)?void 0:e.call(t))||S("content-change")}),x(()=>{const e=t.viewportRef();if(!e)return;const a=()=>{S("scroll")},n=()=>{S("resize")};e.addEventListener("scroll",a,{passive:!0}),window.addEventListener("resize",n),T(()=>{e.removeEventListener("scroll",a),window.removeEventListener("resize",n)})});return{measuredBlockHeights:e,measuredParagraphLayouts:n,inputBox:o,selectionBoxes:l,commentHighlights:d,selectedImageBox:h,selectedTextBoxBox:u,caretBox:g,preferredColumnX:v,setPreferredColumnX:b,clearPreferredColumn:()=>b(null),requestInputBoxSync:S,scheduleDeferredLayoutMeasurement:(t,e={})=>(e.paragraphIds&&e.paragraphIds.length>0&&r(t=>uA(t,e.paragraphIds??[])),S(t),e.resolveWhenDone?Promise.resolve():null),stabilizeLayoutAfterImport:async()=>{a({}),r({}),await new Promise(t=>{var e;e=()=>t(),"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>e()):globalThis.setTimeout(e,16)}),S("import")},syncMeasuredLayoutMetrics:(t="content-change")=>(S(t),!1),syncInputBox:w,setMeasuredBlockHeights:a,setMeasuredParagraphLayouts:r,applyInvalidation:e=>{var n,o;if(!(null==(n=t.isImporting)?void 0:n.call(t))){if(e.dirtyAll||e.structureChanged)a({}),r({});else if(((null==(o=e.dirtyParagraphIds)?void 0:o.length)??0)>0){const t=e.dirtyParagraphIds??[];r(e=>uA(e,t))}S("content-change")}},onCleanupHook:()=>{M+=1}}}const gA="documents",mA="current-document";const vA=new class{constructor(){a(this,"db",null)}async getDB(){return this.db||(this.db=await(t={name:"oasis-editor-db",version:1,onUpgrade:t=>{t.objectStoreNames.contains(gA)||t.createObjectStore(gA)}},new Promise((e,a)=>{const n=indexedDB.open(t.name,t.version);n.onerror=()=>{var t;a(new Error(`Failed to open IndexedDB: ${null==(t=n.error)?void 0:t.message}`))},n.onsuccess=()=>{e(n.result)},n.onupgradeneeded=e=>{const a=n.result;t.onUpgrade(a,e.oldVersion,e.newVersion)}}))),this.db;var t}async saveDocument(t){const e=await this.getDB();await function(t,e,a,n){return new Promise((r,o)=>{try{const i=t.transaction([e],"readwrite").objectStore(e).put(n,a);i.onerror=()=>{var t;o(new Error(`Failed to put item in ${e}: ${null==(t=i.error)?void 0:t.message}`))},i.onsuccess=()=>{r()}}catch(i){o(i)}})}(e,gA,mA,t)}async loadDocument(){const t=await this.getDB();return await function(t,e,a){return new Promise((n,r)=>{try{const o=t.transaction([e],"readonly").objectStore(e).get(a);o.onerror=()=>{var t;r(new Error(`Failed to get item from ${e}: ${null==(t=o.error)?void 0:t.message}`))},o.onsuccess=()=>{n(o.result??null)}}catch(o){r(o)}})}(t,gA,mA)}async clearDocument(){const t=await this.getDB();await function(t,e,a){return new Promise((n,r)=>{try{const o=t.transaction([e],"readwrite").objectStore(e).delete(a);o.onerror=()=>{var t;r(new Error(`Failed to delete item from ${e}: ${null==(t=o.error)?void 0:t.message}`))},o.onsuccess=()=>{n()}}catch(o){r(o)}})}(t,gA,mA)}close(){this.db&&(this.db.close(),this.db=null)}};function bA(t){const[e,a]=y(""),[n,r]=y(""),[o,i]=y({matchCase:!1,wholeWord:!1}),[l,s]=y([]),[d,c]=y(-1),[h,p]=y(!1);x(A([()=>t.state.document,e,o],([t,e,a])=>{const n=function(t,e,a={}){if(!e)return[];const n=[],r=Ke(t),{matchCase:o=!1,wholeWord:i=!1}=a,l=o?"g":"gi";let s=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");i&&(s=`\\b${s}\\b`);const d=new RegExp(s,l);return r.forEach((t,e)=>{const a=Se(t);let r;for(d.lastIndex=0;null!==(r=d.exec(a));){const a=r.index,o=r.index+r[0].length;n.push({anchor:Ie(t,a),focus:Ie(t,o),paragraphIndex:e}),r.index===d.lastIndex&&d.lastIndex++}}),n}(t,e,a);s(n),0===n.length?c(-1):(d()>=n.length||-1===d())&&c(0)}));const u=e=>{const a=l()[e];a&&t.applyState(CS(t.state,{anchor:a.anchor,focus:a.focus}))};return{searchTerm:e,setSearchTerm:a,replaceTerm:n,setReplaceTerm:r,findOptions:o,setFindOptions:i,matches:l,currentIndex:d,findNext:()=>{const t=l().length;if(0===t)return;const e=(d()+1)%t;c(e),u(e)},findPrevious:()=>{const t=l().length;if(0===t)return;const e=(d()-1+t)%t;c(e),u(e)},replace:()=>{if(0===l().length||-1===d())return;const e=l()[d()];t.applyTransactionalState(t=>Xw(CS(t,{anchor:e.anchor,focus:e.focus}),n()),{mergeKey:"findReplace"})},replaceAll:()=>{const e=l();0!==e.length&&(t.applyTransactionalState(t=>{let a=t;for(let r=e.length-1;r>=0;r--){const t=e[r];a=CS(a,{anchor:t.anchor,focus:t.focus}),a=Xw(a,n())}return a},{mergeKey:"findReplaceAll"}),p(!1),t.focusInput())},isOpen:h,setIsOpen:p}}const yA=t=>t.cells.reduce((t,e)=>t+Math.max(1,e.colSpan??1),0),MA=t=>t.rows.reduce((t,e)=>Math.max(t,yA(e)),0),xA=(t,e)=>{let a=0;for(const n of t.cells){const t=Math.max(1,n.colSpan??1);if(e>=a&&e<a+t)return n;a+=t}return null},wA=t=>{for(const e of t.rows)for(const t of e.cells){if("continue"===t.vMerge)continue;const e=t.blocks[0];if(e)return e}return null},SA=(t,e,a)=>{const n=We(t);for(const r of n){const t=[...r.header||[],...r.blocks,...r.footer||[]];for(const n of t){if("table"!==n.type)continue;const t=n.rows.flatMap(t=>t.cells.filter(t=>"continue"!==t.vMerge&&t.blocks.length>0)),r=t.findIndex(t=>t.blocks.some(t=>t.id===e));if(-1===r)continue;const o=t[r+a],i=null==o?void 0:o.blocks[0];return i?Ie(i,0):null}}return null},AA=(t,e,a="main")=>{const n=Je(t),r=Pe(t.document),o=Math.max(0,Math.min(n,r.length-1)),i=r[o];if(!i)return t;const l=[...r];return l[o]="header"===a?{...i,header:e}:"footer"===a?{...i,footer:e}:{...i,blocks:e},{...t,document:{...t.document,sections:l}}};function IA(t,e){return t.visualRowIndex!==e.visualRowIndex?t.visualRowIndex-e.visualRowIndex:t.visualColumnIndex!==e.visualColumnIndex?t.visualColumnIndex-e.visualColumnIndex:0}function TA(t,e){const a=t.selection,n=Je(t),r=Xe(t.document,a.anchor.paragraphId,n),o=Xe(t.document,a.focus.paragraphId,n);if(!r||!o||r.blockIndex!==o.blockIndex||r.zone!==o.zone)return null;const i=e.getTargetBlocks(t,r.zone)[r.blockIndex];if(!i||"table"!==i.type)return null;const l=on(i),s=l.find(t=>t.rowIndex===r.rowIndex&&t.cellIndex===r.cellIndex),d=l.find(t=>t.rowIndex===o.rowIndex&&t.cellIndex===o.cellIndex);return s&&d?{anchorLocation:r,focusLocation:o,anchorCell:s,focusCell:d,tableBlock:i,tableLayout:l}:null}function CA(t){const e=(t,e)=>{const a=Pe(t.document),n=Je(t),r=a[Math.max(0,Math.min(n,a.length-1))];return r?"header"===e?r.header||[]:"footer"===e?r.footer||[]:r.blocks:[]},{resolveTableCellRangeSelection:a,resolveSelectedTableCells:n,resolveHorizontalTableCellRange:r,resolveVerticalTableCellRange:o}=function(t){return{resolveTableCellRangeSelection:e=>{var a,n,r,o,i;const l=e.selection,s=TA(e,t);if(!s||s.anchorLocation.rowIndex===s.focusLocation.rowIndex&&s.anchorLocation.cellIndex===s.focusLocation.cellIndex)return null==(a=t.logger)||a.debug(`resolveTableCellRangeSelection: no expansion (anchor=${l.anchor.paragraphId} focus=${l.focus.paragraphId})`),null;const d=Math.min(s.anchorLocation.rowIndex,s.focusLocation.rowIndex),c=Math.max(s.anchorLocation.rowIndex,s.focusLocation.rowIndex),h=Math.min(s.anchorLocation.cellIndex,s.focusLocation.cellIndex),p=Math.max(s.anchorLocation.cellIndex,s.focusLocation.cellIndex);null==(n=t.logger)||n.info(`resolveTableCellRangeSelection: expanding r${s.anchorLocation.rowIndex}:c${s.anchorLocation.cellIndex}->r${s.focusLocation.rowIndex}:c${s.focusLocation.cellIndex} (anchor=${l.anchor.paragraphId} focus=${l.focus.paragraphId}) range=[rows ${d}..${c}, cells ${h}..${p}]`);const u=IA(s.anchorCell,s.focusCell)<=0?s.anchorLocation:s.focusLocation,f=IA(s.anchorCell,s.focusCell)<=0?s.focusLocation:s.anchorLocation,g=null==(o=null==(r=s.tableBlock.rows[u.rowIndex])?void 0:r.cells[u.cellIndex])?void 0:o.blocks[0],m=null==(i=s.tableBlock.rows[f.rowIndex])?void 0:i.cells[f.cellIndex],v=null==m?void 0:m.blocks[m.blocks.length-1];return g&&v?{anchor:Ie(g,0),focus:Ie(v,Se(v).length)}:null},resolveSelectedTableCells:e=>{const a=TA(e,t);if(!a)return null;const n=Math.min(a.anchorCell.visualRowIndex,a.focusCell.visualRowIndex),r=Math.max(a.anchorCell.visualRowIndex+a.anchorCell.rowSpan-1,a.focusCell.visualRowIndex+a.focusCell.rowSpan-1),o=Math.min(a.anchorCell.visualColumnIndex,a.focusCell.visualColumnIndex),i=Math.max(a.anchorCell.visualColumnIndex+a.anchorCell.colSpan-1,a.focusCell.visualColumnIndex+a.focusCell.colSpan-1),l=a.tableLayout.filter(t=>t.visualRowIndex<=r&&t.visualRowIndex+t.rowSpan-1>=n&&t.visualColumnIndex<=i&&t.visualColumnIndex+t.colSpan-1>=o);return{blockIndex:a.anchorLocation.blockIndex,cells:l,zone:a.anchorLocation.zone}},resolveHorizontalTableCellRange:e=>{const a=TA(e,t);if(!a||a.anchorCell.visualRowIndex!==a.focusCell.visualRowIndex)return null;const n=IA(a.anchorCell,a.focusCell);if(0===n)return null;const r=n<=0?a.anchorLocation:a.focusLocation,o=n<=0?a.focusLocation:a.anchorLocation;return{blockIndex:a.anchorLocation.blockIndex,rowIndex:r.rowIndex,startCellIndex:r.cellIndex,endCellIndex:o.cellIndex,zone:a.anchorLocation.zone}},resolveVerticalTableCellRange:e=>{const a=TA(e,t);if(!a||a.anchorLocation.cellIndex!==a.focusLocation.cellIndex)return null;const n=Math.min(a.anchorCell.visualRowIndex,a.focusCell.visualRowIndex),r=Math.max(a.anchorCell.visualRowIndex,a.focusCell.visualRowIndex);return n===r?null:{blockIndex:a.anchorLocation.blockIndex,startRowIndex:n,endRowIndex:r,cellIndex:a.anchorLocation.cellIndex,zone:a.anchorLocation.zone}}}}({getTargetBlocks:e,logger:t.logger}),{canMergeSelectedTableCells:i,canSplitSelectedTableCell:l,canMergeSelectedTableRows:s,canMergeSelectedTable:d,canSplitSelectedTableCellVertically:c,canSplitSelectedTable:h,canEditSelectedTableRow:p,canEditSelectedTableColumn:u}=function(t){const e=e=>{const a=t.resolveHorizontalTableCellRange(e);return Boolean(a&&a.endCellIndex>a.startCellIndex)},a=e=>{var a;const n=Xe(e.document,e.selection.focus.paragraphId,Je(e));if(!n)return!1;const r=t.getTargetBlocks(e,n.zone)[n.blockIndex];if(!r||"table"!==r.type)return!1;const o=null==(a=r.rows[n.rowIndex])?void 0:a.cells[n.cellIndex];return Boolean(((null==o?void 0:o.colSpan)??1)>1)},n=e=>{var a;const n=t.resolveVerticalTableCellRange(e);if(!n)return!1;const r=t.getTargetBlocks(e,n.zone)[n.blockIndex];if(!r||"table"!==r.type)return!1;for(let t=n.startRowIndex;t<=n.endRowIndex;t+=1){const e=null==(a=r.rows[t])?void 0:a.cells[n.cellIndex];if(!e||"continue"===e.vMerge||1!==e.blocks.length)return!1}return!0},r=e=>{var a;const n=Xe(e.document,e.selection.focus.paragraphId,Je(e));if(!n)return!1;const r=t.getTargetBlocks(e,n.zone)[n.blockIndex];if(!r||"table"!==r.type)return!1;const o=null==(a=r.rows[n.rowIndex])?void 0:a.cells[n.cellIndex];return Boolean(((null==o?void 0:o.rowSpan)??1)>1&&"restart"===(null==o?void 0:o.vMerge))};return{canMergeSelectedTableCells:e,canSplitSelectedTableCell:a,canMergeSelectedTableRows:n,canMergeSelectedTable:t=>e(t)||n(t),canSplitSelectedTableCellVertically:r,canSplitSelectedTable:t=>a(t)||r(t),canEditSelectedTableRow:e=>{const a=Xe(e.document,e.selection.focus.paragraphId,Je(e));if(!a)return!1;const n=t.getTargetBlocks(e,a.zone)[a.blockIndex];return Boolean(n&&"table"===n.type)},canEditSelectedTableColumn:e=>{const a=Xe(e.document,e.selection.focus.paragraphId,Je(e));if(!a)return!1;const n=t.getTargetBlocks(e,a.zone)[a.blockIndex];return!(!n||"table"!==n.type)&&MA(n)>1}}}({getTargetBlocks:e,resolveHorizontalTableCellRange:r,resolveVerticalTableCellRange:o}),{mergeSelectedTableCells:f,mergeSelectedTableRows:g,mergeSelectedTable:m,splitSelectedTableCellVertically:v,splitSelectedTableCell:b,splitSelectedTable:y}=function(t){const e=e=>{const a=t.resolveHorizontalTableCellRange(e);if(!a)return e;const n=t.getTargetBlocks(e,a.zone).map(YS),r=n[a.blockIndex];if(!r||"table"!==r.type)return e;const o=r.rows[a.rowIndex];if(!o)return e;const i=o.cells.slice(a.startCellIndex,a.endCellIndex+1);if(i.length<2)return e;const l={...i[0],colSpan:i.reduce((t,e)=>t+Math.max(1,e.colSpan??1),0),blocks:i.flatMap(t=>t.blocks.map(t=>YS(t)))};o.cells.splice(a.startCellIndex,i.length,l);const s=l.blocks[0];return s?{...AA(e,n,a.zone),selection:{anchor:Ie(s,0),focus:Ie(s,0)}}:e},a=e=>{const a=t.resolveVerticalTableCellRange(e);if(!a)return e;const n=t.getTargetBlocks(e,a.zone).map(YS),r=n[a.blockIndex];if(!r||"table"!==r.type)return e;const o=[];for(let t=a.startRowIndex;t<=a.endRowIndex;t+=1){const n=r.rows[t],i=null==n?void 0:n.cells[a.cellIndex];if(!n||!i||"continue"===i.vMerge||1!==i.blocks.length)return e;o.push(i)}if(o.length<2)return e;const i=Math.max(1,o[0].colSpan??1);if(!o.every(t=>Math.max(1,t.colSpan??1)===i))return e;const l={...o[0],rowSpan:o.length,vMerge:"restart",blocks:o.flatMap(t=>t.blocks.map(t=>YS(t)))};r.rows[a.startRowIndex].cells[a.cellIndex]=l;for(let t=a.startRowIndex+1;t<=a.endRowIndex;t+=1){const e=Ma([ba("")],i);e.blocks=[],e.vMerge="continue",r.rows[t].cells[a.cellIndex]=e}const s=l.blocks[0];return s?{...AA(e,n,a.zone),selection:{anchor:Ie(s,0),focus:Ie(s,0)}}:e},n=e=>{var a;const n=Xe(e.document,e.selection.focus.paragraphId,Je(e));if(!n)return e;const r=t.getTargetBlocks(e,n.zone).map(YS),o=r[n.blockIndex];if(!o||"table"!==o.type)return e;const i=null==(a=o.rows[n.rowIndex])?void 0:a.cells[n.cellIndex],l=Math.max(1,(null==i?void 0:i.rowSpan)??1);if(!i||l<=1||"restart"!==i.vMerge)return e;i.rowSpan=void 0,i.vMerge=void 0;const s=Math.max(1,i.colSpan??1);for(let t=1;t<l;t+=1){const e=o.rows[n.rowIndex+t];if(!e)break;const a=Ma([ba("")],s);e.cells[n.cellIndex]=a}const d=i.blocks[0];return d?{...AA(e,r,n.zone),selection:{anchor:Ie(d,0),focus:Ie(d,0)}}:e},r=e=>{var a;const n=Xe(e.document,e.selection.focus.paragraphId,Je(e));if(!n)return e;const r=t.getTargetBlocks(e,n.zone).map(YS),o=r[n.blockIndex];if(!o||"table"!==o.type)return e;const i=o.rows[n.rowIndex],l=null==i?void 0:i.cells[n.cellIndex],s=Math.max(1,(null==l?void 0:l.colSpan)??1);if(!i||!l||s<=1)return e;const d=[{...l,colSpan:1,blocks:l.blocks.map(t=>YS(t))},...Array.from({length:s-1},()=>Ma([ba("")]))];i.cells.splice(n.cellIndex,1,...d);const c=null==(a=d[0])?void 0:a.blocks[0];return c?{...AA(e,r,n.zone),selection:{anchor:Ie(c,0),focus:Ie(c,0)}}:e};return{mergeSelectedTableCells:e,mergeSelectedTableRows:a,mergeSelectedTable:n=>t.canMergeSelectedTableCells(n)?e(n):t.canMergeSelectedTableRows(n)?a(n):n,splitSelectedTableCellVertically:n,splitSelectedTableCell:r,splitSelectedTable:e=>t.canSplitSelectedTableCellVertically(e)?n(e):t.canSplitSelectedTableCell(e)?r(e):e}}({getTargetBlocks:e,resolveHorizontalTableCellRange:r,resolveVerticalTableCellRange:o,canMergeSelectedTableCells:i,canMergeSelectedTableRows:s,canSplitSelectedTableCell:l,canSplitSelectedTableCellVertically:c}),{insertSelectedTableRow:M,deleteSelectedTableRow:x,insertSelectedTableColumn:w,deleteSelectedTableColumn:S}=function(t){return{insertSelectedTableRow:(e,a)=>{var n,r;const o=Xe(e.document,e.selection.focus.paragraphId,Je(e));if(!o)return e;const i=t.getTargetBlocks(e,o.zone).map(YS),l=i[o.blockIndex];if(!l||"table"!==l.type)return e;const s=l.rows[o.rowIndex];if(!s)return e;const d=Math.max(0,Math.min(l.rows.length,o.rowIndex+(a>0?1:0)));let c;if(l.rows.some(t=>t.cells.some(t=>Math.max(1,t.rowSpan??1)>1||void 0!==t.vMerge))){const t=on(l),a=t.find(t=>t.rowIndex===o.rowIndex&&t.cellIndex===o.cellIndex),r=t.filter(t=>t.rowIndex===o.rowIndex);c=xa((r.length>0?r:t.filter(t=>t.rowIndex===Math.max(0,o.rowIndex-1))).map(e=>{const a=t.find(t=>t.visualColumnIndex===e.visualColumnIndex&&t.visualRowIndex<d&&t.visualRowIndex+t.rowSpan>d);if(a){a.cell.rowSpan=Math.max(1,a.cell.rowSpan??1)+1,a.cell.vMerge="restart";const t=Ma([ba("")],e.colSpan);return t.blocks=[],t.vMerge="continue",t}return Ma([ba("")],e.colSpan)})),l.rows.splice(d,0,c);const s=(null==a?void 0:a.visualColumnIndex)??o.cellIndex,h=xA(c,s),p=(null==h?void 0:h.blocks[0])??(null==(n=c.cells.find(t=>"continue"!==t.vMerge&&t.blocks[0]))?void 0:n.blocks[0])??wA(l);return p?{...AA(e,i,o.zone),selection:{anchor:Ie(p,0),focus:Ie(p,0)}}:AA(e,i,o.zone)}c=xa(s.cells.map(t=>Ma([ba("")],Math.max(1,t.colSpan??1)))),l.rows.splice(d,0,c);const h=c.cells[Math.min(o.cellIndex,c.cells.length-1)],p=(null==h?void 0:h.blocks[0])??(null==(r=c.cells.find(t=>"continue"!==t.vMerge&&t.blocks[0]))?void 0:r.blocks[0])??wA(l);return p?{...AA(e,i,o.zone),selection:{anchor:Ie(p,0),focus:Ie(p,0)}}:AA(e,i,o.zone)},deleteSelectedTableRow:e=>{const a=Xe(e.document,e.selection.focus.paragraphId,Je(e));if(!a)return e;const n=t.getTargetBlocks(e,a.zone).map(YS),r=n[a.blockIndex];if(!r||"table"!==r.type)return e;if(r.rows.length<=1)return e;const o=r.rows[a.rowIndex];if(!o)return e;if(o.cells.some(t=>"continue"!==t.vMerge&&Math.max(1,t.rowSpan??1)>1))return e;const i=r.rows.some(t=>t.cells.some(t=>Math.max(1,t.rowSpan??1)>1||void 0!==t.vMerge)),l=i?on(r).find(t=>t.rowIndex===a.rowIndex&&t.cellIndex===a.cellIndex):null;if(i){const t=on(r);for(const e of t)e.visualRowIndex<a.rowIndex&&e.visualRowIndex+e.rowSpan>a.rowIndex&&(e.cell.rowSpan=Math.max(1,e.cell.rowSpan??1)-1,e.cell.rowSpan<=1?(e.cell.rowSpan=void 0,e.cell.vMerge=void 0):e.cell.vMerge="restart")}r.rows.splice(a.rowIndex,1);const s=r.rows[Math.min(a.rowIndex,r.rows.length-1)],d=s?xA(s,Math.min((null==l?void 0:l.visualColumnIndex)??a.cellIndex,Math.max(0,yA(s)-1))):null,c=(null==d?void 0:d.blocks[0])??wA(r);return c?{...AA(e,n,a.zone),selection:{anchor:Ie(c,0),focus:Ie(c,0)}}:AA(e,n,a.zone)},insertSelectedTableColumn:(e,a)=>{var n;const r=Xe(e.document,e.selection.focus.paragraphId,Je(e));if(!r)return e;const o=t.getTargetBlocks(e,r.zone).map(YS),i=o[r.blockIndex];if(!i||"table"!==i.type)return e;if(i.rows.some(t=>t.cells.some(t=>Math.max(1,t.colSpan??1)>1))){const t=on(i).find(t=>t.rowIndex===r.rowIndex&&t.cellIndex===r.cellIndex),n=((null==t?void 0:t.visualColumnIndex)??r.cellIndex)+(a>0?Math.max(1,(null==t?void 0:t.colSpan)??1):0);for(const e of i.rows){const t=[];let a=0,r=!1;for(const o of e.cells){const e=Math.max(1,o.colSpan??1);!r&&n<=a&&(t.push(Ma([ba("")])),r=!0),!r&&a<n&&n<a+e?(t.push({...o,colSpan:e+1}),r=!0):t.push(o),a+=e}r||t.push(Ma([ba("")])),e.cells=t}const l=i.rows[r.rowIndex],s=l?xA(l,n):null,d=(null==s?void 0:s.blocks[0])??wA(i);return d?{...AA(e,o,r.zone),selection:{anchor:Ie(d,0),focus:Ie(d,0)}}:AA(e,o,r.zone)}const l=Math.max(0,Math.min((null==(n=i.rows[0])?void 0:n.cells.length)??0,r.cellIndex+(a>0?1:0)));for(const t of i.rows)t.cells.splice(l,0,Ma([ba("")]));const s=i.rows[r.rowIndex],d=null==s?void 0:s.cells[l],c=(null==d?void 0:d.blocks[0])??wA(i);return c?{...AA(e,o,r.zone),selection:{anchor:Ie(c,0),focus:Ie(c,0)}}:AA(e,o,r.zone)},deleteSelectedTableColumn:e=>{var a;const n=Xe(e.document,e.selection.focus.paragraphId,Je(e));if(!n)return e;const r=t.getTargetBlocks(e,n.zone).map(YS),o=r[n.blockIndex];if(!o||"table"!==o.type)return e;if(MA(o)<=1)return e;if(o.rows.some(t=>t.cells.some(t=>Math.max(1,t.colSpan??1)>1))){const t=on(o).find(t=>t.rowIndex===n.rowIndex&&t.cellIndex===n.cellIndex),a=(null==t?void 0:t.visualColumnIndex)??n.cellIndex;for(const e of o.rows){const t=[];let n=0;for(const r of e.cells){const e=Math.max(1,r.colSpan??1);a>=n&&a<n+e?e>1&&t.push({...r,colSpan:e-1>1?e-1:void 0}):t.push(r),n+=e}e.cells=t}const i=o.rows[n.rowIndex],l=i&&xA(i,Math.min(a,Math.max(0,yA(i)-1))),s=(null==l?void 0:l.blocks[0])??wA(o);return s?{...AA(e,r,n.zone),selection:{anchor:Ie(s,0),focus:Ie(s,0)}}:AA(e,r,n.zone)}if((null==(a=o.rows[0])?void 0:a.cells.length)<=1)return e;for(const t of o.rows)t.cells.splice(n.cellIndex,1);const i=o.rows[n.rowIndex],l=null==i?void 0:i.cells[Math.min(n.cellIndex,i.cells.length-1)],s=(null==l?void 0:l.blocks[0])??wA(o);return s?{...AA(e,r,n.zone),selection:{anchor:Ie(s,0),focus:Ie(s,0)}}:AA(e,r,n.zone)}}}({getTargetBlocks:e}),{withExpandedTableCellSelection:A,applySelectionAwareTextCommand:I,applySelectionAwareParagraphCommand:T}=function(t){const e=e=>{const a=t.resolveTableCellRangeSelection(e);return a?t.applySelectionToStatePreservingStructure(e,a):e},a=(a,n)=>{t.applyTransactionalState(r=>{var o,i,l;const s=t.resolveSelectedTableCells(r);if(!s||s.cells.length<=1){const i=e(r);return i!==r&&(null==(o=t.logger)||o.info(`${n}: expanded selection to ${i.selection.anchor.paragraphId}[${i.selection.anchor.offset}]..${i.selection.focus.paragraphId}[${i.selection.focus.offset}]`)),a(i)}const{blockIndex:d,cells:c,zone:h}=s;null==(i=t.logger)||i.info(`${n}: multi-cell selection in table block ${d} (${c.length} cells) in zone ${h}`);const p=[],u=[];for(const t of c)p.push(...t.cell.blocks),u.push(t.cell.blocks.length);if(0===p.length)return r;const f={...r,document:Ta(p,void 0,void 0,void 0,void 0,r.document.assets),selection:{anchor:Ie(p[0],0),focus:Ie(p[p.length-1],Se(p[p.length-1]).length)}},g=_e(a(f)),m=t.getTargetBlocks(r,h),v=YS(m[d]);if(!v)return r;const b=m.map((t,e)=>e===d?v:t),y=v;let M=0;for(let t=0;t<c.length;t+=1){const e=c[t],a=u[t],n=g.slice(M,M+a);M+=a;const r=null==(l=y.rows[e.rowIndex])?void 0:l.cells[e.cellIndex];r&&(r.blocks=n)}return AA(r,b,h)})};return{withExpandedTableCellSelection:e,applySelectionAwareTextCommand:t=>{a(t,"applySelectionAwareTextCommand")},applySelectionAwareParagraphCommand:t=>{a(t,"applySelectionAwareParagraphCommand")}}}({applyTransactionalState:t.applyTransactionalState,applySelectionToStatePreservingStructure:t.applySelectionToStatePreservingStructure,getTargetBlocks:e,resolveTableCellRangeSelection:a,resolveSelectedTableCells:n,logger:t.logger});return{resolveTableCellRangeSelection:a,resolveHorizontalTableCellRange:r,resolveVerticalTableCellRange:o,canMergeSelectedTableCells:i,canSplitSelectedTableCell:l,canMergeSelectedTableRows:s,canMergeSelectedTable:d,canSplitSelectedTableCellVertically:c,canSplitSelectedTable:h,canEditSelectedTableRow:p,canEditSelectedTableColumn:u,mergeSelectedTableCells:f,mergeSelectedTableRows:g,mergeSelectedTable:m,splitSelectedTableCellVertically:v,splitSelectedTableCell:b,splitSelectedTable:y,insertSelectedTableRow:M,deleteSelectedTableRow:x,insertSelectedTableColumn:w,deleteSelectedTableColumn:S,getRowVisualWidth:yA,getTableVisualWidth:MA,findCellAtVisualColumn:xA,findFirstNavigableParagraphInTable:wA,updateBlocksInCurrentSection:AA,resolveAdjacentTableCellPosition:SA,applyTableAwareParagraphEdit:(t,a)=>((t,e,a)=>{var n;const r=Xe(t.document,t.selection.focus.paragraphId,Je(t));if(!r||t.selection.anchor.paragraphId!==t.selection.focus.paragraphId)return a(t);const o=r.zone,i=e(t,o),l=YS(i[r.blockIndex]);if(!l||"table"!==l.type)return a(t);const s=i.map((t,e)=>e===r.blockIndex?l:t),d=null==(n=l.rows[r.rowIndex])?void 0:n.cells[r.cellIndex];if(!d)return a(t);const c=a({...t,document:Ta(d.blocks,void 0,void 0,void 0,void 0,t.document.assets),selection:{anchor:{...t.selection.anchor},focus:{...t.selection.focus}}}),h=Ke(c.document).filter(t=>"paragraph"===t.type);return d.blocks.splice(0,d.blocks.length,...h),{...AA(t,s,o),selection:c.selection}})(t,e,a),withExpandedTableCellSelection:A,applySelectionAwareTextCommand:I,applySelectionAwareParagraphCommand:T,insertTableCommand:(e,a)=>{var n;null==(n=t.logger)||n.info(`insertTableCommand: ${e}x${a}`),t.applyTransactionalState(t=>function(t,e,a){const n=100/Math.max(1,a)+"%",r=[];for(let g=0;g<e;g+=1){const t=[];for(let e=0;e<a;e+=1)t.push({...Ma([ba("")]),style:{width:n}});r.push(xa(t))}const o={...wa(r),style:{width:"100%"}},i=ta(t,t.selection.focus),l=We(t.document),s=Je(t),d=Ye(t),c=t=>{const e=t.findIndex(t=>t.id===i.paragraphId||"paragraph"!==t.type&&He(t).some(t=>t.id===i.paragraphId));return-1===e?{nextBlocks:t,found:!1}:{nextBlocks:[...t.slice(0,e+1),o,...t.slice(e+1)],found:!0}},h=l[s];if(!h)return t;const p={...h};let u=!1;if("header"===d){const t=c(h.header??[]);p.header=t.nextBlocks,u=t.found}else if("footer"===d){const t=c(h.footer??[]);p.footer=t.nextBlocks,u=t.found}else{const t=c(h.blocks);p.blocks=t.nextBlocks,u=t.found}if(!u)return t;const f=[...l];return f[s]=p,{...t,document:{...t.document,sections:f},selection:Vw(Ie(o.rows[0].cells[0].blocks[0],0))}}(t,e,a),{mergeKey:"insertTable"}),t.focusInput()}}}function kA(t,e,a,n=0){const r=ve(me(e));if(!a)return r;const o=ol(e,a,n);return null!==o&&Number.isFinite(o)&&o>0?Math.min(r,o):r}function VA(t,e){let a=null;const n=(t,e,a)=>{const n=_e(t).find(t=>t.id===e);return n?{anchor:Ie(n,a),focus:Ie(n,a+1)}:null},r=(t,e)=>({...t,selection:{anchor:{...e.anchor},focus:{...e.focus}}}),o=o=>{var i;const l=a;if(!l)return;const s=(null==(i=e.zoomFactor)?void 0:i.call(e))??1,d=(o.clientX-l.startClientX)/s,c=(o.clientY-l.startClientY)/s,h=t.getMaxWidth(e.state,l.paragraphId),{width:p,height:u}=function(t,e,a,n,r){const o=by(t.handleDirection,"x"),i=by(t.handleDirection,"y"),l=0===o?t.startWidth:t.startWidth+e*o,s=0===i?t.startHeight:t.startHeight+a*i;let d=vy(l,my,r),c=vy(s,my);if(!n)return{width:d,height:c};const h=t.aspectRatio||1,p=0!==o;if(p&&0!==i){const e=d/t.startWidth,a=c/t.startHeight,n=Math.abs(e-1)>=Math.abs(a-1)?e:a;return d=vy(t.startWidth*n,my,r),c=vy(d/h,my),{width:d,height:c}}return p?(d=vy(d,my,r),c=vy(d/h,my),{width:d,height:c}):(c=vy(c,my),d=vy(c*h,my,r),c=vy(d/h,my),{width:d,height:c})}(l,d,c,o.shiftKey,h),f=n(e.state,l.paragraphId,l.paragraphOffset);f?e.applyState(t.applyResize(r(e.state,f),p,u,l.handleDirection)):e.logger.warn(`${t.label} resize:missing paragraph`,l)},i=()=>{const t=a;t&&e.updateHistoryState(a=>({...a,undoStack:[...a.undoStack,e.cloneState(t.initialState)],redoStack:[]})),l(),e.focusInput()},l=()=>{a=null,window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",i)};return{start:(l,s,d,c,h)=>{const p=n(h,l,s);if(!p)return;const u=t.getSelected(r(h,p));u&&(a={paragraphId:l,paragraphOffset:s,handleDirection:d,startClientX:c.clientX,startClientY:c.clientY,startWidth:u.width,startHeight:u.height,aspectRatio:u.width/u.height,initialState:e.cloneState(h)},window.addEventListener("mousemove",o),window.addEventListener("mouseup",i))},stop:l}}function EA(t,e){let a=null;const n=n=>{const r=a;if(!r)return;let o=((180*Math.atan2(n.clientY-r.centerY,n.clientX-r.centerX)/Math.PI+90)%360+360)%360;n.shiftKey&&(o=15*Math.round(o/15)%360);const i=((t,e,a)=>{const n=_e(t).find(t=>t.id===e);return n?{anchor:Ie(n,a),focus:Ie(n,a+1)}:null})(e.state,r.paragraphId,r.paragraphOffset);i?e.applyState(t.applyRotate(((t,e)=>({...t,selection:{anchor:{...e.anchor},focus:{...e.focus}}}))(e.state,i),o)):e.logger.warn(`${t.label} rotate:missing paragraph`,r)},r=()=>{const t=a;t&&e.updateHistoryState(a=>({...a,undoStack:[...a.undoStack,e.cloneState(t.initialState)],redoStack:[]})),o(),e.focusInput()},o=()=>{a=null,window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",r)};return{start:(t,o,i,l)=>{const s=i.currentTarget.closest(".oasis-editor-selection-overlay");if(!s)return;const d=s.getBoundingClientRect();a={paragraphId:t,paragraphOffset:o,centerX:d.left+d.width/2,centerY:d.top+d.height/2,initialState:e.cloneState(l)},window.addEventListener("mousemove",n),window.addEventListener("mouseup",r)},stop:o}}function RA(t){const[e,a]=y(!1),[n,r]=y(null),[o,i]=y({x:0,y:0}),[l,s]=y(null);let d=null,c=null,h=null;const p=t=>{const e=ra(t);if(e.isCollapsed||e.startIndex!==e.endIndex||e.endParagraphOffset-e.startParagraphOffset!==1)return null;const a=_e(t)[e.startIndex];if(!a)return null;let n=0;for(const r of a.runs){const o=n;if(n+=r.text.length,r.image&&1===r.text.length&&o===e.startParagraphOffset)return{paragraph:a,run:r,startOffset:o,width:r.image.width,height:r.image.height,src:Oe(t.document,r.image.src)}}return null},u=(e,a)=>t.resolvePositionAtSurfacePoint(e,a),f=()=>{h&&(h.remove(),h=null),document.body.style.cursor="",c=null,d=null,a(!1),r(null),s(null),window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",b)},g=VA({label:"image",getSelected:t=>p(t),applyResize:(t,e,a)=>function(t,e,a){const n=qw(t);if(!n)return t;const r=_e(t),{paragraphIndex:o,run:i}=n,l=r.map((t,n)=>n!==o?ew(t):{...ew(t),runs:t.runs.map(t=>t.id===i.id&&t.image?{...t,image:{...t.image,width:Math.max(24,Math.round(e)),height:Math.max(24,Math.round(a))}}:tw(t))});return Cw(t,l,zw(l,ra(t)))}(t,e,a),getMaxWidth:(e,a)=>kA(t.surfaceRef(),e.document,a,e.activeSectionIndex??0)},{state:t.state,applyState:t.applyState,updateHistoryState:t.updateHistoryState,cloneState:t.cloneState,focusInput:t.focusInput,logger:t.logger,zoomFactor:t.zoomFactor}),m=EA({label:"image",applyRotate:(t,e)=>Ow(t,e)},{state:t.state,applyState:t.applyState,updateHistoryState:t.updateHistoryState,cloneState:t.cloneState,focusInput:t.focusInput,logger:t.logger}),v=e=>{let n=d;if(!n){const r=c;if(!r)return;if(Math.abs(e.clientX-r.startClientX)+Math.abs(e.clientY-r.startClientY)<4)return;n={paragraphId:r.paragraphId,paragraphOffset:r.paragraphOffset,src:r.src,width:r.width,height:r.height,offsetX:r.offsetX,offsetY:r.offsetY},d=n,c=null,a(!0),h||(h=document.createElement("style"),h.setAttribute("data-oasis-image-drag-cursor",""),h.textContent="*, *::before, *::after { cursor: grabbing !important; }",document.head.appendChild(h)),t.logger.info(`image drag:start ${n.paragraphId}@${n.paragraphOffset} client=(${e.clientX},${e.clientY})`)}i({x:e.clientX,y:e.clientY}),r({...n}),s(u(e.clientX,e.clientY))},b=e=>{const a=d;if(a||c){if(a){const n=u(e.clientX,e.clientY);n?(t.logger.info(`image drag:done ${a.paragraphId} -> ${n.paragraphId}:${n.runId}[${n.offset}]`),t.applyTransactionalState(t=>Uw(t,n),{mergeKey:"moveImage"})):t.logger.warn(`image drag:cancel ${a.paragraphId} no target at (${e.clientX},${e.clientY})`)}f(),t.focusInput()}else t.focusInput()},M=(e,n,o,l)=>{const h=o.currentTarget,u=l?{left:l.left,top:l.top,width:l.width,height:l.height}:null==h?void 0:h.getBoundingClientRect();if(!u)return;const f=p(t.state);c={paragraphId:e,paragraphOffset:n,startClientX:o.clientX,startClientY:o.clientY,src:(null==f?void 0:f.src)??"",width:(null==f?void 0:f.width)??u.width,height:(null==f?void 0:f.height)??u.height,offsetX:o.clientX-u.left,offsetY:o.clientY-u.top},d=null,i({x:o.clientX,y:o.clientY}),a(!1),r(null),s(null),window.addEventListener("mousemove",v),window.addEventListener("mouseup",b)};return{dragging:e,draggedImageInfo:n,mousePos:o,dropTargetPos:l,getSelectedImageInfo:p,startImageDrag:M,stopImageDrag:()=>{f()},stopImageResize:g.stop,stopImageRotate:m.stop,handleImageMouseDown:(e,a,n)=>{n.preventDefault(),n.stopPropagation();const r=Ke(t.state.document).find(t=>t.id===e);r&&t.applyState(CS(t.state,{anchor:Ie(r,a),focus:Ie(r,a+1)})),M(e,a,n),t.focusInputAfterPointerSelection()},handleImageResizeHandleMouseDown:(e,a,n,r)=>{r.preventDefault(),r.stopPropagation(),g.start(e,a,n,r,t.state)},handleImageRotateHandleMouseDown:(e,a,n)=>{n.preventDefault(),n.stopPropagation(),m.start(e,a,n,t.state)}}}function LA(t){const e=t=>{const e=Fw(t);return(null==e?void 0:e.run.textBox)?{width:e.run.textBox.width,height:js(e.run.textBox,t,0)}:null},a=VA({label:"text box",getSelected:e,applyResize:(t,e,a,n)=>function(t,e,a,n={}){const r=Fw(t);if(!r||!r.run.textBox)return t;const o=n.handleDirection??"se",i=o.includes("n")||o.includes("s"),l=o.includes("w"),s=o.includes("n"),d=Math.max(24,Math.round(e)),c=Math.max(24,Math.round(a)),{paragraphIndex:h,run:p}=r,u=d-r.run.textBox.width,f=c-r.run.textBox.height,g=_e(t).map((t,e)=>e!==h?ew(t):{...ew(t),runs:t.runs.map(t=>{var e;if(t.id!==p.id||!t.textBox)return tw(t);const a=t.textBox,n={...a,width:d,height:c};return i&&(null==(e=a.body)?void 0:e.autoFit)&&(n.body={...a.body,autoFit:!1}),a.floating&&(n.floating=function(t,e,a,n,r){let o=t;if(n&&0!==e){const a=t.positionH;(null==a?void 0:a.align)||(o={...o,positionH:{...a??{},offset:((null==a?void 0:a.offset)??0)-9525*e}})}if(r&&0!==a){const t=o.positionV;(null==t?void 0:t.align)||(o={...o,positionV:{...t??{},offset:((null==t?void 0:t.offset)??0)-9525*a}})}return o}(a.floating,u,f,l,s)),{...t,textBox:n}})});return Cw(t,g,zw(g,ra(t)))}(t,e,a,{handleDirection:n}),getMaxWidth:(a,n)=>{const r=kA(t.surfaceRef(),a.document,n,a.activeSectionIndex??0),o=e(a);return o?Math.max(r,o.width):r}},{state:t.state,applyState:t.applyState,updateHistoryState:t.updateHistoryState,cloneState:t.cloneState,focusInput:t.focusInput,logger:t.logger,zoomFactor:t.zoomFactor}),n=EA({label:"text box",applyRotate:(t,e)=>Bw(t,e)},{state:t.state,applyState:t.applyState,updateHistoryState:t.updateHistoryState,cloneState:t.cloneState,focusInput:t.focusInput,logger:t.logger});return{handleTextBoxResizeHandleMouseDown:(e,n,r,o)=>{o.preventDefault(),o.stopPropagation(),a.start(e,n,r,o,t.state)},handleTextBoxRotateHandleMouseDown:(e,a,r)=>{r.preventDefault(),r.stopPropagation(),n.start(e,a,r,t.state)},stopTextBoxResize:a.stop,stopTextBoxRotate:n.stop}}const zA="http://schemas.openxmlformats.org/wordprocessingml/2006/main",NA="http://schemas.openxmlformats.org/package/2006/relationships",qA="http://schemas.openxmlformats.org/officeDocument/2006/relationships",OA="http://schemas.microsoft.com/office/word/2010/wordml";function PA(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function WA(t,e){return Number.isFinite(t)?Math.max(0,Math.round(t/96*1440)):e}function HA(t){return null!=t&&Number.isFinite(t)?Math.round(t/96*1440):null}function UA(t){return null!=t&&Number.isFinite(t)?Math.max(0,Math.round(20*t)):null}function FA(t,e="000000"){const a=null==t?void 0:t.trim().replace(/^#/,"");return a&&/^[0-9a-fA-F]{6}$/.test(a)?a.toUpperCase():e}function BA(t){if("end"===t.kind)return`<w:bookmarkEnd w:id="${t.wId}"/>`;const e=(void 0!==t.colFirst?` w:colFirst="${t.colFirst}"`:"")+(void 0!==t.colLast?` w:colLast="${t.colLast}"`:"");return`<w:bookmarkStart w:id="${t.wId}" w:name="${PA(t.name??"")}"${e}/>`}function GA(t){switch(t.kind){case"start":return`<w:commentRangeStart w:id="${t.wId}"/>`;case"end":return`<w:commentRangeEnd w:id="${t.wId}"/>`;case"reference":return`<w:r><w:commentReference w:id="${t.wId}"/></w:r>`}}const ZA=`xmlns:w="${zA}" xmlns:w14="${OA}" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml"`;function KA(t){const e=t.comments.map(({comment:t,wId:e,paraId:a})=>{const n=void 0!==t.date?` w:date="${new Date(t.date).toISOString().replace(/\.\d{3}Z$/,"Z")}"`:"",r=t.initials?` w:initials="${PA(t.initials)}"`:"";return`<w:comment w:id="${e}" w:author="${PA(t.author)}"${n}${r}><w:p w14:paraId="${a}">${o=t.text,`<w:r>${o.split("\n").map((t,e)=>`${e>0?"<w:br/>":""}<w:t xml:space="preserve">${PA(t)}</w:t>`).join("")}</w:r>`}</w:p></w:comment>`;var o}).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:comments ${ZA}>${e}</w:comments>`}function DA(t,e="000000"){if("none"===t.type||t.width<=0)return'w:val="nil"/>';return`w:val="${"dotted"===t.type?"dotted":"dashed"===t.type?"dashed":"single"}" w:sz="${Math.max(1,Math.round(8*t.width))}" w:space="0" w:color="${FA(t.color,e)}"/>`}function jA(t){const e=[["top",t.borderTop],["left",t.borderLeft],["bottom",t.borderBottom],["right",t.borderRight]].filter(t=>null!=t[1]).map(([t,e])=>`<w:${t} ${DA(e)}`);return e.length>0?`<w:pBdr>${e.join("")}</w:pBdr>`:""}const XA="6F6F6F";function JA(t,e){return void 0===e?"":e?`<w:${t}/>`:`<w:${t} w:val="0"/>`}function YA(t,e,a={}){if("number"==typeof e&&Number.isFinite(e))return`<w:${t} w:w="${UA(e)??0}" w:type="dxa"/>`;if("string"==typeof e){const a=e.trim();if("auto"===a)return`<w:${t} w:w="0" w:type="auto"/>`;if(a.endsWith("%")){const e=Number.parseFloat(a.slice(0,-1));if(Number.isFinite(e))return`<w:${t} w:w="${Math.round(50*e)}" w:type="pct"/>`}const n=Number.parseFloat(a);if(Number.isFinite(n))return`<w:${t} w:w="${Math.round(n)}" w:type="dxa"/>`}return a.fallbackAuto?`<w:${t} w:w="0" w:type="auto"/>`:""}function QA(t){return DA(t??{width:.75,type:"solid",color:`#${XA}`},XA)}function _A(t,e){var a,n,r,o,i,l,s,d,c,h;const p=Math.max(1,Math.floor(t.colSpan??1)),u=[],f=YA("tcW",(null==(a=t.style)?void 0:a.width)??e);f&&u.push(f),p>1&&u.push(`<w:gridSpan w:val="${p}"/>`),"restart"===t.vMerge?u.push('<w:vMerge w:val="restart"/>'):"continue"===t.vMerge&&u.push("<w:vMerge/>"),(null==(n=t.style)?void 0:n.shading)&&u.push(`<w:shd w:val="clear" w:color="auto" w:fill="${FA(t.style.shading,"FFFFFF")}"/>`);const g=JA("noWrap",null==(r=t.style)?void 0:r.noWrap);g&&u.push(g);const m=JA("tcFitText",null==(o=t.style)?void 0:o.fitText);if(m&&u.push(m),(null==(i=t.style)?void 0:i.headers)&&u.push(`<w:headers w:val="${PA(t.style.headers)}"/>`),null==(l=t.style)?void 0:l.verticalAlign){const e="middle"===t.style.verticalAlign?"center":t.style.verticalAlign;u.push(`<w:vAlign w:val="${e}"/>`)}(null==(s=t.style)?void 0:s.textDirection)&&u.push(`<w:textDirection w:val="${t.style.textDirection}"/>`),u.push(function(t){const e=t.style,a=null==e?void 0:e.padding,n=UA(a??(null==e?void 0:e.paddingTop)??0),r=UA(a??(null==e?void 0:e.paddingBottom)??0);return`<w:tcMar><w:top w:w="${n??0}" w:type="dxa"/><w:left w:w="${UA(a??(null==e?void 0:e.paddingLeft)??5.4)??0}" w:type="dxa"/><w:bottom w:w="${r??0}" w:type="dxa"/><w:right w:w="${UA(a??(null==e?void 0:e.paddingRight)??5.4)??0}" w:type="dxa"/>${void 0!==(null==e?void 0:e.paddingStart)?`<w:start w:w="${UA(e.paddingStart)??0}" w:type="dxa"/>`:""}${void 0!==(null==e?void 0:e.paddingEnd)?`<w:end w:w="${UA(e.paddingEnd)??0}" w:type="dxa"/>`:""}</w:tcMar>`}(t)),u.push(function(t){var e,a,n,r,o,i,l,s;const d=[`<w:top ${QA(null==(e=t.style)?void 0:e.borderTop)}`,`<w:left ${QA(null==(a=t.style)?void 0:a.borderLeft)}`,`<w:bottom ${QA(null==(n=t.style)?void 0:n.borderBottom)}`,`<w:right ${QA(null==(r=t.style)?void 0:r.borderRight)}`];return(null==(o=t.style)?void 0:o.borderStart)&&d.push(`<w:start ${QA(t.style.borderStart)}`),(null==(i=t.style)?void 0:i.borderEnd)&&d.push(`<w:end ${QA(t.style.borderEnd)}`),(null==(l=t.style)?void 0:l.borderTopLeftToBottomRight)&&d.push(`<w:tl2br ${QA(t.style.borderTopLeftToBottomRight)}`),(null==(s=t.style)?void 0:s.borderTopRightToBottomLeft)&&d.push(`<w:tr2bl ${QA(t.style.borderTopRightToBottomLeft)}`),`<w:tcBorders>${d.join("")}</w:tcBorders>`}(t));const v=JA("hideMark",null==(d=t.style)?void 0:d.hideMark);return v&&u.push(v),(null==(h=null==(c=t.style)?void 0:c.revisionXml)?void 0:h.length)&&u.push(...t.style.revisionXml),u.length>0?`<w:tcPr>${u.join("")}</w:tcPr>`:""}function $A(t,e){if(void 0===e||!Number.isFinite(e))return"";const a=Math.floor(e);return a>0?`<w:${t} w:val="${a}"/>`:""}function tI(t,e){const a="number"==typeof t?UA(t):"string"==typeof t?Number.parseFloat(t):null,n=null!==a&&Number.isFinite(a);if(!n&&!e)return"";const r=[];return n&&r.push(`w:val="${Math.round(a)}"`),r.push(`w:hRule="${e??"atLeast"}"`),`<w:trHeight ${r.join(" ")}/>`}function eI(t){var e,a,n,r,o,i,l,s,d;const c=[],h=$A("gridBefore",null==(e=t.style)?void 0:e.gridBefore);h&&c.push(h);const p=$A("gridAfter",null==(a=t.style)?void 0:a.gridAfter);p&&c.push(p);const u=YA("wBefore",null==(n=t.style)?void 0:n.widthBefore);u&&c.push(u);const f=YA("wAfter",null==(r=t.style)?void 0:r.widthAfter);f&&c.push(f);const g=YA("tblCellSpacing",null==(o=t.style)?void 0:o.cellSpacing);g&&c.push(g);const m=function(t){var e,a;return tI(null==(e=t.style)?void 0:e.height,null==(a=t.style)?void 0:a.heightRule)}(t);m&&c.push(m);const v=JA("cantSplit",null==(i=t.style)?void 0:i.cantSplit);v&&c.push(v),t.isHeader&&c.push("<w:tblHeader/>");const b=JA("hidden",null==(l=t.style)?void 0:l.hidden);return b&&c.push(b),(null==(d=null==(s=t.style)?void 0:s.revisionXml)?void 0:d.length)&&c.push(...t.style.revisionXml),c.length>0?`<w:trPr>${c.join("")}</w:trPr>`:""}function aI(t){var e,a,n,r,o,i,l,s,d,c,h,p,u,f,g;const m=[];if((null==(e=t.style)?void 0:e.styleId)&&m.push(`<w:tblStyle w:val="${PA(t.style.styleId)}"/>`),null==(a=t.style)?void 0:a.tblLook){const e=t.style.tblLook;m.push(`<w:tblLook w:firstRow="${e.firstRow?"1":"0"}" w:lastRow="${e.lastRow?"1":"0"}" w:firstColumn="${e.firstCol?"1":"0"}" w:lastColumn="${e.lastCol?"1":"0"}" w:noHBand="${e.noHBand?"1":"0"}" w:noVBand="${e.noVBand?"1":"0"}"/>`)}(null==(n=t.style)?void 0:n.altTitle)&&m.push(`<w:tblCaption w:val="${PA(t.style.altTitle)}"/>`),(null==(r=t.style)?void 0:r.altDescription)&&m.push(`<w:tblDescription w:val="${PA(t.style.altDescription)}"/>`);const v=(b=null==(o=t.style)?void 0:o.floating)&&0!==Object.keys(b).length?`<w:tblpPr ${Object.entries(b).map(([t,e])=>`w:${t}="${PA(e)}"`).join(" ")}/>`:"";var b;v&&m.push(v);const y=t.gridCols&&t.gridCols.length>0?t.gridCols.reduce((t,e)=>t+e,0):void 0;m.push(function(t,e=!0){return YA("tblW",t,{fallbackAuto:e})}((null==(i=t.style)?void 0:i.width)??y)),(null==(l=t.style)?void 0:l.align)&&m.push(`<w:jc w:val="${t.style.align}"/>`);const M=YA("tblCellSpacing",null==(s=t.style)?void 0:s.cellSpacing);M&&m.push(M);const x=function(t){if(!t)return"";const e=[],a=(t,a)=>{void 0!==a&&Number.isFinite(a)&&e.push(`<w:${t} w:w="${UA(a)??0}" w:type="dxa"/>`)};return a("top",t.top),a("left",t.left),a("bottom",t.bottom),a("right",t.right),a("start",t.start),a("end",t.end),e.length>0?`<w:tblCellMar>${e.join("")}</w:tblCellMar>`:""}(null==(d=t.style)?void 0:d.defaultCellMargins);x&&m.push(x);const w=YA("tblInd",null==(c=t.style)?void 0:c.indentLeft);w&&m.push(w),m.push(`<w:tblLayout w:type="${(null==(h=t.style)?void 0:h.layout)??"fixed"}"/>`);const S=JA("bidiVisual",null==(p=t.style)?void 0:p.bidiVisual);return S&&m.push(S),(null==(u=t.style)?void 0:u.tblOverlap)&&m.push(`<w:tblOverlap w:val="${PA(t.style.tblOverlap)}"/>`),(null==(g=null==(f=t.style)?void 0:f.revisionXml)?void 0:g.length)&&m.push(...t.style.revisionXml),`<w:tblPr>${m.join("")}</w:tblPr>`}function nI(t,e){const a=on(t),n=new Map(a.map(t=>[`${t.rowIndex}:${t.cellIndex}`,t])),r=t.rows.map((a,r)=>{const o=a.cells.map((a,o)=>{const i=n.get(`${r}:${o}`),l=i&&t.gridCols?t.gridCols.slice(i.visualColumnIndex,i.visualColumnIndex+Math.max(1,i.colSpan)).reduce((t,e)=>t+e,0):void 0,s=(a.blocks.length>0?a.blocks:[{id:"",type:"paragraph",runs:[{id:"",text:""}]}]).map(t=>e(t,a)).join(""),d="continue"===a.vMerge?"<w:p/>":s;return`<w:tc>${_A(a,l)}${d}</w:tc>`}).join("");return`<w:tr>${a.tblPrExXml??""}${eI(a)}${o}</w:tr>`}).join(""),o=t.gridCols?`<w:tblGrid>${t.gridCols.map(t=>`<w:gridCol w:w="${UA(t)??0}"/>`).join("")}${t.tblGridChangeXml??""}</w:tblGrid>`:"";return`<w:tbl>${aI(t)}${o}${r}</w:tbl>`}function rI(t){if(!t||0===t.length)return"";const e=t.map(t=>{const e=UA(t.position);if(null===e)return"";const a=[`w:val="${t.type}"`,`w:pos="${e}"`];return t.leader&&"none"!==t.leader?a.push(`w:leader="${t.leader}"`):"none"===t.leader&&a.push('w:leader="none"'),`<w:tab ${a.join(" ")}/>`}).filter(Boolean);return e.length>0?`<w:tabs>${e.join("")}</w:tabs>`:""}function oI(t){const e=[];if(t.align&&e.push(`<w:jc w:val="${t.align}"/>`),void 0!==t.spacingBefore||void 0!==t.spacingAfter||void 0!==t.lineHeight){const a=[],n=HA(t.spacingBefore),r=HA(t.spacingAfter),o=void 0!==t.lineHeight&&null!==t.lineHeight&&Number.isFinite(t.lineHeight),i="exact"===t.lineRule||"atLeast"===t.lineRule,l=o?i?WA(t.lineHeight,0):Math.round(240*t.lineHeight):null;null!==n&&a.push(`w:before="${n}"`),null!==r&&a.push(`w:after="${r}"`),null!==l&&a.push(`w:line="${l}"`),null!==l&&i&&a.push(`w:lineRule="${t.lineRule}"`),a.length>0&&e.push(`<w:spacing ${a.join(" ")}/>`)}if(void 0!==t.indentLeft||void 0!==t.indentRight||void 0!==t.indentFirstLine||void 0!==t.indentHanging){const a=[],n=HA(t.indentLeft),r=HA(t.indentRight),o=HA(t.indentFirstLine),i=HA(t.indentHanging);null!==n&&a.push(`w:left="${n}"`),null!==r&&a.push(`w:right="${r}"`),null!==o&&a.push(`w:firstLine="${o}"`),null!==i&&a.push(`w:hanging="${i}"`),a.length>0&&e.push(`<w:ind ${a.join(" ")}/>`)}const a=rI(t.tabs);a&&e.push(a),t.pageBreakBefore&&e.push("<w:pageBreakBefore/>"),t.keepWithNext&&e.push("<w:keepNext/>"),t.keepLinesTogether&&e.push("<w:keepLines/>"),!1===t.widowControl&&e.push('<w:widowControl w:val="0"/>'),t.contextualSpacing&&e.push("<w:contextualSpacing/>");const n=jA(t);return n&&e.push(n),t.shading&&e.push(`<w:shd w:val="clear" w:color="auto" w:fill="${FA(t.shading,"FFFFFF")}"/>`),t.textDirection&&e.push(`<w:textDirection w:val="${t.textDirection}"/>`),null!=t.outlineLevel&&e.push(`<w:outlineLvl w:val="${t.outlineLevel}"/>`),e.length>0?`<w:pPr>${e.join("")}</w:pPr>`:""}function iI(t,e,a,n){var r,o;const i=[],l=function(t,e){const a=qe(t.style,e);return{align:a.align,spacingBefore:a.spacingBefore,spacingAfter:a.spacingAfter,contextualSpacing:a.contextualSpacing,lineHeight:a.lineHeight,lineRule:a.lineRule,indentLeft:a.indentLeft,indentRight:a.indentRight,indentFirstLine:a.indentFirstLine,indentHanging:a.indentHanging,pageBreakBefore:a.pageBreakBefore,keepWithNext:a.keepWithNext,keepLinesTogether:a.keepLinesTogether,widowControl:a.widowControl,shading:a.shading,borderTop:a.borderTop,borderRight:a.borderRight,borderBottom:a.borderBottom,borderLeft:a.borderLeft,tabs:a.tabs,textDirection:a.textDirection,outlineLevel:a.outlineLevel}}(t,a),s=(null==(r=t.style)?void 0:r.align)??(null==n?void 0:n.align)??l.align;if((null==(o=t.style)?void 0:o.styleId)&&i.push(`<w:pStyle w:val="${PA(t.style.styleId)}"/>`),s&&i.push(`<w:jc w:val="${s}"/>`),void 0!==l.spacingBefore||void 0!==l.spacingAfter||void 0!==l.lineHeight){const t=[],e=HA(l.spacingBefore),a=HA(l.spacingAfter),n=void 0!==l.lineHeight&&null!==l.lineHeight&&Number.isFinite(l.lineHeight),r="exact"===l.lineRule||"atLeast"===l.lineRule,o=n?r?WA(l.lineHeight,0):Math.round(240*l.lineHeight):null;null!==e&&t.push(`w:before="${e}"`),null!==a&&t.push(`w:after="${a}"`),null!==o&&t.push(`w:line="${o}"`),null!==o&&r&&t.push(`w:lineRule="${l.lineRule}"`),t.length>0&&i.push(`<w:spacing ${t.join(" ")}/>`)}if(void 0!==l.indentLeft||void 0!==l.indentRight||void 0!==l.indentFirstLine||void 0!==l.indentHanging){const t=[],e=HA(l.indentLeft),a=HA(l.indentRight),n=HA(l.indentFirstLine),r=HA(l.indentHanging);null!==e&&t.push(`w:left="${e}"`),null!==a&&t.push(`w:right="${a}"`),null!==n&&t.push(`w:firstLine="${n}"`),null!==r&&t.push(`w:hanging="${r}"`),t.length>0&&i.push(`<w:ind ${t.join(" ")}/>`)}const d=rI(l.tabs);d&&i.push(d),l.pageBreakBefore&&i.push("<w:pageBreakBefore/>"),l.keepWithNext&&i.push("<w:keepNext/>"),l.keepLinesTogether&&i.push("<w:keepLines/>"),!1===l.widowControl&&i.push('<w:widowControl w:val="0"/>'),l.contextualSpacing&&i.push("<w:contextualSpacing/>");const c=jA(l);c&&i.push(c),l.shading&&i.push(`<w:shd w:val="clear" w:color="auto" w:fill="${FA(l.shading,"FFFFFF")}"/>`),l.textDirection&&i.push(`<w:textDirection w:val="${l.textDirection}"/>`),null!=l.outlineLevel&&i.push(`<w:outlineLvl w:val="${l.outlineLevel}"/>`);const h=e.get(t.id);return h&&i.push(`<w:numPr><w:ilvl w:val="${h.level}"/><w:numId w:val="${h.numId}"/></w:numPr>`),i.length>0?`<w:pPr>${i.join("")}</w:pPr>`:""}const lI=9525,sI={black:[0,0,0],blue:[0,0,255],cyan:[0,255,255],green:[0,128,0],magenta:[255,0,255],red:[255,0,0],yellow:[255,255,0],white:[255,255,255],darkBlue:[0,0,139],darkCyan:[0,139,139],darkGreen:[0,100,0],darkMagenta:[139,0,139],darkRed:[139,0,0],darkYellow:[184,134,11],darkGray:[169,169,169],lightGray:[211,211,211]},dI={ffff00:"yellow",fef08a:"yellow",ff0000:"red","00ff00":"green","0000ff":"blue","00ffff":"cyan",ff00ff:"magenta","000000":"black",ffffff:"white"};function cI(t){if(t in sI)return t;const e=t.trim().replace(/^#/,"").toLowerCase(),a=dI[e];if(a)return a;const n=function(t){const e=t.trim().replace(/^#/,"");return/^[0-9a-fA-F]{6}$/.test(e)?[Number.parseInt(e.slice(0,2),16),Number.parseInt(e.slice(2,4),16),Number.parseInt(e.slice(4,6),16)]:null}(t);if(!n)return"yellow";let r="yellow",o=Number.POSITIVE_INFINITY;for(const[i,l]of Object.entries(sI)){const t=(l[0]-n[0])**2+(l[1]-n[1])**2+(l[2]-n[2])**2;t<o&&(o=t,r=i)}return r}function hI(t){if(!t)return"";const e=[];if(t.bold&&e.push("<w:b/>","<w:bCs/>"),t.italic&&e.push("<w:i/>","<w:iCs/>"),t.underline){const a=t.underlineStyle??"single",n=t.underlineColor?` w:color="${PA(t.underlineColor.replace(/^#/,""))}"`:"";e.push(`<w:u w:val="${PA(a)}"${n}/>`)}if(t.strike&&e.push("<w:strike/>"),t.doubleStrike&&e.push("<w:dstrike/>"),t.smallCaps&&e.push("<w:smallCaps/>"),t.allCaps&&e.push("<w:caps/>"),t.hidden&&e.push("<w:vanish/>"),t.noProof&&e.push("<w:noProof/>"),t.webHidden&&e.push("<w:webHidden/>"),t.specVanish&&e.push("<w:specVanish/>"),t.textEffect&&e.push(`<w:effect w:val="${PA(t.textEffect)}"/>`),void 0!==t.characterScale&&null!==t.characterScale&&Number.isFinite(t.characterScale)&&e.push(`<w:w w:val="${Math.max(1,Math.round(t.characterScale))}"/>`),void 0!==t.characterSpacing&&null!==t.characterSpacing){const n=null!=(a=t.characterSpacing)&&Number.isFinite(a)?Math.round(20*a):null;null!==n&&e.push(`<w:spacing w:val="${n}"/>`)}var a;void 0!==t.baselineShift&&null!==t.baselineShift&&Number.isFinite(t.baselineShift)&&e.push(`<w:position w:val="${Math.round(2*t.baselineShift)}"/>`),void 0!==t.kerningThreshold&&null!==t.kerningThreshold&&Number.isFinite(t.kerningThreshold)&&e.push(`<w:kern w:val="${Math.max(0,Math.round(2*t.kerningThreshold))}"/>`);const n=function(t){switch(t){case"none":return"none";case"standard":return"standard";case"contextual":return"contextual";case"historical":return"historical";case"standardContextual":return"standardContextual";default:return null}}(t.ligatures);n&&e.push(`<w14:ligatures w14:val="${n}"/>`);const r=function(t){switch(t){case"proportional":return"proportional";case"tabular":return"tabular";default:return null}}(t.numberSpacing);r&&e.push(`<w14:numSpacing w14:val="${r}"/>`);const o=function(t){switch(t){case"lining":return"lining";case"oldStyle":return"oldStyle";default:return null}}(t.numberForm);o&&e.push(`<w14:numForm w14:val="${o}"/>`);const i=function(t){return"number"!=typeof t||t<1||t>20?null:(1<<t-1).toString(16).toUpperCase().padStart(8,"0")}(t.stylisticSet);if(i&&e.push(`<w14:stylisticSets w14:val="${i}"/>`),t.contextualAlternates&&e.push('<w14:cntxtAlts w14:val="1"/>'),t.superscript?e.push('<w:vertAlign w:val="superscript"/>'):t.subscript&&e.push('<w:vertAlign w:val="subscript"/>'),t.fontFamily&&e.push(`<w:rFonts w:ascii="${PA(t.fontFamily)}" w:hAnsi="${PA(t.fontFamily)}" w:cs="${PA(t.fontFamily)}"/>`),void 0!==t.fontSize&&null!==t.fontSize){const a=function(t){return null!=t&&Number.isFinite(t)?Math.round(t/96*72*2):null}(t.fontSize);null!==a&&e.push(`<w:sz w:val="${a}"/>`,`<w:szCs w:val="${a}"/>`)}if(t.color&&e.push(`<w:color w:val="${PA(t.color.replace(/^#/,""))}"/>`),t.highlight&&e.push(`<w:highlight w:val="${PA(cI(t.highlight))}"/>`),t.shading&&e.push(`<w:shd w:val="clear" w:color="auto" w:fill="${FA(t.shading,"FFFFFF")}"/>`),t.language){const a=[];t.language.value&&a.push(`w:val="${PA(t.language.value)}"`),t.language.eastAsia&&a.push(`w:eastAsia="${PA(t.language.eastAsia)}"`),t.language.bidi&&a.push(`w:bidi="${PA(t.language.bidi)}"`),a.length>0&&e.push(`<w:lang ${a.join(" ")}/>`)}return e.length>0?`<w:rPr>${e.join("")}</w:rPr>`:""}function pI(t){if(0===t.length)return"";var e;return`<w:t${/^\s|\s$/.test(e=t)||e.includes(" ")?' xml:space="preserve"':""}>${PA(t)}</w:t>`}function uI(t){if(0===t.length)return"<w:t></w:t>";let e="",a="";for(const n of t)"\n"!==n?"\t"!==n?"‑"!==n?""!==n?a+=n:(e+=pI(a),a="",e+="<w:softHyphen/>"):(e+=pI(a),a="",e+="<w:noBreakHyphen/>"):(e+=pI(a),a="",e+="<w:tab/>"):(e+=pI(a),a="",e+="<w:br/>");return e+=pI(a),e||"<w:t></w:t>"}function fI(t,e){return t??e?"1":"0"}function gI(t,e,a){const n=PA((null==e?void 0:e.relativeFrom)??a);if(null==e?void 0:e.align)return`<wp:${t} relativeFrom="${n}"><wp:align>${PA(e.align)}</wp:align></wp:${t}>`;return`<wp:${t} relativeFrom="${n}"><wp:posOffset>${(null==e?void 0:e.offset)??0}</wp:posOffset></wp:${t}>`}function mI(t){if(!t||t.length<3)return"";const e=t=>Math.round(21600*Math.min(1,Math.max(0,t))),a=(t,a)=>`<wp:${a} x="${e(t.x)}" y="${e(t.y)}"/>`,n=t[0];return`<wp:wrapPolygon edited="0">${[a(n,"start"),...t.slice(1).map(t=>a(t,"lineTo")),a(n,"lineTo")].join("")}</wp:wrapPolygon>`}function vI(t){const{cx:e,cy:a,floating:n,docPrId:r,docPrName:o,altAttr:i,graphicXml:l}=t,s=PA(o);if(!n)return`<w:drawing><wp:inline distT="0" distB="0" distL="0" distR="0"><wp:extent cx="${e}" cy="${a}"/><wp:effectExtent l="0" t="0" r="0" b="0"/><wp:docPr id="${r}" name="${s}"${i}/>${l}</wp:inline></w:drawing>`;const d=n.distT??0,c=n.distB??0,h=n.distL??0,p=n.distR??0,u=gI("positionH",n.positionH,"column"),f=gI("positionV",n.positionV,"paragraph"),g=function(t,e){switch(t){case"square":return'<wp:wrapSquare wrapText="bothSides"/>';case"tight":{const t=mI(e);return t?`<wp:wrapTight wrapText="bothSides">${t}</wp:wrapTight>`:'<wp:wrapTight wrapText="bothSides"/>'}case"through":{const t=mI(e);return t?`<wp:wrapThrough wrapText="bothSides">${t}</wp:wrapThrough>`:'<wp:wrapThrough wrapText="bothSides"/>'}case"topAndBottom":return"<wp:wrapTopAndBottom/>";default:return"<wp:wrapNone/>"}}(n.wrap,t.wrapPolygon);return`<w:drawing><wp:anchor distT="${d}" distB="${c}" distL="${h}" distR="${p}" simplePos="${fI(n.simplePos,!1)}" relativeHeight="${n.relativeHeight??0}" behindDoc="${fI(n.behindDoc,!1)}" locked="${fI(n.locked,!1)}" layoutInCell="${fI(n.layoutInCell,!0)}" allowOverlap="${fI(n.allowOverlap,!0)}"><wp:simplePos x="0" y="0"/>${u}${f}<wp:extent cx="${e}" cy="${a}"/><wp:effectExtent l="0" t="0" r="0" b="0"/>${g}<wp:docPr id="${r}" name="${s}"${i}/>${l}</wp:anchor></w:drawing>`}function bI(t,e,a,n){const r=a.images.find(t=>t.rId===e);if(!r)return null;const o=(parseInt(e.replace(/\D+/g,""),10)||0)+1,i=void 0!==r.alt?` descr="${PA(r.alt)}" title="${PA(r.alt)}"`:"",l=function(t){let e="";if(t.rotation){const a=Math.round(6e4*t.rotation);0!==a&&(e+=` rot="${a}"`)}return t.flipH&&(e+=' flipH="1"'),t.flipV&&(e+=' flipV="1"'),e}(r),s=function(t){if(!t)return"";const e=t=>t?Math.round(1e5*t):0,a=e(t.left),n=e(t.top),r=e(t.right),o=e(t.bottom);return 0===a&&0===n&&0===r&&0===o?"":`<a:srcRect l="${a}" t="${n}" r="${r}" b="${o}"/>`}(r.crop),d="tile"===r.fillMode?"<a:tile/>":"<a:stretch><a:fillRect/></a:stretch>",c=function(t,e,a,n){return vI({cx:t.cx,cy:t.cy,floating:t.floating,docPrId:e,docPrName:"Picture",altAttr:a,graphicXml:n,wrapPolygon:t.wrapPolygon})}(r,o,i,`<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:nvPicPr><pic:cNvPr id="0" name="Picture"${i}/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip ${"linked"===r.kind?`r:link="${e}"`:`r:embed="${e}"`} xmlns:r="${qA}"/>${s}${d}</pic:blipFill><pic:spPr><a:xfrm${l}><a:off x="0" y="0"/><a:ext cx="${r.cx}" cy="${r.cy}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic></a:graphicData></a:graphic>`);return`<w:r>${n}${c}</w:r>`}function yI(t,e,a,n,r){const o=Math.round(e.width*lI),i=Math.round(e.height*lI),l=a.textBoxDocPrIds.get(t.id)??1,s=e.name??"Text Box",d=void 0!==e.alt?` descr="${PA(e.alt)}" title="${PA(e.alt)}"`:"",c=function(t,e,a,n,r){const o=t.shape,i=PA((null==o?void 0:o.preset)??"rect"),l=t.rotation?Math.round(6e4*t.rotation):0,s=0!==l?` rot="${l}"`:"",d=(null==o?void 0:o.fill)?`<a:solidFill><a:srgbClr val="${PA(o.fill.replace(/^#/,""))}"/></a:solidFill>`:"";let c="";((null==o?void 0:o.borderColor)||void 0!==(null==o?void 0:o.borderWidthPt))&&(c=`<a:ln${void 0!==(null==o?void 0:o.borderWidthPt)?` w="${Math.round(12700*o.borderWidthPt)}"`:""}>${(null==o?void 0:o.borderColor)?`<a:solidFill><a:srgbClr val="${PA(o.borderColor.replace(/^#/,""))}"/></a:solidFill>`:""}<a:miter lim="800000"/></a:ln>`);const h=t.body,p=['rot="0"',`vert="${PA((null==h?void 0:h.vert)??"horz")}"`];p.push(`wrap="${PA((null==h?void 0:h.wrap)??"square")}"`),void 0!==(null==h?void 0:h.paddingLeft)&&p.push(`lIns="${Math.round(h.paddingLeft*lI)}"`),void 0!==(null==h?void 0:h.paddingTop)&&p.push(`tIns="${Math.round(h.paddingTop*lI)}"`),void 0!==(null==h?void 0:h.paddingRight)&&p.push(`rIns="${Math.round(h.paddingRight*lI)}"`),void 0!==(null==h?void 0:h.paddingBottom)&&p.push(`bIns="${Math.round(h.paddingBottom*lI)}"`),p.push(`anchor="${PA((null==h?void 0:h.anchor)??"t")}"`),p.push('anchorCtr="0"');const u=(null==h?void 0:h.autoFit)?"<a:spAutoFit/>":"",f=t.blocks.length>0,g=f?SI(t.blocks,n,r):"";return'<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:graphicData uri="http://schemas.microsoft.com/office/word/2010/wordprocessingShape"><wps:wsp>'+(f?'<wps:cNvSpPr txBox="1"><a:spLocks noChangeArrowheads="1"/></wps:cNvSpPr>':"<wps:cNvSpPr/>")+`<wps:spPr bwMode="auto"><a:xfrm${s}><a:off x="0" y="0"/><a:ext cx="${e}" cy="${a}"/></a:xfrm><a:prstGeom prst="${i}"><a:avLst/></a:prstGeom>`+d+c+"</wps:spPr>"+(f?`<wps:txbx><w:txbxContent>${g}</w:txbxContent></wps:txbx>`:"")+`<wps:bodyPr ${p.join(" ")}>${u}</wps:bodyPr></wps:wsp></a:graphicData></a:graphic>`}(e,o,i,a,n);return`<w:r>${r}${vI({cx:o,cy:i,floating:e.floating,docPrId:l,docPrName:s,altAttr:d,graphicXml:c})}</w:r>`}function MI(t,e,a,n){if(t.__isFootnoteRefMarker)return'<w:r><w:rPr><w:rStyle w:val="FootnoteReference"/><w:vertAlign w:val="superscript"/></w:rPr><w:footnoteRef/></w:r>';if(t.__isEndnoteRefMarker)return'<w:r><w:rPr><w:rStyle w:val="EndnoteReference"/><w:vertAlign w:val="superscript"/></w:rPr><w:endnoteRef/></w:r>';const r=function(t,e,a){var n;const r=Ne(t.styles,e,a),o={bold:r.bold,italic:r.italic,underline:r.underline,underlineStyle:r.underlineStyle,underlineColor:r.underlineColor,strike:r.strike,doubleStrike:r.doubleStrike,superscript:r.superscript,subscript:r.subscript,smallCaps:r.smallCaps,allCaps:r.allCaps,hidden:r.hidden,noProof:r.noProof,webHidden:r.webHidden,specVanish:r.specVanish,textEffect:r.textEffect,characterScale:r.characterScale,characterSpacing:r.characterSpacing,baselineShift:r.baselineShift,kerningThreshold:r.kerningThreshold,ligatures:r.ligatures,numberSpacing:r.numberSpacing,numberForm:r.numberForm,stylisticSet:r.stylisticSet,contextualAlternates:r.contextualAlternates,fontFamily:r.fontFamily,fontSize:r.fontSize,color:r.color,highlight:r.highlight,shading:r.shading,language:r.language};return(null==(n=t.styles)?void 0:n.link)&&(o.link=t.styles.link),o}(t,a,n);if(t.footnoteReference){const a=function(t,e,a){var n;const r=null==(n=a.footnoteIdMap)?void 0:n.get(t.footnoteReference.footnoteId);if(void 0===r)return null;const o={...e??{},superscript:!0},i=t.footnoteReference.customMark?' w:customMarkFollows="1"':"",l=t.footnoteReference.customMark?`<w:t xml:space="preserve">${PA(t.footnoteReference.customMark)}</w:t>`:"";return`<w:r>${hI(o)}<w:footnoteReference${i} w:id="${r}"/>${l}</w:r>`}(t,r,e);if(null!==a)return a}if(t.endnoteReference){const a=function(t,e,a){var n;const r=null==(n=a.endnoteIdMap)?void 0:n.get(t.endnoteReference.endnoteId);if(void 0===r)return null;const o={...e??{},superscript:!0},i=t.endnoteReference.customMark?' w:customMarkFollows="1"':"",l=t.endnoteReference.customMark?`<w:t xml:space="preserve">${PA(t.endnoteReference.customMark)}</w:t>`:"";return`<w:r>${hI(o)}<w:endnoteReference${i} w:id="${r}"/>${l}</w:r>`}(t,r,e);if(null!==a)return a}if(t.fieldChar)return function(t,e){const a=(t.fieldLock?' w:fldLock="true"':"")+(t.dirty?' w:dirty="true"':"");return`<w:r>${e}<w:fldChar w:fldCharType="${t.kind}"${a}/></w:r>`}(t.fieldChar,hI(r));if(void 0!==t.fieldInstruction)return o=t.fieldInstruction,`<w:r>${hI(r)}<w:instrText xml:space="preserve">${PA(o)}</w:instrText></w:r>`;var o;if(t.field)return function(t,e){return`<w:fldSimple w:instr="${"PAGE"===t?" PAGE ":" NUMPAGES "}"><w:r>${e}<w:t>1</w:t></w:r></w:fldSimple>`}(t.field.type,hI(r));if(t.textBox)return yI(t,t.textBox,e,n,hI(r));if(t.image){const a=e.imageMap.get(t.id);if(a){const n=bI(t.id,a,e,hI(r));if(null!==n)return n}}if(t.sym){const{font:e,char:a}=t.sym;return`<w:r>${hI(r)}<w:sym w:font="${PA(e)}" w:char="${a}"/></w:r>`}return`<w:r>${hI(r)}${uI(t.text)}</w:r>`}function xI(t,e,a,n){var r;const o=MI(t,e,a,n),i=null==(r=t.styles)?void 0:r.link;return i?function(t,e,a){if(e.startsWith("#"))return`<w:hyperlink w:anchor="${PA(e.slice(1))}">${t}</w:hyperlink>`;const n=a.hyperlinkMap.get(e);return n?`<w:hyperlink r:id="${n}">${t}</w:hyperlink>`:t}(o,i,e):o}function wI(t){return!(t.image||t.textBox||t.field||t.fieldChar||void 0!==t.fieldInstruction||t.footnoteReference||t.endnoteReference)}function SI(t,e,a){return t.map(t=>{var n;if("table"===t.type){return((null==(n=t.style)?void 0:n.pageBreakBefore)?'<w:p><w:r><w:br w:type="page"/></w:r></w:p>':"")+nI(t,(t,n)=>{var r;return AI(t,e,a,{align:null==(r=n.style)?void 0:r.horizontalAlign})})}return AI(t,e,a)}).join("")}function AI(t,e,a,n){var r,o,i;const l=t.runs.length>0?t.runs:[{id:"",text:""}],s=t.dropCap?function(t){const e=hI(t.style);var a;return`<w:p><w:pPr><w:keepNext/><w:framePr w:dropCap="${t.type}" w:lines="${t.lines}" w:wrap="around" w:vAnchor="text" w:hAnchor="text"/><w:spacing w:after="0"/>${e?`<w:rPr>${a=e,a.replace(/^<w:rPr>/,"").replace(/<\/w:rPr>$/,"")}</w:rPr>`:""}</w:pPr><w:r>${e}${uI(t.text)}</w:r></w:p>`}(t.dropCap):"",d=null==(r=e.bookmarkEventsByParagraph)?void 0:r.get(t.id),c=null==(o=e.commentEventsByParagraph)?void 0:o.get(t.id),h=[...(d??[]).map(t=>({offset:t.offset,seq:t.seq,xml:BA(t)})),...(c??[]).map(t=>({offset:t.offset,seq:t.seq,xml:GA(t)}))],p=h.length>0?function(t,e,a,n,r){const o=[...e].sort((t,e)=>t.offset-e.offset||t.seq-e.seq);let i=0,l=0,s="";const d=t=>{for(;i<o.length&&o[i].offset<=t;)s+=o[i].xml,i+=1};for(const c of t){const t=l,e=t+c.text.length;if(d(t),wI(c)&&c.text.length>0){let l=t;for(;i<o.length&&o[i].offset<e;){const e=o[i];e.offset>l&&(s+=xI({...c,text:c.text.slice(l-t,e.offset-t)},a,n,r)),s+=e.xml,i+=1,l=e.offset}l<e&&(s+=xI({...c,text:c.text.slice(l-t)},a,n,r))}else s+=xI(c,a,n,r);l=e}return d(Number.POSITIVE_INFINITY),s}(l,h,e,null==(i=t.style)?void 0:i.styleId,a):l.map(n=>{var r;return xI(n,e,null==(r=t.style)?void 0:r.styleId,a)}).join("");return`${s}<w:p>${iI(t,e.numberingInfo,a,n)}${p}</w:p>`}function II(t){if(0===t.length)return[TI()];const[e,...a]=t;return"paragraph"!==e.type?[TI(!0),e,...a]:[(n=e,{...n,runs:[{id:"synthetic:footnoteRef",text:"",styles:{styleId:"FootnoteReference",superscript:!0},__isFootnoteRefMarker:!0},...n.runs],style:(null==(r=n.style)?void 0:r.styleId)?n.style:{...n.style??{},styleId:"FootnoteText"}}),...a];var n,r}function TI(t=!0){return{id:"synthetic:footnote-body-empty",type:"paragraph",runs:[...t?[{id:"synthetic:footnoteRef",text:"",styles:{styleId:"FootnoteReference",superscript:!0},__isFootnoteRefMarker:!0}]:[],{id:"synthetic:footnote-body-empty-text",text:""}],style:{styleId:"FootnoteText"}}}function CI(t){if(0===t.length)return[kI()];const[e,...a]=t;return"paragraph"!==e.type?[kI(!0),e,...a]:[(n=e,{...n,runs:[{id:"synthetic:endnoteRef",text:"",styles:{styleId:"EndnoteReference",superscript:!0},__isEndnoteRefMarker:!0},...n.runs],style:(null==(r=n.style)?void 0:r.styleId)?n.style:{...n.style??{},styleId:"EndnoteText"}}),...a];var n,r}function kI(t=!0){return{id:"synthetic:endnote-body-empty",type:"paragraph",runs:[...t?[{id:"synthetic:endnoteRef",text:"",styles:{styleId:"EndnoteReference",superscript:!0},__isEndnoteRefMarker:!0}]:[],{id:"synthetic:endnote-body-empty-text",text:""}],style:{styleId:"EndnoteText"}}}const VI=["wholeTable","band1Horz","band2Horz","band1Vert","band2Vert","firstCol","lastCol","firstRow","lastRow","nwCell","neCell","swCell","seCell"];function EI(t,e){const a=[],n=e.paragraphStyle?oI(e.paragraphStyle):"";n&&a.push(n);const r=e.textStyle?hI(e.textStyle):"";r&&a.push(r);const o=e.rowStyle?function(t){var e;if(!t)return"";const a=[],n=$A("gridBefore",t.gridBefore);n&&a.push(n);const r=$A("gridAfter",t.gridAfter);r&&a.push(r);const o=YA("wBefore",t.widthBefore);o&&a.push(o);const i=YA("wAfter",t.widthAfter);i&&a.push(i);const l=YA("tblCellSpacing",t.cellSpacing);l&&a.push(l);const s=tI(t.height,t.heightRule);s&&a.push(s);const d=JA("cantSplit",t.cantSplit);d&&a.push(d);const c=JA("hidden",t.hidden);return c&&a.push(c),(null==(e=t.revisionXml)?void 0:e.length)&&a.push(...t.revisionXml),a.length>0?`<w:trPr>${a.join("")}</w:trPr>`:""}(e.rowStyle):"";o&&a.push(o);const i=function(t){const e=[];if(t.borders){const a=t.borders,n=[["top",a.borderTop],["left",a.borderLeft],["bottom",a.borderBottom],["right",a.borderRight]].filter(t=>null!=t[1]).map(([t,e])=>`<w:${t} ${DA(e)}`).join("");n&&e.push(`<w:tcBorders>${n}</w:tcBorders>`)}return t.shading&&e.push(`<w:shd w:val="clear" w:color="auto" w:fill="${FA(t.shading,"FFFFFF")}"/>`),e.length>0?`<w:tcPr>${e.join("")}</w:tcPr>`:""}(e);return i&&a.push(i),0===a.length?"":`<w:tblStylePr w:type="${PA(t)}">${a.join("")}</w:tblStylePr>`}function RI(t){const e=[];if(e.push(`<w:name w:val="${PA(t.name)}"/>`),t.basedOn&&e.push(`<w:basedOn w:val="${PA(t.basedOn)}"/>`),t.nextStyle&&e.push(`<w:next w:val="${PA(t.nextStyle)}"/>`),("paragraph"===t.type||"table"===t.type)&&t.paragraphStyle){const a=oI(t.paragraphStyle);a&&e.push(a)}if(t.textStyle){const a=hI(t.textStyle);a&&e.push(a)}if("table"===t.type&&t.tableStyle){const a=t.tableStyle,n=[];if(void 0!==a.rowBandSize&&n.push(`<w:tblStyleRowBandSize w:val="${a.rowBandSize}"/>`),void 0!==a.colBandSize&&n.push(`<w:tblStyleColBandSize w:val="${a.colBandSize}"/>`),void 0!==a.indentLeft){const t="number"==typeof a.indentLeft?UA(a.indentLeft):null;null!==t&&n.push(`<w:tblInd w:w="${t}" w:type="dxa"/>`)}if(n.length>0&&e.push(`<w:tblPr>${n.join("")}</w:tblPr>`),a.conditionalFormats){const t=[...VI.filter(t=>t in a.conditionalFormats),...Object.keys(a.conditionalFormats).filter(t=>!VI.includes(t))];for(const n of t){const t=a.conditionalFormats[n];if(t){const a=EI(n,t);a&&e.push(a)}}}}return`<w:style w:type="${"character"===t.type?"character":"table"===t.type?"table":"paragraph"}" w:styleId="${PA(t.id)}">${e.join("")}</w:style>`}const LI=`xmlns:w="${zA}" xmlns:w14="${OA}" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:r="${qA}"`;function zI(t,e){e(t);for(const a of t.runs)a.textBox&&NI(a.textBox.blocks,e)}function NI(t,e){for(const a of t)if("paragraph"!==a.type)for(const t of a.rows)for(const a of t.cells)for(const t of a.blocks)zI(t,e);else zI(a,e)}function qI(t,e,a,n){const r=[],o=new Map,i=new Map,l=[],s=new Map;return NI(t,t=>{var e;for(const d of t.runs){const t=null==(e=d.styles)?void 0:e.link;if(t&&!t.startsWith("#")&&!s.has(t)){const e=`rIdLink${l.length+1}`;s.set(t,e),l.push({rId:e,href:t})}if(d.textBox&&!i.has(d.id)&&(i.set(d.id,a.nextTextBoxDocPrId),a.nextTextBoxDocPrId+=1),!d.image)continue;const c=a.nextImageId,h=`rIdImg${c}`,p={rId:h,runId:d.id,cx:Math.round(9525*d.image.width),cy:Math.round(9525*d.image.height),alt:d.image.alt,crop:d.image.crop,fillMode:d.image.fillMode,rotation:d.image.rotation,flipH:d.image.flipH,flipV:d.image.flipV,floating:d.image.floating,wrapPolygon:d.image.wrapPolygon};if(d.image.linkedSrc){r.push({...p,kind:"linked",target:d.image.linkedSrc}),o.set(d.id,h),a.nextImageId+=1;continue}const u=Oe(n,d.image.src).match(/^data:([^;,]+);base64,(.*)$/);if(!u)continue;const f=eb(u[1]);if(!f)continue;const g=u[2],m=`media/image${c}.${f}`;r.push({...p,kind:"embedded",target:m,base64:g}),o.set(d.id,h),a.nextImageId+=1}}),{numberingInfo:e.numberingInfo,definitions:e.definitions,images:r,imageMap:o,textBoxDocPrIds:i,hyperlinks:l,hyperlinkMap:s}}function OI(t,e,a){const n=We(t).map((n,r)=>SI(n.blocks,e,t.styles)+function(t,e){var a,n,r,o,i,l,s,d,c;const h=WA(t.width,12240),p=WA(t.height,15840),u=t.margins,f="landscape"===t.orientation?' w:orient="landscape"':"",g=[(null==(a=null==e?void 0:e.header)?void 0:a.first)?`<w:headerReference w:type="first" r:id="${e.header.first.relId}"/>`:"",(null==(n=null==e?void 0:e.header)?void 0:n.even)?`<w:headerReference w:type="even" r:id="${e.header.even.relId}"/>`:"",(null==(r=null==e?void 0:e.header)?void 0:r.default)?`<w:headerReference w:type="default" r:id="${e.header.default.relId}"/>`:"",(null==(o=null==e?void 0:e.footer)?void 0:o.first)?`<w:footerReference w:type="first" r:id="${e.footer.first.relId}"/>`:"",(null==(i=null==e?void 0:e.footer)?void 0:i.even)?`<w:footerReference w:type="even" r:id="${e.footer.even.relId}"/>`:"",(null==(l=null==e?void 0:e.footer)?void 0:l.default)?`<w:footerReference w:type="default" r:id="${e.footer.default.relId}"/>`:""].join(""),m=(null==(s=null==e?void 0:e.header)?void 0:s.first)||(null==(d=null==e?void 0:e.footer)?void 0:d.first)?"<w:titlePg/>":"",v=t.columns;let b="";if(v&&v.count>1){const t=WA(v.space,0),e=v.separator?' w:sep="1"':"";if(!1===v.equalWidth&&(null==(c=v.columns)?void 0:c.length)){const a=v.columns.map(t=>`<w:col w:w="${WA(t.width,0)}" w:space="${WA(t.space,0)}"/>`).join("");b=`<w:cols w:num="${v.count}" w:space="${t}" w:equalWidth="0"${e}>${a}</w:cols>`}else b=`<w:cols w:num="${v.count}" w:space="${t}"${e}/>`}return`<w:sectPr>${g}${m}<w:pgSz w:w="${h}" w:h="${p}"${f}/><w:pgMar w:top="${WA(u.top,1440)}" w:right="${WA(u.right,1440)}" w:bottom="${WA(u.bottom,1440)}" w:left="${WA(u.left,1440)}" w:header="${WA(u.header,720)}" w:footer="${WA(u.footer,720)}" w:gutter="${WA(u.gutter,0)}"/>${b}</w:sectPr>`}(n.pageSettings,a[r])).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document ${LI}><w:body>${n}</w:body></w:document>`}function PI(t,e,a,n){const r="header"===t?"hdr":"ftr";return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:${r} ${LI}>${SI(e,a,n)}</w:${r}>`}function WI(t,e,a,n,r,o,i,l){const s=n.map(t=>{const e="header"===t.kind?"application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml":"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml";return`<Override PartName="/word/${t.path}" ContentType="${e}"/>`}).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/>${function(t){const e=new Set;let a="";for(const n of t){const t=n.toLowerCase();if(e.has(t))continue;const r=$v[t];r&&(e.add(t),a+=`<Default Extension="${t}" ContentType="${r}"/>`)}return a}(e)}<Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>${i?'<Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/>':""}${t?'<Override PartName="/word/numbering.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"/>':""}${a?'<Override PartName="/word/settings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"/>':""}${r?'<Override PartName="/word/footnotes.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml"/>':""}${o?'<Override PartName="/word/endnotes.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml"/>':""}${l?'<Override PartName="/word/comments.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"/><Override PartName="/word/commentsExtended.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml"/>':""}${s}</Types>`}const HI={decimal:"decimal",lowerRoman:"lowerRoman",upperRoman:"upperRoman",lowerLetter:"lowerLetter",upperLetter:"upperLetter",symbol:"symbol"},UI={continuous:"continuous",eachSection:"eachSect"};function FI(t,e){if(!e)return null;const a=[];return e.numberFormat&&a.push(`<w:numFmt w:val="${HI[e.numberFormat]}"/>`),void 0!==e.startAt&&a.push(`<w:numStart w:val="${Math.max(1,e.startAt)}"/>`),e.restart&&a.push(`<w:numRestart w:val="${UI[e.restart]}"/>`),a.length>0?`<w:${t}>${a.join("")}</w:${t}>`:null}function BI(t,e){let a="";for(const n of e)a+=`<Relationship Id="${n.rId}" Type="${qA}/hyperlink" Target="${PA(n.href)}" TargetMode="External"/>`;for(const n of t){const t="linked"===n.kind?' TargetMode="External"':"";a+=`<Relationship Id="${n.rId}" Type="${qA}/image" Target="${PA(n.target)}"${t}/>`}return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${NA}">${a}</Relationships>`}async function GI(t){var e,a,n,r,o,i;t=hw(t);const l=new Qp,s=function(t){const e=new Map,a=new Map,n=[];let r=1,o=1;const i=t=>{if(!t.list)return;const i=Math.max(0,t.list.level??0),l=t.list.bulletGlyph??"",s=`${t.list.kind}:${i}:${l}`;let d=a.get(s);d||(d={abstractNumId:r++,numId:o++},a.set(s,d),n.push({kind:t.list.kind,level:i,abstractNumId:d.abstractNumId,numId:d.numId,format:t.list.format,startAt:t.list.startAt,bulletGlyph:t.list.bulletGlyph,bulletFont:t.list.bulletFont})),e.set(t.id,{numId:d.numId,level:i})};for(const l of We(t))NI(l.blocks,i),l.header&&NI(l.header,i),l.firstPageHeader&&NI(l.firstPageHeader,i),l.evenPageHeader&&NI(l.evenPageHeader,i),l.footer&&NI(l.footer,i),l.firstPageFooter&&NI(l.firstPageFooter,i),l.evenPageFooter&&NI(l.evenPageFooter,i);return{numberingInfo:e,definitions:n}}(t),d={nextImageId:1,nextTextBoxDocPrId:1000001},c=We(t),h=function(t){var e;const a=null==(e=t.footnotes)?void 0:e.items;if(!a)return[];const n=new Map;let r=1;for(const{run:o}of Bl(t)){const t=o.footnoteReference;if(!t)continue;if(n.has(t.footnoteId))continue;const e=a[t.footnoteId];e&&(n.set(t.footnoteId,{footnoteId:t.footnoteId,docxId:r,footnote:e}),r+=1)}return Array.from(n.values())}(t),p=function(t){const e=new Map;for(const a of t)e.set(a.footnoteId,a.docxId);return e}(h),u=h.length>0,f=function(t){var e;const a=null==(e=t.endnotes)?void 0:e.items;if(!a)return[];const n=new Map;let r=1;for(const{run:o}of Ql(t)){const t=o.endnoteReference;if(!t)continue;if(n.has(t.endnoteId))continue;const e=a[t.endnoteId];e&&(n.set(t.endnoteId,{endnoteId:t.endnoteId,docxId:r,endnote:e}),r+=1)}return Array.from(n.values())}(t),g=function(t){const e=new Map;for(const a of t)e.set(a.endnoteId,a.docxId);return e}(f),m=f.length>0,v=qI(c.flatMap(t=>t.blocks),s,d,t);v.footnoteIdMap=p,v.endnoteIdMap=g;const b=function(t){const e=t.bookmarks;if(!e||0===e.order.length)return;const a=new Map,n=new Set;for(const l of e.order){const t=e.items[l];if(!t)continue;const r=t.docxIdHint;void 0!==r&&r>=0&&!n.has(r)&&(a.set(l,r),n.add(r))}let r=0;for(const l of e.order)if(!a.has(l)){for(;n.has(r);)r+=1;a.set(l,r),n.add(r),r+=1}const o=new Map,i=(t,e)=>{const a=o.get(t);a?a.push(e):o.set(t,[e])};for(const l of e.order){const t=e.items[l];if(!t)continue;const n=a.get(l);t.start&&i(t.start.paragraphId,{kind:"start",offset:t.start.offset,seq:t.start.seq??0,wId:n,name:t.name,...void 0!==t.colFirst?{colFirst:t.colFirst}:{},...void 0!==t.colLast?{colLast:t.colLast}:{}}),t.end&&i(t.end.paragraphId,{kind:"end",offset:t.end.offset,seq:t.end.seq??0,wId:n})}return o}(t);v.bookmarkEventsByParagraph=b;const y=function(t){const e=t.comments;if(!e||0===e.order.length)return;const a=new Map,n=new Set;for(const s of e.order){const t=e.items[s];if(!t)continue;const r=t.docxIdHint;void 0!==r&&r>=0&&!n.has(r)&&(a.set(s,r),n.add(r))}let r=0;for(const s of e.order)if(!a.has(s)){for(;n.has(r);)r+=1;a.set(s,r),n.add(r),r+=1}const o=new Map,i=(t,e)=>{const a=o.get(t);a?a.push(e):o.set(t,[e])},l=[];return e.order.forEach((t,n)=>{const r=e.items[t];if(!r)return;const o=a.get(t),s=(1073741824+n).toString(16).toUpperCase();l.push({comment:r,wId:o,paraId:s}),r.start&&i(r.start.paragraphId,{kind:"start",offset:r.start.offset,seq:r.start.seq??0,wId:o}),r.end&&(i(r.end.paragraphId,{kind:"end",offset:r.end.offset,seq:r.end.seq??0,wId:o}),i(r.end.paragraphId,{kind:"reference",offset:r.end.offset,seq:(r.end.seq??0)+.5,wId:o}))}),{eventsByParagraph:o,comments:l}}(t);v.commentEventsByParagraph=null==y?void 0:y.eventsByParagraph;const M=void 0!==y,x=[],w=c.map(()=>({}));let S=1,A=1;c.forEach((e,a)=>{const n=(e,n,r)=>{var o;if(!r||0===r.length)return;const i="header"===e?S:A,l=`${e}${i}.xml`,c=`rId${"header"===e?"Header":"Footer"}${i}`,h=qI(r,s,d,t);h.footnoteIdMap=p,h.endnoteIdMap=g,h.bookmarkEventsByParagraph=b,h.commentEventsByParagraph=null==y?void 0:y.eventsByParagraph,x.push({kind:e,type:n,path:l,relId:c,blocks:r,context:h});const u="header"===e?"header":"footer";((o=w[a])[u]??(o[u]={}))[n]={relId:c},"header"===e?S+=1:A+=1};n("header","first",e.firstPageHeader),n("header","even",e.evenPageHeader),n("header","default",e.header),n("footer","first",e.firstPageFooter),n("footer","even",e.evenPageFooter),n("footer","default",e.footer)});const I=s.definitions.length>0,T=c.some(t=>{var e,a;return((null==(e=t.evenPageHeader)?void 0:e.length)??0)>0||((null==(a=t.evenPageFooter)?void 0:a.length)??0)>0}),C=T||void 0!==(null==(e=t.settings)?void 0:e.defaultTabStop)||void 0!==(null==(a=t.footnotes)?void 0:a.settings)||void 0!==(null==(n=t.endnotes)?void 0:n.settings),k=[...v.images,...x.flatMap(t=>t.context.images)],V=u?function(t,e,a,n,r,o,i){const l=r(e.flatMap(t=>II(t.footnote.blocks)));l.footnoteIdMap=i;const s=e.map(t=>{const e=II(t.footnote.blocks).map(t=>"paragraph"===t.type?AI(t,l,o):nI(t,(t,e)=>{var a;return AI(t,l,o,{align:null==(a=e.style)?void 0:a.horizontalAlign})})).join("");return`<w:footnote w:id="${t.docxId}">${e}</w:footnote>`}).join("");return{xml:`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:footnotes xmlns:w="${zA}" xmlns:w14="${OA}" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:r="${qA}"><w:footnote w:type="separator" w:id="-1"><w:p><w:r><w:separator/></w:r></w:p></w:footnote><w:footnote w:type="continuationSeparator" w:id="0"><w:p><w:r><w:continuationSeparator/></w:r></w:p></w:footnote>${s}</w:footnotes>`,partContext:l}}(0,h,0,0,e=>qI(e,s,d,t),t.styles,p):null;V&&k.push(...V.partContext.images);const E=m?function(t,e,a,n,r,o,i){const l=r(e.flatMap(t=>CI(t.endnote.blocks)));l.endnoteIdMap=i;const s=e.map(t=>{const e=CI(t.endnote.blocks).map(t=>"paragraph"===t.type?AI(t,l,o):nI(t,(t,e)=>{var a;return AI(t,l,o,{align:null==(a=e.style)?void 0:a.horizontalAlign})})).join("");return`<w:endnote w:id="${t.docxId}">${e}</w:endnote>`}).join("");return{xml:`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:endnotes xmlns:w="${zA}" xmlns:w14="${OA}" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:r="${qA}"><w:endnote w:type="separator" w:id="-1"><w:p><w:r><w:separator/></w:r></w:p></w:endnote><w:endnote w:type="continuationSeparator" w:id="0"><w:p><w:r><w:continuationSeparator/></w:r></w:p></w:endnote>${s}</w:endnotes>`,partContext:l}}(0,f,0,0,e=>qI(e,s,d,t),t.styles,g):null;E&&k.push(...E.partContext.images);const R=k.filter(t=>"embedded"===t.kind).map(t=>{var e;return null==(e=t.target.split(".").pop())?void 0:e.toLowerCase()}).filter(t=>Boolean(t)),L=null!=t.styles&&Object.keys(t.styles).length>0;l.file("[Content_Types].xml",WI(I,R,C,x,u,m,L,M)),l.file("_rels/.rels",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${NA}"><Relationship Id="rId1" Type="${qA}/officeDocument" Target="word/document.xml"/></Relationships>`),l.file("word/document.xml",OI(t,v,w)),L&&l.file("word/styles.xml",function(t){const e=Object.values(t).map(RI).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="${OA}">${e}</w:styles>`}(t.styles)),I&&l.file("word/numbering.xml",function(t){const e=t.map(({kind:t,level:e,abstractNumId:a,format:n,startAt:r,bulletGlyph:o,bulletFont:i})=>{const l="bullet"===t?"bullet":n??"decimal",s="bullet"===t?o??"":`%${e+1}.`,d=r??1,c="bullet"===t?i??"Symbol":void 0,h=c?`<w:rPr><w:rFonts w:ascii="${PA(c)}" w:hAnsi="${PA(c)}" w:hint="default"/></w:rPr>`:"";return`<w:abstractNum w:abstractNumId="${a}"><w:lvl w:ilvl="${e}"><w:start w:val="${d}"/><w:numFmt w:val="${l}"/><w:lvlText w:val="${PA(s)}"/><w:lvlJc w:val="left"/>${h}</w:lvl></w:abstractNum>`}).join(""),a=t.map(({abstractNumId:t,numId:e})=>`<w:num w:numId="${e}"><w:abstractNumId w:val="${t}"/></w:num>`).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:numbering xmlns:w="${zA}">${e}${a}</w:numbering>`}(s.definitions)),(L||I||C||v.images.length>0||v.hyperlinks.length>0||x.length>0||u||m||M)&&l.file("word/_rels/document.xml.rels",function(t,e,a,n,r,o,i,l,s){let d="";l&&(d+=`<Relationship Id="rIdStyles" Type="${qA}/styles" Target="styles.xml"/>`),t&&(d+=`<Relationship Id="rIdNum" Type="${qA}/numbering" Target="numbering.xml"/>`),e&&(d+=`<Relationship Id="rIdSettings" Type="${qA}/settings" Target="settings.xml"/>`);for(const c of n)d+=`<Relationship Id="${c.rId}" Type="${qA}/hyperlink" Target="${PA(c.href)}" TargetMode="External"/>`;for(const c of a){const t="linked"===c.kind?' TargetMode="External"':"";d+=`<Relationship Id="${c.rId}" Type="${qA}/image" Target="${PA(c.target)}"${t}/>`}for(const c of r){const t="header"===c.kind?"header":"footer";d+=`<Relationship Id="${c.relId}" Type="${qA}/${t}" Target="${c.path}"/>`}return o&&(d+=`<Relationship Id="rIdFootnotes" Type="${qA}/footnotes" Target="footnotes.xml"/>`),i&&(d+=`<Relationship Id="rIdEndnotes" Type="${qA}/endnotes" Target="endnotes.xml"/>`),s&&(d+=`<Relationship Id="rIdComments" Type="${qA}/comments" Target="comments.xml"/>`,d+='<Relationship Id="rIdCommentsExtended" Type="http://schemas.microsoft.com/office/2011/relationships/commentsExtended" Target="commentsExtended.xml"/>'),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${NA}">${d}</Relationships>`}(I,C,v.images,v.hyperlinks,x,u,m,L,M)),C&&l.file("word/settings.xml",function(t,e,a,n){const r=[],o=UA(e);null!==o&&r.push(`<w:defaultTabStop w:val="${o}"/>`);const i=FI("footnotePr",a);i&&r.push(i);const l=FI("endnotePr",n);return l&&r.push(l),t&&r.push("<w:evenAndOddHeaders/>"),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:settings xmlns:w="${zA}">${r.join("")}</w:settings>`}(T,null==(r=t.settings)?void 0:r.defaultTabStop,null==(o=t.footnotes)?void 0:o.settings,null==(i=t.endnotes)?void 0:i.settings));for(const z of x)l.file(`word/${z.path}`,PI(z.kind,z.blocks,z.context,t.styles)),(z.context.images.length>0||z.context.hyperlinks.length>0)&&l.file(`word/_rels/${z.path}.rels`,BI(z.context.images,z.context.hyperlinks));V&&(l.file("word/footnotes.xml",V.xml),(V.partContext.images.length>0||V.partContext.hyperlinks.length>0)&&l.file("word/_rels/footnotes.xml.rels",BI(V.partContext.images,V.partContext.hyperlinks))),E&&(l.file("word/endnotes.xml",E.xml),(E.partContext.images.length>0||E.partContext.hyperlinks.length>0)&&l.file("word/_rels/endnotes.xml.rels",BI(E.partContext.images,E.partContext.hyperlinks))),y&&(l.file("word/comments.xml",KA(y)),l.file("word/commentsExtended.xml",function(t){const e=t.comments.map(({comment:t,paraId:e})=>`<w15:commentEx w15:paraId="${e}" w15:done="${t.resolved?"1":"0"}"/>`).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w15:commentsEx ${ZA}>${e}</w15:commentsEx>`}(y)));for(const z of k)"embedded"===z.kind&&z.base64&&l.file(`word/${z.target}`,z.base64,{base64:!0});return l.generateAsync({type:"arraybuffer"})}function ZI(t){switch(t){case"dashed":return[CM(5),CM(3)];case"dotted":return[CM(1),CM(3)];default:return}}function KI(t,e,a,n,r,o,i){"none"===a.type||a.width<=0||t.drawLine(e,{x1:CM(n),y1:CM(r),x2:CM(o),y2:CM(i),stroke:a.color,lineWidth:CM(a.width),dashArray:ZI(a.type)})}function DI(t,e,a,n,r){const o=n+a.left,i=r+a.top,l=o+a.width,s=i+a.height;KI(t,e,a.borders.top,o,i,l,i),KI(t,e,a.borders.right,l,i,l,s),KI(t,e,a.borders.bottom,o,s,l,s),KI(t,e,a.borders.left,o,i,o,s)}async function jI(t,e,a,n,r,o,i,l,s){if("table"!==a.sourceBlock.type)return;const d=a.sourceBlock,c=a.tableSegment?ln(d,a.tableSegment):d;if(0===c.rows.length)return;const h=Gd({table:c,state:{document:n},pageIndex:0,originX:0,originY:0,contentWidth:i,estimatedHeight:a.estimatedHeight});for(const p of h.cells)p.shading&&t.drawRect(e,{x:CM(r+p.left),y:CM(o+p.top),width:CM(p.width),height:CM(p.height),fill:p.shading});for(const p of h.cells)DI(t,e,p,r,o);for(const p of h.cells)for(const a of p.paragraphs)await hT(t,e,a.paragraph,a.lines,n,r+a.originX,o+a.originY,l,s)}async function XI(t,e,a,n,r,o,i){const l=e.rotation;l&&(t.saveGraphicsState(a.pageIndex),t.rotateAbout(a.pageIndex,CM(n+o/2),CM(r+i/2),l)),function(t,e,a,n,r,o,i){var l,s,d,c;const h=Gs(null==(l=a.shape)?void 0:l.preset,CM(n),CM(r),CM(o),CM(i)),p=null==(s=a.shape)?void 0:s.fill,u=null==(d=a.shape)?void 0:d.borderColor,f=(null==(c=a.shape)?void 0:c.borderWidthPt)??(u?.75:0);t.drawPath(e,{segments:h,fill:p,stroke:u&&f>0?u:void 0,lineWidth:f})}(t,a.pageIndex,e,n,r,o,i),await async function(t,e,a,n,r,o,i){var l;if(0===e.blocks.length)return;const s=function(t){var e,a,n,r;return{left:(null==(e=t.body)?void 0:e.paddingLeft)??0,top:(null==(a=t.body)?void 0:a.paddingTop)??0,right:(null==(n=t.body)?void 0:n.paddingRight)??0,bottom:(null==(r=t.body)?void 0:r.paddingBottom)??0}}(e),d=n+s.left,c=r+s.top,h=Math.max(1,o-s.left-s.right),p=Math.max(1,i-s.top-s.bottom),u=(null==(l=Rl({blocks:e.blocks,pageSettings:{width:h,height:p,orientation:"portrait",margins:{top:0,right:0,bottom:0,left:0,header:0,footer:0,gutter:0}},maxPageHeight:p,styles:a.document.styles,pageOffset:a.pageIndex})[0])?void 0:l.blocks)??[];if(0===u.length)return;const f=new Map;t.saveGraphicsState(a.pageIndex),t.clipRect(a.pageIndex,CM(d),CM(c),CM(h),CM(p));let g=c;for(const m of u)"paragraph"===m.sourceBlock.type&&m.layout?await hT(t,a.pageIndex,m.sourceBlock,m.layout.lines,a.document,d,g,a.fontRegistry,f):"table"===m.sourceBlock.type&&await jI(t,a.pageIndex,m,a.document,d,g,h,a.fontRegistry,f),g+=Math.max(0,m.estimatedHeight);t.restoreGraphicsState(a.pageIndex)}(t,e,a,n,r,o,i),l&&t.restoreGraphicsState(a.pageIndex)}async function JI(t){const{writer:e,document:a,fontRegistry:n,pageIndex:r,lines:o,pageSettings:i,contentLeft:l,contentTop:s,contentWidth:d,paragraphTop:c}=t;for(const h of o){const t=new Map(h.slots.map(t=>[t.offset,t]));for(const o of h.fragments){const p=o.textBox;if(!(null==p?void 0:p.floating))continue;const u=t.get(o.startOffset),f=l+((null==u?void 0:u.left)??0),g=c+h.top,m=qi({object:Ri(p),pageSettings:i,contentLeft:l,contentTop:s,contentWidth:d,paragraphTop:c,lineTop:g,anchorLeft:f});await XI(e,p,{document:a,fontRegistry:n,pageIndex:r},m.x,m.y,m.width,m.height)}}}const YI=new WeakMap;function QI(t){const e=/^data:([^;,]+)(;base64)?,(.*)$/i.exec(t);if(!e)return null;const a=e[1].toLowerCase(),n=Boolean(e[2]),r=e[3]??"";if(!n)return{mediaType:a,data:(new TextEncoder).encode(decodeURIComponent(r))};const o="function"==typeof atob?atob(r):Buffer.from(r,"base64").toString("binary");return{mediaType:a,data:Uint8Array.from(o,t=>t.charCodeAt(0))}}async function _I(t,e,a){let n=t;n.startsWith("data:")||(n=await async function(t){if("function"!=typeof fetch)return null;const e=await fetch(t);if(!e.ok)return null;const a=await e.blob(),n=new Uint8Array(await a.arrayBuffer()),r=Array.from(n,t=>String.fromCharCode(t)).join(""),o="function"==typeof btoa?btoa(r):Buffer.from(n).toString("base64");return`data:${a.type||"application/octet-stream"};base64,${o}`}(n)??n);let r=QI(n);if(!r)return null;const o="undefined"!=typeof Image?await async function(t){return"undefined"==typeof Image?null:await new Promise(e=>{const a=new Image;a.crossOrigin="anonymous",a.onload=()=>e(a),a.onerror=()=>e(null),a.src=t})}(n):null,i=null!=o&&o.naturalWidth>0&&o.naturalHeight>0;if("image/jpeg"!==r.mediaType&&"image/jpg"!==r.mediaType){if(!i)return null;const t=function(t){if("undefined"==typeof document)return null;const e=document.createElement("canvas");e.width=t.naturalWidth,e.height=t.naturalHeight;const a=e.getContext("2d");return a?(a.fillStyle="#ffffff",a.fillRect(0,0,e.width,e.height),a.drawImage(t,0,0),e.toDataURL("image/jpeg",.92)):null}(o);if(r=t?QI(t):null,!r)return null}const l=i?o.naturalWidth:e,s=i?o.naturalHeight:a;return{width:Math.max(1,Math.round(l)),height:Math.max(1,Math.round(s)),data:r.data}}function $I(t,e){const a=new Map(t.slots.map(t=>[t.offset,t])),n=[];for(const r of e.chars){if("\n"===r.char||"\t"===r.char)continue;const t=a.get(r.paragraphOffset);t&&n.push({char:r.char,left:t.left,offset:r.paragraphOffset})}return n}function tT(t,e,a){const n=$I(t,e);if(0===n.length)return null;const r=new Map(t.slots.map(t=>[t.offset,t])),o=n[0],i=n[n.length-1],l=r.get(i.offset+1);return{left:o.left,right:(null==l?void 0:l.left)??i.left+.55*a}}function eT(t,e,a,n,r,o,i,l){const s=tT(a,n,i.fontSize??TM);if(!s)return;const d="underline"===l?o+a.top+a.height-2:"doubleStrike"===l?o+a.top+.5*a.height:o+a.top+.52*a.height,c=r+s.left,h=r+s.right,p="underline"===l?i.underlineColor??i.color??"#000000":i.color??"#000000";if("strike"!==l){if("doubleStrike"===l){const a=1.3;return t.drawLine(e,{x1:CM(c),y1:CM(d-a),x2:CM(h),y2:CM(d-a),stroke:p,lineWidth:CM(1)}),void t.drawLine(e,{x1:CM(c),y1:CM(d+a),x2:CM(h),y2:CM(d+a),stroke:p,lineWidth:CM(1)})}!function(t,e,a,n,r,o,i){const l=$s(i),s=(r,i)=>{t.drawLine(e,{x1:CM(a),y1:CM(r),x2:CM(n),y2:CM(r),stroke:o,lineWidth:CM(l),dashArray:i})};if(Qs(i))return s(r-1.5),void s(r+1.5);if(_s(i))return void function(t,e,a,n,r,o,i){const l=4,s=1.5;let d=a,c=r;for(let h=a;h<=n;h+=1){const n=r+Math.sin((h-a)/l*Math.PI)*s;t.drawLine(e,{x1:CM(d),y1:CM(c),x2:CM(h),y2:CM(n),stroke:o,lineWidth:CM(i)}),d=h,c=n}}(t,e,a,n,r,o,l);s(r,td(i))}(t,e,c,h,d,p,i.underlineStyle)}else t.drawLine(e,{x1:CM(c),y1:CM(d),x2:CM(h),y2:CM(d),stroke:p,lineWidth:CM(1)})}function aT(t,e,a,n){var r;const o=qe(t.style,n.styles).tabs??[];if(0===o.length)return;const i=a-((null==(r=e.slots[0])?void 0:r.left)??0),l=o.filter(t=>"clear"!==t.type).map(t=>({...t,positionPx:t.position*bn})).filter(t=>t.positionPx>i+.01).sort((t,e)=>t.positionPx-e.positionPx)[0];return(null==l?void 0:l.leader)&&"none"!==l.leader?l.leader:void 0}async function nT(t,e,a,n,r,o,i,l,s){var d;if(r.image){const a=n.slots.find(t=>t.offset===r.startOffset)??n.slots.find(t=>t.offset>=r.startOffset);if(!a)return;const s=await async function(t,e,a){const n=Oe(e,a.src);if(!n)return null;let r=YI.get(t);r||(r=new Map,YI.set(t,r));const o=r.get(n);if(o)return o;const i=_I(n,a.width,a.height).then(e=>e?t.registerImageResource({width:e.width,height:e.height,data:e.data,filter:"DCTDecode"}):null);return r.set(n,i),i}(t,o,r.image);if(!s)return;return void t.drawImage(e,{resourceName:s,x:CM(i+a.left),y:CM(l+n.top+n.height-r.image.height),width:CM(r.image.width),height:CM(r.image.height),rotation:r.image.rotation})}if(r.textBox)return void(await async function(t,e,a,n,r,o,i,l){const s=n.textBox;if(!s||s.floating)return;const d=a.slots.find(t=>t.offset===n.startOffset)??a.slots.find(t=>t.offset>=n.startOffset);d&&await XI(t,s,{document:r,fontRegistry:l,pageIndex:e},o+d.left,i+a.top+a.height-s.height,s.width,s.height)}(t,e,n,r,o,i,l,s));const c=Ne(r.styles,null==(d=a.style)?void 0:d.styleId,o.styles);if(c.hidden)return;const h=s.resolveFontFace({fontFamily:c.fontFamily,bold:c.bold,italic:c.italic}),p=c.smallCaps?.8*kM(c):kM(c),u=(c.baselineShift??0)*bn,f=l+n.top+.8*n.height-u,g=$I(n,r),m=g.map(t=>c.allCaps?t.char.toUpperCase():t.char).join("");if(!g[0]||0===m.length)return;!function(t,e,a,n,r,o,i){if(!i.shading)return;const l=tT(a,n,i.fontSize??TM);l&&t.drawRect(e,{x:CM(r+l.left),y:CM(o+a.top+2),width:CM(Math.max(0,l.right-l.left)),height:CM(Math.max(2,a.height-4)),fill:i.shading})}(t,e,n,r,i,l,c),function(t,e,a,n,r,o,i){if(!i.highlight)return;const l=tT(a,n,i.fontSize??TM);l&&t.drawRect(e,{x:CM(r+l.left),y:CM(o+a.top+2),width:CM(Math.max(0,l.right-l.left)),height:CM(Math.max(2,a.height-4)),fill:i.highlight})}(t,e,n,r,i,l,c),function(t,e,a,n,r,o,i,l,s){const d=new Map(n.slots.map(t=>[t.offset,t]));for(const c of r.chars){if("\t"!==c.char)continue;const r=d.get(c.paragraphOffset),h=d.get(c.paragraphOffset+1);if(!r||!h)continue;const p=aT(a,n,r.left,o);if(!p)continue;const u="underscore"===p?l+2:l;t.drawLine(e,{x1:CM(i+r.left),y1:CM(u),x2:CM(i+h.left),y2:CM(u),stroke:s,lineWidth:CM("heavy"===p?1.5:1),dashArray:"dot"===p||"middleDot"===p?[1,3]:"hyphen"===p?[5,3]:void 0})}}(t,e,a,n,r,o,i,f,c.color??"#000000");if("justify"===(qe(a.style,o.styles).align??"left")){const a=function(t){const e=[];let a=[];for(const n of t)" "!==n.char?a.push(n):a.length>0&&(e.push(a),a=[]);return a.length>0&&e.push(a),e}(g);for(const n of a){const a=n.map(t=>c.allCaps?t.char.toUpperCase():t.char).join("");0!==a.length&&t.drawText(e,{x:CM(i+n[0].left),y:CM(f),text:a,fontSize:p,color:c.color??"#000000",bold:c.bold,italic:c.italic,fontResourceName:h.writerResourceName,characterSpacing:c.characterSpacing??0,horizontalScale:c.characterScale??100})}}else{const a=function(t){const e=[];let a=[];for(const n of t){const t=a[a.length-1];t&&n.offset>t.offset+1&&(e.push(a),a=[]),a.push(n)}return a.length>0&&e.push(a),e}(g);for(const n of a){const a=n.map(t=>c.allCaps?t.char.toUpperCase():t.char).join("");0!==a.length&&t.drawText(e,{x:CM(i+n[0].left),y:CM(f),text:a,fontSize:p,color:c.color??"#000000",bold:c.bold,italic:c.italic,fontResourceName:h.writerResourceName,characterSpacing:c.characterSpacing??0,horizontalScale:c.characterScale??100})}}c.underline&&eT(t,e,n,r,i,l,c,"underline"),c.strike&&eT(t,e,n,r,i,l,c,"strike"),c.doubleStrike&&eT(t,e,n,r,i,l,c,"doubleStrike")}const rT=["•","○","▪","•","○","▪"],oT=["decimal","lowerLetter","lowerRoman","decimal","lowerLetter","lowerRoman"];function iT(t){if(t<=0)return String(t);let e=t,a="";for(;e>0;){const t=(e-1)%26;a=String.fromCharCode(65+t)+a,e=Math.floor((e-1)/26)}return a}function lT(t){if(t<=0||t>=4e3)return String(t);const e=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];let a=t,n="";for(const[r,o]of e)for(;a>=r;)n+=o,a-=r;return n}function sT(t,e){if(!t.list)return"";const a=Math.max(0,t.list.level??0);if("bullet"===t.list.kind)return rT[a%rT.length];return`${function(t,e){switch(e){case"lowerLetter":return iT(t).toLowerCase();case"upperLetter":return iT(t).toUpperCase();case"lowerRoman":return lT(t).toLowerCase();case"upperRoman":return lT(t).toUpperCase();default:return String(t)}}(e.get(t.id)??t.list.startAt??1,t.list.format&&"bullet"!==t.list.format?t.list.format:oT[a%oT.length])}.`}function dT(t,e,a,n,r,o,i,l,s){var d;if(0!==n.index)return;const c=sT(a,s);if(!c)return;if(!n.slots[0])return;const h=Ne(void 0,null==(d=a.style)?void 0:d.styleId,r.styles),p=l.resolveFontFace({fontFamily:h.fontFamily,bold:h.bold,italic:h.italic}),u=$o(a,r.styles);t.drawText(e,{x:CM(o+Math.max(0,u)),y:CM(i+n.top+.8*n.height),text:c,fontSize:kM(h),color:h.color??"#000000",bold:h.bold,italic:h.italic,fontResourceName:p.writerResourceName})}function cT(t,e,a,n,r,o,i){const l=[[a.borderTop,"top"],[a.borderRight,"right"],[a.borderBottom,"bottom"],[a.borderLeft,"left"]],s=l.some(([t])=>t&&"none"!==t.type&&t.width>0);if(!a.shading&&!s)return;let d=0;for(const g of n)d=Math.max(d,g.top+g.height);if(d<=0)return;const c=Mn(a),h=c.top+d+c.bottom,p=r+(a.indentLeft??0),u=r+i-(a.indentRight??0),f=o+h;a.shading&&t.drawRect(e,{x:CM(p),y:CM(o),width:CM(Math.max(0,u-p)),height:CM(h),fill:a.shading});for(const[g,m]of l){if(!g||"none"===g.type||g.width<=0)continue;const[a,n,r,i]="top"===m?[p,o,u,o]:"bottom"===m?[p,f,u,f]:"left"===m?[p,o,p,f]:[u,o,u,f];t.drawLine(e,{x1:CM(a),y1:CM(n),x2:CM(r),y2:CM(i),stroke:g.color,lineWidth:g.width,dashArray:ZI(g.type)})}}async function hT(t,e,a,n,r,o,i,l,s){for(const d of n){dT(t,e,a,d,r,o,i,l,s);for(const n of d.fragments)await nT(t,e,a,d,n,r,o,i,l)}}async function pT(t,e,a,n,r,o,i,l,s,d){if(!a||0===a.length)return;const c=o;let h=o;for(const p of a){if("paragraph"===p.sourceBlock.type&&p.layout){const a=qe(p.sourceBlock.style,n.styles),u=h+(0===p.layout.startOffset&&h>o?a.spacingBefore??0:0),f=u+Mn(a).top;cT(t,e,a,p.layout.lines,r,u,i),await hT(t,e,p.sourceBlock,p.layout.lines,n,r,f,l,s),d&&await JI({writer:t,document:n,fontRegistry:l,pageIndex:e,lines:p.layout.lines,pageSettings:d,contentLeft:r,contentTop:c,contentWidth:i,paragraphTop:u})}else"table"===p.sourceBlock.type&&await jI(t,e,p,n,r,h,i,l,s);h+=Math.max(0,p.estimatedHeight)}}function uT(t,e,a,n){t.drawRect(e,{x:0,y:0,width:a,height:n,fill:"#ffffff"})}const fT=[{key:"helvetica:regular",family:"Helvetica",bold:!1,italic:!1,writerResourceName:"F1",pdfResource:{kind:"base14",resourceName:"F1",baseFont:"Helvetica"}},{key:"helvetica:bold",family:"Helvetica",bold:!0,italic:!1,writerResourceName:"F2",pdfResource:{kind:"base14",resourceName:"F2",baseFont:"Helvetica-Bold"}},{key:"helvetica:italic",family:"Helvetica",bold:!1,italic:!0,writerResourceName:"F3",pdfResource:{kind:"base14",resourceName:"F3",baseFont:"Helvetica-Oblique"}},{key:"helvetica:bolditalic",family:"Helvetica",bold:!0,italic:!0,writerResourceName:"F4",pdfResource:{kind:"base14",resourceName:"F4",baseFont:"Helvetica-BoldOblique"}}];function gT(t,e,a){return`${t.toLowerCase()}:${e?"bold":"regular"}${a?"italic":""}`}function mT(t){return t.replace(/[^A-Za-z0-9_]/g,"")}class vT{constructor(){a(this,"faces",new Map),a(this,"fallbackFamily","Helvetica");for(const t of fT)this.registerFontFace(t)}registerFontFace(t){this.faces.set(gT(t.family,t.bold,t.italic),t)}resolveFontFace(t){const e=_r(t.fontFamily),a=Boolean(t.bold),n=Boolean(t.italic);return this.faces.get(gT(e,a,n))??this.faces.get(gT(this.fallbackFamily,a,n))??this.faces.get(gT(this.fallbackFamily,!1,!1))}getPdfFontResources(){const t=new Map;for(const e of this.faces.values())t.set(e.pdfResource.resourceName,e.pdfResource);return Array.from(t.values())}async loadBundledUnicodeFaces(t={}){const e=t.families?new Set(Array.from(t.families).map(_r).map(t=>t.toLowerCase())):null,a=await this.registerOfficeCompatibleFaces(e);if(!e||e.has("roboto")||Array.from(e).some(t=>"helvetica"!==t&&!a.has(t)))for(const[n,r]of Object.entries(Yr)){const t=await io(r);if(!t)continue;const e="bold"===n||"bolditalic"===n,a="italic"===n||"bolditalic"===n,o=`Roboto${n[0].toUpperCase()}${n.slice(1)}`;this.registerFontFace({key:`roboto:${n}`,family:"Roboto",bold:e,italic:a,writerResourceName:o,pdfResource:{kind:"unicode",resourceName:o,family:"Roboto",fontData:t}}),this.fallbackFamily="Roboto"}}async registerOfficeCompatibleFaces(t){const e=new Set;for(const a of Qr){const n=[a.family,...a.aliases].map(t=>t.toLowerCase());if(!(!t||n.some(e=>t.has(e))))continue;for(const t of n)e.add(t);const r=[];for(const[t,e]of Object.entries(a.files)){const n=await io(e);if(!n)continue;const o="bold"===t||"bolditalic"===t,i="italic"===t||"bolditalic"===t,l=`${mT(a.family)}${t[0].toUpperCase()}${t.slice(1)}`,s={key:`${a.family.toLowerCase()}:${t}`,family:a.family,bold:o,italic:i,writerResourceName:l,pdfResource:{kind:"unicode",resourceName:l,family:a.family,fontData:n}};this.registerFontFace(s),r.push(s)}for(const t of a.aliases)for(const e of r)this.registerFontFace({...e,key:`${t.toLowerCase()}:${e.key.split(":")[1]}`,family:t})}return e}}class bT{constructor(t){this.font=t}layout(t){const e=[],a=[];let n=0;for(const r of t){const t=r.codePointAt(0)??65533,o=this.font.glyphForCodePoint(t),i=this.font.advanceWidthForGlyph(o);e.push({id:o,codePoints:0===o?[65533]:[t],advanceWidth:i}),a.push({xAdvance:i}),n+=i}return{glyphs:e,positions:a,advanceWidth:n}}}function yT(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function MT(t,e){return yT(t).getUint16(e)}function xT(t,e,a){yT(t).setUint16(e,a,!1)}function wT(t,e,a){yT(t).setUint32(e,a,!1)}function ST(t){return t+3&-4}function AT(t){const e=t.reduce((t,e)=>t+ST(e.byteLength),0),a=new Uint8Array(e);let n=0;for(const r of t)a.set(r,n),n+=ST(r.byteLength);return a}function IT(t,e){const a=[],n=yT(t);if(0===e)for(let r=0;r+1<t.byteLength;r+=2)a.push(2*n.getUint16(r));else for(let r=0;r+3<t.byteLength;r+=4)a.push(n.getUint32(r));return a}function TT(t,e){const a=t[e],n=t[e+1];return void 0===a||void 0===n?null:{start:a,end:n}}function CT(t,e){if(t.byteLength<10||function(t,e){return yT(t).getInt16(e)}(t,0)>=0)return;let a=10,n=0;do{if(a+4>t.byteLength)return;n=MT(t,a),e(MT(t,a+2)),a+=4,a+=1&n?4:2,8&n?a+=2:64&n?a+=4:128&n&&(a+=8)}while(32&n)}function kT(t){const e=new Uint8Array(4*t.length);return t.forEach((t,a)=>wT(e,4*a,t)),e}function VT(t,e){const a=new Uint8Array(4*(e+1));for(let n=0;n<=e;n+=1)xT(a,4*n,t.advanceWidthForGlyph(n)),xT(a,4*n+2,0);return a}class ET{createSubset(t,e){const a=new Map,n=[];for(const c of e)n.push(c.id),a.has(c.id)||a.set(c.id,c.codePoints);const r=function(t,e){const a=t.getRawTableData("glyf"),n=t.getRawTableData("loca"),r=t.getRawTableData("head");if(!a||!n||!r)return Array.from(new Set([0,...e])).sort((t,e)=>t-e);const o=IT(n,MT(r,50)),i=new Set([0,...e]),l=Array.from(i);for(;l.length>0;){const t=TT(o,l.pop());!t||t.end<=t.start||t.end>a.byteLength||CT(a.slice(t.start,t.end),t=>{i.has(t)||(i.add(t),l.push(t))})}return Array.from(i).sort((t,e)=>t-e)}(t,n),o=function(t,e){const a=t.getRawTableData("glyf"),n=t.getRawTableData("loca"),r=t.getRawTableData("head"),o=t.getRawTableData("hhea"),i=t.getRawTableData("maxp"),l=t.getRawTableData("cmap");if(!(a&&n&&r&&o&&i&&l))throw new Error("Missing required TrueType tables for subsetting");const s=Math.max(0,...e),d=new Set(e),c=IT(n,MT(r,50)),h=[],p=[];let u=0;for(let b=0;b<=s;b+=1){h.push(u);const t=TT(c,b);if(d.has(b)&&t&&t.end>t.start){const e=a.slice(t.start,t.end);p.push(e),u+=ST(e.byteLength)}}h.push(u);const f=r.slice();wT(f,8,0),xT(f,50,1);const g=o.slice();xT(g,34,s+1);const m=i.slice();xT(m,4,s+1);const v={cmap:l,head:f,hhea:g,hmtx:VT(t,s),loca:kT(h),maxp:m,glyf:AT(p)};for(const b of["OS/2","name","post"]){const e=t.getRawTableData(b);e&&(v[b]=e)}return v}(t,r),i=Cr(65536,new Map(Object.entries(o).map(([t,e])=>[t.charCodeAt(0)<<24|t.charCodeAt(1)<<16|t.charCodeAt(2)<<8|t.charCodeAt(3),e]))).ttf,l=Math.max(0,...r),s=[],d=[];for(let c=0;c<=l;c+=1)s[c]=t.advanceWidthForGlyph(c)/t.unitsPerEm*1e3,d[c]=a.get(c)??[0];return{fontFile:i,widths:s,unicode:d,encodeGlyph:t=>t}}}const RT=[{kind:"base14",resourceName:"F1",baseFont:"Helvetica"},{kind:"base14",resourceName:"F2",baseFont:"Helvetica-Bold"},{kind:"base14",resourceName:"F3",baseFont:"Helvetica-Oblique"},{kind:"base14",resourceName:"F4",baseFont:"Helvetica-BoldOblique"}];function LT(t){return Number.isFinite(t)?Number(t.toFixed(3)).toString():"0"}function zT(t){return(new TextEncoder).encode(t).byteLength}function NT(t){return Array.from(t).map(t=>t.toString(16).padStart(2,"0").toUpperCase()).join("")}function qT(t){return Math.max(0,t).toString(16).padStart(4,"0").slice(-4).toUpperCase()}function OT(t,e,a){const[n,r,o]=function(t,e){if(!t)return e;const a=t.trim().replace(/^#/,"");return/^[0-9a-fA-F]{6}$/.test(a)?[Number.parseInt(a.slice(0,2),16)/255,Number.parseInt(a.slice(2,4),16)/255,Number.parseInt(a.slice(4,6),16)/255]:e}(t,a);return`${LT(n)} ${LT(r)} ${LT(o)} ${e}`}function PT(t,e){return(t&&t.trim().length>0?t:e).replaceAll(" ","_").replace(/[^A-Za-z0-9_.+-]/g,"")}const WT=new Map([[8364,128],[8218,130],[402,131],[8222,132],[8230,133],[8224,134],[8225,135],[710,136],[8240,137],[352,138],[8249,139],[338,140],[381,142],[8216,145],[8217,146],[8220,147],[8221,148],[8226,149],[8211,150],[8212,151],[732,152],[8482,153],[353,154],[8250,155],[339,156],[382,158],[376,159]]);function HT(t){return Array.from(t).map(t=>function(t){const e=t.codePointAt(0)??63;return e>=32&&e<=126||e>=160&&e<=255?e:WT.get(e)??63}(t).toString(16).padStart(2,"0").toUpperCase()).join("")}function UT(t){const e=[];for(let a of t)a>65535?(a-=65536,e.push(a>>>10&1023|55296),e.push(1023&a|56320)):e.push(a);return e.map(qT).join("")}function FT(t){return qT(t)}function BT(t){return`% OasisText ${UT(Array.from(t).map(t=>t.codePointAt(0)??65533))}`}class GT{constructor(t=RT){a(this,"pages",[]),a(this,"fontResources",new Map),a(this,"unicodeFontStates",new Map),a(this,"usedFontResourceNames",new Set),a(this,"imageResources",new Map);for(const e of t)this.registerFontResource(e)}registerFontResource(t){if(this.fontResources.set(t.resourceName,t),"unicode"===t.kind&&!this.unicodeFontStates.has(t.resourceName)){const a={program:e=function(t){const e=Jr.decodeSync(t);return Mo.parse(e)}(t.fontData),layouter:new bT(e),subsetter:new ET},n=1e3/a.program.unitsPerEm,r={id:0,codePoints:[0],advanceWidth:a.program.advanceWidthForGlyph(0)};this.unicodeFontStates.set(t.resourceName,{resource:t,font:a,usedGlyphs:new Map([[0,r]]),scale:n,layoutCache:new Map})}var e}addPage(t){return this.pages.push({width:Math.max(1,t.width),height:Math.max(1,t.height),commands:[],imageResourceNames:new Set}),this.pages.length-1}getPageCount(){return this.pages.length}drawRect(t,e){const a=this.pages[t];if(!a||e.width<=0||e.height<=0)return;const n=["q"];e.fill&&n.push(OT(e.fill,"rg",[1,1,1])),e.stroke&&(n.push(OT(e.stroke,"RG",[0,0,0])),n.push(`${LT(e.lineWidth??1)} w`)),n.push([LT(e.x),LT(a.height-e.y-e.height),LT(e.width),LT(e.height),"re"].join(" ")),e.fill&&e.stroke?n.push("B"):e.fill?n.push("f"):e.stroke&&n.push("S"),n.push("Q"),a.commands.push(n.join("\n"))}drawLine(t,e){const a=this.pages[t];if(!a)return;const n=e.dashArray&&e.dashArray.length>0?`[${e.dashArray.map(t=>LT(t)).join(" ")}] 0 d`:null,r=["q",OT(e.stroke,"RG",[0,0,0])];n&&r.push(n),r.push(`${LT(e.lineWidth??1)} w`,`${LT(e.x1)} ${LT(a.height-e.y1)} m`,`${LT(e.x2)} ${LT(a.height-e.y2)} l`,"S","Q"),a.commands.push(r.join("\n"))}drawPath(t,e){const a=this.pages[t];if(!a||0===e.segments.length)return;if(!e.fill&&!e.stroke)return;const n=t=>a.height-t,r=["q"];e.fill&&r.push(OT(e.fill,"rg",[1,1,1])),e.stroke&&(r.push(OT(e.stroke,"RG",[0,0,0])),r.push(`${LT(e.lineWidth??1)} w`));for(const o of e.segments)switch(o.type){case"move":r.push(`${LT(o.x)} ${LT(n(o.y))} m`);break;case"line":r.push(`${LT(o.x)} ${LT(n(o.y))} l`);break;case"cubic":r.push(`${LT(o.x1)} ${LT(n(o.y1))} ${LT(o.x2)} ${LT(n(o.y2))} ${LT(o.x)} ${LT(n(o.y))} c`);break;case"close":r.push("h")}e.fill&&e.stroke?r.push("B"):e.fill?r.push("f"):r.push("S"),r.push("Q"),a.commands.push(r.join("\n"))}saveGraphicsState(t){const e=this.pages[t];e&&e.commands.push("q")}restoreGraphicsState(t){const e=this.pages[t];e&&e.commands.push("Q")}rotateAbout(t,e,a,n){const r=this.pages[t];if(!r||!n)return;const o=r.height-a,i=-n*Math.PI/180,l=Math.cos(i),s=Math.sin(i),d=e-e*l+o*s,c=o-e*s-o*l;r.commands.push(`${LT(l)} ${LT(s)} ${LT(-s)} ${LT(l)} ${LT(d)} ${LT(c)} cm`)}clipRect(t,e,a,n,r){const o=this.pages[t];!o||n<=0||r<=0||o.commands.push(`${LT(e)} ${LT(o.height-a-r)} ${LT(n)} ${LT(r)} re`,"W","n")}drawText(t,e){const a=this.pages[t];if(!a||0===e.text.length)return;const n=function(t){return t.fontResourceName?t.fontResourceName:t.bold&&t.italic?"F4":t.bold?"F2":t.italic?"F3":"F1"}(e);this.usedFontResourceNames.add(n);const r=this.unicodeFontStates.get(n);r?this.drawUnicodeText(a,r,e):a.commands.push([BT(e.text),"BT",OT(e.color,"rg",[0,0,0]),`/${n} ${LT(e.fontSize??12)} Tf`,...e.horizontalScale&&e.horizontalScale>0&&100!==e.horizontalScale?[`${LT(e.horizontalScale)} Tz`]:[],...e.characterSpacing&&0!==e.characterSpacing?[`${LT(e.characterSpacing)} Tc`]:[],`${LT(e.x)} ${LT(a.height-e.y)} Td`,`<${HT(e.text)}> Tj`,"ET"].join("\n"))}registerImageResource(t){const e=t.resourceName??`Im${this.imageResources.size+1}`;return this.imageResources.has(e)||this.imageResources.set(e,{resourceName:e,width:Math.max(1,Math.round(t.width)),height:Math.max(1,Math.round(t.height)),data:t.data,filter:t.filter}),e}drawImage(t,e){const a=this.pages[t];if(!a||e.width<=0||e.height<=0||!this.imageResources.has(e.resourceName))return;a.imageResourceNames.add(e.resourceName);const n=a.height-e.y-e.height,r=Number.isFinite(e.rotation)?e.rotation??0:0;if(0===r)return void a.commands.push(["q",[LT(e.width),"0","0",LT(e.height),LT(e.x),LT(n),"cm"].join(" "),`/${e.resourceName} Do`,"Q"].join("\n"));const o=-r*Math.PI/180,i=Math.cos(o),l=Math.sin(o),s=e.width*i,d=e.width*l,c=-e.height*l,h=e.height*i,p=e.x+e.width/2-.5*s-.5*c,u=n+e.height/2-.5*d-.5*h;a.commands.push(["q",[LT(s),LT(d),LT(c),LT(h),LT(p),LT(u),"cm"].join(" "),`/${e.resourceName} Do`,"Q"].join("\n"))}layoutUnicodeText(t,e){const a=t.layoutCache.get(e);if(a)return a;const n=t.font.layouter.layout(e);return t.layoutCache.set(e,n),n}encodeUnicodeGlyphRun(t,e){return e.glyphs.map((a,n)=>{t.usedGlyphs.has(a.id)||t.usedGlyphs.set(a.id,a);const r=e.positions[n],o=a.advanceWidth*t.scale,i=((null==r?void 0:r.xAdvance)??a.advanceWidth)*t.scale;return{glyphId:a.id,nominalWidth:o,desiredAdvance:i}})}drawUnicodeText(t,e,a){const n=this.layoutUnicodeText(e,a.text),r=this.encodeUnicodeGlyphRun(e,n);if(0===r.length)return;const o=r.some(t=>Math.abs(t.nominalWidth-t.desiredAdvance)>.01)?`[${r.map(t=>{const e=t.nominalWidth-t.desiredAdvance;return 0===e?`<${FT(t.glyphId)}>`:`<${FT(t.glyphId)}> ${LT(e)}`}).join(" ")}] TJ`:`<${r.map(t=>FT(t.glyphId)).join("")}> Tj`;t.commands.push([BT(a.text),"BT",OT(a.color,"rg",[0,0,0]),`/${e.resource.resourceName} ${LT(a.fontSize??12)} Tf`,...a.horizontalScale&&a.horizontalScale>0&&100!==a.horizontalScale?[`${LT(a.horizontalScale)} Tz`]:[],...a.characterSpacing&&0!==a.characterSpacing?[`${LT(a.characterSpacing)} Tc`]:[],`${LT(a.x)} ${LT(t.height-a.y)} Td`,o,"ET"].join("\n"))}toArrayBuffer(){const t=this.toUint8Array();return Uint8Array.from(t).buffer}toBlob(){return new Blob([this.toArrayBuffer()],{type:"application/pdf"})}toUint8Array(){0===this.pages.length&&this.addPage({width:612,height:792});const t=[],e=e=>{const a=t.length+1;return t.push({id:a,body:e}),a},a=e(""),n=e(""),r=Array.from(this.fontResources.values()).filter(t=>"base14"===t.kind||this.usedFontResourceNames.has(t.resourceName)),o=r.map(t=>{if("unicode"===t.kind){const a=this.unicodeFontStates.get(t.resourceName);if(a)return this.addUnicodeFontObjects(a,e)}return e(function(t){switch(t.kind){case"base14":return`<< /Type /Font /Subtype /Type1 /BaseFont /${t.baseFont} /Encoding /WinAnsiEncoding >>`;case"unicode":return"<< /Type /Font /Subtype /Type0 /BaseFont /OasisPending /Encoding /Identity-H >>"}}(t))}),i=r.map((t,e)=>`/${t.resourceName} ${o[e]} 0 R`).join(" "),l=new Map;for(const p of this.imageResources.values())l.set(p.resourceName,this.addImageObject(p,e));const s=[];for(const p of this.pages){const t=`${p.commands.join("\n")}\n`,a=e(`<< /Length ${zT(t)} >>\nstream\n${t}endstream`),r=Array.from(p.imageResourceNames).map(t=>{const e=l.get(t);return e?`/${t} ${e} 0 R`:""}).filter(Boolean).join(" "),o=r?` /XObject << ${r} >>`:"",d=e(["<< /Type /Page",`/Parent ${n} 0 R`,`/MediaBox [0 0 ${LT(p.width)} ${LT(p.height)}]`,`/Resources << /Font << ${i} >>${o} >>`,`/Contents ${a} 0 R`,">>"].join("\n"));s.push(d)}t[a-1].body=`<< /Type /Catalog /Pages ${n} 0 R >>`,t[n-1].body=["<< /Type /Pages",`/Kids [${s.map(t=>`${t} 0 R`).join(" ")}]`,`/Count ${s.length}`,">>"].join("\n");let d="%PDF-1.4\n% Oasis PDF\n";const c=[0];for(const p of t)c[p.id]=zT(d),d+=`${p.id} 0 obj\n${p.body}\nendobj\n`;const h=zT(d);d+=`xref\n0 ${t.length+1}\n`,d+="0000000000 65535 f \n";for(const p of t)d+=`${String(c[p.id]??0).padStart(10,"0")} 00000 n \n`;return d+=["trailer",`<< /Size ${t.length+1} /Root ${a} 0 R >>`,"startxref",String(h),"%%EOF",""].join("\n"),(new TextEncoder).encode(d)}addImageObject(t,e){return e(function(t,e){const a=`${NT(t)}>`;return[`<< /Length ${zT(a)}`," /Filter [/ASCIIHexDecode /DCTDecode]",` ${e.join(" ")}`," >>","stream",a,"endstream"].join("\n")}(t.data,["/Type /XObject","/Subtype /Image",`/Width ${t.width}`,`/Height ${t.height}`,"/ColorSpace /DeviceRGB","/BitsPerComponent 8"]))}addUnicodeFontObjects(t,e){const a=t.font.subsetter.createSubset(t.font.program,t.usedGlyphs.values()),n=e(function(t,e=""){const a=`${NT(t)}>`,n=e?` /${e.trim().replace(/^\/+/,"")}`:"";return`<< /Length ${zT(a)} /Filter /ASCIIHexDecode${n} >>\nstream\n${a}\nendstream`}(a.fontFile)),r=t.font.program.metadata,o=r.familyClass>>8||0;let i=4;r.isFixedPitch&&(i|=1),o>=1&&o<=7&&(i|=2),10===o&&(i|=8),r.macStyleItalic&&(i|=64);const l=`${PT(`${t.resource.resourceName}AAAAAA`,"OASISF").slice(0,6).padEnd(6,"A")}+${PT(r.postscriptName,t.resource.family)}`,s=r.bbox,d=e(["<< /Type /FontDescriptor",`/FontName /${l}`,`/Flags ${i}`,`/FontBBox [${[s.minX*t.scale,s.minY*t.scale,s.maxX*t.scale,s.maxY*t.scale].map(LT).join(" ")}]`,`/ItalicAngle ${LT(r.italicAngle)}`,`/Ascent ${LT(r.ascent*t.scale)}`,`/Descent ${LT(r.descent*t.scale)}`,`/CapHeight ${LT(r.capHeight*t.scale)}`,`/XHeight ${LT(r.xHeight*t.scale)}`,"/StemV 0",`/FontFile2 ${n} 0 R`,">>"].join("\n")),c=e(["<< /Type /Font","/Subtype /CIDFontType2",`/BaseFont /${l}`,"/CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >>",`/FontDescriptor ${d} 0 R`,`/W [0 [${a.widths.map(t=>LT(t??0)).join(" ")}]]`,"/CIDToGIDMap /Identity",">>"].filter(Boolean).join("\n")),h=e(function(t,e=""){const a=e?` /${e.trim().replace(/^\/+/,"")}`:"";return`<< /Length ${zT(t)}${a} >>\nstream\n${t}endstream`}(function(t){const e=t.map(t=>`<${UT(t)}>`).filter(t=>"<>"!==t);0===e.length&&e.push("<0000>");const a=[];for(let n=0;n<e.length;n+=256){const t=Math.min(n+256,e.length);a.push(`<${qT(n)}> <${qT(t-1)}> [${e.slice(n,t).join(" ")}]`)}return["/CIDInit /ProcSet findresource begin","12 dict begin","begincmap","/CIDSystemInfo <<"," /Registry (Adobe)"," /Ordering (UCS)"," /Supplement 0",">> def","/CMapName /Adobe-Identity-UCS def","/CMapType 2 def","1 begincodespacerange","<0000><ffff>","endcodespacerange",`${a.length} beginbfrange`,a.join("\n"),"endbfrange","endcmap","CMapName currentdict /CMap defineresource pop","end","end",""].join("\n")}(a.unicode)));return e(["<< /Type /Font","/Subtype /Type0",`/BaseFont /${l}`,"/Encoding /Identity-H",`/DescendantFonts [${c} 0 R]`,`/ToUnicode ${h} 0 R`,">>"].join("\n"))}}async function ZT(t){t=hw(t);const e=new vT;await e.loadBundledUnicodeFaces({families:Hh(t)});const a=new GT(e.getPdfFontResources()),n=os(t),r=function(t){const e=new Map,a=Ke(t);let n=[],r=!1;for(const o of a){const t=o.list;if(!t||"ordered"!==t.kind){n=[],r=!1;continue}const a=t.level??0;for(r||(n=[]),n.length>a+1&&(n.length=a+1);n.length<=a;)n.push(0);n[a]=0===n[a]&&"number"==typeof t.startAt?t.startAt:n[a]+1,e.set(o.id,n[a]),r=!0}return e}(t);for(const o of n.pages){const n=Math.max(1,CM(o.pageSettings.width)),i=Math.max(1,CM(o.pageSettings.height)),l=a.addPage({width:n,height:i});uT(a,l,n,i);const s=o.pageSettings.margins.left+o.pageSettings.margins.gutter,d=ve(o.pageSettings);await pT(a,l,o.headerBlocks,t,s,o.headerTop??Me(o.pageSettings),d,e,r,o.pageSettings);const c=o.bodyTop??xe(o.pageSettings);if(o.blocks.some(t=>void 0!==t.columnIndex)){const n=be(o.pageSettings),i=new Map;for(const t of o.blocks){const e=t.columnIndex??0,a=i.get(e)??[];a.push(t),i.set(e,a)}for(const[s,d]of i){const i=n[s]??n[0];await pT(a,l,d,t,i.left,c,i.width,e,r,o.pageSettings)}}else await pT(a,l,o.blocks,t,s,c,d,e,r,o.pageSettings);await pT(a,l,o.footerBlocks,t,s,o.footerTop??o.bodyBottom??o.pageSettings.height,d,e,r,o.pageSettings),o.footnoteBlocks&&o.footnoteBlocks.length>0&&void 0!==o.footnoteTop&&(void 0!==o.footnoteSeparatorTop&&a.drawLine(l,{x1:CM(s),y1:CM(o.footnoteSeparatorTop+.5),x2:CM(s+Math.min(180,.35*d)),y2:CM(o.footnoteSeparatorTop+.5),stroke:"#64748b",lineWidth:CM(1)}),await KT(a,l,o.footnoteBlocks,o.footnoteReferenceIds??[],t,s,o.footnoteTop,d,e,r))}if(0===a.getPageCount()){const t=a.addPage({width:612,height:792});uT(a,t,612,792)}return a.toArrayBuffer()}async function KT(t,e,a,n,r,o,i,l,s,d){var c;let h=i;const p=new Set,u=new Map(n.map(t=>{var e;return[t,(null==(e=Xl(r,t))?void 0:e.run.text)??""]}));for(const f of a){const a=n.find(t=>f.blockId.startsWith(`${t}:`));if(a&&!p.has(a)){const n=u.get(a);if(n){const a="paragraph"===f.sourceBlock.type?f.sourceBlock:void 0,i=Ne(void 0,null==(c=null==a?void 0:a.style)?void 0:c.styleId,r.styles),l=s.resolveFontFace({fontFamily:i.fontFamily,bold:i.bold,italic:i.italic});t.drawText(e,{x:CM(o),y:CM(h+12),text:n,fontSize:kM(i),color:i.color??"#000000",bold:i.bold,italic:i.italic,fontResourceName:l.writerResourceName})}p.add(a)}await pT(t,e,[f],r,o+cn,h,Math.max(24,l-cn),s,d),h+=Math.max(0,f.estimatedHeight)+2}}function DT(t,e){const a=URL.createObjectURL(t),n=document.createElement("a");n.href=a,n.download=e,n.click(),URL.revokeObjectURL(a)}function jT(t){const e=t.download??DT;return{handleExportDocx:async()=>{const a=await async function(t){const e=await GI(t);return new Blob([e],{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"})}(t.document());e(a,"oasis-editor.docx"),t.focusInput()},handleExportPdf:async()=>{const a=await async function(t){const e=await ZT(t);return new Blob([e],{type:"application/pdf"})}(t.document());e(a,"oasis-editor.pdf"),t.focusInput()}}}async function XT(t){return"function"==typeof t.arrayBuffer?t.arrayBuffer():new Promise((e,a)=>{const n=new FileReader;n.onerror=()=>a(n.error??new Error("Failed to read file.")),n.onload=()=>{const t=n.result;t instanceof ArrayBuffer?e(t):a(new Error("Failed to read file as ArrayBuffer."))},n.readAsArrayBuffer(t)})}function JT(t){if(!t)return null;for(const e of Array.from(t.items??[])){if("file"!==e.kind)continue;const t=e.getAsFile();if(t&&t.type.startsWith("image/"))return t}for(const e of Array.from(t.files??[]))if(e.type.startsWith("image/"))return e;return null}function YT(t){return{handleImportFile:async e=>{if(!e)return;const a=function(t){return fy.find(e=>e.matches(t))}(e);if(!a)return t.setImportPhase("error"),t.logger.error("import:unsupported-format",{name:e.name,type:e.type}),void t.clearImportProgressSoon();const n=t.now();t.logger.info("import:start",{format:a.id,name:e.name,size:e.size}),t.setImportPhase("reading-file");try{const r=t.now(),o=await XT(e);t.logger.info("import:phase",{phase:"reading-file",durationMs:Math.round(100*(t.now()-r))/100});let i=null,l=-1,s=0;const d=await a.import(o,(e,a)=>{const n=t.now(),r=void 0!==a&&Number.isFinite(a)?Math.floor(100*a):void 0,o=e!==i;if(!o&&!(void 0!==r&&(l<0||r-l>=1))&&!(n-s>=40))return;i=e,l=r??l,s=n,t.setImportPhase(e,a);const d={phase:e,subProgress:a};o||void 0===a||1===a?t.logger.info("import:phase",d):t.logger.debug("import:phase",d)});t.logger.info("import:document-diagnostics",function(t){var e;const a=Ke(t),n=new Map,r=new Map;let o=0,i=0;for(const l of a){const a=qe(l.style,t.styles);r.set(a.align,(r.get(a.align)??0)+1);for(const r of l.runs){const a=Ne(r.styles,null==(e=l.style)?void 0:e.styleId,t.styles),s=a.fontFamily??"<null>";n.set(s,(n.get(s)??0)+1),null!==a.characterSpacing&&(o+=1),null!==a.characterScale&&(i+=1)}}return{paragraphCount:a.length,alignCounts:Array.from(r.entries()),fontCounts:Array.from(n.entries()),characterSpacingRuns:o,characterScaleRuns:i,firstParagraphs:a.slice(0,30).map((e,a)=>{var n;const r=qe(e.style,t.styles),o=e.runs[0],i=Ne(null==o?void 0:o.styles,null==(n=e.style)?void 0:n.styleId,t.styles);return{index:a,text:Se(e).slice(0,160),runCount:e.runs.length,rawParagraphStyle:e.style,align:r.align,indentFirstLine:r.indentFirstLine,lineGridPitch:r.lineGridPitch,lineGridType:r.lineGridType,fontFamily:i.fontFamily,fontSize:i.fontSize,characterSpacing:i.characterSpacing,characterScale:i.characterScale,firstRunStyle:null==o?void 0:o.styles}})}}(d)),t.setImportPhase("applying-editor-state"),t.resetEditorChromeState(),t.applyState(Ca(d));const c=t.now();t.setImportPhase("stabilizing-layout"),await t.stabilizeLayoutAfterImport(),t.logger.info("import:phase",{phase:"stabilizing-layout",durationMs:Math.round(100*(t.now()-c))/100});const h=Pe(d).reduce((t,e)=>{var a,n;return t+((null==(a=e.header)?void 0:a.length)??0)+e.blocks.length+((null==(n=e.footer)?void 0:n.length)??0)},0),p=Ze(d).length;t.setImportPhase("done"),t.logger.info("import:done",{format:a.id,blocks:h,paragraphs:p,durationMs:Math.round(100*(t.now()-n))/100}),t.focusInput()}catch(r){t.setImportPhase("error"),t.logger.error("import:error",r)}finally{t.clearImportProgressSoon()}}}}function QT(t){return{insertImageFromFile:async(e,a)=>{t.logger.info(`image insert:start name="${e.name}" type=${e.type} size=${e.size}`);const n=await XT(e),r=`data:${e.type};base64,${function(t){return btoa(new Uint8Array(t).reduce((t,e)=>t+String.fromCharCode(e),""))}(n)}`,o=new Image;o.src=r,await new Promise(t=>{o.onload=t,o.onerror=t});const i=o.naturalWidth||300,l=o.naturalHeight||300,s=t.state(),d=(null==a?void 0:a.paragraphId)??s.selection.focus.paragraphId,c=kA(t.surfaceRef(),s.document,d,s.activeSectionIndex??0),h=i>c?c/i:1,p=Math.max(24,Math.round(i*h)),u=Math.max(24,Math.round(l*h));t.logger.info(`image insert:decoded natural=${i}x${l} fitted=${p}x${u} maxWidth=${c}`),t.applyTransactionalState(t=>function(t,e){const a=na(t.selection)?t:Rw(t),{paragraph:n,index:r,offset:o}=Ew(a),i=ww(n,o,[va("",yw(n,o),e)]);return Cw(a,_e(a).map((t,e)=>e===r?i:ew(t)),Vw(Ie(i,o+1)))}(a?CS(t,{anchor:a,focus:a}):t,{src:r,width:p,height:u}),{mergeKey:"insertImage"})}}}const _T={"reading-file":[0,8],opening:[8,20],parsing:[20,72],finishing:[72,78],"applying-editor-state":[78,88],"stabilizing-layout":[88,98],done:[100,100],error:[100,100]};function $T(t){const[e,a]=y(void 0),n=()=>{a(void 0)};x(()=>{na(t.state().selection)||n()});const r=()=>{const a=up(t.state()),n=e();return na(t.state().selection)&&n?{...a,bold:n.bold??a.bold,italic:n.italic??a.italic,underline:n.underline??a.underline,underlineStyle:void 0!==n.underlineStyle&&null!==n.underlineStyle?String(n.underlineStyle):a.underlineStyle,strike:n.strike??a.strike,superscript:n.superscript??a.superscript,subscript:n.subscript??a.subscript,fontFamily:n.fontFamily??a.fontFamily,fontSize:void 0!==n.fontSize&&null!==n.fontSize?String(n.fontSize):a.fontSize,color:n.color??a.color,highlight:n.highlight??a.highlight,textShading:n.shading??a.textShading,link:n.link??a.link}:a};return{pendingCaretTextStyle:e,clearPendingCaretTextStyle:n,toolbarStyleState:r,applyToolbarValueStyleCommand:(e,n)=>{if(na(t.state().selection))return t.logger.info(`setPendingStyle:${e}=${JSON.stringify(n)}`),t.clearPreferredColumn(),t.resetTransactionGrouping(),((t,e)=>{a(a=>{const n={...a??{}};return null==e||""===e?delete n[t]:n[t]=e,Object.keys(n).length>0?n:void 0})})(e,n),void t.focusInput();t.commandsController().applyValueStyleCommand(e,n)},applyToolbarBooleanStyleCommand:e=>{if(na(t.state().selection)){const n=!r()[e];return t.logger.info(`setPendingStyle:${e}=${JSON.stringify(n)}`),t.clearPreferredColumn(),t.resetTransactionGrouping(),((t,e)=>{a(a=>{const n={...a??{}};return n[t]=e,"superscript"===t&&e&&(n.subscript=!1),"subscript"===t&&e&&(n.superscript=!1),n})})(e,n),void t.focusInput()}t.commandsController().applyBooleanStyleCommand(e)}}}function tC(t){return{performUndo:()=>{const e=(a=t.getHistoryState(),n=t.stateSnapshot(),0===a.undoStack.length?null:{history:{undoStack:a.undoStack.slice(0,-1),redoStack:[...a.redoStack,n],lastTransactionMeta:null},nextState:a.undoStack[a.undoStack.length-1]});var a,n;e&&(t.updateHistoryState(()=>e.history),t.clearPreferredColumn(),t.applyHistoryState(e.nextState),t.focusInput())},performRedo:()=>{const e=(a=t.getHistoryState(),n=t.stateSnapshot(),0===a.redoStack.length?null:{history:{undoStack:[...a.undoStack,n],redoStack:a.redoStack.slice(0,-1),lastTransactionMeta:null},nextState:a.redoStack[a.redoStack.length-1]});var a,n;e&&(t.updateHistoryState(()=>e.history),t.clearPreferredColumn(),t.applyHistoryState(e.nextState),t.focusInput())},moveSelectedImageByParagraph:e=>{const a=t.imageOps().getSelectedImageInfo(t.state());if(!a)return!1;const n=_e(t.state()),r=n.findIndex(t=>t.id===a.paragraph.id);if(r<0)return!1;const o=r+e;if(o<0||o>=n.length){const a=((t,e)=>{const a=Pe(t.document),n=Math.max(0,Math.min(Je(t),a.length-1)),r=Ye(t),o=a[n];if(!o)return t;const i=[...a],l={...o},s=ba("");if("header"===r){const t=[...o.header??[]];e<0?t.unshift(s):t.push(s),l.header=t}else if("footer"===r){const t=[...o.footer??[]];e<0?t.unshift(s):t.push(s),l.footer=t}else{const t=[...o.blocks];e<0?t.unshift(s):t.push(s),l.blocks=t}return i[n]=l,{...t,document:{...t.document,sections:i}}})(t.state(),e),n=_e(a),r=e<0?n[0]:n[n.length-1];if(!r)return!1;const o=Ie(r,e<0?Ae(r):0);return t.applyTransactionalState(()=>Uw(a,o),{mergeKey:"moveImage"}),t.focusInput(),!0}const i=n[o],l=e<0?Ae(i):0;return t.applyTransactionalState(t=>Uw(t,Ie(i,l)),{mergeKey:"moveImage"}),t.focusInput(),!0},applySelectionPreservingStructure:e=>{var a;const n=t.stateSnapshot();t.applyHistoryState({...n,document:{...n.document,sections:null==(a=n.document.sections)?void 0:a.map(QS)},selection:{anchor:{...e.anchor},focus:{...e.focus}}})}}}
|
|
12
|
+
*/Yp.exports=function t(e,a,n){function r(i,l){if(!a[i]){if(!e[i]){if(!l&&Jp)return Jp(i);if(o)return o(i,!0);var s=new Error("Cannot find module '"+i+"'");throw s.code="MODULE_NOT_FOUND",s}var d=a[i]={exports:{}};e[i][0].call(d.exports,function(t){return r(e[i][1][t]||t)},d,d.exports,t,e,a,n)}return a[i].exports}for(var o=Jp,i=0;i<n.length;i++)r(n[i]);return r}({1:[function(t,e,a){var n=t("./utils"),r=t("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";a.encode=function(t){for(var e,a,r,i,l,s,d,c=[],h=0,p=t.length,u=p,f="string"!==n.getTypeOf(t);h<t.length;)u=p-h,r=f?(e=t[h++],a=h<p?t[h++]:0,h<p?t[h++]:0):(e=t.charCodeAt(h++),a=h<p?t.charCodeAt(h++):0,h<p?t.charCodeAt(h++):0),i=e>>2,l=(3&e)<<4|a>>4,s=1<u?(15&a)<<2|r>>6:64,d=2<u?63&r:64,c.push(o.charAt(i)+o.charAt(l)+o.charAt(s)+o.charAt(d));return c.join("")},a.decode=function(t){var e,a,n,i,l,s,d=0,c=0,h="data:";if(t.substr(0,h.length)===h)throw new Error("Invalid base64 input, it looks like a data url.");var p,u=3*(t=t.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(t.charAt(t.length-1)===o.charAt(64)&&u--,t.charAt(t.length-2)===o.charAt(64)&&u--,u%1!=0)throw new Error("Invalid base64 input, bad content length.");for(p=r.uint8array?new Uint8Array(0|u):new Array(0|u);d<t.length;)e=o.indexOf(t.charAt(d++))<<2|(i=o.indexOf(t.charAt(d++)))>>4,a=(15&i)<<4|(l=o.indexOf(t.charAt(d++)))>>2,n=(3&l)<<6|(s=o.indexOf(t.charAt(d++))),p[c++]=e,64!==l&&(p[c++]=a),64!==s&&(p[c++]=n);return p}},{"./support":30,"./utils":32}],2:[function(t,e,a){var n=t("./external"),r=t("./stream/DataWorker"),o=t("./stream/Crc32Probe"),i=t("./stream/DataLengthProbe");function l(t,e,a,n,r){this.compressedSize=t,this.uncompressedSize=e,this.crc32=a,this.compression=n,this.compressedContent=r}l.prototype={getContentWorker:function(){var t=new r(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new i("data_length")),e=this;return t.on("end",function(){if(this.streamInfo.data_length!==e.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),t},getCompressedWorker:function(){return new r(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},l.createWorkerFrom=function(t,e,a){return t.pipe(new o).pipe(new i("uncompressedSize")).pipe(e.compressWorker(a)).pipe(new i("compressedSize")).withStreamInfo("compression",e)},e.exports=l},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,e,a){var n=t("./stream/GenericWorker");a.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},a.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,e,a){var n=t("./utils"),r=function(){for(var t,e=[],a=0;a<256;a++){t=a;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t}return e}();e.exports=function(t,e){return void 0!==t&&t.length?"string"!==n.getTypeOf(t)?function(t,e,a,n){var o=r,i=n+a;t^=-1;for(var l=n;l<i;l++)t=t>>>8^o[255&(t^e[l])];return-1^t}(0|e,t,t.length,0):function(t,e,a,n){var o=r,i=n+a;t^=-1;for(var l=n;l<i;l++)t=t>>>8^o[255&(t^e.charCodeAt(l))];return-1^t}(0|e,t,t.length,0):0}},{"./utils":32}],5:[function(t,e,a){a.base64=!1,a.binary=!1,a.dir=!1,a.createFolders=!0,a.date=null,a.compression=null,a.compressionOptions=null,a.comment=null,a.unixPermissions=null,a.dosPermissions=null},{}],6:[function(t,e,a){var n=null;n="undefined"!=typeof Promise?Promise:t("lie"),e.exports={Promise:n}},{lie:37}],7:[function(t,e,a){var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,r=t("pako"),o=t("./utils"),i=t("./stream/GenericWorker"),l=n?"uint8array":"array";function s(t,e){i.call(this,"FlateWorker/"+t),this._pako=null,this._pakoAction=t,this._pakoOptions=e,this.meta={}}a.magic="\b\0",o.inherits(s,i),s.prototype.processChunk=function(t){this.meta=t.meta,null===this._pako&&this._createPako(),this._pako.push(o.transformTo(l,t.data),!1)},s.prototype.flush=function(){i.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},s.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this._pako=null},s.prototype._createPako=function(){this._pako=new r[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},a.compressWorker=function(t){return new s("Deflate",t)},a.uncompressWorker=function(){return new s("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,e,a){function n(t,e){var a,n="";for(a=0;a<e;a++)n+=String.fromCharCode(255&t),t>>>=8;return n}function r(t,e,a,r,i,c){var h,p,u=t.file,f=t.compression,g=c!==l.utf8encode,m=o.transformTo("string",c(u.name)),v=o.transformTo("string",l.utf8encode(u.name)),b=u.comment,y=o.transformTo("string",c(b)),M=o.transformTo("string",l.utf8encode(b)),x=v.length!==u.name.length,w=M.length!==b.length,S="",A="",I="",T=u.dir,C=u.date,k={crc32:0,compressedSize:0,uncompressedSize:0};e&&!a||(k.crc32=t.crc32,k.compressedSize=t.compressedSize,k.uncompressedSize=t.uncompressedSize);var V=0;e&&(V|=8),g||!x&&!w||(V|=2048);var E,R,L,z=0,N=0;T&&(z|=16),"UNIX"===i?(N=798,z|=(E=u.unixPermissions,R=T,L=E,E||(L=R?16893:33204),(65535&L)<<16)):(N=20,z|=function(t){return 63&(t||0)}(u.dosPermissions)),h=C.getUTCHours(),h<<=6,h|=C.getUTCMinutes(),h<<=5,h|=C.getUTCSeconds()/2,p=C.getUTCFullYear()-1980,p<<=4,p|=C.getUTCMonth()+1,p<<=5,p|=C.getUTCDate(),x&&(A=n(1,1)+n(s(m),4)+v,S+="up"+n(A.length,2)+A),w&&(I=n(1,1)+n(s(y),4)+M,S+="uc"+n(I.length,2)+I);var q="";return q+="\n\0",q+=n(V,2),q+=f.magic,q+=n(h,2),q+=n(p,2),q+=n(k.crc32,4),q+=n(k.compressedSize,4),q+=n(k.uncompressedSize,4),q+=n(m.length,2),q+=n(S.length,2),{fileRecord:d.LOCAL_FILE_HEADER+q+m+S,dirRecord:d.CENTRAL_FILE_HEADER+n(N,2)+q+n(y.length,2)+"\0\0\0\0"+n(z,4)+n(r,4)+m+S+y}}var o=t("../utils"),i=t("../stream/GenericWorker"),l=t("../utf8"),s=t("../crc32"),d=t("../signature");function c(t,e,a,n){i.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=e,this.zipPlatform=a,this.encodeFileName=n,this.streamFiles=t,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(c,i),c.prototype.push=function(t){var e=t.meta.percent||0,a=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(t):(this.bytesWritten+=t.data.length,i.prototype.push.call(this,{data:t.data,meta:{currentFile:this.currentFile,percent:a?(e+100*(a-n-1))/a:100}}))},c.prototype.openedSource=function(t){this.currentSourceOffset=this.bytesWritten,this.currentFile=t.file.name;var e=this.streamFiles&&!t.file.dir;if(e){var a=r(t,e,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:a.fileRecord,meta:{percent:0}})}else this.accumulate=!0},c.prototype.closedSource=function(t){this.accumulate=!1;var e,a=this.streamFiles&&!t.file.dir,o=r(t,a,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(o.dirRecord),a)this.push({data:(e=t,d.DATA_DESCRIPTOR+n(e.crc32,4)+n(e.compressedSize,4)+n(e.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:o.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},c.prototype.flush=function(){for(var t=this.bytesWritten,e=0;e<this.dirRecords.length;e++)this.push({data:this.dirRecords[e],meta:{percent:100}});var a,r,i,l,s,c,h=this.bytesWritten-t,p=(a=this.dirRecords.length,r=h,i=t,l=this.zipComment,s=this.encodeFileName,c=o.transformTo("string",s(l)),d.CENTRAL_DIRECTORY_END+"\0\0\0\0"+n(a,2)+n(a,2)+n(r,4)+n(i,4)+n(c.length,2)+c);this.push({data:p,meta:{percent:100}})},c.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},c.prototype.registerPrevious=function(t){this._sources.push(t);var e=this;return t.on("data",function(t){e.processChunk(t)}),t.on("end",function(){e.closedSource(e.previous.streamInfo),e._sources.length?e.prepareNextSource():e.end()}),t.on("error",function(t){e.error(t)}),this},c.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},c.prototype.error=function(t){var e=this._sources;if(!i.prototype.error.call(this,t))return!1;for(var a=0;a<e.length;a++)try{e[a].error(t)}catch(n){}return!0},c.prototype.lock=function(){i.prototype.lock.call(this);for(var t=this._sources,e=0;e<t.length;e++)t[e].lock()},e.exports=c},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,e,a){var n=t("../compressions"),r=t("./ZipFileWorker");a.generateWorker=function(t,e,a){var o=new r(e.streamFiles,a,e.platform,e.encodeFileName),i=0;try{t.forEach(function(t,a){i++;var r=function(t,e){var a=t||e,r=n[a];if(!r)throw new Error(a+" is not a valid compression method !");return r}(a.options.compression,e.compression),l=a.options.compressionOptions||e.compressionOptions||{},s=a.dir,d=a.date;a._compressWorker(r,l).withStreamInfo("file",{name:t,dir:s,date:d,comment:a.comment||"",unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions}).pipe(o)}),o.entriesCount=i}catch(l){o.error(l)}return o}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,e,a){function n(){if(!(this instanceof n))return new n;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var t=new n;for(var e in this)"function"!=typeof this[e]&&(t[e]=this[e]);return t}}(n.prototype=t("./object")).loadAsync=t("./load"),n.support=t("./support"),n.defaults=t("./defaults"),n.version="3.10.1",n.loadAsync=function(t,e){return(new n).loadAsync(t,e)},n.external=t("./external"),e.exports=n},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,e,a){var n=t("./utils"),r=t("./external"),o=t("./utf8"),i=t("./zipEntries"),l=t("./stream/Crc32Probe"),s=t("./nodejsUtils");function d(t){return new r.Promise(function(e,a){var n=t.decompressed.getContentWorker().pipe(new l);n.on("error",function(t){a(t)}).on("end",function(){n.streamInfo.crc32!==t.decompressed.crc32?a(new Error("Corrupted zip : CRC32 mismatch")):e()}).resume()})}e.exports=function(t,e){var a=this;return e=n.extend(e||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),s.isNode&&s.isStream(t)?r.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",t,!0,e.optimizedBinaryString,e.base64).then(function(t){var a=new i(e);return a.load(t),a}).then(function(t){var a=[r.Promise.resolve(t)],n=t.files;if(e.checkCRC32)for(var o=0;o<n.length;o++)a.push(d(n[o]));return r.Promise.all(a)}).then(function(t){for(var r=t.shift(),o=r.files,i=0;i<o.length;i++){var l=o[i],s=l.fileNameStr,d=n.resolve(l.fileNameStr);a.file(d,l.decompressed,{binary:!0,optimizedBinaryString:!0,date:l.date,dir:l.dir,comment:l.fileCommentStr.length?l.fileCommentStr:null,unixPermissions:l.unixPermissions,dosPermissions:l.dosPermissions,createFolders:e.createFolders}),l.dir||(a.file(d).unsafeOriginalName=s)}return r.zipComment.length&&(a.comment=r.zipComment),a})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,e,a){var n=t("../utils"),r=t("../stream/GenericWorker");function o(t,e){r.call(this,"Nodejs stream input adapter for "+t),this._upstreamEnded=!1,this._bindStream(e)}n.inherits(o,r),o.prototype._bindStream=function(t){var e=this;(this._stream=t).pause(),t.on("data",function(t){e.push({data:t,meta:{percent:0}})}).on("error",function(t){e.isPaused?this.generatedError=t:e.error(t)}).on("end",function(){e.isPaused?e._upstreamEnded=!0:e.end()})},o.prototype.pause=function(){return!!r.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},e.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,e,a){var n=t("readable-stream").Readable;function r(t,e,a){n.call(this,e),this._helper=t;var r=this;t.on("data",function(t,e){r.push(t)||r._helper.pause(),a&&a(e)}).on("error",function(t){r.emit("error",t)}).on("end",function(){r.push(null)})}t("../utils").inherits(r,n),r.prototype._read=function(){this._helper.resume()},e.exports=r},{"../utils":32,"readable-stream":16}],14:[function(t,e,a){e.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(t,e){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(t,e);if("number"==typeof t)throw new Error('The "data" argument must not be a number');return new Buffer(t,e)},allocBuffer:function(t){if(Buffer.alloc)return Buffer.alloc(t);var e=new Buffer(t);return e.fill(0),e},isBuffer:function(t){return Buffer.isBuffer(t)},isStream:function(t){return t&&"function"==typeof t.on&&"function"==typeof t.pause&&"function"==typeof t.resume}}},{}],15:[function(t,e,a){function n(t,e,a){var n,r=o.getTypeOf(e),l=o.extend(a||{},s);l.date=l.date||new Date,null!==l.compression&&(l.compression=l.compression.toUpperCase()),"string"==typeof l.unixPermissions&&(l.unixPermissions=parseInt(l.unixPermissions,8)),l.unixPermissions&&16384&l.unixPermissions&&(l.dir=!0),l.dosPermissions&&16&l.dosPermissions&&(l.dir=!0),l.dir&&(t=g(t)),l.createFolders&&(n=f(t))&&m.call(this,n,!0);var h="string"===r&&!1===l.binary&&!1===l.base64;a&&void 0!==a.binary||(l.binary=!h),(e instanceof d&&0===e.uncompressedSize||l.dir||!e||0===e.length)&&(l.base64=!1,l.binary=!0,e="",l.compression="STORE",r="string");var v=null;v=e instanceof d||e instanceof i?e:p.isNode&&p.isStream(e)?new u(t,e):o.prepareContent(t,e,l.binary,l.optimizedBinaryString,l.base64);var b=new c(t,v,l);this.files[t]=b}var r=t("./utf8"),o=t("./utils"),i=t("./stream/GenericWorker"),l=t("./stream/StreamHelper"),s=t("./defaults"),d=t("./compressedObject"),c=t("./zipObject"),h=t("./generate"),p=t("./nodejsUtils"),u=t("./nodejs/NodejsStreamInputAdapter"),f=function(t){"/"===t.slice(-1)&&(t=t.substring(0,t.length-1));var e=t.lastIndexOf("/");return 0<e?t.substring(0,e):""},g=function(t){return"/"!==t.slice(-1)&&(t+="/"),t},m=function(t,e){return e=void 0!==e?e:s.createFolders,t=g(t),this.files[t]||n.call(this,t,null,{dir:!0,createFolders:e}),this.files[t]};function v(t){return"[object RegExp]"===Object.prototype.toString.call(t)}var b={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(t){var e,a,n;for(e in this.files)n=this.files[e],(a=e.slice(this.root.length,e.length))&&e.slice(0,this.root.length)===this.root&&t(a,n)},filter:function(t){var e=[];return this.forEach(function(a,n){t(a,n)&&e.push(n)}),e},file:function(t,e,a){if(1!==arguments.length)return t=this.root+t,n.call(this,t,e,a),this;if(v(t)){var r=t;return this.filter(function(t,e){return!e.dir&&r.test(t)})}var o=this.files[this.root+t];return o&&!o.dir?o:null},folder:function(t){if(!t)return this;if(v(t))return this.filter(function(e,a){return a.dir&&t.test(e)});var e=this.root+t,a=m.call(this,e),n=this.clone();return n.root=a.name,n},remove:function(t){t=this.root+t;var e=this.files[t];if(e||("/"!==t.slice(-1)&&(t+="/"),e=this.files[t]),e&&!e.dir)delete this.files[t];else for(var a=this.filter(function(e,a){return a.name.slice(0,t.length)===t}),n=0;n<a.length;n++)delete this.files[a[n].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(t){var e,a={};try{if((a=o.extend(t||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:r.utf8encode})).type=a.type.toLowerCase(),a.compression=a.compression.toUpperCase(),"binarystring"===a.type&&(a.type="string"),!a.type)throw new Error("No output type specified.");o.checkSupport(a.type),"darwin"!==a.platform&&"freebsd"!==a.platform&&"linux"!==a.platform&&"sunos"!==a.platform||(a.platform="UNIX"),"win32"===a.platform&&(a.platform="DOS");var n=a.comment||this.comment||"";e=h.generateWorker(this,a,n)}catch(s){(e=new i("error")).error(s)}return new l(e,a.type||"string",a.mimeType)},generateAsync:function(t,e){return this.generateInternalStream(t).accumulate(e)},generateNodeStream:function(t,e){return(t=t||{}).type||(t.type="nodebuffer"),this.generateInternalStream(t).toNodejsStream(e)}};e.exports=b},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(t,e,a){e.exports=t("stream")},{stream:void 0}],17:[function(t,e,a){var n=t("./DataReader");function r(t){n.call(this,t);for(var e=0;e<this.data.length;e++)t[e]=255&t[e]}t("../utils").inherits(r,n),r.prototype.byteAt=function(t){return this.data[this.zero+t]},r.prototype.lastIndexOfSignature=function(t){for(var e=t.charCodeAt(0),a=t.charCodeAt(1),n=t.charCodeAt(2),r=t.charCodeAt(3),o=this.length-4;0<=o;--o)if(this.data[o]===e&&this.data[o+1]===a&&this.data[o+2]===n&&this.data[o+3]===r)return o-this.zero;return-1},r.prototype.readAndCheckSignature=function(t){var e=t.charCodeAt(0),a=t.charCodeAt(1),n=t.charCodeAt(2),r=t.charCodeAt(3),o=this.readData(4);return e===o[0]&&a===o[1]&&n===o[2]&&r===o[3]},r.prototype.readData=function(t){if(this.checkOffset(t),0===t)return[];var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=r},{"../utils":32,"./DataReader":18}],18:[function(t,e,a){var n=t("../utils");function r(t){this.data=t,this.length=t.length,this.index=0,this.zero=0}r.prototype={checkOffset:function(t){this.checkIndex(this.index+t)},checkIndex:function(t){if(this.length<this.zero+t||t<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+t+"). Corrupted zip ?")},setIndex:function(t){this.checkIndex(t),this.index=t},skip:function(t){this.setIndex(this.index+t)},byteAt:function(){},readInt:function(t){var e,a=0;for(this.checkOffset(t),e=this.index+t-1;e>=this.index;e--)a=(a<<8)+this.byteAt(e);return this.index+=t,a},readString:function(t){return n.transformTo("string",this.readData(t))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var t=this.readInt(4);return new Date(Date.UTC(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1))}},e.exports=r},{"../utils":32}],19:[function(t,e,a){var n=t("./Uint8ArrayReader");function r(t){n.call(this,t)}t("../utils").inherits(r,n),r.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=r},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,e,a){var n=t("./DataReader");function r(t){n.call(this,t)}t("../utils").inherits(r,n),r.prototype.byteAt=function(t){return this.data.charCodeAt(this.zero+t)},r.prototype.lastIndexOfSignature=function(t){return this.data.lastIndexOf(t)-this.zero},r.prototype.readAndCheckSignature=function(t){return t===this.readData(4)},r.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=r},{"../utils":32,"./DataReader":18}],21:[function(t,e,a){var n=t("./ArrayReader");function r(t){n.call(this,t)}t("../utils").inherits(r,n),r.prototype.readData=function(t){if(this.checkOffset(t),0===t)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=r},{"../utils":32,"./ArrayReader":17}],22:[function(t,e,a){var n=t("../utils"),r=t("../support"),o=t("./ArrayReader"),i=t("./StringReader"),l=t("./NodeBufferReader"),s=t("./Uint8ArrayReader");e.exports=function(t){var e=n.getTypeOf(t);return n.checkSupport(e),"string"!==e||r.uint8array?"nodebuffer"===e?new l(t):r.uint8array?new s(n.transformTo("uint8array",t)):new o(n.transformTo("array",t)):new i(t)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,e,a){a.LOCAL_FILE_HEADER="PK",a.CENTRAL_FILE_HEADER="PK",a.CENTRAL_DIRECTORY_END="PK",a.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",a.ZIP64_CENTRAL_DIRECTORY_END="PK",a.DATA_DESCRIPTOR="PK\b"},{}],24:[function(t,e,a){var n=t("./GenericWorker"),r=t("../utils");function o(t){n.call(this,"ConvertWorker to "+t),this.destType=t}r.inherits(o,n),o.prototype.processChunk=function(t){this.push({data:r.transformTo(this.destType,t.data),meta:t.meta})},e.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,e,a){var n=t("./GenericWorker"),r=t("../crc32");function o(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(o,n),o.prototype.processChunk=function(t){this.streamInfo.crc32=r(t.data,this.streamInfo.crc32||0),this.push(t)},e.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,e,a){var n=t("../utils"),r=t("./GenericWorker");function o(t){r.call(this,"DataLengthProbe for "+t),this.propName=t,this.withStreamInfo(t,0)}n.inherits(o,r),o.prototype.processChunk=function(t){if(t){var e=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=e+t.data.length}r.prototype.processChunk.call(this,t)},e.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,e,a){var n=t("../utils"),r=t("./GenericWorker");function o(t){r.call(this,"DataWorker");var e=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,t.then(function(t){e.dataIsReady=!0,e.data=t,e.max=t&&t.length||0,e.type=n.getTypeOf(t),e.isPaused||e._tickAndRepeat()},function(t){e.error(t)})}n.inherits(o,r),o.prototype.cleanUp=function(){r.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var t=null,e=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,e);break;case"uint8array":t=this.data.subarray(this.index,e);break;case"array":case"nodebuffer":t=this.data.slice(this.index,e)}return this.index=e,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})},e.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(t,e,a){function n(t){this.name=t||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(t){this.emit("data",t)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(t){this.emit("error",t)}return!0},error:function(t){return!this.isFinished&&(this.isPaused?this.generatedError=t:(this.isFinished=!0,this.emit("error",t),this.previous&&this.previous.error(t),this.cleanUp()),!0)},on:function(t,e){return this._listeners[t].push(e),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(t,e){if(this._listeners[t])for(var a=0;a<this._listeners[t].length;a++)this._listeners[t][a].call(this,e)},pipe:function(t){return t.registerPrevious(this)},registerPrevious:function(t){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=t.streamInfo,this.mergeStreamInfo(),this.previous=t;var e=this;return t.on("data",function(t){e.processChunk(t)}),t.on("end",function(){e.end()}),t.on("error",function(t){e.error(t)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var t=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),t=!0),this.previous&&this.previous.resume(),!t},flush:function(){},processChunk:function(t){this.push(t)},withStreamInfo:function(t,e){return this.extraStreamInfo[t]=e,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var t in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,t)&&(this.streamInfo[t]=this.extraStreamInfo[t])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var t="Worker "+this.name;return this.previous?this.previous+" -> "+t:t}},e.exports=n},{}],29:[function(t,e,a){var n=t("../utils"),r=t("./ConvertWorker"),o=t("./GenericWorker"),i=t("../base64"),l=t("../support"),s=t("../external"),d=null;if(l.nodestream)try{d=t("../nodejs/NodejsStreamOutputAdapter")}catch(p){}function c(t,e){return new s.Promise(function(a,r){var o=[],l=t._internalType,s=t._outputType,d=t._mimeType;t.on("data",function(t,a){o.push(t),e&&e(a)}).on("error",function(t){o=[],r(t)}).on("end",function(){try{var t=function(t,e,a){switch(t){case"blob":return n.newBlob(n.transformTo("arraybuffer",e),a);case"base64":return i.encode(e);default:return n.transformTo(t,e)}}(s,function(t,e){var a,n=0,r=null,o=0;for(a=0;a<e.length;a++)o+=e[a].length;switch(t){case"string":return e.join("");case"array":return Array.prototype.concat.apply([],e);case"uint8array":for(r=new Uint8Array(o),a=0;a<e.length;a++)r.set(e[a],n),n+=e[a].length;return r;case"nodebuffer":return Buffer.concat(e);default:throw new Error("concat : unsupported type '"+t+"'")}}(l,o),d);a(t)}catch(e){r(e)}o=[]}).resume()})}function h(t,e,a){var i=e;switch(e){case"blob":case"arraybuffer":i="uint8array";break;case"base64":i="string"}try{this._internalType=i,this._outputType=e,this._mimeType=a,n.checkSupport(i),this._worker=t.pipe(new r(i)),t.lock()}catch(l){this._worker=new o("error"),this._worker.error(l)}}h.prototype={accumulate:function(t){return c(this,t)},on:function(t,e){var a=this;return"data"===t?this._worker.on(t,function(t){e.call(a,t.data,t.meta)}):this._worker.on(t,function(){n.delay(e,arguments,a)}),this},resume:function(){return n.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(t){if(n.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new d(this,{objectMode:"nodebuffer"!==this._outputType},t)}},e.exports=h},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,e,a){if(a.base64=!0,a.array=!0,a.string=!0,a.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,a.nodebuffer="undefined"!=typeof Buffer,a.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)a.blob=!1;else{var n=new ArrayBuffer(0);try{a.blob=0===new Blob([n],{type:"application/zip"}).size}catch(o){try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);r.append(n),a.blob=0===r.getBlob("application/zip").size}catch(i){a.blob=!1}}}try{a.nodestream=!!t("readable-stream").Readable}catch(o){a.nodestream=!1}},{"readable-stream":16}],31:[function(t,e,a){for(var n=t("./utils"),r=t("./support"),o=t("./nodejsUtils"),i=t("./stream/GenericWorker"),l=new Array(256),s=0;s<256;s++)l[s]=252<=s?6:248<=s?5:240<=s?4:224<=s?3:192<=s?2:1;function d(){i.call(this,"utf-8 decode"),this.leftOver=null}function c(){i.call(this,"utf-8 encode")}l[254]=l[254]=1,a.utf8encode=function(t){return r.nodebuffer?o.newBufferFrom(t,"utf-8"):function(t){var e,a,n,o,i,l=t.length,s=0;for(o=0;o<l;o++)55296==(64512&(a=t.charCodeAt(o)))&&o+1<l&&56320==(64512&(n=t.charCodeAt(o+1)))&&(a=65536+(a-55296<<10)+(n-56320),o++),s+=a<128?1:a<2048?2:a<65536?3:4;for(e=r.uint8array?new Uint8Array(s):new Array(s),o=i=0;i<s;o++)55296==(64512&(a=t.charCodeAt(o)))&&o+1<l&&56320==(64512&(n=t.charCodeAt(o+1)))&&(a=65536+(a-55296<<10)+(n-56320),o++),a<128?e[i++]=a:(a<2048?e[i++]=192|a>>>6:(a<65536?e[i++]=224|a>>>12:(e[i++]=240|a>>>18,e[i++]=128|a>>>12&63),e[i++]=128|a>>>6&63),e[i++]=128|63&a);return e}(t)},a.utf8decode=function(t){return r.nodebuffer?n.transformTo("nodebuffer",t).toString("utf-8"):function(t){var e,a,r,o,i=t.length,s=new Array(2*i);for(e=a=0;e<i;)if((r=t[e++])<128)s[a++]=r;else if(4<(o=l[r]))s[a++]=65533,e+=o-1;else{for(r&=2===o?31:3===o?15:7;1<o&&e<i;)r=r<<6|63&t[e++],o--;1<o?s[a++]=65533:r<65536?s[a++]=r:(r-=65536,s[a++]=55296|r>>10&1023,s[a++]=56320|1023&r)}return s.length!==a&&(s.subarray?s=s.subarray(0,a):s.length=a),n.applyFromCharCode(s)}(t=n.transformTo(r.uint8array?"uint8array":"array",t))},n.inherits(d,i),d.prototype.processChunk=function(t){var e=n.transformTo(r.uint8array?"uint8array":"array",t.data);if(this.leftOver&&this.leftOver.length){if(r.uint8array){var o=e;(e=new Uint8Array(o.length+this.leftOver.length)).set(this.leftOver,0),e.set(o,this.leftOver.length)}else e=this.leftOver.concat(e);this.leftOver=null}var i=function(t,e){var a;for((e=e||t.length)>t.length&&(e=t.length),a=e-1;0<=a&&128==(192&t[a]);)a--;return a<0||0===a?e:a+l[t[a]]>e?a:e}(e),s=e;i!==e.length&&(r.uint8array?(s=e.subarray(0,i),this.leftOver=e.subarray(i,e.length)):(s=e.slice(0,i),this.leftOver=e.slice(i,e.length))),this.push({data:a.utf8decode(s),meta:t.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:a.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},a.Utf8DecodeWorker=d,n.inherits(c,i),c.prototype.processChunk=function(t){this.push({data:a.utf8encode(t.data),meta:t.meta})},a.Utf8EncodeWorker=c},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,e,a){var n=t("./support"),r=t("./base64"),o=t("./nodejsUtils"),i=t("./external");function l(t){return t}function s(t,e){for(var a=0;a<t.length;++a)e[a]=255&t.charCodeAt(a);return e}t("setimmediate"),a.newBlob=function(t,e){a.checkSupport("blob");try{return new Blob([t],{type:e})}catch(r){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return n.append(t),n.getBlob(e)}catch(o){throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(t,e,a){var n=[],r=0,o=t.length;if(o<=a)return String.fromCharCode.apply(null,t);for(;r<o;)"array"===e||"nodebuffer"===e?n.push(String.fromCharCode.apply(null,t.slice(r,Math.min(r+a,o)))):n.push(String.fromCharCode.apply(null,t.subarray(r,Math.min(r+a,o)))),r+=a;return n.join("")},stringifyByChar:function(t){for(var e="",a=0;a<t.length;a++)e+=String.fromCharCode(t[a]);return e},applyCanBeUsed:{uint8array:function(){try{return n.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(t){return!1}}(),nodebuffer:function(){try{return n.nodebuffer&&1===String.fromCharCode.apply(null,o.allocBuffer(1)).length}catch(t){return!1}}()}};function c(t){var e=65536,n=a.getTypeOf(t),r=!0;if("uint8array"===n?r=d.applyCanBeUsed.uint8array:"nodebuffer"===n&&(r=d.applyCanBeUsed.nodebuffer),r)for(;1<e;)try{return d.stringifyByChunk(t,n,e)}catch(o){e=Math.floor(e/2)}return d.stringifyByChar(t)}function h(t,e){for(var a=0;a<t.length;a++)e[a]=t[a];return e}a.applyFromCharCode=c;var p={};p.string={string:l,array:function(t){return s(t,new Array(t.length))},arraybuffer:function(t){return p.string.uint8array(t).buffer},uint8array:function(t){return s(t,new Uint8Array(t.length))},nodebuffer:function(t){return s(t,o.allocBuffer(t.length))}},p.array={string:c,array:l,arraybuffer:function(t){return new Uint8Array(t).buffer},uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return o.newBufferFrom(t)}},p.arraybuffer={string:function(t){return c(new Uint8Array(t))},array:function(t){return h(new Uint8Array(t),new Array(t.byteLength))},arraybuffer:l,uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return o.newBufferFrom(new Uint8Array(t))}},p.uint8array={string:c,array:function(t){return h(t,new Array(t.length))},arraybuffer:function(t){return t.buffer},uint8array:l,nodebuffer:function(t){return o.newBufferFrom(t)}},p.nodebuffer={string:c,array:function(t){return h(t,new Array(t.length))},arraybuffer:function(t){return p.nodebuffer.uint8array(t).buffer},uint8array:function(t){return h(t,new Uint8Array(t.length))},nodebuffer:l},a.transformTo=function(t,e){if(e=e||"",!t)return e;a.checkSupport(t);var n=a.getTypeOf(e);return p[n][t](e)},a.resolve=function(t){for(var e=t.split("/"),a=[],n=0;n<e.length;n++){var r=e[n];"."===r||""===r&&0!==n&&n!==e.length-1||(".."===r?a.pop():a.push(r))}return a.join("/")},a.getTypeOf=function(t){return"string"==typeof t?"string":"[object Array]"===Object.prototype.toString.call(t)?"array":n.nodebuffer&&o.isBuffer(t)?"nodebuffer":n.uint8array&&t instanceof Uint8Array?"uint8array":n.arraybuffer&&t instanceof ArrayBuffer?"arraybuffer":void 0},a.checkSupport=function(t){if(!n[t.toLowerCase()])throw new Error(t+" is not supported by this platform")},a.MAX_VALUE_16BITS=65535,a.MAX_VALUE_32BITS=-1,a.pretty=function(t){var e,a,n="";for(a=0;a<(t||"").length;a++)n+="\\x"+((e=t.charCodeAt(a))<16?"0":"")+e.toString(16).toUpperCase();return n},a.delay=function(t,e,a){setImmediate(function(){t.apply(a||null,e||[])})},a.inherits=function(t,e){function a(){}a.prototype=e.prototype,t.prototype=new a},a.extend=function(){var t,e,a={};for(t=0;t<arguments.length;t++)for(e in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],e)&&void 0===a[e]&&(a[e]=arguments[t][e]);return a},a.prepareContent=function(t,e,o,l,d){return i.Promise.resolve(e).then(function(t){return n.blob&&(t instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(t)))&&"undefined"!=typeof FileReader?new i.Promise(function(e,a){var n=new FileReader;n.onload=function(t){e(t.target.result)},n.onerror=function(t){a(t.target.error)},n.readAsArrayBuffer(t)}):t}).then(function(e){var c,h=a.getTypeOf(e);return h?("arraybuffer"===h?e=a.transformTo("uint8array",e):"string"===h&&(d?e=r.decode(e):o&&!0!==l&&(e=s(c=e,n.uint8array?new Uint8Array(c.length):new Array(c.length)))),e):i.Promise.reject(new Error("Can't read the data of '"+t+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,e,a){var n=t("./reader/readerFor"),r=t("./utils"),o=t("./signature"),i=t("./zipEntry"),l=t("./support");function s(t){this.files=[],this.loadOptions=t}s.prototype={checkSignature:function(t){if(!this.reader.readAndCheckSignature(t)){this.reader.index-=4;var e=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+r.pretty(e)+", expected "+r.pretty(t)+")")}},isSignature:function(t,e){var a=this.reader.index;this.reader.setIndex(t);var n=this.reader.readString(4)===e;return this.reader.setIndex(a),n},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var t=this.reader.readData(this.zipCommentLength),e=l.uint8array?"uint8array":"array",a=r.transformTo(e,t);this.zipComment=this.loadOptions.decodeFileName(a)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var t,e,a,n=this.zip64EndOfCentralSize-44;0<n;)t=this.reader.readInt(2),e=this.reader.readInt(4),a=this.reader.readData(e),this.zip64ExtensibleData[t]={id:t,length:e,value:a}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var t,e;for(t=0;t<this.files.length;t++)e=this.files[t],this.reader.setIndex(e.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),e.readLocalPart(this.reader),e.handleUTF8(),e.processAttributes()},readCentralDir:function(){var t;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(t=new i({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(t);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var t=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(t<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(t);var e=t;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===r.MAX_VALUE_16BITS||this.diskWithCentralDirStart===r.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===r.MAX_VALUE_16BITS||this.centralDirRecords===r.MAX_VALUE_16BITS||this.centralDirSize===r.MAX_VALUE_32BITS||this.centralDirOffset===r.MAX_VALUE_32BITS){if(this.zip64=!0,(t=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(t),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var a=this.centralDirOffset+this.centralDirSize;this.zip64&&(a+=20,a+=12+this.zip64EndOfCentralSize);var n=e-a;if(0<n)this.isSignature(e,o.CENTRAL_FILE_HEADER)||(this.reader.zero=n);else if(n<0)throw new Error("Corrupted zip: missing "+Math.abs(n)+" bytes.")},prepareReader:function(t){this.reader=n(t)},load:function(t){this.prepareReader(t),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},e.exports=s},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,e,a){var n=t("./reader/readerFor"),r=t("./utils"),o=t("./compressedObject"),i=t("./crc32"),l=t("./utf8"),s=t("./compressions"),d=t("./support");function c(t,e){this.options=t,this.loadOptions=e}c.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(t){var e,a;if(t.skip(22),this.fileNameLength=t.readInt(2),a=t.readInt(2),this.fileName=t.readData(this.fileNameLength),t.skip(a),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(e=function(t){for(var e in s)if(Object.prototype.hasOwnProperty.call(s,e)&&s[e].magic===t)return s[e];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+r.pretty(this.compressionMethod)+" unknown (inner file : "+r.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,e,t.readData(this.compressedSize))},readCentralPart:function(t){this.versionMadeBy=t.readInt(2),t.skip(2),this.bitFlag=t.readInt(2),this.compressionMethod=t.readString(2),this.date=t.readDate(),this.crc32=t.readInt(4),this.compressedSize=t.readInt(4),this.uncompressedSize=t.readInt(4);var e=t.readInt(2);if(this.extraFieldsLength=t.readInt(2),this.fileCommentLength=t.readInt(2),this.diskNumberStart=t.readInt(2),this.internalFileAttributes=t.readInt(2),this.externalFileAttributes=t.readInt(4),this.localHeaderOffset=t.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");t.skip(e),this.readExtraFields(t),this.parseZIP64ExtraField(t),this.fileComment=t.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var t=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==t&&(this.dosPermissions=63&this.externalFileAttributes),3==t&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var t=n(this.extraFields[1].value);this.uncompressedSize===r.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===r.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===r.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===r.MAX_VALUE_32BITS&&(this.diskNumberStart=t.readInt(4))}},readExtraFields:function(t){var e,a,n,r=t.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});t.index+4<r;)e=t.readInt(2),a=t.readInt(2),n=t.readData(a),this.extraFields[e]={id:e,length:a,value:n};t.setIndex(r)},handleUTF8:function(){var t=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=l.utf8decode(this.fileName),this.fileCommentStr=l.utf8decode(this.fileComment);else{var e=this.findExtraFieldUnicodePath();if(null!==e)this.fileNameStr=e;else{var a=r.transformTo(t,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(a)}var n=this.findExtraFieldUnicodeComment();if(null!==n)this.fileCommentStr=n;else{var o=r.transformTo(t,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(o)}}},findExtraFieldUnicodePath:function(){var t=this.extraFields[28789];if(t){var e=n(t.value);return 1!==e.readInt(1)||i(this.fileName)!==e.readInt(4)?null:l.utf8decode(e.readData(t.length-5))}return null},findExtraFieldUnicodeComment:function(){var t=this.extraFields[25461];if(t){var e=n(t.value);return 1!==e.readInt(1)||i(this.fileComment)!==e.readInt(4)?null:l.utf8decode(e.readData(t.length-5))}return null}},e.exports=c},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,e,a){function n(t,e,a){this.name=t,this.dir=a.dir,this.date=a.date,this.comment=a.comment,this.unixPermissions=a.unixPermissions,this.dosPermissions=a.dosPermissions,this._data=e,this._dataBinary=a.binary,this.options={compression:a.compression,compressionOptions:a.compressionOptions}}var r=t("./stream/StreamHelper"),o=t("./stream/DataWorker"),i=t("./utf8"),l=t("./compressedObject"),s=t("./stream/GenericWorker");n.prototype={internalStream:function(t){var e=null,a="string";try{if(!t)throw new Error("No output type specified.");var n="string"===(a=t.toLowerCase())||"text"===a;"binarystring"!==a&&"text"!==a||(a="string"),e=this._decompressWorker();var o=!this._dataBinary;o&&!n&&(e=e.pipe(new i.Utf8EncodeWorker)),!o&&n&&(e=e.pipe(new i.Utf8DecodeWorker))}catch(l){(e=new s("error")).error(l)}return new r(e,a,"")},async:function(t,e){return this.internalStream(t).accumulate(e)},nodeStream:function(t,e){return this.internalStream(t||"nodebuffer").toNodejsStream(e)},_compressWorker:function(t,e){if(this._data instanceof l&&this._data.compression.magic===t.magic)return this._data.getCompressedWorker();var a=this._decompressWorker();return this._dataBinary||(a=a.pipe(new i.Utf8EncodeWorker)),l.createWorkerFrom(a,t,e)},_decompressWorker:function(){return this._data instanceof l?this._data.getContentWorker():this._data instanceof s?this._data:new o(this._data)}};for(var d=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],c=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},h=0;h<d.length;h++)n.prototype[d[h]]=c;e.exports=n},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,e,a){(function(t){var a,n,r=t.MutationObserver||t.WebKitMutationObserver;if(r){var o=0,i=new r(c),l=t.document.createTextNode("");i.observe(l,{characterData:!0}),a=function(){l.data=o=++o%2}}else if(t.setImmediate||void 0===t.MessageChannel)a="document"in t&&"onreadystatechange"in t.document.createElement("script")?function(){var e=t.document.createElement("script");e.onreadystatechange=function(){c(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},t.document.documentElement.appendChild(e)}:function(){setTimeout(c,0)};else{var s=new t.MessageChannel;s.port1.onmessage=c,a=function(){s.port2.postMessage(0)}}var d=[];function c(){var t,e;n=!0;for(var a=d.length;a;){for(e=d,d=[],t=-1;++t<a;)e[t]();a=d.length}n=!1}e.exports=function(t){1!==d.push(t)||n||a()}}).call(this,void 0!==Sn?Sn:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(t,e,a){var n=t("immediate");function r(){}var o={},i=["REJECTED"],l=["FULFILLED"],s=["PENDING"];function d(t){if("function"!=typeof t)throw new TypeError("resolver must be a function");this.state=s,this.queue=[],this.outcome=void 0,t!==r&&u(this,t)}function c(t,e,a){this.promise=t,"function"==typeof e&&(this.onFulfilled=e,this.callFulfilled=this.otherCallFulfilled),"function"==typeof a&&(this.onRejected=a,this.callRejected=this.otherCallRejected)}function h(t,e,a){n(function(){var n;try{n=e(a)}catch(r){return o.reject(t,r)}n===t?o.reject(t,new TypeError("Cannot resolve promise with itself")):o.resolve(t,n)})}function p(t){var e=t&&t.then;if(t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof e)return function(){e.apply(t,arguments)}}function u(t,e){var a=!1;function n(e){a||(a=!0,o.reject(t,e))}function r(e){a||(a=!0,o.resolve(t,e))}var i=f(function(){e(r,n)});"error"===i.status&&n(i.value)}function f(t,e){var a={};try{a.value=t(e),a.status="success"}catch(n){a.status="error",a.value=n}return a}(e.exports=d).prototype.finally=function(t){if("function"!=typeof t)return this;var e=this.constructor;return this.then(function(a){return e.resolve(t()).then(function(){return a})},function(a){return e.resolve(t()).then(function(){throw a})})},d.prototype.catch=function(t){return this.then(null,t)},d.prototype.then=function(t,e){if("function"!=typeof t&&this.state===l||"function"!=typeof e&&this.state===i)return this;var a=new this.constructor(r);return this.state!==s?h(a,this.state===l?t:e,this.outcome):this.queue.push(new c(a,t,e)),a},c.prototype.callFulfilled=function(t){o.resolve(this.promise,t)},c.prototype.otherCallFulfilled=function(t){h(this.promise,this.onFulfilled,t)},c.prototype.callRejected=function(t){o.reject(this.promise,t)},c.prototype.otherCallRejected=function(t){h(this.promise,this.onRejected,t)},o.resolve=function(t,e){var a=f(p,e);if("error"===a.status)return o.reject(t,a.value);var n=a.value;if(n)u(t,n);else{t.state=l,t.outcome=e;for(var r=-1,i=t.queue.length;++r<i;)t.queue[r].callFulfilled(e)}return t},o.reject=function(t,e){t.state=i,t.outcome=e;for(var a=-1,n=t.queue.length;++a<n;)t.queue[a].callRejected(e);return t},d.resolve=function(t){return t instanceof this?t:o.resolve(new this(r),t)},d.reject=function(t){var e=new this(r);return o.reject(e,t)},d.all=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var a=t.length,n=!1;if(!a)return this.resolve([]);for(var i=new Array(a),l=0,s=-1,d=new this(r);++s<a;)c(t[s],s);return d;function c(t,r){e.resolve(t).then(function(t){i[r]=t,++l!==a||n||(n=!0,o.resolve(d,i))},function(t){n||(n=!0,o.reject(d,t))})}},d.race=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var a=t.length,n=!1;if(!a)return this.resolve([]);for(var i,l=-1,s=new this(r);++l<a;)i=t[l],e.resolve(i).then(function(t){n||(n=!0,o.resolve(s,t))},function(t){n||(n=!0,o.reject(s,t))});return s}},{immediate:36}],38:[function(t,e,a){var n={};(0,t("./lib/utils/common").assign)(n,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),e.exports=n},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,e,a){var n=t("./zlib/deflate"),r=t("./utils/common"),o=t("./utils/strings"),i=t("./zlib/messages"),l=t("./zlib/zstream"),s=Object.prototype.toString,d=0,c=-1,h=0,p=8;function u(t){if(!(this instanceof u))return new u(t);this.options=r.assign({level:c,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:h,to:""},t||{});var e=this.options;e.raw&&0<e.windowBits?e.windowBits=-e.windowBits:e.gzip&&0<e.windowBits&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var a=n.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(a!==d)throw new Error(i[a]);if(e.header&&n.deflateSetHeader(this.strm,e.header),e.dictionary){var f;if(f="string"==typeof e.dictionary?o.string2buf(e.dictionary):"[object ArrayBuffer]"===s.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,(a=n.deflateSetDictionary(this.strm,f))!==d)throw new Error(i[a]);this._dict_set=!0}}function f(t,e){var a=new u(e);if(a.push(t,!0),a.err)throw a.msg||i[a.err];return a.result}u.prototype.push=function(t,e){var a,i,l=this.strm,c=this.options.chunkSize;if(this.ended)return!1;i=e===~~e?e:!0===e?4:0,"string"==typeof t?l.input=o.string2buf(t):"[object ArrayBuffer]"===s.call(t)?l.input=new Uint8Array(t):l.input=t,l.next_in=0,l.avail_in=l.input.length;do{if(0===l.avail_out&&(l.output=new r.Buf8(c),l.next_out=0,l.avail_out=c),1!==(a=n.deflate(l,i))&&a!==d)return this.onEnd(a),!(this.ended=!0);0!==l.avail_out&&(0!==l.avail_in||4!==i&&2!==i)||("string"===this.options.to?this.onData(o.buf2binstring(r.shrinkBuf(l.output,l.next_out))):this.onData(r.shrinkBuf(l.output,l.next_out)))}while((0<l.avail_in||0===l.avail_out)&&1!==a);return 4===i?(a=n.deflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===d):2!==i||(this.onEnd(d),!(l.avail_out=0))},u.prototype.onData=function(t){this.chunks.push(t)},u.prototype.onEnd=function(t){t===d&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},a.Deflate=u,a.deflate=f,a.deflateRaw=function(t,e){return(e=e||{}).raw=!0,f(t,e)},a.gzip=function(t,e){return(e=e||{}).gzip=!0,f(t,e)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,e,a){var n=t("./zlib/inflate"),r=t("./utils/common"),o=t("./utils/strings"),i=t("./zlib/constants"),l=t("./zlib/messages"),s=t("./zlib/zstream"),d=t("./zlib/gzheader"),c=Object.prototype.toString;function h(t){if(!(this instanceof h))return new h(t);this.options=r.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&0<=e.windowBits&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(0<=e.windowBits&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),15<e.windowBits&&e.windowBits<48&&!(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var a=n.inflateInit2(this.strm,e.windowBits);if(a!==i.Z_OK)throw new Error(l[a]);this.header=new d,n.inflateGetHeader(this.strm,this.header)}function p(t,e){var a=new h(e);if(a.push(t,!0),a.err)throw a.msg||l[a.err];return a.result}h.prototype.push=function(t,e){var a,l,s,d,h,p,u=this.strm,f=this.options.chunkSize,g=this.options.dictionary,m=!1;if(this.ended)return!1;l=e===~~e?e:!0===e?i.Z_FINISH:i.Z_NO_FLUSH,"string"==typeof t?u.input=o.binstring2buf(t):"[object ArrayBuffer]"===c.call(t)?u.input=new Uint8Array(t):u.input=t,u.next_in=0,u.avail_in=u.input.length;do{if(0===u.avail_out&&(u.output=new r.Buf8(f),u.next_out=0,u.avail_out=f),(a=n.inflate(u,i.Z_NO_FLUSH))===i.Z_NEED_DICT&&g&&(p="string"==typeof g?o.string2buf(g):"[object ArrayBuffer]"===c.call(g)?new Uint8Array(g):g,a=n.inflateSetDictionary(this.strm,p)),a===i.Z_BUF_ERROR&&!0===m&&(a=i.Z_OK,m=!1),a!==i.Z_STREAM_END&&a!==i.Z_OK)return this.onEnd(a),!(this.ended=!0);u.next_out&&(0!==u.avail_out&&a!==i.Z_STREAM_END&&(0!==u.avail_in||l!==i.Z_FINISH&&l!==i.Z_SYNC_FLUSH)||("string"===this.options.to?(s=o.utf8border(u.output,u.next_out),d=u.next_out-s,h=o.buf2string(u.output,s),u.next_out=d,u.avail_out=f-d,d&&r.arraySet(u.output,u.output,s,d,0),this.onData(h)):this.onData(r.shrinkBuf(u.output,u.next_out)))),0===u.avail_in&&0===u.avail_out&&(m=!0)}while((0<u.avail_in||0===u.avail_out)&&a!==i.Z_STREAM_END);return a===i.Z_STREAM_END&&(l=i.Z_FINISH),l===i.Z_FINISH?(a=n.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===i.Z_OK):l!==i.Z_SYNC_FLUSH||(this.onEnd(i.Z_OK),!(u.avail_out=0))},h.prototype.onData=function(t){this.chunks.push(t)},h.prototype.onEnd=function(t){t===i.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},a.Inflate=h,a.inflate=p,a.inflateRaw=function(t,e){return(e=e||{}).raw=!0,p(t,e)},a.ungzip=p},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,e,a){var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;a.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var a=e.shift();if(a){if("object"!=typeof a)throw new TypeError(a+"must be non-object");for(var n in a)a.hasOwnProperty(n)&&(t[n]=a[n])}}return t},a.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var r={arraySet:function(t,e,a,n,r){if(e.subarray&&t.subarray)t.set(e.subarray(a,a+n),r);else for(var o=0;o<n;o++)t[r+o]=e[a+o]},flattenChunks:function(t){var e,a,n,r,o,i;for(e=n=0,a=t.length;e<a;e++)n+=t[e].length;for(i=new Uint8Array(n),e=r=0,a=t.length;e<a;e++)o=t[e],i.set(o,r),r+=o.length;return i}},o={arraySet:function(t,e,a,n,r){for(var o=0;o<n;o++)t[r+o]=e[a+o]},flattenChunks:function(t){return[].concat.apply([],t)}};a.setTyped=function(t){t?(a.Buf8=Uint8Array,a.Buf16=Uint16Array,a.Buf32=Int32Array,a.assign(a,r)):(a.Buf8=Array,a.Buf16=Array,a.Buf32=Array,a.assign(a,o))},a.setTyped(n)},{}],42:[function(t,e,a){var n=t("./common"),r=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(d){r=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(d){o=!1}for(var i=new n.Buf8(256),l=0;l<256;l++)i[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function s(t,e){if(e<65537&&(t.subarray&&o||!t.subarray&&r))return String.fromCharCode.apply(null,n.shrinkBuf(t,e));for(var a="",i=0;i<e;i++)a+=String.fromCharCode(t[i]);return a}i[254]=i[254]=1,a.string2buf=function(t){var e,a,r,o,i,l=t.length,s=0;for(o=0;o<l;o++)55296==(64512&(a=t.charCodeAt(o)))&&o+1<l&&56320==(64512&(r=t.charCodeAt(o+1)))&&(a=65536+(a-55296<<10)+(r-56320),o++),s+=a<128?1:a<2048?2:a<65536?3:4;for(e=new n.Buf8(s),o=i=0;i<s;o++)55296==(64512&(a=t.charCodeAt(o)))&&o+1<l&&56320==(64512&(r=t.charCodeAt(o+1)))&&(a=65536+(a-55296<<10)+(r-56320),o++),a<128?e[i++]=a:(a<2048?e[i++]=192|a>>>6:(a<65536?e[i++]=224|a>>>12:(e[i++]=240|a>>>18,e[i++]=128|a>>>12&63),e[i++]=128|a>>>6&63),e[i++]=128|63&a);return e},a.buf2binstring=function(t){return s(t,t.length)},a.binstring2buf=function(t){for(var e=new n.Buf8(t.length),a=0,r=e.length;a<r;a++)e[a]=t.charCodeAt(a);return e},a.buf2string=function(t,e){var a,n,r,o,l=e||t.length,d=new Array(2*l);for(a=n=0;a<l;)if((r=t[a++])<128)d[n++]=r;else if(4<(o=i[r]))d[n++]=65533,a+=o-1;else{for(r&=2===o?31:3===o?15:7;1<o&&a<l;)r=r<<6|63&t[a++],o--;1<o?d[n++]=65533:r<65536?d[n++]=r:(r-=65536,d[n++]=55296|r>>10&1023,d[n++]=56320|1023&r)}return s(d,n)},a.utf8border=function(t,e){var a;for((e=e||t.length)>t.length&&(e=t.length),a=e-1;0<=a&&128==(192&t[a]);)a--;return a<0||0===a?e:a+i[t[a]]>e?a:e}},{"./common":41}],43:[function(t,e,a){e.exports=function(t,e,a,n){for(var r=65535&t,o=t>>>16&65535,i=0;0!==a;){for(a-=i=2e3<a?2e3:a;o=o+(r=r+e[n++]|0)|0,--i;);r%=65521,o%=65521}return r|o<<16}},{}],44:[function(t,e,a){e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(t,e,a){var n=function(){for(var t,e=[],a=0;a<256;a++){t=a;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t}return e}();e.exports=function(t,e,a,r){var o=n,i=r+a;t^=-1;for(var l=r;l<i;l++)t=t>>>8^o[255&(t^e[l])];return-1^t}},{}],46:[function(t,e,a){var n,r=t("../utils/common"),o=t("./trees"),i=t("./adler32"),l=t("./crc32"),s=t("./messages"),d=0,c=4,h=0,p=-2,u=-1,f=4,g=2,m=8,v=9,b=286,y=30,M=19,x=2*b+1,w=15,S=3,A=258,I=A+S+1,T=42,C=113,k=1,V=2,E=3,R=4;function L(t,e){return t.msg=s[e],e}function z(t){return(t<<1)-(4<t?9:0)}function N(t){for(var e=t.length;0<=--e;)t[e]=0}function q(t){var e=t.state,a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(r.arraySet(t.output,e.pending_buf,e.pending_out,a,t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0))}function O(t,e){o._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,q(t.strm)}function P(t,e){t.pending_buf[t.pending++]=e}function W(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function H(t,e){var a,n,r=t.max_chain_length,o=t.strstart,i=t.prev_length,l=t.nice_match,s=t.strstart>t.w_size-I?t.strstart-(t.w_size-I):0,d=t.window,c=t.w_mask,h=t.prev,p=t.strstart+A,u=d[o+i-1],f=d[o+i];t.prev_length>=t.good_match&&(r>>=2),l>t.lookahead&&(l=t.lookahead);do{if(d[(a=e)+i]===f&&d[a+i-1]===u&&d[a]===d[o]&&d[++a]===d[o+1]){o+=2,a++;do{}while(d[++o]===d[++a]&&d[++o]===d[++a]&&d[++o]===d[++a]&&d[++o]===d[++a]&&d[++o]===d[++a]&&d[++o]===d[++a]&&d[++o]===d[++a]&&d[++o]===d[++a]&&o<p);if(n=A-(p-o),o=p-A,i<n){if(t.match_start=e,l<=(i=n))break;u=d[o+i-1],f=d[o+i]}}}while((e=h[e&c])>s&&0!=--r);return i<=t.lookahead?i:t.lookahead}function U(t){var e,a,n,o,s,d,c,h,p,u,f=t.w_size;do{if(o=t.window_size-t.lookahead-t.strstart,t.strstart>=f+(f-I)){for(r.arraySet(t.window,t.window,f,f,0),t.match_start-=f,t.strstart-=f,t.block_start-=f,e=a=t.hash_size;n=t.head[--e],t.head[e]=f<=n?n-f:0,--a;);for(e=a=f;n=t.prev[--e],t.prev[e]=f<=n?n-f:0,--a;);o+=f}if(0===t.strm.avail_in)break;if(d=t.strm,c=t.window,h=t.strstart+t.lookahead,u=void 0,(p=o)<(u=d.avail_in)&&(u=p),a=0===u?0:(d.avail_in-=u,r.arraySet(c,d.input,d.next_in,u,h),1===d.state.wrap?d.adler=i(d.adler,c,u,h):2===d.state.wrap&&(d.adler=l(d.adler,c,u,h)),d.next_in+=u,d.total_in+=u,u),t.lookahead+=a,t.lookahead+t.insert>=S)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=(t.ins_h<<t.hash_shift^t.window[s+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[s+S-1])&t.hash_mask,t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<S)););}while(t.lookahead<I&&0!==t.strm.avail_in)}function F(t,e){for(var a,n;;){if(t.lookahead<I){if(U(t),t.lookahead<I&&e===d)return k;if(0===t.lookahead)break}if(a=0,t.lookahead>=S&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+S-1])&t.hash_mask,a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-I&&(t.match_length=H(t,a)),t.match_length>=S)if(n=o._tr_tally(t,t.strstart-t.match_start,t.match_length-S),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=S){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+S-1])&t.hash_mask,a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart,0!=--t.match_length;);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else n=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(O(t,!1),0===t.strm.avail_out))return k}return t.insert=t.strstart<S-1?t.strstart:S-1,e===c?(O(t,!0),0===t.strm.avail_out?E:R):t.last_lit&&(O(t,!1),0===t.strm.avail_out)?k:V}function B(t,e){for(var a,n,r;;){if(t.lookahead<I){if(U(t),t.lookahead<I&&e===d)return k;if(0===t.lookahead)break}if(a=0,t.lookahead>=S&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+S-1])&t.hash_mask,a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=S-1,0!==a&&t.prev_length<t.max_lazy_match&&t.strstart-a<=t.w_size-I&&(t.match_length=H(t,a),t.match_length<=5&&(1===t.strategy||t.match_length===S&&4096<t.strstart-t.match_start)&&(t.match_length=S-1)),t.prev_length>=S&&t.match_length<=t.prev_length){for(r=t.strstart+t.lookahead-S,n=o._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-S),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=r&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+S-1])&t.hash_mask,a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!=--t.prev_length;);if(t.match_available=0,t.match_length=S-1,t.strstart++,n&&(O(t,!1),0===t.strm.avail_out))return k}else if(t.match_available){if((n=o._tr_tally(t,0,t.window[t.strstart-1]))&&O(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return k}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=o._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<S-1?t.strstart:S-1,e===c?(O(t,!0),0===t.strm.avail_out?E:R):t.last_lit&&(O(t,!1),0===t.strm.avail_out)?k:V}function G(t,e,a,n,r){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=n,this.func=r}function Z(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=m,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new r.Buf16(2*x),this.dyn_dtree=new r.Buf16(2*(2*y+1)),this.bl_tree=new r.Buf16(2*(2*M+1)),N(this.dyn_ltree),N(this.dyn_dtree),N(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new r.Buf16(w+1),this.heap=new r.Buf16(2*b+1),N(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new r.Buf16(2*b+1),N(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function K(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=g,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?T:C,t.adler=2===e.wrap?0:1,e.last_flush=d,o._tr_init(e),h):L(t,p)}function D(t){var e,a=K(t);return a===h&&((e=t.state).window_size=2*e.w_size,N(e.head),e.max_lazy_match=n[e.level].max_lazy,e.good_match=n[e.level].good_length,e.nice_match=n[e.level].nice_length,e.max_chain_length=n[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=S-1,e.match_available=0,e.ins_h=0),a}function j(t,e,a,n,o,i){if(!t)return p;var l=1;if(e===u&&(e=6),n<0?(l=0,n=-n):15<n&&(l=2,n-=16),o<1||v<o||a!==m||n<8||15<n||e<0||9<e||i<0||f<i)return L(t,p);8===n&&(n=9);var s=new Z;return(t.state=s).strm=t,s.wrap=l,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=o+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+S-1)/S),s.window=new r.Buf8(2*s.w_size),s.head=new r.Buf16(s.hash_size),s.prev=new r.Buf16(s.w_size),s.lit_bufsize=1<<o+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new r.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=e,s.strategy=i,s.method=a,D(t)}n=[new G(0,0,0,0,function(t,e){var a=65535;for(a>t.pending_buf_size-5&&(a=t.pending_buf_size-5);;){if(t.lookahead<=1){if(U(t),0===t.lookahead&&e===d)return k;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+a;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,O(t,!1),0===t.strm.avail_out))return k;if(t.strstart-t.block_start>=t.w_size-I&&(O(t,!1),0===t.strm.avail_out))return k}return t.insert=0,e===c?(O(t,!0),0===t.strm.avail_out?E:R):(t.strstart>t.block_start&&(O(t,!1),t.strm.avail_out),k)}),new G(4,4,8,4,F),new G(4,5,16,8,F),new G(4,6,32,32,F),new G(4,4,16,16,B),new G(8,16,32,32,B),new G(8,16,128,128,B),new G(8,32,128,256,B),new G(32,128,258,1024,B),new G(32,258,258,4096,B)],a.deflateInit=function(t,e){return j(t,e,m,15,8,0)},a.deflateInit2=j,a.deflateReset=D,a.deflateResetKeep=K,a.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?p:(t.state.gzhead=e,h):p},a.deflate=function(t,e){var a,r,i,s;if(!t||!t.state||5<e||e<0)return t?L(t,p):p;if(r=t.state,!t.output||!t.input&&0!==t.avail_in||666===r.status&&e!==c)return L(t,0===t.avail_out?-5:p);if(r.strm=t,a=r.last_flush,r.last_flush=e,r.status===T)if(2===r.wrap)t.adler=0,P(r,31),P(r,139),P(r,8),r.gzhead?(P(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),P(r,255&r.gzhead.time),P(r,r.gzhead.time>>8&255),P(r,r.gzhead.time>>16&255),P(r,r.gzhead.time>>24&255),P(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),P(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(P(r,255&r.gzhead.extra.length),P(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=l(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(P(r,0),P(r,0),P(r,0),P(r,0),P(r,0),P(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),P(r,3),r.status=C);else{var u=m+(r.w_bits-8<<4)<<8;u|=(2<=r.strategy||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(u|=32),u+=31-u%31,r.status=C,W(r,u),0!==r.strstart&&(W(r,t.adler>>>16),W(r,65535&t.adler)),t.adler=1}if(69===r.status)if(r.gzhead.extra){for(i=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>i&&(t.adler=l(t.adler,r.pending_buf,r.pending-i,i)),q(t),i=r.pending,r.pending!==r.pending_buf_size));)P(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>i&&(t.adler=l(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=l(t.adler,r.pending_buf,r.pending-i,i)),q(t),i=r.pending,r.pending===r.pending_buf_size)){s=1;break}s=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,P(r,s)}while(0!==s);r.gzhead.hcrc&&r.pending>i&&(t.adler=l(t.adler,r.pending_buf,r.pending-i,i)),0===s&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=l(t.adler,r.pending_buf,r.pending-i,i)),q(t),i=r.pending,r.pending===r.pending_buf_size)){s=1;break}s=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,P(r,s)}while(0!==s);r.gzhead.hcrc&&r.pending>i&&(t.adler=l(t.adler,r.pending_buf,r.pending-i,i)),0===s&&(r.status=103)}else r.status=103;if(103===r.status&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&q(t),r.pending+2<=r.pending_buf_size&&(P(r,255&t.adler),P(r,t.adler>>8&255),t.adler=0,r.status=C)):r.status=C),0!==r.pending){if(q(t),0===t.avail_out)return r.last_flush=-1,h}else if(0===t.avail_in&&z(e)<=z(a)&&e!==c)return L(t,-5);if(666===r.status&&0!==t.avail_in)return L(t,-5);if(0!==t.avail_in||0!==r.lookahead||e!==d&&666!==r.status){var f=2===r.strategy?function(t,e){for(var a;;){if(0===t.lookahead&&(U(t),0===t.lookahead)){if(e===d)return k;break}if(t.match_length=0,a=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(O(t,!1),0===t.strm.avail_out))return k}return t.insert=0,e===c?(O(t,!0),0===t.strm.avail_out?E:R):t.last_lit&&(O(t,!1),0===t.strm.avail_out)?k:V}(r,e):3===r.strategy?function(t,e){for(var a,n,r,i,l=t.window;;){if(t.lookahead<=A){if(U(t),t.lookahead<=A&&e===d)return k;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=S&&0<t.strstart&&(n=l[r=t.strstart-1])===l[++r]&&n===l[++r]&&n===l[++r]){i=t.strstart+A;do{}while(n===l[++r]&&n===l[++r]&&n===l[++r]&&n===l[++r]&&n===l[++r]&&n===l[++r]&&n===l[++r]&&n===l[++r]&&r<i);t.match_length=A-(i-r),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=S?(a=o._tr_tally(t,1,t.match_length-S),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(O(t,!1),0===t.strm.avail_out))return k}return t.insert=0,e===c?(O(t,!0),0===t.strm.avail_out?E:R):t.last_lit&&(O(t,!1),0===t.strm.avail_out)?k:V}(r,e):n[r.level].func(r,e);if(f!==E&&f!==R||(r.status=666),f===k||f===E)return 0===t.avail_out&&(r.last_flush=-1),h;if(f===V&&(1===e?o._tr_align(r):5!==e&&(o._tr_stored_block(r,0,0,!1),3===e&&(N(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),q(t),0===t.avail_out))return r.last_flush=-1,h}return e!==c?h:r.wrap<=0?1:(2===r.wrap?(P(r,255&t.adler),P(r,t.adler>>8&255),P(r,t.adler>>16&255),P(r,t.adler>>24&255),P(r,255&t.total_in),P(r,t.total_in>>8&255),P(r,t.total_in>>16&255),P(r,t.total_in>>24&255)):(W(r,t.adler>>>16),W(r,65535&t.adler)),q(t),0<r.wrap&&(r.wrap=-r.wrap),0!==r.pending?h:1)},a.deflateEnd=function(t){var e;return t&&t.state?(e=t.state.status)!==T&&69!==e&&73!==e&&91!==e&&103!==e&&e!==C&&666!==e?L(t,p):(t.state=null,e===C?L(t,-3):h):p},a.deflateSetDictionary=function(t,e){var a,n,o,l,s,d,c,u,f=e.length;if(!t||!t.state)return p;if(2===(l=(a=t.state).wrap)||1===l&&a.status!==T||a.lookahead)return p;for(1===l&&(t.adler=i(t.adler,e,f,0)),a.wrap=0,f>=a.w_size&&(0===l&&(N(a.head),a.strstart=0,a.block_start=0,a.insert=0),u=new r.Buf8(a.w_size),r.arraySet(u,e,f-a.w_size,a.w_size,0),e=u,f=a.w_size),s=t.avail_in,d=t.next_in,c=t.input,t.avail_in=f,t.next_in=0,t.input=e,U(a);a.lookahead>=S;){for(n=a.strstart,o=a.lookahead-(S-1);a.ins_h=(a.ins_h<<a.hash_shift^a.window[n+S-1])&a.hash_mask,a.prev[n&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=n,n++,--o;);a.strstart=n,a.lookahead=S-1,U(a)}return a.strstart+=a.lookahead,a.block_start=a.strstart,a.insert=a.lookahead,a.lookahead=0,a.match_length=a.prev_length=S-1,a.match_available=0,t.next_in=d,t.input=c,t.avail_in=s,a.wrap=l,h},a.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,e,a){e.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(t,e,a){e.exports=function(t,e){var a,n,r,o,i,l,s,d,c,h,p,u,f,g,m,v,b,y,M,x,w,S,A,I,T;a=t.state,n=t.next_in,I=t.input,r=n+(t.avail_in-5),o=t.next_out,T=t.output,i=o-(e-t.avail_out),l=o+(t.avail_out-257),s=a.dmax,d=a.wsize,c=a.whave,h=a.wnext,p=a.window,u=a.hold,f=a.bits,g=a.lencode,m=a.distcode,v=(1<<a.lenbits)-1,b=(1<<a.distbits)-1;t:do{f<15&&(u+=I[n++]<<f,f+=8,u+=I[n++]<<f,f+=8),y=g[u&v];e:for(;;){if(u>>>=M=y>>>24,f-=M,0==(M=y>>>16&255))T[o++]=65535&y;else{if(!(16&M)){if(!(64&M)){y=g[(65535&y)+(u&(1<<M)-1)];continue e}if(32&M){a.mode=12;break t}t.msg="invalid literal/length code",a.mode=30;break t}x=65535&y,(M&=15)&&(f<M&&(u+=I[n++]<<f,f+=8),x+=u&(1<<M)-1,u>>>=M,f-=M),f<15&&(u+=I[n++]<<f,f+=8,u+=I[n++]<<f,f+=8),y=m[u&b];a:for(;;){if(u>>>=M=y>>>24,f-=M,!(16&(M=y>>>16&255))){if(!(64&M)){y=m[(65535&y)+(u&(1<<M)-1)];continue a}t.msg="invalid distance code",a.mode=30;break t}if(w=65535&y,f<(M&=15)&&(u+=I[n++]<<f,(f+=8)<M&&(u+=I[n++]<<f,f+=8)),s<(w+=u&(1<<M)-1)){t.msg="invalid distance too far back",a.mode=30;break t}if(u>>>=M,f-=M,(M=o-i)<w){if(c<(M=w-M)&&a.sane){t.msg="invalid distance too far back",a.mode=30;break t}if(A=p,(S=0)===h){if(S+=d-M,M<x){for(x-=M;T[o++]=p[S++],--M;);S=o-w,A=T}}else if(h<M){if(S+=d+h-M,(M-=h)<x){for(x-=M;T[o++]=p[S++],--M;);if(S=0,h<x){for(x-=M=h;T[o++]=p[S++],--M;);S=o-w,A=T}}}else if(S+=h-M,M<x){for(x-=M;T[o++]=p[S++],--M;);S=o-w,A=T}for(;2<x;)T[o++]=A[S++],T[o++]=A[S++],T[o++]=A[S++],x-=3;x&&(T[o++]=A[S++],1<x&&(T[o++]=A[S++]))}else{for(S=o-w;T[o++]=T[S++],T[o++]=T[S++],T[o++]=T[S++],2<(x-=3););x&&(T[o++]=T[S++],1<x&&(T[o++]=T[S++]))}break}}break}}while(n<r&&o<l);n-=x=f>>3,u&=(1<<(f-=x<<3))-1,t.next_in=n,t.next_out=o,t.avail_in=n<r?r-n+5:5-(n-r),t.avail_out=o<l?l-o+257:257-(o-l),a.hold=u,a.bits=f}},{}],49:[function(t,e,a){var n=t("../utils/common"),r=t("./adler32"),o=t("./crc32"),i=t("./inffast"),l=t("./inftrees"),s=1,d=2,c=0,h=-2,p=1,u=852,f=592;function g(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function m(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function v(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=p,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new n.Buf32(u),e.distcode=e.distdyn=new n.Buf32(f),e.sane=1,e.back=-1,c):h}function b(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,v(t)):h}function y(t,e){var a,n;return t&&t.state?(n=t.state,e<0?(a=0,e=-e):(a=1+(e>>4),e<48&&(e&=15)),e&&(e<8||15<e)?h:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=a,n.wbits=e,b(t))):h}function M(t,e){var a,n;return t?(n=new m,(t.state=n).window=null,(a=y(t,e))!==c&&(t.state=null),a):h}var x,w,S=!0;function A(t){if(S){var e;for(x=new n.Buf32(512),w=new n.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(l(s,t.lens,0,288,x,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;l(d,t.lens,0,32,w,0,t.work,{bits:5}),S=!1}t.lencode=x,t.lenbits=9,t.distcode=w,t.distbits=5}function I(t,e,a,r){var o,i=t.state;return null===i.window&&(i.wsize=1<<i.wbits,i.wnext=0,i.whave=0,i.window=new n.Buf8(i.wsize)),r>=i.wsize?(n.arraySet(i.window,e,a-i.wsize,i.wsize,0),i.wnext=0,i.whave=i.wsize):(r<(o=i.wsize-i.wnext)&&(o=r),n.arraySet(i.window,e,a-r,o,i.wnext),(r-=o)?(n.arraySet(i.window,e,a-r,r,0),i.wnext=r,i.whave=i.wsize):(i.wnext+=o,i.wnext===i.wsize&&(i.wnext=0),i.whave<i.wsize&&(i.whave+=o))),0}a.inflateReset=b,a.inflateReset2=y,a.inflateResetKeep=v,a.inflateInit=function(t){return M(t,15)},a.inflateInit2=M,a.inflate=function(t,e){var a,u,f,m,v,b,y,M,x,w,S,T,C,k,V,E,R,L,z,N,q,O,P,W,H=0,U=new n.Buf8(4),F=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return h;12===(a=t.state).mode&&(a.mode=13),v=t.next_out,f=t.output,y=t.avail_out,m=t.next_in,u=t.input,b=t.avail_in,M=a.hold,x=a.bits,w=b,S=y,O=c;t:for(;;)switch(a.mode){case p:if(0===a.wrap){a.mode=13;break}for(;x<16;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}if(2&a.wrap&&35615===M){U[a.check=0]=255&M,U[1]=M>>>8&255,a.check=o(a.check,U,2,0),x=M=0,a.mode=2;break}if(a.flags=0,a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&M)<<8)+(M>>8))%31){t.msg="incorrect header check",a.mode=30;break}if(8!=(15&M)){t.msg="unknown compression method",a.mode=30;break}if(x-=4,q=8+(15&(M>>>=4)),0===a.wbits)a.wbits=q;else if(q>a.wbits){t.msg="invalid window size",a.mode=30;break}a.dmax=1<<q,t.adler=a.check=1,a.mode=512&M?10:12,x=M=0;break;case 2:for(;x<16;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}if(a.flags=M,8!=(255&a.flags)){t.msg="unknown compression method",a.mode=30;break}if(57344&a.flags){t.msg="unknown header flags set",a.mode=30;break}a.head&&(a.head.text=M>>8&1),512&a.flags&&(U[0]=255&M,U[1]=M>>>8&255,a.check=o(a.check,U,2,0)),x=M=0,a.mode=3;case 3:for(;x<32;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}a.head&&(a.head.time=M),512&a.flags&&(U[0]=255&M,U[1]=M>>>8&255,U[2]=M>>>16&255,U[3]=M>>>24&255,a.check=o(a.check,U,4,0)),x=M=0,a.mode=4;case 4:for(;x<16;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}a.head&&(a.head.xflags=255&M,a.head.os=M>>8),512&a.flags&&(U[0]=255&M,U[1]=M>>>8&255,a.check=o(a.check,U,2,0)),x=M=0,a.mode=5;case 5:if(1024&a.flags){for(;x<16;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}a.length=M,a.head&&(a.head.extra_len=M),512&a.flags&&(U[0]=255&M,U[1]=M>>>8&255,a.check=o(a.check,U,2,0)),x=M=0}else a.head&&(a.head.extra=null);a.mode=6;case 6:if(1024&a.flags&&(b<(T=a.length)&&(T=b),T&&(a.head&&(q=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Array(a.head.extra_len)),n.arraySet(a.head.extra,u,m,T,q)),512&a.flags&&(a.check=o(a.check,u,T,m)),b-=T,m+=T,a.length-=T),a.length))break t;a.length=0,a.mode=7;case 7:if(2048&a.flags){if(0===b)break t;for(T=0;q=u[m+T++],a.head&&q&&a.length<65536&&(a.head.name+=String.fromCharCode(q)),q&&T<b;);if(512&a.flags&&(a.check=o(a.check,u,T,m)),b-=T,m+=T,q)break t}else a.head&&(a.head.name=null);a.length=0,a.mode=8;case 8:if(4096&a.flags){if(0===b)break t;for(T=0;q=u[m+T++],a.head&&q&&a.length<65536&&(a.head.comment+=String.fromCharCode(q)),q&&T<b;);if(512&a.flags&&(a.check=o(a.check,u,T,m)),b-=T,m+=T,q)break t}else a.head&&(a.head.comment=null);a.mode=9;case 9:if(512&a.flags){for(;x<16;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}if(M!==(65535&a.check)){t.msg="header crc mismatch",a.mode=30;break}x=M=0}a.head&&(a.head.hcrc=a.flags>>9&1,a.head.done=!0),t.adler=a.check=0,a.mode=12;break;case 10:for(;x<32;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}t.adler=a.check=g(M),x=M=0,a.mode=11;case 11:if(0===a.havedict)return t.next_out=v,t.avail_out=y,t.next_in=m,t.avail_in=b,a.hold=M,a.bits=x,2;t.adler=a.check=1,a.mode=12;case 12:if(5===e||6===e)break t;case 13:if(a.last){M>>>=7&x,x-=7&x,a.mode=27;break}for(;x<3;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}switch(a.last=1&M,x-=1,3&(M>>>=1)){case 0:a.mode=14;break;case 1:if(A(a),a.mode=20,6!==e)break;M>>>=2,x-=2;break t;case 2:a.mode=17;break;case 3:t.msg="invalid block type",a.mode=30}M>>>=2,x-=2;break;case 14:for(M>>>=7&x,x-=7&x;x<32;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}if((65535&M)!=(M>>>16^65535)){t.msg="invalid stored block lengths",a.mode=30;break}if(a.length=65535&M,x=M=0,a.mode=15,6===e)break t;case 15:a.mode=16;case 16:if(T=a.length){if(b<T&&(T=b),y<T&&(T=y),0===T)break t;n.arraySet(f,u,m,T,v),b-=T,m+=T,y-=T,v+=T,a.length-=T;break}a.mode=12;break;case 17:for(;x<14;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}if(a.nlen=257+(31&M),M>>>=5,x-=5,a.ndist=1+(31&M),M>>>=5,x-=5,a.ncode=4+(15&M),M>>>=4,x-=4,286<a.nlen||30<a.ndist){t.msg="too many length or distance symbols",a.mode=30;break}a.have=0,a.mode=18;case 18:for(;a.have<a.ncode;){for(;x<3;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}a.lens[F[a.have++]]=7&M,M>>>=3,x-=3}for(;a.have<19;)a.lens[F[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,P={bits:a.lenbits},O=l(0,a.lens,0,19,a.lencode,0,a.work,P),a.lenbits=P.bits,O){t.msg="invalid code lengths set",a.mode=30;break}a.have=0,a.mode=19;case 19:for(;a.have<a.nlen+a.ndist;){for(;E=(H=a.lencode[M&(1<<a.lenbits)-1])>>>16&255,R=65535&H,!((V=H>>>24)<=x);){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}if(R<16)M>>>=V,x-=V,a.lens[a.have++]=R;else{if(16===R){for(W=V+2;x<W;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}if(M>>>=V,x-=V,0===a.have){t.msg="invalid bit length repeat",a.mode=30;break}q=a.lens[a.have-1],T=3+(3&M),M>>>=2,x-=2}else if(17===R){for(W=V+3;x<W;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}x-=V,q=0,T=3+(7&(M>>>=V)),M>>>=3,x-=3}else{for(W=V+7;x<W;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}x-=V,q=0,T=11+(127&(M>>>=V)),M>>>=7,x-=7}if(a.have+T>a.nlen+a.ndist){t.msg="invalid bit length repeat",a.mode=30;break}for(;T--;)a.lens[a.have++]=q}}if(30===a.mode)break;if(0===a.lens[256]){t.msg="invalid code -- missing end-of-block",a.mode=30;break}if(a.lenbits=9,P={bits:a.lenbits},O=l(s,a.lens,0,a.nlen,a.lencode,0,a.work,P),a.lenbits=P.bits,O){t.msg="invalid literal/lengths set",a.mode=30;break}if(a.distbits=6,a.distcode=a.distdyn,P={bits:a.distbits},O=l(d,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,P),a.distbits=P.bits,O){t.msg="invalid distances set",a.mode=30;break}if(a.mode=20,6===e)break t;case 20:a.mode=21;case 21:if(6<=b&&258<=y){t.next_out=v,t.avail_out=y,t.next_in=m,t.avail_in=b,a.hold=M,a.bits=x,i(t,S),v=t.next_out,f=t.output,y=t.avail_out,m=t.next_in,u=t.input,b=t.avail_in,M=a.hold,x=a.bits,12===a.mode&&(a.back=-1);break}for(a.back=0;E=(H=a.lencode[M&(1<<a.lenbits)-1])>>>16&255,R=65535&H,!((V=H>>>24)<=x);){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}if(E&&!(240&E)){for(L=V,z=E,N=R;E=(H=a.lencode[N+((M&(1<<L+z)-1)>>L)])>>>16&255,R=65535&H,!(L+(V=H>>>24)<=x);){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}M>>>=L,x-=L,a.back+=L}if(M>>>=V,x-=V,a.back+=V,a.length=R,0===E){a.mode=26;break}if(32&E){a.back=-1,a.mode=12;break}if(64&E){t.msg="invalid literal/length code",a.mode=30;break}a.extra=15&E,a.mode=22;case 22:if(a.extra){for(W=a.extra;x<W;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}a.length+=M&(1<<a.extra)-1,M>>>=a.extra,x-=a.extra,a.back+=a.extra}a.was=a.length,a.mode=23;case 23:for(;E=(H=a.distcode[M&(1<<a.distbits)-1])>>>16&255,R=65535&H,!((V=H>>>24)<=x);){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}if(!(240&E)){for(L=V,z=E,N=R;E=(H=a.distcode[N+((M&(1<<L+z)-1)>>L)])>>>16&255,R=65535&H,!(L+(V=H>>>24)<=x);){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}M>>>=L,x-=L,a.back+=L}if(M>>>=V,x-=V,a.back+=V,64&E){t.msg="invalid distance code",a.mode=30;break}a.offset=R,a.extra=15&E,a.mode=24;case 24:if(a.extra){for(W=a.extra;x<W;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}a.offset+=M&(1<<a.extra)-1,M>>>=a.extra,x-=a.extra,a.back+=a.extra}if(a.offset>a.dmax){t.msg="invalid distance too far back",a.mode=30;break}a.mode=25;case 25:if(0===y)break t;if(T=S-y,a.offset>T){if((T=a.offset-T)>a.whave&&a.sane){t.msg="invalid distance too far back",a.mode=30;break}C=T>a.wnext?(T-=a.wnext,a.wsize-T):a.wnext-T,T>a.length&&(T=a.length),k=a.window}else k=f,C=v-a.offset,T=a.length;for(y<T&&(T=y),y-=T,a.length-=T;f[v++]=k[C++],--T;);0===a.length&&(a.mode=21);break;case 26:if(0===y)break t;f[v++]=a.length,y--,a.mode=21;break;case 27:if(a.wrap){for(;x<32;){if(0===b)break t;b--,M|=u[m++]<<x,x+=8}if(S-=y,t.total_out+=S,a.total+=S,S&&(t.adler=a.check=a.flags?o(a.check,f,S,v-S):r(a.check,f,S,v-S)),S=y,(a.flags?M:g(M))!==a.check){t.msg="incorrect data check",a.mode=30;break}x=M=0}a.mode=28;case 28:if(a.wrap&&a.flags){for(;x<32;){if(0===b)break t;b--,M+=u[m++]<<x,x+=8}if(M!==(4294967295&a.total)){t.msg="incorrect length check",a.mode=30;break}x=M=0}a.mode=29;case 29:O=1;break t;case 30:O=-3;break t;case 31:return-4;default:return h}return t.next_out=v,t.avail_out=y,t.next_in=m,t.avail_in=b,a.hold=M,a.bits=x,(a.wsize||S!==t.avail_out&&a.mode<30&&(a.mode<27||4!==e))&&I(t,t.output,t.next_out,S-t.avail_out)?(a.mode=31,-4):(w-=t.avail_in,S-=t.avail_out,t.total_in+=w,t.total_out+=S,a.total+=S,a.wrap&&S&&(t.adler=a.check=a.flags?o(a.check,f,S,t.next_out-S):r(a.check,f,S,t.next_out-S)),t.data_type=a.bits+(a.last?64:0)+(12===a.mode?128:0)+(20===a.mode||15===a.mode?256:0),(0==w&&0===S||4===e)&&O===c&&(O=-5),O)},a.inflateEnd=function(t){if(!t||!t.state)return h;var e=t.state;return e.window&&(e.window=null),t.state=null,c},a.inflateGetHeader=function(t,e){var a;return t&&t.state&&2&(a=t.state).wrap?((a.head=e).done=!1,c):h},a.inflateSetDictionary=function(t,e){var a,n=e.length;return t&&t.state?0!==(a=t.state).wrap&&11!==a.mode?h:11===a.mode&&r(1,e,n,0)!==a.check?-3:I(t,e,n,n)?(a.mode=31,-4):(a.havedict=1,c):h},a.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,e,a){var n=t("../utils/common"),r=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],i=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],l=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(t,e,a,s,d,c,h,p){var u,f,g,m,v,b,y,M,x,w=p.bits,S=0,A=0,I=0,T=0,C=0,k=0,V=0,E=0,R=0,L=0,z=null,N=0,q=new n.Buf16(16),O=new n.Buf16(16),P=null,W=0;for(S=0;S<=15;S++)q[S]=0;for(A=0;A<s;A++)q[e[a+A]]++;for(C=w,T=15;1<=T&&0===q[T];T--);if(T<C&&(C=T),0===T)return d[c++]=20971520,d[c++]=20971520,p.bits=1,0;for(I=1;I<T&&0===q[I];I++);for(C<I&&(C=I),S=E=1;S<=15;S++)if(E<<=1,(E-=q[S])<0)return-1;if(0<E&&(0===t||1!==T))return-1;for(O[1]=0,S=1;S<15;S++)O[S+1]=O[S]+q[S];for(A=0;A<s;A++)0!==e[a+A]&&(h[O[e[a+A]]++]=A);if(b=0===t?(z=P=h,19):1===t?(z=r,N-=257,P=o,W-=257,256):(z=i,P=l,-1),S=I,v=c,V=A=L=0,g=-1,m=(R=1<<(k=C))-1,1===t&&852<R||2===t&&592<R)return 1;for(;;){for(y=S-V,x=h[A]<b?(M=0,h[A]):h[A]>b?(M=P[W+h[A]],z[N+h[A]]):(M=96,0),u=1<<S-V,I=f=1<<k;d[v+(L>>V)+(f-=u)]=y<<24|M<<16|x,0!==f;);for(u=1<<S-1;L&u;)u>>=1;if(0!==u?(L&=u-1,L+=u):L=0,A++,0==--q[S]){if(S===T)break;S=e[a+h[A]]}if(C<S&&(L&m)!==g){for(0===V&&(V=C),v+=I,E=1<<(k=S-V);k+V<T&&!((E-=q[k+V])<=0);)k++,E<<=1;if(R+=1<<k,1===t&&852<R||2===t&&592<R)return 1;d[g=L&m]=C<<24|k<<16|v-c}}return 0!==L&&(d[v+L]=S-V<<24|64<<16),p.bits=C,0}},{"../utils/common":41}],51:[function(t,e,a){e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(t,e,a){var n=t("../utils/common"),r=0,o=1;function i(t){for(var e=t.length;0<=--e;)t[e]=0}var l=0,s=29,d=256,c=d+1+s,h=30,p=19,u=2*c+1,f=15,g=16,m=7,v=256,b=16,y=17,M=18,x=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],w=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],S=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],A=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],I=new Array(2*(c+2));i(I);var T=new Array(2*h);i(T);var C=new Array(512);i(C);var k=new Array(256);i(k);var V=new Array(s);i(V);var E,R,L,z=new Array(h);function N(t,e,a,n,r){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=n,this.max_length=r,this.has_stree=t&&t.length}function q(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function O(t){return t<256?C[t]:C[256+(t>>>7)]}function P(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function W(t,e,a){t.bi_valid>g-a?(t.bi_buf|=e<<t.bi_valid&65535,P(t,t.bi_buf),t.bi_buf=e>>g-t.bi_valid,t.bi_valid+=a-g):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=a)}function H(t,e,a){W(t,a[2*e],a[2*e+1])}function U(t,e){for(var a=0;a|=1&t,t>>>=1,a<<=1,0<--e;);return a>>>1}function F(t,e,a){var n,r,o=new Array(f+1),i=0;for(n=1;n<=f;n++)o[n]=i=i+a[n-1]<<1;for(r=0;r<=e;r++){var l=t[2*r+1];0!==l&&(t[2*r]=U(o[l]++,l))}}function B(t){var e;for(e=0;e<c;e++)t.dyn_ltree[2*e]=0;for(e=0;e<h;e++)t.dyn_dtree[2*e]=0;for(e=0;e<p;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*v]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function G(t){8<t.bi_valid?P(t,t.bi_buf):0<t.bi_valid&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function Z(t,e,a,n){var r=2*e,o=2*a;return t[r]<t[o]||t[r]===t[o]&&n[e]<=n[a]}function K(t,e,a){for(var n=t.heap[a],r=a<<1;r<=t.heap_len&&(r<t.heap_len&&Z(e,t.heap[r+1],t.heap[r],t.depth)&&r++,!Z(e,n,t.heap[r],t.depth));)t.heap[a]=t.heap[r],a=r,r<<=1;t.heap[a]=n}function D(t,e,a){var n,r,o,i,l=0;if(0!==t.last_lit)for(;n=t.pending_buf[t.d_buf+2*l]<<8|t.pending_buf[t.d_buf+2*l+1],r=t.pending_buf[t.l_buf+l],l++,0===n?H(t,r,e):(H(t,(o=k[r])+d+1,e),0!==(i=x[o])&&W(t,r-=V[o],i),H(t,o=O(--n),a),0!==(i=w[o])&&W(t,n-=z[o],i)),l<t.last_lit;);H(t,v,e)}function j(t,e){var a,n,r,o=e.dyn_tree,i=e.stat_desc.static_tree,l=e.stat_desc.has_stree,s=e.stat_desc.elems,d=-1;for(t.heap_len=0,t.heap_max=u,a=0;a<s;a++)0!==o[2*a]?(t.heap[++t.heap_len]=d=a,t.depth[a]=0):o[2*a+1]=0;for(;t.heap_len<2;)o[2*(r=t.heap[++t.heap_len]=d<2?++d:0)]=1,t.depth[r]=0,t.opt_len--,l&&(t.static_len-=i[2*r+1]);for(e.max_code=d,a=t.heap_len>>1;1<=a;a--)K(t,o,a);for(r=s;a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],K(t,o,1),n=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=n,o[2*r]=o[2*a]+o[2*n],t.depth[r]=(t.depth[a]>=t.depth[n]?t.depth[a]:t.depth[n])+1,o[2*a+1]=o[2*n+1]=r,t.heap[1]=r++,K(t,o,1),2<=t.heap_len;);t.heap[--t.heap_max]=t.heap[1],function(t,e){var a,n,r,o,i,l,s=e.dyn_tree,d=e.max_code,c=e.stat_desc.static_tree,h=e.stat_desc.has_stree,p=e.stat_desc.extra_bits,g=e.stat_desc.extra_base,m=e.stat_desc.max_length,v=0;for(o=0;o<=f;o++)t.bl_count[o]=0;for(s[2*t.heap[t.heap_max]+1]=0,a=t.heap_max+1;a<u;a++)m<(o=s[2*s[2*(n=t.heap[a])+1]+1]+1)&&(o=m,v++),s[2*n+1]=o,d<n||(t.bl_count[o]++,i=0,g<=n&&(i=p[n-g]),l=s[2*n],t.opt_len+=l*(o+i),h&&(t.static_len+=l*(c[2*n+1]+i)));if(0!==v){do{for(o=m-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[m]--,v-=2}while(0<v);for(o=m;0!==o;o--)for(n=t.bl_count[o];0!==n;)d<(r=t.heap[--a])||(s[2*r+1]!==o&&(t.opt_len+=(o-s[2*r+1])*s[2*r],s[2*r+1]=o),n--)}}(t,e),F(o,d,t.bl_count)}function X(t,e,a){var n,r,o=-1,i=e[1],l=0,s=7,d=4;for(0===i&&(s=138,d=3),e[2*(a+1)+1]=65535,n=0;n<=a;n++)r=i,i=e[2*(n+1)+1],++l<s&&r===i||(l<d?t.bl_tree[2*r]+=l:0!==r?(r!==o&&t.bl_tree[2*r]++,t.bl_tree[2*b]++):l<=10?t.bl_tree[2*y]++:t.bl_tree[2*M]++,o=r,d=(l=0)===i?(s=138,3):r===i?(s=6,3):(s=7,4))}function J(t,e,a){var n,r,o=-1,i=e[1],l=0,s=7,d=4;for(0===i&&(s=138,d=3),n=0;n<=a;n++)if(r=i,i=e[2*(n+1)+1],!(++l<s&&r===i)){if(l<d)for(;H(t,r,t.bl_tree),0!=--l;);else 0!==r?(r!==o&&(H(t,r,t.bl_tree),l--),H(t,b,t.bl_tree),W(t,l-3,2)):l<=10?(H(t,y,t.bl_tree),W(t,l-3,3)):(H(t,M,t.bl_tree),W(t,l-11,7));o=r,d=(l=0)===i?(s=138,3):r===i?(s=6,3):(s=7,4)}}i(z);var Y=!1;function Q(t,e,a,r){var o,i,s;W(t,(l<<1)+(r?1:0),3),i=e,s=a,G(o=t),P(o,s),P(o,~s),n.arraySet(o.pending_buf,o.window,i,s,o.pending),o.pending+=s}a._tr_init=function(t){Y||(function(){var t,e,a,n,r,o=new Array(f+1);for(n=a=0;n<s-1;n++)for(V[n]=a,t=0;t<1<<x[n];t++)k[a++]=n;for(k[a-1]=n,n=r=0;n<16;n++)for(z[n]=r,t=0;t<1<<w[n];t++)C[r++]=n;for(r>>=7;n<h;n++)for(z[n]=r<<7,t=0;t<1<<w[n]-7;t++)C[256+r++]=n;for(e=0;e<=f;e++)o[e]=0;for(t=0;t<=143;)I[2*t+1]=8,t++,o[8]++;for(;t<=255;)I[2*t+1]=9,t++,o[9]++;for(;t<=279;)I[2*t+1]=7,t++,o[7]++;for(;t<=287;)I[2*t+1]=8,t++,o[8]++;for(F(I,c+1,o),t=0;t<h;t++)T[2*t+1]=5,T[2*t]=U(t,5);E=new N(I,x,d+1,c,f),R=new N(T,w,0,h,f),L=new N(new Array(0),S,0,p,m)}(),Y=!0),t.l_desc=new q(t.dyn_ltree,E),t.d_desc=new q(t.dyn_dtree,R),t.bl_desc=new q(t.bl_tree,L),t.bi_buf=0,t.bi_valid=0,B(t)},a._tr_stored_block=Q,a._tr_flush_block=function(t,e,a,n){var i,l,s=0;0<t.level?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,a=4093624447;for(e=0;e<=31;e++,a>>>=1)if(1&a&&0!==t.dyn_ltree[2*e])return r;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return o;for(e=32;e<d;e++)if(0!==t.dyn_ltree[2*e])return o;return r}(t)),j(t,t.l_desc),j(t,t.d_desc),s=function(t){var e;for(X(t,t.dyn_ltree,t.l_desc.max_code),X(t,t.dyn_dtree,t.d_desc.max_code),j(t,t.bl_desc),e=p-1;3<=e&&0===t.bl_tree[2*A[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),i=t.opt_len+3+7>>>3,(l=t.static_len+3+7>>>3)<=i&&(i=l)):i=l=a+5,a+4<=i&&-1!==e?Q(t,e,a,n):4===t.strategy||l===i?(W(t,2+(n?1:0),3),D(t,I,T)):(W(t,4+(n?1:0),3),function(t,e,a,n){var r;for(W(t,e-257,5),W(t,a-1,5),W(t,n-4,4),r=0;r<n;r++)W(t,t.bl_tree[2*A[r]+1],3);J(t,t.dyn_ltree,e-1),J(t,t.dyn_dtree,a-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),D(t,t.dyn_ltree,t.dyn_dtree)),B(t),n&&G(t)},a._tr_tally=function(t,e,a){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&a,t.last_lit++,0===e?t.dyn_ltree[2*a]++:(t.matches++,e--,t.dyn_ltree[2*(k[a]+d+1)]++,t.dyn_dtree[2*O(e)]++),t.last_lit===t.lit_bufsize-1},a._tr_align=function(t){var e;W(t,2,3),H(t,v,I),16===(e=t).bi_valid?(P(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":41}],53:[function(t,e,a){e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,e,a){(function(t){!function(t,e){if(!t.setImmediate){var a,n,r,o,i=1,l={},s=!1,d=t.document,c=Object.getPrototypeOf&&Object.getPrototypeOf(t);c=c&&c.setTimeout?c:t,a="[object process]"==={}.toString.call(t.process)?function(t){process.nextTick(function(){p(t)})}:function(){if(t.postMessage&&!t.importScripts){var e=!0,a=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=a,e}}()?(o="setImmediate$"+Math.random()+"$",t.addEventListener?t.addEventListener("message",u,!1):t.attachEvent("onmessage",u),function(e){t.postMessage(o+e,"*")}):t.MessageChannel?((r=new MessageChannel).port1.onmessage=function(t){p(t.data)},function(t){r.port2.postMessage(t)}):d&&"onreadystatechange"in d.createElement("script")?(n=d.documentElement,function(t){var e=d.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,n.removeChild(e),e=null},n.appendChild(e)}):function(t){setTimeout(p,0,t)},c.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var r={callback:t,args:e};return l[i]=r,a(i),i++},c.clearImmediate=h}function h(t){delete l[t]}function p(t){if(s)setTimeout(p,0,t);else{var a=l[t];if(a){s=!0;try{!function(t){var a=t.callback,n=t.args;switch(n.length){case 0:a();break;case 1:a(n[0]);break;case 2:a(n[0],n[1]);break;case 3:a(n[0],n[1],n[2]);break;default:a.apply(e,n)}}(a)}finally{h(t),s=!1}}}}function u(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(o)&&p(+e.data.slice(o.length))}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,void 0!==Sn?Sn:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10);const Qp=An(Yp.exports);var _p={};function $p(t,e){return void 0===e&&(e=Object),e&&"function"==typeof e.getOwnPropertyDescriptors&&(t=e.create(null,e.getOwnPropertyDescriptors(t))),e&&"function"==typeof e.freeze?e.freeze(t):t}function tu(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var eu=$p({allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0});var au=$p({area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});var nu=$p({script:!1,style:!1,textarea:!0,title:!0});function ru(t){return t===ou.HTML}var ou=$p({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),iu=Object.keys(ou).map(function(t){return ou[t]});var lu=$p({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});_p.assign=function(t,e){if(null===t||"object"!=typeof t)throw new TypeError("target is not an object");for(var a in e)tu(e,a)&&(t[a]=e[a]);return t},_p.find=function(t,e,a){if(void 0===a&&(a=Array.prototype),t&&"function"==typeof a.find)return a.find.call(t,e);for(var n=0;n<t.length;n++)if(tu(t,n)){var r=t[n];if(e.call(void 0,r,n,t))return r}},_p.freeze=$p,_p.HTML_BOOLEAN_ATTRIBUTES=eu,_p.HTML_RAW_TEXT_ELEMENTS=nu,_p.HTML_VOID_ELEMENTS=au,_p.hasDefaultHTMLNamespace=function(t){return ru(t)||t===ou.XML_XHTML_APPLICATION},_p.hasOwn=tu,_p.isHTMLBooleanAttribute=function(t){return tu(eu,t.toLowerCase())},_p.isHTMLRawTextElement=function(t){var e=t.toLowerCase();return tu(nu,e)&&!nu[e]},_p.isHTMLEscapableRawTextElement=function(t){var e=t.toLowerCase();return tu(nu,e)&&nu[e]},_p.isHTMLMimeType=ru,_p.isHTMLVoidElement=function(t){return tu(au,t.toLowerCase())},_p.isValidMimeType=function(t){return iu.indexOf(t)>-1},_p.MIME_TYPE=ou,_p.NAMESPACE=lu;var su={};function du(t,e){t.prototype=Object.create(Error.prototype,{constructor:{value:t},name:{value:t.name,enumerable:!0,writable:e}})}var cu=_p.freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),hu=Object.keys(cu);function pu(t){return"number"==typeof t&&t>=1&&t<=25}function uu(t,e){var a;pu(t)?(this.name=hu[t],this.message=e||""):(this.message=t,this.name="string"==typeof(a=e)&&a.substring(a.length-cu.Error.length)===cu.Error?e:cu.Error),Error.captureStackTrace&&Error.captureStackTrace(this,uu)}du(uu,!0),Object.defineProperties(uu.prototype,{code:{enumerable:!0,get:function(){var t=hu.indexOf(this.name);return pu(t)?t:0}}});for(var fu={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},gu=Object.entries(fu),mu=0;mu<gu.length;mu++){uu[gu[mu][0]]=gu[mu][1]}function vu(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,vu)}du(vu),su.DOMException=uu,su.DOMExceptionName=cu,su.ExceptionCode=fu,su.ParseError=vu;var bu={},yu={};function Mu(t){try{"function"!=typeof t&&(t=RegExp);var e=new t("𝌆","u").exec("𝌆");return!!e&&2===e[0].length}catch(a){}return!1}var xu=Mu();function wu(t){if("["!==t.source[0])throw new Error(t+" can not be used with chars");return t.source.slice(1,t.source.lastIndexOf("]"))}function Su(t,e){if("["!==t.source[0])throw new Error("/"+t.source+"/ can not be used with chars_without");if(!e||"string"!=typeof e)throw new Error(JSON.stringify(e)+" is not a valid search");if(-1===t.source.indexOf(e))throw new Error('"'+e+'" is not is /'+t.source+"/");if("-"===e&&1!==t.source.indexOf(e))throw new Error('"'+e+'" is not at the first postion of /'+t.source+"/");return new RegExp(t.source.replace(e,""),xu?"u":"")}function Au(t){var e=this;return new RegExp(Array.prototype.slice.call(arguments).map(function(t){var a="string"==typeof t;if(a&&void 0===e&&"|"===t)throw new Error("use regg instead of reg to wrap expressions with `|`!");return a?t:t.source}).join(""),xu?"mu":"m")}function Iu(t){if(0===arguments.length)throw new Error("no parameters provided");return Au.apply(Iu,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var Tu=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;xu&&(Tu=Au("[",wu(Tu),"\\u{10000}-\\u{10FFFF}","]"));var Cu=new RegExp("[^"+wu(Tu)+"]",xu?"u":""),ku=/[\x20\x09\x0D\x0A]/,Vu=wu(ku),Eu=Au(ku,"+"),Ru=Au(ku,"*"),Lu=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;xu&&(Lu=Au("[",wu(Lu),"\\u{10000}-\\u{10FFFF}","]"));var zu=Au("[",wu(Lu),wu(/[-.0-9\xB7]/),wu(/[\u0300-\u036F\u203F-\u2040]/),"]"),Nu=Au(Lu,zu,"*"),qu=Au(zu,"+"),Ou=Au("&",Nu,";"),Pu=Iu(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),Wu=Iu(Ou,"|",Pu),Hu=Au("%",Nu,";"),Uu=Iu(Au('"',Iu(/[^%&"]/,"|",Hu,"|",Wu),"*",'"'),"|",Au("'",Iu(/[^%&']/,"|",Hu,"|",Wu),"*","'")),Fu=Iu('"',Iu(/[^<&"]/,"|",Wu),"*",'"',"|","'",Iu(/[^<&']/,"|",Wu),"*","'"),Bu=Au(Su(Lu,":"),Su(zu,":"),"*"),Gu=Au(Bu,Iu(":",Bu),"?"),Zu=Au("^",Gu,"$"),Ku=Au("(",Gu,")"),Du=Iu(/"[^"]*"|'[^']*'/),ju=Au(/^<\?/,"(",Nu,")",Iu(Eu,"(",Tu,"*?)"),"?",/\?>/),Xu=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,Ju=Iu('"',Xu,'*"',"|","'",Su(Xu,"'"),"*'"),Yu="\x3c!--",Qu=Au(Yu,Iu(Su(Tu,"-"),"|",Au("-",Su(Tu,"-"))),"*","--\x3e"),_u="#PCDATA",$u=Iu(Au(/\(/,Ru,_u,Iu(Ru,/\|/,Ru,Gu),"*",Ru,/\)\*/),"|",Au(/\(/,Ru,_u,Ru,/\)/)),tf=Iu("EMPTY","|","ANY","|",$u,"|",Au(/\([^>]+\)/,/[?*+]?/)),ef=Au("<!ELEMENT",Eu,Iu(Gu,"|",Hu),Eu,Iu(tf,"|",Hu),Ru,">"),af=Au("NOTATION",Eu,/\(/,Ru,Nu,Iu(Ru,/\|/,Ru,Nu),"*",Ru,/\)/),nf=Au(/\(/,Ru,qu,Iu(Ru,/\|/,Ru,qu),"*",Ru,/\)/),rf=Iu(af,"|",nf),of=Iu(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",rf),lf=Iu(/#REQUIRED|#IMPLIED/,"|",Iu(Iu("#FIXED",Eu),"?",Fu)),sf=Au("<!ATTLIST",Eu,Nu,Iu(Eu,Nu,Eu,of,Eu,lf),"*",Ru,">"),df="about:legacy-compat",cf=Iu('"'+df+'"',"|","'"+df+"'"),hf="SYSTEM",pf="PUBLIC",uf=Iu(Iu(hf,Eu,Du),"|",Iu(pf,Eu,Ju,Eu,Du)),ff=Au("^",Iu(Iu(hf,Eu,"(?<SystemLiteralOnly>",Du,")"),"|",Iu(pf,Eu,"(?<PubidLiteral>",Ju,")",Eu,"(?<SystemLiteral>",Du,")"))),gf=Au("^",Ju,"$"),mf=Au("^",Du,"$"),vf=Iu(Eu,"NDATA",Eu,Nu),bf="<!ENTITY",yf=Au(bf,Eu,Nu,Eu,Iu(Uu,"|",Iu(uf,vf,"?")),Ru,">"),Mf=Iu(Uu,"|",uf),xf=Iu(yf,"|",Au(bf,Eu,"%",Eu,Nu,Eu,Mf,Ru,">")),wf=Au(pf,Eu,Ju),Sf=Au("<!NOTATION",Eu,Nu,Eu,Iu(uf,"|",wf),Ru,">"),Af=Au(Ru,"=",Ru),If=/1[.]\d+/,Tf=Au(Eu,"version",Af,Iu("'",If,"'","|",'"',If,'"')),Cf=/[A-Za-z][-A-Za-z0-9._]*/,kf=Au(/^<\?xml/,Tf,Iu(Eu,"encoding",Af,Iu('"',Cf,'"',"|","'",Cf,"'")),"?",Iu(Eu,"standalone",Af,Iu("'",Iu("yes","|","no"),"'","|",'"',Iu("yes","|","no"),'"')),"?",Ru,/\?>/),Vf=Au(Tu,"*?",/\]\]>/),Ef=Au(/<!\[CDATA\[/,Vf);yu.chars=wu,yu.chars_without=Su,yu.detectUnicodeSupport=Mu,yu.reg=Au,yu.regg=Iu,yu.ABOUT_LEGACY_COMPAT=df,yu.ABOUT_LEGACY_COMPAT_SystemLiteral=cf,yu.AttlistDecl=sf,yu.CDATA_START="<![CDATA[",yu.CDATA_END="]]>",yu.CDSect=Ef,yu.Char=Tu,yu.Comment=Qu,yu.COMMENT_START=Yu,yu.COMMENT_END="--\x3e",yu.DOCTYPE_DECL_START="<!DOCTYPE",yu.elementdecl=ef,yu.EntityDecl=xf,yu.EntityValue=Uu,yu.ExternalID=uf,yu.ExternalID_match=ff,yu.Name=Nu,yu.NotationDecl=Sf,yu.Reference=Wu,yu.PEReference=Hu,yu.PI=ju,yu.PUBLIC=pf,yu.PubidLiteral=Ju,yu.PubidLiteral_match=gf,yu.QName=Gu,yu.QName_exact=Zu,yu.QName_group=Ku,yu.S=Eu,yu.SChar_s=Vu,yu.S_OPT=Ru,yu.SYSTEM=hf,yu.SystemLiteral=Du,yu.SystemLiteral_match=mf,yu.InvalidChar=Cu,yu.UNICODE_REPLACEMENT_CHARACTER="�",yu.UNICODE_SUPPORT=xu,yu.XMLDecl=kf;var Rf=_p,Lf=Rf.find,zf=Rf.hasDefaultHTMLNamespace,Nf=Rf.hasOwn,qf=Rf.isHTMLMimeType,Of=Rf.isHTMLRawTextElement,Pf=Rf.isHTMLVoidElement,Wf=Rf.MIME_TYPE,Hf=Rf.NAMESPACE,Uf=Symbol(),Ff=su,Bf=Ff.DOMException,Gf=Ff.DOMExceptionName,Zf=yu;function Kf(t){if(t!==Uf)throw new TypeError("Illegal constructor")}function Df(t){return""!==t}function jf(t,e){return Nf(t,e)||(t[e]=!0),t}function Xf(t){if(!t)return[];var e=function(t){return t?t.split(/[\t\n\f\r ]+/).filter(Df):[]}(t);return Object.keys(e.reduce(jf,{}))}function Jf(t){if(!Zf.QName_exact.test(t))throw new Bf(Bf.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+t+'"')}function Yf(t,e){Jf(e),t=t||null;var a=null,n=e;if(e.indexOf(":")>=0){var r=e.split(":");a=r[0],n=r[1]}if(null!==a&&null===t)throw new Bf(Bf.NAMESPACE_ERR,"prefix is non-null and namespace is null");if("xml"===a&&t!==Rf.NAMESPACE.XML)throw new Bf(Bf.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if(("xmlns"===a||"xmlns"===e)&&t!==Rf.NAMESPACE.XMLNS)throw new Bf(Bf.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(t===Rf.NAMESPACE.XMLNS&&"xmlns"!==a&&"xmlns"!==e)throw new Bf(Bf.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[t,a,n]}function Qf(t,e){for(var a in t)Nf(t,a)&&(e[a]=t[a])}function _f(t,e){var a=t.prototype;if(!(a instanceof e)){let n=function(){};n.prototype=e.prototype,n=new n,Qf(a,n),t.prototype=a=n}a.constructor!=t&&("function"!=typeof t&&console.error("unknown Class:"+t),a.constructor=t)}var $f={},tg=$f.ELEMENT_NODE=1,eg=$f.ATTRIBUTE_NODE=2,ag=$f.TEXT_NODE=3,ng=$f.CDATA_SECTION_NODE=4,rg=$f.ENTITY_REFERENCE_NODE=5,og=$f.ENTITY_NODE=6,ig=$f.PROCESSING_INSTRUCTION_NODE=7,lg=$f.COMMENT_NODE=8,sg=$f.DOCUMENT_NODE=9,dg=$f.DOCUMENT_TYPE_NODE=10,cg=$f.DOCUMENT_FRAGMENT_NODE=11,hg=$f.NOTATION_NODE=12,pg=Rf.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function ug(t,e){if(e.length<t.length)return ug(e,t);var a=null;for(var n in t){if(t[n]!==e[n])return a;a=t[n]}return a}function fg(t){return t.guid||(t.guid=Math.random()),t.guid}function gg(){}function mg(t,e){this._node=t,this._refresh=e,vg(this)}function vg(t){var e=t._node._inc||t._node.ownerDocument._inc;if(t._inc!==e){var a=t._refresh(t._node);if(rm(t,"length",a.length),!t.$$length||a.length<t.$$length)for(var n=a.length;n in t;n++)Nf(t,n)&&delete t[n];Qf(a,t),t._inc=e}}function bg(){}function yg(t,e){for(var a=0;a<t.length;){if(t[a]===e)return a;a++}}function Mg(t,e,a,n){if(n?e[yg(e,n)]=a:(e[e.length]=a,e.length++),t){a.ownerElement=t;var r=t.ownerDocument;r&&(n&&kg(r,t,n),function(t,e,a){t&&t._inc++;var n=a.namespaceURI;n===Hf.XMLNS&&(e._nsMap[a.prefix?a.localName:""]=a.value)}(r,t,a))}}function xg(t,e,a){var n=yg(e,a);if(n>=0){for(var r=e.length-1;n<=r;)e[n]=e[++n];if(e.length=r,t){var o=t.ownerDocument;o&&kg(o,t,a),a.ownerElement=null}}}function wg(){}function Sg(t){Kf(t)}function Ag(t){return("<"==t?"<":">"==t&&">")||"&"==t&&"&"||'"'==t&&"""||"&#"+t.charCodeAt()+";"}function Ig(t,e){Tg(t,null,{enter:function(t){return!e(t)||Tg.STOP}})}function Tg(t,e,a){for(var n=[{node:t,context:e,phase:Tg.ENTER}];n.length>0;){var r=n.pop();if(r.phase===Tg.ENTER){var o=a.enter(r.node,r.context);if(o===Tg.STOP)return Tg.STOP;if(n.push({node:r.node,context:o,phase:Tg.EXIT}),null==o)continue;for(var i=r.node.lastChild;i;)n.push({node:i,context:o,phase:Tg.ENTER}),i=i.previousSibling}else a.exit&&a.exit(r.node,r.context)}}function Cg(t,e){Kf(t);var a=e||{};this.ownerDocument=this,this.contentType=a.contentType||Wf.XML_APPLICATION,this.type=qf(this.contentType)?"html":"xml"}function kg(t,e,a,n){t&&t._inc++,a.namespaceURI===Hf.XMLNS&&delete e._nsMap[a.prefix?a.localName:""]}function Vg(t,e,a){if(t&&t._inc){t._inc++;var n=e.childNodes;if(a&&!a.nextSibling)n[n.length++]=a;else{for(var r=e.firstChild,o=0;r;)n[o++]=r,r=r.nextSibling;n.length=o,delete n[n.length]}}}function Eg(t,e){if(t!==e.parentNode)throw new Bf(Bf.NOT_FOUND_ERR,"child's parent is not parent");var a=e.previousSibling,n=e.nextSibling;return a?a.nextSibling=n:t.firstChild=n,n?n.previousSibling=a:t.lastChild=a,Vg(t.ownerDocument,t),e.parentNode=null,e.previousSibling=null,e.nextSibling=null,e}function Rg(t){return t&&t.nodeType===Sg.DOCUMENT_TYPE_NODE}function Lg(t){return t&&t.nodeType===Sg.ELEMENT_NODE}function zg(t){return t&&t.nodeType===Sg.TEXT_NODE}function Ng(t,e){var a=t.childNodes||[];if(Lf(a,Lg)||Rg(e))return!1;var n=Lf(a,Rg);return!(e&&n&&a.indexOf(n)>a.indexOf(e))}function qg(t,e){var a=t.childNodes||[];if(Lf(a,function(t){return Lg(t)&&t!==e}))return!1;var n=Lf(a,Rg);return!(e&&n&&a.indexOf(n)>a.indexOf(e))}function Og(t,e,a){if(!function(t){return t&&(t.nodeType===Sg.DOCUMENT_NODE||t.nodeType===Sg.DOCUMENT_FRAGMENT_NODE||t.nodeType===Sg.ELEMENT_NODE)}(t))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+t.nodeType);if(a&&a.parentNode!==t)throw new Bf(Bf.NOT_FOUND_ERR,"child not in parent");if(!function(t){return t&&(t.nodeType===Sg.CDATA_SECTION_NODE||t.nodeType===Sg.COMMENT_NODE||t.nodeType===Sg.DOCUMENT_FRAGMENT_NODE||t.nodeType===Sg.DOCUMENT_TYPE_NODE||t.nodeType===Sg.ELEMENT_NODE||t.nodeType===Sg.PROCESSING_INSTRUCTION_NODE||t.nodeType===Sg.TEXT_NODE)}(e)||Rg(e)&&t.nodeType!==Sg.DOCUMENT_NODE)throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function Pg(t,e,a){var n=t.childNodes||[],r=e.childNodes||[];if(e.nodeType===Sg.DOCUMENT_FRAGMENT_NODE){var o=r.filter(Lg);if(o.length>1||Lf(r,zg))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(1===o.length&&!Ng(t,a))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(Lg(e)&&!Ng(t,a))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Rg(e)){if(Lf(n,Rg))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var i=Lf(n,Lg);if(a&&n.indexOf(i)<n.indexOf(a))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!a&&i)throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}function Wg(t,e,a){var n=t.childNodes||[],r=e.childNodes||[];if(e.nodeType===Sg.DOCUMENT_FRAGMENT_NODE){var o=r.filter(Lg);if(o.length>1||Lf(r,zg))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(1===o.length&&!qg(t,a))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(Lg(e)&&!qg(t,a))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Rg(e)){if(Lf(n,function(t){return Rg(t)&&t!==a}))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var i=Lf(n,Lg);if(a&&n.indexOf(i)<n.indexOf(a))throw new Bf(Bf.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}function Hg(t,e,a,n){Og(t,e,a),t.nodeType===Sg.DOCUMENT_NODE&&(n||Pg)(t,e,a);var r=e.parentNode;if(r&&r.removeChild(e),e.nodeType===cg){var o=e.firstChild;if(null==o)return e;var i=e.lastChild}else o=i=e;var l=a?a.previousSibling:t.lastChild;o.previousSibling=l,i.nextSibling=a,l?l.nextSibling=o:t.firstChild=o,null==a?t.lastChild=i:a.previousSibling=i;do{o.parentNode=t}while(o!==i&&(o=o.nextSibling));return Vg(t.ownerDocument||t,t,e),e.nodeType==cg&&(e.firstChild=e.lastChild=null),e}function Ug(t){Kf(t),this._nsMap=Object.create(null)}function Fg(t){Kf(t),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}function Bg(t){Kf(t)}function Gg(t){Kf(t)}function Zg(t){Kf(t)}function Kg(t){Kf(t)}function Dg(t){Kf(t)}function jg(t){Kf(t)}function Xg(t){Kf(t)}function Jg(t){Kf(t)}function Yg(t){Kf(t)}function Qg(t){Kf(t)}function _g(){}function $g(t){var e;e="function"==typeof t?{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:t}:null!=t?{requireWellFormed:!!t.requireWellFormed,splitCDATASections:!1!==t.splitCDATASections,nodeFilter:t.nodeFilter||null}:{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};var a=[],n=this.nodeType===sg&&this.documentElement||this,r=n.prefix,o=n.namespaceURI;if(o&&null==r&&null==(r=n.lookupPrefix(o)))var i=[{namespace:o,prefix:null}];return am(this,a,i,e),a.join("")}function tm(t,e,a){var n=t.prefix||"",r=t.namespaceURI;if(!r)return!1;if("xml"===n&&r===Hf.XML||r===Hf.XMLNS)return!1;for(var o=a.length;o--;){var i=a[o];if(i.prefix===n)return i.namespace!==r}return!0}function em(t,e,a){t.push(" ",e,'="',a.replace(/[<>&"\t\n\r]/g,Ag),'"')}function am(t,e,a,n){a||(a=[]);var r=n.nodeFilter,o=n.requireWellFormed,i=n.splitCDATASections,l="html"===(t.nodeType===sg?t:t.ownerDocument).type;Tg(t,{ns:a},{enter:function(t,a){var s=a.ns;if(r){if(!(t=r(t)))return null;if("string"==typeof t)return e.push(t),null}switch(t.nodeType){case tg:var d=t.attributes,c=d.length,h=t.tagName,p=h;if(!l&&!t.prefix&&t.namespaceURI){for(var u,f=0;f<d.length;f++)if("xmlns"===d.item(f).name){u=d.item(f).value;break}if(!u)for(var g=s.length-1;g>=0;g--){if(""===(m=s[g]).prefix&&m.namespace===t.namespaceURI){u=m.namespace;break}}if(u!==t.namespaceURI)for(g=s.length-1;g>=0;g--){var m;if((m=s[g]).namespace===t.namespaceURI){m.prefix&&(p=m.prefix+":"+h);break}}}e.push("<",p);for(var v=s.slice(),b=0;b<c;b++){"xmlns"==(y=d.item(b)).prefix?v.push({prefix:y.localName,namespace:y.value}):"xmlns"==y.nodeName&&v.push({prefix:"",namespace:y.value})}for(b=0;b<c;b++){var y;if(tm(y=d.item(b),0,v)){var M=y.prefix||"",x=y.namespaceURI;em(e,M?"xmlns:"+M:"xmlns",x),v.push({prefix:M,namespace:x})}var w=r?r(y):y;w&&("string"==typeof w?e.push(w):em(e,w.name,w.value))}if(h===p&&tm(t,0,v)){var S=t.prefix||"";x=t.namespaceURI;em(e,S?"xmlns:"+S:"xmlns",x),v.push({prefix:S,namespace:x})}var A=!t.firstChild;if(A&&(l||t.namespaceURI===Hf.HTML)&&(A=Pf(h)),A)return e.push("/>"),null;if(e.push(">"),l&&Of(h)){for(var I=t.firstChild;I;)I.data?e.push(I.data):am(I,e,v.slice(),n),I=I.nextSibling;return e.push("</",p,">"),null}return{ns:v,tag:p};case sg:case cg:if(o&&t.nodeType===sg&&null==t.documentElement)throw new Bf("The Document has no documentElement",Gf.InvalidStateError);return{ns:s};case eg:return em(e,t.name,t.value),null;case ag:if(o&&Zf.InvalidChar.test(t.data))throw new Bf("The Text node data contains characters outside the XML Char production",Gf.InvalidStateError);return e.push(t.data.replace(/[<&>]/g,Ag)),null;case ng:if(o&&-1!==t.data.indexOf("]]>"))throw new Bf('The CDATASection data contains "]]>"',Gf.InvalidStateError);return i?e.push(Zf.CDATA_START,t.data.replace(/]]>/g,"]]]]><![CDATA[>"),Zf.CDATA_END):e.push(Zf.CDATA_START,t.data,Zf.CDATA_END),null;case lg:if(o){if(Zf.InvalidChar.test(t.data))throw new Bf("The comment node data contains characters outside the XML Char production",Gf.InvalidStateError);if(-1!==t.data.indexOf("--")||"-"===t.data[t.data.length-1])throw new Bf('The comment node data contains "--" or ends with "-"',Gf.InvalidStateError)}return e.push(Zf.COMMENT_START,t.data,Zf.COMMENT_END),null;case dg:var T=t.publicId,C=t.systemId;if(o){if(T&&!Zf.PubidLiteral_match.test(T))throw new Bf("DocumentType publicId is not a valid PubidLiteral",Gf.InvalidStateError);if(C&&"."!==C&&!Zf.SystemLiteral_match.test(C))throw new Bf("DocumentType systemId is not a valid SystemLiteral",Gf.InvalidStateError);if(t.internalSubset&&-1!==t.internalSubset.indexOf("]>"))throw new Bf('DocumentType internalSubset contains "]>"',Gf.InvalidStateError)}return e.push(Zf.DOCTYPE_DECL_START," ",t.name),T?(e.push(" ",Zf.PUBLIC," ",T),C&&"."!==C&&e.push(" ",C)):C&&"."!==C&&e.push(" ",Zf.SYSTEM," ",C),t.internalSubset&&e.push(" [",t.internalSubset,"]"),e.push(">"),null;case ig:if(o){if(-1!==t.target.indexOf(":")||"xml"===t.target.toLowerCase())throw new Bf("The ProcessingInstruction target is not well-formed",Gf.InvalidStateError);if(Zf.InvalidChar.test(t.data))throw new Bf("The ProcessingInstruction data contains characters outside the XML Char production",Gf.InvalidStateError);if(-1!==t.data.indexOf("?>"))throw new Bf('The ProcessingInstruction data contains "?>"',Gf.InvalidStateError)}return e.push("<?",t.target," ",t.data,"?>"),null;case rg:return e.push("&",t.nodeName,";"),null;default:return e.push("??",t.nodeName),null}},exit:function(t,a){a&&a.tag&&e.push("</",a.tag,">")}})}function nm(t,e,a){var n;return Tg(e,null,{enter:function(e,r){var o=new e.constructor(Uf);for(var i in e)if(Nf(e,i)){var l=e[i];"object"!=typeof l&&l!=o[i]&&(o[i]=l)}e.childNodes&&(o.childNodes=new gg),o.ownerDocument=t;var s=a;switch(o.nodeType){case tg:var d=e.attributes,c=o.attributes=new bg,h=d.length;c._ownerElement=o;for(var p=0;p<h;p++)o.setAttributeNode(nm(t,d.item(p),!0));break;case eg:s=!0}return null!==r?r.appendChild(o):n=o,s?o:null}}),n}function rm(t,e,a){t[e]=a}function om(t){for(var e=[],a=t.firstChild;a;)a.nodeType===tg&&e.push(a),a=a.nextSibling;return e}gg.prototype={length:0,item:function(t){return t>=0&&t<this.length?this[t]:null},toString:function(t){var e;e="function"==typeof t?{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:t}:t?{requireWellFormed:!!t.requireWellFormed,splitCDATASections:!1!==t.splitCDATASections,nodeFilter:t.nodeFilter||null}:{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};for(var a=[],n=0;n<this.length;n++)am(this[n],a,null,e);return a.join("")},filter:function(t){return Array.prototype.filter.call(this,t)},indexOf:function(t){return Array.prototype.indexOf.call(this,t)}},gg.prototype[Symbol.iterator]=function(){var t=this,e=0;return{next:function(){return e<t.length?{value:t[e++],done:!1}:{done:!0}},return:function(){return{done:!0}}}},mg.prototype.item=function(t){return vg(this),this[t]||null},_f(mg,gg),bg.prototype={length:0,item:gg.prototype.item,getNamedItem:function(t){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(t=t.toLowerCase());for(var e=0;e<this.length;){var a=this[e];if(a.nodeName===t)return a;e++}return null},setNamedItem:function(t){var e=t.ownerElement;if(e&&e!==this._ownerElement)throw new Bf(Bf.INUSE_ATTRIBUTE_ERR);var a=this.getNamedItemNS(t.namespaceURI,t.localName);return a===t?t:(Mg(this._ownerElement,this,t,a),a)},setNamedItemNS:function(t){return this.setNamedItem(t)},removeNamedItem:function(t){var e=this.getNamedItem(t);if(!e)throw new Bf(Bf.NOT_FOUND_ERR,t);return xg(this._ownerElement,this,e),e},removeNamedItemNS:function(t,e){var a=this.getNamedItemNS(t,e);if(!a)throw new Bf(Bf.NOT_FOUND_ERR,t?t+" : "+e:e);return xg(this._ownerElement,this,a),a},getNamedItemNS:function(t,e){t||(t=null);for(var a=0;a<this.length;){var n=this[a];if(n.localName===e&&n.namespaceURI===t)return n;a++}return null}},bg.prototype[Symbol.iterator]=function(){var t=this,e=0;return{next:function(){return e<t.length?{value:t[e++],done:!1}:{done:!0}},return:function(){return{done:!0}}}},wg.prototype={hasFeature:function(t,e){return!0},createDocument:function(t,e,a){var n=Wf.XML_APPLICATION;t===Hf.HTML?n=Wf.XML_XHTML_APPLICATION:t===Hf.SVG&&(n=Wf.XML_SVG_IMAGE);var r=new Cg(Uf,{contentType:n});if(r.implementation=this,r.childNodes=new gg,r.doctype=a||null,a&&r.appendChild(a),e){var o=r.createElementNS(t,e);r.appendChild(o)}return r},createDocumentType:function(t,e,a,n){Jf(t);var r=new Dg(Uf);return r.name=t,r.nodeName=t,r.publicId=e||"",r.systemId=a||"",r.internalSubset=n||"",r.childNodes=new gg,r},createHTMLDocument:function(t){var e=new Cg(Uf,{contentType:Wf.HTML});if(e.implementation=this,e.childNodes=new gg,!1!==t){e.doctype=this.createDocumentType("html"),e.doctype.ownerDocument=e,e.appendChild(e.doctype);var a=e.createElement("html");e.appendChild(a);var n=e.createElement("head");if(a.appendChild(n),"string"==typeof t){var r=e.createElement("title");r.appendChild(e.createTextNode(t)),n.appendChild(r)}a.appendChild(e.createElement("body"))}return e}},Sg.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:"about:blank",get isConnected(){var t=this.getRootNode();return t&&t.nodeType===t.DOCUMENT_NODE},contains:function(t){if(!t)return!1;var e=t;do{if(this===e)return!0;e=e.parentNode}while(e);return!1},getRootNode:function(t){var e=this;do{if(!e.parentNode)return e;e=e.parentNode}while(e)},isEqualNode:function(t){if(!t)return!1;for(var e=[{node:this,other:t}];e.length>0;){var a=e.pop(),n=a.node,r=a.other;if(n.nodeType!==r.nodeType)return!1;switch(n.nodeType){case n.DOCUMENT_TYPE_NODE:if(n.name!==r.name)return!1;if(n.publicId!==r.publicId)return!1;if(n.systemId!==r.systemId)return!1;break;case n.ELEMENT_NODE:if(n.namespaceURI!==r.namespaceURI)return!1;if(n.prefix!==r.prefix)return!1;if(n.localName!==r.localName)return!1;if(n.attributes.length!==r.attributes.length)return!1;for(var o=0;o<n.attributes.length;o++){var i=n.attributes.item(o),l=r.getAttributeNodeNS(i.namespaceURI,i.localName);if(!l)return!1;e.push({node:i,other:l})}break;case n.ATTRIBUTE_NODE:if(n.namespaceURI!==r.namespaceURI)return!1;if(n.localName!==r.localName)return!1;if(n.value!==r.value)return!1;break;case n.PROCESSING_INSTRUCTION_NODE:if(n.target!==r.target||n.data!==r.data)return!1;break;case n.TEXT_NODE:case n.CDATA_SECTION_NODE:case n.COMMENT_NODE:if(n.data!==r.data)return!1}if(n.childNodes.length!==r.childNodes.length)return!1;for(o=n.childNodes.length-1;o>=0;o--)e.push({node:n.childNodes[o],other:r.childNodes[o]})}return!0},isSameNode:function(t){return this===t},insertBefore:function(t,e){return Hg(this,t,e)},replaceChild:function(t,e){Hg(this,t,e,Wg),e&&this.removeChild(e)},removeChild:function(t){return Eg(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(t){return nm(this.ownerDocument||this,this,t)},normalize:function(){Tg(this,null,{enter:function(t){for(var e=t.firstChild;e;){var a=e.nextSibling;null!==a&&a.nodeType===ag&&e.nodeType===ag?(t.removeChild(a),e.appendData(a.data)):e=a}return!0}})},isSupported:function(t,e){return this.ownerDocument.implementation.hasFeature(t,e)},lookupPrefix:function(t){for(var e=this;e;){var a=e._nsMap;if(a)for(var n in a)if(Nf(a,n)&&a[n]===t)return n;e=e.nodeType==eg?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var a=e._nsMap;if(a&&Nf(a,t))return a[t];e=e.nodeType==eg?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){return null==this.lookupPrefix(t)},compareDocumentPosition:function(t){if(this===t)return 0;var e=t,a=this,n=null,r=null;if(e instanceof Fg&&(e=(n=e).ownerElement),a instanceof Fg&&(a=(r=a).ownerElement,n&&e&&a===e))for(var o,i=0;o=a.attributes[i];i++){if(o===n)return pg.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+pg.DOCUMENT_POSITION_PRECEDING;if(o===r)return pg.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+pg.DOCUMENT_POSITION_FOLLOWING}if(!e||!a||a.ownerDocument!==e.ownerDocument)return pg.DOCUMENT_POSITION_DISCONNECTED+pg.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(fg(a.ownerDocument)>fg(e.ownerDocument)?pg.DOCUMENT_POSITION_FOLLOWING:pg.DOCUMENT_POSITION_PRECEDING);if(r&&e===a)return pg.DOCUMENT_POSITION_CONTAINS+pg.DOCUMENT_POSITION_PRECEDING;if(n&&e===a)return pg.DOCUMENT_POSITION_CONTAINED_BY+pg.DOCUMENT_POSITION_FOLLOWING;for(var l=[],s=e.parentNode;s;){if(!r&&s===a)return pg.DOCUMENT_POSITION_CONTAINED_BY+pg.DOCUMENT_POSITION_FOLLOWING;l.push(s),s=s.parentNode}l.reverse();for(var d=[],c=a.parentNode;c;){if(!n&&c===e)return pg.DOCUMENT_POSITION_CONTAINS+pg.DOCUMENT_POSITION_PRECEDING;d.push(c),c=c.parentNode}d.reverse();var h=ug(l,d);for(var p in h.childNodes){var u=h.childNodes[p];if(u===a)return pg.DOCUMENT_POSITION_FOLLOWING;if(u===e)return pg.DOCUMENT_POSITION_PRECEDING;if(d.indexOf(u)>=0)return pg.DOCUMENT_POSITION_FOLLOWING;if(l.indexOf(u)>=0)return pg.DOCUMENT_POSITION_PRECEDING}return 0}},Qf($f,Sg),Qf($f,Sg.prototype),Qf(pg,Sg),Qf(pg,Sg.prototype),Tg.STOP=Symbol("walkDOM.STOP"),Tg.ENTER=0,Tg.EXIT=1,Cg.prototype={implementation:null,nodeName:"#document",nodeType:sg,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType===cg){for(var a=t.firstChild;a;){var n=a.nextSibling;this.insertBefore(a,e),a=n}return t}return Hg(this,t,e),t.ownerDocument=this,null===this.documentElement&&t.nodeType===tg&&(this.documentElement=t),t},removeChild:function(t){var e=Eg(this,t);return e===this.documentElement&&(this.documentElement=null),e},replaceChild:function(t,e){Hg(this,t,e,Wg),t.ownerDocument=this,e&&this.removeChild(e),Lg(t)&&(this.documentElement=t)},importNode:function(t,e){return function(t,e,a){var n;return Tg(e,null,{enter:function(e,r){var o=e.cloneNode(!1);return o.ownerDocument=t,o.parentNode=null,null===r?n=o:r.appendChild(o),e.nodeType===eg||a?o:null}}),n}(this,t,e)},getElementById:function(t){var e=null;return Ig(this.documentElement,function(a){if(a.nodeType==tg&&a.getAttribute("id")==t)return e=a,!0}),e},createElement:function(t){var e=new Ug(Uf);return e.ownerDocument=this,"html"===this.type&&(t=t.toLowerCase()),zf(this.contentType)&&(e.namespaceURI=Hf.HTML),e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new gg,(e.attributes=new bg)._ownerElement=e,e},createDocumentFragment:function(){var t=new Yg(Uf);return t.ownerDocument=this,t.childNodes=new gg,t},createTextNode:function(t){var e=new Gg(Uf);return e.ownerDocument=this,e.childNodes=new gg,e.appendData(t),e},createComment:function(t){var e=new Zg(Uf);return e.ownerDocument=this,e.childNodes=new gg,e.appendData(t),e},createCDATASection:function(t){if(-1!==t.indexOf("]]>"))throw new Bf(Bf.INVALID_CHARACTER_ERR,'data contains "]]>"');var e=new Kg(Uf);return e.ownerDocument=this,e.childNodes=new gg,e.appendData(t),e},createProcessingInstruction:function(t,e){var a=new Qg(Uf);return a.ownerDocument=this,a.childNodes=new gg,a.nodeName=a.target=t,a.nodeValue=a.data=e,a},createAttribute:function(t){if(!Zf.QName_exact.test(t))throw new Bf(Bf.INVALID_CHARACTER_ERR,'invalid character in name "'+t+'"');return"html"===this.type&&(t=t.toLowerCase()),this._createAttribute(t)},_createAttribute:function(t){var e=new Fg(Uf);return e.ownerDocument=this,e.childNodes=new gg,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){if(!Zf.Name.test(t))throw new Bf(Bf.INVALID_CHARACTER_ERR,'not a valid xml name "'+t+'"');if("html"===this.type)throw new Bf("document is an html document",Gf.NotSupportedError);var e=new Jg(Uf);return e.ownerDocument=this,e.childNodes=new gg,e.nodeName=t,e},createElementNS:function(t,e){var a=Yf(t,e),n=new Ug(Uf),r=n.attributes=new bg;return n.childNodes=new gg,n.ownerDocument=this,n.nodeName=e,n.tagName=e,n.namespaceURI=a[0],n.prefix=a[1],n.localName=a[2],r._ownerElement=n,n},createAttributeNS:function(t,e){var a=Yf(t,e),n=new Fg(Uf);return n.ownerDocument=this,n.childNodes=new gg,n.nodeName=e,n.name=e,n.specified=!0,n.namespaceURI=a[0],n.prefix=a[1],n.localName=a[2],n}},_f(Cg,Sg),Ug.prototype={nodeType:tg,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return"html"===this.ownerDocument.type&&this.namespaceURI===Hf.HTML},hasAttributes:function(){return!(!this.attributes||!this.attributes.length)},hasAttribute:function(t){return!!this.getAttributeNode(t)},getAttribute:function(t){var e=this.getAttributeNode(t);return e?e.value:null},getAttributeNode:function(t){return this._isInHTMLDocumentAndNamespace()&&(t=t.toLowerCase()),this.attributes.getNamedItem(t)},setAttribute:function(t,e){this._isInHTMLDocumentAndNamespace()&&(t=t.toLowerCase());var a=this.getAttributeNode(t);a?a.value=a.nodeValue=""+e:((a=this.ownerDocument._createAttribute(t)).value=a.nodeValue=""+e,this.setAttributeNode(a))},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var a=this.getAttributeNodeNS(t,e);a&&this.removeAttributeNode(a)},hasAttributeNS:function(t,e){return null!=this.getAttributeNodeNS(t,e)},getAttributeNS:function(t,e){var a=this.getAttributeNodeNS(t,e);return a?a.value:null},setAttributeNS:function(t,e,a){var n=Yf(t,e)[2],r=this.getAttributeNodeNS(t,n);r?r.value=r.nodeValue=""+a:((r=this.ownerDocument.createAttributeNS(t,e)).value=r.nodeValue=""+a,this.setAttributeNode(r))},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByClassName:function(t){var e=Xf(t);return new mg(this,function(a){var n=[];return e.length>0&&Ig(a,function(r){if(r!==a&&r.nodeType===tg){var o=r.getAttribute("class");if(o){var i=t===o;if(!i){var l=Xf(o);i=e.every((s=l,function(t){return s&&-1!==s.indexOf(t)}))}i&&n.push(r)}}var s}),n})},getElementsByTagName:function(t){var e="html"===(this.nodeType===sg?this:this.ownerDocument).type,a=t.toLowerCase();return new mg(this,function(n){var r=[];return Ig(n,function(o){o!==n&&o.nodeType===tg&&(("*"===t||o.getQualifiedName()===(e&&o.namespaceURI===Hf.HTML?a:t))&&r.push(o))}),r})},getElementsByTagNameNS:function(t,e){return new mg(this,function(a){var n=[];return Ig(a,function(r){r===a||r.nodeType!==tg||"*"!==t&&r.namespaceURI!==t||"*"!==e&&r.localName!=e||n.push(r)}),n})}},Cg.prototype.getElementsByClassName=Ug.prototype.getElementsByClassName,Cg.prototype.getElementsByTagName=Ug.prototype.getElementsByTagName,Cg.prototype.getElementsByTagNameNS=Ug.prototype.getElementsByTagNameNS,_f(Ug,Sg),Fg.prototype.nodeType=eg,_f(Fg,Sg),Bg.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,a){a=this.data.substring(0,t)+a+this.data.substring(t+e),this.nodeValue=this.data=a,this.length=a.length}},_f(Bg,Sg),Gg.prototype={nodeName:"#text",nodeType:ag,splitText:function(t){var e=this.data,a=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var n=this.ownerDocument.createTextNode(a);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}},_f(Gg,Bg),Zg.prototype={nodeName:"#comment",nodeType:lg},_f(Zg,Bg),Kg.prototype={nodeName:"#cdata-section",nodeType:ng},_f(Kg,Gg),Dg.prototype.nodeType=dg,_f(Dg,Sg),jg.prototype.nodeType=hg,_f(jg,Sg),Xg.prototype.nodeType=og,_f(Xg,Sg),Jg.prototype.nodeType=rg,_f(Jg,Sg),Yg.prototype.nodeName="#document-fragment",Yg.prototype.nodeType=cg,_f(Yg,Sg),Qg.prototype.nodeType=ig,_f(Qg,Bg),_g.prototype.serializeToString=function(t,e){return $g.call(t,e)},Sg.prototype.toString=$g;try{Object.defineProperty&&(Object.defineProperty(mg.prototype,"length",{get:function(){return vg(this),this.$$length}}),Object.defineProperty(Sg.prototype,"textContent",{get:function(){if(this.nodeType===tg||this.nodeType===cg){var t=[];return Tg(this,null,{enter:function(e){return e.nodeType===tg||e.nodeType===cg||(e.nodeType===ig||e.nodeType===lg?null:void t.push(e.nodeValue))}}),t.join("")}return this.nodeValue},set:function(t){switch(this.nodeType){case tg:case cg:for(;this.firstChild;)this.removeChild(this.firstChild);(t||String(t))&&this.appendChild(this.ownerDocument.createTextNode(t));break;default:this.data=t,this.value=t,this.nodeValue=t}}}),Object.defineProperty(Ug.prototype,"children",{get:function(){return new mg(this,om)}}),Object.defineProperty(Cg.prototype,"children",{get:function(){return new mg(this,om)}}),Object.defineProperty(Yg.prototype,"children",{get:function(){return new mg(this,om)}}),rm=function(t,e,a){t["$$"+e]=a})}catch(rN){}bu._updateLiveList=vg,bu.Attr=Fg,bu.CDATASection=Kg,bu.CharacterData=Bg,bu.Comment=Zg,bu.Document=Cg,bu.DocumentFragment=Yg,bu.DocumentType=Dg,bu.DOMImplementation=wg,bu.Element=Ug,bu.Entity=Xg,bu.EntityReference=Jg,bu.LiveNodeList=mg,bu.NamedNodeMap=bg,bu.Node=Sg,bu.NodeList=gg,bu.Notation=jg,bu.Text=Gg,bu.ProcessingInstruction=Qg,bu.walkDOM=Tg,bu.XMLSerializer=_g;var im,lm,sm={},dm={};im=dm,lm=_p.freeze,im.XML_ENTITIES=lm({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),im.HTML_ENTITIES=lm({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),im.entityMap=im.HTML_ENTITIES;var cm={},hm=_p,pm=yu,um=su,fm=hm.isHTMLEscapableRawTextElement,gm=hm.isHTMLMimeType,mm=hm.isHTMLRawTextElement,vm=hm.hasOwn,bm=hm.NAMESPACE,ym=um.ParseError,Mm=um.DOMException;function xm(){}xm.prototype={parse:function(t,e,a){var n=this.domBuilder;n.startDocument(),Cm(e,e=Object.create(null)),function(t,e,a,n,r){var o=gm(n.mimeType);t.indexOf(pm.UNICODE_REPLACEMENT_CHARACTER)>=0&&r.warning("Unicode replacement character detected, source encoding issues?");function i(t){if(t>65535){var e=55296+((t-=65536)>>10),a=56320+(1023&t);return String.fromCharCode(e,a)}return String.fromCharCode(t)}function l(t){var e=";"===t[t.length-1]?t:t+";";if(!o&&e!==t)return r.error("EntityRef: expecting ;"),t;var n=pm.Reference.exec(e);if(!n||n[0].length!==e.length)return r.error("entity not matching Reference production: "+t),t;var l=e.slice(1,-1);return vm(a,l)?a[l]:"#"===l.charAt(0)?i(parseInt(l.substring(1).replace("x","0x"))):(r.error("entity not found:"+t),t)}function s(e){if(e>m){var a=t.substring(m,e).replace(wm,l);p&&u(m),n.characters(a,0,e-m),m=e}}var d=0,c=0,h=/\r\n?|\n|$/g,p=n.locator;function u(e,a){for(;e>=c&&(a=h.exec(t));)d=c,c=a.index+a[0].length,p.lineNumber++;p.columnNumber=e-d+1}var f=[{currentNSMap:e}],g=[],m=0;for(;;){try{var v=t.indexOf("<",m);if(v<0){if(!o&&g.length>0)return r.fatalError("unclosed xml tag(s): "+g.join(", "));if(!t.substring(m).match(/^\s*$/)){var b=n.doc,y=b.createTextNode(t.substring(m));if(b.documentElement)return r.error("Extra content at the end of the document");b.appendChild(y),n.currentElement=y}return}if(v>m){var M=t.substring(m,v);o||0!==g.length||(M=M.replace(new RegExp(pm.S_OPT.source,"g"),""))&&r.error("Unexpected content outside root element: '"+M+"'"),s(v)}switch(t.charAt(v+1)){case"/":var x=t.indexOf(">",v+2),w=t.substring(v+2,x>0?x:void 0);if(!w)return r.fatalError("end tag name missing");var S=x>0&&pm.reg("^",pm.QName_group,pm.S_OPT,"$").exec(w);if(!S)return r.fatalError('end tag name contains invalid characters: "'+w+'"');if(!n.currentElement&&!n.doc.documentElement)return;var A=g[g.length-1]||n.currentElement.tagName||n.doc.documentElement.tagName||"";if(A!==S[1]){var I=S[1].toLowerCase();if(!o||A.toLowerCase()!==I)return r.fatalError('Opening and ending tag mismatch: "'+A+'" != "'+w+'"')}var T=f.pop();g.pop();var C=T.localNSMap;if(n.endElement(T.uri,T.localName,A),C)for(var k in C)vm(C,k)&&n.endPrefixMapping(k);x++;break;case"?":p&&u(v),x=Em(t,v,n,r);break;case"!":p&&u(v),x=Vm(t,v,n,r,o);break;default:p&&u(v);var V=new Rm,E=f[f.length-1].currentNSMap,R=(x=Am(t,v,V,E,l,r,o),V.length);if(V.closed||(o&&hm.isHTMLVoidElement(V.tagName)?V.closed=!0:g.push(V.tagName)),p&&R){for(var L=Sm(p,{}),z=0;z<R;z++){var N=V[z];u(N.offset),N.locator=Sm(p,{})}n.locator=L,Im(V,n,E)&&f.push(V),n.locator=p}else Im(V,n,E)&&f.push(V);o&&!V.closed?x=Tm(t,x,V.tagName,l,n):x++}}catch(rN){if(rN instanceof ym)throw rN;if(rN instanceof Mm)throw new ym(rN.name+": "+rN.message,n.locator,rN);r.error("element parse error: "+rN),x=-1}x>m?m=x:s(Math.max(v,m)+1)}}(t,e,a,n,this.errorHandler),n.endDocument()}};var wm=/&#?\w+;?/g;function Sm(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function Am(t,e,a,n,r,o,i){function l(t,e,n){return vm(a.attributeNames,t)?o.fatalError("Attribute "+t+" redefined"):!i&&e.indexOf("<")>=0?o.fatalError("Unescaped '<' not allowed in attributes values"):void a.addValue(t,e.replace(/[\t\n\r]/g," ").replace(wm,r),n)}for(var s,d=++e,c=0;;){var h=t.charAt(d);switch(h){case"=":if(1===c)s=t.slice(e,d),c=3;else{if(2!==c)throw new Error("attribute equal must after attrName");c=3}break;case"'":case'"':if(3===c||1===c){if(1===c&&(o.warning('attribute value must after "="'),s=t.slice(e,d)),e=d+1,!((d=t.indexOf(h,e))>0))throw new Error("attribute value no end '"+h+"' match");l(s,p=t.slice(e,d),e-1),c=5}else{if(4!=c)throw new Error('attribute value must after "="');l(s,p=t.slice(e,d),e),o.warning('attribute "'+s+'" missed start quot('+h+")!!"),e=d+1,c=5}break;case"/":switch(c){case 0:a.setTagName(t.slice(e,d));case 5:case 6:case 7:c=7,a.closed=!0;case 4:case 1:break;case 2:a.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return o.error("unexpected end of input"),0==c&&a.setTagName(t.slice(e,d)),d;case">":switch(c){case 0:a.setTagName(t.slice(e,d));case 5:case 6:case 7:break;case 4:case 1:"/"===(p=t.slice(e,d)).slice(-1)&&(a.closed=!0,p=p.slice(0,-1));case 2:2===c&&(p=s),4==c?(o.warning('attribute "'+p+'" missed quot(")!'),l(s,p,e)):(i||o.warning('attribute "'+p+'" missed value!! "'+p+'" instead!!'),l(p,p,e));break;case 3:if(!i)return o.fatalError("AttValue: ' or \" expected")}return d;case"":h=" ";default:if(h<=" ")switch(c){case 0:a.setTagName(t.slice(e,d)),c=6;break;case 1:s=t.slice(e,d),c=2;break;case 4:var p=t.slice(e,d);o.warning('attribute "'+p+'" missed quot(")!!'),l(s,p,e);case 5:c=6}else switch(c){case 2:i||o.warning('attribute "'+s+'" missed value!! "'+s+'" instead2!!'),l(s,s,e),e=d,c=1;break;case 5:o.warning('attribute space is required"'+s+'"!!');case 6:c=1,e=d;break;case 3:c=4,e=d;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}d++}}function Im(t,e,a){for(var n=t.tagName,r=null,o=t.length;o--;){var i=t[o],l=i.qName,s=i.value;if((p=l.indexOf(":"))>0)var d=i.prefix=l.slice(0,p),c=l.slice(p+1),h="xmlns"===d&&c;else c=l,d=null,h="xmlns"===l&&"";i.localName=c,!1!==h&&(null==r&&(r=Object.create(null),Cm(a,a=Object.create(null))),a[h]=r[h]=s,i.uri=bm.XMLNS,e.startPrefixMapping(h,s))}for(o=t.length;o--;)(i=t[o]).prefix&&("xml"===i.prefix&&(i.uri=bm.XML),"xmlns"!==i.prefix&&(i.uri=a[i.prefix]));var p;(p=n.indexOf(":"))>0?(d=t.prefix=n.slice(0,p),c=t.localName=n.slice(p+1)):(d=null,c=t.localName=n);var u=t.uri=a[d||""];if(e.startElement(u,c,n,t),!t.closed)return t.currentNSMap=a,t.localNSMap=r,!0;if(e.endElement(u,c,n),r)for(d in r)vm(r,d)&&e.endPrefixMapping(d)}function Tm(t,e,a,n,r){var o=fm(a);if(o||mm(a)){var i=t.indexOf("</"+a+">",e),l=t.substring(e+1,i);return o&&(l=l.replace(wm,n)),r.characters(l,0,l.length),i}return e+1}function Cm(t,e){for(var a in t)vm(t,a)&&(e[a]=t[a])}function km(t,e){var a=e;function n(e){return e=e||0,t.charAt(a+e)}function r(t){a+=t=t||1}function o(){return t.substring(a)}return{char:n,getIndex:function(){return a},getMatch:function(t){var e=pm.reg("^",t).exec(o());return e?(r(e[0].length),e[0]):null},getSource:function(){return t},skip:r,skipBlanks:function(){for(var e=0;a<t.length;){var o=n();if(" "!==o&&"\n"!==o&&"\t"!==o&&"\r"!==o)return e;e++,r()}return-1},substringFromIndex:o,substringStartsWith:function(e){return t.substring(a,a+e.length)===e},substringStartsWithCaseInsensitive:function(e){return t.substring(a,a+e.length).toUpperCase()===e.toUpperCase()}}}function Vm(t,e,a,n,r){var o=km(t,e);switch(r?o.char(2).toUpperCase():o.char(2)){case"-":var i=o.getMatch(pm.Comment);return i?(a.comment(i,pm.COMMENT_START.length,i.length-pm.COMMENT_START.length-pm.COMMENT_END.length),o.getIndex()):n.fatalError("comment is not well-formed at position "+o.getIndex());case"[":var l=o.getMatch(pm.CDSect);return l?r||a.currentElement?(a.startCDATA(),a.characters(l,pm.CDATA_START.length,l.length-pm.CDATA_START.length-pm.CDATA_END.length),a.endCDATA(),o.getIndex()):n.fatalError("CDATA outside of element"):n.fatalError("Invalid CDATA starting at position "+e);case"D":if(a.doc&&a.doc.documentElement)return n.fatalError("Doctype not allowed inside or after documentElement at position "+o.getIndex());if(r?!o.substringStartsWithCaseInsensitive(pm.DOCTYPE_DECL_START):!o.substringStartsWith(pm.DOCTYPE_DECL_START))return n.fatalError("Expected "+pm.DOCTYPE_DECL_START+" at position "+o.getIndex());if(o.skip(pm.DOCTYPE_DECL_START.length),o.skipBlanks()<1)return n.fatalError("Expected whitespace after "+pm.DOCTYPE_DECL_START+" at position "+o.getIndex());var s={name:void 0,publicId:void 0,systemId:void 0,internalSubset:void 0};if(s.name=o.getMatch(pm.Name),!s.name)return n.fatalError("doctype name missing or contains unexpected characters at position "+o.getIndex());if(r&&"html"!==s.name.toLowerCase()&&n.warning("Unexpected DOCTYPE in HTML document at position "+o.getIndex()),o.skipBlanks(),o.substringStartsWith(pm.PUBLIC)||o.substringStartsWith(pm.SYSTEM)){var d=pm.ExternalID_match.exec(o.substringFromIndex());if(!d)return n.fatalError("doctype external id is not well-formed at position "+o.getIndex());void 0!==d.groups.SystemLiteralOnly?s.systemId=d.groups.SystemLiteralOnly:(s.systemId=d.groups.SystemLiteral,s.publicId=d.groups.PubidLiteral),o.skip(d[0].length)}else if(r&&o.substringStartsWithCaseInsensitive(pm.SYSTEM)){if(o.skip(pm.SYSTEM.length),o.skipBlanks()<1)return n.fatalError("Expected whitespace after "+pm.SYSTEM+" at position "+o.getIndex());if(s.systemId=o.getMatch(pm.ABOUT_LEGACY_COMPAT_SystemLiteral),!s.systemId)return n.fatalError("Expected "+pm.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+pm.SYSTEM+" at position "+o.getIndex())}return r&&s.systemId&&!pm.ABOUT_LEGACY_COMPAT_SystemLiteral.test(s.systemId)&&n.warning("Unexpected doctype.systemId in HTML document at position "+o.getIndex()),r||(o.skipBlanks(),s.internalSubset=function(t,e){function a(t,e){var a=pm.PI.exec(t.substringFromIndex());return a?"xml"===a[1].toLowerCase()?e.fatalError("xml declaration is only allowed at the start of the document, but found at position "+t.getIndex()):(t.skip(a[0].length),a[0]):e.fatalError("processing instruction is not well-formed at position "+t.getIndex())}var n=t.getSource();if("["===t.char()){t.skip(1);for(var r=t.getIndex();t.getIndex()<n.length;){if(t.skipBlanks(),"]"===t.char()){var o=n.substring(r,t.getIndex());return t.skip(1),o}var i=null;if("<"===t.char()&&"!"===t.char(1))switch(t.char(2)){case"E":"L"===t.char(3)?i=t.getMatch(pm.elementdecl):"N"===t.char(3)&&(i=t.getMatch(pm.EntityDecl));break;case"A":i=t.getMatch(pm.AttlistDecl);break;case"N":i=t.getMatch(pm.NotationDecl);break;case"-":i=t.getMatch(pm.Comment)}else if("<"===t.char()&&"?"===t.char(1))i=a(t,e);else{if("%"!==t.char())return e.fatalError("Error detected in Markup declaration");i=t.getMatch(pm.PEReference)}if(!i)return e.fatalError("Error in internal subset at position "+t.getIndex())}return e.fatalError("doctype internal subset is not well-formed, missing ]")}}(o,n)),o.skipBlanks(),">"!==o.char()?n.fatalError("doctype not terminated with > at position "+o.getIndex()):(o.skip(1),a.startDTD(s.name,s.publicId,s.systemId,s.internalSubset),a.endDTD(),o.getIndex());default:return n.fatalError('Not well-formed XML starting with "<!" at position '+e)}}function Em(t,e,a,n){var r=t.substring(e).match(pm.PI);if(!r)return n.fatalError("Invalid processing instruction starting at position "+e);if("xml"===r[1].toLowerCase()){if(e>0)return n.fatalError("processing instruction at position "+e+" is an xml declaration which is only at the start of the document");if(!pm.XMLDecl.test(t.substring(e)))return n.fatalError("xml declaration is not well-formed")}return a.processingInstruction(r[1],r[2]),e+r[0].length}function Rm(){this.attributeNames=Object.create(null)}Rm.prototype={setTagName:function(t){if(!pm.QName_exact.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,a){if(!pm.QName_exact.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:a}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}},cm.XMLReader=xm,cm.parseUtils=km,cm.parseDoctypeCommentOrCData=Vm;var Lm=_p,zm=su,Nm=dm,qm=cm,Om=bu.DOMImplementation,Pm=Lm.hasDefaultHTMLNamespace,Wm=Lm.isHTMLMimeType,Hm=Lm.isValidMimeType,Um=Lm.MIME_TYPE,Fm=Lm.NAMESPACE,Bm=zm.ParseError,Gm=qm.XMLReader;function Zm(t){return t.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028\u2029]/g,"\n")}function Km(t){if(void 0===(t=t||{}).locator&&(t.locator=!0),this.assign=t.assign||Lm.assign,this.domHandler=t.domHandler||Dm,this.onError=t.onError||t.errorHandler,t.errorHandler&&"function"!=typeof t.errorHandler)throw new TypeError("errorHandler object is no longer supported, switch to onError!");t.errorHandler&&t.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=t.normalizeLineEndings||Zm,this.locator=!!t.locator,this.xmlns=this.assign(Object.create(null),t.xmlns)}function Dm(t){var e=t||{};this.mimeType=e.mimeType||Um.XML_APPLICATION,this.defaultNamespace=e.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=e.onError}function jm(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}function Xm(t,e,a){return"string"==typeof t?t.substr(e,a):t.length>=e+a||e?new java.lang.String(t,e,a)+"":t}function Jm(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}Km.prototype.parseFromString=function(t,e){if(!Hm(e))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+e+'" is not valid.');var a=this.assign(Object.create(null),this.xmlns),n=Nm.XML_ENTITIES,r=a[""]||null;Pm(e)?(n=Nm.HTML_ENTITIES,r=Fm.HTML):e===Um.XML_SVG_IMAGE&&(r=Fm.SVG),a[""]=r,a.xml=a.xml||Fm.XML;var o=new this.domHandler({mimeType:e,defaultNamespace:r,onError:this.onError}),i=this.locator?{}:void 0;this.locator&&o.setDocumentLocator(i);var l=new Gm;return l.errorHandler=o,l.domBuilder=o,!Lm.isHTMLMimeType(e)&&"string"!=typeof t&&l.errorHandler.fatalError("source is not a string"),l.parse(this.normalizeLineEndings(String(t)),a,n),o.doc.documentElement||l.errorHandler.fatalError("missing root element"),o.doc},Dm.prototype={startDocument:function(){var t=new Om;this.doc=Wm(this.mimeType)?t.createHTMLDocument(!1):t.createDocument(this.defaultNamespace,"")},startElement:function(t,e,a,n){var r=this.doc,o=r.createElementNS(t,a||e),i=n.length;Jm(this,o),this.currentElement=o,this.locator&&jm(this.locator,o);for(var l=0;l<i;l++){t=n.getURI(l);var s=n.getValue(l),d=(a=n.getQName(l),r.createAttributeNS(t,a));this.locator&&jm(n.getLocator(l),d),d.value=d.nodeValue=s,o.setAttributeNode(d)}},endElement:function(t,e,a){this.currentElement=this.currentElement.parentNode},startPrefixMapping:function(t,e){},endPrefixMapping:function(t){},processingInstruction:function(t,e){var a=this.doc.createProcessingInstruction(t,e);this.locator&&jm(this.locator,a),Jm(this,a)},ignorableWhitespace:function(t,e,a){},characters:function(t,e,a){if(t=Xm.apply(this,arguments)){if(this.cdata)var n=this.doc.createCDATASection(t);else n=this.doc.createTextNode(t);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(t)&&this.doc.appendChild(n),this.locator&&jm(this.locator,n)}},skippedEntity:function(t){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(t){t&&(t.lineNumber=0),this.locator=t},comment:function(t,e,a){t=Xm.apply(this,arguments);var n=this.doc.createComment(t);this.locator&&jm(this.locator,n),Jm(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(t,e,a,n){var r=this.doc.implementation;if(r&&r.createDocumentType){var o=r.createDocumentType(t,e,a,n);this.locator&&jm(this.locator,o),Jm(this,o),this.doc.doctype=o}},reportError:function(t,e){if("function"==typeof this.onError)try{this.onError(t,e,this)}catch(rN){throw new Bm("Reporting "+t+' "'+e+'" caused '+rN,this.locator)}else console.error("[xmldom "+t+"]\t"+e,function(t){if(t)return"\n@#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}(this.locator))},warning:function(t){this.reportError("warning",t)},error:function(t){this.reportError("error",t)},fatalError:function(t){throw this.reportError("fatalError",t),new Bm(t,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(t){Dm.prototype[t]=function(){return null}}),sm.__DOMHandler=Dm,sm.DOMParser=Km,sm.normalizeLineEndings=Zm,sm.onErrorStopParsing=function(t){if("error"===t)throw"onErrorStopParsing"},sm.onWarningStopParsing=function(){throw"onWarningStopParsing"};var Ym=_p;Ym.assign,Ym.hasDefaultHTMLNamespace,Ym.isHTMLMimeType,Ym.isValidMimeType,Ym.MIME_TYPE,Ym.NAMESPACE;var Qm=bu.XMLSerializer,_m=sm.DOMParser;const $m="http://schemas.openxmlformats.org/wordprocessingml/2006/main",tv="http://schemas.openxmlformats.org/drawingml/2006/main",ev="http://schemas.microsoft.com/office/word/2010/wordml";function av(t,e,a){if(!t)return[];const n=[];for(let r=0;r<t.childNodes.length;r+=1){const o=t.childNodes[r];(null==o?void 0:o.nodeType)===o.ELEMENT_NODE&&o.namespaceURI===e&&o.localName===a&&n.push(o)}return n}const nv=["lrTb","tbRl","btLr","lrTbV","tbRlV"];function rv(t){return nv.includes(t)?t:void 0}function ov(t,e,a){return av(t,e,a)[0]??null}function iv(t,e){return t?t.getAttributeNS($m,e)??t.getAttributeNS(ev,e)??t.getAttribute(`w:${e}`)??t.getAttribute(`w14:${e}`)??t.getAttribute(e):null}function lv(t,e){for(let a=0;a<t.childNodes.length;a+=1){const n=t.childNodes[a];if(1===(null==n?void 0:n.nodeType)){const t=n;if(t.localName===e)return t;const a=lv(t,e);if(a)return a}}return null}function sv(t){return"1"===t||"true"===t||"on"===t}function dv(t,e){const a=ov(t,$m,e);if(!a)return;const n=iv(a,"val");return null==n||"0"!==n&&"false"!==n&&"off"!==n&&sv(n)}function cv(t,e){return iv(ov(t,$m,e),"val")??void 0}async function hv(t,e){e>0&&e%t===0&&await new Promise(t=>setTimeout(t,0))}function pv(t){var e;const a=new Map;if(!t)return a;const n=null==(e=(new _m).parseFromString(t,"application/xml").documentElement)?void 0:e.childNodes;if(!n)return a;for(let r=0;r<n.length;r+=1){const t=n[r];if(1===(null==t?void 0:t.nodeType)){const e=t;if("Relationship"===e.localName){const t=e.getAttribute("Id"),n=e.getAttribute("Target");t&&n&&a.set(t,n)}}}return a}async function uv(t,e){var a;const n=e.lastIndexOf("/"),r=n>=0?e.slice(0,n):"",o=n>=0?e.slice(n+1):e,i=r?`${r}/_rels/${o}.rels`:`_rels/${o}.rels`;return pv(await(null==(a=t.file(i))?void 0:a.async("string")))}const fv=t=>{var e;const a=ov(t,tv,"latin");return(null==(e=null==a?void 0:a.getAttribute("typeface"))?void 0:e.trim())||void 0},gv=t=>{var e;const a=ov(t,tv,"cs");return(null==(e=null==a?void 0:a.getAttribute("typeface"))?void 0:e.trim())||fv(t)},mv=t=>{var e;const a=ov(t,tv,"ea");return(null==(e=null==a?void 0:a.getAttribute("typeface"))?void 0:e.trim())||fv(t)};function vv(t){const e=ov(t,tv,"fontScheme"),a=ov(e,tv,"majorFont"),n=ov(e,tv,"minorFont");return{majorHAnsi:fv(a),minorHAnsi:fv(n),majorEastAsia:mv(a),minorEastAsia:mv(n),majorBidi:gv(a),minorBidi:gv(n)}}function bv(t,e){const a=t?Number(t):Number.NaN;return Number.isFinite(a)?Math.round(a/1440*96):e}function yv(t){const e=t?Number(t):Number.NaN;if(Number.isFinite(e))return Math.round(e/20*1e4)/1e4}function Mv(t){const e=null==t?void 0:t.trim();if(e&&"auto"!==e&&"none"!==e)return e.startsWith("#")?e:`#${e.toUpperCase()}`}const xv=["dk1","lt1","dk2","lt2","accent1","accent2","accent3","accent4","accent5","accent6","hlink","folHlink"];function wv(t){const e=ov(t,tv,"srgbClr");if(e)return Mv(iv(e,"val"));const a=ov(t,tv,"sysClr");return a?Mv(iv(a,"lastClr")):void 0}function Sv(t){const e=ov(t,tv,"clrScheme");if(!e)return{};const a={};for(const n of xv){const t=wv(ov(e,tv,n));t&&(a[n]=t)}return a}function Av(t){if(!t)return;const e=Number.parseInt(t,16);return Number.isFinite(e)?e/255:void 0}function Iv(t,e,a){const n=t=>{return(e=t,Math.min(255,Math.max(0,Math.round(e)))).toString(16).padStart(2,"0").toUpperCase();var e};return`#${n(t)}${n(e)}${n(a)}`}const Tv={decimal:"decimal",lowerRoman:"lowerRoman",upperRoman:"upperRoman",lowerLetter:"lowerLetter",upperLetter:"upperLetter",symbol:"symbol"},Cv={continuous:"continuous",eachSect:"eachSection"};function kv(t){if(!t)return;const e={},a=iv(ov(t,$m,"numFmt"),"val");a&&Tv[a]&&(e.numberFormat=Tv[a]);const n=Number.parseInt(iv(ov(t,$m,"numStart"),"val")??"",10);Number.isFinite(n)&&n>0&&(e.startAt=n);const r=iv(ov(t,$m,"numRestart"),"val");return r&&Cv[r]&&(e.restart=Cv[r]),Object.keys(e).length>0?e:void 0}const Vv={decimal:"decimal",lowerLetter:"lowerLetter",upperLetter:"upperLetter",lowerRoman:"lowerRoman",upperRoman:"upperRoman",bullet:"bullet"};function Ev(t){const e=Object.entries(t).filter(([,t])=>void 0!==t);return e.length>0?Object.fromEntries(e):void 0}function Rv(t){return Object.keys(t).length>0?t:void 0}function Lv(t,e){return Rv({...t??{},...e??{}})}function zv(t){return Mv(iv(t,"fill"))}function Nv(t,e){if(!t)return;const a=Ne(t,e,Ia),n=Ne(void 0,e,Ia),r=(t,e)=>t!==e?t:void 0,o=(t,e,a)=>void 0!==t?t:r(e,a);return Ev({styleId:t.styleId,bold:o(t.bold,a.bold,n.bold),italic:o(t.italic,a.italic,n.italic),underline:r(a.underline,n.underline),underlineStyle:r(a.underlineStyle,n.underlineStyle),underlineColor:r(a.underlineColor,n.underlineColor),strike:o(t.strike,a.strike,n.strike),doubleStrike:o(t.doubleStrike,a.doubleStrike,n.doubleStrike),superscript:r(a.superscript,n.superscript),subscript:r(a.subscript,n.subscript),smallCaps:o(t.smallCaps,a.smallCaps,n.smallCaps),allCaps:o(t.allCaps,a.allCaps,n.allCaps),hidden:o(t.hidden,a.hidden,n.hidden),noProof:o(t.noProof,a.noProof,n.noProof),webHidden:o(t.webHidden,a.webHidden,n.webHidden),specVanish:o(t.specVanish,a.specVanish,n.specVanish),textEffect:r(a.textEffect,n.textEffect),characterScale:r(a.characterScale,n.characterScale),characterSpacing:r(a.characterSpacing,n.characterSpacing),baselineShift:r(a.baselineShift,n.baselineShift),kerningThreshold:r(a.kerningThreshold,n.kerningThreshold),ligatures:r(a.ligatures,n.ligatures),numberSpacing:r(a.numberSpacing,n.numberSpacing),numberForm:r(a.numberForm,n.numberForm),stylisticSet:r(a.stylisticSet,n.stylisticSet),contextualAlternates:r(a.contextualAlternates,n.contextualAlternates),fontFamily:o(t.fontFamily,a.fontFamily,n.fontFamily),fontSize:o(t.fontSize,a.fontSize,n.fontSize),color:r(a.color,n.color),highlight:r(a.highlight,n.highlight),shading:r(a.shading,n.shading),language:r(a.language,n.language),link:r(a.link,n.link)})}function qv(t,e){if(!t)return;const a={},n=cv(t,"rStyle");n&&(a.styleId=n);const r=dv(t,"b"),o=dv(t,"bCs");void 0===r&&void 0===o||(a.bold=!0===r||!0===o);const i=dv(t,"i"),l=dv(t,"iCs");void 0===i&&void 0===l||(a.italic=!0===i||!0===l);const s=dv(t,"strike");void 0!==s&&(a.strike=s);const d=dv(t,"dstrike");void 0!==d&&(a.doubleStrike=d);const c=dv(t,"smallCaps");void 0!==c&&(a.smallCaps=c);const h=dv(t,"caps");void 0!==h&&(a.allCaps=h);const p=dv(t,"vanish");void 0!==p&&(a.hidden=p);const u=dv(t,"noProof");void 0!==u&&(a.noProof=u);const f=dv(t,"webHidden");void 0!==f&&(a.webHidden=f);const g=dv(t,"specVanish");void 0!==g&&(a.specVanish=g);const m=iv(ov(t,$m,"effect"),"val");m&&(a.textEffect=m);const v=iv(ov(t,$m,"w"),"val");if(v){const t=Number(v);Number.isFinite(t)&&t>0&&(a.characterScale=t)}const b=iv(ov(t,$m,"spacing"),"val");if(b){const t=yv(b);void 0!==t&&(a.characterSpacing=t)}const y=iv(ov(t,$m,"position"),"val");if(y){const t=Number(y);Number.isFinite(t)&&(a.baselineShift=t/2)}const M=iv(ov(t,$m,"kern"),"val");if(M){const t=Number(M);Number.isFinite(t)&&t>=0&&(a.kerningThreshold=t/2)}const x=iv(ov(t,ev,"ligatures"),"val");"none"!==x&&"standard"!==x&&"contextual"!==x&&"historical"!==x&&"standardContextual"!==x||(a.ligatures=x);const w=iv(ov(t,ev,"numSpacing"),"val");"proportional"!==w&&"tabular"!==w||(a.numberSpacing=w);const S=iv(ov(t,ev,"numForm"),"val");"lining"!==S&&"oldStyle"!==S||(a.numberForm=S);const A=iv(ov(t,ev,"stylisticSets"),"val");if(A){const t=/^[0-9a-fA-F]+$/.test(A)&&A.length>2?Number.parseInt(A,16):Number(A);if(Number.isFinite(t)&&t>0)for(let e=1;e<=20;e+=1)if(t&1<<e-1){a.stylisticSet=e;break}}const I=iv(ov(t,ev,"cntxtAlts"),"val");null===I?ov(t,ev,"cntxtAlts")&&(a.contextualAlternates=!0):sv(I)&&(a.contextualAlternates=!0);const T=ov(t,$m,"u"),C=iv(T,"val");if(T&&"none"!==C){a.underline=!0,C&&"single"!==C&&(a.underlineStyle=C);const t=iv(T,"color");t&&"auto"!==t&&(a.underlineColor=Mv(t))}const k=iv(ov(t,$m,"vertAlign"),"val");"superscript"===k&&(a.superscript=!0),"subscript"===k&&(a.subscript=!0);const V=ov(t,$m,"rFonts"),E=iv(V,"ascii")??iv(V,"hAnsi")??iv(V,"cs")??iv(V,"eastAsia")??function(t,e){const a=iv(t,"asciiTheme")??iv(t,"hAnsiTheme")??iv(t,"eastAsiaTheme")??iv(t,"cstheme");if(!a)return;const n="majorAscii"===a||"majorHAnsi"===a?"majorHAnsi":"minorAscii"===a||"minorHAnsi"===a?"minorHAnsi":"majorEastAsia"===a?"majorEastAsia":"minorEastAsia"===a?"minorEastAsia":"majorBidi"===a?"majorBidi":"minorBidi"===a?"minorBidi":void 0;return n?e[n]:void 0}(V,e.fonts);E&&(a.fontFamily=function(t){const e=null==t?void 0:t.trim();if(!e)return;return`${/[\s,]/.test(e)?`"${e.replace(/"/g,'\\"')}"`:e}, ${/times/i.test(e)?"serif":"sans-serif"}`}(E));const R=iv(ov(t,$m,"sz")??ov(t,$m,"szCs"),"val");if(R){const t=function(t){const e=t?Number(t):Number.NaN;return Number.isFinite(e)?Math.round(e/2/72*96*1e4)/1e4:null}(R);null!==t&&(a.fontSize=t)}const L=ov(t,$m,"color"),z=iv(L,"val");if(z&&"auto"!==z)a.color=Mv(z);else if("auto"!==z){const t=function(t,e){const a=iv(t,"themeColor");if(!a)return;const n=function(t){switch(t){case"dark1":case"text1":return"dk1";case"light1":case"background1":return"lt1";case"dark2":case"text2":return"dk2";case"light2":case"background2":return"lt2";case"accent1":case"accent2":case"accent3":case"accent4":case"accent5":case"accent6":return t;case"hyperlink":return"hlink";case"followedHyperlink":return"folHlink";default:return}}(a),r=n?e[n]:void 0;if(!r)return;let o=Number.parseInt(r.slice(1,3),16),i=Number.parseInt(r.slice(3,5),16),l=Number.parseInt(r.slice(5,7),16);const s=Av(iv(t,"themeShade"));void 0!==s&&(o*=s,i*=s,l*=s);const d=Av(iv(t,"themeTint"));if(void 0!==d){const t=255*(1-d);o=o*d+t,i=i*d+t,l=l*d+t}return Iv(o,i,l)}(L,e.colors);t&&(a.color=t)}const N=iv(ov(t,$m,"highlight"),"val");N&&"none"!==N&&(a.highlight=N);const q=zv(ov(t,$m,"shd"));q&&(a.shading=q);const O=ov(t,$m,"lang");if(O){const t=iv(O,"val"),e=iv(O,"eastAsia"),n=iv(O,"bidi"),r={};t&&(r.value=t),e&&(r.eastAsia=e),n&&(r.bidi=n),Object.keys(r).length>0&&(a.language=r)}return Rv(a)}function Ov(t){if(!t)return;const e=iv(t,"val");if("nil"===e||"none"===e)return{width:0,type:"none",color:"transparent"};const a=Number(iv(t,"sz")),n=Number.isFinite(a)&&a>0?Math.round(a/8*1e4)/1e4:.75,r=Mv(iv(t,"color"))??"#000000",o=(null==e?void 0:e.toLowerCase())??"single";return{width:n,type:o.includes("dotted")||o.includes("dot")?"dotted":o.includes("dash")?"dashed":"solid",color:r}}function Pv(t){return t?{borderTop:Ov(ov(t,$m,"top")),borderRight:Ov(ov(t,$m,"right")),borderBottom:Ov(ov(t,$m,"bottom")),borderLeft:Ov(ov(t,$m,"left")),borderStart:Ov(ov(t,$m,"start")),borderEnd:Ov(ov(t,$m,"end")),borderTopLeftToBottomRight:Ov(ov(t,$m,"tl2br")),borderTopRightToBottomLeft:Ov(ov(t,$m,"tr2bl"))}:{}}function Wv(t){return void 0!==(null==t?void 0:t.lineHeight)?t:{...t??{},lineHeight:1.1}}function Hv(t){const e=ov(t,$m,"spacing");return{before:sv(iv(e,"beforeAutospacing")),after:sv(iv(e,"afterAutospacing"))}}function Uv(t){if(!t)return;const e={},a=cv(t,"pStyle");a&&(e.styleId=a);const n=iv(ov(t,$m,"jc"),"val");"left"===n||"start"===n||"center"===n||"right"===n||"end"===n||"justify"===n?e.align="start"===n?"left":"end"===n?"right":n:"both"!==n&&"distribute"!==n||(e.align="justify");const r=ov(t,$m,"spacing"),o=iv(r,"before"),i=iv(r,"after"),l=iv(r,"line"),s=iv(r,"lineRule");o&&(e.spacingBefore=bv(o,0)),i&&(e.spacingAfter=bv(i,0)),l&&("exact"===s||"atLeast"===s?(e.lineHeight=Math.round(Number(l)/1440*96*1e4)/1e4,e.lineRule=s):e.lineHeight=Number(l)/240);const d=dv(t,"contextualSpacing");void 0!==d&&(e.contextualSpacing=d);const c=dv(t,"snapToGrid");void 0!==c&&(e.snapToGrid=c);const h=ov(t,$m,"ind"),p=iv(h,"start")??iv(h,"left"),u=iv(h,"end")??iv(h,"right"),f=iv(h,"firstLine"),g=iv(h,"hanging");p&&(e.indentLeft=bv(p,0)),u&&(e.indentRight=bv(u,0)),g?(e.indentHanging=bv(g,0),e.indentFirstLine=void 0):f&&(e.indentFirstLine=bv(f,0));const m=function(t){const e=ov(t,$m,"tabs");if(!e)return[];const a=[];for(const n of av(e,$m,"tab")){const t=yv(iv(n,"pos"));if(void 0===t)continue;const e=iv(n,"val"),r="center"===e||"right"===e||"decimal"===e||"bar"===e||"clear"===e?e:"left",o=iv(n,"leader"),i="dot"===o||"hyphen"===o||"underscore"===o||"heavy"===o||"middleDot"===o?o:"none"===o?"none":void 0;a.push({position:t,type:r,...void 0!==i?{leader:i}:{}})}return a}(t);m.length>0&&(e.tabs=m);const v=dv(t,"pageBreakBefore");void 0!==v&&(e.pageBreakBefore=v);const b=dv(t,"keepNext");void 0!==b&&(e.keepWithNext=b);const y=dv(t,"keepLines");void 0!==y&&(e.keepLinesTogether=y);const M=dv(t,"widowControl");void 0!==M&&(e.widowControl=M);const x=ov(t,$m,"pBdr");if(x){const{borderTop:t,borderRight:a,borderBottom:n,borderLeft:r}=Pv(x);t&&(e.borderTop=t),a&&(e.borderRight=a),n&&(e.borderBottom=n),r&&(e.borderLeft=r)}const w=zv(ov(t,$m,"shd"));w&&(e.shading=w);const S=rv(iv(ov(t,$m,"textDirection"),"val"));S&&(e.textDirection=S);const A=iv(ov(t,$m,"outlineLvl"),"val");if(void 0!==A){const t=Number(A);Number.isFinite(t)&&t>=0&&t<=8&&(e.outlineLevel=t)}return Rv(e)}function Fv(t){if(!t)return;const e={},a=ov(t,$m,"trHeight");if(a){const t=yv(iv(a,"val"));void 0!==t&&(e.height=t);const n=iv(a,"hRule");"auto"!==n&&"exact"!==n&&"atLeast"!==n||(e.heightRule=n)}const n=dv(t,"cantSplit");void 0!==n&&(e.cantSplit=n);const r=dv(t,"hidden");return void 0!==r&&(e.hidden=r),Object.keys(e).length>0?e:void 0}function Bv(t){return"1"===t||"true"===t||"on"===t}function Gv(t){const e=ov(t,$m,"cols");if(!e)return;const a=Number.parseInt(iv(e,"num")??"1",10);if(!Number.isFinite(a)||a<=1)return;const n=bv(iv(e,"space"),0),r=iv(e,"sep"),o=iv(e,"equalWidth"),i=av(e,$m,"col").map(t=>({width:bv(iv(t,"w"),0),space:bv(iv(t,"space"),n)})),l=null==o||Bv(o);return{count:a,space:n,...Bv(r)?{separator:!0}:{},...l?{}:{equalWidth:!1},...!l&&i.length>0?{columns:i}:{}}}function Zv(t){const e=ov(t,$m,"pgSz"),a=ov(t,$m,"pgMar"),n=Gv(t);let r;if(e||a||n){const t=bv(iv(e,"w"),816),o=bv(iv(e,"h"),1056),i=iv(e,"orient");r={width:t,height:o,orientation:"landscape"===i?"landscape":"portrait"===i?"portrait":t>o?"landscape":"portrait",margins:{top:bv(iv(a,"top"),96),right:bv(iv(a,"right"),96),bottom:bv(iv(a,"bottom"),96),left:bv(iv(a,"left"),96),header:bv(iv(a,"header"),48),footer:bv(iv(a,"footer"),48),gutter:bv(iv(a,"gutter"),0)},...n?{columns:n}:{}}}const o=e=>{const a={};for(const n of av(t,$m,e)){const t=iv(n,"type")??"default";if("default"!==t&&"first"!==t&&"even"!==t)continue;const e=n.getAttribute("r:id")??n.getAttributeNS("http://schemas.openxmlformats.org/officeDocument/2006/relationships","id")??null;e&&(a[t]=e)}return a},i=o("headerReference"),l=o("footerReference"),s=ov(t,$m,"docGrid"),d=iv(s,"type"),c=bv(iv(s,"linePitch"),Number.NaN);return{pageSettings:r,headerRIds:i,footerRIds:l,docGridLinePitchPx:Number.isFinite(c)&&c>0?c:void 0,docGridMode:"lines"===d||"linesAndChars"===d?"explicit":void 0,docGridType:d}}function Kv(t){if(!t)return;const e=ov(t,$m,"sectPr");if(!e)return;const a=ov(e,$m,"pgSz"),n=ov(e,$m,"pgMar"),r=Gv(e);if(!a&&!n&&!r)return;const o=bv(iv(a,"w"),816),i=bv(iv(a,"h"),1056),l=iv(a,"orient");return{width:o,height:i,orientation:"landscape"===l?"landscape":"portrait"===l?"portrait":o>i?"landscape":"portrait",margins:{top:bv(iv(n,"top"),96),right:bv(iv(n,"right"),96),bottom:bv(iv(n,"bottom"),96),left:bv(iv(n,"left"),96),header:bv(iv(n,"header"),48),footer:bv(iv(n,"footer"),48),gutter:bv(iv(n,"gutter"),0)},...r?{columns:r}:{}}}function Dv(t,e,a,n,r){var o,i,l;if(e&&a)for(const s of t){if("paragraph"===s.type){const t=(null==(o=s.style)?void 0:o.styleId)&&/heading/i.test(s.style.styleId);void 0!==(null==(i=s.style)?void 0:i.lineHeight)||!1===(null==(l=s.style)?void 0:l.snapToGrid)||t||(s.style={...s.style??{},lineGridPitch:e,lineGridType:n});continue}if(r.adjustLineHeightInTable)for(const t of s.rows)for(const o of t.cells)Dv(o.blocks,e,a,n,r)}}const jv=9525,Xv=96/72;function Jv(t){const e=Yv(t);return void 0===e?void 0:Math.round(e/jv)}function Yv(t){if(null==t||""===t)return;const e=parseInt(t,10);return Number.isFinite(e)?e:void 0}function Qv(t){const e=null==t?void 0:t.trim();if(!e)return null;const a=e.match(/^(-?\d+(?:\.\d+)?)(pt|px|in|cm|mm|pc)?$/i);if(!a)return null;const n=Number(a[1]);if(!Number.isFinite(n)||n<=0)return null;switch((a[2]??"px").toLowerCase()){case"pt":return Math.round(n*Xv);case"in":return Math.round(96*n);case"cm":return Math.round(n/2.54*96);case"mm":return Math.round(n/25.4*96);case"pc":return Math.round(12*n*Xv);default:return Math.round(n)}}function _v(t){const e=null==t?void 0:t.trim();if(e&&/^[0-9a-fA-F]{6}$/.test(e))return`#${e.toUpperCase()}`}const $v={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",tif:"image/tiff",tiff:"image/tiff",svg:"image/svg+xml",emf:"image/x-emf",wmf:"image/x-wmf"},tb={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/bmp":"bmp","image/tiff":"tif","image/svg+xml":"svg","image/x-emf":"emf","image/x-wmf":"wmf"};function eb(t){return tb[t.toLowerCase()]??null}async function ab(t,e,a){let n=a;n.startsWith("/")&&(n=n.slice(1)),n.startsWith("word/")||(n="word/"+a);const r=t.file(n),o=function(t){var e;const a=null==(e=t.split(".").pop())?void 0:e.toLowerCase();return a?$v[a]??null:null}(a)??"image/png",i=await(null==r?void 0:r.async("base64"));if(i)return function(t,e,a){const n=t.byPath.get(e);if(n)return`${ce}${n}`;const r=`img-${t.nextId}`;return t.nextId+=1,t.assets[r]={id:r,url:a},t.byPath.set(e,r),`${ce}${r}`}(e,n,`data:${o};base64,${i}`)}function nb(t){return"1"===t||"true"===t||"0"!==t&&"false"!==t&&void 0}function rb(t,e){var a,n,r,o;const i=lv(t,e);if(!i)return;const l=null==(n=null==(a=lv(i,"align"))?void 0:a.textContent)?void 0:n.trim(),s=ob(null==(o=null==(r=lv(i,"posOffset"))?void 0:r.textContent)?void 0:o.trim()),d={relativeFrom:i.getAttribute("relativeFrom")??void 0,...l?{align:l}:{},...void 0!==s?{offset:s}:{}};return void 0!==d.relativeFrom||void 0!==d.align||void 0!==d.offset?d:void 0}function ob(t){if(null==t||""===t)return;const e=parseInt(t,10);return Number.isFinite(e)?e:void 0}function ib(t){const e=rb(t,"positionH"),a=rb(t,"positionV"),n=function(t){return lv(t,"wrapSquare")?"square":lv(t,"wrapTight")?"tight":lv(t,"wrapThrough")?"through":lv(t,"wrapTopAndBottom")?"topAndBottom":lv(t,"wrapNone")?"none":void 0}(t),r=ob(t.getAttribute("distT")),o=ob(t.getAttribute("distB")),i=ob(t.getAttribute("distL")),l=ob(t.getAttribute("distR")),s=nb(t.getAttribute("simplePos")),d=ob(t.getAttribute("relativeHeight")),c=nb(t.getAttribute("behindDoc")),h=nb(t.getAttribute("locked")),p=nb(t.getAttribute("layoutInCell")),u=nb(t.getAttribute("allowOverlap"));return{type:"floating",...void 0!==r?{distT:r}:{},...void 0!==o?{distB:o}:{},...void 0!==i?{distL:i}:{},...void 0!==l?{distR:l}:{},...void 0!==s?{simplePos:s}:{},...void 0!==d?{relativeHeight:d}:{},...void 0!==c?{behindDoc:c}:{},...void 0!==h?{locked:h}:{},...void 0!==p?{layoutInCell:p}:{},...void 0!==u?{allowOverlap:u}:{},...e?{positionH:e}:{},...a?{positionV:a}:{},...n?{wrap:n}:{}}}async function lb(t,e,a,n){const r=lv(t,"blip");if(!r)return{text:"",image:void 0};const{embed:o,link:i}=function(t){const e={};for(let a=0;a<t.attributes.length;a+=1){const n=t.attributes[a];n&&("embed"===n.localName||"r:embed"===n.name?e.embed=n.value:"link"!==n.localName&&"r:link"!==n.name||(e.link=n.value))}return e}(r),l=function(t){for(let e=0;e<t.childNodes.length;e+=1){const a=t.childNodes[e];if((null==a?void 0:a.nodeType)!==a.ELEMENT_NODE)continue;const n=a;if("inline"===n.localName||"anchor"===n.localName)return{element:n,kind:n.localName}}}(t),s=(null==l?void 0:l.element)??t,d=lv(s,"extent"),c=lv(s,"docPr");let h=300,p=300;if(d){const t=d.getAttribute("cx"),e=d.getAttribute("cy");t&&(h=Math.round(parseInt(t,10)/jv)),e&&(p=Math.round(parseInt(e,10)/jv))}const u=c?iv(c,"descr")??iv(c,"title"):null,f=function(t){const e=lv(t,"srcRect");if(!e)return;const a=t=>{const a=e.getAttribute(t);if(null===a||""===a)return;const n=parseInt(a,10);return Number.isFinite(n)&&0!==n?n/1e5:void 0},n={left:a("l"),top:a("t"),right:a("r"),bottom:a("b")};return void 0!==n.left||void 0!==n.top||void 0!==n.right||void 0!==n.bottom?n:void 0}(t),g=function(t){if(lv(t,"tile"))return"tile"}(t),m=function(t){const e=lv(t,"xfrm");if(!e)return{};const a={},n=e.getAttribute("rot");if(n){const t=parseInt(n,10);Number.isFinite(t)&&0!==t&&(a.rotation=t/6e4)}const r=e.getAttribute("flipH");"1"!==r&&"true"!==r||(a.flipH=!0);const o=e.getAttribute("flipV");return"1"!==o&&"true"!==o||(a.flipV=!0),a}(t),v="anchor"===(null==l?void 0:l.kind)?ib(l.element):void 0,b="anchor"===(null==l?void 0:l.kind)?function(t){const e=lv(t,"wrapPolygon");if(!e)return;const a=[];for(let n=0;n<e.childNodes.length;n+=1){const t=e.childNodes[n];if(1!==(null==t?void 0:t.nodeType))continue;const r=t;if("start"!==r.localName&&"lineTo"!==r.localName)continue;const o=ob(r.getAttribute("x")),i=ob(r.getAttribute("y"));void 0!==o&&void 0!==i&&a.push({x:o/21600,y:i/21600})}if(a.length>=2){const t=a[0],e=a[a.length-1];Math.abs(t.x-e.x)<1e-6&&Math.abs(t.y-e.y)<1e-6&&a.pop()}return a.length>=3?a:void 0}(l.element):void 0,y={width:h,height:p,...null!==u?{alt:u}:{},...f?{crop:f}:{},...g?{fillMode:g}:{},...void 0!==m.rotation?{rotation:m.rotation}:{},...m.flipH?{flipH:!0}:{},...m.flipV?{flipV:!0}:{},...v?{floating:v}:{},...b?{wrapPolygon:b}:{}},M=o?a.get(o):void 0,x=i?a.get(i):void 0;if(x&&function(t){return/^[a-z][a-z0-9+.-]*:\/\//i.test(t)||t.startsWith("//")}(x))return{text:"",image:{src:"",linkedSrc:x,...y}};const w=M??x;if(w){const t=await ab(e,n,w);if(t)return{text:"",image:{src:t,...y}}}return{text:"",image:void 0}}function sb(t){const e=null==t?void 0:t.trim();if(!e)return;if(e.endsWith("%")){const t=Number(e.slice(0,-1));return Number.isFinite(t)&&0!==t?t/100:void 0}if(/f$/i.test(e)){const t=Number(e.slice(0,-1));return Number.isFinite(t)&&0!==t?t/65536:void 0}const a=Number(e);return Number.isFinite(a)&&0!==a?a/65536:void 0}async function db(t,e,a,n){const r=lv(t,"imagedata");if(!r)return;const o=function(t){for(let e=0;e<t.attributes.length;e+=1){const a=t.attributes[e];if(a&&("id"===a.localName||"r:id"===a.name))return a.value}}(r),i=o?a.get(o):void 0;if(!i)return;const l=lv(t,"shape"),s=function(t){const e={};if(!t)return e;for(const a of t.split(";")){const t=a.indexOf(":");if(t<0)continue;const n=a.slice(0,t).trim().toLowerCase(),r=a.slice(t+1).trim();if("width"===n){const t=Qv(r);null!==t&&(e.width=t)}else if("height"===n){const t=Qv(r);null!==t&&(e.height=t)}}return e}(null==l?void 0:l.getAttribute("style")),d=function(t){const e={left:sb(iv(t,"cropleft")),top:sb(iv(t,"croptop")),right:sb(iv(t,"cropright")),bottom:sb(iv(t,"cropbottom"))};if(void 0!==e.left||void 0!==e.top||void 0!==e.right||void 0!==e.bottom)return e}(r),c=iv(r,"title")??r.getAttribute("o:title"),h=await ab(e,n,i);return h?{src:h,width:s.width??300,height:s.height??300,...c?{alt:c}:{},...d?{crop:d}:{}}:void 0}function cb(t){return"1"===t||"true"===t||"0"!==t&&"false"!==t&&void 0}function hb(t,e){var a,n,r,o;const i=lv(t,e);if(!i)return;const l=null==(n=null==(a=lv(i,"align"))?void 0:a.textContent)?void 0:n.trim(),s=Yv(null==(o=null==(r=lv(i,"posOffset"))?void 0:r.textContent)?void 0:o.trim()),d={relativeFrom:i.getAttribute("relativeFrom")??void 0,...l?{align:l}:{},...void 0!==s?{offset:s}:{}};return void 0!==d.relativeFrom||void 0!==d.align||void 0!==d.offset?d:void 0}function pb(t){const e=hb(t,"positionH"),a=hb(t,"positionV"),n=function(t){return lv(t,"wrapSquare")?"square":lv(t,"wrapTight")?"tight":lv(t,"wrapThrough")?"through":lv(t,"wrapTopAndBottom")?"topAndBottom":lv(t,"wrapNone")?"none":void 0}(t),r=Yv(t.getAttribute("distT")),o=Yv(t.getAttribute("distB")),i=Yv(t.getAttribute("distL")),l=Yv(t.getAttribute("distR")),s=cb(t.getAttribute("simplePos")),d=Yv(t.getAttribute("relativeHeight")),c=cb(t.getAttribute("behindDoc")),h=cb(t.getAttribute("locked")),p=cb(t.getAttribute("layoutInCell")),u=cb(t.getAttribute("allowOverlap"));return{type:"floating",...void 0!==r?{distT:r}:{},...void 0!==o?{distB:o}:{},...void 0!==i?{distL:i}:{},...void 0!==l?{distR:l}:{},...void 0!==s?{simplePos:s}:{},...void 0!==d?{relativeHeight:d}:{},...void 0!==c?{behindDoc:c}:{},...void 0!==h?{locked:h}:{},...void 0!==p?{layoutInCell:p}:{},...void 0!==u?{allowOverlap:u}:{},...e?{positionH:e}:{},...a?{positionV:a}:{},...n?{wrap:n}:{}}}async function ub(t,e){const a=lv(t,"wsp");if(!a)return;const n=function(t){for(let e=0;e<t.childNodes.length;e+=1){const a=t.childNodes[e];if((null==a?void 0:a.nodeType)!==a.ELEMENT_NODE)continue;const n=a;if("inline"===n.localName||"anchor"===n.localName)return{element:n,kind:n.localName}}}(t),r=(null==n?void 0:n.element)??t,o=lv(r,"extent"),i=Jv(null==o?void 0:o.getAttribute("cx"))??300,l=Jv(null==o?void 0:o.getAttribute("cy"))??300,s=lv(r,"docPr"),d=s?iv(s,"name"):null,c=s?iv(s,"descr")??iv(s,"title"):null,h="anchor"===(null==n?void 0:n.kind)?pb(n.element):void 0,p=lv(a,"txbxContent"),u=p&&e?await e(p):[],f=function(t){var e,a;const n=lv(t,"spPr");if(!n)return;const r={},o=lv(n,"prstGeom"),i=null==o?void 0:o.getAttribute("prst");i&&(r.preset=i);for(let l=0;l<n.childNodes.length;l+=1){const t=n.childNodes[l];if((null==t?void 0:t.nodeType)!==t.ELEMENT_NODE)continue;const o=t;if("solidFill"===o.localName){const t=_v(null==(e=lv(o,"srgbClr"))?void 0:e.getAttribute("val"));t&&(r.fill=t)}else if("ln"===o.localName){const t=Yv(o.getAttribute("w"));void 0!==t&&(r.borderWidthPt=Math.round(t/12700*100)/100);const e=_v(null==(a=lv(o,"srgbClr"))?void 0:a.getAttribute("val"));e&&(r.borderColor=e)}}return Object.keys(r).length>0?r:void 0}(a),g=function(t){const e=lv(t,"bodyPr");if(!e)return;const a={},n=Jv(e.getAttribute("lIns")),r=Jv(e.getAttribute("tIns")),o=Jv(e.getAttribute("rIns")),i=Jv(e.getAttribute("bIns"));void 0!==n&&(a.paddingLeft=n),void 0!==r&&(a.paddingTop=r),void 0!==o&&(a.paddingRight=o),void 0!==i&&(a.paddingBottom=i);const l=e.getAttribute("anchor");l&&(a.anchor=l);const s=e.getAttribute("wrap");s&&(a.wrap=s);const d=e.getAttribute("vert");return"vert"!==d&&"vert270"!==d&&"wordArtVert"!==d||(a.vert=d),lv(e,"spAutoFit")&&(a.autoFit=!0),Object.keys(a).length>0?a:void 0}(a),m=function(t){const e=lv(t,"spPr");if(!e)return;const a=lv(e,"xfrm"),n=Yv(null==a?void 0:a.getAttribute("rot"));return void 0!==n&&0!==n&&(Math.round(n/6e4)%360+360)%360||void 0}(a);return{width:i,height:l,blocks:u,...h?{floating:h}:{},...void 0!==m?{rotation:m}:{},...d?{name:d}:{},...c?{alt:c}:{},...f?{shape:f}:{},...g?{body:g}:{}}}function fb(t){let e;for(let a=0;a<t.childNodes.length;a+=1){const n=t.childNodes[a];if((null==n?void 0:n.nodeType)!==n.ELEMENT_NODE)continue;const r=n;if("Choice"!==r.localName)continue;const o=lv(r,"drawing");if(!o)continue;void 0===e&&(e=o);const i=r.getAttribute("Requires")??"";if(/\bwps\b/.test(i))return o}return e}function gb(t){const e=iv(t,"id");if(!e)return;if("bookmarkEnd"===t.localName)return{kind:"end",docxId:e};const a=iv(t,"name")??void 0,n=iv(t,"colFirst"),r=iv(t,"colLast"),o=null!==n?Number.parseInt(n,10):void 0,i=null!==r?Number.parseInt(r,10):void 0;return{kind:"start",docxId:e,...void 0!==a?{name:a}:{},...void 0===o||Number.isNaN(o)?{}:{colFirst:o},...void 0===i||Number.isNaN(i)?{}:{colLast:i}}}function mb(t){const e=iv(t,"id");if(e)return{kind:"commentRangeEnd"===t.localName?"end":"start",docxId:e}}async function vb(t,e,a,n,r){const o=[];let i,l,s,d=0;const c=[],h=[],p=t=>{o.push(t),d+=t.length},u=t.childNodes;for(let f=0;f<u.length;f+=1){const t=u[f];if((null==t?void 0:t.nodeType)!==t.ELEMENT_NODE)continue;const o=t;if(o.namespaceURI===$m)if("t"===o.localName)p(o.textContent??"");else if("tab"===o.localName)p("\t");else if("noBreakHyphen"===o.localName)p("‑");else if("softHyphen"===o.localName)p("");else if("br"===o.localName)p("page"===iv(o,"type")?"\f":"\n");else{if("lastRenderedPageBreak"===o.localName)continue;if("bookmarkStart"===o.localName||"bookmarkEnd"===o.localName){const t=gb(o);t&&c.push({offset:d,marker:t});continue}if("commentRangeStart"===o.localName||"commentRangeEnd"===o.localName){const t=mb(o);t&&h.push({offset:d,marker:t});continue}if("proofErr"===o.localName||"commentReference"===o.localName||"permStart"===o.localName||"permEnd"===o.localName)continue;if("cr"===o.localName)p("\n");else if("drawing"===o.localName){const t=await lb(o,e,a,n);if(t.image)p(t.text),i=t.image;else{const t=await ub(o,r);t&&(p(""),l=t)}}else if("pict"===o.localName){const t=await db(o,e,a,n);t&&(p(""),i=t)}else if("sym"===o.localName){const t=iv(o,"font")??"",e=iv(o,"char")??"",a=parseInt(e,16);p(Number.isFinite(a)&&a>0?String.fromCodePoint(a):"?"),s={font:t,char:e}}}else if("AlternateContent"===o.localName){const t=fb(o);if(t){const e=await ub(t,r);e&&(p(""),l=e)}}}return{text:o.join(""),image:i,...l?{textBox:l}:{},...c.length>0?{innerBookmarks:c}:{},...h.length>0?{innerComments:h}:{},...s?{sym:s}:{}}}async function bb(t,e,a,n,r,o,i,l){var s,d,c;const h=[],p=[],u=(t,e)=>{const a=iv(t,"fldCharType"),n=iv(t,"fldLock"),r=iv(t,"dirty"),o="true"===n||"1"===n,i="true"===r||"1"===r;if("begin"===a)h.push({text:"",fieldChar:{kind:"begin",...o?{fieldLock:!0}:{},...i?{dirty:!0}:{}},...e?{styles:e}:{}}),p.push({beginIndex:h.length-1,instruction:"",...e?{beginStyles:e}:{}});else if("separate"===a)h.push({text:"",fieldChar:{kind:"separate"},...e?{styles:e}:{}});else if("end"===a){h.push({text:"",fieldChar:{kind:"end"},...e?{styles:e}:{}});const t=p.pop();t&&(t=>{var e;const a=/\bNUMPAGES\b/i.test(t.instruction)?"NUMPAGES":/\bPAGE\b/i.test(t.instruction)?"PAGE":null;if(!a)return;const n=h.slice(t.beginIndex);if(n.some(t=>t.bookmark))return;const r=n.filter(t=>!t.fieldChar&&void 0===t.fieldInstruction),o=r.map(t=>t.text).join("")||"1",i=(null==(e=r.find(t=>t.styles))?void 0:e.styles)??t.beginStyles;h.length=t.beginIndex,h.push({text:o,...i?{styles:i}:{},field:{type:a}})})(t)}},f=(t,e)=>{const a=t.textContent??"";h.push({text:"",fieldInstruction:a,...e?{styles:e}:{}});const n=p[p.length-1];n&&(n.instruction+=a)};for(let g=0;g<t.childNodes.length;g+=1){const p=t.childNodes[g];if((null==p?void 0:p.nodeType)!==p.ELEMENT_NODE)continue;const m=p;if(m.namespaceURI===$m){if("bookmarkStart"===m.localName||"bookmarkEnd"===m.localName){const t=gb(m);if(!t)continue;h.push({text:"",bookmark:t});continue}if("commentRangeStart"===m.localName||"commentRangeEnd"===m.localName){const t=mb(m);if(!t)continue;h.push({text:"",comment:t});continue}if("r"===m.localName){const t=qv(ov(m,$m,"rPr"),o);if(av(m,$m,"fldChar").length>0||av(m,$m,"instrText").length>0){for(let e=0;e<m.childNodes.length;e+=1){const a=m.childNodes[e];if((null==a?void 0:a.nodeType)!==a.ELEMENT_NODE)continue;const n=a;n.namespaceURI===$m&&("fldChar"===n.localName?u(n,t):"instrText"===n.localName&&f(n,t))}continue}const e=ov(m,$m,"footnoteReference");if(e){const a=iv(e,"id");if(!a)continue;const n=iv(e,"customMarkFollows");let r=t;(s=r??(r={})).styleId??(s.styleId="footnoteReference"),void 0===r.superscript&&(r.superscript=!0),h.push({text:"?",styles:r,footnoteReference:{docxId:a,...n?{customMark:n}:{}}});continue}const c=ov(m,$m,"endnoteReference");if(c){const e=iv(c,"id");if(!e)continue;const a=iv(c,"customMarkFollows");let n=t;(d=n??(n={})).styleId??(d.styleId="endnoteReference"),void 0===n.superscript&&(n.superscript=!0),h.push({text:"?",styles:n,endnoteReference:{docxId:e,...a?{customMark:a}:{}}});continue}const{text:p,image:g,textBox:v,innerBookmarks:b,innerComments:y,sym:M}=await vb(m,a,n,r,l);let x=t;M&&!(null==x?void 0:x.fontFamily)&&((x??(x={})).fontFamily=M.font),i&&((x??(x={})).link=i);const w=[...(b??[]).map(t=>({offset:t.offset,run:{text:"",bookmark:t.marker}})),...(y??[]).map(t=>({offset:t.offset,run:{text:"",comment:t.marker}}))];if(w.length>0&&!g&&!v){w.sort((t,e)=>t.offset-e.offset);let t=0;for(const a of w){const e=p.slice(t,a.offset);e.length>0&&h.push({text:e,...x?{styles:x}:{}}),h.push(a.run),t=a.offset}const e=p.slice(t);e.length>0&&h.push({text:e,...x?{styles:x}:{}});continue}if(0===p.length&&!g&&!v)continue;if(h.push({text:p,...g?{image:g}:{},...v?{textBox:v}:{},...M?{sym:M}:{},...x?{styles:x}:{}}),b)for(const a of b)h.push({text:"",bookmark:a.marker});continue}if("fldSimple"===m.localName){const t=m.getAttribute("w:instr")??m.getAttributeNS($m,"instr")??m.getAttribute("instr")??"",s=/\bNUMPAGES\b/i.test(t)?"NUMPAGES":/\bPAGE\b/i.test(t)?"PAGE":null,d=await bb(m,e,a,n,r,o,i,l);if(s){const t=d.map(t=>t.text).join("")||"1",e=null==(c=d.find(t=>t.styles))?void 0:c.styles;h.push({text:t,styles:e,field:{type:s}})}else h.push({text:"",fieldChar:{kind:"begin"}}),h.push({text:"",fieldInstruction:t}),h.push({text:"",fieldChar:{kind:"separate"}}),h.push(...d),h.push({text:"",fieldChar:{kind:"end"}});continue}if("hyperlink"===m.localName){let t=n.get(m.getAttribute("r:id")??m.getAttributeNS("http://schemas.openxmlformats.org/officeDocument/2006/relationships","id")??"")??null;if(!t){const e=iv(m,"anchor");e&&(t=`#${e}`)}h.push(...await bb(m,e,a,n,r,o,t,l))}}}return h}function yb(t){if(!t)return;const e=iv(t,"type"),a=iv(t,"w");if("auto"===e)return"auto";if("pct"===e){if(!a)return;const t=a.trim().endsWith("%")?Number.parseFloat(a):Number(a)/50;return Number.isFinite(t)?Math.round(1e4*t)/1e4+"%":void 0}return yv(a)}function Mb(t,e){const a=iv(ov(t,$m,e),"val"),n=a?Number(a):Number.NaN;return Number.isFinite(n)&&n>0?Math.floor(n):void 0}function xb(t,e){if(!t)return;const a=new Set(e),n=new Qm,r=[],o=t.childNodes;for(let i=0;i<o.length;i+=1){const t=o[i];(null==t?void 0:t.nodeType)===t.ELEMENT_NODE&&t.namespaceURI===$m&&a.has(t.localName??"")&&r.push(n.serializeToString(t))}return r.length>0?r:void 0}function wb(t){if(!t)return;const e=e=>yv(iv(ov(t,$m,e),"w")),a={},n=e("top"),r=e("right"),o=e("bottom"),i=e("left"),l=e("start"),s=e("end");return void 0!==n&&(a.top=n),void 0!==r&&(a.right=r),void 0!==o&&(a.bottom=o),void 0!==i&&(a.left=i),void 0!==l&&(a.start=l),void 0!==s&&(a.end=s),Object.keys(a).length>0?a:void 0}function Sb(t,e){const a={};e&&(a.styleId=e);const n=iv(ov(t,$m,"tblCaption"),"val");n&&(a.altTitle=n);const r=iv(ov(t,$m,"tblDescription"),"val");r&&(a.altDescription=r);const o=yb(ov(t,$m,"tblW"));void 0!==o&&(a.width=o);const i=yb(ov(t,$m,"tblInd"));void 0!==i&&(a.indentLeft=i);const l=iv(ov(t,$m,"jc"),"val");"left"!==l&&"center"!==l&&"right"!==l||(a.align=l);const s=function(t){const e=iv(ov(t,$m,"tblLayout"),"type");return"fixed"===e||"autofit"===e?e:void 0}(t);s&&(a.layout=s);const d=yb(ov(t,$m,"tblCellSpacing"));void 0!==d&&(a.cellSpacing=d);const c=wb(ov(t,$m,"tblCellMar"));c&&(a.defaultCellMargins=c);const h=t?dv(t,"bidiVisual"):void 0;void 0!==h&&(a.bidiVisual=h);const p=iv(ov(t,$m,"tblOverlap"),"val");p&&(a.tblOverlap=p);const u=function(t){const e=ov(t,$m,"tblpPr");if(!e||!e.attributes||0===e.attributes.length)return;const a={};for(let n=0;n<e.attributes.length;n+=1){const t=e.attributes.item(n);(null==t?void 0:t.namespaceURI)!==$m&&"w"!==(null==t?void 0:t.prefix)||(a[t.localName||t.name.replace(/^w:/,"")]=t.value)}return Object.keys(a).length>0?a:void 0}(t);u&&(a.floating=u);const f=xb(t,["tblPrChange"]);return f&&(a.revisionXml=f),Rv(a)}function Ab(t){if(!t)return;const e={},a=Mb(t,"gridBefore");void 0!==a&&(e.gridBefore=a);const n=Mb(t,"gridAfter");void 0!==n&&(e.gridAfter=n);const r=yb(ov(t,$m,"wBefore"));void 0!==r&&(e.widthBefore=r);const o=yb(ov(t,$m,"wAfter"));void 0!==o&&(e.widthAfter=o);const i=ov(t,$m,"trHeight"),l=yv(iv(i,"val"));void 0!==l&&(e.height=l);const s=iv(i,"hRule");"auto"!==s&&"exact"!==s&&"atLeast"!==s||(e.heightRule=s);const d=yb(ov(t,$m,"tblCellSpacing"));void 0!==d&&(e.cellSpacing=d);const c=dv(t,"cantSplit");void 0!==c&&(e.cantSplit=c);const h=dv(t,"hidden");void 0!==h&&(e.hidden=h);const p=xb(t,["trPrChange","ins","del"]);return p&&(e.revisionXml=p),Rv(e)}function Ib(t){if(!t)return 1;const e=iv(ov(t,$m,"gridSpan"),"val"),a=e?Number(e):1;return Number.isFinite(a)&&a>1?Math.floor(a):1}function Tb(t){if(!t)return;const e=ov(t,$m,"vMerge");if(!e)return;return"restart"===iv(e,"val")?"restart":"continue"}function Cb(t,e){if(!t){if(!e)return;return Rv({paddingTop:e.top,paddingRight:e.right,paddingBottom:e.bottom,paddingLeft:e.left,paddingStart:e.start,paddingEnd:e.end})}const a={...void 0!==(null==e?void 0:e.top)?{paddingTop:e.top}:{},...void 0!==(null==e?void 0:e.right)?{paddingRight:e.right}:{},...void 0!==(null==e?void 0:e.bottom)?{paddingBottom:e.bottom}:{},...void 0!==(null==e?void 0:e.left)?{paddingLeft:e.left}:{},...void 0!==(null==e?void 0:e.start)?{paddingStart:e.start}:{},...void 0!==(null==e?void 0:e.end)?{paddingEnd:e.end}:{}},n=zv(ov(t,$m,"shd"));n&&(a.shading=n);const r=ov(t,$m,"tcW"),o=iv(r,"type"),i=iv(r,"w");if("dxa"===o){const t=yv(i);void 0!==t&&(a.width=t)}else if("pct"===o&&i){const t=Number(i);Number.isFinite(t)&&(a.width=Math.round(t/50*1e4)/1e4+"%")}const l=wb(ov(t,$m,"tcMar"));l&&(void 0!==l.top&&(a.paddingTop=l.top),void 0!==l.bottom&&(a.paddingBottom=l.bottom),void 0!==l.left&&(a.paddingLeft=l.left),void 0!==l.right&&(a.paddingRight=l.right),void 0!==l.start&&(a.paddingStart=l.start),void 0!==l.end&&(a.paddingEnd=l.end));const s=function(t){if(!t)return;const e=iv(ov(t,$m,"vAlign"),"val");return"top"===e||"bottom"===e?e:"center"===e?"middle":void 0}(t);s&&(a.verticalAlign=s);const d=rv(iv(ov(t,$m,"textDirection"),"val"));d&&(a.textDirection=d);const c=dv(t,"noWrap");void 0!==c&&(a.noWrap=c);const h=dv(t,"tcFitText");void 0!==h&&(a.fitText=h);const p=dv(t,"hideMark");void 0!==p&&(a.hideMark=p);const u=iv(ov(t,$m,"headers"),"val");u&&(a.headers=u);const f=xb(t,["tcPrChange","cellIns","cellDel","cellMerge"]);f&&(a.revisionXml=f);for(const[g,m]of Object.entries(function(t){return t?Pv(ov(t,$m,"tcBorders")):{}}(t)))m&&(a[g]=m);return Rv(a)}function kb(t){const e=ov(t,$m,"trPr");return!!e&&!0===dv(e,"tblHeader")}function Vb(t,e){var a,n;const r=t=>t.style??(t.style={}),o=t.length-1;for(let i=0;i<t.length;i+=1){const a=e[i];a&&(0===i&&a.before&&(r(t[i]).spacingBefore=0),i===o&&a.after&&(r(t[i]).spacingAfter=0))}for(let i=0;i<o;i+=1){if(!(null==(a=e[i])?void 0:a.after)||!(null==(n=e[i+1])?void 0:n.before))continue;const o=r(t[i]),l=r(t[i+1]);(o.spacingAfter??0)>=(l.spacingBefore??0)?l.spacingBefore=0:o.spacingAfter=0}}function Eb(t,e,a,n,r,o,i){const l=r.firstRow&&0===t,s=r.lastRow&&t===a-1&&0!==t,d=r.firstCol&&0===e,c=r.lastCol&&e===n-1&&0!==e,h=[];if(!r.noHBand&&!l&&!s){const e=t-(r.firstRow?1:0),a=Math.floor(e/Math.max(1,o))%2;h.push(0===a?"band1Horz":"band2Horz")}if(!r.noVBand&&!d&&!c){const t=e-(r.firstCol?1:0),a=Math.floor(t/Math.max(1,i))%2;h.push(0===a?"band1Vert":"band2Vert")}return c&&h.push("lastCol"),d&&h.push("firstCol"),s&&h.push("lastRow"),l&&h.push("firstRow"),l&&d&&h.push("nwCell"),l&&c&&h.push("neCell"),s&&d&&h.push("swCell"),s&&c&&h.push("seCell"),h}function Rb(t,e){const a={};if(!e)return a;for(const n of t){const t=e[n];t&&(t.shading&&(a.shading=t.shading),t.textStyle&&(a.textStyle={...a.textStyle,...t.textStyle}),t.borders&&(a.borders={...a.borders,...t.borders}),t.paragraphStyle&&(a.paragraphStyle={...a.paragraphStyle,...t.paragraphStyle}),t.rowStyle&&(a.rowStyle={...a.rowStyle,...t.rowStyle}))}return a}function Lb(t,e){if(e&&0!==Object.keys(e).length)for(const a of t)for(const t of a.runs)t.styles={...e,...t.styles}}async function zb(t,e,a,n,r,o,i){var l,s;const d=[],c=ov(t,$m,"tblGrid");if(c)for(const V of av(c,$m,"gridCol")){const t=yv(iv(V,"w"));void 0!==t&&d.push(t)}const h=ov(c,$m,"tblGridChange"),p=ov(t,$m,"tblPr"),u=iv(ov(p,$m,"tblStyle"),"val"),f=u&&(null==(l=null==i?void 0:i[u])?void 0:l.paragraphStyle)?i[u].paragraphStyle:void 0,g=(m=ov(p,$m,"tblBorders"))?{...Pv(m),borderInsideH:Ov(ov(m,$m,"insideH")),borderInsideV:Ov(ov(m,$m,"insideV"))}:{};var m;const v=u?null==(s=null==i?void 0:i[u])?void 0:s.tableStyle:void 0,b=Sb(p,u??void 0),y=null==b?void 0:b.defaultCellMargins,M=(null==v?void 0:v.conditionalFormats)??void 0,x=function(t){const e=ov(t,$m,"tblLook"),a=t=>{const a=iv(e,t);return null===a||""===a?void 0:sv(a)},n=iv(e,"val"),r=n?Number.parseInt(n,16):Number.NaN,o=t=>Number.isFinite(r)?0!==(r&t):void 0;return{firstRow:a("firstRow")??o(32)??!0,lastRow:a("lastRow")??o(64)??!1,firstCol:a("firstColumn")??o(128)??!0,lastCol:a("lastColumn")??o(256)??!1,noHBand:a("noHBand")??o(512)??!1,noVBand:a("noVBand")??o(1024)??!1}}(p),w=(null==v?void 0:v.rowBandSize)??1,S=(null==v?void 0:v.colBandSize)??1,A=av(t,$m,"tr"),I=A.length,T=d.length>0?d.length:A.reduce((t,e)=>Math.max(t,av(e,$m,"tc").length),0),C=[];for(let V=0;V<A.length;V+=1){const t=A[V],i=ov(t,$m,"trPr"),l=ov(i,$m,"cnfStyle"),s=[];"1"===iv(l,"firstRow")&&s.push("firstRow"),"1"===iv(l,"lastRow")&&s.push("lastRow");const d=av(t,$m,"tc"),c=[];for(let g=0;g<d.length;g+=1){const t=d[g],i=[],l=[],h=ov(t,$m,"tcPr");for(const s of av(t,$m,"p"))i.push(await Pb(s,e,a,n,r,o,f)),l.push(Hv(ov(s,$m,"pPr")));Vb(i,l);const p=Ib(h),u=Tb(h),m=Cb(h,y),v=Rb([...Eb(V,g,I,T,x,w,S),...s],M);if(Lb(i,v.textStyle),v.paragraphStyle){const t=v.paragraphStyle;for(const e of i)e.style={...t,...e.style}}const b=Ma(i.length>0?i:[ya([{text:""}])],p,"restart"===u?{rowSpan:1,vMerge:u}:u?{vMerge:u}:void 0),A={...m??{}},C=(null==m?void 0:m.shading)??v.shading;if(C&&(A.shading=C),v.borders)for(const e of["borderTop","borderRight","borderBottom","borderLeft"]){const t=v.borders[e];void 0===A[e]&&t&&(A[e]=t)}Object.keys(A).length>0&&(b.style=A),"continue"===u&&(b.blocks=[]),c.push(b)}const h=xa(c,kb(t)?{isHeader:!0}:void 0),p=Ab(i);if(p&&(h.style=p),M){const t=Eb(V,0,I,Math.max(1,T),x,w,S).filter(t=>"firstRow"===t||"lastRow"===t||"band1Horz"===t||"band2Horz"===t),e=Rb([...s,...t],M);e.rowStyle&&(h.style={...e.rowStyle,...h.style})}const u=ov(t,$m,"tblPrEx");u&&(h.tblPrExXml=(new Qm).serializeToString(u)),C.push(h)}!function(t,e){if(0===Object.keys(e).length)return;const a=t.length-1;for(let n=0;n<=a;n+=1){const r=t[n],o=r.cells.length-1;for(let t=0;t<=o;t+=1){const i=r.cells[t],l=i.style??{};0===n&&void 0===l.borderTop&&e.borderTop&&(l.borderTop=e.borderTop),n===a&&void 0===l.borderBottom&&e.borderBottom&&(l.borderBottom=e.borderBottom),0===t&&void 0===l.borderLeft&&e.borderLeft&&(l.borderLeft=e.borderLeft),t===o&&void 0===l.borderRight&&e.borderRight&&(l.borderRight=e.borderRight),n<a&&void 0===l.borderBottom&&e.borderInsideH&&(l.borderBottom=e.borderInsideH),t<o&&void 0===l.borderRight&&e.borderInsideV&&(l.borderRight=e.borderInsideV),Object.keys(l).length>0&&i.style!==l&&(i.style=l)}}}(C,g);for(let V=0;V<C.length;V+=1){const t=C[V];for(let e=0;e<t.cells.length;e+=1){const a=t.cells[e];if("restart"!==a.vMerge)continue;let n=1;for(let t=V+1;t<C.length;t+=1){const a=C[t].cells[e];if(!a||"continue"!==a.vMerge)break;n+=1}n>1&&(a.rowSpan=n)}}const k=wa(C,d.length>0?d:void 0);return b&&(k.style=b),k.style?k.style.tblLook=x:u&&(k.style={tblLook:x}),h&&(k.tblGridChangeXml=(new Qm).serializeToString(h)),k}function Nb(t,e,a,n){var r;const o=ya(t.length>0?t.map(t=>({text:t.text,styles:t.styles,image:t.image})):[{text:"",styles:n}]);t.forEach((t,e)=>{t.field&&(o.runs[e].field={...t.field}),t.fieldChar&&(o.runs[e].fieldChar={...t.fieldChar}),void 0!==t.fieldInstruction&&(o.runs[e].fieldInstruction=t.fieldInstruction),t.textBox&&(o.runs[e].textBox=t.textBox),t.footnoteReference&&(o.runs[e].__importedFootnoteRef={...t.footnoteReference}),t.endnoteReference&&(o.runs[e].__importedEndnoteRef={...t.endnoteReference}),t.bookmark&&(o.runs[e].__importedBookmark={...t.bookmark}),t.comment&&(o.runs[e].__importedComment={...t.comment}),t.sym&&(o.runs[e].sym={...t.sym})}),o.style=e?{...e}:void 0;for(const i of o.runs)i.styles=Nv(i.styles,null==(r=o.style)?void 0:r.styleId);return o.list=a?{...a}:void 0,o}function qb(t){return t.some(t=>t.image||t.textBox||t.field||t.fieldChar||void 0!==t.fieldInstruction||t.bookmark||t.comment||t.text.replace(/\s/g,"").length>0)}async function Ob(t,e,a,n,r,o,i){const l=ov(t,$m,"pPr"),s=await bb(t,e,a,n,r,o,void 0,t=>async function(t,e,a,n,r,o){const i=[];for(let l=0;l<t.childNodes.length;l+=1){const s=t.childNodes[l];if((null==s?void 0:s.nodeType)!==s.ELEMENT_NODE)continue;const d=s;if(d.namespaceURI===$m)if("p"===d.localName){const t=await Ob(d,e,a,n,r,o);for(const e of t.paragraphs)i.push(e)}else"tbl"===d.localName&&i.push(await zb(d,e,a,n,r,o))}return i}(t,e,a,n,r,o)),d=Wv(Uv(l)),c=qv(ov(l,$m,"rPr"),o),h=function(t,e){if(!t)return;const a=ov(t,$m,"numPr");if(!a)return;const n=iv(ov(a,$m,"numId"),"val");if(!n)return;const r=iv(ov(a,$m,"ilvl"),"val")??"0",o=Number(r),i=e.numToAbstractId.get(n),l=i?`${i}:${r}`:void 0,s=l?e.abstractIndents.get(l):void 0,d=(l?e.abstractSuffixes.get(l):void 0)??"tab",c=l?e.abstractFormats.get(l):void 0,h=l?e.abstractBulletGlyphs.get(l):void 0,p=l?e.abstractBulletFonts.get(l):void 0,u=`${n}:${r}`,f=!e.seenInstances.has(u);let g;if(e.seenInstances.add(u),f){const t=e.numStartOverrides.get(u),a=l?e.abstractStarts.get(l):void 0,n=t??a??1;1!==n&&(g=n)}return{list:{kind:e.numKinds.get(n)??"ordered",level:Number.isFinite(o)?o:0,suffix:d,...void 0!==c&&{format:c},...void 0!==g&&{startAt:g},...void 0!==h&&{bulletGlyph:h},...void 0!==p&&{bulletFont:p}},indent:s}}(l,e),p=null==h?void 0:h.list;let u=d;if(null==h?void 0:h.indent){const{left:t,hanging:e}=h.indent,a=d??{};u={...a,...void 0===a.indentLeft&&void 0!==t?{indentLeft:t}:{},...void 0===a.indentHanging&&void 0!==e?{indentHanging:e}:{}}}const f=function(t){if(!t)return;const e=qe(t,Ia),a=qe(void 0,Ia);return Ev({styleId:t.styleId,align:e.align!==a.align?e.align:void 0,spacingBefore:e.spacingBefore!==a.spacingBefore?e.spacingBefore:void 0,spacingAfter:e.spacingAfter!==a.spacingAfter?e.spacingAfter:void 0,contextualSpacing:void 0!==t.contextualSpacing||e.contextualSpacing!==a.contextualSpacing?e.contextualSpacing:void 0,lineHeight:e.lineHeight!==a.lineHeight?e.lineHeight:void 0,lineRule:e.lineRule??void 0,lineGridPitch:t.lineGridPitch??void 0,snapToGrid:void 0!==t.snapToGrid||e.snapToGrid!==a.snapToGrid?e.snapToGrid:void 0,indentLeft:void 0!==t.indentLeft||e.indentLeft!==a.indentLeft?e.indentLeft:void 0,indentRight:void 0!==t.indentRight||e.indentRight!==a.indentRight?e.indentRight:void 0,indentFirstLine:void 0!==t.indentFirstLine||e.indentFirstLine!==a.indentFirstLine?e.indentFirstLine:void 0,indentHanging:void 0!==t.indentHanging||e.indentHanging!==a.indentHanging?e.indentHanging:void 0,pageBreakBefore:void 0!==t.pageBreakBefore||e.pageBreakBefore!==a.pageBreakBefore?e.pageBreakBefore:void 0,keepWithNext:void 0!==t.keepWithNext||e.keepWithNext!==a.keepWithNext?e.keepWithNext:void 0,keepLinesTogether:void 0!==t.keepLinesTogether||e.keepLinesTogether!==a.keepLinesTogether?e.keepLinesTogether:void 0,widowControl:void 0!==t.widowControl||e.widowControl!==a.widowControl?e.widowControl:void 0,shading:t.shading??void 0,borderTop:t.borderTop??void 0,borderRight:t.borderRight??void 0,borderBottom:t.borderBottom??void 0,borderLeft:t.borderLeft??void 0,tabs:t.tabs??void 0,textDirection:t.textDirection??void 0,outlineLevel:t.outlineLevel??void 0})}(i?{...i,...u??{}}:u),g=function(t,e){var a;const n=ov(t,$m,"framePr");if(!n)return null;const r=iv(n,"dropCap");if(!r||"none"===r)return null;const o=e.map(t=>t.text).join("");if(0===o.length)return null;const i=Number(iv(n,"lines"));return{text:o,lines:Number.isFinite(i)&&i>0?i:3,type:"margin"===r?"margin":"drop",style:null==(a=e[0])?void 0:a.styles}}(l,s);if(g)return{paragraphs:[],pageBreakAfter:!1,dropCapFrame:g};const{segments:m,hasPageBreak:v}=function(t){const e=[[]];let a=!1;const n=(t,a)=>{(0!==a.length||t.image||t.textBox||t.field||t.fieldChar||void 0!==t.fieldInstruction||t.bookmark||t.comment)&&e[e.length-1].push({...t,text:a})};for(const r of t){if(!r.text.includes("\f")){n(r,r.text);continue}const t=r.text.split("\f");t.forEach((o,i)=>{n(r,o),i<t.length-1&&(a=!0,e.push([]))})}return{segments:e,hasPageBreak:a}}(s);if(!v)return{paragraphs:[Nb(s,f,p,c)],pageBreakAfter:!1};const b=[];let y=!1;for(let M=0;M<m.length;M+=1){const t=m[M];if(M>0&&(y=!0),!qb(t))continue;const e=y?{...f??{},pageBreakBefore:!0}:f;b.push(Nb(t,e,p,c)),y=!1}return{paragraphs:b,pageBreakAfter:y}}async function Pb(t,e,a,n,r,o,i){return(await Ob(t,e,a,n,r,o,i)).paragraphs[0]??ya([{text:""}])}async function Wb(t,e,a,n,r,o,i){if(!t)return[];const l=(new _m).parseFromString(t,"application/xml").documentElement;if(!l)return[];const s=[];for(let d=0;d<l.childNodes.length;d+=1){const t=l.childNodes[d];if((null==t?void 0:t.nodeType)!==t.ELEMENT_NODE)continue;const c=t;"p"===c.localName&&c.namespaceURI===$m?s.push(await Pb(c,e,a,n,r,o)):"tbl"===c.localName&&c.namespaceURI===$m&&s.push(await zb(c,e,a,n,r,o,i))}return s}const Hb=new Set(["separator","continuationSeparator","continuationNotice"]);const Ub=new Set(["separator","continuationSeparator","continuationNotice"]);const Fb=new Set(["_GoBack"]);function Bb(t,e,a){if("paragraph"===t.type){let n=0;const r=[];for(const o of t.runs){const i=o.__importedBookmark;i?(e.push({marker:i,anchor:{paragraphId:t.id,offset:n,seq:a.value}}),a.value+=1):(n+=o.text.length,r.push(o))}return void(r.length!==t.runs.length&&(t.runs=r.length>0?r:[ma("")]))}for(const n of t.rows)for(const t of n.cells)for(const n of t.blocks)Bb(n,e,a)}function Gb(t){var e;const a=[],n={value:0},r=t=>{null==t||t.forEach(t=>Bb(t,a,n))};for(const c of t)r(c.blocks),r(c.header),r(c.firstPageHeader),r(c.evenPageHeader),r(c.footer),r(c.firstPageFooter),r(c.evenPageFooter);if(0===a.length)return;const o=new Map,i=new Map;for(const c of a){const t="start"===c.marker.kind?o:i,e=t.get(c.marker.docxId);e?e.push(c):t.set(c.marker.docxId,[c])}const l={},s=[],d=a.filter(t=>"start"===t.marker.kind);for(const c of d){const{marker:t,anchor:a}=c,n=t.name;if(!n||Fb.has(n))continue;const r=Number.parseInt(t.docxId,10),o=null==(e=i.get(t.docxId))?void 0:e.shift(),d=fa(),h={id:d,name:n,start:a};n.startsWith("_")&&(h.hidden=!0),Number.isNaN(r)||(h.docxIdHint=r),void 0!==t.colFirst&&(h.colFirst=t.colFirst),void 0!==t.colLast&&(h.colLast=t.colLast),o&&(h.end=o.anchor),l[d]=h,s.push(d)}return 0!==s.length?{items:l,order:s}:void 0}function Zb(t,e,a){if("paragraph"===t.type){let n=0;const r=[];for(const o of t.runs){const i=o.__importedComment;i?(e.push({marker:i,anchor:{paragraphId:t.id,offset:n,seq:a.value}}),a.value+=1):(n+=o.text.length,r.push(o))}return void(r.length!==t.runs.length&&(t.runs=r.length>0?r:[ma("")]))}for(const n of t.rows)for(const t of n.cells)for(const n of t.blocks)Zb(n,e,a)}function Kb(t){const e=[],a={value:0},n=t=>{null==t||t.forEach(t=>Zb(t,e,a))};for(const o of t)n(o.blocks),n(o.header),n(o.firstPageHeader),n(o.evenPageHeader),n(o.footer),n(o.firstPageFooter),n(o.evenPageFooter);const r=new Map;for(const{marker:o,anchor:i}of e){const t=r.get(o.docxId)??{};"start"===o.kind?t.start=i:t.end=i,r.set(o.docxId,t)}return r}const Db="http://schemas.microsoft.com/office/word/2012/wordml";function jb(t){let e="";for(let a=0;a<t.childNodes.length;a+=1){const n=t.childNodes[a];if((null==n?void 0:n.nodeType)!==n.ELEMENT_NODE)continue;const r=n;if(r.namespaceURI===$m){if("t"===r.localName){e+=r.textContent??"";continue}if("tab"===r.localName){e+="\t";continue}if("br"===r.localName||"cr"===r.localName){e+="\n";continue}}e+=jb(r)}return e}function Xb(t){if(!t)return;const e=Date.parse(t);return Number.isNaN(e)?void 0:e}function Jb(t,e){const a=new Map;if(!t)return a;const n=(new _m).parseFromString(t,"application/xml").documentElement;if(!n)return a;const r=function(t){const e=new Map;if(!t)return e;const a=(new _m).parseFromString(t,"application/xml").documentElement;if(!a)return e;for(const n of av(a,Db,"commentEx")){const t=n.getAttributeNS(Db,"paraId");if(!t)continue;const a=n.getAttributeNS(Db,"done");e.set(t,"1"===a||"true"===a)}return e}(e);for(const o of av(n,$m,"comment")){const t=iv(o,"id");if(null===t)continue;const e=iv(o,"author")??"",n=iv(o,"initials")??void 0,i=Xb(iv(o,"date")),l=av(o,$m,"p"),s=l.map(t=>jb(t)).join("\n").trim(),d=l.length>0?iv(l[0],"paraId")??void 0:void 0,c=void 0!==d?r.get(d):void 0;a.set(t,{author:e,...n?{initials:n}:{},...void 0!==i?{date:i}:{},text:s,...c?{resolved:c}:{},...d?{paraId:d}:{}})}return a}async function Yb(t,e={}){var a,n,r,o,i,l,s,d,c,h,p,u,f;null==(a=e.onProgress)||a.call(e,"opening-docx");const g=await Qp.loadAsync(t),m=await(null==(n=g.file("word/document.xml"))?void 0:n.async("string"));if(!m)throw new Error("Missing word/document.xml");const v=pv(await(null==(r=g.file("word/_rels/document.xml.rels"))?void 0:r.async("string"))),b=function(t){const e=new Map,a=new Map,n=new Map,r=new Map,o=new Map,i=new Map,l=new Map,s=new Map,d=new Map,c=new Map,h=new Set,p=()=>({abstractKinds:e,numKinds:a,abstractIndents:n,abstractSuffixes:r,abstractFormats:o,abstractStarts:i,abstractBulletGlyphs:l,abstractBulletFonts:s,numStartOverrides:d,numToAbstractId:c,seenInstances:h});if(!t)return p();const u=(new _m).parseFromString(t,"application/xml").documentElement;if(!u)return p();const f=u.getElementsByTagNameNS($m,"abstractNum");for(let m=0;m<f.length;m+=1){const t=f[m],a=iv(t,"abstractNumId");if(a)for(const d of av(t,$m,"lvl")){const t=iv(d,"ilvl")??"0",c=`${a}:${t}`,h=iv(ov(d,$m,"numFmt"),"val");if(h){e.set(c,"bullet"===h?"bullet":"ordered"),"0"===t&&e.set(a,"bullet"===h?"bullet":"ordered");const n=Vv[h];n&&o.set(c,n)}const p=iv(ov(d,$m,"suff"),"val");"space"!==p&&"nothing"!==p&&"tab"!==p||r.set(c,p);const u=iv(ov(d,$m,"start"),"val");if(null!=u){const t=parseInt(u,10);isNaN(t)||i.set(c,t)}if("bullet"===h){const t=iv(ov(d,$m,"lvlText"),"val");t&&l.set(c,t)}const f=ov(d,$m,"rPr"),g=ov(f,$m,"rFonts"),m=iv(g,"ascii")??iv(g,"hAnsi");m&&s.set(c,m);const v=ov(d,$m,"pPr"),b=ov(v,$m,"ind");if(b){const t=iv(b,"left")??iv(b,"start"),e=iv(b,"hanging"),a=null!=t?bv(t,0):void 0,r=null!=e?bv(e,0):void 0;void 0===a&&void 0===r||n.set(c,{left:a,hanging:r})}}}const g=u.getElementsByTagNameNS($m,"num");for(let m=0;m<g.length;m+=1){const t=g[m],n=iv(t,"numId"),r=iv(ov(t,$m,"abstractNumId"),"val");if(n&&r){c.set(n,r),a.set(n,e.get(r)??"ordered");for(const e of av(t,$m,"lvlOverride")){const t=iv(e,"ilvl");if(!t)continue;const a=iv(ov(e,$m,"startOverride"),"val");if(null!=a){const e=parseInt(a,10);isNaN(e)||d.set(`${n}:${t}`,e)}}}}return{abstractKinds:e,numKinds:a,abstractIndents:n,abstractSuffixes:r,abstractFormats:o,abstractStarts:i,abstractBulletGlyphs:l,abstractBulletFonts:s,numStartOverrides:d,numToAbstractId:c,seenInstances:h}}(await(null==(o=g.file("word/numbering.xml"))?void 0:o.async("string"))??null),y=function(t){const e={adjustLineHeightInTable:!0};if(!t)return e;const a=(new _m).parseFromString(t,"application/xml"),n=yv(iv(ov(a.documentElement,$m,"defaultTabStop"),"val"));void 0!==n&&(e.defaultTabStop=n),e.footnoteSettings=kv(ov(a.documentElement,$m,"footnotePr")),e.endnoteSettings=kv(ov(a.documentElement,$m,"endnotePr"));const r=ov(a.documentElement,$m,"compat");if(r){const t=ov(r,$m,"adjustLineHeightInTable");if(t){const a=iv(t,"val");e.adjustLineHeightInTable="0"!==a&&"false"!==a}}return e}(await(null==(i=g.file("word/settings.xml"))?void 0:i.async("string"))??null),M=await(null==(l=g.file("word/styles.xml"))?void 0:l.async("string"))??null,x=function(t){if(!t)return{fonts:{},colors:{}};const e=(new _m).parseFromString(t,"application/xml").documentElement,a=e?av(e,tv,"themeElements")[0]??null:null;return{fonts:vv(a),colors:Sv(a)}}(await(null==(s=g.file("word/theme/theme1.xml"))?void 0:s.async("string"))??null),w=function(t,e){if(!t)return;const a=(new _m).parseFromString(t,"application/xml").documentElement;if(!a)return;const n=ov(a,$m,"docDefaults"),r=ov(ov(n,$m,"pPrDefault"),$m,"pPr"),o=ov(ov(n,$m,"rPrDefault"),$m,"rPr"),i=r?{spacingBefore:0,spacingAfter:0,...Wv(Uv(r))}:Wv(Uv(r)),l=qv(o,e),s={};let d;for(const c of av(a,$m,"style")){const t=iv(c,"styleId"),a=iv(c,"type");if(!t||"paragraph"!==a&&"character"!==a&&"table"!==a)continue;const n=iv(ov(c,$m,"name"),"val")??t,r=iv(ov(c,$m,"basedOn"),"val")??void 0,o=iv(ov(c,$m,"next"),"val")??void 0,h=Wv(Uv(ov(c,$m,"pPr"))),p=qv(ov(c,$m,"rPr"),e);let u;if("table"===a){const a=ov(c,$m,"tblPr"),n=yv(iv(ov(a,$m,"tblInd"),"w")),r=t=>{const e=iv(ov(a,$m,t),"val"),n=e?Number(e):Number.NaN;return Number.isFinite(n)&&n>0?Math.floor(n):void 0},o=r("tblStyleRowBandSize"),i=r("tblStyleColBandSize"),l={};for(const t of av(c,$m,"tblStylePr")){const a=iv(t,"type");if(!a)continue;const n=ov(t,$m,"tcPr"),r=zv(ov(n,$m,"shd")),o=qv(ov(t,$m,"rPr"),e),i=Rv(Pv(ov(n,$m,"tcBorders"))),s=Uv(ov(t,$m,"pPr")),d=Fv(ov(t,$m,"trPr"));(r||o||i||s||d)&&(l[a]={...r?{shading:r}:{},...o?{textStyle:o}:{},...i?{borders:i}:{},...s?{paragraphStyle:s}:{},...d?{rowStyle:d}:{}})}u={styleId:t,indentLeft:n,...void 0!==o?{rowBandSize:o}:{},...void 0!==i?{colBandSize:i}:{},...Object.keys(l).length>0?{conditionalFormats:l}:{}}}const f="paragraph"===a&&sv(iv(c,"default"));f&&(d=t),s[t]={id:t,name:n,type:a,basedOn:r,nextStyle:o,paragraphStyle:"paragraph"===a&&f?Lv(i,h):h,textStyle:"paragraph"===a&&f?Lv(l,p):p,tableStyle:u}}return d&&s[d]?s:((i||l)&&(s.Normal={id:"Normal",name:"Normal",type:"paragraph",paragraphStyle:i,textStyle:l}),Rv(s))}(M,x);null==(d=e.onProgress)||d.call(e,"parsing-document");const S=(new _m).parseFromString(m,"application/xml").getElementsByTagNameNS($m,"body")[0];if(!S)return Ta([ya([{text:""}])]);const A={assets:{},byPath:new Map,nextId:1},I=[],T=[[]];let C=!1,k=null;const V=t=>{C&&(t.style={...t.style??{},pageBreakBefore:!0},C=!1),k&&"paragraph"===t.type&&(t.dropCap=k,k=null),T[T.length-1].push(t)};let E=0;for(let $=0;$<S.childNodes.length;$+=1){const t=S.childNodes[$];if((null==t?void 0:t.nodeType)===t.ELEMENT_NODE){const e=t;e.namespaceURI===$m&&"sectPr"!==e.localName&&(E+=1)}}let R=0;const L=()=>{var t;R+=1,E>0&&(null==(t=e.onProgress)||t.call(e,"parsing-document",R/E))};for(let $=0;$<S.childNodes.length;$+=1){const t=S.childNodes[$];if((null==t?void 0:t.nodeType)!==t.ELEMENT_NODE)continue;const e=t;if(e.namespaceURI===$m){if("sectPr"===e.localName)I.push(Zv(e)),T.push([]),C=!1;else if("p"===e.localName){const t=await Ob(e,b,g,v,A,x);for(const e of t.paragraphs)V(e);t.dropCapFrame&&(k=t.dropCapFrame),t.pageBreakAfter&&(C=!0),L()}else"tbl"===e.localName&&(V(await zb(e,b,g,v,A,x,w)),L());await hv(50,R)}}if(0===I.length){const t=ov(S,$m,"sectPr");I.push(t?Zv(t):{pageSettings:Kv(S),headerRIds:{},footerRIds:{}})}null==(c=e.onProgress)||c.call(e,"parsing-headers-footers");const z=[],N=t=>Object.keys(t.headerRIds).length>0||Object.keys(t.footerRIds).length>0,q=I.filter(N).length;let O=0;const P=()=>{var t;O+=1,q>0&&(null==(t=e.onProgress)||t.call(e,"parsing-headers-footers",O/q))};for(let $=0;$<I.length;$+=1){const t=I[$],e=T[$]??[];Dv(e,t.docGridLinePitchPx,t.docGridMode,t.docGridType,y);const a=async e=>{var a;if(!e)return[];const n=v.get(e);if(!n)return[];let r=n.startsWith("/")?n.slice(1):n;r.startsWith("word/")||(r=`word/${n}`);const o=await(null==(a=g.file(r))?void 0:a.async("string")),i=await uv(g,r),l=await Wb(o??null,b,g,i,A,x,w);return Dv(l,t.docGridLinePitchPx,t.docGridMode,t.docGridType,y),l},n=await a(t.headerRIds.default),r=await a(t.headerRIds.first),o=await a(t.headerRIds.even),i=await a(t.footerRIds.default),l=await a(t.footerRIds.first),s=await a(t.footerRIds.even);N(t)&&P(),await hv(2,O);const d=ge(t.pageSettings??{width:816,height:1056,orientation:"portrait",margins:{top:96,right:96,bottom:96,left:96,header:48,footer:48,gutter:0}});z.push({id:`section:${$+1}`,blocks:e.length>0?e:[ya([{text:""}])],pageSettings:d,header:n.length>0?n:void 0,firstPageHeader:r.length>0?r:void 0,evenPageHeader:o.length>0?o:void 0,footer:i.length>0?i:void 0,firstPageFooter:l.length>0?l:void 0,evenPageFooter:s.length>0?s:void 0})}const W=await(null==(h=g.file("word/footnotes.xml"))?void 0:h.async("string"))??null,H=W?await uv(g,"word/footnotes.xml"):new Map,U=await async function(t,e,a,n,r,o,i){const l={byDocxId:new Map,footnotes:{items:{}}};if(!t)return l;const s=(new _m).parseFromString(t,"application/xml").documentElement;if(!s)return l;const d={},c=new Map;let h,p;const u=av(s,$m,"footnote");let f=0;for(const g of u){const t=iv(g,"id")??"",l=iv(g,"type")??"",s=[];for(let d=0;d<g.childNodes.length;d+=1){const t=g.childNodes[d];if((null==t?void 0:t.nodeType)!==t.ELEMENT_NODE)continue;const l=t;l.namespaceURI===$m&&("p"===l.localName?s.push(await Pb(l,e,a,n,r,o)):"tbl"===l.localName&&s.push(await zb(l,e,a,n,r,o,i)))}if(Hb.has(l)){"separator"===l?h=s:"continuationSeparator"===l&&(p=s);continue}if(("-1"===t||"0"===t)&&0===s.length)continue;f+=1;const u=`footnote:imported:${f}`,m=Number.parseInt(t,10),v={id:u,blocks:s.length>0?s:[],docxId:Number.isFinite(m)?m:void 0};d[u]=v,t&&c.set(t,v)}return{byDocxId:c,footnotes:{items:d,separator:h,continuationSeparator:p},separator:h,continuationSeparator:p}}(W,b,g,H,A,x,w);y.footnoteSettings&&(U.footnotes.settings=y.footnoteSettings);const F=Object.keys(U.footnotes.items).length>0||U.footnotes.separator||U.footnotes.continuationSeparator||U.footnotes.settings?U.footnotes:void 0;!function(t,e){var a,n,r,o,i,l;const s=t=>{if("paragraph"!==t.type)for(const e of t.rows)for(const t of e.cells)for(const e of t.blocks)s(e);else for(const a of t.runs){const t=a,n=t.__importedFootnoteRef;if(!n)continue;delete t.__importedFootnoteRef;const r=e.get(n.docxId);r&&(a.footnoteReference={footnoteId:r.id,...n.customMark?{customMark:n.customMark}:{}})}};for(const d of t)d.blocks.forEach(s),null==(a=d.header)||a.forEach(s),null==(n=d.firstPageHeader)||n.forEach(s),null==(r=d.evenPageHeader)||r.forEach(s),null==(o=d.footer)||o.forEach(s),null==(i=d.firstPageFooter)||i.forEach(s),null==(l=d.evenPageFooter)||l.forEach(s)}(z,U.byDocxId);const B=await(null==(p=g.file("word/endnotes.xml"))?void 0:p.async("string"))??null,G=B?await uv(g,"word/endnotes.xml"):new Map,Z=await async function(t,e,a,n,r,o,i){const l={byDocxId:new Map,endnotes:{items:{}}};if(!t)return l;const s=(new _m).parseFromString(t,"application/xml").documentElement;if(!s)return l;const d={},c=new Map;let h,p;const u=av(s,$m,"endnote");let f=0;for(const g of u){const t=iv(g,"id")??"",l=iv(g,"type")??"",s=[];for(let d=0;d<g.childNodes.length;d+=1){const t=g.childNodes[d];if((null==t?void 0:t.nodeType)!==t.ELEMENT_NODE)continue;const l=t;l.namespaceURI===$m&&("p"===l.localName?s.push(await Pb(l,e,a,n,r,o)):"tbl"===l.localName&&s.push(await zb(l,e,a,n,r,o,i)))}if(Ub.has(l)){"separator"===l?h=s:"continuationSeparator"===l&&(p=s);continue}if(("-1"===t||"0"===t)&&0===s.length)continue;f+=1;const u=`endnote:imported:${f}`,m=Number.parseInt(t,10),v={id:u,blocks:s.length>0?s:[],docxId:Number.isFinite(m)?m:void 0};d[u]=v,t&&c.set(t,v)}return{byDocxId:c,endnotes:{items:d,separator:h,continuationSeparator:p},separator:h,continuationSeparator:p}}(B,b,g,G,A,x,w);y.endnoteSettings&&(Z.endnotes.settings=y.endnoteSettings);const K=Object.keys(Z.endnotes.items).length>0||Z.endnotes.separator||Z.endnotes.continuationSeparator||Z.endnotes.settings?Z.endnotes:void 0;!function(t,e){var a,n,r,o,i,l;const s=t=>{if("paragraph"!==t.type)for(const e of t.rows)for(const t of e.cells)for(const e of t.blocks)s(e);else for(const a of t.runs){const t=a,n=t.__importedEndnoteRef;if(!n)continue;delete t.__importedEndnoteRef;const r=e.get(n.docxId);r&&(a.endnoteReference={endnoteId:r.id,...n.customMark?{customMark:n.customMark}:{}})}};for(const d of t)d.blocks.forEach(s),null==(a=d.header)||a.forEach(s),null==(n=d.firstPageHeader)||n.forEach(s),null==(r=d.evenPageHeader)||r.forEach(s),null==(o=d.footer)||o.forEach(s),null==(i=d.firstPageFooter)||i.forEach(s),null==(l=d.evenPageFooter)||l.forEach(s)}(z,Z.byDocxId);const D=Gb(z),j=function(t,e){const a=new Set([...t.keys(),...e.keys()]);if(0===a.size)return;const n=[...a].sort((t,e)=>{const a=Number.parseInt(t,10),n=Number.parseInt(e,10);return Number.isNaN(a)||Number.isNaN(n)?t.localeCompare(e):a-n}),r={},o=[];for(const i of n){const a=t.get(i),n=e.get(i);if(!a&&!n)continue;const l=ga(),s=Number.parseInt(i,10);r[l]={id:l,author:(null==n?void 0:n.author)??"",...(null==n?void 0:n.initials)?{initials:n.initials}:{},...void 0!==(null==n?void 0:n.date)?{date:n.date}:{},...(null==n?void 0:n.resolved)?{resolved:n.resolved}:{},text:(null==n?void 0:n.text)??"",...(null==a?void 0:a.start)?{start:a.start}:{},...(null==a?void 0:a.end)?{end:a.end}:{},...Number.isNaN(s)?{}:{docxIdHint:s}},o.push(l)}return o.length>0?{items:r,order:o}:void 0}(Kb(z),Jb(await(null==(u=g.file("word/comments.xml"))?void 0:u.async("string"))??null,await(null==(f=g.file("word/commentsExtended.xml"))?void 0:f.async("string"))??null)),X=z.length>1||z.some(t=>{var e,a,n,r,o,i;return((null==(e=t.header)?void 0:e.length)??0)>0||((null==(a=t.firstPageHeader)?void 0:a.length)??0)>0||((null==(n=t.evenPageHeader)?void 0:n.length)??0)>0||((null==(r=t.footer)?void 0:r.length)??0)>0||((null==(o=t.firstPageFooter)?void 0:o.length)??0)>0||((null==(i=t.evenPageFooter)?void 0:i.length)??0)>0}),J=Object.keys(A.assets).length>0,Y=t=>{void 0!==y.defaultTabStop&&(t.settings={...t.settings??{},defaultTabStop:y.defaultTabStop});let e=t;return F&&(e.footnotes=F,e=Jl(e)),K&&(e.endnotes=K,e=function(t){var e,a;const n=t.endnotes;if(!n||0===Object.keys(n.items).length)return t;const r=(null==(e=n.settings)?void 0:e.numberFormat)??"decimal",o=(null==(a=n.settings)?void 0:a.startAt)??1,i=new Set,l=new Map;let s=o-1;for(const{run:u}of Ql(t)){const t=u.endnoteReference;t&&(i.add(t.endnoteId),t.customMark?l.set(t.endnoteId,t.customMark):l.has(t.endnoteId)||(s+=1,l.set(t.endnoteId,jl(s,r))))}let d=!1;const c=Pe(t).map(t=>{const e=t=>{if(!t)return t;let e=!1;const a=t.map(t=>{if("paragraph"===t.type){const a=_l(t,l);return a!==t&&(e=!0),a}let a=!1;const n=t.rows.map(t=>{let e=!1;const n=t.cells.map(t=>{let a=!1;const n=t.blocks.map(t=>{const e=_l(t,l);return e!==t&&(a=!0),e});return a?(e=!0,{...t,blocks:n}):t});return e?(a=!0,{...t,cells:n}):t});return a?(e=!0,{...t,rows:n}):t});return e?(d=!0,a):t};return{...t,blocks:e(t.blocks)??t.blocks,header:e(t.header),firstPageHeader:e(t.firstPageHeader),evenPageHeader:e(t.evenPageHeader),footer:e(t.footer),firstPageFooter:e(t.firstPageFooter),evenPageFooter:e(t.evenPageFooter)}}),h={};let p=!1;for(const[u,f]of Object.entries(n.items))i.has(u)?h[u]=f:p=!0;return d||p?{...t,sections:d?c:t.sections,endnotes:{...n,items:p?h:n.items}}:t}(e)),D&&(e.bookmarks=D),j&&(e.comments=j),e};if(X){const t=Ta([]);return t.sections=z,1===z.length&&(t.pageSettings=z[0].pageSettings),w&&(t.styles=w),J&&(t.assets=A.assets),Y(t)}const Q=z[0],_=Ta((null==Q?void 0:Q.blocks.length)>0?Q.blocks:[ya([{text:""}])],null==Q?void 0:Q.pageSettings);return J&&(_.assets=A.assets),w&&(_.styles=w),Y(_)}let Qb=1;function _b(t,e={}){if("undefined"==typeof Worker||"undefined"==typeof URL)return Yb(t,e);const a=Qb;return Qb+=1,new Promise((r,o)=>{const i=new Worker(new URL(""+("undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__dirname+"/assets/importDocxWorker-DcrboJNQ.js").href:new URL("assets/importDocxWorker-DcrboJNQ.js","undefined"==typeof document?location.href:document.currentScript&&"SCRIPT"===document.currentScript.tagName.toUpperCase()&&document.currentScript.src||document.baseURI).href),"undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:n&&"SCRIPT"===n.tagName.toUpperCase()&&n.src||new URL("oasis-editor.umd.cjs",document.baseURI).href),{type:"module"}),l=()=>{i.removeEventListener("message",d),i.removeEventListener("error",s),i.terminate()},s=t=>{l(),o(t.error instanceof Error?t.error:new Error(t.message))},d=t=>{var n;const i=t.data;i&&i.id===a&&("progress"!==i.type?(l(),"done"===i.type?r(i.document):o(new Error(i.error))):null==(n=e.onProgress)||n.call(e,i.stage,i.progress))};i.addEventListener("message",d),i.addEventListener("error",s),i.postMessage({type:"import-docx",id:a,buffer:t},[t])})}const $b={"opening-docx":"opening","parsing-document":"parsing","parsing-headers-footers":"finishing"};function ty(t){const e={},a=t.style;return function(t,e){switch(t.tagName){case"B":case"STRONG":e.bold=!0;break;case"I":case"EM":case"CITE":case"VAR":e.italic=!0;break;case"U":case"INS":e.underline=!0;break;case"S":case"STRIKE":case"DEL":e.strike=!0}}(t,e),function(t,e){const a=t.fontFamily.trim();a&&(e.fontFamily=a);const n=t.fontSize.trim();if(n.endsWith("px")){const t=Number.parseFloat(n);Number.isFinite(t)&&(e.fontSize=t)}const r=t.color.trim();r&&(e.color=r);const o=t.backgroundColor.trim();o&&(e.highlight=o)}(a,e),function(t,e){const a=t.getAttribute("data-oasis-lang-value")??t.getAttribute("lang"),n=t.getAttribute("data-oasis-lang-east-asia"),r=t.getAttribute("data-oasis-lang-bidi");(a||n||r)&&(e.language={},a&&(e.language.value=a),n&&(e.language.eastAsia=n),r&&(e.language.bidi=r))}(t,e),function(t,e){var a,n;const r=t.textDecoration.toLowerCase();if(r.includes("underline")){e.underline=!0;switch(null==(a=t.textDecorationStyle)?void 0:a.toLowerCase()){case"double":e.underlineStyle="double";break;case"dotted":e.underlineStyle="dotted";break;case"dashed":e.underlineStyle="dash";break;case"wavy":e.underlineStyle="wave"}}r.includes("line-through")&&(e.strike=!0);const o=null==(n=t.textDecorationColor)?void 0:n.trim();o&&(e.underlineColor=o)}(a,e),function(t,e){const a=t.fontWeight.trim();("bold"===a||Number.parseInt(a,10)>=600)&&(e.bold=!0);const n=t.fontStyle.trim();"italic"===n&&(e.italic=!0);"none"===t.display.trim().toLowerCase()&&(e.hidden=!0);"uppercase"===t.textTransform.trim().toLowerCase()&&(e.allCaps=!0);t.fontVariant.trim().toLowerCase().includes("small-caps")&&(e.smallCaps=!0);const r=t.letterSpacing.trim();if(r.endsWith("pt")){const t=Number.parseFloat(r);Number.isFinite(t)&&(e.characterSpacing=t)}const o=t.fontStretch.trim();if(o.endsWith("%")){const t=Number.parseFloat(o);Number.isFinite(t)&&t>0&&(e.characterScale=t)}}(a,e),function(t,e){const a=t.fontVariantLigatures.trim().toLowerCase();"none"===a?e.ligatures="none":a.includes("historical")?e.ligatures="historical":a.includes("common-ligatures")&&a.includes("contextual")?e.ligatures="standardContextual":a.includes("common-ligatures")?e.ligatures="standard":a.includes("contextual")&&(e.ligatures="contextual");const n=t.fontVariantNumeric.trim().toLowerCase();n.includes("proportional-nums")?e.numberSpacing="proportional":n.includes("tabular-nums")&&(e.numberSpacing="tabular");n.includes("lining-nums")?e.numberForm="lining":n.includes("oldstyle-nums")&&(e.numberForm="oldStyle");const r=t.fontFeatureSettings.trim().toLowerCase(),o=r.match(/["']ss(0[1-9]|1[0-9]|20)["']\s+1/);(null==o?void 0:o[1])&&(e.stylisticSet=Number(o[1]));/["']calt["']\s+1/.test(r)&&(e.contextualAlternates=!0)}(a,e),function(t,e,a){"SUP"===t.tagName&&(a.superscript=!0);"SUB"===t.tagName&&(a.subscript=!0);const n=e.verticalAlign.trim();if(n.endsWith("pt")){const t=Number.parseFloat(n);Number.isFinite(t)&&(a.baselineShift=t)}}(t,a,e),function(t,e){var a;const n="A"===t.tagName?(null==(a=t.getAttribute("href"))?void 0:a.trim())??"":"";n&&(e.link=n,e.underline=!0)}(t,e),Object.keys(e).length>0?e:void 0}function ey(t,e){if(t.nodeType===Node.TEXT_NODE){const a=t.textContent??"";return a.length>0?[va(a,e)]:[]}if(t.nodeType!==Node.ELEMENT_NODE)return[];const a=t;if("BR"===a.tagName)return[va("\n",e)];const n=function(t){var e,a,n;if("IMG"!==t.tagName)return;const r=t,o=(null==(e=r.getAttribute("src"))?void 0:e.trim())??"";if(!o)return;const i=(null==(a=r.getAttribute("width"))?void 0:a.trim())??"",l=(null==(n=r.getAttribute("height"))?void 0:n.trim())??"",s=r.style.width.trim(),d=r.style.height.trim(),c=s.endsWith("px")?Number.parseFloat(s):Number.NaN,h=d.endsWith("px")?Number.parseFloat(d):Number.NaN,p=Number.parseFloat(i),u=Number.parseFloat(l),f=Number.isFinite(c)?c:Number.isFinite(p)?p:100,g=Number.isFinite(h)?h:Number.isFinite(u)?u:100,m=r.getAttribute("alt"),v={src:o,width:Math.max(1,Math.round(f)),height:Math.max(1,Math.round(g))};return null!==m&&(v.alt=m),v}(a);if(n)return[va("",e,n)];const r={...e??{},...ty(a)??{}},o=[];for(const i of Array.from(a.childNodes))o.push(...ey(i,r));return o}function ay(t){return"P"===t||"DIV"===t||"LI"===t||/^H[1-6]$/.test(t)}function ny(t){return"UL"===t?"bullet":"OL"===t?"ordered":null}function ry(t){const e=t.style,a={},n=e.textAlign.trim();"left"!==n&&"center"!==n&&"right"!==n&&"justify"!==n||(a.align=n);const r=e.lineHeight.trim();if(r){const t=Number.parseFloat(r);Number.isFinite(t)&&(a.lineHeight=t,r.endsWith("px")&&(a.lineRule="exact"))}const o=e.paddingTop.trim();if(o.endsWith("px")){const t=Number.parseFloat(o);Number.isFinite(t)&&(a.spacingBefore=t)}const i=e.paddingBottom.trim();if(i.endsWith("px")){const t=Number.parseFloat(i);Number.isFinite(t)&&(a.spacingAfter=t)}const l=e.paddingLeft.trim();if(l.endsWith("px")){const t=Number.parseFloat(l);Number.isFinite(t)&&(a.indentLeft=t)}const s=e.paddingRight.trim();if(s.endsWith("px")){const t=Number.parseFloat(s);Number.isFinite(t)&&(a.indentRight=t)}const d=e.textIndent.trim();if(d.endsWith("px")){const t=Number.parseFloat(d);Number.isFinite(t)&&(a.indentFirstLine=t)}return"page"!==e.breakBefore&&"true"!==t.dataset.oasisPageBreakBefore||(a.pageBreakBefore=!0),"true"===t.dataset.oasisKeepWithNext&&(a.keepWithNext=!0),Object.keys(a).length>0?a:void 0}const oy={H1:"heading1",H2:"heading2",H3:"heading3",H4:"heading3",H5:"heading3",H6:"heading3"};function iy(t){return t.map(t=>({text:t.text,styles:t.styles,image:t.image}))}function ly(t,e){const a=ya(iy(ey(t,void 0))),n=ry(t),r=oy[t.tagName];return(n||r)&&(a.style={...r?{styleId:r}:{},...n??{}}),e&&(a.list=e),a}function sy(t,e,a){const n=[];for(const r of Array.from(t.children))if("LI"===r.tagName){n.push(ly(r,{kind:e,level:a}));for(const t of Array.from(r.children)){const e=ny(t.tagName);e&&n.push(...sy(t,e,a+1))}}return n}function dy(t){const e=py(t).filter(t=>"paragraph"===t.type),a=Number.parseInt(t.getAttribute("colspan")??"",10),n=Number.parseInt(t.getAttribute("rowspan")??"",10);return Ma(e.length>0?e:[ba("")],Number.isFinite(a)&&a>1?a:1,Number.isFinite(n)&&n>1?{rowSpan:n}:void 0)}function cy(t){const e=[];let a=!0;for(const n of Array.from(t.children))"TD"!==n.tagName&&"TH"!==n.tagName||(e.push(dy(n)),"TH"!==n.tagName&&(a=!1));return 0===e.length?null:xa(e,a?{isHeader:!0}:void 0)}function hy(t){const e=[],a=Array.from(t.querySelectorAll("tr")).filter(e=>e.closest("table")===t);for(const n of a){const t=cy(n);t&&e.push(t)}return 0===e.length?null:wa(e)}function py(t){const e=[];for(const a of Array.from(t.childNodes)){if(a.nodeType===Node.TEXT_NODE){(a.textContent??"").trim().length>0&&e.push(uy(ey(a,void 0)));continue}if(a.nodeType!==Node.ELEMENT_NODE)continue;const t=a;if("TABLE"===t.tagName){const a=hy(t);a&&e.push(a);continue}const n=ny(t.tagName);if(n){e.push(...sy(t,n,0));continue}if(ay(t.tagName)){e.push(ly(t));continue}if(t.children.length>0){e.push(...py(t));continue}const r=ey(t,void 0);r.length>0&&e.push(uy(r))}return e}function uy(t){return ya(iy(t))}const fy=[{id:"docx",accept:[".docx"],matches(t){return this.accept.includes(Xp(t.name))},import:(t,e)=>_b(t,{onProgress:e?(t,a)=>e($b[t],a):void 0})},{id:"html",accept:[".html",".htm"],matches(t){return this.accept.includes(Xp(t.name))},async import(t,e){null==e||e("opening");const a=function(t){var e;const a=new Uint8Array(t),n=new TextDecoder("utf-8").decode(a.subarray(0,2048)).match(/charset\s*=\s*["']?([\w-]+)/i),r=null==(e=null==n?void 0:n[1])?void 0:e.toLowerCase();if(r&&"utf-8"!==r&&"utf8"!==r)try{return new TextDecoder(r).decode(a)}catch{}return new TextDecoder("utf-8").decode(a)}(t);null==e||e("parsing");const n=function(t){if("undefined"==typeof document)throw new Error("importHtmlToEditorDocument requires a DOM environment");const e=(new DOMParser).parseFromString(t,"text/html"),a=e.body,n=a?py(a):[];0===n.length&&n.push(ba(""));const r=e.title.trim();return Ta(n,void 0,void 0,void 0,r?{title:r}:void 0)}(a);return null==e||e("finishing"),n}}];const gy=["nw","n","ne","e","se","s","sw","w"],my=24;function vy(t,e,a){const n=Math.max(e,t);return void 0===a?n:Math.min(a,n)}function by(t,e){return"x"===e?t.includes("e")?1:t.includes("w")?-1:0:t.includes("s")?1:t.includes("n")?-1:0}var yy=pt("<button aria-hidden=true class=oasis-editor-rotate-handle tabindex=-1 type=button>"),My=pt("<div aria-hidden=true style=transform-origin:center>"),xy=pt("<button aria-hidden=true class=oasis-editor-resize-handle tabindex=-1 type=button>");function wy(t){return(e=My()).$$mousedown=e=>{!t.readOnly&&t.box()&&t.onBodyMouseDown&&(e.preventDefault(),t.onBodyMouseDown(e))},wt(e,Z(et,{get when(){return!t.readOnly},get children(){return[Z($,{each:gy,children:e=>{return(a=xy()).$$mousedown=a=>{t.box()&&t.onResizeStart(e,a)},ft(a,"data-direction",e),a;var a}}),Z(et,{get when(){return t.onRotateStart},get children(){var e=yy();return e.$$mousedown=e=>{var a;t.box()&&(e.preventDefault(),e.stopPropagation(),null==(a=t.onRotateStart)||a.call(t,e))},e}})]}})),M(a=>{var n,r,o,i,l,s=`oasis-editor-selection-overlay ${t.variantClass}`,d=t.box()?void 0:"none",c=`${(null==(n=t.box())?void 0:n.left)??0}px`,h=`${(null==(r=t.box())?void 0:r.top)??0}px`,p=`${(null==(o=t.box())?void 0:o.width)??0}px`,u=`${(null==(i=t.box())?void 0:i.height)??0}px`,f=(null==(l=t.rotation)?void 0:l.call(t))?`rotate(${t.rotation()}deg)`:void 0,g=!t.readOnly&&t.box()?"auto":"none";return s!==a.e&>(e,a.e=s),d!==a.t&&yt(e,"display",a.t=d),c!==a.a&&yt(e,"left",a.a=c),h!==a.o&&yt(e,"top",a.o=h),p!==a.i&&yt(e,"width",a.i=p),u!==a.n&&yt(e,"height",a.n=u),f!==a.s&&yt(e,"transform",a.s=f),g!==a.h&&yt(e,"pointer-events",a.h=g),a},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),e;var e}ut(["mousedown"]);function Sy(t){return Number.isFinite(t)?Math.min(200,Math.max(50,Math.round(t))):100}var Ay=pt('<div data-testid=editor-editor-shell><div class=oasis-editor-editor data-testid=editor-editor><div class=oasis-editor-editor-zoom-sizer><div class=oasis-editor-editor-scroll-content data-testid=editor-editor-scroll-content style="position:absolute;top:0px;transform-origin:top left"><textarea aria-label="Editor input"autocomplete=off autocapitalize=off class=oasis-editor-input data-testid=editor-input value style=pointer-events:none></textarea><input data-testid=editor-import-docx-input type=file style=display:none><input accept="image/png, image/jpeg, image/gif"data-testid=editor-insert-image-input type=file style=display:none></div></div></div><div class=oasis-editor-statusbar data-testid=editor-statusbar><div class="oasis-editor-statusbar-group oasis-editor-statusbar-start"><span class=oasis-editor-statusbar-item data-testid=editor-statusbar-word-count></span><span class=oasis-editor-statusbar-item data-testid=editor-statusbar-character-count></span><span class=oasis-editor-statusbar-item></span></div><div class="oasis-editor-statusbar-group oasis-editor-statusbar-end"><div class=oasis-editor-statusbar-zoom data-testid=editor-statusbar-zoom-control><button type=button class=oasis-editor-zoom-button>−</button><input class=oasis-editor-zoom-slider type=range><button type=button class=oasis-editor-zoom-button>+</button><span class="oasis-editor-statusbar-item oasis-editor-zoom-value"data-testid=editor-statusbar-zoom>%'),Iy=pt("<div class=oasis-editor-import-overlay data-testid=editor-import-overlay role=status aria-live=polite><div class=oasis-editor-import-card><div class=oasis-editor-import-title></div><div class=oasis-editor-import-phase data-testid=editor-import-phase></div><div class=oasis-editor-import-progress-track><div class=oasis-editor-import-progress-bar data-testid=editor-import-progress-bar></div></div><div class=oasis-editor-import-progress-label>"),Ty=pt("<span class=oasis-editor-import-done-icon>"),Cy=pt("<span class=oasis-editor-import-error-icon>"),ky=pt("<span>");function Vy(t){const e=()=>t.layout??{},a=()=>t.overlays,n=()=>t.refs??{},r=()=>t.surfaceHandlers,o=()=>t.inputHandlers,i=()=>t.fileHandlers;let l,s;const[d,c]=y(),h=()=>We(t.state().document).reduce((t,e)=>Math.max(t,e.pageSettings.width),0)||me(t.state().document).width,p=()=>{const t=e().viewportHeight;return"number"==typeof t?`${t}px`:t??"min(72vh, 920px)"},u=w(()=>({width:"100%",height:"100%","max-height":p(),...e().style??{}})),f=w(()=>t.state().document),g=w(()=>Ze(f()).reduce((t,e)=>t+Ae(e),0)),m=w(()=>function(t){const e=Ze(t);let a=0;for(const n of e){const t=n.runs.reduce((t,e)=>t+e.text,"");t.trim()&&(a+=t.split(/[\s\p{P}]+/u).filter(t=>t.length>0).length)}return a}(f())),[v,b]=y(100),S=()=>{var t,a;return(null==(a=(t=e()).zoomPercent)?void 0:a.call(t))??v()},A=t=>{const a=Sy(t),n=e().setZoomPercent;n?n(a):b(a)},I=t=>A(S()+t),C=w(()=>Sy(S())/100),k=()=>{var t,a;return(null==(a=(t=e()).zoomFactor)?void 0:a.call(t))??C()},[V,E]=y(0),[R,L]=y({width:0,height:0}),z=()=>h()+68,N=w(()=>Math.max(z()*k(),R().width)),q=w(()=>Math.max(V()*k(),R().height)),O=w(()=>Math.max(0,(N()-z()*k())/2));let P=k();x(()=>{const t=k(),e=P;if(P=t,t===e||e<=0)return;const a=s;if(!a)return;const n=t/e,r=a.clientWidth/2,o=a.clientHeight/2,i=(a.scrollLeft+r)*n-r,l=(a.scrollTop+o)*n-o;requestAnimationFrame(()=>{a.scrollLeft=i,a.scrollTop=l})});const W=w(()=>{var t,a,n,r;return os(f(),void 0,null==(a=(t=e()).measuredBlockHeights)?void 0:a.call(t),null==(r=(n=e()).measuredParagraphLayouts)?void 0:r.call(n))}),[H,U]=y(null),F=()=>{const t=s;if(!t)return void U(null);const e=Array.from(t.querySelectorAll(".oasis-editor-paper[data-page-index]"));if(0===e.length)return void U(null);const a=t.getBoundingClientRect(),n=a.top+.5*a.height;let r=0,o=Number.POSITIVE_INFINITY;for(const i of e){const t=i.getBoundingClientRect(),e=t.top+.5*t.height,a=Math.abs(e-n);a<o&&(o=a,r=Number(i.dataset.pageIndex??"0"))}U(Number.isFinite(r)?r:null)},B=()=>{const e=H();if(null!==e)return Math.max(1,e+1);const a=W(),n=t.state().selection.focus.paragraphId,r=a.pages.findIndex(t=>t.blocks.some(t=>t.sourceBlockId===n));return-1===r?1:r+1},G=w(()=>a().selectedImageBox()),K=w(()=>a().selectedTextBoxBox()),D=w(()=>{var e;return(null==(e=t.state().document.comments)?void 0:e.items)??{}});return x(()=>{W(),queueMicrotask(F)}),(()=>{var h=Ay(),p=h.firstChild,f=p.firstChild,v=f.firstChild,b=v.firstChild,y=b.nextSibling,x=y.nextSibling,w=p.nextSibling,C=w.firstChild,V=C.firstChild,P=V.nextSibling,H=P.nextSibling,U=C.nextSibling,j=U.firstChild,X=j.firstChild,J=X.nextSibling,Y=J.nextSibling,Q=Y.nextSibling,_=Q.firstChild;wt(h,Z(et,{get when(){return dt(()=>!!e().showHorizontalRuler)()&&a().toolbarHost},get children(){return Z(xp,{get state(){return t.state},get toolbarHost(){return a().toolbarHost},viewportRef:d,readOnly:()=>Boolean(e().readOnly),zoomFactor:k})}}),p),mt(p,"contextmenu",r().onEditorContextMenu,!0),mt(p,"mousedown",r().onEditorMouseDown,!0),mt(p,"drop",r().onDrop),mt(p,"dragover",r().onDragOver),xt(t=>{var e,a;s=t,c(t),null==(a=(e=n()).onViewportRef)||a.call(e,t);const r=()=>{F()};t.addEventListener("scroll",r,{passive:!0}),queueMicrotask(F);const o=()=>{L({width:t.clientWidth,height:t.clientHeight})};let i;o(),"undefined"!=typeof ResizeObserver&&(i=new ResizeObserver(o),i.observe(t)),T(()=>{t.removeEventListener("scroll",r),null==i||i.disconnect()})},p),xt(t=>{var e,a;l=t,null==(a=(e=n()).onSurfaceRef)||a.call(e,t);const r=()=>{E(t.offsetHeight)};let o;r(),queueMicrotask(r),"undefined"!=typeof ResizeObserver&&(o=new ResizeObserver(r),o.observe(t)),T(()=>null==o?void 0:o.disconnect())},v),wt(v,Z(ap,{get state(){return t.state},get measuredBlockHeights(){return e().measuredBlockHeights},get measuredParagraphLayouts(){return e().measuredParagraphLayouts},viewportRef:()=>s??void 0,get onSurfaceMouseDown(){return r().onSurfaceMouseDown},get onSurfaceClick(){return r().onSurfaceClick},get onSurfaceMouseMove(){return r().onSurfaceMouseMove},get onSurfaceDblClick(){return r().onSurfaceDblClick},get onParagraphMouseDown(){return r().onParagraphMouseDown},get onImageMouseDown(){return r().onImageMouseDown},get onImageResizeHandleMouseDown(){return r().onImageResizeHandleMouseDown},get onTextBoxResizeHandleMouseDown(){return r().onTextBoxResizeHandleMouseDown},get onTableDragHandleMouseDown(){return r().onTableDragHandleMouseDown},get onRevisionMouseEnter(){return r().onRevisionMouseEnter},get onRevisionMouseLeave(){return r().onRevisionMouseLeave}}),b),wt(v,Z(et,{get when(){return a().hoveredRevision()},children:t=>Z(kp,{get box(){return t()}})}),b),wt(v,Z(et,{get when(){return a().selectionBoxes().length>0},get children(){return Z(Tp,{get boxes(){return a().selectionBoxes()}})}}),b),wt(v,Z(et,{get when(){return a().commentHighlights().length>0},get children(){return Z(Np,{get boxes(){return a().commentHighlights},commentsById:D})}}),b),wt(v,Z(wy,{box:G,get readOnly(){return Boolean(e().readOnly)},variantClass:"oasis-editor-image-selection-overlay",rotation:()=>{var t;return(null==(t=G())?void 0:t.rotation)??0},onResizeStart:(t,e)=>{const a=G();a&&(e.preventDefault(),e.stopPropagation(),r().onImageResizeHandleMouseDown(a.paragraphId,a.startOffset,t,e))},onRotateStart:t=>{const e=G();e&&r().onImageRotateHandleMouseDown(e.paragraphId,e.startOffset,t)},onBodyMouseDown:t=>{const e=G();e&&r().onImageMouseDown(e.paragraphId,e.startOffset,t)}}),b),wt(v,Z(wy,{box:K,get readOnly(){return Boolean(e().readOnly)},variantClass:"oasis-editor-textbox-selection-overlay",rotation:()=>{var t;return(null==(t=K())?void 0:t.rotation)??0},onResizeStart:(t,e)=>{const a=K();a&&(e.preventDefault(),e.stopPropagation(),r().onTextBoxResizeHandleMouseDown(a.paragraphId,a.startOffset,t,e))},onRotateStart:t=>{const e=K();e&&r().onTextBoxRotateHandleMouseDown(e.paragraphId,e.startOffset,t)}}),b),wt(v,Z(et,{get when(){return dt(()=>!!a().toolbarHost)()&&a().showFloatingTableToolbar},get children(){return Z(Op,{get host(){return a().toolbarHost},get selectionBoxes(){return a().selectionBoxes},get visible(){return a().showFloatingTableToolbar},surfaceRef:()=>l})}}),b),wt(v,Z(et,{get when(){return a().layoutOptions},children:t=>Z(jp,{box:()=>G()??K(),get layoutOptions(){return t()},surfaceRef:()=>l,get readOnly(){return Boolean(e().readOnly)}})}),b),wt(v,Z(et,{get when(){return a().showCaret()},get children(){return Z(Sp,{get active(){return a().focused()},get left(){return a().caretBox().left},get top(){return a().caretBox().top},get height(){return a().caretBox().height}})}}),b),mt(b,"paste",o().onPaste),mt(b,"keydown",o().onKeyDown,!0),mt(b,"input",o().onInput,!0),mt(b,"focus",o().onInputFocus),mt(b,"cut",o().onCut),mt(b,"copy",o().onCopy),mt(b,"compositionstart",o().onCompositionStart),mt(b,"compositionend",o().onCompositionEnd),mt(b,"blur",o().onInputBlur);var $=n().onTextareaRef;"function"==typeof $?xt($,b):n().onTextareaRef=b,ft(b,"spellcheck",!1),mt(y,"change",i().onImportInputChange);var tt=n().onImportInputRef;"function"==typeof tt?xt(tt,y):n().onImportInputRef=y,mt(x,"change",i().onImageInputChange);var at=n().onImageInputRef;return"function"==typeof at?xt(at,x):n().onImageInputRef=x,wt(h,Z(et,{get when(){var t,e;return null==(e=(t=a()).importProgress)?void 0:e.call(t)},children:t=>{const e="done"===t().phase,a="error"===t().phase;return o=Iy(),i=o.firstChild,l=i.firstChild,s=l.nextSibling,d=s.nextSibling,c=d.firstChild,h=d.nextSibling,o.classList.toggle("oasis-editor-import-overlay-done",!!e),o.classList.toggle("oasis-editor-import-overlay-error",!!a),ft(o,"aria-busy",!e&&!a),wt(i,Z(Ht,{height:40,class:"oasis-editor-loading-mark"}),l),wt(l,()=>Pt("import.overlay.title")),wt(s,()=>Pt(`import.phase.${t().phase}`)),c.classList.toggle("oasis-editor-import-progress-bar-done",!!e),c.classList.toggle("oasis-editor-import-progress-bar-error",!!a),wt(h,e?(wt(r=Ty(),()=>Pt("import.phase.done")),r):a?(wt(n=Cy(),()=>Pt("import.phase.error")),n):[dt(()=>Math.round(t().progress)),"%"]),M(e=>{var a=!("applying-editor-state"!==t().phase&&"stabilizing-layout"!==t().phase),n=`${t().progress}%`;return a!==e.e&&c.classList.toggle("oasis-editor-import-progress-bar-indeterminate",e.e=a),n!==e.t&&yt(c,"width",e.t=n),e},{e:void 0,t:void 0}),o;var n,r,o,i,l,s,d,c,h}}),w),wt(V,()=>Pt("status.words",[m()])),wt(P,()=>Pt("status.characters",[g()])),wt(H,()=>Pt("status.page",[B(),Math.max(1,W().pages.length)])),X.$$click=()=>I(-10),J.$$input=t=>A(Sy(t.currentTarget.valueAsNumber)),ft(J,"min",50),ft(J,"max",200),ft(J,"step",10),Y.$$click=()=>I(10),wt(Q,S,_),wt(U,Z(et,{get when(){return a().persistenceStatus},get children(){return(()=>{const t=a().persistenceStatus().toLowerCase(),e=t.includes("saved")?"status.saved":t.includes("saving")?"status.saving":t.includes("error")?"status.error":null;return Z(et,{when:e,get children(){var a=ky();return wt(a,()=>Pt(e)),M(()=>gt(a,`oasis-editor-statusbar-item oasis-editor-persistence-status oasis-editor-status-${t.replace("...","ing").replace(".","")}`)),a}})})()}}),null),M(t=>{var n="oasis-editor-editor-shell"+(e().class?` ${e().class}`:""),r=u(),o=`${N()}px`,i=`${q()}px`,l=`${O()}px`,s=`${z()}px`,d=R().height/k()+"px",c=`scale(${k()})`,p=e().readOnly,g=`${a().inputBox().left}px`,m=`${a().inputBox().top}px`,M=`${a().inputBox().height}px`,x=fy.flatMap(t=>t.accept).join(","),w=Pt("status.zoom"),A=`${Pt("status.zoom")} -`,I=S()<=50,T=Pt("status.zoom"),C=`${S()}%`,V=`${Pt("status.zoom")} +`,E=S()>=200;return n!==t.e&>(h,t.e=n),t.t=bt(h,r,t.t),o!==t.a&&yt(f,"width",t.a=o),i!==t.o&&yt(f,"height",t.o=i),l!==t.i&&yt(v,"left",t.i=l),s!==t.n&&yt(v,"width",t.n=s),d!==t.s&&yt(v,"min-height",t.s=d),c!==t.h&&yt(v,"transform",t.h=c),p!==t.r&&(b.readOnly=t.r=p),g!==t.d&&yt(b,"left",t.d=g),m!==t.l&&yt(b,"top",t.l=m),M!==t.u&&yt(b,"height",t.u=M),x!==t.c&&ft(y,"accept",t.c=x),w!==t.w&&ft(j,"aria-label",t.w=w),A!==t.m&&ft(X,"aria-label",t.m=A),I!==t.f&&(X.disabled=t.f=I),T!==t.y&&ft(J,"aria-label",t.y=T),C!==t.g&&ft(J,"aria-valuetext",t.g=C),V!==t.p&&ft(Y,"aria-label",t.p=V),E!==t.b&&(Y.disabled=t.b=E),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0,w:void 0,m:void 0,f:void 0,y:void 0,g:void 0,p:void 0,b:void 0}),M(()=>J.value=S()),h})()}ut(["mousedown","contextmenu","input","keydown","click"]);var Ey=pt("<button>");function Ry(t){const[e,a]=Y(t,["type","icon","label","active","class","classList"]);return Mt(n=Ey(),J({get type(){return e.type??"button"},get class(){return`oasis-editor-plugin-floating-action ${e.class??""}`},get classList(){return{"is-active":e.active,...e.classList}},get"aria-label"(){return e.label},get title(){return e.label}},a),!1,!0),wt(n,Z(Ga,{get name(){return e.icon}})),n;var n}var Ly=pt("<aside>"),zy=pt("<div>");function Ny(t){const[e,a]=Y(t,["mode","width","class","classList","children","style"]);return Mt(n=Ly(),J({get class(){return`oasis-editor-plugin-side-panel ${e.class??""}`},get classList(){return{[`oasis-editor-plugin-side-panel-${e.mode??"dock"}`]:!0,...e.classList}},get style(){return{"--oasis-plugin-side-panel-width":"number"==typeof e.width?`${e.width}px`:e.width??"360px",...e.style}}},a),!1,!0),wt(n,()=>e.children),n;var n}function qy(t){const[e,a]=Y(t,["class","children"]);return Mt(n=zy(),J({get class(){return`oasis-editor-plugin-side-panel-header ${e.class??""}`}},a),!1,!0),wt(n,()=>e.children),n;var n}function Oy(t){const[e,a]=Y(t,["class","children"]);return Mt(n=zy(),J({get class(){return`oasis-editor-plugin-side-panel-body ${e.class??""}`}},a),!1,!0),wt(n,()=>e.children),n;var n}var Py=pt("<button>");function Wy(t){const[e,a]=Y(t,["type","icon","label","active","variant","size","class","classList"]);return Mt(n=Py(),J({get type(){return e.type??"button"},get class(){return`oasis-editor-ui-icon-button ${e.class??""}`},get classList(){return{[`oasis-editor-ui-icon-button-${e.variant??"ghost"}`]:!0,[`oasis-editor-ui-icon-button-${e.size??"md"}`]:!0,"is-active":e.active,...e.classList}},get"aria-label"(){return e.label},get title(){return e.label}},a),!1,!0),wt(n,Z(Ga,{get name(){return e.icon}})),n;var n}var Hy=pt("<div class=oasis-editor-plugin-floating-actions>"),Uy=pt("<div class=oasis-editor-plugin-ui-host><div class=oasis-editor-plugin-ui-main>"),Fy=pt("<div class=oasis-editor-plugin-side-panel-overlay>"),By=pt("<span class=oasis-editor-plugin-side-panel-icon>"),Gy=pt("<div class=oasis-editor-plugin-side-panel-title><span>");const Zy={floatingActions:[],sidePanels:[],activeSidePanelId:null};function Ky(t){const e=k(()=>t.children),[a,n]=y(Zy);x(()=>{const e=t.editor();n(e.ui.getSnapshot());T(e.ui.onChange(()=>{n(e.ui.getSnapshot())}))});const r=w(()=>a().sidePanels.find(t=>t.id===a().activeSidePanelId)),o=()=>{var t;return(null==(t=r())?void 0:t.mode)??"dock"},i=()=>"dock"===o()?r():void 0,l=()=>a().floatingActions.filter(t=>"container"===(t.scope??"container")),s=()=>a().floatingActions.filter(t=>"viewport"===t.scope),d=(e,a=!1)=>Z($,{get each(){return function(t){const e=new Map;for(const a of t){const t=a.placement??"bottom-right";e.set(t,[...e.get(t)??[],a])}return Array.from(e.entries()).map(([t,e])=>({placement:t,actions:e}))}(e())},children:e=>{return wt(n=Hy(),Z($,{get each(){return e.actions},children:e=>Z(Ry,{get icon(){return e.icon??"sparkles"},get label(){return function(t){return t.tooltip?t.tooltip:t.labelKey?Pt(t.labelKey):t.label??t.id}(e)},get disabled(){return!function(t,e){const a=Dt(e.command);return t.commands.canExecute(a.name,a.payload)}(t.editor(),e)},get"data-testid"(){return`plugin-floating-action-${e.id}`},onClick:()=>function(t,e){const a=Dt(e.command);t.commands.execute(a.name,a.payload)}(t.editor(),e)})})),M(t=>vt(n,{[`oasis-editor-plugin-floating-actions-${e.placement}`]:!0,"oasis-editor-plugin-floating-actions-viewport":a},t)),n;var n}});return wt((c=Uy()).firstChild,e),wt(c,Z(et,{get when(){return i()},children:e=>Dy(t.editor,e())}),null),wt(c,Z(et,{get when(){return"overlay"===o()?r():void 0},children:e=>{return wt(a=Fy(),()=>Dy(t.editor,e())),a;var a}}),null),wt(c,()=>d(l),null),wt(c,Z(et,{get when(){return s().length>0},get children(){return Z(Rt,{get children(){return d(s,!0)}})}}),null),M(()=>c.classList.toggle("has-docked-side-panel",!!Boolean(i()))),c;var c}function Dy(t,e){const a=()=>t().ui.closeSidePanel(e.id);return Z(Ny,{get mode(){return e.mode??"dock"},get width(){return e.width},get"data-testid"(){return`plugin-side-panel-${e.id}`},get children(){return[Z(qy,{get children(){return[(n=Gy(),r=n.firstChild,wt(n,Z(et,{get when(){return e.icon},get children(){var t=By();return wt(t,Z(Ga,{get name(){return e.icon}})),t}}),r),wt(r,(t=dt(()=>!!e.titleKey),()=>t()?Pt(e.titleKey):e.title)),n),Z(Wy,{icon:"x",label:"Close panel",size:"sm",onClick:a})];var t,n,r}}),Z(Oy,{get children(){return e.render({editor:t(),commands:t().commands,ui:t().ui,panelId:e.id,closePanel:a,getState:()=>t().state,getDocument:()=>t().state.document,getSelection:()=>t().state.selection})}})]}})}var jy=pt("<div class=oasis-editor-main-container><section class=oasis-editor-stage>");function Xy(t){let e,a;const n=a=>{var n,r;e=a,null==(r=(n=t.refs).onSurfaceRef)||r.call(n,a)},r=e=>{var n,r;a=e,null==(r=(n=t.refs).onViewportRef)||r.call(n,e)},o=n=>{if(!e)return;const r=Yd({surface:e,state:t.state});if(!r)return;const o=_d(r,n)[0];if(!o)return;const i=a,l=o.top;if(i){const t=i.getBoundingClientRect();return void i.scrollTo({top:i.scrollTop+(l-t.top)-24,behavior:"smooth"})}window.scrollTo({top:window.scrollY+l-24,behavior:"smooth"})};return[Z(et,{get when(){return t.showChrome},get children(){return[Z(et,{get when(){return"compact"===t.toolbarView},get children(){return Z(et,{get when(){return t.showTitleBar},get fallback(){return Z(et,{get when(){return t.showMenubar},get children(){return Z(tn,{get host(){return t.toolbarHost},get registry(){return t.menuRegistry}})}})},get children(){return Z(nn,{get children(){return Z(et,{get when(){return t.showMenubar},get children(){return Z(tn,{get host(){return t.toolbarHost},get registry(){return t.menuRegistry}})}})}})}})}}),Z(et,{get when(){return t.showToolbar},get children(){return Z(xh,{get host(){return t.toolbarHost},get registry(){return t.toolbarRegistry},get showFileGroup(){return!!dt(()=>"ribbon"===t.toolbarView)()||!t.showMenubar},get view(){return t.toolbarView},get layout(){return t.toolbarLayout}})}})]}}),Z(Ky,{get editor(){return t.runtimeEditor},get children(){var i=jy(),l=i.firstChild;return wt(i,Z(et,{get when(){return dt(()=>!!t.showChrome)()&&t.showOutline},get children(){return Z(rc,{get state(){return t.state},onNavigate:o,surfaceRef:()=>e,viewportRef:()=>a})}}),l),wt(l,Z(Vy,{state:()=>t.state,get layout(){return{...t.layout,showHorizontalRuler:t.showChrome,measuredBlockHeights:()=>t.measuredBlockHeights(),measuredParagraphLayouts:()=>t.measuredParagraphLayouts(),viewportHeight:t.viewportHeight(),readOnly:t.isReadOnly}},get overlays(){return{...t.overlays,toolbarHost:t.toolbarHost,persistenceStatus:()=>t.persistenceStatus(),showFloatingTableToolbar:()=>t.showFloatingTableToolbar()}},get refs(){return{...t.refs,onViewportRef:r,onSurfaceRef:n}},get surfaceHandlers(){return t.surfaceHandlers},get inputHandlers(){return t.inputHandlers},get fileHandlers(){return t.fileHandlers}})),i}})]}var Jy=pt("<div class=oasis-editor-main-container><section class=oasis-editor-stage style=padding:0>"),Yy=pt('<div class=oasis-inline-shell style="border:1px solid var(--oasis-toolbar-border);border-radius:var(--oasis-radius);overflow:hidden;display:flex;flex-direction:column">');function Qy(t){return wt(e=Yy(),Z(et,{get when(){return dt(()=>!!t.showChrome)()&&t.showToolbar},get children(){return Z(xh,{get host(){return t.toolbarHost},get registry(){return t.toolbarRegistry},get view(){return t.toolbarView},get layout(){return t.toolbarLayout}})}}),null),wt(e,Z(Ky,{get editor(){return t.runtimeEditor},get children(){var e=Jy();return wt(e.firstChild,Z(Vy,{state:()=>t.state,get layout(){return{...t.layout,measuredBlockHeights:()=>t.measuredBlockHeights(),measuredParagraphLayouts:()=>t.measuredParagraphLayouts(),viewportHeight:t.viewportHeight(),readOnly:t.isReadOnly}},get overlays(){return{...t.overlays,toolbarHost:t.toolbarHost,persistenceStatus:()=>t.persistenceStatus(),showFloatingTableToolbar:()=>t.showFloatingTableToolbar()}},get refs(){return t.refs},get surfaceHandlers(){return t.surfaceHandlers},get inputHandlers(){return t.inputHandlers},get fileHandlers(){return t.fileHandlers}})),e}}),null),e;var e}var _y=pt("<div class=oasis-editor-main-container><section class=oasis-editor-stage style=padding:0>"),$y=pt("<div class=oasis-balloon-shell>");function tM(t){return wt(e=$y(),Z(Ky,{get editor(){return t.runtimeEditor},get children(){var e=_y();return wt(e.firstChild,Z(Vy,{state:()=>t.state,get layout(){return{...t.layout,measuredBlockHeights:()=>t.measuredBlockHeights(),measuredParagraphLayouts:()=>t.measuredParagraphLayouts(),viewportHeight:t.viewportHeight(),readOnly:t.isReadOnly}},get overlays(){return{...t.overlays,toolbarHost:t.toolbarHost,persistenceStatus:()=>t.persistenceStatus(),showFloatingTableToolbar:()=>t.showFloatingTableToolbar()}},get refs(){return t.refs},get surfaceHandlers(){return t.surfaceHandlers},get inputHandlers(){return t.inputHandlers},get fileHandlers(){return t.fileHandlers}})),e}})),e;var e}var eM=pt("<div class=oasis-editor-dialog-footer data-testid=editor-dialog-footer>"),aM=pt("<div class=oasis-editor-dialog-overlay><div role=dialog aria-modal=true data-testid=editor-dialog><div class=oasis-editor-dialog-header><h3 class=oasis-editor-dialog-title></h3><button class=oasis-editor-dialog-close data-testid=editor-dialog-close><i data-lucide=x></i></button></div><div data-testid=editor-dialog-body>");function nM(t){let e;const a=_(),n=w(()=>t.titleId??a),r=w(()=>t.size??"md"),o=w(()=>["oasis-editor-dialog",`oasis-editor-dialog-${r()}`,t.class].filter(Boolean).join(" ")),i=w(()=>["oasis-editor-dialog-body",t.bodyClass].filter(Boolean).join(" ")),l=e=>{"Escape"===e.key&&t.isOpen&&t.onClose()};return I(()=>{window.addEventListener("keydown",l)}),T(()=>{window.removeEventListener("keydown",l)}),Z(et,{get when(){return t.isOpen},get children(){var a=aM(),r=a.firstChild,l=r.firstChild,s=l.firstChild,d=s.nextSibling,c=l.nextSibling;a.$$click=()=>{(t.closeOnOverlayClick??1)&&t.onClose()},r.$$click=t=>t.stopPropagation();return"function"==typeof e?xt(e,r):e=r,wt(s,()=>t.title),mt(d,"click",t.onClose,!0),wt(c,()=>t.children),wt(r,Z(et,{get when(){return t.footer},get children(){var e=eM();return wt(e,()=>t.footer),e}}),null),M(e=>{var a=o(),l=t.ariaLabel,h=t.ariaLabel?void 0:n(),p=t.ariaDescribedBy,u=n(),f=Pt("generic.close"),g=i();return a!==e.e&>(r,e.e=a),l!==e.t&&ft(r,"aria-label",e.t=l),h!==e.a&&ft(r,"aria-labelledby",e.a=h),p!==e.o&&ft(r,"aria-describedby",e.o=p),u!==e.i&&ft(s,"id",e.i=u),f!==e.n&&ft(d,"title",e.n=f),g!==e.s&>(c,e.s=g),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),a}})}ut(["click"]);var rM=pt("<div><div class=oasis-editor-tabs-list role=tablist>"),oM=pt("<button type=button role=tab class=oasis-editor-tabs-tab>"),iM=pt("<div role=tabpanel class=oasis-editor-tabs-panel>");function lM(t,e,a){if(t.length)for(let n=0;n<t.length;n+=1){const r=t[(e+n*a+t.length)%t.length];if(r&&!r.disabled)return r}}function sM(t){const e=_(),a=w(()=>t.items),n=w(()=>{var t,e;return(null==(t=a().find(t=>!t.disabled))?void 0:t.id)??(null==(e=a()[0])?void 0:e.id)??""}),[r,o]=y(t.defaultValue??n()),i=w(()=>t.value??r()??n()),l=w(()=>a().find(t=>t.id===i()&&!t.disabled)??a().find(t=>!t.disabled)),s=w(()=>["oasis-editor-tabs",t.class].filter(Boolean).join(" ")),d=[],c=(e,n=!1)=>{var r;e&&!e.disabled&&(void 0===t.value&&o(e.id),null==(r=t.onChange)||r.call(t,e.id),n&&queueMicrotask(()=>{var t;return null==(t=d[a().findIndex(t=>t.id===e.id)])?void 0:t.focus()}))},h=t=>{if("ArrowRight"!==t.key&&"ArrowLeft"!==t.key&&"Home"!==t.key&&"End"!==t.key)return;t.preventDefault();const e=Math.max(0,a().findIndex(t=>{var e;return t.id===(null==(e=l())?void 0:e.id)}));if("Home"===t.key)return c(lM(a(),0,1),!0);if("End"===t.key)return c(lM(a(),a().length-1,-1),!0);const n="ArrowRight"===t.key?1:-1;c(lM(a(),e+n,n),!0)};return p=rM(),(u=p.firstChild).$$keydown=h,wt(u,Z($,{get each(){return a()},children:(t,a)=>{const n=`${e}-${t.id}-tab`,r=`${e}-${t.id}-panel`;return(o=oM()).$$click=()=>c(t),xt(t=>{d[a()]=t},o),ft(o,"id",n),ft(o,"aria-controls",r),wt(o,()=>t.label),M(e=>{var a,n,r,i=(null==(a=l())?void 0:a.id)===t.id,s=t.disabled?"true":void 0,d=t.disabled,c=(null==(n=l())?void 0:n.id)===t.id?0:-1,h=!((null==(r=l())?void 0:r.id)!==t.id),p=t.testId;return i!==e.e&&ft(o,"aria-selected",e.e=i),s!==e.t&&ft(o,"aria-disabled",e.t=s),d!==e.a&&(o.disabled=e.a=d),c!==e.o&&ft(o,"tabindex",e.o=c),h!==e.i&&o.classList.toggle("is-active",e.i=h),p!==e.n&&ft(o,"data-testid",e.n=p),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),o;var o}})),wt(p,Z($,{get each(){return a()},children:t=>{return wt(a=iM(),()=>t.panel),M(n=>{var r,o,i=`${e}-${t.id}-panel`,s=`${e}-${t.id}-tab`,d=(null==(r=l())?void 0:r.id)!==t.id,c=!((null==(o=l())?void 0:o.id)!==t.id);return i!==n.e&&ft(a,"id",n.e=i),s!==n.t&&ft(a,"aria-labelledby",n.t=s),d!==n.a&&(a.hidden=n.a=d),c!==n.o&&a.classList.toggle("is-active",n.o=c),n},{e:void 0,t:void 0,a:void 0,o:void 0}),a;var a}}),null),M(e=>{var a=s(),n=t.ariaLabel;return a!==e.e&>(p,e.e=a),n!==e.t&&ft(u,"aria-label",e.t=n),e},{e:void 0,t:void 0}),p;var p,u}ut(["keydown","click"]);var dM=pt("<button><span class=oasis-editor-ui-button-label>");var cM=pt("<span class=oasis-editor-ui-field-label>"),hM=pt("<span class=oasis-editor-ui-field-description>"),pM=pt("<span class=oasis-editor-ui-field-error>"),uM=pt("<label><input class=oasis-editor-ui-input>");ut(["input"]);var fM=pt("<span class=oasis-editor-ui-field-description>"),gM=pt("<span class=oasis-editor-ui-field-error>"),mM=pt("<label><input type=checkbox class=oasis-editor-ui-checkbox-input><span class=oasis-editor-ui-checkbox-copy><span class=oasis-editor-ui-field-label>");var vM=pt("<span class=oasis-editor-ui-field-label>"),bM=pt("<span class=oasis-editor-ui-field-description>"),yM=pt("<span class=oasis-editor-ui-field-error>"),MM=pt("<label><select class=oasis-editor-ui-select>"),xM=pt("<option>");var wM=pt("<div>");const SM=Number.MAX_SAFE_INTEGER;class AM{constructor(){a(this,"entries",[]),a(this,"listeners",new Set)}register(t){const e=this.entries.findIndex(e=>e.id===t.id);e>=0?this.entries[e]=t:this.entries.push(t),this.sortByOrder(),this.emit()}insertBefore(t,e){this.spliceRelative(t,e,0)}insertAfter(t,e){this.spliceRelative(t,e,1)}replace(t,e){const a=this.entries.findIndex(e=>e.id===t);a<0?this.register(e):(this.entries[a]=e,this.emit())}remove(t){const e=this.entries.filter(e=>e.id!==t);e.length!==this.entries.length&&(this.entries=e,this.emit())}move(t,e){const a=this.entries.findIndex(e=>e.id===t);if(a<0)return;const[n]=this.entries.splice(a,1),r=this.resolveMoveIndex(e);if(null===r)return void this.entries.splice(a,0,n);const o=Math.max(0,Math.min(r,this.entries.length));this.entries.splice(o,0,n),this.emit()}get(t){return this.entries.find(e=>e.id===t)}getOrdered(){return[...this.entries]}getItems(){return this.getOrdered()}clear(){0!==this.entries.length&&(this.entries=[],this.emit())}onChange(t){return this.listeners.add(t),()=>this.listeners.delete(t)}spliceRelative(t,e,a){this.entries=this.entries.filter(t=>t.id!==e.id);const n=this.entries.findIndex(e=>e.id===t);n<0?this.entries.push(e):this.entries.splice(n+a,0,e),this.emit()}resolveMoveIndex(t){if("number"==typeof t)return t;if("before"in t){const e=this.entries.findIndex(e=>e.id===t.before);return e>=0?e:null}const e=this.entries.findIndex(e=>e.id===t.after);return e>=0?e+1:null}sortByOrder(){this.entries=this.entries.map((t,e)=>({item:t,index:e})).sort((t,e)=>(t.item.order??SM)-(e.item.order??SM)||t.index-e.index).map(t=>t.item)}emit(){for(const t of this.listeners)t()}}function IM(){return new AM}const TM=14.6667;function CM(t){return Number.isFinite(t)?.75*t:0}function kM(t){return CM(t.fontSize??TM)}const VM=[8,9,10,11,12,14,16,18,20,24,28,32,36,48,72];function EM(t){return Math.round(100*CM(t))/100}function RM(t){return Math.round(1e4*(e=t,Number.isFinite(e)?e/.75:0))/1e4;var e}function LM(t){const e=Number(t);return!Number.isFinite(e)||e<=0?"":String(EM(e))}function zM(t){const e=Number(t);return!Number.isFinite(e)||e<=0?null:RM(e)}const NM=[{value:"single",labelKey:"underline.style.single",preview:{borderStyle:"solid"}},{value:"double",labelKey:"underline.style.double",preview:{borderStyle:"double",borderBottomWidth:"3px"}},{value:"thick",labelKey:"underline.style.thick",preview:{borderStyle:"solid",borderBottomWidth:"3px"}},{value:"dotted",labelKey:"underline.style.dotted",preview:{borderStyle:"dotted"}},{value:"dottedHeavy",labelKey:"underline.style.dottedHeavy",preview:{borderStyle:"dotted",borderBottomWidth:"3px"}},{value:"dash",labelKey:"underline.style.dashed",preview:{borderStyle:"dashed"}},{value:"dashedHeavy",labelKey:"underline.style.dashedHeavy",preview:{borderStyle:"dashed",borderBottomWidth:"3px"}},{value:"dashLong",labelKey:"underline.style.longDashes",preview:{borderStyle:"dashed"}},{value:"dashLongHeavy",labelKey:"underline.style.longDashesHeavy",preview:{borderStyle:"dashed",borderBottomWidth:"3px"}},{value:"dotDash",labelKey:"underline.style.dotDash",preview:{borderStyle:"dashed"}},{value:"dashDotHeavy",labelKey:"underline.style.dotDashHeavy",preview:{borderStyle:"dashed",borderBottomWidth:"3px"}},{value:"dotDotDash",labelKey:"underline.style.dotDotDash",preview:{borderStyle:"dashed"}},{value:"dashDotDotHeavy",labelKey:"underline.style.dotDotDashHeavy",preview:{borderStyle:"dashed",borderBottomWidth:"3px"}},{value:"wave",labelKey:"underline.style.wave",preview:{borderStyle:"wavy",svg:'<svg width="100%" height="6" viewBox="0 0 60 6" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 3 Q 5 0 10 3 T 20 3 T 30 3 T 40 3 T 50 3 T 60 3" fill="none" stroke="currentColor" stroke-width="1"/></svg>'}},{value:"wavyHeavy",labelKey:"underline.style.waveHeavy",preview:{borderStyle:"wavy",svg:'<svg width="100%" height="6" viewBox="0 0 60 6" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 3 Q 5 0 10 3 T 20 3 T 30 3 T 40 3 T 50 3 T 60 3" fill="none" stroke="currentColor" stroke-width="2"/></svg>'}},{value:"wavyDouble",labelKey:"underline.style.waveDouble",preview:{borderStyle:"wavy",svg:'<svg width="100%" height="9" viewBox="0 0 60 9" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 2 Q 5 -1 10 2 T 20 2 T 30 2 T 40 2 T 50 2 T 60 2" fill="none" stroke="currentColor" stroke-width="1"/><path d="M0 7 Q 5 4 10 7 T 20 7 T 30 7 T 40 7 T 50 7 T 60 7" fill="none" stroke="currentColor" stroke-width="1"/></svg>'}}];var qM=pt("<button type=button class=oasis-editor-color-menu-action data-testid=editor-toolbar-underline-remove role=menuitem><span class=oasis-editor-color-menu-action-swatch><i data-lucide=slash></i></span><span>"),OM=pt("<div class=oasis-editor-underline-menu-list>"),PM=pt('<span class="oasis-editor-color-split-icon oasis-editor-underline-split-icon"><span class=oasis-editor-underline-split-glyph aria-hidden=true>U</span><span class=oasis-editor-underline-split-indicator>'),WM=pt('<span class="oasis-editor-underline-menu-stroke oasis-editor-underline-menu-stroke-svg">'),HM=pt("<button type=button class=oasis-editor-underline-menu-item role=menuitemradio><span class=oasis-editor-underline-menu-preview></span><span class=oasis-editor-underline-menu-label>"),UM=pt("<span class=oasis-editor-underline-menu-stroke>");const FM=/Mac/i.test(navigator.userAgent)?"⌘":"Ctrl",BM=`${Pt("toolbar.underline")} (${FM}+U)`,GM="editor-toolbar-underline";function ZM(t){const e=t.api,[a,n]=y("single"),[r,o]=y(!1),i=()=>e.commands.state("underline").isActive,l=()=>String(e.commands.state("setUnderlineStyle").value??"");return Z(Ec,{get open(){return r()},onOpenChange:o,tooltip:BM,get rootActive(){return r()||i()},mainTestId:GM,get mainPressed(){return i()},onMain:()=>{if(!i()){const t=a();"single"===t||l()||e.commands.execute("setUnderlineStyle",t)}e.commands.execute("underline")},menuTestId:`${GM}-dropdown`,panelClass:"oasis-editor-color-menu oasis-editor-underline-menu",panelRole:"menu",get mainContent(){return t=PM(),e=t.firstChild.nextSibling,M(()=>ft(e,"data-style",(l()||a()||"single").toLowerCase())),t;var t,e},get children(){return[(a=qM(),r=a.firstChild.nextSibling,a.$$click=()=>{i()&&e.commands.execute("underline"),e.commands.execute("setUnderlineStyle",null),o(!1)},wt(r,()=>Pt("toolbar.underlineRemove")),a),(t=OM(),wt(t,Z($,{each:NM,children:t=>{const a=()=>i()&&(l()||(i()?"single":"")).toLowerCase()===t.value.toLowerCase();return r=HM(),s=r.firstChild,d=s.nextSibling,r.$$click=()=>{(t=>{n(t);const a=i();e.commands.execute("setUnderlineStyle","single"===t?null:t),a||e.commands.execute("underline")})(t.value),o(!1)},wt(s,Z(et,{get when(){return t.preview.svg},get fallback(){return e=UM(),M(a=>bt(e,"wavy"===t.preview.borderStyle?void 0:{"border-bottom-style":t.preview.borderStyle,"border-bottom-width":t.preview.borderBottomWidth??"1px"},a)),e;var e},get children(){var e=WM();return M(()=>e.innerHTML=t.preview.svg),e}})),wt(d,()=>Pt(t.labelKey)),M(e=>{var n=!!a(),o=a(),i=`${GM}-style-${t.value}`,l=Pt(t.labelKey);return n!==e.e&&r.classList.toggle("oasis-editor-underline-menu-item-active",e.e=n),o!==e.t&&ft(r,"aria-checked",e.t=o),i!==e.a&&ft(r,"data-testid",e.a=i),l!==e.o&&ft(r,"title",e.o=l),e},{e:void 0,t:void 0,a:void 0,o:void 0}),r;var r,s,d}})),t)];var t,a,r}})}ut(["click"]);var KM=pt("<option value=decimal>"),DM=pt("<option value=lowerLetter>"),jM=pt("<option value=upperLetter>"),XM=pt("<option value=lowerRoman>"),JM=pt("<option value=upperRoman>"),YM=pt("<option value=bullet>"),QM=pt("<div class=oasis-editor-toolbar-list-options><label class=oasis-editor-toolbar-field><span></span></label><label class=oasis-editor-toolbar-field><span></span><input type=number class=oasis-editor-tool-number data-testid=editor-toolbar-list-start-at min=1 step=1 placeholder=1>");var _M=pt('<div class=oasis-editor-dialog-row><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><input type=number class=oasis-editor-dialog-input min=0.5 step=0.05 data-testid=editor-line-spacing-dialog-line-height>'),$M=pt('<div class=oasis-editor-dialog-row><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><input type=number class=oasis-editor-dialog-input min=0 step=1 data-testid=editor-line-spacing-dialog-spacing-before></div><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><input type=number class=oasis-editor-dialog-input min=0 step=1 data-testid=editor-line-spacing-dialog-spacing-after>'),tx=pt("<div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><div class=oasis-editor-dialog-preview data-testid=editor-line-spacing-dialog-preview><br>"),ex=pt('<button class="oasis-editor-dialog-button oasis-editor-dialog-button-secondary"data-testid=editor-line-spacing-dialog-cancel>'),ax=pt('<button class="oasis-editor-dialog-button oasis-editor-dialog-button-primary"data-testid=editor-line-spacing-dialog-apply>');function nx(t){const[e,a]=y(""),[n,r]=y(""),[o,i]=y("");x(()=>{t.isOpen&&(a(t.initial.lineHeight??""),r(t.initial.spacingBefore??""),i(t.initial.spacingAfter??""))});const l=t=>{if(""===t.trim())return null;const e=Number(t);return Number.isFinite(e)?e:null},s=w(()=>{const t=l(e());return{"line-height":null!==t&&t>0?String(t):void 0}}),d=()=>{t.onApply({lineHeight:l(e()),spacingBefore:l(n()),spacingAfter:l(o())},t.initial),t.onClose()};return Z(nM,{get isOpen(){return t.isOpen},get title(){return Pt("lineSpacing.title")},get onClose(){return t.onClose},get footer(){return[(a=ex(),mt(a,"click",t.onClose,!0),wt(a,()=>Pt("generic.cancel")),a),(e=ax(),e.$$click=d,wt(e,()=>Pt("generic.apply")),e)];var e,a},get children(){return[(v=_M(),b=v.firstChild.firstChild,y=b.nextSibling,wt(b,()=>Pt("lineSpacing.lineSpacingLabel")),y.$$input=t=>a(t.currentTarget.value),M(()=>y.value=e()),v),(h=$M(),p=h.firstChild,u=p.firstChild,f=u.nextSibling,g=p.nextSibling.firstChild,m=g.nextSibling,wt(u,()=>Pt("lineSpacing.spacingBeforeLabel")),f.$$input=t=>r(t.currentTarget.value),wt(g,()=>Pt("lineSpacing.spacingAfterLabel")),m.$$input=t=>i(t.currentTarget.value),M(()=>f.value=n()),M(()=>m.value=o()),h),(t=tx(),l=t.firstChild,d=l.nextSibling,c=d.firstChild,wt(l,()=>Pt("lineSpacing.preview")),wt(d,()=>Pt("lineSpacing.previewText"),c),wt(d,()=>Pt("lineSpacing.previewText"),null),M(t=>bt(d,s(),t)),t)];var t,l,d,c,h,p,u,f,g,m,v,b,y}})}ut(["input","click"]);var rx=pt("<div class=oasis-editor-line-spacing-menu-separator role=separator>"),ox=pt('<button type=button class="oasis-editor-line-spacing-item oasis-editor-line-spacing-item-more"role=menuitem data-testid=editor-toolbar-line-spacing-options><span class=oasis-editor-line-spacing-item-check aria-hidden=true></span><span class=oasis-editor-line-spacing-item-label>'),ix=pt("<div class=oasis-editor-toolbar-dropdown>"),lx=pt('<button type=button class="oasis-editor-tool-button oasis-editor-tool-button-dropdown oasis-editor-line-spacing-button"aria-haspopup=menu data-testid=editor-toolbar-line-spacing><span class=oasis-editor-line-spacing-icon aria-hidden=true><svg xmlns=http://www.w3.org/2000/svg width=18 height=18 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><polyline points="4 7 7 4 10 7"></polyline><line x1=7 y1=4 x2=7 y2=20></line><polyline points="4 17 7 20 10 17"></polyline><line x1=13 y1=6 x2=21 y2=6></line><line x1=13 y1=12 x2=21 y2=12></line><line x1=13 y1=18 x2=21 y2=18>'),sx=pt('<svg xmlns=http://www.w3.org/2000/svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2.5 stroke-linecap=round stroke-linejoin=round><polyline points="20 6 9 17 4 12">'),dx=pt("<button type=button class=oasis-editor-line-spacing-item role=menuitemradio><span class=oasis-editor-line-spacing-item-check aria-hidden=true></span><span class=oasis-editor-line-spacing-item-label>");const cx=[1,1.15,1.5,2,2.5,3];function hx(t){return null==t?"":String(t)}function px(t){const e=t.api,[a,n]=y(!1),[r,o]=y(!1),[i,l]=y({lineHeight:"",spacingBefore:"",spacingAfter:""}),s=w(()=>{const t=hx(e.commands.state("setLineHeight").value);if(""===t)return null;const a=Number(t);return Number.isFinite(a)?a:null}),d=()=>n(!1),c=()=>{l({lineHeight:hx(e.commands.state("setLineHeight").value),spacingBefore:hx(e.commands.state("setSpacingBefore").value),spacingAfter:hx(e.commands.state("setSpacingAfter").value)}),o(!0),d()},h=(t,a)=>{const n=a.lineHeight?Number(a.lineHeight):null,r=a.spacingBefore?Number(a.spacingBefore):null,o=a.spacingAfter?Number(a.spacingAfter):null;t.lineHeight!==n&&e.commands.execute("setLineHeight",t.lineHeight),t.spacingBefore!==r&&e.commands.execute("setSpacingBefore",t.spacingBefore),t.spacingAfter!==o&&e.commands.execute("setSpacingAfter",t.spacingAfter),e.focusEditor()};return wt(p=ix(),Z(vc,{get open(){return a()},onOpenChange:n,panelRole:"menu",panelClass:"oasis-editor-toolbar-dropdown-menu oasis-editor-line-spacing-menu",trigger:t=>{return(e=lx()).$$click=()=>t.toggle(),xt(e=>t.ref(e),e),M(a=>{var n=!!t.open,r=Pt("metric.lineSpacing"),o=Pt("metric.lineSpacing"),i=t.open;return n!==a.e&&e.classList.toggle("oasis-editor-tool-button-active",a.e=n),r!==a.t&&ft(e,"title",a.t=r),o!==a.a&&ft(e,"aria-label",a.a=o),i!==a.o&&ft(e,"aria-expanded",a.o=i),a},{e:void 0,t:void 0,a:void 0,o:void 0}),e;var e},get children(){return[Z($,{each:cx,children:t=>{const a=function(t){return t.toFixed(t===Math.floor(t)?1:2)}(t),n=()=>{const e=s();return null!==e&&(a=e,n=t,Math.abs(a-n)<.001);var a,n};return r=dx(),o=r.firstChild,i=o.nextSibling,r.$$click=()=>(t=>{e.commands.execute("setLineHeight",t),e.focusEditor(),d()})(t),wt(o,Z(et,{get when(){return n()},get children(){return sx()}})),wt(i,a),M(t=>{var e=!!n(),o=n(),i=`editor-toolbar-line-spacing-${a.replace(".","_")}`,l=Pt("metric.lineSpacingOption",[a]);return e!==t.e&&r.classList.toggle("oasis-editor-line-spacing-item-active",t.e=e),o!==t.t&&ft(r,"aria-checked",t.t=o),i!==t.a&&ft(r,"data-testid",t.a=i),l!==t.o&&ft(r,"title",t.o=l),t},{e:void 0,t:void 0,a:void 0,o:void 0}),r;var r,o,i}}),rx(),(t=ox(),a=t.firstChild.nextSibling,t.$$click=c,wt(a,()=>Pt("metric.lineSpacingOptions")),t)];var t,a}}),null),wt(p,Z(et,{get when(){return r()},get children(){return Z(Rt,{get children(){return Z(nx,{get isOpen(){return r()},get initial(){return i()},onClose:()=>o(!1),onApply:h})}})}}),null),p;var p}ut(["click"]);var ux=pt('<div class="oasis-editor-toolbar-panel-section oasis-editor-toolbar-panel-actions">'),fx=pt("<div class=oasis-editor-toolbar-panel-grid><label class=oasis-editor-tool-metric><span></span><input type=number class=oasis-editor-tool-number data-testid=editor-toolbar-spacing-after min=0 step=1></label><label class=oasis-editor-tool-metric><span></span><input type=number class=oasis-editor-tool-number data-testid=editor-toolbar-indent-left min=0 step=1></label><label class=oasis-editor-tool-metric><span></span><input type=number class=oasis-editor-tool-number data-testid=editor-toolbar-indent-first-line step=1></label><label class=oasis-editor-tool-metric><span></span><input type=number class=oasis-editor-tool-number data-testid=editor-toolbar-indent-hanging min=0 step=1></label><label class=oasis-editor-tool-color><span></span><input type=color class=oasis-editor-tool-color-input data-testid=editor-toolbar-paragraph-shading>");const gx=(t,e)=>{const a=t.commands.state(e).value;return null==a?"":String(a)};ut(["input"]);var mx=pt('<div class="oasis-editor-toolbar-panel-section oasis-editor-toolbar-panel-actions">'),vx=pt("<div class=oasis-editor-toolbar-badge data-testid=editor-table-selection-label>");function bx(t){const e=t.api,a=t=>!e.commands.state(t).isEnabled;return Z(Ac,{icon:"table-properties",testId:"editor-toolbar-table-dropdown",get tooltip(){return Pt("toolbar.table")},hideChevron:!0,panelClass:"oasis-editor-toolbar-panel oasis-editor-toolbar-table-panel",keepMounted:!0,get children(){return[(l=mx(),wt(l,Z(fc,{icon:"combine","data-testid":"editor-toolbar-merge-table",get disabled(){return a("tableMerge")},onClick:()=>e.commands.execute("tableMerge"),get tooltip(){return Pt("table.mergeTooltip")}}),null),wt(l,Z(fc,{icon:"split","data-testid":"editor-toolbar-split-table",get disabled(){return a("tableSplit")},onClick:()=>e.commands.execute("tableSplit"),get tooltip(){return Pt("table.splitTooltip")}}),null),l),(i=mx(),wt(i,Z(fc,{icon:"columns","data-testid":"editor-toolbar-insert-table-column-before",get disabled(){return a("tableInsertColumnBefore")},onClick:()=>e.commands.execute("tableInsertColumnBefore"),get tooltip(){return Pt("table.insertColumnLeft")}}),null),wt(i,Z(fc,{icon:"columns","data-testid":"editor-toolbar-insert-table-column-after",get disabled(){return a("tableInsertColumnAfter")},onClick:()=>e.commands.execute("tableInsertColumnAfter"),get tooltip(){return Pt("table.insertColumnRight")}}),null),wt(i,Z(fc,{icon:"trash-2","data-testid":"editor-toolbar-delete-table-column",get disabled(){return a("tableDeleteColumn")},onClick:()=>e.commands.execute("tableDeleteColumn"),get tooltip(){return Pt("table.deleteColumn")}}),null),i),(o=mx(),wt(o,Z(fc,{icon:"rows","data-testid":"editor-toolbar-insert-table-row-before",get disabled(){return a("tableInsertRowBefore")},onClick:()=>e.commands.execute("tableInsertRowBefore"),get tooltip(){return Pt("table.insertRowAbove")}}),null),wt(o,Z(fc,{icon:"rows","data-testid":"editor-toolbar-insert-table-row-after",get disabled(){return a("tableInsertRowAfter")},onClick:()=>e.commands.execute("tableInsertRowAfter"),get tooltip(){return Pt("table.insertRowBelow")}}),null),wt(o,Z(fc,{icon:"trash-2","data-testid":"editor-toolbar-delete-table-row",get disabled(){return a("tableDeleteRow")},onClick:()=>e.commands.execute("tableDeleteRow"),get tooltip(){return Pt("table.deleteRow")}}),null),o),(r=mx(),wt(r,Z(fc,{icon:"palette","data-testid":"editor-toolbar-table-shading",onClick:()=>{const t=prompt(Pt("table.cellBgColorPrompt"),"#f1f5f9");null!==t&&e.commands.execute("tableCellShading",t)},get tooltip(){return Pt("table.cellColor")}}),null),wt(r,Z(fc,{icon:"frame","data-testid":"editor-toolbar-table-borders",onClick:()=>e.commands.execute("tableCellBorders"),get tooltip(){return Pt("table.applyBorders")}}),null),wt(r,Z(fc,{icon:"square","data-testid":"editor-toolbar-table-no-borders",onClick:()=>e.commands.execute("tableCellNoBorders"),get tooltip(){return Pt("table.removeBorders")}}),null),r),(n=mx(),wt(n,Z(fc,{icon:"maximize","data-testid":"editor-toolbar-table-width-100",onClick:()=>e.commands.execute("tableWidth100"),get tooltip(){return Pt("table.width100Tooltip")}})),n),(t=mx(),wt(t,Z(fc,{icon:"align-left","data-testid":"editor-toolbar-table-align-left",onClick:()=>e.commands.execute("tableAlignLeft"),get tooltip(){return Pt("table.alignLeft")}}),null),wt(t,Z(fc,{icon:"align-center","data-testid":"editor-toolbar-table-align-center",onClick:()=>e.commands.execute("tableAlignCenter"),get tooltip(){return Pt("table.alignCenter")}}),null),wt(t,Z(fc,{icon:"align-right","data-testid":"editor-toolbar-table-align-right",onClick:()=>e.commands.execute("tableAlignRight"),get tooltip(){return Pt("table.alignRight")}}),null),wt(t,Z(fc,{icon:"move-horizontal","data-testid":"editor-toolbar-table-cell-width",onClick:()=>{const t=prompt(Pt("table.cellWidthPrompt"));t&&e.commands.execute("tableSetCellWidth",t)},get tooltip(){return Pt("table.cellWidth")}}),null),t),Z(et,{get when(){return e.commands.state("tableContext").value},children:t=>{return wt(e=vx(),t),e;var e}})];var t,n,r,o,i,l}})}var yx=pt('<div class="oasis-editor-toolbar-panel-section oasis-editor-toolbar-panel-actions">');const Mx=96/2.54;function xx(t){return Math.round(t*Mx)}function wx(t){return Math.round(t/Mx*100)/100}const Sx=[{id:"normal",labelKey:"section.marginPreset.normal",top:2.5,bottom:2.5,left:3,right:3},{id:"narrow",labelKey:"section.marginPreset.narrow",top:1.27,bottom:1.27,left:1.27,right:1.27},{id:"moderate",labelKey:"section.marginPreset.moderate",top:2.54,bottom:2.54,left:1.91,right:1.91},{id:"wide",labelKey:"section.marginPreset.wide",top:2.54,bottom:2.54,left:5.08,right:5.08},{id:"mirrored",labelKey:"section.marginPreset.mirrored",top:2.54,bottom:2.54,left:3.18,right:2.54}];function Ax(t){return{top:xx(t.top),bottom:xx(t.bottom),left:xx(t.left),right:xx(t.right)}}var Ix=pt("<div class=oasis-editor-margins-list>"),Tx=pt("<div class=oasis-editor-margins-custom-form>"),Cx=pt("<div class=oasis-editor-toolbar-list-options><button type=button class=oasis-editor-margins-custom-toggle data-testid=editor-toolbar-margins-custom><i data-lucide=sliders-horizontal></i><span>"),kx=pt("<div class=oasis-editor-margins-custom-actions><button type=button class=oasis-editor-margins-custom-apply data-testid=editor-toolbar-margins-custom-apply>"),Vx=pt("<button type=button class=oasis-editor-margins-item><span class=oasis-editor-margins-item-name></span><span class=oasis-editor-margins-item-values><br>"),Ex=pt("<label class=oasis-editor-margins-custom-field><span></span><input type=number min=0 step=0.1>");const Rx=[{key:"top",labelKey:"section.marginField.top"},{key:"bottom",labelKey:"section.marginField.bottom"},{key:"left",labelKey:"section.marginField.left"},{key:"right",labelKey:"section.marginField.right"}];function Lx(t){return Pt("section.marginValue",[String(t).replace(".",Pt("number.decimalSeparator"))])}function zx(t){const e=t.api,[a,n]=y(!1),[r,o]=y({}),i=w(()=>e.commands.state("setPageMargins").value),l=w(()=>{var t;const e=i();if(e)return null==(t=Sx.find(t=>function(t,e){const a=Ax(e);return Math.abs(t.top-a.top)<=1&&Math.abs(t.bottom-a.bottom)<=1&&Math.abs(t.left-a.left)<=1&&Math.abs(t.right-a.right)<=1}(e,t)))?void 0:t.id}),s=()=>{const t=i();o({top:t?String(wx(t.top)):"",bottom:t?String(wx(t.bottom)):"",left:t?String(wx(t.left)):"",right:t?String(wx(t.right)):""}),n(t=>!t)},d=()=>{const t=r(),a={};for(const{key:e}of Rx){const n=t[e];if(null==n||""===n)continue;const r=Number(n.replace(",","."));Number.isFinite(r)&&r>=0&&(a[e]=xx(r))}Object.keys(a).length>0&&e.commands.execute("setPageMargins",a),e.focusEditor()};return Z(Ac,{icon:"square-dashed",get label(){return Pt("section.margins")},testId:"editor-toolbar-margins-dropdown",get tooltip(){return Pt("section.margins")},panelClass:"oasis-editor-toolbar-panel oasis-editor-margins-panel",keepMounted:!0,get children(){return[(c=Ix(),wt(c,Z($,{each:Sx,children:t=>{return a=Vx(),n=a.firstChild,r=n.nextSibling,o=r.firstChild,a.$$click=()=>(t=>{e.commands.execute("setPageMargins",Ax(t)),e.focusEditor()})(t),wt(n,()=>Pt(t.labelKey)),wt(r,()=>`${Pt("section.marginField.top")} ${Lx(t.top)} ${Pt("section.marginField.bottom")} ${Lx(t.bottom)}`,o),wt(r,()=>`${Pt("section.marginField.left")} ${Lx(t.left)} ${Pt("section.marginField.right")} ${Lx(t.right)}`,null),M(e=>{var n=!(l()!==t.id),r=`editor-toolbar-margins-${t.id}`;return n!==e.e&&a.classList.toggle("oasis-editor-margins-item-active",e.e=n),r!==e.t&&ft(a,"data-testid",e.t=r),e},{e:void 0,t:void 0}),a;var a,n,r,o}})),c),(t=Cx(),n=t.firstChild,i=n.firstChild.nextSibling,n.$$click=s,wt(i,()=>Pt("section.marginPreset.custom")),wt(t,Z(et,{get when(){return a()},get children(){var t=Tx();return wt(t,Z($,{each:Rx,children:t=>{return e=Ex(),a=e.firstChild,n=a.nextSibling,wt(a,()=>Pt(t.labelKey)),n.$$input=e=>o(a=>({...a,[t.key]:e.currentTarget.value})),M(()=>n.value=r()[t.key]??""),e;var e,a,n}})),t}}),null),t),Z(et,{get when(){return a()},get children(){var t=kx(),e=t.firstChild;return e.$$click=d,wt(e,()=>Pt("section.marginApply")),t}})];var t,n,i,c}})}ut(["click","input"]);const Nx=/Mac/i.test(navigator.userAgent)?"⌘":"Ctrl",qx=t=>t.commands.state("documentStyles").value??[],Ox=t=>{const e=new Set(["Arial","Calibri, sans-serif","Calibri Light, sans-serif","Georgia","Inter","Open Sans, sans-serif","Times New Roman","Courier New"]);for(const n of qx(t))n.fontFamily&&e.add(n.fontFamily);const a=String(t.commands.state("setFontFamily").value??"").trim();return a&&e.add(a),Array.from(e).sort((t,e)=>t.localeCompare(e)).map(t=>({value:t,label:t}))},Px=t=>{const e=new Set(VM);for(const n of qx(t))"number"==typeof n.fontSize&&Number.isFinite(n.fontSize)&&e.add(EM(n.fontSize));const a=Number(t.commands.state("setFontSize").value);return Number.isFinite(a)&&a>0&&e.add(a),Array.from(e).sort((t,e)=>t-e).map(t=>({value:String(t),label:String(t)}))},Wx=t=>qx(t).map(t=>({value:t.id,label:t.name})),Hx=[{command:"alignLeft",icon:"align-left",testId:"editor-toolbar-align-left",tooltipKey:"toolbar.alignLeft"},{command:"alignCenter",icon:"align-center",testId:"editor-toolbar-align-center",tooltipKey:"toolbar.alignCenter"},{command:"alignRight",icon:"align-right",testId:"editor-toolbar-align-right",tooltipKey:"toolbar.alignRight"},{command:"alignJustify",icon:"align-justify",testId:"editor-toolbar-align-justify",tooltipKey:"toolbar.justify"}],Ux=[{command:"bulletList",icon:"list",testId:"editor-toolbar-list-bullet",tooltipKey:"toolbar.bulletList"},{command:"orderedList",icon:"list-ordered",testId:"editor-toolbar-list-ordered",tooltipKey:"toolbar.numberedList"}],Fx={"editor-toolbar-file-dropdown":{tab:"file",group:"document",row:1},"sep-file":{tab:"file",group:"document",row:1},"editor-toolbar-undo":{tab:"home",group:"clipboard",row:1},"editor-toolbar-redo":{tab:"home",group:"clipboard",row:2},"sep-history":{tab:"home",group:"clipboard",row:2},"editor-toolbar-style":{tab:"home",group:"styles",row:1},"editor-toolbar-font-family":{tab:"home",group:"font",row:1},"editor-toolbar-font-size":{tab:"home",group:"font",row:1},"editor-toolbar-font-increase":{tab:"home",group:"font",row:1},"editor-toolbar-font-decrease":{tab:"home",group:"font",row:1},"editor-toolbar-change-case":{tab:"home",group:"font",row:1},"editor-toolbar-clear-formatting":{tab:"home",group:"font",row:1},"editor-toolbar-color":{tab:"home",group:"font",row:2},"editor-toolbar-highlight":{tab:"home",group:"font",row:2},"editor-toolbar-text-shading":{tab:"home",group:"font",row:2},"sep-style":{tab:"home",group:"font",row:2},"editor-toolbar-bold":{tab:"home",group:"font",row:2},"editor-toolbar-italic":{tab:"home",group:"font",row:2},"editor-toolbar-underline-control":{tab:"home",group:"font",row:2},"editor-toolbar-strike":{tab:"home",group:"font",row:2},"editor-toolbar-superscript":{tab:"home",group:"font",row:2},"editor-toolbar-subscript":{tab:"home",group:"font",row:2},"sep-format":{tab:"home",group:"font",row:2},"editor-toolbar-insert-image":{tab:"insert",group:"illustrations",row:1},"editor-toolbar-insert-shape":{tab:"insert",group:"illustrations",row:2},"editor-toolbar-insert-table":{tab:"insert",group:"tables",row:1},"editor-toolbar-link":{tab:"insert",group:"links",row:1},"editor-toolbar-unlink":{tab:"insert",group:"links",row:2},"editor-toolbar-footnote":{tab:"references",group:"footnotes",row:1},"editor-toolbar-image-alt":{tab:"insert",group:"accessibility",row:2},"editor-toolbar-image-caption":{tab:"insert",group:"accessibility",row:1},"sep-insert":{tab:"insert",group:"accessibility",row:2},"editor-toolbar-align-left":{tab:"home",group:"paragraph",row:2},"editor-toolbar-align-center":{tab:"home",group:"paragraph",row:2},"editor-toolbar-align-right":{tab:"home",group:"paragraph",row:2},"editor-toolbar-align-justify":{tab:"home",group:"paragraph",row:2},"editor-toolbar-list-bullet":{tab:"home",group:"paragraph",row:1},"editor-toolbar-list-ordered":{tab:"home",group:"paragraph",row:1},"editor-toolbar-list-outdent":{tab:"home",group:"paragraph",row:1},"editor-toolbar-list-indent":{tab:"home",group:"paragraph",row:1},"editor-toolbar-list-options":{tab:"home",group:"paragraph",row:1},"editor-toolbar-special-indent":{tab:"home",group:"paragraph",row:1},"editor-toolbar-line-spacing-control":{tab:"home",group:"paragraph",row:2},"sep-paragraph":{tab:"home",group:"paragraph",row:2},"editor-toolbar-metrics":{tab:"layout",group:"paragraph",row:1},"sep-metrics":{tab:"layout",group:"paragraph",row:2},"editor-toolbar-table":{tab:"layout",group:"table",row:1},"sep-table":{tab:"layout",group:"table",row:2},"editor-toolbar-margins":{tab:"layout",group:"section",row:1},"editor-toolbar-section":{tab:"layout",group:"section",row:1}};function Bx(){const t=[];t.push({type:"menu",id:"editor-toolbar-file-dropdown",group:"file",iconName:"file",tooltipKey:"toolbar.file",content:{kind:"items",items:[{type:"button",id:"editor-toolbar-export-docx",testId:"editor-toolbar-export-docx",iconName:"file-text",labelKey:"toolbar.exportDocx",wide:!0,tooltipKey:"toolbar.exportDocx",command:"exportDocx"},{type:"button",id:"editor-toolbar-export-pdf",testId:"editor-toolbar-export-pdf",iconName:"file-down",labelKey:"toolbar.exportPdf",wide:!0,tooltipKey:"toolbar.exportPdf",command:"exportPdf"},{type:"button",id:"editor-toolbar-import-document",testId:"editor-toolbar-import-document",iconName:"upload",labelKey:"toolbar.import",wide:!0,tooltipKey:"toolbar.import",command:"importDocument"}]}}),t.push({type:"separator",id:"sep-file",group:"file"}),t.push({type:"button",id:"editor-toolbar-undo",testId:"editor-toolbar-undo",iconName:"undo",command:"undo",tooltip:`${Pt("toolbar.undo")} (${Nx}+Z)`}),t.push({type:"button",id:"editor-toolbar-redo",testId:"editor-toolbar-redo",iconName:"redo",command:"redo",tooltip:`${Pt("toolbar.redo")} (${Nx}+Shift+Z)`}),t.push({type:"separator",id:"sep-history"}),t.push({type:"select",id:"editor-toolbar-style",testId:"editor-toolbar-style",width:"wide",tooltipKey:"toolbar.style",command:"setStyleId",options:Wx}),t.push({type:"select",id:"editor-toolbar-font-family",testId:"editor-toolbar-font-family",tooltipKey:"toolbar.fontFamily",placeholder:Pt("toolbar.font"),command:"setFontFamily",options:Ox}),t.push({type:"select",id:"editor-toolbar-font-size",testId:"editor-toolbar-font-size",width:"small",tooltipKey:"toolbar.fontSize",command:"setFontSize",options:Px}),t.push({type:"button",id:"editor-toolbar-font-increase",testId:"editor-toolbar-font-increase",iconName:"a-arrow-up",command:"increaseFontSize",tooltipKey:"toolbar.increaseFontSize"}),t.push({type:"button",id:"editor-toolbar-font-decrease",testId:"editor-toolbar-font-decrease",iconName:"a-arrow-down",command:"decreaseFontSize",tooltipKey:"toolbar.decreaseFontSize"}),t.push({type:"menu",id:"editor-toolbar-change-case",testId:"editor-toolbar-change-case",iconName:"case-sensitive",tooltipKey:"toolbar.changeCase",isDisabled:t=>!t.commands.state({name:"changeTextCase"}).isEnabled,content:{kind:"items",items:[{type:"button",id:"editor-toolbar-case-sentence",testId:"editor-toolbar-case-sentence",labelKey:"toolbar.caseSentence",wide:!0,tooltipKey:"toolbar.caseSentence",command:{name:"changeTextCase",payload:"sentence"}},{type:"button",id:"editor-toolbar-case-lower",testId:"editor-toolbar-case-lower",labelKey:"toolbar.caseLower",wide:!0,tooltipKey:"toolbar.caseLower",command:{name:"changeTextCase",payload:"lower"}},{type:"button",id:"editor-toolbar-case-upper",testId:"editor-toolbar-case-upper",labelKey:"toolbar.caseUpper",wide:!0,tooltipKey:"toolbar.caseUpper",command:{name:"changeTextCase",payload:"upper"}},{type:"button",id:"editor-toolbar-case-capitalize",testId:"editor-toolbar-case-capitalize",labelKey:"toolbar.caseCapitalize",wide:!0,tooltipKey:"toolbar.caseCapitalize",command:{name:"changeTextCase",payload:"capitalize"}},{type:"button",id:"editor-toolbar-case-toggle",testId:"editor-toolbar-case-toggle",labelKey:"toolbar.caseToggle",wide:!0,tooltipKey:"toolbar.caseToggle",command:{name:"changeTextCase",payload:"toggle"}}]}}),t.push({type:"button",id:"editor-toolbar-clear-formatting",testId:"editor-toolbar-clear-formatting",iconName:"remove-formatting",command:"clearFormatting",tooltipKey:"toolbar.clearFormatting"}),t.push({type:"toggle",id:"editor-toolbar-bold",testId:"editor-toolbar-bold",iconName:"bold",command:"bold",tooltipKey:"toolbar.bold"}),t.push({type:"toggle",id:"editor-toolbar-italic",testId:"editor-toolbar-italic",iconName:"italic",command:"italic",tooltipKey:"toolbar.italic"}),t.push({type:"custom",id:"editor-toolbar-underline-control",render:t=>ZM({api:t})}),t.push({type:"toggle",id:"editor-toolbar-strike",testId:"editor-toolbar-strike",iconName:"strikethrough",command:"strike",tooltipKey:"toolbar.strike"}),t.push({type:"toggle",id:"editor-toolbar-subscript",testId:"editor-toolbar-subscript",iconName:"subscript",command:"subscript",tooltipKey:"toolbar.subscript"}),t.push({type:"toggle",id:"editor-toolbar-superscript",testId:"editor-toolbar-superscript",iconName:"superscript",command:"superscript",tooltipKey:"toolbar.superscript"}),t.push({type:"separator",id:"sep-format"}),t.push({type:"colorPicker",id:"editor-toolbar-color",testId:"editor-toolbar-color",kind:"color",iconName:"type",defaultValue:"#111827",tooltipKey:"toolbar.color",command:"setColor"}),t.push({type:"colorPicker",id:"editor-toolbar-highlight",testId:"editor-toolbar-highlight",kind:"highlight",iconName:"highlighter",defaultValue:"#fef08a",tooltipKey:"toolbar.highlight",command:"setHighlight"}),t.push({type:"colorPicker",id:"editor-toolbar-text-shading",testId:"editor-toolbar-text-shading",kind:"shading",iconName:"paint-bucket",defaultValue:"#fef3c7",tooltipKey:"toolbar.textShading",command:"setTextShading"}),t.push({type:"separator",id:"sep-style"}),t.push({type:"button",id:"editor-toolbar-insert-image",testId:"editor-toolbar-insert-image",iconName:"image",tooltipKey:"toolbar.image",command:"insertImage"}),t.push({type:"menu",id:"editor-toolbar-insert-shape",testId:"editor-toolbar-insert-shape",iconName:"shapes",tooltipKey:"toolbar.shapes",content:{kind:"items",items:[{type:"button",id:"editor-toolbar-shape-rect",testId:"editor-toolbar-shape-rect",labelKey:"toolbar.shape.rect",wide:!0,tooltipKey:"toolbar.shape.rect",command:{name:"insertShape",payload:"rect"}},{type:"button",id:"editor-toolbar-shape-roundRect",testId:"editor-toolbar-shape-roundRect",labelKey:"toolbar.shape.roundRect",wide:!0,tooltipKey:"toolbar.shape.roundRect",command:{name:"insertShape",payload:"roundRect"}},{type:"button",id:"editor-toolbar-shape-ellipse",testId:"editor-toolbar-shape-ellipse",labelKey:"toolbar.shape.ellipse",wide:!0,tooltipKey:"toolbar.shape.ellipse",command:{name:"insertShape",payload:"ellipse"}},{type:"button",id:"editor-toolbar-shape-triangle",testId:"editor-toolbar-shape-triangle",labelKey:"toolbar.shape.triangle",wide:!0,tooltipKey:"toolbar.shape.triangle",command:{name:"insertShape",payload:"triangle"}},{type:"button",id:"editor-toolbar-shape-rtTriangle",testId:"editor-toolbar-shape-rtTriangle",labelKey:"toolbar.shape.rtTriangle",wide:!0,tooltipKey:"toolbar.shape.rtTriangle",command:{name:"insertShape",payload:"rtTriangle"}},{type:"button",id:"editor-toolbar-shape-diamond",testId:"editor-toolbar-shape-diamond",labelKey:"toolbar.shape.diamond",wide:!0,tooltipKey:"toolbar.shape.diamond",command:{name:"insertShape",payload:"diamond"}}]}}),t.push({type:"gridPicker",id:"editor-toolbar-insert-table",testId:"editor-toolbar-insert-table",tooltipKey:"toolbar.table",command:"insertTable"}),t.push({type:"button",id:"editor-toolbar-link",testId:"editor-toolbar-link",iconName:"link",command:"link",tooltip:`${Pt("toolbar.link")} (${Nx}+K)`}),t.push({type:"button",id:"editor-toolbar-unlink",testId:"editor-toolbar-unlink",iconName:"unlink",command:"unlink",tooltipKey:"toolbar.unlink"}),t.push({type:"button",id:"editor-toolbar-footnote",testId:"editor-toolbar-footnote",iconName:"footnote",command:"insertFootnote",tooltip:`${Pt("toolbar.footnote")} (${Nx}+Alt+F)`}),t.push({type:"button",id:"editor-toolbar-image-alt",testId:"editor-toolbar-image-alt",iconName:"file-text",tooltipKey:"toolbar.alt",command:"editImageAlt",isVisible:t=>t.commands.state("editImageAlt").isEnabled}),t.push({type:"button",id:"editor-toolbar-image-caption",testId:"editor-toolbar-image-caption",iconName:"subtitles",tooltipKey:"toolbar.imageCaption",command:"insertImageCaption",isVisible:t=>t.commands.state("insertImageCaption").isEnabled}),t.push({type:"separator",id:"sep-insert"});for(const e of Hx)t.push({type:"toggle",id:e.testId,testId:e.testId,iconName:e.icon,command:e.command,tooltipKey:e.tooltipKey});for(const e of Ux)t.push({type:"toggle",id:e.testId,testId:e.testId,iconName:e.icon,command:e.command,tooltipKey:e.tooltipKey});return t.push({type:"button",id:"editor-toolbar-list-outdent",testId:"editor-toolbar-list-outdent",iconName:"indent-decrease",tooltipKey:"toolbar.decreaseIndent",command:"outdent"}),t.push({type:"button",id:"editor-toolbar-list-indent",testId:"editor-toolbar-list-indent",iconName:"indent-increase",tooltipKey:"toolbar.increaseIndent",command:"indent"}),t.push({type:"custom",id:"editor-toolbar-list-options",render:t=>function(t){const e=t.api;return Z(Ac,{icon:"list-filter",get tooltip(){return Pt("toolbar.listFormat")},testId:"editor-toolbar-list-options-dropdown",hideChevron:!0,get children(){var t=QM(),a=t.firstChild,n=a.firstChild,r=a.nextSibling.firstChild,o=r.nextSibling;return wt(n,()=>Pt("toolbar.listFormat")),wt(a,Z(Tc,{"data-testid":"editor-toolbar-list-format",onChange:t=>e.commands.execute("setListFormat",t.currentTarget.value),get tooltip(){return Pt("toolbar.listFormat")},get children(){return[(o=KM(),wt(o,()=>Pt("toolbar.formatDecimal")),o),(r=DM(),wt(r,()=>Pt("toolbar.formatLowerLetter")),r),(n=jM(),wt(n,()=>Pt("toolbar.formatUpperLetter")),n),(a=XM(),wt(a,()=>Pt("toolbar.formatLowerRoman")),a),(e=JM(),wt(e,()=>Pt("toolbar.formatUpperRoman")),e),(t=YM(),wt(t,()=>Pt("toolbar.formatBullet")),t)];var t,e,a,n,r,o}}),null),wt(r,()=>Pt("toolbar.listStartAt")),o.addEventListener("change",t=>e.commands.execute("setListStartAt",t.currentTarget.value)),M(()=>ft(o,"title",Pt("toolbar.listStartAt"))),t}})}({api:t})}),t.push({type:"split",id:"editor-toolbar-special-indent",testId:"editor-toolbar-special-indent",iconName:"specialIndentFirstLine",tooltipKey:"toolbar.specialIndent",command:{name:"setSpecialIndent",payload:{kind:"firstLine"}},isActive:()=>!1,panelClass:"oasis-editor-toolbar-dropdown-menu oasis-editor-special-indent-menu",menu:{kind:"items",items:[{type:"button",id:"editor-toolbar-special-indent-none",testId:"editor-toolbar-special-indent-none",iconName:"minus",labelKey:"toolbar.specialIndentNone",tooltipKey:"toolbar.specialIndentNone",command:{name:"setSpecialIndent",payload:{kind:"none"}},wide:!0},{type:"button",id:"editor-toolbar-special-indent-first-line",testId:"editor-toolbar-special-indent-first-line",iconName:"list-collapse",labelKey:"toolbar.specialIndentFirstLine",tooltipKey:"toolbar.specialIndentFirstLine",command:{name:"setSpecialIndent",payload:{kind:"firstLine"}},wide:!0},{type:"button",id:"editor-toolbar-special-indent-hanging",testId:"editor-toolbar-special-indent-hanging",iconName:"list-indent-increase",labelKey:"toolbar.specialIndentHanging",tooltipKey:"toolbar.specialIndentHanging",command:{name:"setSpecialIndent",payload:{kind:"hanging"}},wide:!0}]}}),t.push({type:"custom",id:"editor-toolbar-line-spacing-control",render:t=>px({api:t})}),t.push({type:"separator",id:"sep-paragraph"}),t.push({type:"custom",id:"editor-toolbar-metrics",render:t=>function(t){const e=t.api,a=t=>a=>e.commands.execute(t,a.currentTarget.value);return Z(Ac,{icon:"sliders-horizontal",testId:"editor-toolbar-metrics-dropdown",get tooltip(){return Pt("metric.leftIndent")},hideChevron:!0,panelClass:"oasis-editor-toolbar-panel",keepMounted:!0,get children(){return[(b=ux(),wt(b,Z(fc,{icon:"file-up",get active(){return e.commands.state("togglePageBreakBefore").isActive},"data-testid":"editor-toolbar-page-break-before",onClick:()=>e.commands.execute("togglePageBreakBefore"),get tooltip(){return Pt("metric.pageBreakBefore")}}),null),wt(b,Z(fc,{icon:"link-2",get active(){return e.commands.state("toggleKeepWithNext").isActive},"data-testid":"editor-toolbar-keep-with-next",onClick:()=>e.commands.execute("toggleKeepWithNext"),get tooltip(){return Pt("metric.keepWithNext")}}),null),b),(t=fx(),n=t.firstChild,r=n.firstChild,o=r.nextSibling,i=n.nextSibling,l=i.firstChild,s=l.nextSibling,d=i.nextSibling,c=d.firstChild,h=c.nextSibling,p=d.nextSibling,u=p.firstChild,f=u.nextSibling,g=p.nextSibling,m=g.firstChild,v=m.nextSibling,wt(r,()=>Pt("metric.after")),mt(o,"change",a("setSpacingAfter")),wt(l,()=>Pt("metric.indent")),mt(s,"change",a("setIndentLeft")),wt(c,()=>Pt("metric.first")),mt(h,"change",a("setIndentFirstLine")),wt(u,()=>Pt("metric.hang")),mt(f,"change",a("setIndentHanging")),wt(m,()=>Pt("metric.paraBg")),v.$$input=t=>e.commands.execute("setParagraphShading",t.currentTarget.value),wt(t,Z(fc,{icon:"frame","data-testid":"editor-toolbar-paragraph-borders",onClick:()=>e.commands.execute("applyParagraphBorders"),get tooltip(){return Pt("metric.applyBorders")}}),null),M(t=>{var e=Pt("metric.spacingAfter"),a=Pt("metric.leftIndent"),r=Pt("metric.firstLineIndent"),o=Pt("metric.hangingIndent"),l=Pt("metric.paragraphBgColor");return e!==t.e&&ft(n,"title",t.e=e),a!==t.t&&ft(i,"title",t.t=a),r!==t.a&&ft(d,"title",t.a=r),o!==t.o&&ft(p,"title",t.o=o),l!==t.i&&ft(g,"title",t.i=l),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),M(()=>o.value=gx(e,"setSpacingAfter")),M(()=>s.value=gx(e,"setIndentLeft")),M(()=>h.value=gx(e,"setIndentFirstLine")),M(()=>f.value=gx(e,"setIndentHanging")),M(()=>v.value=gx(e,"setParagraphShading")||"#ffffff"),t)];var t,n,r,o,i,l,s,d,c,h,p,u,f,g,m,v,b}})}({api:t})}),t.push({type:"separator",id:"sep-metrics"}),t.push({type:"custom",id:"editor-toolbar-table",isVisible:t=>t.commands.state("tableContext").isActive,render:t=>bx({api:t})}),t.push({type:"separator",id:"sep-table",isVisible:t=>t.commands.state("tableContext").isActive}),t.push({type:"custom",id:"editor-toolbar-margins",ribbonSize:"large",render:t=>zx({api:t})}),t.push({type:"custom",id:"editor-toolbar-section",ribbonSize:"large",render:t=>function(t){const e=t.api;return Z(Ac,{icon:"layout-template",get label(){return Pt("section.orientation")},testId:"editor-toolbar-section-dropdown",get tooltip(){return Pt("section.pageSetup")},panelClass:"oasis-editor-toolbar-panel",keepMounted:!0,get children(){return[(a=yx(),wt(a,Z(fc,{icon:"rectangle-vertical",get active(){return!e.commands.state("toggleOrientation").isActive},"data-testid":"editor-toolbar-orientation-portrait",onClick:()=>e.commands.execute({name:"setOrientation",payload:"portrait"}),get tooltip(){return Pt("section.portrait")}}),null),wt(a,Z(fc,{icon:"rectangle-horizontal",get active(){return e.commands.state("toggleOrientation").isActive},"data-testid":"editor-toolbar-orientation-landscape",onClick:()=>e.commands.execute({name:"setOrientation",payload:"landscape"}),get tooltip(){return Pt("section.landscape")}}),null),a),(t=yx(),wt(t,Z(fc,{icon:"scissors","data-testid":"editor-toolbar-section-break-next",onClick:()=>e.commands.execute("sectionBreakNextPage"),get tooltip(){return Pt("section.secNextTooltip")}}),null),wt(t,Z(fc,{icon:"scissors","data-testid":"editor-toolbar-section-break-continuous",onClick:()=>e.commands.execute("sectionBreakContinuous"),get tooltip(){return Pt("section.secContTooltip")}}),null),t)];var t,a}})}({api:t})}),function(t){return t.map((t,e)=>{const a=Fx[t.id]??{tab:"plugins",group:t.group??"general",row:1};return{...t,tab:t.tab??a.tab,group:a.group,row:t.row??a.row,order:t.order??e}})}(t)}function Gx(t,e){const a=ra(t);if(a.isCollapsed||a.startIndex!==a.endIndex||a.endParagraphOffset-a.startParagraphOffset!==1)return null;const n=_e(t)[a.startIndex];if(!n)return null;let r=0;for(let o=0;o<n.runs.length;o+=1){const t=n.runs[o],i=r;if(r+=t.text.length,e(t)&&1===t.text.length&&i===a.startParagraphOffset)return{paragraph:n,paragraphIndex:a.startIndex,run:t,runIndex:o,offset:i}}return null}function Zx(t,e){if("inline"===e)return;const a={...t??{type:"floating",allowOverlap:!0,positionH:{relativeFrom:"column",offset:0},positionV:{relativeFrom:"paragraph",offset:0}},type:"floating"};switch(e){case"square":case"tight":case"through":case"topAndBottom":return{...a,wrap:e,behindDoc:!1};case"behind":return{...a,wrap:"none",behindDoc:!0};case"front":return{...a,wrap:"none",behindDoc:!1}}}function Kx(t){return t?t.behindDoc?"behind":t.wrap&&"none"!==t.wrap?t.wrap:"front":"inline"}function Dx(t,e){return{...t,positionV:{...t.positionV??{},relativeFrom:e?"page":"paragraph"}}}function jx(t){var e;return"page"===(null==(e=null==t?void 0:t.positionV)?void 0:e.relativeFrom)}function Xx(t){return t?{...t}:void 0}function Jx(t,e){return JSON.stringify(t??null)===JSON.stringify(e??null)}function Yx(t,e,a){const n={...t??{}};return a?n[e]=!0:delete n[e],Object.keys(n).length>0?n:void 0}function Qx(t,e,a){const n={...t??{}};return null==a||""===a?delete n[e]:n[e]=a,Object.keys(n).length>0?n:void 0}function _x(t,e,a){const n={...t??{}};return null==a?delete n[e]:n[e]=a,Object.keys(n).length>0?n:void 0}function $x(t){return{...t,floating:t.floating?{...t.floating,positionH:t.floating.positionH?{...t.floating.positionH}:void 0,positionV:t.floating.positionV?{...t.floating.positionV}:void 0}:void 0,shape:t.shape?{...t.shape}:void 0,body:t.body?{...t.body}:void 0,blocks:rw(t.blocks)}}function tw(t){return{...t,styles:Xx(t.styles),image:t.image?{...t.image}:void 0,textBox:t.textBox?$x(t.textBox):void 0,field:t.field?{...t.field}:void 0,fieldChar:t.fieldChar?{...t.fieldChar}:void 0,revision:t.revision?{...t.revision}:void 0,footnoteReference:t.footnoteReference?{...t.footnoteReference}:void 0,endnoteReference:t.endnoteReference?{...t.endnoteReference}:void 0}}function ew(t){return{...t,runs:t.runs.map(tw),style:t.style?{...t.style}:void 0,list:t.list?{...t.list}:void 0}}function aw(t){return t?{...t}:void 0}function nw(t){return t.map(ew)}function rw(t){return t.map(t=>"paragraph"===t.type?ew(t):{...t,style:t.style?{...t.style,defaultCellMargins:t.style.defaultCellMargins?{...t.style.defaultCellMargins}:void 0,floating:t.style.floating?{...t.style.floating}:void 0,revisionXml:t.style.revisionXml?[...t.style.revisionXml]:void 0}:void 0,tblGridChangeXml:t.tblGridChangeXml,rows:t.rows.map(t=>({...t,style:t.style?{...t.style,revisionXml:t.style.revisionXml?[...t.style.revisionXml]:void 0}:void 0,cells:t.cells.map(t=>({...t,style:t.style?{...t.style,revisionXml:t.style.revisionXml?[...t.style.revisionXml]:void 0}:void 0,blocks:nw(t.blocks)}))}))})}function ow(t){const e=ma("");return e.fieldChar={kind:t},e}function iw(t){const e=ma("");return e.fieldInstruction=t,e}function lw(t,e,a){const n=ya([{text:`${e} `},{text:String(a)},{text:t?`: ${t}`:""}]);return n.style={styleId:"Caption",align:"center"},n.runs=[n.runs[0],ow("begin"),iw(" SEQ Figure \\* ARABIC "),ow("separate"),n.runs[1],ow("end"),n.runs[2]],n}function sw(t){var e,a;if(!t)return!1;return"caption"===(null==(a=null==(e=t.style)?void 0:e.styleId)?void 0:a.toLowerCase())&&t.runs.some(t=>void 0!==t.fieldInstruction&&new RegExp("\\bSEQ\\s+Figure\\b","i").test(t.fieldInstruction))}function dw(t,e){if(!sw(t))return ew(t);let a=!1,n=!1;const r=t.runs.map(t=>{var r,o;return"separate"===(null==(r=t.fieldChar)?void 0:r.kind)?(a=!0,{...t,fieldChar:{...t.fieldChar}}):"end"===(null==(o=t.fieldChar)?void 0:o.kind)?(a=!1,{...t,fieldChar:{...t.fieldChar}}):a&&""!==t.text?t.text===String(e)?{...t}:(n=!0,{...t,text:String(e)}):{...t}});return n?{...ew(t),runs:r}:ew(t)}function cw(t,e){return t.map(t=>"paragraph"===t.type?sw(t)?dw(t,e.next++):ew(t):{...t,rows:t.rows.map(t=>({...t,cells:t.cells.map(t=>({...t,blocks:cw(t.blocks,e)}))}))})}function hw(t){const e={next:1},a=We(t).map(t=>({...t,blocks:cw(t.blocks,e),header:t.header?rw(t.header):void 0,footer:t.footer?rw(t.footer):void 0}));return{...t,sections:a}}function pw(t){return Boolean(t.image||t.textBox)}function uw(t,e){const a=[];for(const n of t){if(0===n.text.length)continue;const t=a[a.length-1];!t||pw(n)||pw(t)||!Jx(t.styles,n.styles)?a.push({...n,styles:Xx(n.styles)}):t.text+=n.text}return a.length>0?a:[va("",e)]}function fw(t,e,a){return{...t,runs:uw(e,a),style:t.style?{...t.style}:void 0}}function gw(t){return ya(t)}function mw(t,e){const a=gw(e);return a.style=t.style?{...t.style}:void 0,a.list=aw(t.list),a}function vw(t,e){const a=ew(t);return a.list?(a.list={...a.list,level:Math.max(0,e)},a):a}function bw(t){const e=ew(t);return delete e.list,e}function yw(t,e){var a;if(0===t.runs.length)return;let n=0;for(let r=0;r<t.runs.length;r+=1){const a=t.runs[r],o=n+a.text.length;if(e<o)return Xx(a.styles);if(e===o){if(a.text.length>0)return Xx(a.styles);const e=t.runs[r+1];return Xx((null==e?void 0:e.styles)??a.styles)}n=o}return Xx(null==(a=t.runs[t.runs.length-1])?void 0:a.styles)}function Mw(t,e){var a,n,r;const o=function(t,e){let a=0;for(let n=0;n<t.runs.length;n+=1){const r=t.runs[n],o=a,i=a+r.text.length;if(e<i)return{run:r,startOffset:o,endOffset:i};if(e===i){if(r.text.length>0)return{run:r,startOffset:o,endOffset:i};const e=t.runs[n+1];return e?{run:e,startOffset:i,endOffset:i+e.text.length}:{run:r,startOffset:o,endOffset:i}}a=i}return null}(t,e),i=null==(a=null==o?void 0:o.run.styles)?void 0:a.link;if(!o||!i||o.run.image)return null;let l=o.startOffset,s=o.endOffset,d=0;const c=t.runs,h=c.findIndex(t=>t.id===o.run.id);if(-1===h)return null;for(let p=0;p<h;p+=1)d+=c[p].text.length;l=d,s=d+o.run.text.length;for(let p=h-1;p>=0;p-=1){const t=c[p];if(t.image||(null==(n=t.styles)?void 0:n.link)!==i)break;l-=t.text.length}for(let p=h+1;p<c.length;p+=1){const t=c[p];if(t.image||(null==(r=t.styles)?void 0:r.link)!==i)break;s+=t.text.length}return{href:i,startOffset:l,endOffset:s}}function xw(t,e,a){const n=Math.max(0,Math.min(e,Ae(t))),r=Math.max(n,Math.min(a,Ae(t))),o=[];let i=0;for(const l of t.runs){const t=i,e=i+l.text.length,a=Math.max(n,t),s=Math.min(r,e);if(a<s){const e=Boolean(l.image||l.textBox),n={id:`run:${Math.random().toString(36).slice(2,9)}`,text:e?"":l.text.slice(a-t,s-t)};l.styles&&(n.styles={...l.styles}),l.image&&(n.image={...l.image}),l.textBox&&(n.textBox=$x(l.textBox)),l.revision&&(n.revision={...l.revision}),l.field&&(n.field={...l.field}),l.footnoteReference&&(n.footnoteReference={...l.footnoteReference}),l.endnoteReference&&(n.endnoteReference={...l.endnoteReference}),o.push(n)}i=e}return o}function ww(t,e,a){const n=xw(t,0,e),r=xw(t,e,Ae(t)),o=yw(t,e);return fw(t,[...n,...a.map(t=>({...t,styles:Xx(t.styles??o)})),...r],o)}function Sw(t){const e=[],a=new Map,n=[];let r=0;for(const o of t){const t=Se(o);e.push({id:o.id,base:r,length:t.length}),a.has(o.id)||a.set(o.id,r),n.push(t),r+=t.length+1}return{text:n.join("\n"),spans:e,baseById:a}}function Aw(t,e,a){return t<e?e:t>a?a:t}function Iw(t,e,a){const n=Sw(e);let r=!1;for(const f of t.order){const e=t.items[f];if(e&&(e.start&&n.baseById.has(e.start.paragraphId)||e.end&&n.baseById.has(e.end.paragraphId))){r=!0;break}}if(!r)return t;const o=Sw(a);if(n.text===o.text)return t;const i=n.text.length,l=o.text.length,s=Math.min(i,l),d=function(t,e,a){let n=0;for(;n<a&&t.charCodeAt(t.length-1-n)===e.charCodeAt(e.length-1-n);)n+=1;return n}(n.text,o.text,s),c=function(t,e,a){let n=0;for(;n<a&&t.charCodeAt(n)===e.charCodeAt(n);)n+=1;return n}(n.text,o.text,s-d),h=t=>{const e=n.baseById.get(t.paragraphId);if(void 0===e)return t;const a=e+Aw(t.offset,0,i-e),r=Aw(function(t,e,a,n,r){return t<=n?t:t>=e-r?t+(a-e):n}(a,i,l,c,d),0,l),s=function(t,e){for(const n of e)if(t<=n.base+n.length)return{paragraphId:n.id,offset:Math.max(0,t-n.base)};const a=e[e.length-1];return{paragraphId:a.id,offset:a.length}}(r,o.spans);return s.paragraphId===t.paragraphId&&s.offset===t.offset?t:{...t,paragraphId:s.paragraphId,offset:s.offset}};let p=!1;const u={...t.items};for(const f of t.order){const e=t.items[f];if(!e)continue;let a=e;if(e.start&&n.baseById.has(e.start.paragraphId)){const t=h(e.start);t!==e.start&&(a={...a,start:t})}if(e.end&&n.baseById.has(e.end.paragraphId)){const t=h(e.end);t!==e.end&&(a={...a,end:t})}a!==e&&(u[f]=a,p=!0)}return p?{...t,items:u}:t}function Tw(t,e){if(!function(t){for(const e of t)if("table"===e.type)return!0;return!1}(t))return e;let a=0;const n=t=>{let r=!1;const o=t.map(t=>{if("paragraph"===t.type){const n=e[a++]??t;return n!==t&&(r=!0),n}let o=!1;const i=t.rows.map(t=>{let e=!1;const a=t.cells.map(t=>{const a=n(t.blocks);return a===t.blocks?t:(e=!0,{...t,blocks:a})});return e?(o=!0,{...t,cells:a}):t});return o?(r=!0,{...t,rows:i}):t});return r?o:t};return n(t)}function Cw(t,e,a){const n=Ye(t);if("footnote"===n){const n=t.activeFootnoteId,r=t.document.footnotes;if(!n||!r||!r.items[n])return{...t,selection:a};const o=r.items[n],i=Tw(o.blocks,e);return{...t,document:{...t.document,footnotes:{...r,items:{...r.items,[n]:{...o,blocks:i}}}},selection:a}}const r=We(t.document),o=Math.max(0,Math.min(Je(t),r.length-1)),i=r[o];if(!i)return{...t,selection:a};const l=function(t,e,a){return"header"===a?{...t,header:Tw(t.header??[],e)}:"footer"===a?{...t,footer:Tw(t.footer??[],e)}:{...t,blocks:Tw(t.blocks,e)}}(i,e,n),s=[...r];s[o]=l;const d=t.document.bookmarks,c=d&&d.order.length>0?Iw(d,_e(t),e):d;return{...t,document:{...t.document,sections:s,...c!==d?{bookmarks:c}:{}},selection:a}}function kw(t,e,a){let n=!1;const r=t.map(t=>{if("paragraph"===t.type)return t;let r=!1;const o=t.rows.map(t=>{let n=!1;const o=t.cells.map(t=>{if(!t.blocks.some(t=>e.has(t.id)))return t;const r=a(t);return r!==t&&(n=!0),r});return n?(r=!0,{...t,cells:o}):t});return r?(n=!0,{...t,rows:o}):t});return n?r:t}function Vw(t){return aa(t)}function Ew(t){const e=_e(t),a=ta(t,t.selection.focus),n=$e(e,a.paragraphId),r=e[n];return{paragraph:r,index:n,offset:Te(r,a)}}function Rw(t){const e=ra(t);if(e.isCollapsed)return t;const a=_e(t);if(t.trackChangesEnabled){const n=`rev:${Math.random().toString(36).slice(2,9)}`,r="User",o=Date.now();return Cw(t,a.map((t,a)=>{if(a<e.startIndex||a>e.endIndex)return ew(t);return Lw(t,a===e.startIndex?e.startParagraphOffset:0,a===e.endIndex?e.endParagraphOffset:Ae(t),t=>{var e;return"insert"===(null==(e=t.revision)?void 0:e.type)?{...t,text:""}:{...t,revision:{id:n,type:"delete",author:r,date:o}}})}),Vw(e.start))}const n=a[e.startIndex],r=a[e.endIndex],o=Te(n,e.start),i=Te(r,e.end),l=fw(n,[...xw(n,0,o),...xw(r,i,Ae(r))]);return Cw(t,[...nw(a.slice(0,e.startIndex)),l,...nw(a.slice(e.endIndex+1))],Vw(Ie(l,o)))}function Lw(t,e,a,n){return fw(t,[...xw(t,0,e),...xw(t,e,a).map(n),...xw(t,a,Ae(t))])}function zw(t,e){const a=t[e.startIndex],n=t[e.endIndex];return{anchor:Ie(a,e.startParagraphOffset),focus:Ie(n,e.endParagraphOffset)}}function Nw(t,e){const a=ra(t);return a.isCollapsed?t:{document:t.document,selection:Vw("start"===e?a.start:a.end)}}function qw(t){return Gx(t,t=>Boolean(t.image))}function Ow(t,e){const a=qw(t);if(!a)return t;const n=function(t){if(!Number.isFinite(t))return;const e=(Math.round(t)%360+360)%360;return 0===e?void 0:e}(e),r=_e(t),{paragraphIndex:o,run:i}=a,l=r.map((t,e)=>e!==o?ew(t):{...ew(t),runs:t.runs.map(t=>t.id===i.id&&t.image?{...t,image:{...t.image,rotation:n}}:tw(t))});return Cw(t,l,zw(l,ra(t)))}function Pw(t,e){const a=qw(t);if(!(null==a?void 0:a.run.image))return t;const n=_e(t),{paragraphIndex:r,run:o}=a,i=n.map((t,a)=>a!==r?ew(t):{...ew(t),runs:t.runs.map(t=>{if(t.id!==o.id||!t.image)return tw(t);const a=e(t.image.floating),n={...t.image};return a?n.floating=a:delete n.floating,{...t,image:n}})});return Cw(t,i,zw(i,ra(t)))}function Ww(t){const e=qw(t);if(!(null==e?void 0:e.run.image))return null;return function(t){var e;if(!sw(t))return"";let a=!1,n="";for(const r of t.runs)a?n+=r.text:"end"===(null==(e=r.fieldChar)?void 0:e.kind)&&(a=!0);return n.replace(/^[:\-\s]+/,"")}(_e(t)[e.paragraphIndex+1])}function Hw(t,e,a){const n=qw(t);if(!(null==n?void 0:n.run.image))return t;const r=_e(t),o=n.paragraphIndex+1,i=o<r.length&&sw(r[o])?function(t,e,a){var n;const r=(null==(n=t.runs.find(t=>/^\d+$/.test(t.text)))?void 0:n.text)??"1",o=lw(e,a,Number.parseInt(r,10)||1);return o.id=t.id,o}(r[o],e,a):lw(e,a,1),l=function(t){let e=1;return t.map(t=>sw(t)?dw(t,e++):ew(t))}(o<r.length&&sw(r[o])?[...nw(r.slice(0,o)),i,...nw(r.slice(o+1))]:[...nw(r.slice(0,o)),i,...nw(r.slice(o))]),s=l[o]??i;return Cw(t,l,Vw(Ie(s,Ae(s))))}function Uw(t,e){const a=qw(t);if(!a)return t;const n=_e(t),{paragraphIndex:r,offset:o,run:i}=a,l=$e(n,e.paragraphId);if(l<0)return t;const s=Te(n[l],e),d=l===r&&s>o?s-1:s;if(l===r&&d===o)return t;const c=t=>fw(t,[...xw(t,0,o),...xw(t,o+1,Ae(t))]),h=(t,e)=>ww(t,Math.max(0,Math.min(e,Ae(t))),[va("",yw(t,e),i.image)]),p=n.map((t,e)=>e===r&&e===l?h(c(t),d):e===r?c(t):e===l?h(t,d):nw([t])[0]),u=p[l];return Cw(t,p,Vw(Ie(u,Math.max(0,Math.min(d+1,Ae(u))))))}function Fw(t){return Gx(t,t=>Boolean(t.textBox))}function Bw(t,e){const a=Fw(t);if(!a||!a.run.textBox)return t;const n=function(t){if(!Number.isFinite(t))return;const e=(Math.round(t)%360+360)%360;return 0===e?void 0:e}(e),{paragraphIndex:r,run:o}=a,i=_e(t).map((t,e)=>e!==r?ew(t):{...ew(t),runs:t.runs.map(t=>t.id===o.id&&t.textBox?{...t,textBox:{...t.textBox,rotation:n}}:tw(t))});return Cw(t,i,zw(i,ra(t)))}function Gw(t,e){const a=Fw(t);if(!(null==a?void 0:a.run.textBox))return t;const{paragraphIndex:n,run:r}=a,o=_e(t).map((t,a)=>a!==n?ew(t):{...ew(t),runs:t.runs.map(t=>{if(t.id!==r.id||!t.textBox)return tw(t);const a=e(t.textBox.floating),n={...t.textBox};return a?n.floating=a:delete n.floating,{...t,textBox:n}})});return Cw(t,o,zw(o,ra(t)))}function Zw(t){return t.map(tw)}function Kw(t){return t.reduce((t,e)=>t+e.text.length,0)}function Dw(t,e,a){if(0===a.length)return t;const n=_e(t),r=n.findIndex(t=>t.id===e.paragraphId);if(-1===r)return t;const o=n[r],i=Te(o,e),l=Zw(a[0].runs);if(1===a.length){const e=ww(o,i,l),a=n.map((t,a)=>a===r?e:t),s=Kw(l);return Cw(t,a,{anchor:Ie(e,i),focus:Ie(e,i+s)})}const s=xw(o,0,i),d=xw(o,i,Ae(o)),c=a[a.length-1],h=a.slice(1,-1),p=fw(ew(a[0].paragraphTemplate),[...s,...l],yw(o,i)),u=h.map(t=>fw(ew(t.paragraphTemplate),Zw(t.runs))),f=fw(ew(c.paragraphTemplate),[...Zw(c.runs),...d],yw(o,i));return Cw(t,[...n.slice(0,r),p,...u,f,...n.slice(r+1)],{anchor:Ie(p,Kw(s)),focus:Ie(f,Kw(c.runs))})}function jw(t,e,a={}){if(ra(t).isCollapsed)return t;if(function(t,e){const a=ra(t);if(a.isCollapsed)return!1;const n=_e(t),r=n.findIndex(t=>t.id===e.paragraphId);if(-1===r)return!1;if(r<a.startIndex||r>a.endIndex)return!1;const o=Te(n[r],e);return!(r===a.startIndex&&o<a.startParagraphOffset||r===a.endIndex&&o>a.endParagraphOffset)}(t,e))return t;const n=function(t){const e=ra(t);if(e.isCollapsed)return[];const a=_e(t),n=[];for(let r=e.startIndex;r<=e.endIndex;r+=1){const t=a[r],o=xw(t,r===e.startIndex?e.startParagraphOffset:0,r===e.endIndex?e.endParagraphOffset:Ae(t));n.push({paragraphTemplate:ew(t),runs:o})}return n}(t);if(0===n.length)return t;if(a.copy)return Dw(t,e,n);const r=function(t,e){const a=ra(t),n=_e(t),r=n.findIndex(t=>t.id===e.paragraphId);if(-1===r)return e;const o=Te(n[r],e);if(a.startIndex===a.endIndex)return r!==a.startIndex||o<=a.endParagraphOffset?e:Ie(n[a.startIndex],o-(a.endParagraphOffset-a.startParagraphOffset));return e}(t,e);return Dw(Rw(t),r,n)}function Xw(t,e,a){if(0===e.length)return t;const n=na(t.selection)?t:Rw(t),{paragraph:r,index:o,offset:i}=Ew(n),l=a?{...a}:yw(r,i),s={id:`run:${Math.random().toString(36).slice(2,9)}`,text:e,styles:l};n.trackChangesEnabled&&(s.revision={id:`rev:${Math.random().toString(36).slice(2,9)}`,type:"insert",author:"User",date:Date.now()});const d=ww(r,i,[s]);return Cw(n,_e(n).map((t,e)=>e===o?d:t),Vw(Ie(d,i+e.length)))}function Jw(t,e,a){if(0===e.length)return t;const n=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n");if(!n.includes("\n"))return Xw(t,n,a);const r=na(t.selection)?t:Rw(t),{paragraph:o,index:i,offset:l}=Ew(r),s=n.split("\n"),d=yw(o,l),c=fw(o,[...xw(o,0,l),va(s[0],d)],d),h=xw(o,l,Ae(o)),p=s.slice(1,-1).map(t=>gw([{text:t,styles:d}])),u=gw([{text:s[s.length-1],styles:d},...h.map(t=>({text:t.text,styles:t.styles}))]),f=_e(r);return Cw(r,[...f.slice(0,i),c,...p,u,...f.slice(i+1)],Vw(Ie(u,s[s.length-1].length)))}function Yw(t){var e;if(!na(t.selection))return Rw(t);const{paragraph:a,index:n,offset:r}=Ew(t),o=_e(t);if(r>0){if(t.trackChangesEnabled){const i=a.runs;let l=0,s=-1,d=-1;for(let t=0;t<i.length;t+=1){const e=l+i[t].text.length;if(r<=e){s=t,d=r-l;break}l=e}if(-1!==s){const l=i[s];if("insert"===(null==(e=l.revision)?void 0:e.type)){const e=fw(a,[...xw(a,0,r-1),...xw(a,r,Ae(a))]);return Cw(t,o.map((t,a)=>a===n?e:t),Vw(Ie(e,r-1)))}const c=l.text[d-1],h={id:`run:${Math.random().toString(36).slice(2,9)}`,text:c,styles:{...l.styles},revision:{id:`rev:${Math.random().toString(36).slice(2,9)}`,type:"delete",author:"User",date:Date.now()}},p=fw(a,[...xw(a,0,r-1),h,...xw(a,r,Ae(a))]);return Cw(t,o.map((t,e)=>e===n?p:t),Vw(Ie(p,r-1)))}}const i=fw(a,[...xw(a,0,r-1),...xw(a,r,Ae(a))],yw(a,r-1));return Cw(t,o.map((t,e)=>e===n?i:t),Vw(Ie(i,r-1)))}if(0===n)return t;const i=o[n-1],l=fw(i,[...i.runs.map(tw),...a.runs.map(tw)]);return Cw(t,[...o.slice(0,n-1),l,...o.slice(n+1)],Vw(Ie(l,Ae(i))))}function Qw(t){var e;if(!na(t.selection))return Rw(t);const{paragraph:a,index:n,offset:r}=Ew(t),o=_e(t);if(r<Ae(a)){if(t.trackChangesEnabled){const i=a.runs;let l=0,s=-1,d=-1;for(let t=0;t<i.length;t+=1){const e=l+i[t].text.length;if(r<e){s=t,d=r-l;break}l=e}if(-1!==s){const l=i[s];if("insert"===(null==(e=l.revision)?void 0:e.type)){const e=fw(a,[...xw(a,0,r),...xw(a,r+1,Ae(a))]);return Cw(t,o.map((t,a)=>a===n?e:t),Vw(Ie(e,r)))}const c=l.text[d],h={id:`run:${Math.random().toString(36).slice(2,9)}`,text:c,styles:{...l.styles},revision:{id:`rev:${Math.random().toString(36).slice(2,9)}`,type:"delete",author:"User",date:Date.now()}},p=fw(a,[...xw(a,0,r),h,...xw(a,r+1,Ae(a))]);return Cw(t,o.map((t,e)=>e===n?p:t),Vw(Ie(p,r)))}}const i=fw(a,[...xw(a,0,r),...xw(a,r+1,Ae(a))],yw(a,r));return Cw(t,o.map((t,e)=>e===n?i:t),Vw(Ie(i,r)))}if(n>=o.length-1)return t;const i=o[n+1],l=fw(a,[...a.runs.map(tw),...i.runs.map(tw)]);return Cw(t,[...o.slice(0,n),l,...o.slice(n+2)],Vw(Ie(l,r)))}function _w(t,e){const a=ra(t);if(a.isCollapsed)return t;const n=_e(t),r=n.slice(a.startIndex,a.endIndex+1).flatMap((t,e)=>{const n=a.startIndex+e;return xw(t,n===a.startIndex?a.startParagraphOffset:0,n===a.endIndex?a.endParagraphOffset:Ae(t))}).filter(t=>t.text.length>0);if(0===r.length)return t;const o=!r.every(t=>{var a;return Boolean(null==(a=t.styles)?void 0:a[e])}),i=n.map((t,n)=>{if(n<a.startIndex||n>a.endIndex)return t;return Lw(t,n===a.startIndex?a.startParagraphOffset:0,n===a.endIndex?a.endParagraphOffset:Ae(t),t=>({...t,styles:Yx(t.styles,e,o)}))});return Cw(t,i,zw(i,a))}function $w(t){return new RegExp("\\p{L}","u").test(t)}function tS(t,e){switch(e){case"lower":return t.toLowerCase();case"upper":return t.toUpperCase();case"capitalize":return function(t){let e="",a=!1;for(const n of t){const t=$w(n);e+=t&&!a?n.toUpperCase():n,a=t}return e}(t);case"toggle":return function(t){let e="";for(const a of t){const t=a.toUpperCase(),n=a.toLowerCase();e+=a===n&&a!==t?t:a===t&&a!==n?n:a}return e}(t);default:return function(t){let e="",a=!0;for(const n of t.toLowerCase())a&&$w(n)?(e+=n.toUpperCase(),a=!1):(e+=n,"."!==n&&"!"!==n&&"?"!==n||(a=!0));return e}(t)}}function eS(t,e){return function(t,e){const a=ra(t);if(a.isCollapsed)return t;const n=_e(t).map((t,n)=>{if(n<a.startIndex||n>a.endIndex)return t;const r=n===a.startIndex?a.startParagraphOffset:0,o=n===a.endIndex?a.endParagraphOffset:Ae(t),i=xw(t,r,o).map(t=>t.text).join(""),l=e(i);let s=0;return Lw(t,r,o,t=>{const e=t.text.length,a=l.slice(s,s+e);return s+=e,{...t,text:a}})});return Cw(t,n,zw(n,a))}(t,t=>tS(t,e))}function aS(t,e,a){const n=ra(t);if(n.isCollapsed)return t;const r=_e(t).map((t,r)=>{if(r<n.startIndex||r>n.endIndex)return t;return Lw(t,r===n.startIndex?n.startParagraphOffset:0,r===n.endIndex?n.endParagraphOffset:Ae(t),t=>({...t,styles:Qx(t.styles,e,a)}))});return Cw(t,r,zw(r,n))}function nS(t,e,a){var n;let r;const o=t=>{const a=t.findIndex(t=>t.id===e);return a>=0?(r=t[a],[...t.slice(0,a),...t.slice(a+1)]):t},i={...t.document};if(i.sections&&i.sections.length>0&&(i.sections=i.sections.map(t=>({...t,blocks:o(t.blocks),header:t.header?o(t.header):void 0,footer:t.footer?o(t.footer):void 0}))),!r)return t;const l=a.paragraphId;if("table"===r.type){if(He(r).some(t=>t.id===l))return t}const s=t=>{const e=t.findIndex(t=>t.id===l||"table"===t.type&&He(t).some(t=>t.id===l));if(e<0)return{nextBlocks:t,found:!1};return{nextBlocks:[...t.slice(0,e),r,...t.slice(e)],found:!0}},d=Je(t),c=Ye(t),h={...null==(n=i.sections)?void 0:n[d]};let p=!1;if("header"===c){const t=s(h.header??[]);h.header=t.nextBlocks,p=t.found}else if("footer"===c){const t=s(h.footer??[]);h.footer=t.nextBlocks,p=t.found}else{const t=s(h.blocks);h.blocks=t.nextBlocks,p=t.found}return p||(h.blocks=[...h.blocks,r]),i.sections=[...i.sections??[]],i.sections[d]=h,{...t,document:i}}function rS(t){const e=na(t.selection)?t:Rw(t),{paragraph:a,index:n,offset:r}=Ew(e),o=fw(a,xw(a,0,r),yw(a,r)),i=xw(a,r,Ae(a)),l=i.length>0?mw(a,i.map(t=>({text:t.text,styles:t.styles}))):(()=>{const t=ba("");return t.style=a.style?{...a.style}:void 0,t.list=a.list?{...a.list}:void 0,t})(),s=_e(e);return Cw(e,[...nw(s.slice(0,n)),o,l,...nw(s.slice(n+1))],Vw(Ie(l,0)))}function oS(t){const e=na(t.selection)?t:Rw(t),{paragraph:a,index:n,offset:r}=Ew(e),o=fw(a,xw(a,0,r),yw(a,r)),i=xw(a,r,Ae(a)),l=i.length>0?mw(a,i.map(t=>({text:t.text,styles:t.styles}))):(()=>{const t=ba("");return t.style=a.style?{...a.style}:void 0,t.list=a.list?{...a.list}:void 0,t})();l.style={...a.style??{},pageBreakBefore:!0};const s=_e(e);return Cw(e,[...nw(s.slice(0,n)),o,l,...nw(s.slice(n+1))],Vw(Ie(l,0)))}function iS(t,e,a){const n=ra(t),r=_e(t),o=n.startIndex,i=n.endIndex,l=r.map((t,n)=>n<o||n>i?ew(t):{...ew(t),style:_x(t.style,e,a)});return Cw(t,l,zw(l,n))}function lS(t){const e=ra(t),a=_e(t).map((t,a)=>{if(a<e.startIndex||a>e.endIndex)return ew(t);if(!t.list)return ew(t);const n=t.list.level??0;return n<=0?bw(t):vw(t,n-1)});return Cw(t,a,zw(a,e))}function sS(t,e,a){const n={...t??{}};return null===a?delete n[e]:n[e]=a,Object.keys(n).length>0?n:void 0}function dS(t,e){const a=We(t.document).map(t=>({...t,blocks:e(t.blocks),header:t.header?e(t.header):void 0,footer:t.footer?e(t.footer):void 0}));return{...t,document:{...t.document,sections:a}}}function cS(t,e){return t.map(t=>"table"===t.type?e(t):t)}function hS(t,e){return t.map(t=>"paragraph"===t.type?t:{...e(t),rows:t.rows.map(t=>({...t,cells:t.cells.map(t=>({...t,blocks:hS(t.blocks,e)}))}))})}function pS(t){const e=Je(t),a=Xe(t.document,t.selection.focus.paragraphId,e);return a?{activeSectionIndex:e,loc:a}:null}function uS(t,e){const a=pS(t);if(!a)return t;const{activeSectionIndex:n,loc:r}=a,o=Ye(t),i=(t,a)=>t.map((t,n)=>"table"===t.type&&n===r.blockIndex&&a===r.zone?e(t):t),l=We(t.document).map((t,e)=>e!==n?t:{...t,blocks:"main"===o?i(t.blocks,"main"):t.blocks,header:"header"===o&&t.header?i(t.header,"header"):t.header,footer:"footer"===o&&t.footer?i(t.footer,"footer"):t.footer});return{...t,document:{...t.document,sections:l}}}function fS(t){const e=new Set,a=Je(t),n=Xe(t.document,t.selection.anchor.paragraphId,a),r=Xe(t.document,t.selection.focus.paragraphId,a);if(!n||!r||n.blockIndex!==r.blockIndex||n.zone!==r.zone)return e;const o=function(t,e,a){const n=We(t)[e];if(n)return"header"===a?n.header:"footer"===a?n.footer:n.blocks}(t.document,a,n.zone),i=null==o?void 0:o[n.blockIndex];if(!i||"table"!==i.type)return e;const l=on(i),s=l.find(t=>t.rowIndex===n.rowIndex&&t.cellIndex===n.cellIndex),d=l.find(t=>t.rowIndex===r.rowIndex&&t.cellIndex===r.cellIndex);if(!s||!d)return e;const c=Math.min(s.visualRowIndex,d.visualRowIndex),h=Math.max(s.visualRowIndex+s.rowSpan-1,d.visualRowIndex+d.rowSpan-1),p=Math.min(s.visualColumnIndex,d.visualColumnIndex),u=Math.max(s.visualColumnIndex+s.colSpan-1,d.visualColumnIndex+d.colSpan-1),f=l.filter(t=>t.visualRowIndex<=h&&t.visualRowIndex+t.rowSpan-1>=c&&t.visualColumnIndex<=u&&t.visualColumnIndex+t.colSpan-1>=p);for(const g of f)for(const t of g.cell.blocks)e.add(t.id);return e}function gS(t,e,a){const n=fS(t);if(0===n.size)for(const i of function(t){const e=new Set,a=ra(t),n=_e(t);for(let r=a.startIndex;r<=a.endIndex;r+=1)e.add(n[r].id);return e}(t))n.add(i);const r=t=>({...t,style:sS(t.style,e,a)}),o=We(t.document).map(t=>({...t,blocks:kw(t.blocks,n,r),header:t.header?kw(t.header,n,r):void 0,footer:t.footer?kw(t.footer,n,r):void 0}));return{...t,document:{...t.document,sections:o}}}function mS(t,e){let a=gS(t,"borderTop",e);return a=gS(a,"borderRight",e),a=gS(a,"borderBottom",e),a=gS(a,"borderLeft",e),a}function vS(t,e,a){const n=function(t){const e=ra(t),a=_e(t),n=new Set;for(let r=e.startIndex;r<=e.endIndex;r+=1)n.add(a[r].id);return n}(t),r=t=>t.map(t=>{if("paragraph"===t.type)return t;const o=He(t).some(t=>n.has(t.id)),i=t.rows.map(t=>({...t,cells:t.cells.map(t=>({...t,blocks:r(t.blocks)}))})),l={...t,rows:i};return o?(s=l,{...s,style:sS(s.style,e,a)}):l;var s});return dS(t,r)}function bS(t,e,a,n){const r=t=>t.id!==e?t:{...t,style:sS(t.style,a,n)};return dS(t,t=>hS(t,r))}function yS(t,e,a){const n=pS(t);if(!n)return t;return uS(t,t=>{const r=t.rows.map((t,r)=>r===n.loc.rowIndex?{...t,style:sS(t.style,e,a)}:t);return{...t,rows:r}})}function MS(t){if("number"==typeof t&&Number.isFinite(t))return t;if("string"!=typeof t)return null;const e=t.trim().toLowerCase();if(!e||e.includes("%"))return null;if(e.endsWith("pt")){const t=Number.parseFloat(e.slice(0,-2));return Number.isFinite(t)?t:null}if(e.endsWith("px")){const t=Number.parseFloat(e.slice(0,-2));return Number.isFinite(t)?.75*t:null}if(!/^[+-]?\d+(\.\d+)?$/.test(e))return null;const a=Number.parseFloat(e);return Number.isFinite(a)?a:null}function xS(t,e,a,n,r){const o=t=>{var o;if(t.id!==e)return t;const i=on(t),l=Math.max(1,...i.map(t=>t.visualColumnIndex+Math.max(1,t.colSpan))),s=Array(l);let d=!1,c=!0;for(let e=0;e<l;e+=1){const n=MS(a[e]);if(null!==n){s[e]=Math.max(1,n),d=!0;continue}const r=null==(o=t.gridCols)?void 0:o[e];if(!("number"==typeof r&&Number.isFinite(r)&&r>0)){c=!1;break}s[e]=r}const h=t.rows.map((t,e)=>{const n=t.cells.map((t,n)=>{const r=i.find(t=>t.rowIndex===e&&t.cellIndex===n);if(!r)return t;const o=r.visualColumnIndex+r.colSpan-1,l=a[o];return void 0!==l&&1===r.colSpan?{...t,style:{...t.style??{},width:l}}:t});return{...t,cells:n}}),p={...t.style??{}};return void 0!==n&&(p.width=n),void 0!==r&&(p.indentLeft="number"==typeof r?r:Number(r)),{...t,rows:h,gridCols:d&&c?s:t.gridCols,style:Object.keys(p).length>0?p:void 0}};return dS(t,t=>cS(t,o))}function wS(t,e){return{document:t.document,selection:e}}function SS(t,e){if(!na(t.selection))return Nw(t,e<0?"start":"end");const{index:a,offset:n}=Ew(t),r=_e(t),o=a+e;if(o<0||o>=r.length)return t;const i=r[o];return wS(t,Vw(Ie(i,Math.min(n,Ae(i)))))}function AS(t,e){const a=ta(t,t.selection.focus),n=_e(t),r=$e(n,a.paragraphId),o=n[r],i=Te(o,a),l=Ae(o);if(e<0&&i>0)return wS(t,{anchor:t.selection.anchor,focus:Ie(o,i-1)});if(e>0&&i<l)return wS(t,{anchor:t.selection.anchor,focus:Ie(o,i+1)});if(e<0&&r>0){const e=n[r-1];return wS(t,{anchor:t.selection.anchor,focus:Ie(e,Ae(e))})}if(e>0&&r<n.length-1){const e=n[r+1];return wS(t,{anchor:t.selection.anchor,focus:Ie(e,0)})}return t}function IS(t,e){const a=ta(t,t.selection.focus),n=_e(t),r=$e(n,a.paragraphId),o=Te(n[r],a),i=r+e;if(i<0||i>=n.length)return t;const l=n[i];return wS(t,{anchor:t.selection.anchor,focus:Ie(l,Math.min(o,Ae(l)))})}function TS(t){const e=ra(t);if(e.isCollapsed)return"";const a=_e(t);if(e.startIndex===e.endIndex){return Se(a[e.startIndex]).slice(e.startParagraphOffset,e.endParagraphOffset)}const n=[],r=a[e.startIndex],o=a[e.endIndex];n.push(Se(r).slice(e.startParagraphOffset));for(let i=e.startIndex+1;i<e.endIndex;i+=1)n.push(Se(a[i]));return n.push(Se(o).slice(0,e.endParagraphOffset)),n.join("\n")}function CS(t,e){return{...t,selection:{anchor:ta(t,e.anchor),focus:ta(t,e.focus)}}}function kS(t){if(!na(t.selection))return Nw(t,"start");const{paragraph:e,index:a,offset:n}=Ew(t),r=_e(t);if(n>0)return{document:t.document,selection:Vw(Ie(e,n-1))};if(0===a)return t;const o=r[a-1];return{document:t.document,selection:Vw(Ie(o,Ae(o)))}}function VS(t){if(!na(t.selection))return Nw(t,"end");const{paragraph:e,index:a,offset:n}=Ew(t),r=_e(t);if(n<Ae(e))return{document:t.document,selection:Vw(Ie(e,n+1))};if(a>=r.length-1)return t;const o=r[a+1];return{document:t.document,selection:Vw(Ie(o,0))}}function ES(t){var e,a,n;const r=ra(t),o=_e(t);if(r.isCollapsed){const t=o[r.startIndex];return t?(null==(e=Mw(t,r.startParagraphOffset))?void 0:e.href)??null:null}const i=o.slice(r.startIndex,r.endIndex+1).flatMap((t,e)=>{const a=r.startIndex+e;return xw(t,a===r.startIndex?r.startParagraphOffset:0,a===r.endIndex?r.endParagraphOffset:Ae(t))}).filter(t=>t.text.length>0&&!t.image);if(0===i.length)return null;const l=null==(n=null==(a=i[0])?void 0:a.styles)?void 0:n.link;return l&&i.every(t=>{var e;return(null==(e=t.styles)?void 0:e.link)===l})?l:null}function RS(t,e){const a=_e(t).map(t=>{const a=t.runs.filter(t=>{var a;return!((null==(a=t.revision)?void 0:a.id)===e&&"delete"===t.revision.type)}).map(t=>{var a;if((null==(a=t.revision)?void 0:a.id)===e&&"insert"===t.revision.type){const e={...t};return delete e.revision,e}return t});return a.length===t.runs.length&&a.every((e,a)=>e===t.runs[a])?t:fw(t,a)});return Cw(t,a,zw(a,ra(t)))}function LS(t,e){const a=_e(t).map(t=>{const a=t.runs.filter(t=>{var a;return!((null==(a=t.revision)?void 0:a.id)===e&&"insert"===t.revision.type)}).map(t=>{var a;if((null==(a=t.revision)?void 0:a.id)===e&&"delete"===t.revision.type){const e={...t};return delete e.revision,e}return t});return a.length===t.runs.length&&a.every((e,a)=>e===t.runs[a])?t:fw(t,a)});return Cw(t,a,zw(a,ra(t)))}function zS(t){if(!t)return"";const e=[];t.fontFamily&&e.push(`font-family:${t.fontFamily}`),void 0!==t.fontSize&&null!==t.fontSize&&e.push(`font-size:${t.fontSize}px`),t.color&&e.push(`color:${t.color}`),t.highlight?e.push(`background-color:${t.highlight}`):t.shading&&e.push(`background-color:${t.shading}`),t.superscript?(e.push("vertical-align:super"),e.push("font-size:0.75em")):t.subscript&&(e.push("vertical-align:sub"),e.push("font-size:0.75em")),t.bold&&e.push("font-weight:700"),t.italic&&e.push("font-style:italic"),t.hidden&&e.push("display:none"),t.allCaps&&e.push("text-transform:uppercase"),t.smallCaps&&e.push("font-variant:small-caps"),void 0!==t.characterScale&&null!==t.characterScale&&e.push(`font-stretch:${t.characterScale}%`),void 0!==t.characterSpacing&&null!==t.characterSpacing&&e.push(`letter-spacing:${t.characterSpacing}pt`),NS(t.language)&&e.push("hyphens:auto"),void 0!==t.baselineShift&&null!==t.baselineShift&&e.push(`vertical-align:${t.baselineShift}pt`);const a=function(t){switch(t){case"none":return"none";case"standard":return"common-ligatures";case"contextual":return"contextual";case"historical":return"historical-ligatures";case"standardContextual":return"common-ligatures contextual";default:return null}}(t.ligatures);a&&e.push(`font-variant-ligatures:${a}`);const n=function(t,e){const a=[];"proportional"===t&&a.push("proportional-nums");"tabular"===t&&a.push("tabular-nums");"lining"===e&&a.push("lining-nums");"oldStyle"===e&&a.push("oldstyle-nums");return a.join(" ")||null}(t.numberSpacing,t.numberForm);n&&e.push(`font-variant-numeric:${n}`);const r=function(t,e){const a=[];"number"==typeof t&&t>=1&&t<=20&&a.push(`"ss${String(t).padStart(2,"0")}" 1`);e&&a.push('"calt" 1');return a.join(", ")||null}(t.stylisticSet,t.contextualAlternates);r&&e.push(`font-feature-settings:${r}`);const o=[];if((t.underline||t.link)&&o.push("underline"),t.strike&&o.push("line-through"),t.doubleStrike&&o.push("line-through"),o.length>0&&(e.push(`text-decoration:${o.join(" ")}`),t.underline||t.link)){const a=function(t){switch(t){case"double":case"wavyDouble":return"double";case"dotted":case"dottedHeavy":return"dotted";case"dash":case"dashedHeavy":case"dashLong":case"dashLongHeavy":case"dotDash":case"dashDotHeavy":case"dotDotDash":case"dashDotDotHeavy":return"dashed";case"wave":case"wavyHeavy":return"wavy";default:return null}}(t.underlineStyle);a&&e.push(`text-decoration-style:${a}`),t.underlineColor&&e.push(`text-decoration-color:${t.underlineColor}`)}return e.join(";")}function NS(t){return(null==t?void 0:t.value)??(null==t?void 0:t.bidi)??(null==t?void 0:t.eastAsia)??null}function qS(t){if(!t)return"";const e=[];if(t.align&&e.push(`text-align:${t.align}`),void 0!==t.lineHeight&&null!==t.lineHeight){const a="exact"===t.lineRule||"atLeast"===t.lineRule;e.push(`line-height:${t.lineHeight}${a?"px":""}`)}return void 0!==t.spacingBefore&&null!==t.spacingBefore&&e.push(`padding-top:${t.spacingBefore}px`),void 0!==t.spacingAfter&&null!==t.spacingAfter&&e.push(`padding-bottom:${t.spacingAfter}px`),void 0!==t.indentLeft&&null!==t.indentLeft&&e.push(`padding-left:${t.indentLeft}px`),void 0!==t.indentRight&&null!==t.indentRight&&e.push(`padding-right:${t.indentRight}px`),void 0!==t.indentFirstLine&&null!==t.indentFirstLine&&e.push(`text-indent:${t.indentFirstLine}px`),e.join(";")}function OS(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function PS(t,e){if(t.image)return function(t,e){var a;if(!t.image)return"";const n=Oe(e,t.image.src),r=void 0!==t.image.alt?` alt="${OS(t.image.alt)}"`:"",o=`<img src="${OS(n)}" width="${Math.max(1,Math.round(t.image.width))}" height="${Math.max(1,Math.round(t.image.height))}"${r}>`;return(null==(a=t.styles)?void 0:a.link)?`<a href="${OS(t.styles.link)}">${o}</a>`:o}(t,e);let a=OS(t.text).replace(/\n/g,"<br>");const n=t.styles??void 0;(null==n?void 0:n.strike)&&(a=`<s>${a}</s>`),(null==n?void 0:n.underline)&&(a=`<u>${a}</u>`),(null==n?void 0:n.italic)&&(a=`<em>${a}</em>`),(null==n?void 0:n.bold)&&(a=`<strong>${a}</strong>`),(null==n?void 0:n.superscript)?a=`<sup>${a}</sup>`:(null==n?void 0:n.subscript)&&(a=`<sub>${a}</sub>`);const r=zS(n),o=function(t){if(!t)return"";const e=[],a=NS(t);return a&&e.push(`lang="${OS(a)}"`),t.value&&e.push(`data-oasis-lang-value="${OS(t.value)}"`),t.eastAsia&&e.push(`data-oasis-lang-east-asia="${OS(t.eastAsia)}"`),t.bidi&&e.push(`data-oasis-lang-bidi="${OS(t.bidi)}"`),e.length>0?` ${e.join(" ")}`:""}(null==n?void 0:n.language);if(r.length>0||o.length>0){a=`<span${r.length>0?` style="${r}"`:""}${o}>${a}</span>`}return(null==n?void 0:n.link)&&(a=`<a href="${OS(n.link)}">${a}</a>`),a}function WS(t,e){return t.map(t=>PS(t,e)).join("")||"<br>"}function HS(t){var e;const a=ra(t);if(a.isCollapsed)return"";const n=_e(t),r=[];let o=null;const i=()=>{o&&(r.push("bullet"===o?"</ul>":"</ol>"),o=null)};for(let l=a.startIndex;l<=a.endIndex;l+=1){const s=n[l];if(!s)continue;const d=xw(s,l===a.startIndex?a.startParagraphOffset:0,l===a.endIndex?a.endParagraphOffset:Ae(s)),c=qS(s.style),h=c.length>0?` style="${c}"`:"",p=WS(d,t.document);if(null==(e=s.list)?void 0:e.kind){const t="bullet"===s.list.kind?"ul":"ol";o!==s.list.kind&&(i(),r.push(`<${t}>`),o=s.list.kind),r.push(`<li${h}>${p}</li>`);continue}i(),r.push(`<p${h}>${p}</p>`)}return i(),r.join("")}function US(t,e){if(0===e.length)return t;const a=na(t.selection)?t:Rw(t),{paragraph:n,index:r,offset:o}=Ew(a),i=_e(a),l=xw(n,0,o),s=xw(n,o,Ae(n)),d=e.map(t=>{const e=ya(t.runs.map(t=>({text:t.text,styles:Xx(t.styles),image:t.image?{...t.image}:void 0})));return e.style=t.style?{...t.style}:void 0,e.list=t.list?{...t.list}:void 0,e});let c,h=Vw(Ie(n,o));if(1===d.length){const t=d[0],e=t.runs.reduce((t,e)=>t+e.text.length,0),a=fw(n,[...l,...t.runs.map(tw),...s],yw(n,o));a.style=n.style?{...n.style}:t.style?{...t.style}:void 0,a.list=n.list?{...n.list}:t.list?{...t.list}:void 0,c=[...nw(i.slice(0,r)),a,...nw(i.slice(r+1))],h=Vw(Ie(a,l.reduce((t,e)=>t+e.text.length,0)+e))}else{const t=d[0],e=d[d.length-1],a=e.runs.reduce((t,e)=>t+e.text.length,0),p=fw(n,[...l,...t.runs.map(tw)],yw(n,o));p.style=n.style?{...n.style}:t.style?{...t.style}:void 0,p.list=n.list?{...n.list}:t.list?{...t.list}:void 0;const u=d.slice(1,-1).map(ew),f=fw(e,[...e.runs.map(tw),...s],void 0);f.list=e.list?{...e.list}:void 0,c=[...nw(i.slice(0,r)),p,...u,f,...nw(i.slice(r+1))],h=Vw(Ie(f,a))}return Cw(a,c,h)}function FS(t){if("main"!==(t.activeZone??"main"))return t;const e=na(t.selection)?t:Rw(t),{paragraph:a,index:n,offset:r}=Ew(e),o=function(){const t=[Aa("",{styleId:"footnoteText"})];return{id:Sa(),blocks:t}}(),i=function(t){var e,a;const n=t.footnotes,r=(null==(e=null==n?void 0:n.settings)?void 0:e.numberFormat)??"decimal";let o=((null==(a=null==n?void 0:n.settings)?void 0:a.startAt)??1)-1;const i=new Set;for(const{run:l}of Bl(t)){const t=l.footnoteReference;t&&!t.customMark&&(i.has(t.footnoteId)||(i.add(t.footnoteId),o+=1))}return jl(o+1,r)}(e.document),l=function(t,e){const a=va(e,{styleId:"footnoteReference",superscript:!0}),n={footnoteId:t};return a.footnoteReference=n,a}(o.id,i),s=ww(a,r,[l]),d=Cw(e,_e(e).map((t,e)=>e===n?s:t),aa(Ie(s,r+i.length))),c=function(t){return t||{items:{}}}(d.document.footnotes),h=Jl({...d.document,footnotes:{...c,items:{...c.items,[o.id]:o}}}),p=o.blocks.flatMap(He).find(Boolean);return p?{...d,document:h,selection:aa(Ie(p,0)),activeZone:"footnote",activeFootnoteId:o.id}:{...d,document:h}}const BS=[{x:0,y:0},{x:1,y:0},{x:1,y:1},{x:0,y:1}],GS=new Map;function ZS(){return BS.map(t=>({...t}))}const KS=[[0,-1],[1,-1],[1,0],[1,1],[0,1],[-1,1],[-1,0],[-1,-1]];function DS(t,e,a){const[n,r]=t,[o,i]=e,[l,s]=a,d=l-o,c=s-i,h=d*d+c*c;if(0===h)return Math.hypot(n-o,r-i);return Math.abs(d*(i-r)-c*(o-n))/Math.sqrt(h)}function jS(t,e){if(t.length<3)return t.slice();let a=0,n=0;const r=t[0],o=t[t.length-1];for(let s=1;s<t.length-1;s+=1){const e=DS(t[s],r,o);e>a&&(a=e,n=s)}if(a<=e)return[r,o];const i=jS(t.slice(0,n+1),e),l=jS(t.slice(n),e);return[...i.slice(0,-1),...l]}function XS(t,e,a){let n=0;for(let s=0;s<t.length;s+=1)1===t[s]&&(n+=1);if(e<=0||a<=0||0===n||n/(e*a)>=.985)return ZS();const r=function(t,e,a){const n=(n,r)=>n>=0&&n<e&&r>=0&&r<a&&1===t[r*e+n];let r=-1,o=-1;for(let h=0;h<a&&o<0;h+=1)for(let a=0;a<e;a+=1)if(1===t[h*e+a]){r=a,o=h;break}if(r<0)return[];const i=[];let l=r,s=o,d=6;const c=e*a*4;for(let h=0;h<c;h+=1){let t=!1;for(let e=1;e<=8;e+=1){const a=(d+e)%8,[r,o]=KS[a],c=l+r,h=s+o;if(n(c,h)){i.push([l,s]),d=(a+4)%8,l=c,s=h,t=!0;break}}if(!t){i.push([l,s]);break}if(l===r&&s===o&&i.length>1)break}return i}(t,e,a);if(r.length<3)return ZS();const o=.012*Math.max(e,a);let i=jS(r,o),l=o;for(;i.length>40;)l*=1.6,i=jS(r,l);return i.length<3?ZS():i.map(([t,n])=>({x:Math.min(1,Math.max(0,t/e)),y:Math.min(1,Math.max(0,n/a))}))}function JS(t){const e=t.src,a=GS.get(e);if(a)return a.map(t=>({...t}));const n=function(t){const e=t.naturalWidth||t.width,a=t.naturalHeight||t.height;if(!e||!a)return null;const n=Math.min(1,256/Math.max(e,a)),r=Math.max(1,Math.round(e*n)),o=Math.max(1,Math.round(a*n)),i=document.createElement("canvas");i.width=r,i.height=o;const l=i.getContext("2d",{willReadFrequently:!0});if(!l)return null;let s;l.drawImage(t,0,0,r,o);try{s=l.getImageData(0,0,r,o).data}catch{return null}const d=new Uint8Array(r*o);let c=0;for(let h=0;h<d.length;h+=1)s[4*h+3]>=128&&(d[h]=1,c+=1);return{mask:d,width:r,height:o,foreground:c}}(t);if(!n)return ZS();const r=XS(n.mask,n.width,n.height);return GS.set(e,r),r.map(t=>({...t}))}function YS(t){return"paragraph"===t.type?{...t,runs:t.runs.map(t=>({...t,styles:t.styles?{...t.styles}:void 0,image:t.image?{...t.image}:void 0,field:t.field?{...t.field}:void 0,revision:t.revision?{...t.revision}:void 0,footnoteReference:t.footnoteReference?{...t.footnoteReference}:void 0,endnoteReference:t.endnoteReference?{...t.endnoteReference}:void 0})),style:t.style?{...t.style}:void 0,list:t.list?{...t.list}:void 0}:{...t,style:t.style?{...t.style,defaultCellMargins:t.style.defaultCellMargins?{...t.style.defaultCellMargins}:void 0,floating:t.style.floating?{...t.style.floating}:void 0,revisionXml:t.style.revisionXml?[...t.style.revisionXml]:void 0}:void 0,tblGridChangeXml:t.tblGridChangeXml,rows:t.rows.map(t=>({...t,style:t.style?{...t.style,revisionXml:t.style.revisionXml?[...t.style.revisionXml]:void 0}:void 0,cells:t.cells.map(t=>({...t,colSpan:t.colSpan??void 0,rowSpan:t.rowSpan??void 0,vMerge:t.vMerge??void 0,style:t.style?{...t.style,revisionXml:t.style.revisionXml?[...t.style.revisionXml]:void 0}:void 0,blocks:t.blocks.map(t=>({...t,runs:t.runs.map(t=>({...t,styles:t.styles?{...t.styles}:void 0,image:t.image?{...t.image}:void 0,field:t.field?{...t.field}:void 0,revision:t.revision?{...t.revision}:void 0,footnoteReference:t.footnoteReference?{...t.footnoteReference}:void 0,endnoteReference:t.endnoteReference?{...t.endnoteReference}:void 0})),style:t.style?{...t.style}:void 0,list:t.list?{...t.list}:void 0}))}))}))}}function QS(t){var e,a,n,r,o,i;return{...t,blocks:t.blocks.map(YS),header:null==(e=t.header)?void 0:e.map(YS),firstPageHeader:null==(a=t.firstPageHeader)?void 0:a.map(YS),evenPageHeader:null==(n=t.evenPageHeader)?void 0:n.map(YS),footer:null==(r=t.footer)?void 0:r.map(YS),firstPageFooter:null==(o=t.firstPageFooter)?void 0:o.map(YS),evenPageFooter:null==(i=t.evenPageFooter)?void 0:i.map(YS)}}function _S(t){return{...t,blocks:t.blocks.map(YS)}}function $S(t){var e,a;if(!t)return;const n={};for(const[r,o]of Object.entries(t.items))n[r]=_S(o);return{items:n,settings:t.settings?{...t.settings}:void 0,separator:null==(e=t.separator)?void 0:e.map(YS),continuationSeparator:null==(a=t.continuationSeparator)?void 0:a.map(YS)}}function tA(t){return{...t,blocks:t.blocks.map(YS)}}function eA(t){var e,a;if(!t)return;const n={};for(const[r,o]of Object.entries(t.items))n[r]=tA(o);return{items:n,settings:t.settings?{...t.settings}:void 0,separator:null==(e=t.separator)?void 0:e.map(YS),continuationSeparator:null==(a=t.continuationSeparator)?void 0:a.map(YS)}}function aA(t){var e;return{...t,document:{...t.document,sections:null==(e=t.document.sections)?void 0:e.map(QS),footnotes:$S(t.document.footnotes),endnotes:eA(t.document.endnotes)},selection:{anchor:{...t.selection.anchor},focus:{...t.selection.focus}},activeSectionIndex:t.activeSectionIndex??0,activeZone:t.activeZone??"main",activeFootnoteId:t.activeFootnoteId}}function nA(t){const{state:e,logger:a,applyState:n,applyTransactionalState:r,applySelectionAwareTextCommand:o,applySelectionAwareParagraphCommand:i,applyTableAwareParagraphEdit:l,focusInput:s,clearPreferredColumn:d,resetTransactionGrouping:c,toolbarStyleState:h,selectionCollapsed:p,selectedImageRun:u}=t,f=()=>(()=>{const t=ra(e);return _e(e).slice(t.startIndex,t.endIndex+1)})().some(t=>Boolean(t.list)),g=()=>{const t=e.selection.focus.paragraphId;return _e(e).find(e=>e.id===t)??null},m=()=>{const t=e.selection,a=Je(e),n=Xe(e.document,t.anchor.paragraphId,a),r=Xe(e.document,t.focus.paragraphId,a);return n&&r&&n.blockIndex===r.blockIndex?` [table b${n.blockIndex} r${n.rowIndex}:c${n.cellIndex}→r${r.rowIndex}:c${r.cellIndex}]`:""},v=(t,e)=>{d(),c(),i(a=>iS(a,t,e)),s()},b=()=>"main"===(e.activeZone??"main"),y=t=>{const a=ES(e);p()&&!a||(d(),c(),r(e=>function(t,e){const a=ra(t);if(!a.isCollapsed)return aS(t,"link",e);const n=_e(t)[a.startIndex];if(!n)return t;const r=Mw(n,a.startParagraphOffset);if(!r)return t;const o=aS(CS(t,{anchor:Ie(n,r.startOffset),focus:Ie(n,r.endOffset)}),"link",e),i=_e(o)[a.startIndex];return i?{...o,selection:{anchor:Ie(i,r.startOffset),focus:Ie(i,r.endOffset)}}:o}(e,t),{mergeKey:"link"}),s())};return{applyBooleanStyleCommand:t=>{if(p())return;const n=e.selection;a.info(`toggleStyle:${t} at ${n.anchor.paragraphId}:${n.anchor.runId}[${n.anchor.offset}..${n.focus.offset}]${m()}`),d(),c(),o(e=>_w(e,t)),s()},applyValueStyleCommand:(t,n)=>{if(p())return;const r=e.selection;a.info(`setStyle:${t}=${JSON.stringify(n)} at ${r.anchor.paragraphId}:${r.anchor.runId}[${r.anchor.offset}..${r.focus.offset}]${m()}`),d(),c(),o(e=>aS(e,t,n)),s()},applyChangeTextCaseCommand:t=>{p()||(d(),c(),o(e=>eS(e,t)),s())},applyClearFormattingCommand:()=>{p()||(d(),c(),o(t=>function(t){const e=ra(t);if(e.isCollapsed)return t;const a=_e(t).map((t,a)=>a<e.startIndex||a>e.endIndex?t:Lw(t,a===e.startIndex?e.startParagraphOffset:0,a===e.endIndex?e.endParagraphOffset:Ae(t),t=>{var e;const a=null==(e=t.styles)?void 0:e.link,n=null!=a&&""!==a?{link:a}:{};return{...t,styles:n}}));return Cw(t,a,zw(a,e))}(t)),s())},applyParagraphStyleCommand:v,toggleParagraphFlagCommand:t=>{const e=!h()[t];v(t,!!e||null)},applyParagraphListCommand:t=>{d(),c(),i(e=>function(t,e){const a=ra(t),n=_e(t),r=a.startIndex,o=a.endIndex,i=n.slice(r,o+1),l=i.length>0&&i.every(t=>{var a;return(null==(a=t.list)?void 0:a.kind)===e}),s=n.map((t,a)=>{var n,i,s;if(a<r||a>o)return ew(t);const d=ew(t);return l?(delete d.list,d):(d.list={kind:e,level:(null==(n=t.list)?void 0:n.level)??0,format:null==(i=t.list)?void 0:i.format,startAt:null==(s=t.list)?void 0:s.startAt},d)});return Cw(t,s,zw(s,a))}(e,t)),s()},handleListFormatChange:t=>{d(),c(),i(e=>function(t,e){const a=ra(t),n=_e(t).map((t,n)=>n<a.startIndex||n>a.endIndex?ew(t):t.list?{...ew(t),list:{...t.list,format:e||void 0}}:ew(t));return Cw(t,n,zw(n,a))}(e,t)),s()},handleListStartAtChange:t=>{d(),c(),i(e=>function(t,e){const a=ra(t),n=_e(t).map((t,n)=>n<a.startIndex||n>a.endIndex?ew(t):t.list?{...ew(t),list:{...t.list,startAt:null!==e?e:void 0}}:ew(t));return Cw(t,n,zw(n,a))}(e,t)),s()},applyInsertSectionBreakCommand:t=>{d(),c(),n(function(t,e){const a=na(t.selection)?t:Rw(t),{paragraph:n,offset:r}=Ew(a),o=We(a.document),i=Je(a);if("main"!==Ye(a))return t;const l=o[i];if(!l)return t;const s=l.blocks.findIndex(t=>"paragraph"===t.type&&t.id===n.id);if(-1===s)return t;const d=l.blocks.slice(0,s),c=l.blocks.slice(s+1),h=fw(n,xw(n,0,r),yw(n,r)),p=xw(n,r,Ae(n)),u=p.length>0?mw(n,p.map(t=>({text:t.text,styles:t.styles}))):(()=>{const t=ba("");return t.style=n.style?{...n.style}:void 0,t.list=n.list?{...n.list}:void 0,t})(),f={id:`section:${Math.random().toString(36).slice(2,9)}`,blocks:[u,...c],pageSettings:{...l.pageSettings},header:l.header?rw(l.header):void 0,footer:l.footer?rw(l.footer):void 0,breakType:e},g={...l,blocks:[...d,h]},m=[...o.slice(0,i),g,f,...o.slice(i+1)];return{...a,document:{...a.document,sections:m},activeSectionIndex:i+1,selection:Vw(Ie(u,0))}}(e,t)),s()},applyInsertPageBreakCommand:()=>{d(),c(),r(t=>l(t,t=>oS(t))),s()},canInsertFootnoteCommand:b,applyInsertFootnoteCommand:()=>{b()&&(d(),c(),r(t=>FS(t)),s())},handleStyleChange:t=>{d(),c(),i(e=>function(t,e){return iS(t,"styleId",e)}(e,t||null)),s()},applyUpdateSectionSettingsCommand:(t,a)=>{d(),c(),n(function(t,e,a){var n;const r=We(t.document);if(e<0||e>=r.length)return t;const o=[...r];return o[e]={...o[e],...a,pageSettings:{...o[e].pageSettings,...a.pageSettings??{},margins:{...o[e].pageSettings.margins,...(null==(n=a.pageSettings)?void 0:n.margins)??{}}}},{...t,document:{...t.document,sections:o}}}(e,t,a)),s()},applyToggleTrackChangesCommand:()=>{d(),c(),n(function(t){return{...t,trackChangesEnabled:!t.trackChangesEnabled}}(e)),s()},applyToggleShowMarginsCommand:()=>{n({...e,showMargins:!e.showMargins}),s()},applyToggleShowParagraphMarksCommand:()=>{n({...e,showParagraphMarks:!e.showParagraphMarks}),s()},applyAcceptRevisionsCommand:()=>{d(),c(),n(function(t){var e;const a=ra(t),n=_e(t),r=new Set;for(let i=a.startIndex;i<=a.endIndex;i+=1){const t=n[i],o=xw(t,i===a.startIndex?a.startParagraphOffset:0,i===a.endIndex?a.endParagraphOffset:Ae(t));for(const a of o)(null==(e=a.revision)?void 0:e.id)&&r.add(a.revision.id)}let o=t;for(const i of r)o=RS(o,i);return o}(e)),s()},applyRejectRevisionsCommand:()=>{d(),c(),n(function(t){var e;const a=ra(t),n=_e(t),r=new Set;for(let i=a.startIndex;i<=a.endIndex;i+=1){const t=n[i],o=xw(t,i===a.startIndex?a.startParagraphOffset:0,i===a.endIndex?a.endParagraphOffset:Ae(t));for(const a of o)(null==(e=a.revision)?void 0:e.id)&&r.add(a.revision.id)}let o=t;for(const i of r)o=LS(o,i);return o}(e)),s()},applyLinkCommand:y,promptForLink:()=>{const a=ES(e)??"";p()&&!a||t.openLinkDialog(a)},removeLinkCommand:()=>{y(null)},applyImageAltCommand:t=>{u()&&(d(),c(),r(e=>function(t,e){const a=qw(t);if(!(null==a?void 0:a.run.image))return t;const n=_e(t).map((t,n)=>n!==a.paragraphIndex?ew(t):{...ew(t),runs:t.runs.map(t=>t.id===a.run.id&&t.image?{...t,image:{...t.image,alt:e??void 0}}:tw(t))});return Cw(t,n,zw(n,ra(t)))}(e,t),{mergeKey:"imageAlt"}),s())},promptForImageAlt:()=>{var e;const a=u();if(!a)return;const n=(null==(e=a.run.image)?void 0:e.alt)??"";t.openImageAltDialog(n)},applyImageCaptionCommand:e=>{u()&&(d(),c(),r(a=>Hw(a,e,t.imageCaptionLabel()),{mergeKey:"imageCaption"}),s())},promptForImageCaption:()=>{u()&&t.openImageCaptionDialog(Ww(e)??"")},handleListTab:t=>!Xe(e.document,e.selection.focus.paragraphId,Je(e))&&(!!f()&&(d(),c(),i(e=>"indent"===t?function(t){const e=ra(t),a=_e(t).map((t,a)=>a<e.startIndex||a>e.endIndex?ew(t):t.list?vw(t,(t.list.level??0)+1):ew(t));return Cw(t,a,zw(a,e))}(e):lS(e)),s(),!0)),handleListEnter:()=>{const t=g();return!!(null==t?void 0:t.list)&&(d(),c(),p()&&0===Se(t).length?i(t=>function(t){const e=ra(t),a=_e(t).map((t,a)=>a<e.startIndex||a>e.endIndex?ew(t):bw(t));return Cw(t,a,zw(a,e))}(t)):r(t=>l(t,t=>function(t){const e=na(t.selection)?t:Rw(t),{paragraph:a,index:n,offset:r}=Ew(e),o=fw(a,xw(a,0,r),yw(a,r)),i=xw(a,r,Ae(a)),l=i.length>0?mw(a,i.map(t=>({text:t.text,styles:t.styles}))):(()=>{const t=ba("");return t.style=a.style?{...a.style}:void 0,t.list=aw(a.list),t})(),s=_e(e);return Cw(e,[...nw(s.slice(0,n)),o,l,...nw(s.slice(n+1))],Vw(Ie(l,0)))}(t)),{mergeKey:"splitListItem"}),s(),!0)},handleListBoundaryBackspace:t=>{const a=g();if(!(null==a?void 0:a.list)||!p())return!1;return 0===Te(a,e.selection.focus)&&(d(),c(),i(t=>lS(t)),t.currentTarget.value="",s(),!0)}}}function rA(t){return/[\p{L}\p{N}_]/u.test(t)}function oA(t,e){if(0===t.length)return{start:0,end:0};const a=Math.max(0,Math.min(e,t.length)),n=a===t.length?Math.max(0,a-1):a,r=t[n];if(!r||!rA(r))return{start:a,end:Math.min(t.length,a+1)};let o=n,i=n+1;for(;o>0&&rA(t[o-1]);)o-=1;for(;i<t.length&&rA(t[i]);)i+=1;return{start:o,end:i}}class iA{constructor(){a(this,"bindings",new Map)}register(t){this.bindings.set(t.id,t)}unregister(t){this.bindings.delete(t)}getBindings(){return Array.from(this.bindings.values())}execute(t,e,a){var n;const r=t.ctrlKey||t.metaKey,o=t.key.toLowerCase();for(const i of this.bindings.values())if(i.key.toLowerCase()===o&&Boolean(i.ctrlOrMeta)===r&&Boolean(i.shift)===t.shiftKey&&Boolean(i.alt)===t.altKey){if(i.command&&a){if((null==(n=a.canExecuteCommand)?void 0:n.call(a,i.command))??!0)return a.executeCommand(i.command),t.preventDefault(),!0}if(!1!==i.execute(e,t))return t.preventDefault(),!0}return!1}}const lA=[{id:"selectAll",command:"selectAll",key:"a",ctrlOrMeta:!0,execute:t=>{const e=t.state(),a=_e(e);if(0===a.length)return!1;const n=a[0],r=a[a.length-1];return t.clearPreferredColumn(),t.applyState(CS(e,{anchor:Ie(n,0),focus:Ie(r,Se(r).length)})),t.focusInput(),!0}},{id:"editImageAlt",command:"editImageAlt",key:"a",ctrlOrMeta:!0,alt:!0,execute:t=>!!t.selectedImageRun()&&(t.commandsController.promptForImageAlt(),!0)},{id:"insertFootnote",command:"insertFootnote",key:"f",ctrlOrMeta:!0,alt:!0,execute:t=>(t.commandsController.applyInsertFootnoteCommand(),!0)},{id:"pastePlainText",command:"pastePlainText",key:"v",ctrlOrMeta:!0,shift:!0,execute:t=>(t.setForcePlainTextPaste(!0),t.focusInput(),!0)},{id:"bold",command:"bold",key:"b",ctrlOrMeta:!0,execute:t=>(t.commandsController.applyBooleanStyleCommand("bold"),!0)},{id:"italic",command:"italic",key:"i",ctrlOrMeta:!0,execute:t=>(t.commandsController.applyBooleanStyleCommand("italic"),!0)},{id:"underline",command:"underline",key:"u",ctrlOrMeta:!0,execute:t=>(t.commandsController.applyBooleanStyleCommand("underline"),!0)},{id:"link",command:"link",key:"k",ctrlOrMeta:!0,execute:t=>(t.commandsController.promptForLink(),!0)},{id:"orderedList",command:"orderedList",key:"7",ctrlOrMeta:!0,shift:!0,execute:t=>(t.commandsController.applyParagraphListCommand("ordered"),!0)},{id:"bulletList",command:"bulletList",key:"8",ctrlOrMeta:!0,shift:!0,execute:t=>(t.commandsController.applyParagraphListCommand("bullet"),!0)},{id:"find",command:"find",key:"f",ctrlOrMeta:!0,execute:t=>(t.toggleFindReplace(!0),!0)},{id:"replace",command:"replace",key:"h",ctrlOrMeta:!0,execute:t=>(t.toggleReplace(!0),!0)},{id:"undo",command:"undo",key:"z",ctrlOrMeta:!0,execute:t=>(t.performUndo(),!0)},{id:"redo",command:"redo",key:"z",ctrlOrMeta:!0,shift:!0,execute:t=>(t.performRedo(),!0)},{id:"redoAlternative",command:"redo",key:"y",ctrlOrMeta:!0,execute:t=>(t.performRedo(),!0)},{id:"pageBreak",command:"pageBreak",key:"Enter",ctrlOrMeta:!0,execute:t=>(t.clearPreferredColumn(),t.resetTransactionGrouping(),t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>oS(t))),t.focusInput(),!0)},{id:"lineBreak",command:"lineBreak",key:"Enter",shift:!0,execute:t=>(t.clearPreferredColumn(),t.resetTransactionGrouping(),t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>Xw(t,"\n"))),t.focusInput(),!0)},{id:"splitBlock",command:"splitBlock",key:"Enter",execute:t=>(t.commandsController.handleListEnter()||(t.clearPreferredColumn(),t.resetTransactionGrouping(),t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>rS(t))),t.focusInput()),!0)}];function sA(t){const e=new iA;lA.forEach(t=>e.register(t));return{handleKeyDown:a=>{const n=t.state();if(t.isReadOnly()){const t=a.key,e=t.toLowerCase(),n="ArrowLeft"===t||"ArrowRight"===t||"ArrowUp"===t||"ArrowDown"===t||"Home"===t||"End"===t||"PageUp"===t||"PageDown"===t,r="Shift"===t||"Control"===t||"Meta"===t||"Alt"===t,o=(a.ctrlKey||a.metaKey)&&("a"===e||"c"===e);return void(n||r||o||a.preventDefault())}const r=t.executeCommand?{executeCommand:(e,a)=>{var n;return null==(n=t.executeCommand)?void 0:n.call(t,e,a)},canExecuteCommand:(e,a)=>{var n;return null==(n=t.canExecuteCommand)?void 0:n.call(t,e,a)}}:void 0;if(!e.execute(a,t,r)){if((a.ctrlKey||a.metaKey)&&!a.altKey){if(("ArrowLeft"===a.key||"ArrowRight"===a.key)&&(a.preventDefault(),t.resetTransactionGrouping(),t.moveSelectionByWord("ArrowLeft"===a.key?"left":"right",a.shiftKey)))return void t.focusInput();if("Backspace"===a.key||"Delete"===a.key){if(a.preventDefault(),t.clearPreferredColumn(),t.resetTransactionGrouping(),!na(n.selection))return t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>Yw(t))),a.currentTarget.value="",void t.focusInput();const e=_e(n),r=e.findIndex(t=>t.id===n.selection.focus.paragraphId),o=e[r];if(!o)return a.currentTarget.value="",void t.focusInput();if("Backspace"===a.key&&o.list){if(0===Te(o,n.selection.focus))return t.applySelectionAwareParagraphCommand(t=>lS(t)),a.currentTarget.value="",void t.focusInput()}const i=n.selection.focus.offset,l=Se(o),s=oA(l,i);return"Backspace"===a.key?0===i||s.start===i?t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>Yw(t))):t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(CS(e,{anchor:Ie(o,s.start),focus:Ie(o,i)}),t=>Yw(t))):i>=l.length?t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>Qw(t))):s.end>i?t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(CS(e,{anchor:Ie(o,i),focus:Ie(o,s.end)}),t=>Yw(t))):t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>Qw(t))),a.currentTarget.value="",void t.focusInput()}}if("Home"===a.key||"End"===a.key){a.preventDefault(),t.resetTransactionGrouping();const e="Home"===a.key?"start":"end";return a.ctrlKey||a.metaKey?t.moveSelectionToDocumentBoundary(e,a.shiftKey):t.moveSelectionToParagraphBoundary(e,a.shiftKey),void t.focusInput()}if(!a.altKey||a.ctrlKey||a.metaKey||"ArrowUp"!==a.key&&"ArrowDown"!==a.key||(a.preventDefault(),t.resetTransactionGrouping(),t.clearPreferredColumn(),!t.moveSelectedImageByParagraph("ArrowUp"===a.key?-1:1)))switch(a.key){case"Backspace":return t.commandsController.handleListBoundaryBackspace(a)?void a.preventDefault():(a.preventDefault(),t.clearPreferredColumn(),t.resetTransactionGrouping(),t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>Yw(t))),a.currentTarget.value="",void t.focusInput());case"Delete":return a.preventDefault(),t.clearPreferredColumn(),t.resetTransactionGrouping(),t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>Qw(t))),a.currentTarget.value="",void t.focusInput();case"Tab":{if(t.commandsController.handleListTab(a.shiftKey?"outdent":"indent"))return void a.preventDefault();const e=t.resolveAdjacentTableCellPosition(n.document,n.selection.focus.paragraphId,a.shiftKey?-1:1);if(e)return a.preventDefault(),t.clearPreferredColumn(),t.resetTransactionGrouping(),t.applySelectionPreservingStructure({anchor:e,focus:e}),void t.focusInput();break}case"ArrowLeft":return a.preventDefault(),t.resetTransactionGrouping(),a.shiftKey?(t.clearPreferredColumn(),t.applyState(AS(n,-1))):(t.clearPreferredColumn(),t.applyState(kS(n))),void t.focusInput();case"ArrowRight":return a.preventDefault(),t.resetTransactionGrouping(),a.shiftKey?(t.clearPreferredColumn(),t.applyState(function(t){return AS(t,1)}(n))):(t.clearPreferredColumn(),t.applyState(VS(n))),void t.focusInput();case"ArrowUp":return a.preventDefault(),t.resetTransactionGrouping(),void(a.shiftKey?t.moveVerticalSelection(-1,!0)||(t.applyState(function(t){return IS(t,-1)}(n)),t.focusInput()):t.moveVerticalByBlock(-1)||(t.applyState(function(t){return SS(t,-1)}(n)),t.focusInput()));case"ArrowDown":return a.preventDefault(),t.resetTransactionGrouping(),void(a.shiftKey?t.moveVerticalSelection(1,!0)||(t.applyState(function(t){return IS(t,1)}(n)),t.focusInput()):t.moveVerticalByBlock(1)||(t.applyState(function(t){return SS(t,1)}(n)),t.focusInput()));default:return}}},registry:e}}function dA(t,e){return t.paragraph.runs.map(t=>t.text).join("")[e]??""}function cA(t){return" "===t||"\t"===t||"\n"===t}function hA(t,e,a){if(a.isCollapsed)return null;const n=e.get(t);return void 0===n||n<a.startIndex||n>a.endIndex?null:a.startIndex===a.endIndex?{start:a.startParagraphOffset,end:a.endParagraphOffset}:t===a.start.paragraphId?{start:a.startParagraphOffset,end:Number.POSITIVE_INFINITY}:t===a.end.paragraphId?{start:0,end:a.endParagraphOffset}:{start:0,end:Number.POSITIVE_INFINITY}}function pA(t,e){var a,n,r,o;const i=ra(e),l=[],s=t.surfaceRect,d=new Map(_e(e).map((t,e)=>[t.id,e]));let c=null,h=null;if(!i.isCollapsed&&i.startIndex===i.endIndex&&i.endParagraphOffset-i.startParagraphOffset===1){const e=t=>t.paragraphId===i.start.paragraphId&&t.startOffset===i.startParagraphOffset&&t.endOffset===i.endParagraphOffset,a=t.inlineImages.find(e)??t.floatingImages.find(e);if(a&&(c={paragraphId:a.paragraphId,startOffset:a.startOffset,endOffset:a.endOffset,left:a.left-s.left,top:a.top-s.top,width:a.width,height:a.height,rotation:a.rotation??0}),!c){const e=t=>t.paragraphId===i.start.paragraphId&&t.startOffset===i.startParagraphOffset&&t.endOffset===i.endParagraphOffset,a=t.floatingTextBoxes.find(e),n=a?void 0:t.inlineTextBoxes.find(e),r=a??n;r&&(h={paragraphId:r.paragraphId,startOffset:r.startOffset,endOffset:r.endOffset,left:r.left-s.left,top:r.top-s.top,width:r.width,height:r.height,rotation:r.rotation??0,floating:Boolean(a)})}}const p=Je(e),u=Xe(e.document,e.selection.anchor.paragraphId,p),f=Xe(e.document,e.selection.focus.paragraphId,p);let g=!1;if(u&&f&&u.blockIndex===f.blockIndex&&u.zone===f.zone&&(u.rowIndex!==f.rowIndex||u.cellIndex!==f.cellIndex)){const o=We(e.document)[p];let i;if(i="header"===u.zone?null==(a=null==o?void 0:o.header)?void 0:a[u.blockIndex]:"footer"===u.zone?null==(n=null==o?void 0:o.footer)?void 0:n[u.blockIndex]:null==(r=null==o?void 0:o.blocks)?void 0:r[u.blockIndex],i&&"table"===i.type){g=!0;const e=on(i),a=e.find(t=>t.rowIndex===u.rowIndex&&t.cellIndex===u.cellIndex),n=e.find(t=>t.rowIndex===f.rowIndex&&t.cellIndex===f.cellIndex);if(a&&n){const r=Math.min(a.visualRowIndex,n.visualRowIndex),o=Math.max(a.visualRowIndex+a.rowSpan-1,n.visualRowIndex+n.rowSpan-1),d=Math.min(a.visualColumnIndex,n.visualColumnIndex),c=Math.max(a.visualColumnIndex+a.colSpan-1,n.visualColumnIndex+n.colSpan-1),h=new Set;for(const a of t.paragraphs)if(a.tableCell&&a.tableCell.tableId===i.id){const t=e.find(t=>t.rowIndex===a.tableCell.rowIndex&&t.cellIndex===a.tableCell.cellIndex);if(t){const e=t.visualRowIndex<=o&&t.visualRowIndex+t.rowSpan-1>=r,n=t.visualColumnIndex<=c&&t.visualColumnIndex+t.colSpan-1>=d;if(e&&n){const e=`${t.rowIndex}:${t.cellIndex}`;h.has(e)||(h.add(e),l.push({left:a.tableCell.left-s.left,top:a.tableCell.top-s.top,width:a.tableCell.width,height:a.tableCell.height}))}}}}}}if(!(g||i.isCollapsed||c||h))for(const S of t.paragraphs){const t=hA(S.paragraphId,d,i);if(!t)continue;const e=Math.max(t.start,S.startOffset),a=Math.min(t.end,S.endOffset);if(!(e>=a))for(const n of S.lines){let t=Math.max(e,n.startOffset),r=Math.min(a,n.endOffset);for(;t<r&&cA(dA(S,t));)t+=1;for(;r>t&&cA(dA(S,r-1));)r-=1;if(t>=r)continue;const o=n.slots.find(e=>e.offset===t),i=n.slots.find(t=>t.offset===r)??n.slots[n.slots.length-1];if(!o||!i)continue;const d=0===S.startOffset&&n.startOffset===S.startOffset&&n.top>S.top,c=d?S.top:n.top,h=d?n.top+n.height-S.top:n.height;l.push({left:o.left-s.left+1,top:c-s.top,width:Math.max(1,i.left-o.left+1-1),height:h})}}const m=e.selection.focus.paragraphId,v=t.paragraphsById.get(m)??[],b=null==(o=v[0])?void 0:o.paragraph,y=function(t,e){if(0===t.length)return null;const a=t.find(t=>e>=t.startOffset&&e<=t.endOffset)??t[t.length-1],n=a.lines.flatMap(t=>t.slots);if(0===n.length)return{left:a.left,top:a.top,height:Math.max(18,a.height)};let r=n[0],o=Math.abs(e-r.offset);for(const l of n){const t=Math.abs(e-l.offset);t<o&&(r=l,o=t)}const i=a.lines[0];return 0===a.startOffset&&void 0!==i&&e>=i.startOffset&&e<=i.endOffset&&r.top>a.top?{left:r.left,top:a.top,height:r.top+r.height-a.top}:{left:r.left,top:r.top,height:r.height}}(v,b?Te(b,e.selection.focus):e.selection.focus.offset),M=((null==y?void 0:y.left)??s.left)-s.left,x=((null==y?void 0:y.top)??s.top)-s.top,w=Math.max(18,(null==y?void 0:y.height)??28);return{selectionBoxes:l,inputBox:{left:M,top:x,height:w},caretBox:{left:M,top:x,height:w,visible:v.length>0&&!g&&!c&&!h},selectedImageBox:c,selectedTextBoxBox:h}}function uA(t,e){if(0===e.length)return t;const a={...t};for(const n of e)delete a[n];return a}function fA(t){const[e,a]=y({}),[n,r]=y({}),[o,i]=y({left:0,top:0,height:28}),[l,s]=y([]),[d,c]=y([]),[h,p]=y(null),[u,f]=y(null),[g,m]=y({left:0,top:0,height:28,visible:!1}),[v,b]=y(null);let M=0;const w=(a="selection")=>{var r;const o=t.surfaceRef();if(!o)return s([]),c([]),p(null),f(null),void m(t=>({...t,visible:!1}));const l=Yd({surface:o,state:t.state,measuredBlockHeights:e(),measuredParagraphLayouts:n(),zoomFactor:null==(r=t.zoomFactor)?void 0:r.call(t)});if(!l)return s([]),c([]),p(null),f(null),void m(t=>({...t,visible:!1}));const d=pA(l,t.state);s(d.selectionBoxes),c(function(t,e){const a=e.document.comments;if(!a||0===a.order.length)return[];const n=t.surfaceRect,r=new Map(_e(e).map((t,e)=>[t.id,e])),o=[];for(const i of a.order){const e=a.items[i];if(!(null==e?void 0:e.start)||!(null==e?void 0:e.end))continue;const l=r.get(e.start.paragraphId),s=r.get(e.end.paragraphId);if(void 0!==l&&void 0!==s)for(const a of t.paragraphs){const t=r.get(a.paragraphId);if(void 0===t||t<l||t>s)continue;const d=t===l?e.start.offset:0,c=t===s?e.end.offset:Number.POSITIVE_INFINITY,h=Math.max(d,a.startOffset),p=Math.min(c,a.endOffset);if(!(h>=p))for(const e of a.lines){const t=Math.max(h,e.startOffset),a=Math.min(p,e.endOffset);if(t>=a)continue;const r=e.slots.find(e=>e.offset===t),l=e.slots.find(t=>t.offset===a)??e.slots[e.slots.length-1];r&&l&&o.push({commentId:i,left:r.left-n.left,top:e.top-n.top,width:Math.max(1,l.left-r.left),height:e.height})}}}return o}(l,t.state)),p(d.selectedImageBox),f(d.selectedTextBoxBox),i(d.inputBox),m(d.caretBox)},S=(t="selection")=>{const e=++M;queueMicrotask(()=>{e===M&&w(t)})};x(()=>{t.state.selection.anchor.paragraphId,t.state.selection.anchor.runId,t.state.selection.anchor.offset,t.state.selection.focus.paragraphId,t.state.selection.focus.runId,t.state.selection.focus.offset,S("selection")}),x(()=>{var e;t.state.document,t.state.activeSectionIndex,t.state.activeZone,(null==(e=t.isImporting)?void 0:e.call(t))||S("content-change")}),x(()=>{const e=t.viewportRef();if(!e)return;const a=()=>{S("scroll")},n=()=>{S("resize")};e.addEventListener("scroll",a,{passive:!0}),window.addEventListener("resize",n),T(()=>{e.removeEventListener("scroll",a),window.removeEventListener("resize",n)})});return{measuredBlockHeights:e,measuredParagraphLayouts:n,inputBox:o,selectionBoxes:l,commentHighlights:d,selectedImageBox:h,selectedTextBoxBox:u,caretBox:g,preferredColumnX:v,setPreferredColumnX:b,clearPreferredColumn:()=>b(null),requestInputBoxSync:S,scheduleDeferredLayoutMeasurement:(t,e={})=>(e.paragraphIds&&e.paragraphIds.length>0&&r(t=>uA(t,e.paragraphIds??[])),S(t),e.resolveWhenDone?Promise.resolve():null),stabilizeLayoutAfterImport:async()=>{a({}),r({}),await new Promise(t=>{var e;e=()=>t(),"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>e()):globalThis.setTimeout(e,16)}),S("import")},syncMeasuredLayoutMetrics:(t="content-change")=>(S(t),!1),syncInputBox:w,setMeasuredBlockHeights:a,setMeasuredParagraphLayouts:r,applyInvalidation:e=>{var n,o;if(!(null==(n=t.isImporting)?void 0:n.call(t))){if(e.dirtyAll||e.structureChanged)a({}),r({});else if(((null==(o=e.dirtyParagraphIds)?void 0:o.length)??0)>0){const t=e.dirtyParagraphIds??[];r(e=>uA(e,t))}S("content-change")}},onCleanupHook:()=>{M+=1}}}const gA="documents",mA="current-document";const vA=new class{constructor(){a(this,"db",null)}async getDB(){return this.db||(this.db=await(t={name:"oasis-editor-db",version:1,onUpgrade:t=>{t.objectStoreNames.contains(gA)||t.createObjectStore(gA)}},new Promise((e,a)=>{const n=indexedDB.open(t.name,t.version);n.onerror=()=>{var t;a(new Error(`Failed to open IndexedDB: ${null==(t=n.error)?void 0:t.message}`))},n.onsuccess=()=>{e(n.result)},n.onupgradeneeded=e=>{const a=n.result;t.onUpgrade(a,e.oldVersion,e.newVersion)}}))),this.db;var t}async saveDocument(t){const e=await this.getDB();await function(t,e,a,n){return new Promise((r,o)=>{try{const i=t.transaction([e],"readwrite").objectStore(e).put(n,a);i.onerror=()=>{var t;o(new Error(`Failed to put item in ${e}: ${null==(t=i.error)?void 0:t.message}`))},i.onsuccess=()=>{r()}}catch(i){o(i)}})}(e,gA,mA,t)}async loadDocument(){const t=await this.getDB();return await function(t,e,a){return new Promise((n,r)=>{try{const o=t.transaction([e],"readonly").objectStore(e).get(a);o.onerror=()=>{var t;r(new Error(`Failed to get item from ${e}: ${null==(t=o.error)?void 0:t.message}`))},o.onsuccess=()=>{n(o.result??null)}}catch(o){r(o)}})}(t,gA,mA)}async clearDocument(){const t=await this.getDB();await function(t,e,a){return new Promise((n,r)=>{try{const o=t.transaction([e],"readwrite").objectStore(e).delete(a);o.onerror=()=>{var t;r(new Error(`Failed to delete item from ${e}: ${null==(t=o.error)?void 0:t.message}`))},o.onsuccess=()=>{n()}}catch(o){r(o)}})}(t,gA,mA)}close(){this.db&&(this.db.close(),this.db=null)}};function bA(t){const[e,a]=y(""),[n,r]=y(""),[o,i]=y({matchCase:!1,wholeWord:!1}),[l,s]=y([]),[d,c]=y(-1),[h,p]=y(!1);x(A([()=>t.state.document,e,o],([t,e,a])=>{const n=function(t,e,a={}){if(!e)return[];const n=[],r=Ke(t),{matchCase:o=!1,wholeWord:i=!1}=a,l=o?"g":"gi";let s=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");i&&(s=`\\b${s}\\b`);const d=new RegExp(s,l);return r.forEach((t,e)=>{const a=Se(t);let r;for(d.lastIndex=0;null!==(r=d.exec(a));){const a=r.index,o=r.index+r[0].length;n.push({anchor:Ie(t,a),focus:Ie(t,o),paragraphIndex:e}),r.index===d.lastIndex&&d.lastIndex++}}),n}(t,e,a);s(n),0===n.length?c(-1):(d()>=n.length||-1===d())&&c(0)}));const u=e=>{const a=l()[e];a&&t.applyState(CS(t.state,{anchor:a.anchor,focus:a.focus}))};return{searchTerm:e,setSearchTerm:a,replaceTerm:n,setReplaceTerm:r,findOptions:o,setFindOptions:i,matches:l,currentIndex:d,findNext:()=>{const t=l().length;if(0===t)return;const e=(d()+1)%t;c(e),u(e)},findPrevious:()=>{const t=l().length;if(0===t)return;const e=(d()-1+t)%t;c(e),u(e)},replace:()=>{if(0===l().length||-1===d())return;const e=l()[d()];t.applyTransactionalState(t=>Xw(CS(t,{anchor:e.anchor,focus:e.focus}),n()),{mergeKey:"findReplace"})},replaceAll:()=>{const e=l();0!==e.length&&(t.applyTransactionalState(t=>{let a=t;for(let r=e.length-1;r>=0;r--){const t=e[r];a=CS(a,{anchor:t.anchor,focus:t.focus}),a=Xw(a,n())}return a},{mergeKey:"findReplaceAll"}),p(!1),t.focusInput())},isOpen:h,setIsOpen:p}}const yA=t=>t.cells.reduce((t,e)=>t+Math.max(1,e.colSpan??1),0),MA=t=>t.rows.reduce((t,e)=>Math.max(t,yA(e)),0),xA=(t,e)=>{let a=0;for(const n of t.cells){const t=Math.max(1,n.colSpan??1);if(e>=a&&e<a+t)return n;a+=t}return null},wA=t=>{for(const e of t.rows)for(const t of e.cells){if("continue"===t.vMerge)continue;const e=t.blocks[0];if(e)return e}return null},SA=(t,e,a)=>{const n=We(t);for(const r of n){const t=[...r.header||[],...r.blocks,...r.footer||[]];for(const n of t){if("table"!==n.type)continue;const t=n.rows.flatMap(t=>t.cells.filter(t=>"continue"!==t.vMerge&&t.blocks.length>0)),r=t.findIndex(t=>t.blocks.some(t=>t.id===e));if(-1===r)continue;const o=t[r+a],i=null==o?void 0:o.blocks[0];return i?Ie(i,0):null}}return null},AA=(t,e,a="main")=>{const n=Je(t),r=Pe(t.document),o=Math.max(0,Math.min(n,r.length-1)),i=r[o];if(!i)return t;const l=[...r];return l[o]="header"===a?{...i,header:e}:"footer"===a?{...i,footer:e}:{...i,blocks:e},{...t,document:{...t.document,sections:l}}};function IA(t,e){return t.visualRowIndex!==e.visualRowIndex?t.visualRowIndex-e.visualRowIndex:t.visualColumnIndex!==e.visualColumnIndex?t.visualColumnIndex-e.visualColumnIndex:0}function TA(t,e){const a=t.selection,n=Je(t),r=Xe(t.document,a.anchor.paragraphId,n),o=Xe(t.document,a.focus.paragraphId,n);if(!r||!o||r.blockIndex!==o.blockIndex||r.zone!==o.zone)return null;const i=e.getTargetBlocks(t,r.zone)[r.blockIndex];if(!i||"table"!==i.type)return null;const l=on(i),s=l.find(t=>t.rowIndex===r.rowIndex&&t.cellIndex===r.cellIndex),d=l.find(t=>t.rowIndex===o.rowIndex&&t.cellIndex===o.cellIndex);return s&&d?{anchorLocation:r,focusLocation:o,anchorCell:s,focusCell:d,tableBlock:i,tableLayout:l}:null}function CA(t){const e=(t,e)=>{const a=Pe(t.document),n=Je(t),r=a[Math.max(0,Math.min(n,a.length-1))];return r?"header"===e?r.header||[]:"footer"===e?r.footer||[]:r.blocks:[]},{resolveTableCellRangeSelection:a,resolveSelectedTableCells:n,resolveHorizontalTableCellRange:r,resolveVerticalTableCellRange:o}=function(t){return{resolveTableCellRangeSelection:e=>{var a,n,r,o,i;const l=e.selection,s=TA(e,t);if(!s||s.anchorLocation.rowIndex===s.focusLocation.rowIndex&&s.anchorLocation.cellIndex===s.focusLocation.cellIndex)return null==(a=t.logger)||a.debug(`resolveTableCellRangeSelection: no expansion (anchor=${l.anchor.paragraphId} focus=${l.focus.paragraphId})`),null;const d=Math.min(s.anchorLocation.rowIndex,s.focusLocation.rowIndex),c=Math.max(s.anchorLocation.rowIndex,s.focusLocation.rowIndex),h=Math.min(s.anchorLocation.cellIndex,s.focusLocation.cellIndex),p=Math.max(s.anchorLocation.cellIndex,s.focusLocation.cellIndex);null==(n=t.logger)||n.info(`resolveTableCellRangeSelection: expanding r${s.anchorLocation.rowIndex}:c${s.anchorLocation.cellIndex}->r${s.focusLocation.rowIndex}:c${s.focusLocation.cellIndex} (anchor=${l.anchor.paragraphId} focus=${l.focus.paragraphId}) range=[rows ${d}..${c}, cells ${h}..${p}]`);const u=IA(s.anchorCell,s.focusCell)<=0?s.anchorLocation:s.focusLocation,f=IA(s.anchorCell,s.focusCell)<=0?s.focusLocation:s.anchorLocation,g=null==(o=null==(r=s.tableBlock.rows[u.rowIndex])?void 0:r.cells[u.cellIndex])?void 0:o.blocks[0],m=null==(i=s.tableBlock.rows[f.rowIndex])?void 0:i.cells[f.cellIndex],v=null==m?void 0:m.blocks[m.blocks.length-1];return g&&v?{anchor:Ie(g,0),focus:Ie(v,Se(v).length)}:null},resolveSelectedTableCells:e=>{const a=TA(e,t);if(!a)return null;const n=Math.min(a.anchorCell.visualRowIndex,a.focusCell.visualRowIndex),r=Math.max(a.anchorCell.visualRowIndex+a.anchorCell.rowSpan-1,a.focusCell.visualRowIndex+a.focusCell.rowSpan-1),o=Math.min(a.anchorCell.visualColumnIndex,a.focusCell.visualColumnIndex),i=Math.max(a.anchorCell.visualColumnIndex+a.anchorCell.colSpan-1,a.focusCell.visualColumnIndex+a.focusCell.colSpan-1),l=a.tableLayout.filter(t=>t.visualRowIndex<=r&&t.visualRowIndex+t.rowSpan-1>=n&&t.visualColumnIndex<=i&&t.visualColumnIndex+t.colSpan-1>=o);return{blockIndex:a.anchorLocation.blockIndex,cells:l,zone:a.anchorLocation.zone}},resolveHorizontalTableCellRange:e=>{const a=TA(e,t);if(!a||a.anchorCell.visualRowIndex!==a.focusCell.visualRowIndex)return null;const n=IA(a.anchorCell,a.focusCell);if(0===n)return null;const r=n<=0?a.anchorLocation:a.focusLocation,o=n<=0?a.focusLocation:a.anchorLocation;return{blockIndex:a.anchorLocation.blockIndex,rowIndex:r.rowIndex,startCellIndex:r.cellIndex,endCellIndex:o.cellIndex,zone:a.anchorLocation.zone}},resolveVerticalTableCellRange:e=>{const a=TA(e,t);if(!a||a.anchorLocation.cellIndex!==a.focusLocation.cellIndex)return null;const n=Math.min(a.anchorCell.visualRowIndex,a.focusCell.visualRowIndex),r=Math.max(a.anchorCell.visualRowIndex,a.focusCell.visualRowIndex);return n===r?null:{blockIndex:a.anchorLocation.blockIndex,startRowIndex:n,endRowIndex:r,cellIndex:a.anchorLocation.cellIndex,zone:a.anchorLocation.zone}}}}({getTargetBlocks:e,logger:t.logger}),{canMergeSelectedTableCells:i,canSplitSelectedTableCell:l,canMergeSelectedTableRows:s,canMergeSelectedTable:d,canSplitSelectedTableCellVertically:c,canSplitSelectedTable:h,canEditSelectedTableRow:p,canEditSelectedTableColumn:u}=function(t){const e=e=>{const a=t.resolveHorizontalTableCellRange(e);return Boolean(a&&a.endCellIndex>a.startCellIndex)},a=e=>{var a;const n=Xe(e.document,e.selection.focus.paragraphId,Je(e));if(!n)return!1;const r=t.getTargetBlocks(e,n.zone)[n.blockIndex];if(!r||"table"!==r.type)return!1;const o=null==(a=r.rows[n.rowIndex])?void 0:a.cells[n.cellIndex];return Boolean(((null==o?void 0:o.colSpan)??1)>1)},n=e=>{var a;const n=t.resolveVerticalTableCellRange(e);if(!n)return!1;const r=t.getTargetBlocks(e,n.zone)[n.blockIndex];if(!r||"table"!==r.type)return!1;for(let t=n.startRowIndex;t<=n.endRowIndex;t+=1){const e=null==(a=r.rows[t])?void 0:a.cells[n.cellIndex];if(!e||"continue"===e.vMerge||1!==e.blocks.length)return!1}return!0},r=e=>{var a;const n=Xe(e.document,e.selection.focus.paragraphId,Je(e));if(!n)return!1;const r=t.getTargetBlocks(e,n.zone)[n.blockIndex];if(!r||"table"!==r.type)return!1;const o=null==(a=r.rows[n.rowIndex])?void 0:a.cells[n.cellIndex];return Boolean(((null==o?void 0:o.rowSpan)??1)>1&&"restart"===(null==o?void 0:o.vMerge))};return{canMergeSelectedTableCells:e,canSplitSelectedTableCell:a,canMergeSelectedTableRows:n,canMergeSelectedTable:t=>e(t)||n(t),canSplitSelectedTableCellVertically:r,canSplitSelectedTable:t=>a(t)||r(t),canEditSelectedTableRow:e=>{const a=Xe(e.document,e.selection.focus.paragraphId,Je(e));if(!a)return!1;const n=t.getTargetBlocks(e,a.zone)[a.blockIndex];return Boolean(n&&"table"===n.type)},canEditSelectedTableColumn:e=>{const a=Xe(e.document,e.selection.focus.paragraphId,Je(e));if(!a)return!1;const n=t.getTargetBlocks(e,a.zone)[a.blockIndex];return!(!n||"table"!==n.type)&&MA(n)>1}}}({getTargetBlocks:e,resolveHorizontalTableCellRange:r,resolveVerticalTableCellRange:o}),{mergeSelectedTableCells:f,mergeSelectedTableRows:g,mergeSelectedTable:m,splitSelectedTableCellVertically:v,splitSelectedTableCell:b,splitSelectedTable:y}=function(t){const e=e=>{const a=t.resolveHorizontalTableCellRange(e);if(!a)return e;const n=t.getTargetBlocks(e,a.zone).map(YS),r=n[a.blockIndex];if(!r||"table"!==r.type)return e;const o=r.rows[a.rowIndex];if(!o)return e;const i=o.cells.slice(a.startCellIndex,a.endCellIndex+1);if(i.length<2)return e;const l={...i[0],colSpan:i.reduce((t,e)=>t+Math.max(1,e.colSpan??1),0),blocks:i.flatMap(t=>t.blocks.map(t=>YS(t)))};o.cells.splice(a.startCellIndex,i.length,l);const s=l.blocks[0];return s?{...AA(e,n,a.zone),selection:{anchor:Ie(s,0),focus:Ie(s,0)}}:e},a=e=>{const a=t.resolveVerticalTableCellRange(e);if(!a)return e;const n=t.getTargetBlocks(e,a.zone).map(YS),r=n[a.blockIndex];if(!r||"table"!==r.type)return e;const o=[];for(let t=a.startRowIndex;t<=a.endRowIndex;t+=1){const n=r.rows[t],i=null==n?void 0:n.cells[a.cellIndex];if(!n||!i||"continue"===i.vMerge||1!==i.blocks.length)return e;o.push(i)}if(o.length<2)return e;const i=Math.max(1,o[0].colSpan??1);if(!o.every(t=>Math.max(1,t.colSpan??1)===i))return e;const l={...o[0],rowSpan:o.length,vMerge:"restart",blocks:o.flatMap(t=>t.blocks.map(t=>YS(t)))};r.rows[a.startRowIndex].cells[a.cellIndex]=l;for(let t=a.startRowIndex+1;t<=a.endRowIndex;t+=1){const e=Ma([ba("")],i);e.blocks=[],e.vMerge="continue",r.rows[t].cells[a.cellIndex]=e}const s=l.blocks[0];return s?{...AA(e,n,a.zone),selection:{anchor:Ie(s,0),focus:Ie(s,0)}}:e},n=e=>{var a;const n=Xe(e.document,e.selection.focus.paragraphId,Je(e));if(!n)return e;const r=t.getTargetBlocks(e,n.zone).map(YS),o=r[n.blockIndex];if(!o||"table"!==o.type)return e;const i=null==(a=o.rows[n.rowIndex])?void 0:a.cells[n.cellIndex],l=Math.max(1,(null==i?void 0:i.rowSpan)??1);if(!i||l<=1||"restart"!==i.vMerge)return e;i.rowSpan=void 0,i.vMerge=void 0;const s=Math.max(1,i.colSpan??1);for(let t=1;t<l;t+=1){const e=o.rows[n.rowIndex+t];if(!e)break;const a=Ma([ba("")],s);e.cells[n.cellIndex]=a}const d=i.blocks[0];return d?{...AA(e,r,n.zone),selection:{anchor:Ie(d,0),focus:Ie(d,0)}}:e},r=e=>{var a;const n=Xe(e.document,e.selection.focus.paragraphId,Je(e));if(!n)return e;const r=t.getTargetBlocks(e,n.zone).map(YS),o=r[n.blockIndex];if(!o||"table"!==o.type)return e;const i=o.rows[n.rowIndex],l=null==i?void 0:i.cells[n.cellIndex],s=Math.max(1,(null==l?void 0:l.colSpan)??1);if(!i||!l||s<=1)return e;const d=[{...l,colSpan:1,blocks:l.blocks.map(t=>YS(t))},...Array.from({length:s-1},()=>Ma([ba("")]))];i.cells.splice(n.cellIndex,1,...d);const c=null==(a=d[0])?void 0:a.blocks[0];return c?{...AA(e,r,n.zone),selection:{anchor:Ie(c,0),focus:Ie(c,0)}}:e};return{mergeSelectedTableCells:e,mergeSelectedTableRows:a,mergeSelectedTable:n=>t.canMergeSelectedTableCells(n)?e(n):t.canMergeSelectedTableRows(n)?a(n):n,splitSelectedTableCellVertically:n,splitSelectedTableCell:r,splitSelectedTable:e=>t.canSplitSelectedTableCellVertically(e)?n(e):t.canSplitSelectedTableCell(e)?r(e):e}}({getTargetBlocks:e,resolveHorizontalTableCellRange:r,resolveVerticalTableCellRange:o,canMergeSelectedTableCells:i,canMergeSelectedTableRows:s,canSplitSelectedTableCell:l,canSplitSelectedTableCellVertically:c}),{insertSelectedTableRow:M,deleteSelectedTableRow:x,insertSelectedTableColumn:w,deleteSelectedTableColumn:S}=function(t){return{insertSelectedTableRow:(e,a)=>{var n,r;const o=Xe(e.document,e.selection.focus.paragraphId,Je(e));if(!o)return e;const i=t.getTargetBlocks(e,o.zone).map(YS),l=i[o.blockIndex];if(!l||"table"!==l.type)return e;const s=l.rows[o.rowIndex];if(!s)return e;const d=Math.max(0,Math.min(l.rows.length,o.rowIndex+(a>0?1:0)));let c;if(l.rows.some(t=>t.cells.some(t=>Math.max(1,t.rowSpan??1)>1||void 0!==t.vMerge))){const t=on(l),a=t.find(t=>t.rowIndex===o.rowIndex&&t.cellIndex===o.cellIndex),r=t.filter(t=>t.rowIndex===o.rowIndex);c=xa((r.length>0?r:t.filter(t=>t.rowIndex===Math.max(0,o.rowIndex-1))).map(e=>{const a=t.find(t=>t.visualColumnIndex===e.visualColumnIndex&&t.visualRowIndex<d&&t.visualRowIndex+t.rowSpan>d);if(a){a.cell.rowSpan=Math.max(1,a.cell.rowSpan??1)+1,a.cell.vMerge="restart";const t=Ma([ba("")],e.colSpan);return t.blocks=[],t.vMerge="continue",t}return Ma([ba("")],e.colSpan)})),l.rows.splice(d,0,c);const s=(null==a?void 0:a.visualColumnIndex)??o.cellIndex,h=xA(c,s),p=(null==h?void 0:h.blocks[0])??(null==(n=c.cells.find(t=>"continue"!==t.vMerge&&t.blocks[0]))?void 0:n.blocks[0])??wA(l);return p?{...AA(e,i,o.zone),selection:{anchor:Ie(p,0),focus:Ie(p,0)}}:AA(e,i,o.zone)}c=xa(s.cells.map(t=>Ma([ba("")],Math.max(1,t.colSpan??1)))),l.rows.splice(d,0,c);const h=c.cells[Math.min(o.cellIndex,c.cells.length-1)],p=(null==h?void 0:h.blocks[0])??(null==(r=c.cells.find(t=>"continue"!==t.vMerge&&t.blocks[0]))?void 0:r.blocks[0])??wA(l);return p?{...AA(e,i,o.zone),selection:{anchor:Ie(p,0),focus:Ie(p,0)}}:AA(e,i,o.zone)},deleteSelectedTableRow:e=>{const a=Xe(e.document,e.selection.focus.paragraphId,Je(e));if(!a)return e;const n=t.getTargetBlocks(e,a.zone).map(YS),r=n[a.blockIndex];if(!r||"table"!==r.type)return e;if(r.rows.length<=1)return e;const o=r.rows[a.rowIndex];if(!o)return e;if(o.cells.some(t=>"continue"!==t.vMerge&&Math.max(1,t.rowSpan??1)>1))return e;const i=r.rows.some(t=>t.cells.some(t=>Math.max(1,t.rowSpan??1)>1||void 0!==t.vMerge)),l=i?on(r).find(t=>t.rowIndex===a.rowIndex&&t.cellIndex===a.cellIndex):null;if(i){const t=on(r);for(const e of t)e.visualRowIndex<a.rowIndex&&e.visualRowIndex+e.rowSpan>a.rowIndex&&(e.cell.rowSpan=Math.max(1,e.cell.rowSpan??1)-1,e.cell.rowSpan<=1?(e.cell.rowSpan=void 0,e.cell.vMerge=void 0):e.cell.vMerge="restart")}r.rows.splice(a.rowIndex,1);const s=r.rows[Math.min(a.rowIndex,r.rows.length-1)],d=s?xA(s,Math.min((null==l?void 0:l.visualColumnIndex)??a.cellIndex,Math.max(0,yA(s)-1))):null,c=(null==d?void 0:d.blocks[0])??wA(r);return c?{...AA(e,n,a.zone),selection:{anchor:Ie(c,0),focus:Ie(c,0)}}:AA(e,n,a.zone)},insertSelectedTableColumn:(e,a)=>{var n;const r=Xe(e.document,e.selection.focus.paragraphId,Je(e));if(!r)return e;const o=t.getTargetBlocks(e,r.zone).map(YS),i=o[r.blockIndex];if(!i||"table"!==i.type)return e;if(i.rows.some(t=>t.cells.some(t=>Math.max(1,t.colSpan??1)>1))){const t=on(i).find(t=>t.rowIndex===r.rowIndex&&t.cellIndex===r.cellIndex),n=((null==t?void 0:t.visualColumnIndex)??r.cellIndex)+(a>0?Math.max(1,(null==t?void 0:t.colSpan)??1):0);for(const e of i.rows){const t=[];let a=0,r=!1;for(const o of e.cells){const e=Math.max(1,o.colSpan??1);!r&&n<=a&&(t.push(Ma([ba("")])),r=!0),!r&&a<n&&n<a+e?(t.push({...o,colSpan:e+1}),r=!0):t.push(o),a+=e}r||t.push(Ma([ba("")])),e.cells=t}const l=i.rows[r.rowIndex],s=l?xA(l,n):null,d=(null==s?void 0:s.blocks[0])??wA(i);return d?{...AA(e,o,r.zone),selection:{anchor:Ie(d,0),focus:Ie(d,0)}}:AA(e,o,r.zone)}const l=Math.max(0,Math.min((null==(n=i.rows[0])?void 0:n.cells.length)??0,r.cellIndex+(a>0?1:0)));for(const t of i.rows)t.cells.splice(l,0,Ma([ba("")]));const s=i.rows[r.rowIndex],d=null==s?void 0:s.cells[l],c=(null==d?void 0:d.blocks[0])??wA(i);return c?{...AA(e,o,r.zone),selection:{anchor:Ie(c,0),focus:Ie(c,0)}}:AA(e,o,r.zone)},deleteSelectedTableColumn:e=>{var a;const n=Xe(e.document,e.selection.focus.paragraphId,Je(e));if(!n)return e;const r=t.getTargetBlocks(e,n.zone).map(YS),o=r[n.blockIndex];if(!o||"table"!==o.type)return e;if(MA(o)<=1)return e;if(o.rows.some(t=>t.cells.some(t=>Math.max(1,t.colSpan??1)>1))){const t=on(o).find(t=>t.rowIndex===n.rowIndex&&t.cellIndex===n.cellIndex),a=(null==t?void 0:t.visualColumnIndex)??n.cellIndex;for(const e of o.rows){const t=[];let n=0;for(const r of e.cells){const e=Math.max(1,r.colSpan??1);a>=n&&a<n+e?e>1&&t.push({...r,colSpan:e-1>1?e-1:void 0}):t.push(r),n+=e}e.cells=t}const i=o.rows[n.rowIndex],l=i&&xA(i,Math.min(a,Math.max(0,yA(i)-1))),s=(null==l?void 0:l.blocks[0])??wA(o);return s?{...AA(e,r,n.zone),selection:{anchor:Ie(s,0),focus:Ie(s,0)}}:AA(e,r,n.zone)}if((null==(a=o.rows[0])?void 0:a.cells.length)<=1)return e;for(const t of o.rows)t.cells.splice(n.cellIndex,1);const i=o.rows[n.rowIndex],l=null==i?void 0:i.cells[Math.min(n.cellIndex,i.cells.length-1)],s=(null==l?void 0:l.blocks[0])??wA(o);return s?{...AA(e,r,n.zone),selection:{anchor:Ie(s,0),focus:Ie(s,0)}}:AA(e,r,n.zone)}}}({getTargetBlocks:e}),{withExpandedTableCellSelection:A,applySelectionAwareTextCommand:I,applySelectionAwareParagraphCommand:T}=function(t){const e=e=>{const a=t.resolveTableCellRangeSelection(e);return a?t.applySelectionToStatePreservingStructure(e,a):e},a=(a,n)=>{t.applyTransactionalState(r=>{var o,i,l;const s=t.resolveSelectedTableCells(r);if(!s||s.cells.length<=1){const i=e(r);return i!==r&&(null==(o=t.logger)||o.info(`${n}: expanded selection to ${i.selection.anchor.paragraphId}[${i.selection.anchor.offset}]..${i.selection.focus.paragraphId}[${i.selection.focus.offset}]`)),a(i)}const{blockIndex:d,cells:c,zone:h}=s;null==(i=t.logger)||i.info(`${n}: multi-cell selection in table block ${d} (${c.length} cells) in zone ${h}`);const p=[],u=[];for(const t of c)p.push(...t.cell.blocks),u.push(t.cell.blocks.length);if(0===p.length)return r;const f={...r,document:Ta(p,void 0,void 0,void 0,void 0,r.document.assets),selection:{anchor:Ie(p[0],0),focus:Ie(p[p.length-1],Se(p[p.length-1]).length)}},g=_e(a(f)),m=t.getTargetBlocks(r,h),v=YS(m[d]);if(!v)return r;const b=m.map((t,e)=>e===d?v:t),y=v;let M=0;for(let t=0;t<c.length;t+=1){const e=c[t],a=u[t],n=g.slice(M,M+a);M+=a;const r=null==(l=y.rows[e.rowIndex])?void 0:l.cells[e.cellIndex];r&&(r.blocks=n)}return AA(r,b,h)})};return{withExpandedTableCellSelection:e,applySelectionAwareTextCommand:t=>{a(t,"applySelectionAwareTextCommand")},applySelectionAwareParagraphCommand:t=>{a(t,"applySelectionAwareParagraphCommand")}}}({applyTransactionalState:t.applyTransactionalState,applySelectionToStatePreservingStructure:t.applySelectionToStatePreservingStructure,getTargetBlocks:e,resolveTableCellRangeSelection:a,resolveSelectedTableCells:n,logger:t.logger});return{resolveTableCellRangeSelection:a,resolveHorizontalTableCellRange:r,resolveVerticalTableCellRange:o,canMergeSelectedTableCells:i,canSplitSelectedTableCell:l,canMergeSelectedTableRows:s,canMergeSelectedTable:d,canSplitSelectedTableCellVertically:c,canSplitSelectedTable:h,canEditSelectedTableRow:p,canEditSelectedTableColumn:u,mergeSelectedTableCells:f,mergeSelectedTableRows:g,mergeSelectedTable:m,splitSelectedTableCellVertically:v,splitSelectedTableCell:b,splitSelectedTable:y,insertSelectedTableRow:M,deleteSelectedTableRow:x,insertSelectedTableColumn:w,deleteSelectedTableColumn:S,getRowVisualWidth:yA,getTableVisualWidth:MA,findCellAtVisualColumn:xA,findFirstNavigableParagraphInTable:wA,updateBlocksInCurrentSection:AA,resolveAdjacentTableCellPosition:SA,applyTableAwareParagraphEdit:(t,a)=>((t,e,a)=>{var n;const r=Xe(t.document,t.selection.focus.paragraphId,Je(t));if(!r||t.selection.anchor.paragraphId!==t.selection.focus.paragraphId)return a(t);const o=r.zone,i=e(t,o),l=YS(i[r.blockIndex]);if(!l||"table"!==l.type)return a(t);const s=i.map((t,e)=>e===r.blockIndex?l:t),d=null==(n=l.rows[r.rowIndex])?void 0:n.cells[r.cellIndex];if(!d)return a(t);const c=a({...t,document:Ta(d.blocks,void 0,void 0,void 0,void 0,t.document.assets),selection:{anchor:{...t.selection.anchor},focus:{...t.selection.focus}}}),h=Ke(c.document).filter(t=>"paragraph"===t.type);return d.blocks.splice(0,d.blocks.length,...h),{...AA(t,s,o),selection:c.selection}})(t,e,a),withExpandedTableCellSelection:A,applySelectionAwareTextCommand:I,applySelectionAwareParagraphCommand:T,insertTableCommand:(e,a)=>{var n;null==(n=t.logger)||n.info(`insertTableCommand: ${e}x${a}`),t.applyTransactionalState(t=>function(t,e,a){const n=100/Math.max(1,a)+"%",r=[];for(let g=0;g<e;g+=1){const t=[];for(let e=0;e<a;e+=1)t.push({...Ma([ba("")]),style:{width:n}});r.push(xa(t))}const o={...wa(r),style:{width:"100%"}},i=ta(t,t.selection.focus),l=We(t.document),s=Je(t),d=Ye(t),c=t=>{const e=t.findIndex(t=>t.id===i.paragraphId||"paragraph"!==t.type&&He(t).some(t=>t.id===i.paragraphId));return-1===e?{nextBlocks:t,found:!1}:{nextBlocks:[...t.slice(0,e+1),o,...t.slice(e+1)],found:!0}},h=l[s];if(!h)return t;const p={...h};let u=!1;if("header"===d){const t=c(h.header??[]);p.header=t.nextBlocks,u=t.found}else if("footer"===d){const t=c(h.footer??[]);p.footer=t.nextBlocks,u=t.found}else{const t=c(h.blocks);p.blocks=t.nextBlocks,u=t.found}if(!u)return t;const f=[...l];return f[s]=p,{...t,document:{...t.document,sections:f},selection:Vw(Ie(o.rows[0].cells[0].blocks[0],0))}}(t,e,a),{mergeKey:"insertTable"}),t.focusInput()}}}function kA(t,e,a,n=0){const r=ve(me(e));if(!a)return r;const o=ol(e,a,n);return null!==o&&Number.isFinite(o)&&o>0?Math.min(r,o):r}function VA(t,e){let a=null;const n=(t,e,a)=>{const n=_e(t).find(t=>t.id===e);return n?{anchor:Ie(n,a),focus:Ie(n,a+1)}:null},r=(t,e)=>({...t,selection:{anchor:{...e.anchor},focus:{...e.focus}}}),o=o=>{var i;const l=a;if(!l)return;const s=(null==(i=e.zoomFactor)?void 0:i.call(e))??1,d=(o.clientX-l.startClientX)/s,c=(o.clientY-l.startClientY)/s,h=t.getMaxWidth(e.state,l.paragraphId),{width:p,height:u}=function(t,e,a,n,r){const o=by(t.handleDirection,"x"),i=by(t.handleDirection,"y"),l=0===o?t.startWidth:t.startWidth+e*o,s=0===i?t.startHeight:t.startHeight+a*i;let d=vy(l,my,r),c=vy(s,my);if(!n)return{width:d,height:c};const h=t.aspectRatio||1,p=0!==o;if(p&&0!==i){const e=d/t.startWidth,a=c/t.startHeight,n=Math.abs(e-1)>=Math.abs(a-1)?e:a;return d=vy(t.startWidth*n,my,r),c=vy(d/h,my),{width:d,height:c}}return p?(d=vy(d,my,r),c=vy(d/h,my),{width:d,height:c}):(c=vy(c,my),d=vy(c*h,my,r),c=vy(d/h,my),{width:d,height:c})}(l,d,c,o.shiftKey,h),f=n(e.state,l.paragraphId,l.paragraphOffset);f?e.applyState(t.applyResize(r(e.state,f),p,u,l.handleDirection)):e.logger.warn(`${t.label} resize:missing paragraph`,l)},i=()=>{const t=a;t&&e.updateHistoryState(a=>({...a,undoStack:[...a.undoStack,e.cloneState(t.initialState)],redoStack:[]})),l(),e.focusInput()},l=()=>{a=null,window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",i)};return{start:(l,s,d,c,h)=>{const p=n(h,l,s);if(!p)return;const u=t.getSelected(r(h,p));u&&(a={paragraphId:l,paragraphOffset:s,handleDirection:d,startClientX:c.clientX,startClientY:c.clientY,startWidth:u.width,startHeight:u.height,aspectRatio:u.width/u.height,initialState:e.cloneState(h)},window.addEventListener("mousemove",o),window.addEventListener("mouseup",i))},stop:l}}function EA(t,e){let a=null;const n=n=>{const r=a;if(!r)return;let o=((180*Math.atan2(n.clientY-r.centerY,n.clientX-r.centerX)/Math.PI+90)%360+360)%360;n.shiftKey&&(o=15*Math.round(o/15)%360);const i=((t,e,a)=>{const n=_e(t).find(t=>t.id===e);return n?{anchor:Ie(n,a),focus:Ie(n,a+1)}:null})(e.state,r.paragraphId,r.paragraphOffset);i?e.applyState(t.applyRotate(((t,e)=>({...t,selection:{anchor:{...e.anchor},focus:{...e.focus}}}))(e.state,i),o)):e.logger.warn(`${t.label} rotate:missing paragraph`,r)},r=()=>{const t=a;t&&e.updateHistoryState(a=>({...a,undoStack:[...a.undoStack,e.cloneState(t.initialState)],redoStack:[]})),o(),e.focusInput()},o=()=>{a=null,window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",r)};return{start:(t,o,i,l)=>{const s=i.currentTarget.closest(".oasis-editor-selection-overlay");if(!s)return;const d=s.getBoundingClientRect();a={paragraphId:t,paragraphOffset:o,centerX:d.left+d.width/2,centerY:d.top+d.height/2,initialState:e.cloneState(l)},window.addEventListener("mousemove",n),window.addEventListener("mouseup",r)},stop:o}}function RA(t){const[e,a]=y(!1),[n,r]=y(null),[o,i]=y({x:0,y:0}),[l,s]=y(null);let d=null,c=null,h=null;const p=t=>{const e=ra(t);if(e.isCollapsed||e.startIndex!==e.endIndex||e.endParagraphOffset-e.startParagraphOffset!==1)return null;const a=_e(t)[e.startIndex];if(!a)return null;let n=0;for(const r of a.runs){const o=n;if(n+=r.text.length,r.image&&1===r.text.length&&o===e.startParagraphOffset)return{paragraph:a,run:r,startOffset:o,width:r.image.width,height:r.image.height,src:Oe(t.document,r.image.src)}}return null},u=(e,a)=>t.resolvePositionAtSurfacePoint(e,a),f=()=>{h&&(h.remove(),h=null),document.body.style.cursor="",c=null,d=null,a(!1),r(null),s(null),window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",b)},g=VA({label:"image",getSelected:t=>p(t),applyResize:(t,e,a)=>function(t,e,a){const n=qw(t);if(!n)return t;const r=_e(t),{paragraphIndex:o,run:i}=n,l=r.map((t,n)=>n!==o?ew(t):{...ew(t),runs:t.runs.map(t=>t.id===i.id&&t.image?{...t,image:{...t.image,width:Math.max(24,Math.round(e)),height:Math.max(24,Math.round(a))}}:tw(t))});return Cw(t,l,zw(l,ra(t)))}(t,e,a),getMaxWidth:(e,a)=>kA(t.surfaceRef(),e.document,a,e.activeSectionIndex??0)},{state:t.state,applyState:t.applyState,updateHistoryState:t.updateHistoryState,cloneState:t.cloneState,focusInput:t.focusInput,logger:t.logger,zoomFactor:t.zoomFactor}),m=EA({label:"image",applyRotate:(t,e)=>Ow(t,e)},{state:t.state,applyState:t.applyState,updateHistoryState:t.updateHistoryState,cloneState:t.cloneState,focusInput:t.focusInput,logger:t.logger}),v=e=>{let n=d;if(!n){const r=c;if(!r)return;if(Math.abs(e.clientX-r.startClientX)+Math.abs(e.clientY-r.startClientY)<4)return;n={paragraphId:r.paragraphId,paragraphOffset:r.paragraphOffset,src:r.src,width:r.width,height:r.height,offsetX:r.offsetX,offsetY:r.offsetY},d=n,c=null,a(!0),h||(h=document.createElement("style"),h.setAttribute("data-oasis-image-drag-cursor",""),h.textContent="*, *::before, *::after { cursor: grabbing !important; }",document.head.appendChild(h)),t.logger.info(`image drag:start ${n.paragraphId}@${n.paragraphOffset} client=(${e.clientX},${e.clientY})`)}i({x:e.clientX,y:e.clientY}),r({...n}),s(u(e.clientX,e.clientY))},b=e=>{const a=d;if(a||c){if(a){const n=u(e.clientX,e.clientY);n?(t.logger.info(`image drag:done ${a.paragraphId} -> ${n.paragraphId}:${n.runId}[${n.offset}]`),t.applyTransactionalState(t=>Uw(t,n),{mergeKey:"moveImage"})):t.logger.warn(`image drag:cancel ${a.paragraphId} no target at (${e.clientX},${e.clientY})`)}f(),t.focusInput()}else t.focusInput()},M=(e,n,o,l)=>{const h=o.currentTarget,u=l?{left:l.left,top:l.top,width:l.width,height:l.height}:null==h?void 0:h.getBoundingClientRect();if(!u)return;const f=p(t.state);c={paragraphId:e,paragraphOffset:n,startClientX:o.clientX,startClientY:o.clientY,src:(null==f?void 0:f.src)??"",width:(null==f?void 0:f.width)??u.width,height:(null==f?void 0:f.height)??u.height,offsetX:o.clientX-u.left,offsetY:o.clientY-u.top},d=null,i({x:o.clientX,y:o.clientY}),a(!1),r(null),s(null),window.addEventListener("mousemove",v),window.addEventListener("mouseup",b)};return{dragging:e,draggedImageInfo:n,mousePos:o,dropTargetPos:l,getSelectedImageInfo:p,startImageDrag:M,stopImageDrag:()=>{f()},stopImageResize:g.stop,stopImageRotate:m.stop,handleImageMouseDown:(e,a,n)=>{n.preventDefault(),n.stopPropagation();const r=Ke(t.state.document).find(t=>t.id===e);r&&t.applyState(CS(t.state,{anchor:Ie(r,a),focus:Ie(r,a+1)})),M(e,a,n),t.focusInputAfterPointerSelection()},handleImageResizeHandleMouseDown:(e,a,n,r)=>{r.preventDefault(),r.stopPropagation(),g.start(e,a,n,r,t.state)},handleImageRotateHandleMouseDown:(e,a,n)=>{n.preventDefault(),n.stopPropagation(),m.start(e,a,n,t.state)}}}function LA(t){const e=t=>{const e=Fw(t);return(null==e?void 0:e.run.textBox)?{width:e.run.textBox.width,height:js(e.run.textBox,t,0)}:null},a=VA({label:"text box",getSelected:e,applyResize:(t,e,a,n)=>function(t,e,a,n={}){const r=Fw(t);if(!r||!r.run.textBox)return t;const o=n.handleDirection??"se",i=o.includes("n")||o.includes("s"),l=o.includes("w"),s=o.includes("n"),d=Math.max(24,Math.round(e)),c=Math.max(24,Math.round(a)),{paragraphIndex:h,run:p}=r,u=d-r.run.textBox.width,f=c-r.run.textBox.height,g=_e(t).map((t,e)=>e!==h?ew(t):{...ew(t),runs:t.runs.map(t=>{var e;if(t.id!==p.id||!t.textBox)return tw(t);const a=t.textBox,n={...a,width:d,height:c};return i&&(null==(e=a.body)?void 0:e.autoFit)&&(n.body={...a.body,autoFit:!1}),a.floating&&(n.floating=function(t,e,a,n,r){let o=t;if(n&&0!==e){const a=t.positionH;(null==a?void 0:a.align)||(o={...o,positionH:{...a??{},offset:((null==a?void 0:a.offset)??0)-9525*e}})}if(r&&0!==a){const t=o.positionV;(null==t?void 0:t.align)||(o={...o,positionV:{...t??{},offset:((null==t?void 0:t.offset)??0)-9525*a}})}return o}(a.floating,u,f,l,s)),{...t,textBox:n}})});return Cw(t,g,zw(g,ra(t)))}(t,e,a,{handleDirection:n}),getMaxWidth:(a,n)=>{const r=kA(t.surfaceRef(),a.document,n,a.activeSectionIndex??0),o=e(a);return o?Math.max(r,o.width):r}},{state:t.state,applyState:t.applyState,updateHistoryState:t.updateHistoryState,cloneState:t.cloneState,focusInput:t.focusInput,logger:t.logger,zoomFactor:t.zoomFactor}),n=EA({label:"text box",applyRotate:(t,e)=>Bw(t,e)},{state:t.state,applyState:t.applyState,updateHistoryState:t.updateHistoryState,cloneState:t.cloneState,focusInput:t.focusInput,logger:t.logger});return{handleTextBoxResizeHandleMouseDown:(e,n,r,o)=>{o.preventDefault(),o.stopPropagation(),a.start(e,n,r,o,t.state)},handleTextBoxRotateHandleMouseDown:(e,a,r)=>{r.preventDefault(),r.stopPropagation(),n.start(e,a,r,t.state)},stopTextBoxResize:a.stop,stopTextBoxRotate:n.stop}}const zA="http://schemas.openxmlformats.org/wordprocessingml/2006/main",NA="http://schemas.openxmlformats.org/package/2006/relationships",qA="http://schemas.openxmlformats.org/officeDocument/2006/relationships",OA="http://schemas.microsoft.com/office/word/2010/wordml";function PA(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function WA(t,e){return Number.isFinite(t)?Math.max(0,Math.round(t/96*1440)):e}function HA(t){return null!=t&&Number.isFinite(t)?Math.round(t/96*1440):null}function UA(t){return null!=t&&Number.isFinite(t)?Math.max(0,Math.round(20*t)):null}function FA(t,e="000000"){const a=null==t?void 0:t.trim().replace(/^#/,"");return a&&/^[0-9a-fA-F]{6}$/.test(a)?a.toUpperCase():e}function BA(t){if("end"===t.kind)return`<w:bookmarkEnd w:id="${t.wId}"/>`;const e=(void 0!==t.colFirst?` w:colFirst="${t.colFirst}"`:"")+(void 0!==t.colLast?` w:colLast="${t.colLast}"`:"");return`<w:bookmarkStart w:id="${t.wId}" w:name="${PA(t.name??"")}"${e}/>`}function GA(t){switch(t.kind){case"start":return`<w:commentRangeStart w:id="${t.wId}"/>`;case"end":return`<w:commentRangeEnd w:id="${t.wId}"/>`;case"reference":return`<w:r><w:commentReference w:id="${t.wId}"/></w:r>`}}const ZA=`xmlns:w="${zA}" xmlns:w14="${OA}" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml"`;function KA(t){const e=t.comments.map(({comment:t,wId:e,paraId:a})=>{const n=void 0!==t.date?` w:date="${new Date(t.date).toISOString().replace(/\.\d{3}Z$/,"Z")}"`:"",r=t.initials?` w:initials="${PA(t.initials)}"`:"";return`<w:comment w:id="${e}" w:author="${PA(t.author)}"${n}${r}><w:p w14:paraId="${a}">${o=t.text,`<w:r>${o.split("\n").map((t,e)=>`${e>0?"<w:br/>":""}<w:t xml:space="preserve">${PA(t)}</w:t>`).join("")}</w:r>`}</w:p></w:comment>`;var o}).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:comments ${ZA}>${e}</w:comments>`}function DA(t,e="000000"){if("none"===t.type||t.width<=0)return'w:val="nil"/>';return`w:val="${"dotted"===t.type?"dotted":"dashed"===t.type?"dashed":"single"}" w:sz="${Math.max(1,Math.round(8*t.width))}" w:space="0" w:color="${FA(t.color,e)}"/>`}function jA(t){const e=[["top",t.borderTop],["left",t.borderLeft],["bottom",t.borderBottom],["right",t.borderRight]].filter(t=>null!=t[1]).map(([t,e])=>`<w:${t} ${DA(e)}`);return e.length>0?`<w:pBdr>${e.join("")}</w:pBdr>`:""}const XA="6F6F6F";function JA(t,e){return void 0===e?"":e?`<w:${t}/>`:`<w:${t} w:val="0"/>`}function YA(t,e,a={}){if("number"==typeof e&&Number.isFinite(e))return`<w:${t} w:w="${UA(e)??0}" w:type="dxa"/>`;if("string"==typeof e){const a=e.trim();if("auto"===a)return`<w:${t} w:w="0" w:type="auto"/>`;if(a.endsWith("%")){const e=Number.parseFloat(a.slice(0,-1));if(Number.isFinite(e))return`<w:${t} w:w="${Math.round(50*e)}" w:type="pct"/>`}const n=Number.parseFloat(a);if(Number.isFinite(n))return`<w:${t} w:w="${Math.round(n)}" w:type="dxa"/>`}return a.fallbackAuto?`<w:${t} w:w="0" w:type="auto"/>`:""}function QA(t){return DA(t??{width:.75,type:"solid",color:`#${XA}`},XA)}function _A(t,e){var a,n,r,o,i,l,s,d,c,h;const p=Math.max(1,Math.floor(t.colSpan??1)),u=[],f=YA("tcW",(null==(a=t.style)?void 0:a.width)??e);f&&u.push(f),p>1&&u.push(`<w:gridSpan w:val="${p}"/>`),"restart"===t.vMerge?u.push('<w:vMerge w:val="restart"/>'):"continue"===t.vMerge&&u.push("<w:vMerge/>"),(null==(n=t.style)?void 0:n.shading)&&u.push(`<w:shd w:val="clear" w:color="auto" w:fill="${FA(t.style.shading,"FFFFFF")}"/>`);const g=JA("noWrap",null==(r=t.style)?void 0:r.noWrap);g&&u.push(g);const m=JA("tcFitText",null==(o=t.style)?void 0:o.fitText);if(m&&u.push(m),(null==(i=t.style)?void 0:i.headers)&&u.push(`<w:headers w:val="${PA(t.style.headers)}"/>`),null==(l=t.style)?void 0:l.verticalAlign){const e="middle"===t.style.verticalAlign?"center":t.style.verticalAlign;u.push(`<w:vAlign w:val="${e}"/>`)}(null==(s=t.style)?void 0:s.textDirection)&&u.push(`<w:textDirection w:val="${t.style.textDirection}"/>`),u.push(function(t){const e=t.style,a=null==e?void 0:e.padding,n=UA(a??(null==e?void 0:e.paddingTop)??0),r=UA(a??(null==e?void 0:e.paddingBottom)??0);return`<w:tcMar><w:top w:w="${n??0}" w:type="dxa"/><w:left w:w="${UA(a??(null==e?void 0:e.paddingLeft)??5.4)??0}" w:type="dxa"/><w:bottom w:w="${r??0}" w:type="dxa"/><w:right w:w="${UA(a??(null==e?void 0:e.paddingRight)??5.4)??0}" w:type="dxa"/>${void 0!==(null==e?void 0:e.paddingStart)?`<w:start w:w="${UA(e.paddingStart)??0}" w:type="dxa"/>`:""}${void 0!==(null==e?void 0:e.paddingEnd)?`<w:end w:w="${UA(e.paddingEnd)??0}" w:type="dxa"/>`:""}</w:tcMar>`}(t)),u.push(function(t){var e,a,n,r,o,i,l,s;const d=[`<w:top ${QA(null==(e=t.style)?void 0:e.borderTop)}`,`<w:left ${QA(null==(a=t.style)?void 0:a.borderLeft)}`,`<w:bottom ${QA(null==(n=t.style)?void 0:n.borderBottom)}`,`<w:right ${QA(null==(r=t.style)?void 0:r.borderRight)}`];return(null==(o=t.style)?void 0:o.borderStart)&&d.push(`<w:start ${QA(t.style.borderStart)}`),(null==(i=t.style)?void 0:i.borderEnd)&&d.push(`<w:end ${QA(t.style.borderEnd)}`),(null==(l=t.style)?void 0:l.borderTopLeftToBottomRight)&&d.push(`<w:tl2br ${QA(t.style.borderTopLeftToBottomRight)}`),(null==(s=t.style)?void 0:s.borderTopRightToBottomLeft)&&d.push(`<w:tr2bl ${QA(t.style.borderTopRightToBottomLeft)}`),`<w:tcBorders>${d.join("")}</w:tcBorders>`}(t));const v=JA("hideMark",null==(d=t.style)?void 0:d.hideMark);return v&&u.push(v),(null==(h=null==(c=t.style)?void 0:c.revisionXml)?void 0:h.length)&&u.push(...t.style.revisionXml),u.length>0?`<w:tcPr>${u.join("")}</w:tcPr>`:""}function $A(t,e){if(void 0===e||!Number.isFinite(e))return"";const a=Math.floor(e);return a>0?`<w:${t} w:val="${a}"/>`:""}function tI(t,e){const a="number"==typeof t?UA(t):"string"==typeof t?Number.parseFloat(t):null,n=null!==a&&Number.isFinite(a);if(!n&&!e)return"";const r=[];return n&&r.push(`w:val="${Math.round(a)}"`),r.push(`w:hRule="${e??"atLeast"}"`),`<w:trHeight ${r.join(" ")}/>`}function eI(t){var e,a,n,r,o,i,l,s,d;const c=[],h=$A("gridBefore",null==(e=t.style)?void 0:e.gridBefore);h&&c.push(h);const p=$A("gridAfter",null==(a=t.style)?void 0:a.gridAfter);p&&c.push(p);const u=YA("wBefore",null==(n=t.style)?void 0:n.widthBefore);u&&c.push(u);const f=YA("wAfter",null==(r=t.style)?void 0:r.widthAfter);f&&c.push(f);const g=YA("tblCellSpacing",null==(o=t.style)?void 0:o.cellSpacing);g&&c.push(g);const m=function(t){var e,a;return tI(null==(e=t.style)?void 0:e.height,null==(a=t.style)?void 0:a.heightRule)}(t);m&&c.push(m);const v=JA("cantSplit",null==(i=t.style)?void 0:i.cantSplit);v&&c.push(v),t.isHeader&&c.push("<w:tblHeader/>");const b=JA("hidden",null==(l=t.style)?void 0:l.hidden);return b&&c.push(b),(null==(d=null==(s=t.style)?void 0:s.revisionXml)?void 0:d.length)&&c.push(...t.style.revisionXml),c.length>0?`<w:trPr>${c.join("")}</w:trPr>`:""}function aI(t){var e,a,n,r,o,i,l,s,d,c,h,p,u,f,g;const m=[];if((null==(e=t.style)?void 0:e.styleId)&&m.push(`<w:tblStyle w:val="${PA(t.style.styleId)}"/>`),null==(a=t.style)?void 0:a.tblLook){const e=t.style.tblLook;m.push(`<w:tblLook w:firstRow="${e.firstRow?"1":"0"}" w:lastRow="${e.lastRow?"1":"0"}" w:firstColumn="${e.firstCol?"1":"0"}" w:lastColumn="${e.lastCol?"1":"0"}" w:noHBand="${e.noHBand?"1":"0"}" w:noVBand="${e.noVBand?"1":"0"}"/>`)}(null==(n=t.style)?void 0:n.altTitle)&&m.push(`<w:tblCaption w:val="${PA(t.style.altTitle)}"/>`),(null==(r=t.style)?void 0:r.altDescription)&&m.push(`<w:tblDescription w:val="${PA(t.style.altDescription)}"/>`);const v=(b=null==(o=t.style)?void 0:o.floating)&&0!==Object.keys(b).length?`<w:tblpPr ${Object.entries(b).map(([t,e])=>`w:${t}="${PA(e)}"`).join(" ")}/>`:"";var b;v&&m.push(v);const y=t.gridCols&&t.gridCols.length>0?t.gridCols.reduce((t,e)=>t+e,0):void 0;m.push(function(t,e=!0){return YA("tblW",t,{fallbackAuto:e})}((null==(i=t.style)?void 0:i.width)??y)),(null==(l=t.style)?void 0:l.align)&&m.push(`<w:jc w:val="${t.style.align}"/>`);const M=YA("tblCellSpacing",null==(s=t.style)?void 0:s.cellSpacing);M&&m.push(M);const x=function(t){if(!t)return"";const e=[],a=(t,a)=>{void 0!==a&&Number.isFinite(a)&&e.push(`<w:${t} w:w="${UA(a)??0}" w:type="dxa"/>`)};return a("top",t.top),a("left",t.left),a("bottom",t.bottom),a("right",t.right),a("start",t.start),a("end",t.end),e.length>0?`<w:tblCellMar>${e.join("")}</w:tblCellMar>`:""}(null==(d=t.style)?void 0:d.defaultCellMargins);x&&m.push(x);const w=YA("tblInd",null==(c=t.style)?void 0:c.indentLeft);w&&m.push(w),m.push(`<w:tblLayout w:type="${(null==(h=t.style)?void 0:h.layout)??"fixed"}"/>`);const S=JA("bidiVisual",null==(p=t.style)?void 0:p.bidiVisual);return S&&m.push(S),(null==(u=t.style)?void 0:u.tblOverlap)&&m.push(`<w:tblOverlap w:val="${PA(t.style.tblOverlap)}"/>`),(null==(g=null==(f=t.style)?void 0:f.revisionXml)?void 0:g.length)&&m.push(...t.style.revisionXml),`<w:tblPr>${m.join("")}</w:tblPr>`}function nI(t,e){const a=on(t),n=new Map(a.map(t=>[`${t.rowIndex}:${t.cellIndex}`,t])),r=t.rows.map((a,r)=>{const o=a.cells.map((a,o)=>{const i=n.get(`${r}:${o}`),l=i&&t.gridCols?t.gridCols.slice(i.visualColumnIndex,i.visualColumnIndex+Math.max(1,i.colSpan)).reduce((t,e)=>t+e,0):void 0,s=(a.blocks.length>0?a.blocks:[{id:"",type:"paragraph",runs:[{id:"",text:""}]}]).map(t=>e(t,a)).join(""),d="continue"===a.vMerge?"<w:p/>":s;return`<w:tc>${_A(a,l)}${d}</w:tc>`}).join("");return`<w:tr>${a.tblPrExXml??""}${eI(a)}${o}</w:tr>`}).join(""),o=t.gridCols?`<w:tblGrid>${t.gridCols.map(t=>`<w:gridCol w:w="${UA(t)??0}"/>`).join("")}${t.tblGridChangeXml??""}</w:tblGrid>`:"";return`<w:tbl>${aI(t)}${o}${r}</w:tbl>`}function rI(t){if(!t||0===t.length)return"";const e=t.map(t=>{const e=UA(t.position);if(null===e)return"";const a=[`w:val="${t.type}"`,`w:pos="${e}"`];return t.leader&&"none"!==t.leader?a.push(`w:leader="${t.leader}"`):"none"===t.leader&&a.push('w:leader="none"'),`<w:tab ${a.join(" ")}/>`}).filter(Boolean);return e.length>0?`<w:tabs>${e.join("")}</w:tabs>`:""}function oI(t){const e=[];if(t.align&&e.push(`<w:jc w:val="${t.align}"/>`),void 0!==t.spacingBefore||void 0!==t.spacingAfter||void 0!==t.lineHeight){const a=[],n=HA(t.spacingBefore),r=HA(t.spacingAfter),o=void 0!==t.lineHeight&&null!==t.lineHeight&&Number.isFinite(t.lineHeight),i="exact"===t.lineRule||"atLeast"===t.lineRule,l=o?i?WA(t.lineHeight,0):Math.round(240*t.lineHeight):null;null!==n&&a.push(`w:before="${n}"`),null!==r&&a.push(`w:after="${r}"`),null!==l&&a.push(`w:line="${l}"`),null!==l&&i&&a.push(`w:lineRule="${t.lineRule}"`),a.length>0&&e.push(`<w:spacing ${a.join(" ")}/>`)}if(void 0!==t.indentLeft||void 0!==t.indentRight||void 0!==t.indentFirstLine||void 0!==t.indentHanging){const a=[],n=HA(t.indentLeft),r=HA(t.indentRight),o=HA(t.indentFirstLine),i=HA(t.indentHanging);null!==n&&a.push(`w:left="${n}"`),null!==r&&a.push(`w:right="${r}"`),null!==o&&a.push(`w:firstLine="${o}"`),null!==i&&a.push(`w:hanging="${i}"`),a.length>0&&e.push(`<w:ind ${a.join(" ")}/>`)}const a=rI(t.tabs);a&&e.push(a),t.pageBreakBefore&&e.push("<w:pageBreakBefore/>"),t.keepWithNext&&e.push("<w:keepNext/>"),t.keepLinesTogether&&e.push("<w:keepLines/>"),!1===t.widowControl&&e.push('<w:widowControl w:val="0"/>'),t.contextualSpacing&&e.push("<w:contextualSpacing/>");const n=jA(t);return n&&e.push(n),t.shading&&e.push(`<w:shd w:val="clear" w:color="auto" w:fill="${FA(t.shading,"FFFFFF")}"/>`),t.textDirection&&e.push(`<w:textDirection w:val="${t.textDirection}"/>`),null!=t.outlineLevel&&e.push(`<w:outlineLvl w:val="${t.outlineLevel}"/>`),e.length>0?`<w:pPr>${e.join("")}</w:pPr>`:""}function iI(t,e,a,n){var r,o;const i=[],l=function(t,e){const a=qe(t.style,e);return{align:a.align,spacingBefore:a.spacingBefore,spacingAfter:a.spacingAfter,contextualSpacing:a.contextualSpacing,lineHeight:a.lineHeight,lineRule:a.lineRule,indentLeft:a.indentLeft,indentRight:a.indentRight,indentFirstLine:a.indentFirstLine,indentHanging:a.indentHanging,pageBreakBefore:a.pageBreakBefore,keepWithNext:a.keepWithNext,keepLinesTogether:a.keepLinesTogether,widowControl:a.widowControl,shading:a.shading,borderTop:a.borderTop,borderRight:a.borderRight,borderBottom:a.borderBottom,borderLeft:a.borderLeft,tabs:a.tabs,textDirection:a.textDirection,outlineLevel:a.outlineLevel}}(t,a),s=(null==(r=t.style)?void 0:r.align)??(null==n?void 0:n.align)??l.align;if((null==(o=t.style)?void 0:o.styleId)&&i.push(`<w:pStyle w:val="${PA(t.style.styleId)}"/>`),s&&i.push(`<w:jc w:val="${s}"/>`),void 0!==l.spacingBefore||void 0!==l.spacingAfter||void 0!==l.lineHeight){const t=[],e=HA(l.spacingBefore),a=HA(l.spacingAfter),n=void 0!==l.lineHeight&&null!==l.lineHeight&&Number.isFinite(l.lineHeight),r="exact"===l.lineRule||"atLeast"===l.lineRule,o=n?r?WA(l.lineHeight,0):Math.round(240*l.lineHeight):null;null!==e&&t.push(`w:before="${e}"`),null!==a&&t.push(`w:after="${a}"`),null!==o&&t.push(`w:line="${o}"`),null!==o&&r&&t.push(`w:lineRule="${l.lineRule}"`),t.length>0&&i.push(`<w:spacing ${t.join(" ")}/>`)}if(void 0!==l.indentLeft||void 0!==l.indentRight||void 0!==l.indentFirstLine||void 0!==l.indentHanging){const t=[],e=HA(l.indentLeft),a=HA(l.indentRight),n=HA(l.indentFirstLine),r=HA(l.indentHanging);null!==e&&t.push(`w:left="${e}"`),null!==a&&t.push(`w:right="${a}"`),null!==n&&t.push(`w:firstLine="${n}"`),null!==r&&t.push(`w:hanging="${r}"`),t.length>0&&i.push(`<w:ind ${t.join(" ")}/>`)}const d=rI(l.tabs);d&&i.push(d),l.pageBreakBefore&&i.push("<w:pageBreakBefore/>"),l.keepWithNext&&i.push("<w:keepNext/>"),l.keepLinesTogether&&i.push("<w:keepLines/>"),!1===l.widowControl&&i.push('<w:widowControl w:val="0"/>'),l.contextualSpacing&&i.push("<w:contextualSpacing/>");const c=jA(l);c&&i.push(c),l.shading&&i.push(`<w:shd w:val="clear" w:color="auto" w:fill="${FA(l.shading,"FFFFFF")}"/>`),l.textDirection&&i.push(`<w:textDirection w:val="${l.textDirection}"/>`),null!=l.outlineLevel&&i.push(`<w:outlineLvl w:val="${l.outlineLevel}"/>`);const h=e.get(t.id);return h&&i.push(`<w:numPr><w:ilvl w:val="${h.level}"/><w:numId w:val="${h.numId}"/></w:numPr>`),i.length>0?`<w:pPr>${i.join("")}</w:pPr>`:""}const lI=9525,sI={black:[0,0,0],blue:[0,0,255],cyan:[0,255,255],green:[0,128,0],magenta:[255,0,255],red:[255,0,0],yellow:[255,255,0],white:[255,255,255],darkBlue:[0,0,139],darkCyan:[0,139,139],darkGreen:[0,100,0],darkMagenta:[139,0,139],darkRed:[139,0,0],darkYellow:[184,134,11],darkGray:[169,169,169],lightGray:[211,211,211]},dI={ffff00:"yellow",fef08a:"yellow",ff0000:"red","00ff00":"green","0000ff":"blue","00ffff":"cyan",ff00ff:"magenta","000000":"black",ffffff:"white"};function cI(t){if(t in sI)return t;const e=t.trim().replace(/^#/,"").toLowerCase(),a=dI[e];if(a)return a;const n=function(t){const e=t.trim().replace(/^#/,"");return/^[0-9a-fA-F]{6}$/.test(e)?[Number.parseInt(e.slice(0,2),16),Number.parseInt(e.slice(2,4),16),Number.parseInt(e.slice(4,6),16)]:null}(t);if(!n)return"yellow";let r="yellow",o=Number.POSITIVE_INFINITY;for(const[i,l]of Object.entries(sI)){const t=(l[0]-n[0])**2+(l[1]-n[1])**2+(l[2]-n[2])**2;t<o&&(o=t,r=i)}return r}function hI(t){if(!t)return"";const e=[];if(t.bold&&e.push("<w:b/>","<w:bCs/>"),t.italic&&e.push("<w:i/>","<w:iCs/>"),t.underline){const a=t.underlineStyle??"single",n=t.underlineColor?` w:color="${PA(t.underlineColor.replace(/^#/,""))}"`:"";e.push(`<w:u w:val="${PA(a)}"${n}/>`)}if(t.strike&&e.push("<w:strike/>"),t.doubleStrike&&e.push("<w:dstrike/>"),t.smallCaps&&e.push("<w:smallCaps/>"),t.allCaps&&e.push("<w:caps/>"),t.hidden&&e.push("<w:vanish/>"),t.noProof&&e.push("<w:noProof/>"),t.webHidden&&e.push("<w:webHidden/>"),t.specVanish&&e.push("<w:specVanish/>"),t.textEffect&&e.push(`<w:effect w:val="${PA(t.textEffect)}"/>`),void 0!==t.characterScale&&null!==t.characterScale&&Number.isFinite(t.characterScale)&&e.push(`<w:w w:val="${Math.max(1,Math.round(t.characterScale))}"/>`),void 0!==t.characterSpacing&&null!==t.characterSpacing){const n=null!=(a=t.characterSpacing)&&Number.isFinite(a)?Math.round(20*a):null;null!==n&&e.push(`<w:spacing w:val="${n}"/>`)}var a;void 0!==t.baselineShift&&null!==t.baselineShift&&Number.isFinite(t.baselineShift)&&e.push(`<w:position w:val="${Math.round(2*t.baselineShift)}"/>`),void 0!==t.kerningThreshold&&null!==t.kerningThreshold&&Number.isFinite(t.kerningThreshold)&&e.push(`<w:kern w:val="${Math.max(0,Math.round(2*t.kerningThreshold))}"/>`);const n=function(t){switch(t){case"none":return"none";case"standard":return"standard";case"contextual":return"contextual";case"historical":return"historical";case"standardContextual":return"standardContextual";default:return null}}(t.ligatures);n&&e.push(`<w14:ligatures w14:val="${n}"/>`);const r=function(t){switch(t){case"proportional":return"proportional";case"tabular":return"tabular";default:return null}}(t.numberSpacing);r&&e.push(`<w14:numSpacing w14:val="${r}"/>`);const o=function(t){switch(t){case"lining":return"lining";case"oldStyle":return"oldStyle";default:return null}}(t.numberForm);o&&e.push(`<w14:numForm w14:val="${o}"/>`);const i=function(t){return"number"!=typeof t||t<1||t>20?null:(1<<t-1).toString(16).toUpperCase().padStart(8,"0")}(t.stylisticSet);if(i&&e.push(`<w14:stylisticSets w14:val="${i}"/>`),t.contextualAlternates&&e.push('<w14:cntxtAlts w14:val="1"/>'),t.superscript?e.push('<w:vertAlign w:val="superscript"/>'):t.subscript&&e.push('<w:vertAlign w:val="subscript"/>'),t.fontFamily&&e.push(`<w:rFonts w:ascii="${PA(t.fontFamily)}" w:hAnsi="${PA(t.fontFamily)}" w:cs="${PA(t.fontFamily)}"/>`),void 0!==t.fontSize&&null!==t.fontSize){const a=function(t){return null!=t&&Number.isFinite(t)?Math.round(t/96*72*2):null}(t.fontSize);null!==a&&e.push(`<w:sz w:val="${a}"/>`,`<w:szCs w:val="${a}"/>`)}if(t.color&&e.push(`<w:color w:val="${PA(t.color.replace(/^#/,""))}"/>`),t.highlight&&e.push(`<w:highlight w:val="${PA(cI(t.highlight))}"/>`),t.shading&&e.push(`<w:shd w:val="clear" w:color="auto" w:fill="${FA(t.shading,"FFFFFF")}"/>`),t.language){const a=[];t.language.value&&a.push(`w:val="${PA(t.language.value)}"`),t.language.eastAsia&&a.push(`w:eastAsia="${PA(t.language.eastAsia)}"`),t.language.bidi&&a.push(`w:bidi="${PA(t.language.bidi)}"`),a.length>0&&e.push(`<w:lang ${a.join(" ")}/>`)}return e.length>0?`<w:rPr>${e.join("")}</w:rPr>`:""}function pI(t){if(0===t.length)return"";var e;return`<w:t${/^\s|\s$/.test(e=t)||e.includes(" ")?' xml:space="preserve"':""}>${PA(t)}</w:t>`}function uI(t){if(0===t.length)return"<w:t></w:t>";let e="",a="";for(const n of t)"\n"!==n?"\t"!==n?"‑"!==n?""!==n?a+=n:(e+=pI(a),a="",e+="<w:softHyphen/>"):(e+=pI(a),a="",e+="<w:noBreakHyphen/>"):(e+=pI(a),a="",e+="<w:tab/>"):(e+=pI(a),a="",e+="<w:br/>");return e+=pI(a),e||"<w:t></w:t>"}function fI(t,e){return t??e?"1":"0"}function gI(t,e,a){const n=PA((null==e?void 0:e.relativeFrom)??a);if(null==e?void 0:e.align)return`<wp:${t} relativeFrom="${n}"><wp:align>${PA(e.align)}</wp:align></wp:${t}>`;return`<wp:${t} relativeFrom="${n}"><wp:posOffset>${(null==e?void 0:e.offset)??0}</wp:posOffset></wp:${t}>`}function mI(t){if(!t||t.length<3)return"";const e=t=>Math.round(21600*Math.min(1,Math.max(0,t))),a=(t,a)=>`<wp:${a} x="${e(t.x)}" y="${e(t.y)}"/>`,n=t[0];return`<wp:wrapPolygon edited="0">${[a(n,"start"),...t.slice(1).map(t=>a(t,"lineTo")),a(n,"lineTo")].join("")}</wp:wrapPolygon>`}function vI(t){const{cx:e,cy:a,floating:n,docPrId:r,docPrName:o,altAttr:i,graphicXml:l}=t,s=PA(o);if(!n)return`<w:drawing><wp:inline distT="0" distB="0" distL="0" distR="0"><wp:extent cx="${e}" cy="${a}"/><wp:effectExtent l="0" t="0" r="0" b="0"/><wp:docPr id="${r}" name="${s}"${i}/>${l}</wp:inline></w:drawing>`;const d=n.distT??0,c=n.distB??0,h=n.distL??0,p=n.distR??0,u=gI("positionH",n.positionH,"column"),f=gI("positionV",n.positionV,"paragraph"),g=function(t,e){switch(t){case"square":return'<wp:wrapSquare wrapText="bothSides"/>';case"tight":{const t=mI(e);return t?`<wp:wrapTight wrapText="bothSides">${t}</wp:wrapTight>`:'<wp:wrapTight wrapText="bothSides"/>'}case"through":{const t=mI(e);return t?`<wp:wrapThrough wrapText="bothSides">${t}</wp:wrapThrough>`:'<wp:wrapThrough wrapText="bothSides"/>'}case"topAndBottom":return"<wp:wrapTopAndBottom/>";default:return"<wp:wrapNone/>"}}(n.wrap,t.wrapPolygon);return`<w:drawing><wp:anchor distT="${d}" distB="${c}" distL="${h}" distR="${p}" simplePos="${fI(n.simplePos,!1)}" relativeHeight="${n.relativeHeight??0}" behindDoc="${fI(n.behindDoc,!1)}" locked="${fI(n.locked,!1)}" layoutInCell="${fI(n.layoutInCell,!0)}" allowOverlap="${fI(n.allowOverlap,!0)}"><wp:simplePos x="0" y="0"/>${u}${f}<wp:extent cx="${e}" cy="${a}"/><wp:effectExtent l="0" t="0" r="0" b="0"/>${g}<wp:docPr id="${r}" name="${s}"${i}/>${l}</wp:anchor></w:drawing>`}function bI(t,e,a,n){const r=a.images.find(t=>t.rId===e);if(!r)return null;const o=(parseInt(e.replace(/\D+/g,""),10)||0)+1,i=void 0!==r.alt?` descr="${PA(r.alt)}" title="${PA(r.alt)}"`:"",l=function(t){let e="";if(t.rotation){const a=Math.round(6e4*t.rotation);0!==a&&(e+=` rot="${a}"`)}return t.flipH&&(e+=' flipH="1"'),t.flipV&&(e+=' flipV="1"'),e}(r),s=function(t){if(!t)return"";const e=t=>t?Math.round(1e5*t):0,a=e(t.left),n=e(t.top),r=e(t.right),o=e(t.bottom);return 0===a&&0===n&&0===r&&0===o?"":`<a:srcRect l="${a}" t="${n}" r="${r}" b="${o}"/>`}(r.crop),d="tile"===r.fillMode?"<a:tile/>":"<a:stretch><a:fillRect/></a:stretch>",c=function(t,e,a,n){return vI({cx:t.cx,cy:t.cy,floating:t.floating,docPrId:e,docPrName:"Picture",altAttr:a,graphicXml:n,wrapPolygon:t.wrapPolygon})}(r,o,i,`<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:nvPicPr><pic:cNvPr id="0" name="Picture"${i}/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip ${"linked"===r.kind?`r:link="${e}"`:`r:embed="${e}"`} xmlns:r="${qA}"/>${s}${d}</pic:blipFill><pic:spPr><a:xfrm${l}><a:off x="0" y="0"/><a:ext cx="${r.cx}" cy="${r.cy}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic></a:graphicData></a:graphic>`);return`<w:r>${n}${c}</w:r>`}function yI(t,e,a,n,r){const o=Math.round(e.width*lI),i=Math.round(e.height*lI),l=a.textBoxDocPrIds.get(t.id)??1,s=e.name??"Text Box",d=void 0!==e.alt?` descr="${PA(e.alt)}" title="${PA(e.alt)}"`:"",c=function(t,e,a,n,r){const o=t.shape,i=PA((null==o?void 0:o.preset)??"rect"),l=t.rotation?Math.round(6e4*t.rotation):0,s=0!==l?` rot="${l}"`:"",d=(null==o?void 0:o.fill)?`<a:solidFill><a:srgbClr val="${PA(o.fill.replace(/^#/,""))}"/></a:solidFill>`:"";let c="";((null==o?void 0:o.borderColor)||void 0!==(null==o?void 0:o.borderWidthPt))&&(c=`<a:ln${void 0!==(null==o?void 0:o.borderWidthPt)?` w="${Math.round(12700*o.borderWidthPt)}"`:""}>${(null==o?void 0:o.borderColor)?`<a:solidFill><a:srgbClr val="${PA(o.borderColor.replace(/^#/,""))}"/></a:solidFill>`:""}<a:miter lim="800000"/></a:ln>`);const h=t.body,p=['rot="0"',`vert="${PA((null==h?void 0:h.vert)??"horz")}"`];p.push(`wrap="${PA((null==h?void 0:h.wrap)??"square")}"`),void 0!==(null==h?void 0:h.paddingLeft)&&p.push(`lIns="${Math.round(h.paddingLeft*lI)}"`),void 0!==(null==h?void 0:h.paddingTop)&&p.push(`tIns="${Math.round(h.paddingTop*lI)}"`),void 0!==(null==h?void 0:h.paddingRight)&&p.push(`rIns="${Math.round(h.paddingRight*lI)}"`),void 0!==(null==h?void 0:h.paddingBottom)&&p.push(`bIns="${Math.round(h.paddingBottom*lI)}"`),p.push(`anchor="${PA((null==h?void 0:h.anchor)??"t")}"`),p.push('anchorCtr="0"');const u=(null==h?void 0:h.autoFit)?"<a:spAutoFit/>":"",f=t.blocks.length>0,g=f?SI(t.blocks,n,r):"";return'<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:graphicData uri="http://schemas.microsoft.com/office/word/2010/wordprocessingShape"><wps:wsp>'+(f?'<wps:cNvSpPr txBox="1"><a:spLocks noChangeArrowheads="1"/></wps:cNvSpPr>':"<wps:cNvSpPr/>")+`<wps:spPr bwMode="auto"><a:xfrm${s}><a:off x="0" y="0"/><a:ext cx="${e}" cy="${a}"/></a:xfrm><a:prstGeom prst="${i}"><a:avLst/></a:prstGeom>`+d+c+"</wps:spPr>"+(f?`<wps:txbx><w:txbxContent>${g}</w:txbxContent></wps:txbx>`:"")+`<wps:bodyPr ${p.join(" ")}>${u}</wps:bodyPr></wps:wsp></a:graphicData></a:graphic>`}(e,o,i,a,n);return`<w:r>${r}${vI({cx:o,cy:i,floating:e.floating,docPrId:l,docPrName:s,altAttr:d,graphicXml:c})}</w:r>`}function MI(t,e,a,n){if(t.__isFootnoteRefMarker)return'<w:r><w:rPr><w:rStyle w:val="FootnoteReference"/><w:vertAlign w:val="superscript"/></w:rPr><w:footnoteRef/></w:r>';if(t.__isEndnoteRefMarker)return'<w:r><w:rPr><w:rStyle w:val="EndnoteReference"/><w:vertAlign w:val="superscript"/></w:rPr><w:endnoteRef/></w:r>';const r=function(t,e,a){var n;const r=Ne(t.styles,e,a),o={bold:r.bold,italic:r.italic,underline:r.underline,underlineStyle:r.underlineStyle,underlineColor:r.underlineColor,strike:r.strike,doubleStrike:r.doubleStrike,superscript:r.superscript,subscript:r.subscript,smallCaps:r.smallCaps,allCaps:r.allCaps,hidden:r.hidden,noProof:r.noProof,webHidden:r.webHidden,specVanish:r.specVanish,textEffect:r.textEffect,characterScale:r.characterScale,characterSpacing:r.characterSpacing,baselineShift:r.baselineShift,kerningThreshold:r.kerningThreshold,ligatures:r.ligatures,numberSpacing:r.numberSpacing,numberForm:r.numberForm,stylisticSet:r.stylisticSet,contextualAlternates:r.contextualAlternates,fontFamily:r.fontFamily,fontSize:r.fontSize,color:r.color,highlight:r.highlight,shading:r.shading,language:r.language};return(null==(n=t.styles)?void 0:n.link)&&(o.link=t.styles.link),o}(t,a,n);if(t.footnoteReference){const a=function(t,e,a){var n;const r=null==(n=a.footnoteIdMap)?void 0:n.get(t.footnoteReference.footnoteId);if(void 0===r)return null;const o={...e??{},superscript:!0},i=t.footnoteReference.customMark?' w:customMarkFollows="1"':"",l=t.footnoteReference.customMark?`<w:t xml:space="preserve">${PA(t.footnoteReference.customMark)}</w:t>`:"";return`<w:r>${hI(o)}<w:footnoteReference${i} w:id="${r}"/>${l}</w:r>`}(t,r,e);if(null!==a)return a}if(t.endnoteReference){const a=function(t,e,a){var n;const r=null==(n=a.endnoteIdMap)?void 0:n.get(t.endnoteReference.endnoteId);if(void 0===r)return null;const o={...e??{},superscript:!0},i=t.endnoteReference.customMark?' w:customMarkFollows="1"':"",l=t.endnoteReference.customMark?`<w:t xml:space="preserve">${PA(t.endnoteReference.customMark)}</w:t>`:"";return`<w:r>${hI(o)}<w:endnoteReference${i} w:id="${r}"/>${l}</w:r>`}(t,r,e);if(null!==a)return a}if(t.fieldChar)return function(t,e){const a=(t.fieldLock?' w:fldLock="true"':"")+(t.dirty?' w:dirty="true"':"");return`<w:r>${e}<w:fldChar w:fldCharType="${t.kind}"${a}/></w:r>`}(t.fieldChar,hI(r));if(void 0!==t.fieldInstruction)return o=t.fieldInstruction,`<w:r>${hI(r)}<w:instrText xml:space="preserve">${PA(o)}</w:instrText></w:r>`;var o;if(t.field)return function(t,e){return`<w:fldSimple w:instr="${"PAGE"===t?" PAGE ":" NUMPAGES "}"><w:r>${e}<w:t>1</w:t></w:r></w:fldSimple>`}(t.field.type,hI(r));if(t.textBox)return yI(t,t.textBox,e,n,hI(r));if(t.image){const a=e.imageMap.get(t.id);if(a){const n=bI(t.id,a,e,hI(r));if(null!==n)return n}}if(t.sym){const{font:e,char:a}=t.sym;return`<w:r>${hI(r)}<w:sym w:font="${PA(e)}" w:char="${a}"/></w:r>`}return`<w:r>${hI(r)}${uI(t.text)}</w:r>`}function xI(t,e,a,n){var r;const o=MI(t,e,a,n),i=null==(r=t.styles)?void 0:r.link;return i?function(t,e,a){if(e.startsWith("#"))return`<w:hyperlink w:anchor="${PA(e.slice(1))}">${t}</w:hyperlink>`;const n=a.hyperlinkMap.get(e);return n?`<w:hyperlink r:id="${n}">${t}</w:hyperlink>`:t}(o,i,e):o}function wI(t){return!(t.image||t.textBox||t.field||t.fieldChar||void 0!==t.fieldInstruction||t.footnoteReference||t.endnoteReference)}function SI(t,e,a){return t.map(t=>{var n;if("table"===t.type){return((null==(n=t.style)?void 0:n.pageBreakBefore)?'<w:p><w:r><w:br w:type="page"/></w:r></w:p>':"")+nI(t,(t,n)=>{var r;return AI(t,e,a,{align:null==(r=n.style)?void 0:r.horizontalAlign})})}return AI(t,e,a)}).join("")}function AI(t,e,a,n){var r,o,i;const l=t.runs.length>0?t.runs:[{id:"",text:""}],s=t.dropCap?function(t){const e=hI(t.style);var a;return`<w:p><w:pPr><w:keepNext/><w:framePr w:dropCap="${t.type}" w:lines="${t.lines}" w:wrap="around" w:vAnchor="text" w:hAnchor="text"/><w:spacing w:after="0"/>${e?`<w:rPr>${a=e,a.replace(/^<w:rPr>/,"").replace(/<\/w:rPr>$/,"")}</w:rPr>`:""}</w:pPr><w:r>${e}${uI(t.text)}</w:r></w:p>`}(t.dropCap):"",d=null==(r=e.bookmarkEventsByParagraph)?void 0:r.get(t.id),c=null==(o=e.commentEventsByParagraph)?void 0:o.get(t.id),h=[...(d??[]).map(t=>({offset:t.offset,seq:t.seq,xml:BA(t)})),...(c??[]).map(t=>({offset:t.offset,seq:t.seq,xml:GA(t)}))],p=h.length>0?function(t,e,a,n,r){const o=[...e].sort((t,e)=>t.offset-e.offset||t.seq-e.seq);let i=0,l=0,s="";const d=t=>{for(;i<o.length&&o[i].offset<=t;)s+=o[i].xml,i+=1};for(const c of t){const t=l,e=t+c.text.length;if(d(t),wI(c)&&c.text.length>0){let l=t;for(;i<o.length&&o[i].offset<e;){const e=o[i];e.offset>l&&(s+=xI({...c,text:c.text.slice(l-t,e.offset-t)},a,n,r)),s+=e.xml,i+=1,l=e.offset}l<e&&(s+=xI({...c,text:c.text.slice(l-t)},a,n,r))}else s+=xI(c,a,n,r);l=e}return d(Number.POSITIVE_INFINITY),s}(l,h,e,null==(i=t.style)?void 0:i.styleId,a):l.map(n=>{var r;return xI(n,e,null==(r=t.style)?void 0:r.styleId,a)}).join("");return`${s}<w:p>${iI(t,e.numberingInfo,a,n)}${p}</w:p>`}function II(t){if(0===t.length)return[TI()];const[e,...a]=t;return"paragraph"!==e.type?[TI(!0),e,...a]:[(n=e,{...n,runs:[{id:"synthetic:footnoteRef",text:"",styles:{styleId:"FootnoteReference",superscript:!0},__isFootnoteRefMarker:!0},...n.runs],style:(null==(r=n.style)?void 0:r.styleId)?n.style:{...n.style??{},styleId:"FootnoteText"}}),...a];var n,r}function TI(t=!0){return{id:"synthetic:footnote-body-empty",type:"paragraph",runs:[...t?[{id:"synthetic:footnoteRef",text:"",styles:{styleId:"FootnoteReference",superscript:!0},__isFootnoteRefMarker:!0}]:[],{id:"synthetic:footnote-body-empty-text",text:""}],style:{styleId:"FootnoteText"}}}function CI(t){if(0===t.length)return[kI()];const[e,...a]=t;return"paragraph"!==e.type?[kI(!0),e,...a]:[(n=e,{...n,runs:[{id:"synthetic:endnoteRef",text:"",styles:{styleId:"EndnoteReference",superscript:!0},__isEndnoteRefMarker:!0},...n.runs],style:(null==(r=n.style)?void 0:r.styleId)?n.style:{...n.style??{},styleId:"EndnoteText"}}),...a];var n,r}function kI(t=!0){return{id:"synthetic:endnote-body-empty",type:"paragraph",runs:[...t?[{id:"synthetic:endnoteRef",text:"",styles:{styleId:"EndnoteReference",superscript:!0},__isEndnoteRefMarker:!0}]:[],{id:"synthetic:endnote-body-empty-text",text:""}],style:{styleId:"EndnoteText"}}}const VI=["wholeTable","band1Horz","band2Horz","band1Vert","band2Vert","firstCol","lastCol","firstRow","lastRow","nwCell","neCell","swCell","seCell"];function EI(t,e){const a=[],n=e.paragraphStyle?oI(e.paragraphStyle):"";n&&a.push(n);const r=e.textStyle?hI(e.textStyle):"";r&&a.push(r);const o=e.rowStyle?function(t){var e;if(!t)return"";const a=[],n=$A("gridBefore",t.gridBefore);n&&a.push(n);const r=$A("gridAfter",t.gridAfter);r&&a.push(r);const o=YA("wBefore",t.widthBefore);o&&a.push(o);const i=YA("wAfter",t.widthAfter);i&&a.push(i);const l=YA("tblCellSpacing",t.cellSpacing);l&&a.push(l);const s=tI(t.height,t.heightRule);s&&a.push(s);const d=JA("cantSplit",t.cantSplit);d&&a.push(d);const c=JA("hidden",t.hidden);return c&&a.push(c),(null==(e=t.revisionXml)?void 0:e.length)&&a.push(...t.revisionXml),a.length>0?`<w:trPr>${a.join("")}</w:trPr>`:""}(e.rowStyle):"";o&&a.push(o);const i=function(t){const e=[];if(t.borders){const a=t.borders,n=[["top",a.borderTop],["left",a.borderLeft],["bottom",a.borderBottom],["right",a.borderRight]].filter(t=>null!=t[1]).map(([t,e])=>`<w:${t} ${DA(e)}`).join("");n&&e.push(`<w:tcBorders>${n}</w:tcBorders>`)}return t.shading&&e.push(`<w:shd w:val="clear" w:color="auto" w:fill="${FA(t.shading,"FFFFFF")}"/>`),e.length>0?`<w:tcPr>${e.join("")}</w:tcPr>`:""}(e);return i&&a.push(i),0===a.length?"":`<w:tblStylePr w:type="${PA(t)}">${a.join("")}</w:tblStylePr>`}function RI(t){const e=[];if(e.push(`<w:name w:val="${PA(t.name)}"/>`),t.basedOn&&e.push(`<w:basedOn w:val="${PA(t.basedOn)}"/>`),t.nextStyle&&e.push(`<w:next w:val="${PA(t.nextStyle)}"/>`),("paragraph"===t.type||"table"===t.type)&&t.paragraphStyle){const a=oI(t.paragraphStyle);a&&e.push(a)}if(t.textStyle){const a=hI(t.textStyle);a&&e.push(a)}if("table"===t.type&&t.tableStyle){const a=t.tableStyle,n=[];if(void 0!==a.rowBandSize&&n.push(`<w:tblStyleRowBandSize w:val="${a.rowBandSize}"/>`),void 0!==a.colBandSize&&n.push(`<w:tblStyleColBandSize w:val="${a.colBandSize}"/>`),void 0!==a.indentLeft){const t="number"==typeof a.indentLeft?UA(a.indentLeft):null;null!==t&&n.push(`<w:tblInd w:w="${t}" w:type="dxa"/>`)}if(n.length>0&&e.push(`<w:tblPr>${n.join("")}</w:tblPr>`),a.conditionalFormats){const t=[...VI.filter(t=>t in a.conditionalFormats),...Object.keys(a.conditionalFormats).filter(t=>!VI.includes(t))];for(const n of t){const t=a.conditionalFormats[n];if(t){const a=EI(n,t);a&&e.push(a)}}}}return`<w:style w:type="${"character"===t.type?"character":"table"===t.type?"table":"paragraph"}" w:styleId="${PA(t.id)}">${e.join("")}</w:style>`}const LI=`xmlns:w="${zA}" xmlns:w14="${OA}" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:r="${qA}"`;function zI(t,e){e(t);for(const a of t.runs)a.textBox&&NI(a.textBox.blocks,e)}function NI(t,e){for(const a of t)if("paragraph"!==a.type)for(const t of a.rows)for(const a of t.cells)for(const t of a.blocks)zI(t,e);else zI(a,e)}function qI(t,e,a,n){const r=[],o=new Map,i=new Map,l=[],s=new Map;return NI(t,t=>{var e;for(const d of t.runs){const t=null==(e=d.styles)?void 0:e.link;if(t&&!t.startsWith("#")&&!s.has(t)){const e=`rIdLink${l.length+1}`;s.set(t,e),l.push({rId:e,href:t})}if(d.textBox&&!i.has(d.id)&&(i.set(d.id,a.nextTextBoxDocPrId),a.nextTextBoxDocPrId+=1),!d.image)continue;const c=a.nextImageId,h=`rIdImg${c}`,p={rId:h,runId:d.id,cx:Math.round(9525*d.image.width),cy:Math.round(9525*d.image.height),alt:d.image.alt,crop:d.image.crop,fillMode:d.image.fillMode,rotation:d.image.rotation,flipH:d.image.flipH,flipV:d.image.flipV,floating:d.image.floating,wrapPolygon:d.image.wrapPolygon};if(d.image.linkedSrc){r.push({...p,kind:"linked",target:d.image.linkedSrc}),o.set(d.id,h),a.nextImageId+=1;continue}const u=Oe(n,d.image.src).match(/^data:([^;,]+);base64,(.*)$/);if(!u)continue;const f=eb(u[1]);if(!f)continue;const g=u[2],m=`media/image${c}.${f}`;r.push({...p,kind:"embedded",target:m,base64:g}),o.set(d.id,h),a.nextImageId+=1}}),{numberingInfo:e.numberingInfo,definitions:e.definitions,images:r,imageMap:o,textBoxDocPrIds:i,hyperlinks:l,hyperlinkMap:s}}function OI(t,e,a){const n=We(t).map((n,r)=>SI(n.blocks,e,t.styles)+function(t,e){var a,n,r,o,i,l,s,d,c;const h=WA(t.width,12240),p=WA(t.height,15840),u=t.margins,f="landscape"===t.orientation?' w:orient="landscape"':"",g=[(null==(a=null==e?void 0:e.header)?void 0:a.first)?`<w:headerReference w:type="first" r:id="${e.header.first.relId}"/>`:"",(null==(n=null==e?void 0:e.header)?void 0:n.even)?`<w:headerReference w:type="even" r:id="${e.header.even.relId}"/>`:"",(null==(r=null==e?void 0:e.header)?void 0:r.default)?`<w:headerReference w:type="default" r:id="${e.header.default.relId}"/>`:"",(null==(o=null==e?void 0:e.footer)?void 0:o.first)?`<w:footerReference w:type="first" r:id="${e.footer.first.relId}"/>`:"",(null==(i=null==e?void 0:e.footer)?void 0:i.even)?`<w:footerReference w:type="even" r:id="${e.footer.even.relId}"/>`:"",(null==(l=null==e?void 0:e.footer)?void 0:l.default)?`<w:footerReference w:type="default" r:id="${e.footer.default.relId}"/>`:""].join(""),m=(null==(s=null==e?void 0:e.header)?void 0:s.first)||(null==(d=null==e?void 0:e.footer)?void 0:d.first)?"<w:titlePg/>":"",v=t.columns;let b="";if(v&&v.count>1){const t=WA(v.space,0),e=v.separator?' w:sep="1"':"";if(!1===v.equalWidth&&(null==(c=v.columns)?void 0:c.length)){const a=v.columns.map(t=>`<w:col w:w="${WA(t.width,0)}" w:space="${WA(t.space,0)}"/>`).join("");b=`<w:cols w:num="${v.count}" w:space="${t}" w:equalWidth="0"${e}>${a}</w:cols>`}else b=`<w:cols w:num="${v.count}" w:space="${t}"${e}/>`}return`<w:sectPr>${g}${m}<w:pgSz w:w="${h}" w:h="${p}"${f}/><w:pgMar w:top="${WA(u.top,1440)}" w:right="${WA(u.right,1440)}" w:bottom="${WA(u.bottom,1440)}" w:left="${WA(u.left,1440)}" w:header="${WA(u.header,720)}" w:footer="${WA(u.footer,720)}" w:gutter="${WA(u.gutter,0)}"/>${b}</w:sectPr>`}(n.pageSettings,a[r])).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document ${LI}><w:body>${n}</w:body></w:document>`}function PI(t,e,a,n){const r="header"===t?"hdr":"ftr";return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:${r} ${LI}>${SI(e,a,n)}</w:${r}>`}function WI(t,e,a,n,r,o,i,l){const s=n.map(t=>{const e="header"===t.kind?"application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml":"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml";return`<Override PartName="/word/${t.path}" ContentType="${e}"/>`}).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/>${function(t){const e=new Set;let a="";for(const n of t){const t=n.toLowerCase();if(e.has(t))continue;const r=$v[t];r&&(e.add(t),a+=`<Default Extension="${t}" ContentType="${r}"/>`)}return a}(e)}<Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>${i?'<Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/>':""}${t?'<Override PartName="/word/numbering.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"/>':""}${a?'<Override PartName="/word/settings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"/>':""}${r?'<Override PartName="/word/footnotes.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml"/>':""}${o?'<Override PartName="/word/endnotes.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml"/>':""}${l?'<Override PartName="/word/comments.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"/><Override PartName="/word/commentsExtended.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml"/>':""}${s}</Types>`}const HI={decimal:"decimal",lowerRoman:"lowerRoman",upperRoman:"upperRoman",lowerLetter:"lowerLetter",upperLetter:"upperLetter",symbol:"symbol"},UI={continuous:"continuous",eachSection:"eachSect"};function FI(t,e){if(!e)return null;const a=[];return e.numberFormat&&a.push(`<w:numFmt w:val="${HI[e.numberFormat]}"/>`),void 0!==e.startAt&&a.push(`<w:numStart w:val="${Math.max(1,e.startAt)}"/>`),e.restart&&a.push(`<w:numRestart w:val="${UI[e.restart]}"/>`),a.length>0?`<w:${t}>${a.join("")}</w:${t}>`:null}function BI(t,e){let a="";for(const n of e)a+=`<Relationship Id="${n.rId}" Type="${qA}/hyperlink" Target="${PA(n.href)}" TargetMode="External"/>`;for(const n of t){const t="linked"===n.kind?' TargetMode="External"':"";a+=`<Relationship Id="${n.rId}" Type="${qA}/image" Target="${PA(n.target)}"${t}/>`}return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${NA}">${a}</Relationships>`}async function GI(t){var e,a,n,r,o,i;t=hw(t);const l=new Qp,s=function(t){const e=new Map,a=new Map,n=[];let r=1,o=1;const i=t=>{if(!t.list)return;const i=Math.max(0,t.list.level??0),l=t.list.bulletGlyph??"",s=`${t.list.kind}:${i}:${l}`;let d=a.get(s);d||(d={abstractNumId:r++,numId:o++},a.set(s,d),n.push({kind:t.list.kind,level:i,abstractNumId:d.abstractNumId,numId:d.numId,format:t.list.format,startAt:t.list.startAt,bulletGlyph:t.list.bulletGlyph,bulletFont:t.list.bulletFont})),e.set(t.id,{numId:d.numId,level:i})};for(const l of We(t))NI(l.blocks,i),l.header&&NI(l.header,i),l.firstPageHeader&&NI(l.firstPageHeader,i),l.evenPageHeader&&NI(l.evenPageHeader,i),l.footer&&NI(l.footer,i),l.firstPageFooter&&NI(l.firstPageFooter,i),l.evenPageFooter&&NI(l.evenPageFooter,i);return{numberingInfo:e,definitions:n}}(t),d={nextImageId:1,nextTextBoxDocPrId:1000001},c=We(t),h=function(t){var e;const a=null==(e=t.footnotes)?void 0:e.items;if(!a)return[];const n=new Map;let r=1;for(const{run:o}of Bl(t)){const t=o.footnoteReference;if(!t)continue;if(n.has(t.footnoteId))continue;const e=a[t.footnoteId];e&&(n.set(t.footnoteId,{footnoteId:t.footnoteId,docxId:r,footnote:e}),r+=1)}return Array.from(n.values())}(t),p=function(t){const e=new Map;for(const a of t)e.set(a.footnoteId,a.docxId);return e}(h),u=h.length>0,f=function(t){var e;const a=null==(e=t.endnotes)?void 0:e.items;if(!a)return[];const n=new Map;let r=1;for(const{run:o}of Ql(t)){const t=o.endnoteReference;if(!t)continue;if(n.has(t.endnoteId))continue;const e=a[t.endnoteId];e&&(n.set(t.endnoteId,{endnoteId:t.endnoteId,docxId:r,endnote:e}),r+=1)}return Array.from(n.values())}(t),g=function(t){const e=new Map;for(const a of t)e.set(a.endnoteId,a.docxId);return e}(f),m=f.length>0,v=qI(c.flatMap(t=>t.blocks),s,d,t);v.footnoteIdMap=p,v.endnoteIdMap=g;const b=function(t){const e=t.bookmarks;if(!e||0===e.order.length)return;const a=new Map,n=new Set;for(const l of e.order){const t=e.items[l];if(!t)continue;const r=t.docxIdHint;void 0!==r&&r>=0&&!n.has(r)&&(a.set(l,r),n.add(r))}let r=0;for(const l of e.order)if(!a.has(l)){for(;n.has(r);)r+=1;a.set(l,r),n.add(r),r+=1}const o=new Map,i=(t,e)=>{const a=o.get(t);a?a.push(e):o.set(t,[e])};for(const l of e.order){const t=e.items[l];if(!t)continue;const n=a.get(l);t.start&&i(t.start.paragraphId,{kind:"start",offset:t.start.offset,seq:t.start.seq??0,wId:n,name:t.name,...void 0!==t.colFirst?{colFirst:t.colFirst}:{},...void 0!==t.colLast?{colLast:t.colLast}:{}}),t.end&&i(t.end.paragraphId,{kind:"end",offset:t.end.offset,seq:t.end.seq??0,wId:n})}return o}(t);v.bookmarkEventsByParagraph=b;const y=function(t){const e=t.comments;if(!e||0===e.order.length)return;const a=new Map,n=new Set;for(const s of e.order){const t=e.items[s];if(!t)continue;const r=t.docxIdHint;void 0!==r&&r>=0&&!n.has(r)&&(a.set(s,r),n.add(r))}let r=0;for(const s of e.order)if(!a.has(s)){for(;n.has(r);)r+=1;a.set(s,r),n.add(r),r+=1}const o=new Map,i=(t,e)=>{const a=o.get(t);a?a.push(e):o.set(t,[e])},l=[];return e.order.forEach((t,n)=>{const r=e.items[t];if(!r)return;const o=a.get(t),s=(1073741824+n).toString(16).toUpperCase();l.push({comment:r,wId:o,paraId:s}),r.start&&i(r.start.paragraphId,{kind:"start",offset:r.start.offset,seq:r.start.seq??0,wId:o}),r.end&&(i(r.end.paragraphId,{kind:"end",offset:r.end.offset,seq:r.end.seq??0,wId:o}),i(r.end.paragraphId,{kind:"reference",offset:r.end.offset,seq:(r.end.seq??0)+.5,wId:o}))}),{eventsByParagraph:o,comments:l}}(t);v.commentEventsByParagraph=null==y?void 0:y.eventsByParagraph;const M=void 0!==y,x=[],w=c.map(()=>({}));let S=1,A=1;c.forEach((e,a)=>{const n=(e,n,r)=>{var o;if(!r||0===r.length)return;const i="header"===e?S:A,l=`${e}${i}.xml`,c=`rId${"header"===e?"Header":"Footer"}${i}`,h=qI(r,s,d,t);h.footnoteIdMap=p,h.endnoteIdMap=g,h.bookmarkEventsByParagraph=b,h.commentEventsByParagraph=null==y?void 0:y.eventsByParagraph,x.push({kind:e,type:n,path:l,relId:c,blocks:r,context:h});const u="header"===e?"header":"footer";((o=w[a])[u]??(o[u]={}))[n]={relId:c},"header"===e?S+=1:A+=1};n("header","first",e.firstPageHeader),n("header","even",e.evenPageHeader),n("header","default",e.header),n("footer","first",e.firstPageFooter),n("footer","even",e.evenPageFooter),n("footer","default",e.footer)});const I=s.definitions.length>0,T=c.some(t=>{var e,a;return((null==(e=t.evenPageHeader)?void 0:e.length)??0)>0||((null==(a=t.evenPageFooter)?void 0:a.length)??0)>0}),C=T||void 0!==(null==(e=t.settings)?void 0:e.defaultTabStop)||void 0!==(null==(a=t.footnotes)?void 0:a.settings)||void 0!==(null==(n=t.endnotes)?void 0:n.settings),k=[...v.images,...x.flatMap(t=>t.context.images)],V=u?function(t,e,a,n,r,o,i){const l=r(e.flatMap(t=>II(t.footnote.blocks)));l.footnoteIdMap=i;const s=e.map(t=>{const e=II(t.footnote.blocks).map(t=>"paragraph"===t.type?AI(t,l,o):nI(t,(t,e)=>{var a;return AI(t,l,o,{align:null==(a=e.style)?void 0:a.horizontalAlign})})).join("");return`<w:footnote w:id="${t.docxId}">${e}</w:footnote>`}).join("");return{xml:`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:footnotes xmlns:w="${zA}" xmlns:w14="${OA}" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:r="${qA}"><w:footnote w:type="separator" w:id="-1"><w:p><w:r><w:separator/></w:r></w:p></w:footnote><w:footnote w:type="continuationSeparator" w:id="0"><w:p><w:r><w:continuationSeparator/></w:r></w:p></w:footnote>${s}</w:footnotes>`,partContext:l}}(0,h,0,0,e=>qI(e,s,d,t),t.styles,p):null;V&&k.push(...V.partContext.images);const E=m?function(t,e,a,n,r,o,i){const l=r(e.flatMap(t=>CI(t.endnote.blocks)));l.endnoteIdMap=i;const s=e.map(t=>{const e=CI(t.endnote.blocks).map(t=>"paragraph"===t.type?AI(t,l,o):nI(t,(t,e)=>{var a;return AI(t,l,o,{align:null==(a=e.style)?void 0:a.horizontalAlign})})).join("");return`<w:endnote w:id="${t.docxId}">${e}</w:endnote>`}).join("");return{xml:`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:endnotes xmlns:w="${zA}" xmlns:w14="${OA}" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:r="${qA}"><w:endnote w:type="separator" w:id="-1"><w:p><w:r><w:separator/></w:r></w:p></w:endnote><w:endnote w:type="continuationSeparator" w:id="0"><w:p><w:r><w:continuationSeparator/></w:r></w:p></w:endnote>${s}</w:endnotes>`,partContext:l}}(0,f,0,0,e=>qI(e,s,d,t),t.styles,g):null;E&&k.push(...E.partContext.images);const R=k.filter(t=>"embedded"===t.kind).map(t=>{var e;return null==(e=t.target.split(".").pop())?void 0:e.toLowerCase()}).filter(t=>Boolean(t)),L=null!=t.styles&&Object.keys(t.styles).length>0;l.file("[Content_Types].xml",WI(I,R,C,x,u,m,L,M)),l.file("_rels/.rels",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${NA}"><Relationship Id="rId1" Type="${qA}/officeDocument" Target="word/document.xml"/></Relationships>`),l.file("word/document.xml",OI(t,v,w)),L&&l.file("word/styles.xml",function(t){const e=Object.values(t).map(RI).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="${OA}">${e}</w:styles>`}(t.styles)),I&&l.file("word/numbering.xml",function(t){const e=t.map(({kind:t,level:e,abstractNumId:a,format:n,startAt:r,bulletGlyph:o,bulletFont:i})=>{const l="bullet"===t?"bullet":n??"decimal",s="bullet"===t?o??"":`%${e+1}.`,d=r??1,c="bullet"===t?i??"Symbol":void 0,h=c?`<w:rPr><w:rFonts w:ascii="${PA(c)}" w:hAnsi="${PA(c)}" w:hint="default"/></w:rPr>`:"";return`<w:abstractNum w:abstractNumId="${a}"><w:lvl w:ilvl="${e}"><w:start w:val="${d}"/><w:numFmt w:val="${l}"/><w:lvlText w:val="${PA(s)}"/><w:lvlJc w:val="left"/>${h}</w:lvl></w:abstractNum>`}).join(""),a=t.map(({abstractNumId:t,numId:e})=>`<w:num w:numId="${e}"><w:abstractNumId w:val="${t}"/></w:num>`).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:numbering xmlns:w="${zA}">${e}${a}</w:numbering>`}(s.definitions)),(L||I||C||v.images.length>0||v.hyperlinks.length>0||x.length>0||u||m||M)&&l.file("word/_rels/document.xml.rels",function(t,e,a,n,r,o,i,l,s){let d="";l&&(d+=`<Relationship Id="rIdStyles" Type="${qA}/styles" Target="styles.xml"/>`),t&&(d+=`<Relationship Id="rIdNum" Type="${qA}/numbering" Target="numbering.xml"/>`),e&&(d+=`<Relationship Id="rIdSettings" Type="${qA}/settings" Target="settings.xml"/>`);for(const c of n)d+=`<Relationship Id="${c.rId}" Type="${qA}/hyperlink" Target="${PA(c.href)}" TargetMode="External"/>`;for(const c of a){const t="linked"===c.kind?' TargetMode="External"':"";d+=`<Relationship Id="${c.rId}" Type="${qA}/image" Target="${PA(c.target)}"${t}/>`}for(const c of r){const t="header"===c.kind?"header":"footer";d+=`<Relationship Id="${c.relId}" Type="${qA}/${t}" Target="${c.path}"/>`}return o&&(d+=`<Relationship Id="rIdFootnotes" Type="${qA}/footnotes" Target="footnotes.xml"/>`),i&&(d+=`<Relationship Id="rIdEndnotes" Type="${qA}/endnotes" Target="endnotes.xml"/>`),s&&(d+=`<Relationship Id="rIdComments" Type="${qA}/comments" Target="comments.xml"/>`,d+='<Relationship Id="rIdCommentsExtended" Type="http://schemas.microsoft.com/office/2011/relationships/commentsExtended" Target="commentsExtended.xml"/>'),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${NA}">${d}</Relationships>`}(I,C,v.images,v.hyperlinks,x,u,m,L,M)),C&&l.file("word/settings.xml",function(t,e,a,n){const r=[],o=UA(e);null!==o&&r.push(`<w:defaultTabStop w:val="${o}"/>`);const i=FI("footnotePr",a);i&&r.push(i);const l=FI("endnotePr",n);return l&&r.push(l),t&&r.push("<w:evenAndOddHeaders/>"),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:settings xmlns:w="${zA}">${r.join("")}</w:settings>`}(T,null==(r=t.settings)?void 0:r.defaultTabStop,null==(o=t.footnotes)?void 0:o.settings,null==(i=t.endnotes)?void 0:i.settings));for(const z of x)l.file(`word/${z.path}`,PI(z.kind,z.blocks,z.context,t.styles)),(z.context.images.length>0||z.context.hyperlinks.length>0)&&l.file(`word/_rels/${z.path}.rels`,BI(z.context.images,z.context.hyperlinks));V&&(l.file("word/footnotes.xml",V.xml),(V.partContext.images.length>0||V.partContext.hyperlinks.length>0)&&l.file("word/_rels/footnotes.xml.rels",BI(V.partContext.images,V.partContext.hyperlinks))),E&&(l.file("word/endnotes.xml",E.xml),(E.partContext.images.length>0||E.partContext.hyperlinks.length>0)&&l.file("word/_rels/endnotes.xml.rels",BI(E.partContext.images,E.partContext.hyperlinks))),y&&(l.file("word/comments.xml",KA(y)),l.file("word/commentsExtended.xml",function(t){const e=t.comments.map(({comment:t,paraId:e})=>`<w15:commentEx w15:paraId="${e}" w15:done="${t.resolved?"1":"0"}"/>`).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w15:commentsEx ${ZA}>${e}</w15:commentsEx>`}(y)));for(const z of k)"embedded"===z.kind&&z.base64&&l.file(`word/${z.target}`,z.base64,{base64:!0});return l.generateAsync({type:"arraybuffer"})}function ZI(t){switch(t){case"dashed":return[CM(5),CM(3)];case"dotted":return[CM(1),CM(3)];default:return}}function KI(t,e,a,n,r,o,i){"none"===a.type||a.width<=0||t.drawLine(e,{x1:CM(n),y1:CM(r),x2:CM(o),y2:CM(i),stroke:a.color,lineWidth:CM(a.width),dashArray:ZI(a.type)})}function DI(t,e,a,n,r){const o=n+a.left,i=r+a.top,l=o+a.width,s=i+a.height;KI(t,e,a.borders.top,o,i,l,i),KI(t,e,a.borders.right,l,i,l,s),KI(t,e,a.borders.bottom,o,s,l,s),KI(t,e,a.borders.left,o,i,o,s)}async function jI(t,e,a,n,r,o,i,l,s){if("table"!==a.sourceBlock.type)return;const d=a.sourceBlock,c=a.tableSegment?ln(d,a.tableSegment):d;if(0===c.rows.length)return;const h=Gd({table:c,state:{document:n},pageIndex:0,originX:0,originY:0,contentWidth:i,estimatedHeight:a.estimatedHeight});for(const p of h.cells)p.shading&&t.drawRect(e,{x:CM(r+p.left),y:CM(o+p.top),width:CM(p.width),height:CM(p.height),fill:p.shading});for(const p of h.cells)DI(t,e,p,r,o);for(const p of h.cells)for(const a of p.paragraphs)await hT(t,e,a.paragraph,a.lines,n,r+a.originX,o+a.originY,l,s)}async function XI(t,e,a,n,r,o,i){const l=e.rotation;l&&(t.saveGraphicsState(a.pageIndex),t.rotateAbout(a.pageIndex,CM(n+o/2),CM(r+i/2),l)),function(t,e,a,n,r,o,i){var l,s,d,c;const h=Gs(null==(l=a.shape)?void 0:l.preset,CM(n),CM(r),CM(o),CM(i)),p=null==(s=a.shape)?void 0:s.fill,u=null==(d=a.shape)?void 0:d.borderColor,f=(null==(c=a.shape)?void 0:c.borderWidthPt)??(u?.75:0);t.drawPath(e,{segments:h,fill:p,stroke:u&&f>0?u:void 0,lineWidth:f})}(t,a.pageIndex,e,n,r,o,i),await async function(t,e,a,n,r,o,i){var l;if(0===e.blocks.length)return;const s=function(t){var e,a,n,r;return{left:(null==(e=t.body)?void 0:e.paddingLeft)??0,top:(null==(a=t.body)?void 0:a.paddingTop)??0,right:(null==(n=t.body)?void 0:n.paddingRight)??0,bottom:(null==(r=t.body)?void 0:r.paddingBottom)??0}}(e),d=n+s.left,c=r+s.top,h=Math.max(1,o-s.left-s.right),p=Math.max(1,i-s.top-s.bottom),u=(null==(l=Rl({blocks:e.blocks,pageSettings:{width:h,height:p,orientation:"portrait",margins:{top:0,right:0,bottom:0,left:0,header:0,footer:0,gutter:0}},maxPageHeight:p,styles:a.document.styles,pageOffset:a.pageIndex})[0])?void 0:l.blocks)??[];if(0===u.length)return;const f=new Map;t.saveGraphicsState(a.pageIndex),t.clipRect(a.pageIndex,CM(d),CM(c),CM(h),CM(p));let g=c;for(const m of u)"paragraph"===m.sourceBlock.type&&m.layout?await hT(t,a.pageIndex,m.sourceBlock,m.layout.lines,a.document,d,g,a.fontRegistry,f):"table"===m.sourceBlock.type&&await jI(t,a.pageIndex,m,a.document,d,g,h,a.fontRegistry,f),g+=Math.max(0,m.estimatedHeight);t.restoreGraphicsState(a.pageIndex)}(t,e,a,n,r,o,i),l&&t.restoreGraphicsState(a.pageIndex)}async function JI(t){const{writer:e,document:a,fontRegistry:n,pageIndex:r,lines:o,pageSettings:i,contentLeft:l,contentTop:s,contentWidth:d,paragraphTop:c}=t;for(const h of o){const t=new Map(h.slots.map(t=>[t.offset,t]));for(const o of h.fragments){const p=o.textBox;if(!(null==p?void 0:p.floating))continue;const u=t.get(o.startOffset),f=l+((null==u?void 0:u.left)??0),g=c+h.top,m=qi({object:Ri(p),pageSettings:i,contentLeft:l,contentTop:s,contentWidth:d,paragraphTop:c,lineTop:g,anchorLeft:f});await XI(e,p,{document:a,fontRegistry:n,pageIndex:r},m.x,m.y,m.width,m.height)}}}const YI=new WeakMap;function QI(t){const e=/^data:([^;,]+)(;base64)?,(.*)$/i.exec(t);if(!e)return null;const a=e[1].toLowerCase(),n=Boolean(e[2]),r=e[3]??"";if(!n)return{mediaType:a,data:(new TextEncoder).encode(decodeURIComponent(r))};const o="function"==typeof atob?atob(r):Buffer.from(r,"base64").toString("binary");return{mediaType:a,data:Uint8Array.from(o,t=>t.charCodeAt(0))}}async function _I(t,e,a){let n=t;n.startsWith("data:")||(n=await async function(t){if("function"!=typeof fetch)return null;const e=await fetch(t);if(!e.ok)return null;const a=await e.blob(),n=new Uint8Array(await a.arrayBuffer()),r=Array.from(n,t=>String.fromCharCode(t)).join(""),o="function"==typeof btoa?btoa(r):Buffer.from(n).toString("base64");return`data:${a.type||"application/octet-stream"};base64,${o}`}(n)??n);let r=QI(n);if(!r)return null;const o="undefined"!=typeof Image?await async function(t){return"undefined"==typeof Image?null:await new Promise(e=>{const a=new Image;a.crossOrigin="anonymous",a.onload=()=>e(a),a.onerror=()=>e(null),a.src=t})}(n):null,i=null!=o&&o.naturalWidth>0&&o.naturalHeight>0;if("image/jpeg"!==r.mediaType&&"image/jpg"!==r.mediaType){if(!i)return null;const t=function(t){if("undefined"==typeof document)return null;const e=document.createElement("canvas");e.width=t.naturalWidth,e.height=t.naturalHeight;const a=e.getContext("2d");return a?(a.fillStyle="#ffffff",a.fillRect(0,0,e.width,e.height),a.drawImage(t,0,0),e.toDataURL("image/jpeg",.92)):null}(o);if(r=t?QI(t):null,!r)return null}const l=i?o.naturalWidth:e,s=i?o.naturalHeight:a;return{width:Math.max(1,Math.round(l)),height:Math.max(1,Math.round(s)),data:r.data}}function $I(t,e){const a=new Map(t.slots.map(t=>[t.offset,t])),n=[];for(const r of e.chars){if("\n"===r.char||"\t"===r.char)continue;const t=a.get(r.paragraphOffset);t&&n.push({char:r.char,left:t.left,offset:r.paragraphOffset})}return n}function tT(t,e,a){const n=$I(t,e);if(0===n.length)return null;const r=new Map(t.slots.map(t=>[t.offset,t])),o=n[0],i=n[n.length-1],l=r.get(i.offset+1);return{left:o.left,right:(null==l?void 0:l.left)??i.left+.55*a}}function eT(t,e,a,n,r,o,i,l){const s=tT(a,n,i.fontSize??TM);if(!s)return;const d="underline"===l?o+a.top+a.height-2:"doubleStrike"===l?o+a.top+.5*a.height:o+a.top+.52*a.height,c=r+s.left,h=r+s.right,p="underline"===l?i.underlineColor??i.color??"#000000":i.color??"#000000";if("strike"!==l){if("doubleStrike"===l){const a=1.3;return t.drawLine(e,{x1:CM(c),y1:CM(d-a),x2:CM(h),y2:CM(d-a),stroke:p,lineWidth:CM(1)}),void t.drawLine(e,{x1:CM(c),y1:CM(d+a),x2:CM(h),y2:CM(d+a),stroke:p,lineWidth:CM(1)})}!function(t,e,a,n,r,o,i){const l=$s(i),s=(r,i)=>{t.drawLine(e,{x1:CM(a),y1:CM(r),x2:CM(n),y2:CM(r),stroke:o,lineWidth:CM(l),dashArray:i})};if(Qs(i))return s(r-1.5),void s(r+1.5);if(_s(i))return void function(t,e,a,n,r,o,i){const l=4,s=1.5;let d=a,c=r;for(let h=a;h<=n;h+=1){const n=r+Math.sin((h-a)/l*Math.PI)*s;t.drawLine(e,{x1:CM(d),y1:CM(c),x2:CM(h),y2:CM(n),stroke:o,lineWidth:CM(i)}),d=h,c=n}}(t,e,a,n,r,o,l);s(r,td(i))}(t,e,c,h,d,p,i.underlineStyle)}else t.drawLine(e,{x1:CM(c),y1:CM(d),x2:CM(h),y2:CM(d),stroke:p,lineWidth:CM(1)})}function aT(t,e,a,n){var r;const o=qe(t.style,n.styles).tabs??[];if(0===o.length)return;const i=a-((null==(r=e.slots[0])?void 0:r.left)??0),l=o.filter(t=>"clear"!==t.type).map(t=>({...t,positionPx:t.position*bn})).filter(t=>t.positionPx>i+.01).sort((t,e)=>t.positionPx-e.positionPx)[0];return(null==l?void 0:l.leader)&&"none"!==l.leader?l.leader:void 0}async function nT(t,e,a,n,r,o,i,l,s){var d;if(r.image){const a=n.slots.find(t=>t.offset===r.startOffset)??n.slots.find(t=>t.offset>=r.startOffset);if(!a)return;const s=await async function(t,e,a){const n=Oe(e,a.src);if(!n)return null;let r=YI.get(t);r||(r=new Map,YI.set(t,r));const o=r.get(n);if(o)return o;const i=_I(n,a.width,a.height).then(e=>e?t.registerImageResource({width:e.width,height:e.height,data:e.data,filter:"DCTDecode"}):null);return r.set(n,i),i}(t,o,r.image);if(!s)return;return void t.drawImage(e,{resourceName:s,x:CM(i+a.left),y:CM(l+n.top+n.height-r.image.height),width:CM(r.image.width),height:CM(r.image.height),rotation:r.image.rotation})}if(r.textBox)return void(await async function(t,e,a,n,r,o,i,l){const s=n.textBox;if(!s||s.floating)return;const d=a.slots.find(t=>t.offset===n.startOffset)??a.slots.find(t=>t.offset>=n.startOffset);d&&await XI(t,s,{document:r,fontRegistry:l,pageIndex:e},o+d.left,i+a.top+a.height-s.height,s.width,s.height)}(t,e,n,r,o,i,l,s));const c=Ne(r.styles,null==(d=a.style)?void 0:d.styleId,o.styles);if(c.hidden)return;const h=s.resolveFontFace({fontFamily:c.fontFamily,bold:c.bold,italic:c.italic}),p=c.smallCaps?.8*kM(c):kM(c),u=(c.baselineShift??0)*bn,f=l+n.top+.8*n.height-u,g=$I(n,r),m=g.map(t=>c.allCaps?t.char.toUpperCase():t.char).join("");if(!g[0]||0===m.length)return;!function(t,e,a,n,r,o,i){if(!i.shading)return;const l=tT(a,n,i.fontSize??TM);l&&t.drawRect(e,{x:CM(r+l.left),y:CM(o+a.top+2),width:CM(Math.max(0,l.right-l.left)),height:CM(Math.max(2,a.height-4)),fill:i.shading})}(t,e,n,r,i,l,c),function(t,e,a,n,r,o,i){if(!i.highlight)return;const l=tT(a,n,i.fontSize??TM);l&&t.drawRect(e,{x:CM(r+l.left),y:CM(o+a.top+2),width:CM(Math.max(0,l.right-l.left)),height:CM(Math.max(2,a.height-4)),fill:i.highlight})}(t,e,n,r,i,l,c),function(t,e,a,n,r,o,i,l,s){const d=new Map(n.slots.map(t=>[t.offset,t]));for(const c of r.chars){if("\t"!==c.char)continue;const r=d.get(c.paragraphOffset),h=d.get(c.paragraphOffset+1);if(!r||!h)continue;const p=aT(a,n,r.left,o);if(!p)continue;const u="underscore"===p?l+2:l;t.drawLine(e,{x1:CM(i+r.left),y1:CM(u),x2:CM(i+h.left),y2:CM(u),stroke:s,lineWidth:CM("heavy"===p?1.5:1),dashArray:"dot"===p||"middleDot"===p?[1,3]:"hyphen"===p?[5,3]:void 0})}}(t,e,a,n,r,o,i,f,c.color??"#000000");if("justify"===(qe(a.style,o.styles).align??"left")){const a=function(t){const e=[];let a=[];for(const n of t)" "!==n.char?a.push(n):a.length>0&&(e.push(a),a=[]);return a.length>0&&e.push(a),e}(g);for(const n of a){const a=n.map(t=>c.allCaps?t.char.toUpperCase():t.char).join("");0!==a.length&&t.drawText(e,{x:CM(i+n[0].left),y:CM(f),text:a,fontSize:p,color:c.color??"#000000",bold:c.bold,italic:c.italic,fontResourceName:h.writerResourceName,characterSpacing:c.characterSpacing??0,horizontalScale:c.characterScale??100})}}else{const a=function(t){const e=[];let a=[];for(const n of t){const t=a[a.length-1];t&&n.offset>t.offset+1&&(e.push(a),a=[]),a.push(n)}return a.length>0&&e.push(a),e}(g);for(const n of a){const a=n.map(t=>c.allCaps?t.char.toUpperCase():t.char).join("");0!==a.length&&t.drawText(e,{x:CM(i+n[0].left),y:CM(f),text:a,fontSize:p,color:c.color??"#000000",bold:c.bold,italic:c.italic,fontResourceName:h.writerResourceName,characterSpacing:c.characterSpacing??0,horizontalScale:c.characterScale??100})}}c.underline&&eT(t,e,n,r,i,l,c,"underline"),c.strike&&eT(t,e,n,r,i,l,c,"strike"),c.doubleStrike&&eT(t,e,n,r,i,l,c,"doubleStrike")}const rT=["•","○","▪","•","○","▪"],oT=["decimal","lowerLetter","lowerRoman","decimal","lowerLetter","lowerRoman"];function iT(t){if(t<=0)return String(t);let e=t,a="";for(;e>0;){const t=(e-1)%26;a=String.fromCharCode(65+t)+a,e=Math.floor((e-1)/26)}return a}function lT(t){if(t<=0||t>=4e3)return String(t);const e=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];let a=t,n="";for(const[r,o]of e)for(;a>=r;)n+=o,a-=r;return n}function sT(t,e){if(!t.list)return"";const a=Math.max(0,t.list.level??0);if("bullet"===t.list.kind)return rT[a%rT.length];return`${function(t,e){switch(e){case"lowerLetter":return iT(t).toLowerCase();case"upperLetter":return iT(t).toUpperCase();case"lowerRoman":return lT(t).toLowerCase();case"upperRoman":return lT(t).toUpperCase();default:return String(t)}}(e.get(t.id)??t.list.startAt??1,t.list.format&&"bullet"!==t.list.format?t.list.format:oT[a%oT.length])}.`}function dT(t,e,a,n,r,o,i,l,s){var d;if(0!==n.index)return;const c=sT(a,s);if(!c)return;if(!n.slots[0])return;const h=Ne(void 0,null==(d=a.style)?void 0:d.styleId,r.styles),p=l.resolveFontFace({fontFamily:h.fontFamily,bold:h.bold,italic:h.italic}),u=$o(a,r.styles);t.drawText(e,{x:CM(o+Math.max(0,u)),y:CM(i+n.top+.8*n.height),text:c,fontSize:kM(h),color:h.color??"#000000",bold:h.bold,italic:h.italic,fontResourceName:p.writerResourceName})}function cT(t,e,a,n,r,o,i){const l=[[a.borderTop,"top"],[a.borderRight,"right"],[a.borderBottom,"bottom"],[a.borderLeft,"left"]],s=l.some(([t])=>t&&"none"!==t.type&&t.width>0);if(!a.shading&&!s)return;let d=0;for(const g of n)d=Math.max(d,g.top+g.height);if(d<=0)return;const c=Mn(a),h=c.top+d+c.bottom,p=r+(a.indentLeft??0),u=r+i-(a.indentRight??0),f=o+h;a.shading&&t.drawRect(e,{x:CM(p),y:CM(o),width:CM(Math.max(0,u-p)),height:CM(h),fill:a.shading});for(const[g,m]of l){if(!g||"none"===g.type||g.width<=0)continue;const[a,n,r,i]="top"===m?[p,o,u,o]:"bottom"===m?[p,f,u,f]:"left"===m?[p,o,p,f]:[u,o,u,f];t.drawLine(e,{x1:CM(a),y1:CM(n),x2:CM(r),y2:CM(i),stroke:g.color,lineWidth:g.width,dashArray:ZI(g.type)})}}async function hT(t,e,a,n,r,o,i,l,s){for(const d of n){dT(t,e,a,d,r,o,i,l,s);for(const n of d.fragments)await nT(t,e,a,d,n,r,o,i,l)}}async function pT(t,e,a,n,r,o,i,l,s,d){if(!a||0===a.length)return;const c=o;let h=o;for(const p of a){if("paragraph"===p.sourceBlock.type&&p.layout){const a=qe(p.sourceBlock.style,n.styles),u=h+(0===p.layout.startOffset&&h>o?a.spacingBefore??0:0),f=u+Mn(a).top;cT(t,e,a,p.layout.lines,r,u,i),await hT(t,e,p.sourceBlock,p.layout.lines,n,r,f,l,s),d&&await JI({writer:t,document:n,fontRegistry:l,pageIndex:e,lines:p.layout.lines,pageSettings:d,contentLeft:r,contentTop:c,contentWidth:i,paragraphTop:u})}else"table"===p.sourceBlock.type&&await jI(t,e,p,n,r,h,i,l,s);h+=Math.max(0,p.estimatedHeight)}}function uT(t,e,a,n){t.drawRect(e,{x:0,y:0,width:a,height:n,fill:"#ffffff"})}const fT=[{key:"helvetica:regular",family:"Helvetica",bold:!1,italic:!1,writerResourceName:"F1",pdfResource:{kind:"base14",resourceName:"F1",baseFont:"Helvetica"}},{key:"helvetica:bold",family:"Helvetica",bold:!0,italic:!1,writerResourceName:"F2",pdfResource:{kind:"base14",resourceName:"F2",baseFont:"Helvetica-Bold"}},{key:"helvetica:italic",family:"Helvetica",bold:!1,italic:!0,writerResourceName:"F3",pdfResource:{kind:"base14",resourceName:"F3",baseFont:"Helvetica-Oblique"}},{key:"helvetica:bolditalic",family:"Helvetica",bold:!0,italic:!0,writerResourceName:"F4",pdfResource:{kind:"base14",resourceName:"F4",baseFont:"Helvetica-BoldOblique"}}];function gT(t,e,a){return`${t.toLowerCase()}:${e?"bold":"regular"}${a?"italic":""}`}function mT(t){return t.replace(/[^A-Za-z0-9_]/g,"")}class vT{constructor(){a(this,"faces",new Map),a(this,"fallbackFamily","Helvetica");for(const t of fT)this.registerFontFace(t)}registerFontFace(t){this.faces.set(gT(t.family,t.bold,t.italic),t)}resolveFontFace(t){const e=_r(t.fontFamily),a=Boolean(t.bold),n=Boolean(t.italic);return this.faces.get(gT(e,a,n))??this.faces.get(gT(this.fallbackFamily,a,n))??this.faces.get(gT(this.fallbackFamily,!1,!1))}getPdfFontResources(){const t=new Map;for(const e of this.faces.values())t.set(e.pdfResource.resourceName,e.pdfResource);return Array.from(t.values())}async loadBundledUnicodeFaces(t={}){const e=t.families?new Set(Array.from(t.families).map(_r).map(t=>t.toLowerCase())):null,a=await this.registerOfficeCompatibleFaces(e);if(!e||e.has("roboto")||Array.from(e).some(t=>"helvetica"!==t&&!a.has(t)))for(const[n,r]of Object.entries(Yr)){const t=await io(r);if(!t)continue;const e="bold"===n||"bolditalic"===n,a="italic"===n||"bolditalic"===n,o=`Roboto${n[0].toUpperCase()}${n.slice(1)}`;this.registerFontFace({key:`roboto:${n}`,family:"Roboto",bold:e,italic:a,writerResourceName:o,pdfResource:{kind:"unicode",resourceName:o,family:"Roboto",fontData:t}}),this.fallbackFamily="Roboto"}}async registerOfficeCompatibleFaces(t){const e=new Set;for(const a of Qr){const n=[a.family,...a.aliases].map(t=>t.toLowerCase());if(!(!t||n.some(e=>t.has(e))))continue;for(const t of n)e.add(t);const r=[];for(const[t,e]of Object.entries(a.files)){const n=await io(e);if(!n)continue;const o="bold"===t||"bolditalic"===t,i="italic"===t||"bolditalic"===t,l=`${mT(a.family)}${t[0].toUpperCase()}${t.slice(1)}`,s={key:`${a.family.toLowerCase()}:${t}`,family:a.family,bold:o,italic:i,writerResourceName:l,pdfResource:{kind:"unicode",resourceName:l,family:a.family,fontData:n}};this.registerFontFace(s),r.push(s)}for(const t of a.aliases)for(const e of r)this.registerFontFace({...e,key:`${t.toLowerCase()}:${e.key.split(":")[1]}`,family:t})}return e}}class bT{constructor(t){this.font=t}layout(t){const e=[],a=[];let n=0;for(const r of t){const t=r.codePointAt(0)??65533,o=this.font.glyphForCodePoint(t),i=this.font.advanceWidthForGlyph(o);e.push({id:o,codePoints:0===o?[65533]:[t],advanceWidth:i}),a.push({xAdvance:i}),n+=i}return{glyphs:e,positions:a,advanceWidth:n}}}function yT(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function MT(t,e){return yT(t).getUint16(e)}function xT(t,e,a){yT(t).setUint16(e,a,!1)}function wT(t,e,a){yT(t).setUint32(e,a,!1)}function ST(t){return t+3&-4}function AT(t){const e=t.reduce((t,e)=>t+ST(e.byteLength),0),a=new Uint8Array(e);let n=0;for(const r of t)a.set(r,n),n+=ST(r.byteLength);return a}function IT(t,e){const a=[],n=yT(t);if(0===e)for(let r=0;r+1<t.byteLength;r+=2)a.push(2*n.getUint16(r));else for(let r=0;r+3<t.byteLength;r+=4)a.push(n.getUint32(r));return a}function TT(t,e){const a=t[e],n=t[e+1];return void 0===a||void 0===n?null:{start:a,end:n}}function CT(t,e){if(t.byteLength<10||function(t,e){return yT(t).getInt16(e)}(t,0)>=0)return;let a=10,n=0;do{if(a+4>t.byteLength)return;n=MT(t,a),e(MT(t,a+2)),a+=4,a+=1&n?4:2,8&n?a+=2:64&n?a+=4:128&n&&(a+=8)}while(32&n)}function kT(t){const e=new Uint8Array(4*t.length);return t.forEach((t,a)=>wT(e,4*a,t)),e}function VT(t,e){const a=new Uint8Array(4*(e+1));for(let n=0;n<=e;n+=1)xT(a,4*n,t.advanceWidthForGlyph(n)),xT(a,4*n+2,0);return a}class ET{createSubset(t,e){const a=new Map,n=[];for(const c of e)n.push(c.id),a.has(c.id)||a.set(c.id,c.codePoints);const r=function(t,e){const a=t.getRawTableData("glyf"),n=t.getRawTableData("loca"),r=t.getRawTableData("head");if(!a||!n||!r)return Array.from(new Set([0,...e])).sort((t,e)=>t-e);const o=IT(n,MT(r,50)),i=new Set([0,...e]),l=Array.from(i);for(;l.length>0;){const t=TT(o,l.pop());!t||t.end<=t.start||t.end>a.byteLength||CT(a.slice(t.start,t.end),t=>{i.has(t)||(i.add(t),l.push(t))})}return Array.from(i).sort((t,e)=>t-e)}(t,n),o=function(t,e){const a=t.getRawTableData("glyf"),n=t.getRawTableData("loca"),r=t.getRawTableData("head"),o=t.getRawTableData("hhea"),i=t.getRawTableData("maxp"),l=t.getRawTableData("cmap");if(!(a&&n&&r&&o&&i&&l))throw new Error("Missing required TrueType tables for subsetting");const s=Math.max(0,...e),d=new Set(e),c=IT(n,MT(r,50)),h=[],p=[];let u=0;for(let b=0;b<=s;b+=1){h.push(u);const t=TT(c,b);if(d.has(b)&&t&&t.end>t.start){const e=a.slice(t.start,t.end);p.push(e),u+=ST(e.byteLength)}}h.push(u);const f=r.slice();wT(f,8,0),xT(f,50,1);const g=o.slice();xT(g,34,s+1);const m=i.slice();xT(m,4,s+1);const v={cmap:l,head:f,hhea:g,hmtx:VT(t,s),loca:kT(h),maxp:m,glyf:AT(p)};for(const b of["OS/2","name","post"]){const e=t.getRawTableData(b);e&&(v[b]=e)}return v}(t,r),i=Cr(65536,new Map(Object.entries(o).map(([t,e])=>[t.charCodeAt(0)<<24|t.charCodeAt(1)<<16|t.charCodeAt(2)<<8|t.charCodeAt(3),e]))).ttf,l=Math.max(0,...r),s=[],d=[];for(let c=0;c<=l;c+=1)s[c]=t.advanceWidthForGlyph(c)/t.unitsPerEm*1e3,d[c]=a.get(c)??[0];return{fontFile:i,widths:s,unicode:d,encodeGlyph:t=>t}}}const RT=[{kind:"base14",resourceName:"F1",baseFont:"Helvetica"},{kind:"base14",resourceName:"F2",baseFont:"Helvetica-Bold"},{kind:"base14",resourceName:"F3",baseFont:"Helvetica-Oblique"},{kind:"base14",resourceName:"F4",baseFont:"Helvetica-BoldOblique"}];function LT(t){return Number.isFinite(t)?Number(t.toFixed(3)).toString():"0"}function zT(t){return(new TextEncoder).encode(t).byteLength}function NT(t){return Array.from(t).map(t=>t.toString(16).padStart(2,"0").toUpperCase()).join("")}function qT(t){return Math.max(0,t).toString(16).padStart(4,"0").slice(-4).toUpperCase()}function OT(t,e,a){const[n,r,o]=function(t,e){if(!t)return e;const a=t.trim().replace(/^#/,"");return/^[0-9a-fA-F]{6}$/.test(a)?[Number.parseInt(a.slice(0,2),16)/255,Number.parseInt(a.slice(2,4),16)/255,Number.parseInt(a.slice(4,6),16)/255]:e}(t,a);return`${LT(n)} ${LT(r)} ${LT(o)} ${e}`}function PT(t,e){return(t&&t.trim().length>0?t:e).replaceAll(" ","_").replace(/[^A-Za-z0-9_.+-]/g,"")}const WT=new Map([[8364,128],[8218,130],[402,131],[8222,132],[8230,133],[8224,134],[8225,135],[710,136],[8240,137],[352,138],[8249,139],[338,140],[381,142],[8216,145],[8217,146],[8220,147],[8221,148],[8226,149],[8211,150],[8212,151],[732,152],[8482,153],[353,154],[8250,155],[339,156],[382,158],[376,159]]);function HT(t){return Array.from(t).map(t=>function(t){const e=t.codePointAt(0)??63;return e>=32&&e<=126||e>=160&&e<=255?e:WT.get(e)??63}(t).toString(16).padStart(2,"0").toUpperCase()).join("")}function UT(t){const e=[];for(let a of t)a>65535?(a-=65536,e.push(a>>>10&1023|55296),e.push(1023&a|56320)):e.push(a);return e.map(qT).join("")}function FT(t){return qT(t)}function BT(t){return`% OasisText ${UT(Array.from(t).map(t=>t.codePointAt(0)??65533))}`}class GT{constructor(t=RT){a(this,"pages",[]),a(this,"fontResources",new Map),a(this,"unicodeFontStates",new Map),a(this,"usedFontResourceNames",new Set),a(this,"imageResources",new Map);for(const e of t)this.registerFontResource(e)}registerFontResource(t){if(this.fontResources.set(t.resourceName,t),"unicode"===t.kind&&!this.unicodeFontStates.has(t.resourceName)){const a={program:e=function(t){const e=Jr.decodeSync(t);return Mo.parse(e)}(t.fontData),layouter:new bT(e),subsetter:new ET},n=1e3/a.program.unitsPerEm,r={id:0,codePoints:[0],advanceWidth:a.program.advanceWidthForGlyph(0)};this.unicodeFontStates.set(t.resourceName,{resource:t,font:a,usedGlyphs:new Map([[0,r]]),scale:n,layoutCache:new Map})}var e}addPage(t){return this.pages.push({width:Math.max(1,t.width),height:Math.max(1,t.height),commands:[],imageResourceNames:new Set}),this.pages.length-1}getPageCount(){return this.pages.length}drawRect(t,e){const a=this.pages[t];if(!a||e.width<=0||e.height<=0)return;const n=["q"];e.fill&&n.push(OT(e.fill,"rg",[1,1,1])),e.stroke&&(n.push(OT(e.stroke,"RG",[0,0,0])),n.push(`${LT(e.lineWidth??1)} w`)),n.push([LT(e.x),LT(a.height-e.y-e.height),LT(e.width),LT(e.height),"re"].join(" ")),e.fill&&e.stroke?n.push("B"):e.fill?n.push("f"):e.stroke&&n.push("S"),n.push("Q"),a.commands.push(n.join("\n"))}drawLine(t,e){const a=this.pages[t];if(!a)return;const n=e.dashArray&&e.dashArray.length>0?`[${e.dashArray.map(t=>LT(t)).join(" ")}] 0 d`:null,r=["q",OT(e.stroke,"RG",[0,0,0])];n&&r.push(n),r.push(`${LT(e.lineWidth??1)} w`,`${LT(e.x1)} ${LT(a.height-e.y1)} m`,`${LT(e.x2)} ${LT(a.height-e.y2)} l`,"S","Q"),a.commands.push(r.join("\n"))}drawPath(t,e){const a=this.pages[t];if(!a||0===e.segments.length)return;if(!e.fill&&!e.stroke)return;const n=t=>a.height-t,r=["q"];e.fill&&r.push(OT(e.fill,"rg",[1,1,1])),e.stroke&&(r.push(OT(e.stroke,"RG",[0,0,0])),r.push(`${LT(e.lineWidth??1)} w`));for(const o of e.segments)switch(o.type){case"move":r.push(`${LT(o.x)} ${LT(n(o.y))} m`);break;case"line":r.push(`${LT(o.x)} ${LT(n(o.y))} l`);break;case"cubic":r.push(`${LT(o.x1)} ${LT(n(o.y1))} ${LT(o.x2)} ${LT(n(o.y2))} ${LT(o.x)} ${LT(n(o.y))} c`);break;case"close":r.push("h")}e.fill&&e.stroke?r.push("B"):e.fill?r.push("f"):r.push("S"),r.push("Q"),a.commands.push(r.join("\n"))}saveGraphicsState(t){const e=this.pages[t];e&&e.commands.push("q")}restoreGraphicsState(t){const e=this.pages[t];e&&e.commands.push("Q")}rotateAbout(t,e,a,n){const r=this.pages[t];if(!r||!n)return;const o=r.height-a,i=-n*Math.PI/180,l=Math.cos(i),s=Math.sin(i),d=e-e*l+o*s,c=o-e*s-o*l;r.commands.push(`${LT(l)} ${LT(s)} ${LT(-s)} ${LT(l)} ${LT(d)} ${LT(c)} cm`)}clipRect(t,e,a,n,r){const o=this.pages[t];!o||n<=0||r<=0||o.commands.push(`${LT(e)} ${LT(o.height-a-r)} ${LT(n)} ${LT(r)} re`,"W","n")}drawText(t,e){const a=this.pages[t];if(!a||0===e.text.length)return;const n=function(t){return t.fontResourceName?t.fontResourceName:t.bold&&t.italic?"F4":t.bold?"F2":t.italic?"F3":"F1"}(e);this.usedFontResourceNames.add(n);const r=this.unicodeFontStates.get(n);r?this.drawUnicodeText(a,r,e):a.commands.push([BT(e.text),"BT",OT(e.color,"rg",[0,0,0]),`/${n} ${LT(e.fontSize??12)} Tf`,...e.horizontalScale&&e.horizontalScale>0&&100!==e.horizontalScale?[`${LT(e.horizontalScale)} Tz`]:[],...e.characterSpacing&&0!==e.characterSpacing?[`${LT(e.characterSpacing)} Tc`]:[],`${LT(e.x)} ${LT(a.height-e.y)} Td`,`<${HT(e.text)}> Tj`,"ET"].join("\n"))}registerImageResource(t){const e=t.resourceName??`Im${this.imageResources.size+1}`;return this.imageResources.has(e)||this.imageResources.set(e,{resourceName:e,width:Math.max(1,Math.round(t.width)),height:Math.max(1,Math.round(t.height)),data:t.data,filter:t.filter}),e}drawImage(t,e){const a=this.pages[t];if(!a||e.width<=0||e.height<=0||!this.imageResources.has(e.resourceName))return;a.imageResourceNames.add(e.resourceName);const n=a.height-e.y-e.height,r=Number.isFinite(e.rotation)?e.rotation??0:0;if(0===r)return void a.commands.push(["q",[LT(e.width),"0","0",LT(e.height),LT(e.x),LT(n),"cm"].join(" "),`/${e.resourceName} Do`,"Q"].join("\n"));const o=-r*Math.PI/180,i=Math.cos(o),l=Math.sin(o),s=e.width*i,d=e.width*l,c=-e.height*l,h=e.height*i,p=e.x+e.width/2-.5*s-.5*c,u=n+e.height/2-.5*d-.5*h;a.commands.push(["q",[LT(s),LT(d),LT(c),LT(h),LT(p),LT(u),"cm"].join(" "),`/${e.resourceName} Do`,"Q"].join("\n"))}layoutUnicodeText(t,e){const a=t.layoutCache.get(e);if(a)return a;const n=t.font.layouter.layout(e);return t.layoutCache.set(e,n),n}encodeUnicodeGlyphRun(t,e){return e.glyphs.map((a,n)=>{t.usedGlyphs.has(a.id)||t.usedGlyphs.set(a.id,a);const r=e.positions[n],o=a.advanceWidth*t.scale,i=((null==r?void 0:r.xAdvance)??a.advanceWidth)*t.scale;return{glyphId:a.id,nominalWidth:o,desiredAdvance:i}})}drawUnicodeText(t,e,a){const n=this.layoutUnicodeText(e,a.text),r=this.encodeUnicodeGlyphRun(e,n);if(0===r.length)return;const o=r.some(t=>Math.abs(t.nominalWidth-t.desiredAdvance)>.01)?`[${r.map(t=>{const e=t.nominalWidth-t.desiredAdvance;return 0===e?`<${FT(t.glyphId)}>`:`<${FT(t.glyphId)}> ${LT(e)}`}).join(" ")}] TJ`:`<${r.map(t=>FT(t.glyphId)).join("")}> Tj`;t.commands.push([BT(a.text),"BT",OT(a.color,"rg",[0,0,0]),`/${e.resource.resourceName} ${LT(a.fontSize??12)} Tf`,...a.horizontalScale&&a.horizontalScale>0&&100!==a.horizontalScale?[`${LT(a.horizontalScale)} Tz`]:[],...a.characterSpacing&&0!==a.characterSpacing?[`${LT(a.characterSpacing)} Tc`]:[],`${LT(a.x)} ${LT(t.height-a.y)} Td`,o,"ET"].join("\n"))}toArrayBuffer(){const t=this.toUint8Array();return Uint8Array.from(t).buffer}toBlob(){return new Blob([this.toArrayBuffer()],{type:"application/pdf"})}toUint8Array(){0===this.pages.length&&this.addPage({width:612,height:792});const t=[],e=e=>{const a=t.length+1;return t.push({id:a,body:e}),a},a=e(""),n=e(""),r=Array.from(this.fontResources.values()).filter(t=>"base14"===t.kind||this.usedFontResourceNames.has(t.resourceName)),o=r.map(t=>{if("unicode"===t.kind){const a=this.unicodeFontStates.get(t.resourceName);if(a)return this.addUnicodeFontObjects(a,e)}return e(function(t){switch(t.kind){case"base14":return`<< /Type /Font /Subtype /Type1 /BaseFont /${t.baseFont} /Encoding /WinAnsiEncoding >>`;case"unicode":return"<< /Type /Font /Subtype /Type0 /BaseFont /OasisPending /Encoding /Identity-H >>"}}(t))}),i=r.map((t,e)=>`/${t.resourceName} ${o[e]} 0 R`).join(" "),l=new Map;for(const p of this.imageResources.values())l.set(p.resourceName,this.addImageObject(p,e));const s=[];for(const p of this.pages){const t=`${p.commands.join("\n")}\n`,a=e(`<< /Length ${zT(t)} >>\nstream\n${t}endstream`),r=Array.from(p.imageResourceNames).map(t=>{const e=l.get(t);return e?`/${t} ${e} 0 R`:""}).filter(Boolean).join(" "),o=r?` /XObject << ${r} >>`:"",d=e(["<< /Type /Page",`/Parent ${n} 0 R`,`/MediaBox [0 0 ${LT(p.width)} ${LT(p.height)}]`,`/Resources << /Font << ${i} >>${o} >>`,`/Contents ${a} 0 R`,">>"].join("\n"));s.push(d)}t[a-1].body=`<< /Type /Catalog /Pages ${n} 0 R >>`,t[n-1].body=["<< /Type /Pages",`/Kids [${s.map(t=>`${t} 0 R`).join(" ")}]`,`/Count ${s.length}`,">>"].join("\n");let d="%PDF-1.4\n% Oasis PDF\n";const c=[0];for(const p of t)c[p.id]=zT(d),d+=`${p.id} 0 obj\n${p.body}\nendobj\n`;const h=zT(d);d+=`xref\n0 ${t.length+1}\n`,d+="0000000000 65535 f \n";for(const p of t)d+=`${String(c[p.id]??0).padStart(10,"0")} 00000 n \n`;return d+=["trailer",`<< /Size ${t.length+1} /Root ${a} 0 R >>`,"startxref",String(h),"%%EOF",""].join("\n"),(new TextEncoder).encode(d)}addImageObject(t,e){return e(function(t,e){const a=`${NT(t)}>`;return[`<< /Length ${zT(a)}`," /Filter [/ASCIIHexDecode /DCTDecode]",` ${e.join(" ")}`," >>","stream",a,"endstream"].join("\n")}(t.data,["/Type /XObject","/Subtype /Image",`/Width ${t.width}`,`/Height ${t.height}`,"/ColorSpace /DeviceRGB","/BitsPerComponent 8"]))}addUnicodeFontObjects(t,e){const a=t.font.subsetter.createSubset(t.font.program,t.usedGlyphs.values()),n=e(function(t,e=""){const a=`${NT(t)}>`,n=e?` /${e.trim().replace(/^\/+/,"")}`:"";return`<< /Length ${zT(a)} /Filter /ASCIIHexDecode${n} >>\nstream\n${a}\nendstream`}(a.fontFile)),r=t.font.program.metadata,o=r.familyClass>>8||0;let i=4;r.isFixedPitch&&(i|=1),o>=1&&o<=7&&(i|=2),10===o&&(i|=8),r.macStyleItalic&&(i|=64);const l=`${PT(`${t.resource.resourceName}AAAAAA`,"OASISF").slice(0,6).padEnd(6,"A")}+${PT(r.postscriptName,t.resource.family)}`,s=r.bbox,d=e(["<< /Type /FontDescriptor",`/FontName /${l}`,`/Flags ${i}`,`/FontBBox [${[s.minX*t.scale,s.minY*t.scale,s.maxX*t.scale,s.maxY*t.scale].map(LT).join(" ")}]`,`/ItalicAngle ${LT(r.italicAngle)}`,`/Ascent ${LT(r.ascent*t.scale)}`,`/Descent ${LT(r.descent*t.scale)}`,`/CapHeight ${LT(r.capHeight*t.scale)}`,`/XHeight ${LT(r.xHeight*t.scale)}`,"/StemV 0",`/FontFile2 ${n} 0 R`,">>"].join("\n")),c=e(["<< /Type /Font","/Subtype /CIDFontType2",`/BaseFont /${l}`,"/CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >>",`/FontDescriptor ${d} 0 R`,`/W [0 [${a.widths.map(t=>LT(t??0)).join(" ")}]]`,"/CIDToGIDMap /Identity",">>"].filter(Boolean).join("\n")),h=e(function(t,e=""){const a=e?` /${e.trim().replace(/^\/+/,"")}`:"";return`<< /Length ${zT(t)}${a} >>\nstream\n${t}endstream`}(function(t){const e=t.map(t=>`<${UT(t)}>`).filter(t=>"<>"!==t);0===e.length&&e.push("<0000>");const a=[];for(let n=0;n<e.length;n+=256){const t=Math.min(n+256,e.length);a.push(`<${qT(n)}> <${qT(t-1)}> [${e.slice(n,t).join(" ")}]`)}return["/CIDInit /ProcSet findresource begin","12 dict begin","begincmap","/CIDSystemInfo <<"," /Registry (Adobe)"," /Ordering (UCS)"," /Supplement 0",">> def","/CMapName /Adobe-Identity-UCS def","/CMapType 2 def","1 begincodespacerange","<0000><ffff>","endcodespacerange",`${a.length} beginbfrange`,a.join("\n"),"endbfrange","endcmap","CMapName currentdict /CMap defineresource pop","end","end",""].join("\n")}(a.unicode)));return e(["<< /Type /Font","/Subtype /Type0",`/BaseFont /${l}`,"/Encoding /Identity-H",`/DescendantFonts [${c} 0 R]`,`/ToUnicode ${h} 0 R`,">>"].join("\n"))}}async function ZT(t){t=hw(t);const e=new vT;await e.loadBundledUnicodeFaces({families:Hh(t)});const a=new GT(e.getPdfFontResources()),n=os(t),r=function(t){const e=new Map,a=Ke(t);let n=[],r=!1;for(const o of a){const t=o.list;if(!t||"ordered"!==t.kind){n=[],r=!1;continue}const a=t.level??0;for(r||(n=[]),n.length>a+1&&(n.length=a+1);n.length<=a;)n.push(0);n[a]=0===n[a]&&"number"==typeof t.startAt?t.startAt:n[a]+1,e.set(o.id,n[a]),r=!0}return e}(t);for(const o of n.pages){const n=Math.max(1,CM(o.pageSettings.width)),i=Math.max(1,CM(o.pageSettings.height)),l=a.addPage({width:n,height:i});uT(a,l,n,i);const s=o.pageSettings.margins.left+o.pageSettings.margins.gutter,d=ve(o.pageSettings);await pT(a,l,o.headerBlocks,t,s,o.headerTop??Me(o.pageSettings),d,e,r,o.pageSettings);const c=o.bodyTop??xe(o.pageSettings);if(o.blocks.some(t=>void 0!==t.columnIndex)){const n=be(o.pageSettings),i=new Map;for(const t of o.blocks){const e=t.columnIndex??0,a=i.get(e)??[];a.push(t),i.set(e,a)}for(const[s,d]of i){const i=n[s]??n[0];await pT(a,l,d,t,i.left,c,i.width,e,r,o.pageSettings)}}else await pT(a,l,o.blocks,t,s,c,d,e,r,o.pageSettings);await pT(a,l,o.footerBlocks,t,s,o.footerTop??o.bodyBottom??o.pageSettings.height,d,e,r,o.pageSettings),o.footnoteBlocks&&o.footnoteBlocks.length>0&&void 0!==o.footnoteTop&&(void 0!==o.footnoteSeparatorTop&&a.drawLine(l,{x1:CM(s),y1:CM(o.footnoteSeparatorTop+.5),x2:CM(s+Math.min(180,.35*d)),y2:CM(o.footnoteSeparatorTop+.5),stroke:"#64748b",lineWidth:CM(1)}),await KT(a,l,o.footnoteBlocks,o.footnoteReferenceIds??[],t,s,o.footnoteTop,d,e,r))}if(0===a.getPageCount()){const t=a.addPage({width:612,height:792});uT(a,t,612,792)}return a.toArrayBuffer()}async function KT(t,e,a,n,r,o,i,l,s,d){var c;let h=i;const p=new Set,u=new Map(n.map(t=>{var e;return[t,(null==(e=Xl(r,t))?void 0:e.run.text)??""]}));for(const f of a){const a=n.find(t=>f.blockId.startsWith(`${t}:`));if(a&&!p.has(a)){const n=u.get(a);if(n){const a="paragraph"===f.sourceBlock.type?f.sourceBlock:void 0,i=Ne(void 0,null==(c=null==a?void 0:a.style)?void 0:c.styleId,r.styles),l=s.resolveFontFace({fontFamily:i.fontFamily,bold:i.bold,italic:i.italic});t.drawText(e,{x:CM(o),y:CM(h+12),text:n,fontSize:kM(i),color:i.color??"#000000",bold:i.bold,italic:i.italic,fontResourceName:l.writerResourceName})}p.add(a)}await pT(t,e,[f],r,o+cn,h,Math.max(24,l-cn),s,d),h+=Math.max(0,f.estimatedHeight)+2}}function DT(t,e){const a=URL.createObjectURL(t),n=document.createElement("a");n.href=a,n.download=e,n.click(),URL.revokeObjectURL(a)}function jT(t){const e=t.download??DT;return{handleExportDocx:async()=>{const a=await async function(t){const e=await GI(t);return new Blob([e],{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"})}(t.document());e(a,"oasis-editor.docx"),t.focusInput()},handleExportPdf:async()=>{const a=await async function(t){const e=await ZT(t);return new Blob([e],{type:"application/pdf"})}(t.document());e(a,"oasis-editor.pdf"),t.focusInput()}}}async function XT(t){return"function"==typeof t.arrayBuffer?t.arrayBuffer():new Promise((e,a)=>{const n=new FileReader;n.onerror=()=>a(n.error??new Error("Failed to read file.")),n.onload=()=>{const t=n.result;t instanceof ArrayBuffer?e(t):a(new Error("Failed to read file as ArrayBuffer."))},n.readAsArrayBuffer(t)})}function JT(t){if(!t)return null;for(const e of Array.from(t.items??[])){if("file"!==e.kind)continue;const t=e.getAsFile();if(t&&t.type.startsWith("image/"))return t}for(const e of Array.from(t.files??[]))if(e.type.startsWith("image/"))return e;return null}function YT(t){return{handleImportFile:async e=>{if(!e)return;const a=function(t){return fy.find(e=>e.matches(t))}(e);if(!a)return t.setImportPhase("error"),t.logger.error("import:unsupported-format",{name:e.name,type:e.type}),void t.clearImportProgressSoon();const n=t.now();t.logger.info("import:start",{format:a.id,name:e.name,size:e.size}),t.setImportPhase("reading-file");try{const r=t.now(),o=await XT(e);t.logger.info("import:phase",{phase:"reading-file",durationMs:Math.round(100*(t.now()-r))/100});let i=null,l=-1,s=0;const d=await a.import(o,(e,a)=>{const n=t.now(),r=void 0!==a&&Number.isFinite(a)?Math.floor(100*a):void 0,o=e!==i;if(!o&&!(void 0!==r&&(l<0||r-l>=1))&&!(n-s>=40))return;i=e,l=r??l,s=n,t.setImportPhase(e,a);const d={phase:e,subProgress:a};o||void 0===a||1===a?t.logger.info("import:phase",d):t.logger.debug("import:phase",d)});t.logger.info("import:document-diagnostics",function(t){var e;const a=Ke(t),n=new Map,r=new Map;let o=0,i=0;for(const l of a){const a=qe(l.style,t.styles);r.set(a.align,(r.get(a.align)??0)+1);for(const r of l.runs){const a=Ne(r.styles,null==(e=l.style)?void 0:e.styleId,t.styles),s=a.fontFamily??"<null>";n.set(s,(n.get(s)??0)+1),null!==a.characterSpacing&&(o+=1),null!==a.characterScale&&(i+=1)}}return{paragraphCount:a.length,alignCounts:Array.from(r.entries()),fontCounts:Array.from(n.entries()),characterSpacingRuns:o,characterScaleRuns:i,firstParagraphs:a.slice(0,30).map((e,a)=>{var n;const r=qe(e.style,t.styles),o=e.runs[0],i=Ne(null==o?void 0:o.styles,null==(n=e.style)?void 0:n.styleId,t.styles);return{index:a,text:Se(e).slice(0,160),runCount:e.runs.length,rawParagraphStyle:e.style,align:r.align,indentFirstLine:r.indentFirstLine,lineGridPitch:r.lineGridPitch,lineGridType:r.lineGridType,fontFamily:i.fontFamily,fontSize:i.fontSize,characterSpacing:i.characterSpacing,characterScale:i.characterScale,firstRunStyle:null==o?void 0:o.styles}})}}(d)),t.setImportPhase("applying-editor-state"),t.resetEditorChromeState(),t.applyState(Ca(d));const c=t.now();t.setImportPhase("stabilizing-layout"),await t.stabilizeLayoutAfterImport(),t.logger.info("import:phase",{phase:"stabilizing-layout",durationMs:Math.round(100*(t.now()-c))/100});const h=Pe(d).reduce((t,e)=>{var a,n;return t+((null==(a=e.header)?void 0:a.length)??0)+e.blocks.length+((null==(n=e.footer)?void 0:n.length)??0)},0),p=Ze(d).length;t.setImportPhase("done"),t.logger.info("import:done",{format:a.id,blocks:h,paragraphs:p,durationMs:Math.round(100*(t.now()-n))/100}),t.focusInput()}catch(r){t.setImportPhase("error"),t.logger.error("import:error",r)}finally{t.clearImportProgressSoon()}}}}function QT(t){return{insertImageFromFile:async(e,a)=>{t.logger.info(`image insert:start name="${e.name}" type=${e.type} size=${e.size}`);const n=await XT(e),r=`data:${e.type};base64,${function(t){return btoa(new Uint8Array(t).reduce((t,e)=>t+String.fromCharCode(e),""))}(n)}`,o=new Image;o.src=r,await new Promise(t=>{o.onload=t,o.onerror=t});const i=o.naturalWidth||300,l=o.naturalHeight||300,s=t.state(),d=(null==a?void 0:a.paragraphId)??s.selection.focus.paragraphId,c=kA(t.surfaceRef(),s.document,d,s.activeSectionIndex??0),h=i>c?c/i:1,p=Math.max(24,Math.round(i*h)),u=Math.max(24,Math.round(l*h));t.logger.info(`image insert:decoded natural=${i}x${l} fitted=${p}x${u} maxWidth=${c}`),t.applyTransactionalState(t=>function(t,e){const a=na(t.selection)?t:Rw(t),{paragraph:n,index:r,offset:o}=Ew(a),i=ww(n,o,[va("",yw(n,o),e)]);return Cw(a,_e(a).map((t,e)=>e===r?i:ew(t)),Vw(Ie(i,o+1)))}(a?CS(t,{anchor:a,focus:a}):t,{src:r,width:p,height:u}),{mergeKey:"insertImage"})}}}const _T={"reading-file":[0,8],opening:[8,20],parsing:[20,72],finishing:[72,78],"applying-editor-state":[78,88],"stabilizing-layout":[88,98],done:[100,100],error:[100,100]};function $T(t){const[e,a]=y(void 0),n=()=>{a(void 0)};x(()=>{na(t.state().selection)||n()});const r=()=>{const a=up(t.state()),n=e();return na(t.state().selection)&&n?{...a,bold:n.bold??a.bold,italic:n.italic??a.italic,underline:n.underline??a.underline,underlineStyle:void 0!==n.underlineStyle&&null!==n.underlineStyle?String(n.underlineStyle):a.underlineStyle,strike:n.strike??a.strike,superscript:n.superscript??a.superscript,subscript:n.subscript??a.subscript,fontFamily:n.fontFamily??a.fontFamily,fontSize:void 0!==n.fontSize&&null!==n.fontSize?String(n.fontSize):a.fontSize,color:n.color??a.color,highlight:n.highlight??a.highlight,textShading:n.shading??a.textShading,link:n.link??a.link}:a};return{pendingCaretTextStyle:e,clearPendingCaretTextStyle:n,toolbarStyleState:r,applyToolbarValueStyleCommand:(e,n)=>{if(na(t.state().selection))return t.logger.info(`setPendingStyle:${e}=${JSON.stringify(n)}`),t.clearPreferredColumn(),t.resetTransactionGrouping(),((t,e)=>{a(a=>{const n={...a??{}};return null==e||""===e?delete n[t]:n[t]=e,Object.keys(n).length>0?n:void 0})})(e,n),void t.focusInput();t.commandsController().applyValueStyleCommand(e,n)},applyToolbarBooleanStyleCommand:e=>{if(na(t.state().selection)){const n=!r()[e];return t.logger.info(`setPendingStyle:${e}=${JSON.stringify(n)}`),t.clearPreferredColumn(),t.resetTransactionGrouping(),((t,e)=>{a(a=>{const n={...a??{}};return n[t]=e,"superscript"===t&&e&&(n.subscript=!1),"subscript"===t&&e&&(n.superscript=!1),n})})(e,n),void t.focusInput()}t.commandsController().applyBooleanStyleCommand(e)}}}function tC(t){return{performUndo:()=>{const e=(a=t.getHistoryState(),n=t.stateSnapshot(),0===a.undoStack.length?null:{history:{undoStack:a.undoStack.slice(0,-1),redoStack:[...a.redoStack,n],lastTransactionMeta:null},nextState:a.undoStack[a.undoStack.length-1]});var a,n;e&&(t.updateHistoryState(()=>e.history),t.clearPreferredColumn(),t.applyHistoryState(e.nextState),t.focusInput())},performRedo:()=>{const e=(a=t.getHistoryState(),n=t.stateSnapshot(),0===a.redoStack.length?null:{history:{undoStack:[...a.undoStack,n],redoStack:a.redoStack.slice(0,-1),lastTransactionMeta:null},nextState:a.redoStack[a.redoStack.length-1]});var a,n;e&&(t.updateHistoryState(()=>e.history),t.clearPreferredColumn(),t.applyHistoryState(e.nextState),t.focusInput())},moveSelectedImageByParagraph:e=>{const a=t.imageOps().getSelectedImageInfo(t.state());if(!a)return!1;const n=_e(t.state()),r=n.findIndex(t=>t.id===a.paragraph.id);if(r<0)return!1;const o=r+e;if(o<0||o>=n.length){const a=((t,e)=>{const a=Pe(t.document),n=Math.max(0,Math.min(Je(t),a.length-1)),r=Ye(t),o=a[n];if(!o)return t;const i=[...a],l={...o},s=ba("");if("header"===r){const t=[...o.header??[]];e<0?t.unshift(s):t.push(s),l.header=t}else if("footer"===r){const t=[...o.footer??[]];e<0?t.unshift(s):t.push(s),l.footer=t}else{const t=[...o.blocks];e<0?t.unshift(s):t.push(s),l.blocks=t}return i[n]=l,{...t,document:{...t.document,sections:i}}})(t.state(),e),n=_e(a),r=e<0?n[0]:n[n.length-1];if(!r)return!1;const o=Ie(r,e<0?Ae(r):0);return t.applyTransactionalState(()=>Uw(a,o),{mergeKey:"moveImage"}),t.focusInput(),!0}const i=n[o],l=e<0?Ae(i):0;return t.applyTransactionalState(t=>Uw(t,Ie(i,l)),{mergeKey:"moveImage"}),t.focusInput(),!0},applySelectionPreservingStructure:e=>{var a;const n=t.stateSnapshot();t.applyHistoryState({...n,document:{...n.document,sections:null==(a=n.document.sections)?void 0:a.map(QS)},selection:{anchor:{...e.anchor},focus:{...e.focus}}})}}}
|
|
13
13
|
/**
|
|
14
14
|
* @license lucide v1.11.0 - ISC
|
|
15
15
|
*
|