@vitessce/all 3.3.6 → 3.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4066 +0,0 @@
1
- /*! pako 2.0.3 https://github.com/nodeca/pako @license (MIT AND Zlib) */
2
- const Z_FIXED = 4;
3
- const Z_BINARY = 0;
4
- const Z_TEXT = 1;
5
- const Z_UNKNOWN = 2;
6
- function zero(buf) {
7
- let len = buf.length;
8
- while (--len >= 0) {
9
- buf[len] = 0;
10
- }
11
- }
12
- const STORED_BLOCK = 0;
13
- const STATIC_TREES = 1;
14
- const DYN_TREES = 2;
15
- const MIN_MATCH = 3;
16
- const MAX_MATCH = 258;
17
- const LENGTH_CODES = 29;
18
- const LITERALS = 256;
19
- const L_CODES = LITERALS + 1 + LENGTH_CODES;
20
- const D_CODES = 30;
21
- const BL_CODES = 19;
22
- const HEAP_SIZE = 2 * L_CODES + 1;
23
- const MAX_BITS = 15;
24
- const Buf_size = 16;
25
- const MAX_BL_BITS = 7;
26
- const END_BLOCK = 256;
27
- const REP_3_6 = 16;
28
- const REPZ_3_10 = 17;
29
- const REPZ_11_138 = 18;
30
- const extra_lbits = (
31
- /* extra bits for each length code */
32
- 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])
33
- );
34
- const extra_dbits = (
35
- /* extra bits for each distance code */
36
- 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])
37
- );
38
- const extra_blbits = (
39
- /* extra bits for each bit length code */
40
- new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7])
41
- );
42
- const bl_order = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
43
- const DIST_CODE_LEN = 512;
44
- const static_ltree = new Array((L_CODES + 2) * 2);
45
- zero(static_ltree);
46
- const static_dtree = new Array(D_CODES * 2);
47
- zero(static_dtree);
48
- const _dist_code = new Array(DIST_CODE_LEN);
49
- zero(_dist_code);
50
- const _length_code = new Array(MAX_MATCH - MIN_MATCH + 1);
51
- zero(_length_code);
52
- const base_length = new Array(LENGTH_CODES);
53
- zero(base_length);
54
- const base_dist = new Array(D_CODES);
55
- zero(base_dist);
56
- function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {
57
- this.static_tree = static_tree;
58
- this.extra_bits = extra_bits;
59
- this.extra_base = extra_base;
60
- this.elems = elems;
61
- this.max_length = max_length;
62
- this.has_stree = static_tree && static_tree.length;
63
- }
64
- let static_l_desc;
65
- let static_d_desc;
66
- let static_bl_desc;
67
- function TreeDesc(dyn_tree, stat_desc) {
68
- this.dyn_tree = dyn_tree;
69
- this.max_code = 0;
70
- this.stat_desc = stat_desc;
71
- }
72
- const d_code = (dist) => {
73
- return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];
74
- };
75
- const put_short = (s, w) => {
76
- s.pending_buf[s.pending++] = w & 255;
77
- s.pending_buf[s.pending++] = w >>> 8 & 255;
78
- };
79
- const send_bits = (s, value, length) => {
80
- if (s.bi_valid > Buf_size - length) {
81
- s.bi_buf |= value << s.bi_valid & 65535;
82
- put_short(s, s.bi_buf);
83
- s.bi_buf = value >> Buf_size - s.bi_valid;
84
- s.bi_valid += length - Buf_size;
85
- } else {
86
- s.bi_buf |= value << s.bi_valid & 65535;
87
- s.bi_valid += length;
88
- }
89
- };
90
- const send_code = (s, c, tree) => {
91
- send_bits(
92
- s,
93
- tree[c * 2],
94
- tree[c * 2 + 1]
95
- /*.Len*/
96
- );
97
- };
98
- const bi_reverse = (code, len) => {
99
- let res = 0;
100
- do {
101
- res |= code & 1;
102
- code >>>= 1;
103
- res <<= 1;
104
- } while (--len > 0);
105
- return res >>> 1;
106
- };
107
- const bi_flush = (s) => {
108
- if (s.bi_valid === 16) {
109
- put_short(s, s.bi_buf);
110
- s.bi_buf = 0;
111
- s.bi_valid = 0;
112
- } else if (s.bi_valid >= 8) {
113
- s.pending_buf[s.pending++] = s.bi_buf & 255;
114
- s.bi_buf >>= 8;
115
- s.bi_valid -= 8;
116
- }
117
- };
118
- const gen_bitlen = (s, desc) => {
119
- const tree = desc.dyn_tree;
120
- const max_code = desc.max_code;
121
- const stree = desc.stat_desc.static_tree;
122
- const has_stree = desc.stat_desc.has_stree;
123
- const extra = desc.stat_desc.extra_bits;
124
- const base = desc.stat_desc.extra_base;
125
- const max_length = desc.stat_desc.max_length;
126
- let h;
127
- let n, m;
128
- let bits;
129
- let xbits;
130
- let f;
131
- let overflow = 0;
132
- for (bits = 0; bits <= MAX_BITS; bits++) {
133
- s.bl_count[bits] = 0;
134
- }
135
- tree[s.heap[s.heap_max] * 2 + 1] = 0;
136
- for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {
137
- n = s.heap[h];
138
- bits = tree[tree[n * 2 + 1] * 2 + 1] + 1;
139
- if (bits > max_length) {
140
- bits = max_length;
141
- overflow++;
142
- }
143
- tree[n * 2 + 1] = bits;
144
- if (n > max_code) {
145
- continue;
146
- }
147
- s.bl_count[bits]++;
148
- xbits = 0;
149
- if (n >= base) {
150
- xbits = extra[n - base];
151
- }
152
- f = tree[n * 2];
153
- s.opt_len += f * (bits + xbits);
154
- if (has_stree) {
155
- s.static_len += f * (stree[n * 2 + 1] + xbits);
156
- }
157
- }
158
- if (overflow === 0) {
159
- return;
160
- }
161
- do {
162
- bits = max_length - 1;
163
- while (s.bl_count[bits] === 0) {
164
- bits--;
165
- }
166
- s.bl_count[bits]--;
167
- s.bl_count[bits + 1] += 2;
168
- s.bl_count[max_length]--;
169
- overflow -= 2;
170
- } while (overflow > 0);
171
- for (bits = max_length; bits !== 0; bits--) {
172
- n = s.bl_count[bits];
173
- while (n !== 0) {
174
- m = s.heap[--h];
175
- if (m > max_code) {
176
- continue;
177
- }
178
- if (tree[m * 2 + 1] !== bits) {
179
- s.opt_len += (bits - tree[m * 2 + 1]) * tree[m * 2];
180
- tree[m * 2 + 1] = bits;
181
- }
182
- n--;
183
- }
184
- }
185
- };
186
- const gen_codes = (tree, max_code, bl_count) => {
187
- const next_code = new Array(MAX_BITS + 1);
188
- let code = 0;
189
- let bits;
190
- let n;
191
- for (bits = 1; bits <= MAX_BITS; bits++) {
192
- next_code[bits] = code = code + bl_count[bits - 1] << 1;
193
- }
194
- for (n = 0; n <= max_code; n++) {
195
- let len = tree[n * 2 + 1];
196
- if (len === 0) {
197
- continue;
198
- }
199
- tree[n * 2] = bi_reverse(next_code[len]++, len);
200
- }
201
- };
202
- const tr_static_init = () => {
203
- let n;
204
- let bits;
205
- let length;
206
- let code;
207
- let dist;
208
- const bl_count = new Array(MAX_BITS + 1);
209
- length = 0;
210
- for (code = 0; code < LENGTH_CODES - 1; code++) {
211
- base_length[code] = length;
212
- for (n = 0; n < 1 << extra_lbits[code]; n++) {
213
- _length_code[length++] = code;
214
- }
215
- }
216
- _length_code[length - 1] = code;
217
- dist = 0;
218
- for (code = 0; code < 16; code++) {
219
- base_dist[code] = dist;
220
- for (n = 0; n < 1 << extra_dbits[code]; n++) {
221
- _dist_code[dist++] = code;
222
- }
223
- }
224
- dist >>= 7;
225
- for (; code < D_CODES; code++) {
226
- base_dist[code] = dist << 7;
227
- for (n = 0; n < 1 << extra_dbits[code] - 7; n++) {
228
- _dist_code[256 + dist++] = code;
229
- }
230
- }
231
- for (bits = 0; bits <= MAX_BITS; bits++) {
232
- bl_count[bits] = 0;
233
- }
234
- n = 0;
235
- while (n <= 143) {
236
- static_ltree[n * 2 + 1] = 8;
237
- n++;
238
- bl_count[8]++;
239
- }
240
- while (n <= 255) {
241
- static_ltree[n * 2 + 1] = 9;
242
- n++;
243
- bl_count[9]++;
244
- }
245
- while (n <= 279) {
246
- static_ltree[n * 2 + 1] = 7;
247
- n++;
248
- bl_count[7]++;
249
- }
250
- while (n <= 287) {
251
- static_ltree[n * 2 + 1] = 8;
252
- n++;
253
- bl_count[8]++;
254
- }
255
- gen_codes(static_ltree, L_CODES + 1, bl_count);
256
- for (n = 0; n < D_CODES; n++) {
257
- static_dtree[n * 2 + 1] = 5;
258
- static_dtree[n * 2] = bi_reverse(n, 5);
259
- }
260
- static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);
261
- static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);
262
- static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);
263
- };
264
- const init_block = (s) => {
265
- let n;
266
- for (n = 0; n < L_CODES; n++) {
267
- s.dyn_ltree[n * 2] = 0;
268
- }
269
- for (n = 0; n < D_CODES; n++) {
270
- s.dyn_dtree[n * 2] = 0;
271
- }
272
- for (n = 0; n < BL_CODES; n++) {
273
- s.bl_tree[n * 2] = 0;
274
- }
275
- s.dyn_ltree[END_BLOCK * 2] = 1;
276
- s.opt_len = s.static_len = 0;
277
- s.last_lit = s.matches = 0;
278
- };
279
- const bi_windup = (s) => {
280
- if (s.bi_valid > 8) {
281
- put_short(s, s.bi_buf);
282
- } else if (s.bi_valid > 0) {
283
- s.pending_buf[s.pending++] = s.bi_buf;
284
- }
285
- s.bi_buf = 0;
286
- s.bi_valid = 0;
287
- };
288
- const copy_block = (s, buf, len, header) => {
289
- bi_windup(s);
290
- if (header) {
291
- put_short(s, len);
292
- put_short(s, ~len);
293
- }
294
- s.pending_buf.set(s.window.subarray(buf, buf + len), s.pending);
295
- s.pending += len;
296
- };
297
- const smaller = (tree, n, m, depth) => {
298
- const _n2 = n * 2;
299
- const _m2 = m * 2;
300
- return tree[_n2] < tree[_m2] || tree[_n2] === tree[_m2] && depth[n] <= depth[m];
301
- };
302
- const pqdownheap = (s, tree, k) => {
303
- const v = s.heap[k];
304
- let j = k << 1;
305
- while (j <= s.heap_len) {
306
- if (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {
307
- j++;
308
- }
309
- if (smaller(tree, v, s.heap[j], s.depth)) {
310
- break;
311
- }
312
- s.heap[k] = s.heap[j];
313
- k = j;
314
- j <<= 1;
315
- }
316
- s.heap[k] = v;
317
- };
318
- const compress_block = (s, ltree, dtree) => {
319
- let dist;
320
- let lc;
321
- let lx = 0;
322
- let code;
323
- let extra;
324
- if (s.last_lit !== 0) {
325
- do {
326
- dist = s.pending_buf[s.d_buf + lx * 2] << 8 | s.pending_buf[s.d_buf + lx * 2 + 1];
327
- lc = s.pending_buf[s.l_buf + lx];
328
- lx++;
329
- if (dist === 0) {
330
- send_code(s, lc, ltree);
331
- } else {
332
- code = _length_code[lc];
333
- send_code(s, code + LITERALS + 1, ltree);
334
- extra = extra_lbits[code];
335
- if (extra !== 0) {
336
- lc -= base_length[code];
337
- send_bits(s, lc, extra);
338
- }
339
- dist--;
340
- code = d_code(dist);
341
- send_code(s, code, dtree);
342
- extra = extra_dbits[code];
343
- if (extra !== 0) {
344
- dist -= base_dist[code];
345
- send_bits(s, dist, extra);
346
- }
347
- }
348
- } while (lx < s.last_lit);
349
- }
350
- send_code(s, END_BLOCK, ltree);
351
- };
352
- const build_tree = (s, desc) => {
353
- const tree = desc.dyn_tree;
354
- const stree = desc.stat_desc.static_tree;
355
- const has_stree = desc.stat_desc.has_stree;
356
- const elems = desc.stat_desc.elems;
357
- let n, m;
358
- let max_code = -1;
359
- let node;
360
- s.heap_len = 0;
361
- s.heap_max = HEAP_SIZE;
362
- for (n = 0; n < elems; n++) {
363
- if (tree[n * 2] !== 0) {
364
- s.heap[++s.heap_len] = max_code = n;
365
- s.depth[n] = 0;
366
- } else {
367
- tree[n * 2 + 1] = 0;
368
- }
369
- }
370
- while (s.heap_len < 2) {
371
- node = s.heap[++s.heap_len] = max_code < 2 ? ++max_code : 0;
372
- tree[node * 2] = 1;
373
- s.depth[node] = 0;
374
- s.opt_len--;
375
- if (has_stree) {
376
- s.static_len -= stree[node * 2 + 1];
377
- }
378
- }
379
- desc.max_code = max_code;
380
- for (n = s.heap_len >> 1; n >= 1; n--) {
381
- pqdownheap(s, tree, n);
382
- }
383
- node = elems;
384
- do {
385
- n = s.heap[
386
- 1
387
- /*SMALLEST*/
388
- ];
389
- s.heap[
390
- 1
391
- /*SMALLEST*/
392
- ] = s.heap[s.heap_len--];
393
- pqdownheap(
394
- s,
395
- tree,
396
- 1
397
- /*SMALLEST*/
398
- );
399
- m = s.heap[
400
- 1
401
- /*SMALLEST*/
402
- ];
403
- s.heap[--s.heap_max] = n;
404
- s.heap[--s.heap_max] = m;
405
- tree[node * 2] = tree[n * 2] + tree[m * 2];
406
- s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;
407
- tree[n * 2 + 1] = tree[m * 2 + 1] = node;
408
- s.heap[
409
- 1
410
- /*SMALLEST*/
411
- ] = node++;
412
- pqdownheap(
413
- s,
414
- tree,
415
- 1
416
- /*SMALLEST*/
417
- );
418
- } while (s.heap_len >= 2);
419
- s.heap[--s.heap_max] = s.heap[
420
- 1
421
- /*SMALLEST*/
422
- ];
423
- gen_bitlen(s, desc);
424
- gen_codes(tree, max_code, s.bl_count);
425
- };
426
- const scan_tree = (s, tree, max_code) => {
427
- let n;
428
- let prevlen = -1;
429
- let curlen;
430
- let nextlen = tree[0 * 2 + 1];
431
- let count = 0;
432
- let max_count = 7;
433
- let min_count = 4;
434
- if (nextlen === 0) {
435
- max_count = 138;
436
- min_count = 3;
437
- }
438
- tree[(max_code + 1) * 2 + 1] = 65535;
439
- for (n = 0; n <= max_code; n++) {
440
- curlen = nextlen;
441
- nextlen = tree[(n + 1) * 2 + 1];
442
- if (++count < max_count && curlen === nextlen) {
443
- continue;
444
- } else if (count < min_count) {
445
- s.bl_tree[curlen * 2] += count;
446
- } else if (curlen !== 0) {
447
- if (curlen !== prevlen) {
448
- s.bl_tree[curlen * 2]++;
449
- }
450
- s.bl_tree[REP_3_6 * 2]++;
451
- } else if (count <= 10) {
452
- s.bl_tree[REPZ_3_10 * 2]++;
453
- } else {
454
- s.bl_tree[REPZ_11_138 * 2]++;
455
- }
456
- count = 0;
457
- prevlen = curlen;
458
- if (nextlen === 0) {
459
- max_count = 138;
460
- min_count = 3;
461
- } else if (curlen === nextlen) {
462
- max_count = 6;
463
- min_count = 3;
464
- } else {
465
- max_count = 7;
466
- min_count = 4;
467
- }
468
- }
469
- };
470
- const send_tree = (s, tree, max_code) => {
471
- let n;
472
- let prevlen = -1;
473
- let curlen;
474
- let nextlen = tree[0 * 2 + 1];
475
- let count = 0;
476
- let max_count = 7;
477
- let min_count = 4;
478
- if (nextlen === 0) {
479
- max_count = 138;
480
- min_count = 3;
481
- }
482
- for (n = 0; n <= max_code; n++) {
483
- curlen = nextlen;
484
- nextlen = tree[(n + 1) * 2 + 1];
485
- if (++count < max_count && curlen === nextlen) {
486
- continue;
487
- } else if (count < min_count) {
488
- do {
489
- send_code(s, curlen, s.bl_tree);
490
- } while (--count !== 0);
491
- } else if (curlen !== 0) {
492
- if (curlen !== prevlen) {
493
- send_code(s, curlen, s.bl_tree);
494
- count--;
495
- }
496
- send_code(s, REP_3_6, s.bl_tree);
497
- send_bits(s, count - 3, 2);
498
- } else if (count <= 10) {
499
- send_code(s, REPZ_3_10, s.bl_tree);
500
- send_bits(s, count - 3, 3);
501
- } else {
502
- send_code(s, REPZ_11_138, s.bl_tree);
503
- send_bits(s, count - 11, 7);
504
- }
505
- count = 0;
506
- prevlen = curlen;
507
- if (nextlen === 0) {
508
- max_count = 138;
509
- min_count = 3;
510
- } else if (curlen === nextlen) {
511
- max_count = 6;
512
- min_count = 3;
513
- } else {
514
- max_count = 7;
515
- min_count = 4;
516
- }
517
- }
518
- };
519
- const build_bl_tree = (s) => {
520
- let max_blindex;
521
- scan_tree(s, s.dyn_ltree, s.l_desc.max_code);
522
- scan_tree(s, s.dyn_dtree, s.d_desc.max_code);
523
- build_tree(s, s.bl_desc);
524
- for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {
525
- if (s.bl_tree[bl_order[max_blindex] * 2 + 1] !== 0) {
526
- break;
527
- }
528
- }
529
- s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;
530
- return max_blindex;
531
- };
532
- const send_all_trees = (s, lcodes, dcodes, blcodes) => {
533
- let rank2;
534
- send_bits(s, lcodes - 257, 5);
535
- send_bits(s, dcodes - 1, 5);
536
- send_bits(s, blcodes - 4, 4);
537
- for (rank2 = 0; rank2 < blcodes; rank2++) {
538
- send_bits(s, s.bl_tree[bl_order[rank2] * 2 + 1], 3);
539
- }
540
- send_tree(s, s.dyn_ltree, lcodes - 1);
541
- send_tree(s, s.dyn_dtree, dcodes - 1);
542
- };
543
- const detect_data_type = (s) => {
544
- let black_mask = 4093624447;
545
- let n;
546
- for (n = 0; n <= 31; n++, black_mask >>>= 1) {
547
- if (black_mask & 1 && s.dyn_ltree[n * 2] !== 0) {
548
- return Z_BINARY;
549
- }
550
- }
551
- if (s.dyn_ltree[9 * 2] !== 0 || s.dyn_ltree[10 * 2] !== 0 || s.dyn_ltree[13 * 2] !== 0) {
552
- return Z_TEXT;
553
- }
554
- for (n = 32; n < LITERALS; n++) {
555
- if (s.dyn_ltree[n * 2] !== 0) {
556
- return Z_TEXT;
557
- }
558
- }
559
- return Z_BINARY;
560
- };
561
- let static_init_done = false;
562
- const _tr_init = (s) => {
563
- if (!static_init_done) {
564
- tr_static_init();
565
- static_init_done = true;
566
- }
567
- s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);
568
- s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);
569
- s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);
570
- s.bi_buf = 0;
571
- s.bi_valid = 0;
572
- init_block(s);
573
- };
574
- const _tr_stored_block = (s, buf, stored_len, last) => {
575
- send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3);
576
- copy_block(s, buf, stored_len, true);
577
- };
578
- const _tr_align = (s) => {
579
- send_bits(s, STATIC_TREES << 1, 3);
580
- send_code(s, END_BLOCK, static_ltree);
581
- bi_flush(s);
582
- };
583
- const _tr_flush_block = (s, buf, stored_len, last) => {
584
- let opt_lenb, static_lenb;
585
- let max_blindex = 0;
586
- if (s.level > 0) {
587
- if (s.strm.data_type === Z_UNKNOWN) {
588
- s.strm.data_type = detect_data_type(s);
589
- }
590
- build_tree(s, s.l_desc);
591
- build_tree(s, s.d_desc);
592
- max_blindex = build_bl_tree(s);
593
- opt_lenb = s.opt_len + 3 + 7 >>> 3;
594
- static_lenb = s.static_len + 3 + 7 >>> 3;
595
- if (static_lenb <= opt_lenb) {
596
- opt_lenb = static_lenb;
597
- }
598
- } else {
599
- opt_lenb = static_lenb = stored_len + 5;
600
- }
601
- if (stored_len + 4 <= opt_lenb && buf !== -1) {
602
- _tr_stored_block(s, buf, stored_len, last);
603
- } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {
604
- send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);
605
- compress_block(s, static_ltree, static_dtree);
606
- } else {
607
- send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);
608
- send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);
609
- compress_block(s, s.dyn_ltree, s.dyn_dtree);
610
- }
611
- init_block(s);
612
- if (last) {
613
- bi_windup(s);
614
- }
615
- };
616
- const _tr_tally = (s, dist, lc) => {
617
- s.pending_buf[s.d_buf + s.last_lit * 2] = dist >>> 8 & 255;
618
- s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 255;
619
- s.pending_buf[s.l_buf + s.last_lit] = lc & 255;
620
- s.last_lit++;
621
- if (dist === 0) {
622
- s.dyn_ltree[lc * 2]++;
623
- } else {
624
- s.matches++;
625
- dist--;
626
- s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]++;
627
- s.dyn_dtree[d_code(dist) * 2]++;
628
- }
629
- return s.last_lit === s.lit_bufsize - 1;
630
- };
631
- var _tr_init_1 = _tr_init;
632
- var _tr_stored_block_1 = _tr_stored_block;
633
- var _tr_flush_block_1 = _tr_flush_block;
634
- var _tr_tally_1 = _tr_tally;
635
- var _tr_align_1 = _tr_align;
636
- var trees = {
637
- _tr_init: _tr_init_1,
638
- _tr_stored_block: _tr_stored_block_1,
639
- _tr_flush_block: _tr_flush_block_1,
640
- _tr_tally: _tr_tally_1,
641
- _tr_align: _tr_align_1
642
- };
643
- const adler32 = (adler, buf, len, pos) => {
644
- let s1 = adler & 65535 | 0, s2 = adler >>> 16 & 65535 | 0, n = 0;
645
- while (len !== 0) {
646
- n = len > 2e3 ? 2e3 : len;
647
- len -= n;
648
- do {
649
- s1 = s1 + buf[pos++] | 0;
650
- s2 = s2 + s1 | 0;
651
- } while (--n);
652
- s1 %= 65521;
653
- s2 %= 65521;
654
- }
655
- return s1 | s2 << 16 | 0;
656
- };
657
- var adler32_1 = adler32;
658
- const makeTable = () => {
659
- let c, table = [];
660
- for (var n = 0; n < 256; n++) {
661
- c = n;
662
- for (var k = 0; k < 8; k++) {
663
- c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
664
- }
665
- table[n] = c;
666
- }
667
- return table;
668
- };
669
- const crcTable = new Uint32Array(makeTable());
670
- const crc32 = (crc, buf, len, pos) => {
671
- const t = crcTable;
672
- const end = pos + len;
673
- crc ^= -1;
674
- for (let i = pos; i < end; i++) {
675
- crc = crc >>> 8 ^ t[(crc ^ buf[i]) & 255];
676
- }
677
- return crc ^ -1;
678
- };
679
- var crc32_1 = crc32;
680
- var messages = {
681
- 2: "need dictionary",
682
- /* Z_NEED_DICT 2 */
683
- 1: "stream end",
684
- /* Z_STREAM_END 1 */
685
- 0: "",
686
- /* Z_OK 0 */
687
- "-1": "file error",
688
- /* Z_ERRNO (-1) */
689
- "-2": "stream error",
690
- /* Z_STREAM_ERROR (-2) */
691
- "-3": "data error",
692
- /* Z_DATA_ERROR (-3) */
693
- "-4": "insufficient memory",
694
- /* Z_MEM_ERROR (-4) */
695
- "-5": "buffer error",
696
- /* Z_BUF_ERROR (-5) */
697
- "-6": "incompatible version"
698
- /* Z_VERSION_ERROR (-6) */
699
- };
700
- var constants = {
701
- /* Allowed flush values; see deflate() and inflate() below for details */
702
- Z_NO_FLUSH: 0,
703
- Z_PARTIAL_FLUSH: 1,
704
- Z_SYNC_FLUSH: 2,
705
- Z_FULL_FLUSH: 3,
706
- Z_FINISH: 4,
707
- Z_BLOCK: 5,
708
- Z_TREES: 6,
709
- /* Return codes for the compression/decompression functions. Negative values
710
- * are errors, positive values are used for special but normal events.
711
- */
712
- Z_OK: 0,
713
- Z_STREAM_END: 1,
714
- Z_NEED_DICT: 2,
715
- Z_ERRNO: -1,
716
- Z_STREAM_ERROR: -2,
717
- Z_DATA_ERROR: -3,
718
- Z_MEM_ERROR: -4,
719
- Z_BUF_ERROR: -5,
720
- //Z_VERSION_ERROR: -6,
721
- /* compression levels */
722
- Z_NO_COMPRESSION: 0,
723
- Z_BEST_SPEED: 1,
724
- Z_BEST_COMPRESSION: 9,
725
- Z_DEFAULT_COMPRESSION: -1,
726
- Z_FILTERED: 1,
727
- Z_HUFFMAN_ONLY: 2,
728
- Z_RLE: 3,
729
- Z_FIXED: 4,
730
- Z_DEFAULT_STRATEGY: 0,
731
- /* Possible values of the data_type field (though see inflate()) */
732
- Z_BINARY: 0,
733
- Z_TEXT: 1,
734
- //Z_ASCII: 1, // = Z_TEXT (deprecated)
735
- Z_UNKNOWN: 2,
736
- /* The deflate compression method */
737
- Z_DEFLATED: 8
738
- //Z_NULL: null // Use -1 or null inline, depending on var type
739
- };
740
- const { _tr_init: _tr_init$1, _tr_stored_block: _tr_stored_block$1, _tr_flush_block: _tr_flush_block$1, _tr_tally: _tr_tally$1, _tr_align: _tr_align$1 } = trees;
741
- const {
742
- Z_NO_FLUSH,
743
- Z_PARTIAL_FLUSH,
744
- Z_FULL_FLUSH,
745
- Z_FINISH,
746
- Z_BLOCK,
747
- Z_OK,
748
- Z_STREAM_END,
749
- Z_STREAM_ERROR,
750
- Z_DATA_ERROR,
751
- Z_BUF_ERROR,
752
- Z_DEFAULT_COMPRESSION,
753
- Z_FILTERED,
754
- Z_HUFFMAN_ONLY,
755
- Z_RLE,
756
- Z_FIXED: Z_FIXED$1,
757
- Z_DEFAULT_STRATEGY,
758
- Z_UNKNOWN: Z_UNKNOWN$1,
759
- Z_DEFLATED
760
- } = constants;
761
- const MAX_MEM_LEVEL = 9;
762
- const MAX_WBITS = 15;
763
- const DEF_MEM_LEVEL = 8;
764
- const LENGTH_CODES$1 = 29;
765
- const LITERALS$1 = 256;
766
- const L_CODES$1 = LITERALS$1 + 1 + LENGTH_CODES$1;
767
- const D_CODES$1 = 30;
768
- const BL_CODES$1 = 19;
769
- const HEAP_SIZE$1 = 2 * L_CODES$1 + 1;
770
- const MAX_BITS$1 = 15;
771
- const MIN_MATCH$1 = 3;
772
- const MAX_MATCH$1 = 258;
773
- const MIN_LOOKAHEAD = MAX_MATCH$1 + MIN_MATCH$1 + 1;
774
- const PRESET_DICT = 32;
775
- const INIT_STATE = 42;
776
- const EXTRA_STATE = 69;
777
- const NAME_STATE = 73;
778
- const COMMENT_STATE = 91;
779
- const HCRC_STATE = 103;
780
- const BUSY_STATE = 113;
781
- const FINISH_STATE = 666;
782
- const BS_NEED_MORE = 1;
783
- const BS_BLOCK_DONE = 2;
784
- const BS_FINISH_STARTED = 3;
785
- const BS_FINISH_DONE = 4;
786
- const OS_CODE = 3;
787
- const err = (strm, errorCode) => {
788
- strm.msg = messages[errorCode];
789
- return errorCode;
790
- };
791
- const rank = (f) => {
792
- return (f << 1) - (f > 4 ? 9 : 0);
793
- };
794
- const zero$1 = (buf) => {
795
- let len = buf.length;
796
- while (--len >= 0) {
797
- buf[len] = 0;
798
- }
799
- };
800
- let HASH_ZLIB = (s, prev, data) => (prev << s.hash_shift ^ data) & s.hash_mask;
801
- let HASH = HASH_ZLIB;
802
- const flush_pending = (strm) => {
803
- const s = strm.state;
804
- let len = s.pending;
805
- if (len > strm.avail_out) {
806
- len = strm.avail_out;
807
- }
808
- if (len === 0) {
809
- return;
810
- }
811
- strm.output.set(s.pending_buf.subarray(s.pending_out, s.pending_out + len), strm.next_out);
812
- strm.next_out += len;
813
- s.pending_out += len;
814
- strm.total_out += len;
815
- strm.avail_out -= len;
816
- s.pending -= len;
817
- if (s.pending === 0) {
818
- s.pending_out = 0;
819
- }
820
- };
821
- const flush_block_only = (s, last) => {
822
- _tr_flush_block$1(s, s.block_start >= 0 ? s.block_start : -1, s.strstart - s.block_start, last);
823
- s.block_start = s.strstart;
824
- flush_pending(s.strm);
825
- };
826
- const put_byte = (s, b) => {
827
- s.pending_buf[s.pending++] = b;
828
- };
829
- const putShortMSB = (s, b) => {
830
- s.pending_buf[s.pending++] = b >>> 8 & 255;
831
- s.pending_buf[s.pending++] = b & 255;
832
- };
833
- const read_buf = (strm, buf, start, size) => {
834
- let len = strm.avail_in;
835
- if (len > size) {
836
- len = size;
837
- }
838
- if (len === 0) {
839
- return 0;
840
- }
841
- strm.avail_in -= len;
842
- buf.set(strm.input.subarray(strm.next_in, strm.next_in + len), start);
843
- if (strm.state.wrap === 1) {
844
- strm.adler = adler32_1(strm.adler, buf, len, start);
845
- } else if (strm.state.wrap === 2) {
846
- strm.adler = crc32_1(strm.adler, buf, len, start);
847
- }
848
- strm.next_in += len;
849
- strm.total_in += len;
850
- return len;
851
- };
852
- const longest_match = (s, cur_match) => {
853
- let chain_length = s.max_chain_length;
854
- let scan = s.strstart;
855
- let match;
856
- let len;
857
- let best_len = s.prev_length;
858
- let nice_match = s.nice_match;
859
- const limit = s.strstart > s.w_size - MIN_LOOKAHEAD ? s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0;
860
- const _win = s.window;
861
- const wmask = s.w_mask;
862
- const prev = s.prev;
863
- const strend = s.strstart + MAX_MATCH$1;
864
- let scan_end1 = _win[scan + best_len - 1];
865
- let scan_end = _win[scan + best_len];
866
- if (s.prev_length >= s.good_match) {
867
- chain_length >>= 2;
868
- }
869
- if (nice_match > s.lookahead) {
870
- nice_match = s.lookahead;
871
- }
872
- do {
873
- match = cur_match;
874
- if (_win[match + best_len] !== scan_end || _win[match + best_len - 1] !== scan_end1 || _win[match] !== _win[scan] || _win[++match] !== _win[scan + 1]) {
875
- continue;
876
- }
877
- scan += 2;
878
- match++;
879
- do {
880
- } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && scan < strend);
881
- len = MAX_MATCH$1 - (strend - scan);
882
- scan = strend - MAX_MATCH$1;
883
- if (len > best_len) {
884
- s.match_start = cur_match;
885
- best_len = len;
886
- if (len >= nice_match) {
887
- break;
888
- }
889
- scan_end1 = _win[scan + best_len - 1];
890
- scan_end = _win[scan + best_len];
891
- }
892
- } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);
893
- if (best_len <= s.lookahead) {
894
- return best_len;
895
- }
896
- return s.lookahead;
897
- };
898
- const fill_window = (s) => {
899
- const _w_size = s.w_size;
900
- let p, n, m, more, str;
901
- do {
902
- more = s.window_size - s.lookahead - s.strstart;
903
- if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {
904
- s.window.set(s.window.subarray(_w_size, _w_size + _w_size), 0);
905
- s.match_start -= _w_size;
906
- s.strstart -= _w_size;
907
- s.block_start -= _w_size;
908
- n = s.hash_size;
909
- p = n;
910
- do {
911
- m = s.head[--p];
912
- s.head[p] = m >= _w_size ? m - _w_size : 0;
913
- } while (--n);
914
- n = _w_size;
915
- p = n;
916
- do {
917
- m = s.prev[--p];
918
- s.prev[p] = m >= _w_size ? m - _w_size : 0;
919
- } while (--n);
920
- more += _w_size;
921
- }
922
- if (s.strm.avail_in === 0) {
923
- break;
924
- }
925
- n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);
926
- s.lookahead += n;
927
- if (s.lookahead + s.insert >= MIN_MATCH$1) {
928
- str = s.strstart - s.insert;
929
- s.ins_h = s.window[str];
930
- s.ins_h = HASH(s, s.ins_h, s.window[str + 1]);
931
- while (s.insert) {
932
- s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH$1 - 1]);
933
- s.prev[str & s.w_mask] = s.head[s.ins_h];
934
- s.head[s.ins_h] = str;
935
- str++;
936
- s.insert--;
937
- if (s.lookahead + s.insert < MIN_MATCH$1) {
938
- break;
939
- }
940
- }
941
- }
942
- } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);
943
- };
944
- const deflate_stored = (s, flush) => {
945
- let max_block_size = 65535;
946
- if (max_block_size > s.pending_buf_size - 5) {
947
- max_block_size = s.pending_buf_size - 5;
948
- }
949
- for (; ; ) {
950
- if (s.lookahead <= 1) {
951
- fill_window(s);
952
- if (s.lookahead === 0 && flush === Z_NO_FLUSH) {
953
- return BS_NEED_MORE;
954
- }
955
- if (s.lookahead === 0) {
956
- break;
957
- }
958
- }
959
- s.strstart += s.lookahead;
960
- s.lookahead = 0;
961
- const max_start = s.block_start + max_block_size;
962
- if (s.strstart === 0 || s.strstart >= max_start) {
963
- s.lookahead = s.strstart - max_start;
964
- s.strstart = max_start;
965
- flush_block_only(s, false);
966
- if (s.strm.avail_out === 0) {
967
- return BS_NEED_MORE;
968
- }
969
- }
970
- if (s.strstart - s.block_start >= s.w_size - MIN_LOOKAHEAD) {
971
- flush_block_only(s, false);
972
- if (s.strm.avail_out === 0) {
973
- return BS_NEED_MORE;
974
- }
975
- }
976
- }
977
- s.insert = 0;
978
- if (flush === Z_FINISH) {
979
- flush_block_only(s, true);
980
- if (s.strm.avail_out === 0) {
981
- return BS_FINISH_STARTED;
982
- }
983
- return BS_FINISH_DONE;
984
- }
985
- if (s.strstart > s.block_start) {
986
- flush_block_only(s, false);
987
- if (s.strm.avail_out === 0) {
988
- return BS_NEED_MORE;
989
- }
990
- }
991
- return BS_NEED_MORE;
992
- };
993
- const deflate_fast = (s, flush) => {
994
- let hash_head;
995
- let bflush;
996
- for (; ; ) {
997
- if (s.lookahead < MIN_LOOKAHEAD) {
998
- fill_window(s);
999
- if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
1000
- return BS_NEED_MORE;
1001
- }
1002
- if (s.lookahead === 0) {
1003
- break;
1004
- }
1005
- }
1006
- hash_head = 0;
1007
- if (s.lookahead >= MIN_MATCH$1) {
1008
- s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH$1 - 1]);
1009
- hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
1010
- s.head[s.ins_h] = s.strstart;
1011
- }
1012
- if (hash_head !== 0 && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) {
1013
- s.match_length = longest_match(s, hash_head);
1014
- }
1015
- if (s.match_length >= MIN_MATCH$1) {
1016
- bflush = _tr_tally$1(s, s.strstart - s.match_start, s.match_length - MIN_MATCH$1);
1017
- s.lookahead -= s.match_length;
1018
- if (s.match_length <= s.max_lazy_match && s.lookahead >= MIN_MATCH$1) {
1019
- s.match_length--;
1020
- do {
1021
- s.strstart++;
1022
- s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH$1 - 1]);
1023
- hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
1024
- s.head[s.ins_h] = s.strstart;
1025
- } while (--s.match_length !== 0);
1026
- s.strstart++;
1027
- } else {
1028
- s.strstart += s.match_length;
1029
- s.match_length = 0;
1030
- s.ins_h = s.window[s.strstart];
1031
- s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + 1]);
1032
- }
1033
- } else {
1034
- bflush = _tr_tally$1(s, 0, s.window[s.strstart]);
1035
- s.lookahead--;
1036
- s.strstart++;
1037
- }
1038
- if (bflush) {
1039
- flush_block_only(s, false);
1040
- if (s.strm.avail_out === 0) {
1041
- return BS_NEED_MORE;
1042
- }
1043
- }
1044
- }
1045
- s.insert = s.strstart < MIN_MATCH$1 - 1 ? s.strstart : MIN_MATCH$1 - 1;
1046
- if (flush === Z_FINISH) {
1047
- flush_block_only(s, true);
1048
- if (s.strm.avail_out === 0) {
1049
- return BS_FINISH_STARTED;
1050
- }
1051
- return BS_FINISH_DONE;
1052
- }
1053
- if (s.last_lit) {
1054
- flush_block_only(s, false);
1055
- if (s.strm.avail_out === 0) {
1056
- return BS_NEED_MORE;
1057
- }
1058
- }
1059
- return BS_BLOCK_DONE;
1060
- };
1061
- const deflate_slow = (s, flush) => {
1062
- let hash_head;
1063
- let bflush;
1064
- let max_insert;
1065
- for (; ; ) {
1066
- if (s.lookahead < MIN_LOOKAHEAD) {
1067
- fill_window(s);
1068
- if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
1069
- return BS_NEED_MORE;
1070
- }
1071
- if (s.lookahead === 0) {
1072
- break;
1073
- }
1074
- }
1075
- hash_head = 0;
1076
- if (s.lookahead >= MIN_MATCH$1) {
1077
- s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH$1 - 1]);
1078
- hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
1079
- s.head[s.ins_h] = s.strstart;
1080
- }
1081
- s.prev_length = s.match_length;
1082
- s.prev_match = s.match_start;
1083
- s.match_length = MIN_MATCH$1 - 1;
1084
- if (hash_head !== 0 && s.prev_length < s.max_lazy_match && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) {
1085
- s.match_length = longest_match(s, hash_head);
1086
- if (s.match_length <= 5 && (s.strategy === Z_FILTERED || s.match_length === MIN_MATCH$1 && s.strstart - s.match_start > 4096)) {
1087
- s.match_length = MIN_MATCH$1 - 1;
1088
- }
1089
- }
1090
- if (s.prev_length >= MIN_MATCH$1 && s.match_length <= s.prev_length) {
1091
- max_insert = s.strstart + s.lookahead - MIN_MATCH$1;
1092
- bflush = _tr_tally$1(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH$1);
1093
- s.lookahead -= s.prev_length - 1;
1094
- s.prev_length -= 2;
1095
- do {
1096
- if (++s.strstart <= max_insert) {
1097
- s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH$1 - 1]);
1098
- hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
1099
- s.head[s.ins_h] = s.strstart;
1100
- }
1101
- } while (--s.prev_length !== 0);
1102
- s.match_available = 0;
1103
- s.match_length = MIN_MATCH$1 - 1;
1104
- s.strstart++;
1105
- if (bflush) {
1106
- flush_block_only(s, false);
1107
- if (s.strm.avail_out === 0) {
1108
- return BS_NEED_MORE;
1109
- }
1110
- }
1111
- } else if (s.match_available) {
1112
- bflush = _tr_tally$1(s, 0, s.window[s.strstart - 1]);
1113
- if (bflush) {
1114
- flush_block_only(s, false);
1115
- }
1116
- s.strstart++;
1117
- s.lookahead--;
1118
- if (s.strm.avail_out === 0) {
1119
- return BS_NEED_MORE;
1120
- }
1121
- } else {
1122
- s.match_available = 1;
1123
- s.strstart++;
1124
- s.lookahead--;
1125
- }
1126
- }
1127
- if (s.match_available) {
1128
- bflush = _tr_tally$1(s, 0, s.window[s.strstart - 1]);
1129
- s.match_available = 0;
1130
- }
1131
- s.insert = s.strstart < MIN_MATCH$1 - 1 ? s.strstart : MIN_MATCH$1 - 1;
1132
- if (flush === Z_FINISH) {
1133
- flush_block_only(s, true);
1134
- if (s.strm.avail_out === 0) {
1135
- return BS_FINISH_STARTED;
1136
- }
1137
- return BS_FINISH_DONE;
1138
- }
1139
- if (s.last_lit) {
1140
- flush_block_only(s, false);
1141
- if (s.strm.avail_out === 0) {
1142
- return BS_NEED_MORE;
1143
- }
1144
- }
1145
- return BS_BLOCK_DONE;
1146
- };
1147
- const deflate_rle = (s, flush) => {
1148
- let bflush;
1149
- let prev;
1150
- let scan, strend;
1151
- const _win = s.window;
1152
- for (; ; ) {
1153
- if (s.lookahead <= MAX_MATCH$1) {
1154
- fill_window(s);
1155
- if (s.lookahead <= MAX_MATCH$1 && flush === Z_NO_FLUSH) {
1156
- return BS_NEED_MORE;
1157
- }
1158
- if (s.lookahead === 0) {
1159
- break;
1160
- }
1161
- }
1162
- s.match_length = 0;
1163
- if (s.lookahead >= MIN_MATCH$1 && s.strstart > 0) {
1164
- scan = s.strstart - 1;
1165
- prev = _win[scan];
1166
- if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {
1167
- strend = s.strstart + MAX_MATCH$1;
1168
- do {
1169
- } while (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && scan < strend);
1170
- s.match_length = MAX_MATCH$1 - (strend - scan);
1171
- if (s.match_length > s.lookahead) {
1172
- s.match_length = s.lookahead;
1173
- }
1174
- }
1175
- }
1176
- if (s.match_length >= MIN_MATCH$1) {
1177
- bflush = _tr_tally$1(s, 1, s.match_length - MIN_MATCH$1);
1178
- s.lookahead -= s.match_length;
1179
- s.strstart += s.match_length;
1180
- s.match_length = 0;
1181
- } else {
1182
- bflush = _tr_tally$1(s, 0, s.window[s.strstart]);
1183
- s.lookahead--;
1184
- s.strstart++;
1185
- }
1186
- if (bflush) {
1187
- flush_block_only(s, false);
1188
- if (s.strm.avail_out === 0) {
1189
- return BS_NEED_MORE;
1190
- }
1191
- }
1192
- }
1193
- s.insert = 0;
1194
- if (flush === Z_FINISH) {
1195
- flush_block_only(s, true);
1196
- if (s.strm.avail_out === 0) {
1197
- return BS_FINISH_STARTED;
1198
- }
1199
- return BS_FINISH_DONE;
1200
- }
1201
- if (s.last_lit) {
1202
- flush_block_only(s, false);
1203
- if (s.strm.avail_out === 0) {
1204
- return BS_NEED_MORE;
1205
- }
1206
- }
1207
- return BS_BLOCK_DONE;
1208
- };
1209
- const deflate_huff = (s, flush) => {
1210
- let bflush;
1211
- for (; ; ) {
1212
- if (s.lookahead === 0) {
1213
- fill_window(s);
1214
- if (s.lookahead === 0) {
1215
- if (flush === Z_NO_FLUSH) {
1216
- return BS_NEED_MORE;
1217
- }
1218
- break;
1219
- }
1220
- }
1221
- s.match_length = 0;
1222
- bflush = _tr_tally$1(s, 0, s.window[s.strstart]);
1223
- s.lookahead--;
1224
- s.strstart++;
1225
- if (bflush) {
1226
- flush_block_only(s, false);
1227
- if (s.strm.avail_out === 0) {
1228
- return BS_NEED_MORE;
1229
- }
1230
- }
1231
- }
1232
- s.insert = 0;
1233
- if (flush === Z_FINISH) {
1234
- flush_block_only(s, true);
1235
- if (s.strm.avail_out === 0) {
1236
- return BS_FINISH_STARTED;
1237
- }
1238
- return BS_FINISH_DONE;
1239
- }
1240
- if (s.last_lit) {
1241
- flush_block_only(s, false);
1242
- if (s.strm.avail_out === 0) {
1243
- return BS_NEED_MORE;
1244
- }
1245
- }
1246
- return BS_BLOCK_DONE;
1247
- };
1248
- function Config(good_length, max_lazy, nice_length, max_chain, func) {
1249
- this.good_length = good_length;
1250
- this.max_lazy = max_lazy;
1251
- this.nice_length = nice_length;
1252
- this.max_chain = max_chain;
1253
- this.func = func;
1254
- }
1255
- const configuration_table = [
1256
- /* good lazy nice chain */
1257
- new Config(0, 0, 0, 0, deflate_stored),
1258
- /* 0 store only */
1259
- new Config(4, 4, 8, 4, deflate_fast),
1260
- /* 1 max speed, no lazy matches */
1261
- new Config(4, 5, 16, 8, deflate_fast),
1262
- /* 2 */
1263
- new Config(4, 6, 32, 32, deflate_fast),
1264
- /* 3 */
1265
- new Config(4, 4, 16, 16, deflate_slow),
1266
- /* 4 lazy matches */
1267
- new Config(8, 16, 32, 32, deflate_slow),
1268
- /* 5 */
1269
- new Config(8, 16, 128, 128, deflate_slow),
1270
- /* 6 */
1271
- new Config(8, 32, 128, 256, deflate_slow),
1272
- /* 7 */
1273
- new Config(32, 128, 258, 1024, deflate_slow),
1274
- /* 8 */
1275
- new Config(32, 258, 258, 4096, deflate_slow)
1276
- /* 9 max compression */
1277
- ];
1278
- const lm_init = (s) => {
1279
- s.window_size = 2 * s.w_size;
1280
- zero$1(s.head);
1281
- s.max_lazy_match = configuration_table[s.level].max_lazy;
1282
- s.good_match = configuration_table[s.level].good_length;
1283
- s.nice_match = configuration_table[s.level].nice_length;
1284
- s.max_chain_length = configuration_table[s.level].max_chain;
1285
- s.strstart = 0;
1286
- s.block_start = 0;
1287
- s.lookahead = 0;
1288
- s.insert = 0;
1289
- s.match_length = s.prev_length = MIN_MATCH$1 - 1;
1290
- s.match_available = 0;
1291
- s.ins_h = 0;
1292
- };
1293
- function DeflateState() {
1294
- this.strm = null;
1295
- this.status = 0;
1296
- this.pending_buf = null;
1297
- this.pending_buf_size = 0;
1298
- this.pending_out = 0;
1299
- this.pending = 0;
1300
- this.wrap = 0;
1301
- this.gzhead = null;
1302
- this.gzindex = 0;
1303
- this.method = Z_DEFLATED;
1304
- this.last_flush = -1;
1305
- this.w_size = 0;
1306
- this.w_bits = 0;
1307
- this.w_mask = 0;
1308
- this.window = null;
1309
- this.window_size = 0;
1310
- this.prev = null;
1311
- this.head = null;
1312
- this.ins_h = 0;
1313
- this.hash_size = 0;
1314
- this.hash_bits = 0;
1315
- this.hash_mask = 0;
1316
- this.hash_shift = 0;
1317
- this.block_start = 0;
1318
- this.match_length = 0;
1319
- this.prev_match = 0;
1320
- this.match_available = 0;
1321
- this.strstart = 0;
1322
- this.match_start = 0;
1323
- this.lookahead = 0;
1324
- this.prev_length = 0;
1325
- this.max_chain_length = 0;
1326
- this.max_lazy_match = 0;
1327
- this.level = 0;
1328
- this.strategy = 0;
1329
- this.good_match = 0;
1330
- this.nice_match = 0;
1331
- this.dyn_ltree = new Uint16Array(HEAP_SIZE$1 * 2);
1332
- this.dyn_dtree = new Uint16Array((2 * D_CODES$1 + 1) * 2);
1333
- this.bl_tree = new Uint16Array((2 * BL_CODES$1 + 1) * 2);
1334
- zero$1(this.dyn_ltree);
1335
- zero$1(this.dyn_dtree);
1336
- zero$1(this.bl_tree);
1337
- this.l_desc = null;
1338
- this.d_desc = null;
1339
- this.bl_desc = null;
1340
- this.bl_count = new Uint16Array(MAX_BITS$1 + 1);
1341
- this.heap = new Uint16Array(2 * L_CODES$1 + 1);
1342
- zero$1(this.heap);
1343
- this.heap_len = 0;
1344
- this.heap_max = 0;
1345
- this.depth = new Uint16Array(2 * L_CODES$1 + 1);
1346
- zero$1(this.depth);
1347
- this.l_buf = 0;
1348
- this.lit_bufsize = 0;
1349
- this.last_lit = 0;
1350
- this.d_buf = 0;
1351
- this.opt_len = 0;
1352
- this.static_len = 0;
1353
- this.matches = 0;
1354
- this.insert = 0;
1355
- this.bi_buf = 0;
1356
- this.bi_valid = 0;
1357
- }
1358
- const deflateResetKeep = (strm) => {
1359
- if (!strm || !strm.state) {
1360
- return err(strm, Z_STREAM_ERROR);
1361
- }
1362
- strm.total_in = strm.total_out = 0;
1363
- strm.data_type = Z_UNKNOWN$1;
1364
- const s = strm.state;
1365
- s.pending = 0;
1366
- s.pending_out = 0;
1367
- if (s.wrap < 0) {
1368
- s.wrap = -s.wrap;
1369
- }
1370
- s.status = s.wrap ? INIT_STATE : BUSY_STATE;
1371
- strm.adler = s.wrap === 2 ? 0 : 1;
1372
- s.last_flush = Z_NO_FLUSH;
1373
- _tr_init$1(s);
1374
- return Z_OK;
1375
- };
1376
- const deflateReset = (strm) => {
1377
- const ret = deflateResetKeep(strm);
1378
- if (ret === Z_OK) {
1379
- lm_init(strm.state);
1380
- }
1381
- return ret;
1382
- };
1383
- const deflateSetHeader = (strm, head) => {
1384
- if (!strm || !strm.state) {
1385
- return Z_STREAM_ERROR;
1386
- }
1387
- if (strm.state.wrap !== 2) {
1388
- return Z_STREAM_ERROR;
1389
- }
1390
- strm.state.gzhead = head;
1391
- return Z_OK;
1392
- };
1393
- const deflateInit2 = (strm, level, method, windowBits, memLevel, strategy) => {
1394
- if (!strm) {
1395
- return Z_STREAM_ERROR;
1396
- }
1397
- let wrap = 1;
1398
- if (level === Z_DEFAULT_COMPRESSION) {
1399
- level = 6;
1400
- }
1401
- if (windowBits < 0) {
1402
- wrap = 0;
1403
- windowBits = -windowBits;
1404
- } else if (windowBits > 15) {
1405
- wrap = 2;
1406
- windowBits -= 16;
1407
- }
1408
- if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED$1) {
1409
- return err(strm, Z_STREAM_ERROR);
1410
- }
1411
- if (windowBits === 8) {
1412
- windowBits = 9;
1413
- }
1414
- const s = new DeflateState();
1415
- strm.state = s;
1416
- s.strm = strm;
1417
- s.wrap = wrap;
1418
- s.gzhead = null;
1419
- s.w_bits = windowBits;
1420
- s.w_size = 1 << s.w_bits;
1421
- s.w_mask = s.w_size - 1;
1422
- s.hash_bits = memLevel + 7;
1423
- s.hash_size = 1 << s.hash_bits;
1424
- s.hash_mask = s.hash_size - 1;
1425
- s.hash_shift = ~~((s.hash_bits + MIN_MATCH$1 - 1) / MIN_MATCH$1);
1426
- s.window = new Uint8Array(s.w_size * 2);
1427
- s.head = new Uint16Array(s.hash_size);
1428
- s.prev = new Uint16Array(s.w_size);
1429
- s.lit_bufsize = 1 << memLevel + 6;
1430
- s.pending_buf_size = s.lit_bufsize * 4;
1431
- s.pending_buf = new Uint8Array(s.pending_buf_size);
1432
- s.d_buf = 1 * s.lit_bufsize;
1433
- s.l_buf = (1 + 2) * s.lit_bufsize;
1434
- s.level = level;
1435
- s.strategy = strategy;
1436
- s.method = method;
1437
- return deflateReset(strm);
1438
- };
1439
- const deflateInit = (strm, level) => {
1440
- return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
1441
- };
1442
- const deflate = (strm, flush) => {
1443
- let beg, val;
1444
- if (!strm || !strm.state || flush > Z_BLOCK || flush < 0) {
1445
- return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;
1446
- }
1447
- const s = strm.state;
1448
- if (!strm.output || !strm.input && strm.avail_in !== 0 || s.status === FINISH_STATE && flush !== Z_FINISH) {
1449
- return err(strm, strm.avail_out === 0 ? Z_BUF_ERROR : Z_STREAM_ERROR);
1450
- }
1451
- s.strm = strm;
1452
- const old_flush = s.last_flush;
1453
- s.last_flush = flush;
1454
- if (s.status === INIT_STATE) {
1455
- if (s.wrap === 2) {
1456
- strm.adler = 0;
1457
- put_byte(s, 31);
1458
- put_byte(s, 139);
1459
- put_byte(s, 8);
1460
- if (!s.gzhead) {
1461
- put_byte(s, 0);
1462
- put_byte(s, 0);
1463
- put_byte(s, 0);
1464
- put_byte(s, 0);
1465
- put_byte(s, 0);
1466
- put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0);
1467
- put_byte(s, OS_CODE);
1468
- s.status = BUSY_STATE;
1469
- } else {
1470
- put_byte(
1471
- s,
1472
- (s.gzhead.text ? 1 : 0) + (s.gzhead.hcrc ? 2 : 0) + (!s.gzhead.extra ? 0 : 4) + (!s.gzhead.name ? 0 : 8) + (!s.gzhead.comment ? 0 : 16)
1473
- );
1474
- put_byte(s, s.gzhead.time & 255);
1475
- put_byte(s, s.gzhead.time >> 8 & 255);
1476
- put_byte(s, s.gzhead.time >> 16 & 255);
1477
- put_byte(s, s.gzhead.time >> 24 & 255);
1478
- put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0);
1479
- put_byte(s, s.gzhead.os & 255);
1480
- if (s.gzhead.extra && s.gzhead.extra.length) {
1481
- put_byte(s, s.gzhead.extra.length & 255);
1482
- put_byte(s, s.gzhead.extra.length >> 8 & 255);
1483
- }
1484
- if (s.gzhead.hcrc) {
1485
- strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending, 0);
1486
- }
1487
- s.gzindex = 0;
1488
- s.status = EXTRA_STATE;
1489
- }
1490
- } else {
1491
- let header = Z_DEFLATED + (s.w_bits - 8 << 4) << 8;
1492
- let level_flags = -1;
1493
- if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {
1494
- level_flags = 0;
1495
- } else if (s.level < 6) {
1496
- level_flags = 1;
1497
- } else if (s.level === 6) {
1498
- level_flags = 2;
1499
- } else {
1500
- level_flags = 3;
1501
- }
1502
- header |= level_flags << 6;
1503
- if (s.strstart !== 0) {
1504
- header |= PRESET_DICT;
1505
- }
1506
- header += 31 - header % 31;
1507
- s.status = BUSY_STATE;
1508
- putShortMSB(s, header);
1509
- if (s.strstart !== 0) {
1510
- putShortMSB(s, strm.adler >>> 16);
1511
- putShortMSB(s, strm.adler & 65535);
1512
- }
1513
- strm.adler = 1;
1514
- }
1515
- }
1516
- if (s.status === EXTRA_STATE) {
1517
- if (s.gzhead.extra) {
1518
- beg = s.pending;
1519
- while (s.gzindex < (s.gzhead.extra.length & 65535)) {
1520
- if (s.pending === s.pending_buf_size) {
1521
- if (s.gzhead.hcrc && s.pending > beg) {
1522
- strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);
1523
- }
1524
- flush_pending(strm);
1525
- beg = s.pending;
1526
- if (s.pending === s.pending_buf_size) {
1527
- break;
1528
- }
1529
- }
1530
- put_byte(s, s.gzhead.extra[s.gzindex] & 255);
1531
- s.gzindex++;
1532
- }
1533
- if (s.gzhead.hcrc && s.pending > beg) {
1534
- strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);
1535
- }
1536
- if (s.gzindex === s.gzhead.extra.length) {
1537
- s.gzindex = 0;
1538
- s.status = NAME_STATE;
1539
- }
1540
- } else {
1541
- s.status = NAME_STATE;
1542
- }
1543
- }
1544
- if (s.status === NAME_STATE) {
1545
- if (s.gzhead.name) {
1546
- beg = s.pending;
1547
- do {
1548
- if (s.pending === s.pending_buf_size) {
1549
- if (s.gzhead.hcrc && s.pending > beg) {
1550
- strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);
1551
- }
1552
- flush_pending(strm);
1553
- beg = s.pending;
1554
- if (s.pending === s.pending_buf_size) {
1555
- val = 1;
1556
- break;
1557
- }
1558
- }
1559
- if (s.gzindex < s.gzhead.name.length) {
1560
- val = s.gzhead.name.charCodeAt(s.gzindex++) & 255;
1561
- } else {
1562
- val = 0;
1563
- }
1564
- put_byte(s, val);
1565
- } while (val !== 0);
1566
- if (s.gzhead.hcrc && s.pending > beg) {
1567
- strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);
1568
- }
1569
- if (val === 0) {
1570
- s.gzindex = 0;
1571
- s.status = COMMENT_STATE;
1572
- }
1573
- } else {
1574
- s.status = COMMENT_STATE;
1575
- }
1576
- }
1577
- if (s.status === COMMENT_STATE) {
1578
- if (s.gzhead.comment) {
1579
- beg = s.pending;
1580
- do {
1581
- if (s.pending === s.pending_buf_size) {
1582
- if (s.gzhead.hcrc && s.pending > beg) {
1583
- strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);
1584
- }
1585
- flush_pending(strm);
1586
- beg = s.pending;
1587
- if (s.pending === s.pending_buf_size) {
1588
- val = 1;
1589
- break;
1590
- }
1591
- }
1592
- if (s.gzindex < s.gzhead.comment.length) {
1593
- val = s.gzhead.comment.charCodeAt(s.gzindex++) & 255;
1594
- } else {
1595
- val = 0;
1596
- }
1597
- put_byte(s, val);
1598
- } while (val !== 0);
1599
- if (s.gzhead.hcrc && s.pending > beg) {
1600
- strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);
1601
- }
1602
- if (val === 0) {
1603
- s.status = HCRC_STATE;
1604
- }
1605
- } else {
1606
- s.status = HCRC_STATE;
1607
- }
1608
- }
1609
- if (s.status === HCRC_STATE) {
1610
- if (s.gzhead.hcrc) {
1611
- if (s.pending + 2 > s.pending_buf_size) {
1612
- flush_pending(strm);
1613
- }
1614
- if (s.pending + 2 <= s.pending_buf_size) {
1615
- put_byte(s, strm.adler & 255);
1616
- put_byte(s, strm.adler >> 8 & 255);
1617
- strm.adler = 0;
1618
- s.status = BUSY_STATE;
1619
- }
1620
- } else {
1621
- s.status = BUSY_STATE;
1622
- }
1623
- }
1624
- if (s.pending !== 0) {
1625
- flush_pending(strm);
1626
- if (strm.avail_out === 0) {
1627
- s.last_flush = -1;
1628
- return Z_OK;
1629
- }
1630
- } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && flush !== Z_FINISH) {
1631
- return err(strm, Z_BUF_ERROR);
1632
- }
1633
- if (s.status === FINISH_STATE && strm.avail_in !== 0) {
1634
- return err(strm, Z_BUF_ERROR);
1635
- }
1636
- if (strm.avail_in !== 0 || s.lookahead !== 0 || flush !== Z_NO_FLUSH && s.status !== FINISH_STATE) {
1637
- let bstate = s.strategy === Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : s.strategy === Z_RLE ? deflate_rle(s, flush) : configuration_table[s.level].func(s, flush);
1638
- if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {
1639
- s.status = FINISH_STATE;
1640
- }
1641
- if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {
1642
- if (strm.avail_out === 0) {
1643
- s.last_flush = -1;
1644
- }
1645
- return Z_OK;
1646
- }
1647
- if (bstate === BS_BLOCK_DONE) {
1648
- if (flush === Z_PARTIAL_FLUSH) {
1649
- _tr_align$1(s);
1650
- } else if (flush !== Z_BLOCK) {
1651
- _tr_stored_block$1(s, 0, 0, false);
1652
- if (flush === Z_FULL_FLUSH) {
1653
- zero$1(s.head);
1654
- if (s.lookahead === 0) {
1655
- s.strstart = 0;
1656
- s.block_start = 0;
1657
- s.insert = 0;
1658
- }
1659
- }
1660
- }
1661
- flush_pending(strm);
1662
- if (strm.avail_out === 0) {
1663
- s.last_flush = -1;
1664
- return Z_OK;
1665
- }
1666
- }
1667
- }
1668
- if (flush !== Z_FINISH) {
1669
- return Z_OK;
1670
- }
1671
- if (s.wrap <= 0) {
1672
- return Z_STREAM_END;
1673
- }
1674
- if (s.wrap === 2) {
1675
- put_byte(s, strm.adler & 255);
1676
- put_byte(s, strm.adler >> 8 & 255);
1677
- put_byte(s, strm.adler >> 16 & 255);
1678
- put_byte(s, strm.adler >> 24 & 255);
1679
- put_byte(s, strm.total_in & 255);
1680
- put_byte(s, strm.total_in >> 8 & 255);
1681
- put_byte(s, strm.total_in >> 16 & 255);
1682
- put_byte(s, strm.total_in >> 24 & 255);
1683
- } else {
1684
- putShortMSB(s, strm.adler >>> 16);
1685
- putShortMSB(s, strm.adler & 65535);
1686
- }
1687
- flush_pending(strm);
1688
- if (s.wrap > 0) {
1689
- s.wrap = -s.wrap;
1690
- }
1691
- return s.pending !== 0 ? Z_OK : Z_STREAM_END;
1692
- };
1693
- const deflateEnd = (strm) => {
1694
- if (!strm || !strm.state) {
1695
- return Z_STREAM_ERROR;
1696
- }
1697
- const status = strm.state.status;
1698
- if (status !== INIT_STATE && status !== EXTRA_STATE && status !== NAME_STATE && status !== COMMENT_STATE && status !== HCRC_STATE && status !== BUSY_STATE && status !== FINISH_STATE) {
1699
- return err(strm, Z_STREAM_ERROR);
1700
- }
1701
- strm.state = null;
1702
- return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;
1703
- };
1704
- const deflateSetDictionary = (strm, dictionary) => {
1705
- let dictLength = dictionary.length;
1706
- if (!strm || !strm.state) {
1707
- return Z_STREAM_ERROR;
1708
- }
1709
- const s = strm.state;
1710
- const wrap = s.wrap;
1711
- if (wrap === 2 || wrap === 1 && s.status !== INIT_STATE || s.lookahead) {
1712
- return Z_STREAM_ERROR;
1713
- }
1714
- if (wrap === 1) {
1715
- strm.adler = adler32_1(strm.adler, dictionary, dictLength, 0);
1716
- }
1717
- s.wrap = 0;
1718
- if (dictLength >= s.w_size) {
1719
- if (wrap === 0) {
1720
- zero$1(s.head);
1721
- s.strstart = 0;
1722
- s.block_start = 0;
1723
- s.insert = 0;
1724
- }
1725
- let tmpDict = new Uint8Array(s.w_size);
1726
- tmpDict.set(dictionary.subarray(dictLength - s.w_size, dictLength), 0);
1727
- dictionary = tmpDict;
1728
- dictLength = s.w_size;
1729
- }
1730
- const avail = strm.avail_in;
1731
- const next = strm.next_in;
1732
- const input = strm.input;
1733
- strm.avail_in = dictLength;
1734
- strm.next_in = 0;
1735
- strm.input = dictionary;
1736
- fill_window(s);
1737
- while (s.lookahead >= MIN_MATCH$1) {
1738
- let str = s.strstart;
1739
- let n = s.lookahead - (MIN_MATCH$1 - 1);
1740
- do {
1741
- s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH$1 - 1]);
1742
- s.prev[str & s.w_mask] = s.head[s.ins_h];
1743
- s.head[s.ins_h] = str;
1744
- str++;
1745
- } while (--n);
1746
- s.strstart = str;
1747
- s.lookahead = MIN_MATCH$1 - 1;
1748
- fill_window(s);
1749
- }
1750
- s.strstart += s.lookahead;
1751
- s.block_start = s.strstart;
1752
- s.insert = s.lookahead;
1753
- s.lookahead = 0;
1754
- s.match_length = s.prev_length = MIN_MATCH$1 - 1;
1755
- s.match_available = 0;
1756
- strm.next_in = next;
1757
- strm.input = input;
1758
- strm.avail_in = avail;
1759
- s.wrap = wrap;
1760
- return Z_OK;
1761
- };
1762
- var deflateInit_1 = deflateInit;
1763
- var deflateInit2_1 = deflateInit2;
1764
- var deflateReset_1 = deflateReset;
1765
- var deflateResetKeep_1 = deflateResetKeep;
1766
- var deflateSetHeader_1 = deflateSetHeader;
1767
- var deflate_2 = deflate;
1768
- var deflateEnd_1 = deflateEnd;
1769
- var deflateSetDictionary_1 = deflateSetDictionary;
1770
- var deflateInfo = "pako deflate (from Nodeca project)";
1771
- var deflate_1 = {
1772
- deflateInit: deflateInit_1,
1773
- deflateInit2: deflateInit2_1,
1774
- deflateReset: deflateReset_1,
1775
- deflateResetKeep: deflateResetKeep_1,
1776
- deflateSetHeader: deflateSetHeader_1,
1777
- deflate: deflate_2,
1778
- deflateEnd: deflateEnd_1,
1779
- deflateSetDictionary: deflateSetDictionary_1,
1780
- deflateInfo
1781
- };
1782
- const _has = (obj, key) => {
1783
- return Object.prototype.hasOwnProperty.call(obj, key);
1784
- };
1785
- var assign = function(obj) {
1786
- const sources = Array.prototype.slice.call(arguments, 1);
1787
- while (sources.length) {
1788
- const source = sources.shift();
1789
- if (!source) {
1790
- continue;
1791
- }
1792
- if (typeof source !== "object") {
1793
- throw new TypeError(source + "must be non-object");
1794
- }
1795
- for (const p in source) {
1796
- if (_has(source, p)) {
1797
- obj[p] = source[p];
1798
- }
1799
- }
1800
- }
1801
- return obj;
1802
- };
1803
- var flattenChunks = (chunks) => {
1804
- let len = 0;
1805
- for (let i = 0, l = chunks.length; i < l; i++) {
1806
- len += chunks[i].length;
1807
- }
1808
- const result = new Uint8Array(len);
1809
- for (let i = 0, pos = 0, l = chunks.length; i < l; i++) {
1810
- let chunk = chunks[i];
1811
- result.set(chunk, pos);
1812
- pos += chunk.length;
1813
- }
1814
- return result;
1815
- };
1816
- var common = {
1817
- assign,
1818
- flattenChunks
1819
- };
1820
- let STR_APPLY_UIA_OK = true;
1821
- try {
1822
- String.fromCharCode.apply(null, new Uint8Array(1));
1823
- } catch (__) {
1824
- STR_APPLY_UIA_OK = false;
1825
- }
1826
- const _utf8len = new Uint8Array(256);
1827
- for (let q = 0; q < 256; q++) {
1828
- _utf8len[q] = q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1;
1829
- }
1830
- _utf8len[254] = _utf8len[254] = 1;
1831
- var string2buf = (str) => {
1832
- let buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;
1833
- for (m_pos = 0; m_pos < str_len; m_pos++) {
1834
- c = str.charCodeAt(m_pos);
1835
- if ((c & 64512) === 55296 && m_pos + 1 < str_len) {
1836
- c2 = str.charCodeAt(m_pos + 1);
1837
- if ((c2 & 64512) === 56320) {
1838
- c = 65536 + (c - 55296 << 10) + (c2 - 56320);
1839
- m_pos++;
1840
- }
1841
- }
1842
- buf_len += c < 128 ? 1 : c < 2048 ? 2 : c < 65536 ? 3 : 4;
1843
- }
1844
- buf = new Uint8Array(buf_len);
1845
- for (i = 0, m_pos = 0; i < buf_len; m_pos++) {
1846
- c = str.charCodeAt(m_pos);
1847
- if ((c & 64512) === 55296 && m_pos + 1 < str_len) {
1848
- c2 = str.charCodeAt(m_pos + 1);
1849
- if ((c2 & 64512) === 56320) {
1850
- c = 65536 + (c - 55296 << 10) + (c2 - 56320);
1851
- m_pos++;
1852
- }
1853
- }
1854
- if (c < 128) {
1855
- buf[i++] = c;
1856
- } else if (c < 2048) {
1857
- buf[i++] = 192 | c >>> 6;
1858
- buf[i++] = 128 | c & 63;
1859
- } else if (c < 65536) {
1860
- buf[i++] = 224 | c >>> 12;
1861
- buf[i++] = 128 | c >>> 6 & 63;
1862
- buf[i++] = 128 | c & 63;
1863
- } else {
1864
- buf[i++] = 240 | c >>> 18;
1865
- buf[i++] = 128 | c >>> 12 & 63;
1866
- buf[i++] = 128 | c >>> 6 & 63;
1867
- buf[i++] = 128 | c & 63;
1868
- }
1869
- }
1870
- return buf;
1871
- };
1872
- const buf2binstring = (buf, len) => {
1873
- if (len < 65534) {
1874
- if (buf.subarray && STR_APPLY_UIA_OK) {
1875
- return String.fromCharCode.apply(null, buf.length === len ? buf : buf.subarray(0, len));
1876
- }
1877
- }
1878
- let result = "";
1879
- for (let i = 0; i < len; i++) {
1880
- result += String.fromCharCode(buf[i]);
1881
- }
1882
- return result;
1883
- };
1884
- var buf2string = (buf, max) => {
1885
- let i, out;
1886
- const len = max || buf.length;
1887
- const utf16buf = new Array(len * 2);
1888
- for (out = 0, i = 0; i < len; ) {
1889
- let c = buf[i++];
1890
- if (c < 128) {
1891
- utf16buf[out++] = c;
1892
- continue;
1893
- }
1894
- let c_len = _utf8len[c];
1895
- if (c_len > 4) {
1896
- utf16buf[out++] = 65533;
1897
- i += c_len - 1;
1898
- continue;
1899
- }
1900
- c &= c_len === 2 ? 31 : c_len === 3 ? 15 : 7;
1901
- while (c_len > 1 && i < len) {
1902
- c = c << 6 | buf[i++] & 63;
1903
- c_len--;
1904
- }
1905
- if (c_len > 1) {
1906
- utf16buf[out++] = 65533;
1907
- continue;
1908
- }
1909
- if (c < 65536) {
1910
- utf16buf[out++] = c;
1911
- } else {
1912
- c -= 65536;
1913
- utf16buf[out++] = 55296 | c >> 10 & 1023;
1914
- utf16buf[out++] = 56320 | c & 1023;
1915
- }
1916
- }
1917
- return buf2binstring(utf16buf, out);
1918
- };
1919
- var utf8border = (buf, max) => {
1920
- max = max || buf.length;
1921
- if (max > buf.length) {
1922
- max = buf.length;
1923
- }
1924
- let pos = max - 1;
1925
- while (pos >= 0 && (buf[pos] & 192) === 128) {
1926
- pos--;
1927
- }
1928
- if (pos < 0) {
1929
- return max;
1930
- }
1931
- if (pos === 0) {
1932
- return max;
1933
- }
1934
- return pos + _utf8len[buf[pos]] > max ? pos : max;
1935
- };
1936
- var strings = {
1937
- string2buf,
1938
- buf2string,
1939
- utf8border
1940
- };
1941
- function ZStream() {
1942
- this.input = null;
1943
- this.next_in = 0;
1944
- this.avail_in = 0;
1945
- this.total_in = 0;
1946
- this.output = null;
1947
- this.next_out = 0;
1948
- this.avail_out = 0;
1949
- this.total_out = 0;
1950
- this.msg = "";
1951
- this.state = null;
1952
- this.data_type = 2;
1953
- this.adler = 0;
1954
- }
1955
- var zstream = ZStream;
1956
- const toString = Object.prototype.toString;
1957
- const {
1958
- Z_NO_FLUSH: Z_NO_FLUSH$1,
1959
- Z_SYNC_FLUSH,
1960
- Z_FULL_FLUSH: Z_FULL_FLUSH$1,
1961
- Z_FINISH: Z_FINISH$1,
1962
- Z_OK: Z_OK$1,
1963
- Z_STREAM_END: Z_STREAM_END$1,
1964
- Z_DEFAULT_COMPRESSION: Z_DEFAULT_COMPRESSION$1,
1965
- Z_DEFAULT_STRATEGY: Z_DEFAULT_STRATEGY$1,
1966
- Z_DEFLATED: Z_DEFLATED$1
1967
- } = constants;
1968
- function Deflate(options) {
1969
- this.options = common.assign({
1970
- level: Z_DEFAULT_COMPRESSION$1,
1971
- method: Z_DEFLATED$1,
1972
- chunkSize: 16384,
1973
- windowBits: 15,
1974
- memLevel: 8,
1975
- strategy: Z_DEFAULT_STRATEGY$1
1976
- }, options || {});
1977
- let opt = this.options;
1978
- if (opt.raw && opt.windowBits > 0) {
1979
- opt.windowBits = -opt.windowBits;
1980
- } else if (opt.gzip && opt.windowBits > 0 && opt.windowBits < 16) {
1981
- opt.windowBits += 16;
1982
- }
1983
- this.err = 0;
1984
- this.msg = "";
1985
- this.ended = false;
1986
- this.chunks = [];
1987
- this.strm = new zstream();
1988
- this.strm.avail_out = 0;
1989
- let status = deflate_1.deflateInit2(
1990
- this.strm,
1991
- opt.level,
1992
- opt.method,
1993
- opt.windowBits,
1994
- opt.memLevel,
1995
- opt.strategy
1996
- );
1997
- if (status !== Z_OK$1) {
1998
- throw new Error(messages[status]);
1999
- }
2000
- if (opt.header) {
2001
- deflate_1.deflateSetHeader(this.strm, opt.header);
2002
- }
2003
- if (opt.dictionary) {
2004
- let dict;
2005
- if (typeof opt.dictionary === "string") {
2006
- dict = strings.string2buf(opt.dictionary);
2007
- } else if (toString.call(opt.dictionary) === "[object ArrayBuffer]") {
2008
- dict = new Uint8Array(opt.dictionary);
2009
- } else {
2010
- dict = opt.dictionary;
2011
- }
2012
- status = deflate_1.deflateSetDictionary(this.strm, dict);
2013
- if (status !== Z_OK$1) {
2014
- throw new Error(messages[status]);
2015
- }
2016
- this._dict_set = true;
2017
- }
2018
- }
2019
- Deflate.prototype.push = function(data, flush_mode) {
2020
- const strm = this.strm;
2021
- const chunkSize = this.options.chunkSize;
2022
- let status, _flush_mode;
2023
- if (this.ended) {
2024
- return false;
2025
- }
2026
- if (flush_mode === ~~flush_mode)
2027
- _flush_mode = flush_mode;
2028
- else
2029
- _flush_mode = flush_mode === true ? Z_FINISH$1 : Z_NO_FLUSH$1;
2030
- if (typeof data === "string") {
2031
- strm.input = strings.string2buf(data);
2032
- } else if (toString.call(data) === "[object ArrayBuffer]") {
2033
- strm.input = new Uint8Array(data);
2034
- } else {
2035
- strm.input = data;
2036
- }
2037
- strm.next_in = 0;
2038
- strm.avail_in = strm.input.length;
2039
- for (; ; ) {
2040
- if (strm.avail_out === 0) {
2041
- strm.output = new Uint8Array(chunkSize);
2042
- strm.next_out = 0;
2043
- strm.avail_out = chunkSize;
2044
- }
2045
- if ((_flush_mode === Z_SYNC_FLUSH || _flush_mode === Z_FULL_FLUSH$1) && strm.avail_out <= 6) {
2046
- this.onData(strm.output.subarray(0, strm.next_out));
2047
- strm.avail_out = 0;
2048
- continue;
2049
- }
2050
- status = deflate_1.deflate(strm, _flush_mode);
2051
- if (status === Z_STREAM_END$1) {
2052
- if (strm.next_out > 0) {
2053
- this.onData(strm.output.subarray(0, strm.next_out));
2054
- }
2055
- status = deflate_1.deflateEnd(this.strm);
2056
- this.onEnd(status);
2057
- this.ended = true;
2058
- return status === Z_OK$1;
2059
- }
2060
- if (strm.avail_out === 0) {
2061
- this.onData(strm.output);
2062
- continue;
2063
- }
2064
- if (_flush_mode > 0 && strm.next_out > 0) {
2065
- this.onData(strm.output.subarray(0, strm.next_out));
2066
- strm.avail_out = 0;
2067
- continue;
2068
- }
2069
- if (strm.avail_in === 0)
2070
- break;
2071
- }
2072
- return true;
2073
- };
2074
- Deflate.prototype.onData = function(chunk) {
2075
- this.chunks.push(chunk);
2076
- };
2077
- Deflate.prototype.onEnd = function(status) {
2078
- if (status === Z_OK$1) {
2079
- this.result = common.flattenChunks(this.chunks);
2080
- }
2081
- this.chunks = [];
2082
- this.err = status;
2083
- this.msg = this.strm.msg;
2084
- };
2085
- function deflate$1(input, options) {
2086
- const deflator = new Deflate(options);
2087
- deflator.push(input, true);
2088
- if (deflator.err) {
2089
- throw deflator.msg || messages[deflator.err];
2090
- }
2091
- return deflator.result;
2092
- }
2093
- function deflateRaw(input, options) {
2094
- options = options || {};
2095
- options.raw = true;
2096
- return deflate$1(input, options);
2097
- }
2098
- function gzip(input, options) {
2099
- options = options || {};
2100
- options.gzip = true;
2101
- return deflate$1(input, options);
2102
- }
2103
- var Deflate_1 = Deflate;
2104
- var deflate_2$1 = deflate$1;
2105
- var deflateRaw_1 = deflateRaw;
2106
- var gzip_1 = gzip;
2107
- var constants$1 = constants;
2108
- var deflate_1$1 = {
2109
- Deflate: Deflate_1,
2110
- deflate: deflate_2$1,
2111
- deflateRaw: deflateRaw_1,
2112
- gzip: gzip_1,
2113
- constants: constants$1
2114
- };
2115
- const BAD = 30;
2116
- const TYPE = 12;
2117
- var inffast = function inflate_fast(strm, start) {
2118
- let _in;
2119
- let last;
2120
- let _out;
2121
- let beg;
2122
- let end;
2123
- let dmax;
2124
- let wsize;
2125
- let whave;
2126
- let wnext;
2127
- let s_window;
2128
- let hold;
2129
- let bits;
2130
- let lcode;
2131
- let dcode;
2132
- let lmask;
2133
- let dmask;
2134
- let here;
2135
- let op;
2136
- let len;
2137
- let dist;
2138
- let from;
2139
- let from_source;
2140
- let input, output;
2141
- const state = strm.state;
2142
- _in = strm.next_in;
2143
- input = strm.input;
2144
- last = _in + (strm.avail_in - 5);
2145
- _out = strm.next_out;
2146
- output = strm.output;
2147
- beg = _out - (start - strm.avail_out);
2148
- end = _out + (strm.avail_out - 257);
2149
- dmax = state.dmax;
2150
- wsize = state.wsize;
2151
- whave = state.whave;
2152
- wnext = state.wnext;
2153
- s_window = state.window;
2154
- hold = state.hold;
2155
- bits = state.bits;
2156
- lcode = state.lencode;
2157
- dcode = state.distcode;
2158
- lmask = (1 << state.lenbits) - 1;
2159
- dmask = (1 << state.distbits) - 1;
2160
- top:
2161
- do {
2162
- if (bits < 15) {
2163
- hold += input[_in++] << bits;
2164
- bits += 8;
2165
- hold += input[_in++] << bits;
2166
- bits += 8;
2167
- }
2168
- here = lcode[hold & lmask];
2169
- dolen:
2170
- for (; ; ) {
2171
- op = here >>> 24;
2172
- hold >>>= op;
2173
- bits -= op;
2174
- op = here >>> 16 & 255;
2175
- if (op === 0) {
2176
- output[_out++] = here & 65535;
2177
- } else if (op & 16) {
2178
- len = here & 65535;
2179
- op &= 15;
2180
- if (op) {
2181
- if (bits < op) {
2182
- hold += input[_in++] << bits;
2183
- bits += 8;
2184
- }
2185
- len += hold & (1 << op) - 1;
2186
- hold >>>= op;
2187
- bits -= op;
2188
- }
2189
- if (bits < 15) {
2190
- hold += input[_in++] << bits;
2191
- bits += 8;
2192
- hold += input[_in++] << bits;
2193
- bits += 8;
2194
- }
2195
- here = dcode[hold & dmask];
2196
- dodist:
2197
- for (; ; ) {
2198
- op = here >>> 24;
2199
- hold >>>= op;
2200
- bits -= op;
2201
- op = here >>> 16 & 255;
2202
- if (op & 16) {
2203
- dist = here & 65535;
2204
- op &= 15;
2205
- if (bits < op) {
2206
- hold += input[_in++] << bits;
2207
- bits += 8;
2208
- if (bits < op) {
2209
- hold += input[_in++] << bits;
2210
- bits += 8;
2211
- }
2212
- }
2213
- dist += hold & (1 << op) - 1;
2214
- if (dist > dmax) {
2215
- strm.msg = "invalid distance too far back";
2216
- state.mode = BAD;
2217
- break top;
2218
- }
2219
- hold >>>= op;
2220
- bits -= op;
2221
- op = _out - beg;
2222
- if (dist > op) {
2223
- op = dist - op;
2224
- if (op > whave) {
2225
- if (state.sane) {
2226
- strm.msg = "invalid distance too far back";
2227
- state.mode = BAD;
2228
- break top;
2229
- }
2230
- }
2231
- from = 0;
2232
- from_source = s_window;
2233
- if (wnext === 0) {
2234
- from += wsize - op;
2235
- if (op < len) {
2236
- len -= op;
2237
- do {
2238
- output[_out++] = s_window[from++];
2239
- } while (--op);
2240
- from = _out - dist;
2241
- from_source = output;
2242
- }
2243
- } else if (wnext < op) {
2244
- from += wsize + wnext - op;
2245
- op -= wnext;
2246
- if (op < len) {
2247
- len -= op;
2248
- do {
2249
- output[_out++] = s_window[from++];
2250
- } while (--op);
2251
- from = 0;
2252
- if (wnext < len) {
2253
- op = wnext;
2254
- len -= op;
2255
- do {
2256
- output[_out++] = s_window[from++];
2257
- } while (--op);
2258
- from = _out - dist;
2259
- from_source = output;
2260
- }
2261
- }
2262
- } else {
2263
- from += wnext - op;
2264
- if (op < len) {
2265
- len -= op;
2266
- do {
2267
- output[_out++] = s_window[from++];
2268
- } while (--op);
2269
- from = _out - dist;
2270
- from_source = output;
2271
- }
2272
- }
2273
- while (len > 2) {
2274
- output[_out++] = from_source[from++];
2275
- output[_out++] = from_source[from++];
2276
- output[_out++] = from_source[from++];
2277
- len -= 3;
2278
- }
2279
- if (len) {
2280
- output[_out++] = from_source[from++];
2281
- if (len > 1) {
2282
- output[_out++] = from_source[from++];
2283
- }
2284
- }
2285
- } else {
2286
- from = _out - dist;
2287
- do {
2288
- output[_out++] = output[from++];
2289
- output[_out++] = output[from++];
2290
- output[_out++] = output[from++];
2291
- len -= 3;
2292
- } while (len > 2);
2293
- if (len) {
2294
- output[_out++] = output[from++];
2295
- if (len > 1) {
2296
- output[_out++] = output[from++];
2297
- }
2298
- }
2299
- }
2300
- } else if ((op & 64) === 0) {
2301
- here = dcode[(here & 65535) + (hold & (1 << op) - 1)];
2302
- continue dodist;
2303
- } else {
2304
- strm.msg = "invalid distance code";
2305
- state.mode = BAD;
2306
- break top;
2307
- }
2308
- break;
2309
- }
2310
- } else if ((op & 64) === 0) {
2311
- here = lcode[(here & 65535) + (hold & (1 << op) - 1)];
2312
- continue dolen;
2313
- } else if (op & 32) {
2314
- state.mode = TYPE;
2315
- break top;
2316
- } else {
2317
- strm.msg = "invalid literal/length code";
2318
- state.mode = BAD;
2319
- break top;
2320
- }
2321
- break;
2322
- }
2323
- } while (_in < last && _out < end);
2324
- len = bits >> 3;
2325
- _in -= len;
2326
- bits -= len << 3;
2327
- hold &= (1 << bits) - 1;
2328
- strm.next_in = _in;
2329
- strm.next_out = _out;
2330
- strm.avail_in = _in < last ? 5 + (last - _in) : 5 - (_in - last);
2331
- strm.avail_out = _out < end ? 257 + (end - _out) : 257 - (_out - end);
2332
- state.hold = hold;
2333
- state.bits = bits;
2334
- return;
2335
- };
2336
- const MAXBITS = 15;
2337
- const ENOUGH_LENS = 852;
2338
- const ENOUGH_DISTS = 592;
2339
- const CODES = 0;
2340
- const LENS = 1;
2341
- const DISTS = 2;
2342
- const lbase = new Uint16Array([
2343
- /* Length codes 257..285 base */
2344
- 3,
2345
- 4,
2346
- 5,
2347
- 6,
2348
- 7,
2349
- 8,
2350
- 9,
2351
- 10,
2352
- 11,
2353
- 13,
2354
- 15,
2355
- 17,
2356
- 19,
2357
- 23,
2358
- 27,
2359
- 31,
2360
- 35,
2361
- 43,
2362
- 51,
2363
- 59,
2364
- 67,
2365
- 83,
2366
- 99,
2367
- 115,
2368
- 131,
2369
- 163,
2370
- 195,
2371
- 227,
2372
- 258,
2373
- 0,
2374
- 0
2375
- ]);
2376
- const lext = new Uint8Array([
2377
- /* Length codes 257..285 extra */
2378
- 16,
2379
- 16,
2380
- 16,
2381
- 16,
2382
- 16,
2383
- 16,
2384
- 16,
2385
- 16,
2386
- 17,
2387
- 17,
2388
- 17,
2389
- 17,
2390
- 18,
2391
- 18,
2392
- 18,
2393
- 18,
2394
- 19,
2395
- 19,
2396
- 19,
2397
- 19,
2398
- 20,
2399
- 20,
2400
- 20,
2401
- 20,
2402
- 21,
2403
- 21,
2404
- 21,
2405
- 21,
2406
- 16,
2407
- 72,
2408
- 78
2409
- ]);
2410
- const dbase = new Uint16Array([
2411
- /* Distance codes 0..29 base */
2412
- 1,
2413
- 2,
2414
- 3,
2415
- 4,
2416
- 5,
2417
- 7,
2418
- 9,
2419
- 13,
2420
- 17,
2421
- 25,
2422
- 33,
2423
- 49,
2424
- 65,
2425
- 97,
2426
- 129,
2427
- 193,
2428
- 257,
2429
- 385,
2430
- 513,
2431
- 769,
2432
- 1025,
2433
- 1537,
2434
- 2049,
2435
- 3073,
2436
- 4097,
2437
- 6145,
2438
- 8193,
2439
- 12289,
2440
- 16385,
2441
- 24577,
2442
- 0,
2443
- 0
2444
- ]);
2445
- const dext = new Uint8Array([
2446
- /* Distance codes 0..29 extra */
2447
- 16,
2448
- 16,
2449
- 16,
2450
- 16,
2451
- 17,
2452
- 17,
2453
- 18,
2454
- 18,
2455
- 19,
2456
- 19,
2457
- 20,
2458
- 20,
2459
- 21,
2460
- 21,
2461
- 22,
2462
- 22,
2463
- 23,
2464
- 23,
2465
- 24,
2466
- 24,
2467
- 25,
2468
- 25,
2469
- 26,
2470
- 26,
2471
- 27,
2472
- 27,
2473
- 28,
2474
- 28,
2475
- 29,
2476
- 29,
2477
- 64,
2478
- 64
2479
- ]);
2480
- const inflate_table = (type, lens, lens_index, codes, table, table_index, work, opts) => {
2481
- const bits = opts.bits;
2482
- let len = 0;
2483
- let sym = 0;
2484
- let min = 0, max = 0;
2485
- let root = 0;
2486
- let curr = 0;
2487
- let drop = 0;
2488
- let left = 0;
2489
- let used = 0;
2490
- let huff = 0;
2491
- let incr;
2492
- let fill;
2493
- let low;
2494
- let mask;
2495
- let next;
2496
- let base = null;
2497
- let base_index = 0;
2498
- let end;
2499
- const count = new Uint16Array(MAXBITS + 1);
2500
- const offs = new Uint16Array(MAXBITS + 1);
2501
- let extra = null;
2502
- let extra_index = 0;
2503
- let here_bits, here_op, here_val;
2504
- for (len = 0; len <= MAXBITS; len++) {
2505
- count[len] = 0;
2506
- }
2507
- for (sym = 0; sym < codes; sym++) {
2508
- count[lens[lens_index + sym]]++;
2509
- }
2510
- root = bits;
2511
- for (max = MAXBITS; max >= 1; max--) {
2512
- if (count[max] !== 0) {
2513
- break;
2514
- }
2515
- }
2516
- if (root > max) {
2517
- root = max;
2518
- }
2519
- if (max === 0) {
2520
- table[table_index++] = 1 << 24 | 64 << 16 | 0;
2521
- table[table_index++] = 1 << 24 | 64 << 16 | 0;
2522
- opts.bits = 1;
2523
- return 0;
2524
- }
2525
- for (min = 1; min < max; min++) {
2526
- if (count[min] !== 0) {
2527
- break;
2528
- }
2529
- }
2530
- if (root < min) {
2531
- root = min;
2532
- }
2533
- left = 1;
2534
- for (len = 1; len <= MAXBITS; len++) {
2535
- left <<= 1;
2536
- left -= count[len];
2537
- if (left < 0) {
2538
- return -1;
2539
- }
2540
- }
2541
- if (left > 0 && (type === CODES || max !== 1)) {
2542
- return -1;
2543
- }
2544
- offs[1] = 0;
2545
- for (len = 1; len < MAXBITS; len++) {
2546
- offs[len + 1] = offs[len] + count[len];
2547
- }
2548
- for (sym = 0; sym < codes; sym++) {
2549
- if (lens[lens_index + sym] !== 0) {
2550
- work[offs[lens[lens_index + sym]]++] = sym;
2551
- }
2552
- }
2553
- if (type === CODES) {
2554
- base = extra = work;
2555
- end = 19;
2556
- } else if (type === LENS) {
2557
- base = lbase;
2558
- base_index -= 257;
2559
- extra = lext;
2560
- extra_index -= 257;
2561
- end = 256;
2562
- } else {
2563
- base = dbase;
2564
- extra = dext;
2565
- end = -1;
2566
- }
2567
- huff = 0;
2568
- sym = 0;
2569
- len = min;
2570
- next = table_index;
2571
- curr = root;
2572
- drop = 0;
2573
- low = -1;
2574
- used = 1 << root;
2575
- mask = used - 1;
2576
- if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) {
2577
- return 1;
2578
- }
2579
- for (; ; ) {
2580
- here_bits = len - drop;
2581
- if (work[sym] < end) {
2582
- here_op = 0;
2583
- here_val = work[sym];
2584
- } else if (work[sym] > end) {
2585
- here_op = extra[extra_index + work[sym]];
2586
- here_val = base[base_index + work[sym]];
2587
- } else {
2588
- here_op = 32 + 64;
2589
- here_val = 0;
2590
- }
2591
- incr = 1 << len - drop;
2592
- fill = 1 << curr;
2593
- min = fill;
2594
- do {
2595
- fill -= incr;
2596
- table[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0;
2597
- } while (fill !== 0);
2598
- incr = 1 << len - 1;
2599
- while (huff & incr) {
2600
- incr >>= 1;
2601
- }
2602
- if (incr !== 0) {
2603
- huff &= incr - 1;
2604
- huff += incr;
2605
- } else {
2606
- huff = 0;
2607
- }
2608
- sym++;
2609
- if (--count[len] === 0) {
2610
- if (len === max) {
2611
- break;
2612
- }
2613
- len = lens[lens_index + work[sym]];
2614
- }
2615
- if (len > root && (huff & mask) !== low) {
2616
- if (drop === 0) {
2617
- drop = root;
2618
- }
2619
- next += min;
2620
- curr = len - drop;
2621
- left = 1 << curr;
2622
- while (curr + drop < max) {
2623
- left -= count[curr + drop];
2624
- if (left <= 0) {
2625
- break;
2626
- }
2627
- curr++;
2628
- left <<= 1;
2629
- }
2630
- used += 1 << curr;
2631
- if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) {
2632
- return 1;
2633
- }
2634
- low = huff & mask;
2635
- table[low] = root << 24 | curr << 16 | next - table_index | 0;
2636
- }
2637
- }
2638
- if (huff !== 0) {
2639
- table[next + huff] = len - drop << 24 | 64 << 16 | 0;
2640
- }
2641
- opts.bits = root;
2642
- return 0;
2643
- };
2644
- var inftrees = inflate_table;
2645
- const CODES$1 = 0;
2646
- const LENS$1 = 1;
2647
- const DISTS$1 = 2;
2648
- const {
2649
- Z_FINISH: Z_FINISH$2,
2650
- Z_BLOCK: Z_BLOCK$1,
2651
- Z_TREES,
2652
- Z_OK: Z_OK$2,
2653
- Z_STREAM_END: Z_STREAM_END$2,
2654
- Z_NEED_DICT,
2655
- Z_STREAM_ERROR: Z_STREAM_ERROR$1,
2656
- Z_DATA_ERROR: Z_DATA_ERROR$1,
2657
- Z_MEM_ERROR,
2658
- Z_BUF_ERROR: Z_BUF_ERROR$1,
2659
- Z_DEFLATED: Z_DEFLATED$2
2660
- } = constants;
2661
- const HEAD = 1;
2662
- const FLAGS = 2;
2663
- const TIME = 3;
2664
- const OS = 4;
2665
- const EXLEN = 5;
2666
- const EXTRA = 6;
2667
- const NAME = 7;
2668
- const COMMENT = 8;
2669
- const HCRC = 9;
2670
- const DICTID = 10;
2671
- const DICT = 11;
2672
- const TYPE$1 = 12;
2673
- const TYPEDO = 13;
2674
- const STORED = 14;
2675
- const COPY_ = 15;
2676
- const COPY = 16;
2677
- const TABLE = 17;
2678
- const LENLENS = 18;
2679
- const CODELENS = 19;
2680
- const LEN_ = 20;
2681
- const LEN = 21;
2682
- const LENEXT = 22;
2683
- const DIST = 23;
2684
- const DISTEXT = 24;
2685
- const MATCH = 25;
2686
- const LIT = 26;
2687
- const CHECK = 27;
2688
- const LENGTH = 28;
2689
- const DONE = 29;
2690
- const BAD$1 = 30;
2691
- const MEM = 31;
2692
- const SYNC = 32;
2693
- const ENOUGH_LENS$1 = 852;
2694
- const ENOUGH_DISTS$1 = 592;
2695
- const MAX_WBITS$1 = 15;
2696
- const DEF_WBITS = MAX_WBITS$1;
2697
- const zswap32 = (q) => {
2698
- return (q >>> 24 & 255) + (q >>> 8 & 65280) + ((q & 65280) << 8) + ((q & 255) << 24);
2699
- };
2700
- function InflateState() {
2701
- this.mode = 0;
2702
- this.last = false;
2703
- this.wrap = 0;
2704
- this.havedict = false;
2705
- this.flags = 0;
2706
- this.dmax = 0;
2707
- this.check = 0;
2708
- this.total = 0;
2709
- this.head = null;
2710
- this.wbits = 0;
2711
- this.wsize = 0;
2712
- this.whave = 0;
2713
- this.wnext = 0;
2714
- this.window = null;
2715
- this.hold = 0;
2716
- this.bits = 0;
2717
- this.length = 0;
2718
- this.offset = 0;
2719
- this.extra = 0;
2720
- this.lencode = null;
2721
- this.distcode = null;
2722
- this.lenbits = 0;
2723
- this.distbits = 0;
2724
- this.ncode = 0;
2725
- this.nlen = 0;
2726
- this.ndist = 0;
2727
- this.have = 0;
2728
- this.next = null;
2729
- this.lens = new Uint16Array(320);
2730
- this.work = new Uint16Array(288);
2731
- this.lendyn = null;
2732
- this.distdyn = null;
2733
- this.sane = 0;
2734
- this.back = 0;
2735
- this.was = 0;
2736
- }
2737
- const inflateResetKeep = (strm) => {
2738
- if (!strm || !strm.state) {
2739
- return Z_STREAM_ERROR$1;
2740
- }
2741
- const state = strm.state;
2742
- strm.total_in = strm.total_out = state.total = 0;
2743
- strm.msg = "";
2744
- if (state.wrap) {
2745
- strm.adler = state.wrap & 1;
2746
- }
2747
- state.mode = HEAD;
2748
- state.last = 0;
2749
- state.havedict = 0;
2750
- state.dmax = 32768;
2751
- state.head = null;
2752
- state.hold = 0;
2753
- state.bits = 0;
2754
- state.lencode = state.lendyn = new Int32Array(ENOUGH_LENS$1);
2755
- state.distcode = state.distdyn = new Int32Array(ENOUGH_DISTS$1);
2756
- state.sane = 1;
2757
- state.back = -1;
2758
- return Z_OK$2;
2759
- };
2760
- const inflateReset = (strm) => {
2761
- if (!strm || !strm.state) {
2762
- return Z_STREAM_ERROR$1;
2763
- }
2764
- const state = strm.state;
2765
- state.wsize = 0;
2766
- state.whave = 0;
2767
- state.wnext = 0;
2768
- return inflateResetKeep(strm);
2769
- };
2770
- const inflateReset2 = (strm, windowBits) => {
2771
- let wrap;
2772
- if (!strm || !strm.state) {
2773
- return Z_STREAM_ERROR$1;
2774
- }
2775
- const state = strm.state;
2776
- if (windowBits < 0) {
2777
- wrap = 0;
2778
- windowBits = -windowBits;
2779
- } else {
2780
- wrap = (windowBits >> 4) + 1;
2781
- if (windowBits < 48) {
2782
- windowBits &= 15;
2783
- }
2784
- }
2785
- if (windowBits && (windowBits < 8 || windowBits > 15)) {
2786
- return Z_STREAM_ERROR$1;
2787
- }
2788
- if (state.window !== null && state.wbits !== windowBits) {
2789
- state.window = null;
2790
- }
2791
- state.wrap = wrap;
2792
- state.wbits = windowBits;
2793
- return inflateReset(strm);
2794
- };
2795
- const inflateInit2 = (strm, windowBits) => {
2796
- if (!strm) {
2797
- return Z_STREAM_ERROR$1;
2798
- }
2799
- const state = new InflateState();
2800
- strm.state = state;
2801
- state.window = null;
2802
- const ret = inflateReset2(strm, windowBits);
2803
- if (ret !== Z_OK$2) {
2804
- strm.state = null;
2805
- }
2806
- return ret;
2807
- };
2808
- const inflateInit = (strm) => {
2809
- return inflateInit2(strm, DEF_WBITS);
2810
- };
2811
- let virgin = true;
2812
- let lenfix, distfix;
2813
- const fixedtables = (state) => {
2814
- if (virgin) {
2815
- lenfix = new Int32Array(512);
2816
- distfix = new Int32Array(32);
2817
- let sym = 0;
2818
- while (sym < 144) {
2819
- state.lens[sym++] = 8;
2820
- }
2821
- while (sym < 256) {
2822
- state.lens[sym++] = 9;
2823
- }
2824
- while (sym < 280) {
2825
- state.lens[sym++] = 7;
2826
- }
2827
- while (sym < 288) {
2828
- state.lens[sym++] = 8;
2829
- }
2830
- inftrees(LENS$1, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });
2831
- sym = 0;
2832
- while (sym < 32) {
2833
- state.lens[sym++] = 5;
2834
- }
2835
- inftrees(DISTS$1, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });
2836
- virgin = false;
2837
- }
2838
- state.lencode = lenfix;
2839
- state.lenbits = 9;
2840
- state.distcode = distfix;
2841
- state.distbits = 5;
2842
- };
2843
- const updatewindow = (strm, src, end, copy) => {
2844
- let dist;
2845
- const state = strm.state;
2846
- if (state.window === null) {
2847
- state.wsize = 1 << state.wbits;
2848
- state.wnext = 0;
2849
- state.whave = 0;
2850
- state.window = new Uint8Array(state.wsize);
2851
- }
2852
- if (copy >= state.wsize) {
2853
- state.window.set(src.subarray(end - state.wsize, end), 0);
2854
- state.wnext = 0;
2855
- state.whave = state.wsize;
2856
- } else {
2857
- dist = state.wsize - state.wnext;
2858
- if (dist > copy) {
2859
- dist = copy;
2860
- }
2861
- state.window.set(src.subarray(end - copy, end - copy + dist), state.wnext);
2862
- copy -= dist;
2863
- if (copy) {
2864
- state.window.set(src.subarray(end - copy, end), 0);
2865
- state.wnext = copy;
2866
- state.whave = state.wsize;
2867
- } else {
2868
- state.wnext += dist;
2869
- if (state.wnext === state.wsize) {
2870
- state.wnext = 0;
2871
- }
2872
- if (state.whave < state.wsize) {
2873
- state.whave += dist;
2874
- }
2875
- }
2876
- }
2877
- return 0;
2878
- };
2879
- const inflate = (strm, flush) => {
2880
- let state;
2881
- let input, output;
2882
- let next;
2883
- let put;
2884
- let have, left;
2885
- let hold;
2886
- let bits;
2887
- let _in, _out;
2888
- let copy;
2889
- let from;
2890
- let from_source;
2891
- let here = 0;
2892
- let here_bits, here_op, here_val;
2893
- let last_bits, last_op, last_val;
2894
- let len;
2895
- let ret;
2896
- const hbuf = new Uint8Array(4);
2897
- let opts;
2898
- let n;
2899
- const order = (
2900
- /* permutation of code lengths */
2901
- new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15])
2902
- );
2903
- if (!strm || !strm.state || !strm.output || !strm.input && strm.avail_in !== 0) {
2904
- return Z_STREAM_ERROR$1;
2905
- }
2906
- state = strm.state;
2907
- if (state.mode === TYPE$1) {
2908
- state.mode = TYPEDO;
2909
- }
2910
- put = strm.next_out;
2911
- output = strm.output;
2912
- left = strm.avail_out;
2913
- next = strm.next_in;
2914
- input = strm.input;
2915
- have = strm.avail_in;
2916
- hold = state.hold;
2917
- bits = state.bits;
2918
- _in = have;
2919
- _out = left;
2920
- ret = Z_OK$2;
2921
- inf_leave:
2922
- for (; ; ) {
2923
- switch (state.mode) {
2924
- case HEAD:
2925
- if (state.wrap === 0) {
2926
- state.mode = TYPEDO;
2927
- break;
2928
- }
2929
- while (bits < 16) {
2930
- if (have === 0) {
2931
- break inf_leave;
2932
- }
2933
- have--;
2934
- hold += input[next++] << bits;
2935
- bits += 8;
2936
- }
2937
- if (state.wrap & 2 && hold === 35615) {
2938
- state.check = 0;
2939
- hbuf[0] = hold & 255;
2940
- hbuf[1] = hold >>> 8 & 255;
2941
- state.check = crc32_1(state.check, hbuf, 2, 0);
2942
- hold = 0;
2943
- bits = 0;
2944
- state.mode = FLAGS;
2945
- break;
2946
- }
2947
- state.flags = 0;
2948
- if (state.head) {
2949
- state.head.done = false;
2950
- }
2951
- if (!(state.wrap & 1) || /* check if zlib header allowed */
2952
- (((hold & 255) << 8) + (hold >> 8)) % 31) {
2953
- strm.msg = "incorrect header check";
2954
- state.mode = BAD$1;
2955
- break;
2956
- }
2957
- if ((hold & 15) !== Z_DEFLATED$2) {
2958
- strm.msg = "unknown compression method";
2959
- state.mode = BAD$1;
2960
- break;
2961
- }
2962
- hold >>>= 4;
2963
- bits -= 4;
2964
- len = (hold & 15) + 8;
2965
- if (state.wbits === 0) {
2966
- state.wbits = len;
2967
- } else if (len > state.wbits) {
2968
- strm.msg = "invalid window size";
2969
- state.mode = BAD$1;
2970
- break;
2971
- }
2972
- state.dmax = 1 << state.wbits;
2973
- strm.adler = state.check = 1;
2974
- state.mode = hold & 512 ? DICTID : TYPE$1;
2975
- hold = 0;
2976
- bits = 0;
2977
- break;
2978
- case FLAGS:
2979
- while (bits < 16) {
2980
- if (have === 0) {
2981
- break inf_leave;
2982
- }
2983
- have--;
2984
- hold += input[next++] << bits;
2985
- bits += 8;
2986
- }
2987
- state.flags = hold;
2988
- if ((state.flags & 255) !== Z_DEFLATED$2) {
2989
- strm.msg = "unknown compression method";
2990
- state.mode = BAD$1;
2991
- break;
2992
- }
2993
- if (state.flags & 57344) {
2994
- strm.msg = "unknown header flags set";
2995
- state.mode = BAD$1;
2996
- break;
2997
- }
2998
- if (state.head) {
2999
- state.head.text = hold >> 8 & 1;
3000
- }
3001
- if (state.flags & 512) {
3002
- hbuf[0] = hold & 255;
3003
- hbuf[1] = hold >>> 8 & 255;
3004
- state.check = crc32_1(state.check, hbuf, 2, 0);
3005
- }
3006
- hold = 0;
3007
- bits = 0;
3008
- state.mode = TIME;
3009
- case TIME:
3010
- while (bits < 32) {
3011
- if (have === 0) {
3012
- break inf_leave;
3013
- }
3014
- have--;
3015
- hold += input[next++] << bits;
3016
- bits += 8;
3017
- }
3018
- if (state.head) {
3019
- state.head.time = hold;
3020
- }
3021
- if (state.flags & 512) {
3022
- hbuf[0] = hold & 255;
3023
- hbuf[1] = hold >>> 8 & 255;
3024
- hbuf[2] = hold >>> 16 & 255;
3025
- hbuf[3] = hold >>> 24 & 255;
3026
- state.check = crc32_1(state.check, hbuf, 4, 0);
3027
- }
3028
- hold = 0;
3029
- bits = 0;
3030
- state.mode = OS;
3031
- case OS:
3032
- while (bits < 16) {
3033
- if (have === 0) {
3034
- break inf_leave;
3035
- }
3036
- have--;
3037
- hold += input[next++] << bits;
3038
- bits += 8;
3039
- }
3040
- if (state.head) {
3041
- state.head.xflags = hold & 255;
3042
- state.head.os = hold >> 8;
3043
- }
3044
- if (state.flags & 512) {
3045
- hbuf[0] = hold & 255;
3046
- hbuf[1] = hold >>> 8 & 255;
3047
- state.check = crc32_1(state.check, hbuf, 2, 0);
3048
- }
3049
- hold = 0;
3050
- bits = 0;
3051
- state.mode = EXLEN;
3052
- case EXLEN:
3053
- if (state.flags & 1024) {
3054
- while (bits < 16) {
3055
- if (have === 0) {
3056
- break inf_leave;
3057
- }
3058
- have--;
3059
- hold += input[next++] << bits;
3060
- bits += 8;
3061
- }
3062
- state.length = hold;
3063
- if (state.head) {
3064
- state.head.extra_len = hold;
3065
- }
3066
- if (state.flags & 512) {
3067
- hbuf[0] = hold & 255;
3068
- hbuf[1] = hold >>> 8 & 255;
3069
- state.check = crc32_1(state.check, hbuf, 2, 0);
3070
- }
3071
- hold = 0;
3072
- bits = 0;
3073
- } else if (state.head) {
3074
- state.head.extra = null;
3075
- }
3076
- state.mode = EXTRA;
3077
- case EXTRA:
3078
- if (state.flags & 1024) {
3079
- copy = state.length;
3080
- if (copy > have) {
3081
- copy = have;
3082
- }
3083
- if (copy) {
3084
- if (state.head) {
3085
- len = state.head.extra_len - state.length;
3086
- if (!state.head.extra) {
3087
- state.head.extra = new Uint8Array(state.head.extra_len);
3088
- }
3089
- state.head.extra.set(
3090
- input.subarray(
3091
- next,
3092
- // extra field is limited to 65536 bytes
3093
- // - no need for additional size check
3094
- next + copy
3095
- ),
3096
- /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
3097
- len
3098
- );
3099
- }
3100
- if (state.flags & 512) {
3101
- state.check = crc32_1(state.check, input, copy, next);
3102
- }
3103
- have -= copy;
3104
- next += copy;
3105
- state.length -= copy;
3106
- }
3107
- if (state.length) {
3108
- break inf_leave;
3109
- }
3110
- }
3111
- state.length = 0;
3112
- state.mode = NAME;
3113
- case NAME:
3114
- if (state.flags & 2048) {
3115
- if (have === 0) {
3116
- break inf_leave;
3117
- }
3118
- copy = 0;
3119
- do {
3120
- len = input[next + copy++];
3121
- if (state.head && len && state.length < 65536) {
3122
- state.head.name += String.fromCharCode(len);
3123
- }
3124
- } while (len && copy < have);
3125
- if (state.flags & 512) {
3126
- state.check = crc32_1(state.check, input, copy, next);
3127
- }
3128
- have -= copy;
3129
- next += copy;
3130
- if (len) {
3131
- break inf_leave;
3132
- }
3133
- } else if (state.head) {
3134
- state.head.name = null;
3135
- }
3136
- state.length = 0;
3137
- state.mode = COMMENT;
3138
- case COMMENT:
3139
- if (state.flags & 4096) {
3140
- if (have === 0) {
3141
- break inf_leave;
3142
- }
3143
- copy = 0;
3144
- do {
3145
- len = input[next + copy++];
3146
- if (state.head && len && state.length < 65536) {
3147
- state.head.comment += String.fromCharCode(len);
3148
- }
3149
- } while (len && copy < have);
3150
- if (state.flags & 512) {
3151
- state.check = crc32_1(state.check, input, copy, next);
3152
- }
3153
- have -= copy;
3154
- next += copy;
3155
- if (len) {
3156
- break inf_leave;
3157
- }
3158
- } else if (state.head) {
3159
- state.head.comment = null;
3160
- }
3161
- state.mode = HCRC;
3162
- case HCRC:
3163
- if (state.flags & 512) {
3164
- while (bits < 16) {
3165
- if (have === 0) {
3166
- break inf_leave;
3167
- }
3168
- have--;
3169
- hold += input[next++] << bits;
3170
- bits += 8;
3171
- }
3172
- if (hold !== (state.check & 65535)) {
3173
- strm.msg = "header crc mismatch";
3174
- state.mode = BAD$1;
3175
- break;
3176
- }
3177
- hold = 0;
3178
- bits = 0;
3179
- }
3180
- if (state.head) {
3181
- state.head.hcrc = state.flags >> 9 & 1;
3182
- state.head.done = true;
3183
- }
3184
- strm.adler = state.check = 0;
3185
- state.mode = TYPE$1;
3186
- break;
3187
- case DICTID:
3188
- while (bits < 32) {
3189
- if (have === 0) {
3190
- break inf_leave;
3191
- }
3192
- have--;
3193
- hold += input[next++] << bits;
3194
- bits += 8;
3195
- }
3196
- strm.adler = state.check = zswap32(hold);
3197
- hold = 0;
3198
- bits = 0;
3199
- state.mode = DICT;
3200
- case DICT:
3201
- if (state.havedict === 0) {
3202
- strm.next_out = put;
3203
- strm.avail_out = left;
3204
- strm.next_in = next;
3205
- strm.avail_in = have;
3206
- state.hold = hold;
3207
- state.bits = bits;
3208
- return Z_NEED_DICT;
3209
- }
3210
- strm.adler = state.check = 1;
3211
- state.mode = TYPE$1;
3212
- case TYPE$1:
3213
- if (flush === Z_BLOCK$1 || flush === Z_TREES) {
3214
- break inf_leave;
3215
- }
3216
- case TYPEDO:
3217
- if (state.last) {
3218
- hold >>>= bits & 7;
3219
- bits -= bits & 7;
3220
- state.mode = CHECK;
3221
- break;
3222
- }
3223
- while (bits < 3) {
3224
- if (have === 0) {
3225
- break inf_leave;
3226
- }
3227
- have--;
3228
- hold += input[next++] << bits;
3229
- bits += 8;
3230
- }
3231
- state.last = hold & 1;
3232
- hold >>>= 1;
3233
- bits -= 1;
3234
- switch (hold & 3) {
3235
- case 0:
3236
- state.mode = STORED;
3237
- break;
3238
- case 1:
3239
- fixedtables(state);
3240
- state.mode = LEN_;
3241
- if (flush === Z_TREES) {
3242
- hold >>>= 2;
3243
- bits -= 2;
3244
- break inf_leave;
3245
- }
3246
- break;
3247
- case 2:
3248
- state.mode = TABLE;
3249
- break;
3250
- case 3:
3251
- strm.msg = "invalid block type";
3252
- state.mode = BAD$1;
3253
- }
3254
- hold >>>= 2;
3255
- bits -= 2;
3256
- break;
3257
- case STORED:
3258
- hold >>>= bits & 7;
3259
- bits -= bits & 7;
3260
- while (bits < 32) {
3261
- if (have === 0) {
3262
- break inf_leave;
3263
- }
3264
- have--;
3265
- hold += input[next++] << bits;
3266
- bits += 8;
3267
- }
3268
- if ((hold & 65535) !== (hold >>> 16 ^ 65535)) {
3269
- strm.msg = "invalid stored block lengths";
3270
- state.mode = BAD$1;
3271
- break;
3272
- }
3273
- state.length = hold & 65535;
3274
- hold = 0;
3275
- bits = 0;
3276
- state.mode = COPY_;
3277
- if (flush === Z_TREES) {
3278
- break inf_leave;
3279
- }
3280
- case COPY_:
3281
- state.mode = COPY;
3282
- case COPY:
3283
- copy = state.length;
3284
- if (copy) {
3285
- if (copy > have) {
3286
- copy = have;
3287
- }
3288
- if (copy > left) {
3289
- copy = left;
3290
- }
3291
- if (copy === 0) {
3292
- break inf_leave;
3293
- }
3294
- output.set(input.subarray(next, next + copy), put);
3295
- have -= copy;
3296
- next += copy;
3297
- left -= copy;
3298
- put += copy;
3299
- state.length -= copy;
3300
- break;
3301
- }
3302
- state.mode = TYPE$1;
3303
- break;
3304
- case TABLE:
3305
- while (bits < 14) {
3306
- if (have === 0) {
3307
- break inf_leave;
3308
- }
3309
- have--;
3310
- hold += input[next++] << bits;
3311
- bits += 8;
3312
- }
3313
- state.nlen = (hold & 31) + 257;
3314
- hold >>>= 5;
3315
- bits -= 5;
3316
- state.ndist = (hold & 31) + 1;
3317
- hold >>>= 5;
3318
- bits -= 5;
3319
- state.ncode = (hold & 15) + 4;
3320
- hold >>>= 4;
3321
- bits -= 4;
3322
- if (state.nlen > 286 || state.ndist > 30) {
3323
- strm.msg = "too many length or distance symbols";
3324
- state.mode = BAD$1;
3325
- break;
3326
- }
3327
- state.have = 0;
3328
- state.mode = LENLENS;
3329
- case LENLENS:
3330
- while (state.have < state.ncode) {
3331
- while (bits < 3) {
3332
- if (have === 0) {
3333
- break inf_leave;
3334
- }
3335
- have--;
3336
- hold += input[next++] << bits;
3337
- bits += 8;
3338
- }
3339
- state.lens[order[state.have++]] = hold & 7;
3340
- hold >>>= 3;
3341
- bits -= 3;
3342
- }
3343
- while (state.have < 19) {
3344
- state.lens[order[state.have++]] = 0;
3345
- }
3346
- state.lencode = state.lendyn;
3347
- state.lenbits = 7;
3348
- opts = { bits: state.lenbits };
3349
- ret = inftrees(CODES$1, state.lens, 0, 19, state.lencode, 0, state.work, opts);
3350
- state.lenbits = opts.bits;
3351
- if (ret) {
3352
- strm.msg = "invalid code lengths set";
3353
- state.mode = BAD$1;
3354
- break;
3355
- }
3356
- state.have = 0;
3357
- state.mode = CODELENS;
3358
- case CODELENS:
3359
- while (state.have < state.nlen + state.ndist) {
3360
- for (; ; ) {
3361
- here = state.lencode[hold & (1 << state.lenbits) - 1];
3362
- here_bits = here >>> 24;
3363
- here_op = here >>> 16 & 255;
3364
- here_val = here & 65535;
3365
- if (here_bits <= bits) {
3366
- break;
3367
- }
3368
- if (have === 0) {
3369
- break inf_leave;
3370
- }
3371
- have--;
3372
- hold += input[next++] << bits;
3373
- bits += 8;
3374
- }
3375
- if (here_val < 16) {
3376
- hold >>>= here_bits;
3377
- bits -= here_bits;
3378
- state.lens[state.have++] = here_val;
3379
- } else {
3380
- if (here_val === 16) {
3381
- n = here_bits + 2;
3382
- while (bits < n) {
3383
- if (have === 0) {
3384
- break inf_leave;
3385
- }
3386
- have--;
3387
- hold += input[next++] << bits;
3388
- bits += 8;
3389
- }
3390
- hold >>>= here_bits;
3391
- bits -= here_bits;
3392
- if (state.have === 0) {
3393
- strm.msg = "invalid bit length repeat";
3394
- state.mode = BAD$1;
3395
- break;
3396
- }
3397
- len = state.lens[state.have - 1];
3398
- copy = 3 + (hold & 3);
3399
- hold >>>= 2;
3400
- bits -= 2;
3401
- } else if (here_val === 17) {
3402
- n = here_bits + 3;
3403
- while (bits < n) {
3404
- if (have === 0) {
3405
- break inf_leave;
3406
- }
3407
- have--;
3408
- hold += input[next++] << bits;
3409
- bits += 8;
3410
- }
3411
- hold >>>= here_bits;
3412
- bits -= here_bits;
3413
- len = 0;
3414
- copy = 3 + (hold & 7);
3415
- hold >>>= 3;
3416
- bits -= 3;
3417
- } else {
3418
- n = here_bits + 7;
3419
- while (bits < n) {
3420
- if (have === 0) {
3421
- break inf_leave;
3422
- }
3423
- have--;
3424
- hold += input[next++] << bits;
3425
- bits += 8;
3426
- }
3427
- hold >>>= here_bits;
3428
- bits -= here_bits;
3429
- len = 0;
3430
- copy = 11 + (hold & 127);
3431
- hold >>>= 7;
3432
- bits -= 7;
3433
- }
3434
- if (state.have + copy > state.nlen + state.ndist) {
3435
- strm.msg = "invalid bit length repeat";
3436
- state.mode = BAD$1;
3437
- break;
3438
- }
3439
- while (copy--) {
3440
- state.lens[state.have++] = len;
3441
- }
3442
- }
3443
- }
3444
- if (state.mode === BAD$1) {
3445
- break;
3446
- }
3447
- if (state.lens[256] === 0) {
3448
- strm.msg = "invalid code -- missing end-of-block";
3449
- state.mode = BAD$1;
3450
- break;
3451
- }
3452
- state.lenbits = 9;
3453
- opts = { bits: state.lenbits };
3454
- ret = inftrees(LENS$1, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);
3455
- state.lenbits = opts.bits;
3456
- if (ret) {
3457
- strm.msg = "invalid literal/lengths set";
3458
- state.mode = BAD$1;
3459
- break;
3460
- }
3461
- state.distbits = 6;
3462
- state.distcode = state.distdyn;
3463
- opts = { bits: state.distbits };
3464
- ret = inftrees(DISTS$1, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);
3465
- state.distbits = opts.bits;
3466
- if (ret) {
3467
- strm.msg = "invalid distances set";
3468
- state.mode = BAD$1;
3469
- break;
3470
- }
3471
- state.mode = LEN_;
3472
- if (flush === Z_TREES) {
3473
- break inf_leave;
3474
- }
3475
- case LEN_:
3476
- state.mode = LEN;
3477
- case LEN:
3478
- if (have >= 6 && left >= 258) {
3479
- strm.next_out = put;
3480
- strm.avail_out = left;
3481
- strm.next_in = next;
3482
- strm.avail_in = have;
3483
- state.hold = hold;
3484
- state.bits = bits;
3485
- inffast(strm, _out);
3486
- put = strm.next_out;
3487
- output = strm.output;
3488
- left = strm.avail_out;
3489
- next = strm.next_in;
3490
- input = strm.input;
3491
- have = strm.avail_in;
3492
- hold = state.hold;
3493
- bits = state.bits;
3494
- if (state.mode === TYPE$1) {
3495
- state.back = -1;
3496
- }
3497
- break;
3498
- }
3499
- state.back = 0;
3500
- for (; ; ) {
3501
- here = state.lencode[hold & (1 << state.lenbits) - 1];
3502
- here_bits = here >>> 24;
3503
- here_op = here >>> 16 & 255;
3504
- here_val = here & 65535;
3505
- if (here_bits <= bits) {
3506
- break;
3507
- }
3508
- if (have === 0) {
3509
- break inf_leave;
3510
- }
3511
- have--;
3512
- hold += input[next++] << bits;
3513
- bits += 8;
3514
- }
3515
- if (here_op && (here_op & 240) === 0) {
3516
- last_bits = here_bits;
3517
- last_op = here_op;
3518
- last_val = here_val;
3519
- for (; ; ) {
3520
- here = state.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)];
3521
- here_bits = here >>> 24;
3522
- here_op = here >>> 16 & 255;
3523
- here_val = here & 65535;
3524
- if (last_bits + here_bits <= bits) {
3525
- break;
3526
- }
3527
- if (have === 0) {
3528
- break inf_leave;
3529
- }
3530
- have--;
3531
- hold += input[next++] << bits;
3532
- bits += 8;
3533
- }
3534
- hold >>>= last_bits;
3535
- bits -= last_bits;
3536
- state.back += last_bits;
3537
- }
3538
- hold >>>= here_bits;
3539
- bits -= here_bits;
3540
- state.back += here_bits;
3541
- state.length = here_val;
3542
- if (here_op === 0) {
3543
- state.mode = LIT;
3544
- break;
3545
- }
3546
- if (here_op & 32) {
3547
- state.back = -1;
3548
- state.mode = TYPE$1;
3549
- break;
3550
- }
3551
- if (here_op & 64) {
3552
- strm.msg = "invalid literal/length code";
3553
- state.mode = BAD$1;
3554
- break;
3555
- }
3556
- state.extra = here_op & 15;
3557
- state.mode = LENEXT;
3558
- case LENEXT:
3559
- if (state.extra) {
3560
- n = state.extra;
3561
- while (bits < n) {
3562
- if (have === 0) {
3563
- break inf_leave;
3564
- }
3565
- have--;
3566
- hold += input[next++] << bits;
3567
- bits += 8;
3568
- }
3569
- state.length += hold & (1 << state.extra) - 1;
3570
- hold >>>= state.extra;
3571
- bits -= state.extra;
3572
- state.back += state.extra;
3573
- }
3574
- state.was = state.length;
3575
- state.mode = DIST;
3576
- case DIST:
3577
- for (; ; ) {
3578
- here = state.distcode[hold & (1 << state.distbits) - 1];
3579
- here_bits = here >>> 24;
3580
- here_op = here >>> 16 & 255;
3581
- here_val = here & 65535;
3582
- if (here_bits <= bits) {
3583
- break;
3584
- }
3585
- if (have === 0) {
3586
- break inf_leave;
3587
- }
3588
- have--;
3589
- hold += input[next++] << bits;
3590
- bits += 8;
3591
- }
3592
- if ((here_op & 240) === 0) {
3593
- last_bits = here_bits;
3594
- last_op = here_op;
3595
- last_val = here_val;
3596
- for (; ; ) {
3597
- here = state.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)];
3598
- here_bits = here >>> 24;
3599
- here_op = here >>> 16 & 255;
3600
- here_val = here & 65535;
3601
- if (last_bits + here_bits <= bits) {
3602
- break;
3603
- }
3604
- if (have === 0) {
3605
- break inf_leave;
3606
- }
3607
- have--;
3608
- hold += input[next++] << bits;
3609
- bits += 8;
3610
- }
3611
- hold >>>= last_bits;
3612
- bits -= last_bits;
3613
- state.back += last_bits;
3614
- }
3615
- hold >>>= here_bits;
3616
- bits -= here_bits;
3617
- state.back += here_bits;
3618
- if (here_op & 64) {
3619
- strm.msg = "invalid distance code";
3620
- state.mode = BAD$1;
3621
- break;
3622
- }
3623
- state.offset = here_val;
3624
- state.extra = here_op & 15;
3625
- state.mode = DISTEXT;
3626
- case DISTEXT:
3627
- if (state.extra) {
3628
- n = state.extra;
3629
- while (bits < n) {
3630
- if (have === 0) {
3631
- break inf_leave;
3632
- }
3633
- have--;
3634
- hold += input[next++] << bits;
3635
- bits += 8;
3636
- }
3637
- state.offset += hold & (1 << state.extra) - 1;
3638
- hold >>>= state.extra;
3639
- bits -= state.extra;
3640
- state.back += state.extra;
3641
- }
3642
- if (state.offset > state.dmax) {
3643
- strm.msg = "invalid distance too far back";
3644
- state.mode = BAD$1;
3645
- break;
3646
- }
3647
- state.mode = MATCH;
3648
- case MATCH:
3649
- if (left === 0) {
3650
- break inf_leave;
3651
- }
3652
- copy = _out - left;
3653
- if (state.offset > copy) {
3654
- copy = state.offset - copy;
3655
- if (copy > state.whave) {
3656
- if (state.sane) {
3657
- strm.msg = "invalid distance too far back";
3658
- state.mode = BAD$1;
3659
- break;
3660
- }
3661
- }
3662
- if (copy > state.wnext) {
3663
- copy -= state.wnext;
3664
- from = state.wsize - copy;
3665
- } else {
3666
- from = state.wnext - copy;
3667
- }
3668
- if (copy > state.length) {
3669
- copy = state.length;
3670
- }
3671
- from_source = state.window;
3672
- } else {
3673
- from_source = output;
3674
- from = put - state.offset;
3675
- copy = state.length;
3676
- }
3677
- if (copy > left) {
3678
- copy = left;
3679
- }
3680
- left -= copy;
3681
- state.length -= copy;
3682
- do {
3683
- output[put++] = from_source[from++];
3684
- } while (--copy);
3685
- if (state.length === 0) {
3686
- state.mode = LEN;
3687
- }
3688
- break;
3689
- case LIT:
3690
- if (left === 0) {
3691
- break inf_leave;
3692
- }
3693
- output[put++] = state.length;
3694
- left--;
3695
- state.mode = LEN;
3696
- break;
3697
- case CHECK:
3698
- if (state.wrap) {
3699
- while (bits < 32) {
3700
- if (have === 0) {
3701
- break inf_leave;
3702
- }
3703
- have--;
3704
- hold |= input[next++] << bits;
3705
- bits += 8;
3706
- }
3707
- _out -= left;
3708
- strm.total_out += _out;
3709
- state.total += _out;
3710
- if (_out) {
3711
- strm.adler = state.check = /*UPDATE(state.check, put - _out, _out);*/
3712
- state.flags ? crc32_1(state.check, output, _out, put - _out) : adler32_1(state.check, output, _out, put - _out);
3713
- }
3714
- _out = left;
3715
- if ((state.flags ? hold : zswap32(hold)) !== state.check) {
3716
- strm.msg = "incorrect data check";
3717
- state.mode = BAD$1;
3718
- break;
3719
- }
3720
- hold = 0;
3721
- bits = 0;
3722
- }
3723
- state.mode = LENGTH;
3724
- case LENGTH:
3725
- if (state.wrap && state.flags) {
3726
- while (bits < 32) {
3727
- if (have === 0) {
3728
- break inf_leave;
3729
- }
3730
- have--;
3731
- hold += input[next++] << bits;
3732
- bits += 8;
3733
- }
3734
- if (hold !== (state.total & 4294967295)) {
3735
- strm.msg = "incorrect length check";
3736
- state.mode = BAD$1;
3737
- break;
3738
- }
3739
- hold = 0;
3740
- bits = 0;
3741
- }
3742
- state.mode = DONE;
3743
- case DONE:
3744
- ret = Z_STREAM_END$2;
3745
- break inf_leave;
3746
- case BAD$1:
3747
- ret = Z_DATA_ERROR$1;
3748
- break inf_leave;
3749
- case MEM:
3750
- return Z_MEM_ERROR;
3751
- case SYNC:
3752
- default:
3753
- return Z_STREAM_ERROR$1;
3754
- }
3755
- }
3756
- strm.next_out = put;
3757
- strm.avail_out = left;
3758
- strm.next_in = next;
3759
- strm.avail_in = have;
3760
- state.hold = hold;
3761
- state.bits = bits;
3762
- if (state.wsize || _out !== strm.avail_out && state.mode < BAD$1 && (state.mode < CHECK || flush !== Z_FINISH$2)) {
3763
- if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out))
3764
- ;
3765
- }
3766
- _in -= strm.avail_in;
3767
- _out -= strm.avail_out;
3768
- strm.total_in += _in;
3769
- strm.total_out += _out;
3770
- state.total += _out;
3771
- if (state.wrap && _out) {
3772
- strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/
3773
- state.flags ? crc32_1(state.check, output, _out, strm.next_out - _out) : adler32_1(state.check, output, _out, strm.next_out - _out);
3774
- }
3775
- strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE$1 ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);
3776
- if ((_in === 0 && _out === 0 || flush === Z_FINISH$2) && ret === Z_OK$2) {
3777
- ret = Z_BUF_ERROR$1;
3778
- }
3779
- return ret;
3780
- };
3781
- const inflateEnd = (strm) => {
3782
- if (!strm || !strm.state) {
3783
- return Z_STREAM_ERROR$1;
3784
- }
3785
- let state = strm.state;
3786
- if (state.window) {
3787
- state.window = null;
3788
- }
3789
- strm.state = null;
3790
- return Z_OK$2;
3791
- };
3792
- const inflateGetHeader = (strm, head) => {
3793
- if (!strm || !strm.state) {
3794
- return Z_STREAM_ERROR$1;
3795
- }
3796
- const state = strm.state;
3797
- if ((state.wrap & 2) === 0) {
3798
- return Z_STREAM_ERROR$1;
3799
- }
3800
- state.head = head;
3801
- head.done = false;
3802
- return Z_OK$2;
3803
- };
3804
- const inflateSetDictionary = (strm, dictionary) => {
3805
- const dictLength = dictionary.length;
3806
- let state;
3807
- let dictid;
3808
- let ret;
3809
- if (!strm || !strm.state) {
3810
- return Z_STREAM_ERROR$1;
3811
- }
3812
- state = strm.state;
3813
- if (state.wrap !== 0 && state.mode !== DICT) {
3814
- return Z_STREAM_ERROR$1;
3815
- }
3816
- if (state.mode === DICT) {
3817
- dictid = 1;
3818
- dictid = adler32_1(dictid, dictionary, dictLength, 0);
3819
- if (dictid !== state.check) {
3820
- return Z_DATA_ERROR$1;
3821
- }
3822
- }
3823
- ret = updatewindow(strm, dictionary, dictLength, dictLength);
3824
- if (ret) {
3825
- state.mode = MEM;
3826
- return Z_MEM_ERROR;
3827
- }
3828
- state.havedict = 1;
3829
- return Z_OK$2;
3830
- };
3831
- var inflateReset_1 = inflateReset;
3832
- var inflateReset2_1 = inflateReset2;
3833
- var inflateResetKeep_1 = inflateResetKeep;
3834
- var inflateInit_1 = inflateInit;
3835
- var inflateInit2_1 = inflateInit2;
3836
- var inflate_2 = inflate;
3837
- var inflateEnd_1 = inflateEnd;
3838
- var inflateGetHeader_1 = inflateGetHeader;
3839
- var inflateSetDictionary_1 = inflateSetDictionary;
3840
- var inflateInfo = "pako inflate (from Nodeca project)";
3841
- var inflate_1 = {
3842
- inflateReset: inflateReset_1,
3843
- inflateReset2: inflateReset2_1,
3844
- inflateResetKeep: inflateResetKeep_1,
3845
- inflateInit: inflateInit_1,
3846
- inflateInit2: inflateInit2_1,
3847
- inflate: inflate_2,
3848
- inflateEnd: inflateEnd_1,
3849
- inflateGetHeader: inflateGetHeader_1,
3850
- inflateSetDictionary: inflateSetDictionary_1,
3851
- inflateInfo
3852
- };
3853
- function GZheader() {
3854
- this.text = 0;
3855
- this.time = 0;
3856
- this.xflags = 0;
3857
- this.os = 0;
3858
- this.extra = null;
3859
- this.extra_len = 0;
3860
- this.name = "";
3861
- this.comment = "";
3862
- this.hcrc = 0;
3863
- this.done = false;
3864
- }
3865
- var gzheader = GZheader;
3866
- const toString$1 = Object.prototype.toString;
3867
- const {
3868
- Z_NO_FLUSH: Z_NO_FLUSH$2,
3869
- Z_FINISH: Z_FINISH$3,
3870
- Z_OK: Z_OK$3,
3871
- Z_STREAM_END: Z_STREAM_END$3,
3872
- Z_NEED_DICT: Z_NEED_DICT$1,
3873
- Z_STREAM_ERROR: Z_STREAM_ERROR$2,
3874
- Z_DATA_ERROR: Z_DATA_ERROR$2,
3875
- Z_MEM_ERROR: Z_MEM_ERROR$1
3876
- } = constants;
3877
- function Inflate(options) {
3878
- this.options = common.assign({
3879
- chunkSize: 1024 * 64,
3880
- windowBits: 15,
3881
- to: ""
3882
- }, options || {});
3883
- const opt = this.options;
3884
- if (opt.raw && opt.windowBits >= 0 && opt.windowBits < 16) {
3885
- opt.windowBits = -opt.windowBits;
3886
- if (opt.windowBits === 0) {
3887
- opt.windowBits = -15;
3888
- }
3889
- }
3890
- if (opt.windowBits >= 0 && opt.windowBits < 16 && !(options && options.windowBits)) {
3891
- opt.windowBits += 32;
3892
- }
3893
- if (opt.windowBits > 15 && opt.windowBits < 48) {
3894
- if ((opt.windowBits & 15) === 0) {
3895
- opt.windowBits |= 15;
3896
- }
3897
- }
3898
- this.err = 0;
3899
- this.msg = "";
3900
- this.ended = false;
3901
- this.chunks = [];
3902
- this.strm = new zstream();
3903
- this.strm.avail_out = 0;
3904
- let status = inflate_1.inflateInit2(
3905
- this.strm,
3906
- opt.windowBits
3907
- );
3908
- if (status !== Z_OK$3) {
3909
- throw new Error(messages[status]);
3910
- }
3911
- this.header = new gzheader();
3912
- inflate_1.inflateGetHeader(this.strm, this.header);
3913
- if (opt.dictionary) {
3914
- if (typeof opt.dictionary === "string") {
3915
- opt.dictionary = strings.string2buf(opt.dictionary);
3916
- } else if (toString$1.call(opt.dictionary) === "[object ArrayBuffer]") {
3917
- opt.dictionary = new Uint8Array(opt.dictionary);
3918
- }
3919
- if (opt.raw) {
3920
- status = inflate_1.inflateSetDictionary(this.strm, opt.dictionary);
3921
- if (status !== Z_OK$3) {
3922
- throw new Error(messages[status]);
3923
- }
3924
- }
3925
- }
3926
- }
3927
- Inflate.prototype.push = function(data, flush_mode) {
3928
- const strm = this.strm;
3929
- const chunkSize = this.options.chunkSize;
3930
- const dictionary = this.options.dictionary;
3931
- let status, _flush_mode, last_avail_out;
3932
- if (this.ended)
3933
- return false;
3934
- if (flush_mode === ~~flush_mode)
3935
- _flush_mode = flush_mode;
3936
- else
3937
- _flush_mode = flush_mode === true ? Z_FINISH$3 : Z_NO_FLUSH$2;
3938
- if (toString$1.call(data) === "[object ArrayBuffer]") {
3939
- strm.input = new Uint8Array(data);
3940
- } else {
3941
- strm.input = data;
3942
- }
3943
- strm.next_in = 0;
3944
- strm.avail_in = strm.input.length;
3945
- for (; ; ) {
3946
- if (strm.avail_out === 0) {
3947
- strm.output = new Uint8Array(chunkSize);
3948
- strm.next_out = 0;
3949
- strm.avail_out = chunkSize;
3950
- }
3951
- status = inflate_1.inflate(strm, _flush_mode);
3952
- if (status === Z_NEED_DICT$1 && dictionary) {
3953
- status = inflate_1.inflateSetDictionary(strm, dictionary);
3954
- if (status === Z_OK$3) {
3955
- status = inflate_1.inflate(strm, _flush_mode);
3956
- } else if (status === Z_DATA_ERROR$2) {
3957
- status = Z_NEED_DICT$1;
3958
- }
3959
- }
3960
- while (strm.avail_in > 0 && status === Z_STREAM_END$3 && strm.state.wrap > 0 && data[strm.next_in] !== 0) {
3961
- inflate_1.inflateReset(strm);
3962
- status = inflate_1.inflate(strm, _flush_mode);
3963
- }
3964
- switch (status) {
3965
- case Z_STREAM_ERROR$2:
3966
- case Z_DATA_ERROR$2:
3967
- case Z_NEED_DICT$1:
3968
- case Z_MEM_ERROR$1:
3969
- this.onEnd(status);
3970
- this.ended = true;
3971
- return false;
3972
- }
3973
- last_avail_out = strm.avail_out;
3974
- if (strm.next_out) {
3975
- if (strm.avail_out === 0 || status === Z_STREAM_END$3) {
3976
- if (this.options.to === "string") {
3977
- let next_out_utf8 = strings.utf8border(strm.output, strm.next_out);
3978
- let tail = strm.next_out - next_out_utf8;
3979
- let utf8str = strings.buf2string(strm.output, next_out_utf8);
3980
- strm.next_out = tail;
3981
- strm.avail_out = chunkSize - tail;
3982
- if (tail)
3983
- strm.output.set(strm.output.subarray(next_out_utf8, next_out_utf8 + tail), 0);
3984
- this.onData(utf8str);
3985
- } else {
3986
- this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out));
3987
- }
3988
- }
3989
- }
3990
- if (status === Z_OK$3 && last_avail_out === 0)
3991
- continue;
3992
- if (status === Z_STREAM_END$3) {
3993
- status = inflate_1.inflateEnd(this.strm);
3994
- this.onEnd(status);
3995
- this.ended = true;
3996
- return true;
3997
- }
3998
- if (strm.avail_in === 0)
3999
- break;
4000
- }
4001
- return true;
4002
- };
4003
- Inflate.prototype.onData = function(chunk) {
4004
- this.chunks.push(chunk);
4005
- };
4006
- Inflate.prototype.onEnd = function(status) {
4007
- if (status === Z_OK$3) {
4008
- if (this.options.to === "string") {
4009
- this.result = this.chunks.join("");
4010
- } else {
4011
- this.result = common.flattenChunks(this.chunks);
4012
- }
4013
- }
4014
- this.chunks = [];
4015
- this.err = status;
4016
- this.msg = this.strm.msg;
4017
- };
4018
- function inflate$1(input, options) {
4019
- const inflator = new Inflate(options);
4020
- inflator.push(input);
4021
- if (inflator.err)
4022
- throw inflator.msg || messages[inflator.err];
4023
- return inflator.result;
4024
- }
4025
- function inflateRaw(input, options) {
4026
- options = options || {};
4027
- options.raw = true;
4028
- return inflate$1(input, options);
4029
- }
4030
- var Inflate_1 = Inflate;
4031
- var inflate_2$1 = inflate$1;
4032
- var inflateRaw_1 = inflateRaw;
4033
- var ungzip = inflate$1;
4034
- var constants$2 = constants;
4035
- var inflate_1$1 = {
4036
- Inflate: Inflate_1,
4037
- inflate: inflate_2$1,
4038
- inflateRaw: inflateRaw_1,
4039
- ungzip,
4040
- constants: constants$2
4041
- };
4042
- const { Deflate: Deflate$1, deflate: deflate$2, deflateRaw: deflateRaw$1, gzip: gzip$1 } = deflate_1$1;
4043
- const { Inflate: Inflate$1, inflate: inflate$2, inflateRaw: inflateRaw$1, ungzip: ungzip$1 } = inflate_1$1;
4044
- var Deflate_1$1 = Deflate$1;
4045
- var deflate_1$2 = deflate$2;
4046
- var deflateRaw_1$1 = deflateRaw$1;
4047
- var gzip_1$1 = gzip$1;
4048
- var Inflate_1$1 = Inflate$1;
4049
- var inflate_1$2 = inflate$2;
4050
- var inflateRaw_1$1 = inflateRaw$1;
4051
- var ungzip_1 = ungzip$1;
4052
- var constants_1 = constants;
4053
- var pako = {
4054
- Deflate: Deflate_1$1,
4055
- deflate: deflate_1$2,
4056
- deflateRaw: deflateRaw_1$1,
4057
- gzip: gzip_1$1,
4058
- Inflate: Inflate_1$1,
4059
- inflate: inflate_1$2,
4060
- inflateRaw: inflateRaw_1$1,
4061
- ungzip: ungzip_1,
4062
- constants: constants_1
4063
- };
4064
- export {
4065
- pako as p
4066
- };