UNPKG

@cesium/engine

Version:

CesiumJS is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin.

2 lines (1 loc) 18.5 kB
!function(){"use strict";const{Array:e,Object:t,Number:n,Math:s,Error:r,Uint8Array:i,Uint16Array:a,Uint32Array:o,Int32Array:c,Map:l,DataView:u,Promise:h,TextEncoder:f,crypto:p,postMessage:d,TransformStream:w,ReadableStream:g,WritableStream:m,CompressionStream:_,DecompressionStream:y}=self,b=void 0,S="undefined",z="function",k=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)1&t?t=t>>>1^3988292384:t>>>=1;k[e]=t}class v{constructor(e){this.crc=e||-1}append(e){let t=0|this.crc;for(let n=0,s=0|e.length;s>n;n++)t=t>>>8^k[255&(t^e[n])];this.crc=t}get(){return~this.crc}}class H extends w{constructor(){let e;const t=new v;super({transform(e,n){t.append(e),n.enqueue(e)},flush(){const n=new i(4);new u(n.buffer).setUint32(0,t.get()),e.value=n}}),e=this}}const C={concat(e,t){if(0===e.length||0===t.length)return e.concat(t);const n=e[e.length-1],s=C.getPartial(n);return 32===s?e.concat(t):C._shiftRight(t,s,0|n,e.slice(0,e.length-1))},bitLength(e){const t=e.length;if(0===t)return 0;const n=e[t-1];return 32*(t-1)+C.getPartial(n)},clamp(e,t){if(32*e.length<t)return e;const n=(e=e.slice(0,s.ceil(t/32))).length;return t&=31,n>0&&t&&(e[n-1]=C.partial(t,e[n-1]&2147483648>>t-1,1)),e},partial:(e,t,n)=>32===e?t:(n?0|t:t<<32-e)+1099511627776*e,getPartial:e=>s.round(e/1099511627776)||32,_shiftRight(e,t,n,s){for(void 0===s&&(s=[]);t>=32;t-=32)s.push(n),n=0;if(0===t)return s.concat(e);for(let r=0;r<e.length;r++)s.push(n|e[r]>>>t),n=e[r]<<32-t;const r=e.length?e[e.length-1]:0,i=C.getPartial(r);return s.push(C.partial(t+i&31,t+i>32?n:s.pop(),1)),s}},B={bytes:{fromBits(e){const t=C.bitLength(e)/8,n=new i(t);let s;for(let r=0;t>r;r++)3&r||(s=e[r/4]),n[r]=s>>>24,s<<=8;return n},toBits(e){const t=[];let n,s=0;for(n=0;n<e.length;n++)s=s<<8|e[n],3&~n||(t.push(s),s=0);return 3&n&&t.push(C.partial(8*(3&n),s)),t}}},A=class{constructor(e){const t=this;t.blockSize=512,t._init=[1732584193,4023233417,2562383102,271733878,3285377520],t._key=[1518500249,1859775393,2400959708,3395469782],e?(t._h=e._h.slice(0),t._buffer=e._buffer.slice(0),t._length=e._length):t.reset()}reset(){const e=this;return e._h=e._init.slice(0),e._buffer=[],e._length=0,e}update(e){const t=this;"string"==typeof e&&(e=B.utf8String.toBits(e));const n=t._buffer=C.concat(t._buffer,e),s=t._length,i=t._length=s+C.bitLength(e);if(i>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const a=new o(n);let c=0;for(let e=t.blockSize+s-(t.blockSize+s&t.blockSize-1);i>=e;e+=t.blockSize)t._block(a.subarray(16*c,16*(c+1))),c+=1;return n.splice(0,16*c),t}finalize(){const e=this;let t=e._buffer;const n=e._h;t=C.concat(t,[C.partial(1,1)]);for(let e=t.length+2;15&e;e++)t.push(0);for(t.push(s.floor(e._length/4294967296)),t.push(0|e._length);t.length;)e._block(t.splice(0,16));return e.reset(),n}_f(e,t,n,s){return e>19?e>39?e>59?e>79?void 0:t^n^s:t&n|t&s|n&s:t^n^s:t&n|~t&s}_S(e,t){return t<<e|t>>>32-e}_block(t){const n=this,r=n._h,i=e(80);for(let e=0;16>e;e++)i[e]=t[e];let a=r[0],o=r[1],c=r[2],l=r[3],u=r[4];for(let e=0;79>=e;e++){16>e||(i[e]=n._S(1,i[e-3]^i[e-8]^i[e-14]^i[e-16]));const t=n._S(5,a)+n._f(e,o,c,l)+u+i[e]+n._key[s.floor(e/20)]|0;u=l,l=c,c=n._S(30,o),o=a,a=t}r[0]=r[0]+a|0,r[1]=r[1]+o|0,r[2]=r[2]+c|0,r[3]=r[3]+l|0,r[4]=r[4]+u|0}},R={getRandomValues(e){const t=new o(e.buffer),n=e=>{let t=987654321;const n=4294967295;return()=>(t=36969*(65535&t)+(t>>16)&n,(((t<<16)+(e=18e3*(65535&e)+(e>>16)&n)&n)/4294967296+.5)*(s.random()>.5?1:-1))};for(let r,i=0;i<e.length;i+=4){const e=n(4294967296*(r||s.random()));r=987654071*e(),t[i/4]=4294967296*e()|0}return e}},I={importKey:e=>new I.hmacSha1(B.bytes.toBits(e)),pbkdf2(e,t,n,s){if(n=n||1e4,0>s||0>n)throw new r("invalid params to pbkdf2");const i=1+(s>>5)<<2;let a,o,c,l,h;const f=new ArrayBuffer(i),p=new u(f);let d=0;const w=C;for(t=B.bytes.toBits(t),h=1;(i||1)>d;h++){for(a=o=e.encrypt(w.concat(t,[h])),c=1;n>c;c++)for(o=e.encrypt(o),l=0;l<o.length;l++)a[l]^=o[l];for(c=0;(i||1)>d&&c<a.length;c++)p.setInt32(d,a[c]),d+=4}return f.slice(0,s/8)},hmacSha1:class{constructor(e){const t=this,n=t._hash=A,s=[[],[]];t._baseHash=[new n,new n];const r=t._baseHash[0].blockSize/32;e.length>r&&(e=(new n).update(e).finalize());for(let t=0;r>t;t++)s[0][t]=909522486^e[t],s[1][t]=1549556828^e[t];t._baseHash[0].update(s[0]),t._baseHash[1].update(s[1]),t._resultHash=new n(t._baseHash[0])}reset(){const e=this;e._resultHash=new e._hash(e._baseHash[0]),e._updated=!1}update(e){this._updated=!0,this._resultHash.update(e)}digest(){const e=this,t=e._resultHash.finalize(),n=new e._hash(e._baseHash[1]).update(t).finalize();return e.reset(),n}encrypt(e){if(this._updated)throw new r("encrypt on already updated hmac called!");return this.update(e),this.digest(e)}}},q=typeof p!=S&&typeof p.getRandomValues==z,K="Invalid password",P="Invalid signature",T="zipjs-abort-check-password";function V(e){return q?p.getRandomValues(e):R.getRandomValues(e)}const x=16,U={name:"PBKDF2"},W=t.assign({hash:{name:"HMAC"}},U),M=t.assign({iterations:1e3,hash:{name:"SHA-1"}},U),E=["deriveBits"],D=[8,12,16],L=[16,24,32],Z=10,F=[0,0,0,0],N=typeof p!=S,O=N&&p.subtle,j=N&&typeof O!=S,G=B.bytes,X=class{constructor(e){const t=this;t._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],t._tables[0][0][0]||t._precompute();const n=t._tables[0][4],s=t._tables[1],i=e.length;let a,o,c,l=1;if(4!==i&&6!==i&&8!==i)throw new r("invalid aes key size");for(t._key=[o=e.slice(0),c=[]],a=i;4*i+28>a;a++){let e=o[a-1];(a%i===0||8===i&&a%i===4)&&(e=n[e>>>24]<<24^n[e>>16&255]<<16^n[e>>8&255]<<8^n[255&e],a%i===0&&(e=e<<8^e>>>24^l<<24,l=l<<1^283*(l>>7))),o[a]=o[a-i]^e}for(let e=0;a;e++,a--){const t=o[3&e?a:a-4];c[e]=4>=a||4>e?t:s[0][n[t>>>24]]^s[1][n[t>>16&255]]^s[2][n[t>>8&255]]^s[3][n[255&t]]}}encrypt(e){return this._crypt(e,0)}decrypt(e){return this._crypt(e,1)}_precompute(){const e=this._tables[0],t=this._tables[1],n=e[4],s=t[4],r=[],i=[];let a,o,c,l;for(let e=0;256>e;e++)i[(r[e]=e<<1^283*(e>>7))^e]=e;for(let u=a=0;!n[u];u^=o||1,a=i[a]||1){let i=a^a<<1^a<<2^a<<3^a<<4;i=i>>8^255&i^99,n[u]=i,s[i]=u,l=r[c=r[o=r[u]]];let h=16843009*l^65537*c^257*o^16843008*u,f=257*r[i]^16843008*i;for(let n=0;4>n;n++)e[n][u]=f=f<<24^f>>>8,t[n][i]=h=h<<24^h>>>8}for(let n=0;5>n;n++)e[n]=e[n].slice(0),t[n]=t[n].slice(0)}_crypt(e,t){if(4!==e.length)throw new r("invalid aes block size");const n=this._key[t],s=n.length/4-2,i=[0,0,0,0],a=this._tables[t],o=a[0],c=a[1],l=a[2],u=a[3],h=a[4];let f,p,d,w=e[0]^n[0],g=e[t?3:1]^n[1],m=e[2]^n[2],_=e[t?1:3]^n[3],y=4;for(let e=0;s>e;e++)f=o[w>>>24]^c[g>>16&255]^l[m>>8&255]^u[255&_]^n[y],p=o[g>>>24]^c[m>>16&255]^l[_>>8&255]^u[255&w]^n[y+1],d=o[m>>>24]^c[_>>16&255]^l[w>>8&255]^u[255&g]^n[y+2],_=o[_>>>24]^c[w>>16&255]^l[g>>8&255]^u[255&m]^n[y+3],y+=4,w=f,g=p,m=d;for(let e=0;4>e;e++)i[t?3&-e:e]=h[w>>>24]<<24^h[g>>16&255]<<16^h[m>>8&255]<<8^h[255&_]^n[y++],f=w,w=g,g=m,m=_,_=f;return i}},J=class{constructor(e,t){this._prf=e,this._initIv=t,this._iv=t}reset(){this._iv=this._initIv}update(e){return this.calculate(this._prf,e,this._iv)}incWord(e){if(255&~(e>>24))e+=1<<24;else{let t=e>>16&255,n=e>>8&255,s=255&e;255===t?(t=0,255===n?(n=0,255===s?s=0:++s):++n):++t,e=0,e+=t<<16,e+=n<<8,e+=s}return e}incCounter(e){0===(e[0]=this.incWord(e[0]))&&(e[1]=this.incWord(e[1]))}calculate(e,t,n){let s;if(!(s=t.length))return[];const r=C.bitLength(t);for(let r=0;s>r;r+=4){this.incCounter(n);const s=e.encrypt(n);t[r]^=s[0],t[r+1]^=s[1],t[r+2]^=s[2],t[r+3]^=s[3]}return C.clamp(t,r)}},Q=I.hmacSha1;let Y=N&&j&&typeof O.importKey==z,$=N&&j&&typeof O.deriveBits==z;class ee extends w{constructor({password:e,rawPassword:n,signed:s,encryptionStrength:a,checkPasswordOnly:o}){super({start(){t.assign(this,{ready:new h(e=>this.resolveReady=e),password:re(e,n),signed:s,strength:a-1,pending:new i})},async transform(e,t){const n=this,{password:s,strength:a,resolveReady:c,ready:l}=n;s?(await(async(e,t,n,s)=>{const i=await se(e,t,n,ae(s,0,D[t])),a=ae(s,D[t]);if(i[0]!=a[0]||i[1]!=a[1])throw new r(K)})(n,a,s,ae(e,0,D[a]+2)),e=ae(e,D[a]+2),o?t.error(new r(T)):c()):await l;const u=new i(e.length-Z-(e.length-Z)%x);t.enqueue(ne(n,e,u,0,Z,!0))},async flush(e){const{signed:t,ctr:n,hmac:s,pending:a,ready:o}=this;if(s&&n){await o;const c=ae(a,0,a.length-Z),l=ae(a,a.length-Z);let u=new i;if(c.length){const e=ce(G,c);s.update(e);const t=n.update(e);u=oe(G,t)}if(t){const e=ae(oe(G,s.digest()),0,Z);for(let t=0;Z>t;t++)if(e[t]!=l[t])throw new r(P)}e.enqueue(u)}}})}}class te extends w{constructor({password:e,rawPassword:n,encryptionStrength:s}){let r;super({start(){t.assign(this,{ready:new h(e=>this.resolveReady=e),password:re(e,n),strength:s-1,pending:new i})},async transform(e,t){const n=this,{password:s,strength:r,resolveReady:a,ready:o}=n;let c=new i;s?(c=await(async(e,t,n)=>{const s=V(new i(D[t]));return ie(s,await se(e,t,n,s))})(n,r,s),a()):await o;const l=new i(c.length+e.length-e.length%x);l.set(c,0),t.enqueue(ne(n,e,l,c.length,0))},async flush(e){const{ctr:t,hmac:n,pending:s,ready:a}=this;if(n&&t){await a;let o=new i;if(s.length){const e=t.update(ce(G,s));n.update(e),o=oe(G,e)}r.signature=oe(G,n.digest()).slice(0,Z),e.enqueue(ie(o,r.signature))}}}),r=this}}function ne(e,t,n,s,r,a){const{ctr:o,hmac:c,pending:l}=e,u=t.length-r;let h;for(l.length&&(t=ie(l,t),n=((e,t)=>{if(t&&t>e.length){const n=e;(e=new i(t)).set(n,0)}return e})(n,u-u%x)),h=0;u-x>=h;h+=x){const e=ce(G,ae(t,h,h+x));a&&c.update(e);const r=o.update(e);a||c.update(r),n.set(oe(G,r),h+s)}return e.pending=ae(t,h),n}async function se(n,s,r,a){n.password=null;const o=await(async(e,t,n,s,r)=>{if(!Y)return I.importKey(t);try{return await O.importKey("raw",t,n,!1,r)}catch{return Y=!1,I.importKey(t)}})(0,r,W,0,E),c=await(async(e,t,n)=>{if(!$)return I.pbkdf2(t,e.salt,M.iterations,n);try{return await O.deriveBits(e,t,n)}catch{return $=!1,I.pbkdf2(t,e.salt,M.iterations,n)}})(t.assign({salt:a},M),o,8*(2*L[s]+2)),l=new i(c),u=ce(G,ae(l,0,L[s])),h=ce(G,ae(l,L[s],2*L[s])),f=ae(l,2*L[s]);return t.assign(n,{keys:{key:u,authentication:h,passwordVerification:f},ctr:new J(new X(u),e.from(F)),hmac:new Q(h)}),f}function re(e,t){return t===b?(e=>{if(typeof f==S){const t=new i((e=unescape(encodeURIComponent(e))).length);for(let n=0;n<t.length;n++)t[n]=e.charCodeAt(n);return t}return(new f).encode(e)})(e):t}function ie(e,t){let n=e;return e.length+t.length&&(n=new i(e.length+t.length),n.set(e,0),n.set(t,e.length)),n}function ae(e,t,n){return e.subarray(t,n)}function oe(e,t){return e.fromBits(t)}function ce(e,t){return e.toBits(t)}class le extends w{constructor({password:e,passwordVerification:n,checkPasswordOnly:s}){super({start(){t.assign(this,{password:e,passwordVerification:n}),pe(this,e)},transform(e,t){const n=this;if(n.password){const t=he(n,e.subarray(0,12));if(n.password=null,t.at(-1)!=n.passwordVerification)throw new r(K);e=e.subarray(12)}s?t.error(new r(T)):t.enqueue(he(n,e))}})}}class ue extends w{constructor({password:e,passwordVerification:n}){super({start(){t.assign(this,{password:e,passwordVerification:n}),pe(this,e)},transform(e,t){const n=this;let s,r;if(n.password){n.password=null;const t=V(new i(12));t[11]=n.passwordVerification,s=new i(e.length+t.length),s.set(fe(n,t),0),r=12}else s=new i(e.length),r=0;s.set(fe(n,e),r),t.enqueue(s)}})}}function he(e,t){const n=new i(t.length);for(let s=0;s<t.length;s++)n[s]=we(e)^t[s],de(e,n[s]);return n}function fe(e,t){const n=new i(t.length);for(let s=0;s<t.length;s++)n[s]=we(e)^t[s],de(e,t[s]);return n}function pe(e,n){const s=[305419896,591751049,878082192];t.assign(e,{keys:s,crcKey0:new v(s[0]),crcKey2:new v(s[2])});for(let t=0;t<n.length;t++)de(e,n.charCodeAt(t))}function de(e,t){let[n,r,i]=e.keys;e.crcKey0.append([t]),n=~e.crcKey0.get(),r=me(s.imul(me(r+ge(n)),134775813)+1),e.crcKey2.append([r>>>24]),i=~e.crcKey2.get(),e.keys=[n,r,i]}function we(e){const t=2|e.keys[2];return ge(s.imul(t,1^t)>>>8)}function ge(e){return 255&e}function me(e){return 4294967295&e}class _e extends w{constructor(e,{chunkSize:t,CompressionStreamZlib:n,CompressionStream:s}){super({});const{compressed:r,encrypted:i,useCompressionStream:a,zipCrypto:o,signed:c,level:l}=e,h=this;let f,p,d=super.readable;i&&!o||!c||(f=new H,d=ze(d,f)),r&&(d=Se(d,a,{level:l,chunkSize:t},s,n,s)),i&&(o?d=ze(d,new ue(e)):(p=new te(e),d=ze(d,p))),be(h,d,()=>{let e;i&&!o&&(e=p.signature),i&&!o||!c||(e=new u(f.value.buffer).getUint32(0)),h.signature=e})}}class ye extends w{constructor(e,{chunkSize:t,DecompressionStreamZlib:n,DecompressionStream:s}){super({});const{zipCrypto:i,encrypted:a,signed:o,signature:c,compressed:l,useCompressionStream:h,deflate64:f}=e;let p,d,w=super.readable;a&&(i?w=ze(w,new le(e)):(d=new ee(e),w=ze(w,d))),l&&(w=Se(w,h,{chunkSize:t,deflate64:f},s,n,s)),a&&!i||!o||(p=new H,w=ze(w,p)),be(this,w,()=>{if((!a||i)&&o){const e=new u(p.value.buffer);if(c!=e.getUint32(0,!1))throw new r(P)}})}}function be(e,n,s){n=ze(n,new w({flush:s})),t.defineProperty(e,"readable",{get:()=>n})}function Se(e,t,n,s,r,i){const a=t&&s?s:r||i,o=n.deflate64?"deflate64-raw":"deflate-raw";try{e=ze(e,new a(o,n))}catch(s){if(!t)throw s;if(r)e=ze(e,new r(o,n));else{if(!i)throw s;e=ze(e,new i(o,n))}}return e}function ze(e,t){return e.pipeThrough(t)}const ke="data",ve="close";class He extends w{constructor(e,n){super({});const s=this,{codecType:i}=e;let a;i.startsWith("deflate")?a=_e:i.startsWith("inflate")&&(a=ye),s.outputSize=0;let o=0;const c=new a(e,n),l=super.readable,u=new w({transform(e,t){e&&e.length&&(o+=e.length,t.enqueue(e))},flush(){t.assign(s,{inputSize:o})}}),h=new w({transform(t,n){if(t&&t.length&&(n.enqueue(t),s.outputSize+=t.length,e.outputSize!==b&&s.outputSize>e.outputSize))throw new r("Invalid uncompressed size")},flush(){const{signature:e}=c;t.assign(s,{signature:e,inputSize:o})}});t.defineProperty(s,"readable",{get:()=>l.pipeThrough(u).pipeThrough(c).pipeThrough(h)})}}class Ce extends w{constructor(e){let t;super({transform:function n(s,r){if(t){const e=new i(t.length+s.length);e.set(t),e.set(s,t.length),s=e,t=null}s.length>e?(r.enqueue(s.slice(0,e)),n(s.slice(e),r)):t=s},flush(e){t&&t.length&&e.enqueue(t)}})}}const Be=new l,Ae=new l;let Re,Ie,qe,Ke,Pe,Te=0;async function Ve(e){try{const{options:t,config:s}=e;if(!t.useCompressionStream)try{await self.initModule(e.config)}catch{t.useCompressionStream=!0}s.CompressionStream=self.CompressionStream,s.DecompressionStream=self.DecompressionStream;const r={highWaterMark:1},i=e.readable||new g({async pull(e){const t=new h(e=>Be.set(Te,e));xe({type:"pull",messageId:Te}),Te=(Te+1)%n.MAX_SAFE_INTEGER;const{value:s,done:r}=await t;e.enqueue(s),r&&e.close()}},r),a=e.writable||new m({async write(e){let t;const s=new h(e=>t=e);Ae.set(Te,t),xe({type:ke,value:e,messageId:Te}),Te=(Te+1)%n.MAX_SAFE_INTEGER,await s}},r),o=new He(t,s);Re=new AbortController;const{signal:c}=Re;await i.pipeThrough(o).pipeThrough(new Ce(s.chunkSize)).pipeTo(a,{signal:c,preventClose:!0,preventAbort:!0}),await a.getWriter().close();const{signature:l,inputSize:u,outputSize:f}=o;xe({type:ve,result:{signature:l,inputSize:u,outputSize:f}})}catch(e){e.outputSize=0,Ue(e)}}function xe(e){let{value:t}=e;if(t)if(t.length)try{t=new i(t),e.value=t.buffer,d(e,[e.value])}catch{d(e)}else d(e);else d(e)}function Ue(e=new r("Unknown error")){const{message:t,stack:n,code:s,name:i,outputSize:a}=e;d({error:{message:t,stack:n,code:s,name:i,outputSize:a}})}function We(e,t,n={}){const a="number"==typeof n.level?n.level:-1,o="number"==typeof n.outBuffer?n.outBuffer:65536,c="number"==typeof n.inBufferSize?n.inBufferSize:65536;return new w({start(){let n;if(this.out=qe(o),this.in=qe(c),this.inBufferSize=c,this._scratch=new i(o),e?(this._process=Ie.deflate_process,this._last_consumed=Ie.deflate_last_consumed,this._end=Ie.deflate_end,this.streamHandle=Ie.deflate_new(),n="gzip"===t?Ie.deflate_init_gzip(this.streamHandle,a):"deflate-raw"===t?Ie.deflate_init_raw(this.streamHandle,a):Ie.deflate_init(this.streamHandle,a)):"deflate64-raw"===t?(this._process=Ie.inflate9_process,this._last_consumed=Ie.inflate9_last_consumed,this._end=Ie.inflate9_end,this.streamHandle=Ie.inflate9_new(),n=Ie.inflate9_init_raw(this.streamHandle)):(this._process=Ie.inflate_process,this._last_consumed=Ie.inflate_last_consumed,this._end=Ie.inflate_end,this.streamHandle=Ie.inflate_new(),n="deflate-raw"===t?Ie.inflate_init_raw(this.streamHandle):"gzip"===t?Ie.inflate_init_gzip(this.streamHandle):Ie.inflate_init(this.streamHandle)),0!==n)throw new r("init failed:"+n)},transform(t,n){try{const a=t,c=new i(Pe.buffer),l=this._process,u=this._last_consumed,h=this.out,f=this._scratch;let p=0;for(;p<a.length;){const t=s.min(a.length-p,32768);this.in&&this.inBufferSize>=t||(this.in&&Ke&&Ke(this.in),this.in=qe(t),this.inBufferSize=t),c.set(a.subarray(p,p+t),this.in);const i=l(this.streamHandle,this.in,t,h,o,0);if(!e&&0>i)throw new r("process error:"+i);const d=16777215&i;d&&(f.set(c.subarray(h,h+d),0),n.enqueue(f.slice(0,d)));const w=u(this.streamHandle);if(0===w)break;p+=w}}catch(e){this._end&&this.streamHandle&&this._end(this.streamHandle),this.in&&Ke&&Ke(this.in),this.out&&Ke&&Ke(this.out),n.error(e)}},flush(t){try{const n=new i(Pe.buffer),s=this._process,a=this.out,c=this._scratch;for(;;){const i=s(this.streamHandle,0,0,a,o,4);if(!e&&0>i)throw new r("process error:"+i);const l=16777215&i,u=i>>24&255;if(l&&(c.set(n.subarray(a,a+l),0),t.enqueue(c.slice(0,l))),1===u||0===l)break}}catch(e){t.error(e)}finally{if(this._end&&this.streamHandle){const e=this._end(this.streamHandle);0!==e&&t.error(new r("end error:"+e))}this.in&&Ke&&Ke(this.in),this.out&&Ke&&Ke(this.out)}}})}addEventListener("message",({data:e})=>{const{type:t,messageId:n,value:s,done:r}=e;try{if("start"==t&&Ve(e),t==ke){const e=Be.get(n);Be.delete(n),e({value:new i(s),done:r})}if("ack"==t){const e=Ae.get(n);Ae.delete(n),e()}t==ve&&Re.abort()}catch(e){Ue(e)}});class Me{constructor(e="deflate",t){return We(!0,e,t)}}class Ee{constructor(e="deflate",t){return We(!1,e,t)}}let De=!1;self.initModule=async e=>{try{const t=await(async(e,{baseURI:t})=>{if(!De){let n,s;try{try{s=new URL(e,t)}catch{}const r=await fetch(s);n=await r.arrayBuffer()}catch(t){if(!e.startsWith("data:application/wasm;base64,"))throw t;n=(e=>{const t=e.split(",")[1],n=atob(t),s=n.length,r=new i(s);for(let e=0;s>e;++e)r[e]=n.charCodeAt(e);return r.buffer})(e)}(e=>{if(Ie=e,({malloc:qe,free:Ke,memory:Pe}=Ie),"function"!=typeof qe||"function"!=typeof Ke||!Pe)throw Ie=qe=Ke=Pe=null,new r("Invalid WASM module")})((await WebAssembly.instantiate(n)).instance.exports),De=!0}})(e.wasmURI,e);return e.CompressionStreamZlib=Me,e.DecompressionStreamZlib=Ee,t}catch{}}}();