image-exporter 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/.gitattributes +2 -0
  2. package/.prettierrc +5 -0
  3. package/LICENSE.md +201 -0
  4. package/README.md +3 -0
  5. package/dist/image-exporter.es.js +3807 -0
  6. package/dist/image-exporter.umd.js +3813 -0
  7. package/example/example.css +122 -0
  8. package/example/example.html +152 -0
  9. package/example/github.jpg +0 -0
  10. package/example/poll-h.svg +1 -0
  11. package/package.json +50 -0
  12. package/src/capture-images.ts +129 -0
  13. package/src/clean-up.ts +50 -0
  14. package/src/cors-proxy/index.ts +22 -0
  15. package/src/cors-proxy/proxy-css.ts +52 -0
  16. package/src/cors-proxy/proxy-images.ts +90 -0
  17. package/src/default-options.ts +58 -0
  18. package/src/download-images.ts +52 -0
  19. package/src/get-capture-element.test.html +21 -0
  20. package/src/get-capture-element.test.ts +36 -0
  21. package/src/get-capture-element.ts +175 -0
  22. package/src/get-options/get-input-options.test.html +217 -0
  23. package/src/get-options/get-input-options.test.ts +109 -0
  24. package/src/get-options/get-input-options.ts +40 -0
  25. package/src/get-options/get-item-options.ts +46 -0
  26. package/src/get-options/get-wrapper-options.test.html +33 -0
  27. package/src/get-options/get-wrapper-options.test.ts +109 -0
  28. package/src/get-options/get-wrapper-options.ts +84 -0
  29. package/src/get-options/index.ts +28 -0
  30. package/src/image-exporter.ts +108 -0
  31. package/src/index.ts +8 -0
  32. package/src/types/image.ts +2 -0
  33. package/src/types/index.ts +2 -0
  34. package/src/types/options.ts +69 -0
  35. package/src/utils/convert-to-slug.ts +15 -0
  36. package/src/utils/get-attribute-values.ts +68 -0
  37. package/src/utils/get-date-MMDDYY.ts +11 -0
  38. package/src/utils/ignore-items.ts +11 -0
  39. package/src/utils/index.ts +18 -0
  40. package/src/utils/is-valid-url.ts +20 -0
  41. package/src/utils/is-visible.ts +12 -0
  42. package/src/utils/parse-labels.ts +55 -0
  43. package/src/utils/push-to-window.ts +3 -0
  44. package/tests/index.html +88 -0
  45. package/tests/input-tests.html +169 -0
  46. package/vite.config.js +39 -0
@@ -0,0 +1,3813 @@
1
+ (() => {
2
+ (function(global2, factory) {
3
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2["image-exporter"] = {}));
4
+ })(this, function(exports2) {
5
+ "use strict";
6
+ function pushToWindow(propertyName, value) {
7
+ window[propertyName] = value;
8
+ }
9
+ function getWrapperOptions(options) {
10
+ try {
11
+ const wrapper = document.querySelector(options.selectors.wrapper);
12
+ if (!wrapper) {
13
+ new Error("Wrapper element not found");
14
+ return options;
15
+ }
16
+ Object.keys(options.image).forEach((key) => {
17
+ const attrValue = wrapper.getAttribute(options.image[key].attributeSelector);
18
+ if (attrValue !== null) {
19
+ const safeValue = optionSafetyCheck(key, attrValue);
20
+ if (safeValue === null) return;
21
+ options.image[key].value = safeValue;
22
+ }
23
+ });
24
+ Object.keys(options.zip).forEach((key) => {
25
+ const attrValue = wrapper.getAttribute(options.zip[key].attributeSelector);
26
+ if (attrValue !== null) {
27
+ const safeValue = optionSafetyCheck(key, attrValue);
28
+ if (safeValue === null) return;
29
+ options.zip[key].value = safeValue;
30
+ }
31
+ });
32
+ if (options.debug) pushToWindow("getWrapperOptionsDebug", options);
33
+ return options;
34
+ } catch (e) {
35
+ console.error("ImageExporter: Error in getWrapperOptions", e);
36
+ return options;
37
+ }
38
+ }
39
+ function optionSafetyCheck(key, value) {
40
+ if (value === "on") return true;
41
+ if (value === "off") return false;
42
+ if (key === "scale" || key === "quality") {
43
+ if (typeof value === "number") return value;
44
+ value = value.trim();
45
+ value = parseFloat(value);
46
+ if (isNaN(value)) return null;
47
+ return value;
48
+ }
49
+ if (key === "dateInLabel" || key === "scaleInLabel") {
50
+ if (typeof value === "boolean") return value;
51
+ value = value.trim();
52
+ return value === "true";
53
+ }
54
+ if (key === "format") {
55
+ value = value.trim();
56
+ if (value === "jpg" || value === "png") return value;
57
+ return null;
58
+ }
59
+ return value;
60
+ }
61
+ async function handleOptions(optionsType, key) {
62
+ const selector = optionsType[key].inputSelector;
63
+ const inputElement = document.querySelector(`[${selector}]`);
64
+ if (!inputElement) return;
65
+ if (inputElement.getAttribute("type") === "checkbox") {
66
+ optionsType[key].value = inputElement.checked;
67
+ return;
68
+ }
69
+ if (inputElement.value) {
70
+ const safeValue = optionSafetyCheck(key, inputElement.value);
71
+ if (safeValue === null) return;
72
+ optionsType[key].value = safeValue;
73
+ }
74
+ }
75
+ function getInputOptions(options) {
76
+ try {
77
+ Promise.all(
78
+ Object.keys(options.image).map((key) => handleOptions(options.image, key))
79
+ );
80
+ Promise.all(Object.keys(options.zip).map((key) => handleOptions(options.zip, key)));
81
+ if (options.debug) pushToWindow("getInputOptionsDebug", options);
82
+ return options;
83
+ } catch (e) {
84
+ console.error("ImageExporter: Error in getUserOptions", e);
85
+ return options;
86
+ }
87
+ }
88
+ function convertToSlug(input) {
89
+ if (!input) {
90
+ return null;
91
+ }
92
+ input = input.toLowerCase();
93
+ input = input.replace(/[^a-z0-9_@ -]/g, "");
94
+ input = input.replace(/\s+/g, "-");
95
+ return input;
96
+ }
97
+ function isVisible(element) {
98
+ if (!(element instanceof HTMLElement)) return false;
99
+ if (element.offsetParent === null) return false;
100
+ const rect = element.getBoundingClientRect();
101
+ return rect.width > 0 && rect.height > 0;
102
+ }
103
+ function getDateMMDDYY() {
104
+ return String((/* @__PURE__ */ new Date()).getMonth() + 1).padStart(2, "0") + String((/* @__PURE__ */ new Date()).getDate()).padStart(2, "0") + (/* @__PURE__ */ new Date()).getFullYear().toString().slice(-2);
105
+ }
106
+ function parseZipLabel(options) {
107
+ const date = getDateMMDDYY();
108
+ const zipScale = convertStringToBoolean(options.zip.scaleInLabel.value) ? `_@${options.image.scale.value}x` : "";
109
+ const zipDate = convertStringToBoolean(options.zip.dateInLabel.value) ? `_${date}` : "";
110
+ const zipNameSlug = convertToSlug(options.zip.label.value);
111
+ const zipLabel = `${zipNameSlug}${zipDate}${zipScale}.zip`;
112
+ return zipLabel;
113
+ }
114
+ function parseImageLabel(itemOptions) {
115
+ const date = getDateMMDDYY();
116
+ const imgScale = itemOptions.image.scaleInLabel.value ? `_@${itemOptions.image.scale.value}x` : "";
117
+ const imgDate = itemOptions.image.dateInLabel.value ? `_${date}` : "";
118
+ const imgNameSlug = convertToSlug(itemOptions.userSlug) || `img-${itemOptions.id}`;
119
+ const imgLabel = `${imgNameSlug}${imgDate}${imgScale}`;
120
+ return imgLabel;
121
+ }
122
+ function convertStringToBoolean(str) {
123
+ if (str === "true") {
124
+ return true;
125
+ } else if (str === "false") {
126
+ return false;
127
+ }
128
+ return str;
129
+ }
130
+ function isValidUrl(string) {
131
+ try {
132
+ const url = new URL(string);
133
+ if (url.protocol === "data:") {
134
+ return false;
135
+ }
136
+ if (url.protocol !== "http:" && url.protocol !== "https:") {
137
+ return false;
138
+ }
139
+ return true;
140
+ } catch (_) {
141
+ return false;
142
+ }
143
+ }
144
+ function getItemOptions(element, options, index) {
145
+ var _a;
146
+ let itemOptions = {
147
+ ...options,
148
+ id: index,
149
+ userSlug: "",
150
+ slug: "",
151
+ fileName: ""
152
+ };
153
+ Object.keys(options.image).forEach((key) => {
154
+ const attributeValue = element.getAttribute(options.image[key].attributeSelector);
155
+ if (attributeValue !== null) {
156
+ itemOptions.image[key].value = attributeValue;
157
+ }
158
+ });
159
+ itemOptions.id = index;
160
+ itemOptions.userSlug = ((_a = element.querySelector(options.selectors.slug)) == null ? void 0 : _a.textContent) || "";
161
+ itemOptions.slug = parseImageLabel(itemOptions);
162
+ return itemOptions;
163
+ }
164
+ function determineOptions(options) {
165
+ options = getWrapperOptions(options);
166
+ options = getInputOptions(options);
167
+ return options;
168
+ }
169
+ function getCaptureElements(options) {
170
+ try {
171
+ if (!document.querySelector(options.selectors.capture)) {
172
+ console.error("ImageExporter: No capture items found in the wrapper.");
173
+ return [];
174
+ }
175
+ findMultiScaleElements(options);
176
+ const elements = Array.from(
177
+ document.querySelectorAll(
178
+ `${options.selectors.wrapper} ${options.selectors.capture}`
179
+ )
180
+ );
181
+ const visibleElements = elements.filter((element) => isVisible(element));
182
+ return visibleElements;
183
+ } catch (e) {
184
+ console.error("ImageExporter: Error in getCaptureElements", e);
185
+ return [];
186
+ }
187
+ }
188
+ function findMultiScaleElements(options) {
189
+ try {
190
+ const elements = Array.from(
191
+ document.querySelectorAll(
192
+ `${options.selectors.wrapper} ${options.selectors.capture}`
193
+ )
194
+ );
195
+ if (elements) {
196
+ const elementsWithScaleAttribute = elements.filter(
197
+ (element) => element.hasAttribute(options.image.scale.attributeSelector)
198
+ );
199
+ elementsWithScaleAttribute.forEach((element) => {
200
+ const scaleValue = element.getAttribute(
201
+ options.image.scale.attributeSelector
202
+ );
203
+ if (scaleValue.includes(",")) {
204
+ const scaleArray = scaleValue.split(",").map(Number);
205
+ encapsulateMultiScaleElements(options, element, scaleArray, scaleValue);
206
+ if (options.debug)
207
+ pushToWindow("findMultiScaleElementsTest", element.outerHTML);
208
+ }
209
+ });
210
+ return true;
211
+ } else {
212
+ return false;
213
+ }
214
+ } catch (e) {
215
+ console.error("ImageExporter: Error in findMultiScaleElements", e);
216
+ return;
217
+ }
218
+ }
219
+ function encapsulateMultiScaleElements(options, element, scaleArray, scaleValue) {
220
+ try {
221
+ element.setAttribute(options.image.scale.attributeSelector, scaleArray[0].toString());
222
+ element.setAttribute(options.image.scaleInLabel.attributeSelector, "true");
223
+ element.setAttribute("ie-clone-source", scaleValue);
224
+ for (let i = 1; i < scaleArray.length; i++) {
225
+ const newElement = cloneElementAttributes(options, element);
226
+ newElement.setAttribute(
227
+ options.image.scale.attributeSelector,
228
+ scaleArray[i].toString()
229
+ );
230
+ newElement.setAttribute(options.image.scaleInLabel.attributeSelector, "true");
231
+ if (element.parentNode) {
232
+ element.parentNode.insertBefore(newElement, element);
233
+ newElement.appendChild(element);
234
+ }
235
+ }
236
+ } catch (e) {
237
+ console.error("ImageExporter: Error in encapsulateMultiScaleElements", e);
238
+ return;
239
+ }
240
+ }
241
+ function cloneElementAttributes(options, originalElement) {
242
+ try {
243
+ const clonedElement = document.createElement("div");
244
+ const arrayOfPossibleAttributes = Object.keys(options.image).map(
245
+ (key) => options.image[key].attributeSelector
246
+ );
247
+ const { prefix, value } = parseStringAttribute(options.selectors.capture);
248
+ clonedElement.setAttribute(prefix, value);
249
+ clonedElement.setAttribute("ie-clone", "true");
250
+ setExplicitDimensions(originalElement, clonedElement);
251
+ Array.from(originalElement.attributes).forEach((attr) => {
252
+ if (attr.name in arrayOfPossibleAttributes) {
253
+ clonedElement.setAttribute(attr.name, attr.value);
254
+ }
255
+ });
256
+ return clonedElement;
257
+ } catch (e) {
258
+ console.error("ImageExporter: Error in cloneElementAttributes", e);
259
+ return originalElement;
260
+ }
261
+ }
262
+ function parseStringAttribute(attributeValue) {
263
+ if (!attributeValue.includes("=")) {
264
+ throw new Error("Invalid attribute format. Expected format: [prefix=value]");
265
+ }
266
+ const attributeArray = attributeValue.split("=");
267
+ if (attributeArray.length !== 2) {
268
+ throw new Error("Invalid attribute format. Expected format: [prefix=value]");
269
+ }
270
+ const prefix = attributeArray[0].trim().replace(/^\[|\]$/g, "");
271
+ const value = attributeArray[1].trim().replace(/^\[|\]$/g, "").replace(/^'|'$/g, "");
272
+ if (!prefix || !value) {
273
+ throw new Error("Invalid attribute format. Prefix or value is missing.");
274
+ }
275
+ return { prefix, value };
276
+ }
277
+ function setExplicitDimensions(originalElement, clonedElement) {
278
+ const originalElementStyle = window.getComputedStyle(originalElement);
279
+ const originalElementWidth = originalElementStyle.getPropertyValue("width");
280
+ const originalElementHeight = originalElementStyle.getPropertyValue("height");
281
+ clonedElement.style.width = originalElementWidth;
282
+ clonedElement.style.height = originalElementHeight;
283
+ }
284
+ function resolveUrl(url, baseUrl) {
285
+ if (url.match(/^[a-z]+:\/\//i)) {
286
+ return url;
287
+ }
288
+ if (url.match(/^\/\//)) {
289
+ return window.location.protocol + url;
290
+ }
291
+ if (url.match(/^[a-z]+:/i)) {
292
+ return url;
293
+ }
294
+ const doc = document.implementation.createHTMLDocument();
295
+ const base = doc.createElement("base");
296
+ const a = doc.createElement("a");
297
+ doc.head.appendChild(base);
298
+ doc.body.appendChild(a);
299
+ if (baseUrl) {
300
+ base.href = baseUrl;
301
+ }
302
+ a.href = url;
303
+ return a.href;
304
+ }
305
+ const uuid = /* @__PURE__ */ (() => {
306
+ let counter = 0;
307
+ const random = () => (
308
+ // eslint-disable-next-line no-bitwise
309
+ `0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4)
310
+ );
311
+ return () => {
312
+ counter += 1;
313
+ return `u${random()}${counter}`;
314
+ };
315
+ })();
316
+ function toArray(arrayLike) {
317
+ const arr = [];
318
+ for (let i = 0, l = arrayLike.length; i < l; i++) {
319
+ arr.push(arrayLike[i]);
320
+ }
321
+ return arr;
322
+ }
323
+ function px(node, styleProperty) {
324
+ const win = node.ownerDocument.defaultView || window;
325
+ const val = win.getComputedStyle(node).getPropertyValue(styleProperty);
326
+ return val ? parseFloat(val.replace("px", "")) : 0;
327
+ }
328
+ function getNodeWidth(node) {
329
+ const leftBorder = px(node, "border-left-width");
330
+ const rightBorder = px(node, "border-right-width");
331
+ return node.clientWidth + leftBorder + rightBorder;
332
+ }
333
+ function getNodeHeight(node) {
334
+ const topBorder = px(node, "border-top-width");
335
+ const bottomBorder = px(node, "border-bottom-width");
336
+ return node.clientHeight + topBorder + bottomBorder;
337
+ }
338
+ function getImageSize(targetNode, options = {}) {
339
+ const width = options.width || getNodeWidth(targetNode);
340
+ const height = options.height || getNodeHeight(targetNode);
341
+ return { width, height };
342
+ }
343
+ function getPixelRatio() {
344
+ let ratio;
345
+ let FINAL_PROCESS;
346
+ try {
347
+ FINAL_PROCESS = process;
348
+ } catch (e) {
349
+ }
350
+ const val = FINAL_PROCESS && FINAL_PROCESS.env ? FINAL_PROCESS.env.devicePixelRatio : null;
351
+ if (val) {
352
+ ratio = parseInt(val, 10);
353
+ if (Number.isNaN(ratio)) {
354
+ ratio = 1;
355
+ }
356
+ }
357
+ return ratio || window.devicePixelRatio || 1;
358
+ }
359
+ const canvasDimensionLimit = 16384;
360
+ function checkCanvasDimensions(canvas) {
361
+ if (canvas.width > canvasDimensionLimit || canvas.height > canvasDimensionLimit) {
362
+ if (canvas.width > canvasDimensionLimit && canvas.height > canvasDimensionLimit) {
363
+ if (canvas.width > canvas.height) {
364
+ canvas.height *= canvasDimensionLimit / canvas.width;
365
+ canvas.width = canvasDimensionLimit;
366
+ } else {
367
+ canvas.width *= canvasDimensionLimit / canvas.height;
368
+ canvas.height = canvasDimensionLimit;
369
+ }
370
+ } else if (canvas.width > canvasDimensionLimit) {
371
+ canvas.height *= canvasDimensionLimit / canvas.width;
372
+ canvas.width = canvasDimensionLimit;
373
+ } else {
374
+ canvas.width *= canvasDimensionLimit / canvas.height;
375
+ canvas.height = canvasDimensionLimit;
376
+ }
377
+ }
378
+ }
379
+ function createImage(url) {
380
+ return new Promise((resolve, reject) => {
381
+ const img = new Image();
382
+ img.decode = () => resolve(img);
383
+ img.onload = () => resolve(img);
384
+ img.onerror = reject;
385
+ img.crossOrigin = "anonymous";
386
+ img.decoding = "async";
387
+ img.src = url;
388
+ });
389
+ }
390
+ async function svgToDataURL(svg) {
391
+ return Promise.resolve().then(() => new XMLSerializer().serializeToString(svg)).then(encodeURIComponent).then((html) => `data:image/svg+xml;charset=utf-8,${html}`);
392
+ }
393
+ async function nodeToDataURL(node, width, height) {
394
+ const xmlns = "http://www.w3.org/2000/svg";
395
+ const svg = document.createElementNS(xmlns, "svg");
396
+ const foreignObject = document.createElementNS(xmlns, "foreignObject");
397
+ svg.setAttribute("width", `${width}`);
398
+ svg.setAttribute("height", `${height}`);
399
+ svg.setAttribute("viewBox", `0 0 ${width} ${height}`);
400
+ foreignObject.setAttribute("width", "100%");
401
+ foreignObject.setAttribute("height", "100%");
402
+ foreignObject.setAttribute("x", "0");
403
+ foreignObject.setAttribute("y", "0");
404
+ foreignObject.setAttribute("externalResourcesRequired", "true");
405
+ svg.appendChild(foreignObject);
406
+ foreignObject.appendChild(node);
407
+ return svgToDataURL(svg);
408
+ }
409
+ const isInstanceOfElement = (node, instance) => {
410
+ if (node instanceof instance)
411
+ return true;
412
+ const nodePrototype = Object.getPrototypeOf(node);
413
+ if (nodePrototype === null)
414
+ return false;
415
+ return nodePrototype.constructor.name === instance.name || isInstanceOfElement(nodePrototype, instance);
416
+ };
417
+ function formatCSSText(style) {
418
+ const content = style.getPropertyValue("content");
419
+ return `${style.cssText} content: '${content.replace(/'|"/g, "")}';`;
420
+ }
421
+ function formatCSSProperties(style) {
422
+ return toArray(style).map((name) => {
423
+ const value = style.getPropertyValue(name);
424
+ const priority = style.getPropertyPriority(name);
425
+ return `${name}: ${value}${priority ? " !important" : ""};`;
426
+ }).join(" ");
427
+ }
428
+ function getPseudoElementStyle(className, pseudo, style) {
429
+ const selector = `.${className}:${pseudo}`;
430
+ const cssText = style.cssText ? formatCSSText(style) : formatCSSProperties(style);
431
+ return document.createTextNode(`${selector}{${cssText}}`);
432
+ }
433
+ function clonePseudoElement(nativeNode, clonedNode, pseudo) {
434
+ const style = window.getComputedStyle(nativeNode, pseudo);
435
+ const content = style.getPropertyValue("content");
436
+ if (content === "" || content === "none") {
437
+ return;
438
+ }
439
+ const className = uuid();
440
+ try {
441
+ clonedNode.className = `${clonedNode.className} ${className}`;
442
+ } catch (err) {
443
+ return;
444
+ }
445
+ const styleElement = document.createElement("style");
446
+ styleElement.appendChild(getPseudoElementStyle(className, pseudo, style));
447
+ clonedNode.appendChild(styleElement);
448
+ }
449
+ function clonePseudoElements(nativeNode, clonedNode) {
450
+ clonePseudoElement(nativeNode, clonedNode, ":before");
451
+ clonePseudoElement(nativeNode, clonedNode, ":after");
452
+ }
453
+ const WOFF = "application/font-woff";
454
+ const JPEG = "image/jpeg";
455
+ const mimes = {
456
+ woff: WOFF,
457
+ woff2: WOFF,
458
+ ttf: "application/font-truetype",
459
+ eot: "application/vnd.ms-fontobject",
460
+ png: "image/png",
461
+ jpg: JPEG,
462
+ jpeg: JPEG,
463
+ gif: "image/gif",
464
+ tiff: "image/tiff",
465
+ svg: "image/svg+xml",
466
+ webp: "image/webp"
467
+ };
468
+ function getExtension(url) {
469
+ const match = /\.([^./]*?)$/g.exec(url);
470
+ return match ? match[1] : "";
471
+ }
472
+ function getMimeType(url) {
473
+ const extension = getExtension(url).toLowerCase();
474
+ return mimes[extension] || "";
475
+ }
476
+ function getContentFromDataUrl(dataURL) {
477
+ return dataURL.split(/,/)[1];
478
+ }
479
+ function isDataUrl(url) {
480
+ return url.search(/^(data:)/) !== -1;
481
+ }
482
+ function makeDataUrl(content, mimeType) {
483
+ return `data:${mimeType};base64,${content}`;
484
+ }
485
+ async function fetchAsDataURL(url, init, process2) {
486
+ const res = await fetch(url, init);
487
+ if (res.status === 404) {
488
+ throw new Error(`Resource "${res.url}" not found`);
489
+ }
490
+ const blob = await res.blob();
491
+ return new Promise((resolve, reject) => {
492
+ const reader = new FileReader();
493
+ reader.onerror = reject;
494
+ reader.onloadend = () => {
495
+ try {
496
+ resolve(process2({ res, result: reader.result }));
497
+ } catch (error) {
498
+ reject(error);
499
+ }
500
+ };
501
+ reader.readAsDataURL(blob);
502
+ });
503
+ }
504
+ const cache = {};
505
+ function getCacheKey(url, contentType, includeQueryParams) {
506
+ let key = url.replace(/\?.*/, "");
507
+ if (includeQueryParams) {
508
+ key = url;
509
+ }
510
+ if (/ttf|otf|eot|woff2?/i.test(key)) {
511
+ key = key.replace(/.*\//, "");
512
+ }
513
+ return contentType ? `[${contentType}]${key}` : key;
514
+ }
515
+ async function resourceToDataURL(resourceUrl, contentType, options) {
516
+ const cacheKey = getCacheKey(resourceUrl, contentType, options.includeQueryParams);
517
+ if (cache[cacheKey] != null) {
518
+ return cache[cacheKey];
519
+ }
520
+ if (options.cacheBust) {
521
+ resourceUrl += (/\?/.test(resourceUrl) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime();
522
+ }
523
+ let dataURL;
524
+ try {
525
+ const content = await fetchAsDataURL(resourceUrl, options.fetchRequestInit, ({ res, result }) => {
526
+ if (!contentType) {
527
+ contentType = res.headers.get("Content-Type") || "";
528
+ }
529
+ return getContentFromDataUrl(result);
530
+ });
531
+ dataURL = makeDataUrl(content, contentType);
532
+ } catch (error) {
533
+ dataURL = options.imagePlaceholder || "";
534
+ let msg = `Failed to fetch resource: ${resourceUrl}`;
535
+ if (error) {
536
+ msg = typeof error === "string" ? error : error.message;
537
+ }
538
+ if (msg) {
539
+ console.warn(msg);
540
+ }
541
+ }
542
+ cache[cacheKey] = dataURL;
543
+ return dataURL;
544
+ }
545
+ async function cloneCanvasElement(canvas) {
546
+ const dataURL = canvas.toDataURL();
547
+ if (dataURL === "data:,") {
548
+ return canvas.cloneNode(false);
549
+ }
550
+ return createImage(dataURL);
551
+ }
552
+ async function cloneVideoElement(video, options) {
553
+ if (video.currentSrc) {
554
+ const canvas = document.createElement("canvas");
555
+ const ctx = canvas.getContext("2d");
556
+ canvas.width = video.clientWidth;
557
+ canvas.height = video.clientHeight;
558
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
559
+ const dataURL2 = canvas.toDataURL();
560
+ return createImage(dataURL2);
561
+ }
562
+ const poster = video.poster;
563
+ const contentType = getMimeType(poster);
564
+ const dataURL = await resourceToDataURL(poster, contentType, options);
565
+ return createImage(dataURL);
566
+ }
567
+ async function cloneIFrameElement(iframe) {
568
+ var _a;
569
+ try {
570
+ if ((_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentDocument) === null || _a === void 0 ? void 0 : _a.body) {
571
+ return await cloneNode(iframe.contentDocument.body, {}, true);
572
+ }
573
+ } catch (_b) {
574
+ }
575
+ return iframe.cloneNode(false);
576
+ }
577
+ async function cloneSingleNode(node, options) {
578
+ if (isInstanceOfElement(node, HTMLCanvasElement)) {
579
+ return cloneCanvasElement(node);
580
+ }
581
+ if (isInstanceOfElement(node, HTMLVideoElement)) {
582
+ return cloneVideoElement(node, options);
583
+ }
584
+ if (isInstanceOfElement(node, HTMLIFrameElement)) {
585
+ return cloneIFrameElement(node);
586
+ }
587
+ return node.cloneNode(false);
588
+ }
589
+ const isSlotElement = (node) => node.tagName != null && node.tagName.toUpperCase() === "SLOT";
590
+ async function cloneChildren(nativeNode, clonedNode, options) {
591
+ var _a, _b;
592
+ let children = [];
593
+ if (isSlotElement(nativeNode) && nativeNode.assignedNodes) {
594
+ children = toArray(nativeNode.assignedNodes());
595
+ } else if (isInstanceOfElement(nativeNode, HTMLIFrameElement) && ((_a = nativeNode.contentDocument) === null || _a === void 0 ? void 0 : _a.body)) {
596
+ children = toArray(nativeNode.contentDocument.body.childNodes);
597
+ } else {
598
+ children = toArray(((_b = nativeNode.shadowRoot) !== null && _b !== void 0 ? _b : nativeNode).childNodes);
599
+ }
600
+ if (children.length === 0 || isInstanceOfElement(nativeNode, HTMLVideoElement)) {
601
+ return clonedNode;
602
+ }
603
+ await children.reduce((deferred, child) => deferred.then(() => cloneNode(child, options)).then((clonedChild) => {
604
+ if (clonedChild) {
605
+ clonedNode.appendChild(clonedChild);
606
+ }
607
+ }), Promise.resolve());
608
+ return clonedNode;
609
+ }
610
+ function cloneCSSStyle(nativeNode, clonedNode) {
611
+ const targetStyle = clonedNode.style;
612
+ if (!targetStyle) {
613
+ return;
614
+ }
615
+ const sourceStyle = window.getComputedStyle(nativeNode);
616
+ if (sourceStyle.cssText) {
617
+ targetStyle.cssText = sourceStyle.cssText;
618
+ targetStyle.transformOrigin = sourceStyle.transformOrigin;
619
+ } else {
620
+ toArray(sourceStyle).forEach((name) => {
621
+ let value = sourceStyle.getPropertyValue(name);
622
+ if (name === "font-size" && value.endsWith("px")) {
623
+ const reducedFont = Math.floor(parseFloat(value.substring(0, value.length - 2))) - 0.1;
624
+ value = `${reducedFont}px`;
625
+ }
626
+ if (isInstanceOfElement(nativeNode, HTMLIFrameElement) && name === "display" && value === "inline") {
627
+ value = "block";
628
+ }
629
+ if (name === "d" && clonedNode.getAttribute("d")) {
630
+ value = `path(${clonedNode.getAttribute("d")})`;
631
+ }
632
+ targetStyle.setProperty(name, value, sourceStyle.getPropertyPriority(name));
633
+ });
634
+ }
635
+ }
636
+ function cloneInputValue(nativeNode, clonedNode) {
637
+ if (isInstanceOfElement(nativeNode, HTMLTextAreaElement)) {
638
+ clonedNode.innerHTML = nativeNode.value;
639
+ }
640
+ if (isInstanceOfElement(nativeNode, HTMLInputElement)) {
641
+ clonedNode.setAttribute("value", nativeNode.value);
642
+ }
643
+ }
644
+ function cloneSelectValue(nativeNode, clonedNode) {
645
+ if (isInstanceOfElement(nativeNode, HTMLSelectElement)) {
646
+ const clonedSelect = clonedNode;
647
+ const selectedOption = Array.from(clonedSelect.children).find((child) => nativeNode.value === child.getAttribute("value"));
648
+ if (selectedOption) {
649
+ selectedOption.setAttribute("selected", "");
650
+ }
651
+ }
652
+ }
653
+ function decorate(nativeNode, clonedNode) {
654
+ if (isInstanceOfElement(clonedNode, Element)) {
655
+ cloneCSSStyle(nativeNode, clonedNode);
656
+ clonePseudoElements(nativeNode, clonedNode);
657
+ cloneInputValue(nativeNode, clonedNode);
658
+ cloneSelectValue(nativeNode, clonedNode);
659
+ }
660
+ return clonedNode;
661
+ }
662
+ async function ensureSVGSymbols(clone, options) {
663
+ const uses = clone.querySelectorAll ? clone.querySelectorAll("use") : [];
664
+ if (uses.length === 0) {
665
+ return clone;
666
+ }
667
+ const processedDefs = {};
668
+ for (let i = 0; i < uses.length; i++) {
669
+ const use = uses[i];
670
+ const id = use.getAttribute("xlink:href");
671
+ if (id) {
672
+ const exist = clone.querySelector(id);
673
+ const definition = document.querySelector(id);
674
+ if (!exist && definition && !processedDefs[id]) {
675
+ processedDefs[id] = await cloneNode(definition, options, true);
676
+ }
677
+ }
678
+ }
679
+ const nodes = Object.values(processedDefs);
680
+ if (nodes.length) {
681
+ const ns = "http://www.w3.org/1999/xhtml";
682
+ const svg = document.createElementNS(ns, "svg");
683
+ svg.setAttribute("xmlns", ns);
684
+ svg.style.position = "absolute";
685
+ svg.style.width = "0";
686
+ svg.style.height = "0";
687
+ svg.style.overflow = "hidden";
688
+ svg.style.display = "none";
689
+ const defs = document.createElementNS(ns, "defs");
690
+ svg.appendChild(defs);
691
+ for (let i = 0; i < nodes.length; i++) {
692
+ defs.appendChild(nodes[i]);
693
+ }
694
+ clone.appendChild(svg);
695
+ }
696
+ return clone;
697
+ }
698
+ async function cloneNode(node, options, isRoot) {
699
+ if (!isRoot && options.filter && !options.filter(node)) {
700
+ return null;
701
+ }
702
+ return Promise.resolve(node).then((clonedNode) => cloneSingleNode(clonedNode, options)).then((clonedNode) => cloneChildren(node, clonedNode, options)).then((clonedNode) => decorate(node, clonedNode)).then((clonedNode) => ensureSVGSymbols(clonedNode, options));
703
+ }
704
+ const URL_REGEX = /url\((['"]?)([^'"]+?)\1\)/g;
705
+ const URL_WITH_FORMAT_REGEX = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g;
706
+ const FONT_SRC_REGEX = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
707
+ function toRegex(url) {
708
+ const escaped = url.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
709
+ return new RegExp(`(url\\(['"]?)(${escaped})(['"]?\\))`, "g");
710
+ }
711
+ function parseURLs(cssText) {
712
+ const urls = [];
713
+ cssText.replace(URL_REGEX, (raw, quotation, url) => {
714
+ urls.push(url);
715
+ return raw;
716
+ });
717
+ return urls.filter((url) => !isDataUrl(url));
718
+ }
719
+ async function embed(cssText, resourceURL, baseURL, options, getContentFromUrl) {
720
+ try {
721
+ const resolvedURL = baseURL ? resolveUrl(resourceURL, baseURL) : resourceURL;
722
+ const contentType = getMimeType(resourceURL);
723
+ let dataURL;
724
+ if (getContentFromUrl) ;
725
+ else {
726
+ dataURL = await resourceToDataURL(resolvedURL, contentType, options);
727
+ }
728
+ return cssText.replace(toRegex(resourceURL), `$1${dataURL}$3`);
729
+ } catch (error) {
730
+ }
731
+ return cssText;
732
+ }
733
+ function filterPreferredFontFormat(str, { preferredFontFormat }) {
734
+ return !preferredFontFormat ? str : str.replace(FONT_SRC_REGEX, (match) => {
735
+ while (true) {
736
+ const [src, , format] = URL_WITH_FORMAT_REGEX.exec(match) || [];
737
+ if (!format) {
738
+ return "";
739
+ }
740
+ if (format === preferredFontFormat) {
741
+ return `src: ${src};`;
742
+ }
743
+ }
744
+ });
745
+ }
746
+ function shouldEmbed(url) {
747
+ return url.search(URL_REGEX) !== -1;
748
+ }
749
+ async function embedResources(cssText, baseUrl, options) {
750
+ if (!shouldEmbed(cssText)) {
751
+ return cssText;
752
+ }
753
+ const filteredCSSText = filterPreferredFontFormat(cssText, options);
754
+ const urls = parseURLs(filteredCSSText);
755
+ return urls.reduce((deferred, url) => deferred.then((css) => embed(css, url, baseUrl, options)), Promise.resolve(filteredCSSText));
756
+ }
757
+ async function embedProp(propName, node, options) {
758
+ var _a;
759
+ const propValue = (_a = node.style) === null || _a === void 0 ? void 0 : _a.getPropertyValue(propName);
760
+ if (propValue) {
761
+ const cssString = await embedResources(propValue, null, options);
762
+ node.style.setProperty(propName, cssString, node.style.getPropertyPriority(propName));
763
+ return true;
764
+ }
765
+ return false;
766
+ }
767
+ async function embedBackground(clonedNode, options) {
768
+ if (!await embedProp("background", clonedNode, options)) {
769
+ await embedProp("background-image", clonedNode, options);
770
+ }
771
+ if (!await embedProp("mask", clonedNode, options)) {
772
+ await embedProp("mask-image", clonedNode, options);
773
+ }
774
+ }
775
+ async function embedImageNode(clonedNode, options) {
776
+ const isImageElement = isInstanceOfElement(clonedNode, HTMLImageElement);
777
+ if (!(isImageElement && !isDataUrl(clonedNode.src)) && !(isInstanceOfElement(clonedNode, SVGImageElement) && !isDataUrl(clonedNode.href.baseVal))) {
778
+ return;
779
+ }
780
+ const url = isImageElement ? clonedNode.src : clonedNode.href.baseVal;
781
+ const dataURL = await resourceToDataURL(url, getMimeType(url), options);
782
+ await new Promise((resolve, reject) => {
783
+ clonedNode.onload = resolve;
784
+ clonedNode.onerror = reject;
785
+ const image = clonedNode;
786
+ if (image.decode) {
787
+ image.decode = resolve;
788
+ }
789
+ if (image.loading === "lazy") {
790
+ image.loading = "eager";
791
+ }
792
+ if (isImageElement) {
793
+ clonedNode.srcset = "";
794
+ clonedNode.src = dataURL;
795
+ } else {
796
+ clonedNode.href.baseVal = dataURL;
797
+ }
798
+ });
799
+ }
800
+ async function embedChildren(clonedNode, options) {
801
+ const children = toArray(clonedNode.childNodes);
802
+ const deferreds = children.map((child) => embedImages(child, options));
803
+ await Promise.all(deferreds).then(() => clonedNode);
804
+ }
805
+ async function embedImages(clonedNode, options) {
806
+ if (isInstanceOfElement(clonedNode, Element)) {
807
+ await embedBackground(clonedNode, options);
808
+ await embedImageNode(clonedNode, options);
809
+ await embedChildren(clonedNode, options);
810
+ }
811
+ }
812
+ function applyStyle(node, options) {
813
+ const { style } = node;
814
+ if (options.backgroundColor) {
815
+ style.backgroundColor = options.backgroundColor;
816
+ }
817
+ if (options.width) {
818
+ style.width = `${options.width}px`;
819
+ }
820
+ if (options.height) {
821
+ style.height = `${options.height}px`;
822
+ }
823
+ const manual = options.style;
824
+ if (manual != null) {
825
+ Object.keys(manual).forEach((key) => {
826
+ style[key] = manual[key];
827
+ });
828
+ }
829
+ return node;
830
+ }
831
+ const cssFetchCache = {};
832
+ async function fetchCSS(url) {
833
+ let cache2 = cssFetchCache[url];
834
+ if (cache2 != null) {
835
+ return cache2;
836
+ }
837
+ const res = await fetch(url);
838
+ const cssText = await res.text();
839
+ cache2 = { url, cssText };
840
+ cssFetchCache[url] = cache2;
841
+ return cache2;
842
+ }
843
+ async function embedFonts(data, options) {
844
+ let cssText = data.cssText;
845
+ const regexUrl = /url\(["']?([^"')]+)["']?\)/g;
846
+ const fontLocs = cssText.match(/url\([^)]+\)/g) || [];
847
+ const loadFonts = fontLocs.map(async (loc) => {
848
+ let url = loc.replace(regexUrl, "$1");
849
+ if (!url.startsWith("https://")) {
850
+ url = new URL(url, data.url).href;
851
+ }
852
+ return fetchAsDataURL(url, options.fetchRequestInit, ({ result }) => {
853
+ cssText = cssText.replace(loc, `url(${result})`);
854
+ return [loc, result];
855
+ });
856
+ });
857
+ return Promise.all(loadFonts).then(() => cssText);
858
+ }
859
+ function parseCSS(source) {
860
+ if (source == null) {
861
+ return [];
862
+ }
863
+ const result = [];
864
+ const commentsRegex = /(\/\*[\s\S]*?\*\/)/gi;
865
+ let cssText = source.replace(commentsRegex, "");
866
+ const keyframesRegex = new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
867
+ while (true) {
868
+ const matches = keyframesRegex.exec(cssText);
869
+ if (matches === null) {
870
+ break;
871
+ }
872
+ result.push(matches[0]);
873
+ }
874
+ cssText = cssText.replace(keyframesRegex, "");
875
+ const importRegex = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi;
876
+ const combinedCSSRegex = "((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})";
877
+ const unifiedRegex = new RegExp(combinedCSSRegex, "gi");
878
+ while (true) {
879
+ let matches = importRegex.exec(cssText);
880
+ if (matches === null) {
881
+ matches = unifiedRegex.exec(cssText);
882
+ if (matches === null) {
883
+ break;
884
+ } else {
885
+ importRegex.lastIndex = unifiedRegex.lastIndex;
886
+ }
887
+ } else {
888
+ unifiedRegex.lastIndex = importRegex.lastIndex;
889
+ }
890
+ result.push(matches[0]);
891
+ }
892
+ return result;
893
+ }
894
+ async function getCSSRules(styleSheets, options) {
895
+ const ret = [];
896
+ const deferreds = [];
897
+ styleSheets.forEach((sheet) => {
898
+ if ("cssRules" in sheet) {
899
+ try {
900
+ toArray(sheet.cssRules || []).forEach((item, index) => {
901
+ if (item.type === CSSRule.IMPORT_RULE) {
902
+ let importIndex = index + 1;
903
+ const url = item.href;
904
+ const deferred = fetchCSS(url).then((metadata) => embedFonts(metadata, options)).then((cssText) => parseCSS(cssText).forEach((rule) => {
905
+ try {
906
+ sheet.insertRule(rule, rule.startsWith("@import") ? importIndex += 1 : sheet.cssRules.length);
907
+ } catch (error) {
908
+ console.error("Error inserting rule from remote css", {
909
+ rule,
910
+ error
911
+ });
912
+ }
913
+ })).catch((e) => {
914
+ console.error("Error loading remote css", e.toString());
915
+ });
916
+ deferreds.push(deferred);
917
+ }
918
+ });
919
+ } catch (e) {
920
+ const inline = styleSheets.find((a) => a.href == null) || document.styleSheets[0];
921
+ if (sheet.href != null) {
922
+ deferreds.push(fetchCSS(sheet.href).then((metadata) => embedFonts(metadata, options)).then((cssText) => parseCSS(cssText).forEach((rule) => {
923
+ inline.insertRule(rule, sheet.cssRules.length);
924
+ })).catch((err) => {
925
+ console.error("Error loading remote stylesheet", err);
926
+ }));
927
+ }
928
+ console.error("Error inlining remote css file", e);
929
+ }
930
+ }
931
+ });
932
+ return Promise.all(deferreds).then(() => {
933
+ styleSheets.forEach((sheet) => {
934
+ if ("cssRules" in sheet) {
935
+ try {
936
+ toArray(sheet.cssRules || []).forEach((item) => {
937
+ ret.push(item);
938
+ });
939
+ } catch (e) {
940
+ console.error(`Error while reading CSS rules from ${sheet.href}`, e);
941
+ }
942
+ }
943
+ });
944
+ return ret;
945
+ });
946
+ }
947
+ function getWebFontRules(cssRules) {
948
+ return cssRules.filter((rule) => rule.type === CSSRule.FONT_FACE_RULE).filter((rule) => shouldEmbed(rule.style.getPropertyValue("src")));
949
+ }
950
+ async function parseWebFontRules(node, options) {
951
+ if (node.ownerDocument == null) {
952
+ throw new Error("Provided element is not within a Document");
953
+ }
954
+ const styleSheets = toArray(node.ownerDocument.styleSheets);
955
+ const cssRules = await getCSSRules(styleSheets, options);
956
+ return getWebFontRules(cssRules);
957
+ }
958
+ async function getWebFontCSS(node, options) {
959
+ const rules = await parseWebFontRules(node, options);
960
+ const cssTexts = await Promise.all(rules.map((rule) => {
961
+ const baseUrl = rule.parentStyleSheet ? rule.parentStyleSheet.href : null;
962
+ return embedResources(rule.cssText, baseUrl, options);
963
+ }));
964
+ return cssTexts.join("\n");
965
+ }
966
+ async function embedWebFonts(clonedNode, options) {
967
+ const cssText = options.fontEmbedCSS != null ? options.fontEmbedCSS : options.skipFonts ? null : await getWebFontCSS(clonedNode, options);
968
+ if (cssText) {
969
+ const styleNode = document.createElement("style");
970
+ const sytleContent = document.createTextNode(cssText);
971
+ styleNode.appendChild(sytleContent);
972
+ if (clonedNode.firstChild) {
973
+ clonedNode.insertBefore(styleNode, clonedNode.firstChild);
974
+ } else {
975
+ clonedNode.appendChild(styleNode);
976
+ }
977
+ }
978
+ }
979
+ async function toSvg(node, options = {}) {
980
+ const { width, height } = getImageSize(node, options);
981
+ const clonedNode = await cloneNode(node, options, true);
982
+ await embedWebFonts(clonedNode, options);
983
+ await embedImages(clonedNode, options);
984
+ applyStyle(clonedNode, options);
985
+ const datauri = await nodeToDataURL(clonedNode, width, height);
986
+ return datauri;
987
+ }
988
+ async function toCanvas(node, options = {}) {
989
+ const { width, height } = getImageSize(node, options);
990
+ const svg = await toSvg(node, options);
991
+ const img = await createImage(svg);
992
+ const canvas = document.createElement("canvas");
993
+ const context = canvas.getContext("2d");
994
+ const ratio = options.pixelRatio || getPixelRatio();
995
+ const canvasWidth = options.canvasWidth || width;
996
+ const canvasHeight = options.canvasHeight || height;
997
+ canvas.width = canvasWidth * ratio;
998
+ canvas.height = canvasHeight * ratio;
999
+ if (!options.skipAutoScale) {
1000
+ checkCanvasDimensions(canvas);
1001
+ }
1002
+ canvas.style.width = `${canvasWidth}`;
1003
+ canvas.style.height = `${canvasHeight}`;
1004
+ if (options.backgroundColor) {
1005
+ context.fillStyle = options.backgroundColor;
1006
+ context.fillRect(0, 0, canvas.width, canvas.height);
1007
+ }
1008
+ context.drawImage(img, 0, 0, canvas.width, canvas.height);
1009
+ return canvas;
1010
+ }
1011
+ async function toPng(node, options = {}) {
1012
+ const canvas = await toCanvas(node, options);
1013
+ return canvas.toDataURL();
1014
+ }
1015
+ async function toJpeg(node, options = {}) {
1016
+ const canvas = await toCanvas(node, options);
1017
+ return canvas.toDataURL("image/jpeg", options.quality || 1);
1018
+ }
1019
+ async function proxyCSS(options) {
1020
+ try {
1021
+ const css = document.querySelectorAll('link[rel="stylesheet"]');
1022
+ for (let stylesheetElement of css) {
1023
+ let stylesheetURL = stylesheetElement.getAttribute("href");
1024
+ if (stylesheetURL && !stylesheetURL.startsWith("data:") && isValidUrl(stylesheetURL) && !stylesheetURL.startsWith(options.corsProxyBaseUrl)) {
1025
+ const url = options.corsProxyBaseUrl + encodeURIComponent(stylesheetURL);
1026
+ try {
1027
+ const response = await fetch(url);
1028
+ const css2 = await response.text();
1029
+ const styleEl = document.createElement("style");
1030
+ styleEl.textContent = css2;
1031
+ document.head.appendChild(styleEl);
1032
+ stylesheetElement.remove();
1033
+ } catch (error) {
1034
+ console.error("Error fetching CSS:", error);
1035
+ }
1036
+ }
1037
+ }
1038
+ } catch (e) {
1039
+ console.error("ImageExporter: Error in proxyCSS", e);
1040
+ }
1041
+ }
1042
+ async function proxyImages(options) {
1043
+ try {
1044
+ const links = document.querySelectorAll("link");
1045
+ links.forEach((link) => {
1046
+ link.setAttribute("crossorigin", "anonymous");
1047
+ });
1048
+ const wrapper = document.querySelector(options.selectors.wrapper);
1049
+ if (!wrapper) {
1050
+ console.error("ImageExporter: Wrapper element not found.");
1051
+ return;
1052
+ }
1053
+ const images = Array.from(wrapper.querySelectorAll("img"));
1054
+ const srcMap = /* @__PURE__ */ new Map();
1055
+ images.forEach((img) => {
1056
+ const srcs = srcMap.get(img.src) || [];
1057
+ srcs.push(img);
1058
+ srcMap.set(img.src, srcs);
1059
+ });
1060
+ for (const [src, duplicates] of srcMap) {
1061
+ if (!isValidUrl(src) || options.corsProxyBaseUrl && src.startsWith(options.corsProxyBaseUrl)) {
1062
+ continue;
1063
+ }
1064
+ if (duplicates.length > 1) {
1065
+ try {
1066
+ const response = await fetch(
1067
+ options.corsProxyBaseUrl + encodeURIComponent(src)
1068
+ );
1069
+ const blob = await response.blob();
1070
+ const dataURL = await blobToDataURL(blob);
1071
+ duplicates.forEach((dupImg) => {
1072
+ if (dupImg.src === src) {
1073
+ dupImg.src = dataURL;
1074
+ }
1075
+ });
1076
+ } catch (error) {
1077
+ console.error("Error fetching image:", error);
1078
+ }
1079
+ } else {
1080
+ images.forEach((img) => {
1081
+ if (img.src === src) {
1082
+ img.src = options.corsProxyBaseUrl + encodeURIComponent(src);
1083
+ }
1084
+ });
1085
+ }
1086
+ }
1087
+ } catch (e) {
1088
+ console.error("ImageExporter: Error in proxyImages", e);
1089
+ return;
1090
+ }
1091
+ }
1092
+ function blobToDataURL(blob) {
1093
+ return new Promise((resolve, reject) => {
1094
+ const reader = new FileReader();
1095
+ reader.onloadend = () => resolve(reader.result);
1096
+ reader.onerror = reject;
1097
+ reader.readAsDataURL(blob);
1098
+ });
1099
+ }
1100
+ async function runCorsProxy(options) {
1101
+ try {
1102
+ if (!options.corsProxyBaseUrl || !isValidUrl(options.corsProxyBaseUrl)) return;
1103
+ await proxyCSS(options);
1104
+ await proxyImages(options);
1105
+ return;
1106
+ } catch (e) {
1107
+ console.error("ImageExporter: Error in runCorsProxy", e);
1108
+ }
1109
+ }
1110
+ function ignoreFilter(options) {
1111
+ return (node) => {
1112
+ if (!(node instanceof HTMLElement)) {
1113
+ throw new Error("The provided node is not an HTMLElement");
1114
+ }
1115
+ return !node.matches(options.selectors.ignore);
1116
+ };
1117
+ }
1118
+ async function captureImages(options, captureElements) {
1119
+ try {
1120
+ await runCorsProxy(options);
1121
+ const images = await Promise.all(
1122
+ captureElements.map(
1123
+ (element, index) => captureImage(
1124
+ element,
1125
+ getItemOptions(element, options, index + 1),
1126
+ ignoreFilter(options)
1127
+ )
1128
+ )
1129
+ );
1130
+ return images;
1131
+ } catch (e) {
1132
+ console.error("ImageExporter: Error in captureImages", e);
1133
+ return [];
1134
+ }
1135
+ }
1136
+ async function captureImage(element, itemOptions, ignoreFilter2) {
1137
+ try {
1138
+ itemOptions.slug = ensureUniqueSlug(itemOptions.slug);
1139
+ let dataURL = "";
1140
+ let htmlToImageOptions = {
1141
+ // Ensure quality is a number
1142
+ quality: itemOptions.image.quality.value,
1143
+ // Ensure scale is a number
1144
+ pixelRatio: itemOptions.image.scale.value
1145
+ // Function that returns false if the element should be ignored
1146
+ // filter: ignoreFilter,
1147
+ };
1148
+ switch (itemOptions.image.format.value.toLowerCase()) {
1149
+ case "jpg":
1150
+ dataURL = await toJpeg(element, htmlToImageOptions);
1151
+ itemOptions.fileName = `${itemOptions.slug}.jpg`;
1152
+ break;
1153
+ case "png":
1154
+ default:
1155
+ dataURL = await toPng(element, htmlToImageOptions);
1156
+ itemOptions.fileName = `${itemOptions.slug}.png`;
1157
+ break;
1158
+ }
1159
+ return [dataURL, itemOptions.fileName];
1160
+ } catch (e) {
1161
+ console.error("ImageExporter: Error in captureImage", e);
1162
+ return ["", ""];
1163
+ }
1164
+ }
1165
+ let usedSlugs = [];
1166
+ function ensureUniqueSlug(slug) {
1167
+ try {
1168
+ if (usedSlugs.includes(slug)) {
1169
+ let counter = 1;
1170
+ let newSlug = `${slug}-${counter}`;
1171
+ while (usedSlugs.includes(newSlug)) {
1172
+ counter++;
1173
+ newSlug = `${slug}-${counter}`;
1174
+ }
1175
+ usedSlugs.push(newSlug);
1176
+ return newSlug;
1177
+ } else {
1178
+ usedSlugs.push(slug);
1179
+ return slug;
1180
+ }
1181
+ } catch (e) {
1182
+ console.error("ImageExporter: Error in ensureUniqueSlug", e);
1183
+ return slug;
1184
+ }
1185
+ }
1186
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
1187
+ function getDefaultExportFromCjs(x) {
1188
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
1189
+ }
1190
+ var download$1 = { exports: {} };
1191
+ (function(module2, exports3) {
1192
+ (function(root, factory) {
1193
+ {
1194
+ module2.exports = factory();
1195
+ }
1196
+ })(commonjsGlobal, function() {
1197
+ return function download2(data, strFileName, strMimeType) {
1198
+ var self2 = window, defaultMime = "application/octet-stream", mimeType = strMimeType || defaultMime, payload = data, url = !strFileName && !strMimeType && payload, anchor = document.createElement("a"), toString = function(a) {
1199
+ return String(a);
1200
+ }, myBlob = self2.Blob || self2.MozBlob || self2.WebKitBlob || toString, fileName = strFileName || "download", blob, reader;
1201
+ myBlob = myBlob.call ? myBlob.bind(self2) : Blob;
1202
+ if (String(this) === "true") {
1203
+ payload = [payload, mimeType];
1204
+ mimeType = payload[0];
1205
+ payload = payload[1];
1206
+ }
1207
+ if (url && url.length < 2048) {
1208
+ fileName = url.split("/").pop().split("?")[0];
1209
+ anchor.href = url;
1210
+ if (anchor.href.indexOf(url) !== -1) {
1211
+ var ajax = new XMLHttpRequest();
1212
+ ajax.open("GET", url, true);
1213
+ ajax.responseType = "blob";
1214
+ ajax.onload = function(e) {
1215
+ download2(e.target.response, fileName, defaultMime);
1216
+ };
1217
+ setTimeout(function() {
1218
+ ajax.send();
1219
+ }, 0);
1220
+ return ajax;
1221
+ }
1222
+ }
1223
+ if (/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(payload)) {
1224
+ if (payload.length > 1024 * 1024 * 1.999 && myBlob !== toString) {
1225
+ payload = dataUrlToBlob(payload);
1226
+ mimeType = payload.type || defaultMime;
1227
+ } else {
1228
+ return navigator.msSaveBlob ? (
1229
+ // IE10 can't do a[download], only Blobs:
1230
+ navigator.msSaveBlob(dataUrlToBlob(payload), fileName)
1231
+ ) : saver(payload);
1232
+ }
1233
+ } else {
1234
+ if (/([\x80-\xff])/.test(payload)) {
1235
+ var i = 0, tempUiArr = new Uint8Array(payload.length), mx = tempUiArr.length;
1236
+ for (i; i < mx; ++i) tempUiArr[i] = payload.charCodeAt(i);
1237
+ payload = new myBlob([tempUiArr], { type: mimeType });
1238
+ }
1239
+ }
1240
+ blob = payload instanceof myBlob ? payload : new myBlob([payload], { type: mimeType });
1241
+ function dataUrlToBlob(strUrl) {
1242
+ var parts = strUrl.split(/[:;,]/), type = parts[1], decoder = parts[2] == "base64" ? atob : decodeURIComponent, binData = decoder(parts.pop()), mx2 = binData.length, i2 = 0, uiArr = new Uint8Array(mx2);
1243
+ for (i2; i2 < mx2; ++i2) uiArr[i2] = binData.charCodeAt(i2);
1244
+ return new myBlob([uiArr], { type });
1245
+ }
1246
+ function saver(url2, winMode) {
1247
+ if ("download" in anchor) {
1248
+ anchor.href = url2;
1249
+ anchor.setAttribute("download", fileName);
1250
+ anchor.className = "download-js-link";
1251
+ anchor.innerHTML = "downloading...";
1252
+ anchor.style.display = "none";
1253
+ document.body.appendChild(anchor);
1254
+ setTimeout(function() {
1255
+ anchor.click();
1256
+ document.body.removeChild(anchor);
1257
+ if (winMode === true) {
1258
+ setTimeout(function() {
1259
+ self2.URL.revokeObjectURL(anchor.href);
1260
+ }, 250);
1261
+ }
1262
+ }, 66);
1263
+ return true;
1264
+ }
1265
+ if (/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)) {
1266
+ if (/^data:/.test(url2)) url2 = "data:" + url2.replace(/^data:([\w\/\-\+]+)/, defaultMime);
1267
+ if (!window.open(url2)) {
1268
+ if (confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")) {
1269
+ location.href = url2;
1270
+ }
1271
+ }
1272
+ return true;
1273
+ }
1274
+ var f = document.createElement("iframe");
1275
+ document.body.appendChild(f);
1276
+ if (!winMode && /^data:/.test(url2)) {
1277
+ url2 = "data:" + url2.replace(/^data:([\w\/\-\+]+)/, defaultMime);
1278
+ }
1279
+ f.src = url2;
1280
+ setTimeout(function() {
1281
+ document.body.removeChild(f);
1282
+ }, 333);
1283
+ }
1284
+ if (navigator.msSaveBlob) {
1285
+ return navigator.msSaveBlob(blob, fileName);
1286
+ }
1287
+ if (self2.URL) {
1288
+ saver(self2.URL.createObjectURL(blob), true);
1289
+ } else {
1290
+ if (typeof blob === "string" || blob.constructor === toString) {
1291
+ try {
1292
+ return saver("data:" + mimeType + ";base64," + self2.btoa(blob));
1293
+ } catch (y) {
1294
+ return saver("data:" + mimeType + "," + encodeURIComponent(blob));
1295
+ }
1296
+ }
1297
+ reader = new FileReader();
1298
+ reader.onload = function(e) {
1299
+ saver(this.result);
1300
+ };
1301
+ reader.readAsDataURL(blob);
1302
+ }
1303
+ return true;
1304
+ };
1305
+ });
1306
+ })(download$1);
1307
+ var downloadExports = download$1.exports;
1308
+ const download = /* @__PURE__ */ getDefaultExportFromCjs(downloadExports);
1309
+ function commonjsRequire(path) {
1310
+ throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
1311
+ }
1312
+ var jszip_min = { exports: {} };
1313
+ /*!
1314
+
1315
+ JSZip v3.10.1 - A JavaScript class for generating and reading zip files
1316
+ <http://stuartk.com/jszip>
1317
+
1318
+ (c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
1319
+ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
1320
+
1321
+ JSZip uses the library pako released under the MIT license :
1322
+ https://github.com/nodeca/pako/blob/main/LICENSE
1323
+ */
1324
+ (function(module2, exports3) {
1325
+ !function(e) {
1326
+ module2.exports = e();
1327
+ }(function() {
1328
+ return function s(a, o, h) {
1329
+ function u(r, e2) {
1330
+ if (!o[r]) {
1331
+ if (!a[r]) {
1332
+ var t = "function" == typeof commonjsRequire && commonjsRequire;
1333
+ if (!e2 && t) return t(r, true);
1334
+ if (l) return l(r, true);
1335
+ var n = new Error("Cannot find module '" + r + "'");
1336
+ throw n.code = "MODULE_NOT_FOUND", n;
1337
+ }
1338
+ var i = o[r] = { exports: {} };
1339
+ a[r][0].call(i.exports, function(e3) {
1340
+ var t2 = a[r][1][e3];
1341
+ return u(t2 || e3);
1342
+ }, i, i.exports, s, a, o, h);
1343
+ }
1344
+ return o[r].exports;
1345
+ }
1346
+ for (var l = "function" == typeof commonjsRequire && commonjsRequire, e = 0; e < h.length; e++) u(h[e]);
1347
+ return u;
1348
+ }({ 1: [function(e, t, r) {
1349
+ var d = e("./utils"), c = e("./support"), p = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
1350
+ r.encode = function(e2) {
1351
+ for (var t2, r2, n, i, s, a, o, h = [], u = 0, l = e2.length, f = l, c2 = "string" !== d.getTypeOf(e2); u < e2.length; ) f = l - u, n = c2 ? (t2 = e2[u++], r2 = u < l ? e2[u++] : 0, u < l ? e2[u++] : 0) : (t2 = e2.charCodeAt(u++), r2 = u < l ? e2.charCodeAt(u++) : 0, u < l ? e2.charCodeAt(u++) : 0), i = t2 >> 2, s = (3 & t2) << 4 | r2 >> 4, a = 1 < f ? (15 & r2) << 2 | n >> 6 : 64, o = 2 < f ? 63 & n : 64, h.push(p.charAt(i) + p.charAt(s) + p.charAt(a) + p.charAt(o));
1352
+ return h.join("");
1353
+ }, r.decode = function(e2) {
1354
+ var t2, r2, n, i, s, a, o = 0, h = 0, u = "data:";
1355
+ if (e2.substr(0, u.length) === u) throw new Error("Invalid base64 input, it looks like a data url.");
1356
+ var l, f = 3 * (e2 = e2.replace(/[^A-Za-z0-9+/=]/g, "")).length / 4;
1357
+ if (e2.charAt(e2.length - 1) === p.charAt(64) && f--, e2.charAt(e2.length - 2) === p.charAt(64) && f--, f % 1 != 0) throw new Error("Invalid base64 input, bad content length.");
1358
+ for (l = c.uint8array ? new Uint8Array(0 | f) : new Array(0 | f); o < e2.length; ) t2 = p.indexOf(e2.charAt(o++)) << 2 | (i = p.indexOf(e2.charAt(o++))) >> 4, r2 = (15 & i) << 4 | (s = p.indexOf(e2.charAt(o++))) >> 2, n = (3 & s) << 6 | (a = p.indexOf(e2.charAt(o++))), l[h++] = t2, 64 !== s && (l[h++] = r2), 64 !== a && (l[h++] = n);
1359
+ return l;
1360
+ };
1361
+ }, { "./support": 30, "./utils": 32 }], 2: [function(e, t, r) {
1362
+ var n = e("./external"), i = e("./stream/DataWorker"), s = e("./stream/Crc32Probe"), a = e("./stream/DataLengthProbe");
1363
+ function o(e2, t2, r2, n2, i2) {
1364
+ this.compressedSize = e2, this.uncompressedSize = t2, this.crc32 = r2, this.compression = n2, this.compressedContent = i2;
1365
+ }
1366
+ o.prototype = { getContentWorker: function() {
1367
+ var e2 = new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")), t2 = this;
1368
+ return e2.on("end", function() {
1369
+ if (this.streamInfo.data_length !== t2.uncompressedSize) throw new Error("Bug : uncompressed data size mismatch");
1370
+ }), e2;
1371
+ }, getCompressedWorker: function() {
1372
+ return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression);
1373
+ } }, o.createWorkerFrom = function(e2, t2, r2) {
1374
+ return e2.pipe(new s()).pipe(new a("uncompressedSize")).pipe(t2.compressWorker(r2)).pipe(new a("compressedSize")).withStreamInfo("compression", t2);
1375
+ }, t.exports = o;
1376
+ }, { "./external": 6, "./stream/Crc32Probe": 25, "./stream/DataLengthProbe": 26, "./stream/DataWorker": 27 }], 3: [function(e, t, r) {
1377
+ var n = e("./stream/GenericWorker");
1378
+ r.STORE = { magic: "\0\0", compressWorker: function() {
1379
+ return new n("STORE compression");
1380
+ }, uncompressWorker: function() {
1381
+ return new n("STORE decompression");
1382
+ } }, r.DEFLATE = e("./flate");
1383
+ }, { "./flate": 7, "./stream/GenericWorker": 28 }], 4: [function(e, t, r) {
1384
+ var n = e("./utils");
1385
+ var o = function() {
1386
+ for (var e2, t2 = [], r2 = 0; r2 < 256; r2++) {
1387
+ e2 = r2;
1388
+ for (var n2 = 0; n2 < 8; n2++) e2 = 1 & e2 ? 3988292384 ^ e2 >>> 1 : e2 >>> 1;
1389
+ t2[r2] = e2;
1390
+ }
1391
+ return t2;
1392
+ }();
1393
+ t.exports = function(e2, t2) {
1394
+ return void 0 !== e2 && e2.length ? "string" !== n.getTypeOf(e2) ? function(e3, t3, r2, n2) {
1395
+ var i = o, s = n2 + r2;
1396
+ e3 ^= -1;
1397
+ for (var a = n2; a < s; a++) e3 = e3 >>> 8 ^ i[255 & (e3 ^ t3[a])];
1398
+ return -1 ^ e3;
1399
+ }(0 | t2, e2, e2.length, 0) : function(e3, t3, r2, n2) {
1400
+ var i = o, s = n2 + r2;
1401
+ e3 ^= -1;
1402
+ for (var a = n2; a < s; a++) e3 = e3 >>> 8 ^ i[255 & (e3 ^ t3.charCodeAt(a))];
1403
+ return -1 ^ e3;
1404
+ }(0 | t2, e2, e2.length, 0) : 0;
1405
+ };
1406
+ }, { "./utils": 32 }], 5: [function(e, t, r) {
1407
+ r.base64 = false, r.binary = false, r.dir = false, r.createFolders = true, r.date = null, r.compression = null, r.compressionOptions = null, r.comment = null, r.unixPermissions = null, r.dosPermissions = null;
1408
+ }, {}], 6: [function(e, t, r) {
1409
+ var n = null;
1410
+ n = "undefined" != typeof Promise ? Promise : e("lie"), t.exports = { Promise: n };
1411
+ }, { lie: 37 }], 7: [function(e, t, r) {
1412
+ var n = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Uint32Array, i = e("pako"), s = e("./utils"), a = e("./stream/GenericWorker"), o = n ? "uint8array" : "array";
1413
+ function h(e2, t2) {
1414
+ a.call(this, "FlateWorker/" + e2), this._pako = null, this._pakoAction = e2, this._pakoOptions = t2, this.meta = {};
1415
+ }
1416
+ r.magic = "\b\0", s.inherits(h, a), h.prototype.processChunk = function(e2) {
1417
+ this.meta = e2.meta, null === this._pako && this._createPako(), this._pako.push(s.transformTo(o, e2.data), false);
1418
+ }, h.prototype.flush = function() {
1419
+ a.prototype.flush.call(this), null === this._pako && this._createPako(), this._pako.push([], true);
1420
+ }, h.prototype.cleanUp = function() {
1421
+ a.prototype.cleanUp.call(this), this._pako = null;
1422
+ }, h.prototype._createPako = function() {
1423
+ this._pako = new i[this._pakoAction]({ raw: true, level: this._pakoOptions.level || -1 });
1424
+ var t2 = this;
1425
+ this._pako.onData = function(e2) {
1426
+ t2.push({ data: e2, meta: t2.meta });
1427
+ };
1428
+ }, r.compressWorker = function(e2) {
1429
+ return new h("Deflate", e2);
1430
+ }, r.uncompressWorker = function() {
1431
+ return new h("Inflate", {});
1432
+ };
1433
+ }, { "./stream/GenericWorker": 28, "./utils": 32, pako: 38 }], 8: [function(e, t, r) {
1434
+ function A(e2, t2) {
1435
+ var r2, n2 = "";
1436
+ for (r2 = 0; r2 < t2; r2++) n2 += String.fromCharCode(255 & e2), e2 >>>= 8;
1437
+ return n2;
1438
+ }
1439
+ function n(e2, t2, r2, n2, i2, s2) {
1440
+ var a, o, h = e2.file, u = e2.compression, l = s2 !== O.utf8encode, f = I.transformTo("string", s2(h.name)), c = I.transformTo("string", O.utf8encode(h.name)), d = h.comment, p = I.transformTo("string", s2(d)), m = I.transformTo("string", O.utf8encode(d)), _ = c.length !== h.name.length, g = m.length !== d.length, b = "", v = "", y = "", w = h.dir, k = h.date, x = { crc32: 0, compressedSize: 0, uncompressedSize: 0 };
1441
+ t2 && !r2 || (x.crc32 = e2.crc32, x.compressedSize = e2.compressedSize, x.uncompressedSize = e2.uncompressedSize);
1442
+ var S = 0;
1443
+ t2 && (S |= 8), l || !_ && !g || (S |= 2048);
1444
+ var z = 0, C = 0;
1445
+ w && (z |= 16), "UNIX" === i2 ? (C = 798, z |= function(e3, t3) {
1446
+ var r3 = e3;
1447
+ return e3 || (r3 = t3 ? 16893 : 33204), (65535 & r3) << 16;
1448
+ }(h.unixPermissions, w)) : (C = 20, z |= function(e3) {
1449
+ return 63 & (e3 || 0);
1450
+ }(h.dosPermissions)), a = k.getUTCHours(), a <<= 6, a |= k.getUTCMinutes(), a <<= 5, a |= k.getUTCSeconds() / 2, o = k.getUTCFullYear() - 1980, o <<= 4, o |= k.getUTCMonth() + 1, o <<= 5, o |= k.getUTCDate(), _ && (v = A(1, 1) + A(B(f), 4) + c, b += "up" + A(v.length, 2) + v), g && (y = A(1, 1) + A(B(p), 4) + m, b += "uc" + A(y.length, 2) + y);
1451
+ var E = "";
1452
+ return E += "\n\0", E += A(S, 2), E += u.magic, E += A(a, 2), E += A(o, 2), E += A(x.crc32, 4), E += A(x.compressedSize, 4), E += A(x.uncompressedSize, 4), E += A(f.length, 2), E += A(b.length, 2), { fileRecord: R.LOCAL_FILE_HEADER + E + f + b, dirRecord: R.CENTRAL_FILE_HEADER + A(C, 2) + E + A(p.length, 2) + "\0\0\0\0" + A(z, 4) + A(n2, 4) + f + b + p };
1453
+ }
1454
+ var I = e("../utils"), i = e("../stream/GenericWorker"), O = e("../utf8"), B = e("../crc32"), R = e("../signature");
1455
+ function s(e2, t2, r2, n2) {
1456
+ i.call(this, "ZipFileWorker"), this.bytesWritten = 0, this.zipComment = t2, this.zipPlatform = r2, this.encodeFileName = n2, this.streamFiles = e2, this.accumulate = false, this.contentBuffer = [], this.dirRecords = [], this.currentSourceOffset = 0, this.entriesCount = 0, this.currentFile = null, this._sources = [];
1457
+ }
1458
+ I.inherits(s, i), s.prototype.push = function(e2) {
1459
+ var t2 = e2.meta.percent || 0, r2 = this.entriesCount, n2 = this._sources.length;
1460
+ this.accumulate ? this.contentBuffer.push(e2) : (this.bytesWritten += e2.data.length, i.prototype.push.call(this, { data: e2.data, meta: { currentFile: this.currentFile, percent: r2 ? (t2 + 100 * (r2 - n2 - 1)) / r2 : 100 } }));
1461
+ }, s.prototype.openedSource = function(e2) {
1462
+ this.currentSourceOffset = this.bytesWritten, this.currentFile = e2.file.name;
1463
+ var t2 = this.streamFiles && !e2.file.dir;
1464
+ if (t2) {
1465
+ var r2 = n(e2, t2, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
1466
+ this.push({ data: r2.fileRecord, meta: { percent: 0 } });
1467
+ } else this.accumulate = true;
1468
+ }, s.prototype.closedSource = function(e2) {
1469
+ this.accumulate = false;
1470
+ var t2 = this.streamFiles && !e2.file.dir, r2 = n(e2, t2, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
1471
+ if (this.dirRecords.push(r2.dirRecord), t2) this.push({ data: function(e3) {
1472
+ return R.DATA_DESCRIPTOR + A(e3.crc32, 4) + A(e3.compressedSize, 4) + A(e3.uncompressedSize, 4);
1473
+ }(e2), meta: { percent: 100 } });
1474
+ else for (this.push({ data: r2.fileRecord, meta: { percent: 0 } }); this.contentBuffer.length; ) this.push(this.contentBuffer.shift());
1475
+ this.currentFile = null;
1476
+ }, s.prototype.flush = function() {
1477
+ for (var e2 = this.bytesWritten, t2 = 0; t2 < this.dirRecords.length; t2++) this.push({ data: this.dirRecords[t2], meta: { percent: 100 } });
1478
+ var r2 = this.bytesWritten - e2, n2 = function(e3, t3, r3, n3, i2) {
1479
+ var s2 = I.transformTo("string", i2(n3));
1480
+ return R.CENTRAL_DIRECTORY_END + "\0\0\0\0" + A(e3, 2) + A(e3, 2) + A(t3, 4) + A(r3, 4) + A(s2.length, 2) + s2;
1481
+ }(this.dirRecords.length, r2, e2, this.zipComment, this.encodeFileName);
1482
+ this.push({ data: n2, meta: { percent: 100 } });
1483
+ }, s.prototype.prepareNextSource = function() {
1484
+ this.previous = this._sources.shift(), this.openedSource(this.previous.streamInfo), this.isPaused ? this.previous.pause() : this.previous.resume();
1485
+ }, s.prototype.registerPrevious = function(e2) {
1486
+ this._sources.push(e2);
1487
+ var t2 = this;
1488
+ return e2.on("data", function(e3) {
1489
+ t2.processChunk(e3);
1490
+ }), e2.on("end", function() {
1491
+ t2.closedSource(t2.previous.streamInfo), t2._sources.length ? t2.prepareNextSource() : t2.end();
1492
+ }), e2.on("error", function(e3) {
1493
+ t2.error(e3);
1494
+ }), this;
1495
+ }, s.prototype.resume = function() {
1496
+ return !!i.prototype.resume.call(this) && (!this.previous && this._sources.length ? (this.prepareNextSource(), true) : this.previous || this._sources.length || this.generatedError ? void 0 : (this.end(), true));
1497
+ }, s.prototype.error = function(e2) {
1498
+ var t2 = this._sources;
1499
+ if (!i.prototype.error.call(this, e2)) return false;
1500
+ for (var r2 = 0; r2 < t2.length; r2++) try {
1501
+ t2[r2].error(e2);
1502
+ } catch (e3) {
1503
+ }
1504
+ return true;
1505
+ }, s.prototype.lock = function() {
1506
+ i.prototype.lock.call(this);
1507
+ for (var e2 = this._sources, t2 = 0; t2 < e2.length; t2++) e2[t2].lock();
1508
+ }, t.exports = s;
1509
+ }, { "../crc32": 4, "../signature": 23, "../stream/GenericWorker": 28, "../utf8": 31, "../utils": 32 }], 9: [function(e, t, r) {
1510
+ var u = e("../compressions"), n = e("./ZipFileWorker");
1511
+ r.generateWorker = function(e2, a, t2) {
1512
+ var o = new n(a.streamFiles, t2, a.platform, a.encodeFileName), h = 0;
1513
+ try {
1514
+ e2.forEach(function(e3, t3) {
1515
+ h++;
1516
+ var r2 = function(e4, t4) {
1517
+ var r3 = e4 || t4, n3 = u[r3];
1518
+ if (!n3) throw new Error(r3 + " is not a valid compression method !");
1519
+ return n3;
1520
+ }(t3.options.compression, a.compression), n2 = t3.options.compressionOptions || a.compressionOptions || {}, i = t3.dir, s = t3.date;
1521
+ t3._compressWorker(r2, n2).withStreamInfo("file", { name: e3, dir: i, date: s, comment: t3.comment || "", unixPermissions: t3.unixPermissions, dosPermissions: t3.dosPermissions }).pipe(o);
1522
+ }), o.entriesCount = h;
1523
+ } catch (e3) {
1524
+ o.error(e3);
1525
+ }
1526
+ return o;
1527
+ };
1528
+ }, { "../compressions": 3, "./ZipFileWorker": 8 }], 10: [function(e, t, r) {
1529
+ function n() {
1530
+ if (!(this instanceof n)) return new n();
1531
+ if (arguments.length) throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");
1532
+ this.files = /* @__PURE__ */ Object.create(null), this.comment = null, this.root = "", this.clone = function() {
1533
+ var e2 = new n();
1534
+ for (var t2 in this) "function" != typeof this[t2] && (e2[t2] = this[t2]);
1535
+ return e2;
1536
+ };
1537
+ }
1538
+ (n.prototype = e("./object")).loadAsync = e("./load"), n.support = e("./support"), n.defaults = e("./defaults"), n.version = "3.10.1", n.loadAsync = function(e2, t2) {
1539
+ return new n().loadAsync(e2, t2);
1540
+ }, n.external = e("./external"), t.exports = n;
1541
+ }, { "./defaults": 5, "./external": 6, "./load": 11, "./object": 15, "./support": 30 }], 11: [function(e, t, r) {
1542
+ var u = e("./utils"), i = e("./external"), n = e("./utf8"), s = e("./zipEntries"), a = e("./stream/Crc32Probe"), l = e("./nodejsUtils");
1543
+ function f(n2) {
1544
+ return new i.Promise(function(e2, t2) {
1545
+ var r2 = n2.decompressed.getContentWorker().pipe(new a());
1546
+ r2.on("error", function(e3) {
1547
+ t2(e3);
1548
+ }).on("end", function() {
1549
+ r2.streamInfo.crc32 !== n2.decompressed.crc32 ? t2(new Error("Corrupted zip : CRC32 mismatch")) : e2();
1550
+ }).resume();
1551
+ });
1552
+ }
1553
+ t.exports = function(e2, o) {
1554
+ var h = this;
1555
+ return o = u.extend(o || {}, { base64: false, checkCRC32: false, optimizedBinaryString: false, createFolders: false, decodeFileName: n.utf8decode }), l.isNode && l.isStream(e2) ? i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")) : u.prepareContent("the loaded zip file", e2, true, o.optimizedBinaryString, o.base64).then(function(e3) {
1556
+ var t2 = new s(o);
1557
+ return t2.load(e3), t2;
1558
+ }).then(function(e3) {
1559
+ var t2 = [i.Promise.resolve(e3)], r2 = e3.files;
1560
+ if (o.checkCRC32) for (var n2 = 0; n2 < r2.length; n2++) t2.push(f(r2[n2]));
1561
+ return i.Promise.all(t2);
1562
+ }).then(function(e3) {
1563
+ for (var t2 = e3.shift(), r2 = t2.files, n2 = 0; n2 < r2.length; n2++) {
1564
+ var i2 = r2[n2], s2 = i2.fileNameStr, a2 = u.resolve(i2.fileNameStr);
1565
+ h.file(a2, i2.decompressed, { binary: true, optimizedBinaryString: true, date: i2.date, dir: i2.dir, comment: i2.fileCommentStr.length ? i2.fileCommentStr : null, unixPermissions: i2.unixPermissions, dosPermissions: i2.dosPermissions, createFolders: o.createFolders }), i2.dir || (h.file(a2).unsafeOriginalName = s2);
1566
+ }
1567
+ return t2.zipComment.length && (h.comment = t2.zipComment), h;
1568
+ });
1569
+ };
1570
+ }, { "./external": 6, "./nodejsUtils": 14, "./stream/Crc32Probe": 25, "./utf8": 31, "./utils": 32, "./zipEntries": 33 }], 12: [function(e, t, r) {
1571
+ var n = e("../utils"), i = e("../stream/GenericWorker");
1572
+ function s(e2, t2) {
1573
+ i.call(this, "Nodejs stream input adapter for " + e2), this._upstreamEnded = false, this._bindStream(t2);
1574
+ }
1575
+ n.inherits(s, i), s.prototype._bindStream = function(e2) {
1576
+ var t2 = this;
1577
+ (this._stream = e2).pause(), e2.on("data", function(e3) {
1578
+ t2.push({ data: e3, meta: { percent: 0 } });
1579
+ }).on("error", function(e3) {
1580
+ t2.isPaused ? this.generatedError = e3 : t2.error(e3);
1581
+ }).on("end", function() {
1582
+ t2.isPaused ? t2._upstreamEnded = true : t2.end();
1583
+ });
1584
+ }, s.prototype.pause = function() {
1585
+ return !!i.prototype.pause.call(this) && (this._stream.pause(), true);
1586
+ }, s.prototype.resume = function() {
1587
+ return !!i.prototype.resume.call(this) && (this._upstreamEnded ? this.end() : this._stream.resume(), true);
1588
+ }, t.exports = s;
1589
+ }, { "../stream/GenericWorker": 28, "../utils": 32 }], 13: [function(e, t, r) {
1590
+ var i = e("readable-stream").Readable;
1591
+ function n(e2, t2, r2) {
1592
+ i.call(this, t2), this._helper = e2;
1593
+ var n2 = this;
1594
+ e2.on("data", function(e3, t3) {
1595
+ n2.push(e3) || n2._helper.pause(), r2 && r2(t3);
1596
+ }).on("error", function(e3) {
1597
+ n2.emit("error", e3);
1598
+ }).on("end", function() {
1599
+ n2.push(null);
1600
+ });
1601
+ }
1602
+ e("../utils").inherits(n, i), n.prototype._read = function() {
1603
+ this._helper.resume();
1604
+ }, t.exports = n;
1605
+ }, { "../utils": 32, "readable-stream": 16 }], 14: [function(e, t, r) {
1606
+ t.exports = { isNode: "undefined" != typeof Buffer, newBufferFrom: function(e2, t2) {
1607
+ if (Buffer.from && Buffer.from !== Uint8Array.from) return Buffer.from(e2, t2);
1608
+ if ("number" == typeof e2) throw new Error('The "data" argument must not be a number');
1609
+ return new Buffer(e2, t2);
1610
+ }, allocBuffer: function(e2) {
1611
+ if (Buffer.alloc) return Buffer.alloc(e2);
1612
+ var t2 = new Buffer(e2);
1613
+ return t2.fill(0), t2;
1614
+ }, isBuffer: function(e2) {
1615
+ return Buffer.isBuffer(e2);
1616
+ }, isStream: function(e2) {
1617
+ return e2 && "function" == typeof e2.on && "function" == typeof e2.pause && "function" == typeof e2.resume;
1618
+ } };
1619
+ }, {}], 15: [function(e, t, r) {
1620
+ function s(e2, t2, r2) {
1621
+ var n2, i2 = u.getTypeOf(t2), s2 = u.extend(r2 || {}, f);
1622
+ s2.date = s2.date || /* @__PURE__ */ new Date(), null !== s2.compression && (s2.compression = s2.compression.toUpperCase()), "string" == typeof s2.unixPermissions && (s2.unixPermissions = parseInt(s2.unixPermissions, 8)), s2.unixPermissions && 16384 & s2.unixPermissions && (s2.dir = true), s2.dosPermissions && 16 & s2.dosPermissions && (s2.dir = true), s2.dir && (e2 = g(e2)), s2.createFolders && (n2 = _(e2)) && b.call(this, n2, true);
1623
+ var a2 = "string" === i2 && false === s2.binary && false === s2.base64;
1624
+ r2 && void 0 !== r2.binary || (s2.binary = !a2), (t2 instanceof c && 0 === t2.uncompressedSize || s2.dir || !t2 || 0 === t2.length) && (s2.base64 = false, s2.binary = true, t2 = "", s2.compression = "STORE", i2 = "string");
1625
+ var o2 = null;
1626
+ o2 = t2 instanceof c || t2 instanceof l ? t2 : p.isNode && p.isStream(t2) ? new m(e2, t2) : u.prepareContent(e2, t2, s2.binary, s2.optimizedBinaryString, s2.base64);
1627
+ var h2 = new d(e2, o2, s2);
1628
+ this.files[e2] = h2;
1629
+ }
1630
+ var i = e("./utf8"), u = e("./utils"), l = e("./stream/GenericWorker"), a = e("./stream/StreamHelper"), f = e("./defaults"), c = e("./compressedObject"), d = e("./zipObject"), o = e("./generate"), p = e("./nodejsUtils"), m = e("./nodejs/NodejsStreamInputAdapter"), _ = function(e2) {
1631
+ "/" === e2.slice(-1) && (e2 = e2.substring(0, e2.length - 1));
1632
+ var t2 = e2.lastIndexOf("/");
1633
+ return 0 < t2 ? e2.substring(0, t2) : "";
1634
+ }, g = function(e2) {
1635
+ return "/" !== e2.slice(-1) && (e2 += "/"), e2;
1636
+ }, b = function(e2, t2) {
1637
+ return t2 = void 0 !== t2 ? t2 : f.createFolders, e2 = g(e2), this.files[e2] || s.call(this, e2, null, { dir: true, createFolders: t2 }), this.files[e2];
1638
+ };
1639
+ function h(e2) {
1640
+ return "[object RegExp]" === Object.prototype.toString.call(e2);
1641
+ }
1642
+ var n = { load: function() {
1643
+ throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
1644
+ }, forEach: function(e2) {
1645
+ var t2, r2, n2;
1646
+ for (t2 in this.files) n2 = this.files[t2], (r2 = t2.slice(this.root.length, t2.length)) && t2.slice(0, this.root.length) === this.root && e2(r2, n2);
1647
+ }, filter: function(r2) {
1648
+ var n2 = [];
1649
+ return this.forEach(function(e2, t2) {
1650
+ r2(e2, t2) && n2.push(t2);
1651
+ }), n2;
1652
+ }, file: function(e2, t2, r2) {
1653
+ if (1 !== arguments.length) return e2 = this.root + e2, s.call(this, e2, t2, r2), this;
1654
+ if (h(e2)) {
1655
+ var n2 = e2;
1656
+ return this.filter(function(e3, t3) {
1657
+ return !t3.dir && n2.test(e3);
1658
+ });
1659
+ }
1660
+ var i2 = this.files[this.root + e2];
1661
+ return i2 && !i2.dir ? i2 : null;
1662
+ }, folder: function(r2) {
1663
+ if (!r2) return this;
1664
+ if (h(r2)) return this.filter(function(e3, t3) {
1665
+ return t3.dir && r2.test(e3);
1666
+ });
1667
+ var e2 = this.root + r2, t2 = b.call(this, e2), n2 = this.clone();
1668
+ return n2.root = t2.name, n2;
1669
+ }, remove: function(r2) {
1670
+ r2 = this.root + r2;
1671
+ var e2 = this.files[r2];
1672
+ if (e2 || ("/" !== r2.slice(-1) && (r2 += "/"), e2 = this.files[r2]), e2 && !e2.dir) delete this.files[r2];
1673
+ else for (var t2 = this.filter(function(e3, t3) {
1674
+ return t3.name.slice(0, r2.length) === r2;
1675
+ }), n2 = 0; n2 < t2.length; n2++) delete this.files[t2[n2].name];
1676
+ return this;
1677
+ }, generate: function() {
1678
+ throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
1679
+ }, generateInternalStream: function(e2) {
1680
+ var t2, r2 = {};
1681
+ try {
1682
+ if ((r2 = u.extend(e2 || {}, { streamFiles: false, compression: "STORE", compressionOptions: null, type: "", platform: "DOS", comment: null, mimeType: "application/zip", encodeFileName: i.utf8encode })).type = r2.type.toLowerCase(), r2.compression = r2.compression.toUpperCase(), "binarystring" === r2.type && (r2.type = "string"), !r2.type) throw new Error("No output type specified.");
1683
+ u.checkSupport(r2.type), "darwin" !== r2.platform && "freebsd" !== r2.platform && "linux" !== r2.platform && "sunos" !== r2.platform || (r2.platform = "UNIX"), "win32" === r2.platform && (r2.platform = "DOS");
1684
+ var n2 = r2.comment || this.comment || "";
1685
+ t2 = o.generateWorker(this, r2, n2);
1686
+ } catch (e3) {
1687
+ (t2 = new l("error")).error(e3);
1688
+ }
1689
+ return new a(t2, r2.type || "string", r2.mimeType);
1690
+ }, generateAsync: function(e2, t2) {
1691
+ return this.generateInternalStream(e2).accumulate(t2);
1692
+ }, generateNodeStream: function(e2, t2) {
1693
+ return (e2 = e2 || {}).type || (e2.type = "nodebuffer"), this.generateInternalStream(e2).toNodejsStream(t2);
1694
+ } };
1695
+ t.exports = n;
1696
+ }, { "./compressedObject": 2, "./defaults": 5, "./generate": 9, "./nodejs/NodejsStreamInputAdapter": 12, "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31, "./utils": 32, "./zipObject": 35 }], 16: [function(e, t, r) {
1697
+ t.exports = e("stream");
1698
+ }, { stream: void 0 }], 17: [function(e, t, r) {
1699
+ var n = e("./DataReader");
1700
+ function i(e2) {
1701
+ n.call(this, e2);
1702
+ for (var t2 = 0; t2 < this.data.length; t2++) e2[t2] = 255 & e2[t2];
1703
+ }
1704
+ e("../utils").inherits(i, n), i.prototype.byteAt = function(e2) {
1705
+ return this.data[this.zero + e2];
1706
+ }, i.prototype.lastIndexOfSignature = function(e2) {
1707
+ for (var t2 = e2.charCodeAt(0), r2 = e2.charCodeAt(1), n2 = e2.charCodeAt(2), i2 = e2.charCodeAt(3), s = this.length - 4; 0 <= s; --s) if (this.data[s] === t2 && this.data[s + 1] === r2 && this.data[s + 2] === n2 && this.data[s + 3] === i2) return s - this.zero;
1708
+ return -1;
1709
+ }, i.prototype.readAndCheckSignature = function(e2) {
1710
+ var t2 = e2.charCodeAt(0), r2 = e2.charCodeAt(1), n2 = e2.charCodeAt(2), i2 = e2.charCodeAt(3), s = this.readData(4);
1711
+ return t2 === s[0] && r2 === s[1] && n2 === s[2] && i2 === s[3];
1712
+ }, i.prototype.readData = function(e2) {
1713
+ if (this.checkOffset(e2), 0 === e2) return [];
1714
+ var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2);
1715
+ return this.index += e2, t2;
1716
+ }, t.exports = i;
1717
+ }, { "../utils": 32, "./DataReader": 18 }], 18: [function(e, t, r) {
1718
+ var n = e("../utils");
1719
+ function i(e2) {
1720
+ this.data = e2, this.length = e2.length, this.index = 0, this.zero = 0;
1721
+ }
1722
+ i.prototype = { checkOffset: function(e2) {
1723
+ this.checkIndex(this.index + e2);
1724
+ }, checkIndex: function(e2) {
1725
+ if (this.length < this.zero + e2 || e2 < 0) throw new Error("End of data reached (data length = " + this.length + ", asked index = " + e2 + "). Corrupted zip ?");
1726
+ }, setIndex: function(e2) {
1727
+ this.checkIndex(e2), this.index = e2;
1728
+ }, skip: function(e2) {
1729
+ this.setIndex(this.index + e2);
1730
+ }, byteAt: function() {
1731
+ }, readInt: function(e2) {
1732
+ var t2, r2 = 0;
1733
+ for (this.checkOffset(e2), t2 = this.index + e2 - 1; t2 >= this.index; t2--) r2 = (r2 << 8) + this.byteAt(t2);
1734
+ return this.index += e2, r2;
1735
+ }, readString: function(e2) {
1736
+ return n.transformTo("string", this.readData(e2));
1737
+ }, readData: function() {
1738
+ }, lastIndexOfSignature: function() {
1739
+ }, readAndCheckSignature: function() {
1740
+ }, readDate: function() {
1741
+ var e2 = this.readInt(4);
1742
+ return new Date(Date.UTC(1980 + (e2 >> 25 & 127), (e2 >> 21 & 15) - 1, e2 >> 16 & 31, e2 >> 11 & 31, e2 >> 5 & 63, (31 & e2) << 1));
1743
+ } }, t.exports = i;
1744
+ }, { "../utils": 32 }], 19: [function(e, t, r) {
1745
+ var n = e("./Uint8ArrayReader");
1746
+ function i(e2) {
1747
+ n.call(this, e2);
1748
+ }
1749
+ e("../utils").inherits(i, n), i.prototype.readData = function(e2) {
1750
+ this.checkOffset(e2);
1751
+ var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2);
1752
+ return this.index += e2, t2;
1753
+ }, t.exports = i;
1754
+ }, { "../utils": 32, "./Uint8ArrayReader": 21 }], 20: [function(e, t, r) {
1755
+ var n = e("./DataReader");
1756
+ function i(e2) {
1757
+ n.call(this, e2);
1758
+ }
1759
+ e("../utils").inherits(i, n), i.prototype.byteAt = function(e2) {
1760
+ return this.data.charCodeAt(this.zero + e2);
1761
+ }, i.prototype.lastIndexOfSignature = function(e2) {
1762
+ return this.data.lastIndexOf(e2) - this.zero;
1763
+ }, i.prototype.readAndCheckSignature = function(e2) {
1764
+ return e2 === this.readData(4);
1765
+ }, i.prototype.readData = function(e2) {
1766
+ this.checkOffset(e2);
1767
+ var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2);
1768
+ return this.index += e2, t2;
1769
+ }, t.exports = i;
1770
+ }, { "../utils": 32, "./DataReader": 18 }], 21: [function(e, t, r) {
1771
+ var n = e("./ArrayReader");
1772
+ function i(e2) {
1773
+ n.call(this, e2);
1774
+ }
1775
+ e("../utils").inherits(i, n), i.prototype.readData = function(e2) {
1776
+ if (this.checkOffset(e2), 0 === e2) return new Uint8Array(0);
1777
+ var t2 = this.data.subarray(this.zero + this.index, this.zero + this.index + e2);
1778
+ return this.index += e2, t2;
1779
+ }, t.exports = i;
1780
+ }, { "../utils": 32, "./ArrayReader": 17 }], 22: [function(e, t, r) {
1781
+ var n = e("../utils"), i = e("../support"), s = e("./ArrayReader"), a = e("./StringReader"), o = e("./NodeBufferReader"), h = e("./Uint8ArrayReader");
1782
+ t.exports = function(e2) {
1783
+ var t2 = n.getTypeOf(e2);
1784
+ return n.checkSupport(t2), "string" !== t2 || i.uint8array ? "nodebuffer" === t2 ? new o(e2) : i.uint8array ? new h(n.transformTo("uint8array", e2)) : new s(n.transformTo("array", e2)) : new a(e2);
1785
+ };
1786
+ }, { "../support": 30, "../utils": 32, "./ArrayReader": 17, "./NodeBufferReader": 19, "./StringReader": 20, "./Uint8ArrayReader": 21 }], 23: [function(e, t, r) {
1787
+ r.LOCAL_FILE_HEADER = "PK", r.CENTRAL_FILE_HEADER = "PK", r.CENTRAL_DIRECTORY_END = "PK", r.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x07", r.ZIP64_CENTRAL_DIRECTORY_END = "PK", r.DATA_DESCRIPTOR = "PK\x07\b";
1788
+ }, {}], 24: [function(e, t, r) {
1789
+ var n = e("./GenericWorker"), i = e("../utils");
1790
+ function s(e2) {
1791
+ n.call(this, "ConvertWorker to " + e2), this.destType = e2;
1792
+ }
1793
+ i.inherits(s, n), s.prototype.processChunk = function(e2) {
1794
+ this.push({ data: i.transformTo(this.destType, e2.data), meta: e2.meta });
1795
+ }, t.exports = s;
1796
+ }, { "../utils": 32, "./GenericWorker": 28 }], 25: [function(e, t, r) {
1797
+ var n = e("./GenericWorker"), i = e("../crc32");
1798
+ function s() {
1799
+ n.call(this, "Crc32Probe"), this.withStreamInfo("crc32", 0);
1800
+ }
1801
+ e("../utils").inherits(s, n), s.prototype.processChunk = function(e2) {
1802
+ this.streamInfo.crc32 = i(e2.data, this.streamInfo.crc32 || 0), this.push(e2);
1803
+ }, t.exports = s;
1804
+ }, { "../crc32": 4, "../utils": 32, "./GenericWorker": 28 }], 26: [function(e, t, r) {
1805
+ var n = e("../utils"), i = e("./GenericWorker");
1806
+ function s(e2) {
1807
+ i.call(this, "DataLengthProbe for " + e2), this.propName = e2, this.withStreamInfo(e2, 0);
1808
+ }
1809
+ n.inherits(s, i), s.prototype.processChunk = function(e2) {
1810
+ if (e2) {
1811
+ var t2 = this.streamInfo[this.propName] || 0;
1812
+ this.streamInfo[this.propName] = t2 + e2.data.length;
1813
+ }
1814
+ i.prototype.processChunk.call(this, e2);
1815
+ }, t.exports = s;
1816
+ }, { "../utils": 32, "./GenericWorker": 28 }], 27: [function(e, t, r) {
1817
+ var n = e("../utils"), i = e("./GenericWorker");
1818
+ function s(e2) {
1819
+ i.call(this, "DataWorker");
1820
+ var t2 = this;
1821
+ this.dataIsReady = false, this.index = 0, this.max = 0, this.data = null, this.type = "", this._tickScheduled = false, e2.then(function(e3) {
1822
+ t2.dataIsReady = true, t2.data = e3, t2.max = e3 && e3.length || 0, t2.type = n.getTypeOf(e3), t2.isPaused || t2._tickAndRepeat();
1823
+ }, function(e3) {
1824
+ t2.error(e3);
1825
+ });
1826
+ }
1827
+ n.inherits(s, i), s.prototype.cleanUp = function() {
1828
+ i.prototype.cleanUp.call(this), this.data = null;
1829
+ }, s.prototype.resume = function() {
1830
+ return !!i.prototype.resume.call(this) && (!this._tickScheduled && this.dataIsReady && (this._tickScheduled = true, n.delay(this._tickAndRepeat, [], this)), true);
1831
+ }, s.prototype._tickAndRepeat = function() {
1832
+ this._tickScheduled = false, this.isPaused || this.isFinished || (this._tick(), this.isFinished || (n.delay(this._tickAndRepeat, [], this), this._tickScheduled = true));
1833
+ }, s.prototype._tick = function() {
1834
+ if (this.isPaused || this.isFinished) return false;
1835
+ var e2 = null, t2 = Math.min(this.max, this.index + 16384);
1836
+ if (this.index >= this.max) return this.end();
1837
+ switch (this.type) {
1838
+ case "string":
1839
+ e2 = this.data.substring(this.index, t2);
1840
+ break;
1841
+ case "uint8array":
1842
+ e2 = this.data.subarray(this.index, t2);
1843
+ break;
1844
+ case "array":
1845
+ case "nodebuffer":
1846
+ e2 = this.data.slice(this.index, t2);
1847
+ }
1848
+ return this.index = t2, this.push({ data: e2, meta: { percent: this.max ? this.index / this.max * 100 : 0 } });
1849
+ }, t.exports = s;
1850
+ }, { "../utils": 32, "./GenericWorker": 28 }], 28: [function(e, t, r) {
1851
+ function n(e2) {
1852
+ this.name = e2 || "default", this.streamInfo = {}, this.generatedError = null, this.extraStreamInfo = {}, this.isPaused = true, this.isFinished = false, this.isLocked = false, this._listeners = { data: [], end: [], error: [] }, this.previous = null;
1853
+ }
1854
+ n.prototype = { push: function(e2) {
1855
+ this.emit("data", e2);
1856
+ }, end: function() {
1857
+ if (this.isFinished) return false;
1858
+ this.flush();
1859
+ try {
1860
+ this.emit("end"), this.cleanUp(), this.isFinished = true;
1861
+ } catch (e2) {
1862
+ this.emit("error", e2);
1863
+ }
1864
+ return true;
1865
+ }, error: function(e2) {
1866
+ return !this.isFinished && (this.isPaused ? this.generatedError = e2 : (this.isFinished = true, this.emit("error", e2), this.previous && this.previous.error(e2), this.cleanUp()), true);
1867
+ }, on: function(e2, t2) {
1868
+ return this._listeners[e2].push(t2), this;
1869
+ }, cleanUp: function() {
1870
+ this.streamInfo = this.generatedError = this.extraStreamInfo = null, this._listeners = [];
1871
+ }, emit: function(e2, t2) {
1872
+ if (this._listeners[e2]) for (var r2 = 0; r2 < this._listeners[e2].length; r2++) this._listeners[e2][r2].call(this, t2);
1873
+ }, pipe: function(e2) {
1874
+ return e2.registerPrevious(this);
1875
+ }, registerPrevious: function(e2) {
1876
+ if (this.isLocked) throw new Error("The stream '" + this + "' has already been used.");
1877
+ this.streamInfo = e2.streamInfo, this.mergeStreamInfo(), this.previous = e2;
1878
+ var t2 = this;
1879
+ return e2.on("data", function(e3) {
1880
+ t2.processChunk(e3);
1881
+ }), e2.on("end", function() {
1882
+ t2.end();
1883
+ }), e2.on("error", function(e3) {
1884
+ t2.error(e3);
1885
+ }), this;
1886
+ }, pause: function() {
1887
+ return !this.isPaused && !this.isFinished && (this.isPaused = true, this.previous && this.previous.pause(), true);
1888
+ }, resume: function() {
1889
+ if (!this.isPaused || this.isFinished) return false;
1890
+ var e2 = this.isPaused = false;
1891
+ return this.generatedError && (this.error(this.generatedError), e2 = true), this.previous && this.previous.resume(), !e2;
1892
+ }, flush: function() {
1893
+ }, processChunk: function(e2) {
1894
+ this.push(e2);
1895
+ }, withStreamInfo: function(e2, t2) {
1896
+ return this.extraStreamInfo[e2] = t2, this.mergeStreamInfo(), this;
1897
+ }, mergeStreamInfo: function() {
1898
+ for (var e2 in this.extraStreamInfo) Object.prototype.hasOwnProperty.call(this.extraStreamInfo, e2) && (this.streamInfo[e2] = this.extraStreamInfo[e2]);
1899
+ }, lock: function() {
1900
+ if (this.isLocked) throw new Error("The stream '" + this + "' has already been used.");
1901
+ this.isLocked = true, this.previous && this.previous.lock();
1902
+ }, toString: function() {
1903
+ var e2 = "Worker " + this.name;
1904
+ return this.previous ? this.previous + " -> " + e2 : e2;
1905
+ } }, t.exports = n;
1906
+ }, {}], 29: [function(e, t, r) {
1907
+ var h = e("../utils"), i = e("./ConvertWorker"), s = e("./GenericWorker"), u = e("../base64"), n = e("../support"), a = e("../external"), o = null;
1908
+ if (n.nodestream) try {
1909
+ o = e("../nodejs/NodejsStreamOutputAdapter");
1910
+ } catch (e2) {
1911
+ }
1912
+ function l(e2, o2) {
1913
+ return new a.Promise(function(t2, r2) {
1914
+ var n2 = [], i2 = e2._internalType, s2 = e2._outputType, a2 = e2._mimeType;
1915
+ e2.on("data", function(e3, t3) {
1916
+ n2.push(e3), o2 && o2(t3);
1917
+ }).on("error", function(e3) {
1918
+ n2 = [], r2(e3);
1919
+ }).on("end", function() {
1920
+ try {
1921
+ var e3 = function(e4, t3, r3) {
1922
+ switch (e4) {
1923
+ case "blob":
1924
+ return h.newBlob(h.transformTo("arraybuffer", t3), r3);
1925
+ case "base64":
1926
+ return u.encode(t3);
1927
+ default:
1928
+ return h.transformTo(e4, t3);
1929
+ }
1930
+ }(s2, function(e4, t3) {
1931
+ var r3, n3 = 0, i3 = null, s3 = 0;
1932
+ for (r3 = 0; r3 < t3.length; r3++) s3 += t3[r3].length;
1933
+ switch (e4) {
1934
+ case "string":
1935
+ return t3.join("");
1936
+ case "array":
1937
+ return Array.prototype.concat.apply([], t3);
1938
+ case "uint8array":
1939
+ for (i3 = new Uint8Array(s3), r3 = 0; r3 < t3.length; r3++) i3.set(t3[r3], n3), n3 += t3[r3].length;
1940
+ return i3;
1941
+ case "nodebuffer":
1942
+ return Buffer.concat(t3);
1943
+ default:
1944
+ throw new Error("concat : unsupported type '" + e4 + "'");
1945
+ }
1946
+ }(i2, n2), a2);
1947
+ t2(e3);
1948
+ } catch (e4) {
1949
+ r2(e4);
1950
+ }
1951
+ n2 = [];
1952
+ }).resume();
1953
+ });
1954
+ }
1955
+ function f(e2, t2, r2) {
1956
+ var n2 = t2;
1957
+ switch (t2) {
1958
+ case "blob":
1959
+ case "arraybuffer":
1960
+ n2 = "uint8array";
1961
+ break;
1962
+ case "base64":
1963
+ n2 = "string";
1964
+ }
1965
+ try {
1966
+ this._internalType = n2, this._outputType = t2, this._mimeType = r2, h.checkSupport(n2), this._worker = e2.pipe(new i(n2)), e2.lock();
1967
+ } catch (e3) {
1968
+ this._worker = new s("error"), this._worker.error(e3);
1969
+ }
1970
+ }
1971
+ f.prototype = { accumulate: function(e2) {
1972
+ return l(this, e2);
1973
+ }, on: function(e2, t2) {
1974
+ var r2 = this;
1975
+ return "data" === e2 ? this._worker.on(e2, function(e3) {
1976
+ t2.call(r2, e3.data, e3.meta);
1977
+ }) : this._worker.on(e2, function() {
1978
+ h.delay(t2, arguments, r2);
1979
+ }), this;
1980
+ }, resume: function() {
1981
+ return h.delay(this._worker.resume, [], this._worker), this;
1982
+ }, pause: function() {
1983
+ return this._worker.pause(), this;
1984
+ }, toNodejsStream: function(e2) {
1985
+ if (h.checkSupport("nodestream"), "nodebuffer" !== this._outputType) throw new Error(this._outputType + " is not supported by this method");
1986
+ return new o(this, { objectMode: "nodebuffer" !== this._outputType }, e2);
1987
+ } }, t.exports = f;
1988
+ }, { "../base64": 1, "../external": 6, "../nodejs/NodejsStreamOutputAdapter": 13, "../support": 30, "../utils": 32, "./ConvertWorker": 24, "./GenericWorker": 28 }], 30: [function(e, t, r) {
1989
+ if (r.base64 = true, r.array = true, r.string = true, r.arraybuffer = "undefined" != typeof ArrayBuffer && "undefined" != typeof Uint8Array, r.nodebuffer = "undefined" != typeof Buffer, r.uint8array = "undefined" != typeof Uint8Array, "undefined" == typeof ArrayBuffer) r.blob = false;
1990
+ else {
1991
+ var n = new ArrayBuffer(0);
1992
+ try {
1993
+ r.blob = 0 === new Blob([n], { type: "application/zip" }).size;
1994
+ } catch (e2) {
1995
+ try {
1996
+ var i = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
1997
+ i.append(n), r.blob = 0 === i.getBlob("application/zip").size;
1998
+ } catch (e3) {
1999
+ r.blob = false;
2000
+ }
2001
+ }
2002
+ }
2003
+ try {
2004
+ r.nodestream = !!e("readable-stream").Readable;
2005
+ } catch (e2) {
2006
+ r.nodestream = false;
2007
+ }
2008
+ }, { "readable-stream": 16 }], 31: [function(e, t, s) {
2009
+ for (var o = e("./utils"), h = e("./support"), r = e("./nodejsUtils"), n = e("./stream/GenericWorker"), u = new Array(256), i = 0; i < 256; i++) u[i] = 252 <= i ? 6 : 248 <= i ? 5 : 240 <= i ? 4 : 224 <= i ? 3 : 192 <= i ? 2 : 1;
2010
+ u[254] = u[254] = 1;
2011
+ function a() {
2012
+ n.call(this, "utf-8 decode"), this.leftOver = null;
2013
+ }
2014
+ function l() {
2015
+ n.call(this, "utf-8 encode");
2016
+ }
2017
+ s.utf8encode = function(e2) {
2018
+ return h.nodebuffer ? r.newBufferFrom(e2, "utf-8") : function(e3) {
2019
+ var t2, r2, n2, i2, s2, a2 = e3.length, o2 = 0;
2020
+ for (i2 = 0; i2 < a2; i2++) 55296 == (64512 & (r2 = e3.charCodeAt(i2))) && i2 + 1 < a2 && 56320 == (64512 & (n2 = e3.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), o2 += r2 < 128 ? 1 : r2 < 2048 ? 2 : r2 < 65536 ? 3 : 4;
2021
+ for (t2 = h.uint8array ? new Uint8Array(o2) : new Array(o2), i2 = s2 = 0; s2 < o2; i2++) 55296 == (64512 & (r2 = e3.charCodeAt(i2))) && i2 + 1 < a2 && 56320 == (64512 & (n2 = e3.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), r2 < 128 ? t2[s2++] = r2 : (r2 < 2048 ? t2[s2++] = 192 | r2 >>> 6 : (r2 < 65536 ? t2[s2++] = 224 | r2 >>> 12 : (t2[s2++] = 240 | r2 >>> 18, t2[s2++] = 128 | r2 >>> 12 & 63), t2[s2++] = 128 | r2 >>> 6 & 63), t2[s2++] = 128 | 63 & r2);
2022
+ return t2;
2023
+ }(e2);
2024
+ }, s.utf8decode = function(e2) {
2025
+ return h.nodebuffer ? o.transformTo("nodebuffer", e2).toString("utf-8") : function(e3) {
2026
+ var t2, r2, n2, i2, s2 = e3.length, a2 = new Array(2 * s2);
2027
+ for (t2 = r2 = 0; t2 < s2; ) if ((n2 = e3[t2++]) < 128) a2[r2++] = n2;
2028
+ else if (4 < (i2 = u[n2])) a2[r2++] = 65533, t2 += i2 - 1;
2029
+ else {
2030
+ for (n2 &= 2 === i2 ? 31 : 3 === i2 ? 15 : 7; 1 < i2 && t2 < s2; ) n2 = n2 << 6 | 63 & e3[t2++], i2--;
2031
+ 1 < i2 ? a2[r2++] = 65533 : n2 < 65536 ? a2[r2++] = n2 : (n2 -= 65536, a2[r2++] = 55296 | n2 >> 10 & 1023, a2[r2++] = 56320 | 1023 & n2);
2032
+ }
2033
+ return a2.length !== r2 && (a2.subarray ? a2 = a2.subarray(0, r2) : a2.length = r2), o.applyFromCharCode(a2);
2034
+ }(e2 = o.transformTo(h.uint8array ? "uint8array" : "array", e2));
2035
+ }, o.inherits(a, n), a.prototype.processChunk = function(e2) {
2036
+ var t2 = o.transformTo(h.uint8array ? "uint8array" : "array", e2.data);
2037
+ if (this.leftOver && this.leftOver.length) {
2038
+ if (h.uint8array) {
2039
+ var r2 = t2;
2040
+ (t2 = new Uint8Array(r2.length + this.leftOver.length)).set(this.leftOver, 0), t2.set(r2, this.leftOver.length);
2041
+ } else t2 = this.leftOver.concat(t2);
2042
+ this.leftOver = null;
2043
+ }
2044
+ var n2 = function(e3, t3) {
2045
+ var r3;
2046
+ for ((t3 = t3 || e3.length) > e3.length && (t3 = e3.length), r3 = t3 - 1; 0 <= r3 && 128 == (192 & e3[r3]); ) r3--;
2047
+ return r3 < 0 ? t3 : 0 === r3 ? t3 : r3 + u[e3[r3]] > t3 ? r3 : t3;
2048
+ }(t2), i2 = t2;
2049
+ n2 !== t2.length && (h.uint8array ? (i2 = t2.subarray(0, n2), this.leftOver = t2.subarray(n2, t2.length)) : (i2 = t2.slice(0, n2), this.leftOver = t2.slice(n2, t2.length))), this.push({ data: s.utf8decode(i2), meta: e2.meta });
2050
+ }, a.prototype.flush = function() {
2051
+ this.leftOver && this.leftOver.length && (this.push({ data: s.utf8decode(this.leftOver), meta: {} }), this.leftOver = null);
2052
+ }, s.Utf8DecodeWorker = a, o.inherits(l, n), l.prototype.processChunk = function(e2) {
2053
+ this.push({ data: s.utf8encode(e2.data), meta: e2.meta });
2054
+ }, s.Utf8EncodeWorker = l;
2055
+ }, { "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./support": 30, "./utils": 32 }], 32: [function(e, t, a) {
2056
+ var o = e("./support"), h = e("./base64"), r = e("./nodejsUtils"), u = e("./external");
2057
+ function n(e2) {
2058
+ return e2;
2059
+ }
2060
+ function l(e2, t2) {
2061
+ for (var r2 = 0; r2 < e2.length; ++r2) t2[r2] = 255 & e2.charCodeAt(r2);
2062
+ return t2;
2063
+ }
2064
+ e("setimmediate"), a.newBlob = function(t2, r2) {
2065
+ a.checkSupport("blob");
2066
+ try {
2067
+ return new Blob([t2], { type: r2 });
2068
+ } catch (e2) {
2069
+ try {
2070
+ var n2 = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
2071
+ return n2.append(t2), n2.getBlob(r2);
2072
+ } catch (e3) {
2073
+ throw new Error("Bug : can't construct the Blob.");
2074
+ }
2075
+ }
2076
+ };
2077
+ var i = { stringifyByChunk: function(e2, t2, r2) {
2078
+ var n2 = [], i2 = 0, s2 = e2.length;
2079
+ if (s2 <= r2) return String.fromCharCode.apply(null, e2);
2080
+ for (; i2 < s2; ) "array" === t2 || "nodebuffer" === t2 ? n2.push(String.fromCharCode.apply(null, e2.slice(i2, Math.min(i2 + r2, s2)))) : n2.push(String.fromCharCode.apply(null, e2.subarray(i2, Math.min(i2 + r2, s2)))), i2 += r2;
2081
+ return n2.join("");
2082
+ }, stringifyByChar: function(e2) {
2083
+ for (var t2 = "", r2 = 0; r2 < e2.length; r2++) t2 += String.fromCharCode(e2[r2]);
2084
+ return t2;
2085
+ }, applyCanBeUsed: { uint8array: function() {
2086
+ try {
2087
+ return o.uint8array && 1 === String.fromCharCode.apply(null, new Uint8Array(1)).length;
2088
+ } catch (e2) {
2089
+ return false;
2090
+ }
2091
+ }(), nodebuffer: function() {
2092
+ try {
2093
+ return o.nodebuffer && 1 === String.fromCharCode.apply(null, r.allocBuffer(1)).length;
2094
+ } catch (e2) {
2095
+ return false;
2096
+ }
2097
+ }() } };
2098
+ function s(e2) {
2099
+ var t2 = 65536, r2 = a.getTypeOf(e2), n2 = true;
2100
+ if ("uint8array" === r2 ? n2 = i.applyCanBeUsed.uint8array : "nodebuffer" === r2 && (n2 = i.applyCanBeUsed.nodebuffer), n2) for (; 1 < t2; ) try {
2101
+ return i.stringifyByChunk(e2, r2, t2);
2102
+ } catch (e3) {
2103
+ t2 = Math.floor(t2 / 2);
2104
+ }
2105
+ return i.stringifyByChar(e2);
2106
+ }
2107
+ function f(e2, t2) {
2108
+ for (var r2 = 0; r2 < e2.length; r2++) t2[r2] = e2[r2];
2109
+ return t2;
2110
+ }
2111
+ a.applyFromCharCode = s;
2112
+ var c = {};
2113
+ c.string = { string: n, array: function(e2) {
2114
+ return l(e2, new Array(e2.length));
2115
+ }, arraybuffer: function(e2) {
2116
+ return c.string.uint8array(e2).buffer;
2117
+ }, uint8array: function(e2) {
2118
+ return l(e2, new Uint8Array(e2.length));
2119
+ }, nodebuffer: function(e2) {
2120
+ return l(e2, r.allocBuffer(e2.length));
2121
+ } }, c.array = { string: s, array: n, arraybuffer: function(e2) {
2122
+ return new Uint8Array(e2).buffer;
2123
+ }, uint8array: function(e2) {
2124
+ return new Uint8Array(e2);
2125
+ }, nodebuffer: function(e2) {
2126
+ return r.newBufferFrom(e2);
2127
+ } }, c.arraybuffer = { string: function(e2) {
2128
+ return s(new Uint8Array(e2));
2129
+ }, array: function(e2) {
2130
+ return f(new Uint8Array(e2), new Array(e2.byteLength));
2131
+ }, arraybuffer: n, uint8array: function(e2) {
2132
+ return new Uint8Array(e2);
2133
+ }, nodebuffer: function(e2) {
2134
+ return r.newBufferFrom(new Uint8Array(e2));
2135
+ } }, c.uint8array = { string: s, array: function(e2) {
2136
+ return f(e2, new Array(e2.length));
2137
+ }, arraybuffer: function(e2) {
2138
+ return e2.buffer;
2139
+ }, uint8array: n, nodebuffer: function(e2) {
2140
+ return r.newBufferFrom(e2);
2141
+ } }, c.nodebuffer = { string: s, array: function(e2) {
2142
+ return f(e2, new Array(e2.length));
2143
+ }, arraybuffer: function(e2) {
2144
+ return c.nodebuffer.uint8array(e2).buffer;
2145
+ }, uint8array: function(e2) {
2146
+ return f(e2, new Uint8Array(e2.length));
2147
+ }, nodebuffer: n }, a.transformTo = function(e2, t2) {
2148
+ if (t2 = t2 || "", !e2) return t2;
2149
+ a.checkSupport(e2);
2150
+ var r2 = a.getTypeOf(t2);
2151
+ return c[r2][e2](t2);
2152
+ }, a.resolve = function(e2) {
2153
+ for (var t2 = e2.split("/"), r2 = [], n2 = 0; n2 < t2.length; n2++) {
2154
+ var i2 = t2[n2];
2155
+ "." === i2 || "" === i2 && 0 !== n2 && n2 !== t2.length - 1 || (".." === i2 ? r2.pop() : r2.push(i2));
2156
+ }
2157
+ return r2.join("/");
2158
+ }, a.getTypeOf = function(e2) {
2159
+ return "string" == typeof e2 ? "string" : "[object Array]" === Object.prototype.toString.call(e2) ? "array" : o.nodebuffer && r.isBuffer(e2) ? "nodebuffer" : o.uint8array && e2 instanceof Uint8Array ? "uint8array" : o.arraybuffer && e2 instanceof ArrayBuffer ? "arraybuffer" : void 0;
2160
+ }, a.checkSupport = function(e2) {
2161
+ if (!o[e2.toLowerCase()]) throw new Error(e2 + " is not supported by this platform");
2162
+ }, a.MAX_VALUE_16BITS = 65535, a.MAX_VALUE_32BITS = -1, a.pretty = function(e2) {
2163
+ var t2, r2, n2 = "";
2164
+ for (r2 = 0; r2 < (e2 || "").length; r2++) n2 += "\\x" + ((t2 = e2.charCodeAt(r2)) < 16 ? "0" : "") + t2.toString(16).toUpperCase();
2165
+ return n2;
2166
+ }, a.delay = function(e2, t2, r2) {
2167
+ setImmediate(function() {
2168
+ e2.apply(r2 || null, t2 || []);
2169
+ });
2170
+ }, a.inherits = function(e2, t2) {
2171
+ function r2() {
2172
+ }
2173
+ r2.prototype = t2.prototype, e2.prototype = new r2();
2174
+ }, a.extend = function() {
2175
+ var e2, t2, r2 = {};
2176
+ for (e2 = 0; e2 < arguments.length; e2++) for (t2 in arguments[e2]) Object.prototype.hasOwnProperty.call(arguments[e2], t2) && void 0 === r2[t2] && (r2[t2] = arguments[e2][t2]);
2177
+ return r2;
2178
+ }, a.prepareContent = function(r2, e2, n2, i2, s2) {
2179
+ return u.Promise.resolve(e2).then(function(n3) {
2180
+ return o.blob && (n3 instanceof Blob || -1 !== ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(n3))) && "undefined" != typeof FileReader ? new u.Promise(function(t2, r3) {
2181
+ var e3 = new FileReader();
2182
+ e3.onload = function(e4) {
2183
+ t2(e4.target.result);
2184
+ }, e3.onerror = function(e4) {
2185
+ r3(e4.target.error);
2186
+ }, e3.readAsArrayBuffer(n3);
2187
+ }) : n3;
2188
+ }).then(function(e3) {
2189
+ var t2 = a.getTypeOf(e3);
2190
+ return t2 ? ("arraybuffer" === t2 ? e3 = a.transformTo("uint8array", e3) : "string" === t2 && (s2 ? e3 = h.decode(e3) : n2 && true !== i2 && (e3 = function(e4) {
2191
+ return l(e4, o.uint8array ? new Uint8Array(e4.length) : new Array(e4.length));
2192
+ }(e3))), e3) : u.Promise.reject(new Error("Can't read the data of '" + r2 + "'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));
2193
+ });
2194
+ };
2195
+ }, { "./base64": 1, "./external": 6, "./nodejsUtils": 14, "./support": 30, setimmediate: 54 }], 33: [function(e, t, r) {
2196
+ var n = e("./reader/readerFor"), i = e("./utils"), s = e("./signature"), a = e("./zipEntry"), o = e("./support");
2197
+ function h(e2) {
2198
+ this.files = [], this.loadOptions = e2;
2199
+ }
2200
+ h.prototype = { checkSignature: function(e2) {
2201
+ if (!this.reader.readAndCheckSignature(e2)) {
2202
+ this.reader.index -= 4;
2203
+ var t2 = this.reader.readString(4);
2204
+ throw new Error("Corrupted zip or bug: unexpected signature (" + i.pretty(t2) + ", expected " + i.pretty(e2) + ")");
2205
+ }
2206
+ }, isSignature: function(e2, t2) {
2207
+ var r2 = this.reader.index;
2208
+ this.reader.setIndex(e2);
2209
+ var n2 = this.reader.readString(4) === t2;
2210
+ return this.reader.setIndex(r2), n2;
2211
+ }, readBlockEndOfCentral: function() {
2212
+ this.diskNumber = this.reader.readInt(2), this.diskWithCentralDirStart = this.reader.readInt(2), this.centralDirRecordsOnThisDisk = this.reader.readInt(2), this.centralDirRecords = this.reader.readInt(2), this.centralDirSize = this.reader.readInt(4), this.centralDirOffset = this.reader.readInt(4), this.zipCommentLength = this.reader.readInt(2);
2213
+ var e2 = this.reader.readData(this.zipCommentLength), t2 = o.uint8array ? "uint8array" : "array", r2 = i.transformTo(t2, e2);
2214
+ this.zipComment = this.loadOptions.decodeFileName(r2);
2215
+ }, readBlockZip64EndOfCentral: function() {
2216
+ this.zip64EndOfCentralSize = this.reader.readInt(8), this.reader.skip(4), this.diskNumber = this.reader.readInt(4), this.diskWithCentralDirStart = this.reader.readInt(4), this.centralDirRecordsOnThisDisk = this.reader.readInt(8), this.centralDirRecords = this.reader.readInt(8), this.centralDirSize = this.reader.readInt(8), this.centralDirOffset = this.reader.readInt(8), this.zip64ExtensibleData = {};
2217
+ for (var e2, t2, r2, n2 = this.zip64EndOfCentralSize - 44; 0 < n2; ) e2 = this.reader.readInt(2), t2 = this.reader.readInt(4), r2 = this.reader.readData(t2), this.zip64ExtensibleData[e2] = { id: e2, length: t2, value: r2 };
2218
+ }, readBlockZip64EndOfCentralLocator: function() {
2219
+ if (this.diskWithZip64CentralDirStart = this.reader.readInt(4), this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8), this.disksCount = this.reader.readInt(4), 1 < this.disksCount) throw new Error("Multi-volumes zip are not supported");
2220
+ }, readLocalFiles: function() {
2221
+ var e2, t2;
2222
+ for (e2 = 0; e2 < this.files.length; e2++) t2 = this.files[e2], this.reader.setIndex(t2.localHeaderOffset), this.checkSignature(s.LOCAL_FILE_HEADER), t2.readLocalPart(this.reader), t2.handleUTF8(), t2.processAttributes();
2223
+ }, readCentralDir: function() {
2224
+ var e2;
2225
+ for (this.reader.setIndex(this.centralDirOffset); this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER); ) (e2 = new a({ zip64: this.zip64 }, this.loadOptions)).readCentralPart(this.reader), this.files.push(e2);
2226
+ if (this.centralDirRecords !== this.files.length && 0 !== this.centralDirRecords && 0 === this.files.length) throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length);
2227
+ }, readEndOfCentral: function() {
2228
+ var e2 = this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);
2229
+ if (e2 < 0) throw !this.isSignature(0, s.LOCAL_FILE_HEADER) ? new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html") : new Error("Corrupted zip: can't find end of central directory");
2230
+ this.reader.setIndex(e2);
2231
+ var t2 = e2;
2232
+ if (this.checkSignature(s.CENTRAL_DIRECTORY_END), this.readBlockEndOfCentral(), this.diskNumber === i.MAX_VALUE_16BITS || this.diskWithCentralDirStart === i.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === i.MAX_VALUE_16BITS || this.centralDirRecords === i.MAX_VALUE_16BITS || this.centralDirSize === i.MAX_VALUE_32BITS || this.centralDirOffset === i.MAX_VALUE_32BITS) {
2233
+ if (this.zip64 = true, (e2 = this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR)) < 0) throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");
2234
+ if (this.reader.setIndex(e2), this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR), this.readBlockZip64EndOfCentralLocator(), !this.isSignature(this.relativeOffsetEndOfZip64CentralDir, s.ZIP64_CENTRAL_DIRECTORY_END) && (this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END), this.relativeOffsetEndOfZip64CentralDir < 0)) throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");
2235
+ this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir), this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END), this.readBlockZip64EndOfCentral();
2236
+ }
2237
+ var r2 = this.centralDirOffset + this.centralDirSize;
2238
+ this.zip64 && (r2 += 20, r2 += 12 + this.zip64EndOfCentralSize);
2239
+ var n2 = t2 - r2;
2240
+ if (0 < n2) this.isSignature(t2, s.CENTRAL_FILE_HEADER) || (this.reader.zero = n2);
2241
+ else if (n2 < 0) throw new Error("Corrupted zip: missing " + Math.abs(n2) + " bytes.");
2242
+ }, prepareReader: function(e2) {
2243
+ this.reader = n(e2);
2244
+ }, load: function(e2) {
2245
+ this.prepareReader(e2), this.readEndOfCentral(), this.readCentralDir(), this.readLocalFiles();
2246
+ } }, t.exports = h;
2247
+ }, { "./reader/readerFor": 22, "./signature": 23, "./support": 30, "./utils": 32, "./zipEntry": 34 }], 34: [function(e, t, r) {
2248
+ var n = e("./reader/readerFor"), s = e("./utils"), i = e("./compressedObject"), a = e("./crc32"), o = e("./utf8"), h = e("./compressions"), u = e("./support");
2249
+ function l(e2, t2) {
2250
+ this.options = e2, this.loadOptions = t2;
2251
+ }
2252
+ l.prototype = { isEncrypted: function() {
2253
+ return 1 == (1 & this.bitFlag);
2254
+ }, useUTF8: function() {
2255
+ return 2048 == (2048 & this.bitFlag);
2256
+ }, readLocalPart: function(e2) {
2257
+ var t2, r2;
2258
+ if (e2.skip(22), this.fileNameLength = e2.readInt(2), r2 = e2.readInt(2), this.fileName = e2.readData(this.fileNameLength), e2.skip(r2), -1 === this.compressedSize || -1 === this.uncompressedSize) throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");
2259
+ if (null === (t2 = function(e3) {
2260
+ for (var t3 in h) if (Object.prototype.hasOwnProperty.call(h, t3) && h[t3].magic === e3) return h[t3];
2261
+ return null;
2262
+ }(this.compressionMethod))) throw new Error("Corrupted zip : compression " + s.pretty(this.compressionMethod) + " unknown (inner file : " + s.transformTo("string", this.fileName) + ")");
2263
+ this.decompressed = new i(this.compressedSize, this.uncompressedSize, this.crc32, t2, e2.readData(this.compressedSize));
2264
+ }, readCentralPart: function(e2) {
2265
+ this.versionMadeBy = e2.readInt(2), e2.skip(2), this.bitFlag = e2.readInt(2), this.compressionMethod = e2.readString(2), this.date = e2.readDate(), this.crc32 = e2.readInt(4), this.compressedSize = e2.readInt(4), this.uncompressedSize = e2.readInt(4);
2266
+ var t2 = e2.readInt(2);
2267
+ if (this.extraFieldsLength = e2.readInt(2), this.fileCommentLength = e2.readInt(2), this.diskNumberStart = e2.readInt(2), this.internalFileAttributes = e2.readInt(2), this.externalFileAttributes = e2.readInt(4), this.localHeaderOffset = e2.readInt(4), this.isEncrypted()) throw new Error("Encrypted zip are not supported");
2268
+ e2.skip(t2), this.readExtraFields(e2), this.parseZIP64ExtraField(e2), this.fileComment = e2.readData(this.fileCommentLength);
2269
+ }, processAttributes: function() {
2270
+ this.unixPermissions = null, this.dosPermissions = null;
2271
+ var e2 = this.versionMadeBy >> 8;
2272
+ this.dir = !!(16 & this.externalFileAttributes), 0 == e2 && (this.dosPermissions = 63 & this.externalFileAttributes), 3 == e2 && (this.unixPermissions = this.externalFileAttributes >> 16 & 65535), this.dir || "/" !== this.fileNameStr.slice(-1) || (this.dir = true);
2273
+ }, parseZIP64ExtraField: function() {
2274
+ if (this.extraFields[1]) {
2275
+ var e2 = n(this.extraFields[1].value);
2276
+ this.uncompressedSize === s.MAX_VALUE_32BITS && (this.uncompressedSize = e2.readInt(8)), this.compressedSize === s.MAX_VALUE_32BITS && (this.compressedSize = e2.readInt(8)), this.localHeaderOffset === s.MAX_VALUE_32BITS && (this.localHeaderOffset = e2.readInt(8)), this.diskNumberStart === s.MAX_VALUE_32BITS && (this.diskNumberStart = e2.readInt(4));
2277
+ }
2278
+ }, readExtraFields: function(e2) {
2279
+ var t2, r2, n2, i2 = e2.index + this.extraFieldsLength;
2280
+ for (this.extraFields || (this.extraFields = {}); e2.index + 4 < i2; ) t2 = e2.readInt(2), r2 = e2.readInt(2), n2 = e2.readData(r2), this.extraFields[t2] = { id: t2, length: r2, value: n2 };
2281
+ e2.setIndex(i2);
2282
+ }, handleUTF8: function() {
2283
+ var e2 = u.uint8array ? "uint8array" : "array";
2284
+ if (this.useUTF8()) this.fileNameStr = o.utf8decode(this.fileName), this.fileCommentStr = o.utf8decode(this.fileComment);
2285
+ else {
2286
+ var t2 = this.findExtraFieldUnicodePath();
2287
+ if (null !== t2) this.fileNameStr = t2;
2288
+ else {
2289
+ var r2 = s.transformTo(e2, this.fileName);
2290
+ this.fileNameStr = this.loadOptions.decodeFileName(r2);
2291
+ }
2292
+ var n2 = this.findExtraFieldUnicodeComment();
2293
+ if (null !== n2) this.fileCommentStr = n2;
2294
+ else {
2295
+ var i2 = s.transformTo(e2, this.fileComment);
2296
+ this.fileCommentStr = this.loadOptions.decodeFileName(i2);
2297
+ }
2298
+ }
2299
+ }, findExtraFieldUnicodePath: function() {
2300
+ var e2 = this.extraFields[28789];
2301
+ if (e2) {
2302
+ var t2 = n(e2.value);
2303
+ return 1 !== t2.readInt(1) ? null : a(this.fileName) !== t2.readInt(4) ? null : o.utf8decode(t2.readData(e2.length - 5));
2304
+ }
2305
+ return null;
2306
+ }, findExtraFieldUnicodeComment: function() {
2307
+ var e2 = this.extraFields[25461];
2308
+ if (e2) {
2309
+ var t2 = n(e2.value);
2310
+ return 1 !== t2.readInt(1) ? null : a(this.fileComment) !== t2.readInt(4) ? null : o.utf8decode(t2.readData(e2.length - 5));
2311
+ }
2312
+ return null;
2313
+ } }, t.exports = l;
2314
+ }, { "./compressedObject": 2, "./compressions": 3, "./crc32": 4, "./reader/readerFor": 22, "./support": 30, "./utf8": 31, "./utils": 32 }], 35: [function(e, t, r) {
2315
+ function n(e2, t2, r2) {
2316
+ this.name = e2, this.dir = r2.dir, this.date = r2.date, this.comment = r2.comment, this.unixPermissions = r2.unixPermissions, this.dosPermissions = r2.dosPermissions, this._data = t2, this._dataBinary = r2.binary, this.options = { compression: r2.compression, compressionOptions: r2.compressionOptions };
2317
+ }
2318
+ var s = e("./stream/StreamHelper"), i = e("./stream/DataWorker"), a = e("./utf8"), o = e("./compressedObject"), h = e("./stream/GenericWorker");
2319
+ n.prototype = { internalStream: function(e2) {
2320
+ var t2 = null, r2 = "string";
2321
+ try {
2322
+ if (!e2) throw new Error("No output type specified.");
2323
+ var n2 = "string" === (r2 = e2.toLowerCase()) || "text" === r2;
2324
+ "binarystring" !== r2 && "text" !== r2 || (r2 = "string"), t2 = this._decompressWorker();
2325
+ var i2 = !this._dataBinary;
2326
+ i2 && !n2 && (t2 = t2.pipe(new a.Utf8EncodeWorker())), !i2 && n2 && (t2 = t2.pipe(new a.Utf8DecodeWorker()));
2327
+ } catch (e3) {
2328
+ (t2 = new h("error")).error(e3);
2329
+ }
2330
+ return new s(t2, r2, "");
2331
+ }, async: function(e2, t2) {
2332
+ return this.internalStream(e2).accumulate(t2);
2333
+ }, nodeStream: function(e2, t2) {
2334
+ return this.internalStream(e2 || "nodebuffer").toNodejsStream(t2);
2335
+ }, _compressWorker: function(e2, t2) {
2336
+ if (this._data instanceof o && this._data.compression.magic === e2.magic) return this._data.getCompressedWorker();
2337
+ var r2 = this._decompressWorker();
2338
+ return this._dataBinary || (r2 = r2.pipe(new a.Utf8EncodeWorker())), o.createWorkerFrom(r2, e2, t2);
2339
+ }, _decompressWorker: function() {
2340
+ return this._data instanceof o ? this._data.getContentWorker() : this._data instanceof h ? this._data : new i(this._data);
2341
+ } };
2342
+ for (var u = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"], l = function() {
2343
+ throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
2344
+ }, f = 0; f < u.length; f++) n.prototype[u[f]] = l;
2345
+ t.exports = n;
2346
+ }, { "./compressedObject": 2, "./stream/DataWorker": 27, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31 }], 36: [function(e, l, t) {
2347
+ (function(t2) {
2348
+ var r, n, e2 = t2.MutationObserver || t2.WebKitMutationObserver;
2349
+ if (e2) {
2350
+ var i = 0, s = new e2(u), a = t2.document.createTextNode("");
2351
+ s.observe(a, { characterData: true }), r = function() {
2352
+ a.data = i = ++i % 2;
2353
+ };
2354
+ } else if (t2.setImmediate || void 0 === t2.MessageChannel) r = "document" in t2 && "onreadystatechange" in t2.document.createElement("script") ? function() {
2355
+ var e3 = t2.document.createElement("script");
2356
+ e3.onreadystatechange = function() {
2357
+ u(), e3.onreadystatechange = null, e3.parentNode.removeChild(e3), e3 = null;
2358
+ }, t2.document.documentElement.appendChild(e3);
2359
+ } : function() {
2360
+ setTimeout(u, 0);
2361
+ };
2362
+ else {
2363
+ var o = new t2.MessageChannel();
2364
+ o.port1.onmessage = u, r = function() {
2365
+ o.port2.postMessage(0);
2366
+ };
2367
+ }
2368
+ var h = [];
2369
+ function u() {
2370
+ var e3, t3;
2371
+ n = true;
2372
+ for (var r2 = h.length; r2; ) {
2373
+ for (t3 = h, h = [], e3 = -1; ++e3 < r2; ) t3[e3]();
2374
+ r2 = h.length;
2375
+ }
2376
+ n = false;
2377
+ }
2378
+ l.exports = function(e3) {
2379
+ 1 !== h.push(e3) || n || r();
2380
+ };
2381
+ }).call(this, "undefined" != typeof commonjsGlobal ? commonjsGlobal : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
2382
+ }, {}], 37: [function(e, t, r) {
2383
+ var i = e("immediate");
2384
+ function u() {
2385
+ }
2386
+ var l = {}, s = ["REJECTED"], a = ["FULFILLED"], n = ["PENDING"];
2387
+ function o(e2) {
2388
+ if ("function" != typeof e2) throw new TypeError("resolver must be a function");
2389
+ this.state = n, this.queue = [], this.outcome = void 0, e2 !== u && d(this, e2);
2390
+ }
2391
+ function h(e2, t2, r2) {
2392
+ this.promise = e2, "function" == typeof t2 && (this.onFulfilled = t2, this.callFulfilled = this.otherCallFulfilled), "function" == typeof r2 && (this.onRejected = r2, this.callRejected = this.otherCallRejected);
2393
+ }
2394
+ function f(t2, r2, n2) {
2395
+ i(function() {
2396
+ var e2;
2397
+ try {
2398
+ e2 = r2(n2);
2399
+ } catch (e3) {
2400
+ return l.reject(t2, e3);
2401
+ }
2402
+ e2 === t2 ? l.reject(t2, new TypeError("Cannot resolve promise with itself")) : l.resolve(t2, e2);
2403
+ });
2404
+ }
2405
+ function c(e2) {
2406
+ var t2 = e2 && e2.then;
2407
+ if (e2 && ("object" == typeof e2 || "function" == typeof e2) && "function" == typeof t2) return function() {
2408
+ t2.apply(e2, arguments);
2409
+ };
2410
+ }
2411
+ function d(t2, e2) {
2412
+ var r2 = false;
2413
+ function n2(e3) {
2414
+ r2 || (r2 = true, l.reject(t2, e3));
2415
+ }
2416
+ function i2(e3) {
2417
+ r2 || (r2 = true, l.resolve(t2, e3));
2418
+ }
2419
+ var s2 = p(function() {
2420
+ e2(i2, n2);
2421
+ });
2422
+ "error" === s2.status && n2(s2.value);
2423
+ }
2424
+ function p(e2, t2) {
2425
+ var r2 = {};
2426
+ try {
2427
+ r2.value = e2(t2), r2.status = "success";
2428
+ } catch (e3) {
2429
+ r2.status = "error", r2.value = e3;
2430
+ }
2431
+ return r2;
2432
+ }
2433
+ (t.exports = o).prototype.finally = function(t2) {
2434
+ if ("function" != typeof t2) return this;
2435
+ var r2 = this.constructor;
2436
+ return this.then(function(e2) {
2437
+ return r2.resolve(t2()).then(function() {
2438
+ return e2;
2439
+ });
2440
+ }, function(e2) {
2441
+ return r2.resolve(t2()).then(function() {
2442
+ throw e2;
2443
+ });
2444
+ });
2445
+ }, o.prototype.catch = function(e2) {
2446
+ return this.then(null, e2);
2447
+ }, o.prototype.then = function(e2, t2) {
2448
+ if ("function" != typeof e2 && this.state === a || "function" != typeof t2 && this.state === s) return this;
2449
+ var r2 = new this.constructor(u);
2450
+ this.state !== n ? f(r2, this.state === a ? e2 : t2, this.outcome) : this.queue.push(new h(r2, e2, t2));
2451
+ return r2;
2452
+ }, h.prototype.callFulfilled = function(e2) {
2453
+ l.resolve(this.promise, e2);
2454
+ }, h.prototype.otherCallFulfilled = function(e2) {
2455
+ f(this.promise, this.onFulfilled, e2);
2456
+ }, h.prototype.callRejected = function(e2) {
2457
+ l.reject(this.promise, e2);
2458
+ }, h.prototype.otherCallRejected = function(e2) {
2459
+ f(this.promise, this.onRejected, e2);
2460
+ }, l.resolve = function(e2, t2) {
2461
+ var r2 = p(c, t2);
2462
+ if ("error" === r2.status) return l.reject(e2, r2.value);
2463
+ var n2 = r2.value;
2464
+ if (n2) d(e2, n2);
2465
+ else {
2466
+ e2.state = a, e2.outcome = t2;
2467
+ for (var i2 = -1, s2 = e2.queue.length; ++i2 < s2; ) e2.queue[i2].callFulfilled(t2);
2468
+ }
2469
+ return e2;
2470
+ }, l.reject = function(e2, t2) {
2471
+ e2.state = s, e2.outcome = t2;
2472
+ for (var r2 = -1, n2 = e2.queue.length; ++r2 < n2; ) e2.queue[r2].callRejected(t2);
2473
+ return e2;
2474
+ }, o.resolve = function(e2) {
2475
+ if (e2 instanceof this) return e2;
2476
+ return l.resolve(new this(u), e2);
2477
+ }, o.reject = function(e2) {
2478
+ var t2 = new this(u);
2479
+ return l.reject(t2, e2);
2480
+ }, o.all = function(e2) {
2481
+ var r2 = this;
2482
+ if ("[object Array]" !== Object.prototype.toString.call(e2)) return this.reject(new TypeError("must be an array"));
2483
+ var n2 = e2.length, i2 = false;
2484
+ if (!n2) return this.resolve([]);
2485
+ var s2 = new Array(n2), a2 = 0, t2 = -1, o2 = new this(u);
2486
+ for (; ++t2 < n2; ) h2(e2[t2], t2);
2487
+ return o2;
2488
+ function h2(e3, t3) {
2489
+ r2.resolve(e3).then(function(e4) {
2490
+ s2[t3] = e4, ++a2 !== n2 || i2 || (i2 = true, l.resolve(o2, s2));
2491
+ }, function(e4) {
2492
+ i2 || (i2 = true, l.reject(o2, e4));
2493
+ });
2494
+ }
2495
+ }, o.race = function(e2) {
2496
+ var t2 = this;
2497
+ if ("[object Array]" !== Object.prototype.toString.call(e2)) return this.reject(new TypeError("must be an array"));
2498
+ var r2 = e2.length, n2 = false;
2499
+ if (!r2) return this.resolve([]);
2500
+ var i2 = -1, s2 = new this(u);
2501
+ for (; ++i2 < r2; ) a2 = e2[i2], t2.resolve(a2).then(function(e3) {
2502
+ n2 || (n2 = true, l.resolve(s2, e3));
2503
+ }, function(e3) {
2504
+ n2 || (n2 = true, l.reject(s2, e3));
2505
+ });
2506
+ var a2;
2507
+ return s2;
2508
+ };
2509
+ }, { immediate: 36 }], 38: [function(e, t, r) {
2510
+ var n = {};
2511
+ (0, e("./lib/utils/common").assign)(n, e("./lib/deflate"), e("./lib/inflate"), e("./lib/zlib/constants")), t.exports = n;
2512
+ }, { "./lib/deflate": 39, "./lib/inflate": 40, "./lib/utils/common": 41, "./lib/zlib/constants": 44 }], 39: [function(e, t, r) {
2513
+ var a = e("./zlib/deflate"), o = e("./utils/common"), h = e("./utils/strings"), i = e("./zlib/messages"), s = e("./zlib/zstream"), u = Object.prototype.toString, l = 0, f = -1, c = 0, d = 8;
2514
+ function p(e2) {
2515
+ if (!(this instanceof p)) return new p(e2);
2516
+ this.options = o.assign({ level: f, method: d, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: c, to: "" }, e2 || {});
2517
+ var t2 = this.options;
2518
+ t2.raw && 0 < t2.windowBits ? t2.windowBits = -t2.windowBits : t2.gzip && 0 < t2.windowBits && t2.windowBits < 16 && (t2.windowBits += 16), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new s(), this.strm.avail_out = 0;
2519
+ var r2 = a.deflateInit2(this.strm, t2.level, t2.method, t2.windowBits, t2.memLevel, t2.strategy);
2520
+ if (r2 !== l) throw new Error(i[r2]);
2521
+ if (t2.header && a.deflateSetHeader(this.strm, t2.header), t2.dictionary) {
2522
+ var n2;
2523
+ if (n2 = "string" == typeof t2.dictionary ? h.string2buf(t2.dictionary) : "[object ArrayBuffer]" === u.call(t2.dictionary) ? new Uint8Array(t2.dictionary) : t2.dictionary, (r2 = a.deflateSetDictionary(this.strm, n2)) !== l) throw new Error(i[r2]);
2524
+ this._dict_set = true;
2525
+ }
2526
+ }
2527
+ function n(e2, t2) {
2528
+ var r2 = new p(t2);
2529
+ if (r2.push(e2, true), r2.err) throw r2.msg || i[r2.err];
2530
+ return r2.result;
2531
+ }
2532
+ p.prototype.push = function(e2, t2) {
2533
+ var r2, n2, i2 = this.strm, s2 = this.options.chunkSize;
2534
+ if (this.ended) return false;
2535
+ n2 = t2 === ~~t2 ? t2 : true === t2 ? 4 : 0, "string" == typeof e2 ? i2.input = h.string2buf(e2) : "[object ArrayBuffer]" === u.call(e2) ? i2.input = new Uint8Array(e2) : i2.input = e2, i2.next_in = 0, i2.avail_in = i2.input.length;
2536
+ do {
2537
+ if (0 === i2.avail_out && (i2.output = new o.Buf8(s2), i2.next_out = 0, i2.avail_out = s2), 1 !== (r2 = a.deflate(i2, n2)) && r2 !== l) return this.onEnd(r2), !(this.ended = true);
2538
+ 0 !== i2.avail_out && (0 !== i2.avail_in || 4 !== n2 && 2 !== n2) || ("string" === this.options.to ? this.onData(h.buf2binstring(o.shrinkBuf(i2.output, i2.next_out))) : this.onData(o.shrinkBuf(i2.output, i2.next_out)));
2539
+ } while ((0 < i2.avail_in || 0 === i2.avail_out) && 1 !== r2);
2540
+ return 4 === n2 ? (r2 = a.deflateEnd(this.strm), this.onEnd(r2), this.ended = true, r2 === l) : 2 !== n2 || (this.onEnd(l), !(i2.avail_out = 0));
2541
+ }, p.prototype.onData = function(e2) {
2542
+ this.chunks.push(e2);
2543
+ }, p.prototype.onEnd = function(e2) {
2544
+ e2 === l && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = o.flattenChunks(this.chunks)), this.chunks = [], this.err = e2, this.msg = this.strm.msg;
2545
+ }, r.Deflate = p, r.deflate = n, r.deflateRaw = function(e2, t2) {
2546
+ return (t2 = t2 || {}).raw = true, n(e2, t2);
2547
+ }, r.gzip = function(e2, t2) {
2548
+ return (t2 = t2 || {}).gzip = true, n(e2, t2);
2549
+ };
2550
+ }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/deflate": 46, "./zlib/messages": 51, "./zlib/zstream": 53 }], 40: [function(e, t, r) {
2551
+ var c = e("./zlib/inflate"), d = e("./utils/common"), p = e("./utils/strings"), m = e("./zlib/constants"), n = e("./zlib/messages"), i = e("./zlib/zstream"), s = e("./zlib/gzheader"), _ = Object.prototype.toString;
2552
+ function a(e2) {
2553
+ if (!(this instanceof a)) return new a(e2);
2554
+ this.options = d.assign({ chunkSize: 16384, windowBits: 0, to: "" }, e2 || {});
2555
+ var t2 = this.options;
2556
+ t2.raw && 0 <= t2.windowBits && t2.windowBits < 16 && (t2.windowBits = -t2.windowBits, 0 === t2.windowBits && (t2.windowBits = -15)), !(0 <= t2.windowBits && t2.windowBits < 16) || e2 && e2.windowBits || (t2.windowBits += 32), 15 < t2.windowBits && t2.windowBits < 48 && 0 == (15 & t2.windowBits) && (t2.windowBits |= 15), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new i(), this.strm.avail_out = 0;
2557
+ var r2 = c.inflateInit2(this.strm, t2.windowBits);
2558
+ if (r2 !== m.Z_OK) throw new Error(n[r2]);
2559
+ this.header = new s(), c.inflateGetHeader(this.strm, this.header);
2560
+ }
2561
+ function o(e2, t2) {
2562
+ var r2 = new a(t2);
2563
+ if (r2.push(e2, true), r2.err) throw r2.msg || n[r2.err];
2564
+ return r2.result;
2565
+ }
2566
+ a.prototype.push = function(e2, t2) {
2567
+ var r2, n2, i2, s2, a2, o2, h = this.strm, u = this.options.chunkSize, l = this.options.dictionary, f = false;
2568
+ if (this.ended) return false;
2569
+ n2 = t2 === ~~t2 ? t2 : true === t2 ? m.Z_FINISH : m.Z_NO_FLUSH, "string" == typeof e2 ? h.input = p.binstring2buf(e2) : "[object ArrayBuffer]" === _.call(e2) ? h.input = new Uint8Array(e2) : h.input = e2, h.next_in = 0, h.avail_in = h.input.length;
2570
+ do {
2571
+ if (0 === h.avail_out && (h.output = new d.Buf8(u), h.next_out = 0, h.avail_out = u), (r2 = c.inflate(h, m.Z_NO_FLUSH)) === m.Z_NEED_DICT && l && (o2 = "string" == typeof l ? p.string2buf(l) : "[object ArrayBuffer]" === _.call(l) ? new Uint8Array(l) : l, r2 = c.inflateSetDictionary(this.strm, o2)), r2 === m.Z_BUF_ERROR && true === f && (r2 = m.Z_OK, f = false), r2 !== m.Z_STREAM_END && r2 !== m.Z_OK) return this.onEnd(r2), !(this.ended = true);
2572
+ h.next_out && (0 !== h.avail_out && r2 !== m.Z_STREAM_END && (0 !== h.avail_in || n2 !== m.Z_FINISH && n2 !== m.Z_SYNC_FLUSH) || ("string" === this.options.to ? (i2 = p.utf8border(h.output, h.next_out), s2 = h.next_out - i2, a2 = p.buf2string(h.output, i2), h.next_out = s2, h.avail_out = u - s2, s2 && d.arraySet(h.output, h.output, i2, s2, 0), this.onData(a2)) : this.onData(d.shrinkBuf(h.output, h.next_out)))), 0 === h.avail_in && 0 === h.avail_out && (f = true);
2573
+ } while ((0 < h.avail_in || 0 === h.avail_out) && r2 !== m.Z_STREAM_END);
2574
+ return r2 === m.Z_STREAM_END && (n2 = m.Z_FINISH), n2 === m.Z_FINISH ? (r2 = c.inflateEnd(this.strm), this.onEnd(r2), this.ended = true, r2 === m.Z_OK) : n2 !== m.Z_SYNC_FLUSH || (this.onEnd(m.Z_OK), !(h.avail_out = 0));
2575
+ }, a.prototype.onData = function(e2) {
2576
+ this.chunks.push(e2);
2577
+ }, a.prototype.onEnd = function(e2) {
2578
+ e2 === m.Z_OK && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = d.flattenChunks(this.chunks)), this.chunks = [], this.err = e2, this.msg = this.strm.msg;
2579
+ }, r.Inflate = a, r.inflate = o, r.inflateRaw = function(e2, t2) {
2580
+ return (t2 = t2 || {}).raw = true, o(e2, t2);
2581
+ }, r.ungzip = o;
2582
+ }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/constants": 44, "./zlib/gzheader": 47, "./zlib/inflate": 49, "./zlib/messages": 51, "./zlib/zstream": 53 }], 41: [function(e, t, r) {
2583
+ var n = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Int32Array;
2584
+ r.assign = function(e2) {
2585
+ for (var t2 = Array.prototype.slice.call(arguments, 1); t2.length; ) {
2586
+ var r2 = t2.shift();
2587
+ if (r2) {
2588
+ if ("object" != typeof r2) throw new TypeError(r2 + "must be non-object");
2589
+ for (var n2 in r2) r2.hasOwnProperty(n2) && (e2[n2] = r2[n2]);
2590
+ }
2591
+ }
2592
+ return e2;
2593
+ }, r.shrinkBuf = function(e2, t2) {
2594
+ return e2.length === t2 ? e2 : e2.subarray ? e2.subarray(0, t2) : (e2.length = t2, e2);
2595
+ };
2596
+ var i = { arraySet: function(e2, t2, r2, n2, i2) {
2597
+ if (t2.subarray && e2.subarray) e2.set(t2.subarray(r2, r2 + n2), i2);
2598
+ else for (var s2 = 0; s2 < n2; s2++) e2[i2 + s2] = t2[r2 + s2];
2599
+ }, flattenChunks: function(e2) {
2600
+ var t2, r2, n2, i2, s2, a;
2601
+ for (t2 = n2 = 0, r2 = e2.length; t2 < r2; t2++) n2 += e2[t2].length;
2602
+ for (a = new Uint8Array(n2), t2 = i2 = 0, r2 = e2.length; t2 < r2; t2++) s2 = e2[t2], a.set(s2, i2), i2 += s2.length;
2603
+ return a;
2604
+ } }, s = { arraySet: function(e2, t2, r2, n2, i2) {
2605
+ for (var s2 = 0; s2 < n2; s2++) e2[i2 + s2] = t2[r2 + s2];
2606
+ }, flattenChunks: function(e2) {
2607
+ return [].concat.apply([], e2);
2608
+ } };
2609
+ r.setTyped = function(e2) {
2610
+ e2 ? (r.Buf8 = Uint8Array, r.Buf16 = Uint16Array, r.Buf32 = Int32Array, r.assign(r, i)) : (r.Buf8 = Array, r.Buf16 = Array, r.Buf32 = Array, r.assign(r, s));
2611
+ }, r.setTyped(n);
2612
+ }, {}], 42: [function(e, t, r) {
2613
+ var h = e("./common"), i = true, s = true;
2614
+ try {
2615
+ String.fromCharCode.apply(null, [0]);
2616
+ } catch (e2) {
2617
+ i = false;
2618
+ }
2619
+ try {
2620
+ String.fromCharCode.apply(null, new Uint8Array(1));
2621
+ } catch (e2) {
2622
+ s = false;
2623
+ }
2624
+ for (var u = new h.Buf8(256), n = 0; n < 256; n++) u[n] = 252 <= n ? 6 : 248 <= n ? 5 : 240 <= n ? 4 : 224 <= n ? 3 : 192 <= n ? 2 : 1;
2625
+ function l(e2, t2) {
2626
+ if (t2 < 65537 && (e2.subarray && s || !e2.subarray && i)) return String.fromCharCode.apply(null, h.shrinkBuf(e2, t2));
2627
+ for (var r2 = "", n2 = 0; n2 < t2; n2++) r2 += String.fromCharCode(e2[n2]);
2628
+ return r2;
2629
+ }
2630
+ u[254] = u[254] = 1, r.string2buf = function(e2) {
2631
+ var t2, r2, n2, i2, s2, a = e2.length, o = 0;
2632
+ for (i2 = 0; i2 < a; i2++) 55296 == (64512 & (r2 = e2.charCodeAt(i2))) && i2 + 1 < a && 56320 == (64512 & (n2 = e2.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), o += r2 < 128 ? 1 : r2 < 2048 ? 2 : r2 < 65536 ? 3 : 4;
2633
+ for (t2 = new h.Buf8(o), i2 = s2 = 0; s2 < o; i2++) 55296 == (64512 & (r2 = e2.charCodeAt(i2))) && i2 + 1 < a && 56320 == (64512 & (n2 = e2.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), r2 < 128 ? t2[s2++] = r2 : (r2 < 2048 ? t2[s2++] = 192 | r2 >>> 6 : (r2 < 65536 ? t2[s2++] = 224 | r2 >>> 12 : (t2[s2++] = 240 | r2 >>> 18, t2[s2++] = 128 | r2 >>> 12 & 63), t2[s2++] = 128 | r2 >>> 6 & 63), t2[s2++] = 128 | 63 & r2);
2634
+ return t2;
2635
+ }, r.buf2binstring = function(e2) {
2636
+ return l(e2, e2.length);
2637
+ }, r.binstring2buf = function(e2) {
2638
+ for (var t2 = new h.Buf8(e2.length), r2 = 0, n2 = t2.length; r2 < n2; r2++) t2[r2] = e2.charCodeAt(r2);
2639
+ return t2;
2640
+ }, r.buf2string = function(e2, t2) {
2641
+ var r2, n2, i2, s2, a = t2 || e2.length, o = new Array(2 * a);
2642
+ for (r2 = n2 = 0; r2 < a; ) if ((i2 = e2[r2++]) < 128) o[n2++] = i2;
2643
+ else if (4 < (s2 = u[i2])) o[n2++] = 65533, r2 += s2 - 1;
2644
+ else {
2645
+ for (i2 &= 2 === s2 ? 31 : 3 === s2 ? 15 : 7; 1 < s2 && r2 < a; ) i2 = i2 << 6 | 63 & e2[r2++], s2--;
2646
+ 1 < s2 ? o[n2++] = 65533 : i2 < 65536 ? o[n2++] = i2 : (i2 -= 65536, o[n2++] = 55296 | i2 >> 10 & 1023, o[n2++] = 56320 | 1023 & i2);
2647
+ }
2648
+ return l(o, n2);
2649
+ }, r.utf8border = function(e2, t2) {
2650
+ var r2;
2651
+ for ((t2 = t2 || e2.length) > e2.length && (t2 = e2.length), r2 = t2 - 1; 0 <= r2 && 128 == (192 & e2[r2]); ) r2--;
2652
+ return r2 < 0 ? t2 : 0 === r2 ? t2 : r2 + u[e2[r2]] > t2 ? r2 : t2;
2653
+ };
2654
+ }, { "./common": 41 }], 43: [function(e, t, r) {
2655
+ t.exports = function(e2, t2, r2, n) {
2656
+ for (var i = 65535 & e2 | 0, s = e2 >>> 16 & 65535 | 0, a = 0; 0 !== r2; ) {
2657
+ for (r2 -= a = 2e3 < r2 ? 2e3 : r2; s = s + (i = i + t2[n++] | 0) | 0, --a; ) ;
2658
+ i %= 65521, s %= 65521;
2659
+ }
2660
+ return i | s << 16 | 0;
2661
+ };
2662
+ }, {}], 44: [function(e, t, r) {
2663
+ t.exports = { Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, Z_BUF_ERROR: -5, Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, Z_BINARY: 0, Z_TEXT: 1, Z_UNKNOWN: 2, Z_DEFLATED: 8 };
2664
+ }, {}], 45: [function(e, t, r) {
2665
+ var o = function() {
2666
+ for (var e2, t2 = [], r2 = 0; r2 < 256; r2++) {
2667
+ e2 = r2;
2668
+ for (var n = 0; n < 8; n++) e2 = 1 & e2 ? 3988292384 ^ e2 >>> 1 : e2 >>> 1;
2669
+ t2[r2] = e2;
2670
+ }
2671
+ return t2;
2672
+ }();
2673
+ t.exports = function(e2, t2, r2, n) {
2674
+ var i = o, s = n + r2;
2675
+ e2 ^= -1;
2676
+ for (var a = n; a < s; a++) e2 = e2 >>> 8 ^ i[255 & (e2 ^ t2[a])];
2677
+ return -1 ^ e2;
2678
+ };
2679
+ }, {}], 46: [function(e, t, r) {
2680
+ var h, c = e("../utils/common"), u = e("./trees"), d = e("./adler32"), p = e("./crc32"), n = e("./messages"), l = 0, f = 4, m = 0, _ = -2, g = -1, b = 4, i = 2, v = 8, y = 9, s = 286, a = 30, o = 19, w = 2 * s + 1, k = 15, x = 3, S = 258, z = S + x + 1, C = 42, E = 113, A = 1, I = 2, O = 3, B = 4;
2681
+ function R(e2, t2) {
2682
+ return e2.msg = n[t2], t2;
2683
+ }
2684
+ function T(e2) {
2685
+ return (e2 << 1) - (4 < e2 ? 9 : 0);
2686
+ }
2687
+ function D(e2) {
2688
+ for (var t2 = e2.length; 0 <= --t2; ) e2[t2] = 0;
2689
+ }
2690
+ function F(e2) {
2691
+ var t2 = e2.state, r2 = t2.pending;
2692
+ r2 > e2.avail_out && (r2 = e2.avail_out), 0 !== r2 && (c.arraySet(e2.output, t2.pending_buf, t2.pending_out, r2, e2.next_out), e2.next_out += r2, t2.pending_out += r2, e2.total_out += r2, e2.avail_out -= r2, t2.pending -= r2, 0 === t2.pending && (t2.pending_out = 0));
2693
+ }
2694
+ function N(e2, t2) {
2695
+ u._tr_flush_block(e2, 0 <= e2.block_start ? e2.block_start : -1, e2.strstart - e2.block_start, t2), e2.block_start = e2.strstart, F(e2.strm);
2696
+ }
2697
+ function U(e2, t2) {
2698
+ e2.pending_buf[e2.pending++] = t2;
2699
+ }
2700
+ function P(e2, t2) {
2701
+ e2.pending_buf[e2.pending++] = t2 >>> 8 & 255, e2.pending_buf[e2.pending++] = 255 & t2;
2702
+ }
2703
+ function L(e2, t2) {
2704
+ var r2, n2, i2 = e2.max_chain_length, s2 = e2.strstart, a2 = e2.prev_length, o2 = e2.nice_match, h2 = e2.strstart > e2.w_size - z ? e2.strstart - (e2.w_size - z) : 0, u2 = e2.window, l2 = e2.w_mask, f2 = e2.prev, c2 = e2.strstart + S, d2 = u2[s2 + a2 - 1], p2 = u2[s2 + a2];
2705
+ e2.prev_length >= e2.good_match && (i2 >>= 2), o2 > e2.lookahead && (o2 = e2.lookahead);
2706
+ do {
2707
+ if (u2[(r2 = t2) + a2] === p2 && u2[r2 + a2 - 1] === d2 && u2[r2] === u2[s2] && u2[++r2] === u2[s2 + 1]) {
2708
+ s2 += 2, r2++;
2709
+ do {
2710
+ } while (u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && s2 < c2);
2711
+ if (n2 = S - (c2 - s2), s2 = c2 - S, a2 < n2) {
2712
+ if (e2.match_start = t2, o2 <= (a2 = n2)) break;
2713
+ d2 = u2[s2 + a2 - 1], p2 = u2[s2 + a2];
2714
+ }
2715
+ }
2716
+ } while ((t2 = f2[t2 & l2]) > h2 && 0 != --i2);
2717
+ return a2 <= e2.lookahead ? a2 : e2.lookahead;
2718
+ }
2719
+ function j(e2) {
2720
+ var t2, r2, n2, i2, s2, a2, o2, h2, u2, l2, f2 = e2.w_size;
2721
+ do {
2722
+ if (i2 = e2.window_size - e2.lookahead - e2.strstart, e2.strstart >= f2 + (f2 - z)) {
2723
+ for (c.arraySet(e2.window, e2.window, f2, f2, 0), e2.match_start -= f2, e2.strstart -= f2, e2.block_start -= f2, t2 = r2 = e2.hash_size; n2 = e2.head[--t2], e2.head[t2] = f2 <= n2 ? n2 - f2 : 0, --r2; ) ;
2724
+ for (t2 = r2 = f2; n2 = e2.prev[--t2], e2.prev[t2] = f2 <= n2 ? n2 - f2 : 0, --r2; ) ;
2725
+ i2 += f2;
2726
+ }
2727
+ if (0 === e2.strm.avail_in) break;
2728
+ if (a2 = e2.strm, o2 = e2.window, h2 = e2.strstart + e2.lookahead, u2 = i2, l2 = void 0, l2 = a2.avail_in, u2 < l2 && (l2 = u2), r2 = 0 === l2 ? 0 : (a2.avail_in -= l2, c.arraySet(o2, a2.input, a2.next_in, l2, h2), 1 === a2.state.wrap ? a2.adler = d(a2.adler, o2, l2, h2) : 2 === a2.state.wrap && (a2.adler = p(a2.adler, o2, l2, h2)), a2.next_in += l2, a2.total_in += l2, l2), e2.lookahead += r2, e2.lookahead + e2.insert >= x) for (s2 = e2.strstart - e2.insert, e2.ins_h = e2.window[s2], e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[s2 + 1]) & e2.hash_mask; e2.insert && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[s2 + x - 1]) & e2.hash_mask, e2.prev[s2 & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = s2, s2++, e2.insert--, !(e2.lookahead + e2.insert < x)); ) ;
2729
+ } while (e2.lookahead < z && 0 !== e2.strm.avail_in);
2730
+ }
2731
+ function Z(e2, t2) {
2732
+ for (var r2, n2; ; ) {
2733
+ if (e2.lookahead < z) {
2734
+ if (j(e2), e2.lookahead < z && t2 === l) return A;
2735
+ if (0 === e2.lookahead) break;
2736
+ }
2737
+ if (r2 = 0, e2.lookahead >= x && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), 0 !== r2 && e2.strstart - r2 <= e2.w_size - z && (e2.match_length = L(e2, r2)), e2.match_length >= x) if (n2 = u._tr_tally(e2, e2.strstart - e2.match_start, e2.match_length - x), e2.lookahead -= e2.match_length, e2.match_length <= e2.max_lazy_match && e2.lookahead >= x) {
2738
+ for (e2.match_length--; e2.strstart++, e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart, 0 != --e2.match_length; ) ;
2739
+ e2.strstart++;
2740
+ } else e2.strstart += e2.match_length, e2.match_length = 0, e2.ins_h = e2.window[e2.strstart], e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + 1]) & e2.hash_mask;
2741
+ else n2 = u._tr_tally(e2, 0, e2.window[e2.strstart]), e2.lookahead--, e2.strstart++;
2742
+ if (n2 && (N(e2, false), 0 === e2.strm.avail_out)) return A;
2743
+ }
2744
+ return e2.insert = e2.strstart < x - 1 ? e2.strstart : x - 1, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : e2.last_lit && (N(e2, false), 0 === e2.strm.avail_out) ? A : I;
2745
+ }
2746
+ function W(e2, t2) {
2747
+ for (var r2, n2, i2; ; ) {
2748
+ if (e2.lookahead < z) {
2749
+ if (j(e2), e2.lookahead < z && t2 === l) return A;
2750
+ if (0 === e2.lookahead) break;
2751
+ }
2752
+ if (r2 = 0, e2.lookahead >= x && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), e2.prev_length = e2.match_length, e2.prev_match = e2.match_start, e2.match_length = x - 1, 0 !== r2 && e2.prev_length < e2.max_lazy_match && e2.strstart - r2 <= e2.w_size - z && (e2.match_length = L(e2, r2), e2.match_length <= 5 && (1 === e2.strategy || e2.match_length === x && 4096 < e2.strstart - e2.match_start) && (e2.match_length = x - 1)), e2.prev_length >= x && e2.match_length <= e2.prev_length) {
2753
+ for (i2 = e2.strstart + e2.lookahead - x, n2 = u._tr_tally(e2, e2.strstart - 1 - e2.prev_match, e2.prev_length - x), e2.lookahead -= e2.prev_length - 1, e2.prev_length -= 2; ++e2.strstart <= i2 && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), 0 != --e2.prev_length; ) ;
2754
+ if (e2.match_available = 0, e2.match_length = x - 1, e2.strstart++, n2 && (N(e2, false), 0 === e2.strm.avail_out)) return A;
2755
+ } else if (e2.match_available) {
2756
+ if ((n2 = u._tr_tally(e2, 0, e2.window[e2.strstart - 1])) && N(e2, false), e2.strstart++, e2.lookahead--, 0 === e2.strm.avail_out) return A;
2757
+ } else e2.match_available = 1, e2.strstart++, e2.lookahead--;
2758
+ }
2759
+ return e2.match_available && (n2 = u._tr_tally(e2, 0, e2.window[e2.strstart - 1]), e2.match_available = 0), e2.insert = e2.strstart < x - 1 ? e2.strstart : x - 1, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : e2.last_lit && (N(e2, false), 0 === e2.strm.avail_out) ? A : I;
2760
+ }
2761
+ function M(e2, t2, r2, n2, i2) {
2762
+ this.good_length = e2, this.max_lazy = t2, this.nice_length = r2, this.max_chain = n2, this.func = i2;
2763
+ }
2764
+ function H() {
2765
+ this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = v, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new c.Buf16(2 * w), this.dyn_dtree = new c.Buf16(2 * (2 * a + 1)), this.bl_tree = new c.Buf16(2 * (2 * o + 1)), D(this.dyn_ltree), D(this.dyn_dtree), D(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new c.Buf16(k + 1), this.heap = new c.Buf16(2 * s + 1), D(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new c.Buf16(2 * s + 1), D(this.depth), this.l_buf = 0, this.lit_bufsize = 0, this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0;
2766
+ }
2767
+ function G(e2) {
2768
+ var t2;
2769
+ return e2 && e2.state ? (e2.total_in = e2.total_out = 0, e2.data_type = i, (t2 = e2.state).pending = 0, t2.pending_out = 0, t2.wrap < 0 && (t2.wrap = -t2.wrap), t2.status = t2.wrap ? C : E, e2.adler = 2 === t2.wrap ? 0 : 1, t2.last_flush = l, u._tr_init(t2), m) : R(e2, _);
2770
+ }
2771
+ function K(e2) {
2772
+ var t2 = G(e2);
2773
+ return t2 === m && function(e3) {
2774
+ e3.window_size = 2 * e3.w_size, D(e3.head), e3.max_lazy_match = h[e3.level].max_lazy, e3.good_match = h[e3.level].good_length, e3.nice_match = h[e3.level].nice_length, e3.max_chain_length = h[e3.level].max_chain, e3.strstart = 0, e3.block_start = 0, e3.lookahead = 0, e3.insert = 0, e3.match_length = e3.prev_length = x - 1, e3.match_available = 0, e3.ins_h = 0;
2775
+ }(e2.state), t2;
2776
+ }
2777
+ function Y(e2, t2, r2, n2, i2, s2) {
2778
+ if (!e2) return _;
2779
+ var a2 = 1;
2780
+ if (t2 === g && (t2 = 6), n2 < 0 ? (a2 = 0, n2 = -n2) : 15 < n2 && (a2 = 2, n2 -= 16), i2 < 1 || y < i2 || r2 !== v || n2 < 8 || 15 < n2 || t2 < 0 || 9 < t2 || s2 < 0 || b < s2) return R(e2, _);
2781
+ 8 === n2 && (n2 = 9);
2782
+ var o2 = new H();
2783
+ return (e2.state = o2).strm = e2, o2.wrap = a2, o2.gzhead = null, o2.w_bits = n2, o2.w_size = 1 << o2.w_bits, o2.w_mask = o2.w_size - 1, o2.hash_bits = i2 + 7, o2.hash_size = 1 << o2.hash_bits, o2.hash_mask = o2.hash_size - 1, o2.hash_shift = ~~((o2.hash_bits + x - 1) / x), o2.window = new c.Buf8(2 * o2.w_size), o2.head = new c.Buf16(o2.hash_size), o2.prev = new c.Buf16(o2.w_size), o2.lit_bufsize = 1 << i2 + 6, o2.pending_buf_size = 4 * o2.lit_bufsize, o2.pending_buf = new c.Buf8(o2.pending_buf_size), o2.d_buf = 1 * o2.lit_bufsize, o2.l_buf = 3 * o2.lit_bufsize, o2.level = t2, o2.strategy = s2, o2.method = r2, K(e2);
2784
+ }
2785
+ h = [new M(0, 0, 0, 0, function(e2, t2) {
2786
+ var r2 = 65535;
2787
+ for (r2 > e2.pending_buf_size - 5 && (r2 = e2.pending_buf_size - 5); ; ) {
2788
+ if (e2.lookahead <= 1) {
2789
+ if (j(e2), 0 === e2.lookahead && t2 === l) return A;
2790
+ if (0 === e2.lookahead) break;
2791
+ }
2792
+ e2.strstart += e2.lookahead, e2.lookahead = 0;
2793
+ var n2 = e2.block_start + r2;
2794
+ if ((0 === e2.strstart || e2.strstart >= n2) && (e2.lookahead = e2.strstart - n2, e2.strstart = n2, N(e2, false), 0 === e2.strm.avail_out)) return A;
2795
+ if (e2.strstart - e2.block_start >= e2.w_size - z && (N(e2, false), 0 === e2.strm.avail_out)) return A;
2796
+ }
2797
+ return e2.insert = 0, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : (e2.strstart > e2.block_start && (N(e2, false), e2.strm.avail_out), A);
2798
+ }), new M(4, 4, 8, 4, Z), new M(4, 5, 16, 8, Z), new M(4, 6, 32, 32, Z), new M(4, 4, 16, 16, W), new M(8, 16, 32, 32, W), new M(8, 16, 128, 128, W), new M(8, 32, 128, 256, W), new M(32, 128, 258, 1024, W), new M(32, 258, 258, 4096, W)], r.deflateInit = function(e2, t2) {
2799
+ return Y(e2, t2, v, 15, 8, 0);
2800
+ }, r.deflateInit2 = Y, r.deflateReset = K, r.deflateResetKeep = G, r.deflateSetHeader = function(e2, t2) {
2801
+ return e2 && e2.state ? 2 !== e2.state.wrap ? _ : (e2.state.gzhead = t2, m) : _;
2802
+ }, r.deflate = function(e2, t2) {
2803
+ var r2, n2, i2, s2;
2804
+ if (!e2 || !e2.state || 5 < t2 || t2 < 0) return e2 ? R(e2, _) : _;
2805
+ if (n2 = e2.state, !e2.output || !e2.input && 0 !== e2.avail_in || 666 === n2.status && t2 !== f) return R(e2, 0 === e2.avail_out ? -5 : _);
2806
+ if (n2.strm = e2, r2 = n2.last_flush, n2.last_flush = t2, n2.status === C) if (2 === n2.wrap) e2.adler = 0, U(n2, 31), U(n2, 139), U(n2, 8), n2.gzhead ? (U(n2, (n2.gzhead.text ? 1 : 0) + (n2.gzhead.hcrc ? 2 : 0) + (n2.gzhead.extra ? 4 : 0) + (n2.gzhead.name ? 8 : 0) + (n2.gzhead.comment ? 16 : 0)), U(n2, 255 & n2.gzhead.time), U(n2, n2.gzhead.time >> 8 & 255), U(n2, n2.gzhead.time >> 16 & 255), U(n2, n2.gzhead.time >> 24 & 255), U(n2, 9 === n2.level ? 2 : 2 <= n2.strategy || n2.level < 2 ? 4 : 0), U(n2, 255 & n2.gzhead.os), n2.gzhead.extra && n2.gzhead.extra.length && (U(n2, 255 & n2.gzhead.extra.length), U(n2, n2.gzhead.extra.length >> 8 & 255)), n2.gzhead.hcrc && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending, 0)), n2.gzindex = 0, n2.status = 69) : (U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 9 === n2.level ? 2 : 2 <= n2.strategy || n2.level < 2 ? 4 : 0), U(n2, 3), n2.status = E);
2807
+ else {
2808
+ var a2 = v + (n2.w_bits - 8 << 4) << 8;
2809
+ a2 |= (2 <= n2.strategy || n2.level < 2 ? 0 : n2.level < 6 ? 1 : 6 === n2.level ? 2 : 3) << 6, 0 !== n2.strstart && (a2 |= 32), a2 += 31 - a2 % 31, n2.status = E, P(n2, a2), 0 !== n2.strstart && (P(n2, e2.adler >>> 16), P(n2, 65535 & e2.adler)), e2.adler = 1;
2810
+ }
2811
+ if (69 === n2.status) if (n2.gzhead.extra) {
2812
+ for (i2 = n2.pending; n2.gzindex < (65535 & n2.gzhead.extra.length) && (n2.pending !== n2.pending_buf_size || (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending !== n2.pending_buf_size)); ) U(n2, 255 & n2.gzhead.extra[n2.gzindex]), n2.gzindex++;
2813
+ n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), n2.gzindex === n2.gzhead.extra.length && (n2.gzindex = 0, n2.status = 73);
2814
+ } else n2.status = 73;
2815
+ if (73 === n2.status) if (n2.gzhead.name) {
2816
+ i2 = n2.pending;
2817
+ do {
2818
+ if (n2.pending === n2.pending_buf_size && (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending === n2.pending_buf_size)) {
2819
+ s2 = 1;
2820
+ break;
2821
+ }
2822
+ s2 = n2.gzindex < n2.gzhead.name.length ? 255 & n2.gzhead.name.charCodeAt(n2.gzindex++) : 0, U(n2, s2);
2823
+ } while (0 !== s2);
2824
+ n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), 0 === s2 && (n2.gzindex = 0, n2.status = 91);
2825
+ } else n2.status = 91;
2826
+ if (91 === n2.status) if (n2.gzhead.comment) {
2827
+ i2 = n2.pending;
2828
+ do {
2829
+ if (n2.pending === n2.pending_buf_size && (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending === n2.pending_buf_size)) {
2830
+ s2 = 1;
2831
+ break;
2832
+ }
2833
+ s2 = n2.gzindex < n2.gzhead.comment.length ? 255 & n2.gzhead.comment.charCodeAt(n2.gzindex++) : 0, U(n2, s2);
2834
+ } while (0 !== s2);
2835
+ n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), 0 === s2 && (n2.status = 103);
2836
+ } else n2.status = 103;
2837
+ if (103 === n2.status && (n2.gzhead.hcrc ? (n2.pending + 2 > n2.pending_buf_size && F(e2), n2.pending + 2 <= n2.pending_buf_size && (U(n2, 255 & e2.adler), U(n2, e2.adler >> 8 & 255), e2.adler = 0, n2.status = E)) : n2.status = E), 0 !== n2.pending) {
2838
+ if (F(e2), 0 === e2.avail_out) return n2.last_flush = -1, m;
2839
+ } else if (0 === e2.avail_in && T(t2) <= T(r2) && t2 !== f) return R(e2, -5);
2840
+ if (666 === n2.status && 0 !== e2.avail_in) return R(e2, -5);
2841
+ if (0 !== e2.avail_in || 0 !== n2.lookahead || t2 !== l && 666 !== n2.status) {
2842
+ var o2 = 2 === n2.strategy ? function(e3, t3) {
2843
+ for (var r3; ; ) {
2844
+ if (0 === e3.lookahead && (j(e3), 0 === e3.lookahead)) {
2845
+ if (t3 === l) return A;
2846
+ break;
2847
+ }
2848
+ if (e3.match_length = 0, r3 = u._tr_tally(e3, 0, e3.window[e3.strstart]), e3.lookahead--, e3.strstart++, r3 && (N(e3, false), 0 === e3.strm.avail_out)) return A;
2849
+ }
2850
+ return e3.insert = 0, t3 === f ? (N(e3, true), 0 === e3.strm.avail_out ? O : B) : e3.last_lit && (N(e3, false), 0 === e3.strm.avail_out) ? A : I;
2851
+ }(n2, t2) : 3 === n2.strategy ? function(e3, t3) {
2852
+ for (var r3, n3, i3, s3, a3 = e3.window; ; ) {
2853
+ if (e3.lookahead <= S) {
2854
+ if (j(e3), e3.lookahead <= S && t3 === l) return A;
2855
+ if (0 === e3.lookahead) break;
2856
+ }
2857
+ if (e3.match_length = 0, e3.lookahead >= x && 0 < e3.strstart && (n3 = a3[i3 = e3.strstart - 1]) === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]) {
2858
+ s3 = e3.strstart + S;
2859
+ do {
2860
+ } while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && i3 < s3);
2861
+ e3.match_length = S - (s3 - i3), e3.match_length > e3.lookahead && (e3.match_length = e3.lookahead);
2862
+ }
2863
+ if (e3.match_length >= x ? (r3 = u._tr_tally(e3, 1, e3.match_length - x), e3.lookahead -= e3.match_length, e3.strstart += e3.match_length, e3.match_length = 0) : (r3 = u._tr_tally(e3, 0, e3.window[e3.strstart]), e3.lookahead--, e3.strstart++), r3 && (N(e3, false), 0 === e3.strm.avail_out)) return A;
2864
+ }
2865
+ return e3.insert = 0, t3 === f ? (N(e3, true), 0 === e3.strm.avail_out ? O : B) : e3.last_lit && (N(e3, false), 0 === e3.strm.avail_out) ? A : I;
2866
+ }(n2, t2) : h[n2.level].func(n2, t2);
2867
+ if (o2 !== O && o2 !== B || (n2.status = 666), o2 === A || o2 === O) return 0 === e2.avail_out && (n2.last_flush = -1), m;
2868
+ if (o2 === I && (1 === t2 ? u._tr_align(n2) : 5 !== t2 && (u._tr_stored_block(n2, 0, 0, false), 3 === t2 && (D(n2.head), 0 === n2.lookahead && (n2.strstart = 0, n2.block_start = 0, n2.insert = 0))), F(e2), 0 === e2.avail_out)) return n2.last_flush = -1, m;
2869
+ }
2870
+ return t2 !== f ? m : n2.wrap <= 0 ? 1 : (2 === n2.wrap ? (U(n2, 255 & e2.adler), U(n2, e2.adler >> 8 & 255), U(n2, e2.adler >> 16 & 255), U(n2, e2.adler >> 24 & 255), U(n2, 255 & e2.total_in), U(n2, e2.total_in >> 8 & 255), U(n2, e2.total_in >> 16 & 255), U(n2, e2.total_in >> 24 & 255)) : (P(n2, e2.adler >>> 16), P(n2, 65535 & e2.adler)), F(e2), 0 < n2.wrap && (n2.wrap = -n2.wrap), 0 !== n2.pending ? m : 1);
2871
+ }, r.deflateEnd = function(e2) {
2872
+ var t2;
2873
+ return e2 && e2.state ? (t2 = e2.state.status) !== C && 69 !== t2 && 73 !== t2 && 91 !== t2 && 103 !== t2 && t2 !== E && 666 !== t2 ? R(e2, _) : (e2.state = null, t2 === E ? R(e2, -3) : m) : _;
2874
+ }, r.deflateSetDictionary = function(e2, t2) {
2875
+ var r2, n2, i2, s2, a2, o2, h2, u2, l2 = t2.length;
2876
+ if (!e2 || !e2.state) return _;
2877
+ if (2 === (s2 = (r2 = e2.state).wrap) || 1 === s2 && r2.status !== C || r2.lookahead) return _;
2878
+ for (1 === s2 && (e2.adler = d(e2.adler, t2, l2, 0)), r2.wrap = 0, l2 >= r2.w_size && (0 === s2 && (D(r2.head), r2.strstart = 0, r2.block_start = 0, r2.insert = 0), u2 = new c.Buf8(r2.w_size), c.arraySet(u2, t2, l2 - r2.w_size, r2.w_size, 0), t2 = u2, l2 = r2.w_size), a2 = e2.avail_in, o2 = e2.next_in, h2 = e2.input, e2.avail_in = l2, e2.next_in = 0, e2.input = t2, j(r2); r2.lookahead >= x; ) {
2879
+ for (n2 = r2.strstart, i2 = r2.lookahead - (x - 1); r2.ins_h = (r2.ins_h << r2.hash_shift ^ r2.window[n2 + x - 1]) & r2.hash_mask, r2.prev[n2 & r2.w_mask] = r2.head[r2.ins_h], r2.head[r2.ins_h] = n2, n2++, --i2; ) ;
2880
+ r2.strstart = n2, r2.lookahead = x - 1, j(r2);
2881
+ }
2882
+ return r2.strstart += r2.lookahead, r2.block_start = r2.strstart, r2.insert = r2.lookahead, r2.lookahead = 0, r2.match_length = r2.prev_length = x - 1, r2.match_available = 0, e2.next_in = o2, e2.input = h2, e2.avail_in = a2, r2.wrap = s2, m;
2883
+ }, r.deflateInfo = "pako deflate (from Nodeca project)";
2884
+ }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./messages": 51, "./trees": 52 }], 47: [function(e, t, r) {
2885
+ t.exports = function() {
2886
+ this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = false;
2887
+ };
2888
+ }, {}], 48: [function(e, t, r) {
2889
+ t.exports = function(e2, t2) {
2890
+ var r2, n, i, s, a, o, h, u, l, f, c, d, p, m, _, g, b, v, y, w, k, x, S, z, C;
2891
+ r2 = e2.state, n = e2.next_in, z = e2.input, i = n + (e2.avail_in - 5), s = e2.next_out, C = e2.output, a = s - (t2 - e2.avail_out), o = s + (e2.avail_out - 257), h = r2.dmax, u = r2.wsize, l = r2.whave, f = r2.wnext, c = r2.window, d = r2.hold, p = r2.bits, m = r2.lencode, _ = r2.distcode, g = (1 << r2.lenbits) - 1, b = (1 << r2.distbits) - 1;
2892
+ e: do {
2893
+ p < 15 && (d += z[n++] << p, p += 8, d += z[n++] << p, p += 8), v = m[d & g];
2894
+ t: for (; ; ) {
2895
+ if (d >>>= y = v >>> 24, p -= y, 0 === (y = v >>> 16 & 255)) C[s++] = 65535 & v;
2896
+ else {
2897
+ if (!(16 & y)) {
2898
+ if (0 == (64 & y)) {
2899
+ v = m[(65535 & v) + (d & (1 << y) - 1)];
2900
+ continue t;
2901
+ }
2902
+ if (32 & y) {
2903
+ r2.mode = 12;
2904
+ break e;
2905
+ }
2906
+ e2.msg = "invalid literal/length code", r2.mode = 30;
2907
+ break e;
2908
+ }
2909
+ w = 65535 & v, (y &= 15) && (p < y && (d += z[n++] << p, p += 8), w += d & (1 << y) - 1, d >>>= y, p -= y), p < 15 && (d += z[n++] << p, p += 8, d += z[n++] << p, p += 8), v = _[d & b];
2910
+ r: for (; ; ) {
2911
+ if (d >>>= y = v >>> 24, p -= y, !(16 & (y = v >>> 16 & 255))) {
2912
+ if (0 == (64 & y)) {
2913
+ v = _[(65535 & v) + (d & (1 << y) - 1)];
2914
+ continue r;
2915
+ }
2916
+ e2.msg = "invalid distance code", r2.mode = 30;
2917
+ break e;
2918
+ }
2919
+ if (k = 65535 & v, p < (y &= 15) && (d += z[n++] << p, (p += 8) < y && (d += z[n++] << p, p += 8)), h < (k += d & (1 << y) - 1)) {
2920
+ e2.msg = "invalid distance too far back", r2.mode = 30;
2921
+ break e;
2922
+ }
2923
+ if (d >>>= y, p -= y, (y = s - a) < k) {
2924
+ if (l < (y = k - y) && r2.sane) {
2925
+ e2.msg = "invalid distance too far back", r2.mode = 30;
2926
+ break e;
2927
+ }
2928
+ if (S = c, (x = 0) === f) {
2929
+ if (x += u - y, y < w) {
2930
+ for (w -= y; C[s++] = c[x++], --y; ) ;
2931
+ x = s - k, S = C;
2932
+ }
2933
+ } else if (f < y) {
2934
+ if (x += u + f - y, (y -= f) < w) {
2935
+ for (w -= y; C[s++] = c[x++], --y; ) ;
2936
+ if (x = 0, f < w) {
2937
+ for (w -= y = f; C[s++] = c[x++], --y; ) ;
2938
+ x = s - k, S = C;
2939
+ }
2940
+ }
2941
+ } else if (x += f - y, y < w) {
2942
+ for (w -= y; C[s++] = c[x++], --y; ) ;
2943
+ x = s - k, S = C;
2944
+ }
2945
+ for (; 2 < w; ) C[s++] = S[x++], C[s++] = S[x++], C[s++] = S[x++], w -= 3;
2946
+ w && (C[s++] = S[x++], 1 < w && (C[s++] = S[x++]));
2947
+ } else {
2948
+ for (x = s - k; C[s++] = C[x++], C[s++] = C[x++], C[s++] = C[x++], 2 < (w -= 3); ) ;
2949
+ w && (C[s++] = C[x++], 1 < w && (C[s++] = C[x++]));
2950
+ }
2951
+ break;
2952
+ }
2953
+ }
2954
+ break;
2955
+ }
2956
+ } while (n < i && s < o);
2957
+ n -= w = p >> 3, d &= (1 << (p -= w << 3)) - 1, e2.next_in = n, e2.next_out = s, e2.avail_in = n < i ? i - n + 5 : 5 - (n - i), e2.avail_out = s < o ? o - s + 257 : 257 - (s - o), r2.hold = d, r2.bits = p;
2958
+ };
2959
+ }, {}], 49: [function(e, t, r) {
2960
+ var I = e("../utils/common"), O = e("./adler32"), B = e("./crc32"), R = e("./inffast"), T = e("./inftrees"), D = 1, F = 2, N = 0, U = -2, P = 1, n = 852, i = 592;
2961
+ function L(e2) {
2962
+ return (e2 >>> 24 & 255) + (e2 >>> 8 & 65280) + ((65280 & e2) << 8) + ((255 & e2) << 24);
2963
+ }
2964
+ function s() {
2965
+ this.mode = 0, this.last = false, this.wrap = 0, this.havedict = false, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new I.Buf16(320), this.work = new I.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0;
2966
+ }
2967
+ function a(e2) {
2968
+ var t2;
2969
+ return e2 && e2.state ? (t2 = e2.state, e2.total_in = e2.total_out = t2.total = 0, e2.msg = "", t2.wrap && (e2.adler = 1 & t2.wrap), t2.mode = P, t2.last = 0, t2.havedict = 0, t2.dmax = 32768, t2.head = null, t2.hold = 0, t2.bits = 0, t2.lencode = t2.lendyn = new I.Buf32(n), t2.distcode = t2.distdyn = new I.Buf32(i), t2.sane = 1, t2.back = -1, N) : U;
2970
+ }
2971
+ function o(e2) {
2972
+ var t2;
2973
+ return e2 && e2.state ? ((t2 = e2.state).wsize = 0, t2.whave = 0, t2.wnext = 0, a(e2)) : U;
2974
+ }
2975
+ function h(e2, t2) {
2976
+ var r2, n2;
2977
+ return e2 && e2.state ? (n2 = e2.state, t2 < 0 ? (r2 = 0, t2 = -t2) : (r2 = 1 + (t2 >> 4), t2 < 48 && (t2 &= 15)), t2 && (t2 < 8 || 15 < t2) ? U : (null !== n2.window && n2.wbits !== t2 && (n2.window = null), n2.wrap = r2, n2.wbits = t2, o(e2))) : U;
2978
+ }
2979
+ function u(e2, t2) {
2980
+ var r2, n2;
2981
+ return e2 ? (n2 = new s(), (e2.state = n2).window = null, (r2 = h(e2, t2)) !== N && (e2.state = null), r2) : U;
2982
+ }
2983
+ var l, f, c = true;
2984
+ function j(e2) {
2985
+ if (c) {
2986
+ var t2;
2987
+ for (l = new I.Buf32(512), f = new I.Buf32(32), t2 = 0; t2 < 144; ) e2.lens[t2++] = 8;
2988
+ for (; t2 < 256; ) e2.lens[t2++] = 9;
2989
+ for (; t2 < 280; ) e2.lens[t2++] = 7;
2990
+ for (; t2 < 288; ) e2.lens[t2++] = 8;
2991
+ for (T(D, e2.lens, 0, 288, l, 0, e2.work, { bits: 9 }), t2 = 0; t2 < 32; ) e2.lens[t2++] = 5;
2992
+ T(F, e2.lens, 0, 32, f, 0, e2.work, { bits: 5 }), c = false;
2993
+ }
2994
+ e2.lencode = l, e2.lenbits = 9, e2.distcode = f, e2.distbits = 5;
2995
+ }
2996
+ function Z(e2, t2, r2, n2) {
2997
+ var i2, s2 = e2.state;
2998
+ return null === s2.window && (s2.wsize = 1 << s2.wbits, s2.wnext = 0, s2.whave = 0, s2.window = new I.Buf8(s2.wsize)), n2 >= s2.wsize ? (I.arraySet(s2.window, t2, r2 - s2.wsize, s2.wsize, 0), s2.wnext = 0, s2.whave = s2.wsize) : (n2 < (i2 = s2.wsize - s2.wnext) && (i2 = n2), I.arraySet(s2.window, t2, r2 - n2, i2, s2.wnext), (n2 -= i2) ? (I.arraySet(s2.window, t2, r2 - n2, n2, 0), s2.wnext = n2, s2.whave = s2.wsize) : (s2.wnext += i2, s2.wnext === s2.wsize && (s2.wnext = 0), s2.whave < s2.wsize && (s2.whave += i2))), 0;
2999
+ }
3000
+ r.inflateReset = o, r.inflateReset2 = h, r.inflateResetKeep = a, r.inflateInit = function(e2) {
3001
+ return u(e2, 15);
3002
+ }, r.inflateInit2 = u, r.inflate = function(e2, t2) {
3003
+ var r2, n2, i2, s2, a2, o2, h2, u2, l2, f2, c2, d, p, m, _, g, b, v, y, w, k, x, S, z, C = 0, E = new I.Buf8(4), A = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
3004
+ if (!e2 || !e2.state || !e2.output || !e2.input && 0 !== e2.avail_in) return U;
3005
+ 12 === (r2 = e2.state).mode && (r2.mode = 13), a2 = e2.next_out, i2 = e2.output, h2 = e2.avail_out, s2 = e2.next_in, n2 = e2.input, o2 = e2.avail_in, u2 = r2.hold, l2 = r2.bits, f2 = o2, c2 = h2, x = N;
3006
+ e: for (; ; ) switch (r2.mode) {
3007
+ case P:
3008
+ if (0 === r2.wrap) {
3009
+ r2.mode = 13;
3010
+ break;
3011
+ }
3012
+ for (; l2 < 16; ) {
3013
+ if (0 === o2) break e;
3014
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3015
+ }
3016
+ if (2 & r2.wrap && 35615 === u2) {
3017
+ E[r2.check = 0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0), l2 = u2 = 0, r2.mode = 2;
3018
+ break;
3019
+ }
3020
+ if (r2.flags = 0, r2.head && (r2.head.done = false), !(1 & r2.wrap) || (((255 & u2) << 8) + (u2 >> 8)) % 31) {
3021
+ e2.msg = "incorrect header check", r2.mode = 30;
3022
+ break;
3023
+ }
3024
+ if (8 != (15 & u2)) {
3025
+ e2.msg = "unknown compression method", r2.mode = 30;
3026
+ break;
3027
+ }
3028
+ if (l2 -= 4, k = 8 + (15 & (u2 >>>= 4)), 0 === r2.wbits) r2.wbits = k;
3029
+ else if (k > r2.wbits) {
3030
+ e2.msg = "invalid window size", r2.mode = 30;
3031
+ break;
3032
+ }
3033
+ r2.dmax = 1 << k, e2.adler = r2.check = 1, r2.mode = 512 & u2 ? 10 : 12, l2 = u2 = 0;
3034
+ break;
3035
+ case 2:
3036
+ for (; l2 < 16; ) {
3037
+ if (0 === o2) break e;
3038
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3039
+ }
3040
+ if (r2.flags = u2, 8 != (255 & r2.flags)) {
3041
+ e2.msg = "unknown compression method", r2.mode = 30;
3042
+ break;
3043
+ }
3044
+ if (57344 & r2.flags) {
3045
+ e2.msg = "unknown header flags set", r2.mode = 30;
3046
+ break;
3047
+ }
3048
+ r2.head && (r2.head.text = u2 >> 8 & 1), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l2 = u2 = 0, r2.mode = 3;
3049
+ case 3:
3050
+ for (; l2 < 32; ) {
3051
+ if (0 === o2) break e;
3052
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3053
+ }
3054
+ r2.head && (r2.head.time = u2), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, E[2] = u2 >>> 16 & 255, E[3] = u2 >>> 24 & 255, r2.check = B(r2.check, E, 4, 0)), l2 = u2 = 0, r2.mode = 4;
3055
+ case 4:
3056
+ for (; l2 < 16; ) {
3057
+ if (0 === o2) break e;
3058
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3059
+ }
3060
+ r2.head && (r2.head.xflags = 255 & u2, r2.head.os = u2 >> 8), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l2 = u2 = 0, r2.mode = 5;
3061
+ case 5:
3062
+ if (1024 & r2.flags) {
3063
+ for (; l2 < 16; ) {
3064
+ if (0 === o2) break e;
3065
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3066
+ }
3067
+ r2.length = u2, r2.head && (r2.head.extra_len = u2), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l2 = u2 = 0;
3068
+ } else r2.head && (r2.head.extra = null);
3069
+ r2.mode = 6;
3070
+ case 6:
3071
+ if (1024 & r2.flags && (o2 < (d = r2.length) && (d = o2), d && (r2.head && (k = r2.head.extra_len - r2.length, r2.head.extra || (r2.head.extra = new Array(r2.head.extra_len)), I.arraySet(r2.head.extra, n2, s2, d, k)), 512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, r2.length -= d), r2.length)) break e;
3072
+ r2.length = 0, r2.mode = 7;
3073
+ case 7:
3074
+ if (2048 & r2.flags) {
3075
+ if (0 === o2) break e;
3076
+ for (d = 0; k = n2[s2 + d++], r2.head && k && r2.length < 65536 && (r2.head.name += String.fromCharCode(k)), k && d < o2; ) ;
3077
+ if (512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, k) break e;
3078
+ } else r2.head && (r2.head.name = null);
3079
+ r2.length = 0, r2.mode = 8;
3080
+ case 8:
3081
+ if (4096 & r2.flags) {
3082
+ if (0 === o2) break e;
3083
+ for (d = 0; k = n2[s2 + d++], r2.head && k && r2.length < 65536 && (r2.head.comment += String.fromCharCode(k)), k && d < o2; ) ;
3084
+ if (512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, k) break e;
3085
+ } else r2.head && (r2.head.comment = null);
3086
+ r2.mode = 9;
3087
+ case 9:
3088
+ if (512 & r2.flags) {
3089
+ for (; l2 < 16; ) {
3090
+ if (0 === o2) break e;
3091
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3092
+ }
3093
+ if (u2 !== (65535 & r2.check)) {
3094
+ e2.msg = "header crc mismatch", r2.mode = 30;
3095
+ break;
3096
+ }
3097
+ l2 = u2 = 0;
3098
+ }
3099
+ r2.head && (r2.head.hcrc = r2.flags >> 9 & 1, r2.head.done = true), e2.adler = r2.check = 0, r2.mode = 12;
3100
+ break;
3101
+ case 10:
3102
+ for (; l2 < 32; ) {
3103
+ if (0 === o2) break e;
3104
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3105
+ }
3106
+ e2.adler = r2.check = L(u2), l2 = u2 = 0, r2.mode = 11;
3107
+ case 11:
3108
+ if (0 === r2.havedict) return e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l2, 2;
3109
+ e2.adler = r2.check = 1, r2.mode = 12;
3110
+ case 12:
3111
+ if (5 === t2 || 6 === t2) break e;
3112
+ case 13:
3113
+ if (r2.last) {
3114
+ u2 >>>= 7 & l2, l2 -= 7 & l2, r2.mode = 27;
3115
+ break;
3116
+ }
3117
+ for (; l2 < 3; ) {
3118
+ if (0 === o2) break e;
3119
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3120
+ }
3121
+ switch (r2.last = 1 & u2, l2 -= 1, 3 & (u2 >>>= 1)) {
3122
+ case 0:
3123
+ r2.mode = 14;
3124
+ break;
3125
+ case 1:
3126
+ if (j(r2), r2.mode = 20, 6 !== t2) break;
3127
+ u2 >>>= 2, l2 -= 2;
3128
+ break e;
3129
+ case 2:
3130
+ r2.mode = 17;
3131
+ break;
3132
+ case 3:
3133
+ e2.msg = "invalid block type", r2.mode = 30;
3134
+ }
3135
+ u2 >>>= 2, l2 -= 2;
3136
+ break;
3137
+ case 14:
3138
+ for (u2 >>>= 7 & l2, l2 -= 7 & l2; l2 < 32; ) {
3139
+ if (0 === o2) break e;
3140
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3141
+ }
3142
+ if ((65535 & u2) != (u2 >>> 16 ^ 65535)) {
3143
+ e2.msg = "invalid stored block lengths", r2.mode = 30;
3144
+ break;
3145
+ }
3146
+ if (r2.length = 65535 & u2, l2 = u2 = 0, r2.mode = 15, 6 === t2) break e;
3147
+ case 15:
3148
+ r2.mode = 16;
3149
+ case 16:
3150
+ if (d = r2.length) {
3151
+ if (o2 < d && (d = o2), h2 < d && (d = h2), 0 === d) break e;
3152
+ I.arraySet(i2, n2, s2, d, a2), o2 -= d, s2 += d, h2 -= d, a2 += d, r2.length -= d;
3153
+ break;
3154
+ }
3155
+ r2.mode = 12;
3156
+ break;
3157
+ case 17:
3158
+ for (; l2 < 14; ) {
3159
+ if (0 === o2) break e;
3160
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3161
+ }
3162
+ if (r2.nlen = 257 + (31 & u2), u2 >>>= 5, l2 -= 5, r2.ndist = 1 + (31 & u2), u2 >>>= 5, l2 -= 5, r2.ncode = 4 + (15 & u2), u2 >>>= 4, l2 -= 4, 286 < r2.nlen || 30 < r2.ndist) {
3163
+ e2.msg = "too many length or distance symbols", r2.mode = 30;
3164
+ break;
3165
+ }
3166
+ r2.have = 0, r2.mode = 18;
3167
+ case 18:
3168
+ for (; r2.have < r2.ncode; ) {
3169
+ for (; l2 < 3; ) {
3170
+ if (0 === o2) break e;
3171
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3172
+ }
3173
+ r2.lens[A[r2.have++]] = 7 & u2, u2 >>>= 3, l2 -= 3;
3174
+ }
3175
+ for (; r2.have < 19; ) r2.lens[A[r2.have++]] = 0;
3176
+ if (r2.lencode = r2.lendyn, r2.lenbits = 7, S = { bits: r2.lenbits }, x = T(0, r2.lens, 0, 19, r2.lencode, 0, r2.work, S), r2.lenbits = S.bits, x) {
3177
+ e2.msg = "invalid code lengths set", r2.mode = 30;
3178
+ break;
3179
+ }
3180
+ r2.have = 0, r2.mode = 19;
3181
+ case 19:
3182
+ for (; r2.have < r2.nlen + r2.ndist; ) {
3183
+ for (; g = (C = r2.lencode[u2 & (1 << r2.lenbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) {
3184
+ if (0 === o2) break e;
3185
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3186
+ }
3187
+ if (b < 16) u2 >>>= _, l2 -= _, r2.lens[r2.have++] = b;
3188
+ else {
3189
+ if (16 === b) {
3190
+ for (z = _ + 2; l2 < z; ) {
3191
+ if (0 === o2) break e;
3192
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3193
+ }
3194
+ if (u2 >>>= _, l2 -= _, 0 === r2.have) {
3195
+ e2.msg = "invalid bit length repeat", r2.mode = 30;
3196
+ break;
3197
+ }
3198
+ k = r2.lens[r2.have - 1], d = 3 + (3 & u2), u2 >>>= 2, l2 -= 2;
3199
+ } else if (17 === b) {
3200
+ for (z = _ + 3; l2 < z; ) {
3201
+ if (0 === o2) break e;
3202
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3203
+ }
3204
+ l2 -= _, k = 0, d = 3 + (7 & (u2 >>>= _)), u2 >>>= 3, l2 -= 3;
3205
+ } else {
3206
+ for (z = _ + 7; l2 < z; ) {
3207
+ if (0 === o2) break e;
3208
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3209
+ }
3210
+ l2 -= _, k = 0, d = 11 + (127 & (u2 >>>= _)), u2 >>>= 7, l2 -= 7;
3211
+ }
3212
+ if (r2.have + d > r2.nlen + r2.ndist) {
3213
+ e2.msg = "invalid bit length repeat", r2.mode = 30;
3214
+ break;
3215
+ }
3216
+ for (; d--; ) r2.lens[r2.have++] = k;
3217
+ }
3218
+ }
3219
+ if (30 === r2.mode) break;
3220
+ if (0 === r2.lens[256]) {
3221
+ e2.msg = "invalid code -- missing end-of-block", r2.mode = 30;
3222
+ break;
3223
+ }
3224
+ if (r2.lenbits = 9, S = { bits: r2.lenbits }, x = T(D, r2.lens, 0, r2.nlen, r2.lencode, 0, r2.work, S), r2.lenbits = S.bits, x) {
3225
+ e2.msg = "invalid literal/lengths set", r2.mode = 30;
3226
+ break;
3227
+ }
3228
+ if (r2.distbits = 6, r2.distcode = r2.distdyn, S = { bits: r2.distbits }, x = T(F, r2.lens, r2.nlen, r2.ndist, r2.distcode, 0, r2.work, S), r2.distbits = S.bits, x) {
3229
+ e2.msg = "invalid distances set", r2.mode = 30;
3230
+ break;
3231
+ }
3232
+ if (r2.mode = 20, 6 === t2) break e;
3233
+ case 20:
3234
+ r2.mode = 21;
3235
+ case 21:
3236
+ if (6 <= o2 && 258 <= h2) {
3237
+ e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l2, R(e2, c2), a2 = e2.next_out, i2 = e2.output, h2 = e2.avail_out, s2 = e2.next_in, n2 = e2.input, o2 = e2.avail_in, u2 = r2.hold, l2 = r2.bits, 12 === r2.mode && (r2.back = -1);
3238
+ break;
3239
+ }
3240
+ for (r2.back = 0; g = (C = r2.lencode[u2 & (1 << r2.lenbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) {
3241
+ if (0 === o2) break e;
3242
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3243
+ }
3244
+ if (g && 0 == (240 & g)) {
3245
+ for (v = _, y = g, w = b; g = (C = r2.lencode[w + ((u2 & (1 << v + y) - 1) >> v)]) >>> 16 & 255, b = 65535 & C, !(v + (_ = C >>> 24) <= l2); ) {
3246
+ if (0 === o2) break e;
3247
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3248
+ }
3249
+ u2 >>>= v, l2 -= v, r2.back += v;
3250
+ }
3251
+ if (u2 >>>= _, l2 -= _, r2.back += _, r2.length = b, 0 === g) {
3252
+ r2.mode = 26;
3253
+ break;
3254
+ }
3255
+ if (32 & g) {
3256
+ r2.back = -1, r2.mode = 12;
3257
+ break;
3258
+ }
3259
+ if (64 & g) {
3260
+ e2.msg = "invalid literal/length code", r2.mode = 30;
3261
+ break;
3262
+ }
3263
+ r2.extra = 15 & g, r2.mode = 22;
3264
+ case 22:
3265
+ if (r2.extra) {
3266
+ for (z = r2.extra; l2 < z; ) {
3267
+ if (0 === o2) break e;
3268
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3269
+ }
3270
+ r2.length += u2 & (1 << r2.extra) - 1, u2 >>>= r2.extra, l2 -= r2.extra, r2.back += r2.extra;
3271
+ }
3272
+ r2.was = r2.length, r2.mode = 23;
3273
+ case 23:
3274
+ for (; g = (C = r2.distcode[u2 & (1 << r2.distbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) {
3275
+ if (0 === o2) break e;
3276
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3277
+ }
3278
+ if (0 == (240 & g)) {
3279
+ for (v = _, y = g, w = b; g = (C = r2.distcode[w + ((u2 & (1 << v + y) - 1) >> v)]) >>> 16 & 255, b = 65535 & C, !(v + (_ = C >>> 24) <= l2); ) {
3280
+ if (0 === o2) break e;
3281
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3282
+ }
3283
+ u2 >>>= v, l2 -= v, r2.back += v;
3284
+ }
3285
+ if (u2 >>>= _, l2 -= _, r2.back += _, 64 & g) {
3286
+ e2.msg = "invalid distance code", r2.mode = 30;
3287
+ break;
3288
+ }
3289
+ r2.offset = b, r2.extra = 15 & g, r2.mode = 24;
3290
+ case 24:
3291
+ if (r2.extra) {
3292
+ for (z = r2.extra; l2 < z; ) {
3293
+ if (0 === o2) break e;
3294
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3295
+ }
3296
+ r2.offset += u2 & (1 << r2.extra) - 1, u2 >>>= r2.extra, l2 -= r2.extra, r2.back += r2.extra;
3297
+ }
3298
+ if (r2.offset > r2.dmax) {
3299
+ e2.msg = "invalid distance too far back", r2.mode = 30;
3300
+ break;
3301
+ }
3302
+ r2.mode = 25;
3303
+ case 25:
3304
+ if (0 === h2) break e;
3305
+ if (d = c2 - h2, r2.offset > d) {
3306
+ if ((d = r2.offset - d) > r2.whave && r2.sane) {
3307
+ e2.msg = "invalid distance too far back", r2.mode = 30;
3308
+ break;
3309
+ }
3310
+ p = d > r2.wnext ? (d -= r2.wnext, r2.wsize - d) : r2.wnext - d, d > r2.length && (d = r2.length), m = r2.window;
3311
+ } else m = i2, p = a2 - r2.offset, d = r2.length;
3312
+ for (h2 < d && (d = h2), h2 -= d, r2.length -= d; i2[a2++] = m[p++], --d; ) ;
3313
+ 0 === r2.length && (r2.mode = 21);
3314
+ break;
3315
+ case 26:
3316
+ if (0 === h2) break e;
3317
+ i2[a2++] = r2.length, h2--, r2.mode = 21;
3318
+ break;
3319
+ case 27:
3320
+ if (r2.wrap) {
3321
+ for (; l2 < 32; ) {
3322
+ if (0 === o2) break e;
3323
+ o2--, u2 |= n2[s2++] << l2, l2 += 8;
3324
+ }
3325
+ if (c2 -= h2, e2.total_out += c2, r2.total += c2, c2 && (e2.adler = r2.check = r2.flags ? B(r2.check, i2, c2, a2 - c2) : O(r2.check, i2, c2, a2 - c2)), c2 = h2, (r2.flags ? u2 : L(u2)) !== r2.check) {
3326
+ e2.msg = "incorrect data check", r2.mode = 30;
3327
+ break;
3328
+ }
3329
+ l2 = u2 = 0;
3330
+ }
3331
+ r2.mode = 28;
3332
+ case 28:
3333
+ if (r2.wrap && r2.flags) {
3334
+ for (; l2 < 32; ) {
3335
+ if (0 === o2) break e;
3336
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
3337
+ }
3338
+ if (u2 !== (4294967295 & r2.total)) {
3339
+ e2.msg = "incorrect length check", r2.mode = 30;
3340
+ break;
3341
+ }
3342
+ l2 = u2 = 0;
3343
+ }
3344
+ r2.mode = 29;
3345
+ case 29:
3346
+ x = 1;
3347
+ break e;
3348
+ case 30:
3349
+ x = -3;
3350
+ break e;
3351
+ case 31:
3352
+ return -4;
3353
+ case 32:
3354
+ default:
3355
+ return U;
3356
+ }
3357
+ return e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l2, (r2.wsize || c2 !== e2.avail_out && r2.mode < 30 && (r2.mode < 27 || 4 !== t2)) && Z(e2, e2.output, e2.next_out, c2 - e2.avail_out) ? (r2.mode = 31, -4) : (f2 -= e2.avail_in, c2 -= e2.avail_out, e2.total_in += f2, e2.total_out += c2, r2.total += c2, r2.wrap && c2 && (e2.adler = r2.check = r2.flags ? B(r2.check, i2, c2, e2.next_out - c2) : O(r2.check, i2, c2, e2.next_out - c2)), e2.data_type = r2.bits + (r2.last ? 64 : 0) + (12 === r2.mode ? 128 : 0) + (20 === r2.mode || 15 === r2.mode ? 256 : 0), (0 == f2 && 0 === c2 || 4 === t2) && x === N && (x = -5), x);
3358
+ }, r.inflateEnd = function(e2) {
3359
+ if (!e2 || !e2.state) return U;
3360
+ var t2 = e2.state;
3361
+ return t2.window && (t2.window = null), e2.state = null, N;
3362
+ }, r.inflateGetHeader = function(e2, t2) {
3363
+ var r2;
3364
+ return e2 && e2.state ? 0 == (2 & (r2 = e2.state).wrap) ? U : ((r2.head = t2).done = false, N) : U;
3365
+ }, r.inflateSetDictionary = function(e2, t2) {
3366
+ var r2, n2 = t2.length;
3367
+ return e2 && e2.state ? 0 !== (r2 = e2.state).wrap && 11 !== r2.mode ? U : 11 === r2.mode && O(1, t2, n2, 0) !== r2.check ? -3 : Z(e2, t2, n2, n2) ? (r2.mode = 31, -4) : (r2.havedict = 1, N) : U;
3368
+ }, r.inflateInfo = "pako inflate (from Nodeca project)";
3369
+ }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./inffast": 48, "./inftrees": 50 }], 50: [function(e, t, r) {
3370
+ var D = e("../utils/common"), F = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0], N = [16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78], U = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0], P = [16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64];
3371
+ t.exports = function(e2, t2, r2, n, i, s, a, o) {
3372
+ var h, u, l, f, c, d, p, m, _, g = o.bits, b = 0, v = 0, y = 0, w = 0, k = 0, x = 0, S = 0, z = 0, C = 0, E = 0, A = null, I = 0, O = new D.Buf16(16), B = new D.Buf16(16), R = null, T = 0;
3373
+ for (b = 0; b <= 15; b++) O[b] = 0;
3374
+ for (v = 0; v < n; v++) O[t2[r2 + v]]++;
3375
+ for (k = g, w = 15; 1 <= w && 0 === O[w]; w--) ;
3376
+ if (w < k && (k = w), 0 === w) return i[s++] = 20971520, i[s++] = 20971520, o.bits = 1, 0;
3377
+ for (y = 1; y < w && 0 === O[y]; y++) ;
3378
+ for (k < y && (k = y), b = z = 1; b <= 15; b++) if (z <<= 1, (z -= O[b]) < 0) return -1;
3379
+ if (0 < z && (0 === e2 || 1 !== w)) return -1;
3380
+ for (B[1] = 0, b = 1; b < 15; b++) B[b + 1] = B[b] + O[b];
3381
+ for (v = 0; v < n; v++) 0 !== t2[r2 + v] && (a[B[t2[r2 + v]]++] = v);
3382
+ if (d = 0 === e2 ? (A = R = a, 19) : 1 === e2 ? (A = F, I -= 257, R = N, T -= 257, 256) : (A = U, R = P, -1), b = y, c = s, S = v = E = 0, l = -1, f = (C = 1 << (x = k)) - 1, 1 === e2 && 852 < C || 2 === e2 && 592 < C) return 1;
3383
+ for (; ; ) {
3384
+ for (p = b - S, _ = a[v] < d ? (m = 0, a[v]) : a[v] > d ? (m = R[T + a[v]], A[I + a[v]]) : (m = 96, 0), h = 1 << b - S, y = u = 1 << x; i[c + (E >> S) + (u -= h)] = p << 24 | m << 16 | _ | 0, 0 !== u; ) ;
3385
+ for (h = 1 << b - 1; E & h; ) h >>= 1;
3386
+ if (0 !== h ? (E &= h - 1, E += h) : E = 0, v++, 0 == --O[b]) {
3387
+ if (b === w) break;
3388
+ b = t2[r2 + a[v]];
3389
+ }
3390
+ if (k < b && (E & f) !== l) {
3391
+ for (0 === S && (S = k), c += y, z = 1 << (x = b - S); x + S < w && !((z -= O[x + S]) <= 0); ) x++, z <<= 1;
3392
+ if (C += 1 << x, 1 === e2 && 852 < C || 2 === e2 && 592 < C) return 1;
3393
+ i[l = E & f] = k << 24 | x << 16 | c - s | 0;
3394
+ }
3395
+ }
3396
+ return 0 !== E && (i[c + E] = b - S << 24 | 64 << 16 | 0), o.bits = k, 0;
3397
+ };
3398
+ }, { "../utils/common": 41 }], 51: [function(e, t, r) {
3399
+ t.exports = { 2: "need dictionary", 1: "stream end", 0: "", "-1": "file error", "-2": "stream error", "-3": "data error", "-4": "insufficient memory", "-5": "buffer error", "-6": "incompatible version" };
3400
+ }, {}], 52: [function(e, t, r) {
3401
+ var i = e("../utils/common"), o = 0, h = 1;
3402
+ function n(e2) {
3403
+ for (var t2 = e2.length; 0 <= --t2; ) e2[t2] = 0;
3404
+ }
3405
+ var s = 0, a = 29, u = 256, l = u + 1 + a, f = 30, c = 19, _ = 2 * l + 1, g = 15, d = 16, p = 7, m = 256, b = 16, v = 17, y = 18, w = [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], k = [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], x = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], S = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], z = new Array(2 * (l + 2));
3406
+ n(z);
3407
+ var C = new Array(2 * f);
3408
+ n(C);
3409
+ var E = new Array(512);
3410
+ n(E);
3411
+ var A = new Array(256);
3412
+ n(A);
3413
+ var I = new Array(a);
3414
+ n(I);
3415
+ var O, B, R, T = new Array(f);
3416
+ function D(e2, t2, r2, n2, i2) {
3417
+ this.static_tree = e2, this.extra_bits = t2, this.extra_base = r2, this.elems = n2, this.max_length = i2, this.has_stree = e2 && e2.length;
3418
+ }
3419
+ function F(e2, t2) {
3420
+ this.dyn_tree = e2, this.max_code = 0, this.stat_desc = t2;
3421
+ }
3422
+ function N(e2) {
3423
+ return e2 < 256 ? E[e2] : E[256 + (e2 >>> 7)];
3424
+ }
3425
+ function U(e2, t2) {
3426
+ e2.pending_buf[e2.pending++] = 255 & t2, e2.pending_buf[e2.pending++] = t2 >>> 8 & 255;
3427
+ }
3428
+ function P(e2, t2, r2) {
3429
+ e2.bi_valid > d - r2 ? (e2.bi_buf |= t2 << e2.bi_valid & 65535, U(e2, e2.bi_buf), e2.bi_buf = t2 >> d - e2.bi_valid, e2.bi_valid += r2 - d) : (e2.bi_buf |= t2 << e2.bi_valid & 65535, e2.bi_valid += r2);
3430
+ }
3431
+ function L(e2, t2, r2) {
3432
+ P(e2, r2[2 * t2], r2[2 * t2 + 1]);
3433
+ }
3434
+ function j(e2, t2) {
3435
+ for (var r2 = 0; r2 |= 1 & e2, e2 >>>= 1, r2 <<= 1, 0 < --t2; ) ;
3436
+ return r2 >>> 1;
3437
+ }
3438
+ function Z(e2, t2, r2) {
3439
+ var n2, i2, s2 = new Array(g + 1), a2 = 0;
3440
+ for (n2 = 1; n2 <= g; n2++) s2[n2] = a2 = a2 + r2[n2 - 1] << 1;
3441
+ for (i2 = 0; i2 <= t2; i2++) {
3442
+ var o2 = e2[2 * i2 + 1];
3443
+ 0 !== o2 && (e2[2 * i2] = j(s2[o2]++, o2));
3444
+ }
3445
+ }
3446
+ function W(e2) {
3447
+ var t2;
3448
+ for (t2 = 0; t2 < l; t2++) e2.dyn_ltree[2 * t2] = 0;
3449
+ for (t2 = 0; t2 < f; t2++) e2.dyn_dtree[2 * t2] = 0;
3450
+ for (t2 = 0; t2 < c; t2++) e2.bl_tree[2 * t2] = 0;
3451
+ e2.dyn_ltree[2 * m] = 1, e2.opt_len = e2.static_len = 0, e2.last_lit = e2.matches = 0;
3452
+ }
3453
+ function M(e2) {
3454
+ 8 < e2.bi_valid ? U(e2, e2.bi_buf) : 0 < e2.bi_valid && (e2.pending_buf[e2.pending++] = e2.bi_buf), e2.bi_buf = 0, e2.bi_valid = 0;
3455
+ }
3456
+ function H(e2, t2, r2, n2) {
3457
+ var i2 = 2 * t2, s2 = 2 * r2;
3458
+ return e2[i2] < e2[s2] || e2[i2] === e2[s2] && n2[t2] <= n2[r2];
3459
+ }
3460
+ function G(e2, t2, r2) {
3461
+ for (var n2 = e2.heap[r2], i2 = r2 << 1; i2 <= e2.heap_len && (i2 < e2.heap_len && H(t2, e2.heap[i2 + 1], e2.heap[i2], e2.depth) && i2++, !H(t2, n2, e2.heap[i2], e2.depth)); ) e2.heap[r2] = e2.heap[i2], r2 = i2, i2 <<= 1;
3462
+ e2.heap[r2] = n2;
3463
+ }
3464
+ function K(e2, t2, r2) {
3465
+ var n2, i2, s2, a2, o2 = 0;
3466
+ if (0 !== e2.last_lit) for (; n2 = e2.pending_buf[e2.d_buf + 2 * o2] << 8 | e2.pending_buf[e2.d_buf + 2 * o2 + 1], i2 = e2.pending_buf[e2.l_buf + o2], o2++, 0 === n2 ? L(e2, i2, t2) : (L(e2, (s2 = A[i2]) + u + 1, t2), 0 !== (a2 = w[s2]) && P(e2, i2 -= I[s2], a2), L(e2, s2 = N(--n2), r2), 0 !== (a2 = k[s2]) && P(e2, n2 -= T[s2], a2)), o2 < e2.last_lit; ) ;
3467
+ L(e2, m, t2);
3468
+ }
3469
+ function Y(e2, t2) {
3470
+ var r2, n2, i2, s2 = t2.dyn_tree, a2 = t2.stat_desc.static_tree, o2 = t2.stat_desc.has_stree, h2 = t2.stat_desc.elems, u2 = -1;
3471
+ for (e2.heap_len = 0, e2.heap_max = _, r2 = 0; r2 < h2; r2++) 0 !== s2[2 * r2] ? (e2.heap[++e2.heap_len] = u2 = r2, e2.depth[r2] = 0) : s2[2 * r2 + 1] = 0;
3472
+ for (; e2.heap_len < 2; ) s2[2 * (i2 = e2.heap[++e2.heap_len] = u2 < 2 ? ++u2 : 0)] = 1, e2.depth[i2] = 0, e2.opt_len--, o2 && (e2.static_len -= a2[2 * i2 + 1]);
3473
+ for (t2.max_code = u2, r2 = e2.heap_len >> 1; 1 <= r2; r2--) G(e2, s2, r2);
3474
+ for (i2 = h2; r2 = e2.heap[1], e2.heap[1] = e2.heap[e2.heap_len--], G(e2, s2, 1), n2 = e2.heap[1], e2.heap[--e2.heap_max] = r2, e2.heap[--e2.heap_max] = n2, s2[2 * i2] = s2[2 * r2] + s2[2 * n2], e2.depth[i2] = (e2.depth[r2] >= e2.depth[n2] ? e2.depth[r2] : e2.depth[n2]) + 1, s2[2 * r2 + 1] = s2[2 * n2 + 1] = i2, e2.heap[1] = i2++, G(e2, s2, 1), 2 <= e2.heap_len; ) ;
3475
+ e2.heap[--e2.heap_max] = e2.heap[1], function(e3, t3) {
3476
+ var r3, n3, i3, s3, a3, o3, h3 = t3.dyn_tree, u3 = t3.max_code, l2 = t3.stat_desc.static_tree, f2 = t3.stat_desc.has_stree, c2 = t3.stat_desc.extra_bits, d2 = t3.stat_desc.extra_base, p2 = t3.stat_desc.max_length, m2 = 0;
3477
+ for (s3 = 0; s3 <= g; s3++) e3.bl_count[s3] = 0;
3478
+ for (h3[2 * e3.heap[e3.heap_max] + 1] = 0, r3 = e3.heap_max + 1; r3 < _; r3++) p2 < (s3 = h3[2 * h3[2 * (n3 = e3.heap[r3]) + 1] + 1] + 1) && (s3 = p2, m2++), h3[2 * n3 + 1] = s3, u3 < n3 || (e3.bl_count[s3]++, a3 = 0, d2 <= n3 && (a3 = c2[n3 - d2]), o3 = h3[2 * n3], e3.opt_len += o3 * (s3 + a3), f2 && (e3.static_len += o3 * (l2[2 * n3 + 1] + a3)));
3479
+ if (0 !== m2) {
3480
+ do {
3481
+ for (s3 = p2 - 1; 0 === e3.bl_count[s3]; ) s3--;
3482
+ e3.bl_count[s3]--, e3.bl_count[s3 + 1] += 2, e3.bl_count[p2]--, m2 -= 2;
3483
+ } while (0 < m2);
3484
+ for (s3 = p2; 0 !== s3; s3--) for (n3 = e3.bl_count[s3]; 0 !== n3; ) u3 < (i3 = e3.heap[--r3]) || (h3[2 * i3 + 1] !== s3 && (e3.opt_len += (s3 - h3[2 * i3 + 1]) * h3[2 * i3], h3[2 * i3 + 1] = s3), n3--);
3485
+ }
3486
+ }(e2, t2), Z(s2, u2, e2.bl_count);
3487
+ }
3488
+ function X(e2, t2, r2) {
3489
+ var n2, i2, s2 = -1, a2 = t2[1], o2 = 0, h2 = 7, u2 = 4;
3490
+ for (0 === a2 && (h2 = 138, u2 = 3), t2[2 * (r2 + 1) + 1] = 65535, n2 = 0; n2 <= r2; n2++) i2 = a2, a2 = t2[2 * (n2 + 1) + 1], ++o2 < h2 && i2 === a2 || (o2 < u2 ? e2.bl_tree[2 * i2] += o2 : 0 !== i2 ? (i2 !== s2 && e2.bl_tree[2 * i2]++, e2.bl_tree[2 * b]++) : o2 <= 10 ? e2.bl_tree[2 * v]++ : e2.bl_tree[2 * y]++, s2 = i2, u2 = (o2 = 0) === a2 ? (h2 = 138, 3) : i2 === a2 ? (h2 = 6, 3) : (h2 = 7, 4));
3491
+ }
3492
+ function V(e2, t2, r2) {
3493
+ var n2, i2, s2 = -1, a2 = t2[1], o2 = 0, h2 = 7, u2 = 4;
3494
+ for (0 === a2 && (h2 = 138, u2 = 3), n2 = 0; n2 <= r2; n2++) if (i2 = a2, a2 = t2[2 * (n2 + 1) + 1], !(++o2 < h2 && i2 === a2)) {
3495
+ if (o2 < u2) for (; L(e2, i2, e2.bl_tree), 0 != --o2; ) ;
3496
+ else 0 !== i2 ? (i2 !== s2 && (L(e2, i2, e2.bl_tree), o2--), L(e2, b, e2.bl_tree), P(e2, o2 - 3, 2)) : o2 <= 10 ? (L(e2, v, e2.bl_tree), P(e2, o2 - 3, 3)) : (L(e2, y, e2.bl_tree), P(e2, o2 - 11, 7));
3497
+ s2 = i2, u2 = (o2 = 0) === a2 ? (h2 = 138, 3) : i2 === a2 ? (h2 = 6, 3) : (h2 = 7, 4);
3498
+ }
3499
+ }
3500
+ n(T);
3501
+ var q = false;
3502
+ function J(e2, t2, r2, n2) {
3503
+ P(e2, (s << 1) + (n2 ? 1 : 0), 3), function(e3, t3, r3, n3) {
3504
+ M(e3), U(e3, r3), U(e3, ~r3), i.arraySet(e3.pending_buf, e3.window, t3, r3, e3.pending), e3.pending += r3;
3505
+ }(e2, t2, r2);
3506
+ }
3507
+ r._tr_init = function(e2) {
3508
+ q || (function() {
3509
+ var e3, t2, r2, n2, i2, s2 = new Array(g + 1);
3510
+ for (n2 = r2 = 0; n2 < a - 1; n2++) for (I[n2] = r2, e3 = 0; e3 < 1 << w[n2]; e3++) A[r2++] = n2;
3511
+ for (A[r2 - 1] = n2, n2 = i2 = 0; n2 < 16; n2++) for (T[n2] = i2, e3 = 0; e3 < 1 << k[n2]; e3++) E[i2++] = n2;
3512
+ for (i2 >>= 7; n2 < f; n2++) for (T[n2] = i2 << 7, e3 = 0; e3 < 1 << k[n2] - 7; e3++) E[256 + i2++] = n2;
3513
+ for (t2 = 0; t2 <= g; t2++) s2[t2] = 0;
3514
+ for (e3 = 0; e3 <= 143; ) z[2 * e3 + 1] = 8, e3++, s2[8]++;
3515
+ for (; e3 <= 255; ) z[2 * e3 + 1] = 9, e3++, s2[9]++;
3516
+ for (; e3 <= 279; ) z[2 * e3 + 1] = 7, e3++, s2[7]++;
3517
+ for (; e3 <= 287; ) z[2 * e3 + 1] = 8, e3++, s2[8]++;
3518
+ for (Z(z, l + 1, s2), e3 = 0; e3 < f; e3++) C[2 * e3 + 1] = 5, C[2 * e3] = j(e3, 5);
3519
+ O = new D(z, w, u + 1, l, g), B = new D(C, k, 0, f, g), R = new D(new Array(0), x, 0, c, p);
3520
+ }(), q = true), e2.l_desc = new F(e2.dyn_ltree, O), e2.d_desc = new F(e2.dyn_dtree, B), e2.bl_desc = new F(e2.bl_tree, R), e2.bi_buf = 0, e2.bi_valid = 0, W(e2);
3521
+ }, r._tr_stored_block = J, r._tr_flush_block = function(e2, t2, r2, n2) {
3522
+ var i2, s2, a2 = 0;
3523
+ 0 < e2.level ? (2 === e2.strm.data_type && (e2.strm.data_type = function(e3) {
3524
+ var t3, r3 = 4093624447;
3525
+ for (t3 = 0; t3 <= 31; t3++, r3 >>>= 1) if (1 & r3 && 0 !== e3.dyn_ltree[2 * t3]) return o;
3526
+ if (0 !== e3.dyn_ltree[18] || 0 !== e3.dyn_ltree[20] || 0 !== e3.dyn_ltree[26]) return h;
3527
+ for (t3 = 32; t3 < u; t3++) if (0 !== e3.dyn_ltree[2 * t3]) return h;
3528
+ return o;
3529
+ }(e2)), Y(e2, e2.l_desc), Y(e2, e2.d_desc), a2 = function(e3) {
3530
+ var t3;
3531
+ for (X(e3, e3.dyn_ltree, e3.l_desc.max_code), X(e3, e3.dyn_dtree, e3.d_desc.max_code), Y(e3, e3.bl_desc), t3 = c - 1; 3 <= t3 && 0 === e3.bl_tree[2 * S[t3] + 1]; t3--) ;
3532
+ return e3.opt_len += 3 * (t3 + 1) + 5 + 5 + 4, t3;
3533
+ }(e2), i2 = e2.opt_len + 3 + 7 >>> 3, (s2 = e2.static_len + 3 + 7 >>> 3) <= i2 && (i2 = s2)) : i2 = s2 = r2 + 5, r2 + 4 <= i2 && -1 !== t2 ? J(e2, t2, r2, n2) : 4 === e2.strategy || s2 === i2 ? (P(e2, 2 + (n2 ? 1 : 0), 3), K(e2, z, C)) : (P(e2, 4 + (n2 ? 1 : 0), 3), function(e3, t3, r3, n3) {
3534
+ var i3;
3535
+ for (P(e3, t3 - 257, 5), P(e3, r3 - 1, 5), P(e3, n3 - 4, 4), i3 = 0; i3 < n3; i3++) P(e3, e3.bl_tree[2 * S[i3] + 1], 3);
3536
+ V(e3, e3.dyn_ltree, t3 - 1), V(e3, e3.dyn_dtree, r3 - 1);
3537
+ }(e2, e2.l_desc.max_code + 1, e2.d_desc.max_code + 1, a2 + 1), K(e2, e2.dyn_ltree, e2.dyn_dtree)), W(e2), n2 && M(e2);
3538
+ }, r._tr_tally = function(e2, t2, r2) {
3539
+ return e2.pending_buf[e2.d_buf + 2 * e2.last_lit] = t2 >>> 8 & 255, e2.pending_buf[e2.d_buf + 2 * e2.last_lit + 1] = 255 & t2, e2.pending_buf[e2.l_buf + e2.last_lit] = 255 & r2, e2.last_lit++, 0 === t2 ? e2.dyn_ltree[2 * r2]++ : (e2.matches++, t2--, e2.dyn_ltree[2 * (A[r2] + u + 1)]++, e2.dyn_dtree[2 * N(t2)]++), e2.last_lit === e2.lit_bufsize - 1;
3540
+ }, r._tr_align = function(e2) {
3541
+ P(e2, 2, 3), L(e2, m, z), function(e3) {
3542
+ 16 === e3.bi_valid ? (U(e3, e3.bi_buf), e3.bi_buf = 0, e3.bi_valid = 0) : 8 <= e3.bi_valid && (e3.pending_buf[e3.pending++] = 255 & e3.bi_buf, e3.bi_buf >>= 8, e3.bi_valid -= 8);
3543
+ }(e2);
3544
+ };
3545
+ }, { "../utils/common": 41 }], 53: [function(e, t, r) {
3546
+ t.exports = function() {
3547
+ this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0;
3548
+ };
3549
+ }, {}], 54: [function(e, t, r) {
3550
+ (function(e2) {
3551
+ !function(r2, n) {
3552
+ if (!r2.setImmediate) {
3553
+ var i, s, t2, a, o = 1, h = {}, u = false, l = r2.document, e3 = Object.getPrototypeOf && Object.getPrototypeOf(r2);
3554
+ e3 = e3 && e3.setTimeout ? e3 : r2, i = "[object process]" === {}.toString.call(r2.process) ? function(e4) {
3555
+ process.nextTick(function() {
3556
+ c(e4);
3557
+ });
3558
+ } : function() {
3559
+ if (r2.postMessage && !r2.importScripts) {
3560
+ var e4 = true, t3 = r2.onmessage;
3561
+ return r2.onmessage = function() {
3562
+ e4 = false;
3563
+ }, r2.postMessage("", "*"), r2.onmessage = t3, e4;
3564
+ }
3565
+ }() ? (a = "setImmediate$" + Math.random() + "$", r2.addEventListener ? r2.addEventListener("message", d, false) : r2.attachEvent("onmessage", d), function(e4) {
3566
+ r2.postMessage(a + e4, "*");
3567
+ }) : r2.MessageChannel ? ((t2 = new MessageChannel()).port1.onmessage = function(e4) {
3568
+ c(e4.data);
3569
+ }, function(e4) {
3570
+ t2.port2.postMessage(e4);
3571
+ }) : l && "onreadystatechange" in l.createElement("script") ? (s = l.documentElement, function(e4) {
3572
+ var t3 = l.createElement("script");
3573
+ t3.onreadystatechange = function() {
3574
+ c(e4), t3.onreadystatechange = null, s.removeChild(t3), t3 = null;
3575
+ }, s.appendChild(t3);
3576
+ }) : function(e4) {
3577
+ setTimeout(c, 0, e4);
3578
+ }, e3.setImmediate = function(e4) {
3579
+ "function" != typeof e4 && (e4 = new Function("" + e4));
3580
+ for (var t3 = new Array(arguments.length - 1), r3 = 0; r3 < t3.length; r3++) t3[r3] = arguments[r3 + 1];
3581
+ var n2 = { callback: e4, args: t3 };
3582
+ return h[o] = n2, i(o), o++;
3583
+ }, e3.clearImmediate = f;
3584
+ }
3585
+ function f(e4) {
3586
+ delete h[e4];
3587
+ }
3588
+ function c(e4) {
3589
+ if (u) setTimeout(c, 0, e4);
3590
+ else {
3591
+ var t3 = h[e4];
3592
+ if (t3) {
3593
+ u = true;
3594
+ try {
3595
+ !function(e5) {
3596
+ var t4 = e5.callback, r3 = e5.args;
3597
+ switch (r3.length) {
3598
+ case 0:
3599
+ t4();
3600
+ break;
3601
+ case 1:
3602
+ t4(r3[0]);
3603
+ break;
3604
+ case 2:
3605
+ t4(r3[0], r3[1]);
3606
+ break;
3607
+ case 3:
3608
+ t4(r3[0], r3[1], r3[2]);
3609
+ break;
3610
+ default:
3611
+ t4.apply(n, r3);
3612
+ }
3613
+ }(t3);
3614
+ } finally {
3615
+ f(e4), u = false;
3616
+ }
3617
+ }
3618
+ }
3619
+ }
3620
+ function d(e4) {
3621
+ e4.source === r2 && "string" == typeof e4.data && 0 === e4.data.indexOf(a) && c(+e4.data.slice(a.length));
3622
+ }
3623
+ }("undefined" == typeof self ? void 0 === e2 ? this : e2 : self);
3624
+ }).call(this, "undefined" != typeof commonjsGlobal ? commonjsGlobal : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
3625
+ }, {}] }, {}, [10])(10);
3626
+ });
3627
+ })(jszip_min);
3628
+ var jszip_minExports = jszip_min.exports;
3629
+ const JSZip = /* @__PURE__ */ getDefaultExportFromCjs(jszip_minExports);
3630
+ async function downloadImages(images, options) {
3631
+ if (images.length === 1) {
3632
+ const [dataURL, fileName] = images[0];
3633
+ await download(dataURL, fileName);
3634
+ } else if (images.length > 1) {
3635
+ const zipName = parseZipLabel(options);
3636
+ const zipBlob = await zipUpImages(images);
3637
+ await download(zipBlob, zipName);
3638
+ }
3639
+ }
3640
+ async function zipUpImages(images) {
3641
+ const zip = new JSZip();
3642
+ images.forEach(([dataURL, filename]) => {
3643
+ const content = dataURL.split(",")[1];
3644
+ zip.file(filename, content, { base64: true });
3645
+ });
3646
+ try {
3647
+ const zipBlob = await zip.generateAsync({ type: "blob" });
3648
+ return zipBlob;
3649
+ } catch (error) {
3650
+ console.error("Error creating ZIP:", error);
3651
+ throw error;
3652
+ }
3653
+ }
3654
+ const defaultOptions = {
3655
+ corsProxyBaseUrl: "",
3656
+ downloadImages: true,
3657
+ selectors: {
3658
+ wrapper: "[ie='wrapper']",
3659
+ capture: "[ie='capture']",
3660
+ trigger: "[ie='trigger']",
3661
+ slug: "[ie='slug']",
3662
+ ignore: "[ie='ignore']"
3663
+ },
3664
+ image: {
3665
+ scale: {
3666
+ value: 1,
3667
+ attributeSelector: "ie-scale",
3668
+ inputSelector: "ie-scale-input"
3669
+ },
3670
+ quality: {
3671
+ value: 1,
3672
+ attributeSelector: "ie-quality",
3673
+ inputSelector: "ie-quality-input"
3674
+ },
3675
+ format: {
3676
+ value: "jpg",
3677
+ attributeSelector: "ie-format",
3678
+ inputSelector: "ie-format-input"
3679
+ },
3680
+ dateInLabel: {
3681
+ value: true,
3682
+ attributeSelector: "ie-img-label-date",
3683
+ inputSelector: "ie-img-label-date-input"
3684
+ },
3685
+ scaleInLabel: {
3686
+ value: true,
3687
+ attributeSelector: "ie-img-label-scale",
3688
+ inputSelector: "ie-img-label-scale-input"
3689
+ }
3690
+ },
3691
+ zip: {
3692
+ label: {
3693
+ value: "images",
3694
+ attributeSelector: "ie-zip-label",
3695
+ inputSelector: "ie-zip-label-input"
3696
+ },
3697
+ dateInLabel: {
3698
+ value: true,
3699
+ attributeSelector: "ie-zip-label-date",
3700
+ inputSelector: "ie-zip-label-date-input"
3701
+ },
3702
+ scaleInLabel: {
3703
+ value: true,
3704
+ attributeSelector: "ie-zip-label-scale",
3705
+ inputSelector: "ie-zip-label-scale-input"
3706
+ }
3707
+ },
3708
+ debug: false
3709
+ };
3710
+ function cleanUp(options, captureElements) {
3711
+ const sourceElements = document.querySelectorAll("[ie-clone-source]");
3712
+ if (sourceElements) {
3713
+ sourceElements.forEach((sourceElement) => {
3714
+ const attributeValue = sourceElement.getAttribute("ie-clone-source");
3715
+ sourceElement.removeAttribute("ie-clone-source");
3716
+ if (attributeValue) {
3717
+ sourceElement.setAttribute(options.image.scale.attributeSelector, attributeValue);
3718
+ }
3719
+ let parentElement = sourceElement.parentElement;
3720
+ let lastCloneParent = null;
3721
+ while (parentElement) {
3722
+ if (parentElement.hasAttribute("ie-clone")) {
3723
+ lastCloneParent = parentElement;
3724
+ }
3725
+ parentElement = parentElement.parentElement;
3726
+ }
3727
+ if (lastCloneParent) {
3728
+ const nextSibling = lastCloneParent.nextElementSibling;
3729
+ if (nextSibling) {
3730
+ nextSibling.parentNode.insertBefore(sourceElement, nextSibling);
3731
+ } else {
3732
+ lastCloneParent.parentNode.appendChild(sourceElement);
3733
+ }
3734
+ lastCloneParent.remove();
3735
+ }
3736
+ });
3737
+ }
3738
+ }
3739
+ class ImageExporter {
3740
+ constructor(userOptions = {}) {
3741
+ this.options = { ...defaultOptions, ...userOptions };
3742
+ }
3743
+ /**
3744
+ * Captures images from all elements specified in the options.
3745
+ * If downloadImages is set to true, the images will be downloaded.
3746
+ *
3747
+ * @returns {types.Image[]} An array of captured images.
3748
+ */
3749
+ async captureAll() {
3750
+ this.options = determineOptions(this.options);
3751
+ const captureElements = getCaptureElements(this.options);
3752
+ const images = await captureImages(this.options, captureElements);
3753
+ if (this.options.downloadImages) downloadImages(images, this.options);
3754
+ cleanUp(this.options);
3755
+ return images;
3756
+ }
3757
+ /**
3758
+ * Captures an image from a single element.
3759
+ * If downloadImages is set to true, the image will be downloaded.
3760
+ *
3761
+ * If multiscale elements are found,
3762
+ * the element will be cloned and captured at each scale.
3763
+ */
3764
+ async captureElement(element) {
3765
+ this.options = determineOptions(this.options);
3766
+ await runCorsProxy(this.options);
3767
+ ignoreFilter(this.options);
3768
+ const multiScale = findMultiScaleElements(this.options);
3769
+ if (multiScale) {
3770
+ const elements = Array.from(
3771
+ document.querySelectorAll(
3772
+ "[ie-clone], [ie-clone-source]"
3773
+ )
3774
+ );
3775
+ const images = await captureImages(this.options, elements);
3776
+ if (this.options.downloadImages) downloadImages(images, this.options);
3777
+ cleanUp(this.options);
3778
+ return images;
3779
+ }
3780
+ const image = await captureImage(
3781
+ element,
3782
+ getItemOptions(element, this.options, 1)
3783
+ );
3784
+ if (this.options.downloadImages) downloadImages([image], this.options);
3785
+ cleanUp(this.options);
3786
+ return image;
3787
+ }
3788
+ /**
3789
+ * Adds a click event listener to the trigger element.
3790
+ * If no element is provided, the captureAll method will be run on click.
3791
+ * If an element is provided, provided element will be captured on click.
3792
+ */
3793
+ addTrigger(triggerSelector, element = null) {
3794
+ const triggerElement = document.querySelector(triggerSelector);
3795
+ if (!triggerElement) throw new Error("Trigger element not found");
3796
+ if (!element) {
3797
+ triggerElement.addEventListener("click", () => {
3798
+ this.captureAll();
3799
+ });
3800
+ } else {
3801
+ triggerElement.addEventListener("click", () => {
3802
+ this.captureElement(element);
3803
+ });
3804
+ }
3805
+ }
3806
+ }
3807
+ if (typeof window !== "undefined") {
3808
+ window.ImageExporter = ImageExporter;
3809
+ }
3810
+ exports2.ImageExporter = ImageExporter;
3811
+ Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
3812
+ });
3813
+ })()