@thatopen/components 2.4.0-alpha.6 → 2.4.0-alpha.8

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.
@@ -15,4 +15,4 @@ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/js
15
15
 
16
16
  JSZip uses the library pako released under the MIT license :
17
17
  https://github.com/nodeca/pako/blob/main/LICENSE
18
- */const Dr=wr(vr.exports=function e(t,i,s){function n(o,a){if(!i[o]){if(!t[o]){if(!a&&Mr)return Mr(o);if(r)return r(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=i[o]={exports:{}};t[o][0].call(l.exports,(function(e){return n(t[o][1][e]||e)}),l,l.exports,e,t,i,s)}return i[o].exports}for(var r=Mr,o=0;o<s.length;o++)n(s[o]);return n}({1:[function(e,t,i){var s=e("./utils"),n=e("./support"),r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(e){for(var t,i,n,o,a,c,l,h=[],I=0,u=e.length,d=u,E="string"!==s.getTypeOf(e);I<e.length;)d=u-I,n=E?(t=e[I++],i=I<u?e[I++]:0,I<u?e[I++]:0):(t=e.charCodeAt(I++),i=I<u?e.charCodeAt(I++):0,I<u?e.charCodeAt(I++):0),o=t>>2,a=(3&t)<<4|i>>4,c=1<d?(15&i)<<2|n>>6:64,l=2<d?63&n:64,h.push(r.charAt(o)+r.charAt(a)+r.charAt(c)+r.charAt(l));return h.join("")},i.decode=function(e){var t,i,s,o,a,c,l=0,h=0,I="data:";if(e.substr(0,I.length)===I)throw new Error("Invalid base64 input, it looks like a data url.");var u,d=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===r.charAt(64)&&d--,e.charAt(e.length-2)===r.charAt(64)&&d--,d%1!=0)throw new Error("Invalid base64 input, bad content length.");for(u=n.uint8array?new Uint8Array(0|d):new Array(0|d);l<e.length;)t=r.indexOf(e.charAt(l++))<<2|(o=r.indexOf(e.charAt(l++)))>>4,i=(15&o)<<4|(a=r.indexOf(e.charAt(l++)))>>2,s=(3&a)<<6|(c=r.indexOf(e.charAt(l++))),u[h++]=t,64!==a&&(u[h++]=i),64!==c&&(u[h++]=s);return u}},{"./support":30,"./utils":32}],2:[function(e,t,i){var s=e("./external"),n=e("./stream/DataWorker"),r=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function a(e,t,i,s,n){this.compressedSize=e,this.uncompressedSize=t,this.crc32=i,this.compression=s,this.compressedContent=n}a.prototype={getContentWorker:function(){var e=new n(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",(function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),e},getCompressedWorker:function(){return new n(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,i){return e.pipe(new r).pipe(new o("uncompressedSize")).pipe(t.compressWorker(i)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,i){var s=e("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,i){var s=e("./utils"),n=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==s.getTypeOf(e)?function(e,t,i,s){var r=n,o=s+i;e^=-1;for(var a=s;a<o;a++)e=e>>>8^r[255&(e^t[a])];return~e}(0|t,e,e.length,0):function(e,t,i,s){var r=n,o=s+i;e^=-1;for(var a=s;a<o;a++)e=e>>>8^r[255&(e^t.charCodeAt(a))];return~e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(e,t,i){var s=null;s="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:s}},{lie:37}],7:[function(e,t,i){var s="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=e("pako"),r=e("./utils"),o=e("./stream/GenericWorker"),a=s?"uint8array":"array";function c(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}i.magic="\b\0",r.inherits(c,o),c.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(r.transformTo(a,e.data),!1)},c.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},i.compressWorker=function(e){return new c("Deflate",e)},i.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,i){function s(e,t){var i,s="";for(i=0;i<t;i++)s+=String.fromCharCode(255&e),e>>>=8;return s}function n(e,t,i,n,o,h){var I,u,d=e.file,E=e.compression,f=h!==a.utf8encode,p=r.transformTo("string",h(d.name)),C=r.transformTo("string",a.utf8encode(d.name)),T=d.comment,m=r.transformTo("string",h(T)),R=r.transformTo("string",a.utf8encode(T)),g=C.length!==d.name.length,A=R.length!==T.length,F="",S="",O="",N=d.dir,y=d.date,L={crc32:0,compressedSize:0,uncompressedSize:0};t&&!i||(L.crc32=e.crc32,L.compressedSize=e.compressedSize,L.uncompressedSize=e.uncompressedSize);var _=0;t&&(_|=8),f||!g&&!A||(_|=2048);var P,w,M,v=0,D=0;N&&(v|=16),"UNIX"===o?(D=798,v|=(P=d.unixPermissions,w=N,M=P,P||(M=w?16893:33204),(65535&M)<<16)):(D=20,v|=function(e){return 63&(e||0)}(d.dosPermissions)),I=y.getUTCHours(),I<<=6,I|=y.getUTCMinutes(),I<<=5,I|=y.getUTCSeconds()/2,u=y.getUTCFullYear()-1980,u<<=4,u|=y.getUTCMonth()+1,u<<=5,u|=y.getUTCDate(),g&&(S=s(1,1)+s(c(p),4)+C,F+="up"+s(S.length,2)+S),A&&(O=s(1,1)+s(c(m),4)+R,F+="uc"+s(O.length,2)+O);var b="";return b+="\n\0",b+=s(_,2),b+=E.magic,b+=s(I,2),b+=s(u,2),b+=s(L.crc32,4),b+=s(L.compressedSize,4),b+=s(L.uncompressedSize,4),b+=s(p.length,2),b+=s(F.length,2),{fileRecord:l.LOCAL_FILE_HEADER+b+p+F,dirRecord:l.CENTRAL_FILE_HEADER+s(D,2)+b+s(m.length,2)+"\0\0\0\0"+s(v,4)+s(n,4)+p+F+m}}var r=e("../utils"),o=e("../stream/GenericWorker"),a=e("../utf8"),c=e("../crc32"),l=e("../signature");function h(e,t,i,s){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=i,this.encodeFileName=s,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}r.inherits(h,o),h.prototype.push=function(e){var t=e.meta.percent||0,i=this.entriesCount,s=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:i?(t+100*(i-s-1))/i:100}}))},h.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var i=n(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(e){this.accumulate=!1;var t,i=this.streamFiles&&!e.file.dir,r=n(e,i,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),i)this.push({data:(t=e,l.DATA_DESCRIPTOR+s(t.crc32,4)+s(t.compressedSize,4)+s(t.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var i,n,o,a,c,h,I=this.bytesWritten-e,u=(i=this.dirRecords.length,n=I,o=e,a=this.zipComment,c=this.encodeFileName,h=r.transformTo("string",c(a)),l.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(i,2)+s(i,2)+s(n,4)+s(o,4)+s(h.length,2)+h);this.push({data:u,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()})),e.on("error",(function(e){t.error(e)})),this},h.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(e){var t=this._sources;if(!o.prototype.error.call(this,e))return!1;for(var i=0;i<t.length;i++)try{t[i].error(e)}catch(e){}return!0},h.prototype.lock=function(){o.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,i){var s=e("../compressions"),n=e("./ZipFileWorker");i.generateWorker=function(e,t,i){var r=new n(t.streamFiles,i,t.platform,t.encodeFileName),o=0;try{e.forEach((function(e,i){o++;var n=function(e,t){var i=e||t,n=s[i];if(!n)throw new Error(i+" is not a valid compression method !");return n}(i.options.compression,t.compression),a=i.options.compressionOptions||t.compressionOptions||{},c=i.dir,l=i.date;i._compressWorker(n,a).withStreamInfo("file",{name:e,dir:c,date:l,comment:i.comment||"",unixPermissions:i.unixPermissions,dosPermissions:i.dosPermissions}).pipe(r)})),r.entriesCount=o}catch(e){r.error(e)}return r}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,i){function s(){if(!(this instanceof s))return new s;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 e=new s;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(s.prototype=e("./object")).loadAsync=e("./load"),s.support=e("./support"),s.defaults=e("./defaults"),s.version="3.10.1",s.loadAsync=function(e,t){return(new s).loadAsync(e,t)},s.external=e("./external"),t.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,i){var s=e("./utils"),n=e("./external"),r=e("./utf8"),o=e("./zipEntries"),a=e("./stream/Crc32Probe"),c=e("./nodejsUtils");function l(e){return new n.Promise((function(t,i){var s=e.decompressed.getContentWorker().pipe(new a);s.on("error",(function(e){i(e)})).on("end",(function(){s.streamInfo.crc32!==e.decompressed.crc32?i(new Error("Corrupted zip : CRC32 mismatch")):t()})).resume()}))}t.exports=function(e,t){var i=this;return t=s.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:r.utf8decode}),c.isNode&&c.isStream(e)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then((function(e){var i=new o(t);return i.load(e),i})).then((function(e){var i=[n.Promise.resolve(e)],s=e.files;if(t.checkCRC32)for(var r=0;r<s.length;r++)i.push(l(s[r]));return n.Promise.all(i)})).then((function(e){for(var n=e.shift(),r=n.files,o=0;o<r.length;o++){var a=r[o],c=a.fileNameStr,l=s.resolve(a.fileNameStr);i.file(l,a.decompressed,{binary:!0,optimizedBinaryString:!0,date:a.date,dir:a.dir,comment:a.fileCommentStr.length?a.fileCommentStr:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:t.createFolders}),a.dir||(i.file(l).unsafeOriginalName=c)}return n.zipComment.length&&(i.comment=n.zipComment),i}))}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,i){var s=e("../utils"),n=e("../stream/GenericWorker");function r(e,t){n.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}s.inherits(r,n),r.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",(function(e){t.push({data:e,meta:{percent:0}})})).on("error",(function(e){t.isPaused?this.generatedError=e:t.error(e)})).on("end",(function(){t.isPaused?t._upstreamEnded=!0:t.end()}))},r.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},r.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=r},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,i){var s=e("readable-stream").Readable;function n(e,t,i){s.call(this,t),this._helper=e;var n=this;e.on("data",(function(e,t){n.push(e)||n._helper.pause(),i&&i(t)})).on("error",(function(e){n.emit("error",e)})).on("end",(function(){n.push(null)}))}e("../utils").inherits(n,s),n.prototype._read=function(){this._helper.resume()},t.exports=n},{"../utils":32,"readable-stream":16}],14:[function(e,t,i){t.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,i){function s(e,t,i){var s,n=r.getTypeOf(t),a=r.extend(i||{},c);a.date=a.date||new Date,null!==a.compression&&(a.compression=a.compression.toUpperCase()),"string"==typeof a.unixPermissions&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&16384&a.unixPermissions&&(a.dir=!0),a.dosPermissions&&16&a.dosPermissions&&(a.dir=!0),a.dir&&(e=f(e)),a.createFolders&&(s=E(e))&&p.call(this,s,!0);var I="string"===n&&!1===a.binary&&!1===a.base64;i&&void 0!==i.binary||(a.binary=!I),(t instanceof l&&0===t.uncompressedSize||a.dir||!t||0===t.length)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",n="string");var C=null;C=t instanceof l||t instanceof o?t:u.isNode&&u.isStream(t)?new d(e,t):r.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var T=new h(e,C,a);this.files[e]=T}var n=e("./utf8"),r=e("./utils"),o=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),c=e("./defaults"),l=e("./compressedObject"),h=e("./zipObject"),I=e("./generate"),u=e("./nodejsUtils"),d=e("./nodejs/NodejsStreamInputAdapter"),E=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},f=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},p=function(e,t){return t=void 0!==t?t:c.createFolders,e=f(e),this.files[e]||s.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function C(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var T={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,i,s;for(t in this.files)s=this.files[t],(i=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(i,s)},filter:function(e){var t=[];return this.forEach((function(i,s){e(i,s)&&t.push(s)})),t},file:function(e,t,i){if(1!==arguments.length)return e=this.root+e,s.call(this,e,t,i),this;if(C(e)){var n=e;return this.filter((function(e,t){return!t.dir&&n.test(e)}))}var r=this.files[this.root+e];return r&&!r.dir?r:null},folder:function(e){if(!e)return this;if(C(e))return this.filter((function(t,i){return i.dir&&e.test(t)}));var t=this.root+e,i=p.call(this,t),s=this.clone();return s.root=i.name,s},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var i=this.filter((function(t,i){return i.name.slice(0,e.length)===e})),s=0;s<i.length;s++)delete this.files[i[s].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,i={};try{if((i=r.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=i.type.toLowerCase(),i.compression=i.compression.toUpperCase(),"binarystring"===i.type&&(i.type="string"),!i.type)throw new Error("No output type specified.");r.checkSupport(i.type),"darwin"!==i.platform&&"freebsd"!==i.platform&&"linux"!==i.platform&&"sunos"!==i.platform||(i.platform="UNIX"),"win32"===i.platform&&(i.platform="DOS");var s=i.comment||this.comment||"";t=I.generateWorker(this,i,s)}catch(e){(t=new o("error")).error(e)}return new a(t,i.type||"string",i.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=T},{"./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(e,t,i){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,i){var s=e("./DataReader");function n(e){s.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(n,s),n.prototype.byteAt=function(e){return this.data[this.zero+e]},n.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),i=e.charCodeAt(1),s=e.charCodeAt(2),n=e.charCodeAt(3),r=this.length-4;0<=r;--r)if(this.data[r]===t&&this.data[r+1]===i&&this.data[r+2]===s&&this.data[r+3]===n)return r-this.zero;return-1},n.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),i=e.charCodeAt(1),s=e.charCodeAt(2),n=e.charCodeAt(3),r=this.readData(4);return t===r[0]&&i===r[1]&&s===r[2]&&n===r[3]},n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],18:[function(e,t,i){var s=e("../utils");function n(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,i=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)i=(i<<8)+this.byteAt(t);return this.index+=e,i},readString:function(e){return s.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t,i){var s=e("./Uint8ArrayReader");function n(e){s.call(this,e)}e("../utils").inherits(n,s),n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,i){var s=e("./DataReader");function n(e){s.call(this,e)}e("../utils").inherits(n,s),n.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},n.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},n.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t,i){var s=e("./ArrayReader");function n(e){s.call(this,e)}e("../utils").inherits(n,s),n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,i){var s=e("../utils"),n=e("../support"),r=e("./ArrayReader"),o=e("./StringReader"),a=e("./NodeBufferReader"),c=e("./Uint8ArrayReader");t.exports=function(e){var t=s.getTypeOf(e);return s.checkSupport(t),"string"!==t||n.uint8array?"nodebuffer"===t?new a(e):n.uint8array?new c(s.transformTo("uint8array",e)):new r(s.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,i){var s=e("./GenericWorker"),n=e("../utils");function r(e){s.call(this,"ConvertWorker to "+e),this.destType=e}n.inherits(r,s),r.prototype.processChunk=function(e){this.push({data:n.transformTo(this.destType,e.data),meta:e.meta})},t.exports=r},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,i){var s=e("./GenericWorker"),n=e("../crc32");function r(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(r,s),r.prototype.processChunk=function(e){this.streamInfo.crc32=n(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=r},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,i){var s=e("../utils"),n=e("./GenericWorker");function r(e){n.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}s.inherits(r,n),r.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}n.prototype.processChunk.call(this,e)},t.exports=r},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,i){var s=e("../utils"),n=e("./GenericWorker");function r(e){n.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then((function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=s.getTypeOf(e),t.isPaused||t._tickAndRepeat()}),(function(e){t.error(e)}))}s.inherits(r,n),r.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},r.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},r.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},r.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=r},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,i){function s(e){this.name=e||"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}s.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var i=0;i<this._listeners[e].length;i++)this._listeners[e][i].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.end()})),e.on("error",(function(e){t.error(e)})),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 e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},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 e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=s},{}],29:[function(e,t,i){var s=e("../utils"),n=e("./ConvertWorker"),r=e("./GenericWorker"),o=e("../base64"),a=e("../support"),c=e("../external"),l=null;if(a.nodestream)try{l=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function h(e,t){return new c.Promise((function(i,n){var r=[],a=e._internalType,c=e._outputType,l=e._mimeType;e.on("data",(function(e,i){r.push(e),t&&t(i)})).on("error",(function(e){r=[],n(e)})).on("end",(function(){try{var e=function(e,t,i){switch(e){case"blob":return s.newBlob(s.transformTo("arraybuffer",t),i);case"base64":return o.encode(t);default:return s.transformTo(e,t)}}(c,function(e,t){var i,s=0,n=null,r=0;for(i=0;i<t.length;i++)r+=t[i].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(n=new Uint8Array(r),i=0;i<t.length;i++)n.set(t[i],s),s+=t[i].length;return n;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(a,r),l);i(e)}catch(e){n(e)}r=[]})).resume()}))}function I(e,t,i){var o=t;switch(t){case"blob":case"arraybuffer":o="uint8array";break;case"base64":o="string"}try{this._internalType=o,this._outputType=t,this._mimeType=i,s.checkSupport(o),this._worker=e.pipe(new n(o)),e.lock()}catch(e){this._worker=new r("error"),this._worker.error(e)}}I.prototype={accumulate:function(e){return h(this,e)},on:function(e,t){var i=this;return"data"===e?this._worker.on(e,(function(e){t.call(i,e.data,e.meta)})):this._worker.on(e,(function(){s.delay(t,arguments,i)})),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(s.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new l(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=I},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,i.nodebuffer="undefined"!=typeof Buffer,i.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=0===new Blob([s],{type:"application/zip"}).size}catch(e){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(s),i.blob=0===n.getBlob("application/zip").size}catch(e){i.blob=!1}}}try{i.nodestream=!!e("readable-stream").Readable}catch(e){i.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,i){for(var s=e("./utils"),n=e("./support"),r=e("./nodejsUtils"),o=e("./stream/GenericWorker"),a=new Array(256),c=0;c<256;c++)a[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function l(){o.call(this,"utf-8 decode"),this.leftOver=null}function h(){o.call(this,"utf-8 encode")}a[254]=a[254]=1,i.utf8encode=function(e){return n.nodebuffer?r.newBufferFrom(e,"utf-8"):function(e){var t,i,s,r,o,a=e.length,c=0;for(r=0;r<a;r++)55296==(64512&(i=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(s=e.charCodeAt(r+1)))&&(i=65536+(i-55296<<10)+(s-56320),r++),c+=i<128?1:i<2048?2:i<65536?3:4;for(t=n.uint8array?new Uint8Array(c):new Array(c),r=o=0;o<c;r++)55296==(64512&(i=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(s=e.charCodeAt(r+1)))&&(i=65536+(i-55296<<10)+(s-56320),r++),i<128?t[o++]=i:(i<2048?t[o++]=192|i>>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t}(e)},i.utf8decode=function(e){return n.nodebuffer?s.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,i,n,r,o=e.length,c=new Array(2*o);for(t=i=0;t<o;)if((n=e[t++])<128)c[i++]=n;else if(4<(r=a[n]))c[i++]=65533,t+=r-1;else{for(n&=2===r?31:3===r?15:7;1<r&&t<o;)n=n<<6|63&e[t++],r--;1<r?c[i++]=65533:n<65536?c[i++]=n:(n-=65536,c[i++]=55296|n>>10&1023,c[i++]=56320|1023&n)}return c.length!==i&&(c.subarray?c=c.subarray(0,i):c.length=i),s.applyFromCharCode(c)}(e=s.transformTo(n.uint8array?"uint8array":"array",e))},s.inherits(l,o),l.prototype.processChunk=function(e){var t=s.transformTo(n.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var r=t;(t=new Uint8Array(r.length+this.leftOver.length)).set(this.leftOver,0),t.set(r,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+a[e[i]]>t?i:t}(t),c=t;o!==t.length&&(n.uint8array?(c=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(c=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:i.utf8decode(c),meta:e.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=l,s.inherits(h,o),h.prototype.processChunk=function(e){this.push({data:i.utf8encode(e.data),meta:e.meta})},i.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,i){var s=e("./support"),n=e("./base64"),r=e("./nodejsUtils"),o=e("./external");function a(e){return e}function c(e,t){for(var i=0;i<e.length;++i)t[i]=255&e.charCodeAt(i);return t}e("setimmediate"),i.newBlob=function(e,t){i.checkSupport("blob");try{return new Blob([e],{type:t})}catch(i){try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return s.append(e),s.getBlob(t)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var l={stringifyByChunk:function(e,t,i){var s=[],n=0,r=e.length;if(r<=i)return String.fromCharCode.apply(null,e);for(;n<r;)"array"===t||"nodebuffer"===t?s.push(String.fromCharCode.apply(null,e.slice(n,Math.min(n+i,r)))):s.push(String.fromCharCode.apply(null,e.subarray(n,Math.min(n+i,r)))),n+=i;return s.join("")},stringifyByChar:function(e){for(var t="",i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);return t},applyCanBeUsed:{uint8array:function(){try{return s.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return s.nodebuffer&&1===String.fromCharCode.apply(null,r.allocBuffer(1)).length}catch(e){return!1}}()}};function h(e){var t=65536,s=i.getTypeOf(e),n=!0;if("uint8array"===s?n=l.applyCanBeUsed.uint8array:"nodebuffer"===s&&(n=l.applyCanBeUsed.nodebuffer),n)for(;1<t;)try{return l.stringifyByChunk(e,s,t)}catch(e){t=Math.floor(t/2)}return l.stringifyByChar(e)}function I(e,t){for(var i=0;i<e.length;i++)t[i]=e[i];return t}i.applyFromCharCode=h;var u={};u.string={string:a,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return u.string.uint8array(e).buffer},uint8array:function(e){return c(e,new Uint8Array(e.length))},nodebuffer:function(e){return c(e,r.allocBuffer(e.length))}},u.array={string:h,array:a,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return r.newBufferFrom(e)}},u.arraybuffer={string:function(e){return h(new Uint8Array(e))},array:function(e){return I(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:a,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return r.newBufferFrom(new Uint8Array(e))}},u.uint8array={string:h,array:function(e){return I(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:a,nodebuffer:function(e){return r.newBufferFrom(e)}},u.nodebuffer={string:h,array:function(e){return I(e,new Array(e.length))},arraybuffer:function(e){return u.nodebuffer.uint8array(e).buffer},uint8array:function(e){return I(e,new Uint8Array(e.length))},nodebuffer:a},i.transformTo=function(e,t){if(t=t||"",!e)return t;i.checkSupport(e);var s=i.getTypeOf(t);return u[s][e](t)},i.resolve=function(e){for(var t=e.split("/"),i=[],s=0;s<t.length;s++){var n=t[s];"."===n||""===n&&0!==s&&s!==t.length-1||(".."===n?i.pop():i.push(n))}return i.join("/")},i.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":s.nodebuffer&&r.isBuffer(e)?"nodebuffer":s.uint8array&&e instanceof Uint8Array?"uint8array":s.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(e){if(!s[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(e){var t,i,s="";for(i=0;i<(e||"").length;i++)s+="\\x"+((t=e.charCodeAt(i))<16?"0":"")+t.toString(16).toUpperCase();return s},i.delay=function(e,t,i){setImmediate((function(){e.apply(i||null,t||[])}))},i.inherits=function(e,t){function i(){}i.prototype=t.prototype,e.prototype=new i},i.extend=function(){var e,t,i={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===i[t]&&(i[t]=arguments[e][t]);return i},i.prepareContent=function(e,t,r,a,l){return o.Promise.resolve(t).then((function(e){return s.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new o.Promise((function(t,i){var s=new FileReader;s.onload=function(e){t(e.target.result)},s.onerror=function(e){i(e.target.error)},s.readAsArrayBuffer(e)})):e})).then((function(t){var h,I=i.getTypeOf(t);return I?("arraybuffer"===I?t=i.transformTo("uint8array",t):"string"===I&&(l?t=n.decode(t):r&&!0!==a&&(t=c(h=t,s.uint8array?new Uint8Array(h.length):new Array(h.length)))),t):o.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))}))}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,i){var s=e("./reader/readerFor"),n=e("./utils"),r=e("./signature"),o=e("./zipEntry"),a=e("./support");function c(e){this.files=[],this.loadOptions=e}c.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+n.pretty(t)+", expected "+n.pretty(e)+")")}},isSignature:function(e,t){var i=this.reader.index;this.reader.setIndex(e);var s=this.reader.readString(4)===t;return this.reader.setIndex(i),s},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 e=this.reader.readData(this.zipCommentLength),t=a.uint8array?"uint8array":"array",i=n.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(i)},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 e,t,i,s=this.zip64EndOfCentralSize-44;0<s;)e=this.reader.readInt(2),t=this.reader.readInt(4),i=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:i}},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 e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(r.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(r.CENTRAL_FILE_HEADER);)(e=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);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 e=this.reader.lastIndexOfSignature(r.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,r.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(e);var t=e;if(this.checkSignature(r.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(r.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(r.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,r.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(r.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(r.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var i=this.centralDirOffset+this.centralDirSize;this.zip64&&(i+=20,i+=12+this.zip64EndOfCentralSize);var s=t-i;if(0<s)this.isSignature(t,r.CENTRAL_FILE_HEADER)||(this.reader.zero=s);else if(s<0)throw new Error("Corrupted zip: missing "+Math.abs(s)+" bytes.")},prepareReader:function(e){this.reader=s(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=c},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,i){var s=e("./reader/readerFor"),n=e("./utils"),r=e("./compressedObject"),o=e("./crc32"),a=e("./utf8"),c=e("./compressions"),l=e("./support");function h(e,t){this.options=e,this.loadOptions=t}h.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(e){var t,i;if(e.skip(22),this.fileNameLength=e.readInt(2),i=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(i),-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===(t=function(e){for(var t in c)if(Object.prototype.hasOwnProperty.call(c,t)&&c[t].magic===e)return c[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.transformTo("string",this.fileName)+")");this.decompressed=new r(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=s(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,i,s,n=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<n;)t=e.readInt(2),i=e.readInt(2),s=e.readData(i),this.extraFields[t]={id:t,length:i,value:s};e.setIndex(n)},handleUTF8:function(){var e=l.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var i=n.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var s=this.findExtraFieldUnicodeComment();if(null!==s)this.fileCommentStr=s;else{var r=n.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(r)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=s(e.value);return 1!==t.readInt(1)||o(this.fileName)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=s(e.value);return 1!==t.readInt(1)||o(this.fileComment)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null}},t.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,i){function s(e,t,i){this.name=e,this.dir=i.dir,this.date=i.date,this.comment=i.comment,this.unixPermissions=i.unixPermissions,this.dosPermissions=i.dosPermissions,this._data=t,this._dataBinary=i.binary,this.options={compression:i.compression,compressionOptions:i.compressionOptions}}var n=e("./stream/StreamHelper"),r=e("./stream/DataWorker"),o=e("./utf8"),a=e("./compressedObject"),c=e("./stream/GenericWorker");s.prototype={internalStream:function(e){var t=null,i="string";try{if(!e)throw new Error("No output type specified.");var s="string"===(i=e.toLowerCase())||"text"===i;"binarystring"!==i&&"text"!==i||(i="string"),t=this._decompressWorker();var r=!this._dataBinary;r&&!s&&(t=t.pipe(new o.Utf8EncodeWorker)),!r&&s&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(e){(t=new c("error")).error(e)}return new n(t,i,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof a&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var i=this._decompressWorker();return this._dataBinary||(i=i.pipe(new o.Utf8EncodeWorker)),a.createWorkerFrom(i,e,t)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof c?this._data:new r(this._data)}};for(var l=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},I=0;I<l.length;I++)s.prototype[l[I]]=h;t.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,i){(function(e){var i,s,n=e.MutationObserver||e.WebKitMutationObserver;if(n){var r=0,o=new n(h),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),i=function(){a.data=r=++r%2}}else if(e.setImmediate||void 0===e.MessageChannel)i="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){h(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(h,0)};else{var c=new e.MessageChannel;c.port1.onmessage=h,i=function(){c.port2.postMessage(0)}}var l=[];function h(){var e,t;s=!0;for(var i=l.length;i;){for(t=l,l=[],e=-1;++e<i;)t[e]();i=l.length}s=!1}t.exports=function(e){1!==l.push(e)||s||i()}}).call(this,void 0!==Pr?Pr:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,i){var s=e("immediate");function n(){}var r={},o=["REJECTED"],a=["FULFILLED"],c=["PENDING"];function l(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==n&&d(this,e)}function h(e,t,i){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof i&&(this.onRejected=i,this.callRejected=this.otherCallRejected)}function I(e,t,i){s((function(){var s;try{s=t(i)}catch(t){return r.reject(e,t)}s===e?r.reject(e,new TypeError("Cannot resolve promise with itself")):r.resolve(e,s)}))}function u(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(e,t){var i=!1;function s(t){i||(i=!0,r.reject(e,t))}function n(t){i||(i=!0,r.resolve(e,t))}var o=E((function(){t(n,s)}));"error"===o.status&&s(o.value)}function E(e,t){var i={};try{i.value=e(t),i.status="success"}catch(e){i.status="error",i.value=e}return i}(t.exports=l).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then((function(i){return t.resolve(e()).then((function(){return i}))}),(function(i){return t.resolve(e()).then((function(){throw i}))}))},l.prototype.catch=function(e){return this.then(null,e)},l.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var i=new this.constructor(n);return this.state!==c?I(i,this.state===a?e:t,this.outcome):this.queue.push(new h(i,e,t)),i},h.prototype.callFulfilled=function(e){r.resolve(this.promise,e)},h.prototype.otherCallFulfilled=function(e){I(this.promise,this.onFulfilled,e)},h.prototype.callRejected=function(e){r.reject(this.promise,e)},h.prototype.otherCallRejected=function(e){I(this.promise,this.onRejected,e)},r.resolve=function(e,t){var i=E(u,t);if("error"===i.status)return r.reject(e,i.value);var s=i.value;if(s)d(e,s);else{e.state=a,e.outcome=t;for(var n=-1,o=e.queue.length;++n<o;)e.queue[n].callFulfilled(t)}return e},r.reject=function(e,t){e.state=o,e.outcome=t;for(var i=-1,s=e.queue.length;++i<s;)e.queue[i].callRejected(t);return e},l.resolve=function(e){return e instanceof this?e:r.resolve(new this(n),e)},l.reject=function(e){var t=new this(n);return r.reject(t,e)},l.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,s=!1;if(!i)return this.resolve([]);for(var o=new Array(i),a=0,c=-1,l=new this(n);++c<i;)h(e[c],c);return l;function h(e,n){t.resolve(e).then((function(e){o[n]=e,++a!==i||s||(s=!0,r.resolve(l,o))}),(function(e){s||(s=!0,r.reject(l,e))}))}},l.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,s=!1;if(!i)return this.resolve([]);for(var o,a=-1,c=new this(n);++a<i;)o=e[a],t.resolve(o).then((function(e){s||(s=!0,r.resolve(c,e))}),(function(e){s||(s=!0,r.reject(c,e))}));return c}},{immediate:36}],38:[function(e,t,i){var s={};(0,e("./lib/utils/common").assign)(s,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,i){var s=e("./zlib/deflate"),n=e("./utils/common"),r=e("./utils/strings"),o=e("./zlib/messages"),a=e("./zlib/zstream"),c=Object.prototype.toString,l=0,h=-1,I=0,u=8;function d(e){if(!(this instanceof d))return new d(e);this.options=n.assign({level:h,method:u,chunkSize:16384,windowBits:15,memLevel:8,strategy:I,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var i=s.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==l)throw new Error(o[i]);if(t.header&&s.deflateSetHeader(this.strm,t.header),t.dictionary){var E;if(E="string"==typeof t.dictionary?r.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(i=s.deflateSetDictionary(this.strm,E))!==l)throw new Error(o[i]);this._dict_set=!0}}function E(e,t){var i=new d(t);if(i.push(e,!0),i.err)throw i.msg||o[i.err];return i.result}d.prototype.push=function(e,t){var i,o,a=this.strm,h=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=r.string2buf(e):"[object ArrayBuffer]"===c.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new n.Buf8(h),a.next_out=0,a.avail_out=h),1!==(i=s.deflate(a,o))&&i!==l)return this.onEnd(i),!(this.ended=!0);0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(r.buf2binstring(n.shrinkBuf(a.output,a.next_out))):this.onData(n.shrinkBuf(a.output,a.next_out)))}while((0<a.avail_in||0===a.avail_out)&&1!==i);return 4===o?(i=s.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===l):2!==o||(this.onEnd(l),!(a.avail_out=0))},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){e===l&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Deflate=d,i.deflate=E,i.deflateRaw=function(e,t){return(t=t||{}).raw=!0,E(e,t)},i.gzip=function(e,t){return(t=t||{}).gzip=!0,E(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,i){var s=e("./zlib/inflate"),n=e("./utils/common"),r=e("./utils/strings"),o=e("./zlib/constants"),a=e("./zlib/messages"),c=e("./zlib/zstream"),l=e("./zlib/gzheader"),h=Object.prototype.toString;function I(e){if(!(this instanceof I))return new I(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var i=s.inflateInit2(this.strm,t.windowBits);if(i!==o.Z_OK)throw new Error(a[i]);this.header=new l,s.inflateGetHeader(this.strm,this.header)}function u(e,t){var i=new I(t);if(i.push(e,!0),i.err)throw i.msg||a[i.err];return i.result}I.prototype.push=function(e,t){var i,a,c,l,I,u,d=this.strm,E=this.options.chunkSize,f=this.options.dictionary,p=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?d.input=r.binstring2buf(e):"[object ArrayBuffer]"===h.call(e)?d.input=new Uint8Array(e):d.input=e,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new n.Buf8(E),d.next_out=0,d.avail_out=E),(i=s.inflate(d,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&f&&(u="string"==typeof f?r.string2buf(f):"[object ArrayBuffer]"===h.call(f)?new Uint8Array(f):f,i=s.inflateSetDictionary(this.strm,u)),i===o.Z_BUF_ERROR&&!0===p&&(i=o.Z_OK,p=!1),i!==o.Z_STREAM_END&&i!==o.Z_OK)return this.onEnd(i),!(this.ended=!0);d.next_out&&(0!==d.avail_out&&i!==o.Z_STREAM_END&&(0!==d.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(c=r.utf8border(d.output,d.next_out),l=d.next_out-c,I=r.buf2string(d.output,c),d.next_out=l,d.avail_out=E-l,l&&n.arraySet(d.output,d.output,c,l,0),this.onData(I)):this.onData(n.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(p=!0)}while((0<d.avail_in||0===d.avail_out)&&i!==o.Z_STREAM_END);return i===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(i=s.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(d.avail_out=0))},I.prototype.onData=function(e){this.chunks.push(e)},I.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Inflate=I,i.inflate=u,i.inflateRaw=function(e,t){return(t=t||{}).raw=!0,u(e,t)},i.ungzip=u},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,i){var s="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;i.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var s in i)i.hasOwnProperty(s)&&(e[s]=i[s])}}return e},i.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,i,s,n){if(t.subarray&&e.subarray)e.set(t.subarray(i,i+s),n);else for(var r=0;r<s;r++)e[n+r]=t[i+r]},flattenChunks:function(e){var t,i,s,n,r,o;for(t=s=0,i=e.length;t<i;t++)s+=e[t].length;for(o=new Uint8Array(s),t=n=0,i=e.length;t<i;t++)r=e[t],o.set(r,n),n+=r.length;return o}},r={arraySet:function(e,t,i,s,n){for(var r=0;r<s;r++)e[n+r]=t[i+r]},flattenChunks:function(e){return[].concat.apply([],e)}};i.setTyped=function(e){e?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,n)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,r))},i.setTyped(s)},{}],42:[function(e,t,i){var s=e("./common"),n=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch(e){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){r=!1}for(var o=new s.Buf8(256),a=0;a<256;a++)o[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function c(e,t){if(t<65537&&(e.subarray&&r||!e.subarray&&n))return String.fromCharCode.apply(null,s.shrinkBuf(e,t));for(var i="",o=0;o<t;o++)i+=String.fromCharCode(e[o]);return i}o[254]=o[254]=1,i.string2buf=function(e){var t,i,n,r,o,a=e.length,c=0;for(r=0;r<a;r++)55296==(64512&(i=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(n=e.charCodeAt(r+1)))&&(i=65536+(i-55296<<10)+(n-56320),r++),c+=i<128?1:i<2048?2:i<65536?3:4;for(t=new s.Buf8(c),r=o=0;o<c;r++)55296==(64512&(i=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(n=e.charCodeAt(r+1)))&&(i=65536+(i-55296<<10)+(n-56320),r++),i<128?t[o++]=i:(i<2048?t[o++]=192|i>>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t},i.buf2binstring=function(e){return c(e,e.length)},i.binstring2buf=function(e){for(var t=new s.Buf8(e.length),i=0,n=t.length;i<n;i++)t[i]=e.charCodeAt(i);return t},i.buf2string=function(e,t){var i,s,n,r,a=t||e.length,l=new Array(2*a);for(i=s=0;i<a;)if((n=e[i++])<128)l[s++]=n;else if(4<(r=o[n]))l[s++]=65533,i+=r-1;else{for(n&=2===r?31:3===r?15:7;1<r&&i<a;)n=n<<6|63&e[i++],r--;1<r?l[s++]=65533:n<65536?l[s++]=n:(n-=65536,l[s++]=55296|n>>10&1023,l[s++]=56320|1023&n)}return c(l,s)},i.utf8border=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+o[e[i]]>t?i:t}},{"./common":41}],43:[function(e,t,i){t.exports=function(e,t,i,s){for(var n=65535&e,r=e>>>16&65535,o=0;0!==i;){for(i-=o=2e3<i?2e3:i;r=r+(n=n+t[s++]|0)|0,--o;);n%=65521,r%=65521}return n|r<<16}},{}],44:[function(e,t,i){t.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(e,t,i){var s=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();t.exports=function(e,t,i,n){var r=s,o=n+i;e^=-1;for(var a=n;a<o;a++)e=e>>>8^r[255&(e^t[a])];return~e}},{}],46:[function(e,t,i){var s,n=e("../utils/common"),r=e("./trees"),o=e("./adler32"),a=e("./crc32"),c=e("./messages"),l=0,h=4,I=0,u=-2,d=-1,E=4,f=2,p=8,C=9,T=286,m=30,R=19,g=2*T+1,A=15,F=3,S=258,O=S+F+1,N=42,y=113,L=1,_=2,P=3,w=4;function M(e,t){return e.msg=c[t],t}function v(e){return(e<<1)-(4<e?9:0)}function D(e){for(var t=e.length;0<=--t;)e[t]=0}function b(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(n.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))}function U(e,t){r._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,b(e.strm)}function x(e,t){e.pending_buf[e.pending++]=t}function B(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function V(e,t){var i,s,n=e.max_chain_length,r=e.strstart,o=e.prev_length,a=e.nice_match,c=e.strstart>e.w_size-O?e.strstart-(e.w_size-O):0,l=e.window,h=e.w_mask,I=e.prev,u=e.strstart+S,d=l[r+o-1],E=l[r+o];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do{if(l[(i=t)+o]===E&&l[i+o-1]===d&&l[i]===l[r]&&l[++i]===l[r+1]){r+=2,i++;do{}while(l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&r<u);if(s=S-(u-r),r=u-S,o<s){if(e.match_start=t,a<=(o=s))break;d=l[r+o-1],E=l[r+o]}}}while((t=I[t&h])>c&&0!=--n);return o<=e.lookahead?o:e.lookahead}function Y(e){var t,i,s,r,c,l,h,I,u,d,E=e.w_size;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=E+(E-O)){for(n.arraySet(e.window,e.window,E,E,0),e.match_start-=E,e.strstart-=E,e.block_start-=E,t=i=e.hash_size;s=e.head[--t],e.head[t]=E<=s?s-E:0,--i;);for(t=i=E;s=e.prev[--t],e.prev[t]=E<=s?s-E:0,--i;);r+=E}if(0===e.strm.avail_in)break;if(l=e.strm,h=e.window,I=e.strstart+e.lookahead,d=void 0,(u=r)<(d=l.avail_in)&&(d=u),i=0===d?0:(l.avail_in-=d,n.arraySet(h,l.input,l.next_in,d,I),1===l.state.wrap?l.adler=o(l.adler,h,d,I):2===l.state.wrap&&(l.adler=a(l.adler,h,d,I)),l.next_in+=d,l.total_in+=d,d),e.lookahead+=i,e.lookahead+e.insert>=F)for(c=e.strstart-e.insert,e.ins_h=e.window[c],e.ins_h=(e.ins_h<<e.hash_shift^e.window[c+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[c+F-1])&e.hash_mask,e.prev[c&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=c,c++,e.insert--,!(e.lookahead+e.insert<F)););}while(e.lookahead<O&&0!==e.strm.avail_in)}function G(e,t){for(var i,s;;){if(e.lookahead<O){if(Y(e),e.lookahead<O&&t===l)return L;if(0===e.lookahead)break}if(i=0,e.lookahead>=F&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-O&&(e.match_length=V(e,i)),e.match_length>=F)if(s=r._tr_tally(e,e.strstart-e.match_start,e.match_length-F),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=F){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else s=r._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(s&&(U(e,!1),0===e.strm.avail_out))return L}return e.insert=e.strstart<F-1?e.strstart:F-1,t===h?(U(e,!0),0===e.strm.avail_out?P:w):e.last_lit&&(U(e,!1),0===e.strm.avail_out)?L:_}function z(e,t){for(var i,s,n;;){if(e.lookahead<O){if(Y(e),e.lookahead<O&&t===l)return L;if(0===e.lookahead)break}if(i=0,e.lookahead>=F&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=F-1,0!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-O&&(e.match_length=V(e,i),e.match_length<=5&&(1===e.strategy||e.match_length===F&&4096<e.strstart-e.match_start)&&(e.match_length=F-1)),e.prev_length>=F&&e.match_length<=e.prev_length){for(n=e.strstart+e.lookahead-F,s=r._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-F),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=F-1,e.strstart++,s&&(U(e,!1),0===e.strm.avail_out))return L}else if(e.match_available){if((s=r._tr_tally(e,0,e.window[e.strstart-1]))&&U(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return L}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(s=r._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<F-1?e.strstart:F-1,t===h?(U(e,!0),0===e.strm.avail_out?P:w):e.last_lit&&(U(e,!1),0===e.strm.avail_out)?L:_}function k(e,t,i,s,n){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=s,this.func=n}function H(){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=p,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 n.Buf16(2*g),this.dyn_dtree=new n.Buf16(2*(2*m+1)),this.bl_tree=new n.Buf16(2*(2*R+1)),D(this.dyn_ltree),D(this.dyn_dtree),D(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(A+1),this.heap=new n.Buf16(2*T+1),D(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(2*T+1),D(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 W(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=f,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?N:y,e.adler=2===t.wrap?0:1,t.last_flush=l,r._tr_init(t),I):M(e,u)}function X(e){var t,i=W(e);return i===I&&((t=e.state).window_size=2*t.w_size,D(t.head),t.max_lazy_match=s[t.level].max_lazy,t.good_match=s[t.level].good_length,t.nice_match=s[t.level].nice_length,t.max_chain_length=s[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=F-1,t.match_available=0,t.ins_h=0),i}function j(e,t,i,s,r,o){if(!e)return u;var a=1;if(t===d&&(t=6),s<0?(a=0,s=-s):15<s&&(a=2,s-=16),r<1||C<r||i!==p||s<8||15<s||t<0||9<t||o<0||E<o)return M(e,u);8===s&&(s=9);var c=new H;return(e.state=c).strm=e,c.wrap=a,c.gzhead=null,c.w_bits=s,c.w_size=1<<c.w_bits,c.w_mask=c.w_size-1,c.hash_bits=r+7,c.hash_size=1<<c.hash_bits,c.hash_mask=c.hash_size-1,c.hash_shift=~~((c.hash_bits+F-1)/F),c.window=new n.Buf8(2*c.w_size),c.head=new n.Buf16(c.hash_size),c.prev=new n.Buf16(c.w_size),c.lit_bufsize=1<<r+6,c.pending_buf_size=4*c.lit_bufsize,c.pending_buf=new n.Buf8(c.pending_buf_size),c.d_buf=1*c.lit_bufsize,c.l_buf=3*c.lit_bufsize,c.level=t,c.strategy=o,c.method=i,X(e)}s=[new k(0,0,0,0,(function(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Y(e),0===e.lookahead&&t===l)return L;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var s=e.block_start+i;if((0===e.strstart||e.strstart>=s)&&(e.lookahead=e.strstart-s,e.strstart=s,U(e,!1),0===e.strm.avail_out))return L;if(e.strstart-e.block_start>=e.w_size-O&&(U(e,!1),0===e.strm.avail_out))return L}return e.insert=0,t===h?(U(e,!0),0===e.strm.avail_out?P:w):(e.strstart>e.block_start&&(U(e,!1),e.strm.avail_out),L)})),new k(4,4,8,4,G),new k(4,5,16,8,G),new k(4,6,32,32,G),new k(4,4,16,16,z),new k(8,16,32,32,z),new k(8,16,128,128,z),new k(8,32,128,256,z),new k(32,128,258,1024,z),new k(32,258,258,4096,z)],i.deflateInit=function(e,t){return j(e,t,p,15,8,0)},i.deflateInit2=j,i.deflateReset=X,i.deflateResetKeep=W,i.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?u:(e.state.gzhead=t,I):u},i.deflate=function(e,t){var i,n,o,c;if(!e||!e.state||5<t||t<0)return e?M(e,u):u;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&t!==h)return M(e,0===e.avail_out?-5:u);if(n.strm=e,i=n.last_flush,n.last_flush=t,n.status===N)if(2===n.wrap)e.adler=0,x(n,31),x(n,139),x(n,8),n.gzhead?(x(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),x(n,255&n.gzhead.time),x(n,n.gzhead.time>>8&255),x(n,n.gzhead.time>>16&255),x(n,n.gzhead.time>>24&255),x(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),x(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(x(n,255&n.gzhead.extra.length),x(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=a(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(x(n,0),x(n,0),x(n,0),x(n,0),x(n,0),x(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),x(n,3),n.status=y);else{var d=p+(n.w_bits-8<<4)<<8;d|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(d|=32),d+=31-d%31,n.status=y,B(n,d),0!==n.strstart&&(B(n,e.adler>>>16),B(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),b(e),o=n.pending,n.pending!==n.pending_buf_size));)x(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),b(e),o=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,x(n,c)}while(0!==c);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===c&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),b(e),o=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,x(n,c)}while(0!==c);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===c&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&b(e),n.pending+2<=n.pending_buf_size&&(x(n,255&e.adler),x(n,e.adler>>8&255),e.adler=0,n.status=y)):n.status=y),0!==n.pending){if(b(e),0===e.avail_out)return n.last_flush=-1,I}else if(0===e.avail_in&&v(t)<=v(i)&&t!==h)return M(e,-5);if(666===n.status&&0!==e.avail_in)return M(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==l&&666!==n.status){var E=2===n.strategy?function(e,t){for(var i;;){if(0===e.lookahead&&(Y(e),0===e.lookahead)){if(t===l)return L;break}if(e.match_length=0,i=r._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(U(e,!1),0===e.strm.avail_out))return L}return e.insert=0,t===h?(U(e,!0),0===e.strm.avail_out?P:w):e.last_lit&&(U(e,!1),0===e.strm.avail_out)?L:_}(n,t):3===n.strategy?function(e,t){for(var i,s,n,o,a=e.window;;){if(e.lookahead<=S){if(Y(e),e.lookahead<=S&&t===l)return L;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=F&&0<e.strstart&&(s=a[n=e.strstart-1])===a[++n]&&s===a[++n]&&s===a[++n]){o=e.strstart+S;do{}while(s===a[++n]&&s===a[++n]&&s===a[++n]&&s===a[++n]&&s===a[++n]&&s===a[++n]&&s===a[++n]&&s===a[++n]&&n<o);e.match_length=S-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=F?(i=r._tr_tally(e,1,e.match_length-F),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=r._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(U(e,!1),0===e.strm.avail_out))return L}return e.insert=0,t===h?(U(e,!0),0===e.strm.avail_out?P:w):e.last_lit&&(U(e,!1),0===e.strm.avail_out)?L:_}(n,t):s[n.level].func(n,t);if(E!==P&&E!==w||(n.status=666),E===L||E===P)return 0===e.avail_out&&(n.last_flush=-1),I;if(E===_&&(1===t?r._tr_align(n):5!==t&&(r._tr_stored_block(n,0,0,!1),3===t&&(D(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),b(e),0===e.avail_out))return n.last_flush=-1,I}return t!==h?I:n.wrap<=0?1:(2===n.wrap?(x(n,255&e.adler),x(n,e.adler>>8&255),x(n,e.adler>>16&255),x(n,e.adler>>24&255),x(n,255&e.total_in),x(n,e.total_in>>8&255),x(n,e.total_in>>16&255),x(n,e.total_in>>24&255)):(B(n,e.adler>>>16),B(n,65535&e.adler)),b(e),0<n.wrap&&(n.wrap=-n.wrap),0!==n.pending?I:1)},i.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==N&&69!==t&&73!==t&&91!==t&&103!==t&&t!==y&&666!==t?M(e,u):(e.state=null,t===y?M(e,-3):I):u},i.deflateSetDictionary=function(e,t){var i,s,r,a,c,l,h,d,E=t.length;if(!e||!e.state)return u;if(2===(a=(i=e.state).wrap)||1===a&&i.status!==N||i.lookahead)return u;for(1===a&&(e.adler=o(e.adler,t,E,0)),i.wrap=0,E>=i.w_size&&(0===a&&(D(i.head),i.strstart=0,i.block_start=0,i.insert=0),d=new n.Buf8(i.w_size),n.arraySet(d,t,E-i.w_size,i.w_size,0),t=d,E=i.w_size),c=e.avail_in,l=e.next_in,h=e.input,e.avail_in=E,e.next_in=0,e.input=t,Y(i);i.lookahead>=F;){for(s=i.strstart,r=i.lookahead-(F-1);i.ins_h=(i.ins_h<<i.hash_shift^i.window[s+F-1])&i.hash_mask,i.prev[s&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=s,s++,--r;);i.strstart=s,i.lookahead=F-1,Y(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=F-1,i.match_available=0,e.next_in=l,e.input=h,e.avail_in=c,i.wrap=a,I},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,i){t.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(e,t,i){t.exports=function(e,t){var i,s,n,r,o,a,c,l,h,I,u,d,E,f,p,C,T,m,R,g,A,F,S,O,N;i=e.state,s=e.next_in,O=e.input,n=s+(e.avail_in-5),r=e.next_out,N=e.output,o=r-(t-e.avail_out),a=r+(e.avail_out-257),c=i.dmax,l=i.wsize,h=i.whave,I=i.wnext,u=i.window,d=i.hold,E=i.bits,f=i.lencode,p=i.distcode,C=(1<<i.lenbits)-1,T=(1<<i.distbits)-1;e:do{E<15&&(d+=O[s++]<<E,E+=8,d+=O[s++]<<E,E+=8),m=f[d&C];t:for(;;){if(d>>>=R=m>>>24,E-=R,0==(R=m>>>16&255))N[r++]=65535&m;else{if(!(16&R)){if(!(64&R)){m=f[(65535&m)+(d&(1<<R)-1)];continue t}if(32&R){i.mode=12;break e}e.msg="invalid literal/length code",i.mode=30;break e}g=65535&m,(R&=15)&&(E<R&&(d+=O[s++]<<E,E+=8),g+=d&(1<<R)-1,d>>>=R,E-=R),E<15&&(d+=O[s++]<<E,E+=8,d+=O[s++]<<E,E+=8),m=p[d&T];i:for(;;){if(d>>>=R=m>>>24,E-=R,!(16&(R=m>>>16&255))){if(!(64&R)){m=p[(65535&m)+(d&(1<<R)-1)];continue i}e.msg="invalid distance code",i.mode=30;break e}if(A=65535&m,E<(R&=15)&&(d+=O[s++]<<E,(E+=8)<R&&(d+=O[s++]<<E,E+=8)),c<(A+=d&(1<<R)-1)){e.msg="invalid distance too far back",i.mode=30;break e}if(d>>>=R,E-=R,(R=r-o)<A){if(h<(R=A-R)&&i.sane){e.msg="invalid distance too far back",i.mode=30;break e}if(S=u,(F=0)===I){if(F+=l-R,R<g){for(g-=R;N[r++]=u[F++],--R;);F=r-A,S=N}}else if(I<R){if(F+=l+I-R,(R-=I)<g){for(g-=R;N[r++]=u[F++],--R;);if(F=0,I<g){for(g-=R=I;N[r++]=u[F++],--R;);F=r-A,S=N}}}else if(F+=I-R,R<g){for(g-=R;N[r++]=u[F++],--R;);F=r-A,S=N}for(;2<g;)N[r++]=S[F++],N[r++]=S[F++],N[r++]=S[F++],g-=3;g&&(N[r++]=S[F++],1<g&&(N[r++]=S[F++]))}else{for(F=r-A;N[r++]=N[F++],N[r++]=N[F++],N[r++]=N[F++],2<(g-=3););g&&(N[r++]=N[F++],1<g&&(N[r++]=N[F++]))}break}}break}}while(s<n&&r<a);s-=g=E>>3,d&=(1<<(E-=g<<3))-1,e.next_in=s,e.next_out=r,e.avail_in=s<n?n-s+5:5-(s-n),e.avail_out=r<a?a-r+257:257-(r-a),i.hold=d,i.bits=E}},{}],49:[function(e,t,i){var s=e("../utils/common"),n=e("./adler32"),r=e("./crc32"),o=e("./inffast"),a=e("./inftrees"),c=1,l=2,h=0,I=-2,u=1,d=852,E=592;function f(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function p(){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 s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function C(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=u,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new s.Buf32(d),t.distcode=t.distdyn=new s.Buf32(E),t.sane=1,t.back=-1,h):I}function T(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,C(e)):I}function m(e,t){var i,s;return e&&e.state?(s=e.state,t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?I:(null!==s.window&&s.wbits!==t&&(s.window=null),s.wrap=i,s.wbits=t,T(e))):I}function R(e,t){var i,s;return e?(s=new p,(e.state=s).window=null,(i=m(e,t))!==h&&(e.state=null),i):I}var g,A,F=!0;function S(e){if(F){var t;for(g=new s.Buf32(512),A=new s.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(c,e.lens,0,288,g,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(l,e.lens,0,32,A,0,e.work,{bits:5}),F=!1}e.lencode=g,e.lenbits=9,e.distcode=A,e.distbits=5}function O(e,t,i,n){var r,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new s.Buf8(o.wsize)),n>=o.wsize?(s.arraySet(o.window,t,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(n<(r=o.wsize-o.wnext)&&(r=n),s.arraySet(o.window,t,i-n,r,o.wnext),(n-=r)?(s.arraySet(o.window,t,i-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=r))),0}i.inflateReset=T,i.inflateReset2=m,i.inflateResetKeep=C,i.inflateInit=function(e){return R(e,15)},i.inflateInit2=R,i.inflate=function(e,t){var i,d,E,p,C,T,m,R,g,A,F,N,y,L,_,P,w,M,v,D,b,U,x,B,V=0,Y=new s.Buf8(4),G=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return I;12===(i=e.state).mode&&(i.mode=13),C=e.next_out,E=e.output,m=e.avail_out,p=e.next_in,d=e.input,T=e.avail_in,R=i.hold,g=i.bits,A=T,F=m,U=h;e:for(;;)switch(i.mode){case u:if(0===i.wrap){i.mode=13;break}for(;g<16;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(2&i.wrap&&35615===R){Y[i.check=0]=255&R,Y[1]=R>>>8&255,i.check=r(i.check,Y,2,0),g=R=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&R)<<8)+(R>>8))%31){e.msg="incorrect header check",i.mode=30;break}if(8!=(15&R)){e.msg="unknown compression method",i.mode=30;break}if(g-=4,b=8+(15&(R>>>=4)),0===i.wbits)i.wbits=b;else if(b>i.wbits){e.msg="invalid window size",i.mode=30;break}i.dmax=1<<b,e.adler=i.check=1,i.mode=512&R?10:12,g=R=0;break;case 2:for(;g<16;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(i.flags=R,8!=(255&i.flags)){e.msg="unknown compression method",i.mode=30;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=30;break}i.head&&(i.head.text=R>>8&1),512&i.flags&&(Y[0]=255&R,Y[1]=R>>>8&255,i.check=r(i.check,Y,2,0)),g=R=0,i.mode=3;case 3:for(;g<32;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.head&&(i.head.time=R),512&i.flags&&(Y[0]=255&R,Y[1]=R>>>8&255,Y[2]=R>>>16&255,Y[3]=R>>>24&255,i.check=r(i.check,Y,4,0)),g=R=0,i.mode=4;case 4:for(;g<16;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.head&&(i.head.xflags=255&R,i.head.os=R>>8),512&i.flags&&(Y[0]=255&R,Y[1]=R>>>8&255,i.check=r(i.check,Y,2,0)),g=R=0,i.mode=5;case 5:if(1024&i.flags){for(;g<16;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.length=R,i.head&&(i.head.extra_len=R),512&i.flags&&(Y[0]=255&R,Y[1]=R>>>8&255,i.check=r(i.check,Y,2,0)),g=R=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&(T<(N=i.length)&&(N=T),N&&(i.head&&(b=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),s.arraySet(i.head.extra,d,p,N,b)),512&i.flags&&(i.check=r(i.check,d,N,p)),T-=N,p+=N,i.length-=N),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===T)break e;for(N=0;b=d[p+N++],i.head&&b&&i.length<65536&&(i.head.name+=String.fromCharCode(b)),b&&N<T;);if(512&i.flags&&(i.check=r(i.check,d,N,p)),T-=N,p+=N,b)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===T)break e;for(N=0;b=d[p+N++],i.head&&b&&i.length<65536&&(i.head.comment+=String.fromCharCode(b)),b&&N<T;);if(512&i.flags&&(i.check=r(i.check,d,N,p)),T-=N,p+=N,b)break e}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;g<16;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(R!==(65535&i.check)){e.msg="header crc mismatch",i.mode=30;break}g=R=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=12;break;case 10:for(;g<32;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}e.adler=i.check=f(R),g=R=0,i.mode=11;case 11:if(0===i.havedict)return e.next_out=C,e.avail_out=m,e.next_in=p,e.avail_in=T,i.hold=R,i.bits=g,2;e.adler=i.check=1,i.mode=12;case 12:if(5===t||6===t)break e;case 13:if(i.last){R>>>=7&g,g-=7&g,i.mode=27;break}for(;g<3;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}switch(i.last=1&R,g-=1,3&(R>>>=1)){case 0:i.mode=14;break;case 1:if(S(i),i.mode=20,6!==t)break;R>>>=2,g-=2;break e;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=30}R>>>=2,g-=2;break;case 14:for(R>>>=7&g,g-=7&g;g<32;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if((65535&R)!=(R>>>16^65535)){e.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&R,g=R=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(N=i.length){if(T<N&&(N=T),m<N&&(N=m),0===N)break e;s.arraySet(E,d,p,N,C),T-=N,p+=N,m-=N,C+=N,i.length-=N;break}i.mode=12;break;case 17:for(;g<14;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(i.nlen=257+(31&R),R>>>=5,g-=5,i.ndist=1+(31&R),R>>>=5,g-=5,i.ncode=4+(15&R),R>>>=4,g-=4,286<i.nlen||30<i.ndist){e.msg="too many length or distance symbols",i.mode=30;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;g<3;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.lens[G[i.have++]]=7&R,R>>>=3,g-=3}for(;i.have<19;)i.lens[G[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,x={bits:i.lenbits},U=a(0,i.lens,0,19,i.lencode,0,i.work,x),i.lenbits=x.bits,U){e.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;P=(V=i.lencode[R&(1<<i.lenbits)-1])>>>16&255,w=65535&V,!((_=V>>>24)<=g);){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(w<16)R>>>=_,g-=_,i.lens[i.have++]=w;else{if(16===w){for(B=_+2;g<B;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(R>>>=_,g-=_,0===i.have){e.msg="invalid bit length repeat",i.mode=30;break}b=i.lens[i.have-1],N=3+(3&R),R>>>=2,g-=2}else if(17===w){for(B=_+3;g<B;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}g-=_,b=0,N=3+(7&(R>>>=_)),R>>>=3,g-=3}else{for(B=_+7;g<B;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}g-=_,b=0,N=11+(127&(R>>>=_)),R>>>=7,g-=7}if(i.have+N>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=30;break}for(;N--;)i.lens[i.have++]=b}}if(30===i.mode)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,x={bits:i.lenbits},U=a(c,i.lens,0,i.nlen,i.lencode,0,i.work,x),i.lenbits=x.bits,U){e.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,x={bits:i.distbits},U=a(l,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,x),i.distbits=x.bits,U){e.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===t)break e;case 20:i.mode=21;case 21:if(6<=T&&258<=m){e.next_out=C,e.avail_out=m,e.next_in=p,e.avail_in=T,i.hold=R,i.bits=g,o(e,F),C=e.next_out,E=e.output,m=e.avail_out,p=e.next_in,d=e.input,T=e.avail_in,R=i.hold,g=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;P=(V=i.lencode[R&(1<<i.lenbits)-1])>>>16&255,w=65535&V,!((_=V>>>24)<=g);){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(P&&!(240&P)){for(M=_,v=P,D=w;P=(V=i.lencode[D+((R&(1<<M+v)-1)>>M)])>>>16&255,w=65535&V,!(M+(_=V>>>24)<=g);){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}R>>>=M,g-=M,i.back+=M}if(R>>>=_,g-=_,i.back+=_,i.length=w,0===P){i.mode=26;break}if(32&P){i.back=-1,i.mode=12;break}if(64&P){e.msg="invalid literal/length code",i.mode=30;break}i.extra=15&P,i.mode=22;case 22:if(i.extra){for(B=i.extra;g<B;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.length+=R&(1<<i.extra)-1,R>>>=i.extra,g-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;P=(V=i.distcode[R&(1<<i.distbits)-1])>>>16&255,w=65535&V,!((_=V>>>24)<=g);){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(!(240&P)){for(M=_,v=P,D=w;P=(V=i.distcode[D+((R&(1<<M+v)-1)>>M)])>>>16&255,w=65535&V,!(M+(_=V>>>24)<=g);){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}R>>>=M,g-=M,i.back+=M}if(R>>>=_,g-=_,i.back+=_,64&P){e.msg="invalid distance code",i.mode=30;break}i.offset=w,i.extra=15&P,i.mode=24;case 24:if(i.extra){for(B=i.extra;g<B;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.offset+=R&(1<<i.extra)-1,R>>>=i.extra,g-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===m)break e;if(N=F-m,i.offset>N){if((N=i.offset-N)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=30;break}y=N>i.wnext?(N-=i.wnext,i.wsize-N):i.wnext-N,N>i.length&&(N=i.length),L=i.window}else L=E,y=C-i.offset,N=i.length;for(m<N&&(N=m),m-=N,i.length-=N;E[C++]=L[y++],--N;);0===i.length&&(i.mode=21);break;case 26:if(0===m)break e;E[C++]=i.length,m--,i.mode=21;break;case 27:if(i.wrap){for(;g<32;){if(0===T)break e;T--,R|=d[p++]<<g,g+=8}if(F-=m,e.total_out+=F,i.total+=F,F&&(e.adler=i.check=i.flags?r(i.check,E,F,C-F):n(i.check,E,F,C-F)),F=m,(i.flags?R:f(R))!==i.check){e.msg="incorrect data check",i.mode=30;break}g=R=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;g<32;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(R!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=30;break}g=R=0}i.mode=29;case 29:U=1;break e;case 30:U=-3;break e;case 31:return-4;default:return I}return e.next_out=C,e.avail_out=m,e.next_in=p,e.avail_in=T,i.hold=R,i.bits=g,(i.wsize||F!==e.avail_out&&i.mode<30&&(i.mode<27||4!==t))&&O(e,e.output,e.next_out,F-e.avail_out)?(i.mode=31,-4):(A-=e.avail_in,F-=e.avail_out,e.total_in+=A,e.total_out+=F,i.total+=F,i.wrap&&F&&(e.adler=i.check=i.flags?r(i.check,E,F,e.next_out-F):n(i.check,E,F,e.next_out-F)),e.data_type=i.bits+(i.last?64:0)+(12===i.mode?128:0)+(20===i.mode||15===i.mode?256:0),(0==A&&0===F||4===t)&&U===h&&(U=-5),U)},i.inflateEnd=function(e){if(!e||!e.state)return I;var t=e.state;return t.window&&(t.window=null),e.state=null,h},i.inflateGetHeader=function(e,t){var i;return e&&e.state&&2&(i=e.state).wrap?((i.head=t).done=!1,h):I},i.inflateSetDictionary=function(e,t){var i,s=t.length;return e&&e.state?0!==(i=e.state).wrap&&11!==i.mode?I:11===i.mode&&n(1,t,s,0)!==i.check?-3:O(e,t,s,s)?(i.mode=31,-4):(i.havedict=1,h):I},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,i){var s=e("../utils/common"),n=[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],r=[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],o=[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],a=[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];t.exports=function(e,t,i,c,l,h,I,u){var d,E,f,p,C,T,m,R,g,A=u.bits,F=0,S=0,O=0,N=0,y=0,L=0,_=0,P=0,w=0,M=0,v=null,D=0,b=new s.Buf16(16),U=new s.Buf16(16),x=null,B=0;for(F=0;F<=15;F++)b[F]=0;for(S=0;S<c;S++)b[t[i+S]]++;for(y=A,N=15;1<=N&&0===b[N];N--);if(N<y&&(y=N),0===N)return l[h++]=20971520,l[h++]=20971520,u.bits=1,0;for(O=1;O<N&&0===b[O];O++);for(y<O&&(y=O),F=P=1;F<=15;F++)if(P<<=1,(P-=b[F])<0)return-1;if(0<P&&(0===e||1!==N))return-1;for(U[1]=0,F=1;F<15;F++)U[F+1]=U[F]+b[F];for(S=0;S<c;S++)0!==t[i+S]&&(I[U[t[i+S]]++]=S);if(T=0===e?(v=x=I,19):1===e?(v=n,D-=257,x=r,B-=257,256):(v=o,x=a,-1),F=O,C=h,_=S=M=0,f=-1,p=(w=1<<(L=y))-1,1===e&&852<w||2===e&&592<w)return 1;for(;;){for(m=F-_,g=I[S]<T?(R=0,I[S]):I[S]>T?(R=x[B+I[S]],v[D+I[S]]):(R=96,0),d=1<<F-_,O=E=1<<L;l[C+(M>>_)+(E-=d)]=m<<24|R<<16|g,0!==E;);for(d=1<<F-1;M&d;)d>>=1;if(0!==d?(M&=d-1,M+=d):M=0,S++,0==--b[F]){if(F===N)break;F=t[i+I[S]]}if(y<F&&(M&p)!==f){for(0===_&&(_=y),C+=O,P=1<<(L=F-_);L+_<N&&!((P-=b[L+_])<=0);)L++,P<<=1;if(w+=1<<L,1===e&&852<w||2===e&&592<w)return 1;l[f=M&p]=y<<24|L<<16|C-h}}return 0!==M&&(l[C+M]=F-_<<24|64<<16),u.bits=y,0}},{"../utils/common":41}],51:[function(e,t,i){t.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(e,t,i){var s=e("../utils/common"),n=0,r=1;function o(e){for(var t=e.length;0<=--t;)e[t]=0}var a=0,c=29,l=256,h=l+1+c,I=30,u=19,d=2*h+1,E=15,f=16,p=7,C=256,T=16,m=17,R=18,g=[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],A=[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],F=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],O=new Array(2*(h+2));o(O);var N=new Array(2*I);o(N);var y=new Array(512);o(y);var L=new Array(256);o(L);var _=new Array(c);o(_);var P,w,M,v=new Array(I);function D(e,t,i,s,n){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=s,this.max_length=n,this.has_stree=e&&e.length}function b(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function U(e){return e<256?y[e]:y[256+(e>>>7)]}function x(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function B(e,t,i){e.bi_valid>f-i?(e.bi_buf|=t<<e.bi_valid&65535,x(e,e.bi_buf),e.bi_buf=t>>f-e.bi_valid,e.bi_valid+=i-f):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function V(e,t,i){B(e,i[2*t],i[2*t+1])}function Y(e,t){for(var i=0;i|=1&e,e>>>=1,i<<=1,0<--t;);return i>>>1}function G(e,t,i){var s,n,r=new Array(E+1),o=0;for(s=1;s<=E;s++)r[s]=o=o+i[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=Y(r[a]++,a))}}function z(e){var t;for(t=0;t<h;t++)e.dyn_ltree[2*t]=0;for(t=0;t<I;t++)e.dyn_dtree[2*t]=0;for(t=0;t<u;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*C]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function k(e){8<e.bi_valid?x(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function H(e,t,i,s){var n=2*t,r=2*i;return e[n]<e[r]||e[n]===e[r]&&s[t]<=s[i]}function W(e,t,i){for(var s=e.heap[i],n=i<<1;n<=e.heap_len&&(n<e.heap_len&&H(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!H(t,s,e.heap[n],e.depth));)e.heap[i]=e.heap[n],i=n,n<<=1;e.heap[i]=s}function X(e,t,i){var s,n,r,o,a=0;if(0!==e.last_lit)for(;s=e.pending_buf[e.d_buf+2*a]<<8|e.pending_buf[e.d_buf+2*a+1],n=e.pending_buf[e.l_buf+a],a++,0===s?V(e,n,t):(V(e,(r=L[n])+l+1,t),0!==(o=g[r])&&B(e,n-=_[r],o),V(e,r=U(--s),i),0!==(o=A[r])&&B(e,s-=v[r],o)),a<e.last_lit;);V(e,C,t)}function j(e,t){var i,s,n,r=t.dyn_tree,o=t.stat_desc.static_tree,a=t.stat_desc.has_stree,c=t.stat_desc.elems,l=-1;for(e.heap_len=0,e.heap_max=d,i=0;i<c;i++)0!==r[2*i]?(e.heap[++e.heap_len]=l=i,e.depth[i]=0):r[2*i+1]=0;for(;e.heap_len<2;)r[2*(n=e.heap[++e.heap_len]=l<2?++l:0)]=1,e.depth[n]=0,e.opt_len--,a&&(e.static_len-=o[2*n+1]);for(t.max_code=l,i=e.heap_len>>1;1<=i;i--)W(e,r,i);for(n=c;i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],W(e,r,1),s=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=s,r[2*n]=r[2*i]+r[2*s],e.depth[n]=(e.depth[i]>=e.depth[s]?e.depth[i]:e.depth[s])+1,r[2*i+1]=r[2*s+1]=n,e.heap[1]=n++,W(e,r,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var i,s,n,r,o,a,c=t.dyn_tree,l=t.max_code,h=t.stat_desc.static_tree,I=t.stat_desc.has_stree,u=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,p=t.stat_desc.max_length,C=0;for(r=0;r<=E;r++)e.bl_count[r]=0;for(c[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;i<d;i++)p<(r=c[2*c[2*(s=e.heap[i])+1]+1]+1)&&(r=p,C++),c[2*s+1]=r,l<s||(e.bl_count[r]++,o=0,f<=s&&(o=u[s-f]),a=c[2*s],e.opt_len+=a*(r+o),I&&(e.static_len+=a*(h[2*s+1]+o)));if(0!==C){do{for(r=p-1;0===e.bl_count[r];)r--;e.bl_count[r]--,e.bl_count[r+1]+=2,e.bl_count[p]--,C-=2}while(0<C);for(r=p;0!==r;r--)for(s=e.bl_count[r];0!==s;)l<(n=e.heap[--i])||(c[2*n+1]!==r&&(e.opt_len+=(r-c[2*n+1])*c[2*n],c[2*n+1]=r),s--)}}(e,t),G(r,l,e.bl_count)}function Z(e,t,i){var s,n,r=-1,o=t[1],a=0,c=7,l=4;for(0===o&&(c=138,l=3),t[2*(i+1)+1]=65535,s=0;s<=i;s++)n=o,o=t[2*(s+1)+1],++a<c&&n===o||(a<l?e.bl_tree[2*n]+=a:0!==n?(n!==r&&e.bl_tree[2*n]++,e.bl_tree[2*T]++):a<=10?e.bl_tree[2*m]++:e.bl_tree[2*R]++,r=n,l=(a=0)===o?(c=138,3):n===o?(c=6,3):(c=7,4))}function $(e,t,i){var s,n,r=-1,o=t[1],a=0,c=7,l=4;for(0===o&&(c=138,l=3),s=0;s<=i;s++)if(n=o,o=t[2*(s+1)+1],!(++a<c&&n===o)){if(a<l)for(;V(e,n,e.bl_tree),0!=--a;);else 0!==n?(n!==r&&(V(e,n,e.bl_tree),a--),V(e,T,e.bl_tree),B(e,a-3,2)):a<=10?(V(e,m,e.bl_tree),B(e,a-3,3)):(V(e,R,e.bl_tree),B(e,a-11,7));r=n,l=(a=0)===o?(c=138,3):n===o?(c=6,3):(c=7,4)}}o(v);var q=!1;function Q(e,t,i,n){var r,o,c;B(e,(a<<1)+(n?1:0),3),o=t,c=i,k(r=e),x(r,c),x(r,~c),s.arraySet(r.pending_buf,r.window,o,c,r.pending),r.pending+=c}i._tr_init=function(e){q||(function(){var e,t,i,s,n,r=new Array(E+1);for(s=i=0;s<c-1;s++)for(_[s]=i,e=0;e<1<<g[s];e++)L[i++]=s;for(L[i-1]=s,s=n=0;s<16;s++)for(v[s]=n,e=0;e<1<<A[s];e++)y[n++]=s;for(n>>=7;s<I;s++)for(v[s]=n<<7,e=0;e<1<<A[s]-7;e++)y[256+n++]=s;for(t=0;t<=E;t++)r[t]=0;for(e=0;e<=143;)O[2*e+1]=8,e++,r[8]++;for(;e<=255;)O[2*e+1]=9,e++,r[9]++;for(;e<=279;)O[2*e+1]=7,e++,r[7]++;for(;e<=287;)O[2*e+1]=8,e++,r[8]++;for(G(O,h+1,r),e=0;e<I;e++)N[2*e+1]=5,N[2*e]=Y(e,5);P=new D(O,g,l+1,h,E),w=new D(N,A,0,I,E),M=new D(new Array(0),F,0,u,p)}(),q=!0),e.l_desc=new b(e.dyn_ltree,P),e.d_desc=new b(e.dyn_dtree,w),e.bl_desc=new b(e.bl_tree,M),e.bi_buf=0,e.bi_valid=0,z(e)},i._tr_stored_block=Q,i._tr_flush_block=function(e,t,i,s){var o,a,c=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return n;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return r;for(t=32;t<l;t++)if(0!==e.dyn_ltree[2*t])return r;return n}(e)),j(e,e.l_desc),j(e,e.d_desc),c=function(e){var t;for(Z(e,e.dyn_ltree,e.l_desc.max_code),Z(e,e.dyn_dtree,e.d_desc.max_code),j(e,e.bl_desc),t=u-1;3<=t&&0===e.bl_tree[2*S[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),o=e.opt_len+3+7>>>3,(a=e.static_len+3+7>>>3)<=o&&(o=a)):o=a=i+5,i+4<=o&&-1!==t?Q(e,t,i,s):4===e.strategy||a===o?(B(e,2+(s?1:0),3),X(e,O,N)):(B(e,4+(s?1:0),3),function(e,t,i,s){var n;for(B(e,t-257,5),B(e,i-1,5),B(e,s-4,4),n=0;n<s;n++)B(e,e.bl_tree[2*S[n]+1],3);$(e,e.dyn_ltree,t-1),$(e,e.dyn_dtree,i-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,c+1),X(e,e.dyn_ltree,e.dyn_dtree)),z(e),s&&k(e)},i._tr_tally=function(e,t,i){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(L[i]+l+1)]++,e.dyn_dtree[2*U(t)]++),e.last_lit===e.lit_bufsize-1},i._tr_align=function(e){var t;B(e,2,3),V(e,C,O),16===(t=e).bi_valid?(x(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}},{"../utils/common":41}],53:[function(e,t,i){t.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(e,t,i){(function(e){!function(e,t){if(!e.setImmediate){var i,s,n,r,o=1,a={},c=!1,l=e.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,i="[object process]"==={}.toString.call(e.process)?function(e){process.nextTick((function(){u(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,i=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=i,t}}()?(r="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",d,!1):e.attachEvent("onmessage",d),function(t){e.postMessage(r+t,"*")}):e.MessageChannel?((n=new MessageChannel).port1.onmessage=function(e){u(e.data)},function(e){n.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?(s=l.documentElement,function(e){var t=l.createElement("script");t.onreadystatechange=function(){u(e),t.onreadystatechange=null,s.removeChild(t),t=null},s.appendChild(t)}):function(e){setTimeout(u,0,e)},h.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),s=0;s<t.length;s++)t[s]=arguments[s+1];var n={callback:e,args:t};return a[o]=n,i(o),o++},h.clearImmediate=I}function I(e){delete a[e]}function u(e){if(c)setTimeout(u,0,e);else{var i=a[e];if(i){c=!0;try{!function(e){var i=e.callback,s=e.args;switch(s.length){case 0:i();break;case 1:i(s[0]);break;case 2:i(s[0],s[1]);break;case 3:i(s[0],s[1],s[2]);break;default:i.apply(t,s)}}(i)}finally{I(e),c=!1}}}}function d(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(r)&&u(+t.data.slice(r.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,void 0!==Pr?Pr:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10));var br={},Ur={};!function(e){const t=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",i="["+t+"]["+(t+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040")+"]*",s=new RegExp("^"+i+"$");e.isExist=function(e){return void 0!==e},e.isEmptyObject=function(e){return 0===Object.keys(e).length},e.merge=function(e,t,i){if(t){const s=Object.keys(t),n=s.length;for(let r=0;r<n;r++)e[s[r]]="strict"===i?[t[s[r]]]:t[s[r]]}},e.getValue=function(t){return e.isExist(t)?t:""},e.isName=function(e){const t=s.exec(e);return!(null==t)},e.getAllMatches=function(e,t){const i=[];let s=t.exec(e);for(;s;){const n=[];n.startIndex=t.lastIndex-s[0].length;const r=s.length;for(let e=0;e<r;e++)n.push(s[e]);i.push(n),s=t.exec(e)}return i},e.nameRegexp=i}(Ur);const xr=Ur,Br={allowBooleanAttributes:!1,unpairedTags:[]};function Vr(e){return" "===e||"\t"===e||"\n"===e||"\r"===e}function Yr(e,t){const i=t;for(;t<e.length;t++)if("?"!=e[t]&&" "!=e[t]);else{const s=e.substr(i,t-i);if(t>5&&"xml"===s)return Zr("InvalidXml","XML declaration allowed only at the start of the document.",qr(e,t));if("?"==e[t]&&">"==e[t+1]){t++;break}}return t}function Gr(e,t){if(e.length>t+5&&"-"===e[t+1]&&"-"===e[t+2]){for(t+=3;t<e.length;t++)if("-"===e[t]&&"-"===e[t+1]&&">"===e[t+2]){t+=2;break}}else if(e.length>t+8&&"D"===e[t+1]&&"O"===e[t+2]&&"C"===e[t+3]&&"T"===e[t+4]&&"Y"===e[t+5]&&"P"===e[t+6]&&"E"===e[t+7]){let i=1;for(t+=8;t<e.length;t++)if("<"===e[t])i++;else if(">"===e[t]&&(i--,0===i))break}else if(e.length>t+9&&"["===e[t+1]&&"C"===e[t+2]&&"D"===e[t+3]&&"A"===e[t+4]&&"T"===e[t+5]&&"A"===e[t+6]&&"["===e[t+7])for(t+=8;t<e.length;t++)if("]"===e[t]&&"]"===e[t+1]&&">"===e[t+2]){t+=2;break}return t}br.validate=function(e,t){t=Object.assign({},Br,t);const i=[];let s=!1,n=!1;"\ufeff"===e[0]&&(e=e.substr(1));for(let o=0;o<e.length;o++)if("<"===e[o]&&"?"===e[o+1]){if(o+=2,o=Yr(e,o),o.err)return o}else{if("<"!==e[o]){if(Vr(e[o]))continue;return Zr("InvalidChar","char '"+e[o]+"' is not expected.",qr(e,o))}{let a=o;if(o++,"!"===e[o]){o=Gr(e,o);continue}{let c=!1;"/"===e[o]&&(c=!0,o++);let l="";for(;o<e.length&&">"!==e[o]&&" "!==e[o]&&"\t"!==e[o]&&"\n"!==e[o]&&"\r"!==e[o];o++)l+=e[o];if(l=l.trim(),"/"===l[l.length-1]&&(l=l.substring(0,l.length-1),o--),r=l,!xr.isName(r)){let t;return t=0===l.trim().length?"Invalid space after '<'.":"Tag '"+l+"' is an invalid name.",Zr("InvalidTag",t,qr(e,o))}const h=Hr(e,o);if(!1===h)return Zr("InvalidAttr","Attributes for '"+l+"' have open quote.",qr(e,o));let I=h.value;if(o=h.index,"/"===I[I.length-1]){const i=o-I.length;I=I.substring(0,I.length-1);const n=Xr(I,t);if(!0!==n)return Zr(n.err.code,n.err.msg,qr(e,i+n.err.line));s=!0}else if(c){if(!h.tagClosed)return Zr("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",qr(e,o));if(I.trim().length>0)return Zr("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",qr(e,a));if(0===i.length)return Zr("InvalidTag","Closing tag '"+l+"' has not been opened.",qr(e,a));{const t=i.pop();if(l!==t.tagName){let i=qr(e,t.tagStartPos);return Zr("InvalidTag","Expected closing tag '"+t.tagName+"' (opened in line "+i.line+", col "+i.col+") instead of closing tag '"+l+"'.",qr(e,a))}0==i.length&&(n=!0)}}else{const r=Xr(I,t);if(!0!==r)return Zr(r.err.code,r.err.msg,qr(e,o-I.length+r.err.line));if(!0===n)return Zr("InvalidXml","Multiple possible root nodes found.",qr(e,o));-1!==t.unpairedTags.indexOf(l)||i.push({tagName:l,tagStartPos:a}),s=!0}for(o++;o<e.length;o++)if("<"===e[o]){if("!"===e[o+1]){o++,o=Gr(e,o);continue}if("?"!==e[o+1])break;if(o=Yr(e,++o),o.err)return o}else if("&"===e[o]){const t=jr(e,o);if(-1==t)return Zr("InvalidChar","char '&' is not expected.",qr(e,o));o=t}else if(!0===n&&!Vr(e[o]))return Zr("InvalidXml","Extra text at the end",qr(e,o));"<"===e[o]&&o--}}}var r;return s?1==i.length?Zr("InvalidTag","Unclosed tag '"+i[0].tagName+"'.",qr(e,i[0].tagStartPos)):!(i.length>0)||Zr("InvalidXml","Invalid '"+JSON.stringify(i.map((e=>e.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):Zr("InvalidXml","Start tag expected.",1)};const zr='"',kr="'";function Hr(e,t){let i="",s="",n=!1;for(;t<e.length;t++){if(e[t]===zr||e[t]===kr)""===s?s=e[t]:s!==e[t]||(s="");else if(">"===e[t]&&""===s){n=!0;break}i+=e[t]}return""===s&&{value:i,index:t,tagClosed:n}}const Wr=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function Xr(e,t){const i=xr.getAllMatches(e,Wr),s={};for(let e=0;e<i.length;e++){if(0===i[e][1].length)return Zr("InvalidAttr","Attribute '"+i[e][2]+"' has no space in starting.",Qr(i[e]));if(void 0!==i[e][3]&&void 0===i[e][4])return Zr("InvalidAttr","Attribute '"+i[e][2]+"' is without value.",Qr(i[e]));if(void 0===i[e][3]&&!t.allowBooleanAttributes)return Zr("InvalidAttr","boolean attribute '"+i[e][2]+"' is not allowed.",Qr(i[e]));const n=i[e][2];if(!$r(n))return Zr("InvalidAttr","Attribute '"+n+"' is an invalid name.",Qr(i[e]));if(s.hasOwnProperty(n))return Zr("InvalidAttr","Attribute '"+n+"' is repeated.",Qr(i[e]));s[n]=1}return!0}function jr(e,t){if(";"===e[++t])return-1;if("#"===e[t])return function(e,t){let i=/\d/;for("x"===e[t]&&(t++,i=/[\da-fA-F]/);t<e.length;t++){if(";"===e[t])return t;if(!e[t].match(i))break}return-1}(e,++t);let i=0;for(;t<e.length;t++,i++)if(!(e[t].match(/\w/)&&i<20)){if(";"===e[t])break;return-1}return t}function Zr(e,t,i){return{err:{code:e,msg:t,line:i.line||i,col:i.col}}}function $r(e){return xr.isName(e)}function qr(e,t){const i=e.substring(0,t).split(/\r?\n/);return{line:i.length,col:i[i.length-1].length+1}}function Qr(e){return e.startIndex+e[1].length}var Kr={};const Jr={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,i){return e}};Kr.buildOptions=function(e){return Object.assign({},Jr,e)},Kr.defaultOptions=Jr;var eo=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){"__proto__"===e&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){"__proto__"===e.tagname&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}};const to=Ur;function io(e,t){let i="";for(;t<e.length&&"'"!==e[t]&&'"'!==e[t];t++)i+=e[t];if(i=i.trim(),-1!==i.indexOf(" "))throw new Error("External entites are not supported");const s=e[t++];let n="";for(;t<e.length&&e[t]!==s;t++)n+=e[t];return[i,n,t]}function so(e,t){return"!"===e[t+1]&&"-"===e[t+2]&&"-"===e[t+3]}function no(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"N"===e[t+3]&&"T"===e[t+4]&&"I"===e[t+5]&&"T"===e[t+6]&&"Y"===e[t+7]}function ro(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"L"===e[t+3]&&"E"===e[t+4]&&"M"===e[t+5]&&"E"===e[t+6]&&"N"===e[t+7]&&"T"===e[t+8]}function oo(e,t){return"!"===e[t+1]&&"A"===e[t+2]&&"T"===e[t+3]&&"T"===e[t+4]&&"L"===e[t+5]&&"I"===e[t+6]&&"S"===e[t+7]&&"T"===e[t+8]}function ao(e,t){return"!"===e[t+1]&&"N"===e[t+2]&&"O"===e[t+3]&&"T"===e[t+4]&&"A"===e[t+5]&&"T"===e[t+6]&&"I"===e[t+7]&&"O"===e[t+8]&&"N"===e[t+9]}function co(e){if(to.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}var lo=function(e,t){const i={};if("O"!==e[t+3]||"C"!==e[t+4]||"T"!==e[t+5]||"Y"!==e[t+6]||"P"!==e[t+7]||"E"!==e[t+8])throw new Error("Invalid Tag instead of DOCTYPE");{t+=9;let s=1,n=!1,r=!1,o="";for(;t<e.length;t++)if("<"!==e[t]||r)if(">"===e[t]){if(r?"-"===e[t-1]&&"-"===e[t-2]&&(r=!1,s--):s--,0===s)break}else"["===e[t]?n=!0:o+=e[t];else{if(n&&no(e,t))t+=7,[entityName,val,t]=io(e,t+1),-1===val.indexOf("&")&&(i[co(entityName)]={regx:RegExp(`&${entityName};`,"g"),val:val});else if(n&&ro(e,t))t+=8;else if(n&&oo(e,t))t+=8;else if(n&&ao(e,t))t+=9;else{if(!so)throw new Error("Invalid DOCTYPE");r=!0}s++,o=""}if(0!==s)throw new Error("Unclosed DOCTYPE")}return{entities:i,i:t}};const ho=/^[-+]?0x[a-fA-F0-9]+$/,Io=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const uo={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};const Eo=Ur,fo=eo,po=lo,Co=function(e,t={}){if(t=Object.assign({},uo,t),!e||"string"!=typeof e)return e;let i=e.trim();if(void 0!==t.skipLike&&t.skipLike.test(i))return e;if(t.hex&&ho.test(i))return Number.parseInt(i,16);{const s=Io.exec(i);if(s){const n=s[1],r=s[2];let o=function(e){if(e&&-1!==e.indexOf("."))return"."===(e=e.replace(/0+$/,""))?e="0":"."===e[0]?e="0"+e:"."===e[e.length-1]&&(e=e.substr(0,e.length-1)),e;return e}(s[3]);const a=s[4]||s[6];if(!t.leadingZeros&&r.length>0&&n&&"."!==i[2])return e;if(!t.leadingZeros&&r.length>0&&!n&&"."!==i[1])return e;{const s=Number(i),c=""+s;return-1!==c.search(/[eE]/)||a?t.eNotation?s:e:-1!==i.indexOf(".")?"0"===c&&""===o||c===o||n&&c==="-"+o?s:e:r?o===c||n+o===c?s:e:i===c||i===n+c?s:e}}return e}};function To(e){const t=Object.keys(e);for(let i=0;i<t.length;i++){const s=t[i];this.lastEntities[s]={regex:new RegExp("&"+s+";","g"),val:e[s]}}}function mo(e,t,i,s,n,r,o){if(void 0!==e&&(this.options.trimValues&&!s&&(e=e.trim()),e.length>0)){o||(e=this.replaceEntitiesValue(e));const s=this.options.tagValueProcessor(t,e,i,n,r);if(null==s)return e;if(typeof s!=typeof e||s!==e)return s;if(this.options.trimValues)return wo(e,this.options.parseTagValue,this.options.numberParseOptions);return e.trim()===e?wo(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function Ro(e){if(this.options.removeNSPrefix){const t=e.split(":"),i="/"===e.charAt(0)?"/":"";if("xmlns"===t[0])return"";2===t.length&&(e=i+t[1])}return e}const go=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function Ao(e,t,i){if(!this.options.ignoreAttributes&&"string"==typeof e){const i=Eo.getAllMatches(e,go),s=i.length,n={};for(let e=0;e<s;e++){const s=this.resolveNameSpace(i[e][1]);let r=i[e][4],o=this.options.attributeNamePrefix+s;if(s.length)if(this.options.transformAttributeName&&(o=this.options.transformAttributeName(o)),"__proto__"===o&&(o="#__proto__"),void 0!==r){this.options.trimValues&&(r=r.trim()),r=this.replaceEntitiesValue(r);const e=this.options.attributeValueProcessor(s,r,t);n[o]=null==e?r:typeof e!=typeof r||e!==r?e:wo(r,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(n[o]=!0)}if(!Object.keys(n).length)return;if(this.options.attributesGroupName){const e={};return e[this.options.attributesGroupName]=n,e}return n}}const Fo=function(e){e=e.replace(/\r\n?/g,"\n");const t=new fo("!xml");let i=t,s="",n="";for(let r=0;r<e.length;r++){if("<"===e[r])if("/"===e[r+1]){const t=Lo(e,">",r,"Closing Tag is not closed.");let o=e.substring(r+2,t).trim();if(this.options.removeNSPrefix){const e=o.indexOf(":");-1!==e&&(o=o.substr(e+1))}this.options.transformTagName&&(o=this.options.transformTagName(o)),i&&(s=this.saveTextToParentTag(s,i,n));const a=n.substring(n.lastIndexOf(".")+1);if(o&&-1!==this.options.unpairedTags.indexOf(o))throw new Error(`Unpaired tag can not be used as closing tag: </${o}>`);let c=0;a&&-1!==this.options.unpairedTags.indexOf(a)?(c=n.lastIndexOf(".",n.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=n.lastIndexOf("."),n=n.substring(0,c),i=this.tagsNodeStack.pop(),s="",r=t}else if("?"===e[r+1]){let t=_o(e,r,!1,"?>");if(!t)throw new Error("Pi Tag is not closed.");if(s=this.saveTextToParentTag(s,i,n),this.options.ignoreDeclaration&&"?xml"===t.tagName||this.options.ignorePiTags);else{const e=new fo(t.tagName);e.add(this.options.textNodeName,""),t.tagName!==t.tagExp&&t.attrExpPresent&&(e[":@"]=this.buildAttributesMap(t.tagExp,n,t.tagName)),this.addChild(i,e,n)}r=t.closeIndex+1}else if("!--"===e.substr(r+1,3)){const t=Lo(e,"--\x3e",r+4,"Comment is not closed.");if(this.options.commentPropName){const o=e.substring(r+4,t-2);s=this.saveTextToParentTag(s,i,n),i.add(this.options.commentPropName,[{[this.options.textNodeName]:o}])}r=t}else if("!D"===e.substr(r+1,2)){const t=po(e,r);this.docTypeEntities=t.entities,r=t.i}else if("!["===e.substr(r+1,2)){const t=Lo(e,"]]>",r,"CDATA is not closed.")-2,o=e.substring(r+9,t);s=this.saveTextToParentTag(s,i,n);let a=this.parseTextData(o,i.tagname,n,!0,!1,!0,!0);null==a&&(a=""),this.options.cdataPropName?i.add(this.options.cdataPropName,[{[this.options.textNodeName]:o}]):i.add(this.options.textNodeName,a),r=t+2}else{let o=_o(e,r,this.options.removeNSPrefix),a=o.tagName;const c=o.rawTagName;let l=o.tagExp,h=o.attrExpPresent,I=o.closeIndex;this.options.transformTagName&&(a=this.options.transformTagName(a)),i&&s&&"!xml"!==i.tagname&&(s=this.saveTextToParentTag(s,i,n,!1));const u=i;if(u&&-1!==this.options.unpairedTags.indexOf(u.tagname)&&(i=this.tagsNodeStack.pop(),n=n.substring(0,n.lastIndexOf("."))),a!==t.tagname&&(n+=n?"."+a:a),this.isItStopNode(this.options.stopNodes,n,a)){let t="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)"/"===a[a.length-1]?(a=a.substr(0,a.length-1),n=n.substr(0,n.length-1),l=a):l=l.substr(0,l.length-1),r=o.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(a))r=o.closeIndex;else{const i=this.readStopNodeData(e,c,I+1);if(!i)throw new Error(`Unexpected end of ${c}`);r=i.i,t=i.tagContent}const s=new fo(a);a!==l&&h&&(s[":@"]=this.buildAttributesMap(l,n,a)),t&&(t=this.parseTextData(t,a,n,!0,h,!0,!0)),n=n.substr(0,n.lastIndexOf(".")),s.add(this.options.textNodeName,t),this.addChild(i,s,n)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===a[a.length-1]?(a=a.substr(0,a.length-1),n=n.substr(0,n.length-1),l=a):l=l.substr(0,l.length-1),this.options.transformTagName&&(a=this.options.transformTagName(a));const e=new fo(a);a!==l&&h&&(e[":@"]=this.buildAttributesMap(l,n,a)),this.addChild(i,e,n),n=n.substr(0,n.lastIndexOf("."))}else{const e=new fo(a);this.tagsNodeStack.push(i),a!==l&&h&&(e[":@"]=this.buildAttributesMap(l,n,a)),this.addChild(i,e,n),i=e}s="",r=I}}else s+=e[r]}return t.child};function So(e,t,i){const s=this.options.updateTag(t.tagname,i,t[":@"]);!1===s||("string"==typeof s?(t.tagname=s,e.addChild(t)):e.addChild(t))}const Oo=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const i=this.docTypeEntities[t];e=e.replace(i.regx,i.val)}for(let t in this.lastEntities){const i=this.lastEntities[t];e=e.replace(i.regex,i.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const i=this.htmlEntities[t];e=e.replace(i.regex,i.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function No(e,t,i,s){return e&&(void 0===s&&(s=0===Object.keys(t.child).length),void 0!==(e=this.parseTextData(e,t.tagname,i,!1,!!t[":@"]&&0!==Object.keys(t[":@"]).length,s))&&""!==e&&t.add(this.options.textNodeName,e),e=""),e}function yo(e,t,i){const s="*."+i;for(const i in e){const n=e[i];if(s===n||t===n)return!0}return!1}function Lo(e,t,i,s){const n=e.indexOf(t,i);if(-1===n)throw new Error(s);return n+t.length-1}function _o(e,t,i,s=">"){const n=function(e,t,i=">"){let s,n="";for(let r=t;r<e.length;r++){let t=e[r];if(s)t===s&&(s="");else if('"'===t||"'"===t)s=t;else if(t===i[0]){if(!i[1])return{data:n,index:r};if(e[r+1]===i[1])return{data:n,index:r}}else"\t"===t&&(t=" ");n+=t}}(e,t+1,s);if(!n)return;let r=n.data;const o=n.index,a=r.search(/\s/);let c=r,l=!0;-1!==a&&(c=r.substring(0,a),r=r.substring(a+1).trimStart());const h=c;if(i){const e=c.indexOf(":");-1!==e&&(c=c.substr(e+1),l=c!==n.data.substr(e+1))}return{tagName:c,tagExp:r,closeIndex:o,attrExpPresent:l,rawTagName:h}}function Po(e,t,i){const s=i;let n=1;for(;i<e.length;i++)if("<"===e[i])if("/"===e[i+1]){const r=Lo(e,">",i,`${t} is not closed`);if(e.substring(i+2,r).trim()===t&&(n--,0===n))return{tagContent:e.substring(s,i),i:r};i=r}else if("?"===e[i+1]){i=Lo(e,"?>",i+1,"StopNode is not closed.")}else if("!--"===e.substr(i+1,3)){i=Lo(e,"--\x3e",i+3,"StopNode is not closed.")}else if("!["===e.substr(i+1,2)){i=Lo(e,"]]>",i,"StopNode is not closed.")-2}else{const s=_o(e,i,">");if(s){(s&&s.tagName)===t&&"/"!==s.tagExp[s.tagExp.length-1]&&n++,i=s.closeIndex}}}function wo(e,t,i){if(t&&"string"==typeof e){const t=e.trim();return"true"===t||"false"!==t&&Co(e,i)}return Eo.isExist(e)?e:""}var Mo=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,16))}},this.addExternalEntities=To,this.parseXml=Fo,this.parseTextData=mo,this.resolveNameSpace=Ro,this.buildAttributesMap=Ao,this.isItStopNode=yo,this.replaceEntitiesValue=Oo,this.readStopNodeData=Po,this.saveTextToParentTag=No,this.addChild=So}},vo={};function Do(e,t,i){let s;const n={};for(let r=0;r<e.length;r++){const o=e[r],a=bo(o);let c="";if(c=void 0===i?a:i+"."+a,a===t.textNodeName)void 0===s?s=o[a]:s+=""+o[a];else{if(void 0===a)continue;if(o[a]){let e=Do(o[a],t,c);const i=xo(e,t);o[":@"]?Uo(e,o[":@"],c,t):1!==Object.keys(e).length||void 0===e[t.textNodeName]||t.alwaysCreateTextNode?0===Object.keys(e).length&&(t.alwaysCreateTextNode?e[t.textNodeName]="":e=""):e=e[t.textNodeName],void 0!==n[a]&&n.hasOwnProperty(a)?(Array.isArray(n[a])||(n[a]=[n[a]]),n[a].push(e)):t.isArray(a,c,i)?n[a]=[e]:n[a]=e}}}return"string"==typeof s?s.length>0&&(n[t.textNodeName]=s):void 0!==s&&(n[t.textNodeName]=s),n}function bo(e){const t=Object.keys(e);for(let e=0;e<t.length;e++){const i=t[e];if(":@"!==i)return i}}function Uo(e,t,i,s){if(t){const n=Object.keys(t),r=n.length;for(let o=0;o<r;o++){const r=n[o];s.isArray(r,i+"."+r,!0,!0)?e[r]=[t[r]]:e[r]=t[r]}}}function xo(e,t){const{textNodeName:i}=t,s=Object.keys(e).length;return 0===s||!(1!==s||!e[i]&&"boolean"!=typeof e[i]&&0!==e[i])}vo.prettify=function(e,t){return Do(e,t)};const{buildOptions:Bo}=Kr,Vo=Mo,{prettify:Yo}=vo,Go=br;var zo=class{constructor(e){this.externalEntities={},this.options=Bo(e)}parse(e,t){if("string"==typeof e);else{if(!e.toString)throw new Error("XML data is accepted in String or Bytes[] form.");e=e.toString()}if(t){!0===t&&(t={});const i=Go.validate(e,t);if(!0!==i)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const i=new Vo(this.options);i.addExternalEntities(this.externalEntities);const s=i.parseXml(e);return this.options.preserveOrder||void 0===s?s:Yo(s,this.options)}addEntity(e,t){if(-1!==t.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==e.indexOf("&")||-1!==e.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if("&"===t)throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}};function ko(e,t,i,s){let n="",r=!1;for(let o=0;o<e.length;o++){const a=e[o],c=Ho(a);if(void 0===c)continue;let l="";if(l=0===i.length?c:`${i}.${c}`,c===t.textNodeName){let e=a[c];Xo(l,t)||(e=t.tagValueProcessor(c,e),e=jo(e,t)),r&&(n+=s),n+=e,r=!1;continue}if(c===t.cdataPropName){r&&(n+=s),n+=`<![CDATA[${a[c][0][t.textNodeName]}]]>`,r=!1;continue}if(c===t.commentPropName){n+=s+`\x3c!--${a[c][0][t.textNodeName]}--\x3e`,r=!0;continue}if("?"===c[0]){const e=Wo(a[":@"],t),i="?xml"===c?"":s;let o=a[c][0][t.textNodeName];o=0!==o.length?" "+o:"",n+=i+`<${c}${o}${e}?>`,r=!0;continue}let h=s;""!==h&&(h+=t.indentBy);const I=s+`<${c}${Wo(a[":@"],t)}`,u=ko(a[c],t,l,h);-1!==t.unpairedTags.indexOf(c)?t.suppressUnpairedNode?n+=I+">":n+=I+"/>":u&&0!==u.length||!t.suppressEmptyNode?u&&u.endsWith(">")?n+=I+`>${u}${s}</${c}>`:(n+=I+">",u&&""!==s&&(u.includes("/>")||u.includes("</"))?n+=s+t.indentBy+u+s:n+=u,n+=`</${c}>`):n+=I+"/>",r=!0}return n}function Ho(e){const t=Object.keys(e);for(let i=0;i<t.length;i++){const s=t[i];if(e.hasOwnProperty(s)&&":@"!==s)return s}}function Wo(e,t){let i="";if(e&&!t.ignoreAttributes)for(let s in e){if(!e.hasOwnProperty(s))continue;let n=t.attributeValueProcessor(s,e[s]);n=jo(n,t),!0===n&&t.suppressBooleanAttributes?i+=` ${s.substr(t.attributeNamePrefix.length)}`:i+=` ${s.substr(t.attributeNamePrefix.length)}="${n}"`}return i}function Xo(e,t){let i=(e=e.substr(0,e.length-t.textNodeName.length-1)).substr(e.lastIndexOf(".")+1);for(let s in t.stopNodes)if(t.stopNodes[s]===e||t.stopNodes[s]==="*."+i)return!0;return!1}function jo(e,t){if(e&&e.length>0&&t.processEntities)for(let i=0;i<t.entities.length;i++){const s=t.entities[i];e=e.replace(s.regex,s.val)}return e}const Zo=function(e,t){let i="";return t.format&&t.indentBy.length>0&&(i="\n"),ko(e,t,"",i)},$o={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function qo(e){this.options=Object.assign({},$o,e),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Jo),this.processTextOrObjNode=Qo,this.options.format?(this.indentate=Ko,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function Qo(e,t,i){const s=this.j2x(e,i+1);return void 0!==e[this.options.textNodeName]&&1===Object.keys(e).length?this.buildTextValNode(e[this.options.textNodeName],t,s.attrStr,i):this.buildObjectNode(s.val,t,s.attrStr,i)}function Ko(e){return this.options.indentBy.repeat(e)}function Jo(e){return!(!e.startsWith(this.options.attributeNamePrefix)||e===this.options.textNodeName)&&e.substr(this.attrPrefixLen)}qo.prototype.build=function(e){return this.options.preserveOrder?Zo(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)},qo.prototype.j2x=function(e,t){let i="",s="";for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n))if(void 0===e[n])this.isAttribute(n)&&(s+="");else if(null===e[n])this.isAttribute(n)?s+="":"?"===n[0]?s+=this.indentate(t)+"<"+n+"?"+this.tagEndChar:s+=this.indentate(t)+"<"+n+"/"+this.tagEndChar;else if(e[n]instanceof Date)s+=this.buildTextValNode(e[n],n,"",t);else if("object"!=typeof e[n]){const r=this.isAttribute(n);if(r)i+=this.buildAttrPairStr(r,""+e[n]);else if(n===this.options.textNodeName){let t=this.options.tagValueProcessor(n,""+e[n]);s+=this.replaceEntitiesValue(t)}else s+=this.buildTextValNode(e[n],n,"",t)}else if(Array.isArray(e[n])){const i=e[n].length;let r="",o="";for(let a=0;a<i;a++){const i=e[n][a];if(void 0===i);else if(null===i)"?"===n[0]?s+=this.indentate(t)+"<"+n+"?"+this.tagEndChar:s+=this.indentate(t)+"<"+n+"/"+this.tagEndChar;else if("object"==typeof i)if(this.options.oneListGroup){const e=this.j2x(i,t+1);r+=e.val,this.options.attributesGroupName&&i.hasOwnProperty(this.options.attributesGroupName)&&(o+=e.attrStr)}else r+=this.processTextOrObjNode(i,n,t);else if(this.options.oneListGroup){let e=this.options.tagValueProcessor(n,i);e=this.replaceEntitiesValue(e),r+=e}else r+=this.buildTextValNode(i,n,"",t)}this.options.oneListGroup&&(r=this.buildObjectNode(r,n,o,t)),s+=r}else if(this.options.attributesGroupName&&n===this.options.attributesGroupName){const t=Object.keys(e[n]),s=t.length;for(let r=0;r<s;r++)i+=this.buildAttrPairStr(t[r],""+e[n][t[r]])}else s+=this.processTextOrObjNode(e[n],n,t);return{attrStr:i,val:s}},qo.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&"true"===t?" "+e:" "+e+'="'+t+'"'},qo.prototype.buildObjectNode=function(e,t,i,s){if(""===e)return"?"===t[0]?this.indentate(s)+"<"+t+i+"?"+this.tagEndChar:this.indentate(s)+"<"+t+i+this.closeTag(t)+this.tagEndChar;{let n="</"+t+this.tagEndChar,r="";return"?"===t[0]&&(r="?",n=""),!i&&""!==i||-1!==e.indexOf("<")?!1!==this.options.commentPropName&&t===this.options.commentPropName&&0===r.length?this.indentate(s)+`\x3c!--${e}--\x3e`+this.newLine:this.indentate(s)+"<"+t+i+r+this.tagEndChar+e+this.indentate(s)+n:this.indentate(s)+"<"+t+i+r+">"+e+n}},qo.prototype.closeTag=function(e){let t="";return-1!==this.options.unpairedTags.indexOf(e)?this.options.suppressUnpairedNode||(t="/"):t=this.options.suppressEmptyNode?"/":`></${e}`,t},qo.prototype.buildTextValNode=function(e,t,i,s){if(!1!==this.options.cdataPropName&&t===this.options.cdataPropName)return this.indentate(s)+`<![CDATA[${e}]]>`+this.newLine;if(!1!==this.options.commentPropName&&t===this.options.commentPropName)return this.indentate(s)+`\x3c!--${e}--\x3e`+this.newLine;if("?"===t[0])return this.indentate(s)+"<"+t+i+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(t,e);return n=this.replaceEntitiesValue(n),""===n?this.indentate(s)+"<"+t+i+this.closeTag(t)+this.tagEndChar:this.indentate(s)+"<"+t+i+">"+n+"</"+t+this.tagEndChar}},qo.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const i=this.options.entities[t];e=e.replace(i.regex,i.val)}return e};var ea={XMLParser:zo,XMLValidator:br,XMLBuilder:qo};class ta{constructor(e,i){t(this,"date",new Date),t(this,"author"),t(this,"guid",Gi.create()),t(this,"viewpoint"),t(this,"modifiedAuthor"),t(this,"modifiedDate"),t(this,"topic"),t(this,"_components"),t(this,"_comment",""),this._components=e,this._comment=i;const s=this._components.get(aa);this.author=s.config.author}set comment(e){var t;const i=this._components.get(aa);this._comment=e,this.modifiedDate=new Date,this.modifiedAuthor=i.config.author,null==(t=this.topic)||t.comments.set(this.guid,this)}get comment(){return this._comment}serialize(){let e=null;this.viewpoint&&(e=`<Viewpoint Guid="${this.viewpoint.guid}"/>`);let t=null;this.modifiedDate&&(t=`<ModifiedDate>${this.modifiedDate.toISOString()}</ModifiedDate>`);let i=null;return this.modifiedAuthor&&(i=`<ModifiedAuthor>${this.modifiedAuthor}</ModifiedAuthor>`),`\n <Comment Guid="${this.guid}">\n <Date>${this.date.toISOString()}</Date>\n <Author>${this.author}</Author>\n <Comment>${this.comment}</Comment>\n ${e??""}\n ${i??""}\n ${t??""}\n </Comment>\n `}}const ia=class e{constructor(i){t(this,"guid",Gi.create()),t(this,"title",e.default.title),t(this,"creationDate",new Date),t(this,"creationAuthor",""),t(this,"viewpoints",new Ci),t(this,"relatedTopics",new Ci),t(this,"comments",new Ti),t(this,"customData",{}),t(this,"description"),t(this,"serverAssignedId"),t(this,"dueDate"),t(this,"modifiedAuthor"),t(this,"modifiedDate"),t(this,"index"),t(this,"_type",e.default.type),t(this,"_status",e.default.status),t(this,"_priority",e.default.priority),t(this,"_stage",e.default.priority),t(this,"_assignedTo",e.default.assignedTo),t(this,"_labels",e.default.labels),t(this,"_components"),this._components=i;const s=i.get(aa);this.creationAuthor=s.config.author,this.relatedTopics.guard=e=>e!==this.guid}set type(e){const t=this._components.get(aa),{strict:i,types:s}=t.config;(!i||s.has(e))&&(this._type=e)}get type(){return this._type}set status(e){const t=this._components.get(aa),{strict:i,statuses:s}=t.config;(!i||s.has(e))&&(this._status=e)}get status(){return this._status}set priority(e){const t=this._components.get(aa);if(e){const{strict:i,priorities:s}=t.config;if(!(!i||s.has(e)))return;this._priority=e}else this._priority=e}get priority(){return this._priority}set stage(e){const t=this._components.get(aa);if(e){const{strict:i,stages:s}=t.config;if(!(!i||s.has(e)))return;this._stage=e}else this._stage=e}get stage(){return this._stage}set assignedTo(e){const t=this._components.get(aa);if(e){const{strict:i,users:s}=t.config;if(!(!i||s.has(e)))return;this._assignedTo=e}else this._assignedTo=e}get assignedTo(){return this._assignedTo}set labels(e){const t=this._components.get(aa),{strict:i,labels:s}=t.config;if(i){const t=new Set;for(const n of e){(!i||s.has(n))&&t.add(n)}this._labels=t}else this._labels=e}get labels(){return this._labels}get _managerVersion(){return this._components.get(aa).config.version}set(e){const t=e,i=this;for(const s in e){if("guid"===s)continue;const e=t[s];s in this&&(i[s]=e)}return this._components.get(aa).list.set(this.guid,this),this}createComment(e,t){const i=new ta(this._components,e);return i.viewpoint=t,i.topic=this,this.comments.set(i.guid,i),i}createLabelTags(e=this._managerVersion){let t="Labels";"2.1"===e&&(t="Labels"),"3"===e&&(t="Label");let i=[...this.labels].map((e=>`<${t}>${e}</${t}>`)).join("\n");for(const e in this.customData){const s=this.customData[e];"string"==typeof s&&(i+=`\n<${t}>${s}</${t}>`)}return"2.1"===e?i:"3"===e?0!==i.length?`<Labels>\n${i}\n</Labels>`:"<Labels/>":i}createCommentTags(e=this._managerVersion){const t=[...this.comments.values()].map((e=>e.serialize())).join("\n");return"2.1"===e?t:"3"===e?0!==t.length?`<Comments>\n${t}\n</Comments>`:"<Comments/>":t}createViewpointTags(e=this._managerVersion){let t="Viewpoints";"2.1"===e&&(t="Viewpoints"),"3"===e&&(t="ViewPoint");const i=this._components.get(va),s=[...this.viewpoints].map((e=>i.list.get(e))).filter((e=>e)).map((e=>`<${t} Guid="${e.guid}">\n <Viewpoint>${e.guid}.bcfv</Viewpoint>\n <Snapshot>${e.guid}.jpeg</Snapshot>\n </${t}>\n `)).join("\n");return"2.1"===e?s:"3"===e?0!==s.length?`<Viewpoints>\n${s}\n</Viewpoints>`:"<Viewpoints />":s}createRelatedTopicTags(e=this._managerVersion){const t=[...this.relatedTopics].map((e=>`<RelatedTopic Guid="${e}"></RelatedTopic>\n `)).join("\n");return"2.1"===e?t:"3"===e?0!==t.length?`<RelatedTopics>\n${t}\n</RelatedTopics>`:"<RelatedTopics />":t}serialize(){const e=this._managerVersion;let t=null;this.serverAssignedId&&(t=`ServerAssignedId="${this.serverAssignedId}"`);let i=null;this.priority&&(i=`<Priority>${this.priority}</Priority>`);let s=null;this.index&&"2.1"===e&&(s=`<Index>${this.index}</Index>`);let n=null;this.modifiedDate&&(n=`<ModifiedDate>${this.modifiedDate.toISOString()}</ModifiedDate>`);let r=null;this.modifiedAuthor&&(r=`<ModifiedAuthor>${this.modifiedAuthor}</ModifiedAuthor>`);let o=null;this.dueDate&&(o=`<DueDate>${this.dueDate.toISOString()}</DueDate>`);let a=null;this.assignedTo&&(a=`<AssignedTo>${this.assignedTo}</AssignedTo>`);let c=null;this.description&&(c=`<Description>${this.description}</Description>`);let l=null;this.stage&&(l=`<Stage>${this.stage}</Stage>`);const h=this.createCommentTags(e),I=this.createViewpointTags(e),u=this.createLabelTags(e),d=this.createRelatedTopicTags(e);return`\n <?xml version="1.0" encoding="UTF-8"?>\n <Markup>\n <Topic Guid="${this.guid}" TopicType="${this.type}" TopicStatus="${this.status}" ${t??""}>\n <Title>${this.title}</Title>\n <CreationDate>${this.creationDate.toISOString()}</CreationDate>\n <CreationAuthor>${this.creationAuthor}</CreationAuthor>\n ${i??""}\n ${s??""}\n ${n??""}\n ${r??""}\n ${o??""}\n ${a??""}\n ${c??""}\n ${l??""}\n ${u}\n ${d}\n ${"3"===e?h:""}\n ${"3"===e?I:""}\n </Topic>\n ${"2.1"===e?h:""}\n ${"2.1"===e?I:""}\n </Markup>\n `}};t(ia,"default",{title:"BCF Topic",type:"Issue",status:"Active",labels:new Set});let sa=ia;const na=(e,t)=>{if(""===t.trim())return;const i=aa.xmlParser.parse(t).Extensions;if(!i)return;const{Priorities:s,TopicStatuses:n,TopicTypes:r,Users:o}=i;if(s&&s.Priority){const t=Array.isArray(s.Priority)?s.Priority:[s.Priority];for(const i of t)e.config.priorities.add(i)}if(n&&n.TopicStatus){const t=Array.isArray(n.TopicStatus)?n.TopicStatus:[n.TopicStatus];for(const i of t)e.config.statuses.add(i)}if(r&&r.TopicType){const t=Array.isArray(r.TopicType)?r.TopicType:[r.TopicType];for(const i of t)e.config.types.add(i)}if(o&&o.User){const t=Array.isArray(o.User)?o.User:[o.User];for(const i of t)e.config.users.add(i)}};class ra extends Xi{constructor(){super(...arguments),t(this,"_config",{version:{type:"Select",options:new Set(["2.1","3"]),multiple:!1,value:""},author:{type:"Text",value:""},types:{type:"TextSet",value:new Set},statuses:{type:"TextSet",value:new Set},priorities:{type:"TextSet",value:new Set},labels:{type:"TextSet",value:new Set},stages:{type:"TextSet",value:new Set},users:{type:"TextSet",value:new Set},includeSelectionTag:{type:"Boolean",value:!1},updateExtensionsOnImport:{type:"Boolean",value:!1},strict:{type:"Boolean",value:!1},includeAllExtensionsOnExport:{type:"Boolean",value:!1},fallbackVersionOnImport:{type:"Select",multiple:!1,options:new Set(["2.1","3"]),value:""},ignoreIncompleteTopicsOnImport:{type:"Boolean",value:!1}})}get version(){return this._config.version.value}set version(e){this._config.version.value=e}get author(){return this._config.author.value}set author(e){this._config.author.value=e}get types(){return this._config.types.value}set types(e){this._config.types.value=e}get statuses(){return this._config.statuses.value}set statuses(e){this._config.statuses.value=e}get priorities(){return this._config.priorities.value}set priorities(e){this._config.priorities.value=e}get labels(){return this._config.labels.value}set labels(e){this._config.labels.value=e}get stages(){return this._config.stages.value}set stages(e){this._config.stages.value=e}get users(){return this._config.users.value}set users(e){this._config.users.value=e}get includeSelectionTag(){return this._config.includeSelectionTag.value}set includeSelectionTag(e){this._config.includeSelectionTag.value=e}get updateExtensionsOnImport(){return this._config.updateExtensionsOnImport.value}set updateExtensionsOnImport(e){this._config.updateExtensionsOnImport.value=e}get strict(){return this._config.strict.value}set strict(e){this._config.strict.value=e}get includeAllExtensionsOnExport(){return this._config.includeAllExtensionsOnExport.value}set includeAllExtensionsOnExport(e){this._config.includeAllExtensionsOnExport.value=e}get fallbackVersionOnImport(){return this._config.fallbackVersionOnImport.value}set fallbackVersionOnImport(e){this._config.fallbackVersionOnImport.value=e}get ignoreIncompleteTopicsOnImport(){return this._config.ignoreIncompleteTopicsOnImport.value}set ignoreIncompleteTopicsOnImport(e){this._config.ignoreIncompleteTopicsOnImport.value=e}}const oa=class e extends hi{constructor(){super(...arguments),t(this,"enabled",!1),t(this,"_defaultConfig",{author:"jhon.doe@example.com",version:"2.1",types:new Set(["Clash","Failure","Fault","Inquiry","Issue","Remark","Request"]),statuses:new Set(["Active","In Progress","Done","In Review","Closed"]),priorities:new Set(["On hold","Minor","Normal","Major","Critical"]),labels:new Set,stages:new Set,users:new Set,includeSelectionTag:!1,updateExtensionsOnImport:!0,strict:!1,includeAllExtensionsOnExport:!0,fallbackVersionOnImport:"2.1",ignoreIncompleteTopicsOnImport:!1}),t(this,"config",new ra(this,this.components,"BCF Topics",e.uuid)),t(this,"list",new Ti),t(this,"onSetup",new ai),t(this,"isSetup",!1),t(this,"onBCFImported",new ai),t(this,"onDisposed",new ai)}setup(e){if(this.isSetup)return;const t={...this._defaultConfig,...e};this.config.version=t.version,this.config.author=t.author,this.config.types=t.types,this.config.statuses=t.statuses,this.config.priorities=t.priorities,this.config.labels=t.labels,this.config.stages=t.stages,this.config.users=t.users,this.config.includeSelectionTag=t.includeSelectionTag,this.config.updateExtensionsOnImport=t.updateExtensionsOnImport,this.config.strict=t.strict,this.config.includeAllExtensionsOnExport=t.includeAllExtensionsOnExport,this.config.fallbackVersionOnImport=t.fallbackVersionOnImport||"",this.config.ignoreIncompleteTopicsOnImport=t.ignoreIncompleteTopicsOnImport,this.isSetup=!0,this.enabled=!0,this.onSetup.trigger()}create(e){const t=new sa(this.components);return e&&(t.guid=e.guid??t.guid,t.set(e)),this.list.set(t.guid,t),t}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get usedTypes(){const e=[...this.list].map((([e,t])=>t.type));return new Set(e)}get usedStatuses(){const e=[...this.list].map((([e,t])=>t.status));return new Set(e)}get usedPriorities(){const e=[...this.list].map((([e,t])=>t.priority)).filter((e=>e));return new Set(e)}get usedStages(){const e=[...this.list].map((([e,t])=>t.stage)).filter((e=>e));return new Set(e)}get usedUsers(){const e=[];for(const[t,i]of this.list){e.push(i.creationAuthor),i.assignedTo&&e.push(i.assignedTo),i.modifiedAuthor&&e.push(i.modifiedAuthor);for(const[t,s]of i.comments)e.push(s.author),s.modifiedAuthor&&e.push(s.modifiedAuthor)}return new Set(e)}get usedLabels(){const e=[];for(const[t,i]of this.list)e.push(...i.labels);return new Set(e)}updateExtensions(){for(const[e,t]of this.list){for(const e of t.labels)this.config.labels.add(e);this.config.types.add(t.type),t.priority&&this.config.priorities.add(t.priority),t.stage&&this.config.stages.add(t.stage),this.config.statuses.add(t.status),this.config.users.add(t.creationAuthor),t.assignedTo&&this.config.users.add(t.assignedTo),t.modifiedAuthor&&this.config.users.add(t.modifiedAuthor);for(const[e,i]of t.comments)this.config.users.add(i.author),i.modifiedAuthor&&this.config.users.add(i.modifiedAuthor)}}updateViewpointReferences(){const e=this.components.get(va);for(const[t,i]of this.list)for(const t of i.viewpoints){e.list.has(t)||i.viewpoints.delete(t)}}async export(e=this.list.values()){const t=new Dr;t.file("bcf.version",`<?xml version="1.0" encoding="UTF-8"?>\n <Version VersionId="${this.config.version}" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/buildingSMART/BCF-XML/release_3_0/Schemas/version.xsd"\n xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\n </Version>`),t.file("bcf.extensions",this.serializeExtensions());const i=await fetch("https://thatopen.github.io/engine_components/resources/favicon.ico"),s=await i.arrayBuffer(),n=this.components.get(va);for(const i of e){const e=t.folder(i.guid);e.file("markup.bcf",i.serialize());for(const t of i.viewpoints){const i=n.list.get(t);i&&(e.file(`${t}.jpeg`,s,{binary:!0}),e.file(`${t}.bcfv`,await i.serialize()))}}return await t.generateAsync({type:"blob"})}serializeExtensions(){const e=[...this.config.types].map((e=>`<TopicType>${e}</TopicType>`)).join("\n"),t=[...this.config.statuses].map((e=>`<TopicStatus>${e}</TopicStatus>`)).join("\n"),i=[...this.config.priorities].map((e=>`<Priority>${e}</Priority>`)).join("\n"),s=[...this.config.labels].map((e=>`<TopicLabel>${e}</TopicLabel>`)).join("\n"),n=[...this.config.stages].map((e=>`<Stage>${e}</Stage>`)).join("\n"),r=[...this.config.users].map((e=>`<User>${e}</User>`)).join("\n");return`\n <?xml version="1.0" encoding="UTF-8"?>\n <Extensions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="your-schema-location.xsd">\n ${0!==e.length?`<TopicTypes>\n${e}\n</TopicTypes>`:""}\n ${0!==t.length?`<TopicStatuses>\n${t}\n</TopicStatuses>`:""}\n ${0!==i.length?`<Priorities>\n${i}\n</Priorities>`:""}\n ${0!==s.length?`<TopicLabels>\n${s}\n</TopicLabels>`:""}\n ${0!==n.length?`<Stages>\n${n}\n</Stages>`:""}\n ${0!==r.length?`<Users>\n${r}\n</Users>`:""}\n </Extensions>\n `}processMarkupComment(e){const{Guid:t,Date:i,Author:s,Comment:n,Viewpoint:r}=e;if(!(t&&i&&s&&(ta||r)))return null;const o=this.components.get(va),a=new ta(this.components,n??"");return a.guid=t,a.date=new Date(i),a.author=s,a.viewpoint=(null==r?void 0:r.Guid)?o.list.get(r.Guid):void 0,a.modifiedAuthor=e.ModifiedAuthor,a.modifiedDate=e.ModifiedDate?new Date(e.ModifiedDate):void 0,a}getMarkupComments(e,t){var i;let s;if("2.1"===t&&(s=e.Comment),"3"===t&&(s=null==(i=e.Topic.Comments)?void 0:i.Comment),!s)return[];s=Array.isArray(s)?s:[s];const n=s.map((e=>this.processMarkupComment(e))).filter((e=>e));return Array.isArray(n)?n:[n]}getMarkupLabels(e,t){var i;let s;if("2.1"===t&&(s=e.Topic.Labels),"3"===t&&(s=null==(i=e.Topic.Labels)?void 0:i.Label),!s)return[];return Array.isArray(s)?s:[s]}getMarkupViewpoints(e,t){var i;let s;return"2.1"===t&&(s=e.Viewpoints),"3"===t&&(s=null==(i=e.Topic.Viewpoints)?void 0:i.ViewPoint),s?(s=Array.isArray(s)?s:[s],s):[]}getMarkupRelatedTopics(e,t){var i;let s;if("2.1"===t&&(s=e.Topic.RelatedTopic),"3"===t&&(s=null==(i=e.Topic.RelatedTopics)?void 0:i.RelatedTopic),!s)return[];return(Array.isArray(s)?s:[s]).map((e=>e.Guid))}async load(t,s){var n;const{fallbackVersionOnImport:r,ignoreIncompleteTopicsOnImport:o,updateExtensionsOnImport:a}=this.config,c=new Dr;await c.loadAsync(t);const l=Object.values(c.files);let h=r;const I=l.find((e=>e.name.endsWith(".version")));if(I){const t=await I.async("string"),i=e.xmlParser.parse(t).Version.VersionId;h=String(i)}if(!h||"2.1"!==h&&"3"!==h)throw new Error(`BCFTopics: ${h} is not supported.`);const u=l.find((e=>e.name.endsWith(".extensions")));if(a&&u){const e=await u.async("string");na(this,e)}const d=[],E=this.components.get(va),f=l.filter((e=>e.name.endsWith(".bcfv")));for(const t of f){const r=await t.async("string"),o=e.xmlParser.parse(r).VisualizationInfo;if(!o){console.warn("Missing VisualizationInfo in Viewpoint");continue}const a={},{Guid:c,ClippingPlanes:l,Components:I,OrthogonalCamera:u,PerspectiveCamera:E}=o;if(c&&(a.guid=c),I){const{Selection:e,Visibility:t}=I;if(e&&e.Component){const t=Array.isArray(e.Component)?e.Component:[e.Component];a.selectionComponents=t.map((e=>e.IfcGuid)).filter((e=>e))}if(t&&"DefaultVisibility"in t&&(a.defaultVisibility=t.DefaultVisibility),t&&t.Exceptions&&"Component"in t.Exceptions){const{Component:e}=t.Exceptions,i=Array.isArray(e)?e:[e];a.exceptionComponents=i.map((e=>e.IfcGuid)).filter((e=>e))}let i;"2.1"===h&&(i=I.ViewSetupHints),"3"===h&&(i=null==(n=I.Visibility)?void 0:n.ViewSetupHints),i&&("OpeningsVisible"in i&&(a.openingsVisible=i.OpeningsVisible),"SpacesVisible"in i&&(a.spacesVisible=i.SpacesVisible),"SpaceBoundariesVisible"in i&&(a.spaceBoundariesVisible=i.SpaceBoundariesVisible))}if(u||E){const e=o.PerspectiveCamera??o.OrthogonalCamera,{CameraViewPoint:t,CameraDirection:s}=e,n=new i.Vector3(Number(t.X),Number(t.Z),Number(-t.Y)),r=new i.Vector3(Number(s.X),Number(s.Z),Number(-s.Y)),c={position:{x:n.x,y:n.y,z:n.z},direction:{x:r.x,y:r.y,z:r.z},aspectRatio:"AspectRatio"in e?e.AspectRatio:1};"ViewToWorldScale"in e&&(a.camera={...c,viewToWorldScale:e.ViewToWorldScale}),"FieldOfView"in e&&(a.camera={...c,fov:e.FieldOfView})}const f=new Pa(this.components,s,{data:a,setCamera:!1});if(I){const{Coloring:e}=I;if(e&&e.Color){const t=Array.isArray(e.Color)?e.Color:[e.Color];for(const e of t){const{Color:t,Component:i}=e,s=(Array.isArray(i)?i:[i]).map((e=>e.IfcGuid));f.componentColors.set(t,s)}}}if(d.push(f),l){const e=this.components.get(Jn),t=Array.isArray(l.ClippingPlane)?l.ClippingPlane:[l.ClippingPlane];for(const n of t){const{Location:t,Direction:r}=n;if(!t||!r)continue;const o=new i.Vector3(t.X,t.Z,-t.Y),a=new i.Vector3(r.X,-r.Z,r.Y),c=e.createFromNormalAndCoplanarPoint(s,a,o);c.visible=!1,c.enabled=!1,f.clippingPlanes.add(c)}}}const p={},C=[],T=l.filter((e=>e.name.endsWith(".bcf")));for(const t of T){const i=await t.async("string"),s=e.xmlParser.parse(i).Markup,n=s.Topic,{Guid:r,TopicType:a,TopicStatus:c,Title:l,CreationDate:I,CreationAuthor:u}=n;if(o&&!(r&&a&&c&&l&&I&&u))continue;const d=new sa(this.components);d.guid=r??d.guid;const f=this.getMarkupRelatedTopics(s,h);p[d.guid]=new Set(f),d.type=a??d.type,d.status=c??d.status,d.title=l??d.title,d.creationDate=I?new Date(I):d.creationDate,d.creationAuthor=u??d.creationAuthor,d.serverAssignedId=n.ServerAssignedId,d.priority=n.Priority,d.index=n.Index,d.modifiedDate=n.ModifiedDate?new Date(n.ModifiedDate):void 0,d.modifiedAuthor=n.ModifiedAuthor,d.dueDate=n.DueDate?new Date(n.DueDate):void 0,d.assignedTo=n.AssignedTo,d.description=n.Description,d.stage=n.Stage;const T=this.getMarkupLabels(s,h);for(const e of T)d.labels.add(e);const m=this.getMarkupComments(s,h);for(const e of m)d.comments.set(e.guid,e);const R=this.getMarkupViewpoints(s,h);for(const e of R){if(!e||!e.Guid)continue;const t=E.list.get(e.Guid);t&&d.viewpoints.add(t.guid)}this.list.set(d.guid,d),C.push(d)}for(const e in p){const t=this.list.get(e);if(!t)continue;const i=p[e];for(const e of i)t.relatedTopics.add(e)}return this.onBCFImported.trigger(C),{viewpoints:d,topics:C}}};t(oa,"uuid","de977976-e4f6-4e4f-a01a-204727839802"),t(oa,"xmlParser",new ea.XMLParser({allowBooleanAttributes:!0,attributeNamePrefix:"",ignoreAttributes:!1,ignoreDeclaration:!0,ignorePiTags:!0,numberParseOptions:{leadingZeros:!0,hex:!0},parseAttributeValue:!0,preserveOrder:!1,processEntities:!1,removeNSPrefix:!0,trimValues:!0}));let aa=oa;const ca=class e extends hi{constructor(i){super(i),t(this,"enabled",!0),t(this,"onDisposed",new ai),t(this,"_absoluteMin"),t(this,"_absoluteMax"),t(this,"_meshes",[]),this.components.add(e.uuid,this),this._absoluteMin=e.newBound(!0),this._absoluteMax=e.newBound(!1)}static getDimensions(e){const{min:t,max:s}=e,n=Math.abs(s.x-t.x),r=Math.abs(s.y-t.y),o=Math.abs(s.z-t.z),a=new i.Vector3;return a.subVectors(s,t).divideScalar(2).add(t),{width:n,height:r,depth:o,center:a}}static newBound(e){const t=e?1:-1;return new i.Vector3(t*Number.MAX_VALUE,t*Number.MAX_VALUE,t*Number.MAX_VALUE)}static getBounds(e,t,s){const n=s||this.newBound(!1),r=t||this.newBound(!0);for(const t of e)t.x<r.x&&(r.x=t.x),t.y<r.y&&(r.y=t.y),t.z<r.z&&(r.z=t.z),t.x>n.x&&(n.x=t.x),t.y>n.y&&(n.y=t.y),t.z>n.z&&(n.z=t.z);return new i.Box3(t,s)}dispose(){const t=this.components.get(fi);for(const e of this._meshes)t.destroy(e);this._meshes=[],this.onDisposed.trigger(e.uuid),this.onDisposed.reset()}get(){const e=this._absoluteMin.clone(),t=this._absoluteMax.clone();return new i.Box3(e,t)}getSphere(){const e=this._absoluteMin.clone(),t=this._absoluteMax.clone(),s=Math.abs((t.x-e.x)/2),n=Math.abs((t.y-e.y)/2),r=Math.abs((t.z-e.z)/2),o=new i.Vector3(e.x+s,e.y+n,e.z+r),a=o.distanceTo(e);return new i.Sphere(o,a)}getMesh(){const t=new i.Box3(this._absoluteMin,this._absoluteMax),s=e.getDimensions(t),{width:n,height:r,depth:o,center:a}=s,c=new i.BoxGeometry(n,r,o),l=new i.Mesh(c);return this._meshes.push(l),l.position.copy(a),l}reset(){this._absoluteMin=e.newBound(!0),this._absoluteMax=e.newBound(!1)}add(e){for(const t of e.items)this.addMesh(t.mesh)}addMesh(t,s){if(!t.geometry.index)return;const n=e.getFragmentBounds(t);t.updateMatrixWorld();const r=t.matrixWorld,o=new i.Matrix4,a=t instanceof i.InstancedMesh,c=new Set;if(t instanceof M.FragmentMesh){s||(s=t.fragment.ids);for(const e of s){const i=t.fragment.getInstancesIDs(e);if(i)for(const e of i)c.add(e)}}else c.add(0);for(const e of c){const i=n.min.clone(),s=n.max.clone();a&&(t.getMatrixAt(e,o),i.applyMatrix4(o),s.applyMatrix4(o)),i.applyMatrix4(r),s.applyMatrix4(r),i.x<this._absoluteMin.x&&(this._absoluteMin.x=i.x),i.y<this._absoluteMin.y&&(this._absoluteMin.y=i.y),i.z<this._absoluteMin.z&&(this._absoluteMin.z=i.z),i.x>this._absoluteMax.x&&(this._absoluteMax.x=i.x),i.y>this._absoluteMax.y&&(this._absoluteMax.y=i.y),i.z>this._absoluteMax.z&&(this._absoluteMax.z=i.z),s.x>this._absoluteMax.x&&(this._absoluteMax.x=s.x),s.y>this._absoluteMax.y&&(this._absoluteMax.y=s.y),s.z>this._absoluteMax.z&&(this._absoluteMax.z=s.z),s.x<this._absoluteMin.x&&(this._absoluteMin.x=s.x),s.y<this._absoluteMin.y&&(this._absoluteMin.y=s.y),s.z<this._absoluteMin.z&&(this._absoluteMin.z=s.z)}}addFragmentIdMap(e){const t=this.components.get(_r);for(const i in e){const s=t.list.get(i);if(!s)continue;const n=e[i];this.addMesh(s.mesh,n)}}static getFragmentBounds(e){const t=e.geometry.attributes.position,s=Number.MAX_VALUE,n=-s,r=new i.Vector3(s,s,s),o=new i.Vector3(n,n,n);if(!e.geometry.index)throw new Error("Geometry must be indexed!");const a=Array.from(e.geometry.index.array);for(let e=0;e<a.length;e++){if(e%3==0&&0===a[e]&&0===a[e+1]&&0===a[e+2]){e+=2;continue}const i=a[e],s=t.getX(i),n=t.getY(i),c=t.getZ(i);s<r.x&&(r.x=s),n<r.y&&(r.y=n),c<r.z&&(r.z=c),s>o.x&&(o.x=s),n>o.y&&(o.y=n),c>o.z&&(o.z=c)}return new i.Box3(r,o)}};t(ca,"uuid","d1444724-dba6-4cdd-a0c7-68ee1450d166");let la=ca;const ha=class e{constructor(e){t(this,"onProgress",new ai),t(this,"inclusive",!1),t(this,"rules",[]),t(this,"ids",{}),t(this,"needsUpdate",new Map),t(this,"components"),this.components=e}static import(t,i){const s=e.importers.get(i.type);return s?s(t,i):(console.warn("Invalid query data:.",i),null)}static importRules(e){const t=[];for(const i of e){const e={};for(const t in i){const s=i[t];s.regexp?e[t]=new RegExp(s.value):e[t]=s}t.push(e)}return t}static importIds(e){const t={};for(const i in e.ids)t[i]=new Set(e.ids[i]);return t}clear(e){if(void 0===e)return this.ids={},void this.needsUpdate.clear();delete this.ids[e],this.needsUpdate.delete(e)}addID(e,t){this.ids[e]||(this.ids[e]=new Set),this.ids[e].add(t)}getData(){const e={};for(const t in this.ids)e[t]=Array.from(this.ids[t]);const t=this.exportRules();return{name:this.name,inclusive:this.inclusive,type:"IfcFinderQuery",ids:e,rules:t}}exportRules(){const e=[];for(const t of this.rules){const i={};for(const e in t){const s=t[e];s instanceof RegExp?i[e]={regexp:!0,value:s.source}:i[e]=s}e.push(i)}return e}findInFile(e,t){return new Promise((i=>{const s=new FileReader,n=new TextDecoder("utf-8"),r=1024e4;let o=0;const a=/;/,c=()=>{if(o>=t.size)return void i();const e=Math.min(o+r+1e3,t.size),n=t.slice(o,e);s.readAsArrayBuffer(n)};s.onload=()=>{if(!(s.result instanceof ArrayBuffer))return;const i=new Uint8Array(s.result),l=n.decode(i).split(a);l.shift(),this.findInLines(e,l),this.onProgress.trigger(o/t.size),o+=r,c()},c()}))}getIdFromLine(e){const t=e.slice(e.indexOf("#")+1,e.indexOf("="));return parseInt(t,10)}testRules(e){let t=null,i=null,s=null,n=!1;for(const r of this.rules)if("category"!==r.type){if(null===i&&(i=this.getAttributesFromLine(e),null===i)){if(this.inclusive)continue;n=!1;break}if(null===t&&(t=this.getCategoryFromLine(e),null===t)){if(this.inclusive)continue;n=!1;break}if(null===s&&(s=Object.keys(new b.IFC4[t]),s=s.slice(2),null===s)){if(this.inclusive)continue;n=!1;break}if("property"===r.type){const{name:t,value:o}=r;if(!o.test(e)){if(this.inclusive)continue;n=!1;break}let a=!1;for(let e=0;e<i.length;e++){const n=i[e],r=s[e];if(o.test(n)&&t.test(r)){a=!0;break}}if(a)n=!0;else if(!this.inclusive){n=!1;break}}if("operator"===r.type){const{name:e,value:t,operator:o}=r;let a=!1;for(let n=0;n<i.length;n++){const r=s[n],c=i[n].replace(/IFCLENGTHMEASURE\(|IFCVOLUMEMEASURE\(|\)/g,"");if(e.test(r)){if("="===o&&parseFloat(c)===t){a=!0;break}if("<"===o&&parseFloat(c)<t){a=!0;break}if(">"===o&&parseFloat(c)>t){a=!0;break}if(">="===o&&parseFloat(c)>=t){a=!0;break}if("<="===o&&parseFloat(c)<=t){a=!0;break}}}if(a)n=!0;else if(!this.inclusive){n=!1;break}}}else{if(null===t&&(t=this.getCategoryFromLine(e),null===t)){if(this.inclusive)continue;break}if(!r.value.test(t)){if(this.inclusive)continue;n=!1;break}n=!0}return n}getCategoryFromLine(e){const t=e.indexOf("=")+1,i=e.indexOf("("),s=e.slice(t,i).trim(),n=hr[s];return n||null}getAttributesFromLine(e){const t=e.match(/\((.*)\)/);if(!t||!t[1])return null;return t[1].split(/,(?![^()]*\))/g).map((e=>e.trim()))}};t(ha,"importers",new Map);let Ia=ha;class ua{constructor(e){t(this,"list",new Map),t(this,"id",i.MathUtils.generateUUID()),t(this,"mode","intersect"),t(this,"_components"),this._components=e}get queries(){return new Set(this.list.values())}get items(){const e=[];for(const t of this.queries)e.push(t.items);return"combine"===this.mode?M.FragmentUtils.combine(e):M.FragmentUtils.intersect(e)}add(e){if(this.list.has(e.name))throw new Error(`This group already has a query with the name ${e.name}.`);this.list.set(e.name,e)}clear(e){for(const t of this.queries)t.clear(e)}import(e){this.mode=e.mode,this.id=e.id;for(const t in e.queries){const i=Ia.import(this._components,e.queries[t]);i&&this.list.set(t,i)}}export(){const e={};for(const[t,i]of this.list)e[t]=i.export();return{mode:this.mode,id:this.id,queries:e}}async update(e,t){for(const i of this.queries){const s=i.needsUpdate.get(e);(void 0===s||s)&&await i.update(e,t)}}}const da=class e extends Ia{constructor(e,i){super(e),t(this,"name"),this.name=i.name,this.rules=i.rules,this.inclusive=i.inclusive}get items(){const e=this.components.get(_r),t=[];for(const i in this.ids){const s=this.ids[i],n=e.groups.get(i);if(!n){console.warn(`Model ${i} not found!`);continue}const r=n.getFragmentMap(s);t.push(r)}return M.FragmentUtils.combine(t)}export(){const t=this.getData();return t.type=e.type,t}async update(e,t){this.ids[e]=new Set,await this.findInFile(e,t),this.needsUpdate.set(e,!1)}findInLines(e,t){for(const i of t){if(this.testRules(i)){const t=this.getIdFromLine(i);this.addID(e,t)}}}};t(da,"type","IfcBasicQuery");let Ea=da;Ia.importers.set(Ea.type,((e,t)=>{const i=new Ea(e,{name:t.name,rules:Ia.importRules(t.rules),inclusive:t.inclusive});return i.ids=Ia.importIds(t),i}));const fa=class e extends Ia{constructor(e,i){super(e),t(this,"name"),t(this,"psets",[]),this.name=i.name,this.rules=i.rules,this.inclusive=i.inclusive}get items(){const e=this.components.get(yr),t=this.components.get(_r),i=[];for(const s in this.ids){const n=t.groups.get(s);if(!n){console.log(`Model not found: ${s}.`);continue}const r=this.ids[s];for(const t of r){const r=e.getEntityRelations(s,t,"DefinesOcurrence");if(r){const e=n.getFragmentMap(r);i.push(e)}}}return M.FragmentUtils.combine(i)}export(){const t=this.getData();return t.type=e.type,t}async update(e,t){await this.findInFile(e,t);const i=new Set;for(const t of this.psets){const s=this.getAttributesFromLine(t);if(null===s)continue;const n=s[4].replace("(","[").replace(")","]").replace(/#/g,""),r=JSON.parse(n);for(const s of r){const n=this.ids[e];if(n&&n.has(s)){const e=this.getIdFromLine(t);i.add(e);break}}}this.ids[e]=i,this.psets=[],this.needsUpdate.set(e,!1)}findInLines(e,t){for(const i of t){const t=this.getCategoryFromLine(i);if("IfcPropertySet"===t){this.psets.push(i);continue}if("IfcPropertySingleValue"!==t)continue;if(this.testRules(i)){const t=this.getIdFromLine(i);this.addID(e,t)}}}};t(fa,"type","IfcPropertyQuery");let pa=fa;Ia.importers.set(pa.type,((e,t)=>{const i=new pa(e,{name:t.name,inclusive:t.inclusive,rules:Ia.importRules(t.rules)});return i.ids=Ia.importIds(t),i}));const Ca=class e extends hi{constructor(i){super(i),t(this,"enabled",!0),t(this,"list",new Map),i.add(e.uuid,this)}get queries(){const e=new Set;for(const[,t]of this.list)for(const i of t.queries)e.add(i);return e}import(e){for(const t in e){const i=new ua(this.components);i.import(e[t]),this.list.set(t,i)}}export(){const e={};for(const[t,i]of this.list)e[t]=i.export();return e}create(){const e=new ua(this.components);return this.list.set(e.id,e),e}delete(e){this.list.delete(e)}clear(){this.list.clear()}};t(Ca,"uuid","0da7ad77-f734-42ca-942f-a074adfd1e3a");let Ta=Ca;const ma=class e extends hi{constructor(i){super(i),t(this,"enabled",!0),t(this,"list",{}),t(this,"onDisposed",new ai),t(this,"onFragmentsDisposed",(e=>{const{groupID:t,fragmentIDs:i}=e;for(const e in this.list){const s=this.list[e],n=Object.keys(s);if(n.includes(t))delete s[t],0===Object.values(s).length&&delete this.list[e];else for(const e of n){const t=s[e];for(const e of i)delete t.map[e];0===Object.values(t).length&&delete s[e]}}})),i.add(e.uuid,this);i.get(_r).onFragmentsDisposed.add(this.onFragmentsDisposed)}dispose(){this.list={};this.components.get(_r).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(),this.onDisposed.reset()}remove(e){for(const t in this.list){const i=this.list[t];for(const t in i){delete i[t].map[e]}}}find(e){const t=this.components.get(_r);if(!e){const e={};for(const[i,s]of t.list)e[i]=new Set(s.ids);return e}const i=Object.keys(e).length,s={};for(const t in e){const i=e[t];if(this.list[t])for(const e of i){const i=this.list[t][e];if(i)for(const e in i.map){s[e]||(s[e]=new Map);for(const t of i.map[e]){const i=s[e].get(t);void 0===i?s[e].set(t,1):s[e].set(t,i+1)}}}else console.warn(`Classification ${t} does not exist.`)}const n={};for(const e in s){const t=s[e];for(const[s,r]of t){if(void 0===r)throw new Error("Malformed fragments map!");r===i&&(n[e]||(n[e]=new Set),n[e].add(s))}}return n}byModel(e,t){this.list.models||(this.list.models={});const i=this.list.models;i[e]||(i[e]={map:{},id:null,name:e});const s=i[e];for(const[e,i]of t.data){const n=i[0];for(const i of n){const n=t.keyFragments.get(i);n&&(s.map[n]||(s.map[n]=new Set),s.map[n].add(e))}}}async byPredefinedType(e){var t;this.list.predefinedTypes||(this.list.predefinedTypes={});const i=this.list.predefinedTypes,s=e.getAllPropertiesIDs();for(const n of s){const s=await e.getProperties(n);if(!s)continue;const r=String(null==(t=s.PredefinedType)?void 0:t.value).toUpperCase();i[r]||(i[r]={map:{},id:null,name:r});const o=i[r];for(const[t,i]of e.data){const t=i[0];for(const i of t){const t=e.keyFragments.get(i);if(!t)throw new Error("Fragment ID not found!");o.map[t]||(o.map[t]=new Set);o.map[t].add(s.expressID)}}}}byEntity(e){this.list.entities||(this.list.entities={});for(const[t,i]of e.data){const s=i[1][1],n=cr[s];this.saveItem(e,"entities",n,t)}}async byIfcRel(e,t,i){lr.isRel(t)&&await lr.getRelationMap(e,t,(async(t,s)=>{const{name:n}=await lr.getEntityName(e,t);for(const t of s)this.saveItem(e,i,n??"NO REL NAME",t)}))}async bySpatialStructure(e,t={}){var i,s;const n=this.components.get(yr),r=n.relationMaps[e.uuid];if(!r)throw new Error(`Classifier: model relations of ${e.name||e.uuid} have to exists to group by spatial structure.`);const o="spatialStructures",a=void 0===t.useProperties||t.useProperties;for(const[c]of r){if(t.isolate){const i=e.data.get(c);if(!i)continue;const s=i[1][1];if(void 0===s||!t.isolate.has(s))continue}const r=n.getEntityRelations(e,c,"Decomposes");if(r)for(const t of r){let s=t.toString();if(a){const n=await e.getProperties(t);if(!n)continue;s=null==(i=n.Name)?void 0:i.value}this.saveItem(e,o,s,c,t)}const l=n.getEntityRelations(e,c,"ContainsElements");if(!l)continue;let h=c.toString();if(a){const t=await e.getProperties(c);if(!t)continue;h=null==(s=t.Name)?void 0:s.value}for(const t of l){this.saveItem(e,o,h,t,c);const i=n.getEntityRelations(e,Number(t),"IsDecomposedBy");if(i)for(const t of i)this.saveItem(e,o,h,t,c)}}}setColor(e,t,i=!1){const s=this.components.get(_r);for(const n in e){const r=s.list.get(n);if(!r)continue;const o=e[n];r.setColor(t,o,i)}}resetColor(e){const t=this.components.get(_r);for(const i in e){const s=t.list.get(i);if(!s)continue;const n=e[i];s.resetColor(n)}}saveItem(e,t,i,s,n=null){this.list[t]||(this.list[t]={});const r=e.data.get(s);if(r)for(const o of r[0]){const r=e.keyFragments.get(o);if(r){const e=this.list[t];e[i]||(e[i]={map:{},id:n,name:i}),e[i].map[r]||(e[i].map[r]=new Set),e[i].map[r].add(s)}}}};t(ma,"uuid","e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");let Ra=ma;const ga=class e extends hi{constructor(i){super(i),t(this,"onDisposed",new ai),t(this,"enabled",!0),t(this,"height",10),t(this,"groupName","spatialStructures"),t(this,"list",new Set),i.add(e.uuid,this)}dispose(){this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}set(e){if(!this.enabled)return;const t=this.components.get(Ra),s=this.components.get(_r),n=e?1:-1;let r=0;const o=t.list[this.groupName],a=new i.Matrix4;for(const t in o){a.elements[13]=r*n*this.height;for(const i in o[t].map){const n=s.list.get(i),r=t+i,c=this.list.has(r);if(!n||e&&c||!e&&!c)continue;e?this.list.add(r):this.list.delete(r);const l=o[t].map[i];n.applyTransform(l,a),n.mesh.computeBoundingSphere(),n.mesh.computeBoundingBox()}r++}}};t(ga,"uuid","d260618b-ce88-4c7d-826c-6debb91de3e2");let Aa=ga;const Fa=class e extends hi{constructor(i){super(i),t(this,"enabled",!0),this.components.add(e.uuid,this)}set(e,t){const i=this.components.get(_r);if(t)for(const s in t){const n=t[s],r=i.list.get(s);r&&(r.setVisibility(e,n),this.updateCulledVisibility(r))}else for(const[t,s]of i.list)s&&(s.setVisibility(e),this.updateCulledVisibility(s))}isolate(e){this.set(!1),this.set(!0,e)}updateCulledVisibility(e){const t=this.components.get(an);for(const[i,s]of t.list){const t=s.colorMeshes.get(e.id);t&&(t.count=e.mesh.count)}}};t(Fa,"uuid","dd9ccf2d-8a21-4821-b7f6-2949add16a29");let Sa=Fa;class Oa extends dr{constructor(){super(...arguments),t(this,"minGeometrySize",10),t(this,"minAssetsSize",1e3),t(this,"maxTriangles",null)}}const Na=class e extends hi{constructor(i){super(i),t(this,"onGeometryStreamed",new ci),t(this,"onAssetStreamed",new ci),t(this,"onProgress",new ci),t(this,"onIfcLoaded",new ci),t(this,"onDisposed",new ai),t(this,"settings",new Oa),t(this,"enabled",!0),t(this,"webIfc",new b.IfcAPI),t(this,"_nextAvailableID",0),t(this,"_splittedGeometries",new Map),t(this,"_spatialTree",new ur),t(this,"_metaData",new fr),t(this,"_visitedGeometries",new Map),t(this,"_streamSerializer",new M.StreamSerializer),t(this,"_geometries",new Map),t(this,"_geometryCount",0),t(this,"_civil",new Er),t(this,"_groupSerializer",new M.Serializer),t(this,"_assets",[]),t(this,"_meshesWithHoles",new Set),this.components.add(e.uuid,this),this.settings.excludedCategories.add(b.IFCOPENINGELEMENT)}dispose(){this.onIfcLoaded.reset(),this.onGeometryStreamed.reset(),this.onAssetStreamed.reset(),this.webIfc=null,this.onDisposed.trigger(),this.onDisposed.reset()}async streamFromBuffer(e){await this.readIfcFile(e),await this.streamAllGeometries(),this.cleanUp()}async streamFromCallBack(e){await this.streamIfcFile(e),await this.streamAllGeometries(),this.cleanUp()}async readIfcFile(e){const{path:t,absolute:i,logLevel:s}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),s&&this.webIfc.SetLogLevel(s),this.webIfc.OpenModel(e,this.settings.webIfc),this._nextAvailableID=this.webIfc.GetMaxExpressID(0)}async streamIfcFile(e){const{path:t,absolute:i,logLevel:s}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),s&&this.webIfc.SetLogLevel(s),this.webIfc.OpenModelFromCallback(e,this.settings.webIfc)}async streamAllGeometries(){console.log("Converting geometries to tiles...");const{minGeometrySize:e,minAssetsSize:t}=this.settings;this._spatialTree.setUp(this.webIfc);const i=this.webIfc.GetIfcEntityList(0),s=[[]],n=new M.FragmentsGroup;n.ifcMetadata={name:"",description:"",...this._metaData.getNameInfo(this.webIfc),...this._metaData.getDescriptionInfo(this.webIfc),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};let r=0,o=0;for(const t of i){if(!this.webIfc.IsIfcElement(t)&&t!==b.IFCSPACE)continue;if(this.settings.excludedCategories.has(t))continue;const i=this.webIfc.GetLineIDsWithType(0,t),a=i.size();for(let c=0;c<a;c++){r>e&&(r=0,o++,s.push([]));const a=i.get(c);s[o].push(a);const l=this.webIfc.GetLine(0,a);if(l.GlobalId){const e=(null==l?void 0:l.GlobalId.value)||(null==l?void 0:l.GlobalId);n.globalToExpressIDs.set(e,a)}const h=this._spatialTree.itemsByFloor[a]||0;n.data.set(a,[[],[h,t]]),r++}}this._spatialTree.cleanUp();let a=.01,c=0;for(const e of s){c++,this.webIfc.StreamMeshes(0,e,(e=>{this.getMesh(this.webIfc,e,n)})),this._geometryCount>this.settings.minGeometrySize&&await this.streamGeometries(),this._assets.length>t&&await this.streamAssets();const i=c/s.length;i>a&&(a+=.01,a=Math.max(a,i),await this.onProgress.trigger(Math.round(100*a)/100))}this._geometryCount&&await this.streamGeometries(),this._assets.length&&await this.streamAssets();const{opaque:l,transparent:h}=n.geometryIDs;for(const[e,{index:t,uuid:i}]of this._visitedGeometries){n.keyFragments.set(t,i);(e>1?l:h).set(e,t)}pr.get(n,this.webIfc);const I=this.webIfc.GetCoordinationMatrix(0);n.coordinationMatrix.fromArray(I),n.civilData=this._civil.read(this.webIfc);const u=this._groupSerializer.export(n);await this.onIfcLoaded.trigger(u),n.dispose(!0)}cleanUp(){try{this.webIfc.Dispose()}catch(e){}this.webIfc=null,this.webIfc=new b.IfcAPI,this._visitedGeometries.clear(),this._geometries.clear(),this._assets=[],this._meshesWithHoles.clear()}getMesh(e,t,i){const s=t.geometries.size(),n=t.expressID,r={id:n,geometries:[]};for(let o=0;o<s;o++){const s=t.geometries.get(o),a=s.geometryExpressID,c=a*(1===s.color.w?1:-1);this._visitedGeometries.has(c)||this.getGeometry(e,a,c),this.registerGeometryData(i,n,s,r,a,c);const l=this._splittedGeometries.get(a);if(l)for(const e of l)this.registerGeometryData(i,n,s,r,e,e)}this._assets.push(r)}getGeometry(e,t,s){const n=e.GetGeometry(0,t),r=e.GetIndexArray(n.GetIndexData(),n.GetIndexDataSize()),o=e.GetVertexArray(n.GetVertexData(),n.GetVertexDataSize()),a=new Float32Array(o.length/2),c=new Float32Array(o.length/2);for(let e=0;e<o.length;e+=6)a[e/2]=o[e],a[e/2+1]=o[e+1],a[e/2+2]=o[e+2],c[e/2]=o[e+3],c[e/2+1]=o[e+4],c[e/2+2]=o[e+5];if(0===r.length){const e=new Float32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]);this._geometries.set(t,{position:a,normal:c,index:r,boundingBox:e,hasHoles:!1});const o=this._visitedGeometries.size,l=i.MathUtils.generateUUID();return this._visitedGeometries.set(s,{uuid:l,index:o}),this._geometryCount++,void n.delete()}const l=3*(this.settings.maxTriangles||r.length/3);let h=!0;for(let e=0;e<r.length;e+=l){const n=r.length-e,o=e+Math.min(n,l),I=[],u=[],d=[];let E=0;for(let t=e;t<o;t++){I.push(E++);const e=r[t];u.push(a[3*e]),u.push(a[3*e+1]),u.push(a[3*e+2]),d.push(c[3*e]),d.push(c[3*e+1]),d.push(c[3*e+2])}const f=new Uint32Array(I),p=new Float32Array(u),C=new Float32Array(d),T=xi(p),m=new Float32Array(T.transformation.elements),R=!1,g=h?t:this._nextAvailableID++;if(this._geometries.set(g,{position:p,normal:C,index:f,boundingBox:m,hasHoles:R}),!h){this._splittedGeometries.has(t)||this._splittedGeometries.set(t,new Set);this._splittedGeometries.get(t).add(g)}const A=this._visitedGeometries.size,F=i.MathUtils.generateUUID();this._visitedGeometries.set(s,{uuid:F,index:A}),this._geometryCount++,h=!1}n.delete()}async streamAssets(){await this.onAssetStreamed.trigger(this._assets),this._assets=null,this._assets=[]}async streamGeometries(){let e=this._streamSerializer.export(this._geometries),t={};for(const[e,{boundingBox:i,hasHoles:s}]of this._geometries)t[e]={boundingBox:i,hasHoles:s};await this.onGeometryStreamed.trigger({data:t,buffer:e}),t=null,e=null,this._geometries.clear(),this._geometryCount=0}registerGeometryData(e,t,i,s,n,r){const o=this._visitedGeometries.get(r);if(void 0===o)throw new Error("Error getting geometry data for streaming!");const a=e.data.get(t);if(!a)throw new Error("Data not found!");a[0].push(o.index);const{x:c,y:l,z:h,w:I}=i.color,u=[c,l,h,I],d=i.flatTransformation;s.geometries.push({color:u,geometryID:n,transformation:d})}};t(Na,"uuid","d9999a00-e1f5-4d3f-8cfe-c56e08609764");let ya=Na;class La extends dr{constructor(){super(...arguments),t(this,"propertiesSize",100)}}class _a extends hi{constructor(){super(...arguments),t(this,"onPropertiesStreamed",new ci),t(this,"onProgress",new ci),t(this,"onIndicesStreamed",new ci),t(this,"onDisposed",new ai),t(this,"enabled",!0),t(this,"settings",new La),t(this,"webIfc",new b.IfcAPI)}async dispose(){this.onIndicesStreamed.reset(),this.onPropertiesStreamed.reset(),this.webIfc=null,this.onDisposed.reset()}async streamFromBuffer(e){await this.readIfcFile(e),await this.streamAllProperties(),this.cleanUp()}async streamFromCallBack(e){await this.streamIfcFile(e),await this.streamAllProperties(),this.cleanUp()}async readIfcFile(e){const{path:t,absolute:i,logLevel:s}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),s&&this.webIfc.SetLogLevel(s),this.webIfc.OpenModel(e,this.settings.webIfc)}async streamIfcFile(e){const{path:t,absolute:i,logLevel:s}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),s&&this.webIfc.SetLogLevel(s),this.webIfc.OpenModelFromCallback(e,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:e}=this.settings,t=new Set(this.webIfc.GetIfcEntityList(0)),i=new Set([b.IFCPROJECT,b.IFCSITE,b.IFCBUILDING,b.IFCBUILDINGSTOREY,b.IFCSPACE]);for(const e of i)t.add(e);let s=.01,n=0;for(const r of t){if(n++,Cr.has(r))continue;const o=i.has(r),a=this.webIfc.GetLineIDsWithType(0,r),c=a.size();let l=0;for(let t=0;t<c-e;t+=e){const i={};for(let s=0;s<e;s++){l++;const e=a.get(t+s);try{const t=this.webIfc.GetLine(0,e,o);i[t.expressID]=t}catch(t){console.log(`Could not get property: ${e}`)}}await this.onPropertiesStreamed.trigger({type:r,data:i})}if(l!==c){const e={};for(let t=l;t<c;t++){const i=a.get(t);try{const t=this.webIfc.GetLine(0,i,o);e[t.expressID]=t}catch(e){console.log(`Could not get property: ${i}`)}}await this.onPropertiesStreamed.trigger({type:r,data:e})}n/t.size>s&&(s=Math.round(100*s)/100,await this.onProgress.trigger(s),s+=.01)}await this.onProgress.trigger(1);const r=this.components.get(yr),o=await r.processFromWebIfc(this.webIfc,0);await this.onIndicesStreamed.trigger(o)}cleanUp(){this.webIfc.Dispose(),this.webIfc=null,this.webIfc=new b.IfcAPI}}t(_a,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");class Pa{constructor(e,i,s){t(this,"title"),t(this,"guid",Gi.create()),t(this,"clippingPlanes",new Ci),t(this,"camera",{aspectRatio:0,fov:0,direction:{x:0,y:0,z:80},position:{x:0,y:0,z:0}}),t(this,"exceptionComponents",new Ci),t(this,"selectionComponents",new Ci),t(this,"componentColors",new Ti),t(this,"spacesVisible",!1),t(this,"spaceBoundariesVisible",!1),t(this,"openingsVisible",!1),t(this,"defaultVisibility",!0),t(this,"_components"),t(this,"world");const n={setCamera:!0,...s},{data:r,setCamera:o}=n;this._components=e,this.world=i,r&&(this.guid=r.guid??this.guid,this.set(r)),o&&this.updateCamera()}get _selectionModelIdMap(){const e=this._components.get(_r),t={};for(const[i,s]of e.groups){i in t||(t[i]=new Set);for(const e of this.selectionComponents){const n=s.globalToExpressIDs.get(e);n&&t[i].add(n)}}return t}get _exceptionModelIdMap(){const e=this._components.get(_r),t={};for(const[i,s]of e.groups){i in t||(t[i]=new Set);for(const e of this.exceptionComponents){const n=s.globalToExpressIDs.get(e);n&&t[i].add(n)}}return t}get selection(){return this._components.get(_r).modelIdToFragmentIdMap(this._selectionModelIdMap)}get exception(){return this._components.get(_r).modelIdToFragmentIdMap(this._exceptionModelIdMap)}get projection(){return"fov"in this.camera?"Perspective":"Orthographic"}get position(){const e=this._components.get(_r),{position:t}=this.camera,{x:s,y:n,z:r}=t,o=new i.Vector3(s,n,r);return e.applyBaseCoordinateSystem(o,new i.Matrix4),o}get direction(){const{direction:e}=this.camera,{x:t,y:s,z:n}=e;return new i.Vector3(t,s,n)}get _managerVersion(){return this._components.get(aa).config.version}get topics(){return[...this._components.get(aa).list.values()].filter((e=>e.viewpoints.has(this.guid)))}addComponentsFromMap(e){const t=this._components.get(_r).fragmentIdMapToGuids(e);this.selectionComponents.add(...t);this._components.get(va).list.set(this.guid,this)}set(e){const t=e,i=this;for(const s in e){if("guid"===s)continue;const e=t[s];"selectionComponents"!==s?"exceptionComponents"!==s?s in this&&(i[s]=e):(this.exceptionComponents.clear(),this.exceptionComponents.add(...e)):(this.selectionComponents.clear(),this.selectionComponents.add(...e))}return this._components.get(va).list.set(this.guid,this),this}async go(e=!0){const{camera:t}=this.world;if(!t.hasCameraControls())throw new Error("Viewpoint: the world's camera need controls to set the viewpoint.");t instanceof nr&&t.projection.set(this.projection);const i=this.position,s=this.direction;let n={x:i.x+80*s.x,y:i.y+80*s.y,z:i.z+80*s.z};const r=this.selection;if(0===Object.keys(r).length){const e=this._components.get(dn).get(this.world).castRayFromVector(i,this.direction);e&&(n=e.point)}else{const e=this._components.get(la);e.reset(),e.addFragmentIdMap(r),n=e.getSphere().center,e.reset()}const o=this._components.get(Sa);o.set(this.defaultVisibility),o.set(!this.defaultVisibility,this.exception),o.set(!0,r),await t.controls.setLookAt(i.x,i.y,i.z,n.x,n.y,n.z,e)}updateCamera(){const{camera:e,renderer:t}=this.world;if(!t)throw new Error("Viewpoint: the world needs to have a renderer!");if(!e.hasCameraControls())throw new Error("Viewpoint: world's camera need camera controls!");const s=new i.Vector3;e.controls.getPosition(s);const n=e.three,r=new i.Vector3(0,0,-1).applyEuler(n.rotation),{width:o,height:a}=t.getSize();let c=o/a;Number.isNaN(c)&&(c=1);const l=this._components.get(_r);s.applyMatrix4(l.baseCoordinationMatrix.clone().invert());const h={aspectRatio:c,position:{x:s.x,y:s.y,z:s.z},direction:{x:r.x,y:r.y,z:r.z}};n instanceof i.PerspectiveCamera?this.camera={...h,fov:n.fov}:n instanceof i.OrthographicCamera&&(this.camera={...h,viewToWorldScale:n.top-n.bottom});this._components.get(va).list.set(this.guid,this)}colorize(){const e=this._components.get(va),t=this._components.get(_r),s=this._components.get(Ra);for(const[n,r]of this.componentColors){const o=t.guidToFragmentIdMap(r),a=new i.Color(`#${n}`);s.setColor(o,a,e.config.overwriteColors)}}resetColors(){const e=this._components.get(_r),t=this._components.get(Ra);for(const[i,s]of this.componentColors){const i=e.guidToFragmentIdMap(s);t.resetColor(i)}}async createComponentTags(e){var t,i;const s=this._components.get(_r);let n="";if(this._components.get(aa).config.includeSelectionTag){const r="selection"===e?this._selectionModelIdMap:this._exceptionModelIdMap;for(const e in r){const o=s.groups.get(e);if(!o)continue;const a=r[e];for(const e of a){const s=await o.getProperties(e);if(!s)continue;const r=null==(t=s.GlobalId)?void 0:t.value;if(!r)continue;const a=null==(i=s.Tag)?void 0:i.value;let c=null;a&&(c=`AuthoringToolId="${a}"`),n+=`\n<Component IfcGuid="${r}" ${c??""} />`}}}else n=[...this.selectionComponents].map((e=>`<Component IfcGuid="${e}" />`)).join("\n");return n}async serialize(e=this._managerVersion){const t=this._components.get(_r),s=this.position;s.applyMatrix4(t.baseCoordinationMatrix.clone().invert());const n=this.direction;n.normalize();const r=(new i.Matrix4).makeRotationX(Math.PI/2),o=n.clone().applyMatrix4(r);o.normalize();const a=`<CameraViewPoint>\n <X>${s.x}</X>\n <Y>${-s.z}</Y>\n <Z>${s.y}</Z>\n </CameraViewPoint>`,c=`<CameraDirection>\n <X>${n.x}</X>\n <Y>${-n.z}</Y>\n <Z>${n.y}</Z>\n </CameraDirection>`,l=`<CameraUpVector>\n <X>${o.x}</X>\n <Y>${-o.z}</Y>\n <Z>${o.y}</Z>\n </CameraUpVector>`,h=`<AspectRatio>${this.camera.aspectRatio}</AspectRatio>`;let I="";"viewToWorld"in this.camera?I=`<OrthogonalCamera>\n ${a}\n ${c}\n ${l}\n ${h}\n <ViewToWorldScale>${this.camera.viewToWorld}</ViewToWorldScale>\n </OrthogonalCamera>`:"fov"in this.camera&&(I=`<PerspectiveCamera>\n ${a}\n ${c}\n ${l}\n ${h}\n <FieldOfView>${this.camera.fov}</FieldOfView>\n </PerspectiveCamera>`);const u=`<ViewSetupHints SpacesVisible="${this.spacesVisible??!1}" SpaceBoundariesVisible="${this.spaceBoundariesVisible??!1}" OpeningsVisible="${this.openingsVisible??!1}" />`,d=(await this.createComponentTags("selection")).trim(),E=(await this.createComponentTags("exception")).trim();return`<?xml version="1.0" encoding="UTF-8"?>\n <VisualizationInfo Guid="${this.guid}">\n <Components>\n ${"2.1"===e?u:""}\n ${0!==d.length?`<Selection>${d}</Selection>`:""}\n <Visibility DefaultVisibility="${this.defaultVisibility}">\n ${"3"===e?u:""}\n ${0!==E.length?`<Exceptions>${E}</Exceptions>`:""}\n </Visibility>\n </Components>\n ${I}\n </VisualizationInfo>`}}class wa extends Xi{constructor(){super(...arguments),t(this,"_config",{overwriteColors:{value:!1,type:"Boolean"}})}get overwriteColors(){return this._config.overwriteColors.value}set overwriteColors(e){this._config.overwriteColors.value=e}}const Ma=class e extends hi{constructor(i){super(i),t(this,"enabled",!0),t(this,"list",new Ti),t(this,"isSetup",!1),t(this,"onSetup",new ai),t(this,"config",new wa(this,this.components,"Viewpoints",e.uuid)),t(this,"onDisposed",new ai),i.add(e.uuid,this)}create(e,t){const i=new Pa(this.components,e,{data:t});return t||this.list.set(i.guid,i),i}setup(){}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}};t(Ma,"uuid","ee867824-a796-408d-8aa0-4e5962a83c66");let va=Ma;class Da extends Xi{constructor(){super(...arguments),t(this,"_config",{visible:{value:!0,type:"Boolean"},lockRotation:{value:!0,type:"Boolean"},zoom:{type:"Number",interpolable:!0,value:.05,min:.001,max:5},frontOffset:{type:"Number",interpolable:!0,value:0,min:0,max:100},sizeX:{type:"Number",interpolable:!0,value:320,min:20,max:5e3},sizeY:{type:"Number",interpolable:!0,value:160,min:20,max:5e3},backgroundColor:{value:new i.Color,type:"Color"}})}get visible(){return this._config.visible.value}set visible(e){this._config.visible.value=e;this._component.renderer.domElement.style.display=e?"block":"none"}get lockRotation(){return this._config.lockRotation.value}set lockRotation(e){this._config.lockRotation.value=e,this._component.lockRotation=e}get zoom(){return this._config.zoom.value}set zoom(e){this._config.zoom.value=e,this._component.zoom=e}get frontOffset(){return this._config.frontOffset.value}set frontOffset(e){this._config.frontOffset.value=e,this._component.frontOffset=e}get sizeX(){return this._config.sizeX.value}set sizeX(e){this._config.sizeX.value=e;const{sizeX:t,sizeY:s}=this._config,n=new i.Vector2(t.value,s.value);this._component.resize(n)}get sizeY(){return this._config.sizeY.value}set sizeY(e){this._config.sizeY.value=e;const{sizeX:t,sizeY:s}=this._config,n=new i.Vector2(t.value,s.value);this._component.resize(n)}get backgroundColor(){return this._config.backgroundColor.value}set backgroundColor(e){this._config.backgroundColor.value=e,this._component.backgroundColor=e}}class ba{constructor(e,s){if(t(this,"onDisposed",new ai),t(this,"onAfterUpdate",new ai),t(this,"onBeforeUpdate",new ai),t(this,"onResize",new ai),t(this,"onSetup",new ai),t(this,"frontOffset",0),t(this,"overrideMaterial",new i.MeshDepthMaterial),t(this,"backgroundColor",new i.Color(395274)),t(this,"renderer"),t(this,"enabled",!0),t(this,"world"),t(this,"config"),t(this,"isSetup",!1),t(this,"_defaultConfig",{visible:!0,lockRotation:!1,zoom:.05,frontOffset:0,sizeX:320,sizeY:160,backgroundColor:new i.Color(395274)}),t(this,"_lockRotation",!0),t(this,"_size",new i.Vector2(320,160)),t(this,"_camera"),t(this,"_plane"),t(this,"_tempVector1",new i.Vector3),t(this,"_tempVector2",new i.Vector3),t(this,"_tempTarget",new i.Vector3),t(this,"down",new i.Vector3(0,-1,0)),t(this,"updatePlanes",(()=>{if(!this.world.renderer)throw new Error("The given world must have a renderer!");const e=[],t=this.world.renderer.three;for(const i of t.clippingPlanes)e.push(i);e.push(this._plane),this.renderer.clippingPlanes=e})),this.world=e,!this.world.renderer)throw new Error("The given world must have a renderer!");this.renderer=new i.WebGLRenderer,this.renderer.setSize(this._size.x,this._size.y);const n=this._size.x/this._size.y;this._camera=new i.OrthographicCamera(1*n/-2,1*n/2,.5,-.5),this.world.renderer.onClippingPlanesUpdated.add(this.updatePlanes),this._camera.position.set(0,200,0),this._camera.zoom=.1,this._camera.rotation.x=-Math.PI/2,this._plane=new i.Plane(this.down,200),this.updatePlanes(),this.config=new Da(this,s,"MiniMap")}get lockRotation(){return this._lockRotation}set lockRotation(e){this._lockRotation=e,e&&(this._camera.rotation.z=0)}get zoom(){return this._camera.zoom}set zoom(e){this._camera.zoom=e,this._camera.updateProjectionMatrix()}dispose(){this.enabled=!1,this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.onResize.reset(),this.overrideMaterial.dispose(),this.renderer.forceContextLoss(),this.renderer.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(){return this._camera}update(){if(!this.enabled)return;this.onBeforeUpdate.trigger();const e=this.world.scene.three,t=this.world.camera;if(!t.hasCameraControls())throw new Error("The given world must use camera controls!");if(!(e instanceof i.Scene))throw new Error("The given world must have a THREE.Scene as a root!");const s=t.controls;if(s.getPosition(this._tempVector1),this._camera.position.x=this._tempVector1.x,this._camera.position.z=this._tempVector1.z,0!==this.frontOffset&&(s.getTarget(this._tempVector2),this._tempVector2.sub(this._tempVector1),this._tempVector2.normalize().multiplyScalar(this.frontOffset),this._camera.position.x+=this._tempVector2.x,this._camera.position.z+=this._tempVector2.z),!this._lockRotation){s.getTarget(this._tempTarget);const e=Math.atan2(this._tempTarget.x-this._tempVector1.x,this._tempTarget.z-this._tempVector1.z);this._camera.rotation.z=e+Math.PI}this._plane.set(this.down,this._tempVector1.y);const n=e.background;e.background=this.backgroundColor,this.renderer.render(e,this._camera),e.background=n,this.onAfterUpdate.trigger()}getSize(){return this._size}resize(e=this._size){this._size.copy(e),this.renderer.setSize(e.x,e.y);const t=e.x/e.y;this._camera.left=1*t/-2,this._camera.right=1*t/2,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),this.onResize.trigger(e)}setup(e){const t={...this._defaultConfig,...e};this.config.visible=!0,this.config.lockRotation=t.lockRotation,this.config.zoom=t.zoom,this.config.frontOffset=t.frontOffset,this.config.sizeX=t.sizeX,this.config.sizeY=t.sizeY,this.config.backgroundColor=t.backgroundColor,this.isSetup=!0,this.onSetup.trigger()}}const Ua=class e extends hi{constructor(i){super(i),t(this,"onAfterUpdate",new ai),t(this,"onBeforeUpdate",new ai),t(this,"onDisposed",new ai),t(this,"onSetup",new ai),t(this,"enabled",!0),t(this,"list",new Map),this.components.add(e.uuid,this)}create(e){if(this.list.has(e.uuid))throw new Error("This world already has a minimap!");const t=new ba(e,this.components);return this.list.set(e.uuid,t),t}delete(e){const t=this.list.get(e);t&&t.dispose(),this.list.delete(e)}dispose(){for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}update(){for(const[e,t]of this.list)t.update()}};t(Ua,"uuid","39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");let xa=Ua;const Ba=class e extends hi{constructor(i){super(i),t(this,"enabled",!0),i.add(e.uuid,this)}static distanceFromPointToLine(e,t,s,n=!1){const r=new i.Line3,o=new i.Vector3;return r.set(t,s),r.closestPointToPoint(e,n,o),o.distanceTo(e)}getFace(e,t,i){if(!e.geometry.index)throw new Error("Geometry must be indexed!");const s=new Map,n=e.geometry.index.array,{plane:r}=this.getFaceData(t,i,e),o=[];for(let t=0;t<n.length/3;t++){const{plane:n,edges:a}=this.getFaceData(t,i,e);if(n.equals(r)){o.push({index:t,edges:a});for(const{id:e,points:t,distance:i}of a)s.set(e,{points:t,distance:i})}}let a=0;const c=new Map,l=new Map;for(const{index:e,edges:t}of o){const i=new Map;for(const{id:e}of t)if(c.has(e)){const t=c.get(e);i.set(e,t)}const s=t.map((e=>e.id));if(!i.size){const i=a++;for(const{id:e}of t)c.set(e,i);l.set(i,{edges:new Set(s),indices:new Set([e])});continue}let n=null;const r=new Set,o=new Set(s);for(const[e,t]of i){null===n?n=t:t!==n&&r.add(t),c.delete(e);const{edges:i}=l.get(t);i.delete(e),o.delete(e)}if(null===n)throw new Error("Error computing face!");const h=l.get(n),{indices:I}=h;I.add(e);for(const e of o){c.set(e,n);const{edges:t}=h;t.add(e)}for(const e of r){const t=l.get(e),{edges:i,indices:s}=t,r=l.get(n),{edges:o,indices:a}=r;for(const e of i)o.add(e),c.set(e,n);for(const e of s)a.add(e);l.delete(e)}}for(const[e,{indices:i,edges:n}]of l)if(i.has(t)){const e=[];for(const t of n){const i=s.get(t);e.push(i)}return{edges:e,indices:i}}return null}getVerticesAndNormal(e,t,s){if(!e.geometry.index)throw new Error("Geometry must be indexed!");const n=e.geometry.index.array,r=e.geometry.attributes.position.array,o=e.geometry.attributes.normal.array,a=3*n[3*t],c=3*n[3*t+1],l=3*n[3*t+2],h=new i.Vector3(r[a],r[a+1],r[a+2]),I=new i.Vector3(r[c],r[c+1],r[c+2]),u=new i.Vector3(r[l],r[l+1],r[l+2]),d=new i.Vector3(o[a],o[a+1],o[a+2]),E=new i.Vector3(o[c],o[c+1],o[c+2]),f=new i.Vector3(o[l],o[l+1],o[l+2]),p=(d.x+E.x+f.x)/3,C=(d.y+E.y+f.y)/3,T=(d.z+E.z+f.z)/3,m=new i.Vector3(p,C,T);if(void 0!==s&&e instanceof i.InstancedMesh){const t=new i.Matrix4;e.getMatrixAt(s,t);const n=new i.Matrix4;n.extractRotation(t),m.applyMatrix4(n),h.applyMatrix4(t),I.applyMatrix4(t),u.applyMatrix4(t)}return{p1:h,p2:I,p3:u,faceNormal:m}}round(e){const t=1e3;e.x=Math.trunc(e.x*t)/t,e.y=Math.trunc(e.y*t)/t,e.z=Math.trunc(e.z*t)/t}getVolumeFromFragments(e){const t=this.components.get(_r),s=new i.Matrix4,n=[];for(const r in e){const o=t.list.get(r);if(!o)continue;const a=e[r];let c=0;for(const e of a){const t=o.getInstancesIDs(e);t&&(c+=t.size)}const l=new i.InstancedMesh(o.mesh.geometry,void 0,c);let h=0;for(const e of a){const t=o.getInstancesIDs(e);if(t)for(const e of t)o.mesh.getMatrixAt(e,s),l.setMatrixAt(h++,s)}n.push(l)}const r=this.getVolumeFromMeshes(n);for(const e of n)e.geometry=null,e.material=[],e.dispose();return r}getVolumeFromMeshes(e){let t=0;for(const i of e)t+=this.getVolumeOfMesh(i);return t}getFaceData(e,t,s){const n=this.getVerticesAndNormal(s,e,t),{p1:r,p2:o,p3:a,faceNormal:c}=n;this.round(r),this.round(o),this.round(a),this.round(c);const l=[{id:`${r.x}|${r.y}|${r.z}`,value:r},{id:`${o.x}|${o.y}|${o.z}`,value:o},{id:`${a.x}|${a.y}|${a.z}`,value:a}];l.sort(((e,t)=>e.id<t.id?-1:e.id>t.id?1:0));const[{id:h,value:I},{id:u,value:d},{id:E,value:f}]=l,p=[{id:`${h}|${u}`,distance:I.distanceTo(d),points:[I,d]},{id:`${u}|${E}`,distance:d.distanceTo(f),points:[d,f]},{id:`${h}|${E}`,distance:I.distanceTo(f),points:[I,f]}],C=new i.Plane;return C.setFromNormalAndCoplanarPoint(c,r),C.constant=Math.round(10*C.constant)/10,{plane:C,edges:p}}getVolumeOfMesh(e){let t=0;const s=new i.Vector3,n=new i.Vector3,r=new i.Vector3,{index:o}=e.geometry,a=e.geometry.attributes.position.array;if(!o)return console.warn("Geometry must be indexed to compute its volume!"),0;const c=[];if(e instanceof i.InstancedMesh)for(let t=0;t<e.count;t++){const s=new i.Matrix4;e.getMatrixAt(t,s),c.push(s)}else c.push((new i.Matrix4).identity());const{matrixWorld:l}=e;for(let e=0;e<o.array.length-2;e+=3)for(const i of c){const c=i.multiply(l),h=3*o.array[e],I=3*o.array[e+1],u=3*o.array[e+2];s.set(a[h],a[h+1],a[h+2]).applyMatrix4(c),n.set(a[I],a[I+1],a[I+2]).applyMatrix4(c),r.set(a[u],a[u+1],a[u+2]).applyMatrix4(c),t+=this.getSignedVolumeOfTriangle(s,n,r)}return Math.abs(t)}getSignedVolumeOfTriangle(e,t,i){return 1/6*(-(i.x*t.y*e.z)+t.x*i.y*e.z+i.x*e.y*t.z-e.x*i.y*t.z-t.x*e.y*i.z+e.x*t.y*i.z)}};t(Ba,"uuid","267ca032-672f-4cb0-afa9-d24e904f39d6");let Va=Ba;class Ya{constructor(e){t(this,"cardinality","required"),t(this,"instructions"),t(this,"evalRequirement",((e,t,i,s)=>{const n={parameter:i,currentValue:e,requiredValue:t.parameter,pass:!1};s&&this.addCheckResult(n,s);let r=!1;if("simple"===t.type){r=e===t.parameter}if("enumeration"===t.type){r=t.parameter.includes(e)}if("pattern"===t.type){const i=t.parameter;r=new RegExp(i).test(String(e))}if("length"===t.type){const i=t.parameter,{min:s,length:n,max:o}=i;void 0!==n&&(r=String(e).length===n),void 0!==s&&(r=String(e).length>=s),void 0!==o&&(r=String(e).length<=o)}if("bounds"===t.type&&"number"==typeof e){const{min:i,minInclusive:s,max:n,maxInclusive:o}=t.parameter;let a=!0,c=!0;void 0!==i&&(a=s?e<=i:e<i),void 0!==n&&(c=o?e>=n:e>n),r=a&&c}return"prohibited"===this.cardinality&&(r=!r),"optional"===this.cardinality&&(r=!0),n.pass=r,n.pass})),t(this,"testResult",[]),this.components=e}addCheckResult(e,t){const i=t.findIndex((({parameter:t})=>t===e.parameter));-1!==i?t[i]=e:t.push(e)}saveResult(e,t){const{GlobalId:i}=e;if(!i)return;const{value:s}=i,n={expressID:s,pass:t,checks:[],cardinality:this.cardinality};this.testResult.push(n)}}const Ga=(e,t)=>{let i="";if(!t)return i;if("simple"===t.type&&(i=`<ids:simpleValue>${t.parameter}</ids:simpleValue>`),"enumeration"===t.type){i=`<xs:restriction base="xs:string">\n ${t.parameter.map((e=>`<xs:enumeration value="${e}" />`)).join("\r\n")}\n </xs:restriction>`}if("pattern"===t.type){i=`<xs:restriction base="xs:string">\n <xs:pattern value="${t.parameter}" />\n </xs:restriction>`}return`<ids:${e[0].toLowerCase()+e.slice(1)}>\n ${i}\n </ids:${e[0].toLowerCase()+e.slice(1)}>`};class za extends Ya{constructor(e,i){super(e),t(this,"name"),t(this,"value"),this.name=i}serialize(e){const t=Ga("Name",this.name),i=Ga("Value",this.value);let s="";return"requirement"===e&&(s+=`cardinality="${this.cardinality}"`,s+=this.instructions?`instructions="${this.instructions}"`:""),`<ids:attribute ${s}>\n ${t}\n ${i}\n</ids:attribute>`}async getEntities(){return[]}async test(e){var t;this.testResult=[];for(const i in e){const s=Number(i),n=e[s],r=[],o={guid:null==(t=n.GlobalId)?void 0:t.value,expressID:s,pass:!1,checks:r,cardinality:this.cardinality};this.testResult.push(o);const a=Object.keys(n).filter((e=>{const t=this.evalRequirement(e,this.name,"Name"),i=n[e];return t&&null===i?"optional"===this.cardinality||"prohibited"===this.cardinality:(!t||3!==(null==i?void 0:i.type)||2!==i.value)&&((!t||!Array.isArray(i)||0!==i.length)&&((!t||1!==(null==i?void 0:i.type)||""!==i.value.trim())&&t))})),c=a.length>0;if(r.push({parameter:"Name",currentValue:c?a[0]:null,requiredValue:this.name.parameter,pass:"prohibited"===this.cardinality?!c:c}),this.value)if(a[0]){const e=n[a[0]];5===(null==e?void 0:e.type)?r.push({parameter:"Value",currentValue:null,requiredValue:this.value.parameter,pass:"prohibited"===this.cardinality}):this.evalRequirement(e?e.value:null,this.value,"Value",r)}else r.push({parameter:"Value",currentValue:null,requiredValue:this.value.parameter,pass:"prohibited"===this.cardinality});o.pass=r.every((({pass:e})=>e))}const i=[...this.testResult];return this.testResult=[],i}}class ka extends Ya{constructor(e,i){super(e),t(this,"system"),t(this,"value"),t(this,"uri"),this.system=i}serialize(e){const t=Ga("System",this.system),i=Ga("Value",this.value);let s="";return"requirement"===e&&(s+=`cardinality="${this.cardinality}"`,s+=this.uri?`uri=${this.uri}`:"",s+=this.instructions?`instructions="${this.instructions}"`:""),`<ids:classification ${s}>\n ${t}\n ${i}\n</ids:classification>`}async getEntities(e,t={}){var i;const s=[],n={...await e.getAllPropertiesOfType(b.IFCCLASSIFICATIONREFERENCE),...await e.getAllPropertiesOfType(b.IFCCLASSIFICATION)},r=[];for(const t in n){const s=Number(t),n=await e.getProperties(s);if(!n)continue;const o=null==(i=n.ReferencedSource)?void 0:i.value;if(!o)continue;const a=await e.getProperties(o);if(!a)continue;if(!this.evalSystem(a))continue;if(!this.evalValue(n))continue;this.evalURI(n)&&r.push(s)}const o=this.components.get(yr);for(const i of r){const n=o.getEntitiesWithRelation(e,"HasAssociations",i);for(const i of n){if(i in t)continue;const n=await e.getProperties(i);n&&(t[i]=n,s.push(i))}}return s}async test(e,t){var i;this.testResult=[];for(const s in e){const n=Number(s),r=[],o={guid:null==(i=e[n].GlobalId)?void 0:i.value,expressID:n,pass:!1,checks:r,cardinality:this.cardinality};this.testResult.push(o);let a=!0;const c=await this.getSystems(t,n),l=c.map((e=>this.getSystemName(e))).filter((e=>e));for(const e of c){if(!this.evalSystem(e,r))continue;if(a=!1,!this.value||!this.system)break;if(e.type!==b.IFCCLASSIFICATIONREFERENCE)continue;const t=!this.value||this.evalValue(e,r),i=!this.uri||this.evalURI(e,r);if(t&&i)break}a&&this.addCheckResult({parameter:"System",currentValue:l,requiredValue:this.system,pass:"optional"===this.cardinality},r),o.pass=r.every((({pass:e})=>e))}const s=[...this.testResult];return this.testResult=[],s}async processReferencedSource(e,t){var i;const s=null==(i=t.ReferencedSource)?void 0:i.value;if(!s)return null;const n=await e.getProperties(s);return n?(n.type===b.IFCCLASSIFICATIONREFERENCE&&(n.ReferencedSource=await this.processReferencedSource(e,n)),n):null}async getSystems(e,t){var i;const s=[],n=this.components.get(yr),r=n.getEntityRelations(e,t,"HasAssociations");if(r)for(const t of r){const i=await e.getProperties(t);i&&(i.type===b.IFCCLASSIFICATION&&s.push(i),i.type===b.IFCCLASSIFICATIONREFERENCE&&(i.ReferencedSource=await this.processReferencedSource(e,i),i.ReferencedSource&&s.push(i)))}const o=s.map((e=>{var t,i,s;return e.type===b.IFCCLASSIFICATION?null==(t=e.Name)?void 0:t.value:e.type===b.IFCCLASSIFICATIONREFERENCE?null==(s=null==(i=e.ReferencedSource)?void 0:i.Name)?void 0:s.value:null})).filter((e=>e)),a=n.getEntityRelations(e,t,"IsTypedBy");if(!a||!a[0])return s;const c=a[0],l=n.getEntityRelations(e,c,"HasAssociations");if(l)for(const t of l){const n=await e.getProperties(t);if(n){if(n.type===b.IFCCLASSIFICATION){if(o.includes(null==(i=n.Name)?void 0:i.value))continue;s.push(n)}n.type===b.IFCCLASSIFICATIONREFERENCE&&(n.ReferencedSource=await this.processReferencedSource(e,n),n.ReferencedSource&&s.push(n))}}return s}getSystemName(e){var t,i,s,n;if(e.type===b.IFCCLASSIFICATION)return null==(t=e.Name)?void 0:t.value;if(e.type===b.IFCCLASSIFICATIONREFERENCE){if((null==(i=e.ReferencedSource)?void 0:i.type)===b.IFCCLASSIFICATIONREFERENCE)return this.getSystemName(e.ReferencedSource);if((null==(s=e.ReferencedSource)?void 0:s.type)===b.IFCCLASSIFICATION)return null==(n=e.ReferencedSource.Name)?void 0:n.value}return null}getAllReferenceIdentifications(e){if(e.type!==b.IFCCLASSIFICATIONREFERENCE)return null;const t=[];if(e.Identification&&t.push(e.Identification.value),e.ReferencedSource){const i=this.getAllReferenceIdentifications(e.ReferencedSource);i&&t.push(...i)}return t}evalSystem(e,t){const i=this.getSystemName(e);return this.evalRequirement(i,this.system,"System",t)}evalValue(e,t){if(!this.value)return!0;const i=this.getAllReferenceIdentifications(e);if(!i)return!1;const s=i.find((e=>!!this.value&&this.evalRequirement(e,this.value,"Value")));return t&&this.addCheckResult({parameter:"Value",currentValue:s??null,requiredValue:this.value,pass:!!s},t),!!s}evalURI(e,t){var i;if(!this.uri)return!0;return this.evalRequirement(null==(i=e.Location)?void 0:i.value,{type:"simple",parameter:this.uri},"URI",t)}}class Ha extends Ya{constructor(e,i){super(e),t(this,"name"),t(this,"predefinedType"),this.name=i}serialize(e){const t=Ga("Name",this.name),i=Ga("Name",this.predefinedType);let s="";return"requirement"===e&&(s+=`cardinality="${this.cardinality}"`,s+=this.instructions?`instructions="${this.instructions}"`:""),`<ids:entity ${s}>\n ${t}\n ${i}\n</ids:entity>`}async getEntities(e,t={}){const i=Object.entries(cr),s=[];for(const[e]of i){await this.evalName({type:e})&&s.push(Number(e))}let n={};for(const t of s){const i=await e.getAllPropertiesOfType(t);i&&(n={...n,...i})}if(!this.predefinedType){for(const e in n)e in t||(t[e]=n[e]);return Object.keys(n).map(Number)}const r=[];for(const i in n){const s=Number(i);if(s in t)continue;const o=n[s];await this.evalPredefinedType(e,o)&&(t[s]=o,r.push(s))}return r}async test(e,t){var i;this.testResult=[];for(const s in e){const n=Number(s),r=e[n],o=[],a={guid:null==(i=r.GlobalId)?void 0:i.value,expressID:n,pass:!1,checks:o,cardinality:this.cardinality};this.testResult.push(a),await this.evalName(r,o),await this.evalPredefinedType(t,r,o),a.pass=o.every((({pass:e})=>e))}return this.testResult}async evalName(e,t){const i=cr[e.type];return this.evalRequirement(i,this.name,"Name",t)}async evalPredefinedType(e,t,i){var s,n,r,o;if(!this.predefinedType)return null;const a=this.components.get(yr),c="string"==typeof this.predefinedType.parameter&&"USERDEFINED"===this.predefinedType.parameter;let l=null==(s=t.PredefinedType)?void 0:s.value;if("USERDEFINED"===l&&!c){const e=Object.keys(t).find((e=>/^((?!Predefined).)*Type$/.test(e)));l=e?null==(n=t[e])?void 0:n.value:"USERDEFINED"}if(!l){const i=a.getEntityRelations(e,t.expressID,"IsTypedBy");if(i&&i[0]){const t=await e.getProperties(i[0]);if(t&&(l=null==(r=t.PredefinedType)?void 0:r.value,"USERDEFINED"===l&&!c)){const e=Object.keys(t).find((e=>/^((?!Predefined).)*Type$/.test(e)));l=e?null==(o=t[e])?void 0:o.value:"USERDEFINED"}}}return this.evalRequirement(l,this.predefinedType,"PredefinedType",i)}}class Wa extends Ya{constructor(e,i,s){super(e),t(this,"propertySet"),t(this,"baseName"),t(this,"value"),t(this,"dataType"),t(this,"uri"),t(this,"_unsupportedTypes",[b.IFCCOMPLEXPROPERTY,b.IFCPHYSICALCOMPLEXQUANTITY]),this.propertySet=i,this.baseName=s}serialize(e){const t=Ga("PropertySet",this.propertySet),i=Ga("BaseName",this.baseName),s=Ga("Value",this.value),n=this.dataType?`dataType=${this.dataType}`:"";let r="";return"requirement"===e&&(r+=`cardinality="${this.cardinality}"`,r+=this.uri?`uri=${this.uri}`:"",r+=this.instructions?`instructions="${this.instructions}"`:""),`<ids:property ${n} ${r}>\n ${t}\n ${i}\n ${s}\n</ids:property>`}async getEntities(e,t={}){var i,s;let n={};const r=await e.getAllPropertiesOfType(b.IFCPROPERTYSET);n={...n,...r};const o=await e.getAllPropertiesOfType(b.IFCELEMENTQUANTITY);if(n={...n,...o},0===Object.keys(n).length)return[];const a=[];for(const t in n){const n=Number(t),r=await e.getProperties(n);if(!r)continue;if(!((null==(i=r.Name)?void 0:i.value)===this.propertySet.parameter))continue;let o;if(r.type===b.IFCPROPERTYSET&&(o="HasProperties"),r.type===b.IFCELEMENTQUANTITY&&(o="Quantities"),o)for(const t of r[o]){const i=await e.getProperties(t.value);if(!i)continue;if((null==(s=i.Name)?void 0:s.value)===this.baseName.parameter){if(this.value){const e=Object.keys(i).find((e=>e.endsWith("Value")));if(!e)continue;if(!(i[e].value===this.value.parameter))continue}a.push(n)}}}const c=this.components.get(yr);for(const i of a){const s=c.getEntitiesWithRelation(e,"IsDefinedBy",i);for(const i of s){if(i in t)continue;const s=await e.getProperties(i);s&&(t[i]=s)}}return[]}async test(e,t){var i;this.testResult=[];for(const s in e){const n=Number(s),r=e[n],o=[],a={guid:null==(i=r.GlobalId)?void 0:i.value,expressID:n,pass:!1,checks:o,cardinality:this.cardinality};this.testResult.push(a);const c=(await this.getPsets(t,n)).filter((e=>{var t;return!!this.evalRequirement((null==(t=e.Name)?void 0:t.value)??null,this.propertySet,"PropertySet")&&(o.push({currentValue:e.Name.value,parameter:"PropertySet",pass:!0,requiredValue:this.propertySet.parameter}),!0)}));if(0!==c.length){for(const e of c){const t=this.getItemsAttrName(e.type);if(!t){o.push({currentValue:null,parameter:"BaseName",pass:!1,requiredValue:this.baseName.parameter});continue}const i=e[t].filter((e=>{var t;if(this._unsupportedTypes.includes(e.type))return!1;return!!this.evalRequirement((null==(t=e.Name)?void 0:t.value)??null,this.baseName,"BaseName")&&(o.push({currentValue:e.Name.value,parameter:"BaseName",pass:!0,requiredValue:this.baseName.parameter}),!0)}));if(0!==i.length)for(const e of i)this.evalValue(e,o),this.evalDataType(e,o),this.evalURI();else o.push({currentValue:null,parameter:"BaseName",pass:!1,requiredValue:this.baseName.parameter})}a.pass=o.every((({pass:e})=>e))}else o.push({currentValue:null,parameter:"PropertySet",pass:!1,requiredValue:this.propertySet.parameter})}const s=[...this.testResult];return this.testResult=[],s}getItemsAttrName(e){let t;return e===b.IFCPROPERTYSET&&(t="HasProperties"),e===b.IFCELEMENTQUANTITY&&(t="Quantities"),t}getValueKey(e){return Object.keys(e).find((e=>e.endsWith("Value")||e.endsWith("Values")))}async getPsets(e,t){const i=[],s=this.components.get(yr).getEntityRelations(e,t,"IsDefinedBy");if(!s)return i;for(const t of s){const s=await e.getProperties(t);if(!s)continue;const n=this.getItemsAttrName(s.type);if(!n)continue;const r=structuredClone(s),o=[];for(const{value:t}of r[n]){const i=await e.getProperties(t);i&&o.push(i)}r[n]=o,i.push(r)}return i}evalValue(e,t){const i=this.getValueKey(e);if(this.value){if(!i)return null==t||t.push({parameter:"Value",currentValue:null,pass:!1,requiredValue:this.value.parameter}),!1;const s=e[i],n=structuredClone(this.value);if("IFCLABEL"===s.name&&"simple"===n.type&&(n.parameter=String(n.parameter)),(e.type===b.IFCPROPERTYLISTVALUE||e.type===b.IFCPROPERTYENUMERATEDVALUE)&&Array.isArray(s)){const e=s.map((e=>e.value)),i=s.find((e=>!!n&&this.evalRequirement(e.value,n,"Value")));return null==t||t.push({currentValue:e,pass:!!i,parameter:"Value",requiredValue:n.parameter}),!!i}return this.evalRequirement(s.value,n,"Value",t)}if(!i)return!0;const s=e[i];return 3===s.type&&2===s.value?(null==t||t.push({parameter:"Value",currentValue:null,pass:!1,requiredValue:null}),!1):1!==s.type||""!==s.value.trim()||(null==t||t.push({parameter:"Value",currentValue:"",pass:!1,requiredValue:null}),!1)}evalDataType(e,t){if(!this.dataType)return!0;const i=e[this.getValueKey(e)];if((e.type===b.IFCPROPERTYLISTVALUE||e.type===b.IFCPROPERTYENUMERATEDVALUE)&&Array.isArray(i)&&i[0]){const e=i[0].name;return this.evalRequirement(e,{type:"simple",parameter:this.dataType},"DataType",t)}return this.evalRequirement(i.name,{type:"simple",parameter:this.dataType},"DataType",t)}evalURI(){return!0}}class Xa{constructor(e,i,s){t(this,"name"),t(this,"ifcVersion",new Set),t(this,"identifier",Gi.create()),t(this,"description"),t(this,"instructions"),t(this,"requirementsDescription"),t(this,"applicability",new Ci),t(this,"requirements",new Ci),t(this,"components"),this.components=e,this.name=i;for(const e of s)this.ifcVersion.add(e)}async test(e){let t=[];if(0===this.requirements.size)return t;const i={};for(const t of this.applicability)await t.getEntities(e,i);const s=[...this.requirements][0];return t=await s.test(i,e),t}serialize(){const e=`name="${this.name}"`,t=this.identifier?`identifier="${this.identifier}"`:"",i=this.description?`description="${this.description}"`:"",s=this.instructions?`instructions="${this.instructions}"`:"";return`<ids:specification ifcVersion="${[...this.ifcVersion].join(" ")}" ${e} ${t} ${i} ${s}>\n <ids:applicability minOccurs="1" maxOccurs="unbounded">\n ${[...this.applicability].map((e=>e.serialize("applicability")))}\n </ids:applicability>\n <ids:requirements>\n ${[...this.requirements].map((e=>e.serialize("requirement")))}\n </ids:requirements>\n </ids:specification>`}}const ja=e=>{if(!e)return;const t={type:"simple"};if("simpleValue"in e&&(t.parameter=e.simpleValue),"restriction"in e){const i=e.restriction;if("pattern"in i&&(t.type="pattern",t.parameter=i.pattern.value),"enumeration"in i){t.type="enumeration";const e=i.enumeration.map((({value:e})=>e));t.parameter=e}}return void 0!==t.parameter?t:void 0},Za=(e,t)=>{const i=[];for(const s of t){const t=s.name,n=ja(t);if(!n)continue;const r=new Ha(e,n);s.cardinality&&(r.cardinality=s.cardinality),r.predefinedType=ja(s.predefinedType),i.push(r)}return i},$a=(e,t)=>{const i=[];for(const s of t){const t=s.name,n=ja(t);if(!n)continue;const r=new za(e,n);s.cardinality&&(r.cardinality=s.cardinality),r.value=ja(s.value),i.push(r)}return i},qa=(e,t)=>{const i=[];for(const s of t){const t=s.system,n=ja(t);if(!n)continue;const r=new ka(e,n);s.cardinality&&(r.cardinality=s.cardinality);const o=ja(s.value);"simple"===(null==o?void 0:o.type)&&(o.parameter=String(o.parameter)),"enumeration"===(null==o?void 0:o.type)&&Array.isArray(o.parameter)&&(o.parameter=o.parameter.map(String)),r.value=o,r.uri=s.uri,i.push(r)}return i},Qa=(e,t)=>{const i=[];for(const s of t){const t=s.propertySet,n=s.baseName,r=ja(t),o=ja(n);if(!o||!r)continue;const a=new Wa(e,r,o);s.cardinality&&(a.cardinality=s.cardinality);const c=ja(s.value);"enumeration"===(null==c?void 0:c.type)&&Array.isArray(c.parameter)&&(c.parameter=c.parameter.map(String)),a.value=c,a.dataType=s.dataType,a.uri=s.uri,i.push(a)}return i},Ka=class e extends hi{constructor(i){super(i),t(this,"enabled",!0),t(this,"list",new Ti),i.add(e.uuid,this)}getFragmentIdMap(e,t){const i=t.filter((e=>e.pass)).map((e=>e.expressID)),s=e.getFragmentMap(i),n=t.filter((e=>!e.pass)).map((e=>e.expressID));return{pass:s,fail:e.getFragmentMap(n)}}create(e,t){const i=new Xa(this.components,e,t);return this.list.set(i.identifier,i),i}load(t){const i=[],s=e.xmlParser.parse(t).ids,{specifications:n}=s;if(n&&n.specification){const e=Array.isArray(n.specification)?n.specification:[n.specification];for(const t of e){const{name:e,ifcVersion:s}=t;if(!e||!s)continue;const n=[],r=[],{applicability:o,requirements:a}=t;if(o){const{maxOccurs:e,...t}=o,i=Array.isArray(t)?t:[t];for(const e of i)for(const t in e){const i=Array.isArray(e[t])?e[t]:[e[t]];if("entity"===t){const e=Za(this.components,i);n.push(...e)}}}if(a){const{maxOccurs:e,...t}=a,i=Array.isArray(t)?t:[t];for(const e of i)for(const t in e){const i=Array.isArray(e[t])?e[t]:[e[t]];if("entity"===t){const e=Za(this.components,i);r.push(...e)}if("attribute"===t){const e=$a(this.components,i);r.push(...e)}if("classification"===t){const e=qa(this.components,i);r.push(...e)}if("property"===t){const e=Qa(this.components,i);r.push(...e)}}}if(n.length>0&&r.length>0){const t=this.create(e,s.split(/\s+/));t.applicability.add(...n),t.requirements.add(...r),i.push(t)}}}return i}export(e,t=this.list.values()){const i=t??this.list;return`<ids:ids xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://standards.buildingsmart.org/IDS http://standards.buildingsmart.org/IDS/1.0/ids.xsd" xmlns:ids="http://standards.buildingsmart.org/IDS">\n \x3c!-- Made with That Open Engine ${Hi.release} (https://github.com/thatopen/engine_components) --\x3e\n <ids:info>\n <ids:title>${e.title}</ids:title>\n ${e.copyright?`<ids:copyright>${e.copyright}</ids:copyright>`:""}\n ${e.version?`<ids:version>${e.version}</ids:version>`:""}\n ${e.description?`<ids:description>${e.description}</ids:description>`:""}\n ${e.author?`<ids:author>${e.author}</ids:author>`:""}\n ${e.date?`<ids:date>${e.date.toISOString().split("T")[0]}</ids:date>`:""}\n ${e.purpose?`<ids:purpose>${e.purpose}</ids:purpose>`:""}\n ${e.milestone?`<ids:milestone>${e.milestone}</ids:milestone>`:""}\n </ids:info>\n <ids:specifications>\n ${[...i].map((e=>e.serialize())).join("\n")}\n </ids:specifications>\n</ids:ids>`}};t(Ka,"uuid","9f0b9f78-9b2e-481a-b766-2fbfd01f342c"),t(Ka,"xmlParser",new ea.XMLParser({allowBooleanAttributes:!0,attributeNamePrefix:"",ignoreAttributes:!1,ignoreDeclaration:!0,ignorePiTags:!0,numberParseOptions:{leadingZeros:!0,hex:!0},parseAttributeValue:!0,preserveOrder:!1,processEntities:!1,removeNSPrefix:!0,trimValues:!0}));let Ja=Ka;export{ci as AsyncEvent,aa as BCFTopics,ra as BCFTopicsConfigManager,li as Base,ui as BaseCamera,di as BaseRenderer,pi as BaseScene,Ii as BaseWorldItem,la as BoundingBoxer,Ra as Classifier,Jn as Clipper,ta as Comment,hi as Component,mi as ComponentWithUI,Hi as Components,Zi as ConfigManager,Xi as Configurator,nn as CullerRenderer,an as Cullers,Ti as DataMap,Ci as DataSet,fi as Disposer,ai as Event,Ri as EventManager,Aa as Exploder,er as FirstPersonMode,_r as FragmentsManager,Cr as GeometryTypes,Cn as Grids,Sa as Hider,za as IDSAttribute,ka as IDSClassification,Ha as IDSEntity,Ya as IDSFacet,Wa as IDSProperty,Xa as IDSSpecification,Ja as IDSSpecifications,Ea as IfcBasicQuery,ar as IfcCategories,cr as IfcCategoryMap,or as IfcElements,Ta as IfcFinder,Ia as IfcFinderQuery,dr as IfcFragmentSettings,ya as IfcGeometryTiler,mr as IfcJsonExporter,gr as IfcLoader,Or as IfcPropertiesManager,_a as IfcPropertiesTiler,lr as IfcPropertiesUtils,pa as IfcPropertyQuery,yr as IfcRelationsIndexer,Oa as IfcStreamingSettings,Vi as MaterialsUtils,Va as MeasurementUtils,rn as MeshCullerRenderer,ba as MiniMap,Da as MiniMapConfigManager,xa as MiniMaps,hn as Mouse,tr as OrbitMode,nr as OrthoPerspectiveCamera,ir as PlanMode,sr as ProjectionManager,La as PropertiesStreamingSettings,dn as Raycasters,ln as ShadowedScene,Qs as SimpleCamera,fn as SimpleGrid,En as SimpleGridConfigManager,qn as SimplePlane,In as SimpleRaycaster,Ji as SimpleRenderer,Ki as SimpleScene,Qi as SimpleSceneConfigManager,Wi as SimpleWorld,sa as Topic,Gi as UUID,zi as VertexPicker,Pa as Viewpoint,va as Viewpoints,Js as Worlds,na as extensionsImporter,hr as ifcCategoryCase,Ar as ifcRelAttrsPosition,Fr as ifcRelClassNames,Bi as isPointInFrontOfPlane,xi as obbFromPoints,tn as readPixelsAsync,rr as relToAttributesMap};
18
+ */const Dr=wr(vr.exports=function e(t,i,s){function n(o,a){if(!i[o]){if(!t[o]){if(!a&&Mr)return Mr(o);if(r)return r(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=i[o]={exports:{}};t[o][0].call(l.exports,(function(e){return n(t[o][1][e]||e)}),l,l.exports,e,t,i,s)}return i[o].exports}for(var r=Mr,o=0;o<s.length;o++)n(s[o]);return n}({1:[function(e,t,i){var s=e("./utils"),n=e("./support"),r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(e){for(var t,i,n,o,a,c,l,h=[],I=0,u=e.length,d=u,E="string"!==s.getTypeOf(e);I<e.length;)d=u-I,n=E?(t=e[I++],i=I<u?e[I++]:0,I<u?e[I++]:0):(t=e.charCodeAt(I++),i=I<u?e.charCodeAt(I++):0,I<u?e.charCodeAt(I++):0),o=t>>2,a=(3&t)<<4|i>>4,c=1<d?(15&i)<<2|n>>6:64,l=2<d?63&n:64,h.push(r.charAt(o)+r.charAt(a)+r.charAt(c)+r.charAt(l));return h.join("")},i.decode=function(e){var t,i,s,o,a,c,l=0,h=0,I="data:";if(e.substr(0,I.length)===I)throw new Error("Invalid base64 input, it looks like a data url.");var u,d=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===r.charAt(64)&&d--,e.charAt(e.length-2)===r.charAt(64)&&d--,d%1!=0)throw new Error("Invalid base64 input, bad content length.");for(u=n.uint8array?new Uint8Array(0|d):new Array(0|d);l<e.length;)t=r.indexOf(e.charAt(l++))<<2|(o=r.indexOf(e.charAt(l++)))>>4,i=(15&o)<<4|(a=r.indexOf(e.charAt(l++)))>>2,s=(3&a)<<6|(c=r.indexOf(e.charAt(l++))),u[h++]=t,64!==a&&(u[h++]=i),64!==c&&(u[h++]=s);return u}},{"./support":30,"./utils":32}],2:[function(e,t,i){var s=e("./external"),n=e("./stream/DataWorker"),r=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function a(e,t,i,s,n){this.compressedSize=e,this.uncompressedSize=t,this.crc32=i,this.compression=s,this.compressedContent=n}a.prototype={getContentWorker:function(){var e=new n(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",(function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),e},getCompressedWorker:function(){return new n(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,i){return e.pipe(new r).pipe(new o("uncompressedSize")).pipe(t.compressWorker(i)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,i){var s=e("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,i){var s=e("./utils"),n=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==s.getTypeOf(e)?function(e,t,i,s){var r=n,o=s+i;e^=-1;for(var a=s;a<o;a++)e=e>>>8^r[255&(e^t[a])];return~e}(0|t,e,e.length,0):function(e,t,i,s){var r=n,o=s+i;e^=-1;for(var a=s;a<o;a++)e=e>>>8^r[255&(e^t.charCodeAt(a))];return~e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(e,t,i){var s=null;s="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:s}},{lie:37}],7:[function(e,t,i){var s="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=e("pako"),r=e("./utils"),o=e("./stream/GenericWorker"),a=s?"uint8array":"array";function c(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}i.magic="\b\0",r.inherits(c,o),c.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(r.transformTo(a,e.data),!1)},c.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},i.compressWorker=function(e){return new c("Deflate",e)},i.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,i){function s(e,t){var i,s="";for(i=0;i<t;i++)s+=String.fromCharCode(255&e),e>>>=8;return s}function n(e,t,i,n,o,h){var I,u,d=e.file,E=e.compression,f=h!==a.utf8encode,p=r.transformTo("string",h(d.name)),C=r.transformTo("string",a.utf8encode(d.name)),T=d.comment,m=r.transformTo("string",h(T)),R=r.transformTo("string",a.utf8encode(T)),g=C.length!==d.name.length,A=R.length!==T.length,F="",S="",O="",N=d.dir,y=d.date,L={crc32:0,compressedSize:0,uncompressedSize:0};t&&!i||(L.crc32=e.crc32,L.compressedSize=e.compressedSize,L.uncompressedSize=e.uncompressedSize);var _=0;t&&(_|=8),f||!g&&!A||(_|=2048);var P,w,M,v=0,D=0;N&&(v|=16),"UNIX"===o?(D=798,v|=(P=d.unixPermissions,w=N,M=P,P||(M=w?16893:33204),(65535&M)<<16)):(D=20,v|=function(e){return 63&(e||0)}(d.dosPermissions)),I=y.getUTCHours(),I<<=6,I|=y.getUTCMinutes(),I<<=5,I|=y.getUTCSeconds()/2,u=y.getUTCFullYear()-1980,u<<=4,u|=y.getUTCMonth()+1,u<<=5,u|=y.getUTCDate(),g&&(S=s(1,1)+s(c(p),4)+C,F+="up"+s(S.length,2)+S),A&&(O=s(1,1)+s(c(m),4)+R,F+="uc"+s(O.length,2)+O);var b="";return b+="\n\0",b+=s(_,2),b+=E.magic,b+=s(I,2),b+=s(u,2),b+=s(L.crc32,4),b+=s(L.compressedSize,4),b+=s(L.uncompressedSize,4),b+=s(p.length,2),b+=s(F.length,2),{fileRecord:l.LOCAL_FILE_HEADER+b+p+F,dirRecord:l.CENTRAL_FILE_HEADER+s(D,2)+b+s(m.length,2)+"\0\0\0\0"+s(v,4)+s(n,4)+p+F+m}}var r=e("../utils"),o=e("../stream/GenericWorker"),a=e("../utf8"),c=e("../crc32"),l=e("../signature");function h(e,t,i,s){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=i,this.encodeFileName=s,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}r.inherits(h,o),h.prototype.push=function(e){var t=e.meta.percent||0,i=this.entriesCount,s=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:i?(t+100*(i-s-1))/i:100}}))},h.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var i=n(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(e){this.accumulate=!1;var t,i=this.streamFiles&&!e.file.dir,r=n(e,i,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),i)this.push({data:(t=e,l.DATA_DESCRIPTOR+s(t.crc32,4)+s(t.compressedSize,4)+s(t.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var i,n,o,a,c,h,I=this.bytesWritten-e,u=(i=this.dirRecords.length,n=I,o=e,a=this.zipComment,c=this.encodeFileName,h=r.transformTo("string",c(a)),l.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(i,2)+s(i,2)+s(n,4)+s(o,4)+s(h.length,2)+h);this.push({data:u,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()})),e.on("error",(function(e){t.error(e)})),this},h.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(e){var t=this._sources;if(!o.prototype.error.call(this,e))return!1;for(var i=0;i<t.length;i++)try{t[i].error(e)}catch(e){}return!0},h.prototype.lock=function(){o.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,i){var s=e("../compressions"),n=e("./ZipFileWorker");i.generateWorker=function(e,t,i){var r=new n(t.streamFiles,i,t.platform,t.encodeFileName),o=0;try{e.forEach((function(e,i){o++;var n=function(e,t){var i=e||t,n=s[i];if(!n)throw new Error(i+" is not a valid compression method !");return n}(i.options.compression,t.compression),a=i.options.compressionOptions||t.compressionOptions||{},c=i.dir,l=i.date;i._compressWorker(n,a).withStreamInfo("file",{name:e,dir:c,date:l,comment:i.comment||"",unixPermissions:i.unixPermissions,dosPermissions:i.dosPermissions}).pipe(r)})),r.entriesCount=o}catch(e){r.error(e)}return r}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,i){function s(){if(!(this instanceof s))return new s;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 e=new s;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(s.prototype=e("./object")).loadAsync=e("./load"),s.support=e("./support"),s.defaults=e("./defaults"),s.version="3.10.1",s.loadAsync=function(e,t){return(new s).loadAsync(e,t)},s.external=e("./external"),t.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,i){var s=e("./utils"),n=e("./external"),r=e("./utf8"),o=e("./zipEntries"),a=e("./stream/Crc32Probe"),c=e("./nodejsUtils");function l(e){return new n.Promise((function(t,i){var s=e.decompressed.getContentWorker().pipe(new a);s.on("error",(function(e){i(e)})).on("end",(function(){s.streamInfo.crc32!==e.decompressed.crc32?i(new Error("Corrupted zip : CRC32 mismatch")):t()})).resume()}))}t.exports=function(e,t){var i=this;return t=s.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:r.utf8decode}),c.isNode&&c.isStream(e)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then((function(e){var i=new o(t);return i.load(e),i})).then((function(e){var i=[n.Promise.resolve(e)],s=e.files;if(t.checkCRC32)for(var r=0;r<s.length;r++)i.push(l(s[r]));return n.Promise.all(i)})).then((function(e){for(var n=e.shift(),r=n.files,o=0;o<r.length;o++){var a=r[o],c=a.fileNameStr,l=s.resolve(a.fileNameStr);i.file(l,a.decompressed,{binary:!0,optimizedBinaryString:!0,date:a.date,dir:a.dir,comment:a.fileCommentStr.length?a.fileCommentStr:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:t.createFolders}),a.dir||(i.file(l).unsafeOriginalName=c)}return n.zipComment.length&&(i.comment=n.zipComment),i}))}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,i){var s=e("../utils"),n=e("../stream/GenericWorker");function r(e,t){n.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}s.inherits(r,n),r.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",(function(e){t.push({data:e,meta:{percent:0}})})).on("error",(function(e){t.isPaused?this.generatedError=e:t.error(e)})).on("end",(function(){t.isPaused?t._upstreamEnded=!0:t.end()}))},r.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},r.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=r},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,i){var s=e("readable-stream").Readable;function n(e,t,i){s.call(this,t),this._helper=e;var n=this;e.on("data",(function(e,t){n.push(e)||n._helper.pause(),i&&i(t)})).on("error",(function(e){n.emit("error",e)})).on("end",(function(){n.push(null)}))}e("../utils").inherits(n,s),n.prototype._read=function(){this._helper.resume()},t.exports=n},{"../utils":32,"readable-stream":16}],14:[function(e,t,i){t.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,i){function s(e,t,i){var s,n=r.getTypeOf(t),a=r.extend(i||{},c);a.date=a.date||new Date,null!==a.compression&&(a.compression=a.compression.toUpperCase()),"string"==typeof a.unixPermissions&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&16384&a.unixPermissions&&(a.dir=!0),a.dosPermissions&&16&a.dosPermissions&&(a.dir=!0),a.dir&&(e=f(e)),a.createFolders&&(s=E(e))&&p.call(this,s,!0);var I="string"===n&&!1===a.binary&&!1===a.base64;i&&void 0!==i.binary||(a.binary=!I),(t instanceof l&&0===t.uncompressedSize||a.dir||!t||0===t.length)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",n="string");var C=null;C=t instanceof l||t instanceof o?t:u.isNode&&u.isStream(t)?new d(e,t):r.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var T=new h(e,C,a);this.files[e]=T}var n=e("./utf8"),r=e("./utils"),o=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),c=e("./defaults"),l=e("./compressedObject"),h=e("./zipObject"),I=e("./generate"),u=e("./nodejsUtils"),d=e("./nodejs/NodejsStreamInputAdapter"),E=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},f=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},p=function(e,t){return t=void 0!==t?t:c.createFolders,e=f(e),this.files[e]||s.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function C(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var T={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,i,s;for(t in this.files)s=this.files[t],(i=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(i,s)},filter:function(e){var t=[];return this.forEach((function(i,s){e(i,s)&&t.push(s)})),t},file:function(e,t,i){if(1!==arguments.length)return e=this.root+e,s.call(this,e,t,i),this;if(C(e)){var n=e;return this.filter((function(e,t){return!t.dir&&n.test(e)}))}var r=this.files[this.root+e];return r&&!r.dir?r:null},folder:function(e){if(!e)return this;if(C(e))return this.filter((function(t,i){return i.dir&&e.test(t)}));var t=this.root+e,i=p.call(this,t),s=this.clone();return s.root=i.name,s},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var i=this.filter((function(t,i){return i.name.slice(0,e.length)===e})),s=0;s<i.length;s++)delete this.files[i[s].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,i={};try{if((i=r.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=i.type.toLowerCase(),i.compression=i.compression.toUpperCase(),"binarystring"===i.type&&(i.type="string"),!i.type)throw new Error("No output type specified.");r.checkSupport(i.type),"darwin"!==i.platform&&"freebsd"!==i.platform&&"linux"!==i.platform&&"sunos"!==i.platform||(i.platform="UNIX"),"win32"===i.platform&&(i.platform="DOS");var s=i.comment||this.comment||"";t=I.generateWorker(this,i,s)}catch(e){(t=new o("error")).error(e)}return new a(t,i.type||"string",i.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=T},{"./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(e,t,i){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,i){var s=e("./DataReader");function n(e){s.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(n,s),n.prototype.byteAt=function(e){return this.data[this.zero+e]},n.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),i=e.charCodeAt(1),s=e.charCodeAt(2),n=e.charCodeAt(3),r=this.length-4;0<=r;--r)if(this.data[r]===t&&this.data[r+1]===i&&this.data[r+2]===s&&this.data[r+3]===n)return r-this.zero;return-1},n.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),i=e.charCodeAt(1),s=e.charCodeAt(2),n=e.charCodeAt(3),r=this.readData(4);return t===r[0]&&i===r[1]&&s===r[2]&&n===r[3]},n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],18:[function(e,t,i){var s=e("../utils");function n(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,i=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)i=(i<<8)+this.byteAt(t);return this.index+=e,i},readString:function(e){return s.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t,i){var s=e("./Uint8ArrayReader");function n(e){s.call(this,e)}e("../utils").inherits(n,s),n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,i){var s=e("./DataReader");function n(e){s.call(this,e)}e("../utils").inherits(n,s),n.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},n.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},n.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t,i){var s=e("./ArrayReader");function n(e){s.call(this,e)}e("../utils").inherits(n,s),n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,i){var s=e("../utils"),n=e("../support"),r=e("./ArrayReader"),o=e("./StringReader"),a=e("./NodeBufferReader"),c=e("./Uint8ArrayReader");t.exports=function(e){var t=s.getTypeOf(e);return s.checkSupport(t),"string"!==t||n.uint8array?"nodebuffer"===t?new a(e):n.uint8array?new c(s.transformTo("uint8array",e)):new r(s.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,i){var s=e("./GenericWorker"),n=e("../utils");function r(e){s.call(this,"ConvertWorker to "+e),this.destType=e}n.inherits(r,s),r.prototype.processChunk=function(e){this.push({data:n.transformTo(this.destType,e.data),meta:e.meta})},t.exports=r},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,i){var s=e("./GenericWorker"),n=e("../crc32");function r(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(r,s),r.prototype.processChunk=function(e){this.streamInfo.crc32=n(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=r},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,i){var s=e("../utils"),n=e("./GenericWorker");function r(e){n.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}s.inherits(r,n),r.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}n.prototype.processChunk.call(this,e)},t.exports=r},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,i){var s=e("../utils"),n=e("./GenericWorker");function r(e){n.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then((function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=s.getTypeOf(e),t.isPaused||t._tickAndRepeat()}),(function(e){t.error(e)}))}s.inherits(r,n),r.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},r.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},r.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},r.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=r},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,i){function s(e){this.name=e||"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}s.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var i=0;i<this._listeners[e].length;i++)this._listeners[e][i].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.end()})),e.on("error",(function(e){t.error(e)})),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 e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},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 e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=s},{}],29:[function(e,t,i){var s=e("../utils"),n=e("./ConvertWorker"),r=e("./GenericWorker"),o=e("../base64"),a=e("../support"),c=e("../external"),l=null;if(a.nodestream)try{l=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function h(e,t){return new c.Promise((function(i,n){var r=[],a=e._internalType,c=e._outputType,l=e._mimeType;e.on("data",(function(e,i){r.push(e),t&&t(i)})).on("error",(function(e){r=[],n(e)})).on("end",(function(){try{var e=function(e,t,i){switch(e){case"blob":return s.newBlob(s.transformTo("arraybuffer",t),i);case"base64":return o.encode(t);default:return s.transformTo(e,t)}}(c,function(e,t){var i,s=0,n=null,r=0;for(i=0;i<t.length;i++)r+=t[i].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(n=new Uint8Array(r),i=0;i<t.length;i++)n.set(t[i],s),s+=t[i].length;return n;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(a,r),l);i(e)}catch(e){n(e)}r=[]})).resume()}))}function I(e,t,i){var o=t;switch(t){case"blob":case"arraybuffer":o="uint8array";break;case"base64":o="string"}try{this._internalType=o,this._outputType=t,this._mimeType=i,s.checkSupport(o),this._worker=e.pipe(new n(o)),e.lock()}catch(e){this._worker=new r("error"),this._worker.error(e)}}I.prototype={accumulate:function(e){return h(this,e)},on:function(e,t){var i=this;return"data"===e?this._worker.on(e,(function(e){t.call(i,e.data,e.meta)})):this._worker.on(e,(function(){s.delay(t,arguments,i)})),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(s.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new l(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=I},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,i.nodebuffer="undefined"!=typeof Buffer,i.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=0===new Blob([s],{type:"application/zip"}).size}catch(e){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(s),i.blob=0===n.getBlob("application/zip").size}catch(e){i.blob=!1}}}try{i.nodestream=!!e("readable-stream").Readable}catch(e){i.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,i){for(var s=e("./utils"),n=e("./support"),r=e("./nodejsUtils"),o=e("./stream/GenericWorker"),a=new Array(256),c=0;c<256;c++)a[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function l(){o.call(this,"utf-8 decode"),this.leftOver=null}function h(){o.call(this,"utf-8 encode")}a[254]=a[254]=1,i.utf8encode=function(e){return n.nodebuffer?r.newBufferFrom(e,"utf-8"):function(e){var t,i,s,r,o,a=e.length,c=0;for(r=0;r<a;r++)55296==(64512&(i=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(s=e.charCodeAt(r+1)))&&(i=65536+(i-55296<<10)+(s-56320),r++),c+=i<128?1:i<2048?2:i<65536?3:4;for(t=n.uint8array?new Uint8Array(c):new Array(c),r=o=0;o<c;r++)55296==(64512&(i=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(s=e.charCodeAt(r+1)))&&(i=65536+(i-55296<<10)+(s-56320),r++),i<128?t[o++]=i:(i<2048?t[o++]=192|i>>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t}(e)},i.utf8decode=function(e){return n.nodebuffer?s.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,i,n,r,o=e.length,c=new Array(2*o);for(t=i=0;t<o;)if((n=e[t++])<128)c[i++]=n;else if(4<(r=a[n]))c[i++]=65533,t+=r-1;else{for(n&=2===r?31:3===r?15:7;1<r&&t<o;)n=n<<6|63&e[t++],r--;1<r?c[i++]=65533:n<65536?c[i++]=n:(n-=65536,c[i++]=55296|n>>10&1023,c[i++]=56320|1023&n)}return c.length!==i&&(c.subarray?c=c.subarray(0,i):c.length=i),s.applyFromCharCode(c)}(e=s.transformTo(n.uint8array?"uint8array":"array",e))},s.inherits(l,o),l.prototype.processChunk=function(e){var t=s.transformTo(n.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var r=t;(t=new Uint8Array(r.length+this.leftOver.length)).set(this.leftOver,0),t.set(r,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+a[e[i]]>t?i:t}(t),c=t;o!==t.length&&(n.uint8array?(c=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(c=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:i.utf8decode(c),meta:e.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=l,s.inherits(h,o),h.prototype.processChunk=function(e){this.push({data:i.utf8encode(e.data),meta:e.meta})},i.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,i){var s=e("./support"),n=e("./base64"),r=e("./nodejsUtils"),o=e("./external");function a(e){return e}function c(e,t){for(var i=0;i<e.length;++i)t[i]=255&e.charCodeAt(i);return t}e("setimmediate"),i.newBlob=function(e,t){i.checkSupport("blob");try{return new Blob([e],{type:t})}catch(i){try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return s.append(e),s.getBlob(t)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var l={stringifyByChunk:function(e,t,i){var s=[],n=0,r=e.length;if(r<=i)return String.fromCharCode.apply(null,e);for(;n<r;)"array"===t||"nodebuffer"===t?s.push(String.fromCharCode.apply(null,e.slice(n,Math.min(n+i,r)))):s.push(String.fromCharCode.apply(null,e.subarray(n,Math.min(n+i,r)))),n+=i;return s.join("")},stringifyByChar:function(e){for(var t="",i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);return t},applyCanBeUsed:{uint8array:function(){try{return s.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return s.nodebuffer&&1===String.fromCharCode.apply(null,r.allocBuffer(1)).length}catch(e){return!1}}()}};function h(e){var t=65536,s=i.getTypeOf(e),n=!0;if("uint8array"===s?n=l.applyCanBeUsed.uint8array:"nodebuffer"===s&&(n=l.applyCanBeUsed.nodebuffer),n)for(;1<t;)try{return l.stringifyByChunk(e,s,t)}catch(e){t=Math.floor(t/2)}return l.stringifyByChar(e)}function I(e,t){for(var i=0;i<e.length;i++)t[i]=e[i];return t}i.applyFromCharCode=h;var u={};u.string={string:a,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return u.string.uint8array(e).buffer},uint8array:function(e){return c(e,new Uint8Array(e.length))},nodebuffer:function(e){return c(e,r.allocBuffer(e.length))}},u.array={string:h,array:a,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return r.newBufferFrom(e)}},u.arraybuffer={string:function(e){return h(new Uint8Array(e))},array:function(e){return I(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:a,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return r.newBufferFrom(new Uint8Array(e))}},u.uint8array={string:h,array:function(e){return I(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:a,nodebuffer:function(e){return r.newBufferFrom(e)}},u.nodebuffer={string:h,array:function(e){return I(e,new Array(e.length))},arraybuffer:function(e){return u.nodebuffer.uint8array(e).buffer},uint8array:function(e){return I(e,new Uint8Array(e.length))},nodebuffer:a},i.transformTo=function(e,t){if(t=t||"",!e)return t;i.checkSupport(e);var s=i.getTypeOf(t);return u[s][e](t)},i.resolve=function(e){for(var t=e.split("/"),i=[],s=0;s<t.length;s++){var n=t[s];"."===n||""===n&&0!==s&&s!==t.length-1||(".."===n?i.pop():i.push(n))}return i.join("/")},i.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":s.nodebuffer&&r.isBuffer(e)?"nodebuffer":s.uint8array&&e instanceof Uint8Array?"uint8array":s.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(e){if(!s[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(e){var t,i,s="";for(i=0;i<(e||"").length;i++)s+="\\x"+((t=e.charCodeAt(i))<16?"0":"")+t.toString(16).toUpperCase();return s},i.delay=function(e,t,i){setImmediate((function(){e.apply(i||null,t||[])}))},i.inherits=function(e,t){function i(){}i.prototype=t.prototype,e.prototype=new i},i.extend=function(){var e,t,i={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===i[t]&&(i[t]=arguments[e][t]);return i},i.prepareContent=function(e,t,r,a,l){return o.Promise.resolve(t).then((function(e){return s.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new o.Promise((function(t,i){var s=new FileReader;s.onload=function(e){t(e.target.result)},s.onerror=function(e){i(e.target.error)},s.readAsArrayBuffer(e)})):e})).then((function(t){var h,I=i.getTypeOf(t);return I?("arraybuffer"===I?t=i.transformTo("uint8array",t):"string"===I&&(l?t=n.decode(t):r&&!0!==a&&(t=c(h=t,s.uint8array?new Uint8Array(h.length):new Array(h.length)))),t):o.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))}))}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,i){var s=e("./reader/readerFor"),n=e("./utils"),r=e("./signature"),o=e("./zipEntry"),a=e("./support");function c(e){this.files=[],this.loadOptions=e}c.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+n.pretty(t)+", expected "+n.pretty(e)+")")}},isSignature:function(e,t){var i=this.reader.index;this.reader.setIndex(e);var s=this.reader.readString(4)===t;return this.reader.setIndex(i),s},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 e=this.reader.readData(this.zipCommentLength),t=a.uint8array?"uint8array":"array",i=n.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(i)},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 e,t,i,s=this.zip64EndOfCentralSize-44;0<s;)e=this.reader.readInt(2),t=this.reader.readInt(4),i=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:i}},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 e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(r.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(r.CENTRAL_FILE_HEADER);)(e=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);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 e=this.reader.lastIndexOfSignature(r.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,r.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(e);var t=e;if(this.checkSignature(r.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(r.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(r.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,r.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(r.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(r.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var i=this.centralDirOffset+this.centralDirSize;this.zip64&&(i+=20,i+=12+this.zip64EndOfCentralSize);var s=t-i;if(0<s)this.isSignature(t,r.CENTRAL_FILE_HEADER)||(this.reader.zero=s);else if(s<0)throw new Error("Corrupted zip: missing "+Math.abs(s)+" bytes.")},prepareReader:function(e){this.reader=s(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=c},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,i){var s=e("./reader/readerFor"),n=e("./utils"),r=e("./compressedObject"),o=e("./crc32"),a=e("./utf8"),c=e("./compressions"),l=e("./support");function h(e,t){this.options=e,this.loadOptions=t}h.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(e){var t,i;if(e.skip(22),this.fileNameLength=e.readInt(2),i=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(i),-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===(t=function(e){for(var t in c)if(Object.prototype.hasOwnProperty.call(c,t)&&c[t].magic===e)return c[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.transformTo("string",this.fileName)+")");this.decompressed=new r(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=s(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,i,s,n=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<n;)t=e.readInt(2),i=e.readInt(2),s=e.readData(i),this.extraFields[t]={id:t,length:i,value:s};e.setIndex(n)},handleUTF8:function(){var e=l.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var i=n.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var s=this.findExtraFieldUnicodeComment();if(null!==s)this.fileCommentStr=s;else{var r=n.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(r)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=s(e.value);return 1!==t.readInt(1)||o(this.fileName)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=s(e.value);return 1!==t.readInt(1)||o(this.fileComment)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null}},t.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,i){function s(e,t,i){this.name=e,this.dir=i.dir,this.date=i.date,this.comment=i.comment,this.unixPermissions=i.unixPermissions,this.dosPermissions=i.dosPermissions,this._data=t,this._dataBinary=i.binary,this.options={compression:i.compression,compressionOptions:i.compressionOptions}}var n=e("./stream/StreamHelper"),r=e("./stream/DataWorker"),o=e("./utf8"),a=e("./compressedObject"),c=e("./stream/GenericWorker");s.prototype={internalStream:function(e){var t=null,i="string";try{if(!e)throw new Error("No output type specified.");var s="string"===(i=e.toLowerCase())||"text"===i;"binarystring"!==i&&"text"!==i||(i="string"),t=this._decompressWorker();var r=!this._dataBinary;r&&!s&&(t=t.pipe(new o.Utf8EncodeWorker)),!r&&s&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(e){(t=new c("error")).error(e)}return new n(t,i,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof a&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var i=this._decompressWorker();return this._dataBinary||(i=i.pipe(new o.Utf8EncodeWorker)),a.createWorkerFrom(i,e,t)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof c?this._data:new r(this._data)}};for(var l=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},I=0;I<l.length;I++)s.prototype[l[I]]=h;t.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,i){(function(e){var i,s,n=e.MutationObserver||e.WebKitMutationObserver;if(n){var r=0,o=new n(h),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),i=function(){a.data=r=++r%2}}else if(e.setImmediate||void 0===e.MessageChannel)i="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){h(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(h,0)};else{var c=new e.MessageChannel;c.port1.onmessage=h,i=function(){c.port2.postMessage(0)}}var l=[];function h(){var e,t;s=!0;for(var i=l.length;i;){for(t=l,l=[],e=-1;++e<i;)t[e]();i=l.length}s=!1}t.exports=function(e){1!==l.push(e)||s||i()}}).call(this,void 0!==Pr?Pr:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,i){var s=e("immediate");function n(){}var r={},o=["REJECTED"],a=["FULFILLED"],c=["PENDING"];function l(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==n&&d(this,e)}function h(e,t,i){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof i&&(this.onRejected=i,this.callRejected=this.otherCallRejected)}function I(e,t,i){s((function(){var s;try{s=t(i)}catch(t){return r.reject(e,t)}s===e?r.reject(e,new TypeError("Cannot resolve promise with itself")):r.resolve(e,s)}))}function u(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(e,t){var i=!1;function s(t){i||(i=!0,r.reject(e,t))}function n(t){i||(i=!0,r.resolve(e,t))}var o=E((function(){t(n,s)}));"error"===o.status&&s(o.value)}function E(e,t){var i={};try{i.value=e(t),i.status="success"}catch(e){i.status="error",i.value=e}return i}(t.exports=l).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then((function(i){return t.resolve(e()).then((function(){return i}))}),(function(i){return t.resolve(e()).then((function(){throw i}))}))},l.prototype.catch=function(e){return this.then(null,e)},l.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var i=new this.constructor(n);return this.state!==c?I(i,this.state===a?e:t,this.outcome):this.queue.push(new h(i,e,t)),i},h.prototype.callFulfilled=function(e){r.resolve(this.promise,e)},h.prototype.otherCallFulfilled=function(e){I(this.promise,this.onFulfilled,e)},h.prototype.callRejected=function(e){r.reject(this.promise,e)},h.prototype.otherCallRejected=function(e){I(this.promise,this.onRejected,e)},r.resolve=function(e,t){var i=E(u,t);if("error"===i.status)return r.reject(e,i.value);var s=i.value;if(s)d(e,s);else{e.state=a,e.outcome=t;for(var n=-1,o=e.queue.length;++n<o;)e.queue[n].callFulfilled(t)}return e},r.reject=function(e,t){e.state=o,e.outcome=t;for(var i=-1,s=e.queue.length;++i<s;)e.queue[i].callRejected(t);return e},l.resolve=function(e){return e instanceof this?e:r.resolve(new this(n),e)},l.reject=function(e){var t=new this(n);return r.reject(t,e)},l.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,s=!1;if(!i)return this.resolve([]);for(var o=new Array(i),a=0,c=-1,l=new this(n);++c<i;)h(e[c],c);return l;function h(e,n){t.resolve(e).then((function(e){o[n]=e,++a!==i||s||(s=!0,r.resolve(l,o))}),(function(e){s||(s=!0,r.reject(l,e))}))}},l.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,s=!1;if(!i)return this.resolve([]);for(var o,a=-1,c=new this(n);++a<i;)o=e[a],t.resolve(o).then((function(e){s||(s=!0,r.resolve(c,e))}),(function(e){s||(s=!0,r.reject(c,e))}));return c}},{immediate:36}],38:[function(e,t,i){var s={};(0,e("./lib/utils/common").assign)(s,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,i){var s=e("./zlib/deflate"),n=e("./utils/common"),r=e("./utils/strings"),o=e("./zlib/messages"),a=e("./zlib/zstream"),c=Object.prototype.toString,l=0,h=-1,I=0,u=8;function d(e){if(!(this instanceof d))return new d(e);this.options=n.assign({level:h,method:u,chunkSize:16384,windowBits:15,memLevel:8,strategy:I,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var i=s.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==l)throw new Error(o[i]);if(t.header&&s.deflateSetHeader(this.strm,t.header),t.dictionary){var E;if(E="string"==typeof t.dictionary?r.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(i=s.deflateSetDictionary(this.strm,E))!==l)throw new Error(o[i]);this._dict_set=!0}}function E(e,t){var i=new d(t);if(i.push(e,!0),i.err)throw i.msg||o[i.err];return i.result}d.prototype.push=function(e,t){var i,o,a=this.strm,h=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=r.string2buf(e):"[object ArrayBuffer]"===c.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new n.Buf8(h),a.next_out=0,a.avail_out=h),1!==(i=s.deflate(a,o))&&i!==l)return this.onEnd(i),!(this.ended=!0);0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(r.buf2binstring(n.shrinkBuf(a.output,a.next_out))):this.onData(n.shrinkBuf(a.output,a.next_out)))}while((0<a.avail_in||0===a.avail_out)&&1!==i);return 4===o?(i=s.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===l):2!==o||(this.onEnd(l),!(a.avail_out=0))},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){e===l&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Deflate=d,i.deflate=E,i.deflateRaw=function(e,t){return(t=t||{}).raw=!0,E(e,t)},i.gzip=function(e,t){return(t=t||{}).gzip=!0,E(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,i){var s=e("./zlib/inflate"),n=e("./utils/common"),r=e("./utils/strings"),o=e("./zlib/constants"),a=e("./zlib/messages"),c=e("./zlib/zstream"),l=e("./zlib/gzheader"),h=Object.prototype.toString;function I(e){if(!(this instanceof I))return new I(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var i=s.inflateInit2(this.strm,t.windowBits);if(i!==o.Z_OK)throw new Error(a[i]);this.header=new l,s.inflateGetHeader(this.strm,this.header)}function u(e,t){var i=new I(t);if(i.push(e,!0),i.err)throw i.msg||a[i.err];return i.result}I.prototype.push=function(e,t){var i,a,c,l,I,u,d=this.strm,E=this.options.chunkSize,f=this.options.dictionary,p=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?d.input=r.binstring2buf(e):"[object ArrayBuffer]"===h.call(e)?d.input=new Uint8Array(e):d.input=e,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new n.Buf8(E),d.next_out=0,d.avail_out=E),(i=s.inflate(d,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&f&&(u="string"==typeof f?r.string2buf(f):"[object ArrayBuffer]"===h.call(f)?new Uint8Array(f):f,i=s.inflateSetDictionary(this.strm,u)),i===o.Z_BUF_ERROR&&!0===p&&(i=o.Z_OK,p=!1),i!==o.Z_STREAM_END&&i!==o.Z_OK)return this.onEnd(i),!(this.ended=!0);d.next_out&&(0!==d.avail_out&&i!==o.Z_STREAM_END&&(0!==d.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(c=r.utf8border(d.output,d.next_out),l=d.next_out-c,I=r.buf2string(d.output,c),d.next_out=l,d.avail_out=E-l,l&&n.arraySet(d.output,d.output,c,l,0),this.onData(I)):this.onData(n.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(p=!0)}while((0<d.avail_in||0===d.avail_out)&&i!==o.Z_STREAM_END);return i===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(i=s.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(d.avail_out=0))},I.prototype.onData=function(e){this.chunks.push(e)},I.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Inflate=I,i.inflate=u,i.inflateRaw=function(e,t){return(t=t||{}).raw=!0,u(e,t)},i.ungzip=u},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,i){var s="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;i.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var s in i)i.hasOwnProperty(s)&&(e[s]=i[s])}}return e},i.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,i,s,n){if(t.subarray&&e.subarray)e.set(t.subarray(i,i+s),n);else for(var r=0;r<s;r++)e[n+r]=t[i+r]},flattenChunks:function(e){var t,i,s,n,r,o;for(t=s=0,i=e.length;t<i;t++)s+=e[t].length;for(o=new Uint8Array(s),t=n=0,i=e.length;t<i;t++)r=e[t],o.set(r,n),n+=r.length;return o}},r={arraySet:function(e,t,i,s,n){for(var r=0;r<s;r++)e[n+r]=t[i+r]},flattenChunks:function(e){return[].concat.apply([],e)}};i.setTyped=function(e){e?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,n)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,r))},i.setTyped(s)},{}],42:[function(e,t,i){var s=e("./common"),n=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch(e){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){r=!1}for(var o=new s.Buf8(256),a=0;a<256;a++)o[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function c(e,t){if(t<65537&&(e.subarray&&r||!e.subarray&&n))return String.fromCharCode.apply(null,s.shrinkBuf(e,t));for(var i="",o=0;o<t;o++)i+=String.fromCharCode(e[o]);return i}o[254]=o[254]=1,i.string2buf=function(e){var t,i,n,r,o,a=e.length,c=0;for(r=0;r<a;r++)55296==(64512&(i=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(n=e.charCodeAt(r+1)))&&(i=65536+(i-55296<<10)+(n-56320),r++),c+=i<128?1:i<2048?2:i<65536?3:4;for(t=new s.Buf8(c),r=o=0;o<c;r++)55296==(64512&(i=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(n=e.charCodeAt(r+1)))&&(i=65536+(i-55296<<10)+(n-56320),r++),i<128?t[o++]=i:(i<2048?t[o++]=192|i>>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t},i.buf2binstring=function(e){return c(e,e.length)},i.binstring2buf=function(e){for(var t=new s.Buf8(e.length),i=0,n=t.length;i<n;i++)t[i]=e.charCodeAt(i);return t},i.buf2string=function(e,t){var i,s,n,r,a=t||e.length,l=new Array(2*a);for(i=s=0;i<a;)if((n=e[i++])<128)l[s++]=n;else if(4<(r=o[n]))l[s++]=65533,i+=r-1;else{for(n&=2===r?31:3===r?15:7;1<r&&i<a;)n=n<<6|63&e[i++],r--;1<r?l[s++]=65533:n<65536?l[s++]=n:(n-=65536,l[s++]=55296|n>>10&1023,l[s++]=56320|1023&n)}return c(l,s)},i.utf8border=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+o[e[i]]>t?i:t}},{"./common":41}],43:[function(e,t,i){t.exports=function(e,t,i,s){for(var n=65535&e,r=e>>>16&65535,o=0;0!==i;){for(i-=o=2e3<i?2e3:i;r=r+(n=n+t[s++]|0)|0,--o;);n%=65521,r%=65521}return n|r<<16}},{}],44:[function(e,t,i){t.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(e,t,i){var s=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();t.exports=function(e,t,i,n){var r=s,o=n+i;e^=-1;for(var a=n;a<o;a++)e=e>>>8^r[255&(e^t[a])];return~e}},{}],46:[function(e,t,i){var s,n=e("../utils/common"),r=e("./trees"),o=e("./adler32"),a=e("./crc32"),c=e("./messages"),l=0,h=4,I=0,u=-2,d=-1,E=4,f=2,p=8,C=9,T=286,m=30,R=19,g=2*T+1,A=15,F=3,S=258,O=S+F+1,N=42,y=113,L=1,_=2,P=3,w=4;function M(e,t){return e.msg=c[t],t}function v(e){return(e<<1)-(4<e?9:0)}function D(e){for(var t=e.length;0<=--t;)e[t]=0}function b(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(n.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))}function U(e,t){r._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,b(e.strm)}function x(e,t){e.pending_buf[e.pending++]=t}function B(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function V(e,t){var i,s,n=e.max_chain_length,r=e.strstart,o=e.prev_length,a=e.nice_match,c=e.strstart>e.w_size-O?e.strstart-(e.w_size-O):0,l=e.window,h=e.w_mask,I=e.prev,u=e.strstart+S,d=l[r+o-1],E=l[r+o];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do{if(l[(i=t)+o]===E&&l[i+o-1]===d&&l[i]===l[r]&&l[++i]===l[r+1]){r+=2,i++;do{}while(l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&r<u);if(s=S-(u-r),r=u-S,o<s){if(e.match_start=t,a<=(o=s))break;d=l[r+o-1],E=l[r+o]}}}while((t=I[t&h])>c&&0!=--n);return o<=e.lookahead?o:e.lookahead}function Y(e){var t,i,s,r,c,l,h,I,u,d,E=e.w_size;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=E+(E-O)){for(n.arraySet(e.window,e.window,E,E,0),e.match_start-=E,e.strstart-=E,e.block_start-=E,t=i=e.hash_size;s=e.head[--t],e.head[t]=E<=s?s-E:0,--i;);for(t=i=E;s=e.prev[--t],e.prev[t]=E<=s?s-E:0,--i;);r+=E}if(0===e.strm.avail_in)break;if(l=e.strm,h=e.window,I=e.strstart+e.lookahead,d=void 0,(u=r)<(d=l.avail_in)&&(d=u),i=0===d?0:(l.avail_in-=d,n.arraySet(h,l.input,l.next_in,d,I),1===l.state.wrap?l.adler=o(l.adler,h,d,I):2===l.state.wrap&&(l.adler=a(l.adler,h,d,I)),l.next_in+=d,l.total_in+=d,d),e.lookahead+=i,e.lookahead+e.insert>=F)for(c=e.strstart-e.insert,e.ins_h=e.window[c],e.ins_h=(e.ins_h<<e.hash_shift^e.window[c+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[c+F-1])&e.hash_mask,e.prev[c&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=c,c++,e.insert--,!(e.lookahead+e.insert<F)););}while(e.lookahead<O&&0!==e.strm.avail_in)}function G(e,t){for(var i,s;;){if(e.lookahead<O){if(Y(e),e.lookahead<O&&t===l)return L;if(0===e.lookahead)break}if(i=0,e.lookahead>=F&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-O&&(e.match_length=V(e,i)),e.match_length>=F)if(s=r._tr_tally(e,e.strstart-e.match_start,e.match_length-F),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=F){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else s=r._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(s&&(U(e,!1),0===e.strm.avail_out))return L}return e.insert=e.strstart<F-1?e.strstart:F-1,t===h?(U(e,!0),0===e.strm.avail_out?P:w):e.last_lit&&(U(e,!1),0===e.strm.avail_out)?L:_}function z(e,t){for(var i,s,n;;){if(e.lookahead<O){if(Y(e),e.lookahead<O&&t===l)return L;if(0===e.lookahead)break}if(i=0,e.lookahead>=F&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=F-1,0!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-O&&(e.match_length=V(e,i),e.match_length<=5&&(1===e.strategy||e.match_length===F&&4096<e.strstart-e.match_start)&&(e.match_length=F-1)),e.prev_length>=F&&e.match_length<=e.prev_length){for(n=e.strstart+e.lookahead-F,s=r._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-F),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=F-1,e.strstart++,s&&(U(e,!1),0===e.strm.avail_out))return L}else if(e.match_available){if((s=r._tr_tally(e,0,e.window[e.strstart-1]))&&U(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return L}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(s=r._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<F-1?e.strstart:F-1,t===h?(U(e,!0),0===e.strm.avail_out?P:w):e.last_lit&&(U(e,!1),0===e.strm.avail_out)?L:_}function k(e,t,i,s,n){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=s,this.func=n}function H(){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=p,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 n.Buf16(2*g),this.dyn_dtree=new n.Buf16(2*(2*m+1)),this.bl_tree=new n.Buf16(2*(2*R+1)),D(this.dyn_ltree),D(this.dyn_dtree),D(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(A+1),this.heap=new n.Buf16(2*T+1),D(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(2*T+1),D(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 W(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=f,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?N:y,e.adler=2===t.wrap?0:1,t.last_flush=l,r._tr_init(t),I):M(e,u)}function X(e){var t,i=W(e);return i===I&&((t=e.state).window_size=2*t.w_size,D(t.head),t.max_lazy_match=s[t.level].max_lazy,t.good_match=s[t.level].good_length,t.nice_match=s[t.level].nice_length,t.max_chain_length=s[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=F-1,t.match_available=0,t.ins_h=0),i}function j(e,t,i,s,r,o){if(!e)return u;var a=1;if(t===d&&(t=6),s<0?(a=0,s=-s):15<s&&(a=2,s-=16),r<1||C<r||i!==p||s<8||15<s||t<0||9<t||o<0||E<o)return M(e,u);8===s&&(s=9);var c=new H;return(e.state=c).strm=e,c.wrap=a,c.gzhead=null,c.w_bits=s,c.w_size=1<<c.w_bits,c.w_mask=c.w_size-1,c.hash_bits=r+7,c.hash_size=1<<c.hash_bits,c.hash_mask=c.hash_size-1,c.hash_shift=~~((c.hash_bits+F-1)/F),c.window=new n.Buf8(2*c.w_size),c.head=new n.Buf16(c.hash_size),c.prev=new n.Buf16(c.w_size),c.lit_bufsize=1<<r+6,c.pending_buf_size=4*c.lit_bufsize,c.pending_buf=new n.Buf8(c.pending_buf_size),c.d_buf=1*c.lit_bufsize,c.l_buf=3*c.lit_bufsize,c.level=t,c.strategy=o,c.method=i,X(e)}s=[new k(0,0,0,0,(function(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Y(e),0===e.lookahead&&t===l)return L;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var s=e.block_start+i;if((0===e.strstart||e.strstart>=s)&&(e.lookahead=e.strstart-s,e.strstart=s,U(e,!1),0===e.strm.avail_out))return L;if(e.strstart-e.block_start>=e.w_size-O&&(U(e,!1),0===e.strm.avail_out))return L}return e.insert=0,t===h?(U(e,!0),0===e.strm.avail_out?P:w):(e.strstart>e.block_start&&(U(e,!1),e.strm.avail_out),L)})),new k(4,4,8,4,G),new k(4,5,16,8,G),new k(4,6,32,32,G),new k(4,4,16,16,z),new k(8,16,32,32,z),new k(8,16,128,128,z),new k(8,32,128,256,z),new k(32,128,258,1024,z),new k(32,258,258,4096,z)],i.deflateInit=function(e,t){return j(e,t,p,15,8,0)},i.deflateInit2=j,i.deflateReset=X,i.deflateResetKeep=W,i.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?u:(e.state.gzhead=t,I):u},i.deflate=function(e,t){var i,n,o,c;if(!e||!e.state||5<t||t<0)return e?M(e,u):u;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&t!==h)return M(e,0===e.avail_out?-5:u);if(n.strm=e,i=n.last_flush,n.last_flush=t,n.status===N)if(2===n.wrap)e.adler=0,x(n,31),x(n,139),x(n,8),n.gzhead?(x(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),x(n,255&n.gzhead.time),x(n,n.gzhead.time>>8&255),x(n,n.gzhead.time>>16&255),x(n,n.gzhead.time>>24&255),x(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),x(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(x(n,255&n.gzhead.extra.length),x(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=a(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(x(n,0),x(n,0),x(n,0),x(n,0),x(n,0),x(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),x(n,3),n.status=y);else{var d=p+(n.w_bits-8<<4)<<8;d|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(d|=32),d+=31-d%31,n.status=y,B(n,d),0!==n.strstart&&(B(n,e.adler>>>16),B(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),b(e),o=n.pending,n.pending!==n.pending_buf_size));)x(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),b(e),o=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,x(n,c)}while(0!==c);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===c&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),b(e),o=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,x(n,c)}while(0!==c);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===c&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&b(e),n.pending+2<=n.pending_buf_size&&(x(n,255&e.adler),x(n,e.adler>>8&255),e.adler=0,n.status=y)):n.status=y),0!==n.pending){if(b(e),0===e.avail_out)return n.last_flush=-1,I}else if(0===e.avail_in&&v(t)<=v(i)&&t!==h)return M(e,-5);if(666===n.status&&0!==e.avail_in)return M(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==l&&666!==n.status){var E=2===n.strategy?function(e,t){for(var i;;){if(0===e.lookahead&&(Y(e),0===e.lookahead)){if(t===l)return L;break}if(e.match_length=0,i=r._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(U(e,!1),0===e.strm.avail_out))return L}return e.insert=0,t===h?(U(e,!0),0===e.strm.avail_out?P:w):e.last_lit&&(U(e,!1),0===e.strm.avail_out)?L:_}(n,t):3===n.strategy?function(e,t){for(var i,s,n,o,a=e.window;;){if(e.lookahead<=S){if(Y(e),e.lookahead<=S&&t===l)return L;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=F&&0<e.strstart&&(s=a[n=e.strstart-1])===a[++n]&&s===a[++n]&&s===a[++n]){o=e.strstart+S;do{}while(s===a[++n]&&s===a[++n]&&s===a[++n]&&s===a[++n]&&s===a[++n]&&s===a[++n]&&s===a[++n]&&s===a[++n]&&n<o);e.match_length=S-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=F?(i=r._tr_tally(e,1,e.match_length-F),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=r._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(U(e,!1),0===e.strm.avail_out))return L}return e.insert=0,t===h?(U(e,!0),0===e.strm.avail_out?P:w):e.last_lit&&(U(e,!1),0===e.strm.avail_out)?L:_}(n,t):s[n.level].func(n,t);if(E!==P&&E!==w||(n.status=666),E===L||E===P)return 0===e.avail_out&&(n.last_flush=-1),I;if(E===_&&(1===t?r._tr_align(n):5!==t&&(r._tr_stored_block(n,0,0,!1),3===t&&(D(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),b(e),0===e.avail_out))return n.last_flush=-1,I}return t!==h?I:n.wrap<=0?1:(2===n.wrap?(x(n,255&e.adler),x(n,e.adler>>8&255),x(n,e.adler>>16&255),x(n,e.adler>>24&255),x(n,255&e.total_in),x(n,e.total_in>>8&255),x(n,e.total_in>>16&255),x(n,e.total_in>>24&255)):(B(n,e.adler>>>16),B(n,65535&e.adler)),b(e),0<n.wrap&&(n.wrap=-n.wrap),0!==n.pending?I:1)},i.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==N&&69!==t&&73!==t&&91!==t&&103!==t&&t!==y&&666!==t?M(e,u):(e.state=null,t===y?M(e,-3):I):u},i.deflateSetDictionary=function(e,t){var i,s,r,a,c,l,h,d,E=t.length;if(!e||!e.state)return u;if(2===(a=(i=e.state).wrap)||1===a&&i.status!==N||i.lookahead)return u;for(1===a&&(e.adler=o(e.adler,t,E,0)),i.wrap=0,E>=i.w_size&&(0===a&&(D(i.head),i.strstart=0,i.block_start=0,i.insert=0),d=new n.Buf8(i.w_size),n.arraySet(d,t,E-i.w_size,i.w_size,0),t=d,E=i.w_size),c=e.avail_in,l=e.next_in,h=e.input,e.avail_in=E,e.next_in=0,e.input=t,Y(i);i.lookahead>=F;){for(s=i.strstart,r=i.lookahead-(F-1);i.ins_h=(i.ins_h<<i.hash_shift^i.window[s+F-1])&i.hash_mask,i.prev[s&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=s,s++,--r;);i.strstart=s,i.lookahead=F-1,Y(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=F-1,i.match_available=0,e.next_in=l,e.input=h,e.avail_in=c,i.wrap=a,I},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,i){t.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(e,t,i){t.exports=function(e,t){var i,s,n,r,o,a,c,l,h,I,u,d,E,f,p,C,T,m,R,g,A,F,S,O,N;i=e.state,s=e.next_in,O=e.input,n=s+(e.avail_in-5),r=e.next_out,N=e.output,o=r-(t-e.avail_out),a=r+(e.avail_out-257),c=i.dmax,l=i.wsize,h=i.whave,I=i.wnext,u=i.window,d=i.hold,E=i.bits,f=i.lencode,p=i.distcode,C=(1<<i.lenbits)-1,T=(1<<i.distbits)-1;e:do{E<15&&(d+=O[s++]<<E,E+=8,d+=O[s++]<<E,E+=8),m=f[d&C];t:for(;;){if(d>>>=R=m>>>24,E-=R,0==(R=m>>>16&255))N[r++]=65535&m;else{if(!(16&R)){if(!(64&R)){m=f[(65535&m)+(d&(1<<R)-1)];continue t}if(32&R){i.mode=12;break e}e.msg="invalid literal/length code",i.mode=30;break e}g=65535&m,(R&=15)&&(E<R&&(d+=O[s++]<<E,E+=8),g+=d&(1<<R)-1,d>>>=R,E-=R),E<15&&(d+=O[s++]<<E,E+=8,d+=O[s++]<<E,E+=8),m=p[d&T];i:for(;;){if(d>>>=R=m>>>24,E-=R,!(16&(R=m>>>16&255))){if(!(64&R)){m=p[(65535&m)+(d&(1<<R)-1)];continue i}e.msg="invalid distance code",i.mode=30;break e}if(A=65535&m,E<(R&=15)&&(d+=O[s++]<<E,(E+=8)<R&&(d+=O[s++]<<E,E+=8)),c<(A+=d&(1<<R)-1)){e.msg="invalid distance too far back",i.mode=30;break e}if(d>>>=R,E-=R,(R=r-o)<A){if(h<(R=A-R)&&i.sane){e.msg="invalid distance too far back",i.mode=30;break e}if(S=u,(F=0)===I){if(F+=l-R,R<g){for(g-=R;N[r++]=u[F++],--R;);F=r-A,S=N}}else if(I<R){if(F+=l+I-R,(R-=I)<g){for(g-=R;N[r++]=u[F++],--R;);if(F=0,I<g){for(g-=R=I;N[r++]=u[F++],--R;);F=r-A,S=N}}}else if(F+=I-R,R<g){for(g-=R;N[r++]=u[F++],--R;);F=r-A,S=N}for(;2<g;)N[r++]=S[F++],N[r++]=S[F++],N[r++]=S[F++],g-=3;g&&(N[r++]=S[F++],1<g&&(N[r++]=S[F++]))}else{for(F=r-A;N[r++]=N[F++],N[r++]=N[F++],N[r++]=N[F++],2<(g-=3););g&&(N[r++]=N[F++],1<g&&(N[r++]=N[F++]))}break}}break}}while(s<n&&r<a);s-=g=E>>3,d&=(1<<(E-=g<<3))-1,e.next_in=s,e.next_out=r,e.avail_in=s<n?n-s+5:5-(s-n),e.avail_out=r<a?a-r+257:257-(r-a),i.hold=d,i.bits=E}},{}],49:[function(e,t,i){var s=e("../utils/common"),n=e("./adler32"),r=e("./crc32"),o=e("./inffast"),a=e("./inftrees"),c=1,l=2,h=0,I=-2,u=1,d=852,E=592;function f(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function p(){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 s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function C(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=u,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new s.Buf32(d),t.distcode=t.distdyn=new s.Buf32(E),t.sane=1,t.back=-1,h):I}function T(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,C(e)):I}function m(e,t){var i,s;return e&&e.state?(s=e.state,t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?I:(null!==s.window&&s.wbits!==t&&(s.window=null),s.wrap=i,s.wbits=t,T(e))):I}function R(e,t){var i,s;return e?(s=new p,(e.state=s).window=null,(i=m(e,t))!==h&&(e.state=null),i):I}var g,A,F=!0;function S(e){if(F){var t;for(g=new s.Buf32(512),A=new s.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(c,e.lens,0,288,g,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(l,e.lens,0,32,A,0,e.work,{bits:5}),F=!1}e.lencode=g,e.lenbits=9,e.distcode=A,e.distbits=5}function O(e,t,i,n){var r,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new s.Buf8(o.wsize)),n>=o.wsize?(s.arraySet(o.window,t,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(n<(r=o.wsize-o.wnext)&&(r=n),s.arraySet(o.window,t,i-n,r,o.wnext),(n-=r)?(s.arraySet(o.window,t,i-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=r))),0}i.inflateReset=T,i.inflateReset2=m,i.inflateResetKeep=C,i.inflateInit=function(e){return R(e,15)},i.inflateInit2=R,i.inflate=function(e,t){var i,d,E,p,C,T,m,R,g,A,F,N,y,L,_,P,w,M,v,D,b,U,x,B,V=0,Y=new s.Buf8(4),G=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return I;12===(i=e.state).mode&&(i.mode=13),C=e.next_out,E=e.output,m=e.avail_out,p=e.next_in,d=e.input,T=e.avail_in,R=i.hold,g=i.bits,A=T,F=m,U=h;e:for(;;)switch(i.mode){case u:if(0===i.wrap){i.mode=13;break}for(;g<16;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(2&i.wrap&&35615===R){Y[i.check=0]=255&R,Y[1]=R>>>8&255,i.check=r(i.check,Y,2,0),g=R=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&R)<<8)+(R>>8))%31){e.msg="incorrect header check",i.mode=30;break}if(8!=(15&R)){e.msg="unknown compression method",i.mode=30;break}if(g-=4,b=8+(15&(R>>>=4)),0===i.wbits)i.wbits=b;else if(b>i.wbits){e.msg="invalid window size",i.mode=30;break}i.dmax=1<<b,e.adler=i.check=1,i.mode=512&R?10:12,g=R=0;break;case 2:for(;g<16;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(i.flags=R,8!=(255&i.flags)){e.msg="unknown compression method",i.mode=30;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=30;break}i.head&&(i.head.text=R>>8&1),512&i.flags&&(Y[0]=255&R,Y[1]=R>>>8&255,i.check=r(i.check,Y,2,0)),g=R=0,i.mode=3;case 3:for(;g<32;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.head&&(i.head.time=R),512&i.flags&&(Y[0]=255&R,Y[1]=R>>>8&255,Y[2]=R>>>16&255,Y[3]=R>>>24&255,i.check=r(i.check,Y,4,0)),g=R=0,i.mode=4;case 4:for(;g<16;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.head&&(i.head.xflags=255&R,i.head.os=R>>8),512&i.flags&&(Y[0]=255&R,Y[1]=R>>>8&255,i.check=r(i.check,Y,2,0)),g=R=0,i.mode=5;case 5:if(1024&i.flags){for(;g<16;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.length=R,i.head&&(i.head.extra_len=R),512&i.flags&&(Y[0]=255&R,Y[1]=R>>>8&255,i.check=r(i.check,Y,2,0)),g=R=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&(T<(N=i.length)&&(N=T),N&&(i.head&&(b=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),s.arraySet(i.head.extra,d,p,N,b)),512&i.flags&&(i.check=r(i.check,d,N,p)),T-=N,p+=N,i.length-=N),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===T)break e;for(N=0;b=d[p+N++],i.head&&b&&i.length<65536&&(i.head.name+=String.fromCharCode(b)),b&&N<T;);if(512&i.flags&&(i.check=r(i.check,d,N,p)),T-=N,p+=N,b)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===T)break e;for(N=0;b=d[p+N++],i.head&&b&&i.length<65536&&(i.head.comment+=String.fromCharCode(b)),b&&N<T;);if(512&i.flags&&(i.check=r(i.check,d,N,p)),T-=N,p+=N,b)break e}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;g<16;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(R!==(65535&i.check)){e.msg="header crc mismatch",i.mode=30;break}g=R=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=12;break;case 10:for(;g<32;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}e.adler=i.check=f(R),g=R=0,i.mode=11;case 11:if(0===i.havedict)return e.next_out=C,e.avail_out=m,e.next_in=p,e.avail_in=T,i.hold=R,i.bits=g,2;e.adler=i.check=1,i.mode=12;case 12:if(5===t||6===t)break e;case 13:if(i.last){R>>>=7&g,g-=7&g,i.mode=27;break}for(;g<3;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}switch(i.last=1&R,g-=1,3&(R>>>=1)){case 0:i.mode=14;break;case 1:if(S(i),i.mode=20,6!==t)break;R>>>=2,g-=2;break e;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=30}R>>>=2,g-=2;break;case 14:for(R>>>=7&g,g-=7&g;g<32;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if((65535&R)!=(R>>>16^65535)){e.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&R,g=R=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(N=i.length){if(T<N&&(N=T),m<N&&(N=m),0===N)break e;s.arraySet(E,d,p,N,C),T-=N,p+=N,m-=N,C+=N,i.length-=N;break}i.mode=12;break;case 17:for(;g<14;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(i.nlen=257+(31&R),R>>>=5,g-=5,i.ndist=1+(31&R),R>>>=5,g-=5,i.ncode=4+(15&R),R>>>=4,g-=4,286<i.nlen||30<i.ndist){e.msg="too many length or distance symbols",i.mode=30;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;g<3;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.lens[G[i.have++]]=7&R,R>>>=3,g-=3}for(;i.have<19;)i.lens[G[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,x={bits:i.lenbits},U=a(0,i.lens,0,19,i.lencode,0,i.work,x),i.lenbits=x.bits,U){e.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;P=(V=i.lencode[R&(1<<i.lenbits)-1])>>>16&255,w=65535&V,!((_=V>>>24)<=g);){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(w<16)R>>>=_,g-=_,i.lens[i.have++]=w;else{if(16===w){for(B=_+2;g<B;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(R>>>=_,g-=_,0===i.have){e.msg="invalid bit length repeat",i.mode=30;break}b=i.lens[i.have-1],N=3+(3&R),R>>>=2,g-=2}else if(17===w){for(B=_+3;g<B;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}g-=_,b=0,N=3+(7&(R>>>=_)),R>>>=3,g-=3}else{for(B=_+7;g<B;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}g-=_,b=0,N=11+(127&(R>>>=_)),R>>>=7,g-=7}if(i.have+N>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=30;break}for(;N--;)i.lens[i.have++]=b}}if(30===i.mode)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,x={bits:i.lenbits},U=a(c,i.lens,0,i.nlen,i.lencode,0,i.work,x),i.lenbits=x.bits,U){e.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,x={bits:i.distbits},U=a(l,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,x),i.distbits=x.bits,U){e.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===t)break e;case 20:i.mode=21;case 21:if(6<=T&&258<=m){e.next_out=C,e.avail_out=m,e.next_in=p,e.avail_in=T,i.hold=R,i.bits=g,o(e,F),C=e.next_out,E=e.output,m=e.avail_out,p=e.next_in,d=e.input,T=e.avail_in,R=i.hold,g=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;P=(V=i.lencode[R&(1<<i.lenbits)-1])>>>16&255,w=65535&V,!((_=V>>>24)<=g);){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(P&&!(240&P)){for(M=_,v=P,D=w;P=(V=i.lencode[D+((R&(1<<M+v)-1)>>M)])>>>16&255,w=65535&V,!(M+(_=V>>>24)<=g);){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}R>>>=M,g-=M,i.back+=M}if(R>>>=_,g-=_,i.back+=_,i.length=w,0===P){i.mode=26;break}if(32&P){i.back=-1,i.mode=12;break}if(64&P){e.msg="invalid literal/length code",i.mode=30;break}i.extra=15&P,i.mode=22;case 22:if(i.extra){for(B=i.extra;g<B;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.length+=R&(1<<i.extra)-1,R>>>=i.extra,g-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;P=(V=i.distcode[R&(1<<i.distbits)-1])>>>16&255,w=65535&V,!((_=V>>>24)<=g);){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(!(240&P)){for(M=_,v=P,D=w;P=(V=i.distcode[D+((R&(1<<M+v)-1)>>M)])>>>16&255,w=65535&V,!(M+(_=V>>>24)<=g);){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}R>>>=M,g-=M,i.back+=M}if(R>>>=_,g-=_,i.back+=_,64&P){e.msg="invalid distance code",i.mode=30;break}i.offset=w,i.extra=15&P,i.mode=24;case 24:if(i.extra){for(B=i.extra;g<B;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.offset+=R&(1<<i.extra)-1,R>>>=i.extra,g-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===m)break e;if(N=F-m,i.offset>N){if((N=i.offset-N)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=30;break}y=N>i.wnext?(N-=i.wnext,i.wsize-N):i.wnext-N,N>i.length&&(N=i.length),L=i.window}else L=E,y=C-i.offset,N=i.length;for(m<N&&(N=m),m-=N,i.length-=N;E[C++]=L[y++],--N;);0===i.length&&(i.mode=21);break;case 26:if(0===m)break e;E[C++]=i.length,m--,i.mode=21;break;case 27:if(i.wrap){for(;g<32;){if(0===T)break e;T--,R|=d[p++]<<g,g+=8}if(F-=m,e.total_out+=F,i.total+=F,F&&(e.adler=i.check=i.flags?r(i.check,E,F,C-F):n(i.check,E,F,C-F)),F=m,(i.flags?R:f(R))!==i.check){e.msg="incorrect data check",i.mode=30;break}g=R=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;g<32;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(R!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=30;break}g=R=0}i.mode=29;case 29:U=1;break e;case 30:U=-3;break e;case 31:return-4;default:return I}return e.next_out=C,e.avail_out=m,e.next_in=p,e.avail_in=T,i.hold=R,i.bits=g,(i.wsize||F!==e.avail_out&&i.mode<30&&(i.mode<27||4!==t))&&O(e,e.output,e.next_out,F-e.avail_out)?(i.mode=31,-4):(A-=e.avail_in,F-=e.avail_out,e.total_in+=A,e.total_out+=F,i.total+=F,i.wrap&&F&&(e.adler=i.check=i.flags?r(i.check,E,F,e.next_out-F):n(i.check,E,F,e.next_out-F)),e.data_type=i.bits+(i.last?64:0)+(12===i.mode?128:0)+(20===i.mode||15===i.mode?256:0),(0==A&&0===F||4===t)&&U===h&&(U=-5),U)},i.inflateEnd=function(e){if(!e||!e.state)return I;var t=e.state;return t.window&&(t.window=null),e.state=null,h},i.inflateGetHeader=function(e,t){var i;return e&&e.state&&2&(i=e.state).wrap?((i.head=t).done=!1,h):I},i.inflateSetDictionary=function(e,t){var i,s=t.length;return e&&e.state?0!==(i=e.state).wrap&&11!==i.mode?I:11===i.mode&&n(1,t,s,0)!==i.check?-3:O(e,t,s,s)?(i.mode=31,-4):(i.havedict=1,h):I},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,i){var s=e("../utils/common"),n=[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],r=[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],o=[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],a=[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];t.exports=function(e,t,i,c,l,h,I,u){var d,E,f,p,C,T,m,R,g,A=u.bits,F=0,S=0,O=0,N=0,y=0,L=0,_=0,P=0,w=0,M=0,v=null,D=0,b=new s.Buf16(16),U=new s.Buf16(16),x=null,B=0;for(F=0;F<=15;F++)b[F]=0;for(S=0;S<c;S++)b[t[i+S]]++;for(y=A,N=15;1<=N&&0===b[N];N--);if(N<y&&(y=N),0===N)return l[h++]=20971520,l[h++]=20971520,u.bits=1,0;for(O=1;O<N&&0===b[O];O++);for(y<O&&(y=O),F=P=1;F<=15;F++)if(P<<=1,(P-=b[F])<0)return-1;if(0<P&&(0===e||1!==N))return-1;for(U[1]=0,F=1;F<15;F++)U[F+1]=U[F]+b[F];for(S=0;S<c;S++)0!==t[i+S]&&(I[U[t[i+S]]++]=S);if(T=0===e?(v=x=I,19):1===e?(v=n,D-=257,x=r,B-=257,256):(v=o,x=a,-1),F=O,C=h,_=S=M=0,f=-1,p=(w=1<<(L=y))-1,1===e&&852<w||2===e&&592<w)return 1;for(;;){for(m=F-_,g=I[S]<T?(R=0,I[S]):I[S]>T?(R=x[B+I[S]],v[D+I[S]]):(R=96,0),d=1<<F-_,O=E=1<<L;l[C+(M>>_)+(E-=d)]=m<<24|R<<16|g,0!==E;);for(d=1<<F-1;M&d;)d>>=1;if(0!==d?(M&=d-1,M+=d):M=0,S++,0==--b[F]){if(F===N)break;F=t[i+I[S]]}if(y<F&&(M&p)!==f){for(0===_&&(_=y),C+=O,P=1<<(L=F-_);L+_<N&&!((P-=b[L+_])<=0);)L++,P<<=1;if(w+=1<<L,1===e&&852<w||2===e&&592<w)return 1;l[f=M&p]=y<<24|L<<16|C-h}}return 0!==M&&(l[C+M]=F-_<<24|64<<16),u.bits=y,0}},{"../utils/common":41}],51:[function(e,t,i){t.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(e,t,i){var s=e("../utils/common"),n=0,r=1;function o(e){for(var t=e.length;0<=--t;)e[t]=0}var a=0,c=29,l=256,h=l+1+c,I=30,u=19,d=2*h+1,E=15,f=16,p=7,C=256,T=16,m=17,R=18,g=[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],A=[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],F=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],O=new Array(2*(h+2));o(O);var N=new Array(2*I);o(N);var y=new Array(512);o(y);var L=new Array(256);o(L);var _=new Array(c);o(_);var P,w,M,v=new Array(I);function D(e,t,i,s,n){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=s,this.max_length=n,this.has_stree=e&&e.length}function b(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function U(e){return e<256?y[e]:y[256+(e>>>7)]}function x(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function B(e,t,i){e.bi_valid>f-i?(e.bi_buf|=t<<e.bi_valid&65535,x(e,e.bi_buf),e.bi_buf=t>>f-e.bi_valid,e.bi_valid+=i-f):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function V(e,t,i){B(e,i[2*t],i[2*t+1])}function Y(e,t){for(var i=0;i|=1&e,e>>>=1,i<<=1,0<--t;);return i>>>1}function G(e,t,i){var s,n,r=new Array(E+1),o=0;for(s=1;s<=E;s++)r[s]=o=o+i[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=Y(r[a]++,a))}}function z(e){var t;for(t=0;t<h;t++)e.dyn_ltree[2*t]=0;for(t=0;t<I;t++)e.dyn_dtree[2*t]=0;for(t=0;t<u;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*C]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function k(e){8<e.bi_valid?x(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function H(e,t,i,s){var n=2*t,r=2*i;return e[n]<e[r]||e[n]===e[r]&&s[t]<=s[i]}function W(e,t,i){for(var s=e.heap[i],n=i<<1;n<=e.heap_len&&(n<e.heap_len&&H(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!H(t,s,e.heap[n],e.depth));)e.heap[i]=e.heap[n],i=n,n<<=1;e.heap[i]=s}function X(e,t,i){var s,n,r,o,a=0;if(0!==e.last_lit)for(;s=e.pending_buf[e.d_buf+2*a]<<8|e.pending_buf[e.d_buf+2*a+1],n=e.pending_buf[e.l_buf+a],a++,0===s?V(e,n,t):(V(e,(r=L[n])+l+1,t),0!==(o=g[r])&&B(e,n-=_[r],o),V(e,r=U(--s),i),0!==(o=A[r])&&B(e,s-=v[r],o)),a<e.last_lit;);V(e,C,t)}function j(e,t){var i,s,n,r=t.dyn_tree,o=t.stat_desc.static_tree,a=t.stat_desc.has_stree,c=t.stat_desc.elems,l=-1;for(e.heap_len=0,e.heap_max=d,i=0;i<c;i++)0!==r[2*i]?(e.heap[++e.heap_len]=l=i,e.depth[i]=0):r[2*i+1]=0;for(;e.heap_len<2;)r[2*(n=e.heap[++e.heap_len]=l<2?++l:0)]=1,e.depth[n]=0,e.opt_len--,a&&(e.static_len-=o[2*n+1]);for(t.max_code=l,i=e.heap_len>>1;1<=i;i--)W(e,r,i);for(n=c;i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],W(e,r,1),s=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=s,r[2*n]=r[2*i]+r[2*s],e.depth[n]=(e.depth[i]>=e.depth[s]?e.depth[i]:e.depth[s])+1,r[2*i+1]=r[2*s+1]=n,e.heap[1]=n++,W(e,r,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var i,s,n,r,o,a,c=t.dyn_tree,l=t.max_code,h=t.stat_desc.static_tree,I=t.stat_desc.has_stree,u=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,p=t.stat_desc.max_length,C=0;for(r=0;r<=E;r++)e.bl_count[r]=0;for(c[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;i<d;i++)p<(r=c[2*c[2*(s=e.heap[i])+1]+1]+1)&&(r=p,C++),c[2*s+1]=r,l<s||(e.bl_count[r]++,o=0,f<=s&&(o=u[s-f]),a=c[2*s],e.opt_len+=a*(r+o),I&&(e.static_len+=a*(h[2*s+1]+o)));if(0!==C){do{for(r=p-1;0===e.bl_count[r];)r--;e.bl_count[r]--,e.bl_count[r+1]+=2,e.bl_count[p]--,C-=2}while(0<C);for(r=p;0!==r;r--)for(s=e.bl_count[r];0!==s;)l<(n=e.heap[--i])||(c[2*n+1]!==r&&(e.opt_len+=(r-c[2*n+1])*c[2*n],c[2*n+1]=r),s--)}}(e,t),G(r,l,e.bl_count)}function Z(e,t,i){var s,n,r=-1,o=t[1],a=0,c=7,l=4;for(0===o&&(c=138,l=3),t[2*(i+1)+1]=65535,s=0;s<=i;s++)n=o,o=t[2*(s+1)+1],++a<c&&n===o||(a<l?e.bl_tree[2*n]+=a:0!==n?(n!==r&&e.bl_tree[2*n]++,e.bl_tree[2*T]++):a<=10?e.bl_tree[2*m]++:e.bl_tree[2*R]++,r=n,l=(a=0)===o?(c=138,3):n===o?(c=6,3):(c=7,4))}function $(e,t,i){var s,n,r=-1,o=t[1],a=0,c=7,l=4;for(0===o&&(c=138,l=3),s=0;s<=i;s++)if(n=o,o=t[2*(s+1)+1],!(++a<c&&n===o)){if(a<l)for(;V(e,n,e.bl_tree),0!=--a;);else 0!==n?(n!==r&&(V(e,n,e.bl_tree),a--),V(e,T,e.bl_tree),B(e,a-3,2)):a<=10?(V(e,m,e.bl_tree),B(e,a-3,3)):(V(e,R,e.bl_tree),B(e,a-11,7));r=n,l=(a=0)===o?(c=138,3):n===o?(c=6,3):(c=7,4)}}o(v);var q=!1;function Q(e,t,i,n){var r,o,c;B(e,(a<<1)+(n?1:0),3),o=t,c=i,k(r=e),x(r,c),x(r,~c),s.arraySet(r.pending_buf,r.window,o,c,r.pending),r.pending+=c}i._tr_init=function(e){q||(function(){var e,t,i,s,n,r=new Array(E+1);for(s=i=0;s<c-1;s++)for(_[s]=i,e=0;e<1<<g[s];e++)L[i++]=s;for(L[i-1]=s,s=n=0;s<16;s++)for(v[s]=n,e=0;e<1<<A[s];e++)y[n++]=s;for(n>>=7;s<I;s++)for(v[s]=n<<7,e=0;e<1<<A[s]-7;e++)y[256+n++]=s;for(t=0;t<=E;t++)r[t]=0;for(e=0;e<=143;)O[2*e+1]=8,e++,r[8]++;for(;e<=255;)O[2*e+1]=9,e++,r[9]++;for(;e<=279;)O[2*e+1]=7,e++,r[7]++;for(;e<=287;)O[2*e+1]=8,e++,r[8]++;for(G(O,h+1,r),e=0;e<I;e++)N[2*e+1]=5,N[2*e]=Y(e,5);P=new D(O,g,l+1,h,E),w=new D(N,A,0,I,E),M=new D(new Array(0),F,0,u,p)}(),q=!0),e.l_desc=new b(e.dyn_ltree,P),e.d_desc=new b(e.dyn_dtree,w),e.bl_desc=new b(e.bl_tree,M),e.bi_buf=0,e.bi_valid=0,z(e)},i._tr_stored_block=Q,i._tr_flush_block=function(e,t,i,s){var o,a,c=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return n;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return r;for(t=32;t<l;t++)if(0!==e.dyn_ltree[2*t])return r;return n}(e)),j(e,e.l_desc),j(e,e.d_desc),c=function(e){var t;for(Z(e,e.dyn_ltree,e.l_desc.max_code),Z(e,e.dyn_dtree,e.d_desc.max_code),j(e,e.bl_desc),t=u-1;3<=t&&0===e.bl_tree[2*S[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),o=e.opt_len+3+7>>>3,(a=e.static_len+3+7>>>3)<=o&&(o=a)):o=a=i+5,i+4<=o&&-1!==t?Q(e,t,i,s):4===e.strategy||a===o?(B(e,2+(s?1:0),3),X(e,O,N)):(B(e,4+(s?1:0),3),function(e,t,i,s){var n;for(B(e,t-257,5),B(e,i-1,5),B(e,s-4,4),n=0;n<s;n++)B(e,e.bl_tree[2*S[n]+1],3);$(e,e.dyn_ltree,t-1),$(e,e.dyn_dtree,i-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,c+1),X(e,e.dyn_ltree,e.dyn_dtree)),z(e),s&&k(e)},i._tr_tally=function(e,t,i){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(L[i]+l+1)]++,e.dyn_dtree[2*U(t)]++),e.last_lit===e.lit_bufsize-1},i._tr_align=function(e){var t;B(e,2,3),V(e,C,O),16===(t=e).bi_valid?(x(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}},{"../utils/common":41}],53:[function(e,t,i){t.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(e,t,i){(function(e){!function(e,t){if(!e.setImmediate){var i,s,n,r,o=1,a={},c=!1,l=e.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,i="[object process]"==={}.toString.call(e.process)?function(e){process.nextTick((function(){u(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,i=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=i,t}}()?(r="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",d,!1):e.attachEvent("onmessage",d),function(t){e.postMessage(r+t,"*")}):e.MessageChannel?((n=new MessageChannel).port1.onmessage=function(e){u(e.data)},function(e){n.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?(s=l.documentElement,function(e){var t=l.createElement("script");t.onreadystatechange=function(){u(e),t.onreadystatechange=null,s.removeChild(t),t=null},s.appendChild(t)}):function(e){setTimeout(u,0,e)},h.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),s=0;s<t.length;s++)t[s]=arguments[s+1];var n={callback:e,args:t};return a[o]=n,i(o),o++},h.clearImmediate=I}function I(e){delete a[e]}function u(e){if(c)setTimeout(u,0,e);else{var i=a[e];if(i){c=!0;try{!function(e){var i=e.callback,s=e.args;switch(s.length){case 0:i();break;case 1:i(s[0]);break;case 2:i(s[0],s[1]);break;case 3:i(s[0],s[1],s[2]);break;default:i.apply(t,s)}}(i)}finally{I(e),c=!1}}}}function d(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(r)&&u(+t.data.slice(r.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,void 0!==Pr?Pr:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10));var br={},Ur={};!function(e){const t=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",i="["+t+"]["+(t+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040")+"]*",s=new RegExp("^"+i+"$");e.isExist=function(e){return void 0!==e},e.isEmptyObject=function(e){return 0===Object.keys(e).length},e.merge=function(e,t,i){if(t){const s=Object.keys(t),n=s.length;for(let r=0;r<n;r++)e[s[r]]="strict"===i?[t[s[r]]]:t[s[r]]}},e.getValue=function(t){return e.isExist(t)?t:""},e.isName=function(e){const t=s.exec(e);return!(null==t)},e.getAllMatches=function(e,t){const i=[];let s=t.exec(e);for(;s;){const n=[];n.startIndex=t.lastIndex-s[0].length;const r=s.length;for(let e=0;e<r;e++)n.push(s[e]);i.push(n),s=t.exec(e)}return i},e.nameRegexp=i}(Ur);const xr=Ur,Br={allowBooleanAttributes:!1,unpairedTags:[]};function Vr(e){return" "===e||"\t"===e||"\n"===e||"\r"===e}function Yr(e,t){const i=t;for(;t<e.length;t++)if("?"!=e[t]&&" "!=e[t]);else{const s=e.substr(i,t-i);if(t>5&&"xml"===s)return Zr("InvalidXml","XML declaration allowed only at the start of the document.",qr(e,t));if("?"==e[t]&&">"==e[t+1]){t++;break}}return t}function Gr(e,t){if(e.length>t+5&&"-"===e[t+1]&&"-"===e[t+2]){for(t+=3;t<e.length;t++)if("-"===e[t]&&"-"===e[t+1]&&">"===e[t+2]){t+=2;break}}else if(e.length>t+8&&"D"===e[t+1]&&"O"===e[t+2]&&"C"===e[t+3]&&"T"===e[t+4]&&"Y"===e[t+5]&&"P"===e[t+6]&&"E"===e[t+7]){let i=1;for(t+=8;t<e.length;t++)if("<"===e[t])i++;else if(">"===e[t]&&(i--,0===i))break}else if(e.length>t+9&&"["===e[t+1]&&"C"===e[t+2]&&"D"===e[t+3]&&"A"===e[t+4]&&"T"===e[t+5]&&"A"===e[t+6]&&"["===e[t+7])for(t+=8;t<e.length;t++)if("]"===e[t]&&"]"===e[t+1]&&">"===e[t+2]){t+=2;break}return t}br.validate=function(e,t){t=Object.assign({},Br,t);const i=[];let s=!1,n=!1;"\ufeff"===e[0]&&(e=e.substr(1));for(let o=0;o<e.length;o++)if("<"===e[o]&&"?"===e[o+1]){if(o+=2,o=Yr(e,o),o.err)return o}else{if("<"!==e[o]){if(Vr(e[o]))continue;return Zr("InvalidChar","char '"+e[o]+"' is not expected.",qr(e,o))}{let a=o;if(o++,"!"===e[o]){o=Gr(e,o);continue}{let c=!1;"/"===e[o]&&(c=!0,o++);let l="";for(;o<e.length&&">"!==e[o]&&" "!==e[o]&&"\t"!==e[o]&&"\n"!==e[o]&&"\r"!==e[o];o++)l+=e[o];if(l=l.trim(),"/"===l[l.length-1]&&(l=l.substring(0,l.length-1),o--),r=l,!xr.isName(r)){let t;return t=0===l.trim().length?"Invalid space after '<'.":"Tag '"+l+"' is an invalid name.",Zr("InvalidTag",t,qr(e,o))}const h=Hr(e,o);if(!1===h)return Zr("InvalidAttr","Attributes for '"+l+"' have open quote.",qr(e,o));let I=h.value;if(o=h.index,"/"===I[I.length-1]){const i=o-I.length;I=I.substring(0,I.length-1);const n=Xr(I,t);if(!0!==n)return Zr(n.err.code,n.err.msg,qr(e,i+n.err.line));s=!0}else if(c){if(!h.tagClosed)return Zr("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",qr(e,o));if(I.trim().length>0)return Zr("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",qr(e,a));if(0===i.length)return Zr("InvalidTag","Closing tag '"+l+"' has not been opened.",qr(e,a));{const t=i.pop();if(l!==t.tagName){let i=qr(e,t.tagStartPos);return Zr("InvalidTag","Expected closing tag '"+t.tagName+"' (opened in line "+i.line+", col "+i.col+") instead of closing tag '"+l+"'.",qr(e,a))}0==i.length&&(n=!0)}}else{const r=Xr(I,t);if(!0!==r)return Zr(r.err.code,r.err.msg,qr(e,o-I.length+r.err.line));if(!0===n)return Zr("InvalidXml","Multiple possible root nodes found.",qr(e,o));-1!==t.unpairedTags.indexOf(l)||i.push({tagName:l,tagStartPos:a}),s=!0}for(o++;o<e.length;o++)if("<"===e[o]){if("!"===e[o+1]){o++,o=Gr(e,o);continue}if("?"!==e[o+1])break;if(o=Yr(e,++o),o.err)return o}else if("&"===e[o]){const t=jr(e,o);if(-1==t)return Zr("InvalidChar","char '&' is not expected.",qr(e,o));o=t}else if(!0===n&&!Vr(e[o]))return Zr("InvalidXml","Extra text at the end",qr(e,o));"<"===e[o]&&o--}}}var r;return s?1==i.length?Zr("InvalidTag","Unclosed tag '"+i[0].tagName+"'.",qr(e,i[0].tagStartPos)):!(i.length>0)||Zr("InvalidXml","Invalid '"+JSON.stringify(i.map((e=>e.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):Zr("InvalidXml","Start tag expected.",1)};const zr='"',kr="'";function Hr(e,t){let i="",s="",n=!1;for(;t<e.length;t++){if(e[t]===zr||e[t]===kr)""===s?s=e[t]:s!==e[t]||(s="");else if(">"===e[t]&&""===s){n=!0;break}i+=e[t]}return""===s&&{value:i,index:t,tagClosed:n}}const Wr=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function Xr(e,t){const i=xr.getAllMatches(e,Wr),s={};for(let e=0;e<i.length;e++){if(0===i[e][1].length)return Zr("InvalidAttr","Attribute '"+i[e][2]+"' has no space in starting.",Qr(i[e]));if(void 0!==i[e][3]&&void 0===i[e][4])return Zr("InvalidAttr","Attribute '"+i[e][2]+"' is without value.",Qr(i[e]));if(void 0===i[e][3]&&!t.allowBooleanAttributes)return Zr("InvalidAttr","boolean attribute '"+i[e][2]+"' is not allowed.",Qr(i[e]));const n=i[e][2];if(!$r(n))return Zr("InvalidAttr","Attribute '"+n+"' is an invalid name.",Qr(i[e]));if(s.hasOwnProperty(n))return Zr("InvalidAttr","Attribute '"+n+"' is repeated.",Qr(i[e]));s[n]=1}return!0}function jr(e,t){if(";"===e[++t])return-1;if("#"===e[t])return function(e,t){let i=/\d/;for("x"===e[t]&&(t++,i=/[\da-fA-F]/);t<e.length;t++){if(";"===e[t])return t;if(!e[t].match(i))break}return-1}(e,++t);let i=0;for(;t<e.length;t++,i++)if(!(e[t].match(/\w/)&&i<20)){if(";"===e[t])break;return-1}return t}function Zr(e,t,i){return{err:{code:e,msg:t,line:i.line||i,col:i.col}}}function $r(e){return xr.isName(e)}function qr(e,t){const i=e.substring(0,t).split(/\r?\n/);return{line:i.length,col:i[i.length-1].length+1}}function Qr(e){return e.startIndex+e[1].length}var Kr={};const Jr={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,i){return e}};Kr.buildOptions=function(e){return Object.assign({},Jr,e)},Kr.defaultOptions=Jr;var eo=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){"__proto__"===e&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){"__proto__"===e.tagname&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}};const to=Ur;function io(e,t){let i="";for(;t<e.length&&"'"!==e[t]&&'"'!==e[t];t++)i+=e[t];if(i=i.trim(),-1!==i.indexOf(" "))throw new Error("External entites are not supported");const s=e[t++];let n="";for(;t<e.length&&e[t]!==s;t++)n+=e[t];return[i,n,t]}function so(e,t){return"!"===e[t+1]&&"-"===e[t+2]&&"-"===e[t+3]}function no(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"N"===e[t+3]&&"T"===e[t+4]&&"I"===e[t+5]&&"T"===e[t+6]&&"Y"===e[t+7]}function ro(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"L"===e[t+3]&&"E"===e[t+4]&&"M"===e[t+5]&&"E"===e[t+6]&&"N"===e[t+7]&&"T"===e[t+8]}function oo(e,t){return"!"===e[t+1]&&"A"===e[t+2]&&"T"===e[t+3]&&"T"===e[t+4]&&"L"===e[t+5]&&"I"===e[t+6]&&"S"===e[t+7]&&"T"===e[t+8]}function ao(e,t){return"!"===e[t+1]&&"N"===e[t+2]&&"O"===e[t+3]&&"T"===e[t+4]&&"A"===e[t+5]&&"T"===e[t+6]&&"I"===e[t+7]&&"O"===e[t+8]&&"N"===e[t+9]}function co(e){if(to.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}var lo=function(e,t){const i={};if("O"!==e[t+3]||"C"!==e[t+4]||"T"!==e[t+5]||"Y"!==e[t+6]||"P"!==e[t+7]||"E"!==e[t+8])throw new Error("Invalid Tag instead of DOCTYPE");{t+=9;let s=1,n=!1,r=!1,o="";for(;t<e.length;t++)if("<"!==e[t]||r)if(">"===e[t]){if(r?"-"===e[t-1]&&"-"===e[t-2]&&(r=!1,s--):s--,0===s)break}else"["===e[t]?n=!0:o+=e[t];else{if(n&&no(e,t))t+=7,[entityName,val,t]=io(e,t+1),-1===val.indexOf("&")&&(i[co(entityName)]={regx:RegExp(`&${entityName};`,"g"),val:val});else if(n&&ro(e,t))t+=8;else if(n&&oo(e,t))t+=8;else if(n&&ao(e,t))t+=9;else{if(!so)throw new Error("Invalid DOCTYPE");r=!0}s++,o=""}if(0!==s)throw new Error("Unclosed DOCTYPE")}return{entities:i,i:t}};const ho=/^[-+]?0x[a-fA-F0-9]+$/,Io=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const uo={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};const Eo=Ur,fo=eo,po=lo,Co=function(e,t={}){if(t=Object.assign({},uo,t),!e||"string"!=typeof e)return e;let i=e.trim();if(void 0!==t.skipLike&&t.skipLike.test(i))return e;if(t.hex&&ho.test(i))return Number.parseInt(i,16);{const s=Io.exec(i);if(s){const n=s[1],r=s[2];let o=function(e){if(e&&-1!==e.indexOf("."))return"."===(e=e.replace(/0+$/,""))?e="0":"."===e[0]?e="0"+e:"."===e[e.length-1]&&(e=e.substr(0,e.length-1)),e;return e}(s[3]);const a=s[4]||s[6];if(!t.leadingZeros&&r.length>0&&n&&"."!==i[2])return e;if(!t.leadingZeros&&r.length>0&&!n&&"."!==i[1])return e;{const s=Number(i),c=""+s;return-1!==c.search(/[eE]/)||a?t.eNotation?s:e:-1!==i.indexOf(".")?"0"===c&&""===o||c===o||n&&c==="-"+o?s:e:r?o===c||n+o===c?s:e:i===c||i===n+c?s:e}}return e}};function To(e){const t=Object.keys(e);for(let i=0;i<t.length;i++){const s=t[i];this.lastEntities[s]={regex:new RegExp("&"+s+";","g"),val:e[s]}}}function mo(e,t,i,s,n,r,o){if(void 0!==e&&(this.options.trimValues&&!s&&(e=e.trim()),e.length>0)){o||(e=this.replaceEntitiesValue(e));const s=this.options.tagValueProcessor(t,e,i,n,r);if(null==s)return e;if(typeof s!=typeof e||s!==e)return s;if(this.options.trimValues)return wo(e,this.options.parseTagValue,this.options.numberParseOptions);return e.trim()===e?wo(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function Ro(e){if(this.options.removeNSPrefix){const t=e.split(":"),i="/"===e.charAt(0)?"/":"";if("xmlns"===t[0])return"";2===t.length&&(e=i+t[1])}return e}const go=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function Ao(e,t,i){if(!this.options.ignoreAttributes&&"string"==typeof e){const i=Eo.getAllMatches(e,go),s=i.length,n={};for(let e=0;e<s;e++){const s=this.resolveNameSpace(i[e][1]);let r=i[e][4],o=this.options.attributeNamePrefix+s;if(s.length)if(this.options.transformAttributeName&&(o=this.options.transformAttributeName(o)),"__proto__"===o&&(o="#__proto__"),void 0!==r){this.options.trimValues&&(r=r.trim()),r=this.replaceEntitiesValue(r);const e=this.options.attributeValueProcessor(s,r,t);n[o]=null==e?r:typeof e!=typeof r||e!==r?e:wo(r,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(n[o]=!0)}if(!Object.keys(n).length)return;if(this.options.attributesGroupName){const e={};return e[this.options.attributesGroupName]=n,e}return n}}const Fo=function(e){e=e.replace(/\r\n?/g,"\n");const t=new fo("!xml");let i=t,s="",n="";for(let r=0;r<e.length;r++){if("<"===e[r])if("/"===e[r+1]){const t=Lo(e,">",r,"Closing Tag is not closed.");let o=e.substring(r+2,t).trim();if(this.options.removeNSPrefix){const e=o.indexOf(":");-1!==e&&(o=o.substr(e+1))}this.options.transformTagName&&(o=this.options.transformTagName(o)),i&&(s=this.saveTextToParentTag(s,i,n));const a=n.substring(n.lastIndexOf(".")+1);if(o&&-1!==this.options.unpairedTags.indexOf(o))throw new Error(`Unpaired tag can not be used as closing tag: </${o}>`);let c=0;a&&-1!==this.options.unpairedTags.indexOf(a)?(c=n.lastIndexOf(".",n.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=n.lastIndexOf("."),n=n.substring(0,c),i=this.tagsNodeStack.pop(),s="",r=t}else if("?"===e[r+1]){let t=_o(e,r,!1,"?>");if(!t)throw new Error("Pi Tag is not closed.");if(s=this.saveTextToParentTag(s,i,n),this.options.ignoreDeclaration&&"?xml"===t.tagName||this.options.ignorePiTags);else{const e=new fo(t.tagName);e.add(this.options.textNodeName,""),t.tagName!==t.tagExp&&t.attrExpPresent&&(e[":@"]=this.buildAttributesMap(t.tagExp,n,t.tagName)),this.addChild(i,e,n)}r=t.closeIndex+1}else if("!--"===e.substr(r+1,3)){const t=Lo(e,"--\x3e",r+4,"Comment is not closed.");if(this.options.commentPropName){const o=e.substring(r+4,t-2);s=this.saveTextToParentTag(s,i,n),i.add(this.options.commentPropName,[{[this.options.textNodeName]:o}])}r=t}else if("!D"===e.substr(r+1,2)){const t=po(e,r);this.docTypeEntities=t.entities,r=t.i}else if("!["===e.substr(r+1,2)){const t=Lo(e,"]]>",r,"CDATA is not closed.")-2,o=e.substring(r+9,t);s=this.saveTextToParentTag(s,i,n);let a=this.parseTextData(o,i.tagname,n,!0,!1,!0,!0);null==a&&(a=""),this.options.cdataPropName?i.add(this.options.cdataPropName,[{[this.options.textNodeName]:o}]):i.add(this.options.textNodeName,a),r=t+2}else{let o=_o(e,r,this.options.removeNSPrefix),a=o.tagName;const c=o.rawTagName;let l=o.tagExp,h=o.attrExpPresent,I=o.closeIndex;this.options.transformTagName&&(a=this.options.transformTagName(a)),i&&s&&"!xml"!==i.tagname&&(s=this.saveTextToParentTag(s,i,n,!1));const u=i;if(u&&-1!==this.options.unpairedTags.indexOf(u.tagname)&&(i=this.tagsNodeStack.pop(),n=n.substring(0,n.lastIndexOf("."))),a!==t.tagname&&(n+=n?"."+a:a),this.isItStopNode(this.options.stopNodes,n,a)){let t="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)"/"===a[a.length-1]?(a=a.substr(0,a.length-1),n=n.substr(0,n.length-1),l=a):l=l.substr(0,l.length-1),r=o.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(a))r=o.closeIndex;else{const i=this.readStopNodeData(e,c,I+1);if(!i)throw new Error(`Unexpected end of ${c}`);r=i.i,t=i.tagContent}const s=new fo(a);a!==l&&h&&(s[":@"]=this.buildAttributesMap(l,n,a)),t&&(t=this.parseTextData(t,a,n,!0,h,!0,!0)),n=n.substr(0,n.lastIndexOf(".")),s.add(this.options.textNodeName,t),this.addChild(i,s,n)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===a[a.length-1]?(a=a.substr(0,a.length-1),n=n.substr(0,n.length-1),l=a):l=l.substr(0,l.length-1),this.options.transformTagName&&(a=this.options.transformTagName(a));const e=new fo(a);a!==l&&h&&(e[":@"]=this.buildAttributesMap(l,n,a)),this.addChild(i,e,n),n=n.substr(0,n.lastIndexOf("."))}else{const e=new fo(a);this.tagsNodeStack.push(i),a!==l&&h&&(e[":@"]=this.buildAttributesMap(l,n,a)),this.addChild(i,e,n),i=e}s="",r=I}}else s+=e[r]}return t.child};function So(e,t,i){const s=this.options.updateTag(t.tagname,i,t[":@"]);!1===s||("string"==typeof s?(t.tagname=s,e.addChild(t)):e.addChild(t))}const Oo=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const i=this.docTypeEntities[t];e=e.replace(i.regx,i.val)}for(let t in this.lastEntities){const i=this.lastEntities[t];e=e.replace(i.regex,i.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const i=this.htmlEntities[t];e=e.replace(i.regex,i.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function No(e,t,i,s){return e&&(void 0===s&&(s=0===Object.keys(t.child).length),void 0!==(e=this.parseTextData(e,t.tagname,i,!1,!!t[":@"]&&0!==Object.keys(t[":@"]).length,s))&&""!==e&&t.add(this.options.textNodeName,e),e=""),e}function yo(e,t,i){const s="*."+i;for(const i in e){const n=e[i];if(s===n||t===n)return!0}return!1}function Lo(e,t,i,s){const n=e.indexOf(t,i);if(-1===n)throw new Error(s);return n+t.length-1}function _o(e,t,i,s=">"){const n=function(e,t,i=">"){let s,n="";for(let r=t;r<e.length;r++){let t=e[r];if(s)t===s&&(s="");else if('"'===t||"'"===t)s=t;else if(t===i[0]){if(!i[1])return{data:n,index:r};if(e[r+1]===i[1])return{data:n,index:r}}else"\t"===t&&(t=" ");n+=t}}(e,t+1,s);if(!n)return;let r=n.data;const o=n.index,a=r.search(/\s/);let c=r,l=!0;-1!==a&&(c=r.substring(0,a),r=r.substring(a+1).trimStart());const h=c;if(i){const e=c.indexOf(":");-1!==e&&(c=c.substr(e+1),l=c!==n.data.substr(e+1))}return{tagName:c,tagExp:r,closeIndex:o,attrExpPresent:l,rawTagName:h}}function Po(e,t,i){const s=i;let n=1;for(;i<e.length;i++)if("<"===e[i])if("/"===e[i+1]){const r=Lo(e,">",i,`${t} is not closed`);if(e.substring(i+2,r).trim()===t&&(n--,0===n))return{tagContent:e.substring(s,i),i:r};i=r}else if("?"===e[i+1]){i=Lo(e,"?>",i+1,"StopNode is not closed.")}else if("!--"===e.substr(i+1,3)){i=Lo(e,"--\x3e",i+3,"StopNode is not closed.")}else if("!["===e.substr(i+1,2)){i=Lo(e,"]]>",i,"StopNode is not closed.")-2}else{const s=_o(e,i,">");if(s){(s&&s.tagName)===t&&"/"!==s.tagExp[s.tagExp.length-1]&&n++,i=s.closeIndex}}}function wo(e,t,i){if(t&&"string"==typeof e){const t=e.trim();return"true"===t||"false"!==t&&Co(e,i)}return Eo.isExist(e)?e:""}var Mo=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,16))}},this.addExternalEntities=To,this.parseXml=Fo,this.parseTextData=mo,this.resolveNameSpace=Ro,this.buildAttributesMap=Ao,this.isItStopNode=yo,this.replaceEntitiesValue=Oo,this.readStopNodeData=Po,this.saveTextToParentTag=No,this.addChild=So}},vo={};function Do(e,t,i){let s;const n={};for(let r=0;r<e.length;r++){const o=e[r],a=bo(o);let c="";if(c=void 0===i?a:i+"."+a,a===t.textNodeName)void 0===s?s=o[a]:s+=""+o[a];else{if(void 0===a)continue;if(o[a]){let e=Do(o[a],t,c);const i=xo(e,t);o[":@"]?Uo(e,o[":@"],c,t):1!==Object.keys(e).length||void 0===e[t.textNodeName]||t.alwaysCreateTextNode?0===Object.keys(e).length&&(t.alwaysCreateTextNode?e[t.textNodeName]="":e=""):e=e[t.textNodeName],void 0!==n[a]&&n.hasOwnProperty(a)?(Array.isArray(n[a])||(n[a]=[n[a]]),n[a].push(e)):t.isArray(a,c,i)?n[a]=[e]:n[a]=e}}}return"string"==typeof s?s.length>0&&(n[t.textNodeName]=s):void 0!==s&&(n[t.textNodeName]=s),n}function bo(e){const t=Object.keys(e);for(let e=0;e<t.length;e++){const i=t[e];if(":@"!==i)return i}}function Uo(e,t,i,s){if(t){const n=Object.keys(t),r=n.length;for(let o=0;o<r;o++){const r=n[o];s.isArray(r,i+"."+r,!0,!0)?e[r]=[t[r]]:e[r]=t[r]}}}function xo(e,t){const{textNodeName:i}=t,s=Object.keys(e).length;return 0===s||!(1!==s||!e[i]&&"boolean"!=typeof e[i]&&0!==e[i])}vo.prettify=function(e,t){return Do(e,t)};const{buildOptions:Bo}=Kr,Vo=Mo,{prettify:Yo}=vo,Go=br;var zo=class{constructor(e){this.externalEntities={},this.options=Bo(e)}parse(e,t){if("string"==typeof e);else{if(!e.toString)throw new Error("XML data is accepted in String or Bytes[] form.");e=e.toString()}if(t){!0===t&&(t={});const i=Go.validate(e,t);if(!0!==i)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const i=new Vo(this.options);i.addExternalEntities(this.externalEntities);const s=i.parseXml(e);return this.options.preserveOrder||void 0===s?s:Yo(s,this.options)}addEntity(e,t){if(-1!==t.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==e.indexOf("&")||-1!==e.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if("&"===t)throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}};function ko(e,t,i,s){let n="",r=!1;for(let o=0;o<e.length;o++){const a=e[o],c=Ho(a);if(void 0===c)continue;let l="";if(l=0===i.length?c:`${i}.${c}`,c===t.textNodeName){let e=a[c];Xo(l,t)||(e=t.tagValueProcessor(c,e),e=jo(e,t)),r&&(n+=s),n+=e,r=!1;continue}if(c===t.cdataPropName){r&&(n+=s),n+=`<![CDATA[${a[c][0][t.textNodeName]}]]>`,r=!1;continue}if(c===t.commentPropName){n+=s+`\x3c!--${a[c][0][t.textNodeName]}--\x3e`,r=!0;continue}if("?"===c[0]){const e=Wo(a[":@"],t),i="?xml"===c?"":s;let o=a[c][0][t.textNodeName];o=0!==o.length?" "+o:"",n+=i+`<${c}${o}${e}?>`,r=!0;continue}let h=s;""!==h&&(h+=t.indentBy);const I=s+`<${c}${Wo(a[":@"],t)}`,u=ko(a[c],t,l,h);-1!==t.unpairedTags.indexOf(c)?t.suppressUnpairedNode?n+=I+">":n+=I+"/>":u&&0!==u.length||!t.suppressEmptyNode?u&&u.endsWith(">")?n+=I+`>${u}${s}</${c}>`:(n+=I+">",u&&""!==s&&(u.includes("/>")||u.includes("</"))?n+=s+t.indentBy+u+s:n+=u,n+=`</${c}>`):n+=I+"/>",r=!0}return n}function Ho(e){const t=Object.keys(e);for(let i=0;i<t.length;i++){const s=t[i];if(e.hasOwnProperty(s)&&":@"!==s)return s}}function Wo(e,t){let i="";if(e&&!t.ignoreAttributes)for(let s in e){if(!e.hasOwnProperty(s))continue;let n=t.attributeValueProcessor(s,e[s]);n=jo(n,t),!0===n&&t.suppressBooleanAttributes?i+=` ${s.substr(t.attributeNamePrefix.length)}`:i+=` ${s.substr(t.attributeNamePrefix.length)}="${n}"`}return i}function Xo(e,t){let i=(e=e.substr(0,e.length-t.textNodeName.length-1)).substr(e.lastIndexOf(".")+1);for(let s in t.stopNodes)if(t.stopNodes[s]===e||t.stopNodes[s]==="*."+i)return!0;return!1}function jo(e,t){if(e&&e.length>0&&t.processEntities)for(let i=0;i<t.entities.length;i++){const s=t.entities[i];e=e.replace(s.regex,s.val)}return e}const Zo=function(e,t){let i="";return t.format&&t.indentBy.length>0&&(i="\n"),ko(e,t,"",i)},$o={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function qo(e){this.options=Object.assign({},$o,e),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Jo),this.processTextOrObjNode=Qo,this.options.format?(this.indentate=Ko,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function Qo(e,t,i){const s=this.j2x(e,i+1);return void 0!==e[this.options.textNodeName]&&1===Object.keys(e).length?this.buildTextValNode(e[this.options.textNodeName],t,s.attrStr,i):this.buildObjectNode(s.val,t,s.attrStr,i)}function Ko(e){return this.options.indentBy.repeat(e)}function Jo(e){return!(!e.startsWith(this.options.attributeNamePrefix)||e===this.options.textNodeName)&&e.substr(this.attrPrefixLen)}qo.prototype.build=function(e){return this.options.preserveOrder?Zo(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)},qo.prototype.j2x=function(e,t){let i="",s="";for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n))if(void 0===e[n])this.isAttribute(n)&&(s+="");else if(null===e[n])this.isAttribute(n)?s+="":"?"===n[0]?s+=this.indentate(t)+"<"+n+"?"+this.tagEndChar:s+=this.indentate(t)+"<"+n+"/"+this.tagEndChar;else if(e[n]instanceof Date)s+=this.buildTextValNode(e[n],n,"",t);else if("object"!=typeof e[n]){const r=this.isAttribute(n);if(r)i+=this.buildAttrPairStr(r,""+e[n]);else if(n===this.options.textNodeName){let t=this.options.tagValueProcessor(n,""+e[n]);s+=this.replaceEntitiesValue(t)}else s+=this.buildTextValNode(e[n],n,"",t)}else if(Array.isArray(e[n])){const i=e[n].length;let r="",o="";for(let a=0;a<i;a++){const i=e[n][a];if(void 0===i);else if(null===i)"?"===n[0]?s+=this.indentate(t)+"<"+n+"?"+this.tagEndChar:s+=this.indentate(t)+"<"+n+"/"+this.tagEndChar;else if("object"==typeof i)if(this.options.oneListGroup){const e=this.j2x(i,t+1);r+=e.val,this.options.attributesGroupName&&i.hasOwnProperty(this.options.attributesGroupName)&&(o+=e.attrStr)}else r+=this.processTextOrObjNode(i,n,t);else if(this.options.oneListGroup){let e=this.options.tagValueProcessor(n,i);e=this.replaceEntitiesValue(e),r+=e}else r+=this.buildTextValNode(i,n,"",t)}this.options.oneListGroup&&(r=this.buildObjectNode(r,n,o,t)),s+=r}else if(this.options.attributesGroupName&&n===this.options.attributesGroupName){const t=Object.keys(e[n]),s=t.length;for(let r=0;r<s;r++)i+=this.buildAttrPairStr(t[r],""+e[n][t[r]])}else s+=this.processTextOrObjNode(e[n],n,t);return{attrStr:i,val:s}},qo.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&"true"===t?" "+e:" "+e+'="'+t+'"'},qo.prototype.buildObjectNode=function(e,t,i,s){if(""===e)return"?"===t[0]?this.indentate(s)+"<"+t+i+"?"+this.tagEndChar:this.indentate(s)+"<"+t+i+this.closeTag(t)+this.tagEndChar;{let n="</"+t+this.tagEndChar,r="";return"?"===t[0]&&(r="?",n=""),!i&&""!==i||-1!==e.indexOf("<")?!1!==this.options.commentPropName&&t===this.options.commentPropName&&0===r.length?this.indentate(s)+`\x3c!--${e}--\x3e`+this.newLine:this.indentate(s)+"<"+t+i+r+this.tagEndChar+e+this.indentate(s)+n:this.indentate(s)+"<"+t+i+r+">"+e+n}},qo.prototype.closeTag=function(e){let t="";return-1!==this.options.unpairedTags.indexOf(e)?this.options.suppressUnpairedNode||(t="/"):t=this.options.suppressEmptyNode?"/":`></${e}`,t},qo.prototype.buildTextValNode=function(e,t,i,s){if(!1!==this.options.cdataPropName&&t===this.options.cdataPropName)return this.indentate(s)+`<![CDATA[${e}]]>`+this.newLine;if(!1!==this.options.commentPropName&&t===this.options.commentPropName)return this.indentate(s)+`\x3c!--${e}--\x3e`+this.newLine;if("?"===t[0])return this.indentate(s)+"<"+t+i+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(t,e);return n=this.replaceEntitiesValue(n),""===n?this.indentate(s)+"<"+t+i+this.closeTag(t)+this.tagEndChar:this.indentate(s)+"<"+t+i+">"+n+"</"+t+this.tagEndChar}},qo.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const i=this.options.entities[t];e=e.replace(i.regex,i.val)}return e};var ea={XMLParser:zo,XMLValidator:br,XMLBuilder:qo};class ta{constructor(e,i){t(this,"date",new Date),t(this,"author"),t(this,"guid",Gi.create()),t(this,"viewpoint"),t(this,"modifiedAuthor"),t(this,"modifiedDate"),t(this,"topic"),t(this,"_components"),t(this,"_comment",""),this._components=e,this._comment=i;const s=this._components.get(aa);this.author=s.config.author}set comment(e){var t;const i=this._components.get(aa);this._comment=e,this.modifiedDate=new Date,this.modifiedAuthor=i.config.author,null==(t=this.topic)||t.comments.set(this.guid,this)}get comment(){return this._comment}serialize(){let e=null;this.viewpoint&&(e=`<Viewpoint Guid="${this.viewpoint.guid}"/>`);let t=null;this.modifiedDate&&(t=`<ModifiedDate>${this.modifiedDate.toISOString()}</ModifiedDate>`);let i=null;return this.modifiedAuthor&&(i=`<ModifiedAuthor>${this.modifiedAuthor}</ModifiedAuthor>`),`\n <Comment Guid="${this.guid}">\n <Date>${this.date.toISOString()}</Date>\n <Author>${this.author}</Author>\n <Comment>${this.comment}</Comment>\n ${e??""}\n ${i??""}\n ${t??""}\n </Comment>\n `}}const ia=class e{constructor(i){t(this,"guid",Gi.create()),t(this,"title",e.default.title),t(this,"creationDate",new Date),t(this,"creationAuthor",""),t(this,"viewpoints",new Ci),t(this,"relatedTopics",new Ci),t(this,"comments",new Ti),t(this,"customData",{}),t(this,"description"),t(this,"serverAssignedId"),t(this,"dueDate"),t(this,"modifiedAuthor"),t(this,"modifiedDate"),t(this,"index"),t(this,"_type",e.default.type),t(this,"_status",e.default.status),t(this,"_priority",e.default.priority),t(this,"_stage",e.default.priority),t(this,"_assignedTo",e.default.assignedTo),t(this,"_labels",e.default.labels),t(this,"_components"),this._components=i;const s=i.get(aa);this.creationAuthor=s.config.author,this.relatedTopics.guard=e=>e!==this.guid}set type(e){const t=this._components.get(aa),{strict:i,types:s}=t.config;(!i||s.has(e))&&(this._type=e)}get type(){return this._type}set status(e){const t=this._components.get(aa),{strict:i,statuses:s}=t.config;(!i||s.has(e))&&(this._status=e)}get status(){return this._status}set priority(e){const t=this._components.get(aa);if(e){const{strict:i,priorities:s}=t.config;if(!(!i||s.has(e)))return;this._priority=e}else this._priority=e}get priority(){return this._priority}set stage(e){const t=this._components.get(aa);if(e){const{strict:i,stages:s}=t.config;if(!(!i||s.has(e)))return;this._stage=e}else this._stage=e}get stage(){return this._stage}set assignedTo(e){const t=this._components.get(aa);if(e){const{strict:i,users:s}=t.config;if(!(!i||s.has(e)))return;this._assignedTo=e}else this._assignedTo=e}get assignedTo(){return this._assignedTo}set labels(e){const t=this._components.get(aa),{strict:i,labels:s}=t.config;if(i){const t=new Set;for(const n of e){(!i||s.has(n))&&t.add(n)}this._labels=t}else this._labels=e}get labels(){return this._labels}get _managerVersion(){return this._components.get(aa).config.version}set(e){const t=e,i=this;for(const s in e){if("guid"===s)continue;const e=t[s];s in this&&(i[s]=e)}return this._components.get(aa).list.set(this.guid,this),this}createComment(e,t){const i=new ta(this._components,e);return i.viewpoint=t,i.topic=this,this.comments.set(i.guid,i),i}createLabelTags(e=this._managerVersion){let t="Labels";"2.1"===e&&(t="Labels"),"3"===e&&(t="Label");let i=[...this.labels].map((e=>`<${t}>${e}</${t}>`)).join("\n");for(const e in this.customData){const s=this.customData[e];"string"==typeof s&&(i+=`\n<${t}>${s}</${t}>`)}return"2.1"===e?i:"3"===e?0!==i.length?`<Labels>\n${i}\n</Labels>`:"<Labels/>":i}createCommentTags(e=this._managerVersion){const t=[...this.comments.values()].map((e=>e.serialize())).join("\n");return"2.1"===e?t:"3"===e?0!==t.length?`<Comments>\n${t}\n</Comments>`:"<Comments/>":t}createViewpointTags(e=this._managerVersion){let t="Viewpoints";"2.1"===e&&(t="Viewpoints"),"3"===e&&(t="ViewPoint");const i=this._components.get(va),s=[...this.viewpoints].map((e=>i.list.get(e))).filter((e=>e)).map((e=>`<${t} Guid="${e.guid}">\n <Viewpoint>${e.guid}.bcfv</Viewpoint>\n <Snapshot>${e.guid}.jpeg</Snapshot>\n </${t}>\n `)).join("\n");return"2.1"===e?s:"3"===e?0!==s.length?`<Viewpoints>\n${s}\n</Viewpoints>`:"<Viewpoints />":s}createRelatedTopicTags(e=this._managerVersion){const t=[...this.relatedTopics].map((e=>`<RelatedTopic Guid="${e}"></RelatedTopic>\n `)).join("\n");return"2.1"===e?t:"3"===e?0!==t.length?`<RelatedTopics>\n${t}\n</RelatedTopics>`:"<RelatedTopics />":t}serialize(){const e=this._managerVersion;let t=null;this.serverAssignedId&&(t=`ServerAssignedId="${this.serverAssignedId}"`);let i=null;this.priority&&(i=`<Priority>${this.priority}</Priority>`);let s=null;this.index&&"2.1"===e&&(s=`<Index>${this.index}</Index>`);let n=null;this.modifiedDate&&(n=`<ModifiedDate>${this.modifiedDate.toISOString()}</ModifiedDate>`);let r=null;this.modifiedAuthor&&(r=`<ModifiedAuthor>${this.modifiedAuthor}</ModifiedAuthor>`);let o=null;this.dueDate&&(o=`<DueDate>${this.dueDate.toISOString()}</DueDate>`);let a=null;this.assignedTo&&(a=`<AssignedTo>${this.assignedTo}</AssignedTo>`);let c=null;this.description&&(c=`<Description>${this.description}</Description>`);let l=null;this.stage&&(l=`<Stage>${this.stage}</Stage>`);const h=this.createCommentTags(e),I=this.createViewpointTags(e),u=this.createLabelTags(e),d=this.createRelatedTopicTags(e);return`\n <?xml version="1.0" encoding="UTF-8"?>\n <Markup>\n <Topic Guid="${this.guid}" TopicType="${this.type}" TopicStatus="${this.status}" ${t??""}>\n <Title>${this.title}</Title>\n <CreationDate>${this.creationDate.toISOString()}</CreationDate>\n <CreationAuthor>${this.creationAuthor}</CreationAuthor>\n ${i??""}\n ${s??""}\n ${n??""}\n ${r??""}\n ${o??""}\n ${a??""}\n ${c??""}\n ${l??""}\n ${u}\n ${d}\n ${"3"===e?h:""}\n ${"3"===e?I:""}\n </Topic>\n ${"2.1"===e?h:""}\n ${"2.1"===e?I:""}\n </Markup>\n `}};t(ia,"default",{title:"BCF Topic",type:"Issue",status:"Active",labels:new Set});let sa=ia;const na=(e,t)=>{if(""===t.trim())return;const i=aa.xmlParser.parse(t).Extensions;if(!i)return;const{Priorities:s,TopicStatuses:n,TopicTypes:r,Users:o}=i;if(s&&s.Priority){const t=Array.isArray(s.Priority)?s.Priority:[s.Priority];for(const i of t)e.config.priorities.add(i)}if(n&&n.TopicStatus){const t=Array.isArray(n.TopicStatus)?n.TopicStatus:[n.TopicStatus];for(const i of t)e.config.statuses.add(i)}if(r&&r.TopicType){const t=Array.isArray(r.TopicType)?r.TopicType:[r.TopicType];for(const i of t)e.config.types.add(i)}if(o&&o.User){const t=Array.isArray(o.User)?o.User:[o.User];for(const i of t)e.config.users.add(i)}};class ra extends Xi{constructor(){super(...arguments),t(this,"_config",{version:{type:"Select",options:new Set(["2.1","3"]),multiple:!1,value:""},author:{type:"Text",value:""},types:{type:"TextSet",value:new Set},statuses:{type:"TextSet",value:new Set},priorities:{type:"TextSet",value:new Set},labels:{type:"TextSet",value:new Set},stages:{type:"TextSet",value:new Set},users:{type:"TextSet",value:new Set},includeSelectionTag:{type:"Boolean",value:!1},updateExtensionsOnImport:{type:"Boolean",value:!1},strict:{type:"Boolean",value:!1},includeAllExtensionsOnExport:{type:"Boolean",value:!1},fallbackVersionOnImport:{type:"Select",multiple:!1,options:new Set(["2.1","3"]),value:""},ignoreIncompleteTopicsOnImport:{type:"Boolean",value:!1}})}get version(){return this._config.version.value}set version(e){this._config.version.value=e}get author(){return this._config.author.value}set author(e){this._config.author.value=e}get types(){return this._config.types.value}set types(e){this._config.types.value=e}get statuses(){return this._config.statuses.value}set statuses(e){this._config.statuses.value=e}get priorities(){return this._config.priorities.value}set priorities(e){this._config.priorities.value=e}get labels(){return this._config.labels.value}set labels(e){this._config.labels.value=e}get stages(){return this._config.stages.value}set stages(e){this._config.stages.value=e}get users(){return this._config.users.value}set users(e){this._config.users.value=e}get includeSelectionTag(){return this._config.includeSelectionTag.value}set includeSelectionTag(e){this._config.includeSelectionTag.value=e}get updateExtensionsOnImport(){return this._config.updateExtensionsOnImport.value}set updateExtensionsOnImport(e){this._config.updateExtensionsOnImport.value=e}get strict(){return this._config.strict.value}set strict(e){this._config.strict.value=e}get includeAllExtensionsOnExport(){return this._config.includeAllExtensionsOnExport.value}set includeAllExtensionsOnExport(e){this._config.includeAllExtensionsOnExport.value=e}get fallbackVersionOnImport(){return this._config.fallbackVersionOnImport.value}set fallbackVersionOnImport(e){this._config.fallbackVersionOnImport.value=e}get ignoreIncompleteTopicsOnImport(){return this._config.ignoreIncompleteTopicsOnImport.value}set ignoreIncompleteTopicsOnImport(e){this._config.ignoreIncompleteTopicsOnImport.value=e}}const oa=class e extends hi{constructor(){super(...arguments),t(this,"enabled",!1),t(this,"_defaultConfig",{author:"jhon.doe@example.com",version:"2.1",types:new Set(["Clash","Failure","Fault","Inquiry","Issue","Remark","Request"]),statuses:new Set(["Active","In Progress","Done","In Review","Closed"]),priorities:new Set(["On hold","Minor","Normal","Major","Critical"]),labels:new Set,stages:new Set,users:new Set,includeSelectionTag:!1,updateExtensionsOnImport:!0,strict:!1,includeAllExtensionsOnExport:!0,fallbackVersionOnImport:"2.1",ignoreIncompleteTopicsOnImport:!1}),t(this,"config",new ra(this,this.components,"BCF Topics",e.uuid)),t(this,"list",new Ti),t(this,"onSetup",new ai),t(this,"isSetup",!1),t(this,"onBCFImported",new ai),t(this,"onDisposed",new ai)}setup(e){if(this.isSetup)return;const t={...this._defaultConfig,...e};this.config.version=t.version,this.config.author=t.author,this.config.types=t.types,this.config.statuses=t.statuses,this.config.priorities=t.priorities,this.config.labels=t.labels,this.config.stages=t.stages,this.config.users=t.users,this.config.includeSelectionTag=t.includeSelectionTag,this.config.updateExtensionsOnImport=t.updateExtensionsOnImport,this.config.strict=t.strict,this.config.includeAllExtensionsOnExport=t.includeAllExtensionsOnExport,this.config.fallbackVersionOnImport=t.fallbackVersionOnImport||"",this.config.ignoreIncompleteTopicsOnImport=t.ignoreIncompleteTopicsOnImport,this.isSetup=!0,this.enabled=!0,this.onSetup.trigger()}create(e){const t=new sa(this.components);return e&&(t.guid=e.guid??t.guid,t.set(e)),this.list.set(t.guid,t),t}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get usedTypes(){const e=[...this.list].map((([e,t])=>t.type));return new Set(e)}get usedStatuses(){const e=[...this.list].map((([e,t])=>t.status));return new Set(e)}get usedPriorities(){const e=[...this.list].map((([e,t])=>t.priority)).filter((e=>e));return new Set(e)}get usedStages(){const e=[...this.list].map((([e,t])=>t.stage)).filter((e=>e));return new Set(e)}get usedUsers(){const e=[];for(const[t,i]of this.list){e.push(i.creationAuthor),i.assignedTo&&e.push(i.assignedTo),i.modifiedAuthor&&e.push(i.modifiedAuthor);for(const[t,s]of i.comments)e.push(s.author),s.modifiedAuthor&&e.push(s.modifiedAuthor)}return new Set(e)}get usedLabels(){const e=[];for(const[t,i]of this.list)e.push(...i.labels);return new Set(e)}updateExtensions(){for(const[e,t]of this.list){for(const e of t.labels)this.config.labels.add(e);this.config.types.add(t.type),t.priority&&this.config.priorities.add(t.priority),t.stage&&this.config.stages.add(t.stage),this.config.statuses.add(t.status),this.config.users.add(t.creationAuthor),t.assignedTo&&this.config.users.add(t.assignedTo),t.modifiedAuthor&&this.config.users.add(t.modifiedAuthor);for(const[e,i]of t.comments)this.config.users.add(i.author),i.modifiedAuthor&&this.config.users.add(i.modifiedAuthor)}}updateViewpointReferences(){const e=this.components.get(va);for(const[t,i]of this.list)for(const t of i.viewpoints){e.list.has(t)||i.viewpoints.delete(t)}}async export(e=this.list.values()){const t=new Dr;t.file("bcf.version",`<?xml version="1.0" encoding="UTF-8"?>\n <Version VersionId="${this.config.version}" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/buildingSMART/BCF-XML/release_3_0/Schemas/version.xsd"\n xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\n </Version>`),t.file("bcf.extensions",this.serializeExtensions());const i=await fetch("https://thatopen.github.io/engine_components/resources/favicon.ico"),s=await i.arrayBuffer(),n=this.components.get(va);for(const i of e){const e=t.folder(i.guid);e.file("markup.bcf",i.serialize());for(const t of i.viewpoints){const i=n.list.get(t);i&&(e.file(`${t}.jpeg`,s,{binary:!0}),e.file(`${t}.bcfv`,await i.serialize()))}}return await t.generateAsync({type:"blob"})}serializeExtensions(){const e=[...this.config.types].map((e=>`<TopicType>${e}</TopicType>`)).join("\n"),t=[...this.config.statuses].map((e=>`<TopicStatus>${e}</TopicStatus>`)).join("\n"),i=[...this.config.priorities].map((e=>`<Priority>${e}</Priority>`)).join("\n"),s=[...this.config.labels].map((e=>`<TopicLabel>${e}</TopicLabel>`)).join("\n"),n=[...this.config.stages].map((e=>`<Stage>${e}</Stage>`)).join("\n"),r=[...this.config.users].map((e=>`<User>${e}</User>`)).join("\n");return`\n <?xml version="1.0" encoding="UTF-8"?>\n <Extensions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="your-schema-location.xsd">\n ${0!==e.length?`<TopicTypes>\n${e}\n</TopicTypes>`:""}\n ${0!==t.length?`<TopicStatuses>\n${t}\n</TopicStatuses>`:""}\n ${0!==i.length?`<Priorities>\n${i}\n</Priorities>`:""}\n ${0!==s.length?`<TopicLabels>\n${s}\n</TopicLabels>`:""}\n ${0!==n.length?`<Stages>\n${n}\n</Stages>`:""}\n ${0!==r.length?`<Users>\n${r}\n</Users>`:""}\n </Extensions>\n `}processMarkupComment(e){const{Guid:t,Date:i,Author:s,Comment:n,Viewpoint:r}=e;if(!(t&&i&&s&&(ta||r)))return null;const o=this.components.get(va),a=new ta(this.components,n??"");return a.guid=t,a.date=new Date(i),a.author=s,a.viewpoint=(null==r?void 0:r.Guid)?o.list.get(r.Guid):void 0,a.modifiedAuthor=e.ModifiedAuthor,a.modifiedDate=e.ModifiedDate?new Date(e.ModifiedDate):void 0,a}getMarkupComments(e,t){var i;let s;if("2.1"===t&&(s=e.Comment),"3"===t&&(s=null==(i=e.Topic.Comments)?void 0:i.Comment),!s)return[];s=Array.isArray(s)?s:[s];const n=s.map((e=>this.processMarkupComment(e))).filter((e=>e));return Array.isArray(n)?n:[n]}getMarkupLabels(e,t){var i;let s;if("2.1"===t&&(s=e.Topic.Labels),"3"===t&&(s=null==(i=e.Topic.Labels)?void 0:i.Label),!s)return[];return Array.isArray(s)?s:[s]}getMarkupViewpoints(e,t){var i;let s;return"2.1"===t&&(s=e.Viewpoints),"3"===t&&(s=null==(i=e.Topic.Viewpoints)?void 0:i.ViewPoint),s?(s=Array.isArray(s)?s:[s],s):[]}getMarkupRelatedTopics(e,t){var i;let s;if("2.1"===t&&(s=e.Topic.RelatedTopic),"3"===t&&(s=null==(i=e.Topic.RelatedTopics)?void 0:i.RelatedTopic),!s)return[];return(Array.isArray(s)?s:[s]).map((e=>e.Guid))}async load(t,s){var n;const{fallbackVersionOnImport:r,ignoreIncompleteTopicsOnImport:o,updateExtensionsOnImport:a}=this.config,c=new Dr;await c.loadAsync(t);const l=Object.values(c.files);let h=r;const I=l.find((e=>e.name.endsWith(".version")));if(I){const t=await I.async("string"),i=e.xmlParser.parse(t).Version.VersionId;h=String(i)}if(!h||"2.1"!==h&&"3"!==h)throw new Error(`BCFTopics: ${h} is not supported.`);const u=l.find((e=>e.name.endsWith(".extensions")));if(a&&u){const e=await u.async("string");na(this,e)}const d=[],E=this.components.get(va),f=l.filter((e=>e.name.endsWith(".bcfv")));for(const t of f){const r=await t.async("string"),o=e.xmlParser.parse(r).VisualizationInfo;if(!o){console.warn("Missing VisualizationInfo in Viewpoint");continue}const a={},{Guid:c,ClippingPlanes:l,Components:I,OrthogonalCamera:u,PerspectiveCamera:E}=o;if(c&&(a.guid=c),I){const{Selection:e,Visibility:t}=I;if(e&&e.Component){const t=Array.isArray(e.Component)?e.Component:[e.Component];a.selectionComponents=t.map((e=>e.IfcGuid)).filter((e=>e))}if(t&&"DefaultVisibility"in t&&(a.defaultVisibility=t.DefaultVisibility),t&&t.Exceptions&&"Component"in t.Exceptions){const{Component:e}=t.Exceptions,i=Array.isArray(e)?e:[e];a.exceptionComponents=i.map((e=>e.IfcGuid)).filter((e=>e))}let i;"2.1"===h&&(i=I.ViewSetupHints),"3"===h&&(i=null==(n=I.Visibility)?void 0:n.ViewSetupHints),i&&("OpeningsVisible"in i&&(a.openingsVisible=i.OpeningsVisible),"SpacesVisible"in i&&(a.spacesVisible=i.SpacesVisible),"SpaceBoundariesVisible"in i&&(a.spaceBoundariesVisible=i.SpaceBoundariesVisible))}if(u||E){const e=o.PerspectiveCamera??o.OrthogonalCamera,{CameraViewPoint:t,CameraDirection:s}=e,n=new i.Vector3(Number(t.X),Number(t.Z),Number(-t.Y)),r=new i.Vector3(Number(s.X),Number(s.Z),Number(-s.Y)),c={position:{x:n.x,y:n.y,z:n.z},direction:{x:r.x,y:r.y,z:r.z},aspectRatio:"AspectRatio"in e?e.AspectRatio:1};"ViewToWorldScale"in e&&(a.camera={...c,viewToWorldScale:e.ViewToWorldScale}),"FieldOfView"in e&&(a.camera={...c,fov:e.FieldOfView})}const f=new Pa(this.components,s,{data:a,setCamera:!1});if(I){const{Coloring:e}=I;if(e&&e.Color){const t=Array.isArray(e.Color)?e.Color:[e.Color];for(const e of t){const{Color:t,Component:i}=e,s=(Array.isArray(i)?i:[i]).map((e=>e.IfcGuid));f.componentColors.set(t,s)}}}if(d.push(f),l){const e=this.components.get(Jn),t=Array.isArray(l.ClippingPlane)?l.ClippingPlane:[l.ClippingPlane];for(const n of t){const{Location:t,Direction:r}=n;if(!t||!r)continue;const o=new i.Vector3(t.X,t.Z,-t.Y),a=new i.Vector3(r.X,-r.Z,r.Y),c=e.createFromNormalAndCoplanarPoint(s,a,o);c.visible=!1,c.enabled=!1,f.clippingPlanes.add(c)}}}const p={},C=[],T=l.filter((e=>e.name.endsWith(".bcf")));for(const t of T){const i=await t.async("string"),s=e.xmlParser.parse(i).Markup,n=s.Topic,{Guid:r,TopicType:a,TopicStatus:c,Title:l,CreationDate:I,CreationAuthor:u}=n;if(o&&!(r&&a&&c&&l&&I&&u))continue;const d=new sa(this.components);d.guid=r??d.guid;const f=this.getMarkupRelatedTopics(s,h);p[d.guid]=new Set(f),d.type=a??d.type,d.status=c??d.status,d.title=l??d.title,d.creationDate=I?new Date(I):d.creationDate,d.creationAuthor=u??d.creationAuthor,d.serverAssignedId=n.ServerAssignedId,d.priority=n.Priority,d.index=n.Index,d.modifiedDate=n.ModifiedDate?new Date(n.ModifiedDate):void 0,d.modifiedAuthor=n.ModifiedAuthor,d.dueDate=n.DueDate?new Date(n.DueDate):void 0,d.assignedTo=n.AssignedTo,d.description=n.Description,d.stage=n.Stage;const T=this.getMarkupLabels(s,h);for(const e of T)d.labels.add(e);const m=this.getMarkupComments(s,h);for(const e of m)d.comments.set(e.guid,e);const R=this.getMarkupViewpoints(s,h);for(const e of R){if(!e||!e.Guid)continue;const t=E.list.get(e.Guid);t&&d.viewpoints.add(t.guid)}this.list.set(d.guid,d),C.push(d)}for(const e in p){const t=this.list.get(e);if(!t)continue;const i=p[e];for(const e of i)t.relatedTopics.add(e)}return this.onBCFImported.trigger(C),{viewpoints:d,topics:C}}};t(oa,"uuid","de977976-e4f6-4e4f-a01a-204727839802"),t(oa,"xmlParser",new ea.XMLParser({allowBooleanAttributes:!0,attributeNamePrefix:"",ignoreAttributes:!1,ignoreDeclaration:!0,ignorePiTags:!0,numberParseOptions:{leadingZeros:!0,hex:!0},parseAttributeValue:!0,preserveOrder:!1,processEntities:!1,removeNSPrefix:!0,trimValues:!0}));let aa=oa;const ca=class e extends hi{constructor(i){super(i),t(this,"enabled",!0),t(this,"onDisposed",new ai),t(this,"_absoluteMin"),t(this,"_absoluteMax"),t(this,"_meshes",[]),this.components.add(e.uuid,this),this._absoluteMin=e.newBound(!0),this._absoluteMax=e.newBound(!1)}static getDimensions(e){const{min:t,max:s}=e,n=Math.abs(s.x-t.x),r=Math.abs(s.y-t.y),o=Math.abs(s.z-t.z),a=new i.Vector3;return a.subVectors(s,t).divideScalar(2).add(t),{width:n,height:r,depth:o,center:a}}static newBound(e){const t=e?1:-1;return new i.Vector3(t*Number.MAX_VALUE,t*Number.MAX_VALUE,t*Number.MAX_VALUE)}static getBounds(e,t,s){const n=s||this.newBound(!1),r=t||this.newBound(!0);for(const t of e)t.x<r.x&&(r.x=t.x),t.y<r.y&&(r.y=t.y),t.z<r.z&&(r.z=t.z),t.x>n.x&&(n.x=t.x),t.y>n.y&&(n.y=t.y),t.z>n.z&&(n.z=t.z);return new i.Box3(t,s)}dispose(){const t=this.components.get(fi);for(const e of this._meshes)t.destroy(e);this._meshes=[],this.onDisposed.trigger(e.uuid),this.onDisposed.reset()}get(){const e=this._absoluteMin.clone(),t=this._absoluteMax.clone();return new i.Box3(e,t)}getSphere(){const e=this._absoluteMin.clone(),t=this._absoluteMax.clone(),s=Math.abs((t.x-e.x)/2),n=Math.abs((t.y-e.y)/2),r=Math.abs((t.z-e.z)/2),o=new i.Vector3(e.x+s,e.y+n,e.z+r),a=o.distanceTo(e);return new i.Sphere(o,a)}getMesh(){const t=new i.Box3(this._absoluteMin,this._absoluteMax),s=e.getDimensions(t),{width:n,height:r,depth:o,center:a}=s,c=new i.BoxGeometry(n,r,o),l=new i.Mesh(c);return this._meshes.push(l),l.position.copy(a),l}reset(){this._absoluteMin=e.newBound(!0),this._absoluteMax=e.newBound(!1)}add(e){for(const t of e.items)this.addMesh(t.mesh)}addMesh(t,s){if(!t.geometry.index)return;const n=e.getFragmentBounds(t);t.updateMatrixWorld();const r=t.matrixWorld,o=new i.Matrix4,a=t instanceof i.InstancedMesh,c=new Set;if(t instanceof M.FragmentMesh){s||(s=t.fragment.ids);for(const e of s){const i=t.fragment.getInstancesIDs(e);if(i)for(const e of i)c.add(e)}}else c.add(0);for(const e of c){const i=n.min.clone(),s=n.max.clone();a&&(t.getMatrixAt(e,o),i.applyMatrix4(o),s.applyMatrix4(o)),i.applyMatrix4(r),s.applyMatrix4(r),i.x<this._absoluteMin.x&&(this._absoluteMin.x=i.x),i.y<this._absoluteMin.y&&(this._absoluteMin.y=i.y),i.z<this._absoluteMin.z&&(this._absoluteMin.z=i.z),i.x>this._absoluteMax.x&&(this._absoluteMax.x=i.x),i.y>this._absoluteMax.y&&(this._absoluteMax.y=i.y),i.z>this._absoluteMax.z&&(this._absoluteMax.z=i.z),s.x>this._absoluteMax.x&&(this._absoluteMax.x=s.x),s.y>this._absoluteMax.y&&(this._absoluteMax.y=s.y),s.z>this._absoluteMax.z&&(this._absoluteMax.z=s.z),s.x<this._absoluteMin.x&&(this._absoluteMin.x=s.x),s.y<this._absoluteMin.y&&(this._absoluteMin.y=s.y),s.z<this._absoluteMin.z&&(this._absoluteMin.z=s.z)}}addFragmentIdMap(e){const t=this.components.get(_r);for(const i in e){const s=t.list.get(i);if(!s)continue;const n=e[i];this.addMesh(s.mesh,n)}}static getFragmentBounds(e){const t=e.geometry.attributes.position,s=Number.MAX_VALUE,n=-s,r=new i.Vector3(s,s,s),o=new i.Vector3(n,n,n);if(!e.geometry.index)throw new Error("Geometry must be indexed!");const a=Array.from(e.geometry.index.array);for(let e=0;e<a.length;e++){if(e%3==0&&0===a[e]&&0===a[e+1]&&0===a[e+2]){e+=2;continue}const i=a[e],s=t.getX(i),n=t.getY(i),c=t.getZ(i);s<r.x&&(r.x=s),n<r.y&&(r.y=n),c<r.z&&(r.z=c),s>o.x&&(o.x=s),n>o.y&&(o.y=n),c>o.z&&(o.z=c)}return new i.Box3(r,o)}};t(ca,"uuid","d1444724-dba6-4cdd-a0c7-68ee1450d166");let la=ca;const ha=class e{constructor(e){t(this,"onProgress",new ai),t(this,"inclusive",!1),t(this,"rules",[]),t(this,"ids",{}),t(this,"needsUpdate",new Map),t(this,"components"),this.components=e}static import(t,i){const s=e.importers.get(i.type);return s?s(t,i):(console.warn("Invalid query data:.",i),null)}static importRules(e){const t=[];for(const i of e){const e={};for(const t in i){const s=i[t];s.regexp?e[t]=new RegExp(s.value):e[t]=s}t.push(e)}return t}static importIds(e){const t={};for(const i in e.ids)t[i]=new Set(e.ids[i]);return t}clear(e){if(void 0===e)return this.ids={},void this.needsUpdate.clear();delete this.ids[e],this.needsUpdate.delete(e)}addID(e,t){this.ids[e]||(this.ids[e]=new Set),this.ids[e].add(t)}getData(){const e={};for(const t in this.ids)e[t]=Array.from(this.ids[t]);const t=this.exportRules();return{name:this.name,inclusive:this.inclusive,type:"IfcFinderQuery",ids:e,rules:t}}exportRules(){const e=[];for(const t of this.rules){const i={};for(const e in t){const s=t[e];s instanceof RegExp?i[e]={regexp:!0,value:s.source}:i[e]=s}e.push(i)}return e}findInFile(e,t){return new Promise((i=>{const s=new FileReader,n=new TextDecoder("utf-8"),r=1024e4;let o=0;const a=/;/,c=()=>{if(o>=t.size)return void i();const e=Math.min(o+r+1e3,t.size),n=t.slice(o,e);s.readAsArrayBuffer(n)};s.onload=()=>{if(!(s.result instanceof ArrayBuffer))return;const i=new Uint8Array(s.result),l=n.decode(i).split(a);l.shift(),this.findInLines(e,l),this.onProgress.trigger(o/t.size),o+=r,c()},c()}))}getIdFromLine(e){const t=e.slice(e.indexOf("#")+1,e.indexOf("="));return parseInt(t,10)}testRules(e){let t=null,i=null,s=null,n=!1;for(const r of this.rules)if("category"!==r.type){if(null===i&&(i=this.getAttributesFromLine(e),null===i)){if(this.inclusive)continue;n=!1;break}if(null===t&&(t=this.getCategoryFromLine(e),null===t)){if(this.inclusive)continue;n=!1;break}if(null===s&&(s=Object.keys(new b.IFC4[t]),s=s.slice(2),null===s)){if(this.inclusive)continue;n=!1;break}if("property"===r.type){const{name:t,value:o}=r;if(!o.test(e)){if(this.inclusive)continue;n=!1;break}let a=!1;for(let e=0;e<i.length;e++){const n=i[e],r=s[e];if(o.test(n)&&t.test(r)){a=!0;break}}if(a)n=!0;else if(!this.inclusive){n=!1;break}}if("operator"===r.type){const{name:e,value:t,operator:o}=r;let a=!1;for(let n=0;n<i.length;n++){const r=s[n],c=i[n].replace(/IFCLENGTHMEASURE\(|IFCVOLUMEMEASURE\(|\)/g,"");if(e.test(r)){if("="===o&&parseFloat(c)===t){a=!0;break}if("<"===o&&parseFloat(c)<t){a=!0;break}if(">"===o&&parseFloat(c)>t){a=!0;break}if(">="===o&&parseFloat(c)>=t){a=!0;break}if("<="===o&&parseFloat(c)<=t){a=!0;break}}}if(a)n=!0;else if(!this.inclusive){n=!1;break}}}else{if(null===t&&(t=this.getCategoryFromLine(e),null===t)){if(this.inclusive)continue;break}if(!r.value.test(t)){if(this.inclusive)continue;n=!1;break}n=!0}return n}getCategoryFromLine(e){const t=e.indexOf("=")+1,i=e.indexOf("("),s=e.slice(t,i).trim(),n=hr[s];return n||null}getAttributesFromLine(e){const t=e.match(/\((.*)\)/);if(!t||!t[1])return null;return t[1].split(/,(?![^()]*\))/g).map((e=>e.trim()))}};t(ha,"importers",new Map);let Ia=ha;class ua{constructor(e){t(this,"list",new Map),t(this,"id",i.MathUtils.generateUUID()),t(this,"mode","intersect"),t(this,"_components"),this._components=e}get queries(){return new Set(this.list.values())}get items(){const e=[];for(const t of this.queries)e.push(t.items);return"combine"===this.mode?M.FragmentUtils.combine(e):M.FragmentUtils.intersect(e)}add(e){if(this.list.has(e.name))throw new Error(`This group already has a query with the name ${e.name}.`);this.list.set(e.name,e)}clear(e){for(const t of this.queries)t.clear(e)}import(e){this.mode=e.mode,this.id=e.id;for(const t in e.queries){const i=Ia.import(this._components,e.queries[t]);i&&this.list.set(t,i)}}export(){const e={};for(const[t,i]of this.list)e[t]=i.export();return{mode:this.mode,id:this.id,queries:e}}async update(e,t){for(const i of this.queries){const s=i.needsUpdate.get(e);(void 0===s||s)&&await i.update(e,t)}}}const da=class e extends Ia{constructor(e,i){super(e),t(this,"name"),this.name=i.name,this.rules=i.rules,this.inclusive=i.inclusive}get items(){const e=this.components.get(_r),t=[];for(const i in this.ids){const s=this.ids[i],n=e.groups.get(i);if(!n){console.warn(`Model ${i} not found!`);continue}const r=n.getFragmentMap(s);t.push(r)}return M.FragmentUtils.combine(t)}export(){const t=this.getData();return t.type=e.type,t}async update(e,t){this.ids[e]=new Set,await this.findInFile(e,t),this.needsUpdate.set(e,!1)}findInLines(e,t){for(const i of t){if(this.testRules(i)){const t=this.getIdFromLine(i);this.addID(e,t)}}}};t(da,"type","IfcBasicQuery");let Ea=da;Ia.importers.set(Ea.type,((e,t)=>{const i=new Ea(e,{name:t.name,rules:Ia.importRules(t.rules),inclusive:t.inclusive});return i.ids=Ia.importIds(t),i}));const fa=class e extends Ia{constructor(e,i){super(e),t(this,"name"),t(this,"psets",[]),this.name=i.name,this.rules=i.rules,this.inclusive=i.inclusive}get items(){const e=this.components.get(yr),t=this.components.get(_r),i=[];for(const s in this.ids){const n=t.groups.get(s);if(!n){console.log(`Model not found: ${s}.`);continue}const r=this.ids[s];for(const t of r){const r=e.getEntityRelations(s,t,"DefinesOcurrence");if(r){const e=n.getFragmentMap(r);i.push(e)}}}return M.FragmentUtils.combine(i)}export(){const t=this.getData();return t.type=e.type,t}async update(e,t){await this.findInFile(e,t);const i=new Set;for(const t of this.psets){const s=this.getAttributesFromLine(t);if(null===s)continue;const n=s[4].replace("(","[").replace(")","]").replace(/#/g,""),r=JSON.parse(n);for(const s of r){const n=this.ids[e];if(n&&n.has(s)){const e=this.getIdFromLine(t);i.add(e);break}}}this.ids[e]=i,this.psets=[],this.needsUpdate.set(e,!1)}findInLines(e,t){for(const i of t){const t=this.getCategoryFromLine(i);if("IfcPropertySet"===t){this.psets.push(i);continue}if("IfcPropertySingleValue"!==t)continue;if(this.testRules(i)){const t=this.getIdFromLine(i);this.addID(e,t)}}}};t(fa,"type","IfcPropertyQuery");let pa=fa;Ia.importers.set(pa.type,((e,t)=>{const i=new pa(e,{name:t.name,inclusive:t.inclusive,rules:Ia.importRules(t.rules)});return i.ids=Ia.importIds(t),i}));const Ca=class e extends hi{constructor(i){super(i),t(this,"enabled",!0),t(this,"list",new Map),i.add(e.uuid,this)}get queries(){const e=new Set;for(const[,t]of this.list)for(const i of t.queries)e.add(i);return e}import(e){for(const t in e){const i=new ua(this.components);i.import(e[t]),this.list.set(t,i)}}export(){const e={};for(const[t,i]of this.list)e[t]=i.export();return e}create(){const e=new ua(this.components);return this.list.set(e.id,e),e}delete(e){this.list.delete(e)}clear(){this.list.clear()}};t(Ca,"uuid","0da7ad77-f734-42ca-942f-a074adfd1e3a");let Ta=Ca;const ma=class e extends hi{constructor(i){super(i),t(this,"enabled",!0),t(this,"list",{}),t(this,"onDisposed",new ai),t(this,"onFragmentsDisposed",(e=>{const{groupID:t,fragmentIDs:i}=e;for(const e in this.list){const s=this.list[e],n=Object.keys(s);if(n.includes(t))delete s[t],0===Object.values(s).length&&delete this.list[e];else for(const e of n){const t=s[e];for(const e of i)delete t.map[e];0===Object.values(t).length&&delete s[e]}}})),i.add(e.uuid,this);i.get(_r).onFragmentsDisposed.add(this.onFragmentsDisposed)}dispose(){this.list={};this.components.get(_r).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(),this.onDisposed.reset()}remove(e){for(const t in this.list){const i=this.list[t];for(const t in i){delete i[t].map[e]}}}find(e){const t=this.components.get(_r);if(!e){const e={};for(const[i,s]of t.list)e[i]=new Set(s.ids);return e}const i=Object.keys(e).length,s={};for(const t in e){const i=e[t];if(this.list[t])for(const e of i){const i=this.list[t][e];if(i)for(const e in i.map){s[e]||(s[e]=new Map);for(const t of i.map[e]){const i=s[e].get(t);void 0===i?s[e].set(t,1):s[e].set(t,i+1)}}}else console.warn(`Classification ${t} does not exist.`)}const n={};for(const e in s){const t=s[e];for(const[s,r]of t){if(void 0===r)throw new Error("Malformed fragments map!");r===i&&(n[e]||(n[e]=new Set),n[e].add(s))}}return n}byModel(e,t){this.list.models||(this.list.models={});const i=this.list.models;i[e]||(i[e]={map:{},id:null,name:e});const s=i[e];for(const[e,i]of t.data){const n=i[0];for(const i of n){const n=t.keyFragments.get(i);n&&(s.map[n]||(s.map[n]=new Set),s.map[n].add(e))}}}async byPredefinedType(e){var t;this.list.predefinedTypes||(this.list.predefinedTypes={});const i=this.list.predefinedTypes,s=e.getAllPropertiesIDs();for(const n of s){const s=await e.getProperties(n);if(!s)continue;const r=String(null==(t=s.PredefinedType)?void 0:t.value).toUpperCase();i[r]||(i[r]={map:{},id:null,name:r});const o=i[r];for(const[t,i]of e.data){const t=i[0];for(const i of t){const t=e.keyFragments.get(i);if(!t)throw new Error("Fragment ID not found!");o.map[t]||(o.map[t]=new Set);o.map[t].add(s.expressID)}}}}byEntity(e){this.list.entities||(this.list.entities={});for(const[t,i]of e.data){const s=i[1][1],n=cr[s];this.saveItem(e,"entities",n,t)}}async byIfcRel(e,t,i){lr.isRel(t)&&await lr.getRelationMap(e,t,(async(t,s)=>{const{name:n}=await lr.getEntityName(e,t);for(const t of s)this.saveItem(e,i,n??"NO REL NAME",t)}))}async bySpatialStructure(e,t={}){var i,s;const n=this.components.get(yr),r=n.relationMaps[e.uuid];if(!r)throw new Error(`Classifier: model relations of ${e.name||e.uuid} have to exists to group by spatial structure.`);const o="spatialStructures",a=void 0===t.useProperties||t.useProperties;for(const[c]of r){if(t.isolate){const i=e.data.get(c);if(!i)continue;const s=i[1][1];if(void 0===s||!t.isolate.has(s))continue}const r=n.getEntityRelations(e,c,"Decomposes");if(r)for(const t of r){let s=t.toString();if(a){const n=await e.getProperties(t);if(!n)continue;s=null==(i=n.Name)?void 0:i.value}this.saveItem(e,o,s,c,t)}const l=n.getEntityRelations(e,c,"ContainsElements");if(!l)continue;let h=c.toString();if(a){const t=await e.getProperties(c);if(!t)continue;h=null==(s=t.Name)?void 0:s.value}for(const t of l){this.saveItem(e,o,h,t,c);const i=n.getEntityRelations(e,Number(t),"IsDecomposedBy");if(i)for(const t of i)this.saveItem(e,o,h,t,c)}}}setColor(e,t,i=!1){const s=this.components.get(_r);for(const n in e){const r=s.list.get(n);if(!r)continue;const o=e[n];r.setColor(t,o,i)}}resetColor(e){const t=this.components.get(_r);for(const i in e){const s=t.list.get(i);if(!s)continue;const n=e[i];s.resetColor(n)}}export(){const e={};for(const t in this.list){e[t]={};const i=this.list[t];for(const s in i){const n=i[s];e[t][s]={map:M.FragmentUtils.export(n.map),name:n.name,id:n.id}}}return JSON.stringify(e)}import(e){const t=JSON.parse(e);for(const e in t){this.list[e]||(this.list[e]={});const i=t[e];for(const t in i){const s=i[t];this.list[e][t]={map:M.FragmentUtils.import(s.map),name:s.name,id:s.id}}}}saveItem(e,t,i,s,n=null){this.list[t]||(this.list[t]={});const r=e.data.get(s);if(r)for(const o of r[0]){const r=e.keyFragments.get(o);if(r){const e=this.list[t];e[i]||(e[i]={map:{},id:n,name:i}),e[i].map[r]||(e[i].map[r]=new Set),e[i].map[r].add(s)}}}};t(ma,"uuid","e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");let Ra=ma;const ga=class e extends hi{constructor(i){super(i),t(this,"onDisposed",new ai),t(this,"enabled",!0),t(this,"height",10),t(this,"groupName","spatialStructures"),t(this,"list",new Set),i.add(e.uuid,this)}dispose(){this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}set(e){if(!this.enabled)return;const t=this.components.get(Ra),s=this.components.get(_r),n=e?1:-1;let r=0;const o=t.list[this.groupName],a=new i.Matrix4;for(const t in o){a.elements[13]=r*n*this.height;for(const i in o[t].map){const n=s.list.get(i),r=t+i,c=this.list.has(r);if(!n||e&&c||!e&&!c)continue;e?this.list.add(r):this.list.delete(r);const l=o[t].map[i];n.applyTransform(l,a),n.mesh.computeBoundingSphere(),n.mesh.computeBoundingBox()}r++}}};t(ga,"uuid","d260618b-ce88-4c7d-826c-6debb91de3e2");let Aa=ga;const Fa=class e extends hi{constructor(i){super(i),t(this,"enabled",!0),this.components.add(e.uuid,this)}set(e,t){const i=this.components.get(_r);if(t)for(const s in t){const n=t[s],r=i.list.get(s);r&&(r.setVisibility(e,n),this.updateCulledVisibility(r))}else for(const[t,s]of i.list)s&&(s.setVisibility(e),this.updateCulledVisibility(s))}isolate(e){this.set(!1),this.set(!0,e)}updateCulledVisibility(e){const t=this.components.get(an);for(const[i,s]of t.list){const t=s.colorMeshes.get(e.id);t&&(t.count=e.mesh.count)}}};t(Fa,"uuid","dd9ccf2d-8a21-4821-b7f6-2949add16a29");let Sa=Fa;class Oa extends dr{constructor(){super(...arguments),t(this,"minGeometrySize",10),t(this,"minAssetsSize",1e3),t(this,"maxTriangles",null)}}const Na=class e extends hi{constructor(i){super(i),t(this,"onGeometryStreamed",new ci),t(this,"onAssetStreamed",new ci),t(this,"onProgress",new ci),t(this,"onIfcLoaded",new ci),t(this,"onDisposed",new ai),t(this,"settings",new Oa),t(this,"enabled",!0),t(this,"webIfc",new b.IfcAPI),t(this,"_nextAvailableID",0),t(this,"_splittedGeometries",new Map),t(this,"_spatialTree",new ur),t(this,"_metaData",new fr),t(this,"_visitedGeometries",new Map),t(this,"_streamSerializer",new M.StreamSerializer),t(this,"_geometries",new Map),t(this,"_geometryCount",0),t(this,"_civil",new Er),t(this,"_groupSerializer",new M.Serializer),t(this,"_assets",[]),t(this,"_meshesWithHoles",new Set),this.components.add(e.uuid,this),this.settings.excludedCategories.add(b.IFCOPENINGELEMENT)}dispose(){this.onIfcLoaded.reset(),this.onGeometryStreamed.reset(),this.onAssetStreamed.reset(),this.webIfc=null,this.onDisposed.trigger(),this.onDisposed.reset()}async streamFromBuffer(e){await this.readIfcFile(e),await this.streamAllGeometries(),this.cleanUp()}async streamFromCallBack(e){await this.streamIfcFile(e),await this.streamAllGeometries(),this.cleanUp()}async readIfcFile(e){const{path:t,absolute:i,logLevel:s}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),s&&this.webIfc.SetLogLevel(s),this.webIfc.OpenModel(e,this.settings.webIfc),this._nextAvailableID=this.webIfc.GetMaxExpressID(0)}async streamIfcFile(e){const{path:t,absolute:i,logLevel:s}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),s&&this.webIfc.SetLogLevel(s),this.webIfc.OpenModelFromCallback(e,this.settings.webIfc),this._nextAvailableID=this.webIfc.GetMaxExpressID(0)}async streamAllGeometries(){console.log("Converting geometries to tiles...");const{minGeometrySize:e,minAssetsSize:t}=this.settings;this._spatialTree.setUp(this.webIfc);const i=this.webIfc.GetIfcEntityList(0),s=[[]],n=new M.FragmentsGroup;n.ifcMetadata={name:"",description:"",...this._metaData.getNameInfo(this.webIfc),...this._metaData.getDescriptionInfo(this.webIfc),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};let r=0,o=0;for(const t of i){if(!this.webIfc.IsIfcElement(t)&&t!==b.IFCSPACE)continue;if(this.settings.excludedCategories.has(t))continue;const i=this.webIfc.GetLineIDsWithType(0,t),a=i.size();for(let c=0;c<a;c++){r>e&&(r=0,o++,s.push([]));const a=i.get(c);s[o].push(a);const l=this.webIfc.GetLine(0,a);if(l.GlobalId){const e=(null==l?void 0:l.GlobalId.value)||(null==l?void 0:l.GlobalId);n.globalToExpressIDs.set(e,a)}const h=this._spatialTree.itemsByFloor[a]||0;n.data.set(a,[[],[h,t]]),r++}}this._spatialTree.cleanUp();let a=.01,c=0;for(const e of s){c++,this.webIfc.StreamMeshes(0,e,(e=>{this.getMesh(this.webIfc,e,n)})),this._geometryCount>this.settings.minGeometrySize&&await this.streamGeometries(),this._assets.length>t&&await this.streamAssets();const i=c/s.length;i>a&&(a+=.01,a=Math.max(a,i),await this.onProgress.trigger(Math.round(100*a)/100))}this._geometryCount&&await this.streamGeometries(),this._assets.length&&await this.streamAssets();const{opaque:l,transparent:h}=n.geometryIDs;for(const[e,{index:t,uuid:i}]of this._visitedGeometries){n.keyFragments.set(t,i);(e>1?l:h).set(e,t)}pr.get(n,this.webIfc);const I=this.webIfc.GetCoordinationMatrix(0);n.coordinationMatrix.fromArray(I),n.civilData=this._civil.read(this.webIfc);const u=this._groupSerializer.export(n);await this.onIfcLoaded.trigger(u),n.dispose(!0)}cleanUp(){try{this.webIfc.Dispose()}catch(e){}this.webIfc=null,this.webIfc=new b.IfcAPI,this._visitedGeometries.clear(),this._geometries.clear(),this._assets=[],this._meshesWithHoles.clear()}getMesh(e,t,i){const s=t.geometries.size(),n=t.expressID,r={id:n,geometries:[]};for(let o=0;o<s;o++){const s=t.geometries.get(o),a=s.geometryExpressID,c=1===s.color.w,l=a*(c?1:-1);this._visitedGeometries.has(l)||this.getGeometry(e,a,c),this.registerGeometryData(i,n,s,r,a,l);const h=this._splittedGeometries.get(a);if(h)for(const e of h)this.registerGeometryData(i,n,s,r,e,e)}this._assets.push(r)}getGeometry(e,t,s){const n=e.GetGeometry(0,t),r=e.GetIndexArray(n.GetIndexData(),n.GetIndexDataSize()),o=e.GetVertexArray(n.GetVertexData(),n.GetVertexDataSize()),a=new Float32Array(o.length/2),c=new Float32Array(o.length/2);for(let e=0;e<o.length;e+=6)a[e/2]=o[e],a[e/2+1]=o[e+1],a[e/2+2]=o[e+2],c[e/2]=o[e+3],c[e/2+1]=o[e+4],c[e/2+2]=o[e+5];const l=s?1:-1;if(0===r.length){const e=new Float32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]);this._geometries.set(t,{position:a,normal:c,index:r,boundingBox:e,hasHoles:!1});const s=this._visitedGeometries.size,o=i.MathUtils.generateUUID(),h=t*l;return this._visitedGeometries.set(h,{uuid:o,index:s}),this._geometryCount++,void n.delete()}const h=3*(this.settings.maxTriangles||r.length/3);let I=!0;for(let e=0;e<r.length;e+=h){const s=r.length-e,n=e+Math.min(s,h),o=[],u=[],d=[];let E=0;for(let t=e;t<n;t++){o.push(E++);const e=r[t];u.push(a[3*e]),u.push(a[3*e+1]),u.push(a[3*e+2]),d.push(c[3*e]),d.push(c[3*e+1]),d.push(c[3*e+2])}const f=new Uint32Array(o),p=new Float32Array(u),C=new Float32Array(d),T=xi(p),m=new Float32Array(T.transformation.elements),R=!1,g=I?t:this._nextAvailableID++;if(this._geometries.set(g,{position:p,normal:C,index:f,boundingBox:m,hasHoles:R}),!I){this._splittedGeometries.has(t)||this._splittedGeometries.set(t,new Set);this._splittedGeometries.get(t).add(g)}const A=this._visitedGeometries.size,F=i.MathUtils.generateUUID(),S=g*l;this._visitedGeometries.set(S,{uuid:F,index:A}),this._geometryCount++,I=!1}n.delete()}async streamAssets(){await this.onAssetStreamed.trigger(this._assets),this._assets=null,this._assets=[]}async streamGeometries(){let e=this._streamSerializer.export(this._geometries),t={};for(const[e,{boundingBox:i,hasHoles:s}]of this._geometries)t[e]={boundingBox:i,hasHoles:s};await this.onGeometryStreamed.trigger({data:t,buffer:e}),t=null,e=null,this._geometries.clear(),this._geometryCount=0}registerGeometryData(e,t,i,s,n,r){const o=this._visitedGeometries.get(r);if(void 0===o)throw new Error("Error getting geometry data for streaming!");const a=e.data.get(t);if(!a)throw new Error("Data not found!");a[0].push(o.index);const{x:c,y:l,z:h,w:I}=i.color,u=[c,l,h,I],d=i.flatTransformation;s.geometries.push({color:u,geometryID:n,transformation:d})}};t(Na,"uuid","d9999a00-e1f5-4d3f-8cfe-c56e08609764");let ya=Na;class La extends dr{constructor(){super(...arguments),t(this,"propertiesSize",100)}}class _a extends hi{constructor(){super(...arguments),t(this,"onPropertiesStreamed",new ci),t(this,"onProgress",new ci),t(this,"onIndicesStreamed",new ci),t(this,"onDisposed",new ai),t(this,"enabled",!0),t(this,"settings",new La),t(this,"webIfc",new b.IfcAPI)}async dispose(){this.onIndicesStreamed.reset(),this.onPropertiesStreamed.reset(),this.webIfc=null,this.onDisposed.reset()}async streamFromBuffer(e){await this.readIfcFile(e),await this.streamAllProperties(),this.cleanUp()}async streamFromCallBack(e){await this.streamIfcFile(e),await this.streamAllProperties(),this.cleanUp()}async readIfcFile(e){const{path:t,absolute:i,logLevel:s}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),s&&this.webIfc.SetLogLevel(s),this.webIfc.OpenModel(e,this.settings.webIfc)}async streamIfcFile(e){const{path:t,absolute:i,logLevel:s}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),s&&this.webIfc.SetLogLevel(s),this.webIfc.OpenModelFromCallback(e,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:e}=this.settings,t=new Set(this.webIfc.GetIfcEntityList(0)),i=new Set([b.IFCPROJECT,b.IFCSITE,b.IFCBUILDING,b.IFCBUILDINGSTOREY,b.IFCSPACE]);for(const e of i)t.add(e);let s=.01,n=0;for(const r of t){if(n++,Cr.has(r))continue;const o=i.has(r),a=this.webIfc.GetLineIDsWithType(0,r),c=a.size();let l=0;for(let t=0;t<c-e;t+=e){const i={};for(let s=0;s<e;s++){l++;const e=a.get(t+s);try{const t=this.webIfc.GetLine(0,e,o);i[t.expressID]=t}catch(t){console.log(`Could not get property: ${e}`)}}await this.onPropertiesStreamed.trigger({type:r,data:i})}if(l!==c){const e={};for(let t=l;t<c;t++){const i=a.get(t);try{const t=this.webIfc.GetLine(0,i,o);e[t.expressID]=t}catch(e){console.log(`Could not get property: ${i}`)}}await this.onPropertiesStreamed.trigger({type:r,data:e})}n/t.size>s&&(s=Math.round(100*s)/100,await this.onProgress.trigger(s),s+=.01)}await this.onProgress.trigger(1);const r=this.components.get(yr),o=await r.processFromWebIfc(this.webIfc,0);await this.onIndicesStreamed.trigger(o)}cleanUp(){this.webIfc.Dispose(),this.webIfc=null,this.webIfc=new b.IfcAPI}}t(_a,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");class Pa{constructor(e,i,s){t(this,"title"),t(this,"guid",Gi.create()),t(this,"clippingPlanes",new Ci),t(this,"camera",{aspectRatio:1,fov:60,direction:{x:0,y:0,z:0},position:{x:0,y:0,z:0}}),t(this,"exceptionComponents",new Ci),t(this,"selectionComponents",new Ci),t(this,"componentColors",new Ti),t(this,"spacesVisible",!1),t(this,"spaceBoundariesVisible",!1),t(this,"openingsVisible",!1),t(this,"defaultVisibility",!0),t(this,"_components"),t(this,"world");const n={setCamera:!0,...s},{data:r,setCamera:o}=n;this._components=e,this.world=i,r&&(this.guid=r.guid??this.guid,this.set(r)),o&&this.updateCamera()}get _selectionModelIdMap(){const e=this._components.get(_r),t={};for(const[i,s]of e.groups){i in t||(t[i]=new Set);for(const e of this.selectionComponents){const n=s.globalToExpressIDs.get(e);n&&t[i].add(n)}}return t}get _exceptionModelIdMap(){const e=this._components.get(_r),t={};for(const[i,s]of e.groups){i in t||(t[i]=new Set);for(const e of this.exceptionComponents){const n=s.globalToExpressIDs.get(e);n&&t[i].add(n)}}return t}get selection(){return this._components.get(_r).modelIdToFragmentIdMap(this._selectionModelIdMap)}get exception(){return this._components.get(_r).modelIdToFragmentIdMap(this._exceptionModelIdMap)}get projection(){return"fov"in this.camera?"Perspective":"Orthographic"}get position(){const e=this._components.get(_r),{position:t}=this.camera,{x:s,y:n,z:r}=t,o=new i.Vector3(s,n,r);return e.applyBaseCoordinateSystem(o,new i.Matrix4),o}get direction(){const{direction:e}=this.camera,{x:t,y:s,z:n}=e;return new i.Vector3(t,s,n)}get _managerVersion(){return this._components.get(aa).config.version}get topics(){return[...this._components.get(aa).list.values()].filter((e=>e.viewpoints.has(this.guid)))}addComponentsFromMap(e){const t=this._components.get(_r).fragmentIdMapToGuids(e);this.selectionComponents.add(...t);this._components.get(va).list.set(this.guid,this)}set(e){const t=e,i=this;for(const s in e){if("guid"===s)continue;const e=t[s];"selectionComponents"!==s?"exceptionComponents"!==s?s in this&&(i[s]=e):(this.exceptionComponents.clear(),this.exceptionComponents.add(...e)):(this.selectionComponents.clear(),this.selectionComponents.add(...e))}return this._components.get(va).list.set(this.guid,this),this}async go(e=!0){const{camera:t}=this.world;if(!t.hasCameraControls())throw new Error("Viewpoint: the world's camera need controls to set the viewpoint.");t instanceof nr&&t.projection.set(this.projection);const s=new i.Vector3(this.camera.position.x,this.camera.position.y,this.camera.position.z),n=new i.Vector3(this.camera.direction.x,this.camera.direction.y,this.camera.direction.z);if(s.equals(new i.Vector3)&&n.equals(new i.Vector3))return;const r=this.position,o=this.direction;let a={x:r.x+80*o.x,y:r.y+80*o.y,z:r.z+80*o.z};const c=this.selection;if(0===Object.keys(c).length){const e=this._components.get(dn).get(this.world).castRayFromVector(r,this.direction);e&&(a=e.point)}else{const e=this._components.get(la);e.reset(),e.addFragmentIdMap(c),a=e.getSphere().center,e.reset()}await t.controls.setLookAt(r.x,r.y,r.z,a.x,a.y,a.z,e)}updateCamera(){const{camera:e,renderer:t}=this.world;if(!t)throw new Error("Viewpoint: the world needs to have a renderer!");if(!e.hasCameraControls())throw new Error("Viewpoint: world's camera need camera controls!");const s=new i.Vector3;e.controls.getPosition(s);const n=e.three,r=new i.Vector3(0,0,-1).applyEuler(n.rotation),{width:o,height:a}=t.getSize();let c=o/a;Number.isNaN(c)&&(c=1);const l=this._components.get(_r);s.applyMatrix4(l.baseCoordinationMatrix.clone().invert());const h={aspectRatio:c,position:{x:s.x,y:s.y,z:s.z},direction:{x:r.x,y:r.y,z:r.z}};n instanceof i.PerspectiveCamera?this.camera={...h,fov:n.fov}:n instanceof i.OrthographicCamera&&(this.camera={...h,viewToWorldScale:n.top-n.bottom});this._components.get(va).list.set(this.guid,this)}applyVisibility(){const e=this._components.get(Sa);e.set(this.defaultVisibility),e.set(!this.defaultVisibility,this.exception),e.set(!0,this.selection)}applyColors(){const e=this._components.get(va),t=this._components.get(_r),i=this._components.get(Ra);for(const[s,n]of this.componentColors){const r=t.guidToFragmentIdMap(n);i.setColor(r,s,e.config.overwriteColors)}}resetColors(){const e=this._components.get(_r),t=this._components.get(Ra);for(const[i,s]of this.componentColors){const i=e.guidToFragmentIdMap(s);t.resetColor(i)}}async createComponentTags(e){var t,i;const s=this._components.get(_r);let n="";if(this._components.get(aa).config.includeSelectionTag){const r="selection"===e?this._selectionModelIdMap:this._exceptionModelIdMap;for(const e in r){const o=s.groups.get(e);if(!o)continue;const a=r[e];for(const e of a){const s=await o.getProperties(e);if(!s)continue;const r=null==(t=s.GlobalId)?void 0:t.value;if(!r)continue;const a=null==(i=s.Tag)?void 0:i.value;let c=null;a&&(c=`AuthoringToolId="${a}"`),n+=`\n<Component IfcGuid="${r}" ${c??""} />`}}}else n=[...this.selectionComponents].map((e=>`<Component IfcGuid="${e}" />`)).join("\n");return n}createColorTags(){let e="";for(const[t,i]of this.componentColors.entries()){e+=`<Color Color="${`#${t.getHexString()}`}">\n${i.map((e=>`\n<Component IfcGuid="${e}" />`)).join("\n")}\n</Color>`}return 0!==e.length?`<Coloring>\n${e}\n</Coloring>`:"<Coloring />"}async serialize(e=this._managerVersion){const t=this._components.get(_r),s=this.position;s.applyMatrix4(t.baseCoordinationMatrix.clone().invert());const n=this.direction;n.normalize();const r=(new i.Matrix4).makeRotationX(Math.PI/2),o=n.clone().applyMatrix4(r);o.normalize();const a=`<CameraViewPoint>\n <X>${s.x}</X>\n <Y>${-s.z}</Y>\n <Z>${s.y}</Z>\n </CameraViewPoint>`,c=`<CameraDirection>\n <X>${n.x}</X>\n <Y>${-n.z}</Y>\n <Z>${n.y}</Z>\n </CameraDirection>`,l=`<CameraUpVector>\n <X>${o.x}</X>\n <Y>${-o.z}</Y>\n <Z>${o.y}</Z>\n </CameraUpVector>`,h=`<AspectRatio>${this.camera.aspectRatio}</AspectRatio>`;let I="";"viewToWorld"in this.camera?I=`<OrthogonalCamera>\n ${a}\n ${c}\n ${l}\n ${h}\n <ViewToWorldScale>${this.camera.viewToWorld}</ViewToWorldScale>\n </OrthogonalCamera>`:"fov"in this.camera&&(I=`<PerspectiveCamera>\n ${a}\n ${c}\n ${l}\n ${h}\n <FieldOfView>${this.camera.fov}</FieldOfView>\n </PerspectiveCamera>`);const u=`<ViewSetupHints SpacesVisible="${this.spacesVisible??!1}" SpaceBoundariesVisible="${this.spaceBoundariesVisible??!1}" OpeningsVisible="${this.openingsVisible??!1}" />`,d=(await this.createComponentTags("selection")).trim(),E=(await this.createComponentTags("exception")).trim(),f=this.createColorTags();return`<?xml version="1.0" encoding="UTF-8"?>\n <VisualizationInfo Guid="${this.guid}">\n <Components>\n ${"2.1"===e?u:""}\n ${0!==d.length?`<Selection>${d}</Selection>`:""}\n <Visibility DefaultVisibility="${this.defaultVisibility}">\n ${"3"===e?u:""}\n ${0!==E.length?`<Exceptions>${E}</Exceptions>`:""}\n </Visibility>\n ${f}\n </Components>\n ${I}\n </VisualizationInfo>`}}class wa extends Xi{constructor(){super(...arguments),t(this,"_config",{overwriteColors:{value:!1,type:"Boolean"}})}get overwriteColors(){return this._config.overwriteColors.value}set overwriteColors(e){this._config.overwriteColors.value=e}}const Ma=class e extends hi{constructor(i){super(i),t(this,"enabled",!0),t(this,"list",new Ti),t(this,"isSetup",!1),t(this,"onSetup",new ai),t(this,"config",new wa(this,this.components,"Viewpoints",e.uuid)),t(this,"onDisposed",new ai),i.add(e.uuid,this)}create(e,t){const i=new Pa(this.components,e,{data:t});return t||this.list.set(i.guid,i),i}setup(){}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}};t(Ma,"uuid","ee867824-a796-408d-8aa0-4e5962a83c66");let va=Ma;class Da extends Xi{constructor(){super(...arguments),t(this,"_config",{visible:{value:!0,type:"Boolean"},lockRotation:{value:!0,type:"Boolean"},zoom:{type:"Number",interpolable:!0,value:.05,min:.001,max:5},frontOffset:{type:"Number",interpolable:!0,value:0,min:0,max:100},sizeX:{type:"Number",interpolable:!0,value:320,min:20,max:5e3},sizeY:{type:"Number",interpolable:!0,value:160,min:20,max:5e3},backgroundColor:{value:new i.Color,type:"Color"}})}get visible(){return this._config.visible.value}set visible(e){this._config.visible.value=e;this._component.renderer.domElement.style.display=e?"block":"none"}get lockRotation(){return this._config.lockRotation.value}set lockRotation(e){this._config.lockRotation.value=e,this._component.lockRotation=e}get zoom(){return this._config.zoom.value}set zoom(e){this._config.zoom.value=e,this._component.zoom=e}get frontOffset(){return this._config.frontOffset.value}set frontOffset(e){this._config.frontOffset.value=e,this._component.frontOffset=e}get sizeX(){return this._config.sizeX.value}set sizeX(e){this._config.sizeX.value=e;const{sizeX:t,sizeY:s}=this._config,n=new i.Vector2(t.value,s.value);this._component.resize(n)}get sizeY(){return this._config.sizeY.value}set sizeY(e){this._config.sizeY.value=e;const{sizeX:t,sizeY:s}=this._config,n=new i.Vector2(t.value,s.value);this._component.resize(n)}get backgroundColor(){return this._config.backgroundColor.value}set backgroundColor(e){this._config.backgroundColor.value=e,this._component.backgroundColor=e}}class ba{constructor(e,s){if(t(this,"onDisposed",new ai),t(this,"onAfterUpdate",new ai),t(this,"onBeforeUpdate",new ai),t(this,"onResize",new ai),t(this,"onSetup",new ai),t(this,"frontOffset",0),t(this,"overrideMaterial",new i.MeshDepthMaterial),t(this,"backgroundColor",new i.Color(395274)),t(this,"renderer"),t(this,"enabled",!0),t(this,"world"),t(this,"config"),t(this,"isSetup",!1),t(this,"_defaultConfig",{visible:!0,lockRotation:!1,zoom:.05,frontOffset:0,sizeX:320,sizeY:160,backgroundColor:new i.Color(395274)}),t(this,"_lockRotation",!0),t(this,"_size",new i.Vector2(320,160)),t(this,"_camera"),t(this,"_plane"),t(this,"_tempVector1",new i.Vector3),t(this,"_tempVector2",new i.Vector3),t(this,"_tempTarget",new i.Vector3),t(this,"down",new i.Vector3(0,-1,0)),t(this,"updatePlanes",(()=>{if(!this.world.renderer)throw new Error("The given world must have a renderer!");const e=[],t=this.world.renderer.three;for(const i of t.clippingPlanes)e.push(i);e.push(this._plane),this.renderer.clippingPlanes=e})),this.world=e,!this.world.renderer)throw new Error("The given world must have a renderer!");this.renderer=new i.WebGLRenderer,this.renderer.setSize(this._size.x,this._size.y);const n=this._size.x/this._size.y;this._camera=new i.OrthographicCamera(1*n/-2,1*n/2,.5,-.5),this.world.renderer.onClippingPlanesUpdated.add(this.updatePlanes),this._camera.position.set(0,200,0),this._camera.zoom=.1,this._camera.rotation.x=-Math.PI/2,this._plane=new i.Plane(this.down,200),this.updatePlanes(),this.config=new Da(this,s,"MiniMap")}get lockRotation(){return this._lockRotation}set lockRotation(e){this._lockRotation=e,e&&(this._camera.rotation.z=0)}get zoom(){return this._camera.zoom}set zoom(e){this._camera.zoom=e,this._camera.updateProjectionMatrix()}dispose(){this.enabled=!1,this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.onResize.reset(),this.overrideMaterial.dispose(),this.renderer.forceContextLoss(),this.renderer.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(){return this._camera}update(){if(!this.enabled)return;this.onBeforeUpdate.trigger();const e=this.world.scene.three,t=this.world.camera;if(!t.hasCameraControls())throw new Error("The given world must use camera controls!");if(!(e instanceof i.Scene))throw new Error("The given world must have a THREE.Scene as a root!");const s=t.controls;if(s.getPosition(this._tempVector1),this._camera.position.x=this._tempVector1.x,this._camera.position.z=this._tempVector1.z,0!==this.frontOffset&&(s.getTarget(this._tempVector2),this._tempVector2.sub(this._tempVector1),this._tempVector2.normalize().multiplyScalar(this.frontOffset),this._camera.position.x+=this._tempVector2.x,this._camera.position.z+=this._tempVector2.z),!this._lockRotation){s.getTarget(this._tempTarget);const e=Math.atan2(this._tempTarget.x-this._tempVector1.x,this._tempTarget.z-this._tempVector1.z);this._camera.rotation.z=e+Math.PI}this._plane.set(this.down,this._tempVector1.y);const n=e.background;e.background=this.backgroundColor,this.renderer.render(e,this._camera),e.background=n,this.onAfterUpdate.trigger()}getSize(){return this._size}resize(e=this._size){this._size.copy(e),this.renderer.setSize(e.x,e.y);const t=e.x/e.y;this._camera.left=1*t/-2,this._camera.right=1*t/2,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),this.onResize.trigger(e)}setup(e){const t={...this._defaultConfig,...e};this.config.visible=!0,this.config.lockRotation=t.lockRotation,this.config.zoom=t.zoom,this.config.frontOffset=t.frontOffset,this.config.sizeX=t.sizeX,this.config.sizeY=t.sizeY,this.config.backgroundColor=t.backgroundColor,this.isSetup=!0,this.onSetup.trigger()}}const Ua=class e extends hi{constructor(i){super(i),t(this,"onAfterUpdate",new ai),t(this,"onBeforeUpdate",new ai),t(this,"onDisposed",new ai),t(this,"onSetup",new ai),t(this,"enabled",!0),t(this,"list",new Map),this.components.add(e.uuid,this)}create(e){if(this.list.has(e.uuid))throw new Error("This world already has a minimap!");const t=new ba(e,this.components);return this.list.set(e.uuid,t),t}delete(e){const t=this.list.get(e);t&&t.dispose(),this.list.delete(e)}dispose(){for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}update(){for(const[e,t]of this.list)t.update()}};t(Ua,"uuid","39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");let xa=Ua;const Ba=class e extends hi{constructor(i){super(i),t(this,"enabled",!0),i.add(e.uuid,this)}static distanceFromPointToLine(e,t,s,n=!1){const r=new i.Line3,o=new i.Vector3;return r.set(t,s),r.closestPointToPoint(e,n,o),o.distanceTo(e)}getFace(e,t,i){if(!e.geometry.index)throw new Error("Geometry must be indexed!");const s=new Map,n=e.geometry.index.array,{plane:r}=this.getFaceData(t,i,e),o=[];for(let t=0;t<n.length/3;t++){const{plane:n,edges:a}=this.getFaceData(t,i,e);if(n.equals(r)){o.push({index:t,edges:a});for(const{id:e,points:t,distance:i}of a)s.set(e,{points:t,distance:i})}}let a=0;const c=new Map,l=new Map;for(const{index:e,edges:t}of o){const i=new Map;for(const{id:e}of t)if(c.has(e)){const t=c.get(e);i.set(e,t)}const s=t.map((e=>e.id));if(!i.size){const i=a++;for(const{id:e}of t)c.set(e,i);l.set(i,{edges:new Set(s),indices:new Set([e])});continue}let n=null;const r=new Set,o=new Set(s);for(const[e,t]of i){null===n?n=t:t!==n&&r.add(t),c.delete(e);const{edges:i}=l.get(t);i.delete(e),o.delete(e)}if(null===n)throw new Error("Error computing face!");const h=l.get(n),{indices:I}=h;I.add(e);for(const e of o){c.set(e,n);const{edges:t}=h;t.add(e)}for(const e of r){const t=l.get(e),{edges:i,indices:s}=t,r=l.get(n),{edges:o,indices:a}=r;for(const e of i)o.add(e),c.set(e,n);for(const e of s)a.add(e);l.delete(e)}}for(const[e,{indices:i,edges:n}]of l)if(i.has(t)){const e=[];for(const t of n){const i=s.get(t);e.push(i)}return{edges:e,indices:i}}return null}getVerticesAndNormal(e,t,s){if(!e.geometry.index)throw new Error("Geometry must be indexed!");const n=e.geometry.index.array,r=e.geometry.attributes.position.array,o=e.geometry.attributes.normal.array,a=3*n[3*t],c=3*n[3*t+1],l=3*n[3*t+2],h=new i.Vector3(r[a],r[a+1],r[a+2]),I=new i.Vector3(r[c],r[c+1],r[c+2]),u=new i.Vector3(r[l],r[l+1],r[l+2]),d=new i.Vector3(o[a],o[a+1],o[a+2]),E=new i.Vector3(o[c],o[c+1],o[c+2]),f=new i.Vector3(o[l],o[l+1],o[l+2]),p=(d.x+E.x+f.x)/3,C=(d.y+E.y+f.y)/3,T=(d.z+E.z+f.z)/3,m=new i.Vector3(p,C,T);if(void 0!==s&&e instanceof i.InstancedMesh){const t=new i.Matrix4;e.getMatrixAt(s,t);const n=new i.Matrix4;n.extractRotation(t),m.applyMatrix4(n),h.applyMatrix4(t),I.applyMatrix4(t),u.applyMatrix4(t)}return{p1:h,p2:I,p3:u,faceNormal:m}}round(e){const t=1e3;e.x=Math.trunc(e.x*t)/t,e.y=Math.trunc(e.y*t)/t,e.z=Math.trunc(e.z*t)/t}getVolumeFromFragments(e){const t=this.components.get(_r),s=new i.Matrix4,n=[];for(const r in e){const o=t.list.get(r);if(!o)continue;const a=e[r];let c=0;for(const e of a){const t=o.getInstancesIDs(e);t&&(c+=t.size)}const l=new i.InstancedMesh(o.mesh.geometry,void 0,c);let h=0;for(const e of a){const t=o.getInstancesIDs(e);if(t)for(const e of t)o.mesh.getMatrixAt(e,s),l.setMatrixAt(h++,s)}n.push(l)}const r=this.getVolumeFromMeshes(n);for(const e of n)e.geometry=null,e.material=[],e.dispose();return r}getVolumeFromMeshes(e){let t=0;for(const i of e)t+=this.getVolumeOfMesh(i);return t}getFaceData(e,t,s){const n=this.getVerticesAndNormal(s,e,t),{p1:r,p2:o,p3:a,faceNormal:c}=n;this.round(r),this.round(o),this.round(a),this.round(c);const l=[{id:`${r.x}|${r.y}|${r.z}`,value:r},{id:`${o.x}|${o.y}|${o.z}`,value:o},{id:`${a.x}|${a.y}|${a.z}`,value:a}];l.sort(((e,t)=>e.id<t.id?-1:e.id>t.id?1:0));const[{id:h,value:I},{id:u,value:d},{id:E,value:f}]=l,p=[{id:`${h}|${u}`,distance:I.distanceTo(d),points:[I,d]},{id:`${u}|${E}`,distance:d.distanceTo(f),points:[d,f]},{id:`${h}|${E}`,distance:I.distanceTo(f),points:[I,f]}],C=new i.Plane;return C.setFromNormalAndCoplanarPoint(c,r),C.constant=Math.round(10*C.constant)/10,{plane:C,edges:p}}getVolumeOfMesh(e){let t=0;const s=new i.Vector3,n=new i.Vector3,r=new i.Vector3,{index:o}=e.geometry,a=e.geometry.attributes.position.array;if(!o)return console.warn("Geometry must be indexed to compute its volume!"),0;const c=[];if(e instanceof i.InstancedMesh)for(let t=0;t<e.count;t++){const s=new i.Matrix4;e.getMatrixAt(t,s),c.push(s)}else c.push((new i.Matrix4).identity());const{matrixWorld:l}=e;for(let e=0;e<o.array.length-2;e+=3)for(const i of c){const c=i.multiply(l),h=3*o.array[e],I=3*o.array[e+1],u=3*o.array[e+2];s.set(a[h],a[h+1],a[h+2]).applyMatrix4(c),n.set(a[I],a[I+1],a[I+2]).applyMatrix4(c),r.set(a[u],a[u+1],a[u+2]).applyMatrix4(c),t+=this.getSignedVolumeOfTriangle(s,n,r)}return Math.abs(t)}getSignedVolumeOfTriangle(e,t,i){return 1/6*(-(i.x*t.y*e.z)+t.x*i.y*e.z+i.x*e.y*t.z-e.x*i.y*t.z-t.x*e.y*i.z+e.x*t.y*i.z)}};t(Ba,"uuid","267ca032-672f-4cb0-afa9-d24e904f39d6");let Va=Ba;class Ya{constructor(e){t(this,"cardinality","required"),t(this,"instructions"),t(this,"evalRequirement",((e,t,i,s)=>{const n={parameter:i,currentValue:e,requiredValue:t.parameter,pass:!1};s&&this.addCheckResult(n,s);let r=!1;if("simple"===t.type){r=e===t.parameter}if("enumeration"===t.type){r=t.parameter.includes(e)}if("pattern"===t.type){const i=t.parameter;r=new RegExp(i).test(String(e))}if("length"===t.type){const i=t.parameter,{min:s,length:n,max:o}=i;void 0!==n&&(r=String(e).length===n),void 0!==s&&(r=String(e).length>=s),void 0!==o&&(r=String(e).length<=o)}if("bounds"===t.type&&"number"==typeof e){const{min:i,minInclusive:s,max:n,maxInclusive:o}=t.parameter;let a=!0,c=!0;void 0!==i&&(a=s?e<=i:e<i),void 0!==n&&(c=o?e>=n:e>n),r=a&&c}return"prohibited"===this.cardinality&&(r=!r),"optional"===this.cardinality&&(r=!0),n.pass=r,n.pass})),t(this,"testResult",[]),this.components=e}addCheckResult(e,t){const i=t.findIndex((({parameter:t})=>t===e.parameter));-1!==i?t[i]=e:t.push(e)}saveResult(e,t){const{GlobalId:i}=e;if(!i)return;const{value:s}=i,n={expressID:s,pass:t,checks:[],cardinality:this.cardinality};this.testResult.push(n)}}const Ga=(e,t)=>{let i="";if(!t)return i;if("simple"===t.type&&(i=`<ids:simpleValue>${t.parameter}</ids:simpleValue>`),"enumeration"===t.type){i=`<xs:restriction base="xs:string">\n ${t.parameter.map((e=>`<xs:enumeration value="${e}" />`)).join("\r\n")}\n </xs:restriction>`}if("pattern"===t.type){i=`<xs:restriction base="xs:string">\n <xs:pattern value="${t.parameter}" />\n </xs:restriction>`}return`<ids:${e[0].toLowerCase()+e.slice(1)}>\n ${i}\n </ids:${e[0].toLowerCase()+e.slice(1)}>`};class za extends Ya{constructor(e,i){super(e),t(this,"name"),t(this,"value"),this.name=i}serialize(e){const t=Ga("Name",this.name),i=Ga("Value",this.value);let s="";return"requirement"===e&&(s+=`cardinality="${this.cardinality}"`,s+=this.instructions?`instructions="${this.instructions}"`:""),`<ids:attribute ${s}>\n ${t}\n ${i}\n</ids:attribute>`}async getEntities(){return[]}async test(e){var t;this.testResult=[];for(const i in e){const s=Number(i),n=e[s],r=[],o={guid:null==(t=n.GlobalId)?void 0:t.value,expressID:s,pass:!1,checks:r,cardinality:this.cardinality};this.testResult.push(o);const a=Object.keys(n).filter((e=>{const t=this.evalRequirement(e,this.name,"Name"),i=n[e];return t&&null===i?"optional"===this.cardinality||"prohibited"===this.cardinality:(!t||3!==(null==i?void 0:i.type)||2!==i.value)&&((!t||!Array.isArray(i)||0!==i.length)&&((!t||1!==(null==i?void 0:i.type)||""!==i.value.trim())&&t))})),c=a.length>0;if(r.push({parameter:"Name",currentValue:c?a[0]:null,requiredValue:this.name.parameter,pass:"prohibited"===this.cardinality?!c:c}),this.value)if(a[0]){const e=n[a[0]];5===(null==e?void 0:e.type)?r.push({parameter:"Value",currentValue:null,requiredValue:this.value.parameter,pass:"prohibited"===this.cardinality}):this.evalRequirement(e?e.value:null,this.value,"Value",r)}else r.push({parameter:"Value",currentValue:null,requiredValue:this.value.parameter,pass:"prohibited"===this.cardinality});o.pass=r.every((({pass:e})=>e))}const i=[...this.testResult];return this.testResult=[],i}}class ka extends Ya{constructor(e,i){super(e),t(this,"system"),t(this,"value"),t(this,"uri"),this.system=i}serialize(e){const t=Ga("System",this.system),i=Ga("Value",this.value);let s="";return"requirement"===e&&(s+=`cardinality="${this.cardinality}"`,s+=this.uri?`uri=${this.uri}`:"",s+=this.instructions?`instructions="${this.instructions}"`:""),`<ids:classification ${s}>\n ${t}\n ${i}\n</ids:classification>`}async getEntities(e,t={}){var i;const s=[],n={...await e.getAllPropertiesOfType(b.IFCCLASSIFICATIONREFERENCE),...await e.getAllPropertiesOfType(b.IFCCLASSIFICATION)},r=[];for(const t in n){const s=Number(t),n=await e.getProperties(s);if(!n)continue;const o=null==(i=n.ReferencedSource)?void 0:i.value;if(!o)continue;const a=await e.getProperties(o);if(!a)continue;if(!this.evalSystem(a))continue;if(!this.evalValue(n))continue;this.evalURI(n)&&r.push(s)}const o=this.components.get(yr);for(const i of r){const n=o.getEntitiesWithRelation(e,"HasAssociations",i);for(const i of n){if(i in t)continue;const n=await e.getProperties(i);n&&(t[i]=n,s.push(i))}}return s}async test(e,t){var i;this.testResult=[];for(const s in e){const n=Number(s),r=[],o={guid:null==(i=e[n].GlobalId)?void 0:i.value,expressID:n,pass:!1,checks:r,cardinality:this.cardinality};this.testResult.push(o);let a=!0;const c=await this.getSystems(t,n),l=c.map((e=>this.getSystemName(e))).filter((e=>e));for(const e of c){if(!this.evalSystem(e,r))continue;if(a=!1,!this.value||!this.system)break;if(e.type!==b.IFCCLASSIFICATIONREFERENCE)continue;const t=!this.value||this.evalValue(e,r),i=!this.uri||this.evalURI(e,r);if(t&&i)break}a&&this.addCheckResult({parameter:"System",currentValue:l,requiredValue:this.system,pass:"optional"===this.cardinality},r),o.pass=r.every((({pass:e})=>e))}const s=[...this.testResult];return this.testResult=[],s}async processReferencedSource(e,t){var i;const s=null==(i=t.ReferencedSource)?void 0:i.value;if(!s)return null;const n=await e.getProperties(s);return n?(n.type===b.IFCCLASSIFICATIONREFERENCE&&(n.ReferencedSource=await this.processReferencedSource(e,n)),n):null}async getSystems(e,t){var i;const s=[],n=this.components.get(yr),r=n.getEntityRelations(e,t,"HasAssociations");if(r)for(const t of r){const i=await e.getProperties(t);i&&(i.type===b.IFCCLASSIFICATION&&s.push(i),i.type===b.IFCCLASSIFICATIONREFERENCE&&(i.ReferencedSource=await this.processReferencedSource(e,i),i.ReferencedSource&&s.push(i)))}const o=s.map((e=>{var t,i,s;return e.type===b.IFCCLASSIFICATION?null==(t=e.Name)?void 0:t.value:e.type===b.IFCCLASSIFICATIONREFERENCE?null==(s=null==(i=e.ReferencedSource)?void 0:i.Name)?void 0:s.value:null})).filter((e=>e)),a=n.getEntityRelations(e,t,"IsTypedBy");if(!a||!a[0])return s;const c=a[0],l=n.getEntityRelations(e,c,"HasAssociations");if(l)for(const t of l){const n=await e.getProperties(t);if(n){if(n.type===b.IFCCLASSIFICATION){if(o.includes(null==(i=n.Name)?void 0:i.value))continue;s.push(n)}n.type===b.IFCCLASSIFICATIONREFERENCE&&(n.ReferencedSource=await this.processReferencedSource(e,n),n.ReferencedSource&&s.push(n))}}return s}getSystemName(e){var t,i,s,n;if(e.type===b.IFCCLASSIFICATION)return null==(t=e.Name)?void 0:t.value;if(e.type===b.IFCCLASSIFICATIONREFERENCE){if((null==(i=e.ReferencedSource)?void 0:i.type)===b.IFCCLASSIFICATIONREFERENCE)return this.getSystemName(e.ReferencedSource);if((null==(s=e.ReferencedSource)?void 0:s.type)===b.IFCCLASSIFICATION)return null==(n=e.ReferencedSource.Name)?void 0:n.value}return null}getAllReferenceIdentifications(e){if(e.type!==b.IFCCLASSIFICATIONREFERENCE)return null;const t=[];if(e.Identification&&t.push(e.Identification.value),e.ReferencedSource){const i=this.getAllReferenceIdentifications(e.ReferencedSource);i&&t.push(...i)}return t}evalSystem(e,t){const i=this.getSystemName(e);return this.evalRequirement(i,this.system,"System",t)}evalValue(e,t){if(!this.value)return!0;const i=this.getAllReferenceIdentifications(e);if(!i)return!1;const s=i.find((e=>!!this.value&&this.evalRequirement(e,this.value,"Value")));return t&&this.addCheckResult({parameter:"Value",currentValue:s??null,requiredValue:this.value,pass:!!s},t),!!s}evalURI(e,t){var i;if(!this.uri)return!0;return this.evalRequirement(null==(i=e.Location)?void 0:i.value,{type:"simple",parameter:this.uri},"URI",t)}}class Ha extends Ya{constructor(e,i){super(e),t(this,"name"),t(this,"predefinedType"),this.name=i}serialize(e){const t=Ga("Name",this.name),i=Ga("Name",this.predefinedType);let s="";return"requirement"===e&&(s+=`cardinality="${this.cardinality}"`,s+=this.instructions?`instructions="${this.instructions}"`:""),`<ids:entity ${s}>\n ${t}\n ${i}\n</ids:entity>`}async getEntities(e,t={}){const i=Object.entries(cr),s=[];for(const[e]of i){await this.evalName({type:e})&&s.push(Number(e))}let n={};for(const t of s){const i=await e.getAllPropertiesOfType(t);i&&(n={...n,...i})}if(!this.predefinedType){for(const e in n)e in t||(t[e]=n[e]);return Object.keys(n).map(Number)}const r=[];for(const i in n){const s=Number(i);if(s in t)continue;const o=n[s];await this.evalPredefinedType(e,o)&&(t[s]=o,r.push(s))}return r}async test(e,t){var i;this.testResult=[];for(const s in e){const n=Number(s),r=e[n],o=[],a={guid:null==(i=r.GlobalId)?void 0:i.value,expressID:n,pass:!1,checks:o,cardinality:this.cardinality};this.testResult.push(a),await this.evalName(r,o),await this.evalPredefinedType(t,r,o),a.pass=o.every((({pass:e})=>e))}return this.testResult}async evalName(e,t){const i=cr[e.type];return this.evalRequirement(i,this.name,"Name",t)}async evalPredefinedType(e,t,i){var s,n,r,o;if(!this.predefinedType)return null;const a=this.components.get(yr),c="string"==typeof this.predefinedType.parameter&&"USERDEFINED"===this.predefinedType.parameter;let l=null==(s=t.PredefinedType)?void 0:s.value;if("USERDEFINED"===l&&!c){const e=Object.keys(t).find((e=>/^((?!Predefined).)*Type$/.test(e)));l=e?null==(n=t[e])?void 0:n.value:"USERDEFINED"}if(!l){const i=a.getEntityRelations(e,t.expressID,"IsTypedBy");if(i&&i[0]){const t=await e.getProperties(i[0]);if(t&&(l=null==(r=t.PredefinedType)?void 0:r.value,"USERDEFINED"===l&&!c)){const e=Object.keys(t).find((e=>/^((?!Predefined).)*Type$/.test(e)));l=e?null==(o=t[e])?void 0:o.value:"USERDEFINED"}}}return this.evalRequirement(l,this.predefinedType,"PredefinedType",i)}}class Wa extends Ya{constructor(e,i,s){super(e),t(this,"propertySet"),t(this,"baseName"),t(this,"value"),t(this,"dataType"),t(this,"uri"),t(this,"_unsupportedTypes",[b.IFCCOMPLEXPROPERTY,b.IFCPHYSICALCOMPLEXQUANTITY]),this.propertySet=i,this.baseName=s}serialize(e){const t=Ga("PropertySet",this.propertySet),i=Ga("BaseName",this.baseName),s=Ga("Value",this.value),n=this.dataType?`dataType=${this.dataType}`:"";let r="";return"requirement"===e&&(r+=`cardinality="${this.cardinality}"`,r+=this.uri?`uri=${this.uri}`:"",r+=this.instructions?`instructions="${this.instructions}"`:""),`<ids:property ${n} ${r}>\n ${t}\n ${i}\n ${s}\n</ids:property>`}async getEntities(e,t={}){var i,s;let n={};const r=await e.getAllPropertiesOfType(b.IFCPROPERTYSET);n={...n,...r};const o=await e.getAllPropertiesOfType(b.IFCELEMENTQUANTITY);if(n={...n,...o},0===Object.keys(n).length)return[];const a=[];for(const t in n){const n=Number(t),r=await e.getProperties(n);if(!r)continue;if(!((null==(i=r.Name)?void 0:i.value)===this.propertySet.parameter))continue;let o;if(r.type===b.IFCPROPERTYSET&&(o="HasProperties"),r.type===b.IFCELEMENTQUANTITY&&(o="Quantities"),o)for(const t of r[o]){const i=await e.getProperties(t.value);if(!i)continue;if((null==(s=i.Name)?void 0:s.value)===this.baseName.parameter){if(this.value){const e=Object.keys(i).find((e=>e.endsWith("Value")));if(!e)continue;if(!(i[e].value===this.value.parameter))continue}a.push(n)}}}const c=this.components.get(yr);for(const i of a){const s=c.getEntitiesWithRelation(e,"IsDefinedBy",i);for(const i of s){if(i in t)continue;const s=await e.getProperties(i);s&&(t[i]=s)}}return[]}async test(e,t){var i;this.testResult=[];for(const s in e){const n=Number(s),r=e[n],o=[],a={guid:null==(i=r.GlobalId)?void 0:i.value,expressID:n,pass:!1,checks:o,cardinality:this.cardinality};this.testResult.push(a);const c=(await this.getPsets(t,n)).filter((e=>{var t;return!!this.evalRequirement((null==(t=e.Name)?void 0:t.value)??null,this.propertySet,"PropertySet")&&(o.push({currentValue:e.Name.value,parameter:"PropertySet",pass:!0,requiredValue:this.propertySet.parameter}),!0)}));if(0!==c.length){for(const e of c){const t=this.getItemsAttrName(e.type);if(!t){o.push({currentValue:null,parameter:"BaseName",pass:!1,requiredValue:this.baseName.parameter});continue}const i=e[t].filter((e=>{var t;if(this._unsupportedTypes.includes(e.type))return!1;return!!this.evalRequirement((null==(t=e.Name)?void 0:t.value)??null,this.baseName,"BaseName")&&(o.push({currentValue:e.Name.value,parameter:"BaseName",pass:!0,requiredValue:this.baseName.parameter}),!0)}));if(0!==i.length)for(const e of i)this.evalValue(e,o),this.evalDataType(e,o),this.evalURI();else o.push({currentValue:null,parameter:"BaseName",pass:!1,requiredValue:this.baseName.parameter})}a.pass=o.every((({pass:e})=>e))}else o.push({currentValue:null,parameter:"PropertySet",pass:!1,requiredValue:this.propertySet.parameter})}const s=[...this.testResult];return this.testResult=[],s}getItemsAttrName(e){let t;return e===b.IFCPROPERTYSET&&(t="HasProperties"),e===b.IFCELEMENTQUANTITY&&(t="Quantities"),t}getValueKey(e){return Object.keys(e).find((e=>e.endsWith("Value")||e.endsWith("Values")))}async getPsets(e,t){const i=[],s=this.components.get(yr).getEntityRelations(e,t,"IsDefinedBy");if(!s)return i;for(const t of s){const s=await e.getProperties(t);if(!s)continue;const n=this.getItemsAttrName(s.type);if(!n)continue;const r=structuredClone(s),o=[];for(const{value:t}of r[n]){const i=await e.getProperties(t);i&&o.push(i)}r[n]=o,i.push(r)}return i}evalValue(e,t){const i=this.getValueKey(e);if(this.value){if(!i)return null==t||t.push({parameter:"Value",currentValue:null,pass:!1,requiredValue:this.value.parameter}),!1;const s=e[i],n=structuredClone(this.value);if("IFCLABEL"===s.name&&"simple"===n.type&&(n.parameter=String(n.parameter)),(e.type===b.IFCPROPERTYLISTVALUE||e.type===b.IFCPROPERTYENUMERATEDVALUE)&&Array.isArray(s)){const e=s.map((e=>e.value)),i=s.find((e=>!!n&&this.evalRequirement(e.value,n,"Value")));return null==t||t.push({currentValue:e,pass:!!i,parameter:"Value",requiredValue:n.parameter}),!!i}return this.evalRequirement(s.value,n,"Value",t)}if(!i)return!0;const s=e[i];return 3===s.type&&2===s.value?(null==t||t.push({parameter:"Value",currentValue:null,pass:!1,requiredValue:null}),!1):1!==s.type||""!==s.value.trim()||(null==t||t.push({parameter:"Value",currentValue:"",pass:!1,requiredValue:null}),!1)}evalDataType(e,t){if(!this.dataType)return!0;const i=e[this.getValueKey(e)];if((e.type===b.IFCPROPERTYLISTVALUE||e.type===b.IFCPROPERTYENUMERATEDVALUE)&&Array.isArray(i)&&i[0]){const e=i[0].name;return this.evalRequirement(e,{type:"simple",parameter:this.dataType},"DataType",t)}return this.evalRequirement(i.name,{type:"simple",parameter:this.dataType},"DataType",t)}evalURI(){return!0}}class Xa{constructor(e,i,s){t(this,"name"),t(this,"ifcVersion",new Set),t(this,"identifier",Gi.create()),t(this,"description"),t(this,"instructions"),t(this,"requirementsDescription"),t(this,"applicability",new Ci),t(this,"requirements",new Ci),t(this,"components"),this.components=e,this.name=i;for(const e of s)this.ifcVersion.add(e)}async test(e){let t=[];if(0===this.requirements.size)return t;const i={};for(const t of this.applicability)await t.getEntities(e,i);const s=[...this.requirements][0];return t=await s.test(i,e),t}serialize(){const e=`name="${this.name}"`,t=this.identifier?`identifier="${this.identifier}"`:"",i=this.description?`description="${this.description}"`:"",s=this.instructions?`instructions="${this.instructions}"`:"";return`<ids:specification ifcVersion="${[...this.ifcVersion].join(" ")}" ${e} ${t} ${i} ${s}>\n <ids:applicability minOccurs="1" maxOccurs="unbounded">\n ${[...this.applicability].map((e=>e.serialize("applicability")))}\n </ids:applicability>\n <ids:requirements>\n ${[...this.requirements].map((e=>e.serialize("requirement")))}\n </ids:requirements>\n </ids:specification>`}}const ja=e=>{if(!e)return;const t={type:"simple"};if("simpleValue"in e&&(t.parameter=e.simpleValue),"restriction"in e){const i=e.restriction;if("pattern"in i&&(t.type="pattern",t.parameter=i.pattern.value),"enumeration"in i){t.type="enumeration";const e=i.enumeration.map((({value:e})=>e));t.parameter=e}}return void 0!==t.parameter?t:void 0},Za=(e,t)=>{const i=[];for(const s of t){const t=s.name,n=ja(t);if(!n)continue;const r=new Ha(e,n);s.cardinality&&(r.cardinality=s.cardinality),r.predefinedType=ja(s.predefinedType),r.instructions=s.instructions,i.push(r)}return i},$a=(e,t)=>{const i=[];for(const s of t){const t=s.name,n=ja(t);if(!n)continue;const r=new za(e,n);s.cardinality&&(r.cardinality=s.cardinality),r.value=ja(s.value),r.instructions=s.instructions,i.push(r)}return i},qa=(e,t)=>{const i=[];for(const s of t){const t=s.system,n=ja(t);if(!n)continue;const r=new ka(e,n);s.cardinality&&(r.cardinality=s.cardinality);const o=ja(s.value);"simple"===(null==o?void 0:o.type)&&(o.parameter=String(o.parameter)),"enumeration"===(null==o?void 0:o.type)&&Array.isArray(o.parameter)&&(o.parameter=o.parameter.map(String)),r.value=o,r.uri=s.uri,r.instructions=s.instructions,i.push(r)}return i},Qa=(e,t)=>{const i=[];for(const s of t){const t=s.propertySet,n=s.baseName,r=ja(t),o=ja(n);if(!o||!r)continue;const a=new Wa(e,r,o);s.cardinality&&(a.cardinality=s.cardinality);const c=ja(s.value);"enumeration"===(null==c?void 0:c.type)&&Array.isArray(c.parameter)&&(c.parameter=c.parameter.map(String)),a.value=c,a.dataType=s.dataType,a.uri=s.uri,a.instructions=s.instructions,i.push(a)}return i},Ka=class e extends hi{constructor(i){super(i),t(this,"enabled",!0),t(this,"list",new Ti),i.add(e.uuid,this)}getFragmentIdMap(e,t){const i=t.filter((e=>e.pass)).map((e=>e.expressID)),s=e.getFragmentMap(i),n=t.filter((e=>!e.pass)).map((e=>e.expressID));return{pass:s,fail:e.getFragmentMap(n)}}create(e,t,i){const s=new Xa(this.components,e,t);return i&&(s.identifier=i),this.list.set(s.identifier,s),s}load(t){const i=[],s=e.xmlParser.parse(t).ids,{specifications:n}=s;if(n&&n.specification){const e=Array.isArray(n.specification)?n.specification:[n.specification];for(const t of e){const{name:e,ifcVersion:s,description:n,instructions:r,identifier:o}=t;if(!e||!s)continue;const a=[],c=[],{applicability:l,requirements:h}=t;if(l){const{maxOccurs:e,...t}=l,i=Array.isArray(t)?t:[t];for(const e of i)for(const t in e){const i=Array.isArray(e[t])?e[t]:[e[t]];if("entity"===t){const e=Za(this.components,i);a.push(...e)}}}let I;if(h){const{maxOccurs:e,...t}=h;I=h.description;const i=Array.isArray(t)?t:[t];for(const e of i)for(const t in e){const i=Array.isArray(e[t])?e[t]:[e[t]];if("entity"===t){const e=Za(this.components,i);c.push(...e)}if("attribute"===t){const e=$a(this.components,i);c.push(...e)}if("classification"===t){const e=qa(this.components,i);c.push(...e)}if("property"===t){const e=Qa(this.components,i);c.push(...e)}}}if(a.length>0&&c.length>0){const t=this.create(e,s.split(/\s+/),o);t.description=n,t.instructions=r,t.requirementsDescription=I,t.applicability.add(...a),t.requirements.add(...c),i.push(t)}}}return i}export(e,t=this.list.values()){const i=t??this.list;return`<ids:ids xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://standards.buildingsmart.org/IDS http://standards.buildingsmart.org/IDS/1.0/ids.xsd" xmlns:ids="http://standards.buildingsmart.org/IDS">\n \x3c!-- Made with That Open Engine ${Hi.release} (https://github.com/thatopen/engine_components) --\x3e\n <ids:info>\n <ids:title>${e.title}</ids:title>\n ${e.copyright?`<ids:copyright>${e.copyright}</ids:copyright>`:""}\n ${e.version?`<ids:version>${e.version}</ids:version>`:""}\n ${e.description?`<ids:description>${e.description}</ids:description>`:""}\n ${e.author?`<ids:author>${e.author}</ids:author>`:""}\n ${e.date?`<ids:date>${e.date.toISOString().split("T")[0]}</ids:date>`:""}\n ${e.purpose?`<ids:purpose>${e.purpose}</ids:purpose>`:""}\n ${e.milestone?`<ids:milestone>${e.milestone}</ids:milestone>`:""}\n </ids:info>\n <ids:specifications>\n ${[...i].map((e=>e.serialize())).join("\n")}\n </ids:specifications>\n</ids:ids>`}};t(Ka,"uuid","9f0b9f78-9b2e-481a-b766-2fbfd01f342c"),t(Ka,"xmlParser",new ea.XMLParser({allowBooleanAttributes:!0,attributeNamePrefix:"",ignoreAttributes:!1,ignoreDeclaration:!0,ignorePiTags:!0,numberParseOptions:{leadingZeros:!0,hex:!0},parseAttributeValue:!0,preserveOrder:!1,processEntities:!1,removeNSPrefix:!0,trimValues:!0}));let Ja=Ka;export{ci as AsyncEvent,aa as BCFTopics,ra as BCFTopicsConfigManager,li as Base,ui as BaseCamera,di as BaseRenderer,pi as BaseScene,Ii as BaseWorldItem,la as BoundingBoxer,Ra as Classifier,Jn as Clipper,ta as Comment,hi as Component,mi as ComponentWithUI,Hi as Components,Zi as ConfigManager,Xi as Configurator,nn as CullerRenderer,an as Cullers,Ti as DataMap,Ci as DataSet,fi as Disposer,ai as Event,Ri as EventManager,Aa as Exploder,er as FirstPersonMode,_r as FragmentsManager,Cr as GeometryTypes,Cn as Grids,Sa as Hider,za as IDSAttribute,ka as IDSClassification,Ha as IDSEntity,Ya as IDSFacet,Wa as IDSProperty,Xa as IDSSpecification,Ja as IDSSpecifications,Ea as IfcBasicQuery,ar as IfcCategories,cr as IfcCategoryMap,or as IfcElements,Ta as IfcFinder,Ia as IfcFinderQuery,dr as IfcFragmentSettings,ya as IfcGeometryTiler,mr as IfcJsonExporter,gr as IfcLoader,Or as IfcPropertiesManager,_a as IfcPropertiesTiler,lr as IfcPropertiesUtils,pa as IfcPropertyQuery,yr as IfcRelationsIndexer,Oa as IfcStreamingSettings,Vi as MaterialsUtils,Va as MeasurementUtils,rn as MeshCullerRenderer,ba as MiniMap,Da as MiniMapConfigManager,xa as MiniMaps,hn as Mouse,tr as OrbitMode,nr as OrthoPerspectiveCamera,ir as PlanMode,sr as ProjectionManager,La as PropertiesStreamingSettings,dn as Raycasters,ln as ShadowedScene,Qs as SimpleCamera,fn as SimpleGrid,En as SimpleGridConfigManager,qn as SimplePlane,In as SimpleRaycaster,Ji as SimpleRenderer,Ki as SimpleScene,Qi as SimpleSceneConfigManager,Wi as SimpleWorld,sa as Topic,Gi as UUID,zi as VertexPicker,Pa as Viewpoint,va as Viewpoints,Js as Worlds,na as extensionsImporter,hr as ifcCategoryCase,Ar as ifcRelAttrsPosition,Fr as ifcRelClassNames,Bi as isPointInFrontOfPlane,xi as obbFromPoints,tn as readPixelsAsync,rr as relToAttributesMap};