@zip.js/zip.js 2.8.59 → 2.8.61

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.
Files changed (43) hide show
  1. package/deno.json +2 -2
  2. package/dist/zip-core-external.js +167 -37
  3. package/dist/zip-core-external.min.js +1 -1
  4. package/dist/zip-core.js +143 -20
  5. package/dist/zip-core.min.js +1 -1
  6. package/dist/zip-fs-core-external.js +173 -45
  7. package/dist/zip-fs-core-external.min.js +1 -1
  8. package/dist/zip-fs-core.js +5326 -3928
  9. package/dist/zip-fs-core.min.js +1 -1
  10. package/dist/zip-fs-external.js +173 -45
  11. package/dist/zip-fs-external.min.js +1 -1
  12. package/dist/zip-fs-native.js +151 -30
  13. package/dist/zip-fs-native.min.js +1 -1
  14. package/dist/zip-fs.js +176 -45
  15. package/dist/zip-fs.min.js +1 -1
  16. package/dist/zip-legacy.js +145 -22
  17. package/dist/zip-legacy.min.js +1 -1
  18. package/dist/zip-native.js +145 -22
  19. package/dist/zip-native.min.js +1 -1
  20. package/dist/zip-web-worker-native.js +1 -1
  21. package/dist/zip-web-worker.js +1 -1
  22. package/dist/zip.js +170 -37
  23. package/dist/zip.min.js +1 -1
  24. package/index-native.cjs +151 -30
  25. package/index-native.min.js +1 -1
  26. package/index.cjs +176 -45
  27. package/index.d.cts +134 -1
  28. package/index.d.ts +134 -1
  29. package/index.min.js +1 -1
  30. package/lib/core/codec-registry.js +5 -0
  31. package/lib/core/compression-methods.js +93 -0
  32. package/lib/core/streams/zip-entry-stream.js +7 -3
  33. package/lib/core/streams/zlib-wasm/zlib-streams.js +18 -8
  34. package/lib/core/version.js +31 -0
  35. package/lib/core/web-worker-inline-native.js +1 -1
  36. package/lib/core/web-worker-inline-wasm.js +1 -1
  37. package/lib/core/zip-fs.js +5 -4
  38. package/lib/core/zip-writer.js +38 -31
  39. package/lib/zip-core-base.js +7 -0
  40. package/lib/zip-fs-core.js +32 -0
  41. package/package.json +4 -3
  42. package/release.sh +47 -0
  43. package/sync-versions.js +26 -0
package/dist/zip-fs.js CHANGED
@@ -414,7 +414,7 @@
414
414
  Object.assign(config, DEFAULT_CONFIGURATION);
415
415
  }
416
416
 
417
- const t$1=new Uint8Array(288);t$1.fill(8,0,144),t$1.fill(9,144,256),t$1.fill(7,256,280),t$1.fill(8,280,288),new Uint8Array(30).fill(5);const e$1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n$1=t=>t({workerURI:t=>{const n="text/javascript";let s='!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";const{Array:t,Object:n,Number:e,Math:s,Error:r,Uint8Array:o,Uint16Array:c,Uint32Array:i,Int32Array:a,Map:f,DataView:u,Promise:l,TextEncoder:w,crypto:h,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:S,DecompressionStream:g}=self,v=void 0,b="undefined",k="function",z=new o,C=[[],[],[],[],[],[],[],[]];for(let t=0;t<256;t++){let n=t;for(let t=0;t<8;t++)n=1&n?n>>>1^3988292384:n>>>1;C[0][t]=n}for(let t=0;t<256;t++)for(let n=1;n<8;n++){const e=C[n-1][t];C[n][t]=e>>>8^C[0][255&e]}const[I,A,x,M,P,B,D,F]=C;class R{constructor(t){this.o=t||-1}append(t){let n=0|this.o;const e=0|t.length;let s=0;if(e>=8&&t.buffer){const r=new u(t.buffer,t.byteOffset,e),o=e-8;for(;s<=o;s+=8){const t=n^r.getInt32(s,!0),e=r.getInt32(s+4,!0);n=F[255&t]^D[t>>>8&255]^B[t>>>16&255]^P[t>>>24&255]^M[255&e]^x[e>>>8&255]^A[e>>>16&255]^I[e>>>24&255]}}for(;s<e;s++)n=n>>>8^I[255&(n^t[s])];this.o=n}get(){return~this.o}}class U extends d{constructor(){let t;const n=new R;super({transform(t,e){n.append(t),e.enqueue(t)},flush(){const e=new o(4);new u(e.buffer).setUint32(0,n.get()),t.value=e}}),t=this}}function W(t,n){const e=new o(t.length+n.length);return e.set(t),e.set(n,t.length),e}function _(t){return new u(t.buffer,t.byteOffset,t.byteLength)}const T={concat(t,n){if(0===t.length||0===n.length)return t.concat(n);const e=t[t.length-1],s=T.l(e);return 32===s?t.concat(n):T.h(n,s,0|e,t.slice(0,t.length-1))},bitLength(t){const n=t.length;if(0===n)return 0;const e=t[n-1];return 32*(n-1)+T.l(e)},m(t,n){if(32*t.length<n)return t;const e=(t=t.slice(0,s.ceil(n/32))).length;return n&=31,e>0&&n&&(t[e-1]=T.S(n,t[e-1]&2147483648>>n-1,1)),t},S:(t,n,e)=>32===t?n:(e?0|n:n<<32-t)+1099511627776*t,l:t=>s.round(t/1099511627776)||32,h(t,n,e,s){for(void 0===s&&(s=[]);n>=32;n-=32)s.push(e),e=0;if(0===n)return s.concat(t);for(let r=0;r<t.length;r++)s.push(e|t[r]>>>n),e=t[r]<<32-n;const r=t.length?t[t.length-1]:0,o=T.l(r);return s.push(T.S(n+o&31,n+o>32?e:s.pop(),1)),s}},V={bytes:{v(t){const n=T.bitLength(t)/8,e=new o(n);let s;for(let r=0;r<n;r++)3&r||(s=t[r/4]),e[r]=s>>>24,s<<=8;return e},C(t){const n=[];let e,s=0;for(e=0;e<t.length;e++)s=s<<8|t[e],3&~e||(n.push(s),s=0);return 3&e&&n.push(T.S(8*(3&e),s)),n}}},K=class{constructor(t){const n=this;n.blockSize=512,n.I=[1732584193,4023233417,2562383102,271733878,3285377520],n.A=[1518500249,1859775393,2400959708,3395469782],t?(n.M=t.M.slice(0),n.P=t.P.slice(0),n.B=t.B):n.reset()}reset(){const t=this;return t.M=t.I.slice(0),t.P=[],t.B=0,t}update(t){const n=this;"string"==typeof t&&(t=V.D.C(t));const e=n.P=T.concat(n.P,t),s=n.B,o=n.B=s+T.bitLength(t);if(o>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const c=new i(e);let a=0;for(let t=n.blockSize+s-(n.blockSize+s&n.blockSize-1);t<=o;t+=n.blockSize)n.F(c.subarray(16*a,16*(a+1))),a+=1;return e.splice(0,16*a),n}R(){const t=this;let n=t.P;const e=t.M;n=T.concat(n,[T.S(1,1)]);for(let t=n.length+2;15&t;t++)n.push(0);for(n.push(s.floor(t.B/4294967296)),n.push(0|t.B);n.length;)t.F(n.splice(0,16));return t.reset(),e}U(t,n,e,s){return t<=19?n&e|~n&s:t<=39?n^e^s:t<=59?n&e|n&s|e&s:t<=79?n^e^s:void 0}W(t,n){return n<<t|n>>>32-t}F(n){const e=this,r=e.M,o=t(80);for(let t=0;t<16;t++)o[t]=n[t];let c=r[0],i=r[1],a=r[2],f=r[3],u=r[4];for(let t=0;t<=79;t++){t>=16&&(o[t]=e.W(1,o[t-3]^o[t-8]^o[t-14]^o[t-16]));const n=e.W(5,c)+e.U(t,i,a,f)+u+o[t]+e.A[s.floor(t/20)]|0;u=f,f=a,a=e.W(30,i),i=c,c=n}r[0]=r[0]+c|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+f|0,r[4]=r[4]+u|0}},E={importKey:t=>new E._(V.bytes.C(t)),T(t,n,e,s){if(e=e||1e4,s<0||e<0)throw new r("invalid params to pbkdf2");const o=1+(s>>5)<<2;let c,i,a,f,l;const w=new ArrayBuffer(o),h=new u(w);let p=0;const d=T;for(n=V.bytes.C(n),l=1;p<(o||1);l++){for(c=i=t.encrypt(d.concat(n,[l])),a=1;a<e;a++)for(i=t.encrypt(i),f=0;f<i.length;f++)c[f]^=i[f];for(a=0;p<(o||1)&&a<c.length;a++)h.setInt32(p,c[a]),p+=4}return w.slice(0,s/8)},_:class{constructor(t){const n=this,e=n.V=K,s=[[],[]];n.K=[new e,new e];const r=n.K[0].blockSize/32;t.length>r&&(t=(new e).update(t).R());for(let n=0;n<r;n++)s[0][n]=909522486^t[n],s[1][n]=1549556828^t[n];n.K[0].update(s[0]),n.K[1].update(s[1]),n.L=new e(n.K[0])}reset(){const t=this;t.L=new t.V(t.K[0]),t.O=!1}update(t){this.O=!0,this.L.update(t)}digest(){const t=this,n=t.L.R(),e=new t.V(t.K[1]).update(n).R();return t.reset(),e}encrypt(t){if(this.O)throw new r("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},L=typeof h!=b&&typeof h.getRandomValues==k,O="Invalid password",j="Invalid signature",H=j,N="zipjs-abort-check-password";function q(t){if(L)return h.getRandomValues(t);throw new r("Crypto API not supported")}const G=16,J={name:"PBKDF2"},Q=n.assign({hash:{name:"HMAC"}},J),X=n.assign({iterations:1e3,hash:{name:"SHA-1"}},J),Y=["deriveBits"],Z=[8,12,16],$=[16,24,32],tt=10,nt=[0,0,0,0],et=typeof h!=b,st=et&&h.subtle,rt=et&&typeof st!=b,ot=V.bytes,ct=class{constructor(t){const n=this;n.j=[[[],[],[],[],[]],[[],[],[],[],[]]],n.j[0][0][0]||n.H();const e=n.j[0][4],s=n.j[1],o=t.length;let c,i,a,f=1;if(4!==o&&6!==o&&8!==o)throw new r("invalid aes key size");for(n.A=[i=t.slice(0),a=[]],c=o;c<4*o+28;c++){let t=i[c-1];(c%o===0||8===o&&c%o===4)&&(t=e[t>>>24]<<24^e[t>>16&255]<<16^e[t>>8&255]<<8^e[255&t],c%o===0&&(t=t<<8^t>>>24^f<<24,f=f<<1^283*(f>>7))),i[c]=i[c-o]^t}for(let t=0;c;t++,c--){const n=i[3&t?c:c-4];a[t]=c<=4||t<4?n:s[0][e[n>>>24]]^s[1][e[n>>16&255]]^s[2][e[n>>8&255]]^s[3][e[255&n]]}}encrypt(t){return this.N(t,0)}decrypt(t){return this.N(t,1)}H(){const t=this.j[0],n=this.j[1],e=t[4],s=n[4],r=[],o=[];let c,i,a,f;for(let t=0;t<256;t++)o[(r[t]=t<<1^283*(t>>7))^t]=t;for(let u=c=0;!e[u];u^=i||1,c=o[c]||1){let o=c^c<<1^c<<2^c<<3^c<<4;o=o>>8^255&o^99,e[u]=o,s[o]=u,f=r[a=r[i=r[u]]];let l=16843009*f^65537*a^257*i^16843008*u,w=257*r[o]^16843008*o;for(let e=0;e<4;e++)t[e][u]=w=w<<24^w>>>8,n[e][o]=l=l<<24^l>>>8}for(let e=0;e<5;e++)t[e]=t[e].slice(0),n[e]=n[e].slice(0)}N(t,n){if(4!==t.length)throw new r("invalid aes block size");const e=this.A[n],s=e.length/4-2,o=[0,0,0,0],c=this.j[n],i=c[0],a=c[1],f=c[2],u=c[3],l=c[4];let w,h,p,d=t[0]^e[0],y=t[n?3:1]^e[1],m=t[2]^e[2],S=t[n?1:3]^e[3],g=4;for(let t=0;t<s;t++)w=i[d>>>24]^a[y>>16&255]^f[m>>8&255]^u[255&S]^e[g],h=i[y>>>24]^a[m>>16&255]^f[S>>8&255]^u[255&d]^e[g+1],p=i[m>>>24]^a[S>>16&255]^f[d>>8&255]^u[255&y]^e[g+2],S=i[S>>>24]^a[d>>16&255]^f[y>>8&255]^u[255&m]^e[g+3],g+=4,d=w,y=h,m=p;for(let t=0;t<4;t++)o[n?3&-t:t]=l[d>>>24]<<24^l[y>>16&255]<<16^l[m>>8&255]<<8^l[255&S]^e[g++],w=d,d=y,y=m,m=S,S=w;return o}},it=class{constructor(t,n){this.G=t,this.J=n,this.X=n}reset(){this.X=this.J}update(t){return this.Y(this.G,t,this.X)}Z(t){if(255&~(t>>24))t+=1<<24;else{let n=t>>16&255,e=t>>8&255,s=255&t;255===n?(n=0,255===e?(e=0,255===s?s=0:++s):++e):++n,t=0,t+=n<<16,t+=e<<8,t+=s}return t}$(t){0===(t[0]=this.Z(t[0]))&&(t[1]=this.Z(t[1]))}Y(t,n,e){let s;if(!(s=n.length))return[];const r=T.bitLength(n);for(let r=0;r<s;r+=4){this.$(e);const s=t.encrypt(e);n[r]^=s[0],n[r+1]^=s[1],n[r+2]^=s[2],n[r+3]^=s[3]}return T.m(n,r)}},at=E._;let ft=et&&rt&&typeof st.importKey==k,ut=et&&rt&&typeof st.deriveBits==k;class lt extends d{constructor({password:t,rawPassword:n,encryptionStrength:e,checkPasswordOnly:s,checkAuthenticationCode:c=!0}){super({start(){ht(this,t,n,e)},async transform(t,n){const e=this,{password:c,strength:i,nt:a,ready:f}=e;c?(await async function(t,n,e,s){const o=await dt(t,n,e,mt(s,0,Z[n])),c=mt(s,Z[n]);if(o[0]!=c[0]||o[1]!=c[1])throw new r(O)}(e,i,c,mt(t,0,Z[i]+2)),t=mt(t,Z[i]+2),s?n.error(new r(N)):a()):await f;const u=new o(t.length-tt-(t.length-tt)%G);n.enqueue(pt(e,t,u,0,tt,!0))},async flush(t){const{et:n,st:e,ot:s,ready:o}=this;if(e&&n){await o;const i=mt(s,0,s.length-tt),a=mt(s,s.length-tt);let f=z;if(i.length){const t=gt(ot,i);e.update(t);const s=n.update(t);f=St(ot,s)}const u=mt(St(ot,e.digest()),0,tt);let l=s.length<tt?1:0;for(let t=0;t<tt;t++)l|=u[t]^a[t];if(l&&c)throw new r(H);t.enqueue(f)}}})}}class wt extends d{constructor({password:t,rawPassword:n,encryptionStrength:e}){super({start(){ht(this,t,n,e)},async transform(t,n){const e=this,{password:s,strength:r,nt:c,ready:i}=e;let a=z;s?(a=await async function(t,n,e){const s=q(new o(Z[n]));return W(s,await dt(t,n,e,s))}(e,r,s),c()):await i;const f=new o(a.length+t.length-t.length%G);f.set(a,0),n.enqueue(pt(e,t,f,a.length,0))},async flush(t){const{et:n,st:e,ot:s,ready:r}=this;if(e&&n){await r;let o=z;if(s.length){const t=n.update(gt(ot,s));e.update(t),o=St(ot,t)}const c=St(ot,e.digest()).slice(0,tt);t.enqueue(W(o,c))}}})}}function ht(t,e,s,r){n.assign(t,{ready:new l(n=>t.nt=n),password:yt(e,s),strength:r-1,ot:z})}function pt(t,n,e,s,r,c){const{et:i,st:a,ot:f}=t;f.length&&(n=W(f,n));const u=n.length-r;let l;for(e=function(t,n){if(n&&n>t.length){const e=t;(t=new o(n)).set(e,0)}return t}(e,s+(u-u%G)),l=0;l<=u-G;l+=G){const t=gt(ot,mt(n,l,l+G));c&&a.update(t);const r=i.update(t);c||a.update(r),e.set(St(ot,r),l+s)}return t.ot=mt(n,l),e}async function dt(e,s,r,c){e.password=null;const i=await async function(t,n,e,s,r){if(!ft)return E.importKey(n);try{return await st.importKey("raw",n,e,!1,r)}catch{return ft=!1,E.importKey(n)}}(0,r,Q,0,Y),a=await async function(t,n,e){if(!ut)return E.T(n,t.salt,X.iterations,e);try{return await st.deriveBits(t,n,e)}catch{return ut=!1,E.T(n,t.salt,X.iterations,e)}}(n.assign({salt:c},X),i,8*(2*$[s]+2)),f=new o(a),u=gt(ot,mt(f,0,$[s])),l=gt(ot,mt(f,$[s],2*$[s])),w=mt(f,2*$[s]);return n.assign(e,{keys:{key:u,ct:l,passwordVerification:w},et:new it(new ct(u),t.from(nt)),st:new at(l)}),w}function yt(t,n){return n===v?function(t){if(typeof w==b){t=unescape(encodeURIComponent(t));const n=new o(t.length);for(let e=0;e<n.length;e++)n[e]=t.charCodeAt(e);return n}return(new w).encode(t)}(t):n}function mt(t,n,e){return t.subarray(n,e)}function St(t,n){return t.v(n)}function gt(t,n){return t.C(n)}class vt extends d{constructor({password:t,rawPassword:n,passwordVerification:e,checkPasswordOnly:s}){super({start(){kt(this,t,n,e)},transform(t,n){const e=this;if(e.password||e.rawPassword){const n=zt(e,t.subarray(0,12));if(e.password=e.rawPassword=null,0!=(n[11]^e.passwordVerification))throw new r(O);t=t.subarray(12)}s?n.error(new r(N)):n.enqueue(zt(e,t))}})}}class bt extends d{constructor({password:t,rawPassword:n,passwordVerification:e}){super({start(){kt(this,t,n,e)},transform(t,n){const e=this;let s,r;if(e.password||e.rawPassword){e.password=e.rawPassword=null;const n=q(new o(12));n[11]=e.passwordVerification,s=new o(t.length+n.length),s.set(Ct(e,n),0),r=12}else s=new o(t.length),r=0;s.set(Ct(e,t),r),n.enqueue(s)}})}}function kt(t,e,s,r){n.assign(t,{password:e,rawPassword:s,passwordVerification:r}),function(t,e,s){const r=[305419896,591751049,878082192];if(n.assign(t,{keys:r,it:new R(r[0]),ft:new R(r[2])}),s)for(let n=0;n<s.length;n++)It(t,s[n]);else for(let n=0;n<e.length;n++)It(t,e.charCodeAt(n))}(t,e,s)}function zt(t,n){const e=new o(n.length);for(let s=0;s<n.length;s++)e[s]=At(t)^n[s],It(t,e[s]);return e}function Ct(t,n){const e=new o(n.length);for(let s=0;s<n.length;s++)e[s]=At(t)^n[s],It(t,n[s]);return e}function It(t,n){let[,e]=t.keys;t.it.append([n]);const r=~t.it.get();e=Mt(s.imul(Mt(e+xt(r)),134775813)+1),t.ft.append([e>>>24]);const o=~t.ft.get();t.keys=[r,e,o]}function At(t){const n=2|t.keys[2];return xt(s.imul(n,1^n)>>>8)}function xt(t){return 255&t}function Mt(t){return 4294967295&t}function Pt(t){if(t instanceof y)return t;const n=t.getReader();return new y({async pull(t){const{value:e,done:s}=await n.read();s?t.close():t.enqueue(e)},cancel:t=>n.cancel(t)})}const Bt=new f;function Dt(t){return Bt.get(t)}const Ft="Invalid uncompressed size",Rt=j,Ut="deflate-raw",Wt="gzip",_t=[31,139,8];class Tt extends d{constructor(t,{chunkSize:n,CompressionStreamFallback:e,CompressionStream:s}){super({});const{compressed:r,encrypted:o,useCompressionStream:c,zipCrypto:i,computeCrc32:a,level:f,deflate64:l,format:w,compressionMethod:h}=t,p=this;let d,y,m,S=super.readable;const g=w&&Dt(w),v=a&&r&&!l&&!g&&(!o||i)&&Boolean(c&&s);if(o&&!i||!a||v||(d=new U,S=Ht(S,d)),r)if(g)S=Nt(S,Ot(g.CompressionStream,w,{level:f,chunkSize:n,compressionMethod:h}));else if(v)m=new Vt,S=Nt(S,new s(Wt)),S=Ht(S,m);else try{S=jt(S,c,{level:f,chunkSize:n},s,e)}catch(t){let n;try{n=new s(Wt)}catch{throw t}S=Nt(S,n),S=Ht(S,new Vt)}o&&(i?S=Ht(S,new bt(t)):(y=new wt(t),S=Ht(S,y))),Lt(p,S,()=>{o&&!i||!a||(p.crc32=v?m.crc32:new u(d.value.buffer).getUint32(0))})}}class Vt extends d{constructor(){let t,n=10,e=new o(0);super({transform(t,r){if(n){const e=s.min(n,t.length);if(n-=e,!(t=t.subarray(e)).length)return}const o=e.length+t.length;if(o<=8)return void(e=W(e,t));const c=o-8,i=s.min(c,e.length);r.enqueue(W(e.subarray(0,i),t.subarray(0,c-i))),e=W(e.subarray(i),t.subarray(c-i))},flush(){const n=_(e);t.crc32=n.getUint32(0,!0),t.uncompressedSize=n.getUint32(4,!0)}}),t=this}}class Kt extends d{constructor(t,{chunkSize:n,DecompressionStreamFallback:e,DecompressionStream:s}){super({});const{zipCrypto:c,encrypted:i,checkCrc32:a,crc32:f,compressed:w,useCompressionStream:h,deflate64:p,format:m,compressionMethod:S,rawBitFlag:g,outputSize:b}=t;let k,z,C=super.readable;if(i&&(c?C=Ht(C,new vt(t)):(z=new lt(t),C=Ht(C,z))),w){const t=m&&Dt(m);if(t)C=Nt(C,Ot(t.DecompressionStream,m,{chunkSize:n,compressionMethod:S,rawBitFlag:g,uncompressedSize:b}));else try{C=jt(C,h,{chunkSize:n,deflate64:p},s,e)}catch(t){if(p||b===v)throw t;let n;try{n=new s(Wt)}catch{throw t}C=function(t,n,e){const s=new R;let c,i,a,f=0,u=!1;const w=new l((t,n)=>{i=t,a=n});w.catch(()=>{}),e||i();const h=new d({start(t){const n=new o(10);n.set(_t),t.enqueue(n)},transform(t,n){n.enqueue(t)},async flush(t){u=!0,y();try{await w}finally{m()}const n=new o(8),r=_(n);r.setUint32(0,s.get(),!0),r.setUint32(4,e,!0),t.enqueue(n)},cancel(t){a(t)}}),p=new d({transform(t,n){s.append(t),f+=t.length,f>=e?i():u&&y(),n.enqueue(t)},cancel(t){a(t)}});return t=Ht(t,h),Ht(t=Nt(t,n),p);function y(){m(),c=setTimeout(()=>a(new r(Ft)),5e3)}function m(){clearTimeout(c)}}(C,n,b)}C=function(t){const n=t.getReader();return new y({async pull(t){let e;try{e=await n.read()}catch(t){if(t&&t.message)throw t;const n=new r("Invalid compressed data");throw n.cause=t,n}const{value:s,done:o}=e;o?t.close():t.enqueue(s)},cancel:t=>n.cancel(t)})}(C)}a&&(k=new U,C=Ht(C,k)),Lt(this,C,()=>{if(a){const t=new u(k.value.buffer);if(f!=t.getUint32(0,!1))throw new r(Rt)}})}}const Et=new f;function Lt(t,e,s){e=Ht(e,new d({flush:s})),n.defineProperty(t,"readable",{get:()=>e})}function Ot(t,n,e){if(!t)throw new r("Compression method not supported");return new t(n,e)}function jt(t,n,e,s,r){const o=n&&s?s:r||s,c=e.deflate64?"deflate64-raw":Ut;let i;try{i=new o(c,e)}catch(t){if(!n||!r||o==r)throw t;i=new r(c,e)}return Nt(t,i)}function Ht(t,n){return Pt(t).pipeThrough(n)}function Nt(t,n){const e=n.writable.getWriter(),s=t.getReader();return async function(){try{for(;;){await e.ready;const t=await s.read();if(t.done){await e.close();break}await e.write(t.value)}}catch(t){await async function(t,n){try{await t.abort(n)}catch{}}(e,t),await async function(t,n){try{await t.cancel(n)}catch{}}(s,t)}}(),n.readable}const qt="data",Gt="close",Jt="deflate";class Qt extends d{constructor(t,e){super({});const s=this,{codecType:o}=t;let c;o.startsWith(Jt)?c=Tt:o.startsWith("inflate")&&(c=Kt),s.outputSize=0;let i=0;const a=new c(t,e),f=super.readable,u=new d({transform(t,n){t&&t.length&&(i+=t.length,n.enqueue(t))},flush(){n.assign(s,{inputSize:i})}}),l=new d({transform(n,e){if(n&&n.length&&(e.enqueue(n),s.outputSize+=n.length,t.outputSize!==v&&s.outputSize>t.outputSize))throw new r(Ft)},flush(){const{crc32:t}=a;n.assign(s,{crc32:t,inputSize:i})}});n.defineProperty(s,"readable",{get:()=>f.pipeThrough(u).pipeThrough(a).pipeThrough(l)})}}class Xt extends d{constructor(t){const n=[];let s=0;function r(){const e=new o(t);let r=0;for(;r<t;){const s=n[0],o=t-r;s.length<=o?(e.set(s,r),r+=s.length,n.shift()):(e.set(s.subarray(0,o),r),n[0]=s.subarray(o),r+=o)}return s-=t,e}(!e.isFinite(t)||t<1)&&(t=65536),super({transform(e,o){for(n.push(e),s+=e.length;s>t;)o.enqueue(r())},flush(t){s&&t.enqueue(function(t,n){const e=new o(n);let s=0;for(const n of t)e.set(n,s),s+=n.length;return e}(n,s))}})}}let Yt=2;try{typeof navigator!=b&&navigator.hardwareConcurrency&&(Yt=navigator.hardwareConcurrency)}catch{}const Zt=new f,$t=new f;let tn,nn,en,sn,rn,on,cn=0;async function an(t){let n,o;try{const{options:c,config:i}=t;if(c.format)try{await async function(t,n){!Bt.has(t)&&n&&function(t,n){const{CompressionStream:e,DecompressionStream:s}=n;if(typeof e!=k&&typeof s!=k)throw new r("Invalid codec module");Bt.set(t,{CompressionStream:e,DecompressionStream:s})}(t,await(import(n)))}(c.format,c.codecURI)}catch(t){throw t.codecImportFailed=!0,t}if(i.CompressionStream=self.CompressionStream,i.DecompressionStream=self.DecompressionStream,c.compressed&&!c.format)if(c.useCompressionStream){if(!function(t,n){if(!t)return!1;let e=Et.get(t);e||(e=new f,Et.set(t,e));let s=e.get(n);if(s===v){try{new t(n),s=!0}catch{s=!1}e.set(n,s)}return s}(c.codecType.startsWith(Jt)?i.CompressionStream:i.DecompressionStream,Ut))try{await self.initModule(t.config)}catch{}}else try{await self.initModule(t.config)}catch{c.useCompressionStream=!0}!i.CompressionStreamFallback&&i.CompressionStreamZlib&&(i.CompressionStreamFallback=i.CompressionStreamZlib),!i.DecompressionStreamFallback&&i.DecompressionStreamZlib&&(i.DecompressionStreamFallback=i.DecompressionStreamZlib);const a={highWaterMark:1},u=t.readable?Pt(t.readable):new y({async pull(t){const n=new l(t=>Zt.set(cn,t));fn({type:"pull",messageId:cn}),cn=(cn+1)%e.MAX_SAFE_INTEGER;const{value:s,done:r}=await n;t.enqueue(s),r&&t.close()}},a);o=t.writable?function(t){if(t instanceof m)return t;const n=t.getWriter();return new m({write:t=>n.write(t),close:()=>n.close(),abort:t=>n.abort(t)})}(t.writable):new m({async write(t){let n;const s=new l(t=>n=t);$t.set(cn,n),fn({type:qt,value:t,messageId:cn}),cn=(cn+1)%e.MAX_SAFE_INTEGER,await s}},a),n=new Qt(c,i),tn=new AbortController;const{signal:w}=tn;await u.pipeThrough(n).pipeThrough(new Xt(function(t){return r="string"==typeof(n=r=t.chunkSize)&&n.trim()?e(n):n,e.isInteger(r)&&r>=1?s.max(r,64):65536;var n,r}(i))).pipeTo(o,{signal:w,preventClose:!0,preventAbort:!0}),await o.getWriter().close();const{crc32:h,inputSize:p,outputSize:d}=n;fn({type:Gt,result:{crc32:h,inputSize:p,outputSize:d}})}catch(t){if(t.outputSize=n?n.outputSize:0,o&&!o.locked)try{await o.getWriter().close()}catch{}un(t)}}function fn(t){const{value:n}=t;if(n)if(n.length)try{t.value=(e=n,e.byteOffset||e.byteLength!=e.buffer.byteLength?new o(e):e).buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t);var e}function un(t=new r("Unknown error")){const{message:n,stack:e,code:s,name:o,outputSize:c,cause:i,codecImportFailed:a}=t,f={message:n,stack:e,code:s,name:o,outputSize:c};i&&(f.cause={name:i.name,message:i.message}),a&&(f.codecImportFailed=!0),p({error:f})}function ln(t,n,e={}){if(!nn){const t=new r("WASM module not loaded");throw t.cause=on,t}const c="number"==typeof e.level?e.level:-1,i="number"==typeof e.outBuffer?e.outBuffer:65536,a="number"==typeof e.inBufferSize?e.inBufferSize:65536;return new d({start(){try{let e;if(this.ut=en(i),this.in=en(a),this.inBufferSize=a,!this.ut||!this.in)throw new r("allocation failed");if(this.lt=new o(i),t?(this.wt=nn.deflate_process,this.ht=nn.deflate_last_consumed,this.yt=nn.deflate_end,this.St=nn.deflate_new(),e="gzip"===n?nn.deflate_init_gzip(this.St,c):"deflate-raw"===n?nn.deflate_init_raw(this.St,c):nn.deflate_init(this.St,c)):"deflate64-raw"===n?(this.wt=nn.inflate9_process,this.ht=nn.inflate9_last_consumed,this.yt=nn.inflate9_end,this.St=nn.inflate9_new(),e=nn.inflate9_init_raw(this.St)):(this.wt=nn.inflate_process,this.ht=nn.inflate_last_consumed,this.yt=nn.inflate_end,this.St=nn.inflate_new(),e="deflate-raw"===n?nn.inflate_init_raw(this.St):"gzip"===n?nn.inflate_init_gzip(this.St):nn.inflate_init(this.St)),0!==e)throw new r("init failed:"+e)}catch(t){throw f(this),t}},transform(n,e){try{const c=n,a=new o(rn.buffer),f=this.wt,u=this.ht,l=this.ut,w=this.lt;let h=0;for(;h<c.length;){const n=s.min(c.length-h,32768);if((!this.in||this.inBufferSize<n)&&(this.in&&sn&&(sn(this.in),this.in=0),this.in=en(n),this.inBufferSize=n,!this.in))throw new r("allocation failed");a.set(c.subarray(h,h+n),this.in);const o=f(this.St,this.in,n,l,i,0),p=16777215&o;if(p&&(w.set(a.subarray(l,l+p),0),e.enqueue(w.slice(0,p))),!t){const t=o>>24&255,n=128&t?t-256:t;if(n<0)throw new r("process error:"+n)}const d=u(this.St);if(0===d)break;h+=d}}catch(t){f(this),e.error(t)}},flush(n){try{const e=new o(rn.buffer),s=this.wt,c=this.ut,a=this.lt;for(;;){const o=s(this.St,0,0,c,i,4),f=16777215&o,u=o>>24&255;if(!t){const t=128&u?u-256:u;if(t<0)throw new r("process error:"+t)}if(f&&(a.set(e.subarray(c,c+f),0),n.enqueue(a.slice(0,f))),1===u||0===f)break}}catch(t){n.error(t)}finally{const t=f(this);0!==t&&n.error(new r("end error:"+t))}},cancel(){f(this)}});function f(t){let n=0;return t.St&&t.yt&&(n=t.yt(t.St)),t.St=0,t.in&&sn&&sn(t.in),t.in=0,t.ut&&sn&&sn(t.ut),t.ut=0,n}}addEventListener("message",({data:t})=>{const{type:n,messageId:e,value:s,done:r}=t;try{if("start"==n&&an(t),n==qt){const t=Zt.get(e);Zt.delete(e),t({value:s||new o,done:r})}if("ack"==n){const t=$t.get(e);$t.delete(e),t()}n==Gt&&tn.abort()}catch(t){un(t)}}),p({type:"ready"});class wn{constructor(t="deflate",n){return ln(!0,t,n)}}class hn{constructor(t="deflate",n){return ln(!1,t,n)}}wn.gt=!0,hn.gt=!0;let pn=!1;!function(t={}){const{init:n}=t,e=t.CompressionStreamFallback||t.CompressionStreamZlib,s=t.DecompressionStreamFallback||t.DecompressionStreamZlib;self.initModule=async t=>{n&&await n(t),e&&(t.CompressionStreamFallback=e),s&&(t.DecompressionStreamFallback=s)}}({CompressionStreamFallback:wn,DecompressionStreamFallback:hn,init:t=>async function(t,{baseURI:n}){if(!pn)try{await async function(t,n){let e,s;try{try{s=new URL(t,n)}catch{}const r=await fetch(s);e=await r.arrayBuffer()}catch(n){if(!t.startsWith("data:application/wasm;base64,"))throw n;e=function(t){const n=t.split(",")[1],e=atob(n),s=e.length,r=new o(s);for(let t=0;t<s;++t)r[t]=e.charCodeAt(t);return r.buffer}(t)}!function(t){if(nn=t,({malloc:en,free:sn,memory:rn}=nn),"function"!=typeof en||"function"!=typeof sn||!rn)throw nn=en=sn=rn=null,new r("Invalid WASM module")}((await WebAssembly.instantiate(e)).instance.exports)}(t,n),pn=!0}catch(t){throw function(t){on=t}(t),t}}(t.wasmURI,t)})});\n';if("string"==typeof s&&(s=(new TextEncoder).encode(s)),t){const t=new Blob([s],{type:n});return URL.createObjectURL(t)}return "data:"+n+";base64,"+function(t){let n="";const s=t.length;let r=0;for(;r+2<s;r+=3){const s=t[r]<<16|t[r+1]<<8|t[r+2];n+=e$1[s>>18&63]+e$1[s>>12&63]+e$1[s>>6&63]+e$1[63&s];}const o=s-r;if(1===o){const s=t[r]<<16;n+=e$1[s>>18&63]+e$1[s>>12&63]+"==";}else if(2===o){const s=t[r]<<16|t[r+1]<<8;n+=e$1[s>>18&63]+e$1[s>>12&63]+e$1[s>>6&63]+"=";}return n}(s)}});
417
+ const t$1=new Uint8Array(288);t$1.fill(8,0,144),t$1.fill(9,144,256),t$1.fill(7,256,280),t$1.fill(8,280,288),new Uint8Array(30).fill(5);const e$1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n$1=t=>t({workerURI:t=>{const n="text/javascript";let s='!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";const{Array:t,Object:n,Number:e,Math:s,Error:r,Uint8Array:o,Uint16Array:c,Uint32Array:i,Int32Array:a,Map:f,DataView:u,Promise:l,TextEncoder:w,crypto:h,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:S,DecompressionStream:g}=self,v=void 0,b="undefined",k="function",z=new o,C=[[],[],[],[],[],[],[],[]];for(let t=0;t<256;t++){let n=t;for(let t=0;t<8;t++)n=1&n?n>>>1^3988292384:n>>>1;C[0][t]=n}for(let t=0;t<256;t++)for(let n=1;n<8;n++){const e=C[n-1][t];C[n][t]=e>>>8^C[0][255&e]}const[I,A,x,M,P,B,D,F]=C;class R{constructor(t){this.o=t||-1}append(t){let n=0|this.o;const e=0|t.length;let s=0;if(e>=8&&t.buffer){const r=new u(t.buffer,t.byteOffset,e),o=e-8;for(;s<=o;s+=8){const t=n^r.getInt32(s,!0),e=r.getInt32(s+4,!0);n=F[255&t]^D[t>>>8&255]^B[t>>>16&255]^P[t>>>24&255]^M[255&e]^x[e>>>8&255]^A[e>>>16&255]^I[e>>>24&255]}}for(;s<e;s++)n=n>>>8^I[255&(n^t[s])];this.o=n}get(){return~this.o}}class U extends d{constructor(){let t;const n=new R;super({transform(t,e){n.append(t),e.enqueue(t)},flush(){const e=new o(4);new u(e.buffer).setUint32(0,n.get()),t.value=e}}),t=this}}function W(t,n){const e=new o(t.length+n.length);return e.set(t),e.set(n,t.length),e}function _(t){return new u(t.buffer,t.byteOffset,t.byteLength)}const T={concat(t,n){if(0===t.length||0===n.length)return t.concat(n);const e=t[t.length-1],s=T.l(e);return 32===s?t.concat(n):T.h(n,s,0|e,t.slice(0,t.length-1))},bitLength(t){const n=t.length;if(0===n)return 0;const e=t[n-1];return 32*(n-1)+T.l(e)},m(t,n){if(32*t.length<n)return t;const e=(t=t.slice(0,s.ceil(n/32))).length;return n&=31,e>0&&n&&(t[e-1]=T.S(n,t[e-1]&2147483648>>n-1,1)),t},S:(t,n,e)=>32===t?n:(e?0|n:n<<32-t)+1099511627776*t,l:t=>s.round(t/1099511627776)||32,h(t,n,e,s){for(void 0===s&&(s=[]);n>=32;n-=32)s.push(e),e=0;if(0===n)return s.concat(t);for(let r=0;r<t.length;r++)s.push(e|t[r]>>>n),e=t[r]<<32-n;const r=t.length?t[t.length-1]:0,o=T.l(r);return s.push(T.S(n+o&31,n+o>32?e:s.pop(),1)),s}},V={bytes:{v(t){const n=T.bitLength(t)/8,e=new o(n);let s;for(let r=0;r<n;r++)3&r||(s=t[r/4]),e[r]=s>>>24,s<<=8;return e},C(t){const n=[];let e,s=0;for(e=0;e<t.length;e++)s=s<<8|t[e],3&~e||(n.push(s),s=0);return 3&e&&n.push(T.S(8*(3&e),s)),n}}},K=class{constructor(t){const n=this;n.blockSize=512,n.I=[1732584193,4023233417,2562383102,271733878,3285377520],n.A=[1518500249,1859775393,2400959708,3395469782],t?(n.M=t.M.slice(0),n.P=t.P.slice(0),n.B=t.B):n.reset()}reset(){const t=this;return t.M=t.I.slice(0),t.P=[],t.B=0,t}update(t){const n=this;"string"==typeof t&&(t=V.D.C(t));const e=n.P=T.concat(n.P,t),s=n.B,o=n.B=s+T.bitLength(t);if(o>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const c=new i(e);let a=0;for(let t=n.blockSize+s-(n.blockSize+s&n.blockSize-1);t<=o;t+=n.blockSize)n.F(c.subarray(16*a,16*(a+1))),a+=1;return e.splice(0,16*a),n}R(){const t=this;let n=t.P;const e=t.M;n=T.concat(n,[T.S(1,1)]);for(let t=n.length+2;15&t;t++)n.push(0);for(n.push(s.floor(t.B/4294967296)),n.push(0|t.B);n.length;)t.F(n.splice(0,16));return t.reset(),e}U(t,n,e,s){return t<=19?n&e|~n&s:t<=39?n^e^s:t<=59?n&e|n&s|e&s:t<=79?n^e^s:void 0}W(t,n){return n<<t|n>>>32-t}F(n){const e=this,r=e.M,o=t(80);for(let t=0;t<16;t++)o[t]=n[t];let c=r[0],i=r[1],a=r[2],f=r[3],u=r[4];for(let t=0;t<=79;t++){t>=16&&(o[t]=e.W(1,o[t-3]^o[t-8]^o[t-14]^o[t-16]));const n=e.W(5,c)+e.U(t,i,a,f)+u+o[t]+e.A[s.floor(t/20)]|0;u=f,f=a,a=e.W(30,i),i=c,c=n}r[0]=r[0]+c|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+f|0,r[4]=r[4]+u|0}},E={importKey:t=>new E._(V.bytes.C(t)),T(t,n,e,s){if(e=e||1e4,s<0||e<0)throw new r("invalid params to pbkdf2");const o=1+(s>>5)<<2;let c,i,a,f,l;const w=new ArrayBuffer(o),h=new u(w);let p=0;const d=T;for(n=V.bytes.C(n),l=1;p<(o||1);l++){for(c=i=t.encrypt(d.concat(n,[l])),a=1;a<e;a++)for(i=t.encrypt(i),f=0;f<i.length;f++)c[f]^=i[f];for(a=0;p<(o||1)&&a<c.length;a++)h.setInt32(p,c[a]),p+=4}return w.slice(0,s/8)},_:class{constructor(t){const n=this,e=n.V=K,s=[[],[]];n.K=[new e,new e];const r=n.K[0].blockSize/32;t.length>r&&(t=(new e).update(t).R());for(let n=0;n<r;n++)s[0][n]=909522486^t[n],s[1][n]=1549556828^t[n];n.K[0].update(s[0]),n.K[1].update(s[1]),n.L=new e(n.K[0])}reset(){const t=this;t.L=new t.V(t.K[0]),t.O=!1}update(t){this.O=!0,this.L.update(t)}digest(){const t=this,n=t.L.R(),e=new t.V(t.K[1]).update(n).R();return t.reset(),e}encrypt(t){if(this.O)throw new r("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},L=typeof h!=b&&typeof h.getRandomValues==k,O="Invalid password",j="Invalid signature",H=j,N="zipjs-abort-check-password";function q(t){if(L)return h.getRandomValues(t);throw new r("Crypto API not supported")}const G=16,J={name:"PBKDF2"},Q=n.assign({hash:{name:"HMAC"}},J),X=n.assign({iterations:1e3,hash:{name:"SHA-1"}},J),Y=["deriveBits"],Z=[8,12,16],$=[16,24,32],tt=10,nt=[0,0,0,0],et=typeof h!=b,st=et&&h.subtle,rt=et&&typeof st!=b,ot=V.bytes,ct=class{constructor(t){const n=this;n.j=[[[],[],[],[],[]],[[],[],[],[],[]]],n.j[0][0][0]||n.H();const e=n.j[0][4],s=n.j[1],o=t.length;let c,i,a,f=1;if(4!==o&&6!==o&&8!==o)throw new r("invalid aes key size");for(n.A=[i=t.slice(0),a=[]],c=o;c<4*o+28;c++){let t=i[c-1];(c%o===0||8===o&&c%o===4)&&(t=e[t>>>24]<<24^e[t>>16&255]<<16^e[t>>8&255]<<8^e[255&t],c%o===0&&(t=t<<8^t>>>24^f<<24,f=f<<1^283*(f>>7))),i[c]=i[c-o]^t}for(let t=0;c;t++,c--){const n=i[3&t?c:c-4];a[t]=c<=4||t<4?n:s[0][e[n>>>24]]^s[1][e[n>>16&255]]^s[2][e[n>>8&255]]^s[3][e[255&n]]}}encrypt(t){return this.N(t,0)}decrypt(t){return this.N(t,1)}H(){const t=this.j[0],n=this.j[1],e=t[4],s=n[4],r=[],o=[];let c,i,a,f;for(let t=0;t<256;t++)o[(r[t]=t<<1^283*(t>>7))^t]=t;for(let u=c=0;!e[u];u^=i||1,c=o[c]||1){let o=c^c<<1^c<<2^c<<3^c<<4;o=o>>8^255&o^99,e[u]=o,s[o]=u,f=r[a=r[i=r[u]]];let l=16843009*f^65537*a^257*i^16843008*u,w=257*r[o]^16843008*o;for(let e=0;e<4;e++)t[e][u]=w=w<<24^w>>>8,n[e][o]=l=l<<24^l>>>8}for(let e=0;e<5;e++)t[e]=t[e].slice(0),n[e]=n[e].slice(0)}N(t,n){if(4!==t.length)throw new r("invalid aes block size");const e=this.A[n],s=e.length/4-2,o=[0,0,0,0],c=this.j[n],i=c[0],a=c[1],f=c[2],u=c[3],l=c[4];let w,h,p,d=t[0]^e[0],y=t[n?3:1]^e[1],m=t[2]^e[2],S=t[n?1:3]^e[3],g=4;for(let t=0;t<s;t++)w=i[d>>>24]^a[y>>16&255]^f[m>>8&255]^u[255&S]^e[g],h=i[y>>>24]^a[m>>16&255]^f[S>>8&255]^u[255&d]^e[g+1],p=i[m>>>24]^a[S>>16&255]^f[d>>8&255]^u[255&y]^e[g+2],S=i[S>>>24]^a[d>>16&255]^f[y>>8&255]^u[255&m]^e[g+3],g+=4,d=w,y=h,m=p;for(let t=0;t<4;t++)o[n?3&-t:t]=l[d>>>24]<<24^l[y>>16&255]<<16^l[m>>8&255]<<8^l[255&S]^e[g++],w=d,d=y,y=m,m=S,S=w;return o}},it=class{constructor(t,n){this.G=t,this.J=n,this.X=n}reset(){this.X=this.J}update(t){return this.Y(this.G,t,this.X)}Z(t){if(255&~(t>>24))t+=1<<24;else{let n=t>>16&255,e=t>>8&255,s=255&t;255===n?(n=0,255===e?(e=0,255===s?s=0:++s):++e):++n,t=0,t+=n<<16,t+=e<<8,t+=s}return t}$(t){0===(t[0]=this.Z(t[0]))&&(t[1]=this.Z(t[1]))}Y(t,n,e){let s;if(!(s=n.length))return[];const r=T.bitLength(n);for(let r=0;r<s;r+=4){this.$(e);const s=t.encrypt(e);n[r]^=s[0],n[r+1]^=s[1],n[r+2]^=s[2],n[r+3]^=s[3]}return T.m(n,r)}},at=E._;let ft=et&&rt&&typeof st.importKey==k,ut=et&&rt&&typeof st.deriveBits==k;class lt extends d{constructor({password:t,rawPassword:n,encryptionStrength:e,checkPasswordOnly:s,checkAuthenticationCode:c=!0}){super({start(){ht(this,t,n,e)},async transform(t,n){const e=this,{password:c,strength:i,nt:a,ready:f}=e;c?(await async function(t,n,e,s){const o=await dt(t,n,e,mt(s,0,Z[n])),c=mt(s,Z[n]);if(o[0]!=c[0]||o[1]!=c[1])throw new r(O)}(e,i,c,mt(t,0,Z[i]+2)),t=mt(t,Z[i]+2),s?n.error(new r(N)):a()):await f;const u=new o(t.length-tt-(t.length-tt)%G);n.enqueue(pt(e,t,u,0,tt,!0))},async flush(t){const{et:n,st:e,ot:s,ready:o}=this;if(e&&n){await o;const i=mt(s,0,s.length-tt),a=mt(s,s.length-tt);let f=z;if(i.length){const t=gt(ot,i);e.update(t);const s=n.update(t);f=St(ot,s)}const u=mt(St(ot,e.digest()),0,tt);let l=s.length<tt?1:0;for(let t=0;t<tt;t++)l|=u[t]^a[t];if(l&&c)throw new r(H);t.enqueue(f)}}})}}class wt extends d{constructor({password:t,rawPassword:n,encryptionStrength:e}){super({start(){ht(this,t,n,e)},async transform(t,n){const e=this,{password:s,strength:r,nt:c,ready:i}=e;let a=z;s?(a=await async function(t,n,e){const s=q(new o(Z[n]));return W(s,await dt(t,n,e,s))}(e,r,s),c()):await i;const f=new o(a.length+t.length-t.length%G);f.set(a,0),n.enqueue(pt(e,t,f,a.length,0))},async flush(t){const{et:n,st:e,ot:s,ready:r}=this;if(e&&n){await r;let o=z;if(s.length){const t=n.update(gt(ot,s));e.update(t),o=St(ot,t)}const c=St(ot,e.digest()).slice(0,tt);t.enqueue(W(o,c))}}})}}function ht(t,e,s,r){n.assign(t,{ready:new l(n=>t.nt=n),password:yt(e,s),strength:r-1,ot:z})}function pt(t,n,e,s,r,c){const{et:i,st:a,ot:f}=t;f.length&&(n=W(f,n));const u=n.length-r;let l;for(e=function(t,n){if(n&&n>t.length){const e=t;(t=new o(n)).set(e,0)}return t}(e,s+(u-u%G)),l=0;l<=u-G;l+=G){const t=gt(ot,mt(n,l,l+G));c&&a.update(t);const r=i.update(t);c||a.update(r),e.set(St(ot,r),l+s)}return t.ot=mt(n,l),e}async function dt(e,s,r,c){e.password=null;const i=await async function(t,n,e,s,r){if(!ft)return E.importKey(n);try{return await st.importKey("raw",n,e,!1,r)}catch{return ft=!1,E.importKey(n)}}(0,r,Q,0,Y),a=await async function(t,n,e){if(!ut)return E.T(n,t.salt,X.iterations,e);try{return await st.deriveBits(t,n,e)}catch{return ut=!1,E.T(n,t.salt,X.iterations,e)}}(n.assign({salt:c},X),i,8*(2*$[s]+2)),f=new o(a),u=gt(ot,mt(f,0,$[s])),l=gt(ot,mt(f,$[s],2*$[s])),w=mt(f,2*$[s]);return n.assign(e,{keys:{key:u,ct:l,passwordVerification:w},et:new it(new ct(u),t.from(nt)),st:new at(l)}),w}function yt(t,n){return n===v?function(t){if(typeof w==b){t=unescape(encodeURIComponent(t));const n=new o(t.length);for(let e=0;e<n.length;e++)n[e]=t.charCodeAt(e);return n}return(new w).encode(t)}(t):n}function mt(t,n,e){return t.subarray(n,e)}function St(t,n){return t.v(n)}function gt(t,n){return t.C(n)}class vt extends d{constructor({password:t,rawPassword:n,passwordVerification:e,checkPasswordOnly:s}){super({start(){kt(this,t,n,e)},transform(t,n){const e=this;if(e.password||e.rawPassword){const n=zt(e,t.subarray(0,12));if(e.password=e.rawPassword=null,0!=(n[11]^e.passwordVerification))throw new r(O);t=t.subarray(12)}s?n.error(new r(N)):n.enqueue(zt(e,t))}})}}class bt extends d{constructor({password:t,rawPassword:n,passwordVerification:e}){super({start(){kt(this,t,n,e)},transform(t,n){const e=this;let s,r;if(e.password||e.rawPassword){e.password=e.rawPassword=null;const n=q(new o(12));n[11]=e.passwordVerification,s=new o(t.length+n.length),s.set(Ct(e,n),0),r=12}else s=new o(t.length),r=0;s.set(Ct(e,t),r),n.enqueue(s)}})}}function kt(t,e,s,r){n.assign(t,{password:e,rawPassword:s,passwordVerification:r}),function(t,e,s){const r=[305419896,591751049,878082192];if(n.assign(t,{keys:r,it:new R(r[0]),ft:new R(r[2])}),s)for(let n=0;n<s.length;n++)It(t,s[n]);else for(let n=0;n<e.length;n++)It(t,e.charCodeAt(n))}(t,e,s)}function zt(t,n){const e=new o(n.length);for(let s=0;s<n.length;s++)e[s]=At(t)^n[s],It(t,e[s]);return e}function Ct(t,n){const e=new o(n.length);for(let s=0;s<n.length;s++)e[s]=At(t)^n[s],It(t,n[s]);return e}function It(t,n){let[,e]=t.keys;t.it.append([n]);const r=~t.it.get();e=Mt(s.imul(Mt(e+xt(r)),134775813)+1),t.ft.append([e>>>24]);const o=~t.ft.get();t.keys=[r,e,o]}function At(t){const n=2|t.keys[2];return xt(s.imul(n,1^n)>>>8)}function xt(t){return 255&t}function Mt(t){return 4294967295&t}function Pt(t){if(t instanceof y)return t;const n=t.getReader();return new y({async pull(t){const{value:e,done:s}=await n.read();s?t.close():t.enqueue(e)},cancel:t=>n.cancel(t)})}const Bt=new f;function Dt(t){return Bt.get(t)}const Ft="Invalid uncompressed size",Rt=j,Ut="deflate-raw",Wt="gzip",_t=[31,139,8];class Tt extends d{constructor(t,{chunkSize:n,CompressionStreamFallback:e,CompressionStream:s}){super({});const{compressed:r,encrypted:o,useCompressionStream:c,zipCrypto:i,computeCrc32:a,level:f,deflate64:l,format:w,compressionMethod:h,inputSize:p}=t,d=this;let y,m,S,g=super.readable;const v=w&&Dt(w),b=a&&r&&!l&&!v&&(!o||i)&&Boolean(c&&s);if(o&&!i||!a||b||(y=new U,g=Ht(g,y)),r)if(v)g=Nt(g,Ot(v.CompressionStream,w,{level:f,chunkSize:n,compressionMethod:h,uncompressedSize:p}));else if(b)S=new Vt,g=Nt(g,new s(Wt)),g=Ht(g,S);else try{g=jt(g,c,{level:f,chunkSize:n},s,e)}catch(t){let n;try{n=new s(Wt)}catch{throw t}g=Nt(g,n),g=Ht(g,new Vt)}o&&(i?g=Ht(g,new bt(t)):(m=new wt(t),g=Ht(g,m))),Lt(d,g,()=>{o&&!i||!a||(d.crc32=b?S.crc32:new u(y.value.buffer).getUint32(0))})}}class Vt extends d{constructor(){let t,n=10,e=new o(0);super({transform(t,r){if(n){const e=s.min(n,t.length);if(n-=e,!(t=t.subarray(e)).length)return}const o=e.length+t.length;if(o<=8)return void(e=W(e,t));const c=o-8,i=s.min(c,e.length);r.enqueue(W(e.subarray(0,i),t.subarray(0,c-i))),e=W(e.subarray(i),t.subarray(c-i))},flush(){const n=_(e);t.crc32=n.getUint32(0,!0),t.uncompressedSize=n.getUint32(4,!0)}}),t=this}}class Kt extends d{constructor(t,{chunkSize:n,DecompressionStreamFallback:e,DecompressionStream:s}){super({});const{zipCrypto:c,encrypted:i,checkCrc32:a,crc32:f,compressed:w,useCompressionStream:h,deflate64:p,format:m,compressionMethod:S,rawBitFlag:g,outputSize:b}=t;let k,z,C=super.readable;if(i&&(c?C=Ht(C,new vt(t)):(z=new lt(t),C=Ht(C,z))),w){const t=m&&Dt(m);if(t)C=Nt(C,Ot(t.DecompressionStream,m,{chunkSize:n,compressionMethod:S,rawBitFlag:g,uncompressedSize:b}));else try{C=jt(C,h,{chunkSize:n,deflate64:p},s,e)}catch(t){if(p||b===v)throw t;let n;try{n=new s(Wt)}catch{throw t}C=function(t,n,e){const s=new R;let c,i,a,f=0,u=!1;const w=new l((t,n)=>{i=t,a=n});w.catch(()=>{}),e||i();const h=new d({start(t){const n=new o(10);n.set(_t),t.enqueue(n)},transform(t,n){n.enqueue(t)},async flush(t){u=!0,y();try{await w}finally{m()}const n=new o(8),r=_(n);r.setUint32(0,s.get(),!0),r.setUint32(4,e,!0),t.enqueue(n)},cancel(t){a(t)}}),p=new d({transform(t,n){s.append(t),f+=t.length,f>=e?i():u&&y(),n.enqueue(t)},cancel(t){a(t)}});return t=Ht(t,h),Ht(t=Nt(t,n),p);function y(){m(),c=setTimeout(()=>a(new r(Ft)),5e3)}function m(){clearTimeout(c)}}(C,n,b)}C=function(t){const n=t.getReader();return new y({async pull(t){let e;try{e=await n.read()}catch(t){if(t&&t.message)throw t;const n=new r("Invalid compressed data");throw n.cause=t,n}const{value:s,done:o}=e;o?t.close():t.enqueue(s)},cancel:t=>n.cancel(t)})}(C)}a&&(k=new U,C=Ht(C,k)),Lt(this,C,()=>{if(a){const t=new u(k.value.buffer);if(f!=t.getUint32(0,!1))throw new r(Rt)}})}}const Et=new f;function Lt(t,e,s){e=Ht(e,new d({flush:s})),n.defineProperty(t,"readable",{get:()=>e})}function Ot(t,n,e){if(!t)throw new r("Compression method not supported");return new t(n,e)}function jt(t,n,e,s,r){const o=n&&s?s:r||s,c=e.deflate64?"deflate64-raw":Ut;let i;try{i=new o(c,e)}catch(t){if(!n||!r||o==r)throw t;i=new r(c,e)}return Nt(t,i)}function Ht(t,n){return Pt(t).pipeThrough(n)}function Nt(t,n){const e=n.writable.getWriter(),s=t.getReader();return async function(){try{for(;;){await e.ready;const t=await s.read();if(t.done){await e.close();break}await e.write(t.value)}}catch(t){await async function(t,n){try{await t.abort(n)}catch{}}(e,t),await async function(t,n){try{await t.cancel(n)}catch{}}(s,t)}}(),n.readable}const qt="data",Gt="close",Jt="deflate";class Qt extends d{constructor(t,e){super({});const s=this,{codecType:o}=t;let c;o.startsWith(Jt)?c=Tt:o.startsWith("inflate")&&(c=Kt),s.outputSize=0;let i=0;const a=new c(t,e),f=super.readable,u=new d({transform(t,n){t&&t.length&&(i+=t.length,n.enqueue(t))},flush(){n.assign(s,{inputSize:i})}}),l=new d({transform(n,e){if(n&&n.length&&(e.enqueue(n),s.outputSize+=n.length,t.outputSize!==v&&s.outputSize>t.outputSize))throw new r(Ft)},flush(){const{crc32:t}=a;n.assign(s,{crc32:t,inputSize:i})}});n.defineProperty(s,"readable",{get:()=>f.pipeThrough(u).pipeThrough(a).pipeThrough(l)})}}class Xt extends d{constructor(t){const n=[];let s=0;function r(){const e=new o(t);let r=0;for(;r<t;){const s=n[0],o=t-r;s.length<=o?(e.set(s,r),r+=s.length,n.shift()):(e.set(s.subarray(0,o),r),n[0]=s.subarray(o),r+=o)}return s-=t,e}(!e.isFinite(t)||t<1)&&(t=65536),super({transform(e,o){for(n.push(e),s+=e.length;s>t;)o.enqueue(r())},flush(t){s&&t.enqueue(function(t,n){const e=new o(n);let s=0;for(const n of t)e.set(n,s),s+=n.length;return e}(n,s))}})}}let Yt=2;try{typeof navigator!=b&&navigator.hardwareConcurrency&&(Yt=navigator.hardwareConcurrency)}catch{}const Zt=new f,$t=new f;let tn,nn=0;async function en(t){let n,o;try{const{options:c,config:i}=t;if(c.format)try{await async function(t,n){!Bt.has(t)&&n&&function(t,n){const{CompressionStream:e,DecompressionStream:s}=n;if(typeof e!=k&&typeof s!=k)throw new r("Invalid codec module");Bt.set(t,{CompressionStream:e,DecompressionStream:s})}(t,await(import(n)))}(c.format,c.codecURI)}catch(t){throw t.codecImportFailed=!0,t}if(i.CompressionStream=self.CompressionStream,i.DecompressionStream=self.DecompressionStream,c.compressed&&!c.format)if(c.useCompressionStream){if(!function(t,n){if(!t)return!1;let e=Et.get(t);e||(e=new f,Et.set(t,e));let s=e.get(n);if(s===v){try{new t(n),s=!0}catch{s=!1}e.set(n,s)}return s}(c.codecType.startsWith(Jt)?i.CompressionStream:i.DecompressionStream,Ut))try{await self.initModule(t.config)}catch{}}else try{await self.initModule(t.config)}catch{c.useCompressionStream=!0}!i.CompressionStreamFallback&&i.CompressionStreamZlib&&(i.CompressionStreamFallback=i.CompressionStreamZlib),!i.DecompressionStreamFallback&&i.DecompressionStreamZlib&&(i.DecompressionStreamFallback=i.DecompressionStreamZlib);const a={highWaterMark:1},u=t.readable?Pt(t.readable):new y({async pull(t){const n=new l(t=>Zt.set(nn,t));sn({type:"pull",messageId:nn}),nn=(nn+1)%e.MAX_SAFE_INTEGER;const{value:s,done:r}=await n;t.enqueue(s),r&&t.close()}},a);o=t.writable?function(t){if(t instanceof m)return t;const n=t.getWriter();return new m({write:t=>n.write(t),close:()=>n.close(),abort:t=>n.abort(t)})}(t.writable):new m({async write(t){let n;const s=new l(t=>n=t);$t.set(nn,n),sn({type:qt,value:t,messageId:nn}),nn=(nn+1)%e.MAX_SAFE_INTEGER,await s}},a),n=new Qt(c,i),tn=new AbortController;const{signal:w}=tn;await u.pipeThrough(n).pipeThrough(new Xt(function(t){return r="string"==typeof(n=r=t.chunkSize)&&n.trim()?e(n):n,e.isInteger(r)&&r>=1?s.max(r,64):65536;var n,r}(i))).pipeTo(o,{signal:w,preventClose:!0,preventAbort:!0}),await o.getWriter().close();const{crc32:h,inputSize:p,outputSize:d}=n;sn({type:Gt,result:{crc32:h,inputSize:p,outputSize:d}})}catch(t){if(t.outputSize=n?n.outputSize:0,o&&!o.locked)try{await o.getWriter().close()}catch{}rn(t)}}function sn(t){const{value:n}=t;if(n)if(n.length)try{t.value=(e=n,e.byteOffset||e.byteLength!=e.buffer.byteLength?new o(e):e).buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t);var e}function rn(t=new r("Unknown error")){const{message:n,stack:e,code:s,name:o,outputSize:c,cause:i,codecImportFailed:a}=t,f={message:n,stack:e,code:s,name:o,outputSize:c};i&&(f.cause={name:i.name,message:i.message}),a&&(f.codecImportFailed=!0),p({error:f})}addEventListener("message",({data:t})=>{const{type:n,messageId:e,value:s,done:r}=t;try{if("start"==n&&en(t),n==qt){const t=Zt.get(e);Zt.delete(e),t({value:s||new o,done:r})}if("ack"==n){const t=$t.get(e);$t.delete(e),t()}n==Gt&&tn.abort()}catch(t){rn(t)}}),p({type:"ready"});const on="deflate",cn="deflate-raw",an="deflate64-raw",fn="gzip";let un,ln,wn,hn,pn;function dn(t,n,e={}){if(!un){const t=new r("WASM module not loaded");throw t.cause=pn,t}const c="number"==typeof e.level?e.level:-1,i="number"==typeof e.outBuffer?e.outBuffer:65536,a="number"==typeof e.inBufferSize?e.inBufferSize:65536;return new d({start(){try{let e;if(this.ut=ln(i),this.in=ln(a),this.inBufferSize=a,!this.ut||!this.in)throw new r("allocation failed");if(this.lt=new o(i),t?(this.wt=un.deflate_process,this.ht=un.deflate_last_consumed,this.yt=un.deflate_end,this.St=un.deflate_new(),e=n===fn?un.deflate_init_gzip(this.St,c):n===cn?un.deflate_init_raw(this.St,c):un.deflate_init(this.St,c)):n===an?(this.wt=un.inflate9_process,this.ht=un.inflate9_last_consumed,this.yt=un.inflate9_end,this.St=un.inflate9_new(),e=un.inflate9_init_raw(this.St)):(this.wt=un.inflate_process,this.ht=un.inflate_last_consumed,this.yt=un.inflate_end,this.St=un.inflate_new(),e=n===cn?un.inflate_init_raw(this.St):n===fn?un.inflate_init_gzip(this.St):un.inflate_init(this.St)),0!==e)throw new r("init failed:"+e)}catch(t){throw f(this),t}},transform(n,e){try{const c=n,a=new o(hn.buffer),f=this.wt,u=this.ht,l=this.ut,w=this.lt;let h=0;for(;h<c.length;){const n=s.min(c.length-h,32768);if((!this.in||this.inBufferSize<n)&&(this.in&&wn&&(wn(this.in),this.in=0),this.in=ln(n),this.inBufferSize=n,!this.in))throw new r("allocation failed");a.set(c.subarray(h,h+n),this.in);const o=f(this.St,this.in,n,l,i,0),p=16777215&o;if(p&&(w.set(a.subarray(l,l+p),0),e.enqueue(w.slice(0,p))),!t){const t=o>>24&255,n=128&t?t-256:t;if(n<0)throw new r("process error:"+n)}const d=u(this.St);if(0===d)break;h+=d}}catch(t){f(this),e.error(t)}},flush(n){try{const e=new o(hn.buffer),s=this.wt,c=this.ut,a=this.lt;for(;;){const o=s(this.St,0,0,c,i,4),f=16777215&o,u=o>>24&255;if(!t){const t=128&u?u-256:u;if(t<0)throw new r("process error:"+t)}if(f&&(a.set(e.subarray(c,c+f),0),n.enqueue(a.slice(0,f))),1===u||0===f)break}}catch(t){n.error(t)}finally{const t=f(this);0!==t&&n.error(new r("end error:"+t))}},cancel(){f(this)}});function f(t){let n=0;return t.St&&t.yt&&(n=t.yt(t.St)),t.St=0,t.in&&wn&&wn(t.in),t.in=0,t.ut&&wn&&wn(t.ut),t.ut=0,n}}class yn{constructor(t=on,n){return dn(!0,t,n)}}class mn{constructor(t=on,n){return dn(!1,t,n)}}yn.gt=!0,mn.gt=!0,yn.vt=[on,cn,fn],mn.vt=[on,cn,fn,an];let Sn=!1;!function(t={}){const{init:n}=t,e=t.CompressionStreamFallback||t.CompressionStreamZlib,s=t.DecompressionStreamFallback||t.DecompressionStreamZlib;self.initModule=async t=>{n&&await n(t),e&&(t.CompressionStreamFallback=e),s&&(t.DecompressionStreamFallback=s)}}({CompressionStreamFallback:yn,DecompressionStreamFallback:mn,init:t=>async function(t,{baseURI:n}){if(!Sn)try{await async function(t,n){let e,s;try{try{s=new URL(t,n)}catch{}const r=await fetch(s);e=await r.arrayBuffer()}catch(n){if(!t.startsWith("data:application/wasm;base64,"))throw n;e=function(t){const n=t.split(",")[1],e=atob(n),s=e.length,r=new o(s);for(let t=0;t<s;++t)r[t]=e.charCodeAt(t);return r.buffer}(t)}!function(t){if(un=t,({malloc:ln,free:wn,memory:hn}=un),"function"!=typeof ln||"function"!=typeof wn||!hn)throw un=ln=wn=hn=null,new r("Invalid WASM module")}((await WebAssembly.instantiate(e)).instance.exports)}(t,n),Sn=!0}catch(t){throw function(t){pn=t}(t),t}}(t.wasmURI,t)})});\n';if("string"==typeof s&&(s=(new TextEncoder).encode(s)),t){const t=new Blob([s],{type:n});return URL.createObjectURL(t)}return "data:"+n+";base64,"+function(t){let n="";const s=t.length;let r=0;for(;r+2<s;r+=3){const s=t[r]<<16|t[r+1]<<8|t[r+2];n+=e$1[s>>18&63]+e$1[s>>12&63]+e$1[s>>6&63]+e$1[63&s];}const o=s-r;if(1===o){const s=t[r]<<16;n+=e$1[s>>18&63]+e$1[s>>12&63]+"==";}else if(2===o){const s=t[r]<<16|t[r+1]<<8;n+=e$1[s>>18&63]+e$1[s>>12&63]+e$1[s>>6&63]+"=";}return n}(s)}});
418
418
 
419
419
  /*
420
420
  Copyright (c) 2026 Gildas Lormeau. All rights reserved.
@@ -2084,6 +2084,10 @@
2084
2084
  return registeredCodecs.get(compressionMethod);
2085
2085
  }
2086
2086
 
2087
+ function getRegisteredCodecs() {
2088
+ return Array.from(registeredCodecs.values(), codec => Object.assign({}, codec, codecStreams.get(codec.format)));
2089
+ }
2090
+
2087
2091
  function getCodecStreams(format) {
2088
2092
  return codecStreams.get(format);
2089
2093
  }
@@ -2135,9 +2139,9 @@
2135
2139
  const ERR_INVALID_COMPRESSED_DATA = "Invalid compressed data";
2136
2140
  const ERR_INVALID_CRC32 = ERR_INVALID_SIGNATURE;
2137
2141
  const ERR_UNSUPPORTED_COMPRESSION$2 = "Compression method not supported";
2138
- const FORMAT_DEFLATE_RAW = "deflate-raw";
2139
- const FORMAT_DEFLATE64_RAW = "deflate64-raw";
2140
- const FORMAT_GZIP = "gzip";
2142
+ const FORMAT_DEFLATE_RAW$1 = "deflate-raw";
2143
+ const FORMAT_DEFLATE64_RAW$1 = "deflate64-raw";
2144
+ const FORMAT_GZIP$1 = "gzip";
2141
2145
  const GZIP_HEADER_LENGTH = 10;
2142
2146
  const GZIP_TRAILER_LENGTH = 8;
2143
2147
  const GZIP_HEADER_BYTES = [0x1f, 0x8b, 0x08];
@@ -2147,7 +2151,7 @@
2147
2151
 
2148
2152
  constructor(options, { chunkSize, CompressionStreamFallback, CompressionStream }) {
2149
2153
  super({});
2150
- const { compressed, encrypted, useCompressionStream, zipCrypto, computeCrc32, level, deflate64, format, compressionMethod } = options;
2154
+ const { compressed, encrypted, useCompressionStream, zipCrypto, computeCrc32, level, deflate64, format, compressionMethod, inputSize } = options;
2151
2155
  const stream = this;
2152
2156
  let crc32Stream, encryptionStream, gzipCrc32Stream;
2153
2157
  let readable = super.readable;
@@ -2160,10 +2164,10 @@
2160
2164
  }
2161
2165
  if (compressed) {
2162
2166
  if (codecStreams) {
2163
- readable = pipeThroughBackpressured(readable, createCodecStream(codecStreams.CompressionStream, format, { level, chunkSize, compressionMethod }));
2167
+ readable = pipeThroughBackpressured(readable, createCodecStream(codecStreams.CompressionStream, format, { level, chunkSize, compressionMethod, uncompressedSize: inputSize }));
2164
2168
  } else if (useGzipCrc32) {
2165
2169
  gzipCrc32Stream = new GzipToRawDeflateStream();
2166
- readable = pipeThroughBackpressured(readable, new CompressionStream(FORMAT_GZIP));
2170
+ readable = pipeThroughBackpressured(readable, new CompressionStream(FORMAT_GZIP$1));
2167
2171
  readable = pipeThrough(readable, gzipCrc32Stream);
2168
2172
  } else {
2169
2173
  try {
@@ -2171,7 +2175,7 @@
2171
2175
  } catch (error) {
2172
2176
  let gzipStream;
2173
2177
  try {
2174
- gzipStream = new CompressionStream(FORMAT_GZIP);
2178
+ gzipStream = new CompressionStream(FORMAT_GZIP$1);
2175
2179
  } catch {
2176
2180
  throw error;
2177
2181
  }
@@ -2335,7 +2339,7 @@
2335
2339
  }
2336
2340
  let gzipStream;
2337
2341
  try {
2338
- gzipStream = new DecompressionStream(FORMAT_GZIP);
2342
+ gzipStream = new DecompressionStream(FORMAT_GZIP$1);
2339
2343
  } catch {
2340
2344
  throw error;
2341
2345
  }
@@ -2384,11 +2388,11 @@
2384
2388
  }
2385
2389
 
2386
2390
  function supportsDeflateRaw(StreamClass) {
2387
- return supportsFormat(StreamClass, FORMAT_DEFLATE_RAW);
2391
+ return supportsFormat(StreamClass, FORMAT_DEFLATE_RAW$1);
2388
2392
  }
2389
2393
 
2390
2394
  function supportsGzip(StreamClass) {
2391
- return supportsFormat(StreamClass, FORMAT_GZIP);
2395
+ return supportsFormat(StreamClass, FORMAT_GZIP$1);
2392
2396
  }
2393
2397
 
2394
2398
  function setReadable(stream, readable, flush) {
@@ -2411,7 +2415,7 @@
2411
2415
  const Stream = useCompressionStream && CompressionStreamNative ?
2412
2416
  CompressionStreamNative :
2413
2417
  CompressionStreamFallback || CompressionStreamNative;
2414
- const format = options.deflate64 ? FORMAT_DEFLATE64_RAW : FORMAT_DEFLATE_RAW;
2418
+ const format = options.deflate64 ? FORMAT_DEFLATE64_RAW$1 : FORMAT_DEFLATE_RAW$1;
2415
2419
  let codecStream;
2416
2420
  try {
2417
2421
  codecStream = new Stream(format, options);
@@ -6676,6 +6680,13 @@
6676
6680
  const { comment } = metadataInfo;
6677
6681
  const extraField = options[PROPERTY_NAME_EXTRA_FIELD];
6678
6682
  zipWriter.fileEntries.set(name, UNDEFINED_VALUE);
6683
+ const previousFileEntry = zipWriter.lastFileEntry;
6684
+ const pendingFileEntry = {};
6685
+ let releaseLockFileEntry;
6686
+ if (metadataInfo.resolvedOptions.keepOrder) {
6687
+ pendingFileEntry.lockFileEntry = new Promise(resolve => releaseLockFileEntry = resolve);
6688
+ }
6689
+ zipWriter.lastFileEntry = pendingFileEntry;
6679
6690
  let fileEntry;
6680
6691
  try {
6681
6692
  const { resolvedOptions } = metadataInfo;
@@ -6697,10 +6708,21 @@
6697
6708
  const headerInfo = getHeaderInfo(options);
6698
6709
  const dataDescriptorInfo = getDataDescriptorInfo(options);
6699
6710
  const metadataSize = getLength(headerInfo.localHeaderArray, dataDescriptorInfo.dataDescriptorArray);
6700
- fileEntry = await getFileEntry(zipWriter, name, reader, { headerInfo, dataDescriptorInfo, metadataSize }, options);
6711
+ fileEntry = await getFileEntry(zipWriter, name, reader, {
6712
+ headerInfo,
6713
+ dataDescriptorInfo,
6714
+ metadataSize,
6715
+ fileEntry: pendingFileEntry,
6716
+ previousFileEntry,
6717
+ releaseLockFileEntry
6718
+ }, options);
6701
6719
  } catch (error) {
6702
6720
  zipWriter.fileEntries.delete(name);
6703
6721
  throw error;
6722
+ } finally {
6723
+ if (releaseLockFileEntry) {
6724
+ releaseLockFileEntry(previousFileEntry && previousFileEntry.lockFileEntry);
6725
+ }
6704
6726
  }
6705
6727
  Object.assign(fileEntry, {
6706
6728
  name,
@@ -7088,7 +7110,6 @@
7088
7110
  }
7089
7111
  const usdz = writerOptions[OPTION_USDZ];
7090
7112
  const files = new Map();
7091
- let layoutDependsOnWriteOrder = Boolean(usdz);
7092
7113
  const initialOffset = writerOptions[OPTION_OFFSET] === UNDEFINED_VALUE ? 0 : writerOptions[OPTION_OFFSET];
7093
7114
  let offset = initialOffset;
7094
7115
  let minimumEntrySize = INFINITY_VALUE;
@@ -7134,9 +7155,7 @@
7134
7155
  minimumEntrySize = Math.min(minimumEntrySize, entrySize);
7135
7156
  offset += entrySize;
7136
7157
  }
7137
- if (files.size && offset - minimumEntrySize >= MAX_32_BITS) {
7138
- layoutDependsOnWriteOrder = true;
7139
- }
7158
+ const layoutDependsOnWriteOrder = files.size > 1 && (usdz || offset - minimumEntrySize >= MAX_32_BITS);
7140
7159
  if (layoutDependsOnWriteOrder && !writeOrderGuaranteed) {
7141
7160
  throw new Error(ERR_UNDETERMINED_SIZE);
7142
7161
  }
@@ -7164,27 +7183,23 @@
7164
7183
  signal
7165
7184
  } = options;
7166
7185
  const {
7167
- headerInfo
7186
+ headerInfo,
7187
+ fileEntry: pendingFileEntry,
7188
+ previousFileEntry,
7189
+ releaseLockFileEntry
7168
7190
  } = entryInfo;
7169
7191
  const usdz = zipWriter.options[OPTION_USDZ];
7170
- const previousFileEntry = zipWriter.lastFileEntry;
7171
- let fileEntry = {};
7192
+ let fileEntry = pendingFileEntry;
7172
7193
  let bufferedWrite;
7173
7194
  let releaseLockWriter;
7174
- let releaseLockCurrentFileEntry;
7175
7195
  let writingBufferedEntryData;
7176
7196
  let writingEntryData;
7177
7197
  let writerSizeBeforeEntry;
7178
7198
  let flushedBufferedSize = 0;
7179
7199
  let fileWriter;
7200
+ const lockPreviousFileEntry = keepOrder && previousFileEntry ? previousFileEntry.lockFileEntry : UNDEFINED_VALUE;
7180
7201
  fileEntries.set(name, fileEntry);
7181
- zipWriter.lastFileEntry = fileEntry;
7182
7202
  try {
7183
- let lockPreviousFileEntry;
7184
- if (keepOrder) {
7185
- lockPreviousFileEntry = previousFileEntry && previousFileEntry.lockFileEntry;
7186
- requestLockCurrentFileEntry();
7187
- }
7188
7203
  if (options.bufferedWrite || !keepOrder || zipWriter.writerLocked || zipWriter.bufferedWrites || (!dataDescriptor && !emptyEntry)) {
7189
7204
  bufferedWrite = true;
7190
7205
  zipWriter.bufferedWrites++;
@@ -7197,6 +7212,7 @@
7197
7212
  await initStream(writer);
7198
7213
  } else {
7199
7214
  fileWriter = writer;
7215
+ await lockPreviousFileEntry;
7200
7216
  await requestLockWriter();
7201
7217
  }
7202
7218
  await initStream(fileWriter);
@@ -7209,7 +7225,6 @@
7209
7225
  }
7210
7226
  const { localHeaderArray } = headerInfo;
7211
7227
  if (!bufferedWrite) {
7212
- await lockPreviousFileEntry;
7213
7228
  await skipDiskIfNeeded();
7214
7229
  }
7215
7230
  const diskNumberStart = getDiskNumber(writer);
@@ -7274,8 +7289,8 @@
7274
7289
  if (bufferedWrite) {
7275
7290
  zipWriter.bufferedWrites--;
7276
7291
  }
7277
- if (releaseLockCurrentFileEntry) {
7278
- releaseLockCurrentFileEntry();
7292
+ if (releaseLockFileEntry) {
7293
+ releaseLockFileEntry(lockPreviousFileEntry);
7279
7294
  }
7280
7295
  if (releaseLockWriter) {
7281
7296
  releaseLockWriter();
@@ -7289,10 +7304,6 @@
7289
7304
  }
7290
7305
  }
7291
7306
 
7292
- function requestLockCurrentFileEntry() {
7293
- fileEntry.lockFileEntry = new Promise(resolve => releaseLockCurrentFileEntry = resolve);
7294
- }
7295
-
7296
7307
  async function requestLockWriter() {
7297
7308
  zipWriter.writerLocked = true;
7298
7309
  const { lockWriter } = zipWriter;
@@ -7427,6 +7438,7 @@
7427
7438
  const workerOptions = {
7428
7439
  options: {
7429
7440
  codecType: CODEC_DEFLATE,
7441
+ inputSize: size,
7430
7442
  level,
7431
7443
  rawPassword,
7432
7444
  password,
@@ -8537,6 +8549,111 @@
8537
8549
  */
8538
8550
 
8539
8551
 
8552
+ function getSupportedCompressionMethods() {
8553
+ const { CompressionStream, DecompressionStream, CompressionStreamFallback, DecompressionStreamFallback } = getConfiguration();
8554
+ const supportedMethods = [{
8555
+ compressionMethod: COMPRESSION_METHOD_STORE,
8556
+ compression: true,
8557
+ decompression: true,
8558
+ registered: false
8559
+ }, {
8560
+ compressionMethod: COMPRESSION_METHOD_DEFLATE,
8561
+ compression: formatSupported(CompressionStreamFallback, FORMAT_DEFLATE_RAW$1) ||
8562
+ formatSupported(CompressionStream, FORMAT_DEFLATE_RAW$1) || formatSupported(CompressionStream, FORMAT_GZIP$1),
8563
+ decompression: formatSupported(DecompressionStreamFallback, FORMAT_DEFLATE_RAW$1) ||
8564
+ formatSupported(DecompressionStream, FORMAT_DEFLATE_RAW$1) || formatSupported(DecompressionStream, FORMAT_GZIP$1),
8565
+ registered: false
8566
+ }, {
8567
+ compressionMethod: COMPRESSION_METHOD_DEFLATE_64,
8568
+ compression: false,
8569
+ decompression: formatSupported(DecompressionStreamFallback, FORMAT_DEFLATE64_RAW$1) ||
8570
+ formatSupported(DecompressionStream, FORMAT_DEFLATE64_RAW$1),
8571
+ registered: false
8572
+ }];
8573
+ for (const codec of getRegisteredCodecs()) {
8574
+ const codecStreams = getCodecStreams(codec.format);
8575
+ supportedMethods.push({
8576
+ compressionMethod: codec.compressionMethod,
8577
+ // deno-lint-ignore valid-typeof
8578
+ compression: codecStreams ? typeof codecStreams.CompressionStream == FUNCTION_TYPE : UNDEFINED_VALUE,
8579
+ // deno-lint-ignore valid-typeof
8580
+ decompression: codecStreams ? typeof codecStreams.DecompressionStream == FUNCTION_TYPE : UNDEFINED_VALUE,
8581
+ registered: true
8582
+ });
8583
+ }
8584
+ return supportedMethods;
8585
+ }
8586
+
8587
+ function formatSupported(StreamClass, format) {
8588
+ if (!StreamClass) {
8589
+ return false;
8590
+ }
8591
+ const { supportedFormats } = StreamClass;
8592
+ if (supportedFormats) {
8593
+ return supportedFormats.includes(format);
8594
+ }
8595
+ return supportsFormat(StreamClass, format);
8596
+ }
8597
+
8598
+ /*
8599
+ Copyright (c) 2025 Gildas Lormeau. All rights reserved.
8600
+
8601
+ Redistribution and use in source and binary forms, with or without
8602
+ modification, are permitted provided that the following conditions are met:
8603
+
8604
+ 1. Redistributions of source code must retain the above copyright notice,
8605
+ this list of conditions and the following disclaimer.
8606
+
8607
+ 2. Redistributions in binary form must reproduce the above copyright
8608
+ notice, this list of conditions and the following disclaimer in
8609
+ the documentation and/or other materials provided with the distribution.
8610
+
8611
+ 3. The names of the authors may not be used to endorse or promote products
8612
+ derived from this software without specific prior written permission.
8613
+
8614
+ THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
8615
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
8616
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
8617
+ INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
8618
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
8619
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
8620
+ OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
8621
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
8622
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
8623
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8624
+ */
8625
+
8626
+ const VERSION = "2.8.61";
8627
+
8628
+ /*
8629
+ Copyright (c) 2025 Gildas Lormeau. All rights reserved.
8630
+
8631
+ Redistribution and use in source and binary forms, with or without
8632
+ modification, are permitted provided that the following conditions are met:
8633
+
8634
+ 1. Redistributions of source code must retain the above copyright notice,
8635
+ this list of conditions and the following disclaimer.
8636
+
8637
+ 2. Redistributions in binary form must reproduce the above copyright
8638
+ notice, this list of conditions and the following disclaimer in
8639
+ the documentation and/or other materials provided with the distribution.
8640
+
8641
+ 3. The names of the authors may not be used to endorse or promote products
8642
+ derived from this software without specific prior written permission.
8643
+
8644
+ THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
8645
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
8646
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
8647
+ INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
8648
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
8649
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
8650
+ OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
8651
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
8652
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
8653
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8654
+ */
8655
+
8656
+
8540
8657
  const DEFAULT_THRESHOLD$2 = 1024 * 1024;
8541
8658
  const DEFAULT_DIRECTORY_NAME$1 = ".zip.js-temp";
8542
8659
 
@@ -8987,6 +9104,11 @@
8987
9104
 
8988
9105
  /* global TransformStream */
8989
9106
 
9107
+ const FORMAT_DEFLATE = "deflate";
9108
+ const FORMAT_DEFLATE_RAW = "deflate-raw";
9109
+ const FORMAT_DEFLATE64_RAW = "deflate64-raw";
9110
+ const FORMAT_GZIP = "gzip";
9111
+
8990
9112
  let wasm, malloc, free, memory, initError;
8991
9113
 
8992
9114
  function setWasmExports(wasmAPI) {
@@ -9032,15 +9154,15 @@
9032
9154
  this._last_consumed = wasm.deflate_last_consumed;
9033
9155
  this._end = wasm.deflate_end;
9034
9156
  this.streamHandle = wasm.deflate_new();
9035
- if (type === "gzip") {
9157
+ if (type === FORMAT_GZIP) {
9036
9158
  result = wasm.deflate_init_gzip(this.streamHandle, level);
9037
- } else if (type === "deflate-raw") {
9159
+ } else if (type === FORMAT_DEFLATE_RAW) {
9038
9160
  result = wasm.deflate_init_raw(this.streamHandle, level);
9039
9161
  } else {
9040
9162
  result = wasm.deflate_init(this.streamHandle, level);
9041
9163
  }
9042
9164
  } else {
9043
- if (type === "deflate64-raw") {
9165
+ if (type === FORMAT_DEFLATE64_RAW) {
9044
9166
  this._process = wasm.inflate9_process;
9045
9167
  this._last_consumed = wasm.inflate9_last_consumed;
9046
9168
  this._end = wasm.inflate9_end;
@@ -9051,9 +9173,9 @@
9051
9173
  this._last_consumed = wasm.inflate_last_consumed;
9052
9174
  this._end = wasm.inflate_end;
9053
9175
  this.streamHandle = wasm.inflate_new();
9054
- if (type === "deflate-raw") {
9176
+ if (type === FORMAT_DEFLATE_RAW) {
9055
9177
  result = wasm.inflate_init_raw(this.streamHandle);
9056
- } else if (type === "gzip") {
9178
+ } else if (type === FORMAT_GZIP) {
9057
9179
  result = wasm.inflate_init_gzip(this.streamHandle);
9058
9180
  } else {
9059
9181
  result = wasm.inflate_init(this.streamHandle);
@@ -9174,12 +9296,12 @@
9174
9296
  }
9175
9297
 
9176
9298
  class CompressionStreamZlib {
9177
- constructor(type = "deflate", options) {
9299
+ constructor(type = FORMAT_DEFLATE, options) {
9178
9300
  return _make(true, type, options);
9179
9301
  }
9180
9302
  }
9181
9303
  class DecompressionStreamZlib {
9182
- constructor(type = "deflate", options) {
9304
+ constructor(type = FORMAT_DEFLATE, options) {
9183
9305
  return _make(false, type, options);
9184
9306
  }
9185
9307
  }
@@ -9188,6 +9310,11 @@
9188
9310
  // module fails to load, rather than discarding a self-contained codec supplied through config.
9189
9311
  CompressionStreamZlib.requiresModule = true;
9190
9312
  DecompressionStreamZlib.requiresModule = true;
9313
+ // Constructing these classes before the module is loaded throws, so capability probes cannot rely
9314
+ // on trying the constructor; the formats are declared instead, next to the branches implementing
9315
+ // them in _make().
9316
+ CompressionStreamZlib.supportedFormats = [FORMAT_DEFLATE, FORMAT_DEFLATE_RAW, FORMAT_GZIP];
9317
+ DecompressionStreamZlib.supportedFormats = [FORMAT_DEFLATE, FORMAT_DEFLATE_RAW, FORMAT_GZIP, FORMAT_DEFLATE64_RAW];
9191
9318
 
9192
9319
  /*
9193
9320
  Copyright (c) 2025 Gildas Lormeau. All rights reserved.
@@ -9848,12 +9975,13 @@
9848
9975
  if (options.bufferedWrite === UNDEFINED_VALUE) {
9849
9976
  options.bufferedWrite = true;
9850
9977
  }
9851
- const writeOrderGuaranteed = !options.bufferedWrite ||
9852
- (options.keepOrder !== false && zipEntry.children.every(child => !child.children.length));
9853
- return getEntriesSize(options, zipEntry.getChildren({ recursive: true }).filter(child => !isImplicitDirectory(child)).map(child => {
9978
+ const entries = zipEntry.getChildren({ recursive: true }).filter(child => !isImplicitDirectory(child)).map(child => {
9854
9979
  const { name, entryOptions } = getChildEntryOptions(child, zipEntry, options);
9855
9980
  return { name, size: child.directory ? 0 : getDeterminedSize(child, isPassThrough(child, options)), options: entryOptions };
9856
- }), writeOrderGuaranteed, options.globalComment);
9981
+ });
9982
+ const writeOrderGuaranteed = !options.bufferedWrite ||
9983
+ (entries.every(entry => entry.options.keepOrder !== false) && zipEntry.children.every(child => !child.children.length));
9984
+ return getEntriesSize(options, entries, writeOrderGuaranteed, options.globalComment);
9857
9985
  }
9858
9986
 
9859
9987
  getChildByName(name) {
@@ -10858,6 +10986,7 @@
10858
10986
  exports.TextWriter = TextWriter;
10859
10987
  exports.Uint8ArrayReader = Uint8ArrayReader;
10860
10988
  exports.Uint8ArrayWriter = Uint8ArrayWriter;
10989
+ exports.VERSION = VERSION;
10861
10990
  exports.WARNING_APPENDED_DATA = WARNING_APPENDED_DATA;
10862
10991
  exports.WARNING_COMPRESSED_PATCHED_DATA = WARNING_COMPRESSED_PATCHED_DATA;
10863
10992
  exports.WARNING_DUPLICATE_FILENAME = WARNING_DUPLICATE_FILENAME;
@@ -10887,6 +11016,8 @@
10887
11016
  exports.createSyncAccessHandleTempStream = createSyncAccessHandleTempStream;
10888
11017
  exports.fs = fs;
10889
11018
  exports.getMimeType = getMimeType;
11019
+ exports.getRegisteredCodecs = getRegisteredCodecs;
11020
+ exports.getSupportedCompressionMethods = getSupportedCompressionMethods;
10890
11021
  exports.isZipFile = isZipFile;
10891
11022
  exports.registerCodec = registerCodec;
10892
11023
  exports.resetConfiguration = resetConfiguration;