@casualoffice/sheets 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/LICENSE +200 -0
  2. package/dist/embed/embed-runtime.js +537 -0
  3. package/dist/embed/embed.html +29 -0
  4. package/dist/embed/parser.worker.js +48474 -0
  5. package/dist/embed.cjs +225 -0
  6. package/dist/embed.cjs.map +1 -0
  7. package/dist/embed.d.cts +100 -0
  8. package/dist/embed.d.ts +100 -0
  9. package/dist/embed.js +204 -0
  10. package/dist/embed.js.map +1 -0
  11. package/dist/index.cjs +1549 -0
  12. package/dist/index.cjs.map +1 -0
  13. package/dist/index.d.cts +9 -0
  14. package/dist/index.d.ts +9 -0
  15. package/dist/index.js +1530 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/parser.worker.cjs +48469 -0
  18. package/dist/parser.worker.cjs.map +1 -0
  19. package/dist/parser.worker.js +48474 -0
  20. package/dist/parser.worker.js.map +1 -0
  21. package/dist/protocol--KyBQUjU.d.cts +171 -0
  22. package/dist/protocol-cEzy7S0i.d.ts +171 -0
  23. package/dist/sheets.cjs +677 -0
  24. package/dist/sheets.cjs.map +1 -0
  25. package/dist/sheets.d.cts +177 -0
  26. package/dist/sheets.d.ts +177 -0
  27. package/dist/sheets.js +658 -0
  28. package/dist/sheets.js.map +1 -0
  29. package/dist/signing.cjs +706 -0
  30. package/dist/signing.cjs.map +1 -0
  31. package/dist/signing.d.cts +141 -0
  32. package/dist/signing.d.ts +141 -0
  33. package/dist/signing.js +683 -0
  34. package/dist/signing.js.map +1 -0
  35. package/dist/styles.cjs +10 -0
  36. package/dist/styles.cjs.map +1 -0
  37. package/dist/styles.d.cts +2 -0
  38. package/dist/styles.d.ts +2 -0
  39. package/dist/styles.js +8 -0
  40. package/dist/styles.js.map +1 -0
  41. package/dist/types-s_O0u6Cg.d.cts +90 -0
  42. package/dist/types-s_O0u6Cg.d.ts +90 -0
  43. package/dist/univer.cjs +220 -0
  44. package/dist/univer.cjs.map +1 -0
  45. package/dist/univer.d.cts +60 -0
  46. package/dist/univer.d.ts +60 -0
  47. package/dist/univer.js +187 -0
  48. package/dist/univer.js.map +1 -0
  49. package/dist/xlsx.cjs +3388 -0
  50. package/dist/xlsx.cjs.map +1 -0
  51. package/dist/xlsx.d.cts +383 -0
  52. package/dist/xlsx.d.ts +383 -0
  53. package/dist/xlsx.js +3383 -0
  54. package/dist/xlsx.js.map +1 -0
  55. package/package.json +293 -0
  56. package/src/embed/EmbedHostTransport.ts +226 -0
  57. package/src/embed/EmbedTransport.ts +323 -0
  58. package/src/embed/EmbedTransport.unit.test.ts +161 -0
  59. package/src/embed/index.ts +40 -0
  60. package/src/embed/protocol.ts +258 -0
  61. package/src/embed-runtime/embed.html +29 -0
  62. package/src/embed-runtime/index.tsx +440 -0
  63. package/src/index.ts +16 -0
  64. package/src/sheets/CasualSheets.tsx +319 -0
  65. package/src/sheets/CasualSheetsIframe.tsx +220 -0
  66. package/src/sheets/api.ts +108 -0
  67. package/src/sheets/index.ts +11 -0
  68. package/src/signing/SigningPane.tsx +374 -0
  69. package/src/signing/SigningProvider.tsx +126 -0
  70. package/src/signing/captures.tsx +316 -0
  71. package/src/signing/controller.ts +151 -0
  72. package/src/signing/controller.unit.test.ts +133 -0
  73. package/src/signing/index.ts +44 -0
  74. package/src/signing/types.ts +89 -0
  75. package/src/styles.ts +16 -0
  76. package/src/univer/index.ts +17 -0
  77. package/src/univer/lazy-plugins.ts +280 -0
  78. package/src/xlsx/_perf.ts +14 -0
  79. package/src/xlsx/_snapshot-constants.ts +15 -0
  80. package/src/xlsx/comments-resource.ts +209 -0
  81. package/src/xlsx/constants.ts +9 -0
  82. package/src/xlsx/data-validation-resource.ts +219 -0
  83. package/src/xlsx/import.ts +35 -0
  84. package/src/xlsx/index.ts +40 -0
  85. package/src/xlsx/page-setup-resource.ts +205 -0
  86. package/src/xlsx/parse-impl.ts +418 -0
  87. package/src/xlsx/parse-in-worker.ts +82 -0
  88. package/src/xlsx/parser.worker.ts +39 -0
  89. package/src/xlsx/passthrough-resource.ts +175 -0
  90. package/src/xlsx/pivot-passthrough.ts +359 -0
  91. package/src/xlsx/style-mapping.ts +171 -0
  92. package/src/xlsx/tables-resource.ts +211 -0
package/dist/xlsx.cjs ADDED
@@ -0,0 +1,3388 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+
33
+ // ../../node_modules/.pnpm/jszip@3.10.1/node_modules/jszip/dist/jszip.min.js
34
+ var require_jszip_min = __commonJS({
35
+ "../../node_modules/.pnpm/jszip@3.10.1/node_modules/jszip/dist/jszip.min.js"(exports, module2) {
36
+ "use strict";
37
+ !(function(e) {
38
+ if ("object" == typeof exports && "undefined" != typeof module2) module2.exports = e();
39
+ else if ("function" == typeof define && define.amd) define([], e);
40
+ else {
41
+ ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).JSZip = e();
42
+ }
43
+ })(function() {
44
+ return (function s(a, o, h) {
45
+ function u(r, e2) {
46
+ if (!o[r]) {
47
+ if (!a[r]) {
48
+ var t = "function" == typeof require && require;
49
+ if (!e2 && t) return t(r, true);
50
+ if (l) return l(r, true);
51
+ var n = new Error("Cannot find module '" + r + "'");
52
+ throw n.code = "MODULE_NOT_FOUND", n;
53
+ }
54
+ var i = o[r] = { exports: {} };
55
+ a[r][0].call(i.exports, function(e3) {
56
+ var t2 = a[r][1][e3];
57
+ return u(t2 || e3);
58
+ }, i, i.exports, s, a, o, h);
59
+ }
60
+ return o[r].exports;
61
+ }
62
+ for (var l = "function" == typeof require && require, e = 0; e < h.length; e++) u(h[e]);
63
+ return u;
64
+ })({ 1: [function(e, t, r) {
65
+ "use strict";
66
+ var d = e("./utils"), c = e("./support"), p = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
67
+ r.encode = function(e2) {
68
+ 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));
69
+ return h.join("");
70
+ }, r.decode = function(e2) {
71
+ var t2, r2, n, i, s, a, o = 0, h = 0, u = "data:";
72
+ if (e2.substr(0, u.length) === u) throw new Error("Invalid base64 input, it looks like a data url.");
73
+ var l, f = 3 * (e2 = e2.replace(/[^A-Za-z0-9+/=]/g, "")).length / 4;
74
+ 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.");
75
+ 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);
76
+ return l;
77
+ };
78
+ }, { "./support": 30, "./utils": 32 }], 2: [function(e, t, r) {
79
+ "use strict";
80
+ var n = e("./external"), i = e("./stream/DataWorker"), s = e("./stream/Crc32Probe"), a = e("./stream/DataLengthProbe");
81
+ function o(e2, t2, r2, n2, i2) {
82
+ this.compressedSize = e2, this.uncompressedSize = t2, this.crc32 = r2, this.compression = n2, this.compressedContent = i2;
83
+ }
84
+ o.prototype = { getContentWorker: function() {
85
+ var e2 = new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")), t2 = this;
86
+ return e2.on("end", function() {
87
+ if (this.streamInfo.data_length !== t2.uncompressedSize) throw new Error("Bug : uncompressed data size mismatch");
88
+ }), e2;
89
+ }, getCompressedWorker: function() {
90
+ return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression);
91
+ } }, o.createWorkerFrom = function(e2, t2, r2) {
92
+ return e2.pipe(new s()).pipe(new a("uncompressedSize")).pipe(t2.compressWorker(r2)).pipe(new a("compressedSize")).withStreamInfo("compression", t2);
93
+ }, t.exports = o;
94
+ }, { "./external": 6, "./stream/Crc32Probe": 25, "./stream/DataLengthProbe": 26, "./stream/DataWorker": 27 }], 3: [function(e, t, r) {
95
+ "use strict";
96
+ var n = e("./stream/GenericWorker");
97
+ r.STORE = { magic: "\0\0", compressWorker: function() {
98
+ return new n("STORE compression");
99
+ }, uncompressWorker: function() {
100
+ return new n("STORE decompression");
101
+ } }, r.DEFLATE = e("./flate");
102
+ }, { "./flate": 7, "./stream/GenericWorker": 28 }], 4: [function(e, t, r) {
103
+ "use strict";
104
+ var n = e("./utils");
105
+ var o = (function() {
106
+ for (var e2, t2 = [], r2 = 0; r2 < 256; r2++) {
107
+ e2 = r2;
108
+ for (var n2 = 0; n2 < 8; n2++) e2 = 1 & e2 ? 3988292384 ^ e2 >>> 1 : e2 >>> 1;
109
+ t2[r2] = e2;
110
+ }
111
+ return t2;
112
+ })();
113
+ t.exports = function(e2, t2) {
114
+ return void 0 !== e2 && e2.length ? "string" !== n.getTypeOf(e2) ? (function(e3, t3, r2, n2) {
115
+ var i = o, s = n2 + r2;
116
+ e3 ^= -1;
117
+ for (var a = n2; a < s; a++) e3 = e3 >>> 8 ^ i[255 & (e3 ^ t3[a])];
118
+ return -1 ^ e3;
119
+ })(0 | t2, e2, e2.length, 0) : (function(e3, t3, r2, n2) {
120
+ var i = o, s = n2 + r2;
121
+ e3 ^= -1;
122
+ for (var a = n2; a < s; a++) e3 = e3 >>> 8 ^ i[255 & (e3 ^ t3.charCodeAt(a))];
123
+ return -1 ^ e3;
124
+ })(0 | t2, e2, e2.length, 0) : 0;
125
+ };
126
+ }, { "./utils": 32 }], 5: [function(e, t, r) {
127
+ "use strict";
128
+ 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;
129
+ }, {}], 6: [function(e, t, r) {
130
+ "use strict";
131
+ var n = null;
132
+ n = "undefined" != typeof Promise ? Promise : e("lie"), t.exports = { Promise: n };
133
+ }, { lie: 37 }], 7: [function(e, t, r) {
134
+ "use strict";
135
+ 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";
136
+ function h(e2, t2) {
137
+ a.call(this, "FlateWorker/" + e2), this._pako = null, this._pakoAction = e2, this._pakoOptions = t2, this.meta = {};
138
+ }
139
+ r.magic = "\b\0", s.inherits(h, a), h.prototype.processChunk = function(e2) {
140
+ this.meta = e2.meta, null === this._pako && this._createPako(), this._pako.push(s.transformTo(o, e2.data), false);
141
+ }, h.prototype.flush = function() {
142
+ a.prototype.flush.call(this), null === this._pako && this._createPako(), this._pako.push([], true);
143
+ }, h.prototype.cleanUp = function() {
144
+ a.prototype.cleanUp.call(this), this._pako = null;
145
+ }, h.prototype._createPako = function() {
146
+ this._pako = new i[this._pakoAction]({ raw: true, level: this._pakoOptions.level || -1 });
147
+ var t2 = this;
148
+ this._pako.onData = function(e2) {
149
+ t2.push({ data: e2, meta: t2.meta });
150
+ };
151
+ }, r.compressWorker = function(e2) {
152
+ return new h("Deflate", e2);
153
+ }, r.uncompressWorker = function() {
154
+ return new h("Inflate", {});
155
+ };
156
+ }, { "./stream/GenericWorker": 28, "./utils": 32, pako: 38 }], 8: [function(e, t, r) {
157
+ "use strict";
158
+ function A(e2, t2) {
159
+ var r2, n2 = "";
160
+ for (r2 = 0; r2 < t2; r2++) n2 += String.fromCharCode(255 & e2), e2 >>>= 8;
161
+ return n2;
162
+ }
163
+ function n(e2, t2, r2, n2, i2, s2) {
164
+ 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 };
165
+ t2 && !r2 || (x.crc32 = e2.crc32, x.compressedSize = e2.compressedSize, x.uncompressedSize = e2.uncompressedSize);
166
+ var S = 0;
167
+ t2 && (S |= 8), l || !_ && !g || (S |= 2048);
168
+ var z = 0, C = 0;
169
+ w && (z |= 16), "UNIX" === i2 ? (C = 798, z |= (function(e3, t3) {
170
+ var r3 = e3;
171
+ return e3 || (r3 = t3 ? 16893 : 33204), (65535 & r3) << 16;
172
+ })(h.unixPermissions, w)) : (C = 20, z |= (function(e3) {
173
+ return 63 & (e3 || 0);
174
+ })(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);
175
+ var E = "";
176
+ 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 };
177
+ }
178
+ var I = e("../utils"), i = e("../stream/GenericWorker"), O = e("../utf8"), B = e("../crc32"), R = e("../signature");
179
+ function s(e2, t2, r2, n2) {
180
+ 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 = [];
181
+ }
182
+ I.inherits(s, i), s.prototype.push = function(e2) {
183
+ var t2 = e2.meta.percent || 0, r2 = this.entriesCount, n2 = this._sources.length;
184
+ 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 } }));
185
+ }, s.prototype.openedSource = function(e2) {
186
+ this.currentSourceOffset = this.bytesWritten, this.currentFile = e2.file.name;
187
+ var t2 = this.streamFiles && !e2.file.dir;
188
+ if (t2) {
189
+ var r2 = n(e2, t2, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
190
+ this.push({ data: r2.fileRecord, meta: { percent: 0 } });
191
+ } else this.accumulate = true;
192
+ }, s.prototype.closedSource = function(e2) {
193
+ this.accumulate = false;
194
+ var t2 = this.streamFiles && !e2.file.dir, r2 = n(e2, t2, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
195
+ if (this.dirRecords.push(r2.dirRecord), t2) this.push({ data: (function(e3) {
196
+ return R.DATA_DESCRIPTOR + A(e3.crc32, 4) + A(e3.compressedSize, 4) + A(e3.uncompressedSize, 4);
197
+ })(e2), meta: { percent: 100 } });
198
+ else for (this.push({ data: r2.fileRecord, meta: { percent: 0 } }); this.contentBuffer.length; ) this.push(this.contentBuffer.shift());
199
+ this.currentFile = null;
200
+ }, s.prototype.flush = function() {
201
+ for (var e2 = this.bytesWritten, t2 = 0; t2 < this.dirRecords.length; t2++) this.push({ data: this.dirRecords[t2], meta: { percent: 100 } });
202
+ var r2 = this.bytesWritten - e2, n2 = (function(e3, t3, r3, n3, i2) {
203
+ var s2 = I.transformTo("string", i2(n3));
204
+ 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;
205
+ })(this.dirRecords.length, r2, e2, this.zipComment, this.encodeFileName);
206
+ this.push({ data: n2, meta: { percent: 100 } });
207
+ }, s.prototype.prepareNextSource = function() {
208
+ this.previous = this._sources.shift(), this.openedSource(this.previous.streamInfo), this.isPaused ? this.previous.pause() : this.previous.resume();
209
+ }, s.prototype.registerPrevious = function(e2) {
210
+ this._sources.push(e2);
211
+ var t2 = this;
212
+ return e2.on("data", function(e3) {
213
+ t2.processChunk(e3);
214
+ }), e2.on("end", function() {
215
+ t2.closedSource(t2.previous.streamInfo), t2._sources.length ? t2.prepareNextSource() : t2.end();
216
+ }), e2.on("error", function(e3) {
217
+ t2.error(e3);
218
+ }), this;
219
+ }, s.prototype.resume = function() {
220
+ 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));
221
+ }, s.prototype.error = function(e2) {
222
+ var t2 = this._sources;
223
+ if (!i.prototype.error.call(this, e2)) return false;
224
+ for (var r2 = 0; r2 < t2.length; r2++) try {
225
+ t2[r2].error(e2);
226
+ } catch (e3) {
227
+ }
228
+ return true;
229
+ }, s.prototype.lock = function() {
230
+ i.prototype.lock.call(this);
231
+ for (var e2 = this._sources, t2 = 0; t2 < e2.length; t2++) e2[t2].lock();
232
+ }, t.exports = s;
233
+ }, { "../crc32": 4, "../signature": 23, "../stream/GenericWorker": 28, "../utf8": 31, "../utils": 32 }], 9: [function(e, t, r) {
234
+ "use strict";
235
+ var u = e("../compressions"), n = e("./ZipFileWorker");
236
+ r.generateWorker = function(e2, a, t2) {
237
+ var o = new n(a.streamFiles, t2, a.platform, a.encodeFileName), h = 0;
238
+ try {
239
+ e2.forEach(function(e3, t3) {
240
+ h++;
241
+ var r2 = (function(e4, t4) {
242
+ var r3 = e4 || t4, n3 = u[r3];
243
+ if (!n3) throw new Error(r3 + " is not a valid compression method !");
244
+ return n3;
245
+ })(t3.options.compression, a.compression), n2 = t3.options.compressionOptions || a.compressionOptions || {}, i = t3.dir, s = t3.date;
246
+ t3._compressWorker(r2, n2).withStreamInfo("file", { name: e3, dir: i, date: s, comment: t3.comment || "", unixPermissions: t3.unixPermissions, dosPermissions: t3.dosPermissions }).pipe(o);
247
+ }), o.entriesCount = h;
248
+ } catch (e3) {
249
+ o.error(e3);
250
+ }
251
+ return o;
252
+ };
253
+ }, { "../compressions": 3, "./ZipFileWorker": 8 }], 10: [function(e, t, r) {
254
+ "use strict";
255
+ function n() {
256
+ if (!(this instanceof n)) return new n();
257
+ if (arguments.length) throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");
258
+ this.files = /* @__PURE__ */ Object.create(null), this.comment = null, this.root = "", this.clone = function() {
259
+ var e2 = new n();
260
+ for (var t2 in this) "function" != typeof this[t2] && (e2[t2] = this[t2]);
261
+ return e2;
262
+ };
263
+ }
264
+ (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) {
265
+ return new n().loadAsync(e2, t2);
266
+ }, n.external = e("./external"), t.exports = n;
267
+ }, { "./defaults": 5, "./external": 6, "./load": 11, "./object": 15, "./support": 30 }], 11: [function(e, t, r) {
268
+ "use strict";
269
+ var u = e("./utils"), i = e("./external"), n = e("./utf8"), s = e("./zipEntries"), a = e("./stream/Crc32Probe"), l = e("./nodejsUtils");
270
+ function f(n2) {
271
+ return new i.Promise(function(e2, t2) {
272
+ var r2 = n2.decompressed.getContentWorker().pipe(new a());
273
+ r2.on("error", function(e3) {
274
+ t2(e3);
275
+ }).on("end", function() {
276
+ r2.streamInfo.crc32 !== n2.decompressed.crc32 ? t2(new Error("Corrupted zip : CRC32 mismatch")) : e2();
277
+ }).resume();
278
+ });
279
+ }
280
+ t.exports = function(e2, o) {
281
+ var h = this;
282
+ 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) {
283
+ var t2 = new s(o);
284
+ return t2.load(e3), t2;
285
+ }).then(function(e3) {
286
+ var t2 = [i.Promise.resolve(e3)], r2 = e3.files;
287
+ if (o.checkCRC32) for (var n2 = 0; n2 < r2.length; n2++) t2.push(f(r2[n2]));
288
+ return i.Promise.all(t2);
289
+ }).then(function(e3) {
290
+ for (var t2 = e3.shift(), r2 = t2.files, n2 = 0; n2 < r2.length; n2++) {
291
+ var i2 = r2[n2], s2 = i2.fileNameStr, a2 = u.resolve(i2.fileNameStr);
292
+ 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);
293
+ }
294
+ return t2.zipComment.length && (h.comment = t2.zipComment), h;
295
+ });
296
+ };
297
+ }, { "./external": 6, "./nodejsUtils": 14, "./stream/Crc32Probe": 25, "./utf8": 31, "./utils": 32, "./zipEntries": 33 }], 12: [function(e, t, r) {
298
+ "use strict";
299
+ var n = e("../utils"), i = e("../stream/GenericWorker");
300
+ function s(e2, t2) {
301
+ i.call(this, "Nodejs stream input adapter for " + e2), this._upstreamEnded = false, this._bindStream(t2);
302
+ }
303
+ n.inherits(s, i), s.prototype._bindStream = function(e2) {
304
+ var t2 = this;
305
+ (this._stream = e2).pause(), e2.on("data", function(e3) {
306
+ t2.push({ data: e3, meta: { percent: 0 } });
307
+ }).on("error", function(e3) {
308
+ t2.isPaused ? this.generatedError = e3 : t2.error(e3);
309
+ }).on("end", function() {
310
+ t2.isPaused ? t2._upstreamEnded = true : t2.end();
311
+ });
312
+ }, s.prototype.pause = function() {
313
+ return !!i.prototype.pause.call(this) && (this._stream.pause(), true);
314
+ }, s.prototype.resume = function() {
315
+ return !!i.prototype.resume.call(this) && (this._upstreamEnded ? this.end() : this._stream.resume(), true);
316
+ }, t.exports = s;
317
+ }, { "../stream/GenericWorker": 28, "../utils": 32 }], 13: [function(e, t, r) {
318
+ "use strict";
319
+ var i = e("readable-stream").Readable;
320
+ function n(e2, t2, r2) {
321
+ i.call(this, t2), this._helper = e2;
322
+ var n2 = this;
323
+ e2.on("data", function(e3, t3) {
324
+ n2.push(e3) || n2._helper.pause(), r2 && r2(t3);
325
+ }).on("error", function(e3) {
326
+ n2.emit("error", e3);
327
+ }).on("end", function() {
328
+ n2.push(null);
329
+ });
330
+ }
331
+ e("../utils").inherits(n, i), n.prototype._read = function() {
332
+ this._helper.resume();
333
+ }, t.exports = n;
334
+ }, { "../utils": 32, "readable-stream": 16 }], 14: [function(e, t, r) {
335
+ "use strict";
336
+ t.exports = { isNode: "undefined" != typeof Buffer, newBufferFrom: function(e2, t2) {
337
+ if (Buffer.from && Buffer.from !== Uint8Array.from) return Buffer.from(e2, t2);
338
+ if ("number" == typeof e2) throw new Error('The "data" argument must not be a number');
339
+ return new Buffer(e2, t2);
340
+ }, allocBuffer: function(e2) {
341
+ if (Buffer.alloc) return Buffer.alloc(e2);
342
+ var t2 = new Buffer(e2);
343
+ return t2.fill(0), t2;
344
+ }, isBuffer: function(e2) {
345
+ return Buffer.isBuffer(e2);
346
+ }, isStream: function(e2) {
347
+ return e2 && "function" == typeof e2.on && "function" == typeof e2.pause && "function" == typeof e2.resume;
348
+ } };
349
+ }, {}], 15: [function(e, t, r) {
350
+ "use strict";
351
+ function s(e2, t2, r2) {
352
+ var n2, i2 = u.getTypeOf(t2), s2 = u.extend(r2 || {}, f);
353
+ 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);
354
+ var a2 = "string" === i2 && false === s2.binary && false === s2.base64;
355
+ 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");
356
+ var o2 = null;
357
+ 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);
358
+ var h2 = new d(e2, o2, s2);
359
+ this.files[e2] = h2;
360
+ }
361
+ 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) {
362
+ "/" === e2.slice(-1) && (e2 = e2.substring(0, e2.length - 1));
363
+ var t2 = e2.lastIndexOf("/");
364
+ return 0 < t2 ? e2.substring(0, t2) : "";
365
+ }, g = function(e2) {
366
+ return "/" !== e2.slice(-1) && (e2 += "/"), e2;
367
+ }, b = function(e2, t2) {
368
+ 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];
369
+ };
370
+ function h(e2) {
371
+ return "[object RegExp]" === Object.prototype.toString.call(e2);
372
+ }
373
+ var n = { load: function() {
374
+ throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
375
+ }, forEach: function(e2) {
376
+ var t2, r2, n2;
377
+ 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);
378
+ }, filter: function(r2) {
379
+ var n2 = [];
380
+ return this.forEach(function(e2, t2) {
381
+ r2(e2, t2) && n2.push(t2);
382
+ }), n2;
383
+ }, file: function(e2, t2, r2) {
384
+ if (1 !== arguments.length) return e2 = this.root + e2, s.call(this, e2, t2, r2), this;
385
+ if (h(e2)) {
386
+ var n2 = e2;
387
+ return this.filter(function(e3, t3) {
388
+ return !t3.dir && n2.test(e3);
389
+ });
390
+ }
391
+ var i2 = this.files[this.root + e2];
392
+ return i2 && !i2.dir ? i2 : null;
393
+ }, folder: function(r2) {
394
+ if (!r2) return this;
395
+ if (h(r2)) return this.filter(function(e3, t3) {
396
+ return t3.dir && r2.test(e3);
397
+ });
398
+ var e2 = this.root + r2, t2 = b.call(this, e2), n2 = this.clone();
399
+ return n2.root = t2.name, n2;
400
+ }, remove: function(r2) {
401
+ r2 = this.root + r2;
402
+ var e2 = this.files[r2];
403
+ if (e2 || ("/" !== r2.slice(-1) && (r2 += "/"), e2 = this.files[r2]), e2 && !e2.dir) delete this.files[r2];
404
+ else for (var t2 = this.filter(function(e3, t3) {
405
+ return t3.name.slice(0, r2.length) === r2;
406
+ }), n2 = 0; n2 < t2.length; n2++) delete this.files[t2[n2].name];
407
+ return this;
408
+ }, generate: function() {
409
+ throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
410
+ }, generateInternalStream: function(e2) {
411
+ var t2, r2 = {};
412
+ try {
413
+ 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.");
414
+ 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");
415
+ var n2 = r2.comment || this.comment || "";
416
+ t2 = o.generateWorker(this, r2, n2);
417
+ } catch (e3) {
418
+ (t2 = new l("error")).error(e3);
419
+ }
420
+ return new a(t2, r2.type || "string", r2.mimeType);
421
+ }, generateAsync: function(e2, t2) {
422
+ return this.generateInternalStream(e2).accumulate(t2);
423
+ }, generateNodeStream: function(e2, t2) {
424
+ return (e2 = e2 || {}).type || (e2.type = "nodebuffer"), this.generateInternalStream(e2).toNodejsStream(t2);
425
+ } };
426
+ t.exports = n;
427
+ }, { "./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) {
428
+ "use strict";
429
+ t.exports = e("stream");
430
+ }, { stream: void 0 }], 17: [function(e, t, r) {
431
+ "use strict";
432
+ var n = e("./DataReader");
433
+ function i(e2) {
434
+ n.call(this, e2);
435
+ for (var t2 = 0; t2 < this.data.length; t2++) e2[t2] = 255 & e2[t2];
436
+ }
437
+ e("../utils").inherits(i, n), i.prototype.byteAt = function(e2) {
438
+ return this.data[this.zero + e2];
439
+ }, i.prototype.lastIndexOfSignature = function(e2) {
440
+ 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;
441
+ return -1;
442
+ }, i.prototype.readAndCheckSignature = function(e2) {
443
+ var t2 = e2.charCodeAt(0), r2 = e2.charCodeAt(1), n2 = e2.charCodeAt(2), i2 = e2.charCodeAt(3), s = this.readData(4);
444
+ return t2 === s[0] && r2 === s[1] && n2 === s[2] && i2 === s[3];
445
+ }, i.prototype.readData = function(e2) {
446
+ if (this.checkOffset(e2), 0 === e2) return [];
447
+ var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2);
448
+ return this.index += e2, t2;
449
+ }, t.exports = i;
450
+ }, { "../utils": 32, "./DataReader": 18 }], 18: [function(e, t, r) {
451
+ "use strict";
452
+ var n = e("../utils");
453
+ function i(e2) {
454
+ this.data = e2, this.length = e2.length, this.index = 0, this.zero = 0;
455
+ }
456
+ i.prototype = { checkOffset: function(e2) {
457
+ this.checkIndex(this.index + e2);
458
+ }, checkIndex: function(e2) {
459
+ if (this.length < this.zero + e2 || e2 < 0) throw new Error("End of data reached (data length = " + this.length + ", asked index = " + e2 + "). Corrupted zip ?");
460
+ }, setIndex: function(e2) {
461
+ this.checkIndex(e2), this.index = e2;
462
+ }, skip: function(e2) {
463
+ this.setIndex(this.index + e2);
464
+ }, byteAt: function() {
465
+ }, readInt: function(e2) {
466
+ var t2, r2 = 0;
467
+ for (this.checkOffset(e2), t2 = this.index + e2 - 1; t2 >= this.index; t2--) r2 = (r2 << 8) + this.byteAt(t2);
468
+ return this.index += e2, r2;
469
+ }, readString: function(e2) {
470
+ return n.transformTo("string", this.readData(e2));
471
+ }, readData: function() {
472
+ }, lastIndexOfSignature: function() {
473
+ }, readAndCheckSignature: function() {
474
+ }, readDate: function() {
475
+ var e2 = this.readInt(4);
476
+ 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));
477
+ } }, t.exports = i;
478
+ }, { "../utils": 32 }], 19: [function(e, t, r) {
479
+ "use strict";
480
+ var n = e("./Uint8ArrayReader");
481
+ function i(e2) {
482
+ n.call(this, e2);
483
+ }
484
+ e("../utils").inherits(i, n), i.prototype.readData = function(e2) {
485
+ this.checkOffset(e2);
486
+ var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2);
487
+ return this.index += e2, t2;
488
+ }, t.exports = i;
489
+ }, { "../utils": 32, "./Uint8ArrayReader": 21 }], 20: [function(e, t, r) {
490
+ "use strict";
491
+ var n = e("./DataReader");
492
+ function i(e2) {
493
+ n.call(this, e2);
494
+ }
495
+ e("../utils").inherits(i, n), i.prototype.byteAt = function(e2) {
496
+ return this.data.charCodeAt(this.zero + e2);
497
+ }, i.prototype.lastIndexOfSignature = function(e2) {
498
+ return this.data.lastIndexOf(e2) - this.zero;
499
+ }, i.prototype.readAndCheckSignature = function(e2) {
500
+ return e2 === this.readData(4);
501
+ }, i.prototype.readData = function(e2) {
502
+ this.checkOffset(e2);
503
+ var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2);
504
+ return this.index += e2, t2;
505
+ }, t.exports = i;
506
+ }, { "../utils": 32, "./DataReader": 18 }], 21: [function(e, t, r) {
507
+ "use strict";
508
+ var n = e("./ArrayReader");
509
+ function i(e2) {
510
+ n.call(this, e2);
511
+ }
512
+ e("../utils").inherits(i, n), i.prototype.readData = function(e2) {
513
+ if (this.checkOffset(e2), 0 === e2) return new Uint8Array(0);
514
+ var t2 = this.data.subarray(this.zero + this.index, this.zero + this.index + e2);
515
+ return this.index += e2, t2;
516
+ }, t.exports = i;
517
+ }, { "../utils": 32, "./ArrayReader": 17 }], 22: [function(e, t, r) {
518
+ "use strict";
519
+ var n = e("../utils"), i = e("../support"), s = e("./ArrayReader"), a = e("./StringReader"), o = e("./NodeBufferReader"), h = e("./Uint8ArrayReader");
520
+ t.exports = function(e2) {
521
+ var t2 = n.getTypeOf(e2);
522
+ 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);
523
+ };
524
+ }, { "../support": 30, "../utils": 32, "./ArrayReader": 17, "./NodeBufferReader": 19, "./StringReader": 20, "./Uint8ArrayReader": 21 }], 23: [function(e, t, r) {
525
+ "use strict";
526
+ 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";
527
+ }, {}], 24: [function(e, t, r) {
528
+ "use strict";
529
+ var n = e("./GenericWorker"), i = e("../utils");
530
+ function s(e2) {
531
+ n.call(this, "ConvertWorker to " + e2), this.destType = e2;
532
+ }
533
+ i.inherits(s, n), s.prototype.processChunk = function(e2) {
534
+ this.push({ data: i.transformTo(this.destType, e2.data), meta: e2.meta });
535
+ }, t.exports = s;
536
+ }, { "../utils": 32, "./GenericWorker": 28 }], 25: [function(e, t, r) {
537
+ "use strict";
538
+ var n = e("./GenericWorker"), i = e("../crc32");
539
+ function s() {
540
+ n.call(this, "Crc32Probe"), this.withStreamInfo("crc32", 0);
541
+ }
542
+ e("../utils").inherits(s, n), s.prototype.processChunk = function(e2) {
543
+ this.streamInfo.crc32 = i(e2.data, this.streamInfo.crc32 || 0), this.push(e2);
544
+ }, t.exports = s;
545
+ }, { "../crc32": 4, "../utils": 32, "./GenericWorker": 28 }], 26: [function(e, t, r) {
546
+ "use strict";
547
+ var n = e("../utils"), i = e("./GenericWorker");
548
+ function s(e2) {
549
+ i.call(this, "DataLengthProbe for " + e2), this.propName = e2, this.withStreamInfo(e2, 0);
550
+ }
551
+ n.inherits(s, i), s.prototype.processChunk = function(e2) {
552
+ if (e2) {
553
+ var t2 = this.streamInfo[this.propName] || 0;
554
+ this.streamInfo[this.propName] = t2 + e2.data.length;
555
+ }
556
+ i.prototype.processChunk.call(this, e2);
557
+ }, t.exports = s;
558
+ }, { "../utils": 32, "./GenericWorker": 28 }], 27: [function(e, t, r) {
559
+ "use strict";
560
+ var n = e("../utils"), i = e("./GenericWorker");
561
+ function s(e2) {
562
+ i.call(this, "DataWorker");
563
+ var t2 = this;
564
+ this.dataIsReady = false, this.index = 0, this.max = 0, this.data = null, this.type = "", this._tickScheduled = false, e2.then(function(e3) {
565
+ t2.dataIsReady = true, t2.data = e3, t2.max = e3 && e3.length || 0, t2.type = n.getTypeOf(e3), t2.isPaused || t2._tickAndRepeat();
566
+ }, function(e3) {
567
+ t2.error(e3);
568
+ });
569
+ }
570
+ n.inherits(s, i), s.prototype.cleanUp = function() {
571
+ i.prototype.cleanUp.call(this), this.data = null;
572
+ }, s.prototype.resume = function() {
573
+ return !!i.prototype.resume.call(this) && (!this._tickScheduled && this.dataIsReady && (this._tickScheduled = true, n.delay(this._tickAndRepeat, [], this)), true);
574
+ }, s.prototype._tickAndRepeat = function() {
575
+ this._tickScheduled = false, this.isPaused || this.isFinished || (this._tick(), this.isFinished || (n.delay(this._tickAndRepeat, [], this), this._tickScheduled = true));
576
+ }, s.prototype._tick = function() {
577
+ if (this.isPaused || this.isFinished) return false;
578
+ var e2 = null, t2 = Math.min(this.max, this.index + 16384);
579
+ if (this.index >= this.max) return this.end();
580
+ switch (this.type) {
581
+ case "string":
582
+ e2 = this.data.substring(this.index, t2);
583
+ break;
584
+ case "uint8array":
585
+ e2 = this.data.subarray(this.index, t2);
586
+ break;
587
+ case "array":
588
+ case "nodebuffer":
589
+ e2 = this.data.slice(this.index, t2);
590
+ }
591
+ return this.index = t2, this.push({ data: e2, meta: { percent: this.max ? this.index / this.max * 100 : 0 } });
592
+ }, t.exports = s;
593
+ }, { "../utils": 32, "./GenericWorker": 28 }], 28: [function(e, t, r) {
594
+ "use strict";
595
+ function n(e2) {
596
+ 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;
597
+ }
598
+ n.prototype = { push: function(e2) {
599
+ this.emit("data", e2);
600
+ }, end: function() {
601
+ if (this.isFinished) return false;
602
+ this.flush();
603
+ try {
604
+ this.emit("end"), this.cleanUp(), this.isFinished = true;
605
+ } catch (e2) {
606
+ this.emit("error", e2);
607
+ }
608
+ return true;
609
+ }, error: function(e2) {
610
+ return !this.isFinished && (this.isPaused ? this.generatedError = e2 : (this.isFinished = true, this.emit("error", e2), this.previous && this.previous.error(e2), this.cleanUp()), true);
611
+ }, on: function(e2, t2) {
612
+ return this._listeners[e2].push(t2), this;
613
+ }, cleanUp: function() {
614
+ this.streamInfo = this.generatedError = this.extraStreamInfo = null, this._listeners = [];
615
+ }, emit: function(e2, t2) {
616
+ if (this._listeners[e2]) for (var r2 = 0; r2 < this._listeners[e2].length; r2++) this._listeners[e2][r2].call(this, t2);
617
+ }, pipe: function(e2) {
618
+ return e2.registerPrevious(this);
619
+ }, registerPrevious: function(e2) {
620
+ if (this.isLocked) throw new Error("The stream '" + this + "' has already been used.");
621
+ this.streamInfo = e2.streamInfo, this.mergeStreamInfo(), this.previous = e2;
622
+ var t2 = this;
623
+ return e2.on("data", function(e3) {
624
+ t2.processChunk(e3);
625
+ }), e2.on("end", function() {
626
+ t2.end();
627
+ }), e2.on("error", function(e3) {
628
+ t2.error(e3);
629
+ }), this;
630
+ }, pause: function() {
631
+ return !this.isPaused && !this.isFinished && (this.isPaused = true, this.previous && this.previous.pause(), true);
632
+ }, resume: function() {
633
+ if (!this.isPaused || this.isFinished) return false;
634
+ var e2 = this.isPaused = false;
635
+ return this.generatedError && (this.error(this.generatedError), e2 = true), this.previous && this.previous.resume(), !e2;
636
+ }, flush: function() {
637
+ }, processChunk: function(e2) {
638
+ this.push(e2);
639
+ }, withStreamInfo: function(e2, t2) {
640
+ return this.extraStreamInfo[e2] = t2, this.mergeStreamInfo(), this;
641
+ }, mergeStreamInfo: function() {
642
+ for (var e2 in this.extraStreamInfo) Object.prototype.hasOwnProperty.call(this.extraStreamInfo, e2) && (this.streamInfo[e2] = this.extraStreamInfo[e2]);
643
+ }, lock: function() {
644
+ if (this.isLocked) throw new Error("The stream '" + this + "' has already been used.");
645
+ this.isLocked = true, this.previous && this.previous.lock();
646
+ }, toString: function() {
647
+ var e2 = "Worker " + this.name;
648
+ return this.previous ? this.previous + " -> " + e2 : e2;
649
+ } }, t.exports = n;
650
+ }, {}], 29: [function(e, t, r) {
651
+ "use strict";
652
+ var h = e("../utils"), i = e("./ConvertWorker"), s = e("./GenericWorker"), u = e("../base64"), n = e("../support"), a = e("../external"), o = null;
653
+ if (n.nodestream) try {
654
+ o = e("../nodejs/NodejsStreamOutputAdapter");
655
+ } catch (e2) {
656
+ }
657
+ function l(e2, o2) {
658
+ return new a.Promise(function(t2, r2) {
659
+ var n2 = [], i2 = e2._internalType, s2 = e2._outputType, a2 = e2._mimeType;
660
+ e2.on("data", function(e3, t3) {
661
+ n2.push(e3), o2 && o2(t3);
662
+ }).on("error", function(e3) {
663
+ n2 = [], r2(e3);
664
+ }).on("end", function() {
665
+ try {
666
+ var e3 = (function(e4, t3, r3) {
667
+ switch (e4) {
668
+ case "blob":
669
+ return h.newBlob(h.transformTo("arraybuffer", t3), r3);
670
+ case "base64":
671
+ return u.encode(t3);
672
+ default:
673
+ return h.transformTo(e4, t3);
674
+ }
675
+ })(s2, (function(e4, t3) {
676
+ var r3, n3 = 0, i3 = null, s3 = 0;
677
+ for (r3 = 0; r3 < t3.length; r3++) s3 += t3[r3].length;
678
+ switch (e4) {
679
+ case "string":
680
+ return t3.join("");
681
+ case "array":
682
+ return Array.prototype.concat.apply([], t3);
683
+ case "uint8array":
684
+ for (i3 = new Uint8Array(s3), r3 = 0; r3 < t3.length; r3++) i3.set(t3[r3], n3), n3 += t3[r3].length;
685
+ return i3;
686
+ case "nodebuffer":
687
+ return Buffer.concat(t3);
688
+ default:
689
+ throw new Error("concat : unsupported type '" + e4 + "'");
690
+ }
691
+ })(i2, n2), a2);
692
+ t2(e3);
693
+ } catch (e4) {
694
+ r2(e4);
695
+ }
696
+ n2 = [];
697
+ }).resume();
698
+ });
699
+ }
700
+ function f(e2, t2, r2) {
701
+ var n2 = t2;
702
+ switch (t2) {
703
+ case "blob":
704
+ case "arraybuffer":
705
+ n2 = "uint8array";
706
+ break;
707
+ case "base64":
708
+ n2 = "string";
709
+ }
710
+ try {
711
+ this._internalType = n2, this._outputType = t2, this._mimeType = r2, h.checkSupport(n2), this._worker = e2.pipe(new i(n2)), e2.lock();
712
+ } catch (e3) {
713
+ this._worker = new s("error"), this._worker.error(e3);
714
+ }
715
+ }
716
+ f.prototype = { accumulate: function(e2) {
717
+ return l(this, e2);
718
+ }, on: function(e2, t2) {
719
+ var r2 = this;
720
+ return "data" === e2 ? this._worker.on(e2, function(e3) {
721
+ t2.call(r2, e3.data, e3.meta);
722
+ }) : this._worker.on(e2, function() {
723
+ h.delay(t2, arguments, r2);
724
+ }), this;
725
+ }, resume: function() {
726
+ return h.delay(this._worker.resume, [], this._worker), this;
727
+ }, pause: function() {
728
+ return this._worker.pause(), this;
729
+ }, toNodejsStream: function(e2) {
730
+ if (h.checkSupport("nodestream"), "nodebuffer" !== this._outputType) throw new Error(this._outputType + " is not supported by this method");
731
+ return new o(this, { objectMode: "nodebuffer" !== this._outputType }, e2);
732
+ } }, t.exports = f;
733
+ }, { "../base64": 1, "../external": 6, "../nodejs/NodejsStreamOutputAdapter": 13, "../support": 30, "../utils": 32, "./ConvertWorker": 24, "./GenericWorker": 28 }], 30: [function(e, t, r) {
734
+ "use strict";
735
+ 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;
736
+ else {
737
+ var n = new ArrayBuffer(0);
738
+ try {
739
+ r.blob = 0 === new Blob([n], { type: "application/zip" }).size;
740
+ } catch (e2) {
741
+ try {
742
+ var i = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
743
+ i.append(n), r.blob = 0 === i.getBlob("application/zip").size;
744
+ } catch (e3) {
745
+ r.blob = false;
746
+ }
747
+ }
748
+ }
749
+ try {
750
+ r.nodestream = !!e("readable-stream").Readable;
751
+ } catch (e2) {
752
+ r.nodestream = false;
753
+ }
754
+ }, { "readable-stream": 16 }], 31: [function(e, t, s) {
755
+ "use strict";
756
+ 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;
757
+ u[254] = u[254] = 1;
758
+ function a() {
759
+ n.call(this, "utf-8 decode"), this.leftOver = null;
760
+ }
761
+ function l() {
762
+ n.call(this, "utf-8 encode");
763
+ }
764
+ s.utf8encode = function(e2) {
765
+ return h.nodebuffer ? r.newBufferFrom(e2, "utf-8") : (function(e3) {
766
+ var t2, r2, n2, i2, s2, a2 = e3.length, o2 = 0;
767
+ 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;
768
+ 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);
769
+ return t2;
770
+ })(e2);
771
+ }, s.utf8decode = function(e2) {
772
+ return h.nodebuffer ? o.transformTo("nodebuffer", e2).toString("utf-8") : (function(e3) {
773
+ var t2, r2, n2, i2, s2 = e3.length, a2 = new Array(2 * s2);
774
+ for (t2 = r2 = 0; t2 < s2; ) if ((n2 = e3[t2++]) < 128) a2[r2++] = n2;
775
+ else if (4 < (i2 = u[n2])) a2[r2++] = 65533, t2 += i2 - 1;
776
+ else {
777
+ for (n2 &= 2 === i2 ? 31 : 3 === i2 ? 15 : 7; 1 < i2 && t2 < s2; ) n2 = n2 << 6 | 63 & e3[t2++], i2--;
778
+ 1 < i2 ? a2[r2++] = 65533 : n2 < 65536 ? a2[r2++] = n2 : (n2 -= 65536, a2[r2++] = 55296 | n2 >> 10 & 1023, a2[r2++] = 56320 | 1023 & n2);
779
+ }
780
+ return a2.length !== r2 && (a2.subarray ? a2 = a2.subarray(0, r2) : a2.length = r2), o.applyFromCharCode(a2);
781
+ })(e2 = o.transformTo(h.uint8array ? "uint8array" : "array", e2));
782
+ }, o.inherits(a, n), a.prototype.processChunk = function(e2) {
783
+ var t2 = o.transformTo(h.uint8array ? "uint8array" : "array", e2.data);
784
+ if (this.leftOver && this.leftOver.length) {
785
+ if (h.uint8array) {
786
+ var r2 = t2;
787
+ (t2 = new Uint8Array(r2.length + this.leftOver.length)).set(this.leftOver, 0), t2.set(r2, this.leftOver.length);
788
+ } else t2 = this.leftOver.concat(t2);
789
+ this.leftOver = null;
790
+ }
791
+ var n2 = (function(e3, t3) {
792
+ var r3;
793
+ for ((t3 = t3 || e3.length) > e3.length && (t3 = e3.length), r3 = t3 - 1; 0 <= r3 && 128 == (192 & e3[r3]); ) r3--;
794
+ return r3 < 0 ? t3 : 0 === r3 ? t3 : r3 + u[e3[r3]] > t3 ? r3 : t3;
795
+ })(t2), i2 = t2;
796
+ 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 });
797
+ }, a.prototype.flush = function() {
798
+ this.leftOver && this.leftOver.length && (this.push({ data: s.utf8decode(this.leftOver), meta: {} }), this.leftOver = null);
799
+ }, s.Utf8DecodeWorker = a, o.inherits(l, n), l.prototype.processChunk = function(e2) {
800
+ this.push({ data: s.utf8encode(e2.data), meta: e2.meta });
801
+ }, s.Utf8EncodeWorker = l;
802
+ }, { "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./support": 30, "./utils": 32 }], 32: [function(e, t, a) {
803
+ "use strict";
804
+ var o = e("./support"), h = e("./base64"), r = e("./nodejsUtils"), u = e("./external");
805
+ function n(e2) {
806
+ return e2;
807
+ }
808
+ function l(e2, t2) {
809
+ for (var r2 = 0; r2 < e2.length; ++r2) t2[r2] = 255 & e2.charCodeAt(r2);
810
+ return t2;
811
+ }
812
+ e("setimmediate"), a.newBlob = function(t2, r2) {
813
+ a.checkSupport("blob");
814
+ try {
815
+ return new Blob([t2], { type: r2 });
816
+ } catch (e2) {
817
+ try {
818
+ var n2 = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
819
+ return n2.append(t2), n2.getBlob(r2);
820
+ } catch (e3) {
821
+ throw new Error("Bug : can't construct the Blob.");
822
+ }
823
+ }
824
+ };
825
+ var i = { stringifyByChunk: function(e2, t2, r2) {
826
+ var n2 = [], i2 = 0, s2 = e2.length;
827
+ if (s2 <= r2) return String.fromCharCode.apply(null, e2);
828
+ 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;
829
+ return n2.join("");
830
+ }, stringifyByChar: function(e2) {
831
+ for (var t2 = "", r2 = 0; r2 < e2.length; r2++) t2 += String.fromCharCode(e2[r2]);
832
+ return t2;
833
+ }, applyCanBeUsed: { uint8array: (function() {
834
+ try {
835
+ return o.uint8array && 1 === String.fromCharCode.apply(null, new Uint8Array(1)).length;
836
+ } catch (e2) {
837
+ return false;
838
+ }
839
+ })(), nodebuffer: (function() {
840
+ try {
841
+ return o.nodebuffer && 1 === String.fromCharCode.apply(null, r.allocBuffer(1)).length;
842
+ } catch (e2) {
843
+ return false;
844
+ }
845
+ })() } };
846
+ function s(e2) {
847
+ var t2 = 65536, r2 = a.getTypeOf(e2), n2 = true;
848
+ if ("uint8array" === r2 ? n2 = i.applyCanBeUsed.uint8array : "nodebuffer" === r2 && (n2 = i.applyCanBeUsed.nodebuffer), n2) for (; 1 < t2; ) try {
849
+ return i.stringifyByChunk(e2, r2, t2);
850
+ } catch (e3) {
851
+ t2 = Math.floor(t2 / 2);
852
+ }
853
+ return i.stringifyByChar(e2);
854
+ }
855
+ function f(e2, t2) {
856
+ for (var r2 = 0; r2 < e2.length; r2++) t2[r2] = e2[r2];
857
+ return t2;
858
+ }
859
+ a.applyFromCharCode = s;
860
+ var c = {};
861
+ c.string = { string: n, array: function(e2) {
862
+ return l(e2, new Array(e2.length));
863
+ }, arraybuffer: function(e2) {
864
+ return c.string.uint8array(e2).buffer;
865
+ }, uint8array: function(e2) {
866
+ return l(e2, new Uint8Array(e2.length));
867
+ }, nodebuffer: function(e2) {
868
+ return l(e2, r.allocBuffer(e2.length));
869
+ } }, c.array = { string: s, array: n, arraybuffer: function(e2) {
870
+ return new Uint8Array(e2).buffer;
871
+ }, uint8array: function(e2) {
872
+ return new Uint8Array(e2);
873
+ }, nodebuffer: function(e2) {
874
+ return r.newBufferFrom(e2);
875
+ } }, c.arraybuffer = { string: function(e2) {
876
+ return s(new Uint8Array(e2));
877
+ }, array: function(e2) {
878
+ return f(new Uint8Array(e2), new Array(e2.byteLength));
879
+ }, arraybuffer: n, uint8array: function(e2) {
880
+ return new Uint8Array(e2);
881
+ }, nodebuffer: function(e2) {
882
+ return r.newBufferFrom(new Uint8Array(e2));
883
+ } }, c.uint8array = { string: s, array: function(e2) {
884
+ return f(e2, new Array(e2.length));
885
+ }, arraybuffer: function(e2) {
886
+ return e2.buffer;
887
+ }, uint8array: n, nodebuffer: function(e2) {
888
+ return r.newBufferFrom(e2);
889
+ } }, c.nodebuffer = { string: s, array: function(e2) {
890
+ return f(e2, new Array(e2.length));
891
+ }, arraybuffer: function(e2) {
892
+ return c.nodebuffer.uint8array(e2).buffer;
893
+ }, uint8array: function(e2) {
894
+ return f(e2, new Uint8Array(e2.length));
895
+ }, nodebuffer: n }, a.transformTo = function(e2, t2) {
896
+ if (t2 = t2 || "", !e2) return t2;
897
+ a.checkSupport(e2);
898
+ var r2 = a.getTypeOf(t2);
899
+ return c[r2][e2](t2);
900
+ }, a.resolve = function(e2) {
901
+ for (var t2 = e2.split("/"), r2 = [], n2 = 0; n2 < t2.length; n2++) {
902
+ var i2 = t2[n2];
903
+ "." === i2 || "" === i2 && 0 !== n2 && n2 !== t2.length - 1 || (".." === i2 ? r2.pop() : r2.push(i2));
904
+ }
905
+ return r2.join("/");
906
+ }, a.getTypeOf = function(e2) {
907
+ 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;
908
+ }, a.checkSupport = function(e2) {
909
+ if (!o[e2.toLowerCase()]) throw new Error(e2 + " is not supported by this platform");
910
+ }, a.MAX_VALUE_16BITS = 65535, a.MAX_VALUE_32BITS = -1, a.pretty = function(e2) {
911
+ var t2, r2, n2 = "";
912
+ for (r2 = 0; r2 < (e2 || "").length; r2++) n2 += "\\x" + ((t2 = e2.charCodeAt(r2)) < 16 ? "0" : "") + t2.toString(16).toUpperCase();
913
+ return n2;
914
+ }, a.delay = function(e2, t2, r2) {
915
+ setImmediate(function() {
916
+ e2.apply(r2 || null, t2 || []);
917
+ });
918
+ }, a.inherits = function(e2, t2) {
919
+ function r2() {
920
+ }
921
+ r2.prototype = t2.prototype, e2.prototype = new r2();
922
+ }, a.extend = function() {
923
+ var e2, t2, r2 = {};
924
+ 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]);
925
+ return r2;
926
+ }, a.prepareContent = function(r2, e2, n2, i2, s2) {
927
+ return u.Promise.resolve(e2).then(function(n3) {
928
+ 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) {
929
+ var e3 = new FileReader();
930
+ e3.onload = function(e4) {
931
+ t2(e4.target.result);
932
+ }, e3.onerror = function(e4) {
933
+ r3(e4.target.error);
934
+ }, e3.readAsArrayBuffer(n3);
935
+ }) : n3;
936
+ }).then(function(e3) {
937
+ var t2 = a.getTypeOf(e3);
938
+ return t2 ? ("arraybuffer" === t2 ? e3 = a.transformTo("uint8array", e3) : "string" === t2 && (s2 ? e3 = h.decode(e3) : n2 && true !== i2 && (e3 = (function(e4) {
939
+ return l(e4, o.uint8array ? new Uint8Array(e4.length) : new Array(e4.length));
940
+ })(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) ?"));
941
+ });
942
+ };
943
+ }, { "./base64": 1, "./external": 6, "./nodejsUtils": 14, "./support": 30, setimmediate: 54 }], 33: [function(e, t, r) {
944
+ "use strict";
945
+ var n = e("./reader/readerFor"), i = e("./utils"), s = e("./signature"), a = e("./zipEntry"), o = e("./support");
946
+ function h(e2) {
947
+ this.files = [], this.loadOptions = e2;
948
+ }
949
+ h.prototype = { checkSignature: function(e2) {
950
+ if (!this.reader.readAndCheckSignature(e2)) {
951
+ this.reader.index -= 4;
952
+ var t2 = this.reader.readString(4);
953
+ throw new Error("Corrupted zip or bug: unexpected signature (" + i.pretty(t2) + ", expected " + i.pretty(e2) + ")");
954
+ }
955
+ }, isSignature: function(e2, t2) {
956
+ var r2 = this.reader.index;
957
+ this.reader.setIndex(e2);
958
+ var n2 = this.reader.readString(4) === t2;
959
+ return this.reader.setIndex(r2), n2;
960
+ }, readBlockEndOfCentral: function() {
961
+ 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);
962
+ var e2 = this.reader.readData(this.zipCommentLength), t2 = o.uint8array ? "uint8array" : "array", r2 = i.transformTo(t2, e2);
963
+ this.zipComment = this.loadOptions.decodeFileName(r2);
964
+ }, readBlockZip64EndOfCentral: function() {
965
+ 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 = {};
966
+ 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 };
967
+ }, readBlockZip64EndOfCentralLocator: function() {
968
+ 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");
969
+ }, readLocalFiles: function() {
970
+ var e2, t2;
971
+ 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();
972
+ }, readCentralDir: function() {
973
+ var e2;
974
+ 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);
975
+ 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);
976
+ }, readEndOfCentral: function() {
977
+ var e2 = this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);
978
+ 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");
979
+ this.reader.setIndex(e2);
980
+ var t2 = e2;
981
+ 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) {
982
+ 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");
983
+ 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");
984
+ this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir), this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END), this.readBlockZip64EndOfCentral();
985
+ }
986
+ var r2 = this.centralDirOffset + this.centralDirSize;
987
+ this.zip64 && (r2 += 20, r2 += 12 + this.zip64EndOfCentralSize);
988
+ var n2 = t2 - r2;
989
+ if (0 < n2) this.isSignature(t2, s.CENTRAL_FILE_HEADER) || (this.reader.zero = n2);
990
+ else if (n2 < 0) throw new Error("Corrupted zip: missing " + Math.abs(n2) + " bytes.");
991
+ }, prepareReader: function(e2) {
992
+ this.reader = n(e2);
993
+ }, load: function(e2) {
994
+ this.prepareReader(e2), this.readEndOfCentral(), this.readCentralDir(), this.readLocalFiles();
995
+ } }, t.exports = h;
996
+ }, { "./reader/readerFor": 22, "./signature": 23, "./support": 30, "./utils": 32, "./zipEntry": 34 }], 34: [function(e, t, r) {
997
+ "use strict";
998
+ var n = e("./reader/readerFor"), s = e("./utils"), i = e("./compressedObject"), a = e("./crc32"), o = e("./utf8"), h = e("./compressions"), u = e("./support");
999
+ function l(e2, t2) {
1000
+ this.options = e2, this.loadOptions = t2;
1001
+ }
1002
+ l.prototype = { isEncrypted: function() {
1003
+ return 1 == (1 & this.bitFlag);
1004
+ }, useUTF8: function() {
1005
+ return 2048 == (2048 & this.bitFlag);
1006
+ }, readLocalPart: function(e2) {
1007
+ var t2, r2;
1008
+ 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)");
1009
+ if (null === (t2 = (function(e3) {
1010
+ for (var t3 in h) if (Object.prototype.hasOwnProperty.call(h, t3) && h[t3].magic === e3) return h[t3];
1011
+ return null;
1012
+ })(this.compressionMethod))) throw new Error("Corrupted zip : compression " + s.pretty(this.compressionMethod) + " unknown (inner file : " + s.transformTo("string", this.fileName) + ")");
1013
+ this.decompressed = new i(this.compressedSize, this.uncompressedSize, this.crc32, t2, e2.readData(this.compressedSize));
1014
+ }, readCentralPart: function(e2) {
1015
+ 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);
1016
+ var t2 = e2.readInt(2);
1017
+ 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");
1018
+ e2.skip(t2), this.readExtraFields(e2), this.parseZIP64ExtraField(e2), this.fileComment = e2.readData(this.fileCommentLength);
1019
+ }, processAttributes: function() {
1020
+ this.unixPermissions = null, this.dosPermissions = null;
1021
+ var e2 = this.versionMadeBy >> 8;
1022
+ 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);
1023
+ }, parseZIP64ExtraField: function() {
1024
+ if (this.extraFields[1]) {
1025
+ var e2 = n(this.extraFields[1].value);
1026
+ 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));
1027
+ }
1028
+ }, readExtraFields: function(e2) {
1029
+ var t2, r2, n2, i2 = e2.index + this.extraFieldsLength;
1030
+ 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 };
1031
+ e2.setIndex(i2);
1032
+ }, handleUTF8: function() {
1033
+ var e2 = u.uint8array ? "uint8array" : "array";
1034
+ if (this.useUTF8()) this.fileNameStr = o.utf8decode(this.fileName), this.fileCommentStr = o.utf8decode(this.fileComment);
1035
+ else {
1036
+ var t2 = this.findExtraFieldUnicodePath();
1037
+ if (null !== t2) this.fileNameStr = t2;
1038
+ else {
1039
+ var r2 = s.transformTo(e2, this.fileName);
1040
+ this.fileNameStr = this.loadOptions.decodeFileName(r2);
1041
+ }
1042
+ var n2 = this.findExtraFieldUnicodeComment();
1043
+ if (null !== n2) this.fileCommentStr = n2;
1044
+ else {
1045
+ var i2 = s.transformTo(e2, this.fileComment);
1046
+ this.fileCommentStr = this.loadOptions.decodeFileName(i2);
1047
+ }
1048
+ }
1049
+ }, findExtraFieldUnicodePath: function() {
1050
+ var e2 = this.extraFields[28789];
1051
+ if (e2) {
1052
+ var t2 = n(e2.value);
1053
+ return 1 !== t2.readInt(1) ? null : a(this.fileName) !== t2.readInt(4) ? null : o.utf8decode(t2.readData(e2.length - 5));
1054
+ }
1055
+ return null;
1056
+ }, findExtraFieldUnicodeComment: function() {
1057
+ var e2 = this.extraFields[25461];
1058
+ if (e2) {
1059
+ var t2 = n(e2.value);
1060
+ return 1 !== t2.readInt(1) ? null : a(this.fileComment) !== t2.readInt(4) ? null : o.utf8decode(t2.readData(e2.length - 5));
1061
+ }
1062
+ return null;
1063
+ } }, t.exports = l;
1064
+ }, { "./compressedObject": 2, "./compressions": 3, "./crc32": 4, "./reader/readerFor": 22, "./support": 30, "./utf8": 31, "./utils": 32 }], 35: [function(e, t, r) {
1065
+ "use strict";
1066
+ function n(e2, t2, r2) {
1067
+ 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 };
1068
+ }
1069
+ var s = e("./stream/StreamHelper"), i = e("./stream/DataWorker"), a = e("./utf8"), o = e("./compressedObject"), h = e("./stream/GenericWorker");
1070
+ n.prototype = { internalStream: function(e2) {
1071
+ var t2 = null, r2 = "string";
1072
+ try {
1073
+ if (!e2) throw new Error("No output type specified.");
1074
+ var n2 = "string" === (r2 = e2.toLowerCase()) || "text" === r2;
1075
+ "binarystring" !== r2 && "text" !== r2 || (r2 = "string"), t2 = this._decompressWorker();
1076
+ var i2 = !this._dataBinary;
1077
+ i2 && !n2 && (t2 = t2.pipe(new a.Utf8EncodeWorker())), !i2 && n2 && (t2 = t2.pipe(new a.Utf8DecodeWorker()));
1078
+ } catch (e3) {
1079
+ (t2 = new h("error")).error(e3);
1080
+ }
1081
+ return new s(t2, r2, "");
1082
+ }, async: function(e2, t2) {
1083
+ return this.internalStream(e2).accumulate(t2);
1084
+ }, nodeStream: function(e2, t2) {
1085
+ return this.internalStream(e2 || "nodebuffer").toNodejsStream(t2);
1086
+ }, _compressWorker: function(e2, t2) {
1087
+ if (this._data instanceof o && this._data.compression.magic === e2.magic) return this._data.getCompressedWorker();
1088
+ var r2 = this._decompressWorker();
1089
+ return this._dataBinary || (r2 = r2.pipe(new a.Utf8EncodeWorker())), o.createWorkerFrom(r2, e2, t2);
1090
+ }, _decompressWorker: function() {
1091
+ return this._data instanceof o ? this._data.getContentWorker() : this._data instanceof h ? this._data : new i(this._data);
1092
+ } };
1093
+ for (var u = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"], l = function() {
1094
+ throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
1095
+ }, f = 0; f < u.length; f++) n.prototype[u[f]] = l;
1096
+ t.exports = n;
1097
+ }, { "./compressedObject": 2, "./stream/DataWorker": 27, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31 }], 36: [function(e, l, t) {
1098
+ (function(t2) {
1099
+ "use strict";
1100
+ var r, n, e2 = t2.MutationObserver || t2.WebKitMutationObserver;
1101
+ if (e2) {
1102
+ var i = 0, s = new e2(u), a = t2.document.createTextNode("");
1103
+ s.observe(a, { characterData: true }), r = function() {
1104
+ a.data = i = ++i % 2;
1105
+ };
1106
+ } else if (t2.setImmediate || void 0 === t2.MessageChannel) r = "document" in t2 && "onreadystatechange" in t2.document.createElement("script") ? function() {
1107
+ var e3 = t2.document.createElement("script");
1108
+ e3.onreadystatechange = function() {
1109
+ u(), e3.onreadystatechange = null, e3.parentNode.removeChild(e3), e3 = null;
1110
+ }, t2.document.documentElement.appendChild(e3);
1111
+ } : function() {
1112
+ setTimeout(u, 0);
1113
+ };
1114
+ else {
1115
+ var o = new t2.MessageChannel();
1116
+ o.port1.onmessage = u, r = function() {
1117
+ o.port2.postMessage(0);
1118
+ };
1119
+ }
1120
+ var h = [];
1121
+ function u() {
1122
+ var e3, t3;
1123
+ n = true;
1124
+ for (var r2 = h.length; r2; ) {
1125
+ for (t3 = h, h = [], e3 = -1; ++e3 < r2; ) t3[e3]();
1126
+ r2 = h.length;
1127
+ }
1128
+ n = false;
1129
+ }
1130
+ l.exports = function(e3) {
1131
+ 1 !== h.push(e3) || n || r();
1132
+ };
1133
+ }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
1134
+ }, {}], 37: [function(e, t, r) {
1135
+ "use strict";
1136
+ var i = e("immediate");
1137
+ function u() {
1138
+ }
1139
+ var l = {}, s = ["REJECTED"], a = ["FULFILLED"], n = ["PENDING"];
1140
+ function o(e2) {
1141
+ if ("function" != typeof e2) throw new TypeError("resolver must be a function");
1142
+ this.state = n, this.queue = [], this.outcome = void 0, e2 !== u && d(this, e2);
1143
+ }
1144
+ function h(e2, t2, r2) {
1145
+ this.promise = e2, "function" == typeof t2 && (this.onFulfilled = t2, this.callFulfilled = this.otherCallFulfilled), "function" == typeof r2 && (this.onRejected = r2, this.callRejected = this.otherCallRejected);
1146
+ }
1147
+ function f(t2, r2, n2) {
1148
+ i(function() {
1149
+ var e2;
1150
+ try {
1151
+ e2 = r2(n2);
1152
+ } catch (e3) {
1153
+ return l.reject(t2, e3);
1154
+ }
1155
+ e2 === t2 ? l.reject(t2, new TypeError("Cannot resolve promise with itself")) : l.resolve(t2, e2);
1156
+ });
1157
+ }
1158
+ function c(e2) {
1159
+ var t2 = e2 && e2.then;
1160
+ if (e2 && ("object" == typeof e2 || "function" == typeof e2) && "function" == typeof t2) return function() {
1161
+ t2.apply(e2, arguments);
1162
+ };
1163
+ }
1164
+ function d(t2, e2) {
1165
+ var r2 = false;
1166
+ function n2(e3) {
1167
+ r2 || (r2 = true, l.reject(t2, e3));
1168
+ }
1169
+ function i2(e3) {
1170
+ r2 || (r2 = true, l.resolve(t2, e3));
1171
+ }
1172
+ var s2 = p(function() {
1173
+ e2(i2, n2);
1174
+ });
1175
+ "error" === s2.status && n2(s2.value);
1176
+ }
1177
+ function p(e2, t2) {
1178
+ var r2 = {};
1179
+ try {
1180
+ r2.value = e2(t2), r2.status = "success";
1181
+ } catch (e3) {
1182
+ r2.status = "error", r2.value = e3;
1183
+ }
1184
+ return r2;
1185
+ }
1186
+ (t.exports = o).prototype.finally = function(t2) {
1187
+ if ("function" != typeof t2) return this;
1188
+ var r2 = this.constructor;
1189
+ return this.then(function(e2) {
1190
+ return r2.resolve(t2()).then(function() {
1191
+ return e2;
1192
+ });
1193
+ }, function(e2) {
1194
+ return r2.resolve(t2()).then(function() {
1195
+ throw e2;
1196
+ });
1197
+ });
1198
+ }, o.prototype.catch = function(e2) {
1199
+ return this.then(null, e2);
1200
+ }, o.prototype.then = function(e2, t2) {
1201
+ if ("function" != typeof e2 && this.state === a || "function" != typeof t2 && this.state === s) return this;
1202
+ var r2 = new this.constructor(u);
1203
+ this.state !== n ? f(r2, this.state === a ? e2 : t2, this.outcome) : this.queue.push(new h(r2, e2, t2));
1204
+ return r2;
1205
+ }, h.prototype.callFulfilled = function(e2) {
1206
+ l.resolve(this.promise, e2);
1207
+ }, h.prototype.otherCallFulfilled = function(e2) {
1208
+ f(this.promise, this.onFulfilled, e2);
1209
+ }, h.prototype.callRejected = function(e2) {
1210
+ l.reject(this.promise, e2);
1211
+ }, h.prototype.otherCallRejected = function(e2) {
1212
+ f(this.promise, this.onRejected, e2);
1213
+ }, l.resolve = function(e2, t2) {
1214
+ var r2 = p(c, t2);
1215
+ if ("error" === r2.status) return l.reject(e2, r2.value);
1216
+ var n2 = r2.value;
1217
+ if (n2) d(e2, n2);
1218
+ else {
1219
+ e2.state = a, e2.outcome = t2;
1220
+ for (var i2 = -1, s2 = e2.queue.length; ++i2 < s2; ) e2.queue[i2].callFulfilled(t2);
1221
+ }
1222
+ return e2;
1223
+ }, l.reject = function(e2, t2) {
1224
+ e2.state = s, e2.outcome = t2;
1225
+ for (var r2 = -1, n2 = e2.queue.length; ++r2 < n2; ) e2.queue[r2].callRejected(t2);
1226
+ return e2;
1227
+ }, o.resolve = function(e2) {
1228
+ if (e2 instanceof this) return e2;
1229
+ return l.resolve(new this(u), e2);
1230
+ }, o.reject = function(e2) {
1231
+ var t2 = new this(u);
1232
+ return l.reject(t2, e2);
1233
+ }, o.all = function(e2) {
1234
+ var r2 = this;
1235
+ if ("[object Array]" !== Object.prototype.toString.call(e2)) return this.reject(new TypeError("must be an array"));
1236
+ var n2 = e2.length, i2 = false;
1237
+ if (!n2) return this.resolve([]);
1238
+ var s2 = new Array(n2), a2 = 0, t2 = -1, o2 = new this(u);
1239
+ for (; ++t2 < n2; ) h2(e2[t2], t2);
1240
+ return o2;
1241
+ function h2(e3, t3) {
1242
+ r2.resolve(e3).then(function(e4) {
1243
+ s2[t3] = e4, ++a2 !== n2 || i2 || (i2 = true, l.resolve(o2, s2));
1244
+ }, function(e4) {
1245
+ i2 || (i2 = true, l.reject(o2, e4));
1246
+ });
1247
+ }
1248
+ }, o.race = function(e2) {
1249
+ var t2 = this;
1250
+ if ("[object Array]" !== Object.prototype.toString.call(e2)) return this.reject(new TypeError("must be an array"));
1251
+ var r2 = e2.length, n2 = false;
1252
+ if (!r2) return this.resolve([]);
1253
+ var i2 = -1, s2 = new this(u);
1254
+ for (; ++i2 < r2; ) a2 = e2[i2], t2.resolve(a2).then(function(e3) {
1255
+ n2 || (n2 = true, l.resolve(s2, e3));
1256
+ }, function(e3) {
1257
+ n2 || (n2 = true, l.reject(s2, e3));
1258
+ });
1259
+ var a2;
1260
+ return s2;
1261
+ };
1262
+ }, { immediate: 36 }], 38: [function(e, t, r) {
1263
+ "use strict";
1264
+ var n = {};
1265
+ (0, e("./lib/utils/common").assign)(n, e("./lib/deflate"), e("./lib/inflate"), e("./lib/zlib/constants")), t.exports = n;
1266
+ }, { "./lib/deflate": 39, "./lib/inflate": 40, "./lib/utils/common": 41, "./lib/zlib/constants": 44 }], 39: [function(e, t, r) {
1267
+ "use strict";
1268
+ 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;
1269
+ function p(e2) {
1270
+ if (!(this instanceof p)) return new p(e2);
1271
+ this.options = o.assign({ level: f, method: d, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: c, to: "" }, e2 || {});
1272
+ var t2 = this.options;
1273
+ 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;
1274
+ var r2 = a.deflateInit2(this.strm, t2.level, t2.method, t2.windowBits, t2.memLevel, t2.strategy);
1275
+ if (r2 !== l) throw new Error(i[r2]);
1276
+ if (t2.header && a.deflateSetHeader(this.strm, t2.header), t2.dictionary) {
1277
+ var n2;
1278
+ 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]);
1279
+ this._dict_set = true;
1280
+ }
1281
+ }
1282
+ function n(e2, t2) {
1283
+ var r2 = new p(t2);
1284
+ if (r2.push(e2, true), r2.err) throw r2.msg || i[r2.err];
1285
+ return r2.result;
1286
+ }
1287
+ p.prototype.push = function(e2, t2) {
1288
+ var r2, n2, i2 = this.strm, s2 = this.options.chunkSize;
1289
+ if (this.ended) return false;
1290
+ 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;
1291
+ do {
1292
+ 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);
1293
+ 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)));
1294
+ } while ((0 < i2.avail_in || 0 === i2.avail_out) && 1 !== r2);
1295
+ 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));
1296
+ }, p.prototype.onData = function(e2) {
1297
+ this.chunks.push(e2);
1298
+ }, p.prototype.onEnd = function(e2) {
1299
+ 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;
1300
+ }, r.Deflate = p, r.deflate = n, r.deflateRaw = function(e2, t2) {
1301
+ return (t2 = t2 || {}).raw = true, n(e2, t2);
1302
+ }, r.gzip = function(e2, t2) {
1303
+ return (t2 = t2 || {}).gzip = true, n(e2, t2);
1304
+ };
1305
+ }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/deflate": 46, "./zlib/messages": 51, "./zlib/zstream": 53 }], 40: [function(e, t, r) {
1306
+ "use strict";
1307
+ 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;
1308
+ function a(e2) {
1309
+ if (!(this instanceof a)) return new a(e2);
1310
+ this.options = d.assign({ chunkSize: 16384, windowBits: 0, to: "" }, e2 || {});
1311
+ var t2 = this.options;
1312
+ 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;
1313
+ var r2 = c.inflateInit2(this.strm, t2.windowBits);
1314
+ if (r2 !== m.Z_OK) throw new Error(n[r2]);
1315
+ this.header = new s(), c.inflateGetHeader(this.strm, this.header);
1316
+ }
1317
+ function o(e2, t2) {
1318
+ var r2 = new a(t2);
1319
+ if (r2.push(e2, true), r2.err) throw r2.msg || n[r2.err];
1320
+ return r2.result;
1321
+ }
1322
+ a.prototype.push = function(e2, t2) {
1323
+ var r2, n2, i2, s2, a2, o2, h = this.strm, u = this.options.chunkSize, l = this.options.dictionary, f = false;
1324
+ if (this.ended) return false;
1325
+ 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;
1326
+ do {
1327
+ 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);
1328
+ 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);
1329
+ } while ((0 < h.avail_in || 0 === h.avail_out) && r2 !== m.Z_STREAM_END);
1330
+ 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));
1331
+ }, a.prototype.onData = function(e2) {
1332
+ this.chunks.push(e2);
1333
+ }, a.prototype.onEnd = function(e2) {
1334
+ 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;
1335
+ }, r.Inflate = a, r.inflate = o, r.inflateRaw = function(e2, t2) {
1336
+ return (t2 = t2 || {}).raw = true, o(e2, t2);
1337
+ }, r.ungzip = o;
1338
+ }, { "./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) {
1339
+ "use strict";
1340
+ var n = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Int32Array;
1341
+ r.assign = function(e2) {
1342
+ for (var t2 = Array.prototype.slice.call(arguments, 1); t2.length; ) {
1343
+ var r2 = t2.shift();
1344
+ if (r2) {
1345
+ if ("object" != typeof r2) throw new TypeError(r2 + "must be non-object");
1346
+ for (var n2 in r2) r2.hasOwnProperty(n2) && (e2[n2] = r2[n2]);
1347
+ }
1348
+ }
1349
+ return e2;
1350
+ }, r.shrinkBuf = function(e2, t2) {
1351
+ return e2.length === t2 ? e2 : e2.subarray ? e2.subarray(0, t2) : (e2.length = t2, e2);
1352
+ };
1353
+ var i = { arraySet: function(e2, t2, r2, n2, i2) {
1354
+ if (t2.subarray && e2.subarray) e2.set(t2.subarray(r2, r2 + n2), i2);
1355
+ else for (var s2 = 0; s2 < n2; s2++) e2[i2 + s2] = t2[r2 + s2];
1356
+ }, flattenChunks: function(e2) {
1357
+ var t2, r2, n2, i2, s2, a;
1358
+ for (t2 = n2 = 0, r2 = e2.length; t2 < r2; t2++) n2 += e2[t2].length;
1359
+ for (a = new Uint8Array(n2), t2 = i2 = 0, r2 = e2.length; t2 < r2; t2++) s2 = e2[t2], a.set(s2, i2), i2 += s2.length;
1360
+ return a;
1361
+ } }, s = { arraySet: function(e2, t2, r2, n2, i2) {
1362
+ for (var s2 = 0; s2 < n2; s2++) e2[i2 + s2] = t2[r2 + s2];
1363
+ }, flattenChunks: function(e2) {
1364
+ return [].concat.apply([], e2);
1365
+ } };
1366
+ r.setTyped = function(e2) {
1367
+ 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));
1368
+ }, r.setTyped(n);
1369
+ }, {}], 42: [function(e, t, r) {
1370
+ "use strict";
1371
+ var h = e("./common"), i = true, s = true;
1372
+ try {
1373
+ String.fromCharCode.apply(null, [0]);
1374
+ } catch (e2) {
1375
+ i = false;
1376
+ }
1377
+ try {
1378
+ String.fromCharCode.apply(null, new Uint8Array(1));
1379
+ } catch (e2) {
1380
+ s = false;
1381
+ }
1382
+ 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;
1383
+ function l(e2, t2) {
1384
+ if (t2 < 65537 && (e2.subarray && s || !e2.subarray && i)) return String.fromCharCode.apply(null, h.shrinkBuf(e2, t2));
1385
+ for (var r2 = "", n2 = 0; n2 < t2; n2++) r2 += String.fromCharCode(e2[n2]);
1386
+ return r2;
1387
+ }
1388
+ u[254] = u[254] = 1, r.string2buf = function(e2) {
1389
+ var t2, r2, n2, i2, s2, a = e2.length, o = 0;
1390
+ 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;
1391
+ 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);
1392
+ return t2;
1393
+ }, r.buf2binstring = function(e2) {
1394
+ return l(e2, e2.length);
1395
+ }, r.binstring2buf = function(e2) {
1396
+ for (var t2 = new h.Buf8(e2.length), r2 = 0, n2 = t2.length; r2 < n2; r2++) t2[r2] = e2.charCodeAt(r2);
1397
+ return t2;
1398
+ }, r.buf2string = function(e2, t2) {
1399
+ var r2, n2, i2, s2, a = t2 || e2.length, o = new Array(2 * a);
1400
+ for (r2 = n2 = 0; r2 < a; ) if ((i2 = e2[r2++]) < 128) o[n2++] = i2;
1401
+ else if (4 < (s2 = u[i2])) o[n2++] = 65533, r2 += s2 - 1;
1402
+ else {
1403
+ for (i2 &= 2 === s2 ? 31 : 3 === s2 ? 15 : 7; 1 < s2 && r2 < a; ) i2 = i2 << 6 | 63 & e2[r2++], s2--;
1404
+ 1 < s2 ? o[n2++] = 65533 : i2 < 65536 ? o[n2++] = i2 : (i2 -= 65536, o[n2++] = 55296 | i2 >> 10 & 1023, o[n2++] = 56320 | 1023 & i2);
1405
+ }
1406
+ return l(o, n2);
1407
+ }, r.utf8border = function(e2, t2) {
1408
+ var r2;
1409
+ for ((t2 = t2 || e2.length) > e2.length && (t2 = e2.length), r2 = t2 - 1; 0 <= r2 && 128 == (192 & e2[r2]); ) r2--;
1410
+ return r2 < 0 ? t2 : 0 === r2 ? t2 : r2 + u[e2[r2]] > t2 ? r2 : t2;
1411
+ };
1412
+ }, { "./common": 41 }], 43: [function(e, t, r) {
1413
+ "use strict";
1414
+ t.exports = function(e2, t2, r2, n) {
1415
+ for (var i = 65535 & e2 | 0, s = e2 >>> 16 & 65535 | 0, a = 0; 0 !== r2; ) {
1416
+ for (r2 -= a = 2e3 < r2 ? 2e3 : r2; s = s + (i = i + t2[n++] | 0) | 0, --a; ) ;
1417
+ i %= 65521, s %= 65521;
1418
+ }
1419
+ return i | s << 16 | 0;
1420
+ };
1421
+ }, {}], 44: [function(e, t, r) {
1422
+ "use strict";
1423
+ 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 };
1424
+ }, {}], 45: [function(e, t, r) {
1425
+ "use strict";
1426
+ var o = (function() {
1427
+ for (var e2, t2 = [], r2 = 0; r2 < 256; r2++) {
1428
+ e2 = r2;
1429
+ for (var n = 0; n < 8; n++) e2 = 1 & e2 ? 3988292384 ^ e2 >>> 1 : e2 >>> 1;
1430
+ t2[r2] = e2;
1431
+ }
1432
+ return t2;
1433
+ })();
1434
+ t.exports = function(e2, t2, r2, n) {
1435
+ var i = o, s = n + r2;
1436
+ e2 ^= -1;
1437
+ for (var a = n; a < s; a++) e2 = e2 >>> 8 ^ i[255 & (e2 ^ t2[a])];
1438
+ return -1 ^ e2;
1439
+ };
1440
+ }, {}], 46: [function(e, t, r) {
1441
+ "use strict";
1442
+ 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;
1443
+ function R(e2, t2) {
1444
+ return e2.msg = n[t2], t2;
1445
+ }
1446
+ function T(e2) {
1447
+ return (e2 << 1) - (4 < e2 ? 9 : 0);
1448
+ }
1449
+ function D(e2) {
1450
+ for (var t2 = e2.length; 0 <= --t2; ) e2[t2] = 0;
1451
+ }
1452
+ function F(e2) {
1453
+ var t2 = e2.state, r2 = t2.pending;
1454
+ 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));
1455
+ }
1456
+ function N(e2, t2) {
1457
+ 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);
1458
+ }
1459
+ function U(e2, t2) {
1460
+ e2.pending_buf[e2.pending++] = t2;
1461
+ }
1462
+ function P(e2, t2) {
1463
+ e2.pending_buf[e2.pending++] = t2 >>> 8 & 255, e2.pending_buf[e2.pending++] = 255 & t2;
1464
+ }
1465
+ function L(e2, t2) {
1466
+ 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];
1467
+ e2.prev_length >= e2.good_match && (i2 >>= 2), o2 > e2.lookahead && (o2 = e2.lookahead);
1468
+ do {
1469
+ if (u2[(r2 = t2) + a2] === p2 && u2[r2 + a2 - 1] === d2 && u2[r2] === u2[s2] && u2[++r2] === u2[s2 + 1]) {
1470
+ s2 += 2, r2++;
1471
+ do {
1472
+ } 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);
1473
+ if (n2 = S - (c2 - s2), s2 = c2 - S, a2 < n2) {
1474
+ if (e2.match_start = t2, o2 <= (a2 = n2)) break;
1475
+ d2 = u2[s2 + a2 - 1], p2 = u2[s2 + a2];
1476
+ }
1477
+ }
1478
+ } while ((t2 = f2[t2 & l2]) > h2 && 0 != --i2);
1479
+ return a2 <= e2.lookahead ? a2 : e2.lookahead;
1480
+ }
1481
+ function j(e2) {
1482
+ var t2, r2, n2, i2, s2, a2, o2, h2, u2, l2, f2 = e2.w_size;
1483
+ do {
1484
+ if (i2 = e2.window_size - e2.lookahead - e2.strstart, e2.strstart >= f2 + (f2 - z)) {
1485
+ 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; ) ;
1486
+ for (t2 = r2 = f2; n2 = e2.prev[--t2], e2.prev[t2] = f2 <= n2 ? n2 - f2 : 0, --r2; ) ;
1487
+ i2 += f2;
1488
+ }
1489
+ if (0 === e2.strm.avail_in) break;
1490
+ 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)); ) ;
1491
+ } while (e2.lookahead < z && 0 !== e2.strm.avail_in);
1492
+ }
1493
+ function Z(e2, t2) {
1494
+ for (var r2, n2; ; ) {
1495
+ if (e2.lookahead < z) {
1496
+ if (j(e2), e2.lookahead < z && t2 === l) return A;
1497
+ if (0 === e2.lookahead) break;
1498
+ }
1499
+ 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) {
1500
+ 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; ) ;
1501
+ e2.strstart++;
1502
+ } 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;
1503
+ else n2 = u._tr_tally(e2, 0, e2.window[e2.strstart]), e2.lookahead--, e2.strstart++;
1504
+ if (n2 && (N(e2, false), 0 === e2.strm.avail_out)) return A;
1505
+ }
1506
+ 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;
1507
+ }
1508
+ function W(e2, t2) {
1509
+ for (var r2, n2, i2; ; ) {
1510
+ if (e2.lookahead < z) {
1511
+ if (j(e2), e2.lookahead < z && t2 === l) return A;
1512
+ if (0 === e2.lookahead) break;
1513
+ }
1514
+ 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) {
1515
+ 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; ) ;
1516
+ if (e2.match_available = 0, e2.match_length = x - 1, e2.strstart++, n2 && (N(e2, false), 0 === e2.strm.avail_out)) return A;
1517
+ } else if (e2.match_available) {
1518
+ 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;
1519
+ } else e2.match_available = 1, e2.strstart++, e2.lookahead--;
1520
+ }
1521
+ 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;
1522
+ }
1523
+ function M(e2, t2, r2, n2, i2) {
1524
+ this.good_length = e2, this.max_lazy = t2, this.nice_length = r2, this.max_chain = n2, this.func = i2;
1525
+ }
1526
+ function H() {
1527
+ 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;
1528
+ }
1529
+ function G(e2) {
1530
+ var t2;
1531
+ 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, _);
1532
+ }
1533
+ function K(e2) {
1534
+ var t2 = G(e2);
1535
+ return t2 === m && (function(e3) {
1536
+ 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;
1537
+ })(e2.state), t2;
1538
+ }
1539
+ function Y(e2, t2, r2, n2, i2, s2) {
1540
+ if (!e2) return _;
1541
+ var a2 = 1;
1542
+ 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, _);
1543
+ 8 === n2 && (n2 = 9);
1544
+ var o2 = new H();
1545
+ 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);
1546
+ }
1547
+ h = [new M(0, 0, 0, 0, function(e2, t2) {
1548
+ var r2 = 65535;
1549
+ for (r2 > e2.pending_buf_size - 5 && (r2 = e2.pending_buf_size - 5); ; ) {
1550
+ if (e2.lookahead <= 1) {
1551
+ if (j(e2), 0 === e2.lookahead && t2 === l) return A;
1552
+ if (0 === e2.lookahead) break;
1553
+ }
1554
+ e2.strstart += e2.lookahead, e2.lookahead = 0;
1555
+ var n2 = e2.block_start + r2;
1556
+ 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;
1557
+ if (e2.strstart - e2.block_start >= e2.w_size - z && (N(e2, false), 0 === e2.strm.avail_out)) return A;
1558
+ }
1559
+ 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);
1560
+ }), 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) {
1561
+ return Y(e2, t2, v, 15, 8, 0);
1562
+ }, r.deflateInit2 = Y, r.deflateReset = K, r.deflateResetKeep = G, r.deflateSetHeader = function(e2, t2) {
1563
+ return e2 && e2.state ? 2 !== e2.state.wrap ? _ : (e2.state.gzhead = t2, m) : _;
1564
+ }, r.deflate = function(e2, t2) {
1565
+ var r2, n2, i2, s2;
1566
+ if (!e2 || !e2.state || 5 < t2 || t2 < 0) return e2 ? R(e2, _) : _;
1567
+ 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 : _);
1568
+ 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);
1569
+ else {
1570
+ var a2 = v + (n2.w_bits - 8 << 4) << 8;
1571
+ 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;
1572
+ }
1573
+ if (69 === n2.status) if (n2.gzhead.extra) {
1574
+ 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++;
1575
+ 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);
1576
+ } else n2.status = 73;
1577
+ if (73 === n2.status) if (n2.gzhead.name) {
1578
+ i2 = n2.pending;
1579
+ do {
1580
+ 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)) {
1581
+ s2 = 1;
1582
+ break;
1583
+ }
1584
+ s2 = n2.gzindex < n2.gzhead.name.length ? 255 & n2.gzhead.name.charCodeAt(n2.gzindex++) : 0, U(n2, s2);
1585
+ } while (0 !== s2);
1586
+ 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);
1587
+ } else n2.status = 91;
1588
+ if (91 === n2.status) if (n2.gzhead.comment) {
1589
+ i2 = n2.pending;
1590
+ do {
1591
+ 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)) {
1592
+ s2 = 1;
1593
+ break;
1594
+ }
1595
+ s2 = n2.gzindex < n2.gzhead.comment.length ? 255 & n2.gzhead.comment.charCodeAt(n2.gzindex++) : 0, U(n2, s2);
1596
+ } while (0 !== s2);
1597
+ n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), 0 === s2 && (n2.status = 103);
1598
+ } else n2.status = 103;
1599
+ 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) {
1600
+ if (F(e2), 0 === e2.avail_out) return n2.last_flush = -1, m;
1601
+ } else if (0 === e2.avail_in && T(t2) <= T(r2) && t2 !== f) return R(e2, -5);
1602
+ if (666 === n2.status && 0 !== e2.avail_in) return R(e2, -5);
1603
+ if (0 !== e2.avail_in || 0 !== n2.lookahead || t2 !== l && 666 !== n2.status) {
1604
+ var o2 = 2 === n2.strategy ? (function(e3, t3) {
1605
+ for (var r3; ; ) {
1606
+ if (0 === e3.lookahead && (j(e3), 0 === e3.lookahead)) {
1607
+ if (t3 === l) return A;
1608
+ break;
1609
+ }
1610
+ 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;
1611
+ }
1612
+ 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;
1613
+ })(n2, t2) : 3 === n2.strategy ? (function(e3, t3) {
1614
+ for (var r3, n3, i3, s3, a3 = e3.window; ; ) {
1615
+ if (e3.lookahead <= S) {
1616
+ if (j(e3), e3.lookahead <= S && t3 === l) return A;
1617
+ if (0 === e3.lookahead) break;
1618
+ }
1619
+ 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]) {
1620
+ s3 = e3.strstart + S;
1621
+ do {
1622
+ } 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);
1623
+ e3.match_length = S - (s3 - i3), e3.match_length > e3.lookahead && (e3.match_length = e3.lookahead);
1624
+ }
1625
+ 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;
1626
+ }
1627
+ 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;
1628
+ })(n2, t2) : h[n2.level].func(n2, t2);
1629
+ if (o2 !== O && o2 !== B || (n2.status = 666), o2 === A || o2 === O) return 0 === e2.avail_out && (n2.last_flush = -1), m;
1630
+ 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;
1631
+ }
1632
+ 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);
1633
+ }, r.deflateEnd = function(e2) {
1634
+ var t2;
1635
+ 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) : _;
1636
+ }, r.deflateSetDictionary = function(e2, t2) {
1637
+ var r2, n2, i2, s2, a2, o2, h2, u2, l2 = t2.length;
1638
+ if (!e2 || !e2.state) return _;
1639
+ if (2 === (s2 = (r2 = e2.state).wrap) || 1 === s2 && r2.status !== C || r2.lookahead) return _;
1640
+ 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; ) {
1641
+ 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; ) ;
1642
+ r2.strstart = n2, r2.lookahead = x - 1, j(r2);
1643
+ }
1644
+ 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;
1645
+ }, r.deflateInfo = "pako deflate (from Nodeca project)";
1646
+ }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./messages": 51, "./trees": 52 }], 47: [function(e, t, r) {
1647
+ "use strict";
1648
+ t.exports = function() {
1649
+ 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;
1650
+ };
1651
+ }, {}], 48: [function(e, t, r) {
1652
+ "use strict";
1653
+ t.exports = function(e2, t2) {
1654
+ 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;
1655
+ 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;
1656
+ e: do {
1657
+ p < 15 && (d += z[n++] << p, p += 8, d += z[n++] << p, p += 8), v = m[d & g];
1658
+ t: for (; ; ) {
1659
+ if (d >>>= y = v >>> 24, p -= y, 0 === (y = v >>> 16 & 255)) C[s++] = 65535 & v;
1660
+ else {
1661
+ if (!(16 & y)) {
1662
+ if (0 == (64 & y)) {
1663
+ v = m[(65535 & v) + (d & (1 << y) - 1)];
1664
+ continue t;
1665
+ }
1666
+ if (32 & y) {
1667
+ r2.mode = 12;
1668
+ break e;
1669
+ }
1670
+ e2.msg = "invalid literal/length code", r2.mode = 30;
1671
+ break e;
1672
+ }
1673
+ 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];
1674
+ r: for (; ; ) {
1675
+ if (d >>>= y = v >>> 24, p -= y, !(16 & (y = v >>> 16 & 255))) {
1676
+ if (0 == (64 & y)) {
1677
+ v = _[(65535 & v) + (d & (1 << y) - 1)];
1678
+ continue r;
1679
+ }
1680
+ e2.msg = "invalid distance code", r2.mode = 30;
1681
+ break e;
1682
+ }
1683
+ 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)) {
1684
+ e2.msg = "invalid distance too far back", r2.mode = 30;
1685
+ break e;
1686
+ }
1687
+ if (d >>>= y, p -= y, (y = s - a) < k) {
1688
+ if (l < (y = k - y) && r2.sane) {
1689
+ e2.msg = "invalid distance too far back", r2.mode = 30;
1690
+ break e;
1691
+ }
1692
+ if (S = c, (x = 0) === f) {
1693
+ if (x += u - y, y < w) {
1694
+ for (w -= y; C[s++] = c[x++], --y; ) ;
1695
+ x = s - k, S = C;
1696
+ }
1697
+ } else if (f < y) {
1698
+ if (x += u + f - y, (y -= f) < w) {
1699
+ for (w -= y; C[s++] = c[x++], --y; ) ;
1700
+ if (x = 0, f < w) {
1701
+ for (w -= y = f; C[s++] = c[x++], --y; ) ;
1702
+ x = s - k, S = C;
1703
+ }
1704
+ }
1705
+ } else if (x += f - y, y < w) {
1706
+ for (w -= y; C[s++] = c[x++], --y; ) ;
1707
+ x = s - k, S = C;
1708
+ }
1709
+ for (; 2 < w; ) C[s++] = S[x++], C[s++] = S[x++], C[s++] = S[x++], w -= 3;
1710
+ w && (C[s++] = S[x++], 1 < w && (C[s++] = S[x++]));
1711
+ } else {
1712
+ for (x = s - k; C[s++] = C[x++], C[s++] = C[x++], C[s++] = C[x++], 2 < (w -= 3); ) ;
1713
+ w && (C[s++] = C[x++], 1 < w && (C[s++] = C[x++]));
1714
+ }
1715
+ break;
1716
+ }
1717
+ }
1718
+ break;
1719
+ }
1720
+ } while (n < i && s < o);
1721
+ 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;
1722
+ };
1723
+ }, {}], 49: [function(e, t, r) {
1724
+ "use strict";
1725
+ 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;
1726
+ function L(e2) {
1727
+ return (e2 >>> 24 & 255) + (e2 >>> 8 & 65280) + ((65280 & e2) << 8) + ((255 & e2) << 24);
1728
+ }
1729
+ function s() {
1730
+ 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;
1731
+ }
1732
+ function a(e2) {
1733
+ var t2;
1734
+ 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;
1735
+ }
1736
+ function o(e2) {
1737
+ var t2;
1738
+ return e2 && e2.state ? ((t2 = e2.state).wsize = 0, t2.whave = 0, t2.wnext = 0, a(e2)) : U;
1739
+ }
1740
+ function h(e2, t2) {
1741
+ var r2, n2;
1742
+ 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;
1743
+ }
1744
+ function u(e2, t2) {
1745
+ var r2, n2;
1746
+ return e2 ? (n2 = new s(), (e2.state = n2).window = null, (r2 = h(e2, t2)) !== N && (e2.state = null), r2) : U;
1747
+ }
1748
+ var l, f, c = true;
1749
+ function j(e2) {
1750
+ if (c) {
1751
+ var t2;
1752
+ for (l = new I.Buf32(512), f = new I.Buf32(32), t2 = 0; t2 < 144; ) e2.lens[t2++] = 8;
1753
+ for (; t2 < 256; ) e2.lens[t2++] = 9;
1754
+ for (; t2 < 280; ) e2.lens[t2++] = 7;
1755
+ for (; t2 < 288; ) e2.lens[t2++] = 8;
1756
+ for (T(D, e2.lens, 0, 288, l, 0, e2.work, { bits: 9 }), t2 = 0; t2 < 32; ) e2.lens[t2++] = 5;
1757
+ T(F, e2.lens, 0, 32, f, 0, e2.work, { bits: 5 }), c = false;
1758
+ }
1759
+ e2.lencode = l, e2.lenbits = 9, e2.distcode = f, e2.distbits = 5;
1760
+ }
1761
+ function Z(e2, t2, r2, n2) {
1762
+ var i2, s2 = e2.state;
1763
+ 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;
1764
+ }
1765
+ r.inflateReset = o, r.inflateReset2 = h, r.inflateResetKeep = a, r.inflateInit = function(e2) {
1766
+ return u(e2, 15);
1767
+ }, r.inflateInit2 = u, r.inflate = function(e2, t2) {
1768
+ 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];
1769
+ if (!e2 || !e2.state || !e2.output || !e2.input && 0 !== e2.avail_in) return U;
1770
+ 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;
1771
+ e: for (; ; ) switch (r2.mode) {
1772
+ case P:
1773
+ if (0 === r2.wrap) {
1774
+ r2.mode = 13;
1775
+ break;
1776
+ }
1777
+ for (; l2 < 16; ) {
1778
+ if (0 === o2) break e;
1779
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
1780
+ }
1781
+ if (2 & r2.wrap && 35615 === u2) {
1782
+ 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;
1783
+ break;
1784
+ }
1785
+ if (r2.flags = 0, r2.head && (r2.head.done = false), !(1 & r2.wrap) || (((255 & u2) << 8) + (u2 >> 8)) % 31) {
1786
+ e2.msg = "incorrect header check", r2.mode = 30;
1787
+ break;
1788
+ }
1789
+ if (8 != (15 & u2)) {
1790
+ e2.msg = "unknown compression method", r2.mode = 30;
1791
+ break;
1792
+ }
1793
+ if (l2 -= 4, k = 8 + (15 & (u2 >>>= 4)), 0 === r2.wbits) r2.wbits = k;
1794
+ else if (k > r2.wbits) {
1795
+ e2.msg = "invalid window size", r2.mode = 30;
1796
+ break;
1797
+ }
1798
+ r2.dmax = 1 << k, e2.adler = r2.check = 1, r2.mode = 512 & u2 ? 10 : 12, l2 = u2 = 0;
1799
+ break;
1800
+ case 2:
1801
+ for (; l2 < 16; ) {
1802
+ if (0 === o2) break e;
1803
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
1804
+ }
1805
+ if (r2.flags = u2, 8 != (255 & r2.flags)) {
1806
+ e2.msg = "unknown compression method", r2.mode = 30;
1807
+ break;
1808
+ }
1809
+ if (57344 & r2.flags) {
1810
+ e2.msg = "unknown header flags set", r2.mode = 30;
1811
+ break;
1812
+ }
1813
+ 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;
1814
+ case 3:
1815
+ for (; l2 < 32; ) {
1816
+ if (0 === o2) break e;
1817
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
1818
+ }
1819
+ 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;
1820
+ case 4:
1821
+ for (; l2 < 16; ) {
1822
+ if (0 === o2) break e;
1823
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
1824
+ }
1825
+ 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;
1826
+ case 5:
1827
+ if (1024 & r2.flags) {
1828
+ for (; l2 < 16; ) {
1829
+ if (0 === o2) break e;
1830
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
1831
+ }
1832
+ 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;
1833
+ } else r2.head && (r2.head.extra = null);
1834
+ r2.mode = 6;
1835
+ case 6:
1836
+ 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;
1837
+ r2.length = 0, r2.mode = 7;
1838
+ case 7:
1839
+ if (2048 & r2.flags) {
1840
+ if (0 === o2) break e;
1841
+ for (d = 0; k = n2[s2 + d++], r2.head && k && r2.length < 65536 && (r2.head.name += String.fromCharCode(k)), k && d < o2; ) ;
1842
+ if (512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, k) break e;
1843
+ } else r2.head && (r2.head.name = null);
1844
+ r2.length = 0, r2.mode = 8;
1845
+ case 8:
1846
+ if (4096 & r2.flags) {
1847
+ if (0 === o2) break e;
1848
+ for (d = 0; k = n2[s2 + d++], r2.head && k && r2.length < 65536 && (r2.head.comment += String.fromCharCode(k)), k && d < o2; ) ;
1849
+ if (512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, k) break e;
1850
+ } else r2.head && (r2.head.comment = null);
1851
+ r2.mode = 9;
1852
+ case 9:
1853
+ if (512 & r2.flags) {
1854
+ for (; l2 < 16; ) {
1855
+ if (0 === o2) break e;
1856
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
1857
+ }
1858
+ if (u2 !== (65535 & r2.check)) {
1859
+ e2.msg = "header crc mismatch", r2.mode = 30;
1860
+ break;
1861
+ }
1862
+ l2 = u2 = 0;
1863
+ }
1864
+ r2.head && (r2.head.hcrc = r2.flags >> 9 & 1, r2.head.done = true), e2.adler = r2.check = 0, r2.mode = 12;
1865
+ break;
1866
+ case 10:
1867
+ for (; l2 < 32; ) {
1868
+ if (0 === o2) break e;
1869
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
1870
+ }
1871
+ e2.adler = r2.check = L(u2), l2 = u2 = 0, r2.mode = 11;
1872
+ case 11:
1873
+ 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;
1874
+ e2.adler = r2.check = 1, r2.mode = 12;
1875
+ case 12:
1876
+ if (5 === t2 || 6 === t2) break e;
1877
+ case 13:
1878
+ if (r2.last) {
1879
+ u2 >>>= 7 & l2, l2 -= 7 & l2, r2.mode = 27;
1880
+ break;
1881
+ }
1882
+ for (; l2 < 3; ) {
1883
+ if (0 === o2) break e;
1884
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
1885
+ }
1886
+ switch (r2.last = 1 & u2, l2 -= 1, 3 & (u2 >>>= 1)) {
1887
+ case 0:
1888
+ r2.mode = 14;
1889
+ break;
1890
+ case 1:
1891
+ if (j(r2), r2.mode = 20, 6 !== t2) break;
1892
+ u2 >>>= 2, l2 -= 2;
1893
+ break e;
1894
+ case 2:
1895
+ r2.mode = 17;
1896
+ break;
1897
+ case 3:
1898
+ e2.msg = "invalid block type", r2.mode = 30;
1899
+ }
1900
+ u2 >>>= 2, l2 -= 2;
1901
+ break;
1902
+ case 14:
1903
+ for (u2 >>>= 7 & l2, l2 -= 7 & l2; l2 < 32; ) {
1904
+ if (0 === o2) break e;
1905
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
1906
+ }
1907
+ if ((65535 & u2) != (u2 >>> 16 ^ 65535)) {
1908
+ e2.msg = "invalid stored block lengths", r2.mode = 30;
1909
+ break;
1910
+ }
1911
+ if (r2.length = 65535 & u2, l2 = u2 = 0, r2.mode = 15, 6 === t2) break e;
1912
+ case 15:
1913
+ r2.mode = 16;
1914
+ case 16:
1915
+ if (d = r2.length) {
1916
+ if (o2 < d && (d = o2), h2 < d && (d = h2), 0 === d) break e;
1917
+ I.arraySet(i2, n2, s2, d, a2), o2 -= d, s2 += d, h2 -= d, a2 += d, r2.length -= d;
1918
+ break;
1919
+ }
1920
+ r2.mode = 12;
1921
+ break;
1922
+ case 17:
1923
+ for (; l2 < 14; ) {
1924
+ if (0 === o2) break e;
1925
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
1926
+ }
1927
+ 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) {
1928
+ e2.msg = "too many length or distance symbols", r2.mode = 30;
1929
+ break;
1930
+ }
1931
+ r2.have = 0, r2.mode = 18;
1932
+ case 18:
1933
+ for (; r2.have < r2.ncode; ) {
1934
+ for (; l2 < 3; ) {
1935
+ if (0 === o2) break e;
1936
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
1937
+ }
1938
+ r2.lens[A[r2.have++]] = 7 & u2, u2 >>>= 3, l2 -= 3;
1939
+ }
1940
+ for (; r2.have < 19; ) r2.lens[A[r2.have++]] = 0;
1941
+ 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) {
1942
+ e2.msg = "invalid code lengths set", r2.mode = 30;
1943
+ break;
1944
+ }
1945
+ r2.have = 0, r2.mode = 19;
1946
+ case 19:
1947
+ for (; r2.have < r2.nlen + r2.ndist; ) {
1948
+ for (; g = (C = r2.lencode[u2 & (1 << r2.lenbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) {
1949
+ if (0 === o2) break e;
1950
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
1951
+ }
1952
+ if (b < 16) u2 >>>= _, l2 -= _, r2.lens[r2.have++] = b;
1953
+ else {
1954
+ if (16 === b) {
1955
+ for (z = _ + 2; l2 < z; ) {
1956
+ if (0 === o2) break e;
1957
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
1958
+ }
1959
+ if (u2 >>>= _, l2 -= _, 0 === r2.have) {
1960
+ e2.msg = "invalid bit length repeat", r2.mode = 30;
1961
+ break;
1962
+ }
1963
+ k = r2.lens[r2.have - 1], d = 3 + (3 & u2), u2 >>>= 2, l2 -= 2;
1964
+ } else if (17 === b) {
1965
+ for (z = _ + 3; l2 < z; ) {
1966
+ if (0 === o2) break e;
1967
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
1968
+ }
1969
+ l2 -= _, k = 0, d = 3 + (7 & (u2 >>>= _)), u2 >>>= 3, l2 -= 3;
1970
+ } else {
1971
+ for (z = _ + 7; l2 < z; ) {
1972
+ if (0 === o2) break e;
1973
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
1974
+ }
1975
+ l2 -= _, k = 0, d = 11 + (127 & (u2 >>>= _)), u2 >>>= 7, l2 -= 7;
1976
+ }
1977
+ if (r2.have + d > r2.nlen + r2.ndist) {
1978
+ e2.msg = "invalid bit length repeat", r2.mode = 30;
1979
+ break;
1980
+ }
1981
+ for (; d--; ) r2.lens[r2.have++] = k;
1982
+ }
1983
+ }
1984
+ if (30 === r2.mode) break;
1985
+ if (0 === r2.lens[256]) {
1986
+ e2.msg = "invalid code -- missing end-of-block", r2.mode = 30;
1987
+ break;
1988
+ }
1989
+ 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) {
1990
+ e2.msg = "invalid literal/lengths set", r2.mode = 30;
1991
+ break;
1992
+ }
1993
+ 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) {
1994
+ e2.msg = "invalid distances set", r2.mode = 30;
1995
+ break;
1996
+ }
1997
+ if (r2.mode = 20, 6 === t2) break e;
1998
+ case 20:
1999
+ r2.mode = 21;
2000
+ case 21:
2001
+ if (6 <= o2 && 258 <= h2) {
2002
+ 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);
2003
+ break;
2004
+ }
2005
+ for (r2.back = 0; g = (C = r2.lencode[u2 & (1 << r2.lenbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) {
2006
+ if (0 === o2) break e;
2007
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
2008
+ }
2009
+ if (g && 0 == (240 & g)) {
2010
+ 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); ) {
2011
+ if (0 === o2) break e;
2012
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
2013
+ }
2014
+ u2 >>>= v, l2 -= v, r2.back += v;
2015
+ }
2016
+ if (u2 >>>= _, l2 -= _, r2.back += _, r2.length = b, 0 === g) {
2017
+ r2.mode = 26;
2018
+ break;
2019
+ }
2020
+ if (32 & g) {
2021
+ r2.back = -1, r2.mode = 12;
2022
+ break;
2023
+ }
2024
+ if (64 & g) {
2025
+ e2.msg = "invalid literal/length code", r2.mode = 30;
2026
+ break;
2027
+ }
2028
+ r2.extra = 15 & g, r2.mode = 22;
2029
+ case 22:
2030
+ if (r2.extra) {
2031
+ for (z = r2.extra; l2 < z; ) {
2032
+ if (0 === o2) break e;
2033
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
2034
+ }
2035
+ r2.length += u2 & (1 << r2.extra) - 1, u2 >>>= r2.extra, l2 -= r2.extra, r2.back += r2.extra;
2036
+ }
2037
+ r2.was = r2.length, r2.mode = 23;
2038
+ case 23:
2039
+ for (; g = (C = r2.distcode[u2 & (1 << r2.distbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) {
2040
+ if (0 === o2) break e;
2041
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
2042
+ }
2043
+ if (0 == (240 & g)) {
2044
+ 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); ) {
2045
+ if (0 === o2) break e;
2046
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
2047
+ }
2048
+ u2 >>>= v, l2 -= v, r2.back += v;
2049
+ }
2050
+ if (u2 >>>= _, l2 -= _, r2.back += _, 64 & g) {
2051
+ e2.msg = "invalid distance code", r2.mode = 30;
2052
+ break;
2053
+ }
2054
+ r2.offset = b, r2.extra = 15 & g, r2.mode = 24;
2055
+ case 24:
2056
+ if (r2.extra) {
2057
+ for (z = r2.extra; l2 < z; ) {
2058
+ if (0 === o2) break e;
2059
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
2060
+ }
2061
+ r2.offset += u2 & (1 << r2.extra) - 1, u2 >>>= r2.extra, l2 -= r2.extra, r2.back += r2.extra;
2062
+ }
2063
+ if (r2.offset > r2.dmax) {
2064
+ e2.msg = "invalid distance too far back", r2.mode = 30;
2065
+ break;
2066
+ }
2067
+ r2.mode = 25;
2068
+ case 25:
2069
+ if (0 === h2) break e;
2070
+ if (d = c2 - h2, r2.offset > d) {
2071
+ if ((d = r2.offset - d) > r2.whave && r2.sane) {
2072
+ e2.msg = "invalid distance too far back", r2.mode = 30;
2073
+ break;
2074
+ }
2075
+ p = d > r2.wnext ? (d -= r2.wnext, r2.wsize - d) : r2.wnext - d, d > r2.length && (d = r2.length), m = r2.window;
2076
+ } else m = i2, p = a2 - r2.offset, d = r2.length;
2077
+ for (h2 < d && (d = h2), h2 -= d, r2.length -= d; i2[a2++] = m[p++], --d; ) ;
2078
+ 0 === r2.length && (r2.mode = 21);
2079
+ break;
2080
+ case 26:
2081
+ if (0 === h2) break e;
2082
+ i2[a2++] = r2.length, h2--, r2.mode = 21;
2083
+ break;
2084
+ case 27:
2085
+ if (r2.wrap) {
2086
+ for (; l2 < 32; ) {
2087
+ if (0 === o2) break e;
2088
+ o2--, u2 |= n2[s2++] << l2, l2 += 8;
2089
+ }
2090
+ 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) {
2091
+ e2.msg = "incorrect data check", r2.mode = 30;
2092
+ break;
2093
+ }
2094
+ l2 = u2 = 0;
2095
+ }
2096
+ r2.mode = 28;
2097
+ case 28:
2098
+ if (r2.wrap && r2.flags) {
2099
+ for (; l2 < 32; ) {
2100
+ if (0 === o2) break e;
2101
+ o2--, u2 += n2[s2++] << l2, l2 += 8;
2102
+ }
2103
+ if (u2 !== (4294967295 & r2.total)) {
2104
+ e2.msg = "incorrect length check", r2.mode = 30;
2105
+ break;
2106
+ }
2107
+ l2 = u2 = 0;
2108
+ }
2109
+ r2.mode = 29;
2110
+ case 29:
2111
+ x = 1;
2112
+ break e;
2113
+ case 30:
2114
+ x = -3;
2115
+ break e;
2116
+ case 31:
2117
+ return -4;
2118
+ case 32:
2119
+ default:
2120
+ return U;
2121
+ }
2122
+ 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);
2123
+ }, r.inflateEnd = function(e2) {
2124
+ if (!e2 || !e2.state) return U;
2125
+ var t2 = e2.state;
2126
+ return t2.window && (t2.window = null), e2.state = null, N;
2127
+ }, r.inflateGetHeader = function(e2, t2) {
2128
+ var r2;
2129
+ return e2 && e2.state ? 0 == (2 & (r2 = e2.state).wrap) ? U : ((r2.head = t2).done = false, N) : U;
2130
+ }, r.inflateSetDictionary = function(e2, t2) {
2131
+ var r2, n2 = t2.length;
2132
+ 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;
2133
+ }, r.inflateInfo = "pako inflate (from Nodeca project)";
2134
+ }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./inffast": 48, "./inftrees": 50 }], 50: [function(e, t, r) {
2135
+ "use strict";
2136
+ 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];
2137
+ t.exports = function(e2, t2, r2, n, i, s, a, o) {
2138
+ 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;
2139
+ for (b = 0; b <= 15; b++) O[b] = 0;
2140
+ for (v = 0; v < n; v++) O[t2[r2 + v]]++;
2141
+ for (k = g, w = 15; 1 <= w && 0 === O[w]; w--) ;
2142
+ if (w < k && (k = w), 0 === w) return i[s++] = 20971520, i[s++] = 20971520, o.bits = 1, 0;
2143
+ for (y = 1; y < w && 0 === O[y]; y++) ;
2144
+ for (k < y && (k = y), b = z = 1; b <= 15; b++) if (z <<= 1, (z -= O[b]) < 0) return -1;
2145
+ if (0 < z && (0 === e2 || 1 !== w)) return -1;
2146
+ for (B[1] = 0, b = 1; b < 15; b++) B[b + 1] = B[b] + O[b];
2147
+ for (v = 0; v < n; v++) 0 !== t2[r2 + v] && (a[B[t2[r2 + v]]++] = v);
2148
+ 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;
2149
+ for (; ; ) {
2150
+ 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; ) ;
2151
+ for (h = 1 << b - 1; E & h; ) h >>= 1;
2152
+ if (0 !== h ? (E &= h - 1, E += h) : E = 0, v++, 0 == --O[b]) {
2153
+ if (b === w) break;
2154
+ b = t2[r2 + a[v]];
2155
+ }
2156
+ if (k < b && (E & f) !== l) {
2157
+ for (0 === S && (S = k), c += y, z = 1 << (x = b - S); x + S < w && !((z -= O[x + S]) <= 0); ) x++, z <<= 1;
2158
+ if (C += 1 << x, 1 === e2 && 852 < C || 2 === e2 && 592 < C) return 1;
2159
+ i[l = E & f] = k << 24 | x << 16 | c - s | 0;
2160
+ }
2161
+ }
2162
+ return 0 !== E && (i[c + E] = b - S << 24 | 64 << 16 | 0), o.bits = k, 0;
2163
+ };
2164
+ }, { "../utils/common": 41 }], 51: [function(e, t, r) {
2165
+ "use strict";
2166
+ 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" };
2167
+ }, {}], 52: [function(e, t, r) {
2168
+ "use strict";
2169
+ var i = e("../utils/common"), o = 0, h = 1;
2170
+ function n(e2) {
2171
+ for (var t2 = e2.length; 0 <= --t2; ) e2[t2] = 0;
2172
+ }
2173
+ 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));
2174
+ n(z);
2175
+ var C = new Array(2 * f);
2176
+ n(C);
2177
+ var E = new Array(512);
2178
+ n(E);
2179
+ var A = new Array(256);
2180
+ n(A);
2181
+ var I = new Array(a);
2182
+ n(I);
2183
+ var O, B, R, T = new Array(f);
2184
+ function D(e2, t2, r2, n2, i2) {
2185
+ 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;
2186
+ }
2187
+ function F(e2, t2) {
2188
+ this.dyn_tree = e2, this.max_code = 0, this.stat_desc = t2;
2189
+ }
2190
+ function N(e2) {
2191
+ return e2 < 256 ? E[e2] : E[256 + (e2 >>> 7)];
2192
+ }
2193
+ function U(e2, t2) {
2194
+ e2.pending_buf[e2.pending++] = 255 & t2, e2.pending_buf[e2.pending++] = t2 >>> 8 & 255;
2195
+ }
2196
+ function P(e2, t2, r2) {
2197
+ 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);
2198
+ }
2199
+ function L(e2, t2, r2) {
2200
+ P(e2, r2[2 * t2], r2[2 * t2 + 1]);
2201
+ }
2202
+ function j(e2, t2) {
2203
+ for (var r2 = 0; r2 |= 1 & e2, e2 >>>= 1, r2 <<= 1, 0 < --t2; ) ;
2204
+ return r2 >>> 1;
2205
+ }
2206
+ function Z(e2, t2, r2) {
2207
+ var n2, i2, s2 = new Array(g + 1), a2 = 0;
2208
+ for (n2 = 1; n2 <= g; n2++) s2[n2] = a2 = a2 + r2[n2 - 1] << 1;
2209
+ for (i2 = 0; i2 <= t2; i2++) {
2210
+ var o2 = e2[2 * i2 + 1];
2211
+ 0 !== o2 && (e2[2 * i2] = j(s2[o2]++, o2));
2212
+ }
2213
+ }
2214
+ function W(e2) {
2215
+ var t2;
2216
+ for (t2 = 0; t2 < l; t2++) e2.dyn_ltree[2 * t2] = 0;
2217
+ for (t2 = 0; t2 < f; t2++) e2.dyn_dtree[2 * t2] = 0;
2218
+ for (t2 = 0; t2 < c; t2++) e2.bl_tree[2 * t2] = 0;
2219
+ e2.dyn_ltree[2 * m] = 1, e2.opt_len = e2.static_len = 0, e2.last_lit = e2.matches = 0;
2220
+ }
2221
+ function M(e2) {
2222
+ 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;
2223
+ }
2224
+ function H(e2, t2, r2, n2) {
2225
+ var i2 = 2 * t2, s2 = 2 * r2;
2226
+ return e2[i2] < e2[s2] || e2[i2] === e2[s2] && n2[t2] <= n2[r2];
2227
+ }
2228
+ function G(e2, t2, r2) {
2229
+ 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;
2230
+ e2.heap[r2] = n2;
2231
+ }
2232
+ function K(e2, t2, r2) {
2233
+ var n2, i2, s2, a2, o2 = 0;
2234
+ 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; ) ;
2235
+ L(e2, m, t2);
2236
+ }
2237
+ function Y(e2, t2) {
2238
+ 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;
2239
+ 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;
2240
+ 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]);
2241
+ for (t2.max_code = u2, r2 = e2.heap_len >> 1; 1 <= r2; r2--) G(e2, s2, r2);
2242
+ 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; ) ;
2243
+ e2.heap[--e2.heap_max] = e2.heap[1], (function(e3, t3) {
2244
+ 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;
2245
+ for (s3 = 0; s3 <= g; s3++) e3.bl_count[s3] = 0;
2246
+ 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)));
2247
+ if (0 !== m2) {
2248
+ do {
2249
+ for (s3 = p2 - 1; 0 === e3.bl_count[s3]; ) s3--;
2250
+ e3.bl_count[s3]--, e3.bl_count[s3 + 1] += 2, e3.bl_count[p2]--, m2 -= 2;
2251
+ } while (0 < m2);
2252
+ 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--);
2253
+ }
2254
+ })(e2, t2), Z(s2, u2, e2.bl_count);
2255
+ }
2256
+ function X(e2, t2, r2) {
2257
+ var n2, i2, s2 = -1, a2 = t2[1], o2 = 0, h2 = 7, u2 = 4;
2258
+ 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));
2259
+ }
2260
+ function V(e2, t2, r2) {
2261
+ var n2, i2, s2 = -1, a2 = t2[1], o2 = 0, h2 = 7, u2 = 4;
2262
+ 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)) {
2263
+ if (o2 < u2) for (; L(e2, i2, e2.bl_tree), 0 != --o2; ) ;
2264
+ 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));
2265
+ s2 = i2, u2 = (o2 = 0) === a2 ? (h2 = 138, 3) : i2 === a2 ? (h2 = 6, 3) : (h2 = 7, 4);
2266
+ }
2267
+ }
2268
+ n(T);
2269
+ var q = false;
2270
+ function J(e2, t2, r2, n2) {
2271
+ P(e2, (s << 1) + (n2 ? 1 : 0), 3), (function(e3, t3, r3, n3) {
2272
+ M(e3), n3 && (U(e3, r3), U(e3, ~r3)), i.arraySet(e3.pending_buf, e3.window, t3, r3, e3.pending), e3.pending += r3;
2273
+ })(e2, t2, r2, true);
2274
+ }
2275
+ r._tr_init = function(e2) {
2276
+ q || ((function() {
2277
+ var e3, t2, r2, n2, i2, s2 = new Array(g + 1);
2278
+ for (n2 = r2 = 0; n2 < a - 1; n2++) for (I[n2] = r2, e3 = 0; e3 < 1 << w[n2]; e3++) A[r2++] = n2;
2279
+ 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;
2280
+ for (i2 >>= 7; n2 < f; n2++) for (T[n2] = i2 << 7, e3 = 0; e3 < 1 << k[n2] - 7; e3++) E[256 + i2++] = n2;
2281
+ for (t2 = 0; t2 <= g; t2++) s2[t2] = 0;
2282
+ for (e3 = 0; e3 <= 143; ) z[2 * e3 + 1] = 8, e3++, s2[8]++;
2283
+ for (; e3 <= 255; ) z[2 * e3 + 1] = 9, e3++, s2[9]++;
2284
+ for (; e3 <= 279; ) z[2 * e3 + 1] = 7, e3++, s2[7]++;
2285
+ for (; e3 <= 287; ) z[2 * e3 + 1] = 8, e3++, s2[8]++;
2286
+ for (Z(z, l + 1, s2), e3 = 0; e3 < f; e3++) C[2 * e3 + 1] = 5, C[2 * e3] = j(e3, 5);
2287
+ 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);
2288
+ })(), 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);
2289
+ }, r._tr_stored_block = J, r._tr_flush_block = function(e2, t2, r2, n2) {
2290
+ var i2, s2, a2 = 0;
2291
+ 0 < e2.level ? (2 === e2.strm.data_type && (e2.strm.data_type = (function(e3) {
2292
+ var t3, r3 = 4093624447;
2293
+ for (t3 = 0; t3 <= 31; t3++, r3 >>>= 1) if (1 & r3 && 0 !== e3.dyn_ltree[2 * t3]) return o;
2294
+ if (0 !== e3.dyn_ltree[18] || 0 !== e3.dyn_ltree[20] || 0 !== e3.dyn_ltree[26]) return h;
2295
+ for (t3 = 32; t3 < u; t3++) if (0 !== e3.dyn_ltree[2 * t3]) return h;
2296
+ return o;
2297
+ })(e2)), Y(e2, e2.l_desc), Y(e2, e2.d_desc), a2 = (function(e3) {
2298
+ var t3;
2299
+ 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--) ;
2300
+ return e3.opt_len += 3 * (t3 + 1) + 5 + 5 + 4, t3;
2301
+ })(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) {
2302
+ var i3;
2303
+ 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);
2304
+ V(e3, e3.dyn_ltree, t3 - 1), V(e3, e3.dyn_dtree, r3 - 1);
2305
+ })(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);
2306
+ }, r._tr_tally = function(e2, t2, r2) {
2307
+ 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;
2308
+ }, r._tr_align = function(e2) {
2309
+ P(e2, 2, 3), L(e2, m, z), (function(e3) {
2310
+ 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);
2311
+ })(e2);
2312
+ };
2313
+ }, { "../utils/common": 41 }], 53: [function(e, t, r) {
2314
+ "use strict";
2315
+ t.exports = function() {
2316
+ 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;
2317
+ };
2318
+ }, {}], 54: [function(e, t, r) {
2319
+ (function(e2) {
2320
+ !(function(r2, n) {
2321
+ "use strict";
2322
+ if (!r2.setImmediate) {
2323
+ var i, s, t2, a, o = 1, h = {}, u = false, l = r2.document, e3 = Object.getPrototypeOf && Object.getPrototypeOf(r2);
2324
+ e3 = e3 && e3.setTimeout ? e3 : r2, i = "[object process]" === {}.toString.call(r2.process) ? function(e4) {
2325
+ process.nextTick(function() {
2326
+ c(e4);
2327
+ });
2328
+ } : (function() {
2329
+ if (r2.postMessage && !r2.importScripts) {
2330
+ var e4 = true, t3 = r2.onmessage;
2331
+ return r2.onmessage = function() {
2332
+ e4 = false;
2333
+ }, r2.postMessage("", "*"), r2.onmessage = t3, e4;
2334
+ }
2335
+ })() ? (a = "setImmediate$" + Math.random() + "$", r2.addEventListener ? r2.addEventListener("message", d, false) : r2.attachEvent("onmessage", d), function(e4) {
2336
+ r2.postMessage(a + e4, "*");
2337
+ }) : r2.MessageChannel ? ((t2 = new MessageChannel()).port1.onmessage = function(e4) {
2338
+ c(e4.data);
2339
+ }, function(e4) {
2340
+ t2.port2.postMessage(e4);
2341
+ }) : l && "onreadystatechange" in l.createElement("script") ? (s = l.documentElement, function(e4) {
2342
+ var t3 = l.createElement("script");
2343
+ t3.onreadystatechange = function() {
2344
+ c(e4), t3.onreadystatechange = null, s.removeChild(t3), t3 = null;
2345
+ }, s.appendChild(t3);
2346
+ }) : function(e4) {
2347
+ setTimeout(c, 0, e4);
2348
+ }, e3.setImmediate = function(e4) {
2349
+ "function" != typeof e4 && (e4 = new Function("" + e4));
2350
+ for (var t3 = new Array(arguments.length - 1), r3 = 0; r3 < t3.length; r3++) t3[r3] = arguments[r3 + 1];
2351
+ var n2 = { callback: e4, args: t3 };
2352
+ return h[o] = n2, i(o), o++;
2353
+ }, e3.clearImmediate = f;
2354
+ }
2355
+ function f(e4) {
2356
+ delete h[e4];
2357
+ }
2358
+ function c(e4) {
2359
+ if (u) setTimeout(c, 0, e4);
2360
+ else {
2361
+ var t3 = h[e4];
2362
+ if (t3) {
2363
+ u = true;
2364
+ try {
2365
+ !(function(e5) {
2366
+ var t4 = e5.callback, r3 = e5.args;
2367
+ switch (r3.length) {
2368
+ case 0:
2369
+ t4();
2370
+ break;
2371
+ case 1:
2372
+ t4(r3[0]);
2373
+ break;
2374
+ case 2:
2375
+ t4(r3[0], r3[1]);
2376
+ break;
2377
+ case 3:
2378
+ t4(r3[0], r3[1], r3[2]);
2379
+ break;
2380
+ default:
2381
+ t4.apply(n, r3);
2382
+ }
2383
+ })(t3);
2384
+ } finally {
2385
+ f(e4), u = false;
2386
+ }
2387
+ }
2388
+ }
2389
+ }
2390
+ function d(e4) {
2391
+ e4.source === r2 && "string" == typeof e4.data && 0 === e4.data.indexOf(a) && c(+e4.data.slice(a.length));
2392
+ }
2393
+ })("undefined" == typeof self ? void 0 === e2 ? this : e2 : self);
2394
+ }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
2395
+ }, {}] }, {}, [10])(10);
2396
+ });
2397
+ }
2398
+ });
2399
+
2400
+ // src/xlsx/index.ts
2401
+ var xlsx_exports = {};
2402
+ __export(xlsx_exports, {
2403
+ DATA_VALIDATION_RESOURCE: () => DATA_VALIDATION_RESOURCE,
2404
+ PAGE_SETUP_RESOURCE: () => PAGE_SETUP_RESOURCE,
2405
+ RESOURCES_SHEET: () => RESOURCES_SHEET,
2406
+ TABLES_RESOURCE: () => TABLES_RESOURCE,
2407
+ THREAD_COMMENT_RESOURCE: () => THREAD_COMMENT_RESOURCE,
2408
+ XLSM_MIME: () => XLSM_MIME,
2409
+ XLSX_MIME: () => XLSX_MIME,
2410
+ XLSX_PASSTHROUGH_RESOURCE: () => XLSX_PASSTHROUGH_RESOURCE,
2411
+ applyDataValidationToXlsxWorksheet: () => applyDataValidationToXlsxWorksheet,
2412
+ applyPageSetupToXlsxWorksheet: () => applyPageSetupToXlsxWorksheet,
2413
+ applyPassthroughToXlsxBuffer: () => applyPassthroughToXlsxBuffer,
2414
+ applyTablesToXlsxWorksheet: () => applyTablesToXlsxWorksheet,
2415
+ capturePassthroughFromBuffer: () => capturePassthroughFromBuffer,
2416
+ commentBodyToString: () => commentBodyToString,
2417
+ excelStyleToUniver: () => excelStyleToUniver,
2418
+ extensionForPassthrough: () => extensionForPassthrough,
2419
+ mergeCommentsIntoResources: () => mergeCommentsIntoResources,
2420
+ mergeDataValidationIntoResources: () => mergeDataValidationIntoResources,
2421
+ mergePageSetupIntoResources: () => mergePageSetupIntoResources,
2422
+ mergePassthroughIntoResources: () => mergePassthroughIntoResources,
2423
+ mergeTablesIntoResources: () => mergeTablesIntoResources,
2424
+ mimeForPassthrough: () => mimeForPassthrough,
2425
+ readCommentsFromSnapshot: () => readCommentsFromSnapshot,
2426
+ readCommentsFromXlsx: () => readCommentsFromXlsx,
2427
+ readDataValidationFromSnapshot: () => readDataValidationFromSnapshot,
2428
+ readDataValidationFromXlsx: () => readDataValidationFromXlsx,
2429
+ readPageSetupFromSnapshot: () => readPageSetupFromSnapshot,
2430
+ readPageSetupFromXlsx: () => readPageSetupFromXlsx,
2431
+ readPassthroughFromSnapshot: () => readPassthroughFromSnapshot,
2432
+ readTablesFromSnapshot: () => readTablesFromSnapshot,
2433
+ readTablesFromXlsx: () => readTablesFromXlsx,
2434
+ refToRowCol: () => refToRowCol,
2435
+ univerStyleToExcel: () => univerStyleToExcel,
2436
+ xlsxToWorkbookData: () => xlsxToWorkbookData
2437
+ });
2438
+ module.exports = __toCommonJS(xlsx_exports);
2439
+
2440
+ // src/xlsx/_perf.ts
2441
+ async function timeItAsync(_label, fn) {
2442
+ return fn();
2443
+ }
2444
+
2445
+ // src/xlsx/parse-in-worker.ts
2446
+ var import_meta = {};
2447
+ var nextId = 0;
2448
+ var PARSE_TIMEOUT_MS = 18e4;
2449
+ function parseXlsxInWorker(buffer) {
2450
+ return new Promise((resolve, reject) => {
2451
+ const worker = new Worker(new URL('./parser.worker.js', import_meta.url), {
2452
+ type: "module",
2453
+ name: "xlsx-parser"
2454
+ });
2455
+ const id = ++nextId;
2456
+ let timeoutHandle = null;
2457
+ const cleanup = () => {
2458
+ if (timeoutHandle !== null) clearTimeout(timeoutHandle);
2459
+ worker.terminate();
2460
+ };
2461
+ timeoutHandle = setTimeout(() => {
2462
+ cleanup();
2463
+ reject(
2464
+ new Error(
2465
+ `xlsx parser worker timed out after ${Math.round(PARSE_TIMEOUT_MS / 1e3)}s. The workbook may be corrupted or too large to parse in this browser.`
2466
+ )
2467
+ );
2468
+ }, PARSE_TIMEOUT_MS);
2469
+ worker.addEventListener(
2470
+ "message",
2471
+ (e) => {
2472
+ const msg = e.data;
2473
+ if (msg.id !== id) return;
2474
+ cleanup();
2475
+ if (msg.ok) resolve(msg.data);
2476
+ else reject(new Error(msg.error));
2477
+ }
2478
+ );
2479
+ worker.addEventListener("error", (e) => {
2480
+ cleanup();
2481
+ const hasDetail = Boolean(e.message || e.filename);
2482
+ if (!hasDetail) {
2483
+ reject(
2484
+ new Error(
2485
+ "xlsx parser worker ran out of memory parsing this file. Try a smaller workbook or close other browser tabs."
2486
+ )
2487
+ );
2488
+ return;
2489
+ }
2490
+ const detail = e.message || `${e.filename ?? ""}:${e.lineno ?? ""}`;
2491
+ reject(
2492
+ new Error(
2493
+ `xlsx parser worker crashed (${detail}). The workbook may be too large for this browser to allocate.`
2494
+ )
2495
+ );
2496
+ });
2497
+ worker.addEventListener("messageerror", () => {
2498
+ cleanup();
2499
+ reject(new Error("xlsx parser worker returned an unserializable result."));
2500
+ });
2501
+ worker.postMessage({ id, buffer }, [buffer]);
2502
+ });
2503
+ }
2504
+
2505
+ // src/xlsx/import.ts
2506
+ async function xlsxToWorkbookData(buffer) {
2507
+ return timeItAsync("parse-xlsx", () => parseXlsxInWorker(buffer));
2508
+ }
2509
+
2510
+ // src/xlsx/style-mapping.ts
2511
+ var ARGB_RX = /^#?([0-9A-Fa-f]{6,8})$/;
2512
+ function normalizeColor(argb) {
2513
+ if (!argb) return void 0;
2514
+ const m = ARGB_RX.exec(argb);
2515
+ if (!m) return void 0;
2516
+ const hex = m[1];
2517
+ const rgb = hex.length === 8 ? hex.slice(2) : hex;
2518
+ return `#${rgb.toLowerCase()}`;
2519
+ }
2520
+ function toARGB(rgb) {
2521
+ if (typeof rgb !== "string" || !rgb) return void 0;
2522
+ const m = ARGB_RX.exec(rgb);
2523
+ if (!m) return void 0;
2524
+ const hex = m[1];
2525
+ const norm = hex.length === 8 ? hex : `FF${hex}`;
2526
+ return norm.toUpperCase();
2527
+ }
2528
+ var H_ALIGN_FROM_EXCEL = {
2529
+ left: 1,
2530
+ center: 2,
2531
+ right: 3
2532
+ };
2533
+ var H_ALIGN_TO_EXCEL = {
2534
+ 1: "left",
2535
+ 2: "center",
2536
+ 3: "right"
2537
+ };
2538
+ var V_ALIGN_FROM_EXCEL = {
2539
+ top: 1,
2540
+ middle: 2,
2541
+ bottom: 3
2542
+ };
2543
+ var V_ALIGN_TO_EXCEL = {
2544
+ 1: "top",
2545
+ 2: "middle",
2546
+ 3: "bottom"
2547
+ };
2548
+ function excelStyleToUniver(cell) {
2549
+ const s = {};
2550
+ if (cell.font) {
2551
+ if (cell.font.name) s.ff = cell.font.name;
2552
+ if (cell.font.size) s.fs = cell.font.size;
2553
+ if (cell.font.bold) s.bl = 1;
2554
+ if (cell.font.italic) s.it = 1;
2555
+ if (cell.font.underline) s.ul = { s: 1 };
2556
+ const fc = normalizeColor(cell.font.color?.argb);
2557
+ if (fc) s.cl = { rgb: fc };
2558
+ }
2559
+ if (cell.fill && cell.fill.type === "pattern" && cell.fill.pattern === "solid") {
2560
+ const bg = normalizeColor(cell.fill.fgColor?.argb);
2561
+ if (bg) s.bg = { rgb: bg };
2562
+ }
2563
+ if (cell.alignment) {
2564
+ const ha = cell.alignment.horizontal;
2565
+ if (ha && H_ALIGN_FROM_EXCEL[ha] !== void 0) s.ht = H_ALIGN_FROM_EXCEL[ha];
2566
+ const va = cell.alignment.vertical;
2567
+ if (va && V_ALIGN_FROM_EXCEL[va] !== void 0) s.vt = V_ALIGN_FROM_EXCEL[va];
2568
+ if (cell.alignment.wrapText) s.tb = 3;
2569
+ }
2570
+ if (cell.numFmt) s.n = { pattern: cell.numFmt };
2571
+ if (cell.border) {
2572
+ const bd = {};
2573
+ const sides = [
2574
+ ["t", "top"],
2575
+ ["b", "bottom"],
2576
+ ["l", "left"],
2577
+ ["r", "right"]
2578
+ ];
2579
+ for (const [k, key] of sides) {
2580
+ const side = cell.border[key];
2581
+ if (side?.style && side.style !== "none") {
2582
+ bd[k] = { s: 1, cl: { rgb: normalizeColor(side.color?.argb) ?? "#666666" } };
2583
+ }
2584
+ }
2585
+ if (Object.keys(bd).length > 0) s.bd = bd;
2586
+ }
2587
+ return Object.keys(s).length > 0 ? s : void 0;
2588
+ }
2589
+ function univerStyleToExcel(style) {
2590
+ const out = {};
2591
+ const font = {};
2592
+ if (style.ff) font.name = style.ff;
2593
+ if (style.fs) font.size = style.fs;
2594
+ if (style.bl === 1) font.bold = true;
2595
+ if (style.it === 1) font.italic = true;
2596
+ if (style.ul?.s === 1) font.underline = true;
2597
+ if (style.cl && typeof style.cl === "object" && "rgb" in style.cl) {
2598
+ const argb = toARGB(style.cl.rgb);
2599
+ if (argb) font.color = { argb };
2600
+ }
2601
+ if (Object.keys(font).length > 0) out.font = font;
2602
+ if (style.bg && typeof style.bg === "object" && "rgb" in style.bg) {
2603
+ const argb = toARGB(style.bg.rgb);
2604
+ if (argb) {
2605
+ out.fill = {
2606
+ type: "pattern",
2607
+ pattern: "solid",
2608
+ fgColor: { argb }
2609
+ };
2610
+ }
2611
+ }
2612
+ const alignment = {};
2613
+ if (style.ht && H_ALIGN_TO_EXCEL[style.ht]) {
2614
+ alignment.horizontal = H_ALIGN_TO_EXCEL[style.ht];
2615
+ }
2616
+ if (style.vt && V_ALIGN_TO_EXCEL[style.vt]) {
2617
+ alignment.vertical = V_ALIGN_TO_EXCEL[style.vt];
2618
+ }
2619
+ if (style.tb === 3) alignment.wrapText = true;
2620
+ if (Object.keys(alignment).length > 0) out.alignment = alignment;
2621
+ if (style.n?.pattern) out.numFmt = style.n.pattern;
2622
+ if (style.bd) {
2623
+ const border = {};
2624
+ const sides = [
2625
+ ["t", "top"],
2626
+ ["b", "bottom"],
2627
+ ["l", "left"],
2628
+ ["r", "right"]
2629
+ ];
2630
+ for (const [k, key] of sides) {
2631
+ const side = style.bd[k];
2632
+ if (!side) continue;
2633
+ const color = side.cl && "rgb" in side.cl ? toARGB(side.cl.rgb) : void 0;
2634
+ border[key] = {
2635
+ style: "thin",
2636
+ ...color ? { color: { argb: color } } : {}
2637
+ };
2638
+ }
2639
+ if (Object.keys(border).length > 0) out.border = border;
2640
+ }
2641
+ return out;
2642
+ }
2643
+
2644
+ // src/xlsx/constants.ts
2645
+ var RESOURCES_SHEET = "__casual_sheets_resources__";
2646
+
2647
+ // src/xlsx/comments-resource.ts
2648
+ var THREAD_COMMENT_RESOURCE = "SHEET_UNIVER_THREAD_COMMENT_PLUGIN";
2649
+ var PERSON_FROM_XLSX = "imported";
2650
+ function colToLetters(n) {
2651
+ let out = "";
2652
+ let v = n;
2653
+ while (v >= 0) {
2654
+ out = String.fromCharCode(65 + v % 26) + out;
2655
+ v = Math.floor(v / 26) - 1;
2656
+ }
2657
+ return out;
2658
+ }
2659
+ function refOf(row, column) {
2660
+ return `${colToLetters(column)}${row + 1}`;
2661
+ }
2662
+ function noteToString(note) {
2663
+ if (typeof note === "string") return note.trim() ? note : null;
2664
+ if (note && typeof note === "object") {
2665
+ const texts = note.texts;
2666
+ if (Array.isArray(texts)) {
2667
+ const joined = texts.map((t) => t?.text ?? "").join("");
2668
+ return joined.trim() ? joined : null;
2669
+ }
2670
+ }
2671
+ return null;
2672
+ }
2673
+ function readCommentsFromXlsx(wb, unitId, sheetIdForExcel) {
2674
+ const out = {};
2675
+ let seq = 0;
2676
+ const nowIso = (/* @__PURE__ */ new Date()).toISOString();
2677
+ for (const ws of wb.worksheets) {
2678
+ const subUnitId = sheetIdForExcel(ws.id);
2679
+ const bucket = [];
2680
+ ws.eachRow({ includeEmpty: false }, (row, rowNumber) => {
2681
+ row.eachCell({ includeEmpty: false }, (cell, colNumber) => {
2682
+ const note = cell.note;
2683
+ const text = noteToString(note);
2684
+ if (!text) return;
2685
+ const id = `xc-${unitId}-${seq++}`;
2686
+ bucket.push({
2687
+ id,
2688
+ threadId: id,
2689
+ // single-comment thread; thread id = root id
2690
+ ref: refOf(rowNumber - 1, colNumber - 1),
2691
+ dT: nowIso,
2692
+ personId: PERSON_FROM_XLSX,
2693
+ // Univer's body convention terminates with `\r\n` (one paragraph).
2694
+ // Without it the cursor in the panel jumps a column on first
2695
+ // open of the comment.
2696
+ text: { dataStream: `${text}\r
2697
+ ` },
2698
+ unitId,
2699
+ subUnitId,
2700
+ children: []
2701
+ });
2702
+ });
2703
+ });
2704
+ if (bucket.length > 0) out[subUnitId] = bucket;
2705
+ }
2706
+ return out;
2707
+ }
2708
+ function mergeCommentsIntoResources(resources, comments) {
2709
+ if (Object.keys(comments).length === 0) return resources;
2710
+ const existing = resources?.find((r) => r.name === THREAD_COMMENT_RESOURCE);
2711
+ if (existing) return resources;
2712
+ const next = [...resources ?? []];
2713
+ next.push({
2714
+ name: THREAD_COMMENT_RESOURCE,
2715
+ data: JSON.stringify(comments)
2716
+ });
2717
+ return next;
2718
+ }
2719
+ function readCommentsFromSnapshot(data) {
2720
+ const entry = data.resources?.find((r) => r.name === THREAD_COMMENT_RESOURCE);
2721
+ if (!entry?.data) return {};
2722
+ try {
2723
+ const parsed = JSON.parse(entry.data);
2724
+ if (!parsed || typeof parsed !== "object") return {};
2725
+ const out = {};
2726
+ for (const [sheetId, value] of Object.entries(parsed)) {
2727
+ if (!Array.isArray(value)) continue;
2728
+ const bucket = [];
2729
+ for (const c of value) {
2730
+ if (!c || typeof c !== "object") continue;
2731
+ const obj = c;
2732
+ const text = obj.text?.dataStream;
2733
+ const ref = typeof obj.ref === "string" ? obj.ref : null;
2734
+ if (!ref || typeof text !== "string") continue;
2735
+ bucket.push(c);
2736
+ }
2737
+ if (bucket.length > 0) out[sheetId] = bucket;
2738
+ }
2739
+ return out;
2740
+ } catch {
2741
+ return {};
2742
+ }
2743
+ }
2744
+ function commentBodyToString(body) {
2745
+ const s = body?.dataStream ?? "";
2746
+ return s.replace(/[\r\n]+$/, "");
2747
+ }
2748
+ function refToRowCol(ref) {
2749
+ const m = /^([A-Z]+)(\d+)$/.exec(ref);
2750
+ if (!m) return { row: -1, column: -1 };
2751
+ const letters = m[1];
2752
+ let col = 0;
2753
+ for (let i = 0; i < letters.length; i++) col = col * 26 + (letters.charCodeAt(i) - 64);
2754
+ return { row: Number(m[2]) - 1, column: col - 1 };
2755
+ }
2756
+
2757
+ // src/xlsx/page-setup-resource.ts
2758
+ var PAGE_SETUP_RESOURCE = "__casual_sheets_page_setup__";
2759
+ function isLandscape(o) {
2760
+ return o === "landscape";
2761
+ }
2762
+ var PAGE_SETUP_DEFAULTS = {
2763
+ orientation: "portrait",
2764
+ fitToPage: false,
2765
+ fitToWidth: 1,
2766
+ fitToHeight: 1,
2767
+ scale: 100
2768
+ };
2769
+ var MARGIN_DEFAULTS = {
2770
+ top: 0.75,
2771
+ bottom: 0.75,
2772
+ left: 0.7,
2773
+ right: 0.7,
2774
+ header: 0.3,
2775
+ footer: 0.3
2776
+ };
2777
+ function readPageSetupFromXlsx(wb, sheetIdForExcel) {
2778
+ const out = {};
2779
+ for (const ws of wb.worksheets) {
2780
+ const ps = ws.pageSetup;
2781
+ const hf = ws.headerFooter;
2782
+ const entry = {};
2783
+ if (ps && typeof ps === "object") {
2784
+ if (isLandscape(ps.orientation)) entry.orientation = "landscape";
2785
+ if (typeof ps.paperSize === "number") entry.paperSize = ps.paperSize;
2786
+ if (ps.fitToPage === true) entry.fitToPage = true;
2787
+ if (typeof ps.fitToWidth === "number" && ps.fitToWidth !== PAGE_SETUP_DEFAULTS.fitToWidth) {
2788
+ entry.fitToWidth = ps.fitToWidth;
2789
+ }
2790
+ if (typeof ps.fitToHeight === "number" && ps.fitToHeight !== PAGE_SETUP_DEFAULTS.fitToHeight) {
2791
+ entry.fitToHeight = ps.fitToHeight;
2792
+ }
2793
+ if (typeof ps.scale === "number" && ps.scale !== PAGE_SETUP_DEFAULTS.scale) {
2794
+ entry.scale = ps.scale;
2795
+ }
2796
+ if (typeof ps.printArea === "string") entry.printArea = ps.printArea;
2797
+ const margins = ps.margins;
2798
+ if (margins && typeof margins === "object") {
2799
+ const m = {};
2800
+ for (const k of ["top", "bottom", "left", "right", "header", "footer"]) {
2801
+ const v = margins[k];
2802
+ if (typeof v === "number" && v !== MARGIN_DEFAULTS[k]) m[k] = v;
2803
+ }
2804
+ if (Object.keys(m).length > 0) entry.margins = m;
2805
+ }
2806
+ }
2807
+ if (hf && typeof hf === "object") {
2808
+ const headerFooter = {};
2809
+ for (const k of ["oddHeader", "oddFooter", "evenHeader", "evenFooter"]) {
2810
+ const v = hf[k];
2811
+ if (typeof v === "string" && v.length > 0) headerFooter[k] = v;
2812
+ }
2813
+ if (hf.differentFirst === true) headerFooter.differentFirst = true;
2814
+ if (hf.differentOddEven === true) headerFooter.differentOddEven = true;
2815
+ if (Object.keys(headerFooter).length > 0) entry.headerFooter = headerFooter;
2816
+ }
2817
+ if (Object.keys(entry).length > 0) {
2818
+ out[sheetIdForExcel(ws.id)] = entry;
2819
+ }
2820
+ }
2821
+ return out;
2822
+ }
2823
+ function mergePageSetupIntoResources(resources, payload) {
2824
+ if (Object.keys(payload).length === 0) return resources;
2825
+ const existing = resources?.find((r) => r.name === PAGE_SETUP_RESOURCE);
2826
+ if (existing) return resources;
2827
+ const body = { v: 1, sheets: payload };
2828
+ const next = [...resources ?? []];
2829
+ next.push({ name: PAGE_SETUP_RESOURCE, data: JSON.stringify(body) });
2830
+ return next;
2831
+ }
2832
+ function readPageSetupFromSnapshot(data) {
2833
+ const entry = data.resources?.find((r) => r.name === PAGE_SETUP_RESOURCE);
2834
+ if (!entry?.data) return {};
2835
+ try {
2836
+ const parsed = JSON.parse(entry.data);
2837
+ if (parsed?.v !== 1 || !parsed.sheets) return {};
2838
+ return parsed.sheets;
2839
+ } catch {
2840
+ return {};
2841
+ }
2842
+ }
2843
+ function applyPageSetupToXlsxWorksheet(ws, entry) {
2844
+ if (!entry) return;
2845
+ ws.pageSetup = ws.pageSetup ?? {};
2846
+ if (entry.orientation) ws.pageSetup.orientation = entry.orientation;
2847
+ if (typeof entry.paperSize === "number") ws.pageSetup.paperSize = entry.paperSize;
2848
+ if (typeof entry.fitToPage === "boolean") ws.pageSetup.fitToPage = entry.fitToPage;
2849
+ if (typeof entry.fitToWidth === "number") ws.pageSetup.fitToWidth = entry.fitToWidth;
2850
+ if (typeof entry.fitToHeight === "number") ws.pageSetup.fitToHeight = entry.fitToHeight;
2851
+ if (typeof entry.scale === "number") ws.pageSetup.scale = entry.scale;
2852
+ if (typeof entry.printArea === "string") ws.pageSetup.printArea = entry.printArea;
2853
+ if (entry.margins) {
2854
+ ws.pageSetup.margins = { ...ws.pageSetup.margins ?? {}, ...entry.margins };
2855
+ }
2856
+ if (entry.headerFooter) {
2857
+ ws.headerFooter = ws.headerFooter ?? {};
2858
+ for (const k of ["oddHeader", "oddFooter", "evenHeader", "evenFooter"]) {
2859
+ const v = entry.headerFooter[k];
2860
+ if (typeof v === "string") ws.headerFooter[k] = v;
2861
+ }
2862
+ if (typeof entry.headerFooter.differentFirst === "boolean") {
2863
+ ws.headerFooter.differentFirst = entry.headerFooter.differentFirst;
2864
+ }
2865
+ if (typeof entry.headerFooter.differentOddEven === "boolean") {
2866
+ ws.headerFooter.differentOddEven = entry.headerFooter.differentOddEven;
2867
+ }
2868
+ }
2869
+ }
2870
+
2871
+ // src/xlsx/data-validation-resource.ts
2872
+ var DATA_VALIDATION_RESOURCE = "SHEET_DATA_VALIDATION_PLUGIN";
2873
+ function lettersToCol(letters) {
2874
+ let col = 0;
2875
+ for (let i = 0; i < letters.length; i++) col = col * 26 + (letters.charCodeAt(i) - 64);
2876
+ return col - 1;
2877
+ }
2878
+ function colToLetters2(n) {
2879
+ let out = "";
2880
+ let v = n;
2881
+ while (v >= 0) {
2882
+ out = String.fromCharCode(65 + v % 26) + out;
2883
+ v = Math.floor(v / 26) - 1;
2884
+ }
2885
+ return out;
2886
+ }
2887
+ function rangeStrToIRange(s) {
2888
+ const part = s.includes("!") ? s.split("!").pop() ?? s : s;
2889
+ const m = /^\$?([A-Z]+)\$?(\d+)(?::\$?([A-Z]+)\$?(\d+))?$/.exec(part.trim());
2890
+ if (!m) return null;
2891
+ const c0 = lettersToCol(m[1]);
2892
+ const r0 = Number(m[2]) - 1;
2893
+ const c1 = m[3] ? lettersToCol(m[3]) : c0;
2894
+ const r1 = m[4] ? Number(m[4]) - 1 : r0;
2895
+ return { startRow: r0, endRow: r1, startColumn: c0, endColumn: c1 };
2896
+ }
2897
+ function iRangeToStr(r) {
2898
+ const a = `${colToLetters2(r.startColumn)}${r.startRow + 1}`;
2899
+ const b = `${colToLetters2(r.endColumn)}${r.endRow + 1}`;
2900
+ return a === b ? a : `${a}:${b}`;
2901
+ }
2902
+ function readDataValidationFromXlsx(wb, sheetIdForExcel) {
2903
+ const out = {};
2904
+ let seq = 0;
2905
+ for (const ws of wb.worksheets) {
2906
+ const dv = ws.dataValidations;
2907
+ const model = dv?.model;
2908
+ if (!model || typeof model !== "object") continue;
2909
+ const rules = [];
2910
+ for (const [rangeStr, specUnknown] of Object.entries(model)) {
2911
+ const spec = specUnknown;
2912
+ if (!spec || typeof spec !== "object") continue;
2913
+ const ranges = [];
2914
+ for (const piece of rangeStr.split(/[\s,]+/)) {
2915
+ const r = rangeStrToIRange(piece);
2916
+ if (r) ranges.push(r);
2917
+ }
2918
+ if (ranges.length === 0) continue;
2919
+ const formulae = Array.isArray(spec.formulae) ? spec.formulae : void 0;
2920
+ const rule = {
2921
+ uid: `dv-${seq++}`,
2922
+ type: typeof spec.type === "string" ? spec.type : "any",
2923
+ ranges,
2924
+ ...typeof formulae?.[0] === "string" ? { formula1: formulae[0] } : {},
2925
+ ...typeof formulae?.[1] === "string" ? { formula2: formulae[1] } : {},
2926
+ ...typeof spec.operator === "string" ? { operator: spec.operator } : {},
2927
+ ...typeof spec.allowBlank === "boolean" ? { allowBlank: spec.allowBlank } : {},
2928
+ ...typeof spec.error === "string" ? { error: spec.error } : {},
2929
+ ...typeof spec.errorTitle === "string" ? { errorTitle: spec.errorTitle } : {},
2930
+ ...typeof spec.showErrorMessage === "boolean" ? { showErrorMessage: spec.showErrorMessage } : {},
2931
+ ...typeof spec.errorStyle === "string" ? { errorStyle: spec.errorStyle } : {},
2932
+ ...typeof spec.prompt === "string" ? { prompt: spec.prompt } : {},
2933
+ ...typeof spec.promptTitle === "string" ? { promptTitle: spec.promptTitle } : {},
2934
+ ...typeof spec.showInputMessage === "boolean" ? { showInputMessage: spec.showInputMessage } : {}
2935
+ };
2936
+ rules.push(rule);
2937
+ }
2938
+ if (rules.length > 0) out[sheetIdForExcel(ws.id)] = rules;
2939
+ }
2940
+ return out;
2941
+ }
2942
+ function mergeDataValidationIntoResources(resources, payload) {
2943
+ if (Object.keys(payload).length === 0) return resources;
2944
+ const existing = resources?.find((r) => r.name === DATA_VALIDATION_RESOURCE);
2945
+ if (existing) return resources;
2946
+ const next = [...resources ?? []];
2947
+ next.push({ name: DATA_VALIDATION_RESOURCE, data: JSON.stringify(payload) });
2948
+ return next;
2949
+ }
2950
+ function readDataValidationFromSnapshot(data) {
2951
+ const entry = data.resources?.find((r) => r.name === DATA_VALIDATION_RESOURCE);
2952
+ if (!entry?.data) return {};
2953
+ try {
2954
+ const parsed = JSON.parse(entry.data);
2955
+ if (!parsed || typeof parsed !== "object") return {};
2956
+ const out = {};
2957
+ for (const [sheetId, value] of Object.entries(parsed)) {
2958
+ if (!Array.isArray(value)) continue;
2959
+ const bucket = [];
2960
+ for (const r of value) {
2961
+ if (!r || typeof r !== "object") continue;
2962
+ const obj = r;
2963
+ if (!Array.isArray(obj.ranges) || typeof obj.type !== "string") continue;
2964
+ bucket.push(r);
2965
+ }
2966
+ if (bucket.length > 0) out[sheetId] = bucket;
2967
+ }
2968
+ return out;
2969
+ } catch {
2970
+ return {};
2971
+ }
2972
+ }
2973
+ function applyDataValidationToXlsxWorksheet(ws, rules) {
2974
+ if (!rules?.length) return;
2975
+ for (const rule of rules) {
2976
+ const formulae = [];
2977
+ if (rule.formula1 !== void 0) formulae.push(rule.formula1);
2978
+ if (rule.formula2 !== void 0) formulae.push(rule.formula2);
2979
+ const spec = {
2980
+ type: rule.type,
2981
+ ...formulae.length ? { formulae } : {},
2982
+ ...rule.operator ? { operator: rule.operator } : {},
2983
+ ...rule.allowBlank !== void 0 ? { allowBlank: rule.allowBlank } : {},
2984
+ ...rule.error !== void 0 ? { error: rule.error } : {},
2985
+ ...rule.errorTitle !== void 0 ? { errorTitle: rule.errorTitle } : {},
2986
+ ...rule.showErrorMessage !== void 0 ? { showErrorMessage: rule.showErrorMessage } : {},
2987
+ ...rule.errorStyle !== void 0 ? { errorStyle: rule.errorStyle } : {},
2988
+ ...rule.prompt !== void 0 ? { prompt: rule.prompt } : {},
2989
+ ...rule.promptTitle !== void 0 ? { promptTitle: rule.promptTitle } : {},
2990
+ ...rule.showInputMessage !== void 0 ? { showInputMessage: rule.showInputMessage } : {}
2991
+ };
2992
+ for (const range of rule.ranges) {
2993
+ try {
2994
+ ws.dataValidations.add(iRangeToStr(range), spec);
2995
+ } catch {
2996
+ }
2997
+ }
2998
+ }
2999
+ }
3000
+
3001
+ // src/xlsx/tables-resource.ts
3002
+ var TABLES_RESOURCE = "__casual_sheets_tables__";
3003
+ function readTablesFromXlsx(wb, sheetIdForExcel) {
3004
+ const out = {};
3005
+ for (const ws of wb.worksheets) {
3006
+ const tableMap = ws.tables;
3007
+ if (!tableMap) continue;
3008
+ const entries = tableMap instanceof Map ? Array.from(tableMap.values()) : Object.values(tableMap);
3009
+ if (entries.length === 0) continue;
3010
+ const tables = [];
3011
+ for (const tUnknown of entries) {
3012
+ const tInstance = tUnknown;
3013
+ const modelUnknown = tInstance && typeof tInstance === "object" && "model" in tInstance ? tInstance.model : tUnknown;
3014
+ const model = modelUnknown;
3015
+ if (!model || typeof model !== "object") continue;
3016
+ const name = model.name;
3017
+ const refStr = typeof model.tableRef === "string" ? model.tableRef : typeof model.ref === "string" ? model.ref : null;
3018
+ if (typeof name !== "string" || !refStr) continue;
3019
+ const cols = Array.isArray(model.columns) ? model.columns.map((cUnknown) => {
3020
+ const c = cUnknown;
3021
+ return {
3022
+ name: typeof c?.name === "string" ? c.name : "",
3023
+ ...typeof c?.filterButton === "boolean" ? { filterButton: c.filterButton } : {},
3024
+ ...typeof c?.totalsRowFunction === "string" ? { totalsRowFunction: c.totalsRowFunction } : {},
3025
+ ...typeof c?.totalsRowLabel === "string" ? { totalsRowLabel: c.totalsRowLabel } : {},
3026
+ ...typeof c?.totalsRowFormula === "string" ? { totalsRowFormula: c.totalsRowFormula } : {}
3027
+ };
3028
+ }) : [];
3029
+ tables.push({
3030
+ name,
3031
+ ref: refStr,
3032
+ ...typeof model.displayName === "string" ? { displayName: model.displayName } : {},
3033
+ ...typeof model.headerRow === "boolean" ? { headerRow: model.headerRow } : {},
3034
+ ...typeof model.totalsRow === "boolean" ? { totalsRow: model.totalsRow } : {},
3035
+ ...model.style && typeof model.style === "object" ? { style: model.style } : {},
3036
+ columns: cols,
3037
+ rows: []
3038
+ });
3039
+ }
3040
+ if (tables.length > 0) out[sheetIdForExcel(ws.id)] = tables;
3041
+ }
3042
+ return out;
3043
+ }
3044
+ function mergeTablesIntoResources(resources, payload) {
3045
+ if (Object.keys(payload).length === 0) return resources;
3046
+ const existing = resources?.find((r) => r.name === TABLES_RESOURCE);
3047
+ if (existing) return resources;
3048
+ const body = { v: 1, sheets: payload };
3049
+ const next = [...resources ?? []];
3050
+ next.push({ name: TABLES_RESOURCE, data: JSON.stringify(body) });
3051
+ return next;
3052
+ }
3053
+ function readTablesFromSnapshot(data) {
3054
+ const entry = data.resources?.find((r) => r.name === TABLES_RESOURCE);
3055
+ if (!entry?.data) return {};
3056
+ try {
3057
+ const parsed = JSON.parse(entry.data);
3058
+ if (parsed?.v !== 1 || !parsed.sheets) return {};
3059
+ return parsed.sheets;
3060
+ } catch {
3061
+ return {};
3062
+ }
3063
+ }
3064
+ function applyTablesToXlsxWorksheet(ws, tables) {
3065
+ if (!tables?.length) return;
3066
+ ws.tables = ws.tables ?? {};
3067
+ for (const t of tables) {
3068
+ if (!t?.name || !t?.ref || !Array.isArray(t.columns) || t.columns.length === 0) continue;
3069
+ const model = {
3070
+ name: t.name,
3071
+ displayName: t.displayName ?? t.name,
3072
+ tableRef: t.ref,
3073
+ autoFilterRef: t.ref,
3074
+ headerRow: t.headerRow ?? true,
3075
+ totalsRow: t.totalsRow ?? false,
3076
+ columns: t.columns.map((c) => ({
3077
+ name: c.name,
3078
+ ...c.filterButton !== void 0 ? { filterButton: c.filterButton } : {},
3079
+ ...c.totalsRowFunction ? { totalsRowFunction: c.totalsRowFunction } : {},
3080
+ ...c.totalsRowLabel ? { totalsRowLabel: c.totalsRowLabel } : {},
3081
+ ...c.totalsRowFormula ? { totalsRowFormula: c.totalsRowFormula } : {}
3082
+ })),
3083
+ style: t.style ?? {}
3084
+ };
3085
+ ws.tables[t.name] = { model };
3086
+ }
3087
+ }
3088
+
3089
+ // src/xlsx/passthrough-resource.ts
3090
+ var import_jszip2 = __toESM(require_jszip_min(), 1);
3091
+
3092
+ // src/xlsx/pivot-passthrough.ts
3093
+ var import_jszip = __toESM(require_jszip_min(), 1);
3094
+ var REL_TYPE_PIVOT_CACHE_DEF = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition";
3095
+ var REL_TYPE_PIVOT_TABLE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable";
3096
+ var CT_PIVOT_CACHE_DEF = "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml";
3097
+ var CT_PIVOT_CACHE_REC = "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml";
3098
+ var CT_PIVOT_TABLE = "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml";
3099
+ function extractRid(xml) {
3100
+ const m = xml.match(/r:id="([^"]+)"/i) ?? xml.match(/r:Id="([^"]+)"/i);
3101
+ return m ? m[1] : null;
3102
+ }
3103
+ function parseRelationships(xml) {
3104
+ const out = [];
3105
+ for (const m of xml.matchAll(/<Relationship\b[^>]*\/>/g)) {
3106
+ const tag = m[0];
3107
+ const id = tag.match(/Id="([^"]+)"/)?.[1];
3108
+ const type = tag.match(/Type="([^"]+)"/)?.[1];
3109
+ const target = tag.match(/Target="([^"]+)"/)?.[1];
3110
+ if (id && type && target) out.push({ id, type, target });
3111
+ }
3112
+ return out;
3113
+ }
3114
+ function nextRidIssuer(used) {
3115
+ return () => {
3116
+ let n = 1;
3117
+ while (used.has(n)) n++;
3118
+ used.add(n);
3119
+ return `rId${n}`;
3120
+ };
3121
+ }
3122
+ async function capturePivotsFromBuffer(buffer) {
3123
+ let zip;
3124
+ try {
3125
+ zip = await import_jszip.default.loadAsync(buffer);
3126
+ } catch {
3127
+ return void 0;
3128
+ }
3129
+ const hasPivots = Object.keys(zip.files).some(
3130
+ (p) => p.startsWith("xl/pivotCaches/") || p.startsWith("xl/pivotTables/")
3131
+ );
3132
+ if (!hasPivots) return void 0;
3133
+ const parts = {};
3134
+ for (const [path, file] of Object.entries(zip.files)) {
3135
+ if (file.dir) continue;
3136
+ if (path.startsWith("xl/pivotCaches/") || path.startsWith("xl/pivotTables/")) {
3137
+ parts[path] = await file.async("base64");
3138
+ }
3139
+ }
3140
+ const workbookXmlEntry = zip.file("xl/workbook.xml");
3141
+ if (!workbookXmlEntry) return void 0;
3142
+ const workbookXml = await workbookXmlEntry.async("string");
3143
+ const pivotCachesMatch = workbookXml.match(/<pivotCaches\b[^>]*>[\s\S]*?<\/pivotCaches>/);
3144
+ if (!pivotCachesMatch) return void 0;
3145
+ const workbookPivotCachesXml = pivotCachesMatch[0];
3146
+ const workbookRelsEntry = zip.file("xl/_rels/workbook.xml.rels");
3147
+ if (!workbookRelsEntry) return void 0;
3148
+ const workbookRelsXml = await workbookRelsEntry.async("string");
3149
+ const workbookCacheRels = parseRelationships(workbookRelsXml).filter((r) => r.type === REL_TYPE_PIVOT_CACHE_DEF).map((r) => ({ origId: r.id, target: r.target }));
3150
+ const sheetEntries = [];
3151
+ for (const m of workbookXml.matchAll(/<sheet\b[^>]*\/>/g)) {
3152
+ const tag = m[0];
3153
+ const name = tag.match(/name="([^"]+)"/)?.[1];
3154
+ const rId = tag.match(/r:id="([^"]+)"/i)?.[1] ?? tag.match(/r:Id="([^"]+)"/)?.[1];
3155
+ if (!name || !rId) continue;
3156
+ const rel = parseRelationships(workbookRelsXml).find((r) => r.id === rId);
3157
+ if (!rel) continue;
3158
+ sheetEntries.push({ name, rId, targetPath: rel.target });
3159
+ }
3160
+ const perSheet = [];
3161
+ for (const sheet of sheetEntries) {
3162
+ const fileName = sheet.targetPath.split("/").pop();
3163
+ const sheetRelsPath = `xl/worksheets/_rels/${fileName}.rels`;
3164
+ const sheetRelsEntry = zip.file(sheetRelsPath);
3165
+ if (!sheetRelsEntry) continue;
3166
+ const sheetRelsXml = await sheetRelsEntry.async("string");
3167
+ const pivotTableRels = parseRelationships(sheetRelsXml).filter((r) => r.type === REL_TYPE_PIVOT_TABLE).map((r) => ({ origId: r.id, target: r.target }));
3168
+ if (pivotTableRels.length > 0) {
3169
+ perSheet.push({ sheetName: sheet.name, pivotTableRels });
3170
+ }
3171
+ }
3172
+ if (Object.keys(parts).length === 0 || workbookCacheRels.length === 0) {
3173
+ return void 0;
3174
+ }
3175
+ return {
3176
+ parts,
3177
+ workbookPivotCachesXml,
3178
+ workbookCacheRels,
3179
+ perSheet
3180
+ };
3181
+ }
3182
+ async function applyPivotsToZip(zip, payload) {
3183
+ for (const [path, base64] of Object.entries(payload.parts)) {
3184
+ zip.file(path, base64, { base64: true });
3185
+ }
3186
+ const ctEntry = zip.file("[Content_Types].xml");
3187
+ if (ctEntry) {
3188
+ let ct = await ctEntry.async("string");
3189
+ const inserts = [];
3190
+ for (const path of Object.keys(payload.parts)) {
3191
+ if (path.endsWith(".rels")) continue;
3192
+ const partName = `/${path}`;
3193
+ if (ct.includes(`PartName="${partName}"`)) continue;
3194
+ let contentType;
3195
+ if (/pivotCacheDefinition\d+\.xml$/.test(path)) contentType = CT_PIVOT_CACHE_DEF;
3196
+ else if (/pivotCacheRecords\d+\.xml$/.test(path)) contentType = CT_PIVOT_CACHE_REC;
3197
+ else if (/pivotTable\d+\.xml$/.test(path)) contentType = CT_PIVOT_TABLE;
3198
+ else continue;
3199
+ inserts.push(`<Override PartName="${partName}" ContentType="${contentType}"/>`);
3200
+ }
3201
+ if (inserts.length > 0) {
3202
+ ct = ct.replace("</Types>", `${inserts.join("")}</Types>`);
3203
+ zip.file("[Content_Types].xml", ct);
3204
+ }
3205
+ }
3206
+ const workbookRelsPath = "xl/_rels/workbook.xml.rels";
3207
+ const workbookRelsEntry = zip.file(workbookRelsPath);
3208
+ const cacheIdRemap = /* @__PURE__ */ new Map();
3209
+ if (workbookRelsEntry && payload.workbookCacheRels.length > 0) {
3210
+ let rels = await workbookRelsEntry.async("string");
3211
+ const used = /* @__PURE__ */ new Set();
3212
+ for (const m of rels.matchAll(/Id="rId(\d+)"/g)) used.add(Number(m[1]));
3213
+ const assign = nextRidIssuer(used);
3214
+ const additions = [];
3215
+ for (const r of payload.workbookCacheRels) {
3216
+ const newId = assign();
3217
+ cacheIdRemap.set(r.origId, newId);
3218
+ additions.push(
3219
+ `<Relationship Id="${newId}" Type="${REL_TYPE_PIVOT_CACHE_DEF}" Target="${r.target}"/>`
3220
+ );
3221
+ }
3222
+ rels = rels.replace("</Relationships>", `${additions.join("")}</Relationships>`);
3223
+ zip.file(workbookRelsPath, rels);
3224
+ }
3225
+ const workbookXmlEntry = zip.file("xl/workbook.xml");
3226
+ if (workbookXmlEntry && payload.workbookPivotCachesXml) {
3227
+ let workbookXml = await workbookXmlEntry.async("string");
3228
+ let snippet = payload.workbookPivotCachesXml;
3229
+ for (const [origId, newId] of cacheIdRemap) {
3230
+ snippet = snippet.replaceAll(`"${origId}"`, `"${newId}"`);
3231
+ }
3232
+ if (!workbookXml.includes("<pivotCaches")) {
3233
+ workbookXml = workbookXml.replace("</sheets>", `</sheets>${snippet}`);
3234
+ zip.file("xl/workbook.xml", workbookXml);
3235
+ }
3236
+ }
3237
+ if (workbookXmlEntry && payload.perSheet.length > 0) {
3238
+ const workbookXml = await workbookXmlEntry.async("string");
3239
+ const workbookRels = workbookRelsEntry ? parseRelationships(await zip.file(workbookRelsPath).async("string")) : [];
3240
+ const sheetByName = /* @__PURE__ */ new Map();
3241
+ for (const m of workbookXml.matchAll(/<sheet\b[^>]*\/>/g)) {
3242
+ const tag = m[0];
3243
+ const name = tag.match(/name="([^"]+)"/)?.[1];
3244
+ const rId = tag.match(/r:id="([^"]+)"/i)?.[1] ?? tag.match(/r:Id="([^"]+)"/)?.[1];
3245
+ if (!name || !rId) continue;
3246
+ const rel = workbookRels.find((r) => r.id === rId);
3247
+ if (!rel) continue;
3248
+ sheetByName.set(name, rel.target);
3249
+ }
3250
+ for (const sheet of payload.perSheet) {
3251
+ const targetPath = sheetByName.get(sheet.sheetName);
3252
+ if (!targetPath) continue;
3253
+ const fileName = targetPath.split("/").pop();
3254
+ const sheetRelsPath = `xl/worksheets/_rels/${fileName}.rels`;
3255
+ let sheetRels = await zip.file(sheetRelsPath)?.async("string") ?? `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
3256
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>`;
3257
+ const used = /* @__PURE__ */ new Set();
3258
+ for (const m of sheetRels.matchAll(/Id="rId(\d+)"/g)) used.add(Number(m[1]));
3259
+ const assign = nextRidIssuer(used);
3260
+ const additions = [];
3261
+ for (const r of sheet.pivotTableRels) {
3262
+ const newId = assign();
3263
+ additions.push(
3264
+ `<Relationship Id="${newId}" Type="${REL_TYPE_PIVOT_TABLE}" Target="${r.target}"/>`
3265
+ );
3266
+ }
3267
+ if (sheetRels.includes("</Relationships>")) {
3268
+ sheetRels = sheetRels.replace(
3269
+ "</Relationships>",
3270
+ `${additions.join("")}</Relationships>`
3271
+ );
3272
+ } else {
3273
+ sheetRels += `
3274
+ ${additions.join("")}`;
3275
+ }
3276
+ zip.file(sheetRelsPath, sheetRels);
3277
+ }
3278
+ }
3279
+ void extractRid;
3280
+ }
3281
+
3282
+ // src/xlsx/passthrough-resource.ts
3283
+ var XLSX_PASSTHROUGH_RESOURCE = "__casual_sheets_xlsx_passthrough__";
3284
+ var VBA_REL_TYPE = "http://schemas.microsoft.com/office/2006/relationships/vbaProject";
3285
+ var VBA_CONTENT_TYPE = "application/vnd.ms-office.vbaProject";
3286
+ var XLSX_MIME = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
3287
+ var XLSM_MIME = "application/vnd.ms-excel.sheet.macroEnabled.12";
3288
+ function mimeForPassthrough(payload) {
3289
+ return payload?.vba ? XLSM_MIME : XLSX_MIME;
3290
+ }
3291
+ function extensionForPassthrough(payload) {
3292
+ return payload?.vba ? "xlsm" : "xlsx";
3293
+ }
3294
+ async function capturePassthroughFromBuffer(buffer) {
3295
+ let vba;
3296
+ try {
3297
+ const zip = await import_jszip2.default.loadAsync(buffer);
3298
+ const vbaFile = zip.file("xl/vbaProject.bin");
3299
+ if (vbaFile) {
3300
+ vba = { binBase64: await vbaFile.async("base64") };
3301
+ }
3302
+ } catch {
3303
+ return void 0;
3304
+ }
3305
+ const pivots = await capturePivotsFromBuffer(buffer);
3306
+ if (!vba && !pivots) return void 0;
3307
+ return { vba, pivots };
3308
+ }
3309
+ function mergePassthroughIntoResources(resources, payload) {
3310
+ if (!payload) return resources;
3311
+ const filtered = (resources ?? []).filter(
3312
+ (r) => r.name !== XLSX_PASSTHROUGH_RESOURCE
3313
+ );
3314
+ return [
3315
+ ...filtered,
3316
+ { name: XLSX_PASSTHROUGH_RESOURCE, data: JSON.stringify(payload) }
3317
+ ];
3318
+ }
3319
+ function readPassthroughFromSnapshot(data) {
3320
+ const entry = data.resources?.find(
3321
+ (r) => r.name === XLSX_PASSTHROUGH_RESOURCE
3322
+ );
3323
+ if (!entry?.data) return void 0;
3324
+ try {
3325
+ return JSON.parse(entry.data);
3326
+ } catch {
3327
+ return void 0;
3328
+ }
3329
+ }
3330
+ var REL_TYPE_REGEX_ESCAPE = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3331
+ async function applyPassthroughToXlsxBuffer(excelJsBuffer, payload) {
3332
+ if (!payload?.vba && !payload?.pivots) {
3333
+ if (excelJsBuffer instanceof ArrayBuffer) return excelJsBuffer;
3334
+ return excelJsBuffer.buffer.slice(
3335
+ excelJsBuffer.byteOffset,
3336
+ excelJsBuffer.byteOffset + excelJsBuffer.byteLength
3337
+ );
3338
+ }
3339
+ const zip = await import_jszip2.default.loadAsync(excelJsBuffer);
3340
+ if (payload.vba) await applyVbaToZip(zip, payload.vba);
3341
+ if (payload.pivots) await applyPivotsToZip(zip, payload.pivots);
3342
+ return zip.generateAsync({ type: "arraybuffer" });
3343
+ }
3344
+ async function applyVbaToZip(zip, vba) {
3345
+ zip.file("xl/vbaProject.bin", vba.binBase64, { base64: true });
3346
+ const ctEntry = zip.file("[Content_Types].xml");
3347
+ if (ctEntry) {
3348
+ let ct = await ctEntry.async("string");
3349
+ if (!/PartName="\/xl\/vbaProject\.bin"/i.test(ct)) {
3350
+ const override = `<Override PartName="/xl/vbaProject.bin" ContentType="${VBA_CONTENT_TYPE}"/>`;
3351
+ ct = ct.replace("</Types>", `${override}</Types>`);
3352
+ zip.file("[Content_Types].xml", ct);
3353
+ }
3354
+ }
3355
+ const relsPath = "xl/_rels/workbook.xml.rels";
3356
+ const relsEntry = zip.file(relsPath);
3357
+ if (relsEntry) {
3358
+ let rels = await relsEntry.async("string");
3359
+ const vbaRelTypeRegex = new RegExp(
3360
+ `Type="${REL_TYPE_REGEX_ESCAPE(VBA_REL_TYPE)}"`
3361
+ );
3362
+ if (!vbaRelTypeRegex.test(rels)) {
3363
+ const used = /* @__PURE__ */ new Set();
3364
+ for (const m of rels.matchAll(/Id="rId(\d+)"/g)) used.add(Number(m[1]));
3365
+ let next = 1;
3366
+ while (used.has(next)) next++;
3367
+ const rel = `<Relationship Id="rId${next}" Type="${VBA_REL_TYPE}" Target="vbaProject.bin"/>`;
3368
+ rels = rels.replace("</Relationships>", `${rel}</Relationships>`);
3369
+ zip.file(relsPath, rels);
3370
+ }
3371
+ }
3372
+ }
3373
+ /*! Bundled license information:
3374
+
3375
+ jszip/dist/jszip.min.js:
3376
+ (*!
3377
+
3378
+ JSZip v3.10.1 - A JavaScript class for generating and reading zip files
3379
+ <http://stuartk.com/jszip>
3380
+
3381
+ (c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
3382
+ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
3383
+
3384
+ JSZip uses the library pako released under the MIT license :
3385
+ https://github.com/nodeca/pako/blob/main/LICENSE
3386
+ *)
3387
+ */
3388
+ //# sourceMappingURL=xlsx.cjs.map