@vctrl/hooks 0.2.2 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.2",
2
+ "version": "0.3.2",
3
3
  "name": "@vctrl/hooks",
4
4
  "description": "vctrl/hooks is a React hooks package designed to simplify 3D model loading and management within React applications. It's part of the vectreal-core ecosystem and is primarily used in the vctrl/viewer React component and the official website application.",
5
5
  "bugs": {
@@ -41,5 +41,15 @@
41
41
  "require": "./use-load-model.cjs.js",
42
42
  "types": "./use-load-model/index.d.ts"
43
43
  }
44
+ },
45
+ "peerDependencies": {
46
+ "react": "18.3.1"
47
+ },
48
+ "dependencies": {
49
+ "three": "^0.168.0",
50
+ "@gltf-transform/core": "^4.0.8",
51
+ "@gltf-transform/functions": "^4.0.8",
52
+ "@gltf-transform/extensions": "^4.0.8",
53
+ "meshoptimizer": "^0.21.0"
44
54
  }
45
55
  }
@@ -0,0 +1 @@
1
+ export { default as useExportModel } from './use-export-model';
@@ -0,0 +1,19 @@
1
+ export interface URIBufferObject {
2
+ uri: string;
3
+ byteLength: number;
4
+ }
5
+ export interface TexturesObject {
6
+ name: string;
7
+ sampler: number;
8
+ source: number;
9
+ }
10
+ export interface ImageDataObject {
11
+ data?: Uint8Array | ArrayBuffer;
12
+ uri?: string;
13
+ mimeType?: string;
14
+ }
15
+ export interface ExportResult {
16
+ buffers?: ArrayBuffer[] | URIBufferObject[];
17
+ images?: ImageDataObject[];
18
+ textures?: TexturesObject[];
19
+ }
@@ -0,0 +1,14 @@
1
+ import { ModelFile } from '../use-load-model';
2
+ /**
3
+ * A React hook for exporting a 3D model from a Three.js scene.
4
+ *
5
+ * @param {Function} [onSaved] Called when the export is complete.
6
+ * @param {Function} [onError] Called when an error occurs during exporting.
7
+ * @returns An object with a single property, `handleGltfExport`. `handleGltfExport` is a function
8
+ * that takes a file object and a boolean indicating whether to export in binary format.
9
+ * It exports the scene in the format specified by the boolean parameter.
10
+ */
11
+ declare const useExportModel: (onSaved?: () => void, onError?: (error: ErrorEvent) => void) => {
12
+ handleGltfExport: (file: ModelFile | null, binary: boolean) => void;
13
+ };
14
+ export default useExportModel;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Converts a data URI to a Blob.
3
+ *
4
+ * @param {string} dataURI - The data URI to convert.
5
+ *
6
+ * @returns {Blob} The Blob object.
7
+ */
8
+ declare const dataURItoBlob: (dataURI: string) => Blob;
9
+ export default dataURItoBlob;
@@ -0,0 +1,23 @@
1
+ import { default as JSZip } from 'jszip';
2
+ import { ImageDataObject, TexturesObject, URIBufferObject } from '../types';
3
+ /**
4
+ * Handles processing and adding images to a zip file.
5
+ *
6
+ * @param images The images property of the GLTF model's asset.
7
+ * @param textures The textures property of the GLTF model's asset.
8
+ * @param zip The zip file to add images to.
9
+ */
10
+ export declare const handleImages: (images: Array<ImageDataObject>, textures: Array<TexturesObject>, zip: JSZip) => void;
11
+ /**
12
+ * Handles processing and adding buffers to a zip file.
13
+ *
14
+ * @param buffers The buffers property of the GLTF model's asset.
15
+ * @param zip The zip file to add buffers to.
16
+ * @param baseFileName The base file name to use for the exported file.
17
+ *
18
+ * Only ArrayBuffers and URIBufferObjects with a uri of type data URL are supported.
19
+ * If the buffer is not an ArrayBuffer, it must have a uri that starts with 'data:'.
20
+ * If the buffer is not an ArrayBuffer and does not have a uri, a warning is logged
21
+ * to the console.
22
+ */
23
+ export declare const handleBuffers: (buffers: Array<URIBufferObject | ArrayBuffer>, zip: JSZip, baseFileName: string) => void;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Determines the extension of a file based on its URI and MIME type.
3
+ *
4
+ * If the MIME type is not provided, it is inferred from the URI.
5
+ *
6
+ * Returns a default `png` extension if the extension is unknown.
7
+ *
8
+ * @param {string} uri - The URI of the image
9
+ * @param {string} mimeType - The MIME type of the image
10
+ */
11
+ export declare function getFileExtension(uri: string, mimeType?: string): string;
12
+ /**
13
+ * Extracts the base name of a file from its URI.
14
+ *
15
+ * @param {string} filename - The name of the file
16
+ */
17
+ export declare function getFileBasename(filename: string): string;
@@ -0,0 +1,3 @@
1
+ export { default as dataURItoBlob } from './data-uri-to-blob';
2
+ export * from './export-handlers';
3
+ export * from './file-helpers';
@@ -0,0 +1,12 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ct=require("./_commonjsHelpers-BKV1RZto.cjs");function wt(et){throw new Error('Could not dynamically require "'+et+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Et={exports:{}};/*!
2
+
3
+ JSZip v3.10.1 - A JavaScript class for generating and reading zip files
4
+ <http://stuartk.com/jszip>
5
+
6
+ (c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
7
+ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
8
+
9
+ JSZip uses the library pako released under the MIT license :
10
+ https://github.com/nodeca/pako/blob/main/LICENSE
11
+ */(function(et,ot){(function(g){et.exports=g()})(function(){return function g(I,w,s){function o(c,b){if(!w[c]){if(!I[c]){var _=typeof wt=="function"&&wt;if(!b&&_)return _(c,!0);if(n)return n(c,!0);var m=new Error("Cannot find module '"+c+"'");throw m.code="MODULE_NOT_FOUND",m}var i=w[c]={exports:{}};I[c][0].call(i.exports,function(d){var r=I[c][1][d];return o(r||d)},i,i.exports,g,I,w,s)}return w[c].exports}for(var n=typeof wt=="function"&&wt,u=0;u<s.length;u++)o(s[u]);return o}({1:[function(g,I,w){var s=g("./utils"),o=g("./support"),n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";w.encode=function(u){for(var c,b,_,m,i,d,r,l=[],a=0,p=u.length,y=p,S=s.getTypeOf(u)!=="string";a<u.length;)y=p-a,_=S?(c=u[a++],b=a<p?u[a++]:0,a<p?u[a++]:0):(c=u.charCodeAt(a++),b=a<p?u.charCodeAt(a++):0,a<p?u.charCodeAt(a++):0),m=c>>2,i=(3&c)<<4|b>>4,d=1<y?(15&b)<<2|_>>6:64,r=2<y?63&_:64,l.push(n.charAt(m)+n.charAt(i)+n.charAt(d)+n.charAt(r));return l.join("")},w.decode=function(u){var c,b,_,m,i,d,r=0,l=0,a="data:";if(u.substr(0,a.length)===a)throw new Error("Invalid base64 input, it looks like a data url.");var p,y=3*(u=u.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(u.charAt(u.length-1)===n.charAt(64)&&y--,u.charAt(u.length-2)===n.charAt(64)&&y--,y%1!=0)throw new Error("Invalid base64 input, bad content length.");for(p=o.uint8array?new Uint8Array(0|y):new Array(0|y);r<u.length;)c=n.indexOf(u.charAt(r++))<<2|(m=n.indexOf(u.charAt(r++)))>>4,b=(15&m)<<4|(i=n.indexOf(u.charAt(r++)))>>2,_=(3&i)<<6|(d=n.indexOf(u.charAt(r++))),p[l++]=c,i!==64&&(p[l++]=b),d!==64&&(p[l++]=_);return p}},{"./support":30,"./utils":32}],2:[function(g,I,w){var s=g("./external"),o=g("./stream/DataWorker"),n=g("./stream/Crc32Probe"),u=g("./stream/DataLengthProbe");function c(b,_,m,i,d){this.compressedSize=b,this.uncompressedSize=_,this.crc32=m,this.compression=i,this.compressedContent=d}c.prototype={getContentWorker:function(){var b=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new u("data_length")),_=this;return b.on("end",function(){if(this.streamInfo.data_length!==_.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),b},getCompressedWorker:function(){return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(b,_,m){return b.pipe(new n).pipe(new u("uncompressedSize")).pipe(_.compressWorker(m)).pipe(new u("compressedSize")).withStreamInfo("compression",_)},I.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(g,I,w){var s=g("./stream/GenericWorker");w.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},w.DEFLATE=g("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(g,I,w){var s=g("./utils"),o=function(){for(var n,u=[],c=0;c<256;c++){n=c;for(var b=0;b<8;b++)n=1&n?3988292384^n>>>1:n>>>1;u[c]=n}return u}();I.exports=function(n,u){return n!==void 0&&n.length?s.getTypeOf(n)!=="string"?function(c,b,_,m){var i=o,d=m+_;c^=-1;for(var r=m;r<d;r++)c=c>>>8^i[255&(c^b[r])];return-1^c}(0|u,n,n.length,0):function(c,b,_,m){var i=o,d=m+_;c^=-1;for(var r=m;r<d;r++)c=c>>>8^i[255&(c^b.charCodeAt(r))];return-1^c}(0|u,n,n.length,0):0}},{"./utils":32}],5:[function(g,I,w){w.base64=!1,w.binary=!1,w.dir=!1,w.createFolders=!0,w.date=null,w.compression=null,w.compressionOptions=null,w.comment=null,w.unixPermissions=null,w.dosPermissions=null},{}],6:[function(g,I,w){var s=null;s=typeof Promise<"u"?Promise:g("lie"),I.exports={Promise:s}},{lie:37}],7:[function(g,I,w){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=g("pako"),n=g("./utils"),u=g("./stream/GenericWorker"),c=s?"uint8array":"array";function b(_,m){u.call(this,"FlateWorker/"+_),this._pako=null,this._pakoAction=_,this._pakoOptions=m,this.meta={}}w.magic="\b\0",n.inherits(b,u),b.prototype.processChunk=function(_){this.meta=_.meta,this._pako===null&&this._createPako(),this._pako.push(n.transformTo(c,_.data),!1)},b.prototype.flush=function(){u.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},b.prototype.cleanUp=function(){u.prototype.cleanUp.call(this),this._pako=null},b.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var _=this;this._pako.onData=function(m){_.push({data:m,meta:_.meta})}},w.compressWorker=function(_){return new b("Deflate",_)},w.uncompressWorker=function(){return new b("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(g,I,w){function s(i,d){var r,l="";for(r=0;r<d;r++)l+=String.fromCharCode(255&i),i>>>=8;return l}function o(i,d,r,l,a,p){var y,S,x=i.file,F=i.compression,B=p!==c.utf8encode,L=n.transformTo("string",p(x.name)),O=n.transformTo("string",c.utf8encode(x.name)),W=x.comment,q=n.transformTo("string",p(W)),v=n.transformTo("string",c.utf8encode(W)),R=O.length!==x.name.length,e=v.length!==W.length,D="",J="",j="",$=x.dir,P=x.date,V={crc32:0,compressedSize:0,uncompressedSize:0};d&&!r||(V.crc32=i.crc32,V.compressedSize=i.compressedSize,V.uncompressedSize=i.uncompressedSize);var A=0;d&&(A|=8),B||!R&&!e||(A|=2048);var z=0,X=0;$&&(z|=16),a==="UNIX"?(X=798,z|=function(G,it){var ut=G;return G||(ut=it?16893:33204),(65535&ut)<<16}(x.unixPermissions,$)):(X=20,z|=function(G){return 63&(G||0)}(x.dosPermissions)),y=P.getUTCHours(),y<<=6,y|=P.getUTCMinutes(),y<<=5,y|=P.getUTCSeconds()/2,S=P.getUTCFullYear()-1980,S<<=4,S|=P.getUTCMonth()+1,S<<=5,S|=P.getUTCDate(),R&&(J=s(1,1)+s(b(L),4)+O,D+="up"+s(J.length,2)+J),e&&(j=s(1,1)+s(b(q),4)+v,D+="uc"+s(j.length,2)+j);var H="";return H+=`
12
+ \0`,H+=s(A,2),H+=F.magic,H+=s(y,2),H+=s(S,2),H+=s(V.crc32,4),H+=s(V.compressedSize,4),H+=s(V.uncompressedSize,4),H+=s(L.length,2),H+=s(D.length,2),{fileRecord:_.LOCAL_FILE_HEADER+H+L+D,dirRecord:_.CENTRAL_FILE_HEADER+s(X,2)+H+s(q.length,2)+"\0\0\0\0"+s(z,4)+s(l,4)+L+D+q}}var n=g("../utils"),u=g("../stream/GenericWorker"),c=g("../utf8"),b=g("../crc32"),_=g("../signature");function m(i,d,r,l){u.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=d,this.zipPlatform=r,this.encodeFileName=l,this.streamFiles=i,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}n.inherits(m,u),m.prototype.push=function(i){var d=i.meta.percent||0,r=this.entriesCount,l=this._sources.length;this.accumulate?this.contentBuffer.push(i):(this.bytesWritten+=i.data.length,u.prototype.push.call(this,{data:i.data,meta:{currentFile:this.currentFile,percent:r?(d+100*(r-l-1))/r:100}}))},m.prototype.openedSource=function(i){this.currentSourceOffset=this.bytesWritten,this.currentFile=i.file.name;var d=this.streamFiles&&!i.file.dir;if(d){var r=o(i,d,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0},m.prototype.closedSource=function(i){this.accumulate=!1;var d=this.streamFiles&&!i.file.dir,r=o(i,d,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),d)this.push({data:function(l){return _.DATA_DESCRIPTOR+s(l.crc32,4)+s(l.compressedSize,4)+s(l.uncompressedSize,4)}(i),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},m.prototype.flush=function(){for(var i=this.bytesWritten,d=0;d<this.dirRecords.length;d++)this.push({data:this.dirRecords[d],meta:{percent:100}});var r=this.bytesWritten-i,l=function(a,p,y,S,x){var F=n.transformTo("string",x(S));return _.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(a,2)+s(a,2)+s(p,4)+s(y,4)+s(F.length,2)+F}(this.dirRecords.length,r,i,this.zipComment,this.encodeFileName);this.push({data:l,meta:{percent:100}})},m.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},m.prototype.registerPrevious=function(i){this._sources.push(i);var d=this;return i.on("data",function(r){d.processChunk(r)}),i.on("end",function(){d.closedSource(d.previous.streamInfo),d._sources.length?d.prepareNextSource():d.end()}),i.on("error",function(r){d.error(r)}),this},m.prototype.resume=function(){return!!u.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},m.prototype.error=function(i){var d=this._sources;if(!u.prototype.error.call(this,i))return!1;for(var r=0;r<d.length;r++)try{d[r].error(i)}catch{}return!0},m.prototype.lock=function(){u.prototype.lock.call(this);for(var i=this._sources,d=0;d<i.length;d++)i[d].lock()},I.exports=m},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(g,I,w){var s=g("../compressions"),o=g("./ZipFileWorker");w.generateWorker=function(n,u,c){var b=new o(u.streamFiles,c,u.platform,u.encodeFileName),_=0;try{n.forEach(function(m,i){_++;var d=function(p,y){var S=p||y,x=s[S];if(!x)throw new Error(S+" is not a valid compression method !");return x}(i.options.compression,u.compression),r=i.options.compressionOptions||u.compressionOptions||{},l=i.dir,a=i.date;i._compressWorker(d,r).withStreamInfo("file",{name:m,dir:l,date:a,comment:i.comment||"",unixPermissions:i.unixPermissions,dosPermissions:i.dosPermissions}).pipe(b)}),b.entriesCount=_}catch(m){b.error(m)}return b}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(g,I,w){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 o=new s;for(var n in this)typeof this[n]!="function"&&(o[n]=this[n]);return o}}(s.prototype=g("./object")).loadAsync=g("./load"),s.support=g("./support"),s.defaults=g("./defaults"),s.version="3.10.1",s.loadAsync=function(o,n){return new s().loadAsync(o,n)},s.external=g("./external"),I.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(g,I,w){var s=g("./utils"),o=g("./external"),n=g("./utf8"),u=g("./zipEntries"),c=g("./stream/Crc32Probe"),b=g("./nodejsUtils");function _(m){return new o.Promise(function(i,d){var r=m.decompressed.getContentWorker().pipe(new c);r.on("error",function(l){d(l)}).on("end",function(){r.streamInfo.crc32!==m.decompressed.crc32?d(new Error("Corrupted zip : CRC32 mismatch")):i()}).resume()})}I.exports=function(m,i){var d=this;return i=s.extend(i||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:n.utf8decode}),b.isNode&&b.isStream(m)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",m,!0,i.optimizedBinaryString,i.base64).then(function(r){var l=new u(i);return l.load(r),l}).then(function(r){var l=[o.Promise.resolve(r)],a=r.files;if(i.checkCRC32)for(var p=0;p<a.length;p++)l.push(_(a[p]));return o.Promise.all(l)}).then(function(r){for(var l=r.shift(),a=l.files,p=0;p<a.length;p++){var y=a[p],S=y.fileNameStr,x=s.resolve(y.fileNameStr);d.file(x,y.decompressed,{binary:!0,optimizedBinaryString:!0,date:y.date,dir:y.dir,comment:y.fileCommentStr.length?y.fileCommentStr:null,unixPermissions:y.unixPermissions,dosPermissions:y.dosPermissions,createFolders:i.createFolders}),y.dir||(d.file(x).unsafeOriginalName=S)}return l.zipComment.length&&(d.comment=l.zipComment),d})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(g,I,w){var s=g("../utils"),o=g("../stream/GenericWorker");function n(u,c){o.call(this,"Nodejs stream input adapter for "+u),this._upstreamEnded=!1,this._bindStream(c)}s.inherits(n,o),n.prototype._bindStream=function(u){var c=this;(this._stream=u).pause(),u.on("data",function(b){c.push({data:b,meta:{percent:0}})}).on("error",function(b){c.isPaused?this.generatedError=b:c.error(b)}).on("end",function(){c.isPaused?c._upstreamEnded=!0:c.end()})},n.prototype.pause=function(){return!!o.prototype.pause.call(this)&&(this._stream.pause(),!0)},n.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},I.exports=n},{"../stream/GenericWorker":28,"../utils":32}],13:[function(g,I,w){var s=g("readable-stream").Readable;function o(n,u,c){s.call(this,u),this._helper=n;var b=this;n.on("data",function(_,m){b.push(_)||b._helper.pause(),c&&c(m)}).on("error",function(_){b.emit("error",_)}).on("end",function(){b.push(null)})}g("../utils").inherits(o,s),o.prototype._read=function(){this._helper.resume()},I.exports=o},{"../utils":32,"readable-stream":16}],14:[function(g,I,w){I.exports={isNode:typeof Buffer<"u",newBufferFrom:function(s,o){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(s,o);if(typeof s=="number")throw new Error('The "data" argument must not be a number');return new Buffer(s,o)},allocBuffer:function(s){if(Buffer.alloc)return Buffer.alloc(s);var o=new Buffer(s);return o.fill(0),o},isBuffer:function(s){return Buffer.isBuffer(s)},isStream:function(s){return s&&typeof s.on=="function"&&typeof s.pause=="function"&&typeof s.resume=="function"}}},{}],15:[function(g,I,w){function s(x,F,B){var L,O=n.getTypeOf(F),W=n.extend(B||{},b);W.date=W.date||new Date,W.compression!==null&&(W.compression=W.compression.toUpperCase()),typeof W.unixPermissions=="string"&&(W.unixPermissions=parseInt(W.unixPermissions,8)),W.unixPermissions&&16384&W.unixPermissions&&(W.dir=!0),W.dosPermissions&&16&W.dosPermissions&&(W.dir=!0),W.dir&&(x=a(x)),W.createFolders&&(L=l(x))&&p.call(this,L,!0);var q=O==="string"&&W.binary===!1&&W.base64===!1;B&&B.binary!==void 0||(W.binary=!q),(F instanceof _&&F.uncompressedSize===0||W.dir||!F||F.length===0)&&(W.base64=!1,W.binary=!0,F="",W.compression="STORE",O="string");var v=null;v=F instanceof _||F instanceof u?F:d.isNode&&d.isStream(F)?new r(x,F):n.prepareContent(x,F,W.binary,W.optimizedBinaryString,W.base64);var R=new m(x,v,W);this.files[x]=R}var o=g("./utf8"),n=g("./utils"),u=g("./stream/GenericWorker"),c=g("./stream/StreamHelper"),b=g("./defaults"),_=g("./compressedObject"),m=g("./zipObject"),i=g("./generate"),d=g("./nodejsUtils"),r=g("./nodejs/NodejsStreamInputAdapter"),l=function(x){x.slice(-1)==="/"&&(x=x.substring(0,x.length-1));var F=x.lastIndexOf("/");return 0<F?x.substring(0,F):""},a=function(x){return x.slice(-1)!=="/"&&(x+="/"),x},p=function(x,F){return F=F!==void 0?F:b.createFolders,x=a(x),this.files[x]||s.call(this,x,null,{dir:!0,createFolders:F}),this.files[x]};function y(x){return Object.prototype.toString.call(x)==="[object RegExp]"}var S={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(x){var F,B,L;for(F in this.files)L=this.files[F],(B=F.slice(this.root.length,F.length))&&F.slice(0,this.root.length)===this.root&&x(B,L)},filter:function(x){var F=[];return this.forEach(function(B,L){x(B,L)&&F.push(L)}),F},file:function(x,F,B){if(arguments.length!==1)return x=this.root+x,s.call(this,x,F,B),this;if(y(x)){var L=x;return this.filter(function(W,q){return!q.dir&&L.test(W)})}var O=this.files[this.root+x];return O&&!O.dir?O:null},folder:function(x){if(!x)return this;if(y(x))return this.filter(function(O,W){return W.dir&&x.test(O)});var F=this.root+x,B=p.call(this,F),L=this.clone();return L.root=B.name,L},remove:function(x){x=this.root+x;var F=this.files[x];if(F||(x.slice(-1)!=="/"&&(x+="/"),F=this.files[x]),F&&!F.dir)delete this.files[x];else for(var B=this.filter(function(O,W){return W.name.slice(0,x.length)===x}),L=0;L<B.length;L++)delete this.files[B[L].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(x){var F,B={};try{if((B=n.extend(x||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=B.type.toLowerCase(),B.compression=B.compression.toUpperCase(),B.type==="binarystring"&&(B.type="string"),!B.type)throw new Error("No output type specified.");n.checkSupport(B.type),B.platform!=="darwin"&&B.platform!=="freebsd"&&B.platform!=="linux"&&B.platform!=="sunos"||(B.platform="UNIX"),B.platform==="win32"&&(B.platform="DOS");var L=B.comment||this.comment||"";F=i.generateWorker(this,B,L)}catch(O){(F=new u("error")).error(O)}return new c(F,B.type||"string",B.mimeType)},generateAsync:function(x,F){return this.generateInternalStream(x).accumulate(F)},generateNodeStream:function(x,F){return(x=x||{}).type||(x.type="nodebuffer"),this.generateInternalStream(x).toNodejsStream(F)}};I.exports=S},{"./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(g,I,w){I.exports=g("stream")},{stream:void 0}],17:[function(g,I,w){var s=g("./DataReader");function o(n){s.call(this,n);for(var u=0;u<this.data.length;u++)n[u]=255&n[u]}g("../utils").inherits(o,s),o.prototype.byteAt=function(n){return this.data[this.zero+n]},o.prototype.lastIndexOfSignature=function(n){for(var u=n.charCodeAt(0),c=n.charCodeAt(1),b=n.charCodeAt(2),_=n.charCodeAt(3),m=this.length-4;0<=m;--m)if(this.data[m]===u&&this.data[m+1]===c&&this.data[m+2]===b&&this.data[m+3]===_)return m-this.zero;return-1},o.prototype.readAndCheckSignature=function(n){var u=n.charCodeAt(0),c=n.charCodeAt(1),b=n.charCodeAt(2),_=n.charCodeAt(3),m=this.readData(4);return u===m[0]&&c===m[1]&&b===m[2]&&_===m[3]},o.prototype.readData=function(n){if(this.checkOffset(n),n===0)return[];var u=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,u},I.exports=o},{"../utils":32,"./DataReader":18}],18:[function(g,I,w){var s=g("../utils");function o(n){this.data=n,this.length=n.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(n){this.checkIndex(this.index+n)},checkIndex:function(n){if(this.length<this.zero+n||n<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+n+"). Corrupted zip ?")},setIndex:function(n){this.checkIndex(n),this.index=n},skip:function(n){this.setIndex(this.index+n)},byteAt:function(){},readInt:function(n){var u,c=0;for(this.checkOffset(n),u=this.index+n-1;u>=this.index;u--)c=(c<<8)+this.byteAt(u);return this.index+=n,c},readString:function(n){return s.transformTo("string",this.readData(n))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var n=this.readInt(4);return new Date(Date.UTC(1980+(n>>25&127),(n>>21&15)-1,n>>16&31,n>>11&31,n>>5&63,(31&n)<<1))}},I.exports=o},{"../utils":32}],19:[function(g,I,w){var s=g("./Uint8ArrayReader");function o(n){s.call(this,n)}g("../utils").inherits(o,s),o.prototype.readData=function(n){this.checkOffset(n);var u=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,u},I.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(g,I,w){var s=g("./DataReader");function o(n){s.call(this,n)}g("../utils").inherits(o,s),o.prototype.byteAt=function(n){return this.data.charCodeAt(this.zero+n)},o.prototype.lastIndexOfSignature=function(n){return this.data.lastIndexOf(n)-this.zero},o.prototype.readAndCheckSignature=function(n){return n===this.readData(4)},o.prototype.readData=function(n){this.checkOffset(n);var u=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,u},I.exports=o},{"../utils":32,"./DataReader":18}],21:[function(g,I,w){var s=g("./ArrayReader");function o(n){s.call(this,n)}g("../utils").inherits(o,s),o.prototype.readData=function(n){if(this.checkOffset(n),n===0)return new Uint8Array(0);var u=this.data.subarray(this.zero+this.index,this.zero+this.index+n);return this.index+=n,u},I.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(g,I,w){var s=g("../utils"),o=g("../support"),n=g("./ArrayReader"),u=g("./StringReader"),c=g("./NodeBufferReader"),b=g("./Uint8ArrayReader");I.exports=function(_){var m=s.getTypeOf(_);return s.checkSupport(m),m!=="string"||o.uint8array?m==="nodebuffer"?new c(_):o.uint8array?new b(s.transformTo("uint8array",_)):new n(s.transformTo("array",_)):new u(_)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(g,I,w){w.LOCAL_FILE_HEADER="PK",w.CENTRAL_FILE_HEADER="PK",w.CENTRAL_DIRECTORY_END="PK",w.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",w.ZIP64_CENTRAL_DIRECTORY_END="PK",w.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(g,I,w){var s=g("./GenericWorker"),o=g("../utils");function n(u){s.call(this,"ConvertWorker to "+u),this.destType=u}o.inherits(n,s),n.prototype.processChunk=function(u){this.push({data:o.transformTo(this.destType,u.data),meta:u.meta})},I.exports=n},{"../utils":32,"./GenericWorker":28}],25:[function(g,I,w){var s=g("./GenericWorker"),o=g("../crc32");function n(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}g("../utils").inherits(n,s),n.prototype.processChunk=function(u){this.streamInfo.crc32=o(u.data,this.streamInfo.crc32||0),this.push(u)},I.exports=n},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(g,I,w){var s=g("../utils"),o=g("./GenericWorker");function n(u){o.call(this,"DataLengthProbe for "+u),this.propName=u,this.withStreamInfo(u,0)}s.inherits(n,o),n.prototype.processChunk=function(u){if(u){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+u.data.length}o.prototype.processChunk.call(this,u)},I.exports=n},{"../utils":32,"./GenericWorker":28}],27:[function(g,I,w){var s=g("../utils"),o=g("./GenericWorker");function n(u){o.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,u.then(function(b){c.dataIsReady=!0,c.data=b,c.max=b&&b.length||0,c.type=s.getTypeOf(b),c.isPaused||c._tickAndRepeat()},function(b){c.error(b)})}s.inherits(n,o),n.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},n.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},n.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},n.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var u=null,c=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":u=this.data.substring(this.index,c);break;case"uint8array":u=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":u=this.data.slice(this.index,c)}return this.index=c,this.push({data:u,meta:{percent:this.max?this.index/this.max*100:0}})},I.exports=n},{"../utils":32,"./GenericWorker":28}],28:[function(g,I,w){function s(o){this.name=o||"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(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,n){return this._listeners[o].push(n),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,n){if(this._listeners[o])for(var u=0;u<this._listeners[o].length;u++)this._listeners[o][u].call(this,n)},pipe:function(o){return o.registerPrevious(this)},registerPrevious:function(o){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=o.streamInfo,this.mergeStreamInfo(),this.previous=o;var n=this;return o.on("data",function(u){n.processChunk(u)}),o.on("end",function(){n.end()}),o.on("error",function(u){n.error(u)}),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 o=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),o=!0),this.previous&&this.previous.resume(),!o},flush:function(){},processChunk:function(o){this.push(o)},withStreamInfo:function(o,n){return this.extraStreamInfo[o]=n,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var o in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,o)&&(this.streamInfo[o]=this.extraStreamInfo[o])},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 o="Worker "+this.name;return this.previous?this.previous+" -> "+o:o}},I.exports=s},{}],29:[function(g,I,w){var s=g("../utils"),o=g("./ConvertWorker"),n=g("./GenericWorker"),u=g("../base64"),c=g("../support"),b=g("../external"),_=null;if(c.nodestream)try{_=g("../nodejs/NodejsStreamOutputAdapter")}catch{}function m(d,r){return new b.Promise(function(l,a){var p=[],y=d._internalType,S=d._outputType,x=d._mimeType;d.on("data",function(F,B){p.push(F),r&&r(B)}).on("error",function(F){p=[],a(F)}).on("end",function(){try{var F=function(B,L,O){switch(B){case"blob":return s.newBlob(s.transformTo("arraybuffer",L),O);case"base64":return u.encode(L);default:return s.transformTo(B,L)}}(S,function(B,L){var O,W=0,q=null,v=0;for(O=0;O<L.length;O++)v+=L[O].length;switch(B){case"string":return L.join("");case"array":return Array.prototype.concat.apply([],L);case"uint8array":for(q=new Uint8Array(v),O=0;O<L.length;O++)q.set(L[O],W),W+=L[O].length;return q;case"nodebuffer":return Buffer.concat(L);default:throw new Error("concat : unsupported type '"+B+"'")}}(y,p),x);l(F)}catch(B){a(B)}p=[]}).resume()})}function i(d,r,l){var a=r;switch(r){case"blob":case"arraybuffer":a="uint8array";break;case"base64":a="string"}try{this._internalType=a,this._outputType=r,this._mimeType=l,s.checkSupport(a),this._worker=d.pipe(new o(a)),d.lock()}catch(p){this._worker=new n("error"),this._worker.error(p)}}i.prototype={accumulate:function(d){return m(this,d)},on:function(d,r){var l=this;return d==="data"?this._worker.on(d,function(a){r.call(l,a.data,a.meta)}):this._worker.on(d,function(){s.delay(r,arguments,l)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(d){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new _(this,{objectMode:this._outputType!=="nodebuffer"},d)}},I.exports=i},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(g,I,w){if(w.base64=!0,w.array=!0,w.string=!0,w.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",w.nodebuffer=typeof Buffer<"u",w.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")w.blob=!1;else{var s=new ArrayBuffer(0);try{w.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(s),w.blob=o.getBlob("application/zip").size===0}catch{w.blob=!1}}}try{w.nodestream=!!g("readable-stream").Readable}catch{w.nodestream=!1}},{"readable-stream":16}],31:[function(g,I,w){for(var s=g("./utils"),o=g("./support"),n=g("./nodejsUtils"),u=g("./stream/GenericWorker"),c=new Array(256),b=0;b<256;b++)c[b]=252<=b?6:248<=b?5:240<=b?4:224<=b?3:192<=b?2:1;c[254]=c[254]=1;function _(){u.call(this,"utf-8 decode"),this.leftOver=null}function m(){u.call(this,"utf-8 encode")}w.utf8encode=function(i){return o.nodebuffer?n.newBufferFrom(i,"utf-8"):function(d){var r,l,a,p,y,S=d.length,x=0;for(p=0;p<S;p++)(64512&(l=d.charCodeAt(p)))==55296&&p+1<S&&(64512&(a=d.charCodeAt(p+1)))==56320&&(l=65536+(l-55296<<10)+(a-56320),p++),x+=l<128?1:l<2048?2:l<65536?3:4;for(r=o.uint8array?new Uint8Array(x):new Array(x),p=y=0;y<x;p++)(64512&(l=d.charCodeAt(p)))==55296&&p+1<S&&(64512&(a=d.charCodeAt(p+1)))==56320&&(l=65536+(l-55296<<10)+(a-56320),p++),l<128?r[y++]=l:(l<2048?r[y++]=192|l>>>6:(l<65536?r[y++]=224|l>>>12:(r[y++]=240|l>>>18,r[y++]=128|l>>>12&63),r[y++]=128|l>>>6&63),r[y++]=128|63&l);return r}(i)},w.utf8decode=function(i){return o.nodebuffer?s.transformTo("nodebuffer",i).toString("utf-8"):function(d){var r,l,a,p,y=d.length,S=new Array(2*y);for(r=l=0;r<y;)if((a=d[r++])<128)S[l++]=a;else if(4<(p=c[a]))S[l++]=65533,r+=p-1;else{for(a&=p===2?31:p===3?15:7;1<p&&r<y;)a=a<<6|63&d[r++],p--;1<p?S[l++]=65533:a<65536?S[l++]=a:(a-=65536,S[l++]=55296|a>>10&1023,S[l++]=56320|1023&a)}return S.length!==l&&(S.subarray?S=S.subarray(0,l):S.length=l),s.applyFromCharCode(S)}(i=s.transformTo(o.uint8array?"uint8array":"array",i))},s.inherits(_,u),_.prototype.processChunk=function(i){var d=s.transformTo(o.uint8array?"uint8array":"array",i.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var r=d;(d=new Uint8Array(r.length+this.leftOver.length)).set(this.leftOver,0),d.set(r,this.leftOver.length)}else d=this.leftOver.concat(d);this.leftOver=null}var l=function(p,y){var S;for((y=y||p.length)>p.length&&(y=p.length),S=y-1;0<=S&&(192&p[S])==128;)S--;return S<0||S===0?y:S+c[p[S]]>y?S:y}(d),a=d;l!==d.length&&(o.uint8array?(a=d.subarray(0,l),this.leftOver=d.subarray(l,d.length)):(a=d.slice(0,l),this.leftOver=d.slice(l,d.length))),this.push({data:w.utf8decode(a),meta:i.meta})},_.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:w.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},w.Utf8DecodeWorker=_,s.inherits(m,u),m.prototype.processChunk=function(i){this.push({data:w.utf8encode(i.data),meta:i.meta})},w.Utf8EncodeWorker=m},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(g,I,w){var s=g("./support"),o=g("./base64"),n=g("./nodejsUtils"),u=g("./external");function c(r){return r}function b(r,l){for(var a=0;a<r.length;++a)l[a]=255&r.charCodeAt(a);return l}g("setimmediate"),w.newBlob=function(r,l){w.checkSupport("blob");try{return new Blob([r],{type:l})}catch{try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return a.append(r),a.getBlob(l)}catch{throw new Error("Bug : can't construct the Blob.")}}};var _={stringifyByChunk:function(r,l,a){var p=[],y=0,S=r.length;if(S<=a)return String.fromCharCode.apply(null,r);for(;y<S;)l==="array"||l==="nodebuffer"?p.push(String.fromCharCode.apply(null,r.slice(y,Math.min(y+a,S)))):p.push(String.fromCharCode.apply(null,r.subarray(y,Math.min(y+a,S)))),y+=a;return p.join("")},stringifyByChar:function(r){for(var l="",a=0;a<r.length;a++)l+=String.fromCharCode(r[a]);return l},applyCanBeUsed:{uint8array:function(){try{return s.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return s.nodebuffer&&String.fromCharCode.apply(null,n.allocBuffer(1)).length===1}catch{return!1}}()}};function m(r){var l=65536,a=w.getTypeOf(r),p=!0;if(a==="uint8array"?p=_.applyCanBeUsed.uint8array:a==="nodebuffer"&&(p=_.applyCanBeUsed.nodebuffer),p)for(;1<l;)try{return _.stringifyByChunk(r,a,l)}catch{l=Math.floor(l/2)}return _.stringifyByChar(r)}function i(r,l){for(var a=0;a<r.length;a++)l[a]=r[a];return l}w.applyFromCharCode=m;var d={};d.string={string:c,array:function(r){return b(r,new Array(r.length))},arraybuffer:function(r){return d.string.uint8array(r).buffer},uint8array:function(r){return b(r,new Uint8Array(r.length))},nodebuffer:function(r){return b(r,n.allocBuffer(r.length))}},d.array={string:m,array:c,arraybuffer:function(r){return new Uint8Array(r).buffer},uint8array:function(r){return new Uint8Array(r)},nodebuffer:function(r){return n.newBufferFrom(r)}},d.arraybuffer={string:function(r){return m(new Uint8Array(r))},array:function(r){return i(new Uint8Array(r),new Array(r.byteLength))},arraybuffer:c,uint8array:function(r){return new Uint8Array(r)},nodebuffer:function(r){return n.newBufferFrom(new Uint8Array(r))}},d.uint8array={string:m,array:function(r){return i(r,new Array(r.length))},arraybuffer:function(r){return r.buffer},uint8array:c,nodebuffer:function(r){return n.newBufferFrom(r)}},d.nodebuffer={string:m,array:function(r){return i(r,new Array(r.length))},arraybuffer:function(r){return d.nodebuffer.uint8array(r).buffer},uint8array:function(r){return i(r,new Uint8Array(r.length))},nodebuffer:c},w.transformTo=function(r,l){if(l=l||"",!r)return l;w.checkSupport(r);var a=w.getTypeOf(l);return d[a][r](l)},w.resolve=function(r){for(var l=r.split("/"),a=[],p=0;p<l.length;p++){var y=l[p];y==="."||y===""&&p!==0&&p!==l.length-1||(y===".."?a.pop():a.push(y))}return a.join("/")},w.getTypeOf=function(r){return typeof r=="string"?"string":Object.prototype.toString.call(r)==="[object Array]"?"array":s.nodebuffer&&n.isBuffer(r)?"nodebuffer":s.uint8array&&r instanceof Uint8Array?"uint8array":s.arraybuffer&&r instanceof ArrayBuffer?"arraybuffer":void 0},w.checkSupport=function(r){if(!s[r.toLowerCase()])throw new Error(r+" is not supported by this platform")},w.MAX_VALUE_16BITS=65535,w.MAX_VALUE_32BITS=-1,w.pretty=function(r){var l,a,p="";for(a=0;a<(r||"").length;a++)p+="\\x"+((l=r.charCodeAt(a))<16?"0":"")+l.toString(16).toUpperCase();return p},w.delay=function(r,l,a){setImmediate(function(){r.apply(a||null,l||[])})},w.inherits=function(r,l){function a(){}a.prototype=l.prototype,r.prototype=new a},w.extend=function(){var r,l,a={};for(r=0;r<arguments.length;r++)for(l in arguments[r])Object.prototype.hasOwnProperty.call(arguments[r],l)&&a[l]===void 0&&(a[l]=arguments[r][l]);return a},w.prepareContent=function(r,l,a,p,y){return u.Promise.resolve(l).then(function(S){return s.blob&&(S instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(S))!==-1)&&typeof FileReader<"u"?new u.Promise(function(x,F){var B=new FileReader;B.onload=function(L){x(L.target.result)},B.onerror=function(L){F(L.target.error)},B.readAsArrayBuffer(S)}):S}).then(function(S){var x=w.getTypeOf(S);return x?(x==="arraybuffer"?S=w.transformTo("uint8array",S):x==="string"&&(y?S=o.decode(S):a&&p!==!0&&(S=function(F){return b(F,s.uint8array?new Uint8Array(F.length):new Array(F.length))}(S))),S):u.Promise.reject(new Error("Can't read the data of '"+r+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(g,I,w){var s=g("./reader/readerFor"),o=g("./utils"),n=g("./signature"),u=g("./zipEntry"),c=g("./support");function b(_){this.files=[],this.loadOptions=_}b.prototype={checkSignature:function(_){if(!this.reader.readAndCheckSignature(_)){this.reader.index-=4;var m=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+o.pretty(m)+", expected "+o.pretty(_)+")")}},isSignature:function(_,m){var i=this.reader.index;this.reader.setIndex(_);var d=this.reader.readString(4)===m;return this.reader.setIndex(i),d},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 _=this.reader.readData(this.zipCommentLength),m=c.uint8array?"uint8array":"array",i=o.transformTo(m,_);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 _,m,i,d=this.zip64EndOfCentralSize-44;0<d;)_=this.reader.readInt(2),m=this.reader.readInt(4),i=this.reader.readData(m),this.zip64ExtensibleData[_]={id:_,length:m,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 _,m;for(_=0;_<this.files.length;_++)m=this.files[_],this.reader.setIndex(m.localHeaderOffset),this.checkSignature(n.LOCAL_FILE_HEADER),m.readLocalPart(this.reader),m.handleUTF8(),m.processAttributes()},readCentralDir:function(){var _;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(n.CENTRAL_FILE_HEADER);)(_=new u({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(_);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var _=this.reader.lastIndexOfSignature(n.CENTRAL_DIRECTORY_END);if(_<0)throw this.isSignature(0,n.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(_);var m=_;if(this.checkSignature(n.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===o.MAX_VALUE_16BITS||this.diskWithCentralDirStart===o.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===o.MAX_VALUE_16BITS||this.centralDirRecords===o.MAX_VALUE_16BITS||this.centralDirSize===o.MAX_VALUE_32BITS||this.centralDirOffset===o.MAX_VALUE_32BITS){if(this.zip64=!0,(_=this.reader.lastIndexOfSignature(n.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(_),this.checkSignature(n.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,n.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(n.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(n.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var i=this.centralDirOffset+this.centralDirSize;this.zip64&&(i+=20,i+=12+this.zip64EndOfCentralSize);var d=m-i;if(0<d)this.isSignature(m,n.CENTRAL_FILE_HEADER)||(this.reader.zero=d);else if(d<0)throw new Error("Corrupted zip: missing "+Math.abs(d)+" bytes.")},prepareReader:function(_){this.reader=s(_)},load:function(_){this.prepareReader(_),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},I.exports=b},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(g,I,w){var s=g("./reader/readerFor"),o=g("./utils"),n=g("./compressedObject"),u=g("./crc32"),c=g("./utf8"),b=g("./compressions"),_=g("./support");function m(i,d){this.options=i,this.loadOptions=d}m.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(i){var d,r;if(i.skip(22),this.fileNameLength=i.readInt(2),r=i.readInt(2),this.fileName=i.readData(this.fileNameLength),i.skip(r),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((d=function(l){for(var a in b)if(Object.prototype.hasOwnProperty.call(b,a)&&b[a].magic===l)return b[a];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new n(this.compressedSize,this.uncompressedSize,this.crc32,d,i.readData(this.compressedSize))},readCentralPart:function(i){this.versionMadeBy=i.readInt(2),i.skip(2),this.bitFlag=i.readInt(2),this.compressionMethod=i.readString(2),this.date=i.readDate(),this.crc32=i.readInt(4),this.compressedSize=i.readInt(4),this.uncompressedSize=i.readInt(4);var d=i.readInt(2);if(this.extraFieldsLength=i.readInt(2),this.fileCommentLength=i.readInt(2),this.diskNumberStart=i.readInt(2),this.internalFileAttributes=i.readInt(2),this.externalFileAttributes=i.readInt(4),this.localHeaderOffset=i.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");i.skip(d),this.readExtraFields(i),this.parseZIP64ExtraField(i),this.fileComment=i.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var i=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),i==0&&(this.dosPermissions=63&this.externalFileAttributes),i==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var i=s(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=i.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=i.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=i.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=i.readInt(4))}},readExtraFields:function(i){var d,r,l,a=i.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});i.index+4<a;)d=i.readInt(2),r=i.readInt(2),l=i.readData(r),this.extraFields[d]={id:d,length:r,value:l};i.setIndex(a)},handleUTF8:function(){var i=_.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=c.utf8decode(this.fileName),this.fileCommentStr=c.utf8decode(this.fileComment);else{var d=this.findExtraFieldUnicodePath();if(d!==null)this.fileNameStr=d;else{var r=o.transformTo(i,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r)}var l=this.findExtraFieldUnicodeComment();if(l!==null)this.fileCommentStr=l;else{var a=o.transformTo(i,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(a)}}},findExtraFieldUnicodePath:function(){var i=this.extraFields[28789];if(i){var d=s(i.value);return d.readInt(1)!==1||u(this.fileName)!==d.readInt(4)?null:c.utf8decode(d.readData(i.length-5))}return null},findExtraFieldUnicodeComment:function(){var i=this.extraFields[25461];if(i){var d=s(i.value);return d.readInt(1)!==1||u(this.fileComment)!==d.readInt(4)?null:c.utf8decode(d.readData(i.length-5))}return null}},I.exports=m},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(g,I,w){function s(d,r,l){this.name=d,this.dir=l.dir,this.date=l.date,this.comment=l.comment,this.unixPermissions=l.unixPermissions,this.dosPermissions=l.dosPermissions,this._data=r,this._dataBinary=l.binary,this.options={compression:l.compression,compressionOptions:l.compressionOptions}}var o=g("./stream/StreamHelper"),n=g("./stream/DataWorker"),u=g("./utf8"),c=g("./compressedObject"),b=g("./stream/GenericWorker");s.prototype={internalStream:function(d){var r=null,l="string";try{if(!d)throw new Error("No output type specified.");var a=(l=d.toLowerCase())==="string"||l==="text";l!=="binarystring"&&l!=="text"||(l="string"),r=this._decompressWorker();var p=!this._dataBinary;p&&!a&&(r=r.pipe(new u.Utf8EncodeWorker)),!p&&a&&(r=r.pipe(new u.Utf8DecodeWorker))}catch(y){(r=new b("error")).error(y)}return new o(r,l,"")},async:function(d,r){return this.internalStream(d).accumulate(r)},nodeStream:function(d,r){return this.internalStream(d||"nodebuffer").toNodejsStream(r)},_compressWorker:function(d,r){if(this._data instanceof c&&this._data.compression.magic===d.magic)return this._data.getCompressedWorker();var l=this._decompressWorker();return this._dataBinary||(l=l.pipe(new u.Utf8EncodeWorker)),c.createWorkerFrom(l,d,r)},_decompressWorker:function(){return this._data instanceof c?this._data.getContentWorker():this._data instanceof b?this._data:new n(this._data)}};for(var _=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],m=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},i=0;i<_.length;i++)s.prototype[_[i]]=m;I.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(g,I,w){(function(s){var o,n,u=s.MutationObserver||s.WebKitMutationObserver;if(u){var c=0,b=new u(d),_=s.document.createTextNode("");b.observe(_,{characterData:!0}),o=function(){_.data=c=++c%2}}else if(s.setImmediate||s.MessageChannel===void 0)o="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var r=s.document.createElement("script");r.onreadystatechange=function(){d(),r.onreadystatechange=null,r.parentNode.removeChild(r),r=null},s.document.documentElement.appendChild(r)}:function(){setTimeout(d,0)};else{var m=new s.MessageChannel;m.port1.onmessage=d,o=function(){m.port2.postMessage(0)}}var i=[];function d(){var r,l;n=!0;for(var a=i.length;a;){for(l=i,i=[],r=-1;++r<a;)l[r]();a=i.length}n=!1}I.exports=function(r){i.push(r)!==1||n||o()}}).call(this,typeof ct.commonjsGlobal<"u"?ct.commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(g,I,w){var s=g("immediate");function o(){}var n={},u=["REJECTED"],c=["FULFILLED"],b=["PENDING"];function _(a){if(typeof a!="function")throw new TypeError("resolver must be a function");this.state=b,this.queue=[],this.outcome=void 0,a!==o&&r(this,a)}function m(a,p,y){this.promise=a,typeof p=="function"&&(this.onFulfilled=p,this.callFulfilled=this.otherCallFulfilled),typeof y=="function"&&(this.onRejected=y,this.callRejected=this.otherCallRejected)}function i(a,p,y){s(function(){var S;try{S=p(y)}catch(x){return n.reject(a,x)}S===a?n.reject(a,new TypeError("Cannot resolve promise with itself")):n.resolve(a,S)})}function d(a){var p=a&&a.then;if(a&&(typeof a=="object"||typeof a=="function")&&typeof p=="function")return function(){p.apply(a,arguments)}}function r(a,p){var y=!1;function S(B){y||(y=!0,n.reject(a,B))}function x(B){y||(y=!0,n.resolve(a,B))}var F=l(function(){p(x,S)});F.status==="error"&&S(F.value)}function l(a,p){var y={};try{y.value=a(p),y.status="success"}catch(S){y.status="error",y.value=S}return y}(I.exports=_).prototype.finally=function(a){if(typeof a!="function")return this;var p=this.constructor;return this.then(function(y){return p.resolve(a()).then(function(){return y})},function(y){return p.resolve(a()).then(function(){throw y})})},_.prototype.catch=function(a){return this.then(null,a)},_.prototype.then=function(a,p){if(typeof a!="function"&&this.state===c||typeof p!="function"&&this.state===u)return this;var y=new this.constructor(o);return this.state!==b?i(y,this.state===c?a:p,this.outcome):this.queue.push(new m(y,a,p)),y},m.prototype.callFulfilled=function(a){n.resolve(this.promise,a)},m.prototype.otherCallFulfilled=function(a){i(this.promise,this.onFulfilled,a)},m.prototype.callRejected=function(a){n.reject(this.promise,a)},m.prototype.otherCallRejected=function(a){i(this.promise,this.onRejected,a)},n.resolve=function(a,p){var y=l(d,p);if(y.status==="error")return n.reject(a,y.value);var S=y.value;if(S)r(a,S);else{a.state=c,a.outcome=p;for(var x=-1,F=a.queue.length;++x<F;)a.queue[x].callFulfilled(p)}return a},n.reject=function(a,p){a.state=u,a.outcome=p;for(var y=-1,S=a.queue.length;++y<S;)a.queue[y].callRejected(p);return a},_.resolve=function(a){return a instanceof this?a:n.resolve(new this(o),a)},_.reject=function(a){var p=new this(o);return n.reject(p,a)},_.all=function(a){var p=this;if(Object.prototype.toString.call(a)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=a.length,S=!1;if(!y)return this.resolve([]);for(var x=new Array(y),F=0,B=-1,L=new this(o);++B<y;)O(a[B],B);return L;function O(W,q){p.resolve(W).then(function(v){x[q]=v,++F!==y||S||(S=!0,n.resolve(L,x))},function(v){S||(S=!0,n.reject(L,v))})}},_.race=function(a){var p=this;if(Object.prototype.toString.call(a)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=a.length,S=!1;if(!y)return this.resolve([]);for(var x=-1,F=new this(o);++x<y;)B=a[x],p.resolve(B).then(function(L){S||(S=!0,n.resolve(F,L))},function(L){S||(S=!0,n.reject(F,L))});var B;return F}},{immediate:36}],38:[function(g,I,w){var s={};(0,g("./lib/utils/common").assign)(s,g("./lib/deflate"),g("./lib/inflate"),g("./lib/zlib/constants")),I.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(g,I,w){var s=g("./zlib/deflate"),o=g("./utils/common"),n=g("./utils/strings"),u=g("./zlib/messages"),c=g("./zlib/zstream"),b=Object.prototype.toString,_=0,m=-1,i=0,d=8;function r(a){if(!(this instanceof r))return new r(a);this.options=o.assign({level:m,method:d,chunkSize:16384,windowBits:15,memLevel:8,strategy:i,to:""},a||{});var p=this.options;p.raw&&0<p.windowBits?p.windowBits=-p.windowBits:p.gzip&&0<p.windowBits&&p.windowBits<16&&(p.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var y=s.deflateInit2(this.strm,p.level,p.method,p.windowBits,p.memLevel,p.strategy);if(y!==_)throw new Error(u[y]);if(p.header&&s.deflateSetHeader(this.strm,p.header),p.dictionary){var S;if(S=typeof p.dictionary=="string"?n.string2buf(p.dictionary):b.call(p.dictionary)==="[object ArrayBuffer]"?new Uint8Array(p.dictionary):p.dictionary,(y=s.deflateSetDictionary(this.strm,S))!==_)throw new Error(u[y]);this._dict_set=!0}}function l(a,p){var y=new r(p);if(y.push(a,!0),y.err)throw y.msg||u[y.err];return y.result}r.prototype.push=function(a,p){var y,S,x=this.strm,F=this.options.chunkSize;if(this.ended)return!1;S=p===~~p?p:p===!0?4:0,typeof a=="string"?x.input=n.string2buf(a):b.call(a)==="[object ArrayBuffer]"?x.input=new Uint8Array(a):x.input=a,x.next_in=0,x.avail_in=x.input.length;do{if(x.avail_out===0&&(x.output=new o.Buf8(F),x.next_out=0,x.avail_out=F),(y=s.deflate(x,S))!==1&&y!==_)return this.onEnd(y),!(this.ended=!0);x.avail_out!==0&&(x.avail_in!==0||S!==4&&S!==2)||(this.options.to==="string"?this.onData(n.buf2binstring(o.shrinkBuf(x.output,x.next_out))):this.onData(o.shrinkBuf(x.output,x.next_out)))}while((0<x.avail_in||x.avail_out===0)&&y!==1);return S===4?(y=s.deflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===_):S!==2||(this.onEnd(_),!(x.avail_out=0))},r.prototype.onData=function(a){this.chunks.push(a)},r.prototype.onEnd=function(a){a===_&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},w.Deflate=r,w.deflate=l,w.deflateRaw=function(a,p){return(p=p||{}).raw=!0,l(a,p)},w.gzip=function(a,p){return(p=p||{}).gzip=!0,l(a,p)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(g,I,w){var s=g("./zlib/inflate"),o=g("./utils/common"),n=g("./utils/strings"),u=g("./zlib/constants"),c=g("./zlib/messages"),b=g("./zlib/zstream"),_=g("./zlib/gzheader"),m=Object.prototype.toString;function i(r){if(!(this instanceof i))return new i(r);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},r||{});var l=this.options;l.raw&&0<=l.windowBits&&l.windowBits<16&&(l.windowBits=-l.windowBits,l.windowBits===0&&(l.windowBits=-15)),!(0<=l.windowBits&&l.windowBits<16)||r&&r.windowBits||(l.windowBits+=32),15<l.windowBits&&l.windowBits<48&&!(15&l.windowBits)&&(l.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new b,this.strm.avail_out=0;var a=s.inflateInit2(this.strm,l.windowBits);if(a!==u.Z_OK)throw new Error(c[a]);this.header=new _,s.inflateGetHeader(this.strm,this.header)}function d(r,l){var a=new i(l);if(a.push(r,!0),a.err)throw a.msg||c[a.err];return a.result}i.prototype.push=function(r,l){var a,p,y,S,x,F,B=this.strm,L=this.options.chunkSize,O=this.options.dictionary,W=!1;if(this.ended)return!1;p=l===~~l?l:l===!0?u.Z_FINISH:u.Z_NO_FLUSH,typeof r=="string"?B.input=n.binstring2buf(r):m.call(r)==="[object ArrayBuffer]"?B.input=new Uint8Array(r):B.input=r,B.next_in=0,B.avail_in=B.input.length;do{if(B.avail_out===0&&(B.output=new o.Buf8(L),B.next_out=0,B.avail_out=L),(a=s.inflate(B,u.Z_NO_FLUSH))===u.Z_NEED_DICT&&O&&(F=typeof O=="string"?n.string2buf(O):m.call(O)==="[object ArrayBuffer]"?new Uint8Array(O):O,a=s.inflateSetDictionary(this.strm,F)),a===u.Z_BUF_ERROR&&W===!0&&(a=u.Z_OK,W=!1),a!==u.Z_STREAM_END&&a!==u.Z_OK)return this.onEnd(a),!(this.ended=!0);B.next_out&&(B.avail_out!==0&&a!==u.Z_STREAM_END&&(B.avail_in!==0||p!==u.Z_FINISH&&p!==u.Z_SYNC_FLUSH)||(this.options.to==="string"?(y=n.utf8border(B.output,B.next_out),S=B.next_out-y,x=n.buf2string(B.output,y),B.next_out=S,B.avail_out=L-S,S&&o.arraySet(B.output,B.output,y,S,0),this.onData(x)):this.onData(o.shrinkBuf(B.output,B.next_out)))),B.avail_in===0&&B.avail_out===0&&(W=!0)}while((0<B.avail_in||B.avail_out===0)&&a!==u.Z_STREAM_END);return a===u.Z_STREAM_END&&(p=u.Z_FINISH),p===u.Z_FINISH?(a=s.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===u.Z_OK):p!==u.Z_SYNC_FLUSH||(this.onEnd(u.Z_OK),!(B.avail_out=0))},i.prototype.onData=function(r){this.chunks.push(r)},i.prototype.onEnd=function(r){r===u.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg},w.Inflate=i,w.inflate=d,w.inflateRaw=function(r,l){return(l=l||{}).raw=!0,d(r,l)},w.ungzip=d},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(g,I,w){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";w.assign=function(u){for(var c=Array.prototype.slice.call(arguments,1);c.length;){var b=c.shift();if(b){if(typeof b!="object")throw new TypeError(b+"must be non-object");for(var _ in b)b.hasOwnProperty(_)&&(u[_]=b[_])}}return u},w.shrinkBuf=function(u,c){return u.length===c?u:u.subarray?u.subarray(0,c):(u.length=c,u)};var o={arraySet:function(u,c,b,_,m){if(c.subarray&&u.subarray)u.set(c.subarray(b,b+_),m);else for(var i=0;i<_;i++)u[m+i]=c[b+i]},flattenChunks:function(u){var c,b,_,m,i,d;for(c=_=0,b=u.length;c<b;c++)_+=u[c].length;for(d=new Uint8Array(_),c=m=0,b=u.length;c<b;c++)i=u[c],d.set(i,m),m+=i.length;return d}},n={arraySet:function(u,c,b,_,m){for(var i=0;i<_;i++)u[m+i]=c[b+i]},flattenChunks:function(u){return[].concat.apply([],u)}};w.setTyped=function(u){u?(w.Buf8=Uint8Array,w.Buf16=Uint16Array,w.Buf32=Int32Array,w.assign(w,o)):(w.Buf8=Array,w.Buf16=Array,w.Buf32=Array,w.assign(w,n))},w.setTyped(s)},{}],42:[function(g,I,w){var s=g("./common"),o=!0,n=!0;try{String.fromCharCode.apply(null,[0])}catch{o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{n=!1}for(var u=new s.Buf8(256),c=0;c<256;c++)u[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function b(_,m){if(m<65537&&(_.subarray&&n||!_.subarray&&o))return String.fromCharCode.apply(null,s.shrinkBuf(_,m));for(var i="",d=0;d<m;d++)i+=String.fromCharCode(_[d]);return i}u[254]=u[254]=1,w.string2buf=function(_){var m,i,d,r,l,a=_.length,p=0;for(r=0;r<a;r++)(64512&(i=_.charCodeAt(r)))==55296&&r+1<a&&(64512&(d=_.charCodeAt(r+1)))==56320&&(i=65536+(i-55296<<10)+(d-56320),r++),p+=i<128?1:i<2048?2:i<65536?3:4;for(m=new s.Buf8(p),r=l=0;l<p;r++)(64512&(i=_.charCodeAt(r)))==55296&&r+1<a&&(64512&(d=_.charCodeAt(r+1)))==56320&&(i=65536+(i-55296<<10)+(d-56320),r++),i<128?m[l++]=i:(i<2048?m[l++]=192|i>>>6:(i<65536?m[l++]=224|i>>>12:(m[l++]=240|i>>>18,m[l++]=128|i>>>12&63),m[l++]=128|i>>>6&63),m[l++]=128|63&i);return m},w.buf2binstring=function(_){return b(_,_.length)},w.binstring2buf=function(_){for(var m=new s.Buf8(_.length),i=0,d=m.length;i<d;i++)m[i]=_.charCodeAt(i);return m},w.buf2string=function(_,m){var i,d,r,l,a=m||_.length,p=new Array(2*a);for(i=d=0;i<a;)if((r=_[i++])<128)p[d++]=r;else if(4<(l=u[r]))p[d++]=65533,i+=l-1;else{for(r&=l===2?31:l===3?15:7;1<l&&i<a;)r=r<<6|63&_[i++],l--;1<l?p[d++]=65533:r<65536?p[d++]=r:(r-=65536,p[d++]=55296|r>>10&1023,p[d++]=56320|1023&r)}return b(p,d)},w.utf8border=function(_,m){var i;for((m=m||_.length)>_.length&&(m=_.length),i=m-1;0<=i&&(192&_[i])==128;)i--;return i<0||i===0?m:i+u[_[i]]>m?i:m}},{"./common":41}],43:[function(g,I,w){I.exports=function(s,o,n,u){for(var c=65535&s|0,b=s>>>16&65535|0,_=0;n!==0;){for(n-=_=2e3<n?2e3:n;b=b+(c=c+o[u++]|0)|0,--_;);c%=65521,b%=65521}return c|b<<16|0}},{}],44:[function(g,I,w){I.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(g,I,w){var s=function(){for(var o,n=[],u=0;u<256;u++){o=u;for(var c=0;c<8;c++)o=1&o?3988292384^o>>>1:o>>>1;n[u]=o}return n}();I.exports=function(o,n,u,c){var b=s,_=c+u;o^=-1;for(var m=c;m<_;m++)o=o>>>8^b[255&(o^n[m])];return-1^o}},{}],46:[function(g,I,w){var s,o=g("../utils/common"),n=g("./trees"),u=g("./adler32"),c=g("./crc32"),b=g("./messages"),_=0,m=4,i=0,d=-2,r=-1,l=4,a=2,p=8,y=9,S=286,x=30,F=19,B=2*S+1,L=15,O=3,W=258,q=W+O+1,v=42,R=113,e=1,D=2,J=3,j=4;function $(t,T){return t.msg=b[T],T}function P(t){return(t<<1)-(4<t?9:0)}function V(t){for(var T=t.length;0<=--T;)t[T]=0}function A(t){var T=t.state,C=T.pending;C>t.avail_out&&(C=t.avail_out),C!==0&&(o.arraySet(t.output,T.pending_buf,T.pending_out,C,t.next_out),t.next_out+=C,T.pending_out+=C,t.total_out+=C,t.avail_out-=C,T.pending-=C,T.pending===0&&(T.pending_out=0))}function z(t,T){n._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,T),t.block_start=t.strstart,A(t.strm)}function X(t,T){t.pending_buf[t.pending++]=T}function H(t,T){t.pending_buf[t.pending++]=T>>>8&255,t.pending_buf[t.pending++]=255&T}function G(t,T){var C,f,h=t.max_chain_length,k=t.strstart,U=t.prev_length,N=t.nice_match,E=t.strstart>t.w_size-q?t.strstart-(t.w_size-q):0,Z=t.window,K=t.w_mask,M=t.prev,Y=t.strstart+W,nt=Z[k+U-1],tt=Z[k+U];t.prev_length>=t.good_match&&(h>>=2),N>t.lookahead&&(N=t.lookahead);do if(Z[(C=T)+U]===tt&&Z[C+U-1]===nt&&Z[C]===Z[k]&&Z[++C]===Z[k+1]){k+=2,C++;do;while(Z[++k]===Z[++C]&&Z[++k]===Z[++C]&&Z[++k]===Z[++C]&&Z[++k]===Z[++C]&&Z[++k]===Z[++C]&&Z[++k]===Z[++C]&&Z[++k]===Z[++C]&&Z[++k]===Z[++C]&&k<Y);if(f=W-(Y-k),k=Y-W,U<f){if(t.match_start=T,N<=(U=f))break;nt=Z[k+U-1],tt=Z[k+U]}}while((T=M[T&K])>E&&--h!=0);return U<=t.lookahead?U:t.lookahead}function it(t){var T,C,f,h,k,U,N,E,Z,K,M=t.w_size;do{if(h=t.window_size-t.lookahead-t.strstart,t.strstart>=M+(M-q)){for(o.arraySet(t.window,t.window,M,M,0),t.match_start-=M,t.strstart-=M,t.block_start-=M,T=C=t.hash_size;f=t.head[--T],t.head[T]=M<=f?f-M:0,--C;);for(T=C=M;f=t.prev[--T],t.prev[T]=M<=f?f-M:0,--C;);h+=M}if(t.strm.avail_in===0)break;if(U=t.strm,N=t.window,E=t.strstart+t.lookahead,Z=h,K=void 0,K=U.avail_in,Z<K&&(K=Z),C=K===0?0:(U.avail_in-=K,o.arraySet(N,U.input,U.next_in,K,E),U.state.wrap===1?U.adler=u(U.adler,N,K,E):U.state.wrap===2&&(U.adler=c(U.adler,N,K,E)),U.next_in+=K,U.total_in+=K,K),t.lookahead+=C,t.lookahead+t.insert>=O)for(k=t.strstart-t.insert,t.ins_h=t.window[k],t.ins_h=(t.ins_h<<t.hash_shift^t.window[k+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[k+O-1])&t.hash_mask,t.prev[k&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=k,k++,t.insert--,!(t.lookahead+t.insert<O)););}while(t.lookahead<q&&t.strm.avail_in!==0)}function ut(t,T){for(var C,f;;){if(t.lookahead<q){if(it(t),t.lookahead<q&&T===_)return e;if(t.lookahead===0)break}if(C=0,t.lookahead>=O&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+O-1])&t.hash_mask,C=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),C!==0&&t.strstart-C<=t.w_size-q&&(t.match_length=G(t,C)),t.match_length>=O)if(f=n._tr_tally(t,t.strstart-t.match_start,t.match_length-O),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=O){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+O-1])&t.hash_mask,C=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart,--t.match_length!=0;);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else f=n._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(f&&(z(t,!1),t.strm.avail_out===0))return e}return t.insert=t.strstart<O-1?t.strstart:O-1,T===m?(z(t,!0),t.strm.avail_out===0?J:j):t.last_lit&&(z(t,!1),t.strm.avail_out===0)?e:D}function Q(t,T){for(var C,f,h;;){if(t.lookahead<q){if(it(t),t.lookahead<q&&T===_)return e;if(t.lookahead===0)break}if(C=0,t.lookahead>=O&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+O-1])&t.hash_mask,C=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=O-1,C!==0&&t.prev_length<t.max_lazy_match&&t.strstart-C<=t.w_size-q&&(t.match_length=G(t,C),t.match_length<=5&&(t.strategy===1||t.match_length===O&&4096<t.strstart-t.match_start)&&(t.match_length=O-1)),t.prev_length>=O&&t.match_length<=t.prev_length){for(h=t.strstart+t.lookahead-O,f=n._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-O),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=h&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+O-1])&t.hash_mask,C=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),--t.prev_length!=0;);if(t.match_available=0,t.match_length=O-1,t.strstart++,f&&(z(t,!1),t.strm.avail_out===0))return e}else if(t.match_available){if((f=n._tr_tally(t,0,t.window[t.strstart-1]))&&z(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return e}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(f=n._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<O-1?t.strstart:O-1,T===m?(z(t,!0),t.strm.avail_out===0?J:j):t.last_lit&&(z(t,!1),t.strm.avail_out===0)?e:D}function rt(t,T,C,f,h){this.good_length=t,this.max_lazy=T,this.nice_length=C,this.max_chain=f,this.func=h}function ht(){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 o.Buf16(2*B),this.dyn_dtree=new o.Buf16(2*(2*x+1)),this.bl_tree=new o.Buf16(2*(2*F+1)),V(this.dyn_ltree),V(this.dyn_dtree),V(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(L+1),this.heap=new o.Buf16(2*S+1),V(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*S+1),V(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 at(t){var T;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=a,(T=t.state).pending=0,T.pending_out=0,T.wrap<0&&(T.wrap=-T.wrap),T.status=T.wrap?v:R,t.adler=T.wrap===2?0:1,T.last_flush=_,n._tr_init(T),i):$(t,d)}function dt(t){var T=at(t);return T===i&&function(C){C.window_size=2*C.w_size,V(C.head),C.max_lazy_match=s[C.level].max_lazy,C.good_match=s[C.level].good_length,C.nice_match=s[C.level].nice_length,C.max_chain_length=s[C.level].max_chain,C.strstart=0,C.block_start=0,C.lookahead=0,C.insert=0,C.match_length=C.prev_length=O-1,C.match_available=0,C.ins_h=0}(t.state),T}function ft(t,T,C,f,h,k){if(!t)return d;var U=1;if(T===r&&(T=6),f<0?(U=0,f=-f):15<f&&(U=2,f-=16),h<1||y<h||C!==p||f<8||15<f||T<0||9<T||k<0||l<k)return $(t,d);f===8&&(f=9);var N=new ht;return(t.state=N).strm=t,N.wrap=U,N.gzhead=null,N.w_bits=f,N.w_size=1<<N.w_bits,N.w_mask=N.w_size-1,N.hash_bits=h+7,N.hash_size=1<<N.hash_bits,N.hash_mask=N.hash_size-1,N.hash_shift=~~((N.hash_bits+O-1)/O),N.window=new o.Buf8(2*N.w_size),N.head=new o.Buf16(N.hash_size),N.prev=new o.Buf16(N.w_size),N.lit_bufsize=1<<h+6,N.pending_buf_size=4*N.lit_bufsize,N.pending_buf=new o.Buf8(N.pending_buf_size),N.d_buf=1*N.lit_bufsize,N.l_buf=3*N.lit_bufsize,N.level=T,N.strategy=k,N.method=C,dt(t)}s=[new rt(0,0,0,0,function(t,T){var C=65535;for(C>t.pending_buf_size-5&&(C=t.pending_buf_size-5);;){if(t.lookahead<=1){if(it(t),t.lookahead===0&&T===_)return e;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var f=t.block_start+C;if((t.strstart===0||t.strstart>=f)&&(t.lookahead=t.strstart-f,t.strstart=f,z(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-q&&(z(t,!1),t.strm.avail_out===0))return e}return t.insert=0,T===m?(z(t,!0),t.strm.avail_out===0?J:j):(t.strstart>t.block_start&&(z(t,!1),t.strm.avail_out),e)}),new rt(4,4,8,4,ut),new rt(4,5,16,8,ut),new rt(4,6,32,32,ut),new rt(4,4,16,16,Q),new rt(8,16,32,32,Q),new rt(8,16,128,128,Q),new rt(8,32,128,256,Q),new rt(32,128,258,1024,Q),new rt(32,258,258,4096,Q)],w.deflateInit=function(t,T){return ft(t,T,p,15,8,0)},w.deflateInit2=ft,w.deflateReset=dt,w.deflateResetKeep=at,w.deflateSetHeader=function(t,T){return t&&t.state?t.state.wrap!==2?d:(t.state.gzhead=T,i):d},w.deflate=function(t,T){var C,f,h,k;if(!t||!t.state||5<T||T<0)return t?$(t,d):d;if(f=t.state,!t.output||!t.input&&t.avail_in!==0||f.status===666&&T!==m)return $(t,t.avail_out===0?-5:d);if(f.strm=t,C=f.last_flush,f.last_flush=T,f.status===v)if(f.wrap===2)t.adler=0,X(f,31),X(f,139),X(f,8),f.gzhead?(X(f,(f.gzhead.text?1:0)+(f.gzhead.hcrc?2:0)+(f.gzhead.extra?4:0)+(f.gzhead.name?8:0)+(f.gzhead.comment?16:0)),X(f,255&f.gzhead.time),X(f,f.gzhead.time>>8&255),X(f,f.gzhead.time>>16&255),X(f,f.gzhead.time>>24&255),X(f,f.level===9?2:2<=f.strategy||f.level<2?4:0),X(f,255&f.gzhead.os),f.gzhead.extra&&f.gzhead.extra.length&&(X(f,255&f.gzhead.extra.length),X(f,f.gzhead.extra.length>>8&255)),f.gzhead.hcrc&&(t.adler=c(t.adler,f.pending_buf,f.pending,0)),f.gzindex=0,f.status=69):(X(f,0),X(f,0),X(f,0),X(f,0),X(f,0),X(f,f.level===9?2:2<=f.strategy||f.level<2?4:0),X(f,3),f.status=R);else{var U=p+(f.w_bits-8<<4)<<8;U|=(2<=f.strategy||f.level<2?0:f.level<6?1:f.level===6?2:3)<<6,f.strstart!==0&&(U|=32),U+=31-U%31,f.status=R,H(f,U),f.strstart!==0&&(H(f,t.adler>>>16),H(f,65535&t.adler)),t.adler=1}if(f.status===69)if(f.gzhead.extra){for(h=f.pending;f.gzindex<(65535&f.gzhead.extra.length)&&(f.pending!==f.pending_buf_size||(f.gzhead.hcrc&&f.pending>h&&(t.adler=c(t.adler,f.pending_buf,f.pending-h,h)),A(t),h=f.pending,f.pending!==f.pending_buf_size));)X(f,255&f.gzhead.extra[f.gzindex]),f.gzindex++;f.gzhead.hcrc&&f.pending>h&&(t.adler=c(t.adler,f.pending_buf,f.pending-h,h)),f.gzindex===f.gzhead.extra.length&&(f.gzindex=0,f.status=73)}else f.status=73;if(f.status===73)if(f.gzhead.name){h=f.pending;do{if(f.pending===f.pending_buf_size&&(f.gzhead.hcrc&&f.pending>h&&(t.adler=c(t.adler,f.pending_buf,f.pending-h,h)),A(t),h=f.pending,f.pending===f.pending_buf_size)){k=1;break}k=f.gzindex<f.gzhead.name.length?255&f.gzhead.name.charCodeAt(f.gzindex++):0,X(f,k)}while(k!==0);f.gzhead.hcrc&&f.pending>h&&(t.adler=c(t.adler,f.pending_buf,f.pending-h,h)),k===0&&(f.gzindex=0,f.status=91)}else f.status=91;if(f.status===91)if(f.gzhead.comment){h=f.pending;do{if(f.pending===f.pending_buf_size&&(f.gzhead.hcrc&&f.pending>h&&(t.adler=c(t.adler,f.pending_buf,f.pending-h,h)),A(t),h=f.pending,f.pending===f.pending_buf_size)){k=1;break}k=f.gzindex<f.gzhead.comment.length?255&f.gzhead.comment.charCodeAt(f.gzindex++):0,X(f,k)}while(k!==0);f.gzhead.hcrc&&f.pending>h&&(t.adler=c(t.adler,f.pending_buf,f.pending-h,h)),k===0&&(f.status=103)}else f.status=103;if(f.status===103&&(f.gzhead.hcrc?(f.pending+2>f.pending_buf_size&&A(t),f.pending+2<=f.pending_buf_size&&(X(f,255&t.adler),X(f,t.adler>>8&255),t.adler=0,f.status=R)):f.status=R),f.pending!==0){if(A(t),t.avail_out===0)return f.last_flush=-1,i}else if(t.avail_in===0&&P(T)<=P(C)&&T!==m)return $(t,-5);if(f.status===666&&t.avail_in!==0)return $(t,-5);if(t.avail_in!==0||f.lookahead!==0||T!==_&&f.status!==666){var N=f.strategy===2?function(E,Z){for(var K;;){if(E.lookahead===0&&(it(E),E.lookahead===0)){if(Z===_)return e;break}if(E.match_length=0,K=n._tr_tally(E,0,E.window[E.strstart]),E.lookahead--,E.strstart++,K&&(z(E,!1),E.strm.avail_out===0))return e}return E.insert=0,Z===m?(z(E,!0),E.strm.avail_out===0?J:j):E.last_lit&&(z(E,!1),E.strm.avail_out===0)?e:D}(f,T):f.strategy===3?function(E,Z){for(var K,M,Y,nt,tt=E.window;;){if(E.lookahead<=W){if(it(E),E.lookahead<=W&&Z===_)return e;if(E.lookahead===0)break}if(E.match_length=0,E.lookahead>=O&&0<E.strstart&&(M=tt[Y=E.strstart-1])===tt[++Y]&&M===tt[++Y]&&M===tt[++Y]){nt=E.strstart+W;do;while(M===tt[++Y]&&M===tt[++Y]&&M===tt[++Y]&&M===tt[++Y]&&M===tt[++Y]&&M===tt[++Y]&&M===tt[++Y]&&M===tt[++Y]&&Y<nt);E.match_length=W-(nt-Y),E.match_length>E.lookahead&&(E.match_length=E.lookahead)}if(E.match_length>=O?(K=n._tr_tally(E,1,E.match_length-O),E.lookahead-=E.match_length,E.strstart+=E.match_length,E.match_length=0):(K=n._tr_tally(E,0,E.window[E.strstart]),E.lookahead--,E.strstart++),K&&(z(E,!1),E.strm.avail_out===0))return e}return E.insert=0,Z===m?(z(E,!0),E.strm.avail_out===0?J:j):E.last_lit&&(z(E,!1),E.strm.avail_out===0)?e:D}(f,T):s[f.level].func(f,T);if(N!==J&&N!==j||(f.status=666),N===e||N===J)return t.avail_out===0&&(f.last_flush=-1),i;if(N===D&&(T===1?n._tr_align(f):T!==5&&(n._tr_stored_block(f,0,0,!1),T===3&&(V(f.head),f.lookahead===0&&(f.strstart=0,f.block_start=0,f.insert=0))),A(t),t.avail_out===0))return f.last_flush=-1,i}return T!==m?i:f.wrap<=0?1:(f.wrap===2?(X(f,255&t.adler),X(f,t.adler>>8&255),X(f,t.adler>>16&255),X(f,t.adler>>24&255),X(f,255&t.total_in),X(f,t.total_in>>8&255),X(f,t.total_in>>16&255),X(f,t.total_in>>24&255)):(H(f,t.adler>>>16),H(f,65535&t.adler)),A(t),0<f.wrap&&(f.wrap=-f.wrap),f.pending!==0?i:1)},w.deflateEnd=function(t){var T;return t&&t.state?(T=t.state.status)!==v&&T!==69&&T!==73&&T!==91&&T!==103&&T!==R&&T!==666?$(t,d):(t.state=null,T===R?$(t,-3):i):d},w.deflateSetDictionary=function(t,T){var C,f,h,k,U,N,E,Z,K=T.length;if(!t||!t.state||(k=(C=t.state).wrap)===2||k===1&&C.status!==v||C.lookahead)return d;for(k===1&&(t.adler=u(t.adler,T,K,0)),C.wrap=0,K>=C.w_size&&(k===0&&(V(C.head),C.strstart=0,C.block_start=0,C.insert=0),Z=new o.Buf8(C.w_size),o.arraySet(Z,T,K-C.w_size,C.w_size,0),T=Z,K=C.w_size),U=t.avail_in,N=t.next_in,E=t.input,t.avail_in=K,t.next_in=0,t.input=T,it(C);C.lookahead>=O;){for(f=C.strstart,h=C.lookahead-(O-1);C.ins_h=(C.ins_h<<C.hash_shift^C.window[f+O-1])&C.hash_mask,C.prev[f&C.w_mask]=C.head[C.ins_h],C.head[C.ins_h]=f,f++,--h;);C.strstart=f,C.lookahead=O-1,it(C)}return C.strstart+=C.lookahead,C.block_start=C.strstart,C.insert=C.lookahead,C.lookahead=0,C.match_length=C.prev_length=O-1,C.match_available=0,t.next_in=N,t.input=E,t.avail_in=U,C.wrap=k,i},w.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(g,I,w){I.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(g,I,w){I.exports=function(s,o){var n,u,c,b,_,m,i,d,r,l,a,p,y,S,x,F,B,L,O,W,q,v,R,e,D;n=s.state,u=s.next_in,e=s.input,c=u+(s.avail_in-5),b=s.next_out,D=s.output,_=b-(o-s.avail_out),m=b+(s.avail_out-257),i=n.dmax,d=n.wsize,r=n.whave,l=n.wnext,a=n.window,p=n.hold,y=n.bits,S=n.lencode,x=n.distcode,F=(1<<n.lenbits)-1,B=(1<<n.distbits)-1;t:do{y<15&&(p+=e[u++]<<y,y+=8,p+=e[u++]<<y,y+=8),L=S[p&F];e:for(;;){if(p>>>=O=L>>>24,y-=O,(O=L>>>16&255)===0)D[b++]=65535&L;else{if(!(16&O)){if(!(64&O)){L=S[(65535&L)+(p&(1<<O)-1)];continue e}if(32&O){n.mode=12;break t}s.msg="invalid literal/length code",n.mode=30;break t}W=65535&L,(O&=15)&&(y<O&&(p+=e[u++]<<y,y+=8),W+=p&(1<<O)-1,p>>>=O,y-=O),y<15&&(p+=e[u++]<<y,y+=8,p+=e[u++]<<y,y+=8),L=x[p&B];r:for(;;){if(p>>>=O=L>>>24,y-=O,!(16&(O=L>>>16&255))){if(!(64&O)){L=x[(65535&L)+(p&(1<<O)-1)];continue r}s.msg="invalid distance code",n.mode=30;break t}if(q=65535&L,y<(O&=15)&&(p+=e[u++]<<y,(y+=8)<O&&(p+=e[u++]<<y,y+=8)),i<(q+=p&(1<<O)-1)){s.msg="invalid distance too far back",n.mode=30;break t}if(p>>>=O,y-=O,(O=b-_)<q){if(r<(O=q-O)&&n.sane){s.msg="invalid distance too far back",n.mode=30;break t}if(R=a,(v=0)===l){if(v+=d-O,O<W){for(W-=O;D[b++]=a[v++],--O;);v=b-q,R=D}}else if(l<O){if(v+=d+l-O,(O-=l)<W){for(W-=O;D[b++]=a[v++],--O;);if(v=0,l<W){for(W-=O=l;D[b++]=a[v++],--O;);v=b-q,R=D}}}else if(v+=l-O,O<W){for(W-=O;D[b++]=a[v++],--O;);v=b-q,R=D}for(;2<W;)D[b++]=R[v++],D[b++]=R[v++],D[b++]=R[v++],W-=3;W&&(D[b++]=R[v++],1<W&&(D[b++]=R[v++]))}else{for(v=b-q;D[b++]=D[v++],D[b++]=D[v++],D[b++]=D[v++],2<(W-=3););W&&(D[b++]=D[v++],1<W&&(D[b++]=D[v++]))}break}}break}}while(u<c&&b<m);u-=W=y>>3,p&=(1<<(y-=W<<3))-1,s.next_in=u,s.next_out=b,s.avail_in=u<c?c-u+5:5-(u-c),s.avail_out=b<m?m-b+257:257-(b-m),n.hold=p,n.bits=y}},{}],49:[function(g,I,w){var s=g("../utils/common"),o=g("./adler32"),n=g("./crc32"),u=g("./inffast"),c=g("./inftrees"),b=1,_=2,m=0,i=-2,d=1,r=852,l=592;function a(v){return(v>>>24&255)+(v>>>8&65280)+((65280&v)<<8)+((255&v)<<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 y(v){var R;return v&&v.state?(R=v.state,v.total_in=v.total_out=R.total=0,v.msg="",R.wrap&&(v.adler=1&R.wrap),R.mode=d,R.last=0,R.havedict=0,R.dmax=32768,R.head=null,R.hold=0,R.bits=0,R.lencode=R.lendyn=new s.Buf32(r),R.distcode=R.distdyn=new s.Buf32(l),R.sane=1,R.back=-1,m):i}function S(v){var R;return v&&v.state?((R=v.state).wsize=0,R.whave=0,R.wnext=0,y(v)):i}function x(v,R){var e,D;return v&&v.state?(D=v.state,R<0?(e=0,R=-R):(e=1+(R>>4),R<48&&(R&=15)),R&&(R<8||15<R)?i:(D.window!==null&&D.wbits!==R&&(D.window=null),D.wrap=e,D.wbits=R,S(v))):i}function F(v,R){var e,D;return v?(D=new p,(v.state=D).window=null,(e=x(v,R))!==m&&(v.state=null),e):i}var B,L,O=!0;function W(v){if(O){var R;for(B=new s.Buf32(512),L=new s.Buf32(32),R=0;R<144;)v.lens[R++]=8;for(;R<256;)v.lens[R++]=9;for(;R<280;)v.lens[R++]=7;for(;R<288;)v.lens[R++]=8;for(c(b,v.lens,0,288,B,0,v.work,{bits:9}),R=0;R<32;)v.lens[R++]=5;c(_,v.lens,0,32,L,0,v.work,{bits:5}),O=!1}v.lencode=B,v.lenbits=9,v.distcode=L,v.distbits=5}function q(v,R,e,D){var J,j=v.state;return j.window===null&&(j.wsize=1<<j.wbits,j.wnext=0,j.whave=0,j.window=new s.Buf8(j.wsize)),D>=j.wsize?(s.arraySet(j.window,R,e-j.wsize,j.wsize,0),j.wnext=0,j.whave=j.wsize):(D<(J=j.wsize-j.wnext)&&(J=D),s.arraySet(j.window,R,e-D,J,j.wnext),(D-=J)?(s.arraySet(j.window,R,e-D,D,0),j.wnext=D,j.whave=j.wsize):(j.wnext+=J,j.wnext===j.wsize&&(j.wnext=0),j.whave<j.wsize&&(j.whave+=J))),0}w.inflateReset=S,w.inflateReset2=x,w.inflateResetKeep=y,w.inflateInit=function(v){return F(v,15)},w.inflateInit2=F,w.inflate=function(v,R){var e,D,J,j,$,P,V,A,z,X,H,G,it,ut,Q,rt,ht,at,dt,ft,t,T,C,f,h=0,k=new s.Buf8(4),U=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!v||!v.state||!v.output||!v.input&&v.avail_in!==0)return i;(e=v.state).mode===12&&(e.mode=13),$=v.next_out,J=v.output,V=v.avail_out,j=v.next_in,D=v.input,P=v.avail_in,A=e.hold,z=e.bits,X=P,H=V,T=m;t:for(;;)switch(e.mode){case d:if(e.wrap===0){e.mode=13;break}for(;z<16;){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}if(2&e.wrap&&A===35615){k[e.check=0]=255&A,k[1]=A>>>8&255,e.check=n(e.check,k,2,0),z=A=0,e.mode=2;break}if(e.flags=0,e.head&&(e.head.done=!1),!(1&e.wrap)||(((255&A)<<8)+(A>>8))%31){v.msg="incorrect header check",e.mode=30;break}if((15&A)!=8){v.msg="unknown compression method",e.mode=30;break}if(z-=4,t=8+(15&(A>>>=4)),e.wbits===0)e.wbits=t;else if(t>e.wbits){v.msg="invalid window size",e.mode=30;break}e.dmax=1<<t,v.adler=e.check=1,e.mode=512&A?10:12,z=A=0;break;case 2:for(;z<16;){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}if(e.flags=A,(255&e.flags)!=8){v.msg="unknown compression method",e.mode=30;break}if(57344&e.flags){v.msg="unknown header flags set",e.mode=30;break}e.head&&(e.head.text=A>>8&1),512&e.flags&&(k[0]=255&A,k[1]=A>>>8&255,e.check=n(e.check,k,2,0)),z=A=0,e.mode=3;case 3:for(;z<32;){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}e.head&&(e.head.time=A),512&e.flags&&(k[0]=255&A,k[1]=A>>>8&255,k[2]=A>>>16&255,k[3]=A>>>24&255,e.check=n(e.check,k,4,0)),z=A=0,e.mode=4;case 4:for(;z<16;){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}e.head&&(e.head.xflags=255&A,e.head.os=A>>8),512&e.flags&&(k[0]=255&A,k[1]=A>>>8&255,e.check=n(e.check,k,2,0)),z=A=0,e.mode=5;case 5:if(1024&e.flags){for(;z<16;){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}e.length=A,e.head&&(e.head.extra_len=A),512&e.flags&&(k[0]=255&A,k[1]=A>>>8&255,e.check=n(e.check,k,2,0)),z=A=0}else e.head&&(e.head.extra=null);e.mode=6;case 6:if(1024&e.flags&&(P<(G=e.length)&&(G=P),G&&(e.head&&(t=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Array(e.head.extra_len)),s.arraySet(e.head.extra,D,j,G,t)),512&e.flags&&(e.check=n(e.check,D,G,j)),P-=G,j+=G,e.length-=G),e.length))break t;e.length=0,e.mode=7;case 7:if(2048&e.flags){if(P===0)break t;for(G=0;t=D[j+G++],e.head&&t&&e.length<65536&&(e.head.name+=String.fromCharCode(t)),t&&G<P;);if(512&e.flags&&(e.check=n(e.check,D,G,j)),P-=G,j+=G,t)break t}else e.head&&(e.head.name=null);e.length=0,e.mode=8;case 8:if(4096&e.flags){if(P===0)break t;for(G=0;t=D[j+G++],e.head&&t&&e.length<65536&&(e.head.comment+=String.fromCharCode(t)),t&&G<P;);if(512&e.flags&&(e.check=n(e.check,D,G,j)),P-=G,j+=G,t)break t}else e.head&&(e.head.comment=null);e.mode=9;case 9:if(512&e.flags){for(;z<16;){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}if(A!==(65535&e.check)){v.msg="header crc mismatch",e.mode=30;break}z=A=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),v.adler=e.check=0,e.mode=12;break;case 10:for(;z<32;){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}v.adler=e.check=a(A),z=A=0,e.mode=11;case 11:if(e.havedict===0)return v.next_out=$,v.avail_out=V,v.next_in=j,v.avail_in=P,e.hold=A,e.bits=z,2;v.adler=e.check=1,e.mode=12;case 12:if(R===5||R===6)break t;case 13:if(e.last){A>>>=7&z,z-=7&z,e.mode=27;break}for(;z<3;){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}switch(e.last=1&A,z-=1,3&(A>>>=1)){case 0:e.mode=14;break;case 1:if(W(e),e.mode=20,R!==6)break;A>>>=2,z-=2;break t;case 2:e.mode=17;break;case 3:v.msg="invalid block type",e.mode=30}A>>>=2,z-=2;break;case 14:for(A>>>=7&z,z-=7&z;z<32;){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}if((65535&A)!=(A>>>16^65535)){v.msg="invalid stored block lengths",e.mode=30;break}if(e.length=65535&A,z=A=0,e.mode=15,R===6)break t;case 15:e.mode=16;case 16:if(G=e.length){if(P<G&&(G=P),V<G&&(G=V),G===0)break t;s.arraySet(J,D,j,G,$),P-=G,j+=G,V-=G,$+=G,e.length-=G;break}e.mode=12;break;case 17:for(;z<14;){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}if(e.nlen=257+(31&A),A>>>=5,z-=5,e.ndist=1+(31&A),A>>>=5,z-=5,e.ncode=4+(15&A),A>>>=4,z-=4,286<e.nlen||30<e.ndist){v.msg="too many length or distance symbols",e.mode=30;break}e.have=0,e.mode=18;case 18:for(;e.have<e.ncode;){for(;z<3;){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}e.lens[U[e.have++]]=7&A,A>>>=3,z-=3}for(;e.have<19;)e.lens[U[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,C={bits:e.lenbits},T=c(0,e.lens,0,19,e.lencode,0,e.work,C),e.lenbits=C.bits,T){v.msg="invalid code lengths set",e.mode=30;break}e.have=0,e.mode=19;case 19:for(;e.have<e.nlen+e.ndist;){for(;rt=(h=e.lencode[A&(1<<e.lenbits)-1])>>>16&255,ht=65535&h,!((Q=h>>>24)<=z);){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}if(ht<16)A>>>=Q,z-=Q,e.lens[e.have++]=ht;else{if(ht===16){for(f=Q+2;z<f;){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}if(A>>>=Q,z-=Q,e.have===0){v.msg="invalid bit length repeat",e.mode=30;break}t=e.lens[e.have-1],G=3+(3&A),A>>>=2,z-=2}else if(ht===17){for(f=Q+3;z<f;){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}z-=Q,t=0,G=3+(7&(A>>>=Q)),A>>>=3,z-=3}else{for(f=Q+7;z<f;){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}z-=Q,t=0,G=11+(127&(A>>>=Q)),A>>>=7,z-=7}if(e.have+G>e.nlen+e.ndist){v.msg="invalid bit length repeat",e.mode=30;break}for(;G--;)e.lens[e.have++]=t}}if(e.mode===30)break;if(e.lens[256]===0){v.msg="invalid code -- missing end-of-block",e.mode=30;break}if(e.lenbits=9,C={bits:e.lenbits},T=c(b,e.lens,0,e.nlen,e.lencode,0,e.work,C),e.lenbits=C.bits,T){v.msg="invalid literal/lengths set",e.mode=30;break}if(e.distbits=6,e.distcode=e.distdyn,C={bits:e.distbits},T=c(_,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,C),e.distbits=C.bits,T){v.msg="invalid distances set",e.mode=30;break}if(e.mode=20,R===6)break t;case 20:e.mode=21;case 21:if(6<=P&&258<=V){v.next_out=$,v.avail_out=V,v.next_in=j,v.avail_in=P,e.hold=A,e.bits=z,u(v,H),$=v.next_out,J=v.output,V=v.avail_out,j=v.next_in,D=v.input,P=v.avail_in,A=e.hold,z=e.bits,e.mode===12&&(e.back=-1);break}for(e.back=0;rt=(h=e.lencode[A&(1<<e.lenbits)-1])>>>16&255,ht=65535&h,!((Q=h>>>24)<=z);){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}if(rt&&!(240&rt)){for(at=Q,dt=rt,ft=ht;rt=(h=e.lencode[ft+((A&(1<<at+dt)-1)>>at)])>>>16&255,ht=65535&h,!(at+(Q=h>>>24)<=z);){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}A>>>=at,z-=at,e.back+=at}if(A>>>=Q,z-=Q,e.back+=Q,e.length=ht,rt===0){e.mode=26;break}if(32&rt){e.back=-1,e.mode=12;break}if(64&rt){v.msg="invalid literal/length code",e.mode=30;break}e.extra=15&rt,e.mode=22;case 22:if(e.extra){for(f=e.extra;z<f;){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}e.length+=A&(1<<e.extra)-1,A>>>=e.extra,z-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=23;case 23:for(;rt=(h=e.distcode[A&(1<<e.distbits)-1])>>>16&255,ht=65535&h,!((Q=h>>>24)<=z);){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}if(!(240&rt)){for(at=Q,dt=rt,ft=ht;rt=(h=e.distcode[ft+((A&(1<<at+dt)-1)>>at)])>>>16&255,ht=65535&h,!(at+(Q=h>>>24)<=z);){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}A>>>=at,z-=at,e.back+=at}if(A>>>=Q,z-=Q,e.back+=Q,64&rt){v.msg="invalid distance code",e.mode=30;break}e.offset=ht,e.extra=15&rt,e.mode=24;case 24:if(e.extra){for(f=e.extra;z<f;){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}e.offset+=A&(1<<e.extra)-1,A>>>=e.extra,z-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){v.msg="invalid distance too far back",e.mode=30;break}e.mode=25;case 25:if(V===0)break t;if(G=H-V,e.offset>G){if((G=e.offset-G)>e.whave&&e.sane){v.msg="invalid distance too far back",e.mode=30;break}it=G>e.wnext?(G-=e.wnext,e.wsize-G):e.wnext-G,G>e.length&&(G=e.length),ut=e.window}else ut=J,it=$-e.offset,G=e.length;for(V<G&&(G=V),V-=G,e.length-=G;J[$++]=ut[it++],--G;);e.length===0&&(e.mode=21);break;case 26:if(V===0)break t;J[$++]=e.length,V--,e.mode=21;break;case 27:if(e.wrap){for(;z<32;){if(P===0)break t;P--,A|=D[j++]<<z,z+=8}if(H-=V,v.total_out+=H,e.total+=H,H&&(v.adler=e.check=e.flags?n(e.check,J,H,$-H):o(e.check,J,H,$-H)),H=V,(e.flags?A:a(A))!==e.check){v.msg="incorrect data check",e.mode=30;break}z=A=0}e.mode=28;case 28:if(e.wrap&&e.flags){for(;z<32;){if(P===0)break t;P--,A+=D[j++]<<z,z+=8}if(A!==(4294967295&e.total)){v.msg="incorrect length check",e.mode=30;break}z=A=0}e.mode=29;case 29:T=1;break t;case 30:T=-3;break t;case 31:return-4;case 32:default:return i}return v.next_out=$,v.avail_out=V,v.next_in=j,v.avail_in=P,e.hold=A,e.bits=z,(e.wsize||H!==v.avail_out&&e.mode<30&&(e.mode<27||R!==4))&&q(v,v.output,v.next_out,H-v.avail_out)?(e.mode=31,-4):(X-=v.avail_in,H-=v.avail_out,v.total_in+=X,v.total_out+=H,e.total+=H,e.wrap&&H&&(v.adler=e.check=e.flags?n(e.check,J,H,v.next_out-H):o(e.check,J,H,v.next_out-H)),v.data_type=e.bits+(e.last?64:0)+(e.mode===12?128:0)+(e.mode===20||e.mode===15?256:0),(X==0&&H===0||R===4)&&T===m&&(T=-5),T)},w.inflateEnd=function(v){if(!v||!v.state)return i;var R=v.state;return R.window&&(R.window=null),v.state=null,m},w.inflateGetHeader=function(v,R){var e;return v&&v.state&&2&(e=v.state).wrap?((e.head=R).done=!1,m):i},w.inflateSetDictionary=function(v,R){var e,D=R.length;return v&&v.state?(e=v.state).wrap!==0&&e.mode!==11?i:e.mode===11&&o(1,R,D,0)!==e.check?-3:q(v,R,D,D)?(e.mode=31,-4):(e.havedict=1,m):i},w.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(g,I,w){var s=g("../utils/common"),o=[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],n=[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],u=[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],c=[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];I.exports=function(b,_,m,i,d,r,l,a){var p,y,S,x,F,B,L,O,W,q=a.bits,v=0,R=0,e=0,D=0,J=0,j=0,$=0,P=0,V=0,A=0,z=null,X=0,H=new s.Buf16(16),G=new s.Buf16(16),it=null,ut=0;for(v=0;v<=15;v++)H[v]=0;for(R=0;R<i;R++)H[_[m+R]]++;for(J=q,D=15;1<=D&&H[D]===0;D--);if(D<J&&(J=D),D===0)return d[r++]=20971520,d[r++]=20971520,a.bits=1,0;for(e=1;e<D&&H[e]===0;e++);for(J<e&&(J=e),v=P=1;v<=15;v++)if(P<<=1,(P-=H[v])<0)return-1;if(0<P&&(b===0||D!==1))return-1;for(G[1]=0,v=1;v<15;v++)G[v+1]=G[v]+H[v];for(R=0;R<i;R++)_[m+R]!==0&&(l[G[_[m+R]]++]=R);if(B=b===0?(z=it=l,19):b===1?(z=o,X-=257,it=n,ut-=257,256):(z=u,it=c,-1),v=e,F=r,$=R=A=0,S=-1,x=(V=1<<(j=J))-1,b===1&&852<V||b===2&&592<V)return 1;for(;;){for(L=v-$,W=l[R]<B?(O=0,l[R]):l[R]>B?(O=it[ut+l[R]],z[X+l[R]]):(O=96,0),p=1<<v-$,e=y=1<<j;d[F+(A>>$)+(y-=p)]=L<<24|O<<16|W|0,y!==0;);for(p=1<<v-1;A&p;)p>>=1;if(p!==0?(A&=p-1,A+=p):A=0,R++,--H[v]==0){if(v===D)break;v=_[m+l[R]]}if(J<v&&(A&x)!==S){for($===0&&($=J),F+=e,P=1<<(j=v-$);j+$<D&&!((P-=H[j+$])<=0);)j++,P<<=1;if(V+=1<<j,b===1&&852<V||b===2&&592<V)return 1;d[S=A&x]=J<<24|j<<16|F-r|0}}return A!==0&&(d[F+A]=v-$<<24|64<<16|0),a.bits=J,0}},{"../utils/common":41}],51:[function(g,I,w){I.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(g,I,w){var s=g("../utils/common"),o=0,n=1;function u(h){for(var k=h.length;0<=--k;)h[k]=0}var c=0,b=29,_=256,m=_+1+b,i=30,d=19,r=2*m+1,l=15,a=16,p=7,y=256,S=16,x=17,F=18,B=[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],L=[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],O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],W=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],q=new Array(2*(m+2));u(q);var v=new Array(2*i);u(v);var R=new Array(512);u(R);var e=new Array(256);u(e);var D=new Array(b);u(D);var J,j,$,P=new Array(i);function V(h,k,U,N,E){this.static_tree=h,this.extra_bits=k,this.extra_base=U,this.elems=N,this.max_length=E,this.has_stree=h&&h.length}function A(h,k){this.dyn_tree=h,this.max_code=0,this.stat_desc=k}function z(h){return h<256?R[h]:R[256+(h>>>7)]}function X(h,k){h.pending_buf[h.pending++]=255&k,h.pending_buf[h.pending++]=k>>>8&255}function H(h,k,U){h.bi_valid>a-U?(h.bi_buf|=k<<h.bi_valid&65535,X(h,h.bi_buf),h.bi_buf=k>>a-h.bi_valid,h.bi_valid+=U-a):(h.bi_buf|=k<<h.bi_valid&65535,h.bi_valid+=U)}function G(h,k,U){H(h,U[2*k],U[2*k+1])}function it(h,k){for(var U=0;U|=1&h,h>>>=1,U<<=1,0<--k;);return U>>>1}function ut(h,k,U){var N,E,Z=new Array(l+1),K=0;for(N=1;N<=l;N++)Z[N]=K=K+U[N-1]<<1;for(E=0;E<=k;E++){var M=h[2*E+1];M!==0&&(h[2*E]=it(Z[M]++,M))}}function Q(h){var k;for(k=0;k<m;k++)h.dyn_ltree[2*k]=0;for(k=0;k<i;k++)h.dyn_dtree[2*k]=0;for(k=0;k<d;k++)h.bl_tree[2*k]=0;h.dyn_ltree[2*y]=1,h.opt_len=h.static_len=0,h.last_lit=h.matches=0}function rt(h){8<h.bi_valid?X(h,h.bi_buf):0<h.bi_valid&&(h.pending_buf[h.pending++]=h.bi_buf),h.bi_buf=0,h.bi_valid=0}function ht(h,k,U,N){var E=2*k,Z=2*U;return h[E]<h[Z]||h[E]===h[Z]&&N[k]<=N[U]}function at(h,k,U){for(var N=h.heap[U],E=U<<1;E<=h.heap_len&&(E<h.heap_len&&ht(k,h.heap[E+1],h.heap[E],h.depth)&&E++,!ht(k,N,h.heap[E],h.depth));)h.heap[U]=h.heap[E],U=E,E<<=1;h.heap[U]=N}function dt(h,k,U){var N,E,Z,K,M=0;if(h.last_lit!==0)for(;N=h.pending_buf[h.d_buf+2*M]<<8|h.pending_buf[h.d_buf+2*M+1],E=h.pending_buf[h.l_buf+M],M++,N===0?G(h,E,k):(G(h,(Z=e[E])+_+1,k),(K=B[Z])!==0&&H(h,E-=D[Z],K),G(h,Z=z(--N),U),(K=L[Z])!==0&&H(h,N-=P[Z],K)),M<h.last_lit;);G(h,y,k)}function ft(h,k){var U,N,E,Z=k.dyn_tree,K=k.stat_desc.static_tree,M=k.stat_desc.has_stree,Y=k.stat_desc.elems,nt=-1;for(h.heap_len=0,h.heap_max=r,U=0;U<Y;U++)Z[2*U]!==0?(h.heap[++h.heap_len]=nt=U,h.depth[U]=0):Z[2*U+1]=0;for(;h.heap_len<2;)Z[2*(E=h.heap[++h.heap_len]=nt<2?++nt:0)]=1,h.depth[E]=0,h.opt_len--,M&&(h.static_len-=K[2*E+1]);for(k.max_code=nt,U=h.heap_len>>1;1<=U;U--)at(h,Z,U);for(E=Y;U=h.heap[1],h.heap[1]=h.heap[h.heap_len--],at(h,Z,1),N=h.heap[1],h.heap[--h.heap_max]=U,h.heap[--h.heap_max]=N,Z[2*E]=Z[2*U]+Z[2*N],h.depth[E]=(h.depth[U]>=h.depth[N]?h.depth[U]:h.depth[N])+1,Z[2*U+1]=Z[2*N+1]=E,h.heap[1]=E++,at(h,Z,1),2<=h.heap_len;);h.heap[--h.heap_max]=h.heap[1],function(tt,lt){var _t,pt,gt,st,vt,kt,mt=lt.dyn_tree,xt=lt.max_code,It=lt.stat_desc.static_tree,Ot=lt.stat_desc.has_stree,Bt=lt.stat_desc.extra_bits,St=lt.stat_desc.extra_base,bt=lt.stat_desc.max_length,yt=0;for(st=0;st<=l;st++)tt.bl_count[st]=0;for(mt[2*tt.heap[tt.heap_max]+1]=0,_t=tt.heap_max+1;_t<r;_t++)bt<(st=mt[2*mt[2*(pt=tt.heap[_t])+1]+1]+1)&&(st=bt,yt++),mt[2*pt+1]=st,xt<pt||(tt.bl_count[st]++,vt=0,St<=pt&&(vt=Bt[pt-St]),kt=mt[2*pt],tt.opt_len+=kt*(st+vt),Ot&&(tt.static_len+=kt*(It[2*pt+1]+vt)));if(yt!==0){do{for(st=bt-1;tt.bl_count[st]===0;)st--;tt.bl_count[st]--,tt.bl_count[st+1]+=2,tt.bl_count[bt]--,yt-=2}while(0<yt);for(st=bt;st!==0;st--)for(pt=tt.bl_count[st];pt!==0;)xt<(gt=tt.heap[--_t])||(mt[2*gt+1]!==st&&(tt.opt_len+=(st-mt[2*gt+1])*mt[2*gt],mt[2*gt+1]=st),pt--)}}(h,k),ut(Z,nt,h.bl_count)}function t(h,k,U){var N,E,Z=-1,K=k[1],M=0,Y=7,nt=4;for(K===0&&(Y=138,nt=3),k[2*(U+1)+1]=65535,N=0;N<=U;N++)E=K,K=k[2*(N+1)+1],++M<Y&&E===K||(M<nt?h.bl_tree[2*E]+=M:E!==0?(E!==Z&&h.bl_tree[2*E]++,h.bl_tree[2*S]++):M<=10?h.bl_tree[2*x]++:h.bl_tree[2*F]++,Z=E,nt=(M=0)===K?(Y=138,3):E===K?(Y=6,3):(Y=7,4))}function T(h,k,U){var N,E,Z=-1,K=k[1],M=0,Y=7,nt=4;for(K===0&&(Y=138,nt=3),N=0;N<=U;N++)if(E=K,K=k[2*(N+1)+1],!(++M<Y&&E===K)){if(M<nt)for(;G(h,E,h.bl_tree),--M!=0;);else E!==0?(E!==Z&&(G(h,E,h.bl_tree),M--),G(h,S,h.bl_tree),H(h,M-3,2)):M<=10?(G(h,x,h.bl_tree),H(h,M-3,3)):(G(h,F,h.bl_tree),H(h,M-11,7));Z=E,nt=(M=0)===K?(Y=138,3):E===K?(Y=6,3):(Y=7,4)}}u(P);var C=!1;function f(h,k,U,N){H(h,(c<<1)+(N?1:0),3),function(E,Z,K,M){rt(E),X(E,K),X(E,~K),s.arraySet(E.pending_buf,E.window,Z,K,E.pending),E.pending+=K}(h,k,U)}w._tr_init=function(h){C||(function(){var k,U,N,E,Z,K=new Array(l+1);for(E=N=0;E<b-1;E++)for(D[E]=N,k=0;k<1<<B[E];k++)e[N++]=E;for(e[N-1]=E,E=Z=0;E<16;E++)for(P[E]=Z,k=0;k<1<<L[E];k++)R[Z++]=E;for(Z>>=7;E<i;E++)for(P[E]=Z<<7,k=0;k<1<<L[E]-7;k++)R[256+Z++]=E;for(U=0;U<=l;U++)K[U]=0;for(k=0;k<=143;)q[2*k+1]=8,k++,K[8]++;for(;k<=255;)q[2*k+1]=9,k++,K[9]++;for(;k<=279;)q[2*k+1]=7,k++,K[7]++;for(;k<=287;)q[2*k+1]=8,k++,K[8]++;for(ut(q,m+1,K),k=0;k<i;k++)v[2*k+1]=5,v[2*k]=it(k,5);J=new V(q,B,_+1,m,l),j=new V(v,L,0,i,l),$=new V(new Array(0),O,0,d,p)}(),C=!0),h.l_desc=new A(h.dyn_ltree,J),h.d_desc=new A(h.dyn_dtree,j),h.bl_desc=new A(h.bl_tree,$),h.bi_buf=0,h.bi_valid=0,Q(h)},w._tr_stored_block=f,w._tr_flush_block=function(h,k,U,N){var E,Z,K=0;0<h.level?(h.strm.data_type===2&&(h.strm.data_type=function(M){var Y,nt=4093624447;for(Y=0;Y<=31;Y++,nt>>>=1)if(1&nt&&M.dyn_ltree[2*Y]!==0)return o;if(M.dyn_ltree[18]!==0||M.dyn_ltree[20]!==0||M.dyn_ltree[26]!==0)return n;for(Y=32;Y<_;Y++)if(M.dyn_ltree[2*Y]!==0)return n;return o}(h)),ft(h,h.l_desc),ft(h,h.d_desc),K=function(M){var Y;for(t(M,M.dyn_ltree,M.l_desc.max_code),t(M,M.dyn_dtree,M.d_desc.max_code),ft(M,M.bl_desc),Y=d-1;3<=Y&&M.bl_tree[2*W[Y]+1]===0;Y--);return M.opt_len+=3*(Y+1)+5+5+4,Y}(h),E=h.opt_len+3+7>>>3,(Z=h.static_len+3+7>>>3)<=E&&(E=Z)):E=Z=U+5,U+4<=E&&k!==-1?f(h,k,U,N):h.strategy===4||Z===E?(H(h,2+(N?1:0),3),dt(h,q,v)):(H(h,4+(N?1:0),3),function(M,Y,nt,tt){var lt;for(H(M,Y-257,5),H(M,nt-1,5),H(M,tt-4,4),lt=0;lt<tt;lt++)H(M,M.bl_tree[2*W[lt]+1],3);T(M,M.dyn_ltree,Y-1),T(M,M.dyn_dtree,nt-1)}(h,h.l_desc.max_code+1,h.d_desc.max_code+1,K+1),dt(h,h.dyn_ltree,h.dyn_dtree)),Q(h),N&&rt(h)},w._tr_tally=function(h,k,U){return h.pending_buf[h.d_buf+2*h.last_lit]=k>>>8&255,h.pending_buf[h.d_buf+2*h.last_lit+1]=255&k,h.pending_buf[h.l_buf+h.last_lit]=255&U,h.last_lit++,k===0?h.dyn_ltree[2*U]++:(h.matches++,k--,h.dyn_ltree[2*(e[U]+_+1)]++,h.dyn_dtree[2*z(k)]++),h.last_lit===h.lit_bufsize-1},w._tr_align=function(h){H(h,2,3),G(h,y,q),function(k){k.bi_valid===16?(X(k,k.bi_buf),k.bi_buf=0,k.bi_valid=0):8<=k.bi_valid&&(k.pending_buf[k.pending++]=255&k.bi_buf,k.bi_buf>>=8,k.bi_valid-=8)}(h)}},{"../utils/common":41}],53:[function(g,I,w){I.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(g,I,w){(function(s){(function(o,n){if(!o.setImmediate){var u,c,b,_,m=1,i={},d=!1,r=o.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(o);l=l&&l.setTimeout?l:o,u={}.toString.call(o.process)==="[object process]"?function(S){process.nextTick(function(){p(S)})}:function(){if(o.postMessage&&!o.importScripts){var S=!0,x=o.onmessage;return o.onmessage=function(){S=!1},o.postMessage("","*"),o.onmessage=x,S}}()?(_="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",y,!1):o.attachEvent("onmessage",y),function(S){o.postMessage(_+S,"*")}):o.MessageChannel?((b=new MessageChannel).port1.onmessage=function(S){p(S.data)},function(S){b.port2.postMessage(S)}):r&&"onreadystatechange"in r.createElement("script")?(c=r.documentElement,function(S){var x=r.createElement("script");x.onreadystatechange=function(){p(S),x.onreadystatechange=null,c.removeChild(x),x=null},c.appendChild(x)}):function(S){setTimeout(p,0,S)},l.setImmediate=function(S){typeof S!="function"&&(S=new Function(""+S));for(var x=new Array(arguments.length-1),F=0;F<x.length;F++)x[F]=arguments[F+1];var B={callback:S,args:x};return i[m]=B,u(m),m++},l.clearImmediate=a}function a(S){delete i[S]}function p(S){if(d)setTimeout(p,0,S);else{var x=i[S];if(x){d=!0;try{(function(F){var B=F.callback,L=F.args;switch(L.length){case 0:B();break;case 1:B(L[0]);break;case 2:B(L[0],L[1]);break;case 3:B(L[0],L[1],L[2]);break;default:B.apply(n,L)}})(x)}finally{a(S),d=!1}}}}function y(S){S.source===o&&typeof S.data=="string"&&S.data.indexOf(_)===0&&p(+S.data.slice(_.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof ct.commonjsGlobal<"u"?ct.commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Et);var Rt=Et.exports;const Tt=ct.getDefaultExportFromCjs(Rt);var zt={exports:{}};(function(et,ot){(function(g,I){I()})(ct.commonjsGlobal,function(){function g(c,b){return typeof b>"u"?b={autoBom:!1}:typeof b!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),b={autoBom:!b}),b.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(c.type)?new Blob(["\uFEFF",c],{type:c.type}):c}function I(c,b,_){var m=new XMLHttpRequest;m.open("GET",c),m.responseType="blob",m.onload=function(){u(m.response,b,_)},m.onerror=function(){console.error("could not download file")},m.send()}function w(c){var b=new XMLHttpRequest;b.open("HEAD",c,!1);try{b.send()}catch{}return 200<=b.status&&299>=b.status}function s(c){try{c.dispatchEvent(new MouseEvent("click"))}catch{var b=document.createEvent("MouseEvents");b.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),c.dispatchEvent(b)}}var o=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof ct.commonjsGlobal=="object"&&ct.commonjsGlobal.global===ct.commonjsGlobal?ct.commonjsGlobal:void 0,n=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),u=o.saveAs||(typeof window!="object"||window!==o?function(){}:"download"in HTMLAnchorElement.prototype&&!n?function(c,b,_){var m=o.URL||o.webkitURL,i=document.createElement("a");b=b||c.name||"download",i.download=b,i.rel="noopener",typeof c=="string"?(i.href=c,i.origin===location.origin?s(i):w(i.href)?I(c,b,_):s(i,i.target="_blank")):(i.href=m.createObjectURL(c),setTimeout(function(){m.revokeObjectURL(i.href)},4e4),setTimeout(function(){s(i)},0))}:"msSaveOrOpenBlob"in navigator?function(c,b,_){if(b=b||c.name||"download",typeof c!="string")navigator.msSaveOrOpenBlob(g(c,_),b);else if(w(c))I(c,b,_);else{var m=document.createElement("a");m.href=c,m.target="_blank",setTimeout(function(){s(m)})}}:function(c,b,_,m){if(m=m||open("","_blank"),m&&(m.document.title=m.document.body.innerText="downloading..."),typeof c=="string")return I(c,b,_);var i=c.type==="application/octet-stream",d=/constructor/i.test(o.HTMLElement)||o.safari,r=/CriOS\/[\d]+/.test(navigator.userAgent);if((r||i&&d||n)&&typeof FileReader<"u"){var l=new FileReader;l.onloadend=function(){var y=l.result;y=r?y:y.replace(/^data:[^;]*;/,"data:attachment/file;"),m?m.location.href=y:location=y,m=null},l.readAsDataURL(c)}else{var a=o.URL||o.webkitURL,p=a.createObjectURL(c);m?m.location=p:location.href=p,m=null,setTimeout(function(){a.revokeObjectURL(p)},4e4)}});o.saveAs=u.saveAs=u,et.exports=u})})(zt);var At=zt.exports;const Ct=et=>{const ot=atob(et.split(",")[1]),g=et.split(",")[0].split(":")[1].split(";")[0],I=new ArrayBuffer(ot.length),w=new Uint8Array(I);for(let s=0;s<ot.length;s++)w[s]=ot.charCodeAt(s);return new Blob([I],{type:g})};function Dt(et,ot){var I;const g=(I=et.split(".").pop())==null?void 0:I.split("?")[0];return g&&g!==et?g:ot&&ot.split("/").pop()||"png"}function Ft(et){return(et==null?void 0:et.split(".").shift())||"scene"}const Ut=(et,ot,g)=>{ot.forEach((I,w)=>{const s=et[I.source];if(!s.uri)return;const o=Dt(s.uri,s.mimeType),u=`${I.name||`texture_${w}`}.${o}`;if(s.data instanceof ArrayBuffer||s.data instanceof Uint8Array){const c=s.data instanceof Uint8Array?s.data.buffer:s.data;g.file(u,c,{binary:!0})}else if(s.uri.startsWith("data:")){const c=Ct(s.uri);g.file(u,c,{binary:!0})}else console.warn(`Image at index ${w} has unsupported data format`)})},Nt=(et,ot,g)=>{et.forEach((I,w)=>{const s=`${g}.bin`;if(I instanceof ArrayBuffer)ot.file(s,I,{binary:!0});else if(I.uri){const o=Ct(I.uri);ot.file(s,o,{binary:!0})}else console.warn(`Buffer at index ${w} is not an ArrayBuffer or does not have a URI`)})},jt=(et,ot)=>{const g=new Tt;g.file(`${ot}.gltf`,JSON.stringify(et,null,2)),et.buffers&&Nt(et.buffers,g,ot),et.images&&et.textures&&Ut(et.images,et.textures,g),g.generateAsync({type:"blob"}).then(I=>{At.saveAs(I,`${ot}.zip`)})},Lt=(et,ot)=>({handleGltfExport:(I,w)=>{const s=I==null?void 0:I.model;if(!s){console.error("Scene not initialized");return}const o=new ct.GLTFExporter,n={binary:w,includeCustomExtensions:!0};o.parse(s,u=>{const c=Ft(I.name);u instanceof ArrayBuffer?(At.saveAs(new Blob([u]),`${c}.glb`),et&&et()):(jt(u,c),et&&et())},u=>{console.error(u),ot&&ot(u)},n)}});exports.useExportModel=Lt;