single-file-core 1.5.118 → 1.5.119
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/core/helper.js +23 -22
- package/core/index.js +1 -6
- package/core/lib/doctype.js +0 -3
- package/core/lib/processor-helper-common.js +0 -19
- package/core/lib/processor-helper-inline.js +0 -6
- package/core/lib/processor-helper.js +7 -20
- package/modules/template-formatter.js +4 -2
- package/package.json +2 -2
- package/processors/compression/compression.js +11 -1
- package/test/sfz-harness/entry-compression.js +77 -0
- package/test/sfz-harness/filename-characters.js +55 -0
- package/test/sfz-harness/filename-max-length.js +69 -0
- package/vendor/zip/zip.min.js +1 -1
- package/zip-build/rollup.config.js +7 -0
package/core/helper.js
CHANGED
|
@@ -493,6 +493,15 @@ function getStylesheetsContent(styleSheets, adoptedStyleSheetsCache = new Map())
|
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
495
|
|
|
496
|
+
// an untouched canvas is fully transparent, so it encodes exactly like a blank one of the same
|
|
497
|
+
// size: comparing the two is cheaper than reading the pixels back and needs no drawing context
|
|
498
|
+
function isBlankCanvas(doc, element, dataURI) {
|
|
499
|
+
const blankElement = doc.createElement("canvas");
|
|
500
|
+
blankElement.width = element.width;
|
|
501
|
+
blankElement.height = element.height;
|
|
502
|
+
return blankElement.toDataURL("image/png") == dataURI;
|
|
503
|
+
}
|
|
504
|
+
|
|
496
505
|
function getResourcesInfo(win, doc, element, options, data, elementHidden, computedStyle) {
|
|
497
506
|
const tagName = element.tagName && element.tagName.toUpperCase();
|
|
498
507
|
if (tagName == "CANVAS") {
|
|
@@ -501,13 +510,19 @@ function getResourcesInfo(win, doc, element, options, data, elementHidden, compu
|
|
|
501
510
|
backgroundColor: canvasComputedStyle && canvasComputedStyle.getPropertyValue("background-color")
|
|
502
511
|
};
|
|
503
512
|
try {
|
|
504
|
-
|
|
513
|
+
const dataURI = element.toDataURL("image/png");
|
|
514
|
+
// a canvas in a page SingleFile has already saved is empty, no script ran to draw into
|
|
515
|
+
// it, and the picture it displays is the background image the previous save left
|
|
516
|
+
// behind. An empty bitmap must not overwrite it
|
|
517
|
+
const backgroundImage = canvasComputedStyle ? canvasComputedStyle.getPropertyValue("background-image") : element.style.getPropertyValue("background-image");
|
|
518
|
+
if (backgroundImage && backgroundImage != "none" && isBlankCanvas(doc, element, dataURI)) {
|
|
519
|
+
canvasData.blank = true;
|
|
520
|
+
} else {
|
|
521
|
+
canvasData.dataURI = dataURI;
|
|
522
|
+
}
|
|
505
523
|
// eslint-disable-next-line no-unused-vars
|
|
506
524
|
} catch (error) {
|
|
507
|
-
//
|
|
508
|
-
// whole element, its own drawing included. The entry is pushed and the element marked
|
|
509
|
-
// anyway: the loss is then counted and reported instead of being silent, and an
|
|
510
|
-
// out-of-page fallback re-rendering the element has something to find it by
|
|
525
|
+
// ignored
|
|
511
526
|
}
|
|
512
527
|
data.canvases.push(canvasData);
|
|
513
528
|
element.setAttribute(CANVAS_ATTRIBUTE_NAME, data.canvases.length - 1);
|
|
@@ -611,27 +626,11 @@ function getResourcesInfo(win, doc, element, options, data, elementHidden, compu
|
|
|
611
626
|
}
|
|
612
627
|
}
|
|
613
628
|
|
|
614
|
-
// Every family in the computed font-family is recorded, and the set of faces the document actually
|
|
615
|
-
// resolved is deliberately NOT consulted. Narrowing the list to the loaded faces is the obvious
|
|
616
|
-
// idea — a fallback stack names every family the page might need and only some are used — and it
|
|
617
|
-
// was written in 2019, wired to an option nothing ever set, and dead until it was reconnected here.
|
|
618
|
-
// Reconnected, it saved nothing measurable on nine real pages and cost fidelity twice: a face
|
|
619
|
-
// matched on its declared style is not found when the browser SYNTHESIZED that style, so a family
|
|
620
|
-
// drawn in an italic it declares no face for was dropped from the page that draws it; and a webfont
|
|
621
|
-
// that merely failed to load on the capturing machine would be dropped from the archive for good.
|
|
622
|
-
// It belongs with the unicode-range work, which needs the same information and can weigh a measured
|
|
623
|
-
// benefit against those, not here.
|
|
624
629
|
function getUsedFont(computedStyle, usedFonts) {
|
|
625
630
|
if (computedStyle) {
|
|
626
631
|
const fontStyle = computedStyle.getPropertyValue("font-style") || "normal";
|
|
627
632
|
computedStyle.getPropertyValue("font-family").split(",").forEach(fontFamilyName => {
|
|
628
633
|
fontFamilyName = normalizeFontFamily(fontFamilyName);
|
|
629
|
-
// an element with no computed font-family at all is one whose styles could not be read,
|
|
630
|
-
// not one drawn in a family with no name. It happens to every element of a frame that
|
|
631
|
-
// was re-parsed from its srcdoc, because the computed style is asked of the parent
|
|
632
|
-
// window and the document it belongs to is not the one being rendered. Recorded, it
|
|
633
|
-
// turns "nothing is known here" into a list of length one, which reads downstream as a
|
|
634
|
-
// complete answer and prunes every face the frame declares
|
|
635
634
|
if (fontFamilyName) {
|
|
636
635
|
const fontWeight = getFontWeight(computedStyle.getPropertyValue("font-weight"));
|
|
637
636
|
const fontVariant = computedStyle.getPropertyValue("font-variant") || "normal";
|
|
@@ -899,7 +898,9 @@ function getComputedStyle(win, element, pseudoElement) {
|
|
|
899
898
|
function getValidFilename(filename, replacedCharacters = DEFAULT_REPLACED_CHARACTERS, replacementCharacter = DEFAULT_REPLACEMENT_CHARACTER, replacementCharacters = DEFAULT_REPLACEMENT_CHARACTERS) {
|
|
900
899
|
replacementCharacters.forEach((indexReplacementCharacter, index) => {
|
|
901
900
|
if (replacedCharacters[index] !== undefined && indexReplacementCharacter != replacedCharacters[index]) {
|
|
902
|
-
|
|
901
|
+
// no "+" here, unlike the fallback below: a lookalike replaces its character one for
|
|
902
|
+
// one, so collapsing a run would drop characters the name needs ("C++" -> "C+")
|
|
903
|
+
filename = filename.replace(new RegExp("[" + getCharacterClassContent(replacedCharacters[index]) + "]", "g"), indexReplacementCharacter);
|
|
903
904
|
}
|
|
904
905
|
});
|
|
905
906
|
replacedCharacters.forEach((replacedCharacter, index) => {
|
package/core/index.js
CHANGED
|
@@ -826,11 +826,6 @@ class Processor {
|
|
|
826
826
|
});
|
|
827
827
|
}
|
|
828
828
|
|
|
829
|
-
// a media element left without any source can never start, and the attribute
|
|
830
|
-
// would keep it announcing a playback that never happens. The sources are
|
|
831
|
-
// dropped whenever they could not be stored, so this is not specific to
|
|
832
|
-
// blocked videos, and it runs on the final state to leave alone an element
|
|
833
|
-
// that kept one of several sources
|
|
834
829
|
removeEmptyMediaAutoplay() {
|
|
835
830
|
this.doc.querySelectorAll("video[autoplay], audio[autoplay]").forEach(element => {
|
|
836
831
|
const sourceElements = Array.from(element.querySelectorAll("source"));
|
|
@@ -1069,7 +1064,7 @@ class Processor {
|
|
|
1069
1064
|
}
|
|
1070
1065
|
this.processorHelper.setBackgroundImage(canvasElement, "url(" + canvasData.dataURI + ")", backgroundStyle);
|
|
1071
1066
|
this.stats.add("processed", "canvas", 1);
|
|
1072
|
-
} else {
|
|
1067
|
+
} else if (!canvasData.blank) {
|
|
1073
1068
|
discardedCount++;
|
|
1074
1069
|
this.stats.add("discarded", "canvas", 1);
|
|
1075
1070
|
}
|
package/core/lib/doctype.js
CHANGED
|
@@ -102,10 +102,6 @@ class ProcessorHelperCommon {
|
|
|
102
102
|
["image, feImage", "xlink:href"],
|
|
103
103
|
["image, feImage", "href"]
|
|
104
104
|
];
|
|
105
|
-
// an inline svg is document content, not a fetched resource: blocking images empties the
|
|
106
|
-
// references it makes outwards (image, feImage and use are all processed below) and leaves
|
|
107
|
-
// the markup itself alone. Removing it deleted JS-drawn charts, inline icons, and the
|
|
108
|
-
// <defs> holding gradients and filters that CSS applies to ordinary HTML elements
|
|
109
105
|
let resourcePromises = processAttributeArgs.map(([selector, attributeName, removeElementIfMissing, processDuplicates]) =>
|
|
110
106
|
this.processAttribute(doc, doc.querySelectorAll(selector), attributeName, baseURI, options, "image", resources, removeElementIfMissing, batchRequest, styles, processDuplicates)
|
|
111
107
|
);
|
|
@@ -137,9 +133,6 @@ class ProcessorHelperCommon {
|
|
|
137
133
|
resourceElement.setAttribute("data-sf-original-href", originalResourceURL);
|
|
138
134
|
}
|
|
139
135
|
let resourceURL = normalizeURL(originalResourceURL);
|
|
140
|
-
// a reference into the page itself costs no request, so blocking images must not empty
|
|
141
|
-
// it: normalizeURL drops the fragment, which leaves a bare "#symbol" as the empty path
|
|
142
|
-
// below and a same-document URL matching options.url
|
|
143
136
|
if (testValidPath(resourceURL) && !testIgnoredPath(resourceURL)) {
|
|
144
137
|
resourceElement.setAttribute(attributeName, util.EMPTY_RESOURCE);
|
|
145
138
|
if (!options.blockImages) {
|
|
@@ -257,9 +250,6 @@ class ProcessorHelperCommon {
|
|
|
257
250
|
}));
|
|
258
251
|
}
|
|
259
252
|
|
|
260
|
-
// a video or an audio element gets the attribute REMOVED rather than emptied: util.EMPTY_RESOURCE
|
|
261
|
-
// is inert on an image but not on a media element, which would attempt the load, fail, and sit
|
|
262
|
-
// in an error state where removing the attribute leaves the poster showing cleanly
|
|
263
253
|
setAttributeEmpty(resourceElement, attributeName, expectedType) {
|
|
264
254
|
if (expectedType == "video" || expectedType == "audio") {
|
|
265
255
|
resourceElement.removeAttribute(attributeName);
|
|
@@ -454,11 +444,6 @@ class ProcessorHelperCommon {
|
|
|
454
444
|
const key = this.getFontKey(ruleData);
|
|
455
445
|
const fontInfo = fontsDetails.fonts.get(key);
|
|
456
446
|
if (fontInfo) {
|
|
457
|
-
// a face declaring the same descriptors and the same sources as one already kept
|
|
458
|
-
// cannot change what that one did, and its sources are embedded a second time. A
|
|
459
|
-
// stylesheet reached from two <link> elements, or imported by two sheets, repeats
|
|
460
|
-
// every face it carries. The test is made before the await: the sources are read
|
|
461
|
-
// as they stand for both rules, and processing them is what would interleave
|
|
462
447
|
const ruleKey = key + " " + this.getPropertyValue(ruleData, "src");
|
|
463
448
|
if (fontsDetails.emittedFonts.has(ruleKey)) {
|
|
464
449
|
removedRules.push(cssRule);
|
|
@@ -524,10 +509,6 @@ class ProcessorHelperCommon {
|
|
|
524
509
|
medias: new Map(),
|
|
525
510
|
supports: new Map(),
|
|
526
511
|
layers: new Map(),
|
|
527
|
-
// the faces already emitted in this cascade context, so a second declaration of one of
|
|
528
|
-
// them can be dropped instead of embedding the same bytes again. Each media, supports
|
|
529
|
-
// and layer block gets its own info, so only rules that apply under the same conditions
|
|
530
|
-
// are ever compared
|
|
531
512
|
emittedFonts: new Set()
|
|
532
513
|
};
|
|
533
514
|
}
|
|
@@ -44,8 +44,6 @@ const EMPTY_URL_SOURCE = /^url\(["']?data:[^,]*,?["']?\)/;
|
|
|
44
44
|
const LOCAL_SOURCE = "local(";
|
|
45
45
|
const FONT_MAX_LOAD_DELAY = 5000;
|
|
46
46
|
const DUPLICATE_STYLESHEET_ATTRIBUTE_NAME = "data-sf-duplicate-stylesheet-ref";
|
|
47
|
-
// the attributes that say how the link fetched its stylesheet, which the style element now holding
|
|
48
|
-
// that stylesheet has no use for. Everything else identified the element in the page
|
|
49
47
|
const LINK_FETCH_ATTRIBUTE_NAMES = ["rel", "href", "type", "media", "as", "crossorigin", "integrity",
|
|
50
48
|
"referrerpolicy", "hreflang", "sizes", "imagesrcset", "imagesizes", "fetchpriority"];
|
|
51
49
|
|
|
@@ -166,10 +164,6 @@ function getProcessorHelperClass(utilInstance) {
|
|
|
166
164
|
if (stylesheetInfo) {
|
|
167
165
|
stylesheets.delete(linkElement);
|
|
168
166
|
const styleElement = doc.createElement("style");
|
|
169
|
-
// the element is replaced rather than rewritten, so whatever identified it in
|
|
170
|
-
// the page has to be carried over: an id a script still looks up, a class a
|
|
171
|
-
// selector still matches. The attributes left out are the ones that describe
|
|
172
|
-
// the fetch the style element no longer performs
|
|
173
167
|
Array.from(linkElement.attributes).forEach(({ name, value }) => {
|
|
174
168
|
if (!LINK_FETCH_ATTRIBUTE_NAMES.includes(name.toLowerCase())) {
|
|
175
169
|
styleElement.setAttribute(name, value);
|
|
@@ -36,6 +36,7 @@ const CANVAS_TAG_FOUND = /<canvas/gi;
|
|
|
36
36
|
const EMPTY_URL_SOURCE = /^url\(["']?data:[^,]*,?["']?\)/;
|
|
37
37
|
const LOCAL_SOURCE = "local(";
|
|
38
38
|
const FONT_MAX_LOAD_DELAY = 5000;
|
|
39
|
+
const SCRIPT_EXTENSION = ".js";
|
|
39
40
|
const LINK_OWN_ATTRIBUTE_NAMES = ["rel", "type", "href", "media"];
|
|
40
41
|
|
|
41
42
|
let util;
|
|
@@ -108,10 +109,6 @@ function getProcessorHelperClass(utilInstance) {
|
|
|
108
109
|
linkElement.setAttribute("type", "text/css");
|
|
109
110
|
const name = "stylesheet_" + resources.stylesheets.size + ".css";
|
|
110
111
|
linkElement.setAttribute("href", name);
|
|
111
|
-
// the shared copy is generated from the stylesheet of the element the duplicates were
|
|
112
|
-
// folded into, not from the text that was captured: that text still names the resources
|
|
113
|
-
// by their addresses in the original page, which resolve to nothing once the page is
|
|
114
|
-
// inside the archive
|
|
115
112
|
const { styleElement, content } = options.inlineStylesheets.get(stylesheetRefIndex);
|
|
116
113
|
const sharedEntry = entries.find(([key]) => key.element == styleElement);
|
|
117
114
|
const stylesheet = sharedEntry
|
|
@@ -119,10 +116,6 @@ function getProcessorHelperClass(utilInstance) {
|
|
|
119
116
|
: cssTree.parse(content, { context: "stylesheet", parseCustomProperty: true });
|
|
120
117
|
resources.stylesheets.set(resources.stylesheets.size, { name, content: this.generateStylesheetContent(stylesheet, options) });
|
|
121
118
|
linkElements.set(stylesheetRefIndex, linkElement);
|
|
122
|
-
// the element the duplicates were folded into is not itself a duplicate, so it is
|
|
123
|
-
// absent from inlineStylesheetsRefs and would keep its content inline: the archive
|
|
124
|
-
// would then hold the same stylesheet twice, once as the entry the links point at
|
|
125
|
-
// and once in the page
|
|
126
119
|
sharedStyleElements.set(styleElement, stylesheetRefIndex);
|
|
127
120
|
});
|
|
128
121
|
for (const [key, stylesheetInfo] of entries) {
|
|
@@ -149,10 +142,6 @@ function getProcessorHelperClass(utilInstance) {
|
|
|
149
142
|
styleElement.textContent = this.generateStylesheetContent(stylesheetInfo.stylesheet, options);
|
|
150
143
|
} else {
|
|
151
144
|
const linkElement = linkElements.get(stylesheetRefIndex).cloneNode(true);
|
|
152
|
-
// the element is replaced rather than rewritten, so whatever identified it in
|
|
153
|
-
// the page has to be carried over: an id a script still looks up, a class a
|
|
154
|
-
// selector still matches. The attributes left out are the ones that describe
|
|
155
|
-
// the link itself, which the code around here sets
|
|
156
145
|
Array.from(styleElement.attributes).forEach(({ name, value }) => {
|
|
157
146
|
if (!LINK_OWN_ATTRIBUTE_NAMES.includes(name.toLowerCase())) {
|
|
158
147
|
linkElement.setAttribute(name, value);
|
|
@@ -191,9 +180,6 @@ function getProcessorHelperClass(utilInstance) {
|
|
|
191
180
|
} catch (error) {
|
|
192
181
|
// ignored
|
|
193
182
|
}
|
|
194
|
-
// a sheet already open higher in this import chain must not be entered again: the
|
|
195
|
-
// ancestors are carried down the branch, not accumulated across the whole document,
|
|
196
|
-
// so two sibling imports of one sheet are still both resolved
|
|
197
183
|
if (testValidURL(resourceURL) && !importedStyleSheets.has(resourceURL)) {
|
|
198
184
|
const mediaQueryListNode = cssTree.find(node, node => node.type == "MediaQueryList");
|
|
199
185
|
let mediaText, layerName, supportsCondition;
|
|
@@ -231,9 +217,6 @@ function getProcessorHelperClass(utilInstance) {
|
|
|
231
217
|
stylesheetInfo.stylesheet = cssTree.parse(content.data, { context: "stylesheet", parseCustomProperty: true });
|
|
232
218
|
stylesheet = stylesheetInfo.stylesheet;
|
|
233
219
|
const ancestorStyleSheets = new Set(importedStyleSheets);
|
|
234
|
-
// both identities of the sheet are remembered: a redirect makes the URL that was
|
|
235
|
-
// requested and the URL that answered differ, and an import of either one is the
|
|
236
|
-
// same cycle
|
|
237
220
|
ancestorStyleSheets.add(requestedURL);
|
|
238
221
|
ancestorStyleSheets.add(resourceURL);
|
|
239
222
|
await this.resolveImportURLs(stylesheetInfo, resourceURL, options, workStylesheet, resources, stylesheets, ancestorStyleSheets);
|
|
@@ -472,7 +455,11 @@ function getProcessorHelperClass(utilInstance) {
|
|
|
472
455
|
networkTimeout: options.networkTimeout
|
|
473
456
|
});
|
|
474
457
|
content = getUpdatedResourceContent(resourceURL, options) || content;
|
|
475
|
-
|
|
458
|
+
// the extension is taken from the URL when the content type is not in the map, and a
|
|
459
|
+
// script URL says nothing about the content: a module served as text/javascript from a
|
|
460
|
+
// ".ts" URL was named ".ts", stored uncompressed and served back as video/mp2t, which
|
|
461
|
+
// the browser refuses to execute. Stylesheets have always been named this way
|
|
462
|
+
const name = "scripts/" + indexResource + SCRIPT_EXTENSION;
|
|
476
463
|
element.setAttribute("src", name);
|
|
477
464
|
resources.scripts.set(indexResource, { name, content, extension, contentType, url: resourceURL });
|
|
478
465
|
}
|
|
@@ -491,7 +478,7 @@ function getProcessorHelperClass(utilInstance) {
|
|
|
491
478
|
acceptHeaders: options.acceptHeaders,
|
|
492
479
|
networkTimeout: options.networkTimeout
|
|
493
480
|
});
|
|
494
|
-
const name = "scripts/" + indexResource +
|
|
481
|
+
const name = "scripts/" + indexResource + SCRIPT_EXTENSION;
|
|
495
482
|
if (workletOptions) {
|
|
496
483
|
scriptElement.textContent += ` CSS.paintWorklet.addModule("${name}", ${JSON.stringify(workletOptions)});\n`;
|
|
497
484
|
} else {
|
|
@@ -16883,8 +16883,10 @@ async function formatFilename(content, doc, options) {
|
|
|
16883
16883
|
if (!options.keepFilename && ((options.filenameMaxLengthUnit == "bytes" && getContentSize(filename) > options.filenameMaxLength) || filename.length > options.filenameMaxLength)) {
|
|
16884
16884
|
const extensionMatch = filename.match(/(\.[^.]{3,4})$/);
|
|
16885
16885
|
const extension = extensionMatch && extensionMatch[0] && extensionMatch[0].length > 1 ? extensionMatch[0] : "";
|
|
16886
|
-
|
|
16887
|
-
|
|
16886
|
+
const suffix = "…" + extension;
|
|
16887
|
+
const maxLength = Math.max(options.filenameMaxLength - (options.filenameMaxLengthUnit == "bytes" ? getContentSize(suffix) : suffix.length), 0);
|
|
16888
|
+
filename = options.filenameMaxLengthUnit == "bytes" ? await truncateText(filename, maxLength) : filename.substring(0, maxLength);
|
|
16889
|
+
filename = filename + suffix;
|
|
16888
16890
|
}
|
|
16889
16891
|
if (!filename) {
|
|
16890
16892
|
filename = "Unnamed page";
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "single-file-core",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.119",
|
|
4
4
|
"description": "SingleFile Core",
|
|
5
5
|
"author": "Gildas Lormeau",
|
|
6
6
|
"license": "AGPL-3.0-or-later",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"test": "deno run --allow-read test/sfz-harness/format-rules.js && deno run --allow-read test/sfz-harness/stored-trigger.js && deno run --allow-read test/sfz-harness/check-determinism.js && deno run --allow-read test/sfz-harness/option-wiring.js && deno run --allow-read test/sfz-harness/css-property-filter.js && deno run --allow-read test/sfz-harness/adopted-stylesheets-hook.js && deno run --allow-read test/sfz-harness/css-fonts-minifier.js && deno run --allow-read test/sfz-harness/inlined-functions.js && deno run --allow-read test/sfz-harness/pages-archive.js",
|
|
8
|
+
"test": "deno run --allow-read test/sfz-harness/format-rules.js && deno run --allow-read test/sfz-harness/stored-trigger.js && deno run --allow-read test/sfz-harness/check-determinism.js && deno run --allow-read test/sfz-harness/option-wiring.js && deno run --allow-read test/sfz-harness/css-property-filter.js && deno run --allow-read test/sfz-harness/adopted-stylesheets-hook.js && deno run --allow-read test/sfz-harness/css-fonts-minifier.js && deno run --allow-read test/sfz-harness/inlined-functions.js && deno run --allow-read test/sfz-harness/pages-archive.js && deno run --allow-read test/sfz-harness/filename-max-length.js && deno run --allow-read test/sfz-harness/entry-compression.js && deno run --allow-read test/sfz-harness/filename-characters.js",
|
|
9
9
|
"bump-patch": "npm version patch --no-git-tag-version && npm run bump-commit",
|
|
10
10
|
"bump-minor": "npm version minor --no-git-tag-version && npm run bump-commit",
|
|
11
11
|
"bump-major": "npm version major --no-git-tag-version && npm run bump-commit",
|
|
@@ -44,6 +44,12 @@ const { Blob, fetch, TextEncoder, TextDecoder, DOMParser } = globalThis;
|
|
|
44
44
|
// windows-1252 never decodes bytes >= 0x80 into the ASCII range, the scanned patterns are all ASCII
|
|
45
45
|
const TEXT_DECODER = new TextDecoder("windows-1252");
|
|
46
46
|
|
|
47
|
+
// the extension is only a guess when it comes from the URL, and a wrong one costs the whole
|
|
48
|
+
// gain: a script served as text/javascript from a ".ts" URL was stored uncompressed at 2260
|
|
49
|
+
// bytes where the same bytes named ".js" deflate to 70. A textual content type is authoritative
|
|
50
|
+
// when the server sent one, the extension list decides everything else
|
|
51
|
+
const COMPRESSIBLE_CONTENT_TYPES = ["application/javascript", "application/x-javascript", "application/ecmascript", "application/json", "application/ld+json", "application/manifest+json", "application/xml", "application/xhtml+xml", "application/rss+xml", "application/atom+xml", "image/svg+xml"];
|
|
52
|
+
const TEXT_CONTENT_TYPE_PREFIX = "text/";
|
|
47
53
|
const NO_COMPRESSION_EXTENSIONS = [".jpg", ".jpeg", ".png", ".apng", ".gif", ".webp", ".avif", ".heif", ".heic", ".jxl", ".pdf", ".woff", ".woff2", ".mp4", ".webm", ".avi", ".mpeg", ".mov", ".ts", ".ogv", ".mp3", ".ogg", ".oga", ".weba", ".m4a", ".aac", ".opus", ".flac"];
|
|
48
54
|
const SCRIPT_PATH = "/lib/single-file-zip.min.js";
|
|
49
55
|
// <noscript> is excluded: it is the only tag whose content is raw text when scripting is
|
|
@@ -789,12 +795,16 @@ async function addFile(zipWriter, prefixName, data, disableCompression) {
|
|
|
789
795
|
// password the resource URLs would be readable while the same map in manifest.json is not
|
|
790
796
|
options.comment = data.url && data.url.startsWith("data:") ? "data:" : data.url;
|
|
791
797
|
}
|
|
792
|
-
if (NO_COMPRESSION_EXTENSIONS.includes(data.extension)
|
|
798
|
+
if (disableCompression || (!isCompressibleContentType(data.contentType) && NO_COMPRESSION_EXTENSIONS.includes(data.extension))) {
|
|
793
799
|
options.level = 0;
|
|
794
800
|
}
|
|
795
801
|
await zipWriter.add(prefixName + data.name, dataReader, options);
|
|
796
802
|
}
|
|
797
803
|
|
|
804
|
+
function isCompressibleContentType(contentType) {
|
|
805
|
+
return Boolean(contentType) && (contentType.startsWith(TEXT_CONTENT_TYPE_PREFIX) || COMPRESSIBLE_CONTENT_TYPES.includes(contentType));
|
|
806
|
+
}
|
|
807
|
+
|
|
798
808
|
async function getContent() {
|
|
799
809
|
const BASE64_TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
800
810
|
// the function is inlined in the archive as source, it cannot close over the module scope
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Whether an entry is deflated or stored was decided by its extension alone, and the extension is
|
|
2
|
+
// only a guess: core/index.js takes it from the content type when the type is in its map and from
|
|
3
|
+
// the URL otherwise. CONTENT_TYPE_EXTENSIONS has no entry for text/javascript, so a module served
|
|
4
|
+
// as text/javascript from a ".ts" URL — every Vite dev server — was named ".ts", matched
|
|
5
|
+
// NO_COMPRESSION_EXTENSIONS, and went into the archive uncompressed: measured on a real capture at
|
|
6
|
+
// 2260 bytes where the same bytes named ".js" deflate to 70.
|
|
7
|
+
//
|
|
8
|
+
// The rule is now: a textual content type is authoritative when the server sent one, and the
|
|
9
|
+
// extension list decides everything else. The second half is what the octet-stream rows pin — the
|
|
10
|
+
// sniffer in core/util.js only covers image, font, video and audio, so an image format it cannot
|
|
11
|
+
// recognize keeps application/octet-stream, and deflating it must stay off the table.
|
|
12
|
+
|
|
13
|
+
import "./dom-stub.js";
|
|
14
|
+
const { process } = await import("./../../processors/compression/compression.js");
|
|
15
|
+
const { ZipReader, BlobReader } = await import("./../../vendor/zip/zip.js");
|
|
16
|
+
|
|
17
|
+
const TEXT = "console.log(\"probe\");\n".repeat(100);
|
|
18
|
+
const BINARY = "\x89PNG\r\n\x1a\n" + "\x00\x01\x02\x03".repeat(100);
|
|
19
|
+
|
|
20
|
+
// [label, extension, contentType, expected compression]
|
|
21
|
+
const CASES = [
|
|
22
|
+
["script named .ts, served as text/javascript", ".ts", "text/javascript", "deflate"],
|
|
23
|
+
["script named .js, served as text/javascript", ".js", "text/javascript", "deflate"],
|
|
24
|
+
["script named .ts, served as application/javascript", ".ts", "application/javascript", "deflate"],
|
|
25
|
+
["script named .php, no content type", ".php", undefined, "deflate"],
|
|
26
|
+
["image named .png, served as image/png", ".png", "image/png", "stored"],
|
|
27
|
+
["image named .png, no content type", ".png", undefined, "stored"],
|
|
28
|
+
["image named .avif, sniffing failed", ".avif", "application/octet-stream", "stored"],
|
|
29
|
+
["font named .woff2, served as font/woff2", ".woff2", "font/woff2", "stored"],
|
|
30
|
+
["image named .svg, served as image/svg+xml", ".svg", "image/svg+xml", "deflate"]
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
let failed = false;
|
|
34
|
+
|
|
35
|
+
function check(label, actual, expected) {
|
|
36
|
+
const ok = actual === expected;
|
|
37
|
+
console.log(`${ok ? "PASS" : "FAIL"} ${label}: ${actual}${ok ? "" : " (expected " + expected + ")"}`);
|
|
38
|
+
failed ||= !ok;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async function getEntries(resource, options = {}) {
|
|
42
|
+
const pageData = {
|
|
43
|
+
title: "fixture",
|
|
44
|
+
doctype: "<!DOCTYPE html>",
|
|
45
|
+
content: "<html><body><p>fixture</p></body></html>",
|
|
46
|
+
resources: { stylesheets: [], images: [resource] }
|
|
47
|
+
};
|
|
48
|
+
const blob = await process(pageData, {
|
|
49
|
+
selfExtractingArchive: false,
|
|
50
|
+
extractDataFromPage: false,
|
|
51
|
+
url: "https://example.com/",
|
|
52
|
+
...options
|
|
53
|
+
}, new Date(1755129600000));
|
|
54
|
+
const reader = new ZipReader(new BlobReader(blob), { useWebWorkers: false });
|
|
55
|
+
const entries = await reader.getEntries();
|
|
56
|
+
await reader.close();
|
|
57
|
+
return entries;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
for (const [label, extension, contentType, expected] of CASES) {
|
|
61
|
+
const content = expected == "deflate" ? TEXT : BINARY;
|
|
62
|
+
const [entry] = (await getEntries({ name: "resource" + extension, extension, contentType, content }))
|
|
63
|
+
.filter(({ filename }) => filename.startsWith("resource"));
|
|
64
|
+
check(label, entry.compressionMethod === 0 ? "stored" : "deflate", expected);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// disableCompression still overrides everything, content type included
|
|
68
|
+
const [storedEntry] = (await getEntries({ name: "resource.js", extension: ".js", contentType: "text/javascript", content: TEXT }, { disableCompression: true }))
|
|
69
|
+
.filter(({ filename }) => filename.startsWith("resource"));
|
|
70
|
+
check("disableCompression stores a text/javascript entry", storedEntry.compressionMethod === 0 ? "stored" : "deflate", "stored");
|
|
71
|
+
|
|
72
|
+
if (failed) {
|
|
73
|
+
console.log("FAILED");
|
|
74
|
+
Deno.exit(1);
|
|
75
|
+
} else {
|
|
76
|
+
console.log("PASSED");
|
|
77
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// getValidFilename replaced each character class with "[X]+", so a RUN collapsed to one character:
|
|
2
|
+
// "C++" was saved as "C+" and "Really???" as "Really?". The quantifier was inherited rather than
|
|
3
|
+
// chosen — before a842fe1 (issue #1614) there was a single loop mapping every invalid character to
|
|
4
|
+
// one "_", where collapsing a run is the point. The full-width lookalike loop was written by
|
|
5
|
+
// copying that line, and a lookalike maps one for one, so the run must survive.
|
|
6
|
+
//
|
|
7
|
+
// The fallback loop keeps its "+": a run of control characters still becomes a single "_", which
|
|
8
|
+
// also matches the download retry ladder in the extensions, where the lookalike rung replaces per
|
|
9
|
+
// character (LOOKALIKE_CHARACTERS) and the non-ASCII rung collapses ("[^\x00-\x7F]+").
|
|
10
|
+
|
|
11
|
+
globalThis.window = globalThis;
|
|
12
|
+
globalThis.document = {};
|
|
13
|
+
globalThis.Document = class Document { };
|
|
14
|
+
globalThis.MutationObserver = class MutationObserver { observe() { } };
|
|
15
|
+
const { getValidFilename } = await import("./../../core/helper.js");
|
|
16
|
+
|
|
17
|
+
// [input, expected]
|
|
18
|
+
const CASES = [
|
|
19
|
+
["C++ vs C++", "C++ vs C++"],
|
|
20
|
+
["Really???", "Really???"],
|
|
21
|
+
["Why?? 50%%", "Why?? 50%%"],
|
|
22
|
+
["**bold** and ~~strike~~", "**bold** and ~~strike~~"],
|
|
23
|
+
["a:b::c", "a:b::c"],
|
|
24
|
+
["<<x>>", "<<x>>"],
|
|
25
|
+
["one ? here", "one ? here"],
|
|
26
|
+
["normal title", "normal title"],
|
|
27
|
+
["Wait... what?", "Wait... what?"]
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
let failed = false;
|
|
31
|
+
|
|
32
|
+
function check(label, actual, expected) {
|
|
33
|
+
const ok = actual === expected;
|
|
34
|
+
console.log(`${ok ? "PASS" : "FAIL"} ${label}: ${actual}${ok ? "" : " (expected " + expected + ")"}`);
|
|
35
|
+
failed ||= !ok;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
for (const [input, expected] of CASES) {
|
|
39
|
+
check(JSON.stringify(input), getValidFilename(input), expected);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// the characters with no lookalike take the fallback, and there a run is still collapsed
|
|
43
|
+
check("a run of control characters collapses to one replacement", getValidFilename("a\x00\x01\x02b"), "a_b");
|
|
44
|
+
check("a control character run is collapsed, lookalikes next to it are not", getValidFilename("a\x00\x01b??"), "a_b??");
|
|
45
|
+
|
|
46
|
+
// a custom mapping keeps both behaviours: one for one when a replacement is given, collapsed when not
|
|
47
|
+
check("custom lookalike replaces per character", getValidFilename("a##b", ["#"], "_", ["#"]), "a##b");
|
|
48
|
+
check("custom class without a lookalike collapses", getValidFilename("a##b", ["#"], "_", []), "a_b");
|
|
49
|
+
|
|
50
|
+
if (failed) {
|
|
51
|
+
console.log("FAILED");
|
|
52
|
+
Deno.exit(1);
|
|
53
|
+
} else {
|
|
54
|
+
console.log("PASSED");
|
|
55
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// formatFilename truncates an over-long filename to filenameMaxLength and then appends an ellipsis
|
|
2
|
+
// and the extension, but the budget it truncated to only ever subtracted the extension. The
|
|
3
|
+
// ellipsis was never counted, so every truncated filename came out over the limit — by one
|
|
4
|
+
// character in "char" mode, by the 3 bytes of U+2026 in "bytes" mode. Harmless at the default 192,
|
|
5
|
+
// but a user who sets the limit to the filesystem maximum of 255 gets 258 and the download is
|
|
6
|
+
// refused, which sends the save down the download-util.js retry ladder for no reason.
|
|
7
|
+
//
|
|
8
|
+
// The negative budget was worse than an overrun. truncateText slices a Blob, and Blob.slice reads a
|
|
9
|
+
// negative start as an offset from the END, so a limit smaller than the extension returned nearly
|
|
10
|
+
// the whole 800-byte filename instead of nothing.
|
|
11
|
+
|
|
12
|
+
// template-formatter.js reaches core/helper.js, which pulls in the frame hooks, and those install
|
|
13
|
+
// themselves against window and document as they are evaluated: the stubs go in before the import
|
|
14
|
+
globalThis.window = globalThis;
|
|
15
|
+
globalThis.document = {};
|
|
16
|
+
globalThis.Document = class Document { };
|
|
17
|
+
globalThis.MutationObserver = class MutationObserver { observe() { } };
|
|
18
|
+
const { formatFilename } = await import("../../modules/template-formatter.js");
|
|
19
|
+
|
|
20
|
+
const LONG_TITLE = "a".repeat(400);
|
|
21
|
+
const MULTIBYTE_TITLE = "é".repeat(400);
|
|
22
|
+
|
|
23
|
+
let failed = false;
|
|
24
|
+
|
|
25
|
+
function check(label, actual, expected) {
|
|
26
|
+
const ok = actual === expected;
|
|
27
|
+
console.log(`${ok ? "PASS" : "FAIL"} ${label}: ${actual}${ok ? "" : " (expected " + expected + ")"}`);
|
|
28
|
+
failed ||= !ok;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function getFilename(title, filenameMaxLengthUnit, filenameMaxLength) {
|
|
32
|
+
return formatFilename("", null, {
|
|
33
|
+
url: "https://example.com/page",
|
|
34
|
+
filenameTemplate: title + ".html",
|
|
35
|
+
filenameReplacementCharacter: "_",
|
|
36
|
+
filenameReplacedCharacters: [],
|
|
37
|
+
filenameReplacementCharacters: [],
|
|
38
|
+
backgroundSave: true,
|
|
39
|
+
filenameMaxLengthUnit,
|
|
40
|
+
filenameMaxLength
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function getSize(title, unit, maxLength) {
|
|
45
|
+
const filename = await getFilename(title, unit, maxLength);
|
|
46
|
+
return unit == "bytes" ? new Blob([filename]).size : filename.length;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
for (const maxLength of [192, 255]) {
|
|
50
|
+
check(`ascii title, ${maxLength} bytes`, await getSize(LONG_TITLE, "bytes", maxLength) <= maxLength, true);
|
|
51
|
+
check(`multibyte title, ${maxLength} bytes`, await getSize(MULTIBYTE_TITLE, "bytes", maxLength) <= maxLength, true);
|
|
52
|
+
check(`ascii title, ${maxLength} chars`, await getSize(LONG_TITLE, "char", maxLength) <= maxLength, true);
|
|
53
|
+
check(`multibyte title, ${maxLength} chars`, await getSize(MULTIBYTE_TITLE, "char", maxLength) <= maxLength, true);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// the extension and the ellipsis alone are longer than the limit, so the result cannot fit. What it
|
|
57
|
+
// must not do is grow: before the fix the byte case returned 812 bytes for a limit of 4
|
|
58
|
+
check("limit shorter than the extension keeps only the suffix", await getFilename(LONG_TITLE, "bytes", 4), "….html");
|
|
59
|
+
check("limit shorter than the extension, chars", await getFilename(LONG_TITLE, "char", 3), "….html");
|
|
60
|
+
|
|
61
|
+
// nothing above the limit is truncated at all, ellipsis included
|
|
62
|
+
check("a filename at the limit is left alone", await getFilename("a".repeat(187), "bytes", 192), "a".repeat(187) + ".html");
|
|
63
|
+
|
|
64
|
+
if (failed) {
|
|
65
|
+
console.log("FAILED");
|
|
66
|
+
Deno.exit(1);
|
|
67
|
+
} else {
|
|
68
|
+
console.log("PASSED");
|
|
69
|
+
}
|
package/vendor/zip/zip.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
((t,e)=>{"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).zip={})})(this,function(t){"use strict";const{Array:e,Object:n,String:r,Number:s,BigInt:o,Math:a,Date:i,Map:c,Set:u,Response:f,URL:l,Error:w,Uint8Array:d,Uint16Array:h,Uint32Array:p,DataView:m,Blob:y,Promise:g,TextEncoder:b,TextDecoder:v,crypto:S,btoa:k,TransformStream:x,ReadableStream:z,WritableStream:R,CompressionStream:D,DecompressionStream:F,navigator:C,Worker:A,setTimeout:T,clearTimeout:U}="undefined"!=typeof globalThis?globalThis:this||self,E=4294967295,I=65535,W=255,M=134695760,O=M,L=33639248,P=101075792,B=117853008,H=22,V=20,Z=56,q=61440,N=new i(1980,0,1),_=void 0,j="undefined",K="function",G="string",X=new d,J="strict",Q="balanced",Y="tolerant";function $(t){if(t&&typeof t!=K)throw new w("Invalid option (must be a function)");return t}function tt(t){return typeof t==G&&t.trim()?s(t):t}let et=2;try{typeof C!=j&&C.hardwareConcurrency&&(et=C.hardwareConcurrency)}catch{}const nt={workerURI:"./core/web-worker-wasm.js",wasmURI:"./core/streams/zlib-wasm/zlib-streams.wasm",chunkSize:65536,maxWorkers:et,terminateWorkerTimeout:5e3,workerStarvationTimeout:5e3,workerStartupTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,transferStreams:!0,CompressionStream:typeof D!=j&&D,DecompressionStream:typeof F!=j&&F},rt="maxWorkers",st=["chunkSize",rt,"terminateWorkerTimeout","workerStarvationTimeout","workerStartupTimeout"],ot=["createWorker","CompressionStream","DecompressionStream","CompressionStreamFallback","DecompressionStreamFallback"],at=["baseURI","wasmURI","workerURI","useCompressionStream","useWebWorkers","transferStreams",...st,...ot],it={...nt};function ct(){return it}function ut(t){return ft(t.chunkSize)}function ft(t){return t=tt(t),s.isInteger(t)&&t>=1?a.max(t,64):65536}function lt(t){const e={};for(const n of at){const r=t[n];r!==_&&(e[n]=wt(n,r))}return e}function wt(t,e){if(st.includes(t)){if(e=tt(e),t==rt&&(!s.isInteger(e)||1>e))throw new w("Invalid maxWorkers (must be an integer greater than 0)")}else ot.includes(t)&&$(e);return e}function dt(t){t=t||{};const{CompressionStreamZlib:e,DecompressionStreamZlib:r}=t;if(e===_&&r===_)return t;const s=n.assign({},t);return s.CompressionStreamFallback===_&&(s.CompressionStreamFallback=e),s.DecompressionStreamFallback===_&&(s.DecompressionStreamFallback=r),s}var ht=d,pt=h,mt=Int32Array,yt=new ht([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]),gt=new ht([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]),bt=new ht([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),vt=(t,e)=>{for(var n=new pt(31),r=0;31>r;++r)n[r]=e+=1<<t[r-1];var s=new mt(n[30]);for(r=1;30>r;++r)for(var o=n[r];o<n[r+1];++o)s[o]=o-n[r]<<5|r;return{b:n,r:s}},St=vt(yt,2),kt=St.b,xt=St.r;kt[28]=258,xt[258]=28;for(var zt=vt(gt,0).b,Rt=new pt(32768),Dt=0;32768>Dt;++Dt){var Ft=(43690&Dt)>>1|(21845&Dt)<<1;Ft=(61680&(Ft=(52428&Ft)>>2|(13107&Ft)<<2))>>4|(3855&Ft)<<4,Rt[Dt]=((65280&Ft)>>8|(255&Ft)<<8)>>1}var Ct=(t,e,n)=>{for(var r=t.length,s=0,o=new pt(e);r>s;++s)t[s]&&++o[t[s]-1];var a,i=new pt(e);for(s=1;e>s;++s)i[s]=i[s-1]+o[s-1]<<1;if(n){a=new pt(1<<e);var c=15-e;for(s=0;r>s;++s)if(t[s])for(var u=s<<4|t[s],f=e-t[s],l=i[t[s]-1]++<<f,w=l|(1<<f)-1;w>=l;++l)a[Rt[l]>>c]=u}else for(a=new pt(r),s=0;r>s;++s)t[s]&&(a[s]=Rt[i[t[s]-1]++]>>15-t[s]);return a},At=new ht(288);for(Dt=0;144>Dt;++Dt)At[Dt]=8;for(Dt=144;256>Dt;++Dt)At[Dt]=9;for(Dt=256;280>Dt;++Dt)At[Dt]=7;for(Dt=280;288>Dt;++Dt)At[Dt]=8;var Tt=new ht(32);for(Dt=0;32>Dt;++Dt)Tt[Dt]=5;var Ut=Ct(At,9,1),Et=Ct(Tt,5,1),It=t=>{for(var e=t[0],n=1;n<t.length;++n)t[n]>e&&(e=t[n]);return e},Wt=(t,e,n)=>{var r=e/8|0;return(t[r]|t[r+1]<<8)>>(7&e)&n},Mt=(t,e)=>{var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(7&e)},Ot=t=>(t+7)/8|0,Lt=(t,e,n)=>((null==e||0>e)&&(e=0),(null==n||n>t.length)&&(n=t.length),new ht(t.subarray(e,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"],Bt=(t,e,n)=>{var r=new w(e||Pt[t]);if(r.code=t,w.captureStackTrace&&w.captureStackTrace(r,Bt),!n)throw r;return r},Ht=(t,e,n,r)=>{var s=t.length,o=r?r.length:0;if(!s||e.f&&!e.o)return n||new ht(0);var i=!n,c=i||2!=e.i,u=e.i;i&&(n=new ht(3*s));var f=t=>{var e=n.length;if(t>e){var r=new ht(a.max(2*e,t));r.set(n),n=r}},l=e.f||0,w=e.p||0,d=e.b||0,h=e.o,p=e.d,m=e.l,y=e.n,g=8*s;do{if(!h){l=Wt(t,w,1);var b=Wt(t,w+1,3);if(w+=3,!b){var v=t[(U=Ot(w)+4)-4]|t[U-3]<<8,S=U+v;if(S>s){u&&Bt(0);break}c&&f(d+v),n.set(t.subarray(U,S),d),e.b=d+=v,e.p=w=8*S,e.f=l;continue}if(1==b)h=Ut,p=Et,m=9,y=5;else if(2==b){var k=Wt(t,w,31)+257,x=Wt(t,w+10,15)+4,z=k+Wt(t,w+5,31)+1;w+=14;for(var R=new ht(z),D=new ht(19),F=0;x>F;++F)D[bt[F]]=Wt(t,w+3*F,7);w+=3*x;var C=It(D),A=(1<<C)-1,T=Ct(D,C,1);for(F=0;z>F;){var U,E=T[Wt(t,w,A)];if(w+=15&E,16>(U=E>>4))R[F++]=U;else{var I=0,W=0;for(16==U?(W=3+Wt(t,w,3),w+=2,I=R[F-1]):17==U?(W=3+Wt(t,w,7),w+=3):18==U&&(W=11+Wt(t,w,127),w+=7);W--;)R[F++]=I}}var M=R.subarray(0,k),O=R.subarray(k);m=It(M),y=It(O),h=Ct(M,m,1),p=Ct(O,y,1)}else Bt(1);if(w>g){u&&Bt(0);break}}c&&f(d+131072);for(var L=(1<<m)-1,P=(1<<y)-1,B=w;;B=w){var H=(I=h[Mt(t,w)&L])>>4;if((w+=15&I)>g){u&&Bt(0);break}if(I||Bt(2),256>H)n[d++]=H;else{if(256==H){B=w,h=null;break}var V=H-254;if(H>264){var Z=yt[F=H-257];V=Wt(t,w,(1<<Z)-1)+kt[F],w+=Z}var q=p[Mt(t,w)&P],N=q>>4;if(q||Bt(3),w+=15&q,O=zt[N],N>3&&(Z=gt[N],O+=Mt(t,w)&(1<<Z)-1,w+=Z),w>g){u&&Bt(0);break}c&&f(d+131072);var _=d+V;if(O>d){var j=o-O,K=a.min(O,_);for(0>j+d&&Bt(3);K>d;++d)n[d]=r[j+d]}for(;_>d;++d)n[d]=n[d-O]}}e.o=h,e.p=B,e.b=d,e.f=l,h&&(l=1,e.l=m,e.d=p,e.n=y)}while(!l);return d!=n.length&&i?Lt(n,0,d):n.subarray(0,d)},Vt=new ht(0),Zt=function(){function t(t,e){"function"==typeof t&&(e=t,t={}),this.h=e;var n=t&&t.m&&t.m.subarray(-32768);this.s={i:0,b:n?n.length:0},this.v=new ht(32768),this.p=new ht(0),n&&this.v.set(n)}return t.prototype.e=function(t){if(this.h||Bt(5),this.d&&Bt(4),this.p.length){if(t.length){var e=new ht(this.p.length+t.length);e.set(this.p),e.set(t,this.p.length),this.p=e}}else this.p=t},t.prototype.c=function(t){this.s.i=+(this.d=t||!1);var e=this.s.b,n=Ht(this.p,this.s,this.v);this.h(Lt(n,e,this.s.b),this.d),this.v=Lt(n,this.s.b-32768),this.s.b=this.v.length,this.p=Lt(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(t,e){this.e(t),this.c(e)},t}(),qt=void 0!==v&&new v;try{qt.decode(Vt,{stream:!0})}catch(t){}class Nt extends x{constructor(t){super({start(e){t.h=t=>{t.length&&e.enqueue(t)}},transform(e){t.push(e)},flush(){t.push(new d(0),!0)}})}}const _t=new c,jt=new c;function Kt(t){return jt.get(t)}const Gt=[[],[],[],[],[],[],[],[]];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;Gt[0][t]=e}for(let t=0;256>t;t++)for(let e=1;8>e;e++){const n=Gt[e-1][t];Gt[e][t]=n>>>8^Gt[0][255&n]}const[Xt,Jt,Qt,Yt,$t,te,ee,ne]=Gt;class re{constructor(t){this.S=t||-1}append(t){let e=0|this.S;const n=0|t.length;let r=0;if(n>=8&&t.buffer){const s=new m(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=ne[255&t]^ee[t>>>8&255]^te[t>>>16&255]^$t[t>>>24&255]^Yt[255&n]^Qt[n>>>8&255]^Jt[n>>>16&255]^Xt[n>>>24&255]}}for(;n>r;r++)e=e>>>8^Xt[255&(e^t[r])];this.S=e}get(){return~this.S}}class se extends x{constructor(){let t;const e=new re;super({transform(t,n){e.append(t),n.enqueue(t)},flush(){const n=new d(4);new m(n.buffer).setUint32(0,e.get()),t.value=n}}),t=this}}function oe(t,e){const n=new d(t.length+e.length);return n.set(t),n.set(e,t.length),n}function ae(t){return new m(t.buffer,t.byteOffset,t.byteLength)}const ie={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const n=t[t.length-1],r=ie.R(n);return 32===r?t.concat(e):ie.D(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)+ie.R(n)},F(t,e){if(32*t.length<e)return t;const n=(t=t.slice(0,a.ceil(e/32))).length;return e&=31,n>0&&e&&(t[n-1]=ie.C(e,t[n-1]&2147483648>>e-1,1)),t},C:(t,e,n)=>32===t?e:(n?0|e:e<<32-t)+1099511627776*t,R:t=>a.round(t/1099511627776)||32,D(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=ie.R(s);return r.push(ie.C(e+o&31,e+o>32?n:r.pop(),1)),r}},ce={bytes:{A(t){const e=ie.bitLength(t)/8,n=new d(e);let r;for(let s=0;e>s;s++)3&s||(r=t[s/4]),n[s]=r>>>24,r<<=8;return n},T(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(ie.C(8*(3&n),r)),e}}},ue=class{constructor(t){const e=this;e.blockSize=512,e.U=[1732584193,4023233417,2562383102,271733878,3285377520],e.I=[1518500249,1859775393,2400959708,3395469782],t?(e.W=t.W.slice(0),e.M=t.M.slice(0),e.O=t.O):e.reset()}reset(){const t=this;return t.W=t.U.slice(0),t.M=[],t.O=0,t}update(t){const e=this;"string"==typeof t&&(t=ce.L.T(t));const n=e.M=ie.concat(e.M,t),r=e.O,s=e.O=r+ie.bitLength(t);if(s>9007199254740991)throw new w("Cannot hash more than 2^53 - 1 bits");const o=new p(n);let a=0;for(let t=e.blockSize+r-(e.blockSize+r&e.blockSize-1);s>=t;t+=e.blockSize)e.P(o.subarray(16*a,16*(a+1))),a+=1;return n.splice(0,16*a),e}B(){const t=this;let e=t.M;const n=t.W;e=ie.concat(e,[ie.C(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(a.floor(t.O/4294967296)),e.push(0|t.O);e.length;)t.P(e.splice(0,16));return t.reset(),n}H(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}V(t,e){return e<<t|e>>>32-t}P(t){const n=this,r=n.W,s=e(80);for(let e=0;16>e;e++)s[e]=t[e];let o=r[0],i=r[1],c=r[2],u=r[3],f=r[4];for(let t=0;79>=t;t++){16>t||(s[t]=n.V(1,s[t-3]^s[t-8]^s[t-14]^s[t-16]));const e=n.V(5,o)+n.H(t,i,c,u)+f+s[t]+n.I[a.floor(t/20)]|0;f=u,u=c,c=n.V(30,i),i=o,o=e}r[0]=r[0]+o|0,r[1]=r[1]+i|0,r[2]=r[2]+c|0,r[3]=r[3]+u|0,r[4]=r[4]+f|0}},fe={importKey:t=>new fe.Z(ce.bytes.T(t)),N(t,e,n,r){if(n=n||1e4,0>r||0>n)throw new w("invalid params to pbkdf2");const s=1+(r>>5)<<2;let o,a,i,c,u;const f=new ArrayBuffer(s),l=new m(f);let d=0;const h=ie;for(e=ce.bytes.T(e),u=1;(s||1)>d;u++){for(o=a=t.encrypt(h.concat(e,[u])),i=1;n>i;i++)for(a=t.encrypt(a),c=0;c<a.length;c++)o[c]^=a[c];for(i=0;(s||1)>d&&i<o.length;i++)l.setInt32(d,o[i]),d+=4}return f.slice(0,r/8)},Z:class{constructor(t){const e=this,n=e._=ue,r=[[],[]];e.j=[new n,new n];const s=e.j[0].blockSize/32;t.length>s&&(t=(new n).update(t).B());for(let e=0;s>e;e++)r[0][e]=909522486^t[e],r[1][e]=1549556828^t[e];e.j[0].update(r[0]),e.j[1].update(r[1]),e.K=new n(e.j[0])}reset(){const t=this;t.K=new t._(t.j[0]),t.G=!1}update(t){this.G=!0,this.K.update(t)}digest(){const t=this,e=t.K.B(),n=new t._(t.j[1]).update(e).B();return t.reset(),n}encrypt(t){if(this.G)throw new w("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},le=typeof S!=j&&typeof S.getRandomValues==K,we="Invalid password",de="Invalid signature",he=de,pe="zipjs-abort-check-password";function me(t){if(le)return S.getRandomValues(t);throw new w("Crypto API not supported")}const ye=16,ge={name:"PBKDF2"},be=n.assign({hash:{name:"HMAC"}},ge),ve=n.assign({iterations:1e3,hash:{name:"SHA-1"}},ge),Se=["deriveBits"],ke=[8,12,16],xe=[16,24,32],ze=10,Re=[0,0,0,0],De=typeof S!=j,Fe=De&&S.subtle,Ce=De&&typeof Fe!=j,Ae=ce.bytes,Te=class{constructor(t){const e=this;e.X=[[[],[],[],[],[]],[[],[],[],[],[]]],e.X[0][0][0]||e.J();const n=e.X[0][4],r=e.X[1],s=t.length;let o,a,i,c=1;if(4!==s&&6!==s&&8!==s)throw new w("invalid aes key size");for(e.I=[a=t.slice(0),i=[]],o=s;4*s+28>o;o++){let t=a[o-1];(o%s===0||8===s&&o%s===4)&&(t=n[t>>>24]<<24^n[t>>16&255]<<16^n[t>>8&255]<<8^n[255&t],o%s===0&&(t=t<<8^t>>>24^c<<24,c=c<<1^283*(c>>7))),a[o]=a[o-s]^t}for(let t=0;o;t++,o--){const e=a[3&t?o:o-4];i[t]=4>=o||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.Y(t,0)}decrypt(t){return this.Y(t,1)}J(){const t=this.X[0],e=this.X[1],n=t[4],r=e[4],s=[],o=[];let a,i,c,u;for(let t=0;256>t;t++)o[(s[t]=t<<1^283*(t>>7))^t]=t;for(let f=a=0;!n[f];f^=i||1,a=o[a]||1){let o=a^a<<1^a<<2^a<<3^a<<4;o=o>>8^255&o^99,n[f]=o,r[o]=f,u=s[c=s[i=s[f]]];let l=16843009*u^65537*c^257*i^16843008*f,w=257*s[o]^16843008*o;for(let n=0;4>n;n++)t[n][f]=w=w<<24^w>>>8,e[n][o]=l=l<<24^l>>>8}for(let n=0;5>n;n++)t[n]=t[n].slice(0),e[n]=e[n].slice(0)}Y(t,e){if(4!==t.length)throw new w("invalid aes block size");const n=this.I[e],r=n.length/4-2,s=[0,0,0,0],o=this.X[e],a=o[0],i=o[1],c=o[2],u=o[3],f=o[4];let l,d,h,p=t[0]^n[0],m=t[e?3:1]^n[1],y=t[2]^n[2],g=t[e?1:3]^n[3],b=4;for(let t=0;r>t;t++)l=a[p>>>24]^i[m>>16&255]^c[y>>8&255]^u[255&g]^n[b],d=a[m>>>24]^i[y>>16&255]^c[g>>8&255]^u[255&p]^n[b+1],h=a[y>>>24]^i[g>>16&255]^c[p>>8&255]^u[255&m]^n[b+2],g=a[g>>>24]^i[p>>16&255]^c[m>>8&255]^u[255&y]^n[b+3],b+=4,p=l,m=d,y=h;for(let t=0;4>t;t++)s[e?3&-t:t]=f[p>>>24]<<24^f[m>>16&255]<<16^f[y>>8&255]<<8^f[255&g]^n[b++],l=p,p=m,m=y,y=g,g=l;return s}},Ue=class{constructor(t,e){this.$=t,this.et=e,this.nt=e}reset(){this.nt=this.et}update(t){return this.st(this.$,t,this.nt)}ot(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}it(t){0===(t[0]=this.ot(t[0]))&&(t[1]=this.ot(t[1]))}st(t,e,n){let r;if(!(r=e.length))return[];const s=ie.bitLength(e);for(let s=0;r>s;s+=4){this.it(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 ie.F(e,s)}},Ee=fe.Z;let Ie=De&&Ce&&typeof Fe.importKey==K,We=De&&Ce&&typeof Fe.deriveBits==K;class Me extends x{constructor({password:t,rawPassword:e,encryptionStrength:n,checkPasswordOnly:r,checkAuthenticationCode:s=!0}){super({start(){Le(this,t,e,n)},async transform(t,e){const n=this,{password:s,strength:o,ct:a,ready:i}=n;s?(await(async(t,e,n,r)=>{const s=await Be(t,e,n,Ve(r,0,ke[e])),o=Ve(r,ke[e]);if(s[0]!=o[0]||s[1]!=o[1])throw new w(we)})(n,o,s,Ve(t,0,ke[o]+2)),t=Ve(t,ke[o]+2),r?e.error(new w(pe)):a()):await i;const c=new d(t.length-ze-(t.length-ze)%ye);e.enqueue(Pe(n,t,c,0,ze,!0))},async flush(t){const{ut:e,ft:n,lt:r,ready:o}=this;if(n&&e){await o;const a=Ve(r,0,r.length-ze),i=Ve(r,r.length-ze);let c=X;if(a.length){const t=qe(Ae,a);n.update(t);const r=e.update(t);c=Ze(Ae,r)}const u=Ve(Ze(Ae,n.digest()),0,ze);let f=r.length<ze?1:0;for(let t=0;ze>t;t++)f|=u[t]^i[t];if(f&&s)throw new w(he);t.enqueue(c)}}})}}class Oe extends x{constructor({password:t,rawPassword:e,encryptionStrength:n}){super({start(){Le(this,t,e,n)},async transform(t,e){const n=this,{password:r,strength:s,ct:o,ready:a}=n;let i=X;r?(i=await(async(t,e,n)=>{const r=me(new d(ke[e]));return oe(r,await Be(t,e,n,r))})(n,s,r),o()):await a;const c=new d(i.length+t.length-t.length%ye);c.set(i,0),e.enqueue(Pe(n,t,c,i.length,0))},async flush(t){const{ut:e,ft:n,lt:r,ready:s}=this;if(n&&e){await s;let o=X;if(r.length){const t=e.update(qe(Ae,r));n.update(t),o=Ze(Ae,t)}const a=Ze(Ae,n.digest()).slice(0,ze);t.enqueue(oe(o,a))}}})}}function Le(t,e,r,s){n.assign(t,{ready:new g(e=>t.ct=e),password:He(e,r),strength:s-1,lt:X})}function Pe(t,e,n,r,s,o){const{ut:a,ft:i,lt:c}=t;c.length&&(e=oe(c,e));const u=e.length-s;let f;for(n=((t,e)=>{if(e&&e>t.length){const n=t;(t=new d(e)).set(n,0)}return t})(n,r+(u-u%ye)),f=0;u-ye>=f;f+=ye){const t=qe(Ae,Ve(e,f,f+ye));o&&i.update(t);const s=a.update(t);o||i.update(s),n.set(Ze(Ae,s),f+r)}return t.lt=Ve(e,f),n}async function Be(t,r,s,o){t.password=null;const a=await(async(t,e,n,r,s)=>{if(!Ie)return fe.importKey(e);try{return await Fe.importKey("raw",e,n,!1,s)}catch{return Ie=!1,fe.importKey(e)}})(0,s,be,0,Se),i=await(async(t,e,n)=>{if(!We)return fe.N(e,t.salt,ve.iterations,n);try{return await Fe.deriveBits(t,e,n)}catch{return We=!1,fe.N(e,t.salt,ve.iterations,n)}})(n.assign({salt:o},ve),a,8*(2*xe[r]+2)),c=new d(i),u=qe(Ae,Ve(c,0,xe[r])),f=qe(Ae,Ve(c,xe[r],2*xe[r])),l=Ve(c,2*xe[r]);return n.assign(t,{keys:{key:u,wt:f,passwordVerification:l},ut:new Ue(new Te(u),e.from(Re)),ft:new Ee(f)}),l}function He(t,e){return e===_?(t=>{if(typeof b==j){const e=new d((t=unescape(encodeURIComponent(t))).length);for(let n=0;n<e.length;n++)e[n]=t.charCodeAt(n);return e}return(new b).encode(t)})(t):e}function Ve(t,e,n){return t.subarray(e,n)}function Ze(t,e){return t.A(e)}function qe(t,e){return t.T(e)}class Ne extends x{constructor({password:t,rawPassword:e,passwordVerification:n,checkPasswordOnly:r}){super({start(){je(this,t,e,n)},transform(t,e){const n=this;if(n.password||n.rawPassword){const e=Ke(n,t.subarray(0,12));if(n.password=n.rawPassword=null,0!=(e[11]^n.passwordVerification))throw new w(we);t=t.subarray(12)}r?e.error(new w(pe)):e.enqueue(Ke(n,t))}})}}class _e extends x{constructor({password:t,rawPassword:e,passwordVerification:n}){super({start(){je(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=me(new d(12));e[11]=n.passwordVerification,r=new d(t.length+e.length),r.set(Ge(n,e),0),s=12}else r=new d(t.length),s=0;r.set(Ge(n,t),s),e.enqueue(r)}})}}function je(t,e,r,s){n.assign(t,{password:e,rawPassword:r,passwordVerification:s}),((t,e,r)=>{const s=[305419896,591751049,878082192];if(n.assign(t,{keys:s,ht:new re(s[0]),yt:new re(s[2])}),r)for(let e=0;e<r.length;e++)Xe(t,r[e]);else for(let n=0;n<e.length;n++)Xe(t,e.charCodeAt(n))})(t,e,r)}function Ke(t,e){const n=new d(e.length);for(let r=0;r<e.length;r++)n[r]=Je(t)^e[r],Xe(t,n[r]);return n}function Ge(t,e){const n=new d(e.length);for(let r=0;r<e.length;r++)n[r]=Je(t)^e[r],Xe(t,e[r]);return n}function Xe(t,e){let[,n]=t.keys;t.ht.append([e]);const r=~t.ht.get();n=Ye(a.imul(Ye(n+Qe(r)),134775813)+1),t.yt.append([n>>>24]);const s=~t.yt.get();t.keys=[r,n,s]}function Je(t){const e=2|t.keys[2];return Qe(a.imul(e,1^e)>>>8)}function Qe(t){return 255&t}function Ye(t){return 4294967295&t}function $e(t){if(t instanceof z)return t;const e=t.getReader();return new z({async pull(t){const{value:n,done:r}=await e.read();r?t.close():t.enqueue(n)},cancel:t=>e.cancel(t)})}function tn(t,e){t=$e(t);const n=e?{type:e}:{};if(typeof y.prototype.stream!=K||new y([]).stream()instanceof z)return new f(t).blob().then(t=>e?new y([t],n):t);const r=[];return t.pipeTo(new R({write(t){r.push(t)}})).then(()=>new y(r,n))}function en(t){if(t instanceof R)return t;const e=t.getWriter();return new R({write:t=>e.write(t),close:()=>e.close(),abort:t=>e.abort(t)})}const nn="Invalid uncompressed size",rn=de,sn="deflate-raw",on="gzip",an=[31,139,8];class cn extends x{constructor(t,{chunkSize:e,CompressionStreamFallback:n,CompressionStream:r}){super({});const{compressed:s,encrypted:o,useCompressionStream:a,zipCrypto:i,computeCrc32:c,level:u,deflate64:f,format:l,compressionMethod:w,inputSize:d}=t,h=this;let p,y,g,b=super.readable;const v=l&&Kt(l),S=c&&s&&!f&&!v&&(!o||i)&&!(!a||!r);if(o&&!i||!c||S||(p=new se,b=pn(b,p)),s)if(v)b=mn(b,dn(v.CompressionStream,l,{level:u,chunkSize:e,compressionMethod:w,uncompressedSize:d}));else if(S)g=new un,b=mn(b,new r(on)),b=pn(b,g);else try{b=hn(b,a,{level:u,chunkSize:e},r,n)}catch(t){let e;try{e=new r(on)}catch{throw t}b=mn(b,e),b=pn(b,new un)}o&&(i?b=pn(b,new _e(t)):(y=new Oe(t),b=pn(b,y))),wn(h,b,()=>{o&&!i||!c||(h.crc32=S?g.crc32:new m(p.value.buffer).getUint32(0))})}}class un extends x{constructor(){let t,e=10,n=new d(0);super({transform(t,r){if(e){const n=a.min(e,t.length);if(e-=n,!(t=t.subarray(n)).length)return}const s=n.length+t.length;if(8>=s)return void(n=oe(n,t));const o=s-8,i=a.min(o,n.length);r.enqueue(oe(n.subarray(0,i),t.subarray(0,o-i))),n=oe(n.subarray(i),t.subarray(o-i))},flush(){const e=ae(n);t.crc32=e.getUint32(0,!0),t.uncompressedSize=e.getUint32(4,!0)}}),t=this}}class fn extends x{constructor(t,{chunkSize:e,DecompressionStreamFallback:n,DecompressionStream:r}){super({});const{zipCrypto:s,encrypted:o,checkCrc32:a,crc32:i,compressed:c,useCompressionStream:u,deflate64:f,format:l,compressionMethod:h,rawBitFlag:p,outputSize:y}=t;let b,v,S=super.readable;if(o&&(s?S=pn(S,new Ne(t)):(v=new Me(t),S=pn(S,v))),c){const t=l&&Kt(l);if(t)S=mn(S,dn(t.DecompressionStream,l,{chunkSize:e,compressionMethod:h,rawBitFlag:p,uncompressedSize:y}));else try{S=hn(S,u,{chunkSize:e,deflate64:f},r,n)}catch(t){if(f||y===_)throw t;let e;try{e=new r(on)}catch{throw t}S=((t,e,n)=>{const r=new re;let s,o,a,i=0,c=!1;const u=new g((t,e)=>{o=t,a=e});u.catch(()=>{}),n||o();const f=new x({start(t){const e=new d(10);e.set(an),t.enqueue(e)},transform(t,e){e.enqueue(t)},async flush(t){c=!0,h();try{await u}finally{p()}const e=new d(8),s=ae(e);s.setUint32(0,r.get(),!0),s.setUint32(4,n,!0),t.enqueue(e)},cancel(t){a(t)}}),l=new x({transform(t,e){r.append(t),i+=t.length,n>i?c&&h():o(),e.enqueue(t)},cancel(t){a(t)}});return t=pn(t,f),pn(t=mn(t,e),l);function h(){p(),s=T(()=>a(new w(nn)),5e3)}function p(){U(s)}})(S,e,y)}S=(t=>{const e=t.getReader();return new z({async pull(t){let n;try{n=await e.read()}catch(t){if(t&&t.message)throw t;const e=new w("Invalid compressed data");throw e.cause=t,e}const{value:r,done:s}=n;s?t.close():t.enqueue(r)},cancel:t=>e.cancel(t)})})(S)}a&&(b=new se,S=pn(S,b)),wn(this,S,()=>{if(a){const t=new m(b.value.buffer);if(i!=t.getUint32(0,!1))throw new w(rn)}})}}const ln=new c;function wn(t,e,r){e=pn(e,new x({flush:r})),n.defineProperty(t,"readable",{get:()=>e})}function dn(t,e,n){if(!t)throw new w("Compression method not supported");return new t(e,n)}function hn(t,e,n,r,s){const o=e&&r?r:s||r,a=n.deflate64?"deflate64-raw":sn;let i;try{i=new o(a,n)}catch(t){if(!e||!s||o==s)throw t;i=new s(a,n)}return mn(t,i)}function pn(t,e){return $e(t).pipeThrough(e)}function mn(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 yn="deflate",gn="inflate";class bn extends x{constructor(t,e){super({});const r=this,{codecType:s}=t;let o;s.startsWith(yn)?o=cn:s.startsWith(gn)&&(o=fn),r.outputSize=0;let a=0;const i=new o(t,e),c=super.readable,u=new x({transform(t,e){t&&t.length&&(a+=t.length,e.enqueue(t))},flush(){n.assign(r,{inputSize:a})}}),f=new x({transform(e,n){if(e&&e.length&&(n.enqueue(e),r.outputSize+=e.length,t.outputSize!==_&&r.outputSize>t.outputSize))throw new w(nn)},flush(){const{crc32:t}=i;n.assign(r,{crc32:t,inputSize:a})}});n.defineProperty(r,"readable",{get:()=>c.pipeThrough(u).pipeThrough(i).pipeThrough(f)})}}class vn extends x{constructor(t){const e=[];let n=0;function r(){const r=new d(t);let s=0;for(;t>s;){const n=e[0],o=t-s;n.length>o?(r.set(n.subarray(0,o),s),e[0]=n.subarray(o),s+=o):(r.set(n,s),s+=n.length,e.shift())}return n-=t,r}s.isFinite(t)&&t>=1||(t=65536),super({transform(s,o){for(e.push(s),n+=s.length;n>t;)o.enqueue(r())},flush(t){n&&t.enqueue(((t,e)=>{const n=new d(e);let r=0;for(const e of t)n.set(e,r),r+=e.length;return n})(e,n))}})}}class Sn{constructor(t,{readable:e,writable:r},{options:s,config:o,gt:a,useWebWorkers:i,transferStreams:u,workerURI:f,createWorker:l},w){const{signal:d}=a;return n.assign(t,{bt:!0,vt:(t.vt||0)+1,readable:e.pipeThrough(new vn(ut(o))).pipeThrough(new kn(a),{signal:d}),writable:r,options:n.assign({},s),workerURI:f,createWorker:l,transferStreams:u,terminate:()=>new g(e=>{const{St:n,bt:r}=t;n?(r?t.kt=e:(n.terminate(),e()),t.xt=null):e()}),zt(){if(t.bt){const{kt:e}=t;e&&(t.kt=null,t.Rt=!0,t.St.terminate(),e()),t.bt=!1,w(t)}}}),((t,e)=>({run:()=>(async({options:t,readable:e,writable:n,zt:r},s)=>{let o;try{if(t.compressed&&!t.format){const e=t.codecType.startsWith(yn),n=e?s.CompressionStreamFallback:s.DecompressionStreamFallback,r=e?s.CompressionStream:s.DecompressionStream;if(t.useCompressionStream){if(n&&n.Dt&&!((t,e)=>{if(!t)return!1;let n=ln.get(t);n||(n=new c,ln.set(t,n));let r=n.get(e);if(r===_){try{new t(e),r=!0}catch{r=!1}n.set(e,r)}return r})(r,sn))try{await void 0}catch{}}else try{await void 0}catch{n&&!n.Dt||(t.useCompressionStream=!0)}}o=new bn(t,s),await e.pipeThrough(o).pipeThrough(new vn(ut(s))).pipeTo(n,{preventClose:!0,preventAbort:!0});const{crc32:r,inputSize:a,outputSize:i}=o;return{crc32:r,inputSize:a,outputSize:i}}catch(t){throw o&&(t.outputSize=o.outputSize),t}finally{r()}})(t,e)}))(t,o)}}class kn extends x{constructor({onstart:t,onprogress:e,size:n,onend:r}){let s=0;super({async start(){t&&await xn(t,n)},async transform(t,r){s+=t.length,e&&await xn(e,s,n),r.enqueue(t)},async flush(){r&&await xn(r,s)}})}}async function xn(t,...e){try{await t(...e)}catch{}}let zn=[];const Rn=[];let Dn,Fn,Cn=0;function An(){!Dn&&Rn.length&&s.isFinite(Fn)&&Fn>=0&&(Dn=T(Un,Fn))}function Tn(){Dn&&(U(Dn),Dn=null)}function Un(){if(Dn=null,Rn.length){const[{resolve:t,stream:e,Ft:r}]=Rn.splice(0,1),s=n.assign({},r,{useWebWorkers:!1,workerURI:_,createWorker:_});t(new Sn({},e,s,En)),An()}}function En(){Tn(),An()}function In(t){const{Ct:e}=t;e&&(U(e),t.Ct=null)}const Wn="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split("");function Mn(t,e){return On(t,e,!0)}function On(t,e,n){return e&&"cp437"==e.trim().toLowerCase()?(t=>{{let e="";for(let n=0;n<t.length;n++)e+=Wn[t[n]];return e}})(t):new v(e,{ignoreBOM:n}).decode(t)}const Ln="HTTP error ",Pn="HTTP Range not supported",Bn="HTTP resource changed",Hn="Content-Range",Vn="Range",Zn="GET",qn="bytes",Nn=16777216,_n="writable",jn=Symbol();class Kn{constructor(){this.size=0}init(){this.initialized=!0}}class Gn extends Kn{get readable(){return this.createReadable()}createReadable({offset:t=0,size:e,chunkSize:n=ut(ct())}={}){const r=this;let s=0;return n=ft(n),new z({async pull(o){const i=e===_?n:a.min(n,e-s),c=await zr(r,t+s,i);c.length&&o.enqueue(c),s+n>=e||!c.length&&i?o.close():s+=n}})}}class Xn extends Kn{constructor(){super();const t=this,e=new R({write(e){if(!t.initialized)throw new w("Writer not initialized");return t.writeUint8Array((n=e).byteOffset||n.byteLength!=n.buffer.byteLength?new d(n):n);var n}});n.defineProperty(t,_n,{get:()=>e})}writeUint8Array(){}}let Jn,Qn;class Yn extends Gn{constructor(t){super(),n.assign(this,{At:t,size:t.size}),Qn||(Qn=(async()=>{try{const t=new y([new d(3)]).slice(1,2).stream().getReader();let e=0,n=await t.read();for(;!n.done;)e+=n.value.length,n=await t.read();Jn=1==e}catch{Jn=!1}})())}createReadable(t){const{At:e,size:n}=this,{offset:r=0,size:s=n-r}=t||{};return r||n>s?Jn?$e(e.slice(r,r+s).stream()):super.createReadable(t):$e(e.stream())}async readUint8Array(t,e){const n=this,r=t+e,s=t||r<n.size?n.At.slice(t,r):n.At;let o=await s.arrayBuffer();return o.byteLength>e&&(o=o.slice(t,r)),new d(o)}}class $n extends Kn{constructor(t){super();const e=this,r=new x;n.defineProperty(e,_n,{get:()=>r.writable}),e.contentType=t,e.Tt=tn(r.readable,t),e.Tt.catch(()=>{})}getData(){return this.Tt}}class tr extends Gn{constructor(t,e){super(),nr(this,t,e)}async init(){await rr(this,pr,lr),super.init()}createReadable(t){const e=this,{useRangeHeader:n,forceRangeRequests:r,size:o}=e;if((n||r)&&o!==_){const{offset:n=0,size:r=o-n}=t||{};if(r>0&&o>n)return((t,e,n)=>{let r,o=e,i=0,c=n;return new z({start:()=>u(),async pull(t){r||await u();const{value:e,done:n}=await r.read();if(n)throw new w(Pn);const s=e.length>i?e.subarray(0,i):e;i-=s.length,c-=s.length,s.length&&t.enqueue(s),i||(await(async()=>{const t=r;r=_,await t.cancel()})(),c||t.close())},cancel:t=>r&&r.cancel(t)});async function u(){const e=a.min(t.maximumRangeSize,c),n=await pr(Zn,t,ur(t,o,e));if(206!=n.status)throw new w(Pn);const u=n.headers.get(Hn);if(u){const t=s(u.trim().split(/[\s-]+/)[1]);if(!s.isNaN(t)&&t!=o)throw new w(Pn)}cr(t,n),ir(t,n),o+=e,i=e,r=n.body.getReader()}})(e,n,a.min(r,o-n))}return super.createReadable(t)}readUint8Array(t,e){return sr(this,t,e,pr,lr)}}class er extends Gn{constructor(t,e){super(),nr(this,t,e)}async init(){await rr(this,mr,wr),super.init()}readUint8Array(t,e){return sr(this,t,e,mr,wr)}}function nr(t,e,r){const{preventHeadRequest:s,useRangeHeader:o,forceRangeRequests:a,combineSizeEocd:i,checkResourceChanges:c=!0,maximumRangeSize:u=Nn,fetch:f}=r;delete(r=n.assign({},r)).preventHeadRequest,delete r.useRangeHeader,delete r.forceRangeRequests,delete r.combineSizeEocd,delete r.checkResourceChanges,delete r.maximumRangeSize,delete r.useXHR,delete r.fetch,n.assign(t,{url:e,options:r,preventHeadRequest:s,useRangeHeader:o,forceRangeRequests:a,combineSizeEocd:i,checkResourceChanges:c,maximumRangeSize:u,fetch:f})}async function rr(t,e,n){const{url:r,preventHeadRequest:s,useRangeHeader:o,forceRangeRequests:a,combineSizeEocd:i}=t;if((t=>{const{baseURI:e}=ct(),{protocol:n}=new l(t,e);return"http:"==n||"https:"==n})(r)&&(o||a)&&(typeof s==j||s)){const r=await e(Zn,t,ur(t,i?-22:void 0)),s=r.headers.get("Accept-Ranges");if(!(a||s&&s.toLowerCase()==qn))throw new w(Pn);{if(i){const e=new d(await r.arrayBuffer());206==r.status&&e.length==H&&(t.Ut=e)}ir(t,r);const s=or(r);s===_?await hr(t,e,n):t.size=s}}else await hr(t,e,n)}async function sr(t,e,n,r,o){const{useRangeHeader:a,forceRangeRequests:i,Ut:c,size:u,options:f}=t;if(a||i){if(c&&e==u-H&&n==H)return c;if(u>e&&0!==n){e+n>u&&(n=u-e);const o=await r(Zn,t,ur(t,e,n));if(206!=o.status)throw new w(Pn);const a=o.headers.get(Hn);if(a){const t=s(a.trim().split(/[\s-]+/)[1]);if(!s.isNaN(t)&&t!=e)throw new w(Pn)}cr(t,o),ir(t,o);const i=new d(await o.arrayBuffer());if(i.length!=n)throw new w(Pn);return i}return X}{const{data:r}=t;return r||await o(t,f),t.data.subarray(e,e+n)}}function or(t){const e=t.headers.get(Hn);if(e){const t=e.trim().split(/\s*\/\s*/)[1];if(t&&"*"!=t){const e=s(t);if(!s.isNaN(e))return e}}}function ar({headers:t}){return{Et:t.get("Etag")||_,lastModified:t.get("Last-Modified")||_}}function ir(t,e){const{checkResourceChanges:n,It:r}=t;n&&!r&&206==e.status&&(t.It=ar(e))}function cr(t,e){const{checkResourceChanges:r,It:s,size:o}=t;if(r){const t=or(e);if(t!==_&&o!==_&&t!=o)throw new w(Bn);if(s){const t=ar(e);if(n.entries(s).some(([e,n])=>n!==_&&t[e]!==_&&n!=t[e]))throw new w(Bn)}}}function ur(t,e=0,r=1){return n.assign({},fr(t),{[Vn]:qn+"="+(0>e?e:e+"-"+(e+r-1))})}function fr({options:t}){const{headers:e}=t;if(e)return Symbol.iterator in e?n.fromEntries(e):e}async function lr(t){await dr(t,pr)}async function wr(t){await dr(t,mr)}async function dr(t,e){const n=await e(Zn,t,fr(t));t.data=new d(await n.arrayBuffer()),t.size=t.data.length}async function hr(t,e,n){if(t.preventHeadRequest)await n(t,t.options);else{const r=await e("HEAD",t,fr(t)),o=r.headers.get("Content-Length");o&&!r.headers.get("Content-Encoding")?t.size=s(o):await n(t,t.options)}}async function pr(t,{fetch:e=fetch,options:r,url:s},o){const a=await e(s,n.assign({},r,{method:t,headers:o}));if(400>a.status)return a;throw 416==a.status?new w(Pn):new w(Ln+(a.statusText||a.status))}function mr(t,{url:e},r){return new g((s,o)=>{const a=new XMLHttpRequest;if(a.addEventListener("load",()=>{if(400>a.status){const t=[];a.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(e=>{const n=e.trim().split(/\s*:\s*/);n[0]=n[0].trim().replace(/^[a-z]|-[a-z]/g,t=>t.toUpperCase()),t.push(n)}),s({status:a.status,arrayBuffer:()=>a.response,headers:new c(t)})}else o(416==a.status?new w(Pn):new w(Ln+(a.statusText||a.status)))},!1),a.addEventListener("error",t=>o(t.detail?t.detail.error:new w("Network error")),!1),a.open(t,e),r)for(const t of n.entries(r))a.setRequestHeader(t[0],t[1]);a.responseType="arraybuffer",a.send()})}class yr extends Gn{constructor(t,e={}){super(),n.assign(this,{url:t,reader:e.useXHR&&!e.fetch?new er(t,e):new tr(t,e)})}set size(t){}get size(){return this.reader.size}async init(){await this.reader.init(),super.init()}createReadable(t){return this.reader.createReadable(t)}readUint8Array(t,e){return this.reader.readUint8Array(t,e)}}class gr extends Gn{constructor(t){super(),this.Wt=t}async init(){const t=this;t.Mt=0;const e=t.Wt=await g.all(t.Wt.map(xr));t.Ot=e.map(e=>{const n=t.size;return t.size+=e.size,n}),super.init()}Lt(t){const{Ot:e,size:n}=this,r=e[t];return r===_?n:r}async readUint8Array(t,e){const n=this,{Wt:r}=this;let s,o=0,i=t;for(;r[o]&&i>=r[o].size;)i-=r[o].size,o++;const c=r[o];if(c){const r=c.size;if(i+e>r){const o=r-i;s=oe(await zr(c,i,o),await n.readUint8Array(t+o,e-o))}else s=await zr(c,i,e)}else s=X;return n.Mt=a.max(o,n.Mt),s}}class br extends Kn{constructor(t,e=4294967295){super();const r=this;let s,o,a;n.assign(r,{diskNumber:0,diskOffset:0,size:0,maxSize:e,availableSize:e});const i=new R({async write(e){if(e===jn)return void(a&&await u());const{availableSize:n}=r;if(a)e.length<n?await c(e):(await c(e.subarray(0,n)),await u(),e.length>n&&await this.write(e.subarray(n)));else{const{value:n,done:i}=await t.next();if(i&&!n)throw new w("Writer iterator completed too soon");s=n,s.size=0,s.maxSize&&(r.maxSize=s.maxSize),r.availableSize=r.maxSize,await kr(s),o=n.writable,a=o.getWriter(),await this.write(e)}},async close(){a&&(await a.ready,await f())},async abort(t){a&&await a.abort(t)}});async function c(t){const e=t.length;e&&(await a.ready,await a.write(t),s.size+=e,r.availableSize-=e)}async function u(){await f(),r.diskOffset+=s.size,r.diskNumber++,a=null,r.availableSize=r.maxSize}async function f(){await a.close()}n.defineProperty(r,_n,{get:()=>i})}async closeDisk(){const t=this.writable.getWriter();try{await t.ready,await t.write(jn)}finally{t.releaseLock()}}}class vr{constructor(t){return e.isArray(t)&&(t=new gr(t)),(t instanceof z||typeof t.getReader==K)&&(t={readable:$e(t)}),t}}class Sr{constructor(t){return t.writable===_&&typeof t.next==K&&(t=new br(t)),(t instanceof R||typeof t.getWriter==K)&&(t={writable:en(t)}),t.size===_&&(t.size=0),t}}async function kr(t,e){if(!t.init||t.initialized)return g.resolve();await t.init(e)}async function xr(t){return t=new vr(t),await kr(t),t.size!==_&&t.readUint8Array||(t=new Yn(await tn(t.readable)),await kr(t)),t}function zr(t,e,n){return t.readUint8Array(e,n)}const Rr="filename",Dr="rawFilename",Fr="comment",Cr="rawComment",Ar="uncompressedSize",Tr="compressedSize",Ur="offset",Er="diskNumberStart",Ir="lastModDate",Wr="rawLastModDate",Mr="lastAccessDate",Or="rawLastAccessDate",Lr="creationDate",Pr="rawCreationDate",Br=[Rr,Dr,Ar,Tr,Ir,Wr,Fr,Cr,Mr,Or,Lr,Pr,Ur,Er,"internalFileAttributes","externalFileAttributes","internalFileAttribute","externalFileAttribute","msdosAttributesRaw","msdosAttributes","msDosCompatible","zip64","encrypted","version","versionMadeBy","zipCrypto","directory","executable","symlink","compressionMethod","signature","crc32","extraField","extraFieldUnix","extraFieldInfoZip","extraFieldUnixType1","extraFieldPkwareUnix","uid","gid","unixMode","unixExternalUpper","setuid","setgid","sticky","bitFlag","rawBitFlag","filenameLength","extraFieldLength","filenameUTF8","commentUTF8","rawExtraField","extraFieldZip64","extraFieldUnicodePath","extraFieldUnicodeComment","extraFieldAES","extraFieldNTFS","extraFieldExtendedTimestamp","extraFieldUSDZ"];class Hr{constructor(t){Br.forEach(e=>this[e]=t[e])}}const Vr="File format is not recognized",Zr="Encryption method not supported",qr="Compression method not supported",Nr="Split zip file",_r="malformed extra field",jr="wrapped entries count",Kr="appended data",Gr="prepended data",Xr="mismatched zip64 end of central directory record",Jr=/^[a-zA-Z]:/,Qr="utf-8",Yr="cp437",$r=[[Ar,E],[Tr,E],[Ur,E],[Er,I]],ts={[I]:{Pt:Es,bytes:4},[E]:{Pt:Is,bytes:8}},es=o(s.MAX_SAFE_INTEGER);class ns{constructor(t,e){n.assign(this,{reader:t,options:e})}async getData(t,e,n,r={}){const o=this,i=ct(),{reader:c,index:u,offset:f,diskNumberStart:h,extraFieldAES:p,extraFieldZip64:m,compressionMethod:y,bitFlag:b,rawBitFlag:v,crc32:S,rawLastModDate:k,uncompressedSize:x,compressedSize:z}=o,{dataDescriptor:D}=b,F=e.localDirectory={},C=e.warnings=[],A=ds(c,h)+f,U=await zr(c,A,30),E=ae(U);let I=Ds(o,r,"password"),M=Ds(o,r,"rawPassword");const L=Ds(o,r,"passThrough");if(((t,e)=>{if(t&&typeof t!=G||e&&!(e instanceof d))throw new w("Invalid password (password must be a string, rawPassword must be a Uint8Array)")})(I,M),I=I&&I.length&&I,M=M&&M.length&&M,p&&99!=p.originalCompressionMethod)throw new w(qr);if(30>U.length||67324752!=Es(E,0))throw new w("Local file header not found");as(F,E,4);const{extraFieldLength:P,filenameLength:B}=F,H=F.dataOffset=A+30+B+P,V=Ds(o,r,"checkLocalDirectory"),Z=ms(r,o.options),q=((t,e)=>t===_?e!=Y:!!t)(V,Z),N=((t,e)=>t===_?e==J:!!t)(V,Z);let j=X;if(N&&(B||P)){const t=await zr(c,A+30,B+P);j=t.subarray(0,B),F.rawExtraField=t.subarray(B)}else F.rawExtraField=P?await zr(c,A+30+B,P):X;N&&(F.rawFilename=j),is(o,F,E,4,!0)&&zs(C,_r),((t,e,n,r,s)=>{const{rawFilename:o}=t,a=!s,i=t.Bt&&!(8192&~e.rawBitFlag);!r||i||n.length==o.length&&!n.some((t,e)=>t!=o[e])||xs(a,s,"mismatched local file header (filename)"),(2057&e.rawBitFlag)!=(2057&t.rawBitFlag)&&xs(a,s,"mismatched local file header (general purpose bit flag)"),e.compressionMethod!=t.compressionMethod&&xs(a,s,"mismatched local file header (compression method)"),e.bitFlag.dataDescriptor||i||!(e.crc32||e.compressedSize||e.uncompressedSize)||e.crc32==t.crc32&&e.compressedSize==t.compressedSize&&e.uncompressedSize==t.uncompressedSize||xs(a,s,"mismatched local file header (crc32 or sizes)")})(o,F,j,N,q?_:C);const{lastAccessDate:Q,creationDate:$,uid:tt,gid:et}=F;Q&&(e.lastAccessDate=Q),$&&(e.creationDate=$),tt!==_&&e.uid===_&&(e.uid=tt),et!==_&&e.gid===_&&(e.gid=et);const nt=o.encrypted&&F.encrypted&&!L,rt=nt&&!p;if(L||(e.zipCrypto=rt),nt&&!(64&~F.rawBitFlag))throw new w(Zr);const st=L?_:(t=>_t.get(t))(y);if(0!=y&&8!=y&&9!=y&&!st&&!L)throw new w(qr);if(nt){if(!rt&&(1>p.strength||p.strength>3))throw new w(Zr);if(!I&&!M)throw new w("File contains encrypted entry")}if(H+z>c.size)throw new w("Entry data out of bounds");const ot=z,at=$e(c.createReadable({offset:H,size:ot})),it=(t=>{if(t&&(typeof t.addEventListener!=K||"boolean"!=typeof t.aborted))throw new w("Invalid signal (must be an AbortSignal instance)");return t||_})(Ds(o,r,"signal")),ut=Ds(o,r,"checkPasswordOnly");let ft=Ds(o,r,"checkOverlappingEntry");const lt=Ds(o,r,"checkOverlappingEntryOnly");lt&&(ft=!0);const{onstart:wt,onprogress:dt,onend:ht}=r,pt=0!=y&&!L,mt=L?z:x,yt=9==y;let gt=Ds(o,r,"useCompressionStream");yt&&(gt=!1);const bt=Ds(o,r,"checkCrc32"),vt=(bt===_?Ds(o,r,"checkSignature"):bt)&&!L&&(!nt||rt||p&&1==p.vendorVersion),St={options:{codecType:gn,password:I,rawPassword:M,zipCrypto:rt,encryptionStrength:p&&p.strength,checkCrc32:vt,checkAuthenticationCode:Ds(o,r,"checkAuthenticationCode"),passwordVerification:rt&&(D?k>>>8&W:S>>>24&W),outputSize:mt,crc32:S,compressed:pt,encrypted:nt,useWebWorkers:Ds(o,r,"useWebWorkers"),useCompressionStream:gt,transferStreams:Ds(o,r,"transferStreams"),deflate64:yt,format:st?st.format:_,codecURI:st?st.codecURI:_,compressionMethod:y,rawBitFlag:v,checkPasswordOnly:ut},config:i,gt:{signal:it,size:ot,onstart:wt,onprogress:dt,onend:ht}};let kt,xt;ft&&await(async({reader:t,Ht:e,index:n,offset:r,crc32:s,compressedSize:o,uncompressedSize:a,dataOffset:i,dataDescriptor:c,extraFieldZip64:u,Vt:f})=>{let l=0;if(c&&(l=u?20:12),l){const n=await zr(t,i+o,l+4),r=ae(n);let c=n.length==l+4&&Es(r,0)==O;if(c){const t=ws(r,4,u);(e.encrypted&&!e.zipCrypto||t.crc32==s)&&t.compressedSize==o&&t.uncompressedSize==a?l+=4:c=!1}if(n.length>=l){const t=ws(r,c?4:0,u);t.signature=c,e.localDirectory.dataDescriptor=t}}const d={start:r,end:i+o+l,Ht:e};for(const[t,e]of f)if(t!=n&&d.start<e.end&&e.start<d.end){const t=new w("Overlapping entry found");throw t.overlappingEntry=e.Ht,t}f.set(n,d)})({reader:c,Ht:e,index:u,offset:A,crc32:S,compressedSize:z,uncompressedSize:x,dataOffset:H,dataDescriptor:D||F.bitFlag.dataDescriptor,extraFieldZip64:m||F.extraFieldZip64,Vt:n});try{if(!lt){ut&&(t=new R),t=new Sr(t),await kr(t,((t,e,n)=>a.min(t,n?1032*e:e))(mt,z,pt)),({writable:kt}=t);const{outputSize:e}=await async function(t,e){const{options:n,config:r}=e,{transferStreams:o,useWebWorkers:a,useCompressionStream:i,compressed:c,checkCrc32:u,computeCrc32:f,encrypted:d,format:h,codecURI:p}=n,{workerURI:m,createWorker:y,maxWorkers:b}=r;h&&(p&&(n.codecURI=((t,e)=>{try{return new l(t,e).toString()}catch{return t}})(p,r.baseURI)),await(async(t,e)=>{!jt.has(t)&&e&&((t,e)=>{const{CompressionStream:n,DecompressionStream:r}=e;if(typeof n!=K&&typeof r!=K)throw new w("Invalid codec module");jt.set(t,{CompressionStream:n,DecompressionStream:r})})(t,await(import(e)))})(h,n.codecURI)),e.transferStreams=!h&&(o||o===_&&r.transferStreams);const v=!(c||u||f||d),S=h===_||!!n.codecURI;return e.useWebWorkers=!v&&S&&(a||a===_&&r.useWebWorkers),e.workerURI=e.useWebWorkers&&m?m:_,e.createWorker=e.useWebWorkers&&y?y:_,n.useCompressionStream=i||i===_&&r.useCompressionStream,(await(async()=>{const n=zn.find(t=>!t.bt);if(n)return In(n),new Sn(n,t,e,k);if(zn.length<b){const n={Zt:Cn};return Cn++,zn.push(n),new Sn(n,t,e,k)}return new g(n=>{Rn.push({resolve:n,stream:t,Ft:e}),Fn=r.workerStarvationTimeout,An()})})()).run();function k(t){if(Tn(),Rn.length){const[{resolve:e,stream:n,Ft:r}]=Rn.splice(0,1);e(new Sn(t,n,r,k)),An()}else t.St?(In(t),((t,e)=>{const{config:n}=e,{terminateWorkerTimeout:r}=n;s.isFinite(r)&&r>=0&&(t.Rt?t.Rt=!1:t.Ct=T(async()=>{zn=zn.filter(e=>e!=t);try{await t.terminate()}catch{}},r))})(t,e)):zn=zn.filter(e=>e!=t)}}({readable:at,writable:kt},St);if(t.size+=e,e!=mt)throw new w(nn)}}catch(e){if(e.outputSize!==_&&(t.size+=e.outputSize),!ut||e.message!=pe)throw xt=e,e}finally{const e=!(t=>!(!t||!t.getData))(t)&&Ds(o,r,"preventClose");if(!e&&kt&&!kt.locked){const t=kt.getWriter();if(xt)try{await t.abort(xt)}catch{}else await t.close()}}return ut||lt?_:t.getData?t.getData():kt}}function rs(t){const e=a.min(t.byteLength,1024)-3;for(let n=0;e>n;n++)if(134630224==Es(t,n))return!0;return!1}function ss(t,e,n){let r=0;for(;n+46<=e.length&&Es(t,n)==L;)n+=46+Us(t,n+28)+Us(t,n+30)+Us(t,n+32),r++;return r%65536?0:r}function os(t){if(t.length>=6){const e=ae(t);if(84233040==Es(e,0)){const n=Us(e,4);if(6+n<=t.length)return t.subarray(6,6+n)}}}function as(t,e,r){const s=t.rawBitFlag=Us(e,r+2),o=!(1&~s),a=Es(e,r+6);n.assign(t,{encrypted:o,version:Us(e,r),bitFlag:{level:(6&s)>>1,dataDescriptor:!(8&~s),languageEncodingFlag:!(2048&~s)},rawLastModDate:a,lastModDate:Cs(a),filenameLength:Us(e,r+22),extraFieldLength:Us(e,r+24)})}function is(t,e,r,s,o){const{rawExtraField:a}=e,u=e.extraField=new c,f=ae(a);let l=0,d=!1;try{for(;l<a.length;){const t=Us(f,l),e=Us(f,l+2);u.set(t,{type:t,data:a.slice(l+4,l+4+e)}),l+=4+e}}catch{d=!0}l>a.length&&(d=!0);const h=Us(r,s+4);n.assign(e,{signature:Es(r,s+10),crc32:Es(r,s+10),compressedSize:Es(r,s+14),uncompressedSize:Es(r,s+18)});const p=u.get(1);p&&(((t,e)=>{e.zip64=!0;const n=ae(t.data),r=$r.filter(([t,n])=>e[t]==n),s=r.reduce((t,[,e])=>t+ts[e].bytes,0);if(t.data.length<s)throw new w("Zip64 extra field not found");for(let s=0,o=0;s<r.length;s++){const[a,i]=r[s],c=ts[i];e[a]=t[a]=c.Pt(n,o),o+=c.bytes}})(p,e),e.extraFieldZip64=p);const m=u.get(28789);m&&(cs(m,Rr,Dr,e,t),e.extraFieldUnicodePath=m);const y=u.get(25461);y&&(cs(y,Fr,Cr,e,t),e.extraFieldUnicodeComment=y);const g=u.get(39169);g&&g.data.length>=7?(((t,e,r)=>{const s=ae(t.data),o=Ts(s,4);n.assign(t,{vendorVersion:Ts(s,0),vendorId:Ts(s,2),strength:o,originalCompressionMethod:r,compressionMethod:Us(s,5)}),e.compressionMethod=t.compressionMethod,1!=t.vendorVersion&&(e.crc32=_)})(g,e,h),e.extraFieldAES=g):e.compressionMethod=h;const b=u.get(13);b&&(us(b,e),e.extraFieldPkwareUnix=b);const v=u.get(22613);v&&(us(v,e),e.extraFieldUnixType1=v);const S=u.get(10);S&&(((t,e)=>{const r=ae(t.data);let s,o=4;try{for(;o<t.data.length&&!s;){const e=Us(r,o),n=Us(r,o+2);1==e&&(s=t.data.slice(o+4,o+4+n)),o+=4+n}}catch{}if(s&&24==s.length){const r=ae(s),o=r.getBigUint64(0,!0),a=r.getBigUint64(8,!0),i=r.getBigUint64(16,!0);n.assign(t,{rawLastModDate:o,rawLastAccessDate:a,rawCreationDate:i});const c={lastModDate:As(o),lastAccessDate:As(a),creationDate:As(i)};n.assign(t,c),n.assign(e,c,{rawLastAccessDate:a,rawCreationDate:i})}})(S,e),e.extraFieldNTFS=S);const k=u.get(30805);let x;if(k&&(x=fs(k,e,!1),e.extraFieldUnix=k),!x){const t=u.get(30837);t&&(fs(t,e,!0),e.extraFieldInfoZip=t)}const z=u.get(21589);z&&(((t,e,n)=>{if(!t.data.length)return;const r=ae(t.data),s=Ts(r,0),o=[],a=[];n?(1&~s||(o.push(Ir),a.push(Wr)),2&~s||(o.push(Mr),a.push(Or)),4&~s||(o.push(Lr),a.push(Pr))):5>t.data.length||(o.push(Ir),a.push(Wr));let c=1;o.forEach((n,s)=>{if(t.data.length>=c+4){const o=Es(r,c);e[n]=t[n]=new i(1e3*(0|o));const u=a[s];t[u]=o}c+=4})})(z,e,o),e.extraFieldExtendedTimestamp=z);const R=u.get(6534);return R&&(e.extraFieldUSDZ=R),d}function cs(t,e,r,s,o){if(5>t.data.length)return void(t.valid=!1);const a=ae(t.data),i=new re;i.append(o[r]);const c=ae(new d(4));c.setUint32(0,i.get(),!0);const u=Es(a,1),f=Ts(a,0);n.assign(t,{version:f,[e]:Mn(t.data.subarray(5)),valid:1==f&&!o.bitFlag.languageEncodingFlag&&u==Es(c,0)}),t.valid&&(s[e]=t[e],s[e+"UTF8"]=!0)}function us(t,e){if(8>t.data.length)return;const r=ae(t.data),s={lastAccessDate:new i(1e3*(0|Es(r,0))),lastModDate:new i(1e3*(0|Es(r,4)))};12>t.data.length||(s.uid=Us(r,8),s.gid=Us(r,10)),n.assign(t,s),n.assign(e,s)}function fs(t,e,r){try{const s=ae(t.data);let o,a;if(r){let e=0;const r=Ts(s,e++),i=Ts(s,e++);o=ls(t.data.subarray(e,e+i)),e+=i;const c=Ts(s,e++);a=ls(t.data.subarray(e,e+c)),n.assign(t,{version:r,uid:o,gid:a})}else 4>t.data.length||(o=Us(s,0),a=Us(s,2),n.assign(t,{uid:o,gid:a}));return o!==_&&(e.uid=o),a!==_&&(e.gid=a),o!==_||a!==_}catch{}}function ls(t){const e=new d(4);return e.set(t,0),new m(e.buffer,e.byteOffset,4).getUint32(0,!0)}function ws(t,e,n){const r=Es(t,e);let s,o;return n?(s=Is(t,e+4),o=Is(t,e+12)):(s=Es(t,e+4),o=Es(t,e+8)),{crc32:r,compressedSize:s,uncompressedSize:o}}function ds(t,e){return t.Lt?t.Lt(e):0}async function hs(t){return Es(ae(await zr(t,0,4)))}function ps(t){return t===J||t===Q||t===Y}function ms(t,e){return ys(t,ys(e,Q))}function ys(t,e){const n=t.strictness;if(n!==_){if(!ps(n))throw new w("Invalid strictness (must be 'strict', 'balanced' or 'tolerant')");return n}const r=t.checkAmbiguity;return r===_?e:r?J:e==Y?Y:Q}function gs(t,e){if(e==Y)return!1;const n=t.split("/");return n.length>1&&""===n[n.length-1]&&n.pop(),!!(n.includes("..")||t.startsWith("/")||t.startsWith("\\\\")||Jr.test(t))||e==J&&(n.includes(".")||n.includes(""))}async function*bs(t,e){const n=t.size-e,r=await zr(t,n,e),s=ae(r);for(let t=r.length-H;t>=0;t--)101010256==Es(s,t)&&(yield[s,n,r,t,n+t])}function vs(t,e,n){return{offset:n,buffer:t.slice(e,e+H).buffer}}async function Ss(t,e,n,r,s,o,a){const i=Us(e,r+10),c=Es(e,r+12),u=Es(e,r+16);if(i==I||c==E||u==E)return await ks(t,e,n,s-V,o,a)==B?2:0;if(!i&&!c)return 1;const f=Us(e,r+6);for(const r of[s-c,ds(t,f)+u])if(await ks(t,e,n,r,o,a)==L)return 2;return 0}async function ks(t,e,n,r,s,o){return 0>r||r+4>s?_:n>r?o.count>0?(o.count--,Es(ae(await zr(t,r,4)),0)):_:Es(e,r-n)}function xs(t,e,n){t?Rs(n):zs(e,n)}function zs(t,e,n){if(!t.some(t=>t.reason==e)){const r={reason:e};n!==_&&(r.filename=n),t.push(r)}}function Rs(t){const e=new w("Ambiguous archive");throw e.reason=t,e}function Ds(t,e,n){return e[n]===_?t.options[n]:e[n]}function Fs(t,e,n){return $(Ds(t,e,n))}function Cs(t){const e=(4294901760&t)>>16,n=t&I,r=new i(1980+((65024&e)>>9),((480&e)>>5)-1,31&e,(63488&n)>>11,(2016&n)>>5,2*(31&n),0);return N>r?N:r}function As(t){return new i(s(t/o(1e4)-o(116444736e5)))}function Ts(t,e){return t.getUint8(e)}function Us(t,e){return t.getUint16(e,!0)}function Es(t,e){return t.getUint32(e,!0)}function Is(t,e){const n=t.getBigUint64(e,!0);if(n>es)throw new w("64-bit value exceeds Number.MAX_SAFE_INTEGER");return s(n)}(t=>{const e=lt(dt(t));n.assign(nt,e),n.assign(it,e)})({workerURI:null,wasmURI:null,DecompressionStreamFallback:class extends Nt{constructor(t){(t=>{if("deflate-raw"!=t)throw new TypeError("Unsupported compression format: "+t)})(t),super(new Zt)}}}),t.BlobReader=Yn,t.BlobWriter=$n,t.Data64URIWriter=class extends Xn{constructor(t){super(),n.assign(this,{contentType:t,data:"data:"+(t||"")+";base64,",qt:""})}writeUint8Array(t){const e=this;let n,s=e.qt;const o=e.qt.length;for(e.qt="",n=0;n<3*a.floor((o+t.length)/3)-o;n++)s+=r.fromCharCode(t[n]);for(;n<t.length;n++)e.qt+=r.fromCharCode(t[n]);s.length>2?e.data+=k(s):e.qt=s+e.qt}getData(){return this.data+k(this.qt)}},t.HttpRangeReader=class extends yr{constructor(t,e={}){super(t,n.assign({},e,{useRangeHeader:!0}))}},t.TextWriter=class extends $n{constructor(t){super(),n.assign(this,{encoding:t,Nt:!t||"utf-8"==t.toLowerCase()})}async getData(){const{encoding:t,Nt:e}=this,n=await super.getData();return n.text&&e?n.text():((t,e)=>On(t,e,!1))(new d(await n.arrayBuffer()),t)}},t.ZipReader=class{constructor(t,e={}){n.assign(this,{reader:new vr(t),options:e,Vt:new c})}async*getEntriesGenerator(t={}){const e=this;let{reader:r}=e;if(await kr(r),r.size!==_&&r.readUint8Array||(r=new Yn(await tn(r.readable)),await kr(r)),r.size<H)throw new w(Vr);const o=e.warnings=[],i=ms(t,e.options),c=i==J,f=i!=Y,l=((t,e)=>{if(t!==_){const e=tt(t);if("number"!=typeof e||s.isNaN(e)||0>e)throw new w("Invalid maxAppendedDataSize (must be a number greater than or equal to 0)");return e}return e==J?0:e==Y?1/0:I})(Ds(e,t,"maxAppendedDataSize"),i),d=((t,e)=>{if(t===_)return e;if(!ps(t))throw new w("Invalid filenameValidation (must be 'strict', 'balanced' or 'tolerant')");return t})(Ds(e,t,"filenameValidation"),i),h=Ds(e,t,"normalizeFilename"),{_t:p,jt:m}=await(async(t,e,n)=>{const{size:r}=t,s=a.min(r,65557),o={count:64};let i,c,u=0;for await(const[n,a,f,l,w]of bs(t,s)){const s=Us(n,l+20);if(w+H+s==r){const s=await Ss(t,n,a,l,w,r,o);if(2==s){if(i||(i=vs(f,l,w)),u++,!e||u>1)break}else 1!=s||c||(c=vs(f,l,w))}}return i||(i=c),i||(i=await(async(t,e,n)=>{const{size:r}=t,s=a.min(r,e==1/0?r:65557+e);let o,i;for await(const[e,a,c,u,f]of bs(t,s)){const s=vs(c,u,f);o||(o=s);const l=await Ss(t,e,a,u,f,r,n);if(2==l)return s;1!=l||i||(i=s)}return i||o})(t,n,o)),{_t:i,jt:u}})(r,f,l);if(!p)throw await(async t=>await hs(t)==M)(r)?new w(Nr):new w("End of central directory not found");f&&m>1&&Rs("multiple end of central directory records");const y=ae(p);let g=Es(y,12),b=Es(y,16);const v=p.offset,S=Us(y,20),k=v+H+S,z=r.size-k;z>l&&Rs(Kr),z>0&&zs(o,Kr);let R=Us(y,4);const D=r.Mt||0;let F,C,A,T,U=Us(y,6),O=Us(y,10),N=0,j=Z;const K=b==E||g==E||O==I||U==I;if(b!=E&&U!=I&&(b+=ds(r,U)),K){const t=p.offset<V?X:await zr(r,p.offset-V,V),e=ae(t);if(t.length==V&&Es(e,0)==B){b=ds(r,Es(e,4))+Is(e,8);let t=await zr(r,b,Z),s=ae(t);const i=p.offset-V-Z;if((t.length<Z||Es(s,0)!=P)&&b!=i&&i>=0){const e=b;b=i,b>e&&(N=b-e),t=await zr(r,b,Z),s=ae(t)}if(t.length<Z||Es(s,0)!=P)throw new w("End of Zip64 central directory locator not found");if(C=!0,A=Is(s,4)>44,A){const t=a.min(Is(s,4)-44,r.size-b-Z);t>0&&(j+=t,T=(t=>{const e={rawExtensibleData:t};if(t.length>=28){const r=ae(t),s=Us(r,26);n.assign(e,{compressionMethod:Us(r,0),compressedSize:Is(r,2),uncompressedSize:Is(r,10),encryptionAlgorithm:Us(r,18),bitLength:Us(r,20),flags:Us(r,22),hashAlgorithm:Us(r,24),hashData:t.subarray(28,28+s)})}return e})(await zr(r,b+Z,t)))}R==I?R=Es(s,16):R!=Es(s,16)&&xs(c,o,Xr),U==I?U=Es(s,20):U!=Es(s,20)&&xs(c,o,Xr),O==I?O=Is(s,32):O!=Is(s,32)&&xs(c,o,Xr),g==E?g=Is(s,40):g!=Is(s,40)&&xs(c,o,Xr),b=ds(r,U)+Is(s,48)+N}}let G=g;const Q=p.offset-(C?j+V:0);if(b<r.size||(N=r.size-b-g-H,b=r.size-g-H),D!=R)throw new w(Nr);if(0>b)throw new w(Vr);let $=0,et=await zr(r,b,g),nt=ae(et);if(g){if(4>et.length)throw new w(Vr);const t=Q-g;if(b!=t&&U==R){let e=!(Es(nt,$)==L||T&&T.compressedSize||rs(nt));if(e||0>t||t+4>r.size||(e=Es(ae(await zr(r,t,4)),0)==L),e){const e=b;b=t,b>e&&(N+=b-e),et=await zr(r,b,g),nt=ae(et)}}}const rt=Q-b;if(g==rt||0>rt||U!=R||(g=rt,et=await zr(r,b,g),nt=ae(et)),0>b||b>=r.size)throw new w(Vr);e.directoryOffset=b,e.directoryLength=G;const st=Fs(e,t,"decryptCentralDirectory");let ot,at;if(st&&O&&et.length>=4&&Es(nt,0)!=L&&(A||rs(nt))){const t=((t,e,n)=>{const r=t&&t.compressedSize?t.compressedSize:e;return r>0&&n>=r?r:n})(T,G,et.length);at=et.subarray(t),et=await st(et.subarray(0,t),T),nt=ae(et),G=et.length,ot=!0}!T||ot||et.length>=4&&Es(nt,0)!=L||zs(o,"unknown zip64 extensible data"),F=b;const it=Ds(e,t,"filenameEncoding"),ct=Ds(e,t,"commentEncoding"),ut=new u;let ft,lt=-1;const wt=!c&&!C;!O&&wt&&(O=ss(nt,et,$),O&&zs(o,jr));for(let s=0;O>s;s++){const i=new ns(r,e.options);if($+46>et.length||Es(nt,$)!=L){if(0==s&&!ot&&(A||rs(nt)))throw new w("Encrypted central directory is not supported");throw new w("Central directory header not found")}as(i,nt,$+6);const c=!!i.bitFlag.languageEncodingFlag,u=$+46,f=u+i.filenameLength,l=f+i.extraFieldLength,p=Us(nt,$+4),m=!(p>>8),y=p>>8==3,g=et.subarray(u,f),b=Us(nt,$+32),v=l+b,S=et.subarray(l,v),k=c,z=c,R=Es(nt,$+38),D=R&W,C={readOnly:!!(1&D),hidden:!!(2&D),system:!!(4&D),directory:!!(16&D),archive:!!(32&D)},T=Es(nt,$+42),U=Fs(e,t,"decodeText")||Mn,E=k?Qr:it||Yr,M=z?Qr:ct||Yr;let P=U(g,E,"filename");if(P===_&&(P=Mn(g,E)),h){const t=h(P);t!==_&&(P=t)}if(gs(P,d)){const t=new w("Unsafe filename");throw t.filename=P,t}let B=U(S,M,"comment");B===_&&(B=Mn(S,M)),n.assign(i,{index:s,Bt:ot,versionMadeBy:p,msDosCompatible:m,zip64:!1,compressedSize:0,uncompressedSize:0,Kt:b,offset:T,diskNumberStart:Us(nt,$+34),internalFileAttributes:Us(nt,$+36),externalFileAttributes:R,msdosAttributesRaw:D,msdosAttributes:C,rawFilename:g,filenameUTF8:k,commentUTF8:z,rawExtraField:et.subarray(f,l),rawComment:S,filename:P,comment:B}),is(i,i,nt,$+6)&&zs(o,_r,P),i.offset+=N;const H=ds(r,i.diskNumberStart)+i.offset;F=a.min(H,F),lt>H&&zs(o,"unsorted central directory",P),lt=H,(i.version&W)>63&&zs(o,"unknown version needed to extract",P),32&~i.rawBitFlag||zs(o,"compressed patched data",P),ut.has(i.filename)&&(ft=!0),ut.add(i.filename);const V=i.externalFileAttributes>>16&I;i.unixMode===_&&16877&V&&(i.unixMode=V);const Z=!!(2048&i.unixMode),j=!!(1024&i.unixMode),K=!!(512&i.unixMode),G=40960==((i.unixMode===_?V:i.unixMode)&q),X=!G&&(i.unixMode!==_?!!(73&i.unixMode):y&&!!(73&V)),J=i.unixMode!==_&&16384==(i.unixMode&q),Q=16384==(V&q);n.assign(i,{setuid:Z,setgid:j,sticky:K,symlink:G,unixExternalUpper:V,internalFileAttribute:i.internalFileAttributes,externalFileAttribute:i.externalFileAttributes,executable:X,directory:J||Q||m&&C.directory||i.filename.endsWith("/"),zipCrypto:i.encrypted&&!i.extraFieldAES});const Y=new Hr(i);if(Y.getData=(t,n)=>i.getData(t,Y,e.Vt,n),Y.arrayBuffer=async t=>{const n=new x,r=tn(n.readable).then(t=>t.arrayBuffer());return r.catch(()=>{}),await i.getData(n,Y,e.Vt,t),r},$=v,s==O-1&&wt){const t=ss(nt,et,$);t&&(O+=t,zs(o,jr))}const{onprogress:tt}=t;if(tt)try{await tt(s+1,O,new Hr(i))}catch{}yield Y}let dt=$,ht=os(et.subarray($))||(ot?os(at):_);if(!ht&&!ot){const t=b+$,e=a.min(Q-t,65541);6>e||(ht=os(await zr(r,t,e)))}ht&&(e.digitalSignature=ht,dt=$+6+ht.length),($!=G&&dt!=G||!ot&&$!=g&&dt!=g)&&xs(c,o,"trailing central directory data"),ft&&xs(c,o,"duplicate filename");const pt=Ds(e,t,"extractPrependedData"),mt=Ds(e,t,"extractAppendedData"),yt=(c||pt)&&O&&4==F&&await(async t=>{const e=await hs(t);return e==M||808471376==e})(r)?4:0;return c&&(N||O&&F>yt)&&Rs(Gr),(N||O&&F>4)&&zs(o,Gr),pt&&(e.prependedData=F>yt?await zr(r,yt,F-yt):X),e.comment=S?await zr(r,v+H,S):X,mt&&(e.appendedData=k<r.size?await zr(r,k,r.size-k):X),!0}async getEntries(t={}){const e=[];for await(const n of this.getEntriesGenerator(t))e.push(n);return e}async close(){const{reader:t}=this;t.readUint8Array||!t.readable||t.readable.locked||await t.readable.cancel()}},t.configure=t=>{n.assign(it,lt(dt(t)))},t.inflateRaw=(t,e)=>Ht(t,{i:2},e&&e.Gt,e&&e.m)});
|
|
1
|
+
((t,e)=>{"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).zip={})})(this,function(t){"use strict";const{Array:e,Object:n,String:r,Number:s,BigInt:o,Math:a,Date:i,Map:c,Set:u,Response:f,URL:l,Error:w,Uint8Array:d,Uint16Array:h,Uint32Array:p,DataView:m,Blob:y,Promise:g,TextEncoder:b,TextDecoder:v,crypto:S,btoa:k,TransformStream:x,ReadableStream:z,WritableStream:R,CompressionStream:D,DecompressionStream:F,navigator:C,Worker:A,setTimeout:T,clearTimeout:U}="undefined"!=typeof globalThis?globalThis:this||self,E=4294967295,I=65535,W=255,M=134695760,O=M,L=33639248,P=101075792,B=117853008,H=22,V=20,Z=56,q=61440,N=new i(1980,0,1),_=void 0,j="undefined",K="function",G="string",X=new d,J="strict",Q="balanced",Y="tolerant";function $(t){if(t&&typeof t!=K)throw new w("Invalid option (must be a function)");return t}function tt(t){return typeof t==G&&t.trim()?s(t):t}let et=2;try{typeof C!=j&&C.hardwareConcurrency&&(et=C.hardwareConcurrency)}catch{}const nt={workerURI:"./core/web-worker-wasm.js",wasmURI:"./core/streams/zlib-wasm/zlib-streams.wasm",chunkSize:65536,maxWorkers:et,terminateWorkerTimeout:5e3,workerStarvationTimeout:5e3,workerStartupTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,transferStreams:!0,CompressionStream:typeof D!=j&&D,DecompressionStream:typeof F!=j&&F},rt="maxWorkers",st=["chunkSize",rt,"terminateWorkerTimeout","workerStarvationTimeout","workerStartupTimeout"],ot=["createWorker","CompressionStream","DecompressionStream","CompressionStreamFallback","DecompressionStreamFallback"],at=["baseURI","wasmURI","workerURI","useCompressionStream","useWebWorkers","transferStreams",...st,...ot],it={...nt};function ct(){return it}function ut(t){return ft(t.chunkSize)}function ft(t){return t=tt(t),s.isInteger(t)&&t>=1?a.max(t,64):65536}function lt(t){const e={};for(const n of at){const r=t[n];r!==_&&(e[n]=wt(n,r))}return e}function wt(t,e){if(st.includes(t)){if(e=tt(e),t==rt&&(!s.isInteger(e)||1>e))throw new w("Invalid maxWorkers (must be an integer greater than 0)")}else ot.includes(t)&&$(e);return e}function dt(t){t=t||{};const{CompressionStreamZlib:e,DecompressionStreamZlib:r}=t;if(e===_&&r===_)return t;const s=n.assign({},t);return s.CompressionStreamFallback===_&&(s.CompressionStreamFallback=e),s.DecompressionStreamFallback===_&&(s.DecompressionStreamFallback=r),s}var ht=d,pt=h,mt=Int32Array,yt=new ht([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]),gt=new ht([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]),bt=new ht([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),vt=(t,e)=>{for(var n=new pt(31),r=0;31>r;++r)n[r]=e+=1<<t[r-1];var s=new mt(n[30]);for(r=1;30>r;++r)for(var o=n[r];o<n[r+1];++o)s[o]=o-n[r]<<5|r;return{b:n,r:s}},St=vt(yt,2),kt=St.b,xt=St.r;kt[28]=258,xt[258]=28;for(var zt=vt(gt,0).b,Rt=new pt(32768),Dt=0;32768>Dt;++Dt){var Ft=(43690&Dt)>>1|(21845&Dt)<<1;Ft=(61680&(Ft=(52428&Ft)>>2|(13107&Ft)<<2))>>4|(3855&Ft)<<4,Rt[Dt]=((65280&Ft)>>8|(255&Ft)<<8)>>1}var Ct=(t,e,n)=>{for(var r=t.length,s=0,o=new pt(e);r>s;++s)t[s]&&++o[t[s]-1];var a,i=new pt(e);for(s=1;e>s;++s)i[s]=i[s-1]+o[s-1]<<1;if(n){a=new pt(1<<e);var c=15-e;for(s=0;r>s;++s)if(t[s])for(var u=s<<4|t[s],f=e-t[s],l=i[t[s]-1]++<<f,w=l|(1<<f)-1;w>=l;++l)a[Rt[l]>>c]=u}else for(a=new pt(r),s=0;r>s;++s)t[s]&&(a[s]=Rt[i[t[s]-1]++]>>15-t[s]);return a},At=new ht(288);for(Dt=0;144>Dt;++Dt)At[Dt]=8;for(Dt=144;256>Dt;++Dt)At[Dt]=9;for(Dt=256;280>Dt;++Dt)At[Dt]=7;for(Dt=280;288>Dt;++Dt)At[Dt]=8;var Tt=new ht(32);for(Dt=0;32>Dt;++Dt)Tt[Dt]=5;var Ut=Ct(At,9,1),Et=Ct(Tt,5,1),It=t=>{for(var e=t[0],n=1;n<t.length;++n)t[n]>e&&(e=t[n]);return e},Wt=(t,e,n)=>{var r=e/8|0;return(t[r]|t[r+1]<<8)>>(7&e)&n},Mt=(t,e)=>{var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(7&e)},Ot=t=>(t+7)/8|0,Lt=(t,e,n)=>((null==e||0>e)&&(e=0),(null==n||n>t.length)&&(n=t.length),new ht(t.subarray(e,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"],Bt=(t,e,n)=>{var r=new w(e||Pt[t]);if(r.code=t,w.captureStackTrace&&w.captureStackTrace(r,Bt),!n)throw r;return r},Ht=(t,e,n,r)=>{var s=t.length,o=r?r.length:0;if(!s||e.f&&!e.o)return n||new ht(0);var i=!n,c=i||2!=e.i,u=e.i;i&&(n=new ht(3*s));var f=t=>{var e=n.length;if(t>e){var r=new ht(a.max(2*e,t));r.set(n),n=r}},l=e.f||0,w=e.p||0,d=e.b||0,h=e.o,p=e.d,m=e.l,y=e.n,g=8*s;do{if(!h){l=Wt(t,w,1);var b=Wt(t,w+1,3);if(w+=3,!b){var v=t[(U=Ot(w)+4)-4]|t[U-3]<<8,S=U+v;if(S>s){u&&Bt(0);break}c&&f(d+v),n.set(t.subarray(U,S),d),e.b=d+=v,e.p=w=8*S,e.f=l;continue}if(1==b)h=Ut,p=Et,m=9,y=5;else if(2==b){var k=Wt(t,w,31)+257,x=Wt(t,w+10,15)+4,z=k+Wt(t,w+5,31)+1;w+=14;for(var R=new ht(z),D=new ht(19),F=0;x>F;++F)D[bt[F]]=Wt(t,w+3*F,7);w+=3*x;var C=It(D),A=(1<<C)-1,T=Ct(D,C,1);for(F=0;z>F;){var U,E=T[Wt(t,w,A)];if(w+=15&E,16>(U=E>>4))R[F++]=U;else{var I=0,W=0;for(16==U?(W=3+Wt(t,w,3),w+=2,I=R[F-1]):17==U?(W=3+Wt(t,w,7),w+=3):18==U&&(W=11+Wt(t,w,127),w+=7);W--;)R[F++]=I}}var M=R.subarray(0,k),O=R.subarray(k);m=It(M),y=It(O),h=Ct(M,m,1),p=Ct(O,y,1)}else Bt(1);if(w>g){u&&Bt(0);break}}c&&f(d+131072);for(var L=(1<<m)-1,P=(1<<y)-1,B=w;;B=w){var H=(I=h[Mt(t,w)&L])>>4;if((w+=15&I)>g){u&&Bt(0);break}if(I||Bt(2),256>H)n[d++]=H;else{if(256==H){B=w,h=null;break}var V=H-254;if(H>264){var Z=yt[F=H-257];V=Wt(t,w,(1<<Z)-1)+kt[F],w+=Z}var q=p[Mt(t,w)&P],N=q>>4;if(q||Bt(3),w+=15&q,O=zt[N],N>3&&(Z=gt[N],O+=Mt(t,w)&(1<<Z)-1,w+=Z),w>g){u&&Bt(0);break}c&&f(d+131072);var _=d+V;if(O>d){var j=o-O,K=a.min(O,_);for(0>j+d&&Bt(3);K>d;++d)n[d]=r[j+d]}for(;_>d;++d)n[d]=n[d-O]}}e.o=h,e.p=B,e.b=d,e.f=l,h&&(l=1,e.l=m,e.d=p,e.n=y)}while(!l);return d!=n.length&&i?Lt(n,0,d):n.subarray(0,d)},Vt=new ht(0),Zt=function(){function t(t,e){"function"==typeof t&&(e=t,t={}),this.h=e;var n=t&&t.m&&t.m.subarray(-32768);this.s={i:0,b:n?n.length:0},this.v=new ht(32768),this.p=new ht(0),n&&this.v.set(n)}return t.prototype.e=function(t){if(this.h||Bt(5),this.d&&Bt(4),this.p.length){if(t.length){var e=new ht(this.p.length+t.length);e.set(this.p),e.set(t,this.p.length),this.p=e}}else this.p=t},t.prototype.c=function(t){this.s.i=+(this.d=t||!1);var e=this.s.b,n=Ht(this.p,this.s,this.v);this.h(Lt(n,e,this.s.b),this.d),this.v=Lt(n,this.s.b-32768),this.s.b=this.v.length,this.p=Lt(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(t,e){this.e(t),this.c(e)},t}(),qt=void 0!==v&&new v;try{qt.decode(Vt,{stream:!0})}catch(t){}class Nt extends x{constructor(t){super({start(e){t.h=t=>{t.length&&e.enqueue(t)}},transform(e){t.push(e)},flush(){t.push(new d(0),!0)}})}}const _t=new c,jt=new c;function Kt(t){return jt.get(t)}const Gt=[[],[],[],[],[],[],[],[]];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;Gt[0][t]=e}for(let t=0;256>t;t++)for(let e=1;8>e;e++){const n=Gt[e-1][t];Gt[e][t]=n>>>8^Gt[0][255&n]}const[Xt,Jt,Qt,Yt,$t,te,ee,ne]=Gt;class re{constructor(t){this.S=t||-1}append(t){let e=0|this.S;const n=0|t.length;let r=0;if(n>=8&&t.buffer){const s=new m(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=ne[255&t]^ee[t>>>8&255]^te[t>>>16&255]^$t[t>>>24&255]^Yt[255&n]^Qt[n>>>8&255]^Jt[n>>>16&255]^Xt[n>>>24&255]}}for(;n>r;r++)e=e>>>8^Xt[255&(e^t[r])];this.S=e}get(){return~this.S}}class se extends x{constructor(){let t;const e=new re;super({transform(t,n){e.append(t),n.enqueue(t)},flush(){const n=new d(4);new m(n.buffer).setUint32(0,e.get()),t.value=n}}),t=this}}function oe(t,e){const n=new d(t.length+e.length);return n.set(t),n.set(e,t.length),n}function ae(t){return new m(t.buffer,t.byteOffset,t.byteLength)}const ie={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const n=t[t.length-1],r=ie.R(n);return 32===r?t.concat(e):ie.D(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)+ie.R(n)},F(t,e){if(32*t.length<e)return t;const n=(t=t.slice(0,a.ceil(e/32))).length;return e&=31,n>0&&e&&(t[n-1]=ie.C(e,t[n-1]&2147483648>>e-1,1)),t},C:(t,e,n)=>32===t?e:(n?0|e:e<<32-t)+1099511627776*t,R:t=>a.round(t/1099511627776)||32,D(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=ie.R(s);return r.push(ie.C(e+o&31,e+o>32?n:r.pop(),1)),r}},ce={bytes:{A(t){const e=ie.bitLength(t)/8,n=new d(e);let r;for(let s=0;e>s;s++)3&s||(r=t[s/4]),n[s]=r>>>24,r<<=8;return n},T(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(ie.C(8*(3&n),r)),e}}},ue=class{constructor(t){const e=this;e.blockSize=512,e.U=[1732584193,4023233417,2562383102,271733878,3285377520],e.I=[1518500249,1859775393,2400959708,3395469782],t?(e.W=t.W.slice(0),e.M=t.M.slice(0),e.O=t.O):e.reset()}reset(){const t=this;return t.W=t.U.slice(0),t.M=[],t.O=0,t}update(t){const e=this;"string"==typeof t&&(t=ce.L.T(t));const n=e.M=ie.concat(e.M,t),r=e.O,s=e.O=r+ie.bitLength(t);if(s>9007199254740991)throw new w("Cannot hash more than 2^53 - 1 bits");const o=new p(n);let a=0;for(let t=e.blockSize+r-(e.blockSize+r&e.blockSize-1);s>=t;t+=e.blockSize)e.P(o.subarray(16*a,16*(a+1))),a+=1;return n.splice(0,16*a),e}B(){const t=this;let e=t.M;const n=t.W;e=ie.concat(e,[ie.C(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(a.floor(t.O/4294967296)),e.push(0|t.O);e.length;)t.P(e.splice(0,16));return t.reset(),n}H(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}V(t,e){return e<<t|e>>>32-t}P(t){const n=this,r=n.W,s=e(80);for(let e=0;16>e;e++)s[e]=t[e];let o=r[0],i=r[1],c=r[2],u=r[3],f=r[4];for(let t=0;79>=t;t++){16>t||(s[t]=n.V(1,s[t-3]^s[t-8]^s[t-14]^s[t-16]));const e=n.V(5,o)+n.H(t,i,c,u)+f+s[t]+n.I[a.floor(t/20)]|0;f=u,u=c,c=n.V(30,i),i=o,o=e}r[0]=r[0]+o|0,r[1]=r[1]+i|0,r[2]=r[2]+c|0,r[3]=r[3]+u|0,r[4]=r[4]+f|0}},fe={importKey:t=>new fe.Z(ce.bytes.T(t)),N(t,e,n,r){if(n=n||1e4,0>r||0>n)throw new w("invalid params to pbkdf2");const s=1+(r>>5)<<2;let o,a,i,c,u;const f=new ArrayBuffer(s),l=new m(f);let d=0;const h=ie;for(e=ce.bytes.T(e),u=1;(s||1)>d;u++){for(o=a=t.encrypt(h.concat(e,[u])),i=1;n>i;i++)for(a=t.encrypt(a),c=0;c<a.length;c++)o[c]^=a[c];for(i=0;(s||1)>d&&i<o.length;i++)l.setInt32(d,o[i]),d+=4}return f.slice(0,r/8)},Z:class{constructor(t){const e=this,n=e._=ue,r=[[],[]];e.j=[new n,new n];const s=e.j[0].blockSize/32;t.length>s&&(t=(new n).update(t).B());for(let e=0;s>e;e++)r[0][e]=909522486^t[e],r[1][e]=1549556828^t[e];e.j[0].update(r[0]),e.j[1].update(r[1]),e.K=new n(e.j[0])}reset(){const t=this;t.K=new t._(t.j[0]),t.G=!1}update(t){this.G=!0,this.K.update(t)}digest(){const t=this,e=t.K.B(),n=new t._(t.j[1]).update(e).B();return t.reset(),n}encrypt(t){if(this.G)throw new w("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},le=typeof S!=j&&typeof S.getRandomValues==K,we="Invalid password",de="Invalid signature",he=de,pe="zipjs-abort-check-password";function me(t){if(le)return S.getRandomValues(t);throw new w("Crypto API not supported")}const ye=16,ge={name:"PBKDF2"},be=n.assign({hash:{name:"HMAC"}},ge),ve=n.assign({iterations:1e3,hash:{name:"SHA-1"}},ge),Se=["deriveBits"],ke=[8,12,16],xe=[16,24,32],ze=10,Re=[0,0,0,0],De=typeof S!=j,Fe=De&&S.subtle,Ce=De&&typeof Fe!=j,Ae=ce.bytes,Te=class{constructor(t){const e=this;e.X=[[[],[],[],[],[]],[[],[],[],[],[]]],e.X[0][0][0]||e.J();const n=e.X[0][4],r=e.X[1],s=t.length;let o,a,i,c=1;if(4!==s&&6!==s&&8!==s)throw new w("invalid aes key size");for(e.I=[a=t.slice(0),i=[]],o=s;4*s+28>o;o++){let t=a[o-1];(o%s===0||8===s&&o%s===4)&&(t=n[t>>>24]<<24^n[t>>16&255]<<16^n[t>>8&255]<<8^n[255&t],o%s===0&&(t=t<<8^t>>>24^c<<24,c=c<<1^283*(c>>7))),a[o]=a[o-s]^t}for(let t=0;o;t++,o--){const e=a[3&t?o:o-4];i[t]=4>=o||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.Y(t,0)}decrypt(t){return this.Y(t,1)}J(){const t=this.X[0],e=this.X[1],n=t[4],r=e[4],s=[],o=[];let a,i,c,u;for(let t=0;256>t;t++)o[(s[t]=t<<1^283*(t>>7))^t]=t;for(let f=a=0;!n[f];f^=i||1,a=o[a]||1){let o=a^a<<1^a<<2^a<<3^a<<4;o=o>>8^255&o^99,n[f]=o,r[o]=f,u=s[c=s[i=s[f]]];let l=16843009*u^65537*c^257*i^16843008*f,w=257*s[o]^16843008*o;for(let n=0;4>n;n++)t[n][f]=w=w<<24^w>>>8,e[n][o]=l=l<<24^l>>>8}for(let n=0;5>n;n++)t[n]=t[n].slice(0),e[n]=e[n].slice(0)}Y(t,e){if(4!==t.length)throw new w("invalid aes block size");const n=this.I[e],r=n.length/4-2,s=[0,0,0,0],o=this.X[e],a=o[0],i=o[1],c=o[2],u=o[3],f=o[4];let l,d,h,p=t[0]^n[0],m=t[e?3:1]^n[1],y=t[2]^n[2],g=t[e?1:3]^n[3],b=4;for(let t=0;r>t;t++)l=a[p>>>24]^i[m>>16&255]^c[y>>8&255]^u[255&g]^n[b],d=a[m>>>24]^i[y>>16&255]^c[g>>8&255]^u[255&p]^n[b+1],h=a[y>>>24]^i[g>>16&255]^c[p>>8&255]^u[255&m]^n[b+2],g=a[g>>>24]^i[p>>16&255]^c[m>>8&255]^u[255&y]^n[b+3],b+=4,p=l,m=d,y=h;for(let t=0;4>t;t++)s[e?3&-t:t]=f[p>>>24]<<24^f[m>>16&255]<<16^f[y>>8&255]<<8^f[255&g]^n[b++],l=p,p=m,m=y,y=g,g=l;return s}},Ue=class{constructor(t,e){this.$=t,this.et=e,this.nt=e}reset(){this.nt=this.et}update(t){return this.st(this.$,t,this.nt)}ot(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}it(t){0===(t[0]=this.ot(t[0]))&&(t[1]=this.ot(t[1]))}st(t,e,n){let r;if(!(r=e.length))return[];const s=ie.bitLength(e);for(let s=0;r>s;s+=4){this.it(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 ie.F(e,s)}},Ee=fe.Z;let Ie=De&&Ce&&typeof Fe.importKey==K,We=De&&Ce&&typeof Fe.deriveBits==K;class Me extends x{constructor({password:t,rawPassword:e,encryptionStrength:n,checkPasswordOnly:r,checkAuthenticationCode:s=!0}){super({start(){Le(this,t,e,n)},async transform(t,e){const n=this,{password:s,strength:o,ct:a,ready:i}=n;s?(await(async(t,e,n,r)=>{const s=await Be(t,e,n,Ve(r,0,ke[e])),o=Ve(r,ke[e]);if(s[0]!=o[0]||s[1]!=o[1])throw new w(we)})(n,o,s,Ve(t,0,ke[o]+2)),t=Ve(t,ke[o]+2),r?e.error(new w(pe)):a()):await i;const c=new d(t.length-ze-(t.length-ze)%ye);e.enqueue(Pe(n,t,c,0,ze,!0))},async flush(t){const{ut:e,ft:n,lt:r,ready:o}=this;if(n&&e){await o;const a=Ve(r,0,r.length-ze),i=Ve(r,r.length-ze);let c=X;if(a.length){const t=qe(Ae,a);n.update(t);const r=e.update(t);c=Ze(Ae,r)}const u=Ve(Ze(Ae,n.digest()),0,ze);let f=r.length<ze?1:0;for(let t=0;ze>t;t++)f|=u[t]^i[t];if(f&&s)throw new w(he);t.enqueue(c)}}})}}class Oe extends x{constructor({password:t,rawPassword:e,encryptionStrength:n}){super({start(){Le(this,t,e,n)},async transform(t,e){const n=this,{password:r,strength:s,ct:o,ready:a}=n;let i=X;r?(i=await(async(t,e,n)=>{const r=me(new d(ke[e]));return oe(r,await Be(t,e,n,r))})(n,s,r),o()):await a;const c=new d(i.length+t.length-t.length%ye);c.set(i,0),e.enqueue(Pe(n,t,c,i.length,0))},async flush(t){const{ut:e,ft:n,lt:r,ready:s}=this;if(n&&e){await s;let o=X;if(r.length){const t=e.update(qe(Ae,r));n.update(t),o=Ze(Ae,t)}const a=Ze(Ae,n.digest()).slice(0,ze);t.enqueue(oe(o,a))}}})}}function Le(t,e,r,s){n.assign(t,{ready:new g(e=>t.ct=e),password:He(e,r),strength:s-1,lt:X})}function Pe(t,e,n,r,s,o){const{ut:a,ft:i,lt:c}=t;c.length&&(e=oe(c,e));const u=e.length-s;let f;for(n=((t,e)=>{if(e&&e>t.length){const n=t;(t=new d(e)).set(n,0)}return t})(n,r+(u-u%ye)),f=0;u-ye>=f;f+=ye){const t=qe(Ae,Ve(e,f,f+ye));o&&i.update(t);const s=a.update(t);o||i.update(s),n.set(Ze(Ae,s),f+r)}return t.lt=Ve(e,f),n}async function Be(t,r,s,o){t.password=null;const a=await(async(t,e,n,r,s)=>{if(!Ie)return fe.importKey(e);try{return await Fe.importKey("raw",e,n,!1,s)}catch{return Ie=!1,fe.importKey(e)}})(0,s,be,0,Se),i=await(async(t,e,n)=>{if(!We)return fe.N(e,t.salt,ve.iterations,n);try{return await Fe.deriveBits(t,e,n)}catch{return We=!1,fe.N(e,t.salt,ve.iterations,n)}})(n.assign({salt:o},ve),a,8*(2*xe[r]+2)),c=new d(i),u=qe(Ae,Ve(c,0,xe[r])),f=qe(Ae,Ve(c,xe[r],2*xe[r])),l=Ve(c,2*xe[r]);return n.assign(t,{keys:{key:u,wt:f,passwordVerification:l},ut:new Ue(new Te(u),e.from(Re)),ft:new Ee(f)}),l}function He(t,e){return e===_?(t=>{if(typeof b==j){const e=new d((t=unescape(encodeURIComponent(t))).length);for(let n=0;n<e.length;n++)e[n]=t.charCodeAt(n);return e}return(new b).encode(t)})(t):e}function Ve(t,e,n){return t.subarray(e,n)}function Ze(t,e){return t.A(e)}function qe(t,e){return t.T(e)}class Ne extends x{constructor({password:t,rawPassword:e,passwordVerification:n,checkPasswordOnly:r}){super({start(){je(this,t,e,n)},transform(t,e){const n=this;if(n.password||n.rawPassword){const e=Ke(n,t.subarray(0,12));if(n.password=n.rawPassword=null,0!=(e[11]^n.passwordVerification))throw new w(we);t=t.subarray(12)}r?e.error(new w(pe)):e.enqueue(Ke(n,t))}})}}class _e extends x{constructor({password:t,rawPassword:e,passwordVerification:n}){super({start(){je(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=me(new d(12));e[11]=n.passwordVerification,r=new d(t.length+e.length),r.set(Ge(n,e),0),s=12}else r=new d(t.length),s=0;r.set(Ge(n,t),s),e.enqueue(r)}})}}function je(t,e,r,s){n.assign(t,{password:e,rawPassword:r,passwordVerification:s}),((t,e,r)=>{const s=[305419896,591751049,878082192];if(n.assign(t,{keys:s,ht:new re(s[0]),yt:new re(s[2])}),r)for(let e=0;e<r.length;e++)Xe(t,r[e]);else for(let n=0;n<e.length;n++)Xe(t,e.charCodeAt(n))})(t,e,r)}function Ke(t,e){const n=new d(e.length);for(let r=0;r<e.length;r++)n[r]=Je(t)^e[r],Xe(t,n[r]);return n}function Ge(t,e){const n=new d(e.length);for(let r=0;r<e.length;r++)n[r]=Je(t)^e[r],Xe(t,e[r]);return n}function Xe(t,e){let[,n]=t.keys;t.ht.append([e]);const r=~t.ht.get();n=Ye(a.imul(Ye(n+Qe(r)),134775813)+1),t.yt.append([n>>>24]);const s=~t.yt.get();t.keys=[r,n,s]}function Je(t){const e=2|t.keys[2];return Qe(a.imul(e,1^e)>>>8)}function Qe(t){return 255&t}function Ye(t){return 4294967295&t}function $e(t){if(t instanceof z)return t;const e=t.getReader();return new z({async pull(t){const{value:n,done:r}=await e.read();r?t.close():t.enqueue(n)},cancel:t=>e.cancel(t)})}function tn(t,e){t=$e(t);const n=e?{type:e}:{};if(typeof y.prototype.stream!=K||new y([]).stream()instanceof z)return new f(t).blob().then(t=>e?new y([t],n):t);const r=[];return t.pipeTo(new R({write(t){r.push(t)}})).then(()=>new y(r,n))}function en(t){if(t instanceof R)return t;const e=t.getWriter();return new R({write:t=>e.write(t),close:()=>e.close(),abort:t=>e.abort(t)})}const nn="Invalid uncompressed size",rn=de,sn="deflate-raw",on="gzip",an=[31,139,8];class cn extends x{constructor(t,{chunkSize:e,CompressionStreamFallback:n,CompressionStream:r}){super({});const{compressed:s,encrypted:o,useCompressionStream:a,zipCrypto:i,computeCrc32:c,level:u,deflate64:f,format:l,compressionMethod:w,inputSize:d}=t,h=this;let p,y,g,b=super.readable;const v=l&&Kt(l),S=c&&s&&!f&&!v&&(!o||i)&&!(!a||!r);if(o&&!i||!c||S||(p=new se,b=pn(b,p)),s)if(v)b=mn(b,dn(v.CompressionStream,l,{level:u,chunkSize:e,compressionMethod:w,uncompressedSize:d}));else if(S)g=new un,b=mn(b,new r(on)),b=pn(b,g);else try{b=hn(b,a,{level:u,chunkSize:e},r,n)}catch(t){let e;try{e=new r(on)}catch{throw t}b=mn(b,e),b=pn(b,new un)}o&&(i?b=pn(b,new _e(t)):(y=new Oe(t),b=pn(b,y))),wn(h,b,()=>{o&&!i||!c||(h.crc32=S?g.crc32:new m(p.value.buffer).getUint32(0))})}}class un extends x{constructor(){let t,e=10,n=new d(0);super({transform(t,r){if(e){const n=a.min(e,t.length);if(e-=n,!(t=t.subarray(n)).length)return}const s=n.length+t.length;if(8>=s)return void(n=oe(n,t));const o=s-8,i=a.min(o,n.length);r.enqueue(oe(n.subarray(0,i),t.subarray(0,o-i))),n=oe(n.subarray(i),t.subarray(o-i))},flush(){const e=ae(n);t.crc32=e.getUint32(0,!0),t.uncompressedSize=e.getUint32(4,!0)}}),t=this}}class fn extends x{constructor(t,{chunkSize:e,DecompressionStreamFallback:n,DecompressionStream:r}){super({});const{zipCrypto:s,encrypted:o,checkCrc32:a,crc32:i,compressed:c,useCompressionStream:u,deflate64:f,format:l,compressionMethod:h,rawBitFlag:p,outputSize:y}=t;let b,v,S=super.readable;if(o&&(s?S=pn(S,new Ne(t)):(v=new Me(t),S=pn(S,v))),c){const t=l&&Kt(l);if(t)S=mn(S,dn(t.DecompressionStream,l,{chunkSize:e,compressionMethod:h,rawBitFlag:p,uncompressedSize:y}));else try{S=hn(S,u,{chunkSize:e,deflate64:f},r,n)}catch(t){if(f||y===_)throw t;let e;try{e=new r(on)}catch{throw t}S=((t,e,n)=>{const r=new re;let s,o,a,i=0,c=!1;const u=new g((t,e)=>{o=t,a=e});u.catch(()=>{}),n||o();const f=new x({start(t){const e=new d(10);e.set(an),t.enqueue(e)},transform(t,e){e.enqueue(t)},async flush(t){c=!0,h();try{await u}finally{p()}const e=new d(8),s=ae(e);s.setUint32(0,r.get(),!0),s.setUint32(4,n,!0),t.enqueue(e)},cancel(t){a(t)}}),l=new x({transform(t,e){r.append(t),i+=t.length,n>i?c&&h():o(),e.enqueue(t)},cancel(t){a(t)}});return t=pn(t,f),pn(t=mn(t,e),l);function h(){p(),s=T(()=>a(new w(nn)),5e3)}function p(){U(s)}})(S,e,y)}S=(t=>{const e=t.getReader();return new z({async pull(t){let n;try{n=await e.read()}catch(t){if(t&&t.message)throw t;const e=new w("Invalid compressed data");throw e.cause=t,e}const{value:r,done:s}=n;s?t.close():t.enqueue(r)},cancel:t=>e.cancel(t)})})(S)}a&&(b=new se,S=pn(S,b)),wn(this,S,()=>{if(a){const t=new m(b.value.buffer);if(i!=t.getUint32(0,!1))throw new w(rn)}})}}const ln=new c;function wn(t,e,r){e=pn(e,new x({flush:r})),n.defineProperty(t,"readable",{get:()=>e})}function dn(t,e,n){if(!t)throw new w("Compression method not supported");return new t(e,n)}function hn(t,e,n,r,s){const o=e&&r?r:s||r,a=n.deflate64?"deflate64-raw":sn;let i;try{i=new o(a,n)}catch(t){if(!e||!s||o==s)throw t;i=new s(a,n)}return mn(t,i)}function pn(t,e){return $e(t).pipeThrough(e)}function mn(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 yn="deflate",gn="inflate";class bn extends x{constructor(t,e){super({});const r=this,{codecType:s}=t;let o;s.startsWith(yn)?o=cn:s.startsWith(gn)&&(o=fn),r.outputSize=0;let a=0;const i=new o(t,e),c=super.readable,u=new x({transform(t,e){t&&t.length&&(a+=t.length,e.enqueue(t))},flush(){n.assign(r,{inputSize:a})}}),f=new x({transform(e,n){if(e&&e.length&&(n.enqueue(e),r.outputSize+=e.length,t.outputSize!==_&&r.outputSize>t.outputSize))throw new w(nn)},flush(){const{crc32:t}=i;n.assign(r,{crc32:t,inputSize:a})}});n.defineProperty(r,"readable",{get:()=>c.pipeThrough(u).pipeThrough(i).pipeThrough(f)})}}class vn extends x{constructor(t){const e=[];let n=0;function r(){const r=new d(t);let s=0;for(;t>s;){const n=e[0],o=t-s;n.length>o?(r.set(n.subarray(0,o),s),e[0]=n.subarray(o),s+=o):(r.set(n,s),s+=n.length,e.shift())}return n-=t,r}s.isFinite(t)&&t>=1||(t=65536),super({transform(s,o){for(e.push(s),n+=s.length;n>t;)o.enqueue(r())},flush(t){n&&t.enqueue(((t,e)=>{const n=new d(e);let r=0;for(const e of t)n.set(e,r),r+=e.length;return n})(e,n))}})}}class Sn{constructor(t,{readable:e,writable:r},{options:s,config:o,gt:a,useWebWorkers:i,transferStreams:u,workerURI:f,createWorker:l},w){const{signal:d}=a;return n.assign(t,{bt:!0,vt:(t.vt||0)+1,readable:e.pipeThrough(new vn(ut(o))).pipeThrough(new kn(a),{signal:d}),writable:r,options:n.assign({},s),workerURI:f,createWorker:l,transferStreams:u,terminate:()=>new g(e=>{const{St:n,bt:r}=t;n?(r?t.kt=e:(n.terminate(),e()),t.xt=null):e()}),zt(){if(t.bt){const{kt:e}=t;e&&(t.kt=null,t.Rt=!0,t.St.terminate(),e()),t.bt=!1,w(t)}}}),((t,e)=>({run:()=>(async({options:t,readable:e,writable:n,zt:r},s)=>{let o;try{if(t.compressed&&!t.format){const e=t.codecType.startsWith(yn),n=e?s.CompressionStreamFallback:s.DecompressionStreamFallback,r=e?s.CompressionStream:s.DecompressionStream;if(t.useCompressionStream){if(n&&n.Dt&&!((t,e)=>{if(!t)return!1;let n=ln.get(t);n||(n=new c,ln.set(t,n));let r=n.get(e);if(r===_){try{new t(e),r=!0}catch{r=!1}n.set(e,r)}return r})(r,sn))try{await void 0}catch{}}else try{await void 0}catch{n&&!n.Dt||(t.useCompressionStream=!0)}}o=new bn(t,s),await e.pipeThrough(o).pipeThrough(new vn(ut(s))).pipeTo(n,{preventClose:!0,preventAbort:!0});const{crc32:r,inputSize:a,outputSize:i}=o;return{crc32:r,inputSize:a,outputSize:i}}catch(t){throw o&&(t.outputSize=o.outputSize),t}finally{r()}})(t,e)}))(t,o)}}class kn extends x{constructor({onstart:t,onprogress:e,size:n,onend:r}){let s=0;super({async start(){t&&await xn(t,n)},async transform(t,r){s+=t.length,e&&await xn(e,s,n),r.enqueue(t)},async flush(){r&&await xn(r,s)}})}}async function xn(t,...e){try{await t(...e)}catch{}}let zn=[];const Rn=[];let Dn,Fn,Cn=0;function An(){!Dn&&Rn.length&&s.isFinite(Fn)&&Fn>=0&&(Dn=T(Un,Fn))}function Tn(){Dn&&(U(Dn),Dn=null)}function Un(){if(Dn=null,Rn.length){const[{resolve:t,stream:e,Ft:r}]=Rn.splice(0,1),s=n.assign({},r,{useWebWorkers:!1,workerURI:_,createWorker:_});t(new Sn({},e,s,En)),An()}}function En(){Tn(),An()}function In(t){const{Ct:e}=t;e&&(U(e),t.Ct=null)}const Wn="\0\u263a\u263b\u2665\u2666\u2663\u2660\u2022\u25d8\u25cb\u25d9\u2642\u2640\u266a\u266b\u263c\u25ba\u25c4\u2195\u203c\xb6\xa7\u25ac\u21a8\u2191\u2193\u2192\u2190\u221f\u2194\u25b2\u25bc !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u2302\xc7\xfc\xe9\xe2\xe4\xe0\xe5\xe7\xea\xeb\xe8\xef\xee\xec\xc4\xc5\xc9\xe6\xc6\xf4\xf6\xf2\xfb\xf9\xff\xd6\xdc\xa2\xa3\xa5\u20a7\u0192\xe1\xed\xf3\xfa\xf1\xd1\xaa\xba\xbf\u2310\xac\xbd\xbc\xa1\xab\xbb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\xdf\u0393\u03c0\u03a3\u03c3\xb5\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u03c6\u03b5\u2229\u2261\xb1\u2265\u2264\u2320\u2321\xf7\u2248\xb0\u2219\xb7\u221a\u207f\xb2\u25a0\xa0".split("");function Mn(t,e){return On(t,e,!0)}function On(t,e,n){return e&&"cp437"==e.trim().toLowerCase()?(t=>{{let e="";for(let n=0;n<t.length;n++)e+=Wn[t[n]];return e}})(t):new v(e,{ignoreBOM:n}).decode(t)}const Ln="HTTP error ",Pn="HTTP Range not supported",Bn="HTTP resource changed",Hn="Content-Range",Vn="Range",Zn="GET",qn="bytes",Nn=16777216,_n="writable",jn=Symbol();class Kn{constructor(){this.size=0}init(){this.initialized=!0}}class Gn extends Kn{get readable(){return this.createReadable()}createReadable({offset:t=0,size:e,chunkSize:n=ut(ct())}={}){const r=this;let s=0;return n=ft(n),new z({async pull(o){const i=e===_?n:a.min(n,e-s),c=await zr(r,t+s,i);c.length&&o.enqueue(c),s+n>=e||!c.length&&i?o.close():s+=n}})}}class Xn extends Kn{constructor(){super();const t=this,e=new R({write(e){if(!t.initialized)throw new w("Writer not initialized");return t.writeUint8Array((n=e).byteOffset||n.byteLength!=n.buffer.byteLength?new d(n):n);var n}});n.defineProperty(t,_n,{get:()=>e})}writeUint8Array(){}}let Jn,Qn;class Yn extends Gn{constructor(t){super(),n.assign(this,{At:t,size:t.size}),Qn||(Qn=(async()=>{try{const t=new y([new d(3)]).slice(1,2).stream().getReader();let e=0,n=await t.read();for(;!n.done;)e+=n.value.length,n=await t.read();Jn=1==e}catch{Jn=!1}})())}createReadable(t){const{At:e,size:n}=this,{offset:r=0,size:s=n-r}=t||{};return r||n>s?Jn?$e(e.slice(r,r+s).stream()):super.createReadable(t):$e(e.stream())}async readUint8Array(t,e){const n=this,r=t+e,s=t||r<n.size?n.At.slice(t,r):n.At;let o=await s.arrayBuffer();return o.byteLength>e&&(o=o.slice(t,r)),new d(o)}}class $n extends Kn{constructor(t){super();const e=this,r=new x;n.defineProperty(e,_n,{get:()=>r.writable}),e.contentType=t,e.Tt=tn(r.readable,t),e.Tt.catch(()=>{})}getData(){return this.Tt}}class tr extends Gn{constructor(t,e){super(),nr(this,t,e)}async init(){await rr(this,pr,lr),super.init()}createReadable(t){const e=this,{useRangeHeader:n,forceRangeRequests:r,size:o}=e;if((n||r)&&o!==_){const{offset:n=0,size:r=o-n}=t||{};if(r>0&&o>n)return((t,e,n)=>{let r,o=e,i=0,c=n;return new z({start:()=>u(),async pull(t){r||await u();const{value:e,done:n}=await r.read();if(n)throw new w(Pn);const s=e.length>i?e.subarray(0,i):e;i-=s.length,c-=s.length,s.length&&t.enqueue(s),i||(await(async()=>{const t=r;r=_,await t.cancel()})(),c||t.close())},cancel:t=>r&&r.cancel(t)});async function u(){const e=a.min(t.maximumRangeSize,c),n=await pr(Zn,t,ur(t,o,e));if(206!=n.status)throw new w(Pn);const u=n.headers.get(Hn);if(u){const t=s(u.trim().split(/[\s-]+/)[1]);if(!s.isNaN(t)&&t!=o)throw new w(Pn)}cr(t,n),ir(t,n),o+=e,i=e,r=n.body.getReader()}})(e,n,a.min(r,o-n))}return super.createReadable(t)}readUint8Array(t,e){return sr(this,t,e,pr,lr)}}class er extends Gn{constructor(t,e){super(),nr(this,t,e)}async init(){await rr(this,mr,wr),super.init()}readUint8Array(t,e){return sr(this,t,e,mr,wr)}}function nr(t,e,r){const{preventHeadRequest:s,useRangeHeader:o,forceRangeRequests:a,combineSizeEocd:i,checkResourceChanges:c=!0,maximumRangeSize:u=Nn,fetch:f}=r;delete(r=n.assign({},r)).preventHeadRequest,delete r.useRangeHeader,delete r.forceRangeRequests,delete r.combineSizeEocd,delete r.checkResourceChanges,delete r.maximumRangeSize,delete r.useXHR,delete r.fetch,n.assign(t,{url:e,options:r,preventHeadRequest:s,useRangeHeader:o,forceRangeRequests:a,combineSizeEocd:i,checkResourceChanges:c,maximumRangeSize:u,fetch:f})}async function rr(t,e,n){const{url:r,preventHeadRequest:s,useRangeHeader:o,forceRangeRequests:a,combineSizeEocd:i}=t;if((t=>{const{baseURI:e}=ct(),{protocol:n}=new l(t,e);return"http:"==n||"https:"==n})(r)&&(o||a)&&(typeof s==j||s)){const r=await e(Zn,t,ur(t,i?-22:void 0)),s=r.headers.get("Accept-Ranges");if(!(a||s&&s.toLowerCase()==qn))throw new w(Pn);{if(i){const e=new d(await r.arrayBuffer());206==r.status&&e.length==H&&(t.Ut=e)}ir(t,r);const s=or(r);s===_?await hr(t,e,n):t.size=s}}else await hr(t,e,n)}async function sr(t,e,n,r,o){const{useRangeHeader:a,forceRangeRequests:i,Ut:c,size:u,options:f}=t;if(a||i){if(c&&e==u-H&&n==H)return c;if(u>e&&0!==n){e+n>u&&(n=u-e);const o=await r(Zn,t,ur(t,e,n));if(206!=o.status)throw new w(Pn);const a=o.headers.get(Hn);if(a){const t=s(a.trim().split(/[\s-]+/)[1]);if(!s.isNaN(t)&&t!=e)throw new w(Pn)}cr(t,o),ir(t,o);const i=new d(await o.arrayBuffer());if(i.length!=n)throw new w(Pn);return i}return X}{const{data:r}=t;return r||await o(t,f),t.data.subarray(e,e+n)}}function or(t){const e=t.headers.get(Hn);if(e){const t=e.trim().split(/\s*\/\s*/)[1];if(t&&"*"!=t){const e=s(t);if(!s.isNaN(e))return e}}}function ar({headers:t}){return{Et:t.get("Etag")||_,lastModified:t.get("Last-Modified")||_}}function ir(t,e){const{checkResourceChanges:n,It:r}=t;n&&!r&&206==e.status&&(t.It=ar(e))}function cr(t,e){const{checkResourceChanges:r,It:s,size:o}=t;if(r){const t=or(e);if(t!==_&&o!==_&&t!=o)throw new w(Bn);if(s){const t=ar(e);if(n.entries(s).some(([e,n])=>n!==_&&t[e]!==_&&n!=t[e]))throw new w(Bn)}}}function ur(t,e=0,r=1){return n.assign({},fr(t),{[Vn]:qn+"="+(0>e?e:e+"-"+(e+r-1))})}function fr({options:t}){const{headers:e}=t;if(e)return Symbol.iterator in e?n.fromEntries(e):e}async function lr(t){await dr(t,pr)}async function wr(t){await dr(t,mr)}async function dr(t,e){const n=await e(Zn,t,fr(t));t.data=new d(await n.arrayBuffer()),t.size=t.data.length}async function hr(t,e,n){if(t.preventHeadRequest)await n(t,t.options);else{const r=await e("HEAD",t,fr(t)),o=r.headers.get("Content-Length");o&&!r.headers.get("Content-Encoding")?t.size=s(o):await n(t,t.options)}}async function pr(t,{fetch:e=fetch,options:r,url:s},o){const a=await e(s,n.assign({},r,{method:t,headers:o}));if(400>a.status)return a;throw 416==a.status?new w(Pn):new w(Ln+(a.statusText||a.status))}function mr(t,{url:e},r){return new g((s,o)=>{const a=new XMLHttpRequest;if(a.addEventListener("load",()=>{if(400>a.status){const t=[];a.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(e=>{const n=e.trim().split(/\s*:\s*/);n[0]=n[0].trim().replace(/^[a-z]|-[a-z]/g,t=>t.toUpperCase()),t.push(n)}),s({status:a.status,arrayBuffer:()=>a.response,headers:new c(t)})}else o(416==a.status?new w(Pn):new w(Ln+(a.statusText||a.status)))},!1),a.addEventListener("error",t=>o(t.detail?t.detail.error:new w("Network error")),!1),a.open(t,e),r)for(const t of n.entries(r))a.setRequestHeader(t[0],t[1]);a.responseType="arraybuffer",a.send()})}class yr extends Gn{constructor(t,e={}){super(),n.assign(this,{url:t,reader:e.useXHR&&!e.fetch?new er(t,e):new tr(t,e)})}set size(t){}get size(){return this.reader.size}async init(){await this.reader.init(),super.init()}createReadable(t){return this.reader.createReadable(t)}readUint8Array(t,e){return this.reader.readUint8Array(t,e)}}class gr extends Gn{constructor(t){super(),this.Wt=t}async init(){const t=this;t.Mt=0;const e=t.Wt=await g.all(t.Wt.map(xr));t.Ot=e.map(e=>{const n=t.size;return t.size+=e.size,n}),super.init()}Lt(t){const{Ot:e,size:n}=this,r=e[t];return r===_?n:r}async readUint8Array(t,e){const n=this,{Wt:r}=this;let s,o=0,i=t;for(;r[o]&&i>=r[o].size;)i-=r[o].size,o++;const c=r[o];if(c){const r=c.size;if(i+e>r){const o=r-i;s=oe(await zr(c,i,o),await n.readUint8Array(t+o,e-o))}else s=await zr(c,i,e)}else s=X;return n.Mt=a.max(o,n.Mt),s}}class br extends Kn{constructor(t,e=4294967295){super();const r=this;let s,o,a;n.assign(r,{diskNumber:0,diskOffset:0,size:0,maxSize:e,availableSize:e});const i=new R({async write(e){if(e===jn)return void(a&&await u());const{availableSize:n}=r;if(a)e.length<n?await c(e):(await c(e.subarray(0,n)),await u(),e.length>n&&await this.write(e.subarray(n)));else{const{value:n,done:i}=await t.next();if(i&&!n)throw new w("Writer iterator completed too soon");s=n,s.size=0,s.maxSize&&(r.maxSize=s.maxSize),r.availableSize=r.maxSize,await kr(s),o=n.writable,a=o.getWriter(),await this.write(e)}},async close(){a&&(await a.ready,await f())},async abort(t){a&&await a.abort(t)}});async function c(t){const e=t.length;e&&(await a.ready,await a.write(t),s.size+=e,r.availableSize-=e)}async function u(){await f(),r.diskOffset+=s.size,r.diskNumber++,a=null,r.availableSize=r.maxSize}async function f(){await a.close()}n.defineProperty(r,_n,{get:()=>i})}async closeDisk(){const t=this.writable.getWriter();try{await t.ready,await t.write(jn)}finally{t.releaseLock()}}}class vr{constructor(t){return e.isArray(t)&&(t=new gr(t)),(t instanceof z||typeof t.getReader==K)&&(t={readable:$e(t)}),t}}class Sr{constructor(t){return t.writable===_&&typeof t.next==K&&(t=new br(t)),(t instanceof R||typeof t.getWriter==K)&&(t={writable:en(t)}),t.size===_&&(t.size=0),t}}async function kr(t,e){if(!t.init||t.initialized)return g.resolve();await t.init(e)}async function xr(t){return t=new vr(t),await kr(t),t.size!==_&&t.readUint8Array||(t=new Yn(await tn(t.readable)),await kr(t)),t}function zr(t,e,n){return t.readUint8Array(e,n)}const Rr="filename",Dr="rawFilename",Fr="comment",Cr="rawComment",Ar="uncompressedSize",Tr="compressedSize",Ur="offset",Er="diskNumberStart",Ir="lastModDate",Wr="rawLastModDate",Mr="lastAccessDate",Or="rawLastAccessDate",Lr="creationDate",Pr="rawCreationDate",Br=[Rr,Dr,Ar,Tr,Ir,Wr,Fr,Cr,Mr,Or,Lr,Pr,Ur,Er,"internalFileAttributes","externalFileAttributes","internalFileAttribute","externalFileAttribute","msdosAttributesRaw","msdosAttributes","msDosCompatible","zip64","encrypted","version","versionMadeBy","zipCrypto","directory","executable","symlink","compressionMethod","signature","crc32","extraField","extraFieldUnix","extraFieldInfoZip","extraFieldUnixType1","extraFieldPkwareUnix","uid","gid","unixMode","unixExternalUpper","setuid","setgid","sticky","bitFlag","rawBitFlag","filenameLength","extraFieldLength","filenameUTF8","commentUTF8","rawExtraField","extraFieldZip64","extraFieldUnicodePath","extraFieldUnicodeComment","extraFieldAES","extraFieldNTFS","extraFieldExtendedTimestamp","extraFieldUSDZ"];class Hr{constructor(t){Br.forEach(e=>this[e]=t[e])}}const Vr="File format is not recognized",Zr="Encryption method not supported",qr="Compression method not supported",Nr="Split zip file",_r="malformed extra field",jr="wrapped entries count",Kr="appended data",Gr="prepended data",Xr="mismatched zip64 end of central directory record",Jr=/^[a-zA-Z]:/,Qr="utf-8",Yr="cp437",$r=[[Ar,E],[Tr,E],[Ur,E],[Er,I]],ts={[I]:{Pt:Es,bytes:4},[E]:{Pt:Is,bytes:8}},es=o(s.MAX_SAFE_INTEGER);class ns{constructor(t,e){n.assign(this,{reader:t,options:e})}async getData(t,e,n,r={}){const o=this,i=ct(),{reader:c,index:u,offset:f,diskNumberStart:h,extraFieldAES:p,extraFieldZip64:m,compressionMethod:y,bitFlag:b,rawBitFlag:v,crc32:S,rawLastModDate:k,uncompressedSize:x,compressedSize:z}=o,{dataDescriptor:D}=b,F=e.localDirectory={},C=e.warnings=[],A=ds(c,h)+f,U=await zr(c,A,30),E=ae(U);let I=Ds(o,r,"password"),M=Ds(o,r,"rawPassword");const L=Ds(o,r,"passThrough");if(((t,e)=>{if(t&&typeof t!=G||e&&!(e instanceof d))throw new w("Invalid password (password must be a string, rawPassword must be a Uint8Array)")})(I,M),I=I&&I.length&&I,M=M&&M.length&&M,p&&99!=p.originalCompressionMethod)throw new w(qr);if(30>U.length||67324752!=Es(E,0))throw new w("Local file header not found");as(F,E,4);const{extraFieldLength:P,filenameLength:B}=F,H=F.dataOffset=A+30+B+P,V=Ds(o,r,"checkLocalDirectory"),Z=ms(r,o.options),q=((t,e)=>t===_?e!=Y:!!t)(V,Z),N=((t,e)=>t===_?e==J:!!t)(V,Z);let j=X;if(N&&(B||P)){const t=await zr(c,A+30,B+P);j=t.subarray(0,B),F.rawExtraField=t.subarray(B)}else F.rawExtraField=P?await zr(c,A+30+B,P):X;N&&(F.rawFilename=j),is(o,F,E,4,!0)&&zs(C,_r),((t,e,n,r,s)=>{const{rawFilename:o}=t,a=!s,i=t.Bt&&!(8192&~e.rawBitFlag);!r||i||n.length==o.length&&!n.some((t,e)=>t!=o[e])||xs(a,s,"mismatched local file header (filename)"),(2057&e.rawBitFlag)!=(2057&t.rawBitFlag)&&xs(a,s,"mismatched local file header (general purpose bit flag)"),e.compressionMethod!=t.compressionMethod&&xs(a,s,"mismatched local file header (compression method)"),e.bitFlag.dataDescriptor||i||!(e.crc32||e.compressedSize||e.uncompressedSize)||e.crc32==t.crc32&&e.compressedSize==t.compressedSize&&e.uncompressedSize==t.uncompressedSize||xs(a,s,"mismatched local file header (crc32 or sizes)")})(o,F,j,N,q?_:C);const{lastAccessDate:Q,creationDate:$,uid:tt,gid:et}=F;Q&&(e.lastAccessDate=Q),$&&(e.creationDate=$),tt!==_&&e.uid===_&&(e.uid=tt),et!==_&&e.gid===_&&(e.gid=et);const nt=o.encrypted&&F.encrypted&&!L,rt=nt&&!p;if(L||(e.zipCrypto=rt),nt&&!(64&~F.rawBitFlag))throw new w(Zr);const st=L?_:(t=>_t.get(t))(y);if(0!=y&&8!=y&&9!=y&&!st&&!L)throw new w(qr);if(nt){if(!rt&&(1>p.strength||p.strength>3))throw new w(Zr);if(!I&&!M)throw new w("File contains encrypted entry")}if(H+z>c.size)throw new w("Entry data out of bounds");const ot=z,at=$e(c.createReadable({offset:H,size:ot})),it=(t=>{if(t&&(typeof t.addEventListener!=K||"boolean"!=typeof t.aborted))throw new w("Invalid signal (must be an AbortSignal instance)");return t||_})(Ds(o,r,"signal")),ut=Ds(o,r,"checkPasswordOnly");let ft=Ds(o,r,"checkOverlappingEntry");const lt=Ds(o,r,"checkOverlappingEntryOnly");lt&&(ft=!0);const{onstart:wt,onprogress:dt,onend:ht}=r,pt=0!=y&&!L,mt=L?z:x,yt=9==y;let gt=Ds(o,r,"useCompressionStream");yt&&(gt=!1);const bt=Ds(o,r,"checkCrc32"),vt=(bt===_?Ds(o,r,"checkSignature"):bt)&&!L&&(!nt||rt||p&&1==p.vendorVersion),St={options:{codecType:gn,password:I,rawPassword:M,zipCrypto:rt,encryptionStrength:p&&p.strength,checkCrc32:vt,checkAuthenticationCode:Ds(o,r,"checkAuthenticationCode"),passwordVerification:rt&&(D?k>>>8&W:S>>>24&W),outputSize:mt,crc32:S,compressed:pt,encrypted:nt,useWebWorkers:Ds(o,r,"useWebWorkers"),useCompressionStream:gt,transferStreams:Ds(o,r,"transferStreams"),deflate64:yt,format:st?st.format:_,codecURI:st?st.codecURI:_,compressionMethod:y,rawBitFlag:v,checkPasswordOnly:ut},config:i,gt:{signal:it,size:ot,onstart:wt,onprogress:dt,onend:ht}};let kt,xt;ft&&await(async({reader:t,Ht:e,index:n,offset:r,crc32:s,compressedSize:o,uncompressedSize:a,dataOffset:i,dataDescriptor:c,extraFieldZip64:u,Vt:f})=>{let l=0;if(c&&(l=u?20:12),l){const n=await zr(t,i+o,l+4),r=ae(n);let c=n.length==l+4&&Es(r,0)==O;if(c){const t=ws(r,4,u);(e.encrypted&&!e.zipCrypto||t.crc32==s)&&t.compressedSize==o&&t.uncompressedSize==a?l+=4:c=!1}if(n.length>=l){const t=ws(r,c?4:0,u);t.signature=c,e.localDirectory.dataDescriptor=t}}const d={start:r,end:i+o+l,Ht:e};for(const[t,e]of f)if(t!=n&&d.start<e.end&&e.start<d.end){const t=new w("Overlapping entry found");throw t.overlappingEntry=e.Ht,t}f.set(n,d)})({reader:c,Ht:e,index:u,offset:A,crc32:S,compressedSize:z,uncompressedSize:x,dataOffset:H,dataDescriptor:D||F.bitFlag.dataDescriptor,extraFieldZip64:m||F.extraFieldZip64,Vt:n});try{if(!lt){ut&&(t=new R),t=new Sr(t),await kr(t,((t,e,n)=>a.min(t,n?1032*e:e))(mt,z,pt)),({writable:kt}=t);const{outputSize:e}=await async function(t,e){const{options:n,config:r}=e,{transferStreams:o,useWebWorkers:a,useCompressionStream:i,compressed:c,checkCrc32:u,computeCrc32:f,encrypted:d,format:h,codecURI:p}=n,{workerURI:m,createWorker:y,maxWorkers:b}=r;h&&(p&&(n.codecURI=((t,e)=>{try{return new l(t,e).toString()}catch{return t}})(p,r.baseURI)),await(async(t,e)=>{!jt.has(t)&&e&&((t,e)=>{const{CompressionStream:n,DecompressionStream:r}=e;if(typeof n!=K&&typeof r!=K)throw new w("Invalid codec module");jt.set(t,{CompressionStream:n,DecompressionStream:r})})(t,await(import(e)))})(h,n.codecURI)),e.transferStreams=!h&&(o||o===_&&r.transferStreams);const v=!(c||u||f||d),S=h===_||!!n.codecURI;return e.useWebWorkers=!v&&S&&(a||a===_&&r.useWebWorkers),e.workerURI=e.useWebWorkers&&m?m:_,e.createWorker=e.useWebWorkers&&y?y:_,n.useCompressionStream=i||i===_&&r.useCompressionStream,(await(async()=>{const n=zn.find(t=>!t.bt);if(n)return In(n),new Sn(n,t,e,k);if(zn.length<b){const n={Zt:Cn};return Cn++,zn.push(n),new Sn(n,t,e,k)}return new g(n=>{Rn.push({resolve:n,stream:t,Ft:e}),Fn=r.workerStarvationTimeout,An()})})()).run();function k(t){if(Tn(),Rn.length){const[{resolve:e,stream:n,Ft:r}]=Rn.splice(0,1);e(new Sn(t,n,r,k)),An()}else t.St?(In(t),((t,e)=>{const{config:n}=e,{terminateWorkerTimeout:r}=n;s.isFinite(r)&&r>=0&&(t.Rt?t.Rt=!1:t.Ct=T(async()=>{zn=zn.filter(e=>e!=t);try{await t.terminate()}catch{}},r))})(t,e)):zn=zn.filter(e=>e!=t)}}({readable:at,writable:kt},St);if(t.size+=e,e!=mt)throw new w(nn)}}catch(e){if(e.outputSize!==_&&(t.size+=e.outputSize),!ut||e.message!=pe)throw xt=e,e}finally{const e=!(t=>!(!t||!t.getData))(t)&&Ds(o,r,"preventClose");if(!e&&kt&&!kt.locked){const t=kt.getWriter();if(xt)try{await t.abort(xt)}catch{}else await t.close()}}return ut||lt?_:t.getData?t.getData():kt}}function rs(t){const e=a.min(t.byteLength,1024)-3;for(let n=0;e>n;n++)if(134630224==Es(t,n))return!0;return!1}function ss(t,e,n){let r=0;for(;n+46<=e.length&&Es(t,n)==L;)n+=46+Us(t,n+28)+Us(t,n+30)+Us(t,n+32),r++;return r%65536?0:r}function os(t){if(t.length>=6){const e=ae(t);if(84233040==Es(e,0)){const n=Us(e,4);if(6+n<=t.length)return t.subarray(6,6+n)}}}function as(t,e,r){const s=t.rawBitFlag=Us(e,r+2),o=!(1&~s),a=Es(e,r+6);n.assign(t,{encrypted:o,version:Us(e,r),bitFlag:{level:(6&s)>>1,dataDescriptor:!(8&~s),languageEncodingFlag:!(2048&~s)},rawLastModDate:a,lastModDate:Cs(a),filenameLength:Us(e,r+22),extraFieldLength:Us(e,r+24)})}function is(t,e,r,s,o){const{rawExtraField:a}=e,u=e.extraField=new c,f=ae(a);let l=0,d=!1;try{for(;l<a.length;){const t=Us(f,l),e=Us(f,l+2);u.set(t,{type:t,data:a.slice(l+4,l+4+e)}),l+=4+e}}catch{d=!0}l>a.length&&(d=!0);const h=Us(r,s+4);n.assign(e,{signature:Es(r,s+10),crc32:Es(r,s+10),compressedSize:Es(r,s+14),uncompressedSize:Es(r,s+18)});const p=u.get(1);p&&(((t,e)=>{e.zip64=!0;const n=ae(t.data),r=$r.filter(([t,n])=>e[t]==n),s=r.reduce((t,[,e])=>t+ts[e].bytes,0);if(t.data.length<s)throw new w("Zip64 extra field not found");for(let s=0,o=0;s<r.length;s++){const[a,i]=r[s],c=ts[i];e[a]=t[a]=c.Pt(n,o),o+=c.bytes}})(p,e),e.extraFieldZip64=p);const m=u.get(28789);m&&(cs(m,Rr,Dr,e,t),e.extraFieldUnicodePath=m);const y=u.get(25461);y&&(cs(y,Fr,Cr,e,t),e.extraFieldUnicodeComment=y);const g=u.get(39169);g&&g.data.length>=7?(((t,e,r)=>{const s=ae(t.data),o=Ts(s,4);n.assign(t,{vendorVersion:Ts(s,0),vendorId:Ts(s,2),strength:o,originalCompressionMethod:r,compressionMethod:Us(s,5)}),e.compressionMethod=t.compressionMethod,1!=t.vendorVersion&&(e.crc32=_)})(g,e,h),e.extraFieldAES=g):e.compressionMethod=h;const b=u.get(13);b&&(us(b,e),e.extraFieldPkwareUnix=b);const v=u.get(22613);v&&(us(v,e),e.extraFieldUnixType1=v);const S=u.get(10);S&&(((t,e)=>{const r=ae(t.data);let s,o=4;try{for(;o<t.data.length&&!s;){const e=Us(r,o),n=Us(r,o+2);1==e&&(s=t.data.slice(o+4,o+4+n)),o+=4+n}}catch{}if(s&&24==s.length){const r=ae(s),o=r.getBigUint64(0,!0),a=r.getBigUint64(8,!0),i=r.getBigUint64(16,!0);n.assign(t,{rawLastModDate:o,rawLastAccessDate:a,rawCreationDate:i});const c={lastModDate:As(o),lastAccessDate:As(a),creationDate:As(i)};n.assign(t,c),n.assign(e,c,{rawLastAccessDate:a,rawCreationDate:i})}})(S,e),e.extraFieldNTFS=S);const k=u.get(30805);let x;if(k&&(x=fs(k,e,!1),e.extraFieldUnix=k),!x){const t=u.get(30837);t&&(fs(t,e,!0),e.extraFieldInfoZip=t)}const z=u.get(21589);z&&(((t,e,n)=>{if(!t.data.length)return;const r=ae(t.data),s=Ts(r,0),o=[],a=[];n?(1&~s||(o.push(Ir),a.push(Wr)),2&~s||(o.push(Mr),a.push(Or)),4&~s||(o.push(Lr),a.push(Pr))):5>t.data.length||(o.push(Ir),a.push(Wr));let c=1;o.forEach((n,s)=>{if(t.data.length>=c+4){const o=Es(r,c);e[n]=t[n]=new i(1e3*(0|o));const u=a[s];t[u]=o}c+=4})})(z,e,o),e.extraFieldExtendedTimestamp=z);const R=u.get(6534);return R&&(e.extraFieldUSDZ=R),d}function cs(t,e,r,s,o){if(5>t.data.length)return void(t.valid=!1);const a=ae(t.data),i=new re;i.append(o[r]);const c=ae(new d(4));c.setUint32(0,i.get(),!0);const u=Es(a,1),f=Ts(a,0);n.assign(t,{version:f,[e]:Mn(t.data.subarray(5)),valid:1==f&&!o.bitFlag.languageEncodingFlag&&u==Es(c,0)}),t.valid&&(s[e]=t[e],s[e+"UTF8"]=!0)}function us(t,e){if(8>t.data.length)return;const r=ae(t.data),s={lastAccessDate:new i(1e3*(0|Es(r,0))),lastModDate:new i(1e3*(0|Es(r,4)))};12>t.data.length||(s.uid=Us(r,8),s.gid=Us(r,10)),n.assign(t,s),n.assign(e,s)}function fs(t,e,r){try{const s=ae(t.data);let o,a;if(r){let e=0;const r=Ts(s,e++),i=Ts(s,e++);o=ls(t.data.subarray(e,e+i)),e+=i;const c=Ts(s,e++);a=ls(t.data.subarray(e,e+c)),n.assign(t,{version:r,uid:o,gid:a})}else 4>t.data.length||(o=Us(s,0),a=Us(s,2),n.assign(t,{uid:o,gid:a}));return o!==_&&(e.uid=o),a!==_&&(e.gid=a),o!==_||a!==_}catch{}}function ls(t){const e=new d(4);return e.set(t,0),new m(e.buffer,e.byteOffset,4).getUint32(0,!0)}function ws(t,e,n){const r=Es(t,e);let s,o;return n?(s=Is(t,e+4),o=Is(t,e+12)):(s=Es(t,e+4),o=Es(t,e+8)),{crc32:r,compressedSize:s,uncompressedSize:o}}function ds(t,e){return t.Lt?t.Lt(e):0}async function hs(t){return Es(ae(await zr(t,0,4)))}function ps(t){return t===J||t===Q||t===Y}function ms(t,e){return ys(t,ys(e,Q))}function ys(t,e){const n=t.strictness;if(n!==_){if(!ps(n))throw new w("Invalid strictness (must be 'strict', 'balanced' or 'tolerant')");return n}const r=t.checkAmbiguity;return r===_?e:r?J:e==Y?Y:Q}function gs(t,e){if(e==Y)return!1;const n=t.split("/");return n.length>1&&""===n[n.length-1]&&n.pop(),!!(n.includes("..")||t.startsWith("/")||t.startsWith("\\\\")||Jr.test(t))||e==J&&(n.includes(".")||n.includes(""))}async function*bs(t,e){const n=t.size-e,r=await zr(t,n,e),s=ae(r);for(let t=r.length-H;t>=0;t--)101010256==Es(s,t)&&(yield[s,n,r,t,n+t])}function vs(t,e,n){return{offset:n,buffer:t.slice(e,e+H).buffer}}async function Ss(t,e,n,r,s,o,a){const i=Us(e,r+10),c=Es(e,r+12),u=Es(e,r+16);if(i==I||c==E||u==E)return await ks(t,e,n,s-V,o,a)==B?2:0;if(!i&&!c)return 1;const f=Us(e,r+6);for(const r of[s-c,ds(t,f)+u])if(await ks(t,e,n,r,o,a)==L)return 2;return 0}async function ks(t,e,n,r,s,o){return 0>r||r+4>s?_:n>r?o.count>0?(o.count--,Es(ae(await zr(t,r,4)),0)):_:Es(e,r-n)}function xs(t,e,n){t?Rs(n):zs(e,n)}function zs(t,e,n){if(!t.some(t=>t.reason==e)){const r={reason:e};n!==_&&(r.filename=n),t.push(r)}}function Rs(t){const e=new w("Ambiguous archive");throw e.reason=t,e}function Ds(t,e,n){return e[n]===_?t.options[n]:e[n]}function Fs(t,e,n){return $(Ds(t,e,n))}function Cs(t){const e=(4294901760&t)>>16,n=t&I,r=new i(1980+((65024&e)>>9),((480&e)>>5)-1,31&e,(63488&n)>>11,(2016&n)>>5,2*(31&n),0);return N>r?N:r}function As(t){return new i(s(t/o(1e4)-o(116444736e5)))}function Ts(t,e){return t.getUint8(e)}function Us(t,e){return t.getUint16(e,!0)}function Es(t,e){return t.getUint32(e,!0)}function Is(t,e){const n=t.getBigUint64(e,!0);if(n>es)throw new w("64-bit value exceeds Number.MAX_SAFE_INTEGER");return s(n)}(t=>{const e=lt(dt(t));n.assign(nt,e),n.assign(it,e)})({workerURI:null,wasmURI:null,DecompressionStreamFallback:class extends Nt{constructor(t){(t=>{if("deflate-raw"!=t)throw new TypeError("Unsupported compression format: "+t)})(t),super(new Zt)}}}),t.BlobReader=Yn,t.BlobWriter=$n,t.Data64URIWriter=class extends Xn{constructor(t){super(),n.assign(this,{contentType:t,data:"data:"+(t||"")+";base64,",qt:""})}writeUint8Array(t){const e=this;let n,s=e.qt;const o=e.qt.length;for(e.qt="",n=0;n<3*a.floor((o+t.length)/3)-o;n++)s+=r.fromCharCode(t[n]);for(;n<t.length;n++)e.qt+=r.fromCharCode(t[n]);s.length>2?e.data+=k(s):e.qt=s+e.qt}getData(){return this.data+k(this.qt)}},t.HttpRangeReader=class extends yr{constructor(t,e={}){super(t,n.assign({},e,{useRangeHeader:!0}))}},t.TextWriter=class extends $n{constructor(t){super(),n.assign(this,{encoding:t,Nt:!t||"utf-8"==t.toLowerCase()})}async getData(){const{encoding:t,Nt:e}=this,n=await super.getData();return n.text&&e?n.text():((t,e)=>On(t,e,!1))(new d(await n.arrayBuffer()),t)}},t.ZipReader=class{constructor(t,e={}){n.assign(this,{reader:new vr(t),options:e,Vt:new c})}async*getEntriesGenerator(t={}){const e=this;let{reader:r}=e;if(await kr(r),r.size!==_&&r.readUint8Array||(r=new Yn(await tn(r.readable)),await kr(r)),r.size<H)throw new w(Vr);const o=e.warnings=[],i=ms(t,e.options),c=i==J,f=i!=Y,l=((t,e)=>{if(t!==_){const e=tt(t);if("number"!=typeof e||s.isNaN(e)||0>e)throw new w("Invalid maxAppendedDataSize (must be a number greater than or equal to 0)");return e}return e==J?0:e==Y?1/0:I})(Ds(e,t,"maxAppendedDataSize"),i),d=((t,e)=>{if(t===_)return e;if(!ps(t))throw new w("Invalid filenameValidation (must be 'strict', 'balanced' or 'tolerant')");return t})(Ds(e,t,"filenameValidation"),i),h=Ds(e,t,"normalizeFilename"),{_t:p,jt:m}=await(async(t,e,n)=>{const{size:r}=t,s=a.min(r,65557),o={count:64};let i,c,u=0;for await(const[n,a,f,l,w]of bs(t,s)){const s=Us(n,l+20);if(w+H+s==r){const s=await Ss(t,n,a,l,w,r,o);if(2==s){if(i||(i=vs(f,l,w)),u++,!e||u>1)break}else 1!=s||c||(c=vs(f,l,w))}}return i||(i=c),i||(i=await(async(t,e,n)=>{const{size:r}=t,s=a.min(r,e==1/0?r:65557+e);let o,i;for await(const[e,a,c,u,f]of bs(t,s)){const s=vs(c,u,f);o||(o=s);const l=await Ss(t,e,a,u,f,r,n);if(2==l)return s;1!=l||i||(i=s)}return i||o})(t,n,o)),{_t:i,jt:u}})(r,f,l);if(!p)throw await(async t=>await hs(t)==M)(r)?new w(Nr):new w("End of central directory not found");f&&m>1&&Rs("multiple end of central directory records");const y=ae(p);let g=Es(y,12),b=Es(y,16);const v=p.offset,S=Us(y,20),k=v+H+S,z=r.size-k;z>l&&Rs(Kr),z>0&&zs(o,Kr);let R=Us(y,4);const D=r.Mt||0;let F,C,A,T,U=Us(y,6),O=Us(y,10),N=0,j=Z;const K=b==E||g==E||O==I||U==I;if(b!=E&&U!=I&&(b+=ds(r,U)),K){const t=p.offset<V?X:await zr(r,p.offset-V,V),e=ae(t);if(t.length==V&&Es(e,0)==B){b=ds(r,Es(e,4))+Is(e,8);let t=await zr(r,b,Z),s=ae(t);const i=p.offset-V-Z;if((t.length<Z||Es(s,0)!=P)&&b!=i&&i>=0){const e=b;b=i,b>e&&(N=b-e),t=await zr(r,b,Z),s=ae(t)}if(t.length<Z||Es(s,0)!=P)throw new w("End of Zip64 central directory locator not found");if(C=!0,A=Is(s,4)>44,A){const t=a.min(Is(s,4)-44,r.size-b-Z);t>0&&(j+=t,T=(t=>{const e={rawExtensibleData:t};if(t.length>=28){const r=ae(t),s=Us(r,26);n.assign(e,{compressionMethod:Us(r,0),compressedSize:Is(r,2),uncompressedSize:Is(r,10),encryptionAlgorithm:Us(r,18),bitLength:Us(r,20),flags:Us(r,22),hashAlgorithm:Us(r,24),hashData:t.subarray(28,28+s)})}return e})(await zr(r,b+Z,t)))}R==I?R=Es(s,16):R!=Es(s,16)&&xs(c,o,Xr),U==I?U=Es(s,20):U!=Es(s,20)&&xs(c,o,Xr),O==I?O=Is(s,32):O!=Is(s,32)&&xs(c,o,Xr),g==E?g=Is(s,40):g!=Is(s,40)&&xs(c,o,Xr),b=ds(r,U)+Is(s,48)+N}}let G=g;const Q=p.offset-(C?j+V:0);if(b<r.size||(N=r.size-b-g-H,b=r.size-g-H),D!=R)throw new w(Nr);if(0>b)throw new w(Vr);let $=0,et=await zr(r,b,g),nt=ae(et);if(g){if(4>et.length)throw new w(Vr);const t=Q-g;if(b!=t&&U==R){let e=!(Es(nt,$)==L||T&&T.compressedSize||rs(nt));if(e||0>t||t+4>r.size||(e=Es(ae(await zr(r,t,4)),0)==L),e){const e=b;b=t,b>e&&(N+=b-e),et=await zr(r,b,g),nt=ae(et)}}}const rt=Q-b;if(g==rt||0>rt||U!=R||(g=rt,et=await zr(r,b,g),nt=ae(et)),0>b||b>=r.size)throw new w(Vr);e.directoryOffset=b,e.directoryLength=G;const st=Fs(e,t,"decryptCentralDirectory");let ot,at;if(st&&O&&et.length>=4&&Es(nt,0)!=L&&(A||rs(nt))){const t=((t,e,n)=>{const r=t&&t.compressedSize?t.compressedSize:e;return r>0&&n>=r?r:n})(T,G,et.length);at=et.subarray(t),et=await st(et.subarray(0,t),T),nt=ae(et),G=et.length,ot=!0}!T||ot||et.length>=4&&Es(nt,0)!=L||zs(o,"unknown zip64 extensible data"),F=b;const it=Ds(e,t,"filenameEncoding"),ct=Ds(e,t,"commentEncoding"),ut=new u;let ft,lt=-1;const wt=!c&&!C;!O&&wt&&(O=ss(nt,et,$),O&&zs(o,jr));for(let s=0;O>s;s++){const i=new ns(r,e.options);if($+46>et.length||Es(nt,$)!=L){if(0==s&&!ot&&(A||rs(nt)))throw new w("Encrypted central directory is not supported");throw new w("Central directory header not found")}as(i,nt,$+6);const c=!!i.bitFlag.languageEncodingFlag,u=$+46,f=u+i.filenameLength,l=f+i.extraFieldLength,p=Us(nt,$+4),m=!(p>>8),y=p>>8==3,g=et.subarray(u,f),b=Us(nt,$+32),v=l+b,S=et.subarray(l,v),k=c,z=c,R=Es(nt,$+38),D=R&W,C={readOnly:!!(1&D),hidden:!!(2&D),system:!!(4&D),directory:!!(16&D),archive:!!(32&D)},T=Es(nt,$+42),U=Fs(e,t,"decodeText")||Mn,E=k?Qr:it||Yr,M=z?Qr:ct||Yr;let P=U(g,E,"filename");if(P===_&&(P=Mn(g,E)),h){const t=h(P);t!==_&&(P=t)}if(gs(P,d)){const t=new w("Unsafe filename");throw t.filename=P,t}let B=U(S,M,"comment");B===_&&(B=Mn(S,M)),n.assign(i,{index:s,Bt:ot,versionMadeBy:p,msDosCompatible:m,zip64:!1,compressedSize:0,uncompressedSize:0,Kt:b,offset:T,diskNumberStart:Us(nt,$+34),internalFileAttributes:Us(nt,$+36),externalFileAttributes:R,msdosAttributesRaw:D,msdosAttributes:C,rawFilename:g,filenameUTF8:k,commentUTF8:z,rawExtraField:et.subarray(f,l),rawComment:S,filename:P,comment:B}),is(i,i,nt,$+6)&&zs(o,_r,P),i.offset+=N;const H=ds(r,i.diskNumberStart)+i.offset;F=a.min(H,F),lt>H&&zs(o,"unsorted central directory",P),lt=H,(i.version&W)>63&&zs(o,"unknown version needed to extract",P),32&~i.rawBitFlag||zs(o,"compressed patched data",P),ut.has(i.filename)&&(ft=!0),ut.add(i.filename);const V=i.externalFileAttributes>>16&I;i.unixMode===_&&16877&V&&(i.unixMode=V);const Z=!!(2048&i.unixMode),j=!!(1024&i.unixMode),K=!!(512&i.unixMode),G=40960==((i.unixMode===_?V:i.unixMode)&q),X=!G&&(i.unixMode!==_?!!(73&i.unixMode):y&&!!(73&V)),J=i.unixMode!==_&&16384==(i.unixMode&q),Q=16384==(V&q);n.assign(i,{setuid:Z,setgid:j,sticky:K,symlink:G,unixExternalUpper:V,internalFileAttribute:i.internalFileAttributes,externalFileAttribute:i.externalFileAttributes,executable:X,directory:J||Q||m&&C.directory||i.filename.endsWith("/"),zipCrypto:i.encrypted&&!i.extraFieldAES});const Y=new Hr(i);if(Y.getData=(t,n)=>i.getData(t,Y,e.Vt,n),Y.arrayBuffer=async t=>{const n=new x,r=tn(n.readable).then(t=>t.arrayBuffer());return r.catch(()=>{}),await i.getData(n,Y,e.Vt,t),r},$=v,s==O-1&&wt){const t=ss(nt,et,$);t&&(O+=t,zs(o,jr))}const{onprogress:tt}=t;if(tt)try{await tt(s+1,O,new Hr(i))}catch{}yield Y}let dt=$,ht=os(et.subarray($))||(ot?os(at):_);if(!ht&&!ot){const t=b+$,e=a.min(Q-t,65541);6>e||(ht=os(await zr(r,t,e)))}ht&&(e.digitalSignature=ht,dt=$+6+ht.length),($!=G&&dt!=G||!ot&&$!=g&&dt!=g)&&xs(c,o,"trailing central directory data"),ft&&xs(c,o,"duplicate filename");const pt=Ds(e,t,"extractPrependedData"),mt=Ds(e,t,"extractAppendedData"),yt=(c||pt)&&O&&4==F&&await(async t=>{const e=await hs(t);return e==M||808471376==e})(r)?4:0;return c&&(N||O&&F>yt)&&Rs(Gr),(N||O&&F>4)&&zs(o,Gr),pt&&(e.prependedData=F>yt?await zr(r,yt,F-yt):X),e.comment=S?await zr(r,v+H,S):X,mt&&(e.appendedData=k<r.size?await zr(r,k,r.size-k):X),!0}async getEntries(t={}){const e=[];for await(const n of this.getEntriesGenerator(t))e.push(n);return e}async close(){const{reader:t}=this;t.readUint8Array||!t.readable||t.readable.locked||await t.readable.cancel()}},t.configure=t=>{n.assign(it,lt(dt(t)))},t.inflateRaw=(t,e)=>Ht(t,{i:2},e&&e.Gt,e&&e.m)});
|
|
@@ -21,6 +21,13 @@ const bundledTerserOptions = {
|
|
|
21
21
|
keep_quoted: "strict",
|
|
22
22
|
reserved: reservedPropertyNames
|
|
23
23
|
}
|
|
24
|
+
},
|
|
25
|
+
// zip.min.js is inlined into self-extracting pages, which declare windows-1252: a literal
|
|
26
|
+
// non-ASCII character in the source is re-decoded there, and the CP437 table it belongs to
|
|
27
|
+
// then maps every legacy entry name to garbage. terser prints the shortest form and turns
|
|
28
|
+
// an escape back into the character, so the escaping has to be asked for here
|
|
29
|
+
format: {
|
|
30
|
+
ascii_only: true
|
|
24
31
|
}
|
|
25
32
|
};
|
|
26
33
|
|