use-mmdb-vanilla 1.0.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,1382 @@
1
+ var L = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Ft = {}, q = {}, Q = {};
2
+ Q.byteLength = Ht;
3
+ Q.toByteArray = Jt;
4
+ Q.fromByteArray = Qt;
5
+ var k = [], P = [], Yt = typeof Uint8Array < "u" ? Uint8Array : Array, it = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
6
+ for (var V = 0, qt = it.length; V < qt; ++V)
7
+ k[V] = it[V], P[it.charCodeAt(V)] = V;
8
+ P[45] = 62;
9
+ P[95] = 63;
10
+ function At(u) {
11
+ var o = u.length;
12
+ if (o % 4 > 0)
13
+ throw new Error("Invalid string. Length must be a multiple of 4");
14
+ var s = u.indexOf("=");
15
+ s === -1 && (s = o);
16
+ var f = s === o ? 0 : 4 - s % 4;
17
+ return [s, f];
18
+ }
19
+ function Ht(u) {
20
+ var o = At(u), s = o[0], f = o[1];
21
+ return (s + f) * 3 / 4 - f;
22
+ }
23
+ function Xt(u, o, s) {
24
+ return (o + s) * 3 / 4 - s;
25
+ }
26
+ function Jt(u) {
27
+ var o, s = At(u), f = s[0], l = s[1], d = new Yt(Xt(u, f, l)), p = 0, c = l > 0 ? f - 4 : f, g;
28
+ for (g = 0; g < c; g += 4)
29
+ o = P[u.charCodeAt(g)] << 18 | P[u.charCodeAt(g + 1)] << 12 | P[u.charCodeAt(g + 2)] << 6 | P[u.charCodeAt(g + 3)], d[p++] = o >> 16 & 255, d[p++] = o >> 8 & 255, d[p++] = o & 255;
30
+ return l === 2 && (o = P[u.charCodeAt(g)] << 2 | P[u.charCodeAt(g + 1)] >> 4, d[p++] = o & 255), l === 1 && (o = P[u.charCodeAt(g)] << 10 | P[u.charCodeAt(g + 1)] << 4 | P[u.charCodeAt(g + 2)] >> 2, d[p++] = o >> 8 & 255, d[p++] = o & 255), d;
31
+ }
32
+ function Zt(u) {
33
+ return k[u >> 18 & 63] + k[u >> 12 & 63] + k[u >> 6 & 63] + k[u & 63];
34
+ }
35
+ function Kt(u, o, s) {
36
+ for (var f, l = [], d = o; d < s; d += 3)
37
+ f = (u[d] << 16 & 16711680) + (u[d + 1] << 8 & 65280) + (u[d + 2] & 255), l.push(Zt(f));
38
+ return l.join("");
39
+ }
40
+ function Qt(u) {
41
+ for (var o, s = u.length, f = s % 3, l = [], d = 16383, p = 0, c = s - f; p < c; p += d)
42
+ l.push(Kt(u, p, p + d > c ? c : p + d));
43
+ return f === 1 ? (o = u[s - 1], l.push(
44
+ k[o >> 2] + k[o << 4 & 63] + "=="
45
+ )) : f === 2 && (o = (u[s - 2] << 8) + u[s - 1], l.push(
46
+ k[o >> 10] + k[o >> 4 & 63] + k[o << 2 & 63] + "="
47
+ )), l.join("");
48
+ }
49
+ var ct = {};
50
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
51
+ ct.read = function(u, o, s, f, l) {
52
+ var d, p, c = l * 8 - f - 1, g = (1 << c) - 1, m = g >> 1, E = -7, B = s ? l - 1 : 0, w = s ? -1 : 1, y = u[o + B];
53
+ for (B += w, d = y & (1 << -E) - 1, y >>= -E, E += c; E > 0; d = d * 256 + u[o + B], B += w, E -= 8)
54
+ ;
55
+ for (p = d & (1 << -E) - 1, d >>= -E, E += f; E > 0; p = p * 256 + u[o + B], B += w, E -= 8)
56
+ ;
57
+ if (d === 0)
58
+ d = 1 - m;
59
+ else {
60
+ if (d === g)
61
+ return p ? NaN : (y ? -1 : 1) * (1 / 0);
62
+ p = p + Math.pow(2, f), d = d - m;
63
+ }
64
+ return (y ? -1 : 1) * p * Math.pow(2, d - f);
65
+ };
66
+ ct.write = function(u, o, s, f, l, d) {
67
+ var p, c, g, m = d * 8 - l - 1, E = (1 << m) - 1, B = E >> 1, w = l === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, y = f ? 0 : d - 1, _ = f ? 1 : -1, S = o < 0 || o === 0 && 1 / o < 0 ? 1 : 0;
68
+ for (o = Math.abs(o), isNaN(o) || o === 1 / 0 ? (c = isNaN(o) ? 1 : 0, p = E) : (p = Math.floor(Math.log(o) / Math.LN2), o * (g = Math.pow(2, -p)) < 1 && (p--, g *= 2), p + B >= 1 ? o += w / g : o += w * Math.pow(2, 1 - B), o * g >= 2 && (p++, g /= 2), p + B >= E ? (c = 0, p = E) : p + B >= 1 ? (c = (o * g - 1) * Math.pow(2, l), p = p + B) : (c = o * Math.pow(2, B - 1) * Math.pow(2, l), p = 0)); l >= 8; u[s + y] = c & 255, y += _, c /= 256, l -= 8)
69
+ ;
70
+ for (p = p << l | c, m += l; m > 0; u[s + y] = p & 255, y += _, p /= 256, m -= 8)
71
+ ;
72
+ u[s + y - _] |= S * 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(u) {
81
+ const o = Q, s = ct, f = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
82
+ u.Buffer = c, u.SlowBuffer = W, u.INSPECT_MAX_BYTES = 50;
83
+ const l = 2147483647;
84
+ u.kMaxLength = l, c.TYPED_ARRAY_SUPPORT = d(), !c.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
85
+ "This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
86
+ );
87
+ function d() {
88
+ try {
89
+ const e = new Uint8Array(1), t = { foo: function() {
90
+ return 42;
91
+ } };
92
+ return Object.setPrototypeOf(t, Uint8Array.prototype), Object.setPrototypeOf(e, t), e.foo() === 42;
93
+ } catch {
94
+ return !1;
95
+ }
96
+ }
97
+ Object.defineProperty(c.prototype, "parent", {
98
+ enumerable: !0,
99
+ get: function() {
100
+ if (c.isBuffer(this))
101
+ return this.buffer;
102
+ }
103
+ }), Object.defineProperty(c.prototype, "offset", {
104
+ enumerable: !0,
105
+ get: function() {
106
+ if (c.isBuffer(this))
107
+ return this.byteOffset;
108
+ }
109
+ });
110
+ function p(e) {
111
+ if (e > l)
112
+ throw new RangeError('The value "' + e + '" is invalid for option "size"');
113
+ const t = new Uint8Array(e);
114
+ return Object.setPrototypeOf(t, c.prototype), t;
115
+ }
116
+ function c(e, t, r) {
117
+ if (typeof e == "number") {
118
+ if (typeof t == "string")
119
+ throw new TypeError(
120
+ 'The "string" argument must be of type string. Received type number'
121
+ );
122
+ return B(e);
123
+ }
124
+ return g(e, t, r);
125
+ }
126
+ c.poolSize = 8192;
127
+ function g(e, t, r) {
128
+ if (typeof e == "string")
129
+ return w(e, t);
130
+ if (ArrayBuffer.isView(e))
131
+ return _(e);
132
+ if (e == null)
133
+ throw new TypeError(
134
+ "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e
135
+ );
136
+ if (N(e, ArrayBuffer) || e && N(e.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (N(e, SharedArrayBuffer) || e && N(e.buffer, SharedArrayBuffer)))
137
+ return S(e, t, r);
138
+ if (typeof e == "number")
139
+ throw new TypeError(
140
+ 'The "value" argument must not be of type number. Received type number'
141
+ );
142
+ const n = e.valueOf && e.valueOf();
143
+ if (n != null && n !== e)
144
+ return c.from(n, t, r);
145
+ const i = X(e);
146
+ if (i)
147
+ return i;
148
+ if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof e[Symbol.toPrimitive] == "function")
149
+ return c.from(e[Symbol.toPrimitive]("string"), t, r);
150
+ throw new TypeError(
151
+ "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e
152
+ );
153
+ }
154
+ c.from = function(e, t, r) {
155
+ return g(e, t, r);
156
+ }, Object.setPrototypeOf(c.prototype, Uint8Array.prototype), Object.setPrototypeOf(c, Uint8Array);
157
+ function m(e) {
158
+ if (typeof e != "number")
159
+ throw new TypeError('"size" argument must be of type number');
160
+ if (e < 0)
161
+ throw new RangeError('The value "' + e + '" is invalid for option "size"');
162
+ }
163
+ function E(e, t, r) {
164
+ return m(e), e <= 0 ? p(e) : t !== void 0 ? typeof r == "string" ? p(e).fill(t, r) : p(e).fill(t) : p(e);
165
+ }
166
+ c.alloc = function(e, t, r) {
167
+ return E(e, t, r);
168
+ };
169
+ function B(e) {
170
+ return m(e), p(e < 0 ? 0 : T(e) | 0);
171
+ }
172
+ c.allocUnsafe = function(e) {
173
+ return B(e);
174
+ }, c.allocUnsafeSlow = function(e) {
175
+ return B(e);
176
+ };
177
+ function w(e, t) {
178
+ if ((typeof t != "string" || t === "") && (t = "utf8"), !c.isEncoding(t))
179
+ throw new TypeError("Unknown encoding: " + t);
180
+ const r = O(e, t) | 0;
181
+ let n = p(r);
182
+ const i = n.write(e, t);
183
+ return i !== r && (n = n.slice(0, i)), n;
184
+ }
185
+ function y(e) {
186
+ const t = e.length < 0 ? 0 : T(e.length) | 0, r = p(t);
187
+ for (let n = 0; n < t; n += 1)
188
+ r[n] = e[n] & 255;
189
+ return r;
190
+ }
191
+ function _(e) {
192
+ if (N(e, Uint8Array)) {
193
+ const t = new Uint8Array(e);
194
+ return S(t.buffer, t.byteOffset, t.byteLength);
195
+ }
196
+ return y(e);
197
+ }
198
+ function S(e, t, r) {
199
+ if (t < 0 || e.byteLength < t)
200
+ throw new RangeError('"offset" is outside of buffer bounds');
201
+ if (e.byteLength < t + (r || 0))
202
+ throw new RangeError('"length" is outside of buffer bounds');
203
+ let n;
204
+ return t === void 0 && r === void 0 ? n = new Uint8Array(e) : r === void 0 ? n = new Uint8Array(e, t) : n = new Uint8Array(e, t, r), Object.setPrototypeOf(n, c.prototype), n;
205
+ }
206
+ function X(e) {
207
+ if (c.isBuffer(e)) {
208
+ const t = T(e.length) | 0, r = p(t);
209
+ return r.length === 0 || e.copy(r, 0, 0, t), r;
210
+ }
211
+ if (e.length !== void 0)
212
+ return typeof e.length != "number" || nt(e.length) ? p(0) : y(e);
213
+ if (e.type === "Buffer" && Array.isArray(e.data))
214
+ return y(e.data);
215
+ }
216
+ function T(e) {
217
+ if (e >= l)
218
+ throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + l.toString(16) + " bytes");
219
+ return e | 0;
220
+ }
221
+ function W(e) {
222
+ return +e != e && (e = 0), c.alloc(+e);
223
+ }
224
+ c.isBuffer = function(t) {
225
+ return t != null && t._isBuffer === !0 && t !== c.prototype;
226
+ }, c.compare = function(t, r) {
227
+ if (N(t, Uint8Array) && (t = c.from(t, t.offset, t.byteLength)), N(r, Uint8Array) && (r = c.from(r, r.offset, r.byteLength)), !c.isBuffer(t) || !c.isBuffer(r))
228
+ throw new TypeError(
229
+ 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
230
+ );
231
+ if (t === r)
232
+ return 0;
233
+ let n = t.length, i = r.length;
234
+ for (let a = 0, h = Math.min(n, i); a < h; ++a)
235
+ if (t[a] !== r[a]) {
236
+ n = t[a], i = r[a];
237
+ break;
238
+ }
239
+ return n < i ? -1 : i < n ? 1 : 0;
240
+ }, c.isEncoding = function(t) {
241
+ switch (String(t).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
+ }, c.concat = function(t, r) {
258
+ if (!Array.isArray(t))
259
+ throw new TypeError('"list" argument must be an Array of Buffers');
260
+ if (t.length === 0)
261
+ return c.alloc(0);
262
+ let n;
263
+ if (r === void 0)
264
+ for (r = 0, n = 0; n < t.length; ++n)
265
+ r += t[n].length;
266
+ const i = c.allocUnsafe(r);
267
+ let a = 0;
268
+ for (n = 0; n < t.length; ++n) {
269
+ let h = t[n];
270
+ if (N(h, Uint8Array))
271
+ a + h.length > i.length ? (c.isBuffer(h) || (h = c.from(h)), h.copy(i, a)) : Uint8Array.prototype.set.call(
272
+ i,
273
+ h,
274
+ a
275
+ );
276
+ else if (c.isBuffer(h))
277
+ h.copy(i, a);
278
+ else
279
+ throw new TypeError('"list" argument must be an Array of Buffers');
280
+ a += h.length;
281
+ }
282
+ return i;
283
+ };
284
+ function O(e, t) {
285
+ if (c.isBuffer(e))
286
+ return e.length;
287
+ if (ArrayBuffer.isView(e) || N(e, ArrayBuffer))
288
+ return e.byteLength;
289
+ if (typeof e != "string")
290
+ throw new TypeError(
291
+ 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof e
292
+ );
293
+ const r = e.length, n = arguments.length > 2 && arguments[2] === !0;
294
+ if (!n && r === 0)
295
+ return 0;
296
+ let i = !1;
297
+ for (; ; )
298
+ switch (t) {
299
+ case "ascii":
300
+ case "latin1":
301
+ case "binary":
302
+ return r;
303
+ case "utf8":
304
+ case "utf-8":
305
+ return et(e).length;
306
+ case "ucs2":
307
+ case "ucs-2":
308
+ case "utf16le":
309
+ case "utf-16le":
310
+ return r * 2;
311
+ case "hex":
312
+ return r >>> 1;
313
+ case "base64":
314
+ return mt(e).length;
315
+ default:
316
+ if (i)
317
+ return n ? -1 : et(e).length;
318
+ t = ("" + t).toLowerCase(), i = !0;
319
+ }
320
+ }
321
+ c.byteLength = O;
322
+ function _t(e, t, r) {
323
+ let n = !1;
324
+ if ((t === void 0 || t < 0) && (t = 0), t > this.length || ((r === void 0 || r > this.length) && (r = this.length), r <= 0) || (r >>>= 0, t >>>= 0, r <= t))
325
+ return "";
326
+ for (e || (e = "utf8"); ; )
327
+ switch (e) {
328
+ case "hex":
329
+ return kt(this, t, r);
330
+ case "utf8":
331
+ case "utf-8":
332
+ return lt(this, t, r);
333
+ case "ascii":
334
+ return Tt(this, t, r);
335
+ case "latin1":
336
+ case "binary":
337
+ return Nt(this, t, r);
338
+ case "base64":
339
+ return Pt(this, t, r);
340
+ case "ucs2":
341
+ case "ucs-2":
342
+ case "utf16le":
343
+ case "utf-16le":
344
+ return Ot(this, t, r);
345
+ default:
346
+ if (n)
347
+ throw new TypeError("Unknown encoding: " + e);
348
+ e = (e + "").toLowerCase(), n = !0;
349
+ }
350
+ }
351
+ c.prototype._isBuffer = !0;
352
+ function D(e, t, r) {
353
+ const n = e[t];
354
+ e[t] = e[r], e[r] = n;
355
+ }
356
+ c.prototype.swap16 = function() {
357
+ const t = this.length;
358
+ if (t % 2 !== 0)
359
+ throw new RangeError("Buffer size must be a multiple of 16-bits");
360
+ for (let r = 0; r < t; r += 2)
361
+ D(this, r, r + 1);
362
+ return this;
363
+ }, c.prototype.swap32 = function() {
364
+ const t = this.length;
365
+ if (t % 4 !== 0)
366
+ throw new RangeError("Buffer size must be a multiple of 32-bits");
367
+ for (let r = 0; r < t; r += 4)
368
+ D(this, r, r + 3), D(this, r + 1, r + 2);
369
+ return this;
370
+ }, c.prototype.swap64 = function() {
371
+ const t = this.length;
372
+ if (t % 8 !== 0)
373
+ throw new RangeError("Buffer size must be a multiple of 64-bits");
374
+ for (let r = 0; r < t; r += 8)
375
+ D(this, r, r + 7), D(this, r + 1, r + 6), D(this, r + 2, r + 5), D(this, r + 3, r + 4);
376
+ return this;
377
+ }, c.prototype.toString = function() {
378
+ const t = this.length;
379
+ return t === 0 ? "" : arguments.length === 0 ? lt(this, 0, t) : _t.apply(this, arguments);
380
+ }, c.prototype.toLocaleString = c.prototype.toString, c.prototype.equals = function(t) {
381
+ if (!c.isBuffer(t))
382
+ throw new TypeError("Argument must be a Buffer");
383
+ return this === t ? !0 : c.compare(this, t) === 0;
384
+ }, c.prototype.inspect = function() {
385
+ let t = "";
386
+ const r = u.INSPECT_MAX_BYTES;
387
+ return t = this.toString("hex", 0, r).replace(/(.{2})/g, "$1 ").trim(), this.length > r && (t += " ... "), "<Buffer " + t + ">";
388
+ }, f && (c.prototype[f] = c.prototype.inspect), c.prototype.compare = function(t, r, n, i, a) {
389
+ if (N(t, Uint8Array) && (t = c.from(t, t.offset, t.byteLength)), !c.isBuffer(t))
390
+ throw new TypeError(
391
+ 'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof t
392
+ );
393
+ if (r === void 0 && (r = 0), n === void 0 && (n = t ? t.length : 0), i === void 0 && (i = 0), a === void 0 && (a = this.length), r < 0 || n > t.length || i < 0 || a > this.length)
394
+ throw new RangeError("out of range index");
395
+ if (i >= a && r >= n)
396
+ return 0;
397
+ if (i >= a)
398
+ return -1;
399
+ if (r >= n)
400
+ return 1;
401
+ if (r >>>= 0, n >>>= 0, i >>>= 0, a >>>= 0, this === t)
402
+ return 0;
403
+ let h = a - i, x = n - r;
404
+ const A = Math.min(h, x), F = this.slice(i, a), U = t.slice(r, n);
405
+ for (let I = 0; I < A; ++I)
406
+ if (F[I] !== U[I]) {
407
+ h = F[I], x = U[I];
408
+ break;
409
+ }
410
+ return h < x ? -1 : x < h ? 1 : 0;
411
+ };
412
+ function ht(e, t, r, n, i) {
413
+ if (e.length === 0)
414
+ return -1;
415
+ if (typeof r == "string" ? (n = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r, nt(r) && (r = i ? 0 : e.length - 1), r < 0 && (r = e.length + r), r >= e.length) {
416
+ if (i)
417
+ return -1;
418
+ r = e.length - 1;
419
+ } else if (r < 0)
420
+ if (i)
421
+ r = 0;
422
+ else
423
+ return -1;
424
+ if (typeof t == "string" && (t = c.from(t, n)), c.isBuffer(t))
425
+ return t.length === 0 ? -1 : ft(e, t, r, n, i);
426
+ if (typeof t == "number")
427
+ return t = t & 255, typeof Uint8Array.prototype.indexOf == "function" ? i ? Uint8Array.prototype.indexOf.call(e, t, r) : Uint8Array.prototype.lastIndexOf.call(e, t, r) : ft(e, [t], r, n, i);
428
+ throw new TypeError("val must be string, number or Buffer");
429
+ }
430
+ function ft(e, t, r, n, i) {
431
+ let a = 1, h = e.length, x = t.length;
432
+ if (n !== void 0 && (n = String(n).toLowerCase(), n === "ucs2" || n === "ucs-2" || n === "utf16le" || n === "utf-16le")) {
433
+ if (e.length < 2 || t.length < 2)
434
+ return -1;
435
+ a = 2, h /= 2, x /= 2, r /= 2;
436
+ }
437
+ function A(U, I) {
438
+ return a === 1 ? U[I] : U.readUInt16BE(I * a);
439
+ }
440
+ let F;
441
+ if (i) {
442
+ let U = -1;
443
+ for (F = r; F < h; F++)
444
+ if (A(e, F) === A(t, U === -1 ? 0 : F - U)) {
445
+ if (U === -1 && (U = F), F - U + 1 === x)
446
+ return U * a;
447
+ } else
448
+ U !== -1 && (F -= F - U), U = -1;
449
+ } else
450
+ for (r + x > h && (r = h - x), F = r; F >= 0; F--) {
451
+ let U = !0;
452
+ for (let I = 0; I < x; I++)
453
+ if (A(e, F + I) !== A(t, I)) {
454
+ U = !1;
455
+ break;
456
+ }
457
+ if (U)
458
+ return F;
459
+ }
460
+ return -1;
461
+ }
462
+ c.prototype.includes = function(t, r, n) {
463
+ return this.indexOf(t, r, n) !== -1;
464
+ }, c.prototype.indexOf = function(t, r, n) {
465
+ return ht(this, t, r, n, !0);
466
+ }, c.prototype.lastIndexOf = function(t, r, n) {
467
+ return ht(this, t, r, n, !1);
468
+ };
469
+ function bt(e, t, r, n) {
470
+ r = Number(r) || 0;
471
+ const i = e.length - r;
472
+ n ? (n = Number(n), n > i && (n = i)) : n = i;
473
+ const a = t.length;
474
+ n > a / 2 && (n = a / 2);
475
+ let h;
476
+ for (h = 0; h < n; ++h) {
477
+ const x = parseInt(t.substr(h * 2, 2), 16);
478
+ if (nt(x))
479
+ return h;
480
+ e[r + h] = x;
481
+ }
482
+ return h;
483
+ }
484
+ function Rt(e, t, r, n) {
485
+ return J(et(t, e.length - r), e, r, n);
486
+ }
487
+ function St(e, t, r, n) {
488
+ return J(Gt(t), e, r, n);
489
+ }
490
+ function Ct(e, t, r, n) {
491
+ return J(mt(t), e, r, n);
492
+ }
493
+ function Mt(e, t, r, n) {
494
+ return J(zt(t, e.length - r), e, r, n);
495
+ }
496
+ c.prototype.write = function(t, r, n, i) {
497
+ if (r === void 0)
498
+ i = "utf8", n = this.length, r = 0;
499
+ else if (n === void 0 && typeof r == "string")
500
+ i = r, n = this.length, r = 0;
501
+ else if (isFinite(r))
502
+ r = r >>> 0, isFinite(n) ? (n = n >>> 0, i === void 0 && (i = "utf8")) : (i = n, n = void 0);
503
+ else
504
+ throw new Error(
505
+ "Buffer.write(string, encoding, offset[, length]) is no longer supported"
506
+ );
507
+ const a = this.length - r;
508
+ if ((n === void 0 || n > a) && (n = a), t.length > 0 && (n < 0 || r < 0) || r > this.length)
509
+ throw new RangeError("Attempt to write outside buffer bounds");
510
+ i || (i = "utf8");
511
+ let h = !1;
512
+ for (; ; )
513
+ switch (i) {
514
+ case "hex":
515
+ return bt(this, t, r, n);
516
+ case "utf8":
517
+ case "utf-8":
518
+ return Rt(this, t, r, n);
519
+ case "ascii":
520
+ case "latin1":
521
+ case "binary":
522
+ return St(this, t, r, n);
523
+ case "base64":
524
+ return Ct(this, t, r, n);
525
+ case "ucs2":
526
+ case "ucs-2":
527
+ case "utf16le":
528
+ case "utf-16le":
529
+ return Mt(this, t, r, n);
530
+ default:
531
+ if (h)
532
+ throw new TypeError("Unknown encoding: " + i);
533
+ i = ("" + i).toLowerCase(), h = !0;
534
+ }
535
+ }, c.prototype.toJSON = function() {
536
+ return {
537
+ type: "Buffer",
538
+ data: Array.prototype.slice.call(this._arr || this, 0)
539
+ };
540
+ };
541
+ function Pt(e, t, r) {
542
+ return t === 0 && r === e.length ? o.fromByteArray(e) : o.fromByteArray(e.slice(t, r));
543
+ }
544
+ function lt(e, t, r) {
545
+ r = Math.min(e.length, r);
546
+ const n = [];
547
+ let i = t;
548
+ for (; i < r; ) {
549
+ const a = e[i];
550
+ let h = null, x = a > 239 ? 4 : a > 223 ? 3 : a > 191 ? 2 : 1;
551
+ if (i + x <= r) {
552
+ let A, F, U, I;
553
+ switch (x) {
554
+ case 1:
555
+ a < 128 && (h = a);
556
+ break;
557
+ case 2:
558
+ A = e[i + 1], (A & 192) === 128 && (I = (a & 31) << 6 | A & 63, I > 127 && (h = I));
559
+ break;
560
+ case 3:
561
+ A = e[i + 1], F = e[i + 2], (A & 192) === 128 && (F & 192) === 128 && (I = (a & 15) << 12 | (A & 63) << 6 | F & 63, I > 2047 && (I < 55296 || I > 57343) && (h = I));
562
+ break;
563
+ case 4:
564
+ A = e[i + 1], F = e[i + 2], U = e[i + 3], (A & 192) === 128 && (F & 192) === 128 && (U & 192) === 128 && (I = (a & 15) << 18 | (A & 63) << 12 | (F & 63) << 6 | U & 63, I > 65535 && I < 1114112 && (h = I));
565
+ }
566
+ }
567
+ h === null ? (h = 65533, x = 1) : h > 65535 && (h -= 65536, n.push(h >>> 10 & 1023 | 55296), h = 56320 | h & 1023), n.push(h), i += x;
568
+ }
569
+ return Lt(n);
570
+ }
571
+ const dt = 4096;
572
+ function Lt(e) {
573
+ const t = e.length;
574
+ if (t <= dt)
575
+ return String.fromCharCode.apply(String, e);
576
+ let r = "", n = 0;
577
+ for (; n < t; )
578
+ r += String.fromCharCode.apply(
579
+ String,
580
+ e.slice(n, n += dt)
581
+ );
582
+ return r;
583
+ }
584
+ function Tt(e, t, r) {
585
+ let n = "";
586
+ r = Math.min(e.length, r);
587
+ for (let i = t; i < r; ++i)
588
+ n += String.fromCharCode(e[i] & 127);
589
+ return n;
590
+ }
591
+ function Nt(e, t, r) {
592
+ let n = "";
593
+ r = Math.min(e.length, r);
594
+ for (let i = t; i < r; ++i)
595
+ n += String.fromCharCode(e[i]);
596
+ return n;
597
+ }
598
+ function kt(e, t, r) {
599
+ const n = e.length;
600
+ (!t || t < 0) && (t = 0), (!r || r < 0 || r > n) && (r = n);
601
+ let i = "";
602
+ for (let a = t; a < r; ++a)
603
+ i += Vt[e[a]];
604
+ return i;
605
+ }
606
+ function Ot(e, t, r) {
607
+ const n = e.slice(t, r);
608
+ let i = "";
609
+ for (let a = 0; a < n.length - 1; a += 2)
610
+ i += String.fromCharCode(n[a] + n[a + 1] * 256);
611
+ return i;
612
+ }
613
+ c.prototype.slice = function(t, r) {
614
+ const n = this.length;
615
+ t = ~~t, r = r === void 0 ? n : ~~r, t < 0 ? (t += n, t < 0 && (t = 0)) : t > n && (t = n), r < 0 ? (r += n, r < 0 && (r = 0)) : r > n && (r = n), r < t && (r = t);
616
+ const i = this.subarray(t, r);
617
+ return Object.setPrototypeOf(i, c.prototype), i;
618
+ };
619
+ function b(e, t, r) {
620
+ if (e % 1 !== 0 || e < 0)
621
+ throw new RangeError("offset is not uint");
622
+ if (e + t > r)
623
+ throw new RangeError("Trying to access beyond buffer length");
624
+ }
625
+ c.prototype.readUintLE = c.prototype.readUIntLE = function(t, r, n) {
626
+ t = t >>> 0, r = r >>> 0, n || b(t, r, this.length);
627
+ let i = this[t], a = 1, h = 0;
628
+ for (; ++h < r && (a *= 256); )
629
+ i += this[t + h] * a;
630
+ return i;
631
+ }, c.prototype.readUintBE = c.prototype.readUIntBE = function(t, r, n) {
632
+ t = t >>> 0, r = r >>> 0, n || b(t, r, this.length);
633
+ let i = this[t + --r], a = 1;
634
+ for (; r > 0 && (a *= 256); )
635
+ i += this[t + --r] * a;
636
+ return i;
637
+ }, c.prototype.readUint8 = c.prototype.readUInt8 = function(t, r) {
638
+ return t = t >>> 0, r || b(t, 1, this.length), this[t];
639
+ }, c.prototype.readUint16LE = c.prototype.readUInt16LE = function(t, r) {
640
+ return t = t >>> 0, r || b(t, 2, this.length), this[t] | this[t + 1] << 8;
641
+ }, c.prototype.readUint16BE = c.prototype.readUInt16BE = function(t, r) {
642
+ return t = t >>> 0, r || b(t, 2, this.length), this[t] << 8 | this[t + 1];
643
+ }, c.prototype.readUint32LE = c.prototype.readUInt32LE = function(t, r) {
644
+ return t = t >>> 0, r || b(t, 4, this.length), (this[t] | this[t + 1] << 8 | this[t + 2] << 16) + this[t + 3] * 16777216;
645
+ }, c.prototype.readUint32BE = c.prototype.readUInt32BE = function(t, r) {
646
+ return t = t >>> 0, r || b(t, 4, this.length), this[t] * 16777216 + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]);
647
+ }, c.prototype.readBigUInt64LE = $(function(t) {
648
+ t = t >>> 0, z(t, "offset");
649
+ const r = this[t], n = this[t + 7];
650
+ (r === void 0 || n === void 0) && Y(t, this.length - 8);
651
+ const i = r + this[++t] * 2 ** 8 + this[++t] * 2 ** 16 + this[++t] * 2 ** 24, a = this[++t] + this[++t] * 2 ** 8 + this[++t] * 2 ** 16 + n * 2 ** 24;
652
+ return BigInt(i) + (BigInt(a) << BigInt(32));
653
+ }), c.prototype.readBigUInt64BE = $(function(t) {
654
+ t = t >>> 0, z(t, "offset");
655
+ const r = this[t], n = this[t + 7];
656
+ (r === void 0 || n === void 0) && Y(t, this.length - 8);
657
+ const i = r * 2 ** 24 + this[++t] * 2 ** 16 + this[++t] * 2 ** 8 + this[++t], a = this[++t] * 2 ** 24 + this[++t] * 2 ** 16 + this[++t] * 2 ** 8 + n;
658
+ return (BigInt(i) << BigInt(32)) + BigInt(a);
659
+ }), c.prototype.readIntLE = function(t, r, n) {
660
+ t = t >>> 0, r = r >>> 0, n || b(t, r, this.length);
661
+ let i = this[t], a = 1, h = 0;
662
+ for (; ++h < r && (a *= 256); )
663
+ i += this[t + h] * a;
664
+ return a *= 128, i >= a && (i -= Math.pow(2, 8 * r)), i;
665
+ }, c.prototype.readIntBE = function(t, r, n) {
666
+ t = t >>> 0, r = r >>> 0, n || b(t, r, this.length);
667
+ let i = r, a = 1, h = this[t + --i];
668
+ for (; i > 0 && (a *= 256); )
669
+ h += this[t + --i] * a;
670
+ return a *= 128, h >= a && (h -= Math.pow(2, 8 * r)), h;
671
+ }, c.prototype.readInt8 = function(t, r) {
672
+ return t = t >>> 0, r || b(t, 1, this.length), this[t] & 128 ? (255 - this[t] + 1) * -1 : this[t];
673
+ }, c.prototype.readInt16LE = function(t, r) {
674
+ t = t >>> 0, r || b(t, 2, this.length);
675
+ const n = this[t] | this[t + 1] << 8;
676
+ return n & 32768 ? n | 4294901760 : n;
677
+ }, c.prototype.readInt16BE = function(t, r) {
678
+ t = t >>> 0, r || b(t, 2, this.length);
679
+ const n = this[t + 1] | this[t] << 8;
680
+ return n & 32768 ? n | 4294901760 : n;
681
+ }, c.prototype.readInt32LE = function(t, r) {
682
+ return t = t >>> 0, r || b(t, 4, this.length), this[t] | this[t + 1] << 8 | this[t + 2] << 16 | this[t + 3] << 24;
683
+ }, c.prototype.readInt32BE = function(t, r) {
684
+ return t = t >>> 0, r || b(t, 4, this.length), this[t] << 24 | this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3];
685
+ }, c.prototype.readBigInt64LE = $(function(t) {
686
+ t = t >>> 0, z(t, "offset");
687
+ const r = this[t], n = this[t + 7];
688
+ (r === void 0 || n === void 0) && Y(t, this.length - 8);
689
+ const i = this[t + 4] + this[t + 5] * 2 ** 8 + this[t + 6] * 2 ** 16 + (n << 24);
690
+ return (BigInt(i) << BigInt(32)) + BigInt(r + this[++t] * 2 ** 8 + this[++t] * 2 ** 16 + this[++t] * 2 ** 24);
691
+ }), c.prototype.readBigInt64BE = $(function(t) {
692
+ t = t >>> 0, z(t, "offset");
693
+ const r = this[t], n = this[t + 7];
694
+ (r === void 0 || n === void 0) && Y(t, this.length - 8);
695
+ const i = (r << 24) + // Overflow
696
+ this[++t] * 2 ** 16 + this[++t] * 2 ** 8 + this[++t];
697
+ return (BigInt(i) << BigInt(32)) + BigInt(this[++t] * 2 ** 24 + this[++t] * 2 ** 16 + this[++t] * 2 ** 8 + n);
698
+ }), c.prototype.readFloatLE = function(t, r) {
699
+ return t = t >>> 0, r || b(t, 4, this.length), s.read(this, t, !0, 23, 4);
700
+ }, c.prototype.readFloatBE = function(t, r) {
701
+ return t = t >>> 0, r || b(t, 4, this.length), s.read(this, t, !1, 23, 4);
702
+ }, c.prototype.readDoubleLE = function(t, r) {
703
+ return t = t >>> 0, r || b(t, 8, this.length), s.read(this, t, !0, 52, 8);
704
+ }, c.prototype.readDoubleBE = function(t, r) {
705
+ return t = t >>> 0, r || b(t, 8, this.length), s.read(this, t, !1, 52, 8);
706
+ };
707
+ function M(e, t, r, n, i, a) {
708
+ if (!c.isBuffer(e))
709
+ throw new TypeError('"buffer" argument must be a Buffer instance');
710
+ if (t > i || t < a)
711
+ throw new RangeError('"value" argument is out of bounds');
712
+ if (r + n > e.length)
713
+ throw new RangeError("Index out of range");
714
+ }
715
+ c.prototype.writeUintLE = c.prototype.writeUIntLE = function(t, r, n, i) {
716
+ if (t = +t, r = r >>> 0, n = n >>> 0, !i) {
717
+ const x = Math.pow(2, 8 * n) - 1;
718
+ M(this, t, r, n, x, 0);
719
+ }
720
+ let a = 1, h = 0;
721
+ for (this[r] = t & 255; ++h < n && (a *= 256); )
722
+ this[r + h] = t / a & 255;
723
+ return r + n;
724
+ }, c.prototype.writeUintBE = c.prototype.writeUIntBE = function(t, r, n, i) {
725
+ if (t = +t, r = r >>> 0, n = n >>> 0, !i) {
726
+ const x = Math.pow(2, 8 * n) - 1;
727
+ M(this, t, r, n, x, 0);
728
+ }
729
+ let a = n - 1, h = 1;
730
+ for (this[r + a] = t & 255; --a >= 0 && (h *= 256); )
731
+ this[r + a] = t / h & 255;
732
+ return r + n;
733
+ }, c.prototype.writeUint8 = c.prototype.writeUInt8 = function(t, r, n) {
734
+ return t = +t, r = r >>> 0, n || M(this, t, r, 1, 255, 0), this[r] = t & 255, r + 1;
735
+ }, c.prototype.writeUint16LE = c.prototype.writeUInt16LE = function(t, r, n) {
736
+ return t = +t, r = r >>> 0, n || M(this, t, r, 2, 65535, 0), this[r] = t & 255, this[r + 1] = t >>> 8, r + 2;
737
+ }, c.prototype.writeUint16BE = c.prototype.writeUInt16BE = function(t, r, n) {
738
+ return t = +t, r = r >>> 0, n || M(this, t, r, 2, 65535, 0), this[r] = t >>> 8, this[r + 1] = t & 255, r + 2;
739
+ }, c.prototype.writeUint32LE = c.prototype.writeUInt32LE = function(t, r, n) {
740
+ return t = +t, r = r >>> 0, n || M(this, t, r, 4, 4294967295, 0), this[r + 3] = t >>> 24, this[r + 2] = t >>> 16, this[r + 1] = t >>> 8, this[r] = t & 255, r + 4;
741
+ }, c.prototype.writeUint32BE = c.prototype.writeUInt32BE = function(t, r, n) {
742
+ return t = +t, r = r >>> 0, n || M(this, t, r, 4, 4294967295, 0), this[r] = t >>> 24, this[r + 1] = t >>> 16, this[r + 2] = t >>> 8, this[r + 3] = t & 255, r + 4;
743
+ };
744
+ function pt(e, t, r, n, i) {
745
+ Et(t, n, i, e, r, 7);
746
+ let a = Number(t & BigInt(4294967295));
747
+ e[r++] = a, a = a >> 8, e[r++] = a, a = a >> 8, e[r++] = a, a = a >> 8, e[r++] = a;
748
+ let h = Number(t >> BigInt(32) & BigInt(4294967295));
749
+ return e[r++] = h, h = h >> 8, e[r++] = h, h = h >> 8, e[r++] = h, h = h >> 8, e[r++] = h, r;
750
+ }
751
+ function wt(e, t, r, n, i) {
752
+ Et(t, n, i, e, r, 7);
753
+ let a = Number(t & BigInt(4294967295));
754
+ e[r + 7] = a, a = a >> 8, e[r + 6] = a, a = a >> 8, e[r + 5] = a, a = a >> 8, e[r + 4] = a;
755
+ let h = Number(t >> BigInt(32) & BigInt(4294967295));
756
+ return e[r + 3] = h, h = h >> 8, e[r + 2] = h, h = h >> 8, e[r + 1] = h, h = h >> 8, e[r] = h, r + 8;
757
+ }
758
+ c.prototype.writeBigUInt64LE = $(function(t, r = 0) {
759
+ return pt(this, t, r, BigInt(0), BigInt("0xffffffffffffffff"));
760
+ }), c.prototype.writeBigUInt64BE = $(function(t, r = 0) {
761
+ return wt(this, t, r, BigInt(0), BigInt("0xffffffffffffffff"));
762
+ }), c.prototype.writeIntLE = function(t, r, n, i) {
763
+ if (t = +t, r = r >>> 0, !i) {
764
+ const A = Math.pow(2, 8 * n - 1);
765
+ M(this, t, r, n, A - 1, -A);
766
+ }
767
+ let a = 0, h = 1, x = 0;
768
+ for (this[r] = t & 255; ++a < n && (h *= 256); )
769
+ t < 0 && x === 0 && this[r + a - 1] !== 0 && (x = 1), this[r + a] = (t / h >> 0) - x & 255;
770
+ return r + n;
771
+ }, c.prototype.writeIntBE = function(t, r, n, i) {
772
+ if (t = +t, r = r >>> 0, !i) {
773
+ const A = Math.pow(2, 8 * n - 1);
774
+ M(this, t, r, n, A - 1, -A);
775
+ }
776
+ let a = n - 1, h = 1, x = 0;
777
+ for (this[r + a] = t & 255; --a >= 0 && (h *= 256); )
778
+ t < 0 && x === 0 && this[r + a + 1] !== 0 && (x = 1), this[r + a] = (t / h >> 0) - x & 255;
779
+ return r + n;
780
+ }, c.prototype.writeInt8 = function(t, r, n) {
781
+ return t = +t, r = r >>> 0, n || M(this, t, r, 1, 127, -128), t < 0 && (t = 255 + t + 1), this[r] = t & 255, r + 1;
782
+ }, c.prototype.writeInt16LE = function(t, r, n) {
783
+ return t = +t, r = r >>> 0, n || M(this, t, r, 2, 32767, -32768), this[r] = t & 255, this[r + 1] = t >>> 8, r + 2;
784
+ }, c.prototype.writeInt16BE = function(t, r, n) {
785
+ return t = +t, r = r >>> 0, n || M(this, t, r, 2, 32767, -32768), this[r] = t >>> 8, this[r + 1] = t & 255, r + 2;
786
+ }, c.prototype.writeInt32LE = function(t, r, n) {
787
+ return t = +t, r = r >>> 0, n || M(this, t, r, 4, 2147483647, -2147483648), this[r] = t & 255, this[r + 1] = t >>> 8, this[r + 2] = t >>> 16, this[r + 3] = t >>> 24, r + 4;
788
+ }, c.prototype.writeInt32BE = function(t, r, n) {
789
+ return t = +t, r = r >>> 0, n || M(this, t, r, 4, 2147483647, -2147483648), t < 0 && (t = 4294967295 + t + 1), this[r] = t >>> 24, this[r + 1] = t >>> 16, this[r + 2] = t >>> 8, this[r + 3] = t & 255, r + 4;
790
+ }, c.prototype.writeBigInt64LE = $(function(t, r = 0) {
791
+ return pt(this, t, r, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
792
+ }), c.prototype.writeBigInt64BE = $(function(t, r = 0) {
793
+ return wt(this, t, r, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
794
+ });
795
+ function yt(e, t, r, n, i, a) {
796
+ if (r + n > e.length)
797
+ throw new RangeError("Index out of range");
798
+ if (r < 0)
799
+ throw new RangeError("Index out of range");
800
+ }
801
+ function Bt(e, t, r, n, i) {
802
+ return t = +t, r = r >>> 0, i || yt(e, t, r, 4), s.write(e, t, r, n, 23, 4), r + 4;
803
+ }
804
+ c.prototype.writeFloatLE = function(t, r, n) {
805
+ return Bt(this, t, r, !0, n);
806
+ }, c.prototype.writeFloatBE = function(t, r, n) {
807
+ return Bt(this, t, r, !1, n);
808
+ };
809
+ function xt(e, t, r, n, i) {
810
+ return t = +t, r = r >>> 0, i || yt(e, t, r, 8), s.write(e, t, r, n, 52, 8), r + 8;
811
+ }
812
+ c.prototype.writeDoubleLE = function(t, r, n) {
813
+ return xt(this, t, r, !0, n);
814
+ }, c.prototype.writeDoubleBE = function(t, r, n) {
815
+ return xt(this, t, r, !1, n);
816
+ }, c.prototype.copy = function(t, r, n, i) {
817
+ if (!c.isBuffer(t))
818
+ throw new TypeError("argument should be a Buffer");
819
+ if (n || (n = 0), !i && i !== 0 && (i = this.length), r >= t.length && (r = t.length), r || (r = 0), i > 0 && i < n && (i = n), i === n || t.length === 0 || this.length === 0)
820
+ return 0;
821
+ if (r < 0)
822
+ throw new RangeError("targetStart out of bounds");
823
+ if (n < 0 || n >= this.length)
824
+ throw new RangeError("Index out of range");
825
+ if (i < 0)
826
+ throw new RangeError("sourceEnd out of bounds");
827
+ i > this.length && (i = this.length), t.length - r < i - n && (i = t.length - r + n);
828
+ const a = i - n;
829
+ return this === t && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(r, n, i) : Uint8Array.prototype.set.call(
830
+ t,
831
+ this.subarray(n, i),
832
+ r
833
+ ), a;
834
+ }, c.prototype.fill = function(t, r, n, i) {
835
+ if (typeof t == "string") {
836
+ if (typeof r == "string" ? (i = r, r = 0, n = this.length) : typeof n == "string" && (i = n, n = this.length), i !== void 0 && typeof i != "string")
837
+ throw new TypeError("encoding must be a string");
838
+ if (typeof i == "string" && !c.isEncoding(i))
839
+ throw new TypeError("Unknown encoding: " + i);
840
+ if (t.length === 1) {
841
+ const h = t.charCodeAt(0);
842
+ (i === "utf8" && h < 128 || i === "latin1") && (t = h);
843
+ }
844
+ } else
845
+ typeof t == "number" ? t = t & 255 : typeof t == "boolean" && (t = Number(t));
846
+ if (r < 0 || this.length < r || this.length < n)
847
+ throw new RangeError("Out of range index");
848
+ if (n <= r)
849
+ return this;
850
+ r = r >>> 0, n = n === void 0 ? this.length : n >>> 0, t || (t = 0);
851
+ let a;
852
+ if (typeof t == "number")
853
+ for (a = r; a < n; ++a)
854
+ this[a] = t;
855
+ else {
856
+ const h = c.isBuffer(t) ? t : c.from(t, i), x = h.length;
857
+ if (x === 0)
858
+ throw new TypeError('The value "' + t + '" is invalid for argument "value"');
859
+ for (a = 0; a < n - r; ++a)
860
+ this[a + r] = h[a % x];
861
+ }
862
+ return this;
863
+ };
864
+ const G = {};
865
+ function rt(e, t, r) {
866
+ G[e] = class extends r {
867
+ constructor() {
868
+ super(), Object.defineProperty(this, "message", {
869
+ value: t.apply(this, arguments),
870
+ writable: !0,
871
+ configurable: !0
872
+ }), this.name = `${this.name} [${e}]`, this.stack, delete this.name;
873
+ }
874
+ get code() {
875
+ return e;
876
+ }
877
+ set code(i) {
878
+ Object.defineProperty(this, "code", {
879
+ configurable: !0,
880
+ enumerable: !0,
881
+ value: i,
882
+ writable: !0
883
+ });
884
+ }
885
+ toString() {
886
+ return `${this.name} [${e}]: ${this.message}`;
887
+ }
888
+ };
889
+ }
890
+ rt(
891
+ "ERR_BUFFER_OUT_OF_BOUNDS",
892
+ function(e) {
893
+ return e ? `${e} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
894
+ },
895
+ RangeError
896
+ ), rt(
897
+ "ERR_INVALID_ARG_TYPE",
898
+ function(e, t) {
899
+ return `The "${e}" argument must be of type number. Received type ${typeof t}`;
900
+ },
901
+ TypeError
902
+ ), rt(
903
+ "ERR_OUT_OF_RANGE",
904
+ function(e, t, r) {
905
+ let n = `The value of "${e}" is out of range.`, i = r;
906
+ return Number.isInteger(r) && Math.abs(r) > 2 ** 32 ? i = gt(String(r)) : typeof r == "bigint" && (i = String(r), (r > BigInt(2) ** BigInt(32) || r < -(BigInt(2) ** BigInt(32))) && (i = gt(i)), i += "n"), n += ` It must be ${t}. Received ${i}`, n;
907
+ },
908
+ RangeError
909
+ );
910
+ function gt(e) {
911
+ let t = "", r = e.length;
912
+ const n = e[0] === "-" ? 1 : 0;
913
+ for (; r >= n + 4; r -= 3)
914
+ t = `_${e.slice(r - 3, r)}${t}`;
915
+ return `${e.slice(0, r)}${t}`;
916
+ }
917
+ function $t(e, t, r) {
918
+ z(t, "offset"), (e[t] === void 0 || e[t + r] === void 0) && Y(t, e.length - (r + 1));
919
+ }
920
+ function Et(e, t, r, n, i, a) {
921
+ if (e > r || e < t) {
922
+ const h = typeof t == "bigint" ? "n" : "";
923
+ let x;
924
+ throw a > 3 ? t === 0 || t === BigInt(0) ? x = `>= 0${h} and < 2${h} ** ${(a + 1) * 8}${h}` : x = `>= -(2${h} ** ${(a + 1) * 8 - 1}${h}) and < 2 ** ${(a + 1) * 8 - 1}${h}` : x = `>= ${t}${h} and <= ${r}${h}`, new G.ERR_OUT_OF_RANGE("value", x, e);
925
+ }
926
+ $t(n, i, a);
927
+ }
928
+ function z(e, t) {
929
+ if (typeof e != "number")
930
+ throw new G.ERR_INVALID_ARG_TYPE(t, "number", e);
931
+ }
932
+ function Y(e, t, r) {
933
+ throw Math.floor(e) !== e ? (z(e, r), new G.ERR_OUT_OF_RANGE(r || "offset", "an integer", e)) : t < 0 ? new G.ERR_BUFFER_OUT_OF_BOUNDS() : new G.ERR_OUT_OF_RANGE(
934
+ r || "offset",
935
+ `>= ${r ? 1 : 0} and <= ${t}`,
936
+ e
937
+ );
938
+ }
939
+ const Dt = /[^+/0-9A-Za-z-_]/g;
940
+ function jt(e) {
941
+ if (e = e.split("=")[0], e = e.trim().replace(Dt, ""), e.length < 2)
942
+ return "";
943
+ for (; e.length % 4 !== 0; )
944
+ e = e + "=";
945
+ return e;
946
+ }
947
+ function et(e, t) {
948
+ t = t || 1 / 0;
949
+ let r;
950
+ const n = e.length;
951
+ let i = null;
952
+ const a = [];
953
+ for (let h = 0; h < n; ++h) {
954
+ if (r = e.charCodeAt(h), r > 55295 && r < 57344) {
955
+ if (!i) {
956
+ if (r > 56319) {
957
+ (t -= 3) > -1 && a.push(239, 191, 189);
958
+ continue;
959
+ } else if (h + 1 === n) {
960
+ (t -= 3) > -1 && a.push(239, 191, 189);
961
+ continue;
962
+ }
963
+ i = r;
964
+ continue;
965
+ }
966
+ if (r < 56320) {
967
+ (t -= 3) > -1 && a.push(239, 191, 189), i = r;
968
+ continue;
969
+ }
970
+ r = (i - 55296 << 10 | r - 56320) + 65536;
971
+ } else
972
+ i && (t -= 3) > -1 && a.push(239, 191, 189);
973
+ if (i = null, r < 128) {
974
+ if ((t -= 1) < 0)
975
+ break;
976
+ a.push(r);
977
+ } else if (r < 2048) {
978
+ if ((t -= 2) < 0)
979
+ break;
980
+ a.push(
981
+ r >> 6 | 192,
982
+ r & 63 | 128
983
+ );
984
+ } else if (r < 65536) {
985
+ if ((t -= 3) < 0)
986
+ break;
987
+ a.push(
988
+ r >> 12 | 224,
989
+ r >> 6 & 63 | 128,
990
+ r & 63 | 128
991
+ );
992
+ } else if (r < 1114112) {
993
+ if ((t -= 4) < 0)
994
+ break;
995
+ a.push(
996
+ r >> 18 | 240,
997
+ r >> 12 & 63 | 128,
998
+ r >> 6 & 63 | 128,
999
+ r & 63 | 128
1000
+ );
1001
+ } else
1002
+ throw new Error("Invalid code point");
1003
+ }
1004
+ return a;
1005
+ }
1006
+ function Gt(e) {
1007
+ const t = [];
1008
+ for (let r = 0; r < e.length; ++r)
1009
+ t.push(e.charCodeAt(r) & 255);
1010
+ return t;
1011
+ }
1012
+ function zt(e, t) {
1013
+ let r, n, i;
1014
+ const a = [];
1015
+ for (let h = 0; h < e.length && !((t -= 2) < 0); ++h)
1016
+ r = e.charCodeAt(h), n = r >> 8, i = r % 256, a.push(i), a.push(n);
1017
+ return a;
1018
+ }
1019
+ function mt(e) {
1020
+ return o.toByteArray(jt(e));
1021
+ }
1022
+ function J(e, t, r, n) {
1023
+ let i;
1024
+ for (i = 0; i < n && !(i + r >= t.length || i >= e.length); ++i)
1025
+ t[i + r] = e[i];
1026
+ return i;
1027
+ }
1028
+ function N(e, t) {
1029
+ return e instanceof t || e != null && e.constructor != null && e.constructor.name != null && e.constructor.name === t.name;
1030
+ }
1031
+ function nt(e) {
1032
+ return e !== e;
1033
+ }
1034
+ const Vt = function() {
1035
+ const e = "0123456789abcdef", t = new Array(256);
1036
+ for (let r = 0; r < 16; ++r) {
1037
+ const n = r * 16;
1038
+ for (let i = 0; i < 16; ++i)
1039
+ t[n + i] = e[r] + e[i];
1040
+ }
1041
+ return t;
1042
+ }();
1043
+ function $(e) {
1044
+ return typeof BigInt > "u" ? Wt : e;
1045
+ }
1046
+ function Wt() {
1047
+ throw new Error("BigInt not supported");
1048
+ }
1049
+ })(q);
1050
+ var v = {}, H = {};
1051
+ Object.defineProperty(H, "__esModule", { value: !0 });
1052
+ const vt = (u, o) => u << 8 | o, tr = (u, o, s) => u << 16 | o << 8 | s, rr = (u, o, s, f) => u << 24 | o << 16 | s << 8 | f, er = `Maxmind v2 module has changed API.
1053
+ Upgrade instructions can be found here: https://github.com/runk/node-maxmind/wiki/Migration-guide
1054
+ If you want to use legacy library then explicitly install maxmind@1`;
1055
+ H.default = {
1056
+ concat2: vt,
1057
+ concat3: tr,
1058
+ concat4: rr,
1059
+ legacyErrorMessage: er
1060
+ };
1061
+ var nr = L && L.__importDefault || function(u) {
1062
+ return u && u.__esModule ? u : { default: u };
1063
+ };
1064
+ Object.defineProperty(v, "__esModule", { value: !0 });
1065
+ const j = nr(H), ir = q;
1066
+ var C;
1067
+ (function(u) {
1068
+ u[u.Extended = 0] = "Extended", u[u.Pointer = 1] = "Pointer", u[u.Utf8String = 2] = "Utf8String", u[u.Double = 3] = "Double", u[u.Bytes = 4] = "Bytes", u[u.Uint16 = 5] = "Uint16", u[u.Uint32 = 6] = "Uint32", u[u.Map = 7] = "Map", u[u.Int32 = 8] = "Int32", u[u.Uint64 = 9] = "Uint64", u[u.Uint128 = 10] = "Uint128", u[u.Array = 11] = "Array", u[u.Container = 12] = "Container", u[u.EndMarker = 13] = "EndMarker", u[u.Boolean = 14] = "Boolean", u[u.Float = 15] = "Float";
1069
+ })(C || (C = {}));
1070
+ const or = [0, 2048, 526336, 0], ur = {
1071
+ get: () => {
1072
+ },
1073
+ set: () => {
1074
+ }
1075
+ }, R = (u, o) => ({ value: u, offset: o });
1076
+ class cr {
1077
+ constructor(o, s = 0, f = ur) {
1078
+ this.telemetry = {}, this.db = o, this.baseOffset = s, this.cache = f;
1079
+ }
1080
+ decode(o) {
1081
+ let s;
1082
+ const f = this.db[o++];
1083
+ let l = f >> 5;
1084
+ if (l === C.Pointer)
1085
+ return s = this.decodePointer(f, o), R(this.decodeFast(s.value).value, s.offset);
1086
+ if (l === C.Extended) {
1087
+ if (s = this.db[o] + 7, s < 8)
1088
+ throw new Error("Invalid Extended Type at offset " + o + " val " + s);
1089
+ l = s, o++;
1090
+ }
1091
+ const d = this.sizeFromCtrlByte(f, o);
1092
+ return this.decodeByType(l, d.offset, d.value);
1093
+ }
1094
+ decodeFast(o) {
1095
+ const s = this.cache.get(o);
1096
+ if (s)
1097
+ return s;
1098
+ const f = this.decode(o);
1099
+ return this.cache.set(o, f), f;
1100
+ }
1101
+ decodeByType(o, s, f) {
1102
+ const l = s + f;
1103
+ switch (o) {
1104
+ case C.Utf8String:
1105
+ return R(this.decodeString(s, f), l);
1106
+ case C.Map:
1107
+ return this.decodeMap(f, s);
1108
+ case C.Uint32:
1109
+ return R(this.decodeUint(s, f), l);
1110
+ case C.Double:
1111
+ return R(this.decodeDouble(s), l);
1112
+ case C.Array:
1113
+ return this.decodeArray(f, s);
1114
+ case C.Boolean:
1115
+ return R(this.decodeBoolean(f), s);
1116
+ case C.Float:
1117
+ return R(this.decodeFloat(s), l);
1118
+ case C.Bytes:
1119
+ return R(this.decodeBytes(s, f), l);
1120
+ case C.Uint16:
1121
+ return R(this.decodeUint(s, f), l);
1122
+ case C.Int32:
1123
+ return R(this.decodeInt32(s, f), l);
1124
+ case C.Uint64:
1125
+ return R(this.decodeUint(s, f), l);
1126
+ case C.Uint128:
1127
+ return R(this.decodeUint(s, f), l);
1128
+ }
1129
+ throw new Error("Unknown type " + o + " at offset " + s);
1130
+ }
1131
+ sizeFromCtrlByte(o, s) {
1132
+ const f = o & 31;
1133
+ return f < 29 ? R(f, s) : f === 29 ? R(29 + this.db[s], s + 1) : f === 30 ? R(285 + this.db.readUInt16BE(s), s + 2) : R(65821 + j.default.concat3(this.db[s], this.db[s + 1], this.db[s + 2]), s + 3);
1134
+ }
1135
+ decodeBytes(o, s) {
1136
+ return this.db.slice(o, o + s);
1137
+ }
1138
+ decodePointer(o, s) {
1139
+ const f = o >> 3 & 3, l = this.baseOffset + or[f];
1140
+ let d = 0;
1141
+ return f === 0 ? d = j.default.concat2(o & 7, this.db[s]) : f === 1 ? d = j.default.concat3(o & 7, this.db[s], this.db[s + 1]) : f === 2 ? d = j.default.concat4(o & 7, this.db[s], this.db[s + 1], this.db[s + 2]) : d = this.db.readUInt32BE(s), s += f + 1, R(l + d, s);
1142
+ }
1143
+ decodeArray(o, s) {
1144
+ let f;
1145
+ const l = [];
1146
+ for (let d = 0; d < o; d++)
1147
+ f = this.decode(s), s = f.offset, l.push(f.value);
1148
+ return R(l, s);
1149
+ }
1150
+ decodeBoolean(o) {
1151
+ return o !== 0;
1152
+ }
1153
+ decodeDouble(o) {
1154
+ return this.db.readDoubleBE(o);
1155
+ }
1156
+ decodeFloat(o) {
1157
+ return this.db.readFloatBE(o);
1158
+ }
1159
+ decodeMap(o, s) {
1160
+ let f, l;
1161
+ const d = {};
1162
+ for (let p = 0; p < o; p++)
1163
+ f = this.decode(s), l = f.value, f = this.decode(f.offset), s = f.offset, d[l] = f.value;
1164
+ return R(d, s);
1165
+ }
1166
+ decodeInt32(o, s) {
1167
+ return s === 0 ? 0 : this.db.readInt32BE(o);
1168
+ }
1169
+ decodeUint(o, s) {
1170
+ switch (s) {
1171
+ case 0:
1172
+ return 0;
1173
+ case 1:
1174
+ return this.db[o];
1175
+ case 2:
1176
+ return j.default.concat2(this.db[o + 0], this.db[o + 1]);
1177
+ case 3:
1178
+ return j.default.concat3(this.db[o + 0], this.db[o + 1], this.db[o + 2]);
1179
+ case 4:
1180
+ return j.default.concat4(this.db[o + 0], this.db[o + 1], this.db[o + 2], this.db[o + 3]);
1181
+ case 8:
1182
+ return this.decodeBigUint(o, s);
1183
+ case 16:
1184
+ return this.decodeBigUint(o, s);
1185
+ }
1186
+ return 0;
1187
+ }
1188
+ decodeString(o, s) {
1189
+ return this.db.slice(o, o + s).toString();
1190
+ }
1191
+ decodeBigUint(o, s) {
1192
+ const f = ir.Buffer.alloc(s);
1193
+ this.db.copy(f, 0, o, o + s);
1194
+ let l = BigInt(0);
1195
+ const d = s / 4;
1196
+ for (let p = 0; p < d; p++)
1197
+ l = l * BigInt(4294967296) + BigInt(f.readUInt32BE(p << 2));
1198
+ return l.toString();
1199
+ }
1200
+ }
1201
+ v.default = cr;
1202
+ var at = {};
1203
+ Object.defineProperty(at, "__esModule", { value: !0 });
1204
+ const ar = (u) => {
1205
+ const o = u.split(".", 4), s = parseInt(o[0]), f = parseInt(o[1]), l = parseInt(o[2]), d = parseInt(o[3]);
1206
+ return [s, f, l, d];
1207
+ }, Z = (u) => {
1208
+ const o = parseInt(u, 10).toString(16);
1209
+ return o.length === 2 ? o : "0" + o;
1210
+ }, sr = (u) => {
1211
+ const o = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
1212
+ let s, f, l;
1213
+ const d = u.indexOf(".") > -1 ? u.replace(/(\d+)\.(\d+)\.(\d+)\.(\d+)/, (g, m, E, B, w) => Z(m) + Z(E) + ":" + Z(B) + Z(w)) : u, [p, c] = d.split("::", 2);
1214
+ if (p)
1215
+ for (f = p.split(":"), s = 0; s < f.length; s++)
1216
+ l = parseInt(f[s], 16), o[s * 2] = l >> 8, o[s * 2 + 1] = l & 255;
1217
+ if (c) {
1218
+ f = c.split(":");
1219
+ const g = 16 - f.length * 2;
1220
+ for (s = 0; s < f.length; s++)
1221
+ l = parseInt(f[s], 16), o[g + s * 2] = l >> 8, o[g + (s * 2 + 1)] = l & 255;
1222
+ }
1223
+ return o;
1224
+ }, hr = (u) => u.indexOf(":") === -1 ? ar(u) : sr(u), fr = (u, o) => {
1225
+ const s = o >> 3, f = 7 ^ o & 7;
1226
+ return u[s] >>> f & 1;
1227
+ }, lr = (u) => /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(u), dr = (u) => /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/.test(u), pr = (u) => lr(u) || dr(u);
1228
+ at.default = {
1229
+ bitAt: fr,
1230
+ parse: hr,
1231
+ validate: pr
1232
+ };
1233
+ var Ut = {};
1234
+ (function(u) {
1235
+ var o = L && L.__importDefault || function(m) {
1236
+ return m && m.__esModule ? m : { default: m };
1237
+ };
1238
+ Object.defineProperty(u, "__esModule", { value: !0 }), u.isLegacyFormat = u.parseMetadata = void 0;
1239
+ const s = o(v), f = o(H), d = q.Buffer.from("ABCDEF4D61784D696E642E636F6D", "hex"), p = (m) => {
1240
+ const E = c(m), w = new s.default(m, E).decode(E).value;
1241
+ if (!w)
1242
+ throw new Error((0, u.isLegacyFormat)(m) ? f.default.legacyErrorMessage : "Cannot parse binary database");
1243
+ return [24, 28, 32].indexOf(w.record_size) > -1, {
1244
+ binaryFormatMajorVersion: w.binary_format_major_version,
1245
+ binaryFormatMinorVersion: w.binary_format_minor_version,
1246
+ buildEpoch: new Date(w.build_epoch * 1e3),
1247
+ databaseType: w.database_type,
1248
+ description: w.description,
1249
+ ipVersion: w.ip_version,
1250
+ languages: w.languages,
1251
+ nodeByteSize: w.record_size / 4,
1252
+ nodeCount: w.node_count,
1253
+ recordSize: w.record_size,
1254
+ searchTreeSize: w.node_count * w.record_size / 4,
1255
+ // Depth depends on the IP version, it's 32 for IPv4 and 128 for IPv6.
1256
+ treeDepth: Math.pow(2, w.ip_version + 1)
1257
+ };
1258
+ };
1259
+ u.parseMetadata = p;
1260
+ const c = (m) => {
1261
+ let E = 0, B = m.length - 1;
1262
+ const w = d.length - 1;
1263
+ for (; E <= w && B-- > 0; )
1264
+ E += m[B] === d[w - E] ? 1 : -E;
1265
+ return B + E;
1266
+ }, g = (m) => {
1267
+ for (let B = 0; B < 20; B++) {
1268
+ const w = m.slice(m.length - 3 - B, m.length - B);
1269
+ if (w[0] === 255 && w[1] === 255 && w[2] === 255)
1270
+ return !0;
1271
+ }
1272
+ return !1;
1273
+ };
1274
+ u.isLegacyFormat = g;
1275
+ })(Ut);
1276
+ var st = {}, wr = L && L.__importDefault || function(u) {
1277
+ return u && u.__esModule ? u : { default: u };
1278
+ };
1279
+ Object.defineProperty(st, "__esModule", { value: !0 });
1280
+ const tt = wr(H), yr = (u) => (o) => tt.default.concat3(u[o + 3], u[o + 4], u[o + 5]), Br = (u) => (o) => tt.default.concat3(u[o], u[o + 1], u[o + 2]), xr = (u) => (o) => tt.default.concat4(u[o + 3] >> 4, u[o], u[o + 1], u[o + 2]), gr = (u) => (o) => tt.default.concat4(u[o + 3] & 15, u[o + 4], u[o + 5], u[o + 6]), Er = (u) => (o) => u.readUInt32BE(o), mr = (u) => (o) => u.readUInt32BE(o + 4);
1281
+ st.default = (u, o) => {
1282
+ switch (o) {
1283
+ case 24:
1284
+ return { left: Br(u), right: yr(u) };
1285
+ case 28:
1286
+ return { left: xr(u), right: gr(u) };
1287
+ case 32:
1288
+ return { left: Er(u), right: mr(u) };
1289
+ }
1290
+ throw new Error("Unsupported record size");
1291
+ };
1292
+ var ot = {}, It;
1293
+ function Ir() {
1294
+ return It || (It = 1, Object.defineProperty(ot, "__esModule", { value: !0 })), ot;
1295
+ }
1296
+ (function(u) {
1297
+ var o = L && L.__createBinding || (Object.create ? function(B, w, y, _) {
1298
+ _ === void 0 && (_ = y);
1299
+ var S = Object.getOwnPropertyDescriptor(w, y);
1300
+ (!S || ("get" in S ? !w.__esModule : S.writable || S.configurable)) && (S = { enumerable: !0, get: function() {
1301
+ return w[y];
1302
+ } }), Object.defineProperty(B, _, S);
1303
+ } : function(B, w, y, _) {
1304
+ _ === void 0 && (_ = y), B[_] = w[y];
1305
+ }), s = L && L.__exportStar || function(B, w) {
1306
+ for (var y in B)
1307
+ y !== "default" && !Object.prototype.hasOwnProperty.call(w, y) && o(w, B, y);
1308
+ }, f = L && L.__importDefault || function(B) {
1309
+ return B && B.__esModule ? B : { default: B };
1310
+ };
1311
+ Object.defineProperty(u, "__esModule", { value: !0 }), u.Reader = void 0;
1312
+ const l = q, d = f(v), p = f(at), c = Ut, g = f(st), m = 16;
1313
+ class E {
1314
+ constructor(w, y = {}) {
1315
+ this.opts = y, this.load(w);
1316
+ }
1317
+ load(w) {
1318
+ if (!l.Buffer.isBuffer(w))
1319
+ throw new Error(`mmdb-lib expects an instance of Buffer, got: ${typeof w}`);
1320
+ this.db = w, this.metadata = (0, c.parseMetadata)(this.db), this.decoder = new d.default(this.db, this.metadata.searchTreeSize + m, this.opts.cache), this.walker = (0, g.default)(this.db, this.metadata.recordSize), this.ipv4StartNodeNumber = this.ipv4Start();
1321
+ }
1322
+ get(w) {
1323
+ const [y] = this.getWithPrefixLength(w);
1324
+ return y;
1325
+ }
1326
+ getWithPrefixLength(w) {
1327
+ const [y, _] = this.findAddressInTree(w);
1328
+ return [y ? this.resolveDataPointer(y) : null, _];
1329
+ }
1330
+ findAddressInTree(w) {
1331
+ const y = p.default.parse(w), _ = this.metadata.nodeCount, S = y.length * 8;
1332
+ let X, T = 0, W, O = 0;
1333
+ for (y.length === 4 && (T = this.ipv4StartNodeNumber); O < S && T < _; O++)
1334
+ X = p.default.bitAt(y, O), W = T * this.metadata.nodeByteSize, T = X ? this.walker.right(W) : this.walker.left(W);
1335
+ return T > _ ? [T, O] : [null, O];
1336
+ }
1337
+ resolveDataPointer(w) {
1338
+ const y = w - this.metadata.nodeCount + this.metadata.searchTreeSize;
1339
+ return this.decoder.decodeFast(y).value;
1340
+ }
1341
+ ipv4Start() {
1342
+ if (this.metadata.ipVersion === 4)
1343
+ return 0;
1344
+ const w = this.metadata.nodeCount;
1345
+ let y = 0, _ = 0;
1346
+ for (; _ < 96 && y < w; _++) {
1347
+ const S = y * this.metadata.nodeByteSize;
1348
+ y = this.walker.left(S);
1349
+ }
1350
+ return y;
1351
+ }
1352
+ }
1353
+ u.Reader = E, s(Ir(), u);
1354
+ })(Ft);
1355
+ async function Fr(u) {
1356
+ try {
1357
+ const o = await fetch(u);
1358
+ if (!o.ok)
1359
+ throw new Error("Network response was not ok");
1360
+ const s = await o.arrayBuffer(), f = new Uint8Array(s);
1361
+ return q.Buffer.from(f);
1362
+ } catch (o) {
1363
+ console.error("Fetching file failed:", o);
1364
+ }
1365
+ }
1366
+ const Ar = "https://raw.githubusercontent.com/Max-Sum/17mon-mmdb/release/Country.mmdb";
1367
+ let K = null;
1368
+ const Ur = async (u) => {
1369
+ if (K)
1370
+ return K;
1371
+ const o = await Fr(u ?? Ar);
1372
+ if (o)
1373
+ return K = new Ft.Reader(o), K;
1374
+ }, ut = /* @__PURE__ */ new Map(), _r = async (u) => {
1375
+ var d;
1376
+ if (ut.has(u))
1377
+ return ut.get(u);
1378
+ const o = await Ur(), s = o == null ? void 0 : o.get(u), f = (d = s == null ? void 0 : s.country) == null ? void 0 : d.names, l = (f == null ? void 0 : f["zh-CN"]) ?? (f == null ? void 0 : f.en) ?? "n/a";
1379
+ return l && ut.set(u, l), l;
1380
+ };
1381
+ window.getGeoFromIp = _r;
1382
+ //# sourceMappingURL=index.es.js.map