single-file-core 1.5.84 → 1.5.85
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/package.json
CHANGED
|
@@ -29,7 +29,7 @@ export {
|
|
|
29
29
|
|
|
30
30
|
async function display(document, docContent, { disableFramePointerEvents } = {}) {
|
|
31
31
|
docContent = docContent.replace(/<noscript/gi, "<template disabled-noscript");
|
|
32
|
-
docContent = docContent.
|
|
32
|
+
docContent = docContent.replace(/<\/noscript/gi, "</template");
|
|
33
33
|
const doc = (new DOMParser()).parseFromString(docContent, "text/html");
|
|
34
34
|
if (disableFramePointerEvents) {
|
|
35
35
|
doc.querySelectorAll("iframe").forEach(element => {
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
import {
|
|
27
27
|
configure,
|
|
28
|
+
deflateRaw,
|
|
28
29
|
BlobReader,
|
|
29
30
|
TextReader,
|
|
30
31
|
ZipWriter,
|
|
@@ -37,7 +38,10 @@ import {
|
|
|
37
38
|
display
|
|
38
39
|
} from "./compression-display.js";
|
|
39
40
|
|
|
40
|
-
const { Blob, fetch, TextEncoder, DOMParser } = globalThis;
|
|
41
|
+
const { Blob, fetch, TextEncoder, TextDecoder, DOMParser } = globalThis;
|
|
42
|
+
|
|
43
|
+
// windows-1252 never decodes bytes >= 0x80 into the ASCII range, the scanned patterns are all ASCII
|
|
44
|
+
const TEXT_DECODER = new TextDecoder("windows-1252");
|
|
41
45
|
|
|
42
46
|
const NO_COMPRESSION_EXTENSIONS = [".jpg", ".jpeg", ".png", ".avi", ".apng", ".pdf", ".woff2", ".mp4", ".mp3", ".ogg", ".webp", ".webm", ".avi", ".mpeg", ".ts", ".ogv", ".heif", ".heic"];
|
|
43
47
|
const SCRIPT_PATH = "/lib/single-file-zip.min.js";
|
|
@@ -56,17 +60,17 @@ const EMBEDDED_DATA_TAGS = [
|
|
|
56
60
|
...EXTRA_DATA_TAGS,
|
|
57
61
|
];
|
|
58
62
|
const EXTRA_DATA_REGEXPS = [
|
|
59
|
-
[/<noscript/i, /<\/noscript
|
|
60
|
-
[/<noframes/i, /<\/noframes
|
|
61
|
-
[/<noembed/i, /<\/noembed
|
|
62
|
-
[/<script/i, /<\/script
|
|
63
|
-
[/<style/i, /<\/style
|
|
64
|
-
[/<iframe/i, /<\/iframe
|
|
65
|
-
[/<xmp/i, /<\/xmp
|
|
66
|
-
[/<plaintext/i, /<\/plaintext
|
|
63
|
+
[/<noscript/i, /<\/noscript[\t\n\f\r />]/i],
|
|
64
|
+
[/<noframes/i, /<\/noframes[\t\n\f\r />]/i],
|
|
65
|
+
[/<noembed/i, /<\/noembed[\t\n\f\r />]/i],
|
|
66
|
+
[/<script/i, /<\/script[\t\n\f\r />]/i],
|
|
67
|
+
[/<style/i, /<\/style[\t\n\f\r />]/i],
|
|
68
|
+
[/<iframe/i, /<\/iframe[\t\n\f\r />]/i],
|
|
69
|
+
[/<xmp/i, /<\/xmp[\t\n\f\r />]/i],
|
|
70
|
+
[/<plaintext/i, /<\/plaintext[\t\n\f\r />]/i]
|
|
67
71
|
];
|
|
68
72
|
const EMBEDDED_DATA_REGEXPS = [
|
|
69
|
-
[/<!--/i,
|
|
73
|
+
[/<!--/i, /--!?>/i],
|
|
70
74
|
...EXTRA_DATA_REGEXPS,
|
|
71
75
|
];
|
|
72
76
|
const CRC32_TABLE = new Uint32Array(256).map((_, indexTable) => {
|
|
@@ -91,7 +95,7 @@ async function process(pageData, options, lastModDate = new Date()) {
|
|
|
91
95
|
if (options.zipScript) {
|
|
92
96
|
script = options.zipScript;
|
|
93
97
|
} else if (browser && browser.runtime && browser.runtime.getURL) {
|
|
94
|
-
configure({
|
|
98
|
+
configure({ workerURI: "/lib/single-file-z-worker.js" });
|
|
95
99
|
script = await (await fetch(browser.runtime.getURL(SCRIPT_PATH))).text();
|
|
96
100
|
}
|
|
97
101
|
const zipDataWriter = new Uint8ArrayWriter();
|
|
@@ -103,8 +107,8 @@ async function process(pageData, options, lastModDate = new Date()) {
|
|
|
103
107
|
const embeddedImageData = options.embeddedImage.slice(PNG_SIGNATURE_LENGTH + PNG_IHDR_LENGTH, options.embeddedImage.length - PNG_IEND_LENGTH);
|
|
104
108
|
await writeData(zipDataWriter.writable, options.embeddedImage.slice(0, PNG_SIGNATURE_LENGTH + PNG_IHDR_LENGTH));
|
|
105
109
|
if (options.selfExtractingArchive) {
|
|
106
|
-
const embeddedImageText =
|
|
107
|
-
const tagIndex = EMBEDDED_DATA_REGEXPS.findIndex(tests => !embeddedImageText.match(tests[1]));
|
|
110
|
+
const embeddedImageText = TEXT_DECODER.decode(new Uint8Array(embeddedImageData));
|
|
111
|
+
const tagIndex = EMBEDDED_DATA_REGEXPS.slice(0, -1).findIndex(tests => !embeddedImageText.match(tests[1]));
|
|
108
112
|
let startTag;
|
|
109
113
|
[startTag, endTag] = tagIndex == -1 ? ["", ""] : EMBEDDED_DATA_TAGS[tagIndex];
|
|
110
114
|
const htmlArray = getStartHTMLArray(pageData, options, startTag);
|
|
@@ -129,33 +133,47 @@ async function process(pageData, options, lastModDate = new Date()) {
|
|
|
129
133
|
} else if (!options.embeddedImage && options.embeddedPdf) {
|
|
130
134
|
await writeData(zipDataWriter.writable, new Uint8Array(options.embeddedPdf));
|
|
131
135
|
}
|
|
132
|
-
const zipWriter = new ZipWriter(zipDataWriter, { bufferedWrite: true, keepOrder: true, lastModDate });
|
|
136
|
+
const zipWriter = new ZipWriter(zipDataWriter, { bufferedWrite: true, keepOrder: true, lastModDate, useCompressionStream: true });
|
|
133
137
|
const startOffset = zipDataWriter.offset;
|
|
134
138
|
pageData.url = options.url;
|
|
135
139
|
pageData.archiveTime = (new Date()).toISOString();
|
|
136
140
|
await addPageResources(zipWriter, pageData, { password: options.password, disableCompression: options.disableCompression }, options.createRootDirectory ? String(Date.now()) + "_" + (options.tabId || 0) + "/" : "", options.url);
|
|
137
141
|
const data = await zipWriter.close(null, { preventClose: true });
|
|
138
142
|
if (options.selfExtractingArchive) {
|
|
139
|
-
const
|
|
140
|
-
|
|
143
|
+
const lfCodes = [];
|
|
144
|
+
let crc32 = -1;
|
|
141
145
|
if (options.extractDataFromPage) {
|
|
142
|
-
if (!options.extractDataFromPageTags) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
if (!options.extractDataFromPageTags || options.extractDataFromPageTags[0] != "<plaintext>") {
|
|
147
|
+
const textContent = TEXT_DECODER.decode(data.subarray(startOffset));
|
|
148
|
+
if (options.extractDataFromPageTags) {
|
|
149
|
+
const tagIndex = EXTRA_DATA_TAGS.indexOf(options.extractDataFromPageTags);
|
|
150
|
+
const regExpsTag = EXTRA_DATA_REGEXPS[tagIndex];
|
|
151
|
+
if (textContent.match(regExpsTag[0]) || textContent.match(regExpsTag[1])) {
|
|
152
|
+
return findExtraDataTags(textContent, pageData, options, lastModDate, tagIndex + 1);
|
|
153
|
+
}
|
|
154
|
+
} else {
|
|
155
|
+
const matchCommentTags = textContent.match(/<!--/i) || textContent.match(/--!?>/i);
|
|
156
|
+
if (matchCommentTags) {
|
|
157
|
+
return findExtraDataTags(textContent, pageData, options, lastModDate);
|
|
158
|
+
}
|
|
148
159
|
}
|
|
149
160
|
}
|
|
150
161
|
for (let index = startOffset; index < data.length; index++) {
|
|
151
|
-
|
|
162
|
+
const byte = data[index];
|
|
163
|
+
crc32 = (crc32 >>> 8) ^ CRC32_TABLE[(crc32 ^ byte) & 0xff];
|
|
164
|
+
if (byte == 10) {
|
|
165
|
+
lfCodes.push(0);
|
|
166
|
+
} else if (byte == 13) {
|
|
152
167
|
if (data[index + 1] == 10) {
|
|
153
|
-
|
|
168
|
+
index++;
|
|
169
|
+
crc32 = (crc32 >>> 8) ^ CRC32_TABLE[(crc32 ^ 10) & 0xff];
|
|
170
|
+
lfCodes.push(2);
|
|
154
171
|
} else {
|
|
155
|
-
|
|
172
|
+
lfCodes.push(1);
|
|
156
173
|
}
|
|
157
174
|
}
|
|
158
175
|
}
|
|
176
|
+
crc32 = (crc32 ^ -1) >>> 0;
|
|
159
177
|
}
|
|
160
178
|
let pageContent = "";
|
|
161
179
|
if (!options.preventAppendedData) {
|
|
@@ -167,12 +185,13 @@ async function process(pageData, options, lastModDate = new Date()) {
|
|
|
167
185
|
}
|
|
168
186
|
const endTags = options.preventAppendedData || options.embeddedImage ? "" : "</body></html>";
|
|
169
187
|
if (options.extractDataFromPage) {
|
|
170
|
-
|
|
171
|
-
payload
|
|
172
|
-
payload
|
|
173
|
-
payload
|
|
174
|
-
payload
|
|
175
|
-
|
|
188
|
+
// payload layout: [crc32, zip data length, LF codes count, 2-bit codes (0=LF, 1=CR, 2=CRLF) packed LSB-first]
|
|
189
|
+
const payload = new Uint32Array(3 + Math.ceil(lfCodes.length / 16));
|
|
190
|
+
payload[0] = crc32;
|
|
191
|
+
payload[1] = data.length - startOffset;
|
|
192
|
+
payload[2] = lfCodes.length;
|
|
193
|
+
lfCodes.forEach((lfCode, indexLFCode) => payload[3 + (indexLFCode >> 4)] |= lfCode << ((indexLFCode & 15) * 2));
|
|
194
|
+
extraData = "<sfz-extra-data>" + base64Encode(deflateRaw(new Uint8Array(payload.buffer))) + "</sfz-extra-data>";
|
|
176
195
|
if (options.preventAppendedData || extraData.length > 65535 - endTags.length - (options.embeddedImage ? PNG_IEND_LENGTH : 0)) {
|
|
177
196
|
if (!options.extraDataSize) {
|
|
178
197
|
options.extraDataSize = Math.floor(extraData.length * 1.001);
|
|
@@ -194,7 +213,7 @@ async function process(pageData, options, lastModDate = new Date()) {
|
|
|
194
213
|
const pageContent = await zipDataWriter.getData();
|
|
195
214
|
if (options.extractDataFromPage && options.extraDataSize !== undefined) {
|
|
196
215
|
if (options.extraDataSize >= extraData.length) {
|
|
197
|
-
pageContent.set(
|
|
216
|
+
pageContent.set(new TextEncoder().encode(extraData), startOffset - extraDataOffset);
|
|
198
217
|
} else {
|
|
199
218
|
options.extraData = extraData;
|
|
200
219
|
options.extraDataSize = Math.floor(extraData.length * 1.001);
|
|
@@ -243,7 +262,10 @@ async function prependHTMLData(pageData, zipDataWriter, script, options) {
|
|
|
243
262
|
await writeData(zipDataWriter.writable, getStartHTMLArray(pageData, options));
|
|
244
263
|
}
|
|
245
264
|
pageContent += "<div id=sfz-wait-message>Please wait...</div>";
|
|
246
|
-
if (
|
|
265
|
+
if (options.extractDataFromPage) {
|
|
266
|
+
pageContent += "<div id=sfz-error-message><strong>Error</strong>: Cannot extract the data of the page.";
|
|
267
|
+
pageContent += " The file is still a valid ZIP file, you can rename it with a \"zip\" extension and unzip it to display the page and its resources.</div>";
|
|
268
|
+
} else {
|
|
247
269
|
pageContent += "<div id=sfz-error-message><strong>Error</strong>: Cannot open the page from the filesystem.";
|
|
248
270
|
pageContent += "<ul style='line-height:20px;'>";
|
|
249
271
|
pageContent += "<li style='margin-bottom:10px'><strong>Chrome/Edge/Brave</strong>: Install <a href='https://www.getsinglefile.com'>SingleFile</a> and enable the option \"Allow access to file URLs\" in the details page of the extension.</li>";
|
|
@@ -277,7 +299,13 @@ async function prependHTMLData(pageData, zipDataWriter, script, options) {
|
|
|
277
299
|
"globalThis.bootstrap=(()=>{let bootstrapStarted;return async content=>{if (bootstrapStarted) return bootstrapStarted; bootstrapStarted = (" +
|
|
278
300
|
extract.toString().replace(/\n|\t/g, "") + ")(content,{prompt}).then(({docContent}) => " +
|
|
279
301
|
display.toString().replace(/\n|\t/g, "") + "(document,docContent," + JSON.stringify(displayOptions) + "));return bootstrapStarted;}})();(" +
|
|
280
|
-
getContent.toString().replace(/\n|\t/g, "") + ")().then(globalThis.bootstrap).then(() => document.dispatchEvent(new CustomEvent(\"single-file-display-infobar\"))).catch(
|
|
302
|
+
getContent.toString().replace(/\n|\t/g, "") + ")().then(globalThis.bootstrap).then(() => document.dispatchEvent(new CustomEvent(\"single-file-display-infobar\"))).catch(error => {" +
|
|
303
|
+
"console.error(error);" +
|
|
304
|
+
"const waitMessage = document.getElementById(\"sfz-wait-message\");" +
|
|
305
|
+
"if (waitMessage) { waitMessage.remove(); }" +
|
|
306
|
+
"const errorMessage = document.getElementById(\"sfz-error-message\");" +
|
|
307
|
+
"if (errorMessage) { errorMessage.hidden = false; document.body.hidden = false; }" +
|
|
308
|
+
"});" +
|
|
281
309
|
"</script>";
|
|
282
310
|
pageContent += script;
|
|
283
311
|
let extraData = "";
|
|
@@ -287,8 +315,9 @@ async function prependHTMLData(pageData, zipDataWriter, script, options) {
|
|
|
287
315
|
}
|
|
288
316
|
pageContent += extraData;
|
|
289
317
|
const startTag = options.extractDataFromPageTags ? options.extractDataFromPageTags[0] : "<!--";
|
|
290
|
-
|
|
291
|
-
|
|
318
|
+
// the space guarantees a text node between <sfz-extra-data> and the start tag
|
|
319
|
+
pageContent += (extraData ? " " : "") + startTag;
|
|
320
|
+
const extraDataOffset = startTag.length + extraData.length + (extraData ? 1 : 0);
|
|
292
321
|
await writeData(zipDataWriter.writable, (new TextEncoder()).encode(pageContent));
|
|
293
322
|
return extraDataOffset;
|
|
294
323
|
}
|
|
@@ -306,8 +335,8 @@ function getStartHTMLArray(pageData, options, startTag = "") {
|
|
|
306
335
|
const htmlHeadData = getHTMLHeadData(pageData, options);
|
|
307
336
|
let htmlArray;
|
|
308
337
|
if (options.embeddedPdf) {
|
|
309
|
-
const embeddedPdfText =
|
|
310
|
-
const pdfTagIndex = EMBEDDED_DATA_REGEXPS.findIndex(tests => !embeddedPdfText.match(tests[1]));
|
|
338
|
+
const embeddedPdfText = TEXT_DECODER.decode(new Uint8Array(options.embeddedPdf));
|
|
339
|
+
const pdfTagIndex = EMBEDDED_DATA_REGEXPS.slice(0, -1).findIndex(tests => !embeddedPdfText.match(tests[1]));
|
|
311
340
|
const [pdfStartTag, pdfEndTag] = pdfTagIndex == -1 ? ["", ""] : EMBEDDED_DATA_TAGS[pdfTagIndex];
|
|
312
341
|
const htmlArray1 = new TextEncoder().encode(html + pdfStartTag);
|
|
313
342
|
const htmlArray2 = new TextEncoder().encode(pdfEndTag + htmlHeadData + startTag);
|
|
@@ -349,7 +378,8 @@ function getPageTitle(pageData) {
|
|
|
349
378
|
|
|
350
379
|
function findExtraDataTags(textContent, pageData, options, lastModDate, indexExtractDataFromPageTags = 0) {
|
|
351
380
|
const regExpsTag = EXTRA_DATA_REGEXPS[indexExtractDataFromPageTags];
|
|
352
|
-
const
|
|
381
|
+
const plaintextTag = EXTRA_DATA_TAGS[indexExtractDataFromPageTags][0] == "<plaintext>";
|
|
382
|
+
const matchTag = !plaintextTag && (textContent.match(regExpsTag[0]) || textContent.match(regExpsTag[1]));
|
|
353
383
|
if (matchTag) {
|
|
354
384
|
if (indexExtractDataFromPageTags < EXTRA_DATA_TAGS.length - 1) {
|
|
355
385
|
return findExtraDataTags(textContent, pageData, options, lastModDate, indexExtractDataFromPageTags + 1);
|
|
@@ -359,6 +389,10 @@ function findExtraDataTags(textContent, pageData, options, lastModDate, indexExt
|
|
|
359
389
|
}
|
|
360
390
|
} else {
|
|
361
391
|
options.extractDataFromPageTags = EXTRA_DATA_TAGS[indexExtractDataFromPageTags];
|
|
392
|
+
if (options.extractDataFromPageTags[0] == "<plaintext>") {
|
|
393
|
+
// <plaintext> cannot be closed, the file must end with the zip data
|
|
394
|
+
options.preventAppendedData = true;
|
|
395
|
+
}
|
|
362
396
|
return process(pageData, options, lastModDate);
|
|
363
397
|
}
|
|
364
398
|
}
|
|
@@ -422,29 +456,45 @@ async function getContent() {
|
|
|
422
456
|
[352, 138], [8249, 139], [338, 140], [381, 142], [8216, 145], [8217, 146], [8220, 147], [8221, 148], [8226, 149], [8211, 150],
|
|
423
457
|
[8212, 151], [732, 152], [8482, 153], [353, 154], [8250, 155], [339, 156], [382, 158], [376, 159]
|
|
424
458
|
]);
|
|
459
|
+
const crc32Table = new Uint32Array(256).map((_, indexTable) => {
|
|
460
|
+
let crc = indexTable;
|
|
461
|
+
for (let indexBits = 0; indexBits < 8; indexBits++) {
|
|
462
|
+
crc = crc & 1 ? 0xEDB88320 ^ (crc >>> 1) : crc >>> 1;
|
|
463
|
+
}
|
|
464
|
+
return crc;
|
|
465
|
+
});
|
|
425
466
|
return new Promise((resolve, reject) => {
|
|
426
467
|
let aborted = false;
|
|
427
|
-
|
|
468
|
+
if (location.protocol == "file:") {
|
|
469
|
+
extractDataFromDocument();
|
|
470
|
+
} else {
|
|
471
|
+
getPageData();
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
async function extractDataFromDocument() {
|
|
475
|
+
try {
|
|
476
|
+
await waitForDocumentReady(document);
|
|
477
|
+
document.body.querySelectorAll("meta, style").forEach(element => document.head.appendChild(element));
|
|
478
|
+
const pageData = extractPageData();
|
|
479
|
+
displayMessage("sfz-wait-message", 2);
|
|
480
|
+
resolve(pageData);
|
|
481
|
+
} catch (error) {
|
|
482
|
+
console.error(error);
|
|
483
|
+
displayMessage("sfz-error-message", 2);
|
|
484
|
+
reject(error);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
428
487
|
|
|
429
488
|
function getPageData() {
|
|
430
489
|
const xhr = new XMLHttpRequest();
|
|
431
490
|
xhr.responseType = "blob";
|
|
432
491
|
xhr.open("GET", "");
|
|
433
|
-
xhr.onerror =
|
|
492
|
+
xhr.onerror = () => {
|
|
434
493
|
if (aborted) {
|
|
435
494
|
displayMessage("sfz-error-message", 2);
|
|
436
495
|
reject();
|
|
437
496
|
} else {
|
|
438
|
-
|
|
439
|
-
await waitForDocumentReady(document);
|
|
440
|
-
document.body.querySelectorAll("meta, style").forEach(element => document.head.appendChild(element));
|
|
441
|
-
const pageData = extractPageData();
|
|
442
|
-
displayMessage("sfz-wait-message", 2);
|
|
443
|
-
resolve(pageData);
|
|
444
|
-
} catch {
|
|
445
|
-
displayMessage("sfz-error-message", 2);
|
|
446
|
-
reject();
|
|
447
|
-
};
|
|
497
|
+
extractDataFromDocument();
|
|
448
498
|
}
|
|
449
499
|
};
|
|
450
500
|
xhr.send();
|
|
@@ -485,9 +535,14 @@ async function getContent() {
|
|
|
485
535
|
if (element) {
|
|
486
536
|
Array.from(document.body.childNodes).forEach(node => {
|
|
487
537
|
if (node.id != elementId) {
|
|
488
|
-
node.
|
|
538
|
+
if (node.id == "sfz-wait-message" || node.id == "sfz-error-message") {
|
|
539
|
+
node.hidden = true;
|
|
540
|
+
} else {
|
|
541
|
+
node.remove();
|
|
542
|
+
}
|
|
489
543
|
}
|
|
490
544
|
});
|
|
545
|
+
element.hidden = false;
|
|
491
546
|
document.body.hidden = false;
|
|
492
547
|
element.style = "opacity: 0; animation: 0s linear " + delay + "s display-wait-message 1 normal forwards";
|
|
493
548
|
}
|
|
@@ -506,59 +561,46 @@ async function getContent() {
|
|
|
506
561
|
} else {
|
|
507
562
|
dataNode = zipDataElement.previousSibling;
|
|
508
563
|
}
|
|
509
|
-
const
|
|
510
|
-
|
|
564
|
+
const inflatedPayload = zip.inflateRaw(base64Decode(zipDataElement.textContent));
|
|
565
|
+
const payload = new Uint32Array(inflatedPayload.buffer, inflatedPayload.byteOffset, inflatedPayload.length >> 2);
|
|
566
|
+
const expectedCRC32 = payload[0];
|
|
567
|
+
const zipDataLength = payload[1];
|
|
568
|
+
const lfCodesLength = payload[2];
|
|
569
|
+
const zipData = new Uint8Array(zipDataLength);
|
|
570
|
+
const { textContent } = dataNode;
|
|
571
|
+
let offset = 0;
|
|
572
|
+
let indexLFCode = 0;
|
|
573
|
+
let crc32 = -1;
|
|
511
574
|
for (let index = 0; index < textContent.length; index++) {
|
|
512
575
|
const charCode = textContent.charCodeAt(index);
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
function decompress(src) {
|
|
528
|
-
src = base64Decode(src);
|
|
529
|
-
let out = new Uint8Array(1024);
|
|
530
|
-
let outLen = 0;
|
|
531
|
-
for (let i = 0; i < src.length;) {
|
|
532
|
-
const ctrl = src[i++];
|
|
533
|
-
if ((ctrl & 0x80) === 0) {
|
|
534
|
-
const L = ctrl;
|
|
535
|
-
ensure(outLen + L);
|
|
536
|
-
for (let j = 0; j < L && i < src.length; j++) {
|
|
537
|
-
out[outLen++] = src[i++];
|
|
538
|
-
}
|
|
539
|
-
} else {
|
|
540
|
-
const L = (ctrl & 0x7f) + 3;
|
|
541
|
-
const off = (src[i++] << 8) | src[i++];
|
|
542
|
-
const start = outLen - off;
|
|
543
|
-
ensure(outLen + L);
|
|
544
|
-
for (let k = 0; k < L; k++) {
|
|
545
|
-
out[outLen++] = out[start + k];
|
|
576
|
+
if (charCode == 10) {
|
|
577
|
+
const lfCode = (payload[3 + (indexLFCode >> 4)] >>> ((indexLFCode & 15) * 2)) & 3;
|
|
578
|
+
indexLFCode++;
|
|
579
|
+
if (lfCode == 0) {
|
|
580
|
+
writeByte(10);
|
|
581
|
+
} else {
|
|
582
|
+
writeByte(13);
|
|
583
|
+
if (lfCode == 2) {
|
|
584
|
+
writeByte(10);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
} else {
|
|
588
|
+
writeByte(charCode > 255 ? characterMap.get(charCode) : charCode);
|
|
546
589
|
}
|
|
547
590
|
}
|
|
548
|
-
|
|
549
|
-
|
|
591
|
+
crc32 = (crc32 ^ -1) >>> 0;
|
|
592
|
+
if (offset != zipDataLength || indexLFCode != lfCodesLength || crc32 != expectedCRC32) {
|
|
593
|
+
throw new Error("Invalid checksum of the extracted zip data");
|
|
594
|
+
}
|
|
595
|
+
return new Blob([zipData], { type: "application/octet-stream" });
|
|
550
596
|
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
nl *= 2;
|
|
556
|
-
}
|
|
557
|
-
const nbuf = new Uint8Array(nl);
|
|
558
|
-
nbuf.set(out.subarray(0, outLen));
|
|
559
|
-
out = nbuf;
|
|
597
|
+
function writeByte(byte) {
|
|
598
|
+
zipData[offset] = byte;
|
|
599
|
+
crc32 = (crc32 >>> 8) ^ crc32Table[(crc32 ^ byte) & 0xff];
|
|
600
|
+
offset++;
|
|
560
601
|
}
|
|
561
|
-
}
|
|
602
|
+
}
|
|
603
|
+
throw new Error("Extra zip data data not found");
|
|
562
604
|
}
|
|
563
605
|
|
|
564
606
|
function base64Decode(b64) {
|
|
@@ -603,94 +645,3 @@ function base64Encode(bytes) {
|
|
|
603
645
|
}
|
|
604
646
|
return out;
|
|
605
647
|
}
|
|
606
|
-
|
|
607
|
-
function compress(input) {
|
|
608
|
-
const src = new Uint8Array(input);
|
|
609
|
-
const N = src.length;
|
|
610
|
-
const out = [];
|
|
611
|
-
const litBuf = [];
|
|
612
|
-
const MAX_OFFSET = 0xffff;
|
|
613
|
-
const MAX_MATCH = 130;
|
|
614
|
-
const MAX_CANDIDATES = 64;
|
|
615
|
-
const map = new Map();
|
|
616
|
-
let i = 0;
|
|
617
|
-
while (i < N) {
|
|
618
|
-
let bestLen = 0, bestOff = 0;
|
|
619
|
-
if (i + 2 < N) {
|
|
620
|
-
const key = (src[i] << 16) | (src[i + 1] << 8) | src[i + 2];
|
|
621
|
-
const cand = map.get(key) || [];
|
|
622
|
-
for (let c = cand.length - 1; c >= 0; c--) {
|
|
623
|
-
const j = cand[c];
|
|
624
|
-
const off = i - j;
|
|
625
|
-
if (off <= 0 || off > MAX_OFFSET) {
|
|
626
|
-
continue;
|
|
627
|
-
}
|
|
628
|
-
let k = 0;
|
|
629
|
-
while (k < MAX_MATCH && i + k < N && src[j + k] === src[i + k]) {
|
|
630
|
-
k++;
|
|
631
|
-
}
|
|
632
|
-
if (k > bestLen && k >= 3) {
|
|
633
|
-
bestLen = k; bestOff = off;
|
|
634
|
-
if (bestLen === MAX_MATCH) {
|
|
635
|
-
break;
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
if (bestLen >= 3) {
|
|
642
|
-
if (litBuf.length) {
|
|
643
|
-
flushLiterals();
|
|
644
|
-
}
|
|
645
|
-
let remain = bestLen;
|
|
646
|
-
let produced = 0;
|
|
647
|
-
while (remain > 0) {
|
|
648
|
-
const take = Math.min(remain, MAX_MATCH);
|
|
649
|
-
out.push(0x80 | ((take - 3) & 0x7f));
|
|
650
|
-
out.push((bestOff >> 8) & 0xff);
|
|
651
|
-
out.push(bestOff & 0xff);
|
|
652
|
-
remain -= take;
|
|
653
|
-
produced += take;
|
|
654
|
-
}
|
|
655
|
-
const start = i;
|
|
656
|
-
for (let p = start; p < start + produced; p++) {
|
|
657
|
-
addPos(p);
|
|
658
|
-
}
|
|
659
|
-
i += produced;
|
|
660
|
-
} else {
|
|
661
|
-
litBuf.push(src[i]);
|
|
662
|
-
addPos(i);
|
|
663
|
-
i++;
|
|
664
|
-
if (litBuf.length === 127) {
|
|
665
|
-
flushLiterals();
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
if (litBuf.length) {
|
|
670
|
-
flushLiterals();
|
|
671
|
-
}
|
|
672
|
-
const u8 = new Uint8Array(out);
|
|
673
|
-
return base64Encode(u8);
|
|
674
|
-
|
|
675
|
-
function flushLiterals() {
|
|
676
|
-
while (litBuf.length) {
|
|
677
|
-
const take = Math.min(127, litBuf.length);
|
|
678
|
-
out.push(take);
|
|
679
|
-
for (let t = 0; t < take; t++) {
|
|
680
|
-
out.push(litBuf.shift());
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
function addPos(pos) {
|
|
686
|
-
if (pos + 2 < N) {
|
|
687
|
-
const key = (src[pos] << 16) | (src[pos + 1] << 8) | src[pos + 2];
|
|
688
|
-
const arr = map.get(key) || [];
|
|
689
|
-
arr.push(pos);
|
|
690
|
-
if (arr.length > MAX_CANDIDATES) {
|
|
691
|
-
arr.shift();
|
|
692
|
-
}
|
|
693
|
-
map.set(key, arr);
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
}
|
package/vendor/zip/z-worker.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";const{Array:e,Object:t,Number:n,Math:s,Error:r,Uint8Array:a,Uint16Array:i,Uint32Array:o,Int32Array:l,Map:c,DataView:h,Promise:f,TextEncoder:u,crypto:p,postMessage:d,TransformStream:g,ReadableStream:w,WritableStream:y,CompressionStream:v,DecompressionStream:b}=self,m=void 0,_="undefined",S="function";class k{constructor(e){return class extends g{constructor(t,n){const s=new e(n);super({transform(e,t){t.enqueue(s.append(e))},flush(e){const t=s.flush();t&&e.enqueue(t)}})}}}}const z=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)1&t?t=t>>>1^3988292384:t>>>=1;z[e]=t}class D{constructor(e){this.crc=e||-1}append(e){let t=0|this.crc;for(let n=0,s=0|e.length;s>n;n++)t=t>>>8^z[255&(t^e[n])];this.crc=t}get(){return~this.crc}}class C extends g{constructor(){let e;const t=new D;super({transform(e,n){t.append(e),n.enqueue(e)},flush(){const n=new a(4);new h(n.buffer).setUint32(0,t.get()),e.value=n}}),e=this}}const x={concat(e,t){if(0===e.length||0===t.length)return e.concat(t);const n=e[e.length-1],s=x.getPartial(n);return 32===s?e.concat(t):x._shiftRight(t,s,0|n,e.slice(0,e.length-1))},bitLength(e){const t=e.length;if(0===t)return 0;const n=e[t-1];return 32*(t-1)+x.getPartial(n)},clamp(e,t){if(32*e.length<t)return e;const n=(e=e.slice(0,s.ceil(t/32))).length;return t&=31,n>0&&t&&(e[n-1]=x.partial(t,e[n-1]&2147483648>>t-1,1)),e},partial:(e,t,n)=>32===e?t:(n?0|t:t<<32-e)+1099511627776*e,getPartial:e=>s.round(e/1099511627776)||32,_shiftRight(e,t,n,s){for(void 0===s&&(s=[]);t>=32;t-=32)s.push(n),n=0;if(0===t)return s.concat(e);for(let r=0;r<e.length;r++)s.push(n|e[r]>>>t),n=e[r]<<32-t;const r=e.length?e[e.length-1]:0,a=x.getPartial(r);return s.push(x.partial(t+a&31,t+a>32?n:s.pop(),1)),s}},I={bytes:{fromBits(e){const t=x.bitLength(e)/8,n=new a(t);let s;for(let r=0;t>r;r++)3&r||(s=e[r/4]),n[r]=s>>>24,s<<=8;return n},toBits(e){const t=[];let n,s=0;for(n=0;n<e.length;n++)s=s<<8|e[n],3&~n||(t.push(s),s=0);return 3&n&&t.push(x.partial(8*(3&n),s)),t}}},T=class{constructor(e){const t=this;t.blockSize=512,t._init=[1732584193,4023233417,2562383102,271733878,3285377520],t._key=[1518500249,1859775393,2400959708,3395469782],e?(t._h=e._h.slice(0),t._buffer=e._buffer.slice(0),t._length=e._length):t.reset()}reset(){const e=this;return e._h=e._init.slice(0),e._buffer=[],e._length=0,e}update(e){const t=this;"string"==typeof e&&(e=I.utf8String.toBits(e));const n=t._buffer=x.concat(t._buffer,e),s=t._length,a=t._length=s+x.bitLength(e);if(a>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const i=new o(n);let l=0;for(let e=t.blockSize+s-(t.blockSize+s&t.blockSize-1);a>=e;e+=t.blockSize)t._block(i.subarray(16*l,16*(l+1))),l+=1;return n.splice(0,16*l),t}finalize(){const e=this;let t=e._buffer;const n=e._h;t=x.concat(t,[x.partial(1,1)]);for(let e=t.length+2;15&e;e++)t.push(0);for(t.push(s.floor(e._length/4294967296)),t.push(0|e._length);t.length;)e._block(t.splice(0,16));return e.reset(),n}_f(e,t,n,s){return e>19?e>39?e>59?e>79?void 0:t^n^s:t&n|t&s|n&s:t^n^s:t&n|~t&s}_S(e,t){return t<<e|t>>>32-e}_block(t){const n=this,r=n._h,a=e(80);for(let e=0;16>e;e++)a[e]=t[e];let i=r[0],o=r[1],l=r[2],c=r[3],h=r[4];for(let e=0;79>=e;e++){16>e||(a[e]=n._S(1,a[e-3]^a[e-8]^a[e-14]^a[e-16]));const t=n._S(5,i)+n._f(e,o,l,c)+h+a[e]+n._key[s.floor(e/20)]|0;h=c,c=l,l=n._S(30,o),o=i,i=t}r[0]=r[0]+i|0,r[1]=r[1]+o|0,r[2]=r[2]+l|0,r[3]=r[3]+c|0,r[4]=r[4]+h|0}},A={getRandomValues(e){const t=new o(e.buffer),n=e=>{let t=987654321;const n=4294967295;return()=>(t=36969*(65535&t)+(t>>16)&n,(((t<<16)+(e=18e3*(65535&e)+(e>>16)&n)&n)/4294967296+.5)*(s.random()>.5?1:-1))};for(let r,a=0;a<e.length;a+=4){const e=n(4294967296*(r||s.random()));r=987654071*e(),t[a/4]=4294967296*e()|0}return e}},q={importKey:e=>new q.hmacSha1(I.bytes.toBits(e)),pbkdf2(e,t,n,s){if(n=n||1e4,0>s||0>n)throw new r("invalid params to pbkdf2");const a=1+(s>>5)<<2;let i,o,l,c,f;const u=new ArrayBuffer(a),p=new h(u);let d=0;const g=x;for(t=I.bytes.toBits(t),f=1;(a||1)>d;f++){for(i=o=e.encrypt(g.concat(t,[f])),l=1;n>l;l++)for(o=e.encrypt(o),c=0;c<o.length;c++)i[c]^=o[c];for(l=0;(a||1)>d&&l<i.length;l++)p.setInt32(d,i[l]),d+=4}return u.slice(0,s/8)},hmacSha1:class{constructor(e){const t=this,n=t._hash=T,s=[[],[]];t._baseHash=[new n,new n];const r=t._baseHash[0].blockSize/32;e.length>r&&(e=(new n).update(e).finalize());for(let t=0;r>t;t++)s[0][t]=909522486^e[t],s[1][t]=1549556828^e[t];t._baseHash[0].update(s[0]),t._baseHash[1].update(s[1]),t._resultHash=new n(t._baseHash[0])}reset(){const e=this;e._resultHash=new e._hash(e._baseHash[0]),e._updated=!1}update(e){this._updated=!0,this._resultHash.update(e)}digest(){const e=this,t=e._resultHash.finalize(),n=new e._hash(e._baseHash[1]).update(t).finalize();return e.reset(),n}encrypt(e){if(this._updated)throw new r("encrypt on already updated hmac called!");return this.update(e),this.digest(e)}}},R=typeof p!=_&&typeof p.getRandomValues==S,H="Invalid password",P="Invalid signature",B="zipjs-abort-check-password";function K(e){return R?p.getRandomValues(e):A.getRandomValues(e)}const V=16,E={name:"PBKDF2"},U=t.assign({hash:{name:"HMAC"}},E),W=t.assign({iterations:1e3,hash:{name:"SHA-1"}},E),M=["deriveBits"],N=[8,12,16],O=[16,24,32],F=10,L=[0,0,0,0],j=typeof p!=_,G=j&&p.subtle,X=j&&typeof G!=_,J=I.bytes,Q=class{constructor(e){const t=this;t._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],t._tables[0][0][0]||t._precompute();const n=t._tables[0][4],s=t._tables[1],a=e.length;let i,o,l,c=1;if(4!==a&&6!==a&&8!==a)throw new r("invalid aes key size");for(t._key=[o=e.slice(0),l=[]],i=a;4*a+28>i;i++){let e=o[i-1];(i%a==0||8===a&&i%a==4)&&(e=n[e>>>24]<<24^n[e>>16&255]<<16^n[e>>8&255]<<8^n[255&e],i%a==0&&(e=e<<8^e>>>24^c<<24,c=c<<1^283*(c>>7))),o[i]=o[i-a]^e}for(let e=0;i;e++,i--){const t=o[3&e?i:i-4];l[e]=4>=i||4>e?t:s[0][n[t>>>24]]^s[1][n[t>>16&255]]^s[2][n[t>>8&255]]^s[3][n[255&t]]}}encrypt(e){return this._crypt(e,0)}decrypt(e){return this._crypt(e,1)}_precompute(){const e=this._tables[0],t=this._tables[1],n=e[4],s=t[4],r=[],a=[];let i,o,l,c;for(let e=0;256>e;e++)a[(r[e]=e<<1^283*(e>>7))^e]=e;for(let h=i=0;!n[h];h^=o||1,i=a[i]||1){let a=i^i<<1^i<<2^i<<3^i<<4;a=a>>8^255&a^99,n[h]=a,s[a]=h,c=r[l=r[o=r[h]]];let f=16843009*c^65537*l^257*o^16843008*h,u=257*r[a]^16843008*a;for(let n=0;4>n;n++)e[n][h]=u=u<<24^u>>>8,t[n][a]=f=f<<24^f>>>8}for(let n=0;5>n;n++)e[n]=e[n].slice(0),t[n]=t[n].slice(0)}_crypt(e,t){if(4!==e.length)throw new r("invalid aes block size");const n=this._key[t],s=n.length/4-2,a=[0,0,0,0],i=this._tables[t],o=i[0],l=i[1],c=i[2],h=i[3],f=i[4];let u,p,d,g=e[0]^n[0],w=e[t?3:1]^n[1],y=e[2]^n[2],v=e[t?1:3]^n[3],b=4;for(let e=0;s>e;e++)u=o[g>>>24]^l[w>>16&255]^c[y>>8&255]^h[255&v]^n[b],p=o[w>>>24]^l[y>>16&255]^c[v>>8&255]^h[255&g]^n[b+1],d=o[y>>>24]^l[v>>16&255]^c[g>>8&255]^h[255&w]^n[b+2],v=o[v>>>24]^l[g>>16&255]^c[w>>8&255]^h[255&y]^n[b+3],b+=4,g=u,w=p,y=d;for(let e=0;4>e;e++)a[t?3&-e:e]=f[g>>>24]<<24^f[w>>16&255]<<16^f[y>>8&255]<<8^f[255&v]^n[b++],u=g,g=w,w=y,y=v,v=u;return a}},Y=class{constructor(e,t){this._prf=e,this._initIv=t,this._iv=t}reset(){this._iv=this._initIv}update(e){return this.calculate(this._prf,e,this._iv)}incWord(e){if(255&~(e>>24))e+=1<<24;else{let t=e>>16&255,n=e>>8&255,s=255&e;255===t?(t=0,255===n?(n=0,255===s?s=0:++s):++n):++t,e=0,e+=t<<16,e+=n<<8,e+=s}return e}incCounter(e){0===(e[0]=this.incWord(e[0]))&&(e[1]=this.incWord(e[1]))}calculate(e,t,n){let s;if(!(s=t.length))return[];const r=x.bitLength(t);for(let r=0;s>r;r+=4){this.incCounter(n);const s=e.encrypt(n);t[r]^=s[0],t[r+1]^=s[1],t[r+2]^=s[2],t[r+3]^=s[3]}return x.clamp(t,r)}},Z=q.hmacSha1;let $=j&&X&&typeof G.importKey==S,ee=j&&X&&typeof G.deriveBits==S;class te extends g{constructor({password:e,rawPassword:n,signed:s,encryptionStrength:i,checkPasswordOnly:o}){super({start(){t.assign(this,{ready:new f((e=>this.resolveReady=e)),password:ae(e,n),signed:s,strength:i-1,pending:new a})},async transform(e,t){const n=this,{password:s,strength:i,resolveReady:l,ready:c}=n;s?(await(async(e,t,n,s)=>{const a=await re(e,t,n,oe(s,0,N[t])),i=oe(s,N[t]);if(a[0]!=i[0]||a[1]!=i[1])throw new r(H)})(n,i,s,oe(e,0,N[i]+2)),e=oe(e,N[i]+2),o?t.error(new r(B)):l()):await c;const h=new a(e.length-F-(e.length-F)%V);t.enqueue(se(n,e,h,0,F,!0))},async flush(e){const{signed:t,ctr:n,hmac:s,pending:i,ready:o}=this;if(s&&n){await o;const l=oe(i,0,i.length-F),c=oe(i,i.length-F);let h=new a;if(l.length){const e=ce(J,l);s.update(e);const t=n.update(e);h=le(J,t)}if(t){const e=oe(le(J,s.digest()),0,F);for(let t=0;F>t;t++)if(e[t]!=c[t])throw new r(P)}e.enqueue(h)}}})}}class ne extends g{constructor({password:e,rawPassword:n,encryptionStrength:s}){let r;super({start(){t.assign(this,{ready:new f((e=>this.resolveReady=e)),password:ae(e,n),strength:s-1,pending:new a})},async transform(e,t){const n=this,{password:s,strength:r,resolveReady:i,ready:o}=n;let l=new a;s?(l=await(async(e,t,n)=>{const s=K(new a(N[t]));return ie(s,await re(e,t,n,s))})(n,r,s),i()):await o;const c=new a(l.length+e.length-e.length%V);c.set(l,0),t.enqueue(se(n,e,c,l.length,0))},async flush(e){const{ctr:t,hmac:n,pending:s,ready:i}=this;if(n&&t){await i;let o=new a;if(s.length){const e=t.update(ce(J,s));n.update(e),o=le(J,e)}r.signature=le(J,n.digest()).slice(0,F),e.enqueue(ie(o,r.signature))}}}),r=this}}function se(e,t,n,s,r,i){const{ctr:o,hmac:l,pending:c}=e,h=t.length-r;let f;for(c.length&&(t=ie(c,t),n=((e,t)=>{if(t&&t>e.length){const n=e;(e=new a(t)).set(n,0)}return e})(n,h-h%V)),f=0;h-V>=f;f+=V){const e=ce(J,oe(t,f,f+V));i&&l.update(e);const r=o.update(e);i||l.update(r),n.set(le(J,r),f+s)}return e.pending=oe(t,f),n}async function re(n,s,r,i){n.password=null;const o=await(async(e,t,n,s,r)=>{if(!$)return q.importKey(t);try{return await G.importKey("raw",t,n,!1,r)}catch(e){return $=!1,q.importKey(t)}})(0,r,U,0,M),l=await(async(e,t,n)=>{if(!ee)return q.pbkdf2(t,e.salt,W.iterations,n);try{return await G.deriveBits(e,t,n)}catch(s){return ee=!1,q.pbkdf2(t,e.salt,W.iterations,n)}})(t.assign({salt:i},W),o,8*(2*O[s]+2)),c=new a(l),h=ce(J,oe(c,0,O[s])),f=ce(J,oe(c,O[s],2*O[s])),u=oe(c,2*O[s]);return t.assign(n,{keys:{key:h,authentication:f,passwordVerification:u},ctr:new Y(new Q(h),e.from(L)),hmac:new Z(f)}),u}function ae(e,t){return t===m?(e=>{if(typeof u==_){const t=new a((e=unescape(encodeURIComponent(e))).length);for(let n=0;n<t.length;n++)t[n]=e.charCodeAt(n);return t}return(new u).encode(e)})(e):t}function ie(e,t){let n=e;return e.length+t.length&&(n=new a(e.length+t.length),n.set(e,0),n.set(t,e.length)),n}function oe(e,t,n){return e.subarray(t,n)}function le(e,t){return e.fromBits(t)}function ce(e,t){return e.toBits(t)}class he extends g{constructor({password:e,passwordVerification:n,checkPasswordOnly:s}){super({start(){t.assign(this,{password:e,passwordVerification:n}),de(this,e)},transform(e,t){const n=this;if(n.password){const t=ue(n,e.subarray(0,12));if(n.password=null,t[11]!=n.passwordVerification)throw new r(H);e=e.subarray(12)}s?t.error(new r(B)):t.enqueue(ue(n,e))}})}}class fe extends g{constructor({password:e,passwordVerification:n}){super({start(){t.assign(this,{password:e,passwordVerification:n}),de(this,e)},transform(e,t){const n=this;let s,r;if(n.password){n.password=null;const t=K(new a(12));t[11]=n.passwordVerification,s=new a(e.length+t.length),s.set(pe(n,t),0),r=12}else s=new a(e.length),r=0;s.set(pe(n,e),r),t.enqueue(s)}})}}function ue(e,t){const n=new a(t.length);for(let s=0;s<t.length;s++)n[s]=we(e)^t[s],ge(e,n[s]);return n}function pe(e,t){const n=new a(t.length);for(let s=0;s<t.length;s++)n[s]=we(e)^t[s],ge(e,t[s]);return n}function de(e,n){const s=[305419896,591751049,878082192];t.assign(e,{keys:s,crcKey0:new D(s[0]),crcKey2:new D(s[2])});for(let t=0;t<n.length;t++)ge(e,n.charCodeAt(t))}function ge(e,t){let[n,r,a]=e.keys;e.crcKey0.append([t]),n=~e.crcKey0.get(),r=ve(s.imul(ve(r+ye(n)),134775813)+1),e.crcKey2.append([r>>>24]),a=~e.crcKey2.get(),e.keys=[n,r,a]}function we(e){const t=2|e.keys[2];return ye(s.imul(t,1^t)>>>8)}function ye(e){return 255&e}function ve(e){return 4294967295&e}const be="deflate-raw";class me extends g{constructor(e,{chunkSize:t,CompressionStream:n,CompressionStreamNative:s}){super({});const{compressed:r,encrypted:a,useCompressionStream:i,zipCrypto:o,signed:l,level:c}=e,f=this;let u,p,d=Se(super.readable);a&&!o||!l||(u=new C,d=De(d,u)),r&&(d=ze(d,i,{level:c,chunkSize:t},s,n)),a&&(o?d=De(d,new fe(e)):(p=new ne(e),d=De(d,p))),ke(f,d,(()=>{let e;a&&!o&&(e=p.signature),a&&!o||!l||(e=new h(u.value.buffer).getUint32(0)),f.signature=e}))}}class _e extends g{constructor(e,{chunkSize:t,DecompressionStream:n,DecompressionStreamNative:s}){super({});const{zipCrypto:a,encrypted:i,signed:o,signature:l,compressed:c,useCompressionStream:f}=e;let u,p,d=Se(super.readable);i&&(a?d=De(d,new he(e)):(p=new te(e),d=De(d,p))),c&&(d=ze(d,f,{chunkSize:t},s,n)),i&&!a||!o||(u=new C,d=De(d,u)),ke(this,d,(()=>{if((!i||a)&&o){const e=new h(u.value.buffer);if(l!=e.getUint32(0,!1))throw new r(P)}}))}}function Se(e){return De(e,new g({transform(e,t){e&&e.length&&t.enqueue(e)}}))}function ke(e,n,s){n=De(n,new g({flush:s})),t.defineProperty(e,"readable",{get:()=>n})}function ze(e,t,n,s,r){try{e=De(e,new(t&&s?s:r)(be,n))}catch(s){if(!t)return e;try{e=De(e,new r(be,n))}catch(t){return e}}return e}function De(e,t){return e.pipeThrough(t)}const Ce="data",xe="close";class Ie extends g{constructor(e,n){super({});const s=this,{codecType:r}=e;let a;r.startsWith("deflate")?a=me:r.startsWith("inflate")&&(a=_e);let i=0,o=0;const l=new a(e,n),c=super.readable,h=new g({transform(e,t){e&&e.length&&(o+=e.length,t.enqueue(e))},flush(){t.assign(s,{inputSize:o})}}),f=new g({transform(e,t){e&&e.length&&(i+=e.length,t.enqueue(e))},flush(){const{signature:e}=l;t.assign(s,{signature:e,outputSize:i,inputSize:o})}});t.defineProperty(s,"readable",{get:()=>c.pipeThrough(h).pipeThrough(l).pipeThrough(f)})}}class Te extends g{constructor(e){let t;super({transform:function n(s,r){if(t){const e=new a(t.length+s.length);e.set(t),e.set(s,t.length),s=e,t=null}s.length>e?(r.enqueue(s.slice(0,e)),n(s.slice(e),r)):t=s},flush(e){t&&t.length&&e.enqueue(t)}})}}const Ae=new c,qe=new c;let Re,He=0,Pe=!0;async function Be(e){try{const{options:t,scripts:s,config:r}=e;if(s&&s.length)try{Pe?importScripts.apply(m,s):await Ke(s)}catch(e){Pe=!1,await Ke(s)}self.initCodec&&self.initCodec(),r.CompressionStreamNative=self.CompressionStream,r.DecompressionStreamNative=self.DecompressionStream,self.Deflate&&(r.CompressionStream=new k(self.Deflate)),self.Inflate&&(r.DecompressionStream=new k(self.Inflate));const a={highWaterMark:1},i=e.readable||new w({async pull(e){const t=new f((e=>Ae.set(He,e)));Ve({type:"pull",messageId:He}),He=(He+1)%n.MAX_SAFE_INTEGER;const{value:s,done:r}=await t;e.enqueue(s),r&&e.close()}},a),o=e.writable||new y({async write(e){let t;const s=new f((e=>t=e));qe.set(He,t),Ve({type:Ce,value:e,messageId:He}),He=(He+1)%n.MAX_SAFE_INTEGER,await s}},a),l=new Ie(t,r);Re=new AbortController;const{signal:c}=Re;await i.pipeThrough(l).pipeThrough(new Te(r.chunkSize)).pipeTo(o,{signal:c,preventClose:!0,preventAbort:!0}),await o.getWriter().close();const{signature:h,inputSize:u,outputSize:p}=l;Ve({type:xe,result:{signature:h,inputSize:u,outputSize:p}})}catch(e){Ee(e)}}async function Ke(e){for(const t of e)await import(t)}function Ve(e){let{value:t}=e;if(t)if(t.length)try{t=new a(t),e.value=t.buffer,d(e,[e.value])}catch(t){d(e)}else d(e);else d(e)}function Ee(e=new r("Unknown error")){const{message:t,stack:n,code:s,name:a}=e;d({error:{message:t,stack:n,code:s,name:a}})}addEventListener("message",(({data:e})=>{const{type:t,messageId:n,value:s,done:r}=e;try{if("start"==t&&Be(e),t==Ce){const e=Ae.get(n);Ae.delete(n),e({value:new a(s),done:r})}if("ack"==t){const e=qe.get(n);qe.delete(n),e()}t==xe&&Re.abort()}catch(e){Ee(e)}}));var Ue=a,We=i,Me=l,Ne=new Ue([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Oe=new Ue([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Fe=new Ue([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Le=(e,t)=>{for(var n=new We(31),s=0;31>s;++s)n[s]=t+=1<<e[s-1];var r=new Me(n[30]);for(s=1;30>s;++s)for(var a=n[s];a<n[s+1];++a)r[a]=a-n[s]<<5|s;return{b:n,r:r}},je=Le(Ne,2),Ge=je.b,Xe=je.r;Ge[28]=258,Xe[258]=28;for(var Je=Le(Oe,0),Qe=Je.b,Ye=Je.r,Ze=new We(32768),$e=0;32768>$e;++$e){var et=(43690&$e)>>1|(21845&$e)<<1;et=(61680&(et=(52428&et)>>2|(13107&et)<<2))>>4|(3855&et)<<4,Ze[$e]=((65280&et)>>8|(255&et)<<8)>>1}var tt=(e,t,n)=>{for(var s=e.length,r=0,a=new We(t);s>r;++r)e[r]&&++a[e[r]-1];var i,o=new We(t);for(r=1;t>r;++r)o[r]=o[r-1]+a[r-1]<<1;if(n){i=new We(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var c=r<<4|e[r],h=t-e[r],f=o[e[r]-1]++<<h,u=f|(1<<h)-1;u>=f;++f)i[Ze[f]>>l]=c}else for(i=new We(s),r=0;s>r;++r)e[r]&&(i[r]=Ze[o[e[r]-1]++]>>15-e[r]);return i},nt=new Ue(288);for($e=0;144>$e;++$e)nt[$e]=8;for($e=144;256>$e;++$e)nt[$e]=9;for($e=256;280>$e;++$e)nt[$e]=7;for($e=280;288>$e;++$e)nt[$e]=8;var st=new Ue(32);for($e=0;32>$e;++$e)st[$e]=5;var rt=tt(nt,9,0),at=tt(nt,9,1),it=tt(st,5,0),ot=tt(st,5,1),lt=e=>{for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},ct=(e,t,n)=>{var s=t/8|0;return(e[s]|e[s+1]<<8)>>(7&t)&n},ht=(e,t)=>{var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},ft=e=>(e+7)/8|0,ut=(e,t,n)=>((null==t||0>t)&&(t=0),(null==n||n>e.length)&&(n=e.length),new Ue(e.subarray(t,n))),pt=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],dt=(e,t,n)=>{var s=new r(t||pt[e]);if(s.code=e,r.captureStackTrace&&r.captureStackTrace(s,dt),!n)throw s;return s},gt=(e,t,n)=>{n<<=7&t;var s=t/8|0;e[s]|=n,e[s+1]|=n>>8},wt=(e,t,n)=>{n<<=7&t;var s=t/8|0;e[s]|=n,e[s+1]|=n>>8,e[s+2]|=n>>16},yt=(e,t)=>{for(var n=[],s=0;s<e.length;++s)e[s]&&n.push({s:s,f:e[s]});var r=n.length,a=n.slice();if(!r)return{t:zt,l:0};if(1==r){var i=new Ue(n[0].s+1);return i[n[0].s]=1,{t:i,l:1}}n.sort(((e,t)=>e.f-t.f)),n.push({s:-1,f:25001});var o=n[0],l=n[1],c=0,h=1,f=2;for(n[0]={s:-1,f:o.f+l.f,l:o,r:l};h!=r-1;)o=n[n[c].f<n[f].f?c++:f++],l=n[c!=h&&n[c].f<n[f].f?c++:f++],n[h++]={s:-1,f:o.f+l.f,l:o,r:l};var u=a[0].s;for(s=1;r>s;++s)a[s].s>u&&(u=a[s].s);var p=new We(u+1),d=vt(n[h-1],p,0);if(d>t){s=0;var g=0,w=d-t,y=1<<w;for(a.sort(((e,t)=>p[t.s]-p[e.s]||e.f-t.f));r>s;++s){var v=a[s].s;if(p[v]<=t)break;g+=y-(1<<d-p[v]),p[v]=t}for(g>>=w;g>0;){var b=a[s].s;p[b]<t?g-=1<<t-p[b]++-1:++s}for(;s>=0&&g;--s){var m=a[s].s;p[m]==t&&(--p[m],++g)}d=t}return{t:new Ue(p),l:d}},vt=(e,t,n)=>-1==e.s?s.max(vt(e.l,t,n+1),vt(e.r,t,n+1)):t[e.s]=n,bt=e=>{for(var t=e.length;t&&!e[--t];);for(var n=new We(++t),s=0,r=e[0],a=1,i=e=>{n[s++]=e},o=1;t>=o;++o)if(e[o]==r&&o!=t)++a;else{if(!r&&a>2){for(;a>138;a-=138)i(32754);a>2&&(i(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(i(r),--a;a>6;a-=6)i(8304);a>2&&(i(a-3<<5|8208),a=0)}for(;a--;)i(r);a=1,r=e[o]}return{c:n.subarray(0,s),n:t}},mt=(e,t)=>{for(var n=0,s=0;s<t.length;++s)n+=e[s]*t[s];return n},_t=(e,t,n)=>{var s=n.length,r=ft(t+2);e[r]=255&s,e[r+1]=s>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var a=0;s>a;++a)e[r+a+4]=n[a];return 8*(r+4+s)},St=(e,t,n,s,r,a,i,o,l,c,h)=>{gt(t,h++,n),++r[256];for(var f=yt(r,15),u=f.t,p=f.l,d=yt(a,15),g=d.t,w=d.l,y=bt(u),v=y.c,b=y.n,m=bt(g),_=m.c,S=m.n,k=new We(19),z=0;z<v.length;++z)++k[31&v[z]];for(z=0;z<_.length;++z)++k[31&_[z]];for(var D=yt(k,7),C=D.t,x=D.l,I=19;I>4&&!C[Fe[I-1]];--I);var T,A,q,R,H=c+5<<3,P=mt(r,nt)+mt(a,st)+i,B=mt(r,u)+mt(a,g)+i+14+3*I+mt(k,C)+2*k[16]+3*k[17]+7*k[18];if(l>=0&&P>=H&&B>=H)return _t(t,h,e.subarray(l,l+c));if(gt(t,h,1+(P>B)),h+=2,P>B){T=tt(u,p,0),A=u,q=tt(g,w,0),R=g;var K=tt(C,x,0);for(gt(t,h,b-257),gt(t,h+5,S-1),gt(t,h+10,I-4),h+=14,z=0;I>z;++z)gt(t,h+3*z,C[Fe[z]]);h+=3*I;for(var V=[v,_],E=0;2>E;++E){var U=V[E];for(z=0;z<U.length;++z){var W=31&U[z];gt(t,h,K[W]),h+=C[W],W>15&&(gt(t,h,U[z]>>5&127),h+=U[z]>>12)}}}else T=rt,A=nt,q=it,R=st;for(z=0;o>z;++z){var M=s[z];if(M>255){wt(t,h,T[257+(W=M>>18&31)]),h+=A[W+257],W>7&&(gt(t,h,M>>23&31),h+=Ne[W]);var N=31&M;wt(t,h,q[N]),h+=R[N],N>3&&(wt(t,h,M>>5&8191),h+=Oe[N])}else wt(t,h,T[M]),h+=A[M]}return wt(t,h,T[256]),h+A[256]},kt=new Me([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),zt=new Ue(0),Dt=function(){function e(e,t){if("function"==typeof e&&(t=e,e={}),this.ondata=t,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new Ue(98304),this.o.dictionary){var n=this.o.dictionary.subarray(-32768);this.b.set(n,32768-n.length),this.s.i=32768-n.length}}return e.prototype.p=function(e,t){this.ondata(((e,t,n,r,a)=>{if(!a&&(a={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new Ue(i.length+e.length);o.set(i),o.set(e,i.length),e=o,a.w=i.length}return((e,t,n,r,a,i)=>{var o=i.z||e.length,l=new Ue(0+o+5*(1+s.ceil(o/7e3))+0),c=l.subarray(0,l.length-0),h=i.l,f=7&(i.r||0);if(t){f&&(c[0]=i.r>>3);for(var u=kt[t-1],p=u>>13,d=8191&u,g=(1<<n)-1,w=i.p||new We(32768),y=i.h||new We(g+1),v=s.ceil(n/3),b=2*v,m=t=>(e[t]^e[t+1]<<v^e[t+2]<<b)&g,_=new Me(25e3),S=new We(288),k=new We(32),z=0,D=0,C=i.i||0,x=0,I=i.w||0,T=0;o>C+2;++C){var A=m(C),q=32767&C,R=y[A];if(w[q]=R,y[A]=q,C>=I){var H=o-C;if((z>7e3||x>24576)&&(H>423||!h)){f=St(e,c,0,_,S,k,D,x,T,C-T,f),x=z=D=0,T=C;for(var P=0;286>P;++P)S[P]=0;for(P=0;30>P;++P)k[P]=0}var B=2,K=0,V=d,E=q-R&32767;if(H>2&&A==m(C-E))for(var U=s.min(p,H)-1,W=s.min(32767,C),M=s.min(258,H);W>=E&&--V&&q!=R;){if(e[C+B]==e[C+B-E]){for(var N=0;M>N&&e[C+N]==e[C+N-E];++N);if(N>B){if(B=N,K=E,N>U)break;var O=s.min(E,N-2),F=0;for(P=0;O>P;++P){var L=C-E+P&32767,j=L-w[L]&32767;j>F&&(F=j,R=L)}}}E+=(q=R)-(R=w[q])&32767}if(K){_[x++]=268435456|Xe[B]<<18|Ye[K];var G=31&Xe[B],X=31&Ye[K];D+=Ne[G]+Oe[X],++S[257+G],++k[X],I=C+B,++z}else _[x++]=e[C],++S[e[C]]}}for(C=s.max(C,I);o>C;++C)_[x++]=e[C],++S[e[C]];f=St(e,c,h,_,S,k,D,x,T,C-T,f),h||(i.r=7&f|c[f/8|0]<<3,f-=7,i.h=y,i.p=w,i.i=C,i.w=I)}else{for(C=i.w||0;o+h>C;C+=65535){var J=C+65535;o>J||(c[f/8|0]=h,J=o),f=_t(c,f+1,e.subarray(C,J))}i.i=o}return ut(l,0,0+ft(f)+0)})(e,null==t.level?6:t.level,null==t.mem?a.l?s.ceil(1.5*s.max(8,s.min(13,s.log(e.length)))):20:12+t.mem,0,0,a)})(e,this.o,0,0,this.s),t)},e.prototype.push=function(e,t){this.ondata||dt(5),this.s.l&&dt(4);var n=e.length+this.s.z;if(n>this.b.length){if(n>2*this.b.length-32768){var s=new Ue(-32768&n);s.set(this.b.subarray(0,this.s.z)),this.b=s}var r=this.b.length-this.s.z;this.b.set(e.subarray(0,r),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(r),32768),this.s.z=e.length-r+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=1&t,(this.s.z>this.s.w+8191||t)&&(this.p(this.b,t||!1),this.s.w=this.s.i,this.s.i-=2)},e.prototype.flush=function(){this.ondata||dt(5),this.s.l&&dt(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},e}(),Ct=function(){function e(e,t){"function"==typeof e&&(t=e,e={}),this.ondata=t;var n=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new Ue(32768),this.p=new Ue(0),n&&this.o.set(n)}return e.prototype.e=function(e){if(this.ondata||dt(5),this.d&&dt(4),this.p.length){if(e.length){var t=new Ue(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}}else this.p=e},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,n=((e,t,n)=>{var r=e.length;if(!r||t.f&&!t.l)return n||new Ue(0);var a=!n,i=a||2!=t.i,o=t.i;a&&(n=new Ue(3*r));var l=e=>{var t=n.length;if(e>t){var r=new Ue(s.max(2*t,e));r.set(n),n=r}},c=t.f||0,h=t.p||0,f=t.b||0,u=t.l,p=t.d,d=t.m,g=t.n,w=8*r;do{if(!u){c=ct(e,h,1);var y=ct(e,h+1,3);if(h+=3,!y){var v=e[(T=ft(h)+4)-4]|e[T-3]<<8,b=T+v;if(b>r){o&&dt(0);break}i&&l(f+v),n.set(e.subarray(T,b),f),t.b=f+=v,t.p=h=8*b,t.f=c;continue}if(1==y)u=at,p=ot,d=9,g=5;else if(2==y){var m=ct(e,h,31)+257,_=ct(e,h+10,15)+4,S=m+ct(e,h+5,31)+1;h+=14;for(var k=new Ue(S),z=new Ue(19),D=0;_>D;++D)z[Fe[D]]=ct(e,h+3*D,7);h+=3*_;var C=lt(z),x=(1<<C)-1,I=tt(z,C,1);for(D=0;S>D;){var T,A=I[ct(e,h,x)];if(h+=15&A,16>(T=A>>4))k[D++]=T;else{var q=0,R=0;for(16==T?(R=3+ct(e,h,3),h+=2,q=k[D-1]):17==T?(R=3+ct(e,h,7),h+=3):18==T&&(R=11+ct(e,h,127),h+=7);R--;)k[D++]=q}}var H=k.subarray(0,m),P=k.subarray(m);d=lt(H),g=lt(P),u=tt(H,d,1),p=tt(P,g,1)}else dt(1);if(h>w){o&&dt(0);break}}i&&l(f+131072);for(var B=(1<<d)-1,K=(1<<g)-1,V=h;;V=h){var E=(q=u[ht(e,h)&B])>>4;if((h+=15&q)>w){o&&dt(0);break}if(q||dt(2),256>E)n[f++]=E;else{if(256==E){V=h,u=null;break}var U=E-254;if(E>264){var W=Ne[D=E-257];U=ct(e,h,(1<<W)-1)+Ge[D],h+=W}var M=p[ht(e,h)&K],N=M>>4;if(M||dt(3),h+=15&M,P=Qe[N],N>3&&(W=Oe[N],P+=ht(e,h)&(1<<W)-1,h+=W),h>w){o&&dt(0);break}i&&l(f+131072);var O=f+U;if(P>f){var F=0-P,L=s.min(P,O);for(0>F+f&&dt(3);L>f;++f)n[f]=(void 0)[F+f]}for(;O>f;++f)n[f]=n[f-P]}}t.l=u,t.p=V,t.b=f,t.f=c,u&&(c=1,t.m=d,t.d=p,t.n=g)}while(!c);return f!=n.length&&a?ut(n,0,f):n.subarray(0,f)})(this.p,this.s,this.o);this.ondata(ut(n,t,this.s.b),this.d),this.o=ut(n,this.s.b-32768),this.s.b=this.o.length,this.p=ut(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),xt="undefined"!=typeof TextDecoder&&new TextDecoder;try{xt.decode(zt,{stream:!0})}catch(e){}function It(e,n,s){return class{constructor(r){const i=this;var o,l;o=r,l="level",(typeof t.hasOwn===S?t.hasOwn(o,l):o.hasOwnProperty(l))&&r.level===m&&delete r.level,i.codec=new e(t.assign({},n,r)),s(i.codec,(e=>{if(i.pendingData){const t=i.pendingData;i.pendingData=new a(t.length+e.length);const{pendingData:n}=i;n.set(t,0),n.set(e,t.length)}else i.pendingData=new a(e)}))}append(e){return this.codec.push(e),r(this)}flush(){return this.codec.push(new a,!0),r(this)}};function r(e){if(e.pendingData){const t=e.pendingData;return e.pendingData=null,t}return new a}}const{Deflate:Tt,Inflate:At}=((e,t={},n)=>({Deflate:It(e.Deflate,t.deflate,n),Inflate:It(e.Inflate,t.inflate,n)}))({Deflate:Dt,Inflate:Ct},m,((e,t)=>e.ondata=t));self.initCodec=()=>{self.Deflate=Tt,self.Inflate=At}}();
|
|
1
|
+
!function(){"use strict";const{Array:t,Object:e,Number:n,Math:r,Error:s,Uint8Array:o,Uint16Array:c,Uint32Array:a,Int32Array:i,Map:l,DataView:u,Promise:f,TextEncoder:w,crypto:h,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:g,DecompressionStream:S}=self,v=void 0,k="undefined",z="function",C=new o,b=[[],[],[],[],[],[],[],[]];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)e=1&e?e>>>1^3988292384:e>>>1;b[0][t]=e}for(let t=0;256>t;t++)for(let e=1;8>e;e++){const n=b[e-1][t];b[e][t]=n>>>8^b[0][255&n]}const[A,I,x,P,M,B,D,F]=b;class _{constructor(t){this.o=t||-1}append(t){let e=0|this.o;const n=0|t.length;let r=0;if(n>=8&&t.buffer){const s=new u(t.buffer,t.byteOffset,n),o=n-8;for(;o>=r;r+=8){const t=e^s.getInt32(r,!0),n=s.getInt32(r+4,!0);e=F[255&t]^D[t>>>8&255]^B[t>>>16&255]^M[t>>>24&255]^P[255&n]^x[n>>>8&255]^I[n>>>16&255]^A[n>>>24&255]}}for(;n>r;r++)e=e>>>8^A[255&(e^t[r])];this.o=e}get(){return~this.o}}class R extends d{constructor(){let t;const e=new _;super({transform(t,n){e.append(t),n.enqueue(t)},flush(){const n=new o(4);new u(n.buffer).setUint32(0,e.get()),t.value=n}}),t=this}}function T(t,e){const n=new o(t.length+e.length);return n.set(t),n.set(e,t.length),n}function U(t){return new u(t.buffer,t.byteOffset,t.byteLength)}const V={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const n=t[t.length-1],r=V.l(n);return 32===r?t.concat(e):V.h(e,r,0|n,t.slice(0,t.length-1))},bitLength(t){const e=t.length;if(0===e)return 0;const n=t[e-1];return 32*(e-1)+V.l(n)},m(t,e){if(32*t.length<e)return t;const n=(t=t.slice(0,r.ceil(e/32))).length;return e&=31,n>0&&e&&(t[n-1]=V.S(e,t[n-1]&2147483648>>e-1,1)),t},S:(t,e,n)=>32===t?e:(n?0|e:e<<32-t)+1099511627776*t,l:t=>r.round(t/1099511627776)||32,h(t,e,n,r){for(void 0===r&&(r=[]);e>=32;e-=32)r.push(n),n=0;if(0===e)return r.concat(t);for(let s=0;s<t.length;s++)r.push(n|t[s]>>>e),n=t[s]<<32-e;const s=t.length?t[t.length-1]:0,o=V.l(s);return r.push(V.S(e+o&31,e+o>32?n:r.pop(),1)),r}},K={bytes:{v(t){const e=V.bitLength(t)/8,n=new o(e);let r;for(let s=0;e>s;s++)3&s||(r=t[s/4]),n[s]=r>>>24,r<<=8;return n},C(t){const e=[];let n,r=0;for(n=0;n<t.length;n++)r=r<<8|t[n],3&~n||(e.push(r),r=0);return 3&n&&e.push(V.S(8*(3&n),r)),e}}},E=class{constructor(t){const e=this;e.blockSize=512,e.A=[1732584193,4023233417,2562383102,271733878,3285377520],e.I=[1518500249,1859775393,2400959708,3395469782],t?(e.P=t.P.slice(0),e.M=t.M.slice(0),e.B=t.B):e.reset()}reset(){const t=this;return t.P=t.A.slice(0),t.M=[],t.B=0,t}update(t){const e=this;"string"==typeof t&&(t=K.D.C(t));const n=e.M=V.concat(e.M,t),r=e.B,o=e.B=r+V.bitLength(t);if(o>9007199254740991)throw new s("Cannot hash more than 2^53 - 1 bits");const c=new a(n);let i=0;for(let t=e.blockSize+r-(e.blockSize+r&e.blockSize-1);o>=t;t+=e.blockSize)e.F(c.subarray(16*i,16*(i+1))),i+=1;return n.splice(0,16*i),e}_(){const t=this;let e=t.M;const n=t.P;e=V.concat(e,[V.S(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(r.floor(t.B/4294967296)),e.push(0|t.B);e.length;)t.F(e.splice(0,16));return t.reset(),n}R(t,e,n,r){return t>19?t>39?t>59?t>79?void 0:e^n^r:e&n|e&r|n&r:e^n^r:e&n|~e&r}T(t,e){return e<<t|e>>>32-t}F(e){const n=this,s=n.P,o=t(80);for(let t=0;16>t;t++)o[t]=e[t];let c=s[0],a=s[1],i=s[2],l=s[3],u=s[4];for(let t=0;79>=t;t++){16>t||(o[t]=n.T(1,o[t-3]^o[t-8]^o[t-14]^o[t-16]));const e=n.T(5,c)+n.R(t,a,i,l)+u+o[t]+n.I[r.floor(t/20)]|0;u=l,l=i,i=n.T(30,a),a=c,c=e}s[0]=s[0]+c|0,s[1]=s[1]+a|0,s[2]=s[2]+i|0,s[3]=s[3]+l|0,s[4]=s[4]+u|0}},O={importKey:t=>new O.U(K.bytes.C(t)),V(t,e,n,r){if(n=n||1e4,0>r||0>n)throw new s("invalid params to pbkdf2");const o=1+(r>>5)<<2;let c,a,i,l,f;const w=new ArrayBuffer(o),h=new u(w);let p=0;const d=V;for(e=K.bytes.C(e),f=1;(o||1)>p;f++){for(c=a=t.encrypt(d.concat(e,[f])),i=1;n>i;i++)for(a=t.encrypt(a),l=0;l<a.length;l++)c[l]^=a[l];for(i=0;(o||1)>p&&i<c.length;i++)h.setInt32(p,c[i]),p+=4}return w.slice(0,r/8)},U:class{constructor(t){const e=this,n=e.K=E,r=[[],[]];e.O=[new n,new n];const s=e.O[0].blockSize/32;t.length>s&&(t=(new n).update(t)._());for(let e=0;s>e;e++)r[0][e]=909522486^t[e],r[1][e]=1549556828^t[e];e.O[0].update(r[0]),e.O[1].update(r[1]),e.W=new n(e.O[0])}reset(){const t=this;t.W=new t.K(t.O[0]),t.j=!1}update(t){this.j=!0,this.W.update(t)}digest(){const t=this,e=t.W._(),n=new t.K(t.O[1]).update(e)._();return t.reset(),n}encrypt(t){if(this.j)throw new s("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},W=typeof h!=k&&typeof h.getRandomValues==z,j="Invalid password",H="Invalid signature",L=H,N="zipjs-abort-check-password";function q(t){if(W)return h.getRandomValues(t);throw new s("Crypto API not supported")}const G=16,J={name:"PBKDF2"},Q=e.assign({hash:{name:"HMAC"}},J),X=e.assign({iterations:1e3,hash:{name:"SHA-1"}},J),Y=["deriveBits"],Z=[8,12,16],$=[16,24,32],tt=10,et=[0,0,0,0],nt=typeof h!=k,rt=nt&&h.subtle,st=nt&&typeof rt!=k,ot=K.bytes,ct=class{constructor(t){const e=this;e.H=[[[],[],[],[],[]],[[],[],[],[],[]]],e.H[0][0][0]||e.L();const n=e.H[0][4],r=e.H[1],o=t.length;let c,a,i,l=1;if(4!==o&&6!==o&&8!==o)throw new s("invalid aes key size");for(e.I=[a=t.slice(0),i=[]],c=o;4*o+28>c;c++){let t=a[c-1];(c%o===0||8===o&&c%o===4)&&(t=n[t>>>24]<<24^n[t>>16&255]<<16^n[t>>8&255]<<8^n[255&t],c%o===0&&(t=t<<8^t>>>24^l<<24,l=l<<1^283*(l>>7))),a[c]=a[c-o]^t}for(let t=0;c;t++,c--){const e=a[3&t?c:c-4];i[t]=4>=c||4>t?e:r[0][n[e>>>24]]^r[1][n[e>>16&255]]^r[2][n[e>>8&255]]^r[3][n[255&e]]}}encrypt(t){return this.N(t,0)}decrypt(t){return this.N(t,1)}L(){const t=this.H[0],e=this.H[1],n=t[4],r=e[4],s=[],o=[];let c,a,i,l;for(let t=0;256>t;t++)o[(s[t]=t<<1^283*(t>>7))^t]=t;for(let u=c=0;!n[u];u^=a||1,c=o[c]||1){let o=c^c<<1^c<<2^c<<3^c<<4;o=o>>8^255&o^99,n[u]=o,r[o]=u,l=s[i=s[a=s[u]]];let f=16843009*l^65537*i^257*a^16843008*u,w=257*s[o]^16843008*o;for(let n=0;4>n;n++)t[n][u]=w=w<<24^w>>>8,e[n][o]=f=f<<24^f>>>8}for(let n=0;5>n;n++)t[n]=t[n].slice(0),e[n]=e[n].slice(0)}N(t,e){if(4!==t.length)throw new s("invalid aes block size");const n=this.I[e],r=n.length/4-2,o=[0,0,0,0],c=this.H[e],a=c[0],i=c[1],l=c[2],u=c[3],f=c[4];let w,h,p,d=t[0]^n[0],y=t[e?3:1]^n[1],m=t[2]^n[2],g=t[e?1:3]^n[3],S=4;for(let t=0;r>t;t++)w=a[d>>>24]^i[y>>16&255]^l[m>>8&255]^u[255&g]^n[S],h=a[y>>>24]^i[m>>16&255]^l[g>>8&255]^u[255&d]^n[S+1],p=a[m>>>24]^i[g>>16&255]^l[d>>8&255]^u[255&y]^n[S+2],g=a[g>>>24]^i[d>>16&255]^l[y>>8&255]^u[255&m]^n[S+3],S+=4,d=w,y=h,m=p;for(let t=0;4>t;t++)o[e?3&-t:t]=f[d>>>24]<<24^f[y>>16&255]<<16^f[m>>8&255]<<8^f[255&g]^n[S++],w=d,d=y,y=m,m=g,g=w;return o}},at=class{constructor(t,e){this.G=t,this.J=e,this.X=e}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 e=t>>16&255,n=t>>8&255,r=255&t;255===e?(e=0,255===n?(n=0,255===r?r=0:++r):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=r}return t}$(t){0===(t[0]=this.Z(t[0]))&&(t[1]=this.Z(t[1]))}Y(t,e,n){let r;if(!(r=e.length))return[];const s=V.bitLength(e);for(let s=0;r>s;s+=4){this.$(n);const r=t.encrypt(n);e[s]^=r[0],e[s+1]^=r[1],e[s+2]^=r[2],e[s+3]^=r[3]}return V.m(e,s)}},it=O.U;let lt=nt&&st&&typeof rt.importKey==z,ut=nt&&st&&typeof rt.deriveBits==z;class ft extends d{constructor({password:t,rawPassword:e,encryptionStrength:n,checkPasswordOnly:r,checkAuthenticationCode:c=!0}){super({start(){ht(this,t,e,n)},async transform(t,e){const n=this,{password:c,strength:a,et:i,ready:l}=n;c?(await(async(t,e,n,r)=>{const o=await dt(t,e,n,mt(r,0,Z[e])),c=mt(r,Z[e]);if(o[0]!=c[0]||o[1]!=c[1])throw new s(j)})(n,a,c,mt(t,0,Z[a]+2)),t=mt(t,Z[a]+2),r?e.error(new s(N)):i()):await l;const u=new o(t.length-tt-(t.length-tt)%G);e.enqueue(pt(n,t,u,0,tt,!0))},async flush(t){const{nt:e,st:n,pending:r,ready:o}=this;if(n&&e){await o;const a=mt(r,0,r.length-tt),i=mt(r,r.length-tt);let l=C;if(a.length){const t=St(ot,a);n.update(t);const r=e.update(t);l=gt(ot,r)}const u=mt(gt(ot,n.digest()),0,tt);let f=r.length<tt?1:0;for(let t=0;tt>t;t++)f|=u[t]^i[t];if(f&&c)throw new s(L);t.enqueue(l)}}})}}class wt extends d{constructor({password:t,rawPassword:e,encryptionStrength:n}){super({start(){ht(this,t,e,n)},async transform(t,e){const n=this,{password:r,strength:s,et:c,ready:a}=n;let i=C;r?(i=await(async(t,e,n)=>{const r=q(new o(Z[e]));return T(r,await dt(t,e,n,r))})(n,s,r),c()):await a;const l=new o(i.length+t.length-t.length%G);l.set(i,0),e.enqueue(pt(n,t,l,i.length,0))},async flush(t){const{nt:e,st:n,pending:r,ready:s}=this;if(n&&e){await s;let o=C;if(r.length){const t=e.update(St(ot,r));n.update(t),o=gt(ot,t)}const c=gt(ot,n.digest()).slice(0,tt);t.enqueue(T(o,c))}}})}}function ht(t,n,r,s){e.assign(t,{ready:new f(e=>t.et=e),password:yt(n,r),strength:s-1,pending:C})}function pt(t,e,n,r,s,c){const{nt:a,st:i,pending:l}=t;l.length&&(e=T(l,e));const u=e.length-s;let f;for(n=((t,e)=>{if(e&&e>t.length){const n=t;(t=new o(e)).set(n,0)}return t})(n,r+(u-u%G)),f=0;u-G>=f;f+=G){const t=St(ot,mt(e,f,f+G));c&&i.update(t);const s=a.update(t);c||i.update(s),n.set(gt(ot,s),f+r)}return t.pending=mt(e,f),n}async function dt(n,r,s,c){n.password=null;const a=await(async(t,e,n,r,s)=>{if(!lt)return O.importKey(e);try{return await rt.importKey("raw",e,n,!1,s)}catch{return lt=!1,O.importKey(e)}})(0,s,Q,0,Y),i=await(async(t,e,n)=>{if(!ut)return O.V(e,t.salt,X.iterations,n);try{return await rt.deriveBits(t,e,n)}catch{return ut=!1,O.V(e,t.salt,X.iterations,n)}})(e.assign({salt:c},X),a,8*(2*$[r]+2)),l=new o(i),u=St(ot,mt(l,0,$[r])),f=St(ot,mt(l,$[r],2*$[r])),w=mt(l,2*$[r]);return e.assign(n,{keys:{key:u,ot:f,passwordVerification:w},nt:new at(new ct(u),t.from(et)),st:new it(f)}),w}function yt(t,e){return e===v?(t=>{if(typeof w==k){const e=new o((t=unescape(encodeURIComponent(t))).length);for(let n=0;n<e.length;n++)e[n]=t.charCodeAt(n);return e}return(new w).encode(t)})(t):e}function mt(t,e,n){return t.subarray(e,n)}function gt(t,e){return t.v(e)}function St(t,e){return t.C(e)}class vt extends d{constructor({password:t,rawPassword:e,passwordVerification:n,checkPasswordOnly:r}){super({start(){zt(this,t,e,n)},transform(t,e){const n=this;if(n.password||n.rawPassword){const e=Ct(n,t.subarray(0,12));if(n.password=n.rawPassword=null,0!=(e[11]^n.passwordVerification))throw new s(j);t=t.subarray(12)}r?e.error(new s(N)):e.enqueue(Ct(n,t))}})}}class kt extends d{constructor({password:t,rawPassword:e,passwordVerification:n}){super({start(){zt(this,t,e,n)},transform(t,e){const n=this;let r,s;if(n.password||n.rawPassword){n.password=n.rawPassword=null;const e=q(new o(12));e[11]=n.passwordVerification,r=new o(t.length+e.length),r.set(bt(n,e),0),s=12}else r=new o(t.length),s=0;r.set(bt(n,t),s),e.enqueue(r)}})}}function zt(t,n,r,s){e.assign(t,{password:n,rawPassword:r,passwordVerification:s}),((t,n,r)=>{const s=[305419896,591751049,878082192];if(e.assign(t,{keys:s,ct:new _(s[0]),it:new _(s[2])}),r)for(let e=0;e<r.length;e++)At(t,r[e]);else for(let e=0;e<n.length;e++)At(t,n.charCodeAt(e))})(t,n,r)}function Ct(t,e){const n=new o(e.length);for(let r=0;r<e.length;r++)n[r]=It(t)^e[r],At(t,n[r]);return n}function bt(t,e){const n=new o(e.length);for(let r=0;r<e.length;r++)n[r]=It(t)^e[r],At(t,e[r]);return n}function At(t,e){let[,n]=t.keys;t.ct.append([e]);const s=~t.ct.get();n=Pt(r.imul(Pt(n+xt(s)),134775813)+1),t.it.append([n>>>24]);const o=~t.it.get();t.keys=[s,n,o]}function It(t){const e=2|t.keys[2];return xt(r.imul(e,1^e)>>>8)}function xt(t){return 255&t}function Pt(t){return 4294967295&t}const Mt=new l;function Bt(t){return Mt.get(t)}const Dt="Invalid uncompressed size",Ft=H,_t="deflate-raw",Rt="gzip",Tt=[31,139,8];class Ut extends d{constructor(t,{chunkSize:e,CompressionStreamFallback:n,CompressionStream:r}){super({});const{compressed:s,encrypted:o,useCompressionStream:c,zipCrypto:a,computeCrc32:i,level:l,deflate64:f,format:w,compressionMethod:h}=t,p=this;let d,y,m,g=super.readable;const S=w&&Bt(w),v=i&&s&&!f&&!S&&(!o||a)&&!(!c||!r);if(o&&!a||!i||v||(d=new R,g=Ht(g,d)),s)if(S)g=Lt(g,Wt(S.CompressionStream,w,{level:l,chunkSize:e,compressionMethod:h}));else if(v)m=new Vt,g=Lt(g,new r(Rt)),g=Ht(g,m);else try{g=jt(g,c,{level:l,chunkSize:e},r,n)}catch(t){let e;try{e=new r(Rt)}catch{throw t}g=Lt(g,e),g=Ht(g,new Vt)}o&&(a?g=Ht(g,new kt(t)):(y=new wt(t),g=Ht(g,y))),Ot(p,g,()=>{o&&!a||!i||(p.crc32=v?m.crc32:new u(d.value.buffer).getUint32(0))})}}class Vt extends d{constructor(){let t,e=10,n=new o(0);super({transform(t,s){if(e){const n=r.min(e,t.length);if(e-=n,!(t=t.subarray(n)).length)return}const o=n.length+t.length;if(8>=o)return void(n=T(n,t));const c=o-8,a=r.min(c,n.length);s.enqueue(T(n.subarray(0,a),t.subarray(0,c-a))),n=T(n.subarray(a),t.subarray(c-a))},flush(){const e=U(n);t.crc32=e.getUint32(0,!0),t.uncompressedSize=e.getUint32(4,!0)}}),t=this}}class Kt extends d{constructor(t,{chunkSize:e,DecompressionStreamFallback:n,DecompressionStream:r}){super({});const{zipCrypto:c,encrypted:a,checkCrc32:i,crc32:l,compressed:w,useCompressionStream:h,deflate64:p,format:m,compressionMethod:g,rawBitFlag:S,outputSize:k}=t;let z,C,b=super.readable;if(a&&(c?b=Ht(b,new vt(t)):(C=new ft(t),b=Ht(b,C))),w){const t=m&&Bt(m);if(t)b=Lt(b,Wt(t.DecompressionStream,m,{chunkSize:e,compressionMethod:g,rawBitFlag:S,uncompressedSize:k}));else try{b=jt(b,h,{chunkSize:e,deflate64:p},r,n)}catch(t){if(p||k===v)throw t;let e;try{e=new r(Rt)}catch{throw t}b=((t,e,n)=>{const r=new _;let c,a,i,l=0,u=!1;const w=new f((t,e)=>{a=t,i=e});w.catch(()=>{}),n||a();const h=new d({start(t){const e=new o(10);e.set(Tt),t.enqueue(e)},transform(t,e){e.enqueue(t)},async flush(t){u=!0,y();try{await w}finally{m()}const e=new o(8),s=U(e);s.setUint32(0,r.get(),!0),s.setUint32(4,n,!0),t.enqueue(e)},cancel(t){i(t)}}),p=new d({transform(t,e){r.append(t),l+=t.length,n>l?u&&y():a(),e.enqueue(t)},cancel(t){i(t)}});return t=Ht(t,h),Ht(t=Lt(t,e),p);function y(){m(),c=setTimeout(()=>i(new s(Dt)),5e3)}function m(){clearTimeout(c)}})(b,e,k)}b=(t=>{const e=t.getReader();return new y({async pull(t){let n;try{n=await e.read()}catch(t){if(t&&t.message)throw t;const e=new s("Invalid compressed data");throw e.cause=t,e}const{value:r,done:o}=n;o?t.close():t.enqueue(r)},cancel:t=>e.cancel(t)})})(b)}i&&(z=new R,b=Ht(b,z)),Ot(this,b,()=>{if(i){const t=new u(z.value.buffer);if(l!=t.getUint32(0,!1))throw new s(Ft)}})}}const Et=new l;function Ot(t,n,r){n=Ht(n,new d({flush:r})),e.defineProperty(t,"readable",{get:()=>n})}function Wt(t,e,n){if(!t)throw new s("Compression method not supported");return new t(e,n)}function jt(t,e,n,r,s){const o=e&&r?r:s||r,c=n.deflate64?"deflate64-raw":_t;let a;try{a=new o(c,n)}catch(t){if(!e||!s||o==s)throw t;a=new s(c,n)}return Lt(t,a)}function Ht(t,e){return(t=>{if(t instanceof y)return t;const e=t.getReader();return new y({async pull(t){const{value:n,done:r}=await e.read();r?t.close():t.enqueue(n)},cancel:t=>e.cancel(t)})})(t).pipeThrough(e)}function Lt(t,e){const n=e.writable.getWriter(),r=t.getReader();return(async()=>{try{for(;;){await n.ready;const t=await r.read();if(t.done){await n.close();break}await n.write(t.value)}}catch(t){await(async(t,e)=>{try{await t.abort(e)}catch{}})(n,t),await(async(t,e)=>{try{await t.cancel(e)}catch{}})(r,t)}})(),e.readable}const Nt="data",qt="close",Gt="deflate";class Jt extends d{constructor(t,n){super({});const r=this,{codecType:o}=t;let c;o.startsWith(Gt)?c=Ut:o.startsWith("inflate")&&(c=Kt),r.outputSize=0;let a=0;const i=new c(t,n),l=super.readable,u=new d({transform(t,e){t&&t.length&&(a+=t.length,e.enqueue(t))},flush(){e.assign(r,{inputSize:a})}}),f=new d({transform(e,n){if(e&&e.length&&(n.enqueue(e),r.outputSize+=e.length,t.outputSize!==v&&r.outputSize>t.outputSize))throw new s(Dt)},flush(){const{crc32:t}=i;e.assign(r,{crc32:t,inputSize:a})}});e.defineProperty(r,"readable",{get:()=>l.pipeThrough(u).pipeThrough(i).pipeThrough(f)})}}class Qt extends d{constructor(t){const e=[];let r=0;function s(){const n=new o(t);let s=0;for(;t>s;){const r=e[0],o=t-s;r.length>o?(n.set(r.subarray(0,o),s),e[0]=r.subarray(o),s+=o):(n.set(r,s),s+=r.length,e.shift())}return r-=t,n}n.isFinite(t)&&t>=1||(t=65536),super({transform(n,o){for(e.push(n),r+=n.length;r>t;)o.enqueue(s())},flush(t){r&&t.enqueue(((t,e)=>{const n=new o(e);let r=0;for(const e of t)n.set(e,r),r+=e.length;return n})(e,r))}})}}let Xt=2;try{typeof navigator!=k&&navigator.hardwareConcurrency&&(Xt=navigator.hardwareConcurrency)}catch{}const Yt=new l,Zt=new l;let $t,te=0;async function ee(t){let e,o;try{const{options:c,config:a}=t;if(c.format)try{await(async(t,e)=>{!Mt.has(t)&&e&&((t,e)=>{const{CompressionStream:n,DecompressionStream:r}=e;if(typeof n!=z&&typeof r!=z)throw new s("Invalid codec module");Mt.set(t,{CompressionStream:n,DecompressionStream:r})})(t,await(import(e)))})(c.format,c.codecURI)}catch(t){throw t.codecImportFailed=!0,t}if(a.CompressionStream=self.CompressionStream,a.DecompressionStream=self.DecompressionStream,c.compressed&&!c.format)if(c.useCompressionStream){if(!((t,e)=>{if(!t)return!1;let n=Et.get(t);n||(n=new l,Et.set(t,n));let r=n.get(e);if(r===v){try{new t(e),r=!0}catch{r=!1}n.set(e,r)}return r})(c.codecType.startsWith(Gt)?a.CompressionStream:a.DecompressionStream,_t))try{await self.initModule(t.config)}catch{}}else try{await self.initModule(t.config)}catch{c.useCompressionStream=!0}!a.CompressionStreamFallback&&a.CompressionStreamZlib&&(a.CompressionStreamFallback=a.CompressionStreamZlib),!a.DecompressionStreamFallback&&a.DecompressionStreamZlib&&(a.DecompressionStreamFallback=a.DecompressionStreamZlib);const i={highWaterMark:1},u=t.readable||new y({async pull(t){const e=new f(t=>Yt.set(te,t));ne({type:"pull",messageId:te}),te=(te+1)%n.MAX_SAFE_INTEGER;const{value:r,done:s}=await e;t.enqueue(r),s&&t.close()}},i);o=t.writable||new m({async write(t){let e;const r=new f(t=>e=t);Zt.set(te,e),ne({type:Nt,value:t,messageId:te}),te=(te+1)%n.MAX_SAFE_INTEGER,await r}},i),e=new Jt(c,a),$t=new AbortController;const{signal:w}=$t;await u.pipeThrough(e).pipeThrough(new Qt((t=>r.max(t.chunkSize,64))(a))).pipeTo(o,{signal:w,preventClose:!0,preventAbort:!0}),await o.getWriter().close();const{crc32:h,inputSize:p,outputSize:d}=e;ne({type:qt,result:{crc32:h,inputSize:p,outputSize:d}})}catch(t){if(t.outputSize=e?e.outputSize:0,o&&!o.locked)try{await o.getWriter().close()}catch{}re(t)}}function ne(t){const{value:e}=t;if(e)if(e.length)try{t.value=(n=e,n.byteOffset||n.byteLength!=n.buffer.byteLength?new o(n):n).buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t);var n}function re(t=new s("Unknown error")){const{message:e,stack:n,code:r,name:o,outputSize:c,cause:a,codecImportFailed:i}=t,l={message:e,stack:n,code:r,name:o,outputSize:c};a&&(l.cause={name:a.name,message:a.message}),i&&(l.codecImportFailed=!0),p({error:l})}addEventListener("message",({data:t})=>{const{type:e,messageId:n,value:r,done:s}=t;try{if("start"==e&&ee(t),e==Nt){const t=Yt.get(n);Yt.delete(n),t({value:r||new o,done:s})}if("ack"==e){const t=Zt.get(n);Zt.delete(n),t()}e==qt&&$t.abort()}catch(t){re(t)}}),p({type:"ready"}),((t={})=>{const{init:e}=t,n=t.CompressionStreamFallback||t.CompressionStreamZlib,r=t.DecompressionStreamFallback||t.DecompressionStreamZlib;self.initModule=async t=>{e&&await e(t),n&&(t.CompressionStreamFallback=n),r&&(t.DecompressionStreamFallback=r)}})()}();
|