pptx-svelte-viewer 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3388 @@
1
+ import { a as at, c as ct, d as ut, i as Ye, l as lt, n as ht, o as $e, r as Oe, s as ft, t as dt, u as pt } from "./awareness-CkFlr7xx.js";
2
+ import { A as Re, B as gt, C as re, D as Je, E as yt, F as Pe, I as bt, L as mt, M as _t, N as vt, O as Fe, P as Xe, R as wt, S as De, T as ie, U as je, V as Et, _ as qe, a as Qe, b as Ze, i as ue, j as ze, k as se, l as Ct, n as We, o as Te, r as Rt, s as et, t as St, u as Tt, v as At, x as kt, y as Ot } from "./yjs-CE9F053g.js";
3
+ var Lt = Object.create, Le = Object.defineProperty, xt = Object.getOwnPropertyDescriptor, Nt = Object.getOwnPropertyNames, It = Object.getPrototypeOf, Mt = Object.prototype.hasOwnProperty, Pt = (m, x) => () => (x || (m((x = { exports: {} }).exports, x), m = null), x.exports), er = (m, x) => {
4
+ let j = {};
5
+ for (var U in m)
6
+ Le(j, U, {
7
+ get: m[U],
8
+ enumerable: !0
9
+ });
10
+ return x || Le(j, Symbol.toStringTag, { value: "Module" }), j;
11
+ }, Dt = (m, x, j, U) => {
12
+ if (x && typeof x == "object" || typeof x == "function")
13
+ for (var F = Nt(x), R = 0, M = F.length, _; R < M; R++)
14
+ _ = F[R], !Mt.call(m, _) && _ !== j && Le(m, _, {
15
+ get: ((c) => x[c]).bind(null, _),
16
+ enumerable: !(U = xt(x, _)) || U.enumerable
17
+ });
18
+ return m;
19
+ }, jt = (m, x, j) => (j = m != null ? Lt(It(m)) : {}, Dt(x || !m || !m.__esModule ? Le(j, "default", {
20
+ value: m,
21
+ enumerable: !0
22
+ }) : j, m)), ke = /* @__PURE__ */ ((m) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(m, { get: (x, j) => (typeof require < "u" ? require : x)[j] }) : m)(function(m) {
23
+ if (typeof require < "u") return require.apply(this, arguments);
24
+ throw Error('Calling `require` for "' + m + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
25
+ }), Bt = 1200, Ut = 2500, xe = 3e4, Be = (m) => {
26
+ if (m.shouldConnect && m.ws === null) {
27
+ const x = new WebSocket(m.url), j = m.binaryType;
28
+ let U = null;
29
+ j && (x.binaryType = j), m.ws = x, m.connecting = !0, m.connected = !1, x.onmessage = (M) => {
30
+ m.lastMessageReceived = Pe();
31
+ const _ = M.data, c = typeof _ == "string" ? JSON.parse(_) : _;
32
+ c && c.type === "pong" && (clearTimeout(U), U = setTimeout(R, xe / 2)), m.emit("message", [c, m]);
33
+ };
34
+ const F = (M) => {
35
+ m.ws !== null && (m.ws = null, m.connecting = !1, m.connected ? (m.connected = !1, m.emit("disconnect", [{
36
+ type: "disconnect",
37
+ error: M
38
+ }, m])) : m.unsuccessfulReconnects++, setTimeout(Be, wt(mt(m.unsuccessfulReconnects + 1) * Bt, Ut), m)), clearTimeout(U);
39
+ }, R = () => {
40
+ m.ws === x && m.send({ type: "ping" });
41
+ };
42
+ x.onclose = () => F(null), x.onerror = (M) => F(M), x.onopen = () => {
43
+ m.lastMessageReceived = Pe(), m.connecting = !1, m.connected = !0, m.unsuccessfulReconnects = 0, m.emit("connect", [{ type: "connect" }, m]), U = setTimeout(R, xe / 2);
44
+ };
45
+ }
46
+ }, Ft = class extends gt {
47
+ constructor(m, { binaryType: x } = {}) {
48
+ super(), this.url = m, this.ws = null, this.binaryType = x || null, this.connected = !1, this.connecting = !1, this.unsuccessfulReconnects = 0, this.lastMessageReceived = 0, this.shouldConnect = !0, this._checkInterval = setInterval(() => {
49
+ this.connected && xe < Pe() - this.lastMessageReceived && this.ws.close();
50
+ }, xe / 2), Be(this);
51
+ }
52
+ send(m) {
53
+ this.ws && this.ws.send(JSON.stringify(m));
54
+ }
55
+ destroy() {
56
+ clearInterval(this._checkInterval), this.disconnect(), super.destroy();
57
+ }
58
+ disconnect() {
59
+ this.shouldConnect = !1, this.ws !== null && this.ws.close();
60
+ }
61
+ connect() {
62
+ this.shouldConnect = !0, !this.connected && this.ws === null && Be(this);
63
+ }
64
+ }, qt = () => {
65
+ let m = !0;
66
+ return (x, j) => {
67
+ if (m) {
68
+ m = !1;
69
+ try {
70
+ x();
71
+ } finally {
72
+ m = !0;
73
+ }
74
+ } else j !== void 0 && j();
75
+ };
76
+ }, Wt = /* @__PURE__ */ Pt(((m, x) => {
77
+ (function(j) {
78
+ if (typeof m == "object" && typeof x < "u") x.exports = j();
79
+ else if (typeof define == "function" && define.amd) define([], j);
80
+ else {
81
+ var U = typeof window > "u" ? typeof global > "u" ? typeof self > "u" ? this : self : global : window;
82
+ U.SimplePeer = j();
83
+ }
84
+ })(function() {
85
+ var j = Math.floor, U = Math.abs, F = Math.pow;
86
+ return (/* @__PURE__ */ (function() {
87
+ function R(M, _, c) {
88
+ function S(l, d) {
89
+ if (!_[l]) {
90
+ if (!M[l]) {
91
+ var a = typeof ke == "function" && ke;
92
+ if (!d && a) return a(l, !0);
93
+ if (O) return O(l, !0);
94
+ var g = /* @__PURE__ */ new Error("Cannot find module '" + l + "'");
95
+ throw g.code = "MODULE_NOT_FOUND", g;
96
+ }
97
+ var L = _[l] = { exports: {} };
98
+ M[l][0].call(L.exports, function(w) {
99
+ var b = M[l][1][w];
100
+ return S(b || w);
101
+ }, L, L.exports, R, M, _, c);
102
+ }
103
+ return _[l].exports;
104
+ }
105
+ for (var O = typeof ke == "function" && ke, i = 0; i < c.length; i++) S(c[i]);
106
+ return S;
107
+ }
108
+ return R;
109
+ })())({
110
+ 1: [function(R, M, _) {
111
+ "use strict";
112
+ function c(h) {
113
+ var y = h.length;
114
+ if (0 < y % 4) throw new Error("Invalid string. Length must be a multiple of 4");
115
+ var k = h.indexOf("=");
116
+ k === -1 && (k = y);
117
+ var f = k === y ? 0 : 4 - k % 4;
118
+ return [k, f];
119
+ }
120
+ function S(h, y, k) {
121
+ return 3 * (y + k) / 4 - k;
122
+ }
123
+ function O(h) {
124
+ var y, k, f = c(h), T = f[0], P = f[1], p = new L(S(h, T, P)), v = 0, I = 0 < P ? T - 4 : T;
125
+ for (k = 0; k < I; k += 4) y = g[h.charCodeAt(k)] << 18 | g[h.charCodeAt(k + 1)] << 12 | g[h.charCodeAt(k + 2)] << 6 | g[h.charCodeAt(k + 3)], p[v++] = 255 & y >> 16, p[v++] = 255 & y >> 8, p[v++] = 255 & y;
126
+ return P === 2 && (y = g[h.charCodeAt(k)] << 2 | g[h.charCodeAt(k + 1)] >> 4, p[v++] = 255 & y), P === 1 && (y = g[h.charCodeAt(k)] << 10 | g[h.charCodeAt(k + 1)] << 4 | g[h.charCodeAt(k + 2)] >> 2, p[v++] = 255 & y >> 8, p[v++] = 255 & y), p;
127
+ }
128
+ function i(h) {
129
+ return a[63 & h >> 18] + a[63 & h >> 12] + a[63 & h >> 6] + a[63 & h];
130
+ }
131
+ function l(h, y, k) {
132
+ for (var f, T = [], P = y; P < k; P += 3) f = (16711680 & h[P] << 16) + (65280 & h[P + 1] << 8) + (255 & h[P + 2]), T.push(i(f));
133
+ return T.join("");
134
+ }
135
+ function d(h) {
136
+ for (var y, k = h.length, f = k % 3, T = [], P = 16383, p = 0, v = k - f; p < v; p += P) T.push(l(h, p, p + P > v ? v : p + P));
137
+ return f === 1 ? (y = h[k - 1], T.push(a[y >> 2] + a[63 & y << 4] + "==")) : f === 2 && (y = (h[k - 2] << 8) + h[k - 1], T.push(a[y >> 10] + a[63 & y >> 4] + a[63 & y << 2] + "=")), T.join("");
138
+ }
139
+ _.byteLength = function(h) {
140
+ var y = c(h), k = y[0], f = y[1];
141
+ return 3 * (k + f) / 4 - f;
142
+ }, _.toByteArray = O, _.fromByteArray = d;
143
+ for (var a = [], g = [], L = typeof Uint8Array > "u" ? Array : Uint8Array, w = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", b = 0, n = w.length; b < n; ++b) a[b] = w[b], g[w.charCodeAt(b)] = b;
144
+ g[45] = 62, g[95] = 63;
145
+ }, {}],
146
+ 2: [function() {
147
+ }, {}],
148
+ 3: [function(R, M, _) {
149
+ (function() {
150
+ (function() {
151
+ "use strict";
152
+ var c = String.fromCharCode, S = Math.min;
153
+ function O(e) {
154
+ if (2147483647 < e) throw new RangeError('The value "' + e + '" is invalid for option "size"');
155
+ var t = new Uint8Array(e);
156
+ return t.__proto__ = i.prototype, t;
157
+ }
158
+ function i(e, t, r) {
159
+ if (typeof e == "number") {
160
+ if (typeof t == "string") throw new TypeError('The "string" argument must be of type string. Received type number');
161
+ return g(e);
162
+ }
163
+ return l(e, t, r);
164
+ }
165
+ function l(e, t, r) {
166
+ if (typeof e == "string") return L(e, t);
167
+ if (ArrayBuffer.isView(e)) return w(e);
168
+ if (e == null) throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e);
169
+ if (A(e, ArrayBuffer) || e && A(e.buffer, ArrayBuffer)) return b(e, t, r);
170
+ if (typeof e == "number") throw new TypeError('The "value" argument must not be of type number. Received type number');
171
+ var u = e.valueOf && e.valueOf();
172
+ if (u != null && u !== e) return i.from(u, t, r);
173
+ var E = n(e);
174
+ if (E) return E;
175
+ if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof e[Symbol.toPrimitive] == "function") return i.from(e[Symbol.toPrimitive]("string"), t, r);
176
+ throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e);
177
+ }
178
+ function d(e) {
179
+ if (typeof e != "number") throw new TypeError('"size" argument must be of type number');
180
+ if (0 > e) throw new RangeError('The value "' + e + '" is invalid for option "size"');
181
+ }
182
+ function a(e, t, r) {
183
+ return d(e), 0 >= e || t === void 0 ? O(e) : typeof r == "string" ? O(e).fill(t, r) : O(e).fill(t);
184
+ }
185
+ function g(e) {
186
+ return d(e), O(0 > e ? 0 : 0 | h(e));
187
+ }
188
+ function L(e, t) {
189
+ if ((typeof t != "string" || t === "") && (t = "utf8"), !i.isEncoding(t)) throw new TypeError("Unknown encoding: " + t);
190
+ var r = 0 | y(e, t), u = O(r), E = u.write(e, t);
191
+ return E !== r && (u = u.slice(0, E)), u;
192
+ }
193
+ function w(e) {
194
+ for (var t = 0 > e.length ? 0 : 0 | h(e.length), r = O(t), u = 0; u < t; u += 1) r[u] = 255 & e[u];
195
+ return r;
196
+ }
197
+ function b(e, t, r) {
198
+ if (0 > t || e.byteLength < t) throw new RangeError('"offset" is outside of buffer bounds');
199
+ if (e.byteLength < t + (r || 0)) throw new RangeError('"length" is outside of buffer bounds');
200
+ var u;
201
+ return u = t === void 0 && r === void 0 ? new Uint8Array(e) : r === void 0 ? new Uint8Array(e, t) : new Uint8Array(e, t, r), u.__proto__ = i.prototype, u;
202
+ }
203
+ function n(e) {
204
+ if (i.isBuffer(e)) {
205
+ var t = 0 | h(e.length), r = O(t);
206
+ return r.length === 0 || e.copy(r, 0, 0, t), r;
207
+ }
208
+ return e.length === void 0 ? e.type === "Buffer" && Array.isArray(e.data) ? w(e.data) : void 0 : typeof e.length != "number" || D(e.length) ? O(0) : w(e);
209
+ }
210
+ function h(e) {
211
+ if (e >= 2147483647) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");
212
+ return 0 | e;
213
+ }
214
+ function y(e, t) {
215
+ if (i.isBuffer(e)) return e.length;
216
+ if (ArrayBuffer.isView(e) || A(e, ArrayBuffer)) return e.byteLength;
217
+ if (typeof e != "string") throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof e);
218
+ var r = e.length, u = 2 < arguments.length && arguments[2] === !0;
219
+ if (!u && r === 0) return 0;
220
+ for (var E = !1; ; ) switch (t) {
221
+ case "ascii":
222
+ case "latin1":
223
+ case "binary":
224
+ return r;
225
+ case "utf8":
226
+ case "utf-8":
227
+ return _e(e).length;
228
+ case "ucs2":
229
+ case "ucs-2":
230
+ case "utf16le":
231
+ case "utf-16le":
232
+ return 2 * r;
233
+ case "hex":
234
+ return r >>> 1;
235
+ case "base64":
236
+ return le(e).length;
237
+ default:
238
+ if (E) return u ? -1 : _e(e).length;
239
+ t = ("" + t).toLowerCase(), E = !0;
240
+ }
241
+ }
242
+ function k(e, t, r) {
243
+ var u = !1;
244
+ if ((t === void 0 || 0 > t) && (t = 0), t > this.length || ((r === void 0 || r > this.length) && (r = this.length), 0 >= r) || (r >>>= 0, t >>>= 0, r <= t)) return "";
245
+ for (e || (e = "utf8"); ; ) switch (e) {
246
+ case "hex":
247
+ return oe(this, t, r);
248
+ case "utf8":
249
+ case "utf-8":
250
+ return Z(this, t, r);
251
+ case "ascii":
252
+ return H(this, t, r);
253
+ case "latin1":
254
+ case "binary":
255
+ return Ee(this, t, r);
256
+ case "base64":
257
+ return K(this, t, r);
258
+ case "ucs2":
259
+ case "ucs-2":
260
+ case "utf16le":
261
+ case "utf-16le":
262
+ return de(this, t, r);
263
+ default:
264
+ if (u) throw new TypeError("Unknown encoding: " + e);
265
+ e = (e + "").toLowerCase(), u = !0;
266
+ }
267
+ }
268
+ function f(e, t, r) {
269
+ var u = e[t];
270
+ e[t] = e[r], e[r] = u;
271
+ }
272
+ function T(e, t, r, u, E) {
273
+ if (e.length === 0) return -1;
274
+ if (typeof r == "string" ? (u = r, r = 0) : 2147483647 < r ? r = 2147483647 : -2147483648 > r && (r = -2147483648), r = +r, D(r) && (r = E ? 0 : e.length - 1), 0 > r && (r = e.length + r), r >= e.length) {
275
+ if (E) return -1;
276
+ r = e.length - 1;
277
+ } else if (0 > r) if (E) r = 0;
278
+ else return -1;
279
+ if (typeof t == "string" && (t = i.from(t, u)), i.isBuffer(t)) return t.length === 0 ? -1 : P(e, t, r, u, E);
280
+ if (typeof t == "number") return t &= 255, typeof Uint8Array.prototype.indexOf == "function" ? E ? Uint8Array.prototype.indexOf.call(e, t, r) : Uint8Array.prototype.lastIndexOf.call(e, t, r) : P(e, [t], r, u, E);
281
+ throw new TypeError("val must be string, number or Buffer");
282
+ }
283
+ function P(e, t, r, u, E) {
284
+ function N(he, fe) {
285
+ return q === 1 ? he[fe] : he.readUInt16BE(fe * q);
286
+ }
287
+ var q = 1, G = e.length, $ = t.length;
288
+ if (u !== void 0 && (u = (u + "").toLowerCase(), u === "ucs2" || u === "ucs-2" || u === "utf16le" || u === "utf-16le")) {
289
+ if (2 > e.length || 2 > t.length) return -1;
290
+ q = 2, G /= 2, $ /= 2, r /= 2;
291
+ }
292
+ var Y;
293
+ if (E) {
294
+ var X = -1;
295
+ for (Y = r; Y < G; Y++) if (N(e, Y) !== N(t, X === -1 ? 0 : Y - X)) X !== -1 && (Y -= Y - X), X = -1;
296
+ else if (X === -1 && (X = Y), Y - X + 1 === $) return X * q;
297
+ } else for (r + $ > G && (r = G - $), Y = r; 0 <= Y; Y--) {
298
+ for (var ee = !0, ve = 0; ve < $; ve++) if (N(e, Y + ve) !== N(t, ve)) {
299
+ ee = !1;
300
+ break;
301
+ }
302
+ if (ee) return Y;
303
+ }
304
+ return -1;
305
+ }
306
+ function p(e, t, r, u) {
307
+ r = +r || 0;
308
+ var E = e.length - r;
309
+ u ? (u = +u, u > E && (u = E)) : u = E;
310
+ var N = t.length;
311
+ u > N / 2 && (u = N / 2);
312
+ for (var q, G = 0; G < u; ++G) {
313
+ if (q = parseInt(t.substr(2 * G, 2), 16), D(q)) return G;
314
+ e[r + G] = q;
315
+ }
316
+ return G;
317
+ }
318
+ function v(e, t, r, u) {
319
+ return C(_e(t, e.length - r), e, r, u);
320
+ }
321
+ function I(e, t, r, u) {
322
+ return C(ye(t), e, r, u);
323
+ }
324
+ function B(e, t, r, u) {
325
+ return I(e, t, r, u);
326
+ }
327
+ function V(e, t, r, u) {
328
+ return C(le(t), e, r, u);
329
+ }
330
+ function z(e, t, r, u) {
331
+ return C(ce(t, e.length - r), e, r, u);
332
+ }
333
+ function K(e, t, r) {
334
+ return t === 0 && r === e.length ? W.fromByteArray(e) : W.fromByteArray(e.slice(t, r));
335
+ }
336
+ function Z(e, t, r) {
337
+ r = S(e.length, r);
338
+ for (var u = [], E = t; E < r; ) {
339
+ var N = e[E], q = null, G = 239 < N ? 4 : 223 < N ? 3 : 191 < N ? 2 : 1;
340
+ if (E + G <= r) {
341
+ var $, Y, X, ee;
342
+ G === 1 ? 128 > N && (q = N) : G === 2 ? ($ = e[E + 1], (192 & $) == 128 && (ee = (31 & N) << 6 | 63 & $, 127 < ee && (q = ee))) : G === 3 ? ($ = e[E + 1], Y = e[E + 2], (192 & $) == 128 && (192 & Y) == 128 && (ee = (15 & N) << 12 | (63 & $) << 6 | 63 & Y, 2047 < ee && (55296 > ee || 57343 < ee) && (q = ee))) : G === 4 && ($ = e[E + 1], Y = e[E + 2], X = e[E + 3], (192 & $) == 128 && (192 & Y) == 128 && (192 & X) == 128 && (ee = (15 & N) << 18 | (63 & $) << 12 | (63 & Y) << 6 | 63 & X, 65535 < ee && 1114112 > ee && (q = ee)));
343
+ }
344
+ q === null ? (q = 65533, G = 1) : 65535 < q && (q -= 65536, u.push(55296 | 1023 & q >>> 10), q = 56320 | 1023 & q), u.push(q), E += G;
345
+ }
346
+ return te(u);
347
+ }
348
+ function te(e) {
349
+ var t = e.length;
350
+ if (t <= 4096) return c.apply(String, e);
351
+ for (var r = "", u = 0; u < t; ) r += c.apply(String, e.slice(u, u += 4096));
352
+ return r;
353
+ }
354
+ function H(e, t, r) {
355
+ var u = "";
356
+ r = S(e.length, r);
357
+ for (var E = t; E < r; ++E) u += c(127 & e[E]);
358
+ return u;
359
+ }
360
+ function Ee(e, t, r) {
361
+ var u = "";
362
+ r = S(e.length, r);
363
+ for (var E = t; E < r; ++E) u += c(e[E]);
364
+ return u;
365
+ }
366
+ function oe(e, t, r) {
367
+ var u = e.length;
368
+ (!t || 0 > t) && (t = 0), (!r || 0 > r || r > u) && (r = u);
369
+ for (var E = "", N = t; N < r; ++N) E += me(e[N]);
370
+ return E;
371
+ }
372
+ function de(e, t, r) {
373
+ for (var u = e.slice(t, r), E = "", N = 0; N < u.length; N += 2) E += c(u[N] + 256 * u[N + 1]);
374
+ return E;
375
+ }
376
+ function J(e, t, r) {
377
+ if (e % 1 != 0 || 0 > e) throw new RangeError("offset is not uint");
378
+ if (e + t > r) throw new RangeError("Trying to access beyond buffer length");
379
+ }
380
+ function Q(e, t, r, u, E, N) {
381
+ if (!i.isBuffer(e)) throw new TypeError('"buffer" argument must be a Buffer instance');
382
+ if (t > E || t < N) throw new RangeError('"value" argument is out of bounds');
383
+ if (r + u > e.length) throw new RangeError("Index out of range");
384
+ }
385
+ function ae(e, t, r, u) {
386
+ if (r + u > e.length) throw new RangeError("Index out of range");
387
+ if (0 > r) throw new RangeError("Index out of range");
388
+ }
389
+ function pe(e, t, r, u, E) {
390
+ return t = +t, r >>>= 0, E || ae(e, t, r, 4, 34028234663852886e22, -34028234663852886e22), s.write(e, t, r, u, 23, 4), r + 4;
391
+ }
392
+ function ge(e, t, r, u, E) {
393
+ return t = +t, r >>>= 0, E || ae(e, t, r, 8, 17976931348623157e292, -17976931348623157e292), s.write(e, t, r, u, 52, 8), r + 8;
394
+ }
395
+ function Se(e) {
396
+ if (e = e.split("=")[0], e = e.trim().replace(o, ""), 2 > e.length) return "";
397
+ for (; e.length % 4 != 0; ) e += "=";
398
+ return e;
399
+ }
400
+ function me(e) {
401
+ return 16 > e ? "0" + e.toString(16) : e.toString(16);
402
+ }
403
+ function _e(e, t) {
404
+ t = t || 1 / 0;
405
+ for (var r, u = e.length, E = null, N = [], q = 0; q < u; ++q) {
406
+ if (r = e.charCodeAt(q), 55295 < r && 57344 > r) {
407
+ if (!E) {
408
+ if (56319 < r) {
409
+ -1 < (t -= 3) && N.push(239, 191, 189);
410
+ continue;
411
+ } else if (q + 1 === u) {
412
+ -1 < (t -= 3) && N.push(239, 191, 189);
413
+ continue;
414
+ }
415
+ E = r;
416
+ continue;
417
+ }
418
+ if (56320 > r) {
419
+ -1 < (t -= 3) && N.push(239, 191, 189), E = r;
420
+ continue;
421
+ }
422
+ r = (E - 55296 << 10 | r - 56320) + 65536;
423
+ } else E && -1 < (t -= 3) && N.push(239, 191, 189);
424
+ if (E = null, 128 > r) {
425
+ if (0 > (t -= 1)) break;
426
+ N.push(r);
427
+ } else if (2048 > r) {
428
+ if (0 > (t -= 2)) break;
429
+ N.push(192 | r >> 6, 128 | 63 & r);
430
+ } else if (65536 > r) {
431
+ if (0 > (t -= 3)) break;
432
+ N.push(224 | r >> 12, 128 | 63 & r >> 6, 128 | 63 & r);
433
+ } else if (1114112 > r) {
434
+ if (0 > (t -= 4)) break;
435
+ N.push(240 | r >> 18, 128 | 63 & r >> 12, 128 | 63 & r >> 6, 128 | 63 & r);
436
+ } else throw new Error("Invalid code point");
437
+ }
438
+ return N;
439
+ }
440
+ function ye(e) {
441
+ for (var t = [], r = 0; r < e.length; ++r) t.push(255 & e.charCodeAt(r));
442
+ return t;
443
+ }
444
+ function ce(e, t) {
445
+ for (var r, u, E, N = [], q = 0; q < e.length && !(0 > (t -= 2)); ++q) r = e.charCodeAt(q), u = r >> 8, E = r % 256, N.push(E), N.push(u);
446
+ return N;
447
+ }
448
+ function le(e) {
449
+ return W.toByteArray(Se(e));
450
+ }
451
+ function C(e, t, r, u) {
452
+ for (var E = 0; E < u && !(E + r >= t.length || E >= e.length); ++E) t[E + r] = e[E];
453
+ return E;
454
+ }
455
+ function A(e, t) {
456
+ return e instanceof t || e != null && e.constructor != null && e.constructor.name != null && e.constructor.name === t.name;
457
+ }
458
+ function D(e) {
459
+ return e !== e;
460
+ }
461
+ var W = R("base64-js"), s = R("ieee754");
462
+ _.Buffer = i, _.SlowBuffer = function(e) {
463
+ return +e != e && (e = 0), i.alloc(+e);
464
+ }, _.INSPECT_MAX_BYTES = 50, _.kMaxLength = 2147483647, i.TYPED_ARRAY_SUPPORT = (function() {
465
+ try {
466
+ var e = /* @__PURE__ */ new Uint8Array(1);
467
+ return e.__proto__ = {
468
+ __proto__: Uint8Array.prototype,
469
+ foo: function() {
470
+ return 42;
471
+ }
472
+ }, e.foo() === 42;
473
+ } catch {
474
+ return !1;
475
+ }
476
+ })(), i.TYPED_ARRAY_SUPPORT || typeof console > "u" || typeof console.error != "function" || console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."), Object.defineProperty(i.prototype, "parent", {
477
+ enumerable: !0,
478
+ get: function() {
479
+ return i.isBuffer(this) ? this.buffer : void 0;
480
+ }
481
+ }), Object.defineProperty(i.prototype, "offset", {
482
+ enumerable: !0,
483
+ get: function() {
484
+ return i.isBuffer(this) ? this.byteOffset : void 0;
485
+ }
486
+ }), typeof Symbol < "u" && Symbol.species != null && i[Symbol.species] === i && Object.defineProperty(i, Symbol.species, {
487
+ value: null,
488
+ configurable: !0,
489
+ enumerable: !1,
490
+ writable: !1
491
+ }), i.poolSize = 8192, i.from = function(e, t, r) {
492
+ return l(e, t, r);
493
+ }, i.prototype.__proto__ = Uint8Array.prototype, i.__proto__ = Uint8Array, i.alloc = function(e, t, r) {
494
+ return a(e, t, r);
495
+ }, i.allocUnsafe = function(e) {
496
+ return g(e);
497
+ }, i.allocUnsafeSlow = function(e) {
498
+ return g(e);
499
+ }, i.isBuffer = function(e) {
500
+ return e != null && e._isBuffer === !0 && e !== i.prototype;
501
+ }, i.compare = function(e, t) {
502
+ if (A(e, Uint8Array) && (e = i.from(e, e.offset, e.byteLength)), A(t, Uint8Array) && (t = i.from(t, t.offset, t.byteLength)), !i.isBuffer(e) || !i.isBuffer(t)) throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');
503
+ if (e === t) return 0;
504
+ for (var r = e.length, u = t.length, E = 0, N = S(r, u); E < N; ++E) if (e[E] !== t[E]) {
505
+ r = e[E], u = t[E];
506
+ break;
507
+ }
508
+ return r < u ? -1 : u < r ? 1 : 0;
509
+ }, i.isEncoding = function(e) {
510
+ switch ((e + "").toLowerCase()) {
511
+ case "hex":
512
+ case "utf8":
513
+ case "utf-8":
514
+ case "ascii":
515
+ case "latin1":
516
+ case "binary":
517
+ case "base64":
518
+ case "ucs2":
519
+ case "ucs-2":
520
+ case "utf16le":
521
+ case "utf-16le":
522
+ return !0;
523
+ default:
524
+ return !1;
525
+ }
526
+ }, i.concat = function(e, t) {
527
+ if (!Array.isArray(e)) throw new TypeError('"list" argument must be an Array of Buffers');
528
+ if (e.length === 0) return i.alloc(0);
529
+ var r;
530
+ if (t === void 0) for (t = 0, r = 0; r < e.length; ++r) t += e[r].length;
531
+ var u = i.allocUnsafe(t), E = 0;
532
+ for (r = 0; r < e.length; ++r) {
533
+ var N = e[r];
534
+ if (A(N, Uint8Array) && (N = i.from(N)), !i.isBuffer(N)) throw new TypeError('"list" argument must be an Array of Buffers');
535
+ N.copy(u, E), E += N.length;
536
+ }
537
+ return u;
538
+ }, i.byteLength = y, i.prototype._isBuffer = !0, i.prototype.swap16 = function() {
539
+ var e = this.length;
540
+ if (e % 2 != 0) throw new RangeError("Buffer size must be a multiple of 16-bits");
541
+ for (var t = 0; t < e; t += 2) f(this, t, t + 1);
542
+ return this;
543
+ }, i.prototype.swap32 = function() {
544
+ var e = this.length;
545
+ if (e % 4 != 0) throw new RangeError("Buffer size must be a multiple of 32-bits");
546
+ for (var t = 0; t < e; t += 4) f(this, t, t + 3), f(this, t + 1, t + 2);
547
+ return this;
548
+ }, i.prototype.swap64 = function() {
549
+ var e = this.length;
550
+ if (e % 8 != 0) throw new RangeError("Buffer size must be a multiple of 64-bits");
551
+ for (var t = 0; t < e; t += 8) f(this, t, t + 7), f(this, t + 1, t + 6), f(this, t + 2, t + 5), f(this, t + 3, t + 4);
552
+ return this;
553
+ }, i.prototype.toString = function() {
554
+ var e = this.length;
555
+ return e === 0 ? "" : arguments.length === 0 ? Z(this, 0, e) : k.apply(this, arguments);
556
+ }, i.prototype.toLocaleString = i.prototype.toString, i.prototype.equals = function(e) {
557
+ if (!i.isBuffer(e)) throw new TypeError("Argument must be a Buffer");
558
+ return this === e || i.compare(this, e) === 0;
559
+ }, i.prototype.inspect = function() {
560
+ var e = "", t = _.INSPECT_MAX_BYTES;
561
+ return e = this.toString("hex", 0, t).replace(/(.{2})/g, "$1 ").trim(), this.length > t && (e += " ... "), "<Buffer " + e + ">";
562
+ }, i.prototype.compare = function(e, t, r, u, E) {
563
+ if (A(e, Uint8Array) && (e = i.from(e, e.offset, e.byteLength)), !i.isBuffer(e)) throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof e);
564
+ if (t === void 0 && (t = 0), r === void 0 && (r = e ? e.length : 0), u === void 0 && (u = 0), E === void 0 && (E = this.length), 0 > t || r > e.length || 0 > u || E > this.length) throw new RangeError("out of range index");
565
+ if (u >= E && t >= r) return 0;
566
+ if (u >= E) return -1;
567
+ if (t >= r) return 1;
568
+ if (t >>>= 0, r >>>= 0, u >>>= 0, E >>>= 0, this === e) return 0;
569
+ for (var N = E - u, q = r - t, G = S(N, q), $ = this.slice(u, E), Y = e.slice(t, r), X = 0; X < G; ++X) if ($[X] !== Y[X]) {
570
+ N = $[X], q = Y[X];
571
+ break;
572
+ }
573
+ return N < q ? -1 : q < N ? 1 : 0;
574
+ }, i.prototype.includes = function(e, t, r) {
575
+ return this.indexOf(e, t, r) !== -1;
576
+ }, i.prototype.indexOf = function(e, t, r) {
577
+ return T(this, e, t, r, !0);
578
+ }, i.prototype.lastIndexOf = function(e, t, r) {
579
+ return T(this, e, t, r, !1);
580
+ }, i.prototype.write = function(e, t, r, u) {
581
+ if (t === void 0) u = "utf8", r = this.length, t = 0;
582
+ else if (r === void 0 && typeof t == "string") u = t, r = this.length, t = 0;
583
+ else if (isFinite(t)) t >>>= 0, isFinite(r) ? (r >>>= 0, u === void 0 && (u = "utf8")) : (u = r, r = void 0);
584
+ else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
585
+ var E = this.length - t;
586
+ if ((r === void 0 || r > E) && (r = E), 0 < e.length && (0 > r || 0 > t) || t > this.length) throw new RangeError("Attempt to write outside buffer bounds");
587
+ u || (u = "utf8");
588
+ for (var N = !1; ; ) switch (u) {
589
+ case "hex":
590
+ return p(this, e, t, r);
591
+ case "utf8":
592
+ case "utf-8":
593
+ return v(this, e, t, r);
594
+ case "ascii":
595
+ return I(this, e, t, r);
596
+ case "latin1":
597
+ case "binary":
598
+ return B(this, e, t, r);
599
+ case "base64":
600
+ return V(this, e, t, r);
601
+ case "ucs2":
602
+ case "ucs-2":
603
+ case "utf16le":
604
+ case "utf-16le":
605
+ return z(this, e, t, r);
606
+ default:
607
+ if (N) throw new TypeError("Unknown encoding: " + u);
608
+ u = ("" + u).toLowerCase(), N = !0;
609
+ }
610
+ }, i.prototype.toJSON = function() {
611
+ return {
612
+ type: "Buffer",
613
+ data: Array.prototype.slice.call(this._arr || this, 0)
614
+ };
615
+ }, i.prototype.slice = function(e, t) {
616
+ var r = this.length;
617
+ e = ~~e, t = t === void 0 ? r : ~~t, 0 > e ? (e += r, 0 > e && (e = 0)) : e > r && (e = r), 0 > t ? (t += r, 0 > t && (t = 0)) : t > r && (t = r), t < e && (t = e);
618
+ var u = this.subarray(e, t);
619
+ return u.__proto__ = i.prototype, u;
620
+ }, i.prototype.readUIntLE = function(e, t, r) {
621
+ e >>>= 0, t >>>= 0, r || J(e, t, this.length);
622
+ for (var u = this[e], E = 1, N = 0; ++N < t && (E *= 256); ) u += this[e + N] * E;
623
+ return u;
624
+ }, i.prototype.readUIntBE = function(e, t, r) {
625
+ e >>>= 0, t >>>= 0, r || J(e, t, this.length);
626
+ for (var u = this[e + --t], E = 1; 0 < t && (E *= 256); ) u += this[e + --t] * E;
627
+ return u;
628
+ }, i.prototype.readUInt8 = function(e, t) {
629
+ return e >>>= 0, t || J(e, 1, this.length), this[e];
630
+ }, i.prototype.readUInt16LE = function(e, t) {
631
+ return e >>>= 0, t || J(e, 2, this.length), this[e] | this[e + 1] << 8;
632
+ }, i.prototype.readUInt16BE = function(e, t) {
633
+ return e >>>= 0, t || J(e, 2, this.length), this[e] << 8 | this[e + 1];
634
+ }, i.prototype.readUInt32LE = function(e, t) {
635
+ return e >>>= 0, t || J(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + 16777216 * this[e + 3];
636
+ }, i.prototype.readUInt32BE = function(e, t) {
637
+ return e >>>= 0, t || J(e, 4, this.length), 16777216 * this[e] + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
638
+ }, i.prototype.readIntLE = function(e, t, r) {
639
+ e >>>= 0, t >>>= 0, r || J(e, t, this.length);
640
+ for (var u = this[e], E = 1, N = 0; ++N < t && (E *= 256); ) u += this[e + N] * E;
641
+ return E *= 128, u >= E && (u -= F(2, 8 * t)), u;
642
+ }, i.prototype.readIntBE = function(e, t, r) {
643
+ e >>>= 0, t >>>= 0, r || J(e, t, this.length);
644
+ for (var u = t, E = 1, N = this[e + --u]; 0 < u && (E *= 256); ) N += this[e + --u] * E;
645
+ return E *= 128, N >= E && (N -= F(2, 8 * t)), N;
646
+ }, i.prototype.readInt8 = function(e, t) {
647
+ return e >>>= 0, t || J(e, 1, this.length), 128 & this[e] ? -1 * (255 - this[e] + 1) : this[e];
648
+ }, i.prototype.readInt16LE = function(e, t) {
649
+ e >>>= 0, t || J(e, 2, this.length);
650
+ var r = this[e] | this[e + 1] << 8;
651
+ return 32768 & r ? 4294901760 | r : r;
652
+ }, i.prototype.readInt16BE = function(e, t) {
653
+ e >>>= 0, t || J(e, 2, this.length);
654
+ var r = this[e + 1] | this[e] << 8;
655
+ return 32768 & r ? 4294901760 | r : r;
656
+ }, i.prototype.readInt32LE = function(e, t) {
657
+ return e >>>= 0, t || J(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
658
+ }, i.prototype.readInt32BE = function(e, t) {
659
+ return e >>>= 0, t || J(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
660
+ }, i.prototype.readFloatLE = function(e, t) {
661
+ return e >>>= 0, t || J(e, 4, this.length), s.read(this, e, !0, 23, 4);
662
+ }, i.prototype.readFloatBE = function(e, t) {
663
+ return e >>>= 0, t || J(e, 4, this.length), s.read(this, e, !1, 23, 4);
664
+ }, i.prototype.readDoubleLE = function(e, t) {
665
+ return e >>>= 0, t || J(e, 8, this.length), s.read(this, e, !0, 52, 8);
666
+ }, i.prototype.readDoubleBE = function(e, t) {
667
+ return e >>>= 0, t || J(e, 8, this.length), s.read(this, e, !1, 52, 8);
668
+ }, i.prototype.writeUIntLE = function(e, t, r, u) {
669
+ if (e = +e, t >>>= 0, r >>>= 0, !u) {
670
+ var E = F(2, 8 * r) - 1;
671
+ Q(this, e, t, r, E, 0);
672
+ }
673
+ var N = 1, q = 0;
674
+ for (this[t] = 255 & e; ++q < r && (N *= 256); ) this[t + q] = 255 & e / N;
675
+ return t + r;
676
+ }, i.prototype.writeUIntBE = function(e, t, r, u) {
677
+ if (e = +e, t >>>= 0, r >>>= 0, !u) {
678
+ var E = F(2, 8 * r) - 1;
679
+ Q(this, e, t, r, E, 0);
680
+ }
681
+ var N = r - 1, q = 1;
682
+ for (this[t + N] = 255 & e; 0 <= --N && (q *= 256); ) this[t + N] = 255 & e / q;
683
+ return t + r;
684
+ }, i.prototype.writeUInt8 = function(e, t, r) {
685
+ return e = +e, t >>>= 0, r || Q(this, e, t, 1, 255, 0), this[t] = 255 & e, t + 1;
686
+ }, i.prototype.writeUInt16LE = function(e, t, r) {
687
+ return e = +e, t >>>= 0, r || Q(this, e, t, 2, 65535, 0), this[t] = 255 & e, this[t + 1] = e >>> 8, t + 2;
688
+ }, i.prototype.writeUInt16BE = function(e, t, r) {
689
+ return e = +e, t >>>= 0, r || Q(this, e, t, 2, 65535, 0), this[t] = e >>> 8, this[t + 1] = 255 & e, t + 2;
690
+ }, i.prototype.writeUInt32LE = function(e, t, r) {
691
+ return e = +e, t >>>= 0, r || Q(this, e, t, 4, 4294967295, 0), this[t + 3] = e >>> 24, this[t + 2] = e >>> 16, this[t + 1] = e >>> 8, this[t] = 255 & e, t + 4;
692
+ }, i.prototype.writeUInt32BE = function(e, t, r) {
693
+ return e = +e, t >>>= 0, r || Q(this, e, t, 4, 4294967295, 0), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = 255 & e, t + 4;
694
+ }, i.prototype.writeIntLE = function(e, t, r, u) {
695
+ if (e = +e, t >>>= 0, !u) {
696
+ var E = F(2, 8 * r - 1);
697
+ Q(this, e, t, r, E - 1, -E);
698
+ }
699
+ var N = 0, q = 1, G = 0;
700
+ for (this[t] = 255 & e; ++N < r && (q *= 256); ) 0 > e && G === 0 && this[t + N - 1] !== 0 && (G = 1), this[t + N] = 255 & (e / q >> 0) - G;
701
+ return t + r;
702
+ }, i.prototype.writeIntBE = function(e, t, r, u) {
703
+ if (e = +e, t >>>= 0, !u) {
704
+ var E = F(2, 8 * r - 1);
705
+ Q(this, e, t, r, E - 1, -E);
706
+ }
707
+ var N = r - 1, q = 1, G = 0;
708
+ for (this[t + N] = 255 & e; 0 <= --N && (q *= 256); ) 0 > e && G === 0 && this[t + N + 1] !== 0 && (G = 1), this[t + N] = 255 & (e / q >> 0) - G;
709
+ return t + r;
710
+ }, i.prototype.writeInt8 = function(e, t, r) {
711
+ return e = +e, t >>>= 0, r || Q(this, e, t, 1, 127, -128), 0 > e && (e = 255 + e + 1), this[t] = 255 & e, t + 1;
712
+ }, i.prototype.writeInt16LE = function(e, t, r) {
713
+ return e = +e, t >>>= 0, r || Q(this, e, t, 2, 32767, -32768), this[t] = 255 & e, this[t + 1] = e >>> 8, t + 2;
714
+ }, i.prototype.writeInt16BE = function(e, t, r) {
715
+ return e = +e, t >>>= 0, r || Q(this, e, t, 2, 32767, -32768), this[t] = e >>> 8, this[t + 1] = 255 & e, t + 2;
716
+ }, i.prototype.writeInt32LE = function(e, t, r) {
717
+ return e = +e, t >>>= 0, r || Q(this, e, t, 4, 2147483647, -2147483648), this[t] = 255 & e, this[t + 1] = e >>> 8, this[t + 2] = e >>> 16, this[t + 3] = e >>> 24, t + 4;
718
+ }, i.prototype.writeInt32BE = function(e, t, r) {
719
+ return e = +e, t >>>= 0, r || Q(this, e, t, 4, 2147483647, -2147483648), 0 > e && (e = 4294967295 + e + 1), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = 255 & e, t + 4;
720
+ }, i.prototype.writeFloatLE = function(e, t, r) {
721
+ return pe(this, e, t, !0, r);
722
+ }, i.prototype.writeFloatBE = function(e, t, r) {
723
+ return pe(this, e, t, !1, r);
724
+ }, i.prototype.writeDoubleLE = function(e, t, r) {
725
+ return ge(this, e, t, !0, r);
726
+ }, i.prototype.writeDoubleBE = function(e, t, r) {
727
+ return ge(this, e, t, !1, r);
728
+ }, i.prototype.copy = function(e, t, r, u) {
729
+ if (!i.isBuffer(e)) throw new TypeError("argument should be a Buffer");
730
+ if (r || (r = 0), u || u === 0 || (u = this.length), t >= e.length && (t = e.length), t || (t = 0), 0 < u && u < r && (u = r), u === r || e.length === 0 || this.length === 0) return 0;
731
+ if (0 > t) throw new RangeError("targetStart out of bounds");
732
+ if (0 > r || r >= this.length) throw new RangeError("Index out of range");
733
+ if (0 > u) throw new RangeError("sourceEnd out of bounds");
734
+ u > this.length && (u = this.length), e.length - t < u - r && (u = e.length - t + r);
735
+ var E = u - r;
736
+ if (this === e && typeof Uint8Array.prototype.copyWithin == "function") this.copyWithin(t, r, u);
737
+ else if (this === e && r < t && t < u) for (var N = E - 1; 0 <= N; --N) e[N + t] = this[N + r];
738
+ else Uint8Array.prototype.set.call(e, this.subarray(r, u), t);
739
+ return E;
740
+ }, i.prototype.fill = function(e, t, r, u) {
741
+ if (typeof e == "string") {
742
+ if (typeof t == "string" ? (u = t, t = 0, r = this.length) : typeof r == "string" && (u = r, r = this.length), u !== void 0 && typeof u != "string") throw new TypeError("encoding must be a string");
743
+ if (typeof u == "string" && !i.isEncoding(u)) throw new TypeError("Unknown encoding: " + u);
744
+ if (e.length === 1) {
745
+ var E = e.charCodeAt(0);
746
+ (u === "utf8" && 128 > E || u === "latin1") && (e = E);
747
+ }
748
+ } else typeof e == "number" && (e &= 255);
749
+ if (0 > t || this.length < t || this.length < r) throw new RangeError("Out of range index");
750
+ if (r <= t) return this;
751
+ t >>>= 0, r = r === void 0 ? this.length : r >>> 0, e || (e = 0);
752
+ var N;
753
+ if (typeof e == "number") for (N = t; N < r; ++N) this[N] = e;
754
+ else {
755
+ var q = i.isBuffer(e) ? e : i.from(e, u), G = q.length;
756
+ if (G === 0) throw new TypeError('The value "' + e + '" is invalid for argument "value"');
757
+ for (N = 0; N < r - t; ++N) this[N + t] = q[N % G];
758
+ }
759
+ return this;
760
+ };
761
+ var o = /[^+/0-9A-Za-z-_]/g;
762
+ }).call(this);
763
+ }).call(this, R("buffer").Buffer);
764
+ }, {
765
+ "base64-js": 1,
766
+ buffer: 3,
767
+ ieee754: 9
768
+ }],
769
+ 4: [function(R, M, _) {
770
+ (function(c) {
771
+ (function() {
772
+ function S() {
773
+ let i;
774
+ try {
775
+ i = _.storage.getItem("debug");
776
+ } catch {
777
+ }
778
+ return !i && typeof c < "u" && "env" in c && (i = c.env.DEBUG), i;
779
+ }
780
+ _.formatArgs = function(i) {
781
+ if (i[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + i[0] + (this.useColors ? "%c " : " ") + "+" + M.exports.humanize(this.diff), !this.useColors) return;
782
+ const l = "color: " + this.color;
783
+ i.splice(1, 0, l, "color: inherit");
784
+ let d = 0, a = 0;
785
+ i[0].replace(/%[a-zA-Z%]/g, (g) => {
786
+ g === "%%" || (d++, g === "%c" && (a = d));
787
+ }), i.splice(a, 0, l);
788
+ }, _.save = function(i) {
789
+ try {
790
+ i ? _.storage.setItem("debug", i) : _.storage.removeItem("debug");
791
+ } catch {
792
+ }
793
+ }, _.load = S, _.useColors = function() {
794
+ return !!(typeof window < "u" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) || !(typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) && (typeof document < "u" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window < "u" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && 31 <= parseInt(RegExp.$1, 10) || typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
795
+ }, _.storage = (function() {
796
+ try {
797
+ return localStorage;
798
+ } catch {
799
+ }
800
+ })(), _.destroy = /* @__PURE__ */ (() => {
801
+ let i = !1;
802
+ return () => {
803
+ i || (i = !0, console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."));
804
+ };
805
+ })(), _.colors = [
806
+ "#0000CC",
807
+ "#0000FF",
808
+ "#0033CC",
809
+ "#0033FF",
810
+ "#0066CC",
811
+ "#0066FF",
812
+ "#0099CC",
813
+ "#0099FF",
814
+ "#00CC00",
815
+ "#00CC33",
816
+ "#00CC66",
817
+ "#00CC99",
818
+ "#00CCCC",
819
+ "#00CCFF",
820
+ "#3300CC",
821
+ "#3300FF",
822
+ "#3333CC",
823
+ "#3333FF",
824
+ "#3366CC",
825
+ "#3366FF",
826
+ "#3399CC",
827
+ "#3399FF",
828
+ "#33CC00",
829
+ "#33CC33",
830
+ "#33CC66",
831
+ "#33CC99",
832
+ "#33CCCC",
833
+ "#33CCFF",
834
+ "#6600CC",
835
+ "#6600FF",
836
+ "#6633CC",
837
+ "#6633FF",
838
+ "#66CC00",
839
+ "#66CC33",
840
+ "#9900CC",
841
+ "#9900FF",
842
+ "#9933CC",
843
+ "#9933FF",
844
+ "#99CC00",
845
+ "#99CC33",
846
+ "#CC0000",
847
+ "#CC0033",
848
+ "#CC0066",
849
+ "#CC0099",
850
+ "#CC00CC",
851
+ "#CC00FF",
852
+ "#CC3300",
853
+ "#CC3333",
854
+ "#CC3366",
855
+ "#CC3399",
856
+ "#CC33CC",
857
+ "#CC33FF",
858
+ "#CC6600",
859
+ "#CC6633",
860
+ "#CC9900",
861
+ "#CC9933",
862
+ "#CCCC00",
863
+ "#CCCC33",
864
+ "#FF0000",
865
+ "#FF0033",
866
+ "#FF0066",
867
+ "#FF0099",
868
+ "#FF00CC",
869
+ "#FF00FF",
870
+ "#FF3300",
871
+ "#FF3333",
872
+ "#FF3366",
873
+ "#FF3399",
874
+ "#FF33CC",
875
+ "#FF33FF",
876
+ "#FF6600",
877
+ "#FF6633",
878
+ "#FF9900",
879
+ "#FF9933",
880
+ "#FFCC00",
881
+ "#FFCC33"
882
+ ], _.log = console.debug || console.log || (() => {
883
+ }), M.exports = R("./common")(_);
884
+ const { formatters: O } = M.exports;
885
+ O.j = function(i) {
886
+ try {
887
+ return JSON.stringify(i);
888
+ } catch (l) {
889
+ return "[UnexpectedJSONParseError]: " + l.message;
890
+ }
891
+ };
892
+ }).call(this);
893
+ }).call(this, R("_process"));
894
+ }, {
895
+ "./common": 5,
896
+ _process: 12
897
+ }],
898
+ 5: [function(R, M) {
899
+ M.exports = function(_) {
900
+ function c(i) {
901
+ function l(...g) {
902
+ if (!l.enabled) return;
903
+ const L = l, w = +/* @__PURE__ */ new Date();
904
+ L.diff = w - (d || w), L.prev = d, L.curr = w, d = w, g[0] = c.coerce(g[0]), typeof g[0] != "string" && g.unshift("%O");
905
+ let b = 0;
906
+ g[0] = g[0].replace(/%([a-zA-Z%])/g, (n, h) => {
907
+ if (n === "%%") return "%";
908
+ b++;
909
+ const y = c.formatters[h];
910
+ if (typeof y == "function") {
911
+ const k = g[b];
912
+ n = y.call(L, k), g.splice(b, 1), b--;
913
+ }
914
+ return n;
915
+ }), c.formatArgs.call(L, g), (L.log || c.log).apply(L, g);
916
+ }
917
+ let d, a = null;
918
+ return l.namespace = i, l.useColors = c.useColors(), l.color = c.selectColor(i), l.extend = S, l.destroy = c.destroy, Object.defineProperty(l, "enabled", {
919
+ enumerable: !0,
920
+ configurable: !1,
921
+ get: () => a === null ? c.enabled(i) : a,
922
+ set: (g) => {
923
+ a = g;
924
+ }
925
+ }), typeof c.init == "function" && c.init(l), l;
926
+ }
927
+ function S(i, l) {
928
+ const d = c(this.namespace + (typeof l > "u" ? ":" : l) + i);
929
+ return d.log = this.log, d;
930
+ }
931
+ function O(i) {
932
+ return i.toString().substring(2, i.toString().length - 2).replace(/\.\*\?$/, "*");
933
+ }
934
+ return c.debug = c, c.default = c, c.coerce = function(i) {
935
+ return i instanceof Error ? i.stack || i.message : i;
936
+ }, c.disable = function() {
937
+ const i = [...c.names.map(O), ...c.skips.map(O).map((l) => "-" + l)].join(",");
938
+ return c.enable(""), i;
939
+ }, c.enable = function(i) {
940
+ c.save(i), c.names = [], c.skips = [];
941
+ let l;
942
+ const d = (typeof i == "string" ? i : "").split(/[\s,]+/), a = d.length;
943
+ for (l = 0; l < a; l++) d[l] && (i = d[l].replace(/\*/g, ".*?"), i[0] === "-" ? c.skips.push(new RegExp("^" + i.substr(1) + "$")) : c.names.push(new RegExp("^" + i + "$")));
944
+ }, c.enabled = function(i) {
945
+ if (i[i.length - 1] === "*") return !0;
946
+ let l, d;
947
+ for (l = 0, d = c.skips.length; l < d; l++) if (c.skips[l].test(i)) return !1;
948
+ for (l = 0, d = c.names.length; l < d; l++) if (c.names[l].test(i)) return !0;
949
+ return !1;
950
+ }, c.humanize = R("ms"), c.destroy = function() {
951
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
952
+ }, Object.keys(_).forEach((i) => {
953
+ c[i] = _[i];
954
+ }), c.names = [], c.skips = [], c.formatters = {}, c.selectColor = function(i) {
955
+ let l = 0;
956
+ for (let d = 0; d < i.length; d++) l = (l << 5) - l + i.charCodeAt(d), l |= 0;
957
+ return c.colors[U(l) % c.colors.length];
958
+ }, c.enable(c.load()), c;
959
+ };
960
+ }, { ms: 11 }],
961
+ 6: [function(R, M) {
962
+ "use strict";
963
+ function _(c, S) {
964
+ for (const O in S) Object.defineProperty(c, O, {
965
+ value: S[O],
966
+ enumerable: !0,
967
+ configurable: !0
968
+ });
969
+ return c;
970
+ }
971
+ M.exports = function(c, S, O) {
972
+ if (!c || typeof c == "string") throw new TypeError("Please pass an Error to err-code");
973
+ O || (O = {}), typeof S == "object" && (O = S, S = ""), S && (O.code = S);
974
+ try {
975
+ return _(c, O);
976
+ } catch {
977
+ O.message = c.message, O.stack = c.stack;
978
+ const l = function() {
979
+ };
980
+ return l.prototype = Object.create(Object.getPrototypeOf(c)), _(new l(), O);
981
+ }
982
+ };
983
+ }, {}],
984
+ 7: [function(R, M) {
985
+ "use strict";
986
+ function _(p) {
987
+ console && console.warn && console.warn(p);
988
+ }
989
+ function c() {
990
+ c.init.call(this);
991
+ }
992
+ function S(p) {
993
+ if (typeof p != "function") throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof p);
994
+ }
995
+ function O(p) {
996
+ return p._maxListeners === void 0 ? c.defaultMaxListeners : p._maxListeners;
997
+ }
998
+ function i(p, v, I, B) {
999
+ var V, z, K;
1000
+ if (S(I), z = p._events, z === void 0 ? (z = p._events = /* @__PURE__ */ Object.create(null), p._eventsCount = 0) : (z.newListener !== void 0 && (p.emit("newListener", v, I.listener ? I.listener : I), z = p._events), K = z[v]), K === void 0) K = z[v] = I, ++p._eventsCount;
1001
+ else if (typeof K == "function" ? K = z[v] = B ? [I, K] : [K, I] : B ? K.unshift(I) : K.push(I), V = O(p), 0 < V && K.length > V && !K.warned) {
1002
+ K.warned = !0;
1003
+ var Z = /* @__PURE__ */ new Error("Possible EventEmitter memory leak detected. " + K.length + " " + (v + " listeners added. Use emitter.setMaxListeners() to increase limit"));
1004
+ Z.name = "MaxListenersExceededWarning", Z.emitter = p, Z.type = v, Z.count = K.length, _(Z);
1005
+ }
1006
+ return p;
1007
+ }
1008
+ function l() {
1009
+ if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
1010
+ }
1011
+ function d(p, v, I) {
1012
+ var B = {
1013
+ fired: !1,
1014
+ wrapFn: void 0,
1015
+ target: p,
1016
+ type: v,
1017
+ listener: I
1018
+ }, V = l.bind(B);
1019
+ return V.listener = I, B.wrapFn = V, V;
1020
+ }
1021
+ function a(p, v, I) {
1022
+ var B = p._events;
1023
+ if (B === void 0) return [];
1024
+ var V = B[v];
1025
+ return V === void 0 ? [] : typeof V == "function" ? I ? [V.listener || V] : [V] : I ? b(V) : L(V, V.length);
1026
+ }
1027
+ function g(p) {
1028
+ var v = this._events;
1029
+ if (v !== void 0) {
1030
+ var I = v[p];
1031
+ if (typeof I == "function") return 1;
1032
+ if (I !== void 0) return I.length;
1033
+ }
1034
+ return 0;
1035
+ }
1036
+ function L(p, v) {
1037
+ for (var I = Array(v), B = 0; B < v; ++B) I[B] = p[B];
1038
+ return I;
1039
+ }
1040
+ function w(p, v) {
1041
+ for (; v + 1 < p.length; v++) p[v] = p[v + 1];
1042
+ p.pop();
1043
+ }
1044
+ function b(p) {
1045
+ for (var v = Array(p.length), I = 0; I < v.length; ++I) v[I] = p[I].listener || p[I];
1046
+ return v;
1047
+ }
1048
+ function n(p, v, I) {
1049
+ typeof p.on == "function" && h(p, "error", v, I);
1050
+ }
1051
+ function h(p, v, I, B) {
1052
+ if (typeof p.on == "function") B.once ? p.once(v, I) : p.on(v, I);
1053
+ else if (typeof p.addEventListener == "function") p.addEventListener(v, function V(z) {
1054
+ B.once && p.removeEventListener(v, V), I(z);
1055
+ });
1056
+ else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof p);
1057
+ }
1058
+ var y, k = typeof Reflect == "object" ? Reflect : null, f = k && typeof k.apply == "function" ? k.apply : function(p, v, I) {
1059
+ return Function.prototype.apply.call(p, v, I);
1060
+ };
1061
+ y = k && typeof k.ownKeys == "function" ? k.ownKeys : Object.getOwnPropertySymbols ? function(p) {
1062
+ return Object.getOwnPropertyNames(p).concat(Object.getOwnPropertySymbols(p));
1063
+ } : function(p) {
1064
+ return Object.getOwnPropertyNames(p);
1065
+ };
1066
+ var T = Number.isNaN || function(p) {
1067
+ return p !== p;
1068
+ };
1069
+ M.exports = c, M.exports.once = function(p, v) {
1070
+ return new Promise(function(I, B) {
1071
+ function V(K) {
1072
+ p.removeListener(v, z), B(K);
1073
+ }
1074
+ function z() {
1075
+ typeof p.removeListener == "function" && p.removeListener("error", V), I([].slice.call(arguments));
1076
+ }
1077
+ h(p, v, z, { once: !0 }), v !== "error" && n(p, V, { once: !0 });
1078
+ });
1079
+ }, c.EventEmitter = c, c.prototype._events = void 0, c.prototype._eventsCount = 0, c.prototype._maxListeners = void 0;
1080
+ var P = 10;
1081
+ Object.defineProperty(c, "defaultMaxListeners", {
1082
+ enumerable: !0,
1083
+ get: function() {
1084
+ return P;
1085
+ },
1086
+ set: function(p) {
1087
+ if (typeof p != "number" || 0 > p || T(p)) throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + p + ".");
1088
+ P = p;
1089
+ }
1090
+ }), c.init = function() {
1091
+ (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
1092
+ }, c.prototype.setMaxListeners = function(p) {
1093
+ if (typeof p != "number" || 0 > p || T(p)) throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + p + ".");
1094
+ return this._maxListeners = p, this;
1095
+ }, c.prototype.getMaxListeners = function() {
1096
+ return O(this);
1097
+ }, c.prototype.emit = function(p) {
1098
+ for (var v = [], I = 1; I < arguments.length; I++) v.push(arguments[I]);
1099
+ var B = p === "error", V = this._events;
1100
+ if (V !== void 0) B = B && V.error === void 0;
1101
+ else if (!B) return !1;
1102
+ if (B) {
1103
+ var z;
1104
+ if (0 < v.length && (z = v[0]), z instanceof Error) throw z;
1105
+ var K = /* @__PURE__ */ new Error("Unhandled error." + (z ? " (" + z.message + ")" : ""));
1106
+ throw K.context = z, K;
1107
+ }
1108
+ var Z = V[p];
1109
+ if (Z === void 0) return !1;
1110
+ if (typeof Z == "function") f(Z, this, v);
1111
+ else for (var te = Z.length, H = L(Z, te), I = 0; I < te; ++I) f(H[I], this, v);
1112
+ return !0;
1113
+ }, c.prototype.addListener = function(p, v) {
1114
+ return i(this, p, v, !1);
1115
+ }, c.prototype.on = c.prototype.addListener, c.prototype.prependListener = function(p, v) {
1116
+ return i(this, p, v, !0);
1117
+ }, c.prototype.once = function(p, v) {
1118
+ return S(v), this.on(p, d(this, p, v)), this;
1119
+ }, c.prototype.prependOnceListener = function(p, v) {
1120
+ return S(v), this.prependListener(p, d(this, p, v)), this;
1121
+ }, c.prototype.removeListener = function(p, v) {
1122
+ var I, B, V, z, K;
1123
+ if (S(v), B = this._events, B === void 0) return this;
1124
+ if (I = B[p], I === void 0) return this;
1125
+ if (I === v || I.listener === v) --this._eventsCount == 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete B[p], B.removeListener && this.emit("removeListener", p, I.listener || v));
1126
+ else if (typeof I != "function") {
1127
+ for (V = -1, z = I.length - 1; 0 <= z; z--) if (I[z] === v || I[z].listener === v) {
1128
+ K = I[z].listener, V = z;
1129
+ break;
1130
+ }
1131
+ if (0 > V) return this;
1132
+ V === 0 ? I.shift() : w(I, V), I.length === 1 && (B[p] = I[0]), B.removeListener !== void 0 && this.emit("removeListener", p, K || v);
1133
+ }
1134
+ return this;
1135
+ }, c.prototype.off = c.prototype.removeListener, c.prototype.removeAllListeners = function(p) {
1136
+ var v, I, B;
1137
+ if (I = this._events, I === void 0) return this;
1138
+ if (I.removeListener === void 0) return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : I[p] !== void 0 && (--this._eventsCount == 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete I[p]), this;
1139
+ if (arguments.length === 0) {
1140
+ var V, z = Object.keys(I);
1141
+ for (B = 0; B < z.length; ++B) V = z[B], V !== "removeListener" && this.removeAllListeners(V);
1142
+ return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
1143
+ }
1144
+ if (v = I[p], typeof v == "function") this.removeListener(p, v);
1145
+ else if (v !== void 0) for (B = v.length - 1; 0 <= B; B--) this.removeListener(p, v[B]);
1146
+ return this;
1147
+ }, c.prototype.listeners = function(p) {
1148
+ return a(this, p, !0);
1149
+ }, c.prototype.rawListeners = function(p) {
1150
+ return a(this, p, !1);
1151
+ }, c.listenerCount = function(p, v) {
1152
+ return typeof p.listenerCount == "function" ? p.listenerCount(v) : g.call(p, v);
1153
+ }, c.prototype.listenerCount = g, c.prototype.eventNames = function() {
1154
+ return 0 < this._eventsCount ? y(this._events) : [];
1155
+ };
1156
+ }, {}],
1157
+ 8: [function(R, M) {
1158
+ M.exports = function() {
1159
+ if (typeof globalThis > "u") return null;
1160
+ var _ = {
1161
+ RTCPeerConnection: globalThis.RTCPeerConnection || globalThis.mozRTCPeerConnection || globalThis.webkitRTCPeerConnection,
1162
+ RTCSessionDescription: globalThis.RTCSessionDescription || globalThis.mozRTCSessionDescription || globalThis.webkitRTCSessionDescription,
1163
+ RTCIceCandidate: globalThis.RTCIceCandidate || globalThis.mozRTCIceCandidate || globalThis.webkitRTCIceCandidate
1164
+ };
1165
+ return _.RTCPeerConnection ? _ : null;
1166
+ };
1167
+ }, {}],
1168
+ 9: [function(R, M, _) {
1169
+ _.read = function(c, S, O, i, l) {
1170
+ var d, a, g = 8 * l - i - 1, L = (1 << g) - 1, w = L >> 1, b = -7, n = O ? l - 1 : 0, h = O ? -1 : 1, y = c[S + n];
1171
+ for (n += h, d = y & (1 << -b) - 1, y >>= -b, b += g; 0 < b; d = 256 * d + c[S + n], n += h, b -= 8) ;
1172
+ for (a = d & (1 << -b) - 1, d >>= -b, b += i; 0 < b; a = 256 * a + c[S + n], n += h, b -= 8) ;
1173
+ if (d === 0) d = 1 - w;
1174
+ else {
1175
+ if (d === L) return a ? NaN : (y ? -1 : 1) * (1 / 0);
1176
+ a += F(2, i), d -= w;
1177
+ }
1178
+ return (y ? -1 : 1) * a * F(2, d - i);
1179
+ }, _.write = function(c, S, O, i, l, d) {
1180
+ var a, g, L, w = Math.LN2, b = Math.log, n = 8 * d - l - 1, h = (1 << n) - 1, y = h >> 1, k = l === 23 ? F(2, -24) - F(2, -77) : 0, f = i ? 0 : d - 1, T = i ? 1 : -1, P = 0 > S || S === 0 && 0 > 1 / S ? 1 : 0;
1181
+ for (S = U(S), isNaN(S) || S === 1 / 0 ? (g = isNaN(S) ? 1 : 0, a = h) : (a = j(b(S) / w), 1 > S * (L = F(2, -a)) && (a--, L *= 2), S += 1 <= a + y ? k / L : k * F(2, 1 - y), 2 <= S * L && (a++, L /= 2), a + y >= h ? (g = 0, a = h) : 1 <= a + y ? (g = (S * L - 1) * F(2, l), a += y) : (g = S * F(2, y - 1) * F(2, l), a = 0)); 8 <= l; c[O + f] = 255 & g, f += T, g /= 256, l -= 8) ;
1182
+ for (a = a << l | g, n += l; 0 < n; c[O + f] = 255 & a, f += T, a /= 256, n -= 8) ;
1183
+ c[O + f - T] |= 128 * P;
1184
+ };
1185
+ }, {}],
1186
+ 10: [function(R, M) {
1187
+ M.exports = typeof Object.create == "function" ? function(_, c) {
1188
+ c && (_.super_ = c, _.prototype = Object.create(c.prototype, { constructor: {
1189
+ value: _,
1190
+ enumerable: !1,
1191
+ writable: !0,
1192
+ configurable: !0
1193
+ } }));
1194
+ } : function(_, c) {
1195
+ if (c) {
1196
+ _.super_ = c;
1197
+ var S = function() {
1198
+ };
1199
+ S.prototype = c.prototype, _.prototype = new S(), _.prototype.constructor = _;
1200
+ }
1201
+ };
1202
+ }, {}],
1203
+ 11: [function(R, M) {
1204
+ var _ = Math.round;
1205
+ function c(l) {
1206
+ if (l += "", !(100 < l.length)) {
1207
+ var d = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(l);
1208
+ if (d) {
1209
+ var a = parseFloat(d[1]), g = (d[2] || "ms").toLowerCase();
1210
+ return g === "years" || g === "year" || g === "yrs" || g === "yr" || g === "y" ? 315576e5 * a : g === "weeks" || g === "week" || g === "w" ? 6048e5 * a : g === "days" || g === "day" || g === "d" ? 864e5 * a : g === "hours" || g === "hour" || g === "hrs" || g === "hr" || g === "h" ? 36e5 * a : g === "minutes" || g === "minute" || g === "mins" || g === "min" || g === "m" ? 6e4 * a : g === "seconds" || g === "second" || g === "secs" || g === "sec" || g === "s" ? 1e3 * a : g === "milliseconds" || g === "millisecond" || g === "msecs" || g === "msec" || g === "ms" ? a : void 0;
1211
+ }
1212
+ }
1213
+ }
1214
+ function S(l) {
1215
+ var d = U(l);
1216
+ return 864e5 <= d ? _(l / 864e5) + "d" : 36e5 <= d ? _(l / 36e5) + "h" : 6e4 <= d ? _(l / 6e4) + "m" : 1e3 <= d ? _(l / 1e3) + "s" : l + "ms";
1217
+ }
1218
+ function O(l) {
1219
+ var d = U(l);
1220
+ return 864e5 <= d ? i(l, d, 864e5, "day") : 36e5 <= d ? i(l, d, 36e5, "hour") : 6e4 <= d ? i(l, d, 6e4, "minute") : 1e3 <= d ? i(l, d, 1e3, "second") : l + " ms";
1221
+ }
1222
+ function i(l, d, a, g) {
1223
+ return _(l / a) + " " + g + (d >= 1.5 * a ? "s" : "");
1224
+ }
1225
+ M.exports = function(l, d) {
1226
+ d = d || {};
1227
+ var a = typeof l;
1228
+ if (a == "string" && 0 < l.length) return c(l);
1229
+ if (a === "number" && isFinite(l)) return d.long ? O(l) : S(l);
1230
+ throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(l));
1231
+ };
1232
+ }, {}],
1233
+ 12: [function(R, M) {
1234
+ function _() {
1235
+ throw new Error("setTimeout has not been defined");
1236
+ }
1237
+ function c() {
1238
+ throw new Error("clearTimeout has not been defined");
1239
+ }
1240
+ function S(k) {
1241
+ if (g === setTimeout) return setTimeout(k, 0);
1242
+ if ((g === _ || !g) && setTimeout) return g = setTimeout, setTimeout(k, 0);
1243
+ try {
1244
+ return g(k, 0);
1245
+ } catch {
1246
+ try {
1247
+ return g.call(null, k, 0);
1248
+ } catch {
1249
+ return g.call(this, k, 0);
1250
+ }
1251
+ }
1252
+ }
1253
+ function O(k) {
1254
+ if (L === clearTimeout) return clearTimeout(k);
1255
+ if ((L === c || !L) && clearTimeout) return L = clearTimeout, clearTimeout(k);
1256
+ try {
1257
+ return L(k);
1258
+ } catch {
1259
+ try {
1260
+ return L.call(null, k);
1261
+ } catch {
1262
+ return L.call(this, k);
1263
+ }
1264
+ }
1265
+ }
1266
+ function i() {
1267
+ h && b && (h = !1, b.length ? n = b.concat(n) : y = -1, n.length && l());
1268
+ }
1269
+ function l() {
1270
+ if (!h) {
1271
+ var k = S(i);
1272
+ h = !0;
1273
+ for (var f = n.length; f; ) {
1274
+ for (b = n, n = []; ++y < f; ) b && b[y].run();
1275
+ y = -1, f = n.length;
1276
+ }
1277
+ b = null, h = !1, O(k);
1278
+ }
1279
+ }
1280
+ function d(k, f) {
1281
+ this.fun = k, this.array = f;
1282
+ }
1283
+ function a() {
1284
+ }
1285
+ var g, L, w = M.exports = {};
1286
+ (function() {
1287
+ try {
1288
+ g = typeof setTimeout == "function" ? setTimeout : _;
1289
+ } catch {
1290
+ g = _;
1291
+ }
1292
+ try {
1293
+ L = typeof clearTimeout == "function" ? clearTimeout : c;
1294
+ } catch {
1295
+ L = c;
1296
+ }
1297
+ })();
1298
+ var b, n = [], h = !1, y = -1;
1299
+ w.nextTick = function(k) {
1300
+ var f = Array(arguments.length - 1);
1301
+ if (1 < arguments.length) for (var T = 1; T < arguments.length; T++) f[T - 1] = arguments[T];
1302
+ n.push(new d(k, f)), n.length !== 1 || h || S(l);
1303
+ }, d.prototype.run = function() {
1304
+ this.fun.apply(null, this.array);
1305
+ }, w.title = "browser", w.browser = !0, w.env = {}, w.argv = [], w.version = "", w.versions = {}, w.on = a, w.addListener = a, w.once = a, w.off = a, w.removeListener = a, w.removeAllListeners = a, w.emit = a, w.prependListener = a, w.prependOnceListener = a, w.listeners = function() {
1306
+ return [];
1307
+ }, w.binding = function() {
1308
+ throw new Error("process.binding is not supported");
1309
+ }, w.cwd = function() {
1310
+ return "/";
1311
+ }, w.chdir = function() {
1312
+ throw new Error("process.chdir is not supported");
1313
+ }, w.umask = function() {
1314
+ return 0;
1315
+ };
1316
+ }, {}],
1317
+ 13: [function(R, M) {
1318
+ (function(_) {
1319
+ (function() {
1320
+ let c;
1321
+ M.exports = typeof queueMicrotask == "function" ? queueMicrotask.bind(typeof window > "u" ? _ : window) : (S) => (c || (c = Promise.resolve())).then(S).catch((O) => setTimeout(() => {
1322
+ throw O;
1323
+ }, 0));
1324
+ }).call(this);
1325
+ }).call(this, typeof global > "u" ? typeof self > "u" ? typeof window > "u" ? {} : window : self : global);
1326
+ }, {}],
1327
+ 14: [function(R, M) {
1328
+ (function(_, c) {
1329
+ (function() {
1330
+ "use strict";
1331
+ var S = R("safe-buffer").Buffer, O = c.crypto || c.msCrypto;
1332
+ M.exports = O && O.getRandomValues ? function(i, l) {
1333
+ if (i > 4294967295) throw new RangeError("requested too many random bytes");
1334
+ var d = S.allocUnsafe(i);
1335
+ if (0 < i) if (65536 < i) for (var a = 0; a < i; a += 65536) O.getRandomValues(d.slice(a, a + 65536));
1336
+ else O.getRandomValues(d);
1337
+ return typeof l == "function" ? _.nextTick(function() {
1338
+ l(null, d);
1339
+ }) : d;
1340
+ } : function() {
1341
+ throw new Error(`Secure random number generation is not supported by this browser.
1342
+ Use Chrome, Firefox or Internet Explorer 11`);
1343
+ };
1344
+ }).call(this);
1345
+ }).call(this, R("_process"), typeof global > "u" ? typeof self > "u" ? typeof window > "u" ? {} : window : self : global);
1346
+ }, {
1347
+ _process: 12,
1348
+ "safe-buffer": 30
1349
+ }],
1350
+ 15: [function(R, M) {
1351
+ "use strict";
1352
+ function _(a, g) {
1353
+ a.prototype = Object.create(g.prototype), a.prototype.constructor = a, a.__proto__ = g;
1354
+ }
1355
+ function c(a, g, L) {
1356
+ function w(n, h, y) {
1357
+ return typeof g == "string" ? g : g(n, h, y);
1358
+ }
1359
+ L || (L = Error);
1360
+ var b = (function(n) {
1361
+ function h(y, k, f) {
1362
+ return n.call(this, w(y, k, f)) || this;
1363
+ }
1364
+ return _(h, n), h;
1365
+ })(L);
1366
+ b.prototype.name = L.name, b.prototype.code = a, d[a] = b;
1367
+ }
1368
+ function S(a, g) {
1369
+ if (Array.isArray(a)) {
1370
+ var L = a.length;
1371
+ return a = a.map(function(w) {
1372
+ return w + "";
1373
+ }), 2 < L ? "one of ".concat(g, " ").concat(a.slice(0, L - 1).join(", "), ", or ") + a[L - 1] : L === 2 ? "one of ".concat(g, " ").concat(a[0], " or ").concat(a[1]) : "of ".concat(g, " ").concat(a[0]);
1374
+ }
1375
+ return "of ".concat(g, " ").concat(a + "");
1376
+ }
1377
+ function O(a, g, L) {
1378
+ return a.substr(!L || 0 > L ? 0 : +L, g.length) === g;
1379
+ }
1380
+ function i(a, g, L) {
1381
+ return (L === void 0 || L > a.length) && (L = a.length), a.substring(L - g.length, L) === g;
1382
+ }
1383
+ function l(a, g, L) {
1384
+ return typeof L != "number" && (L = 0), !(L + g.length > a.length) && a.indexOf(g, L) !== -1;
1385
+ }
1386
+ var d = {};
1387
+ c("ERR_INVALID_OPT_VALUE", function(a, g) {
1388
+ return 'The value "' + g + '" is invalid for option "' + a + '"';
1389
+ }, TypeError), c("ERR_INVALID_ARG_TYPE", function(a, g, L) {
1390
+ var w;
1391
+ typeof g == "string" && O(g, "not ") ? (w = "must not be", g = g.replace(/^not /, "")) : w = "must be";
1392
+ var b;
1393
+ if (i(a, " argument")) b = "The ".concat(a, " ").concat(w, " ").concat(S(g, "type"));
1394
+ else {
1395
+ var n = l(a, ".") ? "property" : "argument";
1396
+ b = 'The "'.concat(a, '" ').concat(n, " ").concat(w, " ").concat(S(g, "type"));
1397
+ }
1398
+ return b += ". Received type ".concat(typeof L), b;
1399
+ }, TypeError), c("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF"), c("ERR_METHOD_NOT_IMPLEMENTED", function(a) {
1400
+ return "The " + a + " method is not implemented";
1401
+ }), c("ERR_STREAM_PREMATURE_CLOSE", "Premature close"), c("ERR_STREAM_DESTROYED", function(a) {
1402
+ return "Cannot call " + a + " after a stream was destroyed";
1403
+ }), c("ERR_MULTIPLE_CALLBACK", "Callback called multiple times"), c("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable"), c("ERR_STREAM_WRITE_AFTER_END", "write after end"), c("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError), c("ERR_UNKNOWN_ENCODING", function(a) {
1404
+ return "Unknown encoding: " + a;
1405
+ }, TypeError), c("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event"), M.exports.codes = d;
1406
+ }, {}],
1407
+ 16: [function(R, M) {
1408
+ (function(_) {
1409
+ (function() {
1410
+ "use strict";
1411
+ function c(w) {
1412
+ return this instanceof c ? (l.call(this, w), d.call(this, w), this.allowHalfOpen = !0, void (w && (w.readable === !1 && (this.readable = !1), w.writable === !1 && (this.writable = !1), w.allowHalfOpen === !1 && (this.allowHalfOpen = !1, this.once("end", S))))) : new c(w);
1413
+ }
1414
+ function S() {
1415
+ this._writableState.ended || _.nextTick(O, this);
1416
+ }
1417
+ function O(w) {
1418
+ w.end();
1419
+ }
1420
+ var i = Object.keys || function(w) {
1421
+ var b = [];
1422
+ for (var n in w) b.push(n);
1423
+ return b;
1424
+ };
1425
+ M.exports = c;
1426
+ var l = R("./_stream_readable"), d = R("./_stream_writable");
1427
+ R("inherits")(c, l);
1428
+ for (var a, g = i(d.prototype), L = 0; L < g.length; L++) a = g[L], c.prototype[a] || (c.prototype[a] = d.prototype[a]);
1429
+ Object.defineProperty(c.prototype, "writableHighWaterMark", {
1430
+ enumerable: !1,
1431
+ get: function() {
1432
+ return this._writableState.highWaterMark;
1433
+ }
1434
+ }), Object.defineProperty(c.prototype, "writableBuffer", {
1435
+ enumerable: !1,
1436
+ get: function() {
1437
+ return this._writableState && this._writableState.getBuffer();
1438
+ }
1439
+ }), Object.defineProperty(c.prototype, "writableLength", {
1440
+ enumerable: !1,
1441
+ get: function() {
1442
+ return this._writableState.length;
1443
+ }
1444
+ }), Object.defineProperty(c.prototype, "destroyed", {
1445
+ enumerable: !1,
1446
+ get: function() {
1447
+ return this._readableState !== void 0 && this._writableState !== void 0 && this._readableState.destroyed && this._writableState.destroyed;
1448
+ },
1449
+ set: function(w) {
1450
+ this._readableState === void 0 || this._writableState === void 0 || (this._readableState.destroyed = w, this._writableState.destroyed = w);
1451
+ }
1452
+ });
1453
+ }).call(this);
1454
+ }).call(this, R("_process"));
1455
+ }, {
1456
+ "./_stream_readable": 18,
1457
+ "./_stream_writable": 20,
1458
+ _process: 12,
1459
+ inherits: 10
1460
+ }],
1461
+ 17: [function(R, M) {
1462
+ "use strict";
1463
+ function _(S) {
1464
+ return this instanceof _ ? void c.call(this, S) : new _(S);
1465
+ }
1466
+ M.exports = _;
1467
+ var c = R("./_stream_transform");
1468
+ R("inherits")(_, c), _.prototype._transform = function(S, O, i) {
1469
+ i(null, S);
1470
+ };
1471
+ }, {
1472
+ "./_stream_transform": 19,
1473
+ inherits: 10
1474
+ }],
1475
+ 18: [function(R, M) {
1476
+ (function(_, c) {
1477
+ (function() {
1478
+ "use strict";
1479
+ function S(s) {
1480
+ return de.from(s);
1481
+ }
1482
+ function O(s) {
1483
+ return de.isBuffer(s) || s instanceof J;
1484
+ }
1485
+ function i(s, o, e) {
1486
+ return typeof s.prependListener == "function" ? s.prependListener(o, e) : void (s._events && s._events[o] ? Array.isArray(s._events[o]) ? s._events[o].unshift(e) : s._events[o] = [e, s._events[o]] : s.on(o, e));
1487
+ }
1488
+ function l(s, o, e) {
1489
+ te = te || R("./_stream_duplex"), s = s || {}, typeof e != "boolean" && (e = o instanceof te), this.objectMode = !!s.objectMode, e && (this.objectMode = this.objectMode || !!s.readableObjectMode), this.highWaterMark = _e(this, s, "readableHighWaterMark", e), this.buffer = new Se(), this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this.reading = !1, this.sync = !0, this.needReadable = !1, this.emittedReadable = !1, this.readableListening = !1, this.resumeScheduled = !1, this.paused = !0, this.emitClose = s.emitClose !== !1, this.autoDestroy = !!s.autoDestroy, this.destroyed = !1, this.defaultEncoding = s.defaultEncoding || "utf8", this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this.encoding = null, s.encoding && (!ae && (ae = R("string_decoder/").StringDecoder), this.decoder = new ae(s.encoding), this.encoding = s.encoding);
1490
+ }
1491
+ function d(s) {
1492
+ if (te = te || R("./_stream_duplex"), !(this instanceof d)) return new d(s);
1493
+ var o = this instanceof te;
1494
+ this._readableState = new l(s, this, o), this.readable = !0, s && (typeof s.read == "function" && (this._read = s.read), typeof s.destroy == "function" && (this._destroy = s.destroy)), oe.call(this);
1495
+ }
1496
+ function a(s, o, e, t, r) {
1497
+ H("readableAddChunk", o);
1498
+ var u = s._readableState;
1499
+ if (o === null) u.reading = !1, n(s, u);
1500
+ else {
1501
+ var E;
1502
+ if (r || (E = L(u, o)), E) D(s, E);
1503
+ else if (!(u.objectMode || o && 0 < o.length)) t || (u.reading = !1, k(s, u));
1504
+ else if (typeof o == "string" || u.objectMode || Object.getPrototypeOf(o) === de.prototype || (o = S(o)), t) u.endEmitted ? D(s, new A()) : g(s, u, o, !0);
1505
+ else if (u.ended) D(s, new le());
1506
+ else {
1507
+ if (u.destroyed) return !1;
1508
+ u.reading = !1, u.decoder && !e ? (o = u.decoder.write(o), u.objectMode || o.length !== 0 ? g(s, u, o, !1) : k(s, u)) : g(s, u, o, !1);
1509
+ }
1510
+ }
1511
+ return !u.ended && (u.length < u.highWaterMark || u.length === 0);
1512
+ }
1513
+ function g(s, o, e, t) {
1514
+ o.flowing && o.length === 0 && !o.sync ? (o.awaitDrain = 0, s.emit("data", e)) : (o.length += o.objectMode ? 1 : e.length, t ? o.buffer.unshift(e) : o.buffer.push(e), o.needReadable && h(s)), k(s, o);
1515
+ }
1516
+ function L(s, o) {
1517
+ var e;
1518
+ return O(o) || typeof o == "string" || o === void 0 || s.objectMode || (e = new ce("chunk", [
1519
+ "string",
1520
+ "Buffer",
1521
+ "Uint8Array"
1522
+ ], o)), e;
1523
+ }
1524
+ function w(s) {
1525
+ return 1073741824 <= s ? s = 1073741824 : (s--, s |= s >>> 1, s |= s >>> 2, s |= s >>> 4, s |= s >>> 8, s |= s >>> 16, s++), s;
1526
+ }
1527
+ function b(s, o) {
1528
+ return 0 >= s || o.length === 0 && o.ended ? 0 : o.objectMode ? 1 : s === s ? (s > o.highWaterMark && (o.highWaterMark = w(s)), s <= o.length ? s : o.ended ? o.length : (o.needReadable = !0, 0)) : o.flowing && o.length ? o.buffer.head.data.length : o.length;
1529
+ }
1530
+ function n(s, o) {
1531
+ if (H("onEofChunk"), !o.ended) {
1532
+ if (o.decoder) {
1533
+ var e = o.decoder.end();
1534
+ e && e.length && (o.buffer.push(e), o.length += o.objectMode ? 1 : e.length);
1535
+ }
1536
+ o.ended = !0, o.sync ? h(s) : (o.needReadable = !1, !o.emittedReadable && (o.emittedReadable = !0, y(s)));
1537
+ }
1538
+ }
1539
+ function h(s) {
1540
+ var o = s._readableState;
1541
+ H("emitReadable", o.needReadable, o.emittedReadable), o.needReadable = !1, o.emittedReadable || (H("emitReadable", o.flowing), o.emittedReadable = !0, _.nextTick(y, s));
1542
+ }
1543
+ function y(s) {
1544
+ var o = s._readableState;
1545
+ H("emitReadable_", o.destroyed, o.length, o.ended), !o.destroyed && (o.length || o.ended) && (s.emit("readable"), o.emittedReadable = !1), o.needReadable = !o.flowing && !o.ended && o.length <= o.highWaterMark, B(s);
1546
+ }
1547
+ function k(s, o) {
1548
+ o.readingMore || (o.readingMore = !0, _.nextTick(f, s, o));
1549
+ }
1550
+ function f(s, o) {
1551
+ for (; !o.reading && !o.ended && (o.length < o.highWaterMark || o.flowing && o.length === 0); ) {
1552
+ var e = o.length;
1553
+ if (H("maybeReadMore read 0"), s.read(0), e === o.length) break;
1554
+ }
1555
+ o.readingMore = !1;
1556
+ }
1557
+ function T(s) {
1558
+ return function() {
1559
+ var o = s._readableState;
1560
+ H("pipeOnDrain", o.awaitDrain), o.awaitDrain && o.awaitDrain--, o.awaitDrain === 0 && Ee(s, "data") && (o.flowing = !0, B(s));
1561
+ };
1562
+ }
1563
+ function P(s) {
1564
+ var o = s._readableState;
1565
+ o.readableListening = 0 < s.listenerCount("readable"), o.resumeScheduled && !o.paused ? o.flowing = !0 : 0 < s.listenerCount("data") && s.resume();
1566
+ }
1567
+ function p(s) {
1568
+ H("readable nexttick read 0"), s.read(0);
1569
+ }
1570
+ function v(s, o) {
1571
+ o.resumeScheduled || (o.resumeScheduled = !0, _.nextTick(I, s, o));
1572
+ }
1573
+ function I(s, o) {
1574
+ H("resume", o.reading), o.reading || s.read(0), o.resumeScheduled = !1, s.emit("resume"), B(s), o.flowing && !o.reading && s.read(0);
1575
+ }
1576
+ function B(s) {
1577
+ var o = s._readableState;
1578
+ for (H("flow", o.flowing); o.flowing && s.read() !== null; ) ;
1579
+ }
1580
+ function V(s, o) {
1581
+ if (o.length === 0) return null;
1582
+ var e;
1583
+ return o.objectMode ? e = o.buffer.shift() : !s || s >= o.length ? (e = o.decoder ? o.buffer.join("") : o.buffer.length === 1 ? o.buffer.first() : o.buffer.concat(o.length), o.buffer.clear()) : e = o.buffer.consume(s, o.decoder), e;
1584
+ }
1585
+ function z(s) {
1586
+ var o = s._readableState;
1587
+ H("endReadable", o.endEmitted), o.endEmitted || (o.ended = !0, _.nextTick(K, o, s));
1588
+ }
1589
+ function K(s, o) {
1590
+ if (H("endReadableNT", s.endEmitted, s.length), !s.endEmitted && s.length === 0 && (s.endEmitted = !0, o.readable = !1, o.emit("end"), s.autoDestroy)) {
1591
+ var e = o._writableState;
1592
+ (!e || e.autoDestroy && e.finished) && o.destroy();
1593
+ }
1594
+ }
1595
+ function Z(s, o) {
1596
+ for (var e = 0, t = s.length; e < t; e++) if (s[e] === o) return e;
1597
+ return -1;
1598
+ }
1599
+ M.exports = d;
1600
+ var te;
1601
+ d.ReadableState = l;
1602
+ var H;
1603
+ R("events").EventEmitter;
1604
+ var Ee = function(s, o) {
1605
+ return s.listeners(o).length;
1606
+ }, oe = R("./internal/streams/stream"), de = R("buffer").Buffer, J = c.Uint8Array || function() {
1607
+ }, Q = R("util");
1608
+ H = Q && Q.debuglog ? Q.debuglog("stream") : function() {
1609
+ };
1610
+ var ae, pe, ge, Se = R("./internal/streams/buffer_list"), me = R("./internal/streams/destroy"), _e = R("./internal/streams/state").getHighWaterMark, ye = R("../errors").codes, ce = ye.ERR_INVALID_ARG_TYPE, le = ye.ERR_STREAM_PUSH_AFTER_EOF, C = ye.ERR_METHOD_NOT_IMPLEMENTED, A = ye.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
1611
+ R("inherits")(d, oe);
1612
+ var D = me.errorOrDestroy, W = [
1613
+ "error",
1614
+ "close",
1615
+ "destroy",
1616
+ "pause",
1617
+ "resume"
1618
+ ];
1619
+ Object.defineProperty(d.prototype, "destroyed", {
1620
+ enumerable: !1,
1621
+ get: function() {
1622
+ return this._readableState !== void 0 && this._readableState.destroyed;
1623
+ },
1624
+ set: function(s) {
1625
+ this._readableState && (this._readableState.destroyed = s);
1626
+ }
1627
+ }), d.prototype.destroy = me.destroy, d.prototype._undestroy = me.undestroy, d.prototype._destroy = function(s, o) {
1628
+ o(s);
1629
+ }, d.prototype.push = function(s, o) {
1630
+ var e, t = this._readableState;
1631
+ return t.objectMode ? e = !0 : typeof s == "string" && (o = o || t.defaultEncoding, o !== t.encoding && (s = de.from(s, o), o = ""), e = !0), a(this, s, o, !1, e);
1632
+ }, d.prototype.unshift = function(s) {
1633
+ return a(this, s, null, !0, !1);
1634
+ }, d.prototype.isPaused = function() {
1635
+ return this._readableState.flowing === !1;
1636
+ }, d.prototype.setEncoding = function(s) {
1637
+ ae || (ae = R("string_decoder/").StringDecoder);
1638
+ var o = new ae(s);
1639
+ this._readableState.decoder = o, this._readableState.encoding = this._readableState.decoder.encoding;
1640
+ for (var e = this._readableState.buffer.head, t = ""; e !== null; ) t += o.write(e.data), e = e.next;
1641
+ return this._readableState.buffer.clear(), t !== "" && this._readableState.buffer.push(t), this._readableState.length = t.length, this;
1642
+ }, d.prototype.read = function(s) {
1643
+ H("read", s), s = parseInt(s, 10);
1644
+ var o = this._readableState, e = s;
1645
+ if (s !== 0 && (o.emittedReadable = !1), s === 0 && o.needReadable && ((o.highWaterMark === 0 ? 0 < o.length : o.length >= o.highWaterMark) || o.ended)) return H("read: emitReadable", o.length, o.ended), o.length === 0 && o.ended ? z(this) : h(this), null;
1646
+ if (s = b(s, o), s === 0 && o.ended) return o.length === 0 && z(this), null;
1647
+ var t = o.needReadable;
1648
+ H("need readable", t), (o.length === 0 || o.length - s < o.highWaterMark) && (t = !0, H("length less than watermark", t)), o.ended || o.reading ? (t = !1, H("reading or ended", t)) : t && (H("do read"), o.reading = !0, o.sync = !0, o.length === 0 && (o.needReadable = !0), this._read(o.highWaterMark), o.sync = !1, !o.reading && (s = b(e, o)));
1649
+ var r;
1650
+ return r = 0 < s ? V(s, o) : null, r === null ? (o.needReadable = o.length <= o.highWaterMark, s = 0) : (o.length -= s, o.awaitDrain = 0), o.length === 0 && (!o.ended && (o.needReadable = !0), e !== s && o.ended && z(this)), r !== null && this.emit("data", r), r;
1651
+ }, d.prototype._read = function() {
1652
+ D(this, new C("_read()"));
1653
+ }, d.prototype.pipe = function(s, o) {
1654
+ function e(he, fe) {
1655
+ H("onunpipe"), he === $ && fe && fe.hasUnpiped === !1 && (fe.hasUnpiped = !0, r());
1656
+ }
1657
+ function t() {
1658
+ H("onend"), s.end();
1659
+ }
1660
+ function r() {
1661
+ H("cleanup"), s.removeListener("close", N), s.removeListener("finish", q), s.removeListener("drain", ee), s.removeListener("error", E), s.removeListener("unpipe", e), $.removeListener("end", t), $.removeListener("end", G), $.removeListener("data", u), ve = !0, Y.awaitDrain && (!s._writableState || s._writableState.needDrain) && ee();
1662
+ }
1663
+ function u(he) {
1664
+ H("ondata");
1665
+ var fe = s.write(he);
1666
+ H("dest.write", fe), fe === !1 && ((Y.pipesCount === 1 && Y.pipes === s || 1 < Y.pipesCount && Z(Y.pipes, s) !== -1) && !ve && (H("false write response, pause", Y.awaitDrain), Y.awaitDrain++), $.pause());
1667
+ }
1668
+ function E(he) {
1669
+ H("onerror", he), G(), s.removeListener("error", E), Ee(s, "error") === 0 && D(s, he);
1670
+ }
1671
+ function N() {
1672
+ s.removeListener("finish", q), G();
1673
+ }
1674
+ function q() {
1675
+ H("onfinish"), s.removeListener("close", N), G();
1676
+ }
1677
+ function G() {
1678
+ H("unpipe"), $.unpipe(s);
1679
+ }
1680
+ var $ = this, Y = this._readableState;
1681
+ switch (Y.pipesCount) {
1682
+ case 0:
1683
+ Y.pipes = s;
1684
+ break;
1685
+ case 1:
1686
+ Y.pipes = [Y.pipes, s];
1687
+ break;
1688
+ default:
1689
+ Y.pipes.push(s);
1690
+ }
1691
+ Y.pipesCount += 1, H("pipe count=%d opts=%j", Y.pipesCount, o);
1692
+ var X = (!o || o.end !== !1) && s !== _.stdout && s !== _.stderr ? t : G;
1693
+ Y.endEmitted ? _.nextTick(X) : $.once("end", X), s.on("unpipe", e);
1694
+ var ee = T($);
1695
+ s.on("drain", ee);
1696
+ var ve = !1;
1697
+ return $.on("data", u), i(s, "error", E), s.once("close", N), s.once("finish", q), s.emit("pipe", $), Y.flowing || (H("pipe resume"), $.resume()), s;
1698
+ }, d.prototype.unpipe = function(s) {
1699
+ var o = this._readableState, e = { hasUnpiped: !1 };
1700
+ if (o.pipesCount === 0) return this;
1701
+ if (o.pipesCount === 1) return s && s !== o.pipes ? this : (s || (s = o.pipes), o.pipes = null, o.pipesCount = 0, o.flowing = !1, s && s.emit("unpipe", this, e), this);
1702
+ if (!s) {
1703
+ var t = o.pipes, r = o.pipesCount;
1704
+ o.pipes = null, o.pipesCount = 0, o.flowing = !1;
1705
+ for (var u = 0; u < r; u++) t[u].emit("unpipe", this, { hasUnpiped: !1 });
1706
+ return this;
1707
+ }
1708
+ var E = Z(o.pipes, s);
1709
+ return E === -1 ? this : (o.pipes.splice(E, 1), o.pipesCount -= 1, o.pipesCount === 1 && (o.pipes = o.pipes[0]), s.emit("unpipe", this, e), this);
1710
+ }, d.prototype.on = function(s, o) {
1711
+ var e = oe.prototype.on.call(this, s, o), t = this._readableState;
1712
+ return s === "data" ? (t.readableListening = 0 < this.listenerCount("readable"), t.flowing !== !1 && this.resume()) : s == "readable" && !t.endEmitted && !t.readableListening && (t.readableListening = t.needReadable = !0, t.flowing = !1, t.emittedReadable = !1, H("on readable", t.length, t.reading), t.length ? h(this) : !t.reading && _.nextTick(p, this)), e;
1713
+ }, d.prototype.addListener = d.prototype.on, d.prototype.removeListener = function(s, o) {
1714
+ var e = oe.prototype.removeListener.call(this, s, o);
1715
+ return s === "readable" && _.nextTick(P, this), e;
1716
+ }, d.prototype.removeAllListeners = function(s) {
1717
+ var o = oe.prototype.removeAllListeners.apply(this, arguments);
1718
+ return (s === "readable" || s === void 0) && _.nextTick(P, this), o;
1719
+ }, d.prototype.resume = function() {
1720
+ var s = this._readableState;
1721
+ return s.flowing || (H("resume"), s.flowing = !s.readableListening, v(this, s)), s.paused = !1, this;
1722
+ }, d.prototype.pause = function() {
1723
+ return H("call pause flowing=%j", this._readableState.flowing), this._readableState.flowing !== !1 && (H("pause"), this._readableState.flowing = !1, this.emit("pause")), this._readableState.paused = !0, this;
1724
+ }, d.prototype.wrap = function(s) {
1725
+ var o = this, e = this._readableState, t = !1;
1726
+ for (var r in s.on("end", function() {
1727
+ if (H("wrapped end"), e.decoder && !e.ended) {
1728
+ var E = e.decoder.end();
1729
+ E && E.length && o.push(E);
1730
+ }
1731
+ o.push(null);
1732
+ }), s.on("data", function(E) {
1733
+ H("wrapped data"), e.decoder && (E = e.decoder.write(E)), !(e.objectMode && E == null) && (e.objectMode || E && E.length) && (o.push(E) || (t = !0, s.pause()));
1734
+ }), s) this[r] === void 0 && typeof s[r] == "function" && (this[r] = /* @__PURE__ */ (function(E) {
1735
+ return function() {
1736
+ return s[E].apply(s, arguments);
1737
+ };
1738
+ })(r));
1739
+ for (var u = 0; u < W.length; u++) s.on(W[u], this.emit.bind(this, W[u]));
1740
+ return this._read = function(E) {
1741
+ H("wrapped _read", E), t && (t = !1, s.resume());
1742
+ }, this;
1743
+ }, typeof Symbol == "function" && (d.prototype[Symbol.asyncIterator] = function() {
1744
+ return pe === void 0 && (pe = R("./internal/streams/async_iterator")), pe(this);
1745
+ }), Object.defineProperty(d.prototype, "readableHighWaterMark", {
1746
+ enumerable: !1,
1747
+ get: function() {
1748
+ return this._readableState.highWaterMark;
1749
+ }
1750
+ }), Object.defineProperty(d.prototype, "readableBuffer", {
1751
+ enumerable: !1,
1752
+ get: function() {
1753
+ return this._readableState && this._readableState.buffer;
1754
+ }
1755
+ }), Object.defineProperty(d.prototype, "readableFlowing", {
1756
+ enumerable: !1,
1757
+ get: function() {
1758
+ return this._readableState.flowing;
1759
+ },
1760
+ set: function(s) {
1761
+ this._readableState && (this._readableState.flowing = s);
1762
+ }
1763
+ }), d._fromList = V, Object.defineProperty(d.prototype, "readableLength", {
1764
+ enumerable: !1,
1765
+ get: function() {
1766
+ return this._readableState.length;
1767
+ }
1768
+ }), typeof Symbol == "function" && (d.from = function(s, o) {
1769
+ return ge === void 0 && (ge = R("./internal/streams/from")), ge(d, s, o);
1770
+ });
1771
+ }).call(this);
1772
+ }).call(this, R("_process"), typeof global > "u" ? typeof self > "u" ? typeof window > "u" ? {} : window : self : global);
1773
+ }, {
1774
+ "../errors": 15,
1775
+ "./_stream_duplex": 16,
1776
+ "./internal/streams/async_iterator": 21,
1777
+ "./internal/streams/buffer_list": 22,
1778
+ "./internal/streams/destroy": 23,
1779
+ "./internal/streams/from": 25,
1780
+ "./internal/streams/state": 27,
1781
+ "./internal/streams/stream": 28,
1782
+ _process: 12,
1783
+ buffer: 3,
1784
+ events: 7,
1785
+ inherits: 10,
1786
+ "string_decoder/": 31,
1787
+ util: 2
1788
+ }],
1789
+ 19: [function(R, M) {
1790
+ "use strict";
1791
+ function _(w, b) {
1792
+ var n = this._transformState;
1793
+ n.transforming = !1;
1794
+ var h = n.writecb;
1795
+ if (h === null) return this.emit("error", new d());
1796
+ n.writechunk = null, n.writecb = null, b != null && this.push(b), h(w);
1797
+ var y = this._readableState;
1798
+ y.reading = !1, (y.needReadable || y.length < y.highWaterMark) && this._read(y.highWaterMark);
1799
+ }
1800
+ function c(w) {
1801
+ return this instanceof c ? (L.call(this, w), this._transformState = {
1802
+ afterTransform: _.bind(this),
1803
+ needTransform: !1,
1804
+ transforming: !1,
1805
+ writecb: null,
1806
+ writechunk: null,
1807
+ writeencoding: null
1808
+ }, this._readableState.needReadable = !0, this._readableState.sync = !1, w && (typeof w.transform == "function" && (this._transform = w.transform), typeof w.flush == "function" && (this._flush = w.flush)), void this.on("prefinish", S)) : new c(w);
1809
+ }
1810
+ function S() {
1811
+ var w = this;
1812
+ typeof this._flush != "function" || this._readableState.destroyed ? O(this, null, null) : this._flush(function(b, n) {
1813
+ O(w, b, n);
1814
+ });
1815
+ }
1816
+ function O(w, b, n) {
1817
+ if (b) return w.emit("error", b);
1818
+ if (n != null && w.push(n), w._writableState.length) throw new g();
1819
+ if (w._transformState.transforming) throw new a();
1820
+ return w.push(null);
1821
+ }
1822
+ M.exports = c;
1823
+ var i = R("../errors").codes, l = i.ERR_METHOD_NOT_IMPLEMENTED, d = i.ERR_MULTIPLE_CALLBACK, a = i.ERR_TRANSFORM_ALREADY_TRANSFORMING, g = i.ERR_TRANSFORM_WITH_LENGTH_0, L = R("./_stream_duplex");
1824
+ R("inherits")(c, L), c.prototype.push = function(w, b) {
1825
+ return this._transformState.needTransform = !1, L.prototype.push.call(this, w, b);
1826
+ }, c.prototype._transform = function(w, b, n) {
1827
+ n(new l("_transform()"));
1828
+ }, c.prototype._write = function(w, b, n) {
1829
+ var h = this._transformState;
1830
+ if (h.writecb = n, h.writechunk = w, h.writeencoding = b, !h.transforming) {
1831
+ var y = this._readableState;
1832
+ (h.needTransform || y.needReadable || y.length < y.highWaterMark) && this._read(y.highWaterMark);
1833
+ }
1834
+ }, c.prototype._read = function() {
1835
+ var w = this._transformState;
1836
+ w.writechunk === null || w.transforming ? w.needTransform = !0 : (w.transforming = !0, this._transform(w.writechunk, w.writeencoding, w.afterTransform));
1837
+ }, c.prototype._destroy = function(w, b) {
1838
+ L.prototype._destroy.call(this, w, function(n) {
1839
+ b(n);
1840
+ });
1841
+ };
1842
+ }, {
1843
+ "../errors": 15,
1844
+ "./_stream_duplex": 16,
1845
+ inherits: 10
1846
+ }],
1847
+ 20: [function(R, M) {
1848
+ (function(_, c) {
1849
+ (function() {
1850
+ "use strict";
1851
+ function S(C) {
1852
+ var A = this;
1853
+ this.next = null, this.entry = null, this.finish = function() {
1854
+ z(A, C);
1855
+ };
1856
+ }
1857
+ function O(C) {
1858
+ return H.from(C);
1859
+ }
1860
+ function i(C) {
1861
+ return H.isBuffer(C) || C instanceof Ee;
1862
+ }
1863
+ function l() {
1864
+ }
1865
+ function d(C, A, D) {
1866
+ K = K || R("./_stream_duplex"), C = C || {}, typeof D != "boolean" && (D = A instanceof K), this.objectMode = !!C.objectMode, D && (this.objectMode = this.objectMode || !!C.writableObjectMode), this.highWaterMark = de(this, C, "writableHighWaterMark", D), this.finalCalled = !1, this.needDrain = !1, this.ending = !1, this.ended = !1, this.finished = !1, this.destroyed = !1;
1867
+ var W = C.decodeStrings === !1;
1868
+ this.decodeStrings = !W, this.defaultEncoding = C.defaultEncoding || "utf8", this.length = 0, this.writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = function(s) {
1869
+ k(A, s);
1870
+ }, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest = null, this.pendingcb = 0, this.prefinished = !1, this.errorEmitted = !1, this.emitClose = C.emitClose !== !1, this.autoDestroy = !!C.autoDestroy, this.bufferedRequestCount = 0, this.corkedRequestsFree = new S(this);
1871
+ }
1872
+ function a(C) {
1873
+ K = K || R("./_stream_duplex");
1874
+ var A = this instanceof K;
1875
+ return A || le.call(a, this) ? (this._writableState = new d(C, this, A), this.writable = !0, C && (typeof C.write == "function" && (this._write = C.write), typeof C.writev == "function" && (this._writev = C.writev), typeof C.destroy == "function" && (this._destroy = C.destroy), typeof C.final == "function" && (this._final = C.final)), void te.call(this)) : new a(C);
1876
+ }
1877
+ function g(C, A) {
1878
+ var D = new _e();
1879
+ ce(C, D), _.nextTick(A, D);
1880
+ }
1881
+ function L(C, A, D, W) {
1882
+ var s;
1883
+ return D === null ? s = new me() : typeof D != "string" && !A.objectMode && (s = new Q("chunk", ["string", "Buffer"], D)), !s || (ce(C, s), _.nextTick(W, s), !1);
1884
+ }
1885
+ function w(C, A, D) {
1886
+ return C.objectMode || C.decodeStrings === !1 || typeof A != "string" || (A = H.from(A, D)), A;
1887
+ }
1888
+ function b(C, A, D, W, s, o) {
1889
+ if (!D) {
1890
+ var e = w(A, W, s);
1891
+ W !== e && (D = !0, s = "buffer", W = e);
1892
+ }
1893
+ var t = A.objectMode ? 1 : W.length;
1894
+ A.length += t;
1895
+ var r = A.length < A.highWaterMark;
1896
+ if (r || (A.needDrain = !0), A.writing || A.corked) {
1897
+ var u = A.lastBufferedRequest;
1898
+ A.lastBufferedRequest = {
1899
+ chunk: W,
1900
+ encoding: s,
1901
+ isBuf: D,
1902
+ callback: o,
1903
+ next: null
1904
+ }, u ? u.next = A.lastBufferedRequest : A.bufferedRequest = A.lastBufferedRequest, A.bufferedRequestCount += 1;
1905
+ } else n(C, A, !1, t, W, s, o);
1906
+ return r;
1907
+ }
1908
+ function n(C, A, D, W, s, o, e) {
1909
+ A.writelen = W, A.writecb = e, A.writing = !0, A.sync = !0, A.destroyed ? A.onwrite(new Se("write")) : D ? C._writev(s, A.onwrite) : C._write(s, o, A.onwrite), A.sync = !1;
1910
+ }
1911
+ function h(C, A, D, W, s) {
1912
+ --A.pendingcb, D ? (_.nextTick(s, W), _.nextTick(B, C, A), C._writableState.errorEmitted = !0, ce(C, W)) : (s(W), C._writableState.errorEmitted = !0, ce(C, W), B(C, A));
1913
+ }
1914
+ function y(C) {
1915
+ C.writing = !1, C.writecb = null, C.length -= C.writelen, C.writelen = 0;
1916
+ }
1917
+ function k(C, A) {
1918
+ var D = C._writableState, W = D.sync, s = D.writecb;
1919
+ if (typeof s != "function") throw new pe();
1920
+ if (y(D), A) h(C, D, W, A, s);
1921
+ else {
1922
+ var o = p(D) || C.destroyed;
1923
+ o || D.corked || D.bufferProcessing || !D.bufferedRequest || P(C, D), W ? _.nextTick(f, C, D, o, s) : f(C, D, o, s);
1924
+ }
1925
+ }
1926
+ function f(C, A, D, W) {
1927
+ D || T(C, A), A.pendingcb--, W(), B(C, A);
1928
+ }
1929
+ function T(C, A) {
1930
+ A.length === 0 && A.needDrain && (A.needDrain = !1, C.emit("drain"));
1931
+ }
1932
+ function P(C, A) {
1933
+ A.bufferProcessing = !0;
1934
+ var D = A.bufferedRequest;
1935
+ if (C._writev && D && D.next) {
1936
+ var W = A.bufferedRequestCount, s = Array(W), o = A.corkedRequestsFree;
1937
+ o.entry = D;
1938
+ for (var e = 0, t = !0; D; ) s[e] = D, D.isBuf || (t = !1), D = D.next, e += 1;
1939
+ s.allBuffers = t, n(C, A, !0, A.length, s, "", o.finish), A.pendingcb++, A.lastBufferedRequest = null, o.next ? (A.corkedRequestsFree = o.next, o.next = null) : A.corkedRequestsFree = new S(A), A.bufferedRequestCount = 0;
1940
+ } else {
1941
+ for (; D; ) {
1942
+ var r = D.chunk, u = D.encoding, E = D.callback;
1943
+ if (n(C, A, !1, A.objectMode ? 1 : r.length, r, u, E), D = D.next, A.bufferedRequestCount--, A.writing) break;
1944
+ }
1945
+ D === null && (A.lastBufferedRequest = null);
1946
+ }
1947
+ A.bufferedRequest = D, A.bufferProcessing = !1;
1948
+ }
1949
+ function p(C) {
1950
+ return C.ending && C.length === 0 && C.bufferedRequest === null && !C.finished && !C.writing;
1951
+ }
1952
+ function v(C, A) {
1953
+ C._final(function(D) {
1954
+ A.pendingcb--, D && ce(C, D), A.prefinished = !0, C.emit("prefinish"), B(C, A);
1955
+ });
1956
+ }
1957
+ function I(C, A) {
1958
+ A.prefinished || A.finalCalled || (typeof C._final != "function" || A.destroyed ? (A.prefinished = !0, C.emit("prefinish")) : (A.pendingcb++, A.finalCalled = !0, _.nextTick(v, C, A)));
1959
+ }
1960
+ function B(C, A) {
1961
+ var D = p(A);
1962
+ if (D && (I(C, A), A.pendingcb === 0 && (A.finished = !0, C.emit("finish"), A.autoDestroy))) {
1963
+ var W = C._readableState;
1964
+ (!W || W.autoDestroy && W.endEmitted) && C.destroy();
1965
+ }
1966
+ return D;
1967
+ }
1968
+ function V(C, A, D) {
1969
+ A.ending = !0, B(C, A), D && (A.finished ? _.nextTick(D) : C.once("finish", D)), A.ended = !0, C.writable = !1;
1970
+ }
1971
+ function z(C, A, D) {
1972
+ var W = C.entry;
1973
+ for (C.entry = null; W; ) {
1974
+ var s = W.callback;
1975
+ A.pendingcb--, s(D), W = W.next;
1976
+ }
1977
+ A.corkedRequestsFree.next = C;
1978
+ }
1979
+ M.exports = a;
1980
+ var K;
1981
+ a.WritableState = d;
1982
+ var Z = { deprecate: R("util-deprecate") }, te = R("./internal/streams/stream"), H = R("buffer").Buffer, Ee = c.Uint8Array || function() {
1983
+ }, oe = R("./internal/streams/destroy"), de = R("./internal/streams/state").getHighWaterMark, J = R("../errors").codes, Q = J.ERR_INVALID_ARG_TYPE, ae = J.ERR_METHOD_NOT_IMPLEMENTED, pe = J.ERR_MULTIPLE_CALLBACK, ge = J.ERR_STREAM_CANNOT_PIPE, Se = J.ERR_STREAM_DESTROYED, me = J.ERR_STREAM_NULL_VALUES, _e = J.ERR_STREAM_WRITE_AFTER_END, ye = J.ERR_UNKNOWN_ENCODING, ce = oe.errorOrDestroy;
1984
+ R("inherits")(a, te), d.prototype.getBuffer = function() {
1985
+ for (var C = this.bufferedRequest, A = []; C; ) A.push(C), C = C.next;
1986
+ return A;
1987
+ }, (function() {
1988
+ try {
1989
+ Object.defineProperty(d.prototype, "buffer", { get: Z.deprecate(function() {
1990
+ return this.getBuffer();
1991
+ }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003") });
1992
+ } catch {
1993
+ }
1994
+ })();
1995
+ var le;
1996
+ typeof Symbol == "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] == "function" ? (le = Function.prototype[Symbol.hasInstance], Object.defineProperty(a, Symbol.hasInstance, { value: function(C) {
1997
+ return !!le.call(this, C) || this === a && C && C._writableState instanceof d;
1998
+ } })) : le = function(C) {
1999
+ return C instanceof this;
2000
+ }, a.prototype.pipe = function() {
2001
+ ce(this, new ge());
2002
+ }, a.prototype.write = function(C, A, D) {
2003
+ var W = this._writableState, s = !1, o = !W.objectMode && i(C);
2004
+ return o && !H.isBuffer(C) && (C = O(C)), typeof A == "function" && (D = A, A = null), o ? A = "buffer" : !A && (A = W.defaultEncoding), typeof D != "function" && (D = l), W.ending ? g(this, D) : (o || L(this, W, C, D)) && (W.pendingcb++, s = b(this, W, o, C, A, D)), s;
2005
+ }, a.prototype.cork = function() {
2006
+ this._writableState.corked++;
2007
+ }, a.prototype.uncork = function() {
2008
+ var C = this._writableState;
2009
+ C.corked && (C.corked--, !C.writing && !C.corked && !C.bufferProcessing && C.bufferedRequest && P(this, C));
2010
+ }, a.prototype.setDefaultEncoding = function(C) {
2011
+ if (typeof C == "string" && (C = C.toLowerCase()), !(-1 < [
2012
+ "hex",
2013
+ "utf8",
2014
+ "utf-8",
2015
+ "ascii",
2016
+ "binary",
2017
+ "base64",
2018
+ "ucs2",
2019
+ "ucs-2",
2020
+ "utf16le",
2021
+ "utf-16le",
2022
+ "raw"
2023
+ ].indexOf((C + "").toLowerCase()))) throw new ye(C);
2024
+ return this._writableState.defaultEncoding = C, this;
2025
+ }, Object.defineProperty(a.prototype, "writableBuffer", {
2026
+ enumerable: !1,
2027
+ get: function() {
2028
+ return this._writableState && this._writableState.getBuffer();
2029
+ }
2030
+ }), Object.defineProperty(a.prototype, "writableHighWaterMark", {
2031
+ enumerable: !1,
2032
+ get: function() {
2033
+ return this._writableState.highWaterMark;
2034
+ }
2035
+ }), a.prototype._write = function(C, A, D) {
2036
+ D(new ae("_write()"));
2037
+ }, a.prototype._writev = null, a.prototype.end = function(C, A, D) {
2038
+ var W = this._writableState;
2039
+ return typeof C == "function" ? (D = C, C = null, A = null) : typeof A == "function" && (D = A, A = null), C != null && this.write(C, A), W.corked && (W.corked = 1, this.uncork()), W.ending || V(this, W, D), this;
2040
+ }, Object.defineProperty(a.prototype, "writableLength", {
2041
+ enumerable: !1,
2042
+ get: function() {
2043
+ return this._writableState.length;
2044
+ }
2045
+ }), Object.defineProperty(a.prototype, "destroyed", {
2046
+ enumerable: !1,
2047
+ get: function() {
2048
+ return this._writableState !== void 0 && this._writableState.destroyed;
2049
+ },
2050
+ set: function(C) {
2051
+ this._writableState && (this._writableState.destroyed = C);
2052
+ }
2053
+ }), a.prototype.destroy = oe.destroy, a.prototype._undestroy = oe.undestroy, a.prototype._destroy = function(C, A) {
2054
+ A(C);
2055
+ };
2056
+ }).call(this);
2057
+ }).call(this, R("_process"), typeof global > "u" ? typeof self > "u" ? typeof window > "u" ? {} : window : self : global);
2058
+ }, {
2059
+ "../errors": 15,
2060
+ "./_stream_duplex": 16,
2061
+ "./internal/streams/destroy": 23,
2062
+ "./internal/streams/state": 27,
2063
+ "./internal/streams/stream": 28,
2064
+ _process: 12,
2065
+ buffer: 3,
2066
+ inherits: 10,
2067
+ "util-deprecate": 32
2068
+ }],
2069
+ 21: [function(R, M) {
2070
+ (function(_) {
2071
+ (function() {
2072
+ "use strict";
2073
+ function c(T, P, p) {
2074
+ return P in T ? Object.defineProperty(T, P, {
2075
+ value: p,
2076
+ enumerable: !0,
2077
+ configurable: !0,
2078
+ writable: !0
2079
+ }) : T[P] = p, T;
2080
+ }
2081
+ function S(T, P) {
2082
+ return {
2083
+ value: T,
2084
+ done: P
2085
+ };
2086
+ }
2087
+ function O(T) {
2088
+ var P = T[g];
2089
+ if (P !== null) {
2090
+ var p = T[y].read();
2091
+ p !== null && (T[n] = null, T[g] = null, T[L] = null, P(S(p, !1)));
2092
+ }
2093
+ }
2094
+ function i(T) {
2095
+ _.nextTick(O, T);
2096
+ }
2097
+ function l(T, P) {
2098
+ return function(p, v) {
2099
+ T.then(function() {
2100
+ P[b] ? p(S(void 0, !0)) : P[h](p, v);
2101
+ }, v);
2102
+ };
2103
+ }
2104
+ var d, a = R("./end-of-stream"), g = /* @__PURE__ */ Symbol("lastResolve"), L = /* @__PURE__ */ Symbol("lastReject"), w = /* @__PURE__ */ Symbol("error"), b = /* @__PURE__ */ Symbol("ended"), n = /* @__PURE__ */ Symbol("lastPromise"), h = /* @__PURE__ */ Symbol("handlePromise"), y = /* @__PURE__ */ Symbol("stream"), k = Object.getPrototypeOf(function() {
2105
+ }), f = Object.setPrototypeOf((d = {
2106
+ get stream() {
2107
+ return this[y];
2108
+ },
2109
+ next: function() {
2110
+ var T = this, P = this[w];
2111
+ if (P !== null) return Promise.reject(P);
2112
+ if (this[b]) return Promise.resolve(S(void 0, !0));
2113
+ if (this[y].destroyed) return new Promise(function(B, V) {
2114
+ _.nextTick(function() {
2115
+ T[w] ? V(T[w]) : B(S(void 0, !0));
2116
+ });
2117
+ });
2118
+ var p, v = this[n];
2119
+ if (v) p = new Promise(l(v, this));
2120
+ else {
2121
+ var I = this[y].read();
2122
+ if (I !== null) return Promise.resolve(S(I, !1));
2123
+ p = new Promise(this[h]);
2124
+ }
2125
+ return this[n] = p, p;
2126
+ }
2127
+ }, c(d, Symbol.asyncIterator, function() {
2128
+ return this;
2129
+ }), c(d, "return", function() {
2130
+ var T = this;
2131
+ return new Promise(function(P, p) {
2132
+ T[y].destroy(null, function(v) {
2133
+ v ? p(v) : P(S(void 0, !0));
2134
+ });
2135
+ });
2136
+ }), d), k);
2137
+ M.exports = function(T) {
2138
+ var P, p = Object.create(f, (P = {}, c(P, y, {
2139
+ value: T,
2140
+ writable: !0
2141
+ }), c(P, g, {
2142
+ value: null,
2143
+ writable: !0
2144
+ }), c(P, L, {
2145
+ value: null,
2146
+ writable: !0
2147
+ }), c(P, w, {
2148
+ value: null,
2149
+ writable: !0
2150
+ }), c(P, b, {
2151
+ value: T._readableState.endEmitted,
2152
+ writable: !0
2153
+ }), c(P, h, {
2154
+ value: function(v, I) {
2155
+ var B = p[y].read();
2156
+ B ? (p[n] = null, p[g] = null, p[L] = null, v(S(B, !1))) : (p[g] = v, p[L] = I);
2157
+ },
2158
+ writable: !0
2159
+ }), P));
2160
+ return p[n] = null, a(T, function(v) {
2161
+ if (v && v.code !== "ERR_STREAM_PREMATURE_CLOSE") {
2162
+ var I = p[L];
2163
+ I !== null && (p[n] = null, p[g] = null, p[L] = null, I(v)), p[w] = v;
2164
+ return;
2165
+ }
2166
+ var B = p[g];
2167
+ B !== null && (p[n] = null, p[g] = null, p[L] = null, B(S(void 0, !0))), p[b] = !0;
2168
+ }), T.on("readable", i.bind(null, p)), p;
2169
+ };
2170
+ }).call(this);
2171
+ }).call(this, R("_process"));
2172
+ }, {
2173
+ "./end-of-stream": 24,
2174
+ _process: 12
2175
+ }],
2176
+ 22: [function(R, M) {
2177
+ "use strict";
2178
+ function _(w, b) {
2179
+ var n = Object.keys(w);
2180
+ if (Object.getOwnPropertySymbols) {
2181
+ var h = Object.getOwnPropertySymbols(w);
2182
+ b && (h = h.filter(function(y) {
2183
+ return Object.getOwnPropertyDescriptor(w, y).enumerable;
2184
+ })), n.push.apply(n, h);
2185
+ }
2186
+ return n;
2187
+ }
2188
+ function c(w) {
2189
+ for (var b, n = 1; n < arguments.length; n++) b = arguments[n] == null ? {} : arguments[n], n % 2 ? _(Object(b), !0).forEach(function(h) {
2190
+ S(w, h, b[h]);
2191
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(w, Object.getOwnPropertyDescriptors(b)) : _(Object(b)).forEach(function(h) {
2192
+ Object.defineProperty(w, h, Object.getOwnPropertyDescriptor(b, h));
2193
+ });
2194
+ return w;
2195
+ }
2196
+ function S(w, b, n) {
2197
+ return b in w ? Object.defineProperty(w, b, {
2198
+ value: n,
2199
+ enumerable: !0,
2200
+ configurable: !0,
2201
+ writable: !0
2202
+ }) : w[b] = n, w;
2203
+ }
2204
+ function O(w, b) {
2205
+ if (!(w instanceof b)) throw new TypeError("Cannot call a class as a function");
2206
+ }
2207
+ function i(w, b) {
2208
+ for (var n, h = 0; h < b.length; h++) n = b[h], n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(w, n.key, n);
2209
+ }
2210
+ function l(w, b, n) {
2211
+ return b && i(w.prototype, b), n && i(w, n), w;
2212
+ }
2213
+ function d(w, b, n) {
2214
+ a.prototype.copy.call(w, b, n);
2215
+ }
2216
+ var a = R("buffer").Buffer, g = R("util").inspect, L = g && g.custom || "inspect";
2217
+ M.exports = (function() {
2218
+ function w() {
2219
+ O(this, w), this.head = null, this.tail = null, this.length = 0;
2220
+ }
2221
+ return l(w, [
2222
+ {
2223
+ key: "push",
2224
+ value: function(b) {
2225
+ var n = {
2226
+ data: b,
2227
+ next: null
2228
+ };
2229
+ 0 < this.length ? this.tail.next = n : this.head = n, this.tail = n, ++this.length;
2230
+ }
2231
+ },
2232
+ {
2233
+ key: "unshift",
2234
+ value: function(b) {
2235
+ var n = {
2236
+ data: b,
2237
+ next: this.head
2238
+ };
2239
+ this.length === 0 && (this.tail = n), this.head = n, ++this.length;
2240
+ }
2241
+ },
2242
+ {
2243
+ key: "shift",
2244
+ value: function() {
2245
+ if (this.length !== 0) {
2246
+ var b = this.head.data;
2247
+ return this.head = this.length === 1 ? this.tail = null : this.head.next, --this.length, b;
2248
+ }
2249
+ }
2250
+ },
2251
+ {
2252
+ key: "clear",
2253
+ value: function() {
2254
+ this.head = this.tail = null, this.length = 0;
2255
+ }
2256
+ },
2257
+ {
2258
+ key: "join",
2259
+ value: function(b) {
2260
+ if (this.length === 0) return "";
2261
+ for (var n = this.head, h = "" + n.data; n = n.next; ) h += b + n.data;
2262
+ return h;
2263
+ }
2264
+ },
2265
+ {
2266
+ key: "concat",
2267
+ value: function(b) {
2268
+ if (this.length === 0) return a.alloc(0);
2269
+ for (var n = a.allocUnsafe(b >>> 0), h = this.head, y = 0; h; ) d(h.data, n, y), y += h.data.length, h = h.next;
2270
+ return n;
2271
+ }
2272
+ },
2273
+ {
2274
+ key: "consume",
2275
+ value: function(b, n) {
2276
+ var h;
2277
+ return b < this.head.data.length ? (h = this.head.data.slice(0, b), this.head.data = this.head.data.slice(b)) : b === this.head.data.length ? h = this.shift() : h = n ? this._getString(b) : this._getBuffer(b), h;
2278
+ }
2279
+ },
2280
+ {
2281
+ key: "first",
2282
+ value: function() {
2283
+ return this.head.data;
2284
+ }
2285
+ },
2286
+ {
2287
+ key: "_getString",
2288
+ value: function(b) {
2289
+ var n = this.head, h = 1, y = n.data;
2290
+ for (b -= y.length; n = n.next; ) {
2291
+ var k = n.data, f = b > k.length ? k.length : b;
2292
+ if (y += f === k.length ? k : k.slice(0, b), b -= f, b === 0) {
2293
+ f === k.length ? (++h, this.head = n.next ? n.next : this.tail = null) : (this.head = n, n.data = k.slice(f));
2294
+ break;
2295
+ }
2296
+ ++h;
2297
+ }
2298
+ return this.length -= h, y;
2299
+ }
2300
+ },
2301
+ {
2302
+ key: "_getBuffer",
2303
+ value: function(b) {
2304
+ var n = a.allocUnsafe(b), h = this.head, y = 1;
2305
+ for (h.data.copy(n), b -= h.data.length; h = h.next; ) {
2306
+ var k = h.data, f = b > k.length ? k.length : b;
2307
+ if (k.copy(n, n.length - b, 0, f), b -= f, b === 0) {
2308
+ f === k.length ? (++y, this.head = h.next ? h.next : this.tail = null) : (this.head = h, h.data = k.slice(f));
2309
+ break;
2310
+ }
2311
+ ++y;
2312
+ }
2313
+ return this.length -= y, n;
2314
+ }
2315
+ },
2316
+ {
2317
+ key: L,
2318
+ value: function(b, n) {
2319
+ return g(this, c({}, n, {
2320
+ depth: 0,
2321
+ customInspect: !1
2322
+ }));
2323
+ }
2324
+ }
2325
+ ]), w;
2326
+ })();
2327
+ }, {
2328
+ buffer: 3,
2329
+ util: 2
2330
+ }],
2331
+ 23: [function(R, M) {
2332
+ (function(_) {
2333
+ (function() {
2334
+ "use strict";
2335
+ function c(i, l) {
2336
+ O(i, l), S(i);
2337
+ }
2338
+ function S(i) {
2339
+ i._writableState && !i._writableState.emitClose || i._readableState && !i._readableState.emitClose || i.emit("close");
2340
+ }
2341
+ function O(i, l) {
2342
+ i.emit("error", l);
2343
+ }
2344
+ M.exports = {
2345
+ destroy: function(i, l) {
2346
+ var d = this, a = this._readableState && this._readableState.destroyed, g = this._writableState && this._writableState.destroyed;
2347
+ return a || g ? (l ? l(i) : i && (this._writableState ? !this._writableState.errorEmitted && (this._writableState.errorEmitted = !0, _.nextTick(O, this, i)) : _.nextTick(O, this, i)), this) : (this._readableState && (this._readableState.destroyed = !0), this._writableState && (this._writableState.destroyed = !0), this._destroy(i || null, function(L) {
2348
+ !l && L ? d._writableState ? d._writableState.errorEmitted ? _.nextTick(S, d) : (d._writableState.errorEmitted = !0, _.nextTick(c, d, L)) : _.nextTick(c, d, L) : l ? (_.nextTick(S, d), l(L)) : _.nextTick(S, d);
2349
+ }), this);
2350
+ },
2351
+ undestroy: function() {
2352
+ this._readableState && (this._readableState.destroyed = !1, this._readableState.reading = !1, this._readableState.ended = !1, this._readableState.endEmitted = !1), this._writableState && (this._writableState.destroyed = !1, this._writableState.ended = !1, this._writableState.ending = !1, this._writableState.finalCalled = !1, this._writableState.prefinished = !1, this._writableState.finished = !1, this._writableState.errorEmitted = !1);
2353
+ },
2354
+ errorOrDestroy: function(i, l) {
2355
+ var d = i._readableState, a = i._writableState;
2356
+ d && d.autoDestroy || a && a.autoDestroy ? i.destroy(l) : i.emit("error", l);
2357
+ }
2358
+ };
2359
+ }).call(this);
2360
+ }).call(this, R("_process"));
2361
+ }, { _process: 12 }],
2362
+ 24: [function(R, M) {
2363
+ "use strict";
2364
+ function _(l) {
2365
+ var d = !1;
2366
+ return function() {
2367
+ if (!d) {
2368
+ d = !0;
2369
+ for (var a = arguments.length, g = Array(a), L = 0; L < a; L++) g[L] = arguments[L];
2370
+ l.apply(this, g);
2371
+ }
2372
+ };
2373
+ }
2374
+ function c() {
2375
+ }
2376
+ function S(l) {
2377
+ return l.setHeader && typeof l.abort == "function";
2378
+ }
2379
+ function O(l, d, a) {
2380
+ if (typeof d == "function") return O(l, null, d);
2381
+ d || (d = {}), a = _(a || c);
2382
+ var g = d.readable || d.readable !== !1 && l.readable, L = d.writable || d.writable !== !1 && l.writable, w = function() {
2383
+ l.writable || n();
2384
+ }, b = l._writableState && l._writableState.finished, n = function() {
2385
+ L = !1, b = !0, g || a.call(l);
2386
+ }, h = l._readableState && l._readableState.endEmitted, y = function() {
2387
+ g = !1, h = !0, L || a.call(l);
2388
+ }, k = function(P) {
2389
+ a.call(l, P);
2390
+ }, f = function() {
2391
+ var P;
2392
+ return g && !h ? (l._readableState && l._readableState.ended || (P = new i()), a.call(l, P)) : L && !b ? (l._writableState && l._writableState.ended || (P = new i()), a.call(l, P)) : void 0;
2393
+ }, T = function() {
2394
+ l.req.on("finish", n);
2395
+ };
2396
+ return S(l) ? (l.on("complete", n), l.on("abort", f), l.req ? T() : l.on("request", T)) : L && !l._writableState && (l.on("end", w), l.on("close", w)), l.on("end", y), l.on("finish", n), d.error !== !1 && l.on("error", k), l.on("close", f), function() {
2397
+ l.removeListener("complete", n), l.removeListener("abort", f), l.removeListener("request", T), l.req && l.req.removeListener("finish", n), l.removeListener("end", w), l.removeListener("close", w), l.removeListener("finish", n), l.removeListener("end", y), l.removeListener("error", k), l.removeListener("close", f);
2398
+ };
2399
+ }
2400
+ var i = R("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;
2401
+ M.exports = O;
2402
+ }, { "../../../errors": 15 }],
2403
+ 25: [function(R, M) {
2404
+ M.exports = function() {
2405
+ throw new Error("Readable.from is not available in the browser");
2406
+ };
2407
+ }, {}],
2408
+ 26: [function(R, M) {
2409
+ "use strict";
2410
+ function _(b) {
2411
+ var n = !1;
2412
+ return function() {
2413
+ n || (n = !0, b.apply(void 0, arguments));
2414
+ };
2415
+ }
2416
+ function c(b) {
2417
+ if (b) throw b;
2418
+ }
2419
+ function S(b) {
2420
+ return b.setHeader && typeof b.abort == "function";
2421
+ }
2422
+ function O(b, n, h, y) {
2423
+ y = _(y);
2424
+ var k = !1;
2425
+ b.on("close", function() {
2426
+ k = !0;
2427
+ }), a === void 0 && (a = R("./end-of-stream")), a(b, {
2428
+ readable: n,
2429
+ writable: h
2430
+ }, function(T) {
2431
+ return T ? y(T) : (k = !0, void y());
2432
+ });
2433
+ var f = !1;
2434
+ return function(T) {
2435
+ if (!k) return f ? void 0 : (f = !0, S(b) ? b.abort() : typeof b.destroy == "function" ? b.destroy() : void y(T || new w("pipe")));
2436
+ };
2437
+ }
2438
+ function i(b) {
2439
+ b();
2440
+ }
2441
+ function l(b, n) {
2442
+ return b.pipe(n);
2443
+ }
2444
+ function d(b) {
2445
+ return b.length && typeof b[b.length - 1] == "function" ? b.pop() : c;
2446
+ }
2447
+ var a, g = R("../../../errors").codes, L = g.ERR_MISSING_ARGS, w = g.ERR_STREAM_DESTROYED;
2448
+ M.exports = function() {
2449
+ for (var b = arguments.length, n = Array(b), h = 0; h < b; h++) n[h] = arguments[h];
2450
+ var y = d(n);
2451
+ if (Array.isArray(n[0]) && (n = n[0]), 2 > n.length) throw new L("streams");
2452
+ var k, f = n.map(function(T, P) {
2453
+ var p = P < n.length - 1;
2454
+ return O(T, p, 0 < P, function(v) {
2455
+ k || (k = v), v && f.forEach(i), p || (f.forEach(i), y(k));
2456
+ });
2457
+ });
2458
+ return n.reduce(l);
2459
+ };
2460
+ }, {
2461
+ "../../../errors": 15,
2462
+ "./end-of-stream": 24
2463
+ }],
2464
+ 27: [function(R, M) {
2465
+ "use strict";
2466
+ function _(S, O, i) {
2467
+ return S.highWaterMark == null ? O ? S[i] : null : S.highWaterMark;
2468
+ }
2469
+ var c = R("../../../errors").codes.ERR_INVALID_OPT_VALUE;
2470
+ M.exports = { getHighWaterMark: function(S, O, i, l) {
2471
+ var d = _(O, l, i);
2472
+ if (d != null) {
2473
+ if (!(isFinite(d) && j(d) === d) || 0 > d) throw new c(l ? i : "highWaterMark", d);
2474
+ return j(d);
2475
+ }
2476
+ return S.objectMode ? 16 : 16384;
2477
+ } };
2478
+ }, { "../../../errors": 15 }],
2479
+ 28: [function(R, M) {
2480
+ M.exports = R("events").EventEmitter;
2481
+ }, { events: 7 }],
2482
+ 29: [function(R, M, _) {
2483
+ _ = M.exports = R("./lib/_stream_readable.js"), _.Stream = _, _.Readable = _, _.Writable = R("./lib/_stream_writable.js"), _.Duplex = R("./lib/_stream_duplex.js"), _.Transform = R("./lib/_stream_transform.js"), _.PassThrough = R("./lib/_stream_passthrough.js"), _.finished = R("./lib/internal/streams/end-of-stream.js"), _.pipeline = R("./lib/internal/streams/pipeline.js");
2484
+ }, {
2485
+ "./lib/_stream_duplex.js": 16,
2486
+ "./lib/_stream_passthrough.js": 17,
2487
+ "./lib/_stream_readable.js": 18,
2488
+ "./lib/_stream_transform.js": 19,
2489
+ "./lib/_stream_writable.js": 20,
2490
+ "./lib/internal/streams/end-of-stream.js": 24,
2491
+ "./lib/internal/streams/pipeline.js": 26
2492
+ }],
2493
+ 30: [function(R, M, _) {
2494
+ function c(l, d) {
2495
+ for (var a in l) d[a] = l[a];
2496
+ }
2497
+ function S(l, d, a) {
2498
+ return i(l, d, a);
2499
+ }
2500
+ var O = R("buffer"), i = O.Buffer;
2501
+ i.from && i.alloc && i.allocUnsafe && i.allocUnsafeSlow ? M.exports = O : (c(O, _), _.Buffer = S), S.prototype = Object.create(i.prototype), c(i, S), S.from = function(l, d, a) {
2502
+ if (typeof l == "number") throw new TypeError("Argument must not be a number");
2503
+ return i(l, d, a);
2504
+ }, S.alloc = function(l, d, a) {
2505
+ if (typeof l != "number") throw new TypeError("Argument must be a number");
2506
+ var g = i(l);
2507
+ return d === void 0 ? g.fill(0) : typeof a == "string" ? g.fill(d, a) : g.fill(d), g;
2508
+ }, S.allocUnsafe = function(l) {
2509
+ if (typeof l != "number") throw new TypeError("Argument must be a number");
2510
+ return i(l);
2511
+ }, S.allocUnsafeSlow = function(l) {
2512
+ if (typeof l != "number") throw new TypeError("Argument must be a number");
2513
+ return O.SlowBuffer(l);
2514
+ };
2515
+ }, { buffer: 3 }],
2516
+ 31: [function(R, M, _) {
2517
+ "use strict";
2518
+ function c(f) {
2519
+ if (!f) return "utf8";
2520
+ for (var T; ; ) switch (f) {
2521
+ case "utf8":
2522
+ case "utf-8":
2523
+ return "utf8";
2524
+ case "ucs2":
2525
+ case "ucs-2":
2526
+ case "utf16le":
2527
+ case "utf-16le":
2528
+ return "utf16le";
2529
+ case "latin1":
2530
+ case "binary":
2531
+ return "latin1";
2532
+ case "base64":
2533
+ case "ascii":
2534
+ case "hex":
2535
+ return f;
2536
+ default:
2537
+ if (T) return;
2538
+ f = ("" + f).toLowerCase(), T = !0;
2539
+ }
2540
+ }
2541
+ function S(f) {
2542
+ var T = c(f);
2543
+ if (typeof T != "string" && (y.isEncoding === k || !k(f))) throw new Error("Unknown encoding: " + f);
2544
+ return T || f;
2545
+ }
2546
+ function O(f) {
2547
+ this.encoding = S(f);
2548
+ var T;
2549
+ switch (this.encoding) {
2550
+ case "utf16le":
2551
+ this.text = g, this.end = L, T = 4;
2552
+ break;
2553
+ case "utf8":
2554
+ this.fillLast = a, T = 4;
2555
+ break;
2556
+ case "base64":
2557
+ this.text = w, this.end = b, T = 3;
2558
+ break;
2559
+ default:
2560
+ this.write = n, this.end = h;
2561
+ return;
2562
+ }
2563
+ this.lastNeed = 0, this.lastTotal = 0, this.lastChar = y.allocUnsafe(T);
2564
+ }
2565
+ function i(f) {
2566
+ return 127 >= f ? 0 : f >> 5 == 6 ? 2 : f >> 4 == 14 ? 3 : f >> 3 == 30 ? 4 : f >> 6 == 2 ? -1 : -2;
2567
+ }
2568
+ function l(f, T, P) {
2569
+ var p = T.length - 1;
2570
+ if (p < P) return 0;
2571
+ var v = i(T[p]);
2572
+ return 0 <= v ? (0 < v && (f.lastNeed = v - 1), v) : --p < P || v === -2 ? 0 : (v = i(T[p]), 0 <= v ? (0 < v && (f.lastNeed = v - 2), v) : --p < P || v === -2 ? 0 : (v = i(T[p]), 0 <= v ? (0 < v && (v === 2 ? v = 0 : f.lastNeed = v - 3), v) : 0));
2573
+ }
2574
+ function d(f, T) {
2575
+ if ((192 & T[0]) != 128) return f.lastNeed = 0, "�";
2576
+ if (1 < f.lastNeed && 1 < T.length) {
2577
+ if ((192 & T[1]) != 128) return f.lastNeed = 1, "�";
2578
+ if (2 < f.lastNeed && 2 < T.length && (192 & T[2]) != 128) return f.lastNeed = 2, "�";
2579
+ }
2580
+ }
2581
+ function a(f) {
2582
+ var T = this.lastTotal - this.lastNeed, P = d(this, f, T);
2583
+ return P === void 0 ? this.lastNeed <= f.length ? (f.copy(this.lastChar, T, 0, this.lastNeed), this.lastChar.toString(this.encoding, 0, this.lastTotal)) : (f.copy(this.lastChar, T, 0, f.length), void (this.lastNeed -= f.length)) : P;
2584
+ }
2585
+ function g(f, T) {
2586
+ if ((f.length - T) % 2 == 0) {
2587
+ var P = f.toString("utf16le", T);
2588
+ if (P) {
2589
+ var p = P.charCodeAt(P.length - 1);
2590
+ if (55296 <= p && 56319 >= p) return this.lastNeed = 2, this.lastTotal = 4, this.lastChar[0] = f[f.length - 2], this.lastChar[1] = f[f.length - 1], P.slice(0, -1);
2591
+ }
2592
+ return P;
2593
+ }
2594
+ return this.lastNeed = 1, this.lastTotal = 2, this.lastChar[0] = f[f.length - 1], f.toString("utf16le", T, f.length - 1);
2595
+ }
2596
+ function L(f) {
2597
+ var T = f && f.length ? this.write(f) : "";
2598
+ if (this.lastNeed) {
2599
+ var P = this.lastTotal - this.lastNeed;
2600
+ return T + this.lastChar.toString("utf16le", 0, P);
2601
+ }
2602
+ return T;
2603
+ }
2604
+ function w(f, T) {
2605
+ var P = (f.length - T) % 3;
2606
+ return P == 0 ? f.toString("base64", T) : (this.lastNeed = 3 - P, this.lastTotal = 3, P == 1 ? this.lastChar[0] = f[f.length - 1] : (this.lastChar[0] = f[f.length - 2], this.lastChar[1] = f[f.length - 1]), f.toString("base64", T, f.length - P));
2607
+ }
2608
+ function b(f) {
2609
+ var T = f && f.length ? this.write(f) : "";
2610
+ return this.lastNeed ? T + this.lastChar.toString("base64", 0, 3 - this.lastNeed) : T;
2611
+ }
2612
+ function n(f) {
2613
+ return f.toString(this.encoding);
2614
+ }
2615
+ function h(f) {
2616
+ return f && f.length ? this.write(f) : "";
2617
+ }
2618
+ var y = R("safe-buffer").Buffer, k = y.isEncoding || function(f) {
2619
+ switch (f = "" + f, f && f.toLowerCase()) {
2620
+ case "hex":
2621
+ case "utf8":
2622
+ case "utf-8":
2623
+ case "ascii":
2624
+ case "binary":
2625
+ case "base64":
2626
+ case "ucs2":
2627
+ case "ucs-2":
2628
+ case "utf16le":
2629
+ case "utf-16le":
2630
+ case "raw":
2631
+ return !0;
2632
+ default:
2633
+ return !1;
2634
+ }
2635
+ };
2636
+ _.StringDecoder = O, O.prototype.write = function(f) {
2637
+ if (f.length === 0) return "";
2638
+ var T, P;
2639
+ if (this.lastNeed) {
2640
+ if (T = this.fillLast(f), T === void 0) return "";
2641
+ P = this.lastNeed, this.lastNeed = 0;
2642
+ } else P = 0;
2643
+ return P < f.length ? T ? T + this.text(f, P) : this.text(f, P) : T || "";
2644
+ }, O.prototype.end = function(f) {
2645
+ var T = f && f.length ? this.write(f) : "";
2646
+ return this.lastNeed ? T + "�" : T;
2647
+ }, O.prototype.text = function(f, T) {
2648
+ var P = l(this, f, T);
2649
+ if (!this.lastNeed) return f.toString("utf8", T);
2650
+ this.lastTotal = P;
2651
+ var p = f.length - (P - this.lastNeed);
2652
+ return f.copy(this.lastChar, 0, p), f.toString("utf8", T, p);
2653
+ }, O.prototype.fillLast = function(f) {
2654
+ return this.lastNeed <= f.length ? (f.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed), this.lastChar.toString(this.encoding, 0, this.lastTotal)) : (f.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, f.length), void (this.lastNeed -= f.length));
2655
+ };
2656
+ }, { "safe-buffer": 30 }],
2657
+ 32: [function(R, M) {
2658
+ (function(_) {
2659
+ (function() {
2660
+ function c(S) {
2661
+ try {
2662
+ if (!_.localStorage) return !1;
2663
+ } catch {
2664
+ return !1;
2665
+ }
2666
+ var O = _.localStorage[S];
2667
+ return O != null && (O + "").toLowerCase() === "true";
2668
+ }
2669
+ M.exports = function(S, O) {
2670
+ function i() {
2671
+ if (!l) {
2672
+ if (c("throwDeprecation")) throw new Error(O);
2673
+ c("traceDeprecation") ? console.trace(O) : console.warn(O), l = !0;
2674
+ }
2675
+ return S.apply(this, arguments);
2676
+ }
2677
+ if (c("noDeprecation")) return S;
2678
+ var l = !1;
2679
+ return i;
2680
+ };
2681
+ }).call(this);
2682
+ }).call(this, typeof global > "u" ? typeof self > "u" ? typeof window > "u" ? {} : window : self : global);
2683
+ }, {}],
2684
+ "/": [function(R, M) {
2685
+ function _(b) {
2686
+ return b.replace(/a=ice-options:trickle\s\n/g, "");
2687
+ }
2688
+ function c(b) {
2689
+ console.warn(b);
2690
+ }
2691
+ const S = R("debug")("simple-peer"), O = R("get-browser-rtc"), i = R("randombytes"), l = R("readable-stream"), d = R("queue-microtask"), a = R("err-code"), { Buffer: g } = R("buffer"), L = 65536;
2692
+ class w extends l.Duplex {
2693
+ constructor(n) {
2694
+ if (n = Object.assign({ allowHalfOpen: !1 }, n), super(n), this._id = i(4).toString("hex").slice(0, 7), this._debug("new peer %o", n), this.channelName = n.initiator ? n.channelName || i(20).toString("hex") : null, this.initiator = n.initiator || !1, this.channelConfig = n.channelConfig || w.channelConfig, this.channelNegotiated = this.channelConfig.negotiated, this.config = Object.assign({}, w.config, n.config), this.offerOptions = n.offerOptions || {}, this.answerOptions = n.answerOptions || {}, this.sdpTransform = n.sdpTransform || ((h) => h), this.streams = n.streams || (n.stream ? [n.stream] : []), this.trickle = n.trickle === void 0 || n.trickle, this.allowHalfTrickle = n.allowHalfTrickle !== void 0 && n.allowHalfTrickle, this.iceCompleteTimeout = n.iceCompleteTimeout || 5e3, this.destroyed = !1, this.destroying = !1, this._connected = !1, this.remoteAddress = void 0, this.remoteFamily = void 0, this.remotePort = void 0, this.localAddress = void 0, this.localFamily = void 0, this.localPort = void 0, this._wrtc = n.wrtc && typeof n.wrtc == "object" ? n.wrtc : O(), !this._wrtc) throw a(typeof window > "u" ? /* @__PURE__ */ new Error("No WebRTC support: Specify `opts.wrtc` option in this environment") : /* @__PURE__ */ new Error("No WebRTC support: Not a supported browser"), "ERR_WEBRTC_SUPPORT");
2695
+ this._pcReady = !1, this._channelReady = !1, this._iceComplete = !1, this._iceCompleteTimer = null, this._channel = null, this._pendingCandidates = [], this._isNegotiating = !1, this._firstNegotiation = !0, this._batchedNegotiation = !1, this._queuedNegotiation = !1, this._sendersAwaitingStable = [], this._senderMap = /* @__PURE__ */ new Map(), this._closingInterval = null, this._remoteTracks = [], this._remoteStreams = [], this._chunk = null, this._cb = null, this._interval = null;
2696
+ try {
2697
+ this._pc = new this._wrtc.RTCPeerConnection(this.config);
2698
+ } catch (h) {
2699
+ this.destroy(a(h, "ERR_PC_CONSTRUCTOR"));
2700
+ return;
2701
+ }
2702
+ this._isReactNativeWebrtc = typeof this._pc._peerConnectionId == "number", this._pc.oniceconnectionstatechange = () => {
2703
+ this._onIceStateChange();
2704
+ }, this._pc.onicegatheringstatechange = () => {
2705
+ this._onIceStateChange();
2706
+ }, this._pc.onconnectionstatechange = () => {
2707
+ this._onConnectionStateChange();
2708
+ }, this._pc.onsignalingstatechange = () => {
2709
+ this._onSignalingStateChange();
2710
+ }, this._pc.onicecandidate = (h) => {
2711
+ this._onIceCandidate(h);
2712
+ }, typeof this._pc.peerIdentity == "object" && this._pc.peerIdentity.catch((h) => {
2713
+ this.destroy(a(h, "ERR_PC_PEER_IDENTITY"));
2714
+ }), this.initiator || this.channelNegotiated ? this._setupData({ channel: this._pc.createDataChannel(this.channelName, this.channelConfig) }) : this._pc.ondatachannel = (h) => {
2715
+ this._setupData(h);
2716
+ }, this.streams && this.streams.forEach((h) => {
2717
+ this.addStream(h);
2718
+ }), this._pc.ontrack = (h) => {
2719
+ this._onTrack(h);
2720
+ }, this._debug("initial negotiation"), this._needsNegotiation(), this._onFinishBound = () => {
2721
+ this._onFinish();
2722
+ }, this.once("finish", this._onFinishBound);
2723
+ }
2724
+ get bufferSize() {
2725
+ return this._channel && this._channel.bufferedAmount || 0;
2726
+ }
2727
+ get connected() {
2728
+ return this._connected && this._channel.readyState === "open";
2729
+ }
2730
+ address() {
2731
+ return {
2732
+ port: this.localPort,
2733
+ family: this.localFamily,
2734
+ address: this.localAddress
2735
+ };
2736
+ }
2737
+ signal(n) {
2738
+ if (!this.destroying) {
2739
+ if (this.destroyed) throw a(/* @__PURE__ */ new Error("cannot signal after peer is destroyed"), "ERR_DESTROYED");
2740
+ if (typeof n == "string") try {
2741
+ n = JSON.parse(n);
2742
+ } catch {
2743
+ n = {};
2744
+ }
2745
+ this._debug("signal()"), n.renegotiate && this.initiator && (this._debug("got request to renegotiate"), this._needsNegotiation()), n.transceiverRequest && this.initiator && (this._debug("got request for transceiver"), this.addTransceiver(n.transceiverRequest.kind, n.transceiverRequest.init)), n.candidate && (this._pc.remoteDescription && this._pc.remoteDescription.type ? this._addIceCandidate(n.candidate) : this._pendingCandidates.push(n.candidate)), n.sdp && this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(n)).then(() => {
2746
+ this.destroyed || (this._pendingCandidates.forEach((h) => {
2747
+ this._addIceCandidate(h);
2748
+ }), this._pendingCandidates = [], this._pc.remoteDescription.type === "offer" && this._createAnswer());
2749
+ }).catch((h) => {
2750
+ this.destroy(a(h, "ERR_SET_REMOTE_DESCRIPTION"));
2751
+ }), n.sdp || n.candidate || n.renegotiate || n.transceiverRequest || this.destroy(a(/* @__PURE__ */ new Error("signal() called with invalid signal data"), "ERR_SIGNALING"));
2752
+ }
2753
+ }
2754
+ _addIceCandidate(n) {
2755
+ const h = new this._wrtc.RTCIceCandidate(n);
2756
+ this._pc.addIceCandidate(h).catch((y) => {
2757
+ !h.address || h.address.endsWith(".local") ? c("Ignoring unsupported ICE candidate.") : this.destroy(a(y, "ERR_ADD_ICE_CANDIDATE"));
2758
+ });
2759
+ }
2760
+ send(n) {
2761
+ if (!this.destroying) {
2762
+ if (this.destroyed) throw a(/* @__PURE__ */ new Error("cannot send after peer is destroyed"), "ERR_DESTROYED");
2763
+ this._channel.send(n);
2764
+ }
2765
+ }
2766
+ addTransceiver(n, h) {
2767
+ if (!this.destroying) {
2768
+ if (this.destroyed) throw a(/* @__PURE__ */ new Error("cannot addTransceiver after peer is destroyed"), "ERR_DESTROYED");
2769
+ if (this._debug("addTransceiver()"), this.initiator) try {
2770
+ this._pc.addTransceiver(n, h), this._needsNegotiation();
2771
+ } catch (y) {
2772
+ this.destroy(a(y, "ERR_ADD_TRANSCEIVER"));
2773
+ }
2774
+ else this.emit("signal", {
2775
+ type: "transceiverRequest",
2776
+ transceiverRequest: {
2777
+ kind: n,
2778
+ init: h
2779
+ }
2780
+ });
2781
+ }
2782
+ }
2783
+ addStream(n) {
2784
+ if (!this.destroying) {
2785
+ if (this.destroyed) throw a(/* @__PURE__ */ new Error("cannot addStream after peer is destroyed"), "ERR_DESTROYED");
2786
+ this._debug("addStream()"), n.getTracks().forEach((h) => {
2787
+ this.addTrack(h, n);
2788
+ });
2789
+ }
2790
+ }
2791
+ addTrack(n, h) {
2792
+ if (this.destroying) return;
2793
+ if (this.destroyed) throw a(/* @__PURE__ */ new Error("cannot addTrack after peer is destroyed"), "ERR_DESTROYED");
2794
+ this._debug("addTrack()");
2795
+ const y = this._senderMap.get(n) || /* @__PURE__ */ new Map();
2796
+ let k = y.get(h);
2797
+ if (!k) k = this._pc.addTrack(n, h), y.set(h, k), this._senderMap.set(n, y), this._needsNegotiation();
2798
+ else throw k.removed ? a(/* @__PURE__ */ new Error("Track has been removed. You should enable/disable tracks that you want to re-add."), "ERR_SENDER_REMOVED") : a(/* @__PURE__ */ new Error("Track has already been added to that stream."), "ERR_SENDER_ALREADY_ADDED");
2799
+ }
2800
+ replaceTrack(n, h, y) {
2801
+ if (this.destroying) return;
2802
+ if (this.destroyed) throw a(/* @__PURE__ */ new Error("cannot replaceTrack after peer is destroyed"), "ERR_DESTROYED");
2803
+ this._debug("replaceTrack()");
2804
+ const k = this._senderMap.get(n), f = k ? k.get(y) : null;
2805
+ if (!f) throw a(/* @__PURE__ */ new Error("Cannot replace track that was never added."), "ERR_TRACK_NOT_ADDED");
2806
+ h && this._senderMap.set(h, k), f.replaceTrack == null ? this.destroy(a(/* @__PURE__ */ new Error("replaceTrack is not supported in this browser"), "ERR_UNSUPPORTED_REPLACETRACK")) : f.replaceTrack(h);
2807
+ }
2808
+ removeTrack(n, h) {
2809
+ if (this.destroying) return;
2810
+ if (this.destroyed) throw a(/* @__PURE__ */ new Error("cannot removeTrack after peer is destroyed"), "ERR_DESTROYED");
2811
+ this._debug("removeSender()");
2812
+ const y = this._senderMap.get(n), k = y ? y.get(h) : null;
2813
+ if (!k) throw a(/* @__PURE__ */ new Error("Cannot remove track that was never added."), "ERR_TRACK_NOT_ADDED");
2814
+ try {
2815
+ k.removed = !0, this._pc.removeTrack(k);
2816
+ } catch (f) {
2817
+ f.name === "NS_ERROR_UNEXPECTED" ? this._sendersAwaitingStable.push(k) : this.destroy(a(f, "ERR_REMOVE_TRACK"));
2818
+ }
2819
+ this._needsNegotiation();
2820
+ }
2821
+ removeStream(n) {
2822
+ if (!this.destroying) {
2823
+ if (this.destroyed) throw a(/* @__PURE__ */ new Error("cannot removeStream after peer is destroyed"), "ERR_DESTROYED");
2824
+ this._debug("removeSenders()"), n.getTracks().forEach((h) => {
2825
+ this.removeTrack(h, n);
2826
+ });
2827
+ }
2828
+ }
2829
+ _needsNegotiation() {
2830
+ this._debug("_needsNegotiation"), this._batchedNegotiation || (this._batchedNegotiation = !0, d(() => {
2831
+ this._batchedNegotiation = !1, this.initiator || !this._firstNegotiation ? (this._debug("starting batched negotiation"), this.negotiate()) : this._debug("non-initiator initial negotiation request discarded"), this._firstNegotiation = !1;
2832
+ }));
2833
+ }
2834
+ negotiate() {
2835
+ if (!this.destroying) {
2836
+ if (this.destroyed) throw a(/* @__PURE__ */ new Error("cannot negotiate after peer is destroyed"), "ERR_DESTROYED");
2837
+ this.initiator ? this._isNegotiating ? (this._queuedNegotiation = !0, this._debug("already negotiating, queueing")) : (this._debug("start negotiation"), setTimeout(() => {
2838
+ this._createOffer();
2839
+ }, 0)) : this._isNegotiating ? (this._queuedNegotiation = !0, this._debug("already negotiating, queueing")) : (this._debug("requesting negotiation from initiator"), this.emit("signal", {
2840
+ type: "renegotiate",
2841
+ renegotiate: !0
2842
+ })), this._isNegotiating = !0;
2843
+ }
2844
+ }
2845
+ destroy(n) {
2846
+ this._destroy(n, () => {
2847
+ });
2848
+ }
2849
+ _destroy(n, h) {
2850
+ this.destroyed || this.destroying || (this.destroying = !0, this._debug("destroying (error: %s)", n && (n.message || n)), d(() => {
2851
+ if (this.destroyed = !0, this.destroying = !1, this._debug("destroy (error: %s)", n && (n.message || n)), this.readable = this.writable = !1, this._readableState.ended || this.push(null), this._writableState.finished || this.end(), this._connected = !1, this._pcReady = !1, this._channelReady = !1, this._remoteTracks = null, this._remoteStreams = null, this._senderMap = null, clearInterval(this._closingInterval), this._closingInterval = null, clearInterval(this._interval), this._interval = null, this._chunk = null, this._cb = null, this._onFinishBound && this.removeListener("finish", this._onFinishBound), this._onFinishBound = null, this._channel) {
2852
+ try {
2853
+ this._channel.close();
2854
+ } catch {
2855
+ }
2856
+ this._channel.onmessage = null, this._channel.onopen = null, this._channel.onclose = null, this._channel.onerror = null;
2857
+ }
2858
+ if (this._pc) {
2859
+ try {
2860
+ this._pc.close();
2861
+ } catch {
2862
+ }
2863
+ this._pc.oniceconnectionstatechange = null, this._pc.onicegatheringstatechange = null, this._pc.onsignalingstatechange = null, this._pc.onicecandidate = null, this._pc.ontrack = null, this._pc.ondatachannel = null;
2864
+ }
2865
+ this._pc = null, this._channel = null, n && this.emit("error", n), this.emit("close"), h();
2866
+ }));
2867
+ }
2868
+ _setupData(n) {
2869
+ if (!n.channel) return this.destroy(a(/* @__PURE__ */ new Error("Data channel event is missing `channel` property"), "ERR_DATA_CHANNEL"));
2870
+ this._channel = n.channel, this._channel.binaryType = "arraybuffer", typeof this._channel.bufferedAmountLowThreshold == "number" && (this._channel.bufferedAmountLowThreshold = L), this.channelName = this._channel.label, this._channel.onmessage = (y) => {
2871
+ this._onChannelMessage(y);
2872
+ }, this._channel.onbufferedamountlow = () => {
2873
+ this._onChannelBufferedAmountLow();
2874
+ }, this._channel.onopen = () => {
2875
+ this._onChannelOpen();
2876
+ }, this._channel.onclose = () => {
2877
+ this._onChannelClose();
2878
+ }, this._channel.onerror = (y) => {
2879
+ const k = y.error instanceof Error ? y.error : /* @__PURE__ */ new Error(`Datachannel error: ${y.message} ${y.filename}:${y.lineno}:${y.colno}`);
2880
+ this.destroy(a(k, "ERR_DATA_CHANNEL"));
2881
+ };
2882
+ let h = !1;
2883
+ this._closingInterval = setInterval(() => {
2884
+ this._channel && this._channel.readyState === "closing" ? (h && this._onChannelClose(), h = !0) : h = !1;
2885
+ }, 5e3);
2886
+ }
2887
+ _read() {
2888
+ }
2889
+ _write(n, h, y) {
2890
+ if (this.destroyed) return y(a(/* @__PURE__ */ new Error("cannot write after peer is destroyed"), "ERR_DATA_CHANNEL"));
2891
+ if (this._connected) {
2892
+ try {
2893
+ this.send(n);
2894
+ } catch (k) {
2895
+ return this.destroy(a(k, "ERR_DATA_CHANNEL"));
2896
+ }
2897
+ this._channel.bufferedAmount > L ? (this._debug("start backpressure: bufferedAmount %d", this._channel.bufferedAmount), this._cb = y) : y(null);
2898
+ } else this._debug("write before connect"), this._chunk = n, this._cb = y;
2899
+ }
2900
+ _onFinish() {
2901
+ if (!this.destroyed) {
2902
+ const n = () => {
2903
+ setTimeout(() => this.destroy(), 1e3);
2904
+ };
2905
+ this._connected ? n() : this.once("connect", n);
2906
+ }
2907
+ }
2908
+ _startIceCompleteTimeout() {
2909
+ this.destroyed || this._iceCompleteTimer || (this._debug("started iceComplete timeout"), this._iceCompleteTimer = setTimeout(() => {
2910
+ this._iceComplete || (this._iceComplete = !0, this._debug("iceComplete timeout completed"), this.emit("iceTimeout"), this.emit("_iceComplete"));
2911
+ }, this.iceCompleteTimeout));
2912
+ }
2913
+ _createOffer() {
2914
+ this.destroyed || this._pc.createOffer(this.offerOptions).then((n) => {
2915
+ if (this.destroyed) return;
2916
+ this.trickle || this.allowHalfTrickle || (n.sdp = _(n.sdp)), n.sdp = this.sdpTransform(n.sdp);
2917
+ const h = () => {
2918
+ if (!this.destroyed) {
2919
+ const y = this._pc.localDescription || n;
2920
+ this._debug("signal"), this.emit("signal", {
2921
+ type: y.type,
2922
+ sdp: y.sdp
2923
+ });
2924
+ }
2925
+ };
2926
+ this._pc.setLocalDescription(n).then(() => {
2927
+ this._debug("createOffer success"), this.destroyed || (this.trickle || this._iceComplete ? h() : this.once("_iceComplete", h));
2928
+ }).catch((y) => {
2929
+ this.destroy(a(y, "ERR_SET_LOCAL_DESCRIPTION"));
2930
+ });
2931
+ }).catch((n) => {
2932
+ this.destroy(a(n, "ERR_CREATE_OFFER"));
2933
+ });
2934
+ }
2935
+ _requestMissingTransceivers() {
2936
+ this._pc.getTransceivers && this._pc.getTransceivers().forEach((n) => {
2937
+ n.mid || !n.sender.track || n.requested || (n.requested = !0, this.addTransceiver(n.sender.track.kind));
2938
+ });
2939
+ }
2940
+ _createAnswer() {
2941
+ this.destroyed || this._pc.createAnswer(this.answerOptions).then((n) => {
2942
+ if (this.destroyed) return;
2943
+ this.trickle || this.allowHalfTrickle || (n.sdp = _(n.sdp)), n.sdp = this.sdpTransform(n.sdp);
2944
+ const h = () => {
2945
+ if (!this.destroyed) {
2946
+ const y = this._pc.localDescription || n;
2947
+ this._debug("signal"), this.emit("signal", {
2948
+ type: y.type,
2949
+ sdp: y.sdp
2950
+ }), this.initiator || this._requestMissingTransceivers();
2951
+ }
2952
+ };
2953
+ this._pc.setLocalDescription(n).then(() => {
2954
+ this.destroyed || (this.trickle || this._iceComplete ? h() : this.once("_iceComplete", h));
2955
+ }).catch((y) => {
2956
+ this.destroy(a(y, "ERR_SET_LOCAL_DESCRIPTION"));
2957
+ });
2958
+ }).catch((n) => {
2959
+ this.destroy(a(n, "ERR_CREATE_ANSWER"));
2960
+ });
2961
+ }
2962
+ _onConnectionStateChange() {
2963
+ this.destroyed || this._pc.connectionState === "failed" && this.destroy(a(/* @__PURE__ */ new Error("Connection failed."), "ERR_CONNECTION_FAILURE"));
2964
+ }
2965
+ _onIceStateChange() {
2966
+ if (this.destroyed) return;
2967
+ const n = this._pc.iceConnectionState, h = this._pc.iceGatheringState;
2968
+ this._debug("iceStateChange (connection: %s) (gathering: %s)", n, h), this.emit("iceStateChange", n, h), (n === "connected" || n === "completed") && (this._pcReady = !0, this._maybeReady()), n === "failed" && this.destroy(a(/* @__PURE__ */ new Error("Ice connection failed."), "ERR_ICE_CONNECTION_FAILURE")), n === "closed" && this.destroy(a(/* @__PURE__ */ new Error("Ice connection closed."), "ERR_ICE_CONNECTION_CLOSED"));
2969
+ }
2970
+ getStats(n) {
2971
+ const h = (y) => (Object.prototype.toString.call(y.values) === "[object Array]" && y.values.forEach((k) => {
2972
+ Object.assign(y, k);
2973
+ }), y);
2974
+ this._pc.getStats.length === 0 || this._isReactNativeWebrtc ? this._pc.getStats().then((y) => {
2975
+ const k = [];
2976
+ y.forEach((f) => {
2977
+ k.push(h(f));
2978
+ }), n(null, k);
2979
+ }, (y) => n(y)) : 0 < this._pc.getStats.length ? this._pc.getStats((y) => {
2980
+ if (this.destroyed) return;
2981
+ const k = [];
2982
+ y.result().forEach((f) => {
2983
+ const T = {};
2984
+ f.names().forEach((P) => {
2985
+ T[P] = f.stat(P);
2986
+ }), T.id = f.id, T.type = f.type, T.timestamp = f.timestamp, k.push(h(T));
2987
+ }), n(null, k);
2988
+ }, (y) => n(y)) : n(null, []);
2989
+ }
2990
+ _maybeReady() {
2991
+ if (this._debug("maybeReady pc %s channel %s", this._pcReady, this._channelReady), this._connected || this._connecting || !this._pcReady || !this._channelReady) return;
2992
+ this._connecting = !0;
2993
+ const n = () => {
2994
+ this.destroyed || this.getStats((h, y) => {
2995
+ if (this.destroyed) return;
2996
+ h && (y = []);
2997
+ const k = {}, f = {}, T = {};
2998
+ let P = !1;
2999
+ y.forEach((v) => {
3000
+ (v.type === "remotecandidate" || v.type === "remote-candidate") && (k[v.id] = v), (v.type === "localcandidate" || v.type === "local-candidate") && (f[v.id] = v), (v.type === "candidatepair" || v.type === "candidate-pair") && (T[v.id] = v);
3001
+ });
3002
+ const p = (v) => {
3003
+ P = !0;
3004
+ let I = f[v.localCandidateId];
3005
+ I && (I.ip || I.address) ? (this.localAddress = I.ip || I.address, this.localPort = +I.port) : I && I.ipAddress ? (this.localAddress = I.ipAddress, this.localPort = +I.portNumber) : typeof v.googLocalAddress == "string" && (I = v.googLocalAddress.split(":"), this.localAddress = I[0], this.localPort = +I[1]), this.localAddress && (this.localFamily = this.localAddress.includes(":") ? "IPv6" : "IPv4");
3006
+ let B = k[v.remoteCandidateId];
3007
+ B && (B.ip || B.address) ? (this.remoteAddress = B.ip || B.address, this.remotePort = +B.port) : B && B.ipAddress ? (this.remoteAddress = B.ipAddress, this.remotePort = +B.portNumber) : typeof v.googRemoteAddress == "string" && (B = v.googRemoteAddress.split(":"), this.remoteAddress = B[0], this.remotePort = +B[1]), this.remoteAddress && (this.remoteFamily = this.remoteAddress.includes(":") ? "IPv6" : "IPv4"), this._debug("connect local: %s:%s remote: %s:%s", this.localAddress, this.localPort, this.remoteAddress, this.remotePort);
3008
+ };
3009
+ if (y.forEach((v) => {
3010
+ v.type === "transport" && v.selectedCandidatePairId && p(T[v.selectedCandidatePairId]), (v.type === "googCandidatePair" && v.googActiveConnection === "true" || (v.type === "candidatepair" || v.type === "candidate-pair") && v.selected) && p(v);
3011
+ }), !P && (!Object.keys(T).length || Object.keys(f).length)) return void setTimeout(n, 100);
3012
+ if (this._connecting = !1, this._connected = !0, this._chunk) {
3013
+ try {
3014
+ this.send(this._chunk);
3015
+ } catch (I) {
3016
+ return this.destroy(a(I, "ERR_DATA_CHANNEL"));
3017
+ }
3018
+ this._chunk = null, this._debug('sent chunk from "write before connect"');
3019
+ const v = this._cb;
3020
+ this._cb = null, v(null);
3021
+ }
3022
+ typeof this._channel.bufferedAmountLowThreshold != "number" && (this._interval = setInterval(() => this._onInterval(), 150), this._interval.unref && this._interval.unref()), this._debug("connect"), this.emit("connect");
3023
+ });
3024
+ };
3025
+ n();
3026
+ }
3027
+ _onInterval() {
3028
+ this._cb && this._channel && !(this._channel.bufferedAmount > L) && this._onChannelBufferedAmountLow();
3029
+ }
3030
+ _onSignalingStateChange() {
3031
+ this.destroyed || (this._pc.signalingState === "stable" && (this._isNegotiating = !1, this._debug("flushing sender queue", this._sendersAwaitingStable), this._sendersAwaitingStable.forEach((n) => {
3032
+ this._pc.removeTrack(n), this._queuedNegotiation = !0;
3033
+ }), this._sendersAwaitingStable = [], this._queuedNegotiation ? (this._debug("flushing negotiation queue"), this._queuedNegotiation = !1, this._needsNegotiation()) : (this._debug("negotiated"), this.emit("negotiated"))), this._debug("signalingStateChange %s", this._pc.signalingState), this.emit("signalingStateChange", this._pc.signalingState));
3034
+ }
3035
+ _onIceCandidate(n) {
3036
+ this.destroyed || (n.candidate && this.trickle ? this.emit("signal", {
3037
+ type: "candidate",
3038
+ candidate: {
3039
+ candidate: n.candidate.candidate,
3040
+ sdpMLineIndex: n.candidate.sdpMLineIndex,
3041
+ sdpMid: n.candidate.sdpMid
3042
+ }
3043
+ }) : !n.candidate && !this._iceComplete && (this._iceComplete = !0, this.emit("_iceComplete")), n.candidate && this._startIceCompleteTimeout());
3044
+ }
3045
+ _onChannelMessage(n) {
3046
+ if (this.destroyed) return;
3047
+ let h = n.data;
3048
+ h instanceof ArrayBuffer && (h = g.from(h)), this.push(h);
3049
+ }
3050
+ _onChannelBufferedAmountLow() {
3051
+ if (!this.destroyed && this._cb) {
3052
+ this._debug("ending backpressure: bufferedAmount %d", this._channel.bufferedAmount);
3053
+ const n = this._cb;
3054
+ this._cb = null, n(null);
3055
+ }
3056
+ }
3057
+ _onChannelOpen() {
3058
+ this._connected || this.destroyed || (this._debug("on channel open"), this._channelReady = !0, this._maybeReady());
3059
+ }
3060
+ _onChannelClose() {
3061
+ this.destroyed || (this._debug("on channel close"), this.destroy());
3062
+ }
3063
+ _onTrack(n) {
3064
+ this.destroyed || n.streams.forEach((h) => {
3065
+ this._debug("on track"), this.emit("track", n.track, h), this._remoteTracks.push({
3066
+ track: n.track,
3067
+ stream: h
3068
+ }), this._remoteStreams.some((y) => y.id === h.id) || (this._remoteStreams.push(h), d(() => {
3069
+ this._debug("on stream"), this.emit("stream", h);
3070
+ }));
3071
+ });
3072
+ }
3073
+ _debug() {
3074
+ const n = [].slice.call(arguments);
3075
+ n[0] = "[" + this._id + "] " + n[0], S.apply(null, n);
3076
+ }
3077
+ }
3078
+ w.WEBRTC_SUPPORT = !!O(), w.config = {
3079
+ iceServers: [{ urls: ["stun:stun.l.google.com:19302", "stun:global.stun.twilio.com:3478"] }],
3080
+ sdpSemantics: "unified-plan"
3081
+ }, w.channelConfig = {}, M.exports = w;
3082
+ }, {
3083
+ buffer: 3,
3084
+ debug: 4,
3085
+ "err-code": 6,
3086
+ "get-browser-rtc": 8,
3087
+ "queue-microtask": 13,
3088
+ randombytes: 14,
3089
+ "readable-stream": 29
3090
+ }]
3091
+ }, {}, [])("/");
3092
+ });
3093
+ })), Ht = /* @__PURE__ */ jt(Wt(), 1), Vt = (m, x) => {
3094
+ const j = ze(m).buffer, U = ze(x).buffer;
3095
+ return crypto.subtle.importKey("raw", j, "PBKDF2", !1, ["deriveKey"]).then((F) => crypto.subtle.deriveKey({
3096
+ name: "PBKDF2",
3097
+ salt: U,
3098
+ iterations: 1e5,
3099
+ hash: "SHA-256"
3100
+ }, F, {
3101
+ name: "AES-GCM",
3102
+ length: 256
3103
+ }, !0, ["encrypt", "decrypt"]));
3104
+ }, tt = (m, x) => {
3105
+ if (!x) return We(m);
3106
+ const j = crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(12));
3107
+ return crypto.subtle.encrypt({
3108
+ name: "AES-GCM",
3109
+ iv: j
3110
+ }, x, m).then((U) => {
3111
+ const F = re();
3112
+ return Fe(F, "AES-GCM"), Re(F, j), Re(F, new Uint8Array(U)), ie(F);
3113
+ });
3114
+ }, Yt = (m, x) => {
3115
+ const j = re();
3116
+ return yt(j, m), tt(ie(j), x);
3117
+ }, rt = (m, x) => {
3118
+ if (!x) return We(m);
3119
+ const j = qe(m);
3120
+ Ze(j) !== "AES-GCM" && St(Xe("Unknown encryption algorithm"));
3121
+ const U = De(j), F = De(j);
3122
+ return crypto.subtle.decrypt({
3123
+ name: "AES-GCM",
3124
+ iv: U
3125
+ }, x, F).then((R) => new Uint8Array(R));
3126
+ }, zt = (m, x) => rt(m, x).then((j) => At(qe(new Uint8Array(j)))), ne = Rt("y-webrtc"), Ce = 0, nt = 3, Ae = 1, He = 4, Ne = /* @__PURE__ */ new Map(), we = /* @__PURE__ */ new Map(), it = (m) => {
3127
+ let x = !0;
3128
+ m.webrtcConns.forEach((j) => {
3129
+ j.synced || (x = !1);
3130
+ }), (!x && m.synced || x && !m.synced) && (m.synced = x, m.provider.emit("synced", [{ synced: x }]), ne("synced ", ue, m.name, Te, " with all peers"));
3131
+ }, st = (m, x, j) => {
3132
+ const U = qe(x), F = re(), R = kt(U);
3133
+ if (m === void 0) return null;
3134
+ const M = m.awareness, _ = m.doc;
3135
+ let c = !1;
3136
+ switch (R) {
3137
+ case Ce: {
3138
+ se(F, Ce);
3139
+ const S = at(U, F, _, m);
3140
+ S === 1 && !m.synced && j(), S === 0 && (c = !0);
3141
+ break;
3142
+ }
3143
+ case nt:
3144
+ se(F, Ae), Re(F, Oe(M, Array.from(M.getStates().keys()))), c = !0;
3145
+ break;
3146
+ case Ae:
3147
+ ht(M, De(U), m);
3148
+ break;
3149
+ case He: {
3150
+ const S = Ot(U) === 1, O = Ze(U);
3151
+ if (O !== m.peerId && (m.bcConns.has(O) && !S || !m.bcConns.has(O) && S)) {
3152
+ const i = [], l = [];
3153
+ S ? (m.bcConns.add(O), l.push(O)) : (m.bcConns.delete(O), i.push(O)), m.provider.emit("peers", [{
3154
+ added: l,
3155
+ removed: i,
3156
+ webrtcPeers: Array.from(m.webrtcConns.keys()),
3157
+ bcPeers: Array.from(m.bcConns)
3158
+ }]), ot(m);
3159
+ }
3160
+ break;
3161
+ }
3162
+ default:
3163
+ return console.error("Unable to compute message"), F;
3164
+ }
3165
+ return c ? F : null;
3166
+ }, Gt = (m, x) => {
3167
+ const j = m.room;
3168
+ return ne("received message from ", ue, m.remotePeerId, Qe, " (", j.name, ")", Te, et), st(j, x, () => {
3169
+ m.synced = !0, ne("synced ", ue, j.name, Te, " with ", ue, m.remotePeerId), it(j);
3170
+ });
3171
+ }, Ie = (m, x) => {
3172
+ ne("send message to ", ue, m.remotePeerId, Te, Qe, " (", m.room.name, ")", et);
3173
+ try {
3174
+ m.peer.send(ie(x));
3175
+ } catch {
3176
+ }
3177
+ }, Kt = (m, x) => {
3178
+ ne("broadcast message in ", ue, m.name, Te), m.webrtcConns.forEach((j) => {
3179
+ try {
3180
+ j.peer.send(x);
3181
+ } catch {
3182
+ }
3183
+ });
3184
+ }, Ge = class {
3185
+ constructor(m, x, j, U) {
3186
+ ne("establishing connection to ", ue, j), this.room = U, this.remotePeerId = j, this.glareToken = void 0, this.closed = !1, this.connected = !1, this.synced = !1, this.peer = new Ht.default({
3187
+ initiator: x,
3188
+ ...U.provider.peerOpts
3189
+ }), this.peer.on("signal", (F) => {
3190
+ this.glareToken === void 0 && (this.glareToken = Date.now() + Math.random()), Ve(m, U, {
3191
+ to: j,
3192
+ from: U.peerId,
3193
+ type: "signal",
3194
+ token: this.glareToken,
3195
+ signal: F
3196
+ });
3197
+ }), this.peer.on("connect", () => {
3198
+ ne("connected to ", ue, j), this.connected = !0;
3199
+ const F = U.provider.doc, R = U.awareness, M = re();
3200
+ se(M, Ce), $e(M, F), Ie(this, M);
3201
+ const _ = R.getStates();
3202
+ if (_.size > 0) {
3203
+ const c = re();
3204
+ se(c, Ae), Re(c, Oe(R, Array.from(_.keys()))), Ie(this, c);
3205
+ }
3206
+ }), this.peer.on("close", () => {
3207
+ this.connected = !1, this.closed = !0, U.webrtcConns.has(this.remotePeerId) && (U.webrtcConns.delete(this.remotePeerId), U.provider.emit("peers", [{
3208
+ removed: [this.remotePeerId],
3209
+ added: [],
3210
+ webrtcPeers: Array.from(U.webrtcConns.keys()),
3211
+ bcPeers: Array.from(U.bcConns)
3212
+ }])), it(U), this.peer.destroy(), ne("closed connection to ", ue, j), Ue(U);
3213
+ }), this.peer.on("error", (F) => {
3214
+ ne("Error in connection to ", ue, j, ": ", F), Ue(U);
3215
+ }), this.peer.on("data", (F) => {
3216
+ const R = Gt(this, F);
3217
+ R !== null && Ie(this, R);
3218
+ });
3219
+ }
3220
+ destroy() {
3221
+ this.peer.destroy();
3222
+ }
3223
+ }, be = (m, x) => tt(x, m.key).then((j) => m.mux(() => lt(m.name, j))), Ke = (m, x) => {
3224
+ m.bcconnected && be(m, x), Kt(m, x);
3225
+ }, Ue = (m) => {
3226
+ Ne.forEach((x) => {
3227
+ x.connected && (x.send({
3228
+ type: "subscribe",
3229
+ topics: [m.name]
3230
+ }), m.webrtcConns.size < m.provider.maxConns && Ve(x, m, {
3231
+ type: "announce",
3232
+ from: m.peerId
3233
+ }));
3234
+ });
3235
+ }, ot = (m) => {
3236
+ if (m.provider.filterBcConns) {
3237
+ const x = re();
3238
+ se(x, He), Je(x, 1), Fe(x, m.peerId), be(m, ie(x));
3239
+ }
3240
+ }, $t = class {
3241
+ constructor(m, x, j, U) {
3242
+ this.peerId = vt(), this.doc = m, this.awareness = x.awareness, this.provider = x, this.synced = !1, this.name = j, this.key = U, this.webrtcConns = /* @__PURE__ */ new Map(), this.bcConns = /* @__PURE__ */ new Set(), this.mux = qt(), this.bcconnected = !1, this._bcSubscriber = (F) => rt(new Uint8Array(F), U).then((R) => this.mux(() => {
3243
+ const M = st(this, R, () => {
3244
+ });
3245
+ M && be(this, ie(M));
3246
+ })), this._docUpdateHandler = (F, R) => {
3247
+ const M = re();
3248
+ se(M, Ce), ct(M, F), Ke(this, ie(M));
3249
+ }, this._awarenessUpdateHandler = ({ added: F, updated: R, removed: M }, _) => {
3250
+ const c = F.concat(R).concat(M), S = re();
3251
+ se(S, Ae), Re(S, Oe(this.awareness, c)), Ke(this, ie(S));
3252
+ }, this._beforeUnloadHandler = () => {
3253
+ Ye(this.awareness, [m.clientID], "window unload"), we.forEach((F) => {
3254
+ F.disconnect();
3255
+ });
3256
+ }, typeof window < "u" ? window.addEventListener("beforeunload", this._beforeUnloadHandler) : typeof process < "u" && process.on("exit", this._beforeUnloadHandler);
3257
+ }
3258
+ connect() {
3259
+ this.doc.on("update", this._docUpdateHandler), this.awareness.on("update", this._awarenessUpdateHandler), Ue(this);
3260
+ const m = this.name;
3261
+ pt(m, this._bcSubscriber), this.bcconnected = !0, ot(this);
3262
+ const x = re();
3263
+ se(x, Ce), $e(x, this.doc), be(this, ie(x));
3264
+ const j = re();
3265
+ se(j, Ce), ft(j, this.doc), be(this, ie(j));
3266
+ const U = re();
3267
+ se(U, nt), be(this, ie(U));
3268
+ const F = re();
3269
+ se(F, Ae), Re(F, Oe(this.awareness, [this.doc.clientID])), be(this, ie(F));
3270
+ }
3271
+ disconnect() {
3272
+ Ne.forEach((x) => {
3273
+ x.connected && x.send({
3274
+ type: "unsubscribe",
3275
+ topics: [this.name]
3276
+ });
3277
+ }), Ye(this.awareness, [this.doc.clientID], "disconnect");
3278
+ const m = re();
3279
+ se(m, He), Je(m, 0), Fe(m, this.peerId), be(this, ie(m)), ut(this.name, this._bcSubscriber), this.bcconnected = !1, this.doc.off("update", this._docUpdateHandler), this.awareness.off("update", this._awarenessUpdateHandler), this.webrtcConns.forEach((x) => x.destroy());
3280
+ }
3281
+ destroy() {
3282
+ this.disconnect(), typeof window < "u" ? window.removeEventListener("beforeunload", this._beforeUnloadHandler) : typeof process < "u" && process.off("exit", this._beforeUnloadHandler);
3283
+ }
3284
+ }, Jt = (m, x, j, U) => {
3285
+ if (we.has(j)) throw Xe(`A Yjs Doc connected to room "${j}" already exists!`);
3286
+ const F = new $t(m, x, j, U);
3287
+ return we.set(j, F), F;
3288
+ }, Ve = (m, x, j) => {
3289
+ x.key ? Yt(j, x.key).then((U) => {
3290
+ m.send({
3291
+ type: "publish",
3292
+ topic: x.name,
3293
+ data: Tt(U)
3294
+ });
3295
+ }) : m.send({
3296
+ type: "publish",
3297
+ topic: x.name,
3298
+ data: j
3299
+ });
3300
+ }, Xt = class extends Ft {
3301
+ constructor(m) {
3302
+ super(m), this.providers = /* @__PURE__ */ new Set(), this.on("connect", () => {
3303
+ ne(`connected (${m})`);
3304
+ const x = Array.from(we.keys());
3305
+ this.send({
3306
+ type: "subscribe",
3307
+ topics: x
3308
+ }), we.forEach((j) => Ve(this, j, {
3309
+ type: "announce",
3310
+ from: j.peerId
3311
+ }));
3312
+ }), this.on("message", (x) => {
3313
+ switch (x.type) {
3314
+ case "publish": {
3315
+ const j = x.topic, U = we.get(j);
3316
+ if (U == null || typeof j != "string") return;
3317
+ const F = (R) => {
3318
+ const M = U.webrtcConns, _ = U.peerId;
3319
+ if (R == null || R.from === _ || R.to !== void 0 && R.to !== _ || U.bcConns.has(R.from)) return;
3320
+ const c = M.has(R.from) ? () => {
3321
+ } : () => U.provider.emit("peers", [{
3322
+ removed: [],
3323
+ added: [R.from],
3324
+ webrtcPeers: Array.from(U.webrtcConns.keys()),
3325
+ bcPeers: Array.from(U.bcConns)
3326
+ }]);
3327
+ switch (R.type) {
3328
+ case "announce":
3329
+ M.size < U.provider.maxConns && (je(M, R.from, () => new Ge(this, !0, R.from, U)), c());
3330
+ break;
3331
+ case "signal":
3332
+ if (R.signal.type === "offer") {
3333
+ const S = M.get(R.from);
3334
+ if (S) {
3335
+ const O = R.token, i = S.glareToken;
3336
+ if (i && i > O) {
3337
+ ne("offer rejected: ", R.from);
3338
+ return;
3339
+ }
3340
+ S.glareToken = void 0;
3341
+ }
3342
+ }
3343
+ if (R.signal.type === "answer") {
3344
+ ne("offer answered by: ", R.from);
3345
+ const S = M.get(R.from);
3346
+ S.glareToken = void 0;
3347
+ }
3348
+ R.to === _ && (je(M, R.from, () => new Ge(this, !1, R.from, U)).peer.signal(R.signal), c());
3349
+ break;
3350
+ }
3351
+ };
3352
+ U.key ? typeof x.data == "string" && zt(Ct(x.data), U.key).then(F) : F(x.data);
3353
+ }
3354
+ }
3355
+ }), this.on("disconnect", () => ne(`disconnect (${m})`));
3356
+ }
3357
+ }, Me = (m) => {
3358
+ m.emit("status", [{ connected: m.connected }]);
3359
+ }, tr = class extends Et {
3360
+ constructor(m, x, { signaling: j = ["wss://y-webrtc-eu.fly.dev"], password: U = null, awareness: F = new dt(x), maxConns: R = 20 + bt(_t() * 15), filterBcConns: M = !0, peerOpts: _ = {} } = {}) {
3361
+ super(), this.roomName = m, this.doc = x, this.filterBcConns = M, this.awareness = F, this.shouldConnect = !1, this.signalingUrls = j, this.signalingConns = [], this.maxConns = R, this.peerOpts = _, this.key = U ? Vt(U, m) : We(null), this.room = null, this.key.then((c) => {
3362
+ this.room = Jt(x, this, m, c), this.shouldConnect ? this.room.connect() : this.room.disconnect(), Me(this);
3363
+ }), this.connect(), this.destroy = this.destroy.bind(this), x.on("destroy", this.destroy);
3364
+ }
3365
+ get connected() {
3366
+ return this.room !== null && this.shouldConnect;
3367
+ }
3368
+ connect() {
3369
+ this.shouldConnect = !0, this.signalingUrls.forEach((m) => {
3370
+ const x = je(Ne, m, () => new Xt(m));
3371
+ this.signalingConns.push(x), x.providers.add(this);
3372
+ }), this.room && (this.room.connect(), Me(this));
3373
+ }
3374
+ disconnect() {
3375
+ this.shouldConnect = !1, this.signalingConns.forEach((m) => {
3376
+ m.providers.delete(this), m.providers.size === 0 && (m.destroy(), Ne.delete(m.url));
3377
+ }), this.room && (this.room.disconnect(), Me(this));
3378
+ }
3379
+ destroy() {
3380
+ this.doc.off("destroy", this.destroy), this.key.then(() => {
3381
+ this.room.destroy(), we.delete(this.roomName);
3382
+ }), super.destroy();
3383
+ }
3384
+ };
3385
+ export {
3386
+ tr as WebrtcProvider,
3387
+ er as t
3388
+ };