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