oasis-editor 0.0.52 → 0.0.53

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.
@@ -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
- */Hp.exports=function t(e,a,n){function r(i,l){if(!a[i]){if(!e[i]){if(!l&&Wp)return Wp(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=Wp,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!==Cn?Cn:"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!==Cn?Cn:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10);const Up=kn(Hp.exports);var Fp={};function Bp(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 Gp(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Zp=Bp({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 Kp=Bp({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 Dp=Bp({script:!1,style:!1,textarea:!0,title:!0});function jp(t){return t===Xp.HTML}var Xp=Bp({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Jp=Object.keys(Xp).map(function(t){return Xp[t]});var Yp=Bp({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/"});Fp.assign=function(t,e){if(null===t||"object"!=typeof t)throw new TypeError("target is not an object");for(var a in e)Gp(e,a)&&(t[a]=e[a]);return t},Fp.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(Gp(t,n)){var r=t[n];if(e.call(void 0,r,n,t))return r}},Fp.freeze=Bp,Fp.HTML_BOOLEAN_ATTRIBUTES=Zp,Fp.HTML_RAW_TEXT_ELEMENTS=Dp,Fp.HTML_VOID_ELEMENTS=Kp,Fp.hasDefaultHTMLNamespace=function(t){return jp(t)||t===Xp.XML_XHTML_APPLICATION},Fp.hasOwn=Gp,Fp.isHTMLBooleanAttribute=function(t){return Gp(Zp,t.toLowerCase())},Fp.isHTMLRawTextElement=function(t){var e=t.toLowerCase();return Gp(Dp,e)&&!Dp[e]},Fp.isHTMLEscapableRawTextElement=function(t){var e=t.toLowerCase();return Gp(Dp,e)&&Dp[e]},Fp.isHTMLMimeType=jp,Fp.isHTMLVoidElement=function(t){return Gp(Kp,t.toLowerCase())},Fp.isValidMimeType=function(t){return Jp.indexOf(t)>-1},Fp.MIME_TYPE=Xp,Fp.NAMESPACE=Yp;var Qp={};function _p(t,e){t.prototype=Object.create(Error.prototype,{constructor:{value:t},name:{value:t.name,enumerable:!0,writable:e}})}var $p=Fp.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"}),tu=Object.keys($p);function eu(t){return"number"==typeof t&&t>=1&&t<=25}function au(t,e){var a;eu(t)?(this.name=tu[t],this.message=e||""):(this.message=t,this.name="string"==typeof(a=e)&&a.substring(a.length-$p.Error.length)===$p.Error?e:$p.Error),Error.captureStackTrace&&Error.captureStackTrace(this,au)}_p(au,!0),Object.defineProperties(au.prototype,{code:{enumerable:!0,get:function(){var t=tu.indexOf(this.name);return eu(t)?t:0}}});for(var nu={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},ru=Object.entries(nu),ou=0;ou<ru.length;ou++){au[ru[ou][0]]=ru[ou][1]}function iu(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,iu)}_p(iu),Qp.DOMException=au,Qp.DOMExceptionName=$p,Qp.ExceptionCode=nu,Qp.ParseError=iu;var lu={},su={};function du(t){try{"function"!=typeof t&&(t=RegExp);var e=new t("𝌆","u").exec("𝌆");return!!e&&2===e[0].length}catch(a){}return!1}var cu=du();function hu(t){if("["!==t.source[0])throw new Error(t+" can not be used with chars");return t.source.slice(1,t.source.lastIndexOf("]"))}function pu(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,""),cu?"u":"")}function uu(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(""),cu?"mu":"m")}function fu(t){if(0===arguments.length)throw new Error("no parameters provided");return uu.apply(fu,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var gu=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;cu&&(gu=uu("[",hu(gu),"\\u{10000}-\\u{10FFFF}","]"));var mu=new RegExp("[^"+hu(gu)+"]",cu?"u":""),vu=/[\x20\x09\x0D\x0A]/,bu=hu(vu),yu=uu(vu,"+"),Mu=uu(vu,"*"),xu=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;cu&&(xu=uu("[",hu(xu),"\\u{10000}-\\u{10FFFF}","]"));var wu=uu("[",hu(xu),hu(/[-.0-9\xB7]/),hu(/[\u0300-\u036F\u203F-\u2040]/),"]"),Su=uu(xu,wu,"*"),Au=uu(wu,"+"),Iu=uu("&",Su,";"),Tu=fu(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),Cu=fu(Iu,"|",Tu),ku=uu("%",Su,";"),Vu=fu(uu('"',fu(/[^%&"]/,"|",ku,"|",Cu),"*",'"'),"|",uu("'",fu(/[^%&']/,"|",ku,"|",Cu),"*","'")),Eu=fu('"',fu(/[^<&"]/,"|",Cu),"*",'"',"|","'",fu(/[^<&']/,"|",Cu),"*","'"),Ru=uu(pu(xu,":"),pu(wu,":"),"*"),Lu=uu(Ru,fu(":",Ru),"?"),zu=uu("^",Lu,"$"),Nu=uu("(",Lu,")"),qu=fu(/"[^"]*"|'[^']*'/),Ou=uu(/^<\?/,"(",Su,")",fu(yu,"(",gu,"*?)"),"?",/\?>/),Pu=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,Wu=fu('"',Pu,'*"',"|","'",pu(Pu,"'"),"*'"),Hu="\x3c!--",Uu=uu(Hu,fu(pu(gu,"-"),"|",uu("-",pu(gu,"-"))),"*","--\x3e"),Fu="#PCDATA",Bu=fu(uu(/\(/,Mu,Fu,fu(Mu,/\|/,Mu,Lu),"*",Mu,/\)\*/),"|",uu(/\(/,Mu,Fu,Mu,/\)/)),Gu=fu("EMPTY","|","ANY","|",Bu,"|",uu(/\([^>]+\)/,/[?*+]?/)),Zu=uu("<!ELEMENT",yu,fu(Lu,"|",ku),yu,fu(Gu,"|",ku),Mu,">"),Ku=uu("NOTATION",yu,/\(/,Mu,Su,fu(Mu,/\|/,Mu,Su),"*",Mu,/\)/),Du=uu(/\(/,Mu,Au,fu(Mu,/\|/,Mu,Au),"*",Mu,/\)/),ju=fu(Ku,"|",Du),Xu=fu(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",ju),Ju=fu(/#REQUIRED|#IMPLIED/,"|",fu(fu("#FIXED",yu),"?",Eu)),Yu=uu("<!ATTLIST",yu,Su,fu(yu,Su,yu,Xu,yu,Ju),"*",Mu,">"),Qu="about:legacy-compat",_u=fu('"'+Qu+'"',"|","'"+Qu+"'"),$u="SYSTEM",tf="PUBLIC",ef=fu(fu($u,yu,qu),"|",fu(tf,yu,Wu,yu,qu)),af=uu("^",fu(fu($u,yu,"(?<SystemLiteralOnly>",qu,")"),"|",fu(tf,yu,"(?<PubidLiteral>",Wu,")",yu,"(?<SystemLiteral>",qu,")"))),nf=uu("^",Wu,"$"),rf=uu("^",qu,"$"),of=fu(yu,"NDATA",yu,Su),lf="<!ENTITY",sf=uu(lf,yu,Su,yu,fu(Vu,"|",fu(ef,of,"?")),Mu,">"),df=fu(Vu,"|",ef),cf=fu(sf,"|",uu(lf,yu,"%",yu,Su,yu,df,Mu,">")),hf=uu(tf,yu,Wu),pf=uu("<!NOTATION",yu,Su,yu,fu(ef,"|",hf),Mu,">"),uf=uu(Mu,"=",Mu),ff=/1[.]\d+/,gf=uu(yu,"version",uf,fu("'",ff,"'","|",'"',ff,'"')),mf=/[A-Za-z][-A-Za-z0-9._]*/,vf=uu(/^<\?xml/,gf,fu(yu,"encoding",uf,fu('"',mf,'"',"|","'",mf,"'")),"?",fu(yu,"standalone",uf,fu("'",fu("yes","|","no"),"'","|",'"',fu("yes","|","no"),'"')),"?",Mu,/\?>/),bf=uu(gu,"*?",/\]\]>/),yf=uu(/<!\[CDATA\[/,bf);su.chars=hu,su.chars_without=pu,su.detectUnicodeSupport=du,su.reg=uu,su.regg=fu,su.ABOUT_LEGACY_COMPAT=Qu,su.ABOUT_LEGACY_COMPAT_SystemLiteral=_u,su.AttlistDecl=Yu,su.CDATA_START="<![CDATA[",su.CDATA_END="]]>",su.CDSect=yf,su.Char=gu,su.Comment=Uu,su.COMMENT_START=Hu,su.COMMENT_END="--\x3e",su.DOCTYPE_DECL_START="<!DOCTYPE",su.elementdecl=Zu,su.EntityDecl=cf,su.EntityValue=Vu,su.ExternalID=ef,su.ExternalID_match=af,su.Name=Su,su.NotationDecl=pf,su.Reference=Cu,su.PEReference=ku,su.PI=Ou,su.PUBLIC=tf,su.PubidLiteral=Wu,su.PubidLiteral_match=nf,su.QName=Lu,su.QName_exact=zu,su.QName_group=Nu,su.S=yu,su.SChar_s=bu,su.S_OPT=Mu,su.SYSTEM=$u,su.SystemLiteral=qu,su.SystemLiteral_match=rf,su.InvalidChar=mu,su.UNICODE_REPLACEMENT_CHARACTER="�",su.UNICODE_SUPPORT=cu,su.XMLDecl=vf;var Mf=Fp,xf=Mf.find,wf=Mf.hasDefaultHTMLNamespace,Sf=Mf.hasOwn,Af=Mf.isHTMLMimeType,If=Mf.isHTMLRawTextElement,Tf=Mf.isHTMLVoidElement,Cf=Mf.MIME_TYPE,kf=Mf.NAMESPACE,Vf=Symbol(),Ef=Qp,Rf=Ef.DOMException,Lf=Ef.DOMExceptionName,zf=su;function Nf(t){if(t!==Vf)throw new TypeError("Illegal constructor")}function qf(t){return""!==t}function Of(t,e){return Sf(t,e)||(t[e]=!0),t}function Pf(t){if(!t)return[];var e=function(t){return t?t.split(/[\t\n\f\r ]+/).filter(qf):[]}(t);return Object.keys(e.reduce(Of,{}))}function Wf(t){if(!zf.QName_exact.test(t))throw new Rf(Rf.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+t+'"')}function Hf(t,e){Wf(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 Rf(Rf.NAMESPACE_ERR,"prefix is non-null and namespace is null");if("xml"===a&&t!==Mf.NAMESPACE.XML)throw new Rf(Rf.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if(("xmlns"===a||"xmlns"===e)&&t!==Mf.NAMESPACE.XMLNS)throw new Rf(Rf.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(t===Mf.NAMESPACE.XMLNS&&"xmlns"!==a&&"xmlns"!==e)throw new Rf(Rf.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[t,a,n]}function Uf(t,e){for(var a in t)Sf(t,a)&&(e[a]=t[a])}function Ff(t,e){var a=t.prototype;if(!(a instanceof e)){let n=function(){};n.prototype=e.prototype,n=new n,Uf(a,n),t.prototype=a=n}a.constructor!=t&&("function"!=typeof t&&console.error("unknown Class:"+t),a.constructor=t)}var Bf={},Gf=Bf.ELEMENT_NODE=1,Zf=Bf.ATTRIBUTE_NODE=2,Kf=Bf.TEXT_NODE=3,Df=Bf.CDATA_SECTION_NODE=4,jf=Bf.ENTITY_REFERENCE_NODE=5,Xf=Bf.ENTITY_NODE=6,Jf=Bf.PROCESSING_INSTRUCTION_NODE=7,Yf=Bf.COMMENT_NODE=8,Qf=Bf.DOCUMENT_NODE=9,_f=Bf.DOCUMENT_TYPE_NODE=10,$f=Bf.DOCUMENT_FRAGMENT_NODE=11,tg=Bf.NOTATION_NODE=12,eg=Mf.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 ag(t,e){if(e.length<t.length)return ag(e,t);var a=null;for(var n in t){if(t[n]!==e[n])return a;a=t[n]}return a}function ng(t){return t.guid||(t.guid=Math.random()),t.guid}function rg(){}function og(t,e){this._node=t,this._refresh=e,ig(this)}function ig(t){var e=t._node._inc||t._node.ownerDocument._inc;if(t._inc!==e){var a=t._refresh(t._node);if(jg(t,"length",a.length),!t.$$length||a.length<t.$$length)for(var n=a.length;n in t;n++)Sf(t,n)&&delete t[n];Uf(a,t),t._inc=e}}function lg(){}function sg(t,e){for(var a=0;a<t.length;){if(t[a]===e)return a;a++}}function dg(t,e,a,n){if(n?e[sg(e,n)]=a:(e[e.length]=a,e.length++),t){a.ownerElement=t;var r=t.ownerDocument;r&&(n&&vg(r,t,n),function(t,e,a){t&&t._inc++;var n=a.namespaceURI;n===kf.XMLNS&&(e._nsMap[a.prefix?a.localName:""]=a.value)}(r,t,a))}}function cg(t,e,a){var n=sg(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&&vg(o,t,a),a.ownerElement=null}}}function hg(){}function pg(t){Nf(t)}function ug(t){return("<"==t?"&lt;":">"==t&&"&gt;")||"&"==t&&"&amp;"||'"'==t&&"&quot;"||"&#"+t.charCodeAt()+";"}function fg(t,e){gg(t,null,{enter:function(t){return!e(t)||gg.STOP}})}function gg(t,e,a){for(var n=[{node:t,context:e,phase:gg.ENTER}];n.length>0;){var r=n.pop();if(r.phase===gg.ENTER){var o=a.enter(r.node,r.context);if(o===gg.STOP)return gg.STOP;if(n.push({node:r.node,context:o,phase:gg.EXIT}),null==o)continue;for(var i=r.node.lastChild;i;)n.push({node:i,context:o,phase:gg.ENTER}),i=i.previousSibling}else a.exit&&a.exit(r.node,r.context)}}function mg(t,e){Nf(t);var a=e||{};this.ownerDocument=this,this.contentType=a.contentType||Cf.XML_APPLICATION,this.type=Af(this.contentType)?"html":"xml"}function vg(t,e,a,n){t&&t._inc++,a.namespaceURI===kf.XMLNS&&delete e._nsMap[a.prefix?a.localName:""]}function bg(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 yg(t,e){if(t!==e.parentNode)throw new Rf(Rf.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,bg(t.ownerDocument,t),e.parentNode=null,e.previousSibling=null,e.nextSibling=null,e}function Mg(t){return t&&t.nodeType===pg.DOCUMENT_TYPE_NODE}function xg(t){return t&&t.nodeType===pg.ELEMENT_NODE}function wg(t){return t&&t.nodeType===pg.TEXT_NODE}function Sg(t,e){var a=t.childNodes||[];if(xf(a,xg)||Mg(e))return!1;var n=xf(a,Mg);return!(e&&n&&a.indexOf(n)>a.indexOf(e))}function Ag(t,e){var a=t.childNodes||[];if(xf(a,function(t){return xg(t)&&t!==e}))return!1;var n=xf(a,Mg);return!(e&&n&&a.indexOf(n)>a.indexOf(e))}function Ig(t,e,a){if(!function(t){return t&&(t.nodeType===pg.DOCUMENT_NODE||t.nodeType===pg.DOCUMENT_FRAGMENT_NODE||t.nodeType===pg.ELEMENT_NODE)}(t))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+t.nodeType);if(a&&a.parentNode!==t)throw new Rf(Rf.NOT_FOUND_ERR,"child not in parent");if(!function(t){return t&&(t.nodeType===pg.CDATA_SECTION_NODE||t.nodeType===pg.COMMENT_NODE||t.nodeType===pg.DOCUMENT_FRAGMENT_NODE||t.nodeType===pg.DOCUMENT_TYPE_NODE||t.nodeType===pg.ELEMENT_NODE||t.nodeType===pg.PROCESSING_INSTRUCTION_NODE||t.nodeType===pg.TEXT_NODE)}(e)||Mg(e)&&t.nodeType!==pg.DOCUMENT_NODE)throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function Tg(t,e,a){var n=t.childNodes||[],r=e.childNodes||[];if(e.nodeType===pg.DOCUMENT_FRAGMENT_NODE){var o=r.filter(xg);if(o.length>1||xf(r,wg))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(1===o.length&&!Sg(t,a))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(xg(e)&&!Sg(t,a))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Mg(e)){if(xf(n,Mg))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var i=xf(n,xg);if(a&&n.indexOf(i)<n.indexOf(a))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!a&&i)throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}function Cg(t,e,a){var n=t.childNodes||[],r=e.childNodes||[];if(e.nodeType===pg.DOCUMENT_FRAGMENT_NODE){var o=r.filter(xg);if(o.length>1||xf(r,wg))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(1===o.length&&!Ag(t,a))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(xg(e)&&!Ag(t,a))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Mg(e)){if(xf(n,function(t){return Mg(t)&&t!==a}))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var i=xf(n,xg);if(a&&n.indexOf(i)<n.indexOf(a))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}function kg(t,e,a,n){Ig(t,e,a),t.nodeType===pg.DOCUMENT_NODE&&(n||Tg)(t,e,a);var r=e.parentNode;if(r&&r.removeChild(e),e.nodeType===$f){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 bg(t.ownerDocument||t,t,e),e.nodeType==$f&&(e.firstChild=e.lastChild=null),e}function Vg(t){Nf(t),this._nsMap=Object.create(null)}function Eg(t){Nf(t),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}function Rg(t){Nf(t)}function Lg(t){Nf(t)}function zg(t){Nf(t)}function Ng(t){Nf(t)}function qg(t){Nf(t)}function Og(t){Nf(t)}function Pg(t){Nf(t)}function Wg(t){Nf(t)}function Hg(t){Nf(t)}function Ug(t){Nf(t)}function Fg(){}function Bg(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===Qf&&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 Kg(this,a,i,e),a.join("")}function Gg(t,e,a){var n=t.prefix||"",r=t.namespaceURI;if(!r)return!1;if("xml"===n&&r===kf.XML||r===kf.XMLNS)return!1;for(var o=a.length;o--;){var i=a[o];if(i.prefix===n)return i.namespace!==r}return!0}function Zg(t,e,a){t.push(" ",e,'="',a.replace(/[<>&"\t\n\r]/g,ug),'"')}function Kg(t,e,a,n){a||(a=[]);var r=n.nodeFilter,o=n.requireWellFormed,i=n.splitCDATASections,l="html"===(t.nodeType===Qf?t:t.ownerDocument).type;gg(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 Gf: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(Gg(y=d.item(b),0,v)){var M=y.prefix||"",x=y.namespaceURI;Zg(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):Zg(e,w.name,w.value))}if(h===p&&Gg(t,0,v)){var S=t.prefix||"";x=t.namespaceURI;Zg(e,S?"xmlns:"+S:"xmlns",x),v.push({prefix:S,namespace:x})}var A=!t.firstChild;if(A&&(l||t.namespaceURI===kf.HTML)&&(A=Tf(h)),A)return e.push("/>"),null;if(e.push(">"),l&&If(h)){for(var I=t.firstChild;I;)I.data?e.push(I.data):Kg(I,e,v.slice(),n),I=I.nextSibling;return e.push("</",p,">"),null}return{ns:v,tag:p};case Qf:case $f:if(o&&t.nodeType===Qf&&null==t.documentElement)throw new Rf("The Document has no documentElement",Lf.InvalidStateError);return{ns:s};case Zf:return Zg(e,t.name,t.value),null;case Kf:if(o&&zf.InvalidChar.test(t.data))throw new Rf("The Text node data contains characters outside the XML Char production",Lf.InvalidStateError);return e.push(t.data.replace(/[<&>]/g,ug)),null;case Df:if(o&&-1!==t.data.indexOf("]]>"))throw new Rf('The CDATASection data contains "]]>"',Lf.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 Yf:if(o){if(zf.InvalidChar.test(t.data))throw new Rf("The comment node data contains characters outside the XML Char production",Lf.InvalidStateError);if(-1!==t.data.indexOf("--")||"-"===t.data[t.data.length-1])throw new Rf('The comment node data contains "--" or ends with "-"',Lf.InvalidStateError)}return e.push(zf.COMMENT_START,t.data,zf.COMMENT_END),null;case _f:var T=t.publicId,C=t.systemId;if(o){if(T&&!zf.PubidLiteral_match.test(T))throw new Rf("DocumentType publicId is not a valid PubidLiteral",Lf.InvalidStateError);if(C&&"."!==C&&!zf.SystemLiteral_match.test(C))throw new Rf("DocumentType systemId is not a valid SystemLiteral",Lf.InvalidStateError);if(t.internalSubset&&-1!==t.internalSubset.indexOf("]>"))throw new Rf('DocumentType internalSubset contains "]>"',Lf.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 Jf:if(o){if(-1!==t.target.indexOf(":")||"xml"===t.target.toLowerCase())throw new Rf("The ProcessingInstruction target is not well-formed",Lf.InvalidStateError);if(zf.InvalidChar.test(t.data))throw new Rf("The ProcessingInstruction data contains characters outside the XML Char production",Lf.InvalidStateError);if(-1!==t.data.indexOf("?>"))throw new Rf('The ProcessingInstruction data contains "?>"',Lf.InvalidStateError)}return e.push("<?",t.target," ",t.data,"?>"),null;case jf: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 Dg(t,e,a){var n;return gg(e,null,{enter:function(e,r){var o=new e.constructor(Vf);for(var i in e)if(Sf(e,i)){var l=e[i];"object"!=typeof l&&l!=o[i]&&(o[i]=l)}e.childNodes&&(o.childNodes=new rg),o.ownerDocument=t;var s=a;switch(o.nodeType){case Gf:var d=e.attributes,c=o.attributes=new lg,h=d.length;c._ownerElement=o;for(var p=0;p<h;p++)o.setAttributeNode(Dg(t,d.item(p),!0));break;case Zf:s=!0}return null!==r?r.appendChild(o):n=o,s?o:null}}),n}function jg(t,e,a){t[e]=a}function Xg(t){for(var e=[],a=t.firstChild;a;)a.nodeType===Gf&&e.push(a),a=a.nextSibling;return e}rg.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++)Kg(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)}},rg.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}}}},og.prototype.item=function(t){return ig(this),this[t]||null},Ff(og,rg),lg.prototype={length:0,item:rg.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 Rf(Rf.INUSE_ATTRIBUTE_ERR);var a=this.getNamedItemNS(t.namespaceURI,t.localName);return a===t?t:(dg(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 Rf(Rf.NOT_FOUND_ERR,t);return cg(this._ownerElement,this,e),e},removeNamedItemNS:function(t,e){var a=this.getNamedItemNS(t,e);if(!a)throw new Rf(Rf.NOT_FOUND_ERR,t?t+" : "+e:e);return cg(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}},lg.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}}}},hg.prototype={hasFeature:function(t,e){return!0},createDocument:function(t,e,a){var n=Cf.XML_APPLICATION;t===kf.HTML?n=Cf.XML_XHTML_APPLICATION:t===kf.SVG&&(n=Cf.XML_SVG_IMAGE);var r=new mg(Vf,{contentType:n});if(r.implementation=this,r.childNodes=new rg,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){Wf(t);var r=new qg(Vf);return r.name=t,r.nodeName=t,r.publicId=e||"",r.systemId=a||"",r.internalSubset=n||"",r.childNodes=new rg,r},createHTMLDocument:function(t){var e=new mg(Vf,{contentType:Cf.HTML});if(e.implementation=this,e.childNodes=new rg,!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}},pg.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 kg(this,t,e)},replaceChild:function(t,e){kg(this,t,e,Cg),e&&this.removeChild(e)},removeChild:function(t){return yg(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(t){return Dg(this.ownerDocument||this,this,t)},normalize:function(){gg(this,null,{enter:function(t){for(var e=t.firstChild;e;){var a=e.nextSibling;null!==a&&a.nodeType===Kf&&e.nodeType===Kf?(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(Sf(a,n)&&a[n]===t)return n;e=e.nodeType==Zf?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var a=e._nsMap;if(a&&Sf(a,t))return a[t];e=e.nodeType==Zf?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 Eg&&(e=(n=e).ownerElement),a instanceof Eg&&(a=(r=a).ownerElement,n&&e&&a===e))for(var o,i=0;o=a.attributes[i];i++){if(o===n)return eg.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+eg.DOCUMENT_POSITION_PRECEDING;if(o===r)return eg.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+eg.DOCUMENT_POSITION_FOLLOWING}if(!e||!a||a.ownerDocument!==e.ownerDocument)return eg.DOCUMENT_POSITION_DISCONNECTED+eg.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(ng(a.ownerDocument)>ng(e.ownerDocument)?eg.DOCUMENT_POSITION_FOLLOWING:eg.DOCUMENT_POSITION_PRECEDING);if(r&&e===a)return eg.DOCUMENT_POSITION_CONTAINS+eg.DOCUMENT_POSITION_PRECEDING;if(n&&e===a)return eg.DOCUMENT_POSITION_CONTAINED_BY+eg.DOCUMENT_POSITION_FOLLOWING;for(var l=[],s=e.parentNode;s;){if(!r&&s===a)return eg.DOCUMENT_POSITION_CONTAINED_BY+eg.DOCUMENT_POSITION_FOLLOWING;l.push(s),s=s.parentNode}l.reverse();for(var d=[],c=a.parentNode;c;){if(!n&&c===e)return eg.DOCUMENT_POSITION_CONTAINS+eg.DOCUMENT_POSITION_PRECEDING;d.push(c),c=c.parentNode}d.reverse();var h=ag(l,d);for(var p in h.childNodes){var u=h.childNodes[p];if(u===a)return eg.DOCUMENT_POSITION_FOLLOWING;if(u===e)return eg.DOCUMENT_POSITION_PRECEDING;if(d.indexOf(u)>=0)return eg.DOCUMENT_POSITION_FOLLOWING;if(l.indexOf(u)>=0)return eg.DOCUMENT_POSITION_PRECEDING}return 0}},Uf(Bf,pg),Uf(Bf,pg.prototype),Uf(eg,pg),Uf(eg,pg.prototype),gg.STOP=Symbol("walkDOM.STOP"),gg.ENTER=0,gg.EXIT=1,mg.prototype={implementation:null,nodeName:"#document",nodeType:Qf,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType===$f){for(var a=t.firstChild;a;){var n=a.nextSibling;this.insertBefore(a,e),a=n}return t}return kg(this,t,e),t.ownerDocument=this,null===this.documentElement&&t.nodeType===Gf&&(this.documentElement=t),t},removeChild:function(t){var e=yg(this,t);return e===this.documentElement&&(this.documentElement=null),e},replaceChild:function(t,e){kg(this,t,e,Cg),t.ownerDocument=this,e&&this.removeChild(e),xg(t)&&(this.documentElement=t)},importNode:function(t,e){return function(t,e,a){var n;return gg(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===Zf||a?o:null}}),n}(this,t,e)},getElementById:function(t){var e=null;return fg(this.documentElement,function(a){if(a.nodeType==Gf&&a.getAttribute("id")==t)return e=a,!0}),e},createElement:function(t){var e=new Vg(Vf);return e.ownerDocument=this,"html"===this.type&&(t=t.toLowerCase()),wf(this.contentType)&&(e.namespaceURI=kf.HTML),e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new rg,(e.attributes=new lg)._ownerElement=e,e},createDocumentFragment:function(){var t=new Hg(Vf);return t.ownerDocument=this,t.childNodes=new rg,t},createTextNode:function(t){var e=new Lg(Vf);return e.ownerDocument=this,e.childNodes=new rg,e.appendData(t),e},createComment:function(t){var e=new zg(Vf);return e.ownerDocument=this,e.childNodes=new rg,e.appendData(t),e},createCDATASection:function(t){if(-1!==t.indexOf("]]>"))throw new Rf(Rf.INVALID_CHARACTER_ERR,'data contains "]]>"');var e=new Ng(Vf);return e.ownerDocument=this,e.childNodes=new rg,e.appendData(t),e},createProcessingInstruction:function(t,e){var a=new Ug(Vf);return a.ownerDocument=this,a.childNodes=new rg,a.nodeName=a.target=t,a.nodeValue=a.data=e,a},createAttribute:function(t){if(!zf.QName_exact.test(t))throw new Rf(Rf.INVALID_CHARACTER_ERR,'invalid character in name "'+t+'"');return"html"===this.type&&(t=t.toLowerCase()),this._createAttribute(t)},_createAttribute:function(t){var e=new Eg(Vf);return e.ownerDocument=this,e.childNodes=new rg,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){if(!zf.Name.test(t))throw new Rf(Rf.INVALID_CHARACTER_ERR,'not a valid xml name "'+t+'"');if("html"===this.type)throw new Rf("document is an html document",Lf.NotSupportedError);var e=new Wg(Vf);return e.ownerDocument=this,e.childNodes=new rg,e.nodeName=t,e},createElementNS:function(t,e){var a=Hf(t,e),n=new Vg(Vf),r=n.attributes=new lg;return n.childNodes=new rg,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=Hf(t,e),n=new Eg(Vf);return n.ownerDocument=this,n.childNodes=new rg,n.nodeName=e,n.name=e,n.specified=!0,n.namespaceURI=a[0],n.prefix=a[1],n.localName=a[2],n}},Ff(mg,pg),Vg.prototype={nodeType:Gf,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return"html"===this.ownerDocument.type&&this.namespaceURI===kf.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=Hf(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=Pf(t);return new og(this,function(a){var n=[];return e.length>0&&fg(a,function(r){if(r!==a&&r.nodeType===Gf){var o=r.getAttribute("class");if(o){var i=t===o;if(!i){var l=Pf(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===Qf?this:this.ownerDocument).type,a=t.toLowerCase();return new og(this,function(n){var r=[];return fg(n,function(o){o!==n&&o.nodeType===Gf&&(("*"===t||o.getQualifiedName()===(e&&o.namespaceURI===kf.HTML?a:t))&&r.push(o))}),r})},getElementsByTagNameNS:function(t,e){return new og(this,function(a){var n=[];return fg(a,function(r){r===a||r.nodeType!==Gf||"*"!==t&&r.namespaceURI!==t||"*"!==e&&r.localName!=e||n.push(r)}),n})}},mg.prototype.getElementsByClassName=Vg.prototype.getElementsByClassName,mg.prototype.getElementsByTagName=Vg.prototype.getElementsByTagName,mg.prototype.getElementsByTagNameNS=Vg.prototype.getElementsByTagNameNS,Ff(Vg,pg),Eg.prototype.nodeType=Zf,Ff(Eg,pg),Rg.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}},Ff(Rg,pg),Lg.prototype={nodeName:"#text",nodeType:Kf,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}},Ff(Lg,Rg),zg.prototype={nodeName:"#comment",nodeType:Yf},Ff(zg,Rg),Ng.prototype={nodeName:"#cdata-section",nodeType:Df},Ff(Ng,Lg),qg.prototype.nodeType=_f,Ff(qg,pg),Og.prototype.nodeType=tg,Ff(Og,pg),Pg.prototype.nodeType=Xf,Ff(Pg,pg),Wg.prototype.nodeType=jf,Ff(Wg,pg),Hg.prototype.nodeName="#document-fragment",Hg.prototype.nodeType=$f,Ff(Hg,pg),Ug.prototype.nodeType=Jf,Ff(Ug,Rg),Fg.prototype.serializeToString=function(t,e){return Bg.call(t,e)},pg.prototype.toString=Bg;try{Object.defineProperty&&(Object.defineProperty(og.prototype,"length",{get:function(){return ig(this),this.$$length}}),Object.defineProperty(pg.prototype,"textContent",{get:function(){if(this.nodeType===Gf||this.nodeType===$f){var t=[];return gg(this,null,{enter:function(e){return e.nodeType===Gf||e.nodeType===$f||(e.nodeType===Jf||e.nodeType===Yf?null:void t.push(e.nodeValue))}}),t.join("")}return this.nodeValue},set:function(t){switch(this.nodeType){case Gf:case $f: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(Vg.prototype,"children",{get:function(){return new og(this,Xg)}}),Object.defineProperty(mg.prototype,"children",{get:function(){return new og(this,Xg)}}),Object.defineProperty(Hg.prototype,"children",{get:function(){return new og(this,Xg)}}),jg=function(t,e,a){t["$$"+e]=a})}catch(aN){}lu._updateLiveList=ig,lu.Attr=Eg,lu.CDATASection=Ng,lu.CharacterData=Rg,lu.Comment=zg,lu.Document=mg,lu.DocumentFragment=Hg,lu.DocumentType=qg,lu.DOMImplementation=hg,lu.Element=Vg,lu.Entity=Pg,lu.EntityReference=Wg,lu.LiveNodeList=og,lu.NamedNodeMap=lg,lu.Node=pg,lu.NodeList=rg,lu.Notation=Og,lu.Text=Lg,lu.ProcessingInstruction=Ug,lu.walkDOM=gg,lu.XMLSerializer=Fg;var Jg,Yg,Qg={},_g={};Jg=_g,Yg=Fp.freeze,Jg.XML_ENTITIES=Yg({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),Jg.HTML_ENTITIES=Yg({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:"‌"}),Jg.entityMap=Jg.HTML_ENTITIES;var $g={},tm=Fp,em=su,am=Qp,nm=tm.isHTMLEscapableRawTextElement,rm=tm.isHTMLMimeType,om=tm.isHTMLRawTextElement,im=tm.hasOwn,lm=tm.NAMESPACE,sm=am.ParseError,dm=am.DOMException;function cm(){}cm.prototype={parse:function(t,e,a){var n=this.domBuilder;n.startDocument(),mm(e,e=Object.create(null)),function(t,e,a,n,r){var o=rm(n.mimeType);t.indexOf(em.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=em.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 im(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(hm,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(em.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&&em.reg("^",em.QName_group,em.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)im(C,k)&&n.endPrefixMapping(k);x++;break;case"?":p&&u(v),x=ym(t,v,n,r);break;case"!":p&&u(v),x=bm(t,v,n,r,o);break;default:p&&u(v);var V=new Mm,E=f[f.length-1].currentNSMap,R=(x=um(t,v,V,E,l,r,o),V.length);if(V.closed||(o&&tm.isHTMLVoidElement(V.tagName)?V.closed=!0:g.push(V.tagName)),p&&R){for(var L=pm(p,{}),z=0;z<R;z++){var N=V[z];u(N.offset),N.locator=pm(p,{})}n.locator=L,fm(V,n,E)&&f.push(V),n.locator=p}else fm(V,n,E)&&f.push(V);o&&!V.closed?x=gm(t,x,V.tagName,l,n):x++}}catch(aN){if(aN instanceof sm)throw aN;if(aN instanceof dm)throw new sm(aN.name+": "+aN.message,n.locator,aN);r.error("element parse error: "+aN),x=-1}x>m?m=x:s(Math.max(v,m)+1)}}(t,e,a,n,this.errorHandler),n.endDocument()}};var hm=/&#?\w+;?/g;function pm(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function um(t,e,a,n,r,o,i){function l(t,e,n){return im(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(hm,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 fm(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),mm(a,a=Object.create(null))),a[h]=r[h]=s,i.uri=lm.XMLNS,e.startPrefixMapping(h,s))}for(o=t.length;o--;)(i=t[o]).prefix&&("xml"===i.prefix&&(i.uri=lm.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)im(r,d)&&e.endPrefixMapping(d)}function gm(t,e,a,n,r){var o=nm(a);if(o||om(a)){var i=t.indexOf("</"+a+">",e),l=t.substring(e+1,i);return o&&(l=l.replace(hm,n)),r.characters(l,0,l.length),i}return e+1}function mm(t,e){for(var a in t)im(t,a)&&(e[a]=t[a])}function vm(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=em.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 bm(t,e,a,n,r){var o=vm(t,e);switch(r?o.char(2).toUpperCase():o.char(2)){case"-":var i=o.getMatch(em.Comment);return i?(a.comment(i,em.COMMENT_START.length,i.length-em.COMMENT_START.length-em.COMMENT_END.length),o.getIndex()):n.fatalError("comment is not well-formed at position "+o.getIndex());case"[":var l=o.getMatch(em.CDSect);return l?r||a.currentElement?(a.startCDATA(),a.characters(l,em.CDATA_START.length,l.length-em.CDATA_START.length-em.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(em.DOCTYPE_DECL_START):!o.substringStartsWith(em.DOCTYPE_DECL_START))return n.fatalError("Expected "+em.DOCTYPE_DECL_START+" at position "+o.getIndex());if(o.skip(em.DOCTYPE_DECL_START.length),o.skipBlanks()<1)return n.fatalError("Expected whitespace after "+em.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(em.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(em.PUBLIC)||o.substringStartsWith(em.SYSTEM)){var d=em.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(em.SYSTEM)){if(o.skip(em.SYSTEM.length),o.skipBlanks()<1)return n.fatalError("Expected whitespace after "+em.SYSTEM+" at position "+o.getIndex());if(s.systemId=o.getMatch(em.ABOUT_LEGACY_COMPAT_SystemLiteral),!s.systemId)return n.fatalError("Expected "+em.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+em.SYSTEM+" at position "+o.getIndex())}return r&&s.systemId&&!em.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=em.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(em.elementdecl):"N"===t.char(3)&&(i=t.getMatch(em.EntityDecl));break;case"A":i=t.getMatch(em.AttlistDecl);break;case"N":i=t.getMatch(em.NotationDecl);break;case"-":i=t.getMatch(em.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(em.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 ym(t,e,a,n){var r=t.substring(e).match(em.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(!em.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 Mm(){this.attributeNames=Object.create(null)}Mm.prototype={setTagName:function(t){if(!em.QName_exact.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,a){if(!em.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}},$g.XMLReader=cm,$g.parseUtils=vm,$g.parseDoctypeCommentOrCData=bm;var xm=Fp,wm=Qp,Sm=_g,Am=$g,Im=lu.DOMImplementation,Tm=xm.hasDefaultHTMLNamespace,Cm=xm.isHTMLMimeType,km=xm.isValidMimeType,Vm=xm.MIME_TYPE,Em=xm.NAMESPACE,Rm=wm.ParseError,Lm=Am.XMLReader;function zm(t){return t.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028\u2029]/g,"\n")}function Nm(t){if(void 0===(t=t||{}).locator&&(t.locator=!0),this.assign=t.assign||xm.assign,this.domHandler=t.domHandler||qm,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 qm(t){var e=t||{};this.mimeType=e.mimeType||Vm.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 Om(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}function Pm(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 Wm(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}Nm.prototype.parseFromString=function(t,e){if(!km(e))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+e+'" is not valid.');var a=this.assign(Object.create(null),this.xmlns),n=Sm.XML_ENTITIES,r=a[""]||null;Tm(e)?(n=Sm.HTML_ENTITIES,r=Em.HTML):e===Vm.XML_SVG_IMAGE&&(r=Em.SVG),a[""]=r,a.xml=a.xml||Em.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 Lm;return l.errorHandler=o,l.domBuilder=o,!xm.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},qm.prototype={startDocument:function(){var t=new Im;this.doc=Cm(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;Wm(this,o),this.currentElement=o,this.locator&&Om(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&&Om(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&&Om(this.locator,a),Wm(this,a)},ignorableWhitespace:function(t,e,a){},characters:function(t,e,a){if(t=Pm.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&&Om(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=Pm.apply(this,arguments);var n=this.doc.createComment(t);this.locator&&Om(this.locator,n),Wm(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&&Om(this.locator,o),Wm(this,o),this.doc.doctype=o}},reportError:function(t,e){if("function"==typeof this.onError)try{this.onError(t,e,this)}catch(aN){throw new Rm("Reporting "+t+' "'+e+'" caused '+aN,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 Rm(t,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(t){qm.prototype[t]=function(){return null}}),Qg.__DOMHandler=qm,Qg.DOMParser=Nm,Qg.normalizeLineEndings=zm,Qg.onErrorStopParsing=function(t){if("error"===t)throw"onErrorStopParsing"},Qg.onWarningStopParsing=function(){throw"onWarningStopParsing"};var Hm=Fp;Hm.assign,Hm.hasDefaultHTMLNamespace,Hm.isHTMLMimeType,Hm.isValidMimeType,Hm.MIME_TYPE,Hm.NAMESPACE;var Um=lu.XMLSerializer,Fm=Qg.DOMParser;const Bm="http://schemas.openxmlformats.org/wordprocessingml/2006/main",Gm="http://schemas.openxmlformats.org/drawingml/2006/main",Zm="http://schemas.microsoft.com/office/word/2010/wordml";function Km(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 Dm=["lrTb","tbRl","btLr","lrTbV","tbRlV"];function jm(t){return Dm.includes(t)?t:void 0}function Xm(t,e,a){return Km(t,e,a)[0]??null}function Jm(t,e){return t?t.getAttributeNS(Bm,e)??t.getAttributeNS(Zm,e)??t.getAttribute(`w:${e}`)??t.getAttribute(`w14:${e}`)??t.getAttribute(e):null}function Ym(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=Ym(t,e);if(a)return a}}return null}function Qm(t){return"1"===t||"true"===t||"on"===t}function _m(t,e){const a=Xm(t,Bm,e);if(!a)return;const n=Jm(a,"val");return null==n||"0"!==n&&"false"!==n&&"off"!==n&&Qm(n)}function $m(t,e){return Jm(Xm(t,Bm,e),"val")??void 0}async function tv(t,e){e>0&&e%t===0&&await new Promise(t=>setTimeout(t,0))}function ev(t){var e;const a=new Map;if(!t)return a;const n=null==(e=(new Fm).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 av(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 ev(await(null==(a=t.file(i))?void 0:a.async("string")))}const nv=t=>{var e;const a=Xm(t,Gm,"latin");return(null==(e=null==a?void 0:a.getAttribute("typeface"))?void 0:e.trim())||void 0},rv=t=>{var e;const a=Xm(t,Gm,"cs");return(null==(e=null==a?void 0:a.getAttribute("typeface"))?void 0:e.trim())||nv(t)},ov=t=>{var e;const a=Xm(t,Gm,"ea");return(null==(e=null==a?void 0:a.getAttribute("typeface"))?void 0:e.trim())||nv(t)};function iv(t){const e=Xm(t,Gm,"fontScheme"),a=Xm(e,Gm,"majorFont"),n=Xm(e,Gm,"minorFont");return{majorHAnsi:nv(a),minorHAnsi:nv(n),majorEastAsia:ov(a),minorEastAsia:ov(n),majorBidi:rv(a),minorBidi:rv(n)}}function lv(t,e){const a=t?Number(t):Number.NaN;return Number.isFinite(a)?Math.round(a/Sn*bn):e}function sv(t){const e=t?Number(t):Number.NaN;if(Number.isFinite(e))return Math.round(e/20*1e4)/1e4}function dv(t){const e=null==t?void 0:t.trim();if(e&&"auto"!==e&&"none"!==e)return e.startsWith("#")?e:`#${e.toUpperCase()}`}const cv=["dk1","lt1","dk2","lt2","accent1","accent2","accent3","accent4","accent5","accent6","hlink","folHlink"];function hv(t){const e=Xm(t,Gm,"srgbClr");if(e)return dv(Jm(e,"val"));const a=Xm(t,Gm,"sysClr");return a?dv(Jm(a,"lastClr")):void 0}function pv(t){const e=Xm(t,Gm,"clrScheme");if(!e)return{};const a={};for(const n of cv){const t=hv(Xm(e,Gm,n));t&&(a[n]=t)}return a}function uv(t){if(!t)return;const e=Number.parseInt(t,16);return Number.isFinite(e)?e/255:void 0}function fv(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 gv={decimal:"decimal",lowerRoman:"lowerRoman",upperRoman:"upperRoman",lowerLetter:"lowerLetter",upperLetter:"upperLetter",symbol:"symbol"},mv={continuous:"continuous",eachSect:"eachSection"};function vv(t){if(!t)return;const e={},a=Jm(Xm(t,Bm,"numFmt"),"val");a&&gv[a]&&(e.numberFormat=gv[a]);const n=Number.parseInt(Jm(Xm(t,Bm,"numStart"),"val")??"",10);Number.isFinite(n)&&n>0&&(e.startAt=n);const r=Jm(Xm(t,Bm,"numRestart"),"val");return r&&mv[r]&&(e.restart=mv[r]),Object.keys(e).length>0?e:void 0}const bv={decimal:"decimal",lowerLetter:"lowerLetter",upperLetter:"upperLetter",lowerRoman:"lowerRoman",upperRoman:"upperRoman",bullet:"bullet"};function yv(t){const e={},a=Jm(Xm(t,Bm,"numFmt"),"val");a&&(e.kind="bullet"===a?"bullet":"ordered",e.format=bv[a]);const n=Jm(Xm(t,Bm,"suff"),"val");"tab"!==n&&"space"!==n&&"nothing"!==n||(e.suffix=n);const r=Jm(Xm(t,Bm,"start"),"val");if(null!=r){const t=Number.parseInt(r,10);Number.isFinite(t)&&(e.startAt=t)}e.levelText=Jm(Xm(t,Bm,"lvlText"),"val")??void 0;const o=Jm(Xm(t,Bm,"lvlJc"),"val");"left"!==o&&"center"!==o&&"right"!==o||(e.alignment=o);const i=Xm(t,Bm,"isLgl");var l;i&&(e.legal=null==(l=Jm(i,"val"))||"1"===l||"true"===l||"on"===l),"bullet"===e.kind&&e.levelText&&(e.bulletGlyph=e.levelText);const s=Xm(t,Bm,"rPr"),d=Xm(s,Bm,"rFonts");e.bulletFont=Jm(d,"ascii")??Jm(d,"hAnsi")??void 0;const c=Xm(t,Bm,"pPr"),h=Xm(c,Bm,"ind");if(h){const t=Jm(h,"left")??Jm(h,"start"),a=Jm(h,"hanging"),n=null!=t?lv(t,0):void 0,r=null!=a?lv(a,0):void 0;void 0===n&&void 0===r||(e.indent={left:n,hanging:r})}return e}function Mv(t,e,a){const n=t.numToAbstractId.get(e),r=n?t.abstractLevels.get(`${n}:${a}`):void 0;return t.numOverrideLevels.get(`${e}:${a}`)??r??{}}function xv(t){const e=Object.entries(t).filter(([,t])=>void 0!==t);return e.length>0?Object.fromEntries(e):void 0}function wv(t){return Object.keys(t).length>0?t:void 0}function Sv(t,e){return wv({...t??{},...e??{}})}function Av(t){return dv(Jm(t,"fill"))}function Iv(t,e){if(!t)return;const a=Oe(t,e,Ca),n=Oe(void 0,e,Ca),r=(t,e)=>t!==e?t:void 0,o=(t,e,a)=>void 0!==t?t:r(e,a);return xv({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 Tv(t,e){if(!t)return;const a={},n=$m(t,"rStyle");n&&(a.styleId=n);const r=_m(t,"b"),o=_m(t,"bCs");void 0===r&&void 0===o||(a.bold=!0===r||!0===o);const i=_m(t,"i"),l=_m(t,"iCs");void 0===i&&void 0===l||(a.italic=!0===i||!0===l);const s=_m(t,"strike");void 0!==s&&(a.strike=s);const d=_m(t,"dstrike");void 0!==d&&(a.doubleStrike=d);const c=_m(t,"smallCaps");void 0!==c&&(a.smallCaps=c);const h=_m(t,"caps");void 0!==h&&(a.allCaps=h);const p=_m(t,"vanish");void 0!==p&&(a.hidden=p);const u=_m(t,"noProof");void 0!==u&&(a.noProof=u);const f=_m(t,"webHidden");void 0!==f&&(a.webHidden=f);const g=_m(t,"specVanish");void 0!==g&&(a.specVanish=g);const m=Jm(Xm(t,Bm,"effect"),"val");m&&(a.textEffect=m);const v=Jm(Xm(t,Bm,"w"),"val");if(v){const t=Number(v);Number.isFinite(t)&&t>0&&(a.characterScale=t)}const b=Jm(Xm(t,Bm,"spacing"),"val");if(b){const t=sv(b);void 0!==t&&(a.characterSpacing=t)}const y=Jm(Xm(t,Bm,"position"),"val");if(y){const t=Number(y);Number.isFinite(t)&&(a.baselineShift=t/2)}const M=Jm(Xm(t,Bm,"kern"),"val");if(M){const t=Number(M);Number.isFinite(t)&&t>=0&&(a.kerningThreshold=t/2)}const x=Jm(Xm(t,Zm,"ligatures"),"val");"none"!==x&&"standard"!==x&&"contextual"!==x&&"historical"!==x&&"standardContextual"!==x||(a.ligatures=x);const w=Jm(Xm(t,Zm,"numSpacing"),"val");"proportional"!==w&&"tabular"!==w||(a.numberSpacing=w);const S=Jm(Xm(t,Zm,"numForm"),"val");"lining"!==S&&"oldStyle"!==S||(a.numberForm=S);const A=Jm(Xm(t,Zm,"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=Jm(Xm(t,Zm,"cntxtAlts"),"val");null===I?Xm(t,Zm,"cntxtAlts")&&(a.contextualAlternates=!0):Qm(I)&&(a.contextualAlternates=!0);const T=Xm(t,Bm,"u"),C=Jm(T,"val");if(T&&"none"!==C){a.underline=!0,C&&"single"!==C&&(a.underlineStyle=C);const t=Jm(T,"color");t&&"auto"!==t&&(a.underlineColor=dv(t))}const k=Jm(Xm(t,Bm,"vertAlign"),"val");"superscript"===k&&(a.superscript=!0),"subscript"===k&&(a.subscript=!0);const V=Xm(t,Bm,"rFonts"),E=Jm(V,"ascii")??Jm(V,"hAnsi")??Jm(V,"cs")??Jm(V,"eastAsia")??function(t,e){const a=Jm(t,"asciiTheme")??Jm(t,"hAnsiTheme")??Jm(t,"eastAsiaTheme")??Jm(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=Jm(Xm(t,Bm,"sz")??Xm(t,Bm,"szCs"),"val");if(R){const t=function(t){const e=t?Number(t):Number.NaN;return Number.isFinite(e)?Math.round(e/2/72*bn*1e4)/1e4:null}(R);null!==t&&(a.fontSize=t)}const L=Xm(t,Bm,"color"),z=Jm(L,"val");if(z&&"auto"!==z)a.color=dv(z);else if("auto"!==z){const t=function(t,e){const a=Jm(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=uv(Jm(t,"themeShade"));void 0!==s&&(o*=s,i*=s,l*=s);const d=uv(Jm(t,"themeTint"));if(void 0!==d){const t=255*(1-d);o=o*d+t,i=i*d+t,l=l*d+t}return fv(o,i,l)}(L,e.colors);t&&(a.color=t)}const N=Jm(Xm(t,Bm,"highlight"),"val");N&&"none"!==N&&(a.highlight=N);const q=Av(Xm(t,Bm,"shd"));q&&(a.shading=q);const O=Xm(t,Bm,"lang");if(O){const t=Jm(O,"val"),e=Jm(O,"eastAsia"),n=Jm(O,"bidi"),r={};t&&(r.value=t),e&&(r.eastAsia=e),n&&(r.bidi=n),Object.keys(r).length>0&&(a.language=r)}return wv(a)}function Cv(t){if(!t)return;const e=Jm(t,"val");if("nil"===e||"none"===e)return{width:0,type:"none",color:"transparent"};const a=Number(Jm(t,"sz")),n=Number.isFinite(a)&&a>0?Math.round(a/8*1e4)/1e4:.75,r=dv(Jm(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 kv(t){return t?{borderTop:Cv(Xm(t,Bm,"top")),borderRight:Cv(Xm(t,Bm,"right")),borderBottom:Cv(Xm(t,Bm,"bottom")),borderLeft:Cv(Xm(t,Bm,"left")),borderStart:Cv(Xm(t,Bm,"start")),borderEnd:Cv(Xm(t,Bm,"end")),borderTopLeftToBottomRight:Cv(Xm(t,Bm,"tl2br")),borderTopRightToBottomLeft:Cv(Xm(t,Bm,"tr2bl"))}:{}}function Vv(t){return void 0!==(null==t?void 0:t.lineHeight)?t:{...t??{},lineHeight:1.1}}function Ev(t){const e=Xm(t,Bm,"spacing");return{before:Qm(Jm(e,"beforeAutospacing")),after:Qm(Jm(e,"afterAutospacing"))}}function Rv(t){if(!t)return;const e={},a=$m(t,"pStyle");a&&(e.styleId=a);const n=Jm(Xm(t,Bm,"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=Xm(t,Bm,"spacing"),o=Jm(r,"before"),i=Jm(r,"after"),l=Jm(r,"line"),s=Jm(r,"lineRule");o&&(e.spacingBefore=lv(o,0)),i&&(e.spacingAfter=lv(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=_m(t,"contextualSpacing");void 0!==d&&(e.contextualSpacing=d);const c=_m(t,"snapToGrid");void 0!==c&&(e.snapToGrid=c);const h=Xm(t,Bm,"ind"),p=Jm(h,"start")??Jm(h,"left"),u=Jm(h,"end")??Jm(h,"right"),f=Jm(h,"firstLine"),g=Jm(h,"hanging");p&&(e.indentLeft=lv(p,0)),u&&(e.indentRight=lv(u,0)),g?(e.indentHanging=lv(g,0),e.indentFirstLine=void 0):f&&(e.indentFirstLine=lv(f,0));const m=function(t){const e=Xm(t,Bm,"tabs");if(!e)return[];const a=[];for(const n of Km(e,Bm,"tab")){const t=sv(Jm(n,"pos"));if(void 0===t)continue;const e=Jm(n,"val"),r="center"===e||"right"===e||"decimal"===e||"bar"===e||"clear"===e?e:"left",o=Jm(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=_m(t,"pageBreakBefore");void 0!==v&&(e.pageBreakBefore=v);const b=_m(t,"keepNext");void 0!==b&&(e.keepWithNext=b);const y=_m(t,"keepLines");void 0!==y&&(e.keepLinesTogether=y);const M=_m(t,"widowControl");void 0!==M&&(e.widowControl=M);const x=Xm(t,Bm,"pBdr");if(x){const{borderTop:t,borderRight:a,borderBottom:n,borderLeft:r}=kv(x);t&&(e.borderTop=t),a&&(e.borderRight=a),n&&(e.borderBottom=n),r&&(e.borderLeft=r)}const w=Av(Xm(t,Bm,"shd"));w&&(e.shading=w);const S=jm(Jm(Xm(t,Bm,"textDirection"),"val"));S&&(e.textDirection=S);const A=Jm(Xm(t,Bm,"outlineLvl"),"val");if(void 0!==A){const t=Number(A);Number.isFinite(t)&&t>=0&&t<=8&&(e.outlineLevel=t)}return wv(e)}function Lv(t){if(!t)return;const e={},a=Xm(t,Bm,"trHeight");if(a){const t=sv(Jm(a,"val"));void 0!==t&&(e.height=t);const n=Jm(a,"hRule");"auto"!==n&&"exact"!==n&&"atLeast"!==n||(e.heightRule=n)}const n=_m(t,"cantSplit");void 0!==n&&(e.cantSplit=n);const r=_m(t,"hidden");return void 0!==r&&(e.hidden=r),Object.keys(e).length>0?e:void 0}function zv(t){return"1"===t||"true"===t||"on"===t}function Nv(t){const e=Xm(t,Bm,"cols");if(!e)return;const a=Number.parseInt(Jm(e,"num")??"1",10);if(!Number.isFinite(a)||a<=1)return;const n=lv(Jm(e,"space"),0),r=Jm(e,"sep"),o=Jm(e,"equalWidth"),i=Km(e,Bm,"col").map(t=>({width:lv(Jm(t,"w"),0),space:lv(Jm(t,"space"),n)})),l=null==o||zv(o);return{count:a,space:n,...zv(r)?{separator:!0}:{},...l?{}:{equalWidth:!1},...!l&&i.length>0?{columns:i}:{}}}function qv(t){const e=Xm(t,Bm,"pgSz"),a=Xm(t,Bm,"pgMar"),n=Nv(t);let r;if(e||a||n){const t=lv(Jm(e,"w"),816),o=lv(Jm(e,"h"),1056),i=Jm(e,"orient");r={width:t,height:o,orientation:"landscape"===i?"landscape":"portrait"===i?"portrait":t>o?"landscape":"portrait",margins:{top:lv(Jm(a,"top"),96),right:lv(Jm(a,"right"),96),bottom:lv(Jm(a,"bottom"),96),left:lv(Jm(a,"left"),96),header:lv(Jm(a,"header"),48),footer:lv(Jm(a,"footer"),48),gutter:lv(Jm(a,"gutter"),0)},...n?{columns:n}:{}}}const o=e=>{const a={};for(const n of Km(t,Bm,e)){const t=Jm(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=Xm(t,Bm,"docGrid"),d=Jm(s,"type"),c=lv(Jm(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 Ov(t){if(!t)return;const e=Xm(t,Bm,"sectPr");if(!e)return;const a=Xm(e,Bm,"pgSz"),n=Xm(e,Bm,"pgMar"),r=Nv(e);if(!a&&!n&&!r)return;const o=lv(Jm(a,"w"),816),i=lv(Jm(a,"h"),1056),l=Jm(a,"orient");return{width:o,height:i,orientation:"landscape"===l?"landscape":"portrait"===l?"portrait":o>i?"landscape":"portrait",margins:{top:lv(Jm(n,"top"),96),right:lv(Jm(n,"right"),96),bottom:lv(Jm(n,"bottom"),96),left:lv(Jm(n,"left"),96),header:lv(Jm(n,"header"),48),footer:lv(Jm(n,"footer"),48),gutter:lv(Jm(n,"gutter"),0)},...r?{columns:r}:{}}}function Pv(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)Pv(o.blocks,e,a,n,r)}}function Wv(t){const e=Hv(t);return void 0===e?void 0:Math.round(e/wn)}function Hv(t){if(null==t||""===t)return;const e=parseInt(t,10);return Number.isFinite(e)?e:void 0}function Uv(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*yn);case"in":return Math.round(n*bn);case"cm":return Math.round(n/2.54*bn);case"mm":return Math.round(n/25.4*bn);case"pc":return Math.round(12*n*yn);default:return Math.round(n)}}function Fv(t){const e=null==t?void 0:t.trim();if(e&&/^[0-9a-fA-F]{6}$/.test(e))return`#${e.toUpperCase()}`}const Bv={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"},Gv={"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 Zv(t){return Gv[t.toLowerCase()]??null}async function Kv(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?Bv[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`${pe}${n}`;const r=`img-${t.nextId}`;return t.nextId+=1,t.assets[r]={id:r,url:a},t.byPath.set(e,r),`${pe}${r}`}(e,n,`data:${o};base64,${i}`)}function Dv(t){return"1"===t||"true"===t||"0"!==t&&"false"!==t&&void 0}function jv(t,e){var a,n,r,o;const i=Ym(t,e);if(!i)return;const l=null==(n=null==(a=Ym(i,"align"))?void 0:a.textContent)?void 0:n.trim(),s=Xv(null==(o=null==(r=Ym(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 Xv(t){if(null==t||""===t)return;const e=parseInt(t,10);return Number.isFinite(e)?e:void 0}function Jv(t){const e=jv(t,"positionH"),a=jv(t,"positionV"),n=function(t){return Ym(t,"wrapSquare")?"square":Ym(t,"wrapTight")?"tight":Ym(t,"wrapThrough")?"through":Ym(t,"wrapTopAndBottom")?"topAndBottom":Ym(t,"wrapNone")?"none":void 0}(t),r=Xv(t.getAttribute("distT")),o=Xv(t.getAttribute("distB")),i=Xv(t.getAttribute("distL")),l=Xv(t.getAttribute("distR")),s=Dv(t.getAttribute("simplePos")),d=Xv(t.getAttribute("relativeHeight")),c=Dv(t.getAttribute("behindDoc")),h=Dv(t.getAttribute("locked")),p=Dv(t.getAttribute("layoutInCell")),u=Dv(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 Yv(t,e,a,n){const r=Ym(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=Ym(s,"extent"),c=Ym(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)/wn)),e&&(p=Math.round(parseInt(e,10)/wn))}const u=c?Jm(c,"descr")??Jm(c,"title"):null,f=function(t){const e=Ym(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(Ym(t,"tile"))return"tile"}(t),m=function(t){const e=Ym(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)?Jv(l.element):void 0,b="anchor"===(null==l?void 0:l.kind)?function(t){const e=Ym(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=Xv(r.getAttribute("x")),i=Xv(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 Kv(e,n,w);if(t)return{text:"",image:{src:t,...y}}}return{text:"",image:void 0}}function Qv(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 _v(t,e,a,n){const r=Ym(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=Ym(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=Uv(r);null!==t&&(e.width=t)}else if("height"===n){const t=Uv(r);null!==t&&(e.height=t)}}return e}(null==l?void 0:l.getAttribute("style")),d=function(t){const e={left:Qv(Jm(t,"cropleft")),top:Qv(Jm(t,"croptop")),right:Qv(Jm(t,"cropright")),bottom:Qv(Jm(t,"cropbottom"))};if(void 0!==e.left||void 0!==e.top||void 0!==e.right||void 0!==e.bottom)return e}(r),c=Jm(r,"title")??r.getAttribute("o:title"),h=await Kv(e,n,i);return h?{src:h,width:s.width??300,height:s.height??300,...c?{alt:c}:{},...d?{crop:d}:{}}:void 0}function $v(t){return"1"===t||"true"===t||"0"!==t&&"false"!==t&&void 0}function tb(t,e){var a,n,r,o;const i=Ym(t,e);if(!i)return;const l=null==(n=null==(a=Ym(i,"align"))?void 0:a.textContent)?void 0:n.trim(),s=Hv(null==(o=null==(r=Ym(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 eb(t){const e=tb(t,"positionH"),a=tb(t,"positionV"),n=function(t){return Ym(t,"wrapSquare")?"square":Ym(t,"wrapTight")?"tight":Ym(t,"wrapThrough")?"through":Ym(t,"wrapTopAndBottom")?"topAndBottom":Ym(t,"wrapNone")?"none":void 0}(t),r=Hv(t.getAttribute("distT")),o=Hv(t.getAttribute("distB")),i=Hv(t.getAttribute("distL")),l=Hv(t.getAttribute("distR")),s=$v(t.getAttribute("simplePos")),d=Hv(t.getAttribute("relativeHeight")),c=$v(t.getAttribute("behindDoc")),h=$v(t.getAttribute("locked")),p=$v(t.getAttribute("layoutInCell")),u=$v(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 ab(t,e){const a=Ym(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=Ym(r,"extent"),i=Wv(null==o?void 0:o.getAttribute("cx"))??300,l=Wv(null==o?void 0:o.getAttribute("cy"))??300,s=Ym(r,"docPr"),d=s?Jm(s,"name"):null,c=s?Jm(s,"descr")??Jm(s,"title"):null,h="anchor"===(null==n?void 0:n.kind)?eb(n.element):void 0,p=Ym(a,"txbxContent"),u=p&&e?await e(p):[],f=function(t){var e,a;const n=Ym(t,"spPr");if(!n)return;const r={},o=Ym(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=Fv(null==(e=Ym(o,"srgbClr"))?void 0:e.getAttribute("val"));t&&(r.fill=t)}else if("ln"===o.localName){const t=Hv(o.getAttribute("w"));void 0!==t&&(r.borderWidthPt=Math.round(t/12700*100)/100);const e=Fv(null==(a=Ym(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=Ym(t,"bodyPr");if(!e)return;const a={},n=Wv(e.getAttribute("lIns")),r=Wv(e.getAttribute("tIns")),o=Wv(e.getAttribute("rIns")),i=Wv(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),Ym(e,"spAutoFit")&&(a.autoFit=!0),Object.keys(a).length>0?a:void 0}(a),m=function(t){const e=Ym(t,"spPr");if(!e)return;const a=Ym(e,"xfrm"),n=Hv(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 nb(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=Ym(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 rb(t){const e=Jm(t,"id");if(!e)return;if("bookmarkEnd"===t.localName)return{kind:"end",docxId:e};const a=Jm(t,"name")??void 0,n=Jm(t,"colFirst"),r=Jm(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 ob(t){const e=Jm(t,"id");if(e)return{kind:"commentRangeEnd"===t.localName?"end":"start",docxId:e}}async function ib(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===Bm)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"===Jm(o,"type")?"\f":"\n");else{if("lastRenderedPageBreak"===o.localName)continue;if("bookmarkStart"===o.localName||"bookmarkEnd"===o.localName){const t=rb(o);t&&c.push({offset:d,marker:t});continue}if("commentRangeStart"===o.localName||"commentRangeEnd"===o.localName){const t=ob(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 Yv(o,e,a,n);if(t.image)p(t.text),i=t.image;else{const t=await ab(o,r);t&&(p(""),l=t)}}else if("pict"===o.localName){const t=await _v(o,e,a,n);t&&(p(""),i=t)}else if("sym"===o.localName){const t=Jm(o,"font")??"",e=Jm(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=nb(o);if(t){const e=await ab(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 lb(t,e,a,n,r,o,i,l){var s,d,c;const h=[],p=[],u=(t,e)=>{const a=Jm(t,"fldCharType"),n=Jm(t,"fldLock"),r=Jm(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===Bm){if("bookmarkStart"===m.localName||"bookmarkEnd"===m.localName){const t=rb(m);if(!t)continue;h.push({text:"",bookmark:t});continue}if("commentRangeStart"===m.localName||"commentRangeEnd"===m.localName){const t=ob(m);if(!t)continue;h.push({text:"",comment:t});continue}if("r"===m.localName){const t=Tv(Xm(m,Bm,"rPr"),o);if(Km(m,Bm,"fldChar").length>0||Km(m,Bm,"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===Bm&&("fldChar"===n.localName?u(n,t):"instrText"===n.localName&&f(n,t))}continue}const e=Xm(m,Bm,"footnoteReference");if(e){const a=Jm(e,"id");if(!a)continue;const n=Jm(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=Xm(m,Bm,"endnoteReference");if(c){const e=Jm(c,"id");if(!e)continue;const a=Jm(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 ib(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(Bm,"instr")??m.getAttribute("instr")??"",s=/\bNUMPAGES\b/i.test(t)?"NUMPAGES":/\bPAGE\b/i.test(t)?"PAGE":null,d=await lb(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=Jm(m,"anchor");e&&(t=`#${e}`)}h.push(...await lb(m,e,a,n,r,o,t,l))}}}return h}function sb(t,e,a,n){var r;const o=wa(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=Iv(i.styles,null==(r=o.style)?void 0:r.styleId);return o.list=a?{...a}:void 0,o}function db(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 cb(t,e,a,n,r,o,i,l){const s=Xm(t,Bm,"pPr"),d=await lb(t,e,a,n,r,o,void 0,i),c=Vv(Rv(s)),h=Tv(Xm(s,Bm,"rPr"),o),p=function(t,e){if(!t)return;const a=Xm(t,Bm,"numPr");if(!a)return;const n=Jm(Xm(a,Bm,"numId"),"val");if(!n)return;const r=Jm(Xm(a,Bm,"ilvl"),"val")??"0",o=Number.parseInt(r,10),i=Number.isFinite(o)?o:0,l=Mv(e,n,i),s=[];for(let p=0;p<=i;p+=1)s[p]=Mv(e,n,p).format??"decimal";const d=`${n}:${i}`,c=!e.seenInstances.has(d);e.seenInstances.add(d);const h=c?e.numStartOverrides.get(d)??l.startAt:void 0;return{list:{kind:l.kind??"ordered",level:i,instanceId:n,suffix:l.suffix??"tab",...l.format?{format:l.format}:{},...s.length?{levelFormats:s}:{},...l.levelText?{levelText:l.levelText}:{},...l.alignment?{alignment:l.alignment}:{},...void 0!==l.legal?{legal:l.legal}:{},...void 0!==h&&1!==h?{startAt:h}:{},...l.bulletGlyph?{bulletGlyph:l.bulletGlyph}:{},...l.bulletFont?{bulletFont:l.bulletFont}:{}},indent:l.indent}}(s,e),u=null==p?void 0:p.list;let f=c;if(null==p?void 0:p.indent){const{left:t,hanging:e}=p.indent,a=c??{};f={...a,...void 0===a.indentLeft&&void 0!==t?{indentLeft:t}:{},...void 0===a.indentHanging&&void 0!==e?{indentHanging:e}:{}}}const g=function(t){if(!t)return;const e=Pe(t,Ca),a=Pe(void 0,Ca);return xv({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})}(l?{...l,...f??{}}:f),m=function(t,e){var a;const n=Xm(t,Bm,"framePr");if(!n)return null;const r=Jm(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(Jm(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}}(s,d);if(m)return{paragraphs:[],pageBreakAfter:!1,dropCapFrame:m};const{segments:v,hasPageBreak:b}=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}}(d);if(!b)return{paragraphs:[sb(d,g,u,h)],pageBreakAfter:!1};const y=[];let M=!1;for(let x=0;x<v.length;x+=1){const t=v[x];if(x>0&&(M=!0),!db(t))continue;const e=M?{...g??{},pageBreakBefore:!0}:g;y.push(sb(t,e,u,h)),M=!1}return{paragraphs:y,pageBreakAfter:M}}async function hb(t,e,a,n,r,o,i,l){return(await cb(t,e,a,n,r,o,i,l)).paragraphs[0]??wa([{text:""}])}function pb(t){if(!t)return;const e=Jm(t,"type"),a=Jm(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 sv(a)}function ub(t,e){const a=Jm(Xm(t,Bm,e),"val"),n=a?Number(a):Number.NaN;return Number.isFinite(n)&&n>0?Math.floor(n):void 0}function fb(t,e){if(!t)return;const a=new Set(e),n=new Um,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===Bm&&a.has(t.localName??"")&&r.push(n.serializeToString(t))}return r.length>0?r:void 0}function gb(t){if(!t)return;const e=e=>sv(Jm(Xm(t,Bm,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 mb(t,e){const a={};e&&(a.styleId=e);const n=Jm(Xm(t,Bm,"tblCaption"),"val");n&&(a.altTitle=n);const r=Jm(Xm(t,Bm,"tblDescription"),"val");r&&(a.altDescription=r);const o=pb(Xm(t,Bm,"tblW"));void 0!==o&&(a.width=o);const i=pb(Xm(t,Bm,"tblInd"));void 0!==i&&(a.indentLeft=i);const l=Jm(Xm(t,Bm,"jc"),"val");"left"!==l&&"center"!==l&&"right"!==l||(a.align=l);const s=function(t){const e=Jm(Xm(t,Bm,"tblLayout"),"type");return"fixed"===e||"autofit"===e?e:void 0}(t);s&&(a.layout=s);const d=pb(Xm(t,Bm,"tblCellSpacing"));void 0!==d&&(a.cellSpacing=d);const c=gb(Xm(t,Bm,"tblCellMar"));c&&(a.defaultCellMargins=c);const h=t?_m(t,"bidiVisual"):void 0;void 0!==h&&(a.bidiVisual=h);const p=Jm(Xm(t,Bm,"tblOverlap"),"val");p&&(a.tblOverlap=p);const u=function(t){const e=Xm(t,Bm,"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)!==Bm&&"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=fb(t,["tblPrChange"]);return f&&(a.revisionXml=f),wv(a)}function vb(t){if(!t)return;const e={},a=ub(t,"gridBefore");void 0!==a&&(e.gridBefore=a);const n=ub(t,"gridAfter");void 0!==n&&(e.gridAfter=n);const r=pb(Xm(t,Bm,"wBefore"));void 0!==r&&(e.widthBefore=r);const o=pb(Xm(t,Bm,"wAfter"));void 0!==o&&(e.widthAfter=o);const i=Xm(t,Bm,"trHeight"),l=sv(Jm(i,"val"));void 0!==l&&(e.height=l);const s=Jm(i,"hRule");"auto"!==s&&"exact"!==s&&"atLeast"!==s||(e.heightRule=s);const d=pb(Xm(t,Bm,"tblCellSpacing"));void 0!==d&&(e.cellSpacing=d);const c=_m(t,"cantSplit");void 0!==c&&(e.cantSplit=c);const h=_m(t,"hidden");void 0!==h&&(e.hidden=h);const p=fb(t,["trPrChange","ins","del"]);return p&&(e.revisionXml=p),wv(e)}function bb(t){if(!t)return 1;const e=Jm(Xm(t,Bm,"gridSpan"),"val"),a=e?Number(e):1;return Number.isFinite(a)&&a>1?Math.floor(a):1}function yb(t){if(!t)return;const e=Xm(t,Bm,"vMerge");if(!e)return;return"restart"===Jm(e,"val")?"restart":"continue"}function Mb(t,e){if(!t){if(!e)return;return wv({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=Av(Xm(t,Bm,"shd"));n&&(a.shading=n);const r=Xm(t,Bm,"tcW"),o=Jm(r,"type"),i=Jm(r,"w");if("dxa"===o){const t=sv(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=gb(Xm(t,Bm,"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=Jm(Xm(t,Bm,"vAlign"),"val");return"top"===e||"bottom"===e?e:"center"===e?"middle":void 0}(t);s&&(a.verticalAlign=s);const d=jm(Jm(Xm(t,Bm,"textDirection"),"val"));d&&(a.textDirection=d);const c=_m(t,"noWrap");void 0!==c&&(a.noWrap=c);const h=_m(t,"tcFitText");void 0!==h&&(a.fitText=h);const p=_m(t,"hideMark");void 0!==p&&(a.hideMark=p);const u=Jm(Xm(t,Bm,"headers"),"val");u&&(a.headers=u);const f=fb(t,["tcPrChange","cellIns","cellDel","cellMerge"]);f&&(a.revisionXml=f);for(const[g,m]of Object.entries(function(t){return t?kv(Xm(t,Bm,"tcBorders")):{}}(t)))m&&(a[g]=m);return wv(a)}function xb(t){const e=Xm(t,Bm,"trPr");return!!e&&!0===_m(e,"tblHeader")}function wb(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 Sb(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 Ab(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 Ib(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}}function Tb(t,e,a){if(!t)return;const n=qe(e??ze(a),a),r=new Set(Object.keys(n)),o={};for(const[i,l]of Object.entries(t))r.has(i)||(o[i]=l);return wv(o)}async function Cb(t,e,a,n,r,o,i,l){var s,d;const c=[],h=Xm(t,Bm,"tblGrid");if(h)for(const E of Km(h,Bm,"gridCol")){const t=sv(Jm(E,"w"));void 0!==t&&c.push(t)}const p=Xm(h,Bm,"tblGridChange"),u=Xm(t,Bm,"tblPr"),f=Jm(Xm(u,Bm,"tblStyle"),"val"),g=f&&(null==(s=null==l?void 0:l[f])?void 0:s.paragraphStyle)?l[f].paragraphStyle:void 0,m=(v=Xm(u,Bm,"tblBorders"))?{...kv(v),borderInsideH:Cv(Xm(v,Bm,"insideH")),borderInsideV:Cv(Xm(v,Bm,"insideV"))}:{};var v;const b=f?null==(d=null==l?void 0:l[f])?void 0:d.tableStyle:void 0,y=mb(u,f??void 0),M=null==y?void 0:y.defaultCellMargins,x=(null==b?void 0:b.conditionalFormats)??void 0,w=function(t){const e=Xm(t,Bm,"tblLook"),a=t=>{const a=Jm(e,t);return null===a||""===a?void 0:Qm(a)},n=Jm(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}}(u),S=(null==b?void 0:b.rowBandSize)??1,A=(null==b?void 0:b.colBandSize)??1,I=Km(t,Bm,"tr"),T=I.length,C=c.length>0?c.length:I.reduce((t,e)=>Math.max(t,Km(e,Bm,"tc").length),0),k=[];for(let E=0;E<I.length;E+=1){const t=I[E],s=Xm(t,Bm,"trPr"),d=Xm(s,Bm,"cnfStyle"),c=[];"1"===Jm(d,"firstRow")&&c.push("firstRow"),"1"===Jm(d,"lastRow")&&c.push("lastRow");const h=Km(t,Bm,"tc"),p=[];for(let v=0;v<h.length;v+=1){const t=h[v],s=[],d=[],u=Xm(t,Bm,"tcPr");for(const c of Km(t,Bm,"p")){const t=Tb(g,Jm(Xm(Xm(c,Bm,"pPr"),Bm,"pStyle"),"val")??void 0,l);s.push(await hb(c,e,a,n,r,o,i,t)),d.push(Ev(Xm(c,Bm,"pPr")))}wb(s,d);const f=bb(u),m=yb(u),b=Mb(u,M),y=Ab([...Sb(E,v,T,C,w,S,A),...c],x);if(Ib(s,y.textStyle),y.paragraphStyle){const t=y.paragraphStyle;for(const e of s)e.style={...t,...e.style}}const I=Sa(s.length>0?s:[wa([{text:""}])],f,"restart"===m?{rowSpan:1,vMerge:m}:m?{vMerge:m}:void 0),k={...b??{}},V=(null==b?void 0:b.shading)??y.shading;if(V&&(k.shading=V),y.borders)for(const e of["borderTop","borderRight","borderBottom","borderLeft"]){const t=y.borders[e];void 0===k[e]&&t&&(k[e]=t)}Object.keys(k).length>0&&(I.style=k),"continue"===m&&(I.blocks=[]),p.push(I)}const u=Aa(p,xb(t)?{isHeader:!0}:void 0),f=vb(s);if(f&&(u.style=f),x){const t=Sb(E,0,T,Math.max(1,C),w,S,A).filter(t=>"firstRow"===t||"lastRow"===t||"band1Horz"===t||"band2Horz"===t),e=Ab([...c,...t],x);e.rowStyle&&(u.style={...e.rowStyle,...u.style})}const m=Xm(t,Bm,"tblPrEx");m&&(u.tblPrExXml=(new Um).serializeToString(m)),k.push(u)}!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)}}}(k,m);for(let E=0;E<k.length;E+=1){const t=k[E];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=E+1;t<k.length;t+=1){const a=k[t].cells[e];if(!a||"continue"!==a.vMerge)break;n+=1}n>1&&(a.rowSpan=n)}}const V=Ia(k,c.length>0?c:void 0);return y&&(V.style=y),V.style?V.style.tblLook=w:f&&(V.style={tblLook:w}),p&&(V.tblGridChangeXml=(new Um).serializeToString(p)),V}function kb(t,e,a,n,r){return o=>async function(t,e,a,n,r,o){const i=kb(e,a,n,r,o),l=[];for(let s=0;s<t.childNodes.length;s+=1){const d=t.childNodes[s];if((null==d?void 0:d.nodeType)!==d.ELEMENT_NODE)continue;const c=d;if(c.namespaceURI===Bm)if("p"===c.localName){const t=await cb(c,e,a,n,r,o,i);for(const e of t.paragraphs)l.push(e)}else"tbl"===c.localName&&l.push(await Cb(c,e,a,n,r,o,i))}return l}(o,t,e,a,n,r)}async function Vb(t,e,a,n,r,o,i){if(!t)return[];const l=(new Fm).parseFromString(t,"application/xml").documentElement;if(!l)return[];const s=kb(e,a,n,r,o),d=[];for(let c=0;c<l.childNodes.length;c+=1){const t=l.childNodes[c];if((null==t?void 0:t.nodeType)!==t.ELEMENT_NODE)continue;const h=t;"p"===h.localName&&h.namespaceURI===Bm?d.push(await hb(h,e,a,n,r,o,s)):"tbl"===h.localName&&h.namespaceURI===Bm&&d.push(await Cb(h,e,a,n,r,o,s,i))}return d}const Eb=new Set(["separator","continuationSeparator","continuationNotice"]);async function Rb(t,e,a,n,r,o,i,l){const s={byDocxId:new Map,notes:{items:{}}};if(!e)return s;const d=(new Fm).parseFromString(e,"application/xml").documentElement;if(!d)return s;const c={},h=new Map;let p,u;const f=Km(d,Bm,t);let g=0;const m=kb(a,n,r,o,i);for(const v of f){const e=Jm(v,"id")??"",s=Jm(v,"type")??"",d=[];for(let t=0;t<v.childNodes.length;t+=1){const e=v.childNodes[t];if((null==e?void 0:e.nodeType)!==e.ELEMENT_NODE)continue;const s=e;s.namespaceURI===Bm&&("p"===s.localName?d.push(await hb(s,a,n,r,o,i,m)):"tbl"===s.localName&&d.push(await Cb(s,a,n,r,o,i,m,l)))}if(Eb.has(s)){"separator"===s?p=d:"continuationSeparator"===s&&(u=d);continue}if(("-1"===e||"0"===e)&&0===d.length)continue;g+=1;const f=`${t}:imported:${g}`,b=Number.parseInt(e,10),y={id:f,blocks:d.length>0?d:[],docxId:Number.isFinite(b)?b:void 0};c[f]=y,e&&h.set(e,y)}return{byDocxId:h,notes:{items:c,separator:p,continuationSeparator:u},separator:p,continuationSeparator:u}}const Lb=new Set(["_GoBack"]);function zb(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:[ya("")]))}for(const n of t.rows)for(const t of n.cells)for(const n of t.blocks)zb(n,e,a)}function Nb(t){var e;const a=[],n={value:0},r=t=>{null==t||t.forEach(t=>zb(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||Lb.has(n))continue;const r=Number.parseInt(t.docxId,10),o=null==(e=i.get(t.docxId))?void 0:e.shift(),d=va(),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 qb(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:[ya("")]))}for(const n of t.rows)for(const t of n.cells)for(const n of t.blocks)qb(n,e,a)}function Ob(t){const e=[],a={value:0},n=t=>{null==t||t.forEach(t=>qb(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 Pb="http://schemas.microsoft.com/office/word/2012/wordml";function Wb(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===Bm){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+=Wb(r)}return e}function Hb(t){if(!t)return;const e=Date.parse(t);return Number.isNaN(e)?void 0:e}function Ub(t,e){const a=new Map;if(!t)return a;const n=(new Fm).parseFromString(t,"application/xml").documentElement;if(!n)return a;const r=function(t){const e=new Map;if(!t)return e;const a=(new Fm).parseFromString(t,"application/xml").documentElement;if(!a)return e;for(const n of Km(a,Pb,"commentEx")){const t=n.getAttributeNS(Pb,"paraId");if(!t)continue;const a=n.getAttributeNS(Pb,"done");e.set(t,"1"===a||"true"===a)}return e}(e);for(const o of Km(n,Bm,"comment")){const t=Jm(o,"id");if(null===t)continue;const e=Jm(o,"author")??"",n=Jm(o,"initials")??void 0,i=Hb(Jm(o,"date")),l=Km(o,Bm,"p"),s=l.map(t=>Wb(t)).join("\n").trim(),d=l.length>0?Jm(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 Fb(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 Up.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=ev(await(null==(r=g.file("word/_rels/document.xml.rels"))?void 0:r.async("string"))),b=function(t){const e={abstractLevels:new Map,numOverrideLevels:new Map,numStartOverrides:new Map,numToAbstractId:new Map,seenInstances:new Set};if(!t)return e;const a=(new Fm).parseFromString(t,"application/xml").documentElement;if(!a)return e;for(const n of Array.from(a.getElementsByTagNameNS(Bm,"abstractNum"))){const t=Jm(n,"abstractNumId");if(t)for(const a of Km(n,Bm,"lvl")){const n=Jm(a,"ilvl")??"0";e.abstractLevels.set(`${t}:${n}`,yv(a))}}for(const n of Array.from(a.getElementsByTagNameNS(Bm,"num"))){const t=Jm(n,"numId"),a=Jm(Xm(n,Bm,"abstractNumId"),"val");if(t&&a){e.numToAbstractId.set(t,a);for(const a of Km(n,Bm,"lvlOverride")){const n=Jm(a,"ilvl")??"0",r=Xm(a,Bm,"lvl");r&&e.numOverrideLevels.set(`${t}:${n}`,yv(r));const o=Jm(Xm(a,Bm,"startOverride"),"val");if(null!=o){const a=Number.parseInt(o,10);Number.isFinite(a)&&e.numStartOverrides.set(`${t}:${n}`,a)}}}}return e}(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 Fm).parseFromString(t,"application/xml"),n=sv(Jm(Xm(a.documentElement,Bm,"defaultTabStop"),"val"));void 0!==n&&(e.defaultTabStop=n),e.footnoteSettings=vv(Xm(a.documentElement,Bm,"footnotePr")),e.endnoteSettings=vv(Xm(a.documentElement,Bm,"endnotePr"));const r=Xm(a.documentElement,Bm,"compat");if(r){const t=Xm(r,Bm,"adjustLineHeightInTable");if(t){const a=Jm(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 Fm).parseFromString(t,"application/xml").documentElement,a=e?Km(e,Gm,"themeElements")[0]??null:null;return{fonts:iv(a),colors:pv(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 Fm).parseFromString(t,"application/xml").documentElement;if(!a)return;const n=Xm(a,Bm,"docDefaults"),r=Xm(Xm(n,Bm,"pPrDefault"),Bm,"pPr"),o=Xm(Xm(n,Bm,"rPrDefault"),Bm,"rPr"),i=r?{spacingBefore:0,spacingAfter:0,...Vv(Rv(r))}:Vv(Rv(r)),l=Tv(o,e),s={};let d;for(const c of Km(a,Bm,"style")){const t=Jm(c,"styleId"),a=Jm(c,"type");if(!t||"paragraph"!==a&&"character"!==a&&"table"!==a)continue;const n=Jm(Xm(c,Bm,"name"),"val")??t,r=Jm(Xm(c,Bm,"basedOn"),"val")??void 0,o=Jm(Xm(c,Bm,"next"),"val")??void 0,h=Vv(Rv(Xm(c,Bm,"pPr"))),p=Tv(Xm(c,Bm,"rPr"),e);let u;if("table"===a){const a=Xm(c,Bm,"tblPr"),n=sv(Jm(Xm(a,Bm,"tblInd"),"w")),r=t=>{const e=Jm(Xm(a,Bm,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 Km(c,Bm,"tblStylePr")){const a=Jm(t,"type");if(!a)continue;const n=Xm(t,Bm,"tcPr"),r=Av(Xm(n,Bm,"shd")),o=Tv(Xm(t,Bm,"rPr"),e),i=wv(kv(Xm(n,Bm,"tcBorders"))),s=Rv(Xm(t,Bm,"pPr")),d=Lv(Xm(t,Bm,"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&&Qm(Jm(c,"default"));f&&(d=t),s[t]={id:t,name:n,type:a,basedOn:r,nextStyle:o,paragraphStyle:"paragraph"===a&&f?Sv(i,h):h,textStyle:"paragraph"===a&&f?Sv(l,p):p,tableStyle:u}}return d&&s[d]?s:((i||l)&&(s.Normal={id:"Normal",name:"Normal",type:"paragraph",paragraphStyle:i,textStyle:l}),wv(s))}(M,x);null==(d=e.onProgress)||d.call(e,"parsing-document");const S=(new Fm).parseFromString(m,"application/xml").getElementsByTagNameNS(Bm,"body")[0];if(!S)return ka([wa([{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 tt=0;tt<S.childNodes.length;tt+=1){const t=S.childNodes[tt];if((null==t?void 0:t.nodeType)===t.ELEMENT_NODE){const e=t;e.namespaceURI===Bm&&"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))},z=kb(b,g,v,A,x);for(let tt=0;tt<S.childNodes.length;tt+=1){const t=S.childNodes[tt];if((null==t?void 0:t.nodeType)!==t.ELEMENT_NODE)continue;const e=t;if(e.namespaceURI===Bm){if("sectPr"===e.localName)I.push(qv(e)),T.push([]),C=!1;else if("p"===e.localName){const t=await cb(e,b,g,v,A,x,z);for(const e of t.paragraphs)V(e);t.dropCapFrame&&(k=t.dropCapFrame),t.pageBreakAfter&&(C=!0),L()}else"tbl"===e.localName&&(V(await Cb(e,b,g,v,A,x,z,w)),L());await tv(50,R)}}if(0===I.length){const t=Xm(S,Bm,"sectPr");I.push(t?qv(t):{pageSettings:Ov(S),headerRIds:{},footerRIds:{}})}null==(c=e.onProgress)||c.call(e,"parsing-headers-footers");const N=[],q=t=>Object.keys(t.headerRIds).length>0||Object.keys(t.footerRIds).length>0,O=I.filter(q).length;let P=0;const W=()=>{var t;P+=1,O>0&&(null==(t=e.onProgress)||t.call(e,"parsing-headers-footers",P/O))};for(let tt=0;tt<I.length;tt+=1){const t=I[tt],e=T[tt]??[];Pv(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 av(g,r),l=await Vb(o??null,b,g,i,A,x,w);return Pv(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);q(t)&&W(),await tv(2,P);const d=ve(t.pageSettings??{width:816,height:1056,orientation:"portrait",margins:{top:96,right:96,bottom:96,left:96,header:48,footer:48,gutter:0}});N.push({id:`section:${tt+1}`,blocks:e.length>0?e:[wa([{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 H=await(null==(h=g.file("word/footnotes.xml"))?void 0:h.async("string"))??null,U=H?await av(g,"word/footnotes.xml"):new Map,F=await async function(t,e,a,n,r,o,i){const l=await Rb("footnote",t,e,a,n,r,o,i);return{byDocxId:l.byDocxId,footnotes:l.notes,separator:l.separator,continuationSeparator:l.continuationSeparator}}(H,b,g,U,A,x,w);y.footnoteSettings&&(F.footnotes.settings=y.footnoteSettings);const B=Object.keys(F.footnotes.items).length>0||F.footnotes.separator||F.footnotes.continuationSeparator||F.footnotes.settings?F.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)}(N,F.byDocxId);const G=await(null==(p=g.file("word/endnotes.xml"))?void 0:p.async("string"))??null,Z=G?await av(g,"word/endnotes.xml"):new Map,K=await async function(t,e,a,n,r,o,i){const l=await Rb("endnote",t,e,a,n,r,o,i);return{byDocxId:l.byDocxId,endnotes:l.notes,separator:l.separator,continuationSeparator:l.continuationSeparator}}(G,b,g,Z,A,x,w);y.endnoteSettings&&(K.endnotes.settings=y.endnoteSettings);const D=Object.keys(K.endnotes.items).length>0||K.endnotes.separator||K.endnotes.continuationSeparator||K.endnotes.settings?K.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)}(N,K.byDocxId);const j=Nb(N),X=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=ba(),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}(Ob(N),Ub(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)),J=N.length>1||N.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}),Y=Object.keys(A.assets).length>0,Q=t=>{void 0!==y.defaultTabStop&&(t.settings={...t.settings??{},defaultTabStop:y.defaultTabStop});let e=t;return B&&(e.footnotes=B,e=_l(e)),D&&(e.endnotes=D,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 ts(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,Yl(s,r))))}let d=!1;const c=He(t).map(t=>{const e=t=>{if(!t)return t;let e=!1;const a=t.map(t=>{if("paragraph"===t.type){const a=es(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=es(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)),j&&(e.bookmarks=j),X&&(e.comments=X),e};if(J){const t=ka([]);return t.sections=N,1===N.length&&(t.pageSettings=N[0].pageSettings),w&&(t.styles=w),Y&&(t.assets=A.assets),Q(t)}const _=N[0],$=ka((null==_?void 0:_.blocks.length)>0?_.blocks:[wa([{text:""}])],null==_?void 0:_.pageSettings);return Y&&($.assets=A.assets),w&&($.styles=w),Q($)}let Bb=1;function Gb(t,e={}){if("undefined"==typeof Worker||"undefined"==typeof URL)return Fb(t,e);const a=Bb;return Bb+=1,new Promise((r,o)=>{const i=new Worker(new URL(""+("undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__dirname+"/assets/importDocxWorker-DbI0FKvR.js").href:new URL("assets/importDocxWorker-DbI0FKvR.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 Zb={"opening-docx":"opening","parsing-document":"parsing","parsing-headers-footers":"finishing"};function Kb(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 Db(t,e){if(t.nodeType===Node.TEXT_NODE){const a=t.textContent??"";return a.length>0?[Ma(a,e)]:[]}if(t.nodeType!==Node.ELEMENT_NODE)return[];const a=t;if("BR"===a.tagName)return[Ma("\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[Ma("",e,n)];const r={...e??{},...Kb(a)??{}},o=[];for(const i of Array.from(a.childNodes))o.push(...Db(i,r));return o}function jb(t){return"P"===t||"DIV"===t||"LI"===t||/^H[1-6]$/.test(t)}function Xb(t){return"UL"===t?"bullet":"OL"===t?"ordered":null}function Jb(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 Yb={H1:"heading1",H2:"heading2",H3:"heading3",H4:"heading3",H5:"heading3",H6:"heading3"};function Qb(t){return t.map(t=>({text:t.text,styles:t.styles,image:t.image}))}function _b(t,e){const a=wa(Qb(Db(t,void 0))),n=Jb(t),r=Yb[t.tagName];return(n||r)&&(a.style={...r?{styleId:r}:{},...n??{}}),e&&(a.list=e),a}function $b(t,e,a){const n=[];for(const r of Array.from(t.children))if("LI"===r.tagName){n.push(_b(r,{kind:e,level:a}));for(const t of Array.from(r.children)){const e=Xb(t.tagName);e&&n.push(...$b(t,e,a+1))}}return n}function ty(t){const e=ny(t).filter(t=>"paragraph"===t.type),a=Number.parseInt(t.getAttribute("colspan")??"",10),n=Number.parseInt(t.getAttribute("rowspan")??"",10);return Sa(e.length>0?e:[xa("")],Number.isFinite(a)&&a>1?a:1,Number.isFinite(n)&&n>1?{rowSpan:n}:void 0)}function ey(t){const e=[];let a=!0;for(const n of Array.from(t.children))"TD"!==n.tagName&&"TH"!==n.tagName||(e.push(ty(n)),"TH"!==n.tagName&&(a=!1));return 0===e.length?null:Aa(e,a?{isHeader:!0}:void 0)}function ay(t){const e=[],a=Array.from(t.querySelectorAll("tr")).filter(e=>e.closest("table")===t);for(const n of a){const t=ey(n);t&&e.push(t)}return 0===e.length?null:Ia(e)}function ny(t){const e=[];for(const a of Array.from(t.childNodes)){if(a.nodeType===Node.TEXT_NODE){(a.textContent??"").trim().length>0&&e.push(ry(Db(a,void 0)));continue}if(a.nodeType!==Node.ELEMENT_NODE)continue;const t=a;if("TABLE"===t.tagName){const a=ay(t);a&&e.push(a);continue}const n=Xb(t.tagName);if(n){e.push(...$b(t,n,0));continue}if(jb(t.tagName)){e.push(_b(t));continue}if(t.children.length>0){e.push(...ny(t));continue}const r=Db(t,void 0);r.length>0&&e.push(ry(r))}return e}function ry(t){return wa(Qb(t))}const oy=[{id:"docx",accept:[".docx"],matches(t){return this.accept.includes(Pp(t.name))},import:(t,e)=>Gb(t,{onProgress:e?(t,a)=>e(Zb[t],a):void 0})},{id:"html",accept:[".html",".htm"],matches(t){return this.accept.includes(Pp(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?ny(a):[];0===n.length&&n.push(xa(""));const r=e.title.trim();return ka(n,void 0,void 0,void 0,r?{title:r}:void 0)}(a);return null==e||e("finishing"),n}}];const iy=["nw","n","ne","e","se","s","sw","w"],ly=24;function sy(t,e,a){const n=Math.max(e,t);return void 0===a?n:Math.min(a,n)}function dy(t,e){return"x"===e?t.includes("e")?1:t.includes("w")?-1:0:t.includes("s")?1:t.includes("n")?-1:0}var cy=ut("<button aria-hidden=true class=oasis-editor-rotate-handle tabindex=-1 type=button>"),hy=ut("<div aria-hidden=true style=transform-origin:center>"),py=ut("<button aria-hidden=true class=oasis-editor-resize-handle tabindex=-1 type=button>");function uy(t){return(e=hy()).$$mousedown=e=>{!t.readOnly&&t.box()&&t.onBodyMouseDown&&(e.preventDefault(),t.onBodyMouseDown(e))},St(e,K(at,{get when(){return!t.readOnly},get children(){return[K(tt,{each:iy,children:e=>{return(a=py()).$$mousedown=a=>{t.box()&&t.onResizeStart(e,a)},gt(a,"data-direction",e),a;var a}}),K(at,{get when(){return t.onRotateStart},get children(){var e=cy();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&&mt(e,a.e=s),d!==a.t&&Mt(e,"display",a.t=d),c!==a.a&&Mt(e,"left",a.a=c),h!==a.o&&Mt(e,"top",a.o=h),p!==a.i&&Mt(e,"width",a.i=p),u!==a.n&&Mt(e,"height",a.n=u),f!==a.s&&Mt(e,"transform",a.s=f),g!==a.h&&Mt(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}ft(["mousedown"]);function fy(t){return Number.isFinite(t)?Math.min(200,Math.max(50,Math.round(t))):100}var gy=ut('<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>%'),my=ut("<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>"),vy=ut("<span class=oasis-editor-import-done-icon>"),by=ut("<span class=oasis-editor-import-error-icon>"),yy=ut("<span>");function My(t){const e=Wt(),a=()=>t.layout??{},n=()=>t.overlays,r=()=>t.refs??{},o=()=>t.surfaceHandlers,i=()=>t.inputHandlers,l=()=>t.fileHandlers;let s,d;const[c,h]=y(),p=()=>Ue(t.state().document).reduce((t,e)=>Math.max(t,e.pageSettings.width),0)||be(t.state().document).width,u=()=>{const t=a().viewportHeight;return"number"==typeof t?`${t}px`:t??"min(72vh, 920px)"},f=w(()=>({width:"100%",height:"100%","max-height":u(),...a().style??{}})),g=w(()=>t.state().document),m=w(()=>De(g()).reduce((t,e)=>t+Te(e),0)),v=w(()=>function(t){const e=De(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}(g())),[b,S]=y(100),A=()=>{var t,e;return(null==(e=(t=a()).zoomPercent)?void 0:e.call(t))??b()},I=t=>{const e=fy(t),n=a().setZoomPercent;n?n(e):S(e)},C=t=>I(A()+t),k=w(()=>fy(A())/100),V=()=>{var t,e;return(null==(e=(t=a()).zoomFactor)?void 0:e.call(t))??k()},[E,R]=y(0),[L,z]=y({width:0,height:0}),N=()=>p()+68,q=w(()=>Math.max(N()*V(),L().width)),O=w(()=>Math.max(E()*V(),L().height)),P=w(()=>Math.max(0,(q()-N()*V())/2));let W=V();x(()=>{const t=V(),e=W;if(W=t,t===e||e<=0)return;const a=d;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 H=w(()=>{var t,e,n,r;return ss(g(),void 0,null==(e=(t=a()).measuredBlockHeights)?void 0:e.call(t),null==(r=(n=a()).measuredParagraphLayouts)?void 0:r.call(n))}),[U,F]=y(null),B=()=>{const t=d;if(!t)return void F(null);const e=Array.from(t.querySelectorAll(".oasis-editor-paper[data-page-index]"));if(0===e.length)return void F(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"))}F(Number.isFinite(r)?r:null)},G=()=>{const e=U();if(null!==e)return Math.max(1,e+1);const a=H(),n=t.state().selection.focus.paragraphId,r=a.pages.findIndex(t=>t.blocks.some(t=>t.sourceBlockId===n));return-1===r?1:r+1},Z=w(()=>n().selectedImageBox()),D=w(()=>n().selectedTextBoxBox()),j=w(()=>{var e;return(null==(e=t.state().document.comments)?void 0:e.items)??{}});return x(()=>{H(),queueMicrotask(B)}),(()=>{var p=gy(),u=p.firstChild,g=u.firstChild,b=g.firstChild,y=b.firstChild,x=y.nextSibling,w=x.nextSibling,S=u.nextSibling,k=S.firstChild,E=k.firstChild,W=E.nextSibling,U=W.nextSibling,F=k.nextSibling,X=F.firstChild,J=X.firstChild,Y=J.nextSibling,Q=Y.nextSibling,_=Q.nextSibling,$=_.firstChild;St(p,K(at,{get when(){return ct(()=>!!a().showHorizontalRuler)()&&n().toolbarHost},get children(){return K(cp,{get state(){return t.state},get toolbarHost(){return n().toolbarHost},viewportRef:c,readOnly:()=>Boolean(a().readOnly),zoomFactor:V})}}),u),vt(u,"contextmenu",o().onEditorContextMenu,!0),vt(u,"mousedown",o().onEditorMouseDown,!0),vt(u,"drop",o().onDrop),vt(u,"dragover",o().onDragOver),wt(t=>{var e,a;d=t,h(t),null==(a=(e=r()).onViewportRef)||a.call(e,t);const n=()=>{B()};t.addEventListener("scroll",n,{passive:!0}),queueMicrotask(B);const o=()=>{z({width:t.clientWidth,height:t.clientHeight})};let i;o(),"undefined"!=typeof ResizeObserver&&(i=new ResizeObserver(o),i.observe(t)),T(()=>{t.removeEventListener("scroll",n),null==i||i.disconnect()})},u),wt(t=>{var e,a;s=t,null==(a=(e=r()).onSurfaceRef)||a.call(e,t);const n=()=>{R(t.offsetHeight)};let o;n(),queueMicrotask(n),"undefined"!=typeof ResizeObserver&&(o=new ResizeObserver(n),o.observe(t)),T(()=>null==o?void 0:o.disconnect())},b),St(b,K(Dh,{get state(){return t.state},get measuredBlockHeights(){return a().measuredBlockHeights},get measuredParagraphLayouts(){return a().measuredParagraphLayouts},viewportRef:()=>d??void 0,get onSurfaceMouseDown(){return o().onSurfaceMouseDown},get onSurfaceClick(){return o().onSurfaceClick},get onSurfaceMouseMove(){return o().onSurfaceMouseMove},get onSurfaceDblClick(){return o().onSurfaceDblClick},get onParagraphMouseDown(){return o().onParagraphMouseDown},get onImageMouseDown(){return o().onImageMouseDown},get onImageResizeHandleMouseDown(){return o().onImageResizeHandleMouseDown},get onTextBoxResizeHandleMouseDown(){return o().onTextBoxResizeHandleMouseDown},get onTableDragHandleMouseDown(){return o().onTableDragHandleMouseDown},get onRevisionMouseEnter(){return o().onRevisionMouseEnter},get onRevisionMouseLeave(){return o().onRevisionMouseLeave}}),y),St(b,K(at,{get when(){return n().hoveredRevision()},children:t=>K(vp,{get box(){return t()}})}),y),St(b,K(at,{get when(){return n().selectionBoxes().length>0},get children(){return K(gp,{get boxes(){return n().selectionBoxes()}})}}),y),St(b,K(at,{get when(){return n().commentHighlights().length>0},get children(){return K(Sp,{get boxes(){return n().commentHighlights},commentsById:j})}}),y),St(b,K(uy,{box:Z,get readOnly(){return Boolean(a().readOnly)},variantClass:"oasis-editor-image-selection-overlay",rotation:()=>{var t;return(null==(t=Z())?void 0:t.rotation)??0},onResizeStart:(t,e)=>{const a=Z();a&&(e.preventDefault(),e.stopPropagation(),o().onImageResizeHandleMouseDown(a.paragraphId,a.startOffset,t,e))},onRotateStart:t=>{const e=Z();e&&o().onImageRotateHandleMouseDown(e.paragraphId,e.startOffset,t)},onBodyMouseDown:t=>{const e=Z();e&&o().onImageMouseDown(e.paragraphId,e.startOffset,t)}}),y),St(b,K(uy,{box:D,get readOnly(){return Boolean(a().readOnly)},variantClass:"oasis-editor-textbox-selection-overlay",rotation:()=>{var t;return(null==(t=D())?void 0:t.rotation)??0},onResizeStart:(t,e)=>{const a=D();a&&(e.preventDefault(),e.stopPropagation(),o().onTextBoxResizeHandleMouseDown(a.paragraphId,a.startOffset,t,e))},onRotateStart:t=>{const e=D();e&&o().onTextBoxRotateHandleMouseDown(e.paragraphId,e.startOffset,t)}}),y),St(b,K(at,{get when(){return ct(()=>!!n().toolbarHost)()&&n().showFloatingTableToolbar},get children(){return K(Ip,{get host(){return n().toolbarHost},get selectionBoxes(){return n().selectionBoxes},get visible(){return n().showFloatingTableToolbar},surfaceRef:()=>s})}}),y),St(b,K(at,{get when(){return n().layoutOptions},children:t=>K(Op,{box:()=>Z()??D(),get layoutOptions(){return t()},surfaceRef:()=>s,get readOnly(){return Boolean(a().readOnly)}})}),y),St(b,K(at,{get when(){return n().showCaret()},get children(){return K(pp,{get active(){return n().focused()},get left(){return n().caretBox().left},get top(){return n().caretBox().top},get height(){return n().caretBox().height}})}}),y),vt(y,"paste",i().onPaste),vt(y,"keydown",i().onKeyDown,!0),vt(y,"input",i().onInput,!0),vt(y,"focus",i().onInputFocus),vt(y,"cut",i().onCut),vt(y,"copy",i().onCopy),vt(y,"compositionstart",i().onCompositionStart),vt(y,"compositionend",i().onCompositionEnd),vt(y,"blur",i().onInputBlur);var tt=r().onTextareaRef;"function"==typeof tt?wt(tt,y):r().onTextareaRef=y,gt(y,"spellcheck",!1),vt(x,"change",l().onImportInputChange);var et=r().onImportInputRef;"function"==typeof et?wt(et,x):r().onImportInputRef=x,vt(w,"change",l().onImageInputChange);var nt=r().onImageInputRef;return"function"==typeof nt?wt(nt,w):r().onImageInputRef=w,St(p,K(at,{get when(){var t,e;return null==(e=(t=n()).importProgress)?void 0:e.call(t)},children:t=>{const a="done"===t().phase,n="error"===t().phase;return i=my(),l=i.firstChild,s=l.firstChild,d=s.nextSibling,c=d.nextSibling,h=c.firstChild,p=c.nextSibling,i.classList.toggle("oasis-editor-import-overlay-done",!!a),i.classList.toggle("oasis-editor-import-overlay-error",!!n),gt(i,"aria-busy",!a&&!n),St(l,K(Ft,{height:40,class:"oasis-editor-loading-mark"}),s),St(s,()=>e("import.overlay.title")),St(d,()=>e(`import.phase.${t().phase}`)),h.classList.toggle("oasis-editor-import-progress-bar-done",!!a),h.classList.toggle("oasis-editor-import-progress-bar-error",!!n),St(p,a?(St(o=vy(),()=>e("import.phase.done")),o):n?(St(r=by(),()=>e("import.phase.error")),r):[ct(()=>Math.round(t().progress)),"%"]),M(e=>{var a=!("applying-editor-state"!==t().phase&&"stabilizing-layout"!==t().phase),n=`${t().progress}%`;return a!==e.e&&h.classList.toggle("oasis-editor-import-progress-bar-indeterminate",e.e=a),n!==e.t&&Mt(h,"width",e.t=n),e},{e:void 0,t:void 0}),i;var r,o,i,l,s,d,c,h,p}}),S),St(E,()=>e("status.words",[v()])),St(W,()=>e("status.characters",[m()])),St(U,()=>e("status.page",[G(),Math.max(1,H().pages.length)])),J.$$click=()=>C(-10),Y.$$input=t=>I(fy(t.currentTarget.valueAsNumber)),gt(Y,"min",50),gt(Y,"max",200),gt(Y,"step",10),Q.$$click=()=>C(10),St(_,A,$),St(F,K(at,{get when(){return n().persistenceStatus},get children(){return(()=>{const t=n().persistenceStatus().toLowerCase(),a=t.includes("saved")?"status.saved":t.includes("saving")?"status.saving":t.includes("error")?"status.error":null;return K(at,{when:a,get children(){var n=yy();return St(n,()=>e(a)),M(()=>mt(n,`oasis-editor-statusbar-item oasis-editor-persistence-status oasis-editor-status-${t.replace("...","ing").replace(".","")}`)),n}})})()}}),null),M(t=>{var r="oasis-editor-editor-shell"+(a().class?` ${a().class}`:""),o=f(),i=`${q()}px`,l=`${O()}px`,s=`${P()}px`,d=`${N()}px`,c=L().height/V()+"px",h=`scale(${V()})`,u=a().readOnly,m=`${n().inputBox().left}px`,v=`${n().inputBox().top}px`,M=`${n().inputBox().height}px`,w=oy.flatMap(t=>t.accept).join(","),S=e("status.zoom"),I=`${e("status.zoom")} -`,T=A()<=50,C=e("status.zoom"),k=`${A()}%`,E=`${e("status.zoom")} +`,R=A()>=200;return r!==t.e&&mt(p,t.e=r),t.t=yt(p,o,t.t),i!==t.a&&Mt(g,"width",t.a=i),l!==t.o&&Mt(g,"height",t.o=l),s!==t.i&&Mt(b,"left",t.i=s),d!==t.n&&Mt(b,"width",t.n=d),c!==t.s&&Mt(b,"min-height",t.s=c),h!==t.h&&Mt(b,"transform",t.h=h),u!==t.r&&(y.readOnly=t.r=u),m!==t.d&&Mt(y,"left",t.d=m),v!==t.l&&Mt(y,"top",t.l=v),M!==t.u&&Mt(y,"height",t.u=M),w!==t.c&&gt(x,"accept",t.c=w),S!==t.w&&gt(X,"aria-label",t.w=S),I!==t.m&&gt(J,"aria-label",t.m=I),T!==t.f&&(J.disabled=t.f=T),C!==t.y&&gt(Y,"aria-label",t.y=C),k!==t.g&&gt(Y,"aria-valuetext",t.g=k),E!==t.p&&gt(Q,"aria-label",t.p=E),R!==t.b&&(Q.disabled=t.b=R),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(()=>Y.value=A()),p})()}ft(["mousedown","contextmenu","input","keydown","click"]);var xy=ut("<button>");function wy(t){const[e,a]=Q(t,["type","icon","label","active","class","classList"]);return xt(n=xy(),Y({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),St(n,K(Ga,{get name(){return e.icon}})),n;var n}var Sy=ut("<aside>"),Ay=ut("<div>");function Iy(t){const[e,a]=Q(t,["mode","width","class","classList","children","style"]);return xt(n=Sy(),Y({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),St(n,()=>e.children),n;var n}function Ty(t){const[e,a]=Q(t,["class","children"]);return xt(n=Ay(),Y({get class(){return`oasis-editor-plugin-side-panel-header ${e.class??""}`}},a),!1,!0),St(n,()=>e.children),n;var n}function Cy(t){const[e,a]=Q(t,["class","children"]);return xt(n=Ay(),Y({get class(){return`oasis-editor-plugin-side-panel-body ${e.class??""}`}},a),!1,!0),St(n,()=>e.children),n;var n}var ky=ut("<button>");function Vy(t){const[e,a]=Q(t,["type","icon","label","active","variant","size","class","classList"]);return xt(n=ky(),Y({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),St(n,K(Ga,{get name(){return e.icon}})),n;var n}var Ey=ut("<div class=oasis-editor-plugin-floating-actions>"),Ry=ut("<div class=oasis-editor-plugin-ui-host><div class=oasis-editor-plugin-ui-main>"),Ly=ut("<div class=oasis-editor-plugin-side-panel-overlay>"),zy=ut("<span class=oasis-editor-plugin-side-panel-icon>"),Ny=ut("<div class=oasis-editor-plugin-side-panel-title><span>");const qy={floatingActions:[],sidePanels:[],activeSidePanelId:null};function Oy(t){const e=Wt(),a=k(()=>t.children),[n,r]=y(qy);x(()=>{const e=t.editor();r(e.ui.getSnapshot());T(e.ui.onChange(()=>{r(e.ui.getSnapshot())}))});const o=w(()=>n().sidePanels.find(t=>t.id===n().activeSidePanelId)),i=()=>{var t;return(null==(t=o())?void 0:t.mode)??"dock"},l=()=>"dock"===i()?o():void 0,s=()=>n().floatingActions.filter(t=>"container"===(t.scope??"container")),d=()=>n().floatingActions.filter(t=>"viewport"===t.scope),c=(a,n=!1)=>K(tt,{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}))}(a())},children:a=>{return St(r=Ey(),K(tt,{get each(){return a.actions},children:a=>K(wy,{get icon(){return a.icon??"sparkles"},get label(){return function(t,e){return t.tooltip?t.tooltip:t.labelKey?e(t.labelKey):t.label??t.id}(a,e)},get disabled(){return!function(t,e){const a=Xt(e.command);return t.commands.canExecute(a.name,a.payload)}(t.editor(),a)},get"data-testid"(){return`plugin-floating-action-${a.id}`},onClick:()=>function(t,e){const a=Xt(e.command);t.commands.execute(a.name,a.payload)}(t.editor(),a)})})),M(t=>bt(r,{[`oasis-editor-plugin-floating-actions-${a.placement}`]:!0,"oasis-editor-plugin-floating-actions-viewport":n},t)),r;var r}});return St((h=Ry()).firstChild,a),St(h,K(at,{get when(){return l()},children:a=>Py(t.editor,a(),e)}),null),St(h,K(at,{get when(){return"overlay"===i()?o():void 0},children:a=>{return St(n=Ly(),()=>Py(t.editor,a(),e)),n;var n}}),null),St(h,()=>c(s),null),St(h,K(at,{get when(){return d().length>0},get children(){return K(Lt,{get children(){return c(d,!0)}})}}),null),M(()=>h.classList.toggle("has-docked-side-panel",!!Boolean(l()))),h;var h}function Py(t,e,a){const n=()=>t().ui.closeSidePanel(e.id);return K(Iy,{get mode(){return e.mode??"dock"},get width(){return e.width},get"data-testid"(){return`plugin-side-panel-${e.id}`},get children(){return[K(Ty,{get children(){return[(r=Ny(),o=r.firstChild,St(r,K(at,{get when(){return e.icon},get children(){var t=zy();return St(t,K(Ga,{get name(){return e.icon}})),t}}),o),St(o,(t=ct(()=>!!e.titleKey),()=>t()?a(e.titleKey):e.title)),r),K(Vy,{icon:"x",label:"Close panel",size:"sm",onClick:n})];var t,r,o}}),K(Cy,{get children(){return e.render({editor:t(),commands:t().commands,ui:t().ui,panelId:e.id,closePanel:n,getState:()=>t().state,getDocument:()=>t().state.document,getSelection:()=>t().state.selection})}})]}})}var Wy=ut("<div class=oasis-editor-main-container><section class=oasis-editor-stage>");function Hy(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=Ps({surface:e,state:t.state});if(!r)return;const o=Hs(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[K(at,{get when(){return t.showChrome},get children(){return[K(at,{get when(){return"compact"===t.toolbarView},get children(){return K(at,{get when(){return t.showTitleBar},get fallback(){return K(at,{get when(){return t.showMenubar},get children(){return K($a,{get host(){return t.toolbarHost},get registry(){return t.menuRegistry}})}})},get children(){return K(an,{get children(){return K(at,{get when(){return t.showMenubar},get children(){return K($a,{get host(){return t.toolbarHost},get registry(){return t.menuRegistry}})}})}})}})}}),K(at,{get when(){return t.showToolbar},get children(){return K(sc,{get host(){return t.toolbarHost},get registry(){return t.toolbarRegistry},get showFileGroup(){return!!ct(()=>"ribbon"===t.toolbarView)()||!t.showMenubar},get view(){return t.toolbarView},get layout(){return t.toolbarLayout}})}})]}}),K(Oy,{get editor(){return t.runtimeEditor},get children(){var i=Wy(),l=i.firstChild;return St(i,K(at,{get when(){return ct(()=>!!t.showChrome)()&&t.showOutline},get children(){return K(Ks,{get state(){return t.state},onNavigate:o,surfaceRef:()=>e,viewportRef:()=>a})}}),l),St(l,K(My,{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 Uy=ut("<div class=oasis-editor-main-container><section class=oasis-editor-stage style=padding:0>"),Fy=ut('<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 By(t){return St(e=Fy(),K(at,{get when(){return ct(()=>!!t.showChrome)()&&t.showToolbar},get children(){return K(sc,{get host(){return t.toolbarHost},get registry(){return t.toolbarRegistry},get view(){return t.toolbarView},get layout(){return t.toolbarLayout}})}}),null),St(e,K(Oy,{get editor(){return t.runtimeEditor},get children(){var e=Uy();return St(e.firstChild,K(My,{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 Gy=ut("<div class=oasis-editor-main-container><section class=oasis-editor-stage style=padding:0>"),Zy=ut("<div class=oasis-balloon-shell>");function Ky(t){return St(e=Zy(),K(Oy,{get editor(){return t.runtimeEditor},get children(){var e=Gy();return St(e.firstChild,K(My,{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 Dy=ut("<div class=oasis-editor-dialog-footer data-testid=editor-dialog-footer>"),jy=ut("<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 Xy(t){const e=Wt();let a;const n=$(),r=w(()=>t.titleId??n),o=w(()=>t.size??"md"),i=w(()=>["oasis-editor-dialog",`oasis-editor-dialog-${o()}`,t.class].filter(Boolean).join(" ")),l=w(()=>["oasis-editor-dialog-body",t.bodyClass].filter(Boolean).join(" ")),s=e=>{"Escape"===e.key&&t.isOpen&&t.onClose()};return I(()=>{window.addEventListener("keydown",s)}),T(()=>{window.removeEventListener("keydown",s)}),K(at,{get when(){return t.isOpen},get children(){var n=jy(),o=n.firstChild,s=o.firstChild,d=s.firstChild,c=d.nextSibling,h=s.nextSibling;n.$$click=()=>{(t.closeOnOverlayClick??1)&&t.onClose()},o.$$click=t=>t.stopPropagation();return"function"==typeof a?wt(a,o):a=o,St(d,()=>t.title),vt(c,"click",t.onClose,!0),St(h,()=>t.children),St(o,K(at,{get when(){return t.footer},get children(){var e=Dy();return St(e,()=>t.footer),e}}),null),M(a=>{var n=i(),s=t.ariaLabel,p=t.ariaLabel?void 0:r(),u=t.ariaDescribedBy,f=r(),g=e("generic.close"),m=l();return n!==a.e&&mt(o,a.e=n),s!==a.t&&gt(o,"aria-label",a.t=s),p!==a.a&&gt(o,"aria-labelledby",a.a=p),u!==a.o&&gt(o,"aria-describedby",a.o=u),f!==a.i&&gt(d,"id",a.i=f),g!==a.n&&gt(c,"title",a.n=g),m!==a.s&&mt(h,a.s=m),a},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),n}})}ft(["click"]);var Jy=ut("<div><div class=oasis-editor-tabs-list role=tablist>"),Yy=ut("<button type=button role=tab class=oasis-editor-tabs-tab>"),Qy=ut("<div role=tabpanel class=oasis-editor-tabs-panel>");function _y(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 $y(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(_y(a(),0,1),!0);if("End"===t.key)return c(_y(a(),a().length-1,-1),!0);const n="ArrowRight"===t.key?1:-1;c(_y(a(),e+n,n),!0)};return p=Jy(),(u=p.firstChild).$$keydown=h,St(u,K(tt,{get each(){return a()},children:(t,a)=>{const n=`${e}-${t.id}-tab`,r=`${e}-${t.id}-panel`;return(o=Yy()).$$click=()=>c(t),wt(t=>{d[a()]=t},o),gt(o,"id",n),gt(o,"aria-controls",r),St(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&&gt(o,"aria-selected",e.e=i),s!==e.t&&gt(o,"aria-disabled",e.t=s),d!==e.a&&(o.disabled=e.a=d),c!==e.o&&gt(o,"tabindex",e.o=c),h!==e.i&&o.classList.toggle("is-active",e.i=h),p!==e.n&&gt(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}})),St(p,K(tt,{get each(){return a()},children:t=>{return St(a=Qy(),()=>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&&gt(a,"id",n.e=i),s!==n.t&&gt(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&&mt(p,e.e=a),n!==e.t&&gt(u,"aria-label",e.t=n),e},{e:void 0,t:void 0}),p;var p,u}ft(["keydown","click"]);var tM=ut("<button><span class=oasis-editor-ui-button-label>");var eM=ut("<span class=oasis-editor-ui-field-label>"),aM=ut("<span class=oasis-editor-ui-field-description>"),nM=ut("<span class=oasis-editor-ui-field-error>"),rM=ut("<label><input class=oasis-editor-ui-input>");ft(["input"]);var oM=ut("<span class=oasis-editor-ui-field-description>"),iM=ut("<span class=oasis-editor-ui-field-error>"),lM=ut("<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 sM=ut("<span class=oasis-editor-ui-field-label>"),dM=ut("<span class=oasis-editor-ui-field-description>"),cM=ut("<span class=oasis-editor-ui-field-error>"),hM=ut("<label><select class=oasis-editor-ui-select>"),pM=ut("<option>");var uM=ut("<div>");const fM=Number.MAX_SAFE_INTEGER;class gM{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??fM)-(e.item.order??fM)||t.index-e.index).map(t=>t.item)}emit(){for(const t of this.listeners)t()}}function mM(){return new gM}class vM{constructor(){a(this,"items",[])}register(t){const e=this.items.findIndex(e=>e.id===t.id);e>=0?this.items[e]=t:this.items.push(t),this.items.sort((t,e)=>(t.order??Number.MAX_SAFE_INTEGER)-(e.order??Number.MAX_SAFE_INTEGER))}unregister(t){this.items=this.items.filter(e=>e.id!==t)}getItems(){return[...this.items]}}const bM=Mn,yM=14.6667;function MM(t){return Number.isFinite(t)?t*bM:0}function xM(t){return MM(t.fontSize??yM)}const wM=[8,9,10,11,12,14,16,18,20,24,28,32,36,48,72];function SM(t){return Math.round(100*MM(t))/100}function AM(t){return Math.round(1e4*(e=t,Number.isFinite(e)?e/bM:0))/1e4;var e}function IM(t){const e=Number(t);return!Number.isFinite(e)||e<=0?"":String(SM(e))}function TM(t){const e=Number(t);return!Number.isFinite(e)||e<=0?null:AM(e)}const CM=[{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 kM=ut("<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>"),VM=ut("<div class=oasis-editor-underline-menu-list>"),EM=ut('<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>'),RM=ut('<span class="oasis-editor-underline-menu-stroke oasis-editor-underline-menu-stroke-svg">'),LM=ut("<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>"),zM=ut("<span class=oasis-editor-underline-menu-stroke>");const NM=/Mac/i.test(navigator.userAgent)?"⌘":"Ctrl",qM="editor-toolbar-underline";function OM(t){const e=Wt(),a=`${e("toolbar.underline")} (${NM}+U)`,n=t.api,[r,o]=y("single"),[i,l]=y(!1),s=()=>n.commands.state("underline").isActive,d=()=>String(n.commands.state("setUnderlineStyle").value??"");return K(vd,{get open(){return i()},onOpenChange:l,tooltip:a,get rootActive(){return i()||s()},mainTestId:qM,get mainPressed(){return s()},onMain:()=>{if(!s()){const t=r();"single"===t||d()||n.commands.execute("setUnderlineStyle",t)}n.commands.execute("underline")},menuTestId:`${qM}-dropdown`,panelClass:"oasis-editor-color-menu oasis-editor-underline-menu",panelRole:"menu",get mainContent(){return t=EM(),e=t.firstChild.nextSibling,M(()=>gt(e,"data-style",(d()||r()||"single").toLowerCase())),t;var t,e},get children(){return[(a=kM(),r=a.firstChild.nextSibling,a.$$click=()=>{s()&&n.commands.execute("underline"),n.commands.execute("setUnderlineStyle",null),l(!1)},St(r,()=>e("toolbar.underlineRemove")),a),(t=VM(),St(t,K(tt,{each:CM,children:t=>{const a=()=>s()&&(d()||(s()?"single":"")).toLowerCase()===t.value.toLowerCase();return r=LM(),i=r.firstChild,c=i.nextSibling,r.$$click=()=>{(t=>{o(t);const e=s();n.commands.execute("setUnderlineStyle","single"===t?null:t),e||n.commands.execute("underline")})(t.value),l(!1)},St(i,K(at,{get when(){return t.preview.svg},get fallback(){return e=zM(),M(a=>yt(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=RM();return M(()=>e.innerHTML=t.preview.svg),e}})),St(c,()=>e(t.labelKey)),M(n=>{var o=!!a(),i=a(),l=`${qM}-style-${t.value}`,s=e(t.labelKey);return o!==n.e&&r.classList.toggle("oasis-editor-underline-menu-item-active",n.e=o),i!==n.t&&gt(r,"aria-checked",n.t=i),l!==n.a&&gt(r,"data-testid",n.a=l),s!==n.o&&gt(r,"title",n.o=s),n},{e:void 0,t:void 0,a:void 0,o:void 0}),r;var r,i,c}})),t)];var t,a,r}})}ft(["click"]);var PM=ut("<option value=decimal>"),WM=ut("<option value=lowerLetter>"),HM=ut("<option value=upperLetter>"),UM=ut("<option value=lowerRoman>"),FM=ut("<option value=upperRoman>"),BM=ut("<option value=bullet>"),GM=ut("<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 ZM=ut('<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>'),KM=ut('<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>'),DM=ut("<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>"),jM=ut('<button class="oasis-editor-dialog-button oasis-editor-dialog-button-secondary"data-testid=editor-line-spacing-dialog-cancel>'),XM=ut('<button class="oasis-editor-dialog-button oasis-editor-dialog-button-primary"data-testid=editor-line-spacing-dialog-apply>');function JM(t){const e=Wt(),[a,n]=y(""),[r,o]=y(""),[i,l]=y("");x(()=>{t.isOpen&&(n(t.initial.lineHeight??""),o(t.initial.spacingBefore??""),l(t.initial.spacingAfter??""))});const s=t=>{if(""===t.trim())return null;const e=Number(t);return Number.isFinite(e)?e:null},d=w(()=>{const t=s(a());return{"line-height":null!==t&&t>0?String(t):void 0}}),c=()=>{t.onApply({lineHeight:s(a()),spacingBefore:s(r()),spacingAfter:s(i())},t.initial),t.onClose()};return K(Xy,{get isOpen(){return t.isOpen},get title(){return e("lineSpacing.title")},get onClose(){return t.onClose},get footer(){return[(n=jM(),vt(n,"click",t.onClose,!0),St(n,()=>e("generic.cancel")),n),(a=XM(),a.$$click=c,St(a,()=>e("generic.apply")),a)];var a,n},get children(){return[(b=ZM(),y=b.firstChild.firstChild,x=y.nextSibling,St(y,()=>e("lineSpacing.lineSpacingLabel")),x.$$input=t=>n(t.currentTarget.value),M(()=>x.value=a()),b),(p=KM(),u=p.firstChild,f=u.firstChild,g=f.nextSibling,m=u.nextSibling.firstChild,v=m.nextSibling,St(f,()=>e("lineSpacing.spacingBeforeLabel")),g.$$input=t=>o(t.currentTarget.value),St(m,()=>e("lineSpacing.spacingAfterLabel")),v.$$input=t=>l(t.currentTarget.value),M(()=>g.value=r()),M(()=>v.value=i()),p),(t=DM(),s=t.firstChild,c=s.nextSibling,h=c.firstChild,St(s,()=>e("lineSpacing.preview")),St(c,()=>e("lineSpacing.previewText"),h),St(c,()=>e("lineSpacing.previewText"),null),M(t=>yt(c,d(),t)),t)];var t,s,c,h,p,u,f,g,m,v,b,y,x}})}ft(["input","click"]);var YM=ut("<div class=oasis-editor-line-spacing-menu-separator role=separator>"),QM=ut('<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>'),_M=ut("<div class=oasis-editor-toolbar-dropdown>"),$M=ut('<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>'),tx=ut('<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">'),ex=ut("<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 ax=[1,1.15,1.5,2,2.5,3];function nx(t){return null==t?"":String(t)}function rx(t){const e=Wt(),a=t.api,[n,r]=y(!1),[o,i]=y(!1),[l,s]=y({lineHeight:"",spacingBefore:"",spacingAfter:""}),d=w(()=>{const t=nx(a.commands.state("setLineHeight").value);if(""===t)return null;const e=Number(t);return Number.isFinite(e)?e:null}),c=()=>r(!1),h=()=>{s({lineHeight:nx(a.commands.state("setLineHeight").value),spacingBefore:nx(a.commands.state("setSpacingBefore").value),spacingAfter:nx(a.commands.state("setSpacingAfter").value)}),i(!0),c()},p=(t,e)=>{const n=e.lineHeight?Number(e.lineHeight):null,r=e.spacingBefore?Number(e.spacingBefore):null,o=e.spacingAfter?Number(e.spacingAfter):null;t.lineHeight!==n&&a.commands.execute("setLineHeight",t.lineHeight),t.spacingBefore!==r&&a.commands.execute("setSpacingBefore",t.spacingBefore),t.spacingAfter!==o&&a.commands.execute("setSpacingAfter",t.spacingAfter),a.focusEditor()};return St(u=_M(),K(rd,{get open(){return n()},onOpenChange:r,panelRole:"menu",panelClass:"oasis-editor-toolbar-dropdown-menu oasis-editor-line-spacing-menu",trigger:t=>{return(a=$M()).$$click=()=>t.toggle(),wt(e=>t.ref(e),a),M(n=>{var r=!!t.open,o=e("metric.lineSpacing"),i=e("metric.lineSpacing"),l=t.open;return r!==n.e&&a.classList.toggle("oasis-editor-tool-button-active",n.e=r),o!==n.t&&gt(a,"title",n.t=o),i!==n.a&&gt(a,"aria-label",n.a=i),l!==n.o&&gt(a,"aria-expanded",n.o=l),n},{e:void 0,t:void 0,a:void 0,o:void 0}),a;var a},get children(){return[K(tt,{each:ax,children:t=>{const n=function(t){return t.toFixed(t===Math.floor(t)?1:2)}(t),r=()=>{const e=d();return null!==e&&(a=e,n=t,Math.abs(a-n)<.001);var a,n};return o=ex(),i=o.firstChild,l=i.nextSibling,o.$$click=()=>(t=>{a.commands.execute("setLineHeight",t),a.focusEditor(),c()})(t),St(i,K(at,{get when(){return r()},get children(){return tx()}})),St(l,n),M(t=>{var a=!!r(),i=r(),l=`editor-toolbar-line-spacing-${n.replace(".","_")}`,s=e("metric.lineSpacingOption",[n]);return a!==t.e&&o.classList.toggle("oasis-editor-line-spacing-item-active",t.e=a),i!==t.t&&gt(o,"aria-checked",t.t=i),l!==t.a&&gt(o,"data-testid",t.a=l),s!==t.o&&gt(o,"title",t.o=s),t},{e:void 0,t:void 0,a:void 0,o:void 0}),o;var o,i,l}}),YM(),(t=QM(),n=t.firstChild.nextSibling,t.$$click=h,St(n,()=>e("metric.lineSpacingOptions")),t)];var t,n}}),null),St(u,K(at,{get when(){return o()},get children(){return K(Lt,{get children(){return K(JM,{get isOpen(){return o()},get initial(){return l()},onClose:()=>i(!1),onApply:p})}})}}),null),u;var u}ft(["click"]);var ox=ut('<div class="oasis-editor-toolbar-panel-section oasis-editor-toolbar-panel-actions">'),ix=ut("<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 lx=(t,e)=>{const a=t.commands.state(e).value;return null==a?"":String(a)};ft(["input"]);var sx=ut('<div class="oasis-editor-toolbar-panel-section oasis-editor-toolbar-panel-actions">'),dx=ut("<div class=oasis-editor-toolbar-badge data-testid=editor-table-selection-label>");function cx(t){const e=Wt(),a=t.api,n=t=>!a.commands.state(t).isEnabled;return K(hd,{icon:"table-properties",testId:"editor-toolbar-table-dropdown",get tooltip(){return e("toolbar.table")},hideChevron:!0,panelClass:"oasis-editor-toolbar-panel oasis-editor-toolbar-table-panel",keepMounted:!0,get children(){return[(s=sx(),St(s,K(ed,{icon:"combine","data-testid":"editor-toolbar-merge-table",get disabled(){return n("tableMerge")},onClick:()=>a.commands.execute("tableMerge"),get tooltip(){return e("table.mergeTooltip")}}),null),St(s,K(ed,{icon:"split","data-testid":"editor-toolbar-split-table",get disabled(){return n("tableSplit")},onClick:()=>a.commands.execute("tableSplit"),get tooltip(){return e("table.splitTooltip")}}),null),s),(l=sx(),St(l,K(ed,{icon:"columns","data-testid":"editor-toolbar-insert-table-column-before",get disabled(){return n("tableInsertColumnBefore")},onClick:()=>a.commands.execute("tableInsertColumnBefore"),get tooltip(){return e("table.insertColumnLeft")}}),null),St(l,K(ed,{icon:"columns","data-testid":"editor-toolbar-insert-table-column-after",get disabled(){return n("tableInsertColumnAfter")},onClick:()=>a.commands.execute("tableInsertColumnAfter"),get tooltip(){return e("table.insertColumnRight")}}),null),St(l,K(ed,{icon:"trash-2","data-testid":"editor-toolbar-delete-table-column",get disabled(){return n("tableDeleteColumn")},onClick:()=>a.commands.execute("tableDeleteColumn"),get tooltip(){return e("table.deleteColumn")}}),null),l),(i=sx(),St(i,K(ed,{icon:"rows","data-testid":"editor-toolbar-insert-table-row-before",get disabled(){return n("tableInsertRowBefore")},onClick:()=>a.commands.execute("tableInsertRowBefore"),get tooltip(){return e("table.insertRowAbove")}}),null),St(i,K(ed,{icon:"rows","data-testid":"editor-toolbar-insert-table-row-after",get disabled(){return n("tableInsertRowAfter")},onClick:()=>a.commands.execute("tableInsertRowAfter"),get tooltip(){return e("table.insertRowBelow")}}),null),St(i,K(ed,{icon:"trash-2","data-testid":"editor-toolbar-delete-table-row",get disabled(){return n("tableDeleteRow")},onClick:()=>a.commands.execute("tableDeleteRow"),get tooltip(){return e("table.deleteRow")}}),null),i),(o=sx(),St(o,K(ed,{icon:"palette","data-testid":"editor-toolbar-table-shading",onClick:()=>{const t=prompt(e("table.cellBgColorPrompt"),"#f1f5f9");null!==t&&a.commands.execute("tableCellShading",t)},get tooltip(){return e("table.cellColor")}}),null),St(o,K(ed,{icon:"frame","data-testid":"editor-toolbar-table-borders",onClick:()=>a.commands.execute("tableCellBorders"),get tooltip(){return e("table.applyBorders")}}),null),St(o,K(ed,{icon:"square","data-testid":"editor-toolbar-table-no-borders",onClick:()=>a.commands.execute("tableCellNoBorders"),get tooltip(){return e("table.removeBorders")}}),null),o),(r=sx(),St(r,K(ed,{icon:"maximize","data-testid":"editor-toolbar-table-width-100",onClick:()=>a.commands.execute("tableWidth100"),get tooltip(){return e("table.width100Tooltip")}})),r),(t=sx(),St(t,K(ed,{icon:"align-left","data-testid":"editor-toolbar-table-align-left",onClick:()=>a.commands.execute("tableAlignLeft"),get tooltip(){return e("table.alignLeft")}}),null),St(t,K(ed,{icon:"align-center","data-testid":"editor-toolbar-table-align-center",onClick:()=>a.commands.execute("tableAlignCenter"),get tooltip(){return e("table.alignCenter")}}),null),St(t,K(ed,{icon:"align-right","data-testid":"editor-toolbar-table-align-right",onClick:()=>a.commands.execute("tableAlignRight"),get tooltip(){return e("table.alignRight")}}),null),St(t,K(ed,{icon:"move-horizontal","data-testid":"editor-toolbar-table-cell-width",onClick:()=>{const t=prompt(e("table.cellWidthPrompt"));t&&a.commands.execute("tableSetCellWidth",t)},get tooltip(){return e("table.cellWidth")}}),null),t),K(at,{get when(){return a.commands.state("tableContext").value},children:t=>{return St(e=dx(),t),e;var e}})];var t,r,o,i,l,s}})}var hx=ut('<div class="oasis-editor-toolbar-panel-section oasis-editor-toolbar-panel-actions">');function px(t){return Math.round(t*xn)}function ux(t){return Math.round(t/xn*100)/100}const fx=[{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 gx(t){return{top:px(t.top),bottom:px(t.bottom),left:px(t.left),right:px(t.right)}}var mx=ut("<div class=oasis-editor-margins-list>"),vx=ut("<div class=oasis-editor-margins-custom-form>"),bx=ut("<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>"),yx=ut("<div class=oasis-editor-margins-custom-actions><button type=button class=oasis-editor-margins-custom-apply data-testid=editor-toolbar-margins-custom-apply>"),Mx=ut("<button type=button class=oasis-editor-margins-item><span class=oasis-editor-margins-item-name></span><span class=oasis-editor-margins-item-values><br>"),xx=ut("<label class=oasis-editor-margins-custom-field><span></span><input type=number min=0 step=0.1>");const wx=[{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 Sx(t){const e=Wt(),a=t=>e("section.marginValue",[String(t).replace(".",e("number.decimalSeparator"))]),n=t.api,[r,o]=y(!1),[i,l]=y({}),s=w(()=>n.commands.state("setPageMargins").value),d=w(()=>{var t;const e=s();if(e)return null==(t=fx.find(t=>function(t,e){const a=gx(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}),c=()=>{const t=s();l({top:t?String(ux(t.top)):"",bottom:t?String(ux(t.bottom)):"",left:t?String(ux(t.left)):"",right:t?String(ux(t.right)):""}),o(t=>!t)},h=()=>{const t=i(),e={};for(const{key:a}of wx){const n=t[a];if(null==n||""===n)continue;const r=Number(n.replace(",","."));Number.isFinite(r)&&r>=0&&(e[a]=px(r))}Object.keys(e).length>0&&n.commands.execute("setPageMargins",e),n.focusEditor()};return K(hd,{icon:"square-dashed",get label(){return e("section.margins")},testId:"editor-toolbar-margins-dropdown",get tooltip(){return e("section.margins")},panelClass:"oasis-editor-toolbar-panel oasis-editor-margins-panel",keepMounted:!0,get children(){return[(p=mx(),St(p,K(tt,{each:fx,children:t=>{return r=Mx(),o=r.firstChild,i=o.nextSibling,l=i.firstChild,r.$$click=()=>(t=>{n.commands.execute("setPageMargins",gx(t)),n.focusEditor()})(t),St(o,()=>e(t.labelKey)),St(i,()=>`${e("section.marginField.top")} ${a(t.top)} ${e("section.marginField.bottom")} ${a(t.bottom)}`,l),St(i,()=>`${e("section.marginField.left")} ${a(t.left)} ${e("section.marginField.right")} ${a(t.right)}`,null),M(e=>{var a=!(d()!==t.id),n=`editor-toolbar-margins-${t.id}`;return a!==e.e&&r.classList.toggle("oasis-editor-margins-item-active",e.e=a),n!==e.t&&gt(r,"data-testid",e.t=n),e},{e:void 0,t:void 0}),r;var r,o,i,l}})),p),(t=bx(),o=t.firstChild,s=o.firstChild.nextSibling,o.$$click=c,St(s,()=>e("section.marginPreset.custom")),St(t,K(at,{get when(){return r()},get children(){var t=vx();return St(t,K(tt,{each:wx,children:t=>{return a=xx(),n=a.firstChild,r=n.nextSibling,St(n,()=>e(t.labelKey)),r.$$input=e=>l(a=>({...a,[t.key]:e.currentTarget.value})),M(()=>r.value=i()[t.key]??""),a;var a,n,r}})),t}}),null),t),K(at,{get when(){return r()},get children(){var t=yx(),a=t.firstChild;return a.$$click=h,St(a,()=>e("section.marginApply")),t}})];var t,o,s,p}})}ft(["click","input"]);const Ax=/Mac/i.test(navigator.userAgent)?"⌘":"Ctrl",Ix=t=>t.commands.state("documentStyles").value??[],Tx=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 Ix(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}))},Cx=t=>{const e=new Set(wM);for(const n of Ix(t))"number"==typeof n.fontSize&&Number.isFinite(n.fontSize)&&e.add(SM(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)}))},kx=t=>Ix(t).map(t=>({value:t.id,label:t.name})),Vx=[{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"}],Ex=[{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"}],Rx={"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 Lx(t){const e=[];e.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"}]}}),e.push({type:"separator",id:"sep-file",group:"file"}),e.push({type:"button",id:"editor-toolbar-undo",testId:"editor-toolbar-undo",iconName:"undo",command:"undo",tooltip:`${t("toolbar.undo")} (${Ax}+Z)`}),e.push({type:"button",id:"editor-toolbar-redo",testId:"editor-toolbar-redo",iconName:"redo",command:"redo",tooltip:`${t("toolbar.redo")} (${Ax}+Shift+Z)`}),e.push({type:"separator",id:"sep-history"}),e.push({type:"select",id:"editor-toolbar-style",testId:"editor-toolbar-style",width:"wide",tooltipKey:"toolbar.style",command:"setStyleId",options:kx}),e.push({type:"select",id:"editor-toolbar-font-family",testId:"editor-toolbar-font-family",tooltipKey:"toolbar.fontFamily",placeholder:t("toolbar.font"),command:"setFontFamily",options:Tx}),e.push({type:"select",id:"editor-toolbar-font-size",testId:"editor-toolbar-font-size",width:"small",tooltipKey:"toolbar.fontSize",command:"setFontSize",options:Cx}),e.push({type:"button",id:"editor-toolbar-font-increase",testId:"editor-toolbar-font-increase",iconName:"a-arrow-up",command:"increaseFontSize",tooltipKey:"toolbar.increaseFontSize"}),e.push({type:"button",id:"editor-toolbar-font-decrease",testId:"editor-toolbar-font-decrease",iconName:"a-arrow-down",command:"decreaseFontSize",tooltipKey:"toolbar.decreaseFontSize"}),e.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"}}]}}),e.push({type:"button",id:"editor-toolbar-clear-formatting",testId:"editor-toolbar-clear-formatting",iconName:"remove-formatting",command:"clearFormatting",tooltipKey:"toolbar.clearFormatting"}),e.push({type:"toggle",id:"editor-toolbar-bold",testId:"editor-toolbar-bold",iconName:"bold",command:"bold",tooltipKey:"toolbar.bold"}),e.push({type:"toggle",id:"editor-toolbar-italic",testId:"editor-toolbar-italic",iconName:"italic",command:"italic",tooltipKey:"toolbar.italic"}),e.push({type:"custom",id:"editor-toolbar-underline-control",render:t=>OM({api:t})}),e.push({type:"toggle",id:"editor-toolbar-strike",testId:"editor-toolbar-strike",iconName:"strikethrough",command:"strike",tooltipKey:"toolbar.strike"}),e.push({type:"toggle",id:"editor-toolbar-subscript",testId:"editor-toolbar-subscript",iconName:"subscript",command:"subscript",tooltipKey:"toolbar.subscript"}),e.push({type:"toggle",id:"editor-toolbar-superscript",testId:"editor-toolbar-superscript",iconName:"superscript",command:"superscript",tooltipKey:"toolbar.superscript"}),e.push({type:"separator",id:"sep-format"}),e.push({type:"colorPicker",id:"editor-toolbar-color",testId:"editor-toolbar-color",kind:"color",iconName:"type",defaultValue:"#111827",tooltipKey:"toolbar.color",command:"setColor"}),e.push({type:"colorPicker",id:"editor-toolbar-highlight",testId:"editor-toolbar-highlight",kind:"highlight",iconName:"highlighter",defaultValue:"#fef08a",tooltipKey:"toolbar.highlight",command:"setHighlight"}),e.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"}),e.push({type:"separator",id:"sep-style"}),e.push({type:"button",id:"editor-toolbar-insert-image",testId:"editor-toolbar-insert-image",iconName:"image",tooltipKey:"toolbar.image",command:"insertImage"}),e.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"}}]}}),e.push({type:"gridPicker",id:"editor-toolbar-insert-table",testId:"editor-toolbar-insert-table",tooltipKey:"toolbar.table",command:"insertTable"}),e.push({type:"button",id:"editor-toolbar-link",testId:"editor-toolbar-link",iconName:"link",command:"link",tooltip:`${t("toolbar.link")} (${Ax}+K)`}),e.push({type:"button",id:"editor-toolbar-unlink",testId:"editor-toolbar-unlink",iconName:"unlink",command:"unlink",tooltipKey:"toolbar.unlink"}),e.push({type:"button",id:"editor-toolbar-footnote",testId:"editor-toolbar-footnote",iconName:"footnote",command:"insertFootnote",tooltip:`${t("toolbar.footnote")} (${Ax}+Alt+F)`}),e.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}),e.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}),e.push({type:"separator",id:"sep-insert"});for(const a of Vx)e.push({type:"toggle",id:a.testId,testId:a.testId,iconName:a.icon,command:a.command,tooltipKey:a.tooltipKey});for(const a of Ex)e.push({type:"toggle",id:a.testId,testId:a.testId,iconName:a.icon,command:a.command,tooltipKey:a.tooltipKey});return e.push({type:"button",id:"editor-toolbar-list-outdent",testId:"editor-toolbar-list-outdent",iconName:"indent-decrease",tooltipKey:"toolbar.decreaseIndent",command:"outdent"}),e.push({type:"button",id:"editor-toolbar-list-indent",testId:"editor-toolbar-list-indent",iconName:"indent-increase",tooltipKey:"toolbar.increaseIndent",command:"indent"}),e.push({type:"custom",id:"editor-toolbar-list-options",render:t=>function(t){const e=Wt(),a=t.api;return K(hd,{icon:"list-filter",get tooltip(){return e("toolbar.listFormat")},testId:"editor-toolbar-list-options-dropdown",hideChevron:!0,get children(){var t=GM(),n=t.firstChild,r=n.firstChild,o=n.nextSibling.firstChild,i=o.nextSibling;return St(r,()=>e("toolbar.listFormat")),St(n,K(ud,{"data-testid":"editor-toolbar-list-format",onChange:t=>a.commands.execute("setListFormat",t.currentTarget.value),get tooltip(){return e("toolbar.listFormat")},get children(){return[(i=PM(),St(i,()=>e("toolbar.formatDecimal")),i),(o=WM(),St(o,()=>e("toolbar.formatLowerLetter")),o),(r=HM(),St(r,()=>e("toolbar.formatUpperLetter")),r),(n=UM(),St(n,()=>e("toolbar.formatLowerRoman")),n),(a=FM(),St(a,()=>e("toolbar.formatUpperRoman")),a),(t=BM(),St(t,()=>e("toolbar.formatBullet")),t)];var t,a,n,r,o,i}}),null),St(o,()=>e("toolbar.listStartAt")),i.addEventListener("change",t=>a.commands.execute("setListStartAt",t.currentTarget.value)),M(()=>gt(i,"title",e("toolbar.listStartAt"))),t}})}({api:t})}),e.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}]}}),e.push({type:"custom",id:"editor-toolbar-line-spacing-control",render:t=>rx({api:t})}),e.push({type:"separator",id:"sep-paragraph"}),e.push({type:"custom",id:"editor-toolbar-metrics",render:t=>function(t){const e=Wt(),a=t.api,n=t=>e=>a.commands.execute(t,e.currentTarget.value);return K(hd,{icon:"sliders-horizontal",testId:"editor-toolbar-metrics-dropdown",get tooltip(){return e("metric.leftIndent")},hideChevron:!0,panelClass:"oasis-editor-toolbar-panel",keepMounted:!0,get children(){return[(y=ox(),St(y,K(ed,{icon:"file-up",get active(){return a.commands.state("togglePageBreakBefore").isActive},"data-testid":"editor-toolbar-page-break-before",onClick:()=>a.commands.execute("togglePageBreakBefore"),get tooltip(){return e("metric.pageBreakBefore")}}),null),St(y,K(ed,{icon:"link-2",get active(){return a.commands.state("toggleKeepWithNext").isActive},"data-testid":"editor-toolbar-keep-with-next",onClick:()=>a.commands.execute("toggleKeepWithNext"),get tooltip(){return e("metric.keepWithNext")}}),null),y),(t=ix(),r=t.firstChild,o=r.firstChild,i=o.nextSibling,l=r.nextSibling,s=l.firstChild,d=s.nextSibling,c=l.nextSibling,h=c.firstChild,p=h.nextSibling,u=c.nextSibling,f=u.firstChild,g=f.nextSibling,m=u.nextSibling,v=m.firstChild,b=v.nextSibling,St(o,()=>e("metric.after")),vt(i,"change",n("setSpacingAfter")),St(s,()=>e("metric.indent")),vt(d,"change",n("setIndentLeft")),St(h,()=>e("metric.first")),vt(p,"change",n("setIndentFirstLine")),St(f,()=>e("metric.hang")),vt(g,"change",n("setIndentHanging")),St(v,()=>e("metric.paraBg")),b.$$input=t=>a.commands.execute("setParagraphShading",t.currentTarget.value),St(t,K(ed,{icon:"frame","data-testid":"editor-toolbar-paragraph-borders",onClick:()=>a.commands.execute("applyParagraphBorders"),get tooltip(){return e("metric.applyBorders")}}),null),M(t=>{var a=e("metric.spacingAfter"),n=e("metric.leftIndent"),o=e("metric.firstLineIndent"),i=e("metric.hangingIndent"),s=e("metric.paragraphBgColor");return a!==t.e&&gt(r,"title",t.e=a),n!==t.t&&gt(l,"title",t.t=n),o!==t.a&&gt(c,"title",t.a=o),i!==t.o&&gt(u,"title",t.o=i),s!==t.i&&gt(m,"title",t.i=s),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),M(()=>i.value=lx(a,"setSpacingAfter")),M(()=>d.value=lx(a,"setIndentLeft")),M(()=>p.value=lx(a,"setIndentFirstLine")),M(()=>g.value=lx(a,"setIndentHanging")),M(()=>b.value=lx(a,"setParagraphShading")||"#ffffff"),t)];var t,r,o,i,l,s,d,c,h,p,u,f,g,m,v,b,y}})}({api:t})}),e.push({type:"separator",id:"sep-metrics"}),e.push({type:"custom",id:"editor-toolbar-table",isVisible:t=>t.commands.state("tableContext").isActive,render:t=>cx({api:t})}),e.push({type:"separator",id:"sep-table",isVisible:t=>t.commands.state("tableContext").isActive}),e.push({type:"custom",id:"editor-toolbar-margins",ribbonSize:"large",render:t=>Sx({api:t})}),e.push({type:"custom",id:"editor-toolbar-section",ribbonSize:"large",render:t=>function(t){const e=Wt(),a=t.api;return K(hd,{icon:"layout-template",get label(){return e("section.orientation")},testId:"editor-toolbar-section-dropdown",get tooltip(){return e("section.pageSetup")},panelClass:"oasis-editor-toolbar-panel",keepMounted:!0,get children(){return[(n=hx(),St(n,K(ed,{icon:"rectangle-vertical",get active(){return!a.commands.state("toggleOrientation").isActive},"data-testid":"editor-toolbar-orientation-portrait",onClick:()=>a.commands.execute({name:"setOrientation",payload:"portrait"}),get tooltip(){return e("section.portrait")}}),null),St(n,K(ed,{icon:"rectangle-horizontal",get active(){return a.commands.state("toggleOrientation").isActive},"data-testid":"editor-toolbar-orientation-landscape",onClick:()=>a.commands.execute({name:"setOrientation",payload:"landscape"}),get tooltip(){return e("section.landscape")}}),null),n),(t=hx(),St(t,K(ed,{icon:"scissors","data-testid":"editor-toolbar-section-break-next",onClick:()=>a.commands.execute("sectionBreakNextPage"),get tooltip(){return e("section.secNextTooltip")}}),null),St(t,K(ed,{icon:"scissors","data-testid":"editor-toolbar-section-break-continuous",onClick:()=>a.commands.execute("sectionBreakContinuous"),get tooltip(){return e("section.secContTooltip")}}),null),t)];var t,n}})}({api:t})}),function(t){return t.map((t,e)=>{const a=Rx[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}})}(e)}function zx(t,e){const a=ga(t);if(a.isCollapsed||a.startIndex!==a.endIndex||a.endParagraphOffset-a.startParagraphOffset!==1)return null;const n=da(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 Nx(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 qx(t){return t?t.behindDoc?"behind":t.wrap&&"none"!==t.wrap?t.wrap:"front":"inline"}function Ox(t,e){return{...t,positionV:{...t.positionV??{},relativeFrom:e?"page":"paragraph"}}}function Px(t){var e;return"page"===(null==(e=null==t?void 0:t.positionV)?void 0:e.relativeFrom)}function Wx(t){return t?{...t}:void 0}function Hx(t,e){return JSON.stringify(t??null)===JSON.stringify(e??null)}function Ux(t,e,a){const n={...t??{}};return a?n[e]=!0:delete n[e],Object.keys(n).length>0?n:void 0}function Fx(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 Bx(t,e,a){const n={...t??{}};return null==a?delete n[e]:n[e]=a,Object.keys(n).length>0?n:void 0}function Gx(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:Xx(t.blocks)}}function Zx(t){return{...t,styles:Wx(t.styles),image:t.image?{...t.image}:void 0,textBox:t.textBox?Gx(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 Kx(t){return{...t,runs:t.runs.map(Zx),style:t.style?{...t.style}:void 0,list:t.list?{...t.list}:void 0}}function Dx(t){return t?{...t}:void 0}function jx(t){return t.map(Kx)}function Xx(t){return t.map(t=>"paragraph"===t.type?Kx(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:jx(t.blocks)}))}))})}function Jx(t){const e=ya("");return e.fieldChar={kind:t},e}function Yx(t){const e=ya("");return e.fieldInstruction=t,e}function Qx(t,e,a){const n=wa([{text:`${e} `},{text:String(a)},{text:t?`: ${t}`:""}]);return n.style={styleId:"Caption",align:"center"},n.runs=[n.runs[0],Jx("begin"),Yx(" SEQ Figure \\* ARABIC "),Jx("separate"),n.runs[1],Jx("end"),n.runs[2]],n}function _x(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 $x(t,e){if(!_x(t))return Kx(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?{...Kx(t),runs:r}:Kx(t)}function tw(t,e){return t.map(t=>"paragraph"===t.type?_x(t)?$x(t,e.next++):Kx(t):{...t,rows:t.rows.map(t=>({...t,cells:t.cells.map(t=>({...t,blocks:tw(t.blocks,e)}))}))})}function ew(t){const e={next:1},a=Ue(t).map(t=>({...t,blocks:tw(t.blocks,e),header:t.header?Xx(t.header):void 0,footer:t.footer?Xx(t.footer):void 0}));return{...t,sections:a}}function aw(t){return Boolean(t.image||t.textBox)}function nw(t,e){const a=[];for(const n of t){if(0===n.text.length)continue;const t=a[a.length-1];!t||aw(n)||aw(t)||!Hx(t.styles,n.styles)?a.push({...n,styles:Wx(n.styles)}):t.text+=n.text}return a.length>0?a:[Ma("",e)]}function rw(t,e,a){return{...t,runs:nw(e,a),style:t.style?{...t.style}:void 0}}function ow(t){return wa(t)}function iw(t,e){const a=ow(e);return a.style=t.style?{...t.style}:void 0,a.list=Dx(t.list),a}function lw(t,e){const a=Kx(t);return a.list?(a.list={...a.list,level:Math.max(0,e)},a):a}function sw(t){const e=Kx(t);return delete e.list,e}function dw(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 Wx(a.styles);if(e===o){if(a.text.length>0)return Wx(a.styles);const e=t.runs[r+1];return Wx((null==e?void 0:e.styles)??a.styles)}n=o}return Wx(null==(a=t.runs[t.runs.length-1])?void 0:a.styles)}function cw(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 hw(t,e,a){const n=Math.max(0,Math.min(e,Te(t))),r=Math.max(n,Math.min(a,Te(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=Gx(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 pw(t,e,a){const n=hw(t,0,e),r=hw(t,e,Te(t)),o=dw(t,e);return rw(t,[...n,...a.map(t=>({...t,styles:Wx(t.styles??o)})),...r],o)}function uw(t){const e=[],a=new Map,n=[];let r=0;for(const o of t){const t=Ie(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 fw(t,e,a){return t<e?e:t>a?a:t}function gw(t,e,a){const n=uw(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=uw(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+fw(t.offset,0,i-e),r=fw(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 mw(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 vw(t,e,a){const n=la(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=mw(o.blocks,e);return{...t,document:{...t.document,footnotes:{...r,items:{...r.items,[n]:{...o,blocks:i}}}},selection:a}}const r=Ue(t.document),o=Math.max(0,Math.min(ia(t),r.length-1)),i=r[o];if(!i)return{...t,selection:a};const l=function(t,e,a){return"header"===a?{...t,header:mw(t.header??[],e)}:"footer"===a?{...t,footer:mw(t.footer??[],e)}:{...t,blocks:mw(t.blocks,e)}}(i,e,n),s=[...r];s[o]=l;const d=t.document.bookmarks,c=d&&d.order.length>0?gw(d,da(t),e):d;return{...t,document:{...t.document,sections:s,...c!==d?{bookmarks:c}:{}},selection:a}}function bw(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 yw(t){return ua(t)}function Mw(t){const e=da(t),a=ha(t,t.selection.focus),n=ca(e,a.paragraphId),r=e[n];return{paragraph:r,index:n,offset:ke(r,a)}}function xw(t){const e=ga(t);if(e.isCollapsed)return t;const a=da(t);if(t.trackChangesEnabled){const n=`rev:${Math.random().toString(36).slice(2,9)}`,r="User",o=Date.now();return vw(t,a.map((t,a)=>{if(a<e.startIndex||a>e.endIndex)return Kx(t);return ww(t,a===e.startIndex?e.startParagraphOffset:0,a===e.endIndex?e.endParagraphOffset:Te(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}}})}),yw(e.start))}const n=a[e.startIndex],r=a[e.endIndex],o=ke(n,e.start),i=ke(r,e.end),l=rw(n,[...hw(n,0,o),...hw(r,i,Te(r))]);return vw(t,[...jx(a.slice(0,e.startIndex)),l,...jx(a.slice(e.endIndex+1))],yw(Ce(l,o)))}function ww(t,e,a,n){return rw(t,[...hw(t,0,e),...hw(t,e,a).map(n),...hw(t,a,Te(t))])}function Sw(t,e){const a=t[e.startIndex],n=t[e.endIndex];return{anchor:Ce(a,e.startParagraphOffset),focus:Ce(n,e.endParagraphOffset)}}function Aw(t,e){const a=ga(t);return a.isCollapsed?t:{document:t.document,selection:yw("start"===e?a.start:a.end)}}function Iw(t){return zx(t,t=>Boolean(t.image))}function Tw(t,e){const a=Iw(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=da(t),{paragraphIndex:o,run:i}=a,l=r.map((t,e)=>e!==o?Kx(t):{...Kx(t),runs:t.runs.map(t=>t.id===i.id&&t.image?{...t,image:{...t.image,rotation:n}}:Zx(t))});return vw(t,l,Sw(l,ga(t)))}function Cw(t,e){const a=Iw(t);if(!(null==a?void 0:a.run.image))return t;const n=da(t),{paragraphIndex:r,run:o}=a,i=n.map((t,a)=>a!==r?Kx(t):{...Kx(t),runs:t.runs.map(t=>{if(t.id!==o.id||!t.image)return Zx(t);const a=e(t.image.floating),n={...t.image};return a?n.floating=a:delete n.floating,{...t,image:n}})});return vw(t,i,Sw(i,ga(t)))}function kw(t){const e=Iw(t);if(!(null==e?void 0:e.run.image))return null;return function(t){var e;if(!_x(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]+/,"")}(da(t)[e.paragraphIndex+1])}function Vw(t,e,a){const n=Iw(t);if(!(null==n?void 0:n.run.image))return t;const r=da(t),o=n.paragraphIndex+1,i=o<r.length&&_x(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=Qx(e,a,Number.parseInt(r,10)||1);return o.id=t.id,o}(r[o],e,a):Qx(e,a,1),l=function(t){let e=1;return t.map(t=>_x(t)?$x(t,e++):Kx(t))}(o<r.length&&_x(r[o])?[...jx(r.slice(0,o)),i,...jx(r.slice(o+1))]:[...jx(r.slice(0,o)),i,...jx(r.slice(o))]),s=l[o]??i;return vw(t,l,yw(Ce(s,Te(s))))}function Ew(t,e){const a=Iw(t);if(!a)return t;const n=da(t),{paragraphIndex:r,offset:o,run:i}=a,l=ca(n,e.paragraphId);if(l<0)return t;const s=ke(n[l],e),d=l===r&&s>o?s-1:s;if(l===r&&d===o)return t;const c=t=>rw(t,[...hw(t,0,o),...hw(t,o+1,Te(t))]),h=(t,e)=>pw(t,Math.max(0,Math.min(e,Te(t))),[Ma("",dw(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):jx([t])[0]),u=p[l];return vw(t,p,yw(Ce(u,Math.max(0,Math.min(d+1,Te(u))))))}function Rw(t){return zx(t,t=>Boolean(t.textBox))}function Lw(t,e){const a=Rw(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=da(t).map((t,e)=>e!==r?Kx(t):{...Kx(t),runs:t.runs.map(t=>t.id===o.id&&t.textBox?{...t,textBox:{...t.textBox,rotation:n}}:Zx(t))});return vw(t,i,Sw(i,ga(t)))}function zw(t,e){const a=Rw(t);if(!(null==a?void 0:a.run.textBox))return t;const{paragraphIndex:n,run:r}=a,o=da(t).map((t,a)=>a!==n?Kx(t):{...Kx(t),runs:t.runs.map(t=>{if(t.id!==r.id||!t.textBox)return Zx(t);const a=e(t.textBox.floating),n={...t.textBox};return a?n.floating=a:delete n.floating,{...t,textBox:n}})});return vw(t,o,Sw(o,ga(t)))}function Nw(t,e,a,n={}){const r=Rw(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=da(t).map((t,e)=>e!==h?Kx(t):{...Kx(t),runs:t.runs.map(t=>{var e;if(t.id!==p.id||!t.textBox)return Zx(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)-e*wn}})}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)-a*wn}})}return o}(a.floating,u,f,l,s)),{...t,textBox:n}})});return vw(t,g,Sw(g,ga(t)))}function qw(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 Ow(t){var e,a,n,r,o,i;return{...t,blocks:t.blocks.map(qw),header:null==(e=t.header)?void 0:e.map(qw),firstPageHeader:null==(a=t.firstPageHeader)?void 0:a.map(qw),evenPageHeader:null==(n=t.evenPageHeader)?void 0:n.map(qw),footer:null==(r=t.footer)?void 0:r.map(qw),firstPageFooter:null==(o=t.firstPageFooter)?void 0:o.map(qw),evenPageFooter:null==(i=t.evenPageFooter)?void 0:i.map(qw)}}function Pw(t){return{...t,blocks:t.blocks.map(qw)}}function Ww(t){var e,a;if(!t)return;const n={};for(const[r,o]of Object.entries(t.items))n[r]=Pw(o);return{items:n,settings:t.settings?{...t.settings}:void 0,separator:null==(e=t.separator)?void 0:e.map(qw),continuationSeparator:null==(a=t.continuationSeparator)?void 0:a.map(qw)}}function Hw(t){return{...t,blocks:t.blocks.map(qw)}}function Uw(t){var e,a;if(!t)return;const n={};for(const[r,o]of Object.entries(t.items))n[r]=Hw(o);return{items:n,settings:t.settings?{...t.settings}:void 0,separator:null==(e=t.separator)?void 0:e.map(qw),continuationSeparator:null==(a=t.continuationSeparator)?void 0:a.map(qw)}}function Fw(t){var e;return{...t,document:{...t.document,sections:null==(e=t.document.sections)?void 0:e.map(Ow),footnotes:Ww(t.document.footnotes),endnotes:Uw(t.document.endnotes)},selection:{anchor:{...t.selection.anchor},focus:{...t.selection.focus}},activeSectionIndex:t.activeSectionIndex??0,activeZone:t.activeZone??"main",activeFootnoteId:t.activeFootnoteId}}function Bw(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(Fe(r).some(t=>t.id===l))return t}const s=t=>{const e=t.findIndex(t=>t.id===l||"table"===t.type&&Fe(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=ia(t),c=la(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 Gw(t){const e=fa(t.selection)?t:xw(t),{paragraph:a,index:n,offset:r}=Mw(e),o=rw(a,hw(a,0,r),dw(a,r)),i=hw(a,r,Te(a)),l=i.length>0?iw(a,i.map(t=>({text:t.text,styles:t.styles}))):(()=>{const t=xa("");return t.style=a.style?{...a.style}:void 0,t.list=a.list?{...a.list}:void 0,t})(),s=da(e);return vw(e,[...jx(s.slice(0,n)),o,l,...jx(s.slice(n+1))],yw(Ce(l,0)))}function Zw(t){const e=fa(t.selection)?t:xw(t),{paragraph:a,index:n,offset:r}=Mw(e),o=rw(a,hw(a,0,r),dw(a,r)),i=hw(a,r,Te(a)),l=i.length>0?iw(a,i.map(t=>({text:t.text,styles:t.styles}))):(()=>{const t=xa("");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=da(e);return vw(e,[...jx(s.slice(0,n)),o,l,...jx(s.slice(n+1))],yw(Ce(l,0)))}function Kw(t,e,a){const n=ga(t),r=da(t),o=n.startIndex,i=n.endIndex,l=r.map((t,n)=>n<o||n>i?Kx(t):{...Kx(t),style:Bx(t.style,e,a)});return vw(t,l,Sw(l,n))}function Dw(t,e){return{document:t.document,selection:e}}function jw(t,e){if(!fa(t.selection))return Aw(t,e<0?"start":"end");const{index:a,offset:n}=Mw(t),r=da(t),o=a+e;if(o<0||o>=r.length)return t;const i=r[o];return Dw(t,yw(Ce(i,Math.min(n,Te(i)))))}function Xw(t,e){const a=ha(t,t.selection.focus),n=da(t),r=ca(n,a.paragraphId),o=n[r],i=ke(o,a),l=Te(o);if(e<0&&i>0)return Dw(t,{anchor:t.selection.anchor,focus:Ce(o,i-1)});if(e>0&&i<l)return Dw(t,{anchor:t.selection.anchor,focus:Ce(o,i+1)});if(e<0&&r>0){const e=n[r-1];return Dw(t,{anchor:t.selection.anchor,focus:Ce(e,Te(e))})}if(e>0&&r<n.length-1){const e=n[r+1];return Dw(t,{anchor:t.selection.anchor,focus:Ce(e,0)})}return t}function Jw(t,e){const a=ha(t,t.selection.focus),n=da(t),r=ca(n,a.paragraphId),o=ke(n[r],a),i=r+e;if(i<0||i>=n.length)return t;const l=n[i];return Dw(t,{anchor:t.selection.anchor,focus:Ce(l,Math.min(o,Te(l)))})}function Yw(t){const e=ga(t);if(e.isCollapsed)return"";const a=da(t);if(e.startIndex===e.endIndex){return Ie(a[e.startIndex]).slice(e.startParagraphOffset,e.endParagraphOffset)}const n=[],r=a[e.startIndex],o=a[e.endIndex];n.push(Ie(r).slice(e.startParagraphOffset));for(let i=e.startIndex+1;i<e.endIndex;i+=1)n.push(Ie(a[i]));return n.push(Ie(o).slice(0,e.endParagraphOffset)),n.join("\n")}function Qw(t,e){return{...t,selection:{anchor:ha(t,e.anchor),focus:ha(t,e.focus)}}}function _w(t){if(!fa(t.selection))return Aw(t,"start");const{paragraph:e,index:a,offset:n}=Mw(t),r=da(t);if(n>0)return{document:t.document,selection:yw(Ce(e,n-1))};if(0===a)return t;const o=r[a-1];return{document:t.document,selection:yw(Ce(o,Te(o)))}}function $w(t){if(!fa(t.selection))return Aw(t,"end");const{paragraph:e,index:a,offset:n}=Mw(t),r=da(t);if(n<Te(e))return{document:t.document,selection:yw(Ce(e,n+1))};if(a>=r.length-1)return t;const o=r[a+1];return{document:t.document,selection:yw(Ce(o,0))}}function tS(t){if("main"!==(t.activeZone??"main"))return t;const e=fa(t.selection)?t:xw(t),{paragraph:a,index:n,offset:r}=Mw(e),o=function(){const t=[Ta("",{styleId:"footnoteText"})];return{id:ma("footnote"),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 Kl(t)){const t=l.footnoteReference;t&&!t.customMark&&(i.has(t.footnoteId)||(i.add(t.footnoteId),o+=1))}return Yl(o+1,r)}(e.document),l=function(t,e){const a=Ma(e,{styleId:"footnoteReference",superscript:!0}),n={footnoteId:t};return a.footnoteReference=n,a}(o.id,i),s=pw(a,r,[l]),d=vw(e,da(e).map((t,e)=>e===n?s:t),ua(Ce(s,r+i.length))),c=function(t){return t||{items:{}}}(d.document.footnotes),h=_l({...d.document,footnotes:{...c,items:{...c.items,[o.id]:o}}}),p=o.blocks.flatMap(Fe).find(Boolean);return p?{...d,document:h,selection:ua(Ce(p,0)),activeZone:"footnote",activeFootnoteId:o.id}:{...d,document:h}}function eS(t,e){const a=da(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:rw(t,a)});return vw(t,a,Sw(a,ga(t)))}function aS(t,e){const a=da(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:rw(t,a)});return vw(t,a,Sw(a,ga(t)))}function nS(t){return t.map(Zx)}function rS(t){return t.reduce((t,e)=>t+e.text.length,0)}function oS(t,e,a){if(0===a.length)return t;const n=da(t),r=n.findIndex(t=>t.id===e.paragraphId);if(-1===r)return t;const o=n[r],i=ke(o,e),l=nS(a[0].runs);if(1===a.length){const e=pw(o,i,l),a=n.map((t,a)=>a===r?e:t),s=rS(l);return vw(t,a,{anchor:Ce(e,i),focus:Ce(e,i+s)})}const s=hw(o,0,i),d=hw(o,i,Te(o)),c=a[a.length-1],h=a.slice(1,-1),p=rw(Kx(a[0].paragraphTemplate),[...s,...l],dw(o,i)),u=h.map(t=>rw(Kx(t.paragraphTemplate),nS(t.runs))),f=rw(Kx(c.paragraphTemplate),[...nS(c.runs),...d],dw(o,i));return vw(t,[...n.slice(0,r),p,...u,f,...n.slice(r+1)],{anchor:Ce(p,rS(s)),focus:Ce(f,rS(c.runs))})}function iS(t,e,a={}){if(ga(t).isCollapsed)return t;if(function(t,e){const a=ga(t);if(a.isCollapsed)return!1;const n=da(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=ke(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=ga(t);if(e.isCollapsed)return[];const a=da(t),n=[];for(let r=e.startIndex;r<=e.endIndex;r+=1){const t=a[r],o=hw(t,r===e.startIndex?e.startParagraphOffset:0,r===e.endIndex?e.endParagraphOffset:Te(t));n.push({paragraphTemplate:Kx(t),runs:o})}return n}(t);if(0===n.length)return t;if(a.copy)return oS(t,e,n);const r=function(t,e){const a=ga(t),n=da(t),r=n.findIndex(t=>t.id===e.paragraphId);if(-1===r)return e;const o=ke(n[r],e);if(a.startIndex===a.endIndex)return r!==a.startIndex||o<=a.endParagraphOffset?e:Ce(n[a.startIndex],o-(a.endParagraphOffset-a.startParagraphOffset));return e}(t,e);return oS(xw(t),r,n)}function lS(t,e,a){if(0===e.length)return t;const n=fa(t.selection)?t:xw(t),{paragraph:r,index:o,offset:i}=Mw(n),l=a?{...a}:dw(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=pw(r,i,[s]);return vw(n,da(n).map((t,e)=>e===o?d:t),yw(Ce(d,i+e.length)))}function sS(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 lS(t,n,a);const r=fa(t.selection)?t:xw(t),{paragraph:o,index:i,offset:l}=Mw(r),s=n.split("\n"),d=dw(o,l),c=rw(o,[...hw(o,0,l),Ma(s[0],d)],d),h=hw(o,l,Te(o)),p=s.slice(1,-1).map(t=>ow([{text:t,styles:d}])),u=ow([{text:s[s.length-1],styles:d},...h.map(t=>({text:t.text,styles:t.styles}))]),f=da(r);return vw(r,[...f.slice(0,i),c,...p,u,...f.slice(i+1)],yw(Ce(u,s[s.length-1].length)))}function dS(t){var e;if(!fa(t.selection))return xw(t);const{paragraph:a,index:n,offset:r}=Mw(t),o=da(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=rw(a,[...hw(a,0,r-1),...hw(a,r,Te(a))]);return vw(t,o.map((t,a)=>a===n?e:t),yw(Ce(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=rw(a,[...hw(a,0,r-1),h,...hw(a,r,Te(a))]);return vw(t,o.map((t,e)=>e===n?p:t),yw(Ce(p,r-1)))}}const i=rw(a,[...hw(a,0,r-1),...hw(a,r,Te(a))],dw(a,r-1));return vw(t,o.map((t,e)=>e===n?i:t),yw(Ce(i,r-1)))}if(0===n)return t;const i=o[n-1],l=rw(i,[...i.runs.map(Zx),...a.runs.map(Zx)]);return vw(t,[...o.slice(0,n-1),l,...o.slice(n+1)],yw(Ce(l,Te(i))))}function cS(t){var e;if(!fa(t.selection))return xw(t);const{paragraph:a,index:n,offset:r}=Mw(t),o=da(t);if(r<Te(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=rw(a,[...hw(a,0,r),...hw(a,r+1,Te(a))]);return vw(t,o.map((t,a)=>a===n?e:t),yw(Ce(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=rw(a,[...hw(a,0,r),h,...hw(a,r+1,Te(a))]);return vw(t,o.map((t,e)=>e===n?p:t),yw(Ce(p,r)))}}const i=rw(a,[...hw(a,0,r),...hw(a,r+1,Te(a))],dw(a,r));return vw(t,o.map((t,e)=>e===n?i:t),yw(Ce(i,r)))}if(n>=o.length-1)return t;const i=o[n+1],l=rw(a,[...a.runs.map(Zx),...i.runs.map(Zx)]);return vw(t,[...o.slice(0,n),l,...o.slice(n+2)],yw(Ce(l,r)))}function hS(t,e){const a=ga(t);if(a.isCollapsed)return t;const n=da(t),r=n.slice(a.startIndex,a.endIndex+1).flatMap((t,e)=>{const n=a.startIndex+e;return hw(t,n===a.startIndex?a.startParagraphOffset:0,n===a.endIndex?a.endParagraphOffset:Te(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 ww(t,n===a.startIndex?a.startParagraphOffset:0,n===a.endIndex?a.endParagraphOffset:Te(t),t=>({...t,styles:Ux(t.styles,e,o)}))});return vw(t,i,Sw(i,a))}function pS(t,e,a){const n=ga(t);if(n.isCollapsed)return t;const r=da(t).map((t,r)=>{if(r<n.startIndex||r>n.endIndex)return t;return ww(t,r===n.startIndex?n.startParagraphOffset:0,r===n.endIndex?n.endParagraphOffset:Te(t),t=>({...t,styles:Fx(t.styles,e,a)}))});return vw(t,r,Sw(r,n))}function uS(t){return new RegExp("\\p{L}","u").test(t)}function fS(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=uS(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&&uS(n)?(e+=n.toUpperCase(),a=!1):(e+=n,"."!==n&&"!"!==n&&"?"!==n||(a=!0));return e}(t)}}function gS(t,e){return function(t,e){const a=ga(t);if(a.isCollapsed)return t;const n=da(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:Te(t),i=hw(t,r,o).map(t=>t.text).join(""),l=e(i);let s=0;return ww(t,r,o,t=>{const e=t.text.length,a=l.slice(s,s+e);return s+=e,{...t,text:a}})});return vw(t,n,Sw(n,a))}(t,t=>fS(t,e))}function mS(t){var e,a,n;const r=ga(t),o=da(t);if(r.isCollapsed){const t=o[r.startIndex];return t?(null==(e=cw(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 hw(t,a===r.startIndex?r.startParagraphOffset:0,a===r.endIndex?r.endParagraphOffset:Te(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 vS(t){const e=ga(t),a=da(t).map((t,a)=>{if(a<e.startIndex||a>e.endIndex)return Kx(t);if(!t.list)return Kx(t);const n=t.list.level??0;return n<=0?sw(t):lw(t,n-1)});return vw(t,a,Sw(a,e))}function bS(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=ga(e);return da(e).slice(t.startIndex,t.endIndex+1)})().some(t=>Boolean(t.list)),g=()=>{const t=e.selection.focus.paragraphId;return da(e).find(e=>e.id===t)??null},m=()=>{const t=e.selection,a=ia(e),n=Ye(e.document,t.anchor.paragraphId,a),r=Ye(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=>Kw(a,t,e)),s()},b=()=>"main"===(e.activeZone??"main"),y=t=>{const a=mS(e);p()&&!a||(d(),c(),r(e=>function(t,e){const a=ga(t);if(!a.isCollapsed)return pS(t,"link",e);const n=da(t)[a.startIndex];if(!n)return t;const r=cw(n,a.startParagraphOffset);if(!r)return t;const o=pS(Qw(t,{anchor:Ce(n,r.startOffset),focus:Ce(n,r.endOffset)}),"link",e),i=da(o)[a.startIndex];return i?{...o,selection:{anchor:Ce(i,r.startOffset),focus:Ce(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=>hS(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=>pS(e,t,n)),s()},applyChangeTextCaseCommand:t=>{p()||(d(),c(),o(e=>gS(e,t)),s())},applyClearFormattingCommand:()=>{p()||(d(),c(),o(t=>function(t){const e=ga(t);if(e.isCollapsed)return t;const a=da(t).map((t,a)=>a<e.startIndex||a>e.endIndex?t:ww(t,a===e.startIndex?e.startParagraphOffset:0,a===e.endIndex?e.endParagraphOffset:Te(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 vw(t,a,Sw(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=ga(t),n=da(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 Kx(t);const d=Kx(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 vw(t,s,Sw(s,a))}(e,t)),s()},handleListFormatChange:t=>{d(),c(),i(e=>function(t,e){const a=ga(t),n=da(t).map((t,n)=>n<a.startIndex||n>a.endIndex?Kx(t):t.list?{...Kx(t),list:{...t.list,format:e||void 0}}:Kx(t));return vw(t,n,Sw(n,a))}(e,t)),s()},handleListStartAtChange:t=>{d(),c(),i(e=>function(t,e){const a=ga(t),n=da(t).map((t,n)=>n<a.startIndex||n>a.endIndex?Kx(t):t.list?{...Kx(t),list:{...t.list,startAt:null!==e?e:void 0}}:Kx(t));return vw(t,n,Sw(n,a))}(e,t)),s()},applyInsertSectionBreakCommand:t=>{d(),c(),n(function(t,e){const a=fa(t.selection)?t:xw(t),{paragraph:n,offset:r}=Mw(a),o=Ue(a.document),i=ia(a);if("main"!==la(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=rw(n,hw(n,0,r),dw(n,r)),p=hw(n,r,Te(n)),u=p.length>0?iw(n,p.map(t=>({text:t.text,styles:t.styles}))):(()=>{const t=xa("");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?Xx(l.header):void 0,footer:l.footer?Xx(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:yw(Ce(u,0))}}(e,t)),s()},applyInsertPageBreakCommand:()=>{d(),c(),r(t=>l(t,t=>Zw(t))),s()},canInsertFootnoteCommand:b,applyInsertFootnoteCommand:()=>{b()&&(d(),c(),r(t=>tS(t)),s())},handleStyleChange:t=>{d(),c(),i(e=>function(t,e){return Kw(t,"styleId",e)}(e,t||null)),s()},applyUpdateSectionSettingsCommand:(t,a)=>{d(),c(),n(function(t,e,a){var n;const r=Ue(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=ga(t),n=da(t),r=new Set;for(let i=a.startIndex;i<=a.endIndex;i+=1){const t=n[i],o=hw(t,i===a.startIndex?a.startParagraphOffset:0,i===a.endIndex?a.endParagraphOffset:Te(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=eS(o,i);return o}(e)),s()},applyRejectRevisionsCommand:()=>{d(),c(),n(function(t){var e;const a=ga(t),n=da(t),r=new Set;for(let i=a.startIndex;i<=a.endIndex;i+=1){const t=n[i],o=hw(t,i===a.startIndex?a.startParagraphOffset:0,i===a.endIndex?a.endParagraphOffset:Te(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=aS(o,i);return o}(e)),s()},applyLinkCommand:y,promptForLink:()=>{const a=mS(e)??"";p()&&!a||t.openLinkDialog(a)},removeLinkCommand:()=>{y(null)},applyImageAltCommand:t=>{u()&&(d(),c(),r(e=>function(t,e){const a=Iw(t);if(!(null==a?void 0:a.run.image))return t;const n=da(t).map((t,n)=>n!==a.paragraphIndex?Kx(t):{...Kx(t),runs:t.runs.map(t=>t.id===a.run.id&&t.image?{...t,image:{...t.image,alt:e??void 0}}:Zx(t))});return vw(t,n,Sw(n,ga(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=>Vw(a,e,t.imageCaptionLabel()),{mergeKey:"imageCaption"}),s())},promptForImageCaption:()=>{u()&&t.openImageCaptionDialog(kw(e)??"")},handleListTab:t=>!Ye(e.document,e.selection.focus.paragraphId,ia(e))&&(!!f()&&(d(),c(),i(e=>"indent"===t?function(t){const e=ga(t),a=da(t).map((t,a)=>a<e.startIndex||a>e.endIndex?Kx(t):t.list?lw(t,(t.list.level??0)+1):Kx(t));return vw(t,a,Sw(a,e))}(e):vS(e)),s(),!0)),handleListEnter:()=>{const t=g();return!!(null==t?void 0:t.list)&&(d(),c(),p()&&0===Ie(t).length?i(t=>function(t){const e=ga(t),a=da(t).map((t,a)=>a<e.startIndex||a>e.endIndex?Kx(t):sw(t));return vw(t,a,Sw(a,e))}(t)):r(t=>l(t,t=>function(t){const e=fa(t.selection)?t:xw(t),{paragraph:a,index:n,offset:r}=Mw(e),o=rw(a,hw(a,0,r),dw(a,r)),i=hw(a,r,Te(a)),l=i.length>0?iw(a,i.map(t=>({text:t.text,styles:t.styles}))):(()=>{const t=xa("");return t.style=a.style?{...a.style}:void 0,t.list=Dx(a.list),t})(),s=da(e);return vw(e,[...jx(s.slice(0,n)),o,l,...jx(s.slice(n+1))],yw(Ce(l,0)))}(t)),{mergeKey:"splitListItem"}),s(),!0)},handleListBoundaryBackspace:t=>{const a=g();if(!(null==a?void 0:a.list)||!p())return!1;return 0===ke(a,e.selection.focus)&&(d(),c(),i(t=>vS(t)),t.currentTarget.value="",s(),!0)}}}function yS(t){return/[\p{L}\p{N}_]/u.test(t)}function MS(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||!yS(r))return{start:a,end:Math.min(t.length,a+1)};let o=n,i=n+1;for(;o>0&&yS(t[o-1]);)o-=1;for(;i<t.length&&yS(t[i]);)i+=1;return{start:o,end:i}}class xS{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 wS=[{id:"selectAll",command:"selectAll",key:"a",ctrlOrMeta:!0,execute:t=>{const e=t.state(),a=da(e);if(0===a.length)return!1;const n=a[0],r=a[a.length-1];return t.clearPreferredColumn(),t.applyState(Qw(e,{anchor:Ce(n,0),focus:Ce(r,Ie(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=>Zw(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=>lS(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=>Gw(t))),t.focusInput()),!0)}];function SS(t){const e=new xS;wS.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(),!fa(n.selection))return t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>dS(t))),a.currentTarget.value="",void t.focusInput();const e=da(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===ke(o,n.selection.focus))return t.applySelectionAwareParagraphCommand(t=>vS(t)),a.currentTarget.value="",void t.focusInput()}const i=n.selection.focus.offset,l=Ie(o),s=MS(l,i);return"Backspace"===a.key?0===i||s.start===i?t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>dS(t))):t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(Qw(e,{anchor:Ce(o,s.start),focus:Ce(o,i)}),t=>dS(t))):i>=l.length?t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>cS(t))):s.end>i?t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(Qw(e,{anchor:Ce(o,i),focus:Ce(o,s.end)}),t=>dS(t))):t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>cS(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=>dS(t))),a.currentTarget.value="",void t.focusInput());case"Delete":return a.preventDefault(),t.clearPreferredColumn(),t.resetTransactionGrouping(),t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>cS(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(Xw(n,-1))):(t.clearPreferredColumn(),t.applyState(_w(n))),void t.focusInput();case"ArrowRight":return a.preventDefault(),t.resetTransactionGrouping(),a.shiftKey?(t.clearPreferredColumn(),t.applyState(function(t){return Xw(t,1)}(n))):(t.clearPreferredColumn(),t.applyState($w(n))),void t.focusInput();case"ArrowUp":return a.preventDefault(),t.resetTransactionGrouping(),void(a.shiftKey?t.moveVerticalSelection(-1,!0)||(t.applyState(function(t){return Jw(t,-1)}(n)),t.focusInput()):t.moveVerticalByBlock(-1)||(t.applyState(function(t){return jw(t,-1)}(n)),t.focusInput()));case"ArrowDown":return a.preventDefault(),t.resetTransactionGrouping(),void(a.shiftKey?t.moveVerticalSelection(1,!0)||(t.applyState(function(t){return Jw(t,1)}(n)),t.focusInput()):t.moveVerticalByBlock(1)||(t.applyState(function(t){return jw(t,1)}(n)),t.focusInput()));default:return}}},registry:e}}function AS(t,e){return t.paragraph.runs.map(t=>t.text).join("")[e]??""}function IS(t){return" "===t||"\t"===t||"\n"===t}function TS(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 CS(t,e){var a,n,r,o;const i=ga(e),l=[],s=t.surfaceRect,d=new Map(da(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=ia(e),u=Ye(e.document,e.selection.anchor.paragraphId,p),f=Ye(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=Ue(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=TS(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&&IS(AS(S,t));)t+=1;for(;r>t&&IS(AS(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?ke(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 kS(t,e){if(0===e.length)return t;const a={...t};for(const n of e)delete a[n];return a}function VS(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=Ps({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=CS(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(da(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=>kS(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=>kS(e,t))}S("content-change")}},onCleanupHook:()=>{M+=1}}}function ES(t={}){const e=t.dbName??"oasis-editor-db",a=t.storeName??"documents",n=t.key??"current-document";let r=null;async function o(){return r||(r=await function(t){return 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)}})}({name:e,version:1,onUpgrade:t=>{t.objectStoreNames.contains(a)||t.createObjectStore(a)}}),r)}return{async saveDocument(t){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)}})}(await o(),a,n,t)},loadDocument:async()=>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)}})}(await o(),a,n),async clearDocument(){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)}})}(await o(),a,n)},close(){r&&(r.close(),r=null)}}}function RS(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=je(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=Ie(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:Ce(t,a),focus:Ce(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(Qw(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=>lS(Qw(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=Qw(a,{anchor:t.anchor,focus:t.focus}),a=lS(a,n())}return a},{mergeKey:"findReplaceAll"}),p(!1),t.focusInput())},isOpen:h,setIsOpen:p}}function LS(t,e,a){const n={...t??{}};return null===a?delete n[e]:n[e]=a,Object.keys(n).length>0?n:void 0}function zS(t,e){const a=Ue(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 NS(t,e){return t.map(t=>"table"===t.type?e(t):t)}function qS(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:qS(t.blocks,e)}))}))})}function OS(t){const e=ia(t),a=Ye(t.document,t.selection.focus.paragraphId,e);return a?{activeSectionIndex:e,loc:a}:null}function PS(t,e){const a=OS(t);if(!a)return t;const{activeSectionIndex:n,loc:r}=a,o=la(t),i=(t,a)=>t.map((t,n)=>"table"===t.type&&n===r.blockIndex&&a===r.zone?e(t):t),l=Ue(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 WS(t){const e=new Set,a=ia(t),n=Ye(t.document,t.selection.anchor.paragraphId,a),r=Ye(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=Ue(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 HS(t,e,a){const n=WS(t);if(0===n.size)for(const i of function(t){const e=new Set,a=ga(t),n=da(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:LS(t.style,e,a)}),o=Ue(t.document).map(t=>({...t,blocks:bw(t.blocks,n,r),header:t.header?bw(t.header,n,r):void 0,footer:t.footer?bw(t.footer,n,r):void 0}));return{...t,document:{...t.document,sections:o}}}function US(t,e){let a=HS(t,"borderTop",e);return a=HS(a,"borderRight",e),a=HS(a,"borderBottom",e),a=HS(a,"borderLeft",e),a}function FS(t,e,a){const n=function(t){const e=ga(t),a=da(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=Fe(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:LS(s.style,e,a)}):l;var s});return zS(t,r)}function BS(t,e,a,n){const r=t=>t.id!==e?t:{...t,style:LS(t.style,a,n)};return zS(t,t=>qS(t,r))}function GS(t,e,a){const n=OS(t);if(!n)return t;return PS(t,t=>{const r=t.rows.map((t,r)=>r===n.loc.rowIndex?{...t,style:LS(t.style,e,a)}:t);return{...t,rows:r}})}function ZS(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)?t*Mn:null}if(!/^[+-]?\d+(\.\d+)?$/.test(e))return null;const a=Number.parseFloat(e);return Number.isFinite(a)?a:null}function KS(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=ZS(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 zS(t,t=>NS(t,o))}const DS=t=>t.cells.reduce((t,e)=>t+Math.max(1,e.colSpan??1),0),jS=t=>t.rows.reduce((t,e)=>Math.max(t,DS(e)),0),XS=(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},JS=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},YS=(t,e,a)=>{const n=Ue(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?Ce(i,0):null}}return null},QS=(t,e,a="main")=>{const n=ia(t),r=He(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 _S(t,e){return t.visualRowIndex!==e.visualRowIndex?t.visualRowIndex-e.visualRowIndex:t.visualColumnIndex!==e.visualColumnIndex?t.visualColumnIndex-e.visualColumnIndex:0}function $S(t,e){const a=t.selection,n=ia(t),r=Ye(t.document,a.anchor.paragraphId,n),o=Ye(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 tA(t){const e=(t,e)=>{const a=He(t.document),n=ia(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=$S(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=_S(s.anchorCell,s.focusCell)<=0?s.anchorLocation:s.focusLocation,f=_S(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:Ce(g,0),focus:Ce(v,Ie(v).length)}:null},resolveSelectedTableCells:e=>{const a=$S(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=$S(e,t);if(!a||a.anchorCell.visualRowIndex!==a.focusCell.visualRowIndex)return null;const n=_S(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=$S(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=Ye(e.document,e.selection.focus.paragraphId,ia(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=Ye(e.document,e.selection.focus.paragraphId,ia(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=Ye(e.document,e.selection.focus.paragraphId,ia(e));if(!a)return!1;const n=t.getTargetBlocks(e,a.zone)[a.blockIndex];return Boolean(n&&"table"===n.type)},canEditSelectedTableColumn:e=>{const a=Ye(e.document,e.selection.focus.paragraphId,ia(e));if(!a)return!1;const n=t.getTargetBlocks(e,a.zone)[a.blockIndex];return!(!n||"table"!==n.type)&&jS(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(qw),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=>qw(t)))};o.cells.splice(a.startCellIndex,i.length,l);const s=l.blocks[0];return s?{...QS(e,n,a.zone),selection:{anchor:Ce(s,0),focus:Ce(s,0)}}:e},a=e=>{const a=t.resolveVerticalTableCellRange(e);if(!a)return e;const n=t.getTargetBlocks(e,a.zone).map(qw),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=>qw(t)))};r.rows[a.startRowIndex].cells[a.cellIndex]=l;for(let t=a.startRowIndex+1;t<=a.endRowIndex;t+=1){const e=Sa([xa("")],i);e.blocks=[],e.vMerge="continue",r.rows[t].cells[a.cellIndex]=e}const s=l.blocks[0];return s?{...QS(e,n,a.zone),selection:{anchor:Ce(s,0),focus:Ce(s,0)}}:e},n=e=>{var a;const n=Ye(e.document,e.selection.focus.paragraphId,ia(e));if(!n)return e;const r=t.getTargetBlocks(e,n.zone).map(qw),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=Sa([xa("")],s);e.cells[n.cellIndex]=a}const d=i.blocks[0];return d?{...QS(e,r,n.zone),selection:{anchor:Ce(d,0),focus:Ce(d,0)}}:e},r=e=>{var a;const n=Ye(e.document,e.selection.focus.paragraphId,ia(e));if(!n)return e;const r=t.getTargetBlocks(e,n.zone).map(qw),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=>qw(t))},...Array.from({length:s-1},()=>Sa([xa("")]))];i.cells.splice(n.cellIndex,1,...d);const c=null==(a=d[0])?void 0:a.blocks[0];return c?{...QS(e,r,n.zone),selection:{anchor:Ce(c,0),focus:Ce(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=Ye(e.document,e.selection.focus.paragraphId,ia(e));if(!o)return e;const i=t.getTargetBlocks(e,o.zone).map(qw),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=Aa((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=Sa([xa("")],e.colSpan);return t.blocks=[],t.vMerge="continue",t}return Sa([xa("")],e.colSpan)})),l.rows.splice(d,0,c);const s=(null==a?void 0:a.visualColumnIndex)??o.cellIndex,h=XS(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])??JS(l);return p?{...QS(e,i,o.zone),selection:{anchor:Ce(p,0),focus:Ce(p,0)}}:QS(e,i,o.zone)}c=Aa(s.cells.map(t=>Sa([xa("")],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])??JS(l);return p?{...QS(e,i,o.zone),selection:{anchor:Ce(p,0),focus:Ce(p,0)}}:QS(e,i,o.zone)},deleteSelectedTableRow:e=>{const a=Ye(e.document,e.selection.focus.paragraphId,ia(e));if(!a)return e;const n=t.getTargetBlocks(e,a.zone).map(qw),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?XS(s,Math.min((null==l?void 0:l.visualColumnIndex)??a.cellIndex,Math.max(0,DS(s)-1))):null,c=(null==d?void 0:d.blocks[0])??JS(r);return c?{...QS(e,n,a.zone),selection:{anchor:Ce(c,0),focus:Ce(c,0)}}:QS(e,n,a.zone)},insertSelectedTableColumn:(e,a)=>{var n;const r=Ye(e.document,e.selection.focus.paragraphId,ia(e));if(!r)return e;const o=t.getTargetBlocks(e,r.zone).map(qw),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(Sa([xa("")])),r=!0),!r&&a<n&&n<a+e?(t.push({...o,colSpan:e+1}),r=!0):t.push(o),a+=e}r||t.push(Sa([xa("")])),e.cells=t}const l=i.rows[r.rowIndex],s=l?XS(l,n):null,d=(null==s?void 0:s.blocks[0])??JS(i);return d?{...QS(e,o,r.zone),selection:{anchor:Ce(d,0),focus:Ce(d,0)}}:QS(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,Sa([xa("")]));const s=i.rows[r.rowIndex],d=null==s?void 0:s.cells[l],c=(null==d?void 0:d.blocks[0])??JS(i);return c?{...QS(e,o,r.zone),selection:{anchor:Ce(c,0),focus:Ce(c,0)}}:QS(e,o,r.zone)},deleteSelectedTableColumn:e=>{var a;const n=Ye(e.document,e.selection.focus.paragraphId,ia(e));if(!n)return e;const r=t.getTargetBlocks(e,n.zone).map(qw),o=r[n.blockIndex];if(!o||"table"!==o.type)return e;if(jS(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&&XS(i,Math.min(a,Math.max(0,DS(i)-1))),s=(null==l?void 0:l.blocks[0])??JS(o);return s?{...QS(e,r,n.zone),selection:{anchor:Ce(s,0),focus:Ce(s,0)}}:QS(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])??JS(o);return s?{...QS(e,r,n.zone),selection:{anchor:Ce(s,0),focus:Ce(s,0)}}:QS(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:ka(p,void 0,void 0,void 0,void 0,r.document.assets),selection:{anchor:Ce(p[0],0),focus:Ce(p[p.length-1],Ie(p[p.length-1]).length)}},g=da(a(f)),m=t.getTargetBlocks(r,h),v=qw(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 QS(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:DS,getTableVisualWidth:jS,findCellAtVisualColumn:XS,findFirstNavigableParagraphInTable:JS,updateBlocksInCurrentSection:QS,resolveAdjacentTableCellPosition:YS,applyTableAwareParagraphEdit:(t,a)=>((t,e,a)=>{var n;const r=Ye(t.document,t.selection.focus.paragraphId,ia(t));if(!r||t.selection.anchor.paragraphId!==t.selection.focus.paragraphId)return a(t);const o=r.zone,i=e(t,o),l=qw(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:ka(d.blocks,void 0,void 0,void 0,void 0,t.document.assets),selection:{anchor:{...t.selection.anchor},focus:{...t.selection.focus}}}),h=je(c.document).filter(t=>"paragraph"===t.type);return d.blocks.splice(0,d.blocks.length,...h),{...QS(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({...Sa([xa("")]),style:{width:n}});r.push(Aa(t))}const o={...Ia(r),style:{width:"100%"}},i=ha(t,t.selection.focus),l=Ue(t.document),s=ia(t),d=la(t),c=t=>{const e=t.findIndex(t=>t.id===i.paragraphId||"paragraph"!==t.type&&Fe(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:yw(Ce(o.rows[0].cells[0].blocks[0],0))}}(t,e,a),{mergeKey:"insertTable"}),t.focusInput()}}}function eA(t,e,a,n=0){const r=ye(be(e));if(!a)return r;const o=dl(e,a,n);return null!==o&&Number.isFinite(o)&&o>0?Math.min(r,o):r}function aA(t,e){let a=null;const n=(t,e,a)=>{const n=da(t).find(t=>t.id===e);return n?{anchor:Ce(n,a),focus:Ce(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=dy(t.handleDirection,"x"),i=dy(t.handleDirection,"y"),l=0===o?t.startWidth:t.startWidth+e*o,s=0===i?t.startHeight:t.startHeight+a*i;let d=sy(l,ly,r),c=sy(s,ly);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=sy(t.startWidth*n,ly,r),c=sy(d/h,ly),{width:d,height:c}}return p?(d=sy(d,ly,r),c=sy(d/h,ly),{width:d,height:c}):(c=sy(c,ly),d=sy(c*h,ly,r),c=sy(d/h,ly),{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 nA(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=da(t).find(t=>t.id===e);return n?{anchor:Ce(n,a),focus:Ce(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=ga(t);if(e.isCollapsed||e.startIndex!==e.endIndex||e.endParagraphOffset-e.startParagraphOffset!==1)return null;const a=da(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:We(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=aA({label:"image",getSelected:t=>p(t),applyResize:(t,e,a)=>function(t,e,a){const n=Iw(t);if(!n)return t;const r=da(t),{paragraphIndex:o,run:i}=n,l=r.map((t,n)=>n!==o?Kx(t):{...Kx(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))}}:Zx(t))});return vw(t,l,Sw(l,ga(t)))}(t,e,a),getMaxWidth:(e,a)=>eA(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=nA({label:"image",applyRotate:(t,e)=>Tw(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=>Ew(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=je(t.state.document).find(t=>t.id===e);r&&t.applyState(Qw(t.state,{anchor:Ce(r,a),focus:Ce(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)}}}const oA="http://schemas.openxmlformats.org/wordprocessingml/2006/main",iA="http://schemas.openxmlformats.org/package/2006/relationships",lA="http://schemas.openxmlformats.org/officeDocument/2006/relationships",sA="http://schemas.microsoft.com/office/word/2010/wordml";function dA(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function cA(t,e){return Number.isFinite(t)?Math.max(0,Math.round(t/bn*Sn)):e}function hA(t){return null!=t&&Number.isFinite(t)?Math.round(t/bn*Sn):null}function pA(t){return null!=t&&Number.isFinite(t)?Math.max(0,Math.round(20*t)):null}function uA(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 fA(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="${dA(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 mA=`xmlns:w="${oA}" xmlns:w14="${sA}" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml"`;function vA(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="${dA(t.initials)}"`:"";return`<w:comment w:id="${e}" w:author="${dA(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">${dA(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 ${mA}>${e}</w:comments>`}function bA(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="${uA(t.color,e)}"/>`}function yA(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} ${bA(e)}`);return e.length>0?`<w:pBdr>${e.join("")}</w:pBdr>`:""}const MA="6F6F6F";function xA(t,e){return void 0===e?"":e?`<w:${t}/>`:`<w:${t} w:val="0"/>`}function wA(t,e,a={}){if("number"==typeof e&&Number.isFinite(e))return`<w:${t} w:w="${pA(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 SA(t){return bA(t??{width:.75,type:"solid",color:`#${MA}`},MA)}function AA(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=wA("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="${uA(t.style.shading,"FFFFFF")}"/>`);const g=xA("noWrap",null==(r=t.style)?void 0:r.noWrap);g&&u.push(g);const m=xA("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="${dA(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=pA(a??(null==e?void 0:e.paddingTop)??0),r=pA(a??(null==e?void 0:e.paddingBottom)??0);return`<w:tcMar><w:top w:w="${n??0}" w:type="dxa"/><w:left w:w="${pA(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="${pA(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="${pA(e.paddingStart)??0}" w:type="dxa"/>`:""}${void 0!==(null==e?void 0:e.paddingEnd)?`<w:end w:w="${pA(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 ${SA(null==(e=t.style)?void 0:e.borderTop)}`,`<w:left ${SA(null==(a=t.style)?void 0:a.borderLeft)}`,`<w:bottom ${SA(null==(n=t.style)?void 0:n.borderBottom)}`,`<w:right ${SA(null==(r=t.style)?void 0:r.borderRight)}`];return(null==(o=t.style)?void 0:o.borderStart)&&d.push(`<w:start ${SA(t.style.borderStart)}`),(null==(i=t.style)?void 0:i.borderEnd)&&d.push(`<w:end ${SA(t.style.borderEnd)}`),(null==(l=t.style)?void 0:l.borderTopLeftToBottomRight)&&d.push(`<w:tl2br ${SA(t.style.borderTopLeftToBottomRight)}`),(null==(s=t.style)?void 0:s.borderTopRightToBottomLeft)&&d.push(`<w:tr2bl ${SA(t.style.borderTopRightToBottomLeft)}`),`<w:tcBorders>${d.join("")}</w:tcBorders>`}(t));const v=xA("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 IA(t,e){if(void 0===e||!Number.isFinite(e))return"";const a=Math.floor(e);return a>0?`<w:${t} w:val="${a}"/>`:""}function TA(t,e){const a="number"==typeof t?pA(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 CA(t){var e,a,n,r,o,i,l,s,d;const c=[],h=IA("gridBefore",null==(e=t.style)?void 0:e.gridBefore);h&&c.push(h);const p=IA("gridAfter",null==(a=t.style)?void 0:a.gridAfter);p&&c.push(p);const u=wA("wBefore",null==(n=t.style)?void 0:n.widthBefore);u&&c.push(u);const f=wA("wAfter",null==(r=t.style)?void 0:r.widthAfter);f&&c.push(f);const g=wA("tblCellSpacing",null==(o=t.style)?void 0:o.cellSpacing);g&&c.push(g);const m=function(t){var e,a;return TA(null==(e=t.style)?void 0:e.height,null==(a=t.style)?void 0:a.heightRule)}(t);m&&c.push(m);const v=xA("cantSplit",null==(i=t.style)?void 0:i.cantSplit);v&&c.push(v),t.isHeader&&c.push("<w:tblHeader/>");const b=xA("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 kA(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="${dA(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="${dA(t.style.altTitle)}"/>`),(null==(r=t.style)?void 0:r.altDescription)&&m.push(`<w:tblDescription w:val="${dA(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}="${dA(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 wA("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=wA("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="${pA(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=wA("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=xA("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="${dA(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 VA(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>${AA(a,l)}${d}</w:tc>`}).join("");return`<w:tr>${a.tblPrExXml??""}${CA(a)}${o}</w:tr>`}).join(""),o=t.gridCols?`<w:tblGrid>${t.gridCols.map(t=>`<w:gridCol w:w="${pA(t)??0}"/>`).join("")}${t.tblGridChangeXml??""}</w:tblGrid>`:"";return`<w:tbl>${kA(t)}${o}${r}</w:tbl>`}function EA(t){if(!t||0===t.length)return"";const e=t.map(t=>{const e=pA(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 RA(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?cA(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=EA(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=yA(t);return n&&e.push(n),t.shading&&e.push(`<w:shd w:val="clear" w:color="auto" w:fill="${uA(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 LA(t,e,a,n){var r,o;const i=[],l=function(t,e){const a=Pe(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="${dA(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?cA(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=EA(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=yA(l);c&&i.push(c),l.shading&&i.push(`<w:shd w:val="clear" w:color="auto" w:fill="${uA(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 zA={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]},NA={ffff00:"yellow",fef08a:"yellow",ff0000:"red","00ff00":"green","0000ff":"blue","00ffff":"cyan",ff00ff:"magenta","000000":"black",ffffff:"white"};function qA(t){if(t in zA)return t;const e=t.trim().replace(/^#/,"").toLowerCase(),a=NA[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(zA)){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 OA(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="${dA(t.underlineColor.replace(/^#/,""))}"`:"";e.push(`<w:u w:val="${dA(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="${dA(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="${dA(t.fontFamily)}" w:hAnsi="${dA(t.fontFamily)}" w:cs="${dA(t.fontFamily)}"/>`),void 0!==t.fontSize&&null!==t.fontSize){const a=function(t){return null!=t&&Number.isFinite(t)?Math.round(t/bn*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="${dA(t.color.replace(/^#/,""))}"/>`),t.highlight&&e.push(`<w:highlight w:val="${dA(qA(t.highlight))}"/>`),t.shading&&e.push(`<w:shd w:val="clear" w:color="auto" w:fill="${uA(t.shading,"FFFFFF")}"/>`),t.language){const a=[];t.language.value&&a.push(`w:val="${dA(t.language.value)}"`),t.language.eastAsia&&a.push(`w:eastAsia="${dA(t.language.eastAsia)}"`),t.language.bidi&&a.push(`w:bidi="${dA(t.language.bidi)}"`),a.length>0&&e.push(`<w:lang ${a.join(" ")}/>`)}return e.length>0?`<w:rPr>${e.join("")}</w:rPr>`:""}function PA(t){if(0===t.length)return"";var e;return`<w:t${/^\s|\s$/.test(e=t)||e.includes(" ")?' xml:space="preserve"':""}>${dA(t)}</w:t>`}function WA(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+=PA(a),a="",e+="<w:softHyphen/>"):(e+=PA(a),a="",e+="<w:noBreakHyphen/>"):(e+=PA(a),a="",e+="<w:tab/>"):(e+=PA(a),a="",e+="<w:br/>");return e+=PA(a),e||"<w:t></w:t>"}function HA(t,e){return t??e?"1":"0"}function UA(t,e,a){const n=dA((null==e?void 0:e.relativeFrom)??a);if(null==e?void 0:e.align)return`<wp:${t} relativeFrom="${n}"><wp:align>${dA(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 FA(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 BA(t){const{cx:e,cy:a,floating:n,docPrId:r,docPrName:o,altAttr:i,graphicXml:l}=t,s=dA(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=UA("positionH",n.positionH,"column"),f=UA("positionV",n.positionV,"paragraph"),g=function(t,e){switch(t){case"square":return'<wp:wrapSquare wrapText="bothSides"/>';case"tight":{const t=FA(e);return t?`<wp:wrapTight wrapText="bothSides">${t}</wp:wrapTight>`:'<wp:wrapTight wrapText="bothSides"/>'}case"through":{const t=FA(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="${HA(n.simplePos,!1)}" relativeHeight="${n.relativeHeight??0}" behindDoc="${HA(n.behindDoc,!1)}" locked="${HA(n.locked,!1)}" layoutInCell="${HA(n.layoutInCell,!0)}" allowOverlap="${HA(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 GA(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="${dA(r.alt)}" title="${dA(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 BA({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="${lA}"/>${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 ZA(t,e,a,n,r,o){const i=Math.round(e.width*wn),l=Math.round(e.height*wn),s=a.textBoxDocPrIds.get(t.id)??1,d=e.name??"Text Box",c=void 0!==e.alt?` descr="${dA(e.alt)}" title="${dA(e.alt)}"`:"",h=function(t,e,a,n,r,o){const i=t.shape,l=dA((null==i?void 0:i.preset)??"rect"),s=t.rotation?Math.round(6e4*t.rotation):0,d=0!==s?` rot="${s}"`:"",c=(null==i?void 0:i.fill)?`<a:solidFill><a:srgbClr val="${dA(i.fill.replace(/^#/,""))}"/></a:solidFill>`:"";let h="";((null==i?void 0:i.borderColor)||void 0!==(null==i?void 0:i.borderWidthPt))&&(h=`<a:ln${void 0!==(null==i?void 0:i.borderWidthPt)?` w="${Math.round(12700*i.borderWidthPt)}"`:""}>${(null==i?void 0:i.borderColor)?`<a:solidFill><a:srgbClr val="${dA(i.borderColor.replace(/^#/,""))}"/></a:solidFill>`:""}<a:miter lim="800000"/></a:ln>`);const p=t.body,u=['rot="0"',`vert="${dA((null==p?void 0:p.vert)??"horz")}"`];u.push(`wrap="${dA((null==p?void 0:p.wrap)??"square")}"`),void 0!==(null==p?void 0:p.paddingLeft)&&u.push(`lIns="${Math.round(p.paddingLeft*wn)}"`),void 0!==(null==p?void 0:p.paddingTop)&&u.push(`tIns="${Math.round(p.paddingTop*wn)}"`),void 0!==(null==p?void 0:p.paddingRight)&&u.push(`rIns="${Math.round(p.paddingRight*wn)}"`),void 0!==(null==p?void 0:p.paddingBottom)&&u.push(`bIns="${Math.round(p.paddingBottom*wn)}"`),u.push(`anchor="${dA((null==p?void 0:p.anchor)??"t")}"`),u.push('anchorCtr="0"');const f=(null==p?void 0:p.autoFit)?"<a:spAutoFit/>":"",g=t.blocks.length>0,m=g?o(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>'+(g?'<wps:cNvSpPr txBox="1"><a:spLocks noChangeArrowheads="1"/></wps:cNvSpPr>':"<wps:cNvSpPr/>")+`<wps:spPr bwMode="auto"><a:xfrm${d}><a:off x="0" y="0"/><a:ext cx="${e}" cy="${a}"/></a:xfrm><a:prstGeom prst="${l}"><a:avLst/></a:prstGeom>`+c+h+"</wps:spPr>"+(g?`<wps:txbx><w:txbxContent>${m}</w:txbxContent></wps:txbx>`:"")+`<wps:bodyPr ${u.join(" ")}>${f}</wps:bodyPr></wps:wsp></a:graphicData></a:graphic>`}(e,i,l,a,n,o);return`<w:r>${r}${BA({cx:i,cy:l,floating:e.floating,docPrId:s,docPrName:d,altAttr:c,graphicXml:h})}</w:r>`}const KA={footnote:"FootnoteReference",endnote:"EndnoteReference"};function DA(t){return`<w:r><w:rPr><w:rStyle w:val="${KA[t]}"/><w:vertAlign w:val="superscript"/></w:rPr><w:${t}Ref/></w:r>`}function jA(t,e,a,n){if(!e)return null;const r="footnote"===t?n.footnoteIdMap:n.endnoteIdMap,o=null==r?void 0:r.get(e.noteId);if(void 0===o)return null;const i={...a??{},superscript:!0},l=e.customMark?' w:customMarkFollows="1"':"",s=e.customMark?`<w:t xml:space="preserve">${dA(e.customMark)}</w:t>`:"";return`<w:r>${OA(i)}<w:${t}Reference${l} w:id="${o}"/>${s}</w:r>`}function XA(t,e,a,n,r){if(t.__isFootnoteRefMarker)return DA("footnote");if(t.__isEndnoteRefMarker)return DA("endnote");const o=function(t,e,a){var n;const r=Oe(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){const n=t.footnoteReference;return jA("footnote",n?{noteId:n.footnoteId,customMark:n.customMark}:void 0,e,a)}(t,o,e);if(null!==a)return a}if(t.endnoteReference){const a=function(t,e,a){const n=t.endnoteReference;return jA("endnote",n?{noteId:n.endnoteId,customMark:n.customMark}:void 0,e,a)}(t,o,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,OA(o));if(void 0!==t.fieldInstruction)return i=t.fieldInstruction,`<w:r>${OA(o)}<w:instrText xml:space="preserve">${dA(i)}</w:instrText></w:r>`;var i;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,OA(o));if(t.textBox)return ZA(t,t.textBox,e,n,OA(o),r);if(t.image){const a=e.imageMap.get(t.id);if(a){const n=GA(t.id,a,e,OA(o));if(null!==n)return n}}if(t.sym){const{font:e,char:a}=t.sym;return`<w:r>${OA(o)}<w:sym w:font="${dA(e)}" w:char="${a}"/></w:r>`}return`<w:r>${OA(o)}${WA(t.text)}</w:r>`}function JA(t,e,a,n,r){var o;const i=XA(t,e,a,n,r),l=null==(o=t.styles)?void 0:o.link;return l?function(t,e,a){if(e.startsWith("#"))return`<w:hyperlink w:anchor="${dA(e.slice(1))}">${t}</w:hyperlink>`;const n=a.hyperlinkMap.get(e);return n?`<w:hyperlink r:id="${n}">${t}</w:hyperlink>`:t}(i,l,e):i}function YA(t){return!(t.image||t.textBox||t.field||t.fieldChar||void 0!==t.fieldInstruction||t.footnoteReference||t.endnoteReference)}function QA(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>':"")+VA(t,(t,n)=>{var r;return _A(t,e,a,{align:null==(r=n.style)?void 0:r.horizontalAlign})})}return _A(t,e,a)}).join("")}function _A(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=OA(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}${WA(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:fA(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),YA(c)&&c.text.length>0){let l=t;for(;i<o.length&&o[i].offset<e;){const e=o[i];e.offset>l&&(s+=JA({...c,text:c.text.slice(l-t,e.offset-t)},a,n,r,QA)),s+=e.xml,i+=1,l=e.offset}l<e&&(s+=JA({...c,text:c.text.slice(l-t)},a,n,r,QA))}else s+=JA(c,a,n,r,QA);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 JA(n,e,null==(r=t.style)?void 0:r.styleId,a,QA)}).join("");return`${s}<w:p>${LA(t,e.numberingInfo,a,n)}${p}</w:p>`}function $A(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 eI(t){if(0===t.length)return[aI()];const[e,...a]=t;return"paragraph"!==e.type?[aI(!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 aI(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 nI=["wholeTable","band1Horz","band2Horz","band1Vert","band2Vert","firstCol","lastCol","firstRow","lastRow","nwCell","neCell","swCell","seCell"];function rI(t,e){const a=[],n=e.paragraphStyle?RA(e.paragraphStyle):"";n&&a.push(n);const r=e.textStyle?OA(e.textStyle):"";r&&a.push(r);const o=e.rowStyle?function(t){var e;if(!t)return"";const a=[],n=IA("gridBefore",t.gridBefore);n&&a.push(n);const r=IA("gridAfter",t.gridAfter);r&&a.push(r);const o=wA("wBefore",t.widthBefore);o&&a.push(o);const i=wA("wAfter",t.widthAfter);i&&a.push(i);const l=wA("tblCellSpacing",t.cellSpacing);l&&a.push(l);const s=TA(t.height,t.heightRule);s&&a.push(s);const d=xA("cantSplit",t.cantSplit);d&&a.push(d);const c=xA("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} ${bA(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="${uA(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="${dA(t)}">${a.join("")}</w:tblStylePr>`}function oI(t){const e=[];if(e.push(`<w:name w:val="${dA(t.name)}"/>`),t.basedOn&&e.push(`<w:basedOn w:val="${dA(t.basedOn)}"/>`),t.nextStyle&&e.push(`<w:next w:val="${dA(t.nextStyle)}"/>`),("paragraph"===t.type||"table"===t.type)&&t.paragraphStyle){const a=RA(t.paragraphStyle);a&&e.push(a)}if(t.textStyle){const a=OA(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?pA(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=[...nI.filter(t=>t in a.conditionalFormats),...Object.keys(a.conditionalFormats).filter(t=>!nI.includes(t))];for(const n of t){const t=a.conditionalFormats[n];if(t){const a=rI(n,t);a&&e.push(a)}}}}return`<w:style w:type="${"character"===t.type?"character":"table"===t.type?"table":"paragraph"}" w:styleId="${dA(t.id)}">${e.join("")}</w:style>`}function iI(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=Bv[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 lI={decimal:"decimal",lowerRoman:"lowerRoman",upperRoman:"upperRoman",lowerLetter:"lowerLetter",upperLetter:"upperLetter",symbol:"symbol"},sI={continuous:"continuous",eachSection:"eachSect"};function dI(t,e){if(!e)return null;const a=[];return e.numberFormat&&a.push(`<w:numFmt w:val="${lI[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="${sI[e.restart]}"/>`),a.length>0?`<w:${t}>${a.join("")}</w:${t}>`:null}function cI(t,e){let a="";for(const n of e)a+=`<Relationship Id="${n.rId}" Type="${lA}/hyperlink" Target="${dA(n.href)}" TargetMode="External"/>`;for(const n of t){const t="linked"===n.kind?' TargetMode="External"':"";a+=`<Relationship Id="${n.rId}" Type="${lA}/image" Target="${dA(n.target)}"${t}/>`}return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${iA}">${a}</Relationships>`}function hI(t,e){e(t);for(const a of t.runs)a.textBox&&pI(a.textBox.blocks,e)}function pI(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)hI(t,e);else hI(a,e)}const uI=`xmlns:w="${oA}" xmlns:w14="${sA}" 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="${lA}"`;function fI(t,e,a,n){const r=[],o=new Map,i=new Map,l=[],s=new Map;return pI(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(d.image.width*wn),cy:Math.round(d.image.height*wn),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=We(n,d.image.src).match(/^data:([^;,]+);base64,(.*)$/);if(!u)continue;const f=Zv(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 gI(t,e,a){const n=Ue(t).map((n,r)=>QA(n.blocks,e,t.styles)+function(t,e){var a,n,r,o,i,l,s,d,c;const h=cA(t.width,12240),p=cA(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=cA(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="${cA(t.width,0)}" w:space="${cA(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="${cA(u.top,1440)}" w:right="${cA(u.right,1440)}" w:bottom="${cA(u.bottom,1440)}" w:left="${cA(u.left,1440)}" w:header="${cA(u.header,720)}" w:footer="${cA(u.footer,720)}" w:gutter="${cA(u.gutter,0)}"/>${b}</w:sectPr>`}(n.pageSettings,a[r])).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document ${uI}><w:body>${n}</w:body></w:document>`}function mI(t,e,a,n){const r="header"===t?"hdr":"ftr";return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:${r} ${uI}>${QA(e,a,n)}</w:${r}>`}async function vI(t){var e,a,n,r,o,i;t=ew(t);const l=new Up,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.instanceId?`instance:${t.list.instanceId}`:`legacy:${t.list.kind}:${i}:${l}`;let d=a.get(s);d||(d={abstractNumId:r++,numId:o++,levels:[]},a.set(s,d),n.push(d)),d.levels.some(t=>t.level===i)||d.levels.push({kind:t.list.kind,level:i,format:t.list.format,startAt:t.list.startAt,levelText:t.list.levelText,suffix:t.list.suffix,alignment:t.list.alignment,legal:t.list.legal,bulletGlyph:t.list.bulletGlyph,bulletFont:t.list.bulletFont}),e.set(t.id,{numId:d.numId,level:i})};for(const l of Ue(t))pI(l.blocks,i),l.header&&pI(l.header,i),l.firstPageHeader&&pI(l.firstPageHeader,i),l.evenPageHeader&&pI(l.evenPageHeader,i),l.footer&&pI(l.footer,i),l.firstPageFooter&&pI(l.firstPageFooter,i),l.evenPageFooter&&pI(l.evenPageFooter,i);return{numberingInfo:e,definitions:n}}(t),d={nextImageId:1,nextTextBoxDocPrId:1000001},c=Ue(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 Kl(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 ts(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=fI(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=fI(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=>$A(t.footnote.blocks)));l.footnoteIdMap=i;const s=e.map(t=>{const e=$A(t.footnote.blocks).map(t=>"paragraph"===t.type?_A(t,l,o):VA(t,(t,e)=>{var a;return _A(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="${oA}" xmlns:w14="${sA}" 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="${lA}"><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=>fI(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=>eI(t.endnote.blocks)));l.endnoteIdMap=i;const s=e.map(t=>{const e=eI(t.endnote.blocks).map(t=>"paragraph"===t.type?_A(t,l,o):VA(t,(t,e)=>{var a;return _A(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="${oA}" xmlns:w14="${sA}" 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="${lA}"><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=>fI(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",iI(I,R,C,x,u,m,L,M)),l.file("_rels/.rels",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${iA}"><Relationship Id="rId1" Type="${lA}/officeDocument" Target="word/document.xml"/></Relationships>`),l.file("word/document.xml",gI(t,v,w)),L&&l.file("word/styles.xml",function(t){const e=Object.values(t).map(oI).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="${sA}">${e}</w:styles>`}(t.styles)),I&&l.file("word/numbering.xml",function(t){const e=t.map(({abstractNumId:t,levels:e})=>`<w:abstractNum w:abstractNumId="${t}">${e.sort((t,e)=>t.level-e.level).map(({kind:t,level:e,format:a,startAt:n,levelText:r,suffix:o,alignment:i,legal:l,bulletGlyph:s,bulletFont:d})=>{const c="bullet"===t?"bullet":a??"decimal",h=r??("bullet"===t?s??"":`%${e+1}.`),p=n??1,u="bullet"===t?d??"Symbol":void 0,f=u?`<w:rPr><w:rFonts w:ascii="${dA(u)}" w:hAnsi="${dA(u)}" w:hint="default"/></w:rPr>`:"",g=o&&"tab"!==o?`<w:suff w:val="${o}"/>`:"",m=l?"<w:isLgl/>":"";return`<w:lvl w:ilvl="${e}"><w:start w:val="${p}"/><w:numFmt w:val="${c}"/><w:lvlText w:val="${dA(h)}"/><w:lvlJc w:val="${i??"left"}"/>${g}${m}${f}</w:lvl>`}).join("")}</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="${oA}">${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="${lA}/styles" Target="styles.xml"/>`),t&&(d+=`<Relationship Id="rIdNum" Type="${lA}/numbering" Target="numbering.xml"/>`),e&&(d+=`<Relationship Id="rIdSettings" Type="${lA}/settings" Target="settings.xml"/>`);for(const c of n)d+=`<Relationship Id="${c.rId}" Type="${lA}/hyperlink" Target="${dA(c.href)}" TargetMode="External"/>`;for(const c of a){const t="linked"===c.kind?' TargetMode="External"':"";d+=`<Relationship Id="${c.rId}" Type="${lA}/image" Target="${dA(c.target)}"${t}/>`}for(const c of r){const t="header"===c.kind?"header":"footer";d+=`<Relationship Id="${c.relId}" Type="${lA}/${t}" Target="${c.path}"/>`}return o&&(d+=`<Relationship Id="rIdFootnotes" Type="${lA}/footnotes" Target="footnotes.xml"/>`),i&&(d+=`<Relationship Id="rIdEndnotes" Type="${lA}/endnotes" Target="endnotes.xml"/>`),s&&(d+=`<Relationship Id="rIdComments" Type="${lA}/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="${iA}">${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=pA(e);null!==o&&r.push(`<w:defaultTabStop w:val="${o}"/>`);const i=dI("footnotePr",a);i&&r.push(i);const l=dI("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="${oA}">${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}`,mI(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`,cI(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",cI(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",cI(E.partContext.images,E.partContext.hyperlinks))),y&&(l.file("word/comments.xml",vA(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 ${mA}>${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 bI(t){switch(t){case"dashed":return[MM(5),MM(3)];case"dotted":return[MM(1),MM(3)];default:return}}async function yI(t,e,a,n,r,o,i,l){const s=e.rotation;s&&(t.saveGraphicsState(a.pageIndex),t.rotateAbout(a.pageIndex,MM(n+o/2),MM(r+i/2),s)),function(t,e,a,n,r,o,i){var l,s,d,c;const h=oh(null==(l=a.shape)?void 0:l.preset,MM(n),MM(r),MM(o),MM(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,l){var s;if(0===e.blocks.length)return;const d=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),c=n+d.left,h=r+d.top,p=Math.max(1,o-d.left-d.right),u=Math.max(1,i-d.top-d.bottom),f=(null==(s=Nl({blocks:e.blocks,pageSettings:{width:p,height:u,orientation:"portrait",margins:{top:0,right:0,bottom:0,left:0,header:0,footer:0,gutter:0}},maxPageHeight:u,styles:a.document.styles,pageOffset:a.pageIndex})[0])?void 0:s.blocks)??[];if(0===f.length)return;const g=ra(a.document);t.saveGraphicsState(a.pageIndex),t.clipRect(a.pageIndex,MM(c),MM(h),MM(p),MM(u));let m=h;for(const v of f)"paragraph"===v.sourceBlock.type&&v.layout?await l.drawParagraph(t,a.pageIndex,v.sourceBlock,v.layout.lines,a.document,c,m,a.fontRegistry,g,l):"table"===v.sourceBlock.type&&await l.drawTableBlock(t,a.pageIndex,v,a.document,c,m,p,a.fontRegistry,g,l),m+=Math.max(0,v.estimatedHeight);t.restoreGraphicsState(a.pageIndex)}(t,e,a,n,r,o,i,l),s&&t.restoreGraphicsState(a.pageIndex)}async function MI(t){const{writer:e,document:a,fontRegistry:n,pageIndex:r,lines:o,pageSettings:i,contentLeft:l,contentTop:s,contentWidth:d,paragraphTop:c,drawers:h}=t;for(const p of o){const t=new Map(p.slots.map(t=>[t.offset,t]));for(const o of p.fragments){const u=o.textBox;if(!(null==u?void 0:u.floating))continue;const f=t.get(o.startOffset),g=l+((null==f?void 0:f.left)??0),m=c+p.top,v=Ui({object:Oi(u),pageSettings:i,contentLeft:l,contentTop:s,contentWidth:d,paragraphTop:c,lineTop:m,anchorLeft:g});await yI(e,u,{document:a,fontRegistry:n,pageIndex:r},v.x,v.y,v.width,v.height,h)}}}const xI=new WeakMap;function wI(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 SI(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=wI(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?wI(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 AI(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 II(t,e,a){const n=AI(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 TI(t,e,a,n,r,o,i,l){const s=II(a,n,i.fontSize??yM);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:MM(c),y1:MM(d-a),x2:MM(h),y2:MM(d-a),stroke:p,lineWidth:MM(1)}),void t.drawLine(e,{x1:MM(c),y1:MM(d+a),x2:MM(h),y2:MM(d+a),stroke:p,lineWidth:MM(1)})}!function(t,e,a,n,r,o,i){const l=hh(i),s=(r,i)=>{t.drawLine(e,{x1:MM(a),y1:MM(r),x2:MM(n),y2:MM(r),stroke:o,lineWidth:MM(l),dashArray:i})};if(dh(i))return s(r-1.5),void s(r+1.5);if(ch(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:MM(d),y1:MM(c),x2:MM(h),y2:MM(n),stroke:o,lineWidth:MM(i)}),d=h,c=n}}(t,e,a,n,r,o,l);s(r,ph(i))}(t,e,c,h,d,p,i.underlineStyle)}else t.drawLine(e,{x1:MM(c),y1:MM(d),x2:MM(h),y2:MM(d),stroke:p,lineWidth:MM(1)})}function CI(t,e,a,n){var r;const o=Pe(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*yn})).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 kI(t,e,a,n,r,o,i,l,s,d){var c;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=We(e,a.src);if(!n)return null;let r=xI.get(t);r||(r=new Map,xI.set(t,r));const o=r.get(n);if(o)return o;const i=SI(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:MM(i+a.left),y:MM(l+n.top+n.height-r.image.height),width:MM(r.image.width),height:MM(r.image.height),rotation:r.image.rotation})}if(r.textBox)return void(await async function(t,e,a,n,r,o,i,l,s){const d=n.textBox;if(!d||d.floating)return;const c=a.slots.find(t=>t.offset===n.startOffset)??a.slots.find(t=>t.offset>=n.startOffset);c&&await yI(t,d,{document:r,fontRegistry:l,pageIndex:e},o+c.left,i+a.top+a.height-d.height,d.width,d.height,s)}(t,e,n,r,o,i,l,s,d));const h=Oe(r.styles,null==(c=a.style)?void 0:c.styleId,o.styles);if(h.hidden)return;const p=s.resolveFontFace({fontFamily:h.fontFamily,bold:h.bold,italic:h.italic}),u=h.smallCaps?.8*xM(h):xM(h),f=(h.baselineShift??0)*yn,g=l+n.top+.8*n.height-f,m=AI(n,r),v=m.map(t=>h.allCaps?t.char.toUpperCase():t.char).join("");if(!m[0]||0===v.length)return;!function(t,e,a,n,r,o,i){if(!i.shading)return;const l=II(a,n,i.fontSize??yM);l&&t.drawRect(e,{x:MM(r+l.left),y:MM(o+a.top+2),width:MM(Math.max(0,l.right-l.left)),height:MM(Math.max(2,a.height-4)),fill:i.shading})}(t,e,n,r,i,l,h),function(t,e,a,n,r,o,i){if(!i.highlight)return;const l=II(a,n,i.fontSize??yM);l&&t.drawRect(e,{x:MM(r+l.left),y:MM(o+a.top+2),width:MM(Math.max(0,l.right-l.left)),height:MM(Math.max(2,a.height-4)),fill:i.highlight})}(t,e,n,r,i,l,h),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=CI(a,n,r.left,o);if(!p)continue;const u="underscore"===p?l+2:l;t.drawLine(e,{x1:MM(i+r.left),y1:MM(u),x2:MM(i+h.left),y2:MM(u),stroke:s,lineWidth:MM("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,g,h.color??"#000000");if("justify"===(Pe(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}(m);for(const n of a){const a=n.map(t=>h.allCaps?t.char.toUpperCase():t.char).join("");0!==a.length&&t.drawText(e,{x:MM(i+n[0].left),y:MM(g),text:a,fontSize:u,color:h.color??"#000000",bold:h.bold,italic:h.italic,fontResourceName:p.writerResourceName,characterSpacing:h.characterSpacing??0,horizontalScale:h.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}(m);for(const n of a){const a=n.map(t=>h.allCaps?t.char.toUpperCase():t.char).join("");0!==a.length&&t.drawText(e,{x:MM(i+n[0].left),y:MM(g),text:a,fontSize:u,color:h.color??"#000000",bold:h.bold,italic:h.italic,fontResourceName:p.writerResourceName,characterSpacing:h.characterSpacing??0,horizontalScale:h.characterScale??100})}}h.underline&&TI(t,e,n,r,i,l,h,"underline"),h.strike&&TI(t,e,n,r,i,l,h,"strike"),h.doubleStrike&&TI(t,e,n,r,i,l,h,"doubleStrike")}function VI(t,e,a,n,r,o,i,l,s){var d;if(0!==n.index)return;const c=oa(a,s);if(!c)return;const h=n.slots[0];if(!h)return;const p=Oe(void 0,null==(d=a.style)?void 0:d.styleId,r.styles),u=l.resolveFontFace({fontFamily:p.fontFamily,bold:p.bold,italic:p.italic}),f=ni(a,r.styles),g=xM(p),m=c.length*g*.62*yn,v=ri(a,r.styles,h.left,m);t.drawText(e,{x:MM(o+Math.max(0,v||f)),y:MM(i+n.top+.8*n.height),text:c,fontSize:g,color:p.color??"#000000",bold:p.bold,italic:p.italic,fontResourceName:u.writerResourceName})}function EI(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=In(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:MM(p),y:MM(o),width:MM(Math.max(0,u-p)),height:MM(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:MM(a),y1:MM(n),x2:MM(r),y2:MM(i),stroke:g.color,lineWidth:g.width,dashArray:bI(g.type)})}}async function RI(t,e,a,n,r,o,i,l,s,d){for(const c of n){VI(t,e,a,c,r,o,i,l,s);for(const n of c.fragments)await kI(t,e,a,c,n,r,o,i,l,d)}}function LI(t,e,a,n,r,o,i){"none"===a.type||a.width<=0||t.drawLine(e,{x1:MM(n),y1:MM(r),x2:MM(o),y2:MM(i),stroke:a.color,lineWidth:MM(a.width),dashArray:bI(a.type)})}function zI(t,e,a,n,r){const o=n+a.left,i=r+a.top,l=o+a.width,s=i+a.height;LI(t,e,a.borders.top,o,i,l,i),LI(t,e,a.borders.right,l,i,l,s),LI(t,e,a.borders.bottom,o,s,l,s),LI(t,e,a.borders.left,o,i,o,s)}async function NI(t,e,a,n,r,o,i,l,s,d){if("table"!==a.sourceBlock.type)return;const c=a.sourceBlock,h=a.tableSegment?ln(c,a.tableSegment):c;if(0===h.rows.length)return;const p=Cs({table:h,state:{document:n},pageIndex:0,originX:0,originY:0,contentWidth:i,estimatedHeight:a.estimatedHeight});for(const u of p.cells)u.shading&&t.drawRect(e,{x:MM(r+u.left),y:MM(o+u.top),width:MM(u.width),height:MM(u.height),fill:u.shading});for(const u of p.cells)zI(t,e,u,r,o);for(const u of p.cells)for(const a of u.paragraphs)await RI(t,e,a.paragraph,a.lines,n,r+a.originX,o+a.originY,l,s,d)}const qI={drawParagraph:RI,drawTableBlock:NI};async function OI(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=Pe(p.sourceBlock.style,n.styles),u=h+(0===p.layout.startOffset&&h>o?a.spacingBefore??0:0),f=u+In(a).top;EI(t,e,a,p.layout.lines,r,u,i),await RI(t,e,p.sourceBlock,p.layout.lines,n,r,f,l,s,qI),d&&await MI({writer:t,document:n,fontRegistry:l,pageIndex:e,lines:p.layout.lines,pageSettings:d,contentLeft:r,contentTop:c,contentWidth:i,paragraphTop:u,drawers:qI})}else"table"===p.sourceBlock.type&&await NI(t,e,p,n,r,h,i,l,s,qI);h+=Math.max(0,p.estimatedHeight)}}function PI(t,e,a,n){t.drawRect(e,{x:0,y:0,width:a,height:n,fill:"#ffffff"})}const WI=[{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 HI(t,e,a){return`${t.toLowerCase()}:${e?"bold":"regular"}${a?"italic":""}`}function UI(t){return t.replace(/[^A-Za-z0-9_]/g,"")}class FI{constructor(){a(this,"faces",new Map),a(this,"fallbackFamily","Helvetica");for(const t of WI)this.registerFontFace(t)}registerFontFace(t){this.faces.set(HI(t.family,t.bold,t.italic),t)}resolveFontFace(t){const e=ao(t.fontFamily),a=Boolean(t.bold),n=Boolean(t.italic);return this.faces.get(HI(e,a,n))??this.faces.get(HI(this.fallbackFamily,a,n))??this.faces.get(HI(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(ao).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(to)){const t=await ho(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 eo){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 ho(e);if(!n)continue;const o="bold"===t||"bolditalic"===t,i="italic"===t||"bolditalic"===t,l=`${UI(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 BI{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 GI(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function ZI(t,e){return GI(t).getUint16(e)}function KI(t,e,a){GI(t).setUint16(e,a,!1)}function DI(t,e,a){GI(t).setUint32(e,a,!1)}function jI(t){return t+3&-4}function XI(t){const e=t.reduce((t,e)=>t+jI(e.byteLength),0),a=new Uint8Array(e);let n=0;for(const r of t)a.set(r,n),n+=jI(r.byteLength);return a}function JI(t,e){const a=[],n=GI(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 YI(t,e){const a=t[e],n=t[e+1];return void 0===a||void 0===n?null:{start:a,end:n}}function QI(t,e){if(t.byteLength<10||function(t,e){return GI(t).getInt16(e)}(t,0)>=0)return;let a=10,n=0;do{if(a+4>t.byteLength)return;n=ZI(t,a),e(ZI(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 _I(t){const e=new Uint8Array(4*t.length);return t.forEach((t,a)=>DI(e,4*a,t)),e}function $I(t,e){const a=new Uint8Array(4*(e+1));for(let n=0;n<=e;n+=1)KI(a,4*n,t.advanceWidthForGlyph(n)),KI(a,4*n+2,0);return a}class tT{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=JI(n,ZI(r,50)),i=new Set([0,...e]),l=Array.from(i);for(;l.length>0;){const t=YI(o,l.pop());!t||t.end<=t.start||t.end>a.byteLength||QI(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=JI(n,ZI(r,50)),h=[],p=[];let u=0;for(let b=0;b<=s;b+=1){h.push(u);const t=YI(c,b);if(d.has(b)&&t&&t.end>t.start){const e=a.slice(t.start,t.end);p.push(e),u+=jI(e.byteLength)}}h.push(u);const f=r.slice();DI(f,8,0),KI(f,50,1);const g=o.slice();KI(g,34,s+1);const m=i.slice();KI(m,4,s+1);const v={cmap:l,head:f,hhea:g,hmtx:$I(t,s),loca:_I(h),maxp:m,glyf:XI(p)};for(const b of["OS/2","name","post"]){const e=t.getRawTableData(b);e&&(v[b]=e)}return v}(t,r),i=Rr(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 eT=[{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 aT(t){return Number.isFinite(t)?Number(t.toFixed(3)).toString():"0"}function nT(t){return(new TextEncoder).encode(t).byteLength}function rT(t){return Array.from(t).map(t=>t.toString(16).padStart(2,"0").toUpperCase()).join("")}function oT(t){return Math.max(0,t).toString(16).padStart(4,"0").slice(-4).toUpperCase()}function iT(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`${aT(n)} ${aT(r)} ${aT(o)} ${e}`}function lT(t,e){return(t&&t.trim().length>0?t:e).replaceAll(" ","_").replace(/[^A-Za-z0-9_.+-]/g,"")}const sT=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 dT(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:sT.get(e)??63}(t).toString(16).padStart(2,"0").toUpperCase()).join("")}function cT(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(oT).join("")}function hT(t){return oT(t)}function pT(t){return`% OasisText ${cT(Array.from(t).map(t=>t.codePointAt(0)??65533))}`}class uT{constructor(t=eT){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=$r.decodeSync(t);return Ao.parse(e)}(t.fontData),layouter:new BI(e),subsetter:new tT},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(iT(e.fill,"rg",[1,1,1])),e.stroke&&(n.push(iT(e.stroke,"RG",[0,0,0])),n.push(`${aT(e.lineWidth??1)} w`)),n.push([aT(e.x),aT(a.height-e.y-e.height),aT(e.width),aT(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=>aT(t)).join(" ")}] 0 d`:null,r=["q",iT(e.stroke,"RG",[0,0,0])];n&&r.push(n),r.push(`${aT(e.lineWidth??1)} w`,`${aT(e.x1)} ${aT(a.height-e.y1)} m`,`${aT(e.x2)} ${aT(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(iT(e.fill,"rg",[1,1,1])),e.stroke&&(r.push(iT(e.stroke,"RG",[0,0,0])),r.push(`${aT(e.lineWidth??1)} w`));for(const o of e.segments)switch(o.type){case"move":r.push(`${aT(o.x)} ${aT(n(o.y))} m`);break;case"line":r.push(`${aT(o.x)} ${aT(n(o.y))} l`);break;case"cubic":r.push(`${aT(o.x1)} ${aT(n(o.y1))} ${aT(o.x2)} ${aT(n(o.y2))} ${aT(o.x)} ${aT(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(`${aT(l)} ${aT(s)} ${aT(-s)} ${aT(l)} ${aT(d)} ${aT(c)} cm`)}clipRect(t,e,a,n,r){const o=this.pages[t];!o||n<=0||r<=0||o.commands.push(`${aT(e)} ${aT(o.height-a-r)} ${aT(n)} ${aT(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([pT(e.text),"BT",iT(e.color,"rg",[0,0,0]),`/${n} ${aT(e.fontSize??12)} Tf`,...e.horizontalScale&&e.horizontalScale>0&&100!==e.horizontalScale?[`${aT(e.horizontalScale)} Tz`]:[],...e.characterSpacing&&0!==e.characterSpacing?[`${aT(e.characterSpacing)} Tc`]:[],`${aT(e.x)} ${aT(a.height-e.y)} Td`,`<${dT(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",[aT(e.width),"0","0",aT(e.height),aT(e.x),aT(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",[aT(s),aT(d),aT(c),aT(h),aT(p),aT(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?`<${hT(t.glyphId)}>`:`<${hT(t.glyphId)}> ${aT(e)}`}).join(" ")}] TJ`:`<${r.map(t=>hT(t.glyphId)).join("")}> Tj`;t.commands.push([pT(a.text),"BT",iT(a.color,"rg",[0,0,0]),`/${e.resource.resourceName} ${aT(a.fontSize??12)} Tf`,...a.horizontalScale&&a.horizontalScale>0&&100!==a.horizontalScale?[`${aT(a.horizontalScale)} Tz`]:[],...a.characterSpacing&&0!==a.characterSpacing?[`${aT(a.characterSpacing)} Tc`]:[],`${aT(a.x)} ${aT(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 ${nT(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 ${aT(p.width)} ${aT(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]=nT(d),d+=`${p.id} 0 obj\n${p.body}\nendobj\n`;const h=nT(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=`${rT(t)}>`;return[`<< /Length ${nT(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=`${rT(t)}>`,n=e?` /${e.trim().replace(/^\/+/,"")}`:"";return`<< /Length ${nT(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=`${lT(`${t.resource.resourceName}AAAAAA`,"OASISF").slice(0,6).padEnd(6,"A")}+${lT(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(aT).join(" ")}]`,`/ItalicAngle ${aT(r.italicAngle)}`,`/Ascent ${aT(r.ascent*t.scale)}`,`/Descent ${aT(r.descent*t.scale)}`,`/CapHeight ${aT(r.capHeight*t.scale)}`,`/XHeight ${aT(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=>aT(t??0)).join(" ")}]]`,"/CIDToGIDMap /Identity",">>"].filter(Boolean).join("\n")),h=e(function(t,e=""){const a=e?` /${e.trim().replace(/^\/+/,"")}`:"";return`<< /Length ${nT(t)}${a} >>\nstream\n${t}endstream`}(function(t){const e=t.map(t=>`<${cT(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(`<${oT(n)}> <${oT(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 fT(t){t=ew(t);const e=new FI;await e.loadBundledUnicodeFaces({families:Tc(t)});const a=new uT(e.getPdfFontResources()),n=ss(t),r=function(t){return ra(t)}(t);for(const o of n.pages){const n=Math.max(1,MM(o.pageSettings.width)),i=Math.max(1,MM(o.pageSettings.height)),l=a.addPage({width:n,height:i});PI(a,l,n,i);const s=o.pageSettings.margins.left+o.pageSettings.margins.gutter,d=ye(o.pageSettings);await OI(a,l,o.headerBlocks,t,s,o.headerTop??we(o.pageSettings),d,e,r,o.pageSettings);const c=o.bodyTop??Se(o.pageSettings);if(o.blocks.some(t=>void 0!==t.columnIndex)){const n=Me(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 OI(a,l,d,t,i.left,c,i.width,e,r,o.pageSettings)}}else await OI(a,l,o.blocks,t,s,c,d,e,r,o.pageSettings);await OI(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:MM(s),y1:MM(o.footnoteSeparatorTop+.5),x2:MM(s+Math.min(180,.35*d)),y2:MM(o.footnoteSeparatorTop+.5),stroke:"#64748b",lineWidth:MM(1)}),await gT(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});PI(a,t,612,792)}return a.toArrayBuffer()}async function gT(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=Ql(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=Oe(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:MM(o),y:MM(h+12),text:n,fontSize:xM(i),color:i.color??"#000000",bold:i.bold,italic:i.italic,fontResourceName:l.writerResourceName})}p.add(a)}await OI(t,e,[f],r,o+cn,h,Math.max(24,l-cn),s,d),h+=Math.max(0,f.estimatedHeight)+2}}function mT(t,e){const a=URL.createObjectURL(t),n=document.createElement("a");n.href=a,n.download=e,n.click(),URL.revokeObjectURL(a)}function vT(t){const e=t.download??mT;return{handleExportDocx:async()=>{const a=await async function(t){const e=await vI(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 fT(t);return new Blob([e],{type:"application/pdf"})}(t.document());e(a,"oasis-editor.pdf"),t.focusInput()}}}async function bT(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 yT(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 MT(t){return{handleImportFile:async e=>{if(!e)return;const a=function(t){return oy.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 bT(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=je(t),n=new Map,r=new Map;let o=0,i=0;for(const l of a){const a=Pe(l.style,t.styles);r.set(a.align,(r.get(a.align)??0)+1);for(const r of l.runs){const a=Oe(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=Pe(e.style,t.styles),o=e.runs[0],i=Oe(null==o?void 0:o.styles,null==(n=e.style)?void 0:n.styleId,t.styles);return{index:a,text:Ie(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(Va(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=He(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=De(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 xT(t){return{insertImageFromFile:async(e,a)=>{t.logger.info(`image insert:start name="${e.name}" type=${e.type} size=${e.size}`);const n=await bT(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=eA(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=fa(t.selection)?t:xw(t),{paragraph:n,index:r,offset:o}=Mw(a),i=pw(n,o,[Ma("",dw(n,o),e)]);return vw(a,da(a).map((t,e)=>e===r?i:Kx(t)),yw(Ce(i,o+1)))}(a?Qw(t,{anchor:a,focus:a}):t,{src:r,width:p,height:u}),{mergeKey:"insertImage"})}}}const wT={"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 ST(t){const[e,a]=y(void 0),n=()=>{a(void 0)};x(()=>{fa(t.state().selection)||n()});const r=()=>{const a=np(t.state()),n=e();return fa(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(fa(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(fa(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 AT(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=da(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=He(t.document),n=Math.max(0,Math.min(ia(t),a.length-1)),r=la(t),o=a[n];if(!o)return t;const i=[...a],l={...o},s=xa("");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=da(a),r=e<0?n[0]:n[n.length-1];if(!r)return!1;const o=Ce(r,e<0?Te(r):0);return t.applyTransactionalState(()=>Ew(a,o),{mergeKey:"moveImage"}),t.focusInput(),!0}const i=n[o],l=e<0?Te(i):0;return t.applyTransactionalState(t=>Ew(t,Ce(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(Ow)},selection:{anchor:{...e.anchor},focus:{...e.focus}}})}}}
12
+ */Hp.exports=function t(e,a,n){function r(i,l){if(!a[i]){if(!e[i]){if(!l&&Wp)return Wp(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=Wp,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!==Cn?Cn:"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!==Cn?Cn:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10);const Up=kn(Hp.exports);var Fp={};function Bp(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 Gp(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Zp=Bp({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 Kp=Bp({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 Dp=Bp({script:!1,style:!1,textarea:!0,title:!0});function jp(t){return t===Xp.HTML}var Xp=Bp({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Jp=Object.keys(Xp).map(function(t){return Xp[t]});var Yp=Bp({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/"});Fp.assign=function(t,e){if(null===t||"object"!=typeof t)throw new TypeError("target is not an object");for(var a in e)Gp(e,a)&&(t[a]=e[a]);return t},Fp.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(Gp(t,n)){var r=t[n];if(e.call(void 0,r,n,t))return r}},Fp.freeze=Bp,Fp.HTML_BOOLEAN_ATTRIBUTES=Zp,Fp.HTML_RAW_TEXT_ELEMENTS=Dp,Fp.HTML_VOID_ELEMENTS=Kp,Fp.hasDefaultHTMLNamespace=function(t){return jp(t)||t===Xp.XML_XHTML_APPLICATION},Fp.hasOwn=Gp,Fp.isHTMLBooleanAttribute=function(t){return Gp(Zp,t.toLowerCase())},Fp.isHTMLRawTextElement=function(t){var e=t.toLowerCase();return Gp(Dp,e)&&!Dp[e]},Fp.isHTMLEscapableRawTextElement=function(t){var e=t.toLowerCase();return Gp(Dp,e)&&Dp[e]},Fp.isHTMLMimeType=jp,Fp.isHTMLVoidElement=function(t){return Gp(Kp,t.toLowerCase())},Fp.isValidMimeType=function(t){return Jp.indexOf(t)>-1},Fp.MIME_TYPE=Xp,Fp.NAMESPACE=Yp;var Qp={};function _p(t,e){t.prototype=Object.create(Error.prototype,{constructor:{value:t},name:{value:t.name,enumerable:!0,writable:e}})}var $p=Fp.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"}),tu=Object.keys($p);function eu(t){return"number"==typeof t&&t>=1&&t<=25}function au(t,e){var a;eu(t)?(this.name=tu[t],this.message=e||""):(this.message=t,this.name="string"==typeof(a=e)&&a.substring(a.length-$p.Error.length)===$p.Error?e:$p.Error),Error.captureStackTrace&&Error.captureStackTrace(this,au)}_p(au,!0),Object.defineProperties(au.prototype,{code:{enumerable:!0,get:function(){var t=tu.indexOf(this.name);return eu(t)?t:0}}});for(var nu={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},ru=Object.entries(nu),ou=0;ou<ru.length;ou++){au[ru[ou][0]]=ru[ou][1]}function iu(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,iu)}_p(iu),Qp.DOMException=au,Qp.DOMExceptionName=$p,Qp.ExceptionCode=nu,Qp.ParseError=iu;var lu={},su={};function du(t){try{"function"!=typeof t&&(t=RegExp);var e=new t("𝌆","u").exec("𝌆");return!!e&&2===e[0].length}catch(a){}return!1}var cu=du();function hu(t){if("["!==t.source[0])throw new Error(t+" can not be used with chars");return t.source.slice(1,t.source.lastIndexOf("]"))}function pu(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,""),cu?"u":"")}function uu(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(""),cu?"mu":"m")}function fu(t){if(0===arguments.length)throw new Error("no parameters provided");return uu.apply(fu,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var gu=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;cu&&(gu=uu("[",hu(gu),"\\u{10000}-\\u{10FFFF}","]"));var mu=new RegExp("[^"+hu(gu)+"]",cu?"u":""),vu=/[\x20\x09\x0D\x0A]/,bu=hu(vu),yu=uu(vu,"+"),Mu=uu(vu,"*"),xu=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;cu&&(xu=uu("[",hu(xu),"\\u{10000}-\\u{10FFFF}","]"));var wu=uu("[",hu(xu),hu(/[-.0-9\xB7]/),hu(/[\u0300-\u036F\u203F-\u2040]/),"]"),Su=uu(xu,wu,"*"),Au=uu(wu,"+"),Iu=uu("&",Su,";"),Tu=fu(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),Cu=fu(Iu,"|",Tu),ku=uu("%",Su,";"),Vu=fu(uu('"',fu(/[^%&"]/,"|",ku,"|",Cu),"*",'"'),"|",uu("'",fu(/[^%&']/,"|",ku,"|",Cu),"*","'")),Eu=fu('"',fu(/[^<&"]/,"|",Cu),"*",'"',"|","'",fu(/[^<&']/,"|",Cu),"*","'"),Ru=uu(pu(xu,":"),pu(wu,":"),"*"),Lu=uu(Ru,fu(":",Ru),"?"),zu=uu("^",Lu,"$"),Nu=uu("(",Lu,")"),qu=fu(/"[^"]*"|'[^']*'/),Ou=uu(/^<\?/,"(",Su,")",fu(yu,"(",gu,"*?)"),"?",/\?>/),Pu=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,Wu=fu('"',Pu,'*"',"|","'",pu(Pu,"'"),"*'"),Hu="\x3c!--",Uu=uu(Hu,fu(pu(gu,"-"),"|",uu("-",pu(gu,"-"))),"*","--\x3e"),Fu="#PCDATA",Bu=fu(uu(/\(/,Mu,Fu,fu(Mu,/\|/,Mu,Lu),"*",Mu,/\)\*/),"|",uu(/\(/,Mu,Fu,Mu,/\)/)),Gu=fu("EMPTY","|","ANY","|",Bu,"|",uu(/\([^>]+\)/,/[?*+]?/)),Zu=uu("<!ELEMENT",yu,fu(Lu,"|",ku),yu,fu(Gu,"|",ku),Mu,">"),Ku=uu("NOTATION",yu,/\(/,Mu,Su,fu(Mu,/\|/,Mu,Su),"*",Mu,/\)/),Du=uu(/\(/,Mu,Au,fu(Mu,/\|/,Mu,Au),"*",Mu,/\)/),ju=fu(Ku,"|",Du),Xu=fu(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",ju),Ju=fu(/#REQUIRED|#IMPLIED/,"|",fu(fu("#FIXED",yu),"?",Eu)),Yu=uu("<!ATTLIST",yu,Su,fu(yu,Su,yu,Xu,yu,Ju),"*",Mu,">"),Qu="about:legacy-compat",_u=fu('"'+Qu+'"',"|","'"+Qu+"'"),$u="SYSTEM",tf="PUBLIC",ef=fu(fu($u,yu,qu),"|",fu(tf,yu,Wu,yu,qu)),af=uu("^",fu(fu($u,yu,"(?<SystemLiteralOnly>",qu,")"),"|",fu(tf,yu,"(?<PubidLiteral>",Wu,")",yu,"(?<SystemLiteral>",qu,")"))),nf=uu("^",Wu,"$"),rf=uu("^",qu,"$"),of=fu(yu,"NDATA",yu,Su),lf="<!ENTITY",sf=uu(lf,yu,Su,yu,fu(Vu,"|",fu(ef,of,"?")),Mu,">"),df=fu(Vu,"|",ef),cf=fu(sf,"|",uu(lf,yu,"%",yu,Su,yu,df,Mu,">")),hf=uu(tf,yu,Wu),pf=uu("<!NOTATION",yu,Su,yu,fu(ef,"|",hf),Mu,">"),uf=uu(Mu,"=",Mu),ff=/1[.]\d+/,gf=uu(yu,"version",uf,fu("'",ff,"'","|",'"',ff,'"')),mf=/[A-Za-z][-A-Za-z0-9._]*/,vf=uu(/^<\?xml/,gf,fu(yu,"encoding",uf,fu('"',mf,'"',"|","'",mf,"'")),"?",fu(yu,"standalone",uf,fu("'",fu("yes","|","no"),"'","|",'"',fu("yes","|","no"),'"')),"?",Mu,/\?>/),bf=uu(gu,"*?",/\]\]>/),yf=uu(/<!\[CDATA\[/,bf);su.chars=hu,su.chars_without=pu,su.detectUnicodeSupport=du,su.reg=uu,su.regg=fu,su.ABOUT_LEGACY_COMPAT=Qu,su.ABOUT_LEGACY_COMPAT_SystemLiteral=_u,su.AttlistDecl=Yu,su.CDATA_START="<![CDATA[",su.CDATA_END="]]>",su.CDSect=yf,su.Char=gu,su.Comment=Uu,su.COMMENT_START=Hu,su.COMMENT_END="--\x3e",su.DOCTYPE_DECL_START="<!DOCTYPE",su.elementdecl=Zu,su.EntityDecl=cf,su.EntityValue=Vu,su.ExternalID=ef,su.ExternalID_match=af,su.Name=Su,su.NotationDecl=pf,su.Reference=Cu,su.PEReference=ku,su.PI=Ou,su.PUBLIC=tf,su.PubidLiteral=Wu,su.PubidLiteral_match=nf,su.QName=Lu,su.QName_exact=zu,su.QName_group=Nu,su.S=yu,su.SChar_s=bu,su.S_OPT=Mu,su.SYSTEM=$u,su.SystemLiteral=qu,su.SystemLiteral_match=rf,su.InvalidChar=mu,su.UNICODE_REPLACEMENT_CHARACTER="�",su.UNICODE_SUPPORT=cu,su.XMLDecl=vf;var Mf=Fp,xf=Mf.find,wf=Mf.hasDefaultHTMLNamespace,Sf=Mf.hasOwn,Af=Mf.isHTMLMimeType,If=Mf.isHTMLRawTextElement,Tf=Mf.isHTMLVoidElement,Cf=Mf.MIME_TYPE,kf=Mf.NAMESPACE,Vf=Symbol(),Ef=Qp,Rf=Ef.DOMException,Lf=Ef.DOMExceptionName,zf=su;function Nf(t){if(t!==Vf)throw new TypeError("Illegal constructor")}function qf(t){return""!==t}function Of(t,e){return Sf(t,e)||(t[e]=!0),t}function Pf(t){if(!t)return[];var e=function(t){return t?t.split(/[\t\n\f\r ]+/).filter(qf):[]}(t);return Object.keys(e.reduce(Of,{}))}function Wf(t){if(!zf.QName_exact.test(t))throw new Rf(Rf.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+t+'"')}function Hf(t,e){Wf(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 Rf(Rf.NAMESPACE_ERR,"prefix is non-null and namespace is null");if("xml"===a&&t!==Mf.NAMESPACE.XML)throw new Rf(Rf.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if(("xmlns"===a||"xmlns"===e)&&t!==Mf.NAMESPACE.XMLNS)throw new Rf(Rf.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(t===Mf.NAMESPACE.XMLNS&&"xmlns"!==a&&"xmlns"!==e)throw new Rf(Rf.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[t,a,n]}function Uf(t,e){for(var a in t)Sf(t,a)&&(e[a]=t[a])}function Ff(t,e){var a=t.prototype;if(!(a instanceof e)){let n=function(){};n.prototype=e.prototype,n=new n,Uf(a,n),t.prototype=a=n}a.constructor!=t&&("function"!=typeof t&&console.error("unknown Class:"+t),a.constructor=t)}var Bf={},Gf=Bf.ELEMENT_NODE=1,Zf=Bf.ATTRIBUTE_NODE=2,Kf=Bf.TEXT_NODE=3,Df=Bf.CDATA_SECTION_NODE=4,jf=Bf.ENTITY_REFERENCE_NODE=5,Xf=Bf.ENTITY_NODE=6,Jf=Bf.PROCESSING_INSTRUCTION_NODE=7,Yf=Bf.COMMENT_NODE=8,Qf=Bf.DOCUMENT_NODE=9,_f=Bf.DOCUMENT_TYPE_NODE=10,$f=Bf.DOCUMENT_FRAGMENT_NODE=11,tg=Bf.NOTATION_NODE=12,eg=Mf.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 ag(t,e){if(e.length<t.length)return ag(e,t);var a=null;for(var n in t){if(t[n]!==e[n])return a;a=t[n]}return a}function ng(t){return t.guid||(t.guid=Math.random()),t.guid}function rg(){}function og(t,e){this._node=t,this._refresh=e,ig(this)}function ig(t){var e=t._node._inc||t._node.ownerDocument._inc;if(t._inc!==e){var a=t._refresh(t._node);if(jg(t,"length",a.length),!t.$$length||a.length<t.$$length)for(var n=a.length;n in t;n++)Sf(t,n)&&delete t[n];Uf(a,t),t._inc=e}}function lg(){}function sg(t,e){for(var a=0;a<t.length;){if(t[a]===e)return a;a++}}function dg(t,e,a,n){if(n?e[sg(e,n)]=a:(e[e.length]=a,e.length++),t){a.ownerElement=t;var r=t.ownerDocument;r&&(n&&vg(r,t,n),function(t,e,a){t&&t._inc++;var n=a.namespaceURI;n===kf.XMLNS&&(e._nsMap[a.prefix?a.localName:""]=a.value)}(r,t,a))}}function cg(t,e,a){var n=sg(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&&vg(o,t,a),a.ownerElement=null}}}function hg(){}function pg(t){Nf(t)}function ug(t){return("<"==t?"&lt;":">"==t&&"&gt;")||"&"==t&&"&amp;"||'"'==t&&"&quot;"||"&#"+t.charCodeAt()+";"}function fg(t,e){gg(t,null,{enter:function(t){return!e(t)||gg.STOP}})}function gg(t,e,a){for(var n=[{node:t,context:e,phase:gg.ENTER}];n.length>0;){var r=n.pop();if(r.phase===gg.ENTER){var o=a.enter(r.node,r.context);if(o===gg.STOP)return gg.STOP;if(n.push({node:r.node,context:o,phase:gg.EXIT}),null==o)continue;for(var i=r.node.lastChild;i;)n.push({node:i,context:o,phase:gg.ENTER}),i=i.previousSibling}else a.exit&&a.exit(r.node,r.context)}}function mg(t,e){Nf(t);var a=e||{};this.ownerDocument=this,this.contentType=a.contentType||Cf.XML_APPLICATION,this.type=Af(this.contentType)?"html":"xml"}function vg(t,e,a,n){t&&t._inc++,a.namespaceURI===kf.XMLNS&&delete e._nsMap[a.prefix?a.localName:""]}function bg(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 yg(t,e){if(t!==e.parentNode)throw new Rf(Rf.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,bg(t.ownerDocument,t),e.parentNode=null,e.previousSibling=null,e.nextSibling=null,e}function Mg(t){return t&&t.nodeType===pg.DOCUMENT_TYPE_NODE}function xg(t){return t&&t.nodeType===pg.ELEMENT_NODE}function wg(t){return t&&t.nodeType===pg.TEXT_NODE}function Sg(t,e){var a=t.childNodes||[];if(xf(a,xg)||Mg(e))return!1;var n=xf(a,Mg);return!(e&&n&&a.indexOf(n)>a.indexOf(e))}function Ag(t,e){var a=t.childNodes||[];if(xf(a,function(t){return xg(t)&&t!==e}))return!1;var n=xf(a,Mg);return!(e&&n&&a.indexOf(n)>a.indexOf(e))}function Ig(t,e,a){if(!function(t){return t&&(t.nodeType===pg.DOCUMENT_NODE||t.nodeType===pg.DOCUMENT_FRAGMENT_NODE||t.nodeType===pg.ELEMENT_NODE)}(t))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+t.nodeType);if(a&&a.parentNode!==t)throw new Rf(Rf.NOT_FOUND_ERR,"child not in parent");if(!function(t){return t&&(t.nodeType===pg.CDATA_SECTION_NODE||t.nodeType===pg.COMMENT_NODE||t.nodeType===pg.DOCUMENT_FRAGMENT_NODE||t.nodeType===pg.DOCUMENT_TYPE_NODE||t.nodeType===pg.ELEMENT_NODE||t.nodeType===pg.PROCESSING_INSTRUCTION_NODE||t.nodeType===pg.TEXT_NODE)}(e)||Mg(e)&&t.nodeType!==pg.DOCUMENT_NODE)throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function Tg(t,e,a){var n=t.childNodes||[],r=e.childNodes||[];if(e.nodeType===pg.DOCUMENT_FRAGMENT_NODE){var o=r.filter(xg);if(o.length>1||xf(r,wg))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(1===o.length&&!Sg(t,a))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(xg(e)&&!Sg(t,a))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Mg(e)){if(xf(n,Mg))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var i=xf(n,xg);if(a&&n.indexOf(i)<n.indexOf(a))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!a&&i)throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}function Cg(t,e,a){var n=t.childNodes||[],r=e.childNodes||[];if(e.nodeType===pg.DOCUMENT_FRAGMENT_NODE){var o=r.filter(xg);if(o.length>1||xf(r,wg))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(1===o.length&&!Ag(t,a))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(xg(e)&&!Ag(t,a))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Mg(e)){if(xf(n,function(t){return Mg(t)&&t!==a}))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var i=xf(n,xg);if(a&&n.indexOf(i)<n.indexOf(a))throw new Rf(Rf.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}function kg(t,e,a,n){Ig(t,e,a),t.nodeType===pg.DOCUMENT_NODE&&(n||Tg)(t,e,a);var r=e.parentNode;if(r&&r.removeChild(e),e.nodeType===$f){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 bg(t.ownerDocument||t,t,e),e.nodeType==$f&&(e.firstChild=e.lastChild=null),e}function Vg(t){Nf(t),this._nsMap=Object.create(null)}function Eg(t){Nf(t),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}function Rg(t){Nf(t)}function Lg(t){Nf(t)}function zg(t){Nf(t)}function Ng(t){Nf(t)}function qg(t){Nf(t)}function Og(t){Nf(t)}function Pg(t){Nf(t)}function Wg(t){Nf(t)}function Hg(t){Nf(t)}function Ug(t){Nf(t)}function Fg(){}function Bg(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===Qf&&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 Kg(this,a,i,e),a.join("")}function Gg(t,e,a){var n=t.prefix||"",r=t.namespaceURI;if(!r)return!1;if("xml"===n&&r===kf.XML||r===kf.XMLNS)return!1;for(var o=a.length;o--;){var i=a[o];if(i.prefix===n)return i.namespace!==r}return!0}function Zg(t,e,a){t.push(" ",e,'="',a.replace(/[<>&"\t\n\r]/g,ug),'"')}function Kg(t,e,a,n){a||(a=[]);var r=n.nodeFilter,o=n.requireWellFormed,i=n.splitCDATASections,l="html"===(t.nodeType===Qf?t:t.ownerDocument).type;gg(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 Gf: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(Gg(y=d.item(b),0,v)){var M=y.prefix||"",x=y.namespaceURI;Zg(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):Zg(e,w.name,w.value))}if(h===p&&Gg(t,0,v)){var S=t.prefix||"";x=t.namespaceURI;Zg(e,S?"xmlns:"+S:"xmlns",x),v.push({prefix:S,namespace:x})}var A=!t.firstChild;if(A&&(l||t.namespaceURI===kf.HTML)&&(A=Tf(h)),A)return e.push("/>"),null;if(e.push(">"),l&&If(h)){for(var I=t.firstChild;I;)I.data?e.push(I.data):Kg(I,e,v.slice(),n),I=I.nextSibling;return e.push("</",p,">"),null}return{ns:v,tag:p};case Qf:case $f:if(o&&t.nodeType===Qf&&null==t.documentElement)throw new Rf("The Document has no documentElement",Lf.InvalidStateError);return{ns:s};case Zf:return Zg(e,t.name,t.value),null;case Kf:if(o&&zf.InvalidChar.test(t.data))throw new Rf("The Text node data contains characters outside the XML Char production",Lf.InvalidStateError);return e.push(t.data.replace(/[<&>]/g,ug)),null;case Df:if(o&&-1!==t.data.indexOf("]]>"))throw new Rf('The CDATASection data contains "]]>"',Lf.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 Yf:if(o){if(zf.InvalidChar.test(t.data))throw new Rf("The comment node data contains characters outside the XML Char production",Lf.InvalidStateError);if(-1!==t.data.indexOf("--")||"-"===t.data[t.data.length-1])throw new Rf('The comment node data contains "--" or ends with "-"',Lf.InvalidStateError)}return e.push(zf.COMMENT_START,t.data,zf.COMMENT_END),null;case _f:var T=t.publicId,C=t.systemId;if(o){if(T&&!zf.PubidLiteral_match.test(T))throw new Rf("DocumentType publicId is not a valid PubidLiteral",Lf.InvalidStateError);if(C&&"."!==C&&!zf.SystemLiteral_match.test(C))throw new Rf("DocumentType systemId is not a valid SystemLiteral",Lf.InvalidStateError);if(t.internalSubset&&-1!==t.internalSubset.indexOf("]>"))throw new Rf('DocumentType internalSubset contains "]>"',Lf.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 Jf:if(o){if(-1!==t.target.indexOf(":")||"xml"===t.target.toLowerCase())throw new Rf("The ProcessingInstruction target is not well-formed",Lf.InvalidStateError);if(zf.InvalidChar.test(t.data))throw new Rf("The ProcessingInstruction data contains characters outside the XML Char production",Lf.InvalidStateError);if(-1!==t.data.indexOf("?>"))throw new Rf('The ProcessingInstruction data contains "?>"',Lf.InvalidStateError)}return e.push("<?",t.target," ",t.data,"?>"),null;case jf: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 Dg(t,e,a){var n;return gg(e,null,{enter:function(e,r){var o=new e.constructor(Vf);for(var i in e)if(Sf(e,i)){var l=e[i];"object"!=typeof l&&l!=o[i]&&(o[i]=l)}e.childNodes&&(o.childNodes=new rg),o.ownerDocument=t;var s=a;switch(o.nodeType){case Gf:var d=e.attributes,c=o.attributes=new lg,h=d.length;c._ownerElement=o;for(var p=0;p<h;p++)o.setAttributeNode(Dg(t,d.item(p),!0));break;case Zf:s=!0}return null!==r?r.appendChild(o):n=o,s?o:null}}),n}function jg(t,e,a){t[e]=a}function Xg(t){for(var e=[],a=t.firstChild;a;)a.nodeType===Gf&&e.push(a),a=a.nextSibling;return e}rg.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++)Kg(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)}},rg.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}}}},og.prototype.item=function(t){return ig(this),this[t]||null},Ff(og,rg),lg.prototype={length:0,item:rg.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 Rf(Rf.INUSE_ATTRIBUTE_ERR);var a=this.getNamedItemNS(t.namespaceURI,t.localName);return a===t?t:(dg(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 Rf(Rf.NOT_FOUND_ERR,t);return cg(this._ownerElement,this,e),e},removeNamedItemNS:function(t,e){var a=this.getNamedItemNS(t,e);if(!a)throw new Rf(Rf.NOT_FOUND_ERR,t?t+" : "+e:e);return cg(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}},lg.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}}}},hg.prototype={hasFeature:function(t,e){return!0},createDocument:function(t,e,a){var n=Cf.XML_APPLICATION;t===kf.HTML?n=Cf.XML_XHTML_APPLICATION:t===kf.SVG&&(n=Cf.XML_SVG_IMAGE);var r=new mg(Vf,{contentType:n});if(r.implementation=this,r.childNodes=new rg,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){Wf(t);var r=new qg(Vf);return r.name=t,r.nodeName=t,r.publicId=e||"",r.systemId=a||"",r.internalSubset=n||"",r.childNodes=new rg,r},createHTMLDocument:function(t){var e=new mg(Vf,{contentType:Cf.HTML});if(e.implementation=this,e.childNodes=new rg,!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}},pg.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 kg(this,t,e)},replaceChild:function(t,e){kg(this,t,e,Cg),e&&this.removeChild(e)},removeChild:function(t){return yg(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(t){return Dg(this.ownerDocument||this,this,t)},normalize:function(){gg(this,null,{enter:function(t){for(var e=t.firstChild;e;){var a=e.nextSibling;null!==a&&a.nodeType===Kf&&e.nodeType===Kf?(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(Sf(a,n)&&a[n]===t)return n;e=e.nodeType==Zf?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var a=e._nsMap;if(a&&Sf(a,t))return a[t];e=e.nodeType==Zf?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 Eg&&(e=(n=e).ownerElement),a instanceof Eg&&(a=(r=a).ownerElement,n&&e&&a===e))for(var o,i=0;o=a.attributes[i];i++){if(o===n)return eg.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+eg.DOCUMENT_POSITION_PRECEDING;if(o===r)return eg.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+eg.DOCUMENT_POSITION_FOLLOWING}if(!e||!a||a.ownerDocument!==e.ownerDocument)return eg.DOCUMENT_POSITION_DISCONNECTED+eg.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(ng(a.ownerDocument)>ng(e.ownerDocument)?eg.DOCUMENT_POSITION_FOLLOWING:eg.DOCUMENT_POSITION_PRECEDING);if(r&&e===a)return eg.DOCUMENT_POSITION_CONTAINS+eg.DOCUMENT_POSITION_PRECEDING;if(n&&e===a)return eg.DOCUMENT_POSITION_CONTAINED_BY+eg.DOCUMENT_POSITION_FOLLOWING;for(var l=[],s=e.parentNode;s;){if(!r&&s===a)return eg.DOCUMENT_POSITION_CONTAINED_BY+eg.DOCUMENT_POSITION_FOLLOWING;l.push(s),s=s.parentNode}l.reverse();for(var d=[],c=a.parentNode;c;){if(!n&&c===e)return eg.DOCUMENT_POSITION_CONTAINS+eg.DOCUMENT_POSITION_PRECEDING;d.push(c),c=c.parentNode}d.reverse();var h=ag(l,d);for(var p in h.childNodes){var u=h.childNodes[p];if(u===a)return eg.DOCUMENT_POSITION_FOLLOWING;if(u===e)return eg.DOCUMENT_POSITION_PRECEDING;if(d.indexOf(u)>=0)return eg.DOCUMENT_POSITION_FOLLOWING;if(l.indexOf(u)>=0)return eg.DOCUMENT_POSITION_PRECEDING}return 0}},Uf(Bf,pg),Uf(Bf,pg.prototype),Uf(eg,pg),Uf(eg,pg.prototype),gg.STOP=Symbol("walkDOM.STOP"),gg.ENTER=0,gg.EXIT=1,mg.prototype={implementation:null,nodeName:"#document",nodeType:Qf,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType===$f){for(var a=t.firstChild;a;){var n=a.nextSibling;this.insertBefore(a,e),a=n}return t}return kg(this,t,e),t.ownerDocument=this,null===this.documentElement&&t.nodeType===Gf&&(this.documentElement=t),t},removeChild:function(t){var e=yg(this,t);return e===this.documentElement&&(this.documentElement=null),e},replaceChild:function(t,e){kg(this,t,e,Cg),t.ownerDocument=this,e&&this.removeChild(e),xg(t)&&(this.documentElement=t)},importNode:function(t,e){return function(t,e,a){var n;return gg(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===Zf||a?o:null}}),n}(this,t,e)},getElementById:function(t){var e=null;return fg(this.documentElement,function(a){if(a.nodeType==Gf&&a.getAttribute("id")==t)return e=a,!0}),e},createElement:function(t){var e=new Vg(Vf);return e.ownerDocument=this,"html"===this.type&&(t=t.toLowerCase()),wf(this.contentType)&&(e.namespaceURI=kf.HTML),e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new rg,(e.attributes=new lg)._ownerElement=e,e},createDocumentFragment:function(){var t=new Hg(Vf);return t.ownerDocument=this,t.childNodes=new rg,t},createTextNode:function(t){var e=new Lg(Vf);return e.ownerDocument=this,e.childNodes=new rg,e.appendData(t),e},createComment:function(t){var e=new zg(Vf);return e.ownerDocument=this,e.childNodes=new rg,e.appendData(t),e},createCDATASection:function(t){if(-1!==t.indexOf("]]>"))throw new Rf(Rf.INVALID_CHARACTER_ERR,'data contains "]]>"');var e=new Ng(Vf);return e.ownerDocument=this,e.childNodes=new rg,e.appendData(t),e},createProcessingInstruction:function(t,e){var a=new Ug(Vf);return a.ownerDocument=this,a.childNodes=new rg,a.nodeName=a.target=t,a.nodeValue=a.data=e,a},createAttribute:function(t){if(!zf.QName_exact.test(t))throw new Rf(Rf.INVALID_CHARACTER_ERR,'invalid character in name "'+t+'"');return"html"===this.type&&(t=t.toLowerCase()),this._createAttribute(t)},_createAttribute:function(t){var e=new Eg(Vf);return e.ownerDocument=this,e.childNodes=new rg,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){if(!zf.Name.test(t))throw new Rf(Rf.INVALID_CHARACTER_ERR,'not a valid xml name "'+t+'"');if("html"===this.type)throw new Rf("document is an html document",Lf.NotSupportedError);var e=new Wg(Vf);return e.ownerDocument=this,e.childNodes=new rg,e.nodeName=t,e},createElementNS:function(t,e){var a=Hf(t,e),n=new Vg(Vf),r=n.attributes=new lg;return n.childNodes=new rg,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=Hf(t,e),n=new Eg(Vf);return n.ownerDocument=this,n.childNodes=new rg,n.nodeName=e,n.name=e,n.specified=!0,n.namespaceURI=a[0],n.prefix=a[1],n.localName=a[2],n}},Ff(mg,pg),Vg.prototype={nodeType:Gf,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return"html"===this.ownerDocument.type&&this.namespaceURI===kf.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=Hf(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=Pf(t);return new og(this,function(a){var n=[];return e.length>0&&fg(a,function(r){if(r!==a&&r.nodeType===Gf){var o=r.getAttribute("class");if(o){var i=t===o;if(!i){var l=Pf(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===Qf?this:this.ownerDocument).type,a=t.toLowerCase();return new og(this,function(n){var r=[];return fg(n,function(o){o!==n&&o.nodeType===Gf&&(("*"===t||o.getQualifiedName()===(e&&o.namespaceURI===kf.HTML?a:t))&&r.push(o))}),r})},getElementsByTagNameNS:function(t,e){return new og(this,function(a){var n=[];return fg(a,function(r){r===a||r.nodeType!==Gf||"*"!==t&&r.namespaceURI!==t||"*"!==e&&r.localName!=e||n.push(r)}),n})}},mg.prototype.getElementsByClassName=Vg.prototype.getElementsByClassName,mg.prototype.getElementsByTagName=Vg.prototype.getElementsByTagName,mg.prototype.getElementsByTagNameNS=Vg.prototype.getElementsByTagNameNS,Ff(Vg,pg),Eg.prototype.nodeType=Zf,Ff(Eg,pg),Rg.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}},Ff(Rg,pg),Lg.prototype={nodeName:"#text",nodeType:Kf,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}},Ff(Lg,Rg),zg.prototype={nodeName:"#comment",nodeType:Yf},Ff(zg,Rg),Ng.prototype={nodeName:"#cdata-section",nodeType:Df},Ff(Ng,Lg),qg.prototype.nodeType=_f,Ff(qg,pg),Og.prototype.nodeType=tg,Ff(Og,pg),Pg.prototype.nodeType=Xf,Ff(Pg,pg),Wg.prototype.nodeType=jf,Ff(Wg,pg),Hg.prototype.nodeName="#document-fragment",Hg.prototype.nodeType=$f,Ff(Hg,pg),Ug.prototype.nodeType=Jf,Ff(Ug,Rg),Fg.prototype.serializeToString=function(t,e){return Bg.call(t,e)},pg.prototype.toString=Bg;try{Object.defineProperty&&(Object.defineProperty(og.prototype,"length",{get:function(){return ig(this),this.$$length}}),Object.defineProperty(pg.prototype,"textContent",{get:function(){if(this.nodeType===Gf||this.nodeType===$f){var t=[];return gg(this,null,{enter:function(e){return e.nodeType===Gf||e.nodeType===$f||(e.nodeType===Jf||e.nodeType===Yf?null:void t.push(e.nodeValue))}}),t.join("")}return this.nodeValue},set:function(t){switch(this.nodeType){case Gf:case $f: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(Vg.prototype,"children",{get:function(){return new og(this,Xg)}}),Object.defineProperty(mg.prototype,"children",{get:function(){return new og(this,Xg)}}),Object.defineProperty(Hg.prototype,"children",{get:function(){return new og(this,Xg)}}),jg=function(t,e,a){t["$$"+e]=a})}catch(aN){}lu._updateLiveList=ig,lu.Attr=Eg,lu.CDATASection=Ng,lu.CharacterData=Rg,lu.Comment=zg,lu.Document=mg,lu.DocumentFragment=Hg,lu.DocumentType=qg,lu.DOMImplementation=hg,lu.Element=Vg,lu.Entity=Pg,lu.EntityReference=Wg,lu.LiveNodeList=og,lu.NamedNodeMap=lg,lu.Node=pg,lu.NodeList=rg,lu.Notation=Og,lu.Text=Lg,lu.ProcessingInstruction=Ug,lu.walkDOM=gg,lu.XMLSerializer=Fg;var Jg,Yg,Qg={},_g={};Jg=_g,Yg=Fp.freeze,Jg.XML_ENTITIES=Yg({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),Jg.HTML_ENTITIES=Yg({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:"‌"}),Jg.entityMap=Jg.HTML_ENTITIES;var $g={},tm=Fp,em=su,am=Qp,nm=tm.isHTMLEscapableRawTextElement,rm=tm.isHTMLMimeType,om=tm.isHTMLRawTextElement,im=tm.hasOwn,lm=tm.NAMESPACE,sm=am.ParseError,dm=am.DOMException;function cm(){}cm.prototype={parse:function(t,e,a){var n=this.domBuilder;n.startDocument(),mm(e,e=Object.create(null)),function(t,e,a,n,r){var o=rm(n.mimeType);t.indexOf(em.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=em.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 im(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(hm,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(em.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&&em.reg("^",em.QName_group,em.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)im(C,k)&&n.endPrefixMapping(k);x++;break;case"?":p&&u(v),x=ym(t,v,n,r);break;case"!":p&&u(v),x=bm(t,v,n,r,o);break;default:p&&u(v);var V=new Mm,E=f[f.length-1].currentNSMap,R=(x=um(t,v,V,E,l,r,o),V.length);if(V.closed||(o&&tm.isHTMLVoidElement(V.tagName)?V.closed=!0:g.push(V.tagName)),p&&R){for(var L=pm(p,{}),z=0;z<R;z++){var N=V[z];u(N.offset),N.locator=pm(p,{})}n.locator=L,fm(V,n,E)&&f.push(V),n.locator=p}else fm(V,n,E)&&f.push(V);o&&!V.closed?x=gm(t,x,V.tagName,l,n):x++}}catch(aN){if(aN instanceof sm)throw aN;if(aN instanceof dm)throw new sm(aN.name+": "+aN.message,n.locator,aN);r.error("element parse error: "+aN),x=-1}x>m?m=x:s(Math.max(v,m)+1)}}(t,e,a,n,this.errorHandler),n.endDocument()}};var hm=/&#?\w+;?/g;function pm(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function um(t,e,a,n,r,o,i){function l(t,e,n){return im(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(hm,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 fm(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),mm(a,a=Object.create(null))),a[h]=r[h]=s,i.uri=lm.XMLNS,e.startPrefixMapping(h,s))}for(o=t.length;o--;)(i=t[o]).prefix&&("xml"===i.prefix&&(i.uri=lm.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)im(r,d)&&e.endPrefixMapping(d)}function gm(t,e,a,n,r){var o=nm(a);if(o||om(a)){var i=t.indexOf("</"+a+">",e),l=t.substring(e+1,i);return o&&(l=l.replace(hm,n)),r.characters(l,0,l.length),i}return e+1}function mm(t,e){for(var a in t)im(t,a)&&(e[a]=t[a])}function vm(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=em.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 bm(t,e,a,n,r){var o=vm(t,e);switch(r?o.char(2).toUpperCase():o.char(2)){case"-":var i=o.getMatch(em.Comment);return i?(a.comment(i,em.COMMENT_START.length,i.length-em.COMMENT_START.length-em.COMMENT_END.length),o.getIndex()):n.fatalError("comment is not well-formed at position "+o.getIndex());case"[":var l=o.getMatch(em.CDSect);return l?r||a.currentElement?(a.startCDATA(),a.characters(l,em.CDATA_START.length,l.length-em.CDATA_START.length-em.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(em.DOCTYPE_DECL_START):!o.substringStartsWith(em.DOCTYPE_DECL_START))return n.fatalError("Expected "+em.DOCTYPE_DECL_START+" at position "+o.getIndex());if(o.skip(em.DOCTYPE_DECL_START.length),o.skipBlanks()<1)return n.fatalError("Expected whitespace after "+em.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(em.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(em.PUBLIC)||o.substringStartsWith(em.SYSTEM)){var d=em.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(em.SYSTEM)){if(o.skip(em.SYSTEM.length),o.skipBlanks()<1)return n.fatalError("Expected whitespace after "+em.SYSTEM+" at position "+o.getIndex());if(s.systemId=o.getMatch(em.ABOUT_LEGACY_COMPAT_SystemLiteral),!s.systemId)return n.fatalError("Expected "+em.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+em.SYSTEM+" at position "+o.getIndex())}return r&&s.systemId&&!em.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=em.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(em.elementdecl):"N"===t.char(3)&&(i=t.getMatch(em.EntityDecl));break;case"A":i=t.getMatch(em.AttlistDecl);break;case"N":i=t.getMatch(em.NotationDecl);break;case"-":i=t.getMatch(em.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(em.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 ym(t,e,a,n){var r=t.substring(e).match(em.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(!em.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 Mm(){this.attributeNames=Object.create(null)}Mm.prototype={setTagName:function(t){if(!em.QName_exact.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,a){if(!em.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}},$g.XMLReader=cm,$g.parseUtils=vm,$g.parseDoctypeCommentOrCData=bm;var xm=Fp,wm=Qp,Sm=_g,Am=$g,Im=lu.DOMImplementation,Tm=xm.hasDefaultHTMLNamespace,Cm=xm.isHTMLMimeType,km=xm.isValidMimeType,Vm=xm.MIME_TYPE,Em=xm.NAMESPACE,Rm=wm.ParseError,Lm=Am.XMLReader;function zm(t){return t.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028\u2029]/g,"\n")}function Nm(t){if(void 0===(t=t||{}).locator&&(t.locator=!0),this.assign=t.assign||xm.assign,this.domHandler=t.domHandler||qm,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 qm(t){var e=t||{};this.mimeType=e.mimeType||Vm.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 Om(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}function Pm(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 Wm(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}Nm.prototype.parseFromString=function(t,e){if(!km(e))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+e+'" is not valid.');var a=this.assign(Object.create(null),this.xmlns),n=Sm.XML_ENTITIES,r=a[""]||null;Tm(e)?(n=Sm.HTML_ENTITIES,r=Em.HTML):e===Vm.XML_SVG_IMAGE&&(r=Em.SVG),a[""]=r,a.xml=a.xml||Em.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 Lm;return l.errorHandler=o,l.domBuilder=o,!xm.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},qm.prototype={startDocument:function(){var t=new Im;this.doc=Cm(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;Wm(this,o),this.currentElement=o,this.locator&&Om(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&&Om(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&&Om(this.locator,a),Wm(this,a)},ignorableWhitespace:function(t,e,a){},characters:function(t,e,a){if(t=Pm.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&&Om(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=Pm.apply(this,arguments);var n=this.doc.createComment(t);this.locator&&Om(this.locator,n),Wm(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&&Om(this.locator,o),Wm(this,o),this.doc.doctype=o}},reportError:function(t,e){if("function"==typeof this.onError)try{this.onError(t,e,this)}catch(aN){throw new Rm("Reporting "+t+' "'+e+'" caused '+aN,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 Rm(t,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(t){qm.prototype[t]=function(){return null}}),Qg.__DOMHandler=qm,Qg.DOMParser=Nm,Qg.normalizeLineEndings=zm,Qg.onErrorStopParsing=function(t){if("error"===t)throw"onErrorStopParsing"},Qg.onWarningStopParsing=function(){throw"onWarningStopParsing"};var Hm=Fp;Hm.assign,Hm.hasDefaultHTMLNamespace,Hm.isHTMLMimeType,Hm.isValidMimeType,Hm.MIME_TYPE,Hm.NAMESPACE;var Um=lu.XMLSerializer,Fm=Qg.DOMParser;const Bm="http://schemas.openxmlformats.org/wordprocessingml/2006/main",Gm="http://schemas.openxmlformats.org/drawingml/2006/main",Zm="http://schemas.microsoft.com/office/word/2010/wordml";function Km(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 Dm=["lrTb","tbRl","btLr","lrTbV","tbRlV"];function jm(t){return Dm.includes(t)?t:void 0}function Xm(t,e,a){return Km(t,e,a)[0]??null}function Jm(t,e){return t?t.getAttributeNS(Bm,e)??t.getAttributeNS(Zm,e)??t.getAttribute(`w:${e}`)??t.getAttribute(`w14:${e}`)??t.getAttribute(e):null}function Ym(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=Ym(t,e);if(a)return a}}return null}function Qm(t){return"1"===t||"true"===t||"on"===t}function _m(t,e){const a=Xm(t,Bm,e);if(!a)return;const n=Jm(a,"val");return null==n||"0"!==n&&"false"!==n&&"off"!==n&&Qm(n)}function $m(t,e){return Jm(Xm(t,Bm,e),"val")??void 0}async function tv(t,e){e>0&&e%t===0&&await new Promise(t=>setTimeout(t,0))}function ev(t){var e;const a=new Map;if(!t)return a;const n=null==(e=(new Fm).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 av(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 ev(await(null==(a=t.file(i))?void 0:a.async("string")))}const nv=t=>{var e;const a=Xm(t,Gm,"latin");return(null==(e=null==a?void 0:a.getAttribute("typeface"))?void 0:e.trim())||void 0},rv=t=>{var e;const a=Xm(t,Gm,"cs");return(null==(e=null==a?void 0:a.getAttribute("typeface"))?void 0:e.trim())||nv(t)},ov=t=>{var e;const a=Xm(t,Gm,"ea");return(null==(e=null==a?void 0:a.getAttribute("typeface"))?void 0:e.trim())||nv(t)};function iv(t){const e=Xm(t,Gm,"fontScheme"),a=Xm(e,Gm,"majorFont"),n=Xm(e,Gm,"minorFont");return{majorHAnsi:nv(a),minorHAnsi:nv(n),majorEastAsia:ov(a),minorEastAsia:ov(n),majorBidi:rv(a),minorBidi:rv(n)}}function lv(t,e){const a=t?Number(t):Number.NaN;return Number.isFinite(a)?Math.round(a/Sn*bn):e}function sv(t){const e=t?Number(t):Number.NaN;if(Number.isFinite(e))return Math.round(e/20*1e4)/1e4}function dv(t){const e=null==t?void 0:t.trim();if(e&&"auto"!==e&&"none"!==e)return e.startsWith("#")?e:`#${e.toUpperCase()}`}const cv=["dk1","lt1","dk2","lt2","accent1","accent2","accent3","accent4","accent5","accent6","hlink","folHlink"];function hv(t){const e=Xm(t,Gm,"srgbClr");if(e)return dv(Jm(e,"val"));const a=Xm(t,Gm,"sysClr");return a?dv(Jm(a,"lastClr")):void 0}function pv(t){const e=Xm(t,Gm,"clrScheme");if(!e)return{};const a={};for(const n of cv){const t=hv(Xm(e,Gm,n));t&&(a[n]=t)}return a}function uv(t){if(!t)return;const e=Number.parseInt(t,16);return Number.isFinite(e)?e/255:void 0}function fv(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 gv={decimal:"decimal",lowerRoman:"lowerRoman",upperRoman:"upperRoman",lowerLetter:"lowerLetter",upperLetter:"upperLetter",symbol:"symbol"},mv={continuous:"continuous",eachSect:"eachSection"};function vv(t){if(!t)return;const e={},a=Jm(Xm(t,Bm,"numFmt"),"val");a&&gv[a]&&(e.numberFormat=gv[a]);const n=Number.parseInt(Jm(Xm(t,Bm,"numStart"),"val")??"",10);Number.isFinite(n)&&n>0&&(e.startAt=n);const r=Jm(Xm(t,Bm,"numRestart"),"val");return r&&mv[r]&&(e.restart=mv[r]),Object.keys(e).length>0?e:void 0}const bv={decimal:"decimal",lowerLetter:"lowerLetter",upperLetter:"upperLetter",lowerRoman:"lowerRoman",upperRoman:"upperRoman",bullet:"bullet"};function yv(t){const e={},a=Jm(Xm(t,Bm,"numFmt"),"val");a&&(e.kind="bullet"===a?"bullet":"ordered",e.format=bv[a]);const n=Jm(Xm(t,Bm,"suff"),"val");"tab"!==n&&"space"!==n&&"nothing"!==n||(e.suffix=n);const r=Jm(Xm(t,Bm,"start"),"val");if(null!=r){const t=Number.parseInt(r,10);Number.isFinite(t)&&(e.startAt=t)}e.levelText=Jm(Xm(t,Bm,"lvlText"),"val")??void 0;const o=Jm(Xm(t,Bm,"lvlJc"),"val");"left"!==o&&"center"!==o&&"right"!==o||(e.alignment=o);const i=Xm(t,Bm,"isLgl");var l;i&&(e.legal=null==(l=Jm(i,"val"))||"1"===l||"true"===l||"on"===l),"bullet"===e.kind&&e.levelText&&(e.bulletGlyph=e.levelText);const s=Xm(t,Bm,"rPr"),d=Xm(s,Bm,"rFonts");e.bulletFont=Jm(d,"ascii")??Jm(d,"hAnsi")??void 0;const c=Xm(t,Bm,"pPr"),h=Xm(c,Bm,"ind");if(h){const t=Jm(h,"left")??Jm(h,"start"),a=Jm(h,"hanging"),n=null!=t?lv(t,0):void 0,r=null!=a?lv(a,0):void 0;void 0===n&&void 0===r||(e.indent={left:n,hanging:r})}return e}function Mv(t,e,a){const n=t.numToAbstractId.get(e),r=n?t.abstractLevels.get(`${n}:${a}`):void 0;return t.numOverrideLevels.get(`${e}:${a}`)??r??{}}function xv(t){const e=Object.entries(t).filter(([,t])=>void 0!==t);return e.length>0?Object.fromEntries(e):void 0}function wv(t){return Object.keys(t).length>0?t:void 0}function Sv(t,e){return wv({...t??{},...e??{}})}function Av(t){return dv(Jm(t,"fill"))}function Iv(t,e){if(!t)return;const a=Oe(t,e,Ca),n=Oe(void 0,e,Ca),r=(t,e)=>t!==e?t:void 0,o=(t,e,a)=>void 0!==t?t:r(e,a);return xv({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 Tv(t,e){if(!t)return;const a={},n=$m(t,"rStyle");n&&(a.styleId=n);const r=_m(t,"b"),o=_m(t,"bCs");void 0===r&&void 0===o||(a.bold=!0===r||!0===o);const i=_m(t,"i"),l=_m(t,"iCs");void 0===i&&void 0===l||(a.italic=!0===i||!0===l);const s=_m(t,"strike");void 0!==s&&(a.strike=s);const d=_m(t,"dstrike");void 0!==d&&(a.doubleStrike=d);const c=_m(t,"smallCaps");void 0!==c&&(a.smallCaps=c);const h=_m(t,"caps");void 0!==h&&(a.allCaps=h);const p=_m(t,"vanish");void 0!==p&&(a.hidden=p);const u=_m(t,"noProof");void 0!==u&&(a.noProof=u);const f=_m(t,"webHidden");void 0!==f&&(a.webHidden=f);const g=_m(t,"specVanish");void 0!==g&&(a.specVanish=g);const m=Jm(Xm(t,Bm,"effect"),"val");m&&(a.textEffect=m);const v=Jm(Xm(t,Bm,"w"),"val");if(v){const t=Number(v);Number.isFinite(t)&&t>0&&(a.characterScale=t)}const b=Jm(Xm(t,Bm,"spacing"),"val");if(b){const t=sv(b);void 0!==t&&(a.characterSpacing=t)}const y=Jm(Xm(t,Bm,"position"),"val");if(y){const t=Number(y);Number.isFinite(t)&&(a.baselineShift=t/2)}const M=Jm(Xm(t,Bm,"kern"),"val");if(M){const t=Number(M);Number.isFinite(t)&&t>=0&&(a.kerningThreshold=t/2)}const x=Jm(Xm(t,Zm,"ligatures"),"val");"none"!==x&&"standard"!==x&&"contextual"!==x&&"historical"!==x&&"standardContextual"!==x||(a.ligatures=x);const w=Jm(Xm(t,Zm,"numSpacing"),"val");"proportional"!==w&&"tabular"!==w||(a.numberSpacing=w);const S=Jm(Xm(t,Zm,"numForm"),"val");"lining"!==S&&"oldStyle"!==S||(a.numberForm=S);const A=Jm(Xm(t,Zm,"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=Jm(Xm(t,Zm,"cntxtAlts"),"val");null===I?Xm(t,Zm,"cntxtAlts")&&(a.contextualAlternates=!0):Qm(I)&&(a.contextualAlternates=!0);const T=Xm(t,Bm,"u"),C=Jm(T,"val");if(T&&"none"!==C){a.underline=!0,C&&"single"!==C&&(a.underlineStyle=C);const t=Jm(T,"color");t&&"auto"!==t&&(a.underlineColor=dv(t))}const k=Jm(Xm(t,Bm,"vertAlign"),"val");"superscript"===k&&(a.superscript=!0),"subscript"===k&&(a.subscript=!0);const V=Xm(t,Bm,"rFonts"),E=Jm(V,"ascii")??Jm(V,"hAnsi")??Jm(V,"cs")??Jm(V,"eastAsia")??function(t,e){const a=Jm(t,"asciiTheme")??Jm(t,"hAnsiTheme")??Jm(t,"eastAsiaTheme")??Jm(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=Jm(Xm(t,Bm,"sz")??Xm(t,Bm,"szCs"),"val");if(R){const t=function(t){const e=t?Number(t):Number.NaN;return Number.isFinite(e)?Math.round(e/2/72*bn*1e4)/1e4:null}(R);null!==t&&(a.fontSize=t)}const L=Xm(t,Bm,"color"),z=Jm(L,"val");if(z&&"auto"!==z)a.color=dv(z);else if("auto"!==z){const t=function(t,e){const a=Jm(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=uv(Jm(t,"themeShade"));void 0!==s&&(o*=s,i*=s,l*=s);const d=uv(Jm(t,"themeTint"));if(void 0!==d){const t=255*(1-d);o=o*d+t,i=i*d+t,l=l*d+t}return fv(o,i,l)}(L,e.colors);t&&(a.color=t)}const N=Jm(Xm(t,Bm,"highlight"),"val");N&&"none"!==N&&(a.highlight=N);const q=Av(Xm(t,Bm,"shd"));q&&(a.shading=q);const O=Xm(t,Bm,"lang");if(O){const t=Jm(O,"val"),e=Jm(O,"eastAsia"),n=Jm(O,"bidi"),r={};t&&(r.value=t),e&&(r.eastAsia=e),n&&(r.bidi=n),Object.keys(r).length>0&&(a.language=r)}return wv(a)}function Cv(t){if(!t)return;const e=Jm(t,"val");if("nil"===e||"none"===e)return{width:0,type:"none",color:"transparent"};const a=Number(Jm(t,"sz")),n=Number.isFinite(a)&&a>0?Math.round(a/8*1e4)/1e4:.75,r=dv(Jm(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 kv(t){return t?{borderTop:Cv(Xm(t,Bm,"top")),borderRight:Cv(Xm(t,Bm,"right")),borderBottom:Cv(Xm(t,Bm,"bottom")),borderLeft:Cv(Xm(t,Bm,"left")),borderStart:Cv(Xm(t,Bm,"start")),borderEnd:Cv(Xm(t,Bm,"end")),borderTopLeftToBottomRight:Cv(Xm(t,Bm,"tl2br")),borderTopRightToBottomLeft:Cv(Xm(t,Bm,"tr2bl"))}:{}}function Vv(t){return void 0!==(null==t?void 0:t.lineHeight)?t:{...t??{},lineHeight:1.1}}function Ev(t){const e=Xm(t,Bm,"spacing");return{before:Qm(Jm(e,"beforeAutospacing")),after:Qm(Jm(e,"afterAutospacing"))}}function Rv(t){if(!t)return;const e={},a=$m(t,"pStyle");a&&(e.styleId=a);const n=Jm(Xm(t,Bm,"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=Xm(t,Bm,"spacing"),o=Jm(r,"before"),i=Jm(r,"after"),l=Jm(r,"line"),s=Jm(r,"lineRule");o&&(e.spacingBefore=lv(o,0)),i&&(e.spacingAfter=lv(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=_m(t,"contextualSpacing");void 0!==d&&(e.contextualSpacing=d);const c=_m(t,"snapToGrid");void 0!==c&&(e.snapToGrid=c);const h=Xm(t,Bm,"ind"),p=Jm(h,"start")??Jm(h,"left"),u=Jm(h,"end")??Jm(h,"right"),f=Jm(h,"firstLine"),g=Jm(h,"hanging");p&&(e.indentLeft=lv(p,0)),u&&(e.indentRight=lv(u,0)),g?(e.indentHanging=lv(g,0),e.indentFirstLine=void 0):f&&(e.indentFirstLine=lv(f,0));const m=function(t){const e=Xm(t,Bm,"tabs");if(!e)return[];const a=[];for(const n of Km(e,Bm,"tab")){const t=sv(Jm(n,"pos"));if(void 0===t)continue;const e=Jm(n,"val"),r="center"===e||"right"===e||"decimal"===e||"bar"===e||"clear"===e?e:"left",o=Jm(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=_m(t,"pageBreakBefore");void 0!==v&&(e.pageBreakBefore=v);const b=_m(t,"keepNext");void 0!==b&&(e.keepWithNext=b);const y=_m(t,"keepLines");void 0!==y&&(e.keepLinesTogether=y);const M=_m(t,"widowControl");void 0!==M&&(e.widowControl=M);const x=Xm(t,Bm,"pBdr");if(x){const{borderTop:t,borderRight:a,borderBottom:n,borderLeft:r}=kv(x);t&&(e.borderTop=t),a&&(e.borderRight=a),n&&(e.borderBottom=n),r&&(e.borderLeft=r)}const w=Av(Xm(t,Bm,"shd"));w&&(e.shading=w);const S=jm(Jm(Xm(t,Bm,"textDirection"),"val"));S&&(e.textDirection=S);const A=Jm(Xm(t,Bm,"outlineLvl"),"val");if(void 0!==A){const t=Number(A);Number.isFinite(t)&&t>=0&&t<=8&&(e.outlineLevel=t)}return wv(e)}function Lv(t){if(!t)return;const e={},a=Xm(t,Bm,"trHeight");if(a){const t=sv(Jm(a,"val"));void 0!==t&&(e.height=t);const n=Jm(a,"hRule");"auto"!==n&&"exact"!==n&&"atLeast"!==n||(e.heightRule=n)}const n=_m(t,"cantSplit");void 0!==n&&(e.cantSplit=n);const r=_m(t,"hidden");return void 0!==r&&(e.hidden=r),Object.keys(e).length>0?e:void 0}function zv(t){return"1"===t||"true"===t||"on"===t}function Nv(t){const e=Xm(t,Bm,"cols");if(!e)return;const a=Number.parseInt(Jm(e,"num")??"1",10);if(!Number.isFinite(a)||a<=1)return;const n=lv(Jm(e,"space"),0),r=Jm(e,"sep"),o=Jm(e,"equalWidth"),i=Km(e,Bm,"col").map(t=>({width:lv(Jm(t,"w"),0),space:lv(Jm(t,"space"),n)})),l=null==o||zv(o);return{count:a,space:n,...zv(r)?{separator:!0}:{},...l?{}:{equalWidth:!1},...!l&&i.length>0?{columns:i}:{}}}function qv(t){const e=Xm(t,Bm,"pgSz"),a=Xm(t,Bm,"pgMar"),n=Nv(t);let r;if(e||a||n){const t=lv(Jm(e,"w"),816),o=lv(Jm(e,"h"),1056),i=Jm(e,"orient");r={width:t,height:o,orientation:"landscape"===i?"landscape":"portrait"===i?"portrait":t>o?"landscape":"portrait",margins:{top:lv(Jm(a,"top"),96),right:lv(Jm(a,"right"),96),bottom:lv(Jm(a,"bottom"),96),left:lv(Jm(a,"left"),96),header:lv(Jm(a,"header"),48),footer:lv(Jm(a,"footer"),48),gutter:lv(Jm(a,"gutter"),0)},...n?{columns:n}:{}}}const o=e=>{const a={};for(const n of Km(t,Bm,e)){const t=Jm(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=Xm(t,Bm,"docGrid"),d=Jm(s,"type"),c=lv(Jm(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 Ov(t){if(!t)return;const e=Xm(t,Bm,"sectPr");if(!e)return;const a=Xm(e,Bm,"pgSz"),n=Xm(e,Bm,"pgMar"),r=Nv(e);if(!a&&!n&&!r)return;const o=lv(Jm(a,"w"),816),i=lv(Jm(a,"h"),1056),l=Jm(a,"orient");return{width:o,height:i,orientation:"landscape"===l?"landscape":"portrait"===l?"portrait":o>i?"landscape":"portrait",margins:{top:lv(Jm(n,"top"),96),right:lv(Jm(n,"right"),96),bottom:lv(Jm(n,"bottom"),96),left:lv(Jm(n,"left"),96),header:lv(Jm(n,"header"),48),footer:lv(Jm(n,"footer"),48),gutter:lv(Jm(n,"gutter"),0)},...r?{columns:r}:{}}}function Pv(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)Pv(o.blocks,e,a,n,r)}}function Wv(t){const e=Hv(t);return void 0===e?void 0:Math.round(e/wn)}function Hv(t){if(null==t||""===t)return;const e=parseInt(t,10);return Number.isFinite(e)?e:void 0}function Uv(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*yn);case"in":return Math.round(n*bn);case"cm":return Math.round(n/2.54*bn);case"mm":return Math.round(n/25.4*bn);case"pc":return Math.round(12*n*yn);default:return Math.round(n)}}function Fv(t){const e=null==t?void 0:t.trim();if(e&&/^[0-9a-fA-F]{6}$/.test(e))return`#${e.toUpperCase()}`}const Bv={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"},Gv={"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 Zv(t){return Gv[t.toLowerCase()]??null}async function Kv(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?Bv[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`${pe}${n}`;const r=`img-${t.nextId}`;return t.nextId+=1,t.assets[r]={id:r,url:a},t.byPath.set(e,r),`${pe}${r}`}(e,n,`data:${o};base64,${i}`)}function Dv(t){return"1"===t||"true"===t||"0"!==t&&"false"!==t&&void 0}function jv(t,e){var a,n,r,o;const i=Ym(t,e);if(!i)return;const l=null==(n=null==(a=Ym(i,"align"))?void 0:a.textContent)?void 0:n.trim(),s=Xv(null==(o=null==(r=Ym(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 Xv(t){if(null==t||""===t)return;const e=parseInt(t,10);return Number.isFinite(e)?e:void 0}function Jv(t){const e=jv(t,"positionH"),a=jv(t,"positionV"),n=function(t){return Ym(t,"wrapSquare")?"square":Ym(t,"wrapTight")?"tight":Ym(t,"wrapThrough")?"through":Ym(t,"wrapTopAndBottom")?"topAndBottom":Ym(t,"wrapNone")?"none":void 0}(t),r=Xv(t.getAttribute("distT")),o=Xv(t.getAttribute("distB")),i=Xv(t.getAttribute("distL")),l=Xv(t.getAttribute("distR")),s=Dv(t.getAttribute("simplePos")),d=Xv(t.getAttribute("relativeHeight")),c=Dv(t.getAttribute("behindDoc")),h=Dv(t.getAttribute("locked")),p=Dv(t.getAttribute("layoutInCell")),u=Dv(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 Yv(t,e,a,n){const r=Ym(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=Ym(s,"extent"),c=Ym(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)/wn)),e&&(p=Math.round(parseInt(e,10)/wn))}const u=c?Jm(c,"descr")??Jm(c,"title"):null,f=function(t){const e=Ym(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(Ym(t,"tile"))return"tile"}(t),m=function(t){const e=Ym(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)?Jv(l.element):void 0,b="anchor"===(null==l?void 0:l.kind)?function(t){const e=Ym(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=Xv(r.getAttribute("x")),i=Xv(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 Kv(e,n,w);if(t)return{text:"",image:{src:t,...y}}}return{text:"",image:void 0}}function Qv(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 _v(t,e,a,n){const r=Ym(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=Ym(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=Uv(r);null!==t&&(e.width=t)}else if("height"===n){const t=Uv(r);null!==t&&(e.height=t)}}return e}(null==l?void 0:l.getAttribute("style")),d=function(t){const e={left:Qv(Jm(t,"cropleft")),top:Qv(Jm(t,"croptop")),right:Qv(Jm(t,"cropright")),bottom:Qv(Jm(t,"cropbottom"))};if(void 0!==e.left||void 0!==e.top||void 0!==e.right||void 0!==e.bottom)return e}(r),c=Jm(r,"title")??r.getAttribute("o:title"),h=await Kv(e,n,i);return h?{src:h,width:s.width??300,height:s.height??300,...c?{alt:c}:{},...d?{crop:d}:{}}:void 0}function $v(t){return"1"===t||"true"===t||"0"!==t&&"false"!==t&&void 0}function tb(t,e){var a,n,r,o;const i=Ym(t,e);if(!i)return;const l=null==(n=null==(a=Ym(i,"align"))?void 0:a.textContent)?void 0:n.trim(),s=Hv(null==(o=null==(r=Ym(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 eb(t){const e=tb(t,"positionH"),a=tb(t,"positionV"),n=function(t){return Ym(t,"wrapSquare")?"square":Ym(t,"wrapTight")?"tight":Ym(t,"wrapThrough")?"through":Ym(t,"wrapTopAndBottom")?"topAndBottom":Ym(t,"wrapNone")?"none":void 0}(t),r=Hv(t.getAttribute("distT")),o=Hv(t.getAttribute("distB")),i=Hv(t.getAttribute("distL")),l=Hv(t.getAttribute("distR")),s=$v(t.getAttribute("simplePos")),d=Hv(t.getAttribute("relativeHeight")),c=$v(t.getAttribute("behindDoc")),h=$v(t.getAttribute("locked")),p=$v(t.getAttribute("layoutInCell")),u=$v(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 ab(t,e){const a=Ym(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=Ym(r,"extent"),i=Wv(null==o?void 0:o.getAttribute("cx"))??300,l=Wv(null==o?void 0:o.getAttribute("cy"))??300,s=Ym(r,"docPr"),d=s?Jm(s,"name"):null,c=s?Jm(s,"descr")??Jm(s,"title"):null,h="anchor"===(null==n?void 0:n.kind)?eb(n.element):void 0,p=Ym(a,"txbxContent"),u=p&&e?await e(p):[],f=function(t){var e,a;const n=Ym(t,"spPr");if(!n)return;const r={},o=Ym(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=Fv(null==(e=Ym(o,"srgbClr"))?void 0:e.getAttribute("val"));t&&(r.fill=t)}else if("ln"===o.localName){const t=Hv(o.getAttribute("w"));void 0!==t&&(r.borderWidthPt=Math.round(t/12700*100)/100);const e=Fv(null==(a=Ym(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=Ym(t,"bodyPr");if(!e)return;const a={},n=Wv(e.getAttribute("lIns")),r=Wv(e.getAttribute("tIns")),o=Wv(e.getAttribute("rIns")),i=Wv(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),Ym(e,"spAutoFit")&&(a.autoFit=!0),Object.keys(a).length>0?a:void 0}(a),m=function(t){const e=Ym(t,"spPr");if(!e)return;const a=Ym(e,"xfrm"),n=Hv(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 nb(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=Ym(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 rb(t){const e=Jm(t,"id");if(!e)return;if("bookmarkEnd"===t.localName)return{kind:"end",docxId:e};const a=Jm(t,"name")??void 0,n=Jm(t,"colFirst"),r=Jm(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 ob(t){const e=Jm(t,"id");if(e)return{kind:"commentRangeEnd"===t.localName?"end":"start",docxId:e}}async function ib(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===Bm)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"===Jm(o,"type")?"\f":"\n");else{if("lastRenderedPageBreak"===o.localName)continue;if("bookmarkStart"===o.localName||"bookmarkEnd"===o.localName){const t=rb(o);t&&c.push({offset:d,marker:t});continue}if("commentRangeStart"===o.localName||"commentRangeEnd"===o.localName){const t=ob(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 Yv(o,e,a,n);if(t.image)p(t.text),i=t.image;else{const t=await ab(o,r);t&&(p(""),l=t)}}else if("pict"===o.localName){const t=await _v(o,e,a,n);t&&(p(""),i=t)}else if("sym"===o.localName){const t=Jm(o,"font")??"",e=Jm(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=nb(o);if(t){const e=await ab(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 lb(t,e,a,n,r,o,i,l){var s,d,c;const h=[],p=[],u=(t,e)=>{const a=Jm(t,"fldCharType"),n=Jm(t,"fldLock"),r=Jm(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===Bm){if("bookmarkStart"===m.localName||"bookmarkEnd"===m.localName){const t=rb(m);if(!t)continue;h.push({text:"",bookmark:t});continue}if("commentRangeStart"===m.localName||"commentRangeEnd"===m.localName){const t=ob(m);if(!t)continue;h.push({text:"",comment:t});continue}if("r"===m.localName){const t=Tv(Xm(m,Bm,"rPr"),o);if(Km(m,Bm,"fldChar").length>0||Km(m,Bm,"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===Bm&&("fldChar"===n.localName?u(n,t):"instrText"===n.localName&&f(n,t))}continue}const e=Xm(m,Bm,"footnoteReference");if(e){const a=Jm(e,"id");if(!a)continue;const n=Jm(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=Xm(m,Bm,"endnoteReference");if(c){const e=Jm(c,"id");if(!e)continue;const a=Jm(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 ib(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(Bm,"instr")??m.getAttribute("instr")??"",s=/\bNUMPAGES\b/i.test(t)?"NUMPAGES":/\bPAGE\b/i.test(t)?"PAGE":null,d=await lb(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=Jm(m,"anchor");e&&(t=`#${e}`)}h.push(...await lb(m,e,a,n,r,o,t,l))}}}return h}function sb(t,e,a,n){var r;const o=wa(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=Iv(i.styles,null==(r=o.style)?void 0:r.styleId);return o.list=a?{...a}:void 0,o}function db(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 cb(t,e,a,n,r,o,i,l){const s=Xm(t,Bm,"pPr"),d=await lb(t,e,a,n,r,o,void 0,i),c=Vv(Rv(s)),h=Tv(Xm(s,Bm,"rPr"),o),p=function(t,e){if(!t)return;const a=Xm(t,Bm,"numPr");if(!a)return;const n=Jm(Xm(a,Bm,"numId"),"val");if(!n)return;const r=Jm(Xm(a,Bm,"ilvl"),"val")??"0",o=Number.parseInt(r,10),i=Number.isFinite(o)?o:0,l=Mv(e,n,i),s=[];for(let p=0;p<=i;p+=1)s[p]=Mv(e,n,p).format??"decimal";const d=`${n}:${i}`,c=!e.seenInstances.has(d);e.seenInstances.add(d);const h=c?e.numStartOverrides.get(d)??l.startAt:void 0;return{list:{kind:l.kind??"ordered",level:i,instanceId:n,suffix:l.suffix??"tab",...l.format?{format:l.format}:{},...s.length?{levelFormats:s}:{},...l.levelText?{levelText:l.levelText}:{},...l.alignment?{alignment:l.alignment}:{},...void 0!==l.legal?{legal:l.legal}:{},...void 0!==h&&1!==h?{startAt:h}:{},...l.bulletGlyph?{bulletGlyph:l.bulletGlyph}:{},...l.bulletFont?{bulletFont:l.bulletFont}:{}},indent:l.indent}}(s,e),u=null==p?void 0:p.list;let f=c;if(null==p?void 0:p.indent){const{left:t,hanging:e}=p.indent,a=c??{};f={...a,...void 0===a.indentLeft&&void 0!==t?{indentLeft:t}:{},...void 0===a.indentHanging&&void 0!==e?{indentHanging:e}:{}}}const g=function(t){if(!t)return;const e=Pe(t,Ca),a=Pe(void 0,Ca);return xv({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})}(l?{...l,...f??{}}:f),m=function(t,e){var a;const n=Xm(t,Bm,"framePr");if(!n)return null;const r=Jm(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(Jm(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}}(s,d);if(m)return{paragraphs:[],pageBreakAfter:!1,dropCapFrame:m};const{segments:v,hasPageBreak:b}=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}}(d);if(!b)return{paragraphs:[sb(d,g,u,h)],pageBreakAfter:!1};const y=[];let M=!1;for(let x=0;x<v.length;x+=1){const t=v[x];if(x>0&&(M=!0),!db(t))continue;const e=M?{...g??{},pageBreakBefore:!0}:g;y.push(sb(t,e,u,h)),M=!1}return{paragraphs:y,pageBreakAfter:M}}async function hb(t,e,a,n,r,o,i,l){return(await cb(t,e,a,n,r,o,i,l)).paragraphs[0]??wa([{text:""}])}function pb(t){if(!t)return;const e=Jm(t,"type"),a=Jm(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 sv(a)}function ub(t,e){const a=Jm(Xm(t,Bm,e),"val"),n=a?Number(a):Number.NaN;return Number.isFinite(n)&&n>0?Math.floor(n):void 0}function fb(t,e){if(!t)return;const a=new Set(e),n=new Um,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===Bm&&a.has(t.localName??"")&&r.push(n.serializeToString(t))}return r.length>0?r:void 0}function gb(t){if(!t)return;const e=e=>sv(Jm(Xm(t,Bm,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 mb(t,e){const a={};e&&(a.styleId=e);const n=Jm(Xm(t,Bm,"tblCaption"),"val");n&&(a.altTitle=n);const r=Jm(Xm(t,Bm,"tblDescription"),"val");r&&(a.altDescription=r);const o=pb(Xm(t,Bm,"tblW"));void 0!==o&&(a.width=o);const i=pb(Xm(t,Bm,"tblInd"));void 0!==i&&(a.indentLeft=i);const l=Jm(Xm(t,Bm,"jc"),"val");"left"!==l&&"center"!==l&&"right"!==l||(a.align=l);const s=function(t){const e=Jm(Xm(t,Bm,"tblLayout"),"type");return"fixed"===e||"autofit"===e?e:void 0}(t);s&&(a.layout=s);const d=pb(Xm(t,Bm,"tblCellSpacing"));void 0!==d&&(a.cellSpacing=d);const c=gb(Xm(t,Bm,"tblCellMar"));c&&(a.defaultCellMargins=c);const h=t?_m(t,"bidiVisual"):void 0;void 0!==h&&(a.bidiVisual=h);const p=Jm(Xm(t,Bm,"tblOverlap"),"val");p&&(a.tblOverlap=p);const u=function(t){const e=Xm(t,Bm,"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)!==Bm&&"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=fb(t,["tblPrChange"]);return f&&(a.revisionXml=f),wv(a)}function vb(t){if(!t)return;const e={},a=ub(t,"gridBefore");void 0!==a&&(e.gridBefore=a);const n=ub(t,"gridAfter");void 0!==n&&(e.gridAfter=n);const r=pb(Xm(t,Bm,"wBefore"));void 0!==r&&(e.widthBefore=r);const o=pb(Xm(t,Bm,"wAfter"));void 0!==o&&(e.widthAfter=o);const i=Xm(t,Bm,"trHeight"),l=sv(Jm(i,"val"));void 0!==l&&(e.height=l);const s=Jm(i,"hRule");"auto"!==s&&"exact"!==s&&"atLeast"!==s||(e.heightRule=s);const d=pb(Xm(t,Bm,"tblCellSpacing"));void 0!==d&&(e.cellSpacing=d);const c=_m(t,"cantSplit");void 0!==c&&(e.cantSplit=c);const h=_m(t,"hidden");void 0!==h&&(e.hidden=h);const p=fb(t,["trPrChange","ins","del"]);return p&&(e.revisionXml=p),wv(e)}function bb(t){if(!t)return 1;const e=Jm(Xm(t,Bm,"gridSpan"),"val"),a=e?Number(e):1;return Number.isFinite(a)&&a>1?Math.floor(a):1}function yb(t){if(!t)return;const e=Xm(t,Bm,"vMerge");if(!e)return;return"restart"===Jm(e,"val")?"restart":"continue"}function Mb(t,e){if(!t){if(!e)return;return wv({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=Av(Xm(t,Bm,"shd"));n&&(a.shading=n);const r=Xm(t,Bm,"tcW"),o=Jm(r,"type"),i=Jm(r,"w");if("dxa"===o){const t=sv(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=gb(Xm(t,Bm,"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=Jm(Xm(t,Bm,"vAlign"),"val");return"top"===e||"bottom"===e?e:"center"===e?"middle":void 0}(t);s&&(a.verticalAlign=s);const d=jm(Jm(Xm(t,Bm,"textDirection"),"val"));d&&(a.textDirection=d);const c=_m(t,"noWrap");void 0!==c&&(a.noWrap=c);const h=_m(t,"tcFitText");void 0!==h&&(a.fitText=h);const p=_m(t,"hideMark");void 0!==p&&(a.hideMark=p);const u=Jm(Xm(t,Bm,"headers"),"val");u&&(a.headers=u);const f=fb(t,["tcPrChange","cellIns","cellDel","cellMerge"]);f&&(a.revisionXml=f);for(const[g,m]of Object.entries(function(t){return t?kv(Xm(t,Bm,"tcBorders")):{}}(t)))m&&(a[g]=m);return wv(a)}function xb(t){const e=Xm(t,Bm,"trPr");return!!e&&!0===_m(e,"tblHeader")}function wb(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 Sb(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 Ab(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 Ib(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}}function Tb(t,e,a){if(!t)return;const n=qe(e??ze(a),a),r=new Set(Object.keys(n)),o={};for(const[i,l]of Object.entries(t))r.has(i)||(o[i]=l);return wv(o)}async function Cb(t,e,a,n,r,o,i,l){var s,d;const c=[],h=Xm(t,Bm,"tblGrid");if(h)for(const E of Km(h,Bm,"gridCol")){const t=sv(Jm(E,"w"));void 0!==t&&c.push(t)}const p=Xm(h,Bm,"tblGridChange"),u=Xm(t,Bm,"tblPr"),f=Jm(Xm(u,Bm,"tblStyle"),"val"),g=f&&(null==(s=null==l?void 0:l[f])?void 0:s.paragraphStyle)?l[f].paragraphStyle:void 0,m=(v=Xm(u,Bm,"tblBorders"))?{...kv(v),borderInsideH:Cv(Xm(v,Bm,"insideH")),borderInsideV:Cv(Xm(v,Bm,"insideV"))}:{};var v;const b=f?null==(d=null==l?void 0:l[f])?void 0:d.tableStyle:void 0,y=mb(u,f??void 0),M=null==y?void 0:y.defaultCellMargins,x=(null==b?void 0:b.conditionalFormats)??void 0,w=function(t){const e=Xm(t,Bm,"tblLook"),a=t=>{const a=Jm(e,t);return null===a||""===a?void 0:Qm(a)},n=Jm(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}}(u),S=(null==b?void 0:b.rowBandSize)??1,A=(null==b?void 0:b.colBandSize)??1,I=Km(t,Bm,"tr"),T=I.length,C=c.length>0?c.length:I.reduce((t,e)=>Math.max(t,Km(e,Bm,"tc").length),0),k=[];for(let E=0;E<I.length;E+=1){const t=I[E],s=Xm(t,Bm,"trPr"),d=Xm(s,Bm,"cnfStyle"),c=[];"1"===Jm(d,"firstRow")&&c.push("firstRow"),"1"===Jm(d,"lastRow")&&c.push("lastRow");const h=Km(t,Bm,"tc"),p=[];for(let v=0;v<h.length;v+=1){const t=h[v],s=[],d=[],u=Xm(t,Bm,"tcPr");for(const c of Km(t,Bm,"p")){const t=Tb(g,Jm(Xm(Xm(c,Bm,"pPr"),Bm,"pStyle"),"val")??void 0,l);s.push(await hb(c,e,a,n,r,o,i,t)),d.push(Ev(Xm(c,Bm,"pPr")))}wb(s,d);const f=bb(u),m=yb(u),b=Mb(u,M),y=Ab([...Sb(E,v,T,C,w,S,A),...c],x);if(Ib(s,y.textStyle),y.paragraphStyle){const t=y.paragraphStyle;for(const e of s)e.style={...t,...e.style}}const I=Sa(s.length>0?s:[wa([{text:""}])],f,"restart"===m?{rowSpan:1,vMerge:m}:m?{vMerge:m}:void 0),k={...b??{}},V=(null==b?void 0:b.shading)??y.shading;if(V&&(k.shading=V),y.borders)for(const e of["borderTop","borderRight","borderBottom","borderLeft"]){const t=y.borders[e];void 0===k[e]&&t&&(k[e]=t)}Object.keys(k).length>0&&(I.style=k),"continue"===m&&(I.blocks=[]),p.push(I)}const u=Aa(p,xb(t)?{isHeader:!0}:void 0),f=vb(s);if(f&&(u.style=f),x){const t=Sb(E,0,T,Math.max(1,C),w,S,A).filter(t=>"firstRow"===t||"lastRow"===t||"band1Horz"===t||"band2Horz"===t),e=Ab([...c,...t],x);e.rowStyle&&(u.style={...e.rowStyle,...u.style})}const m=Xm(t,Bm,"tblPrEx");m&&(u.tblPrExXml=(new Um).serializeToString(m)),k.push(u)}!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)}}}(k,m);for(let E=0;E<k.length;E+=1){const t=k[E];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=E+1;t<k.length;t+=1){const a=k[t].cells[e];if(!a||"continue"!==a.vMerge)break;n+=1}n>1&&(a.rowSpan=n)}}const V=Ia(k,c.length>0?c:void 0);return y&&(V.style=y),V.style?V.style.tblLook=w:f&&(V.style={tblLook:w}),p&&(V.tblGridChangeXml=(new Um).serializeToString(p)),V}function kb(t,e,a,n,r){return o=>async function(t,e,a,n,r,o){const i=kb(e,a,n,r,o),l=[];for(let s=0;s<t.childNodes.length;s+=1){const d=t.childNodes[s];if((null==d?void 0:d.nodeType)!==d.ELEMENT_NODE)continue;const c=d;if(c.namespaceURI===Bm)if("p"===c.localName){const t=await cb(c,e,a,n,r,o,i);for(const e of t.paragraphs)l.push(e)}else"tbl"===c.localName&&l.push(await Cb(c,e,a,n,r,o,i))}return l}(o,t,e,a,n,r)}async function Vb(t,e,a,n,r,o,i){if(!t)return[];const l=(new Fm).parseFromString(t,"application/xml").documentElement;if(!l)return[];const s=kb(e,a,n,r,o),d=[];for(let c=0;c<l.childNodes.length;c+=1){const t=l.childNodes[c];if((null==t?void 0:t.nodeType)!==t.ELEMENT_NODE)continue;const h=t;"p"===h.localName&&h.namespaceURI===Bm?d.push(await hb(h,e,a,n,r,o,s)):"tbl"===h.localName&&h.namespaceURI===Bm&&d.push(await Cb(h,e,a,n,r,o,s,i))}return d}const Eb=new Set(["separator","continuationSeparator","continuationNotice"]);async function Rb(t,e,a,n,r,o,i,l){const s={byDocxId:new Map,notes:{items:{}}};if(!e)return s;const d=(new Fm).parseFromString(e,"application/xml").documentElement;if(!d)return s;const c={},h=new Map;let p,u;const f=Km(d,Bm,t);let g=0;const m=kb(a,n,r,o,i);for(const v of f){const e=Jm(v,"id")??"",s=Jm(v,"type")??"",d=[];for(let t=0;t<v.childNodes.length;t+=1){const e=v.childNodes[t];if((null==e?void 0:e.nodeType)!==e.ELEMENT_NODE)continue;const s=e;s.namespaceURI===Bm&&("p"===s.localName?d.push(await hb(s,a,n,r,o,i,m)):"tbl"===s.localName&&d.push(await Cb(s,a,n,r,o,i,m,l)))}if(Eb.has(s)){"separator"===s?p=d:"continuationSeparator"===s&&(u=d);continue}if(("-1"===e||"0"===e)&&0===d.length)continue;g+=1;const f=`${t}:imported:${g}`,b=Number.parseInt(e,10),y={id:f,blocks:d.length>0?d:[],docxId:Number.isFinite(b)?b:void 0};c[f]=y,e&&h.set(e,y)}return{byDocxId:h,notes:{items:c,separator:p,continuationSeparator:u},separator:p,continuationSeparator:u}}const Lb=new Set(["_GoBack"]);function zb(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:[ya("")]))}for(const n of t.rows)for(const t of n.cells)for(const n of t.blocks)zb(n,e,a)}function Nb(t){var e;const a=[],n={value:0},r=t=>{null==t||t.forEach(t=>zb(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||Lb.has(n))continue;const r=Number.parseInt(t.docxId,10),o=null==(e=i.get(t.docxId))?void 0:e.shift(),d=va(),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 qb(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:[ya("")]))}for(const n of t.rows)for(const t of n.cells)for(const n of t.blocks)qb(n,e,a)}function Ob(t){const e=[],a={value:0},n=t=>{null==t||t.forEach(t=>qb(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 Pb="http://schemas.microsoft.com/office/word/2012/wordml";function Wb(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===Bm){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+=Wb(r)}return e}function Hb(t){if(!t)return;const e=Date.parse(t);return Number.isNaN(e)?void 0:e}function Ub(t,e){const a=new Map;if(!t)return a;const n=(new Fm).parseFromString(t,"application/xml").documentElement;if(!n)return a;const r=function(t){const e=new Map;if(!t)return e;const a=(new Fm).parseFromString(t,"application/xml").documentElement;if(!a)return e;for(const n of Km(a,Pb,"commentEx")){const t=n.getAttributeNS(Pb,"paraId");if(!t)continue;const a=n.getAttributeNS(Pb,"done");e.set(t,"1"===a||"true"===a)}return e}(e);for(const o of Km(n,Bm,"comment")){const t=Jm(o,"id");if(null===t)continue;const e=Jm(o,"author")??"",n=Jm(o,"initials")??void 0,i=Hb(Jm(o,"date")),l=Km(o,Bm,"p"),s=l.map(t=>Wb(t)).join("\n").trim(),d=l.length>0?Jm(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 Fb(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 Up.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=ev(await(null==(r=g.file("word/_rels/document.xml.rels"))?void 0:r.async("string"))),b=function(t){const e={abstractLevels:new Map,numOverrideLevels:new Map,numStartOverrides:new Map,numToAbstractId:new Map,seenInstances:new Set};if(!t)return e;const a=(new Fm).parseFromString(t,"application/xml").documentElement;if(!a)return e;for(const n of Array.from(a.getElementsByTagNameNS(Bm,"abstractNum"))){const t=Jm(n,"abstractNumId");if(t)for(const a of Km(n,Bm,"lvl")){const n=Jm(a,"ilvl")??"0";e.abstractLevels.set(`${t}:${n}`,yv(a))}}for(const n of Array.from(a.getElementsByTagNameNS(Bm,"num"))){const t=Jm(n,"numId"),a=Jm(Xm(n,Bm,"abstractNumId"),"val");if(t&&a){e.numToAbstractId.set(t,a);for(const a of Km(n,Bm,"lvlOverride")){const n=Jm(a,"ilvl")??"0",r=Xm(a,Bm,"lvl");r&&e.numOverrideLevels.set(`${t}:${n}`,yv(r));const o=Jm(Xm(a,Bm,"startOverride"),"val");if(null!=o){const a=Number.parseInt(o,10);Number.isFinite(a)&&e.numStartOverrides.set(`${t}:${n}`,a)}}}}return e}(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 Fm).parseFromString(t,"application/xml"),n=sv(Jm(Xm(a.documentElement,Bm,"defaultTabStop"),"val"));void 0!==n&&(e.defaultTabStop=n),e.footnoteSettings=vv(Xm(a.documentElement,Bm,"footnotePr")),e.endnoteSettings=vv(Xm(a.documentElement,Bm,"endnotePr"));const r=Xm(a.documentElement,Bm,"compat");if(r){const t=Xm(r,Bm,"adjustLineHeightInTable");if(t){const a=Jm(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 Fm).parseFromString(t,"application/xml").documentElement,a=e?Km(e,Gm,"themeElements")[0]??null:null;return{fonts:iv(a),colors:pv(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 Fm).parseFromString(t,"application/xml").documentElement;if(!a)return;const n=Xm(a,Bm,"docDefaults"),r=Xm(Xm(n,Bm,"pPrDefault"),Bm,"pPr"),o=Xm(Xm(n,Bm,"rPrDefault"),Bm,"rPr"),i=r?{spacingBefore:0,spacingAfter:0,...Vv(Rv(r))}:Vv(Rv(r)),l=Tv(o,e),s={};let d;for(const c of Km(a,Bm,"style")){const t=Jm(c,"styleId"),a=Jm(c,"type");if(!t||"paragraph"!==a&&"character"!==a&&"table"!==a)continue;const n=Jm(Xm(c,Bm,"name"),"val")??t,r=Jm(Xm(c,Bm,"basedOn"),"val")??void 0,o=Jm(Xm(c,Bm,"next"),"val")??void 0,h=Vv(Rv(Xm(c,Bm,"pPr"))),p=Tv(Xm(c,Bm,"rPr"),e);let u;if("table"===a){const a=Xm(c,Bm,"tblPr"),n=sv(Jm(Xm(a,Bm,"tblInd"),"w")),r=t=>{const e=Jm(Xm(a,Bm,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 Km(c,Bm,"tblStylePr")){const a=Jm(t,"type");if(!a)continue;const n=Xm(t,Bm,"tcPr"),r=Av(Xm(n,Bm,"shd")),o=Tv(Xm(t,Bm,"rPr"),e),i=wv(kv(Xm(n,Bm,"tcBorders"))),s=Rv(Xm(t,Bm,"pPr")),d=Lv(Xm(t,Bm,"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&&Qm(Jm(c,"default"));f&&(d=t),s[t]={id:t,name:n,type:a,basedOn:r,nextStyle:o,paragraphStyle:"paragraph"===a&&f?Sv(i,h):h,textStyle:"paragraph"===a&&f?Sv(l,p):p,tableStyle:u}}return d&&s[d]?s:((i||l)&&(s.Normal={id:"Normal",name:"Normal",type:"paragraph",paragraphStyle:i,textStyle:l}),wv(s))}(M,x);null==(d=e.onProgress)||d.call(e,"parsing-document");const S=(new Fm).parseFromString(m,"application/xml").getElementsByTagNameNS(Bm,"body")[0];if(!S)return ka([wa([{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 tt=0;tt<S.childNodes.length;tt+=1){const t=S.childNodes[tt];if((null==t?void 0:t.nodeType)===t.ELEMENT_NODE){const e=t;e.namespaceURI===Bm&&"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))},z=kb(b,g,v,A,x);for(let tt=0;tt<S.childNodes.length;tt+=1){const t=S.childNodes[tt];if((null==t?void 0:t.nodeType)!==t.ELEMENT_NODE)continue;const e=t;if(e.namespaceURI===Bm){if("sectPr"===e.localName)I.push(qv(e)),T.push([]),C=!1;else if("p"===e.localName){const t=await cb(e,b,g,v,A,x,z);for(const e of t.paragraphs)V(e);t.dropCapFrame&&(k=t.dropCapFrame),t.pageBreakAfter&&(C=!0),L()}else"tbl"===e.localName&&(V(await Cb(e,b,g,v,A,x,z,w)),L());await tv(50,R)}}if(0===I.length){const t=Xm(S,Bm,"sectPr");I.push(t?qv(t):{pageSettings:Ov(S),headerRIds:{},footerRIds:{}})}null==(c=e.onProgress)||c.call(e,"parsing-headers-footers");const N=[],q=t=>Object.keys(t.headerRIds).length>0||Object.keys(t.footerRIds).length>0,O=I.filter(q).length;let P=0;const W=()=>{var t;P+=1,O>0&&(null==(t=e.onProgress)||t.call(e,"parsing-headers-footers",P/O))};for(let tt=0;tt<I.length;tt+=1){const t=I[tt],e=T[tt]??[];Pv(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 av(g,r),l=await Vb(o??null,b,g,i,A,x,w);return Pv(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);q(t)&&W(),await tv(2,P);const d=ve(t.pageSettings??{width:816,height:1056,orientation:"portrait",margins:{top:96,right:96,bottom:96,left:96,header:48,footer:48,gutter:0}});N.push({id:`section:${tt+1}`,blocks:e.length>0?e:[wa([{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 H=await(null==(h=g.file("word/footnotes.xml"))?void 0:h.async("string"))??null,U=H?await av(g,"word/footnotes.xml"):new Map,F=await async function(t,e,a,n,r,o,i){const l=await Rb("footnote",t,e,a,n,r,o,i);return{byDocxId:l.byDocxId,footnotes:l.notes,separator:l.separator,continuationSeparator:l.continuationSeparator}}(H,b,g,U,A,x,w);y.footnoteSettings&&(F.footnotes.settings=y.footnoteSettings);const B=Object.keys(F.footnotes.items).length>0||F.footnotes.separator||F.footnotes.continuationSeparator||F.footnotes.settings?F.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)}(N,F.byDocxId);const G=await(null==(p=g.file("word/endnotes.xml"))?void 0:p.async("string"))??null,Z=G?await av(g,"word/endnotes.xml"):new Map,K=await async function(t,e,a,n,r,o,i){const l=await Rb("endnote",t,e,a,n,r,o,i);return{byDocxId:l.byDocxId,endnotes:l.notes,separator:l.separator,continuationSeparator:l.continuationSeparator}}(G,b,g,Z,A,x,w);y.endnoteSettings&&(K.endnotes.settings=y.endnoteSettings);const D=Object.keys(K.endnotes.items).length>0||K.endnotes.separator||K.endnotes.continuationSeparator||K.endnotes.settings?K.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)}(N,K.byDocxId);const j=Nb(N),X=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=ba(),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}(Ob(N),Ub(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)),J=N.length>1||N.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}),Y=Object.keys(A.assets).length>0,Q=t=>{void 0!==y.defaultTabStop&&(t.settings={...t.settings??{},defaultTabStop:y.defaultTabStop});let e=t;return B&&(e.footnotes=B,e=_l(e)),D&&(e.endnotes=D,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 ts(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,Yl(s,r))))}let d=!1;const c=He(t).map(t=>{const e=t=>{if(!t)return t;let e=!1;const a=t.map(t=>{if("paragraph"===t.type){const a=es(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=es(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)),j&&(e.bookmarks=j),X&&(e.comments=X),e};if(J){const t=ka([]);return t.sections=N,1===N.length&&(t.pageSettings=N[0].pageSettings),w&&(t.styles=w),Y&&(t.assets=A.assets),Q(t)}const _=N[0],$=ka((null==_?void 0:_.blocks.length)>0?_.blocks:[wa([{text:""}])],null==_?void 0:_.pageSettings);return Y&&($.assets=A.assets),w&&($.styles=w),Q($)}let Bb=1;function Gb(t,e={}){if("undefined"==typeof Worker||"undefined"==typeof URL)return Fb(t,e);const a=Bb;return Bb+=1,new Promise((r,o)=>{const i=new Worker(new URL(""+("undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__dirname+"/assets/importDocxWorker-DbI0FKvR.js").href:new URL("assets/importDocxWorker-DbI0FKvR.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 Zb={"opening-docx":"opening","parsing-document":"parsing","parsing-headers-footers":"finishing"};function Kb(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 Db(t,e){if(t.nodeType===Node.TEXT_NODE){const a=t.textContent??"";return a.length>0?[Ma(a,e)]:[]}if(t.nodeType!==Node.ELEMENT_NODE)return[];const a=t;if("BR"===a.tagName)return[Ma("\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[Ma("",e,n)];const r={...e??{},...Kb(a)??{}},o=[];for(const i of Array.from(a.childNodes))o.push(...Db(i,r));return o}function jb(t){return"P"===t||"DIV"===t||"LI"===t||/^H[1-6]$/.test(t)}function Xb(t){return"UL"===t?"bullet":"OL"===t?"ordered":null}function Jb(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 Yb={H1:"heading1",H2:"heading2",H3:"heading3",H4:"heading3",H5:"heading3",H6:"heading3"};function Qb(t){return t.map(t=>({text:t.text,styles:t.styles,image:t.image}))}function _b(t,e){const a=wa(Qb(Db(t,void 0))),n=Jb(t),r=Yb[t.tagName];return(n||r)&&(a.style={...r?{styleId:r}:{},...n??{}}),e&&(a.list=e),a}function $b(t,e,a){const n=[];for(const r of Array.from(t.children))if("LI"===r.tagName){n.push(_b(r,{kind:e,level:a}));for(const t of Array.from(r.children)){const e=Xb(t.tagName);e&&n.push(...$b(t,e,a+1))}}return n}function ty(t){const e=ny(t).filter(t=>"paragraph"===t.type),a=Number.parseInt(t.getAttribute("colspan")??"",10),n=Number.parseInt(t.getAttribute("rowspan")??"",10);return Sa(e.length>0?e:[xa("")],Number.isFinite(a)&&a>1?a:1,Number.isFinite(n)&&n>1?{rowSpan:n}:void 0)}function ey(t){const e=[];let a=!0;for(const n of Array.from(t.children))"TD"!==n.tagName&&"TH"!==n.tagName||(e.push(ty(n)),"TH"!==n.tagName&&(a=!1));return 0===e.length?null:Aa(e,a?{isHeader:!0}:void 0)}function ay(t){const e=[],a=Array.from(t.querySelectorAll("tr")).filter(e=>e.closest("table")===t);for(const n of a){const t=ey(n);t&&e.push(t)}return 0===e.length?null:Ia(e)}function ny(t){const e=[];for(const a of Array.from(t.childNodes)){if(a.nodeType===Node.TEXT_NODE){(a.textContent??"").trim().length>0&&e.push(ry(Db(a,void 0)));continue}if(a.nodeType!==Node.ELEMENT_NODE)continue;const t=a;if("TABLE"===t.tagName){const a=ay(t);a&&e.push(a);continue}const n=Xb(t.tagName);if(n){e.push(...$b(t,n,0));continue}if(jb(t.tagName)){e.push(_b(t));continue}if(t.children.length>0){e.push(...ny(t));continue}const r=Db(t,void 0);r.length>0&&e.push(ry(r))}return e}function ry(t){return wa(Qb(t))}const oy=[{id:"docx",accept:[".docx"],matches(t){return this.accept.includes(Pp(t.name))},import:(t,e)=>Gb(t,{onProgress:e?(t,a)=>e(Zb[t],a):void 0})},{id:"html",accept:[".html",".htm"],matches(t){return this.accept.includes(Pp(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?ny(a):[];0===n.length&&n.push(xa(""));const r=e.title.trim();return ka(n,void 0,void 0,void 0,r?{title:r}:void 0)}(a);return null==e||e("finishing"),n}}];const iy=["nw","n","ne","e","se","s","sw","w"],ly=24;function sy(t,e,a){const n=Math.max(e,t);return void 0===a?n:Math.min(a,n)}function dy(t,e){return"x"===e?t.includes("e")?1:t.includes("w")?-1:0:t.includes("s")?1:t.includes("n")?-1:0}var cy=ut("<button aria-hidden=true class=oasis-editor-rotate-handle tabindex=-1 type=button>"),hy=ut("<div aria-hidden=true style=transform-origin:center>"),py=ut("<button aria-hidden=true class=oasis-editor-resize-handle tabindex=-1 type=button>");function uy(t){return(e=hy()).$$mousedown=e=>{!t.readOnly&&t.box()&&t.onBodyMouseDown&&(e.preventDefault(),t.onBodyMouseDown(e))},St(e,K(at,{get when(){return!t.readOnly},get children(){return[K(tt,{each:iy,children:e=>{return(a=py()).$$mousedown=a=>{t.box()&&t.onResizeStart(e,a)},gt(a,"data-direction",e),a;var a}}),K(at,{get when(){return t.onRotateStart},get children(){var e=cy();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&&mt(e,a.e=s),d!==a.t&&Mt(e,"display",a.t=d),c!==a.a&&Mt(e,"left",a.a=c),h!==a.o&&Mt(e,"top",a.o=h),p!==a.i&&Mt(e,"width",a.i=p),u!==a.n&&Mt(e,"height",a.n=u),f!==a.s&&Mt(e,"transform",a.s=f),g!==a.h&&Mt(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}ft(["mousedown"]);function fy(t){return Number.isFinite(t)?Math.min(200,Math.max(50,Math.round(t))):100}var gy=ut('<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>%'),my=ut("<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>"),vy=ut("<span class=oasis-editor-import-done-icon>"),by=ut("<span class=oasis-editor-import-error-icon>"),yy=ut("<span>");function My(t){const e=Wt(),a=()=>t.layout??{},n=()=>t.overlays,r=()=>t.refs??{},o=()=>t.surfaceHandlers,i=()=>t.inputHandlers,l=()=>t.fileHandlers;let s,d;const[c,h]=y(),p=()=>Ue(t.state().document).reduce((t,e)=>Math.max(t,e.pageSettings.width),0)||be(t.state().document).width,u=()=>{const t=a().viewportHeight;return"number"==typeof t?`${t}px`:t??"min(72vh, 920px)"},f=w(()=>({width:"100%",height:"100%","max-height":u(),...a().style??{}})),g=w(()=>t.state().document),m=w(()=>De(g()).reduce((t,e)=>t+Te(e),0)),v=w(()=>function(t){const e=De(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}(g())),[b,S]=y(100),A=()=>{var t,e;return(null==(e=(t=a()).zoomPercent)?void 0:e.call(t))??b()},I=t=>{const e=fy(t),n=a().setZoomPercent;n?n(e):S(e)},C=t=>I(A()+t),k=w(()=>fy(A())/100),V=()=>{var t,e;return(null==(e=(t=a()).zoomFactor)?void 0:e.call(t))??k()},[E,R]=y(0),[L,z]=y({width:0,height:0}),N=()=>p()+68,q=w(()=>Math.max(N()*V(),L().width)),O=w(()=>Math.max(E()*V(),L().height)),P=w(()=>Math.max(0,(q()-N()*V())/2));let W=V();x(()=>{const t=V(),e=W;if(W=t,t===e||e<=0)return;const a=d;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 H=w(()=>{var t,e,n,r;return ss(g(),void 0,null==(e=(t=a()).measuredBlockHeights)?void 0:e.call(t),null==(r=(n=a()).measuredParagraphLayouts)?void 0:r.call(n))}),[U,F]=y(null),B=()=>{const t=d;if(!t)return void F(null);const e=Array.from(t.querySelectorAll(".oasis-editor-paper[data-page-index]"));if(0===e.length)return void F(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"))}F(Number.isFinite(r)?r:null)},G=()=>{const e=U();if(null!==e)return Math.max(1,e+1);const a=H(),n=t.state().selection.focus.paragraphId,r=a.pages.findIndex(t=>t.blocks.some(t=>t.sourceBlockId===n));return-1===r?1:r+1},Z=w(()=>n().selectedImageBox()),D=w(()=>n().selectedTextBoxBox()),j=w(()=>{var e;return(null==(e=t.state().document.comments)?void 0:e.items)??{}});return x(()=>{H(),queueMicrotask(B)}),(()=>{var p=gy(),u=p.firstChild,g=u.firstChild,b=g.firstChild,y=b.firstChild,x=y.nextSibling,w=x.nextSibling,S=u.nextSibling,k=S.firstChild,E=k.firstChild,W=E.nextSibling,U=W.nextSibling,F=k.nextSibling,X=F.firstChild,J=X.firstChild,Y=J.nextSibling,Q=Y.nextSibling,_=Q.nextSibling,$=_.firstChild;St(p,K(at,{get when(){return ct(()=>!!a().showHorizontalRuler)()&&n().toolbarHost},get children(){return K(cp,{get state(){return t.state},get toolbarHost(){return n().toolbarHost},viewportRef:c,readOnly:()=>Boolean(a().readOnly),zoomFactor:V})}}),u),vt(u,"contextmenu",o().onEditorContextMenu,!0),vt(u,"mousedown",o().onEditorMouseDown,!0),vt(u,"drop",o().onDrop),vt(u,"dragover",o().onDragOver),wt(t=>{var e,a;d=t,h(t),null==(a=(e=r()).onViewportRef)||a.call(e,t);const n=()=>{B()};t.addEventListener("scroll",n,{passive:!0}),queueMicrotask(B);const o=()=>{z({width:t.clientWidth,height:t.clientHeight})};let i;o(),"undefined"!=typeof ResizeObserver&&(i=new ResizeObserver(o),i.observe(t)),T(()=>{t.removeEventListener("scroll",n),null==i||i.disconnect()})},u),wt(t=>{var e,a;s=t,null==(a=(e=r()).onSurfaceRef)||a.call(e,t);const n=()=>{R(t.offsetHeight)};let o;n(),queueMicrotask(n),"undefined"!=typeof ResizeObserver&&(o=new ResizeObserver(n),o.observe(t)),T(()=>null==o?void 0:o.disconnect())},b),St(b,K(Dh,{get state(){return t.state},get measuredBlockHeights(){return a().measuredBlockHeights},get measuredParagraphLayouts(){return a().measuredParagraphLayouts},viewportRef:()=>d??void 0,get onSurfaceMouseDown(){return o().onSurfaceMouseDown},get onSurfaceClick(){return o().onSurfaceClick},get onSurfaceMouseMove(){return o().onSurfaceMouseMove},get onSurfaceDblClick(){return o().onSurfaceDblClick},get onParagraphMouseDown(){return o().onParagraphMouseDown},get onImageMouseDown(){return o().onImageMouseDown},get onImageResizeHandleMouseDown(){return o().onImageResizeHandleMouseDown},get onTextBoxResizeHandleMouseDown(){return o().onTextBoxResizeHandleMouseDown},get onTableDragHandleMouseDown(){return o().onTableDragHandleMouseDown},get onRevisionMouseEnter(){return o().onRevisionMouseEnter},get onRevisionMouseLeave(){return o().onRevisionMouseLeave}}),y),St(b,K(at,{get when(){return n().hoveredRevision()},children:t=>K(vp,{get box(){return t()}})}),y),St(b,K(at,{get when(){return n().selectionBoxes().length>0},get children(){return K(gp,{get boxes(){return n().selectionBoxes()}})}}),y),St(b,K(at,{get when(){return n().commentHighlights().length>0},get children(){return K(Sp,{get boxes(){return n().commentHighlights},commentsById:j})}}),y),St(b,K(uy,{box:Z,get readOnly(){return Boolean(a().readOnly)},variantClass:"oasis-editor-image-selection-overlay",rotation:()=>{var t;return(null==(t=Z())?void 0:t.rotation)??0},onResizeStart:(t,e)=>{const a=Z();a&&(e.preventDefault(),e.stopPropagation(),o().onImageResizeHandleMouseDown(a.paragraphId,a.startOffset,t,e))},onRotateStart:t=>{const e=Z();e&&o().onImageRotateHandleMouseDown(e.paragraphId,e.startOffset,t)},onBodyMouseDown:t=>{const e=Z();e&&o().onImageMouseDown(e.paragraphId,e.startOffset,t)}}),y),St(b,K(uy,{box:D,get readOnly(){return Boolean(a().readOnly)},variantClass:"oasis-editor-textbox-selection-overlay",rotation:()=>{var t;return(null==(t=D())?void 0:t.rotation)??0},onResizeStart:(t,e)=>{const a=D();a&&(e.preventDefault(),e.stopPropagation(),o().onTextBoxResizeHandleMouseDown(a.paragraphId,a.startOffset,t,e))},onRotateStart:t=>{const e=D();e&&o().onTextBoxRotateHandleMouseDown(e.paragraphId,e.startOffset,t)}}),y),St(b,K(at,{get when(){return ct(()=>!!n().toolbarHost)()&&n().showFloatingTableToolbar},get children(){return K(Ip,{get host(){return n().toolbarHost},get selectionBoxes(){return n().selectionBoxes},get visible(){return n().showFloatingTableToolbar},surfaceRef:()=>s})}}),y),St(b,K(at,{get when(){return n().layoutOptions},children:t=>K(Op,{box:()=>Z()??D(),get layoutOptions(){return t()},surfaceRef:()=>s,get readOnly(){return Boolean(a().readOnly)}})}),y),St(b,K(at,{get when(){return n().showCaret()},get children(){return K(pp,{get active(){return n().focused()},get left(){return n().caretBox().left},get top(){return n().caretBox().top},get height(){return n().caretBox().height}})}}),y),vt(y,"paste",i().onPaste),vt(y,"keydown",i().onKeyDown,!0),vt(y,"input",i().onInput,!0),vt(y,"focus",i().onInputFocus),vt(y,"cut",i().onCut),vt(y,"copy",i().onCopy),vt(y,"compositionstart",i().onCompositionStart),vt(y,"compositionend",i().onCompositionEnd),vt(y,"blur",i().onInputBlur);var tt=r().onTextareaRef;"function"==typeof tt?wt(tt,y):r().onTextareaRef=y,gt(y,"spellcheck",!1),vt(x,"change",l().onImportInputChange);var et=r().onImportInputRef;"function"==typeof et?wt(et,x):r().onImportInputRef=x,vt(w,"change",l().onImageInputChange);var nt=r().onImageInputRef;return"function"==typeof nt?wt(nt,w):r().onImageInputRef=w,St(p,K(at,{get when(){var t,e;return null==(e=(t=n()).importProgress)?void 0:e.call(t)},children:t=>{const a="done"===t().phase,n="error"===t().phase;return i=my(),l=i.firstChild,s=l.firstChild,d=s.nextSibling,c=d.nextSibling,h=c.firstChild,p=c.nextSibling,i.classList.toggle("oasis-editor-import-overlay-done",!!a),i.classList.toggle("oasis-editor-import-overlay-error",!!n),gt(i,"aria-busy",!a&&!n),St(l,K(Ft,{height:40,class:"oasis-editor-loading-mark"}),s),St(s,()=>e("import.overlay.title")),St(d,()=>e(`import.phase.${t().phase}`)),h.classList.toggle("oasis-editor-import-progress-bar-done",!!a),h.classList.toggle("oasis-editor-import-progress-bar-error",!!n),St(p,a?(St(o=vy(),()=>e("import.phase.done")),o):n?(St(r=by(),()=>e("import.phase.error")),r):[ct(()=>Math.round(t().progress)),"%"]),M(e=>{var a=!("applying-editor-state"!==t().phase&&"stabilizing-layout"!==t().phase),n=`${t().progress}%`;return a!==e.e&&h.classList.toggle("oasis-editor-import-progress-bar-indeterminate",e.e=a),n!==e.t&&Mt(h,"width",e.t=n),e},{e:void 0,t:void 0}),i;var r,o,i,l,s,d,c,h,p}}),S),St(E,()=>e("status.words",[v()])),St(W,()=>e("status.characters",[m()])),St(U,()=>e("status.page",[G(),Math.max(1,H().pages.length)])),J.$$click=()=>C(-10),Y.$$input=t=>I(fy(t.currentTarget.valueAsNumber)),gt(Y,"min",50),gt(Y,"max",200),gt(Y,"step",10),Q.$$click=()=>C(10),St(_,A,$),St(F,K(at,{get when(){return n().persistenceStatus},get children(){return(()=>{const t=n().persistenceStatus().toLowerCase(),a=t.includes("saved")?"status.saved":t.includes("saving")?"status.saving":t.includes("error")?"status.error":null;return K(at,{when:a,get children(){var n=yy();return St(n,()=>e(a)),M(()=>mt(n,`oasis-editor-statusbar-item oasis-editor-persistence-status oasis-editor-status-${t.replace("...","ing").replace(".","")}`)),n}})})()}}),null),M(t=>{var r="oasis-editor-editor-shell"+(a().class?` ${a().class}`:""),o=f(),i=`${q()}px`,l=`${O()}px`,s=`${P()}px`,d=`${N()}px`,c=L().height/V()+"px",h=`scale(${V()})`,u=a().readOnly,m=`${n().inputBox().left}px`,v=`${n().inputBox().top}px`,M=`${n().inputBox().height}px`,w=oy.flatMap(t=>t.accept).join(","),S=e("status.zoom"),I=`${e("status.zoom")} -`,T=A()<=50,C=e("status.zoom"),k=`${A()}%`,E=`${e("status.zoom")} +`,R=A()>=200;return r!==t.e&&mt(p,t.e=r),t.t=yt(p,o,t.t),i!==t.a&&Mt(g,"width",t.a=i),l!==t.o&&Mt(g,"height",t.o=l),s!==t.i&&Mt(b,"left",t.i=s),d!==t.n&&Mt(b,"width",t.n=d),c!==t.s&&Mt(b,"min-height",t.s=c),h!==t.h&&Mt(b,"transform",t.h=h),u!==t.r&&(y.readOnly=t.r=u),m!==t.d&&Mt(y,"left",t.d=m),v!==t.l&&Mt(y,"top",t.l=v),M!==t.u&&Mt(y,"height",t.u=M),w!==t.c&&gt(x,"accept",t.c=w),S!==t.w&&gt(X,"aria-label",t.w=S),I!==t.m&&gt(J,"aria-label",t.m=I),T!==t.f&&(J.disabled=t.f=T),C!==t.y&&gt(Y,"aria-label",t.y=C),k!==t.g&&gt(Y,"aria-valuetext",t.g=k),E!==t.p&&gt(Q,"aria-label",t.p=E),R!==t.b&&(Q.disabled=t.b=R),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(()=>Y.value=A()),p})()}ft(["mousedown","contextmenu","input","keydown","click"]);var xy=ut("<button>");function wy(t){const[e,a]=Q(t,["type","icon","label","active","class","classList"]);return xt(n=xy(),Y({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),St(n,K(Ga,{get name(){return e.icon}})),n;var n}var Sy=ut("<aside>"),Ay=ut("<div>");function Iy(t){const[e,a]=Q(t,["mode","width","class","classList","children","style"]);return xt(n=Sy(),Y({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),St(n,()=>e.children),n;var n}function Ty(t){const[e,a]=Q(t,["class","children"]);return xt(n=Ay(),Y({get class(){return`oasis-editor-plugin-side-panel-header ${e.class??""}`}},a),!1,!0),St(n,()=>e.children),n;var n}function Cy(t){const[e,a]=Q(t,["class","children"]);return xt(n=Ay(),Y({get class(){return`oasis-editor-plugin-side-panel-body ${e.class??""}`}},a),!1,!0),St(n,()=>e.children),n;var n}var ky=ut("<button>");function Vy(t){const[e,a]=Q(t,["type","icon","label","active","variant","size","class","classList"]);return xt(n=ky(),Y({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),St(n,K(Ga,{get name(){return e.icon}})),n;var n}var Ey=ut("<div class=oasis-editor-plugin-floating-actions>"),Ry=ut("<div class=oasis-editor-plugin-ui-host><div class=oasis-editor-plugin-ui-main>"),Ly=ut("<div class=oasis-editor-plugin-side-panel-overlay>"),zy=ut("<span class=oasis-editor-plugin-side-panel-icon>"),Ny=ut("<div class=oasis-editor-plugin-side-panel-title><span>");const qy={floatingActions:[],sidePanels:[],activeSidePanelId:null};function Oy(t){const e=Wt(),a=k(()=>t.children),[n,r]=y(qy);x(()=>{const e=t.editor();r(e.ui.getSnapshot());T(e.ui.onChange(()=>{r(e.ui.getSnapshot())}))});const o=w(()=>n().sidePanels.find(t=>t.id===n().activeSidePanelId)),i=()=>{var t;return(null==(t=o())?void 0:t.mode)??"dock"},l=()=>"dock"===i()?o():void 0,s=()=>n().floatingActions.filter(t=>"container"===(t.scope??"container")),d=()=>n().floatingActions.filter(t=>"viewport"===t.scope),c=(a,n=!1)=>K(tt,{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}))}(a())},children:a=>{return St(r=Ey(),K(tt,{get each(){return a.actions},children:a=>K(wy,{get icon(){return a.icon??"sparkles"},get label(){return function(t,e){return t.tooltip?t.tooltip:t.labelKey?e(t.labelKey):t.label??t.id}(a,e)},get disabled(){return!function(t,e){const a=Xt(e.command);return t.commands.canExecute(a.name,a.payload)}(t.editor(),a)},get"data-testid"(){return`plugin-floating-action-${a.id}`},onClick:()=>function(t,e){const a=Xt(e.command);t.commands.execute(a.name,a.payload)}(t.editor(),a)})})),M(t=>bt(r,{[`oasis-editor-plugin-floating-actions-${a.placement}`]:!0,"oasis-editor-plugin-floating-actions-viewport":n},t)),r;var r}});return St((h=Ry()).firstChild,a),St(h,K(at,{get when(){return l()},children:a=>Py(t.editor,a(),e)}),null),St(h,K(at,{get when(){return"overlay"===i()?o():void 0},children:a=>{return St(n=Ly(),()=>Py(t.editor,a(),e)),n;var n}}),null),St(h,()=>c(s),null),St(h,K(at,{get when(){return d().length>0},get children(){return K(Lt,{get children(){return c(d,!0)}})}}),null),M(()=>h.classList.toggle("has-docked-side-panel",!!Boolean(l()))),h;var h}function Py(t,e,a){const n=()=>t().ui.closeSidePanel(e.id);return K(Iy,{get mode(){return e.mode??"dock"},get width(){return e.width},get"data-testid"(){return`plugin-side-panel-${e.id}`},get children(){return[K(Ty,{get children(){return[(r=Ny(),o=r.firstChild,St(r,K(at,{get when(){return e.icon},get children(){var t=zy();return St(t,K(Ga,{get name(){return e.icon}})),t}}),o),St(o,(t=ct(()=>!!e.titleKey),()=>t()?a(e.titleKey):e.title)),r),K(Vy,{icon:"x",label:"Close panel",size:"sm",onClick:n})];var t,r,o}}),K(Cy,{get children(){return e.render({editor:t(),commands:t().commands,ui:t().ui,panelId:e.id,closePanel:n,getState:()=>t().state,getDocument:()=>t().state.document,getSelection:()=>t().state.selection})}})]}})}var Wy=ut("<div class=oasis-editor-main-container><section class=oasis-editor-stage>");function Hy(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=Ps({surface:e,state:t.state});if(!r)return;const o=Hs(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[K(at,{get when(){return t.showChrome},get children(){return[K(at,{get when(){return"compact"===t.toolbarView},get children(){return K(at,{get when(){return t.showTitleBar},get fallback(){return K(at,{get when(){return t.showMenubar},get children(){return K($a,{get host(){return t.toolbarHost},get registry(){return t.menuRegistry}})}})},get children(){return K(an,{get children(){return K(at,{get when(){return t.showMenubar},get children(){return K($a,{get host(){return t.toolbarHost},get registry(){return t.menuRegistry}})}})}})}})}}),K(at,{get when(){return t.showToolbar},get children(){return K(sc,{get host(){return t.toolbarHost},get registry(){return t.toolbarRegistry},get showFileGroup(){return!!ct(()=>"ribbon"===t.toolbarView)()||!t.showMenubar},get view(){return t.toolbarView},get layout(){return t.toolbarLayout}})}})]}}),K(Oy,{get editor(){return t.runtimeEditor},get children(){var i=Wy(),l=i.firstChild;return St(i,K(at,{get when(){return ct(()=>!!t.showChrome)()&&t.showOutline},get children(){return K(Ks,{get state(){return t.state},onNavigate:o,surfaceRef:()=>e,viewportRef:()=>a})}}),l),St(l,K(My,{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 Uy=ut("<div class=oasis-editor-main-container><section class=oasis-editor-stage style=padding:0>"),Fy=ut('<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 By(t){return St(e=Fy(),K(at,{get when(){return ct(()=>!!t.showChrome)()&&t.showToolbar},get children(){return K(sc,{get host(){return t.toolbarHost},get registry(){return t.toolbarRegistry},get view(){return t.toolbarView},get layout(){return t.toolbarLayout}})}}),null),St(e,K(Oy,{get editor(){return t.runtimeEditor},get children(){var e=Uy();return St(e.firstChild,K(My,{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 Gy=ut("<div class=oasis-editor-main-container><section class=oasis-editor-stage style=padding:0>"),Zy=ut("<div class=oasis-balloon-shell>");function Ky(t){return St(e=Zy(),K(Oy,{get editor(){return t.runtimeEditor},get children(){var e=Gy();return St(e.firstChild,K(My,{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 Dy=ut("<div class=oasis-editor-dialog-footer data-testid=editor-dialog-footer>"),jy=ut("<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 Xy(t){const e=Wt();let a;const n=$(),r=w(()=>t.titleId??n),o=w(()=>t.size??"md"),i=w(()=>["oasis-editor-dialog",`oasis-editor-dialog-${o()}`,t.class].filter(Boolean).join(" ")),l=w(()=>["oasis-editor-dialog-body",t.bodyClass].filter(Boolean).join(" ")),s=e=>{"Escape"===e.key&&t.isOpen&&t.onClose()};return I(()=>{window.addEventListener("keydown",s)}),T(()=>{window.removeEventListener("keydown",s)}),K(at,{get when(){return t.isOpen},get children(){var n=jy(),o=n.firstChild,s=o.firstChild,d=s.firstChild,c=d.nextSibling,h=s.nextSibling;n.$$click=()=>{(t.closeOnOverlayClick??1)&&t.onClose()},o.$$click=t=>t.stopPropagation();return"function"==typeof a?wt(a,o):a=o,St(d,()=>t.title),vt(c,"click",t.onClose,!0),St(h,()=>t.children),St(o,K(at,{get when(){return t.footer},get children(){var e=Dy();return St(e,()=>t.footer),e}}),null),M(a=>{var n=i(),s=t.ariaLabel,p=t.ariaLabel?void 0:r(),u=t.ariaDescribedBy,f=r(),g=e("generic.close"),m=l();return n!==a.e&&mt(o,a.e=n),s!==a.t&&gt(o,"aria-label",a.t=s),p!==a.a&&gt(o,"aria-labelledby",a.a=p),u!==a.o&&gt(o,"aria-describedby",a.o=u),f!==a.i&&gt(d,"id",a.i=f),g!==a.n&&gt(c,"title",a.n=g),m!==a.s&&mt(h,a.s=m),a},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),n}})}ft(["click"]);var Jy=ut("<div><div class=oasis-editor-tabs-list role=tablist>"),Yy=ut("<button type=button role=tab class=oasis-editor-tabs-tab>"),Qy=ut("<div role=tabpanel class=oasis-editor-tabs-panel>");function _y(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 $y(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(_y(a(),0,1),!0);if("End"===t.key)return c(_y(a(),a().length-1,-1),!0);const n="ArrowRight"===t.key?1:-1;c(_y(a(),e+n,n),!0)};return p=Jy(),(u=p.firstChild).$$keydown=h,St(u,K(tt,{get each(){return a()},children:(t,a)=>{const n=`${e}-${t.id}-tab`,r=`${e}-${t.id}-panel`;return(o=Yy()).$$click=()=>c(t),wt(t=>{d[a()]=t},o),gt(o,"id",n),gt(o,"aria-controls",r),St(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&&gt(o,"aria-selected",e.e=i),s!==e.t&&gt(o,"aria-disabled",e.t=s),d!==e.a&&(o.disabled=e.a=d),c!==e.o&&gt(o,"tabindex",e.o=c),h!==e.i&&o.classList.toggle("is-active",e.i=h),p!==e.n&&gt(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}})),St(p,K(tt,{get each(){return a()},children:t=>{return St(a=Qy(),()=>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&&gt(a,"id",n.e=i),s!==n.t&&gt(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&&mt(p,e.e=a),n!==e.t&&gt(u,"aria-label",e.t=n),e},{e:void 0,t:void 0}),p;var p,u}ft(["keydown","click"]);var tM=ut("<button><span class=oasis-editor-ui-button-label>");var eM=ut("<span class=oasis-editor-ui-field-label>"),aM=ut("<span class=oasis-editor-ui-field-description>"),nM=ut("<span class=oasis-editor-ui-field-error>"),rM=ut("<label><input class=oasis-editor-ui-input>");ft(["input"]);var oM=ut("<span class=oasis-editor-ui-field-description>"),iM=ut("<span class=oasis-editor-ui-field-error>"),lM=ut("<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 sM=ut("<span class=oasis-editor-ui-field-label>"),dM=ut("<span class=oasis-editor-ui-field-description>"),cM=ut("<span class=oasis-editor-ui-field-error>"),hM=ut("<label><select class=oasis-editor-ui-select>"),pM=ut("<option>");var uM=ut("<div>");const fM=Number.MAX_SAFE_INTEGER;class gM{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??fM)-(e.item.order??fM)||t.index-e.index).map(t=>t.item)}emit(){for(const t of this.listeners)t()}}function mM(){return new gM}class vM{constructor(){a(this,"items",[])}register(t){const e=this.items.findIndex(e=>e.id===t.id);e>=0?this.items[e]=t:this.items.push(t),this.items.sort((t,e)=>(t.order??Number.MAX_SAFE_INTEGER)-(e.order??Number.MAX_SAFE_INTEGER))}unregister(t){this.items=this.items.filter(e=>e.id!==t)}getItems(){return[...this.items]}}const bM=Mn,yM=14.6667;function MM(t){return Number.isFinite(t)?t*bM:0}function xM(t){return MM(t.fontSize??yM)}const wM=[8,9,10,11,12,14,16,18,20,24,28,32,36,48,72];function SM(t){return Math.round(100*MM(t))/100}function AM(t){return Math.round(1e4*(e=t,Number.isFinite(e)?e/bM:0))/1e4;var e}function IM(t){const e=Number(t);return!Number.isFinite(e)||e<=0?"":String(SM(e))}function TM(t){const e=Number(t);return!Number.isFinite(e)||e<=0?null:AM(e)}const CM=[{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 kM=ut("<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>"),VM=ut("<div class=oasis-editor-underline-menu-list>"),EM=ut('<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>'),RM=ut('<span class="oasis-editor-underline-menu-stroke oasis-editor-underline-menu-stroke-svg">'),LM=ut("<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>"),zM=ut("<span class=oasis-editor-underline-menu-stroke>");const NM=/Mac/i.test(navigator.userAgent)?"⌘":"Ctrl",qM="editor-toolbar-underline";function OM(t){const e=Wt(),a=`${e("toolbar.underline")} (${NM}+U)`,n=t.api,[r,o]=y("single"),[i,l]=y(!1),s=()=>n.commands.state("underline").isActive,d=()=>String(n.commands.state("setUnderlineStyle").value??"");return K(vd,{get open(){return i()},onOpenChange:l,tooltip:a,get rootActive(){return i()||s()},mainTestId:qM,get mainPressed(){return s()},onMain:()=>{if(!s()){const t=r();"single"===t||d()||n.commands.execute("setUnderlineStyle",t)}n.commands.execute("underline")},menuTestId:`${qM}-dropdown`,panelClass:"oasis-editor-color-menu oasis-editor-underline-menu",panelRole:"menu",get mainContent(){return t=EM(),e=t.firstChild.nextSibling,M(()=>gt(e,"data-style",(d()||r()||"single").toLowerCase())),t;var t,e},get children(){return[(a=kM(),r=a.firstChild.nextSibling,a.$$click=()=>{s()&&n.commands.execute("underline"),n.commands.execute("setUnderlineStyle",null),l(!1)},St(r,()=>e("toolbar.underlineRemove")),a),(t=VM(),St(t,K(tt,{each:CM,children:t=>{const a=()=>s()&&(d()||(s()?"single":"")).toLowerCase()===t.value.toLowerCase();return r=LM(),i=r.firstChild,c=i.nextSibling,r.$$click=()=>{(t=>{o(t);const e=s();n.commands.execute("setUnderlineStyle","single"===t?null:t),e||n.commands.execute("underline")})(t.value),l(!1)},St(i,K(at,{get when(){return t.preview.svg},get fallback(){return e=zM(),M(a=>yt(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=RM();return M(()=>e.innerHTML=t.preview.svg),e}})),St(c,()=>e(t.labelKey)),M(n=>{var o=!!a(),i=a(),l=`${qM}-style-${t.value}`,s=e(t.labelKey);return o!==n.e&&r.classList.toggle("oasis-editor-underline-menu-item-active",n.e=o),i!==n.t&&gt(r,"aria-checked",n.t=i),l!==n.a&&gt(r,"data-testid",n.a=l),s!==n.o&&gt(r,"title",n.o=s),n},{e:void 0,t:void 0,a:void 0,o:void 0}),r;var r,i,c}})),t)];var t,a,r}})}ft(["click"]);var PM=ut("<option value=decimal>"),WM=ut("<option value=lowerLetter>"),HM=ut("<option value=upperLetter>"),UM=ut("<option value=lowerRoman>"),FM=ut("<option value=upperRoman>"),BM=ut("<option value=bullet>"),GM=ut("<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 ZM=ut('<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>'),KM=ut('<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>'),DM=ut("<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>"),jM=ut('<button class="oasis-editor-dialog-button oasis-editor-dialog-button-secondary"data-testid=editor-line-spacing-dialog-cancel>'),XM=ut('<button class="oasis-editor-dialog-button oasis-editor-dialog-button-primary"data-testid=editor-line-spacing-dialog-apply>');function JM(t){const e=Wt(),[a,n]=y(""),[r,o]=y(""),[i,l]=y("");x(()=>{t.isOpen&&(n(t.initial.lineHeight??""),o(t.initial.spacingBefore??""),l(t.initial.spacingAfter??""))});const s=t=>{if(""===t.trim())return null;const e=Number(t);return Number.isFinite(e)?e:null},d=w(()=>{const t=s(a());return{"line-height":null!==t&&t>0?String(t):void 0}}),c=()=>{t.onApply({lineHeight:s(a()),spacingBefore:s(r()),spacingAfter:s(i())},t.initial),t.onClose()};return K(Xy,{get isOpen(){return t.isOpen},get title(){return e("lineSpacing.title")},get onClose(){return t.onClose},get footer(){return[(n=jM(),vt(n,"click",t.onClose,!0),St(n,()=>e("generic.cancel")),n),(a=XM(),a.$$click=c,St(a,()=>e("generic.apply")),a)];var a,n},get children(){return[(b=ZM(),y=b.firstChild.firstChild,x=y.nextSibling,St(y,()=>e("lineSpacing.lineSpacingLabel")),x.$$input=t=>n(t.currentTarget.value),M(()=>x.value=a()),b),(p=KM(),u=p.firstChild,f=u.firstChild,g=f.nextSibling,m=u.nextSibling.firstChild,v=m.nextSibling,St(f,()=>e("lineSpacing.spacingBeforeLabel")),g.$$input=t=>o(t.currentTarget.value),St(m,()=>e("lineSpacing.spacingAfterLabel")),v.$$input=t=>l(t.currentTarget.value),M(()=>g.value=r()),M(()=>v.value=i()),p),(t=DM(),s=t.firstChild,c=s.nextSibling,h=c.firstChild,St(s,()=>e("lineSpacing.preview")),St(c,()=>e("lineSpacing.previewText"),h),St(c,()=>e("lineSpacing.previewText"),null),M(t=>yt(c,d(),t)),t)];var t,s,c,h,p,u,f,g,m,v,b,y,x}})}ft(["input","click"]);var YM=ut("<div class=oasis-editor-line-spacing-menu-separator role=separator>"),QM=ut('<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>'),_M=ut("<div class=oasis-editor-toolbar-dropdown>"),$M=ut('<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>'),tx=ut('<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">'),ex=ut("<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 ax=[1,1.15,1.5,2,2.5,3];function nx(t){return null==t?"":String(t)}function rx(t){const e=Wt(),a=t.api,[n,r]=y(!1),[o,i]=y(!1),[l,s]=y({lineHeight:"",spacingBefore:"",spacingAfter:""}),d=w(()=>{const t=nx(a.commands.state("setLineHeight").value);if(""===t)return null;const e=Number(t);return Number.isFinite(e)?e:null}),c=()=>r(!1),h=()=>{s({lineHeight:nx(a.commands.state("setLineHeight").value),spacingBefore:nx(a.commands.state("setSpacingBefore").value),spacingAfter:nx(a.commands.state("setSpacingAfter").value)}),i(!0),c()},p=(t,e)=>{const n=e.lineHeight?Number(e.lineHeight):null,r=e.spacingBefore?Number(e.spacingBefore):null,o=e.spacingAfter?Number(e.spacingAfter):null;t.lineHeight!==n&&a.commands.execute("setLineHeight",t.lineHeight),t.spacingBefore!==r&&a.commands.execute("setSpacingBefore",t.spacingBefore),t.spacingAfter!==o&&a.commands.execute("setSpacingAfter",t.spacingAfter),a.focusEditor()};return St(u=_M(),K(rd,{get open(){return n()},onOpenChange:r,panelRole:"menu",panelClass:"oasis-editor-toolbar-dropdown-menu oasis-editor-line-spacing-menu",trigger:t=>{return(a=$M()).$$click=()=>t.toggle(),wt(e=>t.ref(e),a),M(n=>{var r=!!t.open,o=e("metric.lineSpacing"),i=e("metric.lineSpacing"),l=t.open;return r!==n.e&&a.classList.toggle("oasis-editor-tool-button-active",n.e=r),o!==n.t&&gt(a,"title",n.t=o),i!==n.a&&gt(a,"aria-label",n.a=i),l!==n.o&&gt(a,"aria-expanded",n.o=l),n},{e:void 0,t:void 0,a:void 0,o:void 0}),a;var a},get children(){return[K(tt,{each:ax,children:t=>{const n=function(t){return t.toFixed(t===Math.floor(t)?1:2)}(t),r=()=>{const e=d();return null!==e&&(a=e,n=t,Math.abs(a-n)<.001);var a,n};return o=ex(),i=o.firstChild,l=i.nextSibling,o.$$click=()=>(t=>{a.commands.execute("setLineHeight",t),a.focusEditor(),c()})(t),St(i,K(at,{get when(){return r()},get children(){return tx()}})),St(l,n),M(t=>{var a=!!r(),i=r(),l=`editor-toolbar-line-spacing-${n.replace(".","_")}`,s=e("metric.lineSpacingOption",[n]);return a!==t.e&&o.classList.toggle("oasis-editor-line-spacing-item-active",t.e=a),i!==t.t&&gt(o,"aria-checked",t.t=i),l!==t.a&&gt(o,"data-testid",t.a=l),s!==t.o&&gt(o,"title",t.o=s),t},{e:void 0,t:void 0,a:void 0,o:void 0}),o;var o,i,l}}),YM(),(t=QM(),n=t.firstChild.nextSibling,t.$$click=h,St(n,()=>e("metric.lineSpacingOptions")),t)];var t,n}}),null),St(u,K(at,{get when(){return o()},get children(){return K(Lt,{get children(){return K(JM,{get isOpen(){return o()},get initial(){return l()},onClose:()=>i(!1),onApply:p})}})}}),null),u;var u}ft(["click"]);var ox=ut('<div class="oasis-editor-toolbar-panel-section oasis-editor-toolbar-panel-actions">'),ix=ut("<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 lx=(t,e)=>{const a=t.commands.state(e).value;return null==a?"":String(a)};ft(["input"]);var sx=ut('<div class="oasis-editor-toolbar-panel-section oasis-editor-toolbar-panel-actions">'),dx=ut("<div class=oasis-editor-toolbar-badge data-testid=editor-table-selection-label>");function cx(t){const e=Wt(),a=t.api,n=t=>!a.commands.state(t).isEnabled;return K(hd,{icon:"table-properties",testId:"editor-toolbar-table-dropdown",get tooltip(){return e("toolbar.table")},hideChevron:!0,panelClass:"oasis-editor-toolbar-panel oasis-editor-toolbar-table-panel",keepMounted:!0,get children(){return[(s=sx(),St(s,K(ed,{icon:"combine","data-testid":"editor-toolbar-merge-table",get disabled(){return n("tableMerge")},onClick:()=>a.commands.execute("tableMerge"),get tooltip(){return e("table.mergeTooltip")}}),null),St(s,K(ed,{icon:"split","data-testid":"editor-toolbar-split-table",get disabled(){return n("tableSplit")},onClick:()=>a.commands.execute("tableSplit"),get tooltip(){return e("table.splitTooltip")}}),null),s),(l=sx(),St(l,K(ed,{icon:"columns","data-testid":"editor-toolbar-insert-table-column-before",get disabled(){return n("tableInsertColumnBefore")},onClick:()=>a.commands.execute("tableInsertColumnBefore"),get tooltip(){return e("table.insertColumnLeft")}}),null),St(l,K(ed,{icon:"columns","data-testid":"editor-toolbar-insert-table-column-after",get disabled(){return n("tableInsertColumnAfter")},onClick:()=>a.commands.execute("tableInsertColumnAfter"),get tooltip(){return e("table.insertColumnRight")}}),null),St(l,K(ed,{icon:"trash-2","data-testid":"editor-toolbar-delete-table-column",get disabled(){return n("tableDeleteColumn")},onClick:()=>a.commands.execute("tableDeleteColumn"),get tooltip(){return e("table.deleteColumn")}}),null),l),(i=sx(),St(i,K(ed,{icon:"rows","data-testid":"editor-toolbar-insert-table-row-before",get disabled(){return n("tableInsertRowBefore")},onClick:()=>a.commands.execute("tableInsertRowBefore"),get tooltip(){return e("table.insertRowAbove")}}),null),St(i,K(ed,{icon:"rows","data-testid":"editor-toolbar-insert-table-row-after",get disabled(){return n("tableInsertRowAfter")},onClick:()=>a.commands.execute("tableInsertRowAfter"),get tooltip(){return e("table.insertRowBelow")}}),null),St(i,K(ed,{icon:"trash-2","data-testid":"editor-toolbar-delete-table-row",get disabled(){return n("tableDeleteRow")},onClick:()=>a.commands.execute("tableDeleteRow"),get tooltip(){return e("table.deleteRow")}}),null),i),(o=sx(),St(o,K(ed,{icon:"palette","data-testid":"editor-toolbar-table-shading",onClick:()=>{const t=prompt(e("table.cellBgColorPrompt"),"#f1f5f9");null!==t&&a.commands.execute("tableCellShading",t)},get tooltip(){return e("table.cellColor")}}),null),St(o,K(ed,{icon:"frame","data-testid":"editor-toolbar-table-borders",onClick:()=>a.commands.execute("tableCellBorders"),get tooltip(){return e("table.applyBorders")}}),null),St(o,K(ed,{icon:"square","data-testid":"editor-toolbar-table-no-borders",onClick:()=>a.commands.execute("tableCellNoBorders"),get tooltip(){return e("table.removeBorders")}}),null),o),(r=sx(),St(r,K(ed,{icon:"maximize","data-testid":"editor-toolbar-table-width-100",onClick:()=>a.commands.execute("tableWidth100"),get tooltip(){return e("table.width100Tooltip")}})),r),(t=sx(),St(t,K(ed,{icon:"align-left","data-testid":"editor-toolbar-table-align-left",onClick:()=>a.commands.execute("tableAlignLeft"),get tooltip(){return e("table.alignLeft")}}),null),St(t,K(ed,{icon:"align-center","data-testid":"editor-toolbar-table-align-center",onClick:()=>a.commands.execute("tableAlignCenter"),get tooltip(){return e("table.alignCenter")}}),null),St(t,K(ed,{icon:"align-right","data-testid":"editor-toolbar-table-align-right",onClick:()=>a.commands.execute("tableAlignRight"),get tooltip(){return e("table.alignRight")}}),null),St(t,K(ed,{icon:"move-horizontal","data-testid":"editor-toolbar-table-cell-width",onClick:()=>{const t=prompt(e("table.cellWidthPrompt"));t&&a.commands.execute("tableSetCellWidth",t)},get tooltip(){return e("table.cellWidth")}}),null),t),K(at,{get when(){return a.commands.state("tableContext").value},children:t=>{return St(e=dx(),t),e;var e}})];var t,r,o,i,l,s}})}var hx=ut('<div class="oasis-editor-toolbar-panel-section oasis-editor-toolbar-panel-actions">');function px(t){return Math.round(t*xn)}function ux(t){return Math.round(t/xn*100)/100}const fx=[{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 gx(t){return{top:px(t.top),bottom:px(t.bottom),left:px(t.left),right:px(t.right)}}var mx=ut("<div class=oasis-editor-margins-list>"),vx=ut("<div class=oasis-editor-margins-custom-form>"),bx=ut("<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>"),yx=ut("<div class=oasis-editor-margins-custom-actions><button type=button class=oasis-editor-margins-custom-apply data-testid=editor-toolbar-margins-custom-apply>"),Mx=ut("<button type=button class=oasis-editor-margins-item><span class=oasis-editor-margins-item-name></span><span class=oasis-editor-margins-item-values><br>"),xx=ut("<label class=oasis-editor-margins-custom-field><span></span><input type=number min=0 step=0.1>");const wx=[{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 Sx(t){const e=Wt(),a=t=>e("section.marginValue",[String(t).replace(".",e("number.decimalSeparator"))]),n=t.api,[r,o]=y(!1),[i,l]=y({}),s=w(()=>n.commands.state("setPageMargins").value),d=w(()=>{var t;const e=s();if(e)return null==(t=fx.find(t=>function(t,e){const a=gx(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}),c=()=>{const t=s();l({top:t?String(ux(t.top)):"",bottom:t?String(ux(t.bottom)):"",left:t?String(ux(t.left)):"",right:t?String(ux(t.right)):""}),o(t=>!t)},h=()=>{const t=i(),e={};for(const{key:a}of wx){const n=t[a];if(null==n||""===n)continue;const r=Number(n.replace(",","."));Number.isFinite(r)&&r>=0&&(e[a]=px(r))}Object.keys(e).length>0&&n.commands.execute("setPageMargins",e),n.focusEditor()};return K(hd,{icon:"square-dashed",get label(){return e("section.margins")},testId:"editor-toolbar-margins-dropdown",get tooltip(){return e("section.margins")},panelClass:"oasis-editor-toolbar-panel oasis-editor-margins-panel",keepMounted:!0,get children(){return[(p=mx(),St(p,K(tt,{each:fx,children:t=>{return r=Mx(),o=r.firstChild,i=o.nextSibling,l=i.firstChild,r.$$click=()=>(t=>{n.commands.execute("setPageMargins",gx(t)),n.focusEditor()})(t),St(o,()=>e(t.labelKey)),St(i,()=>`${e("section.marginField.top")} ${a(t.top)} ${e("section.marginField.bottom")} ${a(t.bottom)}`,l),St(i,()=>`${e("section.marginField.left")} ${a(t.left)} ${e("section.marginField.right")} ${a(t.right)}`,null),M(e=>{var a=!(d()!==t.id),n=`editor-toolbar-margins-${t.id}`;return a!==e.e&&r.classList.toggle("oasis-editor-margins-item-active",e.e=a),n!==e.t&&gt(r,"data-testid",e.t=n),e},{e:void 0,t:void 0}),r;var r,o,i,l}})),p),(t=bx(),o=t.firstChild,s=o.firstChild.nextSibling,o.$$click=c,St(s,()=>e("section.marginPreset.custom")),St(t,K(at,{get when(){return r()},get children(){var t=vx();return St(t,K(tt,{each:wx,children:t=>{return a=xx(),n=a.firstChild,r=n.nextSibling,St(n,()=>e(t.labelKey)),r.$$input=e=>l(a=>({...a,[t.key]:e.currentTarget.value})),M(()=>r.value=i()[t.key]??""),a;var a,n,r}})),t}}),null),t),K(at,{get when(){return r()},get children(){var t=yx(),a=t.firstChild;return a.$$click=h,St(a,()=>e("section.marginApply")),t}})];var t,o,s,p}})}ft(["click","input"]);const Ax=/Mac/i.test(navigator.userAgent)?"⌘":"Ctrl",Ix=t=>t.commands.state("documentStyles").value??[],Tx=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 Ix(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}))},Cx=t=>{const e=new Set(wM);for(const n of Ix(t))"number"==typeof n.fontSize&&Number.isFinite(n.fontSize)&&e.add(SM(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)}))},kx=t=>Ix(t).map(t=>({value:t.id,label:t.name})),Vx=[{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"}],Ex=[{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"}],Rx={"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 Lx(t){const e=[];e.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"}]}}),e.push({type:"separator",id:"sep-file",group:"file"}),e.push({type:"button",id:"editor-toolbar-undo",testId:"editor-toolbar-undo",iconName:"undo",command:"undo",tooltip:`${t("toolbar.undo")} (${Ax}+Z)`}),e.push({type:"button",id:"editor-toolbar-redo",testId:"editor-toolbar-redo",iconName:"redo",command:"redo",tooltip:`${t("toolbar.redo")} (${Ax}+Shift+Z)`}),e.push({type:"separator",id:"sep-history"}),e.push({type:"select",id:"editor-toolbar-style",testId:"editor-toolbar-style",width:"wide",tooltipKey:"toolbar.style",command:"setStyleId",options:kx}),e.push({type:"select",id:"editor-toolbar-font-family",testId:"editor-toolbar-font-family",tooltipKey:"toolbar.fontFamily",placeholder:t("toolbar.font"),command:"setFontFamily",options:Tx}),e.push({type:"select",id:"editor-toolbar-font-size",testId:"editor-toolbar-font-size",width:"small",tooltipKey:"toolbar.fontSize",command:"setFontSize",options:Cx}),e.push({type:"button",id:"editor-toolbar-font-increase",testId:"editor-toolbar-font-increase",iconName:"a-arrow-up",command:"increaseFontSize",tooltipKey:"toolbar.increaseFontSize"}),e.push({type:"button",id:"editor-toolbar-font-decrease",testId:"editor-toolbar-font-decrease",iconName:"a-arrow-down",command:"decreaseFontSize",tooltipKey:"toolbar.decreaseFontSize"}),e.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"}}]}}),e.push({type:"button",id:"editor-toolbar-clear-formatting",testId:"editor-toolbar-clear-formatting",iconName:"remove-formatting",command:"clearFormatting",tooltipKey:"toolbar.clearFormatting"}),e.push({type:"toggle",id:"editor-toolbar-bold",testId:"editor-toolbar-bold",iconName:"bold",command:"bold",tooltipKey:"toolbar.bold"}),e.push({type:"toggle",id:"editor-toolbar-italic",testId:"editor-toolbar-italic",iconName:"italic",command:"italic",tooltipKey:"toolbar.italic"}),e.push({type:"custom",id:"editor-toolbar-underline-control",render:t=>OM({api:t})}),e.push({type:"toggle",id:"editor-toolbar-strike",testId:"editor-toolbar-strike",iconName:"strikethrough",command:"strike",tooltipKey:"toolbar.strike"}),e.push({type:"toggle",id:"editor-toolbar-subscript",testId:"editor-toolbar-subscript",iconName:"subscript",command:"subscript",tooltipKey:"toolbar.subscript"}),e.push({type:"toggle",id:"editor-toolbar-superscript",testId:"editor-toolbar-superscript",iconName:"superscript",command:"superscript",tooltipKey:"toolbar.superscript"}),e.push({type:"separator",id:"sep-format"}),e.push({type:"colorPicker",id:"editor-toolbar-color",testId:"editor-toolbar-color",kind:"color",iconName:"type",defaultValue:"#111827",tooltipKey:"toolbar.color",command:"setColor"}),e.push({type:"colorPicker",id:"editor-toolbar-highlight",testId:"editor-toolbar-highlight",kind:"highlight",iconName:"highlighter",defaultValue:"#fef08a",tooltipKey:"toolbar.highlight",command:"setHighlight"}),e.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"}),e.push({type:"separator",id:"sep-style"}),e.push({type:"button",id:"editor-toolbar-insert-image",testId:"editor-toolbar-insert-image",iconName:"image",tooltipKey:"toolbar.image",command:"insertImage"}),e.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"}}]}}),e.push({type:"gridPicker",id:"editor-toolbar-insert-table",testId:"editor-toolbar-insert-table",tooltipKey:"toolbar.table",command:"insertTable"}),e.push({type:"button",id:"editor-toolbar-link",testId:"editor-toolbar-link",iconName:"link",command:"link",tooltip:`${t("toolbar.link")} (${Ax}+K)`}),e.push({type:"button",id:"editor-toolbar-unlink",testId:"editor-toolbar-unlink",iconName:"unlink",command:"unlink",tooltipKey:"toolbar.unlink"}),e.push({type:"button",id:"editor-toolbar-footnote",testId:"editor-toolbar-footnote",iconName:"footnote",command:"insertFootnote",tooltip:`${t("toolbar.footnote")} (${Ax}+Alt+F)`}),e.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}),e.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}),e.push({type:"separator",id:"sep-insert"});for(const a of Vx)e.push({type:"toggle",id:a.testId,testId:a.testId,iconName:a.icon,command:a.command,tooltipKey:a.tooltipKey});for(const a of Ex)e.push({type:"toggle",id:a.testId,testId:a.testId,iconName:a.icon,command:a.command,tooltipKey:a.tooltipKey});return e.push({type:"button",id:"editor-toolbar-list-outdent",testId:"editor-toolbar-list-outdent",iconName:"indent-decrease",tooltipKey:"toolbar.decreaseIndent",command:"outdent"}),e.push({type:"button",id:"editor-toolbar-list-indent",testId:"editor-toolbar-list-indent",iconName:"indent-increase",tooltipKey:"toolbar.increaseIndent",command:"indent"}),e.push({type:"custom",id:"editor-toolbar-list-options",render:t=>function(t){const e=Wt(),a=t.api;return K(hd,{icon:"list-filter",get tooltip(){return e("toolbar.listFormat")},testId:"editor-toolbar-list-options-dropdown",hideChevron:!0,get children(){var t=GM(),n=t.firstChild,r=n.firstChild,o=n.nextSibling.firstChild,i=o.nextSibling;return St(r,()=>e("toolbar.listFormat")),St(n,K(ud,{"data-testid":"editor-toolbar-list-format",onChange:t=>a.commands.execute("setListFormat",t.currentTarget.value),get tooltip(){return e("toolbar.listFormat")},get children(){return[(i=PM(),St(i,()=>e("toolbar.formatDecimal")),i),(o=WM(),St(o,()=>e("toolbar.formatLowerLetter")),o),(r=HM(),St(r,()=>e("toolbar.formatUpperLetter")),r),(n=UM(),St(n,()=>e("toolbar.formatLowerRoman")),n),(a=FM(),St(a,()=>e("toolbar.formatUpperRoman")),a),(t=BM(),St(t,()=>e("toolbar.formatBullet")),t)];var t,a,n,r,o,i}}),null),St(o,()=>e("toolbar.listStartAt")),i.addEventListener("change",t=>a.commands.execute("setListStartAt",t.currentTarget.value)),M(()=>gt(i,"title",e("toolbar.listStartAt"))),t}})}({api:t})}),e.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}]}}),e.push({type:"custom",id:"editor-toolbar-line-spacing-control",render:t=>rx({api:t})}),e.push({type:"separator",id:"sep-paragraph"}),e.push({type:"custom",id:"editor-toolbar-metrics",render:t=>function(t){const e=Wt(),a=t.api,n=t=>e=>a.commands.execute(t,e.currentTarget.value);return K(hd,{icon:"sliders-horizontal",testId:"editor-toolbar-metrics-dropdown",get tooltip(){return e("metric.leftIndent")},hideChevron:!0,panelClass:"oasis-editor-toolbar-panel",keepMounted:!0,get children(){return[(y=ox(),St(y,K(ed,{icon:"file-up",get active(){return a.commands.state("togglePageBreakBefore").isActive},"data-testid":"editor-toolbar-page-break-before",onClick:()=>a.commands.execute("togglePageBreakBefore"),get tooltip(){return e("metric.pageBreakBefore")}}),null),St(y,K(ed,{icon:"link-2",get active(){return a.commands.state("toggleKeepWithNext").isActive},"data-testid":"editor-toolbar-keep-with-next",onClick:()=>a.commands.execute("toggleKeepWithNext"),get tooltip(){return e("metric.keepWithNext")}}),null),y),(t=ix(),r=t.firstChild,o=r.firstChild,i=o.nextSibling,l=r.nextSibling,s=l.firstChild,d=s.nextSibling,c=l.nextSibling,h=c.firstChild,p=h.nextSibling,u=c.nextSibling,f=u.firstChild,g=f.nextSibling,m=u.nextSibling,v=m.firstChild,b=v.nextSibling,St(o,()=>e("metric.after")),vt(i,"change",n("setSpacingAfter")),St(s,()=>e("metric.indent")),vt(d,"change",n("setIndentLeft")),St(h,()=>e("metric.first")),vt(p,"change",n("setIndentFirstLine")),St(f,()=>e("metric.hang")),vt(g,"change",n("setIndentHanging")),St(v,()=>e("metric.paraBg")),b.$$input=t=>a.commands.execute("setParagraphShading",t.currentTarget.value),St(t,K(ed,{icon:"frame","data-testid":"editor-toolbar-paragraph-borders",onClick:()=>a.commands.execute("applyParagraphBorders"),get tooltip(){return e("metric.applyBorders")}}),null),M(t=>{var a=e("metric.spacingAfter"),n=e("metric.leftIndent"),o=e("metric.firstLineIndent"),i=e("metric.hangingIndent"),s=e("metric.paragraphBgColor");return a!==t.e&&gt(r,"title",t.e=a),n!==t.t&&gt(l,"title",t.t=n),o!==t.a&&gt(c,"title",t.a=o),i!==t.o&&gt(u,"title",t.o=i),s!==t.i&&gt(m,"title",t.i=s),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),M(()=>i.value=lx(a,"setSpacingAfter")),M(()=>d.value=lx(a,"setIndentLeft")),M(()=>p.value=lx(a,"setIndentFirstLine")),M(()=>g.value=lx(a,"setIndentHanging")),M(()=>b.value=lx(a,"setParagraphShading")||"#ffffff"),t)];var t,r,o,i,l,s,d,c,h,p,u,f,g,m,v,b,y}})}({api:t})}),e.push({type:"separator",id:"sep-metrics"}),e.push({type:"custom",id:"editor-toolbar-table",isVisible:t=>t.commands.state("tableContext").isActive,render:t=>cx({api:t})}),e.push({type:"separator",id:"sep-table",isVisible:t=>t.commands.state("tableContext").isActive}),e.push({type:"custom",id:"editor-toolbar-margins",ribbonSize:"large",render:t=>Sx({api:t})}),e.push({type:"custom",id:"editor-toolbar-section",ribbonSize:"large",render:t=>function(t){const e=Wt(),a=t.api;return K(hd,{icon:"layout-template",get label(){return e("section.orientation")},testId:"editor-toolbar-section-dropdown",get tooltip(){return e("section.pageSetup")},panelClass:"oasis-editor-toolbar-panel",keepMounted:!0,get children(){return[(n=hx(),St(n,K(ed,{icon:"rectangle-vertical",get active(){return!a.commands.state("toggleOrientation").isActive},"data-testid":"editor-toolbar-orientation-portrait",onClick:()=>a.commands.execute({name:"setOrientation",payload:"portrait"}),get tooltip(){return e("section.portrait")}}),null),St(n,K(ed,{icon:"rectangle-horizontal",get active(){return a.commands.state("toggleOrientation").isActive},"data-testid":"editor-toolbar-orientation-landscape",onClick:()=>a.commands.execute({name:"setOrientation",payload:"landscape"}),get tooltip(){return e("section.landscape")}}),null),n),(t=hx(),St(t,K(ed,{icon:"scissors","data-testid":"editor-toolbar-section-break-next",onClick:()=>a.commands.execute("sectionBreakNextPage"),get tooltip(){return e("section.secNextTooltip")}}),null),St(t,K(ed,{icon:"scissors","data-testid":"editor-toolbar-section-break-continuous",onClick:()=>a.commands.execute("sectionBreakContinuous"),get tooltip(){return e("section.secContTooltip")}}),null),t)];var t,n}})}({api:t})}),function(t){return t.map((t,e)=>{const a=Rx[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}})}(e)}function zx(t,e){const a=ga(t);if(a.isCollapsed||a.startIndex!==a.endIndex||a.endParagraphOffset-a.startParagraphOffset!==1)return null;const n=da(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 Nx(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 qx(t){return t?t.behindDoc?"behind":t.wrap&&"none"!==t.wrap?t.wrap:"front":"inline"}function Ox(t,e){return{...t,positionV:{...t.positionV??{},relativeFrom:e?"page":"paragraph"}}}function Px(t){var e;return"page"===(null==(e=null==t?void 0:t.positionV)?void 0:e.relativeFrom)}function Wx(t){return t?{...t}:void 0}function Hx(t,e){return JSON.stringify(t??null)===JSON.stringify(e??null)}function Ux(t,e,a){const n={...t??{}};return a?n[e]=!0:delete n[e],Object.keys(n).length>0?n:void 0}function Fx(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 Bx(t,e,a){const n={...t??{}};return null==a?delete n[e]:n[e]=a,Object.keys(n).length>0?n:void 0}function Gx(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:Xx(t.blocks)}}function Zx(t){return{...t,styles:Wx(t.styles),image:t.image?{...t.image}:void 0,textBox:t.textBox?Gx(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 Kx(t){return{...t,runs:t.runs.map(Zx),style:t.style?{...t.style}:void 0,list:t.list?{...t.list}:void 0}}function Dx(t){return t?{...t}:void 0}function jx(t){return t.map(Kx)}function Xx(t){return t.map(t=>"paragraph"===t.type?Kx(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:jx(t.blocks)}))}))})}function Jx(t){const e=ya("");return e.fieldChar={kind:t},e}function Yx(t){const e=ya("");return e.fieldInstruction=t,e}function Qx(t,e,a){const n=wa([{text:`${e} `},{text:String(a)},{text:t?`: ${t}`:""}]);return n.style={styleId:"Caption",align:"center"},n.runs=[n.runs[0],Jx("begin"),Yx(" SEQ Figure \\* ARABIC "),Jx("separate"),n.runs[1],Jx("end"),n.runs[2]],n}function _x(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 $x(t,e){if(!_x(t))return Kx(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?{...Kx(t),runs:r}:Kx(t)}function tw(t,e){return t.map(t=>"paragraph"===t.type?_x(t)?$x(t,e.next++):Kx(t):{...t,rows:t.rows.map(t=>({...t,cells:t.cells.map(t=>({...t,blocks:tw(t.blocks,e)}))}))})}function ew(t){const e={next:1},a=Ue(t).map(t=>({...t,blocks:tw(t.blocks,e),header:t.header?Xx(t.header):void 0,footer:t.footer?Xx(t.footer):void 0}));return{...t,sections:a}}function aw(t){return Boolean(t.image||t.textBox)}function nw(t,e){const a=[];for(const n of t){if(0===n.text.length)continue;const t=a[a.length-1];!t||aw(n)||aw(t)||!Hx(t.styles,n.styles)?a.push({...n,styles:Wx(n.styles)}):t.text+=n.text}return a.length>0?a:[Ma("",e)]}function rw(t,e,a){return{...t,runs:nw(e,a),style:t.style?{...t.style}:void 0}}function ow(t){return wa(t)}function iw(t,e){const a=ow(e);return a.style=t.style?{...t.style}:void 0,a.list=Dx(t.list),a}function lw(t,e){const a=Kx(t);return a.list?(a.list={...a.list,level:Math.max(0,e)},a):a}function sw(t){const e=Kx(t);return delete e.list,e}function dw(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 Wx(a.styles);if(e===o){if(a.text.length>0)return Wx(a.styles);const e=t.runs[r+1];return Wx((null==e?void 0:e.styles)??a.styles)}n=o}return Wx(null==(a=t.runs[t.runs.length-1])?void 0:a.styles)}function cw(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 hw(t,e,a){const n=Math.max(0,Math.min(e,Te(t))),r=Math.max(n,Math.min(a,Te(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=Gx(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 pw(t,e,a){const n=hw(t,0,e),r=hw(t,e,Te(t)),o=dw(t,e);return rw(t,[...n,...a.map(t=>({...t,styles:Wx(t.styles??o)})),...r],o)}function uw(t){const e=[],a=new Map,n=[];let r=0;for(const o of t){const t=Ie(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 fw(t,e,a){return t<e?e:t>a?a:t}function gw(t,e,a){const n=uw(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=uw(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+fw(t.offset,0,i-e),r=fw(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 mw(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 vw(t,e,a){const n=la(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=mw(o.blocks,e);return{...t,document:{...t.document,footnotes:{...r,items:{...r.items,[n]:{...o,blocks:i}}}},selection:a}}const r=Ue(t.document),o=Math.max(0,Math.min(ia(t),r.length-1)),i=r[o];if(!i)return{...t,selection:a};const l=function(t,e,a){return"header"===a?{...t,header:mw(t.header??[],e)}:"footer"===a?{...t,footer:mw(t.footer??[],e)}:{...t,blocks:mw(t.blocks,e)}}(i,e,n),s=[...r];s[o]=l;const d=t.document.bookmarks,c=d&&d.order.length>0?gw(d,da(t),e):d;return{...t,document:{...t.document,sections:s,...c!==d?{bookmarks:c}:{}},selection:a}}function bw(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 yw(t){return ua(t)}function Mw(t){const e=da(t),a=ha(t,t.selection.focus),n=ca(e,a.paragraphId),r=e[n];return{paragraph:r,index:n,offset:ke(r,a)}}function xw(t){const e=ga(t);if(e.isCollapsed)return t;const a=da(t);if(t.trackChangesEnabled){const n=`rev:${Math.random().toString(36).slice(2,9)}`,r="User",o=Date.now();return vw(t,a.map((t,a)=>{if(a<e.startIndex||a>e.endIndex)return Kx(t);return ww(t,a===e.startIndex?e.startParagraphOffset:0,a===e.endIndex?e.endParagraphOffset:Te(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}}})}),yw(e.start))}const n=a[e.startIndex],r=a[e.endIndex],o=ke(n,e.start),i=ke(r,e.end),l=rw(n,[...hw(n,0,o),...hw(r,i,Te(r))]);return vw(t,[...jx(a.slice(0,e.startIndex)),l,...jx(a.slice(e.endIndex+1))],yw(Ce(l,o)))}function ww(t,e,a,n){return rw(t,[...hw(t,0,e),...hw(t,e,a).map(n),...hw(t,a,Te(t))])}function Sw(t,e){const a=t[e.startIndex],n=t[e.endIndex];return{anchor:Ce(a,e.startParagraphOffset),focus:Ce(n,e.endParagraphOffset)}}function Aw(t,e){const a=ga(t);return a.isCollapsed?t:{document:t.document,selection:yw("start"===e?a.start:a.end)}}function Iw(t){return zx(t,t=>Boolean(t.image))}function Tw(t,e){const a=Iw(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=da(t),{paragraphIndex:o,run:i}=a,l=r.map((t,e)=>e!==o?Kx(t):{...Kx(t),runs:t.runs.map(t=>t.id===i.id&&t.image?{...t,image:{...t.image,rotation:n}}:Zx(t))});return vw(t,l,Sw(l,ga(t)))}function Cw(t,e){const a=Iw(t);if(!(null==a?void 0:a.run.image))return t;const n=da(t),{paragraphIndex:r,run:o}=a,i=n.map((t,a)=>a!==r?Kx(t):{...Kx(t),runs:t.runs.map(t=>{if(t.id!==o.id||!t.image)return Zx(t);const a=e(t.image.floating),n={...t.image};return a?n.floating=a:delete n.floating,{...t,image:n}})});return vw(t,i,Sw(i,ga(t)))}function kw(t){const e=Iw(t);if(!(null==e?void 0:e.run.image))return null;return function(t){var e;if(!_x(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]+/,"")}(da(t)[e.paragraphIndex+1])}function Vw(t,e,a){const n=Iw(t);if(!(null==n?void 0:n.run.image))return t;const r=da(t),o=n.paragraphIndex+1,i=o<r.length&&_x(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=Qx(e,a,Number.parseInt(r,10)||1);return o.id=t.id,o}(r[o],e,a):Qx(e,a,1),l=function(t){let e=1;return t.map(t=>_x(t)?$x(t,e++):Kx(t))}(o<r.length&&_x(r[o])?[...jx(r.slice(0,o)),i,...jx(r.slice(o+1))]:[...jx(r.slice(0,o)),i,...jx(r.slice(o))]),s=l[o]??i;return vw(t,l,yw(Ce(s,Te(s))))}function Ew(t,e){const a=Iw(t);if(!a)return t;const n=da(t),{paragraphIndex:r,offset:o,run:i}=a,l=ca(n,e.paragraphId);if(l<0)return t;const s=ke(n[l],e),d=l===r&&s>o?s-1:s;if(l===r&&d===o)return t;const c=t=>rw(t,[...hw(t,0,o),...hw(t,o+1,Te(t))]),h=(t,e)=>pw(t,Math.max(0,Math.min(e,Te(t))),[Ma("",dw(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):jx([t])[0]),u=p[l];return vw(t,p,yw(Ce(u,Math.max(0,Math.min(d+1,Te(u))))))}function Rw(t){return zx(t,t=>Boolean(t.textBox))}function Lw(t,e){const a=Rw(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=da(t).map((t,e)=>e!==r?Kx(t):{...Kx(t),runs:t.runs.map(t=>t.id===o.id&&t.textBox?{...t,textBox:{...t.textBox,rotation:n}}:Zx(t))});return vw(t,i,Sw(i,ga(t)))}function zw(t,e){const a=Rw(t);if(!(null==a?void 0:a.run.textBox))return t;const{paragraphIndex:n,run:r}=a,o=da(t).map((t,a)=>a!==n?Kx(t):{...Kx(t),runs:t.runs.map(t=>{if(t.id!==r.id||!t.textBox)return Zx(t);const a=e(t.textBox.floating),n={...t.textBox};return a?n.floating=a:delete n.floating,{...t,textBox:n}})});return vw(t,o,Sw(o,ga(t)))}function Nw(t,e,a,n={}){const r=Rw(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=da(t).map((t,e)=>e!==h?Kx(t):{...Kx(t),runs:t.runs.map(t=>{var e;if(t.id!==p.id||!t.textBox)return Zx(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)-e*wn}})}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)-a*wn}})}return o}(a.floating,u,f,l,s)),{...t,textBox:n}})});return vw(t,g,Sw(g,ga(t)))}function qw(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 Ow(t){var e,a,n,r,o,i;return{...t,blocks:t.blocks.map(qw),header:null==(e=t.header)?void 0:e.map(qw),firstPageHeader:null==(a=t.firstPageHeader)?void 0:a.map(qw),evenPageHeader:null==(n=t.evenPageHeader)?void 0:n.map(qw),footer:null==(r=t.footer)?void 0:r.map(qw),firstPageFooter:null==(o=t.firstPageFooter)?void 0:o.map(qw),evenPageFooter:null==(i=t.evenPageFooter)?void 0:i.map(qw)}}function Pw(t){return{...t,blocks:t.blocks.map(qw)}}function Ww(t){var e,a;if(!t)return;const n={};for(const[r,o]of Object.entries(t.items))n[r]=Pw(o);return{items:n,settings:t.settings?{...t.settings}:void 0,separator:null==(e=t.separator)?void 0:e.map(qw),continuationSeparator:null==(a=t.continuationSeparator)?void 0:a.map(qw)}}function Hw(t){return{...t,blocks:t.blocks.map(qw)}}function Uw(t){var e,a;if(!t)return;const n={};for(const[r,o]of Object.entries(t.items))n[r]=Hw(o);return{items:n,settings:t.settings?{...t.settings}:void 0,separator:null==(e=t.separator)?void 0:e.map(qw),continuationSeparator:null==(a=t.continuationSeparator)?void 0:a.map(qw)}}function Fw(t){var e;return{...t,document:{...t.document,sections:null==(e=t.document.sections)?void 0:e.map(Ow),footnotes:Ww(t.document.footnotes),endnotes:Uw(t.document.endnotes)},selection:{anchor:{...t.selection.anchor},focus:{...t.selection.focus}},activeSectionIndex:t.activeSectionIndex??0,activeZone:t.activeZone??"main",activeFootnoteId:t.activeFootnoteId}}function Bw(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(Fe(r).some(t=>t.id===l))return t}const s=t=>{const e=t.findIndex(t=>t.id===l||"table"===t.type&&Fe(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=ia(t),c=la(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 Gw(t){const e=fa(t.selection)?t:xw(t),{paragraph:a,index:n,offset:r}=Mw(e),o=rw(a,hw(a,0,r),dw(a,r)),i=hw(a,r,Te(a)),l=i.length>0?iw(a,i.map(t=>({text:t.text,styles:t.styles}))):(()=>{const t=xa("");return t.style=a.style?{...a.style}:void 0,t.list=a.list?{...a.list}:void 0,t})(),s=da(e);return vw(e,[...jx(s.slice(0,n)),o,l,...jx(s.slice(n+1))],yw(Ce(l,0)))}function Zw(t){const e=fa(t.selection)?t:xw(t),{paragraph:a,index:n,offset:r}=Mw(e),o=rw(a,hw(a,0,r),dw(a,r)),i=hw(a,r,Te(a)),l=i.length>0?iw(a,i.map(t=>({text:t.text,styles:t.styles}))):(()=>{const t=xa("");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=da(e);return vw(e,[...jx(s.slice(0,n)),o,l,...jx(s.slice(n+1))],yw(Ce(l,0)))}function Kw(t,e,a){const n=ga(t),r=da(t),o=n.startIndex,i=n.endIndex,l=r.map((t,n)=>n<o||n>i?Kx(t):{...Kx(t),style:Bx(t.style,e,a)});return vw(t,l,Sw(l,n))}function Dw(t,e){return{document:t.document,selection:e}}function jw(t,e){if(!fa(t.selection))return Aw(t,e<0?"start":"end");const{index:a,offset:n}=Mw(t),r=da(t),o=a+e;if(o<0||o>=r.length)return t;const i=r[o];return Dw(t,yw(Ce(i,Math.min(n,Te(i)))))}function Xw(t,e){const a=ha(t,t.selection.focus),n=da(t),r=ca(n,a.paragraphId),o=n[r],i=ke(o,a),l=Te(o);if(e<0&&i>0)return Dw(t,{anchor:t.selection.anchor,focus:Ce(o,i-1)});if(e>0&&i<l)return Dw(t,{anchor:t.selection.anchor,focus:Ce(o,i+1)});if(e<0&&r>0){const e=n[r-1];return Dw(t,{anchor:t.selection.anchor,focus:Ce(e,Te(e))})}if(e>0&&r<n.length-1){const e=n[r+1];return Dw(t,{anchor:t.selection.anchor,focus:Ce(e,0)})}return t}function Jw(t,e){const a=ha(t,t.selection.focus),n=da(t),r=ca(n,a.paragraphId),o=ke(n[r],a),i=r+e;if(i<0||i>=n.length)return t;const l=n[i];return Dw(t,{anchor:t.selection.anchor,focus:Ce(l,Math.min(o,Te(l)))})}function Yw(t){const e=ga(t);if(e.isCollapsed)return"";const a=da(t);if(e.startIndex===e.endIndex){return Ie(a[e.startIndex]).slice(e.startParagraphOffset,e.endParagraphOffset)}const n=[],r=a[e.startIndex],o=a[e.endIndex];n.push(Ie(r).slice(e.startParagraphOffset));for(let i=e.startIndex+1;i<e.endIndex;i+=1)n.push(Ie(a[i]));return n.push(Ie(o).slice(0,e.endParagraphOffset)),n.join("\n")}function Qw(t,e){return{...t,selection:{anchor:ha(t,e.anchor),focus:ha(t,e.focus)}}}function _w(t){if(!fa(t.selection))return Aw(t,"start");const{paragraph:e,index:a,offset:n}=Mw(t),r=da(t);if(n>0)return{document:t.document,selection:yw(Ce(e,n-1))};if(0===a)return t;const o=r[a-1];return{document:t.document,selection:yw(Ce(o,Te(o)))}}function $w(t){if(!fa(t.selection))return Aw(t,"end");const{paragraph:e,index:a,offset:n}=Mw(t),r=da(t);if(n<Te(e))return{document:t.document,selection:yw(Ce(e,n+1))};if(a>=r.length-1)return t;const o=r[a+1];return{document:t.document,selection:yw(Ce(o,0))}}function tS(t){if("main"!==(t.activeZone??"main"))return t;const e=fa(t.selection)?t:xw(t),{paragraph:a,index:n,offset:r}=Mw(e),o=function(){const t=[Ta("",{styleId:"footnoteText"})];return{id:ma("footnote"),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 Kl(t)){const t=l.footnoteReference;t&&!t.customMark&&(i.has(t.footnoteId)||(i.add(t.footnoteId),o+=1))}return Yl(o+1,r)}(e.document),l=function(t,e){const a=Ma(e,{styleId:"footnoteReference",superscript:!0}),n={footnoteId:t};return a.footnoteReference=n,a}(o.id,i),s=pw(a,r,[l]),d=vw(e,da(e).map((t,e)=>e===n?s:t),ua(Ce(s,r+i.length))),c=function(t){return t||{items:{}}}(d.document.footnotes),h=_l({...d.document,footnotes:{...c,items:{...c.items,[o.id]:o}}}),p=o.blocks.flatMap(Fe).find(Boolean);return p?{...d,document:h,selection:ua(Ce(p,0)),activeZone:"footnote",activeFootnoteId:o.id}:{...d,document:h}}function eS(t,e){const a=da(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:rw(t,a)});return vw(t,a,Sw(a,ga(t)))}function aS(t,e){const a=da(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:rw(t,a)});return vw(t,a,Sw(a,ga(t)))}function nS(t){return t.map(Zx)}function rS(t){return t.reduce((t,e)=>t+e.text.length,0)}function oS(t,e,a){if(0===a.length)return t;const n=da(t),r=n.findIndex(t=>t.id===e.paragraphId);if(-1===r)return t;const o=n[r],i=ke(o,e),l=nS(a[0].runs);if(1===a.length){const e=pw(o,i,l),a=n.map((t,a)=>a===r?e:t),s=rS(l);return vw(t,a,{anchor:Ce(e,i),focus:Ce(e,i+s)})}const s=hw(o,0,i),d=hw(o,i,Te(o)),c=a[a.length-1],h=a.slice(1,-1),p=rw(Kx(a[0].paragraphTemplate),[...s,...l],dw(o,i)),u=h.map(t=>rw(Kx(t.paragraphTemplate),nS(t.runs))),f=rw(Kx(c.paragraphTemplate),[...nS(c.runs),...d],dw(o,i));return vw(t,[...n.slice(0,r),p,...u,f,...n.slice(r+1)],{anchor:Ce(p,rS(s)),focus:Ce(f,rS(c.runs))})}function iS(t,e,a={}){if(ga(t).isCollapsed)return t;if(function(t,e){const a=ga(t);if(a.isCollapsed)return!1;const n=da(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=ke(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=ga(t);if(e.isCollapsed)return[];const a=da(t),n=[];for(let r=e.startIndex;r<=e.endIndex;r+=1){const t=a[r],o=hw(t,r===e.startIndex?e.startParagraphOffset:0,r===e.endIndex?e.endParagraphOffset:Te(t));n.push({paragraphTemplate:Kx(t),runs:o})}return n}(t);if(0===n.length)return t;if(a.copy)return oS(t,e,n);const r=function(t,e){const a=ga(t),n=da(t),r=n.findIndex(t=>t.id===e.paragraphId);if(-1===r)return e;const o=ke(n[r],e);if(a.startIndex===a.endIndex)return r!==a.startIndex||o<=a.endParagraphOffset?e:Ce(n[a.startIndex],o-(a.endParagraphOffset-a.startParagraphOffset));return e}(t,e);return oS(xw(t),r,n)}function lS(t,e,a){if(0===e.length)return t;const n=fa(t.selection)?t:xw(t),{paragraph:r,index:o,offset:i}=Mw(n),l=a?{...a}:dw(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=pw(r,i,[s]);return vw(n,da(n).map((t,e)=>e===o?d:t),yw(Ce(d,i+e.length)))}function sS(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 lS(t,n,a);const r=fa(t.selection)?t:xw(t),{paragraph:o,index:i,offset:l}=Mw(r),s=n.split("\n"),d=dw(o,l),c=rw(o,[...hw(o,0,l),Ma(s[0],d)],d),h=hw(o,l,Te(o)),p=s.slice(1,-1).map(t=>ow([{text:t,styles:d}])),u=ow([{text:s[s.length-1],styles:d},...h.map(t=>({text:t.text,styles:t.styles}))]),f=da(r);return vw(r,[...f.slice(0,i),c,...p,u,...f.slice(i+1)],yw(Ce(u,s[s.length-1].length)))}function dS(t){var e;if(!fa(t.selection))return xw(t);const{paragraph:a,index:n,offset:r}=Mw(t),o=da(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=rw(a,[...hw(a,0,r-1),...hw(a,r,Te(a))]);return vw(t,o.map((t,a)=>a===n?e:t),yw(Ce(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=rw(a,[...hw(a,0,r-1),h,...hw(a,r,Te(a))]);return vw(t,o.map((t,e)=>e===n?p:t),yw(Ce(p,r-1)))}}const i=rw(a,[...hw(a,0,r-1),...hw(a,r,Te(a))],dw(a,r-1));return vw(t,o.map((t,e)=>e===n?i:t),yw(Ce(i,r-1)))}if(0===n)return t;const i=o[n-1],l=rw(i,[...i.runs.map(Zx),...a.runs.map(Zx)]);return vw(t,[...o.slice(0,n-1),l,...o.slice(n+1)],yw(Ce(l,Te(i))))}function cS(t){var e;if(!fa(t.selection))return xw(t);const{paragraph:a,index:n,offset:r}=Mw(t),o=da(t);if(r<Te(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=rw(a,[...hw(a,0,r),...hw(a,r+1,Te(a))]);return vw(t,o.map((t,a)=>a===n?e:t),yw(Ce(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=rw(a,[...hw(a,0,r),h,...hw(a,r+1,Te(a))]);return vw(t,o.map((t,e)=>e===n?p:t),yw(Ce(p,r)))}}const i=rw(a,[...hw(a,0,r),...hw(a,r+1,Te(a))],dw(a,r));return vw(t,o.map((t,e)=>e===n?i:t),yw(Ce(i,r)))}if(n>=o.length-1)return t;const i=o[n+1],l=rw(a,[...a.runs.map(Zx),...i.runs.map(Zx)]);return vw(t,[...o.slice(0,n),l,...o.slice(n+2)],yw(Ce(l,r)))}function hS(t,e){const a=ga(t);if(a.isCollapsed)return t;const n=da(t),r=n.slice(a.startIndex,a.endIndex+1).flatMap((t,e)=>{const n=a.startIndex+e;return hw(t,n===a.startIndex?a.startParagraphOffset:0,n===a.endIndex?a.endParagraphOffset:Te(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 ww(t,n===a.startIndex?a.startParagraphOffset:0,n===a.endIndex?a.endParagraphOffset:Te(t),t=>({...t,styles:Ux(t.styles,e,o)}))});return vw(t,i,Sw(i,a))}function pS(t,e,a){const n=ga(t);if(n.isCollapsed)return t;const r=da(t).map((t,r)=>{if(r<n.startIndex||r>n.endIndex)return t;return ww(t,r===n.startIndex?n.startParagraphOffset:0,r===n.endIndex?n.endParagraphOffset:Te(t),t=>({...t,styles:Fx(t.styles,e,a)}))});return vw(t,r,Sw(r,n))}function uS(t){return new RegExp("\\p{L}","u").test(t)}function fS(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=uS(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&&uS(n)?(e+=n.toUpperCase(),a=!1):(e+=n,"."!==n&&"!"!==n&&"?"!==n||(a=!0));return e}(t)}}function gS(t,e){return function(t,e){const a=ga(t);if(a.isCollapsed)return t;const n=da(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:Te(t),i=hw(t,r,o).map(t=>t.text).join(""),l=e(i);let s=0;return ww(t,r,o,t=>{const e=t.text.length,a=l.slice(s,s+e);return s+=e,{...t,text:a}})});return vw(t,n,Sw(n,a))}(t,t=>fS(t,e))}function mS(t){var e,a,n;const r=ga(t),o=da(t);if(r.isCollapsed){const t=o[r.startIndex];return t?(null==(e=cw(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 hw(t,a===r.startIndex?r.startParagraphOffset:0,a===r.endIndex?r.endParagraphOffset:Te(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 vS(t){const e=ga(t),a=da(t).map((t,a)=>{if(a<e.startIndex||a>e.endIndex)return Kx(t);if(!t.list)return Kx(t);const n=t.list.level??0;return n<=0?sw(t):lw(t,n-1)});return vw(t,a,Sw(a,e))}function bS(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=ga(e);return da(e).slice(t.startIndex,t.endIndex+1)})().some(t=>Boolean(t.list)),g=()=>{const t=e.selection.focus.paragraphId;return da(e).find(e=>e.id===t)??null},m=()=>{const t=e.selection,a=ia(e),n=Ye(e.document,t.anchor.paragraphId,a),r=Ye(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=>Kw(a,t,e)),s()},b=()=>"main"===(e.activeZone??"main"),y=t=>{const a=mS(e);p()&&!a||(d(),c(),r(e=>function(t,e){const a=ga(t);if(!a.isCollapsed)return pS(t,"link",e);const n=da(t)[a.startIndex];if(!n)return t;const r=cw(n,a.startParagraphOffset);if(!r)return t;const o=pS(Qw(t,{anchor:Ce(n,r.startOffset),focus:Ce(n,r.endOffset)}),"link",e),i=da(o)[a.startIndex];return i?{...o,selection:{anchor:Ce(i,r.startOffset),focus:Ce(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=>hS(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=>pS(e,t,n)),s()},applyChangeTextCaseCommand:t=>{p()||(d(),c(),o(e=>gS(e,t)),s())},applyClearFormattingCommand:()=>{p()||(d(),c(),o(t=>function(t){const e=ga(t);if(e.isCollapsed)return t;const a=da(t).map((t,a)=>a<e.startIndex||a>e.endIndex?t:ww(t,a===e.startIndex?e.startParagraphOffset:0,a===e.endIndex?e.endParagraphOffset:Te(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 vw(t,a,Sw(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=ga(t),n=da(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 Kx(t);const d=Kx(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 vw(t,s,Sw(s,a))}(e,t)),s()},handleListFormatChange:t=>{d(),c(),i(e=>function(t,e){const a=ga(t),n=da(t).map((t,n)=>n<a.startIndex||n>a.endIndex?Kx(t):t.list?{...Kx(t),list:{...t.list,format:e||void 0}}:Kx(t));return vw(t,n,Sw(n,a))}(e,t)),s()},handleListStartAtChange:t=>{d(),c(),i(e=>function(t,e){const a=ga(t),n=da(t).map((t,n)=>n<a.startIndex||n>a.endIndex?Kx(t):t.list?{...Kx(t),list:{...t.list,startAt:null!==e?e:void 0}}:Kx(t));return vw(t,n,Sw(n,a))}(e,t)),s()},applyInsertSectionBreakCommand:t=>{d(),c(),n(function(t,e){const a=fa(t.selection)?t:xw(t),{paragraph:n,offset:r}=Mw(a),o=Ue(a.document),i=ia(a);if("main"!==la(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=rw(n,hw(n,0,r),dw(n,r)),p=hw(n,r,Te(n)),u=p.length>0?iw(n,p.map(t=>({text:t.text,styles:t.styles}))):(()=>{const t=xa("");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?Xx(l.header):void 0,footer:l.footer?Xx(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:yw(Ce(u,0))}}(e,t)),s()},applyInsertPageBreakCommand:()=>{d(),c(),r(t=>l(t,t=>Zw(t))),s()},canInsertFootnoteCommand:b,applyInsertFootnoteCommand:()=>{b()&&(d(),c(),r(t=>tS(t)),s())},handleStyleChange:t=>{d(),c(),i(e=>function(t,e){return Kw(t,"styleId",e)}(e,t||null)),s()},applyUpdateSectionSettingsCommand:(t,a)=>{d(),c(),n(function(t,e,a){var n;const r=Ue(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=ga(t),n=da(t),r=new Set;for(let i=a.startIndex;i<=a.endIndex;i+=1){const t=n[i],o=hw(t,i===a.startIndex?a.startParagraphOffset:0,i===a.endIndex?a.endParagraphOffset:Te(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=eS(o,i);return o}(e)),s()},applyRejectRevisionsCommand:()=>{d(),c(),n(function(t){var e;const a=ga(t),n=da(t),r=new Set;for(let i=a.startIndex;i<=a.endIndex;i+=1){const t=n[i],o=hw(t,i===a.startIndex?a.startParagraphOffset:0,i===a.endIndex?a.endParagraphOffset:Te(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=aS(o,i);return o}(e)),s()},applyLinkCommand:y,promptForLink:()=>{const a=mS(e)??"";p()&&!a||t.openLinkDialog(a)},removeLinkCommand:()=>{y(null)},applyImageAltCommand:t=>{u()&&(d(),c(),r(e=>function(t,e){const a=Iw(t);if(!(null==a?void 0:a.run.image))return t;const n=da(t).map((t,n)=>n!==a.paragraphIndex?Kx(t):{...Kx(t),runs:t.runs.map(t=>t.id===a.run.id&&t.image?{...t,image:{...t.image,alt:e??void 0}}:Zx(t))});return vw(t,n,Sw(n,ga(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=>Vw(a,e,t.imageCaptionLabel()),{mergeKey:"imageCaption"}),s())},promptForImageCaption:()=>{u()&&t.openImageCaptionDialog(kw(e)??"")},handleListTab:t=>!Ye(e.document,e.selection.focus.paragraphId,ia(e))&&(!!f()&&(d(),c(),i(e=>"indent"===t?function(t){const e=ga(t),a=da(t).map((t,a)=>a<e.startIndex||a>e.endIndex?Kx(t):t.list?lw(t,(t.list.level??0)+1):Kx(t));return vw(t,a,Sw(a,e))}(e):vS(e)),s(),!0)),handleListEnter:()=>{const t=g();return!!(null==t?void 0:t.list)&&(d(),c(),p()&&0===Ie(t).length?i(t=>function(t){const e=ga(t),a=da(t).map((t,a)=>a<e.startIndex||a>e.endIndex?Kx(t):sw(t));return vw(t,a,Sw(a,e))}(t)):r(t=>l(t,t=>function(t){const e=fa(t.selection)?t:xw(t),{paragraph:a,index:n,offset:r}=Mw(e),o=rw(a,hw(a,0,r),dw(a,r)),i=hw(a,r,Te(a)),l=i.length>0?iw(a,i.map(t=>({text:t.text,styles:t.styles}))):(()=>{const t=xa("");return t.style=a.style?{...a.style}:void 0,t.list=Dx(a.list),t})(),s=da(e);return vw(e,[...jx(s.slice(0,n)),o,l,...jx(s.slice(n+1))],yw(Ce(l,0)))}(t)),{mergeKey:"splitListItem"}),s(),!0)},handleListBoundaryBackspace:t=>{const a=g();if(!(null==a?void 0:a.list)||!p())return!1;return 0===ke(a,e.selection.focus)&&(d(),c(),i(t=>vS(t)),t.currentTarget.value="",s(),!0)}}}function yS(t){return/[\p{L}\p{N}_]/u.test(t)}function MS(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||!yS(r))return{start:a,end:Math.min(t.length,a+1)};let o=n,i=n+1;for(;o>0&&yS(t[o-1]);)o-=1;for(;i<t.length&&yS(t[i]);)i+=1;return{start:o,end:i}}class xS{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 wS=[{id:"selectAll",command:"selectAll",key:"a",ctrlOrMeta:!0,execute:t=>{const e=t.state(),a=da(e);if(0===a.length)return!1;const n=a[0],r=a[a.length-1];return t.clearPreferredColumn(),t.applyState(Qw(e,{anchor:Ce(n,0),focus:Ce(r,Ie(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=>Zw(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=>lS(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=>Gw(t))),t.focusInput()),!0)}];function SS(t){const e=new xS;wS.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(),!fa(n.selection))return t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>dS(t))),a.currentTarget.value="",void t.focusInput();const e=da(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===ke(o,n.selection.focus))return t.applySelectionAwareParagraphCommand(t=>vS(t)),a.currentTarget.value="",void t.focusInput()}const i=n.selection.focus.offset,l=Ie(o),s=MS(l,i);return"Backspace"===a.key?0===i||s.start===i?t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>dS(t))):t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(Qw(e,{anchor:Ce(o,s.start),focus:Ce(o,i)}),t=>dS(t))):i>=l.length?t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>cS(t))):s.end>i?t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(Qw(e,{anchor:Ce(o,i),focus:Ce(o,s.end)}),t=>dS(t))):t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>cS(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=>dS(t))),a.currentTarget.value="",void t.focusInput());case"Delete":return a.preventDefault(),t.clearPreferredColumn(),t.resetTransactionGrouping(),t.applyTransactionalState(e=>t.applyTableAwareParagraphEdit(e,t=>cS(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(Xw(n,-1))):(t.clearPreferredColumn(),t.applyState(_w(n))),void t.focusInput();case"ArrowRight":return a.preventDefault(),t.resetTransactionGrouping(),a.shiftKey?(t.clearPreferredColumn(),t.applyState(function(t){return Xw(t,1)}(n))):(t.clearPreferredColumn(),t.applyState($w(n))),void t.focusInput();case"ArrowUp":return a.preventDefault(),t.resetTransactionGrouping(),void(a.shiftKey?t.moveVerticalSelection(-1,!0)||(t.applyState(function(t){return Jw(t,-1)}(n)),t.focusInput()):t.moveVerticalByBlock(-1)||(t.applyState(function(t){return jw(t,-1)}(n)),t.focusInput()));case"ArrowDown":return a.preventDefault(),t.resetTransactionGrouping(),void(a.shiftKey?t.moveVerticalSelection(1,!0)||(t.applyState(function(t){return Jw(t,1)}(n)),t.focusInput()):t.moveVerticalByBlock(1)||(t.applyState(function(t){return jw(t,1)}(n)),t.focusInput()));default:return}}},registry:e}}function AS(t,e){return t.paragraph.runs.map(t=>t.text).join("")[e]??""}function IS(t){return" "===t||"\t"===t||"\n"===t}function TS(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 CS(t,e){var a,n,r,o;const i=ga(e),l=[],s=t.surfaceRect,d=new Map(da(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=ia(e),u=Ye(e.document,e.selection.anchor.paragraphId,p),f=Ye(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=Ue(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=TS(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&&IS(AS(S,t));)t+=1;for(;r>t&&IS(AS(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?ke(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 kS(t,e){if(0===e.length)return t;const a={...t};for(const n of e)delete a[n];return a}function VS(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=Ps({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=CS(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(da(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=>kS(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=>kS(e,t))}S("content-change")}},onCleanupHook:()=>{M+=1}}}function ES(t={}){const e=t.dbName??"oasis-editor-db",a=t.storeName??"documents",n=t.key??"current-document";let r=null;async function o(){return r||(r=await function(t){return 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)}})}({name:e,version:1,onUpgrade:t=>{t.objectStoreNames.contains(a)||t.createObjectStore(a)}}),r)}return{async saveDocument(t){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)}})}(await o(),a,n,t)},loadDocument:async()=>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)}})}(await o(),a,n),async clearDocument(){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)}})}(await o(),a,n)},close(){r&&(r.close(),r=null)}}}function RS(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=je(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=Ie(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:Ce(t,a),focus:Ce(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(Qw(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=>lS(Qw(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=Qw(a,{anchor:t.anchor,focus:t.focus}),a=lS(a,n())}return a},{mergeKey:"findReplaceAll"}),p(!1),t.focusInput())},isOpen:h,setIsOpen:p}}function LS(t,e,a){const n={...t??{}};return null===a?delete n[e]:n[e]=a,Object.keys(n).length>0?n:void 0}function zS(t,e){const a=Ue(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 NS(t,e){return t.map(t=>"table"===t.type?e(t):t)}function qS(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:qS(t.blocks,e)}))}))})}function OS(t){const e=ia(t),a=Ye(t.document,t.selection.focus.paragraphId,e);return a?{activeSectionIndex:e,loc:a}:null}function PS(t,e){const a=OS(t);if(!a)return t;const{activeSectionIndex:n,loc:r}=a,o=la(t),i=(t,a)=>t.map((t,n)=>"table"===t.type&&n===r.blockIndex&&a===r.zone?e(t):t),l=Ue(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 WS(t){const e=new Set,a=ia(t),n=Ye(t.document,t.selection.anchor.paragraphId,a),r=Ye(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=Ue(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 HS(t,e,a){const n=WS(t);if(0===n.size)for(const i of function(t){const e=new Set,a=ga(t),n=da(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:LS(t.style,e,a)}),o=Ue(t.document).map(t=>({...t,blocks:bw(t.blocks,n,r),header:t.header?bw(t.header,n,r):void 0,footer:t.footer?bw(t.footer,n,r):void 0}));return{...t,document:{...t.document,sections:o}}}function US(t,e){let a=HS(t,"borderTop",e);return a=HS(a,"borderRight",e),a=HS(a,"borderBottom",e),a=HS(a,"borderLeft",e),a}function FS(t,e,a){const n=function(t){const e=ga(t),a=da(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=Fe(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:LS(s.style,e,a)}):l;var s});return zS(t,r)}function BS(t,e,a,n){const r=t=>t.id!==e?t:{...t,style:LS(t.style,a,n)};return zS(t,t=>qS(t,r))}function GS(t,e,a){const n=OS(t);if(!n)return t;return PS(t,t=>{const r=t.rows.map((t,r)=>r===n.loc.rowIndex?{...t,style:LS(t.style,e,a)}:t);return{...t,rows:r}})}function ZS(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)?t*Mn:null}if(!/^[+-]?\d+(\.\d+)?$/.test(e))return null;const a=Number.parseFloat(e);return Number.isFinite(a)?a:null}function KS(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=ZS(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 zS(t,t=>NS(t,o))}const DS=t=>t.cells.reduce((t,e)=>t+Math.max(1,e.colSpan??1),0),jS=t=>t.rows.reduce((t,e)=>Math.max(t,DS(e)),0),XS=(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},JS=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},YS=(t,e,a)=>{const n=Ue(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?Ce(i,0):null}}return null},QS=(t,e,a="main")=>{const n=ia(t),r=He(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 _S(t,e){return t.visualRowIndex!==e.visualRowIndex?t.visualRowIndex-e.visualRowIndex:t.visualColumnIndex!==e.visualColumnIndex?t.visualColumnIndex-e.visualColumnIndex:0}function $S(t,e){const a=t.selection,n=ia(t),r=Ye(t.document,a.anchor.paragraphId,n),o=Ye(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 tA(t){const e=(t,e)=>{const a=He(t.document),n=ia(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=$S(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=_S(s.anchorCell,s.focusCell)<=0?s.anchorLocation:s.focusLocation,f=_S(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:Ce(g,0),focus:Ce(v,Ie(v).length)}:null},resolveSelectedTableCells:e=>{const a=$S(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=$S(e,t);if(!a||a.anchorCell.visualRowIndex!==a.focusCell.visualRowIndex)return null;const n=_S(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=$S(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=Ye(e.document,e.selection.focus.paragraphId,ia(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=Ye(e.document,e.selection.focus.paragraphId,ia(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=Ye(e.document,e.selection.focus.paragraphId,ia(e));if(!a)return!1;const n=t.getTargetBlocks(e,a.zone)[a.blockIndex];return Boolean(n&&"table"===n.type)},canEditSelectedTableColumn:e=>{const a=Ye(e.document,e.selection.focus.paragraphId,ia(e));if(!a)return!1;const n=t.getTargetBlocks(e,a.zone)[a.blockIndex];return!(!n||"table"!==n.type)&&jS(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(qw),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=>qw(t)))};o.cells.splice(a.startCellIndex,i.length,l);const s=l.blocks[0];return s?{...QS(e,n,a.zone),selection:{anchor:Ce(s,0),focus:Ce(s,0)}}:e},a=e=>{const a=t.resolveVerticalTableCellRange(e);if(!a)return e;const n=t.getTargetBlocks(e,a.zone).map(qw),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=>qw(t)))};r.rows[a.startRowIndex].cells[a.cellIndex]=l;for(let t=a.startRowIndex+1;t<=a.endRowIndex;t+=1){const e=Sa([xa("")],i);e.blocks=[],e.vMerge="continue",r.rows[t].cells[a.cellIndex]=e}const s=l.blocks[0];return s?{...QS(e,n,a.zone),selection:{anchor:Ce(s,0),focus:Ce(s,0)}}:e},n=e=>{var a;const n=Ye(e.document,e.selection.focus.paragraphId,ia(e));if(!n)return e;const r=t.getTargetBlocks(e,n.zone).map(qw),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=Sa([xa("")],s);e.cells[n.cellIndex]=a}const d=i.blocks[0];return d?{...QS(e,r,n.zone),selection:{anchor:Ce(d,0),focus:Ce(d,0)}}:e},r=e=>{var a;const n=Ye(e.document,e.selection.focus.paragraphId,ia(e));if(!n)return e;const r=t.getTargetBlocks(e,n.zone).map(qw),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=>qw(t))},...Array.from({length:s-1},()=>Sa([xa("")]))];i.cells.splice(n.cellIndex,1,...d);const c=null==(a=d[0])?void 0:a.blocks[0];return c?{...QS(e,r,n.zone),selection:{anchor:Ce(c,0),focus:Ce(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=Ye(e.document,e.selection.focus.paragraphId,ia(e));if(!o)return e;const i=t.getTargetBlocks(e,o.zone).map(qw),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=Aa((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=Sa([xa("")],e.colSpan);return t.blocks=[],t.vMerge="continue",t}return Sa([xa("")],e.colSpan)})),l.rows.splice(d,0,c);const s=(null==a?void 0:a.visualColumnIndex)??o.cellIndex,h=XS(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])??JS(l);return p?{...QS(e,i,o.zone),selection:{anchor:Ce(p,0),focus:Ce(p,0)}}:QS(e,i,o.zone)}c=Aa(s.cells.map(t=>Sa([xa("")],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])??JS(l);return p?{...QS(e,i,o.zone),selection:{anchor:Ce(p,0),focus:Ce(p,0)}}:QS(e,i,o.zone)},deleteSelectedTableRow:e=>{const a=Ye(e.document,e.selection.focus.paragraphId,ia(e));if(!a)return e;const n=t.getTargetBlocks(e,a.zone).map(qw),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?XS(s,Math.min((null==l?void 0:l.visualColumnIndex)??a.cellIndex,Math.max(0,DS(s)-1))):null,c=(null==d?void 0:d.blocks[0])??JS(r);return c?{...QS(e,n,a.zone),selection:{anchor:Ce(c,0),focus:Ce(c,0)}}:QS(e,n,a.zone)},insertSelectedTableColumn:(e,a)=>{var n;const r=Ye(e.document,e.selection.focus.paragraphId,ia(e));if(!r)return e;const o=t.getTargetBlocks(e,r.zone).map(qw),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(Sa([xa("")])),r=!0),!r&&a<n&&n<a+e?(t.push({...o,colSpan:e+1}),r=!0):t.push(o),a+=e}r||t.push(Sa([xa("")])),e.cells=t}const l=i.rows[r.rowIndex],s=l?XS(l,n):null,d=(null==s?void 0:s.blocks[0])??JS(i);return d?{...QS(e,o,r.zone),selection:{anchor:Ce(d,0),focus:Ce(d,0)}}:QS(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,Sa([xa("")]));const s=i.rows[r.rowIndex],d=null==s?void 0:s.cells[l],c=(null==d?void 0:d.blocks[0])??JS(i);return c?{...QS(e,o,r.zone),selection:{anchor:Ce(c,0),focus:Ce(c,0)}}:QS(e,o,r.zone)},deleteSelectedTableColumn:e=>{var a;const n=Ye(e.document,e.selection.focus.paragraphId,ia(e));if(!n)return e;const r=t.getTargetBlocks(e,n.zone).map(qw),o=r[n.blockIndex];if(!o||"table"!==o.type)return e;if(jS(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&&XS(i,Math.min(a,Math.max(0,DS(i)-1))),s=(null==l?void 0:l.blocks[0])??JS(o);return s?{...QS(e,r,n.zone),selection:{anchor:Ce(s,0),focus:Ce(s,0)}}:QS(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])??JS(o);return s?{...QS(e,r,n.zone),selection:{anchor:Ce(s,0),focus:Ce(s,0)}}:QS(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:ka(p,void 0,void 0,void 0,void 0,r.document.assets),selection:{anchor:Ce(p[0],0),focus:Ce(p[p.length-1],Ie(p[p.length-1]).length)}},g=da(a(f)),m=t.getTargetBlocks(r,h),v=qw(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 QS(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:DS,getTableVisualWidth:jS,findCellAtVisualColumn:XS,findFirstNavigableParagraphInTable:JS,updateBlocksInCurrentSection:QS,resolveAdjacentTableCellPosition:YS,applyTableAwareParagraphEdit:(t,a)=>((t,e,a)=>{var n;const r=Ye(t.document,t.selection.focus.paragraphId,ia(t));if(!r||t.selection.anchor.paragraphId!==t.selection.focus.paragraphId)return a(t);const o=r.zone,i=e(t,o),l=qw(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:ka(d.blocks,void 0,void 0,void 0,void 0,t.document.assets),selection:{anchor:{...t.selection.anchor},focus:{...t.selection.focus}}}),h=je(c.document).filter(t=>"paragraph"===t.type);return d.blocks.splice(0,d.blocks.length,...h),{...QS(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({...Sa([xa("")]),style:{width:n}});r.push(Aa(t))}const o={...Ia(r),style:{width:"100%"}},i=ha(t,t.selection.focus),l=Ue(t.document),s=ia(t),d=la(t),c=t=>{const e=t.findIndex(t=>t.id===i.paragraphId||"paragraph"!==t.type&&Fe(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:yw(Ce(o.rows[0].cells[0].blocks[0],0))}}(t,e,a),{mergeKey:"insertTable"}),t.focusInput()}}}function eA(t,e,a,n=0){const r=ye(be(e));if(!a)return r;const o=dl(e,a,n);return null!==o&&Number.isFinite(o)&&o>0?Math.min(r,o):r}function aA(t,e){let a=null;const n=(t,e,a)=>{const n=da(t).find(t=>t.id===e);return n?{anchor:Ce(n,a),focus:Ce(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=dy(t.handleDirection,"x"),i=dy(t.handleDirection,"y"),l=0===o?t.startWidth:t.startWidth+e*o,s=0===i?t.startHeight:t.startHeight+a*i;let d=sy(l,ly,r),c=sy(s,ly);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=sy(t.startWidth*n,ly,r),c=sy(d/h,ly),{width:d,height:c}}return p?(d=sy(d,ly,r),c=sy(d/h,ly),{width:d,height:c}):(c=sy(c,ly),d=sy(c*h,ly,r),c=sy(d/h,ly),{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 nA(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=da(t).find(t=>t.id===e);return n?{anchor:Ce(n,a),focus:Ce(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=ga(t);if(e.isCollapsed||e.startIndex!==e.endIndex||e.endParagraphOffset-e.startParagraphOffset!==1)return null;const a=da(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:We(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=aA({label:"image",getSelected:t=>p(t),applyResize:(t,e,a)=>function(t,e,a){const n=Iw(t);if(!n)return t;const r=da(t),{paragraphIndex:o,run:i}=n,l=r.map((t,n)=>n!==o?Kx(t):{...Kx(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))}}:Zx(t))});return vw(t,l,Sw(l,ga(t)))}(t,e,a),getMaxWidth:(e,a)=>eA(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=nA({label:"image",applyRotate:(t,e)=>Tw(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=>Ew(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=je(t.state.document).find(t=>t.id===e);r&&t.applyState(Qw(t.state,{anchor:Ce(r,a),focus:Ce(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)}}}const oA="http://schemas.openxmlformats.org/wordprocessingml/2006/main",iA="http://schemas.openxmlformats.org/package/2006/relationships",lA="http://schemas.openxmlformats.org/officeDocument/2006/relationships",sA="http://schemas.microsoft.com/office/word/2010/wordml";function dA(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function cA(t,e){return Number.isFinite(t)?Math.max(0,Math.round(t/bn*Sn)):e}function hA(t){return null!=t&&Number.isFinite(t)?Math.round(t/bn*Sn):null}function pA(t){return null!=t&&Number.isFinite(t)?Math.max(0,Math.round(20*t)):null}function uA(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 fA(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="${dA(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 mA=`xmlns:w="${oA}" xmlns:w14="${sA}" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml"`;function vA(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="${dA(t.initials)}"`:"";return`<w:comment w:id="${e}" w:author="${dA(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">${dA(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 ${mA}>${e}</w:comments>`}function bA(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="${uA(t.color,e)}"/>`}function yA(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} ${bA(e)}`);return e.length>0?`<w:pBdr>${e.join("")}</w:pBdr>`:""}const MA="6F6F6F";function xA(t,e){return void 0===e?"":e?`<w:${t}/>`:`<w:${t} w:val="0"/>`}function wA(t,e,a={}){if("number"==typeof e&&Number.isFinite(e))return`<w:${t} w:w="${pA(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 SA(t){return bA(t??{width:.75,type:"solid",color:`#${MA}`},MA)}function AA(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=wA("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="${uA(t.style.shading,"FFFFFF")}"/>`);const g=xA("noWrap",null==(r=t.style)?void 0:r.noWrap);g&&u.push(g);const m=xA("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="${dA(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=pA(a??(null==e?void 0:e.paddingTop)??0),r=pA(a??(null==e?void 0:e.paddingBottom)??0);return`<w:tcMar><w:top w:w="${n??0}" w:type="dxa"/><w:left w:w="${pA(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="${pA(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="${pA(e.paddingStart)??0}" w:type="dxa"/>`:""}${void 0!==(null==e?void 0:e.paddingEnd)?`<w:end w:w="${pA(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 ${SA(null==(e=t.style)?void 0:e.borderTop)}`,`<w:left ${SA(null==(a=t.style)?void 0:a.borderLeft)}`,`<w:bottom ${SA(null==(n=t.style)?void 0:n.borderBottom)}`,`<w:right ${SA(null==(r=t.style)?void 0:r.borderRight)}`];return(null==(o=t.style)?void 0:o.borderStart)&&d.push(`<w:start ${SA(t.style.borderStart)}`),(null==(i=t.style)?void 0:i.borderEnd)&&d.push(`<w:end ${SA(t.style.borderEnd)}`),(null==(l=t.style)?void 0:l.borderTopLeftToBottomRight)&&d.push(`<w:tl2br ${SA(t.style.borderTopLeftToBottomRight)}`),(null==(s=t.style)?void 0:s.borderTopRightToBottomLeft)&&d.push(`<w:tr2bl ${SA(t.style.borderTopRightToBottomLeft)}`),`<w:tcBorders>${d.join("")}</w:tcBorders>`}(t));const v=xA("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 IA(t,e){if(void 0===e||!Number.isFinite(e))return"";const a=Math.floor(e);return a>0?`<w:${t} w:val="${a}"/>`:""}function TA(t,e){const a="number"==typeof t?pA(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 CA(t){var e,a,n,r,o,i,l,s,d;const c=[],h=IA("gridBefore",null==(e=t.style)?void 0:e.gridBefore);h&&c.push(h);const p=IA("gridAfter",null==(a=t.style)?void 0:a.gridAfter);p&&c.push(p);const u=wA("wBefore",null==(n=t.style)?void 0:n.widthBefore);u&&c.push(u);const f=wA("wAfter",null==(r=t.style)?void 0:r.widthAfter);f&&c.push(f);const g=wA("tblCellSpacing",null==(o=t.style)?void 0:o.cellSpacing);g&&c.push(g);const m=function(t){var e,a;return TA(null==(e=t.style)?void 0:e.height,null==(a=t.style)?void 0:a.heightRule)}(t);m&&c.push(m);const v=xA("cantSplit",null==(i=t.style)?void 0:i.cantSplit);v&&c.push(v),t.isHeader&&c.push("<w:tblHeader/>");const b=xA("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 kA(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="${dA(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="${dA(t.style.altTitle)}"/>`),(null==(r=t.style)?void 0:r.altDescription)&&m.push(`<w:tblDescription w:val="${dA(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}="${dA(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 wA("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=wA("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="${pA(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=wA("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=xA("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="${dA(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 VA(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>${AA(a,l)}${d}</w:tc>`}).join("");return`<w:tr>${a.tblPrExXml??""}${CA(a)}${o}</w:tr>`}).join(""),o=t.gridCols?`<w:tblGrid>${t.gridCols.map(t=>`<w:gridCol w:w="${pA(t)??0}"/>`).join("")}${t.tblGridChangeXml??""}</w:tblGrid>`:"";return`<w:tbl>${kA(t)}${o}${r}</w:tbl>`}function EA(t){if(!t||0===t.length)return"";const e=t.map(t=>{const e=pA(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 RA(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?cA(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=EA(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=yA(t);return n&&e.push(n),t.shading&&e.push(`<w:shd w:val="clear" w:color="auto" w:fill="${uA(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 LA(t,e,a,n){var r,o;const i=[],l=function(t,e){const a=Pe(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="${dA(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?cA(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=EA(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=yA(l);c&&i.push(c),l.shading&&i.push(`<w:shd w:val="clear" w:color="auto" w:fill="${uA(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 zA={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]},NA={ffff00:"yellow",fef08a:"yellow",ff0000:"red","00ff00":"green","0000ff":"blue","00ffff":"cyan",ff00ff:"magenta","000000":"black",ffffff:"white"};function qA(t){if(t in zA)return t;const e=t.trim().replace(/^#/,"").toLowerCase(),a=NA[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(zA)){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 OA(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="${dA(t.underlineColor.replace(/^#/,""))}"`:"";e.push(`<w:u w:val="${dA(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="${dA(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="${dA(t.fontFamily)}" w:hAnsi="${dA(t.fontFamily)}" w:cs="${dA(t.fontFamily)}"/>`),void 0!==t.fontSize&&null!==t.fontSize){const a=function(t){return null!=t&&Number.isFinite(t)?Math.round(t/bn*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="${dA(t.color.replace(/^#/,""))}"/>`),t.highlight&&e.push(`<w:highlight w:val="${dA(qA(t.highlight))}"/>`),t.shading&&e.push(`<w:shd w:val="clear" w:color="auto" w:fill="${uA(t.shading,"FFFFFF")}"/>`),t.language){const a=[];t.language.value&&a.push(`w:val="${dA(t.language.value)}"`),t.language.eastAsia&&a.push(`w:eastAsia="${dA(t.language.eastAsia)}"`),t.language.bidi&&a.push(`w:bidi="${dA(t.language.bidi)}"`),a.length>0&&e.push(`<w:lang ${a.join(" ")}/>`)}return e.length>0?`<w:rPr>${e.join("")}</w:rPr>`:""}function PA(t){if(0===t.length)return"";var e;return`<w:t${/^\s|\s$/.test(e=t)||e.includes(" ")?' xml:space="preserve"':""}>${dA(t)}</w:t>`}function WA(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+=PA(a),a="",e+="<w:softHyphen/>"):(e+=PA(a),a="",e+="<w:noBreakHyphen/>"):(e+=PA(a),a="",e+="<w:tab/>"):(e+=PA(a),a="",e+="<w:br/>");return e+=PA(a),e||"<w:t></w:t>"}function HA(t,e){return t??e?"1":"0"}function UA(t,e,a){const n=dA((null==e?void 0:e.relativeFrom)??a);if(null==e?void 0:e.align)return`<wp:${t} relativeFrom="${n}"><wp:align>${dA(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 FA(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 BA(t){const{cx:e,cy:a,floating:n,docPrId:r,docPrName:o,altAttr:i,graphicXml:l}=t,s=dA(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=UA("positionH",n.positionH,"column"),f=UA("positionV",n.positionV,"paragraph"),g=function(t,e){switch(t){case"square":return'<wp:wrapSquare wrapText="bothSides"/>';case"tight":{const t=FA(e);return t?`<wp:wrapTight wrapText="bothSides">${t}</wp:wrapTight>`:'<wp:wrapTight wrapText="bothSides"/>'}case"through":{const t=FA(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="${HA(n.simplePos,!1)}" relativeHeight="${n.relativeHeight??0}" behindDoc="${HA(n.behindDoc,!1)}" locked="${HA(n.locked,!1)}" layoutInCell="${HA(n.layoutInCell,!0)}" allowOverlap="${HA(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 GA(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="${dA(r.alt)}" title="${dA(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 BA({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="${lA}"/>${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 ZA(t,e,a,n,r,o){const i=Math.round(e.width*wn),l=Math.round(e.height*wn),s=a.textBoxDocPrIds.get(t.id)??1,d=e.name??"Text Box",c=void 0!==e.alt?` descr="${dA(e.alt)}" title="${dA(e.alt)}"`:"",h=function(t,e,a,n,r,o){const i=t.shape,l=dA((null==i?void 0:i.preset)??"rect"),s=t.rotation?Math.round(6e4*t.rotation):0,d=0!==s?` rot="${s}"`:"",c=(null==i?void 0:i.fill)?`<a:solidFill><a:srgbClr val="${dA(i.fill.replace(/^#/,""))}"/></a:solidFill>`:"";let h="";((null==i?void 0:i.borderColor)||void 0!==(null==i?void 0:i.borderWidthPt))&&(h=`<a:ln${void 0!==(null==i?void 0:i.borderWidthPt)?` w="${Math.round(12700*i.borderWidthPt)}"`:""}>${(null==i?void 0:i.borderColor)?`<a:solidFill><a:srgbClr val="${dA(i.borderColor.replace(/^#/,""))}"/></a:solidFill>`:""}<a:miter lim="800000"/></a:ln>`);const p=t.body,u=['rot="0"',`vert="${dA((null==p?void 0:p.vert)??"horz")}"`];u.push(`wrap="${dA((null==p?void 0:p.wrap)??"square")}"`),void 0!==(null==p?void 0:p.paddingLeft)&&u.push(`lIns="${Math.round(p.paddingLeft*wn)}"`),void 0!==(null==p?void 0:p.paddingTop)&&u.push(`tIns="${Math.round(p.paddingTop*wn)}"`),void 0!==(null==p?void 0:p.paddingRight)&&u.push(`rIns="${Math.round(p.paddingRight*wn)}"`),void 0!==(null==p?void 0:p.paddingBottom)&&u.push(`bIns="${Math.round(p.paddingBottom*wn)}"`),u.push(`anchor="${dA((null==p?void 0:p.anchor)??"t")}"`),u.push('anchorCtr="0"');const f=(null==p?void 0:p.autoFit)?"<a:spAutoFit/>":"",g=t.blocks.length>0,m=g?o(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>'+(g?'<wps:cNvSpPr txBox="1"><a:spLocks noChangeArrowheads="1"/></wps:cNvSpPr>':"<wps:cNvSpPr/>")+`<wps:spPr bwMode="auto"><a:xfrm${d}><a:off x="0" y="0"/><a:ext cx="${e}" cy="${a}"/></a:xfrm><a:prstGeom prst="${l}"><a:avLst/></a:prstGeom>`+c+h+"</wps:spPr>"+(g?`<wps:txbx><w:txbxContent>${m}</w:txbxContent></wps:txbx>`:"")+`<wps:bodyPr ${u.join(" ")}>${f}</wps:bodyPr></wps:wsp></a:graphicData></a:graphic>`}(e,i,l,a,n,o);return`<w:r>${r}${BA({cx:i,cy:l,floating:e.floating,docPrId:s,docPrName:d,altAttr:c,graphicXml:h})}</w:r>`}const KA={footnote:"FootnoteReference",endnote:"EndnoteReference"};function DA(t){return`<w:r><w:rPr><w:rStyle w:val="${KA[t]}"/><w:vertAlign w:val="superscript"/></w:rPr><w:${t}Ref/></w:r>`}function jA(t,e,a,n){if(!e)return null;const r="footnote"===t?n.footnoteIdMap:n.endnoteIdMap,o=null==r?void 0:r.get(e.noteId);if(void 0===o)return null;const i={...a??{},superscript:!0},l=e.customMark?' w:customMarkFollows="1"':"",s=e.customMark?`<w:t xml:space="preserve">${dA(e.customMark)}</w:t>`:"";return`<w:r>${OA(i)}<w:${t}Reference${l} w:id="${o}"/>${s}</w:r>`}function XA(t,e,a,n,r){if(t.__isFootnoteRefMarker)return DA("footnote");if(t.__isEndnoteRefMarker)return DA("endnote");const o=function(t,e,a){var n;const r=Oe(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){const n=t.footnoteReference;return jA("footnote",n?{noteId:n.footnoteId,customMark:n.customMark}:void 0,e,a)}(t,o,e);if(null!==a)return a}if(t.endnoteReference){const a=function(t,e,a){const n=t.endnoteReference;return jA("endnote",n?{noteId:n.endnoteId,customMark:n.customMark}:void 0,e,a)}(t,o,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,OA(o));if(void 0!==t.fieldInstruction)return i=t.fieldInstruction,`<w:r>${OA(o)}<w:instrText xml:space="preserve">${dA(i)}</w:instrText></w:r>`;var i;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,OA(o));if(t.textBox)return ZA(t,t.textBox,e,n,OA(o),r);if(t.image){const a=e.imageMap.get(t.id);if(a){const n=GA(t.id,a,e,OA(o));if(null!==n)return n}}if(t.sym){const{font:e,char:a}=t.sym;return`<w:r>${OA(o)}<w:sym w:font="${dA(e)}" w:char="${a}"/></w:r>`}return`<w:r>${OA(o)}${WA(t.text)}</w:r>`}function JA(t,e,a,n,r){var o;const i=XA(t,e,a,n,r),l=null==(o=t.styles)?void 0:o.link;return l?function(t,e,a){if(e.startsWith("#"))return`<w:hyperlink w:anchor="${dA(e.slice(1))}">${t}</w:hyperlink>`;const n=a.hyperlinkMap.get(e);return n?`<w:hyperlink r:id="${n}">${t}</w:hyperlink>`:t}(i,l,e):i}function YA(t){return!(t.image||t.textBox||t.field||t.fieldChar||void 0!==t.fieldInstruction||t.footnoteReference||t.endnoteReference)}function QA(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>':"")+VA(t,(t,n)=>{var r;return _A(t,e,a,{align:null==(r=n.style)?void 0:r.horizontalAlign})})}return _A(t,e,a)}).join("")}function _A(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=OA(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}${WA(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:fA(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),YA(c)&&c.text.length>0){let l=t;for(;i<o.length&&o[i].offset<e;){const e=o[i];e.offset>l&&(s+=JA({...c,text:c.text.slice(l-t,e.offset-t)},a,n,r,QA)),s+=e.xml,i+=1,l=e.offset}l<e&&(s+=JA({...c,text:c.text.slice(l-t)},a,n,r,QA))}else s+=JA(c,a,n,r,QA);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 JA(n,e,null==(r=t.style)?void 0:r.styleId,a,QA)}).join("");return`${s}<w:p>${LA(t,e.numberingInfo,a,n)}${p}</w:p>`}function $A(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 eI(t){if(0===t.length)return[aI()];const[e,...a]=t;return"paragraph"!==e.type?[aI(!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 aI(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 nI=["wholeTable","band1Horz","band2Horz","band1Vert","band2Vert","firstCol","lastCol","firstRow","lastRow","nwCell","neCell","swCell","seCell"];function rI(t,e){const a=[],n=e.paragraphStyle?RA(e.paragraphStyle):"";n&&a.push(n);const r=e.textStyle?OA(e.textStyle):"";r&&a.push(r);const o=e.rowStyle?function(t){var e;if(!t)return"";const a=[],n=IA("gridBefore",t.gridBefore);n&&a.push(n);const r=IA("gridAfter",t.gridAfter);r&&a.push(r);const o=wA("wBefore",t.widthBefore);o&&a.push(o);const i=wA("wAfter",t.widthAfter);i&&a.push(i);const l=wA("tblCellSpacing",t.cellSpacing);l&&a.push(l);const s=TA(t.height,t.heightRule);s&&a.push(s);const d=xA("cantSplit",t.cantSplit);d&&a.push(d);const c=xA("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} ${bA(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="${uA(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="${dA(t)}">${a.join("")}</w:tblStylePr>`}function oI(t){const e=[];if(e.push(`<w:name w:val="${dA(t.name)}"/>`),t.basedOn&&e.push(`<w:basedOn w:val="${dA(t.basedOn)}"/>`),t.nextStyle&&e.push(`<w:next w:val="${dA(t.nextStyle)}"/>`),("paragraph"===t.type||"table"===t.type)&&t.paragraphStyle){const a=RA(t.paragraphStyle);a&&e.push(a)}if(t.textStyle){const a=OA(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?pA(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=[...nI.filter(t=>t in a.conditionalFormats),...Object.keys(a.conditionalFormats).filter(t=>!nI.includes(t))];for(const n of t){const t=a.conditionalFormats[n];if(t){const a=rI(n,t);a&&e.push(a)}}}}return`<w:style w:type="${"character"===t.type?"character":"table"===t.type?"table":"paragraph"}" w:styleId="${dA(t.id)}">${e.join("")}</w:style>`}function iI(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=Bv[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 lI={decimal:"decimal",lowerRoman:"lowerRoman",upperRoman:"upperRoman",lowerLetter:"lowerLetter",upperLetter:"upperLetter",symbol:"symbol"},sI={continuous:"continuous",eachSection:"eachSect"};function dI(t,e){if(!e)return null;const a=[];return e.numberFormat&&a.push(`<w:numFmt w:val="${lI[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="${sI[e.restart]}"/>`),a.length>0?`<w:${t}>${a.join("")}</w:${t}>`:null}function cI(t,e){let a="";for(const n of e)a+=`<Relationship Id="${n.rId}" Type="${lA}/hyperlink" Target="${dA(n.href)}" TargetMode="External"/>`;for(const n of t){const t="linked"===n.kind?' TargetMode="External"':"";a+=`<Relationship Id="${n.rId}" Type="${lA}/image" Target="${dA(n.target)}"${t}/>`}return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${iA}">${a}</Relationships>`}function hI(t,e){e(t);for(const a of t.runs)a.textBox&&pI(a.textBox.blocks,e)}function pI(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)hI(t,e);else hI(a,e)}const uI=`xmlns:w="${oA}" xmlns:w14="${sA}" 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="${lA}"`;function fI(t,e,a){const n=Ue(t).map((n,r)=>QA(n.blocks,e,t.styles)+function(t,e){var a,n,r,o,i,l,s,d,c;const h=cA(t.width,12240),p=cA(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=cA(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="${cA(t.width,0)}" w:space="${cA(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="${cA(u.top,1440)}" w:right="${cA(u.right,1440)}" w:bottom="${cA(u.bottom,1440)}" w:left="${cA(u.left,1440)}" w:header="${cA(u.header,720)}" w:footer="${cA(u.footer,720)}" w:gutter="${cA(u.gutter,0)}"/>${b}</w:sectPr>`}(n.pageSettings,a[r])).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document ${uI}><w:body>${n}</w:body></w:document>`}function gI(t,e,a,n){const r="header"===t?"hdr":"ftr";return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:${r} ${uI}>${QA(e,a,n)}</w:${r}>`}function mI(t,e,a,n){const r=[],o=new Map,i=new Map,l=[],s=new Map;return pI(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(d.image.width*wn),cy:Math.round(d.image.height*wn),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=We(n,d.image.src).match(/^data:([^;,]+);base64,(.*)$/);if(!u)continue;const f=Zv(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}}async function vI(t){var e,a,n,r,o,i;t=ew(t);const l=new Up,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.instanceId?`instance:${t.list.instanceId}`:`legacy:${t.list.kind}:${i}:${l}`;let d=a.get(s);d||(d={abstractNumId:r++,numId:o++,levels:[]},a.set(s,d),n.push(d)),d.levels.some(t=>t.level===i)||d.levels.push({kind:t.list.kind,level:i,format:t.list.format,startAt:t.list.startAt,levelText:t.list.levelText,suffix:t.list.suffix,alignment:t.list.alignment,legal:t.list.legal,bulletGlyph:t.list.bulletGlyph,bulletFont:t.list.bulletFont}),e.set(t.id,{numId:d.numId,level:i})};for(const l of Ue(t))pI(l.blocks,i),l.header&&pI(l.header,i),l.firstPageHeader&&pI(l.firstPageHeader,i),l.evenPageHeader&&pI(l.evenPageHeader,i),l.footer&&pI(l.footer,i),l.firstPageFooter&&pI(l.firstPageFooter,i),l.evenPageFooter&&pI(l.evenPageFooter,i);return{numberingInfo:e,definitions:n}}(t),d={nextImageId:1,nextTextBoxDocPrId:1000001},c=Ue(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 Kl(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 ts(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=mI(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=mI(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=>$A(t.footnote.blocks)));l.footnoteIdMap=i;const s=e.map(t=>{const e=$A(t.footnote.blocks).map(t=>"paragraph"===t.type?_A(t,l,o):VA(t,(t,e)=>{var a;return _A(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="${oA}" xmlns:w14="${sA}" 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="${lA}"><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=>mI(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=>eI(t.endnote.blocks)));l.endnoteIdMap=i;const s=e.map(t=>{const e=eI(t.endnote.blocks).map(t=>"paragraph"===t.type?_A(t,l,o):VA(t,(t,e)=>{var a;return _A(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="${oA}" xmlns:w14="${sA}" 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="${lA}"><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=>mI(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",iI(I,R,C,x,u,m,L,M)),l.file("_rels/.rels",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${iA}"><Relationship Id="rId1" Type="${lA}/officeDocument" Target="word/document.xml"/></Relationships>`),l.file("word/document.xml",fI(t,v,w)),L&&l.file("word/styles.xml",function(t){const e=Object.values(t).map(oI).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="${sA}">${e}</w:styles>`}(t.styles)),I&&l.file("word/numbering.xml",function(t){const e=t.map(({abstractNumId:t,levels:e})=>`<w:abstractNum w:abstractNumId="${t}">${e.sort((t,e)=>t.level-e.level).map(({kind:t,level:e,format:a,startAt:n,levelText:r,suffix:o,alignment:i,legal:l,bulletGlyph:s,bulletFont:d})=>{const c="bullet"===t?"bullet":a??"decimal",h=r??("bullet"===t?s??"":`%${e+1}.`),p=n??1,u="bullet"===t?d??"Symbol":void 0,f=u?`<w:rPr><w:rFonts w:ascii="${dA(u)}" w:hAnsi="${dA(u)}" w:hint="default"/></w:rPr>`:"",g=o&&"tab"!==o?`<w:suff w:val="${o}"/>`:"",m=l?"<w:isLgl/>":"";return`<w:lvl w:ilvl="${e}"><w:start w:val="${p}"/><w:numFmt w:val="${c}"/><w:lvlText w:val="${dA(h)}"/><w:lvlJc w:val="${i??"left"}"/>${g}${m}${f}</w:lvl>`}).join("")}</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="${oA}">${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="${lA}/styles" Target="styles.xml"/>`),t&&(d+=`<Relationship Id="rIdNum" Type="${lA}/numbering" Target="numbering.xml"/>`),e&&(d+=`<Relationship Id="rIdSettings" Type="${lA}/settings" Target="settings.xml"/>`);for(const c of n)d+=`<Relationship Id="${c.rId}" Type="${lA}/hyperlink" Target="${dA(c.href)}" TargetMode="External"/>`;for(const c of a){const t="linked"===c.kind?' TargetMode="External"':"";d+=`<Relationship Id="${c.rId}" Type="${lA}/image" Target="${dA(c.target)}"${t}/>`}for(const c of r){const t="header"===c.kind?"header":"footer";d+=`<Relationship Id="${c.relId}" Type="${lA}/${t}" Target="${c.path}"/>`}return o&&(d+=`<Relationship Id="rIdFootnotes" Type="${lA}/footnotes" Target="footnotes.xml"/>`),i&&(d+=`<Relationship Id="rIdEndnotes" Type="${lA}/endnotes" Target="endnotes.xml"/>`),s&&(d+=`<Relationship Id="rIdComments" Type="${lA}/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="${iA}">${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=pA(e);null!==o&&r.push(`<w:defaultTabStop w:val="${o}"/>`);const i=dI("footnotePr",a);i&&r.push(i);const l=dI("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="${oA}">${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}`,gI(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`,cI(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",cI(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",cI(E.partContext.images,E.partContext.hyperlinks))),y&&(l.file("word/comments.xml",vA(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 ${mA}>${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 bI(t){switch(t){case"dashed":return[MM(5),MM(3)];case"dotted":return[MM(1),MM(3)];default:return}}async function yI(t,e,a,n,r,o,i,l){const s=e.rotation;s&&(t.saveGraphicsState(a.pageIndex),t.rotateAbout(a.pageIndex,MM(n+o/2),MM(r+i/2),s)),function(t,e,a,n,r,o,i){var l,s,d,c;const h=oh(null==(l=a.shape)?void 0:l.preset,MM(n),MM(r),MM(o),MM(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,l){var s;if(0===e.blocks.length)return;const d=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),c=n+d.left,h=r+d.top,p=Math.max(1,o-d.left-d.right),u=Math.max(1,i-d.top-d.bottom),f=(null==(s=Nl({blocks:e.blocks,pageSettings:{width:p,height:u,orientation:"portrait",margins:{top:0,right:0,bottom:0,left:0,header:0,footer:0,gutter:0}},maxPageHeight:u,styles:a.document.styles,pageOffset:a.pageIndex})[0])?void 0:s.blocks)??[];if(0===f.length)return;const g=ra(a.document);t.saveGraphicsState(a.pageIndex),t.clipRect(a.pageIndex,MM(c),MM(h),MM(p),MM(u));let m=h;for(const v of f)"paragraph"===v.sourceBlock.type&&v.layout?await l.drawParagraph(t,a.pageIndex,v.sourceBlock,v.layout.lines,a.document,c,m,a.fontRegistry,g,l):"table"===v.sourceBlock.type&&await l.drawTableBlock(t,a.pageIndex,v,a.document,c,m,p,a.fontRegistry,g,l),m+=Math.max(0,v.estimatedHeight);t.restoreGraphicsState(a.pageIndex)}(t,e,a,n,r,o,i,l),s&&t.restoreGraphicsState(a.pageIndex)}async function MI(t){const{writer:e,document:a,fontRegistry:n,pageIndex:r,lines:o,pageSettings:i,contentLeft:l,contentTop:s,contentWidth:d,paragraphTop:c,drawers:h}=t;for(const p of o){const t=new Map(p.slots.map(t=>[t.offset,t]));for(const o of p.fragments){const u=o.textBox;if(!(null==u?void 0:u.floating))continue;const f=t.get(o.startOffset),g=l+((null==f?void 0:f.left)??0),m=c+p.top,v=Ui({object:Oi(u),pageSettings:i,contentLeft:l,contentTop:s,contentWidth:d,paragraphTop:c,lineTop:m,anchorLeft:g});await yI(e,u,{document:a,fontRegistry:n,pageIndex:r},v.x,v.y,v.width,v.height,h)}}}const xI=new WeakMap;function wI(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 SI(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=wI(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?wI(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 AI(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 II(t,e,a){const n=AI(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 TI(t,e,a,n,r,o,i,l){const s=II(a,n,i.fontSize??yM);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:MM(c),y1:MM(d-a),x2:MM(h),y2:MM(d-a),stroke:p,lineWidth:MM(1)}),void t.drawLine(e,{x1:MM(c),y1:MM(d+a),x2:MM(h),y2:MM(d+a),stroke:p,lineWidth:MM(1)})}!function(t,e,a,n,r,o,i){const l=hh(i),s=(r,i)=>{t.drawLine(e,{x1:MM(a),y1:MM(r),x2:MM(n),y2:MM(r),stroke:o,lineWidth:MM(l),dashArray:i})};if(dh(i))return s(r-1.5),void s(r+1.5);if(ch(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:MM(d),y1:MM(c),x2:MM(h),y2:MM(n),stroke:o,lineWidth:MM(i)}),d=h,c=n}}(t,e,a,n,r,o,l);s(r,ph(i))}(t,e,c,h,d,p,i.underlineStyle)}else t.drawLine(e,{x1:MM(c),y1:MM(d),x2:MM(h),y2:MM(d),stroke:p,lineWidth:MM(1)})}function CI(t,e,a,n){var r;const o=Pe(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*yn})).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 kI(t,e,a,n,r,o,i,l,s,d){var c;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=We(e,a.src);if(!n)return null;let r=xI.get(t);r||(r=new Map,xI.set(t,r));const o=r.get(n);if(o)return o;const i=SI(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:MM(i+a.left),y:MM(l+n.top+n.height-r.image.height),width:MM(r.image.width),height:MM(r.image.height),rotation:r.image.rotation})}if(r.textBox)return void(await async function(t,e,a,n,r,o,i,l,s){const d=n.textBox;if(!d||d.floating)return;const c=a.slots.find(t=>t.offset===n.startOffset)??a.slots.find(t=>t.offset>=n.startOffset);c&&await yI(t,d,{document:r,fontRegistry:l,pageIndex:e},o+c.left,i+a.top+a.height-d.height,d.width,d.height,s)}(t,e,n,r,o,i,l,s,d));const h=Oe(r.styles,null==(c=a.style)?void 0:c.styleId,o.styles);if(h.hidden)return;const p=s.resolveFontFace({fontFamily:h.fontFamily,bold:h.bold,italic:h.italic}),u=h.smallCaps?.8*xM(h):xM(h),f=(h.baselineShift??0)*yn,g=l+n.top+.8*n.height-f,m=AI(n,r),v=m.map(t=>h.allCaps?t.char.toUpperCase():t.char).join("");if(!m[0]||0===v.length)return;!function(t,e,a,n,r,o,i){if(!i.shading)return;const l=II(a,n,i.fontSize??yM);l&&t.drawRect(e,{x:MM(r+l.left),y:MM(o+a.top+2),width:MM(Math.max(0,l.right-l.left)),height:MM(Math.max(2,a.height-4)),fill:i.shading})}(t,e,n,r,i,l,h),function(t,e,a,n,r,o,i){if(!i.highlight)return;const l=II(a,n,i.fontSize??yM);l&&t.drawRect(e,{x:MM(r+l.left),y:MM(o+a.top+2),width:MM(Math.max(0,l.right-l.left)),height:MM(Math.max(2,a.height-4)),fill:i.highlight})}(t,e,n,r,i,l,h),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=CI(a,n,r.left,o);if(!p)continue;const u="underscore"===p?l+2:l;t.drawLine(e,{x1:MM(i+r.left),y1:MM(u),x2:MM(i+h.left),y2:MM(u),stroke:s,lineWidth:MM("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,g,h.color??"#000000");if("justify"===(Pe(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}(m);for(const n of a){const a=n.map(t=>h.allCaps?t.char.toUpperCase():t.char).join("");0!==a.length&&t.drawText(e,{x:MM(i+n[0].left),y:MM(g),text:a,fontSize:u,color:h.color??"#000000",bold:h.bold,italic:h.italic,fontResourceName:p.writerResourceName,characterSpacing:h.characterSpacing??0,horizontalScale:h.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}(m);for(const n of a){const a=n.map(t=>h.allCaps?t.char.toUpperCase():t.char).join("");0!==a.length&&t.drawText(e,{x:MM(i+n[0].left),y:MM(g),text:a,fontSize:u,color:h.color??"#000000",bold:h.bold,italic:h.italic,fontResourceName:p.writerResourceName,characterSpacing:h.characterSpacing??0,horizontalScale:h.characterScale??100})}}h.underline&&TI(t,e,n,r,i,l,h,"underline"),h.strike&&TI(t,e,n,r,i,l,h,"strike"),h.doubleStrike&&TI(t,e,n,r,i,l,h,"doubleStrike")}function VI(t,e,a,n,r,o,i,l,s){var d;if(0!==n.index)return;const c=oa(a,s);if(!c)return;const h=n.slots[0];if(!h)return;const p=Oe(void 0,null==(d=a.style)?void 0:d.styleId,r.styles),u=l.resolveFontFace({fontFamily:p.fontFamily,bold:p.bold,italic:p.italic}),f=ni(a,r.styles),g=xM(p),m=c.length*g*.62*yn,v=ri(a,r.styles,h.left,m);t.drawText(e,{x:MM(o+Math.max(0,v||f)),y:MM(i+n.top+.8*n.height),text:c,fontSize:g,color:p.color??"#000000",bold:p.bold,italic:p.italic,fontResourceName:u.writerResourceName})}function EI(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=In(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:MM(p),y:MM(o),width:MM(Math.max(0,u-p)),height:MM(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:MM(a),y1:MM(n),x2:MM(r),y2:MM(i),stroke:g.color,lineWidth:g.width,dashArray:bI(g.type)})}}async function RI(t,e,a,n,r,o,i,l,s,d){for(const c of n){VI(t,e,a,c,r,o,i,l,s);for(const n of c.fragments)await kI(t,e,a,c,n,r,o,i,l,d)}}function LI(t,e,a,n,r,o,i){"none"===a.type||a.width<=0||t.drawLine(e,{x1:MM(n),y1:MM(r),x2:MM(o),y2:MM(i),stroke:a.color,lineWidth:MM(a.width),dashArray:bI(a.type)})}function zI(t,e,a,n,r){const o=n+a.left,i=r+a.top,l=o+a.width,s=i+a.height;LI(t,e,a.borders.top,o,i,l,i),LI(t,e,a.borders.right,l,i,l,s),LI(t,e,a.borders.bottom,o,s,l,s),LI(t,e,a.borders.left,o,i,o,s)}async function NI(t,e,a,n,r,o,i,l,s,d){if("table"!==a.sourceBlock.type)return;const c=a.sourceBlock,h=a.tableSegment?ln(c,a.tableSegment):c;if(0===h.rows.length)return;const p=Cs({table:h,state:{document:n},pageIndex:0,originX:0,originY:0,contentWidth:i,estimatedHeight:a.estimatedHeight});for(const u of p.cells)u.shading&&t.drawRect(e,{x:MM(r+u.left),y:MM(o+u.top),width:MM(u.width),height:MM(u.height),fill:u.shading});for(const u of p.cells)zI(t,e,u,r,o);for(const u of p.cells)for(const a of u.paragraphs)await RI(t,e,a.paragraph,a.lines,n,r+a.originX,o+a.originY,l,s,d)}const qI={drawParagraph:RI,drawTableBlock:NI};async function OI(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=Pe(p.sourceBlock.style,n.styles),u=h+(0===p.layout.startOffset&&h>o?a.spacingBefore??0:0),f=u+In(a).top;EI(t,e,a,p.layout.lines,r,u,i),await RI(t,e,p.sourceBlock,p.layout.lines,n,r,f,l,s,qI),d&&await MI({writer:t,document:n,fontRegistry:l,pageIndex:e,lines:p.layout.lines,pageSettings:d,contentLeft:r,contentTop:c,contentWidth:i,paragraphTop:u,drawers:qI})}else"table"===p.sourceBlock.type&&await NI(t,e,p,n,r,h,i,l,s,qI);h+=Math.max(0,p.estimatedHeight)}}function PI(t,e,a,n){t.drawRect(e,{x:0,y:0,width:a,height:n,fill:"#ffffff"})}const WI=[{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 HI(t,e,a){return`${t.toLowerCase()}:${e?"bold":"regular"}${a?"italic":""}`}function UI(t){return t.replace(/[^A-Za-z0-9_]/g,"")}class FI{constructor(){a(this,"faces",new Map),a(this,"fallbackFamily","Helvetica");for(const t of WI)this.registerFontFace(t)}registerFontFace(t){this.faces.set(HI(t.family,t.bold,t.italic),t)}resolveFontFace(t){const e=ao(t.fontFamily),a=Boolean(t.bold),n=Boolean(t.italic);return this.faces.get(HI(e,a,n))??this.faces.get(HI(this.fallbackFamily,a,n))??this.faces.get(HI(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(ao).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(to)){const t=await ho(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 eo){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 ho(e);if(!n)continue;const o="bold"===t||"bolditalic"===t,i="italic"===t||"bolditalic"===t,l=`${UI(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 BI{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 GI(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function ZI(t,e){return GI(t).getUint16(e)}function KI(t,e,a){GI(t).setUint16(e,a,!1)}function DI(t,e,a){GI(t).setUint32(e,a,!1)}function jI(t){return t+3&-4}function XI(t){const e=t.reduce((t,e)=>t+jI(e.byteLength),0),a=new Uint8Array(e);let n=0;for(const r of t)a.set(r,n),n+=jI(r.byteLength);return a}function JI(t,e){const a=[],n=GI(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 YI(t,e){const a=t[e],n=t[e+1];return void 0===a||void 0===n?null:{start:a,end:n}}function QI(t,e){if(t.byteLength<10||function(t,e){return GI(t).getInt16(e)}(t,0)>=0)return;let a=10,n=0;do{if(a+4>t.byteLength)return;n=ZI(t,a),e(ZI(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 _I(t){const e=new Uint8Array(4*t.length);return t.forEach((t,a)=>DI(e,4*a,t)),e}function $I(t,e){const a=new Uint8Array(4*(e+1));for(let n=0;n<=e;n+=1)KI(a,4*n,t.advanceWidthForGlyph(n)),KI(a,4*n+2,0);return a}class tT{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=JI(n,ZI(r,50)),i=new Set([0,...e]),l=Array.from(i);for(;l.length>0;){const t=YI(o,l.pop());!t||t.end<=t.start||t.end>a.byteLength||QI(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=JI(n,ZI(r,50)),h=[],p=[];let u=0;for(let b=0;b<=s;b+=1){h.push(u);const t=YI(c,b);if(d.has(b)&&t&&t.end>t.start){const e=a.slice(t.start,t.end);p.push(e),u+=jI(e.byteLength)}}h.push(u);const f=r.slice();DI(f,8,0),KI(f,50,1);const g=o.slice();KI(g,34,s+1);const m=i.slice();KI(m,4,s+1);const v={cmap:l,head:f,hhea:g,hmtx:$I(t,s),loca:_I(h),maxp:m,glyf:XI(p)};for(const b of["OS/2","name","post"]){const e=t.getRawTableData(b);e&&(v[b]=e)}return v}(t,r),i=Rr(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 eT=[{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 aT(t){return Number.isFinite(t)?Number(t.toFixed(3)).toString():"0"}function nT(t){return(new TextEncoder).encode(t).byteLength}function rT(t){return Array.from(t).map(t=>t.toString(16).padStart(2,"0").toUpperCase()).join("")}function oT(t){return Math.max(0,t).toString(16).padStart(4,"0").slice(-4).toUpperCase()}function iT(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`${aT(n)} ${aT(r)} ${aT(o)} ${e}`}function lT(t,e){return(t&&t.trim().length>0?t:e).replaceAll(" ","_").replace(/[^A-Za-z0-9_.+-]/g,"")}const sT=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 dT(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:sT.get(e)??63}(t).toString(16).padStart(2,"0").toUpperCase()).join("")}function cT(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(oT).join("")}function hT(t){return oT(t)}function pT(t){return`% OasisText ${cT(Array.from(t).map(t=>t.codePointAt(0)??65533))}`}class uT{constructor(t=eT){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=$r.decodeSync(t);return Ao.parse(e)}(t.fontData),layouter:new BI(e),subsetter:new tT},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(iT(e.fill,"rg",[1,1,1])),e.stroke&&(n.push(iT(e.stroke,"RG",[0,0,0])),n.push(`${aT(e.lineWidth??1)} w`)),n.push([aT(e.x),aT(a.height-e.y-e.height),aT(e.width),aT(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=>aT(t)).join(" ")}] 0 d`:null,r=["q",iT(e.stroke,"RG",[0,0,0])];n&&r.push(n),r.push(`${aT(e.lineWidth??1)} w`,`${aT(e.x1)} ${aT(a.height-e.y1)} m`,`${aT(e.x2)} ${aT(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(iT(e.fill,"rg",[1,1,1])),e.stroke&&(r.push(iT(e.stroke,"RG",[0,0,0])),r.push(`${aT(e.lineWidth??1)} w`));for(const o of e.segments)switch(o.type){case"move":r.push(`${aT(o.x)} ${aT(n(o.y))} m`);break;case"line":r.push(`${aT(o.x)} ${aT(n(o.y))} l`);break;case"cubic":r.push(`${aT(o.x1)} ${aT(n(o.y1))} ${aT(o.x2)} ${aT(n(o.y2))} ${aT(o.x)} ${aT(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(`${aT(l)} ${aT(s)} ${aT(-s)} ${aT(l)} ${aT(d)} ${aT(c)} cm`)}clipRect(t,e,a,n,r){const o=this.pages[t];!o||n<=0||r<=0||o.commands.push(`${aT(e)} ${aT(o.height-a-r)} ${aT(n)} ${aT(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([pT(e.text),"BT",iT(e.color,"rg",[0,0,0]),`/${n} ${aT(e.fontSize??12)} Tf`,...e.horizontalScale&&e.horizontalScale>0&&100!==e.horizontalScale?[`${aT(e.horizontalScale)} Tz`]:[],...e.characterSpacing&&0!==e.characterSpacing?[`${aT(e.characterSpacing)} Tc`]:[],`${aT(e.x)} ${aT(a.height-e.y)} Td`,`<${dT(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",[aT(e.width),"0","0",aT(e.height),aT(e.x),aT(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",[aT(s),aT(d),aT(c),aT(h),aT(p),aT(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?`<${hT(t.glyphId)}>`:`<${hT(t.glyphId)}> ${aT(e)}`}).join(" ")}] TJ`:`<${r.map(t=>hT(t.glyphId)).join("")}> Tj`;t.commands.push([pT(a.text),"BT",iT(a.color,"rg",[0,0,0]),`/${e.resource.resourceName} ${aT(a.fontSize??12)} Tf`,...a.horizontalScale&&a.horizontalScale>0&&100!==a.horizontalScale?[`${aT(a.horizontalScale)} Tz`]:[],...a.characterSpacing&&0!==a.characterSpacing?[`${aT(a.characterSpacing)} Tc`]:[],`${aT(a.x)} ${aT(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 ${nT(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 ${aT(p.width)} ${aT(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]=nT(d),d+=`${p.id} 0 obj\n${p.body}\nendobj\n`;const h=nT(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=`${rT(t)}>`;return[`<< /Length ${nT(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=`${rT(t)}>`,n=e?` /${e.trim().replace(/^\/+/,"")}`:"";return`<< /Length ${nT(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=`${lT(`${t.resource.resourceName}AAAAAA`,"OASISF").slice(0,6).padEnd(6,"A")}+${lT(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(aT).join(" ")}]`,`/ItalicAngle ${aT(r.italicAngle)}`,`/Ascent ${aT(r.ascent*t.scale)}`,`/Descent ${aT(r.descent*t.scale)}`,`/CapHeight ${aT(r.capHeight*t.scale)}`,`/XHeight ${aT(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=>aT(t??0)).join(" ")}]]`,"/CIDToGIDMap /Identity",">>"].filter(Boolean).join("\n")),h=e(function(t,e=""){const a=e?` /${e.trim().replace(/^\/+/,"")}`:"";return`<< /Length ${nT(t)}${a} >>\nstream\n${t}endstream`}(function(t){const e=t.map(t=>`<${cT(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(`<${oT(n)}> <${oT(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 fT(t){t=ew(t);const e=new FI;await e.loadBundledUnicodeFaces({families:Tc(t)});const a=new uT(e.getPdfFontResources()),n=ss(t),r=function(t){return ra(t)}(t);for(const o of n.pages){const n=Math.max(1,MM(o.pageSettings.width)),i=Math.max(1,MM(o.pageSettings.height)),l=a.addPage({width:n,height:i});PI(a,l,n,i);const s=o.pageSettings.margins.left+o.pageSettings.margins.gutter,d=ye(o.pageSettings);await OI(a,l,o.headerBlocks,t,s,o.headerTop??we(o.pageSettings),d,e,r,o.pageSettings);const c=o.bodyTop??Se(o.pageSettings);if(o.blocks.some(t=>void 0!==t.columnIndex)){const n=Me(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 OI(a,l,d,t,i.left,c,i.width,e,r,o.pageSettings)}}else await OI(a,l,o.blocks,t,s,c,d,e,r,o.pageSettings);await OI(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:MM(s),y1:MM(o.footnoteSeparatorTop+.5),x2:MM(s+Math.min(180,.35*d)),y2:MM(o.footnoteSeparatorTop+.5),stroke:"#64748b",lineWidth:MM(1)}),await gT(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});PI(a,t,612,792)}return a.toArrayBuffer()}async function gT(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=Ql(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=Oe(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:MM(o),y:MM(h+12),text:n,fontSize:xM(i),color:i.color??"#000000",bold:i.bold,italic:i.italic,fontResourceName:l.writerResourceName})}p.add(a)}await OI(t,e,[f],r,o+cn,h,Math.max(24,l-cn),s,d),h+=Math.max(0,f.estimatedHeight)+2}}function mT(t,e){const a=URL.createObjectURL(t),n=document.createElement("a");n.href=a,n.download=e,n.click(),URL.revokeObjectURL(a)}function vT(t){const e=t.download??mT;return{handleExportDocx:async()=>{const a=await async function(t){const e=await vI(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 fT(t);return new Blob([e],{type:"application/pdf"})}(t.document());e(a,"oasis-editor.pdf"),t.focusInput()}}}async function bT(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 yT(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 MT(t){return{handleImportFile:async e=>{if(!e)return;const a=function(t){return oy.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 bT(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=je(t),n=new Map,r=new Map;let o=0,i=0;for(const l of a){const a=Pe(l.style,t.styles);r.set(a.align,(r.get(a.align)??0)+1);for(const r of l.runs){const a=Oe(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=Pe(e.style,t.styles),o=e.runs[0],i=Oe(null==o?void 0:o.styles,null==(n=e.style)?void 0:n.styleId,t.styles);return{index:a,text:Ie(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(Va(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=He(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=De(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 xT(t){return{insertImageFromFile:async(e,a)=>{t.logger.info(`image insert:start name="${e.name}" type=${e.type} size=${e.size}`);const n=await bT(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=eA(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=fa(t.selection)?t:xw(t),{paragraph:n,index:r,offset:o}=Mw(a),i=pw(n,o,[Ma("",dw(n,o),e)]);return vw(a,da(a).map((t,e)=>e===r?i:Kx(t)),yw(Ce(i,o+1)))}(a?Qw(t,{anchor:a,focus:a}):t,{src:r,width:p,height:u}),{mergeKey:"insertImage"})}}}const wT={"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 ST(t){const[e,a]=y(void 0),n=()=>{a(void 0)};x(()=>{fa(t.state().selection)||n()});const r=()=>{const a=np(t.state()),n=e();return fa(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(fa(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(fa(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 AT(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=da(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=He(t.document),n=Math.max(0,Math.min(ia(t),a.length-1)),r=la(t),o=a[n];if(!o)return t;const i=[...a],l={...o},s=xa("");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=da(a),r=e<0?n[0]:n[n.length-1];if(!r)return!1;const o=Ce(r,e<0?Te(r):0);return t.applyTransactionalState(()=>Ew(a,o),{mergeKey:"moveImage"}),t.focusInput(),!0}const i=n[o],l=e<0?Te(i):0;return t.applyTransactionalState(t=>Ew(t,Ce(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(Ow)},selection:{anchor:{...e.anchor},focus:{...e.focus}}})}}}
13
13
  /**
14
14
  * @license lucide v1.11.0 - ISC
15
15
  *