@zip.js/zip.js 2.11.3 → 2.12.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 +444 -114
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +454 -111
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +509 -236
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +522 -233
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +509 -236
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +524 -235
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +525 -236
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +456 -113
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +456 -113
- 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 +457 -114
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +524 -235
- package/index-native.min.js +1 -1
- package/index.cjs +525 -236
- package/index.d.cts +480 -59
- package/index.d.ts +480 -59
- package/index.min.js +1 -1
- package/lib/core/codec-worker-web.js +10 -2
- package/lib/core/codec-worker.js +4 -3
- package/lib/core/configuration.js +20 -5
- package/lib/core/constants.js +2 -0
- package/lib/core/io.js +20 -10
- package/lib/core/options.js +29 -0
- package/lib/core/streams/codec-stream.js +6 -0
- package/lib/core/util/warnings.js +42 -0
- package/lib/core/version.js +1 -1
- package/lib/core/web-worker-base.js +4 -3
- package/lib/core/web-worker-inline-native.js +1 -1
- package/lib/core/web-worker-inline-wasm.js +1 -1
- package/lib/core/zip-entry.js +49 -1
- package/lib/core/zip-fs.js +43 -134
- package/lib/core/zip-reader.js +108 -47
- package/lib/core/zip-writer.js +238 -54
- package/lib/zip-core-base.js +9 -3
- package/lib/zip-core-reader.js +2 -0
- package/lib/zip-core-writer.js +6 -1
- package/lib/zip-module-wasm-base.js +2 -2
- package/package.json +5 -3
package/index.cjs
CHANGED
|
@@ -128,6 +128,7 @@ const NUMBER_TYPE = "number";
|
|
|
128
128
|
const BOOLEAN_TYPE = "boolean";
|
|
129
129
|
|
|
130
130
|
const EMPTY_UINT8_ARRAY = new Uint8Array();
|
|
131
|
+
const SYMBOL_ASYNC_DISPOSE = Symbol.asyncDispose || Symbol();
|
|
131
132
|
|
|
132
133
|
/*
|
|
133
134
|
Copyright (c) 2022 Gildas Lormeau. All rights reserved.
|
|
@@ -172,6 +173,7 @@ const OPTION_CHECK_OVERLAPPING_ENTRY_ONLY = "checkOverlappingEntryOnly";
|
|
|
172
173
|
const OPTION_CHECK_OVERLAPPING_ENTRY = "checkOverlappingEntry";
|
|
173
174
|
const OPTION_CHECK_AMBIGUITY = "checkAmbiguity";
|
|
174
175
|
const OPTION_CHECK_LOCAL_DIRECTORY = "checkLocalDirectory";
|
|
176
|
+
const OPTION_CHECK_LOCAL_FILENAME = "checkLocalFilename";
|
|
175
177
|
const OPTION_CHECK_SIGNATURE = "checkSignature";
|
|
176
178
|
const OPTION_CHECK_CRC32 = "checkCrc32";
|
|
177
179
|
const OPTION_CHECK_AUTHENTICATION_CODE = "checkAuthenticationCode";
|
|
@@ -202,15 +204,20 @@ const OPTION_NORMALIZE_FILENAME = "normalizeFilename";
|
|
|
202
204
|
const OPTION_MAX_APPENDED_DATA_SIZE = "maxAppendedDataSize";
|
|
203
205
|
const OPTION_DECRYPT_CENTRAL_DIRECTORY = "decryptCentralDirectory";
|
|
204
206
|
const OPTION_SIGN_CENTRAL_DIRECTORY = "signCentralDirectory";
|
|
207
|
+
const OPTION_ENTRY = "entry";
|
|
205
208
|
const TEXT_TYPE_FILENAME = "filename";
|
|
206
209
|
const TEXT_TYPE_COMMENT = "comment";
|
|
207
210
|
const STRICTNESS_STRICT = "strict";
|
|
208
211
|
const STRICTNESS_BALANCED = "balanced";
|
|
209
212
|
const STRICTNESS_TOLERANT = "tolerant";
|
|
213
|
+
const PASS_THROUGH_COMPRESSED = "compressed";
|
|
210
214
|
|
|
211
215
|
const ERR_INVALID_FUNCTION_OPTION = "Invalid option (must be a function)";
|
|
212
216
|
const ERR_INVALID_SIGNAL = "Invalid signal (must be an AbortSignal instance)";
|
|
213
217
|
const ERR_INVALID_PASSWORD_TYPE = "Invalid password (password must be a string, rawPassword must be a Uint8Array)";
|
|
218
|
+
const ERR_INVALID_PASS_THROUGH_VALUE = "Invalid passThrough option (must be a boolean or 'compressed')";
|
|
219
|
+
const ERR_ABORTED = "The operation was aborted";
|
|
220
|
+
const ABORT_ERROR_NAME = "AbortError";
|
|
214
221
|
|
|
215
222
|
function checkFunctionOption(value) {
|
|
216
223
|
if (value && typeof value != FUNCTION_TYPE) {
|
|
@@ -226,12 +233,25 @@ function checkSignalOption(signal) {
|
|
|
226
233
|
return signal || UNDEFINED_VALUE;
|
|
227
234
|
}
|
|
228
235
|
|
|
236
|
+
function throwIfAborted(signal) {
|
|
237
|
+
if (signal && signal.aborted) {
|
|
238
|
+
throw signal.reason === UNDEFINED_VALUE ? new DOMException(ERR_ABORTED, ABORT_ERROR_NAME) : signal.reason;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
229
242
|
function checkPasswordOption(password, rawPassword) {
|
|
230
243
|
if ((password && typeof password != STRING_TYPE) || (rawPassword && !(rawPassword instanceof Uint8Array))) {
|
|
231
244
|
throw new Error(ERR_INVALID_PASSWORD_TYPE);
|
|
232
245
|
}
|
|
233
246
|
}
|
|
234
247
|
|
|
248
|
+
function checkPassThroughOption(passThrough) {
|
|
249
|
+
if (passThrough !== UNDEFINED_VALUE && typeof passThrough != BOOLEAN_TYPE && passThrough !== PASS_THROUGH_COMPRESSED) {
|
|
250
|
+
throw new Error(ERR_INVALID_PASS_THROUGH_VALUE);
|
|
251
|
+
}
|
|
252
|
+
return passThrough;
|
|
253
|
+
}
|
|
254
|
+
|
|
235
255
|
function checkInteger(value, maxValue, errorMessage) {
|
|
236
256
|
if (!Number.isInteger(value) || value < 0 || value > maxValue) {
|
|
237
257
|
throw new Error(errorMessage);
|
|
@@ -281,6 +301,8 @@ const DEFAULT_CHUNK_SIZE$1 = 64 * 1024;
|
|
|
281
301
|
const MINIMUM_CHUNK_SIZE = 64;
|
|
282
302
|
const MINIMUM_PROPERTY_VALUE = 1;
|
|
283
303
|
const ERR_INVALID_MAX_WORKERS = "Invalid maxWorkers (must be an integer greater than 0)";
|
|
304
|
+
const ERR_INVALID_BASE_URI = "Invalid baseURI (must be a string)";
|
|
305
|
+
const ERR_INVALID_URI = "Invalid URI (must be a string or a function returning a string)";
|
|
284
306
|
let maxWorkers = 2;
|
|
285
307
|
try {
|
|
286
308
|
if (typeof navigator != UNDEFINED_TYPE && navigator.hardwareConcurrency) {
|
|
@@ -305,9 +327,9 @@ const DEFAULT_CONFIGURATION = {
|
|
|
305
327
|
};
|
|
306
328
|
|
|
307
329
|
const PROPERTY_NAME_MAX_WORKERS = "maxWorkers";
|
|
330
|
+
const PROPERTY_NAME_BASE_URI = "baseURI";
|
|
308
331
|
|
|
309
|
-
const
|
|
310
|
-
"baseURI",
|
|
332
|
+
const URI_PROPERTY_NAMES = [
|
|
311
333
|
"wasmURI",
|
|
312
334
|
"workerURI"
|
|
313
335
|
];
|
|
@@ -331,7 +353,8 @@ const FUNCTION_PROPERTY_NAMES = [
|
|
|
331
353
|
"DecompressionStreamFallback"
|
|
332
354
|
];
|
|
333
355
|
const CONFIGURABLE_PROPERTY_NAMES = [
|
|
334
|
-
|
|
356
|
+
PROPERTY_NAME_BASE_URI,
|
|
357
|
+
...URI_PROPERTY_NAMES,
|
|
335
358
|
...BOOLEAN_PROPERTY_NAMES,
|
|
336
359
|
...NUMBER_PROPERTY_NAMES,
|
|
337
360
|
...FUNCTION_PROPERTY_NAMES
|
|
@@ -375,6 +398,14 @@ function checkPropertyValue(propertyName, propertyValue) {
|
|
|
375
398
|
}
|
|
376
399
|
} else if (FUNCTION_PROPERTY_NAMES.includes(propertyName)) {
|
|
377
400
|
checkFunctionOption(propertyValue);
|
|
401
|
+
} else if (propertyName == PROPERTY_NAME_BASE_URI) {
|
|
402
|
+
if (propertyValue && typeof propertyValue != STRING_TYPE) {
|
|
403
|
+
throw new Error(ERR_INVALID_BASE_URI);
|
|
404
|
+
}
|
|
405
|
+
} else if (URI_PROPERTY_NAMES.includes(propertyName)) {
|
|
406
|
+
if (propertyValue && typeof propertyValue != STRING_TYPE && typeof propertyValue != FUNCTION_TYPE) {
|
|
407
|
+
throw new Error(ERR_INVALID_URI);
|
|
408
|
+
}
|
|
378
409
|
}
|
|
379
410
|
return propertyValue;
|
|
380
411
|
}
|
|
@@ -408,7 +439,7 @@ function resetConfiguration() {
|
|
|
408
439
|
Object.assign(config, DEFAULT_CONFIGURATION);
|
|
409
440
|
}
|
|
410
441
|
|
|
411
|
-
const t$1=new Uint8Array(288);t$1.fill(8,0,144),t$1.fill(9,144,256),t$1.fill(7,256,280),t$1.fill(8,280,288),new Uint8Array(30).fill(5);const e$1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n$1=t=>t({workerURI:t=>{const n="text/javascript";let s='!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";const{Array:t,Object:n,Number:e,Math:s,Error:r,Uint8Array:o,Uint16Array:c,Uint32Array:i,Int32Array:a,Map:f,DataView:u,Promise:l,TextEncoder:w,crypto:h,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:S,DecompressionStream:g}=self,v=void 0,b="undefined",k="function",z=new o,C=[[],[],[],[],[],[],[],[]];for(let t=0;t<256;t++){let n=t;for(let t=0;t<8;t++)n=1&n?n>>>1^3988292384:n>>>1;C[0][t]=n}for(let t=0;t<256;t++)for(let n=1;n<8;n++){const e=C[n-1][t];C[n][t]=e>>>8^C[0][255&e]}const[I,A,x,M,P,B,D,F]=C;class R{constructor(t){this.o=t||-1}append(t){let n=0|this.o;const e=0|t.length;let s=0;if(e>=8&&t.buffer){const r=new u(t.buffer,t.byteOffset,e),o=e-8;for(;s<=o;s+=8){const t=n^r.getInt32(s,!0),e=r.getInt32(s+4,!0);n=F[255&t]^D[t>>>8&255]^B[t>>>16&255]^P[t>>>24&255]^M[255&e]^x[e>>>8&255]^A[e>>>16&255]^I[e>>>24&255]}}for(;s<e;s++)n=n>>>8^I[255&(n^t[s])];this.o=n}get(){return~this.o}}class U extends d{constructor(){let t;const n=new R;super({transform(t,e){n.append(t),e.enqueue(t)},flush(){const e=new o(4);new u(e.buffer).setUint32(0,n.get()),t.value=e}}),t=this}}function W(t,n){const e=new o(t.length+n.length);return e.set(t),e.set(n,t.length),e}function _(t){return new u(t.buffer,t.byteOffset,t.byteLength)}const T={concat(t,n){if(0===t.length||0===n.length)return t.concat(n);const e=t[t.length-1],s=T.l(e);return 32===s?t.concat(n):T.h(n,s,0|e,t.slice(0,t.length-1))},bitLength(t){const n=t.length;if(0===n)return 0;const e=t[n-1];return 32*(n-1)+T.l(e)},m(t,n){if(32*t.length<n)return t;const e=(t=t.slice(0,s.ceil(n/32))).length;return n&=31,e>0&&n&&(t[e-1]=T.S(n,t[e-1]&2147483648>>n-1,1)),t},S:(t,n,e)=>32===t?n:(e?0|n:n<<32-t)+1099511627776*t,l:t=>s.round(t/1099511627776)||32,h(t,n,e,s){for(void 0===s&&(s=[]);n>=32;n-=32)s.push(e),e=0;if(0===n)return s.concat(t);for(let r=0;r<t.length;r++)s.push(e|t[r]>>>n),e=t[r]<<32-n;const r=t.length?t[t.length-1]:0,o=T.l(r);return s.push(T.S(n+o&31,n+o>32?e:s.pop(),1)),s}},V={bytes:{v(t){const n=T.bitLength(t)/8,e=new o(n);let s;for(let r=0;r<n;r++)3&r||(s=t[r/4]),e[r]=s>>>24,s<<=8;return e},C(t){const n=[];let e,s=0;for(e=0;e<t.length;e++)s=s<<8|t[e],3&~e||(n.push(s),s=0);return 3&e&&n.push(T.S(8*(3&e),s)),n}}},K=class{constructor(t){const n=this;n.blockSize=512,n.I=[1732584193,4023233417,2562383102,271733878,3285377520],n.A=[1518500249,1859775393,2400959708,3395469782],t?(n.M=t.M.slice(0),n.P=t.P.slice(0),n.B=t.B):n.reset()}reset(){const t=this;return t.M=t.I.slice(0),t.P=[],t.B=0,t}update(t){const n=this;"string"==typeof t&&(t=V.D.C(t));const e=n.P=T.concat(n.P,t),s=n.B,o=n.B=s+T.bitLength(t);if(o>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const c=new i(e);let a=0;for(let t=n.blockSize+s-(n.blockSize+s&n.blockSize-1);t<=o;t+=n.blockSize)n.F(c.subarray(16*a,16*(a+1))),a+=1;return e.splice(0,16*a),n}R(){const t=this;let n=t.P;const e=t.M;n=T.concat(n,[T.S(1,1)]);for(let t=n.length+2;15&t;t++)n.push(0);for(n.push(s.floor(t.B/4294967296)),n.push(0|t.B);n.length;)t.F(n.splice(0,16));return t.reset(),e}U(t,n,e,s){return t<=19?n&e|~n&s:t<=39?n^e^s:t<=59?n&e|n&s|e&s:t<=79?n^e^s:void 0}W(t,n){return n<<t|n>>>32-t}F(n){const e=this,r=e.M,o=t(80);for(let t=0;t<16;t++)o[t]=n[t];let c=r[0],i=r[1],a=r[2],f=r[3],u=r[4];for(let t=0;t<=79;t++){t>=16&&(o[t]=e.W(1,o[t-3]^o[t-8]^o[t-14]^o[t-16]));const n=e.W(5,c)+e.U(t,i,a,f)+u+o[t]+e.A[s.floor(t/20)]|0;u=f,f=a,a=e.W(30,i),i=c,c=n}r[0]=r[0]+c|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+f|0,r[4]=r[4]+u|0}},E={importKey:t=>new E._(V.bytes.C(t)),T(t,n,e,s){if(e=e||1e4,s<0||e<0)throw new r("invalid params to pbkdf2");const o=1+(s>>5)<<2;let c,i,a,f,l;const w=new ArrayBuffer(o),h=new u(w);let p=0;const d=T;for(n=V.bytes.C(n),l=1;p<(o||1);l++){for(c=i=t.encrypt(d.concat(n,[l])),a=1;a<e;a++)for(i=t.encrypt(i),f=0;f<i.length;f++)c[f]^=i[f];for(a=0;p<(o||1)&&a<c.length;a++)h.setInt32(p,c[a]),p+=4}return w.slice(0,s/8)},_:class{constructor(t){const n=this,e=n.V=K,s=[[],[]];n.K=[new e,new e];const r=n.K[0].blockSize/32;t.length>r&&(t=(new e).update(t).R());for(let n=0;n<r;n++)s[0][n]=909522486^t[n],s[1][n]=1549556828^t[n];n.K[0].update(s[0]),n.K[1].update(s[1]),n.L=new e(n.K[0])}reset(){const t=this;t.L=new t.V(t.K[0]),t.O=!1}update(t){this.O=!0,this.L.update(t)}digest(){const t=this,n=t.L.R(),e=new t.V(t.K[1]).update(n).R();return t.reset(),e}encrypt(t){if(this.O)throw new r("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},L=typeof h!=b&&typeof h.getRandomValues==k,O="Invalid password",j="zipjs-abort-check-password";function H(t){if(L)return h.getRandomValues(t);throw new r("Crypto API not supported")}const N=16,q={name:"PBKDF2"},G=n.assign({hash:{name:"HMAC"}},q),J=n.assign({iterations:1e3,hash:{name:"SHA-1"}},q),Q=["deriveBits"],X=[8,12,16],Y=[16,24,32],Z=10,$=[0,0,0,0],tt=typeof h!=b,nt=tt&&h.subtle,et=tt&&typeof nt!=b,st=V.bytes,rt=class{constructor(t){const n=this;n.j=[[[],[],[],[],[]],[[],[],[],[],[]]],n.j[0][0][0]||n.H();const e=n.j[0][4],s=n.j[1],o=t.length;let c,i,a,f=1;if(4!==o&&6!==o&&8!==o)throw new r("invalid aes key size");for(n.A=[i=t.slice(0),a=[]],c=o;c<4*o+28;c++){let t=i[c-1];(c%o===0||8===o&&c%o===4)&&(t=e[t>>>24]<<24^e[t>>16&255]<<16^e[t>>8&255]<<8^e[255&t],c%o===0&&(t=t<<8^t>>>24^f<<24,f=f<<1^283*(f>>7))),i[c]=i[c-o]^t}for(let t=0;c;t++,c--){const n=i[3&t?c:c-4];a[t]=c<=4||t<4?n:s[0][e[n>>>24]]^s[1][e[n>>16&255]]^s[2][e[n>>8&255]]^s[3][e[255&n]]}}encrypt(t){return this.N(t,0)}decrypt(t){return this.N(t,1)}H(){const t=this.j[0],n=this.j[1],e=t[4],s=n[4],r=[],o=[];let c,i,a,f;for(let t=0;t<256;t++)o[(r[t]=t<<1^283*(t>>7))^t]=t;for(let u=c=0;!e[u];u^=i||1,c=o[c]||1){let o=c^c<<1^c<<2^c<<3^c<<4;o=o>>8^255&o^99,e[u]=o,s[o]=u,f=r[a=r[i=r[u]]];let l=16843009*f^65537*a^257*i^16843008*u,w=257*r[o]^16843008*o;for(let e=0;e<4;e++)t[e][u]=w=w<<24^w>>>8,n[e][o]=l=l<<24^l>>>8}for(let e=0;e<5;e++)t[e]=t[e].slice(0),n[e]=n[e].slice(0)}N(t,n){if(4!==t.length)throw new r("invalid aes block size");const e=this.A[n],s=e.length/4-2,o=[0,0,0,0],c=this.j[n],i=c[0],a=c[1],f=c[2],u=c[3],l=c[4];let w,h,p,d=t[0]^e[0],y=t[n?3:1]^e[1],m=t[2]^e[2],S=t[n?1:3]^e[3],g=4;for(let t=0;t<s;t++)w=i[d>>>24]^a[y>>16&255]^f[m>>8&255]^u[255&S]^e[g],h=i[y>>>24]^a[m>>16&255]^f[S>>8&255]^u[255&d]^e[g+1],p=i[m>>>24]^a[S>>16&255]^f[d>>8&255]^u[255&y]^e[g+2],S=i[S>>>24]^a[d>>16&255]^f[y>>8&255]^u[255&m]^e[g+3],g+=4,d=w,y=h,m=p;for(let t=0;t<4;t++)o[n?3&-t:t]=l[d>>>24]<<24^l[y>>16&255]<<16^l[m>>8&255]<<8^l[255&S]^e[g++],w=d,d=y,y=m,m=S,S=w;return o}},ot=class{constructor(t,n){this.G=t,this.J=n,this.X=n}reset(){this.X=this.J}update(t){return this.Y(this.G,t,this.X)}Z(t){if(255&~(t>>24))t+=1<<24;else{let n=t>>16&255,e=t>>8&255,s=255&t;255===n?(n=0,255===e?(e=0,255===s?s=0:++s):++e):++n,t=0,t+=n<<16,t+=e<<8,t+=s}return t}$(t){0===(t[0]=this.Z(t[0]))&&(t[1]=this.Z(t[1]))}Y(t,n,e){let s;if(!(s=n.length))return[];const r=T.bitLength(n);for(let r=0;r<s;r+=4){this.$(e);const s=t.encrypt(e);n[r]^=s[0],n[r+1]^=s[1],n[r+2]^=s[2],n[r+3]^=s[3]}return T.m(n,r)}},ct=E._;let it=tt&&et&&typeof nt.importKey==k,at=tt&&et&&typeof nt.deriveBits==k;class ft extends d{constructor({password:t,rawPassword:n,encryptionStrength:e,checkPasswordOnly:s,checkAuthenticationCode:c=!0}){super({start(){lt(this,t,n,e)},async transform(t,n){const e=this,{password:c,strength:i,nt:a,ready:f}=e;c?(await async function(t,n,e,s){const o=await ht(t,n,e,dt(s,0,X[n])),c=dt(s,X[n]);if(o[0]!=c[0]||o[1]!=c[1])throw new r(O)}(e,i,c,dt(t,0,X[i]+2)),t=dt(t,X[i]+2),s?n.error(new r(j)):a()):await f;const u=new o(t.length-Z-(t.length-Z)%N);n.enqueue(wt(e,t,u,0,Z,!0))},async flush(t){const{et:n,st:e,ot:s,ready:o}=this;if(e&&n){await o;const i=dt(s,0,s.length-Z),a=dt(s,s.length-Z);let f=z;if(i.length){const t=mt(st,i);e.update(t);const s=n.update(t);f=yt(st,s)}const u=dt(yt(st,e.digest()),0,Z);let l=s.length<Z?1:0;for(let t=0;t<Z;t++)l|=u[t]^a[t];if(l&&c)throw new r("Invalid authentication code");t.enqueue(f)}}})}}class ut extends d{constructor({password:t,rawPassword:n,encryptionStrength:e}){super({start(){lt(this,t,n,e)},async transform(t,n){const e=this,{password:s,strength:r,nt:c,ready:i}=e;let a=z;s?(a=await async function(t,n,e){const s=H(new o(X[n]));return W(s,await ht(t,n,e,s))}(e,r,s),c()):await i;const f=new o(a.length+t.length-t.length%N);f.set(a,0),n.enqueue(wt(e,t,f,a.length,0))},async flush(t){const{et:n,st:e,ot:s,ready:r}=this;if(e&&n){await r;let o=z;if(s.length){const t=n.update(mt(st,s));e.update(t),o=yt(st,t)}const c=yt(st,e.digest()).slice(0,Z);t.enqueue(W(o,c))}}})}}function lt(t,e,s,r){n.assign(t,{ready:new l(n=>t.nt=n),password:pt(e,s),strength:r-1,ot:z})}function wt(t,n,e,s,r,c){const{et:i,st:a,ot:f}=t;f.length&&(n=W(f,n));const u=n.length-r;let l;for(e=function(t,n){if(n&&n>t.length){const e=t;(t=new o(n)).set(e,0)}return t}(e,s+(u-u%N)),l=0;l<=u-N;l+=N){const t=mt(st,dt(n,l,l+N));c&&a.update(t);const r=i.update(t);c||a.update(r),e.set(yt(st,r),l+s)}return t.ot=dt(n,l),e}async function ht(e,s,r,c){e.password=null;const i=await async function(t,n,e,s,r){if(!it)return E.importKey(n);try{return await nt.importKey("raw",n,e,!1,r)}catch{return it=!1,E.importKey(n)}}(0,r,G,0,Q),a=await async function(t,n,e){if(!at)return E.T(n,t.salt,J.iterations,e);try{return await nt.deriveBits(t,n,e)}catch{return at=!1,E.T(n,t.salt,J.iterations,e)}}(n.assign({salt:c},J),i,8*(2*Y[s]+2)),f=new o(a),u=mt(st,dt(f,0,Y[s])),l=mt(st,dt(f,Y[s],2*Y[s])),w=dt(f,2*Y[s]);return n.assign(e,{keys:{key:u,ct:l,passwordVerification:w},et:new ot(new rt(u),t.from($)),st:new ct(l)}),w}function pt(t,n){return n===v?function(t){if(typeof w==b){t=unescape(encodeURIComponent(t));const n=new o(t.length);for(let e=0;e<n.length;e++)n[e]=t.charCodeAt(e);return n}return(new w).encode(t)}(t):n}function dt(t,n,e){return t.subarray(n,e)}function yt(t,n){return t.v(n)}function mt(t,n){return t.C(n)}class St extends d{constructor({password:t,rawPassword:n,passwordVerification:e,checkPasswordOnly:s}){super({start(){vt(this,t,n,e)},transform(t,n){const e=this;if(e.password||e.rawPassword){const n=bt(e,t.subarray(0,12));if(e.password=e.rawPassword=null,0!=(n[11]^e.passwordVerification))throw new r(O);t=t.subarray(12)}s?n.error(new r(j)):n.enqueue(bt(e,t))}})}}class gt extends d{constructor({password:t,rawPassword:n,passwordVerification:e}){super({start(){vt(this,t,n,e)},transform(t,n){const e=this;let s,r;if(e.password||e.rawPassword){e.password=e.rawPassword=null;const n=H(new o(12));n[11]=e.passwordVerification,s=new o(t.length+n.length),s.set(kt(e,n),0),r=12}else s=new o(t.length),r=0;s.set(kt(e,t),r),n.enqueue(s)}})}}function vt(t,e,s,r){n.assign(t,{password:e,rawPassword:s,passwordVerification:r}),function(t,e,s){const r=[305419896,591751049,878082192];if(n.assign(t,{keys:r,it:new R(r[0]),ft:new R(r[2])}),s)for(let n=0;n<s.length;n++)zt(t,s[n]);else for(let n=0;n<e.length;n++)zt(t,e.charCodeAt(n))}(t,e,s)}function bt(t,n){const e=new o(n.length);for(let s=0;s<n.length;s++)e[s]=Ct(t)^n[s],zt(t,e[s]);return e}function kt(t,n){const e=new o(n.length);for(let s=0;s<n.length;s++)e[s]=Ct(t)^n[s],zt(t,n[s]);return e}function zt(t,n){let[,e]=t.keys;t.it.append([n]);const r=~t.it.get();e=At(s.imul(At(e+It(r)),134775813)+1),t.ft.append([e>>>24]);const o=~t.ft.get();t.keys=[r,e,o]}function Ct(t){const n=2|t.keys[2];return It(s.imul(n,1^n)>>>8)}function It(t){return 255&t}function At(t){return 4294967295&t}function xt(t){if(t instanceof y)return t;const n=t.getReader();return new y({async pull(t){const{value:e,done:s}=await n.read();s?t.close():t.enqueue(e)},cancel:t=>n.cancel(t)})}const Mt=new f;function Pt(t){return Mt.get(t)}const Bt="Invalid uncompressed size",Dt="deflate-raw",Ft="gzip",Rt=[31,139,8];class Ut extends d{constructor(t,{chunkSize:n,CompressionStreamFallback:e,CompressionStream:s}){super({});const{compressed:r,encrypted:o,useCompressionStream:c,zipCrypto:i,computeCrc32:a,level:f,deflate64:l,format:w,compressionMethod:h,inputSize:p}=t,d=this;let y,m,S,g=super.readable;const v=w&&Pt(w),b=a&&r&&!l&&!v&&(!o||i)&&Boolean(c&&s);if(o&&!i||!a||b||(y=new U,g=Lt(g,y)),r)if(v)g=Ot(g,Kt(v.CompressionStream,w,{level:f,chunkSize:n,compressionMethod:h,uncompressedSize:p}));else if(b)S=new Wt,g=Ot(g,new s(Ft)),g=Lt(g,S);else try{g=Et(g,c,{level:f,chunkSize:n},s,e)}catch(t){let n;try{n=new s(Ft)}catch{throw t}g=Ot(g,n),g=Lt(g,new Wt)}o&&(i?g=Lt(g,new gt(t)):(m=new ut(t),g=Lt(g,m))),Vt(d,g,()=>{o&&!i||!a||(d.crc32=b?S.crc32:new u(y.value.buffer).getUint32(0))})}}class Wt extends d{constructor(){let t,n=10,e=new o(0);super({transform(t,r){if(n){const e=s.min(n,t.length);if(n-=e,!(t=t.subarray(e)).length)return}const o=e.length+t.length;if(o<=8)return void(e=W(e,t));const c=o-8,i=s.min(c,e.length);r.enqueue(W(e.subarray(0,i),t.subarray(0,c-i))),e=W(e.subarray(i),t.subarray(c-i))},flush(){const n=_(e);t.crc32=n.getUint32(0,!0),t.uncompressedSize=n.getUint32(4,!0)}}),t=this}}class _t extends d{constructor(t,{chunkSize:n,DecompressionStreamFallback:e,DecompressionStream:s}){super({});const{zipCrypto:c,encrypted:i,checkCrc32:a,crc32:f,compressed:w,useCompressionStream:h,deflate64:p,format:m,compressionMethod:S,rawBitFlag:g,outputSize:b}=t;let k,z,C=super.readable;if(i&&(c?C=Lt(C,new St(t)):(z=new ft(t),C=Lt(C,z))),w){const t=m&&Pt(m);if(t)C=Ot(C,Kt(t.DecompressionStream,m,{chunkSize:n,compressionMethod:S,rawBitFlag:g,uncompressedSize:b}));else try{C=Et(C,h,{chunkSize:n,deflate64:p},s,e)}catch(t){if(p||b===v)throw t;let n;try{n=new s(Ft)}catch{throw t}C=function(t,n,e){const s=new R;let c,i,a,f=0,u=!1;const w=new l((t,n)=>{i=t,a=n});w.catch(()=>{}),e||i();const h=new d({start(t){const n=new o(10);n.set(Rt),t.enqueue(n)},transform(t,n){n.enqueue(t)},async flush(t){u=!0,y();try{await w}finally{m()}const n=new o(8),r=_(n);r.setUint32(0,s.get(),!0),r.setUint32(4,e,!0),t.enqueue(n)},cancel(t){a(t)}}),p=new d({transform(t,n){s.append(t),f+=t.length,f>=e?i():u&&y(),n.enqueue(t)},cancel(t){a(t)}});return t=Lt(t,h),Lt(t=Ot(t,n),p);function y(){m(),c=setTimeout(()=>a(new r(Bt)),5e3)}function m(){clearTimeout(c)}}(C,n,b)}C=function(t){const n=t.getReader();return new y({async pull(t){let e;try{e=await n.read()}catch(t){if(t&&t.message)throw t;const n=new r("Invalid compressed data");throw n.cause=t,n}const{value:s,done:o}=e;o?t.close():t.enqueue(s)},cancel:t=>n.cancel(t)})}(C)}a&&(k=new U,C=Lt(C,k)),Vt(this,C,()=>{if(a){const t=new u(k.value.buffer);if(f!=t.getUint32(0,!1))throw new r("Invalid CRC32")}})}}const Tt=new f;function Vt(t,e,s){e=Lt(e,new d({flush:s})),n.defineProperty(t,"readable",{get:()=>e})}function Kt(t,n,e){if(!t)throw new r("Compression method not supported");return new t(n,e)}function Et(t,n,e,s,r){const o=n&&s?s:r||s,c=e.deflate64?"deflate64-raw":Dt;let i;try{i=new o(c,e)}catch(t){if(!n||!r||o==r)throw t;i=new r(c,e)}return Ot(t,i)}function Lt(t,n){return xt(t).pipeThrough(n)}function Ot(t,n){const e=n.writable.getWriter(),s=t.getReader();return async function(){try{for(;;){await e.ready;const t=await s.read();if(t.done){await e.close();break}await e.write(t.value)}}catch(t){await async function(t,n){try{await t.abort(n)}catch{}}(e,t),await async function(t,n){try{await t.cancel(n)}catch{}}(s,t)}}(),n.readable}const jt="data",Ht="close",Nt="deflate";class qt extends d{constructor(t,e){super({});const s=this,{codecType:o}=t;let c;o.startsWith(Nt)?c=Ut:o.startsWith("inflate")&&(c=_t),s.outputSize=0;let i=0;const a=new c(t,e),f=super.readable,u=new d({transform(t,n){t&&t.length&&(i+=t.length,n.enqueue(t))},flush(){n.assign(s,{inputSize:i})}}),l=new d({transform(n,e){if(n&&n.length&&(e.enqueue(n),s.outputSize+=n.length,t.outputSize!==v&&s.outputSize>t.outputSize))throw new r(Bt)},flush(){const{crc32:t}=a;n.assign(s,{crc32:t,inputSize:i})}});n.defineProperty(s,"readable",{get:()=>f.pipeThrough(u).pipeThrough(a).pipeThrough(l)})}}class Gt extends d{constructor(t){const n=[];let s=0;function r(){const e=new o(t);let r=0;for(;r<t;){const s=n[0],o=t-r;s.length<=o?(e.set(s,r),r+=s.length,n.shift()):(e.set(s.subarray(0,o),r),n[0]=s.subarray(o),r+=o)}return s-=t,e}(!e.isFinite(t)||t<1)&&(t=65536),super({transform(e,o){for(n.push(e),s+=e.length;s>t;)o.enqueue(r())},flush(t){s&&t.enqueue(function(t,n){const e=new o(n);let s=0;for(const n of t)e.set(n,s),s+=n.length;return e}(n,s))}})}}let Jt=2;try{typeof navigator!=b&&navigator.hardwareConcurrency&&(Jt=navigator.hardwareConcurrency)}catch{}const Qt=new f,Xt=new f;let Yt,Zt=0;async function $t(t){let n,o;try{const{options:c,config:i}=t;if(c.format)try{await async function(t,n){!Mt.has(t)&&n&&function(t,n){const{CompressionStream:e,DecompressionStream:s}=n;if(typeof e!=k&&typeof s!=k)throw new r("Invalid codec module");Mt.set(t,{CompressionStream:e,DecompressionStream:s})}(t,await(import(n)))}(c.format,c.codecURI)}catch(t){throw t.codecImportFailed=!0,t}if(i.CompressionStream=self.CompressionStream,i.DecompressionStream=self.DecompressionStream,c.compressed&&!c.format)if(c.useCompressionStream){if(!function(t,n){if(!t)return!1;let e=Tt.get(t);e||(e=new f,Tt.set(t,e));let s=e.get(n);if(s===v){try{new t(n),s=!0}catch{s=!1}e.set(n,s)}return s}(c.codecType.startsWith(Nt)?i.CompressionStream:i.DecompressionStream,Dt))try{await self.initModule(t.config)}catch{}}else try{await self.initModule(t.config)}catch{c.useCompressionStream=!0}!i.CompressionStreamFallback&&i.CompressionStreamZlib&&(i.CompressionStreamFallback=i.CompressionStreamZlib),!i.DecompressionStreamFallback&&i.DecompressionStreamZlib&&(i.DecompressionStreamFallback=i.DecompressionStreamZlib);const a={highWaterMark:1},u=t.readable?xt(t.readable):new y({async pull(t){const n=new l(t=>Qt.set(Zt,t));tn({type:"pull",messageId:Zt}),Zt=(Zt+1)%e.MAX_SAFE_INTEGER;const{value:s,done:r}=await n;t.enqueue(s),r&&t.close()}},a);o=t.writable?function(t){if(t instanceof m)return t;const n=t.getWriter();return new m({write:t=>n.write(t),close:()=>n.close(),abort:t=>n.abort(t)})}(t.writable):new m({async write(t){let n;const s=new l(t=>n=t);Xt.set(Zt,n),tn({type:jt,value:t,messageId:Zt}),Zt=(Zt+1)%e.MAX_SAFE_INTEGER,await s}},a),n=new qt(c,i),Yt=new AbortController;const{signal:w}=Yt;await u.pipeThrough(n).pipeThrough(new Gt(function(t){return r="string"==typeof(n=r=t.chunkSize)&&n.trim()?e(n):n,e.isInteger(r)&&r>=1?s.max(r,64):65536;var n,r}(i))).pipeTo(o,{signal:w,preventClose:!0,preventAbort:!0}),await o.getWriter().close();const{crc32:h,inputSize:p,outputSize:d}=n;tn({type:Ht,result:{crc32:h,inputSize:p,outputSize:d}})}catch(t){if(t.outputSize=n?n.outputSize:0,o&&!o.locked)try{await o.getWriter().close()}catch{}nn(t)}}function tn(t){const{value:n}=t;if(n)if(n.length)try{t.value=(e=n,e.byteOffset||e.byteLength!=e.buffer.byteLength?new o(e):e).buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t);var e}function nn(t=new r("Unknown error")){const{message:n,stack:e,code:s,name:o,outputSize:c,cause:i,codecImportFailed:a}=t,f={message:n,stack:e,code:s,name:o,outputSize:c};i&&(f.cause={name:i.name,message:i.message}),a&&(f.codecImportFailed=!0),p({error:f})}addEventListener("message",({data:t})=>{const{type:n,messageId:e,value:s,done:r}=t;try{if("start"==n&&$t(t),n==jt){const t=Qt.get(e);Qt.delete(e),t({value:s||new o,done:r})}if("ack"==n){const t=Xt.get(e);Xt.delete(e),t()}n==Ht&&Yt.abort()}catch(t){nn(t)}}),p({type:"ready"});const en="deflate",sn="deflate-raw",rn="deflate64-raw",on="gzip";let cn,an,fn,un,ln;function wn(t,n,e={}){if(!cn){const t=new r("WASM module not loaded");throw t.cause=ln,t}const c="number"==typeof e.level?e.level:-1,i="number"==typeof e.outBuffer?e.outBuffer:65536,a="number"==typeof e.inBufferSize?e.inBufferSize:65536;return new d({start(){try{let e;if(this.ut=an(i),this.in=an(a),this.inBufferSize=a,!this.ut||!this.in)throw new r("allocation failed");if(this.lt=new o(i),t?(this.wt=cn.deflate_process,this.ht=cn.deflate_last_consumed,this.yt=cn.deflate_end,this.St=cn.deflate_new(),e=n===on?cn.deflate_init_gzip(this.St,c):n===sn?cn.deflate_init_raw(this.St,c):cn.deflate_init(this.St,c)):n===rn?(this.wt=cn.inflate9_process,this.ht=cn.inflate9_last_consumed,this.yt=cn.inflate9_end,this.St=cn.inflate9_new(),e=cn.inflate9_init_raw(this.St)):(this.wt=cn.inflate_process,this.ht=cn.inflate_last_consumed,this.yt=cn.inflate_end,this.St=cn.inflate_new(),e=n===sn?cn.inflate_init_raw(this.St):n===on?cn.inflate_init_gzip(this.St):cn.inflate_init(this.St)),0!==e)throw new r("init failed:"+e)}catch(t){throw f(this),t}},transform(t,n){try{const e=t,c=new o(un.buffer),a=this.wt,f=this.ht,u=this.ut,l=this.lt;let w=0;for(;w<e.length;){const t=s.min(e.length-w,32768);if((!this.in||this.inBufferSize<t)&&(this.in&&fn&&(fn(this.in),this.in=0),this.in=an(t),this.inBufferSize=t,!this.in))throw new r("allocation failed");c.set(e.subarray(w,w+t),this.in);const o=a(this.St,this.in,t,u,i,0),h=o>>24&255,p=128&h?h-256:h;if(p<0)throw new r("process error:"+p);const d=16777215&o;d&&(l.set(c.subarray(u,u+d),0),n.enqueue(l.slice(0,d)));const y=f(this.St);if(0===y&&0===d)break;w+=y}}catch(t){f(this),n.error(t)}},flush(t){try{const n=new o(un.buffer),e=this.wt,s=this.ut,c=this.lt;for(;;){const o=e(this.St,0,0,s,i,4),a=o>>24&255,f=128&a?a-256:a;if(f<0)throw new r("process error:"+f);const u=16777215&o;if(u&&(c.set(n.subarray(s,s+u),0),t.enqueue(c.slice(0,u))),1===a||0===u)break}}catch(n){t.error(n)}finally{const n=f(this);0!==n&&t.error(new r("end error:"+n))}},cancel(){f(this)}});function f(t){let n=0;return t.St&&t.yt&&(n=t.yt(t.St)),t.St=0,t.in&&fn&&fn(t.in),t.in=0,t.ut&&fn&&fn(t.ut),t.ut=0,n}}class hn{constructor(t=en,n){return wn(!0,t,n)}}class pn{constructor(t=en,n){return wn(!1,t,n)}}hn.gt=!0,pn.gt=!0,hn.vt=[en,sn,on],pn.vt=[en,sn,on,rn];let dn=!1;!function(t={}){const{init:n}=t,e=t.CompressionStreamFallback||t.CompressionStreamZlib,s=t.DecompressionStreamFallback||t.DecompressionStreamZlib;self.initModule=async t=>{n&&await n(t),e&&(t.CompressionStreamFallback=e),s&&(t.DecompressionStreamFallback=s)}}({CompressionStreamFallback:hn,DecompressionStreamFallback:pn,init:t=>async function(t,{baseURI:n}){if(!dn)try{await async function(t,n){let e,s;try{try{s=new URL(t,n)}catch{}const r=await fetch(s);e=await r.arrayBuffer()}catch(n){if(!t.startsWith("data:application/wasm;base64,"))throw n;e=function(t){const n=t.split(",")[1],e=atob(n),s=e.length,r=new o(s);for(let t=0;t<s;++t)r[t]=e.charCodeAt(t);return r.buffer}(t)}!function(t){if(cn=t,({malloc:an,free:fn,memory:un}=cn),"function"!=typeof an||"function"!=typeof fn||!un)throw cn=an=fn=un=null,new r("Invalid WASM module")}((await WebAssembly.instantiate(e)).instance.exports)}(t,n),dn=!0}catch(t){throw function(t){ln=t}(t),t}}(t.wasmURI,t)})});\n';if("string"==typeof s&&(s=(new TextEncoder).encode(s)),t){const t=new Blob([s],{type:n});return URL.createObjectURL(t)}return "data:"+n+";base64,"+function(t){let n="";const s=t.length;let r=0;for(;r+2<s;r+=3){const s=t[r]<<16|t[r+1]<<8|t[r+2];n+=e$1[s>>18&63]+e$1[s>>12&63]+e$1[s>>6&63]+e$1[63&s];}const o=s-r;if(1===o){const s=t[r]<<16;n+=e$1[s>>18&63]+e$1[s>>12&63]+"==";}else if(2===o){const s=t[r]<<16|t[r+1]<<8;n+=e$1[s>>18&63]+e$1[s>>12&63]+e$1[s>>6&63]+"=";}return n}(s)}});
|
|
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 e$1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n$1=t=>t({workerURI:t=>{const n="text/javascript";let s='!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";const{Array:t,Object:n,Number:e,Math:s,Error:r,Uint8Array:o,Uint16Array:c,Uint32Array:i,Int32Array:a,Map:f,DataView:u,Promise:l,TextEncoder:w,crypto:h,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:S,DecompressionStream:g}=self,v=void 0,b="undefined",k="function",z=new o,C=[[],[],[],[],[],[],[],[]];for(let t=0;t<256;t++){let n=t;for(let t=0;t<8;t++)n=1&n?n>>>1^3988292384:n>>>1;C[0][t]=n}for(let t=0;t<256;t++)for(let n=1;n<8;n++){const e=C[n-1][t];C[n][t]=e>>>8^C[0][255&e]}const[I,A,x,M,P,B,D,F]=C;class R{constructor(t){this.o=t||-1}append(t){let n=0|this.o;const e=0|t.length;let s=0;if(e>=8&&t.buffer){const r=new u(t.buffer,t.byteOffset,e),o=e-8;for(;s<=o;s+=8){const t=n^r.getInt32(s,!0),e=r.getInt32(s+4,!0);n=F[255&t]^D[t>>>8&255]^B[t>>>16&255]^P[t>>>24&255]^M[255&e]^x[e>>>8&255]^A[e>>>16&255]^I[e>>>24&255]}}for(;s<e;s++)n=n>>>8^I[255&(n^t[s])];this.o=n}get(){return~this.o}}class U extends d{constructor(){let t;const n=new R;super({transform(t,e){n.append(t),e.enqueue(t)},flush(){const e=new o(4);new u(e.buffer).setUint32(0,n.get()),t.value=e}}),t=this}}function W(t,n){const e=new o(t.length+n.length);return e.set(t),e.set(n,t.length),e}function _(t){return new u(t.buffer,t.byteOffset,t.byteLength)}const T={concat(t,n){if(0===t.length||0===n.length)return t.concat(n);const e=t[t.length-1],s=T.l(e);return 32===s?t.concat(n):T.h(n,s,0|e,t.slice(0,t.length-1))},bitLength(t){const n=t.length;if(0===n)return 0;const e=t[n-1];return 32*(n-1)+T.l(e)},m(t,n){if(32*t.length<n)return t;const e=(t=t.slice(0,s.ceil(n/32))).length;return n&=31,e>0&&n&&(t[e-1]=T.S(n,t[e-1]&2147483648>>n-1,1)),t},S:(t,n,e)=>32===t?n:(e?0|n:n<<32-t)+1099511627776*t,l:t=>s.round(t/1099511627776)||32,h(t,n,e,s){for(void 0===s&&(s=[]);n>=32;n-=32)s.push(e),e=0;if(0===n)return s.concat(t);for(let r=0;r<t.length;r++)s.push(e|t[r]>>>n),e=t[r]<<32-n;const r=t.length?t[t.length-1]:0,o=T.l(r);return s.push(T.S(n+o&31,n+o>32?e:s.pop(),1)),s}},V={bytes:{v(t){const n=T.bitLength(t)/8,e=new o(n);let s;for(let r=0;r<n;r++)3&r||(s=t[r/4]),e[r]=s>>>24,s<<=8;return e},C(t){const n=[];let e,s=0;for(e=0;e<t.length;e++)s=s<<8|t[e],3&~e||(n.push(s),s=0);return 3&e&&n.push(T.S(8*(3&e),s)),n}}},K=class{constructor(t){const n=this;n.blockSize=512,n.I=[1732584193,4023233417,2562383102,271733878,3285377520],n.A=[1518500249,1859775393,2400959708,3395469782],t?(n.M=t.M.slice(0),n.P=t.P.slice(0),n.B=t.B):n.reset()}reset(){const t=this;return t.M=t.I.slice(0),t.P=[],t.B=0,t}update(t){const n=this;"string"==typeof t&&(t=V.D.C(t));const e=n.P=T.concat(n.P,t),s=n.B,o=n.B=s+T.bitLength(t);if(o>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const c=new i(e);let a=0;for(let t=n.blockSize+s-(n.blockSize+s&n.blockSize-1);t<=o;t+=n.blockSize)n.F(c.subarray(16*a,16*(a+1))),a+=1;return e.splice(0,16*a),n}R(){const t=this;let n=t.P;const e=t.M;n=T.concat(n,[T.S(1,1)]);for(let t=n.length+2;15&t;t++)n.push(0);for(n.push(s.floor(t.B/4294967296)),n.push(0|t.B);n.length;)t.F(n.splice(0,16));return t.reset(),e}U(t,n,e,s){return t<=19?n&e|~n&s:t<=39?n^e^s:t<=59?n&e|n&s|e&s:t<=79?n^e^s:void 0}W(t,n){return n<<t|n>>>32-t}F(n){const e=this,r=e.M,o=t(80);for(let t=0;t<16;t++)o[t]=n[t];let c=r[0],i=r[1],a=r[2],f=r[3],u=r[4];for(let t=0;t<=79;t++){t>=16&&(o[t]=e.W(1,o[t-3]^o[t-8]^o[t-14]^o[t-16]));const n=e.W(5,c)+e.U(t,i,a,f)+u+o[t]+e.A[s.floor(t/20)]|0;u=f,f=a,a=e.W(30,i),i=c,c=n}r[0]=r[0]+c|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+f|0,r[4]=r[4]+u|0}},E={importKey:t=>new E._(V.bytes.C(t)),T(t,n,e,s){if(e=e||1e4,s<0||e<0)throw new r("invalid params to pbkdf2");const o=1+(s>>5)<<2;let c,i,a,f,l;const w=new ArrayBuffer(o),h=new u(w);let p=0;const d=T;for(n=V.bytes.C(n),l=1;p<(o||1);l++){for(c=i=t.encrypt(d.concat(n,[l])),a=1;a<e;a++)for(i=t.encrypt(i),f=0;f<i.length;f++)c[f]^=i[f];for(a=0;p<(o||1)&&a<c.length;a++)h.setInt32(p,c[a]),p+=4}return w.slice(0,s/8)},_:class{constructor(t){const n=this,e=n.V=K,s=[[],[]];n.K=[new e,new e];const r=n.K[0].blockSize/32;t.length>r&&(t=(new e).update(t).R());for(let n=0;n<r;n++)s[0][n]=909522486^t[n],s[1][n]=1549556828^t[n];n.K[0].update(s[0]),n.K[1].update(s[1]),n.L=new e(n.K[0])}reset(){const t=this;t.L=new t.V(t.K[0]),t.O=!1}update(t){this.O=!0,this.L.update(t)}digest(){const t=this,n=t.L.R(),e=new t.V(t.K[1]).update(n).R();return t.reset(),e}encrypt(t){if(this.O)throw new r("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},L=typeof h!=b&&typeof h.getRandomValues==k,O="Invalid password",j="zipjs-abort-check-password";function H(t){if(L)return h.getRandomValues(t);throw new r("Crypto API not supported")}const N=16,q={name:"PBKDF2"},G=n.assign({hash:{name:"HMAC"}},q),J=n.assign({iterations:1e3,hash:{name:"SHA-1"}},q),Q=["deriveBits"],X=[8,12,16],Y=[16,24,32],Z=10,$=[0,0,0,0],tt=typeof h!=b,nt=tt&&h.subtle,et=tt&&typeof nt!=b,st=V.bytes,rt=class{constructor(t){const n=this;n.j=[[[],[],[],[],[]],[[],[],[],[],[]]],n.j[0][0][0]||n.H();const e=n.j[0][4],s=n.j[1],o=t.length;let c,i,a,f=1;if(4!==o&&6!==o&&8!==o)throw new r("invalid aes key size");for(n.A=[i=t.slice(0),a=[]],c=o;c<4*o+28;c++){let t=i[c-1];(c%o===0||8===o&&c%o===4)&&(t=e[t>>>24]<<24^e[t>>16&255]<<16^e[t>>8&255]<<8^e[255&t],c%o===0&&(t=t<<8^t>>>24^f<<24,f=f<<1^283*(f>>7))),i[c]=i[c-o]^t}for(let t=0;c;t++,c--){const n=i[3&t?c:c-4];a[t]=c<=4||t<4?n:s[0][e[n>>>24]]^s[1][e[n>>16&255]]^s[2][e[n>>8&255]]^s[3][e[255&n]]}}encrypt(t){return this.N(t,0)}decrypt(t){return this.N(t,1)}H(){const t=this.j[0],n=this.j[1],e=t[4],s=n[4],r=[],o=[];let c,i,a,f;for(let t=0;t<256;t++)o[(r[t]=t<<1^283*(t>>7))^t]=t;for(let u=c=0;!e[u];u^=i||1,c=o[c]||1){let o=c^c<<1^c<<2^c<<3^c<<4;o=o>>8^255&o^99,e[u]=o,s[o]=u,f=r[a=r[i=r[u]]];let l=16843009*f^65537*a^257*i^16843008*u,w=257*r[o]^16843008*o;for(let e=0;e<4;e++)t[e][u]=w=w<<24^w>>>8,n[e][o]=l=l<<24^l>>>8}for(let e=0;e<5;e++)t[e]=t[e].slice(0),n[e]=n[e].slice(0)}N(t,n){if(4!==t.length)throw new r("invalid aes block size");const e=this.A[n],s=e.length/4-2,o=[0,0,0,0],c=this.j[n],i=c[0],a=c[1],f=c[2],u=c[3],l=c[4];let w,h,p,d=t[0]^e[0],y=t[n?3:1]^e[1],m=t[2]^e[2],S=t[n?1:3]^e[3],g=4;for(let t=0;t<s;t++)w=i[d>>>24]^a[y>>16&255]^f[m>>8&255]^u[255&S]^e[g],h=i[y>>>24]^a[m>>16&255]^f[S>>8&255]^u[255&d]^e[g+1],p=i[m>>>24]^a[S>>16&255]^f[d>>8&255]^u[255&y]^e[g+2],S=i[S>>>24]^a[d>>16&255]^f[y>>8&255]^u[255&m]^e[g+3],g+=4,d=w,y=h,m=p;for(let t=0;t<4;t++)o[n?3&-t:t]=l[d>>>24]<<24^l[y>>16&255]<<16^l[m>>8&255]<<8^l[255&S]^e[g++],w=d,d=y,y=m,m=S,S=w;return o}},ot=class{constructor(t,n){this.G=t,this.J=n,this.X=n}reset(){this.X=this.J}update(t){return this.Y(this.G,t,this.X)}Z(t){if(255&~(t>>24))t+=1<<24;else{let n=t>>16&255,e=t>>8&255,s=255&t;255===n?(n=0,255===e?(e=0,255===s?s=0:++s):++e):++n,t=0,t+=n<<16,t+=e<<8,t+=s}return t}$(t){0===(t[0]=this.Z(t[0]))&&(t[1]=this.Z(t[1]))}Y(t,n,e){let s;if(!(s=n.length))return[];const r=T.bitLength(n);for(let r=0;r<s;r+=4){this.$(e);const s=t.encrypt(e);n[r]^=s[0],n[r+1]^=s[1],n[r+2]^=s[2],n[r+3]^=s[3]}return T.m(n,r)}},ct=E._;let it=tt&&et&&typeof nt.importKey==k,at=tt&&et&&typeof nt.deriveBits==k;class ft extends d{constructor({password:t,rawPassword:n,encryptionStrength:e,checkPasswordOnly:s,checkAuthenticationCode:c=!0}){super({start(){lt(this,t,n,e)},async transform(t,n){const e=this,{password:c,strength:i,nt:a,ready:f}=e;c?(await async function(t,n,e,s){const o=await ht(t,n,e,dt(s,0,X[n])),c=dt(s,X[n]);if(o[0]!=c[0]||o[1]!=c[1])throw new r(O)}(e,i,c,dt(t,0,X[i]+2)),t=dt(t,X[i]+2),s?n.error(new r(j)):a()):await f;const u=new o(t.length-Z-(t.length-Z)%N);n.enqueue(wt(e,t,u,0,Z,!0))},async flush(t){const{et:n,st:e,ot:s,ready:o}=this;if(e&&n){await o;const i=dt(s,0,s.length-Z),a=dt(s,s.length-Z);let f=z;if(i.length){const t=mt(st,i);e.update(t);const s=n.update(t);f=yt(st,s)}const u=dt(yt(st,e.digest()),0,Z);let l=s.length<Z?1:0;for(let t=0;t<Z;t++)l|=u[t]^a[t];if(l&&c)throw new r("Invalid authentication code");t.enqueue(f)}}})}}class ut extends d{constructor({password:t,rawPassword:n,encryptionStrength:e}){super({start(){lt(this,t,n,e)},async transform(t,n){const e=this,{password:s,strength:r,nt:c,ready:i}=e;let a=z;s?(a=await async function(t,n,e){const s=H(new o(X[n]));return W(s,await ht(t,n,e,s))}(e,r,s),c()):await i;const f=new o(a.length+t.length-t.length%N);f.set(a,0),n.enqueue(wt(e,t,f,a.length,0))},async flush(t){const{et:n,st:e,ot:s,ready:r}=this;if(e&&n){await r;let o=z;if(s.length){const t=n.update(mt(st,s));e.update(t),o=yt(st,t)}const c=yt(st,e.digest()).slice(0,Z);t.enqueue(W(o,c))}}})}}function lt(t,e,s,r){n.assign(t,{ready:new l(n=>t.nt=n),password:pt(e,s),strength:r-1,ot:z})}function wt(t,n,e,s,r,c){const{et:i,st:a,ot:f}=t;f.length&&(n=W(f,n));const u=n.length-r;let l;for(e=function(t,n){if(n&&n>t.length){const e=t;(t=new o(n)).set(e,0)}return t}(e,s+(u-u%N)),l=0;l<=u-N;l+=N){const t=mt(st,dt(n,l,l+N));c&&a.update(t);const r=i.update(t);c||a.update(r),e.set(yt(st,r),l+s)}return t.ot=dt(n,l),e}async function ht(e,s,r,c){e.password=null;const i=await async function(t,n,e,s,r){if(!it)return E.importKey(n);try{return await nt.importKey("raw",n,e,!1,r)}catch{return it=!1,E.importKey(n)}}(0,r,G,0,Q),a=await async function(t,n,e){if(!at)return E.T(n,t.salt,J.iterations,e);try{return await nt.deriveBits(t,n,e)}catch{return at=!1,E.T(n,t.salt,J.iterations,e)}}(n.assign({salt:c},J),i,8*(2*Y[s]+2)),f=new o(a),u=mt(st,dt(f,0,Y[s])),l=mt(st,dt(f,Y[s],2*Y[s])),w=dt(f,2*Y[s]);return n.assign(e,{keys:{key:u,ct:l,passwordVerification:w},et:new ot(new rt(u),t.from($)),st:new ct(l)}),w}function pt(t,n){return n===v?function(t){if(typeof w==b){t=unescape(encodeURIComponent(t));const n=new o(t.length);for(let e=0;e<n.length;e++)n[e]=t.charCodeAt(e);return n}return(new w).encode(t)}(t):n}function dt(t,n,e){return t.subarray(n,e)}function yt(t,n){return t.v(n)}function mt(t,n){return t.C(n)}class St extends d{constructor({password:t,rawPassword:n,passwordVerification:e,checkPasswordOnly:s}){super({start(){vt(this,t,n,e)},transform(t,n){const e=this;if(e.password||e.rawPassword){const n=bt(e,t.subarray(0,12));if(e.password=e.rawPassword=null,0!=(n[11]^e.passwordVerification))throw new r(O);t=t.subarray(12)}s?n.error(new r(j)):n.enqueue(bt(e,t))}})}}class gt extends d{constructor({password:t,rawPassword:n,passwordVerification:e}){super({start(){vt(this,t,n,e)},transform(t,n){const e=this;let s,r;if(e.password||e.rawPassword){e.password=e.rawPassword=null;const n=H(new o(12));n[11]=e.passwordVerification,s=new o(t.length+n.length),s.set(kt(e,n),0),r=12}else s=new o(t.length),r=0;s.set(kt(e,t),r),n.enqueue(s)}})}}function vt(t,e,s,r){n.assign(t,{password:e,rawPassword:s,passwordVerification:r}),function(t,e,s){const r=[305419896,591751049,878082192];if(n.assign(t,{keys:r,it:new R(r[0]),ft:new R(r[2])}),s)for(let n=0;n<s.length;n++)zt(t,s[n]);else for(let n=0;n<e.length;n++)zt(t,e.charCodeAt(n))}(t,e,s)}function bt(t,n){const e=new o(n.length);for(let s=0;s<n.length;s++)e[s]=Ct(t)^n[s],zt(t,e[s]);return e}function kt(t,n){const e=new o(n.length);for(let s=0;s<n.length;s++)e[s]=Ct(t)^n[s],zt(t,n[s]);return e}function zt(t,n){let[,e]=t.keys;t.it.append([n]);const r=~t.it.get();e=At(s.imul(At(e+It(r)),134775813)+1),t.ft.append([e>>>24]);const o=~t.ft.get();t.keys=[r,e,o]}function Ct(t){const n=2|t.keys[2];return It(s.imul(n,1^n)>>>8)}function It(t){return 255&t}function At(t){return 4294967295&t}function xt(t){if(t instanceof y)return t;const n=t.getReader();return new y({async pull(t){const{value:e,done:s}=await n.read();s?t.close():t.enqueue(e)},cancel:t=>n.cancel(t)})}const Mt=new f;function Pt(t){return Mt.get(t)}const Bt="Invalid uncompressed size",Dt="deflate-raw",Ft="gzip",Rt=[31,139,8];class Ut extends d{constructor(t,{chunkSize:n,CompressionStreamFallback:e,CompressionStream:s}){super({});const{compressed:r,encrypted:o,useCompressionStream:c,zipCrypto:i,computeCrc32:a,level:f,deflate64:l,format:w,compressionMethod:h,inputSize:p}=t,d=this;let y,m,S,g=super.readable;const v=w&&Pt(w),b=a&&r&&!l&&!v&&(!o||i)&&Boolean(c&&s);if(o&&!i||!a||b||(y=new U,g=Lt(g,y)),r)if(v)g=Ot(g,Kt(v.CompressionStream,w,{level:f,chunkSize:n,compressionMethod:h,uncompressedSize:p}));else if(b)S=new Wt,g=Ot(g,new s(Ft)),g=Lt(g,S);else try{g=Et(g,c,{level:f,chunkSize:n},s,e)}catch(t){let n;try{n=new s(Ft)}catch{throw t}g=Ot(g,n),g=Lt(g,new Wt)}o&&(i?g=Lt(g,new gt(t)):(m=new ut(t),g=Lt(g,m))),Vt(d,g,()=>{o&&!i||!a||(d.crc32=b?S.crc32:new u(y.value.buffer).getUint32(0))})}}class Wt extends d{constructor(){let t,n=10,e=new o(0);super({transform(t,r){if(n){const e=s.min(n,t.length);if(n-=e,!(t=t.subarray(e)).length)return}const o=e.length+t.length;if(o<=8)return void(e=W(e,t));const c=o-8,i=s.min(c,e.length);r.enqueue(W(e.subarray(0,i),t.subarray(0,c-i))),e=W(e.subarray(i),t.subarray(c-i))},flush(){const n=_(e);t.crc32=n.getUint32(0,!0),t.uncompressedSize=n.getUint32(4,!0)}}),t=this}}class _t extends d{constructor(t,{chunkSize:n,DecompressionStreamFallback:e,DecompressionStream:s}){super({});const{zipCrypto:c,encrypted:i,checkCrc32:a,crc32:f,compressed:w,useCompressionStream:h,deflate64:p,format:m,compressionMethod:S,rawBitFlag:g,outputSize:b}=t;let k,z,C=super.readable;if(i&&(c?C=Lt(C,new St(t)):(z=new ft(t),C=Lt(C,z))),w){const t=m&&Pt(m);if(t)C=Ot(C,Kt(t.DecompressionStream,m,{chunkSize:n,compressionMethod:S,rawBitFlag:g,uncompressedSize:b}));else try{C=Et(C,h,{chunkSize:n,deflate64:p},s,e)}catch(t){if(p||b===v)throw t;let n;try{n=new s(Ft)}catch{throw t}C=function(t,n,e){const s=new R;let c,i,a,f=0,u=!1;const w=new l((t,n)=>{i=t,a=n});w.catch(()=>{}),e||i();const h=new d({start(t){const n=new o(10);n.set(Rt),t.enqueue(n)},transform(t,n){n.enqueue(t)},async flush(t){u=!0,y();try{await w}finally{m()}const n=new o(8),r=_(n);r.setUint32(0,s.get(),!0),r.setUint32(4,e,!0),t.enqueue(n)},cancel(t){a(t)}}),p=new d({transform(t,n){s.append(t),f+=t.length,f>=e?i():u&&y(),n.enqueue(t)},cancel(t){a(t)}});return t=Lt(t,h),Lt(t=Ot(t,n),p);function y(){m(),c=setTimeout(()=>a(new r(Bt)),5e3)}function m(){clearTimeout(c)}}(C,n,b)}C=function(t){const n=t.getReader();return new y({async pull(t){let e;try{e=await n.read()}catch(t){if(t&&t.message)throw t;const n=new r("Invalid compressed data");throw n.cause=t,n}const{value:s,done:o}=e;o?t.close():t.enqueue(s)},cancel:t=>n.cancel(t)})}(C)}a&&(k=new U,C=Lt(C,k)),Vt(this,C,()=>{if(a){const t=new u(k.value.buffer);if(f!=t.getUint32(0,!1))throw new r("Invalid CRC32")}})}}const Tt=new f;function Vt(t,e,s){e=Lt(e,new d({flush:s})),n.defineProperty(t,"readable",{get:()=>e})}function Kt(t,n,e){if(!t)throw new r("Compression method not supported");return new t(n,e)}function Et(t,n,e,s,r){const o=n&&s?s:r||s,c=e.deflate64?"deflate64-raw":Dt;let i;try{i=new o(c,e)}catch(t){if(!n||!r||o==r)throw t;i=new r(c,e)}return Ot(t,i)}function Lt(t,n){return xt(t).pipeThrough(n)}function Ot(t,n){const e=n.writable.getWriter(),s=t.getReader();return async function(){try{for(;;){await e.ready;const t=await s.read();if(t.done){await e.close();break}await e.write(t.value)}}catch(t){await async function(t,n){try{await t.abort(n)}catch{}}(e,t),await async function(t,n){try{await t.cancel(n)}catch{}}(s,t)}}(),n.readable}const jt="data",Ht="close",Nt="deflate";class qt extends d{constructor(t,e){super({});const s=this,{codecType:o}=t;let c;o.startsWith(Nt)?c=Ut:o.startsWith("inflate")&&(c=_t),s.outputSize=0;let i=0;const a=new c(t,e),f=super.readable,u=new d({transform(t,n){t&&t.length&&(i+=t.length,n.enqueue(t))},flush(){n.assign(s,{inputSize:i})}}),l=new d({transform(n,e){if(n&&n.length&&(e.enqueue(n),s.outputSize+=n.length,t.outputSize!==v&&s.outputSize>t.outputSize))throw new r(Bt)},flush(){const{crc32:t}=a;n.assign(s,{crc32:t,inputSize:i})}});n.defineProperty(s,"readable",{get:()=>f.pipeThrough(u).pipeThrough(a).pipeThrough(l)})}}class Gt extends d{constructor(t){const s=[];let r=0,c=0;function i(){const n=new o(t);let e=0;for(;e<t;){const r=s[0],o=t-e;r.length<=o?(n.set(r,e),e+=r.length,s.shift()):(n.set(r.subarray(0,o),e),s[0]=r.subarray(o),e+=o)}return r-=t,n}(!e.isFinite(t)||t<1)&&(t=65536),super({transform(n,e){for(s.push(n),r+=n.length;r>t;)c+=t,e.enqueue(i())},flush(t){r&&(c+=r,t.enqueue(function(t,n){const e=new o(n);let s=0;for(const n of t)e.set(n,s),s+=n.length;return e}(s,r)))}}),n.defineProperty(this,"outputSize",{get:()=>c})}}let Jt=2;try{typeof navigator!=b&&navigator.hardwareConcurrency&&(Jt=navigator.hardwareConcurrency)}catch{}const Qt=new f,Xt=new f;let Yt,Zt=0;async function $t(t){let n,o,c;try{const{options:i,config:a}=t;if(i.format)try{await async function(t,n){!Mt.has(t)&&n&&function(t,n){const{CompressionStream:e,DecompressionStream:s}=n;if(typeof e!=k&&typeof s!=k)throw new r("Invalid codec module");Mt.set(t,{CompressionStream:e,DecompressionStream:s})}(t,await(import(n)))}(i.format,i.codecURI)}catch(t){throw t.codecImportFailed=!0,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=Tt.get(t);e||(e=new f,Tt.set(t,e));let s=e.get(n);if(s===v){try{new t(n),s=!0}catch{s=!1}e.set(n,s)}return s}(i.codecType.startsWith(Nt)?a.CompressionStream:a.DecompressionStream,Dt))try{await self.initModule(t.config)}catch{}}else try{await self.initModule(t.config)}catch{i.useCompressionStream=!0}!a.CompressionStreamFallback&&a.CompressionStreamZlib&&(a.CompressionStreamFallback=a.CompressionStreamZlib),!a.DecompressionStreamFallback&&a.DecompressionStreamZlib&&(a.DecompressionStreamFallback=a.DecompressionStreamZlib);const u={highWaterMark:1},w=t.readable?xt(t.readable):new y({async pull(t){const n=new l(t=>Qt.set(Zt,t));tn({type:"pull",messageId:Zt}),Zt=(Zt+1)%e.MAX_SAFE_INTEGER;const{value:s,done:r}=await n;t.enqueue(s),r&&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 s=new l(t=>n=t);Xt.set(Zt,n),tn({type:jt,value:t,messageId:Zt}),Zt=(Zt+1)%e.MAX_SAFE_INTEGER,await s}},u),n=new qt(i,a),o=new Gt(function(t){return r="string"==typeof(n=r=t.chunkSize)&&n.trim()?e(n):n,e.isInteger(r)&&r>=1?s.max(r,64):65536;var n,r}(a)),Yt=new AbortController;const{signal:h}=Yt;await w.pipeThrough(n).pipeThrough(o).pipeTo(c,{signal:h,preventClose:!0,preventAbort:!0}),await c.getWriter().close();const{crc32:p,inputSize:d,outputSize:S}=n;tn({type:Ht,result:{crc32:p,inputSize:d,outputSize:S}})}catch(t){if(t.outputSize=o?o.outputSize:0,c&&!c.locked)try{await c.getWriter().close()}catch{}nn(t)}}function tn(t){const{value:n}=t;if(n)if(n.length)try{t.value=(e=n,e.byteOffset||e.byteLength!=e.buffer.byteLength?new o(e):e).buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t);var e}function nn(t=new r("Unknown error")){const{message:n,stack:e,code:s,name:o,outputSize:c,cause:i,codecImportFailed:a}=t,f={message:n,stack:e,code:s,name:o,outputSize:c};i&&(f.cause={name:i.name,message:i.message}),a&&(f.codecImportFailed=!0),p({error:f})}addEventListener("message",({data:t})=>{const{type:n,messageId:e,value:s,done:r}=t;try{if("start"==n&&$t(t),n==jt){const t=Qt.get(e);Qt.delete(e),t({value:s||new o,done:r})}if("ack"==n){const t=Xt.get(e);Xt.delete(e),t()}n==Ht&&Yt.abort()}catch(t){nn(t)}}),p({type:"ready"});const en="deflate",sn="deflate-raw",rn="deflate64-raw",on="gzip";let cn,an,fn,un,ln;function wn(t,n,e={}){if(!cn){const t=new r("WASM module not loaded");throw t.cause=ln,t}const c="number"==typeof e.level?e.level:-1,i="number"==typeof e.outBuffer?e.outBuffer:65536,a="number"==typeof e.inBufferSize?e.inBufferSize:65536;return new d({start(){try{let e;if(this.ut=an(i),this.in=an(a),this.inBufferSize=a,!this.ut||!this.in)throw new r("allocation failed");if(this.lt=new o(i),t?(this.wt=cn.deflate_process,this.ht=cn.deflate_last_consumed,this.yt=cn.deflate_end,this.St=cn.deflate_new(),e=n===on?cn.deflate_init_gzip(this.St,c):n===sn?cn.deflate_init_raw(this.St,c):cn.deflate_init(this.St,c)):n===rn?(this.wt=cn.inflate9_process,this.ht=cn.inflate9_last_consumed,this.yt=cn.inflate9_end,this.St=cn.inflate9_new(),e=cn.inflate9_init_raw(this.St)):(this.wt=cn.inflate_process,this.ht=cn.inflate_last_consumed,this.yt=cn.inflate_end,this.St=cn.inflate_new(),e=n===sn?cn.inflate_init_raw(this.St):n===on?cn.inflate_init_gzip(this.St):cn.inflate_init(this.St)),0!==e)throw new r("init failed:"+e)}catch(t){throw f(this),t}},transform(t,n){try{const e=t,c=new o(un.buffer),a=this.wt,f=this.ht,u=this.ut,l=this.lt;let w=0;for(;w<e.length;){const t=s.min(e.length-w,32768);if((!this.in||this.inBufferSize<t)&&(this.in&&fn&&(fn(this.in),this.in=0),this.in=an(t),this.inBufferSize=t,!this.in))throw new r("allocation failed");c.set(e.subarray(w,w+t),this.in);const o=a(this.St,this.in,t,u,i,0),h=o>>24&255,p=128&h?h-256:h;if(p<0)throw new r("process error:"+p);const d=16777215&o;d&&(l.set(c.subarray(u,u+d),0),n.enqueue(l.slice(0,d)));const y=f(this.St);if(0===y&&0===d)break;w+=y}}catch(t){f(this),n.error(t)}},flush(t){try{const n=new o(un.buffer),e=this.wt,s=this.ut,c=this.lt;for(;;){const o=e(this.St,0,0,s,i,4),a=o>>24&255,f=128&a?a-256:a;if(f<0)throw new r("process error:"+f);const u=16777215&o;if(u&&(c.set(n.subarray(s,s+u),0),t.enqueue(c.slice(0,u))),1===a||0===u)break}}catch(n){t.error(n)}finally{const n=f(this);0!==n&&t.error(new r("end error:"+n))}},cancel(){f(this)}});function f(t){let n=0;return t.St&&t.yt&&(n=t.yt(t.St)),t.St=0,t.in&&fn&&fn(t.in),t.in=0,t.ut&&fn&&fn(t.ut),t.ut=0,n}}class hn{constructor(t=en,n){return wn(!0,t,n)}}class pn{constructor(t=en,n){return wn(!1,t,n)}}hn.gt=!0,pn.gt=!0,hn.vt=[en,sn,on],pn.vt=[en,sn,on,rn];let dn=!1;!function(t={}){const{init:n}=t,e=t.CompressionStreamFallback||t.CompressionStreamZlib,s=t.DecompressionStreamFallback||t.DecompressionStreamZlib;self.initModule=async t=>{n&&await n(t),e&&(t.CompressionStreamFallback=e),s&&(t.DecompressionStreamFallback=s)}}({CompressionStreamFallback:hn,DecompressionStreamFallback:pn,init:t=>async function(t,{baseURI:n}){if(!dn)try{await async function(t,n){let e,s;try{try{s=new URL(t,n)}catch{}const r=await fetch(s);e=await r.arrayBuffer()}catch(n){if(!t.startsWith("data:application/wasm;base64,"))throw n;e=function(t){const n=t.split(",")[1],e=atob(n),s=e.length,r=new o(s);for(let t=0;t<s;++t)r[t]=e.charCodeAt(t);return r.buffer}(t)}!function(t){if(cn=t,({malloc:an,free:fn,memory:un}=cn),"function"!=typeof an||"function"!=typeof fn||!un)throw cn=an=fn=un=null,new r("Invalid WASM module")}((await WebAssembly.instantiate(e)).instance.exports)}(t,n),dn=!0}catch(t){throw function(t){ln=t}(t),t}}(t.wasmURI,t)})});\n';if("string"==typeof s&&(s=(new TextEncoder).encode(s)),t){const t=new Blob([s],{type:n});return URL.createObjectURL(t)}return "data:"+n+";base64,"+function(t){let n="";const s=t.length;let r=0;for(;r+2<s;r+=3){const s=t[r]<<16|t[r+1]<<8|t[r+2];n+=e$1[s>>18&63]+e$1[s>>12&63]+e$1[s>>6&63]+e$1[63&s];}const o=s-r;if(1===o){const s=t[r]<<16;n+=e$1[s>>18&63]+e$1[s>>12&63]+"==";}else if(2===o){const s=t[r]<<16|t[r+1]<<8;n+=e$1[s>>18&63]+e$1[s>>12&63]+e$1[s>>6&63]+"=";}return n}(s)}});
|
|
412
443
|
|
|
413
444
|
/*
|
|
414
445
|
Copyright (c) 2026 Gildas Lormeau. All rights reserved.
|
|
@@ -2593,6 +2624,7 @@ class ChunkStream extends TransformStream {
|
|
|
2593
2624
|
constructor(chunkSize) {
|
|
2594
2625
|
const pendingChunks = [];
|
|
2595
2626
|
let pendingLength = 0;
|
|
2627
|
+
let outputSize = 0;
|
|
2596
2628
|
if (!Number.isFinite(chunkSize) || chunkSize < 1) {
|
|
2597
2629
|
chunkSize = DEFAULT_CHUNK_SIZE;
|
|
2598
2630
|
}
|
|
@@ -2601,15 +2633,20 @@ class ChunkStream extends TransformStream {
|
|
|
2601
2633
|
pendingChunks.push(chunk);
|
|
2602
2634
|
pendingLength += chunk.length;
|
|
2603
2635
|
while (pendingLength > chunkSize) {
|
|
2636
|
+
outputSize += chunkSize;
|
|
2604
2637
|
controller.enqueue(shiftChunk());
|
|
2605
2638
|
}
|
|
2606
2639
|
},
|
|
2607
2640
|
flush(controller) {
|
|
2608
2641
|
if (pendingLength) {
|
|
2642
|
+
outputSize += pendingLength;
|
|
2609
2643
|
controller.enqueue(concatChunks(pendingChunks, pendingLength));
|
|
2610
2644
|
}
|
|
2611
2645
|
}
|
|
2612
2646
|
});
|
|
2647
|
+
Object.defineProperty(this, "outputSize", {
|
|
2648
|
+
get: () => outputSize
|
|
2649
|
+
});
|
|
2613
2650
|
|
|
2614
2651
|
function shiftChunk() {
|
|
2615
2652
|
const result = new Uint8Array(chunkSize);
|
|
@@ -2814,7 +2851,7 @@ function createWorkerInterface(workerData, config) {
|
|
|
2814
2851
|
}
|
|
2815
2852
|
|
|
2816
2853
|
async function runWorker$1({ options, readable, writable, onTaskFinished }, config) {
|
|
2817
|
-
let codecStream;
|
|
2854
|
+
let codecStream, chunkStream;
|
|
2818
2855
|
try {
|
|
2819
2856
|
if (options.compressed && !options.format) {
|
|
2820
2857
|
const deflate = options.codecType.startsWith(CODEC_DEFLATE);
|
|
@@ -2837,9 +2874,10 @@ async function runWorker$1({ options, readable, writable, onTaskFinished }, conf
|
|
|
2837
2874
|
}
|
|
2838
2875
|
}
|
|
2839
2876
|
codecStream = new CodecStream(options, config);
|
|
2877
|
+
chunkStream = new ChunkStream(getChunkSize(config));
|
|
2840
2878
|
await readable
|
|
2841
2879
|
.pipeThrough(codecStream)
|
|
2842
|
-
.pipeThrough(
|
|
2880
|
+
.pipeThrough(chunkStream)
|
|
2843
2881
|
.pipeTo(writable, { preventClose: true, preventAbort: true });
|
|
2844
2882
|
const {
|
|
2845
2883
|
crc32,
|
|
@@ -2853,7 +2891,7 @@ async function runWorker$1({ options, readable, writable, onTaskFinished }, conf
|
|
|
2853
2891
|
};
|
|
2854
2892
|
} catch (error) {
|
|
2855
2893
|
if (codecStream) {
|
|
2856
|
-
error.outputSize =
|
|
2894
|
+
error.outputSize = chunkStream ? chunkStream.outputSize : 0;
|
|
2857
2895
|
}
|
|
2858
2896
|
throw error;
|
|
2859
2897
|
} finally {
|
|
@@ -2962,11 +3000,17 @@ async function runWebWorker(workerData, config) {
|
|
|
2962
3000
|
let resolveResult, rejectResult;
|
|
2963
3001
|
const result = new Promise((resolve, reject) => {
|
|
2964
3002
|
resolveResult = resolve;
|
|
2965
|
-
rejectResult =
|
|
3003
|
+
rejectResult = error => {
|
|
3004
|
+
if (error && error.outputSize === UNDEFINED_VALUE) {
|
|
3005
|
+
error.outputSize = workerData.outputSize;
|
|
3006
|
+
}
|
|
3007
|
+
reject(error);
|
|
3008
|
+
};
|
|
2966
3009
|
});
|
|
2967
3010
|
Object.assign(workerData, {
|
|
2968
3011
|
reader: null,
|
|
2969
3012
|
writer: null,
|
|
3013
|
+
outputSize: 0,
|
|
2970
3014
|
resolveResult,
|
|
2971
3015
|
rejectResult,
|
|
2972
3016
|
result
|
|
@@ -3250,8 +3294,10 @@ async function onMessage({ data }, workerData) {
|
|
|
3250
3294
|
}
|
|
3251
3295
|
}
|
|
3252
3296
|
if (type == MESSAGE_DATA) {
|
|
3297
|
+
const chunk = new Uint8Array(value);
|
|
3253
3298
|
await writer.ready;
|
|
3254
|
-
await writer.write(
|
|
3299
|
+
await writer.write(chunk);
|
|
3300
|
+
workerData.outputSize += chunk.length;
|
|
3255
3301
|
if (!stale()) {
|
|
3256
3302
|
sendMessage({ type: MESSAGE_ACK_DATA, messageId }, workerData);
|
|
3257
3303
|
}
|
|
@@ -3559,10 +3605,13 @@ function decode(value, encoding, ignoreBOM) {
|
|
|
3559
3605
|
|
|
3560
3606
|
|
|
3561
3607
|
const ERR_HTTP_STATUS = "HTTP error ";
|
|
3608
|
+
const MIN_SUCCESS_HTTP_STATUS = 200;
|
|
3609
|
+
const MAX_SUCCESS_HTTP_STATUS = 299;
|
|
3562
3610
|
const ERR_HTTP_RANGE = "HTTP Range not supported";
|
|
3563
3611
|
const ERR_HTTP_RESOURCE_CHANGED = "HTTP resource changed";
|
|
3564
3612
|
const ERR_ITERATOR_COMPLETED_TOO_SOON = "Writer iterator completed too soon";
|
|
3565
3613
|
const ERR_WRITER_NOT_INITIALIZED = "Writer not initialized";
|
|
3614
|
+
const ERR_WRITER_SIZE_NOT_WRITABLE = "Invalid writer (size must be writable)";
|
|
3566
3615
|
|
|
3567
3616
|
const CONTENT_TYPE_TEXT_PLAIN = "text/plain";
|
|
3568
3617
|
const HTTP_HEADER_CONTENT_LENGTH = "Content-Length";
|
|
@@ -3754,11 +3803,14 @@ class BlobReader extends Reader {
|
|
|
3754
3803
|
const reader = this;
|
|
3755
3804
|
const { sourceBlob, size } = reader;
|
|
3756
3805
|
const { offset = 0, size: readSize = size - offset } = options || {};
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3806
|
+
// deno-lint-ignore valid-typeof
|
|
3807
|
+
if (typeof sourceBlob.stream == FUNCTION_TYPE) {
|
|
3808
|
+
if (!offset && readSize >= size) {
|
|
3809
|
+
return toCompatibleReadable(sourceBlob.stream());
|
|
3810
|
+
}
|
|
3811
|
+
if (blobSliceReliable) {
|
|
3812
|
+
return toCompatibleReadable(sourceBlob.slice(offset, offset + readSize).stream());
|
|
3813
|
+
}
|
|
3762
3814
|
}
|
|
3763
3815
|
return super.createReadable(options);
|
|
3764
3816
|
}
|
|
@@ -4158,7 +4210,7 @@ async function getContentLength(httpReader, sendRequest, getRequestData) {
|
|
|
4158
4210
|
|
|
4159
4211
|
async function sendFetchRequest(method, { fetch: fetchFunction = fetch, options, url }, headers) {
|
|
4160
4212
|
const response = await fetchFunction(url, Object.assign({}, options, { method, headers }));
|
|
4161
|
-
if (response.status
|
|
4213
|
+
if (response.status >= MIN_SUCCESS_HTTP_STATUS && response.status <= MAX_SUCCESS_HTTP_STATUS) {
|
|
4162
4214
|
return response;
|
|
4163
4215
|
} else {
|
|
4164
4216
|
throw response.status == 416 ? new Error(ERR_HTTP_RANGE) : new Error(ERR_HTTP_STATUS + (response.statusText || response.status));
|
|
@@ -4169,7 +4221,7 @@ function sendXMLHttpRequest(method, { url }, headers) {
|
|
|
4169
4221
|
return new Promise((resolve, reject) => {
|
|
4170
4222
|
const request = new XMLHttpRequest();
|
|
4171
4223
|
request.addEventListener("load", () => {
|
|
4172
|
-
if (request.status
|
|
4224
|
+
if (request.status >= MIN_SUCCESS_HTTP_STATUS && request.status <= MAX_SUCCESS_HTTP_STATUS) {
|
|
4173
4225
|
const headers = [];
|
|
4174
4226
|
request.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(header => {
|
|
4175
4227
|
const splitHeader = header.trim().split(/\s*:\s*/);
|
|
@@ -4473,8 +4525,10 @@ class GenericWriter {
|
|
|
4473
4525
|
writable: toCompatibleWritable(writer)
|
|
4474
4526
|
};
|
|
4475
4527
|
}
|
|
4476
|
-
|
|
4477
|
-
writer.size = 0;
|
|
4528
|
+
try {
|
|
4529
|
+
writer.size = writer.size === UNDEFINED_VALUE ? 0 : writer.size;
|
|
4530
|
+
} catch {
|
|
4531
|
+
throw new Error(ERR_WRITER_SIZE_NOT_WRITABLE);
|
|
4478
4532
|
}
|
|
4479
4533
|
return writer;
|
|
4480
4534
|
}
|
|
@@ -4522,6 +4576,45 @@ function createReadable(reader, options) {
|
|
|
4522
4576
|
}
|
|
4523
4577
|
}
|
|
4524
4578
|
|
|
4579
|
+
/*
|
|
4580
|
+
Copyright (c) 2026 Gildas Lormeau. All rights reserved.
|
|
4581
|
+
|
|
4582
|
+
Redistribution and use in source and binary forms, with or without
|
|
4583
|
+
modification, are permitted provided that the following conditions are met:
|
|
4584
|
+
|
|
4585
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
4586
|
+
this list of conditions and the following disclaimer.
|
|
4587
|
+
|
|
4588
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
4589
|
+
notice, this list of conditions and the following disclaimer in
|
|
4590
|
+
the documentation and/or other materials provided with the distribution.
|
|
4591
|
+
|
|
4592
|
+
3. The names of the authors may not be used to endorse or promote products
|
|
4593
|
+
derived from this software without specific prior written permission.
|
|
4594
|
+
|
|
4595
|
+
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
4596
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
4597
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
4598
|
+
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
4599
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
4600
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
4601
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
4602
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
4603
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
4604
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
4605
|
+
*/
|
|
4606
|
+
|
|
4607
|
+
|
|
4608
|
+
function addWarning(warnings, reason, filename) {
|
|
4609
|
+
if (!warnings.some(warning => warning.reason == reason)) {
|
|
4610
|
+
const warning = { reason };
|
|
4611
|
+
if (filename !== UNDEFINED_VALUE) {
|
|
4612
|
+
warning.filename = filename;
|
|
4613
|
+
}
|
|
4614
|
+
warnings.push(warning);
|
|
4615
|
+
}
|
|
4616
|
+
}
|
|
4617
|
+
|
|
4525
4618
|
/*
|
|
4526
4619
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
4527
4620
|
|
|
@@ -4550,6 +4643,7 @@ function createReadable(reader, options) {
|
|
|
4550
4643
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
4551
4644
|
*/
|
|
4552
4645
|
|
|
4646
|
+
|
|
4553
4647
|
const PROPERTY_NAME_FILENAME = "filename";
|
|
4554
4648
|
const PROPERTY_NAME_RAW_FILENAME = "rawFilename";
|
|
4555
4649
|
const PROPERTY_NAME_COMMENT = "comment";
|
|
@@ -4674,6 +4768,38 @@ class Entry {
|
|
|
4674
4768
|
|
|
4675
4769
|
}
|
|
4676
4770
|
|
|
4771
|
+
const INTERPRETED_EXTRA_FIELD_TYPES = new Set([
|
|
4772
|
+
EXTRAFIELD_TYPE_ZIP64,
|
|
4773
|
+
EXTRAFIELD_TYPE_AES,
|
|
4774
|
+
EXTRAFIELD_TYPE_NTFS,
|
|
4775
|
+
EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP,
|
|
4776
|
+
EXTRAFIELD_TYPE_UNICODE_PATH,
|
|
4777
|
+
EXTRAFIELD_TYPE_UNICODE_COMMENT,
|
|
4778
|
+
EXTRAFIELD_TYPE_USDZ,
|
|
4779
|
+
EXTRAFIELD_TYPE_INFOZIP,
|
|
4780
|
+
EXTRAFIELD_TYPE_UNIX,
|
|
4781
|
+
EXTRAFIELD_TYPE_UNIX_TYPE1,
|
|
4782
|
+
EXTRAFIELD_TYPE_PKWARE_UNIX
|
|
4783
|
+
]);
|
|
4784
|
+
|
|
4785
|
+
function getUserExtraField(extraField) {
|
|
4786
|
+
if (extraField) {
|
|
4787
|
+
const userExtraField = new Map();
|
|
4788
|
+
extraField.forEach((field, type) => {
|
|
4789
|
+
if (!INTERPRETED_EXTRA_FIELD_TYPES.has(type)) {
|
|
4790
|
+
userExtraField.set(type, field.data);
|
|
4791
|
+
}
|
|
4792
|
+
});
|
|
4793
|
+
if (userExtraField.size) {
|
|
4794
|
+
return userExtraField;
|
|
4795
|
+
}
|
|
4796
|
+
}
|
|
4797
|
+
}
|
|
4798
|
+
|
|
4799
|
+
function getEncryptionOverhead(encrypted, zipCrypto, encryptionStrength) {
|
|
4800
|
+
return encrypted ? (zipCrypto ? 12 : 16 + encryptionStrength * 4) : 0;
|
|
4801
|
+
}
|
|
4802
|
+
|
|
4677
4803
|
/*
|
|
4678
4804
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
4679
4805
|
|
|
@@ -4733,6 +4859,8 @@ const WARNING_PREPENDED_CENTRAL_DIRECTORY = "prepended central directory";
|
|
|
4733
4859
|
const WARNING_TRAILING_CENTRAL_DIRECTORY_DATA = "trailing central directory data";
|
|
4734
4860
|
const WARNING_DUPLICATE_FILENAME = "duplicate filename";
|
|
4735
4861
|
const WARNING_MISMATCHED_ZIP64_END_OF_CENTRAL_DIRECTORY = "mismatched zip64 end of central directory record";
|
|
4862
|
+
const WARNING_MULTIPLE_END_OF_CENTRAL_DIRECTORY = "multiple end of central directory records";
|
|
4863
|
+
const WARNING_MISMATCHED_LOCAL_FILE_HEADER_FILENAME = "mismatched local file header (filename)";
|
|
4736
4864
|
const WARNING_MISMATCHED_LOCAL_FILE_HEADER_BIT_FLAG = "mismatched local file header (general purpose bit flag)";
|
|
4737
4865
|
const WARNING_MISMATCHED_LOCAL_FILE_HEADER_COMPRESSION_METHOD = "mismatched local file header (compression method)";
|
|
4738
4866
|
const WARNING_MISMATCHED_LOCAL_FILE_HEADER_CRC32_OR_SIZES = "mismatched local file header (crc32 or sizes)";
|
|
@@ -4803,7 +4931,7 @@ class ZipReader {
|
|
|
4803
4931
|
}
|
|
4804
4932
|
}
|
|
4805
4933
|
if (rejectAmbiguousEndOfDirectory && endOfDirectoryReachingEndCount > 1) {
|
|
4806
|
-
throwAmbiguousArchive(
|
|
4934
|
+
throwAmbiguousArchive(WARNING_MULTIPLE_END_OF_CENTRAL_DIRECTORY);
|
|
4807
4935
|
}
|
|
4808
4936
|
const endOfDirectoryView = getDataView(endOfDirectoryInfo);
|
|
4809
4937
|
let directoryDataLength = getUint32$1(endOfDirectoryView, 12);
|
|
@@ -5101,7 +5229,8 @@ class ZipReader {
|
|
|
5101
5229
|
const writer = new TransformStream();
|
|
5102
5230
|
const arrayBufferPromise = streamToBlob(writer.readable).then(blob => blob.arrayBuffer());
|
|
5103
5231
|
arrayBufferPromise.catch(() => { });
|
|
5104
|
-
await fileEntry.getData(writer, entry, zipReader.readRanges,
|
|
5232
|
+
await fileEntry.getData(writer, entry, zipReader.readRanges,
|
|
5233
|
+
Object.assign({}, options, { preventClose: false }));
|
|
5105
5234
|
return arrayBufferPromise;
|
|
5106
5235
|
};
|
|
5107
5236
|
offset = endOffset;
|
|
@@ -5182,48 +5311,101 @@ class ZipReader {
|
|
|
5182
5311
|
await reader.readable.cancel();
|
|
5183
5312
|
}
|
|
5184
5313
|
}
|
|
5314
|
+
|
|
5315
|
+
[SYMBOL_ASYNC_DISPOSE]() {
|
|
5316
|
+
return this.close();
|
|
5317
|
+
}
|
|
5185
5318
|
}
|
|
5186
5319
|
|
|
5187
5320
|
class ZipReaderStream {
|
|
5188
5321
|
|
|
5189
5322
|
constructor(options = {}) {
|
|
5190
|
-
|
|
5191
|
-
const
|
|
5323
|
+
let sourceController;
|
|
5324
|
+
const { readable, writable } = new TransformStream({
|
|
5325
|
+
start(controller) {
|
|
5326
|
+
sourceController = controller;
|
|
5327
|
+
}
|
|
5328
|
+
});
|
|
5329
|
+
const zipReader = new ZipReader(readable, options);
|
|
5330
|
+
const gen = zipReader.getEntriesGenerator();
|
|
5331
|
+
const pendingEntries = new Set();
|
|
5192
5332
|
this.readable = new ReadableStream({
|
|
5193
5333
|
async pull(controller) {
|
|
5194
5334
|
const { done, value } = await gen.next();
|
|
5195
5335
|
if (done)
|
|
5196
5336
|
return controller.close();
|
|
5337
|
+
const entryStream = createEntryStream(value, pendingEntries);
|
|
5197
5338
|
const chunk = {
|
|
5198
5339
|
...value,
|
|
5199
|
-
readable:
|
|
5200
|
-
const { readable, writable } = new TransformStream();
|
|
5201
|
-
if (value.getData) {
|
|
5202
|
-
getData();
|
|
5203
|
-
return readable;
|
|
5204
|
-
}
|
|
5205
|
-
|
|
5206
|
-
async function getData() {
|
|
5207
|
-
try {
|
|
5208
|
-
await value.getData(writable);
|
|
5209
|
-
} catch (error) {
|
|
5210
|
-
try {
|
|
5211
|
-
await writable.abort(error);
|
|
5212
|
-
} catch {
|
|
5213
|
-
// ignored
|
|
5214
|
-
}
|
|
5215
|
-
}
|
|
5216
|
-
}
|
|
5217
|
-
})()
|
|
5340
|
+
readable: entryStream.readable
|
|
5218
5341
|
};
|
|
5219
5342
|
delete chunk.getData;
|
|
5343
|
+
Object.defineProperties(chunk, {
|
|
5344
|
+
localDirectory: {
|
|
5345
|
+
get: () => value.localDirectory,
|
|
5346
|
+
enumerable: true
|
|
5347
|
+
},
|
|
5348
|
+
warnings: {
|
|
5349
|
+
get: () => value.warnings,
|
|
5350
|
+
enumerable: true
|
|
5351
|
+
}
|
|
5352
|
+
});
|
|
5220
5353
|
controller.enqueue(chunk);
|
|
5354
|
+
},
|
|
5355
|
+
async cancel(reason) {
|
|
5356
|
+
const entryStreams = Array.from(pendingEntries);
|
|
5357
|
+
pendingEntries.clear();
|
|
5358
|
+
sourceController.error(reason);
|
|
5359
|
+
await Promise.allSettled(entryStreams.map(entryStream => entryStream.cancel(reason)));
|
|
5360
|
+
await Promise.allSettled([gen.return(), zipReader.close()]);
|
|
5221
5361
|
}
|
|
5222
5362
|
});
|
|
5223
5363
|
this.writable = writable;
|
|
5224
5364
|
}
|
|
5225
5365
|
}
|
|
5226
5366
|
|
|
5367
|
+
function createEntryStream(entry, pendingEntries) {
|
|
5368
|
+
const { readable, writable } = new TransformStream();
|
|
5369
|
+
let dataReader;
|
|
5370
|
+
const entryStream = {
|
|
5371
|
+
cancel: async reason => {
|
|
5372
|
+
pendingEntries.delete(entryStream);
|
|
5373
|
+
await (dataReader ? dataReader.cancel(reason) : readable.cancel(reason));
|
|
5374
|
+
}
|
|
5375
|
+
};
|
|
5376
|
+
entryStream.readable = new ReadableStream({
|
|
5377
|
+
async pull(controller) {
|
|
5378
|
+
if (!dataReader) {
|
|
5379
|
+
dataReader = readable.getReader();
|
|
5380
|
+
pendingEntries.add(entryStream);
|
|
5381
|
+
getData();
|
|
5382
|
+
}
|
|
5383
|
+
const { done, value } = await dataReader.read();
|
|
5384
|
+
if (done) {
|
|
5385
|
+
controller.close();
|
|
5386
|
+
} else {
|
|
5387
|
+
controller.enqueue(value);
|
|
5388
|
+
}
|
|
5389
|
+
},
|
|
5390
|
+
cancel: reason => entryStream.cancel(reason)
|
|
5391
|
+
}, { highWaterMark: 0 });
|
|
5392
|
+
return entryStream;
|
|
5393
|
+
|
|
5394
|
+
async function getData() {
|
|
5395
|
+
try {
|
|
5396
|
+
await entry.getData(writable, { preventClose: false });
|
|
5397
|
+
} catch (error) {
|
|
5398
|
+
try {
|
|
5399
|
+
await writable.abort(error);
|
|
5400
|
+
} catch {
|
|
5401
|
+
// ignored
|
|
5402
|
+
}
|
|
5403
|
+
} finally {
|
|
5404
|
+
pendingEntries.delete(entryStream);
|
|
5405
|
+
}
|
|
5406
|
+
}
|
|
5407
|
+
}
|
|
5408
|
+
|
|
5227
5409
|
async function isZipFile(reader, options = {}) {
|
|
5228
5410
|
reader = new GenericReader(reader);
|
|
5229
5411
|
await initStream(reader);
|
|
@@ -5283,7 +5465,9 @@ let ZipEntry$1 = class ZipEntry {
|
|
|
5283
5465
|
const dataView = getDataView(dataArray);
|
|
5284
5466
|
let password = getOptionValue$1(zipEntry, options, OPTION_PASSWORD);
|
|
5285
5467
|
let rawPassword = getOptionValue$1(zipEntry, options, OPTION_RAW_PASSWORD);
|
|
5286
|
-
const passThrough = getOptionValue$1(zipEntry, options, OPTION_PASS_THROUGH);
|
|
5468
|
+
const passThrough = checkPassThroughOption(getOptionValue$1(zipEntry, options, OPTION_PASS_THROUGH));
|
|
5469
|
+
const passThroughCompression = Boolean(passThrough);
|
|
5470
|
+
const passThroughEncryption = passThrough === true;
|
|
5287
5471
|
checkPasswordOption(password, rawPassword);
|
|
5288
5472
|
password = password && password.length && password;
|
|
5289
5473
|
rawPassword = rawPassword && rawPassword.length && rawPassword;
|
|
@@ -5304,7 +5488,9 @@ let ZipEntry$1 = class ZipEntry {
|
|
|
5304
5488
|
const checkLocalDirectoryOption = getOptionValue$1(zipEntry, options, OPTION_CHECK_LOCAL_DIRECTORY);
|
|
5305
5489
|
const entryStrictness = getStrictness(options, zipEntry.options);
|
|
5306
5490
|
const checkLocalDirectory = getCheckLocalDirectory(checkLocalDirectoryOption, entryStrictness);
|
|
5307
|
-
const
|
|
5491
|
+
const checkLocalFilenameOption = getOptionValue$1(zipEntry, options, OPTION_CHECK_LOCAL_FILENAME);
|
|
5492
|
+
const checkLocalFilename = getCheckLocalFilename(
|
|
5493
|
+
checkLocalFilenameOption === UNDEFINED_VALUE ? checkLocalDirectoryOption : checkLocalFilenameOption, entryStrictness);
|
|
5308
5494
|
let rawLocalFilename = EMPTY_UINT8_ARRAY;
|
|
5309
5495
|
if (checkLocalFilename && (filenameLength || extraFieldLength)) {
|
|
5310
5496
|
const trailingDataArray = await readUint8Array(reader, localHeaderOffset + HEADER_SIZE, filenameLength + extraFieldLength);
|
|
@@ -5335,16 +5521,17 @@ let ZipEntry$1 = class ZipEntry {
|
|
|
5335
5521
|
if (gid !== UNDEFINED_VALUE && fileEntry.gid === UNDEFINED_VALUE) {
|
|
5336
5522
|
fileEntry.gid = gid;
|
|
5337
5523
|
}
|
|
5338
|
-
const
|
|
5524
|
+
const checkPasswordOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_PASSWORD_ONLY);
|
|
5525
|
+
const encrypted = zipEntry.encrypted && localDirectory.encrypted && (!passThroughEncryption || checkPasswordOnly);
|
|
5339
5526
|
const zipCrypto = encrypted && !extraFieldAES;
|
|
5340
|
-
if (!
|
|
5527
|
+
if (!passThroughEncryption) {
|
|
5341
5528
|
fileEntry.zipCrypto = zipCrypto;
|
|
5342
5529
|
}
|
|
5343
5530
|
if (encrypted && (localDirectory.rawBitFlag & BITFLAG_STRONG_ENCRYPTION) == BITFLAG_STRONG_ENCRYPTION) {
|
|
5344
5531
|
throw new Error(ERR_UNSUPPORTED_ENCRYPTION);
|
|
5345
5532
|
}
|
|
5346
|
-
const registeredCodec =
|
|
5347
|
-
if (compressionMethod != COMPRESSION_METHOD_STORE && compressionMethod != COMPRESSION_METHOD_DEFLATE && compressionMethod != COMPRESSION_METHOD_DEFLATE_64 && !registeredCodec && !
|
|
5533
|
+
const registeredCodec = passThroughCompression ? UNDEFINED_VALUE : getRegisteredCodec(compressionMethod);
|
|
5534
|
+
if (compressionMethod != COMPRESSION_METHOD_STORE && compressionMethod != COMPRESSION_METHOD_DEFLATE && compressionMethod != COMPRESSION_METHOD_DEFLATE_64 && !registeredCodec && !passThroughCompression) {
|
|
5348
5535
|
throw new Error(ERR_UNSUPPORTED_COMPRESSION);
|
|
5349
5536
|
}
|
|
5350
5537
|
if (encrypted) {
|
|
@@ -5360,15 +5547,17 @@ let ZipEntry$1 = class ZipEntry {
|
|
|
5360
5547
|
const size = compressedSize;
|
|
5361
5548
|
const readable = toCompatibleReadable(reader.createReadable({ offset: dataOffset, size }));
|
|
5362
5549
|
const signal = checkSignalOption(getOptionValue$1(zipEntry, options, OPTION_SIGNAL));
|
|
5363
|
-
|
|
5550
|
+
throwIfAborted(signal);
|
|
5364
5551
|
let checkOverlappingEntry = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY);
|
|
5365
5552
|
const checkOverlappingEntryOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY_ONLY);
|
|
5366
5553
|
if (checkOverlappingEntryOnly) {
|
|
5367
5554
|
checkOverlappingEntry = true;
|
|
5368
5555
|
}
|
|
5369
5556
|
const { onstart, onprogress, onend } = options;
|
|
5370
|
-
const compressed = compressionMethod != COMPRESSION_METHOD_STORE && !
|
|
5371
|
-
const outputSize =
|
|
5557
|
+
const compressed = compressionMethod != COMPRESSION_METHOD_STORE && !passThroughCompression;
|
|
5558
|
+
const outputSize = passThroughCompression ?
|
|
5559
|
+
compressedSize - getEncryptionOverhead(encrypted, zipCrypto, extraFieldAES && extraFieldAES.strength) :
|
|
5560
|
+
uncompressedSize;
|
|
5372
5561
|
const deflate64 = compressionMethod == COMPRESSION_METHOD_DEFLATE_64;
|
|
5373
5562
|
let useCompressionStream = getOptionValue$1(zipEntry, options, OPTION_USE_COMPRESSION_STREAM);
|
|
5374
5563
|
if (deflate64) {
|
|
@@ -5377,7 +5566,7 @@ let ZipEntry$1 = class ZipEntry {
|
|
|
5377
5566
|
const checkCrc32Option = getOptionValue$1(zipEntry, options, OPTION_CHECK_CRC32);
|
|
5378
5567
|
const checkCrc32 = (checkCrc32Option === UNDEFINED_VALUE ?
|
|
5379
5568
|
getOptionValue$1(zipEntry, options, OPTION_CHECK_SIGNATURE) :
|
|
5380
|
-
checkCrc32Option) && !
|
|
5569
|
+
checkCrc32Option) && !passThroughCompression &&
|
|
5381
5570
|
(!encrypted || zipCrypto || (extraFieldAES && extraFieldAES.vendorVersion == VENDOR_VERSION_AE_1$1));
|
|
5382
5571
|
const workerOptions = {
|
|
5383
5572
|
options: {
|
|
@@ -5431,10 +5620,10 @@ let ZipEntry$1 = class ZipEntry {
|
|
|
5431
5620
|
await initStream(writer, getDecodableOutputSize(outputSize, compressedSize, compressed));
|
|
5432
5621
|
({ writable } = writer);
|
|
5433
5622
|
const { outputSize: writtenSize } = await runWorker({ readable, writable }, workerOptions);
|
|
5434
|
-
writer.size += writtenSize;
|
|
5435
5623
|
if (writtenSize != outputSize) {
|
|
5436
|
-
throw new Error(ERR_INVALID_UNCOMPRESSED_SIZE);
|
|
5624
|
+
throw Object.assign(new Error(ERR_INVALID_UNCOMPRESSED_SIZE), { outputSize: writtenSize });
|
|
5437
5625
|
}
|
|
5626
|
+
writer.size += writtenSize;
|
|
5438
5627
|
}
|
|
5439
5628
|
} catch (error) {
|
|
5440
5629
|
if (error.outputSize !== UNDEFINED_VALUE) {
|
|
@@ -6100,7 +6289,7 @@ function validateLocalDirectory(zipEntry, localDirectory, rawLocalFilename, chec
|
|
|
6100
6289
|
if (checkLocalFilename && !maskedLocalDirectory &&
|
|
6101
6290
|
(rawLocalFilename.length != rawFilename.length ||
|
|
6102
6291
|
rawLocalFilename.some((byteValue, indexByte) => byteValue != rawFilename[indexByte]))) {
|
|
6103
|
-
reportAmbiguity(reject, warnings,
|
|
6292
|
+
reportAmbiguity(reject, warnings, WARNING_MISMATCHED_LOCAL_FILE_HEADER_FILENAME);
|
|
6104
6293
|
}
|
|
6105
6294
|
if ((localDirectory.rawBitFlag & BITFLAG_AMBIGUITY_MASK) != (zipEntry.rawBitFlag & BITFLAG_AMBIGUITY_MASK)) {
|
|
6106
6295
|
reportAmbiguity(reject, warnings, WARNING_MISMATCHED_LOCAL_FILE_HEADER_BIT_FLAG);
|
|
@@ -6125,16 +6314,6 @@ function reportAmbiguity(reject, warnings, reason) {
|
|
|
6125
6314
|
}
|
|
6126
6315
|
}
|
|
6127
6316
|
|
|
6128
|
-
function addWarning(warnings, reason, filename) {
|
|
6129
|
-
if (!warnings.some(warning => warning.reason == reason)) {
|
|
6130
|
-
const warning = { reason };
|
|
6131
|
-
if (filename !== UNDEFINED_VALUE) {
|
|
6132
|
-
warning.filename = filename;
|
|
6133
|
-
}
|
|
6134
|
-
warnings.push(warning);
|
|
6135
|
-
}
|
|
6136
|
-
}
|
|
6137
|
-
|
|
6138
6317
|
function throwAmbiguousArchive(reason) {
|
|
6139
6318
|
const error = new Error(ERR_AMBIGUOUS_ARCHIVE);
|
|
6140
6319
|
error.reason = reason;
|
|
@@ -6214,7 +6393,9 @@ var zipReader = /*#__PURE__*/Object.freeze({
|
|
|
6214
6393
|
WARNING_MISMATCHED_LOCAL_FILE_HEADER_BIT_FLAG: WARNING_MISMATCHED_LOCAL_FILE_HEADER_BIT_FLAG,
|
|
6215
6394
|
WARNING_MISMATCHED_LOCAL_FILE_HEADER_COMPRESSION_METHOD: WARNING_MISMATCHED_LOCAL_FILE_HEADER_COMPRESSION_METHOD,
|
|
6216
6395
|
WARNING_MISMATCHED_LOCAL_FILE_HEADER_CRC32_OR_SIZES: WARNING_MISMATCHED_LOCAL_FILE_HEADER_CRC32_OR_SIZES,
|
|
6396
|
+
WARNING_MISMATCHED_LOCAL_FILE_HEADER_FILENAME: WARNING_MISMATCHED_LOCAL_FILE_HEADER_FILENAME,
|
|
6217
6397
|
WARNING_MISMATCHED_ZIP64_END_OF_CENTRAL_DIRECTORY: WARNING_MISMATCHED_ZIP64_END_OF_CENTRAL_DIRECTORY,
|
|
6398
|
+
WARNING_MULTIPLE_END_OF_CENTRAL_DIRECTORY: WARNING_MULTIPLE_END_OF_CENTRAL_DIRECTORY,
|
|
6218
6399
|
WARNING_PREPENDED_CENTRAL_DIRECTORY: WARNING_PREPENDED_CENTRAL_DIRECTORY,
|
|
6219
6400
|
WARNING_PREPENDED_DATA: WARNING_PREPENDED_DATA,
|
|
6220
6401
|
WARNING_TRAILING_CENTRAL_DIRECTORY_DATA: WARNING_TRAILING_CENTRAL_DIRECTORY_DATA,
|
|
@@ -6267,7 +6448,7 @@ const ERR_INVALID_VERSION = "Version exceeds 65535";
|
|
|
6267
6448
|
const ERR_INVALID_ENCRYPTION_STRENGTH = "The strength must equal 1, 2, or 3";
|
|
6268
6449
|
const ERR_UNSUPPORTED_ENCRYPTION_USDZ = "Encryption is not supported in USDZ files";
|
|
6269
6450
|
const ERR_UNSUPPORTED_SPLIT_USDZ = "Split zip files are not supported in USDZ files";
|
|
6270
|
-
const ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH = "Encryption is not supported when the 'passThrough' option is set";
|
|
6451
|
+
const ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH = "Encryption is not supported when the 'passThrough' option is set to true (use 'compressed' instead)";
|
|
6271
6452
|
const ERR_INVALID_EXTRAFIELD = "Invalid extra field (must be a Map)";
|
|
6272
6453
|
const ERR_INVALID_EXTRAFIELD_TYPE = "Invalid extra field type (must be integer 0..65535)";
|
|
6273
6454
|
const ERR_INVALID_EXTRAFIELD_DATA_TYPE = "Invalid extra field data (must be a Uint8Array)";
|
|
@@ -6279,6 +6460,7 @@ const MAX_NTFS_TIME = BigInt("0x7fffffffffffffff");
|
|
|
6279
6460
|
const ERR_UNSUPPORTED_FORMAT = "Zip64 is not supported (set the 'zip64' option to 'true')";
|
|
6280
6461
|
const ERR_UNDEFINED_UNCOMPRESSED_SIZE = "Undefined uncompressed size";
|
|
6281
6462
|
const ERR_UNDEFINED_COMPRESSION_METHOD = "Undefined compression method";
|
|
6463
|
+
const ERR_UNDEFINED_CRC32 = "Undefined CRC32";
|
|
6282
6464
|
const ERR_UNDETERMINED_SIZE = "Undetermined size";
|
|
6283
6465
|
const ERR_UNDEFINED_READER = "Undefined reader";
|
|
6284
6466
|
const ERR_INVALID_READER = "Invalid reader (must be a Reader instance, a ReadableStream instance, or an object with a 'readable' property)";
|
|
@@ -6292,14 +6474,21 @@ const ERR_INVALID_MSDOS_ATTRIBUTES = "Invalid msdosAttributesRaw (must be intege
|
|
|
6292
6474
|
const ERR_INVALID_MSDOS_DATA = "Invalid msdosAttributes (must be an object with boolean flags)";
|
|
6293
6475
|
const ERR_INVALID_LEVEL = "Invalid level (must be integer 0..9)";
|
|
6294
6476
|
const ERR_INVALID_SIGNATURE_DATA = "Signature data exceeds 64KB";
|
|
6477
|
+
const ERR_INVALID_ENTRY = "Invalid entry option (must be an entry returned by ZipReader#getEntries())";
|
|
6478
|
+
const ERR_ZIP_CRYPTO_LAST_MOD_DATE = "The last modification date of an entry encrypted with ZipCrypto cannot be changed when passThrough is set";
|
|
6479
|
+
const WARNING_COMPRESSION_UNAVAILABLE = "compression unavailable";
|
|
6480
|
+
const WARNING_CLAMPED_LAST_MODIFICATION_DATE = "clamped last modification date";
|
|
6295
6481
|
|
|
6296
6482
|
const EXTRAFIELD_DATA_AES = new Uint8Array([0x07, 0x00, 0x02, 0x00, 0x41, 0x45, 0x03, 0x00, 0x00]);
|
|
6297
6483
|
const EXTRAFIELD_OFFSET_AES_VENDOR_VERSION = 4;
|
|
6298
6484
|
const EXTRAFIELD_OFFSET_AES_COMPRESSION_METHOD = 9;
|
|
6299
6485
|
const EXTRAFIELD_USDZ_MAX_LENGTH = 67;
|
|
6486
|
+
const MIN_PRINTABLE_ASCII_CHARACTER_CODE = 0x20;
|
|
6487
|
+
const MAX_PRINTABLE_ASCII_CHARACTER_CODE = 0x7e;
|
|
6300
6488
|
const VENDOR_VERSION_AE_1 = 1;
|
|
6301
|
-
const INFOZIP_EXTRA_FIELD_TYPE
|
|
6489
|
+
const INFOZIP_EXTRA_FIELD_TYPE = "infozip";
|
|
6302
6490
|
const UNIX_EXTRA_FIELD_TYPE = "unix";
|
|
6491
|
+
const LEVEL_BY_BITFLAG_LEVEL = [8, 9, 5, 3];
|
|
6303
6492
|
const MAX_LEVEL = 9;
|
|
6304
6493
|
|
|
6305
6494
|
let workers = 0;
|
|
@@ -6326,9 +6515,11 @@ class ZipWriter {
|
|
|
6326
6515
|
initialOffset: options[OPTION_OFFSET] === UNDEFINED_VALUE ? 0 : options[OPTION_OFFSET] - (writer.size || writer.writable.size || 0),
|
|
6327
6516
|
pendingAddFileCalls: new Set(),
|
|
6328
6517
|
pendingErrors: [],
|
|
6518
|
+
warnings: [],
|
|
6329
6519
|
bufferedWrites: 0,
|
|
6330
6520
|
directWrites: 0,
|
|
6331
|
-
lastFileEntry: UNDEFINED_VALUE
|
|
6521
|
+
lastFileEntry: UNDEFINED_VALUE,
|
|
6522
|
+
archiveClosed: false
|
|
6332
6523
|
});
|
|
6333
6524
|
}
|
|
6334
6525
|
|
|
@@ -6493,6 +6684,9 @@ class ZipWriter {
|
|
|
6493
6684
|
const zipWriter = this;
|
|
6494
6685
|
const { pendingAddFileCalls, writer } = this;
|
|
6495
6686
|
const { writable } = writer;
|
|
6687
|
+
if (zipWriter.archiveClosed) {
|
|
6688
|
+
return getWriterData(writer);
|
|
6689
|
+
}
|
|
6496
6690
|
if (!(comment instanceof Uint8Array)) {
|
|
6497
6691
|
throw new Error(ERR_INVALID_COMMENT_TYPE);
|
|
6498
6692
|
}
|
|
@@ -6516,11 +6710,16 @@ class ZipWriter {
|
|
|
6516
6710
|
throw error;
|
|
6517
6711
|
}
|
|
6518
6712
|
await closeFile(zipWriter, comment, options);
|
|
6713
|
+
zipWriter.archiveClosed = true;
|
|
6519
6714
|
const preventClose = !ownsWritable(writer) && getOptionValue(zipWriter, options, OPTION_PREVENT_CLOSE);
|
|
6520
6715
|
if (!preventClose) {
|
|
6521
6716
|
await writable.getWriter().close();
|
|
6522
6717
|
}
|
|
6523
|
-
return writer
|
|
6718
|
+
return getWriterData(writer);
|
|
6719
|
+
}
|
|
6720
|
+
|
|
6721
|
+
[SYMBOL_ASYNC_DISPOSE]() {
|
|
6722
|
+
return this.close();
|
|
6524
6723
|
}
|
|
6525
6724
|
}
|
|
6526
6725
|
|
|
@@ -6599,6 +6798,10 @@ class WatchedPromise extends Promise {
|
|
|
6599
6798
|
}
|
|
6600
6799
|
}
|
|
6601
6800
|
|
|
6801
|
+
function getWriterData(writer) {
|
|
6802
|
+
return writer.getData ? writer.getData() : writer.writable;
|
|
6803
|
+
}
|
|
6804
|
+
|
|
6602
6805
|
function watchPromiseError(zipWriter, promise) {
|
|
6603
6806
|
const watchedPromise = new WatchedPromise((resolve, reject) => Promise.prototype.then.call(promise, resolve, reject));
|
|
6604
6807
|
const watcher = {};
|
|
@@ -6617,6 +6820,14 @@ async function prependZipEntries(zipWriter, reader) {
|
|
|
6617
6820
|
|
|
6618
6821
|
async function addFileEntry(zipWriter, name, reader, options) {
|
|
6619
6822
|
options = Object.assign({}, options);
|
|
6823
|
+
const entry = options[OPTION_ENTRY];
|
|
6824
|
+
if (entry !== UNDEFINED_VALUE) {
|
|
6825
|
+
const { entryOptions, passThroughOptions } = getSourceEntryOptions(entry,
|
|
6826
|
+
checkPassThroughOption(getOptionValue(zipWriter, options, OPTION_PASS_THROUGH)),
|
|
6827
|
+
getOptionValue(zipWriter, options, PROPERTY_NAME_LAST_MODIFICATION_DATE));
|
|
6828
|
+
delete options[OPTION_ENTRY];
|
|
6829
|
+
options = Object.assign(entryOptions, passThroughOptions, options);
|
|
6830
|
+
}
|
|
6620
6831
|
if (getOptionValue(zipWriter, options, PROPERTY_NAME_DIRECTORY) && !name.endsWith(DIRECTORY_SIGNATURE)) {
|
|
6621
6832
|
name += DIRECTORY_SIGNATURE;
|
|
6622
6833
|
}
|
|
@@ -6681,21 +6892,33 @@ async function addFile(zipWriter, name, reader, options) {
|
|
|
6681
6892
|
try {
|
|
6682
6893
|
const { resolvedOptions } = metadataInfo;
|
|
6683
6894
|
if (resolvedOptions.level != 0 && resolvedOptions.compressionMethod === UNDEFINED_VALUE &&
|
|
6684
|
-
!resolvedOptions.
|
|
6895
|
+
!resolvedOptions.passThroughCompression && !(await supportsDeflate(getConfiguration()))) {
|
|
6685
6896
|
resolvedOptions.level = 0;
|
|
6897
|
+
addWarning(zipWriter.warnings, WARNING_COMPRESSION_UNAVAILABLE, name);
|
|
6686
6898
|
}
|
|
6687
6899
|
const sizesInfo = await resolveSizes(zipWriter, reader, metadataInfo, options);
|
|
6688
6900
|
({ reader } = sizesInfo);
|
|
6689
6901
|
const diskOffset = getDiskOffset(zipWriter.writer);
|
|
6690
6902
|
const diskNumber = getDiskNumber(zipWriter.writer);
|
|
6903
|
+
let crc32 = options.crc32 === UNDEFINED_VALUE ? options[PROPERTY_NAME_SIGNATURE] : options.crc32;
|
|
6904
|
+
const storesAE2 = sizesInfo.resolvedOptions.encrypted && !resolvedOptions.zipCrypto;
|
|
6905
|
+
if (resolvedOptions.passThroughCompression && !resolvedOptions.passThroughEncryption && storesAE2) {
|
|
6906
|
+
crc32 = UNDEFINED_VALUE;
|
|
6907
|
+
}
|
|
6908
|
+
if (resolvedOptions.passThroughCompression && reader && !storesAE2 && crc32 === UNDEFINED_VALUE) {
|
|
6909
|
+
throw new Error(ERR_UNDEFINED_CRC32);
|
|
6910
|
+
}
|
|
6691
6911
|
options = Object.assign({}, options, attributesInfo.resolvedOptions, metadataInfo.resolvedOptions, sizesInfo.resolvedOptions, {
|
|
6692
6912
|
signature: options[PROPERTY_NAME_SIGNATURE],
|
|
6693
|
-
crc32
|
|
6913
|
+
crc32,
|
|
6694
6914
|
offset: zipWriter.offset - diskOffset,
|
|
6695
6915
|
diskNumberStart: diskNumber,
|
|
6696
6916
|
[OPTION_USDZ]: zipWriter.options[OPTION_USDZ]
|
|
6697
6917
|
});
|
|
6698
6918
|
const headerInfo = getHeaderInfo(options);
|
|
6919
|
+
if (headerInfo.lastModDateClamped) {
|
|
6920
|
+
addWarning(zipWriter.warnings, WARNING_CLAMPED_LAST_MODIFICATION_DATE, name);
|
|
6921
|
+
}
|
|
6699
6922
|
const dataDescriptorInfo = getDataDescriptorInfo(options);
|
|
6700
6923
|
const metadataSize = getLength(headerInfo.localHeaderArray, dataDescriptorInfo.dataDescriptorArray);
|
|
6701
6924
|
fileEntry = await getFileEntry(zipWriter, name, reader, {
|
|
@@ -6722,6 +6945,95 @@ async function addFile(zipWriter, name, reader, options) {
|
|
|
6722
6945
|
return new Entry(fileEntry);
|
|
6723
6946
|
}
|
|
6724
6947
|
|
|
6948
|
+
function getSourceEntryOptions(entry, passThrough, lastModDateOverride) {
|
|
6949
|
+
if (entry === null || typeof entry != OBJECT_TYPE || Array.isArray(entry)) {
|
|
6950
|
+
throw new Error(ERR_INVALID_ENTRY);
|
|
6951
|
+
}
|
|
6952
|
+
const {
|
|
6953
|
+
externalFileAttributes,
|
|
6954
|
+
versionMadeBy,
|
|
6955
|
+
comment,
|
|
6956
|
+
lastModDate,
|
|
6957
|
+
rawLastModDate,
|
|
6958
|
+
creationDate,
|
|
6959
|
+
lastAccessDate,
|
|
6960
|
+
uncompressedSize,
|
|
6961
|
+
encrypted,
|
|
6962
|
+
zipCrypto,
|
|
6963
|
+
crc32,
|
|
6964
|
+
compressionMethod,
|
|
6965
|
+
extraFieldAES,
|
|
6966
|
+
extraFieldUnix,
|
|
6967
|
+
internalFileAttributes,
|
|
6968
|
+
extraField,
|
|
6969
|
+
bitFlag,
|
|
6970
|
+
directory,
|
|
6971
|
+
uid,
|
|
6972
|
+
gid
|
|
6973
|
+
} = entry;
|
|
6974
|
+
const entryOptions = {
|
|
6975
|
+
externalFileAttributes,
|
|
6976
|
+
versionMadeBy,
|
|
6977
|
+
comment,
|
|
6978
|
+
lastModDate,
|
|
6979
|
+
creationDate,
|
|
6980
|
+
lastAccessDate,
|
|
6981
|
+
internalFileAttributes,
|
|
6982
|
+
directory
|
|
6983
|
+
};
|
|
6984
|
+
if (bitFlag && bitFlag.languageEncodingFlag) {
|
|
6985
|
+
entryOptions[OPTION_USE_UNICODE_FILE_NAMES] = true;
|
|
6986
|
+
}
|
|
6987
|
+
const userExtraField = getUserExtraField(extraField);
|
|
6988
|
+
if (userExtraField) {
|
|
6989
|
+
entryOptions[PROPERTY_NAME_EXTRA_FIELD] = userExtraField;
|
|
6990
|
+
}
|
|
6991
|
+
if (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE) {
|
|
6992
|
+
Object.assign(entryOptions, {
|
|
6993
|
+
uid,
|
|
6994
|
+
gid,
|
|
6995
|
+
unixExtraFieldType: extraFieldUnix ? UNIX_EXTRA_FIELD_TYPE : INFOZIP_EXTRA_FIELD_TYPE
|
|
6996
|
+
});
|
|
6997
|
+
}
|
|
6998
|
+
const passThroughOptions = {};
|
|
6999
|
+
if (passThrough && !directory) {
|
|
7000
|
+
Object.assign(passThroughOptions, {
|
|
7001
|
+
uncompressedSize,
|
|
7002
|
+
crc32,
|
|
7003
|
+
compressionMethod
|
|
7004
|
+
});
|
|
7005
|
+
if (passThrough !== PASS_THROUGH_COMPRESSED) {
|
|
7006
|
+
Object.assign(passThroughOptions, {
|
|
7007
|
+
encrypted,
|
|
7008
|
+
zipCrypto,
|
|
7009
|
+
encryptionStrength: extraFieldAES ? extraFieldAES.strength : UNDEFINED_VALUE
|
|
7010
|
+
});
|
|
7011
|
+
}
|
|
7012
|
+
if (bitFlag) {
|
|
7013
|
+
passThroughOptions.dataDescriptor = bitFlag.dataDescriptor;
|
|
7014
|
+
passThroughOptions[OPTION_LEVEL] = LEVEL_BY_BITFLAG_LEVEL[bitFlag.level];
|
|
7015
|
+
}
|
|
7016
|
+
if (lastModDateOverride === UNDEFINED_VALUE) {
|
|
7017
|
+
passThroughOptions.rawLastModDate = rawLastModDate;
|
|
7018
|
+
} else if (passThrough !== PASS_THROUGH_COMPRESSED && zipCrypto && (!bitFlag || bitFlag.dataDescriptor) &&
|
|
7019
|
+
lastModDateOverride instanceof Date &&
|
|
7020
|
+
getDosTimeHighByte(lastModDateOverride) != ((rawLastModDate >>> 8) & MAX_8_BITS)) {
|
|
7021
|
+
throw new Error(ERR_ZIP_CRYPTO_LAST_MOD_DATE);
|
|
7022
|
+
}
|
|
7023
|
+
}
|
|
7024
|
+
return { entryOptions, passThroughOptions };
|
|
7025
|
+
}
|
|
7026
|
+
|
|
7027
|
+
function getDosTimeHighByte(lastModDate) {
|
|
7028
|
+
let dosLastModDate = new Date(Math.ceil(Math.floor(lastModDate.getTime() / 1000) / 2) * 2000);
|
|
7029
|
+
if (dosLastModDate < MIN_DATE) {
|
|
7030
|
+
dosLastModDate = MIN_DATE;
|
|
7031
|
+
} else if (dosLastModDate > MAX_DATE) {
|
|
7032
|
+
dosLastModDate = MAX_DATE;
|
|
7033
|
+
}
|
|
7034
|
+
return ((dosLastModDate.getHours() << 3) | (dosLastModDate.getMinutes() >> 3)) & MAX_8_BITS;
|
|
7035
|
+
}
|
|
7036
|
+
|
|
6725
7037
|
function resolveAttributes(zipWriter, name, options) {
|
|
6726
7038
|
let msDosCompatible = getOptionValue(zipWriter, options, PROPERTY_NAME_MS_DOS_COMPATIBLE);
|
|
6727
7039
|
let versionMadeBy = getOptionValue(zipWriter, options, PROPERTY_NAME_VERSION_MADE_BY, msDosCompatible ? VERSION_MADE_BY_MSDOS : VERSION_MADE_BY_UNIX);
|
|
@@ -6736,7 +7048,7 @@ function resolveAttributes(zipWriter, name, options) {
|
|
|
6736
7048
|
checkIntegerOption(uid, MAX_32_BITS, ERR_INVALID_UID);
|
|
6737
7049
|
checkIntegerOption(gid, MAX_32_BITS, ERR_INVALID_GID);
|
|
6738
7050
|
checkIntegerOption(unixMode, MAX_16_BITS, ERR_INVALID_UNIX_MODE);
|
|
6739
|
-
if (unixExtraFieldType !== UNDEFINED_VALUE && unixExtraFieldType !== INFOZIP_EXTRA_FIELD_TYPE
|
|
7051
|
+
if (unixExtraFieldType !== UNDEFINED_VALUE && unixExtraFieldType !== INFOZIP_EXTRA_FIELD_TYPE && unixExtraFieldType !== UNIX_EXTRA_FIELD_TYPE) {
|
|
6740
7052
|
throw new Error(ERR_INVALID_UNIX_EXTRA_FIELD_TYPE);
|
|
6741
7053
|
}
|
|
6742
7054
|
if (unixExtraFieldType === UNIX_EXTRA_FIELD_TYPE &&
|
|
@@ -6744,7 +7056,7 @@ function resolveAttributes(zipWriter, name, options) {
|
|
|
6744
7056
|
throw new Error(ERR_INVALID_UNIX_ID_SIZE);
|
|
6745
7057
|
}
|
|
6746
7058
|
if (unixExtraFieldType === UNDEFINED_VALUE && (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE)) {
|
|
6747
|
-
unixExtraFieldType = INFOZIP_EXTRA_FIELD_TYPE
|
|
7059
|
+
unixExtraFieldType = INFOZIP_EXTRA_FIELD_TYPE;
|
|
6748
7060
|
}
|
|
6749
7061
|
let msdosAttributesRaw = getNumberOptionValue(zipWriter, options, PROPERTY_NAME_MSDOS_ATTRIBUTES_RAW);
|
|
6750
7062
|
let msdosAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_MSDOS_ATTRIBUTES);
|
|
@@ -6875,7 +7187,9 @@ function resolveMetadata(zipWriter, name, options) {
|
|
|
6875
7187
|
const lastAccessDate = getDateOptionValue(zipWriter, options, PROPERTY_NAME_LAST_ACCESS_DATE);
|
|
6876
7188
|
const creationDate = getDateOptionValue(zipWriter, options, PROPERTY_NAME_CREATION_DATE);
|
|
6877
7189
|
const internalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES, 0);
|
|
6878
|
-
const passThrough = getOptionValue(zipWriter, options, OPTION_PASS_THROUGH);
|
|
7190
|
+
const passThrough = checkPassThroughOption(getOptionValue(zipWriter, options, OPTION_PASS_THROUGH));
|
|
7191
|
+
const passThroughCompression = Boolean(passThrough);
|
|
7192
|
+
const passThroughEncryption = passThrough === true;
|
|
6879
7193
|
const password = getOptionValue(zipWriter, options, OPTION_PASSWORD);
|
|
6880
7194
|
const rawPassword = getOptionValue(zipWriter, options, OPTION_RAW_PASSWORD);
|
|
6881
7195
|
checkPasswordOption(password, rawPassword);
|
|
@@ -6890,10 +7204,12 @@ function resolveMetadata(zipWriter, name, options) {
|
|
|
6890
7204
|
const createTempStream = getFunctionOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
6891
7205
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, true);
|
|
6892
7206
|
const signal = checkSignalOption(getOptionValue(zipWriter, options, OPTION_SIGNAL));
|
|
6893
|
-
|
|
7207
|
+
throwIfAborted(signal);
|
|
7208
|
+
const useUnicodeFileNames = getOptionValue(zipWriter, options, OPTION_USE_UNICODE_FILE_NAMES,
|
|
7209
|
+
!isPrintableASCIIText(rawFilename) || !isPrintableASCIIText(rawComment));
|
|
6894
7210
|
const compressionMethod = getOptionValue(zipWriter, options, PROPERTY_NAME_COMPRESSION_METHOD);
|
|
6895
|
-
const registeredCodec =
|
|
6896
|
-
if (!
|
|
7211
|
+
const registeredCodec = passThroughCompression || compressionMethod === UNDEFINED_VALUE ? UNDEFINED_VALUE : getRegisteredCodec(compressionMethod);
|
|
7212
|
+
if (!passThroughCompression && compressionMethod !== UNDEFINED_VALUE &&
|
|
6897
7213
|
compressionMethod !== COMPRESSION_METHOD_STORE && compressionMethod !== COMPRESSION_METHOD_DEFLATE && !registeredCodec) {
|
|
6898
7214
|
throw new Error(ERR_UNSUPPORTED_COMPRESSION);
|
|
6899
7215
|
}
|
|
@@ -6907,15 +7223,15 @@ function resolveMetadata(zipWriter, name, options) {
|
|
|
6907
7223
|
level = 0;
|
|
6908
7224
|
}
|
|
6909
7225
|
}
|
|
6910
|
-
if (
|
|
6911
|
-
level =
|
|
7226
|
+
if (passThroughCompression) {
|
|
7227
|
+
level = toNumber(options[OPTION_LEVEL]);
|
|
6912
7228
|
}
|
|
6913
7229
|
let useCompressionStream = getOptionValue(zipWriter, options, OPTION_USE_COMPRESSION_STREAM);
|
|
6914
7230
|
let dataDescriptor = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR);
|
|
6915
7231
|
if (bufferedWrite && dataDescriptor === UNDEFINED_VALUE) {
|
|
6916
7232
|
dataDescriptor = false;
|
|
6917
7233
|
}
|
|
6918
|
-
if (dataDescriptor === UNDEFINED_VALUE || (zipCrypto && !
|
|
7234
|
+
if (dataDescriptor === UNDEFINED_VALUE || (zipCrypto && !passThroughEncryption)) {
|
|
6919
7235
|
dataDescriptor = true;
|
|
6920
7236
|
}
|
|
6921
7237
|
if (level !== UNDEFINED_VALUE && level != 6) {
|
|
@@ -6939,7 +7255,8 @@ function resolveMetadata(zipWriter, name, options) {
|
|
|
6939
7255
|
lastAccessDate,
|
|
6940
7256
|
creationDate,
|
|
6941
7257
|
internalFileAttributes,
|
|
6942
|
-
|
|
7258
|
+
passThroughCompression,
|
|
7259
|
+
passThroughEncryption,
|
|
6943
7260
|
password,
|
|
6944
7261
|
rawPassword,
|
|
6945
7262
|
encryptionStrength,
|
|
@@ -7000,7 +7317,7 @@ function serializeExtraField(extraField) {
|
|
|
7000
7317
|
}
|
|
7001
7318
|
|
|
7002
7319
|
async function resolveSizes(zipWriter, reader, { resolvedOptions: metadata }, options) {
|
|
7003
|
-
if (metadata.
|
|
7320
|
+
if (metadata.passThroughCompression && !reader && !getOptionValue(zipWriter, options, PROPERTY_NAME_DIRECTORY)) {
|
|
7004
7321
|
throw new Error(ERR_UNDEFINED_READER);
|
|
7005
7322
|
}
|
|
7006
7323
|
let contentSize;
|
|
@@ -7016,12 +7333,12 @@ async function resolveSizes(zipWriter, reader, { resolvedOptions: metadata }, op
|
|
|
7016
7333
|
}
|
|
7017
7334
|
|
|
7018
7335
|
function resolveEntrySizes(zipWriter, hasContent, contentSize, metadata, options) {
|
|
7019
|
-
const {
|
|
7336
|
+
const { passThroughCompression, passThroughEncryption, zipCrypto, password, rawPassword, encryptionStrength } = metadata;
|
|
7020
7337
|
let { dataDescriptor, zip64, level, compressionMethod } = metadata;
|
|
7021
7338
|
let maximumCompressedSize = 0;
|
|
7022
7339
|
let uncompressedSize = 0;
|
|
7023
7340
|
let unknownSize = false;
|
|
7024
|
-
if (
|
|
7341
|
+
if (passThroughCompression && hasContent) {
|
|
7025
7342
|
uncompressedSize = options[PROPERTY_NAME_UNCOMPRESSED_SIZE];
|
|
7026
7343
|
if (uncompressedSize === UNDEFINED_VALUE) {
|
|
7027
7344
|
throw new Error(ERR_UNDEFINED_UNCOMPRESSED_SIZE);
|
|
@@ -7032,17 +7349,17 @@ function resolveEntrySizes(zipWriter, hasContent, contentSize, metadata, options
|
|
|
7032
7349
|
}
|
|
7033
7350
|
const zip64Enabled = zip64 === true;
|
|
7034
7351
|
const encrypted = getOptionValue(zipWriter, options, PROPERTY_NAME_ENCRYPTED);
|
|
7035
|
-
if (hasContent &&
|
|
7352
|
+
if (hasContent && passThroughEncryption && !encrypted && getLength(password, rawPassword)) {
|
|
7036
7353
|
throw new Error(ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH);
|
|
7037
7354
|
}
|
|
7038
|
-
const encryptedEntry = hasContent && (Boolean((password && getLength(password)) || (rawPassword && getLength(rawPassword))) || (
|
|
7355
|
+
const encryptedEntry = hasContent && (Boolean((password && getLength(password)) || (rawPassword && getLength(rawPassword))) || (passThroughEncryption && encrypted));
|
|
7039
7356
|
if (!hasContent) {
|
|
7040
7357
|
level = 0;
|
|
7041
7358
|
compressionMethod = COMPRESSION_METHOD_STORE;
|
|
7042
7359
|
}
|
|
7043
|
-
const encryptionOverhead = encryptedEntry
|
|
7360
|
+
const encryptionOverhead = getEncryptionOverhead(encryptedEntry, zipCrypto, encryptionStrength);
|
|
7044
7361
|
if (hasContent) {
|
|
7045
|
-
if (!
|
|
7362
|
+
if (!passThroughCompression) {
|
|
7046
7363
|
if (contentSize === UNDEFINED_VALUE) {
|
|
7047
7364
|
dataDescriptor = true;
|
|
7048
7365
|
if (zip64 || zip64 === UNDEFINED_VALUE) {
|
|
@@ -7055,10 +7372,12 @@ function resolveEntrySizes(zipWriter, hasContent, contentSize, metadata, options
|
|
|
7055
7372
|
}
|
|
7056
7373
|
} else {
|
|
7057
7374
|
options.uncompressedSize = uncompressedSize;
|
|
7058
|
-
maximumCompressedSize = contentSize === UNDEFINED_VALUE ?
|
|
7375
|
+
maximumCompressedSize = contentSize === UNDEFINED_VALUE ?
|
|
7376
|
+
getMaximumCompressedSize(uncompressedSize) + encryptionOverhead :
|
|
7377
|
+
contentSize + (passThroughEncryption ? 0 : encryptionOverhead);
|
|
7059
7378
|
}
|
|
7060
7379
|
}
|
|
7061
|
-
const emptyEntry = !encryptedEntry && (!hasContent || (contentSize === 0 && !
|
|
7380
|
+
const emptyEntry = !encryptedEntry && (!hasContent || (contentSize === 0 && !passThroughCompression)) && !isCompressed(compressionMethod, level);
|
|
7062
7381
|
if (emptyEntry && !zipCrypto && getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR) === UNDEFINED_VALUE) {
|
|
7063
7382
|
dataDescriptor = false;
|
|
7064
7383
|
}
|
|
@@ -7107,6 +7426,8 @@ async function getEntriesSize(writerOptions, entries, writeOrderGuaranteed, comm
|
|
|
7107
7426
|
const initialOffset = writerOptions[OPTION_OFFSET] === UNDEFINED_VALUE ? 0 : writerOptions[OPTION_OFFSET];
|
|
7108
7427
|
let offset = initialOffset;
|
|
7109
7428
|
let minimumEntrySize = INFINITY_VALUE;
|
|
7429
|
+
const entrySizes = [];
|
|
7430
|
+
const entriesAlreadyZip64 = new Set();
|
|
7110
7431
|
for (const entry of entries) {
|
|
7111
7432
|
let { name } = entry;
|
|
7112
7433
|
const { size } = entry;
|
|
@@ -7118,7 +7439,7 @@ async function getEntriesSize(writerOptions, entries, writeOrderGuaranteed, comm
|
|
|
7118
7439
|
({ name } = attributesInfo);
|
|
7119
7440
|
const { resolvedOptions: metadata } = resolveMetadata(zipWriter, name, options);
|
|
7120
7441
|
if (metadata.level != 0 && metadata.compressionMethod === UNDEFINED_VALUE &&
|
|
7121
|
-
!metadata.
|
|
7442
|
+
!metadata.passThroughCompression && !(await supportsDeflate(getConfiguration()))) {
|
|
7122
7443
|
metadata.level = 0;
|
|
7123
7444
|
}
|
|
7124
7445
|
const hasContent = !getOptionValue(zipWriter, options, PROPERTY_NAME_DIRECTORY);
|
|
@@ -7126,7 +7447,7 @@ async function getEntriesSize(writerOptions, entries, writeOrderGuaranteed, comm
|
|
|
7126
7447
|
throw new Error(ERR_UNDETERMINED_SIZE);
|
|
7127
7448
|
}
|
|
7128
7449
|
const { maximumCompressedSize, resolvedOptions: sizes } = resolveEntrySizes(zipWriter, hasContent, size, metadata, options);
|
|
7129
|
-
if (hasContent && !metadata.
|
|
7450
|
+
if (hasContent && !metadata.passThroughCompression && isCompressed(sizes.compressionMethod, sizes.level)) {
|
|
7130
7451
|
throw new Error(ERR_UNDETERMINED_SIZE);
|
|
7131
7452
|
}
|
|
7132
7453
|
const entryOptions = Object.assign({}, options, attributesInfo.resolvedOptions, metadata, sizes, { [OPTION_USDZ]: usdz });
|
|
@@ -7146,10 +7467,15 @@ async function getEntriesSize(writerOptions, entries, writeOrderGuaranteed, comm
|
|
|
7146
7467
|
compressedSize
|
|
7147
7468
|
}));
|
|
7148
7469
|
const entrySize = entryInfo.metadataSize + compressedSize;
|
|
7470
|
+
entrySizes.push(entrySize);
|
|
7471
|
+
entriesAlreadyZip64.add(Boolean(entryOptions.zip64Enabled ||
|
|
7472
|
+
entryOptions.uncompressedSize >= MAX_32_BITS || compressedSize >= MAX_32_BITS));
|
|
7149
7473
|
minimumEntrySize = Math.min(minimumEntrySize, entrySize);
|
|
7150
7474
|
offset += entrySize;
|
|
7151
7475
|
}
|
|
7152
|
-
const layoutDependsOnWriteOrder = files.size > 1 && (usdz ||
|
|
7476
|
+
const layoutDependsOnWriteOrder = files.size > 1 && (usdz ||
|
|
7477
|
+
(offset - minimumEntrySize >= MAX_32_BITS &&
|
|
7478
|
+
(entriesAlreadyZip64.size > 1 || countEntriesBefore4GB(entrySizes, initialOffset, true) != countEntriesBefore4GB(entrySizes, initialOffset, false))));
|
|
7153
7479
|
if (layoutDependsOnWriteOrder && !writeOrderGuaranteed) {
|
|
7154
7480
|
throw new Error(ERR_UNDETERMINED_SIZE);
|
|
7155
7481
|
}
|
|
@@ -7167,6 +7493,20 @@ async function getEntriesSize(writerOptions, entries, writeOrderGuaranteed, comm
|
|
|
7167
7493
|
return offset - initialOffset + directoryDataLength + commentLength + (zip64 ? ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH : END_OF_CENTRAL_DIR_LENGTH);
|
|
7168
7494
|
}
|
|
7169
7495
|
|
|
7496
|
+
function countEntriesBefore4GB(entrySizes, initialOffset, largestFirst) {
|
|
7497
|
+
const ordered = entrySizes.slice().sort((first, second) => largestFirst ? second - first : first - second);
|
|
7498
|
+
let position = initialOffset;
|
|
7499
|
+
let count = 0;
|
|
7500
|
+
for (const entrySize of ordered) {
|
|
7501
|
+
if (position >= MAX_32_BITS) {
|
|
7502
|
+
break;
|
|
7503
|
+
}
|
|
7504
|
+
position += entrySize;
|
|
7505
|
+
count++;
|
|
7506
|
+
}
|
|
7507
|
+
return count;
|
|
7508
|
+
}
|
|
7509
|
+
|
|
7170
7510
|
async function getFileEntry(zipWriter, name, reader, entryInfo, options) {
|
|
7171
7511
|
const {
|
|
7172
7512
|
fileEntries,
|
|
@@ -7342,6 +7682,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7342
7682
|
localExtraFieldZip64Length,
|
|
7343
7683
|
rawExtraFieldExtendedTimestamp,
|
|
7344
7684
|
extraFieldExtendedTimestampFlag,
|
|
7685
|
+
extraFieldExtendedTimestampTime,
|
|
7345
7686
|
rawExtraFieldNTFS,
|
|
7346
7687
|
rawExtraFieldUnix,
|
|
7347
7688
|
rawExtraFieldAES,
|
|
@@ -7354,6 +7695,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7354
7695
|
password,
|
|
7355
7696
|
rawPassword,
|
|
7356
7697
|
level,
|
|
7698
|
+
useUnicodeFileNames,
|
|
7357
7699
|
zip64,
|
|
7358
7700
|
zip64Enabled,
|
|
7359
7701
|
zip64UncompressedSize,
|
|
@@ -7388,7 +7730,8 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7388
7730
|
msdosAttributesRaw,
|
|
7389
7731
|
msdosAttributes,
|
|
7390
7732
|
useCompressionStream,
|
|
7391
|
-
|
|
7733
|
+
passThroughCompression,
|
|
7734
|
+
passThroughEncryption,
|
|
7392
7735
|
format,
|
|
7393
7736
|
codecURI
|
|
7394
7737
|
} = options;
|
|
@@ -7399,9 +7742,9 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7399
7742
|
zip64Enabled,
|
|
7400
7743
|
directory: Boolean(directory),
|
|
7401
7744
|
executable: Boolean(executable),
|
|
7402
|
-
filenameUTF8:
|
|
7745
|
+
filenameUTF8: Boolean(useUnicodeFileNames),
|
|
7403
7746
|
rawFilename,
|
|
7404
|
-
commentUTF8:
|
|
7747
|
+
commentUTF8: Boolean(useUnicodeFileNames),
|
|
7405
7748
|
rawComment,
|
|
7406
7749
|
rawExtraFieldZip64,
|
|
7407
7750
|
localExtraFieldZip64Length,
|
|
@@ -7432,7 +7775,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7432
7775
|
uncompressedSize
|
|
7433
7776
|
} = options;
|
|
7434
7777
|
let compressedSize = 0;
|
|
7435
|
-
if (!
|
|
7778
|
+
if (!passThroughCompression) {
|
|
7436
7779
|
uncompressedSize = 0;
|
|
7437
7780
|
}
|
|
7438
7781
|
const { writable } = writer;
|
|
@@ -7449,9 +7792,9 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7449
7792
|
encryptionStrength,
|
|
7450
7793
|
zipCrypto: encrypted && zipCrypto,
|
|
7451
7794
|
passwordVerification: encrypted && zipCrypto && (rawLastModDate >> 8) & MAX_8_BITS,
|
|
7452
|
-
computeCrc32: !
|
|
7453
|
-
compressed: compressed && !
|
|
7454
|
-
encrypted: encrypted && !
|
|
7795
|
+
computeCrc32: !passThroughCompression,
|
|
7796
|
+
compressed: compressed && !passThroughCompression,
|
|
7797
|
+
encrypted: encrypted && !passThroughEncryption,
|
|
7455
7798
|
useWebWorkers,
|
|
7456
7799
|
useCompressionStream,
|
|
7457
7800
|
transferStreams,
|
|
@@ -7466,7 +7809,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7466
7809
|
const result = await runWorker({ readable, writable }, workerOptions);
|
|
7467
7810
|
compressedSize = result.outputSize;
|
|
7468
7811
|
writer.size += compressedSize;
|
|
7469
|
-
if (!
|
|
7812
|
+
if (!passThroughCompression) {
|
|
7470
7813
|
uncompressedSize = result.inputSize;
|
|
7471
7814
|
if (!encrypted || zipCrypto) {
|
|
7472
7815
|
crc32 = result.crc32;
|
|
@@ -7509,8 +7852,9 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7509
7852
|
headerArray,
|
|
7510
7853
|
headerView,
|
|
7511
7854
|
signature: crc32,
|
|
7512
|
-
crc32: encrypted && !zipCrypto && !
|
|
7855
|
+
crc32: encrypted && !zipCrypto && !passThroughCompression ? UNDEFINED_VALUE : crc32,
|
|
7513
7856
|
extraFieldExtendedTimestampFlag,
|
|
7857
|
+
extraFieldExtendedTimestampTime,
|
|
7514
7858
|
zip64UncompressedSize,
|
|
7515
7859
|
zip64CompressedSize
|
|
7516
7860
|
});
|
|
@@ -7535,7 +7879,7 @@ function getHeaderInfo(options) {
|
|
|
7535
7879
|
encryptionStrength,
|
|
7536
7880
|
extendedTimestamp,
|
|
7537
7881
|
ntfsTimestamp,
|
|
7538
|
-
|
|
7882
|
+
passThroughCompression,
|
|
7539
7883
|
encrypted,
|
|
7540
7884
|
zip64UncompressedSize,
|
|
7541
7885
|
zip64CompressedSize,
|
|
@@ -7546,7 +7890,7 @@ function getHeaderInfo(options) {
|
|
|
7546
7890
|
let { version, compressionMethod } = options;
|
|
7547
7891
|
const compressed = !directory && isCompressed(compressionMethod, level);
|
|
7548
7892
|
let rawLocalExtraFieldZip64;
|
|
7549
|
-
const uncompressedFile =
|
|
7893
|
+
const uncompressedFile = passThroughCompression || !compressed;
|
|
7550
7894
|
const zip64ExtraFieldComplete = zip64 && (options.bufferedWrite || !dataDescriptor || ((!zip64UncompressedSize && !zip64CompressedSize) || (uncompressedFile && !unknownSize)));
|
|
7551
7895
|
const writeLocalExtraFieldZip64 = zip64ExtraFieldComplete || (zip64 && dataDescriptor && (zip64UncompressedSize || zip64CompressedSize));
|
|
7552
7896
|
if (zip64 && (zip64UncompressedSize || zip64CompressedSize)) {
|
|
@@ -7558,8 +7902,8 @@ function getHeaderInfo(options) {
|
|
|
7558
7902
|
if (zip64ExtraFieldComplete) {
|
|
7559
7903
|
extraFieldZip64.writeUint64(uncompressedSize);
|
|
7560
7904
|
if (uncompressedFile) {
|
|
7561
|
-
const encryptionOverhead = encrypted
|
|
7562
|
-
extraFieldZip64.writeUint64(
|
|
7905
|
+
const encryptionOverhead = getEncryptionOverhead(encrypted, zipCrypto, encryptionStrength);
|
|
7906
|
+
extraFieldZip64.writeUint64(passThroughCompression ? 0 : uncompressedSize + encryptionOverhead);
|
|
7563
7907
|
}
|
|
7564
7908
|
}
|
|
7565
7909
|
} else {
|
|
@@ -7578,6 +7922,7 @@ function getHeaderInfo(options) {
|
|
|
7578
7922
|
let rawExtraFieldNTFS;
|
|
7579
7923
|
let rawExtraFieldExtendedTimestamp;
|
|
7580
7924
|
let extraFieldExtendedTimestampFlag;
|
|
7925
|
+
let extraFieldExtendedTimestampTime;
|
|
7581
7926
|
if (extendedTimestamp) {
|
|
7582
7927
|
const lastModTimeUnix = getTimeUnix(lastModDate);
|
|
7583
7928
|
const lastModTimeUnixInRange = inUnixTimeRange(lastModTimeUnix);
|
|
@@ -7585,6 +7930,7 @@ function getHeaderInfo(options) {
|
|
|
7585
7930
|
const extraFieldTimestampLength = 9 + (lastAccessDate ? 4 : 0) + (creationDate ? 4 : 0);
|
|
7586
7931
|
const extraFieldTimestamp = createRecordWriter(extraFieldTimestampLength);
|
|
7587
7932
|
extraFieldExtendedTimestampFlag = 0x1 + (lastAccessDate ? 0x2 : 0) + (creationDate ? 0x4 : 0);
|
|
7933
|
+
extraFieldExtendedTimestampTime = lastModTimeUnix;
|
|
7588
7934
|
extraFieldTimestamp.writeUint16(EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
|
|
7589
7935
|
extraFieldTimestamp.writeUint16(extraFieldTimestampLength - 4);
|
|
7590
7936
|
extraFieldTimestamp.writeUint8(extraFieldExtendedTimestampFlag);
|
|
@@ -7627,7 +7973,7 @@ function getHeaderInfo(options) {
|
|
|
7627
7973
|
let rawExtraFieldUnix;
|
|
7628
7974
|
try {
|
|
7629
7975
|
const { uid, gid, unixExtraFieldType } = options;
|
|
7630
|
-
if (unixExtraFieldType == INFOZIP_EXTRA_FIELD_TYPE
|
|
7976
|
+
if (unixExtraFieldType == INFOZIP_EXTRA_FIELD_TYPE && (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE)) {
|
|
7631
7977
|
const uidBytes = packUnixId(uid === UNDEFINED_VALUE ? 0 : uid);
|
|
7632
7978
|
const gidBytes = packUnixId(gid === UNDEFINED_VALUE ? 0 : gid);
|
|
7633
7979
|
const payloadLength = 3 + uidBytes.length + gidBytes.length;
|
|
@@ -7668,7 +8014,7 @@ function getHeaderInfo(options) {
|
|
|
7668
8014
|
}
|
|
7669
8015
|
if (encrypted && !zipCrypto) {
|
|
7670
8016
|
version = version > VERSION_AES ? version : VERSION_AES;
|
|
7671
|
-
if (
|
|
8017
|
+
if (passThroughCompression && crc32 !== UNDEFINED_VALUE) {
|
|
7672
8018
|
rawExtraFieldAES[EXTRAFIELD_OFFSET_AES_VENDOR_VERSION] = VENDOR_VERSION_AE_1;
|
|
7673
8019
|
}
|
|
7674
8020
|
setUint16(getDataView(rawExtraFieldAES), EXTRAFIELD_OFFSET_AES_COMPRESSION_METHOD, compressionMethod);
|
|
@@ -7730,12 +8076,14 @@ function getHeaderInfo(options) {
|
|
|
7730
8076
|
headerArray,
|
|
7731
8077
|
headerView,
|
|
7732
8078
|
lastModDate: storedLastModDate,
|
|
8079
|
+
lastModDateClamped: storedLastModDate === clampedLastModDate && dosLastModDate.getTime() != clampedLastModDate.getTime(),
|
|
7733
8080
|
rawLastModDate,
|
|
7734
8081
|
encrypted,
|
|
7735
8082
|
compressed,
|
|
7736
8083
|
version,
|
|
7737
8084
|
compressionMethod,
|
|
7738
8085
|
extraFieldExtendedTimestampFlag,
|
|
8086
|
+
extraFieldExtendedTimestampTime,
|
|
7739
8087
|
rawExtraFieldZip64: EMPTY_UINT8_ARRAY,
|
|
7740
8088
|
localExtraFieldZip64Length,
|
|
7741
8089
|
rawExtraFieldExtendedTimestamp,
|
|
@@ -7838,7 +8186,7 @@ function setEntryInfo({
|
|
|
7838
8186
|
}, {
|
|
7839
8187
|
zip64,
|
|
7840
8188
|
zipCrypto,
|
|
7841
|
-
|
|
8189
|
+
passThroughCompression,
|
|
7842
8190
|
dataDescriptor
|
|
7843
8191
|
}) {
|
|
7844
8192
|
const {
|
|
@@ -7849,7 +8197,7 @@ function setEntryInfo({
|
|
|
7849
8197
|
dataDescriptorView,
|
|
7850
8198
|
dataDescriptorOffset
|
|
7851
8199
|
} = dataDescriptorInfo;
|
|
7852
|
-
if ((!encrypted || zipCrypto ||
|
|
8200
|
+
if ((!encrypted || zipCrypto || passThroughCompression) && crc32 !== UNDEFINED_VALUE) {
|
|
7853
8201
|
setUint32(headerView, HEADER_OFFSET_SIGNATURE, crc32);
|
|
7854
8202
|
if (dataDescriptor) {
|
|
7855
8203
|
setUint32(dataDescriptorView, dataDescriptorOffset, crc32);
|
|
@@ -7880,9 +8228,9 @@ function updateLocalHeader({
|
|
|
7880
8228
|
uncompressedSize,
|
|
7881
8229
|
zip64UncompressedSize,
|
|
7882
8230
|
zip64CompressedSize
|
|
7883
|
-
}, localHeaderView, { dataDescriptor,
|
|
8231
|
+
}, localHeaderView, { dataDescriptor, passThroughCompression }) {
|
|
7884
8232
|
if (!dataDescriptor) {
|
|
7885
|
-
if (!encrypted || (
|
|
8233
|
+
if (!encrypted || (passThroughCompression && crc32 !== UNDEFINED_VALUE)) {
|
|
7886
8234
|
setUint32(localHeaderView, HEADER_OFFSET_SIGNATURE + LOCAL_HEADER_COMMON_OFFSET, crc32);
|
|
7887
8235
|
}
|
|
7888
8236
|
if (!zip64CompressedSize) {
|
|
@@ -7919,9 +8267,8 @@ function createDirectoryRecords(files) {
|
|
|
7919
8267
|
rawExtraFieldUnix,
|
|
7920
8268
|
rawExtraField,
|
|
7921
8269
|
rawCentralExtraField,
|
|
7922
|
-
extendedTimestamp,
|
|
7923
8270
|
extraFieldExtendedTimestampFlag,
|
|
7924
|
-
|
|
8271
|
+
extraFieldExtendedTimestampTime,
|
|
7925
8272
|
zip64Enabled,
|
|
7926
8273
|
uncompressedSize,
|
|
7927
8274
|
compressedSize
|
|
@@ -7964,16 +8311,15 @@ function createDirectoryRecords(files) {
|
|
|
7964
8311
|
fileEntry.zip64Offset = zip64Offset;
|
|
7965
8312
|
fileEntry.zip64DiskNumberStart = zip64DiskNumberStart;
|
|
7966
8313
|
let rawExtraFieldTimestamp;
|
|
7967
|
-
|
|
7968
|
-
|
|
8314
|
+
if (extraFieldExtendedTimestampTime === UNDEFINED_VALUE) {
|
|
8315
|
+
rawExtraFieldTimestamp = EMPTY_UINT8_ARRAY;
|
|
8316
|
+
} else {
|
|
7969
8317
|
const extraFieldTimestamp = createRecordWriter(9);
|
|
7970
8318
|
extraFieldTimestamp.writeUint16(EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
|
|
7971
8319
|
extraFieldTimestamp.writeUint16(5);
|
|
7972
8320
|
extraFieldTimestamp.writeUint8(extraFieldExtendedTimestampFlag);
|
|
7973
|
-
extraFieldTimestamp.writeUint32(
|
|
8321
|
+
extraFieldTimestamp.writeUint32(extraFieldExtendedTimestampTime);
|
|
7974
8322
|
rawExtraFieldTimestamp = extraFieldTimestamp.array;
|
|
7975
|
-
} else {
|
|
7976
|
-
rawExtraFieldTimestamp = EMPTY_UINT8_ARRAY;
|
|
7977
8323
|
}
|
|
7978
8324
|
fileEntry.rawExtraFieldExtendedTimestamp = rawExtraFieldTimestamp;
|
|
7979
8325
|
const extraFieldLength = getLength(
|
|
@@ -8473,6 +8819,11 @@ function getHeaderArrayData({
|
|
|
8473
8819
|
};
|
|
8474
8820
|
}
|
|
8475
8821
|
|
|
8822
|
+
function isPrintableASCIIText(rawText) {
|
|
8823
|
+
return rawText.every(characterCode =>
|
|
8824
|
+
characterCode >= MIN_PRINTABLE_ASCII_CHARACTER_CODE && characterCode <= MAX_PRINTABLE_ASCII_CHARACTER_CODE);
|
|
8825
|
+
}
|
|
8826
|
+
|
|
8476
8827
|
function getBitFlag(level, useUnicodeFileNames, dataDescriptor, encrypted, compressionMethod) {
|
|
8477
8828
|
let bitFlag = 0;
|
|
8478
8829
|
if (useUnicodeFileNames) {
|
|
@@ -8634,7 +8985,7 @@ function formatSupported(StreamClass, format) {
|
|
|
8634
8985
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8635
8986
|
*/
|
|
8636
8987
|
|
|
8637
|
-
const VERSION = "2.
|
|
8988
|
+
const VERSION = "2.12.0";
|
|
8638
8989
|
|
|
8639
8990
|
/*
|
|
8640
8991
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
@@ -9456,9 +9807,9 @@ setDefaultConfiguration({
|
|
|
9456
9807
|
DecompressionStreamFallback: DecompressionStreamZlib
|
|
9457
9808
|
});
|
|
9458
9809
|
|
|
9459
|
-
function terminateWorkersAndModule() {
|
|
9810
|
+
async function terminateWorkersAndModule() {
|
|
9811
|
+
await terminateWorkers();
|
|
9460
9812
|
modulePromise = null;
|
|
9461
|
-
terminateWorkers();
|
|
9462
9813
|
resetWasmModule();
|
|
9463
9814
|
}
|
|
9464
9815
|
|
|
@@ -9525,7 +9876,10 @@ s(setDefaultConfiguration);
|
|
|
9525
9876
|
const ERR_ENTRY_EXISTS = "Entry filename already exists";
|
|
9526
9877
|
const ERR_DUPLICATE_IMPORTED_ENTRY = "Duplicate entry filename in the imported zip file";
|
|
9527
9878
|
const ERR_INVALID_DUPLICATES = "Invalid duplicates option (must be \"throw\", \"keep-first\" or \"keep-last\")";
|
|
9528
|
-
const ERR_ANCESTOR_ENTRY = "Entry is
|
|
9879
|
+
const ERR_ANCESTOR_ENTRY = "Entry is an ancestor of target entry";
|
|
9880
|
+
const ERR_ROOT_DIRECTORY_NOT_MOVABLE = "Root directory cannot be moved";
|
|
9881
|
+
const ERR_TARGET_NOT_DIRECTORY = "Target entry is not a directory";
|
|
9882
|
+
const ERR_PARENT_NOT_DIRECTORY = "Parent entry is not a directory";
|
|
9529
9883
|
const ERR_READABLE_CONSUMED = "Readable stream already consumed";
|
|
9530
9884
|
const DUPLICATES_THROW = "throw";
|
|
9531
9885
|
const DUPLICATES_KEEP_FIRST = "keep-first";
|
|
@@ -9533,24 +9887,8 @@ const DUPLICATES_KEEP_LAST = "keep-last";
|
|
|
9533
9887
|
const DUPLICATES_VALUES = new Set([DUPLICATES_THROW, DUPLICATES_KEEP_FIRST, DUPLICATES_KEEP_LAST]);
|
|
9534
9888
|
const ERR_INVALID_PASS_THROUGH = "Invalid passThrough option (use readerOptions.passThrough or set uncompressedSize for each entry)";
|
|
9535
9889
|
const ERR_INVALID_READER_OPTIONS = "Invalid readerOptions (must be an object)";
|
|
9536
|
-
const
|
|
9890
|
+
const ERR_UNSUPPORTED_PASS_THROUGH_VALUE = "The 'compressed' passThrough option is only supported by Entry#getData() and ZipWriter#add()";
|
|
9537
9891
|
const ERR_ABORT_EXPORT = "zipjs-abort-export";
|
|
9538
|
-
const ERR_ABORTED = "The operation was aborted";
|
|
9539
|
-
const ABORT_ERROR_NAME = "AbortError";
|
|
9540
|
-
const INFOZIP_EXTRA_FIELD_TYPE = "infozip";
|
|
9541
|
-
const INTERPRETED_EXTRA_FIELD_TYPES = new Set([
|
|
9542
|
-
EXTRAFIELD_TYPE_ZIP64,
|
|
9543
|
-
EXTRAFIELD_TYPE_AES,
|
|
9544
|
-
EXTRAFIELD_TYPE_NTFS,
|
|
9545
|
-
EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP,
|
|
9546
|
-
EXTRAFIELD_TYPE_UNICODE_PATH,
|
|
9547
|
-
EXTRAFIELD_TYPE_UNICODE_COMMENT,
|
|
9548
|
-
EXTRAFIELD_TYPE_USDZ,
|
|
9549
|
-
EXTRAFIELD_TYPE_INFOZIP,
|
|
9550
|
-
EXTRAFIELD_TYPE_UNIX,
|
|
9551
|
-
EXTRAFIELD_TYPE_UNIX_TYPE1,
|
|
9552
|
-
EXTRAFIELD_TYPE_PKWARE_UNIX
|
|
9553
|
-
]);
|
|
9554
9892
|
|
|
9555
9893
|
class ZipEntry {
|
|
9556
9894
|
|
|
@@ -9922,6 +10260,7 @@ class ZipDirectoryEntry extends ZipEntry {
|
|
|
9922
10260
|
await initStream(reader);
|
|
9923
10261
|
zipReader = new ZipReader(reader, options);
|
|
9924
10262
|
}
|
|
10263
|
+
checkPassThroughValue(options.passThrough);
|
|
9925
10264
|
const duplicates = checkDuplicatesOption(options.duplicates);
|
|
9926
10265
|
const importedEntries = [];
|
|
9927
10266
|
const entries = await zipReader.getEntries(options);
|
|
@@ -10012,18 +10351,25 @@ class ZipDirectoryEntry extends ZipEntry {
|
|
|
10012
10351
|
|
|
10013
10352
|
async exportZip(writer, options = {}) {
|
|
10014
10353
|
const zipEntry = this;
|
|
10354
|
+
const zipWriterProvided = Boolean(writer) && typeof writer.add == FUNCTION_TYPE;
|
|
10015
10355
|
options = Object.assign({}, options);
|
|
10016
|
-
if (options.bufferedWrite === UNDEFINED_VALUE) {
|
|
10356
|
+
if (!zipWriterProvided && options.bufferedWrite === UNDEFINED_VALUE) {
|
|
10017
10357
|
options.bufferedWrite = true;
|
|
10018
10358
|
}
|
|
10019
|
-
const [readers] = await Promise.all([
|
|
10020
|
-
|
|
10359
|
+
const [readers] = await Promise.all([
|
|
10360
|
+
initReaders(zipEntry, checkReaderOptions(options.readerOptions)),
|
|
10361
|
+
zipWriterProvided ? UNDEFINED_VALUE : initStream(writer)
|
|
10362
|
+
]);
|
|
10363
|
+
const zipWriter = zipWriterProvided ? writer : new ZipWriter(writer, options);
|
|
10021
10364
|
await exportZip(zipWriter, zipEntry, getTotalSize([zipEntry], getUncompressedSize), options, readers);
|
|
10365
|
+
if (zipWriterProvided) {
|
|
10366
|
+
return zipWriter;
|
|
10367
|
+
}
|
|
10022
10368
|
await zipWriter.close(options.globalComment);
|
|
10023
10369
|
return writer.getData ? writer.getData() : writer.writable;
|
|
10024
10370
|
}
|
|
10025
10371
|
|
|
10026
|
-
getExportedSize(options = {}) {
|
|
10372
|
+
async getExportedSize(options = {}) {
|
|
10027
10373
|
const zipEntry = this;
|
|
10028
10374
|
options = Object.assign({}, options);
|
|
10029
10375
|
checkReaderOptions(options.readerOptions);
|
|
@@ -10038,7 +10384,7 @@ class ZipDirectoryEntry extends ZipEntry {
|
|
|
10038
10384
|
const writeOrderGuaranteed = !options.bufferedWrite ||
|
|
10039
10385
|
(entries.every(entry => entry.options.keepOrder !== false) &&
|
|
10040
10386
|
children.every(child => isImplicitDirectory(child) || !child.children.length));
|
|
10041
|
-
return getEntriesSize(options, entries, writeOrderGuaranteed, options.globalComment);
|
|
10387
|
+
return await getEntriesSize(options, entries, writeOrderGuaranteed, options.globalComment);
|
|
10042
10388
|
}
|
|
10043
10389
|
|
|
10044
10390
|
getChildByName(name) {
|
|
@@ -10099,7 +10445,7 @@ class ZipFS {
|
|
|
10099
10445
|
|
|
10100
10446
|
move(entry, destination) {
|
|
10101
10447
|
if (entry == this.root) {
|
|
10102
|
-
throw new Error(
|
|
10448
|
+
throw new Error(ERR_ROOT_DIRECTORY_NOT_MOVABLE);
|
|
10103
10449
|
} else {
|
|
10104
10450
|
if (destination.directory) {
|
|
10105
10451
|
if (!destination.isDescendantOf(entry)) {
|
|
@@ -10120,7 +10466,7 @@ class ZipFS {
|
|
|
10120
10466
|
throw new Error(ERR_ANCESTOR_ENTRY);
|
|
10121
10467
|
}
|
|
10122
10468
|
} else {
|
|
10123
|
-
throw new Error(
|
|
10469
|
+
throw new Error(ERR_TARGET_NOT_DIRECTORY);
|
|
10124
10470
|
}
|
|
10125
10471
|
}
|
|
10126
10472
|
}
|
|
@@ -10433,70 +10779,11 @@ function getChildEntryOptions(child, selectedEntry, options) {
|
|
|
10433
10779
|
let zipEntryMetadata = {};
|
|
10434
10780
|
let passThroughOptions = {};
|
|
10435
10781
|
if (child.data instanceof Entry) {
|
|
10436
|
-
const
|
|
10437
|
-
|
|
10438
|
-
|
|
10439
|
-
|
|
10440
|
-
|
|
10441
|
-
rawLastModDate,
|
|
10442
|
-
creationDate,
|
|
10443
|
-
lastAccessDate,
|
|
10444
|
-
uncompressedSize,
|
|
10445
|
-
encrypted,
|
|
10446
|
-
zipCrypto,
|
|
10447
|
-
crc32,
|
|
10448
|
-
compressionMethod,
|
|
10449
|
-
extraFieldAES,
|
|
10450
|
-
internalFileAttributes,
|
|
10451
|
-
extraField,
|
|
10452
|
-
bitFlag,
|
|
10453
|
-
uid,
|
|
10454
|
-
gid
|
|
10455
|
-
} = child.data;
|
|
10456
|
-
zipEntryMetadata = {
|
|
10457
|
-
externalFileAttributes,
|
|
10458
|
-
versionMadeBy,
|
|
10459
|
-
comment,
|
|
10460
|
-
lastModDate,
|
|
10461
|
-
creationDate,
|
|
10462
|
-
lastAccessDate,
|
|
10463
|
-
internalFileAttributes
|
|
10464
|
-
};
|
|
10465
|
-
const userExtraField = getUserExtraField(extraField);
|
|
10466
|
-
if (userExtraField) {
|
|
10467
|
-
zipEntryMetadata.extraField = userExtraField;
|
|
10468
|
-
}
|
|
10469
|
-
if (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE) {
|
|
10470
|
-
Object.assign(zipEntryMetadata, {
|
|
10471
|
-
uid,
|
|
10472
|
-
gid,
|
|
10473
|
-
unixExtraFieldType: INFOZIP_EXTRA_FIELD_TYPE
|
|
10474
|
-
});
|
|
10475
|
-
}
|
|
10476
|
-
if (isPassThrough(child, options)) {
|
|
10477
|
-
let encryptionStrength;
|
|
10478
|
-
if (extraFieldAES) {
|
|
10479
|
-
encryptionStrength = extraFieldAES.strength;
|
|
10480
|
-
}
|
|
10481
|
-
passThroughOptions = {
|
|
10482
|
-
passThrough: true,
|
|
10483
|
-
encrypted,
|
|
10484
|
-
zipCrypto,
|
|
10485
|
-
crc32,
|
|
10486
|
-
uncompressedSize,
|
|
10487
|
-
encryptionStrength,
|
|
10488
|
-
compressionMethod
|
|
10489
|
-
};
|
|
10490
|
-
if (bitFlag) {
|
|
10491
|
-
passThroughOptions.dataDescriptor = bitFlag.dataDescriptor;
|
|
10492
|
-
}
|
|
10493
|
-
const lastModDateOverride = childOptions.lastModDate === UNDEFINED_VALUE ? options.lastModDate : childOptions.lastModDate;
|
|
10494
|
-
if (lastModDateOverride === UNDEFINED_VALUE) {
|
|
10495
|
-
passThroughOptions.rawLastModDate = rawLastModDate;
|
|
10496
|
-
} else if (zipCrypto && (!bitFlag || bitFlag.dataDescriptor) && lastModDateOverride instanceof Date &&
|
|
10497
|
-
getDosTimeHighByte(lastModDateOverride) != ((rawLastModDate >>> 8) & MAX_8_BITS)) {
|
|
10498
|
-
throw new Error(ERR_ZIP_CRYPTO_LAST_MOD_DATE);
|
|
10499
|
-
}
|
|
10782
|
+
const passThrough = isPassThrough(child, options);
|
|
10783
|
+
const lastModDateOverride = childOptions.lastModDate === UNDEFINED_VALUE ? options.lastModDate : childOptions.lastModDate;
|
|
10784
|
+
({ entryOptions: zipEntryMetadata, passThroughOptions } = getSourceEntryOptions(child.data, passThrough, lastModDateOverride));
|
|
10785
|
+
if (passThrough) {
|
|
10786
|
+
passThroughOptions.passThrough = true;
|
|
10500
10787
|
}
|
|
10501
10788
|
}
|
|
10502
10789
|
const entryOptions = Object.assign({ lastModDate: child.defaultLastModDate }, zipEntryMetadata, options, childOptions, passThroughOptions, { directory: child.directory });
|
|
@@ -10506,16 +10793,6 @@ function getChildEntryOptions(child, selectedEntry, options) {
|
|
|
10506
10793
|
return { name, entryOptions };
|
|
10507
10794
|
}
|
|
10508
10795
|
|
|
10509
|
-
function getDosTimeHighByte(lastModDate) {
|
|
10510
|
-
let dosLastModDate = new Date(Math.ceil(Math.floor(lastModDate.getTime() / 1000) / 2) * 2000);
|
|
10511
|
-
if (dosLastModDate < MIN_DATE) {
|
|
10512
|
-
dosLastModDate = MIN_DATE;
|
|
10513
|
-
} else if (dosLastModDate > MAX_DATE) {
|
|
10514
|
-
dosLastModDate = MAX_DATE;
|
|
10515
|
-
}
|
|
10516
|
-
return ((dosLastModDate.getHours() << 3) | (dosLastModDate.getMinutes() >> 3)) & MAX_8_BITS;
|
|
10517
|
-
}
|
|
10518
|
-
|
|
10519
10796
|
function getDeterminedSize(child, passThrough) {
|
|
10520
10797
|
const { reader } = child;
|
|
10521
10798
|
if (reader && reader.size !== UNDEFINED_VALUE) {
|
|
@@ -10528,9 +10805,18 @@ function checkReaderOptions(readerOptions) {
|
|
|
10528
10805
|
if (readerOptions && (typeof readerOptions != OBJECT_TYPE || Array.isArray(readerOptions))) {
|
|
10529
10806
|
throw new Error(ERR_INVALID_READER_OPTIONS);
|
|
10530
10807
|
}
|
|
10808
|
+
if (readerOptions) {
|
|
10809
|
+
checkPassThroughValue(readerOptions.passThrough);
|
|
10810
|
+
}
|
|
10531
10811
|
return readerOptions;
|
|
10532
10812
|
}
|
|
10533
10813
|
|
|
10814
|
+
function checkPassThroughValue(passThrough) {
|
|
10815
|
+
if (checkPassThroughOption(passThrough) === PASS_THROUGH_COMPRESSED) {
|
|
10816
|
+
throw new Error(ERR_UNSUPPORTED_PASS_THROUGH_VALUE);
|
|
10817
|
+
}
|
|
10818
|
+
}
|
|
10819
|
+
|
|
10534
10820
|
function replaceContent(zipEntry, params) {
|
|
10535
10821
|
const { uncompressedSize } = params;
|
|
10536
10822
|
Object.assign(zipEntry, params, {
|
|
@@ -10559,20 +10845,6 @@ function isImplicitDirectory(child) {
|
|
|
10559
10845
|
return child.directory && child.data === null;
|
|
10560
10846
|
}
|
|
10561
10847
|
|
|
10562
|
-
function getUserExtraField(extraField) {
|
|
10563
|
-
if (extraField) {
|
|
10564
|
-
const userExtraField = new Map();
|
|
10565
|
-
extraField.forEach((field, type) => {
|
|
10566
|
-
if (!INTERPRETED_EXTRA_FIELD_TYPES.has(type)) {
|
|
10567
|
-
userExtraField.set(type, field.data);
|
|
10568
|
-
}
|
|
10569
|
-
});
|
|
10570
|
-
if (userExtraField.size) {
|
|
10571
|
-
return userExtraField;
|
|
10572
|
-
}
|
|
10573
|
-
}
|
|
10574
|
-
}
|
|
10575
|
-
|
|
10576
10848
|
async function exportZip(zipWriter, entry, totalSize, options, readers) {
|
|
10577
10849
|
const { onstart, onprogress, onend, onentryprogress } = options;
|
|
10578
10850
|
const selectedEntry = entry;
|
|
@@ -10675,6 +10947,7 @@ function addFileSystemHandle(zipEntry, handle, options) {
|
|
|
10675
10947
|
|
|
10676
10948
|
async function exportFileSystemHandle(zipEntry, directoryHandle, options) {
|
|
10677
10949
|
const { onstart, onprogress, onend } = options;
|
|
10950
|
+
checkPassThroughValue(options.passThrough);
|
|
10678
10951
|
const readerOptions = checkReaderOptions(options.readerOptions);
|
|
10679
10952
|
const abortController = new AbortController();
|
|
10680
10953
|
const { signal } = abortController;
|
|
@@ -10750,7 +11023,7 @@ async function exportFileSystemHandle(zipEntry, directoryHandle, options) {
|
|
|
10750
11023
|
if (exportAborted || isExportAborted(signal.reason)) {
|
|
10751
11024
|
return;
|
|
10752
11025
|
}
|
|
10753
|
-
|
|
11026
|
+
throwIfAborted(signal);
|
|
10754
11027
|
}
|
|
10755
11028
|
try {
|
|
10756
11029
|
if (child.directory) {
|
|
@@ -10883,7 +11156,7 @@ function addChild(parent, name, params, directory) {
|
|
|
10883
11156
|
}
|
|
10884
11157
|
return directory ? new ZipDirectoryEntry(parent.fs, name, params, parent) : new ZipFileEntry(parent.fs, name, params, parent);
|
|
10885
11158
|
} else {
|
|
10886
|
-
throw new Error(
|
|
11159
|
+
throw new Error(ERR_PARENT_NOT_DIRECTORY);
|
|
10887
11160
|
}
|
|
10888
11161
|
}
|
|
10889
11162
|
|
|
@@ -11025,6 +11298,7 @@ exports.Data64URIReader = Data64URIReader;
|
|
|
11025
11298
|
exports.Data64URIWriter = Data64URIWriter;
|
|
11026
11299
|
exports.ERR_ABORTED = ERR_ABORTED;
|
|
11027
11300
|
exports.ERR_AMBIGUOUS_ARCHIVE = ERR_AMBIGUOUS_ARCHIVE;
|
|
11301
|
+
exports.ERR_ANCESTOR_ENTRY = ERR_ANCESTOR_ENTRY;
|
|
11028
11302
|
exports.ERR_BAD_FORMAT = ERR_BAD_FORMAT;
|
|
11029
11303
|
exports.ERR_CENTRAL_DIRECTORY_NOT_FOUND = ERR_CENTRAL_DIRECTORY_NOT_FOUND;
|
|
11030
11304
|
exports.ERR_DUPLICATED_NAME = ERR_DUPLICATED_NAME;
|
|
@@ -11038,7 +11312,9 @@ exports.ERR_EOCDR_NOT_FOUND = ERR_EOCDR_NOT_FOUND;
|
|
|
11038
11312
|
exports.ERR_EXTRAFIELD_ZIP64_NOT_FOUND = ERR_EXTRAFIELD_ZIP64_NOT_FOUND;
|
|
11039
11313
|
exports.ERR_HTTP_RANGE = ERR_HTTP_RANGE;
|
|
11040
11314
|
exports.ERR_HTTP_RESOURCE_CHANGED = ERR_HTTP_RESOURCE_CHANGED;
|
|
11315
|
+
exports.ERR_HTTP_STATUS = ERR_HTTP_STATUS;
|
|
11041
11316
|
exports.ERR_INVALID_AUTHENTICATION_CODE = ERR_INVALID_AUTHENTICATION_CODE;
|
|
11317
|
+
exports.ERR_INVALID_BASE_URI = ERR_INVALID_BASE_URI;
|
|
11042
11318
|
exports.ERR_INVALID_CODEC_DEFINITION = ERR_INVALID_CODEC_DEFINITION;
|
|
11043
11319
|
exports.ERR_INVALID_CODEC_MODULE = ERR_INVALID_CODEC_MODULE;
|
|
11044
11320
|
exports.ERR_INVALID_COMMENT = ERR_INVALID_COMMENT;
|
|
@@ -11048,6 +11324,7 @@ exports.ERR_INVALID_CRC32 = ERR_INVALID_CRC32;
|
|
|
11048
11324
|
exports.ERR_INVALID_DATE = ERR_INVALID_DATE;
|
|
11049
11325
|
exports.ERR_INVALID_DUPLICATES = ERR_INVALID_DUPLICATES;
|
|
11050
11326
|
exports.ERR_INVALID_ENCRYPTION_STRENGTH = ERR_INVALID_ENCRYPTION_STRENGTH;
|
|
11327
|
+
exports.ERR_INVALID_ENTRY = ERR_INVALID_ENTRY;
|
|
11051
11328
|
exports.ERR_INVALID_ENTRY_COMMENT = ERR_INVALID_ENTRY_COMMENT;
|
|
11052
11329
|
exports.ERR_INVALID_ENTRY_COMMENT_TYPE = ERR_INVALID_ENTRY_COMMENT_TYPE;
|
|
11053
11330
|
exports.ERR_INVALID_ENTRY_NAME = ERR_INVALID_ENTRY_NAME;
|
|
@@ -11066,6 +11343,7 @@ exports.ERR_INVALID_MSDOS_DATA = ERR_INVALID_MSDOS_DATA;
|
|
|
11066
11343
|
exports.ERR_INVALID_PASSWORD = ERR_INVALID_PASSWORD;
|
|
11067
11344
|
exports.ERR_INVALID_PASSWORD_TYPE = ERR_INVALID_PASSWORD_TYPE;
|
|
11068
11345
|
exports.ERR_INVALID_PASS_THROUGH = ERR_INVALID_PASS_THROUGH;
|
|
11346
|
+
exports.ERR_INVALID_PASS_THROUGH_VALUE = ERR_INVALID_PASS_THROUGH_VALUE;
|
|
11069
11347
|
exports.ERR_INVALID_READER = ERR_INVALID_READER;
|
|
11070
11348
|
exports.ERR_INVALID_READER_OPTIONS = ERR_INVALID_READER_OPTIONS;
|
|
11071
11349
|
exports.ERR_INVALID_SIGNAL = ERR_INVALID_SIGNAL;
|
|
@@ -11076,14 +11354,19 @@ exports.ERR_INVALID_UNCOMPRESSED_SIZE = ERR_INVALID_UNCOMPRESSED_SIZE;
|
|
|
11076
11354
|
exports.ERR_INVALID_UNIX_EXTRA_FIELD_TYPE = ERR_INVALID_UNIX_EXTRA_FIELD_TYPE;
|
|
11077
11355
|
exports.ERR_INVALID_UNIX_ID_SIZE = ERR_INVALID_UNIX_ID_SIZE;
|
|
11078
11356
|
exports.ERR_INVALID_UNIX_MODE = ERR_INVALID_UNIX_MODE;
|
|
11357
|
+
exports.ERR_INVALID_URI = ERR_INVALID_URI;
|
|
11079
11358
|
exports.ERR_INVALID_VERSION = ERR_INVALID_VERSION;
|
|
11080
11359
|
exports.ERR_ITERATOR_COMPLETED_TOO_SOON = ERR_ITERATOR_COMPLETED_TOO_SOON;
|
|
11081
11360
|
exports.ERR_LOCAL_FILE_HEADER_NOT_FOUND = ERR_LOCAL_FILE_HEADER_NOT_FOUND;
|
|
11082
11361
|
exports.ERR_OVERLAPPING_ENTRY = ERR_OVERLAPPING_ENTRY;
|
|
11362
|
+
exports.ERR_PARENT_NOT_DIRECTORY = ERR_PARENT_NOT_DIRECTORY;
|
|
11083
11363
|
exports.ERR_READABLE_CONSUMED = ERR_READABLE_CONSUMED;
|
|
11084
11364
|
exports.ERR_RESERVED_COMPRESSION_METHOD = ERR_RESERVED_COMPRESSION_METHOD;
|
|
11365
|
+
exports.ERR_ROOT_DIRECTORY_NOT_MOVABLE = ERR_ROOT_DIRECTORY_NOT_MOVABLE;
|
|
11085
11366
|
exports.ERR_SPLIT_ZIP_FILE = ERR_SPLIT_ZIP_FILE;
|
|
11367
|
+
exports.ERR_TARGET_NOT_DIRECTORY = ERR_TARGET_NOT_DIRECTORY;
|
|
11086
11368
|
exports.ERR_UNDEFINED_COMPRESSION_METHOD = ERR_UNDEFINED_COMPRESSION_METHOD;
|
|
11369
|
+
exports.ERR_UNDEFINED_CRC32 = ERR_UNDEFINED_CRC32;
|
|
11087
11370
|
exports.ERR_UNDEFINED_READER = ERR_UNDEFINED_READER;
|
|
11088
11371
|
exports.ERR_UNDEFINED_UNCOMPRESSED_SIZE = ERR_UNDEFINED_UNCOMPRESSED_SIZE;
|
|
11089
11372
|
exports.ERR_UNDETERMINED_SIZE = ERR_UNDETERMINED_SIZE;
|
|
@@ -11095,10 +11378,12 @@ exports.ERR_UNSUPPORTED_ENCRYPTION = ERR_UNSUPPORTED_ENCRYPTION;
|
|
|
11095
11378
|
exports.ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH = ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH;
|
|
11096
11379
|
exports.ERR_UNSUPPORTED_ENCRYPTION_USDZ = ERR_UNSUPPORTED_ENCRYPTION_USDZ;
|
|
11097
11380
|
exports.ERR_UNSUPPORTED_FORMAT = ERR_UNSUPPORTED_FORMAT;
|
|
11381
|
+
exports.ERR_UNSUPPORTED_PASS_THROUGH_VALUE = ERR_UNSUPPORTED_PASS_THROUGH_VALUE;
|
|
11098
11382
|
exports.ERR_UNSUPPORTED_SPLIT_USDZ = ERR_UNSUPPORTED_SPLIT_USDZ;
|
|
11099
11383
|
exports.ERR_UNSUPPORTED_UINT64 = ERR_UNSUPPORTED_UINT64;
|
|
11100
11384
|
exports.ERR_WORKER_STARTUP_TIMEOUT = ERR_WORKER_STARTUP_TIMEOUT;
|
|
11101
11385
|
exports.ERR_WRITER_NOT_INITIALIZED = ERR_WRITER_NOT_INITIALIZED;
|
|
11386
|
+
exports.ERR_WRITER_SIZE_NOT_WRITABLE = ERR_WRITER_SIZE_NOT_WRITABLE;
|
|
11102
11387
|
exports.ERR_ZIP_CRYPTO_LAST_MOD_DATE = ERR_ZIP_CRYPTO_LAST_MOD_DATE;
|
|
11103
11388
|
exports.ERR_ZIP_NOT_EMPTY = ERR_ZIP_NOT_EMPTY;
|
|
11104
11389
|
exports.HttpRangeReader = HttpRangeReader;
|
|
@@ -11112,13 +11397,17 @@ exports.Uint8ArrayReader = Uint8ArrayReader;
|
|
|
11112
11397
|
exports.Uint8ArrayWriter = Uint8ArrayWriter;
|
|
11113
11398
|
exports.VERSION = VERSION;
|
|
11114
11399
|
exports.WARNING_APPENDED_DATA = WARNING_APPENDED_DATA;
|
|
11400
|
+
exports.WARNING_CLAMPED_LAST_MODIFICATION_DATE = WARNING_CLAMPED_LAST_MODIFICATION_DATE;
|
|
11115
11401
|
exports.WARNING_COMPRESSED_PATCHED_DATA = WARNING_COMPRESSED_PATCHED_DATA;
|
|
11402
|
+
exports.WARNING_COMPRESSION_UNAVAILABLE = WARNING_COMPRESSION_UNAVAILABLE;
|
|
11116
11403
|
exports.WARNING_DUPLICATE_FILENAME = WARNING_DUPLICATE_FILENAME;
|
|
11117
11404
|
exports.WARNING_MALFORMED_EXTRA_FIELD = WARNING_MALFORMED_EXTRA_FIELD;
|
|
11118
11405
|
exports.WARNING_MISMATCHED_LOCAL_FILE_HEADER_BIT_FLAG = WARNING_MISMATCHED_LOCAL_FILE_HEADER_BIT_FLAG;
|
|
11119
11406
|
exports.WARNING_MISMATCHED_LOCAL_FILE_HEADER_COMPRESSION_METHOD = WARNING_MISMATCHED_LOCAL_FILE_HEADER_COMPRESSION_METHOD;
|
|
11120
11407
|
exports.WARNING_MISMATCHED_LOCAL_FILE_HEADER_CRC32_OR_SIZES = WARNING_MISMATCHED_LOCAL_FILE_HEADER_CRC32_OR_SIZES;
|
|
11408
|
+
exports.WARNING_MISMATCHED_LOCAL_FILE_HEADER_FILENAME = WARNING_MISMATCHED_LOCAL_FILE_HEADER_FILENAME;
|
|
11121
11409
|
exports.WARNING_MISMATCHED_ZIP64_END_OF_CENTRAL_DIRECTORY = WARNING_MISMATCHED_ZIP64_END_OF_CENTRAL_DIRECTORY;
|
|
11410
|
+
exports.WARNING_MULTIPLE_END_OF_CENTRAL_DIRECTORY = WARNING_MULTIPLE_END_OF_CENTRAL_DIRECTORY;
|
|
11122
11411
|
exports.WARNING_PREPENDED_CENTRAL_DIRECTORY = WARNING_PREPENDED_CENTRAL_DIRECTORY;
|
|
11123
11412
|
exports.WARNING_PREPENDED_DATA = WARNING_PREPENDED_DATA;
|
|
11124
11413
|
exports.WARNING_TRAILING_CENTRAL_DIRECTORY_DATA = WARNING_TRAILING_CENTRAL_DIRECTORY_DATA;
|