iflow-engine-base 3.8.3 → 3.8.4

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.
@@ -110,7 +110,7 @@
110
110
  <path d="M8 3C4.5 3 1.5 8 1.5 8C2.2 9.3 3.3 10.5 4.5 11.5" stroke="currentColor" stroke-width="1.2"/>
111
111
  <path d="M11.5 11.5C12.7 10.5 13.8 9.3 14.5 8C14.5 8 11.5 3 8 3" stroke="currentColor" stroke-width="1.2"/>
112
112
  </svg>`}_colorToHex(e){return"#"+e.toString(16).padStart(6,"0")}_makeDraggable(e,t){t.onmousedown=i=>{i.preventDefault();const n=e.getBoundingClientRect(),r=e.offsetParent?.getBoundingClientRect()??{left:0,top:0};e.style.left=n.left-r.left+"px",e.style.top=n.top-r.top+"px",e.style.right="auto",e.style.bottom="auto";const s=i.clientX-n.left,o=i.clientY-n.top,a=u=>{e.style.left=u.clientX-s-r.left+"px",e.style.top=u.clientY-o-r.top+"px"},h=()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",h)};document.addEventListener("mousemove",a),document.addEventListener("mouseup",h)}}dispose(){this.panel?.remove(),this.panel=null,this.listEl=null}}class Ne{engine;layerMap=new Map;panelUI=null;constructor(e){this.engine=e;const t=document.getElementById(e?.options?.containerId??"")??e?.container??null;t&&(this.panelUI=new bt(t,this))}_loadLayers(e=this.engine.dwgData?.layers??[]){this.layerMap.clear();for(const t of e)this.layerMap.set(t.name,{...t});this.panelUI?.refresh()}syncFromModel(e){e?.length>0&&(this._loadLayers(e),this.panelUI?.refresh())}getLayers(){return Array.from(this.layerMap.values())}getDisplayColor(e){return this.engine.modelToolModule2d?.getDisplayColor(e)??e}refresh(){this.panelUI?.refresh()}setLayerVisible(e,t){const i=this.layerMap.get(e);i&&(i.visible=t),this._applyVisibility(e,t),t||this.clearInteractiveStateForLayer(e)}toggleLayer(e){const t=this.layerMap.get(e);if(!t)return!0;const i=!t.visible;return this.setLayerVisible(e,i),i}setAllLayersVisible(e){for(const t of this.layerMap.keys()){const i=this.layerMap.get(t);i.visible=e,this._applyVisibility(t,e)}}isAllVisible(){return Array.from(this.layerMap.values()).every(e=>e.visible)}isLayerVisible(e){return e?this.layerMap.get(e)?.visible!==!1:!0}isModelVisibleByLayer(e){const t=this.engine.loaderModule2d?.model?.nodeMap?.get(String(e))??this.engine.loaderModule2d?.model?.nodeMap?.get(e);return!t||t.length===0?!0:t.some(i=>{const n=this.getNodeObject(i);return this.isLayerVisible(i?.layer)&&n?.visible!==!1})}_applyVisibility(e,t){const i=this.engine?.modelGroup??this.engine?.scene;if(!i)return;const n=e+"||";i.traverse(r=>{r.name?.startsWith(n)&&(r.visible=t)})}getNodeObject(e){return e?.object??e?.group?.children?.[e.indexes?.[0]]??this.engine.modelGroup?.children?.[e.indexes?.[0]]}clearInteractiveStateForLayer(e){const t=[...this.engine.engineStatus2d?.highlightModels??[],...this.engine.engineStatus2d?.highlightHoverModels??[]];t.length===0||!t.some(n=>(this.engine.loaderModule2d?.model?.nodeMap?.get(String(n))??this.engine.loaderModule2d?.model?.nodeMap?.get(n))?.some(s=>s?.layer===e))||(this.engine.modelToolModule2d?.unHighlightModelHover?.(),this.engine.modelToolModule2d?.unhighlightAllModels?.())}show(){this.panelUI?.show()}hide(){this.panelUI?.hide()}toggle(){this.panelUI?.toggle()}dispose(){this.panelUI?.dispose(),this.panelUI=null,this.layerMap.clear()}}function xe(C){return Array.isArray(C)?new k.Vector3(C[0]??0,C[1]??0,C[2]??0):new k.Vector3(C?.x??0,C?.y??0,C?.z??0)}function _e(C){return C?(C.computeBoundingBox(),{min:C.boundingBox?.min.clone()??new k.Vector3,max:C.boundingBox?.max.clone()??new k.Vector3}):{min:new k.Vector3,max:new k.Vector3}}function ze(C,e,t){const i=new k.Vector3(C[0]??0,C[1]??0,C[2]??0),n=new k.Euler(0,0,t??0),r=new k.Vector3(e[0]??1,e[1]??1,e[2]??1),s=new k.Quaternion().setFromEuler(n);return new k.Matrix4().compose(i,s,r)}function vt(C){return Array.isArray(C?.transformMatrix)&&C.transformMatrix.length===16?new k.Matrix4().fromArray(C.transformMatrix):ze(C.position??[0,0,0],C.scale??[1,1,1],C.rotation??0)}function je(C){if(C.length===0)return{min:new k.Vector3,max:new k.Vector3};const e=new k.Vector3(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),t=new k.Vector3(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);return C.forEach(i=>{e.x=Math.min(e.x,i.x),e.y=Math.min(e.y,i.y),e.z=Math.min(e.z,i.z),t.x=Math.max(t.x,i.x),t.y=Math.max(t.y,i.y),t.z=Math.max(t.z,i.z)}),{min:e,max:t}}class wt{constructor(e){this.geometryFactory=e}cache=new Map;blockIndex=new Map;setBlocks(e){this.cache.clear(),this.blockIndex.clear(),(e??[]).forEach(t=>{t?.name&&this.blockIndex.set(t.name,t),t?.id&&this.blockIndex.set(t.id,t)})}clearCache(){this.cache.clear()}flattenRootEntities(e){return Array.from(this.iterateRootEntities(e))}*iterateRootEntities(e){yield*this.iterateEntities(e??[],new k.Matrix4,0)}flattenBlock(e,t,i){const n=this.cache.get(t);if(n)return n;const r=e.origin??[0,0,0],s=new k.Matrix4().makeTranslation(-r[0],-r[1],-(r[2]??0)),o=this.flattenEntities(e.entities??[],s,i);return this.cache.set(t,o),e.name&&this.cache.set(e.name,o),e.id&&this.cache.set(e.id,o),o}flattenEntities(e,t,i){return Array.from(this.iterateEntities(e,t,i))}*iterateEntities(e,t,i){if(i>20){console.warn("[LoaderModule2d] Block nesting is too deep, skip nested INSERT.");return}for(const n of e)if(n?.visible!==!1){if(n.type==="INSERT"){const r=this.getBlockItems(n.blockId,i+1),s=t.clone().multiply(vt(n)),o=this.getClipPolygon(n,t);for(const a of r){const h=this.cloneRenderItem(a,s,n),u=o?this.clipRenderItem(h,o):h;u&&(yield u)}o&&n.displayClipBoundary===!0&&(yield this.createClipBoundaryItem(n,o));continue}for(const r of this.geometryFactory.create(n,t))yield r}}getBlockItems(e,t){const i=this.cache.get(e);if(i)return i;const n=this.blockIndex.get(e);return n?this.flattenBlock(n,n.name??n.id??e,t):(console.warn(`[LoaderModule2d] Missing block: ${e}`),[])}cloneRenderItem(e,t,i){const n=e.layer==="0"&&i?.layer?i.layer:e.layer??i?.layer,r=e.color==null||e.color===0?i?.color??e.color??0:e.color,s=i?.linkId??i?.id??e.linkId;if(e.kind==="line")return{...e,layer:n,color:r,linkId:s,points:(e.points??[]).map(u=>u.clone().applyMatrix4(t))};const o=e.geometry?.clone();o?.applyMatrix4(t);const a=e.textAnchor?.clone().applyMatrix4(t),h=_e(o);return{...e,layer:n,color:r,linkId:s,geometry:o,min:h.min,max:h.max,textAnchor:a}}getClipPolygon(e,t){if(e?.clipping!==!0||!Array.isArray(e?.clipBoundary))return null;const i=e.clipBoundary.map(r=>new k.Vector3(r?.[0]??r?.x??0,r?.[1]??r?.y??0,r?.[2]??r?.z??0)).filter(r=>Number.isFinite(r.x)&&Number.isFinite(r.y));if(i.length<3)return null;const n=this.getClipBoundaryMatrix(e,t);return n?i.map(r=>r.clone().applyMatrix4(n)):i}getClipBoundaryMatrix(e,t){return!Array.isArray(e?.clipInsertTransform)||e.clipInsertTransform.length!==16?null:t.clone().multiply(new k.Matrix4().fromArray(e.clipInsertTransform))}clipRenderItem(e,t){if(e.kind==="line"){const r=this.clipLinePoints(e.points??[],t);if(r.length===0)return null;const s=this.getPointsBounds(r);return{...e,points:r,min:s.min,max:s.max}}const i=this.clipGeometry(e.geometry,t);if(!i)return null;const n=_e(i);return{...e,geometry:i,min:n.min,max:n.max}}clipLinePoints(e,t){const i=[];for(let n=0;n<e.length-1;n+=2)this.clipSegmentByPolygon(e[n],e[n+1],t).forEach(r=>{i.push(r[0],r[1])});return i}clipSegmentByPolygon(e,t,i){const n=t.clone().sub(e),r=[0,1];for(let a=0;a<i.length;a+=1){const h=this.getSegmentIntersectionParameter(e,t,i[a],i[(a+1)%i.length]);h!=null&&h>1e-9&&h<1-1e-9&&r.push(h)}const s=Array.from(new Set(r.map(a=>Number(a.toFixed(12))))).sort((a,h)=>a-h),o=[];for(let a=0;a<s.length-1;a+=1){const h=s[a],u=s[a+1];if(u-h<1e-10)continue;const f=(h+u)*.5,g=e.clone().add(n.clone().multiplyScalar(f));this.isPointInPolygon(g,i)&&o.push([e.clone().add(n.clone().multiplyScalar(h)),e.clone().add(n.clone().multiplyScalar(u))])}return o}getSegmentIntersectionParameter(e,t,i,n){const r=t.x-e.x,s=t.y-e.y,o=n.x-i.x,a=n.y-i.y,h=r*a-s*o;if(Math.abs(h)<1e-12)return null;const u=i.x-e.x,f=i.y-e.y,g=(u*a-f*o)/h,d=(u*s-f*r)/h;return g>=-1e-9&&g<=1+1e-9&&d>=-1e-9&&d<=1+1e-9?k.MathUtils.clamp(g,0,1):null}isPointInPolygon(e,t){let i=!1;for(let n=0,r=t.length-1;n<t.length;r=n,n+=1){const s=t[n],o=t[r];if(this.isPointOnSegment(e,s,o))return!0;s.y>e.y!=o.y>e.y&&e.x<(o.x-s.x)*(e.y-s.y)/(o.y-s.y)+s.x&&(i=!i)}return i}isPointOnSegment(e,t,i){const n=(i.x-t.x)*(e.y-t.y)-(i.y-t.y)*(e.x-t.x);if(Math.abs(n)>1e-8)return!1;const r=(e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y),s=(i.x-t.x)**2+(i.y-t.y)**2;return r>=-1e-8&&r<=s+1e-8}clipGeometry(e,t){if(!e?.attributes?.position)return null;const i=e.attributes.position,n=e.attributes.uv,r=e.index,s=[],o=[],a=!!n,h=this.triangulateClipPolygon(t),u=d=>({position:new k.Vector3(i.getX(d),i.getY(d),i.getZ(d)),uv:a?new k.Vector2(n.getX(d),n.getY(d)):void 0}),f=r?r.count:i.count;for(let d=0;d<f;d+=3){const b=r?r.getX(d):d,l=r?r.getX(d+1):d+1,p=r?r.getX(d+2):d+2,y=[u(b),u(l),u(p)];h.forEach(v=>{const _=this.clipTriangle(y,v);if(!(_.length<3))for(let S=1;S<_.length-1;S+=1)[_[0],_[S],_[S+1]].forEach(E=>{s.push(E.position.x,E.position.y,E.position.z),a&&E.uv&&o.push(E.uv.x,E.uv.y)})})}if(s.length===0)return null;const g=new k.BufferGeometry;return g.setAttribute("position",new k.Float32BufferAttribute(s,3)),a&&g.setAttribute("uv",new k.Float32BufferAttribute(o,2)),g.computeVertexNormals(),g}triangulateClipPolygon(e){const t=e.map(n=>new k.Vector2(n.x,n.y)),i=k.ShapeUtils.triangulateShape(t,[]);if(i.length===0){const n=[];for(let r=1;r<e.length-1;r+=1)n.push([e[0],e[r],e[r+1]]);return n}return i.map(n=>n.map(r=>e[r]))}clipTriangle(e,t){const i=this.getPolygonOrientation(t);let n=e;for(let r=0;r<t.length;r+=1){const s=t[r],o=t[(r+1)%t.length],a=n;if(n=[],a.length===0)break;let h=a[a.length-1],u=this.isInsideClipEdge(h.position,s,o,i);a.forEach(f=>{const g=this.isInsideClipEdge(f.position,s,o,i);g!==u&&n.push(this.intersectClipEdge(h,f,s,o,i)),g&&n.push(f),h=f,u=g})}return n}isInsideClipEdge(e,t,i,n){const r=i.x-t.x,s=i.y-t.y;return n*(r*(e.y-t.y)-s*(e.x-t.x))>=-1e-9}intersectClipEdge(e,t,i,n,r){const s=n.x-i.x,o=n.y-i.y,a=r*(s*(e.position.y-i.y)-o*(e.position.x-i.x)),h=r*(s*(t.position.y-i.y)-o*(t.position.x-i.x)),u=Math.abs(a-h)<1e-12?0:a/(a-h);return{position:e.position.clone().lerp(t.position,u),uv:e.uv&&t.uv?e.uv.clone().lerp(t.uv,u):void 0}}getPolygonOrientation(e){let t=0;for(let i=0;i<e.length;i+=1){const n=e[i],r=e[(i+1)%e.length];t+=n.x*r.y-r.x*n.y}return t>=0?1:-1}getPointsBounds(e){const t=new k.Vector3(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new k.Vector3(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);return e.forEach(n=>{t.min(n),i.max(n)}),{min:t,max:i}}createClipBoundaryItem(e,t){const i=[];for(let r=0;r<t.length;r+=1)i.push(t[r].clone(),t[(r+1)%t.length].clone());const n=this.getPointsBounds(i);return{kind:"line",layer:e.layer??"0",color:e.clipBoundaryColor??16711935,lineType:"Continuous",linkId:e.linkId??e.id,points:i,min:n.min,max:n.max,info:e}}}function Te(C){throw new Error('Could not dynamically require "'+C+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Pe={exports:{}};var Ue;function xt(){return Ue||(Ue=1,(function(C,e){(function(t){C.exports=t()})(function(){return(function t(i,n,r){function s(h,u){if(!n[h]){if(!i[h]){var f=typeof Te=="function"&&Te;if(!u&&f)return f(h,!0);if(o)return o(h,!0);var g=new Error("Cannot find module '"+h+"'");throw g.code="MODULE_NOT_FOUND",g}var d=n[h]={exports:{}};i[h][0].call(d.exports,function(b){var l=i[h][1][b];return s(l||b)},d,d.exports,t,i,n,r)}return n[h].exports}for(var o=typeof Te=="function"&&Te,a=0;a<r.length;a++)s(r[a]);return s})({1:[function(t,i,n){var r=t("./utils"),s=t("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.encode=function(a){for(var h,u,f,g,d,b,l,p=[],y=0,v=a.length,_=v,S=r.getTypeOf(a)!=="string";y<a.length;)_=v-y,f=S?(h=a[y++],u=y<v?a[y++]:0,y<v?a[y++]:0):(h=a.charCodeAt(y++),u=y<v?a.charCodeAt(y++):0,y<v?a.charCodeAt(y++):0),g=h>>2,d=(3&h)<<4|u>>4,b=1<_?(15&u)<<2|f>>6:64,l=2<_?63&f:64,p.push(o.charAt(g)+o.charAt(d)+o.charAt(b)+o.charAt(l));return p.join("")},n.decode=function(a){var h,u,f,g,d,b,l=0,p=0,y="data:";if(a.substr(0,y.length)===y)throw new Error("Invalid base64 input, it looks like a data url.");var v,_=3*(a=a.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(a.charAt(a.length-1)===o.charAt(64)&&_--,a.charAt(a.length-2)===o.charAt(64)&&_--,_%1!=0)throw new Error("Invalid base64 input, bad content length.");for(v=s.uint8array?new Uint8Array(0|_):new Array(0|_);l<a.length;)h=o.indexOf(a.charAt(l++))<<2|(g=o.indexOf(a.charAt(l++)))>>4,u=(15&g)<<4|(d=o.indexOf(a.charAt(l++)))>>2,f=(3&d)<<6|(b=o.indexOf(a.charAt(l++))),v[p++]=h,d!==64&&(v[p++]=u),b!==64&&(v[p++]=f);return v}},{"./support":30,"./utils":32}],2:[function(t,i,n){var r=t("./external"),s=t("./stream/DataWorker"),o=t("./stream/Crc32Probe"),a=t("./stream/DataLengthProbe");function h(u,f,g,d,b){this.compressedSize=u,this.uncompressedSize=f,this.crc32=g,this.compression=d,this.compressedContent=b}h.prototype={getContentWorker:function(){var u=new s(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),f=this;return u.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),u},getCompressedWorker:function(){return new s(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},h.createWorkerFrom=function(u,f,g){return u.pipe(new o).pipe(new a("uncompressedSize")).pipe(f.compressWorker(g)).pipe(new a("compressedSize")).withStreamInfo("compression",f)},i.exports=h},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,i,n){var r=t("./stream/GenericWorker");n.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},n.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,i,n){var r=t("./utils"),s=(function(){for(var o,a=[],h=0;h<256;h++){o=h;for(var u=0;u<8;u++)o=1&o?3988292384^o>>>1:o>>>1;a[h]=o}return a})();i.exports=function(o,a){return o!==void 0&&o.length?r.getTypeOf(o)!=="string"?(function(h,u,f,g){var d=s,b=g+f;h^=-1;for(var l=g;l<b;l++)h=h>>>8^d[255&(h^u[l])];return-1^h})(0|a,o,o.length,0):(function(h,u,f,g){var d=s,b=g+f;h^=-1;for(var l=g;l<b;l++)h=h>>>8^d[255&(h^u.charCodeAt(l))];return-1^h})(0|a,o,o.length,0):0}},{"./utils":32}],5:[function(t,i,n){n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(t,i,n){var r=null;r=typeof Promise<"u"?Promise:t("lie"),i.exports={Promise:r}},{lie:37}],7:[function(t,i,n){var r=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=t("pako"),o=t("./utils"),a=t("./stream/GenericWorker"),h=r?"uint8array":"array";function u(f,g){a.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=g,this.meta={}}n.magic="\b\0",o.inherits(u,a),u.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(h,f.data),!1)},u.prototype.flush=function(){a.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(g){f.push({data:g,meta:f.meta})}},n.compressWorker=function(f){return new u("Deflate",f)},n.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,i,n){function r(d,b){var l,p="";for(l=0;l<b;l++)p+=String.fromCharCode(255&d),d>>>=8;return p}function s(d,b,l,p,y,v){var _,S,E=d.file,D=d.compression,P=v!==h.utf8encode,F=o.transformTo("string",v(E.name)),B=o.transformTo("string",h.utf8encode(E.name)),H=E.comment,q=o.transformTo("string",v(H)),M=o.transformTo("string",h.utf8encode(H)),R=B.length!==E.name.length,m=M.length!==H.length,N="",ee="",V="",te=E.dir,G=E.date,Q={crc32:0,compressedSize:0,uncompressedSize:0};b&&!l||(Q.crc32=d.crc32,Q.compressedSize=d.compressedSize,Q.uncompressedSize=d.uncompressedSize);var L=0;b&&(L|=8),P||!R&&!m||(L|=2048);var A=0,J=0;te&&(A|=16),y==="UNIX"?(J=798,A|=(function(Y,ae){var fe=Y;return Y||(fe=ae?16893:33204),(65535&fe)<<16})(E.unixPermissions,te)):(J=20,A|=(function(Y){return 63&(Y||0)})(E.dosPermissions)),_=G.getUTCHours(),_<<=6,_|=G.getUTCMinutes(),_<<=5,_|=G.getUTCSeconds()/2,S=G.getUTCFullYear()-1980,S<<=4,S|=G.getUTCMonth()+1,S<<=5,S|=G.getUTCDate(),R&&(ee=r(1,1)+r(u(F),4)+B,N+="up"+r(ee.length,2)+ee),m&&(V=r(1,1)+r(u(q),4)+M,N+="uc"+r(V.length,2)+V);var X="";return X+=`
113
- \0`,X+=r(L,2),X+=D.magic,X+=r(_,2),X+=r(S,2),X+=r(Q.crc32,4),X+=r(Q.compressedSize,4),X+=r(Q.uncompressedSize,4),X+=r(F.length,2),X+=r(N.length,2),{fileRecord:f.LOCAL_FILE_HEADER+X+F+N,dirRecord:f.CENTRAL_FILE_HEADER+r(J,2)+X+r(q.length,2)+"\0\0\0\0"+r(A,4)+r(p,4)+F+N+q}}var o=t("../utils"),a=t("../stream/GenericWorker"),h=t("../utf8"),u=t("../crc32"),f=t("../signature");function g(d,b,l,p){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=b,this.zipPlatform=l,this.encodeFileName=p,this.streamFiles=d,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(g,a),g.prototype.push=function(d){var b=d.meta.percent||0,l=this.entriesCount,p=this._sources.length;this.accumulate?this.contentBuffer.push(d):(this.bytesWritten+=d.data.length,a.prototype.push.call(this,{data:d.data,meta:{currentFile:this.currentFile,percent:l?(b+100*(l-p-1))/l:100}}))},g.prototype.openedSource=function(d){this.currentSourceOffset=this.bytesWritten,this.currentFile=d.file.name;var b=this.streamFiles&&!d.file.dir;if(b){var l=s(d,b,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:l.fileRecord,meta:{percent:0}})}else this.accumulate=!0},g.prototype.closedSource=function(d){this.accumulate=!1;var b=this.streamFiles&&!d.file.dir,l=s(d,b,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(l.dirRecord),b)this.push({data:(function(p){return f.DATA_DESCRIPTOR+r(p.crc32,4)+r(p.compressedSize,4)+r(p.uncompressedSize,4)})(d),meta:{percent:100}});else for(this.push({data:l.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},g.prototype.flush=function(){for(var d=this.bytesWritten,b=0;b<this.dirRecords.length;b++)this.push({data:this.dirRecords[b],meta:{percent:100}});var l=this.bytesWritten-d,p=(function(y,v,_,S,E){var D=o.transformTo("string",E(S));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(y,2)+r(y,2)+r(v,4)+r(_,4)+r(D.length,2)+D})(this.dirRecords.length,l,d,this.zipComment,this.encodeFileName);this.push({data:p,meta:{percent:100}})},g.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},g.prototype.registerPrevious=function(d){this._sources.push(d);var b=this;return d.on("data",function(l){b.processChunk(l)}),d.on("end",function(){b.closedSource(b.previous.streamInfo),b._sources.length?b.prepareNextSource():b.end()}),d.on("error",function(l){b.error(l)}),this},g.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},g.prototype.error=function(d){var b=this._sources;if(!a.prototype.error.call(this,d))return!1;for(var l=0;l<b.length;l++)try{b[l].error(d)}catch{}return!0},g.prototype.lock=function(){a.prototype.lock.call(this);for(var d=this._sources,b=0;b<d.length;b++)d[b].lock()},i.exports=g},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,i,n){var r=t("../compressions"),s=t("./ZipFileWorker");n.generateWorker=function(o,a,h){var u=new s(a.streamFiles,h,a.platform,a.encodeFileName),f=0;try{o.forEach(function(g,d){f++;var b=(function(v,_){var S=v||_,E=r[S];if(!E)throw new Error(S+" is not a valid compression method !");return E})(d.options.compression,a.compression),l=d.options.compressionOptions||a.compressionOptions||{},p=d.dir,y=d.date;d._compressWorker(b,l).withStreamInfo("file",{name:g,dir:p,date:y,comment:d.comment||"",unixPermissions:d.unixPermissions,dosPermissions:d.dosPermissions}).pipe(u)}),u.entriesCount=f}catch(g){u.error(g)}return u}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,i,n){function r(){if(!(this instanceof r))return new r;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 s=new r;for(var o in this)typeof this[o]!="function"&&(s[o]=this[o]);return s}}(r.prototype=t("./object")).loadAsync=t("./load"),r.support=t("./support"),r.defaults=t("./defaults"),r.version="3.10.1",r.loadAsync=function(s,o){return new r().loadAsync(s,o)},r.external=t("./external"),i.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,i,n){var r=t("./utils"),s=t("./external"),o=t("./utf8"),a=t("./zipEntries"),h=t("./stream/Crc32Probe"),u=t("./nodejsUtils");function f(g){return new s.Promise(function(d,b){var l=g.decompressed.getContentWorker().pipe(new h);l.on("error",function(p){b(p)}).on("end",function(){l.streamInfo.crc32!==g.decompressed.crc32?b(new Error("Corrupted zip : CRC32 mismatch")):d()}).resume()})}i.exports=function(g,d){var b=this;return d=r.extend(d||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),u.isNode&&u.isStream(g)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",g,!0,d.optimizedBinaryString,d.base64).then(function(l){var p=new a(d);return p.load(l),p}).then(function(l){var p=[s.Promise.resolve(l)],y=l.files;if(d.checkCRC32)for(var v=0;v<y.length;v++)p.push(f(y[v]));return s.Promise.all(p)}).then(function(l){for(var p=l.shift(),y=p.files,v=0;v<y.length;v++){var _=y[v],S=_.fileNameStr,E=r.resolve(_.fileNameStr);b.file(E,_.decompressed,{binary:!0,optimizedBinaryString:!0,date:_.date,dir:_.dir,comment:_.fileCommentStr.length?_.fileCommentStr:null,unixPermissions:_.unixPermissions,dosPermissions:_.dosPermissions,createFolders:d.createFolders}),_.dir||(b.file(E).unsafeOriginalName=S)}return p.zipComment.length&&(b.comment=p.zipComment),b})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,i,n){var r=t("../utils"),s=t("../stream/GenericWorker");function o(a,h){s.call(this,"Nodejs stream input adapter for "+a),this._upstreamEnded=!1,this._bindStream(h)}r.inherits(o,s),o.prototype._bindStream=function(a){var h=this;(this._stream=a).pause(),a.on("data",function(u){h.push({data:u,meta:{percent:0}})}).on("error",function(u){h.isPaused?this.generatedError=u:h.error(u)}).on("end",function(){h.isPaused?h._upstreamEnded=!0:h.end()})},o.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},i.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,i,n){var r=t("readable-stream").Readable;function s(o,a,h){r.call(this,a),this._helper=o;var u=this;o.on("data",function(f,g){u.push(f)||u._helper.pause(),h&&h(g)}).on("error",function(f){u.emit("error",f)}).on("end",function(){u.push(null)})}t("../utils").inherits(s,r),s.prototype._read=function(){this._helper.resume()},i.exports=s},{"../utils":32,"readable-stream":16}],14:[function(t,i,n){i.exports={isNode:typeof Buffer<"u",newBufferFrom:function(r,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(r,s);if(typeof r=="number")throw new Error('The "data" argument must not be a number');return new Buffer(r,s)},allocBuffer:function(r){if(Buffer.alloc)return Buffer.alloc(r);var s=new Buffer(r);return s.fill(0),s},isBuffer:function(r){return Buffer.isBuffer(r)},isStream:function(r){return r&&typeof r.on=="function"&&typeof r.pause=="function"&&typeof r.resume=="function"}}},{}],15:[function(t,i,n){function r(E,D,P){var F,B=o.getTypeOf(D),H=o.extend(P||{},u);H.date=H.date||new Date,H.compression!==null&&(H.compression=H.compression.toUpperCase()),typeof H.unixPermissions=="string"&&(H.unixPermissions=parseInt(H.unixPermissions,8)),H.unixPermissions&&16384&H.unixPermissions&&(H.dir=!0),H.dosPermissions&&16&H.dosPermissions&&(H.dir=!0),H.dir&&(E=y(E)),H.createFolders&&(F=p(E))&&v.call(this,F,!0);var q=B==="string"&&H.binary===!1&&H.base64===!1;P&&P.binary!==void 0||(H.binary=!q),(D instanceof f&&D.uncompressedSize===0||H.dir||!D||D.length===0)&&(H.base64=!1,H.binary=!0,D="",H.compression="STORE",B="string");var M=null;M=D instanceof f||D instanceof a?D:b.isNode&&b.isStream(D)?new l(E,D):o.prepareContent(E,D,H.binary,H.optimizedBinaryString,H.base64);var R=new g(E,M,H);this.files[E]=R}var s=t("./utf8"),o=t("./utils"),a=t("./stream/GenericWorker"),h=t("./stream/StreamHelper"),u=t("./defaults"),f=t("./compressedObject"),g=t("./zipObject"),d=t("./generate"),b=t("./nodejsUtils"),l=t("./nodejs/NodejsStreamInputAdapter"),p=function(E){E.slice(-1)==="/"&&(E=E.substring(0,E.length-1));var D=E.lastIndexOf("/");return 0<D?E.substring(0,D):""},y=function(E){return E.slice(-1)!=="/"&&(E+="/"),E},v=function(E,D){return D=D!==void 0?D:u.createFolders,E=y(E),this.files[E]||r.call(this,E,null,{dir:!0,createFolders:D}),this.files[E]};function _(E){return Object.prototype.toString.call(E)==="[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(E){var D,P,F;for(D in this.files)F=this.files[D],(P=D.slice(this.root.length,D.length))&&D.slice(0,this.root.length)===this.root&&E(P,F)},filter:function(E){var D=[];return this.forEach(function(P,F){E(P,F)&&D.push(F)}),D},file:function(E,D,P){if(arguments.length!==1)return E=this.root+E,r.call(this,E,D,P),this;if(_(E)){var F=E;return this.filter(function(H,q){return!q.dir&&F.test(H)})}var B=this.files[this.root+E];return B&&!B.dir?B:null},folder:function(E){if(!E)return this;if(_(E))return this.filter(function(B,H){return H.dir&&E.test(B)});var D=this.root+E,P=v.call(this,D),F=this.clone();return F.root=P.name,F},remove:function(E){E=this.root+E;var D=this.files[E];if(D||(E.slice(-1)!=="/"&&(E+="/"),D=this.files[E]),D&&!D.dir)delete this.files[E];else for(var P=this.filter(function(B,H){return H.name.slice(0,E.length)===E}),F=0;F<P.length;F++)delete this.files[P[F].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(E){var D,P={};try{if((P=o.extend(E||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=P.type.toLowerCase(),P.compression=P.compression.toUpperCase(),P.type==="binarystring"&&(P.type="string"),!P.type)throw new Error("No output type specified.");o.checkSupport(P.type),P.platform!=="darwin"&&P.platform!=="freebsd"&&P.platform!=="linux"&&P.platform!=="sunos"||(P.platform="UNIX"),P.platform==="win32"&&(P.platform="DOS");var F=P.comment||this.comment||"";D=d.generateWorker(this,P,F)}catch(B){(D=new a("error")).error(B)}return new h(D,P.type||"string",P.mimeType)},generateAsync:function(E,D){return this.generateInternalStream(E).accumulate(D)},generateNodeStream:function(E,D){return(E=E||{}).type||(E.type="nodebuffer"),this.generateInternalStream(E).toNodejsStream(D)}};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(t,i,n){i.exports=t("stream")},{stream:void 0}],17:[function(t,i,n){var r=t("./DataReader");function s(o){r.call(this,o);for(var a=0;a<this.data.length;a++)o[a]=255&o[a]}t("../utils").inherits(s,r),s.prototype.byteAt=function(o){return this.data[this.zero+o]},s.prototype.lastIndexOfSignature=function(o){for(var a=o.charCodeAt(0),h=o.charCodeAt(1),u=o.charCodeAt(2),f=o.charCodeAt(3),g=this.length-4;0<=g;--g)if(this.data[g]===a&&this.data[g+1]===h&&this.data[g+2]===u&&this.data[g+3]===f)return g-this.zero;return-1},s.prototype.readAndCheckSignature=function(o){var a=o.charCodeAt(0),h=o.charCodeAt(1),u=o.charCodeAt(2),f=o.charCodeAt(3),g=this.readData(4);return a===g[0]&&h===g[1]&&u===g[2]&&f===g[3]},s.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},i.exports=s},{"../utils":32,"./DataReader":18}],18:[function(t,i,n){var r=t("../utils");function s(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var a,h=0;for(this.checkOffset(o),a=this.index+o-1;a>=this.index;a--)h=(h<<8)+this.byteAt(a);return this.index+=o,h},readString:function(o){return r.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},i.exports=s},{"../utils":32}],19:[function(t,i,n){var r=t("./Uint8ArrayReader");function s(o){r.call(this,o)}t("../utils").inherits(s,r),s.prototype.readData=function(o){this.checkOffset(o);var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},i.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,i,n){var r=t("./DataReader");function s(o){r.call(this,o)}t("../utils").inherits(s,r),s.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},s.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},s.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},s.prototype.readData=function(o){this.checkOffset(o);var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},i.exports=s},{"../utils":32,"./DataReader":18}],21:[function(t,i,n){var r=t("./ArrayReader");function s(o){r.call(this,o)}t("../utils").inherits(s,r),s.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var a=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},i.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(t,i,n){var r=t("../utils"),s=t("../support"),o=t("./ArrayReader"),a=t("./StringReader"),h=t("./NodeBufferReader"),u=t("./Uint8ArrayReader");i.exports=function(f){var g=r.getTypeOf(f);return r.checkSupport(g),g!=="string"||s.uint8array?g==="nodebuffer"?new h(f):s.uint8array?new u(r.transformTo("uint8array",f)):new o(r.transformTo("array",f)):new a(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,i,n){n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,i,n){var r=t("./GenericWorker"),s=t("../utils");function o(a){r.call(this,"ConvertWorker to "+a),this.destType=a}s.inherits(o,r),o.prototype.processChunk=function(a){this.push({data:s.transformTo(this.destType,a.data),meta:a.meta})},i.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,i,n){var r=t("./GenericWorker"),s=t("../crc32");function o(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(o,r),o.prototype.processChunk=function(a){this.streamInfo.crc32=s(a.data,this.streamInfo.crc32||0),this.push(a)},i.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,i,n){var r=t("../utils"),s=t("./GenericWorker");function o(a){s.call(this,"DataLengthProbe for "+a),this.propName=a,this.withStreamInfo(a,0)}r.inherits(o,s),o.prototype.processChunk=function(a){if(a){var h=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=h+a.data.length}s.prototype.processChunk.call(this,a)},i.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,i,n){var r=t("../utils"),s=t("./GenericWorker");function o(a){s.call(this,"DataWorker");var h=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,a.then(function(u){h.dataIsReady=!0,h.data=u,h.max=u&&u.length||0,h.type=r.getTypeOf(u),h.isPaused||h._tickAndRepeat()},function(u){h.error(u)})}r.inherits(o,s),o.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var a=null,h=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":a=this.data.substring(this.index,h);break;case"uint8array":a=this.data.subarray(this.index,h);break;case"array":case"nodebuffer":a=this.data.slice(this.index,h)}return this.index=h,this.push({data:a,meta:{percent:this.max?this.index/this.max*100:0}})},i.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(t,i,n){function r(s){this.name=s||"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}r.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,o){return this._listeners[s].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,o){if(this._listeners[s])for(var a=0;a<this._listeners[s].length;a++)this._listeners[s][a].call(this,o)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var o=this;return s.on("data",function(a){o.processChunk(a)}),s.on("end",function(){o.end()}),s.on("error",function(a){o.error(a)}),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 s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,o){return this.extraStreamInfo[s]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},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 s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},i.exports=r},{}],29:[function(t,i,n){var r=t("../utils"),s=t("./ConvertWorker"),o=t("./GenericWorker"),a=t("../base64"),h=t("../support"),u=t("../external"),f=null;if(h.nodestream)try{f=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function g(b,l){return new u.Promise(function(p,y){var v=[],_=b._internalType,S=b._outputType,E=b._mimeType;b.on("data",function(D,P){v.push(D),l&&l(P)}).on("error",function(D){v=[],y(D)}).on("end",function(){try{var D=(function(P,F,B){switch(P){case"blob":return r.newBlob(r.transformTo("arraybuffer",F),B);case"base64":return a.encode(F);default:return r.transformTo(P,F)}})(S,(function(P,F){var B,H=0,q=null,M=0;for(B=0;B<F.length;B++)M+=F[B].length;switch(P){case"string":return F.join("");case"array":return Array.prototype.concat.apply([],F);case"uint8array":for(q=new Uint8Array(M),B=0;B<F.length;B++)q.set(F[B],H),H+=F[B].length;return q;case"nodebuffer":return Buffer.concat(F);default:throw new Error("concat : unsupported type '"+P+"'")}})(_,v),E);p(D)}catch(P){y(P)}v=[]}).resume()})}function d(b,l,p){var y=l;switch(l){case"blob":case"arraybuffer":y="uint8array";break;case"base64":y="string"}try{this._internalType=y,this._outputType=l,this._mimeType=p,r.checkSupport(y),this._worker=b.pipe(new s(y)),b.lock()}catch(v){this._worker=new o("error"),this._worker.error(v)}}d.prototype={accumulate:function(b){return g(this,b)},on:function(b,l){var p=this;return b==="data"?this._worker.on(b,function(y){l.call(p,y.data,y.meta)}):this._worker.on(b,function(){r.delay(l,arguments,p)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(b){if(r.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},b)}},i.exports=d},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,i,n){if(n.base64=!0,n.array=!0,n.string=!0,n.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",n.nodebuffer=typeof Buffer<"u",n.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")n.blob=!1;else{var r=new ArrayBuffer(0);try{n.blob=new Blob([r],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(r),n.blob=s.getBlob("application/zip").size===0}catch{n.blob=!1}}}try{n.nodestream=!!t("readable-stream").Readable}catch{n.nodestream=!1}},{"readable-stream":16}],31:[function(t,i,n){for(var r=t("./utils"),s=t("./support"),o=t("./nodejsUtils"),a=t("./stream/GenericWorker"),h=new Array(256),u=0;u<256;u++)h[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;h[254]=h[254]=1;function f(){a.call(this,"utf-8 decode"),this.leftOver=null}function g(){a.call(this,"utf-8 encode")}n.utf8encode=function(d){return s.nodebuffer?o.newBufferFrom(d,"utf-8"):(function(b){var l,p,y,v,_,S=b.length,E=0;for(v=0;v<S;v++)(64512&(p=b.charCodeAt(v)))==55296&&v+1<S&&(64512&(y=b.charCodeAt(v+1)))==56320&&(p=65536+(p-55296<<10)+(y-56320),v++),E+=p<128?1:p<2048?2:p<65536?3:4;for(l=s.uint8array?new Uint8Array(E):new Array(E),v=_=0;_<E;v++)(64512&(p=b.charCodeAt(v)))==55296&&v+1<S&&(64512&(y=b.charCodeAt(v+1)))==56320&&(p=65536+(p-55296<<10)+(y-56320),v++),p<128?l[_++]=p:(p<2048?l[_++]=192|p>>>6:(p<65536?l[_++]=224|p>>>12:(l[_++]=240|p>>>18,l[_++]=128|p>>>12&63),l[_++]=128|p>>>6&63),l[_++]=128|63&p);return l})(d)},n.utf8decode=function(d){return s.nodebuffer?r.transformTo("nodebuffer",d).toString("utf-8"):(function(b){var l,p,y,v,_=b.length,S=new Array(2*_);for(l=p=0;l<_;)if((y=b[l++])<128)S[p++]=y;else if(4<(v=h[y]))S[p++]=65533,l+=v-1;else{for(y&=v===2?31:v===3?15:7;1<v&&l<_;)y=y<<6|63&b[l++],v--;1<v?S[p++]=65533:y<65536?S[p++]=y:(y-=65536,S[p++]=55296|y>>10&1023,S[p++]=56320|1023&y)}return S.length!==p&&(S.subarray?S=S.subarray(0,p):S.length=p),r.applyFromCharCode(S)})(d=r.transformTo(s.uint8array?"uint8array":"array",d))},r.inherits(f,a),f.prototype.processChunk=function(d){var b=r.transformTo(s.uint8array?"uint8array":"array",d.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var l=b;(b=new Uint8Array(l.length+this.leftOver.length)).set(this.leftOver,0),b.set(l,this.leftOver.length)}else b=this.leftOver.concat(b);this.leftOver=null}var p=(function(v,_){var S;for((_=_||v.length)>v.length&&(_=v.length),S=_-1;0<=S&&(192&v[S])==128;)S--;return S<0||S===0?_:S+h[v[S]]>_?S:_})(b),y=b;p!==b.length&&(s.uint8array?(y=b.subarray(0,p),this.leftOver=b.subarray(p,b.length)):(y=b.slice(0,p),this.leftOver=b.slice(p,b.length))),this.push({data:n.utf8decode(y),meta:d.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=f,r.inherits(g,a),g.prototype.processChunk=function(d){this.push({data:n.utf8encode(d.data),meta:d.meta})},n.Utf8EncodeWorker=g},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,i,n){var r=t("./support"),s=t("./base64"),o=t("./nodejsUtils"),a=t("./external");function h(l){return l}function u(l,p){for(var y=0;y<l.length;++y)p[y]=255&l.charCodeAt(y);return p}t("setimmediate"),n.newBlob=function(l,p){n.checkSupport("blob");try{return new Blob([l],{type:p})}catch{try{var y=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return y.append(l),y.getBlob(p)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(l,p,y){var v=[],_=0,S=l.length;if(S<=y)return String.fromCharCode.apply(null,l);for(;_<S;)p==="array"||p==="nodebuffer"?v.push(String.fromCharCode.apply(null,l.slice(_,Math.min(_+y,S)))):v.push(String.fromCharCode.apply(null,l.subarray(_,Math.min(_+y,S)))),_+=y;return v.join("")},stringifyByChar:function(l){for(var p="",y=0;y<l.length;y++)p+=String.fromCharCode(l[y]);return p},applyCanBeUsed:{uint8array:(function(){try{return r.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return r.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch{return!1}})()}};function g(l){var p=65536,y=n.getTypeOf(l),v=!0;if(y==="uint8array"?v=f.applyCanBeUsed.uint8array:y==="nodebuffer"&&(v=f.applyCanBeUsed.nodebuffer),v)for(;1<p;)try{return f.stringifyByChunk(l,y,p)}catch{p=Math.floor(p/2)}return f.stringifyByChar(l)}function d(l,p){for(var y=0;y<l.length;y++)p[y]=l[y];return p}n.applyFromCharCode=g;var b={};b.string={string:h,array:function(l){return u(l,new Array(l.length))},arraybuffer:function(l){return b.string.uint8array(l).buffer},uint8array:function(l){return u(l,new Uint8Array(l.length))},nodebuffer:function(l){return u(l,o.allocBuffer(l.length))}},b.array={string:g,array:h,arraybuffer:function(l){return new Uint8Array(l).buffer},uint8array:function(l){return new Uint8Array(l)},nodebuffer:function(l){return o.newBufferFrom(l)}},b.arraybuffer={string:function(l){return g(new Uint8Array(l))},array:function(l){return d(new Uint8Array(l),new Array(l.byteLength))},arraybuffer:h,uint8array:function(l){return new Uint8Array(l)},nodebuffer:function(l){return o.newBufferFrom(new Uint8Array(l))}},b.uint8array={string:g,array:function(l){return d(l,new Array(l.length))},arraybuffer:function(l){return l.buffer},uint8array:h,nodebuffer:function(l){return o.newBufferFrom(l)}},b.nodebuffer={string:g,array:function(l){return d(l,new Array(l.length))},arraybuffer:function(l){return b.nodebuffer.uint8array(l).buffer},uint8array:function(l){return d(l,new Uint8Array(l.length))},nodebuffer:h},n.transformTo=function(l,p){if(p=p||"",!l)return p;n.checkSupport(l);var y=n.getTypeOf(p);return b[y][l](p)},n.resolve=function(l){for(var p=l.split("/"),y=[],v=0;v<p.length;v++){var _=p[v];_==="."||_===""&&v!==0&&v!==p.length-1||(_===".."?y.pop():y.push(_))}return y.join("/")},n.getTypeOf=function(l){return typeof l=="string"?"string":Object.prototype.toString.call(l)==="[object Array]"?"array":r.nodebuffer&&o.isBuffer(l)?"nodebuffer":r.uint8array&&l instanceof Uint8Array?"uint8array":r.arraybuffer&&l instanceof ArrayBuffer?"arraybuffer":void 0},n.checkSupport=function(l){if(!r[l.toLowerCase()])throw new Error(l+" is not supported by this platform")},n.MAX_VALUE_16BITS=65535,n.MAX_VALUE_32BITS=-1,n.pretty=function(l){var p,y,v="";for(y=0;y<(l||"").length;y++)v+="\\x"+((p=l.charCodeAt(y))<16?"0":"")+p.toString(16).toUpperCase();return v},n.delay=function(l,p,y){setImmediate(function(){l.apply(y||null,p||[])})},n.inherits=function(l,p){function y(){}y.prototype=p.prototype,l.prototype=new y},n.extend=function(){var l,p,y={};for(l=0;l<arguments.length;l++)for(p in arguments[l])Object.prototype.hasOwnProperty.call(arguments[l],p)&&y[p]===void 0&&(y[p]=arguments[l][p]);return y},n.prepareContent=function(l,p,y,v,_){return a.Promise.resolve(p).then(function(S){return r.blob&&(S instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(S))!==-1)&&typeof FileReader<"u"?new a.Promise(function(E,D){var P=new FileReader;P.onload=function(F){E(F.target.result)},P.onerror=function(F){D(F.target.error)},P.readAsArrayBuffer(S)}):S}).then(function(S){var E=n.getTypeOf(S);return E?(E==="arraybuffer"?S=n.transformTo("uint8array",S):E==="string"&&(_?S=s.decode(S):y&&v!==!0&&(S=(function(D){return u(D,r.uint8array?new Uint8Array(D.length):new Array(D.length))})(S))),S):a.Promise.reject(new Error("Can't read the data of '"+l+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,i,n){var r=t("./reader/readerFor"),s=t("./utils"),o=t("./signature"),a=t("./zipEntry"),h=t("./support");function u(f){this.files=[],this.loadOptions=f}u.prototype={checkSignature:function(f){if(!this.reader.readAndCheckSignature(f)){this.reader.index-=4;var g=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(g)+", expected "+s.pretty(f)+")")}},isSignature:function(f,g){var d=this.reader.index;this.reader.setIndex(f);var b=this.reader.readString(4)===g;return this.reader.setIndex(d),b},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 f=this.reader.readData(this.zipCommentLength),g=h.uint8array?"uint8array":"array",d=s.transformTo(g,f);this.zipComment=this.loadOptions.decodeFileName(d)},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 f,g,d,b=this.zip64EndOfCentralSize-44;0<b;)f=this.reader.readInt(2),g=this.reader.readInt(4),d=this.reader.readData(g),this.zip64ExtensibleData[f]={id:f,length:g,value:d}},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 f,g;for(f=0;f<this.files.length;f++)g=this.files[f],this.reader.setIndex(g.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),g.readLocalPart(this.reader),g.handleUTF8(),g.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(f=new a({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);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 f=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var g=f;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var d=this.centralDirOffset+this.centralDirSize;this.zip64&&(d+=20,d+=12+this.zip64EndOfCentralSize);var b=g-d;if(0<b)this.isSignature(g,o.CENTRAL_FILE_HEADER)||(this.reader.zero=b);else if(b<0)throw new Error("Corrupted zip: missing "+Math.abs(b)+" bytes.")},prepareReader:function(f){this.reader=r(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},i.exports=u},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,i,n){var r=t("./reader/readerFor"),s=t("./utils"),o=t("./compressedObject"),a=t("./crc32"),h=t("./utf8"),u=t("./compressions"),f=t("./support");function g(d,b){this.options=d,this.loadOptions=b}g.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(d){var b,l;if(d.skip(22),this.fileNameLength=d.readInt(2),l=d.readInt(2),this.fileName=d.readData(this.fileNameLength),d.skip(l),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((b=(function(p){for(var y in u)if(Object.prototype.hasOwnProperty.call(u,y)&&u[y].magic===p)return u[y];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,b,d.readData(this.compressedSize))},readCentralPart:function(d){this.versionMadeBy=d.readInt(2),d.skip(2),this.bitFlag=d.readInt(2),this.compressionMethod=d.readString(2),this.date=d.readDate(),this.crc32=d.readInt(4),this.compressedSize=d.readInt(4),this.uncompressedSize=d.readInt(4);var b=d.readInt(2);if(this.extraFieldsLength=d.readInt(2),this.fileCommentLength=d.readInt(2),this.diskNumberStart=d.readInt(2),this.internalFileAttributes=d.readInt(2),this.externalFileAttributes=d.readInt(4),this.localHeaderOffset=d.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");d.skip(b),this.readExtraFields(d),this.parseZIP64ExtraField(d),this.fileComment=d.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var d=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),d==0&&(this.dosPermissions=63&this.externalFileAttributes),d==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var d=r(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=d.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=d.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=d.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=d.readInt(4))}},readExtraFields:function(d){var b,l,p,y=d.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});d.index+4<y;)b=d.readInt(2),l=d.readInt(2),p=d.readData(l),this.extraFields[b]={id:b,length:l,value:p};d.setIndex(y)},handleUTF8:function(){var d=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=h.utf8decode(this.fileName),this.fileCommentStr=h.utf8decode(this.fileComment);else{var b=this.findExtraFieldUnicodePath();if(b!==null)this.fileNameStr=b;else{var l=s.transformTo(d,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(l)}var p=this.findExtraFieldUnicodeComment();if(p!==null)this.fileCommentStr=p;else{var y=s.transformTo(d,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(y)}}},findExtraFieldUnicodePath:function(){var d=this.extraFields[28789];if(d){var b=r(d.value);return b.readInt(1)!==1||a(this.fileName)!==b.readInt(4)?null:h.utf8decode(b.readData(d.length-5))}return null},findExtraFieldUnicodeComment:function(){var d=this.extraFields[25461];if(d){var b=r(d.value);return b.readInt(1)!==1||a(this.fileComment)!==b.readInt(4)?null:h.utf8decode(b.readData(d.length-5))}return null}},i.exports=g},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,i,n){function r(b,l,p){this.name=b,this.dir=p.dir,this.date=p.date,this.comment=p.comment,this.unixPermissions=p.unixPermissions,this.dosPermissions=p.dosPermissions,this._data=l,this._dataBinary=p.binary,this.options={compression:p.compression,compressionOptions:p.compressionOptions}}var s=t("./stream/StreamHelper"),o=t("./stream/DataWorker"),a=t("./utf8"),h=t("./compressedObject"),u=t("./stream/GenericWorker");r.prototype={internalStream:function(b){var l=null,p="string";try{if(!b)throw new Error("No output type specified.");var y=(p=b.toLowerCase())==="string"||p==="text";p!=="binarystring"&&p!=="text"||(p="string"),l=this._decompressWorker();var v=!this._dataBinary;v&&!y&&(l=l.pipe(new a.Utf8EncodeWorker)),!v&&y&&(l=l.pipe(new a.Utf8DecodeWorker))}catch(_){(l=new u("error")).error(_)}return new s(l,p,"")},async:function(b,l){return this.internalStream(b).accumulate(l)},nodeStream:function(b,l){return this.internalStream(b||"nodebuffer").toNodejsStream(l)},_compressWorker:function(b,l){if(this._data instanceof h&&this._data.compression.magic===b.magic)return this._data.getCompressedWorker();var p=this._decompressWorker();return this._dataBinary||(p=p.pipe(new a.Utf8EncodeWorker)),h.createWorkerFrom(p,b,l)},_decompressWorker:function(){return this._data instanceof h?this._data.getContentWorker():this._data instanceof u?this._data:new o(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],g=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},d=0;d<f.length;d++)r.prototype[f[d]]=g;i.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,i,n){(function(r){var s,o,a=r.MutationObserver||r.WebKitMutationObserver;if(a){var h=0,u=new a(b),f=r.document.createTextNode("");u.observe(f,{characterData:!0}),s=function(){f.data=h=++h%2}}else if(r.setImmediate||r.MessageChannel===void 0)s="document"in r&&"onreadystatechange"in r.document.createElement("script")?function(){var l=r.document.createElement("script");l.onreadystatechange=function(){b(),l.onreadystatechange=null,l.parentNode.removeChild(l),l=null},r.document.documentElement.appendChild(l)}:function(){setTimeout(b,0)};else{var g=new r.MessageChannel;g.port1.onmessage=b,s=function(){g.port2.postMessage(0)}}var d=[];function b(){var l,p;o=!0;for(var y=d.length;y;){for(p=d,d=[],l=-1;++l<y;)p[l]();y=d.length}o=!1}i.exports=function(l){d.push(l)!==1||o||s()}}).call(this,typeof Se<"u"?Se:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(t,i,n){var r=t("immediate");function s(){}var o={},a=["REJECTED"],h=["FULFILLED"],u=["PENDING"];function f(y){if(typeof y!="function")throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,y!==s&&l(this,y)}function g(y,v,_){this.promise=y,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof _=="function"&&(this.onRejected=_,this.callRejected=this.otherCallRejected)}function d(y,v,_){r(function(){var S;try{S=v(_)}catch(E){return o.reject(y,E)}S===y?o.reject(y,new TypeError("Cannot resolve promise with itself")):o.resolve(y,S)})}function b(y){var v=y&&y.then;if(y&&(typeof y=="object"||typeof y=="function")&&typeof v=="function")return function(){v.apply(y,arguments)}}function l(y,v){var _=!1;function S(P){_||(_=!0,o.reject(y,P))}function E(P){_||(_=!0,o.resolve(y,P))}var D=p(function(){v(E,S)});D.status==="error"&&S(D.value)}function p(y,v){var _={};try{_.value=y(v),_.status="success"}catch(S){_.status="error",_.value=S}return _}(i.exports=f).prototype.finally=function(y){if(typeof y!="function")return this;var v=this.constructor;return this.then(function(_){return v.resolve(y()).then(function(){return _})},function(_){return v.resolve(y()).then(function(){throw _})})},f.prototype.catch=function(y){return this.then(null,y)},f.prototype.then=function(y,v){if(typeof y!="function"&&this.state===h||typeof v!="function"&&this.state===a)return this;var _=new this.constructor(s);return this.state!==u?d(_,this.state===h?y:v,this.outcome):this.queue.push(new g(_,y,v)),_},g.prototype.callFulfilled=function(y){o.resolve(this.promise,y)},g.prototype.otherCallFulfilled=function(y){d(this.promise,this.onFulfilled,y)},g.prototype.callRejected=function(y){o.reject(this.promise,y)},g.prototype.otherCallRejected=function(y){d(this.promise,this.onRejected,y)},o.resolve=function(y,v){var _=p(b,v);if(_.status==="error")return o.reject(y,_.value);var S=_.value;if(S)l(y,S);else{y.state=h,y.outcome=v;for(var E=-1,D=y.queue.length;++E<D;)y.queue[E].callFulfilled(v)}return y},o.reject=function(y,v){y.state=a,y.outcome=v;for(var _=-1,S=y.queue.length;++_<S;)y.queue[_].callRejected(v);return y},f.resolve=function(y){return y instanceof this?y:o.resolve(new this(s),y)},f.reject=function(y){var v=new this(s);return o.reject(v,y)},f.all=function(y){var v=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var _=y.length,S=!1;if(!_)return this.resolve([]);for(var E=new Array(_),D=0,P=-1,F=new this(s);++P<_;)B(y[P],P);return F;function B(H,q){v.resolve(H).then(function(M){E[q]=M,++D!==_||S||(S=!0,o.resolve(F,E))},function(M){S||(S=!0,o.reject(F,M))})}},f.race=function(y){var v=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var _=y.length,S=!1;if(!_)return this.resolve([]);for(var E=-1,D=new this(s);++E<_;)P=y[E],v.resolve(P).then(function(F){S||(S=!0,o.resolve(D,F))},function(F){S||(S=!0,o.reject(D,F))});var P;return D}},{immediate:36}],38:[function(t,i,n){var r={};(0,t("./lib/utils/common").assign)(r,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),i.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,i,n){var r=t("./zlib/deflate"),s=t("./utils/common"),o=t("./utils/strings"),a=t("./zlib/messages"),h=t("./zlib/zstream"),u=Object.prototype.toString,f=0,g=-1,d=0,b=8;function l(y){if(!(this instanceof l))return new l(y);this.options=s.assign({level:g,method:b,chunkSize:16384,windowBits:15,memLevel:8,strategy:d,to:""},y||{});var v=this.options;v.raw&&0<v.windowBits?v.windowBits=-v.windowBits:v.gzip&&0<v.windowBits&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var _=r.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(_!==f)throw new Error(a[_]);if(v.header&&r.deflateSetHeader(this.strm,v.header),v.dictionary){var S;if(S=typeof v.dictionary=="string"?o.string2buf(v.dictionary):u.call(v.dictionary)==="[object ArrayBuffer]"?new Uint8Array(v.dictionary):v.dictionary,(_=r.deflateSetDictionary(this.strm,S))!==f)throw new Error(a[_]);this._dict_set=!0}}function p(y,v){var _=new l(v);if(_.push(y,!0),_.err)throw _.msg||a[_.err];return _.result}l.prototype.push=function(y,v){var _,S,E=this.strm,D=this.options.chunkSize;if(this.ended)return!1;S=v===~~v?v:v===!0?4:0,typeof y=="string"?E.input=o.string2buf(y):u.call(y)==="[object ArrayBuffer]"?E.input=new Uint8Array(y):E.input=y,E.next_in=0,E.avail_in=E.input.length;do{if(E.avail_out===0&&(E.output=new s.Buf8(D),E.next_out=0,E.avail_out=D),(_=r.deflate(E,S))!==1&&_!==f)return this.onEnd(_),!(this.ended=!0);E.avail_out!==0&&(E.avail_in!==0||S!==4&&S!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(s.shrinkBuf(E.output,E.next_out))):this.onData(s.shrinkBuf(E.output,E.next_out)))}while((0<E.avail_in||E.avail_out===0)&&_!==1);return S===4?(_=r.deflateEnd(this.strm),this.onEnd(_),this.ended=!0,_===f):S!==2||(this.onEnd(f),!(E.avail_out=0))},l.prototype.onData=function(y){this.chunks.push(y)},l.prototype.onEnd=function(y){y===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=y,this.msg=this.strm.msg},n.Deflate=l,n.deflate=p,n.deflateRaw=function(y,v){return(v=v||{}).raw=!0,p(y,v)},n.gzip=function(y,v){return(v=v||{}).gzip=!0,p(y,v)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,i,n){var r=t("./zlib/inflate"),s=t("./utils/common"),o=t("./utils/strings"),a=t("./zlib/constants"),h=t("./zlib/messages"),u=t("./zlib/zstream"),f=t("./zlib/gzheader"),g=Object.prototype.toString;function d(l){if(!(this instanceof d))return new d(l);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},l||{});var p=this.options;p.raw&&0<=p.windowBits&&p.windowBits<16&&(p.windowBits=-p.windowBits,p.windowBits===0&&(p.windowBits=-15)),!(0<=p.windowBits&&p.windowBits<16)||l&&l.windowBits||(p.windowBits+=32),15<p.windowBits&&p.windowBits<48&&(15&p.windowBits)==0&&(p.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var y=r.inflateInit2(this.strm,p.windowBits);if(y!==a.Z_OK)throw new Error(h[y]);this.header=new f,r.inflateGetHeader(this.strm,this.header)}function b(l,p){var y=new d(p);if(y.push(l,!0),y.err)throw y.msg||h[y.err];return y.result}d.prototype.push=function(l,p){var y,v,_,S,E,D,P=this.strm,F=this.options.chunkSize,B=this.options.dictionary,H=!1;if(this.ended)return!1;v=p===~~p?p:p===!0?a.Z_FINISH:a.Z_NO_FLUSH,typeof l=="string"?P.input=o.binstring2buf(l):g.call(l)==="[object ArrayBuffer]"?P.input=new Uint8Array(l):P.input=l,P.next_in=0,P.avail_in=P.input.length;do{if(P.avail_out===0&&(P.output=new s.Buf8(F),P.next_out=0,P.avail_out=F),(y=r.inflate(P,a.Z_NO_FLUSH))===a.Z_NEED_DICT&&B&&(D=typeof B=="string"?o.string2buf(B):g.call(B)==="[object ArrayBuffer]"?new Uint8Array(B):B,y=r.inflateSetDictionary(this.strm,D)),y===a.Z_BUF_ERROR&&H===!0&&(y=a.Z_OK,H=!1),y!==a.Z_STREAM_END&&y!==a.Z_OK)return this.onEnd(y),!(this.ended=!0);P.next_out&&(P.avail_out!==0&&y!==a.Z_STREAM_END&&(P.avail_in!==0||v!==a.Z_FINISH&&v!==a.Z_SYNC_FLUSH)||(this.options.to==="string"?(_=o.utf8border(P.output,P.next_out),S=P.next_out-_,E=o.buf2string(P.output,_),P.next_out=S,P.avail_out=F-S,S&&s.arraySet(P.output,P.output,_,S,0),this.onData(E)):this.onData(s.shrinkBuf(P.output,P.next_out)))),P.avail_in===0&&P.avail_out===0&&(H=!0)}while((0<P.avail_in||P.avail_out===0)&&y!==a.Z_STREAM_END);return y===a.Z_STREAM_END&&(v=a.Z_FINISH),v===a.Z_FINISH?(y=r.inflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===a.Z_OK):v!==a.Z_SYNC_FLUSH||(this.onEnd(a.Z_OK),!(P.avail_out=0))},d.prototype.onData=function(l){this.chunks.push(l)},d.prototype.onEnd=function(l){l===a.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=l,this.msg=this.strm.msg},n.Inflate=d,n.inflate=b,n.inflateRaw=function(l,p){return(p=p||{}).raw=!0,b(l,p)},n.ungzip=b},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,i,n){var r=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";n.assign=function(a){for(var h=Array.prototype.slice.call(arguments,1);h.length;){var u=h.shift();if(u){if(typeof u!="object")throw new TypeError(u+"must be non-object");for(var f in u)u.hasOwnProperty(f)&&(a[f]=u[f])}}return a},n.shrinkBuf=function(a,h){return a.length===h?a:a.subarray?a.subarray(0,h):(a.length=h,a)};var s={arraySet:function(a,h,u,f,g){if(h.subarray&&a.subarray)a.set(h.subarray(u,u+f),g);else for(var d=0;d<f;d++)a[g+d]=h[u+d]},flattenChunks:function(a){var h,u,f,g,d,b;for(h=f=0,u=a.length;h<u;h++)f+=a[h].length;for(b=new Uint8Array(f),h=g=0,u=a.length;h<u;h++)d=a[h],b.set(d,g),g+=d.length;return b}},o={arraySet:function(a,h,u,f,g){for(var d=0;d<f;d++)a[g+d]=h[u+d]},flattenChunks:function(a){return[].concat.apply([],a)}};n.setTyped=function(a){a?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,s)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,o))},n.setTyped(r)},{}],42:[function(t,i,n){var r=t("./common"),s=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{o=!1}for(var a=new r.Buf8(256),h=0;h<256;h++)a[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;function u(f,g){if(g<65537&&(f.subarray&&o||!f.subarray&&s))return String.fromCharCode.apply(null,r.shrinkBuf(f,g));for(var d="",b=0;b<g;b++)d+=String.fromCharCode(f[b]);return d}a[254]=a[254]=1,n.string2buf=function(f){var g,d,b,l,p,y=f.length,v=0;for(l=0;l<y;l++)(64512&(d=f.charCodeAt(l)))==55296&&l+1<y&&(64512&(b=f.charCodeAt(l+1)))==56320&&(d=65536+(d-55296<<10)+(b-56320),l++),v+=d<128?1:d<2048?2:d<65536?3:4;for(g=new r.Buf8(v),l=p=0;p<v;l++)(64512&(d=f.charCodeAt(l)))==55296&&l+1<y&&(64512&(b=f.charCodeAt(l+1)))==56320&&(d=65536+(d-55296<<10)+(b-56320),l++),d<128?g[p++]=d:(d<2048?g[p++]=192|d>>>6:(d<65536?g[p++]=224|d>>>12:(g[p++]=240|d>>>18,g[p++]=128|d>>>12&63),g[p++]=128|d>>>6&63),g[p++]=128|63&d);return g},n.buf2binstring=function(f){return u(f,f.length)},n.binstring2buf=function(f){for(var g=new r.Buf8(f.length),d=0,b=g.length;d<b;d++)g[d]=f.charCodeAt(d);return g},n.buf2string=function(f,g){var d,b,l,p,y=g||f.length,v=new Array(2*y);for(d=b=0;d<y;)if((l=f[d++])<128)v[b++]=l;else if(4<(p=a[l]))v[b++]=65533,d+=p-1;else{for(l&=p===2?31:p===3?15:7;1<p&&d<y;)l=l<<6|63&f[d++],p--;1<p?v[b++]=65533:l<65536?v[b++]=l:(l-=65536,v[b++]=55296|l>>10&1023,v[b++]=56320|1023&l)}return u(v,b)},n.utf8border=function(f,g){var d;for((g=g||f.length)>f.length&&(g=f.length),d=g-1;0<=d&&(192&f[d])==128;)d--;return d<0||d===0?g:d+a[f[d]]>g?d:g}},{"./common":41}],43:[function(t,i,n){i.exports=function(r,s,o,a){for(var h=65535&r|0,u=r>>>16&65535|0,f=0;o!==0;){for(o-=f=2e3<o?2e3:o;u=u+(h=h+s[a++]|0)|0,--f;);h%=65521,u%=65521}return h|u<<16|0}},{}],44:[function(t,i,n){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(t,i,n){var r=(function(){for(var s,o=[],a=0;a<256;a++){s=a;for(var h=0;h<8;h++)s=1&s?3988292384^s>>>1:s>>>1;o[a]=s}return o})();i.exports=function(s,o,a,h){var u=r,f=h+a;s^=-1;for(var g=h;g<f;g++)s=s>>>8^u[255&(s^o[g])];return-1^s}},{}],46:[function(t,i,n){var r,s=t("../utils/common"),o=t("./trees"),a=t("./adler32"),h=t("./crc32"),u=t("./messages"),f=0,g=4,d=0,b=-2,l=-1,p=4,y=2,v=8,_=9,S=286,E=30,D=19,P=2*S+1,F=15,B=3,H=258,q=H+B+1,M=42,R=113,m=1,N=2,ee=3,V=4;function te(c,O){return c.msg=u[O],O}function G(c){return(c<<1)-(4<c?9:0)}function Q(c){for(var O=c.length;0<=--O;)c[O]=0}function L(c){var O=c.state,z=O.pending;z>c.avail_out&&(z=c.avail_out),z!==0&&(s.arraySet(c.output,O.pending_buf,O.pending_out,z,c.next_out),c.next_out+=z,O.pending_out+=z,c.total_out+=z,c.avail_out-=z,O.pending-=z,O.pending===0&&(O.pending_out=0))}function A(c,O){o._tr_flush_block(c,0<=c.block_start?c.block_start:-1,c.strstart-c.block_start,O),c.block_start=c.strstart,L(c.strm)}function J(c,O){c.pending_buf[c.pending++]=O}function X(c,O){c.pending_buf[c.pending++]=O>>>8&255,c.pending_buf[c.pending++]=255&O}function Y(c,O){var z,x,w=c.max_chain_length,I=c.strstart,j=c.prev_length,U=c.nice_match,T=c.strstart>c.w_size-q?c.strstart-(c.w_size-q):0,W=c.window,$=c.w_mask,Z=c.prev,K=c.strstart+H,se=W[I+j-1],ne=W[I+j];c.prev_length>=c.good_match&&(w>>=2),U>c.lookahead&&(U=c.lookahead);do if(W[(z=O)+j]===ne&&W[z+j-1]===se&&W[z]===W[I]&&W[++z]===W[I+1]){I+=2,z++;do;while(W[++I]===W[++z]&&W[++I]===W[++z]&&W[++I]===W[++z]&&W[++I]===W[++z]&&W[++I]===W[++z]&&W[++I]===W[++z]&&W[++I]===W[++z]&&W[++I]===W[++z]&&I<K);if(x=H-(K-I),I=K-H,j<x){if(c.match_start=O,U<=(j=x))break;se=W[I+j-1],ne=W[I+j]}}while((O=Z[O&$])>T&&--w!=0);return j<=c.lookahead?j:c.lookahead}function ae(c){var O,z,x,w,I,j,U,T,W,$,Z=c.w_size;do{if(w=c.window_size-c.lookahead-c.strstart,c.strstart>=Z+(Z-q)){for(s.arraySet(c.window,c.window,Z,Z,0),c.match_start-=Z,c.strstart-=Z,c.block_start-=Z,O=z=c.hash_size;x=c.head[--O],c.head[O]=Z<=x?x-Z:0,--z;);for(O=z=Z;x=c.prev[--O],c.prev[O]=Z<=x?x-Z:0,--z;);w+=Z}if(c.strm.avail_in===0)break;if(j=c.strm,U=c.window,T=c.strstart+c.lookahead,W=w,$=void 0,$=j.avail_in,W<$&&($=W),z=$===0?0:(j.avail_in-=$,s.arraySet(U,j.input,j.next_in,$,T),j.state.wrap===1?j.adler=a(j.adler,U,$,T):j.state.wrap===2&&(j.adler=h(j.adler,U,$,T)),j.next_in+=$,j.total_in+=$,$),c.lookahead+=z,c.lookahead+c.insert>=B)for(I=c.strstart-c.insert,c.ins_h=c.window[I],c.ins_h=(c.ins_h<<c.hash_shift^c.window[I+1])&c.hash_mask;c.insert&&(c.ins_h=(c.ins_h<<c.hash_shift^c.window[I+B-1])&c.hash_mask,c.prev[I&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=I,I++,c.insert--,!(c.lookahead+c.insert<B)););}while(c.lookahead<q&&c.strm.avail_in!==0)}function fe(c,O){for(var z,x;;){if(c.lookahead<q){if(ae(c),c.lookahead<q&&O===f)return m;if(c.lookahead===0)break}if(z=0,c.lookahead>=B&&(c.ins_h=(c.ins_h<<c.hash_shift^c.window[c.strstart+B-1])&c.hash_mask,z=c.prev[c.strstart&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=c.strstart),z!==0&&c.strstart-z<=c.w_size-q&&(c.match_length=Y(c,z)),c.match_length>=B)if(x=o._tr_tally(c,c.strstart-c.match_start,c.match_length-B),c.lookahead-=c.match_length,c.match_length<=c.max_lazy_match&&c.lookahead>=B){for(c.match_length--;c.strstart++,c.ins_h=(c.ins_h<<c.hash_shift^c.window[c.strstart+B-1])&c.hash_mask,z=c.prev[c.strstart&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=c.strstart,--c.match_length!=0;);c.strstart++}else c.strstart+=c.match_length,c.match_length=0,c.ins_h=c.window[c.strstart],c.ins_h=(c.ins_h<<c.hash_shift^c.window[c.strstart+1])&c.hash_mask;else x=o._tr_tally(c,0,c.window[c.strstart]),c.lookahead--,c.strstart++;if(x&&(A(c,!1),c.strm.avail_out===0))return m}return c.insert=c.strstart<B-1?c.strstart:B-1,O===g?(A(c,!0),c.strm.avail_out===0?ee:V):c.last_lit&&(A(c,!1),c.strm.avail_out===0)?m:N}function ie(c,O){for(var z,x,w;;){if(c.lookahead<q){if(ae(c),c.lookahead<q&&O===f)return m;if(c.lookahead===0)break}if(z=0,c.lookahead>=B&&(c.ins_h=(c.ins_h<<c.hash_shift^c.window[c.strstart+B-1])&c.hash_mask,z=c.prev[c.strstart&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=c.strstart),c.prev_length=c.match_length,c.prev_match=c.match_start,c.match_length=B-1,z!==0&&c.prev_length<c.max_lazy_match&&c.strstart-z<=c.w_size-q&&(c.match_length=Y(c,z),c.match_length<=5&&(c.strategy===1||c.match_length===B&&4096<c.strstart-c.match_start)&&(c.match_length=B-1)),c.prev_length>=B&&c.match_length<=c.prev_length){for(w=c.strstart+c.lookahead-B,x=o._tr_tally(c,c.strstart-1-c.prev_match,c.prev_length-B),c.lookahead-=c.prev_length-1,c.prev_length-=2;++c.strstart<=w&&(c.ins_h=(c.ins_h<<c.hash_shift^c.window[c.strstart+B-1])&c.hash_mask,z=c.prev[c.strstart&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=c.strstart),--c.prev_length!=0;);if(c.match_available=0,c.match_length=B-1,c.strstart++,x&&(A(c,!1),c.strm.avail_out===0))return m}else if(c.match_available){if((x=o._tr_tally(c,0,c.window[c.strstart-1]))&&A(c,!1),c.strstart++,c.lookahead--,c.strm.avail_out===0)return m}else c.match_available=1,c.strstart++,c.lookahead--}return c.match_available&&(x=o._tr_tally(c,0,c.window[c.strstart-1]),c.match_available=0),c.insert=c.strstart<B-1?c.strstart:B-1,O===g?(A(c,!0),c.strm.avail_out===0?ee:V):c.last_lit&&(A(c,!1),c.strm.avail_out===0)?m:N}function re(c,O,z,x,w){this.good_length=c,this.max_lazy=O,this.nice_length=z,this.max_chain=x,this.func=w}function ue(){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=v,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 s.Buf16(2*P),this.dyn_dtree=new s.Buf16(2*(2*E+1)),this.bl_tree=new s.Buf16(2*(2*D+1)),Q(this.dyn_ltree),Q(this.dyn_dtree),Q(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(F+1),this.heap=new s.Buf16(2*S+1),Q(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*S+1),Q(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 le(c){var O;return c&&c.state?(c.total_in=c.total_out=0,c.data_type=y,(O=c.state).pending=0,O.pending_out=0,O.wrap<0&&(O.wrap=-O.wrap),O.status=O.wrap?M:R,c.adler=O.wrap===2?0:1,O.last_flush=f,o._tr_init(O),d):te(c,b)}function be(c){var O=le(c);return O===d&&(function(z){z.window_size=2*z.w_size,Q(z.head),z.max_lazy_match=r[z.level].max_lazy,z.good_match=r[z.level].good_length,z.nice_match=r[z.level].nice_length,z.max_chain_length=r[z.level].max_chain,z.strstart=0,z.block_start=0,z.lookahead=0,z.insert=0,z.match_length=z.prev_length=B-1,z.match_available=0,z.ins_h=0})(c.state),O}function ge(c,O,z,x,w,I){if(!c)return b;var j=1;if(O===l&&(O=6),x<0?(j=0,x=-x):15<x&&(j=2,x-=16),w<1||_<w||z!==v||x<8||15<x||O<0||9<O||I<0||p<I)return te(c,b);x===8&&(x=9);var U=new ue;return(c.state=U).strm=c,U.wrap=j,U.gzhead=null,U.w_bits=x,U.w_size=1<<U.w_bits,U.w_mask=U.w_size-1,U.hash_bits=w+7,U.hash_size=1<<U.hash_bits,U.hash_mask=U.hash_size-1,U.hash_shift=~~((U.hash_bits+B-1)/B),U.window=new s.Buf8(2*U.w_size),U.head=new s.Buf16(U.hash_size),U.prev=new s.Buf16(U.w_size),U.lit_bufsize=1<<w+6,U.pending_buf_size=4*U.lit_bufsize,U.pending_buf=new s.Buf8(U.pending_buf_size),U.d_buf=1*U.lit_bufsize,U.l_buf=3*U.lit_bufsize,U.level=O,U.strategy=I,U.method=z,be(c)}r=[new re(0,0,0,0,function(c,O){var z=65535;for(z>c.pending_buf_size-5&&(z=c.pending_buf_size-5);;){if(c.lookahead<=1){if(ae(c),c.lookahead===0&&O===f)return m;if(c.lookahead===0)break}c.strstart+=c.lookahead,c.lookahead=0;var x=c.block_start+z;if((c.strstart===0||c.strstart>=x)&&(c.lookahead=c.strstart-x,c.strstart=x,A(c,!1),c.strm.avail_out===0)||c.strstart-c.block_start>=c.w_size-q&&(A(c,!1),c.strm.avail_out===0))return m}return c.insert=0,O===g?(A(c,!0),c.strm.avail_out===0?ee:V):(c.strstart>c.block_start&&(A(c,!1),c.strm.avail_out),m)}),new re(4,4,8,4,fe),new re(4,5,16,8,fe),new re(4,6,32,32,fe),new re(4,4,16,16,ie),new re(8,16,32,32,ie),new re(8,16,128,128,ie),new re(8,32,128,256,ie),new re(32,128,258,1024,ie),new re(32,258,258,4096,ie)],n.deflateInit=function(c,O){return ge(c,O,v,15,8,0)},n.deflateInit2=ge,n.deflateReset=be,n.deflateResetKeep=le,n.deflateSetHeader=function(c,O){return c&&c.state?c.state.wrap!==2?b:(c.state.gzhead=O,d):b},n.deflate=function(c,O){var z,x,w,I;if(!c||!c.state||5<O||O<0)return c?te(c,b):b;if(x=c.state,!c.output||!c.input&&c.avail_in!==0||x.status===666&&O!==g)return te(c,c.avail_out===0?-5:b);if(x.strm=c,z=x.last_flush,x.last_flush=O,x.status===M)if(x.wrap===2)c.adler=0,J(x,31),J(x,139),J(x,8),x.gzhead?(J(x,(x.gzhead.text?1:0)+(x.gzhead.hcrc?2:0)+(x.gzhead.extra?4:0)+(x.gzhead.name?8:0)+(x.gzhead.comment?16:0)),J(x,255&x.gzhead.time),J(x,x.gzhead.time>>8&255),J(x,x.gzhead.time>>16&255),J(x,x.gzhead.time>>24&255),J(x,x.level===9?2:2<=x.strategy||x.level<2?4:0),J(x,255&x.gzhead.os),x.gzhead.extra&&x.gzhead.extra.length&&(J(x,255&x.gzhead.extra.length),J(x,x.gzhead.extra.length>>8&255)),x.gzhead.hcrc&&(c.adler=h(c.adler,x.pending_buf,x.pending,0)),x.gzindex=0,x.status=69):(J(x,0),J(x,0),J(x,0),J(x,0),J(x,0),J(x,x.level===9?2:2<=x.strategy||x.level<2?4:0),J(x,3),x.status=R);else{var j=v+(x.w_bits-8<<4)<<8;j|=(2<=x.strategy||x.level<2?0:x.level<6?1:x.level===6?2:3)<<6,x.strstart!==0&&(j|=32),j+=31-j%31,x.status=R,X(x,j),x.strstart!==0&&(X(x,c.adler>>>16),X(x,65535&c.adler)),c.adler=1}if(x.status===69)if(x.gzhead.extra){for(w=x.pending;x.gzindex<(65535&x.gzhead.extra.length)&&(x.pending!==x.pending_buf_size||(x.gzhead.hcrc&&x.pending>w&&(c.adler=h(c.adler,x.pending_buf,x.pending-w,w)),L(c),w=x.pending,x.pending!==x.pending_buf_size));)J(x,255&x.gzhead.extra[x.gzindex]),x.gzindex++;x.gzhead.hcrc&&x.pending>w&&(c.adler=h(c.adler,x.pending_buf,x.pending-w,w)),x.gzindex===x.gzhead.extra.length&&(x.gzindex=0,x.status=73)}else x.status=73;if(x.status===73)if(x.gzhead.name){w=x.pending;do{if(x.pending===x.pending_buf_size&&(x.gzhead.hcrc&&x.pending>w&&(c.adler=h(c.adler,x.pending_buf,x.pending-w,w)),L(c),w=x.pending,x.pending===x.pending_buf_size)){I=1;break}I=x.gzindex<x.gzhead.name.length?255&x.gzhead.name.charCodeAt(x.gzindex++):0,J(x,I)}while(I!==0);x.gzhead.hcrc&&x.pending>w&&(c.adler=h(c.adler,x.pending_buf,x.pending-w,w)),I===0&&(x.gzindex=0,x.status=91)}else x.status=91;if(x.status===91)if(x.gzhead.comment){w=x.pending;do{if(x.pending===x.pending_buf_size&&(x.gzhead.hcrc&&x.pending>w&&(c.adler=h(c.adler,x.pending_buf,x.pending-w,w)),L(c),w=x.pending,x.pending===x.pending_buf_size)){I=1;break}I=x.gzindex<x.gzhead.comment.length?255&x.gzhead.comment.charCodeAt(x.gzindex++):0,J(x,I)}while(I!==0);x.gzhead.hcrc&&x.pending>w&&(c.adler=h(c.adler,x.pending_buf,x.pending-w,w)),I===0&&(x.status=103)}else x.status=103;if(x.status===103&&(x.gzhead.hcrc?(x.pending+2>x.pending_buf_size&&L(c),x.pending+2<=x.pending_buf_size&&(J(x,255&c.adler),J(x,c.adler>>8&255),c.adler=0,x.status=R)):x.status=R),x.pending!==0){if(L(c),c.avail_out===0)return x.last_flush=-1,d}else if(c.avail_in===0&&G(O)<=G(z)&&O!==g)return te(c,-5);if(x.status===666&&c.avail_in!==0)return te(c,-5);if(c.avail_in!==0||x.lookahead!==0||O!==f&&x.status!==666){var U=x.strategy===2?(function(T,W){for(var $;;){if(T.lookahead===0&&(ae(T),T.lookahead===0)){if(W===f)return m;break}if(T.match_length=0,$=o._tr_tally(T,0,T.window[T.strstart]),T.lookahead--,T.strstart++,$&&(A(T,!1),T.strm.avail_out===0))return m}return T.insert=0,W===g?(A(T,!0),T.strm.avail_out===0?ee:V):T.last_lit&&(A(T,!1),T.strm.avail_out===0)?m:N})(x,O):x.strategy===3?(function(T,W){for(var $,Z,K,se,ne=T.window;;){if(T.lookahead<=H){if(ae(T),T.lookahead<=H&&W===f)return m;if(T.lookahead===0)break}if(T.match_length=0,T.lookahead>=B&&0<T.strstart&&(Z=ne[K=T.strstart-1])===ne[++K]&&Z===ne[++K]&&Z===ne[++K]){se=T.strstart+H;do;while(Z===ne[++K]&&Z===ne[++K]&&Z===ne[++K]&&Z===ne[++K]&&Z===ne[++K]&&Z===ne[++K]&&Z===ne[++K]&&Z===ne[++K]&&K<se);T.match_length=H-(se-K),T.match_length>T.lookahead&&(T.match_length=T.lookahead)}if(T.match_length>=B?($=o._tr_tally(T,1,T.match_length-B),T.lookahead-=T.match_length,T.strstart+=T.match_length,T.match_length=0):($=o._tr_tally(T,0,T.window[T.strstart]),T.lookahead--,T.strstart++),$&&(A(T,!1),T.strm.avail_out===0))return m}return T.insert=0,W===g?(A(T,!0),T.strm.avail_out===0?ee:V):T.last_lit&&(A(T,!1),T.strm.avail_out===0)?m:N})(x,O):r[x.level].func(x,O);if(U!==ee&&U!==V||(x.status=666),U===m||U===ee)return c.avail_out===0&&(x.last_flush=-1),d;if(U===N&&(O===1?o._tr_align(x):O!==5&&(o._tr_stored_block(x,0,0,!1),O===3&&(Q(x.head),x.lookahead===0&&(x.strstart=0,x.block_start=0,x.insert=0))),L(c),c.avail_out===0))return x.last_flush=-1,d}return O!==g?d:x.wrap<=0?1:(x.wrap===2?(J(x,255&c.adler),J(x,c.adler>>8&255),J(x,c.adler>>16&255),J(x,c.adler>>24&255),J(x,255&c.total_in),J(x,c.total_in>>8&255),J(x,c.total_in>>16&255),J(x,c.total_in>>24&255)):(X(x,c.adler>>>16),X(x,65535&c.adler)),L(c),0<x.wrap&&(x.wrap=-x.wrap),x.pending!==0?d:1)},n.deflateEnd=function(c){var O;return c&&c.state?(O=c.state.status)!==M&&O!==69&&O!==73&&O!==91&&O!==103&&O!==R&&O!==666?te(c,b):(c.state=null,O===R?te(c,-3):d):b},n.deflateSetDictionary=function(c,O){var z,x,w,I,j,U,T,W,$=O.length;if(!c||!c.state||(I=(z=c.state).wrap)===2||I===1&&z.status!==M||z.lookahead)return b;for(I===1&&(c.adler=a(c.adler,O,$,0)),z.wrap=0,$>=z.w_size&&(I===0&&(Q(z.head),z.strstart=0,z.block_start=0,z.insert=0),W=new s.Buf8(z.w_size),s.arraySet(W,O,$-z.w_size,z.w_size,0),O=W,$=z.w_size),j=c.avail_in,U=c.next_in,T=c.input,c.avail_in=$,c.next_in=0,c.input=O,ae(z);z.lookahead>=B;){for(x=z.strstart,w=z.lookahead-(B-1);z.ins_h=(z.ins_h<<z.hash_shift^z.window[x+B-1])&z.hash_mask,z.prev[x&z.w_mask]=z.head[z.ins_h],z.head[z.ins_h]=x,x++,--w;);z.strstart=x,z.lookahead=B-1,ae(z)}return z.strstart+=z.lookahead,z.block_start=z.strstart,z.insert=z.lookahead,z.lookahead=0,z.match_length=z.prev_length=B-1,z.match_available=0,c.next_in=U,c.input=T,c.avail_in=j,z.wrap=I,d},n.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,i,n){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(t,i,n){i.exports=function(r,s){var o,a,h,u,f,g,d,b,l,p,y,v,_,S,E,D,P,F,B,H,q,M,R,m,N;o=r.state,a=r.next_in,m=r.input,h=a+(r.avail_in-5),u=r.next_out,N=r.output,f=u-(s-r.avail_out),g=u+(r.avail_out-257),d=o.dmax,b=o.wsize,l=o.whave,p=o.wnext,y=o.window,v=o.hold,_=o.bits,S=o.lencode,E=o.distcode,D=(1<<o.lenbits)-1,P=(1<<o.distbits)-1;e:do{_<15&&(v+=m[a++]<<_,_+=8,v+=m[a++]<<_,_+=8),F=S[v&D];t:for(;;){if(v>>>=B=F>>>24,_-=B,(B=F>>>16&255)===0)N[u++]=65535&F;else{if(!(16&B)){if((64&B)==0){F=S[(65535&F)+(v&(1<<B)-1)];continue t}if(32&B){o.mode=12;break e}r.msg="invalid literal/length code",o.mode=30;break e}H=65535&F,(B&=15)&&(_<B&&(v+=m[a++]<<_,_+=8),H+=v&(1<<B)-1,v>>>=B,_-=B),_<15&&(v+=m[a++]<<_,_+=8,v+=m[a++]<<_,_+=8),F=E[v&P];i:for(;;){if(v>>>=B=F>>>24,_-=B,!(16&(B=F>>>16&255))){if((64&B)==0){F=E[(65535&F)+(v&(1<<B)-1)];continue i}r.msg="invalid distance code",o.mode=30;break e}if(q=65535&F,_<(B&=15)&&(v+=m[a++]<<_,(_+=8)<B&&(v+=m[a++]<<_,_+=8)),d<(q+=v&(1<<B)-1)){r.msg="invalid distance too far back",o.mode=30;break e}if(v>>>=B,_-=B,(B=u-f)<q){if(l<(B=q-B)&&o.sane){r.msg="invalid distance too far back",o.mode=30;break e}if(R=y,(M=0)===p){if(M+=b-B,B<H){for(H-=B;N[u++]=y[M++],--B;);M=u-q,R=N}}else if(p<B){if(M+=b+p-B,(B-=p)<H){for(H-=B;N[u++]=y[M++],--B;);if(M=0,p<H){for(H-=B=p;N[u++]=y[M++],--B;);M=u-q,R=N}}}else if(M+=p-B,B<H){for(H-=B;N[u++]=y[M++],--B;);M=u-q,R=N}for(;2<H;)N[u++]=R[M++],N[u++]=R[M++],N[u++]=R[M++],H-=3;H&&(N[u++]=R[M++],1<H&&(N[u++]=R[M++]))}else{for(M=u-q;N[u++]=N[M++],N[u++]=N[M++],N[u++]=N[M++],2<(H-=3););H&&(N[u++]=N[M++],1<H&&(N[u++]=N[M++]))}break}}break}}while(a<h&&u<g);a-=H=_>>3,v&=(1<<(_-=H<<3))-1,r.next_in=a,r.next_out=u,r.avail_in=a<h?h-a+5:5-(a-h),r.avail_out=u<g?g-u+257:257-(u-g),o.hold=v,o.bits=_}},{}],49:[function(t,i,n){var r=t("../utils/common"),s=t("./adler32"),o=t("./crc32"),a=t("./inffast"),h=t("./inftrees"),u=1,f=2,g=0,d=-2,b=1,l=852,p=592;function y(M){return(M>>>24&255)+(M>>>8&65280)+((65280&M)<<8)+((255&M)<<24)}function v(){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 r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(M){var R;return M&&M.state?(R=M.state,M.total_in=M.total_out=R.total=0,M.msg="",R.wrap&&(M.adler=1&R.wrap),R.mode=b,R.last=0,R.havedict=0,R.dmax=32768,R.head=null,R.hold=0,R.bits=0,R.lencode=R.lendyn=new r.Buf32(l),R.distcode=R.distdyn=new r.Buf32(p),R.sane=1,R.back=-1,g):d}function S(M){var R;return M&&M.state?((R=M.state).wsize=0,R.whave=0,R.wnext=0,_(M)):d}function E(M,R){var m,N;return M&&M.state?(N=M.state,R<0?(m=0,R=-R):(m=1+(R>>4),R<48&&(R&=15)),R&&(R<8||15<R)?d:(N.window!==null&&N.wbits!==R&&(N.window=null),N.wrap=m,N.wbits=R,S(M))):d}function D(M,R){var m,N;return M?(N=new v,(M.state=N).window=null,(m=E(M,R))!==g&&(M.state=null),m):d}var P,F,B=!0;function H(M){if(B){var R;for(P=new r.Buf32(512),F=new r.Buf32(32),R=0;R<144;)M.lens[R++]=8;for(;R<256;)M.lens[R++]=9;for(;R<280;)M.lens[R++]=7;for(;R<288;)M.lens[R++]=8;for(h(u,M.lens,0,288,P,0,M.work,{bits:9}),R=0;R<32;)M.lens[R++]=5;h(f,M.lens,0,32,F,0,M.work,{bits:5}),B=!1}M.lencode=P,M.lenbits=9,M.distcode=F,M.distbits=5}function q(M,R,m,N){var ee,V=M.state;return V.window===null&&(V.wsize=1<<V.wbits,V.wnext=0,V.whave=0,V.window=new r.Buf8(V.wsize)),N>=V.wsize?(r.arraySet(V.window,R,m-V.wsize,V.wsize,0),V.wnext=0,V.whave=V.wsize):(N<(ee=V.wsize-V.wnext)&&(ee=N),r.arraySet(V.window,R,m-N,ee,V.wnext),(N-=ee)?(r.arraySet(V.window,R,m-N,N,0),V.wnext=N,V.whave=V.wsize):(V.wnext+=ee,V.wnext===V.wsize&&(V.wnext=0),V.whave<V.wsize&&(V.whave+=ee))),0}n.inflateReset=S,n.inflateReset2=E,n.inflateResetKeep=_,n.inflateInit=function(M){return D(M,15)},n.inflateInit2=D,n.inflate=function(M,R){var m,N,ee,V,te,G,Q,L,A,J,X,Y,ae,fe,ie,re,ue,le,be,ge,c,O,z,x,w=0,I=new r.Buf8(4),j=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!M||!M.state||!M.output||!M.input&&M.avail_in!==0)return d;(m=M.state).mode===12&&(m.mode=13),te=M.next_out,ee=M.output,Q=M.avail_out,V=M.next_in,N=M.input,G=M.avail_in,L=m.hold,A=m.bits,J=G,X=Q,O=g;e:for(;;)switch(m.mode){case b:if(m.wrap===0){m.mode=13;break}for(;A<16;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}if(2&m.wrap&&L===35615){I[m.check=0]=255&L,I[1]=L>>>8&255,m.check=o(m.check,I,2,0),A=L=0,m.mode=2;break}if(m.flags=0,m.head&&(m.head.done=!1),!(1&m.wrap)||(((255&L)<<8)+(L>>8))%31){M.msg="incorrect header check",m.mode=30;break}if((15&L)!=8){M.msg="unknown compression method",m.mode=30;break}if(A-=4,c=8+(15&(L>>>=4)),m.wbits===0)m.wbits=c;else if(c>m.wbits){M.msg="invalid window size",m.mode=30;break}m.dmax=1<<c,M.adler=m.check=1,m.mode=512&L?10:12,A=L=0;break;case 2:for(;A<16;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}if(m.flags=L,(255&m.flags)!=8){M.msg="unknown compression method",m.mode=30;break}if(57344&m.flags){M.msg="unknown header flags set",m.mode=30;break}m.head&&(m.head.text=L>>8&1),512&m.flags&&(I[0]=255&L,I[1]=L>>>8&255,m.check=o(m.check,I,2,0)),A=L=0,m.mode=3;case 3:for(;A<32;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}m.head&&(m.head.time=L),512&m.flags&&(I[0]=255&L,I[1]=L>>>8&255,I[2]=L>>>16&255,I[3]=L>>>24&255,m.check=o(m.check,I,4,0)),A=L=0,m.mode=4;case 4:for(;A<16;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}m.head&&(m.head.xflags=255&L,m.head.os=L>>8),512&m.flags&&(I[0]=255&L,I[1]=L>>>8&255,m.check=o(m.check,I,2,0)),A=L=0,m.mode=5;case 5:if(1024&m.flags){for(;A<16;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}m.length=L,m.head&&(m.head.extra_len=L),512&m.flags&&(I[0]=255&L,I[1]=L>>>8&255,m.check=o(m.check,I,2,0)),A=L=0}else m.head&&(m.head.extra=null);m.mode=6;case 6:if(1024&m.flags&&(G<(Y=m.length)&&(Y=G),Y&&(m.head&&(c=m.head.extra_len-m.length,m.head.extra||(m.head.extra=new Array(m.head.extra_len)),r.arraySet(m.head.extra,N,V,Y,c)),512&m.flags&&(m.check=o(m.check,N,Y,V)),G-=Y,V+=Y,m.length-=Y),m.length))break e;m.length=0,m.mode=7;case 7:if(2048&m.flags){if(G===0)break e;for(Y=0;c=N[V+Y++],m.head&&c&&m.length<65536&&(m.head.name+=String.fromCharCode(c)),c&&Y<G;);if(512&m.flags&&(m.check=o(m.check,N,Y,V)),G-=Y,V+=Y,c)break e}else m.head&&(m.head.name=null);m.length=0,m.mode=8;case 8:if(4096&m.flags){if(G===0)break e;for(Y=0;c=N[V+Y++],m.head&&c&&m.length<65536&&(m.head.comment+=String.fromCharCode(c)),c&&Y<G;);if(512&m.flags&&(m.check=o(m.check,N,Y,V)),G-=Y,V+=Y,c)break e}else m.head&&(m.head.comment=null);m.mode=9;case 9:if(512&m.flags){for(;A<16;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}if(L!==(65535&m.check)){M.msg="header crc mismatch",m.mode=30;break}A=L=0}m.head&&(m.head.hcrc=m.flags>>9&1,m.head.done=!0),M.adler=m.check=0,m.mode=12;break;case 10:for(;A<32;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}M.adler=m.check=y(L),A=L=0,m.mode=11;case 11:if(m.havedict===0)return M.next_out=te,M.avail_out=Q,M.next_in=V,M.avail_in=G,m.hold=L,m.bits=A,2;M.adler=m.check=1,m.mode=12;case 12:if(R===5||R===6)break e;case 13:if(m.last){L>>>=7&A,A-=7&A,m.mode=27;break}for(;A<3;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}switch(m.last=1&L,A-=1,3&(L>>>=1)){case 0:m.mode=14;break;case 1:if(H(m),m.mode=20,R!==6)break;L>>>=2,A-=2;break e;case 2:m.mode=17;break;case 3:M.msg="invalid block type",m.mode=30}L>>>=2,A-=2;break;case 14:for(L>>>=7&A,A-=7&A;A<32;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}if((65535&L)!=(L>>>16^65535)){M.msg="invalid stored block lengths",m.mode=30;break}if(m.length=65535&L,A=L=0,m.mode=15,R===6)break e;case 15:m.mode=16;case 16:if(Y=m.length){if(G<Y&&(Y=G),Q<Y&&(Y=Q),Y===0)break e;r.arraySet(ee,N,V,Y,te),G-=Y,V+=Y,Q-=Y,te+=Y,m.length-=Y;break}m.mode=12;break;case 17:for(;A<14;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}if(m.nlen=257+(31&L),L>>>=5,A-=5,m.ndist=1+(31&L),L>>>=5,A-=5,m.ncode=4+(15&L),L>>>=4,A-=4,286<m.nlen||30<m.ndist){M.msg="too many length or distance symbols",m.mode=30;break}m.have=0,m.mode=18;case 18:for(;m.have<m.ncode;){for(;A<3;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}m.lens[j[m.have++]]=7&L,L>>>=3,A-=3}for(;m.have<19;)m.lens[j[m.have++]]=0;if(m.lencode=m.lendyn,m.lenbits=7,z={bits:m.lenbits},O=h(0,m.lens,0,19,m.lencode,0,m.work,z),m.lenbits=z.bits,O){M.msg="invalid code lengths set",m.mode=30;break}m.have=0,m.mode=19;case 19:for(;m.have<m.nlen+m.ndist;){for(;re=(w=m.lencode[L&(1<<m.lenbits)-1])>>>16&255,ue=65535&w,!((ie=w>>>24)<=A);){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}if(ue<16)L>>>=ie,A-=ie,m.lens[m.have++]=ue;else{if(ue===16){for(x=ie+2;A<x;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}if(L>>>=ie,A-=ie,m.have===0){M.msg="invalid bit length repeat",m.mode=30;break}c=m.lens[m.have-1],Y=3+(3&L),L>>>=2,A-=2}else if(ue===17){for(x=ie+3;A<x;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}A-=ie,c=0,Y=3+(7&(L>>>=ie)),L>>>=3,A-=3}else{for(x=ie+7;A<x;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}A-=ie,c=0,Y=11+(127&(L>>>=ie)),L>>>=7,A-=7}if(m.have+Y>m.nlen+m.ndist){M.msg="invalid bit length repeat",m.mode=30;break}for(;Y--;)m.lens[m.have++]=c}}if(m.mode===30)break;if(m.lens[256]===0){M.msg="invalid code -- missing end-of-block",m.mode=30;break}if(m.lenbits=9,z={bits:m.lenbits},O=h(u,m.lens,0,m.nlen,m.lencode,0,m.work,z),m.lenbits=z.bits,O){M.msg="invalid literal/lengths set",m.mode=30;break}if(m.distbits=6,m.distcode=m.distdyn,z={bits:m.distbits},O=h(f,m.lens,m.nlen,m.ndist,m.distcode,0,m.work,z),m.distbits=z.bits,O){M.msg="invalid distances set",m.mode=30;break}if(m.mode=20,R===6)break e;case 20:m.mode=21;case 21:if(6<=G&&258<=Q){M.next_out=te,M.avail_out=Q,M.next_in=V,M.avail_in=G,m.hold=L,m.bits=A,a(M,X),te=M.next_out,ee=M.output,Q=M.avail_out,V=M.next_in,N=M.input,G=M.avail_in,L=m.hold,A=m.bits,m.mode===12&&(m.back=-1);break}for(m.back=0;re=(w=m.lencode[L&(1<<m.lenbits)-1])>>>16&255,ue=65535&w,!((ie=w>>>24)<=A);){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}if(re&&(240&re)==0){for(le=ie,be=re,ge=ue;re=(w=m.lencode[ge+((L&(1<<le+be)-1)>>le)])>>>16&255,ue=65535&w,!(le+(ie=w>>>24)<=A);){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}L>>>=le,A-=le,m.back+=le}if(L>>>=ie,A-=ie,m.back+=ie,m.length=ue,re===0){m.mode=26;break}if(32&re){m.back=-1,m.mode=12;break}if(64&re){M.msg="invalid literal/length code",m.mode=30;break}m.extra=15&re,m.mode=22;case 22:if(m.extra){for(x=m.extra;A<x;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}m.length+=L&(1<<m.extra)-1,L>>>=m.extra,A-=m.extra,m.back+=m.extra}m.was=m.length,m.mode=23;case 23:for(;re=(w=m.distcode[L&(1<<m.distbits)-1])>>>16&255,ue=65535&w,!((ie=w>>>24)<=A);){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}if((240&re)==0){for(le=ie,be=re,ge=ue;re=(w=m.distcode[ge+((L&(1<<le+be)-1)>>le)])>>>16&255,ue=65535&w,!(le+(ie=w>>>24)<=A);){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}L>>>=le,A-=le,m.back+=le}if(L>>>=ie,A-=ie,m.back+=ie,64&re){M.msg="invalid distance code",m.mode=30;break}m.offset=ue,m.extra=15&re,m.mode=24;case 24:if(m.extra){for(x=m.extra;A<x;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}m.offset+=L&(1<<m.extra)-1,L>>>=m.extra,A-=m.extra,m.back+=m.extra}if(m.offset>m.dmax){M.msg="invalid distance too far back",m.mode=30;break}m.mode=25;case 25:if(Q===0)break e;if(Y=X-Q,m.offset>Y){if((Y=m.offset-Y)>m.whave&&m.sane){M.msg="invalid distance too far back",m.mode=30;break}ae=Y>m.wnext?(Y-=m.wnext,m.wsize-Y):m.wnext-Y,Y>m.length&&(Y=m.length),fe=m.window}else fe=ee,ae=te-m.offset,Y=m.length;for(Q<Y&&(Y=Q),Q-=Y,m.length-=Y;ee[te++]=fe[ae++],--Y;);m.length===0&&(m.mode=21);break;case 26:if(Q===0)break e;ee[te++]=m.length,Q--,m.mode=21;break;case 27:if(m.wrap){for(;A<32;){if(G===0)break e;G--,L|=N[V++]<<A,A+=8}if(X-=Q,M.total_out+=X,m.total+=X,X&&(M.adler=m.check=m.flags?o(m.check,ee,X,te-X):s(m.check,ee,X,te-X)),X=Q,(m.flags?L:y(L))!==m.check){M.msg="incorrect data check",m.mode=30;break}A=L=0}m.mode=28;case 28:if(m.wrap&&m.flags){for(;A<32;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}if(L!==(4294967295&m.total)){M.msg="incorrect length check",m.mode=30;break}A=L=0}m.mode=29;case 29:O=1;break e;case 30:O=-3;break e;case 31:return-4;case 32:default:return d}return M.next_out=te,M.avail_out=Q,M.next_in=V,M.avail_in=G,m.hold=L,m.bits=A,(m.wsize||X!==M.avail_out&&m.mode<30&&(m.mode<27||R!==4))&&q(M,M.output,M.next_out,X-M.avail_out)?(m.mode=31,-4):(J-=M.avail_in,X-=M.avail_out,M.total_in+=J,M.total_out+=X,m.total+=X,m.wrap&&X&&(M.adler=m.check=m.flags?o(m.check,ee,X,M.next_out-X):s(m.check,ee,X,M.next_out-X)),M.data_type=m.bits+(m.last?64:0)+(m.mode===12?128:0)+(m.mode===20||m.mode===15?256:0),(J==0&&X===0||R===4)&&O===g&&(O=-5),O)},n.inflateEnd=function(M){if(!M||!M.state)return d;var R=M.state;return R.window&&(R.window=null),M.state=null,g},n.inflateGetHeader=function(M,R){var m;return M&&M.state?(2&(m=M.state).wrap)==0?d:((m.head=R).done=!1,g):d},n.inflateSetDictionary=function(M,R){var m,N=R.length;return M&&M.state?(m=M.state).wrap!==0&&m.mode!==11?d:m.mode===11&&s(1,R,N,0)!==m.check?-3:q(M,R,N,N)?(m.mode=31,-4):(m.havedict=1,g):d},n.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,i,n){var r=t("../utils/common"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],a=[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],h=[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(u,f,g,d,b,l,p,y){var v,_,S,E,D,P,F,B,H,q=y.bits,M=0,R=0,m=0,N=0,ee=0,V=0,te=0,G=0,Q=0,L=0,A=null,J=0,X=new r.Buf16(16),Y=new r.Buf16(16),ae=null,fe=0;for(M=0;M<=15;M++)X[M]=0;for(R=0;R<d;R++)X[f[g+R]]++;for(ee=q,N=15;1<=N&&X[N]===0;N--);if(N<ee&&(ee=N),N===0)return b[l++]=20971520,b[l++]=20971520,y.bits=1,0;for(m=1;m<N&&X[m]===0;m++);for(ee<m&&(ee=m),M=G=1;M<=15;M++)if(G<<=1,(G-=X[M])<0)return-1;if(0<G&&(u===0||N!==1))return-1;for(Y[1]=0,M=1;M<15;M++)Y[M+1]=Y[M]+X[M];for(R=0;R<d;R++)f[g+R]!==0&&(p[Y[f[g+R]]++]=R);if(P=u===0?(A=ae=p,19):u===1?(A=s,J-=257,ae=o,fe-=257,256):(A=a,ae=h,-1),M=m,D=l,te=R=L=0,S=-1,E=(Q=1<<(V=ee))-1,u===1&&852<Q||u===2&&592<Q)return 1;for(;;){for(F=M-te,H=p[R]<P?(B=0,p[R]):p[R]>P?(B=ae[fe+p[R]],A[J+p[R]]):(B=96,0),v=1<<M-te,m=_=1<<V;b[D+(L>>te)+(_-=v)]=F<<24|B<<16|H|0,_!==0;);for(v=1<<M-1;L&v;)v>>=1;if(v!==0?(L&=v-1,L+=v):L=0,R++,--X[M]==0){if(M===N)break;M=f[g+p[R]]}if(ee<M&&(L&E)!==S){for(te===0&&(te=ee),D+=m,G=1<<(V=M-te);V+te<N&&!((G-=X[V+te])<=0);)V++,G<<=1;if(Q+=1<<V,u===1&&852<Q||u===2&&592<Q)return 1;b[S=L&E]=ee<<24|V<<16|D-l|0}}return L!==0&&(b[D+L]=M-te<<24|64<<16|0),y.bits=ee,0}},{"../utils/common":41}],51:[function(t,i,n){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(t,i,n){var r=t("../utils/common"),s=0,o=1;function a(w){for(var I=w.length;0<=--I;)w[I]=0}var h=0,u=29,f=256,g=f+1+u,d=30,b=19,l=2*g+1,p=15,y=16,v=7,_=256,S=16,E=17,D=18,P=[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],F=[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],B=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],q=new Array(2*(g+2));a(q);var M=new Array(2*d);a(M);var R=new Array(512);a(R);var m=new Array(256);a(m);var N=new Array(u);a(N);var ee,V,te,G=new Array(d);function Q(w,I,j,U,T){this.static_tree=w,this.extra_bits=I,this.extra_base=j,this.elems=U,this.max_length=T,this.has_stree=w&&w.length}function L(w,I){this.dyn_tree=w,this.max_code=0,this.stat_desc=I}function A(w){return w<256?R[w]:R[256+(w>>>7)]}function J(w,I){w.pending_buf[w.pending++]=255&I,w.pending_buf[w.pending++]=I>>>8&255}function X(w,I,j){w.bi_valid>y-j?(w.bi_buf|=I<<w.bi_valid&65535,J(w,w.bi_buf),w.bi_buf=I>>y-w.bi_valid,w.bi_valid+=j-y):(w.bi_buf|=I<<w.bi_valid&65535,w.bi_valid+=j)}function Y(w,I,j){X(w,j[2*I],j[2*I+1])}function ae(w,I){for(var j=0;j|=1&w,w>>>=1,j<<=1,0<--I;);return j>>>1}function fe(w,I,j){var U,T,W=new Array(p+1),$=0;for(U=1;U<=p;U++)W[U]=$=$+j[U-1]<<1;for(T=0;T<=I;T++){var Z=w[2*T+1];Z!==0&&(w[2*T]=ae(W[Z]++,Z))}}function ie(w){var I;for(I=0;I<g;I++)w.dyn_ltree[2*I]=0;for(I=0;I<d;I++)w.dyn_dtree[2*I]=0;for(I=0;I<b;I++)w.bl_tree[2*I]=0;w.dyn_ltree[2*_]=1,w.opt_len=w.static_len=0,w.last_lit=w.matches=0}function re(w){8<w.bi_valid?J(w,w.bi_buf):0<w.bi_valid&&(w.pending_buf[w.pending++]=w.bi_buf),w.bi_buf=0,w.bi_valid=0}function ue(w,I,j,U){var T=2*I,W=2*j;return w[T]<w[W]||w[T]===w[W]&&U[I]<=U[j]}function le(w,I,j){for(var U=w.heap[j],T=j<<1;T<=w.heap_len&&(T<w.heap_len&&ue(I,w.heap[T+1],w.heap[T],w.depth)&&T++,!ue(I,U,w.heap[T],w.depth));)w.heap[j]=w.heap[T],j=T,T<<=1;w.heap[j]=U}function be(w,I,j){var U,T,W,$,Z=0;if(w.last_lit!==0)for(;U=w.pending_buf[w.d_buf+2*Z]<<8|w.pending_buf[w.d_buf+2*Z+1],T=w.pending_buf[w.l_buf+Z],Z++,U===0?Y(w,T,I):(Y(w,(W=m[T])+f+1,I),($=P[W])!==0&&X(w,T-=N[W],$),Y(w,W=A(--U),j),($=F[W])!==0&&X(w,U-=G[W],$)),Z<w.last_lit;);Y(w,_,I)}function ge(w,I){var j,U,T,W=I.dyn_tree,$=I.stat_desc.static_tree,Z=I.stat_desc.has_stree,K=I.stat_desc.elems,se=-1;for(w.heap_len=0,w.heap_max=l,j=0;j<K;j++)W[2*j]!==0?(w.heap[++w.heap_len]=se=j,w.depth[j]=0):W[2*j+1]=0;for(;w.heap_len<2;)W[2*(T=w.heap[++w.heap_len]=se<2?++se:0)]=1,w.depth[T]=0,w.opt_len--,Z&&(w.static_len-=$[2*T+1]);for(I.max_code=se,j=w.heap_len>>1;1<=j;j--)le(w,W,j);for(T=K;j=w.heap[1],w.heap[1]=w.heap[w.heap_len--],le(w,W,1),U=w.heap[1],w.heap[--w.heap_max]=j,w.heap[--w.heap_max]=U,W[2*T]=W[2*j]+W[2*U],w.depth[T]=(w.depth[j]>=w.depth[U]?w.depth[j]:w.depth[U])+1,W[2*j+1]=W[2*U+1]=T,w.heap[1]=T++,le(w,W,1),2<=w.heap_len;);w.heap[--w.heap_max]=w.heap[1],(function(ne,me){var ke,ve,Ce,he,Ae,Be,we=me.dyn_tree,Ke=me.max_code,ei=me.stat_desc.static_tree,ti=me.stat_desc.has_stree,ii=me.stat_desc.extra_bits,qe=me.stat_desc.extra_base,Ee=me.stat_desc.max_length,Le=0;for(he=0;he<=p;he++)ne.bl_count[he]=0;for(we[2*ne.heap[ne.heap_max]+1]=0,ke=ne.heap_max+1;ke<l;ke++)Ee<(he=we[2*we[2*(ve=ne.heap[ke])+1]+1]+1)&&(he=Ee,Le++),we[2*ve+1]=he,Ke<ve||(ne.bl_count[he]++,Ae=0,qe<=ve&&(Ae=ii[ve-qe]),Be=we[2*ve],ne.opt_len+=Be*(he+Ae),ti&&(ne.static_len+=Be*(ei[2*ve+1]+Ae)));if(Le!==0){do{for(he=Ee-1;ne.bl_count[he]===0;)he--;ne.bl_count[he]--,ne.bl_count[he+1]+=2,ne.bl_count[Ee]--,Le-=2}while(0<Le);for(he=Ee;he!==0;he--)for(ve=ne.bl_count[he];ve!==0;)Ke<(Ce=ne.heap[--ke])||(we[2*Ce+1]!==he&&(ne.opt_len+=(he-we[2*Ce+1])*we[2*Ce],we[2*Ce+1]=he),ve--)}})(w,I),fe(W,se,w.bl_count)}function c(w,I,j){var U,T,W=-1,$=I[1],Z=0,K=7,se=4;for($===0&&(K=138,se=3),I[2*(j+1)+1]=65535,U=0;U<=j;U++)T=$,$=I[2*(U+1)+1],++Z<K&&T===$||(Z<se?w.bl_tree[2*T]+=Z:T!==0?(T!==W&&w.bl_tree[2*T]++,w.bl_tree[2*S]++):Z<=10?w.bl_tree[2*E]++:w.bl_tree[2*D]++,W=T,se=(Z=0)===$?(K=138,3):T===$?(K=6,3):(K=7,4))}function O(w,I,j){var U,T,W=-1,$=I[1],Z=0,K=7,se=4;for($===0&&(K=138,se=3),U=0;U<=j;U++)if(T=$,$=I[2*(U+1)+1],!(++Z<K&&T===$)){if(Z<se)for(;Y(w,T,w.bl_tree),--Z!=0;);else T!==0?(T!==W&&(Y(w,T,w.bl_tree),Z--),Y(w,S,w.bl_tree),X(w,Z-3,2)):Z<=10?(Y(w,E,w.bl_tree),X(w,Z-3,3)):(Y(w,D,w.bl_tree),X(w,Z-11,7));W=T,se=(Z=0)===$?(K=138,3):T===$?(K=6,3):(K=7,4)}}a(G);var z=!1;function x(w,I,j,U){X(w,(h<<1)+(U?1:0),3),(function(T,W,$,Z){re(T),J(T,$),J(T,~$),r.arraySet(T.pending_buf,T.window,W,$,T.pending),T.pending+=$})(w,I,j)}n._tr_init=function(w){z||((function(){var I,j,U,T,W,$=new Array(p+1);for(T=U=0;T<u-1;T++)for(N[T]=U,I=0;I<1<<P[T];I++)m[U++]=T;for(m[U-1]=T,T=W=0;T<16;T++)for(G[T]=W,I=0;I<1<<F[T];I++)R[W++]=T;for(W>>=7;T<d;T++)for(G[T]=W<<7,I=0;I<1<<F[T]-7;I++)R[256+W++]=T;for(j=0;j<=p;j++)$[j]=0;for(I=0;I<=143;)q[2*I+1]=8,I++,$[8]++;for(;I<=255;)q[2*I+1]=9,I++,$[9]++;for(;I<=279;)q[2*I+1]=7,I++,$[7]++;for(;I<=287;)q[2*I+1]=8,I++,$[8]++;for(fe(q,g+1,$),I=0;I<d;I++)M[2*I+1]=5,M[2*I]=ae(I,5);ee=new Q(q,P,f+1,g,p),V=new Q(M,F,0,d,p),te=new Q(new Array(0),B,0,b,v)})(),z=!0),w.l_desc=new L(w.dyn_ltree,ee),w.d_desc=new L(w.dyn_dtree,V),w.bl_desc=new L(w.bl_tree,te),w.bi_buf=0,w.bi_valid=0,ie(w)},n._tr_stored_block=x,n._tr_flush_block=function(w,I,j,U){var T,W,$=0;0<w.level?(w.strm.data_type===2&&(w.strm.data_type=(function(Z){var K,se=4093624447;for(K=0;K<=31;K++,se>>>=1)if(1&se&&Z.dyn_ltree[2*K]!==0)return s;if(Z.dyn_ltree[18]!==0||Z.dyn_ltree[20]!==0||Z.dyn_ltree[26]!==0)return o;for(K=32;K<f;K++)if(Z.dyn_ltree[2*K]!==0)return o;return s})(w)),ge(w,w.l_desc),ge(w,w.d_desc),$=(function(Z){var K;for(c(Z,Z.dyn_ltree,Z.l_desc.max_code),c(Z,Z.dyn_dtree,Z.d_desc.max_code),ge(Z,Z.bl_desc),K=b-1;3<=K&&Z.bl_tree[2*H[K]+1]===0;K--);return Z.opt_len+=3*(K+1)+5+5+4,K})(w),T=w.opt_len+3+7>>>3,(W=w.static_len+3+7>>>3)<=T&&(T=W)):T=W=j+5,j+4<=T&&I!==-1?x(w,I,j,U):w.strategy===4||W===T?(X(w,2+(U?1:0),3),be(w,q,M)):(X(w,4+(U?1:0),3),(function(Z,K,se,ne){var me;for(X(Z,K-257,5),X(Z,se-1,5),X(Z,ne-4,4),me=0;me<ne;me++)X(Z,Z.bl_tree[2*H[me]+1],3);O(Z,Z.dyn_ltree,K-1),O(Z,Z.dyn_dtree,se-1)})(w,w.l_desc.max_code+1,w.d_desc.max_code+1,$+1),be(w,w.dyn_ltree,w.dyn_dtree)),ie(w),U&&re(w)},n._tr_tally=function(w,I,j){return w.pending_buf[w.d_buf+2*w.last_lit]=I>>>8&255,w.pending_buf[w.d_buf+2*w.last_lit+1]=255&I,w.pending_buf[w.l_buf+w.last_lit]=255&j,w.last_lit++,I===0?w.dyn_ltree[2*j]++:(w.matches++,I--,w.dyn_ltree[2*(m[j]+f+1)]++,w.dyn_dtree[2*A(I)]++),w.last_lit===w.lit_bufsize-1},n._tr_align=function(w){X(w,2,3),Y(w,_,q),(function(I){I.bi_valid===16?(J(I,I.bi_buf),I.bi_buf=0,I.bi_valid=0):8<=I.bi_valid&&(I.pending_buf[I.pending++]=255&I.bi_buf,I.bi_buf>>=8,I.bi_valid-=8)})(w)}},{"../utils/common":41}],53:[function(t,i,n){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(t,i,n){(function(r){(function(s,o){if(!s.setImmediate){var a,h,u,f,g=1,d={},b=!1,l=s.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(s);p=p&&p.setTimeout?p:s,a={}.toString.call(s.process)==="[object process]"?function(S){process.nextTick(function(){v(S)})}:(function(){if(s.postMessage&&!s.importScripts){var S=!0,E=s.onmessage;return s.onmessage=function(){S=!1},s.postMessage("","*"),s.onmessage=E,S}})()?(f="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",_,!1):s.attachEvent("onmessage",_),function(S){s.postMessage(f+S,"*")}):s.MessageChannel?((u=new MessageChannel).port1.onmessage=function(S){v(S.data)},function(S){u.port2.postMessage(S)}):l&&"onreadystatechange"in l.createElement("script")?(h=l.documentElement,function(S){var E=l.createElement("script");E.onreadystatechange=function(){v(S),E.onreadystatechange=null,h.removeChild(E),E=null},h.appendChild(E)}):function(S){setTimeout(v,0,S)},p.setImmediate=function(S){typeof S!="function"&&(S=new Function(""+S));for(var E=new Array(arguments.length-1),D=0;D<E.length;D++)E[D]=arguments[D+1];var P={callback:S,args:E};return d[g]=P,a(g),g++},p.clearImmediate=y}function y(S){delete d[S]}function v(S){if(b)setTimeout(v,0,S);else{var E=d[S];if(E){b=!0;try{(function(D){var P=D.callback,F=D.args;switch(F.length){case 0:P();break;case 1:P(F[0]);break;case 2:P(F[0],F[1]);break;case 3:P(F[0],F[1],F[2]);break;default:P.apply(o,F)}})(E)}finally{y(S),b=!1}}}}function _(S){S.source===s&&typeof S.data=="string"&&S.data.indexOf(f)===0&&v(+S.data.slice(f.length))}})(typeof self>"u"?r===void 0?this:r:self)}).call(this,typeof Se<"u"?Se:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Pe)),Pe.exports}var _t=xt();const Mt=De(_t);class kt{zipObjectUrls=[];async load(e){if(this.clearZipObjectUrls(),this.is2dZipUrl(e))return this.loadZipData(e);const t=this.isManifestUrl(e)?e:this.joinUrl(this.normalizeDirectoryUrl(e),"manifest.json"),i=await this.fetchJson(t);if(!this.isSplitManifest(i))throw new Error("[LoaderModule2d] Expected split CAD manifest data.");return this.loadSplitData(this.getBaseUrl(t),i)}async fetchJson(e){const t=await fetch(e);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.json()}async loadSplitData(e,t,i=r=>this.fetchJson(r),n=(r,s)=>Promise.resolve(this.resolveImageUrl(r,s))){const[r,s,o,a]=await Promise.all([i(this.joinUrl(e,t.metadataUrl??"metadata.json")),i(this.joinUrl(e,t.layersUrl??"layers.json")),this.loadBlocks(e,t.blocksUrl??"blocks/index.json",i),this.loadTiles(e,t.root,i)]);await this.resolveBlockAssets(o,e,n);const h=[];return a.forEach(u=>{u.inserts.forEach(f=>h.push(f))}),{version:t.version??"1.0",metadata:r,layers:s,blocks:o,entities:h,octree:t.root,tiles:a}}async loadBlocks(e,t,i){const r=(await i(this.joinUrl(e,t))).parts??[],s=await Promise.all(r.map(a=>this.loadBlockPart(this.joinUrl(e,a),i))),o=[];return s.forEach(a=>{(Array.isArray(a?.blocks)?a.blocks:[]).forEach(u=>o.push(u))}),o}async loadBlockPart(e,t){try{return await t(e)}catch(i){const n=i instanceof Error?i.message:String(i);return console.warn(`[LoaderModule2d] Skip missing block json: ${e}`,n),{blocks:[]}}}async resolveBlockAssets(e,t,i){await Promise.all(e.map(async n=>{const r=Array.isArray(n?.entities)?n.entities:[];await Promise.all(r.map(async s=>{String(s?.type).toUpperCase()==="IMAGE"&&(s.imageUrl=await i(s,t))}))}))}resolveImageUrl(e,t){const i=e.localPath||e.sourcePath||e.path||e.url||"";if(/^(https?:)?\/\//i.test(i)||i.startsWith("/"))return i;const r=String(i).replace(/\\/g,"/").split("/").filter(Boolean).pop();return r?this.joinUrl(t,r):""}async loadTiles(e,t,i){const n=this.collectTileNodes(t);return await Promise.all(n.map(async s=>{const o=s.tileUrl??"",a=await i(this.joinUrl(e,o)),h=this.normalizeTileInserts(a.inserts??[]);return s.elements=h.map(u=>u.linkId??u.id).filter(u=>u!=null),{id:s.id??a.id??o,url:o,node:s,inserts:h}}))}normalizeTileInserts(e){return e.map(t=>({...t,linkId:t.linkId??t.id,type:"INSERT",color:t.color??0,visible:t.visible??!0}))}collectTileNodes(e){if(!e)return[];const t=[],i=[e];for(;i.length>0;){const n=i.pop();if(!n)continue;n.tileUrl&&t.push(n);const r=n.children??[];for(let s=r.length-1;s>=0;s-=1)i.push(r[s])}return t}async loadZipData(e){const t=await fetch(e);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const i=await Mt.loadAsync(await t.arrayBuffer()),n=this.findZipManifestPath(i),r=await this.fetchZipJson(i,n);if(!this.isSplitManifest(r))throw new Error("[LoaderModule2d] Expected split CAD manifest data in .2d package.");const s=this.getZipBasePath(n);return this.loadSplitData(s,r,o=>this.fetchZipJson(i,o),(o,a)=>this.resolveZipImageUrl(i,o,a))}findZipManifestPath(e){const t=Object.keys(e.files).filter(r=>!e.files[r].dir),n=t.find(r=>this.normalizeZipPath(r).toLowerCase()==="manifest.json")??t.find(r=>this.normalizeZipPath(r).toLowerCase().endsWith("/manifest.json"));if(!n)throw new Error("[LoaderModule2d] Missing manifest.json in .2d package.");return this.normalizeZipPath(n)}async fetchZipJson(e,t){if(/^(https?:)?\/\//i.test(t))return this.fetchJson(t);const i=this.getZipFile(e,t);if(!i)throw new Error(`[LoaderModule2d] Missing file in .2d package: ${t}`);return JSON.parse(await i.async("string"))}async resolveZipImageUrl(e,t,i){const n=t.localPath||t.sourcePath||t.path||t.url||"";if(/^(https?:)?\/\//i.test(n)||String(n).startsWith("blob:"))return n;const r=this.normalizeZipPath(String(n)),s=r.split("/").filter(Boolean).pop(),a=[this.joinUrl(i,r),s?this.joinUrl(i,s):"",r,s??""].filter(Boolean).map(u=>this.getZipFile(e,u)).find(u=>!!u);if(!a)return"";const h=URL.createObjectURL(new Blob([await a.async("arraybuffer")]));return this.zipObjectUrls.push(h),h}isSplitManifest(e){return!!e&&typeof e=="object"&&(e.splitType==="octree-2d"||!!e.blocksUrl)}is2dZipUrl(e){return/\.2d($|[?#])/i.test(e)}isManifestUrl(e){return/manifest\.json($|\?)/i.test(e)}getBaseUrl(e){const t=e.split("?")[0];return t.slice(0,t.lastIndexOf("/")+1)}getZipBasePath(e){const t=this.normalizeZipPath(e),i=t.lastIndexOf("/");return i>=0?t.slice(0,i+1):""}normalizeDirectoryUrl(e){return e.endsWith("/")?e:`${e}/`}joinUrl(e,t){return/^(https?:)?\/\//i.test(t)||t.startsWith("/")?t:`${e}${t}`.replace(/([^:]\/)\/+/g,"$1")}normalizeZipPath(e){return String(e).split("?")[0].split("#")[0].replace(/\\/g,"/").replace(/^\/+/,"")}getZipFile(e,t){const i=this.normalizeZipPath(t),n=e.file(i);if(n)return n;const r=i.toLowerCase(),s=Object.keys(e.files).find(o=>this.normalizeZipPath(o).toLowerCase()===r);return s?e.file(s):null}clearZipObjectUrls(){this.zipObjectUrls.forEach(e=>URL.revokeObjectURL(e)),this.zipObjectUrls=[]}}function Fe(C,e,t){const i=t.length-C-1;if(e>=t[i])return i-1;if(e<=t[C])return C;let n=C,r=i,s=Math.floor((n+r)/2);for(;e<t[s]||e>=t[s+1];)e<t[s]?r=s:n=s,s=Math.floor((n+r)/2);return s}function Ct(C,e,t,i){const n=[],r=[],s=[];n[0]=1;for(let o=1;o<=t;++o){r[o]=e-i[C+1-o],s[o]=i[C+o]-e;let a=0;for(let h=0;h<o;++h){const u=s[h+1],f=r[o-h],g=n[h]/(u+f);n[h]=a+u*g,a=f*g}n[o]=a}return n}function Et(C,e,t,i){const n=Fe(C,i,e),r=Ct(n,i,C,e),s=new de.Vector4(0,0,0,0);for(let o=0;o<=C;++o){const a=t[n-C+o],h=r[o],u=a.w*h;s.x+=a.x*u,s.y+=a.y*u,s.z+=a.z*u,s.w+=a.w*h}return s}function St(C,e,t,i,n){const r=[];for(let f=0;f<=t;++f)r[f]=0;const s=[];for(let f=0;f<=i;++f)s[f]=r.slice(0);const o=[];for(let f=0;f<=t;++f)o[f]=r.slice(0);o[0][0]=1;const a=r.slice(0),h=r.slice(0);for(let f=1;f<=t;++f){a[f]=e-n[C+1-f],h[f]=n[C+f]-e;let g=0;for(let d=0;d<f;++d){const b=h[d+1],l=a[f-d];o[f][d]=b+l;const p=o[d][f-1]/o[f][d];o[d][f]=g+b*p,g=l*p}o[f][f]=g}for(let f=0;f<=t;++f)s[0][f]=o[f][t];for(let f=0;f<=t;++f){let g=0,d=1;const b=[];for(let l=0;l<=t;++l)b[l]=r.slice(0);b[0][0]=1;for(let l=1;l<=i;++l){let p=0;const y=f-l,v=t-l;f>=l&&(b[d][0]=b[g][0]/o[v+1][y],p=b[d][0]*o[y][v]);const _=y>=-1?1:-y,S=f-1<=v?l-1:t-f;for(let D=_;D<=S;++D)b[d][D]=(b[g][D]-b[g][D-1])/o[v+1][y+D],p+=b[d][D]*o[y+D][v];f<=v&&(b[d][l]=-b[g][l-1]/o[v+1][f],p+=b[d][l]*o[f][v]),s[l][f]=p;const E=g;g=d,d=E}}let u=t;for(let f=1;f<=i;++f){for(let g=0;g<=t;++g)s[f][g]*=u;u*=t-f}return s}function It(C,e,t,i,n){const r=n<C?n:C,s=[],o=Fe(C,i,e),a=St(o,i,C,r,e),h=[];for(let u=0;u<t.length;++u){const f=t[u].clone(),g=f.w;f.x*=g,f.y*=g,f.z*=g,h[u]=f}for(let u=0;u<=r;++u){const f=h[o-C].clone().multiplyScalar(a[u][0]);for(let g=1;g<=C;++g)f.add(h[o-C+g].clone().multiplyScalar(a[u][g]));s[u]=f}for(let u=r+1;u<=n+1;++u)s[u]=new de.Vector4(0,0,0);return s}function Tt(C,e){let t=1;for(let n=2;n<=C;++n)t*=n;let i=1;for(let n=2;n<=e;++n)i*=n;for(let n=2;n<=C-e;++n)i*=n;return t/i}function At(C){const e=C.length,t=[],i=[];for(let r=0;r<e;++r){const s=C[r];t[r]=new de.Vector3(s.x,s.y,s.z),i[r]=s.w}const n=[];for(let r=0;r<e;++r){const s=t[r].clone();for(let o=1;o<=r;++o)s.sub(n[r-o].clone().multiplyScalar(Tt(r,o)*i[o]));n[r]=s.divideScalar(i[0])}return n}function Lt(C,e,t,i,n){const r=It(C,e,t,i,n);return At(r)}class zt extends de.Curve{constructor(e,t,i,n,r){super();const s=t?t.length-1:0,o=i?i.length:0;this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=n||0,this.endKnot=r||s;for(let a=0;a<o;++a){const h=i[a];this.controlPoints[a]=new de.Vector4(h.x,h.y,h.z,h.w)}}getPoint(e,t=new de.Vector3){const i=t,n=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),r=Et(this.degree,this.knots,this.controlPoints,n);return r.w!==1&&r.divideScalar(r.w),i.set(r.x,r.y,r.z)}getTangent(e,t=new de.Vector3){const i=t,n=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),r=Lt(this.degree,this.knots,this.controlPoints,n,1);return i.copy(r[1]).normalize(),i}toJSON(){const e=super.toJSON();return e.degree=this.degree,e.knots=[...this.knots],e.controlPoints=this.controlPoints.map(t=>t.toArray()),e.startKnot=this.startKnot,e.endKnot=this.endKnot,e}fromJSON(e){return super.fromJSON(e),this.degree=e.degree,this.knots=[...e.knots],this.controlPoints=e.controlPoints.map(t=>new de.Vector4(t[0],t[1],t[2],t[3])),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this}}function Me(C,e=!1){const t=C[0].index!==null,i=new Set(Object.keys(C[0].attributes)),n=new Set(Object.keys(C[0].morphAttributes)),r={},s={},o=C[0].morphTargetsRelative,a=new de.BufferGeometry;let h=0;for(let u=0;u<C.length;++u){const f=C[u];let g=0;if(t!==(f.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const d in f.attributes){if(!i.has(d))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;r[d]===void 0&&(r[d]=[]),r[d].push(f.attributes[d]),g++}if(g!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(o!==f.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const d in f.morphAttributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;s[d]===void 0&&(s[d]=[]),s[d].push(f.morphAttributes[d])}if(e){let d;if(t)d=f.index.count;else if(f.attributes.position!==void 0)d=f.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;a.addGroup(h,d,u),h+=d}}if(t){let u=0;const f=[];for(let g=0;g<C.length;++g){const d=C[g].index;for(let b=0;b<d.count;++b)f.push(d.getX(b)+u);u+=C[g].attributes.position.count}a.setIndex(f)}for(const u in r){const f=Ve(r[u]);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;a.setAttribute(u,f)}for(const u in s){const f=s[u][0].length;if(f===0)break;a.morphAttributes=a.morphAttributes||{},a.morphAttributes[u]=[];for(let g=0;g<f;++g){const d=[];for(let l=0;l<s[u].length;++l)d.push(s[u][l][g]);const b=Ve(d);if(!b)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;a.morphAttributes[u].push(b)}}return a}function Ve(C){let e,t,i,n=-1,r=0;for(let h=0;h<C.length;++h){const u=C[h];if(e===void 0&&(e=u.array.constructor),e!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=u.itemSize),t!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=u.normalized),i!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(n===-1&&(n=u.gpuType),n!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;r+=u.count*t}const s=new e(r),o=new de.BufferAttribute(s,t,i);let a=0;for(let h=0;h<C.length;++h){const u=C[h];if(u.isInterleavedBufferAttribute){const f=a/t;for(let g=0,d=u.count;g<d;g++)for(let b=0;b<t;b++){const l=u.getComponent(g,b);o.setComponent(g+f,b,l)}}else s.set(u.array,a);a+=u.count*t}return n!==void 0&&(o.gpuType=n),o}const oe=1e-8,Ge=.001,Pt=8421504;class Bt{constructor(e){this.engine=e}create(e,t){const i=this.getLoopSet(e);if(i.outers.length===0)return[];if(this.isGradientFill(e))return this.createGradientItems(e,t,i);if(this.isSolidFill(e))return this.createSolidItems(e,t,i);const r=this.createPatternLineItem(e,t,i);return r?[r]:(this.warnUnknownPatternFallback(e),this.createSolidItems(e,t,i,Pt))}isSolidFill(e){const t=String(e.pattern??e.patternName??"").toUpperCase();return e.solid===!0||t==="SOLID"}warnUnknownPatternFallback(e){const t=e.pattern??e.patternName??"UNKNOWN";this.engine.options?.debugHatch===!0&&console.warn(`[LoaderModule2d] HATCH pattern "${t}" cannot be rendered, use gray solid fallback.`)}isGradientFill(e){return e.gradient?.enabled===!0||String(e.patternType??"").toUpperCase()==="GRADIENTFILL"}getLoopSet(e){const t=(e.loops??[]).map(s=>this.normalizeLoop(s.points)).filter(s=>s.length>=3);if(t.length===0)return{outers:[],holes:[]};const i=(e.loops??[]).filter(s=>this.normalizeLoop(s.points).length>=3);if(!i.some(s=>s.type===!1))return this.classifyLoopsByContainment(t);const n=i.filter(s=>s.type!==!1).map(s=>this.normalizeLoop(s.points)),r=i.filter(s=>s.type===!1).map(s=>this.normalizeLoop(s.points));return n.length>0?{outers:n,holes:r}:{outers:[t[0]],holes:t.slice(1)}}classifyLoopsByContainment(e){const t=[...e].sort((r,s)=>Math.abs(this.signedArea(s))-Math.abs(this.signedArea(r))),i=[],n=[];return t.forEach((r,s)=>{const o=new k.Vector2(r[0][0],r[0][1]);t.slice(0,s).filter(h=>this.pointInPolygon(o,h)).length%2===0?i.push(r):n.push(r)}),{outers:i,holes:n}}signedArea(e){let t=0;for(let i=0;i<e.length;i+=1){const n=e[i],r=e[(i+1)%e.length];t+=n[0]*r[1]-r[0]*n[1]}return t/2}normalizeLoop(e){const t=[];(e??[]).forEach(r=>{if(!Array.isArray(r)||r.length<2)return;const s=[Number(r[0]),Number(r[1])];if(!Number.isFinite(s[0])||!Number.isFinite(s[1]))return;const o=t[t.length-1];(!o||Math.hypot(s[0]-o[0],s[1]-o[1])>oe)&&t.push(s)});const i=t[0],n=t[t.length-1];return i&&n&&Math.hypot(i[0]-n[0],i[1]-n[1])<=oe&&t.pop(),t}createSolidItems(e,t,i,n){const r=[];if(i.outers.forEach(a=>{const h=this.createShape(a);i.holes.filter(u=>this.pointInPolygon(new k.Vector2(u[0][0],u[0][1]),a)).forEach(u=>{h.holes.push(this.createPath(u))}),r.push(new k.ShapeGeometry(h))}),r.length===0)return[];const s=r.length===1?r[0]:Me(r,!1);s.applyMatrix4(t);const o=_e(s);return[{kind:"hatch",layer:e.layer??"0",color:n??this.resolveEntityColor(e),linkId:e.linkId??e.id,geometry:s,min:o.min,max:o.max,info:e}]}createShape(e){const t=new k.Shape;t.moveTo(e[0][0],e[0][1]);for(let i=1;i<e.length;i+=1)t.lineTo(e[i][0],e[i][1]);return t.closePath(),t}createPath(e){const t=new k.Path;t.moveTo(e[0][0],e[0][1]);for(let i=1;i<e.length;i+=1)t.lineTo(e[i][0],e[i][1]);return t.closePath(),t}createGradientItems(e,t,i){const n=[];if(i.outers.forEach(o=>{const a=this.createShape(o);i.holes.filter(u=>this.pointInPolygon(new k.Vector2(u[0][0],u[0][1]),o)).forEach(u=>{a.holes.push(this.createPath(u))});const h=this.subdivideTriangles(new k.ShapeGeometry(a),this.engine.options?.hatchGradientSubdivisions??3);this.applyGradientVertexColors(h,o,e.gradient),n.push(h)}),n.length===0)return[];const r=n.length===1?n[0]:Me(n,!1);r.applyMatrix4(t);const s=_e(r);return[{kind:"hatch",layer:e.layer??"0",color:this.resolveEntityColor(e),linkId:e.linkId??e.id,geometry:r,useVertexColors:!0,min:s.min,max:s.max,info:e}]}applyGradientVertexColors(e,t,i){const n=e.getAttribute("position"),r=[],s=this.resolveGradientStops(i),o=this.getBounds(t),a=new k.Vector2((o.minX+o.maxX)/2,(o.minY+o.maxY)/2),h=Math.max(o.maxX-o.minX,oe),u=Math.max(o.maxY-o.minY,oe),f=Math.max(Math.hypot(h/2,u/2),oe),g=Number(i?.angle??0),d=new k.Vector2(Math.cos(g),Math.sin(g)).normalize(),b=new k.Vector2(-d.y,d.x);for(let l=0;l<n.count;l+=1){const p=new k.Vector2(n.getX(l),n.getY(l)),y=this.resolveGradientFactor(p,a,d,b,h,u,f,i),v=this.sampleGradientColor(s,y);r.push(v.r,v.g,v.b)}e.setAttribute("color",new k.Float32BufferAttribute(r,3))}subdivideTriangles(e,t){let i=e.index?e.toNonIndexed():e.clone();const n=Math.max(0,Math.min(Math.floor(Number(t)||0),5));for(let r=0;r<n;r+=1){const s=i.getAttribute("position"),o=[];for(let a=0;a<s.count;a+=3){const h=new k.Vector3(s.getX(a),s.getY(a),s.getZ(a)),u=new k.Vector3(s.getX(a+1),s.getY(a+1),s.getZ(a+1)),f=new k.Vector3(s.getX(a+2),s.getY(a+2),s.getZ(a+2)),g=h.clone().lerp(u,.5),d=u.clone().lerp(f,.5),b=f.clone().lerp(h,.5);this.pushTriangle(o,h,g,b),this.pushTriangle(o,g,u,d),this.pushTriangle(o,b,d,f),this.pushTriangle(o,g,d,b)}i=new k.BufferGeometry().setAttribute("position",new k.Float32BufferAttribute(o,3))}return i}pushTriangle(e,t,i,n){e.push(t.x,t.y,t.z,i.x,i.y,i.z,n.x,n.y,n.z)}resolveGradientFactor(e,t,i,n,r,s,o,a){const h=e.clone().sub(t),u=String(a?.name??"LINEAR").toUpperCase(),f=Number(a?.shift??0),g=Math.max(Math.abs(i.x)*r+Math.abs(i.y)*s,oe),d=Math.max(Math.abs(n.x)*r+Math.abs(n.y)*s,oe);let b=.5+h.dot(i)/g+f;return u.includes("CYLINDER")?b=Math.abs(h.dot(n))/(d/2):u.includes("SPHERICAL")?(b=h.length()/o,u.includes("HEMI")&&(b=Math.sqrt(b))):u.includes("CURVED")&&(b=Math.pow(Math.abs(h.dot(i))/(g/2),.65)),u.startsWith("INV")&&(b=1-b),k.MathUtils.clamp(b,0,1)}resolveGradientStops(e){const t=(e?.colors??[]).map(i=>({value:k.MathUtils.clamp(Number(i.value??0),0,1),color:this.resolveGradientStopColor(i)})).sort((i,n)=>i.value-n.value);if(t.length>=2)return t;if(t.length===1){const i=k.MathUtils.clamp(Number(e?.colorTint??0),0,1);return[{value:0,color:t[0].color.clone().lerp(new k.Color(16777215),i)},{value:1,color:t[0].color}]}return[{value:0,color:new k.Color(16777215)},{value:1,color:new k.Color(0)}]}resolveGradientStopColor(e){if(Array.isArray(e.rgb)&&e.rgb.length>=3){const[t,i,n]=e.rgb.map(r=>k.MathUtils.clamp(Number(r??0),0,255)/255);return new k.Color(t,i,n)}return new k.Color(e.color??16777215)}resolveEntityColor(e){if(Array.isArray(e.rgb)&&e.rgb.length>=3){const[t,i,n]=e.rgb.map(r=>Math.round(k.MathUtils.clamp(Number(r??0),0,255)));return t<<16|i<<8|n}return e.color??16777215}sampleGradientColor(e,t){if(t<=e[0].value)return e[0].color.clone();for(let i=0;i<e.length-1;i+=1){const n=e[i],r=e[i+1];if(t<=r.value+oe){const s=Math.max(r.value-n.value,oe);return n.color.clone().lerp(r.color,(t-n.value)/s)}}return e[e.length-1].color.clone()}createPatternLineItem(e,t,i){const n=[],r=this.engine.options?.hatchPatternMaxSegments??2e4;let s=0;for(const a of i.outers){const h=this.getBounds(a),u=Math.hypot(h.maxX-h.minX,h.maxY-h.minY);if(!(u<oe))for(const f of e.patternLines??[]){if(s>=r)break;const g=this.createPatternFamilySegments(e,f,a,i.holes,h,u,r-s);g.forEach(([d,b])=>{n.push(new k.Vector3(d.x,d.y,Ge),new k.Vector3(b.x,b.y,Ge))}),s+=g.length}}if(n.length===0)return null;n.forEach(a=>a.applyMatrix4(t));const o=je(n);return{kind:"line",layer:e.layer??"0",color:this.resolveEntityColor(e),linkId:e.linkId??e.id,points:n,min:o.min,max:o.max,info:e}}createPatternFamilySegments(e,t,i,n,r,s,o){const a=this.resolvePatternLineTransform(e,t),h=a.dir,u=new k.Vector2(-h.y,h.x),f=a.base,g=a.offset;let d=g.dot(u);if(Math.abs(d)<oe&&(d=Number(t.lineOffset??0)),Math.abs(d)<oe)return[];const b=[new k.Vector2(r.minX,r.minY),new k.Vector2(r.maxX,r.minY),new k.Vector2(r.maxX,r.maxY),new k.Vector2(r.minX,r.maxY)],l=f.dot(u),p=b.map(P=>P.dot(u)-l),y=Math.min(...p)-s,v=Math.max(...p)+s,_=Math.floor(Math.min(y/d,v/d))-2,S=Math.ceil(Math.max(y/d,v/d))+2,E=[],D=new k.Vector2((r.minX+r.maxX)/2,(r.minY+r.maxY)/2);for(let P=_;P<=S&&E.length<o;P+=1){const F=f.clone().add(g.clone().multiplyScalar(P)),B=F.clone().add(h.clone().multiplyScalar(D.clone().sub(F).dot(h))),H=B.clone().add(h.clone().multiplyScalar(-s*2)),q=B.clone().add(h.clone().multiplyScalar(s*2));this.clipLineByPolygon(H,q,i).forEach(([R,m])=>{this.subtractHoles(R,m,n).forEach(([N,ee])=>{this.appendDashedSegment(E,N,ee,t.dashLengths,F,h)})})}return E.slice(0,o)}resolvePatternLineTransform(e,t){const i=Number(t.angle??e.patternAngle??0);return{dir:new k.Vector2(Math.cos(i),Math.sin(i)).normalize(),base:this.toVector2(t.basePoint),offset:this.toVector2(t.offset)}}toVector2(e){return new k.Vector2(e?.[0]??0,e?.[1]??0)}getBounds(e){return{minX:Math.min(...e.map(t=>t[0])),minY:Math.min(...e.map(t=>t[1])),maxX:Math.max(...e.map(t=>t[0])),maxY:Math.max(...e.map(t=>t[1]))}}clipLineByPolygon(e,t,i){const n=[0,1];for(let o=0;o<i.length;o+=1){const a=new k.Vector2(i[o][0],i[o][1]),h=new k.Vector2(i[(o+1)%i.length][0],i[(o+1)%i.length][1]),u=this.segmentIntersectionT(e,t,a,h);u!==null&&u>oe&&u<1-oe&&n.push(u)}const r=this.dedupeSorted(n.sort((o,a)=>o-a),1e-7),s=[];for(let o=0;o<r.length-1;o+=1){const a=r[o],h=r[o+1];if(h-a<1e-7)continue;const u=this.interpolate2(e,t,(a+h)/2);this.pointInPolygon(u,i)&&s.push([this.interpolate2(e,t,a),this.interpolate2(e,t,h)])}return s}subtractHoles(e,t,i){let n=[[e,t]];return i.forEach(r=>{const s=[];n.forEach(([o,a])=>{const h=this.clipLineByPolygon(o,a,r);s.push(...this.subtractSegments(o,a,h))}),n=s}),n}appendDashedSegment(e,t,i,n,r,s){const o=t.distanceTo(i);if(o<oe)return;if(!n?.length){e.push([t,i]);return}const a=this.normalizeDashPattern(n),h=a.reduce((_,S)=>_+S.length,0);if(h<oe){e.push([t,i]);return}const u=s?.clone().normalize()??i.clone().sub(t).normalize(),f=r??t,d=i.clone().sub(t).normalize().dot(u)>=0?1:-1,b=t.clone().sub(f).dot(u)*d,l=this.positiveModulo(b,h);let p=0,y=this.findDashIndex(a,l),v=l-a[y].start;for(;p<o-oe;){const _=a[y],S=Math.max(_.length-v,oe),E=Math.min(o,p+S);_.draw&&e.push([this.pointAtLength(t,i,p),this.pointAtLength(t,i,E)]),p=E,y=(y+1)%a.length,v=0}}normalizeDashPattern(e){let t=0;return e.map(i=>{const n=Number(i??0),r={length:Math.max(Math.abs(n),5e-4),draw:n>=0,start:t};return t+=r.length,r}).filter(i=>i.length>oe)}findDashIndex(e,t){for(let i=e.length-1;i>=0;i-=1)if(t>=e[i].start-oe)return i;return 0}positiveModulo(e,t){return(e%t+t)%t}subtractSegments(e,t,i){const n=i.map(([o,a])=>[this.projectT(e,t,o),this.projectT(e,t,a)]).map(([o,a])=>[Math.max(0,Math.min(o,a)),Math.min(1,Math.max(o,a))]).sort((o,a)=>o[0]-a[0]),r=[];let s=0;return n.forEach(([o,a])=>{o>s+oe&&r.push([this.interpolate2(e,t,s),this.interpolate2(e,t,o)]),s=Math.max(s,a)}),s<1-oe&&r.push([this.interpolate2(e,t,s),this.interpolate2(e,t,1)]),r}segmentIntersectionT(e,t,i,n){const r=t.clone().sub(e),s=n.clone().sub(i),o=this.cross2(r,s);if(Math.abs(o)<1e-10)return null;const a=i.clone().sub(e),h=this.cross2(a,s)/o,u=this.cross2(a,r)/o;return h>=-1e-8&&h<=1+1e-8&&u>=-1e-8&&u<=1+1e-8?h:null}pointInPolygon(e,t){let i=!1;for(let n=0,r=t.length-1;n<t.length;r=n,n+=1){const s=t[n][0],o=t[n][1],a=t[r][0],h=t[r][1];o>e.y!=h>e.y&&e.x<(a-s)*(e.y-o)/(h-o+1e-20)+s&&(i=!i)}return i}cross2(e,t){return e.x*t.y-e.y*t.x}interpolate2(e,t,i){return e.clone().lerp(t,i)}projectT(e,t,i){const n=t.clone().sub(e),r=n.lengthSq();return r<1e-12?0:i.clone().sub(e).dot(n)/r}pointAtLength(e,t,i){const n=e.distanceTo(t);return this.interpolate2(e,t,n<1e-12?0:i/n)}dedupeSorted(e,t){const i=[];return e.forEach(n=>{(!i.length||Math.abs(n-i[i.length-1])>t)&&i.push(n)}),i}}class Rt{constructor(e,t){this.engine=e,this.textFactory=t,this.hatchRenderer=new Bt(e)}hatchRenderer;create(e,t){switch(e.type){case"LINE_GROUP":case"LINE":case"CIRCLE":case"POLYLINE":case"SPLINE":return this.createLineItem(e,t);case"MTEXT":case"TEXT":return this.textFactory.create(e,t);case"HATCH":return this.createHatch(e,t);case"IMAGE":return this.createImage(e,t);default:return[]}}createLineItem(e,t){const i=this.getEntityPoints(e).map(n=>n.clone().applyMatrix4(t));return i.length===0?[]:[{kind:"line",layer:e.layer,color:e.color,lineType:e.lineType,lineTypeScale:e.lineTypeScale,lineTypePattern:Array.isArray(e.lineTypePattern)?e.lineTypePattern:void 0,linkId:e.linkId??e.id,points:i,info:e}]}getEntityPoints(e){switch(e.type){case"LINE_GROUP":return this.getLineGroupPoints(e);case"LINE":return[xe(e.startPoint),xe(e.endPoint)];case"CIRCLE":return this.getCirclePoints(e);case"POLYLINE":return this.getPolylinePoints(e);case"SPLINE":return this.getSplinePoints(e);default:return[]}}getLineGroupPoints(e){const t=[];return(e.segments??[]).forEach(i=>{t.push(new k.Vector3(i[0]??0,i[1]??0,i[2]??0)),t.push(new k.Vector3(i[3]??0,i[4]??0,i[5]??0))}),t}getCirclePoints(e){const t=new k.EllipseCurve(e.center?.[0]??0,e.center?.[1]??0,e.radius??0,e.radius??0,e.startAngle??0,(e.endAngle??Math.PI*2)-1e-5,!1,0);return this.pointsToSegments(t.getPoints(this.engine.options?.circleSegments??48).map(i=>new k.Vector3(i.x,i.y,e.center?.[2]??0)))}getPolylinePoints(e){const t=[],i=e.points??[];for(let n=0;n<i.length-1;n+=1)this.getPolylineSegmentPoints(i[n],i[n+1]).forEach(r=>{t.push(r)});return e.closed&&i.length>1&&this.getPolylineSegmentPoints(i[i.length-1],i[0]).forEach(n=>{t.push(n)}),t}getPolylineSegmentPoints(e,t){const i=xe(e),n=xe(t),r=Number(e?.bulge??0);if(!Number.isFinite(r)||Math.abs(r)<1e-10)return[i,n];const s=n.clone().sub(i),o=s.length();if(o<1e-12)return[i,n];const a=4*Math.atan(r),h=o*(1+r*r)/(4*Math.abs(r)),u=i.clone().add(n).multiplyScalar(.5),f=new k.Vector3(-s.y/o,s.x/o,0),g=u.clone().add(f.multiplyScalar(o*(1-r*r)/(4*r))),d=Math.atan2(i.y-g.y,i.x-g.x),b=Math.max(4,Math.ceil(Math.abs(a)/(this.engine.options?.polylineArcAngleStep??Math.PI/18))),l=[];for(let p=0;p<=b;p+=1){const y=p/b,v=d+a*y;l.push(new k.Vector3(g.x+Math.cos(v)*h,g.y+Math.sin(v)*h,i.z+(n.z-i.z)*y))}return this.pointsToSegments(l)}getSplinePoints(e){const t=(e.points??[]).map(n=>xe(n));if(t.length<2)return[];const i=t.length===2?t:this.sampleSplineCurve(t,e);return this.pointsToSegments(i)}sampleSplineCurve(e,t){const i=Math.min(Math.max(Number(t.degree??this.engine.options?.splineDegree??6),1),e.length-1),n=Array.isArray(t.knots)&&t.knots.length===e.length+i+1?t.knots:this.createClampedUniformKnots(e.length,i),r=e.map((a,h)=>{const u=Array.isArray(t.weights)?Number(t.weights[h]??1):1;return new k.Vector4(a.x,a.y,a.z,Number.isFinite(u)?u:1)});let s=(e.length-1)*2;const o=new zt(i,n,r).getPoints(s);return t.closed===!0&&o.length>1&&o.push(o[0].clone()),o}createClampedUniformKnots(e,t){const i=[];for(let n=0;n<e+t+1;n+=1)n<=t?i.push(0):n>=e?i.push(1):i.push((n-t)/(e-t));return i}pointsToSegments(e){const t=[];for(let i=0;i<e.length-1;i+=1)t.push(e[i].clone(),e[i+1].clone());return t}createHatch(e,t){return this.hatchRenderer.create(e,t)}createImage(e,t){const i=e.imageUrl||e.url;if(!i)return[];const n=xe(e.position),r=xe(e.uVector),s=xe(e.vVector),o=Number(e.pixelWidth??e.width??1),a=Number(e.pixelHeight??e.height??1);if(!Number.isFinite(o)||!Number.isFinite(a)||o===0||a===0)return[];const h=r.multiplyScalar(o),u=s.multiplyScalar(a),f=n.clone(),g=n.clone().add(h),d=n.clone().add(h).add(u),b=n.clone().add(u);[f,g,d,b].forEach(v=>v.applyMatrix4(t));const l=new k.BufferGeometry;l.setAttribute("position",new k.Float32BufferAttribute([f.x,f.y,f.z,g.x,g.y,g.z,d.x,d.y,d.z,f.x,f.y,f.z,d.x,d.y,d.z,b.x,b.y,b.z],3)),l.setAttribute("uv",new k.Float32BufferAttribute([0,0,1,0,1,1,0,0,1,1,0,1],2)),l.computeVertexNormals();const p=_e(l),y=Number(e.fade??0);return[{kind:"image",layer:e.layer??"0",color:e.color??16777215,linkId:e.linkId??e.id,geometry:l,imageUrl:i,opacity:Number.isFinite(y)?k.MathUtils.clamp(1-y/100,0,1):1,min:p.min,max:p.max,info:e}]}}class Dt{constructor(e,t,i=e.modelGroup){this.model=t,this.targetGroup=i}modelMap=new Map;hatchMap=new Map;textMap=new Map;imageMap=new Map;textureLoader=new k.TextureLoader;addRenderItems(e){e.forEach(t=>this.addRenderItem(t))}buildSceneObjects(){this.buildImageObjects(),this.buildHatchObjects(),this.buildLineObjects(),this.buildTextObjects()}addRenderItem(e){const t=`${e.layer}||${e.color}`;if(e.kind==="line"){let s=this.modelMap.get(t);s||(s=new Map,this.modelMap.set(t,s));const o=this.resolveLinePoints(e),a=s.get(e.linkId);a?o.forEach(h=>a.push(h)):s.set(e.linkId,[...o]);return}const i=this.getItemMap(e),n=e.kind==="image"?`${t}||${e.imageUrl??""}`:t,r=i.get(n);r?r.push(e):i.set(n,[e])}getItemMap(e){return e.kind==="text"?this.textMap:e.kind==="image"?this.imageMap:this.hatchMap}resolveLinePoints(e){const t=e.points??[],i=this.resolveLineTypePattern(e);if(!i)return t;const n=[];for(let r=0;r<t.length-1;r+=2)this.applyDashPattern(t[r],t[r+1],i).forEach(s=>n.push(s));return n}resolveLineTypePattern(e){const t=this.model.layers.find(a=>a.name===e.layer),i=String(e.lineType??"").toLowerCase(),n=i==="bylayer"||i===""?String(t?.lineType??"").toLowerCase():i;if(!n||n==="continuous"||n==="byblock")return null;const r=Array.isArray(e.lineTypePattern)&&e.lineTypePattern.length>0?e.lineTypePattern:Array.isArray(t?.lineTypePattern)?t.lineTypePattern:this.getFallbackLineTypePattern(n);if(!r||r.length===0)return null;const s=this.resolveLineTypeScale(e,t),o=r.map(a=>Number(a)).filter(a=>Number.isFinite(a)).map(a=>a*s);return o.some(a=>Math.abs(a)>1e-12)?o:null}getFallbackLineTypePattern(e){return e.includes("dash")?[.25,-.1]:e.includes("dot")?[0,-.1]:null}resolveLineTypeScale(e,t){const i=Number(e.lineTypeScale??t?.lineTypeScale??1);return!Number.isFinite(i)||Math.abs(i)<1e-12?1:Math.abs(i)}applyDashPattern(e,t,i){const n=t.clone().sub(e),r=n.length();if(r<1e-12)return[];const s=n.multiplyScalar(1/r),o=i.reduce((g,d)=>g+Math.abs(d),0),a=Math.max(o*.05,r*.002,1e-6),h=[];let u=0,f=0;for(;u<r-1e-12;){const g=i[f%i.length],d=g>=0,b=Math.max(Math.abs(g),a),l=Math.min(u+b,r);if(d&&l>u&&h.push(e.clone().add(s.clone().multiplyScalar(u)),e.clone().add(s.clone().multiplyScalar(l))),u=l,f+=1,f>1e5)break}return h}buildLineObjects(){this.modelMap.forEach((e,t)=>{const[i]=t.split("||"),n=[];if(e.forEach(f=>{f.forEach(g=>n.push(g))}),n.length===0)return;const r=new k.BufferGeometry().setFromPoints(n),s=new k.LineBasicMaterial({color:this.resolveColor(t)}),o=new k.LineSegments(r,s);o.name=t;const a=r.getAttribute("position");o.clonePoints=a.array.slice(),o.materialClone=s.clone(),this.targetGroup.add(o);const h=this.targetGroup.children.length-1;let u=0;e.forEach((f,g)=>{const d=je(f);this.pushNodeMap(g,{indexes:[h,u,u+f.length*3],object:o,group:this.targetGroup,kind:"line",layer:i,min:d.min,max:d.max}),u+=f.length*3})})}buildTextObjects(){this.textMap.forEach((e,t)=>{const i=e.filter(o=>!!o.geometry),n=this.normalizeMeshGeometries(i,!1,!1);if(n.length===0)return;const r=this.mergeMeshGeometries(n),s=new k.MeshBasicMaterial({color:this.resolveColor(t),side:k.DoubleSide});t.includes("_hitbox")&&(s.visible=!1),this.addMeshObject(i,t,r,n,s)})}buildHatchObjects(){this.hatchMap.forEach((e,t)=>{const i=e.filter(a=>!!a.geometry),n=i.some(a=>a.useVertexColors===!0),r=this.normalizeMeshGeometries(i,!1,n);if(r.length===0)return;const s=this.mergeMeshGeometries(r),o=new k.MeshBasicMaterial({color:n?16777215:this.resolveColor(t),side:k.DoubleSide,transparent:!0,opacity:n?1:.5,vertexColors:n});this.addMeshObject(i,t,s,r,o)})}buildImageObjects(){this.imageMap.forEach((e,t)=>{const i=e.filter(u=>!!u.geometry),n=this.normalizeMeshGeometries(i,!0,!1);if(n.length===0)return;const r=i[0]?.imageUrl;if(!r)return;const s=this.mergeMeshGeometries(n),o=this.textureLoader.load(r);o.colorSpace=k.SRGBColorSpace,o.needsUpdate=!0;const a=i.reduce((u,f)=>Math.min(u,f.opacity??1),1),h=new k.MeshBasicMaterial({map:o,side:k.DoubleSide,transparent:!0,opacity:a,depthWrite:!1});this.addMeshObject(i,t,s,n,h)})}mergeMeshGeometries(e){const t=e.length===1?e[0]:Me(e,!0);if(t.groups.length===0){const i=t.getAttribute("position");t.addGroup(0,i?.count??0,0)}return t.groups.forEach(i=>{i.materialIndex=0}),t}normalizeMeshGeometries(e,t,i){return e.map(n=>{const r=n.geometry,s=r.index?r.toNonIndexed():r.clone(),o=s.getAttribute("position"),a=s.getAttribute("uv"),h=s.getAttribute("color"),u=new k.BufferGeometry;return u.setAttribute("position",o.clone()),t&&u.setAttribute("uv",a?a.clone():this.createEmptyUv(o.count)),i&&u.setAttribute("color",h?h.clone():this.createSolidColorAttribute(o.count,n.color)),u})}createEmptyUv(e){return new k.Float32BufferAttribute(new Array(e*2).fill(0),2)}createSolidColorAttribute(e,t){const i=new k.Color(t??16777215),n=[];for(let r=0;r<e;r+=1)n.push(i.r,i.g,i.b);return new k.Float32BufferAttribute(n,3)}addMeshObject(e,t,i,n,r){const s=new k.Mesh(i,r);s.name=t,s.materialClone=r.clone(),s.isSplit=!1,s.geometrys=void 0,n.forEach(a=>{a!==i&&a.dispose()}),this.targetGroup.add(s);const o=this.targetGroup.children.length-1;e.forEach((a,h)=>{const u=a.linkId??a.info?.id;this.pushNodeMap(u,{indexes:[o,h],object:s,group:this.targetGroup,kind:a.kind,layer:a.layer,info:a.info,min:a.min??new k.Vector3,max:a.max??new k.Vector3}),this.pushTextSearchItem(a,t)})}pushTextSearchItem(e,t){if(e.kind!=="text"||t.includes("_hitbox"))return;const i=e.info?.text,n=String(i??"").replace(/\r\n/g,`
113
+ \0`,X+=r(L,2),X+=D.magic,X+=r(_,2),X+=r(S,2),X+=r(Q.crc32,4),X+=r(Q.compressedSize,4),X+=r(Q.uncompressedSize,4),X+=r(F.length,2),X+=r(N.length,2),{fileRecord:f.LOCAL_FILE_HEADER+X+F+N,dirRecord:f.CENTRAL_FILE_HEADER+r(J,2)+X+r(q.length,2)+"\0\0\0\0"+r(A,4)+r(p,4)+F+N+q}}var o=t("../utils"),a=t("../stream/GenericWorker"),h=t("../utf8"),u=t("../crc32"),f=t("../signature");function g(d,b,l,p){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=b,this.zipPlatform=l,this.encodeFileName=p,this.streamFiles=d,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(g,a),g.prototype.push=function(d){var b=d.meta.percent||0,l=this.entriesCount,p=this._sources.length;this.accumulate?this.contentBuffer.push(d):(this.bytesWritten+=d.data.length,a.prototype.push.call(this,{data:d.data,meta:{currentFile:this.currentFile,percent:l?(b+100*(l-p-1))/l:100}}))},g.prototype.openedSource=function(d){this.currentSourceOffset=this.bytesWritten,this.currentFile=d.file.name;var b=this.streamFiles&&!d.file.dir;if(b){var l=s(d,b,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:l.fileRecord,meta:{percent:0}})}else this.accumulate=!0},g.prototype.closedSource=function(d){this.accumulate=!1;var b=this.streamFiles&&!d.file.dir,l=s(d,b,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(l.dirRecord),b)this.push({data:(function(p){return f.DATA_DESCRIPTOR+r(p.crc32,4)+r(p.compressedSize,4)+r(p.uncompressedSize,4)})(d),meta:{percent:100}});else for(this.push({data:l.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},g.prototype.flush=function(){for(var d=this.bytesWritten,b=0;b<this.dirRecords.length;b++)this.push({data:this.dirRecords[b],meta:{percent:100}});var l=this.bytesWritten-d,p=(function(y,v,_,S,E){var D=o.transformTo("string",E(S));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(y,2)+r(y,2)+r(v,4)+r(_,4)+r(D.length,2)+D})(this.dirRecords.length,l,d,this.zipComment,this.encodeFileName);this.push({data:p,meta:{percent:100}})},g.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},g.prototype.registerPrevious=function(d){this._sources.push(d);var b=this;return d.on("data",function(l){b.processChunk(l)}),d.on("end",function(){b.closedSource(b.previous.streamInfo),b._sources.length?b.prepareNextSource():b.end()}),d.on("error",function(l){b.error(l)}),this},g.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},g.prototype.error=function(d){var b=this._sources;if(!a.prototype.error.call(this,d))return!1;for(var l=0;l<b.length;l++)try{b[l].error(d)}catch{}return!0},g.prototype.lock=function(){a.prototype.lock.call(this);for(var d=this._sources,b=0;b<d.length;b++)d[b].lock()},i.exports=g},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,i,n){var r=t("../compressions"),s=t("./ZipFileWorker");n.generateWorker=function(o,a,h){var u=new s(a.streamFiles,h,a.platform,a.encodeFileName),f=0;try{o.forEach(function(g,d){f++;var b=(function(v,_){var S=v||_,E=r[S];if(!E)throw new Error(S+" is not a valid compression method !");return E})(d.options.compression,a.compression),l=d.options.compressionOptions||a.compressionOptions||{},p=d.dir,y=d.date;d._compressWorker(b,l).withStreamInfo("file",{name:g,dir:p,date:y,comment:d.comment||"",unixPermissions:d.unixPermissions,dosPermissions:d.dosPermissions}).pipe(u)}),u.entriesCount=f}catch(g){u.error(g)}return u}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,i,n){function r(){if(!(this instanceof r))return new r;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 s=new r;for(var o in this)typeof this[o]!="function"&&(s[o]=this[o]);return s}}(r.prototype=t("./object")).loadAsync=t("./load"),r.support=t("./support"),r.defaults=t("./defaults"),r.version="3.10.1",r.loadAsync=function(s,o){return new r().loadAsync(s,o)},r.external=t("./external"),i.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,i,n){var r=t("./utils"),s=t("./external"),o=t("./utf8"),a=t("./zipEntries"),h=t("./stream/Crc32Probe"),u=t("./nodejsUtils");function f(g){return new s.Promise(function(d,b){var l=g.decompressed.getContentWorker().pipe(new h);l.on("error",function(p){b(p)}).on("end",function(){l.streamInfo.crc32!==g.decompressed.crc32?b(new Error("Corrupted zip : CRC32 mismatch")):d()}).resume()})}i.exports=function(g,d){var b=this;return d=r.extend(d||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),u.isNode&&u.isStream(g)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",g,!0,d.optimizedBinaryString,d.base64).then(function(l){var p=new a(d);return p.load(l),p}).then(function(l){var p=[s.Promise.resolve(l)],y=l.files;if(d.checkCRC32)for(var v=0;v<y.length;v++)p.push(f(y[v]));return s.Promise.all(p)}).then(function(l){for(var p=l.shift(),y=p.files,v=0;v<y.length;v++){var _=y[v],S=_.fileNameStr,E=r.resolve(_.fileNameStr);b.file(E,_.decompressed,{binary:!0,optimizedBinaryString:!0,date:_.date,dir:_.dir,comment:_.fileCommentStr.length?_.fileCommentStr:null,unixPermissions:_.unixPermissions,dosPermissions:_.dosPermissions,createFolders:d.createFolders}),_.dir||(b.file(E).unsafeOriginalName=S)}return p.zipComment.length&&(b.comment=p.zipComment),b})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,i,n){var r=t("../utils"),s=t("../stream/GenericWorker");function o(a,h){s.call(this,"Nodejs stream input adapter for "+a),this._upstreamEnded=!1,this._bindStream(h)}r.inherits(o,s),o.prototype._bindStream=function(a){var h=this;(this._stream=a).pause(),a.on("data",function(u){h.push({data:u,meta:{percent:0}})}).on("error",function(u){h.isPaused?this.generatedError=u:h.error(u)}).on("end",function(){h.isPaused?h._upstreamEnded=!0:h.end()})},o.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},i.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,i,n){var r=t("readable-stream").Readable;function s(o,a,h){r.call(this,a),this._helper=o;var u=this;o.on("data",function(f,g){u.push(f)||u._helper.pause(),h&&h(g)}).on("error",function(f){u.emit("error",f)}).on("end",function(){u.push(null)})}t("../utils").inherits(s,r),s.prototype._read=function(){this._helper.resume()},i.exports=s},{"../utils":32,"readable-stream":16}],14:[function(t,i,n){i.exports={isNode:typeof Buffer<"u",newBufferFrom:function(r,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(r,s);if(typeof r=="number")throw new Error('The "data" argument must not be a number');return new Buffer(r,s)},allocBuffer:function(r){if(Buffer.alloc)return Buffer.alloc(r);var s=new Buffer(r);return s.fill(0),s},isBuffer:function(r){return Buffer.isBuffer(r)},isStream:function(r){return r&&typeof r.on=="function"&&typeof r.pause=="function"&&typeof r.resume=="function"}}},{}],15:[function(t,i,n){function r(E,D,P){var F,B=o.getTypeOf(D),H=o.extend(P||{},u);H.date=H.date||new Date,H.compression!==null&&(H.compression=H.compression.toUpperCase()),typeof H.unixPermissions=="string"&&(H.unixPermissions=parseInt(H.unixPermissions,8)),H.unixPermissions&&16384&H.unixPermissions&&(H.dir=!0),H.dosPermissions&&16&H.dosPermissions&&(H.dir=!0),H.dir&&(E=y(E)),H.createFolders&&(F=p(E))&&v.call(this,F,!0);var q=B==="string"&&H.binary===!1&&H.base64===!1;P&&P.binary!==void 0||(H.binary=!q),(D instanceof f&&D.uncompressedSize===0||H.dir||!D||D.length===0)&&(H.base64=!1,H.binary=!0,D="",H.compression="STORE",B="string");var M=null;M=D instanceof f||D instanceof a?D:b.isNode&&b.isStream(D)?new l(E,D):o.prepareContent(E,D,H.binary,H.optimizedBinaryString,H.base64);var R=new g(E,M,H);this.files[E]=R}var s=t("./utf8"),o=t("./utils"),a=t("./stream/GenericWorker"),h=t("./stream/StreamHelper"),u=t("./defaults"),f=t("./compressedObject"),g=t("./zipObject"),d=t("./generate"),b=t("./nodejsUtils"),l=t("./nodejs/NodejsStreamInputAdapter"),p=function(E){E.slice(-1)==="/"&&(E=E.substring(0,E.length-1));var D=E.lastIndexOf("/");return 0<D?E.substring(0,D):""},y=function(E){return E.slice(-1)!=="/"&&(E+="/"),E},v=function(E,D){return D=D!==void 0?D:u.createFolders,E=y(E),this.files[E]||r.call(this,E,null,{dir:!0,createFolders:D}),this.files[E]};function _(E){return Object.prototype.toString.call(E)==="[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(E){var D,P,F;for(D in this.files)F=this.files[D],(P=D.slice(this.root.length,D.length))&&D.slice(0,this.root.length)===this.root&&E(P,F)},filter:function(E){var D=[];return this.forEach(function(P,F){E(P,F)&&D.push(F)}),D},file:function(E,D,P){if(arguments.length!==1)return E=this.root+E,r.call(this,E,D,P),this;if(_(E)){var F=E;return this.filter(function(H,q){return!q.dir&&F.test(H)})}var B=this.files[this.root+E];return B&&!B.dir?B:null},folder:function(E){if(!E)return this;if(_(E))return this.filter(function(B,H){return H.dir&&E.test(B)});var D=this.root+E,P=v.call(this,D),F=this.clone();return F.root=P.name,F},remove:function(E){E=this.root+E;var D=this.files[E];if(D||(E.slice(-1)!=="/"&&(E+="/"),D=this.files[E]),D&&!D.dir)delete this.files[E];else for(var P=this.filter(function(B,H){return H.name.slice(0,E.length)===E}),F=0;F<P.length;F++)delete this.files[P[F].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(E){var D,P={};try{if((P=o.extend(E||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=P.type.toLowerCase(),P.compression=P.compression.toUpperCase(),P.type==="binarystring"&&(P.type="string"),!P.type)throw new Error("No output type specified.");o.checkSupport(P.type),P.platform!=="darwin"&&P.platform!=="freebsd"&&P.platform!=="linux"&&P.platform!=="sunos"||(P.platform="UNIX"),P.platform==="win32"&&(P.platform="DOS");var F=P.comment||this.comment||"";D=d.generateWorker(this,P,F)}catch(B){(D=new a("error")).error(B)}return new h(D,P.type||"string",P.mimeType)},generateAsync:function(E,D){return this.generateInternalStream(E).accumulate(D)},generateNodeStream:function(E,D){return(E=E||{}).type||(E.type="nodebuffer"),this.generateInternalStream(E).toNodejsStream(D)}};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(t,i,n){i.exports=t("stream")},{stream:void 0}],17:[function(t,i,n){var r=t("./DataReader");function s(o){r.call(this,o);for(var a=0;a<this.data.length;a++)o[a]=255&o[a]}t("../utils").inherits(s,r),s.prototype.byteAt=function(o){return this.data[this.zero+o]},s.prototype.lastIndexOfSignature=function(o){for(var a=o.charCodeAt(0),h=o.charCodeAt(1),u=o.charCodeAt(2),f=o.charCodeAt(3),g=this.length-4;0<=g;--g)if(this.data[g]===a&&this.data[g+1]===h&&this.data[g+2]===u&&this.data[g+3]===f)return g-this.zero;return-1},s.prototype.readAndCheckSignature=function(o){var a=o.charCodeAt(0),h=o.charCodeAt(1),u=o.charCodeAt(2),f=o.charCodeAt(3),g=this.readData(4);return a===g[0]&&h===g[1]&&u===g[2]&&f===g[3]},s.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},i.exports=s},{"../utils":32,"./DataReader":18}],18:[function(t,i,n){var r=t("../utils");function s(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var a,h=0;for(this.checkOffset(o),a=this.index+o-1;a>=this.index;a--)h=(h<<8)+this.byteAt(a);return this.index+=o,h},readString:function(o){return r.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},i.exports=s},{"../utils":32}],19:[function(t,i,n){var r=t("./Uint8ArrayReader");function s(o){r.call(this,o)}t("../utils").inherits(s,r),s.prototype.readData=function(o){this.checkOffset(o);var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},i.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,i,n){var r=t("./DataReader");function s(o){r.call(this,o)}t("../utils").inherits(s,r),s.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},s.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},s.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},s.prototype.readData=function(o){this.checkOffset(o);var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},i.exports=s},{"../utils":32,"./DataReader":18}],21:[function(t,i,n){var r=t("./ArrayReader");function s(o){r.call(this,o)}t("../utils").inherits(s,r),s.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var a=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},i.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(t,i,n){var r=t("../utils"),s=t("../support"),o=t("./ArrayReader"),a=t("./StringReader"),h=t("./NodeBufferReader"),u=t("./Uint8ArrayReader");i.exports=function(f){var g=r.getTypeOf(f);return r.checkSupport(g),g!=="string"||s.uint8array?g==="nodebuffer"?new h(f):s.uint8array?new u(r.transformTo("uint8array",f)):new o(r.transformTo("array",f)):new a(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,i,n){n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,i,n){var r=t("./GenericWorker"),s=t("../utils");function o(a){r.call(this,"ConvertWorker to "+a),this.destType=a}s.inherits(o,r),o.prototype.processChunk=function(a){this.push({data:s.transformTo(this.destType,a.data),meta:a.meta})},i.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,i,n){var r=t("./GenericWorker"),s=t("../crc32");function o(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(o,r),o.prototype.processChunk=function(a){this.streamInfo.crc32=s(a.data,this.streamInfo.crc32||0),this.push(a)},i.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,i,n){var r=t("../utils"),s=t("./GenericWorker");function o(a){s.call(this,"DataLengthProbe for "+a),this.propName=a,this.withStreamInfo(a,0)}r.inherits(o,s),o.prototype.processChunk=function(a){if(a){var h=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=h+a.data.length}s.prototype.processChunk.call(this,a)},i.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,i,n){var r=t("../utils"),s=t("./GenericWorker");function o(a){s.call(this,"DataWorker");var h=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,a.then(function(u){h.dataIsReady=!0,h.data=u,h.max=u&&u.length||0,h.type=r.getTypeOf(u),h.isPaused||h._tickAndRepeat()},function(u){h.error(u)})}r.inherits(o,s),o.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var a=null,h=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":a=this.data.substring(this.index,h);break;case"uint8array":a=this.data.subarray(this.index,h);break;case"array":case"nodebuffer":a=this.data.slice(this.index,h)}return this.index=h,this.push({data:a,meta:{percent:this.max?this.index/this.max*100:0}})},i.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(t,i,n){function r(s){this.name=s||"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}r.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,o){return this._listeners[s].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,o){if(this._listeners[s])for(var a=0;a<this._listeners[s].length;a++)this._listeners[s][a].call(this,o)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var o=this;return s.on("data",function(a){o.processChunk(a)}),s.on("end",function(){o.end()}),s.on("error",function(a){o.error(a)}),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 s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,o){return this.extraStreamInfo[s]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},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 s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},i.exports=r},{}],29:[function(t,i,n){var r=t("../utils"),s=t("./ConvertWorker"),o=t("./GenericWorker"),a=t("../base64"),h=t("../support"),u=t("../external"),f=null;if(h.nodestream)try{f=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function g(b,l){return new u.Promise(function(p,y){var v=[],_=b._internalType,S=b._outputType,E=b._mimeType;b.on("data",function(D,P){v.push(D),l&&l(P)}).on("error",function(D){v=[],y(D)}).on("end",function(){try{var D=(function(P,F,B){switch(P){case"blob":return r.newBlob(r.transformTo("arraybuffer",F),B);case"base64":return a.encode(F);default:return r.transformTo(P,F)}})(S,(function(P,F){var B,H=0,q=null,M=0;for(B=0;B<F.length;B++)M+=F[B].length;switch(P){case"string":return F.join("");case"array":return Array.prototype.concat.apply([],F);case"uint8array":for(q=new Uint8Array(M),B=0;B<F.length;B++)q.set(F[B],H),H+=F[B].length;return q;case"nodebuffer":return Buffer.concat(F);default:throw new Error("concat : unsupported type '"+P+"'")}})(_,v),E);p(D)}catch(P){y(P)}v=[]}).resume()})}function d(b,l,p){var y=l;switch(l){case"blob":case"arraybuffer":y="uint8array";break;case"base64":y="string"}try{this._internalType=y,this._outputType=l,this._mimeType=p,r.checkSupport(y),this._worker=b.pipe(new s(y)),b.lock()}catch(v){this._worker=new o("error"),this._worker.error(v)}}d.prototype={accumulate:function(b){return g(this,b)},on:function(b,l){var p=this;return b==="data"?this._worker.on(b,function(y){l.call(p,y.data,y.meta)}):this._worker.on(b,function(){r.delay(l,arguments,p)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(b){if(r.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},b)}},i.exports=d},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,i,n){if(n.base64=!0,n.array=!0,n.string=!0,n.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",n.nodebuffer=typeof Buffer<"u",n.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")n.blob=!1;else{var r=new ArrayBuffer(0);try{n.blob=new Blob([r],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(r),n.blob=s.getBlob("application/zip").size===0}catch{n.blob=!1}}}try{n.nodestream=!!t("readable-stream").Readable}catch{n.nodestream=!1}},{"readable-stream":16}],31:[function(t,i,n){for(var r=t("./utils"),s=t("./support"),o=t("./nodejsUtils"),a=t("./stream/GenericWorker"),h=new Array(256),u=0;u<256;u++)h[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;h[254]=h[254]=1;function f(){a.call(this,"utf-8 decode"),this.leftOver=null}function g(){a.call(this,"utf-8 encode")}n.utf8encode=function(d){return s.nodebuffer?o.newBufferFrom(d,"utf-8"):(function(b){var l,p,y,v,_,S=b.length,E=0;for(v=0;v<S;v++)(64512&(p=b.charCodeAt(v)))==55296&&v+1<S&&(64512&(y=b.charCodeAt(v+1)))==56320&&(p=65536+(p-55296<<10)+(y-56320),v++),E+=p<128?1:p<2048?2:p<65536?3:4;for(l=s.uint8array?new Uint8Array(E):new Array(E),v=_=0;_<E;v++)(64512&(p=b.charCodeAt(v)))==55296&&v+1<S&&(64512&(y=b.charCodeAt(v+1)))==56320&&(p=65536+(p-55296<<10)+(y-56320),v++),p<128?l[_++]=p:(p<2048?l[_++]=192|p>>>6:(p<65536?l[_++]=224|p>>>12:(l[_++]=240|p>>>18,l[_++]=128|p>>>12&63),l[_++]=128|p>>>6&63),l[_++]=128|63&p);return l})(d)},n.utf8decode=function(d){return s.nodebuffer?r.transformTo("nodebuffer",d).toString("utf-8"):(function(b){var l,p,y,v,_=b.length,S=new Array(2*_);for(l=p=0;l<_;)if((y=b[l++])<128)S[p++]=y;else if(4<(v=h[y]))S[p++]=65533,l+=v-1;else{for(y&=v===2?31:v===3?15:7;1<v&&l<_;)y=y<<6|63&b[l++],v--;1<v?S[p++]=65533:y<65536?S[p++]=y:(y-=65536,S[p++]=55296|y>>10&1023,S[p++]=56320|1023&y)}return S.length!==p&&(S.subarray?S=S.subarray(0,p):S.length=p),r.applyFromCharCode(S)})(d=r.transformTo(s.uint8array?"uint8array":"array",d))},r.inherits(f,a),f.prototype.processChunk=function(d){var b=r.transformTo(s.uint8array?"uint8array":"array",d.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var l=b;(b=new Uint8Array(l.length+this.leftOver.length)).set(this.leftOver,0),b.set(l,this.leftOver.length)}else b=this.leftOver.concat(b);this.leftOver=null}var p=(function(v,_){var S;for((_=_||v.length)>v.length&&(_=v.length),S=_-1;0<=S&&(192&v[S])==128;)S--;return S<0||S===0?_:S+h[v[S]]>_?S:_})(b),y=b;p!==b.length&&(s.uint8array?(y=b.subarray(0,p),this.leftOver=b.subarray(p,b.length)):(y=b.slice(0,p),this.leftOver=b.slice(p,b.length))),this.push({data:n.utf8decode(y),meta:d.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=f,r.inherits(g,a),g.prototype.processChunk=function(d){this.push({data:n.utf8encode(d.data),meta:d.meta})},n.Utf8EncodeWorker=g},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,i,n){var r=t("./support"),s=t("./base64"),o=t("./nodejsUtils"),a=t("./external");function h(l){return l}function u(l,p){for(var y=0;y<l.length;++y)p[y]=255&l.charCodeAt(y);return p}t("setimmediate"),n.newBlob=function(l,p){n.checkSupport("blob");try{return new Blob([l],{type:p})}catch{try{var y=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return y.append(l),y.getBlob(p)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(l,p,y){var v=[],_=0,S=l.length;if(S<=y)return String.fromCharCode.apply(null,l);for(;_<S;)p==="array"||p==="nodebuffer"?v.push(String.fromCharCode.apply(null,l.slice(_,Math.min(_+y,S)))):v.push(String.fromCharCode.apply(null,l.subarray(_,Math.min(_+y,S)))),_+=y;return v.join("")},stringifyByChar:function(l){for(var p="",y=0;y<l.length;y++)p+=String.fromCharCode(l[y]);return p},applyCanBeUsed:{uint8array:(function(){try{return r.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return r.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch{return!1}})()}};function g(l){var p=65536,y=n.getTypeOf(l),v=!0;if(y==="uint8array"?v=f.applyCanBeUsed.uint8array:y==="nodebuffer"&&(v=f.applyCanBeUsed.nodebuffer),v)for(;1<p;)try{return f.stringifyByChunk(l,y,p)}catch{p=Math.floor(p/2)}return f.stringifyByChar(l)}function d(l,p){for(var y=0;y<l.length;y++)p[y]=l[y];return p}n.applyFromCharCode=g;var b={};b.string={string:h,array:function(l){return u(l,new Array(l.length))},arraybuffer:function(l){return b.string.uint8array(l).buffer},uint8array:function(l){return u(l,new Uint8Array(l.length))},nodebuffer:function(l){return u(l,o.allocBuffer(l.length))}},b.array={string:g,array:h,arraybuffer:function(l){return new Uint8Array(l).buffer},uint8array:function(l){return new Uint8Array(l)},nodebuffer:function(l){return o.newBufferFrom(l)}},b.arraybuffer={string:function(l){return g(new Uint8Array(l))},array:function(l){return d(new Uint8Array(l),new Array(l.byteLength))},arraybuffer:h,uint8array:function(l){return new Uint8Array(l)},nodebuffer:function(l){return o.newBufferFrom(new Uint8Array(l))}},b.uint8array={string:g,array:function(l){return d(l,new Array(l.length))},arraybuffer:function(l){return l.buffer},uint8array:h,nodebuffer:function(l){return o.newBufferFrom(l)}},b.nodebuffer={string:g,array:function(l){return d(l,new Array(l.length))},arraybuffer:function(l){return b.nodebuffer.uint8array(l).buffer},uint8array:function(l){return d(l,new Uint8Array(l.length))},nodebuffer:h},n.transformTo=function(l,p){if(p=p||"",!l)return p;n.checkSupport(l);var y=n.getTypeOf(p);return b[y][l](p)},n.resolve=function(l){for(var p=l.split("/"),y=[],v=0;v<p.length;v++){var _=p[v];_==="."||_===""&&v!==0&&v!==p.length-1||(_===".."?y.pop():y.push(_))}return y.join("/")},n.getTypeOf=function(l){return typeof l=="string"?"string":Object.prototype.toString.call(l)==="[object Array]"?"array":r.nodebuffer&&o.isBuffer(l)?"nodebuffer":r.uint8array&&l instanceof Uint8Array?"uint8array":r.arraybuffer&&l instanceof ArrayBuffer?"arraybuffer":void 0},n.checkSupport=function(l){if(!r[l.toLowerCase()])throw new Error(l+" is not supported by this platform")},n.MAX_VALUE_16BITS=65535,n.MAX_VALUE_32BITS=-1,n.pretty=function(l){var p,y,v="";for(y=0;y<(l||"").length;y++)v+="\\x"+((p=l.charCodeAt(y))<16?"0":"")+p.toString(16).toUpperCase();return v},n.delay=function(l,p,y){setImmediate(function(){l.apply(y||null,p||[])})},n.inherits=function(l,p){function y(){}y.prototype=p.prototype,l.prototype=new y},n.extend=function(){var l,p,y={};for(l=0;l<arguments.length;l++)for(p in arguments[l])Object.prototype.hasOwnProperty.call(arguments[l],p)&&y[p]===void 0&&(y[p]=arguments[l][p]);return y},n.prepareContent=function(l,p,y,v,_){return a.Promise.resolve(p).then(function(S){return r.blob&&(S instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(S))!==-1)&&typeof FileReader<"u"?new a.Promise(function(E,D){var P=new FileReader;P.onload=function(F){E(F.target.result)},P.onerror=function(F){D(F.target.error)},P.readAsArrayBuffer(S)}):S}).then(function(S){var E=n.getTypeOf(S);return E?(E==="arraybuffer"?S=n.transformTo("uint8array",S):E==="string"&&(_?S=s.decode(S):y&&v!==!0&&(S=(function(D){return u(D,r.uint8array?new Uint8Array(D.length):new Array(D.length))})(S))),S):a.Promise.reject(new Error("Can't read the data of '"+l+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,i,n){var r=t("./reader/readerFor"),s=t("./utils"),o=t("./signature"),a=t("./zipEntry"),h=t("./support");function u(f){this.files=[],this.loadOptions=f}u.prototype={checkSignature:function(f){if(!this.reader.readAndCheckSignature(f)){this.reader.index-=4;var g=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(g)+", expected "+s.pretty(f)+")")}},isSignature:function(f,g){var d=this.reader.index;this.reader.setIndex(f);var b=this.reader.readString(4)===g;return this.reader.setIndex(d),b},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 f=this.reader.readData(this.zipCommentLength),g=h.uint8array?"uint8array":"array",d=s.transformTo(g,f);this.zipComment=this.loadOptions.decodeFileName(d)},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 f,g,d,b=this.zip64EndOfCentralSize-44;0<b;)f=this.reader.readInt(2),g=this.reader.readInt(4),d=this.reader.readData(g),this.zip64ExtensibleData[f]={id:f,length:g,value:d}},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 f,g;for(f=0;f<this.files.length;f++)g=this.files[f],this.reader.setIndex(g.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),g.readLocalPart(this.reader),g.handleUTF8(),g.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(f=new a({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);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 f=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var g=f;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var d=this.centralDirOffset+this.centralDirSize;this.zip64&&(d+=20,d+=12+this.zip64EndOfCentralSize);var b=g-d;if(0<b)this.isSignature(g,o.CENTRAL_FILE_HEADER)||(this.reader.zero=b);else if(b<0)throw new Error("Corrupted zip: missing "+Math.abs(b)+" bytes.")},prepareReader:function(f){this.reader=r(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},i.exports=u},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,i,n){var r=t("./reader/readerFor"),s=t("./utils"),o=t("./compressedObject"),a=t("./crc32"),h=t("./utf8"),u=t("./compressions"),f=t("./support");function g(d,b){this.options=d,this.loadOptions=b}g.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(d){var b,l;if(d.skip(22),this.fileNameLength=d.readInt(2),l=d.readInt(2),this.fileName=d.readData(this.fileNameLength),d.skip(l),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((b=(function(p){for(var y in u)if(Object.prototype.hasOwnProperty.call(u,y)&&u[y].magic===p)return u[y];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,b,d.readData(this.compressedSize))},readCentralPart:function(d){this.versionMadeBy=d.readInt(2),d.skip(2),this.bitFlag=d.readInt(2),this.compressionMethod=d.readString(2),this.date=d.readDate(),this.crc32=d.readInt(4),this.compressedSize=d.readInt(4),this.uncompressedSize=d.readInt(4);var b=d.readInt(2);if(this.extraFieldsLength=d.readInt(2),this.fileCommentLength=d.readInt(2),this.diskNumberStart=d.readInt(2),this.internalFileAttributes=d.readInt(2),this.externalFileAttributes=d.readInt(4),this.localHeaderOffset=d.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");d.skip(b),this.readExtraFields(d),this.parseZIP64ExtraField(d),this.fileComment=d.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var d=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),d==0&&(this.dosPermissions=63&this.externalFileAttributes),d==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var d=r(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=d.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=d.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=d.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=d.readInt(4))}},readExtraFields:function(d){var b,l,p,y=d.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});d.index+4<y;)b=d.readInt(2),l=d.readInt(2),p=d.readData(l),this.extraFields[b]={id:b,length:l,value:p};d.setIndex(y)},handleUTF8:function(){var d=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=h.utf8decode(this.fileName),this.fileCommentStr=h.utf8decode(this.fileComment);else{var b=this.findExtraFieldUnicodePath();if(b!==null)this.fileNameStr=b;else{var l=s.transformTo(d,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(l)}var p=this.findExtraFieldUnicodeComment();if(p!==null)this.fileCommentStr=p;else{var y=s.transformTo(d,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(y)}}},findExtraFieldUnicodePath:function(){var d=this.extraFields[28789];if(d){var b=r(d.value);return b.readInt(1)!==1||a(this.fileName)!==b.readInt(4)?null:h.utf8decode(b.readData(d.length-5))}return null},findExtraFieldUnicodeComment:function(){var d=this.extraFields[25461];if(d){var b=r(d.value);return b.readInt(1)!==1||a(this.fileComment)!==b.readInt(4)?null:h.utf8decode(b.readData(d.length-5))}return null}},i.exports=g},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,i,n){function r(b,l,p){this.name=b,this.dir=p.dir,this.date=p.date,this.comment=p.comment,this.unixPermissions=p.unixPermissions,this.dosPermissions=p.dosPermissions,this._data=l,this._dataBinary=p.binary,this.options={compression:p.compression,compressionOptions:p.compressionOptions}}var s=t("./stream/StreamHelper"),o=t("./stream/DataWorker"),a=t("./utf8"),h=t("./compressedObject"),u=t("./stream/GenericWorker");r.prototype={internalStream:function(b){var l=null,p="string";try{if(!b)throw new Error("No output type specified.");var y=(p=b.toLowerCase())==="string"||p==="text";p!=="binarystring"&&p!=="text"||(p="string"),l=this._decompressWorker();var v=!this._dataBinary;v&&!y&&(l=l.pipe(new a.Utf8EncodeWorker)),!v&&y&&(l=l.pipe(new a.Utf8DecodeWorker))}catch(_){(l=new u("error")).error(_)}return new s(l,p,"")},async:function(b,l){return this.internalStream(b).accumulate(l)},nodeStream:function(b,l){return this.internalStream(b||"nodebuffer").toNodejsStream(l)},_compressWorker:function(b,l){if(this._data instanceof h&&this._data.compression.magic===b.magic)return this._data.getCompressedWorker();var p=this._decompressWorker();return this._dataBinary||(p=p.pipe(new a.Utf8EncodeWorker)),h.createWorkerFrom(p,b,l)},_decompressWorker:function(){return this._data instanceof h?this._data.getContentWorker():this._data instanceof u?this._data:new o(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],g=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},d=0;d<f.length;d++)r.prototype[f[d]]=g;i.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,i,n){(function(r){var s,o,a=r.MutationObserver||r.WebKitMutationObserver;if(a){var h=0,u=new a(b),f=r.document.createTextNode("");u.observe(f,{characterData:!0}),s=function(){f.data=h=++h%2}}else if(r.setImmediate||r.MessageChannel===void 0)s="document"in r&&"onreadystatechange"in r.document.createElement("script")?function(){var l=r.document.createElement("script");l.onreadystatechange=function(){b(),l.onreadystatechange=null,l.parentNode.removeChild(l),l=null},r.document.documentElement.appendChild(l)}:function(){setTimeout(b,0)};else{var g=new r.MessageChannel;g.port1.onmessage=b,s=function(){g.port2.postMessage(0)}}var d=[];function b(){var l,p;o=!0;for(var y=d.length;y;){for(p=d,d=[],l=-1;++l<y;)p[l]();y=d.length}o=!1}i.exports=function(l){d.push(l)!==1||o||s()}}).call(this,typeof Se<"u"?Se:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(t,i,n){var r=t("immediate");function s(){}var o={},a=["REJECTED"],h=["FULFILLED"],u=["PENDING"];function f(y){if(typeof y!="function")throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,y!==s&&l(this,y)}function g(y,v,_){this.promise=y,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof _=="function"&&(this.onRejected=_,this.callRejected=this.otherCallRejected)}function d(y,v,_){r(function(){var S;try{S=v(_)}catch(E){return o.reject(y,E)}S===y?o.reject(y,new TypeError("Cannot resolve promise with itself")):o.resolve(y,S)})}function b(y){var v=y&&y.then;if(y&&(typeof y=="object"||typeof y=="function")&&typeof v=="function")return function(){v.apply(y,arguments)}}function l(y,v){var _=!1;function S(P){_||(_=!0,o.reject(y,P))}function E(P){_||(_=!0,o.resolve(y,P))}var D=p(function(){v(E,S)});D.status==="error"&&S(D.value)}function p(y,v){var _={};try{_.value=y(v),_.status="success"}catch(S){_.status="error",_.value=S}return _}(i.exports=f).prototype.finally=function(y){if(typeof y!="function")return this;var v=this.constructor;return this.then(function(_){return v.resolve(y()).then(function(){return _})},function(_){return v.resolve(y()).then(function(){throw _})})},f.prototype.catch=function(y){return this.then(null,y)},f.prototype.then=function(y,v){if(typeof y!="function"&&this.state===h||typeof v!="function"&&this.state===a)return this;var _=new this.constructor(s);return this.state!==u?d(_,this.state===h?y:v,this.outcome):this.queue.push(new g(_,y,v)),_},g.prototype.callFulfilled=function(y){o.resolve(this.promise,y)},g.prototype.otherCallFulfilled=function(y){d(this.promise,this.onFulfilled,y)},g.prototype.callRejected=function(y){o.reject(this.promise,y)},g.prototype.otherCallRejected=function(y){d(this.promise,this.onRejected,y)},o.resolve=function(y,v){var _=p(b,v);if(_.status==="error")return o.reject(y,_.value);var S=_.value;if(S)l(y,S);else{y.state=h,y.outcome=v;for(var E=-1,D=y.queue.length;++E<D;)y.queue[E].callFulfilled(v)}return y},o.reject=function(y,v){y.state=a,y.outcome=v;for(var _=-1,S=y.queue.length;++_<S;)y.queue[_].callRejected(v);return y},f.resolve=function(y){return y instanceof this?y:o.resolve(new this(s),y)},f.reject=function(y){var v=new this(s);return o.reject(v,y)},f.all=function(y){var v=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var _=y.length,S=!1;if(!_)return this.resolve([]);for(var E=new Array(_),D=0,P=-1,F=new this(s);++P<_;)B(y[P],P);return F;function B(H,q){v.resolve(H).then(function(M){E[q]=M,++D!==_||S||(S=!0,o.resolve(F,E))},function(M){S||(S=!0,o.reject(F,M))})}},f.race=function(y){var v=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var _=y.length,S=!1;if(!_)return this.resolve([]);for(var E=-1,D=new this(s);++E<_;)P=y[E],v.resolve(P).then(function(F){S||(S=!0,o.resolve(D,F))},function(F){S||(S=!0,o.reject(D,F))});var P;return D}},{immediate:36}],38:[function(t,i,n){var r={};(0,t("./lib/utils/common").assign)(r,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),i.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,i,n){var r=t("./zlib/deflate"),s=t("./utils/common"),o=t("./utils/strings"),a=t("./zlib/messages"),h=t("./zlib/zstream"),u=Object.prototype.toString,f=0,g=-1,d=0,b=8;function l(y){if(!(this instanceof l))return new l(y);this.options=s.assign({level:g,method:b,chunkSize:16384,windowBits:15,memLevel:8,strategy:d,to:""},y||{});var v=this.options;v.raw&&0<v.windowBits?v.windowBits=-v.windowBits:v.gzip&&0<v.windowBits&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var _=r.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(_!==f)throw new Error(a[_]);if(v.header&&r.deflateSetHeader(this.strm,v.header),v.dictionary){var S;if(S=typeof v.dictionary=="string"?o.string2buf(v.dictionary):u.call(v.dictionary)==="[object ArrayBuffer]"?new Uint8Array(v.dictionary):v.dictionary,(_=r.deflateSetDictionary(this.strm,S))!==f)throw new Error(a[_]);this._dict_set=!0}}function p(y,v){var _=new l(v);if(_.push(y,!0),_.err)throw _.msg||a[_.err];return _.result}l.prototype.push=function(y,v){var _,S,E=this.strm,D=this.options.chunkSize;if(this.ended)return!1;S=v===~~v?v:v===!0?4:0,typeof y=="string"?E.input=o.string2buf(y):u.call(y)==="[object ArrayBuffer]"?E.input=new Uint8Array(y):E.input=y,E.next_in=0,E.avail_in=E.input.length;do{if(E.avail_out===0&&(E.output=new s.Buf8(D),E.next_out=0,E.avail_out=D),(_=r.deflate(E,S))!==1&&_!==f)return this.onEnd(_),!(this.ended=!0);E.avail_out!==0&&(E.avail_in!==0||S!==4&&S!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(s.shrinkBuf(E.output,E.next_out))):this.onData(s.shrinkBuf(E.output,E.next_out)))}while((0<E.avail_in||E.avail_out===0)&&_!==1);return S===4?(_=r.deflateEnd(this.strm),this.onEnd(_),this.ended=!0,_===f):S!==2||(this.onEnd(f),!(E.avail_out=0))},l.prototype.onData=function(y){this.chunks.push(y)},l.prototype.onEnd=function(y){y===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=y,this.msg=this.strm.msg},n.Deflate=l,n.deflate=p,n.deflateRaw=function(y,v){return(v=v||{}).raw=!0,p(y,v)},n.gzip=function(y,v){return(v=v||{}).gzip=!0,p(y,v)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,i,n){var r=t("./zlib/inflate"),s=t("./utils/common"),o=t("./utils/strings"),a=t("./zlib/constants"),h=t("./zlib/messages"),u=t("./zlib/zstream"),f=t("./zlib/gzheader"),g=Object.prototype.toString;function d(l){if(!(this instanceof d))return new d(l);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},l||{});var p=this.options;p.raw&&0<=p.windowBits&&p.windowBits<16&&(p.windowBits=-p.windowBits,p.windowBits===0&&(p.windowBits=-15)),!(0<=p.windowBits&&p.windowBits<16)||l&&l.windowBits||(p.windowBits+=32),15<p.windowBits&&p.windowBits<48&&(15&p.windowBits)==0&&(p.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var y=r.inflateInit2(this.strm,p.windowBits);if(y!==a.Z_OK)throw new Error(h[y]);this.header=new f,r.inflateGetHeader(this.strm,this.header)}function b(l,p){var y=new d(p);if(y.push(l,!0),y.err)throw y.msg||h[y.err];return y.result}d.prototype.push=function(l,p){var y,v,_,S,E,D,P=this.strm,F=this.options.chunkSize,B=this.options.dictionary,H=!1;if(this.ended)return!1;v=p===~~p?p:p===!0?a.Z_FINISH:a.Z_NO_FLUSH,typeof l=="string"?P.input=o.binstring2buf(l):g.call(l)==="[object ArrayBuffer]"?P.input=new Uint8Array(l):P.input=l,P.next_in=0,P.avail_in=P.input.length;do{if(P.avail_out===0&&(P.output=new s.Buf8(F),P.next_out=0,P.avail_out=F),(y=r.inflate(P,a.Z_NO_FLUSH))===a.Z_NEED_DICT&&B&&(D=typeof B=="string"?o.string2buf(B):g.call(B)==="[object ArrayBuffer]"?new Uint8Array(B):B,y=r.inflateSetDictionary(this.strm,D)),y===a.Z_BUF_ERROR&&H===!0&&(y=a.Z_OK,H=!1),y!==a.Z_STREAM_END&&y!==a.Z_OK)return this.onEnd(y),!(this.ended=!0);P.next_out&&(P.avail_out!==0&&y!==a.Z_STREAM_END&&(P.avail_in!==0||v!==a.Z_FINISH&&v!==a.Z_SYNC_FLUSH)||(this.options.to==="string"?(_=o.utf8border(P.output,P.next_out),S=P.next_out-_,E=o.buf2string(P.output,_),P.next_out=S,P.avail_out=F-S,S&&s.arraySet(P.output,P.output,_,S,0),this.onData(E)):this.onData(s.shrinkBuf(P.output,P.next_out)))),P.avail_in===0&&P.avail_out===0&&(H=!0)}while((0<P.avail_in||P.avail_out===0)&&y!==a.Z_STREAM_END);return y===a.Z_STREAM_END&&(v=a.Z_FINISH),v===a.Z_FINISH?(y=r.inflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===a.Z_OK):v!==a.Z_SYNC_FLUSH||(this.onEnd(a.Z_OK),!(P.avail_out=0))},d.prototype.onData=function(l){this.chunks.push(l)},d.prototype.onEnd=function(l){l===a.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=l,this.msg=this.strm.msg},n.Inflate=d,n.inflate=b,n.inflateRaw=function(l,p){return(p=p||{}).raw=!0,b(l,p)},n.ungzip=b},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,i,n){var r=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";n.assign=function(a){for(var h=Array.prototype.slice.call(arguments,1);h.length;){var u=h.shift();if(u){if(typeof u!="object")throw new TypeError(u+"must be non-object");for(var f in u)u.hasOwnProperty(f)&&(a[f]=u[f])}}return a},n.shrinkBuf=function(a,h){return a.length===h?a:a.subarray?a.subarray(0,h):(a.length=h,a)};var s={arraySet:function(a,h,u,f,g){if(h.subarray&&a.subarray)a.set(h.subarray(u,u+f),g);else for(var d=0;d<f;d++)a[g+d]=h[u+d]},flattenChunks:function(a){var h,u,f,g,d,b;for(h=f=0,u=a.length;h<u;h++)f+=a[h].length;for(b=new Uint8Array(f),h=g=0,u=a.length;h<u;h++)d=a[h],b.set(d,g),g+=d.length;return b}},o={arraySet:function(a,h,u,f,g){for(var d=0;d<f;d++)a[g+d]=h[u+d]},flattenChunks:function(a){return[].concat.apply([],a)}};n.setTyped=function(a){a?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,s)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,o))},n.setTyped(r)},{}],42:[function(t,i,n){var r=t("./common"),s=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{o=!1}for(var a=new r.Buf8(256),h=0;h<256;h++)a[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;function u(f,g){if(g<65537&&(f.subarray&&o||!f.subarray&&s))return String.fromCharCode.apply(null,r.shrinkBuf(f,g));for(var d="",b=0;b<g;b++)d+=String.fromCharCode(f[b]);return d}a[254]=a[254]=1,n.string2buf=function(f){var g,d,b,l,p,y=f.length,v=0;for(l=0;l<y;l++)(64512&(d=f.charCodeAt(l)))==55296&&l+1<y&&(64512&(b=f.charCodeAt(l+1)))==56320&&(d=65536+(d-55296<<10)+(b-56320),l++),v+=d<128?1:d<2048?2:d<65536?3:4;for(g=new r.Buf8(v),l=p=0;p<v;l++)(64512&(d=f.charCodeAt(l)))==55296&&l+1<y&&(64512&(b=f.charCodeAt(l+1)))==56320&&(d=65536+(d-55296<<10)+(b-56320),l++),d<128?g[p++]=d:(d<2048?g[p++]=192|d>>>6:(d<65536?g[p++]=224|d>>>12:(g[p++]=240|d>>>18,g[p++]=128|d>>>12&63),g[p++]=128|d>>>6&63),g[p++]=128|63&d);return g},n.buf2binstring=function(f){return u(f,f.length)},n.binstring2buf=function(f){for(var g=new r.Buf8(f.length),d=0,b=g.length;d<b;d++)g[d]=f.charCodeAt(d);return g},n.buf2string=function(f,g){var d,b,l,p,y=g||f.length,v=new Array(2*y);for(d=b=0;d<y;)if((l=f[d++])<128)v[b++]=l;else if(4<(p=a[l]))v[b++]=65533,d+=p-1;else{for(l&=p===2?31:p===3?15:7;1<p&&d<y;)l=l<<6|63&f[d++],p--;1<p?v[b++]=65533:l<65536?v[b++]=l:(l-=65536,v[b++]=55296|l>>10&1023,v[b++]=56320|1023&l)}return u(v,b)},n.utf8border=function(f,g){var d;for((g=g||f.length)>f.length&&(g=f.length),d=g-1;0<=d&&(192&f[d])==128;)d--;return d<0||d===0?g:d+a[f[d]]>g?d:g}},{"./common":41}],43:[function(t,i,n){i.exports=function(r,s,o,a){for(var h=65535&r|0,u=r>>>16&65535|0,f=0;o!==0;){for(o-=f=2e3<o?2e3:o;u=u+(h=h+s[a++]|0)|0,--f;);h%=65521,u%=65521}return h|u<<16|0}},{}],44:[function(t,i,n){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(t,i,n){var r=(function(){for(var s,o=[],a=0;a<256;a++){s=a;for(var h=0;h<8;h++)s=1&s?3988292384^s>>>1:s>>>1;o[a]=s}return o})();i.exports=function(s,o,a,h){var u=r,f=h+a;s^=-1;for(var g=h;g<f;g++)s=s>>>8^u[255&(s^o[g])];return-1^s}},{}],46:[function(t,i,n){var r,s=t("../utils/common"),o=t("./trees"),a=t("./adler32"),h=t("./crc32"),u=t("./messages"),f=0,g=4,d=0,b=-2,l=-1,p=4,y=2,v=8,_=9,S=286,E=30,D=19,P=2*S+1,F=15,B=3,H=258,q=H+B+1,M=42,R=113,m=1,N=2,ee=3,V=4;function te(c,O){return c.msg=u[O],O}function G(c){return(c<<1)-(4<c?9:0)}function Q(c){for(var O=c.length;0<=--O;)c[O]=0}function L(c){var O=c.state,z=O.pending;z>c.avail_out&&(z=c.avail_out),z!==0&&(s.arraySet(c.output,O.pending_buf,O.pending_out,z,c.next_out),c.next_out+=z,O.pending_out+=z,c.total_out+=z,c.avail_out-=z,O.pending-=z,O.pending===0&&(O.pending_out=0))}function A(c,O){o._tr_flush_block(c,0<=c.block_start?c.block_start:-1,c.strstart-c.block_start,O),c.block_start=c.strstart,L(c.strm)}function J(c,O){c.pending_buf[c.pending++]=O}function X(c,O){c.pending_buf[c.pending++]=O>>>8&255,c.pending_buf[c.pending++]=255&O}function Y(c,O){var z,x,w=c.max_chain_length,I=c.strstart,j=c.prev_length,U=c.nice_match,T=c.strstart>c.w_size-q?c.strstart-(c.w_size-q):0,W=c.window,$=c.w_mask,Z=c.prev,K=c.strstart+H,se=W[I+j-1],ne=W[I+j];c.prev_length>=c.good_match&&(w>>=2),U>c.lookahead&&(U=c.lookahead);do if(W[(z=O)+j]===ne&&W[z+j-1]===se&&W[z]===W[I]&&W[++z]===W[I+1]){I+=2,z++;do;while(W[++I]===W[++z]&&W[++I]===W[++z]&&W[++I]===W[++z]&&W[++I]===W[++z]&&W[++I]===W[++z]&&W[++I]===W[++z]&&W[++I]===W[++z]&&W[++I]===W[++z]&&I<K);if(x=H-(K-I),I=K-H,j<x){if(c.match_start=O,U<=(j=x))break;se=W[I+j-1],ne=W[I+j]}}while((O=Z[O&$])>T&&--w!=0);return j<=c.lookahead?j:c.lookahead}function ae(c){var O,z,x,w,I,j,U,T,W,$,Z=c.w_size;do{if(w=c.window_size-c.lookahead-c.strstart,c.strstart>=Z+(Z-q)){for(s.arraySet(c.window,c.window,Z,Z,0),c.match_start-=Z,c.strstart-=Z,c.block_start-=Z,O=z=c.hash_size;x=c.head[--O],c.head[O]=Z<=x?x-Z:0,--z;);for(O=z=Z;x=c.prev[--O],c.prev[O]=Z<=x?x-Z:0,--z;);w+=Z}if(c.strm.avail_in===0)break;if(j=c.strm,U=c.window,T=c.strstart+c.lookahead,W=w,$=void 0,$=j.avail_in,W<$&&($=W),z=$===0?0:(j.avail_in-=$,s.arraySet(U,j.input,j.next_in,$,T),j.state.wrap===1?j.adler=a(j.adler,U,$,T):j.state.wrap===2&&(j.adler=h(j.adler,U,$,T)),j.next_in+=$,j.total_in+=$,$),c.lookahead+=z,c.lookahead+c.insert>=B)for(I=c.strstart-c.insert,c.ins_h=c.window[I],c.ins_h=(c.ins_h<<c.hash_shift^c.window[I+1])&c.hash_mask;c.insert&&(c.ins_h=(c.ins_h<<c.hash_shift^c.window[I+B-1])&c.hash_mask,c.prev[I&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=I,I++,c.insert--,!(c.lookahead+c.insert<B)););}while(c.lookahead<q&&c.strm.avail_in!==0)}function fe(c,O){for(var z,x;;){if(c.lookahead<q){if(ae(c),c.lookahead<q&&O===f)return m;if(c.lookahead===0)break}if(z=0,c.lookahead>=B&&(c.ins_h=(c.ins_h<<c.hash_shift^c.window[c.strstart+B-1])&c.hash_mask,z=c.prev[c.strstart&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=c.strstart),z!==0&&c.strstart-z<=c.w_size-q&&(c.match_length=Y(c,z)),c.match_length>=B)if(x=o._tr_tally(c,c.strstart-c.match_start,c.match_length-B),c.lookahead-=c.match_length,c.match_length<=c.max_lazy_match&&c.lookahead>=B){for(c.match_length--;c.strstart++,c.ins_h=(c.ins_h<<c.hash_shift^c.window[c.strstart+B-1])&c.hash_mask,z=c.prev[c.strstart&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=c.strstart,--c.match_length!=0;);c.strstart++}else c.strstart+=c.match_length,c.match_length=0,c.ins_h=c.window[c.strstart],c.ins_h=(c.ins_h<<c.hash_shift^c.window[c.strstart+1])&c.hash_mask;else x=o._tr_tally(c,0,c.window[c.strstart]),c.lookahead--,c.strstart++;if(x&&(A(c,!1),c.strm.avail_out===0))return m}return c.insert=c.strstart<B-1?c.strstart:B-1,O===g?(A(c,!0),c.strm.avail_out===0?ee:V):c.last_lit&&(A(c,!1),c.strm.avail_out===0)?m:N}function ie(c,O){for(var z,x,w;;){if(c.lookahead<q){if(ae(c),c.lookahead<q&&O===f)return m;if(c.lookahead===0)break}if(z=0,c.lookahead>=B&&(c.ins_h=(c.ins_h<<c.hash_shift^c.window[c.strstart+B-1])&c.hash_mask,z=c.prev[c.strstart&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=c.strstart),c.prev_length=c.match_length,c.prev_match=c.match_start,c.match_length=B-1,z!==0&&c.prev_length<c.max_lazy_match&&c.strstart-z<=c.w_size-q&&(c.match_length=Y(c,z),c.match_length<=5&&(c.strategy===1||c.match_length===B&&4096<c.strstart-c.match_start)&&(c.match_length=B-1)),c.prev_length>=B&&c.match_length<=c.prev_length){for(w=c.strstart+c.lookahead-B,x=o._tr_tally(c,c.strstart-1-c.prev_match,c.prev_length-B),c.lookahead-=c.prev_length-1,c.prev_length-=2;++c.strstart<=w&&(c.ins_h=(c.ins_h<<c.hash_shift^c.window[c.strstart+B-1])&c.hash_mask,z=c.prev[c.strstart&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=c.strstart),--c.prev_length!=0;);if(c.match_available=0,c.match_length=B-1,c.strstart++,x&&(A(c,!1),c.strm.avail_out===0))return m}else if(c.match_available){if((x=o._tr_tally(c,0,c.window[c.strstart-1]))&&A(c,!1),c.strstart++,c.lookahead--,c.strm.avail_out===0)return m}else c.match_available=1,c.strstart++,c.lookahead--}return c.match_available&&(x=o._tr_tally(c,0,c.window[c.strstart-1]),c.match_available=0),c.insert=c.strstart<B-1?c.strstart:B-1,O===g?(A(c,!0),c.strm.avail_out===0?ee:V):c.last_lit&&(A(c,!1),c.strm.avail_out===0)?m:N}function re(c,O,z,x,w){this.good_length=c,this.max_lazy=O,this.nice_length=z,this.max_chain=x,this.func=w}function ue(){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=v,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 s.Buf16(2*P),this.dyn_dtree=new s.Buf16(2*(2*E+1)),this.bl_tree=new s.Buf16(2*(2*D+1)),Q(this.dyn_ltree),Q(this.dyn_dtree),Q(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(F+1),this.heap=new s.Buf16(2*S+1),Q(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*S+1),Q(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 le(c){var O;return c&&c.state?(c.total_in=c.total_out=0,c.data_type=y,(O=c.state).pending=0,O.pending_out=0,O.wrap<0&&(O.wrap=-O.wrap),O.status=O.wrap?M:R,c.adler=O.wrap===2?0:1,O.last_flush=f,o._tr_init(O),d):te(c,b)}function be(c){var O=le(c);return O===d&&(function(z){z.window_size=2*z.w_size,Q(z.head),z.max_lazy_match=r[z.level].max_lazy,z.good_match=r[z.level].good_length,z.nice_match=r[z.level].nice_length,z.max_chain_length=r[z.level].max_chain,z.strstart=0,z.block_start=0,z.lookahead=0,z.insert=0,z.match_length=z.prev_length=B-1,z.match_available=0,z.ins_h=0})(c.state),O}function ge(c,O,z,x,w,I){if(!c)return b;var j=1;if(O===l&&(O=6),x<0?(j=0,x=-x):15<x&&(j=2,x-=16),w<1||_<w||z!==v||x<8||15<x||O<0||9<O||I<0||p<I)return te(c,b);x===8&&(x=9);var U=new ue;return(c.state=U).strm=c,U.wrap=j,U.gzhead=null,U.w_bits=x,U.w_size=1<<U.w_bits,U.w_mask=U.w_size-1,U.hash_bits=w+7,U.hash_size=1<<U.hash_bits,U.hash_mask=U.hash_size-1,U.hash_shift=~~((U.hash_bits+B-1)/B),U.window=new s.Buf8(2*U.w_size),U.head=new s.Buf16(U.hash_size),U.prev=new s.Buf16(U.w_size),U.lit_bufsize=1<<w+6,U.pending_buf_size=4*U.lit_bufsize,U.pending_buf=new s.Buf8(U.pending_buf_size),U.d_buf=1*U.lit_bufsize,U.l_buf=3*U.lit_bufsize,U.level=O,U.strategy=I,U.method=z,be(c)}r=[new re(0,0,0,0,function(c,O){var z=65535;for(z>c.pending_buf_size-5&&(z=c.pending_buf_size-5);;){if(c.lookahead<=1){if(ae(c),c.lookahead===0&&O===f)return m;if(c.lookahead===0)break}c.strstart+=c.lookahead,c.lookahead=0;var x=c.block_start+z;if((c.strstart===0||c.strstart>=x)&&(c.lookahead=c.strstart-x,c.strstart=x,A(c,!1),c.strm.avail_out===0)||c.strstart-c.block_start>=c.w_size-q&&(A(c,!1),c.strm.avail_out===0))return m}return c.insert=0,O===g?(A(c,!0),c.strm.avail_out===0?ee:V):(c.strstart>c.block_start&&(A(c,!1),c.strm.avail_out),m)}),new re(4,4,8,4,fe),new re(4,5,16,8,fe),new re(4,6,32,32,fe),new re(4,4,16,16,ie),new re(8,16,32,32,ie),new re(8,16,128,128,ie),new re(8,32,128,256,ie),new re(32,128,258,1024,ie),new re(32,258,258,4096,ie)],n.deflateInit=function(c,O){return ge(c,O,v,15,8,0)},n.deflateInit2=ge,n.deflateReset=be,n.deflateResetKeep=le,n.deflateSetHeader=function(c,O){return c&&c.state?c.state.wrap!==2?b:(c.state.gzhead=O,d):b},n.deflate=function(c,O){var z,x,w,I;if(!c||!c.state||5<O||O<0)return c?te(c,b):b;if(x=c.state,!c.output||!c.input&&c.avail_in!==0||x.status===666&&O!==g)return te(c,c.avail_out===0?-5:b);if(x.strm=c,z=x.last_flush,x.last_flush=O,x.status===M)if(x.wrap===2)c.adler=0,J(x,31),J(x,139),J(x,8),x.gzhead?(J(x,(x.gzhead.text?1:0)+(x.gzhead.hcrc?2:0)+(x.gzhead.extra?4:0)+(x.gzhead.name?8:0)+(x.gzhead.comment?16:0)),J(x,255&x.gzhead.time),J(x,x.gzhead.time>>8&255),J(x,x.gzhead.time>>16&255),J(x,x.gzhead.time>>24&255),J(x,x.level===9?2:2<=x.strategy||x.level<2?4:0),J(x,255&x.gzhead.os),x.gzhead.extra&&x.gzhead.extra.length&&(J(x,255&x.gzhead.extra.length),J(x,x.gzhead.extra.length>>8&255)),x.gzhead.hcrc&&(c.adler=h(c.adler,x.pending_buf,x.pending,0)),x.gzindex=0,x.status=69):(J(x,0),J(x,0),J(x,0),J(x,0),J(x,0),J(x,x.level===9?2:2<=x.strategy||x.level<2?4:0),J(x,3),x.status=R);else{var j=v+(x.w_bits-8<<4)<<8;j|=(2<=x.strategy||x.level<2?0:x.level<6?1:x.level===6?2:3)<<6,x.strstart!==0&&(j|=32),j+=31-j%31,x.status=R,X(x,j),x.strstart!==0&&(X(x,c.adler>>>16),X(x,65535&c.adler)),c.adler=1}if(x.status===69)if(x.gzhead.extra){for(w=x.pending;x.gzindex<(65535&x.gzhead.extra.length)&&(x.pending!==x.pending_buf_size||(x.gzhead.hcrc&&x.pending>w&&(c.adler=h(c.adler,x.pending_buf,x.pending-w,w)),L(c),w=x.pending,x.pending!==x.pending_buf_size));)J(x,255&x.gzhead.extra[x.gzindex]),x.gzindex++;x.gzhead.hcrc&&x.pending>w&&(c.adler=h(c.adler,x.pending_buf,x.pending-w,w)),x.gzindex===x.gzhead.extra.length&&(x.gzindex=0,x.status=73)}else x.status=73;if(x.status===73)if(x.gzhead.name){w=x.pending;do{if(x.pending===x.pending_buf_size&&(x.gzhead.hcrc&&x.pending>w&&(c.adler=h(c.adler,x.pending_buf,x.pending-w,w)),L(c),w=x.pending,x.pending===x.pending_buf_size)){I=1;break}I=x.gzindex<x.gzhead.name.length?255&x.gzhead.name.charCodeAt(x.gzindex++):0,J(x,I)}while(I!==0);x.gzhead.hcrc&&x.pending>w&&(c.adler=h(c.adler,x.pending_buf,x.pending-w,w)),I===0&&(x.gzindex=0,x.status=91)}else x.status=91;if(x.status===91)if(x.gzhead.comment){w=x.pending;do{if(x.pending===x.pending_buf_size&&(x.gzhead.hcrc&&x.pending>w&&(c.adler=h(c.adler,x.pending_buf,x.pending-w,w)),L(c),w=x.pending,x.pending===x.pending_buf_size)){I=1;break}I=x.gzindex<x.gzhead.comment.length?255&x.gzhead.comment.charCodeAt(x.gzindex++):0,J(x,I)}while(I!==0);x.gzhead.hcrc&&x.pending>w&&(c.adler=h(c.adler,x.pending_buf,x.pending-w,w)),I===0&&(x.status=103)}else x.status=103;if(x.status===103&&(x.gzhead.hcrc?(x.pending+2>x.pending_buf_size&&L(c),x.pending+2<=x.pending_buf_size&&(J(x,255&c.adler),J(x,c.adler>>8&255),c.adler=0,x.status=R)):x.status=R),x.pending!==0){if(L(c),c.avail_out===0)return x.last_flush=-1,d}else if(c.avail_in===0&&G(O)<=G(z)&&O!==g)return te(c,-5);if(x.status===666&&c.avail_in!==0)return te(c,-5);if(c.avail_in!==0||x.lookahead!==0||O!==f&&x.status!==666){var U=x.strategy===2?(function(T,W){for(var $;;){if(T.lookahead===0&&(ae(T),T.lookahead===0)){if(W===f)return m;break}if(T.match_length=0,$=o._tr_tally(T,0,T.window[T.strstart]),T.lookahead--,T.strstart++,$&&(A(T,!1),T.strm.avail_out===0))return m}return T.insert=0,W===g?(A(T,!0),T.strm.avail_out===0?ee:V):T.last_lit&&(A(T,!1),T.strm.avail_out===0)?m:N})(x,O):x.strategy===3?(function(T,W){for(var $,Z,K,se,ne=T.window;;){if(T.lookahead<=H){if(ae(T),T.lookahead<=H&&W===f)return m;if(T.lookahead===0)break}if(T.match_length=0,T.lookahead>=B&&0<T.strstart&&(Z=ne[K=T.strstart-1])===ne[++K]&&Z===ne[++K]&&Z===ne[++K]){se=T.strstart+H;do;while(Z===ne[++K]&&Z===ne[++K]&&Z===ne[++K]&&Z===ne[++K]&&Z===ne[++K]&&Z===ne[++K]&&Z===ne[++K]&&Z===ne[++K]&&K<se);T.match_length=H-(se-K),T.match_length>T.lookahead&&(T.match_length=T.lookahead)}if(T.match_length>=B?($=o._tr_tally(T,1,T.match_length-B),T.lookahead-=T.match_length,T.strstart+=T.match_length,T.match_length=0):($=o._tr_tally(T,0,T.window[T.strstart]),T.lookahead--,T.strstart++),$&&(A(T,!1),T.strm.avail_out===0))return m}return T.insert=0,W===g?(A(T,!0),T.strm.avail_out===0?ee:V):T.last_lit&&(A(T,!1),T.strm.avail_out===0)?m:N})(x,O):r[x.level].func(x,O);if(U!==ee&&U!==V||(x.status=666),U===m||U===ee)return c.avail_out===0&&(x.last_flush=-1),d;if(U===N&&(O===1?o._tr_align(x):O!==5&&(o._tr_stored_block(x,0,0,!1),O===3&&(Q(x.head),x.lookahead===0&&(x.strstart=0,x.block_start=0,x.insert=0))),L(c),c.avail_out===0))return x.last_flush=-1,d}return O!==g?d:x.wrap<=0?1:(x.wrap===2?(J(x,255&c.adler),J(x,c.adler>>8&255),J(x,c.adler>>16&255),J(x,c.adler>>24&255),J(x,255&c.total_in),J(x,c.total_in>>8&255),J(x,c.total_in>>16&255),J(x,c.total_in>>24&255)):(X(x,c.adler>>>16),X(x,65535&c.adler)),L(c),0<x.wrap&&(x.wrap=-x.wrap),x.pending!==0?d:1)},n.deflateEnd=function(c){var O;return c&&c.state?(O=c.state.status)!==M&&O!==69&&O!==73&&O!==91&&O!==103&&O!==R&&O!==666?te(c,b):(c.state=null,O===R?te(c,-3):d):b},n.deflateSetDictionary=function(c,O){var z,x,w,I,j,U,T,W,$=O.length;if(!c||!c.state||(I=(z=c.state).wrap)===2||I===1&&z.status!==M||z.lookahead)return b;for(I===1&&(c.adler=a(c.adler,O,$,0)),z.wrap=0,$>=z.w_size&&(I===0&&(Q(z.head),z.strstart=0,z.block_start=0,z.insert=0),W=new s.Buf8(z.w_size),s.arraySet(W,O,$-z.w_size,z.w_size,0),O=W,$=z.w_size),j=c.avail_in,U=c.next_in,T=c.input,c.avail_in=$,c.next_in=0,c.input=O,ae(z);z.lookahead>=B;){for(x=z.strstart,w=z.lookahead-(B-1);z.ins_h=(z.ins_h<<z.hash_shift^z.window[x+B-1])&z.hash_mask,z.prev[x&z.w_mask]=z.head[z.ins_h],z.head[z.ins_h]=x,x++,--w;);z.strstart=x,z.lookahead=B-1,ae(z)}return z.strstart+=z.lookahead,z.block_start=z.strstart,z.insert=z.lookahead,z.lookahead=0,z.match_length=z.prev_length=B-1,z.match_available=0,c.next_in=U,c.input=T,c.avail_in=j,z.wrap=I,d},n.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,i,n){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(t,i,n){i.exports=function(r,s){var o,a,h,u,f,g,d,b,l,p,y,v,_,S,E,D,P,F,B,H,q,M,R,m,N;o=r.state,a=r.next_in,m=r.input,h=a+(r.avail_in-5),u=r.next_out,N=r.output,f=u-(s-r.avail_out),g=u+(r.avail_out-257),d=o.dmax,b=o.wsize,l=o.whave,p=o.wnext,y=o.window,v=o.hold,_=o.bits,S=o.lencode,E=o.distcode,D=(1<<o.lenbits)-1,P=(1<<o.distbits)-1;e:do{_<15&&(v+=m[a++]<<_,_+=8,v+=m[a++]<<_,_+=8),F=S[v&D];t:for(;;){if(v>>>=B=F>>>24,_-=B,(B=F>>>16&255)===0)N[u++]=65535&F;else{if(!(16&B)){if((64&B)==0){F=S[(65535&F)+(v&(1<<B)-1)];continue t}if(32&B){o.mode=12;break e}r.msg="invalid literal/length code",o.mode=30;break e}H=65535&F,(B&=15)&&(_<B&&(v+=m[a++]<<_,_+=8),H+=v&(1<<B)-1,v>>>=B,_-=B),_<15&&(v+=m[a++]<<_,_+=8,v+=m[a++]<<_,_+=8),F=E[v&P];i:for(;;){if(v>>>=B=F>>>24,_-=B,!(16&(B=F>>>16&255))){if((64&B)==0){F=E[(65535&F)+(v&(1<<B)-1)];continue i}r.msg="invalid distance code",o.mode=30;break e}if(q=65535&F,_<(B&=15)&&(v+=m[a++]<<_,(_+=8)<B&&(v+=m[a++]<<_,_+=8)),d<(q+=v&(1<<B)-1)){r.msg="invalid distance too far back",o.mode=30;break e}if(v>>>=B,_-=B,(B=u-f)<q){if(l<(B=q-B)&&o.sane){r.msg="invalid distance too far back",o.mode=30;break e}if(R=y,(M=0)===p){if(M+=b-B,B<H){for(H-=B;N[u++]=y[M++],--B;);M=u-q,R=N}}else if(p<B){if(M+=b+p-B,(B-=p)<H){for(H-=B;N[u++]=y[M++],--B;);if(M=0,p<H){for(H-=B=p;N[u++]=y[M++],--B;);M=u-q,R=N}}}else if(M+=p-B,B<H){for(H-=B;N[u++]=y[M++],--B;);M=u-q,R=N}for(;2<H;)N[u++]=R[M++],N[u++]=R[M++],N[u++]=R[M++],H-=3;H&&(N[u++]=R[M++],1<H&&(N[u++]=R[M++]))}else{for(M=u-q;N[u++]=N[M++],N[u++]=N[M++],N[u++]=N[M++],2<(H-=3););H&&(N[u++]=N[M++],1<H&&(N[u++]=N[M++]))}break}}break}}while(a<h&&u<g);a-=H=_>>3,v&=(1<<(_-=H<<3))-1,r.next_in=a,r.next_out=u,r.avail_in=a<h?h-a+5:5-(a-h),r.avail_out=u<g?g-u+257:257-(u-g),o.hold=v,o.bits=_}},{}],49:[function(t,i,n){var r=t("../utils/common"),s=t("./adler32"),o=t("./crc32"),a=t("./inffast"),h=t("./inftrees"),u=1,f=2,g=0,d=-2,b=1,l=852,p=592;function y(M){return(M>>>24&255)+(M>>>8&65280)+((65280&M)<<8)+((255&M)<<24)}function v(){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 r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(M){var R;return M&&M.state?(R=M.state,M.total_in=M.total_out=R.total=0,M.msg="",R.wrap&&(M.adler=1&R.wrap),R.mode=b,R.last=0,R.havedict=0,R.dmax=32768,R.head=null,R.hold=0,R.bits=0,R.lencode=R.lendyn=new r.Buf32(l),R.distcode=R.distdyn=new r.Buf32(p),R.sane=1,R.back=-1,g):d}function S(M){var R;return M&&M.state?((R=M.state).wsize=0,R.whave=0,R.wnext=0,_(M)):d}function E(M,R){var m,N;return M&&M.state?(N=M.state,R<0?(m=0,R=-R):(m=1+(R>>4),R<48&&(R&=15)),R&&(R<8||15<R)?d:(N.window!==null&&N.wbits!==R&&(N.window=null),N.wrap=m,N.wbits=R,S(M))):d}function D(M,R){var m,N;return M?(N=new v,(M.state=N).window=null,(m=E(M,R))!==g&&(M.state=null),m):d}var P,F,B=!0;function H(M){if(B){var R;for(P=new r.Buf32(512),F=new r.Buf32(32),R=0;R<144;)M.lens[R++]=8;for(;R<256;)M.lens[R++]=9;for(;R<280;)M.lens[R++]=7;for(;R<288;)M.lens[R++]=8;for(h(u,M.lens,0,288,P,0,M.work,{bits:9}),R=0;R<32;)M.lens[R++]=5;h(f,M.lens,0,32,F,0,M.work,{bits:5}),B=!1}M.lencode=P,M.lenbits=9,M.distcode=F,M.distbits=5}function q(M,R,m,N){var ee,V=M.state;return V.window===null&&(V.wsize=1<<V.wbits,V.wnext=0,V.whave=0,V.window=new r.Buf8(V.wsize)),N>=V.wsize?(r.arraySet(V.window,R,m-V.wsize,V.wsize,0),V.wnext=0,V.whave=V.wsize):(N<(ee=V.wsize-V.wnext)&&(ee=N),r.arraySet(V.window,R,m-N,ee,V.wnext),(N-=ee)?(r.arraySet(V.window,R,m-N,N,0),V.wnext=N,V.whave=V.wsize):(V.wnext+=ee,V.wnext===V.wsize&&(V.wnext=0),V.whave<V.wsize&&(V.whave+=ee))),0}n.inflateReset=S,n.inflateReset2=E,n.inflateResetKeep=_,n.inflateInit=function(M){return D(M,15)},n.inflateInit2=D,n.inflate=function(M,R){var m,N,ee,V,te,G,Q,L,A,J,X,Y,ae,fe,ie,re,ue,le,be,ge,c,O,z,x,w=0,I=new r.Buf8(4),j=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!M||!M.state||!M.output||!M.input&&M.avail_in!==0)return d;(m=M.state).mode===12&&(m.mode=13),te=M.next_out,ee=M.output,Q=M.avail_out,V=M.next_in,N=M.input,G=M.avail_in,L=m.hold,A=m.bits,J=G,X=Q,O=g;e:for(;;)switch(m.mode){case b:if(m.wrap===0){m.mode=13;break}for(;A<16;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}if(2&m.wrap&&L===35615){I[m.check=0]=255&L,I[1]=L>>>8&255,m.check=o(m.check,I,2,0),A=L=0,m.mode=2;break}if(m.flags=0,m.head&&(m.head.done=!1),!(1&m.wrap)||(((255&L)<<8)+(L>>8))%31){M.msg="incorrect header check",m.mode=30;break}if((15&L)!=8){M.msg="unknown compression method",m.mode=30;break}if(A-=4,c=8+(15&(L>>>=4)),m.wbits===0)m.wbits=c;else if(c>m.wbits){M.msg="invalid window size",m.mode=30;break}m.dmax=1<<c,M.adler=m.check=1,m.mode=512&L?10:12,A=L=0;break;case 2:for(;A<16;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}if(m.flags=L,(255&m.flags)!=8){M.msg="unknown compression method",m.mode=30;break}if(57344&m.flags){M.msg="unknown header flags set",m.mode=30;break}m.head&&(m.head.text=L>>8&1),512&m.flags&&(I[0]=255&L,I[1]=L>>>8&255,m.check=o(m.check,I,2,0)),A=L=0,m.mode=3;case 3:for(;A<32;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}m.head&&(m.head.time=L),512&m.flags&&(I[0]=255&L,I[1]=L>>>8&255,I[2]=L>>>16&255,I[3]=L>>>24&255,m.check=o(m.check,I,4,0)),A=L=0,m.mode=4;case 4:for(;A<16;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}m.head&&(m.head.xflags=255&L,m.head.os=L>>8),512&m.flags&&(I[0]=255&L,I[1]=L>>>8&255,m.check=o(m.check,I,2,0)),A=L=0,m.mode=5;case 5:if(1024&m.flags){for(;A<16;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}m.length=L,m.head&&(m.head.extra_len=L),512&m.flags&&(I[0]=255&L,I[1]=L>>>8&255,m.check=o(m.check,I,2,0)),A=L=0}else m.head&&(m.head.extra=null);m.mode=6;case 6:if(1024&m.flags&&(G<(Y=m.length)&&(Y=G),Y&&(m.head&&(c=m.head.extra_len-m.length,m.head.extra||(m.head.extra=new Array(m.head.extra_len)),r.arraySet(m.head.extra,N,V,Y,c)),512&m.flags&&(m.check=o(m.check,N,Y,V)),G-=Y,V+=Y,m.length-=Y),m.length))break e;m.length=0,m.mode=7;case 7:if(2048&m.flags){if(G===0)break e;for(Y=0;c=N[V+Y++],m.head&&c&&m.length<65536&&(m.head.name+=String.fromCharCode(c)),c&&Y<G;);if(512&m.flags&&(m.check=o(m.check,N,Y,V)),G-=Y,V+=Y,c)break e}else m.head&&(m.head.name=null);m.length=0,m.mode=8;case 8:if(4096&m.flags){if(G===0)break e;for(Y=0;c=N[V+Y++],m.head&&c&&m.length<65536&&(m.head.comment+=String.fromCharCode(c)),c&&Y<G;);if(512&m.flags&&(m.check=o(m.check,N,Y,V)),G-=Y,V+=Y,c)break e}else m.head&&(m.head.comment=null);m.mode=9;case 9:if(512&m.flags){for(;A<16;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}if(L!==(65535&m.check)){M.msg="header crc mismatch",m.mode=30;break}A=L=0}m.head&&(m.head.hcrc=m.flags>>9&1,m.head.done=!0),M.adler=m.check=0,m.mode=12;break;case 10:for(;A<32;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}M.adler=m.check=y(L),A=L=0,m.mode=11;case 11:if(m.havedict===0)return M.next_out=te,M.avail_out=Q,M.next_in=V,M.avail_in=G,m.hold=L,m.bits=A,2;M.adler=m.check=1,m.mode=12;case 12:if(R===5||R===6)break e;case 13:if(m.last){L>>>=7&A,A-=7&A,m.mode=27;break}for(;A<3;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}switch(m.last=1&L,A-=1,3&(L>>>=1)){case 0:m.mode=14;break;case 1:if(H(m),m.mode=20,R!==6)break;L>>>=2,A-=2;break e;case 2:m.mode=17;break;case 3:M.msg="invalid block type",m.mode=30}L>>>=2,A-=2;break;case 14:for(L>>>=7&A,A-=7&A;A<32;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}if((65535&L)!=(L>>>16^65535)){M.msg="invalid stored block lengths",m.mode=30;break}if(m.length=65535&L,A=L=0,m.mode=15,R===6)break e;case 15:m.mode=16;case 16:if(Y=m.length){if(G<Y&&(Y=G),Q<Y&&(Y=Q),Y===0)break e;r.arraySet(ee,N,V,Y,te),G-=Y,V+=Y,Q-=Y,te+=Y,m.length-=Y;break}m.mode=12;break;case 17:for(;A<14;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}if(m.nlen=257+(31&L),L>>>=5,A-=5,m.ndist=1+(31&L),L>>>=5,A-=5,m.ncode=4+(15&L),L>>>=4,A-=4,286<m.nlen||30<m.ndist){M.msg="too many length or distance symbols",m.mode=30;break}m.have=0,m.mode=18;case 18:for(;m.have<m.ncode;){for(;A<3;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}m.lens[j[m.have++]]=7&L,L>>>=3,A-=3}for(;m.have<19;)m.lens[j[m.have++]]=0;if(m.lencode=m.lendyn,m.lenbits=7,z={bits:m.lenbits},O=h(0,m.lens,0,19,m.lencode,0,m.work,z),m.lenbits=z.bits,O){M.msg="invalid code lengths set",m.mode=30;break}m.have=0,m.mode=19;case 19:for(;m.have<m.nlen+m.ndist;){for(;re=(w=m.lencode[L&(1<<m.lenbits)-1])>>>16&255,ue=65535&w,!((ie=w>>>24)<=A);){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}if(ue<16)L>>>=ie,A-=ie,m.lens[m.have++]=ue;else{if(ue===16){for(x=ie+2;A<x;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}if(L>>>=ie,A-=ie,m.have===0){M.msg="invalid bit length repeat",m.mode=30;break}c=m.lens[m.have-1],Y=3+(3&L),L>>>=2,A-=2}else if(ue===17){for(x=ie+3;A<x;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}A-=ie,c=0,Y=3+(7&(L>>>=ie)),L>>>=3,A-=3}else{for(x=ie+7;A<x;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}A-=ie,c=0,Y=11+(127&(L>>>=ie)),L>>>=7,A-=7}if(m.have+Y>m.nlen+m.ndist){M.msg="invalid bit length repeat",m.mode=30;break}for(;Y--;)m.lens[m.have++]=c}}if(m.mode===30)break;if(m.lens[256]===0){M.msg="invalid code -- missing end-of-block",m.mode=30;break}if(m.lenbits=9,z={bits:m.lenbits},O=h(u,m.lens,0,m.nlen,m.lencode,0,m.work,z),m.lenbits=z.bits,O){M.msg="invalid literal/lengths set",m.mode=30;break}if(m.distbits=6,m.distcode=m.distdyn,z={bits:m.distbits},O=h(f,m.lens,m.nlen,m.ndist,m.distcode,0,m.work,z),m.distbits=z.bits,O){M.msg="invalid distances set",m.mode=30;break}if(m.mode=20,R===6)break e;case 20:m.mode=21;case 21:if(6<=G&&258<=Q){M.next_out=te,M.avail_out=Q,M.next_in=V,M.avail_in=G,m.hold=L,m.bits=A,a(M,X),te=M.next_out,ee=M.output,Q=M.avail_out,V=M.next_in,N=M.input,G=M.avail_in,L=m.hold,A=m.bits,m.mode===12&&(m.back=-1);break}for(m.back=0;re=(w=m.lencode[L&(1<<m.lenbits)-1])>>>16&255,ue=65535&w,!((ie=w>>>24)<=A);){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}if(re&&(240&re)==0){for(le=ie,be=re,ge=ue;re=(w=m.lencode[ge+((L&(1<<le+be)-1)>>le)])>>>16&255,ue=65535&w,!(le+(ie=w>>>24)<=A);){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}L>>>=le,A-=le,m.back+=le}if(L>>>=ie,A-=ie,m.back+=ie,m.length=ue,re===0){m.mode=26;break}if(32&re){m.back=-1,m.mode=12;break}if(64&re){M.msg="invalid literal/length code",m.mode=30;break}m.extra=15&re,m.mode=22;case 22:if(m.extra){for(x=m.extra;A<x;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}m.length+=L&(1<<m.extra)-1,L>>>=m.extra,A-=m.extra,m.back+=m.extra}m.was=m.length,m.mode=23;case 23:for(;re=(w=m.distcode[L&(1<<m.distbits)-1])>>>16&255,ue=65535&w,!((ie=w>>>24)<=A);){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}if((240&re)==0){for(le=ie,be=re,ge=ue;re=(w=m.distcode[ge+((L&(1<<le+be)-1)>>le)])>>>16&255,ue=65535&w,!(le+(ie=w>>>24)<=A);){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}L>>>=le,A-=le,m.back+=le}if(L>>>=ie,A-=ie,m.back+=ie,64&re){M.msg="invalid distance code",m.mode=30;break}m.offset=ue,m.extra=15&re,m.mode=24;case 24:if(m.extra){for(x=m.extra;A<x;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}m.offset+=L&(1<<m.extra)-1,L>>>=m.extra,A-=m.extra,m.back+=m.extra}if(m.offset>m.dmax){M.msg="invalid distance too far back",m.mode=30;break}m.mode=25;case 25:if(Q===0)break e;if(Y=X-Q,m.offset>Y){if((Y=m.offset-Y)>m.whave&&m.sane){M.msg="invalid distance too far back",m.mode=30;break}ae=Y>m.wnext?(Y-=m.wnext,m.wsize-Y):m.wnext-Y,Y>m.length&&(Y=m.length),fe=m.window}else fe=ee,ae=te-m.offset,Y=m.length;for(Q<Y&&(Y=Q),Q-=Y,m.length-=Y;ee[te++]=fe[ae++],--Y;);m.length===0&&(m.mode=21);break;case 26:if(Q===0)break e;ee[te++]=m.length,Q--,m.mode=21;break;case 27:if(m.wrap){for(;A<32;){if(G===0)break e;G--,L|=N[V++]<<A,A+=8}if(X-=Q,M.total_out+=X,m.total+=X,X&&(M.adler=m.check=m.flags?o(m.check,ee,X,te-X):s(m.check,ee,X,te-X)),X=Q,(m.flags?L:y(L))!==m.check){M.msg="incorrect data check",m.mode=30;break}A=L=0}m.mode=28;case 28:if(m.wrap&&m.flags){for(;A<32;){if(G===0)break e;G--,L+=N[V++]<<A,A+=8}if(L!==(4294967295&m.total)){M.msg="incorrect length check",m.mode=30;break}A=L=0}m.mode=29;case 29:O=1;break e;case 30:O=-3;break e;case 31:return-4;case 32:default:return d}return M.next_out=te,M.avail_out=Q,M.next_in=V,M.avail_in=G,m.hold=L,m.bits=A,(m.wsize||X!==M.avail_out&&m.mode<30&&(m.mode<27||R!==4))&&q(M,M.output,M.next_out,X-M.avail_out)?(m.mode=31,-4):(J-=M.avail_in,X-=M.avail_out,M.total_in+=J,M.total_out+=X,m.total+=X,m.wrap&&X&&(M.adler=m.check=m.flags?o(m.check,ee,X,M.next_out-X):s(m.check,ee,X,M.next_out-X)),M.data_type=m.bits+(m.last?64:0)+(m.mode===12?128:0)+(m.mode===20||m.mode===15?256:0),(J==0&&X===0||R===4)&&O===g&&(O=-5),O)},n.inflateEnd=function(M){if(!M||!M.state)return d;var R=M.state;return R.window&&(R.window=null),M.state=null,g},n.inflateGetHeader=function(M,R){var m;return M&&M.state?(2&(m=M.state).wrap)==0?d:((m.head=R).done=!1,g):d},n.inflateSetDictionary=function(M,R){var m,N=R.length;return M&&M.state?(m=M.state).wrap!==0&&m.mode!==11?d:m.mode===11&&s(1,R,N,0)!==m.check?-3:q(M,R,N,N)?(m.mode=31,-4):(m.havedict=1,g):d},n.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,i,n){var r=t("../utils/common"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],a=[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],h=[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(u,f,g,d,b,l,p,y){var v,_,S,E,D,P,F,B,H,q=y.bits,M=0,R=0,m=0,N=0,ee=0,V=0,te=0,G=0,Q=0,L=0,A=null,J=0,X=new r.Buf16(16),Y=new r.Buf16(16),ae=null,fe=0;for(M=0;M<=15;M++)X[M]=0;for(R=0;R<d;R++)X[f[g+R]]++;for(ee=q,N=15;1<=N&&X[N]===0;N--);if(N<ee&&(ee=N),N===0)return b[l++]=20971520,b[l++]=20971520,y.bits=1,0;for(m=1;m<N&&X[m]===0;m++);for(ee<m&&(ee=m),M=G=1;M<=15;M++)if(G<<=1,(G-=X[M])<0)return-1;if(0<G&&(u===0||N!==1))return-1;for(Y[1]=0,M=1;M<15;M++)Y[M+1]=Y[M]+X[M];for(R=0;R<d;R++)f[g+R]!==0&&(p[Y[f[g+R]]++]=R);if(P=u===0?(A=ae=p,19):u===1?(A=s,J-=257,ae=o,fe-=257,256):(A=a,ae=h,-1),M=m,D=l,te=R=L=0,S=-1,E=(Q=1<<(V=ee))-1,u===1&&852<Q||u===2&&592<Q)return 1;for(;;){for(F=M-te,H=p[R]<P?(B=0,p[R]):p[R]>P?(B=ae[fe+p[R]],A[J+p[R]]):(B=96,0),v=1<<M-te,m=_=1<<V;b[D+(L>>te)+(_-=v)]=F<<24|B<<16|H|0,_!==0;);for(v=1<<M-1;L&v;)v>>=1;if(v!==0?(L&=v-1,L+=v):L=0,R++,--X[M]==0){if(M===N)break;M=f[g+p[R]]}if(ee<M&&(L&E)!==S){for(te===0&&(te=ee),D+=m,G=1<<(V=M-te);V+te<N&&!((G-=X[V+te])<=0);)V++,G<<=1;if(Q+=1<<V,u===1&&852<Q||u===2&&592<Q)return 1;b[S=L&E]=ee<<24|V<<16|D-l|0}}return L!==0&&(b[D+L]=M-te<<24|64<<16|0),y.bits=ee,0}},{"../utils/common":41}],51:[function(t,i,n){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(t,i,n){var r=t("../utils/common"),s=0,o=1;function a(w){for(var I=w.length;0<=--I;)w[I]=0}var h=0,u=29,f=256,g=f+1+u,d=30,b=19,l=2*g+1,p=15,y=16,v=7,_=256,S=16,E=17,D=18,P=[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],F=[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],B=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],q=new Array(2*(g+2));a(q);var M=new Array(2*d);a(M);var R=new Array(512);a(R);var m=new Array(256);a(m);var N=new Array(u);a(N);var ee,V,te,G=new Array(d);function Q(w,I,j,U,T){this.static_tree=w,this.extra_bits=I,this.extra_base=j,this.elems=U,this.max_length=T,this.has_stree=w&&w.length}function L(w,I){this.dyn_tree=w,this.max_code=0,this.stat_desc=I}function A(w){return w<256?R[w]:R[256+(w>>>7)]}function J(w,I){w.pending_buf[w.pending++]=255&I,w.pending_buf[w.pending++]=I>>>8&255}function X(w,I,j){w.bi_valid>y-j?(w.bi_buf|=I<<w.bi_valid&65535,J(w,w.bi_buf),w.bi_buf=I>>y-w.bi_valid,w.bi_valid+=j-y):(w.bi_buf|=I<<w.bi_valid&65535,w.bi_valid+=j)}function Y(w,I,j){X(w,j[2*I],j[2*I+1])}function ae(w,I){for(var j=0;j|=1&w,w>>>=1,j<<=1,0<--I;);return j>>>1}function fe(w,I,j){var U,T,W=new Array(p+1),$=0;for(U=1;U<=p;U++)W[U]=$=$+j[U-1]<<1;for(T=0;T<=I;T++){var Z=w[2*T+1];Z!==0&&(w[2*T]=ae(W[Z]++,Z))}}function ie(w){var I;for(I=0;I<g;I++)w.dyn_ltree[2*I]=0;for(I=0;I<d;I++)w.dyn_dtree[2*I]=0;for(I=0;I<b;I++)w.bl_tree[2*I]=0;w.dyn_ltree[2*_]=1,w.opt_len=w.static_len=0,w.last_lit=w.matches=0}function re(w){8<w.bi_valid?J(w,w.bi_buf):0<w.bi_valid&&(w.pending_buf[w.pending++]=w.bi_buf),w.bi_buf=0,w.bi_valid=0}function ue(w,I,j,U){var T=2*I,W=2*j;return w[T]<w[W]||w[T]===w[W]&&U[I]<=U[j]}function le(w,I,j){for(var U=w.heap[j],T=j<<1;T<=w.heap_len&&(T<w.heap_len&&ue(I,w.heap[T+1],w.heap[T],w.depth)&&T++,!ue(I,U,w.heap[T],w.depth));)w.heap[j]=w.heap[T],j=T,T<<=1;w.heap[j]=U}function be(w,I,j){var U,T,W,$,Z=0;if(w.last_lit!==0)for(;U=w.pending_buf[w.d_buf+2*Z]<<8|w.pending_buf[w.d_buf+2*Z+1],T=w.pending_buf[w.l_buf+Z],Z++,U===0?Y(w,T,I):(Y(w,(W=m[T])+f+1,I),($=P[W])!==0&&X(w,T-=N[W],$),Y(w,W=A(--U),j),($=F[W])!==0&&X(w,U-=G[W],$)),Z<w.last_lit;);Y(w,_,I)}function ge(w,I){var j,U,T,W=I.dyn_tree,$=I.stat_desc.static_tree,Z=I.stat_desc.has_stree,K=I.stat_desc.elems,se=-1;for(w.heap_len=0,w.heap_max=l,j=0;j<K;j++)W[2*j]!==0?(w.heap[++w.heap_len]=se=j,w.depth[j]=0):W[2*j+1]=0;for(;w.heap_len<2;)W[2*(T=w.heap[++w.heap_len]=se<2?++se:0)]=1,w.depth[T]=0,w.opt_len--,Z&&(w.static_len-=$[2*T+1]);for(I.max_code=se,j=w.heap_len>>1;1<=j;j--)le(w,W,j);for(T=K;j=w.heap[1],w.heap[1]=w.heap[w.heap_len--],le(w,W,1),U=w.heap[1],w.heap[--w.heap_max]=j,w.heap[--w.heap_max]=U,W[2*T]=W[2*j]+W[2*U],w.depth[T]=(w.depth[j]>=w.depth[U]?w.depth[j]:w.depth[U])+1,W[2*j+1]=W[2*U+1]=T,w.heap[1]=T++,le(w,W,1),2<=w.heap_len;);w.heap[--w.heap_max]=w.heap[1],(function(ne,me){var ke,ve,Ce,he,Ae,Be,we=me.dyn_tree,Ke=me.max_code,ei=me.stat_desc.static_tree,ti=me.stat_desc.has_stree,ii=me.stat_desc.extra_bits,qe=me.stat_desc.extra_base,Ee=me.stat_desc.max_length,Le=0;for(he=0;he<=p;he++)ne.bl_count[he]=0;for(we[2*ne.heap[ne.heap_max]+1]=0,ke=ne.heap_max+1;ke<l;ke++)Ee<(he=we[2*we[2*(ve=ne.heap[ke])+1]+1]+1)&&(he=Ee,Le++),we[2*ve+1]=he,Ke<ve||(ne.bl_count[he]++,Ae=0,qe<=ve&&(Ae=ii[ve-qe]),Be=we[2*ve],ne.opt_len+=Be*(he+Ae),ti&&(ne.static_len+=Be*(ei[2*ve+1]+Ae)));if(Le!==0){do{for(he=Ee-1;ne.bl_count[he]===0;)he--;ne.bl_count[he]--,ne.bl_count[he+1]+=2,ne.bl_count[Ee]--,Le-=2}while(0<Le);for(he=Ee;he!==0;he--)for(ve=ne.bl_count[he];ve!==0;)Ke<(Ce=ne.heap[--ke])||(we[2*Ce+1]!==he&&(ne.opt_len+=(he-we[2*Ce+1])*we[2*Ce],we[2*Ce+1]=he),ve--)}})(w,I),fe(W,se,w.bl_count)}function c(w,I,j){var U,T,W=-1,$=I[1],Z=0,K=7,se=4;for($===0&&(K=138,se=3),I[2*(j+1)+1]=65535,U=0;U<=j;U++)T=$,$=I[2*(U+1)+1],++Z<K&&T===$||(Z<se?w.bl_tree[2*T]+=Z:T!==0?(T!==W&&w.bl_tree[2*T]++,w.bl_tree[2*S]++):Z<=10?w.bl_tree[2*E]++:w.bl_tree[2*D]++,W=T,se=(Z=0)===$?(K=138,3):T===$?(K=6,3):(K=7,4))}function O(w,I,j){var U,T,W=-1,$=I[1],Z=0,K=7,se=4;for($===0&&(K=138,se=3),U=0;U<=j;U++)if(T=$,$=I[2*(U+1)+1],!(++Z<K&&T===$)){if(Z<se)for(;Y(w,T,w.bl_tree),--Z!=0;);else T!==0?(T!==W&&(Y(w,T,w.bl_tree),Z--),Y(w,S,w.bl_tree),X(w,Z-3,2)):Z<=10?(Y(w,E,w.bl_tree),X(w,Z-3,3)):(Y(w,D,w.bl_tree),X(w,Z-11,7));W=T,se=(Z=0)===$?(K=138,3):T===$?(K=6,3):(K=7,4)}}a(G);var z=!1;function x(w,I,j,U){X(w,(h<<1)+(U?1:0),3),(function(T,W,$,Z){re(T),J(T,$),J(T,~$),r.arraySet(T.pending_buf,T.window,W,$,T.pending),T.pending+=$})(w,I,j)}n._tr_init=function(w){z||((function(){var I,j,U,T,W,$=new Array(p+1);for(T=U=0;T<u-1;T++)for(N[T]=U,I=0;I<1<<P[T];I++)m[U++]=T;for(m[U-1]=T,T=W=0;T<16;T++)for(G[T]=W,I=0;I<1<<F[T];I++)R[W++]=T;for(W>>=7;T<d;T++)for(G[T]=W<<7,I=0;I<1<<F[T]-7;I++)R[256+W++]=T;for(j=0;j<=p;j++)$[j]=0;for(I=0;I<=143;)q[2*I+1]=8,I++,$[8]++;for(;I<=255;)q[2*I+1]=9,I++,$[9]++;for(;I<=279;)q[2*I+1]=7,I++,$[7]++;for(;I<=287;)q[2*I+1]=8,I++,$[8]++;for(fe(q,g+1,$),I=0;I<d;I++)M[2*I+1]=5,M[2*I]=ae(I,5);ee=new Q(q,P,f+1,g,p),V=new Q(M,F,0,d,p),te=new Q(new Array(0),B,0,b,v)})(),z=!0),w.l_desc=new L(w.dyn_ltree,ee),w.d_desc=new L(w.dyn_dtree,V),w.bl_desc=new L(w.bl_tree,te),w.bi_buf=0,w.bi_valid=0,ie(w)},n._tr_stored_block=x,n._tr_flush_block=function(w,I,j,U){var T,W,$=0;0<w.level?(w.strm.data_type===2&&(w.strm.data_type=(function(Z){var K,se=4093624447;for(K=0;K<=31;K++,se>>>=1)if(1&se&&Z.dyn_ltree[2*K]!==0)return s;if(Z.dyn_ltree[18]!==0||Z.dyn_ltree[20]!==0||Z.dyn_ltree[26]!==0)return o;for(K=32;K<f;K++)if(Z.dyn_ltree[2*K]!==0)return o;return s})(w)),ge(w,w.l_desc),ge(w,w.d_desc),$=(function(Z){var K;for(c(Z,Z.dyn_ltree,Z.l_desc.max_code),c(Z,Z.dyn_dtree,Z.d_desc.max_code),ge(Z,Z.bl_desc),K=b-1;3<=K&&Z.bl_tree[2*H[K]+1]===0;K--);return Z.opt_len+=3*(K+1)+5+5+4,K})(w),T=w.opt_len+3+7>>>3,(W=w.static_len+3+7>>>3)<=T&&(T=W)):T=W=j+5,j+4<=T&&I!==-1?x(w,I,j,U):w.strategy===4||W===T?(X(w,2+(U?1:0),3),be(w,q,M)):(X(w,4+(U?1:0),3),(function(Z,K,se,ne){var me;for(X(Z,K-257,5),X(Z,se-1,5),X(Z,ne-4,4),me=0;me<ne;me++)X(Z,Z.bl_tree[2*H[me]+1],3);O(Z,Z.dyn_ltree,K-1),O(Z,Z.dyn_dtree,se-1)})(w,w.l_desc.max_code+1,w.d_desc.max_code+1,$+1),be(w,w.dyn_ltree,w.dyn_dtree)),ie(w),U&&re(w)},n._tr_tally=function(w,I,j){return w.pending_buf[w.d_buf+2*w.last_lit]=I>>>8&255,w.pending_buf[w.d_buf+2*w.last_lit+1]=255&I,w.pending_buf[w.l_buf+w.last_lit]=255&j,w.last_lit++,I===0?w.dyn_ltree[2*j]++:(w.matches++,I--,w.dyn_ltree[2*(m[j]+f+1)]++,w.dyn_dtree[2*A(I)]++),w.last_lit===w.lit_bufsize-1},n._tr_align=function(w){X(w,2,3),Y(w,_,q),(function(I){I.bi_valid===16?(J(I,I.bi_buf),I.bi_buf=0,I.bi_valid=0):8<=I.bi_valid&&(I.pending_buf[I.pending++]=255&I.bi_buf,I.bi_buf>>=8,I.bi_valid-=8)})(w)}},{"../utils/common":41}],53:[function(t,i,n){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(t,i,n){(function(r){(function(s,o){if(!s.setImmediate){var a,h,u,f,g=1,d={},b=!1,l=s.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(s);p=p&&p.setTimeout?p:s,a={}.toString.call(s.process)==="[object process]"?function(S){process.nextTick(function(){v(S)})}:(function(){if(s.postMessage&&!s.importScripts){var S=!0,E=s.onmessage;return s.onmessage=function(){S=!1},s.postMessage("","*"),s.onmessage=E,S}})()?(f="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",_,!1):s.attachEvent("onmessage",_),function(S){s.postMessage(f+S,"*")}):s.MessageChannel?((u=new MessageChannel).port1.onmessage=function(S){v(S.data)},function(S){u.port2.postMessage(S)}):l&&"onreadystatechange"in l.createElement("script")?(h=l.documentElement,function(S){var E=l.createElement("script");E.onreadystatechange=function(){v(S),E.onreadystatechange=null,h.removeChild(E),E=null},h.appendChild(E)}):function(S){setTimeout(v,0,S)},p.setImmediate=function(S){typeof S!="function"&&(S=new Function(""+S));for(var E=new Array(arguments.length-1),D=0;D<E.length;D++)E[D]=arguments[D+1];var P={callback:S,args:E};return d[g]=P,a(g),g++},p.clearImmediate=y}function y(S){delete d[S]}function v(S){if(b)setTimeout(v,0,S);else{var E=d[S];if(E){b=!0;try{(function(D){var P=D.callback,F=D.args;switch(F.length){case 0:P();break;case 1:P(F[0]);break;case 2:P(F[0],F[1]);break;case 3:P(F[0],F[1],F[2]);break;default:P.apply(o,F)}})(E)}finally{y(S),b=!1}}}}function _(S){S.source===s&&typeof S.data=="string"&&S.data.indexOf(f)===0&&v(+S.data.slice(f.length))}})(typeof self>"u"?r===void 0?this:r:self)}).call(this,typeof Se<"u"?Se:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Pe)),Pe.exports}var _t=xt();const Mt=De(_t);class kt{zipObjectUrls=[];async load(e){return this.clearZipObjectUrls(),this.loadZipData(e)}async fetchJson(e){const t=await fetch(e);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.json()}async loadSplitData(e,t,i=r=>this.fetchJson(r),n=(r,s)=>Promise.resolve(this.resolveImageUrl(r,s))){const[r,s,o,a]=await Promise.all([i(this.joinUrl(e,t.metadataUrl??"metadata.json")),i(this.joinUrl(e,t.layersUrl??"layers.json")),this.loadBlocks(e,t.blocksUrl??"blocks/index.json",i),this.loadTiles(e,t.root,i)]);await this.resolveBlockAssets(o,e,n);const h=[];return a.forEach(u=>{u.inserts.forEach(f=>h.push(f))}),{version:t.version??"1.0",metadata:r,layers:s,blocks:o,entities:h,octree:t.root,tiles:a}}async loadBlocks(e,t,i){const r=(await i(this.joinUrl(e,t))).parts??[],s=await Promise.all(r.map(a=>this.loadBlockPart(this.joinUrl(e,a),i))),o=[];return s.forEach(a=>{(Array.isArray(a?.blocks)?a.blocks:[]).forEach(u=>o.push(u))}),o}async loadBlockPart(e,t){try{return await t(e)}catch(i){const n=i instanceof Error?i.message:String(i);return console.warn(`[LoaderModule2d] Skip missing block json: ${e}`,n),{blocks:[]}}}async resolveBlockAssets(e,t,i){await Promise.all(e.map(async n=>{const r=Array.isArray(n?.entities)?n.entities:[];await Promise.all(r.map(async s=>{String(s?.type).toUpperCase()==="IMAGE"&&(s.imageUrl=await i(s,t))}))}))}resolveImageUrl(e,t){const i=e.localPath||e.sourcePath||e.path||e.url||"";if(/^(https?:)?\/\//i.test(i)||i.startsWith("/"))return i;const r=String(i).replace(/\\/g,"/").split("/").filter(Boolean).pop();return r?this.joinUrl(t,r):""}async loadTiles(e,t,i){const n=this.collectTileNodes(t);return await Promise.all(n.map(async s=>{const o=s.tileUrl??"",a=await i(this.joinUrl(e,o)),h=this.normalizeTileInserts(a.inserts??[]);return s.elements=h.map(u=>u.linkId??u.id).filter(u=>u!=null),{id:s.id??a.id??o,url:o,node:s,inserts:h}}))}normalizeTileInserts(e){return e.map(t=>({...t,linkId:t.linkId??t.id,type:"INSERT",color:t.color??0,visible:t.visible??!0}))}collectTileNodes(e){if(!e)return[];const t=[],i=[e];for(;i.length>0;){const n=i.pop();if(!n)continue;n.tileUrl&&t.push(n);const r=n.children??[];for(let s=r.length-1;s>=0;s-=1)i.push(r[s])}return t}async loadZipData(e){const t=await fetch(e);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const i=await Mt.loadAsync(await t.arrayBuffer()),n=this.findZipManifestPath(i),r=await this.fetchZipJson(i,n);if(!this.isSplitManifest(r))throw new Error("[LoaderModule2d] Expected split CAD manifest data in .2d package.");const s=this.getZipBasePath(n);return this.loadSplitData(s,r,o=>this.fetchZipJson(i,o),(o,a)=>this.resolveZipImageUrl(i,o,a))}findZipManifestPath(e){const t=Object.keys(e.files).filter(r=>!e.files[r].dir),n=t.find(r=>this.normalizeZipPath(r).toLowerCase()==="manifest.json")??t.find(r=>this.normalizeZipPath(r).toLowerCase().endsWith("/manifest.json"));if(!n)throw new Error("[LoaderModule2d] Missing manifest.json in .2d package.");return this.normalizeZipPath(n)}async fetchZipJson(e,t){if(/^(https?:)?\/\//i.test(t))return this.fetchJson(t);const i=this.getZipFile(e,t);if(!i)throw new Error(`[LoaderModule2d] Missing file in .2d package: ${t}`);return JSON.parse(await i.async("string"))}async resolveZipImageUrl(e,t,i){const n=t.localPath||t.sourcePath||t.path||t.url||"";if(/^(https?:)?\/\//i.test(n)||String(n).startsWith("blob:"))return n;const r=this.normalizeZipPath(String(n)),s=r.split("/").filter(Boolean).pop(),a=[this.joinUrl(i,r),s?this.joinUrl(i,s):"",r,s??""].filter(Boolean).map(u=>this.getZipFile(e,u)).find(u=>!!u);if(!a)return"";const h=URL.createObjectURL(new Blob([await a.async("arraybuffer")]));return this.zipObjectUrls.push(h),h}isSplitManifest(e){return!!e&&typeof e=="object"&&(e.splitType==="octree-2d"||!!e.blocksUrl)}is2dZipUrl(e){return/\.2d($|[?#])/i.test(e)}isManifestUrl(e){return/manifest\.json($|\?)/i.test(e)}getBaseUrl(e){const t=e.split("?")[0];return t.slice(0,t.lastIndexOf("/")+1)}getZipBasePath(e){const t=this.normalizeZipPath(e),i=t.lastIndexOf("/");return i>=0?t.slice(0,i+1):""}normalizeDirectoryUrl(e){return e.endsWith("/")?e:`${e}/`}joinUrl(e,t){return/^(https?:)?\/\//i.test(t)||t.startsWith("/")?t:`${e}${t}`.replace(/([^:]\/)\/+/g,"$1")}normalizeZipPath(e){return String(e).split("?")[0].split("#")[0].replace(/\\/g,"/").replace(/^\/+/,"")}getZipFile(e,t){const i=this.normalizeZipPath(t),n=e.file(i);if(n)return n;const r=i.toLowerCase(),s=Object.keys(e.files).find(o=>this.normalizeZipPath(o).toLowerCase()===r);return s?e.file(s):null}clearZipObjectUrls(){this.zipObjectUrls.forEach(e=>URL.revokeObjectURL(e)),this.zipObjectUrls=[]}}function Fe(C,e,t){const i=t.length-C-1;if(e>=t[i])return i-1;if(e<=t[C])return C;let n=C,r=i,s=Math.floor((n+r)/2);for(;e<t[s]||e>=t[s+1];)e<t[s]?r=s:n=s,s=Math.floor((n+r)/2);return s}function Ct(C,e,t,i){const n=[],r=[],s=[];n[0]=1;for(let o=1;o<=t;++o){r[o]=e-i[C+1-o],s[o]=i[C+o]-e;let a=0;for(let h=0;h<o;++h){const u=s[h+1],f=r[o-h],g=n[h]/(u+f);n[h]=a+u*g,a=f*g}n[o]=a}return n}function Et(C,e,t,i){const n=Fe(C,i,e),r=Ct(n,i,C,e),s=new de.Vector4(0,0,0,0);for(let o=0;o<=C;++o){const a=t[n-C+o],h=r[o],u=a.w*h;s.x+=a.x*u,s.y+=a.y*u,s.z+=a.z*u,s.w+=a.w*h}return s}function St(C,e,t,i,n){const r=[];for(let f=0;f<=t;++f)r[f]=0;const s=[];for(let f=0;f<=i;++f)s[f]=r.slice(0);const o=[];for(let f=0;f<=t;++f)o[f]=r.slice(0);o[0][0]=1;const a=r.slice(0),h=r.slice(0);for(let f=1;f<=t;++f){a[f]=e-n[C+1-f],h[f]=n[C+f]-e;let g=0;for(let d=0;d<f;++d){const b=h[d+1],l=a[f-d];o[f][d]=b+l;const p=o[d][f-1]/o[f][d];o[d][f]=g+b*p,g=l*p}o[f][f]=g}for(let f=0;f<=t;++f)s[0][f]=o[f][t];for(let f=0;f<=t;++f){let g=0,d=1;const b=[];for(let l=0;l<=t;++l)b[l]=r.slice(0);b[0][0]=1;for(let l=1;l<=i;++l){let p=0;const y=f-l,v=t-l;f>=l&&(b[d][0]=b[g][0]/o[v+1][y],p=b[d][0]*o[y][v]);const _=y>=-1?1:-y,S=f-1<=v?l-1:t-f;for(let D=_;D<=S;++D)b[d][D]=(b[g][D]-b[g][D-1])/o[v+1][y+D],p+=b[d][D]*o[y+D][v];f<=v&&(b[d][l]=-b[g][l-1]/o[v+1][f],p+=b[d][l]*o[f][v]),s[l][f]=p;const E=g;g=d,d=E}}let u=t;for(let f=1;f<=i;++f){for(let g=0;g<=t;++g)s[f][g]*=u;u*=t-f}return s}function It(C,e,t,i,n){const r=n<C?n:C,s=[],o=Fe(C,i,e),a=St(o,i,C,r,e),h=[];for(let u=0;u<t.length;++u){const f=t[u].clone(),g=f.w;f.x*=g,f.y*=g,f.z*=g,h[u]=f}for(let u=0;u<=r;++u){const f=h[o-C].clone().multiplyScalar(a[u][0]);for(let g=1;g<=C;++g)f.add(h[o-C+g].clone().multiplyScalar(a[u][g]));s[u]=f}for(let u=r+1;u<=n+1;++u)s[u]=new de.Vector4(0,0,0);return s}function Tt(C,e){let t=1;for(let n=2;n<=C;++n)t*=n;let i=1;for(let n=2;n<=e;++n)i*=n;for(let n=2;n<=C-e;++n)i*=n;return t/i}function At(C){const e=C.length,t=[],i=[];for(let r=0;r<e;++r){const s=C[r];t[r]=new de.Vector3(s.x,s.y,s.z),i[r]=s.w}const n=[];for(let r=0;r<e;++r){const s=t[r].clone();for(let o=1;o<=r;++o)s.sub(n[r-o].clone().multiplyScalar(Tt(r,o)*i[o]));n[r]=s.divideScalar(i[0])}return n}function Lt(C,e,t,i,n){const r=It(C,e,t,i,n);return At(r)}class zt extends de.Curve{constructor(e,t,i,n,r){super();const s=t?t.length-1:0,o=i?i.length:0;this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=n||0,this.endKnot=r||s;for(let a=0;a<o;++a){const h=i[a];this.controlPoints[a]=new de.Vector4(h.x,h.y,h.z,h.w)}}getPoint(e,t=new de.Vector3){const i=t,n=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),r=Et(this.degree,this.knots,this.controlPoints,n);return r.w!==1&&r.divideScalar(r.w),i.set(r.x,r.y,r.z)}getTangent(e,t=new de.Vector3){const i=t,n=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),r=Lt(this.degree,this.knots,this.controlPoints,n,1);return i.copy(r[1]).normalize(),i}toJSON(){const e=super.toJSON();return e.degree=this.degree,e.knots=[...this.knots],e.controlPoints=this.controlPoints.map(t=>t.toArray()),e.startKnot=this.startKnot,e.endKnot=this.endKnot,e}fromJSON(e){return super.fromJSON(e),this.degree=e.degree,this.knots=[...e.knots],this.controlPoints=e.controlPoints.map(t=>new de.Vector4(t[0],t[1],t[2],t[3])),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this}}function Me(C,e=!1){const t=C[0].index!==null,i=new Set(Object.keys(C[0].attributes)),n=new Set(Object.keys(C[0].morphAttributes)),r={},s={},o=C[0].morphTargetsRelative,a=new de.BufferGeometry;let h=0;for(let u=0;u<C.length;++u){const f=C[u];let g=0;if(t!==(f.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const d in f.attributes){if(!i.has(d))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;r[d]===void 0&&(r[d]=[]),r[d].push(f.attributes[d]),g++}if(g!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(o!==f.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const d in f.morphAttributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;s[d]===void 0&&(s[d]=[]),s[d].push(f.morphAttributes[d])}if(e){let d;if(t)d=f.index.count;else if(f.attributes.position!==void 0)d=f.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;a.addGroup(h,d,u),h+=d}}if(t){let u=0;const f=[];for(let g=0;g<C.length;++g){const d=C[g].index;for(let b=0;b<d.count;++b)f.push(d.getX(b)+u);u+=C[g].attributes.position.count}a.setIndex(f)}for(const u in r){const f=Ve(r[u]);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;a.setAttribute(u,f)}for(const u in s){const f=s[u][0].length;if(f===0)break;a.morphAttributes=a.morphAttributes||{},a.morphAttributes[u]=[];for(let g=0;g<f;++g){const d=[];for(let l=0;l<s[u].length;++l)d.push(s[u][l][g]);const b=Ve(d);if(!b)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;a.morphAttributes[u].push(b)}}return a}function Ve(C){let e,t,i,n=-1,r=0;for(let h=0;h<C.length;++h){const u=C[h];if(e===void 0&&(e=u.array.constructor),e!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=u.itemSize),t!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=u.normalized),i!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(n===-1&&(n=u.gpuType),n!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;r+=u.count*t}const s=new e(r),o=new de.BufferAttribute(s,t,i);let a=0;for(let h=0;h<C.length;++h){const u=C[h];if(u.isInterleavedBufferAttribute){const f=a/t;for(let g=0,d=u.count;g<d;g++)for(let b=0;b<t;b++){const l=u.getComponent(g,b);o.setComponent(g+f,b,l)}}else s.set(u.array,a);a+=u.count*t}return n!==void 0&&(o.gpuType=n),o}const oe=1e-8,Ge=.001,Pt=8421504;class Bt{constructor(e){this.engine=e}create(e,t){const i=this.getLoopSet(e);if(i.outers.length===0)return[];if(this.isGradientFill(e))return this.createGradientItems(e,t,i);if(this.isSolidFill(e))return this.createSolidItems(e,t,i);const r=this.createPatternLineItem(e,t,i);return r?[r]:(this.warnUnknownPatternFallback(e),this.createSolidItems(e,t,i,Pt))}isSolidFill(e){const t=String(e.pattern??e.patternName??"").toUpperCase();return e.solid===!0||t==="SOLID"}warnUnknownPatternFallback(e){const t=e.pattern??e.patternName??"UNKNOWN";this.engine.options?.debugHatch===!0&&console.warn(`[LoaderModule2d] HATCH pattern "${t}" cannot be rendered, use gray solid fallback.`)}isGradientFill(e){return e.gradient?.enabled===!0||String(e.patternType??"").toUpperCase()==="GRADIENTFILL"}getLoopSet(e){const t=(e.loops??[]).map(s=>this.normalizeLoop(s.points)).filter(s=>s.length>=3);if(t.length===0)return{outers:[],holes:[]};const i=(e.loops??[]).filter(s=>this.normalizeLoop(s.points).length>=3);if(!i.some(s=>s.type===!1))return this.classifyLoopsByContainment(t);const n=i.filter(s=>s.type!==!1).map(s=>this.normalizeLoop(s.points)),r=i.filter(s=>s.type===!1).map(s=>this.normalizeLoop(s.points));return n.length>0?{outers:n,holes:r}:{outers:[t[0]],holes:t.slice(1)}}classifyLoopsByContainment(e){const t=[...e].sort((r,s)=>Math.abs(this.signedArea(s))-Math.abs(this.signedArea(r))),i=[],n=[];return t.forEach((r,s)=>{const o=new k.Vector2(r[0][0],r[0][1]);t.slice(0,s).filter(h=>this.pointInPolygon(o,h)).length%2===0?i.push(r):n.push(r)}),{outers:i,holes:n}}signedArea(e){let t=0;for(let i=0;i<e.length;i+=1){const n=e[i],r=e[(i+1)%e.length];t+=n[0]*r[1]-r[0]*n[1]}return t/2}normalizeLoop(e){const t=[];(e??[]).forEach(r=>{if(!Array.isArray(r)||r.length<2)return;const s=[Number(r[0]),Number(r[1])];if(!Number.isFinite(s[0])||!Number.isFinite(s[1]))return;const o=t[t.length-1];(!o||Math.hypot(s[0]-o[0],s[1]-o[1])>oe)&&t.push(s)});const i=t[0],n=t[t.length-1];return i&&n&&Math.hypot(i[0]-n[0],i[1]-n[1])<=oe&&t.pop(),t}createSolidItems(e,t,i,n){const r=[];if(i.outers.forEach(a=>{const h=this.createShape(a);i.holes.filter(u=>this.pointInPolygon(new k.Vector2(u[0][0],u[0][1]),a)).forEach(u=>{h.holes.push(this.createPath(u))}),r.push(new k.ShapeGeometry(h))}),r.length===0)return[];const s=r.length===1?r[0]:Me(r,!1);s.applyMatrix4(t);const o=_e(s);return[{kind:"hatch",layer:e.layer??"0",color:n??this.resolveEntityColor(e),linkId:e.linkId??e.id,geometry:s,min:o.min,max:o.max,info:e}]}createShape(e){const t=new k.Shape;t.moveTo(e[0][0],e[0][1]);for(let i=1;i<e.length;i+=1)t.lineTo(e[i][0],e[i][1]);return t.closePath(),t}createPath(e){const t=new k.Path;t.moveTo(e[0][0],e[0][1]);for(let i=1;i<e.length;i+=1)t.lineTo(e[i][0],e[i][1]);return t.closePath(),t}createGradientItems(e,t,i){const n=[];if(i.outers.forEach(o=>{const a=this.createShape(o);i.holes.filter(u=>this.pointInPolygon(new k.Vector2(u[0][0],u[0][1]),o)).forEach(u=>{a.holes.push(this.createPath(u))});const h=this.subdivideTriangles(new k.ShapeGeometry(a),this.engine.options?.hatchGradientSubdivisions??3);this.applyGradientVertexColors(h,o,e.gradient),n.push(h)}),n.length===0)return[];const r=n.length===1?n[0]:Me(n,!1);r.applyMatrix4(t);const s=_e(r);return[{kind:"hatch",layer:e.layer??"0",color:this.resolveEntityColor(e),linkId:e.linkId??e.id,geometry:r,useVertexColors:!0,min:s.min,max:s.max,info:e}]}applyGradientVertexColors(e,t,i){const n=e.getAttribute("position"),r=[],s=this.resolveGradientStops(i),o=this.getBounds(t),a=new k.Vector2((o.minX+o.maxX)/2,(o.minY+o.maxY)/2),h=Math.max(o.maxX-o.minX,oe),u=Math.max(o.maxY-o.minY,oe),f=Math.max(Math.hypot(h/2,u/2),oe),g=Number(i?.angle??0),d=new k.Vector2(Math.cos(g),Math.sin(g)).normalize(),b=new k.Vector2(-d.y,d.x);for(let l=0;l<n.count;l+=1){const p=new k.Vector2(n.getX(l),n.getY(l)),y=this.resolveGradientFactor(p,a,d,b,h,u,f,i),v=this.sampleGradientColor(s,y);r.push(v.r,v.g,v.b)}e.setAttribute("color",new k.Float32BufferAttribute(r,3))}subdivideTriangles(e,t){let i=e.index?e.toNonIndexed():e.clone();const n=Math.max(0,Math.min(Math.floor(Number(t)||0),5));for(let r=0;r<n;r+=1){const s=i.getAttribute("position"),o=[];for(let a=0;a<s.count;a+=3){const h=new k.Vector3(s.getX(a),s.getY(a),s.getZ(a)),u=new k.Vector3(s.getX(a+1),s.getY(a+1),s.getZ(a+1)),f=new k.Vector3(s.getX(a+2),s.getY(a+2),s.getZ(a+2)),g=h.clone().lerp(u,.5),d=u.clone().lerp(f,.5),b=f.clone().lerp(h,.5);this.pushTriangle(o,h,g,b),this.pushTriangle(o,g,u,d),this.pushTriangle(o,b,d,f),this.pushTriangle(o,g,d,b)}i=new k.BufferGeometry().setAttribute("position",new k.Float32BufferAttribute(o,3))}return i}pushTriangle(e,t,i,n){e.push(t.x,t.y,t.z,i.x,i.y,i.z,n.x,n.y,n.z)}resolveGradientFactor(e,t,i,n,r,s,o,a){const h=e.clone().sub(t),u=String(a?.name??"LINEAR").toUpperCase(),f=Number(a?.shift??0),g=Math.max(Math.abs(i.x)*r+Math.abs(i.y)*s,oe),d=Math.max(Math.abs(n.x)*r+Math.abs(n.y)*s,oe);let b=.5+h.dot(i)/g+f;return u.includes("CYLINDER")?b=Math.abs(h.dot(n))/(d/2):u.includes("SPHERICAL")?(b=h.length()/o,u.includes("HEMI")&&(b=Math.sqrt(b))):u.includes("CURVED")&&(b=Math.pow(Math.abs(h.dot(i))/(g/2),.65)),u.startsWith("INV")&&(b=1-b),k.MathUtils.clamp(b,0,1)}resolveGradientStops(e){const t=(e?.colors??[]).map(i=>({value:k.MathUtils.clamp(Number(i.value??0),0,1),color:this.resolveGradientStopColor(i)})).sort((i,n)=>i.value-n.value);if(t.length>=2)return t;if(t.length===1){const i=k.MathUtils.clamp(Number(e?.colorTint??0),0,1);return[{value:0,color:t[0].color.clone().lerp(new k.Color(16777215),i)},{value:1,color:t[0].color}]}return[{value:0,color:new k.Color(16777215)},{value:1,color:new k.Color(0)}]}resolveGradientStopColor(e){if(Array.isArray(e.rgb)&&e.rgb.length>=3){const[t,i,n]=e.rgb.map(r=>k.MathUtils.clamp(Number(r??0),0,255)/255);return new k.Color(t,i,n)}return new k.Color(e.color??16777215)}resolveEntityColor(e){if(Array.isArray(e.rgb)&&e.rgb.length>=3){const[t,i,n]=e.rgb.map(r=>Math.round(k.MathUtils.clamp(Number(r??0),0,255)));return t<<16|i<<8|n}return e.color??16777215}sampleGradientColor(e,t){if(t<=e[0].value)return e[0].color.clone();for(let i=0;i<e.length-1;i+=1){const n=e[i],r=e[i+1];if(t<=r.value+oe){const s=Math.max(r.value-n.value,oe);return n.color.clone().lerp(r.color,(t-n.value)/s)}}return e[e.length-1].color.clone()}createPatternLineItem(e,t,i){const n=[],r=this.engine.options?.hatchPatternMaxSegments??2e4;let s=0;for(const a of i.outers){const h=this.getBounds(a),u=Math.hypot(h.maxX-h.minX,h.maxY-h.minY);if(!(u<oe))for(const f of e.patternLines??[]){if(s>=r)break;const g=this.createPatternFamilySegments(e,f,a,i.holes,h,u,r-s);g.forEach(([d,b])=>{n.push(new k.Vector3(d.x,d.y,Ge),new k.Vector3(b.x,b.y,Ge))}),s+=g.length}}if(n.length===0)return null;n.forEach(a=>a.applyMatrix4(t));const o=je(n);return{kind:"line",layer:e.layer??"0",color:this.resolveEntityColor(e),linkId:e.linkId??e.id,points:n,min:o.min,max:o.max,info:e}}createPatternFamilySegments(e,t,i,n,r,s,o){const a=this.resolvePatternLineTransform(e,t),h=a.dir,u=new k.Vector2(-h.y,h.x),f=a.base,g=a.offset;let d=g.dot(u);if(Math.abs(d)<oe&&(d=Number(t.lineOffset??0)),Math.abs(d)<oe)return[];const b=[new k.Vector2(r.minX,r.minY),new k.Vector2(r.maxX,r.minY),new k.Vector2(r.maxX,r.maxY),new k.Vector2(r.minX,r.maxY)],l=f.dot(u),p=b.map(P=>P.dot(u)-l),y=Math.min(...p)-s,v=Math.max(...p)+s,_=Math.floor(Math.min(y/d,v/d))-2,S=Math.ceil(Math.max(y/d,v/d))+2,E=[],D=new k.Vector2((r.minX+r.maxX)/2,(r.minY+r.maxY)/2);for(let P=_;P<=S&&E.length<o;P+=1){const F=f.clone().add(g.clone().multiplyScalar(P)),B=F.clone().add(h.clone().multiplyScalar(D.clone().sub(F).dot(h))),H=B.clone().add(h.clone().multiplyScalar(-s*2)),q=B.clone().add(h.clone().multiplyScalar(s*2));this.clipLineByPolygon(H,q,i).forEach(([R,m])=>{this.subtractHoles(R,m,n).forEach(([N,ee])=>{this.appendDashedSegment(E,N,ee,t.dashLengths,F,h)})})}return E.slice(0,o)}resolvePatternLineTransform(e,t){const i=Number(t.angle??e.patternAngle??0);return{dir:new k.Vector2(Math.cos(i),Math.sin(i)).normalize(),base:this.toVector2(t.basePoint),offset:this.toVector2(t.offset)}}toVector2(e){return new k.Vector2(e?.[0]??0,e?.[1]??0)}getBounds(e){return{minX:Math.min(...e.map(t=>t[0])),minY:Math.min(...e.map(t=>t[1])),maxX:Math.max(...e.map(t=>t[0])),maxY:Math.max(...e.map(t=>t[1]))}}clipLineByPolygon(e,t,i){const n=[0,1];for(let o=0;o<i.length;o+=1){const a=new k.Vector2(i[o][0],i[o][1]),h=new k.Vector2(i[(o+1)%i.length][0],i[(o+1)%i.length][1]),u=this.segmentIntersectionT(e,t,a,h);u!==null&&u>oe&&u<1-oe&&n.push(u)}const r=this.dedupeSorted(n.sort((o,a)=>o-a),1e-7),s=[];for(let o=0;o<r.length-1;o+=1){const a=r[o],h=r[o+1];if(h-a<1e-7)continue;const u=this.interpolate2(e,t,(a+h)/2);this.pointInPolygon(u,i)&&s.push([this.interpolate2(e,t,a),this.interpolate2(e,t,h)])}return s}subtractHoles(e,t,i){let n=[[e,t]];return i.forEach(r=>{const s=[];n.forEach(([o,a])=>{const h=this.clipLineByPolygon(o,a,r);s.push(...this.subtractSegments(o,a,h))}),n=s}),n}appendDashedSegment(e,t,i,n,r,s){const o=t.distanceTo(i);if(o<oe)return;if(!n?.length){e.push([t,i]);return}const a=this.normalizeDashPattern(n),h=a.reduce((_,S)=>_+S.length,0);if(h<oe){e.push([t,i]);return}const u=s?.clone().normalize()??i.clone().sub(t).normalize(),f=r??t,d=i.clone().sub(t).normalize().dot(u)>=0?1:-1,b=t.clone().sub(f).dot(u)*d,l=this.positiveModulo(b,h);let p=0,y=this.findDashIndex(a,l),v=l-a[y].start;for(;p<o-oe;){const _=a[y],S=Math.max(_.length-v,oe),E=Math.min(o,p+S);_.draw&&e.push([this.pointAtLength(t,i,p),this.pointAtLength(t,i,E)]),p=E,y=(y+1)%a.length,v=0}}normalizeDashPattern(e){let t=0;return e.map(i=>{const n=Number(i??0),r={length:Math.max(Math.abs(n),5e-4),draw:n>=0,start:t};return t+=r.length,r}).filter(i=>i.length>oe)}findDashIndex(e,t){for(let i=e.length-1;i>=0;i-=1)if(t>=e[i].start-oe)return i;return 0}positiveModulo(e,t){return(e%t+t)%t}subtractSegments(e,t,i){const n=i.map(([o,a])=>[this.projectT(e,t,o),this.projectT(e,t,a)]).map(([o,a])=>[Math.max(0,Math.min(o,a)),Math.min(1,Math.max(o,a))]).sort((o,a)=>o[0]-a[0]),r=[];let s=0;return n.forEach(([o,a])=>{o>s+oe&&r.push([this.interpolate2(e,t,s),this.interpolate2(e,t,o)]),s=Math.max(s,a)}),s<1-oe&&r.push([this.interpolate2(e,t,s),this.interpolate2(e,t,1)]),r}segmentIntersectionT(e,t,i,n){const r=t.clone().sub(e),s=n.clone().sub(i),o=this.cross2(r,s);if(Math.abs(o)<1e-10)return null;const a=i.clone().sub(e),h=this.cross2(a,s)/o,u=this.cross2(a,r)/o;return h>=-1e-8&&h<=1+1e-8&&u>=-1e-8&&u<=1+1e-8?h:null}pointInPolygon(e,t){let i=!1;for(let n=0,r=t.length-1;n<t.length;r=n,n+=1){const s=t[n][0],o=t[n][1],a=t[r][0],h=t[r][1];o>e.y!=h>e.y&&e.x<(a-s)*(e.y-o)/(h-o+1e-20)+s&&(i=!i)}return i}cross2(e,t){return e.x*t.y-e.y*t.x}interpolate2(e,t,i){return e.clone().lerp(t,i)}projectT(e,t,i){const n=t.clone().sub(e),r=n.lengthSq();return r<1e-12?0:i.clone().sub(e).dot(n)/r}pointAtLength(e,t,i){const n=e.distanceTo(t);return this.interpolate2(e,t,n<1e-12?0:i/n)}dedupeSorted(e,t){const i=[];return e.forEach(n=>{(!i.length||Math.abs(n-i[i.length-1])>t)&&i.push(n)}),i}}class Rt{constructor(e,t){this.engine=e,this.textFactory=t,this.hatchRenderer=new Bt(e)}hatchRenderer;create(e,t){switch(e.type){case"LINE_GROUP":case"LINE":case"CIRCLE":case"POLYLINE":case"SPLINE":return this.createLineItem(e,t);case"MTEXT":case"TEXT":return this.textFactory.create(e,t);case"HATCH":return this.createHatch(e,t);case"IMAGE":return this.createImage(e,t);default:return[]}}createLineItem(e,t){const i=this.getEntityPoints(e).map(n=>n.clone().applyMatrix4(t));return i.length===0?[]:[{kind:"line",layer:e.layer,color:e.color,lineType:e.lineType,lineTypeScale:e.lineTypeScale,lineTypePattern:Array.isArray(e.lineTypePattern)?e.lineTypePattern:void 0,linkId:e.linkId??e.id,points:i,info:e}]}getEntityPoints(e){switch(e.type){case"LINE_GROUP":return this.getLineGroupPoints(e);case"LINE":return[xe(e.startPoint),xe(e.endPoint)];case"CIRCLE":return this.getCirclePoints(e);case"POLYLINE":return this.getPolylinePoints(e);case"SPLINE":return this.getSplinePoints(e);default:return[]}}getLineGroupPoints(e){const t=[];return(e.segments??[]).forEach(i=>{t.push(new k.Vector3(i[0]??0,i[1]??0,i[2]??0)),t.push(new k.Vector3(i[3]??0,i[4]??0,i[5]??0))}),t}getCirclePoints(e){const t=new k.EllipseCurve(e.center?.[0]??0,e.center?.[1]??0,e.radius??0,e.radius??0,e.startAngle??0,(e.endAngle??Math.PI*2)-1e-5,!1,0);return this.pointsToSegments(t.getPoints(this.engine.options?.circleSegments??48).map(i=>new k.Vector3(i.x,i.y,e.center?.[2]??0)))}getPolylinePoints(e){const t=[],i=e.points??[];for(let n=0;n<i.length-1;n+=1)this.getPolylineSegmentPoints(i[n],i[n+1]).forEach(r=>{t.push(r)});return e.closed&&i.length>1&&this.getPolylineSegmentPoints(i[i.length-1],i[0]).forEach(n=>{t.push(n)}),t}getPolylineSegmentPoints(e,t){const i=xe(e),n=xe(t),r=Number(e?.bulge??0);if(!Number.isFinite(r)||Math.abs(r)<1e-10)return[i,n];const s=n.clone().sub(i),o=s.length();if(o<1e-12)return[i,n];const a=4*Math.atan(r),h=o*(1+r*r)/(4*Math.abs(r)),u=i.clone().add(n).multiplyScalar(.5),f=new k.Vector3(-s.y/o,s.x/o,0),g=u.clone().add(f.multiplyScalar(o*(1-r*r)/(4*r))),d=Math.atan2(i.y-g.y,i.x-g.x),b=Math.max(4,Math.ceil(Math.abs(a)/(this.engine.options?.polylineArcAngleStep??Math.PI/18))),l=[];for(let p=0;p<=b;p+=1){const y=p/b,v=d+a*y;l.push(new k.Vector3(g.x+Math.cos(v)*h,g.y+Math.sin(v)*h,i.z+(n.z-i.z)*y))}return this.pointsToSegments(l)}getSplinePoints(e){const t=(e.points??[]).map(n=>xe(n));if(t.length<2)return[];const i=t.length===2?t:this.sampleSplineCurve(t,e);return this.pointsToSegments(i)}sampleSplineCurve(e,t){const i=Math.min(Math.max(Number(t.degree??this.engine.options?.splineDegree??6),1),e.length-1),n=Array.isArray(t.knots)&&t.knots.length===e.length+i+1?t.knots:this.createClampedUniformKnots(e.length,i),r=e.map((a,h)=>{const u=Array.isArray(t.weights)?Number(t.weights[h]??1):1;return new k.Vector4(a.x,a.y,a.z,Number.isFinite(u)?u:1)});let s=(e.length-1)*2;const o=new zt(i,n,r).getPoints(s);return t.closed===!0&&o.length>1&&o.push(o[0].clone()),o}createClampedUniformKnots(e,t){const i=[];for(let n=0;n<e+t+1;n+=1)n<=t?i.push(0):n>=e?i.push(1):i.push((n-t)/(e-t));return i}pointsToSegments(e){const t=[];for(let i=0;i<e.length-1;i+=1)t.push(e[i].clone(),e[i+1].clone());return t}createHatch(e,t){return this.hatchRenderer.create(e,t)}createImage(e,t){const i=e.imageUrl||e.url;if(!i)return[];const n=xe(e.position),r=xe(e.uVector),s=xe(e.vVector),o=Number(e.pixelWidth??e.width??1),a=Number(e.pixelHeight??e.height??1);if(!Number.isFinite(o)||!Number.isFinite(a)||o===0||a===0)return[];const h=r.multiplyScalar(o),u=s.multiplyScalar(a),f=n.clone(),g=n.clone().add(h),d=n.clone().add(h).add(u),b=n.clone().add(u);[f,g,d,b].forEach(v=>v.applyMatrix4(t));const l=new k.BufferGeometry;l.setAttribute("position",new k.Float32BufferAttribute([f.x,f.y,f.z,g.x,g.y,g.z,d.x,d.y,d.z,f.x,f.y,f.z,d.x,d.y,d.z,b.x,b.y,b.z],3)),l.setAttribute("uv",new k.Float32BufferAttribute([0,0,1,0,1,1,0,0,1,1,0,1],2)),l.computeVertexNormals();const p=_e(l),y=Number(e.fade??0);return[{kind:"image",layer:e.layer??"0",color:e.color??16777215,linkId:e.linkId??e.id,geometry:l,imageUrl:i,opacity:Number.isFinite(y)?k.MathUtils.clamp(1-y/100,0,1):1,min:p.min,max:p.max,info:e}]}}class Dt{constructor(e,t,i=e.modelGroup){this.model=t,this.targetGroup=i}modelMap=new Map;hatchMap=new Map;textMap=new Map;imageMap=new Map;textureLoader=new k.TextureLoader;addRenderItems(e){e.forEach(t=>this.addRenderItem(t))}buildSceneObjects(){this.buildImageObjects(),this.buildHatchObjects(),this.buildLineObjects(),this.buildTextObjects()}addRenderItem(e){const t=`${e.layer}||${e.color}`;if(e.kind==="line"){let s=this.modelMap.get(t);s||(s=new Map,this.modelMap.set(t,s));const o=this.resolveLinePoints(e),a=s.get(e.linkId);a?o.forEach(h=>a.push(h)):s.set(e.linkId,[...o]);return}const i=this.getItemMap(e),n=e.kind==="image"?`${t}||${e.imageUrl??""}`:t,r=i.get(n);r?r.push(e):i.set(n,[e])}getItemMap(e){return e.kind==="text"?this.textMap:e.kind==="image"?this.imageMap:this.hatchMap}resolveLinePoints(e){const t=e.points??[],i=this.resolveLineTypePattern(e);if(!i)return t;const n=[];for(let r=0;r<t.length-1;r+=2)this.applyDashPattern(t[r],t[r+1],i).forEach(s=>n.push(s));return n}resolveLineTypePattern(e){const t=this.model.layers.find(a=>a.name===e.layer),i=String(e.lineType??"").toLowerCase(),n=i==="bylayer"||i===""?String(t?.lineType??"").toLowerCase():i;if(!n||n==="continuous"||n==="byblock")return null;const r=Array.isArray(e.lineTypePattern)&&e.lineTypePattern.length>0?e.lineTypePattern:Array.isArray(t?.lineTypePattern)?t.lineTypePattern:this.getFallbackLineTypePattern(n);if(!r||r.length===0)return null;const s=this.resolveLineTypeScale(e,t),o=r.map(a=>Number(a)).filter(a=>Number.isFinite(a)).map(a=>a*s);return o.some(a=>Math.abs(a)>1e-12)?o:null}getFallbackLineTypePattern(e){return e.includes("dash")?[.25,-.1]:e.includes("dot")?[0,-.1]:null}resolveLineTypeScale(e,t){const i=Number(e.lineTypeScale??t?.lineTypeScale??1);return!Number.isFinite(i)||Math.abs(i)<1e-12?1:Math.abs(i)}applyDashPattern(e,t,i){const n=t.clone().sub(e),r=n.length();if(r<1e-12)return[];const s=n.multiplyScalar(1/r),o=i.reduce((g,d)=>g+Math.abs(d),0),a=Math.max(o*.05,r*.002,1e-6),h=[];let u=0,f=0;for(;u<r-1e-12;){const g=i[f%i.length],d=g>=0,b=Math.max(Math.abs(g),a),l=Math.min(u+b,r);if(d&&l>u&&h.push(e.clone().add(s.clone().multiplyScalar(u)),e.clone().add(s.clone().multiplyScalar(l))),u=l,f+=1,f>1e5)break}return h}buildLineObjects(){this.modelMap.forEach((e,t)=>{const[i]=t.split("||"),n=[];if(e.forEach(f=>{f.forEach(g=>n.push(g))}),n.length===0)return;const r=new k.BufferGeometry().setFromPoints(n),s=new k.LineBasicMaterial({color:this.resolveColor(t)}),o=new k.LineSegments(r,s);o.name=t;const a=r.getAttribute("position");o.clonePoints=a.array.slice(),o.materialClone=s.clone(),this.targetGroup.add(o);const h=this.targetGroup.children.length-1;let u=0;e.forEach((f,g)=>{const d=je(f);this.pushNodeMap(g,{indexes:[h,u,u+f.length*3],object:o,group:this.targetGroup,kind:"line",layer:i,min:d.min,max:d.max}),u+=f.length*3})})}buildTextObjects(){this.textMap.forEach((e,t)=>{const i=e.filter(o=>!!o.geometry),n=this.normalizeMeshGeometries(i,!1,!1);if(n.length===0)return;const r=this.mergeMeshGeometries(n),s=new k.MeshBasicMaterial({color:this.resolveColor(t),side:k.DoubleSide});t.includes("_hitbox")&&(s.visible=!1),this.addMeshObject(i,t,r,n,s)})}buildHatchObjects(){this.hatchMap.forEach((e,t)=>{const i=e.filter(a=>!!a.geometry),n=i.some(a=>a.useVertexColors===!0),r=this.normalizeMeshGeometries(i,!1,n);if(r.length===0)return;const s=this.mergeMeshGeometries(r),o=new k.MeshBasicMaterial({color:n?16777215:this.resolveColor(t),side:k.DoubleSide,transparent:!0,opacity:n?1:.5,vertexColors:n});this.addMeshObject(i,t,s,r,o)})}buildImageObjects(){this.imageMap.forEach((e,t)=>{const i=e.filter(u=>!!u.geometry),n=this.normalizeMeshGeometries(i,!0,!1);if(n.length===0)return;const r=i[0]?.imageUrl;if(!r)return;const s=this.mergeMeshGeometries(n),o=this.textureLoader.load(r);o.colorSpace=k.SRGBColorSpace,o.needsUpdate=!0;const a=i.reduce((u,f)=>Math.min(u,f.opacity??1),1),h=new k.MeshBasicMaterial({map:o,side:k.DoubleSide,transparent:!0,opacity:a,depthWrite:!1});this.addMeshObject(i,t,s,n,h)})}mergeMeshGeometries(e){const t=e.length===1?e[0]:Me(e,!0);if(t.groups.length===0){const i=t.getAttribute("position");t.addGroup(0,i?.count??0,0)}return t.groups.forEach(i=>{i.materialIndex=0}),t}normalizeMeshGeometries(e,t,i){return e.map(n=>{const r=n.geometry,s=r.index?r.toNonIndexed():r.clone(),o=s.getAttribute("position"),a=s.getAttribute("uv"),h=s.getAttribute("color"),u=new k.BufferGeometry;return u.setAttribute("position",o.clone()),t&&u.setAttribute("uv",a?a.clone():this.createEmptyUv(o.count)),i&&u.setAttribute("color",h?h.clone():this.createSolidColorAttribute(o.count,n.color)),u})}createEmptyUv(e){return new k.Float32BufferAttribute(new Array(e*2).fill(0),2)}createSolidColorAttribute(e,t){const i=new k.Color(t??16777215),n=[];for(let r=0;r<e;r+=1)n.push(i.r,i.g,i.b);return new k.Float32BufferAttribute(n,3)}addMeshObject(e,t,i,n,r){const s=new k.Mesh(i,r);s.name=t,s.materialClone=r.clone(),s.isSplit=!1,s.geometrys=void 0,n.forEach(a=>{a!==i&&a.dispose()}),this.targetGroup.add(s);const o=this.targetGroup.children.length-1;e.forEach((a,h)=>{const u=a.linkId??a.info?.id;this.pushNodeMap(u,{indexes:[o,h],object:s,group:this.targetGroup,kind:a.kind,layer:a.layer,info:a.info,min:a.min??new k.Vector3,max:a.max??new k.Vector3}),this.pushTextSearchItem(a,t)})}pushTextSearchItem(e,t){if(e.kind!=="text"||t.includes("_hitbox"))return;const i=e.info?.text,n=String(i??"").replace(/\r\n/g,`
114
114
  `).replace(/\r/g,`
115
115
  `).trim(),r=e.linkId??e.info?.id;!n||r==null||this.model.textItems.push({id:String(r),text:n,layer:e.layer,min:e.min,max:e.max,anchor:e.textAnchor,info:e.info})}resolveColor(e){const[t,i]=e.split("||");let n=Number.parseInt(i);return(n===0||Number.isNaN(n))&&(n=this.model.layers.find(s=>s.name===t)?.color??16777215),n}pushNodeMap(e,t){if(e==null)return;const i=String(e),n=this.model.nodeMap.get(i);n?n.push(t):this.model.nodeMap.set(i,[t])}}class Ot{constructor(e,t){this.engine=e,this.font=t}create(e,t=new k.Matrix4){if(!e.text)return[];const i=this.normalizeText(e.text);if(!i.trim())return[];const n=this.engine.options?.textCurveSegments??1,r=this.createTextGeometry(i,e.height??100,n);if(!r)return[];const s=[...e.position??[0,0,0]];s[1]=s[1]-(e.height??0);const o=this.resolveWidthScale(e),a=new k.Vector3(s[0]??0,s[1]??0,s[2]??0).applyMatrix4(t),h=1.4*e.scale;r.applyMatrix4(t.clone().multiply(ze(s,[o*1.4,1*h,1*h],e.rotation??0)));const u=_e(r),f=[{kind:"text",layer:e.layer,color:e.color,linkId:e.linkId??e.id,geometry:r,min:u.min,max:u.max,textAnchor:a,info:e}],g=this.createHitbox(r);if(g){const d=_e(g);f.push({kind:"text",layer:e.layer,color:`${e.color}_hitbox`,linkId:e.linkId??e.id,geometry:g,min:d.min,max:d.max,textAnchor:a,info:e})}return f}resolveWidthScale(e){const t=Number(e.widthScale??e.widthFactor??1);return!Number.isFinite(t)||Math.abs(t)<1e-12?1:t}normalizeText(e){return String(e??"").replace(/\r\n/g,`
116
116
  `).replace(/\r/g,`