@genai-fi/nanogpt 0.2.3 → 0.2.5

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,1023 @@
1
+ var fr = {}, O = {};
2
+ O.byteLength = Mr;
3
+ O.toByteArray = Dr;
4
+ O.fromByteArray = Or;
5
+ var _ = [], T = [], Nr = typeof Uint8Array < "u" ? Uint8Array : Array, X = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
6
+ for (var D = 0, br = X.length; D < br; ++D)
7
+ _[D] = X[D], T[X.charCodeAt(D)] = D;
8
+ T[45] = 62;
9
+ T[95] = 63;
10
+ function cr(p) {
11
+ var c = p.length;
12
+ if (c % 4 > 0)
13
+ throw new Error("Invalid string. Length must be a multiple of 4");
14
+ var a = p.indexOf("=");
15
+ a === -1 && (a = c);
16
+ var x = a === c ? 0 : 4 - a % 4;
17
+ return [a, x];
18
+ }
19
+ function Mr(p) {
20
+ var c = cr(p), a = c[0], x = c[1];
21
+ return (a + x) * 3 / 4 - x;
22
+ }
23
+ function kr(p, c, a) {
24
+ return (c + a) * 3 / 4 - a;
25
+ }
26
+ function Dr(p) {
27
+ var c, a = cr(p), x = a[0], w = a[1], f = new Nr(kr(p, x, w)), l = 0, m = w > 0 ? x - 4 : x, B;
28
+ for (B = 0; B < m; B += 4)
29
+ c = T[p.charCodeAt(B)] << 18 | T[p.charCodeAt(B + 1)] << 12 | T[p.charCodeAt(B + 2)] << 6 | T[p.charCodeAt(B + 3)], f[l++] = c >> 16 & 255, f[l++] = c >> 8 & 255, f[l++] = c & 255;
30
+ return w === 2 && (c = T[p.charCodeAt(B)] << 2 | T[p.charCodeAt(B + 1)] >> 4, f[l++] = c & 255), w === 1 && (c = T[p.charCodeAt(B)] << 10 | T[p.charCodeAt(B + 1)] << 4 | T[p.charCodeAt(B + 2)] >> 2, f[l++] = c >> 8 & 255, f[l++] = c & 255), f;
31
+ }
32
+ function Pr(p) {
33
+ return _[p >> 18 & 63] + _[p >> 12 & 63] + _[p >> 6 & 63] + _[p & 63];
34
+ }
35
+ function $r(p, c, a) {
36
+ for (var x, w = [], f = c; f < a; f += 3)
37
+ x = (p[f] << 16 & 16711680) + (p[f + 1] << 8 & 65280) + (p[f + 2] & 255), w.push(Pr(x));
38
+ return w.join("");
39
+ }
40
+ function Or(p) {
41
+ for (var c, a = p.length, x = a % 3, w = [], f = 16383, l = 0, m = a - x; l < m; l += f)
42
+ w.push($r(p, l, l + f > m ? m : l + f));
43
+ return x === 1 ? (c = p[a - 1], w.push(
44
+ _[c >> 2] + _[c << 4 & 63] + "=="
45
+ )) : x === 2 && (c = (p[a - 2] << 8) + p[a - 1], w.push(
46
+ _[c >> 10] + _[c >> 4 & 63] + _[c << 2 & 63] + "="
47
+ )), w.join("");
48
+ }
49
+ var J = {};
50
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
51
+ J.read = function(p, c, a, x, w) {
52
+ var f, l, m = w * 8 - x - 1, B = (1 << m) - 1, F = B >> 1, o = -7, A = a ? w - 1 : 0, S = a ? -1 : 1, R = p[c + A];
53
+ for (A += S, f = R & (1 << -o) - 1, R >>= -o, o += m; o > 0; f = f * 256 + p[c + A], A += S, o -= 8)
54
+ ;
55
+ for (l = f & (1 << -o) - 1, f >>= -o, o += x; o > 0; l = l * 256 + p[c + A], A += S, o -= 8)
56
+ ;
57
+ if (f === 0)
58
+ f = 1 - F;
59
+ else {
60
+ if (f === B)
61
+ return l ? NaN : (R ? -1 : 1) * (1 / 0);
62
+ l = l + Math.pow(2, x), f = f - F;
63
+ }
64
+ return (R ? -1 : 1) * l * Math.pow(2, f - x);
65
+ };
66
+ J.write = function(p, c, a, x, w, f) {
67
+ var l, m, B, F = f * 8 - w - 1, o = (1 << F) - 1, A = o >> 1, S = w === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, R = x ? 0 : f - 1, N = x ? 1 : -1, G = c < 0 || c === 0 && 1 / c < 0 ? 1 : 0;
68
+ for (c = Math.abs(c), isNaN(c) || c === 1 / 0 ? (m = isNaN(c) ? 1 : 0, l = o) : (l = Math.floor(Math.log(c) / Math.LN2), c * (B = Math.pow(2, -l)) < 1 && (l--, B *= 2), l + A >= 1 ? c += S / B : c += S * Math.pow(2, 1 - A), c * B >= 2 && (l++, B /= 2), l + A >= o ? (m = 0, l = o) : l + A >= 1 ? (m = (c * B - 1) * Math.pow(2, w), l = l + A) : (m = c * Math.pow(2, A - 1) * Math.pow(2, w), l = 0)); w >= 8; p[a + R] = m & 255, R += N, m /= 256, w -= 8)
69
+ ;
70
+ for (l = l << w | m, F += w; F > 0; p[a + R] = l & 255, R += N, l /= 256, F -= 8)
71
+ ;
72
+ p[a + R - N] |= G * 128;
73
+ };
74
+ /*!
75
+ * The buffer module from node.js, for the browser.
76
+ *
77
+ * @author Feross Aboukhadijeh <https://feross.org>
78
+ * @license MIT
79
+ */
80
+ (function(p) {
81
+ const c = O, a = J, x = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
82
+ p.Buffer = o, p.SlowBuffer = sr, p.INSPECT_MAX_BYTES = 50;
83
+ const w = 2147483647;
84
+ p.kMaxLength = w;
85
+ const { Uint8Array: f, ArrayBuffer: l, SharedArrayBuffer: m } = globalThis;
86
+ o.TYPED_ARRAY_SUPPORT = B(), !o.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
87
+ "This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
88
+ );
89
+ function B() {
90
+ try {
91
+ const i = new f(1), r = { foo: function() {
92
+ return 42;
93
+ } };
94
+ return Object.setPrototypeOf(r, f.prototype), Object.setPrototypeOf(i, r), i.foo() === 42;
95
+ } catch {
96
+ return !1;
97
+ }
98
+ }
99
+ Object.defineProperty(o.prototype, "parent", {
100
+ enumerable: !0,
101
+ get: function() {
102
+ if (o.isBuffer(this))
103
+ return this.buffer;
104
+ }
105
+ }), Object.defineProperty(o.prototype, "offset", {
106
+ enumerable: !0,
107
+ get: function() {
108
+ if (o.isBuffer(this))
109
+ return this.byteOffset;
110
+ }
111
+ });
112
+ function F(i) {
113
+ if (i > w)
114
+ throw new RangeError('The value "' + i + '" is invalid for option "size"');
115
+ const r = new f(i);
116
+ return Object.setPrototypeOf(r, o.prototype), r;
117
+ }
118
+ function o(i, r, t) {
119
+ if (typeof i == "number") {
120
+ if (typeof r == "string")
121
+ throw new TypeError(
122
+ 'The "string" argument must be of type string. Received type number'
123
+ );
124
+ return N(i);
125
+ }
126
+ return A(i, r, t);
127
+ }
128
+ o.poolSize = 8192;
129
+ function A(i, r, t) {
130
+ if (typeof i == "string")
131
+ return G(i, r);
132
+ if (l.isView(i))
133
+ return pr(i);
134
+ if (i == null)
135
+ throw new TypeError(
136
+ "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof i
137
+ );
138
+ if (C(i, l) || i && C(i.buffer, l) || typeof m < "u" && (C(i, m) || i && C(i.buffer, m)))
139
+ return W(i, r, t);
140
+ if (typeof i == "number")
141
+ throw new TypeError(
142
+ 'The "value" argument must not be of type number. Received type number'
143
+ );
144
+ const n = i.valueOf && i.valueOf();
145
+ if (n != null && n !== i)
146
+ return o.from(n, r, t);
147
+ const e = lr(i);
148
+ if (e) return e;
149
+ if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof i[Symbol.toPrimitive] == "function")
150
+ return o.from(i[Symbol.toPrimitive]("string"), r, t);
151
+ throw new TypeError(
152
+ "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof i
153
+ );
154
+ }
155
+ o.from = function(i, r, t) {
156
+ return A(i, r, t);
157
+ }, Object.setPrototypeOf(o.prototype, f.prototype), Object.setPrototypeOf(o, f);
158
+ function S(i) {
159
+ if (typeof i != "number")
160
+ throw new TypeError('"size" argument must be of type number');
161
+ if (i < 0)
162
+ throw new RangeError('The value "' + i + '" is invalid for option "size"');
163
+ }
164
+ function R(i, r, t) {
165
+ return S(i), i <= 0 ? F(i) : r !== void 0 ? typeof t == "string" ? F(i).fill(r, t) : F(i).fill(r) : F(i);
166
+ }
167
+ o.alloc = function(i, r, t) {
168
+ return R(i, r, t);
169
+ };
170
+ function N(i) {
171
+ return S(i), F(i < 0 ? 0 : j(i) | 0);
172
+ }
173
+ o.allocUnsafe = function(i) {
174
+ return N(i);
175
+ }, o.allocUnsafeSlow = function(i) {
176
+ return N(i);
177
+ };
178
+ function G(i, r) {
179
+ if ((typeof r != "string" || r === "") && (r = "utf8"), !o.isEncoding(r))
180
+ throw new TypeError("Unknown encoding: " + r);
181
+ const t = z(i, r) | 0;
182
+ let n = F(t);
183
+ const e = n.write(i, r);
184
+ return e !== t && (n = n.slice(0, e)), n;
185
+ }
186
+ function Y(i) {
187
+ const r = i.length < 0 ? 0 : j(i.length) | 0, t = F(r);
188
+ for (let n = 0; n < r; n += 1)
189
+ t[n] = i[n] & 255;
190
+ return t;
191
+ }
192
+ function pr(i) {
193
+ if (C(i, f)) {
194
+ const r = new f(i);
195
+ return W(r.buffer, r.byteOffset, r.byteLength);
196
+ }
197
+ return Y(i);
198
+ }
199
+ function W(i, r, t) {
200
+ if (r < 0 || i.byteLength < r)
201
+ throw new RangeError('"offset" is outside of buffer bounds');
202
+ if (i.byteLength < r + (t || 0))
203
+ throw new RangeError('"length" is outside of buffer bounds');
204
+ let n;
205
+ return r === void 0 && t === void 0 ? n = new f(i) : t === void 0 ? n = new f(i, r) : n = new f(i, r, t), Object.setPrototypeOf(n, o.prototype), n;
206
+ }
207
+ function lr(i) {
208
+ if (o.isBuffer(i)) {
209
+ const r = j(i.length) | 0, t = F(r);
210
+ return t.length === 0 || i.copy(t, 0, 0, r), t;
211
+ }
212
+ if (i.length !== void 0)
213
+ return typeof i.length != "number" || V(i.length) ? F(0) : Y(i);
214
+ if (i.type === "Buffer" && Array.isArray(i.data))
215
+ return Y(i.data);
216
+ }
217
+ function j(i) {
218
+ if (i >= w)
219
+ throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + w.toString(16) + " bytes");
220
+ return i | 0;
221
+ }
222
+ function sr(i) {
223
+ return +i != i && (i = 0), o.alloc(+i);
224
+ }
225
+ o.isBuffer = function(r) {
226
+ return r != null && r._isBuffer === !0 && r !== o.prototype;
227
+ }, o.compare = function(r, t) {
228
+ if (C(r, f) && (r = o.from(r, r.offset, r.byteLength)), C(t, f) && (t = o.from(t, t.offset, t.byteLength)), !o.isBuffer(r) || !o.isBuffer(t))
229
+ throw new TypeError(
230
+ 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
231
+ );
232
+ if (r === t) return 0;
233
+ let n = r.length, e = t.length;
234
+ for (let u = 0, h = Math.min(n, e); u < h; ++u)
235
+ if (r[u] !== t[u]) {
236
+ n = r[u], e = t[u];
237
+ break;
238
+ }
239
+ return n < e ? -1 : e < n ? 1 : 0;
240
+ }, o.isEncoding = function(r) {
241
+ switch (String(r).toLowerCase()) {
242
+ case "hex":
243
+ case "utf8":
244
+ case "utf-8":
245
+ case "ascii":
246
+ case "latin1":
247
+ case "binary":
248
+ case "base64":
249
+ case "ucs2":
250
+ case "ucs-2":
251
+ case "utf16le":
252
+ case "utf-16le":
253
+ return !0;
254
+ default:
255
+ return !1;
256
+ }
257
+ }, o.concat = function(r, t) {
258
+ if (!Array.isArray(r))
259
+ throw new TypeError('"list" argument must be an Array of Buffers');
260
+ if (r.length === 0)
261
+ return o.alloc(0);
262
+ let n;
263
+ if (t === void 0)
264
+ for (t = 0, n = 0; n < r.length; ++n)
265
+ t += r[n].length;
266
+ const e = o.allocUnsafe(t);
267
+ let u = 0;
268
+ for (n = 0; n < r.length; ++n) {
269
+ let h = r[n];
270
+ if (C(h, f))
271
+ u + h.length > e.length ? (o.isBuffer(h) || (h = o.from(h)), h.copy(e, u)) : f.prototype.set.call(
272
+ e,
273
+ h,
274
+ u
275
+ );
276
+ else if (o.isBuffer(h))
277
+ h.copy(e, u);
278
+ else
279
+ throw new TypeError('"list" argument must be an Array of Buffers');
280
+ u += h.length;
281
+ }
282
+ return e;
283
+ };
284
+ function z(i, r) {
285
+ if (o.isBuffer(i))
286
+ return i.length;
287
+ if (l.isView(i) || C(i, l))
288
+ return i.byteLength;
289
+ if (typeof i != "string")
290
+ throw new TypeError(
291
+ 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof i
292
+ );
293
+ const t = i.length, n = arguments.length > 2 && arguments[2] === !0;
294
+ if (!n && t === 0) return 0;
295
+ let e = !1;
296
+ for (; ; )
297
+ switch (r) {
298
+ case "ascii":
299
+ case "latin1":
300
+ case "binary":
301
+ return t;
302
+ case "utf8":
303
+ case "utf-8":
304
+ return H(i).length;
305
+ case "ucs2":
306
+ case "ucs-2":
307
+ case "utf16le":
308
+ case "utf-16le":
309
+ return t * 2;
310
+ case "hex":
311
+ return t >>> 1;
312
+ case "base64":
313
+ return hr(i).length;
314
+ default:
315
+ if (e)
316
+ return n ? -1 : H(i).length;
317
+ r = ("" + r).toLowerCase(), e = !0;
318
+ }
319
+ }
320
+ o.byteLength = z;
321
+ function ar(i, r, t) {
322
+ let n = !1;
323
+ if ((r === void 0 || r < 0) && (r = 0), r > this.length || ((t === void 0 || t > this.length) && (t = this.length), t <= 0) || (t >>>= 0, r >>>= 0, t <= r))
324
+ return "";
325
+ for (i || (i = "utf8"); ; )
326
+ switch (i) {
327
+ case "hex":
328
+ return Fr(this, r, t);
329
+ case "utf8":
330
+ case "utf-8":
331
+ return Q(this, r, t);
332
+ case "ascii":
333
+ return mr(this, r, t);
334
+ case "latin1":
335
+ case "binary":
336
+ return Ir(this, r, t);
337
+ case "base64":
338
+ return dr(this, r, t);
339
+ case "ucs2":
340
+ case "ucs-2":
341
+ case "utf16le":
342
+ case "utf-16le":
343
+ return Ar(this, r, t);
344
+ default:
345
+ if (n) throw new TypeError("Unknown encoding: " + i);
346
+ i = (i + "").toLowerCase(), n = !0;
347
+ }
348
+ }
349
+ o.prototype._isBuffer = !0;
350
+ function b(i, r, t) {
351
+ const n = i[r];
352
+ i[r] = i[t], i[t] = n;
353
+ }
354
+ o.prototype.swap16 = function() {
355
+ const r = this.length;
356
+ if (r % 2 !== 0)
357
+ throw new RangeError("Buffer size must be a multiple of 16-bits");
358
+ for (let t = 0; t < r; t += 2)
359
+ b(this, t, t + 1);
360
+ return this;
361
+ }, o.prototype.swap32 = function() {
362
+ const r = this.length;
363
+ if (r % 4 !== 0)
364
+ throw new RangeError("Buffer size must be a multiple of 32-bits");
365
+ for (let t = 0; t < r; t += 4)
366
+ b(this, t, t + 3), b(this, t + 1, t + 2);
367
+ return this;
368
+ }, o.prototype.swap64 = function() {
369
+ const r = this.length;
370
+ if (r % 8 !== 0)
371
+ throw new RangeError("Buffer size must be a multiple of 64-bits");
372
+ for (let t = 0; t < r; t += 8)
373
+ b(this, t, t + 7), b(this, t + 1, t + 6), b(this, t + 2, t + 5), b(this, t + 3, t + 4);
374
+ return this;
375
+ }, o.prototype.toString = function() {
376
+ const r = this.length;
377
+ return r === 0 ? "" : arguments.length === 0 ? Q(this, 0, r) : ar.apply(this, arguments);
378
+ }, o.prototype.toLocaleString = o.prototype.toString, o.prototype.equals = function(r) {
379
+ if (!o.isBuffer(r)) throw new TypeError("Argument must be a Buffer");
380
+ return this === r ? !0 : o.compare(this, r) === 0;
381
+ }, o.prototype.inspect = function() {
382
+ let r = "";
383
+ const t = p.INSPECT_MAX_BYTES;
384
+ return r = this.toString("hex", 0, t).replace(/(.{2})/g, "$1 ").trim(), this.length > t && (r += " ... "), "<Buffer " + r + ">";
385
+ }, x && (o.prototype[x] = o.prototype.inspect), o.prototype.compare = function(r, t, n, e, u) {
386
+ if (C(r, f) && (r = o.from(r, r.offset, r.byteLength)), !o.isBuffer(r))
387
+ throw new TypeError(
388
+ 'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof r
389
+ );
390
+ if (t === void 0 && (t = 0), n === void 0 && (n = r ? r.length : 0), e === void 0 && (e = 0), u === void 0 && (u = this.length), t < 0 || n > r.length || e < 0 || u > this.length)
391
+ throw new RangeError("out of range index");
392
+ if (e >= u && t >= n)
393
+ return 0;
394
+ if (e >= u)
395
+ return -1;
396
+ if (t >= n)
397
+ return 1;
398
+ if (t >>>= 0, n >>>= 0, e >>>= 0, u >>>= 0, this === r) return 0;
399
+ let h = u - e, s = n - t;
400
+ const d = Math.min(h, s), E = this.slice(e, u), g = r.slice(t, n);
401
+ for (let y = 0; y < d; ++y)
402
+ if (E[y] !== g[y]) {
403
+ h = E[y], s = g[y];
404
+ break;
405
+ }
406
+ return h < s ? -1 : s < h ? 1 : 0;
407
+ };
408
+ function K(i, r, t, n, e) {
409
+ if (i.length === 0) return -1;
410
+ if (typeof t == "string" ? (n = t, t = 0) : t > 2147483647 ? t = 2147483647 : t < -2147483648 && (t = -2147483648), t = +t, V(t) && (t = e ? 0 : i.length - 1), t < 0 && (t = i.length + t), t >= i.length) {
411
+ if (e) return -1;
412
+ t = i.length - 1;
413
+ } else if (t < 0)
414
+ if (e) t = 0;
415
+ else return -1;
416
+ if (typeof r == "string" && (r = o.from(r, n)), o.isBuffer(r))
417
+ return r.length === 0 ? -1 : Z(i, r, t, n, e);
418
+ if (typeof r == "number")
419
+ return r = r & 255, typeof f.prototype.indexOf == "function" ? e ? f.prototype.indexOf.call(i, r, t) : f.prototype.lastIndexOf.call(i, r, t) : Z(i, [r], t, n, e);
420
+ throw new TypeError("val must be string, number or Buffer");
421
+ }
422
+ function Z(i, r, t, n, e) {
423
+ let u = 1, h = i.length, s = r.length;
424
+ if (n !== void 0 && (n = String(n).toLowerCase(), n === "ucs2" || n === "ucs-2" || n === "utf16le" || n === "utf-16le")) {
425
+ if (i.length < 2 || r.length < 2)
426
+ return -1;
427
+ u = 2, h /= 2, s /= 2, t /= 2;
428
+ }
429
+ function d(g, y) {
430
+ return u === 1 ? g[y] : g.readUInt16BE(y * u);
431
+ }
432
+ let E;
433
+ if (e) {
434
+ let g = -1;
435
+ for (E = t; E < h; E++)
436
+ if (d(i, E) === d(r, g === -1 ? 0 : E - g)) {
437
+ if (g === -1 && (g = E), E - g + 1 === s) return g * u;
438
+ } else
439
+ g !== -1 && (E -= E - g), g = -1;
440
+ } else
441
+ for (t + s > h && (t = h - s), E = t; E >= 0; E--) {
442
+ let g = !0;
443
+ for (let y = 0; y < s; y++)
444
+ if (d(i, E + y) !== d(r, y)) {
445
+ g = !1;
446
+ break;
447
+ }
448
+ if (g) return E;
449
+ }
450
+ return -1;
451
+ }
452
+ o.prototype.includes = function(r, t, n) {
453
+ return this.indexOf(r, t, n) !== -1;
454
+ }, o.prototype.indexOf = function(r, t, n) {
455
+ return K(this, r, t, n, !0);
456
+ }, o.prototype.lastIndexOf = function(r, t, n) {
457
+ return K(this, r, t, n, !1);
458
+ };
459
+ function wr(i, r, t, n) {
460
+ t = Number(t) || 0;
461
+ const e = i.length - t;
462
+ n ? (n = Number(n), n > e && (n = e)) : n = e;
463
+ const u = r.length;
464
+ n > u / 2 && (n = u / 2);
465
+ let h;
466
+ for (h = 0; h < n; ++h) {
467
+ const s = parseInt(r.substr(h * 2, 2), 16);
468
+ if (V(s)) return h;
469
+ i[t + h] = s;
470
+ }
471
+ return h;
472
+ }
473
+ function yr(i, r, t, n) {
474
+ return $(H(r, i.length - t), i, t, n);
475
+ }
476
+ function xr(i, r, t, n) {
477
+ return $(Cr(r), i, t, n);
478
+ }
479
+ function Br(i, r, t, n) {
480
+ return $(hr(r), i, t, n);
481
+ }
482
+ function Er(i, r, t, n) {
483
+ return $(_r(r, i.length - t), i, t, n);
484
+ }
485
+ o.prototype.write = function(r, t, n, e) {
486
+ if (t === void 0)
487
+ e = "utf8", n = this.length, t = 0;
488
+ else if (n === void 0 && typeof t == "string")
489
+ e = t, n = this.length, t = 0;
490
+ else if (isFinite(t))
491
+ t = t >>> 0, isFinite(n) ? (n = n >>> 0, e === void 0 && (e = "utf8")) : (e = n, n = void 0);
492
+ else
493
+ throw new Error(
494
+ "Buffer.write(string, encoding, offset[, length]) is no longer supported"
495
+ );
496
+ const u = this.length - t;
497
+ if ((n === void 0 || n > u) && (n = u), r.length > 0 && (n < 0 || t < 0) || t > this.length)
498
+ throw new RangeError("Attempt to write outside buffer bounds");
499
+ e || (e = "utf8");
500
+ let h = !1;
501
+ for (; ; )
502
+ switch (e) {
503
+ case "hex":
504
+ return wr(this, r, t, n);
505
+ case "utf8":
506
+ case "utf-8":
507
+ return yr(this, r, t, n);
508
+ case "ascii":
509
+ case "latin1":
510
+ case "binary":
511
+ return xr(this, r, t, n);
512
+ case "base64":
513
+ return Br(this, r, t, n);
514
+ case "ucs2":
515
+ case "ucs-2":
516
+ case "utf16le":
517
+ case "utf-16le":
518
+ return Er(this, r, t, n);
519
+ default:
520
+ if (h) throw new TypeError("Unknown encoding: " + e);
521
+ e = ("" + e).toLowerCase(), h = !0;
522
+ }
523
+ }, o.prototype.toJSON = function() {
524
+ return {
525
+ type: "Buffer",
526
+ data: Array.prototype.slice.call(this._arr || this, 0)
527
+ };
528
+ };
529
+ function dr(i, r, t) {
530
+ return r === 0 && t === i.length ? c.fromByteArray(i) : c.fromByteArray(i.slice(r, t));
531
+ }
532
+ function Q(i, r, t) {
533
+ t = Math.min(i.length, t);
534
+ const n = [];
535
+ let e = r;
536
+ for (; e < t; ) {
537
+ const u = i[e];
538
+ let h = null, s = u > 239 ? 4 : u > 223 ? 3 : u > 191 ? 2 : 1;
539
+ if (e + s <= t) {
540
+ let d, E, g, y;
541
+ switch (s) {
542
+ case 1:
543
+ u < 128 && (h = u);
544
+ break;
545
+ case 2:
546
+ d = i[e + 1], (d & 192) === 128 && (y = (u & 31) << 6 | d & 63, y > 127 && (h = y));
547
+ break;
548
+ case 3:
549
+ d = i[e + 1], E = i[e + 2], (d & 192) === 128 && (E & 192) === 128 && (y = (u & 15) << 12 | (d & 63) << 6 | E & 63, y > 2047 && (y < 55296 || y > 57343) && (h = y));
550
+ break;
551
+ case 4:
552
+ d = i[e + 1], E = i[e + 2], g = i[e + 3], (d & 192) === 128 && (E & 192) === 128 && (g & 192) === 128 && (y = (u & 15) << 18 | (d & 63) << 12 | (E & 63) << 6 | g & 63, y > 65535 && y < 1114112 && (h = y));
553
+ }
554
+ }
555
+ h === null ? (h = 65533, s = 1) : h > 65535 && (h -= 65536, n.push(h >>> 10 & 1023 | 55296), h = 56320 | h & 1023), n.push(h), e += s;
556
+ }
557
+ return gr(n);
558
+ }
559
+ const v = 4096;
560
+ function gr(i) {
561
+ const r = i.length;
562
+ if (r <= v)
563
+ return String.fromCharCode.apply(String, i);
564
+ let t = "", n = 0;
565
+ for (; n < r; )
566
+ t += String.fromCharCode.apply(
567
+ String,
568
+ i.slice(n, n += v)
569
+ );
570
+ return t;
571
+ }
572
+ function mr(i, r, t) {
573
+ let n = "";
574
+ t = Math.min(i.length, t);
575
+ for (let e = r; e < t; ++e)
576
+ n += String.fromCharCode(i[e] & 127);
577
+ return n;
578
+ }
579
+ function Ir(i, r, t) {
580
+ let n = "";
581
+ t = Math.min(i.length, t);
582
+ for (let e = r; e < t; ++e)
583
+ n += String.fromCharCode(i[e]);
584
+ return n;
585
+ }
586
+ function Fr(i, r, t) {
587
+ const n = i.length;
588
+ (!r || r < 0) && (r = 0), (!t || t < 0 || t > n) && (t = n);
589
+ let e = "";
590
+ for (let u = r; u < t; ++u)
591
+ e += Sr[i[u]];
592
+ return e;
593
+ }
594
+ function Ar(i, r, t) {
595
+ const n = i.slice(r, t);
596
+ let e = "";
597
+ for (let u = 0; u < n.length - 1; u += 2)
598
+ e += String.fromCharCode(n[u] + n[u + 1] * 256);
599
+ return e;
600
+ }
601
+ o.prototype.slice = function(r, t) {
602
+ const n = this.length;
603
+ r = ~~r, t = t === void 0 ? n : ~~t, r < 0 ? (r += n, r < 0 && (r = 0)) : r > n && (r = n), t < 0 ? (t += n, t < 0 && (t = 0)) : t > n && (t = n), t < r && (t = r);
604
+ const e = this.subarray(r, t);
605
+ return Object.setPrototypeOf(e, o.prototype), e;
606
+ };
607
+ function I(i, r, t) {
608
+ if (i % 1 !== 0 || i < 0) throw new RangeError("offset is not uint");
609
+ if (i + r > t) throw new RangeError("Trying to access beyond buffer length");
610
+ }
611
+ o.prototype.readUintLE = o.prototype.readUIntLE = function(r, t, n) {
612
+ r = r >>> 0, t = t >>> 0, n || I(r, t, this.length);
613
+ let e = this[r], u = 1, h = 0;
614
+ for (; ++h < t && (u *= 256); )
615
+ e += this[r + h] * u;
616
+ return e;
617
+ }, o.prototype.readUintBE = o.prototype.readUIntBE = function(r, t, n) {
618
+ r = r >>> 0, t = t >>> 0, n || I(r, t, this.length);
619
+ let e = this[r + --t], u = 1;
620
+ for (; t > 0 && (u *= 256); )
621
+ e += this[r + --t] * u;
622
+ return e;
623
+ }, o.prototype.readUint8 = o.prototype.readUInt8 = function(r, t) {
624
+ return r = r >>> 0, t || I(r, 1, this.length), this[r];
625
+ }, o.prototype.readUint16LE = o.prototype.readUInt16LE = function(r, t) {
626
+ return r = r >>> 0, t || I(r, 2, this.length), this[r] | this[r + 1] << 8;
627
+ }, o.prototype.readUint16BE = o.prototype.readUInt16BE = function(r, t) {
628
+ return r = r >>> 0, t || I(r, 2, this.length), this[r] << 8 | this[r + 1];
629
+ }, o.prototype.readUint32LE = o.prototype.readUInt32LE = function(r, t) {
630
+ return r = r >>> 0, t || I(r, 4, this.length), (this[r] | this[r + 1] << 8 | this[r + 2] << 16) + this[r + 3] * 16777216;
631
+ }, o.prototype.readUint32BE = o.prototype.readUInt32BE = function(r, t) {
632
+ return r = r >>> 0, t || I(r, 4, this.length), this[r] * 16777216 + (this[r + 1] << 16 | this[r + 2] << 8 | this[r + 3]);
633
+ }, o.prototype.readBigUInt64LE = L(function(r) {
634
+ r = r >>> 0, k(r, "offset");
635
+ const t = this[r], n = this[r + 7];
636
+ (t === void 0 || n === void 0) && P(r, this.length - 8);
637
+ const e = t + this[++r] * 2 ** 8 + this[++r] * 2 ** 16 + this[++r] * 2 ** 24, u = this[++r] + this[++r] * 2 ** 8 + this[++r] * 2 ** 16 + n * 2 ** 24;
638
+ return BigInt(e) + (BigInt(u) << BigInt(32));
639
+ }), o.prototype.readBigUInt64BE = L(function(r) {
640
+ r = r >>> 0, k(r, "offset");
641
+ const t = this[r], n = this[r + 7];
642
+ (t === void 0 || n === void 0) && P(r, this.length - 8);
643
+ const e = t * 2 ** 24 + this[++r] * 2 ** 16 + this[++r] * 2 ** 8 + this[++r], u = this[++r] * 2 ** 24 + this[++r] * 2 ** 16 + this[++r] * 2 ** 8 + n;
644
+ return (BigInt(e) << BigInt(32)) + BigInt(u);
645
+ }), o.prototype.readIntLE = function(r, t, n) {
646
+ r = r >>> 0, t = t >>> 0, n || I(r, t, this.length);
647
+ let e = this[r], u = 1, h = 0;
648
+ for (; ++h < t && (u *= 256); )
649
+ e += this[r + h] * u;
650
+ return u *= 128, e >= u && (e -= Math.pow(2, 8 * t)), e;
651
+ }, o.prototype.readIntBE = function(r, t, n) {
652
+ r = r >>> 0, t = t >>> 0, n || I(r, t, this.length);
653
+ let e = t, u = 1, h = this[r + --e];
654
+ for (; e > 0 && (u *= 256); )
655
+ h += this[r + --e] * u;
656
+ return u *= 128, h >= u && (h -= Math.pow(2, 8 * t)), h;
657
+ }, o.prototype.readInt8 = function(r, t) {
658
+ return r = r >>> 0, t || I(r, 1, this.length), this[r] & 128 ? (255 - this[r] + 1) * -1 : this[r];
659
+ }, o.prototype.readInt16LE = function(r, t) {
660
+ r = r >>> 0, t || I(r, 2, this.length);
661
+ const n = this[r] | this[r + 1] << 8;
662
+ return n & 32768 ? n | 4294901760 : n;
663
+ }, o.prototype.readInt16BE = function(r, t) {
664
+ r = r >>> 0, t || I(r, 2, this.length);
665
+ const n = this[r + 1] | this[r] << 8;
666
+ return n & 32768 ? n | 4294901760 : n;
667
+ }, o.prototype.readInt32LE = function(r, t) {
668
+ return r = r >>> 0, t || I(r, 4, this.length), this[r] | this[r + 1] << 8 | this[r + 2] << 16 | this[r + 3] << 24;
669
+ }, o.prototype.readInt32BE = function(r, t) {
670
+ return r = r >>> 0, t || I(r, 4, this.length), this[r] << 24 | this[r + 1] << 16 | this[r + 2] << 8 | this[r + 3];
671
+ }, o.prototype.readBigInt64LE = L(function(r) {
672
+ r = r >>> 0, k(r, "offset");
673
+ const t = this[r], n = this[r + 7];
674
+ (t === void 0 || n === void 0) && P(r, this.length - 8);
675
+ const e = this[r + 4] + this[r + 5] * 2 ** 8 + this[r + 6] * 2 ** 16 + (n << 24);
676
+ return (BigInt(e) << BigInt(32)) + BigInt(t + this[++r] * 2 ** 8 + this[++r] * 2 ** 16 + this[++r] * 2 ** 24);
677
+ }), o.prototype.readBigInt64BE = L(function(r) {
678
+ r = r >>> 0, k(r, "offset");
679
+ const t = this[r], n = this[r + 7];
680
+ (t === void 0 || n === void 0) && P(r, this.length - 8);
681
+ const e = (t << 24) + // Overflow
682
+ this[++r] * 2 ** 16 + this[++r] * 2 ** 8 + this[++r];
683
+ return (BigInt(e) << BigInt(32)) + BigInt(this[++r] * 2 ** 24 + this[++r] * 2 ** 16 + this[++r] * 2 ** 8 + n);
684
+ }), o.prototype.readFloatLE = function(r, t) {
685
+ return r = r >>> 0, t || I(r, 4, this.length), a.read(this, r, !0, 23, 4);
686
+ }, o.prototype.readFloatBE = function(r, t) {
687
+ return r = r >>> 0, t || I(r, 4, this.length), a.read(this, r, !1, 23, 4);
688
+ }, o.prototype.readDoubleLE = function(r, t) {
689
+ return r = r >>> 0, t || I(r, 8, this.length), a.read(this, r, !0, 52, 8);
690
+ }, o.prototype.readDoubleBE = function(r, t) {
691
+ return r = r >>> 0, t || I(r, 8, this.length), a.read(this, r, !1, 52, 8);
692
+ };
693
+ function U(i, r, t, n, e, u) {
694
+ if (!o.isBuffer(i)) throw new TypeError('"buffer" argument must be a Buffer instance');
695
+ if (r > e || r < u) throw new RangeError('"value" argument is out of bounds');
696
+ if (t + n > i.length) throw new RangeError("Index out of range");
697
+ }
698
+ o.prototype.writeUintLE = o.prototype.writeUIntLE = function(r, t, n, e) {
699
+ if (r = +r, t = t >>> 0, n = n >>> 0, !e) {
700
+ const s = Math.pow(2, 8 * n) - 1;
701
+ U(this, r, t, n, s, 0);
702
+ }
703
+ let u = 1, h = 0;
704
+ for (this[t] = r & 255; ++h < n && (u *= 256); )
705
+ this[t + h] = r / u & 255;
706
+ return t + n;
707
+ }, o.prototype.writeUintBE = o.prototype.writeUIntBE = function(r, t, n, e) {
708
+ if (r = +r, t = t >>> 0, n = n >>> 0, !e) {
709
+ const s = Math.pow(2, 8 * n) - 1;
710
+ U(this, r, t, n, s, 0);
711
+ }
712
+ let u = n - 1, h = 1;
713
+ for (this[t + u] = r & 255; --u >= 0 && (h *= 256); )
714
+ this[t + u] = r / h & 255;
715
+ return t + n;
716
+ }, o.prototype.writeUint8 = o.prototype.writeUInt8 = function(r, t, n) {
717
+ return r = +r, t = t >>> 0, n || U(this, r, t, 1, 255, 0), this[t] = r & 255, t + 1;
718
+ }, o.prototype.writeUint16LE = o.prototype.writeUInt16LE = function(r, t, n) {
719
+ return r = +r, t = t >>> 0, n || U(this, r, t, 2, 65535, 0), this[t] = r & 255, this[t + 1] = r >>> 8, t + 2;
720
+ }, o.prototype.writeUint16BE = o.prototype.writeUInt16BE = function(r, t, n) {
721
+ return r = +r, t = t >>> 0, n || U(this, r, t, 2, 65535, 0), this[t] = r >>> 8, this[t + 1] = r & 255, t + 2;
722
+ }, o.prototype.writeUint32LE = o.prototype.writeUInt32LE = function(r, t, n) {
723
+ return r = +r, t = t >>> 0, n || U(this, r, t, 4, 4294967295, 0), this[t + 3] = r >>> 24, this[t + 2] = r >>> 16, this[t + 1] = r >>> 8, this[t] = r & 255, t + 4;
724
+ }, o.prototype.writeUint32BE = o.prototype.writeUInt32BE = function(r, t, n) {
725
+ return r = +r, t = t >>> 0, n || U(this, r, t, 4, 4294967295, 0), this[t] = r >>> 24, this[t + 1] = r >>> 16, this[t + 2] = r >>> 8, this[t + 3] = r & 255, t + 4;
726
+ };
727
+ function rr(i, r, t, n, e) {
728
+ ur(r, n, e, i, t, 7);
729
+ let u = Number(r & BigInt(4294967295));
730
+ i[t++] = u, u = u >> 8, i[t++] = u, u = u >> 8, i[t++] = u, u = u >> 8, i[t++] = u;
731
+ let h = Number(r >> BigInt(32) & BigInt(4294967295));
732
+ return i[t++] = h, h = h >> 8, i[t++] = h, h = h >> 8, i[t++] = h, h = h >> 8, i[t++] = h, t;
733
+ }
734
+ function tr(i, r, t, n, e) {
735
+ ur(r, n, e, i, t, 7);
736
+ let u = Number(r & BigInt(4294967295));
737
+ i[t + 7] = u, u = u >> 8, i[t + 6] = u, u = u >> 8, i[t + 5] = u, u = u >> 8, i[t + 4] = u;
738
+ let h = Number(r >> BigInt(32) & BigInt(4294967295));
739
+ return i[t + 3] = h, h = h >> 8, i[t + 2] = h, h = h >> 8, i[t + 1] = h, h = h >> 8, i[t] = h, t + 8;
740
+ }
741
+ o.prototype.writeBigUInt64LE = L(function(r, t = 0) {
742
+ return rr(this, r, t, BigInt(0), BigInt("0xffffffffffffffff"));
743
+ }), o.prototype.writeBigUInt64BE = L(function(r, t = 0) {
744
+ return tr(this, r, t, BigInt(0), BigInt("0xffffffffffffffff"));
745
+ }), o.prototype.writeIntLE = function(r, t, n, e) {
746
+ if (r = +r, t = t >>> 0, !e) {
747
+ const d = Math.pow(2, 8 * n - 1);
748
+ U(this, r, t, n, d - 1, -d);
749
+ }
750
+ let u = 0, h = 1, s = 0;
751
+ for (this[t] = r & 255; ++u < n && (h *= 256); )
752
+ r < 0 && s === 0 && this[t + u - 1] !== 0 && (s = 1), this[t + u] = (r / h >> 0) - s & 255;
753
+ return t + n;
754
+ }, o.prototype.writeIntBE = function(r, t, n, e) {
755
+ if (r = +r, t = t >>> 0, !e) {
756
+ const d = Math.pow(2, 8 * n - 1);
757
+ U(this, r, t, n, d - 1, -d);
758
+ }
759
+ let u = n - 1, h = 1, s = 0;
760
+ for (this[t + u] = r & 255; --u >= 0 && (h *= 256); )
761
+ r < 0 && s === 0 && this[t + u + 1] !== 0 && (s = 1), this[t + u] = (r / h >> 0) - s & 255;
762
+ return t + n;
763
+ }, o.prototype.writeInt8 = function(r, t, n) {
764
+ return r = +r, t = t >>> 0, n || U(this, r, t, 1, 127, -128), r < 0 && (r = 255 + r + 1), this[t] = r & 255, t + 1;
765
+ }, o.prototype.writeInt16LE = function(r, t, n) {
766
+ return r = +r, t = t >>> 0, n || U(this, r, t, 2, 32767, -32768), this[t] = r & 255, this[t + 1] = r >>> 8, t + 2;
767
+ }, o.prototype.writeInt16BE = function(r, t, n) {
768
+ return r = +r, t = t >>> 0, n || U(this, r, t, 2, 32767, -32768), this[t] = r >>> 8, this[t + 1] = r & 255, t + 2;
769
+ }, o.prototype.writeInt32LE = function(r, t, n) {
770
+ return r = +r, t = t >>> 0, n || U(this, r, t, 4, 2147483647, -2147483648), this[t] = r & 255, this[t + 1] = r >>> 8, this[t + 2] = r >>> 16, this[t + 3] = r >>> 24, t + 4;
771
+ }, o.prototype.writeInt32BE = function(r, t, n) {
772
+ return r = +r, t = t >>> 0, n || U(this, r, t, 4, 2147483647, -2147483648), r < 0 && (r = 4294967295 + r + 1), this[t] = r >>> 24, this[t + 1] = r >>> 16, this[t + 2] = r >>> 8, this[t + 3] = r & 255, t + 4;
773
+ }, o.prototype.writeBigInt64LE = L(function(r, t = 0) {
774
+ return rr(this, r, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
775
+ }), o.prototype.writeBigInt64BE = L(function(r, t = 0) {
776
+ return tr(this, r, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
777
+ });
778
+ function ir(i, r, t, n, e, u) {
779
+ if (t + n > i.length) throw new RangeError("Index out of range");
780
+ if (t < 0) throw new RangeError("Index out of range");
781
+ }
782
+ function nr(i, r, t, n, e) {
783
+ return r = +r, t = t >>> 0, e || ir(i, r, t, 4), a.write(i, r, t, n, 23, 4), t + 4;
784
+ }
785
+ o.prototype.writeFloatLE = function(r, t, n) {
786
+ return nr(this, r, t, !0, n);
787
+ }, o.prototype.writeFloatBE = function(r, t, n) {
788
+ return nr(this, r, t, !1, n);
789
+ };
790
+ function er(i, r, t, n, e) {
791
+ return r = +r, t = t >>> 0, e || ir(i, r, t, 8), a.write(i, r, t, n, 52, 8), t + 8;
792
+ }
793
+ o.prototype.writeDoubleLE = function(r, t, n) {
794
+ return er(this, r, t, !0, n);
795
+ }, o.prototype.writeDoubleBE = function(r, t, n) {
796
+ return er(this, r, t, !1, n);
797
+ }, o.prototype.copy = function(r, t, n, e) {
798
+ if (!o.isBuffer(r)) throw new TypeError("argument should be a Buffer");
799
+ if (n || (n = 0), !e && e !== 0 && (e = this.length), t >= r.length && (t = r.length), t || (t = 0), e > 0 && e < n && (e = n), e === n || r.length === 0 || this.length === 0) return 0;
800
+ if (t < 0)
801
+ throw new RangeError("targetStart out of bounds");
802
+ if (n < 0 || n >= this.length) throw new RangeError("Index out of range");
803
+ if (e < 0) throw new RangeError("sourceEnd out of bounds");
804
+ e > this.length && (e = this.length), r.length - t < e - n && (e = r.length - t + n);
805
+ const u = e - n;
806
+ return this === r && typeof f.prototype.copyWithin == "function" ? this.copyWithin(t, n, e) : f.prototype.set.call(
807
+ r,
808
+ this.subarray(n, e),
809
+ t
810
+ ), u;
811
+ }, o.prototype.fill = function(r, t, n, e) {
812
+ if (typeof r == "string") {
813
+ if (typeof t == "string" ? (e = t, t = 0, n = this.length) : typeof n == "string" && (e = n, n = this.length), e !== void 0 && typeof e != "string")
814
+ throw new TypeError("encoding must be a string");
815
+ if (typeof e == "string" && !o.isEncoding(e))
816
+ throw new TypeError("Unknown encoding: " + e);
817
+ if (r.length === 1) {
818
+ const h = r.charCodeAt(0);
819
+ (e === "utf8" && h < 128 || e === "latin1") && (r = h);
820
+ }
821
+ } else typeof r == "number" ? r = r & 255 : typeof r == "boolean" && (r = Number(r));
822
+ if (t < 0 || this.length < t || this.length < n)
823
+ throw new RangeError("Out of range index");
824
+ if (n <= t)
825
+ return this;
826
+ t = t >>> 0, n = n === void 0 ? this.length : n >>> 0, r || (r = 0);
827
+ let u;
828
+ if (typeof r == "number")
829
+ for (u = t; u < n; ++u)
830
+ this[u] = r;
831
+ else {
832
+ const h = o.isBuffer(r) ? r : o.from(r, e), s = h.length;
833
+ if (s === 0)
834
+ throw new TypeError('The value "' + r + '" is invalid for argument "value"');
835
+ for (u = 0; u < n - t; ++u)
836
+ this[u + t] = h[u % s];
837
+ }
838
+ return this;
839
+ };
840
+ const M = {};
841
+ function q(i, r, t) {
842
+ M[i] = class extends t {
843
+ constructor() {
844
+ super(), Object.defineProperty(this, "message", {
845
+ value: r.apply(this, arguments),
846
+ writable: !0,
847
+ configurable: !0
848
+ }), this.name = `${this.name} [${i}]`, this.stack, delete this.name;
849
+ }
850
+ get code() {
851
+ return i;
852
+ }
853
+ set code(e) {
854
+ Object.defineProperty(this, "code", {
855
+ configurable: !0,
856
+ enumerable: !0,
857
+ value: e,
858
+ writable: !0
859
+ });
860
+ }
861
+ toString() {
862
+ return `${this.name} [${i}]: ${this.message}`;
863
+ }
864
+ };
865
+ }
866
+ q(
867
+ "ERR_BUFFER_OUT_OF_BOUNDS",
868
+ function(i) {
869
+ return i ? `${i} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
870
+ },
871
+ RangeError
872
+ ), q(
873
+ "ERR_INVALID_ARG_TYPE",
874
+ function(i, r) {
875
+ return `The "${i}" argument must be of type number. Received type ${typeof r}`;
876
+ },
877
+ TypeError
878
+ ), q(
879
+ "ERR_OUT_OF_RANGE",
880
+ function(i, r, t) {
881
+ let n = `The value of "${i}" is out of range.`, e = t;
882
+ return Number.isInteger(t) && Math.abs(t) > 2 ** 32 ? e = or(String(t)) : typeof t == "bigint" && (e = String(t), (t > BigInt(2) ** BigInt(32) || t < -(BigInt(2) ** BigInt(32))) && (e = or(e)), e += "n"), n += ` It must be ${r}. Received ${e}`, n;
883
+ },
884
+ RangeError
885
+ );
886
+ function or(i) {
887
+ let r = "", t = i.length;
888
+ const n = i[0] === "-" ? 1 : 0;
889
+ for (; t >= n + 4; t -= 3)
890
+ r = `_${i.slice(t - 3, t)}${r}`;
891
+ return `${i.slice(0, t)}${r}`;
892
+ }
893
+ function Ur(i, r, t) {
894
+ k(r, "offset"), (i[r] === void 0 || i[r + t] === void 0) && P(r, i.length - (t + 1));
895
+ }
896
+ function ur(i, r, t, n, e, u) {
897
+ if (i > t || i < r) {
898
+ const h = typeof r == "bigint" ? "n" : "";
899
+ let s;
900
+ throw r === 0 || r === BigInt(0) ? s = `>= 0${h} and < 2${h} ** ${(u + 1) * 8}${h}` : s = `>= -(2${h} ** ${(u + 1) * 8 - 1}${h}) and < 2 ** ${(u + 1) * 8 - 1}${h}`, new M.ERR_OUT_OF_RANGE("value", s, i);
901
+ }
902
+ Ur(n, e, u);
903
+ }
904
+ function k(i, r) {
905
+ if (typeof i != "number")
906
+ throw new M.ERR_INVALID_ARG_TYPE(r, "number", i);
907
+ }
908
+ function P(i, r, t) {
909
+ throw Math.floor(i) !== i ? (k(i, t), new M.ERR_OUT_OF_RANGE("offset", "an integer", i)) : r < 0 ? new M.ERR_BUFFER_OUT_OF_BOUNDS() : new M.ERR_OUT_OF_RANGE(
910
+ "offset",
911
+ `>= 0 and <= ${r}`,
912
+ i
913
+ );
914
+ }
915
+ const Rr = /[^+/0-9A-Za-z-_]/g;
916
+ function Tr(i) {
917
+ if (i = i.split("=")[0], i = i.trim().replace(Rr, ""), i.length < 2) return "";
918
+ for (; i.length % 4 !== 0; )
919
+ i = i + "=";
920
+ return i;
921
+ }
922
+ function H(i, r) {
923
+ r = r || 1 / 0;
924
+ let t;
925
+ const n = i.length;
926
+ let e = null;
927
+ const u = [];
928
+ for (let h = 0; h < n; ++h) {
929
+ if (t = i.charCodeAt(h), t > 55295 && t < 57344) {
930
+ if (!e) {
931
+ if (t > 56319) {
932
+ (r -= 3) > -1 && u.push(239, 191, 189);
933
+ continue;
934
+ } else if (h + 1 === n) {
935
+ (r -= 3) > -1 && u.push(239, 191, 189);
936
+ continue;
937
+ }
938
+ e = t;
939
+ continue;
940
+ }
941
+ if (t < 56320) {
942
+ (r -= 3) > -1 && u.push(239, 191, 189), e = t;
943
+ continue;
944
+ }
945
+ t = (e - 55296 << 10 | t - 56320) + 65536;
946
+ } else e && (r -= 3) > -1 && u.push(239, 191, 189);
947
+ if (e = null, t < 128) {
948
+ if ((r -= 1) < 0) break;
949
+ u.push(t);
950
+ } else if (t < 2048) {
951
+ if ((r -= 2) < 0) break;
952
+ u.push(
953
+ t >> 6 | 192,
954
+ t & 63 | 128
955
+ );
956
+ } else if (t < 65536) {
957
+ if ((r -= 3) < 0) break;
958
+ u.push(
959
+ t >> 12 | 224,
960
+ t >> 6 & 63 | 128,
961
+ t & 63 | 128
962
+ );
963
+ } else if (t < 1114112) {
964
+ if ((r -= 4) < 0) break;
965
+ u.push(
966
+ t >> 18 | 240,
967
+ t >> 12 & 63 | 128,
968
+ t >> 6 & 63 | 128,
969
+ t & 63 | 128
970
+ );
971
+ } else
972
+ throw new Error("Invalid code point");
973
+ }
974
+ return u;
975
+ }
976
+ function Cr(i) {
977
+ const r = [];
978
+ for (let t = 0; t < i.length; ++t)
979
+ r.push(i.charCodeAt(t) & 255);
980
+ return r;
981
+ }
982
+ function _r(i, r) {
983
+ let t, n, e;
984
+ const u = [];
985
+ for (let h = 0; h < i.length && !((r -= 2) < 0); ++h)
986
+ t = i.charCodeAt(h), n = t >> 8, e = t % 256, u.push(e), u.push(n);
987
+ return u;
988
+ }
989
+ function hr(i) {
990
+ return c.toByteArray(Tr(i));
991
+ }
992
+ function $(i, r, t, n) {
993
+ let e;
994
+ for (e = 0; e < n && !(e + t >= r.length || e >= i.length); ++e)
995
+ r[e + t] = i[e];
996
+ return e;
997
+ }
998
+ function C(i, r) {
999
+ return i instanceof r || i != null && i.constructor != null && i.constructor.name != null && i.constructor.name === r.name;
1000
+ }
1001
+ function V(i) {
1002
+ return i !== i;
1003
+ }
1004
+ const Sr = function() {
1005
+ const i = "0123456789abcdef", r = new Array(256);
1006
+ for (let t = 0; t < 16; ++t) {
1007
+ const n = t * 16;
1008
+ for (let e = 0; e < 16; ++e)
1009
+ r[n + e] = i[t] + i[e];
1010
+ }
1011
+ return r;
1012
+ }();
1013
+ function L(i) {
1014
+ return typeof BigInt > "u" ? Lr : i;
1015
+ }
1016
+ function Lr() {
1017
+ throw new Error("BigInt not supported");
1018
+ }
1019
+ })(fr);
1020
+ const Yr = fr.Buffer;
1021
+ export {
1022
+ Yr as B
1023
+ };