@univerjs-pro/exchange-client 0.4.2-nightly.202410291606 → 0.4.2-nightly.202410310419

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2481 @@
1
+ var _i = Object.defineProperty;
2
+ var fi = (e, n, t) => n in e ? _i(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
3
+ var $e = (e, n, t) => fi(e, typeof n != "symbol" ? n + "" : n, t);
4
+ import { createIdentifier as mn, Inject as Rn, IConfigService as kn, Disposable as ci } from "@univerjs/core";
5
+ import { transformWorkbookDataToSnapshot as hi, getSheetBlocksFromSnapshot as di, b64EncodeUnicode as dt, textDecoder as Ke, transformSnapshotToDocumentData as ui, b64DecodeUnicode as pi, transformSnapshotToWorkbookData as gi, textEncoder as Ei } from "@univerjs-pro/collaboration";
6
+ import { Subject as wi } from "rxjs";
7
+ import { HTTPService as bi } from "@univerjs/network";
8
+ const te = "exchange-client.config", ns = {};
9
+ var S = /* @__PURE__ */ ((e) => (e[e.UNDEFINED = 0] = "UNDEFINED", e[e.OK = 1] = "OK", e[e.INTERNAL_ERROR = 2] = "INTERNAL_ERROR", e[e.PERMISSION_DENIED = 3] = "PERMISSION_DENIED", e[e.NOT_FOUND = 4] = "NOT_FOUND", e[e.UNAUTHENTICATED = 5] = "UNAUTHENTICATED", e[e.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", e[e.INVALID_ARGUMENT = 7] = "INVALID_ARGUMENT", e[e.TOO_MANY_REQUESTS = 8] = "TOO_MANY_REQUESTS", e[e.COMPLETION_FINISHED = 9] = "COMPLETION_FINISHED", e[e.CHANGESET_REVISION_CONFILICT = 5001] = "CHANGESET_REVISION_CONFILICT", e[e.SNAPSHOT_INVALID_SNAPSHOT = 6001] = "SNAPSHOT_INVALID_SNAPSHOT", e[e.SNAPSHOT_HAS_BEEN_REMOVED = 6002] = "SNAPSHOT_HAS_BEEN_REMOVED", e[e.ENSURE_SNAPSHOT_EXECUTION = 6003] = "ENSURE_SNAPSHOT_EXECUTION", e[e.APPLY_REJECT = 7001] = "APPLY_REJECT", e[e.APPLY_NON_SEQUENTIAL_REVISION = 7002] = "APPLY_NON_SEQUENTIAL_REVISION", e[e.APPLY_REVISION_CONFILICT = 7003] = "APPLY_REVISION_CONFILICT", e[e.APPLY_PERMISSION_DENIED = 7004] = "APPLY_PERMISSION_DENIED", e[e.APPLY_DUPLICATED = 7005] = "APPLY_DUPLICATED", e[e.CONNECTOR_DATA_TOO_LARGE = 8001] = "CONNECTOR_DATA_TOO_LARGE", e[e.LICENSE_MAX_UNITS_EXCEEDED = 9001] = "LICENSE_MAX_UNITS_EXCEEDED", e[e.LICENSE_MAX_MEMBERS_PER_UNIT_EXCEEDED = 9002] = "LICENSE_MAX_MEMBERS_PER_UNIT_EXCEEDED", e[e.LICENSE_IMPORT_SIZE_EXCEEDED = 9003] = "LICENSE_IMPORT_SIZE_EXCEEDED", e[e.LICENSE_EXPORT_SIZE_EXCEEDED = 9004] = "LICENSE_EXPORT_SIZE_EXCEEDED", e[e.LICENSE_DISTRO_REJECTED = 9005] = "LICENSE_DISTRO_REJECTED", e[e.YUUMI_UNABLE_LOAD_URL = 10001] = "YUUMI_UNABLE_LOAD_URL", e[e.YUUMI_URL_COL_OUT_OF_RANGE = 10002] = "YUUMI_URL_COL_OUT_OF_RANGE", e[e.YUUMI_RATE_OVER_LIMIT = 10003] = "YUUMI_RATE_OVER_LIMIT", e[e.YUUMI_SUBSCRIPTION_NOT_FOUND = 10004] = "YUUMI_SUBSCRIPTION_NOT_FOUND", e[e.UNRECOGNIZED = -1] = "UNRECOGNIZED", e))(S || {}), U = /* @__PURE__ */ ((e) => (e[e.UNIVER_UNKNOWN = 0] = "UNIVER_UNKNOWN", e[e.UNIVER_DOC = 1] = "UNIVER_DOC", e[e.UNIVER_SHEET = 2] = "UNIVER_SHEET", e[e.UNIVER_SLIDE = 3] = "UNIVER_SLIDE", e[e.UNIVER_PROJECT = 4] = "UNIVER_PROJECT", e[e.UNRECOGNIZED = -1] = "UNRECOGNIZED", e))(U || {}), In = /* @__PURE__ */ ((e) => (e[e.Undefined = 0] = "Undefined", e[e.HttpImport = 1] = "HttpImport", e[e.HttpExport = 2] = "HttpExport", e[e.UnitEmbedded = 3] = "UnitEmbedded", e[e.UnitSnapshot = 4] = "UnitSnapshot", e[e.UNRECOGNIZED = -1] = "UNRECOGNIZED", e))(In || {});
10
+ /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
11
+ const xi = 4, Ut = 0, Ot = 1, Si = 2;
12
+ function pe(e) {
13
+ let n = e.length;
14
+ for (; --n >= 0; )
15
+ e[n] = 0;
16
+ }
17
+ const vi = 0, Nn = 1, mi = 2, Ri = 3, ki = 258, mt = 29, Oe = 256, Re = Oe + 1 + mt, he = 30, Rt = 19, Dn = 2 * Re + 1, ne = 15, Qe = 16, Ii = 7, kt = 256, Tn = 16, yn = 17, Un = 18, ut = (
18
+ /* extra bits for each length code */
19
+ 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])
20
+ ), Ge = (
21
+ /* extra bits for each distance code */
22
+ 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])
23
+ ), Ni = (
24
+ /* extra bits for each bit length code */
25
+ new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7])
26
+ ), On = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), Di = 512, V = new Array((Re + 2) * 2);
27
+ pe(V);
28
+ const Se = new Array(he * 2);
29
+ pe(Se);
30
+ const ke = new Array(Di);
31
+ pe(ke);
32
+ const Ie = new Array(ki - Ri + 1);
33
+ pe(Ie);
34
+ const It = new Array(mt);
35
+ pe(It);
36
+ const Xe = new Array(he);
37
+ pe(Xe);
38
+ function et(e, n, t, i, r) {
39
+ this.static_tree = e, this.extra_bits = n, this.extra_base = t, this.elems = i, this.max_length = r, this.has_stree = e && e.length;
40
+ }
41
+ let An, Ln, zn;
42
+ function tt(e, n) {
43
+ this.dyn_tree = e, this.max_code = 0, this.stat_desc = n;
44
+ }
45
+ const Cn = (e) => e < 256 ? ke[e] : ke[256 + (e >>> 7)], Ne = (e, n) => {
46
+ e.pending_buf[e.pending++] = n & 255, e.pending_buf[e.pending++] = n >>> 8 & 255;
47
+ }, C = (e, n, t) => {
48
+ e.bi_valid > Qe - t ? (e.bi_buf |= n << e.bi_valid & 65535, Ne(e, e.bi_buf), e.bi_buf = n >> Qe - e.bi_valid, e.bi_valid += t - Qe) : (e.bi_buf |= n << e.bi_valid & 65535, e.bi_valid += t);
49
+ }, H = (e, n, t) => {
50
+ C(
51
+ e,
52
+ t[n * 2],
53
+ t[n * 2 + 1]
54
+ /*.Len*/
55
+ );
56
+ }, Zn = (e, n) => {
57
+ let t = 0;
58
+ do
59
+ t |= e & 1, e >>>= 1, t <<= 1;
60
+ while (--n > 0);
61
+ return t >>> 1;
62
+ }, Ti = (e) => {
63
+ e.bi_valid === 16 ? (Ne(e, e.bi_buf), e.bi_buf = 0, e.bi_valid = 0) : e.bi_valid >= 8 && (e.pending_buf[e.pending++] = e.bi_buf & 255, e.bi_buf >>= 8, e.bi_valid -= 8);
64
+ }, yi = (e, n) => {
65
+ const t = n.dyn_tree, i = n.max_code, r = n.stat_desc.static_tree, a = n.stat_desc.has_stree, l = n.stat_desc.extra_bits, s = n.stat_desc.extra_base, c = n.stat_desc.max_length;
66
+ let o, _, E, h, f, u, y = 0;
67
+ for (h = 0; h <= ne; h++)
68
+ e.bl_count[h] = 0;
69
+ for (t[e.heap[e.heap_max] * 2 + 1] = 0, o = e.heap_max + 1; o < Dn; o++)
70
+ _ = e.heap[o], h = t[t[_ * 2 + 1] * 2 + 1] + 1, h > c && (h = c, y++), t[_ * 2 + 1] = h, !(_ > i) && (e.bl_count[h]++, f = 0, _ >= s && (f = l[_ - s]), u = t[_ * 2], e.opt_len += u * (h + f), a && (e.static_len += u * (r[_ * 2 + 1] + f)));
71
+ if (y !== 0) {
72
+ do {
73
+ for (h = c - 1; e.bl_count[h] === 0; )
74
+ h--;
75
+ e.bl_count[h]--, e.bl_count[h + 1] += 2, e.bl_count[c]--, y -= 2;
76
+ } while (y > 0);
77
+ for (h = c; h !== 0; h--)
78
+ for (_ = e.bl_count[h]; _ !== 0; )
79
+ E = e.heap[--o], !(E > i) && (t[E * 2 + 1] !== h && (e.opt_len += (h - t[E * 2 + 1]) * t[E * 2], t[E * 2 + 1] = h), _--);
80
+ }
81
+ }, $n = (e, n, t) => {
82
+ const i = new Array(ne + 1);
83
+ let r = 0, a, l;
84
+ for (a = 1; a <= ne; a++)
85
+ r = r + t[a - 1] << 1, i[a] = r;
86
+ for (l = 0; l <= n; l++) {
87
+ let s = e[l * 2 + 1];
88
+ s !== 0 && (e[l * 2] = Zn(i[s]++, s));
89
+ }
90
+ }, Ui = () => {
91
+ let e, n, t, i, r;
92
+ const a = new Array(ne + 1);
93
+ for (t = 0, i = 0; i < mt - 1; i++)
94
+ for (It[i] = t, e = 0; e < 1 << ut[i]; e++)
95
+ Ie[t++] = i;
96
+ for (Ie[t - 1] = i, r = 0, i = 0; i < 16; i++)
97
+ for (Xe[i] = r, e = 0; e < 1 << Ge[i]; e++)
98
+ ke[r++] = i;
99
+ for (r >>= 7; i < he; i++)
100
+ for (Xe[i] = r << 7, e = 0; e < 1 << Ge[i] - 7; e++)
101
+ ke[256 + r++] = i;
102
+ for (n = 0; n <= ne; n++)
103
+ a[n] = 0;
104
+ for (e = 0; e <= 143; )
105
+ V[e * 2 + 1] = 8, e++, a[8]++;
106
+ for (; e <= 255; )
107
+ V[e * 2 + 1] = 9, e++, a[9]++;
108
+ for (; e <= 279; )
109
+ V[e * 2 + 1] = 7, e++, a[7]++;
110
+ for (; e <= 287; )
111
+ V[e * 2 + 1] = 8, e++, a[8]++;
112
+ for ($n(V, Re + 1, a), e = 0; e < he; e++)
113
+ Se[e * 2 + 1] = 5, Se[e * 2] = Zn(e, 5);
114
+ An = new et(V, ut, Oe + 1, Re, ne), Ln = new et(Se, Ge, 0, he, ne), zn = new et(new Array(0), Ni, 0, Rt, Ii);
115
+ }, Mn = (e) => {
116
+ let n;
117
+ for (n = 0; n < Re; n++)
118
+ e.dyn_ltree[n * 2] = 0;
119
+ for (n = 0; n < he; n++)
120
+ e.dyn_dtree[n * 2] = 0;
121
+ for (n = 0; n < Rt; n++)
122
+ e.bl_tree[n * 2] = 0;
123
+ e.dyn_ltree[kt * 2] = 1, e.opt_len = e.static_len = 0, e.sym_next = e.matches = 0;
124
+ }, Pn = (e) => {
125
+ e.bi_valid > 8 ? Ne(e, e.bi_buf) : e.bi_valid > 0 && (e.pending_buf[e.pending++] = e.bi_buf), e.bi_buf = 0, e.bi_valid = 0;
126
+ }, At = (e, n, t, i) => {
127
+ const r = n * 2, a = t * 2;
128
+ return e[r] < e[a] || e[r] === e[a] && i[n] <= i[t];
129
+ }, nt = (e, n, t) => {
130
+ const i = e.heap[t];
131
+ let r = t << 1;
132
+ for (; r <= e.heap_len && (r < e.heap_len && At(n, e.heap[r + 1], e.heap[r], e.depth) && r++, !At(n, i, e.heap[r], e.depth)); )
133
+ e.heap[t] = e.heap[r], t = r, r <<= 1;
134
+ e.heap[t] = i;
135
+ }, Lt = (e, n, t) => {
136
+ let i, r, a = 0, l, s;
137
+ if (e.sym_next !== 0)
138
+ do
139
+ i = e.pending_buf[e.sym_buf + a++] & 255, i += (e.pending_buf[e.sym_buf + a++] & 255) << 8, r = e.pending_buf[e.sym_buf + a++], i === 0 ? H(e, r, n) : (l = Ie[r], H(e, l + Oe + 1, n), s = ut[l], s !== 0 && (r -= It[l], C(e, r, s)), i--, l = Cn(i), H(e, l, t), s = Ge[l], s !== 0 && (i -= Xe[l], C(e, i, s)));
140
+ while (a < e.sym_next);
141
+ H(e, kt, n);
142
+ }, pt = (e, n) => {
143
+ const t = n.dyn_tree, i = n.stat_desc.static_tree, r = n.stat_desc.has_stree, a = n.stat_desc.elems;
144
+ let l, s, c = -1, o;
145
+ for (e.heap_len = 0, e.heap_max = Dn, l = 0; l < a; l++)
146
+ t[l * 2] !== 0 ? (e.heap[++e.heap_len] = c = l, e.depth[l] = 0) : t[l * 2 + 1] = 0;
147
+ for (; e.heap_len < 2; )
148
+ o = e.heap[++e.heap_len] = c < 2 ? ++c : 0, t[o * 2] = 1, e.depth[o] = 0, e.opt_len--, r && (e.static_len -= i[o * 2 + 1]);
149
+ for (n.max_code = c, l = e.heap_len >> 1; l >= 1; l--)
150
+ nt(e, t, l);
151
+ o = a;
152
+ do
153
+ l = e.heap[
154
+ 1
155
+ /*SMALLEST*/
156
+ ], e.heap[
157
+ 1
158
+ /*SMALLEST*/
159
+ ] = e.heap[e.heap_len--], nt(
160
+ e,
161
+ t,
162
+ 1
163
+ /*SMALLEST*/
164
+ ), s = e.heap[
165
+ 1
166
+ /*SMALLEST*/
167
+ ], e.heap[--e.heap_max] = l, e.heap[--e.heap_max] = s, t[o * 2] = t[l * 2] + t[s * 2], e.depth[o] = (e.depth[l] >= e.depth[s] ? e.depth[l] : e.depth[s]) + 1, t[l * 2 + 1] = t[s * 2 + 1] = o, e.heap[
168
+ 1
169
+ /*SMALLEST*/
170
+ ] = o++, nt(
171
+ e,
172
+ t,
173
+ 1
174
+ /*SMALLEST*/
175
+ );
176
+ while (e.heap_len >= 2);
177
+ e.heap[--e.heap_max] = e.heap[
178
+ 1
179
+ /*SMALLEST*/
180
+ ], yi(e, n), $n(t, c, e.bl_count);
181
+ }, zt = (e, n, t) => {
182
+ let i, r = -1, a, l = n[0 * 2 + 1], s = 0, c = 7, o = 4;
183
+ for (l === 0 && (c = 138, o = 3), n[(t + 1) * 2 + 1] = 65535, i = 0; i <= t; i++)
184
+ a = l, l = n[(i + 1) * 2 + 1], !(++s < c && a === l) && (s < o ? e.bl_tree[a * 2] += s : a !== 0 ? (a !== r && e.bl_tree[a * 2]++, e.bl_tree[Tn * 2]++) : s <= 10 ? e.bl_tree[yn * 2]++ : e.bl_tree[Un * 2]++, s = 0, r = a, l === 0 ? (c = 138, o = 3) : a === l ? (c = 6, o = 3) : (c = 7, o = 4));
185
+ }, Ct = (e, n, t) => {
186
+ let i, r = -1, a, l = n[0 * 2 + 1], s = 0, c = 7, o = 4;
187
+ for (l === 0 && (c = 138, o = 3), i = 0; i <= t; i++)
188
+ if (a = l, l = n[(i + 1) * 2 + 1], !(++s < c && a === l)) {
189
+ if (s < o)
190
+ do
191
+ H(e, a, e.bl_tree);
192
+ while (--s !== 0);
193
+ else a !== 0 ? (a !== r && (H(e, a, e.bl_tree), s--), H(e, Tn, e.bl_tree), C(e, s - 3, 2)) : s <= 10 ? (H(e, yn, e.bl_tree), C(e, s - 3, 3)) : (H(e, Un, e.bl_tree), C(e, s - 11, 7));
194
+ s = 0, r = a, l === 0 ? (c = 138, o = 3) : a === l ? (c = 6, o = 3) : (c = 7, o = 4);
195
+ }
196
+ }, Oi = (e) => {
197
+ let n;
198
+ for (zt(e, e.dyn_ltree, e.l_desc.max_code), zt(e, e.dyn_dtree, e.d_desc.max_code), pt(e, e.bl_desc), n = Rt - 1; n >= 3 && e.bl_tree[On[n] * 2 + 1] === 0; n--)
199
+ ;
200
+ return e.opt_len += 3 * (n + 1) + 5 + 5 + 4, n;
201
+ }, Ai = (e, n, t, i) => {
202
+ let r;
203
+ for (C(e, n - 257, 5), C(e, t - 1, 5), C(e, i - 4, 4), r = 0; r < i; r++)
204
+ C(e, e.bl_tree[On[r] * 2 + 1], 3);
205
+ Ct(e, e.dyn_ltree, n - 1), Ct(e, e.dyn_dtree, t - 1);
206
+ }, Li = (e) => {
207
+ let n = 4093624447, t;
208
+ for (t = 0; t <= 31; t++, n >>>= 1)
209
+ if (n & 1 && e.dyn_ltree[t * 2] !== 0)
210
+ return Ut;
211
+ if (e.dyn_ltree[9 * 2] !== 0 || e.dyn_ltree[10 * 2] !== 0 || e.dyn_ltree[13 * 2] !== 0)
212
+ return Ot;
213
+ for (t = 32; t < Oe; t++)
214
+ if (e.dyn_ltree[t * 2] !== 0)
215
+ return Ot;
216
+ return Ut;
217
+ };
218
+ let Zt = !1;
219
+ const zi = (e) => {
220
+ Zt || (Ui(), Zt = !0), e.l_desc = new tt(e.dyn_ltree, An), e.d_desc = new tt(e.dyn_dtree, Ln), e.bl_desc = new tt(e.bl_tree, zn), e.bi_buf = 0, e.bi_valid = 0, Mn(e);
221
+ }, Fn = (e, n, t, i) => {
222
+ C(e, (vi << 1) + (i ? 1 : 0), 3), Pn(e), Ne(e, t), Ne(e, ~t), t && e.pending_buf.set(e.window.subarray(n, n + t), e.pending), e.pending += t;
223
+ }, Ci = (e) => {
224
+ C(e, Nn << 1, 3), H(e, kt, V), Ti(e);
225
+ }, Zi = (e, n, t, i) => {
226
+ let r, a, l = 0;
227
+ e.level > 0 ? (e.strm.data_type === Si && (e.strm.data_type = Li(e)), pt(e, e.l_desc), pt(e, e.d_desc), l = Oi(e), r = e.opt_len + 3 + 7 >>> 3, a = e.static_len + 3 + 7 >>> 3, a <= r && (r = a)) : r = a = t + 5, t + 4 <= r && n !== -1 ? Fn(e, n, t, i) : e.strategy === xi || a === r ? (C(e, (Nn << 1) + (i ? 1 : 0), 3), Lt(e, V, Se)) : (C(e, (mi << 1) + (i ? 1 : 0), 3), Ai(e, e.l_desc.max_code + 1, e.d_desc.max_code + 1, l + 1), Lt(e, e.dyn_ltree, e.dyn_dtree)), Mn(e), i && Pn(e);
228
+ }, $i = (e, n, t) => (e.pending_buf[e.sym_buf + e.sym_next++] = n, e.pending_buf[e.sym_buf + e.sym_next++] = n >> 8, e.pending_buf[e.sym_buf + e.sym_next++] = t, n === 0 ? e.dyn_ltree[t * 2]++ : (e.matches++, n--, e.dyn_ltree[(Ie[t] + Oe + 1) * 2]++, e.dyn_dtree[Cn(n) * 2]++), e.sym_next === e.sym_end);
229
+ var Mi = zi, Pi = Fn, Fi = Zi, Hi = $i, Bi = Ci, Gi = {
230
+ _tr_init: Mi,
231
+ _tr_stored_block: Pi,
232
+ _tr_flush_block: Fi,
233
+ _tr_tally: Hi,
234
+ _tr_align: Bi
235
+ };
236
+ const Ki = (e, n, t, i) => {
237
+ let r = e & 65535 | 0, a = e >>> 16 & 65535 | 0, l = 0;
238
+ for (; t !== 0; ) {
239
+ l = t > 2e3 ? 2e3 : t, t -= l;
240
+ do
241
+ r = r + n[i++] | 0, a = a + r | 0;
242
+ while (--l);
243
+ r %= 65521, a %= 65521;
244
+ }
245
+ return r | a << 16 | 0;
246
+ };
247
+ var De = Ki;
248
+ const Xi = () => {
249
+ let e, n = [];
250
+ for (var t = 0; t < 256; t++) {
251
+ e = t;
252
+ for (var i = 0; i < 8; i++)
253
+ e = e & 1 ? 3988292384 ^ e >>> 1 : e >>> 1;
254
+ n[t] = e;
255
+ }
256
+ return n;
257
+ }, Vi = new Uint32Array(Xi()), Yi = (e, n, t, i) => {
258
+ const r = Vi, a = i + t;
259
+ e ^= -1;
260
+ for (let l = i; l < a; l++)
261
+ e = e >>> 8 ^ r[(e ^ n[l]) & 255];
262
+ return e ^ -1;
263
+ };
264
+ var A = Yi, re = {
265
+ 2: "need dictionary",
266
+ /* Z_NEED_DICT 2 */
267
+ 1: "stream end",
268
+ /* Z_STREAM_END 1 */
269
+ 0: "",
270
+ /* Z_OK 0 */
271
+ "-1": "file error",
272
+ /* Z_ERRNO (-1) */
273
+ "-2": "stream error",
274
+ /* Z_STREAM_ERROR (-2) */
275
+ "-3": "data error",
276
+ /* Z_DATA_ERROR (-3) */
277
+ "-4": "insufficient memory",
278
+ /* Z_MEM_ERROR (-4) */
279
+ "-5": "buffer error",
280
+ /* Z_BUF_ERROR (-5) */
281
+ "-6": "incompatible version"
282
+ /* Z_VERSION_ERROR (-6) */
283
+ }, le = {
284
+ /* Allowed flush values; see deflate() and inflate() below for details */
285
+ Z_NO_FLUSH: 0,
286
+ Z_PARTIAL_FLUSH: 1,
287
+ Z_SYNC_FLUSH: 2,
288
+ Z_FULL_FLUSH: 3,
289
+ Z_FINISH: 4,
290
+ Z_BLOCK: 5,
291
+ Z_TREES: 6,
292
+ /* Return codes for the compression/decompression functions. Negative values
293
+ * are errors, positive values are used for special but normal events.
294
+ */
295
+ Z_OK: 0,
296
+ Z_STREAM_END: 1,
297
+ Z_NEED_DICT: 2,
298
+ Z_ERRNO: -1,
299
+ Z_STREAM_ERROR: -2,
300
+ Z_DATA_ERROR: -3,
301
+ Z_MEM_ERROR: -4,
302
+ Z_BUF_ERROR: -5,
303
+ //Z_VERSION_ERROR: -6,
304
+ /* compression levels */
305
+ Z_NO_COMPRESSION: 0,
306
+ Z_BEST_SPEED: 1,
307
+ Z_BEST_COMPRESSION: 9,
308
+ Z_DEFAULT_COMPRESSION: -1,
309
+ Z_FILTERED: 1,
310
+ Z_HUFFMAN_ONLY: 2,
311
+ Z_RLE: 3,
312
+ Z_FIXED: 4,
313
+ Z_DEFAULT_STRATEGY: 0,
314
+ /* Possible values of the data_type field (though see inflate()) */
315
+ Z_BINARY: 0,
316
+ Z_TEXT: 1,
317
+ //Z_ASCII: 1, // = Z_TEXT (deprecated)
318
+ Z_UNKNOWN: 2,
319
+ /* The deflate compression method */
320
+ Z_DEFLATED: 8
321
+ //Z_NULL: null // Use -1 or null inline, depending on var type
322
+ };
323
+ const { _tr_init: qi, _tr_stored_block: gt, _tr_flush_block: ji, _tr_tally: J, _tr_align: Ji } = Gi, {
324
+ Z_NO_FLUSH: W,
325
+ Z_PARTIAL_FLUSH: Wi,
326
+ Z_FULL_FLUSH: Qi,
327
+ Z_FINISH: M,
328
+ Z_BLOCK: $t,
329
+ Z_OK: L,
330
+ Z_STREAM_END: Mt,
331
+ Z_STREAM_ERROR: B,
332
+ Z_DATA_ERROR: ea,
333
+ Z_BUF_ERROR: it,
334
+ Z_DEFAULT_COMPRESSION: ta,
335
+ Z_FILTERED: na,
336
+ Z_HUFFMAN_ONLY: Me,
337
+ Z_RLE: ia,
338
+ Z_FIXED: aa,
339
+ Z_DEFAULT_STRATEGY: ra,
340
+ Z_UNKNOWN: oa,
341
+ Z_DEFLATED: qe
342
+ } = le, sa = 9, la = 15, _a = 8, fa = 29, ca = 256, Et = ca + 1 + fa, ha = 30, da = 19, ua = 2 * Et + 1, pa = 15, v = 3, j = 258, G = j + v + 1, ga = 32, de = 42, Nt = 57, wt = 69, bt = 73, xt = 91, St = 103, ie = 113, be = 666, z = 1, ge = 2, oe = 3, Ee = 4, Ea = 3, ae = (e, n) => (e.msg = re[n], n), Pt = (e) => e * 2 - (e > 4 ? 9 : 0), q = (e) => {
343
+ let n = e.length;
344
+ for (; --n >= 0; )
345
+ e[n] = 0;
346
+ }, wa = (e) => {
347
+ let n, t, i, r = e.w_size;
348
+ n = e.hash_size, i = n;
349
+ do
350
+ t = e.head[--i], e.head[i] = t >= r ? t - r : 0;
351
+ while (--n);
352
+ n = r, i = n;
353
+ do
354
+ t = e.prev[--i], e.prev[i] = t >= r ? t - r : 0;
355
+ while (--n);
356
+ };
357
+ let ba = (e, n, t) => (n << e.hash_shift ^ t) & e.hash_mask, Q = ba;
358
+ const Z = (e) => {
359
+ const n = e.state;
360
+ let t = n.pending;
361
+ t > e.avail_out && (t = e.avail_out), t !== 0 && (e.output.set(n.pending_buf.subarray(n.pending_out, n.pending_out + t), e.next_out), e.next_out += t, n.pending_out += t, e.total_out += t, e.avail_out -= t, n.pending -= t, n.pending === 0 && (n.pending_out = 0));
362
+ }, $ = (e, n) => {
363
+ ji(e, e.block_start >= 0 ? e.block_start : -1, e.strstart - e.block_start, n), e.block_start = e.strstart, Z(e.strm);
364
+ }, I = (e, n) => {
365
+ e.pending_buf[e.pending++] = n;
366
+ }, we = (e, n) => {
367
+ e.pending_buf[e.pending++] = n >>> 8 & 255, e.pending_buf[e.pending++] = n & 255;
368
+ }, vt = (e, n, t, i) => {
369
+ let r = e.avail_in;
370
+ return r > i && (r = i), r === 0 ? 0 : (e.avail_in -= r, n.set(e.input.subarray(e.next_in, e.next_in + r), t), e.state.wrap === 1 ? e.adler = De(e.adler, n, r, t) : e.state.wrap === 2 && (e.adler = A(e.adler, n, r, t)), e.next_in += r, e.total_in += r, r);
371
+ }, Hn = (e, n) => {
372
+ let t = e.max_chain_length, i = e.strstart, r, a, l = e.prev_length, s = e.nice_match;
373
+ const c = e.strstart > e.w_size - G ? e.strstart - (e.w_size - G) : 0, o = e.window, _ = e.w_mask, E = e.prev, h = e.strstart + j;
374
+ let f = o[i + l - 1], u = o[i + l];
375
+ e.prev_length >= e.good_match && (t >>= 2), s > e.lookahead && (s = e.lookahead);
376
+ do
377
+ if (r = n, !(o[r + l] !== u || o[r + l - 1] !== f || o[r] !== o[i] || o[++r] !== o[i + 1])) {
378
+ i += 2, r++;
379
+ do
380
+ ;
381
+ while (o[++i] === o[++r] && o[++i] === o[++r] && o[++i] === o[++r] && o[++i] === o[++r] && o[++i] === o[++r] && o[++i] === o[++r] && o[++i] === o[++r] && o[++i] === o[++r] && i < h);
382
+ if (a = j - (h - i), i = h - j, a > l) {
383
+ if (e.match_start = n, l = a, a >= s)
384
+ break;
385
+ f = o[i + l - 1], u = o[i + l];
386
+ }
387
+ }
388
+ while ((n = E[n & _]) > c && --t !== 0);
389
+ return l <= e.lookahead ? l : e.lookahead;
390
+ }, ue = (e) => {
391
+ const n = e.w_size;
392
+ let t, i, r;
393
+ do {
394
+ if (i = e.window_size - e.lookahead - e.strstart, e.strstart >= n + (n - G) && (e.window.set(e.window.subarray(n, n + n - i), 0), e.match_start -= n, e.strstart -= n, e.block_start -= n, e.insert > e.strstart && (e.insert = e.strstart), wa(e), i += n), e.strm.avail_in === 0)
395
+ break;
396
+ if (t = vt(e.strm, e.window, e.strstart + e.lookahead, i), e.lookahead += t, e.lookahead + e.insert >= v)
397
+ for (r = e.strstart - e.insert, e.ins_h = e.window[r], e.ins_h = Q(e, e.ins_h, e.window[r + 1]); e.insert && (e.ins_h = Q(e, e.ins_h, e.window[r + v - 1]), e.prev[r & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = r, r++, e.insert--, !(e.lookahead + e.insert < v)); )
398
+ ;
399
+ } while (e.lookahead < G && e.strm.avail_in !== 0);
400
+ }, Bn = (e, n) => {
401
+ let t = e.pending_buf_size - 5 > e.w_size ? e.w_size : e.pending_buf_size - 5, i, r, a, l = 0, s = e.strm.avail_in;
402
+ do {
403
+ if (i = 65535, a = e.bi_valid + 42 >> 3, e.strm.avail_out < a || (a = e.strm.avail_out - a, r = e.strstart - e.block_start, i > r + e.strm.avail_in && (i = r + e.strm.avail_in), i > a && (i = a), i < t && (i === 0 && n !== M || n === W || i !== r + e.strm.avail_in)))
404
+ break;
405
+ l = n === M && i === r + e.strm.avail_in ? 1 : 0, gt(e, 0, 0, l), e.pending_buf[e.pending - 4] = i, e.pending_buf[e.pending - 3] = i >> 8, e.pending_buf[e.pending - 2] = ~i, e.pending_buf[e.pending - 1] = ~i >> 8, Z(e.strm), r && (r > i && (r = i), e.strm.output.set(e.window.subarray(e.block_start, e.block_start + r), e.strm.next_out), e.strm.next_out += r, e.strm.avail_out -= r, e.strm.total_out += r, e.block_start += r, i -= r), i && (vt(e.strm, e.strm.output, e.strm.next_out, i), e.strm.next_out += i, e.strm.avail_out -= i, e.strm.total_out += i);
406
+ } while (l === 0);
407
+ return s -= e.strm.avail_in, s && (s >= e.w_size ? (e.matches = 2, e.window.set(e.strm.input.subarray(e.strm.next_in - e.w_size, e.strm.next_in), 0), e.strstart = e.w_size, e.insert = e.strstart) : (e.window_size - e.strstart <= s && (e.strstart -= e.w_size, e.window.set(e.window.subarray(e.w_size, e.w_size + e.strstart), 0), e.matches < 2 && e.matches++, e.insert > e.strstart && (e.insert = e.strstart)), e.window.set(e.strm.input.subarray(e.strm.next_in - s, e.strm.next_in), e.strstart), e.strstart += s, e.insert += s > e.w_size - e.insert ? e.w_size - e.insert : s), e.block_start = e.strstart), e.high_water < e.strstart && (e.high_water = e.strstart), l ? Ee : n !== W && n !== M && e.strm.avail_in === 0 && e.strstart === e.block_start ? ge : (a = e.window_size - e.strstart, e.strm.avail_in > a && e.block_start >= e.w_size && (e.block_start -= e.w_size, e.strstart -= e.w_size, e.window.set(e.window.subarray(e.w_size, e.w_size + e.strstart), 0), e.matches < 2 && e.matches++, a += e.w_size, e.insert > e.strstart && (e.insert = e.strstart)), a > e.strm.avail_in && (a = e.strm.avail_in), a && (vt(e.strm, e.window, e.strstart, a), e.strstart += a, e.insert += a > e.w_size - e.insert ? e.w_size - e.insert : a), e.high_water < e.strstart && (e.high_water = e.strstart), a = e.bi_valid + 42 >> 3, a = e.pending_buf_size - a > 65535 ? 65535 : e.pending_buf_size - a, t = a > e.w_size ? e.w_size : a, r = e.strstart - e.block_start, (r >= t || (r || n === M) && n !== W && e.strm.avail_in === 0 && r <= a) && (i = r > a ? a : r, l = n === M && e.strm.avail_in === 0 && i === r ? 1 : 0, gt(e, e.block_start, i, l), e.block_start += i, Z(e.strm)), l ? oe : z);
408
+ }, at = (e, n) => {
409
+ let t, i;
410
+ for (; ; ) {
411
+ if (e.lookahead < G) {
412
+ if (ue(e), e.lookahead < G && n === W)
413
+ return z;
414
+ if (e.lookahead === 0)
415
+ break;
416
+ }
417
+ if (t = 0, e.lookahead >= v && (e.ins_h = Q(e, e.ins_h, e.window[e.strstart + v - 1]), t = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart), t !== 0 && e.strstart - t <= e.w_size - G && (e.match_length = Hn(e, t)), e.match_length >= v)
418
+ if (i = J(e, e.strstart - e.match_start, e.match_length - v), e.lookahead -= e.match_length, e.match_length <= e.max_lazy_match && e.lookahead >= v) {
419
+ e.match_length--;
420
+ do
421
+ e.strstart++, e.ins_h = Q(e, e.ins_h, e.window[e.strstart + v - 1]), t = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart;
422
+ while (--e.match_length !== 0);
423
+ e.strstart++;
424
+ } else
425
+ e.strstart += e.match_length, e.match_length = 0, e.ins_h = e.window[e.strstart], e.ins_h = Q(e, e.ins_h, e.window[e.strstart + 1]);
426
+ else
427
+ i = J(e, 0, e.window[e.strstart]), e.lookahead--, e.strstart++;
428
+ if (i && ($(e, !1), e.strm.avail_out === 0))
429
+ return z;
430
+ }
431
+ return e.insert = e.strstart < v - 1 ? e.strstart : v - 1, n === M ? ($(e, !0), e.strm.avail_out === 0 ? oe : Ee) : e.sym_next && ($(e, !1), e.strm.avail_out === 0) ? z : ge;
432
+ }, fe = (e, n) => {
433
+ let t, i, r;
434
+ for (; ; ) {
435
+ if (e.lookahead < G) {
436
+ if (ue(e), e.lookahead < G && n === W)
437
+ return z;
438
+ if (e.lookahead === 0)
439
+ break;
440
+ }
441
+ if (t = 0, e.lookahead >= v && (e.ins_h = Q(e, e.ins_h, e.window[e.strstart + v - 1]), t = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart), e.prev_length = e.match_length, e.prev_match = e.match_start, e.match_length = v - 1, t !== 0 && e.prev_length < e.max_lazy_match && e.strstart - t <= e.w_size - G && (e.match_length = Hn(e, t), e.match_length <= 5 && (e.strategy === na || e.match_length === v && e.strstart - e.match_start > 4096) && (e.match_length = v - 1)), e.prev_length >= v && e.match_length <= e.prev_length) {
442
+ r = e.strstart + e.lookahead - v, i = J(e, e.strstart - 1 - e.prev_match, e.prev_length - v), e.lookahead -= e.prev_length - 1, e.prev_length -= 2;
443
+ do
444
+ ++e.strstart <= r && (e.ins_h = Q(e, e.ins_h, e.window[e.strstart + v - 1]), t = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart);
445
+ while (--e.prev_length !== 0);
446
+ if (e.match_available = 0, e.match_length = v - 1, e.strstart++, i && ($(e, !1), e.strm.avail_out === 0))
447
+ return z;
448
+ } else if (e.match_available) {
449
+ if (i = J(e, 0, e.window[e.strstart - 1]), i && $(e, !1), e.strstart++, e.lookahead--, e.strm.avail_out === 0)
450
+ return z;
451
+ } else
452
+ e.match_available = 1, e.strstart++, e.lookahead--;
453
+ }
454
+ return e.match_available && (i = J(e, 0, e.window[e.strstart - 1]), e.match_available = 0), e.insert = e.strstart < v - 1 ? e.strstart : v - 1, n === M ? ($(e, !0), e.strm.avail_out === 0 ? oe : Ee) : e.sym_next && ($(e, !1), e.strm.avail_out === 0) ? z : ge;
455
+ }, xa = (e, n) => {
456
+ let t, i, r, a;
457
+ const l = e.window;
458
+ for (; ; ) {
459
+ if (e.lookahead <= j) {
460
+ if (ue(e), e.lookahead <= j && n === W)
461
+ return z;
462
+ if (e.lookahead === 0)
463
+ break;
464
+ }
465
+ if (e.match_length = 0, e.lookahead >= v && e.strstart > 0 && (r = e.strstart - 1, i = l[r], i === l[++r] && i === l[++r] && i === l[++r])) {
466
+ a = e.strstart + j;
467
+ do
468
+ ;
469
+ while (i === l[++r] && i === l[++r] && i === l[++r] && i === l[++r] && i === l[++r] && i === l[++r] && i === l[++r] && i === l[++r] && r < a);
470
+ e.match_length = j - (a - r), e.match_length > e.lookahead && (e.match_length = e.lookahead);
471
+ }
472
+ if (e.match_length >= v ? (t = J(e, 1, e.match_length - v), e.lookahead -= e.match_length, e.strstart += e.match_length, e.match_length = 0) : (t = J(e, 0, e.window[e.strstart]), e.lookahead--, e.strstart++), t && ($(e, !1), e.strm.avail_out === 0))
473
+ return z;
474
+ }
475
+ return e.insert = 0, n === M ? ($(e, !0), e.strm.avail_out === 0 ? oe : Ee) : e.sym_next && ($(e, !1), e.strm.avail_out === 0) ? z : ge;
476
+ }, Sa = (e, n) => {
477
+ let t;
478
+ for (; ; ) {
479
+ if (e.lookahead === 0 && (ue(e), e.lookahead === 0)) {
480
+ if (n === W)
481
+ return z;
482
+ break;
483
+ }
484
+ if (e.match_length = 0, t = J(e, 0, e.window[e.strstart]), e.lookahead--, e.strstart++, t && ($(e, !1), e.strm.avail_out === 0))
485
+ return z;
486
+ }
487
+ return e.insert = 0, n === M ? ($(e, !0), e.strm.avail_out === 0 ? oe : Ee) : e.sym_next && ($(e, !1), e.strm.avail_out === 0) ? z : ge;
488
+ };
489
+ function F(e, n, t, i, r) {
490
+ this.good_length = e, this.max_lazy = n, this.nice_length = t, this.max_chain = i, this.func = r;
491
+ }
492
+ const xe = [
493
+ /* good lazy nice chain */
494
+ new F(0, 0, 0, 0, Bn),
495
+ /* 0 store only */
496
+ new F(4, 4, 8, 4, at),
497
+ /* 1 max speed, no lazy matches */
498
+ new F(4, 5, 16, 8, at),
499
+ /* 2 */
500
+ new F(4, 6, 32, 32, at),
501
+ /* 3 */
502
+ new F(4, 4, 16, 16, fe),
503
+ /* 4 lazy matches */
504
+ new F(8, 16, 32, 32, fe),
505
+ /* 5 */
506
+ new F(8, 16, 128, 128, fe),
507
+ /* 6 */
508
+ new F(8, 32, 128, 256, fe),
509
+ /* 7 */
510
+ new F(32, 128, 258, 1024, fe),
511
+ /* 8 */
512
+ new F(32, 258, 258, 4096, fe)
513
+ /* 9 max compression */
514
+ ], va = (e) => {
515
+ e.window_size = 2 * e.w_size, q(e.head), e.max_lazy_match = xe[e.level].max_lazy, e.good_match = xe[e.level].good_length, e.nice_match = xe[e.level].nice_length, e.max_chain_length = xe[e.level].max_chain, e.strstart = 0, e.block_start = 0, e.lookahead = 0, e.insert = 0, e.match_length = e.prev_length = v - 1, e.match_available = 0, e.ins_h = 0;
516
+ };
517
+ function ma() {
518
+ this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = qe, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new Uint16Array(ua * 2), this.dyn_dtree = new Uint16Array((2 * ha + 1) * 2), this.bl_tree = new Uint16Array((2 * da + 1) * 2), q(this.dyn_ltree), q(this.dyn_dtree), q(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new Uint16Array(pa + 1), this.heap = new Uint16Array(2 * Et + 1), q(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new Uint16Array(2 * Et + 1), q(this.depth), this.sym_buf = 0, this.lit_bufsize = 0, this.sym_next = 0, this.sym_end = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0;
519
+ }
520
+ const Ae = (e) => {
521
+ if (!e)
522
+ return 1;
523
+ const n = e.state;
524
+ return !n || n.strm !== e || n.status !== de && //#ifdef GZIP
525
+ n.status !== Nt && //#endif
526
+ n.status !== wt && n.status !== bt && n.status !== xt && n.status !== St && n.status !== ie && n.status !== be ? 1 : 0;
527
+ }, Gn = (e) => {
528
+ if (Ae(e))
529
+ return ae(e, B);
530
+ e.total_in = e.total_out = 0, e.data_type = oa;
531
+ const n = e.state;
532
+ return n.pending = 0, n.pending_out = 0, n.wrap < 0 && (n.wrap = -n.wrap), n.status = //#ifdef GZIP
533
+ n.wrap === 2 ? Nt : (
534
+ //#endif
535
+ n.wrap ? de : ie
536
+ ), e.adler = n.wrap === 2 ? 0 : 1, n.last_flush = -2, qi(n), L;
537
+ }, Kn = (e) => {
538
+ const n = Gn(e);
539
+ return n === L && va(e.state), n;
540
+ }, Ra = (e, n) => Ae(e) || e.state.wrap !== 2 ? B : (e.state.gzhead = n, L), Xn = (e, n, t, i, r, a) => {
541
+ if (!e)
542
+ return B;
543
+ let l = 1;
544
+ if (n === ta && (n = 6), i < 0 ? (l = 0, i = -i) : i > 15 && (l = 2, i -= 16), r < 1 || r > sa || t !== qe || i < 8 || i > 15 || n < 0 || n > 9 || a < 0 || a > aa || i === 8 && l !== 1)
545
+ return ae(e, B);
546
+ i === 8 && (i = 9);
547
+ const s = new ma();
548
+ return e.state = s, s.strm = e, s.status = de, s.wrap = l, s.gzhead = null, s.w_bits = i, s.w_size = 1 << s.w_bits, s.w_mask = s.w_size - 1, s.hash_bits = r + 7, s.hash_size = 1 << s.hash_bits, s.hash_mask = s.hash_size - 1, s.hash_shift = ~~((s.hash_bits + v - 1) / v), s.window = new Uint8Array(s.w_size * 2), s.head = new Uint16Array(s.hash_size), s.prev = new Uint16Array(s.w_size), s.lit_bufsize = 1 << r + 6, s.pending_buf_size = s.lit_bufsize * 4, s.pending_buf = new Uint8Array(s.pending_buf_size), s.sym_buf = s.lit_bufsize, s.sym_end = (s.lit_bufsize - 1) * 3, s.level = n, s.strategy = a, s.method = t, Kn(e);
549
+ }, ka = (e, n) => Xn(e, n, qe, la, _a, ra), Ia = (e, n) => {
550
+ if (Ae(e) || n > $t || n < 0)
551
+ return e ? ae(e, B) : B;
552
+ const t = e.state;
553
+ if (!e.output || e.avail_in !== 0 && !e.input || t.status === be && n !== M)
554
+ return ae(e, e.avail_out === 0 ? it : B);
555
+ const i = t.last_flush;
556
+ if (t.last_flush = n, t.pending !== 0) {
557
+ if (Z(e), e.avail_out === 0)
558
+ return t.last_flush = -1, L;
559
+ } else if (e.avail_in === 0 && Pt(n) <= Pt(i) && n !== M)
560
+ return ae(e, it);
561
+ if (t.status === be && e.avail_in !== 0)
562
+ return ae(e, it);
563
+ if (t.status === de && t.wrap === 0 && (t.status = ie), t.status === de) {
564
+ let r = qe + (t.w_bits - 8 << 4) << 8, a = -1;
565
+ if (t.strategy >= Me || t.level < 2 ? a = 0 : t.level < 6 ? a = 1 : t.level === 6 ? a = 2 : a = 3, r |= a << 6, t.strstart !== 0 && (r |= ga), r += 31 - r % 31, we(t, r), t.strstart !== 0 && (we(t, e.adler >>> 16), we(t, e.adler & 65535)), e.adler = 1, t.status = ie, Z(e), t.pending !== 0)
566
+ return t.last_flush = -1, L;
567
+ }
568
+ if (t.status === Nt) {
569
+ if (e.adler = 0, I(t, 31), I(t, 139), I(t, 8), t.gzhead)
570
+ I(
571
+ t,
572
+ (t.gzhead.text ? 1 : 0) + (t.gzhead.hcrc ? 2 : 0) + (t.gzhead.extra ? 4 : 0) + (t.gzhead.name ? 8 : 0) + (t.gzhead.comment ? 16 : 0)
573
+ ), I(t, t.gzhead.time & 255), I(t, t.gzhead.time >> 8 & 255), I(t, t.gzhead.time >> 16 & 255), I(t, t.gzhead.time >> 24 & 255), I(t, t.level === 9 ? 2 : t.strategy >= Me || t.level < 2 ? 4 : 0), I(t, t.gzhead.os & 255), t.gzhead.extra && t.gzhead.extra.length && (I(t, t.gzhead.extra.length & 255), I(t, t.gzhead.extra.length >> 8 & 255)), t.gzhead.hcrc && (e.adler = A(e.adler, t.pending_buf, t.pending, 0)), t.gzindex = 0, t.status = wt;
574
+ else if (I(t, 0), I(t, 0), I(t, 0), I(t, 0), I(t, 0), I(t, t.level === 9 ? 2 : t.strategy >= Me || t.level < 2 ? 4 : 0), I(t, Ea), t.status = ie, Z(e), t.pending !== 0)
575
+ return t.last_flush = -1, L;
576
+ }
577
+ if (t.status === wt) {
578
+ if (t.gzhead.extra) {
579
+ let r = t.pending, a = (t.gzhead.extra.length & 65535) - t.gzindex;
580
+ for (; t.pending + a > t.pending_buf_size; ) {
581
+ let s = t.pending_buf_size - t.pending;
582
+ if (t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex, t.gzindex + s), t.pending), t.pending = t.pending_buf_size, t.gzhead.hcrc && t.pending > r && (e.adler = A(e.adler, t.pending_buf, t.pending - r, r)), t.gzindex += s, Z(e), t.pending !== 0)
583
+ return t.last_flush = -1, L;
584
+ r = 0, a -= s;
585
+ }
586
+ let l = new Uint8Array(t.gzhead.extra);
587
+ t.pending_buf.set(l.subarray(t.gzindex, t.gzindex + a), t.pending), t.pending += a, t.gzhead.hcrc && t.pending > r && (e.adler = A(e.adler, t.pending_buf, t.pending - r, r)), t.gzindex = 0;
588
+ }
589
+ t.status = bt;
590
+ }
591
+ if (t.status === bt) {
592
+ if (t.gzhead.name) {
593
+ let r = t.pending, a;
594
+ do {
595
+ if (t.pending === t.pending_buf_size) {
596
+ if (t.gzhead.hcrc && t.pending > r && (e.adler = A(e.adler, t.pending_buf, t.pending - r, r)), Z(e), t.pending !== 0)
597
+ return t.last_flush = -1, L;
598
+ r = 0;
599
+ }
600
+ t.gzindex < t.gzhead.name.length ? a = t.gzhead.name.charCodeAt(t.gzindex++) & 255 : a = 0, I(t, a);
601
+ } while (a !== 0);
602
+ t.gzhead.hcrc && t.pending > r && (e.adler = A(e.adler, t.pending_buf, t.pending - r, r)), t.gzindex = 0;
603
+ }
604
+ t.status = xt;
605
+ }
606
+ if (t.status === xt) {
607
+ if (t.gzhead.comment) {
608
+ let r = t.pending, a;
609
+ do {
610
+ if (t.pending === t.pending_buf_size) {
611
+ if (t.gzhead.hcrc && t.pending > r && (e.adler = A(e.adler, t.pending_buf, t.pending - r, r)), Z(e), t.pending !== 0)
612
+ return t.last_flush = -1, L;
613
+ r = 0;
614
+ }
615
+ t.gzindex < t.gzhead.comment.length ? a = t.gzhead.comment.charCodeAt(t.gzindex++) & 255 : a = 0, I(t, a);
616
+ } while (a !== 0);
617
+ t.gzhead.hcrc && t.pending > r && (e.adler = A(e.adler, t.pending_buf, t.pending - r, r));
618
+ }
619
+ t.status = St;
620
+ }
621
+ if (t.status === St) {
622
+ if (t.gzhead.hcrc) {
623
+ if (t.pending + 2 > t.pending_buf_size && (Z(e), t.pending !== 0))
624
+ return t.last_flush = -1, L;
625
+ I(t, e.adler & 255), I(t, e.adler >> 8 & 255), e.adler = 0;
626
+ }
627
+ if (t.status = ie, Z(e), t.pending !== 0)
628
+ return t.last_flush = -1, L;
629
+ }
630
+ if (e.avail_in !== 0 || t.lookahead !== 0 || n !== W && t.status !== be) {
631
+ let r = t.level === 0 ? Bn(t, n) : t.strategy === Me ? Sa(t, n) : t.strategy === ia ? xa(t, n) : xe[t.level].func(t, n);
632
+ if ((r === oe || r === Ee) && (t.status = be), r === z || r === oe)
633
+ return e.avail_out === 0 && (t.last_flush = -1), L;
634
+ if (r === ge && (n === Wi ? Ji(t) : n !== $t && (gt(t, 0, 0, !1), n === Qi && (q(t.head), t.lookahead === 0 && (t.strstart = 0, t.block_start = 0, t.insert = 0))), Z(e), e.avail_out === 0))
635
+ return t.last_flush = -1, L;
636
+ }
637
+ return n !== M ? L : t.wrap <= 0 ? Mt : (t.wrap === 2 ? (I(t, e.adler & 255), I(t, e.adler >> 8 & 255), I(t, e.adler >> 16 & 255), I(t, e.adler >> 24 & 255), I(t, e.total_in & 255), I(t, e.total_in >> 8 & 255), I(t, e.total_in >> 16 & 255), I(t, e.total_in >> 24 & 255)) : (we(t, e.adler >>> 16), we(t, e.adler & 65535)), Z(e), t.wrap > 0 && (t.wrap = -t.wrap), t.pending !== 0 ? L : Mt);
638
+ }, Na = (e) => {
639
+ if (Ae(e))
640
+ return B;
641
+ const n = e.state.status;
642
+ return e.state = null, n === ie ? ae(e, ea) : L;
643
+ }, Da = (e, n) => {
644
+ let t = n.length;
645
+ if (Ae(e))
646
+ return B;
647
+ const i = e.state, r = i.wrap;
648
+ if (r === 2 || r === 1 && i.status !== de || i.lookahead)
649
+ return B;
650
+ if (r === 1 && (e.adler = De(e.adler, n, t, 0)), i.wrap = 0, t >= i.w_size) {
651
+ r === 0 && (q(i.head), i.strstart = 0, i.block_start = 0, i.insert = 0);
652
+ let c = new Uint8Array(i.w_size);
653
+ c.set(n.subarray(t - i.w_size, t), 0), n = c, t = i.w_size;
654
+ }
655
+ const a = e.avail_in, l = e.next_in, s = e.input;
656
+ for (e.avail_in = t, e.next_in = 0, e.input = n, ue(i); i.lookahead >= v; ) {
657
+ let c = i.strstart, o = i.lookahead - (v - 1);
658
+ do
659
+ i.ins_h = Q(i, i.ins_h, i.window[c + v - 1]), i.prev[c & i.w_mask] = i.head[i.ins_h], i.head[i.ins_h] = c, c++;
660
+ while (--o);
661
+ i.strstart = c, i.lookahead = v - 1, ue(i);
662
+ }
663
+ return i.strstart += i.lookahead, i.block_start = i.strstart, i.insert = i.lookahead, i.lookahead = 0, i.match_length = i.prev_length = v - 1, i.match_available = 0, e.next_in = l, e.input = s, e.avail_in = a, i.wrap = r, L;
664
+ };
665
+ var Ta = ka, ya = Xn, Ua = Kn, Oa = Gn, Aa = Ra, La = Ia, za = Na, Ca = Da, Za = "pako deflate (from Nodeca project)", ve = {
666
+ deflateInit: Ta,
667
+ deflateInit2: ya,
668
+ deflateReset: Ua,
669
+ deflateResetKeep: Oa,
670
+ deflateSetHeader: Aa,
671
+ deflate: La,
672
+ deflateEnd: za,
673
+ deflateSetDictionary: Ca,
674
+ deflateInfo: Za
675
+ };
676
+ const $a = (e, n) => Object.prototype.hasOwnProperty.call(e, n);
677
+ var Ma = function(e) {
678
+ const n = Array.prototype.slice.call(arguments, 1);
679
+ for (; n.length; ) {
680
+ const t = n.shift();
681
+ if (t) {
682
+ if (typeof t != "object")
683
+ throw new TypeError(t + "must be non-object");
684
+ for (const i in t)
685
+ $a(t, i) && (e[i] = t[i]);
686
+ }
687
+ }
688
+ return e;
689
+ }, Pa = (e) => {
690
+ let n = 0;
691
+ for (let i = 0, r = e.length; i < r; i++)
692
+ n += e[i].length;
693
+ const t = new Uint8Array(n);
694
+ for (let i = 0, r = 0, a = e.length; i < a; i++) {
695
+ let l = e[i];
696
+ t.set(l, r), r += l.length;
697
+ }
698
+ return t;
699
+ }, je = {
700
+ assign: Ma,
701
+ flattenChunks: Pa
702
+ };
703
+ let Vn = !0;
704
+ try {
705
+ String.fromCharCode.apply(null, new Uint8Array(1));
706
+ } catch {
707
+ Vn = !1;
708
+ }
709
+ const Te = new Uint8Array(256);
710
+ for (let e = 0; e < 256; e++)
711
+ Te[e] = e >= 252 ? 6 : e >= 248 ? 5 : e >= 240 ? 4 : e >= 224 ? 3 : e >= 192 ? 2 : 1;
712
+ Te[254] = Te[254] = 1;
713
+ var Fa = (e) => {
714
+ if (typeof TextEncoder == "function" && TextEncoder.prototype.encode)
715
+ return new TextEncoder().encode(e);
716
+ let n, t, i, r, a, l = e.length, s = 0;
717
+ for (r = 0; r < l; r++)
718
+ t = e.charCodeAt(r), (t & 64512) === 55296 && r + 1 < l && (i = e.charCodeAt(r + 1), (i & 64512) === 56320 && (t = 65536 + (t - 55296 << 10) + (i - 56320), r++)), s += t < 128 ? 1 : t < 2048 ? 2 : t < 65536 ? 3 : 4;
719
+ for (n = new Uint8Array(s), a = 0, r = 0; a < s; r++)
720
+ t = e.charCodeAt(r), (t & 64512) === 55296 && r + 1 < l && (i = e.charCodeAt(r + 1), (i & 64512) === 56320 && (t = 65536 + (t - 55296 << 10) + (i - 56320), r++)), t < 128 ? n[a++] = t : t < 2048 ? (n[a++] = 192 | t >>> 6, n[a++] = 128 | t & 63) : t < 65536 ? (n[a++] = 224 | t >>> 12, n[a++] = 128 | t >>> 6 & 63, n[a++] = 128 | t & 63) : (n[a++] = 240 | t >>> 18, n[a++] = 128 | t >>> 12 & 63, n[a++] = 128 | t >>> 6 & 63, n[a++] = 128 | t & 63);
721
+ return n;
722
+ };
723
+ const Ha = (e, n) => {
724
+ if (n < 65534 && e.subarray && Vn)
725
+ return String.fromCharCode.apply(null, e.length === n ? e : e.subarray(0, n));
726
+ let t = "";
727
+ for (let i = 0; i < n; i++)
728
+ t += String.fromCharCode(e[i]);
729
+ return t;
730
+ };
731
+ var Ba = (e, n) => {
732
+ const t = n || e.length;
733
+ if (typeof TextDecoder == "function" && TextDecoder.prototype.decode)
734
+ return new TextDecoder().decode(e.subarray(0, n));
735
+ let i, r;
736
+ const a = new Array(t * 2);
737
+ for (r = 0, i = 0; i < t; ) {
738
+ let l = e[i++];
739
+ if (l < 128) {
740
+ a[r++] = l;
741
+ continue;
742
+ }
743
+ let s = Te[l];
744
+ if (s > 4) {
745
+ a[r++] = 65533, i += s - 1;
746
+ continue;
747
+ }
748
+ for (l &= s === 2 ? 31 : s === 3 ? 15 : 7; s > 1 && i < t; )
749
+ l = l << 6 | e[i++] & 63, s--;
750
+ if (s > 1) {
751
+ a[r++] = 65533;
752
+ continue;
753
+ }
754
+ l < 65536 ? a[r++] = l : (l -= 65536, a[r++] = 55296 | l >> 10 & 1023, a[r++] = 56320 | l & 1023);
755
+ }
756
+ return Ha(a, r);
757
+ }, Ga = (e, n) => {
758
+ n = n || e.length, n > e.length && (n = e.length);
759
+ let t = n - 1;
760
+ for (; t >= 0 && (e[t] & 192) === 128; )
761
+ t--;
762
+ return t < 0 || t === 0 ? n : t + Te[e[t]] > n ? t : n;
763
+ }, ye = {
764
+ string2buf: Fa,
765
+ buf2string: Ba,
766
+ utf8border: Ga
767
+ };
768
+ function Ka() {
769
+ this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0;
770
+ }
771
+ var Yn = Ka;
772
+ const qn = Object.prototype.toString, {
773
+ Z_NO_FLUSH: Xa,
774
+ Z_SYNC_FLUSH: Va,
775
+ Z_FULL_FLUSH: Ya,
776
+ Z_FINISH: qa,
777
+ Z_OK: Ve,
778
+ Z_STREAM_END: ja,
779
+ Z_DEFAULT_COMPRESSION: Ja,
780
+ Z_DEFAULT_STRATEGY: Wa,
781
+ Z_DEFLATED: Qa
782
+ } = le;
783
+ function Le(e) {
784
+ this.options = je.assign({
785
+ level: Ja,
786
+ method: Qa,
787
+ chunkSize: 16384,
788
+ windowBits: 15,
789
+ memLevel: 8,
790
+ strategy: Wa
791
+ }, e || {});
792
+ let n = this.options;
793
+ n.raw && n.windowBits > 0 ? n.windowBits = -n.windowBits : n.gzip && n.windowBits > 0 && n.windowBits < 16 && (n.windowBits += 16), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new Yn(), this.strm.avail_out = 0;
794
+ let t = ve.deflateInit2(
795
+ this.strm,
796
+ n.level,
797
+ n.method,
798
+ n.windowBits,
799
+ n.memLevel,
800
+ n.strategy
801
+ );
802
+ if (t !== Ve)
803
+ throw new Error(re[t]);
804
+ if (n.header && ve.deflateSetHeader(this.strm, n.header), n.dictionary) {
805
+ let i;
806
+ if (typeof n.dictionary == "string" ? i = ye.string2buf(n.dictionary) : qn.call(n.dictionary) === "[object ArrayBuffer]" ? i = new Uint8Array(n.dictionary) : i = n.dictionary, t = ve.deflateSetDictionary(this.strm, i), t !== Ve)
807
+ throw new Error(re[t]);
808
+ this._dict_set = !0;
809
+ }
810
+ }
811
+ Le.prototype.push = function(e, n) {
812
+ const t = this.strm, i = this.options.chunkSize;
813
+ let r, a;
814
+ if (this.ended)
815
+ return !1;
816
+ for (n === ~~n ? a = n : a = n === !0 ? qa : Xa, typeof e == "string" ? t.input = ye.string2buf(e) : qn.call(e) === "[object ArrayBuffer]" ? t.input = new Uint8Array(e) : t.input = e, t.next_in = 0, t.avail_in = t.input.length; ; ) {
817
+ if (t.avail_out === 0 && (t.output = new Uint8Array(i), t.next_out = 0, t.avail_out = i), (a === Va || a === Ya) && t.avail_out <= 6) {
818
+ this.onData(t.output.subarray(0, t.next_out)), t.avail_out = 0;
819
+ continue;
820
+ }
821
+ if (r = ve.deflate(t, a), r === ja)
822
+ return t.next_out > 0 && this.onData(t.output.subarray(0, t.next_out)), r = ve.deflateEnd(this.strm), this.onEnd(r), this.ended = !0, r === Ve;
823
+ if (t.avail_out === 0) {
824
+ this.onData(t.output);
825
+ continue;
826
+ }
827
+ if (a > 0 && t.next_out > 0) {
828
+ this.onData(t.output.subarray(0, t.next_out)), t.avail_out = 0;
829
+ continue;
830
+ }
831
+ if (t.avail_in === 0) break;
832
+ }
833
+ return !0;
834
+ };
835
+ Le.prototype.onData = function(e) {
836
+ this.chunks.push(e);
837
+ };
838
+ Le.prototype.onEnd = function(e) {
839
+ e === Ve && (this.result = je.flattenChunks(this.chunks)), this.chunks = [], this.err = e, this.msg = this.strm.msg;
840
+ };
841
+ function Dt(e, n) {
842
+ const t = new Le(n);
843
+ if (t.push(e, !0), t.err)
844
+ throw t.msg || re[t.err];
845
+ return t.result;
846
+ }
847
+ function er(e, n) {
848
+ return n = n || {}, n.raw = !0, Dt(e, n);
849
+ }
850
+ function tr(e, n) {
851
+ return n = n || {}, n.gzip = !0, Dt(e, n);
852
+ }
853
+ var nr = Le, ir = Dt, ar = er, rr = tr, or = le, sr = {
854
+ Deflate: nr,
855
+ deflate: ir,
856
+ deflateRaw: ar,
857
+ gzip: rr,
858
+ constants: or
859
+ };
860
+ const Pe = 16209, lr = 16191;
861
+ var _r = function(n, t) {
862
+ let i, r, a, l, s, c, o, _, E, h, f, u, y, m, w, N, b, d, k, O, p, D, R, g;
863
+ const x = n.state;
864
+ i = n.next_in, R = n.input, r = i + (n.avail_in - 5), a = n.next_out, g = n.output, l = a - (t - n.avail_out), s = a + (n.avail_out - 257), c = x.dmax, o = x.wsize, _ = x.whave, E = x.wnext, h = x.window, f = x.hold, u = x.bits, y = x.lencode, m = x.distcode, w = (1 << x.lenbits) - 1, N = (1 << x.distbits) - 1;
865
+ e:
866
+ do {
867
+ u < 15 && (f += R[i++] << u, u += 8, f += R[i++] << u, u += 8), b = y[f & w];
868
+ t:
869
+ for (; ; ) {
870
+ if (d = b >>> 24, f >>>= d, u -= d, d = b >>> 16 & 255, d === 0)
871
+ g[a++] = b & 65535;
872
+ else if (d & 16) {
873
+ k = b & 65535, d &= 15, d && (u < d && (f += R[i++] << u, u += 8), k += f & (1 << d) - 1, f >>>= d, u -= d), u < 15 && (f += R[i++] << u, u += 8, f += R[i++] << u, u += 8), b = m[f & N];
874
+ n:
875
+ for (; ; ) {
876
+ if (d = b >>> 24, f >>>= d, u -= d, d = b >>> 16 & 255, d & 16) {
877
+ if (O = b & 65535, d &= 15, u < d && (f += R[i++] << u, u += 8, u < d && (f += R[i++] << u, u += 8)), O += f & (1 << d) - 1, O > c) {
878
+ n.msg = "invalid distance too far back", x.mode = Pe;
879
+ break e;
880
+ }
881
+ if (f >>>= d, u -= d, d = a - l, O > d) {
882
+ if (d = O - d, d > _ && x.sane) {
883
+ n.msg = "invalid distance too far back", x.mode = Pe;
884
+ break e;
885
+ }
886
+ if (p = 0, D = h, E === 0) {
887
+ if (p += o - d, d < k) {
888
+ k -= d;
889
+ do
890
+ g[a++] = h[p++];
891
+ while (--d);
892
+ p = a - O, D = g;
893
+ }
894
+ } else if (E < d) {
895
+ if (p += o + E - d, d -= E, d < k) {
896
+ k -= d;
897
+ do
898
+ g[a++] = h[p++];
899
+ while (--d);
900
+ if (p = 0, E < k) {
901
+ d = E, k -= d;
902
+ do
903
+ g[a++] = h[p++];
904
+ while (--d);
905
+ p = a - O, D = g;
906
+ }
907
+ }
908
+ } else if (p += E - d, d < k) {
909
+ k -= d;
910
+ do
911
+ g[a++] = h[p++];
912
+ while (--d);
913
+ p = a - O, D = g;
914
+ }
915
+ for (; k > 2; )
916
+ g[a++] = D[p++], g[a++] = D[p++], g[a++] = D[p++], k -= 3;
917
+ k && (g[a++] = D[p++], k > 1 && (g[a++] = D[p++]));
918
+ } else {
919
+ p = a - O;
920
+ do
921
+ g[a++] = g[p++], g[a++] = g[p++], g[a++] = g[p++], k -= 3;
922
+ while (k > 2);
923
+ k && (g[a++] = g[p++], k > 1 && (g[a++] = g[p++]));
924
+ }
925
+ } else if (d & 64) {
926
+ n.msg = "invalid distance code", x.mode = Pe;
927
+ break e;
928
+ } else {
929
+ b = m[(b & 65535) + (f & (1 << d) - 1)];
930
+ continue n;
931
+ }
932
+ break;
933
+ }
934
+ } else if (d & 64)
935
+ if (d & 32) {
936
+ x.mode = lr;
937
+ break e;
938
+ } else {
939
+ n.msg = "invalid literal/length code", x.mode = Pe;
940
+ break e;
941
+ }
942
+ else {
943
+ b = y[(b & 65535) + (f & (1 << d) - 1)];
944
+ continue t;
945
+ }
946
+ break;
947
+ }
948
+ } while (i < r && a < s);
949
+ k = u >> 3, i -= k, u -= k << 3, f &= (1 << u) - 1, n.next_in = i, n.next_out = a, n.avail_in = i < r ? 5 + (r - i) : 5 - (i - r), n.avail_out = a < s ? 257 + (s - a) : 257 - (a - s), x.hold = f, x.bits = u;
950
+ };
951
+ const ce = 15, Ft = 852, Ht = 592, Bt = 0, rt = 1, Gt = 2, fr = new Uint16Array([
952
+ /* Length codes 257..285 base */
953
+ 3,
954
+ 4,
955
+ 5,
956
+ 6,
957
+ 7,
958
+ 8,
959
+ 9,
960
+ 10,
961
+ 11,
962
+ 13,
963
+ 15,
964
+ 17,
965
+ 19,
966
+ 23,
967
+ 27,
968
+ 31,
969
+ 35,
970
+ 43,
971
+ 51,
972
+ 59,
973
+ 67,
974
+ 83,
975
+ 99,
976
+ 115,
977
+ 131,
978
+ 163,
979
+ 195,
980
+ 227,
981
+ 258,
982
+ 0,
983
+ 0
984
+ ]), cr = new Uint8Array([
985
+ /* Length codes 257..285 extra */
986
+ 16,
987
+ 16,
988
+ 16,
989
+ 16,
990
+ 16,
991
+ 16,
992
+ 16,
993
+ 16,
994
+ 17,
995
+ 17,
996
+ 17,
997
+ 17,
998
+ 18,
999
+ 18,
1000
+ 18,
1001
+ 18,
1002
+ 19,
1003
+ 19,
1004
+ 19,
1005
+ 19,
1006
+ 20,
1007
+ 20,
1008
+ 20,
1009
+ 20,
1010
+ 21,
1011
+ 21,
1012
+ 21,
1013
+ 21,
1014
+ 16,
1015
+ 72,
1016
+ 78
1017
+ ]), hr = new Uint16Array([
1018
+ /* Distance codes 0..29 base */
1019
+ 1,
1020
+ 2,
1021
+ 3,
1022
+ 4,
1023
+ 5,
1024
+ 7,
1025
+ 9,
1026
+ 13,
1027
+ 17,
1028
+ 25,
1029
+ 33,
1030
+ 49,
1031
+ 65,
1032
+ 97,
1033
+ 129,
1034
+ 193,
1035
+ 257,
1036
+ 385,
1037
+ 513,
1038
+ 769,
1039
+ 1025,
1040
+ 1537,
1041
+ 2049,
1042
+ 3073,
1043
+ 4097,
1044
+ 6145,
1045
+ 8193,
1046
+ 12289,
1047
+ 16385,
1048
+ 24577,
1049
+ 0,
1050
+ 0
1051
+ ]), dr = new Uint8Array([
1052
+ /* Distance codes 0..29 extra */
1053
+ 16,
1054
+ 16,
1055
+ 16,
1056
+ 16,
1057
+ 17,
1058
+ 17,
1059
+ 18,
1060
+ 18,
1061
+ 19,
1062
+ 19,
1063
+ 20,
1064
+ 20,
1065
+ 21,
1066
+ 21,
1067
+ 22,
1068
+ 22,
1069
+ 23,
1070
+ 23,
1071
+ 24,
1072
+ 24,
1073
+ 25,
1074
+ 25,
1075
+ 26,
1076
+ 26,
1077
+ 27,
1078
+ 27,
1079
+ 28,
1080
+ 28,
1081
+ 29,
1082
+ 29,
1083
+ 64,
1084
+ 64
1085
+ ]), ur = (e, n, t, i, r, a, l, s) => {
1086
+ const c = s.bits;
1087
+ let o = 0, _ = 0, E = 0, h = 0, f = 0, u = 0, y = 0, m = 0, w = 0, N = 0, b, d, k, O, p, D = null, R;
1088
+ const g = new Uint16Array(ce + 1), x = new Uint16Array(ce + 1);
1089
+ let ee = null, yt, Ce, Ze;
1090
+ for (o = 0; o <= ce; o++)
1091
+ g[o] = 0;
1092
+ for (_ = 0; _ < i; _++)
1093
+ g[n[t + _]]++;
1094
+ for (f = c, h = ce; h >= 1 && g[h] === 0; h--)
1095
+ ;
1096
+ if (f > h && (f = h), h === 0)
1097
+ return r[a++] = 1 << 24 | 64 << 16 | 0, r[a++] = 1 << 24 | 64 << 16 | 0, s.bits = 1, 0;
1098
+ for (E = 1; E < h && g[E] === 0; E++)
1099
+ ;
1100
+ for (f < E && (f = E), m = 1, o = 1; o <= ce; o++)
1101
+ if (m <<= 1, m -= g[o], m < 0)
1102
+ return -1;
1103
+ if (m > 0 && (e === Bt || h !== 1))
1104
+ return -1;
1105
+ for (x[1] = 0, o = 1; o < ce; o++)
1106
+ x[o + 1] = x[o] + g[o];
1107
+ for (_ = 0; _ < i; _++)
1108
+ n[t + _] !== 0 && (l[x[n[t + _]]++] = _);
1109
+ if (e === Bt ? (D = ee = l, R = 20) : e === rt ? (D = fr, ee = cr, R = 257) : (D = hr, ee = dr, R = 0), N = 0, _ = 0, o = E, p = a, u = f, y = 0, k = -1, w = 1 << f, O = w - 1, e === rt && w > Ft || e === Gt && w > Ht)
1110
+ return 1;
1111
+ for (; ; ) {
1112
+ yt = o - y, l[_] + 1 < R ? (Ce = 0, Ze = l[_]) : l[_] >= R ? (Ce = ee[l[_] - R], Ze = D[l[_] - R]) : (Ce = 96, Ze = 0), b = 1 << o - y, d = 1 << u, E = d;
1113
+ do
1114
+ d -= b, r[p + (N >> y) + d] = yt << 24 | Ce << 16 | Ze | 0;
1115
+ while (d !== 0);
1116
+ for (b = 1 << o - 1; N & b; )
1117
+ b >>= 1;
1118
+ if (b !== 0 ? (N &= b - 1, N += b) : N = 0, _++, --g[o] === 0) {
1119
+ if (o === h)
1120
+ break;
1121
+ o = n[t + l[_]];
1122
+ }
1123
+ if (o > f && (N & O) !== k) {
1124
+ for (y === 0 && (y = f), p += E, u = o - y, m = 1 << u; u + y < h && (m -= g[u + y], !(m <= 0)); )
1125
+ u++, m <<= 1;
1126
+ if (w += 1 << u, e === rt && w > Ft || e === Gt && w > Ht)
1127
+ return 1;
1128
+ k = N & O, r[k] = f << 24 | u << 16 | p - a | 0;
1129
+ }
1130
+ }
1131
+ return N !== 0 && (r[p + N] = o - y << 24 | 64 << 16 | 0), s.bits = f, 0;
1132
+ };
1133
+ var me = ur;
1134
+ const pr = 0, jn = 1, Jn = 2, {
1135
+ Z_FINISH: Kt,
1136
+ Z_BLOCK: gr,
1137
+ Z_TREES: Fe,
1138
+ Z_OK: se,
1139
+ Z_STREAM_END: Er,
1140
+ Z_NEED_DICT: wr,
1141
+ Z_STREAM_ERROR: P,
1142
+ Z_DATA_ERROR: Wn,
1143
+ Z_MEM_ERROR: Qn,
1144
+ Z_BUF_ERROR: br,
1145
+ Z_DEFLATED: Xt
1146
+ } = le, Je = 16180, Vt = 16181, Yt = 16182, qt = 16183, jt = 16184, Jt = 16185, Wt = 16186, Qt = 16187, en = 16188, tn = 16189, Ye = 16190, K = 16191, ot = 16192, nn = 16193, st = 16194, an = 16195, rn = 16196, on = 16197, sn = 16198, He = 16199, Be = 16200, ln = 16201, _n = 16202, fn = 16203, cn = 16204, hn = 16205, lt = 16206, dn = 16207, un = 16208, T = 16209, ei = 16210, ti = 16211, xr = 852, Sr = 592, vr = 15, mr = vr, pn = (e) => (e >>> 24 & 255) + (e >>> 8 & 65280) + ((e & 65280) << 8) + ((e & 255) << 24);
1147
+ function Rr() {
1148
+ this.strm = null, this.mode = 0, this.last = !1, this.wrap = 0, this.havedict = !1, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new Uint16Array(320), this.work = new Uint16Array(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0;
1149
+ }
1150
+ const _e = (e) => {
1151
+ if (!e)
1152
+ return 1;
1153
+ const n = e.state;
1154
+ return !n || n.strm !== e || n.mode < Je || n.mode > ti ? 1 : 0;
1155
+ }, ni = (e) => {
1156
+ if (_e(e))
1157
+ return P;
1158
+ const n = e.state;
1159
+ return e.total_in = e.total_out = n.total = 0, e.msg = "", n.wrap && (e.adler = n.wrap & 1), n.mode = Je, n.last = 0, n.havedict = 0, n.flags = -1, n.dmax = 32768, n.head = null, n.hold = 0, n.bits = 0, n.lencode = n.lendyn = new Int32Array(xr), n.distcode = n.distdyn = new Int32Array(Sr), n.sane = 1, n.back = -1, se;
1160
+ }, ii = (e) => {
1161
+ if (_e(e))
1162
+ return P;
1163
+ const n = e.state;
1164
+ return n.wsize = 0, n.whave = 0, n.wnext = 0, ni(e);
1165
+ }, ai = (e, n) => {
1166
+ let t;
1167
+ if (_e(e))
1168
+ return P;
1169
+ const i = e.state;
1170
+ return n < 0 ? (t = 0, n = -n) : (t = (n >> 4) + 5, n < 48 && (n &= 15)), n && (n < 8 || n > 15) ? P : (i.window !== null && i.wbits !== n && (i.window = null), i.wrap = t, i.wbits = n, ii(e));
1171
+ }, ri = (e, n) => {
1172
+ if (!e)
1173
+ return P;
1174
+ const t = new Rr();
1175
+ e.state = t, t.strm = e, t.window = null, t.mode = Je;
1176
+ const i = ai(e, n);
1177
+ return i !== se && (e.state = null), i;
1178
+ }, kr = (e) => ri(e, mr);
1179
+ let gn = !0, _t, ft;
1180
+ const Ir = (e) => {
1181
+ if (gn) {
1182
+ _t = new Int32Array(512), ft = new Int32Array(32);
1183
+ let n = 0;
1184
+ for (; n < 144; )
1185
+ e.lens[n++] = 8;
1186
+ for (; n < 256; )
1187
+ e.lens[n++] = 9;
1188
+ for (; n < 280; )
1189
+ e.lens[n++] = 7;
1190
+ for (; n < 288; )
1191
+ e.lens[n++] = 8;
1192
+ for (me(jn, e.lens, 0, 288, _t, 0, e.work, { bits: 9 }), n = 0; n < 32; )
1193
+ e.lens[n++] = 5;
1194
+ me(Jn, e.lens, 0, 32, ft, 0, e.work, { bits: 5 }), gn = !1;
1195
+ }
1196
+ e.lencode = _t, e.lenbits = 9, e.distcode = ft, e.distbits = 5;
1197
+ }, oi = (e, n, t, i) => {
1198
+ let r;
1199
+ const a = e.state;
1200
+ return a.window === null && (a.wsize = 1 << a.wbits, a.wnext = 0, a.whave = 0, a.window = new Uint8Array(a.wsize)), i >= a.wsize ? (a.window.set(n.subarray(t - a.wsize, t), 0), a.wnext = 0, a.whave = a.wsize) : (r = a.wsize - a.wnext, r > i && (r = i), a.window.set(n.subarray(t - i, t - i + r), a.wnext), i -= r, i ? (a.window.set(n.subarray(t - i, t), 0), a.wnext = i, a.whave = a.wsize) : (a.wnext += r, a.wnext === a.wsize && (a.wnext = 0), a.whave < a.wsize && (a.whave += r))), 0;
1201
+ }, Nr = (e, n) => {
1202
+ let t, i, r, a, l, s, c, o, _, E, h, f, u, y, m = 0, w, N, b, d, k, O, p, D;
1203
+ const R = new Uint8Array(4);
1204
+ let g, x;
1205
+ const ee = (
1206
+ /* permutation of code lengths */
1207
+ new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15])
1208
+ );
1209
+ if (_e(e) || !e.output || !e.input && e.avail_in !== 0)
1210
+ return P;
1211
+ t = e.state, t.mode === K && (t.mode = ot), l = e.next_out, r = e.output, c = e.avail_out, a = e.next_in, i = e.input, s = e.avail_in, o = t.hold, _ = t.bits, E = s, h = c, D = se;
1212
+ e:
1213
+ for (; ; )
1214
+ switch (t.mode) {
1215
+ case Je:
1216
+ if (t.wrap === 0) {
1217
+ t.mode = ot;
1218
+ break;
1219
+ }
1220
+ for (; _ < 16; ) {
1221
+ if (s === 0)
1222
+ break e;
1223
+ s--, o += i[a++] << _, _ += 8;
1224
+ }
1225
+ if (t.wrap & 2 && o === 35615) {
1226
+ t.wbits === 0 && (t.wbits = 15), t.check = 0, R[0] = o & 255, R[1] = o >>> 8 & 255, t.check = A(t.check, R, 2, 0), o = 0, _ = 0, t.mode = Vt;
1227
+ break;
1228
+ }
1229
+ if (t.head && (t.head.done = !1), !(t.wrap & 1) || /* check if zlib header allowed */
1230
+ (((o & 255) << 8) + (o >> 8)) % 31) {
1231
+ e.msg = "incorrect header check", t.mode = T;
1232
+ break;
1233
+ }
1234
+ if ((o & 15) !== Xt) {
1235
+ e.msg = "unknown compression method", t.mode = T;
1236
+ break;
1237
+ }
1238
+ if (o >>>= 4, _ -= 4, p = (o & 15) + 8, t.wbits === 0 && (t.wbits = p), p > 15 || p > t.wbits) {
1239
+ e.msg = "invalid window size", t.mode = T;
1240
+ break;
1241
+ }
1242
+ t.dmax = 1 << t.wbits, t.flags = 0, e.adler = t.check = 1, t.mode = o & 512 ? tn : K, o = 0, _ = 0;
1243
+ break;
1244
+ case Vt:
1245
+ for (; _ < 16; ) {
1246
+ if (s === 0)
1247
+ break e;
1248
+ s--, o += i[a++] << _, _ += 8;
1249
+ }
1250
+ if (t.flags = o, (t.flags & 255) !== Xt) {
1251
+ e.msg = "unknown compression method", t.mode = T;
1252
+ break;
1253
+ }
1254
+ if (t.flags & 57344) {
1255
+ e.msg = "unknown header flags set", t.mode = T;
1256
+ break;
1257
+ }
1258
+ t.head && (t.head.text = o >> 8 & 1), t.flags & 512 && t.wrap & 4 && (R[0] = o & 255, R[1] = o >>> 8 & 255, t.check = A(t.check, R, 2, 0)), o = 0, _ = 0, t.mode = Yt;
1259
+ case Yt:
1260
+ for (; _ < 32; ) {
1261
+ if (s === 0)
1262
+ break e;
1263
+ s--, o += i[a++] << _, _ += 8;
1264
+ }
1265
+ t.head && (t.head.time = o), t.flags & 512 && t.wrap & 4 && (R[0] = o & 255, R[1] = o >>> 8 & 255, R[2] = o >>> 16 & 255, R[3] = o >>> 24 & 255, t.check = A(t.check, R, 4, 0)), o = 0, _ = 0, t.mode = qt;
1266
+ case qt:
1267
+ for (; _ < 16; ) {
1268
+ if (s === 0)
1269
+ break e;
1270
+ s--, o += i[a++] << _, _ += 8;
1271
+ }
1272
+ t.head && (t.head.xflags = o & 255, t.head.os = o >> 8), t.flags & 512 && t.wrap & 4 && (R[0] = o & 255, R[1] = o >>> 8 & 255, t.check = A(t.check, R, 2, 0)), o = 0, _ = 0, t.mode = jt;
1273
+ case jt:
1274
+ if (t.flags & 1024) {
1275
+ for (; _ < 16; ) {
1276
+ if (s === 0)
1277
+ break e;
1278
+ s--, o += i[a++] << _, _ += 8;
1279
+ }
1280
+ t.length = o, t.head && (t.head.extra_len = o), t.flags & 512 && t.wrap & 4 && (R[0] = o & 255, R[1] = o >>> 8 & 255, t.check = A(t.check, R, 2, 0)), o = 0, _ = 0;
1281
+ } else t.head && (t.head.extra = null);
1282
+ t.mode = Jt;
1283
+ case Jt:
1284
+ if (t.flags & 1024 && (f = t.length, f > s && (f = s), f && (t.head && (p = t.head.extra_len - t.length, t.head.extra || (t.head.extra = new Uint8Array(t.head.extra_len)), t.head.extra.set(
1285
+ i.subarray(
1286
+ a,
1287
+ // extra field is limited to 65536 bytes
1288
+ // - no need for additional size check
1289
+ a + f
1290
+ ),
1291
+ /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
1292
+ p
1293
+ )), t.flags & 512 && t.wrap & 4 && (t.check = A(t.check, i, f, a)), s -= f, a += f, t.length -= f), t.length))
1294
+ break e;
1295
+ t.length = 0, t.mode = Wt;
1296
+ case Wt:
1297
+ if (t.flags & 2048) {
1298
+ if (s === 0)
1299
+ break e;
1300
+ f = 0;
1301
+ do
1302
+ p = i[a + f++], t.head && p && t.length < 65536 && (t.head.name += String.fromCharCode(p));
1303
+ while (p && f < s);
1304
+ if (t.flags & 512 && t.wrap & 4 && (t.check = A(t.check, i, f, a)), s -= f, a += f, p)
1305
+ break e;
1306
+ } else t.head && (t.head.name = null);
1307
+ t.length = 0, t.mode = Qt;
1308
+ case Qt:
1309
+ if (t.flags & 4096) {
1310
+ if (s === 0)
1311
+ break e;
1312
+ f = 0;
1313
+ do
1314
+ p = i[a + f++], t.head && p && t.length < 65536 && (t.head.comment += String.fromCharCode(p));
1315
+ while (p && f < s);
1316
+ if (t.flags & 512 && t.wrap & 4 && (t.check = A(t.check, i, f, a)), s -= f, a += f, p)
1317
+ break e;
1318
+ } else t.head && (t.head.comment = null);
1319
+ t.mode = en;
1320
+ case en:
1321
+ if (t.flags & 512) {
1322
+ for (; _ < 16; ) {
1323
+ if (s === 0)
1324
+ break e;
1325
+ s--, o += i[a++] << _, _ += 8;
1326
+ }
1327
+ if (t.wrap & 4 && o !== (t.check & 65535)) {
1328
+ e.msg = "header crc mismatch", t.mode = T;
1329
+ break;
1330
+ }
1331
+ o = 0, _ = 0;
1332
+ }
1333
+ t.head && (t.head.hcrc = t.flags >> 9 & 1, t.head.done = !0), e.adler = t.check = 0, t.mode = K;
1334
+ break;
1335
+ case tn:
1336
+ for (; _ < 32; ) {
1337
+ if (s === 0)
1338
+ break e;
1339
+ s--, o += i[a++] << _, _ += 8;
1340
+ }
1341
+ e.adler = t.check = pn(o), o = 0, _ = 0, t.mode = Ye;
1342
+ case Ye:
1343
+ if (t.havedict === 0)
1344
+ return e.next_out = l, e.avail_out = c, e.next_in = a, e.avail_in = s, t.hold = o, t.bits = _, wr;
1345
+ e.adler = t.check = 1, t.mode = K;
1346
+ case K:
1347
+ if (n === gr || n === Fe)
1348
+ break e;
1349
+ case ot:
1350
+ if (t.last) {
1351
+ o >>>= _ & 7, _ -= _ & 7, t.mode = lt;
1352
+ break;
1353
+ }
1354
+ for (; _ < 3; ) {
1355
+ if (s === 0)
1356
+ break e;
1357
+ s--, o += i[a++] << _, _ += 8;
1358
+ }
1359
+ switch (t.last = o & 1, o >>>= 1, _ -= 1, o & 3) {
1360
+ case 0:
1361
+ t.mode = nn;
1362
+ break;
1363
+ case 1:
1364
+ if (Ir(t), t.mode = He, n === Fe) {
1365
+ o >>>= 2, _ -= 2;
1366
+ break e;
1367
+ }
1368
+ break;
1369
+ case 2:
1370
+ t.mode = rn;
1371
+ break;
1372
+ case 3:
1373
+ e.msg = "invalid block type", t.mode = T;
1374
+ }
1375
+ o >>>= 2, _ -= 2;
1376
+ break;
1377
+ case nn:
1378
+ for (o >>>= _ & 7, _ -= _ & 7; _ < 32; ) {
1379
+ if (s === 0)
1380
+ break e;
1381
+ s--, o += i[a++] << _, _ += 8;
1382
+ }
1383
+ if ((o & 65535) !== (o >>> 16 ^ 65535)) {
1384
+ e.msg = "invalid stored block lengths", t.mode = T;
1385
+ break;
1386
+ }
1387
+ if (t.length = o & 65535, o = 0, _ = 0, t.mode = st, n === Fe)
1388
+ break e;
1389
+ case st:
1390
+ t.mode = an;
1391
+ case an:
1392
+ if (f = t.length, f) {
1393
+ if (f > s && (f = s), f > c && (f = c), f === 0)
1394
+ break e;
1395
+ r.set(i.subarray(a, a + f), l), s -= f, a += f, c -= f, l += f, t.length -= f;
1396
+ break;
1397
+ }
1398
+ t.mode = K;
1399
+ break;
1400
+ case rn:
1401
+ for (; _ < 14; ) {
1402
+ if (s === 0)
1403
+ break e;
1404
+ s--, o += i[a++] << _, _ += 8;
1405
+ }
1406
+ if (t.nlen = (o & 31) + 257, o >>>= 5, _ -= 5, t.ndist = (o & 31) + 1, o >>>= 5, _ -= 5, t.ncode = (o & 15) + 4, o >>>= 4, _ -= 4, t.nlen > 286 || t.ndist > 30) {
1407
+ e.msg = "too many length or distance symbols", t.mode = T;
1408
+ break;
1409
+ }
1410
+ t.have = 0, t.mode = on;
1411
+ case on:
1412
+ for (; t.have < t.ncode; ) {
1413
+ for (; _ < 3; ) {
1414
+ if (s === 0)
1415
+ break e;
1416
+ s--, o += i[a++] << _, _ += 8;
1417
+ }
1418
+ t.lens[ee[t.have++]] = o & 7, o >>>= 3, _ -= 3;
1419
+ }
1420
+ for (; t.have < 19; )
1421
+ t.lens[ee[t.have++]] = 0;
1422
+ if (t.lencode = t.lendyn, t.lenbits = 7, g = { bits: t.lenbits }, D = me(pr, t.lens, 0, 19, t.lencode, 0, t.work, g), t.lenbits = g.bits, D) {
1423
+ e.msg = "invalid code lengths set", t.mode = T;
1424
+ break;
1425
+ }
1426
+ t.have = 0, t.mode = sn;
1427
+ case sn:
1428
+ for (; t.have < t.nlen + t.ndist; ) {
1429
+ for (; m = t.lencode[o & (1 << t.lenbits) - 1], w = m >>> 24, N = m >>> 16 & 255, b = m & 65535, !(w <= _); ) {
1430
+ if (s === 0)
1431
+ break e;
1432
+ s--, o += i[a++] << _, _ += 8;
1433
+ }
1434
+ if (b < 16)
1435
+ o >>>= w, _ -= w, t.lens[t.have++] = b;
1436
+ else {
1437
+ if (b === 16) {
1438
+ for (x = w + 2; _ < x; ) {
1439
+ if (s === 0)
1440
+ break e;
1441
+ s--, o += i[a++] << _, _ += 8;
1442
+ }
1443
+ if (o >>>= w, _ -= w, t.have === 0) {
1444
+ e.msg = "invalid bit length repeat", t.mode = T;
1445
+ break;
1446
+ }
1447
+ p = t.lens[t.have - 1], f = 3 + (o & 3), o >>>= 2, _ -= 2;
1448
+ } else if (b === 17) {
1449
+ for (x = w + 3; _ < x; ) {
1450
+ if (s === 0)
1451
+ break e;
1452
+ s--, o += i[a++] << _, _ += 8;
1453
+ }
1454
+ o >>>= w, _ -= w, p = 0, f = 3 + (o & 7), o >>>= 3, _ -= 3;
1455
+ } else {
1456
+ for (x = w + 7; _ < x; ) {
1457
+ if (s === 0)
1458
+ break e;
1459
+ s--, o += i[a++] << _, _ += 8;
1460
+ }
1461
+ o >>>= w, _ -= w, p = 0, f = 11 + (o & 127), o >>>= 7, _ -= 7;
1462
+ }
1463
+ if (t.have + f > t.nlen + t.ndist) {
1464
+ e.msg = "invalid bit length repeat", t.mode = T;
1465
+ break;
1466
+ }
1467
+ for (; f--; )
1468
+ t.lens[t.have++] = p;
1469
+ }
1470
+ }
1471
+ if (t.mode === T)
1472
+ break;
1473
+ if (t.lens[256] === 0) {
1474
+ e.msg = "invalid code -- missing end-of-block", t.mode = T;
1475
+ break;
1476
+ }
1477
+ if (t.lenbits = 9, g = { bits: t.lenbits }, D = me(jn, t.lens, 0, t.nlen, t.lencode, 0, t.work, g), t.lenbits = g.bits, D) {
1478
+ e.msg = "invalid literal/lengths set", t.mode = T;
1479
+ break;
1480
+ }
1481
+ if (t.distbits = 6, t.distcode = t.distdyn, g = { bits: t.distbits }, D = me(Jn, t.lens, t.nlen, t.ndist, t.distcode, 0, t.work, g), t.distbits = g.bits, D) {
1482
+ e.msg = "invalid distances set", t.mode = T;
1483
+ break;
1484
+ }
1485
+ if (t.mode = He, n === Fe)
1486
+ break e;
1487
+ case He:
1488
+ t.mode = Be;
1489
+ case Be:
1490
+ if (s >= 6 && c >= 258) {
1491
+ e.next_out = l, e.avail_out = c, e.next_in = a, e.avail_in = s, t.hold = o, t.bits = _, _r(e, h), l = e.next_out, r = e.output, c = e.avail_out, a = e.next_in, i = e.input, s = e.avail_in, o = t.hold, _ = t.bits, t.mode === K && (t.back = -1);
1492
+ break;
1493
+ }
1494
+ for (t.back = 0; m = t.lencode[o & (1 << t.lenbits) - 1], w = m >>> 24, N = m >>> 16 & 255, b = m & 65535, !(w <= _); ) {
1495
+ if (s === 0)
1496
+ break e;
1497
+ s--, o += i[a++] << _, _ += 8;
1498
+ }
1499
+ if (N && !(N & 240)) {
1500
+ for (d = w, k = N, O = b; m = t.lencode[O + ((o & (1 << d + k) - 1) >> d)], w = m >>> 24, N = m >>> 16 & 255, b = m & 65535, !(d + w <= _); ) {
1501
+ if (s === 0)
1502
+ break e;
1503
+ s--, o += i[a++] << _, _ += 8;
1504
+ }
1505
+ o >>>= d, _ -= d, t.back += d;
1506
+ }
1507
+ if (o >>>= w, _ -= w, t.back += w, t.length = b, N === 0) {
1508
+ t.mode = hn;
1509
+ break;
1510
+ }
1511
+ if (N & 32) {
1512
+ t.back = -1, t.mode = K;
1513
+ break;
1514
+ }
1515
+ if (N & 64) {
1516
+ e.msg = "invalid literal/length code", t.mode = T;
1517
+ break;
1518
+ }
1519
+ t.extra = N & 15, t.mode = ln;
1520
+ case ln:
1521
+ if (t.extra) {
1522
+ for (x = t.extra; _ < x; ) {
1523
+ if (s === 0)
1524
+ break e;
1525
+ s--, o += i[a++] << _, _ += 8;
1526
+ }
1527
+ t.length += o & (1 << t.extra) - 1, o >>>= t.extra, _ -= t.extra, t.back += t.extra;
1528
+ }
1529
+ t.was = t.length, t.mode = _n;
1530
+ case _n:
1531
+ for (; m = t.distcode[o & (1 << t.distbits) - 1], w = m >>> 24, N = m >>> 16 & 255, b = m & 65535, !(w <= _); ) {
1532
+ if (s === 0)
1533
+ break e;
1534
+ s--, o += i[a++] << _, _ += 8;
1535
+ }
1536
+ if (!(N & 240)) {
1537
+ for (d = w, k = N, O = b; m = t.distcode[O + ((o & (1 << d + k) - 1) >> d)], w = m >>> 24, N = m >>> 16 & 255, b = m & 65535, !(d + w <= _); ) {
1538
+ if (s === 0)
1539
+ break e;
1540
+ s--, o += i[a++] << _, _ += 8;
1541
+ }
1542
+ o >>>= d, _ -= d, t.back += d;
1543
+ }
1544
+ if (o >>>= w, _ -= w, t.back += w, N & 64) {
1545
+ e.msg = "invalid distance code", t.mode = T;
1546
+ break;
1547
+ }
1548
+ t.offset = b, t.extra = N & 15, t.mode = fn;
1549
+ case fn:
1550
+ if (t.extra) {
1551
+ for (x = t.extra; _ < x; ) {
1552
+ if (s === 0)
1553
+ break e;
1554
+ s--, o += i[a++] << _, _ += 8;
1555
+ }
1556
+ t.offset += o & (1 << t.extra) - 1, o >>>= t.extra, _ -= t.extra, t.back += t.extra;
1557
+ }
1558
+ if (t.offset > t.dmax) {
1559
+ e.msg = "invalid distance too far back", t.mode = T;
1560
+ break;
1561
+ }
1562
+ t.mode = cn;
1563
+ case cn:
1564
+ if (c === 0)
1565
+ break e;
1566
+ if (f = h - c, t.offset > f) {
1567
+ if (f = t.offset - f, f > t.whave && t.sane) {
1568
+ e.msg = "invalid distance too far back", t.mode = T;
1569
+ break;
1570
+ }
1571
+ f > t.wnext ? (f -= t.wnext, u = t.wsize - f) : u = t.wnext - f, f > t.length && (f = t.length), y = t.window;
1572
+ } else
1573
+ y = r, u = l - t.offset, f = t.length;
1574
+ f > c && (f = c), c -= f, t.length -= f;
1575
+ do
1576
+ r[l++] = y[u++];
1577
+ while (--f);
1578
+ t.length === 0 && (t.mode = Be);
1579
+ break;
1580
+ case hn:
1581
+ if (c === 0)
1582
+ break e;
1583
+ r[l++] = t.length, c--, t.mode = Be;
1584
+ break;
1585
+ case lt:
1586
+ if (t.wrap) {
1587
+ for (; _ < 32; ) {
1588
+ if (s === 0)
1589
+ break e;
1590
+ s--, o |= i[a++] << _, _ += 8;
1591
+ }
1592
+ if (h -= c, e.total_out += h, t.total += h, t.wrap & 4 && h && (e.adler = t.check = /*UPDATE_CHECK(state.check, put - _out, _out);*/
1593
+ t.flags ? A(t.check, r, h, l - h) : De(t.check, r, h, l - h)), h = c, t.wrap & 4 && (t.flags ? o : pn(o)) !== t.check) {
1594
+ e.msg = "incorrect data check", t.mode = T;
1595
+ break;
1596
+ }
1597
+ o = 0, _ = 0;
1598
+ }
1599
+ t.mode = dn;
1600
+ case dn:
1601
+ if (t.wrap && t.flags) {
1602
+ for (; _ < 32; ) {
1603
+ if (s === 0)
1604
+ break e;
1605
+ s--, o += i[a++] << _, _ += 8;
1606
+ }
1607
+ if (t.wrap & 4 && o !== (t.total & 4294967295)) {
1608
+ e.msg = "incorrect length check", t.mode = T;
1609
+ break;
1610
+ }
1611
+ o = 0, _ = 0;
1612
+ }
1613
+ t.mode = un;
1614
+ case un:
1615
+ D = Er;
1616
+ break e;
1617
+ case T:
1618
+ D = Wn;
1619
+ break e;
1620
+ case ei:
1621
+ return Qn;
1622
+ case ti:
1623
+ default:
1624
+ return P;
1625
+ }
1626
+ return e.next_out = l, e.avail_out = c, e.next_in = a, e.avail_in = s, t.hold = o, t.bits = _, (t.wsize || h !== e.avail_out && t.mode < T && (t.mode < lt || n !== Kt)) && oi(e, e.output, e.next_out, h - e.avail_out), E -= e.avail_in, h -= e.avail_out, e.total_in += E, e.total_out += h, t.total += h, t.wrap & 4 && h && (e.adler = t.check = /*UPDATE_CHECK(state.check, strm.next_out - _out, _out);*/
1627
+ t.flags ? A(t.check, r, h, e.next_out - h) : De(t.check, r, h, e.next_out - h)), e.data_type = t.bits + (t.last ? 64 : 0) + (t.mode === K ? 128 : 0) + (t.mode === He || t.mode === st ? 256 : 0), (E === 0 && h === 0 || n === Kt) && D === se && (D = br), D;
1628
+ }, Dr = (e) => {
1629
+ if (_e(e))
1630
+ return P;
1631
+ let n = e.state;
1632
+ return n.window && (n.window = null), e.state = null, se;
1633
+ }, Tr = (e, n) => {
1634
+ if (_e(e))
1635
+ return P;
1636
+ const t = e.state;
1637
+ return t.wrap & 2 ? (t.head = n, n.done = !1, se) : P;
1638
+ }, yr = (e, n) => {
1639
+ const t = n.length;
1640
+ let i, r, a;
1641
+ return _e(e) || (i = e.state, i.wrap !== 0 && i.mode !== Ye) ? P : i.mode === Ye && (r = 1, r = De(r, n, t, 0), r !== i.check) ? Wn : (a = oi(e, n, t, t), a ? (i.mode = ei, Qn) : (i.havedict = 1, se));
1642
+ };
1643
+ var Ur = ii, Or = ai, Ar = ni, Lr = kr, zr = ri, Cr = Nr, Zr = Dr, $r = Tr, Mr = yr, Pr = "pako inflate (from Nodeca project)", Y = {
1644
+ inflateReset: Ur,
1645
+ inflateReset2: Or,
1646
+ inflateResetKeep: Ar,
1647
+ inflateInit: Lr,
1648
+ inflateInit2: zr,
1649
+ inflate: Cr,
1650
+ inflateEnd: Zr,
1651
+ inflateGetHeader: $r,
1652
+ inflateSetDictionary: Mr,
1653
+ inflateInfo: Pr
1654
+ };
1655
+ function Fr() {
1656
+ this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = !1;
1657
+ }
1658
+ var Hr = Fr;
1659
+ const si = Object.prototype.toString, {
1660
+ Z_NO_FLUSH: Br,
1661
+ Z_FINISH: Gr,
1662
+ Z_OK: Ue,
1663
+ Z_STREAM_END: ct,
1664
+ Z_NEED_DICT: ht,
1665
+ Z_STREAM_ERROR: Kr,
1666
+ Z_DATA_ERROR: En,
1667
+ Z_MEM_ERROR: Xr
1668
+ } = le;
1669
+ function ze(e) {
1670
+ this.options = je.assign({
1671
+ chunkSize: 1024 * 64,
1672
+ windowBits: 15,
1673
+ to: ""
1674
+ }, e || {});
1675
+ const n = this.options;
1676
+ n.raw && n.windowBits >= 0 && n.windowBits < 16 && (n.windowBits = -n.windowBits, n.windowBits === 0 && (n.windowBits = -15)), n.windowBits >= 0 && n.windowBits < 16 && !(e && e.windowBits) && (n.windowBits += 32), n.windowBits > 15 && n.windowBits < 48 && (n.windowBits & 15 || (n.windowBits |= 15)), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new Yn(), this.strm.avail_out = 0;
1677
+ let t = Y.inflateInit2(
1678
+ this.strm,
1679
+ n.windowBits
1680
+ );
1681
+ if (t !== Ue)
1682
+ throw new Error(re[t]);
1683
+ if (this.header = new Hr(), Y.inflateGetHeader(this.strm, this.header), n.dictionary && (typeof n.dictionary == "string" ? n.dictionary = ye.string2buf(n.dictionary) : si.call(n.dictionary) === "[object ArrayBuffer]" && (n.dictionary = new Uint8Array(n.dictionary)), n.raw && (t = Y.inflateSetDictionary(this.strm, n.dictionary), t !== Ue)))
1684
+ throw new Error(re[t]);
1685
+ }
1686
+ ze.prototype.push = function(e, n) {
1687
+ const t = this.strm, i = this.options.chunkSize, r = this.options.dictionary;
1688
+ let a, l, s;
1689
+ if (this.ended) return !1;
1690
+ for (n === ~~n ? l = n : l = n === !0 ? Gr : Br, si.call(e) === "[object ArrayBuffer]" ? t.input = new Uint8Array(e) : t.input = e, t.next_in = 0, t.avail_in = t.input.length; ; ) {
1691
+ for (t.avail_out === 0 && (t.output = new Uint8Array(i), t.next_out = 0, t.avail_out = i), a = Y.inflate(t, l), a === ht && r && (a = Y.inflateSetDictionary(t, r), a === Ue ? a = Y.inflate(t, l) : a === En && (a = ht)); t.avail_in > 0 && a === ct && t.state.wrap > 0 && e[t.next_in] !== 0; )
1692
+ Y.inflateReset(t), a = Y.inflate(t, l);
1693
+ switch (a) {
1694
+ case Kr:
1695
+ case En:
1696
+ case ht:
1697
+ case Xr:
1698
+ return this.onEnd(a), this.ended = !0, !1;
1699
+ }
1700
+ if (s = t.avail_out, t.next_out && (t.avail_out === 0 || a === ct))
1701
+ if (this.options.to === "string") {
1702
+ let c = ye.utf8border(t.output, t.next_out), o = t.next_out - c, _ = ye.buf2string(t.output, c);
1703
+ t.next_out = o, t.avail_out = i - o, o && t.output.set(t.output.subarray(c, c + o), 0), this.onData(_);
1704
+ } else
1705
+ this.onData(t.output.length === t.next_out ? t.output : t.output.subarray(0, t.next_out));
1706
+ if (!(a === Ue && s === 0)) {
1707
+ if (a === ct)
1708
+ return a = Y.inflateEnd(this.strm), this.onEnd(a), this.ended = !0, !0;
1709
+ if (t.avail_in === 0) break;
1710
+ }
1711
+ }
1712
+ return !0;
1713
+ };
1714
+ ze.prototype.onData = function(e) {
1715
+ this.chunks.push(e);
1716
+ };
1717
+ ze.prototype.onEnd = function(e) {
1718
+ e === Ue && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = je.flattenChunks(this.chunks)), this.chunks = [], this.err = e, this.msg = this.strm.msg;
1719
+ };
1720
+ function Tt(e, n) {
1721
+ const t = new ze(n);
1722
+ if (t.push(e), t.err) throw t.msg || re[t.err];
1723
+ return t.result;
1724
+ }
1725
+ function Vr(e, n) {
1726
+ return n = n || {}, n.raw = !0, Tt(e, n);
1727
+ }
1728
+ var Yr = ze, qr = Tt, jr = Vr, Jr = Tt, Wr = le, Qr = {
1729
+ Inflate: Yr,
1730
+ inflate: qr,
1731
+ inflateRaw: jr,
1732
+ ungzip: Jr,
1733
+ constants: Wr
1734
+ };
1735
+ const { Deflate: eo, deflate: to, deflateRaw: no, gzip: io } = sr, { Inflate: ao, inflate: ro, inflateRaw: oo, ungzip: so } = Qr;
1736
+ var lo = eo, _o = to, fo = no, co = io, ho = ao, uo = ro, po = oo, go = so, Eo = le, wo = {
1737
+ Deflate: lo,
1738
+ deflate: _o,
1739
+ deflateRaw: fo,
1740
+ gzip: co,
1741
+ Inflate: ho,
1742
+ inflate: uo,
1743
+ inflateRaw: po,
1744
+ ungzip: go,
1745
+ constants: Eo
1746
+ };
1747
+ function bo(e, n, t) {
1748
+ const i = document.createElement("a");
1749
+ i.href = e, i.style.display = "none", i.download = `${n}.${t}`, document.body.appendChild(i), i.click(), document.body.removeChild(i);
1750
+ }
1751
+ function is(e, n, t) {
1752
+ const i = URL.createObjectURL(e);
1753
+ bo(i, n, t), URL.revokeObjectURL(i);
1754
+ }
1755
+ const We = {
1756
+ [U.UNIVER_UNKNOWN]: "",
1757
+ [U.UNIVER_DOC]: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
1758
+ [U.UNIVER_SHEET]: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
1759
+ [U.UNIVER_SLIDE]: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
1760
+ [U.UNIVER_PROJECT]: "",
1761
+ [U.UNRECOGNIZED]: ""
1762
+ }, xo = {
1763
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
1764
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx",
1765
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation": "pptx"
1766
+ };
1767
+ function as(e) {
1768
+ return So(e.type) ? U.UNIVER_SHEET : vo(e.type) ? U.UNIVER_DOC : mo(e.type) ? U.UNIVER_SLIDE : U.UNIVER_UNKNOWN;
1769
+ }
1770
+ function So(e) {
1771
+ return e === We[U.UNIVER_SHEET];
1772
+ }
1773
+ function vo(e) {
1774
+ return e === We[U.UNIVER_DOC];
1775
+ }
1776
+ function mo(e) {
1777
+ return e === We[U.UNIVER_SLIDE];
1778
+ }
1779
+ function rs(e, n = !1) {
1780
+ const t = e.map((i) => We[i]).join(",");
1781
+ return new Promise((i, r) => {
1782
+ const a = document.createElement("input");
1783
+ a.type = "file", a.accept = t, a.multiple = n, a.addEventListener("change", (l) => {
1784
+ const s = l.currentTarget;
1785
+ if (!s.files || s.files.length === 0)
1786
+ throw r(null), new Error("No file selected");
1787
+ i(s.files);
1788
+ }), a.click();
1789
+ });
1790
+ }
1791
+ async function li(e) {
1792
+ try {
1793
+ const n = await fetch(e);
1794
+ if (!n.ok)
1795
+ throw new Error(`HTTP error! Status: ${n.status}`);
1796
+ const t = await n.blob(), i = n.headers.get("Content-Type") || "application/octet-stream";
1797
+ let a = `file.${xo[i] || "xlsx"}`;
1798
+ const l = n.headers.get("content-disposition");
1799
+ if (l) {
1800
+ const c = l.match(/filename=(.+)/);
1801
+ c && c[1] && (a = c[1]);
1802
+ } else
1803
+ a = Ro(e) || a;
1804
+ return new File([t], a, { type: i });
1805
+ } catch (n) {
1806
+ console.error("Error fetching file from URL:", n);
1807
+ return;
1808
+ }
1809
+ }
1810
+ function Ro(e) {
1811
+ try {
1812
+ return new URL(e).pathname.split("/").pop();
1813
+ } catch (n) {
1814
+ console.error("Error getting file name from URL:", n);
1815
+ return;
1816
+ }
1817
+ }
1818
+ async function ko(e) {
1819
+ try {
1820
+ const n = await fetch(e);
1821
+ if (!n.ok)
1822
+ throw new Error(`HTTP error! Status: ${n.status}`);
1823
+ return await n.text();
1824
+ } catch (n) {
1825
+ console.error("Error fetching text from URL:", n);
1826
+ return;
1827
+ }
1828
+ }
1829
+ function Io(e) {
1830
+ const n = new Blob([e], { type: "application/json" });
1831
+ return new File([n], "file.json");
1832
+ }
1833
+ function wn(e, n) {
1834
+ return e.replace("{type}", n);
1835
+ }
1836
+ function No(e, n) {
1837
+ return e.replace("{taskID}", n);
1838
+ }
1839
+ function Do(e, n) {
1840
+ return e.replace("{fileID}", n);
1841
+ }
1842
+ var To = Object.defineProperty, yo = Object.getOwnPropertyDescriptor, Uo = (e, n, t, i) => {
1843
+ for (var r = i > 1 ? void 0 : i ? yo(n, t) : n, a = e.length - 1, l; a >= 0; a--)
1844
+ (l = e[a]) && (r = (i ? l(n, t, r) : l(r)) || r);
1845
+ return i && r && To(n, t, r), r;
1846
+ }, bn = (e, n) => (t, i) => n(t, i, e);
1847
+ const Oo = "EXCHANGE_UPLOAD_FILE_SERVER_URL_KEY", Ao = "/universer-api/stream/file/upload", Lo = "EXCHANGE_IMPORT_SERVER_URL_KEY", zo = "/universer-api/exchange/{type}/import", Co = "EXCHANGE_EXPORT_SERVER_URL_KEY", Zo = "/universer-api/exchange/{type}/export", $o = "EXCHANGE_GET_TASK_SERVER_URL_KEY", Mo = "/universer-api/exchange/task/{taskID}", Po = "EXCHANGE_SIGN_URL_SERVER_URL_KEY", Fo = "/universer-api/file/{fileID}/sign-url", Ho = 12e4;
1848
+ var X = /* @__PURE__ */ ((e) => (e[e.UNDEFINED = 0] = "UNDEFINED", e[e.UNIT = 1] = "UNIT", e[e.JSON = 2] = "JSON", e[e.UNRECOGNIZED = -1] = "UNRECOGNIZED", e))(X || {});
1849
+ const Bo = mn("univer-pro.exchange-client.request.service");
1850
+ let xn = class {
1851
+ constructor(e, n) {
1852
+ this._configService = e, this._httpService = n;
1853
+ }
1854
+ dispose() {
1855
+ }
1856
+ /**
1857
+ * upload file to server
1858
+ * @param file
1859
+ */
1860
+ async upload(e, n = 0, t = !1) {
1861
+ if (typeof e == "string") {
1862
+ const r = await li(e);
1863
+ if (!r)
1864
+ return;
1865
+ e = r;
1866
+ }
1867
+ n = n || e.size;
1868
+ const i = new FormData();
1869
+ i.append("file", e);
1870
+ try {
1871
+ const r = `${this._getUploadFileURL()}?size=${n}&source=${In.HttpImport}&flate=${t}`;
1872
+ return await (await fetch(r, { method: "POST", body: i })).json();
1873
+ } catch {
1874
+ return;
1875
+ }
1876
+ }
1877
+ async import(e) {
1878
+ const { fileID: n, type: t, outputType: i } = e;
1879
+ try {
1880
+ const r = wn(this._getImportURL(), `${t}`);
1881
+ return await (await fetch(r, { method: "POST", body: JSON.stringify({
1882
+ body: {
1883
+ fileID: n,
1884
+ outputType: i
1885
+ }
1886
+ }.body), headers: { "Content-Type": "application/json" } })).json();
1887
+ } catch {
1888
+ return;
1889
+ }
1890
+ }
1891
+ async export(e) {
1892
+ const { unitID: n, jsonID: t, type: i } = e;
1893
+ try {
1894
+ const r = wn(this._getExportURL(), `${i}`);
1895
+ return await (await fetch(r, { method: "POST", body: JSON.stringify({
1896
+ body: {
1897
+ unitID: n,
1898
+ jsonID: t,
1899
+ type: i
1900
+ }
1901
+ }.body), headers: { "Content-Type": "application/json" } })).json();
1902
+ } catch {
1903
+ return;
1904
+ }
1905
+ }
1906
+ async getTask(e) {
1907
+ return new Promise((n, t) => {
1908
+ try {
1909
+ let i = 0;
1910
+ const r = No(this._getTaskURL(), `${e}`), a = this._getMaxPollingTime(), l = async () => {
1911
+ const c = (await this._httpService.get(r)).body;
1912
+ if (c.error && c.error.code === S.OK)
1913
+ if (c.status === "done")
1914
+ n(c);
1915
+ else if (c.status === "pending") {
1916
+ let o = 1e3;
1917
+ if (i >= a) {
1918
+ t(c);
1919
+ return;
1920
+ } else i >= 3e4 && (o = 5e3);
1921
+ i += o, setTimeout(l, o);
1922
+ } else
1923
+ t(c);
1924
+ else
1925
+ t(c);
1926
+ };
1927
+ l();
1928
+ } catch (i) {
1929
+ t(i instanceof Error ? i : new Error(String(i)));
1930
+ }
1931
+ });
1932
+ }
1933
+ async signUrl(e) {
1934
+ try {
1935
+ const n = Do(this._getSignURL(), `${e}`);
1936
+ return (await this._httpService.get(n)).body;
1937
+ } catch {
1938
+ return;
1939
+ }
1940
+ }
1941
+ _getUploadFileURL() {
1942
+ var t, i;
1943
+ const e = this._configService.getConfig(Oo), n = this._configService.getConfig(te);
1944
+ return (i = (t = n == null ? void 0 : n.uploadFileServerUrl) != null ? t : e) != null ? i : Ao;
1945
+ }
1946
+ _getImportURL() {
1947
+ var t, i;
1948
+ const e = this._configService.getConfig(Lo), n = this._configService.getConfig(te);
1949
+ return (i = (t = n == null ? void 0 : n.importServerUrl) != null ? t : e) != null ? i : zo;
1950
+ }
1951
+ _getExportURL() {
1952
+ var t, i;
1953
+ const e = this._configService.getConfig(Co), n = this._configService.getConfig(te);
1954
+ return (i = (t = n == null ? void 0 : n.exportServerUrl) != null ? t : e) != null ? i : Zo;
1955
+ }
1956
+ _getTaskURL() {
1957
+ var t, i;
1958
+ const e = this._configService.getConfig($o), n = this._configService.getConfig(te);
1959
+ return (i = (t = n == null ? void 0 : n.getTaskServerUrl) != null ? t : e) != null ? i : Mo;
1960
+ }
1961
+ _getSignURL() {
1962
+ var t, i;
1963
+ const e = this._configService.getConfig(Po), n = this._configService.getConfig(te);
1964
+ return (i = (t = n == null ? void 0 : n.signUrlServerUrl) != null ? t : e) != null ? i : Fo;
1965
+ }
1966
+ _getMaxPollingTime() {
1967
+ var n;
1968
+ const e = this._configService.getConfig(te);
1969
+ return (n = e == null ? void 0 : e.maxTimeoutTime) != null ? n : Ho;
1970
+ }
1971
+ };
1972
+ xn = Uo([
1973
+ bn(0, kn),
1974
+ bn(1, Rn(bi))
1975
+ ], xn);
1976
+ function Go(e) {
1977
+ const n = e.workbook;
1978
+ if (!n) return null;
1979
+ const t = {};
1980
+ n.sheets && Object.keys(n.sheets).forEach((r) => {
1981
+ const a = n.sheets[r];
1982
+ t[r] = {
1983
+ ...a,
1984
+ originalMeta: dt(Ke.decode(a.originalMeta))
1985
+ };
1986
+ });
1987
+ const i = dt(Ke.decode(n.originalMeta));
1988
+ return {
1989
+ ...e,
1990
+ workbook: {
1991
+ ...n,
1992
+ originalMeta: i,
1993
+ sheets: t
1994
+ },
1995
+ doc: {}
1996
+ };
1997
+ }
1998
+ function Ko(e) {
1999
+ const n = {};
2000
+ return e.forEach((t) => {
2001
+ n[t.id] = {
2002
+ ...t,
2003
+ data: dt(Ke.decode(t.data))
2004
+ };
2005
+ }), n;
2006
+ }
2007
+ async function Xo(e) {
2008
+ var c;
2009
+ const n = {
2010
+ metadata: void 0
2011
+ }, t = e.id, i = (c = e.rev) != null ? c : 0, r = new Vo(), { snapshot: a } = await hi(n, e, t, i, r), l = await di(a, r), s = Go(a);
2012
+ if (!s) throw new Error("Failed to transform snapshot to string");
2013
+ return {
2014
+ snapshot: s,
2015
+ sheetBlocks: Ko(l)
2016
+ };
2017
+ }
2018
+ class Vo {
2019
+ constructor() {
2020
+ $e(this, "_sheetBlockCache", /* @__PURE__ */ new Map());
2021
+ }
2022
+ /** Load snapshot from a database. */
2023
+ getUnitOnRev(n, t) {
2024
+ return Promise.resolve({
2025
+ snapshot: {
2026
+ unitID: "",
2027
+ type: U.UNIVER_SHEET,
2028
+ rev: 0,
2029
+ workbook: void 0,
2030
+ doc: void 0
2031
+ },
2032
+ changesets: [],
2033
+ error: {
2034
+ code: S.OK,
2035
+ message: ""
2036
+ }
2037
+ });
2038
+ }
2039
+ /** Load sheet block from a database. */
2040
+ getSheetBlock(n, t) {
2041
+ const i = this._sheetBlockCache.get(t.blockID);
2042
+ return Promise.resolve({
2043
+ block: i,
2044
+ error: {
2045
+ code: S.OK,
2046
+ message: ""
2047
+ }
2048
+ });
2049
+ }
2050
+ /** Load deserialized sheet block from a database. */
2051
+ getDeserializedSheetBlock(n, t) {
2052
+ const i = this._sheetBlockCache.get(t.blockID);
2053
+ return Promise.resolve({
2054
+ block: i === void 0 ? void 0 : {
2055
+ ...i,
2056
+ data: JSON.parse(Ke.decode(i.data))
2057
+ },
2058
+ error: {
2059
+ code: S.OK,
2060
+ message: ""
2061
+ }
2062
+ });
2063
+ }
2064
+ /** Fetch missing changeset */
2065
+ fetchMissingChangesets(n, t) {
2066
+ return Promise.resolve({
2067
+ changesets: [],
2068
+ error: {
2069
+ code: S.OK,
2070
+ message: ""
2071
+ }
2072
+ });
2073
+ }
2074
+ getResourcesRequest(n, t) {
2075
+ return Promise.resolve({
2076
+ resources: {},
2077
+ error: {
2078
+ code: S.OK,
2079
+ message: ""
2080
+ }
2081
+ });
2082
+ }
2083
+ /** Save snapshot to a database. */
2084
+ saveSnapshot(n, t) {
2085
+ return Promise.resolve({
2086
+ error: {
2087
+ code: S.OK,
2088
+ message: ""
2089
+ }
2090
+ });
2091
+ }
2092
+ /** Save sheet block to a database. */
2093
+ saveSheetBlock(n, t) {
2094
+ const { block: i } = t;
2095
+ return i ? (this._sheetBlockCache.set(i.id, i), Promise.resolve({
2096
+ error: {
2097
+ code: S.OK,
2098
+ message: ""
2099
+ },
2100
+ blockID: i.id
2101
+ })) : Promise.resolve({
2102
+ error: {
2103
+ code: S.UNDEFINED,
2104
+ message: "block is required"
2105
+ },
2106
+ blockID: ""
2107
+ });
2108
+ }
2109
+ /** Save changeset to a database. */
2110
+ saveChangeset(n, t) {
2111
+ return Promise.resolve({
2112
+ error: {
2113
+ code: S.OK,
2114
+ message: ""
2115
+ },
2116
+ concurrent: []
2117
+ });
2118
+ }
2119
+ copyFileMeta(n, t) {
2120
+ return Promise.resolve({
2121
+ error: void 0,
2122
+ fileMetaId: ""
2123
+ });
2124
+ }
2125
+ getLatestCsReqIdBySid(n, t) {
2126
+ return Promise.resolve({
2127
+ error: void 0,
2128
+ latestReqID: 0
2129
+ });
2130
+ }
2131
+ }
2132
+ var Yo = Object.defineProperty, qo = Object.getOwnPropertyDescriptor, jo = (e, n, t, i) => {
2133
+ for (var r = i > 1 ? void 0 : i ? qo(n, t) : n, a = e.length - 1, l; a >= 0; a--)
2134
+ (l = e[a]) && (r = (i ? l(n, t, r) : l(r)) || r);
2135
+ return i && r && Yo(n, t, r), r;
2136
+ }, Sn = (e, n) => (t, i) => n(t, i, e);
2137
+ const os = mn("univer-pro.exchange-client.exchange.service");
2138
+ let vn = class extends ci {
2139
+ constructor(n, t) {
2140
+ super();
2141
+ $e(this, "_requestState$", new wi());
2142
+ $e(this, "requestState$", this._requestState$.asObservable());
2143
+ this._configService = n, this._requestService = t;
2144
+ }
2145
+ dispose() {
2146
+ super.dispose(), this._requestState$.complete();
2147
+ }
2148
+ async importDOCXToSnapshot(n) {
2149
+ const t = await this._importToSnapshot(n, U.UNIVER_DOC);
2150
+ if (!t || !t.snapshot) return;
2151
+ const i = ui(t.snapshot);
2152
+ if (i)
2153
+ return i;
2154
+ }
2155
+ exportDOCXByUnitId(n) {
2156
+ throw new Error("Method not implemented.");
2157
+ }
2158
+ exportDOCXBySnapshot(n) {
2159
+ throw new Error("Method not implemented.");
2160
+ }
2161
+ async importXLSXToSnapshot(n) {
2162
+ const t = await this._importToSnapshot(n, U.UNIVER_SHEET);
2163
+ if (!t) return;
2164
+ const i = t.snapshot, r = t.sheetBlocks, l = Object.keys(r).map((c) => r[c]).map((c) => ({
2165
+ ...c,
2166
+ data: c.data ? JSON.parse(pi(c.data)) : void 0
2167
+ })), s = gi(i, l);
2168
+ if (s)
2169
+ return s;
2170
+ }
2171
+ async exportXLSXByUnitId(n) {
2172
+ return this._export(n, X.UNIT, U.UNIVER_SHEET);
2173
+ }
2174
+ async exportXLSXBySnapshot(n) {
2175
+ const t = await Xo(n);
2176
+ return this._exportBySnapshot(t, U.UNIVER_SHEET);
2177
+ }
2178
+ async importFileToUnitId(n, t) {
2179
+ var c, o;
2180
+ const i = await this._upload(n);
2181
+ if (!i) return;
2182
+ const r = await this._import(i, X.UNIT, t);
2183
+ if (!r) return;
2184
+ const a = await this._requestService.getTask(r).catch((_) => {
2185
+ var h;
2186
+ const E = _ instanceof Error ? _.message : (h = _.error) == null ? void 0 : h.message;
2187
+ this._requestState$.next({
2188
+ error: { code: S.UNRECOGNIZED, message: E || "" },
2189
+ state: 3
2190
+ /* GET_TASK */
2191
+ });
2192
+ });
2193
+ if (!a)
2194
+ return;
2195
+ const l = (c = a.import) == null ? void 0 : c.outputType, s = ((o = a.import) == null ? void 0 : o.unitID) || "";
2196
+ if (l !== X.UNIT) {
2197
+ this._requestState$.next({
2198
+ error: { code: S.UNRECOGNIZED, message: "Get outputType error" },
2199
+ state: 3
2200
+ /* GET_TASK */
2201
+ });
2202
+ return;
2203
+ }
2204
+ if (s.length === 0) {
2205
+ this._requestState$.next({
2206
+ error: { code: S.UNRECOGNIZED, message: "Failed to get unitID from task" },
2207
+ state: 3
2208
+ /* GET_TASK */
2209
+ });
2210
+ return;
2211
+ }
2212
+ return this._requestState$.next({
2213
+ error: a.error,
2214
+ state: 3
2215
+ /* GET_TASK */
2216
+ }), s;
2217
+ }
2218
+ async _importToSnapshot(n, t) {
2219
+ var _, E;
2220
+ const i = await this._upload(n);
2221
+ if (!i) return;
2222
+ const r = await this._import(i, X.JSON, t);
2223
+ if (!r) return;
2224
+ const a = await this._requestService.getTask(r).catch((h) => {
2225
+ var u;
2226
+ const f = h instanceof Error ? h.message : (u = h.error) == null ? void 0 : u.message;
2227
+ this._requestState$.next({
2228
+ error: { code: S.UNRECOGNIZED, message: f || "" },
2229
+ state: 3
2230
+ /* GET_TASK */
2231
+ });
2232
+ });
2233
+ if (!a)
2234
+ return;
2235
+ const l = (_ = a.import) == null ? void 0 : _.outputType, s = ((E = a.import) == null ? void 0 : E.jsonID) || "";
2236
+ if (l !== X.JSON) {
2237
+ this._requestState$.next({
2238
+ error: { code: S.UNRECOGNIZED, message: "Get outputType error" },
2239
+ state: 3
2240
+ /* GET_TASK */
2241
+ });
2242
+ return;
2243
+ }
2244
+ if (s.length === 0) {
2245
+ this._requestState$.next({
2246
+ error: { code: S.UNRECOGNIZED, message: "Failed to get jsonID from task" },
2247
+ state: 3
2248
+ /* GET_TASK */
2249
+ });
2250
+ return;
2251
+ }
2252
+ this._requestState$.next({
2253
+ error: a.error,
2254
+ state: 3
2255
+ /* GET_TASK */
2256
+ });
2257
+ const c = await this._signUrl(s);
2258
+ if (!c) return;
2259
+ const o = await ko(c);
2260
+ if (!o) {
2261
+ this._requestState$.next({
2262
+ error: { code: S.UNRECOGNIZED, message: "Failed to get text from url" },
2263
+ state: 5
2264
+ /* GET_JSON */
2265
+ });
2266
+ return;
2267
+ }
2268
+ try {
2269
+ const h = JSON.parse(o);
2270
+ return this._requestState$.next({
2271
+ error: { code: S.OK, message: "success" },
2272
+ state: 5
2273
+ /* GET_JSON */
2274
+ }), h;
2275
+ } catch {
2276
+ this._requestState$.next({
2277
+ error: { code: S.UNRECOGNIZED, message: "Failed to parse json" },
2278
+ state: 5
2279
+ /* GET_JSON */
2280
+ });
2281
+ }
2282
+ }
2283
+ /**
2284
+ * Export file by snapshot
2285
+ * @param snapshot
2286
+ * @param univerType
2287
+ * @returns
2288
+ */
2289
+ async _exportBySnapshot(n, t) {
2290
+ const i = JSON.stringify(n), r = wo.deflateRaw(i), a = Ei.encode(i).length, l = Io(r), s = await this._upload(l, a, !0);
2291
+ if (s)
2292
+ return this._export(s, X.JSON, t);
2293
+ }
2294
+ async _export(n, t, i) {
2295
+ var _;
2296
+ const r = await this._requestService.export({
2297
+ unitID: t === X.UNIT ? n : "",
2298
+ jsonID: t === X.JSON ? n : "",
2299
+ type: i
2300
+ });
2301
+ if (!r) {
2302
+ this._requestState$.next({
2303
+ error: { code: S.UNRECOGNIZED, message: "export error" },
2304
+ state: 2
2305
+ /* EXPORT */
2306
+ });
2307
+ return;
2308
+ }
2309
+ if (this._requestState$.next({
2310
+ error: r.error,
2311
+ state: 2
2312
+ /* EXPORT */
2313
+ }), r.error && r.error.code !== S.OK)
2314
+ return;
2315
+ const a = r.taskID, l = await this._requestService.getTask(a).catch((E) => {
2316
+ var f;
2317
+ const h = E instanceof Error ? E.message : (f = E.error) == null ? void 0 : f.message;
2318
+ this._requestState$.next({
2319
+ error: { code: S.UNRECOGNIZED, message: h || "" },
2320
+ state: 3
2321
+ /* GET_TASK */
2322
+ });
2323
+ });
2324
+ if (!l)
2325
+ return;
2326
+ const s = ((_ = l.export) == null ? void 0 : _.fileID) || "";
2327
+ if (s.length === 0) {
2328
+ this._requestState$.next({
2329
+ error: { code: S.UNRECOGNIZED, message: "Failed to get fileID from task" },
2330
+ state: 3
2331
+ /* GET_TASK */
2332
+ });
2333
+ return;
2334
+ }
2335
+ this._requestState$.next({
2336
+ error: l.error,
2337
+ state: 3
2338
+ /* GET_TASK */
2339
+ });
2340
+ const c = await this._signUrl(s);
2341
+ if (!c) return;
2342
+ const o = await li(c);
2343
+ if (!o) {
2344
+ this._requestState$.next({
2345
+ error: { code: S.UNRECOGNIZED, message: "Failed to get file from url" },
2346
+ state: 6
2347
+ /* GET_FILE */
2348
+ });
2349
+ return;
2350
+ }
2351
+ return this._requestState$.next({
2352
+ error: { code: S.OK, message: "success" },
2353
+ state: 6
2354
+ /* GET_FILE */
2355
+ }), o;
2356
+ }
2357
+ async _upload(n, t, i) {
2358
+ const r = await this._requestService.upload(n, t, i);
2359
+ if (!r || typeof r.FileId != "string") {
2360
+ this._requestState$.next({
2361
+ error: { code: S.UNRECOGNIZED, message: "upload error" },
2362
+ state: 0
2363
+ /* UPLOAD */
2364
+ });
2365
+ return;
2366
+ }
2367
+ const a = r.FileId;
2368
+ if (a.length === 0) {
2369
+ this._requestState$.next({
2370
+ error: { code: S.UNRECOGNIZED, message: "upload error" },
2371
+ state: 0
2372
+ /* UPLOAD */
2373
+ });
2374
+ return;
2375
+ }
2376
+ return this._requestState$.next({
2377
+ error: { code: S.OK, message: "success" },
2378
+ state: 0
2379
+ /* UPLOAD */
2380
+ }), a;
2381
+ }
2382
+ async _import(n, t, i) {
2383
+ const r = {
2384
+ fileID: n,
2385
+ type: i,
2386
+ outputType: t,
2387
+ fileUrl: ""
2388
+ }, a = await this._requestService.import(r);
2389
+ if (!a) {
2390
+ this._requestState$.next({
2391
+ error: { code: S.UNRECOGNIZED, message: "import error" },
2392
+ state: 1
2393
+ /* IMPORT */
2394
+ });
2395
+ return;
2396
+ }
2397
+ if (a.error && a.error.code !== S.OK) {
2398
+ this._requestState$.next({
2399
+ error: a.error,
2400
+ state: 1
2401
+ /* IMPORT */
2402
+ });
2403
+ return;
2404
+ }
2405
+ const l = a.taskID;
2406
+ if (l.length === 0) {
2407
+ this._requestState$.next({
2408
+ error: { code: S.UNRECOGNIZED, message: "Failed to get taskID from import response" },
2409
+ state: 1
2410
+ /* IMPORT */
2411
+ });
2412
+ return;
2413
+ }
2414
+ return this._requestState$.next({
2415
+ error: a.error,
2416
+ state: 1
2417
+ /* IMPORT */
2418
+ }), l;
2419
+ }
2420
+ async _signUrl(n) {
2421
+ const t = await this._requestService.signUrl(n);
2422
+ if (!t) {
2423
+ this._requestState$.next({
2424
+ error: { code: S.UNRECOGNIZED, message: "sign url error" },
2425
+ state: 4
2426
+ /* SIGN_URL */
2427
+ });
2428
+ return;
2429
+ }
2430
+ if (t.error && t.error.code !== S.OK) {
2431
+ this._requestState$.next({
2432
+ error: t.error,
2433
+ state: 4
2434
+ /* SIGN_URL */
2435
+ });
2436
+ return;
2437
+ }
2438
+ const i = new URL(t.url, this._getDownloadEndpointURL()).toString();
2439
+ if (i.length === 0) {
2440
+ this._requestState$.next({
2441
+ error: { code: S.UNRECOGNIZED, message: "sign url error" },
2442
+ state: 4
2443
+ /* SIGN_URL */
2444
+ });
2445
+ return;
2446
+ }
2447
+ return this._requestState$.next({
2448
+ error: t.error,
2449
+ state: 4
2450
+ /* SIGN_URL */
2451
+ }), i;
2452
+ }
2453
+ _getDownloadEndpointURL() {
2454
+ var t;
2455
+ const n = this._configService.getConfig(te);
2456
+ return (t = n == null ? void 0 : n.downloadEndpointUrl) != null ? t : location.origin;
2457
+ }
2458
+ };
2459
+ vn = jo([
2460
+ Sn(0, kn),
2461
+ Sn(1, Rn(Bo))
2462
+ ], vn);
2463
+ export {
2464
+ S as E,
2465
+ os as I,
2466
+ te as P,
2467
+ xn as R,
2468
+ U,
2469
+ ns as a,
2470
+ vn as b,
2471
+ Bo as c,
2472
+ is as d,
2473
+ Co as e,
2474
+ $o as f,
2475
+ rs as g,
2476
+ Lo as h,
2477
+ Po as i,
2478
+ Oo as j,
2479
+ as as k,
2480
+ Xo as t
2481
+ };