@pretextbook/import 0.0.1 → 0.3.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.
@@ -1,3862 +0,0 @@
1
- import { formatPretext as me } from "@pretextbook/format";
2
- import { latexToPretext as ge } from "@pretextbook/latex-pretext";
3
- import { markdownToPretext as _e } from "@pretextbook/remark-pretext";
4
- const be = [
5
- "\\documentclass",
6
- "\\begin{document}",
7
- "\\begin{",
8
- "\\section",
9
- "\\chapter",
10
- "\\title",
11
- "\\author"
12
- ], ye = ["# ", "## ", "### ", "#### "];
13
- function ie(d) {
14
- const c = d.trim();
15
- return !c || c.startsWith("<") ? "pretext" : be.some((e) => c.includes(e)) ? "latex" : ye.some((e) => c.startsWith(e)) ? "markdown" : "pretext";
16
- }
17
- const ve = [
18
- {
19
- kind: "presentation",
20
- category: "latex_fonts",
21
- macros: ["textrm", "textit", "textbf", "textsc", "texttt"]
22
- }
23
- ], Mt = {
24
- kind: "presentation",
25
- category: "tex_fonts",
26
- pairs: [
27
- { from: "rm", to: "textrm" },
28
- { from: "em", to: "emph" },
29
- { from: "it", to: "textit" },
30
- { from: "itshape", to: "textit" },
31
- { from: "bf", to: "textbf" },
32
- { from: "bfseries", to: "textbf" },
33
- { from: "sf", to: "textsf" },
34
- { from: "sffamily", to: "textss" },
35
- { from: "textsl", to: "testsl" }
36
- ]
37
- }, we = [
38
- {
39
- kind: "accessibility",
40
- category: "consistency",
41
- macros: ["renewcommand"]
42
- }
43
- ], xe = [
44
- {
45
- kind: "unused",
46
- category: "conditionals",
47
- macros: ["if", "fi", "iffalse", "then", "else", "loop", "repeat"]
48
- },
49
- {
50
- kind: "presentation",
51
- category: "font_size",
52
- macros: [
53
- "tiny",
54
- "scriptsize",
55
- "footnotesize",
56
- "small",
57
- "normalsize",
58
- "large",
59
- "Large",
60
- "LARGE",
61
- "huge",
62
- "Huge",
63
- "normalfont"
64
- ]
65
- },
66
- {
67
- kind: "presentation",
68
- category: "spacing_vertical",
69
- macros: ["smallskip", "medskip", "bigskip", "vfil", "vfill"]
70
- },
71
- {
72
- kind: "presentation",
73
- category: "archaic_tex",
74
- macros: ["centerline", "centering", "noindent", "par", "linebreak"]
75
- },
76
- {
77
- kind: "mistake",
78
- category: "nonstructural",
79
- macros: ["ensuremath"]
80
- },
81
- {
82
- kind: "archaic",
83
- category: "low_level_tex",
84
- macros: [
85
- "relax",
86
- "makeatletter",
87
- "makeatother",
88
- "csname",
89
- "endcsname",
90
- "shipout",
91
- "noexpand",
92
- "expandafter",
93
- "clearpage"
94
- ]
95
- },
96
- {
97
- kind: "archaic",
98
- category: "file_manipulation",
99
- macros: [
100
- "newwrite",
101
- "newread",
102
- "immediate",
103
- "write",
104
- "write18",
105
- "read",
106
- "readline",
107
- "readfile",
108
- "openin",
109
- "openout",
110
- "jobname"
111
- ]
112
- }
113
- ], ke = [
114
- {
115
- kind: "archaic",
116
- category: "low_level_tex",
117
- macros: ["catcode", "newtheorem", "maketitle", "setlength"]
118
- }
119
- ], Se = [
120
- {
121
- kind: "publisher",
122
- category: "zzzzz",
123
- macros: [
124
- "theoremstyle",
125
- "makeindex",
126
- "allowdisplaybreaks",
127
- "frontmatter",
128
- "mainmatter",
129
- "appendix",
130
- "numberwithin",
131
- "setcounter",
132
- "tableofcontents",
133
- "FloatBarrier"
134
- ]
135
- }
136
- ], ze = [
137
- {
138
- kind: "archaic",
139
- category: "use_newcommand_only",
140
- macros: ["def", "let", "edef", "gdef", "xdef", "global", "long"]
141
- }
142
- ], Ee = [
143
- {
144
- kind: "presentation",
145
- category: "spacing_horizontal",
146
- macros: [{ name: "hspace", arity: 1 }]
147
- },
148
- {
149
- kind: "other",
150
- category: "other",
151
- macros: [{ name: "date", arity: 1 }]
152
- },
153
- {
154
- kind: "accessibility",
155
- category: "colors",
156
- macros: [
157
- { name: "color", arity: 1 },
158
- { name: "textcolor", arity: 1 },
159
- { name: "mathcolor", arity: 1 },
160
- { name: "definecolor", arity: 3 }
161
- ]
162
- }
163
- ], Ce = [
164
- {
165
- kind: "presentation",
166
- category: "nonstructural",
167
- environments: ["center", "minipage"]
168
- }
169
- ];
170
- function Zt(d) {
171
- return d.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
172
- }
173
- function Ht(d, c) {
174
- let e = d;
175
- const f = [];
176
- for (const { from: a, to: n } of c.pairs) {
177
- let r, i;
178
- c.category === "tex_fonts" ? (r = `\\{ *\\\\${Zt(a)}\\b *`, i = `\\${n}{`) : (r = `\\\\${Zt(a)}\\b *`, i = `\\${n}`);
179
- const l = new RegExp(r, "g"), p = e.match(l);
180
- p && (f.push({
181
- action: "replace",
182
- severity: "info",
183
- kind: c.kind,
184
- category: c.category,
185
- macro: a,
186
- replacement: n,
187
- occurrences: p.length
188
- }), e = e.replace(l, i));
189
- }
190
- return { output: e, warnings: f };
191
- }
192
- function Ae(d) {
193
- let c = d;
194
- const e = [], f = c.match(/\(\\ref\{([^{}]+)\}\)/g);
195
- f && (e.push({
196
- action: "rewrite",
197
- severity: "info",
198
- kind: "presentation",
199
- category: "math_refs",
200
- macro: "(\\ref{...})",
201
- replacement: "\\eqref{...}",
202
- occurrences: f.length
203
- }), c = c.replace(/\(\\ref\{([^{}]+)\}\)/g, "\\eqref{$1}")), c = c.replace(/(\\vfil)l\b/g, "$1"), c = c.replace(/(\\vfil)(\s*\\vfil\b)+\b/g, "$1");
204
- const a = c.match(/(\\vfil)\b/g);
205
- return a && (e.push({
206
- action: "rewrite",
207
- severity: "info",
208
- kind: "presentation",
209
- category: "spacing_vertical",
210
- macro: "vfil",
211
- replacement: "\\vspace{1in}",
212
- occurrences: a.length
213
- }), c = c.replace(/(\\vfil)\b/g, "\\vspace{1in}")), c = c.replace(
214
- /\\vskip\*? *([0-9]+|-) *([a-zA-Z]+).*/g,
215
- "\\vspace{$1$2}"
216
- ), c = c.replace(/(\\vspace)\*? */g, "$1"), c = c.replace(
217
- /(\\vspace) *\{([0-9]+|-) *([a-zA-Z]+).*?\}/g,
218
- "$1{$2$3}"
219
- ), { output: c, warnings: e };
220
- }
221
- function Ie(d) {
222
- const c = d.split("\\begin{document}");
223
- if (c.length < 2)
224
- return { preamble: "", body: d, bibliography: "" };
225
- const e = c[0];
226
- let f = c.slice(1).join("\\begin{document}"), a = "";
227
- if (/\\begin\{thebibliography\}/.test(f)) {
228
- const [n, ...r] = f.split("\\begin{thebibliography}");
229
- f = n, a = r.join("\\begin{thebibliography}");
230
- }
231
- return { preamble: e, body: f, bibliography: a };
232
- }
233
- function se(d) {
234
- return d.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
235
- }
236
- function Oe(d, c, e) {
237
- const f = se(d);
238
- if (c === "hasarg") {
239
- let a = `\\\\${f}\\b\\*?`;
240
- for (let n = 0; n < e; n += 1)
241
- a += "\\{[^{}]*\\}";
242
- return new RegExp(`(${a})`, "g");
243
- }
244
- return c === "line" ? new RegExp(`(\\\\${f}\\b.*)`, "g") : new RegExp(`(\\\\${f}\\b)`, "g");
245
- }
246
- function ut(d, c, e, f) {
247
- const { type: a = "", action: n = "mark", extra: r = "", save: i = !1 } = e;
248
- "macros" in c && c.macros[0];
249
- let l = d;
250
- const p = c.macros;
251
- for (const w of p) {
252
- const v = typeof w == "string" ? w : w.name, x = typeof w == "string" ? 0 : w.arity, u = Oe(v, a, x), _ = l.match(u);
253
- !_ || _.length === 0 || (i && f.push({
254
- action: "save",
255
- severity: "warning",
256
- kind: c.kind,
257
- category: c.category,
258
- macro: v,
259
- occurrences: _.length,
260
- examples: _.slice(0, 5),
261
- message: r || void 0
262
- }), n === "delete" ? (f.push({
263
- action: "delete",
264
- severity: "info",
265
- kind: c.kind,
266
- category: c.category,
267
- macro: v,
268
- occurrences: _.length,
269
- message: r || void 0
270
- }), l = l.replace(u, "")) : f.push({
271
- action: "anomaly",
272
- severity: "warning",
273
- kind: c.kind,
274
- category: c.category,
275
- macro: v,
276
- occurrences: _.length,
277
- message: r || void 0,
278
- examples: _.slice(0, 5)
279
- }));
280
- }
281
- return l;
282
- }
283
- function Te(d, c, e) {
284
- let f = d;
285
- for (const a of c.environments) {
286
- const n = se(a), r = new RegExp(`(\\\\(begin|end)\\{\\s*${n}\\})`, "g"), i = f.match(r);
287
- i && i.length > 0 && (e.push({
288
- action: "delete",
289
- severity: "info",
290
- kind: c.kind,
291
- category: c.category,
292
- macro: a,
293
- occurrences: i.length
294
- }), f = f.replace(r, ""));
295
- }
296
- return f;
297
- }
298
- function Re(d) {
299
- const c = [], e = Ie(d);
300
- let { preamble: f, body: a } = e;
301
- const { bibliography: n } = e;
302
- for (const p of xe)
303
- f = ut(f, p, { action: "delete" }, c), a = ut(a, p, { action: "delete" }, c);
304
- for (const p of we)
305
- f = ut(
306
- f,
307
- p,
308
- { type: "line", action: "delete", extra: "in the preamble", save: !0 },
309
- c
310
- ), a = ut(
311
- a,
312
- p,
313
- { type: "line", action: "delete", extra: "in the main text", save: !0 },
314
- c
315
- );
316
- for (const p of ze)
317
- f = ut(
318
- f,
319
- p,
320
- { type: "line", action: "delete", extra: "in the preamble", save: !0 },
321
- c
322
- ), a = ut(
323
- a,
324
- p,
325
- { type: "line", action: "delete", extra: "in the main text", save: !0 },
326
- c
327
- );
328
- for (const p of Ee)
329
- f = ut(
330
- f,
331
- p,
332
- { type: "hasarg", action: "delete" },
333
- c
334
- ), a = ut(
335
- a,
336
- p,
337
- { type: "hasarg", action: "delete" },
338
- c
339
- );
340
- for (const p of ke)
341
- f = ut(
342
- f,
343
- p,
344
- { type: "line", action: "delete" },
345
- c
346
- ), a = ut(a, p, { type: "line", action: "delete" }, c);
347
- for (const p of Se)
348
- f = ut(
349
- f,
350
- p,
351
- {
352
- type: "line",
353
- action: "delete",
354
- extra: "this is a publisher choice in PreTeXt"
355
- },
356
- c
357
- ), a = ut(
358
- a,
359
- p,
360
- {
361
- type: "line",
362
- action: "delete",
363
- extra: "this is a publisher choice in PreTeXt"
364
- },
365
- c
366
- );
367
- for (const p of ve)
368
- a = ut(a, p, { action: "mark" }, c);
369
- for (const p of Ce)
370
- a = Te(a, p, c);
371
- const r = d.includes("\\begin{document}"), i = n.length > 0;
372
- let l = f;
373
- return r ? l += `\\begin{document}
374
- ` + a : l = a, i && (l += `\\begin{thebibliography}
375
- ` + n), { output: l, warnings: c };
376
- }
377
- function Be(d) {
378
- let c = d;
379
- return c = c.replace(/\s+%.*/g, ""), c = c.replace(/([^\\])%.*/g, "$1"), c = c.replace(/^%.*/, ""), c;
380
- }
381
- function Pe(d) {
382
- return d.replace(/(.*\{)([^{}]+)(\}.*)/, (c, e, f, a) => {
383
- const n = String(f).replace(/\s/g, "_").replace(/[^a-zA-Z0-9_]/g, "-");
384
- return `${e}${n}${a}`;
385
- });
386
- }
387
- function Fe(d) {
388
- let c = d;
389
- return c = c.replace(/> */g, "\\gt "), c = c.replace(/< */g, "\\lt "), c = c.replace(
390
- /(\\(ref|eqref|cref|Cref|label)\{([^{}]+)\})/g,
391
- Pe
392
- ), c;
393
- }
394
- function De(d) {
395
- let c = d;
396
- return c = c.replace(/\\begin +/g, "\\begin"), c = c.replace(/\\chapter +/g, "\\chapter"), c = c.replace(/\\section +/g, "\\section"), c = c.replace(/\\section\*/g, "\\section"), c = Be(c), c = Fe(c), c = c.replace(/\\end\{document\}.*/s, ""), c = c.replace(/^\s+/, ""), c = c.replace(/\n{3,}/g, `
397
-
398
- `), c;
399
- }
400
- function Xt(d, c = 0, e = "{", f = "}") {
401
- let a = d.trimStart();
402
- if (!a)
403
- return ["", ""];
404
- let n = "", r = "", i = c;
405
- if (i === 0 && a[0] !== e)
406
- return ["", a];
407
- for (i === 0 && (r = e, i = 1, a = a.substring(1)); i > 0 && a; ) {
408
- const l = a[0];
409
- l === e && n !== "\\" ? i += 1 : l === f && n !== "\\" && (i -= 1), r += l, n === "\\" && l === "\\" ? n = `
410
- ` : n = l, a = a.substring(1);
411
- }
412
- return i === 0 ? [r, a] : ["", r.substring(1)];
413
- }
414
- function je(d) {
415
- const c = [];
416
- let e = De(d).replace(/(\n *){3,}/g, `
417
-
418
- `);
419
- const f = Ae(e);
420
- e = f.output, c.push(...f.warnings);
421
- const a = Ht(e, Mt);
422
- e = a.output, c.push(...a.warnings);
423
- const n = Ht(e, Mt);
424
- e = n.output, c.push(...n.warnings);
425
- const r = Re(e);
426
- return e = r.output.replace(/(\n *){3,}/g, `
427
-
428
- `), c.push(...r.warnings), { output: e, warnings: c };
429
- }
430
- function Ne(d) {
431
- const c = "\\begin{document}", e = "\\end{document}", f = d.indexOf(c);
432
- if (f === -1)
433
- return { preamble: "", body: d };
434
- const a = d.slice(0, f).trim(), n = d.slice(f + c.length), r = n.indexOf(e), i = (r === -1 ? n : n.slice(0, r)).trim();
435
- return { preamble: a, body: i };
436
- }
437
- function Gt(d, c) {
438
- const f = new RegExp(`\\\\${c}(?![a-zA-Z])`).exec(d);
439
- if (!f) return "";
440
- let a = d.slice(f.index + f[0].length).trimStart();
441
- if (a.startsWith("[")) {
442
- const [r, i] = Xt(a, 0, "[", "]");
443
- r && (a = i.trimStart());
444
- }
445
- const [n] = Xt(a);
446
- return n ? n.slice(1, -1).trim() : "";
447
- }
448
- const $e = /^[ \t]*(\\(?:new|renew|provide)command\*?|\\DeclareMathOperator\*?|\\newenvironment\*?)\b/;
449
- function Kt(d) {
450
- let c = 0;
451
- for (let e = 0; e < d.length; e++) {
452
- if (d[e] === "\\") {
453
- e++;
454
- continue;
455
- }
456
- d[e] === "{" ? c++ : d[e] === "}" && c--;
457
- }
458
- return c;
459
- }
460
- function Le(d) {
461
- const c = d.split(`
462
- `), e = [];
463
- let f = 0;
464
- for (; f < c.length; ) {
465
- if (!$e.test(c[f])) {
466
- f++;
467
- continue;
468
- }
469
- let a = c[f], n = Kt(c[f]);
470
- for (f++; n > 0 && f < c.length; )
471
- a += `
472
- ` + c[f], n += Kt(c[f]), f++;
473
- e.push(a.trim());
474
- }
475
- return e.join(`
476
- `);
477
- }
478
- function Ue(d) {
479
- const c = /\\documentclass(?:\[[^\]]*\])?\{([^}]+)\}/.exec(d);
480
- return c ? c[1].trim() : "article";
481
- }
482
- function We(d) {
483
- const c = d.replace(/(^|[^\\])%[^\n]*/gm, "$1");
484
- return {
485
- documentClass: Ue(c),
486
- title: Gt(c, "title"),
487
- author: Gt(c, "author"),
488
- macros: Le(c)
489
- };
490
- }
491
- function Me(d) {
492
- if (typeof d == "string")
493
- return d;
494
- if (typeof d == "object" && d !== null && "value" in d) {
495
- const c = d.value;
496
- if (typeof c == "string")
497
- return c;
498
- if (c != null)
499
- return String(c);
500
- }
501
- return String(d);
502
- }
503
- function ae(d) {
504
- return d.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
505
- }
506
- function oe(d) {
507
- return d.replace(/\\LaTeX\b/g, "LaTeX").replace(/\\TeX\b/g, "TeX").replace(/\\thanks\{[^{}]*(?:\{[^{}]*\}[^{}]*)?\}/g, "").replace(/\\inst\{[^{}]*\}/g, "").replace(/\\email\{[^{}]*\}/g, "").replace(/\\[a-zA-Z]+\{([^{}]*)\}/g, "$1").replace(/\\\s/g, " ").replace(/~/g, " ").replace(/\s+/g, " ").trim();
508
- }
509
- function Ze(d) {
510
- const c = [];
511
- if (d.macros) {
512
- const e = d.macros.split(`
513
- `).map((f) => ` ${f}`).join(`
514
- `);
515
- c.push(` <macros>
516
- ${e}
517
- </macros>`);
518
- }
519
- if (d.author) {
520
- const e = d.author.split(/\s+\\and\s+/)[0].trim(), f = ae(oe(e));
521
- f && c.push(
522
- ` <author>
523
- <personname>${f}</personname>
524
- </author>`
525
- );
526
- }
527
- return c.length === 0 ? "" : `<docinfo>
528
- ${c.join(`
529
- `)}
530
- </docinfo>`;
531
- }
532
- function He(d, c) {
533
- const e = d.replace(/^\s*<p\s*\/>\s*/g, "").replace(/^\s*<p>\s*<\/p>\s*/g, "").trim();
534
- if (!e) return "";
535
- const a = /<chapter[\s>]/.test(e) ? "book" : "article", n = Ze(c), r = c.title ? ` <title>${ae(oe(c.title))}</title>
536
- ` : "", i = `<${a}>
537
- ${r}${e}
538
- </${a}>`;
539
- return `<pretext>
540
- ${[n, i].filter(Boolean).join(`
541
- `)}
542
- </pretext>`;
543
- }
544
- function Lt(d) {
545
- const c = d.trim();
546
- return c ? me(c) : "";
547
- }
548
- function Xe(d) {
549
- const c = d.trim();
550
- if (!c)
551
- return { pretext: "", cleanedLatex: "", warnings: [] };
552
- const { preamble: e, body: f } = Ne(c), a = We(e), n = f ? [
553
- `\\documentclass{${a.documentClass}}`,
554
- a.macros,
555
- "\\begin{document}",
556
- f,
557
- "\\end{document}"
558
- ].filter(Boolean).join(`
559
- `) : c, { output: r, warnings: i } = je(n);
560
- if (!r.trim())
561
- return { pretext: "", cleanedLatex: r, warnings: i };
562
- const l = f ? r + `
563
- \\end{document}` : r, p = Me(ge(l)).trim();
564
- if (!p)
565
- return { pretext: "", cleanedLatex: r, warnings: i };
566
- const w = He(p, a);
567
- return { pretext: w ? Lt(w) : "", cleanedLatex: r, warnings: i };
568
- }
569
- function Ge(d) {
570
- const c = d.trim();
571
- if (!c)
572
- return { pretext: "", cleanedMarkdown: "" };
573
- const e = String(_e(c)).trim();
574
- return { pretext: e ? Lt(e) : "", cleanedMarkdown: c };
575
- }
576
- function Ke(d) {
577
- return d instanceof Error && d.message.trim() ? d.message.trim() : "Could not convert source content to PreTeXt.";
578
- }
579
- function Ye(d, c) {
580
- const e = ie(d), f = c ?? e;
581
- try {
582
- if (f === "pretext")
583
- return {
584
- sourceFormat: f,
585
- detectedSourceFormat: e,
586
- pretextSource: Lt(d),
587
- warnings: []
588
- };
589
- if (f === "markdown") {
590
- const { pretext: i, cleanedMarkdown: l } = Ge(d);
591
- return {
592
- sourceFormat: f,
593
- detectedSourceFormat: e,
594
- pretextSource: i,
595
- cleanedNativeSource: l,
596
- warnings: []
597
- };
598
- }
599
- const { pretext: a, cleanedLatex: n, warnings: r } = Xe(d);
600
- return {
601
- sourceFormat: f,
602
- detectedSourceFormat: e,
603
- pretextSource: a,
604
- cleanedNativeSource: n,
605
- warnings: r
606
- };
607
- } catch (a) {
608
- return {
609
- sourceFormat: f,
610
- detectedSourceFormat: e,
611
- pretextError: Ke(a),
612
- warnings: []
613
- };
614
- }
615
- }
616
- var zt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
617
- function Ve(d) {
618
- return d && d.__esModule && Object.prototype.hasOwnProperty.call(d, "default") ? d.default : d;
619
- }
620
- function Et(d) {
621
- throw new Error('Could not dynamically require "' + d + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
622
- }
623
- var Ot = { exports: {} };
624
- var Yt;
625
- function Je() {
626
- return Yt || (Yt = 1, (function(d, c) {
627
- (function(e) {
628
- d.exports = e();
629
- })(function() {
630
- return (function e(f, a, n) {
631
- function r(p, w) {
632
- if (!a[p]) {
633
- if (!f[p]) {
634
- var v = typeof Et == "function" && Et;
635
- if (!w && v) return v(p, !0);
636
- if (i) return i(p, !0);
637
- var x = new Error("Cannot find module '" + p + "'");
638
- throw x.code = "MODULE_NOT_FOUND", x;
639
- }
640
- var u = a[p] = { exports: {} };
641
- f[p][0].call(u.exports, function(_) {
642
- var o = f[p][1][_];
643
- return r(o || _);
644
- }, u, u.exports, e, f, a, n);
645
- }
646
- return a[p].exports;
647
- }
648
- for (var i = typeof Et == "function" && Et, l = 0; l < n.length; l++) r(n[l]);
649
- return r;
650
- })({ 1: [function(e, f, a) {
651
- var n = e("./utils"), r = e("./support"), i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
652
- a.encode = function(l) {
653
- for (var p, w, v, x, u, _, o, g = [], h = 0, b = l.length, S = b, z = n.getTypeOf(l) !== "string"; h < l.length; ) S = b - h, v = z ? (p = l[h++], w = h < b ? l[h++] : 0, h < b ? l[h++] : 0) : (p = l.charCodeAt(h++), w = h < b ? l.charCodeAt(h++) : 0, h < b ? l.charCodeAt(h++) : 0), x = p >> 2, u = (3 & p) << 4 | w >> 4, _ = 1 < S ? (15 & w) << 2 | v >> 6 : 64, o = 2 < S ? 63 & v : 64, g.push(i.charAt(x) + i.charAt(u) + i.charAt(_) + i.charAt(o));
654
- return g.join("");
655
- }, a.decode = function(l) {
656
- var p, w, v, x, u, _, o = 0, g = 0, h = "data:";
657
- if (l.substr(0, h.length) === h) throw new Error("Invalid base64 input, it looks like a data url.");
658
- var b, S = 3 * (l = l.replace(/[^A-Za-z0-9+/=]/g, "")).length / 4;
659
- if (l.charAt(l.length - 1) === i.charAt(64) && S--, l.charAt(l.length - 2) === i.charAt(64) && S--, S % 1 != 0) throw new Error("Invalid base64 input, bad content length.");
660
- for (b = r.uint8array ? new Uint8Array(0 | S) : new Array(0 | S); o < l.length; ) p = i.indexOf(l.charAt(o++)) << 2 | (x = i.indexOf(l.charAt(o++))) >> 4, w = (15 & x) << 4 | (u = i.indexOf(l.charAt(o++))) >> 2, v = (3 & u) << 6 | (_ = i.indexOf(l.charAt(o++))), b[g++] = p, u !== 64 && (b[g++] = w), _ !== 64 && (b[g++] = v);
661
- return b;
662
- };
663
- }, { "./support": 30, "./utils": 32 }], 2: [function(e, f, a) {
664
- var n = e("./external"), r = e("./stream/DataWorker"), i = e("./stream/Crc32Probe"), l = e("./stream/DataLengthProbe");
665
- function p(w, v, x, u, _) {
666
- this.compressedSize = w, this.uncompressedSize = v, this.crc32 = x, this.compression = u, this.compressedContent = _;
667
- }
668
- p.prototype = { getContentWorker: function() {
669
- var w = new r(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")), v = this;
670
- return w.on("end", function() {
671
- if (this.streamInfo.data_length !== v.uncompressedSize) throw new Error("Bug : uncompressed data size mismatch");
672
- }), w;
673
- }, getCompressedWorker: function() {
674
- return new r(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression);
675
- } }, p.createWorkerFrom = function(w, v, x) {
676
- return w.pipe(new i()).pipe(new l("uncompressedSize")).pipe(v.compressWorker(x)).pipe(new l("compressedSize")).withStreamInfo("compression", v);
677
- }, f.exports = p;
678
- }, { "./external": 6, "./stream/Crc32Probe": 25, "./stream/DataLengthProbe": 26, "./stream/DataWorker": 27 }], 3: [function(e, f, a) {
679
- var n = e("./stream/GenericWorker");
680
- a.STORE = { magic: "\0\0", compressWorker: function() {
681
- return new n("STORE compression");
682
- }, uncompressWorker: function() {
683
- return new n("STORE decompression");
684
- } }, a.DEFLATE = e("./flate");
685
- }, { "./flate": 7, "./stream/GenericWorker": 28 }], 4: [function(e, f, a) {
686
- var n = e("./utils"), r = (function() {
687
- for (var i, l = [], p = 0; p < 256; p++) {
688
- i = p;
689
- for (var w = 0; w < 8; w++) i = 1 & i ? 3988292384 ^ i >>> 1 : i >>> 1;
690
- l[p] = i;
691
- }
692
- return l;
693
- })();
694
- f.exports = function(i, l) {
695
- return i !== void 0 && i.length ? n.getTypeOf(i) !== "string" ? (function(p, w, v, x) {
696
- var u = r, _ = x + v;
697
- p ^= -1;
698
- for (var o = x; o < _; o++) p = p >>> 8 ^ u[255 & (p ^ w[o])];
699
- return -1 ^ p;
700
- })(0 | l, i, i.length, 0) : (function(p, w, v, x) {
701
- var u = r, _ = x + v;
702
- p ^= -1;
703
- for (var o = x; o < _; o++) p = p >>> 8 ^ u[255 & (p ^ w.charCodeAt(o))];
704
- return -1 ^ p;
705
- })(0 | l, i, i.length, 0) : 0;
706
- };
707
- }, { "./utils": 32 }], 5: [function(e, f, a) {
708
- a.base64 = !1, a.binary = !1, a.dir = !1, a.createFolders = !0, a.date = null, a.compression = null, a.compressionOptions = null, a.comment = null, a.unixPermissions = null, a.dosPermissions = null;
709
- }, {}], 6: [function(e, f, a) {
710
- var n = null;
711
- n = typeof Promise < "u" ? Promise : e("lie"), f.exports = { Promise: n };
712
- }, { lie: 37 }], 7: [function(e, f, a) {
713
- var n = typeof Uint8Array < "u" && typeof Uint16Array < "u" && typeof Uint32Array < "u", r = e("pako"), i = e("./utils"), l = e("./stream/GenericWorker"), p = n ? "uint8array" : "array";
714
- function w(v, x) {
715
- l.call(this, "FlateWorker/" + v), this._pako = null, this._pakoAction = v, this._pakoOptions = x, this.meta = {};
716
- }
717
- a.magic = "\b\0", i.inherits(w, l), w.prototype.processChunk = function(v) {
718
- this.meta = v.meta, this._pako === null && this._createPako(), this._pako.push(i.transformTo(p, v.data), !1);
719
- }, w.prototype.flush = function() {
720
- l.prototype.flush.call(this), this._pako === null && this._createPako(), this._pako.push([], !0);
721
- }, w.prototype.cleanUp = function() {
722
- l.prototype.cleanUp.call(this), this._pako = null;
723
- }, w.prototype._createPako = function() {
724
- this._pako = new r[this._pakoAction]({ raw: !0, level: this._pakoOptions.level || -1 });
725
- var v = this;
726
- this._pako.onData = function(x) {
727
- v.push({ data: x, meta: v.meta });
728
- };
729
- }, a.compressWorker = function(v) {
730
- return new w("Deflate", v);
731
- }, a.uncompressWorker = function() {
732
- return new w("Inflate", {});
733
- };
734
- }, { "./stream/GenericWorker": 28, "./utils": 32, pako: 38 }], 8: [function(e, f, a) {
735
- function n(u, _) {
736
- var o, g = "";
737
- for (o = 0; o < _; o++) g += String.fromCharCode(255 & u), u >>>= 8;
738
- return g;
739
- }
740
- function r(u, _, o, g, h, b) {
741
- var S, z, E = u.file, R = u.compression, B = b !== p.utf8encode, L = i.transformTo("string", b(E.name)), P = i.transformTo("string", p.utf8encode(E.name)), W = E.comment, Y = i.transformTo("string", b(W)), k = i.transformTo("string", p.utf8encode(W)), F = P.length !== E.name.length, s = k.length !== W.length, j = "", Q = "", U = "", tt = E.dir, M = E.date, q = { crc32: 0, compressedSize: 0, uncompressedSize: 0 };
742
- _ && !o || (q.crc32 = u.crc32, q.compressedSize = u.compressedSize, q.uncompressedSize = u.uncompressedSize);
743
- var O = 0;
744
- _ && (O |= 8), B || !F && !s || (O |= 2048);
745
- var I = 0, J = 0;
746
- tt && (I |= 16), h === "UNIX" ? (J = 798, I |= (function(X, st) {
747
- var lt = X;
748
- return X || (lt = st ? 16893 : 33204), (65535 & lt) << 16;
749
- })(E.unixPermissions, tt)) : (J = 20, I |= (function(X) {
750
- return 63 & (X || 0);
751
- })(E.dosPermissions)), S = M.getUTCHours(), S <<= 6, S |= M.getUTCMinutes(), S <<= 5, S |= M.getUTCSeconds() / 2, z = M.getUTCFullYear() - 1980, z <<= 4, z |= M.getUTCMonth() + 1, z <<= 5, z |= M.getUTCDate(), F && (Q = n(1, 1) + n(w(L), 4) + P, j += "up" + n(Q.length, 2) + Q), s && (U = n(1, 1) + n(w(Y), 4) + k, j += "uc" + n(U.length, 2) + U);
752
- var G = "";
753
- return G += `
754
- \0`, G += n(O, 2), G += R.magic, G += n(S, 2), G += n(z, 2), G += n(q.crc32, 4), G += n(q.compressedSize, 4), G += n(q.uncompressedSize, 4), G += n(L.length, 2), G += n(j.length, 2), { fileRecord: v.LOCAL_FILE_HEADER + G + L + j, dirRecord: v.CENTRAL_FILE_HEADER + n(J, 2) + G + n(Y.length, 2) + "\0\0\0\0" + n(I, 4) + n(g, 4) + L + j + Y };
755
- }
756
- var i = e("../utils"), l = e("../stream/GenericWorker"), p = e("../utf8"), w = e("../crc32"), v = e("../signature");
757
- function x(u, _, o, g) {
758
- l.call(this, "ZipFileWorker"), this.bytesWritten = 0, this.zipComment = _, this.zipPlatform = o, this.encodeFileName = g, this.streamFiles = u, this.accumulate = !1, this.contentBuffer = [], this.dirRecords = [], this.currentSourceOffset = 0, this.entriesCount = 0, this.currentFile = null, this._sources = [];
759
- }
760
- i.inherits(x, l), x.prototype.push = function(u) {
761
- var _ = u.meta.percent || 0, o = this.entriesCount, g = this._sources.length;
762
- this.accumulate ? this.contentBuffer.push(u) : (this.bytesWritten += u.data.length, l.prototype.push.call(this, { data: u.data, meta: { currentFile: this.currentFile, percent: o ? (_ + 100 * (o - g - 1)) / o : 100 } }));
763
- }, x.prototype.openedSource = function(u) {
764
- this.currentSourceOffset = this.bytesWritten, this.currentFile = u.file.name;
765
- var _ = this.streamFiles && !u.file.dir;
766
- if (_) {
767
- var o = r(u, _, !1, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
768
- this.push({ data: o.fileRecord, meta: { percent: 0 } });
769
- } else this.accumulate = !0;
770
- }, x.prototype.closedSource = function(u) {
771
- this.accumulate = !1;
772
- var _ = this.streamFiles && !u.file.dir, o = r(u, _, !0, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
773
- if (this.dirRecords.push(o.dirRecord), _) this.push({ data: (function(g) {
774
- return v.DATA_DESCRIPTOR + n(g.crc32, 4) + n(g.compressedSize, 4) + n(g.uncompressedSize, 4);
775
- })(u), meta: { percent: 100 } });
776
- else for (this.push({ data: o.fileRecord, meta: { percent: 0 } }); this.contentBuffer.length; ) this.push(this.contentBuffer.shift());
777
- this.currentFile = null;
778
- }, x.prototype.flush = function() {
779
- for (var u = this.bytesWritten, _ = 0; _ < this.dirRecords.length; _++) this.push({ data: this.dirRecords[_], meta: { percent: 100 } });
780
- var o = this.bytesWritten - u, g = (function(h, b, S, z, E) {
781
- var R = i.transformTo("string", E(z));
782
- return v.CENTRAL_DIRECTORY_END + "\0\0\0\0" + n(h, 2) + n(h, 2) + n(b, 4) + n(S, 4) + n(R.length, 2) + R;
783
- })(this.dirRecords.length, o, u, this.zipComment, this.encodeFileName);
784
- this.push({ data: g, meta: { percent: 100 } });
785
- }, x.prototype.prepareNextSource = function() {
786
- this.previous = this._sources.shift(), this.openedSource(this.previous.streamInfo), this.isPaused ? this.previous.pause() : this.previous.resume();
787
- }, x.prototype.registerPrevious = function(u) {
788
- this._sources.push(u);
789
- var _ = this;
790
- return u.on("data", function(o) {
791
- _.processChunk(o);
792
- }), u.on("end", function() {
793
- _.closedSource(_.previous.streamInfo), _._sources.length ? _.prepareNextSource() : _.end();
794
- }), u.on("error", function(o) {
795
- _.error(o);
796
- }), this;
797
- }, x.prototype.resume = function() {
798
- return !!l.prototype.resume.call(this) && (!this.previous && this._sources.length ? (this.prepareNextSource(), !0) : this.previous || this._sources.length || this.generatedError ? void 0 : (this.end(), !0));
799
- }, x.prototype.error = function(u) {
800
- var _ = this._sources;
801
- if (!l.prototype.error.call(this, u)) return !1;
802
- for (var o = 0; o < _.length; o++) try {
803
- _[o].error(u);
804
- } catch {
805
- }
806
- return !0;
807
- }, x.prototype.lock = function() {
808
- l.prototype.lock.call(this);
809
- for (var u = this._sources, _ = 0; _ < u.length; _++) u[_].lock();
810
- }, f.exports = x;
811
- }, { "../crc32": 4, "../signature": 23, "../stream/GenericWorker": 28, "../utf8": 31, "../utils": 32 }], 9: [function(e, f, a) {
812
- var n = e("../compressions"), r = e("./ZipFileWorker");
813
- a.generateWorker = function(i, l, p) {
814
- var w = new r(l.streamFiles, p, l.platform, l.encodeFileName), v = 0;
815
- try {
816
- i.forEach(function(x, u) {
817
- v++;
818
- var _ = (function(b, S) {
819
- var z = b || S, E = n[z];
820
- if (!E) throw new Error(z + " is not a valid compression method !");
821
- return E;
822
- })(u.options.compression, l.compression), o = u.options.compressionOptions || l.compressionOptions || {}, g = u.dir, h = u.date;
823
- u._compressWorker(_, o).withStreamInfo("file", { name: x, dir: g, date: h, comment: u.comment || "", unixPermissions: u.unixPermissions, dosPermissions: u.dosPermissions }).pipe(w);
824
- }), w.entriesCount = v;
825
- } catch (x) {
826
- w.error(x);
827
- }
828
- return w;
829
- };
830
- }, { "../compressions": 3, "./ZipFileWorker": 8 }], 10: [function(e, f, a) {
831
- function n() {
832
- if (!(this instanceof n)) return new n();
833
- if (arguments.length) throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");
834
- this.files = /* @__PURE__ */ Object.create(null), this.comment = null, this.root = "", this.clone = function() {
835
- var r = new n();
836
- for (var i in this) typeof this[i] != "function" && (r[i] = this[i]);
837
- return r;
838
- };
839
- }
840
- (n.prototype = e("./object")).loadAsync = e("./load"), n.support = e("./support"), n.defaults = e("./defaults"), n.version = "3.10.1", n.loadAsync = function(r, i) {
841
- return new n().loadAsync(r, i);
842
- }, n.external = e("./external"), f.exports = n;
843
- }, { "./defaults": 5, "./external": 6, "./load": 11, "./object": 15, "./support": 30 }], 11: [function(e, f, a) {
844
- var n = e("./utils"), r = e("./external"), i = e("./utf8"), l = e("./zipEntries"), p = e("./stream/Crc32Probe"), w = e("./nodejsUtils");
845
- function v(x) {
846
- return new r.Promise(function(u, _) {
847
- var o = x.decompressed.getContentWorker().pipe(new p());
848
- o.on("error", function(g) {
849
- _(g);
850
- }).on("end", function() {
851
- o.streamInfo.crc32 !== x.decompressed.crc32 ? _(new Error("Corrupted zip : CRC32 mismatch")) : u();
852
- }).resume();
853
- });
854
- }
855
- f.exports = function(x, u) {
856
- var _ = this;
857
- return u = n.extend(u || {}, { base64: !1, checkCRC32: !1, optimizedBinaryString: !1, createFolders: !1, decodeFileName: i.utf8decode }), w.isNode && w.isStream(x) ? r.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")) : n.prepareContent("the loaded zip file", x, !0, u.optimizedBinaryString, u.base64).then(function(o) {
858
- var g = new l(u);
859
- return g.load(o), g;
860
- }).then(function(o) {
861
- var g = [r.Promise.resolve(o)], h = o.files;
862
- if (u.checkCRC32) for (var b = 0; b < h.length; b++) g.push(v(h[b]));
863
- return r.Promise.all(g);
864
- }).then(function(o) {
865
- for (var g = o.shift(), h = g.files, b = 0; b < h.length; b++) {
866
- var S = h[b], z = S.fileNameStr, E = n.resolve(S.fileNameStr);
867
- _.file(E, S.decompressed, { binary: !0, optimizedBinaryString: !0, date: S.date, dir: S.dir, comment: S.fileCommentStr.length ? S.fileCommentStr : null, unixPermissions: S.unixPermissions, dosPermissions: S.dosPermissions, createFolders: u.createFolders }), S.dir || (_.file(E).unsafeOriginalName = z);
868
- }
869
- return g.zipComment.length && (_.comment = g.zipComment), _;
870
- });
871
- };
872
- }, { "./external": 6, "./nodejsUtils": 14, "./stream/Crc32Probe": 25, "./utf8": 31, "./utils": 32, "./zipEntries": 33 }], 12: [function(e, f, a) {
873
- var n = e("../utils"), r = e("../stream/GenericWorker");
874
- function i(l, p) {
875
- r.call(this, "Nodejs stream input adapter for " + l), this._upstreamEnded = !1, this._bindStream(p);
876
- }
877
- n.inherits(i, r), i.prototype._bindStream = function(l) {
878
- var p = this;
879
- (this._stream = l).pause(), l.on("data", function(w) {
880
- p.push({ data: w, meta: { percent: 0 } });
881
- }).on("error", function(w) {
882
- p.isPaused ? this.generatedError = w : p.error(w);
883
- }).on("end", function() {
884
- p.isPaused ? p._upstreamEnded = !0 : p.end();
885
- });
886
- }, i.prototype.pause = function() {
887
- return !!r.prototype.pause.call(this) && (this._stream.pause(), !0);
888
- }, i.prototype.resume = function() {
889
- return !!r.prototype.resume.call(this) && (this._upstreamEnded ? this.end() : this._stream.resume(), !0);
890
- }, f.exports = i;
891
- }, { "../stream/GenericWorker": 28, "../utils": 32 }], 13: [function(e, f, a) {
892
- var n = e("readable-stream").Readable;
893
- function r(i, l, p) {
894
- n.call(this, l), this._helper = i;
895
- var w = this;
896
- i.on("data", function(v, x) {
897
- w.push(v) || w._helper.pause(), p && p(x);
898
- }).on("error", function(v) {
899
- w.emit("error", v);
900
- }).on("end", function() {
901
- w.push(null);
902
- });
903
- }
904
- e("../utils").inherits(r, n), r.prototype._read = function() {
905
- this._helper.resume();
906
- }, f.exports = r;
907
- }, { "../utils": 32, "readable-stream": 16 }], 14: [function(e, f, a) {
908
- f.exports = { isNode: typeof Buffer < "u", newBufferFrom: function(n, r) {
909
- if (Buffer.from && Buffer.from !== Uint8Array.from) return Buffer.from(n, r);
910
- if (typeof n == "number") throw new Error('The "data" argument must not be a number');
911
- return new Buffer(n, r);
912
- }, allocBuffer: function(n) {
913
- if (Buffer.alloc) return Buffer.alloc(n);
914
- var r = new Buffer(n);
915
- return r.fill(0), r;
916
- }, isBuffer: function(n) {
917
- return Buffer.isBuffer(n);
918
- }, isStream: function(n) {
919
- return n && typeof n.on == "function" && typeof n.pause == "function" && typeof n.resume == "function";
920
- } };
921
- }, {}], 15: [function(e, f, a) {
922
- function n(E, R, B) {
923
- var L, P = i.getTypeOf(R), W = i.extend(B || {}, w);
924
- W.date = W.date || /* @__PURE__ */ new Date(), W.compression !== null && (W.compression = W.compression.toUpperCase()), typeof W.unixPermissions == "string" && (W.unixPermissions = parseInt(W.unixPermissions, 8)), W.unixPermissions && 16384 & W.unixPermissions && (W.dir = !0), W.dosPermissions && 16 & W.dosPermissions && (W.dir = !0), W.dir && (E = h(E)), W.createFolders && (L = g(E)) && b.call(this, L, !0);
925
- var Y = P === "string" && W.binary === !1 && W.base64 === !1;
926
- B && B.binary !== void 0 || (W.binary = !Y), (R instanceof v && R.uncompressedSize === 0 || W.dir || !R || R.length === 0) && (W.base64 = !1, W.binary = !0, R = "", W.compression = "STORE", P = "string");
927
- var k = null;
928
- k = R instanceof v || R instanceof l ? R : _.isNode && _.isStream(R) ? new o(E, R) : i.prepareContent(E, R, W.binary, W.optimizedBinaryString, W.base64);
929
- var F = new x(E, k, W);
930
- this.files[E] = F;
931
- }
932
- var r = e("./utf8"), i = e("./utils"), l = e("./stream/GenericWorker"), p = e("./stream/StreamHelper"), w = e("./defaults"), v = e("./compressedObject"), x = e("./zipObject"), u = e("./generate"), _ = e("./nodejsUtils"), o = e("./nodejs/NodejsStreamInputAdapter"), g = function(E) {
933
- E.slice(-1) === "/" && (E = E.substring(0, E.length - 1));
934
- var R = E.lastIndexOf("/");
935
- return 0 < R ? E.substring(0, R) : "";
936
- }, h = function(E) {
937
- return E.slice(-1) !== "/" && (E += "/"), E;
938
- }, b = function(E, R) {
939
- return R = R !== void 0 ? R : w.createFolders, E = h(E), this.files[E] || n.call(this, E, null, { dir: !0, createFolders: R }), this.files[E];
940
- };
941
- function S(E) {
942
- return Object.prototype.toString.call(E) === "[object RegExp]";
943
- }
944
- var z = { load: function() {
945
- throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
946
- }, forEach: function(E) {
947
- var R, B, L;
948
- for (R in this.files) L = this.files[R], (B = R.slice(this.root.length, R.length)) && R.slice(0, this.root.length) === this.root && E(B, L);
949
- }, filter: function(E) {
950
- var R = [];
951
- return this.forEach(function(B, L) {
952
- E(B, L) && R.push(L);
953
- }), R;
954
- }, file: function(E, R, B) {
955
- if (arguments.length !== 1) return E = this.root + E, n.call(this, E, R, B), this;
956
- if (S(E)) {
957
- var L = E;
958
- return this.filter(function(W, Y) {
959
- return !Y.dir && L.test(W);
960
- });
961
- }
962
- var P = this.files[this.root + E];
963
- return P && !P.dir ? P : null;
964
- }, folder: function(E) {
965
- if (!E) return this;
966
- if (S(E)) return this.filter(function(P, W) {
967
- return W.dir && E.test(P);
968
- });
969
- var R = this.root + E, B = b.call(this, R), L = this.clone();
970
- return L.root = B.name, L;
971
- }, remove: function(E) {
972
- E = this.root + E;
973
- var R = this.files[E];
974
- if (R || (E.slice(-1) !== "/" && (E += "/"), R = this.files[E]), R && !R.dir) delete this.files[E];
975
- else for (var B = this.filter(function(P, W) {
976
- return W.name.slice(0, E.length) === E;
977
- }), L = 0; L < B.length; L++) delete this.files[B[L].name];
978
- return this;
979
- }, generate: function() {
980
- throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
981
- }, generateInternalStream: function(E) {
982
- var R, B = {};
983
- try {
984
- if ((B = i.extend(E || {}, { streamFiles: !1, compression: "STORE", compressionOptions: null, type: "", platform: "DOS", comment: null, mimeType: "application/zip", encodeFileName: r.utf8encode })).type = B.type.toLowerCase(), B.compression = B.compression.toUpperCase(), B.type === "binarystring" && (B.type = "string"), !B.type) throw new Error("No output type specified.");
985
- i.checkSupport(B.type), B.platform !== "darwin" && B.platform !== "freebsd" && B.platform !== "linux" && B.platform !== "sunos" || (B.platform = "UNIX"), B.platform === "win32" && (B.platform = "DOS");
986
- var L = B.comment || this.comment || "";
987
- R = u.generateWorker(this, B, L);
988
- } catch (P) {
989
- (R = new l("error")).error(P);
990
- }
991
- return new p(R, B.type || "string", B.mimeType);
992
- }, generateAsync: function(E, R) {
993
- return this.generateInternalStream(E).accumulate(R);
994
- }, generateNodeStream: function(E, R) {
995
- return (E = E || {}).type || (E.type = "nodebuffer"), this.generateInternalStream(E).toNodejsStream(R);
996
- } };
997
- f.exports = z;
998
- }, { "./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, f, a) {
999
- f.exports = e("stream");
1000
- }, { stream: void 0 }], 17: [function(e, f, a) {
1001
- var n = e("./DataReader");
1002
- function r(i) {
1003
- n.call(this, i);
1004
- for (var l = 0; l < this.data.length; l++) i[l] = 255 & i[l];
1005
- }
1006
- e("../utils").inherits(r, n), r.prototype.byteAt = function(i) {
1007
- return this.data[this.zero + i];
1008
- }, r.prototype.lastIndexOfSignature = function(i) {
1009
- for (var l = i.charCodeAt(0), p = i.charCodeAt(1), w = i.charCodeAt(2), v = i.charCodeAt(3), x = this.length - 4; 0 <= x; --x) if (this.data[x] === l && this.data[x + 1] === p && this.data[x + 2] === w && this.data[x + 3] === v) return x - this.zero;
1010
- return -1;
1011
- }, r.prototype.readAndCheckSignature = function(i) {
1012
- var l = i.charCodeAt(0), p = i.charCodeAt(1), w = i.charCodeAt(2), v = i.charCodeAt(3), x = this.readData(4);
1013
- return l === x[0] && p === x[1] && w === x[2] && v === x[3];
1014
- }, r.prototype.readData = function(i) {
1015
- if (this.checkOffset(i), i === 0) return [];
1016
- var l = this.data.slice(this.zero + this.index, this.zero + this.index + i);
1017
- return this.index += i, l;
1018
- }, f.exports = r;
1019
- }, { "../utils": 32, "./DataReader": 18 }], 18: [function(e, f, a) {
1020
- var n = e("../utils");
1021
- function r(i) {
1022
- this.data = i, this.length = i.length, this.index = 0, this.zero = 0;
1023
- }
1024
- r.prototype = { checkOffset: function(i) {
1025
- this.checkIndex(this.index + i);
1026
- }, checkIndex: function(i) {
1027
- if (this.length < this.zero + i || i < 0) throw new Error("End of data reached (data length = " + this.length + ", asked index = " + i + "). Corrupted zip ?");
1028
- }, setIndex: function(i) {
1029
- this.checkIndex(i), this.index = i;
1030
- }, skip: function(i) {
1031
- this.setIndex(this.index + i);
1032
- }, byteAt: function() {
1033
- }, readInt: function(i) {
1034
- var l, p = 0;
1035
- for (this.checkOffset(i), l = this.index + i - 1; l >= this.index; l--) p = (p << 8) + this.byteAt(l);
1036
- return this.index += i, p;
1037
- }, readString: function(i) {
1038
- return n.transformTo("string", this.readData(i));
1039
- }, readData: function() {
1040
- }, lastIndexOfSignature: function() {
1041
- }, readAndCheckSignature: function() {
1042
- }, readDate: function() {
1043
- var i = this.readInt(4);
1044
- return new Date(Date.UTC(1980 + (i >> 25 & 127), (i >> 21 & 15) - 1, i >> 16 & 31, i >> 11 & 31, i >> 5 & 63, (31 & i) << 1));
1045
- } }, f.exports = r;
1046
- }, { "../utils": 32 }], 19: [function(e, f, a) {
1047
- var n = e("./Uint8ArrayReader");
1048
- function r(i) {
1049
- n.call(this, i);
1050
- }
1051
- e("../utils").inherits(r, n), r.prototype.readData = function(i) {
1052
- this.checkOffset(i);
1053
- var l = this.data.slice(this.zero + this.index, this.zero + this.index + i);
1054
- return this.index += i, l;
1055
- }, f.exports = r;
1056
- }, { "../utils": 32, "./Uint8ArrayReader": 21 }], 20: [function(e, f, a) {
1057
- var n = e("./DataReader");
1058
- function r(i) {
1059
- n.call(this, i);
1060
- }
1061
- e("../utils").inherits(r, n), r.prototype.byteAt = function(i) {
1062
- return this.data.charCodeAt(this.zero + i);
1063
- }, r.prototype.lastIndexOfSignature = function(i) {
1064
- return this.data.lastIndexOf(i) - this.zero;
1065
- }, r.prototype.readAndCheckSignature = function(i) {
1066
- return i === this.readData(4);
1067
- }, r.prototype.readData = function(i) {
1068
- this.checkOffset(i);
1069
- var l = this.data.slice(this.zero + this.index, this.zero + this.index + i);
1070
- return this.index += i, l;
1071
- }, f.exports = r;
1072
- }, { "../utils": 32, "./DataReader": 18 }], 21: [function(e, f, a) {
1073
- var n = e("./ArrayReader");
1074
- function r(i) {
1075
- n.call(this, i);
1076
- }
1077
- e("../utils").inherits(r, n), r.prototype.readData = function(i) {
1078
- if (this.checkOffset(i), i === 0) return new Uint8Array(0);
1079
- var l = this.data.subarray(this.zero + this.index, this.zero + this.index + i);
1080
- return this.index += i, l;
1081
- }, f.exports = r;
1082
- }, { "../utils": 32, "./ArrayReader": 17 }], 22: [function(e, f, a) {
1083
- var n = e("../utils"), r = e("../support"), i = e("./ArrayReader"), l = e("./StringReader"), p = e("./NodeBufferReader"), w = e("./Uint8ArrayReader");
1084
- f.exports = function(v) {
1085
- var x = n.getTypeOf(v);
1086
- return n.checkSupport(x), x !== "string" || r.uint8array ? x === "nodebuffer" ? new p(v) : r.uint8array ? new w(n.transformTo("uint8array", v)) : new i(n.transformTo("array", v)) : new l(v);
1087
- };
1088
- }, { "../support": 30, "../utils": 32, "./ArrayReader": 17, "./NodeBufferReader": 19, "./StringReader": 20, "./Uint8ArrayReader": 21 }], 23: [function(e, f, a) {
1089
- a.LOCAL_FILE_HEADER = "PK", a.CENTRAL_FILE_HEADER = "PK", a.CENTRAL_DIRECTORY_END = "PK", a.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x07", a.ZIP64_CENTRAL_DIRECTORY_END = "PK", a.DATA_DESCRIPTOR = "PK\x07\b";
1090
- }, {}], 24: [function(e, f, a) {
1091
- var n = e("./GenericWorker"), r = e("../utils");
1092
- function i(l) {
1093
- n.call(this, "ConvertWorker to " + l), this.destType = l;
1094
- }
1095
- r.inherits(i, n), i.prototype.processChunk = function(l) {
1096
- this.push({ data: r.transformTo(this.destType, l.data), meta: l.meta });
1097
- }, f.exports = i;
1098
- }, { "../utils": 32, "./GenericWorker": 28 }], 25: [function(e, f, a) {
1099
- var n = e("./GenericWorker"), r = e("../crc32");
1100
- function i() {
1101
- n.call(this, "Crc32Probe"), this.withStreamInfo("crc32", 0);
1102
- }
1103
- e("../utils").inherits(i, n), i.prototype.processChunk = function(l) {
1104
- this.streamInfo.crc32 = r(l.data, this.streamInfo.crc32 || 0), this.push(l);
1105
- }, f.exports = i;
1106
- }, { "../crc32": 4, "../utils": 32, "./GenericWorker": 28 }], 26: [function(e, f, a) {
1107
- var n = e("../utils"), r = e("./GenericWorker");
1108
- function i(l) {
1109
- r.call(this, "DataLengthProbe for " + l), this.propName = l, this.withStreamInfo(l, 0);
1110
- }
1111
- n.inherits(i, r), i.prototype.processChunk = function(l) {
1112
- if (l) {
1113
- var p = this.streamInfo[this.propName] || 0;
1114
- this.streamInfo[this.propName] = p + l.data.length;
1115
- }
1116
- r.prototype.processChunk.call(this, l);
1117
- }, f.exports = i;
1118
- }, { "../utils": 32, "./GenericWorker": 28 }], 27: [function(e, f, a) {
1119
- var n = e("../utils"), r = e("./GenericWorker");
1120
- function i(l) {
1121
- r.call(this, "DataWorker");
1122
- var p = this;
1123
- this.dataIsReady = !1, this.index = 0, this.max = 0, this.data = null, this.type = "", this._tickScheduled = !1, l.then(function(w) {
1124
- p.dataIsReady = !0, p.data = w, p.max = w && w.length || 0, p.type = n.getTypeOf(w), p.isPaused || p._tickAndRepeat();
1125
- }, function(w) {
1126
- p.error(w);
1127
- });
1128
- }
1129
- n.inherits(i, r), i.prototype.cleanUp = function() {
1130
- r.prototype.cleanUp.call(this), this.data = null;
1131
- }, i.prototype.resume = function() {
1132
- return !!r.prototype.resume.call(this) && (!this._tickScheduled && this.dataIsReady && (this._tickScheduled = !0, n.delay(this._tickAndRepeat, [], this)), !0);
1133
- }, i.prototype._tickAndRepeat = function() {
1134
- this._tickScheduled = !1, this.isPaused || this.isFinished || (this._tick(), this.isFinished || (n.delay(this._tickAndRepeat, [], this), this._tickScheduled = !0));
1135
- }, i.prototype._tick = function() {
1136
- if (this.isPaused || this.isFinished) return !1;
1137
- var l = null, p = Math.min(this.max, this.index + 16384);
1138
- if (this.index >= this.max) return this.end();
1139
- switch (this.type) {
1140
- case "string":
1141
- l = this.data.substring(this.index, p);
1142
- break;
1143
- case "uint8array":
1144
- l = this.data.subarray(this.index, p);
1145
- break;
1146
- case "array":
1147
- case "nodebuffer":
1148
- l = this.data.slice(this.index, p);
1149
- }
1150
- return this.index = p, this.push({ data: l, meta: { percent: this.max ? this.index / this.max * 100 : 0 } });
1151
- }, f.exports = i;
1152
- }, { "../utils": 32, "./GenericWorker": 28 }], 28: [function(e, f, a) {
1153
- function n(r) {
1154
- this.name = r || "default", this.streamInfo = {}, this.generatedError = null, this.extraStreamInfo = {}, this.isPaused = !0, this.isFinished = !1, this.isLocked = !1, this._listeners = { data: [], end: [], error: [] }, this.previous = null;
1155
- }
1156
- n.prototype = { push: function(r) {
1157
- this.emit("data", r);
1158
- }, end: function() {
1159
- if (this.isFinished) return !1;
1160
- this.flush();
1161
- try {
1162
- this.emit("end"), this.cleanUp(), this.isFinished = !0;
1163
- } catch (r) {
1164
- this.emit("error", r);
1165
- }
1166
- return !0;
1167
- }, error: function(r) {
1168
- return !this.isFinished && (this.isPaused ? this.generatedError = r : (this.isFinished = !0, this.emit("error", r), this.previous && this.previous.error(r), this.cleanUp()), !0);
1169
- }, on: function(r, i) {
1170
- return this._listeners[r].push(i), this;
1171
- }, cleanUp: function() {
1172
- this.streamInfo = this.generatedError = this.extraStreamInfo = null, this._listeners = [];
1173
- }, emit: function(r, i) {
1174
- if (this._listeners[r]) for (var l = 0; l < this._listeners[r].length; l++) this._listeners[r][l].call(this, i);
1175
- }, pipe: function(r) {
1176
- return r.registerPrevious(this);
1177
- }, registerPrevious: function(r) {
1178
- if (this.isLocked) throw new Error("The stream '" + this + "' has already been used.");
1179
- this.streamInfo = r.streamInfo, this.mergeStreamInfo(), this.previous = r;
1180
- var i = this;
1181
- return r.on("data", function(l) {
1182
- i.processChunk(l);
1183
- }), r.on("end", function() {
1184
- i.end();
1185
- }), r.on("error", function(l) {
1186
- i.error(l);
1187
- }), this;
1188
- }, pause: function() {
1189
- return !this.isPaused && !this.isFinished && (this.isPaused = !0, this.previous && this.previous.pause(), !0);
1190
- }, resume: function() {
1191
- if (!this.isPaused || this.isFinished) return !1;
1192
- var r = this.isPaused = !1;
1193
- return this.generatedError && (this.error(this.generatedError), r = !0), this.previous && this.previous.resume(), !r;
1194
- }, flush: function() {
1195
- }, processChunk: function(r) {
1196
- this.push(r);
1197
- }, withStreamInfo: function(r, i) {
1198
- return this.extraStreamInfo[r] = i, this.mergeStreamInfo(), this;
1199
- }, mergeStreamInfo: function() {
1200
- for (var r in this.extraStreamInfo) Object.prototype.hasOwnProperty.call(this.extraStreamInfo, r) && (this.streamInfo[r] = this.extraStreamInfo[r]);
1201
- }, lock: function() {
1202
- if (this.isLocked) throw new Error("The stream '" + this + "' has already been used.");
1203
- this.isLocked = !0, this.previous && this.previous.lock();
1204
- }, toString: function() {
1205
- var r = "Worker " + this.name;
1206
- return this.previous ? this.previous + " -> " + r : r;
1207
- } }, f.exports = n;
1208
- }, {}], 29: [function(e, f, a) {
1209
- var n = e("../utils"), r = e("./ConvertWorker"), i = e("./GenericWorker"), l = e("../base64"), p = e("../support"), w = e("../external"), v = null;
1210
- if (p.nodestream) try {
1211
- v = e("../nodejs/NodejsStreamOutputAdapter");
1212
- } catch {
1213
- }
1214
- function x(_, o) {
1215
- return new w.Promise(function(g, h) {
1216
- var b = [], S = _._internalType, z = _._outputType, E = _._mimeType;
1217
- _.on("data", function(R, B) {
1218
- b.push(R), o && o(B);
1219
- }).on("error", function(R) {
1220
- b = [], h(R);
1221
- }).on("end", function() {
1222
- try {
1223
- var R = (function(B, L, P) {
1224
- switch (B) {
1225
- case "blob":
1226
- return n.newBlob(n.transformTo("arraybuffer", L), P);
1227
- case "base64":
1228
- return l.encode(L);
1229
- default:
1230
- return n.transformTo(B, L);
1231
- }
1232
- })(z, (function(B, L) {
1233
- var P, W = 0, Y = null, k = 0;
1234
- for (P = 0; P < L.length; P++) k += L[P].length;
1235
- switch (B) {
1236
- case "string":
1237
- return L.join("");
1238
- case "array":
1239
- return Array.prototype.concat.apply([], L);
1240
- case "uint8array":
1241
- for (Y = new Uint8Array(k), P = 0; P < L.length; P++) Y.set(L[P], W), W += L[P].length;
1242
- return Y;
1243
- case "nodebuffer":
1244
- return Buffer.concat(L);
1245
- default:
1246
- throw new Error("concat : unsupported type '" + B + "'");
1247
- }
1248
- })(S, b), E);
1249
- g(R);
1250
- } catch (B) {
1251
- h(B);
1252
- }
1253
- b = [];
1254
- }).resume();
1255
- });
1256
- }
1257
- function u(_, o, g) {
1258
- var h = o;
1259
- switch (o) {
1260
- case "blob":
1261
- case "arraybuffer":
1262
- h = "uint8array";
1263
- break;
1264
- case "base64":
1265
- h = "string";
1266
- }
1267
- try {
1268
- this._internalType = h, this._outputType = o, this._mimeType = g, n.checkSupport(h), this._worker = _.pipe(new r(h)), _.lock();
1269
- } catch (b) {
1270
- this._worker = new i("error"), this._worker.error(b);
1271
- }
1272
- }
1273
- u.prototype = { accumulate: function(_) {
1274
- return x(this, _);
1275
- }, on: function(_, o) {
1276
- var g = this;
1277
- return _ === "data" ? this._worker.on(_, function(h) {
1278
- o.call(g, h.data, h.meta);
1279
- }) : this._worker.on(_, function() {
1280
- n.delay(o, arguments, g);
1281
- }), this;
1282
- }, resume: function() {
1283
- return n.delay(this._worker.resume, [], this._worker), this;
1284
- }, pause: function() {
1285
- return this._worker.pause(), this;
1286
- }, toNodejsStream: function(_) {
1287
- if (n.checkSupport("nodestream"), this._outputType !== "nodebuffer") throw new Error(this._outputType + " is not supported by this method");
1288
- return new v(this, { objectMode: this._outputType !== "nodebuffer" }, _);
1289
- } }, f.exports = u;
1290
- }, { "../base64": 1, "../external": 6, "../nodejs/NodejsStreamOutputAdapter": 13, "../support": 30, "../utils": 32, "./ConvertWorker": 24, "./GenericWorker": 28 }], 30: [function(e, f, a) {
1291
- if (a.base64 = !0, a.array = !0, a.string = !0, a.arraybuffer = typeof ArrayBuffer < "u" && typeof Uint8Array < "u", a.nodebuffer = typeof Buffer < "u", a.uint8array = typeof Uint8Array < "u", typeof ArrayBuffer > "u") a.blob = !1;
1292
- else {
1293
- var n = new ArrayBuffer(0);
1294
- try {
1295
- a.blob = new Blob([n], { type: "application/zip" }).size === 0;
1296
- } catch {
1297
- try {
1298
- var r = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
1299
- r.append(n), a.blob = r.getBlob("application/zip").size === 0;
1300
- } catch {
1301
- a.blob = !1;
1302
- }
1303
- }
1304
- }
1305
- try {
1306
- a.nodestream = !!e("readable-stream").Readable;
1307
- } catch {
1308
- a.nodestream = !1;
1309
- }
1310
- }, { "readable-stream": 16 }], 31: [function(e, f, a) {
1311
- for (var n = e("./utils"), r = e("./support"), i = e("./nodejsUtils"), l = e("./stream/GenericWorker"), p = new Array(256), w = 0; w < 256; w++) p[w] = 252 <= w ? 6 : 248 <= w ? 5 : 240 <= w ? 4 : 224 <= w ? 3 : 192 <= w ? 2 : 1;
1312
- p[254] = p[254] = 1;
1313
- function v() {
1314
- l.call(this, "utf-8 decode"), this.leftOver = null;
1315
- }
1316
- function x() {
1317
- l.call(this, "utf-8 encode");
1318
- }
1319
- a.utf8encode = function(u) {
1320
- return r.nodebuffer ? i.newBufferFrom(u, "utf-8") : (function(_) {
1321
- var o, g, h, b, S, z = _.length, E = 0;
1322
- for (b = 0; b < z; b++) (64512 & (g = _.charCodeAt(b))) == 55296 && b + 1 < z && (64512 & (h = _.charCodeAt(b + 1))) == 56320 && (g = 65536 + (g - 55296 << 10) + (h - 56320), b++), E += g < 128 ? 1 : g < 2048 ? 2 : g < 65536 ? 3 : 4;
1323
- for (o = r.uint8array ? new Uint8Array(E) : new Array(E), b = S = 0; S < E; b++) (64512 & (g = _.charCodeAt(b))) == 55296 && b + 1 < z && (64512 & (h = _.charCodeAt(b + 1))) == 56320 && (g = 65536 + (g - 55296 << 10) + (h - 56320), b++), g < 128 ? o[S++] = g : (g < 2048 ? o[S++] = 192 | g >>> 6 : (g < 65536 ? o[S++] = 224 | g >>> 12 : (o[S++] = 240 | g >>> 18, o[S++] = 128 | g >>> 12 & 63), o[S++] = 128 | g >>> 6 & 63), o[S++] = 128 | 63 & g);
1324
- return o;
1325
- })(u);
1326
- }, a.utf8decode = function(u) {
1327
- return r.nodebuffer ? n.transformTo("nodebuffer", u).toString("utf-8") : (function(_) {
1328
- var o, g, h, b, S = _.length, z = new Array(2 * S);
1329
- for (o = g = 0; o < S; ) if ((h = _[o++]) < 128) z[g++] = h;
1330
- else if (4 < (b = p[h])) z[g++] = 65533, o += b - 1;
1331
- else {
1332
- for (h &= b === 2 ? 31 : b === 3 ? 15 : 7; 1 < b && o < S; ) h = h << 6 | 63 & _[o++], b--;
1333
- 1 < b ? z[g++] = 65533 : h < 65536 ? z[g++] = h : (h -= 65536, z[g++] = 55296 | h >> 10 & 1023, z[g++] = 56320 | 1023 & h);
1334
- }
1335
- return z.length !== g && (z.subarray ? z = z.subarray(0, g) : z.length = g), n.applyFromCharCode(z);
1336
- })(u = n.transformTo(r.uint8array ? "uint8array" : "array", u));
1337
- }, n.inherits(v, l), v.prototype.processChunk = function(u) {
1338
- var _ = n.transformTo(r.uint8array ? "uint8array" : "array", u.data);
1339
- if (this.leftOver && this.leftOver.length) {
1340
- if (r.uint8array) {
1341
- var o = _;
1342
- (_ = new Uint8Array(o.length + this.leftOver.length)).set(this.leftOver, 0), _.set(o, this.leftOver.length);
1343
- } else _ = this.leftOver.concat(_);
1344
- this.leftOver = null;
1345
- }
1346
- var g = (function(b, S) {
1347
- var z;
1348
- for ((S = S || b.length) > b.length && (S = b.length), z = S - 1; 0 <= z && (192 & b[z]) == 128; ) z--;
1349
- return z < 0 || z === 0 ? S : z + p[b[z]] > S ? z : S;
1350
- })(_), h = _;
1351
- g !== _.length && (r.uint8array ? (h = _.subarray(0, g), this.leftOver = _.subarray(g, _.length)) : (h = _.slice(0, g), this.leftOver = _.slice(g, _.length))), this.push({ data: a.utf8decode(h), meta: u.meta });
1352
- }, v.prototype.flush = function() {
1353
- this.leftOver && this.leftOver.length && (this.push({ data: a.utf8decode(this.leftOver), meta: {} }), this.leftOver = null);
1354
- }, a.Utf8DecodeWorker = v, n.inherits(x, l), x.prototype.processChunk = function(u) {
1355
- this.push({ data: a.utf8encode(u.data), meta: u.meta });
1356
- }, a.Utf8EncodeWorker = x;
1357
- }, { "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./support": 30, "./utils": 32 }], 32: [function(e, f, a) {
1358
- var n = e("./support"), r = e("./base64"), i = e("./nodejsUtils"), l = e("./external");
1359
- function p(o) {
1360
- return o;
1361
- }
1362
- function w(o, g) {
1363
- for (var h = 0; h < o.length; ++h) g[h] = 255 & o.charCodeAt(h);
1364
- return g;
1365
- }
1366
- e("setimmediate"), a.newBlob = function(o, g) {
1367
- a.checkSupport("blob");
1368
- try {
1369
- return new Blob([o], { type: g });
1370
- } catch {
1371
- try {
1372
- var h = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
1373
- return h.append(o), h.getBlob(g);
1374
- } catch {
1375
- throw new Error("Bug : can't construct the Blob.");
1376
- }
1377
- }
1378
- };
1379
- var v = { stringifyByChunk: function(o, g, h) {
1380
- var b = [], S = 0, z = o.length;
1381
- if (z <= h) return String.fromCharCode.apply(null, o);
1382
- for (; S < z; ) g === "array" || g === "nodebuffer" ? b.push(String.fromCharCode.apply(null, o.slice(S, Math.min(S + h, z)))) : b.push(String.fromCharCode.apply(null, o.subarray(S, Math.min(S + h, z)))), S += h;
1383
- return b.join("");
1384
- }, stringifyByChar: function(o) {
1385
- for (var g = "", h = 0; h < o.length; h++) g += String.fromCharCode(o[h]);
1386
- return g;
1387
- }, applyCanBeUsed: { uint8array: (function() {
1388
- try {
1389
- return n.uint8array && String.fromCharCode.apply(null, new Uint8Array(1)).length === 1;
1390
- } catch {
1391
- return !1;
1392
- }
1393
- })(), nodebuffer: (function() {
1394
- try {
1395
- return n.nodebuffer && String.fromCharCode.apply(null, i.allocBuffer(1)).length === 1;
1396
- } catch {
1397
- return !1;
1398
- }
1399
- })() } };
1400
- function x(o) {
1401
- var g = 65536, h = a.getTypeOf(o), b = !0;
1402
- if (h === "uint8array" ? b = v.applyCanBeUsed.uint8array : h === "nodebuffer" && (b = v.applyCanBeUsed.nodebuffer), b) for (; 1 < g; ) try {
1403
- return v.stringifyByChunk(o, h, g);
1404
- } catch {
1405
- g = Math.floor(g / 2);
1406
- }
1407
- return v.stringifyByChar(o);
1408
- }
1409
- function u(o, g) {
1410
- for (var h = 0; h < o.length; h++) g[h] = o[h];
1411
- return g;
1412
- }
1413
- a.applyFromCharCode = x;
1414
- var _ = {};
1415
- _.string = { string: p, array: function(o) {
1416
- return w(o, new Array(o.length));
1417
- }, arraybuffer: function(o) {
1418
- return _.string.uint8array(o).buffer;
1419
- }, uint8array: function(o) {
1420
- return w(o, new Uint8Array(o.length));
1421
- }, nodebuffer: function(o) {
1422
- return w(o, i.allocBuffer(o.length));
1423
- } }, _.array = { string: x, array: p, arraybuffer: function(o) {
1424
- return new Uint8Array(o).buffer;
1425
- }, uint8array: function(o) {
1426
- return new Uint8Array(o);
1427
- }, nodebuffer: function(o) {
1428
- return i.newBufferFrom(o);
1429
- } }, _.arraybuffer = { string: function(o) {
1430
- return x(new Uint8Array(o));
1431
- }, array: function(o) {
1432
- return u(new Uint8Array(o), new Array(o.byteLength));
1433
- }, arraybuffer: p, uint8array: function(o) {
1434
- return new Uint8Array(o);
1435
- }, nodebuffer: function(o) {
1436
- return i.newBufferFrom(new Uint8Array(o));
1437
- } }, _.uint8array = { string: x, array: function(o) {
1438
- return u(o, new Array(o.length));
1439
- }, arraybuffer: function(o) {
1440
- return o.buffer;
1441
- }, uint8array: p, nodebuffer: function(o) {
1442
- return i.newBufferFrom(o);
1443
- } }, _.nodebuffer = { string: x, array: function(o) {
1444
- return u(o, new Array(o.length));
1445
- }, arraybuffer: function(o) {
1446
- return _.nodebuffer.uint8array(o).buffer;
1447
- }, uint8array: function(o) {
1448
- return u(o, new Uint8Array(o.length));
1449
- }, nodebuffer: p }, a.transformTo = function(o, g) {
1450
- if (g = g || "", !o) return g;
1451
- a.checkSupport(o);
1452
- var h = a.getTypeOf(g);
1453
- return _[h][o](g);
1454
- }, a.resolve = function(o) {
1455
- for (var g = o.split("/"), h = [], b = 0; b < g.length; b++) {
1456
- var S = g[b];
1457
- S === "." || S === "" && b !== 0 && b !== g.length - 1 || (S === ".." ? h.pop() : h.push(S));
1458
- }
1459
- return h.join("/");
1460
- }, a.getTypeOf = function(o) {
1461
- return typeof o == "string" ? "string" : Object.prototype.toString.call(o) === "[object Array]" ? "array" : n.nodebuffer && i.isBuffer(o) ? "nodebuffer" : n.uint8array && o instanceof Uint8Array ? "uint8array" : n.arraybuffer && o instanceof ArrayBuffer ? "arraybuffer" : void 0;
1462
- }, a.checkSupport = function(o) {
1463
- if (!n[o.toLowerCase()]) throw new Error(o + " is not supported by this platform");
1464
- }, a.MAX_VALUE_16BITS = 65535, a.MAX_VALUE_32BITS = -1, a.pretty = function(o) {
1465
- var g, h, b = "";
1466
- for (h = 0; h < (o || "").length; h++) b += "\\x" + ((g = o.charCodeAt(h)) < 16 ? "0" : "") + g.toString(16).toUpperCase();
1467
- return b;
1468
- }, a.delay = function(o, g, h) {
1469
- setImmediate(function() {
1470
- o.apply(h || null, g || []);
1471
- });
1472
- }, a.inherits = function(o, g) {
1473
- function h() {
1474
- }
1475
- h.prototype = g.prototype, o.prototype = new h();
1476
- }, a.extend = function() {
1477
- var o, g, h = {};
1478
- for (o = 0; o < arguments.length; o++) for (g in arguments[o]) Object.prototype.hasOwnProperty.call(arguments[o], g) && h[g] === void 0 && (h[g] = arguments[o][g]);
1479
- return h;
1480
- }, a.prepareContent = function(o, g, h, b, S) {
1481
- return l.Promise.resolve(g).then(function(z) {
1482
- return n.blob && (z instanceof Blob || ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(z)) !== -1) && typeof FileReader < "u" ? new l.Promise(function(E, R) {
1483
- var B = new FileReader();
1484
- B.onload = function(L) {
1485
- E(L.target.result);
1486
- }, B.onerror = function(L) {
1487
- R(L.target.error);
1488
- }, B.readAsArrayBuffer(z);
1489
- }) : z;
1490
- }).then(function(z) {
1491
- var E = a.getTypeOf(z);
1492
- return E ? (E === "arraybuffer" ? z = a.transformTo("uint8array", z) : E === "string" && (S ? z = r.decode(z) : h && b !== !0 && (z = (function(R) {
1493
- return w(R, n.uint8array ? new Uint8Array(R.length) : new Array(R.length));
1494
- })(z))), z) : l.Promise.reject(new Error("Can't read the data of '" + o + "'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));
1495
- });
1496
- };
1497
- }, { "./base64": 1, "./external": 6, "./nodejsUtils": 14, "./support": 30, setimmediate: 54 }], 33: [function(e, f, a) {
1498
- var n = e("./reader/readerFor"), r = e("./utils"), i = e("./signature"), l = e("./zipEntry"), p = e("./support");
1499
- function w(v) {
1500
- this.files = [], this.loadOptions = v;
1501
- }
1502
- w.prototype = { checkSignature: function(v) {
1503
- if (!this.reader.readAndCheckSignature(v)) {
1504
- this.reader.index -= 4;
1505
- var x = this.reader.readString(4);
1506
- throw new Error("Corrupted zip or bug: unexpected signature (" + r.pretty(x) + ", expected " + r.pretty(v) + ")");
1507
- }
1508
- }, isSignature: function(v, x) {
1509
- var u = this.reader.index;
1510
- this.reader.setIndex(v);
1511
- var _ = this.reader.readString(4) === x;
1512
- return this.reader.setIndex(u), _;
1513
- }, readBlockEndOfCentral: function() {
1514
- 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);
1515
- var v = this.reader.readData(this.zipCommentLength), x = p.uint8array ? "uint8array" : "array", u = r.transformTo(x, v);
1516
- this.zipComment = this.loadOptions.decodeFileName(u);
1517
- }, readBlockZip64EndOfCentral: function() {
1518
- 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 = {};
1519
- for (var v, x, u, _ = this.zip64EndOfCentralSize - 44; 0 < _; ) v = this.reader.readInt(2), x = this.reader.readInt(4), u = this.reader.readData(x), this.zip64ExtensibleData[v] = { id: v, length: x, value: u };
1520
- }, readBlockZip64EndOfCentralLocator: function() {
1521
- 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");
1522
- }, readLocalFiles: function() {
1523
- var v, x;
1524
- for (v = 0; v < this.files.length; v++) x = this.files[v], this.reader.setIndex(x.localHeaderOffset), this.checkSignature(i.LOCAL_FILE_HEADER), x.readLocalPart(this.reader), x.handleUTF8(), x.processAttributes();
1525
- }, readCentralDir: function() {
1526
- var v;
1527
- for (this.reader.setIndex(this.centralDirOffset); this.reader.readAndCheckSignature(i.CENTRAL_FILE_HEADER); ) (v = new l({ zip64: this.zip64 }, this.loadOptions)).readCentralPart(this.reader), this.files.push(v);
1528
- if (this.centralDirRecords !== this.files.length && this.centralDirRecords !== 0 && this.files.length === 0) throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length);
1529
- }, readEndOfCentral: function() {
1530
- var v = this.reader.lastIndexOfSignature(i.CENTRAL_DIRECTORY_END);
1531
- if (v < 0) throw this.isSignature(0, i.LOCAL_FILE_HEADER) ? new Error("Corrupted zip: can't find end of central directory") : 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");
1532
- this.reader.setIndex(v);
1533
- var x = v;
1534
- if (this.checkSignature(i.CENTRAL_DIRECTORY_END), this.readBlockEndOfCentral(), this.diskNumber === r.MAX_VALUE_16BITS || this.diskWithCentralDirStart === r.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === r.MAX_VALUE_16BITS || this.centralDirRecords === r.MAX_VALUE_16BITS || this.centralDirSize === r.MAX_VALUE_32BITS || this.centralDirOffset === r.MAX_VALUE_32BITS) {
1535
- if (this.zip64 = !0, (v = this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR)) < 0) throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");
1536
- if (this.reader.setIndex(v), this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR), this.readBlockZip64EndOfCentralLocator(), !this.isSignature(this.relativeOffsetEndOfZip64CentralDir, i.ZIP64_CENTRAL_DIRECTORY_END) && (this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_END), this.relativeOffsetEndOfZip64CentralDir < 0)) throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");
1537
- this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir), this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_END), this.readBlockZip64EndOfCentral();
1538
- }
1539
- var u = this.centralDirOffset + this.centralDirSize;
1540
- this.zip64 && (u += 20, u += 12 + this.zip64EndOfCentralSize);
1541
- var _ = x - u;
1542
- if (0 < _) this.isSignature(x, i.CENTRAL_FILE_HEADER) || (this.reader.zero = _);
1543
- else if (_ < 0) throw new Error("Corrupted zip: missing " + Math.abs(_) + " bytes.");
1544
- }, prepareReader: function(v) {
1545
- this.reader = n(v);
1546
- }, load: function(v) {
1547
- this.prepareReader(v), this.readEndOfCentral(), this.readCentralDir(), this.readLocalFiles();
1548
- } }, f.exports = w;
1549
- }, { "./reader/readerFor": 22, "./signature": 23, "./support": 30, "./utils": 32, "./zipEntry": 34 }], 34: [function(e, f, a) {
1550
- var n = e("./reader/readerFor"), r = e("./utils"), i = e("./compressedObject"), l = e("./crc32"), p = e("./utf8"), w = e("./compressions"), v = e("./support");
1551
- function x(u, _) {
1552
- this.options = u, this.loadOptions = _;
1553
- }
1554
- x.prototype = { isEncrypted: function() {
1555
- return (1 & this.bitFlag) == 1;
1556
- }, useUTF8: function() {
1557
- return (2048 & this.bitFlag) == 2048;
1558
- }, readLocalPart: function(u) {
1559
- var _, o;
1560
- if (u.skip(22), this.fileNameLength = u.readInt(2), o = u.readInt(2), this.fileName = u.readData(this.fileNameLength), u.skip(o), this.compressedSize === -1 || this.uncompressedSize === -1) throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");
1561
- if ((_ = (function(g) {
1562
- for (var h in w) if (Object.prototype.hasOwnProperty.call(w, h) && w[h].magic === g) return w[h];
1563
- return null;
1564
- })(this.compressionMethod)) === null) throw new Error("Corrupted zip : compression " + r.pretty(this.compressionMethod) + " unknown (inner file : " + r.transformTo("string", this.fileName) + ")");
1565
- this.decompressed = new i(this.compressedSize, this.uncompressedSize, this.crc32, _, u.readData(this.compressedSize));
1566
- }, readCentralPart: function(u) {
1567
- this.versionMadeBy = u.readInt(2), u.skip(2), this.bitFlag = u.readInt(2), this.compressionMethod = u.readString(2), this.date = u.readDate(), this.crc32 = u.readInt(4), this.compressedSize = u.readInt(4), this.uncompressedSize = u.readInt(4);
1568
- var _ = u.readInt(2);
1569
- if (this.extraFieldsLength = u.readInt(2), this.fileCommentLength = u.readInt(2), this.diskNumberStart = u.readInt(2), this.internalFileAttributes = u.readInt(2), this.externalFileAttributes = u.readInt(4), this.localHeaderOffset = u.readInt(4), this.isEncrypted()) throw new Error("Encrypted zip are not supported");
1570
- u.skip(_), this.readExtraFields(u), this.parseZIP64ExtraField(u), this.fileComment = u.readData(this.fileCommentLength);
1571
- }, processAttributes: function() {
1572
- this.unixPermissions = null, this.dosPermissions = null;
1573
- var u = this.versionMadeBy >> 8;
1574
- this.dir = !!(16 & this.externalFileAttributes), u == 0 && (this.dosPermissions = 63 & this.externalFileAttributes), u == 3 && (this.unixPermissions = this.externalFileAttributes >> 16 & 65535), this.dir || this.fileNameStr.slice(-1) !== "/" || (this.dir = !0);
1575
- }, parseZIP64ExtraField: function() {
1576
- if (this.extraFields[1]) {
1577
- var u = n(this.extraFields[1].value);
1578
- this.uncompressedSize === r.MAX_VALUE_32BITS && (this.uncompressedSize = u.readInt(8)), this.compressedSize === r.MAX_VALUE_32BITS && (this.compressedSize = u.readInt(8)), this.localHeaderOffset === r.MAX_VALUE_32BITS && (this.localHeaderOffset = u.readInt(8)), this.diskNumberStart === r.MAX_VALUE_32BITS && (this.diskNumberStart = u.readInt(4));
1579
- }
1580
- }, readExtraFields: function(u) {
1581
- var _, o, g, h = u.index + this.extraFieldsLength;
1582
- for (this.extraFields || (this.extraFields = {}); u.index + 4 < h; ) _ = u.readInt(2), o = u.readInt(2), g = u.readData(o), this.extraFields[_] = { id: _, length: o, value: g };
1583
- u.setIndex(h);
1584
- }, handleUTF8: function() {
1585
- var u = v.uint8array ? "uint8array" : "array";
1586
- if (this.useUTF8()) this.fileNameStr = p.utf8decode(this.fileName), this.fileCommentStr = p.utf8decode(this.fileComment);
1587
- else {
1588
- var _ = this.findExtraFieldUnicodePath();
1589
- if (_ !== null) this.fileNameStr = _;
1590
- else {
1591
- var o = r.transformTo(u, this.fileName);
1592
- this.fileNameStr = this.loadOptions.decodeFileName(o);
1593
- }
1594
- var g = this.findExtraFieldUnicodeComment();
1595
- if (g !== null) this.fileCommentStr = g;
1596
- else {
1597
- var h = r.transformTo(u, this.fileComment);
1598
- this.fileCommentStr = this.loadOptions.decodeFileName(h);
1599
- }
1600
- }
1601
- }, findExtraFieldUnicodePath: function() {
1602
- var u = this.extraFields[28789];
1603
- if (u) {
1604
- var _ = n(u.value);
1605
- return _.readInt(1) !== 1 || l(this.fileName) !== _.readInt(4) ? null : p.utf8decode(_.readData(u.length - 5));
1606
- }
1607
- return null;
1608
- }, findExtraFieldUnicodeComment: function() {
1609
- var u = this.extraFields[25461];
1610
- if (u) {
1611
- var _ = n(u.value);
1612
- return _.readInt(1) !== 1 || l(this.fileComment) !== _.readInt(4) ? null : p.utf8decode(_.readData(u.length - 5));
1613
- }
1614
- return null;
1615
- } }, f.exports = x;
1616
- }, { "./compressedObject": 2, "./compressions": 3, "./crc32": 4, "./reader/readerFor": 22, "./support": 30, "./utf8": 31, "./utils": 32 }], 35: [function(e, f, a) {
1617
- function n(_, o, g) {
1618
- this.name = _, this.dir = g.dir, this.date = g.date, this.comment = g.comment, this.unixPermissions = g.unixPermissions, this.dosPermissions = g.dosPermissions, this._data = o, this._dataBinary = g.binary, this.options = { compression: g.compression, compressionOptions: g.compressionOptions };
1619
- }
1620
- var r = e("./stream/StreamHelper"), i = e("./stream/DataWorker"), l = e("./utf8"), p = e("./compressedObject"), w = e("./stream/GenericWorker");
1621
- n.prototype = { internalStream: function(_) {
1622
- var o = null, g = "string";
1623
- try {
1624
- if (!_) throw new Error("No output type specified.");
1625
- var h = (g = _.toLowerCase()) === "string" || g === "text";
1626
- g !== "binarystring" && g !== "text" || (g = "string"), o = this._decompressWorker();
1627
- var b = !this._dataBinary;
1628
- b && !h && (o = o.pipe(new l.Utf8EncodeWorker())), !b && h && (o = o.pipe(new l.Utf8DecodeWorker()));
1629
- } catch (S) {
1630
- (o = new w("error")).error(S);
1631
- }
1632
- return new r(o, g, "");
1633
- }, async: function(_, o) {
1634
- return this.internalStream(_).accumulate(o);
1635
- }, nodeStream: function(_, o) {
1636
- return this.internalStream(_ || "nodebuffer").toNodejsStream(o);
1637
- }, _compressWorker: function(_, o) {
1638
- if (this._data instanceof p && this._data.compression.magic === _.magic) return this._data.getCompressedWorker();
1639
- var g = this._decompressWorker();
1640
- return this._dataBinary || (g = g.pipe(new l.Utf8EncodeWorker())), p.createWorkerFrom(g, _, o);
1641
- }, _decompressWorker: function() {
1642
- return this._data instanceof p ? this._data.getContentWorker() : this._data instanceof w ? this._data : new i(this._data);
1643
- } };
1644
- for (var v = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"], x = function() {
1645
- throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
1646
- }, u = 0; u < v.length; u++) n.prototype[v[u]] = x;
1647
- f.exports = n;
1648
- }, { "./compressedObject": 2, "./stream/DataWorker": 27, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31 }], 36: [function(e, f, a) {
1649
- (function(n) {
1650
- var r, i, l = n.MutationObserver || n.WebKitMutationObserver;
1651
- if (l) {
1652
- var p = 0, w = new l(_), v = n.document.createTextNode("");
1653
- w.observe(v, { characterData: !0 }), r = function() {
1654
- v.data = p = ++p % 2;
1655
- };
1656
- } else if (n.setImmediate || n.MessageChannel === void 0) r = "document" in n && "onreadystatechange" in n.document.createElement("script") ? function() {
1657
- var o = n.document.createElement("script");
1658
- o.onreadystatechange = function() {
1659
- _(), o.onreadystatechange = null, o.parentNode.removeChild(o), o = null;
1660
- }, n.document.documentElement.appendChild(o);
1661
- } : function() {
1662
- setTimeout(_, 0);
1663
- };
1664
- else {
1665
- var x = new n.MessageChannel();
1666
- x.port1.onmessage = _, r = function() {
1667
- x.port2.postMessage(0);
1668
- };
1669
- }
1670
- var u = [];
1671
- function _() {
1672
- var o, g;
1673
- i = !0;
1674
- for (var h = u.length; h; ) {
1675
- for (g = u, u = [], o = -1; ++o < h; ) g[o]();
1676
- h = u.length;
1677
- }
1678
- i = !1;
1679
- }
1680
- f.exports = function(o) {
1681
- u.push(o) !== 1 || i || r();
1682
- };
1683
- }).call(this, typeof zt < "u" ? zt : typeof self < "u" ? self : typeof window < "u" ? window : {});
1684
- }, {}], 37: [function(e, f, a) {
1685
- var n = e("immediate");
1686
- function r() {
1687
- }
1688
- var i = {}, l = ["REJECTED"], p = ["FULFILLED"], w = ["PENDING"];
1689
- function v(h) {
1690
- if (typeof h != "function") throw new TypeError("resolver must be a function");
1691
- this.state = w, this.queue = [], this.outcome = void 0, h !== r && o(this, h);
1692
- }
1693
- function x(h, b, S) {
1694
- this.promise = h, typeof b == "function" && (this.onFulfilled = b, this.callFulfilled = this.otherCallFulfilled), typeof S == "function" && (this.onRejected = S, this.callRejected = this.otherCallRejected);
1695
- }
1696
- function u(h, b, S) {
1697
- n(function() {
1698
- var z;
1699
- try {
1700
- z = b(S);
1701
- } catch (E) {
1702
- return i.reject(h, E);
1703
- }
1704
- z === h ? i.reject(h, new TypeError("Cannot resolve promise with itself")) : i.resolve(h, z);
1705
- });
1706
- }
1707
- function _(h) {
1708
- var b = h && h.then;
1709
- if (h && (typeof h == "object" || typeof h == "function") && typeof b == "function") return function() {
1710
- b.apply(h, arguments);
1711
- };
1712
- }
1713
- function o(h, b) {
1714
- var S = !1;
1715
- function z(B) {
1716
- S || (S = !0, i.reject(h, B));
1717
- }
1718
- function E(B) {
1719
- S || (S = !0, i.resolve(h, B));
1720
- }
1721
- var R = g(function() {
1722
- b(E, z);
1723
- });
1724
- R.status === "error" && z(R.value);
1725
- }
1726
- function g(h, b) {
1727
- var S = {};
1728
- try {
1729
- S.value = h(b), S.status = "success";
1730
- } catch (z) {
1731
- S.status = "error", S.value = z;
1732
- }
1733
- return S;
1734
- }
1735
- (f.exports = v).prototype.finally = function(h) {
1736
- if (typeof h != "function") return this;
1737
- var b = this.constructor;
1738
- return this.then(function(S) {
1739
- return b.resolve(h()).then(function() {
1740
- return S;
1741
- });
1742
- }, function(S) {
1743
- return b.resolve(h()).then(function() {
1744
- throw S;
1745
- });
1746
- });
1747
- }, v.prototype.catch = function(h) {
1748
- return this.then(null, h);
1749
- }, v.prototype.then = function(h, b) {
1750
- if (typeof h != "function" && this.state === p || typeof b != "function" && this.state === l) return this;
1751
- var S = new this.constructor(r);
1752
- return this.state !== w ? u(S, this.state === p ? h : b, this.outcome) : this.queue.push(new x(S, h, b)), S;
1753
- }, x.prototype.callFulfilled = function(h) {
1754
- i.resolve(this.promise, h);
1755
- }, x.prototype.otherCallFulfilled = function(h) {
1756
- u(this.promise, this.onFulfilled, h);
1757
- }, x.prototype.callRejected = function(h) {
1758
- i.reject(this.promise, h);
1759
- }, x.prototype.otherCallRejected = function(h) {
1760
- u(this.promise, this.onRejected, h);
1761
- }, i.resolve = function(h, b) {
1762
- var S = g(_, b);
1763
- if (S.status === "error") return i.reject(h, S.value);
1764
- var z = S.value;
1765
- if (z) o(h, z);
1766
- else {
1767
- h.state = p, h.outcome = b;
1768
- for (var E = -1, R = h.queue.length; ++E < R; ) h.queue[E].callFulfilled(b);
1769
- }
1770
- return h;
1771
- }, i.reject = function(h, b) {
1772
- h.state = l, h.outcome = b;
1773
- for (var S = -1, z = h.queue.length; ++S < z; ) h.queue[S].callRejected(b);
1774
- return h;
1775
- }, v.resolve = function(h) {
1776
- return h instanceof this ? h : i.resolve(new this(r), h);
1777
- }, v.reject = function(h) {
1778
- var b = new this(r);
1779
- return i.reject(b, h);
1780
- }, v.all = function(h) {
1781
- var b = this;
1782
- if (Object.prototype.toString.call(h) !== "[object Array]") return this.reject(new TypeError("must be an array"));
1783
- var S = h.length, z = !1;
1784
- if (!S) return this.resolve([]);
1785
- for (var E = new Array(S), R = 0, B = -1, L = new this(r); ++B < S; ) P(h[B], B);
1786
- return L;
1787
- function P(W, Y) {
1788
- b.resolve(W).then(function(k) {
1789
- E[Y] = k, ++R !== S || z || (z = !0, i.resolve(L, E));
1790
- }, function(k) {
1791
- z || (z = !0, i.reject(L, k));
1792
- });
1793
- }
1794
- }, v.race = function(h) {
1795
- var b = this;
1796
- if (Object.prototype.toString.call(h) !== "[object Array]") return this.reject(new TypeError("must be an array"));
1797
- var S = h.length, z = !1;
1798
- if (!S) return this.resolve([]);
1799
- for (var E = -1, R = new this(r); ++E < S; ) B = h[E], b.resolve(B).then(function(L) {
1800
- z || (z = !0, i.resolve(R, L));
1801
- }, function(L) {
1802
- z || (z = !0, i.reject(R, L));
1803
- });
1804
- var B;
1805
- return R;
1806
- };
1807
- }, { immediate: 36 }], 38: [function(e, f, a) {
1808
- var n = {};
1809
- (0, e("./lib/utils/common").assign)(n, e("./lib/deflate"), e("./lib/inflate"), e("./lib/zlib/constants")), f.exports = n;
1810
- }, { "./lib/deflate": 39, "./lib/inflate": 40, "./lib/utils/common": 41, "./lib/zlib/constants": 44 }], 39: [function(e, f, a) {
1811
- var n = e("./zlib/deflate"), r = e("./utils/common"), i = e("./utils/strings"), l = e("./zlib/messages"), p = e("./zlib/zstream"), w = Object.prototype.toString, v = 0, x = -1, u = 0, _ = 8;
1812
- function o(h) {
1813
- if (!(this instanceof o)) return new o(h);
1814
- this.options = r.assign({ level: x, method: _, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: u, to: "" }, h || {});
1815
- var b = this.options;
1816
- b.raw && 0 < b.windowBits ? b.windowBits = -b.windowBits : b.gzip && 0 < b.windowBits && b.windowBits < 16 && (b.windowBits += 16), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new p(), this.strm.avail_out = 0;
1817
- var S = n.deflateInit2(this.strm, b.level, b.method, b.windowBits, b.memLevel, b.strategy);
1818
- if (S !== v) throw new Error(l[S]);
1819
- if (b.header && n.deflateSetHeader(this.strm, b.header), b.dictionary) {
1820
- var z;
1821
- if (z = typeof b.dictionary == "string" ? i.string2buf(b.dictionary) : w.call(b.dictionary) === "[object ArrayBuffer]" ? new Uint8Array(b.dictionary) : b.dictionary, (S = n.deflateSetDictionary(this.strm, z)) !== v) throw new Error(l[S]);
1822
- this._dict_set = !0;
1823
- }
1824
- }
1825
- function g(h, b) {
1826
- var S = new o(b);
1827
- if (S.push(h, !0), S.err) throw S.msg || l[S.err];
1828
- return S.result;
1829
- }
1830
- o.prototype.push = function(h, b) {
1831
- var S, z, E = this.strm, R = this.options.chunkSize;
1832
- if (this.ended) return !1;
1833
- z = b === ~~b ? b : b === !0 ? 4 : 0, typeof h == "string" ? E.input = i.string2buf(h) : w.call(h) === "[object ArrayBuffer]" ? E.input = new Uint8Array(h) : E.input = h, E.next_in = 0, E.avail_in = E.input.length;
1834
- do {
1835
- if (E.avail_out === 0 && (E.output = new r.Buf8(R), E.next_out = 0, E.avail_out = R), (S = n.deflate(E, z)) !== 1 && S !== v) return this.onEnd(S), !(this.ended = !0);
1836
- E.avail_out !== 0 && (E.avail_in !== 0 || z !== 4 && z !== 2) || (this.options.to === "string" ? this.onData(i.buf2binstring(r.shrinkBuf(E.output, E.next_out))) : this.onData(r.shrinkBuf(E.output, E.next_out)));
1837
- } while ((0 < E.avail_in || E.avail_out === 0) && S !== 1);
1838
- return z === 4 ? (S = n.deflateEnd(this.strm), this.onEnd(S), this.ended = !0, S === v) : z !== 2 || (this.onEnd(v), !(E.avail_out = 0));
1839
- }, o.prototype.onData = function(h) {
1840
- this.chunks.push(h);
1841
- }, o.prototype.onEnd = function(h) {
1842
- h === v && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = r.flattenChunks(this.chunks)), this.chunks = [], this.err = h, this.msg = this.strm.msg;
1843
- }, a.Deflate = o, a.deflate = g, a.deflateRaw = function(h, b) {
1844
- return (b = b || {}).raw = !0, g(h, b);
1845
- }, a.gzip = function(h, b) {
1846
- return (b = b || {}).gzip = !0, g(h, b);
1847
- };
1848
- }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/deflate": 46, "./zlib/messages": 51, "./zlib/zstream": 53 }], 40: [function(e, f, a) {
1849
- var n = e("./zlib/inflate"), r = e("./utils/common"), i = e("./utils/strings"), l = e("./zlib/constants"), p = e("./zlib/messages"), w = e("./zlib/zstream"), v = e("./zlib/gzheader"), x = Object.prototype.toString;
1850
- function u(o) {
1851
- if (!(this instanceof u)) return new u(o);
1852
- this.options = r.assign({ chunkSize: 16384, windowBits: 0, to: "" }, o || {});
1853
- var g = this.options;
1854
- g.raw && 0 <= g.windowBits && g.windowBits < 16 && (g.windowBits = -g.windowBits, g.windowBits === 0 && (g.windowBits = -15)), !(0 <= g.windowBits && g.windowBits < 16) || o && o.windowBits || (g.windowBits += 32), 15 < g.windowBits && g.windowBits < 48 && (15 & g.windowBits) == 0 && (g.windowBits |= 15), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new w(), this.strm.avail_out = 0;
1855
- var h = n.inflateInit2(this.strm, g.windowBits);
1856
- if (h !== l.Z_OK) throw new Error(p[h]);
1857
- this.header = new v(), n.inflateGetHeader(this.strm, this.header);
1858
- }
1859
- function _(o, g) {
1860
- var h = new u(g);
1861
- if (h.push(o, !0), h.err) throw h.msg || p[h.err];
1862
- return h.result;
1863
- }
1864
- u.prototype.push = function(o, g) {
1865
- var h, b, S, z, E, R, B = this.strm, L = this.options.chunkSize, P = this.options.dictionary, W = !1;
1866
- if (this.ended) return !1;
1867
- b = g === ~~g ? g : g === !0 ? l.Z_FINISH : l.Z_NO_FLUSH, typeof o == "string" ? B.input = i.binstring2buf(o) : x.call(o) === "[object ArrayBuffer]" ? B.input = new Uint8Array(o) : B.input = o, B.next_in = 0, B.avail_in = B.input.length;
1868
- do {
1869
- if (B.avail_out === 0 && (B.output = new r.Buf8(L), B.next_out = 0, B.avail_out = L), (h = n.inflate(B, l.Z_NO_FLUSH)) === l.Z_NEED_DICT && P && (R = typeof P == "string" ? i.string2buf(P) : x.call(P) === "[object ArrayBuffer]" ? new Uint8Array(P) : P, h = n.inflateSetDictionary(this.strm, R)), h === l.Z_BUF_ERROR && W === !0 && (h = l.Z_OK, W = !1), h !== l.Z_STREAM_END && h !== l.Z_OK) return this.onEnd(h), !(this.ended = !0);
1870
- B.next_out && (B.avail_out !== 0 && h !== l.Z_STREAM_END && (B.avail_in !== 0 || b !== l.Z_FINISH && b !== l.Z_SYNC_FLUSH) || (this.options.to === "string" ? (S = i.utf8border(B.output, B.next_out), z = B.next_out - S, E = i.buf2string(B.output, S), B.next_out = z, B.avail_out = L - z, z && r.arraySet(B.output, B.output, S, z, 0), this.onData(E)) : this.onData(r.shrinkBuf(B.output, B.next_out)))), B.avail_in === 0 && B.avail_out === 0 && (W = !0);
1871
- } while ((0 < B.avail_in || B.avail_out === 0) && h !== l.Z_STREAM_END);
1872
- return h === l.Z_STREAM_END && (b = l.Z_FINISH), b === l.Z_FINISH ? (h = n.inflateEnd(this.strm), this.onEnd(h), this.ended = !0, h === l.Z_OK) : b !== l.Z_SYNC_FLUSH || (this.onEnd(l.Z_OK), !(B.avail_out = 0));
1873
- }, u.prototype.onData = function(o) {
1874
- this.chunks.push(o);
1875
- }, u.prototype.onEnd = function(o) {
1876
- o === l.Z_OK && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = r.flattenChunks(this.chunks)), this.chunks = [], this.err = o, this.msg = this.strm.msg;
1877
- }, a.Inflate = u, a.inflate = _, a.inflateRaw = function(o, g) {
1878
- return (g = g || {}).raw = !0, _(o, g);
1879
- }, a.ungzip = _;
1880
- }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/constants": 44, "./zlib/gzheader": 47, "./zlib/inflate": 49, "./zlib/messages": 51, "./zlib/zstream": 53 }], 41: [function(e, f, a) {
1881
- var n = typeof Uint8Array < "u" && typeof Uint16Array < "u" && typeof Int32Array < "u";
1882
- a.assign = function(l) {
1883
- for (var p = Array.prototype.slice.call(arguments, 1); p.length; ) {
1884
- var w = p.shift();
1885
- if (w) {
1886
- if (typeof w != "object") throw new TypeError(w + "must be non-object");
1887
- for (var v in w) w.hasOwnProperty(v) && (l[v] = w[v]);
1888
- }
1889
- }
1890
- return l;
1891
- }, a.shrinkBuf = function(l, p) {
1892
- return l.length === p ? l : l.subarray ? l.subarray(0, p) : (l.length = p, l);
1893
- };
1894
- var r = { arraySet: function(l, p, w, v, x) {
1895
- if (p.subarray && l.subarray) l.set(p.subarray(w, w + v), x);
1896
- else for (var u = 0; u < v; u++) l[x + u] = p[w + u];
1897
- }, flattenChunks: function(l) {
1898
- var p, w, v, x, u, _;
1899
- for (p = v = 0, w = l.length; p < w; p++) v += l[p].length;
1900
- for (_ = new Uint8Array(v), p = x = 0, w = l.length; p < w; p++) u = l[p], _.set(u, x), x += u.length;
1901
- return _;
1902
- } }, i = { arraySet: function(l, p, w, v, x) {
1903
- for (var u = 0; u < v; u++) l[x + u] = p[w + u];
1904
- }, flattenChunks: function(l) {
1905
- return [].concat.apply([], l);
1906
- } };
1907
- a.setTyped = function(l) {
1908
- l ? (a.Buf8 = Uint8Array, a.Buf16 = Uint16Array, a.Buf32 = Int32Array, a.assign(a, r)) : (a.Buf8 = Array, a.Buf16 = Array, a.Buf32 = Array, a.assign(a, i));
1909
- }, a.setTyped(n);
1910
- }, {}], 42: [function(e, f, a) {
1911
- var n = e("./common"), r = !0, i = !0;
1912
- try {
1913
- String.fromCharCode.apply(null, [0]);
1914
- } catch {
1915
- r = !1;
1916
- }
1917
- try {
1918
- String.fromCharCode.apply(null, new Uint8Array(1));
1919
- } catch {
1920
- i = !1;
1921
- }
1922
- for (var l = new n.Buf8(256), p = 0; p < 256; p++) l[p] = 252 <= p ? 6 : 248 <= p ? 5 : 240 <= p ? 4 : 224 <= p ? 3 : 192 <= p ? 2 : 1;
1923
- function w(v, x) {
1924
- if (x < 65537 && (v.subarray && i || !v.subarray && r)) return String.fromCharCode.apply(null, n.shrinkBuf(v, x));
1925
- for (var u = "", _ = 0; _ < x; _++) u += String.fromCharCode(v[_]);
1926
- return u;
1927
- }
1928
- l[254] = l[254] = 1, a.string2buf = function(v) {
1929
- var x, u, _, o, g, h = v.length, b = 0;
1930
- for (o = 0; o < h; o++) (64512 & (u = v.charCodeAt(o))) == 55296 && o + 1 < h && (64512 & (_ = v.charCodeAt(o + 1))) == 56320 && (u = 65536 + (u - 55296 << 10) + (_ - 56320), o++), b += u < 128 ? 1 : u < 2048 ? 2 : u < 65536 ? 3 : 4;
1931
- for (x = new n.Buf8(b), o = g = 0; g < b; o++) (64512 & (u = v.charCodeAt(o))) == 55296 && o + 1 < h && (64512 & (_ = v.charCodeAt(o + 1))) == 56320 && (u = 65536 + (u - 55296 << 10) + (_ - 56320), o++), u < 128 ? x[g++] = u : (u < 2048 ? x[g++] = 192 | u >>> 6 : (u < 65536 ? x[g++] = 224 | u >>> 12 : (x[g++] = 240 | u >>> 18, x[g++] = 128 | u >>> 12 & 63), x[g++] = 128 | u >>> 6 & 63), x[g++] = 128 | 63 & u);
1932
- return x;
1933
- }, a.buf2binstring = function(v) {
1934
- return w(v, v.length);
1935
- }, a.binstring2buf = function(v) {
1936
- for (var x = new n.Buf8(v.length), u = 0, _ = x.length; u < _; u++) x[u] = v.charCodeAt(u);
1937
- return x;
1938
- }, a.buf2string = function(v, x) {
1939
- var u, _, o, g, h = x || v.length, b = new Array(2 * h);
1940
- for (u = _ = 0; u < h; ) if ((o = v[u++]) < 128) b[_++] = o;
1941
- else if (4 < (g = l[o])) b[_++] = 65533, u += g - 1;
1942
- else {
1943
- for (o &= g === 2 ? 31 : g === 3 ? 15 : 7; 1 < g && u < h; ) o = o << 6 | 63 & v[u++], g--;
1944
- 1 < g ? b[_++] = 65533 : o < 65536 ? b[_++] = o : (o -= 65536, b[_++] = 55296 | o >> 10 & 1023, b[_++] = 56320 | 1023 & o);
1945
- }
1946
- return w(b, _);
1947
- }, a.utf8border = function(v, x) {
1948
- var u;
1949
- for ((x = x || v.length) > v.length && (x = v.length), u = x - 1; 0 <= u && (192 & v[u]) == 128; ) u--;
1950
- return u < 0 || u === 0 ? x : u + l[v[u]] > x ? u : x;
1951
- };
1952
- }, { "./common": 41 }], 43: [function(e, f, a) {
1953
- f.exports = function(n, r, i, l) {
1954
- for (var p = 65535 & n | 0, w = n >>> 16 & 65535 | 0, v = 0; i !== 0; ) {
1955
- for (i -= v = 2e3 < i ? 2e3 : i; w = w + (p = p + r[l++] | 0) | 0, --v; ) ;
1956
- p %= 65521, w %= 65521;
1957
- }
1958
- return p | w << 16 | 0;
1959
- };
1960
- }, {}], 44: [function(e, f, a) {
1961
- f.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 };
1962
- }, {}], 45: [function(e, f, a) {
1963
- var n = (function() {
1964
- for (var r, i = [], l = 0; l < 256; l++) {
1965
- r = l;
1966
- for (var p = 0; p < 8; p++) r = 1 & r ? 3988292384 ^ r >>> 1 : r >>> 1;
1967
- i[l] = r;
1968
- }
1969
- return i;
1970
- })();
1971
- f.exports = function(r, i, l, p) {
1972
- var w = n, v = p + l;
1973
- r ^= -1;
1974
- for (var x = p; x < v; x++) r = r >>> 8 ^ w[255 & (r ^ i[x])];
1975
- return -1 ^ r;
1976
- };
1977
- }, {}], 46: [function(e, f, a) {
1978
- var n, r = e("../utils/common"), i = e("./trees"), l = e("./adler32"), p = e("./crc32"), w = e("./messages"), v = 0, x = 4, u = 0, _ = -2, o = -1, g = 4, h = 2, b = 8, S = 9, z = 286, E = 30, R = 19, B = 2 * z + 1, L = 15, P = 3, W = 258, Y = W + P + 1, k = 42, F = 113, s = 1, j = 2, Q = 3, U = 4;
1979
- function tt(t, D) {
1980
- return t.msg = w[D], D;
1981
- }
1982
- function M(t) {
1983
- return (t << 1) - (4 < t ? 9 : 0);
1984
- }
1985
- function q(t) {
1986
- for (var D = t.length; 0 <= --D; ) t[D] = 0;
1987
- }
1988
- function O(t) {
1989
- var D = t.state, T = D.pending;
1990
- T > t.avail_out && (T = t.avail_out), T !== 0 && (r.arraySet(t.output, D.pending_buf, D.pending_out, T, t.next_out), t.next_out += T, D.pending_out += T, t.total_out += T, t.avail_out -= T, D.pending -= T, D.pending === 0 && (D.pending_out = 0));
1991
- }
1992
- function I(t, D) {
1993
- i._tr_flush_block(t, 0 <= t.block_start ? t.block_start : -1, t.strstart - t.block_start, D), t.block_start = t.strstart, O(t.strm);
1994
- }
1995
- function J(t, D) {
1996
- t.pending_buf[t.pending++] = D;
1997
- }
1998
- function G(t, D) {
1999
- t.pending_buf[t.pending++] = D >>> 8 & 255, t.pending_buf[t.pending++] = 255 & D;
2000
- }
2001
- function X(t, D) {
2002
- var T, y, m = t.max_chain_length, C = t.strstart, N = t.prev_length, $ = t.nice_match, A = t.strstart > t.w_size - Y ? t.strstart - (t.w_size - Y) : 0, Z = t.window, K = t.w_mask, H = t.prev, V = t.strstart + W, it = Z[C + N - 1], rt = Z[C + N];
2003
- t.prev_length >= t.good_match && (m >>= 2), $ > t.lookahead && ($ = t.lookahead);
2004
- do
2005
- if (Z[(T = D) + N] === rt && Z[T + N - 1] === it && Z[T] === Z[C] && Z[++T] === Z[C + 1]) {
2006
- C += 2, T++;
2007
- do
2008
- ;
2009
- while (Z[++C] === Z[++T] && Z[++C] === Z[++T] && Z[++C] === Z[++T] && Z[++C] === Z[++T] && Z[++C] === Z[++T] && Z[++C] === Z[++T] && Z[++C] === Z[++T] && Z[++C] === Z[++T] && C < V);
2010
- if (y = W - (V - C), C = V - W, N < y) {
2011
- if (t.match_start = D, $ <= (N = y)) break;
2012
- it = Z[C + N - 1], rt = Z[C + N];
2013
- }
2014
- }
2015
- while ((D = H[D & K]) > A && --m != 0);
2016
- return N <= t.lookahead ? N : t.lookahead;
2017
- }
2018
- function st(t) {
2019
- var D, T, y, m, C, N, $, A, Z, K, H = t.w_size;
2020
- do {
2021
- if (m = t.window_size - t.lookahead - t.strstart, t.strstart >= H + (H - Y)) {
2022
- for (r.arraySet(t.window, t.window, H, H, 0), t.match_start -= H, t.strstart -= H, t.block_start -= H, D = T = t.hash_size; y = t.head[--D], t.head[D] = H <= y ? y - H : 0, --T; ) ;
2023
- for (D = T = H; y = t.prev[--D], t.prev[D] = H <= y ? y - H : 0, --T; ) ;
2024
- m += H;
2025
- }
2026
- if (t.strm.avail_in === 0) break;
2027
- if (N = t.strm, $ = t.window, A = t.strstart + t.lookahead, Z = m, K = void 0, K = N.avail_in, Z < K && (K = Z), T = K === 0 ? 0 : (N.avail_in -= K, r.arraySet($, N.input, N.next_in, K, A), N.state.wrap === 1 ? N.adler = l(N.adler, $, K, A) : N.state.wrap === 2 && (N.adler = p(N.adler, $, K, A)), N.next_in += K, N.total_in += K, K), t.lookahead += T, t.lookahead + t.insert >= P) for (C = t.strstart - t.insert, t.ins_h = t.window[C], t.ins_h = (t.ins_h << t.hash_shift ^ t.window[C + 1]) & t.hash_mask; t.insert && (t.ins_h = (t.ins_h << t.hash_shift ^ t.window[C + P - 1]) & t.hash_mask, t.prev[C & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = C, C++, t.insert--, !(t.lookahead + t.insert < P)); ) ;
2028
- } while (t.lookahead < Y && t.strm.avail_in !== 0);
2029
- }
2030
- function lt(t, D) {
2031
- for (var T, y; ; ) {
2032
- if (t.lookahead < Y) {
2033
- if (st(t), t.lookahead < Y && D === v) return s;
2034
- if (t.lookahead === 0) break;
2035
- }
2036
- if (T = 0, t.lookahead >= P && (t.ins_h = (t.ins_h << t.hash_shift ^ t.window[t.strstart + P - 1]) & t.hash_mask, T = t.prev[t.strstart & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = t.strstart), T !== 0 && t.strstart - T <= t.w_size - Y && (t.match_length = X(t, T)), t.match_length >= P) if (y = i._tr_tally(t, t.strstart - t.match_start, t.match_length - P), t.lookahead -= t.match_length, t.match_length <= t.max_lazy_match && t.lookahead >= P) {
2037
- for (t.match_length--; t.strstart++, t.ins_h = (t.ins_h << t.hash_shift ^ t.window[t.strstart + P - 1]) & t.hash_mask, T = t.prev[t.strstart & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = t.strstart, --t.match_length != 0; ) ;
2038
- t.strstart++;
2039
- } else t.strstart += t.match_length, t.match_length = 0, t.ins_h = t.window[t.strstart], t.ins_h = (t.ins_h << t.hash_shift ^ t.window[t.strstart + 1]) & t.hash_mask;
2040
- else y = i._tr_tally(t, 0, t.window[t.strstart]), t.lookahead--, t.strstart++;
2041
- if (y && (I(t, !1), t.strm.avail_out === 0)) return s;
2042
- }
2043
- return t.insert = t.strstart < P - 1 ? t.strstart : P - 1, D === x ? (I(t, !0), t.strm.avail_out === 0 ? Q : U) : t.last_lit && (I(t, !1), t.strm.avail_out === 0) ? s : j;
2044
- }
2045
- function et(t, D) {
2046
- for (var T, y, m; ; ) {
2047
- if (t.lookahead < Y) {
2048
- if (st(t), t.lookahead < Y && D === v) return s;
2049
- if (t.lookahead === 0) break;
2050
- }
2051
- if (T = 0, t.lookahead >= P && (t.ins_h = (t.ins_h << t.hash_shift ^ t.window[t.strstart + P - 1]) & t.hash_mask, T = t.prev[t.strstart & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = t.strstart), t.prev_length = t.match_length, t.prev_match = t.match_start, t.match_length = P - 1, T !== 0 && t.prev_length < t.max_lazy_match && t.strstart - T <= t.w_size - Y && (t.match_length = X(t, T), t.match_length <= 5 && (t.strategy === 1 || t.match_length === P && 4096 < t.strstart - t.match_start) && (t.match_length = P - 1)), t.prev_length >= P && t.match_length <= t.prev_length) {
2052
- for (m = t.strstart + t.lookahead - P, y = i._tr_tally(t, t.strstart - 1 - t.prev_match, t.prev_length - P), t.lookahead -= t.prev_length - 1, t.prev_length -= 2; ++t.strstart <= m && (t.ins_h = (t.ins_h << t.hash_shift ^ t.window[t.strstart + P - 1]) & t.hash_mask, T = t.prev[t.strstart & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = t.strstart), --t.prev_length != 0; ) ;
2053
- if (t.match_available = 0, t.match_length = P - 1, t.strstart++, y && (I(t, !1), t.strm.avail_out === 0)) return s;
2054
- } else if (t.match_available) {
2055
- if ((y = i._tr_tally(t, 0, t.window[t.strstart - 1])) && I(t, !1), t.strstart++, t.lookahead--, t.strm.avail_out === 0) return s;
2056
- } else t.match_available = 1, t.strstart++, t.lookahead--;
2057
- }
2058
- return t.match_available && (y = i._tr_tally(t, 0, t.window[t.strstart - 1]), t.match_available = 0), t.insert = t.strstart < P - 1 ? t.strstart : P - 1, D === x ? (I(t, !0), t.strm.avail_out === 0 ? Q : U) : t.last_lit && (I(t, !1), t.strm.avail_out === 0) ? s : j;
2059
- }
2060
- function nt(t, D, T, y, m) {
2061
- this.good_length = t, this.max_lazy = D, this.nice_length = T, this.max_chain = y, this.func = m;
2062
- }
2063
- function ct() {
2064
- 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 = b, 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 r.Buf16(2 * B), this.dyn_dtree = new r.Buf16(2 * (2 * E + 1)), this.bl_tree = new r.Buf16(2 * (2 * R + 1)), q(this.dyn_ltree), q(this.dyn_dtree), q(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new r.Buf16(L + 1), this.heap = new r.Buf16(2 * z + 1), q(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new r.Buf16(2 * z + 1), q(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;
2065
- }
2066
- function at(t) {
2067
- var D;
2068
- return t && t.state ? (t.total_in = t.total_out = 0, t.data_type = h, (D = t.state).pending = 0, D.pending_out = 0, D.wrap < 0 && (D.wrap = -D.wrap), D.status = D.wrap ? k : F, t.adler = D.wrap === 2 ? 0 : 1, D.last_flush = v, i._tr_init(D), u) : tt(t, _);
2069
- }
2070
- function dt(t) {
2071
- var D = at(t);
2072
- return D === u && (function(T) {
2073
- T.window_size = 2 * T.w_size, q(T.head), T.max_lazy_match = n[T.level].max_lazy, T.good_match = n[T.level].good_length, T.nice_match = n[T.level].nice_length, T.max_chain_length = n[T.level].max_chain, T.strstart = 0, T.block_start = 0, T.lookahead = 0, T.insert = 0, T.match_length = T.prev_length = P - 1, T.match_available = 0, T.ins_h = 0;
2074
- })(t.state), D;
2075
- }
2076
- function ht(t, D, T, y, m, C) {
2077
- if (!t) return _;
2078
- var N = 1;
2079
- if (D === o && (D = 6), y < 0 ? (N = 0, y = -y) : 15 < y && (N = 2, y -= 16), m < 1 || S < m || T !== b || y < 8 || 15 < y || D < 0 || 9 < D || C < 0 || g < C) return tt(t, _);
2080
- y === 8 && (y = 9);
2081
- var $ = new ct();
2082
- return (t.state = $).strm = t, $.wrap = N, $.gzhead = null, $.w_bits = y, $.w_size = 1 << $.w_bits, $.w_mask = $.w_size - 1, $.hash_bits = m + 7, $.hash_size = 1 << $.hash_bits, $.hash_mask = $.hash_size - 1, $.hash_shift = ~~(($.hash_bits + P - 1) / P), $.window = new r.Buf8(2 * $.w_size), $.head = new r.Buf16($.hash_size), $.prev = new r.Buf16($.w_size), $.lit_bufsize = 1 << m + 6, $.pending_buf_size = 4 * $.lit_bufsize, $.pending_buf = new r.Buf8($.pending_buf_size), $.d_buf = 1 * $.lit_bufsize, $.l_buf = 3 * $.lit_bufsize, $.level = D, $.strategy = C, $.method = T, dt(t);
2083
- }
2084
- n = [new nt(0, 0, 0, 0, function(t, D) {
2085
- var T = 65535;
2086
- for (T > t.pending_buf_size - 5 && (T = t.pending_buf_size - 5); ; ) {
2087
- if (t.lookahead <= 1) {
2088
- if (st(t), t.lookahead === 0 && D === v) return s;
2089
- if (t.lookahead === 0) break;
2090
- }
2091
- t.strstart += t.lookahead, t.lookahead = 0;
2092
- var y = t.block_start + T;
2093
- if ((t.strstart === 0 || t.strstart >= y) && (t.lookahead = t.strstart - y, t.strstart = y, I(t, !1), t.strm.avail_out === 0) || t.strstart - t.block_start >= t.w_size - Y && (I(t, !1), t.strm.avail_out === 0)) return s;
2094
- }
2095
- return t.insert = 0, D === x ? (I(t, !0), t.strm.avail_out === 0 ? Q : U) : (t.strstart > t.block_start && (I(t, !1), t.strm.avail_out), s);
2096
- }), new nt(4, 4, 8, 4, lt), new nt(4, 5, 16, 8, lt), new nt(4, 6, 32, 32, lt), new nt(4, 4, 16, 16, et), new nt(8, 16, 32, 32, et), new nt(8, 16, 128, 128, et), new nt(8, 32, 128, 256, et), new nt(32, 128, 258, 1024, et), new nt(32, 258, 258, 4096, et)], a.deflateInit = function(t, D) {
2097
- return ht(t, D, b, 15, 8, 0);
2098
- }, a.deflateInit2 = ht, a.deflateReset = dt, a.deflateResetKeep = at, a.deflateSetHeader = function(t, D) {
2099
- return t && t.state ? t.state.wrap !== 2 ? _ : (t.state.gzhead = D, u) : _;
2100
- }, a.deflate = function(t, D) {
2101
- var T, y, m, C;
2102
- if (!t || !t.state || 5 < D || D < 0) return t ? tt(t, _) : _;
2103
- if (y = t.state, !t.output || !t.input && t.avail_in !== 0 || y.status === 666 && D !== x) return tt(t, t.avail_out === 0 ? -5 : _);
2104
- if (y.strm = t, T = y.last_flush, y.last_flush = D, y.status === k) if (y.wrap === 2) t.adler = 0, J(y, 31), J(y, 139), J(y, 8), y.gzhead ? (J(y, (y.gzhead.text ? 1 : 0) + (y.gzhead.hcrc ? 2 : 0) + (y.gzhead.extra ? 4 : 0) + (y.gzhead.name ? 8 : 0) + (y.gzhead.comment ? 16 : 0)), J(y, 255 & y.gzhead.time), J(y, y.gzhead.time >> 8 & 255), J(y, y.gzhead.time >> 16 & 255), J(y, y.gzhead.time >> 24 & 255), J(y, y.level === 9 ? 2 : 2 <= y.strategy || y.level < 2 ? 4 : 0), J(y, 255 & y.gzhead.os), y.gzhead.extra && y.gzhead.extra.length && (J(y, 255 & y.gzhead.extra.length), J(y, y.gzhead.extra.length >> 8 & 255)), y.gzhead.hcrc && (t.adler = p(t.adler, y.pending_buf, y.pending, 0)), y.gzindex = 0, y.status = 69) : (J(y, 0), J(y, 0), J(y, 0), J(y, 0), J(y, 0), J(y, y.level === 9 ? 2 : 2 <= y.strategy || y.level < 2 ? 4 : 0), J(y, 3), y.status = F);
2105
- else {
2106
- var N = b + (y.w_bits - 8 << 4) << 8;
2107
- N |= (2 <= y.strategy || y.level < 2 ? 0 : y.level < 6 ? 1 : y.level === 6 ? 2 : 3) << 6, y.strstart !== 0 && (N |= 32), N += 31 - N % 31, y.status = F, G(y, N), y.strstart !== 0 && (G(y, t.adler >>> 16), G(y, 65535 & t.adler)), t.adler = 1;
2108
- }
2109
- if (y.status === 69) if (y.gzhead.extra) {
2110
- for (m = y.pending; y.gzindex < (65535 & y.gzhead.extra.length) && (y.pending !== y.pending_buf_size || (y.gzhead.hcrc && y.pending > m && (t.adler = p(t.adler, y.pending_buf, y.pending - m, m)), O(t), m = y.pending, y.pending !== y.pending_buf_size)); ) J(y, 255 & y.gzhead.extra[y.gzindex]), y.gzindex++;
2111
- y.gzhead.hcrc && y.pending > m && (t.adler = p(t.adler, y.pending_buf, y.pending - m, m)), y.gzindex === y.gzhead.extra.length && (y.gzindex = 0, y.status = 73);
2112
- } else y.status = 73;
2113
- if (y.status === 73) if (y.gzhead.name) {
2114
- m = y.pending;
2115
- do {
2116
- if (y.pending === y.pending_buf_size && (y.gzhead.hcrc && y.pending > m && (t.adler = p(t.adler, y.pending_buf, y.pending - m, m)), O(t), m = y.pending, y.pending === y.pending_buf_size)) {
2117
- C = 1;
2118
- break;
2119
- }
2120
- C = y.gzindex < y.gzhead.name.length ? 255 & y.gzhead.name.charCodeAt(y.gzindex++) : 0, J(y, C);
2121
- } while (C !== 0);
2122
- y.gzhead.hcrc && y.pending > m && (t.adler = p(t.adler, y.pending_buf, y.pending - m, m)), C === 0 && (y.gzindex = 0, y.status = 91);
2123
- } else y.status = 91;
2124
- if (y.status === 91) if (y.gzhead.comment) {
2125
- m = y.pending;
2126
- do {
2127
- if (y.pending === y.pending_buf_size && (y.gzhead.hcrc && y.pending > m && (t.adler = p(t.adler, y.pending_buf, y.pending - m, m)), O(t), m = y.pending, y.pending === y.pending_buf_size)) {
2128
- C = 1;
2129
- break;
2130
- }
2131
- C = y.gzindex < y.gzhead.comment.length ? 255 & y.gzhead.comment.charCodeAt(y.gzindex++) : 0, J(y, C);
2132
- } while (C !== 0);
2133
- y.gzhead.hcrc && y.pending > m && (t.adler = p(t.adler, y.pending_buf, y.pending - m, m)), C === 0 && (y.status = 103);
2134
- } else y.status = 103;
2135
- if (y.status === 103 && (y.gzhead.hcrc ? (y.pending + 2 > y.pending_buf_size && O(t), y.pending + 2 <= y.pending_buf_size && (J(y, 255 & t.adler), J(y, t.adler >> 8 & 255), t.adler = 0, y.status = F)) : y.status = F), y.pending !== 0) {
2136
- if (O(t), t.avail_out === 0) return y.last_flush = -1, u;
2137
- } else if (t.avail_in === 0 && M(D) <= M(T) && D !== x) return tt(t, -5);
2138
- if (y.status === 666 && t.avail_in !== 0) return tt(t, -5);
2139
- if (t.avail_in !== 0 || y.lookahead !== 0 || D !== v && y.status !== 666) {
2140
- var $ = y.strategy === 2 ? (function(A, Z) {
2141
- for (var K; ; ) {
2142
- if (A.lookahead === 0 && (st(A), A.lookahead === 0)) {
2143
- if (Z === v) return s;
2144
- break;
2145
- }
2146
- if (A.match_length = 0, K = i._tr_tally(A, 0, A.window[A.strstart]), A.lookahead--, A.strstart++, K && (I(A, !1), A.strm.avail_out === 0)) return s;
2147
- }
2148
- return A.insert = 0, Z === x ? (I(A, !0), A.strm.avail_out === 0 ? Q : U) : A.last_lit && (I(A, !1), A.strm.avail_out === 0) ? s : j;
2149
- })(y, D) : y.strategy === 3 ? (function(A, Z) {
2150
- for (var K, H, V, it, rt = A.window; ; ) {
2151
- if (A.lookahead <= W) {
2152
- if (st(A), A.lookahead <= W && Z === v) return s;
2153
- if (A.lookahead === 0) break;
2154
- }
2155
- if (A.match_length = 0, A.lookahead >= P && 0 < A.strstart && (H = rt[V = A.strstart - 1]) === rt[++V] && H === rt[++V] && H === rt[++V]) {
2156
- it = A.strstart + W;
2157
- do
2158
- ;
2159
- while (H === rt[++V] && H === rt[++V] && H === rt[++V] && H === rt[++V] && H === rt[++V] && H === rt[++V] && H === rt[++V] && H === rt[++V] && V < it);
2160
- A.match_length = W - (it - V), A.match_length > A.lookahead && (A.match_length = A.lookahead);
2161
- }
2162
- if (A.match_length >= P ? (K = i._tr_tally(A, 1, A.match_length - P), A.lookahead -= A.match_length, A.strstart += A.match_length, A.match_length = 0) : (K = i._tr_tally(A, 0, A.window[A.strstart]), A.lookahead--, A.strstart++), K && (I(A, !1), A.strm.avail_out === 0)) return s;
2163
- }
2164
- return A.insert = 0, Z === x ? (I(A, !0), A.strm.avail_out === 0 ? Q : U) : A.last_lit && (I(A, !1), A.strm.avail_out === 0) ? s : j;
2165
- })(y, D) : n[y.level].func(y, D);
2166
- if ($ !== Q && $ !== U || (y.status = 666), $ === s || $ === Q) return t.avail_out === 0 && (y.last_flush = -1), u;
2167
- if ($ === j && (D === 1 ? i._tr_align(y) : D !== 5 && (i._tr_stored_block(y, 0, 0, !1), D === 3 && (q(y.head), y.lookahead === 0 && (y.strstart = 0, y.block_start = 0, y.insert = 0))), O(t), t.avail_out === 0)) return y.last_flush = -1, u;
2168
- }
2169
- return D !== x ? u : y.wrap <= 0 ? 1 : (y.wrap === 2 ? (J(y, 255 & t.adler), J(y, t.adler >> 8 & 255), J(y, t.adler >> 16 & 255), J(y, t.adler >> 24 & 255), J(y, 255 & t.total_in), J(y, t.total_in >> 8 & 255), J(y, t.total_in >> 16 & 255), J(y, t.total_in >> 24 & 255)) : (G(y, t.adler >>> 16), G(y, 65535 & t.adler)), O(t), 0 < y.wrap && (y.wrap = -y.wrap), y.pending !== 0 ? u : 1);
2170
- }, a.deflateEnd = function(t) {
2171
- var D;
2172
- return t && t.state ? (D = t.state.status) !== k && D !== 69 && D !== 73 && D !== 91 && D !== 103 && D !== F && D !== 666 ? tt(t, _) : (t.state = null, D === F ? tt(t, -3) : u) : _;
2173
- }, a.deflateSetDictionary = function(t, D) {
2174
- var T, y, m, C, N, $, A, Z, K = D.length;
2175
- if (!t || !t.state || (C = (T = t.state).wrap) === 2 || C === 1 && T.status !== k || T.lookahead) return _;
2176
- for (C === 1 && (t.adler = l(t.adler, D, K, 0)), T.wrap = 0, K >= T.w_size && (C === 0 && (q(T.head), T.strstart = 0, T.block_start = 0, T.insert = 0), Z = new r.Buf8(T.w_size), r.arraySet(Z, D, K - T.w_size, T.w_size, 0), D = Z, K = T.w_size), N = t.avail_in, $ = t.next_in, A = t.input, t.avail_in = K, t.next_in = 0, t.input = D, st(T); T.lookahead >= P; ) {
2177
- for (y = T.strstart, m = T.lookahead - (P - 1); T.ins_h = (T.ins_h << T.hash_shift ^ T.window[y + P - 1]) & T.hash_mask, T.prev[y & T.w_mask] = T.head[T.ins_h], T.head[T.ins_h] = y, y++, --m; ) ;
2178
- T.strstart = y, T.lookahead = P - 1, st(T);
2179
- }
2180
- return T.strstart += T.lookahead, T.block_start = T.strstart, T.insert = T.lookahead, T.lookahead = 0, T.match_length = T.prev_length = P - 1, T.match_available = 0, t.next_in = $, t.input = A, t.avail_in = N, T.wrap = C, u;
2181
- }, a.deflateInfo = "pako deflate (from Nodeca project)";
2182
- }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./messages": 51, "./trees": 52 }], 47: [function(e, f, a) {
2183
- f.exports = function() {
2184
- 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 = !1;
2185
- };
2186
- }, {}], 48: [function(e, f, a) {
2187
- f.exports = function(n, r) {
2188
- var i, l, p, w, v, x, u, _, o, g, h, b, S, z, E, R, B, L, P, W, Y, k, F, s, j;
2189
- i = n.state, l = n.next_in, s = n.input, p = l + (n.avail_in - 5), w = n.next_out, j = n.output, v = w - (r - n.avail_out), x = w + (n.avail_out - 257), u = i.dmax, _ = i.wsize, o = i.whave, g = i.wnext, h = i.window, b = i.hold, S = i.bits, z = i.lencode, E = i.distcode, R = (1 << i.lenbits) - 1, B = (1 << i.distbits) - 1;
2190
- t: do {
2191
- S < 15 && (b += s[l++] << S, S += 8, b += s[l++] << S, S += 8), L = z[b & R];
2192
- e: for (; ; ) {
2193
- if (b >>>= P = L >>> 24, S -= P, (P = L >>> 16 & 255) === 0) j[w++] = 65535 & L;
2194
- else {
2195
- if (!(16 & P)) {
2196
- if ((64 & P) == 0) {
2197
- L = z[(65535 & L) + (b & (1 << P) - 1)];
2198
- continue e;
2199
- }
2200
- if (32 & P) {
2201
- i.mode = 12;
2202
- break t;
2203
- }
2204
- n.msg = "invalid literal/length code", i.mode = 30;
2205
- break t;
2206
- }
2207
- W = 65535 & L, (P &= 15) && (S < P && (b += s[l++] << S, S += 8), W += b & (1 << P) - 1, b >>>= P, S -= P), S < 15 && (b += s[l++] << S, S += 8, b += s[l++] << S, S += 8), L = E[b & B];
2208
- r: for (; ; ) {
2209
- if (b >>>= P = L >>> 24, S -= P, !(16 & (P = L >>> 16 & 255))) {
2210
- if ((64 & P) == 0) {
2211
- L = E[(65535 & L) + (b & (1 << P) - 1)];
2212
- continue r;
2213
- }
2214
- n.msg = "invalid distance code", i.mode = 30;
2215
- break t;
2216
- }
2217
- if (Y = 65535 & L, S < (P &= 15) && (b += s[l++] << S, (S += 8) < P && (b += s[l++] << S, S += 8)), u < (Y += b & (1 << P) - 1)) {
2218
- n.msg = "invalid distance too far back", i.mode = 30;
2219
- break t;
2220
- }
2221
- if (b >>>= P, S -= P, (P = w - v) < Y) {
2222
- if (o < (P = Y - P) && i.sane) {
2223
- n.msg = "invalid distance too far back", i.mode = 30;
2224
- break t;
2225
- }
2226
- if (F = h, (k = 0) === g) {
2227
- if (k += _ - P, P < W) {
2228
- for (W -= P; j[w++] = h[k++], --P; ) ;
2229
- k = w - Y, F = j;
2230
- }
2231
- } else if (g < P) {
2232
- if (k += _ + g - P, (P -= g) < W) {
2233
- for (W -= P; j[w++] = h[k++], --P; ) ;
2234
- if (k = 0, g < W) {
2235
- for (W -= P = g; j[w++] = h[k++], --P; ) ;
2236
- k = w - Y, F = j;
2237
- }
2238
- }
2239
- } else if (k += g - P, P < W) {
2240
- for (W -= P; j[w++] = h[k++], --P; ) ;
2241
- k = w - Y, F = j;
2242
- }
2243
- for (; 2 < W; ) j[w++] = F[k++], j[w++] = F[k++], j[w++] = F[k++], W -= 3;
2244
- W && (j[w++] = F[k++], 1 < W && (j[w++] = F[k++]));
2245
- } else {
2246
- for (k = w - Y; j[w++] = j[k++], j[w++] = j[k++], j[w++] = j[k++], 2 < (W -= 3); ) ;
2247
- W && (j[w++] = j[k++], 1 < W && (j[w++] = j[k++]));
2248
- }
2249
- break;
2250
- }
2251
- }
2252
- break;
2253
- }
2254
- } while (l < p && w < x);
2255
- l -= W = S >> 3, b &= (1 << (S -= W << 3)) - 1, n.next_in = l, n.next_out = w, n.avail_in = l < p ? p - l + 5 : 5 - (l - p), n.avail_out = w < x ? x - w + 257 : 257 - (w - x), i.hold = b, i.bits = S;
2256
- };
2257
- }, {}], 49: [function(e, f, a) {
2258
- var n = e("../utils/common"), r = e("./adler32"), i = e("./crc32"), l = e("./inffast"), p = e("./inftrees"), w = 1, v = 2, x = 0, u = -2, _ = 1, o = 852, g = 592;
2259
- function h(k) {
2260
- return (k >>> 24 & 255) + (k >>> 8 & 65280) + ((65280 & k) << 8) + ((255 & k) << 24);
2261
- }
2262
- function b() {
2263
- this.mode = 0, this.last = !1, this.wrap = 0, this.havedict = !1, 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 n.Buf16(320), this.work = new n.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0;
2264
- }
2265
- function S(k) {
2266
- var F;
2267
- return k && k.state ? (F = k.state, k.total_in = k.total_out = F.total = 0, k.msg = "", F.wrap && (k.adler = 1 & F.wrap), F.mode = _, F.last = 0, F.havedict = 0, F.dmax = 32768, F.head = null, F.hold = 0, F.bits = 0, F.lencode = F.lendyn = new n.Buf32(o), F.distcode = F.distdyn = new n.Buf32(g), F.sane = 1, F.back = -1, x) : u;
2268
- }
2269
- function z(k) {
2270
- var F;
2271
- return k && k.state ? ((F = k.state).wsize = 0, F.whave = 0, F.wnext = 0, S(k)) : u;
2272
- }
2273
- function E(k, F) {
2274
- var s, j;
2275
- return k && k.state ? (j = k.state, F < 0 ? (s = 0, F = -F) : (s = 1 + (F >> 4), F < 48 && (F &= 15)), F && (F < 8 || 15 < F) ? u : (j.window !== null && j.wbits !== F && (j.window = null), j.wrap = s, j.wbits = F, z(k))) : u;
2276
- }
2277
- function R(k, F) {
2278
- var s, j;
2279
- return k ? (j = new b(), (k.state = j).window = null, (s = E(k, F)) !== x && (k.state = null), s) : u;
2280
- }
2281
- var B, L, P = !0;
2282
- function W(k) {
2283
- if (P) {
2284
- var F;
2285
- for (B = new n.Buf32(512), L = new n.Buf32(32), F = 0; F < 144; ) k.lens[F++] = 8;
2286
- for (; F < 256; ) k.lens[F++] = 9;
2287
- for (; F < 280; ) k.lens[F++] = 7;
2288
- for (; F < 288; ) k.lens[F++] = 8;
2289
- for (p(w, k.lens, 0, 288, B, 0, k.work, { bits: 9 }), F = 0; F < 32; ) k.lens[F++] = 5;
2290
- p(v, k.lens, 0, 32, L, 0, k.work, { bits: 5 }), P = !1;
2291
- }
2292
- k.lencode = B, k.lenbits = 9, k.distcode = L, k.distbits = 5;
2293
- }
2294
- function Y(k, F, s, j) {
2295
- var Q, U = k.state;
2296
- return U.window === null && (U.wsize = 1 << U.wbits, U.wnext = 0, U.whave = 0, U.window = new n.Buf8(U.wsize)), j >= U.wsize ? (n.arraySet(U.window, F, s - U.wsize, U.wsize, 0), U.wnext = 0, U.whave = U.wsize) : (j < (Q = U.wsize - U.wnext) && (Q = j), n.arraySet(U.window, F, s - j, Q, U.wnext), (j -= Q) ? (n.arraySet(U.window, F, s - j, j, 0), U.wnext = j, U.whave = U.wsize) : (U.wnext += Q, U.wnext === U.wsize && (U.wnext = 0), U.whave < U.wsize && (U.whave += Q))), 0;
2297
- }
2298
- a.inflateReset = z, a.inflateReset2 = E, a.inflateResetKeep = S, a.inflateInit = function(k) {
2299
- return R(k, 15);
2300
- }, a.inflateInit2 = R, a.inflate = function(k, F) {
2301
- var s, j, Q, U, tt, M, q, O, I, J, G, X, st, lt, et, nt, ct, at, dt, ht, t, D, T, y, m = 0, C = new n.Buf8(4), N = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
2302
- if (!k || !k.state || !k.output || !k.input && k.avail_in !== 0) return u;
2303
- (s = k.state).mode === 12 && (s.mode = 13), tt = k.next_out, Q = k.output, q = k.avail_out, U = k.next_in, j = k.input, M = k.avail_in, O = s.hold, I = s.bits, J = M, G = q, D = x;
2304
- t: for (; ; ) switch (s.mode) {
2305
- case _:
2306
- if (s.wrap === 0) {
2307
- s.mode = 13;
2308
- break;
2309
- }
2310
- for (; I < 16; ) {
2311
- if (M === 0) break t;
2312
- M--, O += j[U++] << I, I += 8;
2313
- }
2314
- if (2 & s.wrap && O === 35615) {
2315
- C[s.check = 0] = 255 & O, C[1] = O >>> 8 & 255, s.check = i(s.check, C, 2, 0), I = O = 0, s.mode = 2;
2316
- break;
2317
- }
2318
- if (s.flags = 0, s.head && (s.head.done = !1), !(1 & s.wrap) || (((255 & O) << 8) + (O >> 8)) % 31) {
2319
- k.msg = "incorrect header check", s.mode = 30;
2320
- break;
2321
- }
2322
- if ((15 & O) != 8) {
2323
- k.msg = "unknown compression method", s.mode = 30;
2324
- break;
2325
- }
2326
- if (I -= 4, t = 8 + (15 & (O >>>= 4)), s.wbits === 0) s.wbits = t;
2327
- else if (t > s.wbits) {
2328
- k.msg = "invalid window size", s.mode = 30;
2329
- break;
2330
- }
2331
- s.dmax = 1 << t, k.adler = s.check = 1, s.mode = 512 & O ? 10 : 12, I = O = 0;
2332
- break;
2333
- case 2:
2334
- for (; I < 16; ) {
2335
- if (M === 0) break t;
2336
- M--, O += j[U++] << I, I += 8;
2337
- }
2338
- if (s.flags = O, (255 & s.flags) != 8) {
2339
- k.msg = "unknown compression method", s.mode = 30;
2340
- break;
2341
- }
2342
- if (57344 & s.flags) {
2343
- k.msg = "unknown header flags set", s.mode = 30;
2344
- break;
2345
- }
2346
- s.head && (s.head.text = O >> 8 & 1), 512 & s.flags && (C[0] = 255 & O, C[1] = O >>> 8 & 255, s.check = i(s.check, C, 2, 0)), I = O = 0, s.mode = 3;
2347
- case 3:
2348
- for (; I < 32; ) {
2349
- if (M === 0) break t;
2350
- M--, O += j[U++] << I, I += 8;
2351
- }
2352
- s.head && (s.head.time = O), 512 & s.flags && (C[0] = 255 & O, C[1] = O >>> 8 & 255, C[2] = O >>> 16 & 255, C[3] = O >>> 24 & 255, s.check = i(s.check, C, 4, 0)), I = O = 0, s.mode = 4;
2353
- case 4:
2354
- for (; I < 16; ) {
2355
- if (M === 0) break t;
2356
- M--, O += j[U++] << I, I += 8;
2357
- }
2358
- s.head && (s.head.xflags = 255 & O, s.head.os = O >> 8), 512 & s.flags && (C[0] = 255 & O, C[1] = O >>> 8 & 255, s.check = i(s.check, C, 2, 0)), I = O = 0, s.mode = 5;
2359
- case 5:
2360
- if (1024 & s.flags) {
2361
- for (; I < 16; ) {
2362
- if (M === 0) break t;
2363
- M--, O += j[U++] << I, I += 8;
2364
- }
2365
- s.length = O, s.head && (s.head.extra_len = O), 512 & s.flags && (C[0] = 255 & O, C[1] = O >>> 8 & 255, s.check = i(s.check, C, 2, 0)), I = O = 0;
2366
- } else s.head && (s.head.extra = null);
2367
- s.mode = 6;
2368
- case 6:
2369
- if (1024 & s.flags && (M < (X = s.length) && (X = M), X && (s.head && (t = s.head.extra_len - s.length, s.head.extra || (s.head.extra = new Array(s.head.extra_len)), n.arraySet(s.head.extra, j, U, X, t)), 512 & s.flags && (s.check = i(s.check, j, X, U)), M -= X, U += X, s.length -= X), s.length)) break t;
2370
- s.length = 0, s.mode = 7;
2371
- case 7:
2372
- if (2048 & s.flags) {
2373
- if (M === 0) break t;
2374
- for (X = 0; t = j[U + X++], s.head && t && s.length < 65536 && (s.head.name += String.fromCharCode(t)), t && X < M; ) ;
2375
- if (512 & s.flags && (s.check = i(s.check, j, X, U)), M -= X, U += X, t) break t;
2376
- } else s.head && (s.head.name = null);
2377
- s.length = 0, s.mode = 8;
2378
- case 8:
2379
- if (4096 & s.flags) {
2380
- if (M === 0) break t;
2381
- for (X = 0; t = j[U + X++], s.head && t && s.length < 65536 && (s.head.comment += String.fromCharCode(t)), t && X < M; ) ;
2382
- if (512 & s.flags && (s.check = i(s.check, j, X, U)), M -= X, U += X, t) break t;
2383
- } else s.head && (s.head.comment = null);
2384
- s.mode = 9;
2385
- case 9:
2386
- if (512 & s.flags) {
2387
- for (; I < 16; ) {
2388
- if (M === 0) break t;
2389
- M--, O += j[U++] << I, I += 8;
2390
- }
2391
- if (O !== (65535 & s.check)) {
2392
- k.msg = "header crc mismatch", s.mode = 30;
2393
- break;
2394
- }
2395
- I = O = 0;
2396
- }
2397
- s.head && (s.head.hcrc = s.flags >> 9 & 1, s.head.done = !0), k.adler = s.check = 0, s.mode = 12;
2398
- break;
2399
- case 10:
2400
- for (; I < 32; ) {
2401
- if (M === 0) break t;
2402
- M--, O += j[U++] << I, I += 8;
2403
- }
2404
- k.adler = s.check = h(O), I = O = 0, s.mode = 11;
2405
- case 11:
2406
- if (s.havedict === 0) return k.next_out = tt, k.avail_out = q, k.next_in = U, k.avail_in = M, s.hold = O, s.bits = I, 2;
2407
- k.adler = s.check = 1, s.mode = 12;
2408
- case 12:
2409
- if (F === 5 || F === 6) break t;
2410
- case 13:
2411
- if (s.last) {
2412
- O >>>= 7 & I, I -= 7 & I, s.mode = 27;
2413
- break;
2414
- }
2415
- for (; I < 3; ) {
2416
- if (M === 0) break t;
2417
- M--, O += j[U++] << I, I += 8;
2418
- }
2419
- switch (s.last = 1 & O, I -= 1, 3 & (O >>>= 1)) {
2420
- case 0:
2421
- s.mode = 14;
2422
- break;
2423
- case 1:
2424
- if (W(s), s.mode = 20, F !== 6) break;
2425
- O >>>= 2, I -= 2;
2426
- break t;
2427
- case 2:
2428
- s.mode = 17;
2429
- break;
2430
- case 3:
2431
- k.msg = "invalid block type", s.mode = 30;
2432
- }
2433
- O >>>= 2, I -= 2;
2434
- break;
2435
- case 14:
2436
- for (O >>>= 7 & I, I -= 7 & I; I < 32; ) {
2437
- if (M === 0) break t;
2438
- M--, O += j[U++] << I, I += 8;
2439
- }
2440
- if ((65535 & O) != (O >>> 16 ^ 65535)) {
2441
- k.msg = "invalid stored block lengths", s.mode = 30;
2442
- break;
2443
- }
2444
- if (s.length = 65535 & O, I = O = 0, s.mode = 15, F === 6) break t;
2445
- case 15:
2446
- s.mode = 16;
2447
- case 16:
2448
- if (X = s.length) {
2449
- if (M < X && (X = M), q < X && (X = q), X === 0) break t;
2450
- n.arraySet(Q, j, U, X, tt), M -= X, U += X, q -= X, tt += X, s.length -= X;
2451
- break;
2452
- }
2453
- s.mode = 12;
2454
- break;
2455
- case 17:
2456
- for (; I < 14; ) {
2457
- if (M === 0) break t;
2458
- M--, O += j[U++] << I, I += 8;
2459
- }
2460
- if (s.nlen = 257 + (31 & O), O >>>= 5, I -= 5, s.ndist = 1 + (31 & O), O >>>= 5, I -= 5, s.ncode = 4 + (15 & O), O >>>= 4, I -= 4, 286 < s.nlen || 30 < s.ndist) {
2461
- k.msg = "too many length or distance symbols", s.mode = 30;
2462
- break;
2463
- }
2464
- s.have = 0, s.mode = 18;
2465
- case 18:
2466
- for (; s.have < s.ncode; ) {
2467
- for (; I < 3; ) {
2468
- if (M === 0) break t;
2469
- M--, O += j[U++] << I, I += 8;
2470
- }
2471
- s.lens[N[s.have++]] = 7 & O, O >>>= 3, I -= 3;
2472
- }
2473
- for (; s.have < 19; ) s.lens[N[s.have++]] = 0;
2474
- if (s.lencode = s.lendyn, s.lenbits = 7, T = { bits: s.lenbits }, D = p(0, s.lens, 0, 19, s.lencode, 0, s.work, T), s.lenbits = T.bits, D) {
2475
- k.msg = "invalid code lengths set", s.mode = 30;
2476
- break;
2477
- }
2478
- s.have = 0, s.mode = 19;
2479
- case 19:
2480
- for (; s.have < s.nlen + s.ndist; ) {
2481
- for (; nt = (m = s.lencode[O & (1 << s.lenbits) - 1]) >>> 16 & 255, ct = 65535 & m, !((et = m >>> 24) <= I); ) {
2482
- if (M === 0) break t;
2483
- M--, O += j[U++] << I, I += 8;
2484
- }
2485
- if (ct < 16) O >>>= et, I -= et, s.lens[s.have++] = ct;
2486
- else {
2487
- if (ct === 16) {
2488
- for (y = et + 2; I < y; ) {
2489
- if (M === 0) break t;
2490
- M--, O += j[U++] << I, I += 8;
2491
- }
2492
- if (O >>>= et, I -= et, s.have === 0) {
2493
- k.msg = "invalid bit length repeat", s.mode = 30;
2494
- break;
2495
- }
2496
- t = s.lens[s.have - 1], X = 3 + (3 & O), O >>>= 2, I -= 2;
2497
- } else if (ct === 17) {
2498
- for (y = et + 3; I < y; ) {
2499
- if (M === 0) break t;
2500
- M--, O += j[U++] << I, I += 8;
2501
- }
2502
- I -= et, t = 0, X = 3 + (7 & (O >>>= et)), O >>>= 3, I -= 3;
2503
- } else {
2504
- for (y = et + 7; I < y; ) {
2505
- if (M === 0) break t;
2506
- M--, O += j[U++] << I, I += 8;
2507
- }
2508
- I -= et, t = 0, X = 11 + (127 & (O >>>= et)), O >>>= 7, I -= 7;
2509
- }
2510
- if (s.have + X > s.nlen + s.ndist) {
2511
- k.msg = "invalid bit length repeat", s.mode = 30;
2512
- break;
2513
- }
2514
- for (; X--; ) s.lens[s.have++] = t;
2515
- }
2516
- }
2517
- if (s.mode === 30) break;
2518
- if (s.lens[256] === 0) {
2519
- k.msg = "invalid code -- missing end-of-block", s.mode = 30;
2520
- break;
2521
- }
2522
- if (s.lenbits = 9, T = { bits: s.lenbits }, D = p(w, s.lens, 0, s.nlen, s.lencode, 0, s.work, T), s.lenbits = T.bits, D) {
2523
- k.msg = "invalid literal/lengths set", s.mode = 30;
2524
- break;
2525
- }
2526
- if (s.distbits = 6, s.distcode = s.distdyn, T = { bits: s.distbits }, D = p(v, s.lens, s.nlen, s.ndist, s.distcode, 0, s.work, T), s.distbits = T.bits, D) {
2527
- k.msg = "invalid distances set", s.mode = 30;
2528
- break;
2529
- }
2530
- if (s.mode = 20, F === 6) break t;
2531
- case 20:
2532
- s.mode = 21;
2533
- case 21:
2534
- if (6 <= M && 258 <= q) {
2535
- k.next_out = tt, k.avail_out = q, k.next_in = U, k.avail_in = M, s.hold = O, s.bits = I, l(k, G), tt = k.next_out, Q = k.output, q = k.avail_out, U = k.next_in, j = k.input, M = k.avail_in, O = s.hold, I = s.bits, s.mode === 12 && (s.back = -1);
2536
- break;
2537
- }
2538
- for (s.back = 0; nt = (m = s.lencode[O & (1 << s.lenbits) - 1]) >>> 16 & 255, ct = 65535 & m, !((et = m >>> 24) <= I); ) {
2539
- if (M === 0) break t;
2540
- M--, O += j[U++] << I, I += 8;
2541
- }
2542
- if (nt && (240 & nt) == 0) {
2543
- for (at = et, dt = nt, ht = ct; nt = (m = s.lencode[ht + ((O & (1 << at + dt) - 1) >> at)]) >>> 16 & 255, ct = 65535 & m, !(at + (et = m >>> 24) <= I); ) {
2544
- if (M === 0) break t;
2545
- M--, O += j[U++] << I, I += 8;
2546
- }
2547
- O >>>= at, I -= at, s.back += at;
2548
- }
2549
- if (O >>>= et, I -= et, s.back += et, s.length = ct, nt === 0) {
2550
- s.mode = 26;
2551
- break;
2552
- }
2553
- if (32 & nt) {
2554
- s.back = -1, s.mode = 12;
2555
- break;
2556
- }
2557
- if (64 & nt) {
2558
- k.msg = "invalid literal/length code", s.mode = 30;
2559
- break;
2560
- }
2561
- s.extra = 15 & nt, s.mode = 22;
2562
- case 22:
2563
- if (s.extra) {
2564
- for (y = s.extra; I < y; ) {
2565
- if (M === 0) break t;
2566
- M--, O += j[U++] << I, I += 8;
2567
- }
2568
- s.length += O & (1 << s.extra) - 1, O >>>= s.extra, I -= s.extra, s.back += s.extra;
2569
- }
2570
- s.was = s.length, s.mode = 23;
2571
- case 23:
2572
- for (; nt = (m = s.distcode[O & (1 << s.distbits) - 1]) >>> 16 & 255, ct = 65535 & m, !((et = m >>> 24) <= I); ) {
2573
- if (M === 0) break t;
2574
- M--, O += j[U++] << I, I += 8;
2575
- }
2576
- if ((240 & nt) == 0) {
2577
- for (at = et, dt = nt, ht = ct; nt = (m = s.distcode[ht + ((O & (1 << at + dt) - 1) >> at)]) >>> 16 & 255, ct = 65535 & m, !(at + (et = m >>> 24) <= I); ) {
2578
- if (M === 0) break t;
2579
- M--, O += j[U++] << I, I += 8;
2580
- }
2581
- O >>>= at, I -= at, s.back += at;
2582
- }
2583
- if (O >>>= et, I -= et, s.back += et, 64 & nt) {
2584
- k.msg = "invalid distance code", s.mode = 30;
2585
- break;
2586
- }
2587
- s.offset = ct, s.extra = 15 & nt, s.mode = 24;
2588
- case 24:
2589
- if (s.extra) {
2590
- for (y = s.extra; I < y; ) {
2591
- if (M === 0) break t;
2592
- M--, O += j[U++] << I, I += 8;
2593
- }
2594
- s.offset += O & (1 << s.extra) - 1, O >>>= s.extra, I -= s.extra, s.back += s.extra;
2595
- }
2596
- if (s.offset > s.dmax) {
2597
- k.msg = "invalid distance too far back", s.mode = 30;
2598
- break;
2599
- }
2600
- s.mode = 25;
2601
- case 25:
2602
- if (q === 0) break t;
2603
- if (X = G - q, s.offset > X) {
2604
- if ((X = s.offset - X) > s.whave && s.sane) {
2605
- k.msg = "invalid distance too far back", s.mode = 30;
2606
- break;
2607
- }
2608
- st = X > s.wnext ? (X -= s.wnext, s.wsize - X) : s.wnext - X, X > s.length && (X = s.length), lt = s.window;
2609
- } else lt = Q, st = tt - s.offset, X = s.length;
2610
- for (q < X && (X = q), q -= X, s.length -= X; Q[tt++] = lt[st++], --X; ) ;
2611
- s.length === 0 && (s.mode = 21);
2612
- break;
2613
- case 26:
2614
- if (q === 0) break t;
2615
- Q[tt++] = s.length, q--, s.mode = 21;
2616
- break;
2617
- case 27:
2618
- if (s.wrap) {
2619
- for (; I < 32; ) {
2620
- if (M === 0) break t;
2621
- M--, O |= j[U++] << I, I += 8;
2622
- }
2623
- if (G -= q, k.total_out += G, s.total += G, G && (k.adler = s.check = s.flags ? i(s.check, Q, G, tt - G) : r(s.check, Q, G, tt - G)), G = q, (s.flags ? O : h(O)) !== s.check) {
2624
- k.msg = "incorrect data check", s.mode = 30;
2625
- break;
2626
- }
2627
- I = O = 0;
2628
- }
2629
- s.mode = 28;
2630
- case 28:
2631
- if (s.wrap && s.flags) {
2632
- for (; I < 32; ) {
2633
- if (M === 0) break t;
2634
- M--, O += j[U++] << I, I += 8;
2635
- }
2636
- if (O !== (4294967295 & s.total)) {
2637
- k.msg = "incorrect length check", s.mode = 30;
2638
- break;
2639
- }
2640
- I = O = 0;
2641
- }
2642
- s.mode = 29;
2643
- case 29:
2644
- D = 1;
2645
- break t;
2646
- case 30:
2647
- D = -3;
2648
- break t;
2649
- case 31:
2650
- return -4;
2651
- default:
2652
- return u;
2653
- }
2654
- return k.next_out = tt, k.avail_out = q, k.next_in = U, k.avail_in = M, s.hold = O, s.bits = I, (s.wsize || G !== k.avail_out && s.mode < 30 && (s.mode < 27 || F !== 4)) && Y(k, k.output, k.next_out, G - k.avail_out) ? (s.mode = 31, -4) : (J -= k.avail_in, G -= k.avail_out, k.total_in += J, k.total_out += G, s.total += G, s.wrap && G && (k.adler = s.check = s.flags ? i(s.check, Q, G, k.next_out - G) : r(s.check, Q, G, k.next_out - G)), k.data_type = s.bits + (s.last ? 64 : 0) + (s.mode === 12 ? 128 : 0) + (s.mode === 20 || s.mode === 15 ? 256 : 0), (J == 0 && G === 0 || F === 4) && D === x && (D = -5), D);
2655
- }, a.inflateEnd = function(k) {
2656
- if (!k || !k.state) return u;
2657
- var F = k.state;
2658
- return F.window && (F.window = null), k.state = null, x;
2659
- }, a.inflateGetHeader = function(k, F) {
2660
- var s;
2661
- return k && k.state ? (2 & (s = k.state).wrap) == 0 ? u : ((s.head = F).done = !1, x) : u;
2662
- }, a.inflateSetDictionary = function(k, F) {
2663
- var s, j = F.length;
2664
- return k && k.state ? (s = k.state).wrap !== 0 && s.mode !== 11 ? u : s.mode === 11 && r(1, F, j, 0) !== s.check ? -3 : Y(k, F, j, j) ? (s.mode = 31, -4) : (s.havedict = 1, x) : u;
2665
- }, a.inflateInfo = "pako inflate (from Nodeca project)";
2666
- }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./inffast": 48, "./inftrees": 50 }], 50: [function(e, f, a) {
2667
- var n = e("../utils/common"), r = [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], i = [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], l = [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];
2668
- f.exports = function(w, v, x, u, _, o, g, h) {
2669
- var b, S, z, E, R, B, L, P, W, Y = h.bits, k = 0, F = 0, s = 0, j = 0, Q = 0, U = 0, tt = 0, M = 0, q = 0, O = 0, I = null, J = 0, G = new n.Buf16(16), X = new n.Buf16(16), st = null, lt = 0;
2670
- for (k = 0; k <= 15; k++) G[k] = 0;
2671
- for (F = 0; F < u; F++) G[v[x + F]]++;
2672
- for (Q = Y, j = 15; 1 <= j && G[j] === 0; j--) ;
2673
- if (j < Q && (Q = j), j === 0) return _[o++] = 20971520, _[o++] = 20971520, h.bits = 1, 0;
2674
- for (s = 1; s < j && G[s] === 0; s++) ;
2675
- for (Q < s && (Q = s), k = M = 1; k <= 15; k++) if (M <<= 1, (M -= G[k]) < 0) return -1;
2676
- if (0 < M && (w === 0 || j !== 1)) return -1;
2677
- for (X[1] = 0, k = 1; k < 15; k++) X[k + 1] = X[k] + G[k];
2678
- for (F = 0; F < u; F++) v[x + F] !== 0 && (g[X[v[x + F]]++] = F);
2679
- if (B = w === 0 ? (I = st = g, 19) : w === 1 ? (I = r, J -= 257, st = i, lt -= 257, 256) : (I = l, st = p, -1), k = s, R = o, tt = F = O = 0, z = -1, E = (q = 1 << (U = Q)) - 1, w === 1 && 852 < q || w === 2 && 592 < q) return 1;
2680
- for (; ; ) {
2681
- for (L = k - tt, W = g[F] < B ? (P = 0, g[F]) : g[F] > B ? (P = st[lt + g[F]], I[J + g[F]]) : (P = 96, 0), b = 1 << k - tt, s = S = 1 << U; _[R + (O >> tt) + (S -= b)] = L << 24 | P << 16 | W | 0, S !== 0; ) ;
2682
- for (b = 1 << k - 1; O & b; ) b >>= 1;
2683
- if (b !== 0 ? (O &= b - 1, O += b) : O = 0, F++, --G[k] == 0) {
2684
- if (k === j) break;
2685
- k = v[x + g[F]];
2686
- }
2687
- if (Q < k && (O & E) !== z) {
2688
- for (tt === 0 && (tt = Q), R += s, M = 1 << (U = k - tt); U + tt < j && !((M -= G[U + tt]) <= 0); ) U++, M <<= 1;
2689
- if (q += 1 << U, w === 1 && 852 < q || w === 2 && 592 < q) return 1;
2690
- _[z = O & E] = Q << 24 | U << 16 | R - o | 0;
2691
- }
2692
- }
2693
- return O !== 0 && (_[R + O] = k - tt << 24 | 64 << 16 | 0), h.bits = Q, 0;
2694
- };
2695
- }, { "../utils/common": 41 }], 51: [function(e, f, a) {
2696
- f.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" };
2697
- }, {}], 52: [function(e, f, a) {
2698
- var n = e("../utils/common"), r = 0, i = 1;
2699
- function l(m) {
2700
- for (var C = m.length; 0 <= --C; ) m[C] = 0;
2701
- }
2702
- var p = 0, w = 29, v = 256, x = v + 1 + w, u = 30, _ = 19, o = 2 * x + 1, g = 15, h = 16, b = 7, S = 256, z = 16, E = 17, R = 18, B = [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], L = [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], P = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], W = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], Y = new Array(2 * (x + 2));
2703
- l(Y);
2704
- var k = new Array(2 * u);
2705
- l(k);
2706
- var F = new Array(512);
2707
- l(F);
2708
- var s = new Array(256);
2709
- l(s);
2710
- var j = new Array(w);
2711
- l(j);
2712
- var Q, U, tt, M = new Array(u);
2713
- function q(m, C, N, $, A) {
2714
- this.static_tree = m, this.extra_bits = C, this.extra_base = N, this.elems = $, this.max_length = A, this.has_stree = m && m.length;
2715
- }
2716
- function O(m, C) {
2717
- this.dyn_tree = m, this.max_code = 0, this.stat_desc = C;
2718
- }
2719
- function I(m) {
2720
- return m < 256 ? F[m] : F[256 + (m >>> 7)];
2721
- }
2722
- function J(m, C) {
2723
- m.pending_buf[m.pending++] = 255 & C, m.pending_buf[m.pending++] = C >>> 8 & 255;
2724
- }
2725
- function G(m, C, N) {
2726
- m.bi_valid > h - N ? (m.bi_buf |= C << m.bi_valid & 65535, J(m, m.bi_buf), m.bi_buf = C >> h - m.bi_valid, m.bi_valid += N - h) : (m.bi_buf |= C << m.bi_valid & 65535, m.bi_valid += N);
2727
- }
2728
- function X(m, C, N) {
2729
- G(m, N[2 * C], N[2 * C + 1]);
2730
- }
2731
- function st(m, C) {
2732
- for (var N = 0; N |= 1 & m, m >>>= 1, N <<= 1, 0 < --C; ) ;
2733
- return N >>> 1;
2734
- }
2735
- function lt(m, C, N) {
2736
- var $, A, Z = new Array(g + 1), K = 0;
2737
- for ($ = 1; $ <= g; $++) Z[$] = K = K + N[$ - 1] << 1;
2738
- for (A = 0; A <= C; A++) {
2739
- var H = m[2 * A + 1];
2740
- H !== 0 && (m[2 * A] = st(Z[H]++, H));
2741
- }
2742
- }
2743
- function et(m) {
2744
- var C;
2745
- for (C = 0; C < x; C++) m.dyn_ltree[2 * C] = 0;
2746
- for (C = 0; C < u; C++) m.dyn_dtree[2 * C] = 0;
2747
- for (C = 0; C < _; C++) m.bl_tree[2 * C] = 0;
2748
- m.dyn_ltree[2 * S] = 1, m.opt_len = m.static_len = 0, m.last_lit = m.matches = 0;
2749
- }
2750
- function nt(m) {
2751
- 8 < m.bi_valid ? J(m, m.bi_buf) : 0 < m.bi_valid && (m.pending_buf[m.pending++] = m.bi_buf), m.bi_buf = 0, m.bi_valid = 0;
2752
- }
2753
- function ct(m, C, N, $) {
2754
- var A = 2 * C, Z = 2 * N;
2755
- return m[A] < m[Z] || m[A] === m[Z] && $[C] <= $[N];
2756
- }
2757
- function at(m, C, N) {
2758
- for (var $ = m.heap[N], A = N << 1; A <= m.heap_len && (A < m.heap_len && ct(C, m.heap[A + 1], m.heap[A], m.depth) && A++, !ct(C, $, m.heap[A], m.depth)); ) m.heap[N] = m.heap[A], N = A, A <<= 1;
2759
- m.heap[N] = $;
2760
- }
2761
- function dt(m, C, N) {
2762
- var $, A, Z, K, H = 0;
2763
- if (m.last_lit !== 0) for (; $ = m.pending_buf[m.d_buf + 2 * H] << 8 | m.pending_buf[m.d_buf + 2 * H + 1], A = m.pending_buf[m.l_buf + H], H++, $ === 0 ? X(m, A, C) : (X(m, (Z = s[A]) + v + 1, C), (K = B[Z]) !== 0 && G(m, A -= j[Z], K), X(m, Z = I(--$), N), (K = L[Z]) !== 0 && G(m, $ -= M[Z], K)), H < m.last_lit; ) ;
2764
- X(m, S, C);
2765
- }
2766
- function ht(m, C) {
2767
- var N, $, A, Z = C.dyn_tree, K = C.stat_desc.static_tree, H = C.stat_desc.has_stree, V = C.stat_desc.elems, it = -1;
2768
- for (m.heap_len = 0, m.heap_max = o, N = 0; N < V; N++) Z[2 * N] !== 0 ? (m.heap[++m.heap_len] = it = N, m.depth[N] = 0) : Z[2 * N + 1] = 0;
2769
- for (; m.heap_len < 2; ) Z[2 * (A = m.heap[++m.heap_len] = it < 2 ? ++it : 0)] = 1, m.depth[A] = 0, m.opt_len--, H && (m.static_len -= K[2 * A + 1]);
2770
- for (C.max_code = it, N = m.heap_len >> 1; 1 <= N; N--) at(m, Z, N);
2771
- for (A = V; N = m.heap[1], m.heap[1] = m.heap[m.heap_len--], at(m, Z, 1), $ = m.heap[1], m.heap[--m.heap_max] = N, m.heap[--m.heap_max] = $, Z[2 * A] = Z[2 * N] + Z[2 * $], m.depth[A] = (m.depth[N] >= m.depth[$] ? m.depth[N] : m.depth[$]) + 1, Z[2 * N + 1] = Z[2 * $ + 1] = A, m.heap[1] = A++, at(m, Z, 1), 2 <= m.heap_len; ) ;
2772
- m.heap[--m.heap_max] = m.heap[1], (function(rt, ft) {
2773
- var bt, pt, yt, ot, kt, It, mt = ft.dyn_tree, Ut = ft.max_code, he = ft.stat_desc.static_tree, de = ft.stat_desc.has_stree, pe = ft.stat_desc.extra_bits, Wt = ft.stat_desc.extra_base, vt = ft.stat_desc.max_length, St = 0;
2774
- for (ot = 0; ot <= g; ot++) rt.bl_count[ot] = 0;
2775
- for (mt[2 * rt.heap[rt.heap_max] + 1] = 0, bt = rt.heap_max + 1; bt < o; bt++) vt < (ot = mt[2 * mt[2 * (pt = rt.heap[bt]) + 1] + 1] + 1) && (ot = vt, St++), mt[2 * pt + 1] = ot, Ut < pt || (rt.bl_count[ot]++, kt = 0, Wt <= pt && (kt = pe[pt - Wt]), It = mt[2 * pt], rt.opt_len += It * (ot + kt), de && (rt.static_len += It * (he[2 * pt + 1] + kt)));
2776
- if (St !== 0) {
2777
- do {
2778
- for (ot = vt - 1; rt.bl_count[ot] === 0; ) ot--;
2779
- rt.bl_count[ot]--, rt.bl_count[ot + 1] += 2, rt.bl_count[vt]--, St -= 2;
2780
- } while (0 < St);
2781
- for (ot = vt; ot !== 0; ot--) for (pt = rt.bl_count[ot]; pt !== 0; ) Ut < (yt = rt.heap[--bt]) || (mt[2 * yt + 1] !== ot && (rt.opt_len += (ot - mt[2 * yt + 1]) * mt[2 * yt], mt[2 * yt + 1] = ot), pt--);
2782
- }
2783
- })(m, C), lt(Z, it, m.bl_count);
2784
- }
2785
- function t(m, C, N) {
2786
- var $, A, Z = -1, K = C[1], H = 0, V = 7, it = 4;
2787
- for (K === 0 && (V = 138, it = 3), C[2 * (N + 1) + 1] = 65535, $ = 0; $ <= N; $++) A = K, K = C[2 * ($ + 1) + 1], ++H < V && A === K || (H < it ? m.bl_tree[2 * A] += H : A !== 0 ? (A !== Z && m.bl_tree[2 * A]++, m.bl_tree[2 * z]++) : H <= 10 ? m.bl_tree[2 * E]++ : m.bl_tree[2 * R]++, Z = A, it = (H = 0) === K ? (V = 138, 3) : A === K ? (V = 6, 3) : (V = 7, 4));
2788
- }
2789
- function D(m, C, N) {
2790
- var $, A, Z = -1, K = C[1], H = 0, V = 7, it = 4;
2791
- for (K === 0 && (V = 138, it = 3), $ = 0; $ <= N; $++) if (A = K, K = C[2 * ($ + 1) + 1], !(++H < V && A === K)) {
2792
- if (H < it) for (; X(m, A, m.bl_tree), --H != 0; ) ;
2793
- else A !== 0 ? (A !== Z && (X(m, A, m.bl_tree), H--), X(m, z, m.bl_tree), G(m, H - 3, 2)) : H <= 10 ? (X(m, E, m.bl_tree), G(m, H - 3, 3)) : (X(m, R, m.bl_tree), G(m, H - 11, 7));
2794
- Z = A, it = (H = 0) === K ? (V = 138, 3) : A === K ? (V = 6, 3) : (V = 7, 4);
2795
- }
2796
- }
2797
- l(M);
2798
- var T = !1;
2799
- function y(m, C, N, $) {
2800
- G(m, (p << 1) + ($ ? 1 : 0), 3), (function(A, Z, K, H) {
2801
- nt(A), J(A, K), J(A, ~K), n.arraySet(A.pending_buf, A.window, Z, K, A.pending), A.pending += K;
2802
- })(m, C, N);
2803
- }
2804
- a._tr_init = function(m) {
2805
- T || ((function() {
2806
- var C, N, $, A, Z, K = new Array(g + 1);
2807
- for (A = $ = 0; A < w - 1; A++) for (j[A] = $, C = 0; C < 1 << B[A]; C++) s[$++] = A;
2808
- for (s[$ - 1] = A, A = Z = 0; A < 16; A++) for (M[A] = Z, C = 0; C < 1 << L[A]; C++) F[Z++] = A;
2809
- for (Z >>= 7; A < u; A++) for (M[A] = Z << 7, C = 0; C < 1 << L[A] - 7; C++) F[256 + Z++] = A;
2810
- for (N = 0; N <= g; N++) K[N] = 0;
2811
- for (C = 0; C <= 143; ) Y[2 * C + 1] = 8, C++, K[8]++;
2812
- for (; C <= 255; ) Y[2 * C + 1] = 9, C++, K[9]++;
2813
- for (; C <= 279; ) Y[2 * C + 1] = 7, C++, K[7]++;
2814
- for (; C <= 287; ) Y[2 * C + 1] = 8, C++, K[8]++;
2815
- for (lt(Y, x + 1, K), C = 0; C < u; C++) k[2 * C + 1] = 5, k[2 * C] = st(C, 5);
2816
- Q = new q(Y, B, v + 1, x, g), U = new q(k, L, 0, u, g), tt = new q(new Array(0), P, 0, _, b);
2817
- })(), T = !0), m.l_desc = new O(m.dyn_ltree, Q), m.d_desc = new O(m.dyn_dtree, U), m.bl_desc = new O(m.bl_tree, tt), m.bi_buf = 0, m.bi_valid = 0, et(m);
2818
- }, a._tr_stored_block = y, a._tr_flush_block = function(m, C, N, $) {
2819
- var A, Z, K = 0;
2820
- 0 < m.level ? (m.strm.data_type === 2 && (m.strm.data_type = (function(H) {
2821
- var V, it = 4093624447;
2822
- for (V = 0; V <= 31; V++, it >>>= 1) if (1 & it && H.dyn_ltree[2 * V] !== 0) return r;
2823
- if (H.dyn_ltree[18] !== 0 || H.dyn_ltree[20] !== 0 || H.dyn_ltree[26] !== 0) return i;
2824
- for (V = 32; V < v; V++) if (H.dyn_ltree[2 * V] !== 0) return i;
2825
- return r;
2826
- })(m)), ht(m, m.l_desc), ht(m, m.d_desc), K = (function(H) {
2827
- var V;
2828
- for (t(H, H.dyn_ltree, H.l_desc.max_code), t(H, H.dyn_dtree, H.d_desc.max_code), ht(H, H.bl_desc), V = _ - 1; 3 <= V && H.bl_tree[2 * W[V] + 1] === 0; V--) ;
2829
- return H.opt_len += 3 * (V + 1) + 5 + 5 + 4, V;
2830
- })(m), A = m.opt_len + 3 + 7 >>> 3, (Z = m.static_len + 3 + 7 >>> 3) <= A && (A = Z)) : A = Z = N + 5, N + 4 <= A && C !== -1 ? y(m, C, N, $) : m.strategy === 4 || Z === A ? (G(m, 2 + ($ ? 1 : 0), 3), dt(m, Y, k)) : (G(m, 4 + ($ ? 1 : 0), 3), (function(H, V, it, rt) {
2831
- var ft;
2832
- for (G(H, V - 257, 5), G(H, it - 1, 5), G(H, rt - 4, 4), ft = 0; ft < rt; ft++) G(H, H.bl_tree[2 * W[ft] + 1], 3);
2833
- D(H, H.dyn_ltree, V - 1), D(H, H.dyn_dtree, it - 1);
2834
- })(m, m.l_desc.max_code + 1, m.d_desc.max_code + 1, K + 1), dt(m, m.dyn_ltree, m.dyn_dtree)), et(m), $ && nt(m);
2835
- }, a._tr_tally = function(m, C, N) {
2836
- return m.pending_buf[m.d_buf + 2 * m.last_lit] = C >>> 8 & 255, m.pending_buf[m.d_buf + 2 * m.last_lit + 1] = 255 & C, m.pending_buf[m.l_buf + m.last_lit] = 255 & N, m.last_lit++, C === 0 ? m.dyn_ltree[2 * N]++ : (m.matches++, C--, m.dyn_ltree[2 * (s[N] + v + 1)]++, m.dyn_dtree[2 * I(C)]++), m.last_lit === m.lit_bufsize - 1;
2837
- }, a._tr_align = function(m) {
2838
- G(m, 2, 3), X(m, S, Y), (function(C) {
2839
- C.bi_valid === 16 ? (J(C, C.bi_buf), C.bi_buf = 0, C.bi_valid = 0) : 8 <= C.bi_valid && (C.pending_buf[C.pending++] = 255 & C.bi_buf, C.bi_buf >>= 8, C.bi_valid -= 8);
2840
- })(m);
2841
- };
2842
- }, { "../utils/common": 41 }], 53: [function(e, f, a) {
2843
- f.exports = function() {
2844
- 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;
2845
- };
2846
- }, {}], 54: [function(e, f, a) {
2847
- (function(n) {
2848
- (function(r, i) {
2849
- if (!r.setImmediate) {
2850
- var l, p, w, v, x = 1, u = {}, _ = !1, o = r.document, g = Object.getPrototypeOf && Object.getPrototypeOf(r);
2851
- g = g && g.setTimeout ? g : r, l = {}.toString.call(r.process) === "[object process]" ? function(z) {
2852
- process.nextTick(function() {
2853
- b(z);
2854
- });
2855
- } : (function() {
2856
- if (r.postMessage && !r.importScripts) {
2857
- var z = !0, E = r.onmessage;
2858
- return r.onmessage = function() {
2859
- z = !1;
2860
- }, r.postMessage("", "*"), r.onmessage = E, z;
2861
- }
2862
- })() ? (v = "setImmediate$" + Math.random() + "$", r.addEventListener ? r.addEventListener("message", S, !1) : r.attachEvent("onmessage", S), function(z) {
2863
- r.postMessage(v + z, "*");
2864
- }) : r.MessageChannel ? ((w = new MessageChannel()).port1.onmessage = function(z) {
2865
- b(z.data);
2866
- }, function(z) {
2867
- w.port2.postMessage(z);
2868
- }) : o && "onreadystatechange" in o.createElement("script") ? (p = o.documentElement, function(z) {
2869
- var E = o.createElement("script");
2870
- E.onreadystatechange = function() {
2871
- b(z), E.onreadystatechange = null, p.removeChild(E), E = null;
2872
- }, p.appendChild(E);
2873
- }) : function(z) {
2874
- setTimeout(b, 0, z);
2875
- }, g.setImmediate = function(z) {
2876
- typeof z != "function" && (z = new Function("" + z));
2877
- for (var E = new Array(arguments.length - 1), R = 0; R < E.length; R++) E[R] = arguments[R + 1];
2878
- var B = { callback: z, args: E };
2879
- return u[x] = B, l(x), x++;
2880
- }, g.clearImmediate = h;
2881
- }
2882
- function h(z) {
2883
- delete u[z];
2884
- }
2885
- function b(z) {
2886
- if (_) setTimeout(b, 0, z);
2887
- else {
2888
- var E = u[z];
2889
- if (E) {
2890
- _ = !0;
2891
- try {
2892
- (function(R) {
2893
- var B = R.callback, L = R.args;
2894
- switch (L.length) {
2895
- case 0:
2896
- B();
2897
- break;
2898
- case 1:
2899
- B(L[0]);
2900
- break;
2901
- case 2:
2902
- B(L[0], L[1]);
2903
- break;
2904
- case 3:
2905
- B(L[0], L[1], L[2]);
2906
- break;
2907
- default:
2908
- B.apply(i, L);
2909
- }
2910
- })(E);
2911
- } finally {
2912
- h(z), _ = !1;
2913
- }
2914
- }
2915
- }
2916
- }
2917
- function S(z) {
2918
- z.source === r && typeof z.data == "string" && z.data.indexOf(v) === 0 && b(+z.data.slice(v.length));
2919
- }
2920
- })(typeof self > "u" ? n === void 0 ? this : n : self);
2921
- }).call(this, typeof zt < "u" ? zt : typeof self < "u" ? self : typeof window < "u" ? window : {});
2922
- }, {}] }, {}, [10])(10);
2923
- });
2924
- })(Ot)), Ot.exports;
2925
- }
2926
- var qe = Je();
2927
- const Qe = /* @__PURE__ */ Ve(qe), tr = /<xi:include\b[^>]*\bhref\s*=\s*(?:"([^"]+)"|'([^']+)')[^>]*\/>/g;
2928
- function er(d) {
2929
- const c = d.lastIndexOf("/");
2930
- return c >= 0 ? d.slice(0, c) : "";
2931
- }
2932
- function rr(d) {
2933
- return d.replace(/\\/g, "/").replace(/^\.\//, "");
2934
- }
2935
- function nr(d, c, e) {
2936
- const f = er(c), a = [
2937
- d,
2938
- `${d}.ptx`,
2939
- `${d}.xml`,
2940
- f ? `${f}/${d}` : null,
2941
- f ? `${f}/${d}.ptx` : `${d}.ptx`,
2942
- f ? `${f}/${d}.xml` : `${d}.xml`
2943
- ].filter((n) => n !== null);
2944
- for (const n of a) {
2945
- const r = rr(n);
2946
- if (r in e)
2947
- return r;
2948
- }
2949
- return null;
2950
- }
2951
- function ir(d) {
2952
- return d.replace(/^\s*<\?xml[^?]*\?>\s*/, "");
2953
- }
2954
- function sr(d, c, e, f = 5) {
2955
- let a = 0;
2956
- const n = [], r = [], i = (p, w) => {
2957
- let v = !1;
2958
- return { output: p.replace(
2959
- tr,
2960
- (u, _, o) => {
2961
- const g = _ ?? o ?? "", h = nr(g, w, e);
2962
- return h ? r.includes(h) ? u : (v = !0, a += 1, ir(e[h])) : (n.includes(g) || n.push(g), u);
2963
- }
2964
- ), changed: v };
2965
- };
2966
- let l = d;
2967
- for (let p = 0; p < f; p += 1) {
2968
- r.push(c);
2969
- const { output: w, changed: v } = i(l, c);
2970
- if (r.pop(), l = w, !v)
2971
- break;
2972
- }
2973
- return {
2974
- expandedText: l,
2975
- expandedCount: a,
2976
- missingIncludes: n
2977
- };
2978
- }
2979
- const ar = /<(pretext|book|article)\b/;
2980
- function or(d) {
2981
- const c = Object.keys(d).filter((f) => /\.(ptx|xml)$/i.test(f)).sort();
2982
- return c.length === 0 ? null : c.find((f) => ar.test(d[f])) ?? c[0];
2983
- }
2984
- const Vt = /([a-zA-Z_:][\w:.-]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/g;
2985
- function At(d) {
2986
- const c = {};
2987
- let e;
2988
- for (Vt.lastIndex = 0; (e = Vt.exec(d)) !== null; )
2989
- c[e[1]] = e[2] ?? e[3] ?? "";
2990
- return c;
2991
- }
2992
- function ce(d) {
2993
- const c = [];
2994
- let e = 0;
2995
- const f = d.length;
2996
- for (; e < f; ) {
2997
- const a = d.indexOf("<", e);
2998
- if (a < 0) break;
2999
- if (d.startsWith("<!--", a)) {
3000
- const o = d.indexOf("-->", a + 4);
3001
- e = o < 0 ? f : o + 3;
3002
- continue;
3003
- }
3004
- if (d.startsWith("<![CDATA[", a)) {
3005
- const o = d.indexOf("]]>", a + 9);
3006
- e = o < 0 ? f : o + 3;
3007
- continue;
3008
- }
3009
- if (d.startsWith("<?", a)) {
3010
- const o = d.indexOf("?>", a + 2);
3011
- e = o < 0 ? f : o + 2;
3012
- continue;
3013
- }
3014
- if (d.startsWith("<!", a)) {
3015
- const o = d.indexOf(">", a + 2);
3016
- e = o < 0 ? f : o + 1;
3017
- continue;
3018
- }
3019
- let n = a + 1, r = !1;
3020
- d[n] === "/" && (r = !0, n += 1);
3021
- const i = /^[a-zA-Z_:][\w:.-]*/.exec(d.slice(n));
3022
- if (!i) {
3023
- e = a + 1;
3024
- continue;
3025
- }
3026
- const l = i[0];
3027
- n += l.length;
3028
- let p = n, w = null;
3029
- for (; n < f; ) {
3030
- const o = d[n];
3031
- if (w) {
3032
- o === w && (w = null), n += 1;
3033
- continue;
3034
- }
3035
- if (o === '"' || o === "'") {
3036
- w = o, n += 1;
3037
- continue;
3038
- }
3039
- if (o === ">")
3040
- break;
3041
- n += 1;
3042
- }
3043
- if (n >= f) break;
3044
- const v = n + 1, x = d.slice(p, n), u = !r && x.trimEnd().endsWith("/"), _ = u ? x.replace(/\/\s*$/, "") : x;
3045
- r ? c.push({ kind: "close", name: l, pos: a, end: v }) : u ? c.push({ kind: "selfclose", name: l, attrs: _, pos: a, end: v }) : c.push({ kind: "open", name: l, attrs: _, pos: a, end: v }), e = v;
3046
- }
3047
- return c;
3048
- }
3049
- function Nt(d, c) {
3050
- const e = ce(d), f = [];
3051
- let a = 0, n = null;
3052
- for (const r of e) {
3053
- if (r.kind === "selfclose") {
3054
- a === 0 && r.name === c && f.push({
3055
- name: c,
3056
- start: r.pos,
3057
- startTagEnd: r.end,
3058
- contentEnd: r.end,
3059
- end: r.end,
3060
- inner: "",
3061
- outer: d.slice(r.pos, r.end),
3062
- attributes: At(r.attrs)
3063
- });
3064
- continue;
3065
- }
3066
- if (r.kind === "open") {
3067
- a === 0 && r.name === c && !n && (n = r), a += 1;
3068
- continue;
3069
- }
3070
- a -= 1, a < 0 && (a = 0), n && a === 0 && r.name === c && (f.push({
3071
- name: c,
3072
- start: n.pos,
3073
- startTagEnd: n.end,
3074
- contentEnd: r.pos,
3075
- end: r.end,
3076
- inner: d.slice(n.end, r.pos),
3077
- outer: d.slice(n.pos, r.end),
3078
- attributes: At(
3079
- n.attrs
3080
- )
3081
- }), n = null);
3082
- }
3083
- return f;
3084
- }
3085
- function wt(d, c) {
3086
- return Nt(d, c)[0] ?? null;
3087
- }
3088
- function Ct(d, c) {
3089
- const e = ce(d);
3090
- let f = 0, a = null, n = -1;
3091
- for (const r of e) {
3092
- if (r.kind === "selfclose") {
3093
- if (!a && r.name === c)
3094
- return {
3095
- name: c,
3096
- start: r.pos,
3097
- startTagEnd: r.end,
3098
- contentEnd: r.end,
3099
- end: r.end,
3100
- inner: "",
3101
- outer: d.slice(r.pos, r.end),
3102
- attributes: At(r.attrs)
3103
- };
3104
- continue;
3105
- }
3106
- if (r.kind === "open") {
3107
- !a && r.name === c && (a = r, n = f), f += 1;
3108
- continue;
3109
- }
3110
- if (f -= 1, f < 0 && (f = 0), a && r.name === c && f === n) {
3111
- const i = a.attrs;
3112
- return {
3113
- name: c,
3114
- start: a.pos,
3115
- startTagEnd: a.end,
3116
- contentEnd: r.pos,
3117
- end: r.end,
3118
- inner: d.slice(a.end, r.pos),
3119
- outer: d.slice(a.pos, r.end),
3120
- attributes: At(i)
3121
- };
3122
- }
3123
- }
3124
- return null;
3125
- }
3126
- function cr(d) {
3127
- return Ct(d, "book") ? "book" : Ct(d, "article") ? "article" : Ct(d, "chapter") ? "book" : "article";
3128
- }
3129
- function lr(d) {
3130
- const { mainSource: c, publication: e, outputBase: f = "output" } = d;
3131
- return `<?xml version="1.0" encoding="UTF-8"?>
3132
- <project ptx-version="2">
3133
- <targets>
3134
- <target name="web">
3135
- <format>html</format>
3136
- <source>${c}</source>
3137
- <publication>${e}</publication>
3138
- <output-dir>${f}/web</output-dir>
3139
- </target>
3140
- <target name="print">
3141
- <format>pdf</format>
3142
- <source>${c}</source>
3143
- <publication>${e}</publication>
3144
- <output-dir>${f}/print</output-dir>
3145
- </target>
3146
- </targets>
3147
- </project>
3148
- `;
3149
- }
3150
- function ur() {
3151
- return `<?xml version="1.0" encoding="UTF-8"?>
3152
- <publication>
3153
- <source>
3154
- <directories external="external" generated="generated"/>
3155
- </source>
3156
- <common>
3157
- <chunking level="1"/>
3158
- </common>
3159
- </publication>
3160
- `;
3161
- }
3162
- function fr() {
3163
- return `<?xml version="1.0" encoding="UTF-8"?>
3164
- `;
3165
- }
3166
- const hr = "http://www.w3.org/2001/XInclude";
3167
- function dr(d) {
3168
- return d.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60);
3169
- }
3170
- function Jt(d, c) {
3171
- const e = String(c).length;
3172
- return String(d).padStart(Math.max(e, 2), "0");
3173
- }
3174
- function qt(d, c) {
3175
- const e = [...c].sort((n, r) => n.start - r.start);
3176
- let f = "", a = 0;
3177
- for (const n of e)
3178
- f += d.slice(a, n.start), f += n.replacement, a = n.end;
3179
- return f += d.slice(a), f;
3180
- }
3181
- function Qt(d) {
3182
- return d.replace(
3183
- /<(pretext|book|article|chapter)\b([^>]*)>/,
3184
- (c, e, f) => /\bxmlns:xi\s*=/.test(f) ? c : `<${e}${f} xmlns:xi="${hr}">`
3185
- );
3186
- }
3187
- function te(d) {
3188
- return d.startsWith("<?xml") ? d : fr() + d;
3189
- }
3190
- function le(d) {
3191
- return d.trim().replace(/[^a-zA-Z0-9\-_]+/g, "-").replace(/^[^a-zA-Z_]+/, "").replace(/-+$/, "");
3192
- }
3193
- class pr {
3194
- used = /* @__PURE__ */ new Set();
3195
- claim(c) {
3196
- let e = c, f = 2;
3197
- for (; this.used.has(e); )
3198
- e = `${c}-${f}`, f += 1;
3199
- return this.used.add(e), e;
3200
- }
3201
- has(c) {
3202
- return this.used.has(c);
3203
- }
3204
- }
3205
- function Tt(d, c, e) {
3206
- const f = d.slice(0, c), a = d.slice(c);
3207
- return /\bxml:id\s*=\s*(?:"[^"]*"|'[^']*')/.test(f) ? f.replace(
3208
- /\bxml:id\s*=\s*(?:"[^"]*"|'[^']*')/,
3209
- `xml:id="${e}"`
3210
- ) + a : f.replace(/^<([a-zA-Z_:][\w:.-]*)/, `<$1 xml:id="${e}"`) + a;
3211
- }
3212
- function Rt(d) {
3213
- const c = wt(d, "title");
3214
- return c ? c.inner.replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim() : "";
3215
- }
3216
- function Bt(d, c, e) {
3217
- const f = d.attributes["xml:id"];
3218
- if (f) {
3219
- const a = le(f) || e, n = c.claim(a);
3220
- return n !== f ? { ref: n, renamedFrom: f, generated: !1 } : { ref: n, generated: !1 };
3221
- }
3222
- return { ref: c.claim(e), generated: !0 };
3223
- }
3224
- function Pt(d, c, e, f) {
3225
- c.renamedFrom !== void 0 ? d.push({
3226
- action: "anomaly",
3227
- severity: "warning",
3228
- kind: "structure",
3229
- category: "renamed_xml_id",
3230
- macro: e,
3231
- occurrences: 1,
3232
- message: `<${e}> xml:id \`${c.renamedFrom}\` is not a valid ref (or collides with another); renamed to \`${c.ref}\`. Cross-references to the old id will break.`
3233
- }) : c.generated && d.push({
3234
- action: "anomaly",
3235
- severity: "info",
3236
- kind: "structure",
3237
- category: "missing_xml_id",
3238
- macro: e,
3239
- occurrences: 1,
3240
- message: `<${e}> at position ${f} has no xml:id; assigned \`${c.ref}\`.`
3241
- });
3242
- }
3243
- function ee(d, c) {
3244
- const e = d.outer.slice(0, d.startTagEnd - d.start), f = d.outer.slice(d.contentEnd - d.start);
3245
- return e + c + f;
3246
- }
3247
- function mr(d, c) {
3248
- return Object.entries(d).map(([e, f]) => {
3249
- const a = e.split("/").pop() ?? e, n = a.replace(/\.[^.]+$/, "");
3250
- return { ref: c.claim(le(n) || "asset"), fileName: a, data: f };
3251
- });
3252
- }
3253
- function gr(d, c = {}) {
3254
- const e = [], f = c.documentKind ?? cr(d), a = c.splitChapters ?? f === "book", n = c.splitSections ?? !1, r = Ct(d, "pretext"), i = r ? r.inner : d, l = wt(i, "docinfo"), p = l?.outer.trim() ?? "";
3255
- let w = wt(i, "book") ?? wt(i, "article");
3256
- if (!w) {
3257
- const b = f === "book" ? "book" : "article", S = (l ? i.slice(0, l.start) + i.slice(l.end) : i).trim();
3258
- w = wt(
3259
- `<${b}>
3260
- ${S}
3261
- </${b}>`,
3262
- b
3263
- );
3264
- }
3265
- if (!w)
3266
- throw new Error("Could not locate a root element for the division pool.");
3267
- f === "book" && w.name !== "book" && e.push({
3268
- action: "anomaly",
3269
- severity: "warning",
3270
- kind: "structure",
3271
- category: "missing_root",
3272
- macro: "book",
3273
- occurrences: 1,
3274
- message: "Document was treated as a book but no <book> element found; importing with the existing root."
3275
- });
3276
- const v = new pr(), x = [], u = Bt(w, v, "document");
3277
- u.renamedFrom !== void 0 && Pt(e, u, w.name, 1);
3278
- const _ = Rt(w.inner);
3279
- let o = w.inner;
3280
- if (a && f === "book") {
3281
- const b = Nt(w.inner, "chapter"), S = b.map((z, E) => {
3282
- const R = Bt(
3283
- z,
3284
- v,
3285
- `ch-${Jt(E + 1, b.length)}`
3286
- );
3287
- Pt(e, R, "chapter", E + 1);
3288
- let B = z.inner;
3289
- if (n) {
3290
- const L = Nt(z.inner, "section"), P = L.map((W, Y) => {
3291
- const k = Bt(
3292
- W,
3293
- v,
3294
- `${R.ref}-sec-${Jt(Y + 1, L.length)}`
3295
- );
3296
- return Pt(e, k, "section", Y + 1), x.push({
3297
- xmlId: k.ref,
3298
- type: "section",
3299
- title: Rt(W.inner),
3300
- sourceFormat: "pretext",
3301
- content: Tt(
3302
- W.outer,
3303
- W.startTagEnd - W.start,
3304
- k.ref
3305
- ),
3306
- isRoot: !1
3307
- }), {
3308
- start: W.start,
3309
- end: W.end,
3310
- replacement: `<plus:section ref="${k.ref}"/>`
3311
- };
3312
- });
3313
- B = qt(z.inner, P);
3314
- }
3315
- return x.push({
3316
- xmlId: R.ref,
3317
- type: "chapter",
3318
- title: Rt(z.inner),
3319
- sourceFormat: "pretext",
3320
- content: Tt(
3321
- ee(z, B),
3322
- z.startTagEnd - z.start,
3323
- R.ref
3324
- ),
3325
- isRoot: !1
3326
- }), {
3327
- start: z.start,
3328
- end: z.end,
3329
- replacement: `<plus:chapter ref="${R.ref}"/>`
3330
- };
3331
- });
3332
- o = qt(w.inner, S);
3333
- }
3334
- const g = {
3335
- xmlId: u.ref,
3336
- type: w.name === "book" ? "book" : "article",
3337
- title: _,
3338
- sourceFormat: "pretext",
3339
- content: Tt(
3340
- ee(w, o),
3341
- w.startTagEnd - w.start,
3342
- u.ref
3343
- ),
3344
- isRoot: !0
3345
- };
3346
- x.unshift(g);
3347
- const h = mr(c.assets ?? {}, v);
3348
- return {
3349
- project: {
3350
- title: _,
3351
- docinfo: p,
3352
- documentKind: f,
3353
- divisions: x,
3354
- assets: h
3355
- },
3356
- warnings: e
3357
- };
3358
- }
3359
- const Ft = {
3360
- mainSourcePath: "source/main.ptx",
3361
- publicationPath: "publication/publication.ptx",
3362
- projectFilePath: "project.ptx"
3363
- }, $t = /<plus:([a-zA-Z][a-zA-Z-]*)\s+ref="([^"]+)"\s*\/>/g;
3364
- function re(d) {
3365
- const c = [];
3366
- $t.lastIndex = 0;
3367
- let e;
3368
- for (; (e = $t.exec(d)) !== null; )
3369
- c.push(e[2]);
3370
- return c;
3371
- }
3372
- function Dt(d, c) {
3373
- const e = dr(d) || "division";
3374
- return e.startsWith(`${c}-`) ? e : `${c}-${e}`;
3375
- }
3376
- function jt(d, c) {
3377
- let e = c, f = 2;
3378
- for (; d.has(e); )
3379
- e = `${c}-${f}`, f += 1;
3380
- return d.add(e), e;
3381
- }
3382
- function _r(d, c) {
3383
- const e = `${c}-`;
3384
- return d.startsWith(e) ? d.slice(e.length) : d;
3385
- }
3386
- function ne(d, c) {
3387
- return d.replace($t, (e, f, a) => {
3388
- const n = c.get(a);
3389
- return n ? `<xi:include href="${n}"/>` : e;
3390
- });
3391
- }
3392
- function br(d, c = {}) {
3393
- const e = c.mainSourcePath ?? Ft.mainSourcePath, f = c.publicationPath ?? Ft.publicationPath, a = c.projectFilePath ?? Ft.projectFilePath, n = c.includeScaffold ?? !0, r = {}, i = new Map(
3394
- d.divisions.map((h) => [h.xmlId, h])
3395
- ), l = d.divisions.find((h) => h.isRoot);
3396
- if (!l)
3397
- throw new Error("Division pool has no root division.");
3398
- const p = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Map(), v = e.includes("/") ? e.slice(0, e.lastIndexOf("/") + 1) : "", x = [];
3399
- for (const h of re(l.content)) {
3400
- const b = i.get(h);
3401
- if (!b) continue;
3402
- const S = jt(
3403
- p,
3404
- Dt(b.xmlId, "ch")
3405
- );
3406
- w.set(b.xmlId, `${S}.ptx`), x.push({
3407
- division: b,
3408
- filePath: `${v}${S}.ptx`
3409
- });
3410
- const z = /* @__PURE__ */ new Set();
3411
- for (const E of re(b.content)) {
3412
- const R = i.get(E);
3413
- if (!R) continue;
3414
- const B = jt(
3415
- z,
3416
- Dt(_r(R.xmlId, b.xmlId), "sec")
3417
- );
3418
- w.set(R.xmlId, `${S}/${B}.ptx`), x.push({
3419
- division: R,
3420
- filePath: `${v}${S}/${B}.ptx`
3421
- });
3422
- }
3423
- }
3424
- const u = new Set(x.map((h) => h.division.xmlId));
3425
- for (const h of d.divisions) {
3426
- if (h.isRoot || u.has(h.xmlId)) continue;
3427
- const b = h.type === "section" ? "sec" : "ch", S = jt(p, Dt(h.xmlId, b));
3428
- w.set(h.xmlId, `${S}.ptx`), x.push({ division: h, filePath: `${v}${S}.ptx` });
3429
- }
3430
- for (const { division: h, filePath: b } of x) {
3431
- const S = ne(h.content, w), z = S === h.content ? S : Qt(S);
3432
- r[b] = te(z);
3433
- }
3434
- const _ = ne(l.content, w), g = `<pretext>
3435
- ${d.docinfo ? `${d.docinfo}
3436
- ` : ""}${_}
3437
- </pretext>`;
3438
- return r[e] = te(
3439
- _ === l.content ? g : Qt(g)
3440
- ), n && (r[a] = lr({
3441
- mainSource: e,
3442
- publication: f
3443
- }), r[f] = ur()), { files: r };
3444
- }
3445
- const yr = /\.(tex|zip|md|markdown|ptx|xml|tar\.gz|tgz)$/i, vr = [
3446
- "tex",
3447
- "md",
3448
- "markdown",
3449
- "ptx",
3450
- "xml",
3451
- "bib",
3452
- "sty",
3453
- "txt",
3454
- "pdf",
3455
- "eps",
3456
- "png",
3457
- "ps",
3458
- "bbl"
3459
- ], wr = /* @__PURE__ */ new Set([
3460
- "png",
3461
- "jpg",
3462
- "jpeg",
3463
- "gif",
3464
- "pdf",
3465
- "eps",
3466
- "ps",
3467
- "bmp",
3468
- "tiff",
3469
- "tif",
3470
- "webp",
3471
- "ico"
3472
- ]), xr = /* @__PURE__ */ new Set([
3473
- "png",
3474
- "jpg",
3475
- "jpeg",
3476
- "gif",
3477
- "svg",
3478
- "bmp",
3479
- "tiff",
3480
- "tif",
3481
- "webp",
3482
- "ico",
3483
- "pdf",
3484
- "eps",
3485
- "ps"
3486
- ]);
3487
- function ue(d) {
3488
- return wr.has(d.toLowerCase());
3489
- }
3490
- function fe(d) {
3491
- return d.split("/").pop() ?? d;
3492
- }
3493
- function kr(d) {
3494
- const c = fe(d), e = gt(c);
3495
- return xr.has(e) ? `source/assets/${c}` : null;
3496
- }
3497
- function Sr(d) {
3498
- const c = fe(d);
3499
- return gt(c) === "bib" ? `source/${c}` : null;
3500
- }
3501
- function xt(d) {
3502
- return d.replace(/\r\n?/g, `
3503
- `).replace(/(\n *){3,}/g, `
3504
-
3505
- `);
3506
- }
3507
- function _t(d) {
3508
- return d.replace(/\\/g, "/").replace(/^\.\//, "");
3509
- }
3510
- function zr(d) {
3511
- const c = d.toLowerCase();
3512
- return c.endsWith(".tar.gz") || c.endsWith(".tgz") ? "tar.gz" : c.endsWith(".zip") ? "zip" : c.endsWith(".tex") ? "tex" : c.endsWith(".md") || c.endsWith(".markdown") ? "markdown" : c.endsWith(".ptx") || c.endsWith(".xml") ? "pretext" : null;
3513
- }
3514
- function Er(d) {
3515
- const c = (e, f) => new TextDecoder().decode(d.slice(e, f)).split("\0")[0];
3516
- return {
3517
- name: c(0, 100),
3518
- size: parseInt(c(124, 136), 8) || 0,
3519
- type: c(156, 157)
3520
- };
3521
- }
3522
- async function Cr(d) {
3523
- if (typeof DecompressionStream > "u")
3524
- throw new Error("This runtime does not support gzip decompression.");
3525
- const f = new ReadableStream({
3526
- start(l) {
3527
- l.enqueue(new Uint8Array(d)), l.close();
3528
- }
3529
- }).pipeThrough(
3530
- new DecompressionStream("gzip")
3531
- ).getReader(), a = [];
3532
- for (; ; ) {
3533
- const { done: l, value: p } = await f.read();
3534
- if (l)
3535
- break;
3536
- a.push(p);
3537
- }
3538
- const n = a.reduce((l, p) => l + p.length, 0), r = new Uint8Array(n);
3539
- let i = 0;
3540
- for (const l of a)
3541
- r.set(l, i), i += l.length;
3542
- return r.buffer;
3543
- }
3544
- function Ar(d) {
3545
- const c = {}, e = {};
3546
- let f = 0;
3547
- for (; f < d.length && !(f + 512 > d.length); ) {
3548
- const a = d.slice(f, f + 512), n = Er(a);
3549
- if (!n.name)
3550
- break;
3551
- f += 512;
3552
- const r = n.size, i = Math.ceil(r / 512) * 512;
3553
- if (n.type === "0" || n.type === "") {
3554
- const l = d.slice(f, f + r), p = _t(n.name);
3555
- if (ue(gt(p)))
3556
- e[p] = l;
3557
- else {
3558
- const w = new TextDecoder().decode(l);
3559
- c[p] = xt(w);
3560
- }
3561
- }
3562
- f += i;
3563
- }
3564
- return { files: c, assets: e };
3565
- }
3566
- async function Ir(d) {
3567
- const c = zr(d.name);
3568
- if (!c)
3569
- throw new Error(
3570
- "File format not supported: please upload .tex, .md, .ptx, .xml, .zip, or .tar.gz."
3571
- );
3572
- if (c === "tex" || c === "markdown" || c === "pretext") {
3573
- const a = await d.text();
3574
- return {
3575
- files: { [_t(d.name)]: xt(a) },
3576
- assets: {}
3577
- };
3578
- }
3579
- if (c === "zip") {
3580
- const n = await new Qe().loadAsync(d), r = {}, i = {};
3581
- for (const [l, p] of Object.entries(n.files)) {
3582
- if (p.dir)
3583
- continue;
3584
- const w = _t(l);
3585
- if (ue(gt(w)))
3586
- i[w] = await p.async("uint8array");
3587
- else {
3588
- const v = await p.async("string");
3589
- r[w] = xt(v);
3590
- }
3591
- }
3592
- return { files: r, assets: i };
3593
- }
3594
- const e = await d.arrayBuffer(), f = await Cr(e);
3595
- return Ar(new Uint8Array(f));
3596
- }
3597
- function gt(d) {
3598
- const c = d.toLowerCase().match(/\.([^.\/]+)$/);
3599
- return c ? c[1] : "";
3600
- }
3601
- function Or(d) {
3602
- const c = Object.keys(d).filter((f) => gt(f) === "tex").sort();
3603
- return c.length === 0 ? null : c.find(
3604
- (f) => /\\begin *\{document\}/.test(d[f])
3605
- ) ?? c[0];
3606
- }
3607
- function Tr(d) {
3608
- const c = d.lastIndexOf("/");
3609
- return c >= 0 ? d.slice(0, c) : "";
3610
- }
3611
- function Rr(d, c, e) {
3612
- const f = Tr(c);
3613
- return [
3614
- d,
3615
- `${d}.tex`,
3616
- f ? `${f}/${d}` : d,
3617
- f ? `${f}/${d}.tex` : `${d}.tex`
3618
- ].map(_t).find((n) => n in e) ?? null;
3619
- }
3620
- function Br(d, c, e) {
3621
- let f = 0;
3622
- const a = [], n = (i) => {
3623
- let l = !1;
3624
- return { output: i.replace(
3625
- /(\\(input|include) *\{([^{}]+)\})/g,
3626
- (w, v, x, u) => {
3627
- const _ = Rr(u, c, e);
3628
- return _ ? (l = !0, f += 1, e[_]) : (a.includes(u) || a.push(u), w);
3629
- }
3630
- ), changed: l };
3631
- };
3632
- let r = d;
3633
- for (let i = 0; i < 3; i += 1) {
3634
- const { output: l, changed: p } = n(r);
3635
- if (r = l, !p)
3636
- break;
3637
- }
3638
- return { expandedText: xt(r), expandedCount: f, missingInputs: a };
3639
- }
3640
- function Pr(d) {
3641
- const c = Or(d);
3642
- if (c)
3643
- return { sourcePath: c, sourceType: "tex" };
3644
- const e = Object.keys(d).sort(), f = e.find((i) => {
3645
- const l = gt(i);
3646
- return l === "md" || l === "markdown";
3647
- });
3648
- if (f)
3649
- return { sourcePath: f, sourceType: "markdown" };
3650
- const a = or(d);
3651
- if (a)
3652
- return { sourcePath: a, sourceType: "pretext" };
3653
- if (e.length === 0)
3654
- throw new Error("No files were found in the uploaded source.");
3655
- const n = e[0], r = ie(d[n]);
3656
- return {
3657
- sourcePath: n,
3658
- sourceType: r === "latex" ? "tex" : r
3659
- };
3660
- }
3661
- function Fr(d) {
3662
- const c = { other: 0 };
3663
- for (const e of vr)
3664
- c[e] = 0;
3665
- for (const e of Object.keys(d)) {
3666
- const f = gt(e);
3667
- f in c ? c[f] += 1 : c.other += 1;
3668
- }
3669
- return c;
3670
- }
3671
- function Dr(d, c) {
3672
- const e = Fr(c);
3673
- d.push({ type: "success", message: "File types:" });
3674
- for (const f of Object.keys(e).sort())
3675
- e[f] && d.push({ type: "success", message: `${f}: ${e[f]}` });
3676
- }
3677
- function jr(d) {
3678
- return d === "tex" ? "latex" : d === "markdown" ? "markdown" : "pretext";
3679
- }
3680
- function Nr(d, c = {}) {
3681
- const e = [];
3682
- try {
3683
- const f = Object.fromEntries(
3684
- Object.entries(d).map(([z, E]) => [
3685
- _t(z),
3686
- xt(E)
3687
- ])
3688
- ), a = Object.keys(f).length;
3689
- e.push({
3690
- type: "success",
3691
- message: `Found ${a} file${a === 1 ? "" : "s"}.`
3692
- }), Dr(e, f);
3693
- const { sourcePath: n, sourceType: r } = Pr(f);
3694
- let i = f[n] ?? "";
3695
- if (r === "tex") {
3696
- const z = Object.fromEntries(
3697
- Object.entries(f).filter(
3698
- ([L]) => gt(L) === "tex"
3699
- )
3700
- ), { expandedText: E, expandedCount: R, missingInputs: B } = Br(
3701
- i,
3702
- n,
3703
- z
3704
- );
3705
- i = E, R > 0 && e.push({
3706
- type: "success",
3707
- message: `Expanded ${R} input/include reference${R === 1 ? "" : "s"}.`
3708
- }), B.length > 0 && e.push({
3709
- type: "error",
3710
- message: `Missing input/include files: ${B.join(", ")}.`
3711
- });
3712
- } else if (r === "pretext") {
3713
- const z = Object.fromEntries(
3714
- Object.entries(f).filter(([L]) => {
3715
- const P = gt(L);
3716
- return P === "ptx" || P === "xml";
3717
- })
3718
- ), { expandedText: E, expandedCount: R, missingIncludes: B } = sr(i, n, z);
3719
- i = E, R > 0 && e.push({
3720
- type: "success",
3721
- message: `Expanded ${R} xi:include reference${R === 1 ? "" : "s"}.`
3722
- }), B.length > 0 && e.push({
3723
- type: "error",
3724
- message: `Missing xi:include targets: ${B.join(", ")}.`
3725
- });
3726
- }
3727
- e.push({
3728
- type: "success",
3729
- message: `Main source file: ${n}`
3730
- });
3731
- const l = jr(r), p = Ye(i, l);
3732
- if ("pretextError" in p)
3733
- return {
3734
- pretextError: p.pretextError,
3735
- statusMessages: e,
3736
- warnings: p.warnings
3737
- };
3738
- const {
3739
- buildLayout: w = !0,
3740
- assets: v = {},
3741
- ...x
3742
- } = c, u = {}, _ = {};
3743
- for (const [z, E] of Object.entries(v)) {
3744
- const R = kr(z);
3745
- R && (u[R] = E, _[z] = E);
3746
- }
3747
- const o = gr(p.pretextSource, {
3748
- documentKind: x.documentKind,
3749
- splitChapters: w ? x.splitChapters : !1,
3750
- splitSections: w ? x.splitSections : !1,
3751
- assets: _
3752
- }), g = w ? br(o.project, {
3753
- mainSourcePath: x.mainSourcePath,
3754
- publicationPath: x.publicationPath,
3755
- projectFilePath: x.projectFilePath
3756
- }).files : { "source/main.ptx": p.pretextSource };
3757
- for (const [z, E] of Object.entries(f)) {
3758
- const R = Sr(z);
3759
- R && !(R in g) && (g[R] = E);
3760
- }
3761
- const h = o.project.documentKind, b = [...p.warnings, ...o.warnings];
3762
- let S;
3763
- return p.cleanedNativeSource !== void 0 && p.cleanedNativeSource.length > 0 && (p.sourceFormat === "latex" ? S = { "source/main.tex": p.cleanedNativeSource } : p.sourceFormat === "markdown" && (S = { "source/main.md": p.cleanedNativeSource })), Object.keys(v).length > 0 && e.push({
3764
- type: "success",
3765
- message: `Routed ${Object.keys(u).length} binary asset${Object.keys(u).length === 1 ? "" : "s"}.`
3766
- }), {
3767
- ...p,
3768
- warnings: b,
3769
- sourcePath: n,
3770
- sourceName: n.split("/").pop() ?? n,
3771
- sourceType: r,
3772
- project: o.project,
3773
- files: f,
3774
- assets: v,
3775
- outputFiles: g,
3776
- outputAssets: u,
3777
- nativeOutputFiles: S,
3778
- documentKind: h,
3779
- statusMessages: e
3780
- };
3781
- } catch (f) {
3782
- const a = f instanceof Error ? f.message : String(f);
3783
- return e.push({ type: "error", message: a }), {
3784
- pretextError: a,
3785
- statusMessages: e,
3786
- warnings: []
3787
- };
3788
- }
3789
- }
3790
- async function Wr(d, c = {}) {
3791
- const e = [], f = _t(d.name);
3792
- if (!yr.test(f.toLowerCase()))
3793
- return {
3794
- pretextError: "File format not supported: please upload .tex, .md, .ptx, .xml, .zip, or .tar.gz.",
3795
- statusMessages: [
3796
- {
3797
- type: "error",
3798
- message: "File format not supported: please upload .tex, .md, .ptx, .xml, .zip, or .tar.gz."
3799
- }
3800
- ],
3801
- warnings: []
3802
- };
3803
- e.push({
3804
- type: "loading",
3805
- message: `Processing ${f}...`
3806
- });
3807
- try {
3808
- const { files: a, assets: n } = await Ir(d), r = Nr(a, { ...c, assets: n });
3809
- return {
3810
- ...r,
3811
- statusMessages: [...e, ...r.statusMessages]
3812
- };
3813
- } catch (a) {
3814
- const n = a instanceof Error ? a.message : String(a);
3815
- return {
3816
- pretextError: n,
3817
- statusMessages: [...e, { type: "error", message: n }],
3818
- warnings: []
3819
- };
3820
- }
3821
- }
3822
- function Mr(d, c) {
3823
- return c === "converted" ? d.outputFiles : d.nativeOutputFiles ?? d.files;
3824
- }
3825
- function Zr(d, c) {
3826
- return c === "converted" ? d.outputAssets : d.assets;
3827
- }
3828
- function Hr(d) {
3829
- const c = d.action === "replace" || d.action === "rewrite" ? `replaced with \`${d.replacement}\`` : d.message ?? d.action, e = d.occurrences > 1 ? ` (x${d.occurrences})` : "";
3830
- return `[${d.severity}] ${d.macro}: ${c}${e}`;
3831
- }
3832
- export {
3833
- br as A,
3834
- be as L,
3835
- ye as M,
3836
- ur as a,
3837
- Nt as b,
3838
- dr as c,
3839
- cr as d,
3840
- Qt as e,
3841
- Ct as f,
3842
- Zr as g,
3843
- gr as h,
3844
- je as i,
3845
- Xe as j,
3846
- Ge as k,
3847
- Ye as l,
3848
- ie as m,
3849
- re as n,
3850
- sr as o,
3851
- Jt as p,
3852
- Mr as q,
3853
- lr as r,
3854
- qt as s,
3855
- Hr as t,
3856
- Ke as u,
3857
- Wr as v,
3858
- te as w,
3859
- Nr as x,
3860
- Lt as y,
3861
- le as z
3862
- };