@zip.js/zip.js 2.16.0 → 2.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deno.json +1 -1
- package/dist/zip-core-external.js +429 -274
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +230 -151
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +580 -283
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +383 -160
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +580 -283
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +386 -163
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +583 -283
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +232 -153
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +233 -154
- package/dist/zip-native.min.js +1 -1
- package/dist/zip-web-worker-native.js +1 -1
- package/dist/zip-web-worker.js +1 -1
- package/dist/zip.js +430 -274
- package/dist/zip.min.js +1 -1
- package/eslint.config.mjs +1 -1
- package/index-native.cjs +386 -163
- package/index-native.min.js +1 -1
- package/index.cjs +583 -283
- package/index.d.cts +168 -29
- package/index.d.ts +168 -29
- package/index.min.js +1 -1
- package/lib/core/codec-pool.js +2 -0
- package/lib/core/codec-worker-web.js +11 -3
- package/lib/core/codec-worker.js +2 -1
- package/lib/core/streams/aes-crypto-stream.js +60 -17
- package/lib/core/streams/codec-stream.js +2 -0
- package/lib/core/streams/zip-crypto-stream.js +7 -7
- package/lib/core/streams/zip-entry-stream.js +130 -113
- package/lib/core/streams/zlib-js/zlib-streams.min.js +1 -1
- package/lib/core/streams/zlib-wasm/zlib-streams.js +199 -122
- package/lib/core/util/compatible-streams.js +10 -5
- package/lib/core/version.js +1 -1
- package/lib/core/web-worker-base.js +1 -1
- package/lib/core/web-worker-inline-native.js +1 -1
- package/lib/core/web-worker-inline-wasm.js +1 -1
- package/lib/core/zip-fs.js +157 -10
- package/lib/core/zip-reader.js +8 -5
- package/lib/core/zip-writer.js +5 -2
- package/lib/zip-core-reader.js +1 -0
- package/package.json +3 -2
package/index.cjs
CHANGED
|
@@ -217,7 +217,7 @@ const ERR_INVALID_SIGNAL = "Invalid signal (must be an AbortSignal instance)";
|
|
|
217
217
|
const ERR_INVALID_PASSWORD_TYPE = "Invalid password (password must be a string, rawPassword must be a Uint8Array)";
|
|
218
218
|
const ERR_INVALID_PASS_THROUGH_VALUE = "Invalid passThrough option (must be a boolean or 'compressed')";
|
|
219
219
|
const ERR_ABORTED = "The operation was aborted";
|
|
220
|
-
const ABORT_ERROR_NAME = "AbortError";
|
|
220
|
+
const ABORT_ERROR_NAME$1 = "AbortError";
|
|
221
221
|
|
|
222
222
|
function checkFunctionOption(value) {
|
|
223
223
|
if (value && typeof value != FUNCTION_TYPE) {
|
|
@@ -235,7 +235,7 @@ function checkSignalOption(signal) {
|
|
|
235
235
|
|
|
236
236
|
function throwIfAborted(signal) {
|
|
237
237
|
if (signal && signal.aborted) {
|
|
238
|
-
throw signal.reason === UNDEFINED_VALUE ? new DOMException(ERR_ABORTED, ABORT_ERROR_NAME) : signal.reason;
|
|
238
|
+
throw signal.reason === UNDEFINED_VALUE ? new DOMException(ERR_ABORTED, ABORT_ERROR_NAME$1) : signal.reason;
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
|
|
@@ -439,7 +439,7 @@ function resetConfiguration() {
|
|
|
439
439
|
Object.assign(config, DEFAULT_CONFIGURATION);
|
|
440
440
|
}
|
|
441
441
|
|
|
442
|
-
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 n$1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e$1=t=>t({workerURI:t=>{const e="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:o,Error:s,Uint8Array:r,Uint16Array:c,Uint32Array:i,Int32Array:a,Map:f,DataView:u,Promise:w,TextEncoder:l,crypto:h,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:S,DecompressionStream:g}=self,v=void 0,k="undefined",z="function",b=new r,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,M,x,P,D,F,E]=C;class R{constructor(t){this.o=t||-1}append(t){let n=0|this.o;const e=0|t.length;let o=0;if(e>=8&&t.buffer){const s=new u(t.buffer,t.byteOffset,e),r=e-8;for(;o<=r;o+=8){const t=n^s.getInt32(o,!0),e=s.getInt32(o+4,!0);n=E[255&t]^F[t>>>8&255]^D[t>>>16&255]^P[t>>>24&255]^x[255&e]^M[e>>>8&255]^A[e>>>16&255]^I[e>>>24&255]}}for(;o<e;o++)n=n>>>8^I[255&(n^t[o])];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 r(4);new u(e.buffer).setUint32(0,n.get()),t.value=e}}),t=this}}function B(t,n){const e=new r(t.length+n.length);return e.set(t),e.set(n,t.length),e}function V(t){return new u(t.buffer,t.byteOffset,t.byteLength)}const W=64,j=20,K=new r([128]),O=new r(1),T=new a([1732584193,4023233417,2562383102,271733878,3285377520]),H=new r(256),L=new a(256),N=new a(256),q=new a(256),G=new a(256);let J=!1;function Q(t,n){!function(){if(!J){let t=1,n=1;do{t=255&(t^t<<1^(128&t?27:0)),n=255&(n^n<<1),n=255&(n^n<<2),n=255&(n^n<<4),128&n&&(n^=9),H[t]=255&(n^(n<<1|n>>7)^(n<<2|n>>6)^(n<<3|n>>5)^(n<<4|n>>4)^99)}while(1!=t);H[0]=99;for(let t=0;t<256;t++){const n=H[t],e=$(n),o=e<<24|n<<16|n<<8|e^n;L[t]=o,N[t]=o>>>8|o<<24,q[t]=o>>>16|o<<16,G[t]=o>>>24|o<<8}J=!0}}();const e=new a(60),o=function(t,n){const e=t.length>>2,o=e+6,s=4*(o+1);let r=1;for(let o=0;o<e;o++)n[o]=t[4*o]<<24|t[4*o+1]<<16|t[4*o+2]<<8|t[4*o+3];for(let t=e;t<s;t++){let o=n[t-1];t%e==0?(o=Y(o<<8|o>>>24)^r<<24,r=$(r)):e>6&&t%e==4&&(o=Y(o)),n[t]=n[t-e]^o}return o}(t,e),s=new a(4),r=X(n);let c=0,i=0,f=0,w=0;return{process(t,n){n&&r.update(t,0,t.length),function(t){const n=new u(t.buffer,t.byteOffset,t.byteLength),e=t.length;let o=0;for(;o+16<=e;o+=16)l(),n.setInt32(o,n.getInt32(o)^s[0]),n.setInt32(o+4,n.getInt32(o+4)^s[1]),n.setInt32(o+8,n.getInt32(o+8)^s[2]),n.setInt32(o+12,n.getInt32(o+12)^s[3]);if(o<e){l();for(let n=0;o<e;o++,n++)t[o]^=s[n>>2]>>>24-8*(3&n)}}(t),n||r.update(t,0,t.length)},digest:()=>r.digest()};function l(){c=c+1|0,c||(i=i+1|0,i||(f=f+1|0,f||(w=w+1|0)));let t=Z(c)^e[0],n=Z(i)^e[1],r=Z(f)^e[2],a=Z(w)^e[3],u=L[t>>>24]^N[n>>>16&255]^q[r>>>8&255]^G[255&a]^e[4],l=L[n>>>24]^N[r>>>16&255]^q[a>>>8&255]^G[255&t]^e[5],h=L[r>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[6],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&r]^e[7];t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[8],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[9],r=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[10],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[11],u=L[t>>>24]^N[n>>>16&255]^q[r>>>8&255]^G[255&a]^e[12],l=L[n>>>24]^N[r>>>16&255]^q[a>>>8&255]^G[255&t]^e[13],h=L[r>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[14],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&r]^e[15],t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[16],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[17],r=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[18],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[19],u=L[t>>>24]^N[n>>>16&255]^q[r>>>8&255]^G[255&a]^e[20],l=L[n>>>24]^N[r>>>16&255]^q[a>>>8&255]^G[255&t]^e[21],h=L[r>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[22],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&r]^e[23],t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[24],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[25],r=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[26],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[27],u=L[t>>>24]^N[n>>>16&255]^q[r>>>8&255]^G[255&a]^e[28],l=L[n>>>24]^N[r>>>16&255]^q[a>>>8&255]^G[255&t]^e[29],h=L[r>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[30],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&r]^e[31],t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[32],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[33],r=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[34],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[35],u=L[t>>>24]^N[n>>>16&255]^q[r>>>8&255]^G[255&a]^e[36],l=L[n>>>24]^N[r>>>16&255]^q[a>>>8&255]^G[255&t]^e[37],h=L[r>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[38],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&r]^e[39];let d=40;o>10&&(t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[40],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[41],r=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[42],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[43],u=L[t>>>24]^N[n>>>16&255]^q[r>>>8&255]^G[255&a]^e[44],l=L[n>>>24]^N[r>>>16&255]^q[a>>>8&255]^G[255&t]^e[45],h=L[r>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[46],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&r]^e[47],d=48),o>12&&(t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[48],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[49],r=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[50],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[51],u=L[t>>>24]^N[n>>>16&255]^q[r>>>8&255]^G[255&a]^e[52],l=L[n>>>24]^N[r>>>16&255]^q[a>>>8&255]^G[255&t]^e[53],h=L[r>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[54],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&r]^e[55],d=56),s[0]=(H[u>>>24]<<24|H[l>>>16&255]<<16|H[h>>>8&255]<<8|H[255&p])^e[d],s[1]=(H[l>>>24]<<24|H[h>>>16&255]<<16|H[p>>>8&255]<<8|H[255&u])^e[d+1],s[2]=(H[h>>>24]<<24|H[p>>>16&255]<<16|H[u>>>8&255]<<8|H[255&l])^e[d+2],s[3]=(H[p>>>24]<<24|H[u>>>16&255]<<16|H[l>>>8&255]<<8|H[255&h])^e[d+3]}}function X(t){const n=function(){const t=new a(T),n=new a(16),e=new r(W),s=new u(e.buffer),c=new r(8);let i=0,f=0;return{update:w,digest:function(){const n=8*f,e=o.floor(n/4294967296),s=n>>>0;for(w(K,0,1);56!=i;)w(O,0,1);c[0]=e>>>24,c[1]=e>>>16,c[2]=e>>>8,c[3]=e,c[4]=s>>>24,c[5]=s>>>16,c[6]=s>>>8,c[7]=s,w(c,0,8);const a=new r(j),l=new u(a.buffer);for(let n=0;n<t.length;n++)l.setInt32(4*n,t[n]);return t.set(T),i=0,f=0,a}};function w(t,n,o){const r=n+o;if(f+=o,i){for(;n<r&&i<W;)e[i++]=t[n++];i==W&&(l(s,0),i=0)}if(n+W<=r){const e=new u(t.buffer,t.byteOffset,t.byteLength);for(;n+W<=r;n+=W)l(e,n)}for(;n<r;)e[i++]=t[n++]}function l(e,o){for(let t=0;t<16;t++)n[t]=e.getInt32(o+4*t);let s,r=t[0],c=t[1],i=t[2],a=t[3],f=t[4];for(let t=0;t<15;t+=5)f=(r<<5|r>>>27)+((i^a)&c^a)+f+1518500249+n[t]|0,c=c<<30|c>>>2,a=(f<<5|f>>>27)+((c^i)&r^i)+a+1518500249+n[t+1]|0,r=r<<30|r>>>2,i=(a<<5|a>>>27)+((r^c)&f^c)+i+1518500249+n[t+2]|0,f=f<<30|f>>>2,c=(i<<5|i>>>27)+((f^r)&a^r)+c+1518500249+n[t+3]|0,a=a<<30|a>>>2,r=(c<<5|c>>>27)+((a^f)&i^f)+r+1518500249+n[t+4]|0,i=i<<30|i>>>2;f=(r<<5|r>>>27)+((i^a)&c^a)+f+1518500249+n[15]|0,c=c<<30|c>>>2,s=n[13]^n[8]^n[2]^n[0],s=s<<1|s>>>31,n[0]=s,a=(f<<5|f>>>27)+((c^i)&r^i)+a+1518500249+s|0,r=r<<30|r>>>2,s=n[14]^n[9]^n[3]^n[1],s=s<<1|s>>>31,n[1]=s,i=(a<<5|a>>>27)+((r^c)&f^c)+i+1518500249+s|0,f=f<<30|f>>>2,s=n[15]^n[10]^n[4]^n[2],s=s<<1|s>>>31,n[2]=s,c=(i<<5|i>>>27)+((f^r)&a^r)+c+1518500249+s|0,a=a<<30|a>>>2,s=n[0]^n[11]^n[5]^n[3],s=s<<1|s>>>31,n[3]=s,r=(c<<5|c>>>27)+((a^f)&i^f)+r+1518500249+s|0,i=i<<30|i>>>2;for(let t=20;t<40;t+=5)s=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],s=s<<1|s>>>31,n[15&t]=s,f=(r<<5|r>>>27)+(c^i^a)+f+1859775393+s|0,c=c<<30|c>>>2,s=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],s=s<<1|s>>>31,n[t+1&15]=s,a=(f<<5|f>>>27)+(r^c^i)+a+1859775393+s|0,r=r<<30|r>>>2,s=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],s=s<<1|s>>>31,n[t+2&15]=s,i=(a<<5|a>>>27)+(f^r^c)+i+1859775393+s|0,f=f<<30|f>>>2,s=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],s=s<<1|s>>>31,n[t+3&15]=s,c=(i<<5|i>>>27)+(a^f^r)+c+1859775393+s|0,a=a<<30|a>>>2,s=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],s=s<<1|s>>>31,n[t+4&15]=s,r=(c<<5|c>>>27)+(i^a^f)+r+1859775393+s|0,i=i<<30|i>>>2;for(let t=40;t<60;t+=5)s=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],s=s<<1|s>>>31,n[15&t]=s,f=(r<<5|r>>>27)+(c&i|(c|i)&a)+f+2400959708+s|0,c=c<<30|c>>>2,s=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],s=s<<1|s>>>31,n[t+1&15]=s,a=(f<<5|f>>>27)+(r&c|(r|c)&i)+a+2400959708+s|0,r=r<<30|r>>>2,s=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],s=s<<1|s>>>31,n[t+2&15]=s,i=(a<<5|a>>>27)+(f&r|(f|r)&c)+i+2400959708+s|0,f=f<<30|f>>>2,s=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],s=s<<1|s>>>31,n[t+3&15]=s,c=(i<<5|i>>>27)+(a&f|(a|f)&r)+c+2400959708+s|0,a=a<<30|a>>>2,s=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],s=s<<1|s>>>31,n[t+4&15]=s,r=(c<<5|c>>>27)+(i&a|(i|a)&f)+r+2400959708+s|0,i=i<<30|i>>>2;for(let t=60;t<80;t+=5)s=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],s=s<<1|s>>>31,n[15&t]=s,f=(r<<5|r>>>27)+(c^i^a)+f+3395469782+s|0,c=c<<30|c>>>2,s=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],s=s<<1|s>>>31,n[t+1&15]=s,a=(f<<5|f>>>27)+(r^c^i)+a+3395469782+s|0,r=r<<30|r>>>2,s=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],s=s<<1|s>>>31,n[t+2&15]=s,i=(a<<5|a>>>27)+(f^r^c)+i+3395469782+s|0,f=f<<30|f>>>2,s=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],s=s<<1|s>>>31,n[t+3&15]=s,c=(i<<5|i>>>27)+(a^f^r)+c+3395469782+s|0,a=a<<30|a>>>2,s=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],s=s<<1|s>>>31,n[t+4&15]=s,r=(c<<5|c>>>27)+(i^a^f)+r+3395469782+s|0,i=i<<30|i>>>2;t[0]=t[0]+r|0,t[1]=t[1]+c|0,t[2]=t[2]+i|0,t[3]=t[3]+a|0,t[4]=t[4]+f|0}}(),e=new r(W),s=new r(W);t.length>W&&(n.update(t,0,t.length),t=n.digest());for(let n=0;n<W;n++){const o=n<t.length?t[n]:0;e[n]=54^o,s[n]=92^o}return n.update(e,0,W),{update(t,e,o){n.update(t,e,o)},digest(){const t=n.digest();n.update(s,0,W),n.update(t,0,j);const o=n.digest();return n.update(e,0,W),o}}}function Y(t){return H[t>>>24]<<24|H[t>>>16&255]<<16|H[t>>>8&255]<<8|H[255&t]}function Z(t){return t<<24|(65280&t)<<8|t>>>8&65280|t>>>24}function $(t){return 255&(t<<1^27*(t>>7))}const _=typeof h!=k&&typeof h.getRandomValues==z,tt="Invalid password",nt="zipjs-abort-check-password";function et(t){if(_)return h.getRandomValues(t);throw new s("Crypto API not supported")}const ot={name:"PBKDF2"},st=n.assign({hash:{name:"HMAC"}},ot),rt=n.assign({iterations:1e3,hash:{name:"SHA-1"}},ot),ct=["deriveBits"],it=[8,12,16],at=[16,24,32],ft=10,ut=typeof h!=k,wt=ut&&h.subtle;let lt=ut&&typeof wt!=k&&typeof wt.importKey==z&&typeof wt.deriveBits==z,ht=Q;class pt extends d{constructor({password:t,rawPassword:n,encryptionStrength:e,checkPasswordOnly:o,checkAuthenticationCode:c=!0}){super({start(){yt(this,t,n,e)},async transform(t,n){const e=this,{password:c,strength:i,l:a,ready:f}=e;c?(await async function(t,n,e,o){const r=await gt(t,n,e,kt(o,0,it[n])),c=kt(o,it[n]);if(r[0]!=c[0]||r[1]!=c[1])throw St(t),new s(tt)}(e,i,c,kt(t,0,it[i]+2)),t=kt(t,it[i]+2),o?(St(e),n.error(new s(nt))):a()):await f;const u=new r(t.length-ft-(t.length-ft)%16);n.enqueue(mt(e,t,u,0,ft,!0))},async flush(t){const{h:n,m:e,ready:o}=this;if(n){await o;const i=kt(e,e.length-ft),a=new r(kt(e,0,e.length-ft));n.process(a,!0);const f=n.digest();let u=e.length<ft?1:0;for(let t=0;t<ft;t++)u|=f[t]^i[t];if(u&&c)throw new s("Invalid authentication code");t.enqueue(a)}},cancel(){St(this)}})}}class dt extends d{constructor({password:t,rawPassword:n,encryptionStrength:e}){super({start(){yt(this,t,n,e)},async transform(t,n){const e=this,{password:o,strength:s,l:c,ready:i}=e;let a=b;o?(a=await async function(t,n,e){const o=et(new r(it[n]));return B(o,await gt(t,n,e,o))}(e,s,o),c()):await i;const f=new r(a.length+t.length-t.length%16);f.set(a,0),n.enqueue(mt(e,t,f,a.length,0,!1))},async flush(t){const{h:n,m:e,ready:o}=this;if(n){await o;const s=new r(e);n.process(s,!1);const c=kt(n.digest(),0,ft);t.enqueue(B(s,c))}},cancel(){St(this)}})}}function yt(t,e,o,s){n.assign(t,{ready:new w(n=>t.l=n),password:vt(e,o),strength:s-1,m:b})}function mt(t,n,e,o,s,c){const{h:i,m:a}=t;a.length&&(n=B(a,n));const f=n.length-s,u=f-f%16;if(e=function(t,n){if(n&&n>t.length){const e=t;(t=new r(n)).set(e,0)}return t}(e,o+u),u){const t=kt(e,o,o+u);t.set(kt(n,0,u)),i.process(t,c)}return t.m=kt(n,u),e}function St({h:t}){t&&t.dispose&&t.dispose()}async function gt(t,e,s,c){t.password=null;const i=at[e],a=await async function(t,e,s){if(lt)try{const o=await wt.importKey("raw",t,st,!1,ct);return new r(await wt.deriveBits(n.assign({salt:e},rt),o,8*s))}catch{lt=!1}return function(t,n,e,s){const c=X(t),i=new r(s),a=new r(n.length+4),f=new u(a.buffer);a.set(n);for(let t=1,e=0;e<s;t++,e+=j){f.setUint32(n.length,t),c.update(a,0,a.length);let r=c.digest();const u=r.slice();for(let t=1;t<1e3;t++){c.update(r,0,j),r=c.digest();for(let t=0;t<j;t++)u[t]^=r[t]}i.set(u.subarray(0,o.min(j,s-e)),e)}return i}(t,e,0,s)}(s,c,2*i+2);return t.h=ht(kt(a,0,i),kt(a,i,2*i)),kt(a,2*i)}function vt(t,n){return n===v?function(t){if(typeof l==k){t=unescape(encodeURIComponent(t));const n=new r(t.length);for(let e=0;e<n.length;e++)n[e]=t.charCodeAt(e);return n}return(new l).encode(t)}(t):n}function kt(t,n,e){return t.subarray(n,e)}class zt extends d{constructor({password:t,rawPassword:n,passwordVerification:e,checkPasswordOnly:o}){super({start(){Ct(this,t,n,e)},transform(t,n){const e=this;if(e.password||e.rawPassword){const n=It(e,t.subarray(0,12));if(e.password=e.rawPassword=null,0!=(n[11]^e.passwordVerification))throw new s(tt);t=t.subarray(12)}o?n.error(new s(nt)):n.enqueue(It(e,t))}})}}class bt extends d{constructor({password:t,rawPassword:n,passwordVerification:e}){super({start(){Ct(this,t,n,e)},transform(t,n){const e=this;let o,s;if(e.password||e.rawPassword){e.password=e.rawPassword=null;const n=et(new r(12));n[11]=e.passwordVerification,o=new r(t.length+n.length),o.set(At(e,n),0),s=12}else o=new r(t.length),s=0;o.set(At(e,t),s),n.enqueue(o)}})}}function Ct(t,e,o,s){n.assign(t,{password:e,rawPassword:o,passwordVerification:s}),function(t,e,o){const s=[305419896,591751049,878082192];if(n.assign(t,{keys:s,S:new R(s[0]),v:new R(s[2])}),o)for(let n=0;n<o.length;n++)Mt(t,o[n]);else for(let n=0;n<e.length;n++)Mt(t,e.charCodeAt(n))}(t,e,o)}function It(t,n){const e=new r(n.length);for(let o=0;o<n.length;o++)e[o]=xt(t)^n[o],Mt(t,e[o]);return e}function At(t,n){const e=new r(n.length);for(let o=0;o<n.length;o++)e[o]=xt(t)^n[o],Mt(t,n[o]);return e}function Mt(t,n){let[,e]=t.keys;t.S.append([n]);const s=~t.S.get();e=Dt(o.imul(Dt(e+Pt(s)),134775813)+1),t.v.append([e>>>24]);const r=~t.v.get();t.keys=[s,e,r]}function xt(t){const n=2|t.keys[2];return Pt(o.imul(n,1^n)>>>8)}function Pt(t){return 255&t}function Dt(t){return 4294967295&t}function Ft(t){if(t instanceof y)return t;const n=t.getReader();return new y({async pull(t){const{value:e,done:o}=await n.read();o?t.close():t.enqueue(e)},cancel:t=>n.cancel(t)})}const Et=new f;function Rt(t){return Et.get(t)}const Ut="Invalid uncompressed size",Bt="Invalid CRC32",Vt="deflate-raw",Wt="gzip",jt=[31,139,8];class Kt extends d{constructor(t,{chunkSize:n,CompressionStreamFallback:e,CompressionStream:o}){super({});const{compressed:s,encrypted:r,useCompressionStream:c,zipCrypto:i,computeCrc32:a,level:f,deflate64:w,format:l,compressionMethod:h,inputSize:p}=t,d=this;let y,m,S,g=super.readable;const v=l&&Rt(l),k=qt(c,o,e),z=a&&s&&!w&&!v&&(!r||i)&&Boolean(k);if(r&&!i||!a||z||(y=new U,g=Jt(g,y)),s)if(v)g=Qt(g,Nt(v.CompressionStream,l,{level:f,chunkSize:n,compressionMethod:h,uncompressedSize:p}));else if(z)S=new Ot,g=Qt(g,new k(Wt,{level:f,chunkSize:n})),g=Jt(g,S);else try{g=Gt(g,c,{level:f,chunkSize:n},o,e)}catch(t){if(!c&&e)throw t;let n;try{n=new o(Wt)}catch{throw t}g=Qt(g,n),g=Jt(g,new Ot)}r&&(i?g=Jt(g,new bt(t)):(m=new dt(t),g=Jt(g,m))),Lt(d,g,()=>{r&&!i||!a||(d.crc32=z?S.crc32:new u(y.value.buffer).getUint32(0))})}}class Ot extends d{constructor(){let t,n=10,e=new r(0);super({transform(t,s){if(n){const e=o.min(n,t.length);if(n-=e,!(t=t.subarray(e)).length)return}const r=e.length+t.length;if(r<=8)return void(e=B(e,t));const c=r-8,i=o.min(c,e.length);s.enqueue(B(e.subarray(0,i),t.subarray(0,c-i))),e=B(e.subarray(i),t.subarray(c-i))},flush(){const n=V(e);t.crc32=n.getUint32(0,!0),t.uncompressedSize=n.getUint32(4,!0)}}),t=this}}class Tt extends d{constructor(t,{chunkSize:n,DecompressionStreamFallback:e,DecompressionStream:o}){super({});const{zipCrypto:c,encrypted:i,checkCrc32:a,crc32:f,compressed:l,useCompressionStream:h,deflate64:p,format:d,compressionMethod:m,rawBitFlag:S,outputSize:g}=t;let k,z,b,C=super.readable;if(i&&(c?C=Jt(C,new zt(t)):(z=new pt(t),C=Jt(C,z))),l){const t=d&&Rt(d);if(t)C=Qt(C,Nt(t.DecompressionStream,d,{chunkSize:n,compressionMethod:m,rawBitFlag:S,uncompressedSize:g}));else{let t;const c=qt(h,o,e);if(a&&!p&&f!==v&&g!==v&&c)try{t=new c(Wt,{chunkSize:n})}catch{t=v}if(!t)try{C=Gt(C,h,{chunkSize:n,deflate64:p},o,e)}catch(n){if(p||g===v||!h&&e)throw n;try{t=new o(Wt)}catch{throw n}}t&&(b=!0,C=function(t,n,e,o){const c=n.writable.getWriter(),i=n.readable.getReader(),a=o===v?new R:v;let f,u,l=0,h=!1,p=!1,d=!1,m=0,S=!1;const g=new w((t,n)=>{f=t,u=n});return g.catch(()=>{}),async function(){const n=t.getReader();try{const t=new r(10);for(t.set(jt),await c.write(t);;){await c.ready;const{value:t,done:e}=await n.read();if(e)break;await c.write(t)}h=!0,a&&(S&&z(),await g);const s=new r(8),i=V(s);i.setUint32(0,a?a.get():o,!0),i.setUint32(4,e,!0),p=!0,await c.write(s),await c.close()}catch(t){await Xt(c,t),await Yt(n,t)}}(),new y({async pull(t){let n;try{n=await function(){m++,S=!0;const t=i.read();return t.then(k,k),h&&a&&z(),t}()}catch(t){throw p?function(t){const n=new s(l==e?Bt:Ut);return n.cause=t,n}(t):t}const{value:o,done:r}=n;if(r)t.close();else{if(l+=o.length,l>e){const t=new s(Ut);throw u(t),await Yt(i,t),t}a&&a.append(o),t.enqueue(o)}},cancel:t=>(u(t),i.cancel(t))});function k(){S=!1}async function z(){if(!d){d=!0;const t=m;await new w(t=>{const{port1:n,port2:e}=new MessageChannel;e.onmessage=()=>{n.close(),e.close(),t()},n.postMessage(v)}),d=!1,S&&(m==t?f():z())}}}(C,t,g,f))}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 s("Invalid compressed data");throw n.cause=t,n}const{value:o,done:r}=e;r?t.close():t.enqueue(o)},cancel:t=>n.cancel(t)})}(C)}a&&!b&&(k=new U,C=Jt(C,k)),Lt(this,C,()=>{if(k){const t=new u(k.value.buffer).getUint32(0,!1);if(f!=t)throw new s(Bt)}})}}const Ht=new f;function Lt(t,e,o){e=Jt(e,new d({flush:o})),n.defineProperty(t,"readable",{get:()=>e})}function Nt(t,n,e){if(!t)throw new s("Compression method not supported");return new t(n,e)}function qt(t,n,e){return t&&n?n:e&&e.requiresModule?e:void 0}function Gt(t,n,e,o,s){const r=n&&o?o:s||o,c=e.deflate64?"deflate64-raw":Vt;let i;try{i=new r(c,e)}catch(t){if(!n||!s||r==s)throw t;i=new s(c,e)}return Qt(t,i)}function Jt(t,n){return Ft(t).pipeThrough(n)}function Qt(t,n){const e=n.writable.getWriter(),o=t.getReader();return async function(){try{for(;;){await e.ready;const t=await o.read();if(t.done){await e.close();break}await e.write(t.value)}}catch(t){await Xt(e,t),await Yt(o,t)}}(),n.readable}async function Xt(t,n){try{await t.abort(n)}catch{}}async function Yt(t,n){try{await t.cancel(n)}catch{}}const Zt="data",$t="deflate";class _t extends d{constructor(t,e){super({});const o=this,{codecType:r}=t;let c;r.startsWith($t)?c=Kt:r.startsWith("inflate")&&(c=Tt),o.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(o,{inputSize:i})}}),w=new d({transform(n,e){if(n&&n.length&&(e.enqueue(n),o.outputSize+=n.length,t.outputSize!==v&&o.outputSize>t.outputSize))throw new s(Ut)},flush(){const{crc32:t}=a;n.assign(o,{crc32:t,inputSize:i})}});n.defineProperty(o,"readable",{get:()=>f.pipeThrough(u).pipeThrough(a).pipeThrough(w)})}}class tn extends d{constructor(t){const o=[];let s=0,c=0;function i(){const n=new r(t);let e=0;for(;e<t;){const s=o[0],r=t-e;s.length<=r?(n.set(s,e),e+=s.length,o.shift()):(n.set(s.subarray(0,r),e),o[0]=s.subarray(r),e+=r)}return s-=t,n}(!e.isFinite(t)||t<1)&&(t=65536),super({transform(n,e){for(o.push(n),s+=n.length;s>t;)c+=t,e.enqueue(i())},flush(t){s&&(c+=s,t.enqueue(function(t,n){const e=new r(n);let o=0;for(const n of t)e.set(n,o),o+=n.length;return e}(o,s)))}}),n.defineProperty(this,"outputSize",{get:()=>c})}}let nn=2;try{typeof navigator!=k&&navigator.hardwareConcurrency&&(nn=navigator.hardwareConcurrency)}catch{}function en(t){return Boolean(t)&&"object"==typeof t}const on=new f,sn=new f,rn=function(){try{return structuredClone(new s)instanceof s}catch{return!1}}();let cn=0;async function an(t){let n,r,c;try{const{options:i,config:a}=t;if(i.format)try{await async function(t,n){!Et.has(t)&&n&&function(t,n){const{CompressionStream:e,DecompressionStream:o}=n;if(typeof e!=z&&typeof o!=z)throw new s("Invalid codec module");Et.set(t,{CompressionStream:e,DecompressionStream:o})}(t,await(import(n)))}(i.format,i.codecURI)}catch(t){if(en(t))try{t.codecImportFailed=!0}catch{}throw t}if(a.CompressionStream=self.CompressionStream,a.DecompressionStream=self.DecompressionStream,i.compressed&&!i.format)if(i.useCompressionStream){if(!function(t,n){if(!t)return!1;let e=Ht.get(t);e||(e=new f,Ht.set(t,e));let o=e.get(n);if(o===v){try{new t(n),o=!0}catch{o=!1}e.set(n,o)}return o}(i.codecType.startsWith($t)?a.CompressionStream:a.DecompressionStream,Vt))try{await self.initModule(t.config)}catch{}}else try{await self.initModule(t.config)}catch{i.useCompressionStream=!0}if(i.encrypted&&!i.zipCrypto)try{await self.initModule(t.config)}catch{}!a.CompressionStreamFallback&&a.CompressionStreamZlib&&(a.CompressionStreamFallback=a.CompressionStreamZlib),!a.DecompressionStreamFallback&&a.DecompressionStreamZlib&&(a.DecompressionStreamFallback=a.DecompressionStreamZlib);const u={highWaterMark:1},l=t.readable?Ft(t.readable):new y({async pull(t){const n=new w(t=>on.set(cn,t));fn({type:"pull",messageId:cn}),cn=(cn+1)%e.MAX_SAFE_INTEGER;const{value:o,done:s}=await n;t.enqueue(o),s&&t.close()}},u);c=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 o=new w(t=>n=t);sn.set(cn,n),fn({type:Zt,value:t,messageId:cn}),cn=(cn+1)%e.MAX_SAFE_INTEGER,await o}},u),n=new _t(i,a),r=new tn(function(t){return s="string"==typeof(n=s=t.chunkSize)&&n.trim()?e(n):n,e.isInteger(s)&&s>=1?o.max(s,64):65536;var n,s}(a)),await l.pipeThrough(n).pipeThrough(r).pipeTo(c,{preventClose:!0,preventAbort:!0}),await c.getWriter().close();const{crc32:h,inputSize:p,outputSize:d}=n;fn({type:"close",result:{crc32:h,inputSize:p,outputSize:d}})}catch(t){const n=r?r.outputSize:0;if(en(t))try{t.outputSize=n}catch{}if(c&&!c.locked)try{await c.getWriter().close()}catch{}un(t,n)}}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 r(e):e).buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t);var e}function un(t,n){const{message:e,stack:o,code:r,name:c,outputSize:i,cause:a,codecImportFailed:f}=function(t=new s("Unknown error")){return en(t)?t:new s(String(t))}(t),u={message:e,stack:o,code:r,name:c,outputSize:i===v?n:i};if(a&&(u.cause={name:a.name,message:a.message}),f&&(u.codecImportFailed=!0),rn)try{return void p({error:u,errorValue:{value:t}})}catch{}p({error:u})}addEventListener("message",({data:t})=>{const{type:n,messageId:e,value:o,done:s}=t;try{if("start"==n&&an(t),n==Zt){const t=on.get(e);on.delete(e),t({value:o||new r,done:s})}if("ack"==n){const t=sn.get(e);sn.delete(e),t()}}catch(t){un(t)}}),p({type:"ready"});const wn="deflate",ln="deflate-raw",hn="deflate64-raw",pn="gzip";let dn,yn,mn,Sn,gn;function vn(t,n,e={}){if(!dn){const t=new s("WASM module not loaded");throw t.cause=gn,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.C=yn(i),this.in=yn(a),this.inBufferSize=a,!this.C||!this.in)throw new s("allocation failed");if(t?(this.I=dn.deflate_process,this.A=dn.deflate_last_consumed,this.M=dn.deflate_end,this.P=dn.deflate_new(),e=n===pn?dn.deflate_init_gzip(this.P,c):n===ln?dn.deflate_init_raw(this.P,c):dn.deflate_init(this.P,c)):n===hn?(this.I=dn.inflate9_process,this.A=dn.inflate9_last_consumed,this.M=dn.inflate9_end,this.P=dn.inflate9_new(),e=dn.inflate9_init_raw(this.P)):(this.I=dn.inflate_process,this.A=dn.inflate_last_consumed,this.M=dn.inflate_end,this.P=dn.inflate_new(),e=n===ln?dn.inflate_init_raw(this.P):n===pn?dn.inflate_init_gzip(this.P):dn.inflate_init(this.P)),0!==e)throw new s("init failed:"+e)}catch(t){throw f(this),t}},transform(t,n){try{const e=t,c=new r(Sn.buffer),a=this.I,f=this.A,u=this.C;let w=0;for(;w<e.length;){const t=o.min(e.length-w,32768);if((!this.in||this.inBufferSize<t)&&(this.in&&mn&&(mn(this.in),this.in=0),this.in=yn(t),this.inBufferSize=t,!this.in))throw new s("allocation failed");c.set(e.subarray(w,w+t),this.in);const r=a(this.P,this.in,t,u,i,0),l=r>>24&255,h=128&l?l-256:l;if(h<0)throw new s("process error:"+h);const p=16777215&r;p&&n.enqueue(c.slice(u,u+p));const d=f(this.P);if(0===d&&0===p)break;w+=d}}catch(t){f(this),n.error(t)}},flush(t){try{const n=new r(Sn.buffer),e=this.I,o=this.C;for(;;){const r=e(this.P,0,0,o,i,4),c=r>>24&255,a=128&c?c-256:c;if(a<0)throw new s("process error:"+a);const f=16777215&r;if(f&&t.enqueue(n.slice(o,o+f)),1===c||0===f)break}}catch(n){t.error(n)}finally{const n=f(this);0!==n&&t.error(new s("end error:"+n))}},cancel(){f(this)}});function f(t){let n=0;return t.P&&t.M&&(n=t.M(t.P)),t.P=0,t.in&&mn&&mn(t.in),t.in=0,t.C&&mn&&mn(t.C),t.C=0,n}}class kn{constructor(t=wn,n){return vn(!0,t,n)}}class zn{constructor(t=wn,n){return vn(!1,t,n)}}kn.requiresModule=!0,zn.requiresModule=!0,kn.supportedFormats=[wn,ln,pn],zn.supportedFormats=[wn,ln,pn,hn];const bn=65536;let Cn,In;function An(t){return new r(t.memory.buffer)}let Mn=!1;!function(t={}){const{init:n,D:e}=t,o=t.CompressionStreamFallback||t.CompressionStreamZlib,s=t.DecompressionStreamFallback||t.DecompressionStreamZlib;e&&(ht=e||Q),self.initModule=async t=>{n&&await n(t),o&&(t.CompressionStreamFallback=o),s&&(t.DecompressionStreamFallback=s)}}({CompressionStreamFallback:kn,DecompressionStreamFallback:zn,D:function(t,n){const e=Cn;let o=e?function(t,n,e){In||(In=t.malloc(bn));const o=In?t.aes_hmac_new():0;if(o){const s=An(t);if(s.set(n,In),s.set(e,In+n.length),t.aes_hmac_init(o,In,n.length,In+n.length,e.length))return t.aes_hmac_end(o,0),0}return o}(e,t,n):0;if(!o)return Q(t,n);const s=In;return{process(t,n){for(let r=0;r<t.length;r+=bn){const c=t.subarray(r,r+bn),i=An(e);i.set(c,s),e.aes_hmac_process(o,s,c.length,n?1:0),c.set(i.subarray(s,s+c.length))}},digest:()=>(e.aes_hmac_end(o,s),o=0,An(e).slice(s,s+20)),dispose(){o&&(e.aes_hmac_end(o,0),o=0)}}},init:t=>async function(t,{baseURI:n}){if(!Mn)try{await async function(t,n){let e,o;try{try{o=new URL(t,n)}catch{}const s=await fetch(o);e=await s.arrayBuffer()}catch(n){if(!t.startsWith("data:application/wasm;base64,"))throw n;e=function(t){const n=t.split(",")[1],e=atob(n),o=e.length,s=new r(o);for(let t=0;t<o;++t)s[t]=e.charCodeAt(t);return s.buffer}(t)}const c=await WebAssembly.instantiate(e);var i;(function(t){if(dn=t,({malloc:yn,free:mn,memory:Sn}=dn),"function"!=typeof yn||"function"!=typeof mn||!Sn)throw dn=yn=mn=Sn=null,new s("Invalid WASM module")})(c.instance.exports),typeof(i=c.instance.exports).aes_hmac_new==z&&(Cn=i,In=0)}(t,n),Mn=!0}catch(t){throw function(t){gn=t}(t),t}}(t.wasmURI,t)})});\n';if("string"==typeof s&&(s=(new TextEncoder).encode(s)),t){const t=new Blob([s],{type:e});return URL.createObjectURL(t)}return "data:"+e+";base64,"+function(t){let e="";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];e+=n$1[s>>18&63]+n$1[s>>12&63]+n$1[s>>6&63]+n$1[63&s];}const o=s-r;if(1===o){const s=t[r]<<16;e+=n$1[s>>18&63]+n$1[s>>12&63]+"==";}else if(2===o){const s=t[r]<<16|t[r+1]<<8;e+=n$1[s>>18&63]+n$1[s>>12&63]+n$1[s>>6&63]+"=";}return e}(s)}});
|
|
442
|
+
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 n$1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e$1=t=>t({workerURI:t=>{const e="text/javascript";let r='!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";const{Array:t,Object:n,Number:e,Math:o,Error:r,Uint8Array:c,Uint16Array:s,Uint32Array:a,Int32Array:i,Map:f,DataView:u,Promise:w,TextEncoder:l,crypto:d,postMessage:p,TransformStream:h,ReadableStream:y,WritableStream:m,CompressionStream:S,DecompressionStream:g}=self,v=void 0,b="undefined",k="function",z=new c,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,M,A,E,R,x,P,D]=C;class F{constructor(t){this.o=t||-1}append(t){let n=0|this.o;const e=0|t.length;let o=0;if(e>=8&&t.buffer){const r=new u(t.buffer,t.byteOffset,e),c=e-8;for(;o<=c;o+=8){const t=n^r.getInt32(o,!0),e=r.getInt32(o+4,!0);n=D[255&t]^P[t>>>8&255]^x[t>>>16&255]^R[t>>>24&255]^E[255&e]^A[e>>>8&255]^M[e>>>16&255]^I[e>>>24&255]}}for(;o<e;o++)n=n>>>8^I[255&(n^t[o])];this.o=n}get(){return~this.o}}class U extends h{constructor(){let t;const n=new F;super({transform(t,e){n.append(t),e.enqueue(t)},flush(){const e=new c(4);new u(e.buffer).setUint32(0,n.get()),t.value=e}}),t=this}}function B(t,n){const e=new c(t.length+n.length);return e.set(t),e.set(n,t.length),e}function W(t){return new u(t.buffer,t.byteOffset,t.byteLength)}const O=64,V=20,K=new c([128]),T=new c(1),_=new i([1732584193,4023233417,2562383102,271733878,3285377520]),j=new c(256),H=new i(256),L=new i(256),Z=new i(256),N=new i(256);let q=!1;function G(t,n){!function(){if(!q){let t=1,n=1;do{t=255&(t^t<<1^(128&t?27:0)),n=255&(n^n<<1),n=255&(n^n<<2),n=255&(n^n<<4),128&n&&(n^=9),j[t]=255&(n^(n<<1|n>>7)^(n<<2|n>>6)^(n<<3|n>>5)^(n<<4|n>>4)^99)}while(1!=t);j[0]=99;for(let t=0;t<256;t++){const n=j[t],e=Y(n),o=e<<24|n<<16|n<<8|e^n;H[t]=o,L[t]=o>>>8|o<<24,Z[t]=o>>>16|o<<16,N[t]=o>>>24|o<<8}q=!0}}();const e=new i(60),o=function(t,n){const e=t.length>>2,o=e+6,r=4*(o+1);let c=1;for(let o=0;o<e;o++)n[o]=t[4*o]<<24|t[4*o+1]<<16|t[4*o+2]<<8|t[4*o+3];for(let t=e;t<r;t++){let o=n[t-1];t%e==0?(o=Q(o<<8|o>>>24)^c<<24,c=Y(c)):e>6&&t%e==4&&(o=Q(o)),n[t]=n[t-e]^o}return o}(t,e),r=new i(4),c=J(n);let s=0,a=0,f=0,w=0;return{process(t,n){n&&c.update(t,0,t.length),function(t){const n=new u(t.buffer,t.byteOffset,t.byteLength),e=t.length;let o=0;for(;o+16<=e;o+=16)l(),n.setInt32(o,n.getInt32(o)^r[0]),n.setInt32(o+4,n.getInt32(o+4)^r[1]),n.setInt32(o+8,n.getInt32(o+8)^r[2]),n.setInt32(o+12,n.getInt32(o+12)^r[3]);if(o<e){l();for(let n=0;o<e;o++,n++)t[o]^=r[n>>2]>>>24-8*(3&n)}}(t),n||c.update(t,0,t.length)},digest:()=>c.digest()};function l(){s=s+1|0,s||(a=a+1|0,a||(f=f+1|0,f||(w=w+1|0)));let t=X(s)^e[0],n=X(a)^e[1],c=X(f)^e[2],i=X(w)^e[3],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[4],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[5],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[6],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[7];t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[8],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[9],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[10],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[11],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[12],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[13],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[14],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[15],t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[16],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[17],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[18],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[19],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[20],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[21],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[22],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[23],t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[24],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[25],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[26],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[27],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[28],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[29],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[30],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[31],t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[32],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[33],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[34],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[35],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[36],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[37],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[38],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[39];let h=40;o>10&&(t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[40],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[41],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[42],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[43],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[44],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[45],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[46],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[47],h=48),o>12&&(t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[48],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[49],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[50],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[51],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[52],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[53],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[54],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[55],h=56),r[0]=(j[u>>>24]<<24|j[l>>>16&255]<<16|j[d>>>8&255]<<8|j[255&p])^e[h],r[1]=(j[l>>>24]<<24|j[d>>>16&255]<<16|j[p>>>8&255]<<8|j[255&u])^e[h+1],r[2]=(j[d>>>24]<<24|j[p>>>16&255]<<16|j[u>>>8&255]<<8|j[255&l])^e[h+2],r[3]=(j[p>>>24]<<24|j[u>>>16&255]<<16|j[l>>>8&255]<<8|j[255&d])^e[h+3]}}function J(t){const n=function(){const t=new i(_),n=new i(16),e=new c(O),r=new u(e.buffer),s=new c(8);let a=0,f=0;return{update:w,digest:function(){const n=8*f,e=o.floor(n/4294967296),r=n>>>0;for(w(K,0,1);56!=a;)w(T,0,1);s[0]=e>>>24,s[1]=e>>>16,s[2]=e>>>8,s[3]=e,s[4]=r>>>24,s[5]=r>>>16,s[6]=r>>>8,s[7]=r,w(s,0,8);const i=new c(V),l=new u(i.buffer);for(let n=0;n<t.length;n++)l.setInt32(4*n,t[n]);return t.set(_),a=0,f=0,i}};function w(t,n,o){const c=n+o;if(f+=o,a){for(;n<c&&a<O;)e[a++]=t[n++];a==O&&(l(r,0),a=0)}if(n+O<=c){const e=new u(t.buffer,t.byteOffset,t.byteLength);for(;n+O<=c;n+=O)l(e,n)}for(;n<c;)e[a++]=t[n++]}function l(e,o){for(let t=0;t<16;t++)n[t]=e.getInt32(o+4*t);let r,c=t[0],s=t[1],a=t[2],i=t[3],f=t[4];for(let t=0;t<15;t+=5)f=(c<<5|c>>>27)+((a^i)&s^i)+f+1518500249+n[t]|0,s=s<<30|s>>>2,i=(f<<5|f>>>27)+((s^a)&c^a)+i+1518500249+n[t+1]|0,c=c<<30|c>>>2,a=(i<<5|i>>>27)+((c^s)&f^s)+a+1518500249+n[t+2]|0,f=f<<30|f>>>2,s=(a<<5|a>>>27)+((f^c)&i^c)+s+1518500249+n[t+3]|0,i=i<<30|i>>>2,c=(s<<5|s>>>27)+((i^f)&a^f)+c+1518500249+n[t+4]|0,a=a<<30|a>>>2;f=(c<<5|c>>>27)+((a^i)&s^i)+f+1518500249+n[15]|0,s=s<<30|s>>>2,r=n[13]^n[8]^n[2]^n[0],r=r<<1|r>>>31,n[0]=r,i=(f<<5|f>>>27)+((s^a)&c^a)+i+1518500249+r|0,c=c<<30|c>>>2,r=n[14]^n[9]^n[3]^n[1],r=r<<1|r>>>31,n[1]=r,a=(i<<5|i>>>27)+((c^s)&f^s)+a+1518500249+r|0,f=f<<30|f>>>2,r=n[15]^n[10]^n[4]^n[2],r=r<<1|r>>>31,n[2]=r,s=(a<<5|a>>>27)+((f^c)&i^c)+s+1518500249+r|0,i=i<<30|i>>>2,r=n[0]^n[11]^n[5]^n[3],r=r<<1|r>>>31,n[3]=r,c=(s<<5|s>>>27)+((i^f)&a^f)+c+1518500249+r|0,a=a<<30|a>>>2;for(let t=20;t<40;t+=5)r=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],r=r<<1|r>>>31,n[15&t]=r,f=(c<<5|c>>>27)+(s^a^i)+f+1859775393+r|0,s=s<<30|s>>>2,r=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],r=r<<1|r>>>31,n[t+1&15]=r,i=(f<<5|f>>>27)+(c^s^a)+i+1859775393+r|0,c=c<<30|c>>>2,r=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],r=r<<1|r>>>31,n[t+2&15]=r,a=(i<<5|i>>>27)+(f^c^s)+a+1859775393+r|0,f=f<<30|f>>>2,r=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],r=r<<1|r>>>31,n[t+3&15]=r,s=(a<<5|a>>>27)+(i^f^c)+s+1859775393+r|0,i=i<<30|i>>>2,r=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],r=r<<1|r>>>31,n[t+4&15]=r,c=(s<<5|s>>>27)+(a^i^f)+c+1859775393+r|0,a=a<<30|a>>>2;for(let t=40;t<60;t+=5)r=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],r=r<<1|r>>>31,n[15&t]=r,f=(c<<5|c>>>27)+(s&a|(s|a)&i)+f+2400959708+r|0,s=s<<30|s>>>2,r=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],r=r<<1|r>>>31,n[t+1&15]=r,i=(f<<5|f>>>27)+(c&s|(c|s)&a)+i+2400959708+r|0,c=c<<30|c>>>2,r=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],r=r<<1|r>>>31,n[t+2&15]=r,a=(i<<5|i>>>27)+(f&c|(f|c)&s)+a+2400959708+r|0,f=f<<30|f>>>2,r=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],r=r<<1|r>>>31,n[t+3&15]=r,s=(a<<5|a>>>27)+(i&f|(i|f)&c)+s+2400959708+r|0,i=i<<30|i>>>2,r=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],r=r<<1|r>>>31,n[t+4&15]=r,c=(s<<5|s>>>27)+(a&i|(a|i)&f)+c+2400959708+r|0,a=a<<30|a>>>2;for(let t=60;t<80;t+=5)r=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],r=r<<1|r>>>31,n[15&t]=r,f=(c<<5|c>>>27)+(s^a^i)+f+3395469782+r|0,s=s<<30|s>>>2,r=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],r=r<<1|r>>>31,n[t+1&15]=r,i=(f<<5|f>>>27)+(c^s^a)+i+3395469782+r|0,c=c<<30|c>>>2,r=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],r=r<<1|r>>>31,n[t+2&15]=r,a=(i<<5|i>>>27)+(f^c^s)+a+3395469782+r|0,f=f<<30|f>>>2,r=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],r=r<<1|r>>>31,n[t+3&15]=r,s=(a<<5|a>>>27)+(i^f^c)+s+3395469782+r|0,i=i<<30|i>>>2,r=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],r=r<<1|r>>>31,n[t+4&15]=r,c=(s<<5|s>>>27)+(a^i^f)+c+3395469782+r|0,a=a<<30|a>>>2;t[0]=t[0]+c|0,t[1]=t[1]+s|0,t[2]=t[2]+a|0,t[3]=t[3]+i|0,t[4]=t[4]+f|0}}(),e=new c(O),r=new c(O);t.length>O&&(n.update(t,0,t.length),t=n.digest());for(let n=0;n<O;n++){const o=n<t.length?t[n]:0;e[n]=54^o,r[n]=92^o}return n.update(e,0,O),{update(t,e,o){n.update(t,e,o)},digest(){const t=n.digest();n.update(r,0,O),n.update(t,0,V);const o=n.digest();return n.update(e,0,O),o}}}function Q(t){return j[t>>>24]<<24|j[t>>>16&255]<<16|j[t>>>8&255]<<8|j[255&t]}function X(t){return t<<24|(65280&t)<<8|t>>>8&65280|t>>>24}function Y(t){return 255&(t<<1^27*(t>>7))}const $=typeof d!=b&&typeof d.getRandomValues==k,tt="Invalid password",nt="zipjs-abort-check-password";function et(t){if($)return d.getRandomValues(t);throw new r("Crypto API not supported")}const ot={name:"PBKDF2"},rt=n.assign({hash:{name:"HMAC"}},ot),ct=n.assign({iterations:1e3,hash:{name:"SHA-1"}},ot),st=["deriveBits"],at=[8,12,16],it=[16,24,32],ft=10,ut=typeof d!=b,wt=ut&&d.subtle;let lt=ut&&typeof wt!=b&&typeof wt.importKey==k&&typeof wt.deriveBits==k,dt=G;class pt extends h{constructor({password:t,rawPassword:n,encryptionStrength:e,checkPasswordOnly:o,checkAuthenticationCode:s=!0}){const a={};super({start(){yt(a,t,n,e)},async transform(t,n){const{password:e,strength:s,l:i,ready:f}=a;if(e?(await async function(t,n,e,o){const c=await vt(t,n,e,kt(o,0,at[n])),s=kt(o,at[n]);if(c[0]!=s[0]||c[1]!=s[1])throw gt(t),new r(tt)}(a,s,e,kt(t,0,at[s]+2)),t=kt(t,at[s]+2),o?(gt(a),n.error(new r(nt))):i()):await f,a.h)return;const u=new c(t.length-ft-(t.length-ft)%16);n.enqueue(St(a,t,u,0,ft,!0))},async flush(t){const{m:n,S:e,ready:o}=a;if(n){if(await o,a.h)return;const i=kt(e,e.length-ft),f=new c(kt(e,0,e.length-ft));n.process(f,!0);const u=n.digest();let w=e.length<ft?1:0;for(let t=0;t<ft;t++)w|=u[t]^i[t];if(w&&s)return void t.error(new r("Invalid authentication code"));t.enqueue(f)}}}),mt(this,a)}}class ht extends h{constructor({password:t,rawPassword:n,encryptionStrength:e}){const o={};super({start(){yt(o,t,n,e)},async transform(t,n){const{password:e,strength:r,l:s,ready:a}=o;let i=z;if(e?(i=await async function(t,n,e){const o=et(new c(at[n]));return B(o,await vt(t,n,e,o))}(o,r,e),s()):await a,o.h)return;const f=new c(i.length+t.length-t.length%16);f.set(i,0),n.enqueue(St(o,t,f,i.length,0,!1))},async flush(t){const{m:n,S:e,ready:r}=o;if(n){if(await r,o.h)return;const s=new c(e);n.process(s,!1);const a=kt(n.digest(),0,ft);t.enqueue(B(s,a))}}}),mt(this,o)}}function yt(t,e,o,r){n.assign(t,{ready:new w(n=>t.l=n),password:bt(e,o),strength:r-1,S:z,h:!1})}function mt(t,e){const o=t.readable.getReader(),r=new y({async pull(t){try{const{value:n,done:e}=await o.read();e?t.close():t.enqueue(n)}catch(t){throw gt(e),o.cancel(t).catch(()=>{}),t}},cancel:t=>(gt(e),o.cancel(t))});n.defineProperty(t,"readable",{get:()=>r})}function St(t,n,e,o,r,s){const{m:a,S:i}=t;i.length&&(n=B(i,n));const f=n.length-r,u=f-f%16;if(e=function(t,n){if(n&&n>t.length){const e=t;(t=new c(n)).set(e,0)}return t}(e,o+u),u){const t=kt(e,o,o+u);t.set(kt(n,0,u)),a.process(t,s)}return t.S=kt(n,u),e}function gt(t){const{m:n}=t;t.h=!0,n&&n.dispose&&n.dispose()}async function vt(t,e,r,s){t.password=null;const a=it[e],i=await async function(t,e,r){if(lt)try{const o=await wt.importKey("raw",t,rt,!1,st);return new c(await wt.deriveBits(n.assign({salt:e},ct),o,8*r))}catch{lt=!1}return function(t,n,e,r){const s=J(t),a=new c(r),i=new c(n.length+4),f=new u(i.buffer);i.set(n);for(let t=1,e=0;e<r;t++,e+=V){f.setUint32(n.length,t),s.update(i,0,i.length);let c=s.digest();const u=c.slice();for(let t=1;t<1e3;t++){s.update(c,0,V),c=s.digest();for(let t=0;t<V;t++)u[t]^=c[t]}a.set(u.subarray(0,o.min(V,r-e)),e)}return a}(t,e,0,r)}(r,s,2*a+2);return t.m=dt(kt(i,0,a),kt(i,a,2*a)),t.h&>(t),kt(i,2*a)}function bt(t,n){return n===v?function(t){if(typeof l==b){t=unescape(encodeURIComponent(t));const n=new c(t.length);for(let e=0;e<n.length;e++)n[e]=t.charCodeAt(e);return n}return(new l).encode(t)}(t):n}function kt(t,n,e){return t.subarray(n,e)}class zt extends h{constructor({password:t,rawPassword:n,passwordVerification:e,checkPasswordOnly:o}){super({start(){It(this,t,n,e)},transform(t,n){const e=this;if(e.password||e.rawPassword){const n=Mt(e,t.subarray(0,12));if(e.password=e.rawPassword=null,0!=(n[11]^e.passwordVerification))throw new r(tt);t=t.subarray(12)}o?n.error(new r(nt)):n.enqueue(Mt(e,t))}})}}class Ct extends h{constructor({password:t,rawPassword:n,passwordVerification:e}){super({start(){It(this,t,n,e)},transform(t,n){const e=this;let o,r;if(e.password||e.rawPassword){e.password=e.rawPassword=null;const n=et(new c(12));n[11]=e.passwordVerification,o=new c(t.length+n.length),o.set(At(e,n),0),r=12}else o=new c(t.length),r=0;o.set(At(e,t),r),n.enqueue(o)}})}}function It(t,e,o,r){n.assign(t,{password:e,rawPassword:o,passwordVerification:r}),function(t,e,o){const r=[305419896,591751049,878082192];if(n.assign(t,{v:r,C:new F(r[0]),I:new F(r[2])}),o)for(let n=0;n<o.length;n++)Et(t,o[n]);else for(let n=0;n<e.length;n++)Et(t,e.charCodeAt(n))}(t,e,o)}function Mt(t,n){const e=new c(n.length);for(let o=0;o<n.length;o++)e[o]=Rt(t)^n[o],Et(t,e[o]);return e}function At(t,n){const e=new c(n.length);for(let o=0;o<n.length;o++)e[o]=Rt(t)^n[o],Et(t,n[o]);return e}function Et(t,n){let[,e]=t.v;t.C.append([n]);const r=~t.C.get();e=Pt(o.imul(Pt(e+xt(r)),134775813)+1),t.I.append([e>>>24]);const c=~t.I.get();t.v=[r,e,c]}function Rt(t){const n=2|t.v[2];return xt(o.imul(n,1^n)>>>8)}function xt(t){return 255&t}function Pt(t){return 4294967295&t}function Dt(t){if(t instanceof y)return t;const n=t.getReader();return new y({async pull(t){try{const{value:e,done:o}=await n.read();o?t.close():t.enqueue(e)}catch(t){throw n.cancel(t).catch(()=>{}),t}},cancel:t=>n.cancel(t)})}function Ft(t){return Boolean(t)&&"object"==typeof t}const Ut=new f;function Bt(t){return Ut.get(t)}const Wt="Invalid uncompressed size",Ot="Codec out of memory",Vt="Invalid CRC32",Kt="deflate-raw",Tt="gzip",_t=[31,139,8];class jt extends h{constructor(t,{chunkSize:n,CompressionStreamFallback:e,CompressionStream:o}){super({});const{compressed:r,encrypted:c,useCompressionStream:s,zipCrypto:a,computeCrc32:i,level:f,deflate64:w,format:l,compressionMethod:d,inputSize:p}=t,h=this;let y,m,S,g=super.readable;const v=l&&Bt(l),b=Gt(s,o,e),k=i&&r&&!w&&!v&&(!c||a)&&Boolean(b);if(c&&!a||!i||k||(y=new U,g=Qt(g,y)),r)if(v)g=Xt(g,qt(v.CompressionStream,l,{level:f,chunkSize:n,compressionMethod:d,uncompressedSize:p}));else if(k)S=new Ht,g=Xt(g,new b(Tt,{level:f,chunkSize:n})),g=Qt(g,S);else try{g=Jt(g,s,{level:f,chunkSize:n},o,e)}catch(t){if(!s&&e)throw en(t);let n;try{n=new o(Tt)}catch{throw en(t)}g=Xt(g,n),g=Qt(g,new Ht)}c&&(a?g=Qt(g,new Ct(t)):(m=new ht(t),g=Qt(g,m))),Nt(h,g,()=>{c&&!a||!i||(h.crc32=k?S.crc32:new u(y.value.buffer).getUint32(0))})}}class Ht extends h{constructor(){let t,n=10,e=new c(0);super({transform(t,r){if(n){const e=o.min(n,t.length);if(n-=e,!(t=t.subarray(e)).length)return}const c=e.length+t.length;if(c<=8)return void(e=B(e,t));const s=c-8,a=o.min(s,e.length);r.enqueue(B(e.subarray(0,a),t.subarray(0,s-a))),e=B(e.subarray(a),t.subarray(s-a))},flush(){const n=W(e);t.crc32=n.getUint32(0,!0),t.uncompressedSize=n.getUint32(4,!0)}}),t=this}}class Lt extends h{constructor(t,{chunkSize:n,DecompressionStreamFallback:e,DecompressionStream:o}){super({});const{zipCrypto:s,encrypted:a,checkCrc32:i,crc32:f,compressed:l,useCompressionStream:d,deflate64:p,format:h,compressionMethod:m,rawBitFlag:S,outputSize:g}=t;let b,k,z,C=super.readable;if(a&&(s?C=Qt(C,new zt(t)):(k=new pt(t),C=Qt(C,k))),l){const t=new Set,s=h&&Bt(h);let a;if(s)C=Xt(C,qt(s.DecompressionStream,h,{chunkSize:n,compressionMethod:m,rawBitFlag:S,uncompressedSize:g}),t);else{const r=Gt(d,o,e);if(i&&!p&&f!==v&&g!==v&&r)try{a=new r(Tt,{chunkSize:n})}catch{a=v}if(!a)try{C=Jt(C,d,{chunkSize:n,deflate64:p},o,e,t)}catch(t){if(p||g===v||!d&&e)throw en(t);try{a=new o(Tt)}catch{throw en(t)}}}a?(z=!0,C=function(t,n,e,o,s){const a=n.writable.getWriter(),i=n.readable.getReader(),f=o===v?new F:v;let u,l,d=0,p=!1,h=!1;const m=new y({start(t){l=t},pull(){b()},cancel:t=>(h=!0,b(),i.cancel(t))});return async function(){const n=t.getReader();try{const t=new c(10);for(t.set(_t),await a.write(t);;){await g(),await a.ready;const{value:t,done:e}=await tn(n,s);if(e)break;await a.write(t)}f&&await a.write(new c(0));const r=new c(8),i=W(r);i.setUint32(0,f?f.get():o,!0),i.setUint32(4,e,!0),p=!0,await a.write(r),await a.close()}catch(t){await Yt(a,t),await $t(n,t)}}(),async function(){try{for(;;){const{value:t,done:n}=await S();if(n)break;if(d+=t.length,d>e)throw new r(Wt);f&&f.append(t),l.enqueue(t)}h||(h=!0,l.close())}catch(t){!function(t){h||(h=!0,l.error(t),b())}(t),await $t(i,t)}}(),m;function S(){return i.read().catch(t=>{if(p){if(!f)throw rn(t,Vt);if(d!=e)throw rn(t,Wt);return{done:!0}}throw nn(t,s)})}function g(){if(!h&&l.desiredSize<=0)return new w(t=>u=t)}function b(){if(u){const t=u;u=v,t()}}}(C,a,g,f,t)):C=function(t,n){const e=t.getReader();return new y({async pull(t){try{const{value:n,done:o}=await e.read();o?t.close():t.enqueue(n)}catch(t){throw await $t(e,t),nn(t,n)}},cancel:t=>e.cancel(t)})}(C,t)}i&&!z&&(b=new U,C=Qt(C,b)),Nt(this,C,()=>{if(b){const t=new u(b.value.buffer).getUint32(0,!1);if(f!=t)throw new r(Vt)}})}}const Zt=new f;function Nt(t,e,o){e=Qt(e,new h({flush:o})),n.defineProperty(t,"readable",{get:()=>e})}function qt(t,n,e){if(!t)throw new r("Compression method not supported");return new t(n,e)}function Gt(t,n,e){return t&&n?n:e&&e.requiresModule?e:void 0}function Jt(t,n,e,o,r,c){const s=n&&o?o:r||o,a=e.deflate64?"deflate64-raw":Kt;let i;try{i=new s(a,e)}catch(t){if(!n||!r||s==r)throw t;i=new r(a,e)}return Xt(t,i,c)}function Qt(t,n){return Dt(t).pipeThrough(n)}function Xt(t,n,e){const o=n.writable.getWriter(),r=t.getReader();return async function(){try{for(;;){await o.ready;const t=await tn(r,e);if(t.done){await o.close();break}await o.write(t.value)}}catch(t){await Yt(o,t),await $t(r,t)}}(),n.readable}async function Yt(t,n){try{await t.abort(n)}catch{}}async function $t(t,n){try{await t.cancel(n)}catch{}}function tn(t,n){const e=t.read();return n?e.catch(t=>{throw n.add(t),t}):e}function nn(t,n){return n.has(t)?t:rn(t,on(t)?Ot:"Invalid compressed data")}function en(t){return on(t)?rn(t,Ot):t}function on(t){return Ft(t)&&"Z_MEM_ERROR"==t.code}function rn(t,n){const e=new r(n);return e.cause=t,e}const cn="data",sn="deflate";class an extends h{constructor(t,e){super({});const o=this,{codecType:c}=t;let s;c.startsWith(sn)?s=jt:c.startsWith("inflate")&&(s=Lt),o.outputSize=0;let a=0;const i=new s(t,e),f=super.readable,u=new h({transform(t,n){t&&t.length&&(a+=t.length,n.enqueue(t))},flush(){n.assign(o,{inputSize:a})}}),w=new h({transform(n,e){if(n&&n.length&&(e.enqueue(n),o.outputSize+=n.length,t.outputSize!==v&&o.outputSize>t.outputSize))throw new r(Wt)},flush(){const{crc32:t}=i;n.assign(o,{crc32:t,inputSize:a})}});n.defineProperty(o,"readable",{get:()=>f.pipeThrough(u).pipeThrough(i).pipeThrough(w)})}}class fn extends h{constructor(t){const o=[];let r=0,s=0;function a(){const n=new c(t);let e=0;for(;e<t;){const r=o[0],c=t-e;r.length<=c?(n.set(r,e),e+=r.length,o.shift()):(n.set(r.subarray(0,c),e),o[0]=r.subarray(c),e+=c)}return r-=t,n}(!e.isFinite(t)||t<1)&&(t=65536),super({transform(n,e){for(o.push(n),r+=n.length;r>t;)s+=t,e.enqueue(a())},flush(t){r&&(s+=r,t.enqueue(function(t,n){const e=new c(n);let o=0;for(const n of t)e.set(n,o),o+=n.length;return e}(o,r)))}}),n.defineProperty(this,"outputSize",{get:()=>s})}}let un=2;try{typeof navigator!=b&&navigator.hardwareConcurrency&&(un=navigator.hardwareConcurrency)}catch{}const wn=new f,ln=new f,dn=function(){try{return structuredClone(new r)instanceof r}catch{return!1}}();let pn=0;async function hn(t){let n,c,s;try{const{options:a,config:i}=t;if(a.format)try{await async function(t,n){!Ut.has(t)&&n&&function(t,n){const{CompressionStream:e,DecompressionStream:o}=n;if(typeof e!=k&&typeof o!=k)throw new r("Invalid codec module");Ut.set(t,{CompressionStream:e,DecompressionStream:o})}(t,await(import(n)))}(a.format,a.codecURI)}catch(t){if(Ft(t))try{t.codecImportFailed=!0}catch{}throw t}if(i.CompressionStream=self.CompressionStream,i.DecompressionStream=self.DecompressionStream,a.compressed&&!a.format)if(a.useCompressionStream){if(!function(t,n){if(!t)return!1;let e=Zt.get(t);e||(e=new f,Zt.set(t,e));let o=e.get(n);if(o===v){try{new t(n),o=!0}catch{o=!1}e.set(n,o)}return o}(a.codecType.startsWith(sn)?i.CompressionStream:i.DecompressionStream,Kt))try{await self.initModule(t.config)}catch{}}else try{await self.initModule(t.config)}catch{a.useCompressionStream=!0}if(a.encrypted&&!a.zipCrypto)try{await self.initModule(t.config)}catch{}!i.CompressionStreamFallback&&i.CompressionStreamZlib&&(i.CompressionStreamFallback=i.CompressionStreamZlib),!i.DecompressionStreamFallback&&i.DecompressionStreamZlib&&(i.DecompressionStreamFallback=i.DecompressionStreamZlib);const u={highWaterMark:1},l=t.readable?Dt(t.readable):new y({async pull(t){const n=new w(t=>wn.set(pn,t));yn({type:"pull",messageId:pn}),pn=(pn+1)%e.MAX_SAFE_INTEGER;const{value:o,done:r}=await n;t.enqueue(o),r&&t.close()}},u);s=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 o=new w(t=>n=t);ln.set(pn,n),yn({type:cn,value:t,messageId:pn}),pn=(pn+1)%e.MAX_SAFE_INTEGER,await o}},u),n=new an(a,i),c=new fn(function(t){return r="string"==typeof(n=r=t.chunkSize)&&n.trim()?e(n):n,e.isInteger(r)&&r>=1?o.max(r,64):65536;var n,r}(i)),await l.pipeThrough(n).pipeThrough(c).pipeTo(s,{preventClose:!0,preventAbort:!0}),await s.getWriter().close();const{crc32:d,inputSize:p,outputSize:h}=n;yn({type:"close",result:{crc32:d,inputSize:p,outputSize:h}})}catch(t){const n=c?c.outputSize:0;if(Ft(t))try{t.outputSize=n}catch{}if(s&&!s.locked)try{await s.getWriter().close()}catch{}mn(t,n)}}function yn(t){const{value:n}=t;if(n)if(n.length)try{t.value=(e=n,e.byteOffset||e.byteLength!=e.buffer.byteLength?new c(e):e).buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t);var e}function mn(t,n){const{message:e,stack:o,code:c,name:s,outputSize:a,cause:i,codecImportFailed:f}=function(t=new r("Unknown error")){return Ft(t)?t:new r(String(t))}(t),u={message:e,stack:o,code:c,name:s,outputSize:a===v?n:a};if(Ft(i)&&(u.cause={name:i.name,message:i.message}),f&&(u.codecImportFailed=!0),dn)try{return void p({error:u,errorValue:{value:t}})}catch{}p({error:u})}addEventListener("message",({data:t})=>{const{type:n,messageId:e,value:o,done:r}=t;try{if("start"==n&&hn(t),n==cn){const t=wn.get(e);wn.delete(e),t({value:o||new c,done:r})}if("ack"==n){const t=ln.get(e);ln.delete(e),t()}}catch(t){mn(t)}}),p({type:"ready"});const Sn="deflate",gn="deflate-raw",vn="deflate64-raw",bn="gzip",kn=[Sn,gn,bn],zn=[Sn,gn,bn,vn];let Cn,In,Mn,An,En;function Rn(t,n){return-4===n&&(t.code="Z_MEM_ERROR"),t}function xn(t,n,e={}){if(!(t?kn:zn).includes(n))throw new TypeError("Unsupported format: "+n);if(!Cn){const t=new r("WASM module not loaded");throw t.cause=En,t}const s="number"==typeof e.level?e.level:-1,a="number"==typeof e.outBuffer?e.outBuffer:65536,i="number"==typeof e.inBufferSize?e.inBufferSize:65536,f={M:0,in:0,inBufferSize:0,A:0,R:!1};let u,l,d,p,h=!0,S=!1;return function(){try{let e;if(f.M=In(a),f.in=In(i),f.inBufferSize=i,!f.M||!f.in)throw Rn(new r("allocation failed"),-4);if(t?(f.P=Cn.deflate_process,f.D=Cn.deflate_last_consumed,f.F=Cn.deflate_end,f.A=Cn.deflate_new(),e=n===bn?Cn.deflate_init_gzip(f.A,s):n===gn?Cn.deflate_init_raw(f.A,s):Cn.deflate_init(f.A,s)):n===vn?(f.P=Cn.inflate9_process,f.D=Cn.inflate9_last_consumed,f.F=Cn.inflate9_end,f.A=Cn.inflate9_new(),e=Cn.inflate9_init_raw(f.A)):(f.P=Cn.inflate_process,f.D=Cn.inflate_last_consumed,f.F=Cn.inflate_end,f.A=Cn.inflate_new(),e=n===gn?Cn.inflate_init_raw(f.A):n===bn?Cn.inflate_init_gzip(f.A):Cn.inflate_init(f.A)),0!==e)throw Rn(new r("init failed:"+e),e)}catch(t){throw b(f),t}}(),{readable:new y({start(t){u=t},pull(){h=!1,v()},cancel(t){S=!0,p=t,b(f),l.error(t),v()}},{highWaterMark:0}),writable:new m({start(t){l=t},async write(t){if(h&&await new w(t=>d=t),S)throw p;try{!function(t){const n=new c(An.buffer),e=f.P,s=f.D,i=f.M;let u=0;for(;u<t.length;){if(f.R)throw new r("trailing data after the end of the stream");const c=o.min(t.length-u,32768);if((!f.in||f.inBufferSize<c)&&(f.in&&Mn&&(Mn(f.in),f.in=0),f.in=In(c),f.inBufferSize=c,!f.in))throw Rn(new r("allocation failed"),-4);n.set(t.subarray(u,u+c),f.in);const w=e(f.A,f.in,c,i,a,0),l=w>>24&255,d=128&l?l-256:l;if(d<0)throw Rn(new r("process error:"+d),d);const p=16777215&w;p&&g(n.slice(i,i+p));const h=s(f.A);if(1===l)f.R=!0;else if(0===h&&0===p)break;u+=h}}(t)}catch(t){throw b(f),u.error(t),t}},close(){if(S)return;try{!function(){const t=new c(An.buffer),n=f.P,e=f.M;for(;;){const o=n(f.A,0,0,e,a,4),c=o>>24&255,s=128&c?c-256:c;if(s<0)throw Rn(new r("process error:"+s),s);const i=16777215&o;if(i&&g(t.slice(e,e+i)),1===c||0===i)break}}()}catch(t){throw b(f),u.error(t),t}const t=b(f);if(0!==t){const n=Rn(new r("end error:"+t),t);throw u.error(n),n}u.close()},abort(t){b(f),u.error(t)}},{highWaterMark:1})};function g(t){h=!0,u.enqueue(t)}function v(){if(d){const t=d;d=null,t()}}function b(t){let n=0;return t.A&&t.F&&(n=t.F(t.A)),t.A=0,t.in&&Mn&&Mn(t.in),t.in=0,t.M&&Mn&&Mn(t.M),t.M=0,n}}class Pn{constructor(t=Sn,n){return xn(!0,t,n)}}class Dn{constructor(t=Sn,n){return xn(!1,t,n)}}Pn.requiresModule=!0,Dn.requiresModule=!0,Pn.supportedFormats=kn,Dn.supportedFormats=zn;const Fn=65536;let Un,Bn;function Wn(t){return new c(t.memory.buffer)}let On=!1;!function(t={}){const{init:n,U:e}=t,o=t.CompressionStreamFallback||t.CompressionStreamZlib,r=t.DecompressionStreamFallback||t.DecompressionStreamZlib;e&&(dt=e||G),self.initModule=async t=>{n&&await n(t),o&&(t.CompressionStreamFallback=o),r&&(t.DecompressionStreamFallback=r)}}({CompressionStreamFallback:Pn,DecompressionStreamFallback:Dn,U:function(t,n){const e=Un;let o=e?function(t,n,e){Bn||(Bn=t.malloc(Fn));const o=Bn?t.aes_hmac_new():0;if(o){const r=Wn(t);if(r.set(n,Bn),r.set(e,Bn+n.length),t.aes_hmac_init(o,Bn,n.length,Bn+n.length,e.length))return t.aes_hmac_end(o,0),0}return o}(e,t,n):0;if(!o)return G(t,n);const r=Bn;return{process(t,n){for(let c=0;c<t.length;c+=Fn){const s=t.subarray(c,c+Fn),a=Wn(e);a.set(s,r),e.aes_hmac_process(o,r,s.length,n?1:0),s.set(a.subarray(r,r+s.length))}},digest:()=>(e.aes_hmac_end(o,r),o=0,Wn(e).slice(r,r+20)),dispose(){o&&(e.aes_hmac_end(o,0),o=0)}}},init:t=>async function(t,{baseURI:n}){if(!On)try{await async function(t,n){let e,o;try{try{o=new URL(t,n)}catch{}const r=await fetch(o);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),o=e.length,r=new c(o);for(let t=0;t<o;++t)r[t]=e.charCodeAt(t);return r.buffer}(t)}const s=await WebAssembly.instantiate(e);var a;(function(t){if(Cn=t,({malloc:In,free:Mn,memory:An}=Cn),"function"!=typeof In||"function"!=typeof Mn||!An)throw Cn=In=Mn=An=null,new r("Invalid WASM module")})(s.instance.exports),typeof(a=s.instance.exports).aes_hmac_new==k&&(Un=a,Bn=0)}(t,n),On=!0}catch(t){throw function(t){En=t}(t),t}}(t.wasmURI,t)})});\n';if("string"==typeof r&&(r=(new TextEncoder).encode(r)),t){const t=new Blob([r],{type:e});return URL.createObjectURL(t)}return "data:"+e+";base64,"+function(t){let e="";const r=t.length;let o=0;for(;o+2<r;o+=3){const r=t[o]<<16|t[o+1]<<8|t[o+2];e+=n$1[r>>18&63]+n$1[r>>12&63]+n$1[r>>6&63]+n$1[63&r];}const s=r-o;if(1===s){const r=t[o]<<16;e+=n$1[r>>18&63]+n$1[r>>12&63]+"==";}else if(2===s){const r=t[o]<<16|t[o+1]<<8;e+=n$1[r>>18&63]+n$1[r>>12&63]+n$1[r>>6&63]+"=";}return e}(r)}});
|
|
443
443
|
|
|
444
444
|
/*
|
|
445
445
|
Copyright (c) 2026 Gildas Lormeau. All rights reserved.
|
|
@@ -1279,12 +1279,12 @@ let createEngine$1 = createEngine$2;
|
|
|
1279
1279
|
class AESDecryptionStream extends TransformStream {
|
|
1280
1280
|
|
|
1281
1281
|
constructor({ password, rawPassword, encryptionStrength, checkPasswordOnly, checkAuthenticationCode = true }) {
|
|
1282
|
+
const aesCrypto = {};
|
|
1282
1283
|
super({
|
|
1283
1284
|
start() {
|
|
1284
|
-
initAesCrypto(
|
|
1285
|
+
initAesCrypto(aesCrypto, password, rawPassword, encryptionStrength);
|
|
1285
1286
|
},
|
|
1286
1287
|
async transform(chunk, controller) {
|
|
1287
|
-
const aesCrypto = this;
|
|
1288
1288
|
const {
|
|
1289
1289
|
password,
|
|
1290
1290
|
strength,
|
|
@@ -1303,6 +1303,9 @@ class AESDecryptionStream extends TransformStream {
|
|
|
1303
1303
|
} else {
|
|
1304
1304
|
await ready;
|
|
1305
1305
|
}
|
|
1306
|
+
if (aesCrypto.discarded) {
|
|
1307
|
+
return;
|
|
1308
|
+
}
|
|
1306
1309
|
const output = new Uint8Array(chunk.length - AUTHENTICATION_CODE_LENGTH - ((chunk.length - AUTHENTICATION_CODE_LENGTH) % BLOCK_LENGTH));
|
|
1307
1310
|
controller.enqueue(append(aesCrypto, chunk, output, 0, AUTHENTICATION_CODE_LENGTH, true));
|
|
1308
1311
|
},
|
|
@@ -1311,9 +1314,12 @@ class AESDecryptionStream extends TransformStream {
|
|
|
1311
1314
|
engine,
|
|
1312
1315
|
pendingInput,
|
|
1313
1316
|
ready
|
|
1314
|
-
} =
|
|
1317
|
+
} = aesCrypto;
|
|
1315
1318
|
if (engine) {
|
|
1316
1319
|
await ready;
|
|
1320
|
+
if (aesCrypto.discarded) {
|
|
1321
|
+
return;
|
|
1322
|
+
}
|
|
1317
1323
|
const originalAuthenticationCode = subarray(pendingInput, pendingInput.length - AUTHENTICATION_CODE_LENGTH);
|
|
1318
1324
|
const decryptedChunkArray = new Uint8Array(subarray(pendingInput, 0, pendingInput.length - AUTHENTICATION_CODE_LENGTH));
|
|
1319
1325
|
engine.process(decryptedChunkArray, true);
|
|
@@ -1323,27 +1329,26 @@ class AESDecryptionStream extends TransformStream {
|
|
|
1323
1329
|
invalidAuthenticationCode |= authenticationCode[indexByte] ^ originalAuthenticationCode[indexByte];
|
|
1324
1330
|
}
|
|
1325
1331
|
if (invalidAuthenticationCode && checkAuthenticationCode) {
|
|
1326
|
-
|
|
1332
|
+
controller.error(new Error(ERR_INVALID_AUTHENTICATION_CODE));
|
|
1333
|
+
return;
|
|
1327
1334
|
}
|
|
1328
1335
|
controller.enqueue(decryptedChunkArray);
|
|
1329
1336
|
}
|
|
1330
|
-
},
|
|
1331
|
-
cancel() {
|
|
1332
|
-
disposeEngine(this);
|
|
1333
1337
|
}
|
|
1334
1338
|
});
|
|
1339
|
+
setDisposingReadable(this, aesCrypto);
|
|
1335
1340
|
}
|
|
1336
1341
|
}
|
|
1337
1342
|
|
|
1338
1343
|
class AESEncryptionStream extends TransformStream {
|
|
1339
1344
|
|
|
1340
1345
|
constructor({ password, rawPassword, encryptionStrength }) {
|
|
1346
|
+
const aesCrypto = {};
|
|
1341
1347
|
super({
|
|
1342
1348
|
start() {
|
|
1343
|
-
initAesCrypto(
|
|
1349
|
+
initAesCrypto(aesCrypto, password, rawPassword, encryptionStrength);
|
|
1344
1350
|
},
|
|
1345
1351
|
async transform(chunk, controller) {
|
|
1346
|
-
const aesCrypto = this;
|
|
1347
1352
|
const {
|
|
1348
1353
|
password,
|
|
1349
1354
|
strength,
|
|
@@ -1357,6 +1362,9 @@ class AESEncryptionStream extends TransformStream {
|
|
|
1357
1362
|
} else {
|
|
1358
1363
|
await ready;
|
|
1359
1364
|
}
|
|
1365
|
+
if (aesCrypto.discarded) {
|
|
1366
|
+
return;
|
|
1367
|
+
}
|
|
1360
1368
|
const output = new Uint8Array(preamble.length + chunk.length - (chunk.length % BLOCK_LENGTH));
|
|
1361
1369
|
output.set(preamble, 0);
|
|
1362
1370
|
controller.enqueue(append(aesCrypto, chunk, output, preamble.length, 0, false));
|
|
@@ -1366,19 +1374,20 @@ class AESEncryptionStream extends TransformStream {
|
|
|
1366
1374
|
engine,
|
|
1367
1375
|
pendingInput,
|
|
1368
1376
|
ready
|
|
1369
|
-
} =
|
|
1377
|
+
} = aesCrypto;
|
|
1370
1378
|
if (engine) {
|
|
1371
1379
|
await ready;
|
|
1380
|
+
if (aesCrypto.discarded) {
|
|
1381
|
+
return;
|
|
1382
|
+
}
|
|
1372
1383
|
const encryptedChunkArray = new Uint8Array(pendingInput);
|
|
1373
1384
|
engine.process(encryptedChunkArray, false);
|
|
1374
1385
|
const authenticationCode = subarray(engine.digest(), 0, AUTHENTICATION_CODE_LENGTH);
|
|
1375
1386
|
controller.enqueue(concat(encryptedChunkArray, authenticationCode));
|
|
1376
1387
|
}
|
|
1377
|
-
},
|
|
1378
|
-
cancel() {
|
|
1379
|
-
disposeEngine(this);
|
|
1380
1388
|
}
|
|
1381
1389
|
});
|
|
1390
|
+
setDisposingReadable(this, aesCrypto);
|
|
1382
1391
|
}
|
|
1383
1392
|
}
|
|
1384
1393
|
|
|
@@ -1391,7 +1400,37 @@ function initAesCrypto(aesCrypto, password, rawPassword, encryptionStrength) {
|
|
|
1391
1400
|
ready: new Promise(resolve => aesCrypto.resolveReady = resolve),
|
|
1392
1401
|
password: encodePassword(password, rawPassword),
|
|
1393
1402
|
strength: encryptionStrength - 1,
|
|
1394
|
-
pendingInput: EMPTY_UINT8_ARRAY
|
|
1403
|
+
pendingInput: EMPTY_UINT8_ARRAY,
|
|
1404
|
+
discarded: false
|
|
1405
|
+
});
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
function setDisposingReadable(stream, aesCrypto) {
|
|
1409
|
+
const reader = stream.readable.getReader();
|
|
1410
|
+
const readable = new ReadableStream({
|
|
1411
|
+
async pull(controller) {
|
|
1412
|
+
try {
|
|
1413
|
+
const { value, done } = await reader.read();
|
|
1414
|
+
if (done) {
|
|
1415
|
+
controller.close();
|
|
1416
|
+
} else {
|
|
1417
|
+
controller.enqueue(value);
|
|
1418
|
+
}
|
|
1419
|
+
} catch (error) {
|
|
1420
|
+
disposeEngine(aesCrypto);
|
|
1421
|
+
reader.cancel(error).catch(() => { });
|
|
1422
|
+
throw error;
|
|
1423
|
+
}
|
|
1424
|
+
},
|
|
1425
|
+
cancel(reason) {
|
|
1426
|
+
disposeEngine(aesCrypto);
|
|
1427
|
+
return reader.cancel(reason);
|
|
1428
|
+
}
|
|
1429
|
+
});
|
|
1430
|
+
Object.defineProperty(stream, "readable", {
|
|
1431
|
+
get() {
|
|
1432
|
+
return readable;
|
|
1433
|
+
}
|
|
1395
1434
|
});
|
|
1396
1435
|
}
|
|
1397
1436
|
|
|
@@ -1424,7 +1463,9 @@ async function createDecryptionKeys(decrypt, strength, password, preamble) {
|
|
|
1424
1463
|
}
|
|
1425
1464
|
}
|
|
1426
1465
|
|
|
1427
|
-
function disposeEngine(
|
|
1466
|
+
function disposeEngine(aesCrypto) {
|
|
1467
|
+
const { engine } = aesCrypto;
|
|
1468
|
+
aesCrypto.discarded = true;
|
|
1428
1469
|
if (engine && engine.dispose) {
|
|
1429
1470
|
engine.dispose();
|
|
1430
1471
|
}
|
|
@@ -1441,6 +1482,9 @@ async function createKeys$1(aesCrypto, strength, password, salt) {
|
|
|
1441
1482
|
const keyLength = KEY_LENGTH[strength];
|
|
1442
1483
|
const compositeKey = await deriveKey(password, salt, keyLength * 2 + PASSWORD_VERIFICATION_LENGTH);
|
|
1443
1484
|
aesCrypto.engine = createEngine$1(subarray(compositeKey, 0, keyLength), subarray(compositeKey, keyLength, keyLength * 2));
|
|
1485
|
+
if (aesCrypto.discarded) {
|
|
1486
|
+
disposeEngine(aesCrypto);
|
|
1487
|
+
}
|
|
1444
1488
|
return subarray(compositeKey, keyLength * 2);
|
|
1445
1489
|
}
|
|
1446
1490
|
|
|
@@ -1592,11 +1636,11 @@ function encrypt(target, input) {
|
|
|
1592
1636
|
}
|
|
1593
1637
|
|
|
1594
1638
|
function createKeys(target, password, rawPassword) {
|
|
1595
|
-
const
|
|
1639
|
+
const cryptoKeys = [0x12345678, 0x23456789, 0x34567890];
|
|
1596
1640
|
Object.assign(target, {
|
|
1597
|
-
|
|
1598
|
-
crcKey0: new Crc32(
|
|
1599
|
-
crcKey2: new Crc32(
|
|
1641
|
+
cryptoKeys,
|
|
1642
|
+
crcKey0: new Crc32(cryptoKeys[0]),
|
|
1643
|
+
crcKey2: new Crc32(cryptoKeys[2])
|
|
1600
1644
|
});
|
|
1601
1645
|
if (rawPassword) {
|
|
1602
1646
|
for (let index = 0; index < rawPassword.length; index++) {
|
|
@@ -1610,17 +1654,17 @@ function createKeys(target, password, rawPassword) {
|
|
|
1610
1654
|
}
|
|
1611
1655
|
|
|
1612
1656
|
function updateKeys(target, byte) {
|
|
1613
|
-
let [, key1] = target.
|
|
1657
|
+
let [, key1] = target.cryptoKeys;
|
|
1614
1658
|
target.crcKey0.append([byte]);
|
|
1615
1659
|
const key0 = ~target.crcKey0.get();
|
|
1616
1660
|
key1 = getInt32(Math.imul(getInt32(key1 + getInt8(key0)), 134775813) + 1);
|
|
1617
1661
|
target.crcKey2.append([key1 >>> 24]);
|
|
1618
1662
|
const key2 = ~target.crcKey2.get();
|
|
1619
|
-
target.
|
|
1663
|
+
target.cryptoKeys = [key0, key1, key2];
|
|
1620
1664
|
}
|
|
1621
1665
|
|
|
1622
1666
|
function getByte(target) {
|
|
1623
|
-
const temp = target.
|
|
1667
|
+
const temp = target.cryptoKeys[2] | 2;
|
|
1624
1668
|
return getInt8(Math.imul(temp, (temp ^ 1)) >>> 8);
|
|
1625
1669
|
}
|
|
1626
1670
|
|
|
@@ -1668,11 +1712,16 @@ function toCompatibleReadable(readable) {
|
|
|
1668
1712
|
const reader = readable.getReader();
|
|
1669
1713
|
return new ReadableStream({
|
|
1670
1714
|
async pull(controller) {
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1715
|
+
try {
|
|
1716
|
+
const { value, done } = await reader.read();
|
|
1717
|
+
if (done) {
|
|
1718
|
+
controller.close();
|
|
1719
|
+
} else {
|
|
1720
|
+
controller.enqueue(value);
|
|
1721
|
+
}
|
|
1722
|
+
} catch (error) {
|
|
1723
|
+
reader.cancel(error).catch(() => { });
|
|
1724
|
+
throw error;
|
|
1676
1725
|
}
|
|
1677
1726
|
},
|
|
1678
1727
|
cancel(reason) {
|
|
@@ -1851,7 +1900,9 @@ async function ensureCodecStreams(format, codecURI) {
|
|
|
1851
1900
|
|
|
1852
1901
|
const ERR_INVALID_UNCOMPRESSED_SIZE = "Invalid uncompressed size";
|
|
1853
1902
|
const ERR_INVALID_COMPRESSED_DATA = "Invalid compressed data";
|
|
1903
|
+
const ERR_CODEC_OUT_OF_MEMORY = "Codec out of memory";
|
|
1854
1904
|
const ERR_INVALID_CRC32 = "Invalid CRC32";
|
|
1905
|
+
const Z_MEM_ERROR_CODE$1 = "Z_MEM_ERROR";
|
|
1855
1906
|
const FORMAT_DEFLATE_RAW$1 = "deflate-raw";
|
|
1856
1907
|
const FORMAT_DEFLATE64_RAW$1 = "deflate64-raw";
|
|
1857
1908
|
const FORMAT_GZIP$1 = "gzip";
|
|
@@ -1886,13 +1937,13 @@ class DeflateStream extends TransformStream {
|
|
|
1886
1937
|
readable = pipeThroughCompressionStream(readable, useCompressionStream, { level, chunkSize }, CompressionStream, CompressionStreamFallback);
|
|
1887
1938
|
} catch (error) {
|
|
1888
1939
|
if (!useCompressionStream && CompressionStreamFallback) {
|
|
1889
|
-
throw error;
|
|
1940
|
+
throw mapMemoryError(error);
|
|
1890
1941
|
}
|
|
1891
1942
|
let gzipStream;
|
|
1892
1943
|
try {
|
|
1893
1944
|
gzipStream = new CompressionStream(FORMAT_GZIP$1);
|
|
1894
1945
|
} catch {
|
|
1895
|
-
throw error;
|
|
1946
|
+
throw mapMemoryError(error);
|
|
1896
1947
|
}
|
|
1897
1948
|
readable = pipeThroughBackpressured(readable, gzipStream);
|
|
1898
1949
|
readable = pipeThrough(readable, new GzipToRawDeflateStream());
|
|
@@ -1956,53 +2007,30 @@ class GzipToRawDeflateStream extends TransformStream {
|
|
|
1956
2007
|
}
|
|
1957
2008
|
}
|
|
1958
2009
|
|
|
1959
|
-
function pipeThroughGzipDecompressionStream(readable, gzipStream, outputSize, crc32) {
|
|
2010
|
+
function pipeThroughGzipDecompressionStream(readable, gzipStream, outputSize, crc32, sourceErrors) {
|
|
1960
2011
|
const writer = gzipStream.writable.getWriter();
|
|
1961
2012
|
const reader = gzipStream.readable.getReader();
|
|
1962
2013
|
const outputCrc32 = crc32 === UNDEFINED_VALUE ? new Crc32() : UNDEFINED_VALUE;
|
|
1963
2014
|
let outputLength = 0;
|
|
1964
|
-
let inputDone = false;
|
|
1965
2015
|
let trailerWritten = false;
|
|
1966
|
-
let
|
|
1967
|
-
let
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
trailerReady.catch(() => { });
|
|
1975
|
-
pump();
|
|
1976
|
-
return new ReadableStream({
|
|
1977
|
-
async pull(controller) {
|
|
1978
|
-
let result;
|
|
1979
|
-
try {
|
|
1980
|
-
result = await read();
|
|
1981
|
-
} catch (error) {
|
|
1982
|
-
throw trailerWritten ? getTrailerError(error) : error;
|
|
1983
|
-
}
|
|
1984
|
-
const { value, done } = result;
|
|
1985
|
-
if (done) {
|
|
1986
|
-
controller.close();
|
|
1987
|
-
} else {
|
|
1988
|
-
outputLength += value.length;
|
|
1989
|
-
if (outputLength > outputSize) {
|
|
1990
|
-
const error = new Error(ERR_INVALID_UNCOMPRESSED_SIZE);
|
|
1991
|
-
rejectTrailerReady(error);
|
|
1992
|
-
await cancel(reader, error);
|
|
1993
|
-
throw error;
|
|
1994
|
-
}
|
|
1995
|
-
if (outputCrc32) {
|
|
1996
|
-
outputCrc32.append(value);
|
|
1997
|
-
}
|
|
1998
|
-
controller.enqueue(value);
|
|
1999
|
-
}
|
|
2016
|
+
let settled = false;
|
|
2017
|
+
let resolvePull, controller;
|
|
2018
|
+
const output = new ReadableStream({
|
|
2019
|
+
start(streamController) {
|
|
2020
|
+
controller = streamController;
|
|
2021
|
+
},
|
|
2022
|
+
pull() {
|
|
2023
|
+
resumePump();
|
|
2000
2024
|
},
|
|
2001
2025
|
cancel(reason) {
|
|
2002
|
-
|
|
2026
|
+
settled = true;
|
|
2027
|
+
resumePump();
|
|
2003
2028
|
return reader.cancel(reason);
|
|
2004
2029
|
}
|
|
2005
2030
|
});
|
|
2031
|
+
pump();
|
|
2032
|
+
drain();
|
|
2033
|
+
return output;
|
|
2006
2034
|
|
|
2007
2035
|
async function pump() {
|
|
2008
2036
|
const inputReader = readable.getReader();
|
|
@@ -2011,19 +2039,16 @@ function pipeThroughGzipDecompressionStream(readable, gzipStream, outputSize, cr
|
|
|
2011
2039
|
header.set(GZIP_HEADER_BYTES);
|
|
2012
2040
|
await writer.write(header);
|
|
2013
2041
|
for (; ;) {
|
|
2042
|
+
await outputCapacity();
|
|
2014
2043
|
await writer.ready;
|
|
2015
|
-
const { value, done } = await inputReader
|
|
2044
|
+
const { value, done } = await readSource(inputReader, sourceErrors);
|
|
2016
2045
|
if (done) {
|
|
2017
2046
|
break;
|
|
2018
2047
|
}
|
|
2019
2048
|
await writer.write(value);
|
|
2020
2049
|
}
|
|
2021
|
-
inputDone = true;
|
|
2022
2050
|
if (outputCrc32) {
|
|
2023
|
-
|
|
2024
|
-
armIdleCheck();
|
|
2025
|
-
}
|
|
2026
|
-
await trailerReady;
|
|
2051
|
+
await writer.write(new Uint8Array(0));
|
|
2027
2052
|
}
|
|
2028
2053
|
const trailer = new Uint8Array(GZIP_TRAILER_LENGTH);
|
|
2029
2054
|
const dataView = getDataView(trailer);
|
|
@@ -2038,54 +2063,68 @@ function pipeThroughGzipDecompressionStream(readable, gzipStream, outputSize, cr
|
|
|
2038
2063
|
}
|
|
2039
2064
|
}
|
|
2040
2065
|
|
|
2041
|
-
function
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2066
|
+
async function drain() {
|
|
2067
|
+
try {
|
|
2068
|
+
for (; ;) {
|
|
2069
|
+
const { value, done } = await read();
|
|
2070
|
+
if (done) {
|
|
2071
|
+
break;
|
|
2072
|
+
}
|
|
2073
|
+
outputLength += value.length;
|
|
2074
|
+
if (outputLength > outputSize) {
|
|
2075
|
+
throw new Error(ERR_INVALID_UNCOMPRESSED_SIZE);
|
|
2076
|
+
}
|
|
2077
|
+
if (outputCrc32) {
|
|
2078
|
+
outputCrc32.append(value);
|
|
2079
|
+
}
|
|
2080
|
+
controller.enqueue(value);
|
|
2081
|
+
}
|
|
2082
|
+
if (!settled) {
|
|
2083
|
+
settled = true;
|
|
2084
|
+
controller.close();
|
|
2085
|
+
}
|
|
2086
|
+
} catch (error) {
|
|
2087
|
+
fail(error);
|
|
2088
|
+
await cancel(reader, error);
|
|
2048
2089
|
}
|
|
2049
|
-
return result;
|
|
2050
2090
|
}
|
|
2051
2091
|
|
|
2052
|
-
function
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
if (!idleCheckArmed) {
|
|
2058
|
-
idleCheckArmed = true;
|
|
2059
|
-
const count = readCount;
|
|
2060
|
-
await nextTask();
|
|
2061
|
-
idleCheckArmed = false;
|
|
2062
|
-
if (readPending) {
|
|
2063
|
-
if (readCount == count) {
|
|
2064
|
-
resolveTrailerReady();
|
|
2065
|
-
} else {
|
|
2066
|
-
armIdleCheck();
|
|
2092
|
+
function read() {
|
|
2093
|
+
return reader.read().catch(error => {
|
|
2094
|
+
if (trailerWritten) {
|
|
2095
|
+
if (!outputCrc32) {
|
|
2096
|
+
throw mapError(error, ERR_INVALID_CRC32);
|
|
2067
2097
|
}
|
|
2098
|
+
if (outputLength != outputSize) {
|
|
2099
|
+
throw mapError(error, ERR_INVALID_UNCOMPRESSED_SIZE);
|
|
2100
|
+
}
|
|
2101
|
+
return { done: true };
|
|
2068
2102
|
}
|
|
2069
|
-
|
|
2103
|
+
throw mapCodecError(error, sourceErrors);
|
|
2104
|
+
});
|
|
2070
2105
|
}
|
|
2071
2106
|
|
|
2072
|
-
function
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2107
|
+
function outputCapacity() {
|
|
2108
|
+
if (!settled && controller.desiredSize <= 0) {
|
|
2109
|
+
return new Promise(resolve => resolvePull = resolve);
|
|
2110
|
+
}
|
|
2076
2111
|
}
|
|
2077
|
-
}
|
|
2078
2112
|
|
|
2079
|
-
function
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
port1.close();
|
|
2084
|
-
port2.close();
|
|
2113
|
+
function resumePump() {
|
|
2114
|
+
if (resolvePull) {
|
|
2115
|
+
const resolve = resolvePull;
|
|
2116
|
+
resolvePull = UNDEFINED_VALUE;
|
|
2085
2117
|
resolve();
|
|
2086
|
-
}
|
|
2087
|
-
|
|
2088
|
-
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
|
|
2121
|
+
function fail(error) {
|
|
2122
|
+
if (!settled) {
|
|
2123
|
+
settled = true;
|
|
2124
|
+
controller.error(error);
|
|
2125
|
+
resumePump();
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2089
2128
|
}
|
|
2090
2129
|
|
|
2091
2130
|
class InflateStream extends TransformStream {
|
|
@@ -2104,11 +2143,12 @@ class InflateStream extends TransformStream {
|
|
|
2104
2143
|
}
|
|
2105
2144
|
}
|
|
2106
2145
|
if (compressed) {
|
|
2146
|
+
const sourceErrors = new Set();
|
|
2107
2147
|
const codecStreams = format && getCodecStreams(format);
|
|
2148
|
+
let gzipStream;
|
|
2108
2149
|
if (codecStreams) {
|
|
2109
|
-
readable = pipeThroughBackpressured(readable, createCodecStream(codecStreams.DecompressionStream, format, { chunkSize, compressionMethod, rawBitFlag, uncompressedSize: outputSize }));
|
|
2150
|
+
readable = pipeThroughBackpressured(readable, createCodecStream(codecStreams.DecompressionStream, format, { chunkSize, compressionMethod, rawBitFlag, uncompressedSize: outputSize }), sourceErrors);
|
|
2110
2151
|
} else {
|
|
2111
|
-
let gzipStream;
|
|
2112
2152
|
const GzipDecompressionStream = getGzipCodecStream(useCompressionStream, DecompressionStream, DecompressionStreamFallback);
|
|
2113
2153
|
if (checkCrc32 && !deflate64 && crc32 !== UNDEFINED_VALUE && outputSize !== UNDEFINED_VALUE && GzipDecompressionStream) {
|
|
2114
2154
|
try {
|
|
@@ -2119,24 +2159,25 @@ class InflateStream extends TransformStream {
|
|
|
2119
2159
|
}
|
|
2120
2160
|
if (!gzipStream) {
|
|
2121
2161
|
try {
|
|
2122
|
-
readable = pipeThroughCompressionStream(readable, useCompressionStream, { chunkSize, deflate64 }, DecompressionStream, DecompressionStreamFallback);
|
|
2162
|
+
readable = pipeThroughCompressionStream(readable, useCompressionStream, { chunkSize, deflate64 }, DecompressionStream, DecompressionStreamFallback, sourceErrors);
|
|
2123
2163
|
} catch (error) {
|
|
2124
2164
|
if (deflate64 || outputSize === UNDEFINED_VALUE || (!useCompressionStream && DecompressionStreamFallback)) {
|
|
2125
|
-
throw error;
|
|
2165
|
+
throw mapMemoryError(error);
|
|
2126
2166
|
}
|
|
2127
2167
|
try {
|
|
2128
2168
|
gzipStream = new DecompressionStream(FORMAT_GZIP$1);
|
|
2129
2169
|
} catch {
|
|
2130
|
-
throw error;
|
|
2170
|
+
throw mapMemoryError(error);
|
|
2131
2171
|
}
|
|
2132
2172
|
}
|
|
2133
2173
|
}
|
|
2134
|
-
if (gzipStream) {
|
|
2135
|
-
gzipCrc32 = true;
|
|
2136
|
-
readable = pipeThroughGzipDecompressionStream(readable, gzipStream, outputSize, crc32);
|
|
2137
|
-
}
|
|
2138
2174
|
}
|
|
2139
|
-
|
|
2175
|
+
if (gzipStream) {
|
|
2176
|
+
gzipCrc32 = true;
|
|
2177
|
+
readable = pipeThroughGzipDecompressionStream(readable, gzipStream, outputSize, crc32, sourceErrors);
|
|
2178
|
+
} else {
|
|
2179
|
+
readable = mapInflateStreamError(readable, sourceErrors);
|
|
2180
|
+
}
|
|
2140
2181
|
}
|
|
2141
2182
|
if (checkCrc32 && !gzipCrc32) {
|
|
2142
2183
|
crc32Stream = new Crc32Stream();
|
|
@@ -2209,7 +2250,7 @@ function getGzipCodecStream(useCompressionStream, CodecStreamNative, CodecStream
|
|
|
2209
2250
|
}
|
|
2210
2251
|
}
|
|
2211
2252
|
|
|
2212
|
-
function pipeThroughCompressionStream(readable, useCompressionStream, options, CompressionStreamNative, CompressionStreamFallback) {
|
|
2253
|
+
function pipeThroughCompressionStream(readable, useCompressionStream, options, CompressionStreamNative, CompressionStreamFallback, sourceErrors) {
|
|
2213
2254
|
const Stream = useCompressionStream && CompressionStreamNative ?
|
|
2214
2255
|
CompressionStreamNative :
|
|
2215
2256
|
CompressionStreamFallback || CompressionStreamNative;
|
|
@@ -2224,14 +2265,14 @@ function pipeThroughCompressionStream(readable, useCompressionStream, options, C
|
|
|
2224
2265
|
throw error;
|
|
2225
2266
|
}
|
|
2226
2267
|
}
|
|
2227
|
-
return pipeThroughBackpressured(readable, codecStream);
|
|
2268
|
+
return pipeThroughBackpressured(readable, codecStream, sourceErrors);
|
|
2228
2269
|
}
|
|
2229
2270
|
|
|
2230
2271
|
function pipeThrough(readable, transformStream) {
|
|
2231
2272
|
return toCompatibleReadable(readable).pipeThrough(transformStream);
|
|
2232
2273
|
}
|
|
2233
2274
|
|
|
2234
|
-
function pipeThroughBackpressured(readable, transformStream) {
|
|
2275
|
+
function pipeThroughBackpressured(readable, transformStream, sourceErrors) {
|
|
2235
2276
|
const writer = transformStream.writable.getWriter();
|
|
2236
2277
|
const reader = readable.getReader();
|
|
2237
2278
|
pump();
|
|
@@ -2241,7 +2282,7 @@ function pipeThroughBackpressured(readable, transformStream) {
|
|
|
2241
2282
|
try {
|
|
2242
2283
|
for (; ;) {
|
|
2243
2284
|
await writer.ready;
|
|
2244
|
-
const result = await reader
|
|
2285
|
+
const result = await readSource(reader, sourceErrors);
|
|
2245
2286
|
if (result.done) {
|
|
2246
2287
|
await writer.close();
|
|
2247
2288
|
break;
|
|
@@ -2271,26 +2312,49 @@ async function cancel(reader, error) {
|
|
|
2271
2312
|
}
|
|
2272
2313
|
}
|
|
2273
2314
|
|
|
2274
|
-
function
|
|
2315
|
+
function readSource(reader, sourceErrors) {
|
|
2316
|
+
const result = reader.read();
|
|
2317
|
+
return sourceErrors ? result.catch(error => {
|
|
2318
|
+
sourceErrors.add(error);
|
|
2319
|
+
throw error;
|
|
2320
|
+
}) : result;
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
function mapCodecError(error, sourceErrors) {
|
|
2324
|
+
if (sourceErrors.has(error)) {
|
|
2325
|
+
return error;
|
|
2326
|
+
}
|
|
2327
|
+
return mapError(error, isMemoryError(error) ? ERR_CODEC_OUT_OF_MEMORY : ERR_INVALID_COMPRESSED_DATA);
|
|
2328
|
+
}
|
|
2329
|
+
|
|
2330
|
+
function mapMemoryError(error) {
|
|
2331
|
+
return isMemoryError(error) ? mapError(error, ERR_CODEC_OUT_OF_MEMORY) : error;
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
function isMemoryError(error) {
|
|
2335
|
+
return isErrorObject(error) && error.code == Z_MEM_ERROR_CODE$1;
|
|
2336
|
+
}
|
|
2337
|
+
|
|
2338
|
+
function mapError(error, message) {
|
|
2339
|
+
const mappedError = new Error(message);
|
|
2340
|
+
mappedError.cause = error;
|
|
2341
|
+
return mappedError;
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2344
|
+
function mapInflateStreamError(readable, sourceErrors) {
|
|
2275
2345
|
const reader = readable.getReader();
|
|
2276
2346
|
return new ReadableStream({
|
|
2277
2347
|
async pull(controller) {
|
|
2278
|
-
let result;
|
|
2279
2348
|
try {
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2349
|
+
const { value, done } = await reader.read();
|
|
2350
|
+
if (done) {
|
|
2351
|
+
controller.close();
|
|
2352
|
+
} else {
|
|
2353
|
+
controller.enqueue(value);
|
|
2284
2354
|
}
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
throw
|
|
2288
|
-
}
|
|
2289
|
-
const { value, done } = result;
|
|
2290
|
-
if (done) {
|
|
2291
|
-
controller.close();
|
|
2292
|
-
} else {
|
|
2293
|
-
controller.enqueue(value);
|
|
2355
|
+
} catch (error) {
|
|
2356
|
+
await cancel(reader, error);
|
|
2357
|
+
throw mapCodecError(error, sourceErrors);
|
|
2294
2358
|
}
|
|
2295
2359
|
},
|
|
2296
2360
|
cancel(reason) {
|
|
@@ -2658,10 +2722,11 @@ async function runWorker$1({ options, readable, writable, onTaskFinished, worker
|
|
|
2658
2722
|
}
|
|
2659
2723
|
codecStream = new CodecStream(options, config);
|
|
2660
2724
|
chunkStream = new ChunkStream(getChunkSize(config));
|
|
2725
|
+
const { signal } = workerOptions.streamOptions;
|
|
2661
2726
|
await readable
|
|
2662
2727
|
.pipeThrough(codecStream)
|
|
2663
2728
|
.pipeThrough(chunkStream)
|
|
2664
|
-
.pipeTo(writable, { preventClose: true, preventAbort: true });
|
|
2729
|
+
.pipeTo(writable, { preventClose: true, preventAbort: true, signal });
|
|
2665
2730
|
const {
|
|
2666
2731
|
crc32,
|
|
2667
2732
|
inputSize,
|
|
@@ -2729,6 +2794,7 @@ async function runWorker$1({ options, readable, writable, onTaskFinished, worker
|
|
|
2729
2794
|
const MODULE_WORKER_OPTIONS = { type: "module" };
|
|
2730
2795
|
const ERROR_EVENT_TYPE = "error";
|
|
2731
2796
|
const MESSAGE_ERROR_EVENT_TYPE = "messageerror";
|
|
2797
|
+
const ABORT_EVENT_TYPE = "abort";
|
|
2732
2798
|
|
|
2733
2799
|
let webWorkerSource, webWorkerURI, webWorkerOptions;
|
|
2734
2800
|
let transferStreamsSupported = true;
|
|
@@ -2905,6 +2971,13 @@ function watchClosedStream(writableSource, workerData) {
|
|
|
2905
2971
|
Object.assign(workerData, { destinationFailed: true, destinationError: error });
|
|
2906
2972
|
}
|
|
2907
2973
|
});
|
|
2974
|
+
const { signal } = workerData.workerOptions.streamOptions;
|
|
2975
|
+
if (signal) {
|
|
2976
|
+
const onAbort = () => abortController.abort(signal.reason);
|
|
2977
|
+
const removeAbortListener = () => signal.removeEventListener(ABORT_EVENT_TYPE, onAbort);
|
|
2978
|
+
signal.addEventListener(ABORT_EVENT_TYPE, onAbort);
|
|
2979
|
+
closed.then(removeAbortListener, removeAbortListener);
|
|
2980
|
+
}
|
|
2908
2981
|
return {
|
|
2909
2982
|
writable, closed, abortPipe: () => {
|
|
2910
2983
|
aborting = true;
|
|
@@ -3167,9 +3240,6 @@ function getResponseError(errorData, errorValue) {
|
|
|
3167
3240
|
responseError = errorValue.value;
|
|
3168
3241
|
} else {
|
|
3169
3242
|
responseError = Object.assign(new Error(message), { stack, code, name });
|
|
3170
|
-
if (cause) {
|
|
3171
|
-
responseError.cause = Object.assign(new Error(cause.message), { name: cause.name });
|
|
3172
|
-
}
|
|
3173
3243
|
}
|
|
3174
3244
|
if (isErrorObject(responseError)) {
|
|
3175
3245
|
try {
|
|
@@ -3179,6 +3249,9 @@ function getResponseError(errorData, errorValue) {
|
|
|
3179
3249
|
if (codecImportFailed) {
|
|
3180
3250
|
responseError.codecImportFailed = true;
|
|
3181
3251
|
}
|
|
3252
|
+
if (cause && !isErrorObject(responseError.cause)) {
|
|
3253
|
+
responseError.cause = Object.assign(new Error(cause.message), { name: cause.name });
|
|
3254
|
+
}
|
|
3182
3255
|
if (errorValue) {
|
|
3183
3256
|
if (responseError.name !== name) {
|
|
3184
3257
|
responseError.name = name;
|
|
@@ -5370,8 +5443,8 @@ let ZipEntry$1 = class ZipEntry {
|
|
|
5370
5443
|
const passThroughCompression = Boolean(passThrough);
|
|
5371
5444
|
const passThroughEncryption = passThrough === true;
|
|
5372
5445
|
checkPasswordOption(password, rawPassword);
|
|
5373
|
-
password = password && password.length
|
|
5374
|
-
rawPassword = rawPassword && rawPassword.length
|
|
5446
|
+
password = password && password.length ? password : UNDEFINED_VALUE;
|
|
5447
|
+
rawPassword = rawPassword && rawPassword.length ? rawPassword : UNDEFINED_VALUE;
|
|
5375
5448
|
if (extraFieldAES) {
|
|
5376
5449
|
if (extraFieldAES.originalCompressionMethod != COMPRESSION_METHOD_AES) {
|
|
5377
5450
|
throw new Error(ERR_UNSUPPORTED_COMPRESSION);
|
|
@@ -5521,6 +5594,7 @@ let ZipEntry$1 = class ZipEntry {
|
|
|
5521
5594
|
({ writable } = writer);
|
|
5522
5595
|
const readable = toCompatibleReadable(reader.createReadable({ offset: dataOffset, size }));
|
|
5523
5596
|
const { outputSize: writtenSize } = await runWorker({ readable, writable }, workerOptions);
|
|
5597
|
+
throwIfAborted(signal);
|
|
5524
5598
|
if (writtenSize != outputSize) {
|
|
5525
5599
|
throw Object.assign(new Error(ERR_INVALID_UNCOMPRESSED_SIZE), { outputSize: writtenSize });
|
|
5526
5600
|
}
|
|
@@ -6132,7 +6206,7 @@ function getMaxAppendedDataSize(maxAppendedDataSize, strictness) {
|
|
|
6132
6206
|
async function findEndOfCentralDirectory(reader, rejectAmbiguous, maxAppendedDataSize) {
|
|
6133
6207
|
const { size } = reader;
|
|
6134
6208
|
const anchoredLength = Math.min(size, END_OF_CENTRAL_DIR_LENGTH + MAX_16_BITS);
|
|
6135
|
-
const remoteProbeBudget = {
|
|
6209
|
+
const remoteProbeBudget = { remaining: MAX_END_OF_CENTRAL_DIR_PROBES };
|
|
6136
6210
|
let endOfDirectoryInfo;
|
|
6137
6211
|
let plausibleEndOfDirectoryInfo;
|
|
6138
6212
|
let endOfDirectoryReachingEndCount = 0;
|
|
@@ -6225,8 +6299,8 @@ async function readSignature(reader, view, anchoredOffset, signatureOffset, size
|
|
|
6225
6299
|
if (signatureOffset >= anchoredOffset) {
|
|
6226
6300
|
return getUint32$1(view, signatureOffset - anchoredOffset);
|
|
6227
6301
|
}
|
|
6228
|
-
if (remoteProbeBudget.
|
|
6229
|
-
remoteProbeBudget.
|
|
6302
|
+
if (remoteProbeBudget.remaining > 0) {
|
|
6303
|
+
remoteProbeBudget.remaining--;
|
|
6230
6304
|
const signatureArray = await readUint8Array(reader, signatureOffset, 4);
|
|
6231
6305
|
return getUint32$1(getDataView(signatureArray), 0);
|
|
6232
6306
|
}
|
|
@@ -6316,6 +6390,7 @@ var zipReader = /*#__PURE__*/Object.freeze({
|
|
|
6316
6390
|
ERR_AMBIGUOUS_ARCHIVE: ERR_AMBIGUOUS_ARCHIVE,
|
|
6317
6391
|
ERR_BAD_FORMAT: ERR_BAD_FORMAT,
|
|
6318
6392
|
ERR_CENTRAL_DIRECTORY_NOT_FOUND: ERR_CENTRAL_DIRECTORY_NOT_FOUND,
|
|
6393
|
+
ERR_CODEC_OUT_OF_MEMORY: ERR_CODEC_OUT_OF_MEMORY,
|
|
6319
6394
|
ERR_ENCRYPTED: ERR_ENCRYPTED,
|
|
6320
6395
|
ERR_ENCRYPTED_CENTRAL_DIRECTORY: ERR_ENCRYPTED_CENTRAL_DIRECTORY,
|
|
6321
6396
|
ERR_ENTRY_DATA_OUT_OF_BOUNDS: ERR_ENTRY_DATA_OUT_OF_BOUNDS,
|
|
@@ -7142,9 +7217,11 @@ function resolveMetadata(zipWriter, name, options) {
|
|
|
7142
7217
|
const passThrough = checkPassThroughOption(getOptionValue(zipWriter, options, OPTION_PASS_THROUGH));
|
|
7143
7218
|
const passThroughCompression = Boolean(passThrough);
|
|
7144
7219
|
const passThroughEncryption = passThrough === true;
|
|
7145
|
-
|
|
7146
|
-
|
|
7220
|
+
let password = getOptionValue(zipWriter, options, OPTION_PASSWORD);
|
|
7221
|
+
let rawPassword = getOptionValue(zipWriter, options, OPTION_RAW_PASSWORD);
|
|
7147
7222
|
checkPasswordOption(password, rawPassword);
|
|
7223
|
+
password = password && password.length ? password : UNDEFINED_VALUE;
|
|
7224
|
+
rawPassword = rawPassword && rawPassword.length ? rawPassword : UNDEFINED_VALUE;
|
|
7148
7225
|
const encryptionStrength = getNumberOptionValue(zipWriter, options, OPTION_ENCRYPTION_STRENGTH, 3);
|
|
7149
7226
|
const zipCrypto = getOptionValue(zipWriter, options, PROPERTY_NAME_ZIPCRYPTO);
|
|
7150
7227
|
const extendedTimestamp = getOptionValue(zipWriter, options, OPTION_EXTENDED_TIMESTAMP, true);
|
|
@@ -7761,6 +7838,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7761
7838
|
const result = await runWorker({ readable, writable }, workerOptions);
|
|
7762
7839
|
compressedSize = result.outputSize;
|
|
7763
7840
|
writer.size += compressedSize;
|
|
7841
|
+
throwIfAborted(signal);
|
|
7764
7842
|
if (!passThroughCompression) {
|
|
7765
7843
|
uncompressedSize = result.inputSize;
|
|
7766
7844
|
if (!encrypted || zipCrypto) {
|
|
@@ -8940,7 +9018,7 @@ function formatSupported(StreamClass, format) {
|
|
|
8940
9018
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8941
9019
|
*/
|
|
8942
9020
|
|
|
8943
|
-
const VERSION = "2.
|
|
9021
|
+
const VERSION = "2.17.0";
|
|
8944
9022
|
|
|
8945
9023
|
/*
|
|
8946
9024
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
@@ -9419,12 +9497,16 @@ const n=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,1
|
|
|
9419
9497
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
9420
9498
|
*/
|
|
9421
9499
|
|
|
9422
|
-
/* global
|
|
9500
|
+
/* global ReadableStream, WritableStream */
|
|
9423
9501
|
|
|
9424
9502
|
const FORMAT_DEFLATE = "deflate";
|
|
9425
9503
|
const FORMAT_DEFLATE_RAW = "deflate-raw";
|
|
9426
9504
|
const FORMAT_DEFLATE64_RAW = "deflate64-raw";
|
|
9427
9505
|
const FORMAT_GZIP = "gzip";
|
|
9506
|
+
const Z_MEM_ERROR = -4;
|
|
9507
|
+
const Z_MEM_ERROR_CODE = "Z_MEM_ERROR";
|
|
9508
|
+
const COMPRESSION_FORMATS = [FORMAT_DEFLATE, FORMAT_DEFLATE_RAW, FORMAT_GZIP];
|
|
9509
|
+
const DECOMPRESSION_FORMATS = [FORMAT_DEFLATE, FORMAT_DEFLATE_RAW, FORMAT_GZIP, FORMAT_DEFLATE64_RAW];
|
|
9428
9510
|
|
|
9429
9511
|
let wasm$1, malloc, free, memory, initError;
|
|
9430
9512
|
|
|
@@ -9445,7 +9527,17 @@ function resetWasmExports$1() {
|
|
|
9445
9527
|
wasm$1 = malloc = free = memory = initError = null;
|
|
9446
9528
|
}
|
|
9447
9529
|
|
|
9530
|
+
function setZlibCode(error, result) {
|
|
9531
|
+
if (result === Z_MEM_ERROR) {
|
|
9532
|
+
error.code = Z_MEM_ERROR_CODE;
|
|
9533
|
+
}
|
|
9534
|
+
return error;
|
|
9535
|
+
}
|
|
9536
|
+
|
|
9448
9537
|
function _make(isCompress, type, options = {}) {
|
|
9538
|
+
if (!(isCompress ? COMPRESSION_FORMATS : DECOMPRESSION_FORMATS).includes(type)) {
|
|
9539
|
+
throw new TypeError("Unsupported format: " + type);
|
|
9540
|
+
}
|
|
9449
9541
|
if (!wasm$1) {
|
|
9450
9542
|
const error = new Error("WASM module not loaded");
|
|
9451
9543
|
error.cause = initError;
|
|
@@ -9454,137 +9546,200 @@ function _make(isCompress, type, options = {}) {
|
|
|
9454
9546
|
const level = (typeof options.level === "number") ? options.level : -1;
|
|
9455
9547
|
const outBufferSize = (typeof options.outBuffer === "number") ? options.outBuffer : 64 * 1024;
|
|
9456
9548
|
const inBufferSize = (typeof options.inBufferSize === "number") ? options.inBufferSize : 64 * 1024;
|
|
9457
|
-
|
|
9458
|
-
|
|
9459
|
-
|
|
9549
|
+
const state = { out: 0, in: 0, inBufferSize: 0, streamHandle: 0, streamEnded: false };
|
|
9550
|
+
let readableController, writableController, resolveWrite, cancelReason;
|
|
9551
|
+
let backpressure = true;
|
|
9552
|
+
let cancelled = false;
|
|
9553
|
+
initStream();
|
|
9554
|
+
const readable = new ReadableStream({
|
|
9555
|
+
start(controller) {
|
|
9556
|
+
readableController = controller;
|
|
9557
|
+
},
|
|
9558
|
+
pull() {
|
|
9559
|
+
backpressure = false;
|
|
9560
|
+
resumeWrite();
|
|
9561
|
+
},
|
|
9562
|
+
cancel(reason) {
|
|
9563
|
+
cancelled = true;
|
|
9564
|
+
cancelReason = reason;
|
|
9565
|
+
disposeStream(state);
|
|
9566
|
+
writableController.error(reason);
|
|
9567
|
+
resumeWrite();
|
|
9568
|
+
}
|
|
9569
|
+
}, { highWaterMark: 0 });
|
|
9570
|
+
const writable = new WritableStream({
|
|
9571
|
+
start(controller) {
|
|
9572
|
+
writableController = controller;
|
|
9573
|
+
},
|
|
9574
|
+
async write(chunk) {
|
|
9575
|
+
if (backpressure) {
|
|
9576
|
+
await new Promise(resolve => resolveWrite = resolve);
|
|
9577
|
+
}
|
|
9578
|
+
if (cancelled) {
|
|
9579
|
+
throw cancelReason;
|
|
9580
|
+
}
|
|
9460
9581
|
try {
|
|
9461
|
-
|
|
9462
|
-
this.out = malloc(outBufferSize);
|
|
9463
|
-
this.in = malloc(inBufferSize);
|
|
9464
|
-
this.inBufferSize = inBufferSize;
|
|
9465
|
-
if (!this.out || !this.in) {
|
|
9466
|
-
throw new Error("allocation failed");
|
|
9467
|
-
}
|
|
9468
|
-
if (isCompress) {
|
|
9469
|
-
this._process = wasm$1.deflate_process;
|
|
9470
|
-
this._last_consumed = wasm$1.deflate_last_consumed;
|
|
9471
|
-
this._end = wasm$1.deflate_end;
|
|
9472
|
-
this.streamHandle = wasm$1.deflate_new();
|
|
9473
|
-
if (type === FORMAT_GZIP) {
|
|
9474
|
-
result = wasm$1.deflate_init_gzip(this.streamHandle, level);
|
|
9475
|
-
} else if (type === FORMAT_DEFLATE_RAW) {
|
|
9476
|
-
result = wasm$1.deflate_init_raw(this.streamHandle, level);
|
|
9477
|
-
} else {
|
|
9478
|
-
result = wasm$1.deflate_init(this.streamHandle, level);
|
|
9479
|
-
}
|
|
9480
|
-
} else {
|
|
9481
|
-
if (type === FORMAT_DEFLATE64_RAW) {
|
|
9482
|
-
this._process = wasm$1.inflate9_process;
|
|
9483
|
-
this._last_consumed = wasm$1.inflate9_last_consumed;
|
|
9484
|
-
this._end = wasm$1.inflate9_end;
|
|
9485
|
-
this.streamHandle = wasm$1.inflate9_new();
|
|
9486
|
-
result = wasm$1.inflate9_init_raw(this.streamHandle);
|
|
9487
|
-
} else {
|
|
9488
|
-
this._process = wasm$1.inflate_process;
|
|
9489
|
-
this._last_consumed = wasm$1.inflate_last_consumed;
|
|
9490
|
-
this._end = wasm$1.inflate_end;
|
|
9491
|
-
this.streamHandle = wasm$1.inflate_new();
|
|
9492
|
-
if (type === FORMAT_DEFLATE_RAW) {
|
|
9493
|
-
result = wasm$1.inflate_init_raw(this.streamHandle);
|
|
9494
|
-
} else if (type === FORMAT_GZIP) {
|
|
9495
|
-
result = wasm$1.inflate_init_gzip(this.streamHandle);
|
|
9496
|
-
} else {
|
|
9497
|
-
result = wasm$1.inflate_init(this.streamHandle);
|
|
9498
|
-
}
|
|
9499
|
-
}
|
|
9500
|
-
}
|
|
9501
|
-
if (result !== 0) {
|
|
9502
|
-
throw new Error("init failed:" + result);
|
|
9503
|
-
}
|
|
9582
|
+
processChunk(chunk);
|
|
9504
9583
|
} catch (error) {
|
|
9505
|
-
disposeStream(
|
|
9584
|
+
disposeStream(state);
|
|
9585
|
+
readableController.error(error);
|
|
9506
9586
|
throw error;
|
|
9507
9587
|
}
|
|
9508
9588
|
},
|
|
9509
|
-
|
|
9589
|
+
close() {
|
|
9590
|
+
if (cancelled) {
|
|
9591
|
+
return;
|
|
9592
|
+
}
|
|
9510
9593
|
try {
|
|
9511
|
-
|
|
9512
|
-
const heap = new Uint8Array(memory.buffer);
|
|
9513
|
-
const process = this._process;
|
|
9514
|
-
const last_consumed = this._last_consumed;
|
|
9515
|
-
const out = this.out;
|
|
9516
|
-
let offset = 0;
|
|
9517
|
-
while (offset < buffer.length) {
|
|
9518
|
-
const toRead = Math.min(buffer.length - offset, 32 * 1024);
|
|
9519
|
-
if (!this.in || this.inBufferSize < toRead) {
|
|
9520
|
-
if (this.in && free) {
|
|
9521
|
-
free(this.in);
|
|
9522
|
-
this.in = 0;
|
|
9523
|
-
}
|
|
9524
|
-
this.in = malloc(toRead);
|
|
9525
|
-
this.inBufferSize = toRead;
|
|
9526
|
-
if (!this.in) {
|
|
9527
|
-
throw new Error("allocation failed");
|
|
9528
|
-
}
|
|
9529
|
-
}
|
|
9530
|
-
heap.set(buffer.subarray(offset, offset + toRead), this.in);
|
|
9531
|
-
const result = process(this.streamHandle, this.in, toRead, out, outBufferSize, 0);
|
|
9532
|
-
// checked before the byte count is used, so a status code can never be read as one
|
|
9533
|
-
const code = (result >> 24) & 0xff;
|
|
9534
|
-
const signedCode = (code & 0x80) ? code - 256 : code;
|
|
9535
|
-
if (signedCode < 0) {
|
|
9536
|
-
throw new Error("process error:" + signedCode);
|
|
9537
|
-
}
|
|
9538
|
-
const prod = result & 0x00ffffff;
|
|
9539
|
-
if (prod) {
|
|
9540
|
-
controller.enqueue(heap.slice(out, out + prod));
|
|
9541
|
-
}
|
|
9542
|
-
const consumed = last_consumed(this.streamHandle);
|
|
9543
|
-
if (consumed === 0 && prod === 0) {
|
|
9544
|
-
break;
|
|
9545
|
-
}
|
|
9546
|
-
offset += consumed;
|
|
9547
|
-
}
|
|
9594
|
+
flushStream();
|
|
9548
9595
|
} catch (error) {
|
|
9549
|
-
disposeStream(
|
|
9550
|
-
|
|
9596
|
+
disposeStream(state);
|
|
9597
|
+
readableController.error(error);
|
|
9598
|
+
throw error;
|
|
9551
9599
|
}
|
|
9600
|
+
const result = disposeStream(state);
|
|
9601
|
+
if (result !== 0) {
|
|
9602
|
+
const error = setZlibCode(new Error("end error:" + result), result);
|
|
9603
|
+
readableController.error(error);
|
|
9604
|
+
throw error;
|
|
9605
|
+
}
|
|
9606
|
+
readableController.close();
|
|
9552
9607
|
},
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
|
-
|
|
9565
|
-
|
|
9566
|
-
|
|
9567
|
-
|
|
9568
|
-
|
|
9569
|
-
|
|
9570
|
-
|
|
9608
|
+
abort(reason) {
|
|
9609
|
+
disposeStream(state);
|
|
9610
|
+
readableController.error(reason);
|
|
9611
|
+
}
|
|
9612
|
+
}, { highWaterMark: 1 });
|
|
9613
|
+
return { readable, writable };
|
|
9614
|
+
|
|
9615
|
+
function initStream() {
|
|
9616
|
+
try {
|
|
9617
|
+
let result;
|
|
9618
|
+
state.out = malloc(outBufferSize);
|
|
9619
|
+
state.in = malloc(inBufferSize);
|
|
9620
|
+
state.inBufferSize = inBufferSize;
|
|
9621
|
+
if (!state.out || !state.in) {
|
|
9622
|
+
throw setZlibCode(new Error("allocation failed"), Z_MEM_ERROR);
|
|
9623
|
+
}
|
|
9624
|
+
if (isCompress) {
|
|
9625
|
+
state._process = wasm$1.deflate_process;
|
|
9626
|
+
state._last_consumed = wasm$1.deflate_last_consumed;
|
|
9627
|
+
state._end = wasm$1.deflate_end;
|
|
9628
|
+
state.streamHandle = wasm$1.deflate_new();
|
|
9629
|
+
if (type === FORMAT_GZIP) {
|
|
9630
|
+
result = wasm$1.deflate_init_gzip(state.streamHandle, level);
|
|
9631
|
+
} else if (type === FORMAT_DEFLATE_RAW) {
|
|
9632
|
+
result = wasm$1.deflate_init_raw(state.streamHandle, level);
|
|
9633
|
+
} else {
|
|
9634
|
+
result = wasm$1.deflate_init(state.streamHandle, level);
|
|
9635
|
+
}
|
|
9636
|
+
} else {
|
|
9637
|
+
if (type === FORMAT_DEFLATE64_RAW) {
|
|
9638
|
+
state._process = wasm$1.inflate9_process;
|
|
9639
|
+
state._last_consumed = wasm$1.inflate9_last_consumed;
|
|
9640
|
+
state._end = wasm$1.inflate9_end;
|
|
9641
|
+
state.streamHandle = wasm$1.inflate9_new();
|
|
9642
|
+
result = wasm$1.inflate9_init_raw(state.streamHandle);
|
|
9643
|
+
} else {
|
|
9644
|
+
state._process = wasm$1.inflate_process;
|
|
9645
|
+
state._last_consumed = wasm$1.inflate_last_consumed;
|
|
9646
|
+
state._end = wasm$1.inflate_end;
|
|
9647
|
+
state.streamHandle = wasm$1.inflate_new();
|
|
9648
|
+
if (type === FORMAT_DEFLATE_RAW) {
|
|
9649
|
+
result = wasm$1.inflate_init_raw(state.streamHandle);
|
|
9650
|
+
} else if (type === FORMAT_GZIP) {
|
|
9651
|
+
result = wasm$1.inflate_init_gzip(state.streamHandle);
|
|
9652
|
+
} else {
|
|
9653
|
+
result = wasm$1.inflate_init(state.streamHandle);
|
|
9571
9654
|
}
|
|
9572
9655
|
}
|
|
9573
|
-
}
|
|
9574
|
-
|
|
9575
|
-
|
|
9576
|
-
|
|
9577
|
-
|
|
9578
|
-
|
|
9656
|
+
}
|
|
9657
|
+
if (result !== 0) {
|
|
9658
|
+
throw setZlibCode(new Error("init failed:" + result), result);
|
|
9659
|
+
}
|
|
9660
|
+
} catch (error) {
|
|
9661
|
+
disposeStream(state);
|
|
9662
|
+
throw error;
|
|
9663
|
+
}
|
|
9664
|
+
}
|
|
9665
|
+
|
|
9666
|
+
function processChunk(chunk) {
|
|
9667
|
+
const heap = new Uint8Array(memory.buffer);
|
|
9668
|
+
const process = state._process;
|
|
9669
|
+
const last_consumed = state._last_consumed;
|
|
9670
|
+
const out = state.out;
|
|
9671
|
+
let offset = 0;
|
|
9672
|
+
while (offset < chunk.length) {
|
|
9673
|
+
if (state.streamEnded) {
|
|
9674
|
+
throw new Error("trailing data after the end of the stream");
|
|
9675
|
+
}
|
|
9676
|
+
const toRead = Math.min(chunk.length - offset, 32 * 1024);
|
|
9677
|
+
if (!state.in || state.inBufferSize < toRead) {
|
|
9678
|
+
if (state.in && free) {
|
|
9679
|
+
free(state.in);
|
|
9680
|
+
state.in = 0;
|
|
9681
|
+
}
|
|
9682
|
+
state.in = malloc(toRead);
|
|
9683
|
+
state.inBufferSize = toRead;
|
|
9684
|
+
if (!state.in) {
|
|
9685
|
+
throw setZlibCode(new Error("allocation failed"), Z_MEM_ERROR);
|
|
9579
9686
|
}
|
|
9580
9687
|
}
|
|
9581
|
-
|
|
9582
|
-
|
|
9583
|
-
//
|
|
9584
|
-
|
|
9585
|
-
|
|
9688
|
+
heap.set(chunk.subarray(offset, offset + toRead), state.in);
|
|
9689
|
+
const result = process(state.streamHandle, state.in, toRead, out, outBufferSize, 0);
|
|
9690
|
+
// checked before the byte count is used, so a status code can never be read as one
|
|
9691
|
+
const code = (result >> 24) & 0xff;
|
|
9692
|
+
const signedCode = (code & 0x80) ? code - 256 : code;
|
|
9693
|
+
if (signedCode < 0) {
|
|
9694
|
+
throw setZlibCode(new Error("process error:" + signedCode), signedCode);
|
|
9695
|
+
}
|
|
9696
|
+
const prod = result & 0x00ffffff;
|
|
9697
|
+
if (prod) {
|
|
9698
|
+
enqueue(heap.slice(out, out + prod));
|
|
9699
|
+
}
|
|
9700
|
+
const consumed = last_consumed(state.streamHandle);
|
|
9701
|
+
if (code === 1) {
|
|
9702
|
+
state.streamEnded = true;
|
|
9703
|
+
} else if (consumed === 0 && prod === 0) {
|
|
9704
|
+
break;
|
|
9705
|
+
}
|
|
9706
|
+
offset += consumed;
|
|
9586
9707
|
}
|
|
9587
|
-
}
|
|
9708
|
+
}
|
|
9709
|
+
|
|
9710
|
+
function flushStream() {
|
|
9711
|
+
const heap = new Uint8Array(memory.buffer);
|
|
9712
|
+
const process = state._process;
|
|
9713
|
+
const out = state.out;
|
|
9714
|
+
while (true) {
|
|
9715
|
+
const result = process(state.streamHandle, 0, 0, out, outBufferSize, 4);
|
|
9716
|
+
const code = (result >> 24) & 0xff;
|
|
9717
|
+
const signedCode = (code & 0x80) ? code - 256 : code;
|
|
9718
|
+
if (signedCode < 0) {
|
|
9719
|
+
throw setZlibCode(new Error("process error:" + signedCode), signedCode);
|
|
9720
|
+
}
|
|
9721
|
+
const produced = result & 0x00ffffff;
|
|
9722
|
+
if (produced) {
|
|
9723
|
+
enqueue(heap.slice(out, out + produced));
|
|
9724
|
+
}
|
|
9725
|
+
if (code === 1 || produced === 0) {
|
|
9726
|
+
break;
|
|
9727
|
+
}
|
|
9728
|
+
}
|
|
9729
|
+
}
|
|
9730
|
+
|
|
9731
|
+
function enqueue(chunk) {
|
|
9732
|
+
backpressure = true;
|
|
9733
|
+
readableController.enqueue(chunk);
|
|
9734
|
+
}
|
|
9735
|
+
|
|
9736
|
+
function resumeWrite() {
|
|
9737
|
+
if (resolveWrite) {
|
|
9738
|
+
const resolve = resolveWrite;
|
|
9739
|
+
resolveWrite = null;
|
|
9740
|
+
resolve();
|
|
9741
|
+
}
|
|
9742
|
+
}
|
|
9588
9743
|
|
|
9589
9744
|
function disposeStream(state) {
|
|
9590
9745
|
let endResult = 0;
|
|
@@ -9620,10 +9775,10 @@ class DecompressionStreamZlib {
|
|
|
9620
9775
|
CompressionStreamZlib.requiresModule = true;
|
|
9621
9776
|
DecompressionStreamZlib.requiresModule = true;
|
|
9622
9777
|
// Constructing these classes before the module is loaded throws, so capability probes cannot rely
|
|
9623
|
-
// on trying the constructor; the formats are declared instead,
|
|
9624
|
-
//
|
|
9625
|
-
CompressionStreamZlib.supportedFormats =
|
|
9626
|
-
DecompressionStreamZlib.supportedFormats =
|
|
9778
|
+
// on trying the constructor; the formats are declared instead, the lists _make() checks a format
|
|
9779
|
+
// against before anything else.
|
|
9780
|
+
CompressionStreamZlib.supportedFormats = COMPRESSION_FORMATS;
|
|
9781
|
+
DecompressionStreamZlib.supportedFormats = DECOMPRESSION_FORMATS;
|
|
9627
9782
|
|
|
9628
9783
|
/*
|
|
9629
9784
|
Copyright (c) 2026 Gildas Lormeau. All rights reserved.
|
|
@@ -9940,7 +10095,12 @@ const DUPLICATES_VALUES = new Set([DUPLICATES_THROW, DUPLICATES_KEEP_FIRST, DUPL
|
|
|
9940
10095
|
const ERR_INVALID_PASS_THROUGH = "Invalid passThrough option (use readerOptions.passThrough or set uncompressedSize for each entry)";
|
|
9941
10096
|
const ERR_INVALID_READER_OPTIONS = "Invalid readerOptions (must be an object)";
|
|
9942
10097
|
const ERR_UNSUPPORTED_PASS_THROUGH_VALUE = "The 'compressed' passThrough option is only supported by Entry#getData() and ZipWriter#add()";
|
|
10098
|
+
const ERR_INVALID_PASSWORDS = "Invalid passwords option (must be an array of strings)";
|
|
10099
|
+
const ERR_INVALID_REQUEST_PASSWORD = "Invalid requestPassword option (must be a function returning a string or undefined)";
|
|
9943
10100
|
const ERR_ABORT_EXPORT = "zipjs-abort-export";
|
|
10101
|
+
const ABORT_ERROR_NAME = "AbortError";
|
|
10102
|
+
const EMPTY_RAW_PASSWORD = new Uint8Array(0);
|
|
10103
|
+
const FALSE_ACCEPT_ERRORS = new Set([ERR_INVALID_CRC32, ERR_INVALID_UNCOMPRESSED_SIZE, ERR_INVALID_COMPRESSED_DATA]);
|
|
9944
10104
|
|
|
9945
10105
|
class ZipEntry {
|
|
9946
10106
|
|
|
@@ -10313,8 +10473,10 @@ class ZipDirectoryEntry extends ZipEntry {
|
|
|
10313
10473
|
zipReader = new ZipReader(reader, options);
|
|
10314
10474
|
}
|
|
10315
10475
|
checkPassThroughValue(options.passThrough);
|
|
10476
|
+
checkPasswordCandidatesOptions(options);
|
|
10316
10477
|
const duplicates = checkDuplicatesOption(options.duplicates);
|
|
10317
10478
|
const importedEntries = [];
|
|
10479
|
+
const passwordState = { known: [] };
|
|
10318
10480
|
const entries = await zipReader.getEntries(options);
|
|
10319
10481
|
for (const entry of entries) {
|
|
10320
10482
|
let parent = this;
|
|
@@ -10359,7 +10521,7 @@ class ZipDirectoryEntry extends ZipEntry {
|
|
|
10359
10521
|
}
|
|
10360
10522
|
importedEntries.push(addChild(parent, name, {
|
|
10361
10523
|
data: entry,
|
|
10362
|
-
Reader: getZipBlobReader(Object.assign({}, options)),
|
|
10524
|
+
Reader: getZipBlobReader(Object.assign({}, options), passwordState),
|
|
10363
10525
|
uncompressedSize: options.passThrough ? entry.compressedSize : entry.uncompressedSize,
|
|
10364
10526
|
passThrough: options.passThrough
|
|
10365
10527
|
}));
|
|
@@ -10688,7 +10850,7 @@ function getReadableReader(readable) {
|
|
|
10688
10850
|
};
|
|
10689
10851
|
}
|
|
10690
10852
|
|
|
10691
|
-
function getZipBlobReader(options) {
|
|
10853
|
+
function getZipBlobReader(options, passwordState) {
|
|
10692
10854
|
return class extends Reader {
|
|
10693
10855
|
|
|
10694
10856
|
constructor(entry, options = {}) {
|
|
@@ -10701,12 +10863,12 @@ function getZipBlobReader(options) {
|
|
|
10701
10863
|
const zipBlobReader = this;
|
|
10702
10864
|
const readerOptions = Object.assign({}, options, zipBlobReader.options);
|
|
10703
10865
|
const { checkOverlappingEntry, checkOverlappingEntryOnly } = readerOptions;
|
|
10704
|
-
const data = await zipBlobReader.entry
|
|
10866
|
+
const data = await readEntryData(zipBlobReader.entry, Object.assign(readerOptions, {
|
|
10705
10867
|
checkPasswordOnly: false,
|
|
10706
10868
|
checkOverlappingEntry: checkOverlappingEntryOnly || checkOverlappingEntry,
|
|
10707
10869
|
checkOverlappingEntryOnly: false,
|
|
10708
10870
|
preventClose: false
|
|
10709
|
-
}));
|
|
10871
|
+
}), passwordState);
|
|
10710
10872
|
zipBlobReader.data = data;
|
|
10711
10873
|
zipBlobReader.blobReader = new BlobReader(data);
|
|
10712
10874
|
zipBlobReader.size = data.size;
|
|
@@ -10768,10 +10930,9 @@ async function initReaders(entry, options) {
|
|
|
10768
10930
|
await initStream(reader);
|
|
10769
10931
|
} catch (error) {
|
|
10770
10932
|
try {
|
|
10933
|
+
error.entry = child;
|
|
10771
10934
|
error.entryId = child.id;
|
|
10772
|
-
error.
|
|
10773
|
-
entry: child
|
|
10774
|
-
};
|
|
10935
|
+
error.entryName = child.getRelativeName(entry);
|
|
10775
10936
|
} catch {
|
|
10776
10937
|
// ignored
|
|
10777
10938
|
}
|
|
@@ -10863,10 +11024,145 @@ function checkReaderOptions(readerOptions) {
|
|
|
10863
11024
|
}
|
|
10864
11025
|
if (readerOptions) {
|
|
10865
11026
|
checkPassThroughValue(readerOptions.passThrough);
|
|
11027
|
+
checkPasswordCandidatesOptions(readerOptions);
|
|
10866
11028
|
}
|
|
10867
11029
|
return readerOptions;
|
|
10868
11030
|
}
|
|
10869
11031
|
|
|
11032
|
+
function checkPasswordCandidatesOptions(options) {
|
|
11033
|
+
const { passwords, requestPassword } = options;
|
|
11034
|
+
if (passwords && (!Array.isArray(passwords) || passwords.some(password => typeof password != STRING_TYPE))) {
|
|
11035
|
+
throw new Error(ERR_INVALID_PASSWORDS);
|
|
11036
|
+
}
|
|
11037
|
+
if (requestPassword && typeof requestPassword != FUNCTION_TYPE) {
|
|
11038
|
+
throw new Error(ERR_INVALID_REQUEST_PASSWORD);
|
|
11039
|
+
}
|
|
11040
|
+
}
|
|
11041
|
+
|
|
11042
|
+
async function readEntryData(entry, options, passwordState) {
|
|
11043
|
+
checkPasswordCandidatesOptions(options);
|
|
11044
|
+
const { passwords, requestPassword, signal } = options;
|
|
11045
|
+
options = Object.assign({}, options);
|
|
11046
|
+
delete options.passwords;
|
|
11047
|
+
delete options.requestPassword;
|
|
11048
|
+
if (!entry.encrypted || options.passThrough || (!passwords && !requestPassword)) {
|
|
11049
|
+
return entry.getData(new BlobWriter(), options);
|
|
11050
|
+
}
|
|
11051
|
+
const tried = new Set();
|
|
11052
|
+
let error;
|
|
11053
|
+
while (true) {
|
|
11054
|
+
for (const candidate of getPasswordCandidates(options, passwordState, passwords)) {
|
|
11055
|
+
if (!tried.has(candidate.key)) {
|
|
11056
|
+
const result = await tryPasswordCandidate(candidate);
|
|
11057
|
+
if (result.done) {
|
|
11058
|
+
return result.data;
|
|
11059
|
+
}
|
|
11060
|
+
error = result.error;
|
|
11061
|
+
}
|
|
11062
|
+
}
|
|
11063
|
+
if (!requestPassword) {
|
|
11064
|
+
break;
|
|
11065
|
+
}
|
|
11066
|
+
if (passwordState.pendingPrompt) {
|
|
11067
|
+
await passwordState.pendingPrompt;
|
|
11068
|
+
continue;
|
|
11069
|
+
}
|
|
11070
|
+
let release;
|
|
11071
|
+
passwordState.pendingPrompt = new Promise(resolve => release = resolve);
|
|
11072
|
+
try {
|
|
11073
|
+
const answer = await requestPassword(entry, error);
|
|
11074
|
+
if (answer === UNDEFINED_VALUE || answer === null) {
|
|
11075
|
+
break;
|
|
11076
|
+
}
|
|
11077
|
+
// deno-lint-ignore valid-typeof
|
|
11078
|
+
if (typeof answer != STRING_TYPE) {
|
|
11079
|
+
throw new Error(ERR_INVALID_REQUEST_PASSWORD);
|
|
11080
|
+
}
|
|
11081
|
+
const result = await tryPasswordCandidate(getPasswordCandidate(answer));
|
|
11082
|
+
if (result.done) {
|
|
11083
|
+
return result.data;
|
|
11084
|
+
}
|
|
11085
|
+
error = result.error;
|
|
11086
|
+
} finally {
|
|
11087
|
+
passwordState.pendingPrompt = UNDEFINED_VALUE;
|
|
11088
|
+
release();
|
|
11089
|
+
}
|
|
11090
|
+
}
|
|
11091
|
+
if (!tried.size) {
|
|
11092
|
+
throw new Error(ERR_ENCRYPTED);
|
|
11093
|
+
}
|
|
11094
|
+
const passwordError = new Error(ERR_INVALID_PASSWORD);
|
|
11095
|
+
passwordError.cause = error;
|
|
11096
|
+
throw passwordError;
|
|
11097
|
+
|
|
11098
|
+
async function tryPasswordCandidate(candidate) {
|
|
11099
|
+
tried.add(candidate.key);
|
|
11100
|
+
const candidateOptions = Object.assign({}, options, candidate.options);
|
|
11101
|
+
if (entry.zipCrypto) {
|
|
11102
|
+
candidateOptions.checkCrc32 = true;
|
|
11103
|
+
try {
|
|
11104
|
+
await entry.getData(null, Object.assign({}, candidateOptions, { checkPasswordOnly: true }));
|
|
11105
|
+
} catch (probeError) {
|
|
11106
|
+
if (isInvalidPasswordError(probeError)) {
|
|
11107
|
+
return { done: false, error: probeError };
|
|
11108
|
+
}
|
|
11109
|
+
throw probeError;
|
|
11110
|
+
}
|
|
11111
|
+
}
|
|
11112
|
+
try {
|
|
11113
|
+
const data = await entry.getData(new BlobWriter(), candidateOptions);
|
|
11114
|
+
rememberPassword(passwordState, candidate);
|
|
11115
|
+
return { done: true, data };
|
|
11116
|
+
} catch (readError) {
|
|
11117
|
+
if (isAbortError(readError, signal) || !isWrongPasswordError(readError, entry)) {
|
|
11118
|
+
throw readError;
|
|
11119
|
+
}
|
|
11120
|
+
return { done: false, error: readError };
|
|
11121
|
+
}
|
|
11122
|
+
}
|
|
11123
|
+
}
|
|
11124
|
+
|
|
11125
|
+
function isInvalidPasswordError(error) {
|
|
11126
|
+
return isErrorObject(error) && error.message == ERR_INVALID_PASSWORD;
|
|
11127
|
+
}
|
|
11128
|
+
|
|
11129
|
+
function isWrongPasswordError(error, entry) {
|
|
11130
|
+
return isInvalidPasswordError(error) || (entry.zipCrypto && isErrorObject(error) && FALSE_ACCEPT_ERRORS.has(error.message));
|
|
11131
|
+
}
|
|
11132
|
+
|
|
11133
|
+
function isAbortError(error, signal) {
|
|
11134
|
+
return Boolean(signal && signal.aborted) || (isErrorObject(error) && error.name == ABORT_ERROR_NAME);
|
|
11135
|
+
}
|
|
11136
|
+
|
|
11137
|
+
function getPasswordCandidates(options, passwordState, passwords) {
|
|
11138
|
+
const candidates = [];
|
|
11139
|
+
const { password, rawPassword } = options;
|
|
11140
|
+
if (rawPassword && rawPassword.length) {
|
|
11141
|
+
candidates.push({ key: rawPassword, options: { password: "", rawPassword } });
|
|
11142
|
+
}
|
|
11143
|
+
if (password) {
|
|
11144
|
+
candidates.push(getPasswordCandidate(password));
|
|
11145
|
+
}
|
|
11146
|
+
candidates.push(...passwordState.known);
|
|
11147
|
+
if (passwords) {
|
|
11148
|
+
candidates.push(...passwords.filter(password => password).map(getPasswordCandidate));
|
|
11149
|
+
}
|
|
11150
|
+
return candidates;
|
|
11151
|
+
}
|
|
11152
|
+
|
|
11153
|
+
function getPasswordCandidate(password) {
|
|
11154
|
+
return { key: password, options: { password, rawPassword: EMPTY_RAW_PASSWORD } };
|
|
11155
|
+
}
|
|
11156
|
+
|
|
11157
|
+
function rememberPassword(passwordState, candidate) {
|
|
11158
|
+
const { known } = passwordState;
|
|
11159
|
+
const index = known.findIndex(knownCandidate => knownCandidate.key === candidate.key);
|
|
11160
|
+
if (index != -1) {
|
|
11161
|
+
known.splice(index, 1);
|
|
11162
|
+
}
|
|
11163
|
+
known.unshift(candidate);
|
|
11164
|
+
}
|
|
11165
|
+
|
|
10870
11166
|
function checkPassThroughValue(passThrough) {
|
|
10871
11167
|
if (checkPassThroughOption(passThrough) === PASS_THROUGH_COMPRESSED) {
|
|
10872
11168
|
throw new Error(ERR_UNSUPPORTED_PASS_THROUGH_VALUE);
|
|
@@ -11004,6 +11300,7 @@ function addFileSystemHandle(zipEntry, handle, options) {
|
|
|
11004
11300
|
async function exportFileSystemHandle(zipEntry, directoryHandle, options) {
|
|
11005
11301
|
const { onstart, onprogress, onend } = options;
|
|
11006
11302
|
checkPassThroughValue(options.passThrough);
|
|
11303
|
+
checkPasswordCandidatesOptions(options);
|
|
11007
11304
|
const readerOptions = checkReaderOptions(options.readerOptions);
|
|
11008
11305
|
const abortController = new AbortController();
|
|
11009
11306
|
const { signal } = abortController;
|
|
@@ -11357,6 +11654,7 @@ exports.ERR_AMBIGUOUS_ARCHIVE = ERR_AMBIGUOUS_ARCHIVE;
|
|
|
11357
11654
|
exports.ERR_ANCESTOR_ENTRY = ERR_ANCESTOR_ENTRY;
|
|
11358
11655
|
exports.ERR_BAD_FORMAT = ERR_BAD_FORMAT;
|
|
11359
11656
|
exports.ERR_CENTRAL_DIRECTORY_NOT_FOUND = ERR_CENTRAL_DIRECTORY_NOT_FOUND;
|
|
11657
|
+
exports.ERR_CODEC_OUT_OF_MEMORY = ERR_CODEC_OUT_OF_MEMORY;
|
|
11360
11658
|
exports.ERR_DUPLICATED_NAME = ERR_DUPLICATED_NAME;
|
|
11361
11659
|
exports.ERR_DUPLICATE_IMPORTED_ENTRY = ERR_DUPLICATE_IMPORTED_ENTRY;
|
|
11362
11660
|
exports.ERR_ENCRYPTED = ERR_ENCRYPTED;
|
|
@@ -11397,11 +11695,13 @@ exports.ERR_INVALID_MAX_WORKERS = ERR_INVALID_MAX_WORKERS;
|
|
|
11397
11695
|
exports.ERR_INVALID_MSDOS_ATTRIBUTES = ERR_INVALID_MSDOS_ATTRIBUTES;
|
|
11398
11696
|
exports.ERR_INVALID_MSDOS_DATA = ERR_INVALID_MSDOS_DATA;
|
|
11399
11697
|
exports.ERR_INVALID_PASSWORD = ERR_INVALID_PASSWORD;
|
|
11698
|
+
exports.ERR_INVALID_PASSWORDS = ERR_INVALID_PASSWORDS;
|
|
11400
11699
|
exports.ERR_INVALID_PASSWORD_TYPE = ERR_INVALID_PASSWORD_TYPE;
|
|
11401
11700
|
exports.ERR_INVALID_PASS_THROUGH = ERR_INVALID_PASS_THROUGH;
|
|
11402
11701
|
exports.ERR_INVALID_PASS_THROUGH_VALUE = ERR_INVALID_PASS_THROUGH_VALUE;
|
|
11403
11702
|
exports.ERR_INVALID_READER = ERR_INVALID_READER;
|
|
11404
11703
|
exports.ERR_INVALID_READER_OPTIONS = ERR_INVALID_READER_OPTIONS;
|
|
11704
|
+
exports.ERR_INVALID_REQUEST_PASSWORD = ERR_INVALID_REQUEST_PASSWORD;
|
|
11405
11705
|
exports.ERR_INVALID_SIGNAL = ERR_INVALID_SIGNAL;
|
|
11406
11706
|
exports.ERR_INVALID_SIGNATURE_DATA = ERR_INVALID_SIGNATURE_DATA;
|
|
11407
11707
|
exports.ERR_INVALID_STRICTNESS = ERR_INVALID_STRICTNESS;
|