@genome-spy/app 0.37.4 → 0.38.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.
@@ -0,0 +1,4050 @@
1
+ import { b as Q } from "./index-2VmK8MLN.js";
2
+ import { _ as Yn, L as Kn } from "./index-5BtgVTyz.js";
3
+ import { L as nr } from "./__vite-browser-external-ENoMJThg.js";
4
+ import { R as ir } from "./remoteFile-1ad_qGwi.js";
5
+ import "./index-UyB03NDZ.js";
6
+ const ft = BigInt(32);
7
+ function rr(e, n, t) {
8
+ const i = +!!t, r = +!t;
9
+ return BigInt(e.getInt32(n, t) * r + e.getInt32(n + 4, t) * i) << ft | BigInt(e.getUint32(n, t) * i + e.getUint32(n + 4, t) * r);
10
+ }
11
+ function ar(e, n, t) {
12
+ const i = e.getUint32(n, t), r = e.getUint32(n + 4, t), a = +!!t, o = +!t;
13
+ return BigInt(i * o + r * a) << ft | BigInt(i * a + r * o);
14
+ }
15
+ function or(e, n, t, i) {
16
+ const r = Number(t >> ft), a = Number(t & BigInt(4294967295));
17
+ i ? (e.setInt32(n + 4, r, i), e.setUint32(n, a, i)) : (e.setInt32(n, r, i), e.setUint32(n + 4, a, i));
18
+ }
19
+ function sr(e, n, t, i) {
20
+ const r = Number(t >> ft), a = Number(t & BigInt(4294967295));
21
+ i ? (e.setUint32(n + 4, r, i), e.setUint32(n, a, i)) : (e.setUint32(n, r, i), e.setUint32(n + 4, a, i));
22
+ }
23
+ "getBigInt64" in DataView || (DataView.prototype.getBigInt64 = function(e, n) {
24
+ return rr(this, e, n);
25
+ });
26
+ "getBigUint64" in DataView || (DataView.prototype.getBigUint64 = function(e, n) {
27
+ return ar(this, e, n);
28
+ });
29
+ "setBigInt64" in DataView || (DataView.prototype.setBigInt64 = function(e, n, t) {
30
+ or(this, e, n, t);
31
+ });
32
+ "setBigUint64" in DataView || (DataView.prototype.setBigUint64 = function(e, n, t) {
33
+ sr(this, e, n, t);
34
+ });
35
+ class lr {
36
+ constructor(n, t) {
37
+ this.code = "", this.scopes = [["vars"]], this.bitFields = [], this.tmpVariableCount = 0, this.references = /* @__PURE__ */ new Map(), this.imports = [], this.reverseImports = /* @__PURE__ */ new Map(), this.useContextVariables = !1, this.importPath = n, this.useContextVariables = t;
38
+ }
39
+ generateVariable(n) {
40
+ const t = [...this.scopes[this.scopes.length - 1]];
41
+ return n && t.push(n), t.join(".");
42
+ }
43
+ generateOption(n) {
44
+ switch (typeof n) {
45
+ case "number":
46
+ return n.toString();
47
+ case "string":
48
+ return this.generateVariable(n);
49
+ case "function":
50
+ return `${this.addImport(n)}.call(${this.generateVariable()}, vars)`;
51
+ }
52
+ }
53
+ generateError(n) {
54
+ this.pushCode(`throw new Error(${n});`);
55
+ }
56
+ generateTmpVariable() {
57
+ return "$tmp" + this.tmpVariableCount++;
58
+ }
59
+ pushCode(n) {
60
+ this.code += n + `
61
+ `;
62
+ }
63
+ pushPath(n) {
64
+ n && this.scopes[this.scopes.length - 1].push(n);
65
+ }
66
+ popPath(n) {
67
+ n && this.scopes[this.scopes.length - 1].pop();
68
+ }
69
+ pushScope(n) {
70
+ this.scopes.push([n]);
71
+ }
72
+ popScope() {
73
+ this.scopes.pop();
74
+ }
75
+ addImport(n) {
76
+ if (!this.importPath)
77
+ return `(${n})`;
78
+ let t = this.reverseImports.get(n);
79
+ return t || (t = this.imports.push(n) - 1, this.reverseImports.set(n, t)), `${this.importPath}[${t}]`;
80
+ }
81
+ addReference(n) {
82
+ this.references.has(n) || this.references.set(n, { resolved: !1, requested: !1 });
83
+ }
84
+ markResolved(n) {
85
+ const t = this.references.get(n);
86
+ t && (t.resolved = !0);
87
+ }
88
+ markRequested(n) {
89
+ n.forEach((t) => {
90
+ const i = this.references.get(t);
91
+ i && (i.requested = !0);
92
+ });
93
+ }
94
+ getUnresolvedReferences() {
95
+ return Array.from(this.references).filter(([n, t]) => !t.resolved && !t.requested).map(([n, t]) => n);
96
+ }
97
+ }
98
+ const x = /* @__PURE__ */ new Map(), oe = "___parser_", M = {
99
+ uint8: 1,
100
+ uint16le: 2,
101
+ uint16be: 2,
102
+ uint32le: 4,
103
+ uint32be: 4,
104
+ int8: 1,
105
+ int16le: 2,
106
+ int16be: 2,
107
+ int32le: 4,
108
+ int32be: 4,
109
+ int64be: 8,
110
+ int64le: 8,
111
+ uint64be: 8,
112
+ uint64le: 8,
113
+ floatle: 4,
114
+ floatbe: 4,
115
+ doublele: 8,
116
+ doublebe: 8
117
+ }, Ye = {
118
+ uint8: "Uint8",
119
+ uint16le: "Uint16",
120
+ uint16be: "Uint16",
121
+ uint32le: "Uint32",
122
+ uint32be: "Uint32",
123
+ int8: "Int8",
124
+ int16le: "Int16",
125
+ int16be: "Int16",
126
+ int32le: "Int32",
127
+ int32be: "Int32",
128
+ int64be: "BigInt64",
129
+ int64le: "BigInt64",
130
+ uint64be: "BigUint64",
131
+ uint64le: "BigUint64",
132
+ floatle: "Float32",
133
+ floatbe: "Float32",
134
+ doublele: "Float64",
135
+ doublebe: "Float64"
136
+ }, Ke = {
137
+ uint8: !1,
138
+ uint16le: !0,
139
+ uint16be: !1,
140
+ uint32le: !0,
141
+ uint32be: !1,
142
+ int8: !1,
143
+ int16le: !0,
144
+ int16be: !1,
145
+ int32le: !0,
146
+ int32be: !1,
147
+ int64be: !1,
148
+ int64le: !0,
149
+ uint64be: !1,
150
+ uint64le: !0,
151
+ floatle: !0,
152
+ floatbe: !1,
153
+ doublele: !0,
154
+ doublebe: !1
155
+ };
156
+ class N {
157
+ constructor() {
158
+ this.varName = "", this.type = "", this.options = {}, this.endian = "be", this.useContextVariables = !1;
159
+ }
160
+ static start() {
161
+ return new N();
162
+ }
163
+ primitiveGenerateN(n, t) {
164
+ const i = Ye[n], r = Ke[n];
165
+ t.pushCode(`${t.generateVariable(this.varName)} = dataView.get${i}(offset, ${r});`), t.pushCode(`offset += ${M[n]};`);
166
+ }
167
+ primitiveN(n, t, i) {
168
+ return this.setNextParser(n, t, i);
169
+ }
170
+ useThisEndian(n) {
171
+ return n + this.endian.toLowerCase();
172
+ }
173
+ uint8(n, t = {}) {
174
+ return this.primitiveN("uint8", n, t);
175
+ }
176
+ uint16(n, t = {}) {
177
+ return this.primitiveN(this.useThisEndian("uint16"), n, t);
178
+ }
179
+ uint16le(n, t = {}) {
180
+ return this.primitiveN("uint16le", n, t);
181
+ }
182
+ uint16be(n, t = {}) {
183
+ return this.primitiveN("uint16be", n, t);
184
+ }
185
+ uint32(n, t = {}) {
186
+ return this.primitiveN(this.useThisEndian("uint32"), n, t);
187
+ }
188
+ uint32le(n, t = {}) {
189
+ return this.primitiveN("uint32le", n, t);
190
+ }
191
+ uint32be(n, t = {}) {
192
+ return this.primitiveN("uint32be", n, t);
193
+ }
194
+ int8(n, t = {}) {
195
+ return this.primitiveN("int8", n, t);
196
+ }
197
+ int16(n, t = {}) {
198
+ return this.primitiveN(this.useThisEndian("int16"), n, t);
199
+ }
200
+ int16le(n, t = {}) {
201
+ return this.primitiveN("int16le", n, t);
202
+ }
203
+ int16be(n, t = {}) {
204
+ return this.primitiveN("int16be", n, t);
205
+ }
206
+ int32(n, t = {}) {
207
+ return this.primitiveN(this.useThisEndian("int32"), n, t);
208
+ }
209
+ int32le(n, t = {}) {
210
+ return this.primitiveN("int32le", n, t);
211
+ }
212
+ int32be(n, t = {}) {
213
+ return this.primitiveN("int32be", n, t);
214
+ }
215
+ bigIntVersionCheck() {
216
+ if (!DataView.prototype.getBigInt64)
217
+ throw new Error("BigInt64 is unsupported on this runtime");
218
+ }
219
+ int64(n, t = {}) {
220
+ return this.bigIntVersionCheck(), this.primitiveN(this.useThisEndian("int64"), n, t);
221
+ }
222
+ int64be(n, t = {}) {
223
+ return this.bigIntVersionCheck(), this.primitiveN("int64be", n, t);
224
+ }
225
+ int64le(n, t = {}) {
226
+ return this.bigIntVersionCheck(), this.primitiveN("int64le", n, t);
227
+ }
228
+ uint64(n, t = {}) {
229
+ return this.bigIntVersionCheck(), this.primitiveN(this.useThisEndian("uint64"), n, t);
230
+ }
231
+ uint64be(n, t = {}) {
232
+ return this.bigIntVersionCheck(), this.primitiveN("uint64be", n, t);
233
+ }
234
+ uint64le(n, t = {}) {
235
+ return this.bigIntVersionCheck(), this.primitiveN("uint64le", n, t);
236
+ }
237
+ floatle(n, t = {}) {
238
+ return this.primitiveN("floatle", n, t);
239
+ }
240
+ floatbe(n, t = {}) {
241
+ return this.primitiveN("floatbe", n, t);
242
+ }
243
+ doublele(n, t = {}) {
244
+ return this.primitiveN("doublele", n, t);
245
+ }
246
+ doublebe(n, t = {}) {
247
+ return this.primitiveN("doublebe", n, t);
248
+ }
249
+ bitN(n, t, i) {
250
+ return i.length = n, this.setNextParser("bit", t, i);
251
+ }
252
+ bit1(n, t = {}) {
253
+ return this.bitN(1, n, t);
254
+ }
255
+ bit2(n, t = {}) {
256
+ return this.bitN(2, n, t);
257
+ }
258
+ bit3(n, t = {}) {
259
+ return this.bitN(3, n, t);
260
+ }
261
+ bit4(n, t = {}) {
262
+ return this.bitN(4, n, t);
263
+ }
264
+ bit5(n, t = {}) {
265
+ return this.bitN(5, n, t);
266
+ }
267
+ bit6(n, t = {}) {
268
+ return this.bitN(6, n, t);
269
+ }
270
+ bit7(n, t = {}) {
271
+ return this.bitN(7, n, t);
272
+ }
273
+ bit8(n, t = {}) {
274
+ return this.bitN(8, n, t);
275
+ }
276
+ bit9(n, t = {}) {
277
+ return this.bitN(9, n, t);
278
+ }
279
+ bit10(n, t = {}) {
280
+ return this.bitN(10, n, t);
281
+ }
282
+ bit11(n, t = {}) {
283
+ return this.bitN(11, n, t);
284
+ }
285
+ bit12(n, t = {}) {
286
+ return this.bitN(12, n, t);
287
+ }
288
+ bit13(n, t = {}) {
289
+ return this.bitN(13, n, t);
290
+ }
291
+ bit14(n, t = {}) {
292
+ return this.bitN(14, n, t);
293
+ }
294
+ bit15(n, t = {}) {
295
+ return this.bitN(15, n, t);
296
+ }
297
+ bit16(n, t = {}) {
298
+ return this.bitN(16, n, t);
299
+ }
300
+ bit17(n, t = {}) {
301
+ return this.bitN(17, n, t);
302
+ }
303
+ bit18(n, t = {}) {
304
+ return this.bitN(18, n, t);
305
+ }
306
+ bit19(n, t = {}) {
307
+ return this.bitN(19, n, t);
308
+ }
309
+ bit20(n, t = {}) {
310
+ return this.bitN(20, n, t);
311
+ }
312
+ bit21(n, t = {}) {
313
+ return this.bitN(21, n, t);
314
+ }
315
+ bit22(n, t = {}) {
316
+ return this.bitN(22, n, t);
317
+ }
318
+ bit23(n, t = {}) {
319
+ return this.bitN(23, n, t);
320
+ }
321
+ bit24(n, t = {}) {
322
+ return this.bitN(24, n, t);
323
+ }
324
+ bit25(n, t = {}) {
325
+ return this.bitN(25, n, t);
326
+ }
327
+ bit26(n, t = {}) {
328
+ return this.bitN(26, n, t);
329
+ }
330
+ bit27(n, t = {}) {
331
+ return this.bitN(27, n, t);
332
+ }
333
+ bit28(n, t = {}) {
334
+ return this.bitN(28, n, t);
335
+ }
336
+ bit29(n, t = {}) {
337
+ return this.bitN(29, n, t);
338
+ }
339
+ bit30(n, t = {}) {
340
+ return this.bitN(30, n, t);
341
+ }
342
+ bit31(n, t = {}) {
343
+ return this.bitN(31, n, t);
344
+ }
345
+ bit32(n, t = {}) {
346
+ return this.bitN(32, n, t);
347
+ }
348
+ namely(n) {
349
+ return x.set(n, this), this.alias = n, this;
350
+ }
351
+ skip(n, t = {}) {
352
+ return this.seek(n, t);
353
+ }
354
+ seek(n, t = {}) {
355
+ if (t.assert)
356
+ throw new Error("assert option on seek is not allowed.");
357
+ return this.setNextParser("seek", "", { length: n });
358
+ }
359
+ string(n, t) {
360
+ if (!t.zeroTerminated && !t.length && !t.greedy)
361
+ throw new Error("One of length, zeroTerminated, or greedy must be defined for string.");
362
+ if ((t.zeroTerminated || t.length) && t.greedy)
363
+ throw new Error("greedy is mutually exclusive with length and zeroTerminated for string.");
364
+ if (t.stripNull && !(t.length || t.greedy))
365
+ throw new Error("length or greedy must be defined if stripNull is enabled.");
366
+ return t.encoding = t.encoding || "utf8", this.setNextParser("string", n, t);
367
+ }
368
+ buffer(n, t) {
369
+ if (!t.length && !t.readUntil)
370
+ throw new Error("length or readUntil must be defined for buffer.");
371
+ return this.setNextParser("buffer", n, t);
372
+ }
373
+ wrapped(n, t) {
374
+ if (typeof t != "object" && typeof n == "object" && (t = n, n = ""), !t || !t.wrapper || !t.type)
375
+ throw new Error("Both wrapper and type must be defined for wrapped.");
376
+ if (!t.length && !t.readUntil)
377
+ throw new Error("length or readUntil must be defined for wrapped.");
378
+ return this.setNextParser("wrapper", n, t);
379
+ }
380
+ array(n, t) {
381
+ if (!t.readUntil && !t.length && !t.lengthInBytes)
382
+ throw new Error("One of readUntil, length and lengthInBytes must be defined for array.");
383
+ if (!t.type)
384
+ throw new Error("type is required for array.");
385
+ if (typeof t.type == "string" && !x.has(t.type) && !(t.type in M))
386
+ throw new Error(`Array element type "${t.type}" is unkown.`);
387
+ return this.setNextParser("array", n, t);
388
+ }
389
+ choice(n, t) {
390
+ if (typeof t != "object" && typeof n == "object" && (t = n, n = ""), !t)
391
+ throw new Error("tag and choices are are required for choice.");
392
+ if (!t.tag)
393
+ throw new Error("tag is requird for choice.");
394
+ if (!t.choices)
395
+ throw new Error("choices is required for choice.");
396
+ for (const i in t.choices) {
397
+ const r = parseInt(i, 10), a = t.choices[r];
398
+ if (isNaN(r))
399
+ throw new Error(`Choice key "${i}" is not a number.`);
400
+ if (typeof a == "string" && !x.has(a) && !(a in M))
401
+ throw new Error(`Choice type "${a}" is unkown.`);
402
+ }
403
+ return this.setNextParser("choice", n, t);
404
+ }
405
+ nest(n, t) {
406
+ if (typeof t != "object" && typeof n == "object" && (t = n, n = ""), !t || !t.type)
407
+ throw new Error("type is required for nest.");
408
+ if (!(t.type instanceof N) && !x.has(t.type))
409
+ throw new Error("type must be a known parser name or a Parser object.");
410
+ if (!(t.type instanceof N) && !n)
411
+ throw new Error("type must be a Parser object if the variable name is omitted.");
412
+ return this.setNextParser("nest", n, t);
413
+ }
414
+ pointer(n, t) {
415
+ if (!t.offset)
416
+ throw new Error("offset is required for pointer.");
417
+ if (!t.type)
418
+ throw new Error("type is required for pointer.");
419
+ if (typeof t.type == "string" && !(t.type in M) && !x.has(t.type))
420
+ throw new Error(`Pointer type "${t.type}" is unkown.`);
421
+ return this.setNextParser("pointer", n, t);
422
+ }
423
+ saveOffset(n, t = {}) {
424
+ return this.setNextParser("saveOffset", n, t);
425
+ }
426
+ endianness(n) {
427
+ switch (n.toLowerCase()) {
428
+ case "little":
429
+ this.endian = "le";
430
+ break;
431
+ case "big":
432
+ this.endian = "be";
433
+ break;
434
+ default:
435
+ throw new Error('endianness must be one of "little" or "big"');
436
+ }
437
+ return this;
438
+ }
439
+ endianess(n) {
440
+ return this.endianness(n);
441
+ }
442
+ useContextVars(n = !0) {
443
+ return this.useContextVariables = n, this;
444
+ }
445
+ create(n) {
446
+ if (!(n instanceof Function))
447
+ throw new Error("Constructor must be a Function object.");
448
+ return this.constructorFn = n, this;
449
+ }
450
+ getContext(n) {
451
+ const t = new lr(n, this.useContextVariables);
452
+ return t.pushCode("var dataView = new DataView(buffer.buffer, buffer.byteOffset, buffer.length);"), this.alias ? (this.addAliasedCode(t), t.pushCode(`return ${oe + this.alias}(0).result;`)) : this.addRawCode(t), t;
453
+ }
454
+ getCode() {
455
+ const n = "imports";
456
+ return this.getContext(n).code;
457
+ }
458
+ addRawCode(n) {
459
+ n.pushCode("var offset = 0;"), n.pushCode(`var vars = ${this.constructorFn ? "new constructorFn()" : "{}"};`), n.pushCode("vars.$parent = null;"), n.pushCode("vars.$root = vars;"), this.generate(n), this.resolveReferences(n), n.pushCode("delete vars.$parent;"), n.pushCode("delete vars.$root;"), n.pushCode("return vars;");
460
+ }
461
+ addAliasedCode(n) {
462
+ return n.pushCode(`function ${oe + this.alias}(offset, context) {`), n.pushCode(`var vars = ${this.constructorFn ? "new constructorFn()" : "{}"};`), n.pushCode("var ctx = Object.assign({$parent: null, $root: vars}, context || {});"), n.pushCode("vars = Object.assign(vars, ctx);"), this.generate(n), n.markResolved(this.alias), this.resolveReferences(n), n.pushCode("Object.keys(ctx).forEach(function (item) { delete vars[item]; });"), n.pushCode("return { offset: offset, result: vars };"), n.pushCode("}"), n;
463
+ }
464
+ resolveReferences(n) {
465
+ const t = n.getUnresolvedReferences();
466
+ n.markRequested(t), t.forEach((i) => {
467
+ var r;
468
+ (r = x.get(i)) === null || r === void 0 || r.addAliasedCode(n);
469
+ });
470
+ }
471
+ compile() {
472
+ const n = "imports", t = this.getContext(n);
473
+ this.compiled = new Function(n, "TextDecoder", `return function (buffer, constructorFn) { ${t.code} };`)(t.imports, TextDecoder);
474
+ }
475
+ sizeOf() {
476
+ let n = NaN;
477
+ if (Object.keys(M).indexOf(this.type) >= 0)
478
+ n = M[this.type];
479
+ else if (this.type === "string" && typeof this.options.length == "number")
480
+ n = this.options.length;
481
+ else if (this.type === "buffer" && typeof this.options.length == "number")
482
+ n = this.options.length;
483
+ else if (this.type === "array" && typeof this.options.length == "number") {
484
+ let t = NaN;
485
+ typeof this.options.type == "string" ? t = M[this.options.type] : this.options.type instanceof N && (t = this.options.type.sizeOf()), n = this.options.length * t;
486
+ } else
487
+ this.type === "seek" ? n = this.options.length : this.type === "nest" ? n = this.options.type.sizeOf() : this.type || (n = 0);
488
+ return this.next && (n += this.next.sizeOf()), n;
489
+ }
490
+ // Follow the parser chain till the root and start parsing from there
491
+ parse(n) {
492
+ return this.compiled || this.compile(), this.compiled(n, this.constructorFn);
493
+ }
494
+ setNextParser(n, t, i) {
495
+ const r = new N();
496
+ return r.type = n, r.varName = t, r.options = i, r.endian = this.endian, this.head ? this.head.next = r : this.next = r, this.head = r, this;
497
+ }
498
+ // Call code generator for this parser
499
+ generate(n) {
500
+ if (this.type) {
501
+ switch (this.type) {
502
+ case "uint8":
503
+ case "uint16le":
504
+ case "uint16be":
505
+ case "uint32le":
506
+ case "uint32be":
507
+ case "int8":
508
+ case "int16le":
509
+ case "int16be":
510
+ case "int32le":
511
+ case "int32be":
512
+ case "int64be":
513
+ case "int64le":
514
+ case "uint64be":
515
+ case "uint64le":
516
+ case "floatle":
517
+ case "floatbe":
518
+ case "doublele":
519
+ case "doublebe":
520
+ this.primitiveGenerateN(this.type, n);
521
+ break;
522
+ case "bit":
523
+ this.generateBit(n);
524
+ break;
525
+ case "string":
526
+ this.generateString(n);
527
+ break;
528
+ case "buffer":
529
+ this.generateBuffer(n);
530
+ break;
531
+ case "seek":
532
+ this.generateSeek(n);
533
+ break;
534
+ case "nest":
535
+ this.generateNest(n);
536
+ break;
537
+ case "array":
538
+ this.generateArray(n);
539
+ break;
540
+ case "choice":
541
+ this.generateChoice(n);
542
+ break;
543
+ case "pointer":
544
+ this.generatePointer(n);
545
+ break;
546
+ case "saveOffset":
547
+ this.generateSaveOffset(n);
548
+ break;
549
+ case "wrapper":
550
+ this.generateWrapper(n);
551
+ break;
552
+ }
553
+ this.type !== "bit" && this.generateAssert(n);
554
+ }
555
+ const t = n.generateVariable(this.varName);
556
+ return this.options.formatter && this.type !== "bit" && this.generateFormatter(n, t, this.options.formatter), this.generateNext(n);
557
+ }
558
+ generateAssert(n) {
559
+ if (!this.options.assert)
560
+ return;
561
+ const t = n.generateVariable(this.varName);
562
+ switch (typeof this.options.assert) {
563
+ case "function":
564
+ {
565
+ const i = n.addImport(this.options.assert);
566
+ n.pushCode(`if (!${i}.call(vars, ${t})) {`);
567
+ }
568
+ break;
569
+ case "number":
570
+ n.pushCode(`if (${this.options.assert} !== ${t}) {`);
571
+ break;
572
+ case "string":
573
+ n.pushCode(`if (${JSON.stringify(this.options.assert)} !== ${t}) {`);
574
+ break;
575
+ default:
576
+ throw new Error("assert option must be a string, number or a function.");
577
+ }
578
+ n.generateError(`"Assertion error: ${t} is " + ${JSON.stringify(this.options.assert.toString())}`), n.pushCode("}");
579
+ }
580
+ // Recursively call code generators and append results
581
+ generateNext(n) {
582
+ return this.next && (n = this.next.generate(n)), n;
583
+ }
584
+ generateBit(n) {
585
+ const t = JSON.parse(JSON.stringify(this));
586
+ if (t.options = this.options, t.generateAssert = this.generateAssert.bind(this), t.generateFormatter = this.generateFormatter.bind(this), t.varName = n.generateVariable(t.varName), n.bitFields.push(t), !this.next || this.next && ["bit", "nest"].indexOf(this.next.type) < 0) {
587
+ const i = n.generateTmpVariable();
588
+ n.pushCode(`var ${i} = 0;`);
589
+ const r = (f = 0) => {
590
+ let d = 0;
591
+ for (let c = f; c < n.bitFields.length; c++) {
592
+ const h = n.bitFields[c].options.length;
593
+ if (d + h > 32)
594
+ break;
595
+ d += h;
596
+ }
597
+ return d;
598
+ }, a = (f) => (f <= 8 ? (n.pushCode(`${i} = dataView.getUint8(offset);`), f = 8) : f <= 16 ? (n.pushCode(`${i} = dataView.getUint16(offset);`), f = 16) : f <= 24 ? (n.pushCode(`${i} = (dataView.getUint16(offset) << 8) | dataView.getUint8(offset + 2);`), f = 24) : (n.pushCode(`${i} = dataView.getUint32(offset);`), f = 32), n.pushCode(`offset += ${f / 8};`), f);
599
+ let o = 0;
600
+ const l = this.endian === "be";
601
+ let u = 0, s = 0;
602
+ n.bitFields.forEach((f, d) => {
603
+ let c = f.options.length;
604
+ if (c > s) {
605
+ if (s) {
606
+ const g = -1 >>> 32 - s;
607
+ n.pushCode(`${f.varName} = (${i} & 0x${g.toString(16)}) << ${c - s};`), c -= s;
608
+ }
609
+ o = 0, s = u = a(r(d) - s);
610
+ }
611
+ const h = l ? u - o - c : o, _ = -1 >>> 32 - c;
612
+ n.pushCode(`${f.varName} ${c < f.options.length ? "|=" : "="} ${i} >> ${h} & 0x${_.toString(16)};`), f.options.length === 32 && n.pushCode(`${f.varName} >>>= 0`), f.options.assert && f.generateAssert(n), f.options.formatter && f.generateFormatter(n, f.varName, f.options.formatter), o += c, s -= c;
613
+ }), n.bitFields = [];
614
+ }
615
+ }
616
+ generateSeek(n) {
617
+ const t = n.generateOption(this.options.length);
618
+ n.pushCode(`offset += ${t};`);
619
+ }
620
+ generateString(n) {
621
+ const t = n.generateVariable(this.varName), i = n.generateTmpVariable(), r = this.options.encoding, a = r.toLowerCase() === "hex", o = 'b => b.toString(16).padStart(2, "0")';
622
+ if (this.options.length && this.options.zeroTerminated) {
623
+ const l = this.options.length;
624
+ n.pushCode(`var ${i} = offset;`), n.pushCode(`while(dataView.getUint8(offset++) !== 0 && offset - ${i} < ${l});`);
625
+ const u = `offset - ${i} < ${l} ? offset - 1 : offset`;
626
+ n.pushCode(a ? `${t} = Array.from(buffer.subarray(${i}, ${u}), ${o}).join('');` : `${t} = new TextDecoder('${r}').decode(buffer.subarray(${i}, ${u}));`);
627
+ } else if (this.options.length) {
628
+ const l = n.generateOption(this.options.length);
629
+ n.pushCode(a ? `${t} = Array.from(buffer.subarray(offset, offset + ${l}), ${o}).join('');` : `${t} = new TextDecoder('${r}').decode(buffer.subarray(offset, offset + ${l}));`), n.pushCode(`offset += ${l};`);
630
+ } else
631
+ this.options.zeroTerminated ? (n.pushCode(`var ${i} = offset;`), n.pushCode("while(dataView.getUint8(offset++) !== 0);"), n.pushCode(a ? `${t} = Array.from(buffer.subarray(${i}, offset - 1), ${o}).join('');` : `${t} = new TextDecoder('${r}').decode(buffer.subarray(${i}, offset - 1));`)) : this.options.greedy && (n.pushCode(`var ${i} = offset;`), n.pushCode("while(buffer.length > offset++);"), n.pushCode(a ? `${t} = Array.from(buffer.subarray(${i}, offset), ${o}).join('');` : `${t} = new TextDecoder('${r}').decode(buffer.subarray(${i}, offset));`));
632
+ this.options.stripNull && n.pushCode(`${t} = ${t}.replace(/\\x00+$/g, '')`);
633
+ }
634
+ generateBuffer(n) {
635
+ const t = n.generateVariable(this.varName);
636
+ if (typeof this.options.readUntil == "function") {
637
+ const i = this.options.readUntil, r = n.generateTmpVariable(), a = n.generateTmpVariable();
638
+ n.pushCode(`var ${r} = offset;`), n.pushCode(`var ${a} = 0;`), n.pushCode("while (offset < buffer.length) {"), n.pushCode(`${a} = dataView.getUint8(offset);`);
639
+ const o = n.addImport(i);
640
+ n.pushCode(`if (${o}.call(${n.generateVariable()}, ${a}, buffer.subarray(offset))) break;`), n.pushCode("offset += 1;"), n.pushCode("}"), n.pushCode(`${t} = buffer.subarray(${r}, offset);`);
641
+ } else if (this.options.readUntil === "eof")
642
+ n.pushCode(`${t} = buffer.subarray(offset);`);
643
+ else {
644
+ const i = n.generateOption(this.options.length);
645
+ n.pushCode(`${t} = buffer.subarray(offset, offset + ${i});`), n.pushCode(`offset += ${i};`);
646
+ }
647
+ this.options.clone && n.pushCode(`${t} = buffer.constructor.from(${t});`);
648
+ }
649
+ generateArray(n) {
650
+ const t = n.generateOption(this.options.length), i = n.generateOption(this.options.lengthInBytes), r = this.options.type, a = n.generateTmpVariable(), o = n.generateVariable(this.varName), l = n.generateTmpVariable(), u = this.options.key, s = typeof u == "string";
651
+ if (s ? n.pushCode(`${o} = {};`) : n.pushCode(`${o} = [];`), typeof this.options.readUntil == "function" ? n.pushCode("do {") : this.options.readUntil === "eof" ? n.pushCode(`for (var ${a} = 0; offset < buffer.length; ${a}++) {`) : i !== void 0 ? n.pushCode(`for (var ${a} = offset + ${i}; offset < ${a}; ) {`) : n.pushCode(`for (var ${a} = ${t}; ${a} > 0; ${a}--) {`), typeof r == "string")
652
+ if (x.get(r)) {
653
+ const f = n.generateTmpVariable();
654
+ if (n.pushCode(`var ${f} = ${oe + r}(offset, {`), n.useContextVariables) {
655
+ const d = n.generateVariable();
656
+ n.pushCode(`$parent: ${d},`), n.pushCode(`$root: ${d}.$root,`), !this.options.readUntil && i === void 0 && n.pushCode(`$index: ${t} - ${a},`);
657
+ }
658
+ n.pushCode("});"), n.pushCode(`var ${l} = ${f}.result; offset = ${f}.offset;`), r !== this.alias && n.addReference(r);
659
+ } else {
660
+ const f = Ye[r], d = Ke[r];
661
+ n.pushCode(`var ${l} = dataView.get${f}(offset, ${d});`), n.pushCode(`offset += ${M[r]};`);
662
+ }
663
+ else if (r instanceof N) {
664
+ n.pushCode(`var ${l} = {};`);
665
+ const f = n.generateVariable();
666
+ n.pushScope(l), n.useContextVariables && (n.pushCode(`${l}.$parent = ${f};`), n.pushCode(`${l}.$root = ${f}.$root;`), !this.options.readUntil && i === void 0 && n.pushCode(`${l}.$index = ${t} - ${a};`)), r.generate(n), n.useContextVariables && (n.pushCode(`delete ${l}.$parent;`), n.pushCode(`delete ${l}.$root;`), n.pushCode(`delete ${l}.$index;`)), n.popScope();
667
+ }
668
+ if (s ? n.pushCode(`${o}[${l}.${u}] = ${l};`) : n.pushCode(`${o}.push(${l});`), n.pushCode("}"), typeof this.options.readUntil == "function") {
669
+ const f = this.options.readUntil, d = n.addImport(f);
670
+ n.pushCode(`while (!${d}.call(${n.generateVariable()}, ${l}, buffer.subarray(offset)));`);
671
+ }
672
+ }
673
+ generateChoiceCase(n, t, i) {
674
+ if (typeof i == "string") {
675
+ const r = n.generateVariable(this.varName);
676
+ if (x.has(i)) {
677
+ const a = n.generateTmpVariable();
678
+ n.pushCode(`var ${a} = ${oe + i}(offset, {`), n.useContextVariables && (n.pushCode(`$parent: ${r}.$parent,`), n.pushCode(`$root: ${r}.$root,`)), n.pushCode("});"), n.pushCode(`${r} = ${a}.result; offset = ${a}.offset;`), i !== this.alias && n.addReference(i);
679
+ } else {
680
+ const a = Ye[i], o = Ke[i];
681
+ n.pushCode(`${r} = dataView.get${a}(offset, ${o});`), n.pushCode(`offset += ${M[i]}`);
682
+ }
683
+ } else
684
+ i instanceof N && (n.pushPath(t), i.generate(n), n.popPath(t));
685
+ }
686
+ generateChoice(n) {
687
+ const t = n.generateOption(this.options.tag), i = n.generateVariable(this.varName);
688
+ if (this.varName && (n.pushCode(`${i} = {};`), n.useContextVariables)) {
689
+ const r = n.generateVariable();
690
+ n.pushCode(`${i}.$parent = ${r};`), n.pushCode(`${i}.$root = ${r}.$root;`);
691
+ }
692
+ n.pushCode(`switch(${t}) {`);
693
+ for (const r in this.options.choices) {
694
+ const a = parseInt(r, 10), o = this.options.choices[a];
695
+ n.pushCode(`case ${a}:`), this.generateChoiceCase(n, this.varName, o), n.pushCode("break;");
696
+ }
697
+ n.pushCode("default:"), this.options.defaultChoice ? this.generateChoiceCase(n, this.varName, this.options.defaultChoice) : n.generateError(`"Met undefined tag value " + ${t} + " at choice"`), n.pushCode("}"), this.varName && n.useContextVariables && (n.pushCode(`delete ${i}.$parent;`), n.pushCode(`delete ${i}.$root;`));
698
+ }
699
+ generateNest(n) {
700
+ const t = n.generateVariable(this.varName);
701
+ if (this.options.type instanceof N) {
702
+ if (this.varName && (n.pushCode(`${t} = {};`), n.useContextVariables)) {
703
+ const i = n.generateVariable();
704
+ n.pushCode(`${t}.$parent = ${i};`), n.pushCode(`${t}.$root = ${i}.$root;`);
705
+ }
706
+ n.pushPath(this.varName), this.options.type.generate(n), n.popPath(this.varName), this.varName && n.useContextVariables && n.useContextVariables && (n.pushCode(`delete ${t}.$parent;`), n.pushCode(`delete ${t}.$root;`));
707
+ } else if (x.has(this.options.type)) {
708
+ const i = n.generateTmpVariable();
709
+ if (n.pushCode(`var ${i} = ${oe + this.options.type}(offset, {`), n.useContextVariables) {
710
+ const r = n.generateVariable();
711
+ n.pushCode(`$parent: ${r},`), n.pushCode(`$root: ${r}.$root,`);
712
+ }
713
+ n.pushCode("});"), n.pushCode(`${t} = ${i}.result; offset = ${i}.offset;`), this.options.type !== this.alias && n.addReference(this.options.type);
714
+ }
715
+ }
716
+ generateWrapper(n) {
717
+ const t = n.generateVariable(this.varName), i = n.generateTmpVariable();
718
+ if (typeof this.options.readUntil == "function") {
719
+ const u = this.options.readUntil, s = n.generateTmpVariable(), f = n.generateTmpVariable();
720
+ n.pushCode(`var ${s} = offset;`), n.pushCode(`var ${f} = 0;`), n.pushCode("while (offset < buffer.length) {"), n.pushCode(`${f} = dataView.getUint8(offset);`);
721
+ const d = n.addImport(u);
722
+ n.pushCode(`if (${d}.call(${n.generateVariable()}, ${f}, buffer.subarray(offset))) break;`), n.pushCode("offset += 1;"), n.pushCode("}"), n.pushCode(`${i} = buffer.subarray(${s}, offset);`);
723
+ } else if (this.options.readUntil === "eof")
724
+ n.pushCode(`${i} = buffer.subarray(offset);`);
725
+ else {
726
+ const u = n.generateOption(this.options.length);
727
+ n.pushCode(`${i} = buffer.subarray(offset, offset + ${u});`), n.pushCode(`offset += ${u};`);
728
+ }
729
+ this.options.clone && n.pushCode(`${i} = buffer.constructor.from(${i});`);
730
+ const r = n.generateTmpVariable(), a = n.generateTmpVariable(), o = n.generateTmpVariable(), l = n.addImport(this.options.wrapper);
731
+ if (n.pushCode(`${i} = ${l}.call(this, ${i}).subarray(0);`), n.pushCode(`var ${r} = buffer;`), n.pushCode(`var ${a} = offset;`), n.pushCode(`var ${o} = dataView;`), n.pushCode(`buffer = ${i};`), n.pushCode("offset = 0;"), n.pushCode("dataView = new DataView(buffer.buffer, buffer.byteOffset, buffer.length);"), this.options.type instanceof N)
732
+ this.varName && n.pushCode(`${t} = {};`), n.pushPath(this.varName), this.options.type.generate(n), n.popPath(this.varName);
733
+ else if (x.has(this.options.type)) {
734
+ const u = n.generateTmpVariable();
735
+ n.pushCode(`var ${u} = ${oe + this.options.type}(0);`), n.pushCode(`${t} = ${u}.result;`), this.options.type !== this.alias && n.addReference(this.options.type);
736
+ }
737
+ n.pushCode(`buffer = ${r};`), n.pushCode(`dataView = ${o};`), n.pushCode(`offset = ${a};`);
738
+ }
739
+ generateFormatter(n, t, i) {
740
+ if (typeof i == "function") {
741
+ const r = n.addImport(i);
742
+ n.pushCode(`${t} = ${r}.call(${n.generateVariable()}, ${t});`);
743
+ }
744
+ }
745
+ generatePointer(n) {
746
+ const t = this.options.type, i = n.generateOption(this.options.offset), r = n.generateTmpVariable(), a = n.generateVariable(this.varName);
747
+ if (n.pushCode(`var ${r} = offset;`), n.pushCode(`offset = ${i};`), this.options.type instanceof N) {
748
+ if (n.pushCode(`${a} = {};`), n.useContextVariables) {
749
+ const o = n.generateVariable();
750
+ n.pushCode(`${a}.$parent = ${o};`), n.pushCode(`${a}.$root = ${o}.$root;`);
751
+ }
752
+ n.pushPath(this.varName), this.options.type.generate(n), n.popPath(this.varName), n.useContextVariables && (n.pushCode(`delete ${a}.$parent;`), n.pushCode(`delete ${a}.$root;`));
753
+ } else if (x.has(this.options.type)) {
754
+ const o = n.generateTmpVariable();
755
+ if (n.pushCode(`var ${o} = ${oe + this.options.type}(offset, {`), n.useContextVariables) {
756
+ const l = n.generateVariable();
757
+ n.pushCode(`$parent: ${l},`), n.pushCode(`$root: ${l}.$root,`);
758
+ }
759
+ n.pushCode("});"), n.pushCode(`${a} = ${o}.result; offset = ${o}.offset;`), this.options.type !== this.alias && n.addReference(this.options.type);
760
+ } else if (Object.keys(M).indexOf(this.options.type) >= 0) {
761
+ const o = Ye[t], l = Ke[t];
762
+ n.pushCode(`${a} = dataView.get${o}(offset, ${l});`), n.pushCode(`offset += ${M[t]};`);
763
+ }
764
+ n.pushCode(`offset = ${r};`);
765
+ }
766
+ generateSaveOffset(n) {
767
+ const t = n.generateVariable(this.varName);
768
+ n.pushCode(`${t} = offset`);
769
+ }
770
+ }
771
+ class q {
772
+ constructor(n, t) {
773
+ this.ranges = arguments.length === 2 ? [{ min: n, max: t }] : 0 in n ? Object.assign({}, n) : [n];
774
+ }
775
+ min() {
776
+ return this.ranges[0].min;
777
+ }
778
+ max() {
779
+ return this.ranges[this.ranges.length - 1].max;
780
+ }
781
+ contains(n) {
782
+ for (let t = 0; t < this.ranges.length; t += 1) {
783
+ const i = this.ranges[t];
784
+ if (i.min <= n && i.max >= n)
785
+ return !0;
786
+ }
787
+ return !1;
788
+ }
789
+ isContiguous() {
790
+ return this.ranges.length > 1;
791
+ }
792
+ getRanges() {
793
+ return this.ranges.map((n) => new q(n.min, n.max));
794
+ }
795
+ toString() {
796
+ return this.ranges.map((n) => `[${n.min}-${n.max}]`).join(",");
797
+ }
798
+ union(n) {
799
+ const t = this.getRanges().concat(n.getRanges()).sort(this.rangeOrder), i = [];
800
+ let r = t[0];
801
+ for (let a = 1; a < t.length; a += 1) {
802
+ const o = t[a];
803
+ o.min() > r.max() + 1 ? (i.push(r), r = o) : o.max() > r.max() && (r = new q(r.min(), o.max()));
804
+ }
805
+ return i.push(r), i.length === 1 ? i[0] : new q(i);
806
+ }
807
+ intersection(n) {
808
+ let t = this, i = n;
809
+ const r = this.ranges(), a = i.ranges(), o = r.length, l = a.length;
810
+ let u = 0, s = 0;
811
+ const f = [];
812
+ for (; u < o && s < l; ) {
813
+ t = r[u], i = a[s];
814
+ const d = Math.max(t.min(), i.min()), c = Math.min(t.max(), i.max());
815
+ c >= d && f.push(new q(d, c)), t.max() > i.max() ? s += 1 : u += 1;
816
+ }
817
+ if (f.length === 0)
818
+ throw new Error("found range of length 0");
819
+ return f.length === 1 ? f[0] : new q(f);
820
+ }
821
+ coverage() {
822
+ let n = 0;
823
+ const t = this.ranges();
824
+ for (const i of t)
825
+ n += i.max() - i.min() + 1;
826
+ return n;
827
+ }
828
+ rangeOrder(n, t) {
829
+ let i = n, r = t;
830
+ return arguments.length < 2 && (r = i, i = this), i.min() < r.min() ? -1 : i.min() > r.min() ? 1 : i.max() < r.max() ? -1 : r.max() > i.max() ? 1 : 0;
831
+ }
832
+ }
833
+ /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
834
+ const fr = 4, en = 0, tn = 1, ur = 2;
835
+ function ye(e) {
836
+ let n = e.length;
837
+ for (; --n >= 0; )
838
+ e[n] = 0;
839
+ }
840
+ const hr = 0, Wn = 1, cr = 2, dr = 3, pr = 258, xt = 29, Ze = 256, Oe = Ze + 1 + xt, _e = 30, Mt = 19, Xn = 2 * Oe + 1, se = 15, dt = 16, _r = 7, Ht = 256, qn = 16, Jn = 17, Qn = 18, Ot = (
841
+ /* extra bits for each length code */
842
+ new Uint8Array([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])
843
+ ), nt = (
844
+ /* extra bits for each distance code */
845
+ new Uint8Array([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])
846
+ ), br = (
847
+ /* extra bits for each bit length code */
848
+ new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7])
849
+ ), ei = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), gr = 512, W = new Array((Oe + 2) * 2);
850
+ ye(W);
851
+ const Te = new Array(_e * 2);
852
+ ye(Te);
853
+ const ze = new Array(gr);
854
+ ye(ze);
855
+ const Re = new Array(pr - dr + 1);
856
+ ye(Re);
857
+ const jt = new Array(xt);
858
+ ye(jt);
859
+ const it = new Array(_e);
860
+ ye(it);
861
+ function pt(e, n, t, i, r) {
862
+ this.static_tree = e, this.extra_bits = n, this.extra_base = t, this.elems = i, this.max_length = r, this.has_stree = e && e.length;
863
+ }
864
+ let ti, ni, ii;
865
+ function _t(e, n) {
866
+ this.dyn_tree = e, this.max_code = 0, this.stat_desc = n;
867
+ }
868
+ const ri = (e) => e < 256 ? ze[e] : ze[256 + (e >>> 7)], Be = (e, n) => {
869
+ e.pending_buf[e.pending++] = n & 255, e.pending_buf[e.pending++] = n >>> 8 & 255;
870
+ }, D = (e, n, t) => {
871
+ e.bi_valid > dt - t ? (e.bi_buf |= n << e.bi_valid & 65535, Be(e, e.bi_buf), e.bi_buf = n >> dt - e.bi_valid, e.bi_valid += t - dt) : (e.bi_buf |= n << e.bi_valid & 65535, e.bi_valid += t);
872
+ }, j = (e, n, t) => {
873
+ D(
874
+ e,
875
+ t[n * 2],
876
+ t[n * 2 + 1]
877
+ /*.Len*/
878
+ );
879
+ }, ai = (e, n) => {
880
+ let t = 0;
881
+ do
882
+ t |= e & 1, e >>>= 1, t <<= 1;
883
+ while (--n > 0);
884
+ return t >>> 1;
885
+ }, wr = (e) => {
886
+ e.bi_valid === 16 ? (Be(e, e.bi_buf), e.bi_buf = 0, e.bi_valid = 0) : e.bi_valid >= 8 && (e.pending_buf[e.pending++] = e.bi_buf & 255, e.bi_buf >>= 8, e.bi_valid -= 8);
887
+ }, mr = (e, n) => {
888
+ const t = n.dyn_tree, i = n.max_code, r = n.stat_desc.static_tree, a = n.stat_desc.has_stree, o = n.stat_desc.extra_bits, l = n.stat_desc.extra_base, u = n.stat_desc.max_length;
889
+ let s, f, d, c, h, _, g = 0;
890
+ for (c = 0; c <= se; c++)
891
+ e.bl_count[c] = 0;
892
+ for (t[e.heap[e.heap_max] * 2 + 1] = 0, s = e.heap_max + 1; s < Xn; s++)
893
+ f = e.heap[s], c = t[t[f * 2 + 1] * 2 + 1] + 1, c > u && (c = u, g++), t[f * 2 + 1] = c, !(f > i) && (e.bl_count[c]++, h = 0, f >= l && (h = o[f - l]), _ = t[f * 2], e.opt_len += _ * (c + h), a && (e.static_len += _ * (r[f * 2 + 1] + h)));
894
+ if (g !== 0) {
895
+ do {
896
+ for (c = u - 1; e.bl_count[c] === 0; )
897
+ c--;
898
+ e.bl_count[c]--, e.bl_count[c + 1] += 2, e.bl_count[u]--, g -= 2;
899
+ } while (g > 0);
900
+ for (c = u; c !== 0; c--)
901
+ for (f = e.bl_count[c]; f !== 0; )
902
+ d = e.heap[--s], !(d > i) && (t[d * 2 + 1] !== c && (e.opt_len += (c - t[d * 2 + 1]) * t[d * 2], t[d * 2 + 1] = c), f--);
903
+ }
904
+ }, oi = (e, n, t) => {
905
+ const i = new Array(se + 1);
906
+ let r = 0, a, o;
907
+ for (a = 1; a <= se; a++)
908
+ r = r + t[a - 1] << 1, i[a] = r;
909
+ for (o = 0; o <= n; o++) {
910
+ let l = e[o * 2 + 1];
911
+ l !== 0 && (e[o * 2] = ai(i[l]++, l));
912
+ }
913
+ }, yr = () => {
914
+ let e, n, t, i, r;
915
+ const a = new Array(se + 1);
916
+ for (t = 0, i = 0; i < xt - 1; i++)
917
+ for (jt[i] = t, e = 0; e < 1 << Ot[i]; e++)
918
+ Re[t++] = i;
919
+ for (Re[t - 1] = i, r = 0, i = 0; i < 16; i++)
920
+ for (it[i] = r, e = 0; e < 1 << nt[i]; e++)
921
+ ze[r++] = i;
922
+ for (r >>= 7; i < _e; i++)
923
+ for (it[i] = r << 7, e = 0; e < 1 << nt[i] - 7; e++)
924
+ ze[256 + r++] = i;
925
+ for (n = 0; n <= se; n++)
926
+ a[n] = 0;
927
+ for (e = 0; e <= 143; )
928
+ W[e * 2 + 1] = 8, e++, a[8]++;
929
+ for (; e <= 255; )
930
+ W[e * 2 + 1] = 9, e++, a[9]++;
931
+ for (; e <= 279; )
932
+ W[e * 2 + 1] = 7, e++, a[7]++;
933
+ for (; e <= 287; )
934
+ W[e * 2 + 1] = 8, e++, a[8]++;
935
+ for (oi(W, Oe + 1, a), e = 0; e < _e; e++)
936
+ Te[e * 2 + 1] = 5, Te[e * 2] = ai(e, 5);
937
+ ti = new pt(W, Ot, Ze + 1, Oe, se), ni = new pt(Te, nt, 0, _e, se), ii = new pt(new Array(0), br, 0, Mt, _r);
938
+ }, si = (e) => {
939
+ let n;
940
+ for (n = 0; n < Oe; n++)
941
+ e.dyn_ltree[n * 2] = 0;
942
+ for (n = 0; n < _e; n++)
943
+ e.dyn_dtree[n * 2] = 0;
944
+ for (n = 0; n < Mt; n++)
945
+ e.bl_tree[n * 2] = 0;
946
+ e.dyn_ltree[Ht * 2] = 1, e.opt_len = e.static_len = 0, e.sym_next = e.matches = 0;
947
+ }, li = (e) => {
948
+ e.bi_valid > 8 ? Be(e, e.bi_buf) : e.bi_valid > 0 && (e.pending_buf[e.pending++] = e.bi_buf), e.bi_buf = 0, e.bi_valid = 0;
949
+ }, nn = (e, n, t, i) => {
950
+ const r = n * 2, a = t * 2;
951
+ return e[r] < e[a] || e[r] === e[a] && i[n] <= i[t];
952
+ }, bt = (e, n, t) => {
953
+ const i = e.heap[t];
954
+ let r = t << 1;
955
+ for (; r <= e.heap_len && (r < e.heap_len && nn(n, e.heap[r + 1], e.heap[r], e.depth) && r++, !nn(n, i, e.heap[r], e.depth)); )
956
+ e.heap[t] = e.heap[r], t = r, r <<= 1;
957
+ e.heap[t] = i;
958
+ }, rn = (e, n, t) => {
959
+ let i, r, a = 0, o, l;
960
+ if (e.sym_next !== 0)
961
+ do
962
+ i = e.pending_buf[e.sym_buf + a++] & 255, i += (e.pending_buf[e.sym_buf + a++] & 255) << 8, r = e.pending_buf[e.sym_buf + a++], i === 0 ? j(e, r, n) : (o = Re[r], j(e, o + Ze + 1, n), l = Ot[o], l !== 0 && (r -= jt[o], D(e, r, l)), i--, o = ri(i), j(e, o, t), l = nt[o], l !== 0 && (i -= it[o], D(e, i, l)));
963
+ while (a < e.sym_next);
964
+ j(e, Ht, n);
965
+ }, zt = (e, n) => {
966
+ const t = n.dyn_tree, i = n.stat_desc.static_tree, r = n.stat_desc.has_stree, a = n.stat_desc.elems;
967
+ let o, l, u = -1, s;
968
+ for (e.heap_len = 0, e.heap_max = Xn, o = 0; o < a; o++)
969
+ t[o * 2] !== 0 ? (e.heap[++e.heap_len] = u = o, e.depth[o] = 0) : t[o * 2 + 1] = 0;
970
+ for (; e.heap_len < 2; )
971
+ s = e.heap[++e.heap_len] = u < 2 ? ++u : 0, t[s * 2] = 1, e.depth[s] = 0, e.opt_len--, r && (e.static_len -= i[s * 2 + 1]);
972
+ for (n.max_code = u, o = e.heap_len >> 1; o >= 1; o--)
973
+ bt(e, t, o);
974
+ s = a;
975
+ do
976
+ o = e.heap[
977
+ 1
978
+ /*SMALLEST*/
979
+ ], e.heap[
980
+ 1
981
+ /*SMALLEST*/
982
+ ] = e.heap[e.heap_len--], bt(
983
+ e,
984
+ t,
985
+ 1
986
+ /*SMALLEST*/
987
+ ), l = e.heap[
988
+ 1
989
+ /*SMALLEST*/
990
+ ], e.heap[--e.heap_max] = o, e.heap[--e.heap_max] = l, t[s * 2] = t[o * 2] + t[l * 2], e.depth[s] = (e.depth[o] >= e.depth[l] ? e.depth[o] : e.depth[l]) + 1, t[o * 2 + 1] = t[l * 2 + 1] = s, e.heap[
991
+ 1
992
+ /*SMALLEST*/
993
+ ] = s++, bt(
994
+ e,
995
+ t,
996
+ 1
997
+ /*SMALLEST*/
998
+ );
999
+ while (e.heap_len >= 2);
1000
+ e.heap[--e.heap_max] = e.heap[
1001
+ 1
1002
+ /*SMALLEST*/
1003
+ ], mr(e, n), oi(t, u, e.bl_count);
1004
+ }, an = (e, n, t) => {
1005
+ let i, r = -1, a, o = n[0 * 2 + 1], l = 0, u = 7, s = 4;
1006
+ for (o === 0 && (u = 138, s = 3), n[(t + 1) * 2 + 1] = 65535, i = 0; i <= t; i++)
1007
+ a = o, o = n[(i + 1) * 2 + 1], !(++l < u && a === o) && (l < s ? e.bl_tree[a * 2] += l : a !== 0 ? (a !== r && e.bl_tree[a * 2]++, e.bl_tree[qn * 2]++) : l <= 10 ? e.bl_tree[Jn * 2]++ : e.bl_tree[Qn * 2]++, l = 0, r = a, o === 0 ? (u = 138, s = 3) : a === o ? (u = 6, s = 3) : (u = 7, s = 4));
1008
+ }, on = (e, n, t) => {
1009
+ let i, r = -1, a, o = n[0 * 2 + 1], l = 0, u = 7, s = 4;
1010
+ for (o === 0 && (u = 138, s = 3), i = 0; i <= t; i++)
1011
+ if (a = o, o = n[(i + 1) * 2 + 1], !(++l < u && a === o)) {
1012
+ if (l < s)
1013
+ do
1014
+ j(e, a, e.bl_tree);
1015
+ while (--l !== 0);
1016
+ else
1017
+ a !== 0 ? (a !== r && (j(e, a, e.bl_tree), l--), j(e, qn, e.bl_tree), D(e, l - 3, 2)) : l <= 10 ? (j(e, Jn, e.bl_tree), D(e, l - 3, 3)) : (j(e, Qn, e.bl_tree), D(e, l - 11, 7));
1018
+ l = 0, r = a, o === 0 ? (u = 138, s = 3) : a === o ? (u = 6, s = 3) : (u = 7, s = 4);
1019
+ }
1020
+ }, vr = (e) => {
1021
+ let n;
1022
+ for (an(e, e.dyn_ltree, e.l_desc.max_code), an(e, e.dyn_dtree, e.d_desc.max_code), zt(e, e.bl_desc), n = Mt - 1; n >= 3 && e.bl_tree[ei[n] * 2 + 1] === 0; n--)
1023
+ ;
1024
+ return e.opt_len += 3 * (n + 1) + 5 + 5 + 4, n;
1025
+ }, kr = (e, n, t, i) => {
1026
+ let r;
1027
+ for (D(e, n - 257, 5), D(e, t - 1, 5), D(e, i - 4, 4), r = 0; r < i; r++)
1028
+ D(e, e.bl_tree[ei[r] * 2 + 1], 3);
1029
+ on(e, e.dyn_ltree, n - 1), on(e, e.dyn_dtree, t - 1);
1030
+ }, $r = (e) => {
1031
+ let n = 4093624447, t;
1032
+ for (t = 0; t <= 31; t++, n >>>= 1)
1033
+ if (n & 1 && e.dyn_ltree[t * 2] !== 0)
1034
+ return en;
1035
+ if (e.dyn_ltree[9 * 2] !== 0 || e.dyn_ltree[10 * 2] !== 0 || e.dyn_ltree[13 * 2] !== 0)
1036
+ return tn;
1037
+ for (t = 32; t < Ze; t++)
1038
+ if (e.dyn_ltree[t * 2] !== 0)
1039
+ return tn;
1040
+ return en;
1041
+ };
1042
+ let sn = !1;
1043
+ const Er = (e) => {
1044
+ sn || (yr(), sn = !0), e.l_desc = new _t(e.dyn_ltree, ti), e.d_desc = new _t(e.dyn_dtree, ni), e.bl_desc = new _t(e.bl_tree, ii), e.bi_buf = 0, e.bi_valid = 0, si(e);
1045
+ }, fi = (e, n, t, i) => {
1046
+ D(e, (hr << 1) + (i ? 1 : 0), 3), li(e), Be(e, t), Be(e, ~t), t && e.pending_buf.set(e.window.subarray(n, n + t), e.pending), e.pending += t;
1047
+ }, Cr = (e) => {
1048
+ D(e, Wn << 1, 3), j(e, Ht, W), wr(e);
1049
+ }, Sr = (e, n, t, i) => {
1050
+ let r, a, o = 0;
1051
+ e.level > 0 ? (e.strm.data_type === ur && (e.strm.data_type = $r(e)), zt(e, e.l_desc), zt(e, e.d_desc), o = vr(e), r = e.opt_len + 3 + 7 >>> 3, a = e.static_len + 3 + 7 >>> 3, a <= r && (r = a)) : r = a = t + 5, t + 4 <= r && n !== -1 ? fi(e, n, t, i) : e.strategy === fr || a === r ? (D(e, (Wn << 1) + (i ? 1 : 0), 3), rn(e, W, Te)) : (D(e, (cr << 1) + (i ? 1 : 0), 3), kr(e, e.l_desc.max_code + 1, e.d_desc.max_code + 1, o + 1), rn(e, e.dyn_ltree, e.dyn_dtree)), si(e), i && li(e);
1052
+ }, Nr = (e, n, t) => (e.pending_buf[e.sym_buf + e.sym_next++] = n, e.pending_buf[e.sym_buf + e.sym_next++] = n >> 8, e.pending_buf[e.sym_buf + e.sym_next++] = t, n === 0 ? e.dyn_ltree[t * 2]++ : (e.matches++, n--, e.dyn_ltree[(Re[t] + Ze + 1) * 2]++, e.dyn_dtree[ri(n) * 2]++), e.sym_next === e.sym_end);
1053
+ var Tr = Er, Ir = fi, Ar = Sr, Or = Nr, zr = Cr, Rr = {
1054
+ _tr_init: Tr,
1055
+ _tr_stored_block: Ir,
1056
+ _tr_flush_block: Ar,
1057
+ _tr_tally: Or,
1058
+ _tr_align: zr
1059
+ };
1060
+ const Br = (e, n, t, i) => {
1061
+ let r = e & 65535 | 0, a = e >>> 16 & 65535 | 0, o = 0;
1062
+ for (; t !== 0; ) {
1063
+ o = t > 2e3 ? 2e3 : t, t -= o;
1064
+ do
1065
+ r = r + n[i++] | 0, a = a + r | 0;
1066
+ while (--o);
1067
+ r %= 65521, a %= 65521;
1068
+ }
1069
+ return r | a << 16 | 0;
1070
+ };
1071
+ var Ue = Br;
1072
+ const Ur = () => {
1073
+ let e, n = [];
1074
+ for (var t = 0; t < 256; t++) {
1075
+ e = t;
1076
+ for (var i = 0; i < 8; i++)
1077
+ e = e & 1 ? 3988292384 ^ e >>> 1 : e >>> 1;
1078
+ n[t] = e;
1079
+ }
1080
+ return n;
1081
+ }, Dr = new Uint32Array(Ur()), Vr = (e, n, t, i) => {
1082
+ const r = Dr, a = i + t;
1083
+ e ^= -1;
1084
+ for (let o = i; o < a; o++)
1085
+ e = e >>> 8 ^ r[(e ^ n[o]) & 255];
1086
+ return e ^ -1;
1087
+ };
1088
+ var R = Vr, ge = {
1089
+ 2: "need dictionary",
1090
+ /* Z_NEED_DICT 2 */
1091
+ 1: "stream end",
1092
+ /* Z_STREAM_END 1 */
1093
+ 0: "",
1094
+ /* Z_OK 0 */
1095
+ "-1": "file error",
1096
+ /* Z_ERRNO (-1) */
1097
+ "-2": "stream error",
1098
+ /* Z_STREAM_ERROR (-2) */
1099
+ "-3": "data error",
1100
+ /* Z_DATA_ERROR (-3) */
1101
+ "-4": "insufficient memory",
1102
+ /* Z_MEM_ERROR (-4) */
1103
+ "-5": "buffer error",
1104
+ /* Z_BUF_ERROR (-5) */
1105
+ "-6": "incompatible version"
1106
+ /* Z_VERSION_ERROR (-6) */
1107
+ }, xe = {
1108
+ /* Allowed flush values; see deflate() and inflate() below for details */
1109
+ Z_NO_FLUSH: 0,
1110
+ Z_PARTIAL_FLUSH: 1,
1111
+ Z_SYNC_FLUSH: 2,
1112
+ Z_FULL_FLUSH: 3,
1113
+ Z_FINISH: 4,
1114
+ Z_BLOCK: 5,
1115
+ Z_TREES: 6,
1116
+ /* Return codes for the compression/decompression functions. Negative values
1117
+ * are errors, positive values are used for special but normal events.
1118
+ */
1119
+ Z_OK: 0,
1120
+ Z_STREAM_END: 1,
1121
+ Z_NEED_DICT: 2,
1122
+ Z_ERRNO: -1,
1123
+ Z_STREAM_ERROR: -2,
1124
+ Z_DATA_ERROR: -3,
1125
+ Z_MEM_ERROR: -4,
1126
+ Z_BUF_ERROR: -5,
1127
+ //Z_VERSION_ERROR: -6,
1128
+ /* compression levels */
1129
+ Z_NO_COMPRESSION: 0,
1130
+ Z_BEST_SPEED: 1,
1131
+ Z_BEST_COMPRESSION: 9,
1132
+ Z_DEFAULT_COMPRESSION: -1,
1133
+ Z_FILTERED: 1,
1134
+ Z_HUFFMAN_ONLY: 2,
1135
+ Z_RLE: 3,
1136
+ Z_FIXED: 4,
1137
+ Z_DEFAULT_STRATEGY: 0,
1138
+ /* Possible values of the data_type field (though see inflate()) */
1139
+ Z_BINARY: 0,
1140
+ Z_TEXT: 1,
1141
+ //Z_ASCII: 1, // = Z_TEXT (deprecated)
1142
+ Z_UNKNOWN: 2,
1143
+ /* The deflate compression method */
1144
+ Z_DEFLATED: 8
1145
+ //Z_NULL: null // Use -1 or null inline, depending on var type
1146
+ };
1147
+ const { _tr_init: Lr, _tr_stored_block: Rt, _tr_flush_block: Fr, _tr_tally: te, _tr_align: Pr } = Rr, {
1148
+ Z_NO_FLUSH: ne,
1149
+ Z_PARTIAL_FLUSH: Zr,
1150
+ Z_FULL_FLUSH: xr,
1151
+ Z_FINISH: F,
1152
+ Z_BLOCK: ln,
1153
+ Z_OK: B,
1154
+ Z_STREAM_END: fn,
1155
+ Z_STREAM_ERROR: G,
1156
+ Z_DATA_ERROR: Mr,
1157
+ Z_BUF_ERROR: gt,
1158
+ Z_DEFAULT_COMPRESSION: Hr,
1159
+ Z_FILTERED: jr,
1160
+ Z_HUFFMAN_ONLY: We,
1161
+ Z_RLE: Gr,
1162
+ Z_FIXED: Yr,
1163
+ Z_DEFAULT_STRATEGY: Kr,
1164
+ Z_UNKNOWN: Wr,
1165
+ Z_DEFLATED: ut
1166
+ } = xe, Xr = 9, qr = 15, Jr = 8, Qr = 29, ea = 256, Bt = ea + 1 + Qr, ta = 30, na = 19, ia = 2 * Bt + 1, ra = 15, I = 3, ee = 258, Y = ee + I + 1, aa = 32, we = 42, Gt = 57, Ut = 69, Dt = 73, Vt = 91, Lt = 103, le = 113, Se = 666, U = 1, ve = 2, ue = 3, ke = 4, oa = 3, fe = (e, n) => (e.msg = ge[n], n), un = (e) => e * 2 - (e > 4 ? 9 : 0), J = (e) => {
1167
+ let n = e.length;
1168
+ for (; --n >= 0; )
1169
+ e[n] = 0;
1170
+ }, sa = (e) => {
1171
+ let n, t, i, r = e.w_size;
1172
+ n = e.hash_size, i = n;
1173
+ do
1174
+ t = e.head[--i], e.head[i] = t >= r ? t - r : 0;
1175
+ while (--n);
1176
+ n = r, i = n;
1177
+ do
1178
+ t = e.prev[--i], e.prev[i] = t >= r ? t - r : 0;
1179
+ while (--n);
1180
+ };
1181
+ let la = (e, n, t) => (n << e.hash_shift ^ t) & e.hash_mask, ie = la;
1182
+ const V = (e) => {
1183
+ const n = e.state;
1184
+ let t = n.pending;
1185
+ t > e.avail_out && (t = e.avail_out), t !== 0 && (e.output.set(n.pending_buf.subarray(n.pending_out, n.pending_out + t), e.next_out), e.next_out += t, n.pending_out += t, e.total_out += t, e.avail_out -= t, n.pending -= t, n.pending === 0 && (n.pending_out = 0));
1186
+ }, L = (e, n) => {
1187
+ Fr(e, e.block_start >= 0 ? e.block_start : -1, e.strstart - e.block_start, n), e.block_start = e.strstart, V(e.strm);
1188
+ }, A = (e, n) => {
1189
+ e.pending_buf[e.pending++] = n;
1190
+ }, Ce = (e, n) => {
1191
+ e.pending_buf[e.pending++] = n >>> 8 & 255, e.pending_buf[e.pending++] = n & 255;
1192
+ }, Ft = (e, n, t, i) => {
1193
+ let r = e.avail_in;
1194
+ return r > i && (r = i), r === 0 ? 0 : (e.avail_in -= r, n.set(e.input.subarray(e.next_in, e.next_in + r), t), e.state.wrap === 1 ? e.adler = Ue(e.adler, n, r, t) : e.state.wrap === 2 && (e.adler = R(e.adler, n, r, t)), e.next_in += r, e.total_in += r, r);
1195
+ }, ui = (e, n) => {
1196
+ let t = e.max_chain_length, i = e.strstart, r, a, o = e.prev_length, l = e.nice_match;
1197
+ const u = e.strstart > e.w_size - Y ? e.strstart - (e.w_size - Y) : 0, s = e.window, f = e.w_mask, d = e.prev, c = e.strstart + ee;
1198
+ let h = s[i + o - 1], _ = s[i + o];
1199
+ e.prev_length >= e.good_match && (t >>= 2), l > e.lookahead && (l = e.lookahead);
1200
+ do
1201
+ if (r = n, !(s[r + o] !== _ || s[r + o - 1] !== h || s[r] !== s[i] || s[++r] !== s[i + 1])) {
1202
+ i += 2, r++;
1203
+ do
1204
+ ;
1205
+ while (s[++i] === s[++r] && s[++i] === s[++r] && s[++i] === s[++r] && s[++i] === s[++r] && s[++i] === s[++r] && s[++i] === s[++r] && s[++i] === s[++r] && s[++i] === s[++r] && i < c);
1206
+ if (a = ee - (c - i), i = c - ee, a > o) {
1207
+ if (e.match_start = n, o = a, a >= l)
1208
+ break;
1209
+ h = s[i + o - 1], _ = s[i + o];
1210
+ }
1211
+ }
1212
+ while ((n = d[n & f]) > u && --t !== 0);
1213
+ return o <= e.lookahead ? o : e.lookahead;
1214
+ }, me = (e) => {
1215
+ const n = e.w_size;
1216
+ let t, i, r;
1217
+ do {
1218
+ if (i = e.window_size - e.lookahead - e.strstart, e.strstart >= n + (n - Y) && (e.window.set(e.window.subarray(n, n + n - i), 0), e.match_start -= n, e.strstart -= n, e.block_start -= n, e.insert > e.strstart && (e.insert = e.strstart), sa(e), i += n), e.strm.avail_in === 0)
1219
+ break;
1220
+ if (t = Ft(e.strm, e.window, e.strstart + e.lookahead, i), e.lookahead += t, e.lookahead + e.insert >= I)
1221
+ for (r = e.strstart - e.insert, e.ins_h = e.window[r], e.ins_h = ie(e, e.ins_h, e.window[r + 1]); e.insert && (e.ins_h = ie(e, e.ins_h, e.window[r + I - 1]), e.prev[r & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = r, r++, e.insert--, !(e.lookahead + e.insert < I)); )
1222
+ ;
1223
+ } while (e.lookahead < Y && e.strm.avail_in !== 0);
1224
+ }, hi = (e, n) => {
1225
+ let t = e.pending_buf_size - 5 > e.w_size ? e.w_size : e.pending_buf_size - 5, i, r, a, o = 0, l = e.strm.avail_in;
1226
+ do {
1227
+ if (i = 65535, a = e.bi_valid + 42 >> 3, e.strm.avail_out < a || (a = e.strm.avail_out - a, r = e.strstart - e.block_start, i > r + e.strm.avail_in && (i = r + e.strm.avail_in), i > a && (i = a), i < t && (i === 0 && n !== F || n === ne || i !== r + e.strm.avail_in)))
1228
+ break;
1229
+ o = n === F && i === r + e.strm.avail_in ? 1 : 0, Rt(e, 0, 0, o), e.pending_buf[e.pending - 4] = i, e.pending_buf[e.pending - 3] = i >> 8, e.pending_buf[e.pending - 2] = ~i, e.pending_buf[e.pending - 1] = ~i >> 8, V(e.strm), r && (r > i && (r = i), e.strm.output.set(e.window.subarray(e.block_start, e.block_start + r), e.strm.next_out), e.strm.next_out += r, e.strm.avail_out -= r, e.strm.total_out += r, e.block_start += r, i -= r), i && (Ft(e.strm, e.strm.output, e.strm.next_out, i), e.strm.next_out += i, e.strm.avail_out -= i, e.strm.total_out += i);
1230
+ } while (o === 0);
1231
+ return l -= e.strm.avail_in, l && (l >= e.w_size ? (e.matches = 2, e.window.set(e.strm.input.subarray(e.strm.next_in - e.w_size, e.strm.next_in), 0), e.strstart = e.w_size, e.insert = e.strstart) : (e.window_size - e.strstart <= l && (e.strstart -= e.w_size, e.window.set(e.window.subarray(e.w_size, e.w_size + e.strstart), 0), e.matches < 2 && e.matches++, e.insert > e.strstart && (e.insert = e.strstart)), e.window.set(e.strm.input.subarray(e.strm.next_in - l, e.strm.next_in), e.strstart), e.strstart += l, e.insert += l > e.w_size - e.insert ? e.w_size - e.insert : l), e.block_start = e.strstart), e.high_water < e.strstart && (e.high_water = e.strstart), o ? ke : n !== ne && n !== F && e.strm.avail_in === 0 && e.strstart === e.block_start ? ve : (a = e.window_size - e.strstart, e.strm.avail_in > a && e.block_start >= e.w_size && (e.block_start -= e.w_size, e.strstart -= e.w_size, e.window.set(e.window.subarray(e.w_size, e.w_size + e.strstart), 0), e.matches < 2 && e.matches++, a += e.w_size, e.insert > e.strstart && (e.insert = e.strstart)), a > e.strm.avail_in && (a = e.strm.avail_in), a && (Ft(e.strm, e.window, e.strstart, a), e.strstart += a, e.insert += a > e.w_size - e.insert ? e.w_size - e.insert : a), e.high_water < e.strstart && (e.high_water = e.strstart), a = e.bi_valid + 42 >> 3, a = e.pending_buf_size - a > 65535 ? 65535 : e.pending_buf_size - a, t = a > e.w_size ? e.w_size : a, r = e.strstart - e.block_start, (r >= t || (r || n === F) && n !== ne && e.strm.avail_in === 0 && r <= a) && (i = r > a ? a : r, o = n === F && e.strm.avail_in === 0 && i === r ? 1 : 0, Rt(e, e.block_start, i, o), e.block_start += i, V(e.strm)), o ? ue : U);
1232
+ }, wt = (e, n) => {
1233
+ let t, i;
1234
+ for (; ; ) {
1235
+ if (e.lookahead < Y) {
1236
+ if (me(e), e.lookahead < Y && n === ne)
1237
+ return U;
1238
+ if (e.lookahead === 0)
1239
+ break;
1240
+ }
1241
+ if (t = 0, e.lookahead >= I && (e.ins_h = ie(e, e.ins_h, e.window[e.strstart + I - 1]), t = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart), t !== 0 && e.strstart - t <= e.w_size - Y && (e.match_length = ui(e, t)), e.match_length >= I)
1242
+ if (i = te(e, e.strstart - e.match_start, e.match_length - I), e.lookahead -= e.match_length, e.match_length <= e.max_lazy_match && e.lookahead >= I) {
1243
+ e.match_length--;
1244
+ do
1245
+ e.strstart++, e.ins_h = ie(e, e.ins_h, e.window[e.strstart + I - 1]), t = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart;
1246
+ while (--e.match_length !== 0);
1247
+ e.strstart++;
1248
+ } else
1249
+ e.strstart += e.match_length, e.match_length = 0, e.ins_h = e.window[e.strstart], e.ins_h = ie(e, e.ins_h, e.window[e.strstart + 1]);
1250
+ else
1251
+ i = te(e, 0, e.window[e.strstart]), e.lookahead--, e.strstart++;
1252
+ if (i && (L(e, !1), e.strm.avail_out === 0))
1253
+ return U;
1254
+ }
1255
+ return e.insert = e.strstart < I - 1 ? e.strstart : I - 1, n === F ? (L(e, !0), e.strm.avail_out === 0 ? ue : ke) : e.sym_next && (L(e, !1), e.strm.avail_out === 0) ? U : ve;
1256
+ }, de = (e, n) => {
1257
+ let t, i, r;
1258
+ for (; ; ) {
1259
+ if (e.lookahead < Y) {
1260
+ if (me(e), e.lookahead < Y && n === ne)
1261
+ return U;
1262
+ if (e.lookahead === 0)
1263
+ break;
1264
+ }
1265
+ if (t = 0, e.lookahead >= I && (e.ins_h = ie(e, e.ins_h, e.window[e.strstart + I - 1]), t = 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 = I - 1, t !== 0 && e.prev_length < e.max_lazy_match && e.strstart - t <= e.w_size - Y && (e.match_length = ui(e, t), e.match_length <= 5 && (e.strategy === jr || e.match_length === I && e.strstart - e.match_start > 4096) && (e.match_length = I - 1)), e.prev_length >= I && e.match_length <= e.prev_length) {
1266
+ r = e.strstart + e.lookahead - I, i = te(e, e.strstart - 1 - e.prev_match, e.prev_length - I), e.lookahead -= e.prev_length - 1, e.prev_length -= 2;
1267
+ do
1268
+ ++e.strstart <= r && (e.ins_h = ie(e, e.ins_h, e.window[e.strstart + I - 1]), t = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart);
1269
+ while (--e.prev_length !== 0);
1270
+ if (e.match_available = 0, e.match_length = I - 1, e.strstart++, i && (L(e, !1), e.strm.avail_out === 0))
1271
+ return U;
1272
+ } else if (e.match_available) {
1273
+ if (i = te(e, 0, e.window[e.strstart - 1]), i && L(e, !1), e.strstart++, e.lookahead--, e.strm.avail_out === 0)
1274
+ return U;
1275
+ } else
1276
+ e.match_available = 1, e.strstart++, e.lookahead--;
1277
+ }
1278
+ return e.match_available && (i = te(e, 0, e.window[e.strstart - 1]), e.match_available = 0), e.insert = e.strstart < I - 1 ? e.strstart : I - 1, n === F ? (L(e, !0), e.strm.avail_out === 0 ? ue : ke) : e.sym_next && (L(e, !1), e.strm.avail_out === 0) ? U : ve;
1279
+ }, fa = (e, n) => {
1280
+ let t, i, r, a;
1281
+ const o = e.window;
1282
+ for (; ; ) {
1283
+ if (e.lookahead <= ee) {
1284
+ if (me(e), e.lookahead <= ee && n === ne)
1285
+ return U;
1286
+ if (e.lookahead === 0)
1287
+ break;
1288
+ }
1289
+ if (e.match_length = 0, e.lookahead >= I && e.strstart > 0 && (r = e.strstart - 1, i = o[r], i === o[++r] && i === o[++r] && i === o[++r])) {
1290
+ a = e.strstart + ee;
1291
+ do
1292
+ ;
1293
+ while (i === o[++r] && i === o[++r] && i === o[++r] && i === o[++r] && i === o[++r] && i === o[++r] && i === o[++r] && i === o[++r] && r < a);
1294
+ e.match_length = ee - (a - r), e.match_length > e.lookahead && (e.match_length = e.lookahead);
1295
+ }
1296
+ if (e.match_length >= I ? (t = te(e, 1, e.match_length - I), e.lookahead -= e.match_length, e.strstart += e.match_length, e.match_length = 0) : (t = te(e, 0, e.window[e.strstart]), e.lookahead--, e.strstart++), t && (L(e, !1), e.strm.avail_out === 0))
1297
+ return U;
1298
+ }
1299
+ return e.insert = 0, n === F ? (L(e, !0), e.strm.avail_out === 0 ? ue : ke) : e.sym_next && (L(e, !1), e.strm.avail_out === 0) ? U : ve;
1300
+ }, ua = (e, n) => {
1301
+ let t;
1302
+ for (; ; ) {
1303
+ if (e.lookahead === 0 && (me(e), e.lookahead === 0)) {
1304
+ if (n === ne)
1305
+ return U;
1306
+ break;
1307
+ }
1308
+ if (e.match_length = 0, t = te(e, 0, e.window[e.strstart]), e.lookahead--, e.strstart++, t && (L(e, !1), e.strm.avail_out === 0))
1309
+ return U;
1310
+ }
1311
+ return e.insert = 0, n === F ? (L(e, !0), e.strm.avail_out === 0 ? ue : ke) : e.sym_next && (L(e, !1), e.strm.avail_out === 0) ? U : ve;
1312
+ };
1313
+ function H(e, n, t, i, r) {
1314
+ this.good_length = e, this.max_lazy = n, this.nice_length = t, this.max_chain = i, this.func = r;
1315
+ }
1316
+ const Ne = [
1317
+ /* good lazy nice chain */
1318
+ new H(0, 0, 0, 0, hi),
1319
+ /* 0 store only */
1320
+ new H(4, 4, 8, 4, wt),
1321
+ /* 1 max speed, no lazy matches */
1322
+ new H(4, 5, 16, 8, wt),
1323
+ /* 2 */
1324
+ new H(4, 6, 32, 32, wt),
1325
+ /* 3 */
1326
+ new H(4, 4, 16, 16, de),
1327
+ /* 4 lazy matches */
1328
+ new H(8, 16, 32, 32, de),
1329
+ /* 5 */
1330
+ new H(8, 16, 128, 128, de),
1331
+ /* 6 */
1332
+ new H(8, 32, 128, 256, de),
1333
+ /* 7 */
1334
+ new H(32, 128, 258, 1024, de),
1335
+ /* 8 */
1336
+ new H(32, 258, 258, 4096, de)
1337
+ /* 9 max compression */
1338
+ ], ha = (e) => {
1339
+ e.window_size = 2 * e.w_size, J(e.head), e.max_lazy_match = Ne[e.level].max_lazy, e.good_match = Ne[e.level].good_length, e.nice_match = Ne[e.level].nice_length, e.max_chain_length = Ne[e.level].max_chain, e.strstart = 0, e.block_start = 0, e.lookahead = 0, e.insert = 0, e.match_length = e.prev_length = I - 1, e.match_available = 0, e.ins_h = 0;
1340
+ };
1341
+ function ca() {
1342
+ 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 = ut, 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 Uint16Array(ia * 2), this.dyn_dtree = new Uint16Array((2 * ta + 1) * 2), this.bl_tree = new Uint16Array((2 * na + 1) * 2), J(this.dyn_ltree), J(this.dyn_dtree), J(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new Uint16Array(ra + 1), this.heap = new Uint16Array(2 * Bt + 1), J(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new Uint16Array(2 * Bt + 1), J(this.depth), this.sym_buf = 0, this.lit_bufsize = 0, this.sym_next = 0, this.sym_end = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0;
1343
+ }
1344
+ const Me = (e) => {
1345
+ if (!e)
1346
+ return 1;
1347
+ const n = e.state;
1348
+ return !n || n.strm !== e || n.status !== we && //#ifdef GZIP
1349
+ n.status !== Gt && //#endif
1350
+ n.status !== Ut && n.status !== Dt && n.status !== Vt && n.status !== Lt && n.status !== le && n.status !== Se ? 1 : 0;
1351
+ }, ci = (e) => {
1352
+ if (Me(e))
1353
+ return fe(e, G);
1354
+ e.total_in = e.total_out = 0, e.data_type = Wr;
1355
+ const n = e.state;
1356
+ return n.pending = 0, n.pending_out = 0, n.wrap < 0 && (n.wrap = -n.wrap), n.status = //#ifdef GZIP
1357
+ n.wrap === 2 ? Gt : (
1358
+ //#endif
1359
+ n.wrap ? we : le
1360
+ ), e.adler = n.wrap === 2 ? 0 : 1, n.last_flush = -2, Lr(n), B;
1361
+ }, di = (e) => {
1362
+ const n = ci(e);
1363
+ return n === B && ha(e.state), n;
1364
+ }, da = (e, n) => Me(e) || e.state.wrap !== 2 ? G : (e.state.gzhead = n, B), pi = (e, n, t, i, r, a) => {
1365
+ if (!e)
1366
+ return G;
1367
+ let o = 1;
1368
+ if (n === Hr && (n = 6), i < 0 ? (o = 0, i = -i) : i > 15 && (o = 2, i -= 16), r < 1 || r > Xr || t !== ut || i < 8 || i > 15 || n < 0 || n > 9 || a < 0 || a > Yr || i === 8 && o !== 1)
1369
+ return fe(e, G);
1370
+ i === 8 && (i = 9);
1371
+ const l = new ca();
1372
+ return e.state = l, l.strm = e, l.status = we, l.wrap = o, l.gzhead = null, l.w_bits = i, l.w_size = 1 << l.w_bits, l.w_mask = l.w_size - 1, l.hash_bits = r + 7, l.hash_size = 1 << l.hash_bits, l.hash_mask = l.hash_size - 1, l.hash_shift = ~~((l.hash_bits + I - 1) / I), l.window = new Uint8Array(l.w_size * 2), l.head = new Uint16Array(l.hash_size), l.prev = new Uint16Array(l.w_size), l.lit_bufsize = 1 << r + 6, l.pending_buf_size = l.lit_bufsize * 4, l.pending_buf = new Uint8Array(l.pending_buf_size), l.sym_buf = l.lit_bufsize, l.sym_end = (l.lit_bufsize - 1) * 3, l.level = n, l.strategy = a, l.method = t, di(e);
1373
+ }, pa = (e, n) => pi(e, n, ut, qr, Jr, Kr), _a = (e, n) => {
1374
+ if (Me(e) || n > ln || n < 0)
1375
+ return e ? fe(e, G) : G;
1376
+ const t = e.state;
1377
+ if (!e.output || e.avail_in !== 0 && !e.input || t.status === Se && n !== F)
1378
+ return fe(e, e.avail_out === 0 ? gt : G);
1379
+ const i = t.last_flush;
1380
+ if (t.last_flush = n, t.pending !== 0) {
1381
+ if (V(e), e.avail_out === 0)
1382
+ return t.last_flush = -1, B;
1383
+ } else if (e.avail_in === 0 && un(n) <= un(i) && n !== F)
1384
+ return fe(e, gt);
1385
+ if (t.status === Se && e.avail_in !== 0)
1386
+ return fe(e, gt);
1387
+ if (t.status === we && t.wrap === 0 && (t.status = le), t.status === we) {
1388
+ let r = ut + (t.w_bits - 8 << 4) << 8, a = -1;
1389
+ if (t.strategy >= We || t.level < 2 ? a = 0 : t.level < 6 ? a = 1 : t.level === 6 ? a = 2 : a = 3, r |= a << 6, t.strstart !== 0 && (r |= aa), r += 31 - r % 31, Ce(t, r), t.strstart !== 0 && (Ce(t, e.adler >>> 16), Ce(t, e.adler & 65535)), e.adler = 1, t.status = le, V(e), t.pending !== 0)
1390
+ return t.last_flush = -1, B;
1391
+ }
1392
+ if (t.status === Gt) {
1393
+ if (e.adler = 0, A(t, 31), A(t, 139), A(t, 8), t.gzhead)
1394
+ A(
1395
+ t,
1396
+ (t.gzhead.text ? 1 : 0) + (t.gzhead.hcrc ? 2 : 0) + (t.gzhead.extra ? 4 : 0) + (t.gzhead.name ? 8 : 0) + (t.gzhead.comment ? 16 : 0)
1397
+ ), A(t, t.gzhead.time & 255), A(t, t.gzhead.time >> 8 & 255), A(t, t.gzhead.time >> 16 & 255), A(t, t.gzhead.time >> 24 & 255), A(t, t.level === 9 ? 2 : t.strategy >= We || t.level < 2 ? 4 : 0), A(t, t.gzhead.os & 255), t.gzhead.extra && t.gzhead.extra.length && (A(t, t.gzhead.extra.length & 255), A(t, t.gzhead.extra.length >> 8 & 255)), t.gzhead.hcrc && (e.adler = R(e.adler, t.pending_buf, t.pending, 0)), t.gzindex = 0, t.status = Ut;
1398
+ else if (A(t, 0), A(t, 0), A(t, 0), A(t, 0), A(t, 0), A(t, t.level === 9 ? 2 : t.strategy >= We || t.level < 2 ? 4 : 0), A(t, oa), t.status = le, V(e), t.pending !== 0)
1399
+ return t.last_flush = -1, B;
1400
+ }
1401
+ if (t.status === Ut) {
1402
+ if (t.gzhead.extra) {
1403
+ let r = t.pending, a = (t.gzhead.extra.length & 65535) - t.gzindex;
1404
+ for (; t.pending + a > t.pending_buf_size; ) {
1405
+ let l = t.pending_buf_size - t.pending;
1406
+ if (t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex, t.gzindex + l), t.pending), t.pending = t.pending_buf_size, t.gzhead.hcrc && t.pending > r && (e.adler = R(e.adler, t.pending_buf, t.pending - r, r)), t.gzindex += l, V(e), t.pending !== 0)
1407
+ return t.last_flush = -1, B;
1408
+ r = 0, a -= l;
1409
+ }
1410
+ let o = new Uint8Array(t.gzhead.extra);
1411
+ t.pending_buf.set(o.subarray(t.gzindex, t.gzindex + a), t.pending), t.pending += a, t.gzhead.hcrc && t.pending > r && (e.adler = R(e.adler, t.pending_buf, t.pending - r, r)), t.gzindex = 0;
1412
+ }
1413
+ t.status = Dt;
1414
+ }
1415
+ if (t.status === Dt) {
1416
+ if (t.gzhead.name) {
1417
+ let r = t.pending, a;
1418
+ do {
1419
+ if (t.pending === t.pending_buf_size) {
1420
+ if (t.gzhead.hcrc && t.pending > r && (e.adler = R(e.adler, t.pending_buf, t.pending - r, r)), V(e), t.pending !== 0)
1421
+ return t.last_flush = -1, B;
1422
+ r = 0;
1423
+ }
1424
+ t.gzindex < t.gzhead.name.length ? a = t.gzhead.name.charCodeAt(t.gzindex++) & 255 : a = 0, A(t, a);
1425
+ } while (a !== 0);
1426
+ t.gzhead.hcrc && t.pending > r && (e.adler = R(e.adler, t.pending_buf, t.pending - r, r)), t.gzindex = 0;
1427
+ }
1428
+ t.status = Vt;
1429
+ }
1430
+ if (t.status === Vt) {
1431
+ if (t.gzhead.comment) {
1432
+ let r = t.pending, a;
1433
+ do {
1434
+ if (t.pending === t.pending_buf_size) {
1435
+ if (t.gzhead.hcrc && t.pending > r && (e.adler = R(e.adler, t.pending_buf, t.pending - r, r)), V(e), t.pending !== 0)
1436
+ return t.last_flush = -1, B;
1437
+ r = 0;
1438
+ }
1439
+ t.gzindex < t.gzhead.comment.length ? a = t.gzhead.comment.charCodeAt(t.gzindex++) & 255 : a = 0, A(t, a);
1440
+ } while (a !== 0);
1441
+ t.gzhead.hcrc && t.pending > r && (e.adler = R(e.adler, t.pending_buf, t.pending - r, r));
1442
+ }
1443
+ t.status = Lt;
1444
+ }
1445
+ if (t.status === Lt) {
1446
+ if (t.gzhead.hcrc) {
1447
+ if (t.pending + 2 > t.pending_buf_size && (V(e), t.pending !== 0))
1448
+ return t.last_flush = -1, B;
1449
+ A(t, e.adler & 255), A(t, e.adler >> 8 & 255), e.adler = 0;
1450
+ }
1451
+ if (t.status = le, V(e), t.pending !== 0)
1452
+ return t.last_flush = -1, B;
1453
+ }
1454
+ if (e.avail_in !== 0 || t.lookahead !== 0 || n !== ne && t.status !== Se) {
1455
+ let r = t.level === 0 ? hi(t, n) : t.strategy === We ? ua(t, n) : t.strategy === Gr ? fa(t, n) : Ne[t.level].func(t, n);
1456
+ if ((r === ue || r === ke) && (t.status = Se), r === U || r === ue)
1457
+ return e.avail_out === 0 && (t.last_flush = -1), B;
1458
+ if (r === ve && (n === Zr ? Pr(t) : n !== ln && (Rt(t, 0, 0, !1), n === xr && (J(t.head), t.lookahead === 0 && (t.strstart = 0, t.block_start = 0, t.insert = 0))), V(e), e.avail_out === 0))
1459
+ return t.last_flush = -1, B;
1460
+ }
1461
+ return n !== F ? B : t.wrap <= 0 ? fn : (t.wrap === 2 ? (A(t, e.adler & 255), A(t, e.adler >> 8 & 255), A(t, e.adler >> 16 & 255), A(t, e.adler >> 24 & 255), A(t, e.total_in & 255), A(t, e.total_in >> 8 & 255), A(t, e.total_in >> 16 & 255), A(t, e.total_in >> 24 & 255)) : (Ce(t, e.adler >>> 16), Ce(t, e.adler & 65535)), V(e), t.wrap > 0 && (t.wrap = -t.wrap), t.pending !== 0 ? B : fn);
1462
+ }, ba = (e) => {
1463
+ if (Me(e))
1464
+ return G;
1465
+ const n = e.state.status;
1466
+ return e.state = null, n === le ? fe(e, Mr) : B;
1467
+ }, ga = (e, n) => {
1468
+ let t = n.length;
1469
+ if (Me(e))
1470
+ return G;
1471
+ const i = e.state, r = i.wrap;
1472
+ if (r === 2 || r === 1 && i.status !== we || i.lookahead)
1473
+ return G;
1474
+ if (r === 1 && (e.adler = Ue(e.adler, n, t, 0)), i.wrap = 0, t >= i.w_size) {
1475
+ r === 0 && (J(i.head), i.strstart = 0, i.block_start = 0, i.insert = 0);
1476
+ let u = new Uint8Array(i.w_size);
1477
+ u.set(n.subarray(t - i.w_size, t), 0), n = u, t = i.w_size;
1478
+ }
1479
+ const a = e.avail_in, o = e.next_in, l = e.input;
1480
+ for (e.avail_in = t, e.next_in = 0, e.input = n, me(i); i.lookahead >= I; ) {
1481
+ let u = i.strstart, s = i.lookahead - (I - 1);
1482
+ do
1483
+ i.ins_h = ie(i, i.ins_h, i.window[u + I - 1]), i.prev[u & i.w_mask] = i.head[i.ins_h], i.head[i.ins_h] = u, u++;
1484
+ while (--s);
1485
+ i.strstart = u, i.lookahead = I - 1, me(i);
1486
+ }
1487
+ return i.strstart += i.lookahead, i.block_start = i.strstart, i.insert = i.lookahead, i.lookahead = 0, i.match_length = i.prev_length = I - 1, i.match_available = 0, e.next_in = o, e.input = l, e.avail_in = a, i.wrap = r, B;
1488
+ };
1489
+ var wa = pa, ma = pi, ya = di, va = ci, ka = da, $a = _a, Ea = ba, Ca = ga, Sa = "pako deflate (from Nodeca project)", Ie = {
1490
+ deflateInit: wa,
1491
+ deflateInit2: ma,
1492
+ deflateReset: ya,
1493
+ deflateResetKeep: va,
1494
+ deflateSetHeader: ka,
1495
+ deflate: $a,
1496
+ deflateEnd: Ea,
1497
+ deflateSetDictionary: Ca,
1498
+ deflateInfo: Sa
1499
+ };
1500
+ const Na = (e, n) => Object.prototype.hasOwnProperty.call(e, n);
1501
+ var Ta = function(e) {
1502
+ const n = Array.prototype.slice.call(arguments, 1);
1503
+ for (; n.length; ) {
1504
+ const t = n.shift();
1505
+ if (t) {
1506
+ if (typeof t != "object")
1507
+ throw new TypeError(t + "must be non-object");
1508
+ for (const i in t)
1509
+ Na(t, i) && (e[i] = t[i]);
1510
+ }
1511
+ }
1512
+ return e;
1513
+ }, Ia = (e) => {
1514
+ let n = 0;
1515
+ for (let i = 0, r = e.length; i < r; i++)
1516
+ n += e[i].length;
1517
+ const t = new Uint8Array(n);
1518
+ for (let i = 0, r = 0, a = e.length; i < a; i++) {
1519
+ let o = e[i];
1520
+ t.set(o, r), r += o.length;
1521
+ }
1522
+ return t;
1523
+ }, ht = {
1524
+ assign: Ta,
1525
+ flattenChunks: Ia
1526
+ };
1527
+ let _i = !0;
1528
+ try {
1529
+ String.fromCharCode.apply(null, new Uint8Array(1));
1530
+ } catch {
1531
+ _i = !1;
1532
+ }
1533
+ const De = new Uint8Array(256);
1534
+ for (let e = 0; e < 256; e++)
1535
+ De[e] = e >= 252 ? 6 : e >= 248 ? 5 : e >= 240 ? 4 : e >= 224 ? 3 : e >= 192 ? 2 : 1;
1536
+ De[254] = De[254] = 1;
1537
+ var Aa = (e) => {
1538
+ if (typeof TextEncoder == "function" && TextEncoder.prototype.encode)
1539
+ return new TextEncoder().encode(e);
1540
+ let n, t, i, r, a, o = e.length, l = 0;
1541
+ for (r = 0; r < o; r++)
1542
+ t = e.charCodeAt(r), (t & 64512) === 55296 && r + 1 < o && (i = e.charCodeAt(r + 1), (i & 64512) === 56320 && (t = 65536 + (t - 55296 << 10) + (i - 56320), r++)), l += t < 128 ? 1 : t < 2048 ? 2 : t < 65536 ? 3 : 4;
1543
+ for (n = new Uint8Array(l), a = 0, r = 0; a < l; r++)
1544
+ t = e.charCodeAt(r), (t & 64512) === 55296 && r + 1 < o && (i = e.charCodeAt(r + 1), (i & 64512) === 56320 && (t = 65536 + (t - 55296 << 10) + (i - 56320), r++)), t < 128 ? n[a++] = t : t < 2048 ? (n[a++] = 192 | t >>> 6, n[a++] = 128 | t & 63) : t < 65536 ? (n[a++] = 224 | t >>> 12, n[a++] = 128 | t >>> 6 & 63, n[a++] = 128 | t & 63) : (n[a++] = 240 | t >>> 18, n[a++] = 128 | t >>> 12 & 63, n[a++] = 128 | t >>> 6 & 63, n[a++] = 128 | t & 63);
1545
+ return n;
1546
+ };
1547
+ const Oa = (e, n) => {
1548
+ if (n < 65534 && e.subarray && _i)
1549
+ return String.fromCharCode.apply(null, e.length === n ? e : e.subarray(0, n));
1550
+ let t = "";
1551
+ for (let i = 0; i < n; i++)
1552
+ t += String.fromCharCode(e[i]);
1553
+ return t;
1554
+ };
1555
+ var za = (e, n) => {
1556
+ const t = n || e.length;
1557
+ if (typeof TextDecoder == "function" && TextDecoder.prototype.decode)
1558
+ return new TextDecoder().decode(e.subarray(0, n));
1559
+ let i, r;
1560
+ const a = new Array(t * 2);
1561
+ for (r = 0, i = 0; i < t; ) {
1562
+ let o = e[i++];
1563
+ if (o < 128) {
1564
+ a[r++] = o;
1565
+ continue;
1566
+ }
1567
+ let l = De[o];
1568
+ if (l > 4) {
1569
+ a[r++] = 65533, i += l - 1;
1570
+ continue;
1571
+ }
1572
+ for (o &= l === 2 ? 31 : l === 3 ? 15 : 7; l > 1 && i < t; )
1573
+ o = o << 6 | e[i++] & 63, l--;
1574
+ if (l > 1) {
1575
+ a[r++] = 65533;
1576
+ continue;
1577
+ }
1578
+ o < 65536 ? a[r++] = o : (o -= 65536, a[r++] = 55296 | o >> 10 & 1023, a[r++] = 56320 | o & 1023);
1579
+ }
1580
+ return Oa(a, r);
1581
+ }, Ra = (e, n) => {
1582
+ n = n || e.length, n > e.length && (n = e.length);
1583
+ let t = n - 1;
1584
+ for (; t >= 0 && (e[t] & 192) === 128; )
1585
+ t--;
1586
+ return t < 0 || t === 0 ? n : t + De[e[t]] > n ? t : n;
1587
+ }, Ve = {
1588
+ string2buf: Aa,
1589
+ buf2string: za,
1590
+ utf8border: Ra
1591
+ };
1592
+ function Ba() {
1593
+ 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;
1594
+ }
1595
+ var bi = Ba;
1596
+ const gi = Object.prototype.toString, {
1597
+ Z_NO_FLUSH: Ua,
1598
+ Z_SYNC_FLUSH: Da,
1599
+ Z_FULL_FLUSH: Va,
1600
+ Z_FINISH: La,
1601
+ Z_OK: rt,
1602
+ Z_STREAM_END: Fa,
1603
+ Z_DEFAULT_COMPRESSION: Pa,
1604
+ Z_DEFAULT_STRATEGY: Za,
1605
+ Z_DEFLATED: xa
1606
+ } = xe;
1607
+ function Yt(e) {
1608
+ this.options = ht.assign({
1609
+ level: Pa,
1610
+ method: xa,
1611
+ chunkSize: 16384,
1612
+ windowBits: 15,
1613
+ memLevel: 8,
1614
+ strategy: Za
1615
+ }, e || {});
1616
+ let n = this.options;
1617
+ n.raw && n.windowBits > 0 ? n.windowBits = -n.windowBits : n.gzip && n.windowBits > 0 && n.windowBits < 16 && (n.windowBits += 16), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new bi(), this.strm.avail_out = 0;
1618
+ let t = Ie.deflateInit2(
1619
+ this.strm,
1620
+ n.level,
1621
+ n.method,
1622
+ n.windowBits,
1623
+ n.memLevel,
1624
+ n.strategy
1625
+ );
1626
+ if (t !== rt)
1627
+ throw new Error(ge[t]);
1628
+ if (n.header && Ie.deflateSetHeader(this.strm, n.header), n.dictionary) {
1629
+ let i;
1630
+ if (typeof n.dictionary == "string" ? i = Ve.string2buf(n.dictionary) : gi.call(n.dictionary) === "[object ArrayBuffer]" ? i = new Uint8Array(n.dictionary) : i = n.dictionary, t = Ie.deflateSetDictionary(this.strm, i), t !== rt)
1631
+ throw new Error(ge[t]);
1632
+ this._dict_set = !0;
1633
+ }
1634
+ }
1635
+ Yt.prototype.push = function(e, n) {
1636
+ const t = this.strm, i = this.options.chunkSize;
1637
+ let r, a;
1638
+ if (this.ended)
1639
+ return !1;
1640
+ for (n === ~~n ? a = n : a = n === !0 ? La : Ua, typeof e == "string" ? t.input = Ve.string2buf(e) : gi.call(e) === "[object ArrayBuffer]" ? t.input = new Uint8Array(e) : t.input = e, t.next_in = 0, t.avail_in = t.input.length; ; ) {
1641
+ if (t.avail_out === 0 && (t.output = new Uint8Array(i), t.next_out = 0, t.avail_out = i), (a === Da || a === Va) && t.avail_out <= 6) {
1642
+ this.onData(t.output.subarray(0, t.next_out)), t.avail_out = 0;
1643
+ continue;
1644
+ }
1645
+ if (r = Ie.deflate(t, a), r === Fa)
1646
+ return t.next_out > 0 && this.onData(t.output.subarray(0, t.next_out)), r = Ie.deflateEnd(this.strm), this.onEnd(r), this.ended = !0, r === rt;
1647
+ if (t.avail_out === 0) {
1648
+ this.onData(t.output);
1649
+ continue;
1650
+ }
1651
+ if (a > 0 && t.next_out > 0) {
1652
+ this.onData(t.output.subarray(0, t.next_out)), t.avail_out = 0;
1653
+ continue;
1654
+ }
1655
+ if (t.avail_in === 0)
1656
+ break;
1657
+ }
1658
+ return !0;
1659
+ };
1660
+ Yt.prototype.onData = function(e) {
1661
+ this.chunks.push(e);
1662
+ };
1663
+ Yt.prototype.onEnd = function(e) {
1664
+ e === rt && (this.result = ht.flattenChunks(this.chunks)), this.chunks = [], this.err = e, this.msg = this.strm.msg;
1665
+ };
1666
+ const Xe = 16209, Ma = 16191;
1667
+ var Ha = function(n, t) {
1668
+ let i, r, a, o, l, u, s, f, d, c, h, _, g, k, y, E, C, p, $, S, b, w, m, v;
1669
+ const T = n.state;
1670
+ i = n.next_in, m = n.input, r = i + (n.avail_in - 5), a = n.next_out, v = n.output, o = a - (t - n.avail_out), l = a + (n.avail_out - 257), u = T.dmax, s = T.wsize, f = T.whave, d = T.wnext, c = T.window, h = T.hold, _ = T.bits, g = T.lencode, k = T.distcode, y = (1 << T.lenbits) - 1, E = (1 << T.distbits) - 1;
1671
+ e:
1672
+ do {
1673
+ _ < 15 && (h += m[i++] << _, _ += 8, h += m[i++] << _, _ += 8), C = g[h & y];
1674
+ t:
1675
+ for (; ; ) {
1676
+ if (p = C >>> 24, h >>>= p, _ -= p, p = C >>> 16 & 255, p === 0)
1677
+ v[a++] = C & 65535;
1678
+ else if (p & 16) {
1679
+ $ = C & 65535, p &= 15, p && (_ < p && (h += m[i++] << _, _ += 8), $ += h & (1 << p) - 1, h >>>= p, _ -= p), _ < 15 && (h += m[i++] << _, _ += 8, h += m[i++] << _, _ += 8), C = k[h & E];
1680
+ n:
1681
+ for (; ; ) {
1682
+ if (p = C >>> 24, h >>>= p, _ -= p, p = C >>> 16 & 255, p & 16) {
1683
+ if (S = C & 65535, p &= 15, _ < p && (h += m[i++] << _, _ += 8, _ < p && (h += m[i++] << _, _ += 8)), S += h & (1 << p) - 1, S > u) {
1684
+ n.msg = "invalid distance too far back", T.mode = Xe;
1685
+ break e;
1686
+ }
1687
+ if (h >>>= p, _ -= p, p = a - o, S > p) {
1688
+ if (p = S - p, p > f && T.sane) {
1689
+ n.msg = "invalid distance too far back", T.mode = Xe;
1690
+ break e;
1691
+ }
1692
+ if (b = 0, w = c, d === 0) {
1693
+ if (b += s - p, p < $) {
1694
+ $ -= p;
1695
+ do
1696
+ v[a++] = c[b++];
1697
+ while (--p);
1698
+ b = a - S, w = v;
1699
+ }
1700
+ } else if (d < p) {
1701
+ if (b += s + d - p, p -= d, p < $) {
1702
+ $ -= p;
1703
+ do
1704
+ v[a++] = c[b++];
1705
+ while (--p);
1706
+ if (b = 0, d < $) {
1707
+ p = d, $ -= p;
1708
+ do
1709
+ v[a++] = c[b++];
1710
+ while (--p);
1711
+ b = a - S, w = v;
1712
+ }
1713
+ }
1714
+ } else if (b += d - p, p < $) {
1715
+ $ -= p;
1716
+ do
1717
+ v[a++] = c[b++];
1718
+ while (--p);
1719
+ b = a - S, w = v;
1720
+ }
1721
+ for (; $ > 2; )
1722
+ v[a++] = w[b++], v[a++] = w[b++], v[a++] = w[b++], $ -= 3;
1723
+ $ && (v[a++] = w[b++], $ > 1 && (v[a++] = w[b++]));
1724
+ } else {
1725
+ b = a - S;
1726
+ do
1727
+ v[a++] = v[b++], v[a++] = v[b++], v[a++] = v[b++], $ -= 3;
1728
+ while ($ > 2);
1729
+ $ && (v[a++] = v[b++], $ > 1 && (v[a++] = v[b++]));
1730
+ }
1731
+ } else if (p & 64) {
1732
+ n.msg = "invalid distance code", T.mode = Xe;
1733
+ break e;
1734
+ } else {
1735
+ C = k[(C & 65535) + (h & (1 << p) - 1)];
1736
+ continue n;
1737
+ }
1738
+ break;
1739
+ }
1740
+ } else if (p & 64)
1741
+ if (p & 32) {
1742
+ T.mode = Ma;
1743
+ break e;
1744
+ } else {
1745
+ n.msg = "invalid literal/length code", T.mode = Xe;
1746
+ break e;
1747
+ }
1748
+ else {
1749
+ C = g[(C & 65535) + (h & (1 << p) - 1)];
1750
+ continue t;
1751
+ }
1752
+ break;
1753
+ }
1754
+ } while (i < r && a < l);
1755
+ $ = _ >> 3, i -= $, _ -= $ << 3, h &= (1 << _) - 1, n.next_in = i, n.next_out = a, n.avail_in = i < r ? 5 + (r - i) : 5 - (i - r), n.avail_out = a < l ? 257 + (l - a) : 257 - (a - l), T.hold = h, T.bits = _;
1756
+ };
1757
+ const pe = 15, hn = 852, cn = 592, dn = 0, mt = 1, pn = 2, ja = new Uint16Array([
1758
+ /* Length codes 257..285 base */
1759
+ 3,
1760
+ 4,
1761
+ 5,
1762
+ 6,
1763
+ 7,
1764
+ 8,
1765
+ 9,
1766
+ 10,
1767
+ 11,
1768
+ 13,
1769
+ 15,
1770
+ 17,
1771
+ 19,
1772
+ 23,
1773
+ 27,
1774
+ 31,
1775
+ 35,
1776
+ 43,
1777
+ 51,
1778
+ 59,
1779
+ 67,
1780
+ 83,
1781
+ 99,
1782
+ 115,
1783
+ 131,
1784
+ 163,
1785
+ 195,
1786
+ 227,
1787
+ 258,
1788
+ 0,
1789
+ 0
1790
+ ]), Ga = new Uint8Array([
1791
+ /* Length codes 257..285 extra */
1792
+ 16,
1793
+ 16,
1794
+ 16,
1795
+ 16,
1796
+ 16,
1797
+ 16,
1798
+ 16,
1799
+ 16,
1800
+ 17,
1801
+ 17,
1802
+ 17,
1803
+ 17,
1804
+ 18,
1805
+ 18,
1806
+ 18,
1807
+ 18,
1808
+ 19,
1809
+ 19,
1810
+ 19,
1811
+ 19,
1812
+ 20,
1813
+ 20,
1814
+ 20,
1815
+ 20,
1816
+ 21,
1817
+ 21,
1818
+ 21,
1819
+ 21,
1820
+ 16,
1821
+ 72,
1822
+ 78
1823
+ ]), Ya = new Uint16Array([
1824
+ /* Distance codes 0..29 base */
1825
+ 1,
1826
+ 2,
1827
+ 3,
1828
+ 4,
1829
+ 5,
1830
+ 7,
1831
+ 9,
1832
+ 13,
1833
+ 17,
1834
+ 25,
1835
+ 33,
1836
+ 49,
1837
+ 65,
1838
+ 97,
1839
+ 129,
1840
+ 193,
1841
+ 257,
1842
+ 385,
1843
+ 513,
1844
+ 769,
1845
+ 1025,
1846
+ 1537,
1847
+ 2049,
1848
+ 3073,
1849
+ 4097,
1850
+ 6145,
1851
+ 8193,
1852
+ 12289,
1853
+ 16385,
1854
+ 24577,
1855
+ 0,
1856
+ 0
1857
+ ]), Ka = new Uint8Array([
1858
+ /* Distance codes 0..29 extra */
1859
+ 16,
1860
+ 16,
1861
+ 16,
1862
+ 16,
1863
+ 17,
1864
+ 17,
1865
+ 18,
1866
+ 18,
1867
+ 19,
1868
+ 19,
1869
+ 20,
1870
+ 20,
1871
+ 21,
1872
+ 21,
1873
+ 22,
1874
+ 22,
1875
+ 23,
1876
+ 23,
1877
+ 24,
1878
+ 24,
1879
+ 25,
1880
+ 25,
1881
+ 26,
1882
+ 26,
1883
+ 27,
1884
+ 27,
1885
+ 28,
1886
+ 28,
1887
+ 29,
1888
+ 29,
1889
+ 64,
1890
+ 64
1891
+ ]), Wa = (e, n, t, i, r, a, o, l) => {
1892
+ const u = l.bits;
1893
+ let s = 0, f = 0, d = 0, c = 0, h = 0, _ = 0, g = 0, k = 0, y = 0, E = 0, C, p, $, S, b, w = null, m;
1894
+ const v = new Uint16Array(pe + 1), T = new Uint16Array(pe + 1);
1895
+ let ae = null, Qt, je, Ge;
1896
+ for (s = 0; s <= pe; s++)
1897
+ v[s] = 0;
1898
+ for (f = 0; f < i; f++)
1899
+ v[n[t + f]]++;
1900
+ for (h = u, c = pe; c >= 1 && v[c] === 0; c--)
1901
+ ;
1902
+ if (h > c && (h = c), c === 0)
1903
+ return r[a++] = 1 << 24 | 64 << 16 | 0, r[a++] = 1 << 24 | 64 << 16 | 0, l.bits = 1, 0;
1904
+ for (d = 1; d < c && v[d] === 0; d++)
1905
+ ;
1906
+ for (h < d && (h = d), k = 1, s = 1; s <= pe; s++)
1907
+ if (k <<= 1, k -= v[s], k < 0)
1908
+ return -1;
1909
+ if (k > 0 && (e === dn || c !== 1))
1910
+ return -1;
1911
+ for (T[1] = 0, s = 1; s < pe; s++)
1912
+ T[s + 1] = T[s] + v[s];
1913
+ for (f = 0; f < i; f++)
1914
+ n[t + f] !== 0 && (o[T[n[t + f]]++] = f);
1915
+ if (e === dn ? (w = ae = o, m = 20) : e === mt ? (w = ja, ae = Ga, m = 257) : (w = Ya, ae = Ka, m = 0), E = 0, f = 0, s = d, b = a, _ = h, g = 0, $ = -1, y = 1 << h, S = y - 1, e === mt && y > hn || e === pn && y > cn)
1916
+ return 1;
1917
+ for (; ; ) {
1918
+ Qt = s - g, o[f] + 1 < m ? (je = 0, Ge = o[f]) : o[f] >= m ? (je = ae[o[f] - m], Ge = w[o[f] - m]) : (je = 32 + 64, Ge = 0), C = 1 << s - g, p = 1 << _, d = p;
1919
+ do
1920
+ p -= C, r[b + (E >> g) + p] = Qt << 24 | je << 16 | Ge | 0;
1921
+ while (p !== 0);
1922
+ for (C = 1 << s - 1; E & C; )
1923
+ C >>= 1;
1924
+ if (C !== 0 ? (E &= C - 1, E += C) : E = 0, f++, --v[s] === 0) {
1925
+ if (s === c)
1926
+ break;
1927
+ s = n[t + o[f]];
1928
+ }
1929
+ if (s > h && (E & S) !== $) {
1930
+ for (g === 0 && (g = h), b += d, _ = s - g, k = 1 << _; _ + g < c && (k -= v[_ + g], !(k <= 0)); )
1931
+ _++, k <<= 1;
1932
+ if (y += 1 << _, e === mt && y > hn || e === pn && y > cn)
1933
+ return 1;
1934
+ $ = E & S, r[$] = h << 24 | _ << 16 | b - a | 0;
1935
+ }
1936
+ }
1937
+ return E !== 0 && (r[b + E] = s - g << 24 | 64 << 16 | 0), l.bits = h, 0;
1938
+ };
1939
+ var Ae = Wa;
1940
+ const Xa = 0, wi = 1, mi = 2, {
1941
+ Z_FINISH: _n,
1942
+ Z_BLOCK: qa,
1943
+ Z_TREES: qe,
1944
+ Z_OK: he,
1945
+ Z_STREAM_END: Ja,
1946
+ Z_NEED_DICT: Qa,
1947
+ Z_STREAM_ERROR: P,
1948
+ Z_DATA_ERROR: yi,
1949
+ Z_MEM_ERROR: vi,
1950
+ Z_BUF_ERROR: eo,
1951
+ Z_DEFLATED: bn
1952
+ } = xe, ct = 16180, gn = 16181, wn = 16182, mn = 16183, yn = 16184, vn = 16185, kn = 16186, $n = 16187, En = 16188, Cn = 16189, at = 16190, K = 16191, yt = 16192, Sn = 16193, vt = 16194, Nn = 16195, Tn = 16196, In = 16197, An = 16198, Je = 16199, Qe = 16200, On = 16201, zn = 16202, Rn = 16203, Bn = 16204, Un = 16205, kt = 16206, Dn = 16207, Vn = 16208, O = 16209, ki = 16210, $i = 16211, to = 852, no = 592, io = 15, ro = io, Ln = (e) => (e >>> 24 & 255) + (e >>> 8 & 65280) + ((e & 65280) << 8) + ((e & 255) << 24);
1953
+ function ao() {
1954
+ this.strm = null, 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 Uint16Array(320), this.work = new Uint16Array(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0;
1955
+ }
1956
+ const ce = (e) => {
1957
+ if (!e)
1958
+ return 1;
1959
+ const n = e.state;
1960
+ return !n || n.strm !== e || n.mode < ct || n.mode > $i ? 1 : 0;
1961
+ }, Ei = (e) => {
1962
+ if (ce(e))
1963
+ return P;
1964
+ const n = e.state;
1965
+ return e.total_in = e.total_out = n.total = 0, e.msg = "", n.wrap && (e.adler = n.wrap & 1), n.mode = ct, n.last = 0, n.havedict = 0, n.flags = -1, n.dmax = 32768, n.head = null, n.hold = 0, n.bits = 0, n.lencode = n.lendyn = new Int32Array(to), n.distcode = n.distdyn = new Int32Array(no), n.sane = 1, n.back = -1, he;
1966
+ }, Ci = (e) => {
1967
+ if (ce(e))
1968
+ return P;
1969
+ const n = e.state;
1970
+ return n.wsize = 0, n.whave = 0, n.wnext = 0, Ei(e);
1971
+ }, Si = (e, n) => {
1972
+ let t;
1973
+ if (ce(e))
1974
+ return P;
1975
+ const i = e.state;
1976
+ return n < 0 ? (t = 0, n = -n) : (t = (n >> 4) + 5, n < 48 && (n &= 15)), n && (n < 8 || n > 15) ? P : (i.window !== null && i.wbits !== n && (i.window = null), i.wrap = t, i.wbits = n, Ci(e));
1977
+ }, Ni = (e, n) => {
1978
+ if (!e)
1979
+ return P;
1980
+ const t = new ao();
1981
+ e.state = t, t.strm = e, t.window = null, t.mode = ct;
1982
+ const i = Si(e, n);
1983
+ return i !== he && (e.state = null), i;
1984
+ }, oo = (e) => Ni(e, ro);
1985
+ let Fn = !0, $t, Et;
1986
+ const so = (e) => {
1987
+ if (Fn) {
1988
+ $t = new Int32Array(512), Et = new Int32Array(32);
1989
+ let n = 0;
1990
+ for (; n < 144; )
1991
+ e.lens[n++] = 8;
1992
+ for (; n < 256; )
1993
+ e.lens[n++] = 9;
1994
+ for (; n < 280; )
1995
+ e.lens[n++] = 7;
1996
+ for (; n < 288; )
1997
+ e.lens[n++] = 8;
1998
+ for (Ae(wi, e.lens, 0, 288, $t, 0, e.work, { bits: 9 }), n = 0; n < 32; )
1999
+ e.lens[n++] = 5;
2000
+ Ae(mi, e.lens, 0, 32, Et, 0, e.work, { bits: 5 }), Fn = !1;
2001
+ }
2002
+ e.lencode = $t, e.lenbits = 9, e.distcode = Et, e.distbits = 5;
2003
+ }, Ti = (e, n, t, i) => {
2004
+ let r;
2005
+ const a = e.state;
2006
+ return a.window === null && (a.wsize = 1 << a.wbits, a.wnext = 0, a.whave = 0, a.window = new Uint8Array(a.wsize)), i >= a.wsize ? (a.window.set(n.subarray(t - a.wsize, t), 0), a.wnext = 0, a.whave = a.wsize) : (r = a.wsize - a.wnext, r > i && (r = i), a.window.set(n.subarray(t - i, t - i + r), a.wnext), i -= r, i ? (a.window.set(n.subarray(t - i, t), 0), a.wnext = i, a.whave = a.wsize) : (a.wnext += r, a.wnext === a.wsize && (a.wnext = 0), a.whave < a.wsize && (a.whave += r))), 0;
2007
+ }, lo = (e, n) => {
2008
+ let t, i, r, a, o, l, u, s, f, d, c, h, _, g, k = 0, y, E, C, p, $, S, b, w;
2009
+ const m = new Uint8Array(4);
2010
+ let v, T;
2011
+ const ae = (
2012
+ /* permutation of code lengths */
2013
+ new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15])
2014
+ );
2015
+ if (ce(e) || !e.output || !e.input && e.avail_in !== 0)
2016
+ return P;
2017
+ t = e.state, t.mode === K && (t.mode = yt), o = e.next_out, r = e.output, u = e.avail_out, a = e.next_in, i = e.input, l = e.avail_in, s = t.hold, f = t.bits, d = l, c = u, w = he;
2018
+ e:
2019
+ for (; ; )
2020
+ switch (t.mode) {
2021
+ case ct:
2022
+ if (t.wrap === 0) {
2023
+ t.mode = yt;
2024
+ break;
2025
+ }
2026
+ for (; f < 16; ) {
2027
+ if (l === 0)
2028
+ break e;
2029
+ l--, s += i[a++] << f, f += 8;
2030
+ }
2031
+ if (t.wrap & 2 && s === 35615) {
2032
+ t.wbits === 0 && (t.wbits = 15), t.check = 0, m[0] = s & 255, m[1] = s >>> 8 & 255, t.check = R(t.check, m, 2, 0), s = 0, f = 0, t.mode = gn;
2033
+ break;
2034
+ }
2035
+ if (t.head && (t.head.done = !1), !(t.wrap & 1) || /* check if zlib header allowed */
2036
+ (((s & 255) << 8) + (s >> 8)) % 31) {
2037
+ e.msg = "incorrect header check", t.mode = O;
2038
+ break;
2039
+ }
2040
+ if ((s & 15) !== bn) {
2041
+ e.msg = "unknown compression method", t.mode = O;
2042
+ break;
2043
+ }
2044
+ if (s >>>= 4, f -= 4, b = (s & 15) + 8, t.wbits === 0 && (t.wbits = b), b > 15 || b > t.wbits) {
2045
+ e.msg = "invalid window size", t.mode = O;
2046
+ break;
2047
+ }
2048
+ t.dmax = 1 << t.wbits, t.flags = 0, e.adler = t.check = 1, t.mode = s & 512 ? Cn : K, s = 0, f = 0;
2049
+ break;
2050
+ case gn:
2051
+ for (; f < 16; ) {
2052
+ if (l === 0)
2053
+ break e;
2054
+ l--, s += i[a++] << f, f += 8;
2055
+ }
2056
+ if (t.flags = s, (t.flags & 255) !== bn) {
2057
+ e.msg = "unknown compression method", t.mode = O;
2058
+ break;
2059
+ }
2060
+ if (t.flags & 57344) {
2061
+ e.msg = "unknown header flags set", t.mode = O;
2062
+ break;
2063
+ }
2064
+ t.head && (t.head.text = s >> 8 & 1), t.flags & 512 && t.wrap & 4 && (m[0] = s & 255, m[1] = s >>> 8 & 255, t.check = R(t.check, m, 2, 0)), s = 0, f = 0, t.mode = wn;
2065
+ case wn:
2066
+ for (; f < 32; ) {
2067
+ if (l === 0)
2068
+ break e;
2069
+ l--, s += i[a++] << f, f += 8;
2070
+ }
2071
+ t.head && (t.head.time = s), t.flags & 512 && t.wrap & 4 && (m[0] = s & 255, m[1] = s >>> 8 & 255, m[2] = s >>> 16 & 255, m[3] = s >>> 24 & 255, t.check = R(t.check, m, 4, 0)), s = 0, f = 0, t.mode = mn;
2072
+ case mn:
2073
+ for (; f < 16; ) {
2074
+ if (l === 0)
2075
+ break e;
2076
+ l--, s += i[a++] << f, f += 8;
2077
+ }
2078
+ t.head && (t.head.xflags = s & 255, t.head.os = s >> 8), t.flags & 512 && t.wrap & 4 && (m[0] = s & 255, m[1] = s >>> 8 & 255, t.check = R(t.check, m, 2, 0)), s = 0, f = 0, t.mode = yn;
2079
+ case yn:
2080
+ if (t.flags & 1024) {
2081
+ for (; f < 16; ) {
2082
+ if (l === 0)
2083
+ break e;
2084
+ l--, s += i[a++] << f, f += 8;
2085
+ }
2086
+ t.length = s, t.head && (t.head.extra_len = s), t.flags & 512 && t.wrap & 4 && (m[0] = s & 255, m[1] = s >>> 8 & 255, t.check = R(t.check, m, 2, 0)), s = 0, f = 0;
2087
+ } else
2088
+ t.head && (t.head.extra = null);
2089
+ t.mode = vn;
2090
+ case vn:
2091
+ if (t.flags & 1024 && (h = t.length, h > l && (h = l), h && (t.head && (b = t.head.extra_len - t.length, t.head.extra || (t.head.extra = new Uint8Array(t.head.extra_len)), t.head.extra.set(
2092
+ i.subarray(
2093
+ a,
2094
+ // extra field is limited to 65536 bytes
2095
+ // - no need for additional size check
2096
+ a + h
2097
+ ),
2098
+ /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
2099
+ b
2100
+ )), t.flags & 512 && t.wrap & 4 && (t.check = R(t.check, i, h, a)), l -= h, a += h, t.length -= h), t.length))
2101
+ break e;
2102
+ t.length = 0, t.mode = kn;
2103
+ case kn:
2104
+ if (t.flags & 2048) {
2105
+ if (l === 0)
2106
+ break e;
2107
+ h = 0;
2108
+ do
2109
+ b = i[a + h++], t.head && b && t.length < 65536 && (t.head.name += String.fromCharCode(b));
2110
+ while (b && h < l);
2111
+ if (t.flags & 512 && t.wrap & 4 && (t.check = R(t.check, i, h, a)), l -= h, a += h, b)
2112
+ break e;
2113
+ } else
2114
+ t.head && (t.head.name = null);
2115
+ t.length = 0, t.mode = $n;
2116
+ case $n:
2117
+ if (t.flags & 4096) {
2118
+ if (l === 0)
2119
+ break e;
2120
+ h = 0;
2121
+ do
2122
+ b = i[a + h++], t.head && b && t.length < 65536 && (t.head.comment += String.fromCharCode(b));
2123
+ while (b && h < l);
2124
+ if (t.flags & 512 && t.wrap & 4 && (t.check = R(t.check, i, h, a)), l -= h, a += h, b)
2125
+ break e;
2126
+ } else
2127
+ t.head && (t.head.comment = null);
2128
+ t.mode = En;
2129
+ case En:
2130
+ if (t.flags & 512) {
2131
+ for (; f < 16; ) {
2132
+ if (l === 0)
2133
+ break e;
2134
+ l--, s += i[a++] << f, f += 8;
2135
+ }
2136
+ if (t.wrap & 4 && s !== (t.check & 65535)) {
2137
+ e.msg = "header crc mismatch", t.mode = O;
2138
+ break;
2139
+ }
2140
+ s = 0, f = 0;
2141
+ }
2142
+ t.head && (t.head.hcrc = t.flags >> 9 & 1, t.head.done = !0), e.adler = t.check = 0, t.mode = K;
2143
+ break;
2144
+ case Cn:
2145
+ for (; f < 32; ) {
2146
+ if (l === 0)
2147
+ break e;
2148
+ l--, s += i[a++] << f, f += 8;
2149
+ }
2150
+ e.adler = t.check = Ln(s), s = 0, f = 0, t.mode = at;
2151
+ case at:
2152
+ if (t.havedict === 0)
2153
+ return e.next_out = o, e.avail_out = u, e.next_in = a, e.avail_in = l, t.hold = s, t.bits = f, Qa;
2154
+ e.adler = t.check = 1, t.mode = K;
2155
+ case K:
2156
+ if (n === qa || n === qe)
2157
+ break e;
2158
+ case yt:
2159
+ if (t.last) {
2160
+ s >>>= f & 7, f -= f & 7, t.mode = kt;
2161
+ break;
2162
+ }
2163
+ for (; f < 3; ) {
2164
+ if (l === 0)
2165
+ break e;
2166
+ l--, s += i[a++] << f, f += 8;
2167
+ }
2168
+ switch (t.last = s & 1, s >>>= 1, f -= 1, s & 3) {
2169
+ case 0:
2170
+ t.mode = Sn;
2171
+ break;
2172
+ case 1:
2173
+ if (so(t), t.mode = Je, n === qe) {
2174
+ s >>>= 2, f -= 2;
2175
+ break e;
2176
+ }
2177
+ break;
2178
+ case 2:
2179
+ t.mode = Tn;
2180
+ break;
2181
+ case 3:
2182
+ e.msg = "invalid block type", t.mode = O;
2183
+ }
2184
+ s >>>= 2, f -= 2;
2185
+ break;
2186
+ case Sn:
2187
+ for (s >>>= f & 7, f -= f & 7; f < 32; ) {
2188
+ if (l === 0)
2189
+ break e;
2190
+ l--, s += i[a++] << f, f += 8;
2191
+ }
2192
+ if ((s & 65535) !== (s >>> 16 ^ 65535)) {
2193
+ e.msg = "invalid stored block lengths", t.mode = O;
2194
+ break;
2195
+ }
2196
+ if (t.length = s & 65535, s = 0, f = 0, t.mode = vt, n === qe)
2197
+ break e;
2198
+ case vt:
2199
+ t.mode = Nn;
2200
+ case Nn:
2201
+ if (h = t.length, h) {
2202
+ if (h > l && (h = l), h > u && (h = u), h === 0)
2203
+ break e;
2204
+ r.set(i.subarray(a, a + h), o), l -= h, a += h, u -= h, o += h, t.length -= h;
2205
+ break;
2206
+ }
2207
+ t.mode = K;
2208
+ break;
2209
+ case Tn:
2210
+ for (; f < 14; ) {
2211
+ if (l === 0)
2212
+ break e;
2213
+ l--, s += i[a++] << f, f += 8;
2214
+ }
2215
+ if (t.nlen = (s & 31) + 257, s >>>= 5, f -= 5, t.ndist = (s & 31) + 1, s >>>= 5, f -= 5, t.ncode = (s & 15) + 4, s >>>= 4, f -= 4, t.nlen > 286 || t.ndist > 30) {
2216
+ e.msg = "too many length or distance symbols", t.mode = O;
2217
+ break;
2218
+ }
2219
+ t.have = 0, t.mode = In;
2220
+ case In:
2221
+ for (; t.have < t.ncode; ) {
2222
+ for (; f < 3; ) {
2223
+ if (l === 0)
2224
+ break e;
2225
+ l--, s += i[a++] << f, f += 8;
2226
+ }
2227
+ t.lens[ae[t.have++]] = s & 7, s >>>= 3, f -= 3;
2228
+ }
2229
+ for (; t.have < 19; )
2230
+ t.lens[ae[t.have++]] = 0;
2231
+ if (t.lencode = t.lendyn, t.lenbits = 7, v = { bits: t.lenbits }, w = Ae(Xa, t.lens, 0, 19, t.lencode, 0, t.work, v), t.lenbits = v.bits, w) {
2232
+ e.msg = "invalid code lengths set", t.mode = O;
2233
+ break;
2234
+ }
2235
+ t.have = 0, t.mode = An;
2236
+ case An:
2237
+ for (; t.have < t.nlen + t.ndist; ) {
2238
+ for (; k = t.lencode[s & (1 << t.lenbits) - 1], y = k >>> 24, E = k >>> 16 & 255, C = k & 65535, !(y <= f); ) {
2239
+ if (l === 0)
2240
+ break e;
2241
+ l--, s += i[a++] << f, f += 8;
2242
+ }
2243
+ if (C < 16)
2244
+ s >>>= y, f -= y, t.lens[t.have++] = C;
2245
+ else {
2246
+ if (C === 16) {
2247
+ for (T = y + 2; f < T; ) {
2248
+ if (l === 0)
2249
+ break e;
2250
+ l--, s += i[a++] << f, f += 8;
2251
+ }
2252
+ if (s >>>= y, f -= y, t.have === 0) {
2253
+ e.msg = "invalid bit length repeat", t.mode = O;
2254
+ break;
2255
+ }
2256
+ b = t.lens[t.have - 1], h = 3 + (s & 3), s >>>= 2, f -= 2;
2257
+ } else if (C === 17) {
2258
+ for (T = y + 3; f < T; ) {
2259
+ if (l === 0)
2260
+ break e;
2261
+ l--, s += i[a++] << f, f += 8;
2262
+ }
2263
+ s >>>= y, f -= y, b = 0, h = 3 + (s & 7), s >>>= 3, f -= 3;
2264
+ } else {
2265
+ for (T = y + 7; f < T; ) {
2266
+ if (l === 0)
2267
+ break e;
2268
+ l--, s += i[a++] << f, f += 8;
2269
+ }
2270
+ s >>>= y, f -= y, b = 0, h = 11 + (s & 127), s >>>= 7, f -= 7;
2271
+ }
2272
+ if (t.have + h > t.nlen + t.ndist) {
2273
+ e.msg = "invalid bit length repeat", t.mode = O;
2274
+ break;
2275
+ }
2276
+ for (; h--; )
2277
+ t.lens[t.have++] = b;
2278
+ }
2279
+ }
2280
+ if (t.mode === O)
2281
+ break;
2282
+ if (t.lens[256] === 0) {
2283
+ e.msg = "invalid code -- missing end-of-block", t.mode = O;
2284
+ break;
2285
+ }
2286
+ if (t.lenbits = 9, v = { bits: t.lenbits }, w = Ae(wi, t.lens, 0, t.nlen, t.lencode, 0, t.work, v), t.lenbits = v.bits, w) {
2287
+ e.msg = "invalid literal/lengths set", t.mode = O;
2288
+ break;
2289
+ }
2290
+ if (t.distbits = 6, t.distcode = t.distdyn, v = { bits: t.distbits }, w = Ae(mi, t.lens, t.nlen, t.ndist, t.distcode, 0, t.work, v), t.distbits = v.bits, w) {
2291
+ e.msg = "invalid distances set", t.mode = O;
2292
+ break;
2293
+ }
2294
+ if (t.mode = Je, n === qe)
2295
+ break e;
2296
+ case Je:
2297
+ t.mode = Qe;
2298
+ case Qe:
2299
+ if (l >= 6 && u >= 258) {
2300
+ e.next_out = o, e.avail_out = u, e.next_in = a, e.avail_in = l, t.hold = s, t.bits = f, Ha(e, c), o = e.next_out, r = e.output, u = e.avail_out, a = e.next_in, i = e.input, l = e.avail_in, s = t.hold, f = t.bits, t.mode === K && (t.back = -1);
2301
+ break;
2302
+ }
2303
+ for (t.back = 0; k = t.lencode[s & (1 << t.lenbits) - 1], y = k >>> 24, E = k >>> 16 & 255, C = k & 65535, !(y <= f); ) {
2304
+ if (l === 0)
2305
+ break e;
2306
+ l--, s += i[a++] << f, f += 8;
2307
+ }
2308
+ if (E && !(E & 240)) {
2309
+ for (p = y, $ = E, S = C; k = t.lencode[S + ((s & (1 << p + $) - 1) >> p)], y = k >>> 24, E = k >>> 16 & 255, C = k & 65535, !(p + y <= f); ) {
2310
+ if (l === 0)
2311
+ break e;
2312
+ l--, s += i[a++] << f, f += 8;
2313
+ }
2314
+ s >>>= p, f -= p, t.back += p;
2315
+ }
2316
+ if (s >>>= y, f -= y, t.back += y, t.length = C, E === 0) {
2317
+ t.mode = Un;
2318
+ break;
2319
+ }
2320
+ if (E & 32) {
2321
+ t.back = -1, t.mode = K;
2322
+ break;
2323
+ }
2324
+ if (E & 64) {
2325
+ e.msg = "invalid literal/length code", t.mode = O;
2326
+ break;
2327
+ }
2328
+ t.extra = E & 15, t.mode = On;
2329
+ case On:
2330
+ if (t.extra) {
2331
+ for (T = t.extra; f < T; ) {
2332
+ if (l === 0)
2333
+ break e;
2334
+ l--, s += i[a++] << f, f += 8;
2335
+ }
2336
+ t.length += s & (1 << t.extra) - 1, s >>>= t.extra, f -= t.extra, t.back += t.extra;
2337
+ }
2338
+ t.was = t.length, t.mode = zn;
2339
+ case zn:
2340
+ for (; k = t.distcode[s & (1 << t.distbits) - 1], y = k >>> 24, E = k >>> 16 & 255, C = k & 65535, !(y <= f); ) {
2341
+ if (l === 0)
2342
+ break e;
2343
+ l--, s += i[a++] << f, f += 8;
2344
+ }
2345
+ if (!(E & 240)) {
2346
+ for (p = y, $ = E, S = C; k = t.distcode[S + ((s & (1 << p + $) - 1) >> p)], y = k >>> 24, E = k >>> 16 & 255, C = k & 65535, !(p + y <= f); ) {
2347
+ if (l === 0)
2348
+ break e;
2349
+ l--, s += i[a++] << f, f += 8;
2350
+ }
2351
+ s >>>= p, f -= p, t.back += p;
2352
+ }
2353
+ if (s >>>= y, f -= y, t.back += y, E & 64) {
2354
+ e.msg = "invalid distance code", t.mode = O;
2355
+ break;
2356
+ }
2357
+ t.offset = C, t.extra = E & 15, t.mode = Rn;
2358
+ case Rn:
2359
+ if (t.extra) {
2360
+ for (T = t.extra; f < T; ) {
2361
+ if (l === 0)
2362
+ break e;
2363
+ l--, s += i[a++] << f, f += 8;
2364
+ }
2365
+ t.offset += s & (1 << t.extra) - 1, s >>>= t.extra, f -= t.extra, t.back += t.extra;
2366
+ }
2367
+ if (t.offset > t.dmax) {
2368
+ e.msg = "invalid distance too far back", t.mode = O;
2369
+ break;
2370
+ }
2371
+ t.mode = Bn;
2372
+ case Bn:
2373
+ if (u === 0)
2374
+ break e;
2375
+ if (h = c - u, t.offset > h) {
2376
+ if (h = t.offset - h, h > t.whave && t.sane) {
2377
+ e.msg = "invalid distance too far back", t.mode = O;
2378
+ break;
2379
+ }
2380
+ h > t.wnext ? (h -= t.wnext, _ = t.wsize - h) : _ = t.wnext - h, h > t.length && (h = t.length), g = t.window;
2381
+ } else
2382
+ g = r, _ = o - t.offset, h = t.length;
2383
+ h > u && (h = u), u -= h, t.length -= h;
2384
+ do
2385
+ r[o++] = g[_++];
2386
+ while (--h);
2387
+ t.length === 0 && (t.mode = Qe);
2388
+ break;
2389
+ case Un:
2390
+ if (u === 0)
2391
+ break e;
2392
+ r[o++] = t.length, u--, t.mode = Qe;
2393
+ break;
2394
+ case kt:
2395
+ if (t.wrap) {
2396
+ for (; f < 32; ) {
2397
+ if (l === 0)
2398
+ break e;
2399
+ l--, s |= i[a++] << f, f += 8;
2400
+ }
2401
+ if (c -= u, e.total_out += c, t.total += c, t.wrap & 4 && c && (e.adler = t.check = /*UPDATE_CHECK(state.check, put - _out, _out);*/
2402
+ t.flags ? R(t.check, r, c, o - c) : Ue(t.check, r, c, o - c)), c = u, t.wrap & 4 && (t.flags ? s : Ln(s)) !== t.check) {
2403
+ e.msg = "incorrect data check", t.mode = O;
2404
+ break;
2405
+ }
2406
+ s = 0, f = 0;
2407
+ }
2408
+ t.mode = Dn;
2409
+ case Dn:
2410
+ if (t.wrap && t.flags) {
2411
+ for (; f < 32; ) {
2412
+ if (l === 0)
2413
+ break e;
2414
+ l--, s += i[a++] << f, f += 8;
2415
+ }
2416
+ if (t.wrap & 4 && s !== (t.total & 4294967295)) {
2417
+ e.msg = "incorrect length check", t.mode = O;
2418
+ break;
2419
+ }
2420
+ s = 0, f = 0;
2421
+ }
2422
+ t.mode = Vn;
2423
+ case Vn:
2424
+ w = Ja;
2425
+ break e;
2426
+ case O:
2427
+ w = yi;
2428
+ break e;
2429
+ case ki:
2430
+ return vi;
2431
+ case $i:
2432
+ default:
2433
+ return P;
2434
+ }
2435
+ return e.next_out = o, e.avail_out = u, e.next_in = a, e.avail_in = l, t.hold = s, t.bits = f, (t.wsize || c !== e.avail_out && t.mode < O && (t.mode < kt || n !== _n)) && Ti(e, e.output, e.next_out, c - e.avail_out), d -= e.avail_in, c -= e.avail_out, e.total_in += d, e.total_out += c, t.total += c, t.wrap & 4 && c && (e.adler = t.check = /*UPDATE_CHECK(state.check, strm.next_out - _out, _out);*/
2436
+ t.flags ? R(t.check, r, c, e.next_out - c) : Ue(t.check, r, c, e.next_out - c)), e.data_type = t.bits + (t.last ? 64 : 0) + (t.mode === K ? 128 : 0) + (t.mode === Je || t.mode === vt ? 256 : 0), (d === 0 && c === 0 || n === _n) && w === he && (w = eo), w;
2437
+ }, fo = (e) => {
2438
+ if (ce(e))
2439
+ return P;
2440
+ let n = e.state;
2441
+ return n.window && (n.window = null), e.state = null, he;
2442
+ }, uo = (e, n) => {
2443
+ if (ce(e))
2444
+ return P;
2445
+ const t = e.state;
2446
+ return t.wrap & 2 ? (t.head = n, n.done = !1, he) : P;
2447
+ }, ho = (e, n) => {
2448
+ const t = n.length;
2449
+ let i, r, a;
2450
+ return ce(e) || (i = e.state, i.wrap !== 0 && i.mode !== at) ? P : i.mode === at && (r = 1, r = Ue(r, n, t, 0), r !== i.check) ? yi : (a = Ti(e, n, t, t), a ? (i.mode = ki, vi) : (i.havedict = 1, he));
2451
+ };
2452
+ var co = Ci, po = Si, _o = Ei, bo = oo, go = Ni, wo = lo, mo = fo, yo = uo, vo = ho, ko = "pako inflate (from Nodeca project)", X = {
2453
+ inflateReset: co,
2454
+ inflateReset2: po,
2455
+ inflateResetKeep: _o,
2456
+ inflateInit: bo,
2457
+ inflateInit2: go,
2458
+ inflate: wo,
2459
+ inflateEnd: mo,
2460
+ inflateGetHeader: yo,
2461
+ inflateSetDictionary: vo,
2462
+ inflateInfo: ko
2463
+ };
2464
+ function $o() {
2465
+ 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;
2466
+ }
2467
+ var Eo = $o;
2468
+ const Ii = Object.prototype.toString, {
2469
+ Z_NO_FLUSH: Co,
2470
+ Z_FINISH: So,
2471
+ Z_OK: Le,
2472
+ Z_STREAM_END: Ct,
2473
+ Z_NEED_DICT: St,
2474
+ Z_STREAM_ERROR: No,
2475
+ Z_DATA_ERROR: Pn,
2476
+ Z_MEM_ERROR: To
2477
+ } = xe;
2478
+ function He(e) {
2479
+ this.options = ht.assign({
2480
+ chunkSize: 1024 * 64,
2481
+ windowBits: 15,
2482
+ to: ""
2483
+ }, e || {});
2484
+ const n = this.options;
2485
+ n.raw && n.windowBits >= 0 && n.windowBits < 16 && (n.windowBits = -n.windowBits, n.windowBits === 0 && (n.windowBits = -15)), n.windowBits >= 0 && n.windowBits < 16 && !(e && e.windowBits) && (n.windowBits += 32), n.windowBits > 15 && n.windowBits < 48 && (n.windowBits & 15 || (n.windowBits |= 15)), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new bi(), this.strm.avail_out = 0;
2486
+ let t = X.inflateInit2(
2487
+ this.strm,
2488
+ n.windowBits
2489
+ );
2490
+ if (t !== Le)
2491
+ throw new Error(ge[t]);
2492
+ if (this.header = new Eo(), X.inflateGetHeader(this.strm, this.header), n.dictionary && (typeof n.dictionary == "string" ? n.dictionary = Ve.string2buf(n.dictionary) : Ii.call(n.dictionary) === "[object ArrayBuffer]" && (n.dictionary = new Uint8Array(n.dictionary)), n.raw && (t = X.inflateSetDictionary(this.strm, n.dictionary), t !== Le)))
2493
+ throw new Error(ge[t]);
2494
+ }
2495
+ He.prototype.push = function(e, n) {
2496
+ const t = this.strm, i = this.options.chunkSize, r = this.options.dictionary;
2497
+ let a, o, l;
2498
+ if (this.ended)
2499
+ return !1;
2500
+ for (n === ~~n ? o = n : o = n === !0 ? So : Co, Ii.call(e) === "[object ArrayBuffer]" ? t.input = new Uint8Array(e) : t.input = e, t.next_in = 0, t.avail_in = t.input.length; ; ) {
2501
+ for (t.avail_out === 0 && (t.output = new Uint8Array(i), t.next_out = 0, t.avail_out = i), a = X.inflate(t, o), a === St && r && (a = X.inflateSetDictionary(t, r), a === Le ? a = X.inflate(t, o) : a === Pn && (a = St)); t.avail_in > 0 && a === Ct && t.state.wrap > 0 && e[t.next_in] !== 0; )
2502
+ X.inflateReset(t), a = X.inflate(t, o);
2503
+ switch (a) {
2504
+ case No:
2505
+ case Pn:
2506
+ case St:
2507
+ case To:
2508
+ return this.onEnd(a), this.ended = !0, !1;
2509
+ }
2510
+ if (l = t.avail_out, t.next_out && (t.avail_out === 0 || a === Ct))
2511
+ if (this.options.to === "string") {
2512
+ let u = Ve.utf8border(t.output, t.next_out), s = t.next_out - u, f = Ve.buf2string(t.output, u);
2513
+ t.next_out = s, t.avail_out = i - s, s && t.output.set(t.output.subarray(u, u + s), 0), this.onData(f);
2514
+ } else
2515
+ this.onData(t.output.length === t.next_out ? t.output : t.output.subarray(0, t.next_out));
2516
+ if (!(a === Le && l === 0)) {
2517
+ if (a === Ct)
2518
+ return a = X.inflateEnd(this.strm), this.onEnd(a), this.ended = !0, !0;
2519
+ if (t.avail_in === 0)
2520
+ break;
2521
+ }
2522
+ }
2523
+ return !0;
2524
+ };
2525
+ He.prototype.onData = function(e) {
2526
+ this.chunks.push(e);
2527
+ };
2528
+ He.prototype.onEnd = function(e) {
2529
+ e === Le && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = ht.flattenChunks(this.chunks)), this.chunks = [], this.err = e, this.msg = this.strm.msg;
2530
+ };
2531
+ function Kt(e, n) {
2532
+ const t = new He(n);
2533
+ if (t.push(e), t.err)
2534
+ throw t.msg || ge[t.err];
2535
+ return t.result;
2536
+ }
2537
+ function Io(e, n) {
2538
+ return n = n || {}, n.raw = !0, Kt(e, n);
2539
+ }
2540
+ var Ao = He, Oo = Kt, zo = Io, Ro = Kt, Bo = xe, Uo = {
2541
+ Inflate: Ao,
2542
+ inflate: Oo,
2543
+ inflateRaw: zo,
2544
+ ungzip: Ro,
2545
+ constants: Bo
2546
+ };
2547
+ const { Inflate: Ds, inflate: Vs, inflateRaw: Do, ungzip: Ls } = Uo;
2548
+ var Vo = Do;
2549
+ function Lo(e) {
2550
+ return Vo(e.subarray(2));
2551
+ }
2552
+ class Fo extends Error {
2553
+ constructor(n) {
2554
+ super(n), this.code = "ERR_ABORTED";
2555
+ }
2556
+ }
2557
+ function Po(e) {
2558
+ e.sort((r, a) => Number(r.offset) - Number(a.offset));
2559
+ const n = [];
2560
+ let t, i;
2561
+ for (const r of e)
2562
+ t && i && Number(r.offset) - i <= 2e3 ? (t.length = BigInt(Number(t.length) + Number(r.length) - i + Number(r.offset)), t.blocks.push(r)) : n.push(t = {
2563
+ blocks: [r],
2564
+ length: r.length,
2565
+ offset: r.offset
2566
+ }), i = Number(t.offset) + Number(t.length);
2567
+ return n;
2568
+ }
2569
+ function et(e) {
2570
+ if (e && e.aborted)
2571
+ if (typeof DOMException > "u") {
2572
+ const n = new Fo("aborted");
2573
+ throw n.code = "ERR_ABORTED", n;
2574
+ } else
2575
+ throw new DOMException("aborted", "AbortError");
2576
+ }
2577
+ const Zo = 1, xo = 2, Mo = 3;
2578
+ function Nt(e, n, t, i) {
2579
+ return e < i && n >= t;
2580
+ }
2581
+ function Ho(e) {
2582
+ const n = e ? "big" : "little", t = new N().endianess(n).uint32("chromId").uint32("start").uint32("end").uint32("validCnt").floatle("minScore").floatle("maxScore").floatle("sumData").floatle("sumSqData").saveOffset("offset"), i = new N().endianess(n).uint8("isLeaf").skip(1).uint16("cnt").choice({
2583
+ tag: "isLeaf",
2584
+ choices: {
2585
+ 1: new N().endianess(n).array("blocksToFetch", {
2586
+ length: "cnt",
2587
+ type: new N().endianess(n).uint32("startChrom").uint32("startBase").uint32("endChrom").uint32("endBase").uint64("blockOffset").uint64("blockSize").saveOffset("offset")
2588
+ }),
2589
+ 0: new N().array("recurOffsets", {
2590
+ length: "cnt",
2591
+ type: new N().endianess(n).uint32("startChrom").uint32("startBase").uint32("endChrom").uint32("endBase").uint64("blockOffset").saveOffset("offset")
2592
+ })
2593
+ }
2594
+ }), r = new N().endianess(n).uint32("chromId").int32("start").int32("end").string("rest", {
2595
+ zeroTerminated: !0
2596
+ }).saveOffset("offset");
2597
+ return {
2598
+ bigWigParser: new N().endianess(n).skip(4).int32("blockStart").skip(4).uint32("itemStep").uint32("itemSpan").uint8("blockType").skip(1).uint16("itemCount").choice({
2599
+ tag: "blockType",
2600
+ choices: {
2601
+ [Mo]: new N().array("items", {
2602
+ length: "itemCount",
2603
+ type: new N().floatle("score")
2604
+ }),
2605
+ [xo]: new N().array("items", {
2606
+ length: "itemCount",
2607
+ type: new N().endianess(n).int32("start").floatle("score")
2608
+ }),
2609
+ [Zo]: new N().array("items", {
2610
+ length: "itemCount",
2611
+ type: new N().endianess(n).int32("start").int32("end").floatle("score")
2612
+ })
2613
+ }
2614
+ }),
2615
+ bigBedParser: r,
2616
+ summaryParser: t,
2617
+ leafParser: i
2618
+ };
2619
+ }
2620
+ class Ai {
2621
+ constructor(n, t, i, r, a, o) {
2622
+ if (this.bbi = n, this.refsByName = t, this.cirTreeOffset = i, this.isBigEndian = r, this.isCompressed = a, this.blockType = o, this.featureCache = new Yn({
2623
+ cache: new Kn({ maxSize: 1e3 }),
2624
+ fill: async (u, s) => {
2625
+ const f = Number(u.length), d = Number(u.offset), { buffer: c } = await this.bbi.read(Q.Buffer.alloc(f), 0, f, d, {
2626
+ signal: s
2627
+ });
2628
+ return c;
2629
+ }
2630
+ }), !(i >= 0))
2631
+ throw new Error("invalid cirTreeOffset!");
2632
+ const l = Ho(r);
2633
+ this.leafParser = l.leafParser, this.bigBedParser = l.bigBedParser;
2634
+ }
2635
+ async readWigData(n, t, i, r, a) {
2636
+ try {
2637
+ const { refsByName: o, bbi: l, cirTreeOffset: u, isBigEndian: s } = this, f = o[n];
2638
+ f === void 0 && r.complete();
2639
+ const d = { chrId: f, start: t, end: i };
2640
+ this.cirTreePromise || (this.cirTreePromise = l.read(Q.Buffer.alloc(48), 0, 48, Number(u), a));
2641
+ const { buffer: c } = await this.cirTreePromise, h = s ? c.readUInt32BE(4) : c.readUInt32LE(4);
2642
+ let _ = [], g = 0;
2643
+ const k = (p, $, S) => {
2644
+ try {
2645
+ const b = p.subarray($), w = this.leafParser.parse(b);
2646
+ if (w.blocksToFetch && (_ = _.concat(w.blocksToFetch.filter((m) => y(m)).map((m) => ({
2647
+ offset: m.blockOffset,
2648
+ length: m.blockSize
2649
+ })))), w.recurOffsets) {
2650
+ const m = w.recurOffsets.filter((v) => y(v)).map((v) => Number(v.blockOffset));
2651
+ m.length > 0 && C(m, S + 1);
2652
+ }
2653
+ } catch (b) {
2654
+ r.error(b);
2655
+ }
2656
+ }, y = (p) => {
2657
+ const { startChrom: $, startBase: S, endChrom: b, endBase: w } = p;
2658
+ return ($ < f || $ === f && S <= i) && (b > f || b === f && w >= t);
2659
+ }, E = async (p, $, S) => {
2660
+ try {
2661
+ const b = $.max() - $.min(), w = $.min(), m = await this.featureCache.get(`${b}_${w}`, { length: b, offset: w }, a == null ? void 0 : a.signal);
2662
+ for (const v of p)
2663
+ $.contains(v) && (k(m, v - w, S), g -= 1, g === 0 && this.readFeatures(r, _, { ...a, request: d }));
2664
+ } catch (b) {
2665
+ r.error(b);
2666
+ }
2667
+ }, C = (p, $) => {
2668
+ try {
2669
+ g += p.length;
2670
+ const S = 4 + Number(h) * 32;
2671
+ let b = new q(p[0], p[0] + S);
2672
+ for (let w = 1; w < p.length; w += 1) {
2673
+ const m = new q(p[w], p[w] + S);
2674
+ b = b.union(m);
2675
+ }
2676
+ b.getRanges().map((w) => E(p, w, $));
2677
+ } catch (S) {
2678
+ r.error(S);
2679
+ }
2680
+ };
2681
+ return C([Number(u) + 48], 1);
2682
+ } catch (o) {
2683
+ r.error(o);
2684
+ }
2685
+ }
2686
+ parseSummaryBlock(n, t, i) {
2687
+ const r = [];
2688
+ let a = t;
2689
+ const o = new DataView(n.buffer, n.byteOffset, n.length);
2690
+ for (; a < n.byteLength; ) {
2691
+ const l = o.getUint32(a, !0);
2692
+ a += 4;
2693
+ const u = o.getUint32(a, !0);
2694
+ a += 4;
2695
+ const s = o.getUint32(a, !0);
2696
+ a += 4;
2697
+ const f = o.getUint32(a, !0);
2698
+ a += 4;
2699
+ const d = o.getFloat32(a, !0);
2700
+ a += 4;
2701
+ const c = o.getFloat32(a, !0);
2702
+ a += 4;
2703
+ const h = o.getFloat32(a, !0);
2704
+ a += 4, a += 4, (!i || l === i.chrId && Nt(u, s, i.start, i.end)) && r.push({
2705
+ start: u,
2706
+ end: s,
2707
+ maxScore: c,
2708
+ minScore: d,
2709
+ summary: !0,
2710
+ score: h / (f || 1)
2711
+ });
2712
+ }
2713
+ return r;
2714
+ }
2715
+ parseBigBedBlock(n, t, i, r) {
2716
+ const a = [];
2717
+ let o = t;
2718
+ for (; o < n.byteLength; ) {
2719
+ const l = this.bigBedParser.parse(n.subarray(o));
2720
+ a.push({ ...l, uniqueId: `bb-${i + o}` }), o += l.offset;
2721
+ }
2722
+ return r ? a.filter((l) => Nt(l.start, l.end, r.start, r.end)) : a;
2723
+ }
2724
+ parseBigWigBlock(n, t, i) {
2725
+ const r = n.subarray(t), a = new DataView(r.buffer, r.byteOffset, r.length);
2726
+ let o = 0;
2727
+ o += 4;
2728
+ const l = a.getInt32(o, !0);
2729
+ o += 8;
2730
+ const u = a.getUint32(o, !0);
2731
+ o += 4;
2732
+ const s = a.getUint32(o, !0);
2733
+ o += 4;
2734
+ const f = a.getUint8(o);
2735
+ o += 2;
2736
+ const d = a.getUint16(o, !0);
2737
+ o += 2;
2738
+ const c = new Array(d);
2739
+ switch (f) {
2740
+ case 1: {
2741
+ for (let h = 0; h < d; h++) {
2742
+ const _ = a.getInt32(o, !0);
2743
+ o += 4;
2744
+ const g = a.getInt32(o, !0);
2745
+ o += 4;
2746
+ const k = a.getFloat32(o, !0);
2747
+ o += 4, c[h] = { start: _, end: g, score: k };
2748
+ }
2749
+ break;
2750
+ }
2751
+ case 2: {
2752
+ for (let h = 0; h < d; h++) {
2753
+ const _ = a.getInt32(o, !0);
2754
+ o += 4;
2755
+ const g = a.getFloat32(o, !0);
2756
+ o += 4, c[h] = { score: g, start: _, end: _ + s };
2757
+ }
2758
+ break;
2759
+ }
2760
+ case 3: {
2761
+ for (let h = 0; h < d; h++) {
2762
+ const _ = a.getFloat32(o, !0);
2763
+ o += 4;
2764
+ const g = l + h * u;
2765
+ c[h] = { score: _, start: g, end: g + s };
2766
+ }
2767
+ break;
2768
+ }
2769
+ }
2770
+ return i ? c.filter((h) => Nt(h.start, h.end, i.start, i.end)) : c;
2771
+ }
2772
+ async readFeatures(n, t, i = {}) {
2773
+ try {
2774
+ const { blockType: r, isCompressed: a } = this, { signal: o, request: l } = i, u = Po(t);
2775
+ et(o), await Promise.all(u.map(async (s) => {
2776
+ et(o);
2777
+ const { length: f, offset: d } = s, c = await this.featureCache.get(`${f}_${d}`, s, o);
2778
+ for (const h of s.blocks) {
2779
+ et(o);
2780
+ let _ = Number(h.offset) - Number(s.offset), g = c;
2781
+ switch (a && (g = Lo(c.subarray(_)), _ = 0), et(o), r) {
2782
+ case "summary": {
2783
+ n.next(this.parseSummaryBlock(g, _, l));
2784
+ break;
2785
+ }
2786
+ case "bigwig": {
2787
+ n.next(this.parseBigWigBlock(g, _, l));
2788
+ break;
2789
+ }
2790
+ case "bigbed": {
2791
+ n.next(this.parseBigBedBlock(g, _, Number(h.offset) * 256, l));
2792
+ break;
2793
+ }
2794
+ default:
2795
+ console.warn(`Don't know what to do with ${r}`);
2796
+ }
2797
+ }
2798
+ })), n.complete();
2799
+ } catch (r) {
2800
+ n.error(r);
2801
+ }
2802
+ }
2803
+ }
2804
+ var Pt = function(e, n) {
2805
+ return Pt = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, i) {
2806
+ t.__proto__ = i;
2807
+ } || function(t, i) {
2808
+ for (var r in i)
2809
+ Object.prototype.hasOwnProperty.call(i, r) && (t[r] = i[r]);
2810
+ }, Pt(e, n);
2811
+ };
2812
+ function Wt(e, n) {
2813
+ if (typeof n != "function" && n !== null)
2814
+ throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
2815
+ Pt(e, n);
2816
+ function t() {
2817
+ this.constructor = e;
2818
+ }
2819
+ e.prototype = n === null ? Object.create(n) : (t.prototype = n.prototype, new t());
2820
+ }
2821
+ function jo(e, n, t, i) {
2822
+ function r(a) {
2823
+ return a instanceof t ? a : new t(function(o) {
2824
+ o(a);
2825
+ });
2826
+ }
2827
+ return new (t || (t = Promise))(function(a, o) {
2828
+ function l(f) {
2829
+ try {
2830
+ s(i.next(f));
2831
+ } catch (d) {
2832
+ o(d);
2833
+ }
2834
+ }
2835
+ function u(f) {
2836
+ try {
2837
+ s(i.throw(f));
2838
+ } catch (d) {
2839
+ o(d);
2840
+ }
2841
+ }
2842
+ function s(f) {
2843
+ f.done ? a(f.value) : r(f.value).then(l, u);
2844
+ }
2845
+ s((i = i.apply(e, n || [])).next());
2846
+ });
2847
+ }
2848
+ function Oi(e, n) {
2849
+ var t = { label: 0, sent: function() {
2850
+ if (a[0] & 1)
2851
+ throw a[1];
2852
+ return a[1];
2853
+ }, trys: [], ops: [] }, i, r, a, o;
2854
+ return o = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (o[Symbol.iterator] = function() {
2855
+ return this;
2856
+ }), o;
2857
+ function l(s) {
2858
+ return function(f) {
2859
+ return u([s, f]);
2860
+ };
2861
+ }
2862
+ function u(s) {
2863
+ if (i)
2864
+ throw new TypeError("Generator is already executing.");
2865
+ for (; o && (o = 0, s[0] && (t = 0)), t; )
2866
+ try {
2867
+ if (i = 1, r && (a = s[0] & 2 ? r.return : s[0] ? r.throw || ((a = r.return) && a.call(r), 0) : r.next) && !(a = a.call(r, s[1])).done)
2868
+ return a;
2869
+ switch (r = 0, a && (s = [s[0] & 2, a.value]), s[0]) {
2870
+ case 0:
2871
+ case 1:
2872
+ a = s;
2873
+ break;
2874
+ case 4:
2875
+ return t.label++, { value: s[1], done: !1 };
2876
+ case 5:
2877
+ t.label++, r = s[1], s = [0];
2878
+ continue;
2879
+ case 7:
2880
+ s = t.ops.pop(), t.trys.pop();
2881
+ continue;
2882
+ default:
2883
+ if (a = t.trys, !(a = a.length > 0 && a[a.length - 1]) && (s[0] === 6 || s[0] === 2)) {
2884
+ t = 0;
2885
+ continue;
2886
+ }
2887
+ if (s[0] === 3 && (!a || s[1] > a[0] && s[1] < a[3])) {
2888
+ t.label = s[1];
2889
+ break;
2890
+ }
2891
+ if (s[0] === 6 && t.label < a[1]) {
2892
+ t.label = a[1], a = s;
2893
+ break;
2894
+ }
2895
+ if (a && t.label < a[2]) {
2896
+ t.label = a[2], t.ops.push(s);
2897
+ break;
2898
+ }
2899
+ a[2] && t.ops.pop(), t.trys.pop();
2900
+ continue;
2901
+ }
2902
+ s = n.call(e, t);
2903
+ } catch (f) {
2904
+ s = [6, f], r = 0;
2905
+ } finally {
2906
+ i = a = 0;
2907
+ }
2908
+ if (s[0] & 5)
2909
+ throw s[1];
2910
+ return { value: s[0] ? s[1] : void 0, done: !0 };
2911
+ }
2912
+ }
2913
+ function Fe(e) {
2914
+ var n = typeof Symbol == "function" && Symbol.iterator, t = n && e[n], i = 0;
2915
+ if (t)
2916
+ return t.call(e);
2917
+ if (e && typeof e.length == "number")
2918
+ return {
2919
+ next: function() {
2920
+ return e && i >= e.length && (e = void 0), { value: e && e[i++], done: !e };
2921
+ }
2922
+ };
2923
+ throw new TypeError(n ? "Object is not iterable." : "Symbol.iterator is not defined.");
2924
+ }
2925
+ function ot(e, n) {
2926
+ var t = typeof Symbol == "function" && e[Symbol.iterator];
2927
+ if (!t)
2928
+ return e;
2929
+ var i = t.call(e), r, a = [], o;
2930
+ try {
2931
+ for (; (n === void 0 || n-- > 0) && !(r = i.next()).done; )
2932
+ a.push(r.value);
2933
+ } catch (l) {
2934
+ o = { error: l };
2935
+ } finally {
2936
+ try {
2937
+ r && !r.done && (t = i.return) && t.call(i);
2938
+ } finally {
2939
+ if (o)
2940
+ throw o.error;
2941
+ }
2942
+ }
2943
+ return a;
2944
+ }
2945
+ function st(e, n, t) {
2946
+ if (t || arguments.length === 2)
2947
+ for (var i = 0, r = n.length, a; i < r; i++)
2948
+ (a || !(i in n)) && (a || (a = Array.prototype.slice.call(n, 0, i)), a[i] = n[i]);
2949
+ return e.concat(a || Array.prototype.slice.call(n));
2950
+ }
2951
+ function be(e) {
2952
+ return this instanceof be ? (this.v = e, this) : new be(e);
2953
+ }
2954
+ function Go(e, n, t) {
2955
+ if (!Symbol.asyncIterator)
2956
+ throw new TypeError("Symbol.asyncIterator is not defined.");
2957
+ var i = t.apply(e, n || []), r, a = [];
2958
+ return r = {}, o("next"), o("throw"), o("return"), r[Symbol.asyncIterator] = function() {
2959
+ return this;
2960
+ }, r;
2961
+ function o(c) {
2962
+ i[c] && (r[c] = function(h) {
2963
+ return new Promise(function(_, g) {
2964
+ a.push([c, h, _, g]) > 1 || l(c, h);
2965
+ });
2966
+ });
2967
+ }
2968
+ function l(c, h) {
2969
+ try {
2970
+ u(i[c](h));
2971
+ } catch (_) {
2972
+ d(a[0][3], _);
2973
+ }
2974
+ }
2975
+ function u(c) {
2976
+ c.value instanceof be ? Promise.resolve(c.value.v).then(s, f) : d(a[0][2], c);
2977
+ }
2978
+ function s(c) {
2979
+ l("next", c);
2980
+ }
2981
+ function f(c) {
2982
+ l("throw", c);
2983
+ }
2984
+ function d(c, h) {
2985
+ c(h), a.shift(), a.length && l(a[0][0], a[0][1]);
2986
+ }
2987
+ }
2988
+ function Yo(e) {
2989
+ if (!Symbol.asyncIterator)
2990
+ throw new TypeError("Symbol.asyncIterator is not defined.");
2991
+ var n = e[Symbol.asyncIterator], t;
2992
+ return n ? n.call(e) : (e = typeof Fe == "function" ? Fe(e) : e[Symbol.iterator](), t = {}, i("next"), i("throw"), i("return"), t[Symbol.asyncIterator] = function() {
2993
+ return this;
2994
+ }, t);
2995
+ function i(a) {
2996
+ t[a] = e[a] && function(o) {
2997
+ return new Promise(function(l, u) {
2998
+ o = e[a](o), r(l, u, o.done, o.value);
2999
+ });
3000
+ };
3001
+ }
3002
+ function r(a, o, l, u) {
3003
+ Promise.resolve(u).then(function(s) {
3004
+ a({ value: s, done: l });
3005
+ }, o);
3006
+ }
3007
+ }
3008
+ function z(e) {
3009
+ return typeof e == "function";
3010
+ }
3011
+ function zi(e) {
3012
+ var n = function(i) {
3013
+ Error.call(i), i.stack = new Error().stack;
3014
+ }, t = e(n);
3015
+ return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t;
3016
+ }
3017
+ var Tt = zi(function(e) {
3018
+ return function(t) {
3019
+ e(this), this.message = t ? t.length + ` errors occurred during unsubscription:
3020
+ ` + t.map(function(i, r) {
3021
+ return r + 1 + ") " + i.toString();
3022
+ }).join(`
3023
+ `) : "", this.name = "UnsubscriptionError", this.errors = t;
3024
+ };
3025
+ });
3026
+ function Zn(e, n) {
3027
+ if (e) {
3028
+ var t = e.indexOf(n);
3029
+ 0 <= t && e.splice(t, 1);
3030
+ }
3031
+ }
3032
+ var Xt = function() {
3033
+ function e(n) {
3034
+ this.initialTeardown = n, this.closed = !1, this._parentage = null, this._finalizers = null;
3035
+ }
3036
+ return e.prototype.unsubscribe = function() {
3037
+ var n, t, i, r, a;
3038
+ if (!this.closed) {
3039
+ this.closed = !0;
3040
+ var o = this._parentage;
3041
+ if (o)
3042
+ if (this._parentage = null, Array.isArray(o))
3043
+ try {
3044
+ for (var l = Fe(o), u = l.next(); !u.done; u = l.next()) {
3045
+ var s = u.value;
3046
+ s.remove(this);
3047
+ }
3048
+ } catch (g) {
3049
+ n = { error: g };
3050
+ } finally {
3051
+ try {
3052
+ u && !u.done && (t = l.return) && t.call(l);
3053
+ } finally {
3054
+ if (n)
3055
+ throw n.error;
3056
+ }
3057
+ }
3058
+ else
3059
+ o.remove(this);
3060
+ var f = this.initialTeardown;
3061
+ if (z(f))
3062
+ try {
3063
+ f();
3064
+ } catch (g) {
3065
+ a = g instanceof Tt ? g.errors : [g];
3066
+ }
3067
+ var d = this._finalizers;
3068
+ if (d) {
3069
+ this._finalizers = null;
3070
+ try {
3071
+ for (var c = Fe(d), h = c.next(); !h.done; h = c.next()) {
3072
+ var _ = h.value;
3073
+ try {
3074
+ xn(_);
3075
+ } catch (g) {
3076
+ a = a ?? [], g instanceof Tt ? a = st(st([], ot(a)), ot(g.errors)) : a.push(g);
3077
+ }
3078
+ }
3079
+ } catch (g) {
3080
+ i = { error: g };
3081
+ } finally {
3082
+ try {
3083
+ h && !h.done && (r = c.return) && r.call(c);
3084
+ } finally {
3085
+ if (i)
3086
+ throw i.error;
3087
+ }
3088
+ }
3089
+ }
3090
+ if (a)
3091
+ throw new Tt(a);
3092
+ }
3093
+ }, e.prototype.add = function(n) {
3094
+ var t;
3095
+ if (n && n !== this)
3096
+ if (this.closed)
3097
+ xn(n);
3098
+ else {
3099
+ if (n instanceof e) {
3100
+ if (n.closed || n._hasParent(this))
3101
+ return;
3102
+ n._addParent(this);
3103
+ }
3104
+ (this._finalizers = (t = this._finalizers) !== null && t !== void 0 ? t : []).push(n);
3105
+ }
3106
+ }, e.prototype._hasParent = function(n) {
3107
+ var t = this._parentage;
3108
+ return t === n || Array.isArray(t) && t.includes(n);
3109
+ }, e.prototype._addParent = function(n) {
3110
+ var t = this._parentage;
3111
+ this._parentage = Array.isArray(t) ? (t.push(n), t) : t ? [t, n] : n;
3112
+ }, e.prototype._removeParent = function(n) {
3113
+ var t = this._parentage;
3114
+ t === n ? this._parentage = null : Array.isArray(t) && Zn(t, n);
3115
+ }, e.prototype.remove = function(n) {
3116
+ var t = this._finalizers;
3117
+ t && Zn(t, n), n instanceof e && n._removeParent(this);
3118
+ }, e.EMPTY = function() {
3119
+ var n = new e();
3120
+ return n.closed = !0, n;
3121
+ }(), e;
3122
+ }();
3123
+ Xt.EMPTY;
3124
+ function Ri(e) {
3125
+ return e instanceof Xt || e && "closed" in e && z(e.remove) && z(e.add) && z(e.unsubscribe);
3126
+ }
3127
+ function xn(e) {
3128
+ z(e) ? e() : e.unsubscribe();
3129
+ }
3130
+ var Bi = {
3131
+ onUnhandledError: null,
3132
+ onStoppedNotification: null,
3133
+ Promise: void 0,
3134
+ useDeprecatedSynchronousErrorHandling: !1,
3135
+ useDeprecatedNextContext: !1
3136
+ }, Zt = {
3137
+ setTimeout: function(e, n) {
3138
+ for (var t = [], i = 2; i < arguments.length; i++)
3139
+ t[i - 2] = arguments[i];
3140
+ var r = Zt.delegate;
3141
+ return r != null && r.setTimeout ? r.setTimeout.apply(r, st([e, n], ot(t))) : setTimeout.apply(void 0, st([e, n], ot(t)));
3142
+ },
3143
+ clearTimeout: function(e) {
3144
+ var n = Zt.delegate;
3145
+ return ((n == null ? void 0 : n.clearTimeout) || clearTimeout)(e);
3146
+ },
3147
+ delegate: void 0
3148
+ };
3149
+ function Ui(e) {
3150
+ Zt.setTimeout(function() {
3151
+ throw e;
3152
+ });
3153
+ }
3154
+ function Mn() {
3155
+ }
3156
+ function Ko(e) {
3157
+ e();
3158
+ }
3159
+ var qt = function(e) {
3160
+ Wt(n, e);
3161
+ function n(t) {
3162
+ var i = e.call(this) || this;
3163
+ return i.isStopped = !1, t ? (i.destination = t, Ri(t) && t.add(i)) : i.destination = Jo, i;
3164
+ }
3165
+ return n.create = function(t, i, r) {
3166
+ return new lt(t, i, r);
3167
+ }, n.prototype.next = function(t) {
3168
+ this.isStopped || this._next(t);
3169
+ }, n.prototype.error = function(t) {
3170
+ this.isStopped || (this.isStopped = !0, this._error(t));
3171
+ }, n.prototype.complete = function() {
3172
+ this.isStopped || (this.isStopped = !0, this._complete());
3173
+ }, n.prototype.unsubscribe = function() {
3174
+ this.closed || (this.isStopped = !0, e.prototype.unsubscribe.call(this), this.destination = null);
3175
+ }, n.prototype._next = function(t) {
3176
+ this.destination.next(t);
3177
+ }, n.prototype._error = function(t) {
3178
+ try {
3179
+ this.destination.error(t);
3180
+ } finally {
3181
+ this.unsubscribe();
3182
+ }
3183
+ }, n.prototype._complete = function() {
3184
+ try {
3185
+ this.destination.complete();
3186
+ } finally {
3187
+ this.unsubscribe();
3188
+ }
3189
+ }, n;
3190
+ }(Xt), Wo = Function.prototype.bind;
3191
+ function It(e, n) {
3192
+ return Wo.call(e, n);
3193
+ }
3194
+ var Xo = function() {
3195
+ function e(n) {
3196
+ this.partialObserver = n;
3197
+ }
3198
+ return e.prototype.next = function(n) {
3199
+ var t = this.partialObserver;
3200
+ if (t.next)
3201
+ try {
3202
+ t.next(n);
3203
+ } catch (i) {
3204
+ tt(i);
3205
+ }
3206
+ }, e.prototype.error = function(n) {
3207
+ var t = this.partialObserver;
3208
+ if (t.error)
3209
+ try {
3210
+ t.error(n);
3211
+ } catch (i) {
3212
+ tt(i);
3213
+ }
3214
+ else
3215
+ tt(n);
3216
+ }, e.prototype.complete = function() {
3217
+ var n = this.partialObserver;
3218
+ if (n.complete)
3219
+ try {
3220
+ n.complete();
3221
+ } catch (t) {
3222
+ tt(t);
3223
+ }
3224
+ }, e;
3225
+ }(), lt = function(e) {
3226
+ Wt(n, e);
3227
+ function n(t, i, r) {
3228
+ var a = e.call(this) || this, o;
3229
+ if (z(t) || !t)
3230
+ o = {
3231
+ next: t ?? void 0,
3232
+ error: i ?? void 0,
3233
+ complete: r ?? void 0
3234
+ };
3235
+ else {
3236
+ var l;
3237
+ a && Bi.useDeprecatedNextContext ? (l = Object.create(t), l.unsubscribe = function() {
3238
+ return a.unsubscribe();
3239
+ }, o = {
3240
+ next: t.next && It(t.next, l),
3241
+ error: t.error && It(t.error, l),
3242
+ complete: t.complete && It(t.complete, l)
3243
+ }) : o = t;
3244
+ }
3245
+ return a.destination = new Xo(o), a;
3246
+ }
3247
+ return n;
3248
+ }(qt);
3249
+ function tt(e) {
3250
+ Ui(e);
3251
+ }
3252
+ function qo(e) {
3253
+ throw e;
3254
+ }
3255
+ var Jo = {
3256
+ closed: !0,
3257
+ next: Mn,
3258
+ error: qo,
3259
+ complete: Mn
3260
+ }, Jt = function() {
3261
+ return typeof Symbol == "function" && Symbol.observable || "@@observable";
3262
+ }();
3263
+ function Di(e) {
3264
+ return e;
3265
+ }
3266
+ function Qo(e) {
3267
+ return e.length === 0 ? Di : e.length === 1 ? e[0] : function(t) {
3268
+ return e.reduce(function(i, r) {
3269
+ return r(i);
3270
+ }, t);
3271
+ };
3272
+ }
3273
+ var Z = function() {
3274
+ function e(n) {
3275
+ n && (this._subscribe = n);
3276
+ }
3277
+ return e.prototype.lift = function(n) {
3278
+ var t = new e();
3279
+ return t.source = this, t.operator = n, t;
3280
+ }, e.prototype.subscribe = function(n, t, i) {
3281
+ var r = this, a = ts(n) ? n : new lt(n, t, i);
3282
+ return Ko(function() {
3283
+ var o = r, l = o.operator, u = o.source;
3284
+ a.add(l ? l.call(a, u) : u ? r._subscribe(a) : r._trySubscribe(a));
3285
+ }), a;
3286
+ }, e.prototype._trySubscribe = function(n) {
3287
+ try {
3288
+ return this._subscribe(n);
3289
+ } catch (t) {
3290
+ n.error(t);
3291
+ }
3292
+ }, e.prototype.forEach = function(n, t) {
3293
+ var i = this;
3294
+ return t = Hn(t), new t(function(r, a) {
3295
+ var o = new lt({
3296
+ next: function(l) {
3297
+ try {
3298
+ n(l);
3299
+ } catch (u) {
3300
+ a(u), o.unsubscribe();
3301
+ }
3302
+ },
3303
+ error: a,
3304
+ complete: r
3305
+ });
3306
+ i.subscribe(o);
3307
+ });
3308
+ }, e.prototype._subscribe = function(n) {
3309
+ var t;
3310
+ return (t = this.source) === null || t === void 0 ? void 0 : t.subscribe(n);
3311
+ }, e.prototype[Jt] = function() {
3312
+ return this;
3313
+ }, e.prototype.pipe = function() {
3314
+ for (var n = [], t = 0; t < arguments.length; t++)
3315
+ n[t] = arguments[t];
3316
+ return Qo(n)(this);
3317
+ }, e.prototype.toPromise = function(n) {
3318
+ var t = this;
3319
+ return n = Hn(n), new n(function(i, r) {
3320
+ var a;
3321
+ t.subscribe(function(o) {
3322
+ return a = o;
3323
+ }, function(o) {
3324
+ return r(o);
3325
+ }, function() {
3326
+ return i(a);
3327
+ });
3328
+ });
3329
+ }, e.create = function(n) {
3330
+ return new e(n);
3331
+ }, e;
3332
+ }();
3333
+ function Hn(e) {
3334
+ var n;
3335
+ return (n = e ?? Bi.Promise) !== null && n !== void 0 ? n : Promise;
3336
+ }
3337
+ function es(e) {
3338
+ return e && z(e.next) && z(e.error) && z(e.complete);
3339
+ }
3340
+ function ts(e) {
3341
+ return e && e instanceof qt || es(e) && Ri(e);
3342
+ }
3343
+ function ns(e) {
3344
+ return z(e == null ? void 0 : e.lift);
3345
+ }
3346
+ function $e(e) {
3347
+ return function(n) {
3348
+ if (ns(n))
3349
+ return n.lift(function(t) {
3350
+ try {
3351
+ return e(t, this);
3352
+ } catch (i) {
3353
+ this.error(i);
3354
+ }
3355
+ });
3356
+ throw new TypeError("Unable to lift unknown Observable type");
3357
+ };
3358
+ }
3359
+ function Pe(e, n, t, i, r) {
3360
+ return new is(e, n, t, i, r);
3361
+ }
3362
+ var is = function(e) {
3363
+ Wt(n, e);
3364
+ function n(t, i, r, a, o, l) {
3365
+ var u = e.call(this, t) || this;
3366
+ return u.onFinalize = o, u.shouldUnsubscribe = l, u._next = i ? function(s) {
3367
+ try {
3368
+ i(s);
3369
+ } catch (f) {
3370
+ t.error(f);
3371
+ }
3372
+ } : e.prototype._next, u._error = a ? function(s) {
3373
+ try {
3374
+ a(s);
3375
+ } catch (f) {
3376
+ t.error(f);
3377
+ } finally {
3378
+ this.unsubscribe();
3379
+ }
3380
+ } : e.prototype._error, u._complete = r ? function() {
3381
+ try {
3382
+ r();
3383
+ } catch (s) {
3384
+ t.error(s);
3385
+ } finally {
3386
+ this.unsubscribe();
3387
+ }
3388
+ } : e.prototype._complete, u;
3389
+ }
3390
+ return n.prototype.unsubscribe = function() {
3391
+ var t;
3392
+ if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
3393
+ var i = this.closed;
3394
+ e.prototype.unsubscribe.call(this), !i && ((t = this.onFinalize) === null || t === void 0 || t.call(this));
3395
+ }
3396
+ }, n;
3397
+ }(qt), rs = new Z(function(e) {
3398
+ return e.complete();
3399
+ });
3400
+ function as(e) {
3401
+ return e && z(e.schedule);
3402
+ }
3403
+ function Vi(e) {
3404
+ return e[e.length - 1];
3405
+ }
3406
+ function os(e) {
3407
+ return as(Vi(e)) ? e.pop() : void 0;
3408
+ }
3409
+ function ss(e, n) {
3410
+ return typeof Vi(e) == "number" ? e.pop() : n;
3411
+ }
3412
+ var Li = function(e) {
3413
+ return e && typeof e.length == "number" && typeof e != "function";
3414
+ };
3415
+ function Fi(e) {
3416
+ return z(e == null ? void 0 : e.then);
3417
+ }
3418
+ function Pi(e) {
3419
+ return z(e[Jt]);
3420
+ }
3421
+ function Zi(e) {
3422
+ return Symbol.asyncIterator && z(e == null ? void 0 : e[Symbol.asyncIterator]);
3423
+ }
3424
+ function xi(e) {
3425
+ return new TypeError("You provided " + (e !== null && typeof e == "object" ? "an invalid object" : "'" + e + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
3426
+ }
3427
+ function ls() {
3428
+ return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
3429
+ }
3430
+ var Mi = ls();
3431
+ function Hi(e) {
3432
+ return z(e == null ? void 0 : e[Mi]);
3433
+ }
3434
+ function ji(e) {
3435
+ return Go(this, arguments, function() {
3436
+ var t, i, r, a;
3437
+ return Oi(this, function(o) {
3438
+ switch (o.label) {
3439
+ case 0:
3440
+ t = e.getReader(), o.label = 1;
3441
+ case 1:
3442
+ o.trys.push([1, , 9, 10]), o.label = 2;
3443
+ case 2:
3444
+ return [4, be(t.read())];
3445
+ case 3:
3446
+ return i = o.sent(), r = i.value, a = i.done, a ? [4, be(void 0)] : [3, 5];
3447
+ case 4:
3448
+ return [2, o.sent()];
3449
+ case 5:
3450
+ return [4, be(r)];
3451
+ case 6:
3452
+ return [4, o.sent()];
3453
+ case 7:
3454
+ return o.sent(), [3, 2];
3455
+ case 8:
3456
+ return [3, 10];
3457
+ case 9:
3458
+ return t.releaseLock(), [7];
3459
+ case 10:
3460
+ return [2];
3461
+ }
3462
+ });
3463
+ });
3464
+ }
3465
+ function Gi(e) {
3466
+ return z(e == null ? void 0 : e.getReader);
3467
+ }
3468
+ function Ee(e) {
3469
+ if (e instanceof Z)
3470
+ return e;
3471
+ if (e != null) {
3472
+ if (Pi(e))
3473
+ return fs(e);
3474
+ if (Li(e))
3475
+ return us(e);
3476
+ if (Fi(e))
3477
+ return hs(e);
3478
+ if (Zi(e))
3479
+ return Yi(e);
3480
+ if (Hi(e))
3481
+ return cs(e);
3482
+ if (Gi(e))
3483
+ return ds(e);
3484
+ }
3485
+ throw xi(e);
3486
+ }
3487
+ function fs(e) {
3488
+ return new Z(function(n) {
3489
+ var t = e[Jt]();
3490
+ if (z(t.subscribe))
3491
+ return t.subscribe(n);
3492
+ throw new TypeError("Provided object does not correctly implement Symbol.observable");
3493
+ });
3494
+ }
3495
+ function us(e) {
3496
+ return new Z(function(n) {
3497
+ for (var t = 0; t < e.length && !n.closed; t++)
3498
+ n.next(e[t]);
3499
+ n.complete();
3500
+ });
3501
+ }
3502
+ function hs(e) {
3503
+ return new Z(function(n) {
3504
+ e.then(function(t) {
3505
+ n.closed || (n.next(t), n.complete());
3506
+ }, function(t) {
3507
+ return n.error(t);
3508
+ }).then(null, Ui);
3509
+ });
3510
+ }
3511
+ function cs(e) {
3512
+ return new Z(function(n) {
3513
+ var t, i;
3514
+ try {
3515
+ for (var r = Fe(e), a = r.next(); !a.done; a = r.next()) {
3516
+ var o = a.value;
3517
+ if (n.next(o), n.closed)
3518
+ return;
3519
+ }
3520
+ } catch (l) {
3521
+ t = { error: l };
3522
+ } finally {
3523
+ try {
3524
+ a && !a.done && (i = r.return) && i.call(r);
3525
+ } finally {
3526
+ if (t)
3527
+ throw t.error;
3528
+ }
3529
+ }
3530
+ n.complete();
3531
+ });
3532
+ }
3533
+ function Yi(e) {
3534
+ return new Z(function(n) {
3535
+ ps(e, n).catch(function(t) {
3536
+ return n.error(t);
3537
+ });
3538
+ });
3539
+ }
3540
+ function ds(e) {
3541
+ return Yi(ji(e));
3542
+ }
3543
+ function ps(e, n) {
3544
+ var t, i, r, a;
3545
+ return jo(this, void 0, void 0, function() {
3546
+ var o, l;
3547
+ return Oi(this, function(u) {
3548
+ switch (u.label) {
3549
+ case 0:
3550
+ u.trys.push([0, 5, 6, 11]), t = Yo(e), u.label = 1;
3551
+ case 1:
3552
+ return [4, t.next()];
3553
+ case 2:
3554
+ if (i = u.sent(), !!i.done)
3555
+ return [3, 4];
3556
+ if (o = i.value, n.next(o), n.closed)
3557
+ return [2];
3558
+ u.label = 3;
3559
+ case 3:
3560
+ return [3, 1];
3561
+ case 4:
3562
+ return [3, 11];
3563
+ case 5:
3564
+ return l = u.sent(), r = { error: l }, [3, 11];
3565
+ case 6:
3566
+ return u.trys.push([6, , 9, 10]), i && !i.done && (a = t.return) ? [4, a.call(t)] : [3, 8];
3567
+ case 7:
3568
+ u.sent(), u.label = 8;
3569
+ case 8:
3570
+ return [3, 10];
3571
+ case 9:
3572
+ if (r)
3573
+ throw r.error;
3574
+ return [7];
3575
+ case 10:
3576
+ return [7];
3577
+ case 11:
3578
+ return n.complete(), [2];
3579
+ }
3580
+ });
3581
+ });
3582
+ }
3583
+ function re(e, n, t, i, r) {
3584
+ i === void 0 && (i = 0), r === void 0 && (r = !1);
3585
+ var a = n.schedule(function() {
3586
+ t(), r ? e.add(this.schedule(null, i)) : this.unsubscribe();
3587
+ }, i);
3588
+ if (e.add(a), !r)
3589
+ return a;
3590
+ }
3591
+ function Ki(e, n) {
3592
+ return n === void 0 && (n = 0), $e(function(t, i) {
3593
+ t.subscribe(Pe(i, function(r) {
3594
+ return re(i, e, function() {
3595
+ return i.next(r);
3596
+ }, n);
3597
+ }, function() {
3598
+ return re(i, e, function() {
3599
+ return i.complete();
3600
+ }, n);
3601
+ }, function(r) {
3602
+ return re(i, e, function() {
3603
+ return i.error(r);
3604
+ }, n);
3605
+ }));
3606
+ });
3607
+ }
3608
+ function Wi(e, n) {
3609
+ return n === void 0 && (n = 0), $e(function(t, i) {
3610
+ i.add(e.schedule(function() {
3611
+ return t.subscribe(i);
3612
+ }, n));
3613
+ });
3614
+ }
3615
+ function _s(e, n) {
3616
+ return Ee(e).pipe(Wi(n), Ki(n));
3617
+ }
3618
+ function bs(e, n) {
3619
+ return Ee(e).pipe(Wi(n), Ki(n));
3620
+ }
3621
+ function gs(e, n) {
3622
+ return new Z(function(t) {
3623
+ var i = 0;
3624
+ return n.schedule(function() {
3625
+ i === e.length ? t.complete() : (t.next(e[i++]), t.closed || this.schedule());
3626
+ });
3627
+ });
3628
+ }
3629
+ function ws(e, n) {
3630
+ return new Z(function(t) {
3631
+ var i;
3632
+ return re(t, n, function() {
3633
+ i = e[Mi](), re(t, n, function() {
3634
+ var r, a, o;
3635
+ try {
3636
+ r = i.next(), a = r.value, o = r.done;
3637
+ } catch (l) {
3638
+ t.error(l);
3639
+ return;
3640
+ }
3641
+ o ? t.complete() : t.next(a);
3642
+ }, 0, !0);
3643
+ }), function() {
3644
+ return z(i == null ? void 0 : i.return) && i.return();
3645
+ };
3646
+ });
3647
+ }
3648
+ function Xi(e, n) {
3649
+ if (!e)
3650
+ throw new Error("Iterable cannot be null");
3651
+ return new Z(function(t) {
3652
+ re(t, n, function() {
3653
+ var i = e[Symbol.asyncIterator]();
3654
+ re(t, n, function() {
3655
+ i.next().then(function(r) {
3656
+ r.done ? t.complete() : t.next(r.value);
3657
+ });
3658
+ }, 0, !0);
3659
+ });
3660
+ });
3661
+ }
3662
+ function ms(e, n) {
3663
+ return Xi(ji(e), n);
3664
+ }
3665
+ function ys(e, n) {
3666
+ if (e != null) {
3667
+ if (Pi(e))
3668
+ return _s(e, n);
3669
+ if (Li(e))
3670
+ return gs(e, n);
3671
+ if (Fi(e))
3672
+ return bs(e, n);
3673
+ if (Zi(e))
3674
+ return Xi(e, n);
3675
+ if (Hi(e))
3676
+ return ws(e, n);
3677
+ if (Gi(e))
3678
+ return ms(e, n);
3679
+ }
3680
+ throw xi(e);
3681
+ }
3682
+ function vs(e, n) {
3683
+ return n ? ys(e, n) : Ee(e);
3684
+ }
3685
+ var ks = zi(function(e) {
3686
+ return function() {
3687
+ e(this), this.name = "EmptyError", this.message = "no elements in sequence";
3688
+ };
3689
+ });
3690
+ function qi(e, n) {
3691
+ var t = typeof n == "object";
3692
+ return new Promise(function(i, r) {
3693
+ var a = new lt({
3694
+ next: function(o) {
3695
+ i(o), a.unsubscribe();
3696
+ },
3697
+ error: r,
3698
+ complete: function() {
3699
+ t ? i(n.defaultValue) : r(new ks());
3700
+ }
3701
+ });
3702
+ e.subscribe(a);
3703
+ });
3704
+ }
3705
+ function Ji(e, n) {
3706
+ return $e(function(t, i) {
3707
+ var r = 0;
3708
+ t.subscribe(Pe(i, function(a) {
3709
+ i.next(e.call(n, a, r++));
3710
+ }));
3711
+ });
3712
+ }
3713
+ function $s(e, n, t, i, r, a, o, l) {
3714
+ var u = [], s = 0, f = 0, d = !1, c = function() {
3715
+ d && !u.length && !s && n.complete();
3716
+ }, h = function(g) {
3717
+ return s < i ? _(g) : u.push(g);
3718
+ }, _ = function(g) {
3719
+ a && n.next(g), s++;
3720
+ var k = !1;
3721
+ Ee(t(g, f++)).subscribe(Pe(n, function(y) {
3722
+ r == null || r(y), a ? h(y) : n.next(y);
3723
+ }, function() {
3724
+ k = !0;
3725
+ }, void 0, function() {
3726
+ if (k)
3727
+ try {
3728
+ s--;
3729
+ for (var y = function() {
3730
+ var E = u.shift();
3731
+ o ? re(n, o, function() {
3732
+ return _(E);
3733
+ }) : _(E);
3734
+ }; u.length && s < i; )
3735
+ y();
3736
+ c();
3737
+ } catch (E) {
3738
+ n.error(E);
3739
+ }
3740
+ }));
3741
+ };
3742
+ return e.subscribe(Pe(n, h, function() {
3743
+ d = !0, c();
3744
+ })), function() {
3745
+ l == null || l();
3746
+ };
3747
+ }
3748
+ function Qi(e, n, t) {
3749
+ return t === void 0 && (t = 1 / 0), z(n) ? Qi(function(i, r) {
3750
+ return Ji(function(a, o) {
3751
+ return n(i, a, r, o);
3752
+ })(Ee(e(i, r)));
3753
+ }, t) : (typeof n == "number" && (t = n), $e(function(i, r) {
3754
+ return $s(i, r, e, t);
3755
+ }));
3756
+ }
3757
+ function Es(e) {
3758
+ return e === void 0 && (e = 1 / 0), Qi(Di, e);
3759
+ }
3760
+ function Cs() {
3761
+ for (var e = [], n = 0; n < arguments.length; n++)
3762
+ e[n] = arguments[n];
3763
+ var t = os(e), i = ss(e, 1 / 0), r = e;
3764
+ return r.length ? r.length === 1 ? Ee(r[0]) : Es(i)(vs(r, t)) : rs;
3765
+ }
3766
+ function Ss(e, n, t, i, r) {
3767
+ return function(a, o) {
3768
+ var l = t, u = n, s = 0;
3769
+ a.subscribe(Pe(o, function(f) {
3770
+ var d = s++;
3771
+ u = l ? e(u, f, d) : (l = !0, f), i && o.next(u);
3772
+ }, r && function() {
3773
+ l && o.next(u), o.complete();
3774
+ }));
3775
+ };
3776
+ }
3777
+ function er(e, n) {
3778
+ return $e(Ss(e, n, arguments.length >= 2, !1, !0));
3779
+ }
3780
+ var Ns = function(e, n) {
3781
+ return e.push(n), e;
3782
+ };
3783
+ function Ts() {
3784
+ return $e(function(e, n) {
3785
+ er(Ns, [])(e).subscribe(n);
3786
+ });
3787
+ }
3788
+ const jn = -2003829722, At = -2021002517;
3789
+ function Is(e) {
3790
+ return new TextDecoder().decode(e);
3791
+ }
3792
+ function Gn(e) {
3793
+ const n = e ? "big" : "little", t = new N().endianess(n).int32("magic").uint16("version").uint16("numZoomLevels").uint64("chromTreeOffset").uint64("unzoomedDataOffset").uint64("unzoomedIndexOffset").uint16("fieldCount").uint16("definedFieldCount").uint64("asOffset").uint64("totalSummaryOffset").uint32("uncompressBufSize").uint64("extHeaderOffset").array("zoomLevels", {
3794
+ length: "numZoomLevels",
3795
+ type: new N().endianess(n).uint32("reductionLevel").uint32("reserved").uint64("dataOffset").uint64("indexOffset")
3796
+ }), i = new N().endianess(n).uint64("basesCovered").doublele("scoreMin").doublele("scoreMax").doublele("scoreSum").doublele("scoreSumSquares"), r = new N().endianess(n).uint32("magic").uint32("blockSize").uint32("keySize").uint32("valSize").uint64("itemCount"), a = new N().endianess(n).uint8("isLeafNode").skip(1).uint16("cnt").saveOffset("offset");
3797
+ return {
3798
+ chromTreeParser: r,
3799
+ totalSummaryParser: i,
3800
+ headerParser: t,
3801
+ isLeafNode: a
3802
+ };
3803
+ }
3804
+ class tr {
3805
+ /* fetch and parse header information from a bigwig or bigbed file
3806
+ * @param abortSignal - abort the operation, can be null
3807
+ * @return a Header object
3808
+ */
3809
+ getHeader(n) {
3810
+ return this.headerP || (this.headerP = this._getHeader(n).catch((t) => {
3811
+ throw this.headerP = void 0, t;
3812
+ })), this.headerP;
3813
+ }
3814
+ /*
3815
+ * @param filehandle - a filehandle from generic-filehandle or implementing something similar to the node10 fs.promises API
3816
+ * @param path - a Local file path as a string
3817
+ * @param url - a URL string
3818
+ * @param renameRefSeqs - an optional method to rename the internal reference sequences using a mapping function
3819
+ */
3820
+ constructor(n) {
3821
+ const { filehandle: t, renameRefSeqs: i = (o) => o, path: r, url: a } = n;
3822
+ if (this.renameRefSeqs = i, t)
3823
+ this.bbi = t;
3824
+ else if (a)
3825
+ this.bbi = new ir(a);
3826
+ else if (r)
3827
+ this.bbi = new nr(r);
3828
+ else
3829
+ throw new Error("no file given");
3830
+ }
3831
+ async _getHeader(n) {
3832
+ const t = await this._getMainHeader(n), i = await this._readChromTree(t, n);
3833
+ return { ...t, ...i };
3834
+ }
3835
+ async _getMainHeader(n, t = 2e3) {
3836
+ const { buffer: i } = await this.bbi.read(Q.Buffer.alloc(t), 0, t, 0, n), r = this._isBigEndian(i), a = Gn(r), o = a.headerParser.parse(i), { magic: l, asOffset: u, totalSummaryOffset: s } = o;
3837
+ if (o.fileType = l === At ? "bigbed" : "bigwig", u > t || s > t)
3838
+ return this._getMainHeader(n, t * 2);
3839
+ if (u) {
3840
+ const f = Number(o.asOffset);
3841
+ o.autoSql = Is(i.subarray(f, i.indexOf(0, f)));
3842
+ }
3843
+ if (o.totalSummaryOffset > t)
3844
+ return this._getMainHeader(n, t * 2);
3845
+ if (o.totalSummaryOffset) {
3846
+ const f = i.subarray(Number(o.totalSummaryOffset)), d = a.totalSummaryParser.parse(f);
3847
+ o.totalSummary = { ...d, basesCovered: Number(d.basesCovered) };
3848
+ }
3849
+ return { ...o, isBigEndian: r };
3850
+ }
3851
+ _isBigEndian(n) {
3852
+ let t = n.readInt32LE(0);
3853
+ if (t === jn || t === At)
3854
+ return !1;
3855
+ if (t = n.readInt32BE(0), t === jn || t === At)
3856
+ return !0;
3857
+ throw new Error("not a BigWig/BigBed file");
3858
+ }
3859
+ // todo: add progress if long running
3860
+ async _readChromTree(n, t) {
3861
+ const i = n.isBigEndian, r = i ? "big" : "little", a = [], o = {};
3862
+ let l = Number(n.unzoomedDataOffset);
3863
+ const u = Number(n.chromTreeOffset);
3864
+ for (; l % 4 !== 0; )
3865
+ l += 1;
3866
+ const s = l - u, { buffer: f } = await this.bbi.read(Q.Buffer.alloc(s), 0, s, Number(u), t), d = Gn(i), { keySize: c } = d.chromTreeParser.parse(f), h = new N().endianess(r).string("key", { stripNull: !0, length: c }).uint32("refId").uint32("refSize").saveOffset("offset"), _ = new N().endianess(r).skip(c).uint64("childOffset").saveOffset("offset"), g = 32, k = async (y) => {
3867
+ let E = y;
3868
+ if (E >= f.length)
3869
+ throw new Error("reading beyond end of buffer");
3870
+ const C = d.isLeafNode.parse(f.subarray(E)), { isLeafNode: p, cnt: $ } = C;
3871
+ if (E += C.offset, p)
3872
+ for (let S = 0; S < $; S += 1) {
3873
+ const b = h.parse(f.subarray(E));
3874
+ E += b.offset;
3875
+ const { key: w, refId: m, refSize: v } = b, T = { name: w, id: m, length: v };
3876
+ o[this.renameRefSeqs(w)] = m, a[m] = T;
3877
+ }
3878
+ else {
3879
+ const S = [];
3880
+ for (let b = 0; b < $; b += 1) {
3881
+ const w = _.parse(f.subarray(E)), { childOffset: m } = w;
3882
+ E += w.offset, S.push(k(Number(m) - Number(u)));
3883
+ }
3884
+ await Promise.all(S);
3885
+ }
3886
+ };
3887
+ return await k(g), {
3888
+ refsByName: o,
3889
+ refsByNumber: a
3890
+ };
3891
+ }
3892
+ /*
3893
+ * fetches the "unzoomed" view of the bigwig data. this is the default for bigbed
3894
+ * @param abortSignal - a signal to optionally abort this operation
3895
+ */
3896
+ async getUnzoomedView(n) {
3897
+ const { unzoomedIndexOffset: t, refsByName: i, uncompressBufSize: r, isBigEndian: a, fileType: o } = await this.getHeader(n);
3898
+ return new Ai(this.bbi, i, t, a, r > 0, o);
3899
+ }
3900
+ /**
3901
+ * Gets features from a BigWig file
3902
+ *
3903
+ * @param refName - The chromosome name
3904
+ * @param start - The start of a region
3905
+ * @param end - The end of a region
3906
+ * @param opts - An object containing basesPerSpan (e.g. pixels per basepair) or scale used to infer the zoomLevel to use
3907
+ */
3908
+ async getFeatureStream(n, t, i, r) {
3909
+ await this.getHeader(r);
3910
+ const a = this.renameRefSeqs(n);
3911
+ let o;
3912
+ const { basesPerSpan: l, scale: u } = r || {};
3913
+ return l ? o = await this.getView(1 / l, r) : u ? o = await this.getView(u, r) : o = await this.getView(1, r), new Z((s) => {
3914
+ o.readWigData(a, t, i, s, r);
3915
+ });
3916
+ }
3917
+ async getFeatures(n, t, i, r) {
3918
+ const a = await this.getFeatureStream(n, t, i, r);
3919
+ return (await qi(a.pipe(Ts()))).flat();
3920
+ }
3921
+ }
3922
+ class Fs extends tr {
3923
+ /**
3924
+ * Retrieves a BlockView of a specific zoomLevel
3925
+ *
3926
+ * @param scale - number
3927
+ * @param opts - An object containing basesPerSpan (e.g. pixels per basepair) or scale used to infer the zoomLevel to use
3928
+ */
3929
+ async getView(n, t) {
3930
+ const { zoomLevels: i, refsByName: r, fileSize: a, isBigEndian: o, uncompressBufSize: l } = await this.getHeader(t), u = 1 / n;
3931
+ let s = i.length;
3932
+ a || (s -= 1);
3933
+ for (let f = s; f >= 0; f -= 1) {
3934
+ const d = i[f];
3935
+ if (d && d.reductionLevel <= 2 * u) {
3936
+ const c = Number(d.indexOffset);
3937
+ return new Ai(this.bbi, r, c, o, l > 0, "summary");
3938
+ }
3939
+ }
3940
+ return this.getUnzoomedView(t);
3941
+ }
3942
+ }
3943
+ function As(e) {
3944
+ return e.filter((n) => !!n);
3945
+ }
3946
+ class Ps extends tr {
3947
+ constructor() {
3948
+ super(...arguments), this.readIndicesCache = new Yn({
3949
+ cache: new Kn({ maxSize: 1 }),
3950
+ fill: (n, t) => this._readIndices({ ...n, signal: t })
3951
+ });
3952
+ }
3953
+ readIndices(n = {}) {
3954
+ const { signal: t, ...i } = n;
3955
+ return this.readIndicesCache.get(JSON.stringify(i), n, t);
3956
+ }
3957
+ /*
3958
+ * retrieve unzoomed view for any scale
3959
+ */
3960
+ async getView(n, t) {
3961
+ return this.getUnzoomedView(t);
3962
+ }
3963
+ /*
3964
+ * parse the bigbed extraIndex fields
3965
+ * @param abortSignal to abort operation
3966
+ * @return a Promise for an array of Index data structure since there can be multiple extraIndexes in a bigbed, see bedToBigBed documentation
3967
+ */
3968
+ async _readIndices(n) {
3969
+ const { extHeaderOffset: t, isBigEndian: i } = await this.getHeader(n), { buffer: r } = await this.bbi.read(Q.Buffer.alloc(64), 0, 64, Number(t)), a = i ? "big" : "little", o = new N().endianess(a).uint16("size").uint16("count").uint64("offset").parse(r), { count: l, offset: u } = o;
3970
+ if (l === 0)
3971
+ return [];
3972
+ const s = 20, f = s * l, { buffer: d } = await this.bbi.read(Q.Buffer.alloc(f), 0, f, Number(u)), c = new N().endianess(a).int16("type").int16("fieldcount").uint64("offset").skip(4).int16("field"), h = [];
3973
+ for (let _ = 0; _ < l; _ += 1)
3974
+ h.push(c.parse(d.subarray(_ * s)));
3975
+ return h;
3976
+ }
3977
+ /*
3978
+ * perform a search in the bigbed extraIndex to find which blocks in the bigbed data to look for the
3979
+ * actual feature data
3980
+ *
3981
+ * @param name - the name to search for
3982
+ * @param opts - a SearchOptions argument with optional signal
3983
+ * @return a Promise for an array of bigbed block Loc entries
3984
+ */
3985
+ async searchExtraIndexBlocks(n, t = {}) {
3986
+ const { isBigEndian: i } = await this.getHeader(t), r = await this.readIndices(t);
3987
+ if (r.length === 0)
3988
+ return [];
3989
+ const a = r.map(async (o) => {
3990
+ const { offset: l, field: u } = o, { buffer: s } = await this.bbi.read(Q.Buffer.alloc(32), 0, 32, Number(l), t), f = i ? "big" : "little", d = new N().endianess(f).int32("magic").int32("blockSize").int32("keySize").int32("valSize").uint64("itemCount"), { blockSize: c, keySize: h, valSize: _ } = d.parse(s), g = new N().endianess(f).int8("nodeType").skip(1).int16("cnt").choice({
3991
+ tag: "nodeType",
3992
+ choices: {
3993
+ 0: new N().array("leafkeys", {
3994
+ length: "cnt",
3995
+ type: new N().endianess(f).string("key", { length: h, stripNull: !0 }).uint64("offset")
3996
+ }),
3997
+ 1: new N().array("keys", {
3998
+ length: "cnt",
3999
+ type: new N().endianess(f).string("key", { length: h, stripNull: !0 }).uint64("offset").uint32("length").uint32("reserved")
4000
+ })
4001
+ }
4002
+ }), k = async (E) => {
4003
+ const C = Number(E), p = 4 + c * (h + _), { buffer: $ } = await this.bbi.read(Q.Buffer.alloc(p), 0, p, C, t), S = g.parse($);
4004
+ if (S.leafkeys) {
4005
+ let b;
4006
+ for (let w = 0; w < S.leafkeys.length; w += 1) {
4007
+ const { key: m } = S.leafkeys[w];
4008
+ if (n.localeCompare(m) < 0 && b)
4009
+ return k(b);
4010
+ b = S.leafkeys[w].offset;
4011
+ }
4012
+ return k(b);
4013
+ }
4014
+ for (let b = 0; b < S.keys.length; b += 1)
4015
+ if (S.keys[b].key === n)
4016
+ return { ...S.keys[b], field: u };
4017
+ }, y = 32;
4018
+ return k(Number(l) + y);
4019
+ });
4020
+ return As(await Promise.all(a));
4021
+ }
4022
+ /*
4023
+ * retrieve the features from the bigbed data that were found through the lookup of the extraIndex
4024
+ * note that there can be multiple extraIndex, see the BigBed specification and the -extraIndex argument to bedToBigBed
4025
+ *
4026
+ * @param name - the name to search for
4027
+ * @param opts - a SearchOptions argument with optional signal
4028
+ * @return a Promise for an array of Feature
4029
+ */
4030
+ async searchExtraIndex(n, t = {}) {
4031
+ const i = await this.searchExtraIndexBlocks(n, t);
4032
+ if (i.length === 0)
4033
+ return [];
4034
+ const r = await this.getUnzoomedView(t), a = i.map((l) => new Z((u) => {
4035
+ r.readFeatures(u, [l], t);
4036
+ }).pipe(er((u, s) => u.concat(s)), Ji((u) => {
4037
+ for (const s of u)
4038
+ s.field = l.field;
4039
+ return u;
4040
+ })));
4041
+ return (await qi(Cs(...a))).filter((l) => {
4042
+ var u;
4043
+ return ((u = l.rest) === null || u === void 0 ? void 0 : u.split(" ")[(l.field || 0) - 3]) === n;
4044
+ });
4045
+ }
4046
+ }
4047
+ export {
4048
+ Ps as BigBed,
4049
+ Fs as BigWig
4050
+ };