@zip.js/zip.js 2.8.1 → 2.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,6 +36,7 @@
36
36
  /* global TransformStream */
37
37
  // deno-lint-ignore-file no-this-alias
38
38
 
39
+ import { UNDEFINED_VALUE } from "../constants.js";
39
40
  import {
40
41
  ERR_INVALID_PASSWORD,
41
42
  ERR_INVALID_SIGNATURE,
@@ -105,7 +106,7 @@ class CodecStream extends TransformStream {
105
106
  if (chunk && chunk.length) {
106
107
  controller.enqueue(chunk);
107
108
  codec.outputSize += chunk.length;
108
- if (options.outputSize && codec.outputSize > options.outputSize) {
109
+ if (options.outputSize !== UNDEFINED_VALUE && codec.outputSize > options.outputSize) {
109
110
  throw new Error(ERR_INVALID_UNCOMPRESSED_SIZE);
110
111
  }
111
112
  }
@@ -1 +1 @@
1
- function t(t){t({workerURI:()=>"data:text/javascript,"+encodeURIComponent('(t=>{"function"==typeof define&&define.amd?define(t):t()})(function(){"use strict";const{Array:t,Object:e,Number:n,Math:s,Error:r,Uint8Array:o,Uint16Array:i,Uint32Array:c,Int32Array:a,Map:h,DataView:l,Promise:u,TextEncoder:f,crypto:w,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:g,DecompressionStream:b}=self,S=[];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)1&e?e=e>>>1^3988292384:e>>>=1;S[t]=e}class v{constructor(t){this.t=t||-1}append(t){let e=0|this.t;for(let n=0,s=0|t.length;s>n;n++)e=e>>>8^S[255&(e^t[n])];this.t=e}get(){return~this.t}}class k extends d{constructor(){let t;const e=new v;super({transform(t,n){e.append(t),n.enqueue(t)},flush(){const n=new o(4);new l(n.buffer).setUint32(0,e.get()),t.value=n}}),t=this}}const z="undefined",C="function",A={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const n=t[t.length-1],s=A.o(n);return 32===s?t.concat(e):A.i(e,s,0|n,t.slice(0,t.length-1))},h(t){const e=t.length;if(0===e)return 0;const n=t[e-1];return 32*(e-1)+A.o(n)},l(t,e){if(32*t.length<e)return t;const n=(t=t.slice(0,s.ceil(e/32))).length;return e&=31,n>0&&e&&(t[n-1]=A.u(e,t[n-1]&2147483648>>e-1,1)),t},u:(t,e,n)=>32===t?e:(n?0|e:e<<32-t)+1099511627776*t,o:t=>s.round(t/1099511627776)||32,i(t,e,n,s){for(void 0===s&&(s=[]);e>=32;e-=32)s.push(n),n=0;if(0===e)return s.concat(t);for(let r=0;r<t.length;r++)s.push(n|t[r]>>>e),n=t[r]<<32-e;const r=t.length?t[t.length-1]:0,o=A.o(r);return s.push(A.u(e+o&31,e+o>32?n:s.pop(),1)),s}},x={bytes:{p(t){const e=A.h(t)/8,n=new o(e);let s;for(let r=0;e>r;r++)3&r||(s=t[r/4]),n[r]=s>>>24,s<<=8;return n},m(t){const e=[];let n,s=0;for(n=0;n<t.length;n++)s=s<<8|t[n],3&~n||(e.push(s),s=0);return 3&n&&e.push(A.u(8*(3&n),s)),e}}},I=class{constructor(t){const e=this;e.blockSize=512,e.S=[1732584193,4023233417,2562383102,271733878,3285377520],e.v=[1518500249,1859775393,2400959708,3395469782],t?(e.k=t.k.slice(0),e.C=t.C.slice(0),e.A=t.A):e.reset()}reset(){const t=this;return t.k=t.S.slice(0),t.C=[],t.A=0,t}update(t){const e=this;"string"==typeof t&&(t=x.I.m(t));const n=e.C=A.concat(e.C,t),s=e.A,o=e.A=s+A.h(t);if(o>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const i=new c(n);let a=0;for(let t=e.blockSize+s-(e.blockSize+s&e.blockSize-1);o>=t;t+=e.blockSize)e.R(i.subarray(16*a,16*(a+1))),a+=1;return n.splice(0,16*a),e}P(){const t=this;let e=t.C;const n=t.k;e=A.concat(e,[A.u(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(s.floor(t.A/4294967296)),e.push(0|t.A);e.length;)t.R(e.splice(0,16));return t.reset(),n}U(t,e,n,s){return t>19?t>39?t>59?t>79?void 0:e^n^s:e&n|e&s|n&s:e^n^s:e&n|~e&s}V(t,e){return e<<t|e>>>32-t}R(e){const n=this,r=n.k,o=t(80);for(let t=0;16>t;t++)o[t]=e[t];let i=r[0],c=r[1],a=r[2],h=r[3],l=r[4];for(let t=0;79>=t;t++){16>t||(o[t]=n.V(1,o[t-3]^o[t-8]^o[t-14]^o[t-16]));const e=n.V(5,i)+n.U(t,c,a,h)+l+o[t]+n.v[s.floor(t/20)]|0;l=h,h=a,a=n.V(30,c),c=i,i=e}r[0]=r[0]+i|0,r[1]=r[1]+c|0,r[2]=r[2]+a|0,r[3]=r[3]+h|0,r[4]=r[4]+l|0}},R={getRandomValues(t){const e=new c(t.buffer),n=t=>{let e=987654321;const n=4294967295;return()=>(e=36969*(65535&e)+(e>>16)&n,(((e<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n)/4294967296+.5)*(s.random()>.5?1:-1))};for(let r,o=0;o<t.length;o+=4){const t=n(4294967296*(r||s.random()));r=987654071*t(),e[o/4]=4294967296*t()|0}return t}},P={importKey:t=>new P._(x.bytes.m(t)),B(t,e,n,s){if(n=n||1e4,0>s||0>n)throw new r("invalid params to pbkdf2");const o=1+(s>>5)<<2;let i,c,a,h,u;const f=new ArrayBuffer(o),w=new l(f);let p=0;const d=A;for(e=x.bytes.m(e),u=1;(o||1)>p;u++){for(i=c=t.encrypt(d.concat(e,[u])),a=1;n>a;a++)for(c=t.encrypt(c),h=0;h<c.length;h++)i[h]^=c[h];for(a=0;(o||1)>p&&a<i.length;a++)w.setInt32(p,i[a]),p+=4}return f.slice(0,s/8)},_:class{constructor(t){const e=this,n=e.D=I,s=[[],[]];e.M=[new n,new n];const r=e.M[0].blockSize/32;t.length>r&&(t=(new n).update(t).P());for(let e=0;r>e;e++)s[0][e]=909522486^t[e],s[1][e]=1549556828^t[e];e.M[0].update(s[0]),e.M[1].update(s[1]),e.K=new n(e.M[0])}reset(){const t=this;t.K=new t.D(t.M[0]),t.W=!1}update(t){this.W=!0,this.K.update(t)}digest(){const t=this,e=t.K.P(),n=new t.D(t.M[1]).update(e).P();return t.reset(),n}encrypt(t){if(this.W)throw new r("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},U=typeof w!=z&&typeof w.getRandomValues==C,V="Invalid password",_="Invalid signature",B="zipjs-abort-check-password";function D(t){return U?w.getRandomValues(t):R.getRandomValues(t)}const M=16,K={name:"PBKDF2"},W=e.assign({hash:{name:"HMAC"}},K),E=e.assign({iterations:1e3,hash:{name:"SHA-1"}},K),L=["deriveBits"],O=[8,12,16],T=[16,24,32],j=10,H=[0,0,0,0],Z=typeof w!=z,F=Z&&w.subtle,N=Z&&typeof F!=z,q=x.bytes,G=class{constructor(t){const e=this;e.L=[[[],[],[],[],[]],[[],[],[],[],[]]],e.L[0][0][0]||e.O();const n=e.L[0][4],s=e.L[1],o=t.length;let i,c,a,h=1;if(4!==o&&6!==o&&8!==o)throw new r("invalid aes key size");for(e.v=[c=t.slice(0),a=[]],i=o;4*o+28>i;i++){let t=c[i-1];(i%o===0||8===o&&i%o===4)&&(t=n[t>>>24]<<24^n[t>>16&255]<<16^n[t>>8&255]<<8^n[255&t],i%o===0&&(t=t<<8^t>>>24^h<<24,h=h<<1^283*(h>>7))),c[i]=c[i-o]^t}for(let t=0;i;t++,i--){const e=c[3&t?i:i-4];a[t]=4>=i||4>t?e:s[0][n[e>>>24]]^s[1][n[e>>16&255]]^s[2][n[e>>8&255]]^s[3][n[255&e]]}}encrypt(t){return this.T(t,0)}decrypt(t){return this.T(t,1)}O(){const t=this.L[0],e=this.L[1],n=t[4],s=e[4],r=[],o=[];let i,c,a,h;for(let t=0;256>t;t++)o[(r[t]=t<<1^283*(t>>7))^t]=t;for(let l=i=0;!n[l];l^=c||1,i=o[i]||1){let o=i^i<<1^i<<2^i<<3^i<<4;o=o>>8^255&o^99,n[l]=o,s[o]=l,h=r[a=r[c=r[l]]];let u=16843009*h^65537*a^257*c^16843008*l,f=257*r[o]^16843008*o;for(let n=0;4>n;n++)t[n][l]=f=f<<24^f>>>8,e[n][o]=u=u<<24^u>>>8}for(let n=0;5>n;n++)t[n]=t[n].slice(0),e[n]=e[n].slice(0)}T(t,e){if(4!==t.length)throw new r("invalid aes block size");const n=this.v[e],s=n.length/4-2,o=[0,0,0,0],i=this.L[e],c=i[0],a=i[1],h=i[2],l=i[3],u=i[4];let f,w,p,d=t[0]^n[0],y=t[e?3:1]^n[1],m=t[2]^n[2],g=t[e?1:3]^n[3],b=4;for(let t=0;s>t;t++)f=c[d>>>24]^a[y>>16&255]^h[m>>8&255]^l[255&g]^n[b],w=c[y>>>24]^a[m>>16&255]^h[g>>8&255]^l[255&d]^n[b+1],p=c[m>>>24]^a[g>>16&255]^h[d>>8&255]^l[255&y]^n[b+2],g=c[g>>>24]^a[d>>16&255]^h[y>>8&255]^l[255&m]^n[b+3],b+=4,d=f,y=w,m=p;for(let t=0;4>t;t++)o[e?3&-t:t]=u[d>>>24]<<24^u[y>>16&255]<<16^u[m>>8&255]<<8^u[255&g]^n[b++],f=d,d=y,y=m,m=g,g=f;return o}},J=class{constructor(t,e){this.j=t,this.H=e,this.Z=e}reset(){this.Z=this.H}update(t){return this.F(this.j,t,this.Z)}N(t){if(255&~(t>>24))t+=1<<24;else{let e=t>>16&255,n=t>>8&255,s=255&t;255===e?(e=0,255===n?(n=0,255===s?s=0:++s):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=s}return t}q(t){0===(t[0]=this.N(t[0]))&&(t[1]=this.N(t[1]))}F(t,e,n){let s;if(!(s=e.length))return[];const r=A.h(e);for(let r=0;s>r;r+=4){this.q(n);const s=t.encrypt(n);e[r]^=s[0],e[r+1]^=s[1],e[r+2]^=s[2],e[r+3]^=s[3]}return A.l(e,r)}},Q=P._;let X=Z&&N&&typeof F.importKey==C,Y=Z&&N&&typeof F.deriveBits==C;class $ extends d{constructor({password:t,rawPassword:n,signed:s,encryptionStrength:i,checkPasswordOnly:c}){super({start(){e.assign(this,{ready:new u(t=>this.G=t),password:st(t,n),signed:s,J:i-1,pending:new o})},async transform(t,e){const n=this,{password:s,J:i,G:a,ready:h}=n;s?(await(async(t,e,n,s)=>{const o=await nt(t,e,n,ot(s,0,O[e])),i=ot(s,O[e]);if(o[0]!=i[0]||o[1]!=i[1])throw new r(V)})(n,i,s,ot(t,0,O[i]+2)),t=ot(t,O[i]+2),c?e.error(new r(B)):a()):await h;const l=new o(t.length-j-(t.length-j)%M);e.enqueue(et(n,t,l,0,j,!0))},async flush(t){const{signed:e,X:n,Y:s,pending:i,ready:c}=this;if(s&&n){await c;const a=ot(i,0,i.length-j),h=ot(i,i.length-j);let l=new o;if(a.length){const t=ct(q,a);s.update(t);const e=n.update(t);l=it(q,e)}if(e){const t=ot(it(q,s.digest()),0,j);for(let e=0;j>e;e++)if(t[e]!=h[e])throw new r(_)}t.enqueue(l)}}})}}class tt extends d{constructor({password:t,rawPassword:n,encryptionStrength:s}){let r;super({start(){e.assign(this,{ready:new u(t=>this.G=t),password:st(t,n),J:s-1,pending:new o})},async transform(t,e){const n=this,{password:s,J:r,G:i,ready:c}=n;let a=new o;s?(a=await(async(t,e,n)=>{const s=D(new o(O[e]));return rt(s,await nt(t,e,n,s))})(n,r,s),i()):await c;const h=new o(a.length+t.length-t.length%M);h.set(a,0),e.enqueue(et(n,t,h,a.length,0))},async flush(t){const{X:e,Y:n,pending:s,ready:i}=this;if(n&&e){await i;let c=new o;if(s.length){const t=e.update(ct(q,s));n.update(t),c=it(q,t)}r.signature=it(q,n.digest()).slice(0,j),t.enqueue(rt(c,r.signature))}}}),r=this}}function et(t,e,n,s,r,i){const{X:c,Y:a,pending:h}=t,l=e.length-r;let u;for(h.length&&(e=rt(h,e),n=((t,e)=>{if(e&&e>t.length){const n=t;(t=new o(e)).set(n,0)}return t})(n,l-l%M)),u=0;l-M>=u;u+=M){const t=ct(q,ot(e,u,u+M));i&&a.update(t);const r=c.update(t);i||a.update(r),n.set(it(q,r),u+s)}return t.pending=ot(e,u),n}async function nt(n,s,r,i){n.password=null;const c=await(async(t,e,n,s,r)=>{if(!X)return P.importKey(e);try{return await F.importKey("raw",e,n,!1,r)}catch(t){return X=!1,P.importKey(e)}})(0,r,W,0,L),a=await(async(t,e,n)=>{if(!Y)return P.B(e,t.salt,E.iterations,n);try{return await F.deriveBits(t,e,n)}catch(s){return Y=!1,P.B(e,t.salt,E.iterations,n)}})(e.assign({salt:i},E),c,8*(2*T[s]+2)),h=new o(a),l=ct(q,ot(h,0,T[s])),u=ct(q,ot(h,T[s],2*T[s])),f=ot(h,2*T[s]);return e.assign(n,{keys:{key:l,$:u,passwordVerification:f},X:new J(new G(l),t.from(H)),Y:new Q(u)}),f}function st(t,e){return void 0===e?(t=>{if(typeof f==z){const e=new o((t=unescape(encodeURIComponent(t))).length);for(let n=0;n<e.length;n++)e[n]=t.charCodeAt(n);return e}return(new f).encode(t)})(t):e}function rt(t,e){let n=t;return t.length+e.length&&(n=new o(t.length+e.length),n.set(t,0),n.set(e,t.length)),n}function ot(t,e,n){return t.subarray(e,n)}function it(t,e){return t.p(e)}function ct(t,e){return t.m(e)}class at extends d{constructor({password:t,passwordVerification:n,checkPasswordOnly:s}){super({start(){e.assign(this,{password:t,passwordVerification:n}),ft(this,t)},transform(t,e){const n=this;if(n.password){const e=lt(n,t.subarray(0,12));if(n.password=null,e.at(-1)!=n.passwordVerification)throw new r(V);t=t.subarray(12)}s?e.error(new r(B)):e.enqueue(lt(n,t))}})}}class ht extends d{constructor({password:t,passwordVerification:n}){super({start(){e.assign(this,{password:t,passwordVerification:n}),ft(this,t)},transform(t,e){const n=this;let s,r;if(n.password){n.password=null;const e=D(new o(12));e[11]=n.passwordVerification,s=new o(t.length+e.length),s.set(ut(n,e),0),r=12}else s=new o(t.length),r=0;s.set(ut(n,t),r),e.enqueue(s)}})}}function lt(t,e){const n=new o(e.length);for(let s=0;s<e.length;s++)n[s]=pt(t)^e[s],wt(t,n[s]);return n}function ut(t,e){const n=new o(e.length);for(let s=0;s<e.length;s++)n[s]=pt(t)^e[s],wt(t,e[s]);return n}function ft(t,n){const s=[305419896,591751049,878082192];e.assign(t,{keys:s,tt:new v(s[0]),et:new v(s[2])});for(let e=0;e<n.length;e++)wt(t,n.charCodeAt(e))}function wt(t,e){let[n,r,o]=t.keys;t.tt.append([e]),n=~t.tt.get(),r=yt(s.imul(yt(r+dt(n)),134775813)+1),t.et.append([r>>>24]),o=~t.et.get(),t.keys=[n,r,o]}function pt(t){const e=2|t.keys[2];return dt(s.imul(e,1^e)>>>8)}function dt(t){return 255&t}function yt(t){return 4294967295&t}class mt extends d{constructor(t,{chunkSize:e,nt:n,CompressionStream:s}){super({});const{compressed:r,encrypted:o,useCompressionStream:i,zipCrypto:c,signed:a,level:h}=t,u=this;let f,w,p=super.readable;o&&!c||!a||(f=new k,p=vt(p,f)),r&&(p=St(p,i,{level:h,chunkSize:e},s,n,s)),o&&(c?p=vt(p,new ht(t)):(w=new tt(t),p=vt(p,w))),bt(u,p,()=>{let t;o&&!c&&(t=w.signature),o&&!c||!a||(t=new l(f.value.buffer).getUint32(0)),u.signature=t})}}class gt extends d{constructor(t,{chunkSize:e,st:n,DecompressionStream:s}){super({});const{zipCrypto:o,encrypted:i,signed:c,signature:a,compressed:h,useCompressionStream:u,rt:f}=t;let w,p,d=super.readable;i&&(o?d=vt(d,new at(t)):(p=new $(t),d=vt(d,p))),h&&(d=St(d,u,{chunkSize:e,rt:f},s,n,s)),i&&!o||!c||(w=new k,d=vt(d,w)),bt(this,d,()=>{if((!i||o)&&c){const t=new l(w.value.buffer);if(a!=t.getUint32(0,!1))throw new r(_)}})}}function bt(t,n,s){n=vt(n,new d({flush:s})),e.defineProperty(t,"readable",{get:()=>n})}function St(t,e,n,s,r,o){const i=e&&s?s:r||o,c=n.rt?"deflate64-raw":"deflate-raw";try{t=vt(t,new i(c,n))}catch(s){if(!e)throw s;if(r)t=vt(t,new r(c,n));else{if(!o)throw s;t=vt(t,new o(c,n))}}return t}function vt(t,e){return t.pipeThrough(e)}const kt="data",zt="close";class Ct extends d{constructor(t,n){super({});const s=this,{codecType:o}=t;let i;o.startsWith("deflate")?i=mt:o.startsWith("inflate")&&(i=gt),s.outputSize=0;let c=0;const a=new i(t,n),h=super.readable,l=new d({transform(t,e){t&&t.length&&(c+=t.length,e.enqueue(t))},flush(){e.assign(s,{inputSize:c})}}),u=new d({transform(e,n){if(e&&e.length&&(n.enqueue(e),s.outputSize+=e.length,t.outputSize&&s.outputSize>t.outputSize))throw new r("Invalid uncompressed size")},flush(){const{signature:t}=a;e.assign(s,{signature:t,inputSize:c})}});e.defineProperty(s,"readable",{get:()=>h.pipeThrough(l).pipeThrough(a).pipeThrough(u)})}}class At extends d{constructor(t){let e;super({transform:function n(s,r){if(e){const t=new o(e.length+s.length);t.set(e),t.set(s,e.length),s=t,e=null}s.length>t?(r.enqueue(s.slice(0,t)),n(s.slice(t),r)):e=s},flush(t){e&&e.length&&t.enqueue(e)}})}}let xt,It,Rt,Pt;function Ut(t,e,n={}){const i="number"==typeof n.level?n.level:-1,c="number"==typeof n.ot?n.ot:65536,a="number"==typeof n.it?n.it:65536;return new d({start(){let n;if(this.ct=It(c),this.in=It(a),this.it=a,this.ht=new o(c),t?(this.lt=xt.deflate_process,this.ut=xt.deflate_last_consumed,this.ft=xt.deflate_end,this.wt=xt.deflate_new(),n="gzip"===e?xt.deflate_init_gzip(this.wt,i):"deflate-raw"===e?xt.deflate_init_raw(this.wt,i):xt.deflate_init(this.wt,i)):"deflate64-raw"===e?(this.lt=xt.inflate9_process,this.ut=xt.inflate9_last_consumed,this.ft=xt.inflate9_end,this.wt=xt.inflate9_new(),n=xt.inflate9_init_raw(this.wt)):(this.lt=xt.inflate_process,this.ut=xt.inflate_last_consumed,this.ft=xt.inflate_end,this.wt=xt.inflate_new(),n="deflate-raw"===e?xt.inflate_init_raw(this.wt):"gzip"===e?xt.inflate_init_gzip(this.wt):xt.inflate_init(this.wt)),0!==n)throw new r("init failed:"+n)},transform(e,n){try{const i=e,a=new o(Pt.buffer),h=this.lt,l=this.ut,u=this.ct,f=this.ht;let w=0;for(;w<i.length;){const e=s.min(i.length-w,32768);this.in&&this.it>=e||(this.in&&Rt&&Rt(this.in),this.in=It(e),this.it=e),a.set(i.subarray(w,w+e),this.in);const o=h(this.wt,this.in,e,u,c,0);if(!t&&0>o)throw new r("process error:"+o);const p=16777215&o;p&&(f.set(a.subarray(u,u+p),0),n.enqueue(f.slice(0,p)));const d=l(this.wt);if(0===d)break;w+=d}}catch(t){this.ft&&this.wt&&this.ft(this.wt),this.in&&Rt&&Rt(this.in),this.ct&&Rt&&Rt(this.ct),n.error(t)}},flush(e){try{const n=new o(Pt.buffer),s=this.lt,i=this.ct,a=this.ht;for(;;){const o=s(this.wt,0,0,i,c,4);if(!t&&0>o)throw new r("process error:"+o);const h=16777215&o,l=o>>24&255;if(h&&(a.set(n.subarray(i,i+h),0),e.enqueue(a.slice(0,h))),1===l||0===h)break}}catch(t){e.error(t)}finally{if(this.ft&&this.wt){const t=this.ft(this.wt);0!==t&&e.error(new r("end error:"+t))}this.in&&Rt&&Rt(this.in),this.ct&&Rt&&Rt(this.ct)}}})}class Vt{constructor(t="deflate",e){return Ut(!0,t,e)}}class _t{constructor(t="deflate",e){return Ut(!1,t,e)}}let Bt=!1;const Dt=new h,Mt=new h;let Kt,Wt=0;async function Et(t){try{const{options:e,config:s}=t;Bt||e.useCompressionStream||await(async(t,{baseURI:e})=>{if(!Bt){let s,r;try{try{r=new URL(t,e)}catch(t){}const n=await fetch(r);s=await n.arrayBuffer()}catch(e){if(!t.startsWith("data:application/wasm;base64,"))throw e;s=(t=>{const e=t.split(",")[1],n=atob(e),s=n.length,r=new o(s);for(let t=0;s>t;++t)r[t]=n.charCodeAt(t);return r.buffer})(t)}n=(await WebAssembly.instantiate(s)).instance.exports,xt=n,({malloc:It,free:Rt,memory:Pt}=xt),Bt=!0}var n})(t.config.wasmURI,t.config),s.CompressionStream=self.CompressionStream,s.DecompressionStream=self.DecompressionStream,s.nt=Vt,s.st=_t;const r={highWaterMark:1},i=t.readable||new y({async pull(t){const e=new u(t=>Dt.set(Wt,t));Lt({type:"pull",messageId:Wt}),Wt=(Wt+1)%n.MAX_SAFE_INTEGER;const{value:s,done:r}=await e;t.enqueue(s),r&&t.close()}},r),c=t.writable||new m({async write(t){let e;const s=new u(t=>e=t);Mt.set(Wt,e),Lt({type:kt,value:t,messageId:Wt}),Wt=(Wt+1)%n.MAX_SAFE_INTEGER,await s}},r),a=new Ct(e,s);Kt=new AbortController;const{signal:h}=Kt;await i.pipeThrough(a).pipeThrough(new At(s.chunkSize)).pipeTo(c,{signal:h,preventClose:!0,preventAbort:!0}),await c.getWriter().close();const{signature:l,inputSize:f,outputSize:w}=a;Lt({type:zt,result:{signature:l,inputSize:f,outputSize:w}})}catch(t){t.outputSize=0,Ot(t)}}function Lt(t){let{value:e}=t;if(e)if(e.length)try{e=new o(e),t.value=e.buffer,p(t,[t.value])}catch(e){p(t)}else p(t);else p(t)}function Ot(t=new r("Unknown error")){const{message:e,stack:n,code:s,name:o,outputSize:i}=t;p({error:{message:e,stack:n,code:s,name:o,outputSize:i}})}addEventListener("message",({data:t})=>{const{type:e,messageId:n,value:s,done:r}=t;try{if("start"==e&&Et(t),e==kt){const t=Dt.get(n);Dt.delete(n),t({value:new o(s),done:r})}if("ack"==e){const t=Mt.get(n);Mt.delete(n),t()}e==zt&&Kt.abort()}catch(t){Ot(t)}})});\n')})}export{t as configureWebWorker};
1
+ function t(t){t({workerURI:()=>"data:text/javascript,"+encodeURIComponent('(t=>{"function"==typeof define&&define.amd?define(t):t()})(function(){"use strict";const{Array:t,Object:e,Number:n,Math:s,Error:r,Uint8Array:o,Uint16Array:i,Uint32Array:c,Int32Array:a,Map:h,DataView:l,Promise:u,TextEncoder:f,crypto:w,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:g,DecompressionStream:b}=self,S=void 0,v="undefined",k="function",z=[];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)1&e?e=e>>>1^3988292384:e>>>=1;z[t]=e}class C{constructor(t){this.t=t||-1}append(t){let e=0|this.t;for(let n=0,s=0|t.length;s>n;n++)e=e>>>8^z[255&(e^t[n])];this.t=e}get(){return~this.t}}class A extends d{constructor(){let t;const e=new C;super({transform(t,n){e.append(t),n.enqueue(t)},flush(){const n=new o(4);new l(n.buffer).setUint32(0,e.get()),t.value=n}}),t=this}}const x={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const n=t[t.length-1],s=x.o(n);return 32===s?t.concat(e):x.i(e,s,0|n,t.slice(0,t.length-1))},h(t){const e=t.length;if(0===e)return 0;const n=t[e-1];return 32*(e-1)+x.o(n)},l(t,e){if(32*t.length<e)return t;const n=(t=t.slice(0,s.ceil(e/32))).length;return e&=31,n>0&&e&&(t[n-1]=x.u(e,t[n-1]&2147483648>>e-1,1)),t},u:(t,e,n)=>32===t?e:(n?0|e:e<<32-t)+1099511627776*t,o:t=>s.round(t/1099511627776)||32,i(t,e,n,s){for(void 0===s&&(s=[]);e>=32;e-=32)s.push(n),n=0;if(0===e)return s.concat(t);for(let r=0;r<t.length;r++)s.push(n|t[r]>>>e),n=t[r]<<32-e;const r=t.length?t[t.length-1]:0,o=x.o(r);return s.push(x.u(e+o&31,e+o>32?n:s.pop(),1)),s}},I={bytes:{p(t){const e=x.h(t)/8,n=new o(e);let s;for(let r=0;e>r;r++)3&r||(s=t[r/4]),n[r]=s>>>24,s<<=8;return n},m(t){const e=[];let n,s=0;for(n=0;n<t.length;n++)s=s<<8|t[n],3&~n||(e.push(s),s=0);return 3&n&&e.push(x.u(8*(3&n),s)),e}}},R=class{constructor(t){const e=this;e.blockSize=512,e.S=[1732584193,4023233417,2562383102,271733878,3285377520],e.v=[1518500249,1859775393,2400959708,3395469782],t?(e.k=t.k.slice(0),e.C=t.C.slice(0),e.A=t.A):e.reset()}reset(){const t=this;return t.k=t.S.slice(0),t.C=[],t.A=0,t}update(t){const e=this;"string"==typeof t&&(t=I.I.m(t));const n=e.C=x.concat(e.C,t),s=e.A,o=e.A=s+x.h(t);if(o>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const i=new c(n);let a=0;for(let t=e.blockSize+s-(e.blockSize+s&e.blockSize-1);o>=t;t+=e.blockSize)e.R(i.subarray(16*a,16*(a+1))),a+=1;return n.splice(0,16*a),e}P(){const t=this;let e=t.C;const n=t.k;e=x.concat(e,[x.u(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(s.floor(t.A/4294967296)),e.push(0|t.A);e.length;)t.R(e.splice(0,16));return t.reset(),n}U(t,e,n,s){return t>19?t>39?t>59?t>79?void 0:e^n^s:e&n|e&s|n&s:e^n^s:e&n|~e&s}V(t,e){return e<<t|e>>>32-t}R(e){const n=this,r=n.k,o=t(80);for(let t=0;16>t;t++)o[t]=e[t];let i=r[0],c=r[1],a=r[2],h=r[3],l=r[4];for(let t=0;79>=t;t++){16>t||(o[t]=n.V(1,o[t-3]^o[t-8]^o[t-14]^o[t-16]));const e=n.V(5,i)+n.U(t,c,a,h)+l+o[t]+n.v[s.floor(t/20)]|0;l=h,h=a,a=n.V(30,c),c=i,i=e}r[0]=r[0]+i|0,r[1]=r[1]+c|0,r[2]=r[2]+a|0,r[3]=r[3]+h|0,r[4]=r[4]+l|0}},P={getRandomValues(t){const e=new c(t.buffer),n=t=>{let e=987654321;const n=4294967295;return()=>(e=36969*(65535&e)+(e>>16)&n,(((e<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n)/4294967296+.5)*(s.random()>.5?1:-1))};for(let r,o=0;o<t.length;o+=4){const t=n(4294967296*(r||s.random()));r=987654071*t(),e[o/4]=4294967296*t()|0}return t}},U={importKey:t=>new U._(I.bytes.m(t)),B(t,e,n,s){if(n=n||1e4,0>s||0>n)throw new r("invalid params to pbkdf2");const o=1+(s>>5)<<2;let i,c,a,h,u;const f=new ArrayBuffer(o),w=new l(f);let p=0;const d=x;for(e=I.bytes.m(e),u=1;(o||1)>p;u++){for(i=c=t.encrypt(d.concat(e,[u])),a=1;n>a;a++)for(c=t.encrypt(c),h=0;h<c.length;h++)i[h]^=c[h];for(a=0;(o||1)>p&&a<i.length;a++)w.setInt32(p,i[a]),p+=4}return f.slice(0,s/8)},_:class{constructor(t){const e=this,n=e.D=R,s=[[],[]];e.M=[new n,new n];const r=e.M[0].blockSize/32;t.length>r&&(t=(new n).update(t).P());for(let e=0;r>e;e++)s[0][e]=909522486^t[e],s[1][e]=1549556828^t[e];e.M[0].update(s[0]),e.M[1].update(s[1]),e.K=new n(e.M[0])}reset(){const t=this;t.K=new t.D(t.M[0]),t.W=!1}update(t){this.W=!0,this.K.update(t)}digest(){const t=this,e=t.K.P(),n=new t.D(t.M[1]).update(e).P();return t.reset(),n}encrypt(t){if(this.W)throw new r("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},V=typeof w!=v&&typeof w.getRandomValues==k,_="Invalid password",B="Invalid signature",D="zipjs-abort-check-password";function M(t){return V?w.getRandomValues(t):P.getRandomValues(t)}const K=16,W={name:"PBKDF2"},E=e.assign({hash:{name:"HMAC"}},W),L=e.assign({iterations:1e3,hash:{name:"SHA-1"}},W),O=["deriveBits"],T=[8,12,16],j=[16,24,32],H=10,Z=[0,0,0,0],F=typeof w!=v,N=F&&w.subtle,q=F&&typeof N!=v,G=I.bytes,J=class{constructor(t){const e=this;e.L=[[[],[],[],[],[]],[[],[],[],[],[]]],e.L[0][0][0]||e.O();const n=e.L[0][4],s=e.L[1],o=t.length;let i,c,a,h=1;if(4!==o&&6!==o&&8!==o)throw new r("invalid aes key size");for(e.v=[c=t.slice(0),a=[]],i=o;4*o+28>i;i++){let t=c[i-1];(i%o===0||8===o&&i%o===4)&&(t=n[t>>>24]<<24^n[t>>16&255]<<16^n[t>>8&255]<<8^n[255&t],i%o===0&&(t=t<<8^t>>>24^h<<24,h=h<<1^283*(h>>7))),c[i]=c[i-o]^t}for(let t=0;i;t++,i--){const e=c[3&t?i:i-4];a[t]=4>=i||4>t?e:s[0][n[e>>>24]]^s[1][n[e>>16&255]]^s[2][n[e>>8&255]]^s[3][n[255&e]]}}encrypt(t){return this.T(t,0)}decrypt(t){return this.T(t,1)}O(){const t=this.L[0],e=this.L[1],n=t[4],s=e[4],r=[],o=[];let i,c,a,h;for(let t=0;256>t;t++)o[(r[t]=t<<1^283*(t>>7))^t]=t;for(let l=i=0;!n[l];l^=c||1,i=o[i]||1){let o=i^i<<1^i<<2^i<<3^i<<4;o=o>>8^255&o^99,n[l]=o,s[o]=l,h=r[a=r[c=r[l]]];let u=16843009*h^65537*a^257*c^16843008*l,f=257*r[o]^16843008*o;for(let n=0;4>n;n++)t[n][l]=f=f<<24^f>>>8,e[n][o]=u=u<<24^u>>>8}for(let n=0;5>n;n++)t[n]=t[n].slice(0),e[n]=e[n].slice(0)}T(t,e){if(4!==t.length)throw new r("invalid aes block size");const n=this.v[e],s=n.length/4-2,o=[0,0,0,0],i=this.L[e],c=i[0],a=i[1],h=i[2],l=i[3],u=i[4];let f,w,p,d=t[0]^n[0],y=t[e?3:1]^n[1],m=t[2]^n[2],g=t[e?1:3]^n[3],b=4;for(let t=0;s>t;t++)f=c[d>>>24]^a[y>>16&255]^h[m>>8&255]^l[255&g]^n[b],w=c[y>>>24]^a[m>>16&255]^h[g>>8&255]^l[255&d]^n[b+1],p=c[m>>>24]^a[g>>16&255]^h[d>>8&255]^l[255&y]^n[b+2],g=c[g>>>24]^a[d>>16&255]^h[y>>8&255]^l[255&m]^n[b+3],b+=4,d=f,y=w,m=p;for(let t=0;4>t;t++)o[e?3&-t:t]=u[d>>>24]<<24^u[y>>16&255]<<16^u[m>>8&255]<<8^u[255&g]^n[b++],f=d,d=y,y=m,m=g,g=f;return o}},Q=class{constructor(t,e){this.j=t,this.H=e,this.Z=e}reset(){this.Z=this.H}update(t){return this.F(this.j,t,this.Z)}N(t){if(255&~(t>>24))t+=1<<24;else{let e=t>>16&255,n=t>>8&255,s=255&t;255===e?(e=0,255===n?(n=0,255===s?s=0:++s):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=s}return t}q(t){0===(t[0]=this.N(t[0]))&&(t[1]=this.N(t[1]))}F(t,e,n){let s;if(!(s=e.length))return[];const r=x.h(e);for(let r=0;s>r;r+=4){this.q(n);const s=t.encrypt(n);e[r]^=s[0],e[r+1]^=s[1],e[r+2]^=s[2],e[r+3]^=s[3]}return x.l(e,r)}},X=U._;let Y=F&&q&&typeof N.importKey==k,$=F&&q&&typeof N.deriveBits==k;class tt extends d{constructor({password:t,rawPassword:n,signed:s,encryptionStrength:i,checkPasswordOnly:c}){super({start(){e.assign(this,{ready:new u(t=>this.G=t),password:rt(t,n),signed:s,J:i-1,pending:new o})},async transform(t,e){const n=this,{password:s,J:i,G:a,ready:h}=n;s?(await(async(t,e,n,s)=>{const o=await st(t,e,n,it(s,0,T[e])),i=it(s,T[e]);if(o[0]!=i[0]||o[1]!=i[1])throw new r(_)})(n,i,s,it(t,0,T[i]+2)),t=it(t,T[i]+2),c?e.error(new r(D)):a()):await h;const l=new o(t.length-H-(t.length-H)%K);e.enqueue(nt(n,t,l,0,H,!0))},async flush(t){const{signed:e,X:n,Y:s,pending:i,ready:c}=this;if(s&&n){await c;const a=it(i,0,i.length-H),h=it(i,i.length-H);let l=new o;if(a.length){const t=at(G,a);s.update(t);const e=n.update(t);l=ct(G,e)}if(e){const t=it(ct(G,s.digest()),0,H);for(let e=0;H>e;e++)if(t[e]!=h[e])throw new r(B)}t.enqueue(l)}}})}}class et extends d{constructor({password:t,rawPassword:n,encryptionStrength:s}){let r;super({start(){e.assign(this,{ready:new u(t=>this.G=t),password:rt(t,n),J:s-1,pending:new o})},async transform(t,e){const n=this,{password:s,J:r,G:i,ready:c}=n;let a=new o;s?(a=await(async(t,e,n)=>{const s=M(new o(T[e]));return ot(s,await st(t,e,n,s))})(n,r,s),i()):await c;const h=new o(a.length+t.length-t.length%K);h.set(a,0),e.enqueue(nt(n,t,h,a.length,0))},async flush(t){const{X:e,Y:n,pending:s,ready:i}=this;if(n&&e){await i;let c=new o;if(s.length){const t=e.update(at(G,s));n.update(t),c=ct(G,t)}r.signature=ct(G,n.digest()).slice(0,H),t.enqueue(ot(c,r.signature))}}}),r=this}}function nt(t,e,n,s,r,i){const{X:c,Y:a,pending:h}=t,l=e.length-r;let u;for(h.length&&(e=ot(h,e),n=((t,e)=>{if(e&&e>t.length){const n=t;(t=new o(e)).set(n,0)}return t})(n,l-l%K)),u=0;l-K>=u;u+=K){const t=at(G,it(e,u,u+K));i&&a.update(t);const r=c.update(t);i||a.update(r),n.set(ct(G,r),u+s)}return t.pending=it(e,u),n}async function st(n,s,r,i){n.password=null;const c=await(async(t,e,n,s,r)=>{if(!Y)return U.importKey(e);try{return await N.importKey("raw",e,n,!1,r)}catch(t){return Y=!1,U.importKey(e)}})(0,r,E,0,O),a=await(async(t,e,n)=>{if(!$)return U.B(e,t.salt,L.iterations,n);try{return await N.deriveBits(t,e,n)}catch(s){return $=!1,U.B(e,t.salt,L.iterations,n)}})(e.assign({salt:i},L),c,8*(2*j[s]+2)),h=new o(a),l=at(G,it(h,0,j[s])),u=at(G,it(h,j[s],2*j[s])),f=it(h,2*j[s]);return e.assign(n,{keys:{key:l,$:u,passwordVerification:f},X:new Q(new J(l),t.from(Z)),Y:new X(u)}),f}function rt(t,e){return e===S?(t=>{if(typeof f==v){const e=new o((t=unescape(encodeURIComponent(t))).length);for(let n=0;n<e.length;n++)e[n]=t.charCodeAt(n);return e}return(new f).encode(t)})(t):e}function ot(t,e){let n=t;return t.length+e.length&&(n=new o(t.length+e.length),n.set(t,0),n.set(e,t.length)),n}function it(t,e,n){return t.subarray(e,n)}function ct(t,e){return t.p(e)}function at(t,e){return t.m(e)}class ht extends d{constructor({password:t,passwordVerification:n,checkPasswordOnly:s}){super({start(){e.assign(this,{password:t,passwordVerification:n}),wt(this,t)},transform(t,e){const n=this;if(n.password){const e=ut(n,t.subarray(0,12));if(n.password=null,e.at(-1)!=n.passwordVerification)throw new r(_);t=t.subarray(12)}s?e.error(new r(D)):e.enqueue(ut(n,t))}})}}class lt extends d{constructor({password:t,passwordVerification:n}){super({start(){e.assign(this,{password:t,passwordVerification:n}),wt(this,t)},transform(t,e){const n=this;let s,r;if(n.password){n.password=null;const e=M(new o(12));e[11]=n.passwordVerification,s=new o(t.length+e.length),s.set(ft(n,e),0),r=12}else s=new o(t.length),r=0;s.set(ft(n,t),r),e.enqueue(s)}})}}function ut(t,e){const n=new o(e.length);for(let s=0;s<e.length;s++)n[s]=dt(t)^e[s],pt(t,n[s]);return n}function ft(t,e){const n=new o(e.length);for(let s=0;s<e.length;s++)n[s]=dt(t)^e[s],pt(t,e[s]);return n}function wt(t,n){const s=[305419896,591751049,878082192];e.assign(t,{keys:s,tt:new C(s[0]),et:new C(s[2])});for(let e=0;e<n.length;e++)pt(t,n.charCodeAt(e))}function pt(t,e){let[n,r,o]=t.keys;t.tt.append([e]),n=~t.tt.get(),r=mt(s.imul(mt(r+yt(n)),134775813)+1),t.et.append([r>>>24]),o=~t.et.get(),t.keys=[n,r,o]}function dt(t){const e=2|t.keys[2];return yt(s.imul(e,1^e)>>>8)}function yt(t){return 255&t}function mt(t){return 4294967295&t}class gt extends d{constructor(t,{chunkSize:e,nt:n,CompressionStream:s}){super({});const{compressed:r,encrypted:o,useCompressionStream:i,zipCrypto:c,signed:a,level:h}=t,u=this;let f,w,p=super.readable;o&&!c||!a||(f=new A,p=kt(p,f)),r&&(p=vt(p,i,{level:h,chunkSize:e},s,n,s)),o&&(c?p=kt(p,new lt(t)):(w=new et(t),p=kt(p,w))),St(u,p,()=>{let t;o&&!c&&(t=w.signature),o&&!c||!a||(t=new l(f.value.buffer).getUint32(0)),u.signature=t})}}class bt extends d{constructor(t,{chunkSize:e,st:n,DecompressionStream:s}){super({});const{zipCrypto:o,encrypted:i,signed:c,signature:a,compressed:h,useCompressionStream:u,rt:f}=t;let w,p,d=super.readable;i&&(o?d=kt(d,new ht(t)):(p=new tt(t),d=kt(d,p))),h&&(d=vt(d,u,{chunkSize:e,rt:f},s,n,s)),i&&!o||!c||(w=new A,d=kt(d,w)),St(this,d,()=>{if((!i||o)&&c){const t=new l(w.value.buffer);if(a!=t.getUint32(0,!1))throw new r(B)}})}}function St(t,n,s){n=kt(n,new d({flush:s})),e.defineProperty(t,"readable",{get:()=>n})}function vt(t,e,n,s,r,o){const i=e&&s?s:r||o,c=n.rt?"deflate64-raw":"deflate-raw";try{t=kt(t,new i(c,n))}catch(s){if(!e)throw s;if(r)t=kt(t,new r(c,n));else{if(!o)throw s;t=kt(t,new o(c,n))}}return t}function kt(t,e){return t.pipeThrough(e)}const zt="data",Ct="close";class At extends d{constructor(t,n){super({});const s=this,{codecType:o}=t;let i;o.startsWith("deflate")?i=gt:o.startsWith("inflate")&&(i=bt),s.outputSize=0;let c=0;const a=new i(t,n),h=super.readable,l=new d({transform(t,e){t&&t.length&&(c+=t.length,e.enqueue(t))},flush(){e.assign(s,{inputSize:c})}}),u=new d({transform(e,n){if(e&&e.length&&(n.enqueue(e),s.outputSize+=e.length,t.outputSize!==S&&s.outputSize>t.outputSize))throw new r("Invalid uncompressed size")},flush(){const{signature:t}=a;e.assign(s,{signature:t,inputSize:c})}});e.defineProperty(s,"readable",{get:()=>h.pipeThrough(l).pipeThrough(a).pipeThrough(u)})}}class xt extends d{constructor(t){let e;super({transform:function n(s,r){if(e){const t=new o(e.length+s.length);t.set(e),t.set(s,e.length),s=t,e=null}s.length>t?(r.enqueue(s.slice(0,t)),n(s.slice(t),r)):e=s},flush(t){e&&e.length&&t.enqueue(e)}})}}let It,Rt,Pt,Ut;function Vt(t,e,n={}){const i="number"==typeof n.level?n.level:-1,c="number"==typeof n.ot?n.ot:65536,a="number"==typeof n.it?n.it:65536;return new d({start(){let n;if(this.ct=Rt(c),this.in=Rt(a),this.it=a,this.ht=new o(c),t?(this.lt=It.deflate_process,this.ut=It.deflate_last_consumed,this.ft=It.deflate_end,this.wt=It.deflate_new(),n="gzip"===e?It.deflate_init_gzip(this.wt,i):"deflate-raw"===e?It.deflate_init_raw(this.wt,i):It.deflate_init(this.wt,i)):"deflate64-raw"===e?(this.lt=It.inflate9_process,this.ut=It.inflate9_last_consumed,this.ft=It.inflate9_end,this.wt=It.inflate9_new(),n=It.inflate9_init_raw(this.wt)):(this.lt=It.inflate_process,this.ut=It.inflate_last_consumed,this.ft=It.inflate_end,this.wt=It.inflate_new(),n="deflate-raw"===e?It.inflate_init_raw(this.wt):"gzip"===e?It.inflate_init_gzip(this.wt):It.inflate_init(this.wt)),0!==n)throw new r("init failed:"+n)},transform(e,n){try{const i=e,a=new o(Ut.buffer),h=this.lt,l=this.ut,u=this.ct,f=this.ht;let w=0;for(;w<i.length;){const e=s.min(i.length-w,32768);this.in&&this.it>=e||(this.in&&Pt&&Pt(this.in),this.in=Rt(e),this.it=e),a.set(i.subarray(w,w+e),this.in);const o=h(this.wt,this.in,e,u,c,0);if(!t&&0>o)throw new r("process error:"+o);const p=16777215&o;p&&(f.set(a.subarray(u,u+p),0),n.enqueue(f.slice(0,p)));const d=l(this.wt);if(0===d)break;w+=d}}catch(t){this.ft&&this.wt&&this.ft(this.wt),this.in&&Pt&&Pt(this.in),this.ct&&Pt&&Pt(this.ct),n.error(t)}},flush(e){try{const n=new o(Ut.buffer),s=this.lt,i=this.ct,a=this.ht;for(;;){const o=s(this.wt,0,0,i,c,4);if(!t&&0>o)throw new r("process error:"+o);const h=16777215&o,l=o>>24&255;if(h&&(a.set(n.subarray(i,i+h),0),e.enqueue(a.slice(0,h))),1===l||0===h)break}}catch(t){e.error(t)}finally{if(this.ft&&this.wt){const t=this.ft(this.wt);0!==t&&e.error(new r("end error:"+t))}this.in&&Pt&&Pt(this.in),this.ct&&Pt&&Pt(this.ct)}}})}class _t{constructor(t="deflate",e){return Vt(!0,t,e)}}class Bt{constructor(t="deflate",e){return Vt(!1,t,e)}}let Dt=!1;const Mt=new h,Kt=new h;let Wt,Et=0;async function Lt(t){try{const{options:e,config:s}=t;Dt||e.useCompressionStream||await(async(t,{baseURI:e})=>{if(!Dt){let s,r;try{try{r=new URL(t,e)}catch(t){}const n=await fetch(r);s=await n.arrayBuffer()}catch(e){if(!t.startsWith("data:application/wasm;base64,"))throw e;s=(t=>{const e=t.split(",")[1],n=atob(e),s=n.length,r=new o(s);for(let t=0;s>t;++t)r[t]=n.charCodeAt(t);return r.buffer})(t)}n=(await WebAssembly.instantiate(s)).instance.exports,It=n,({malloc:Rt,free:Pt,memory:Ut}=It),Dt=!0}var n})(t.config.wasmURI,t.config),s.CompressionStream=self.CompressionStream,s.DecompressionStream=self.DecompressionStream,s.nt=_t,s.st=Bt;const r={highWaterMark:1},i=t.readable||new y({async pull(t){const e=new u(t=>Mt.set(Et,t));Ot({type:"pull",messageId:Et}),Et=(Et+1)%n.MAX_SAFE_INTEGER;const{value:s,done:r}=await e;t.enqueue(s),r&&t.close()}},r),c=t.writable||new m({async write(t){let e;const s=new u(t=>e=t);Kt.set(Et,e),Ot({type:zt,value:t,messageId:Et}),Et=(Et+1)%n.MAX_SAFE_INTEGER,await s}},r),a=new At(e,s);Wt=new AbortController;const{signal:h}=Wt;await i.pipeThrough(a).pipeThrough(new xt(s.chunkSize)).pipeTo(c,{signal:h,preventClose:!0,preventAbort:!0}),await c.getWriter().close();const{signature:l,inputSize:f,outputSize:w}=a;Ot({type:Ct,result:{signature:l,inputSize:f,outputSize:w}})}catch(t){t.outputSize=0,Tt(t)}}function Ot(t){let{value:e}=t;if(e)if(e.length)try{e=new o(e),t.value=e.buffer,p(t,[t.value])}catch(e){p(t)}else p(t);else p(t)}function Tt(t=new r("Unknown error")){const{message:e,stack:n,code:s,name:o,outputSize:i}=t;p({error:{message:e,stack:n,code:s,name:o,outputSize:i}})}addEventListener("message",({data:t})=>{const{type:e,messageId:n,value:s,done:r}=t;try{if("start"==e&&Lt(t),e==zt){const t=Mt.get(n);Mt.delete(n),t({value:new o(s),done:r})}if("ack"==e){const t=Kt.get(n);Kt.delete(n),t()}e==Ct&&Wt.abort()}catch(t){Tt(t)}})});\n')})}export{t as configureWebWorker};
@@ -536,7 +536,7 @@ class ZipEntry {
536
536
  encryptionStrength: extraFieldAES && extraFieldAES.strength,
537
537
  signed: getOptionValue(zipEntry, options, OPTION_CHECK_SIGNATURE) && !passThrough,
538
538
  passwordVerification: zipCrypto && (dataDescriptor ? ((rawLastModDate >>> 8) & 0xFF) : ((signature >>> 24) & 0xFF)),
539
- outputSize: uncompressedSize,
539
+ outputSize: passThrough ? compressedSize : uncompressedSize,
540
540
  signature,
541
541
  compressed: compressionMethod != 0 && !passThrough,
542
542
  encrypted: zipEntry.encrypted && !passThrough,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A JavaScript library to zip and unzip files in the browser, Deno and Node.js",
4
4
  "author": "Gildas Lormeau",
5
5
  "license": "BSD-3-Clause",
6
- "version": "2.8.1",
6
+ "version": "2.8.2",
7
7
  "type": "module",
8
8
  "keywords": [
9
9
  "zip",