@btc-vision/bitcoin 6.5.1 → 6.5.2

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.
Files changed (103) hide show
  1. package/browser/chunks/crypto-0PweVewC.js +2033 -0
  2. package/browser/chunks/{payments-BE4vwHhV.js → payments-CgasufRS.js} +410 -408
  3. package/browser/chunks/psbt-BIwOrKer.js +4096 -0
  4. package/browser/chunks/{script-COWGdiOo.js → script-CROJPzz_.js} +96 -96
  5. package/browser/chunks/{transaction-BiXwH2v4.js → transaction-DchBu35N.js} +158 -147
  6. package/browser/chunks/{utils-BKmkTzNZ.js → utils-CO5kmxe9.js} +225 -223
  7. package/browser/crypto.d.ts +1 -1
  8. package/browser/hooks/HookedSigner.d.ts +1 -1
  9. package/browser/index.d.ts +23 -1
  10. package/browser/index.js +6 -6
  11. package/browser/payments/index.d.ts +2 -2
  12. package/browser/payments/lazy.d.ts +1 -1
  13. package/browser/psbt/bip371.d.ts +5 -1
  14. package/browser/psbt.d.ts +1 -1
  15. package/browser/typeforce.d.ts +38 -0
  16. package/browser/types.d.ts +22 -20
  17. package/build/address.js +2 -2
  18. package/build/bip66.js +2 -2
  19. package/build/block.js +2 -2
  20. package/build/crypto.d.ts +1 -1
  21. package/build/crypto.js +2 -3
  22. package/build/hooks/HookedSigner.d.ts +1 -1
  23. package/build/index.d.ts +23 -1
  24. package/build/payments/bip341.js +1 -1
  25. package/build/payments/index.d.ts +2 -2
  26. package/build/payments/lazy.d.ts +1 -1
  27. package/build/payments/p2op.js +3 -3
  28. package/build/payments/p2pk.js +1 -1
  29. package/build/payments/p2pkh.js +3 -3
  30. package/build/payments/p2sh.js +3 -3
  31. package/build/payments/p2tr.js +9 -5
  32. package/build/payments/p2wpkh.js +3 -3
  33. package/build/payments/p2wsh.js +2 -2
  34. package/build/psbt/bip371.d.ts +5 -1
  35. package/build/psbt/bip371.js +10 -7
  36. package/build/psbt/psbtutils.js +5 -4
  37. package/build/psbt.d.ts +1 -1
  38. package/build/psbt.js +78 -45
  39. package/build/script.js +2 -2
  40. package/build/script_signature.js +7 -7
  41. package/build/transaction.js +22 -10
  42. package/build/tsconfig.tsbuildinfo +1 -0
  43. package/build/types.d.ts +22 -20
  44. package/build/types.js +10 -9
  45. package/package.json +30 -59
  46. package/src/address.ts +2 -2
  47. package/src/bip66.ts +2 -2
  48. package/src/block.ts +8 -5
  49. package/src/crypto.ts +3 -4
  50. package/src/ecc_lib.ts +1 -1
  51. package/src/hooks/HookedSigner.ts +1 -1
  52. package/src/index.ts +34 -12
  53. package/src/payments/bip341.ts +1 -1
  54. package/src/payments/embed.ts +1 -2
  55. package/src/payments/index.ts +4 -4
  56. package/src/payments/lazy.ts +3 -3
  57. package/src/payments/p2op.ts +4 -3
  58. package/src/payments/p2pk.ts +1 -1
  59. package/src/payments/p2pkh.ts +3 -3
  60. package/src/payments/p2sh.ts +13 -5
  61. package/src/payments/p2tr.ts +8 -9
  62. package/src/payments/p2wpkh.ts +3 -3
  63. package/src/payments/p2wsh.ts +4 -4
  64. package/src/psbt/bip371.ts +22 -13
  65. package/src/psbt/psbtutils.ts +8 -5
  66. package/src/psbt.ts +127 -80
  67. package/src/script.ts +4 -4
  68. package/src/script_signature.ts +7 -7
  69. package/src/transaction.ts +31 -18
  70. package/src/typeforce.d.ts +38 -0
  71. package/src/types.ts +34 -29
  72. package/test/address.spec.ts +12 -4
  73. package/test/bitcoin.core.spec.ts +1 -1
  74. package/test/block.spec.ts +1 -1
  75. package/test/bufferutils.spec.ts +1 -1
  76. package/test/crypto.spec.ts +3 -2
  77. package/test/fixtures/address.json +1 -1
  78. package/test/integration/addresses.spec.ts +1 -1
  79. package/test/integration/bip32.spec.ts +2 -2
  80. package/test/integration/blocks.spec.ts +1 -1
  81. package/test/integration/cltv.spec.ts +3 -3
  82. package/test/integration/csv.spec.ts +3 -3
  83. package/test/integration/payments.spec.ts +1 -1
  84. package/test/integration/taproot.spec.ts +8 -7
  85. package/test/integration/transactions.spec.ts +2 -2
  86. package/test/payments.spec.ts +4 -3
  87. package/test/psbt.spec.ts +106 -74
  88. package/test/script.spec.ts +73 -7
  89. package/test/script_number.spec.ts +1 -1
  90. package/test/script_signature.spec.ts +1 -1
  91. package/test/transaction.spec.ts +1 -1
  92. package/test/tsconfig.json +1 -1
  93. package/test/types.spec.ts +1 -1
  94. package/vitest.config.ts +16 -0
  95. package/.babelrc +0 -13
  96. package/.mocharc.json +0 -13
  97. package/browser/chunks/crypto-C6FlKKmp.js +0 -2006
  98. package/browser/chunks/psbt-Dlosf9CT.js +0 -3853
  99. package/cjs/package.json +0 -3
  100. package/gulpfile.js +0 -42
  101. package/src/crypto/crypto-browser.js +0 -75
  102. package/test/ts-node-register.js +0 -7
  103. package/webpack.config.js +0 -79
@@ -1,2006 +0,0 @@
1
- var ut = {}, rt = {};
2
- rt.byteLength = hr;
3
- rt.toByteArray = ur;
4
- rt.fromByteArray = ar;
5
- var N = [], S = [], or = typeof Uint8Array < "u" ? Uint8Array : Array, ht = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
6
- for (var Y = 0, sr = ht.length; Y < sr; ++Y)
7
- N[Y] = ht[Y], S[ht.charCodeAt(Y)] = Y;
8
- S[45] = 62;
9
- S[95] = 63;
10
- function _t(c) {
11
- var s = c.length;
12
- if (s % 4 > 0)
13
- throw new Error("Invalid string. Length must be a multiple of 4");
14
- var p = c.indexOf("=");
15
- p === -1 && (p = s);
16
- var a = p === s ? 0 : 4 - p % 4;
17
- return [p, a];
18
- }
19
- function hr(c) {
20
- var s = _t(c), p = s[0], a = s[1];
21
- return (p + a) * 3 / 4 - a;
22
- }
23
- function cr(c, s, p) {
24
- return (s + p) * 3 / 4 - p;
25
- }
26
- function ur(c) {
27
- var s, p = _t(c), a = p[0], y = p[1], f = new or(cr(c, a, y)), l = 0, B = y > 0 ? a - 4 : a, w;
28
- for (w = 0; w < B; w += 4)
29
- s = S[c.charCodeAt(w)] << 18 | S[c.charCodeAt(w + 1)] << 12 | S[c.charCodeAt(w + 2)] << 6 | S[c.charCodeAt(w + 3)], f[l++] = s >> 16 & 255, f[l++] = s >> 8 & 255, f[l++] = s & 255;
30
- return y === 2 && (s = S[c.charCodeAt(w)] << 2 | S[c.charCodeAt(w + 1)] >> 4, f[l++] = s & 255), y === 1 && (s = S[c.charCodeAt(w)] << 10 | S[c.charCodeAt(w + 1)] << 4 | S[c.charCodeAt(w + 2)] >> 2, f[l++] = s >> 8 & 255, f[l++] = s & 255), f;
31
- }
32
- function fr(c) {
33
- return N[c >> 18 & 63] + N[c >> 12 & 63] + N[c >> 6 & 63] + N[c & 63];
34
- }
35
- function pr(c, s, p) {
36
- for (var a, y = [], f = s; f < p; f += 3)
37
- a = (c[f] << 16 & 16711680) + (c[f + 1] << 8 & 65280) + (c[f + 2] & 255), y.push(fr(a));
38
- return y.join("");
39
- }
40
- function ar(c) {
41
- for (var s, p = c.length, a = p % 3, y = [], f = 16383, l = 0, B = p - a; l < B; l += f)
42
- y.push(pr(c, l, l + f > B ? B : l + f));
43
- return a === 1 ? (s = c[p - 1], y.push(
44
- N[s >> 2] + N[s << 4 & 63] + "=="
45
- )) : a === 2 && (s = (c[p - 2] << 8) + c[p - 1], y.push(
46
- N[s >> 10] + N[s >> 4 & 63] + N[s << 2 & 63] + "="
47
- )), y.join("");
48
- }
49
- var ft = {};
50
- ft.read = function(c, s, p, a, y) {
51
- var f, l, B = y * 8 - a - 1, w = (1 << B) - 1, d = w >> 1, o = -7, g = p ? y - 1 : 0, U = p ? -1 : 1, E = c[s + g];
52
- for (g += U, f = E & (1 << -o) - 1, E >>= -o, o += B; o > 0; f = f * 256 + c[s + g], g += U, o -= 8)
53
- ;
54
- for (l = f & (1 << -o) - 1, f >>= -o, o += a; o > 0; l = l * 256 + c[s + g], g += U, o -= 8)
55
- ;
56
- if (f === 0)
57
- f = 1 - d;
58
- else {
59
- if (f === w)
60
- return l ? NaN : (E ? -1 : 1) * (1 / 0);
61
- l = l + Math.pow(2, a), f = f - d;
62
- }
63
- return (E ? -1 : 1) * l * Math.pow(2, f - a);
64
- };
65
- ft.write = function(c, s, p, a, y, f) {
66
- var l, B, w, d = f * 8 - y - 1, o = (1 << d) - 1, g = o >> 1, U = y === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, E = a ? 0 : f - 1, L = a ? 1 : -1, P = s < 0 || s === 0 && 1 / s < 0 ? 1 : 0;
67
- for (s = Math.abs(s), isNaN(s) || s === 1 / 0 ? (B = isNaN(s) ? 1 : 0, l = o) : (l = Math.floor(Math.log(s) / Math.LN2), s * (w = Math.pow(2, -l)) < 1 && (l--, w *= 2), l + g >= 1 ? s += U / w : s += U * Math.pow(2, 1 - g), s * w >= 2 && (l++, w /= 2), l + g >= o ? (B = 0, l = o) : l + g >= 1 ? (B = (s * w - 1) * Math.pow(2, y), l = l + g) : (B = s * Math.pow(2, g - 1) * Math.pow(2, y), l = 0)); y >= 8; c[p + E] = B & 255, E += L, B /= 256, y -= 8)
68
- ;
69
- for (l = l << y | B, d += y; d > 0; c[p + E] = l & 255, E += L, l /= 256, d -= 8)
70
- ;
71
- c[p + E - L] |= P * 128;
72
- };
73
- (function(c) {
74
- const s = rt, p = ft, a = typeof Symbol == "function" && typeof Symbol.for == "function" ? /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom") : null;
75
- c.Buffer = o, c.SlowBuffer = C, c.INSPECT_MAX_BYTES = 50;
76
- const y = 2147483647;
77
- c.kMaxLength = y;
78
- const { Uint8Array: f, ArrayBuffer: l, SharedArrayBuffer: B } = globalThis;
79
- o.TYPED_ARRAY_SUPPORT = w(), !o.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
80
- "This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
81
- );
82
- function w() {
83
- try {
84
- const i = new f(1), t = { foo: function() {
85
- return 42;
86
- } };
87
- return Object.setPrototypeOf(t, f.prototype), Object.setPrototypeOf(i, t), i.foo() === 42;
88
- } catch {
89
- return !1;
90
- }
91
- }
92
- Object.defineProperty(o.prototype, "parent", {
93
- enumerable: !0,
94
- get: function() {
95
- if (o.isBuffer(this))
96
- return this.buffer;
97
- }
98
- }), Object.defineProperty(o.prototype, "offset", {
99
- enumerable: !0,
100
- get: function() {
101
- if (o.isBuffer(this))
102
- return this.byteOffset;
103
- }
104
- });
105
- function d(i) {
106
- if (i > y)
107
- throw new RangeError('The value "' + i + '" is invalid for option "size"');
108
- const t = new f(i);
109
- return Object.setPrototypeOf(t, o.prototype), t;
110
- }
111
- function o(i, t, r) {
112
- if (typeof i == "number") {
113
- if (typeof t == "string")
114
- throw new TypeError(
115
- 'The "string" argument must be of type string. Received type number'
116
- );
117
- return L(i);
118
- }
119
- return g(i, t, r);
120
- }
121
- o.poolSize = 8192;
122
- function g(i, t, r) {
123
- if (typeof i == "string")
124
- return P(i, t);
125
- if (l.isView(i))
126
- return it(i);
127
- if (i == null)
128
- throw new TypeError(
129
- "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof i
130
- );
131
- if (M(i, l) || i && M(i.buffer, l) || typeof B < "u" && (M(i, B) || i && M(i.buffer, B)))
132
- return X(i, t, r);
133
- if (typeof i == "number")
134
- throw new TypeError(
135
- 'The "value" argument must not be of type number. Received type number'
136
- );
137
- const e = i.valueOf && i.valueOf();
138
- if (e != null && e !== i)
139
- return o.from(e, t, r);
140
- const n = et(i);
141
- if (n) return n;
142
- if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof i[Symbol.toPrimitive] == "function")
143
- return o.from(i[Symbol.toPrimitive]("string"), t, r);
144
- throw new TypeError(
145
- "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof i
146
- );
147
- }
148
- o.from = function(i, t, r) {
149
- return g(i, t, r);
150
- }, Object.setPrototypeOf(o.prototype, f.prototype), Object.setPrototypeOf(o, f);
151
- function U(i) {
152
- if (typeof i != "number")
153
- throw new TypeError('"size" argument must be of type number');
154
- if (i < 0)
155
- throw new RangeError('The value "' + i + '" is invalid for option "size"');
156
- }
157
- function E(i, t, r) {
158
- return U(i), i <= 0 ? d(i) : t !== void 0 ? typeof r == "string" ? d(i).fill(t, r) : d(i).fill(t) : d(i);
159
- }
160
- o.alloc = function(i, t, r) {
161
- return E(i, t, r);
162
- };
163
- function L(i) {
164
- return U(i), d(i < 0 ? 0 : J(i) | 0);
165
- }
166
- o.allocUnsafe = function(i) {
167
- return L(i);
168
- }, o.allocUnsafeSlow = function(i) {
169
- return L(i);
170
- };
171
- function P(i, t) {
172
- if ((typeof t != "string" || t === "") && (t = "utf8"), !o.isEncoding(t))
173
- throw new TypeError("Unknown encoding: " + t);
174
- const r = W(i, t) | 0;
175
- let e = d(r);
176
- const n = e.write(i, t);
177
- return n !== r && (e = e.slice(0, n)), e;
178
- }
179
- function q(i) {
180
- const t = i.length < 0 ? 0 : J(i.length) | 0, r = d(t);
181
- for (let e = 0; e < t; e += 1)
182
- r[e] = i[e] & 255;
183
- return r;
184
- }
185
- function it(i) {
186
- if (M(i, f)) {
187
- const t = new f(i);
188
- return X(t.buffer, t.byteOffset, t.byteLength);
189
- }
190
- return q(i);
191
- }
192
- function X(i, t, r) {
193
- if (t < 0 || i.byteLength < t)
194
- throw new RangeError('"offset" is outside of buffer bounds');
195
- if (i.byteLength < t + (r || 0))
196
- throw new RangeError('"length" is outside of buffer bounds');
197
- let e;
198
- return t === void 0 && r === void 0 ? e = new f(i) : r === void 0 ? e = new f(i, t) : e = new f(i, t, r), Object.setPrototypeOf(e, o.prototype), e;
199
- }
200
- function et(i) {
201
- if (o.isBuffer(i)) {
202
- const t = J(i.length) | 0, r = d(t);
203
- return r.length === 0 || i.copy(r, 0, 0, t), r;
204
- }
205
- if (i.length !== void 0)
206
- return typeof i.length != "number" || st(i.length) ? d(0) : q(i);
207
- if (i.type === "Buffer" && Array.isArray(i.data))
208
- return q(i.data);
209
- }
210
- function J(i) {
211
- if (i >= y)
212
- throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + y.toString(16) + " bytes");
213
- return i | 0;
214
- }
215
- function C(i) {
216
- return +i != i && (i = 0), o.alloc(+i);
217
- }
218
- o.isBuffer = function(t) {
219
- return t != null && t._isBuffer === !0 && t !== o.prototype;
220
- }, o.compare = function(t, r) {
221
- if (M(t, f) && (t = o.from(t, t.offset, t.byteLength)), M(r, f) && (r = o.from(r, r.offset, r.byteLength)), !o.isBuffer(t) || !o.isBuffer(r))
222
- throw new TypeError(
223
- 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
224
- );
225
- if (t === r) return 0;
226
- let e = t.length, n = r.length;
227
- for (let h = 0, u = Math.min(e, n); h < u; ++h)
228
- if (t[h] !== r[h]) {
229
- e = t[h], n = r[h];
230
- break;
231
- }
232
- return e < n ? -1 : n < e ? 1 : 0;
233
- }, o.isEncoding = function(t) {
234
- switch (String(t).toLowerCase()) {
235
- case "hex":
236
- case "utf8":
237
- case "utf-8":
238
- case "ascii":
239
- case "latin1":
240
- case "binary":
241
- case "base64":
242
- case "ucs2":
243
- case "ucs-2":
244
- case "utf16le":
245
- case "utf-16le":
246
- return !0;
247
- default:
248
- return !1;
249
- }
250
- }, o.concat = function(t, r) {
251
- if (!Array.isArray(t))
252
- throw new TypeError('"list" argument must be an Array of Buffers');
253
- if (t.length === 0)
254
- return o.alloc(0);
255
- let e;
256
- if (r === void 0)
257
- for (r = 0, e = 0; e < t.length; ++e)
258
- r += t[e].length;
259
- const n = o.allocUnsafe(r);
260
- let h = 0;
261
- for (e = 0; e < t.length; ++e) {
262
- let u = t[e];
263
- if (M(u, f))
264
- h + u.length > n.length ? (o.isBuffer(u) || (u = o.from(u)), u.copy(n, h)) : f.prototype.set.call(
265
- n,
266
- u,
267
- h
268
- );
269
- else if (o.isBuffer(u))
270
- u.copy(n, h);
271
- else
272
- throw new TypeError('"list" argument must be an Array of Buffers');
273
- h += u.length;
274
- }
275
- return n;
276
- };
277
- function W(i, t) {
278
- if (o.isBuffer(i))
279
- return i.length;
280
- if (l.isView(i) || M(i, l))
281
- return i.byteLength;
282
- if (typeof i != "string")
283
- throw new TypeError(
284
- 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof i
285
- );
286
- const r = i.length, e = arguments.length > 2 && arguments[2] === !0;
287
- if (!e && r === 0) return 0;
288
- let n = !1;
289
- for (; ; )
290
- switch (t) {
291
- case "ascii":
292
- case "latin1":
293
- case "binary":
294
- return r;
295
- case "utf8":
296
- case "utf-8":
297
- return ot(i).length;
298
- case "ucs2":
299
- case "ucs-2":
300
- case "utf16le":
301
- case "utf-16le":
302
- return r * 2;
303
- case "hex":
304
- return r >>> 1;
305
- case "base64":
306
- return Ut(i).length;
307
- default:
308
- if (n)
309
- return e ? -1 : ot(i).length;
310
- t = ("" + t).toLowerCase(), n = !0;
311
- }
312
- }
313
- o.byteLength = W;
314
- function Ot(i, t, r) {
315
- let e = !1;
316
- 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))
317
- return "";
318
- for (i || (i = "utf8"); ; )
319
- switch (i) {
320
- case "hex":
321
- return Zt(this, t, r);
322
- case "utf8":
323
- case "utf-8":
324
- return Bt(this, t, r);
325
- case "ascii":
326
- return Xt(this, t, r);
327
- case "latin1":
328
- case "binary":
329
- return Jt(this, t, r);
330
- case "base64":
331
- return Yt(this, t, r);
332
- case "ucs2":
333
- case "ucs-2":
334
- case "utf16le":
335
- case "utf-16le":
336
- return Qt(this, t, r);
337
- default:
338
- if (e) throw new TypeError("Unknown encoding: " + i);
339
- i = (i + "").toLowerCase(), e = !0;
340
- }
341
- }
342
- o.prototype._isBuffer = !0;
343
- function O(i, t, r) {
344
- const e = i[t];
345
- i[t] = i[r], i[r] = e;
346
- }
347
- o.prototype.swap16 = function() {
348
- const t = this.length;
349
- if (t % 2 !== 0)
350
- throw new RangeError("Buffer size must be a multiple of 16-bits");
351
- for (let r = 0; r < t; r += 2)
352
- O(this, r, r + 1);
353
- return this;
354
- }, o.prototype.swap32 = function() {
355
- const t = this.length;
356
- if (t % 4 !== 0)
357
- throw new RangeError("Buffer size must be a multiple of 32-bits");
358
- for (let r = 0; r < t; r += 4)
359
- O(this, r, r + 3), O(this, r + 1, r + 2);
360
- return this;
361
- }, o.prototype.swap64 = function() {
362
- const t = this.length;
363
- if (t % 8 !== 0)
364
- throw new RangeError("Buffer size must be a multiple of 64-bits");
365
- for (let r = 0; r < t; r += 8)
366
- O(this, r, r + 7), O(this, r + 1, r + 6), O(this, r + 2, r + 5), O(this, r + 3, r + 4);
367
- return this;
368
- }, o.prototype.toString = function() {
369
- const t = this.length;
370
- return t === 0 ? "" : arguments.length === 0 ? Bt(this, 0, t) : Ot.apply(this, arguments);
371
- }, o.prototype.toLocaleString = o.prototype.toString, o.prototype.equals = function(t) {
372
- if (!o.isBuffer(t)) throw new TypeError("Argument must be a Buffer");
373
- return this === t ? !0 : o.compare(this, t) === 0;
374
- }, o.prototype.inspect = function() {
375
- let t = "";
376
- const r = c.INSPECT_MAX_BYTES;
377
- return t = this.toString("hex", 0, r).replace(/(.{2})/g, "$1 ").trim(), this.length > r && (t += " ... "), "<Buffer " + t + ">";
378
- }, a && (o.prototype[a] = o.prototype.inspect), o.prototype.compare = function(t, r, e, n, h) {
379
- if (M(t, f) && (t = o.from(t, t.offset, t.byteLength)), !o.isBuffer(t))
380
- throw new TypeError(
381
- 'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof t
382
- );
383
- if (r === void 0 && (r = 0), e === void 0 && (e = t ? t.length : 0), n === void 0 && (n = 0), h === void 0 && (h = this.length), r < 0 || e > t.length || n < 0 || h > this.length)
384
- throw new RangeError("out of range index");
385
- if (n >= h && r >= e)
386
- return 0;
387
- if (n >= h)
388
- return -1;
389
- if (r >= e)
390
- return 1;
391
- if (r >>>= 0, e >>>= 0, n >>>= 0, h >>>= 0, this === t) return 0;
392
- let u = h - n, m = e - r;
393
- const A = Math.min(u, m), x = this.slice(n, h), b = t.slice(r, e);
394
- for (let I = 0; I < A; ++I)
395
- if (x[I] !== b[I]) {
396
- u = x[I], m = b[I];
397
- break;
398
- }
399
- return u < m ? -1 : m < u ? 1 : 0;
400
- };
401
- function yt(i, t, r, e, n) {
402
- if (i.length === 0) return -1;
403
- if (typeof r == "string" ? (e = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r, st(r) && (r = n ? 0 : i.length - 1), r < 0 && (r = i.length + r), r >= i.length) {
404
- if (n) return -1;
405
- r = i.length - 1;
406
- } else if (r < 0)
407
- if (n) r = 0;
408
- else return -1;
409
- if (typeof t == "string" && (t = o.from(t, e)), o.isBuffer(t))
410
- return t.length === 0 ? -1 : wt(i, t, r, e, n);
411
- if (typeof t == "number")
412
- return t = t & 255, typeof f.prototype.indexOf == "function" ? n ? f.prototype.indexOf.call(i, t, r) : f.prototype.lastIndexOf.call(i, t, r) : wt(i, [t], r, e, n);
413
- throw new TypeError("val must be string, number or Buffer");
414
- }
415
- function wt(i, t, r, e, n) {
416
- let h = 1, u = i.length, m = t.length;
417
- if (e !== void 0 && (e = String(e).toLowerCase(), e === "ucs2" || e === "ucs-2" || e === "utf16le" || e === "utf-16le")) {
418
- if (i.length < 2 || t.length < 2)
419
- return -1;
420
- h = 2, u /= 2, m /= 2, r /= 2;
421
- }
422
- function A(b, I) {
423
- return h === 1 ? b[I] : b.readUInt16BE(I * h);
424
- }
425
- let x;
426
- if (n) {
427
- let b = -1;
428
- for (x = r; x < u; x++)
429
- if (A(i, x) === A(t, b === -1 ? 0 : x - b)) {
430
- if (b === -1 && (b = x), x - b + 1 === m) return b * h;
431
- } else
432
- b !== -1 && (x -= x - b), b = -1;
433
- } else
434
- for (r + m > u && (r = u - m), x = r; x >= 0; x--) {
435
- let b = !0;
436
- for (let I = 0; I < m; I++)
437
- if (A(i, x + I) !== A(t, I)) {
438
- b = !1;
439
- break;
440
- }
441
- if (b) return x;
442
- }
443
- return -1;
444
- }
445
- o.prototype.includes = function(t, r, e) {
446
- return this.indexOf(t, r, e) !== -1;
447
- }, o.prototype.indexOf = function(t, r, e) {
448
- return yt(this, t, r, e, !0);
449
- }, o.prototype.lastIndexOf = function(t, r, e) {
450
- return yt(this, t, r, e, !1);
451
- };
452
- function Gt(i, t, r, e) {
453
- r = Number(r) || 0;
454
- const n = i.length - r;
455
- e ? (e = Number(e), e > n && (e = n)) : e = n;
456
- const h = t.length;
457
- e > h / 2 && (e = h / 2);
458
- let u;
459
- for (u = 0; u < e; ++u) {
460
- const m = parseInt(t.substr(u * 2, 2), 16);
461
- if (st(m)) return u;
462
- i[r + u] = m;
463
- }
464
- return u;
465
- }
466
- function jt(i, t, r, e) {
467
- return z(ot(t, i.length - r), i, r, e);
468
- }
469
- function Wt(i, t, r, e) {
470
- return z(rr(t), i, r, e);
471
- }
472
- function Vt(i, t, r, e) {
473
- return z(Ut(t), i, r, e);
474
- }
475
- function Kt(i, t, r, e) {
476
- return z(ir(t, i.length - r), i, r, e);
477
- }
478
- o.prototype.write = function(t, r, e, n) {
479
- if (r === void 0)
480
- n = "utf8", e = this.length, r = 0;
481
- else if (e === void 0 && typeof r == "string")
482
- n = r, e = this.length, r = 0;
483
- else if (isFinite(r))
484
- r = r >>> 0, isFinite(e) ? (e = e >>> 0, n === void 0 && (n = "utf8")) : (n = e, e = void 0);
485
- else
486
- throw new Error(
487
- "Buffer.write(string, encoding, offset[, length]) is no longer supported"
488
- );
489
- const h = this.length - r;
490
- if ((e === void 0 || e > h) && (e = h), t.length > 0 && (e < 0 || r < 0) || r > this.length)
491
- throw new RangeError("Attempt to write outside buffer bounds");
492
- n || (n = "utf8");
493
- let u = !1;
494
- for (; ; )
495
- switch (n) {
496
- case "hex":
497
- return Gt(this, t, r, e);
498
- case "utf8":
499
- case "utf-8":
500
- return jt(this, t, r, e);
501
- case "ascii":
502
- case "latin1":
503
- case "binary":
504
- return Wt(this, t, r, e);
505
- case "base64":
506
- return Vt(this, t, r, e);
507
- case "ucs2":
508
- case "ucs-2":
509
- case "utf16le":
510
- case "utf-16le":
511
- return Kt(this, t, r, e);
512
- default:
513
- if (u) throw new TypeError("Unknown encoding: " + n);
514
- n = ("" + n).toLowerCase(), u = !0;
515
- }
516
- }, o.prototype.toJSON = function() {
517
- return {
518
- type: "Buffer",
519
- data: Array.prototype.slice.call(this._arr || this, 0)
520
- };
521
- };
522
- function Yt(i, t, r) {
523
- return t === 0 && r === i.length ? s.fromByteArray(i) : s.fromByteArray(i.slice(t, r));
524
- }
525
- function Bt(i, t, r) {
526
- r = Math.min(i.length, r);
527
- const e = [];
528
- let n = t;
529
- for (; n < r; ) {
530
- const h = i[n];
531
- let u = null, m = h > 239 ? 4 : h > 223 ? 3 : h > 191 ? 2 : 1;
532
- if (n + m <= r) {
533
- let A, x, b, I;
534
- switch (m) {
535
- case 1:
536
- h < 128 && (u = h);
537
- break;
538
- case 2:
539
- A = i[n + 1], (A & 192) === 128 && (I = (h & 31) << 6 | A & 63, I > 127 && (u = I));
540
- break;
541
- case 3:
542
- A = i[n + 1], x = i[n + 2], (A & 192) === 128 && (x & 192) === 128 && (I = (h & 15) << 12 | (A & 63) << 6 | x & 63, I > 2047 && (I < 55296 || I > 57343) && (u = I));
543
- break;
544
- case 4:
545
- A = i[n + 1], x = i[n + 2], b = i[n + 3], (A & 192) === 128 && (x & 192) === 128 && (b & 192) === 128 && (I = (h & 15) << 18 | (A & 63) << 12 | (x & 63) << 6 | b & 63, I > 65535 && I < 1114112 && (u = I));
546
- }
547
- }
548
- u === null ? (u = 65533, m = 1) : u > 65535 && (u -= 65536, e.push(u >>> 10 & 1023 | 55296), u = 56320 | u & 1023), e.push(u), n += m;
549
- }
550
- return qt(e);
551
- }
552
- const gt = 4096;
553
- function qt(i) {
554
- const t = i.length;
555
- if (t <= gt)
556
- return String.fromCharCode.apply(String, i);
557
- let r = "", e = 0;
558
- for (; e < t; )
559
- r += String.fromCharCode.apply(
560
- String,
561
- i.slice(e, e += gt)
562
- );
563
- return r;
564
- }
565
- function Xt(i, t, r) {
566
- let e = "";
567
- r = Math.min(i.length, r);
568
- for (let n = t; n < r; ++n)
569
- e += String.fromCharCode(i[n] & 127);
570
- return e;
571
- }
572
- function Jt(i, t, r) {
573
- let e = "";
574
- r = Math.min(i.length, r);
575
- for (let n = t; n < r; ++n)
576
- e += String.fromCharCode(i[n]);
577
- return e;
578
- }
579
- function Zt(i, t, r) {
580
- const e = i.length;
581
- (!t || t < 0) && (t = 0), (!r || r < 0 || r > e) && (r = e);
582
- let n = "";
583
- for (let h = t; h < r; ++h)
584
- n += er[i[h]];
585
- return n;
586
- }
587
- function Qt(i, t, r) {
588
- const e = i.slice(t, r);
589
- let n = "";
590
- for (let h = 0; h < e.length - 1; h += 2)
591
- n += String.fromCharCode(e[h] + e[h + 1] * 256);
592
- return n;
593
- }
594
- o.prototype.slice = function(t, r) {
595
- const e = this.length;
596
- t = ~~t, r = r === void 0 ? e : ~~r, t < 0 ? (t += e, t < 0 && (t = 0)) : t > e && (t = e), r < 0 ? (r += e, r < 0 && (r = 0)) : r > e && (r = e), r < t && (r = t);
597
- const n = this.subarray(t, r);
598
- return Object.setPrototypeOf(n, o.prototype), n;
599
- };
600
- function T(i, t, r) {
601
- if (i % 1 !== 0 || i < 0) throw new RangeError("offset is not uint");
602
- if (i + t > r) throw new RangeError("Trying to access beyond buffer length");
603
- }
604
- o.prototype.readUintLE = o.prototype.readUIntLE = function(t, r, e) {
605
- t = t >>> 0, r = r >>> 0, e || T(t, r, this.length);
606
- let n = this[t], h = 1, u = 0;
607
- for (; ++u < r && (h *= 256); )
608
- n += this[t + u] * h;
609
- return n;
610
- }, o.prototype.readUintBE = o.prototype.readUIntBE = function(t, r, e) {
611
- t = t >>> 0, r = r >>> 0, e || T(t, r, this.length);
612
- let n = this[t + --r], h = 1;
613
- for (; r > 0 && (h *= 256); )
614
- n += this[t + --r] * h;
615
- return n;
616
- }, o.prototype.readUint8 = o.prototype.readUInt8 = function(t, r) {
617
- return t = t >>> 0, r || T(t, 1, this.length), this[t];
618
- }, o.prototype.readUint16LE = o.prototype.readUInt16LE = function(t, r) {
619
- return t = t >>> 0, r || T(t, 2, this.length), this[t] | this[t + 1] << 8;
620
- }, o.prototype.readUint16BE = o.prototype.readUInt16BE = function(t, r) {
621
- return t = t >>> 0, r || T(t, 2, this.length), this[t] << 8 | this[t + 1];
622
- }, o.prototype.readUint32LE = o.prototype.readUInt32LE = function(t, r) {
623
- return t = t >>> 0, r || T(t, 4, this.length), (this[t] | this[t + 1] << 8 | this[t + 2] << 16) + this[t + 3] * 16777216;
624
- }, o.prototype.readUint32BE = o.prototype.readUInt32BE = function(t, r) {
625
- return t = t >>> 0, r || T(t, 4, this.length), this[t] * 16777216 + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]);
626
- }, o.prototype.readBigUInt64LE = D(function(t) {
627
- t = t >>> 0, K(t, "offset");
628
- const r = this[t], e = this[t + 7];
629
- (r === void 0 || e === void 0) && Z(t, this.length - 8);
630
- const n = r + this[++t] * 2 ** 8 + this[++t] * 2 ** 16 + this[++t] * 2 ** 24, h = this[++t] + this[++t] * 2 ** 8 + this[++t] * 2 ** 16 + e * 2 ** 24;
631
- return BigInt(n) + (BigInt(h) << BigInt(32));
632
- }), o.prototype.readBigUInt64BE = D(function(t) {
633
- t = t >>> 0, K(t, "offset");
634
- const r = this[t], e = this[t + 7];
635
- (r === void 0 || e === void 0) && Z(t, this.length - 8);
636
- const n = r * 2 ** 24 + this[++t] * 2 ** 16 + this[++t] * 2 ** 8 + this[++t], h = this[++t] * 2 ** 24 + this[++t] * 2 ** 16 + this[++t] * 2 ** 8 + e;
637
- return (BigInt(n) << BigInt(32)) + BigInt(h);
638
- }), o.prototype.readIntLE = function(t, r, e) {
639
- t = t >>> 0, r = r >>> 0, e || T(t, r, this.length);
640
- let n = this[t], h = 1, u = 0;
641
- for (; ++u < r && (h *= 256); )
642
- n += this[t + u] * h;
643
- return h *= 128, n >= h && (n -= Math.pow(2, 8 * r)), n;
644
- }, o.prototype.readIntBE = function(t, r, e) {
645
- t = t >>> 0, r = r >>> 0, e || T(t, r, this.length);
646
- let n = r, h = 1, u = this[t + --n];
647
- for (; n > 0 && (h *= 256); )
648
- u += this[t + --n] * h;
649
- return h *= 128, u >= h && (u -= Math.pow(2, 8 * r)), u;
650
- }, o.prototype.readInt8 = function(t, r) {
651
- return t = t >>> 0, r || T(t, 1, this.length), this[t] & 128 ? (255 - this[t] + 1) * -1 : this[t];
652
- }, o.prototype.readInt16LE = function(t, r) {
653
- t = t >>> 0, r || T(t, 2, this.length);
654
- const e = this[t] | this[t + 1] << 8;
655
- return e & 32768 ? e | 4294901760 : e;
656
- }, o.prototype.readInt16BE = function(t, r) {
657
- t = t >>> 0, r || T(t, 2, this.length);
658
- const e = this[t + 1] | this[t] << 8;
659
- return e & 32768 ? e | 4294901760 : e;
660
- }, o.prototype.readInt32LE = function(t, r) {
661
- return t = t >>> 0, r || T(t, 4, this.length), this[t] | this[t + 1] << 8 | this[t + 2] << 16 | this[t + 3] << 24;
662
- }, o.prototype.readInt32BE = function(t, r) {
663
- return t = t >>> 0, r || T(t, 4, this.length), this[t] << 24 | this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3];
664
- }, o.prototype.readBigInt64LE = D(function(t) {
665
- t = t >>> 0, K(t, "offset");
666
- const r = this[t], e = this[t + 7];
667
- (r === void 0 || e === void 0) && Z(t, this.length - 8);
668
- const n = this[t + 4] + this[t + 5] * 2 ** 8 + this[t + 6] * 2 ** 16 + (e << 24);
669
- return (BigInt(n) << BigInt(32)) + BigInt(r + this[++t] * 2 ** 8 + this[++t] * 2 ** 16 + this[++t] * 2 ** 24);
670
- }), o.prototype.readBigInt64BE = D(function(t) {
671
- t = t >>> 0, K(t, "offset");
672
- const r = this[t], e = this[t + 7];
673
- (r === void 0 || e === void 0) && Z(t, this.length - 8);
674
- const n = (r << 24) + // Overflow
675
- this[++t] * 2 ** 16 + this[++t] * 2 ** 8 + this[++t];
676
- return (BigInt(n) << BigInt(32)) + BigInt(this[++t] * 2 ** 24 + this[++t] * 2 ** 16 + this[++t] * 2 ** 8 + e);
677
- }), o.prototype.readFloatLE = function(t, r) {
678
- return t = t >>> 0, r || T(t, 4, this.length), p.read(this, t, !0, 23, 4);
679
- }, o.prototype.readFloatBE = function(t, r) {
680
- return t = t >>> 0, r || T(t, 4, this.length), p.read(this, t, !1, 23, 4);
681
- }, o.prototype.readDoubleLE = function(t, r) {
682
- return t = t >>> 0, r || T(t, 8, this.length), p.read(this, t, !0, 52, 8);
683
- }, o.prototype.readDoubleBE = function(t, r) {
684
- return t = t >>> 0, r || T(t, 8, this.length), p.read(this, t, !1, 52, 8);
685
- };
686
- function _(i, t, r, e, n, h) {
687
- if (!o.isBuffer(i)) throw new TypeError('"buffer" argument must be a Buffer instance');
688
- if (t > n || t < h) throw new RangeError('"value" argument is out of bounds');
689
- if (r + e > i.length) throw new RangeError("Index out of range");
690
- }
691
- o.prototype.writeUintLE = o.prototype.writeUIntLE = function(t, r, e, n) {
692
- if (t = +t, r = r >>> 0, e = e >>> 0, !n) {
693
- const m = Math.pow(2, 8 * e) - 1;
694
- _(this, t, r, e, m, 0);
695
- }
696
- let h = 1, u = 0;
697
- for (this[r] = t & 255; ++u < e && (h *= 256); )
698
- this[r + u] = t / h & 255;
699
- return r + e;
700
- }, o.prototype.writeUintBE = o.prototype.writeUIntBE = function(t, r, e, n) {
701
- if (t = +t, r = r >>> 0, e = e >>> 0, !n) {
702
- const m = Math.pow(2, 8 * e) - 1;
703
- _(this, t, r, e, m, 0);
704
- }
705
- let h = e - 1, u = 1;
706
- for (this[r + h] = t & 255; --h >= 0 && (u *= 256); )
707
- this[r + h] = t / u & 255;
708
- return r + e;
709
- }, o.prototype.writeUint8 = o.prototype.writeUInt8 = function(t, r, e) {
710
- return t = +t, r = r >>> 0, e || _(this, t, r, 1, 255, 0), this[r] = t & 255, r + 1;
711
- }, o.prototype.writeUint16LE = o.prototype.writeUInt16LE = function(t, r, e) {
712
- return t = +t, r = r >>> 0, e || _(this, t, r, 2, 65535, 0), this[r] = t & 255, this[r + 1] = t >>> 8, r + 2;
713
- }, o.prototype.writeUint16BE = o.prototype.writeUInt16BE = function(t, r, e) {
714
- return t = +t, r = r >>> 0, e || _(this, t, r, 2, 65535, 0), this[r] = t >>> 8, this[r + 1] = t & 255, r + 2;
715
- }, o.prototype.writeUint32LE = o.prototype.writeUInt32LE = function(t, r, e) {
716
- return t = +t, r = r >>> 0, e || _(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;
717
- }, o.prototype.writeUint32BE = o.prototype.writeUInt32BE = function(t, r, e) {
718
- return t = +t, r = r >>> 0, e || _(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;
719
- };
720
- function dt(i, t, r, e, n) {
721
- bt(t, e, n, i, r, 7);
722
- let h = Number(t & BigInt(4294967295));
723
- i[r++] = h, h = h >> 8, i[r++] = h, h = h >> 8, i[r++] = h, h = h >> 8, i[r++] = h;
724
- let u = Number(t >> BigInt(32) & BigInt(4294967295));
725
- return i[r++] = u, u = u >> 8, i[r++] = u, u = u >> 8, i[r++] = u, u = u >> 8, i[r++] = u, r;
726
- }
727
- function mt(i, t, r, e, n) {
728
- bt(t, e, n, i, r, 7);
729
- let h = Number(t & BigInt(4294967295));
730
- i[r + 7] = h, h = h >> 8, i[r + 6] = h, h = h >> 8, i[r + 5] = h, h = h >> 8, i[r + 4] = h;
731
- let u = Number(t >> BigInt(32) & BigInt(4294967295));
732
- return i[r + 3] = u, u = u >> 8, i[r + 2] = u, u = u >> 8, i[r + 1] = u, u = u >> 8, i[r] = u, r + 8;
733
- }
734
- o.prototype.writeBigUInt64LE = D(function(t, r = 0) {
735
- return dt(this, t, r, BigInt(0), BigInt("0xffffffffffffffff"));
736
- }), o.prototype.writeBigUInt64BE = D(function(t, r = 0) {
737
- return mt(this, t, r, BigInt(0), BigInt("0xffffffffffffffff"));
738
- }), o.prototype.writeIntLE = function(t, r, e, n) {
739
- if (t = +t, r = r >>> 0, !n) {
740
- const A = Math.pow(2, 8 * e - 1);
741
- _(this, t, r, e, A - 1, -A);
742
- }
743
- let h = 0, u = 1, m = 0;
744
- for (this[r] = t & 255; ++h < e && (u *= 256); )
745
- t < 0 && m === 0 && this[r + h - 1] !== 0 && (m = 1), this[r + h] = (t / u >> 0) - m & 255;
746
- return r + e;
747
- }, o.prototype.writeIntBE = function(t, r, e, n) {
748
- if (t = +t, r = r >>> 0, !n) {
749
- const A = Math.pow(2, 8 * e - 1);
750
- _(this, t, r, e, A - 1, -A);
751
- }
752
- let h = e - 1, u = 1, m = 0;
753
- for (this[r + h] = t & 255; --h >= 0 && (u *= 256); )
754
- t < 0 && m === 0 && this[r + h + 1] !== 0 && (m = 1), this[r + h] = (t / u >> 0) - m & 255;
755
- return r + e;
756
- }, o.prototype.writeInt8 = function(t, r, e) {
757
- return t = +t, r = r >>> 0, e || _(this, t, r, 1, 127, -128), t < 0 && (t = 255 + t + 1), this[r] = t & 255, r + 1;
758
- }, o.prototype.writeInt16LE = function(t, r, e) {
759
- return t = +t, r = r >>> 0, e || _(this, t, r, 2, 32767, -32768), this[r] = t & 255, this[r + 1] = t >>> 8, r + 2;
760
- }, o.prototype.writeInt16BE = function(t, r, e) {
761
- return t = +t, r = r >>> 0, e || _(this, t, r, 2, 32767, -32768), this[r] = t >>> 8, this[r + 1] = t & 255, r + 2;
762
- }, o.prototype.writeInt32LE = function(t, r, e) {
763
- return t = +t, r = r >>> 0, e || _(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;
764
- }, o.prototype.writeInt32BE = function(t, r, e) {
765
- return t = +t, r = r >>> 0, e || _(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;
766
- }, o.prototype.writeBigInt64LE = D(function(t, r = 0) {
767
- return dt(this, t, r, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
768
- }), o.prototype.writeBigInt64BE = D(function(t, r = 0) {
769
- return mt(this, t, r, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
770
- });
771
- function Et(i, t, r, e, n, h) {
772
- if (r + e > i.length) throw new RangeError("Index out of range");
773
- if (r < 0) throw new RangeError("Index out of range");
774
- }
775
- function It(i, t, r, e, n) {
776
- return t = +t, r = r >>> 0, n || Et(i, t, r, 4), p.write(i, t, r, e, 23, 4), r + 4;
777
- }
778
- o.prototype.writeFloatLE = function(t, r, e) {
779
- return It(this, t, r, !0, e);
780
- }, o.prototype.writeFloatBE = function(t, r, e) {
781
- return It(this, t, r, !1, e);
782
- };
783
- function xt(i, t, r, e, n) {
784
- return t = +t, r = r >>> 0, n || Et(i, t, r, 8), p.write(i, t, r, e, 52, 8), r + 8;
785
- }
786
- o.prototype.writeDoubleLE = function(t, r, e) {
787
- return xt(this, t, r, !0, e);
788
- }, o.prototype.writeDoubleBE = function(t, r, e) {
789
- return xt(this, t, r, !1, e);
790
- }, o.prototype.copy = function(t, r, e, n) {
791
- if (!o.isBuffer(t)) throw new TypeError("argument should be a Buffer");
792
- if (e || (e = 0), !n && n !== 0 && (n = this.length), r >= t.length && (r = t.length), r || (r = 0), n > 0 && n < e && (n = e), n === e || t.length === 0 || this.length === 0) return 0;
793
- if (r < 0)
794
- throw new RangeError("targetStart out of bounds");
795
- if (e < 0 || e >= this.length) throw new RangeError("Index out of range");
796
- if (n < 0) throw new RangeError("sourceEnd out of bounds");
797
- n > this.length && (n = this.length), t.length - r < n - e && (n = t.length - r + e);
798
- const h = n - e;
799
- return this === t && typeof f.prototype.copyWithin == "function" ? this.copyWithin(r, e, n) : f.prototype.set.call(
800
- t,
801
- this.subarray(e, n),
802
- r
803
- ), h;
804
- }, o.prototype.fill = function(t, r, e, n) {
805
- if (typeof t == "string") {
806
- if (typeof r == "string" ? (n = r, r = 0, e = this.length) : typeof e == "string" && (n = e, e = this.length), n !== void 0 && typeof n != "string")
807
- throw new TypeError("encoding must be a string");
808
- if (typeof n == "string" && !o.isEncoding(n))
809
- throw new TypeError("Unknown encoding: " + n);
810
- if (t.length === 1) {
811
- const u = t.charCodeAt(0);
812
- (n === "utf8" && u < 128 || n === "latin1") && (t = u);
813
- }
814
- } else typeof t == "number" ? t = t & 255 : typeof t == "boolean" && (t = Number(t));
815
- if (r < 0 || this.length < r || this.length < e)
816
- throw new RangeError("Out of range index");
817
- if (e <= r)
818
- return this;
819
- r = r >>> 0, e = e === void 0 ? this.length : e >>> 0, t || (t = 0);
820
- let h;
821
- if (typeof t == "number")
822
- for (h = r; h < e; ++h)
823
- this[h] = t;
824
- else {
825
- const u = o.isBuffer(t) ? t : o.from(t, n), m = u.length;
826
- if (m === 0)
827
- throw new TypeError('The value "' + t + '" is invalid for argument "value"');
828
- for (h = 0; h < e - r; ++h)
829
- this[h + r] = u[h % m];
830
- }
831
- return this;
832
- };
833
- const V = {};
834
- function nt(i, t, r) {
835
- V[i] = class extends r {
836
- constructor() {
837
- super(), Object.defineProperty(this, "message", {
838
- value: t.apply(this, arguments),
839
- writable: !0,
840
- configurable: !0
841
- }), this.name = `${this.name} [${i}]`, this.stack, delete this.name;
842
- }
843
- get code() {
844
- return i;
845
- }
846
- set code(n) {
847
- Object.defineProperty(this, "code", {
848
- configurable: !0,
849
- enumerable: !0,
850
- value: n,
851
- writable: !0
852
- });
853
- }
854
- toString() {
855
- return `${this.name} [${i}]: ${this.message}`;
856
- }
857
- };
858
- }
859
- nt(
860
- "ERR_BUFFER_OUT_OF_BOUNDS",
861
- function(i) {
862
- return i ? `${i} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
863
- },
864
- RangeError
865
- ), nt(
866
- "ERR_INVALID_ARG_TYPE",
867
- function(i, t) {
868
- return `The "${i}" argument must be of type number. Received type ${typeof t}`;
869
- },
870
- TypeError
871
- ), nt(
872
- "ERR_OUT_OF_RANGE",
873
- function(i, t, r) {
874
- let e = `The value of "${i}" is out of range.`, n = r;
875
- return Number.isInteger(r) && Math.abs(r) > 2 ** 32 ? n = At(String(r)) : typeof r == "bigint" && (n = String(r), (r > BigInt(2) ** BigInt(32) || r < -(BigInt(2) ** BigInt(32))) && (n = At(n)), n += "n"), e += ` It must be ${t}. Received ${n}`, e;
876
- },
877
- RangeError
878
- );
879
- function At(i) {
880
- let t = "", r = i.length;
881
- const e = i[0] === "-" ? 1 : 0;
882
- for (; r >= e + 4; r -= 3)
883
- t = `_${i.slice(r - 3, r)}${t}`;
884
- return `${i.slice(0, r)}${t}`;
885
- }
886
- function zt(i, t, r) {
887
- K(t, "offset"), (i[t] === void 0 || i[t + r] === void 0) && Z(t, i.length - (r + 1));
888
- }
889
- function bt(i, t, r, e, n, h) {
890
- if (i > r || i < t) {
891
- const u = typeof t == "bigint" ? "n" : "";
892
- let m;
893
- throw t === 0 || t === BigInt(0) ? m = `>= 0${u} and < 2${u} ** ${(h + 1) * 8}${u}` : m = `>= -(2${u} ** ${(h + 1) * 8 - 1}${u}) and < 2 ** ${(h + 1) * 8 - 1}${u}`, new V.ERR_OUT_OF_RANGE("value", m, i);
894
- }
895
- zt(e, n, h);
896
- }
897
- function K(i, t) {
898
- if (typeof i != "number")
899
- throw new V.ERR_INVALID_ARG_TYPE(t, "number", i);
900
- }
901
- function Z(i, t, r) {
902
- throw Math.floor(i) !== i ? (K(i, r), new V.ERR_OUT_OF_RANGE("offset", "an integer", i)) : t < 0 ? new V.ERR_BUFFER_OUT_OF_BOUNDS() : new V.ERR_OUT_OF_RANGE(
903
- "offset",
904
- `>= 0 and <= ${t}`,
905
- i
906
- );
907
- }
908
- const vt = /[^+/0-9A-Za-z-_]/g;
909
- function tr(i) {
910
- if (i = i.split("=")[0], i = i.trim().replace(vt, ""), i.length < 2) return "";
911
- for (; i.length % 4 !== 0; )
912
- i = i + "=";
913
- return i;
914
- }
915
- function ot(i, t) {
916
- t = t || 1 / 0;
917
- let r;
918
- const e = i.length;
919
- let n = null;
920
- const h = [];
921
- for (let u = 0; u < e; ++u) {
922
- if (r = i.charCodeAt(u), r > 55295 && r < 57344) {
923
- if (!n) {
924
- if (r > 56319) {
925
- (t -= 3) > -1 && h.push(239, 191, 189);
926
- continue;
927
- } else if (u + 1 === e) {
928
- (t -= 3) > -1 && h.push(239, 191, 189);
929
- continue;
930
- }
931
- n = r;
932
- continue;
933
- }
934
- if (r < 56320) {
935
- (t -= 3) > -1 && h.push(239, 191, 189), n = r;
936
- continue;
937
- }
938
- r = (n - 55296 << 10 | r - 56320) + 65536;
939
- } else n && (t -= 3) > -1 && h.push(239, 191, 189);
940
- if (n = null, r < 128) {
941
- if ((t -= 1) < 0) break;
942
- h.push(r);
943
- } else if (r < 2048) {
944
- if ((t -= 2) < 0) break;
945
- h.push(
946
- r >> 6 | 192,
947
- r & 63 | 128
948
- );
949
- } else if (r < 65536) {
950
- if ((t -= 3) < 0) break;
951
- h.push(
952
- r >> 12 | 224,
953
- r >> 6 & 63 | 128,
954
- r & 63 | 128
955
- );
956
- } else if (r < 1114112) {
957
- if ((t -= 4) < 0) break;
958
- h.push(
959
- r >> 18 | 240,
960
- r >> 12 & 63 | 128,
961
- r >> 6 & 63 | 128,
962
- r & 63 | 128
963
- );
964
- } else
965
- throw new Error("Invalid code point");
966
- }
967
- return h;
968
- }
969
- function rr(i) {
970
- const t = [];
971
- for (let r = 0; r < i.length; ++r)
972
- t.push(i.charCodeAt(r) & 255);
973
- return t;
974
- }
975
- function ir(i, t) {
976
- let r, e, n;
977
- const h = [];
978
- for (let u = 0; u < i.length && !((t -= 2) < 0); ++u)
979
- r = i.charCodeAt(u), e = r >> 8, n = r % 256, h.push(n), h.push(e);
980
- return h;
981
- }
982
- function Ut(i) {
983
- return s.toByteArray(tr(i));
984
- }
985
- function z(i, t, r, e) {
986
- let n;
987
- for (n = 0; n < e && !(n + r >= t.length || n >= i.length); ++n)
988
- t[n + r] = i[n];
989
- return n;
990
- }
991
- function M(i, t) {
992
- return i instanceof t || i != null && i.constructor != null && i.constructor.name != null && i.constructor.name === t.name;
993
- }
994
- function st(i) {
995
- return i !== i;
996
- }
997
- const er = (function() {
998
- const i = "0123456789abcdef", t = new Array(256);
999
- for (let r = 0; r < 16; ++r) {
1000
- const e = r * 16;
1001
- for (let n = 0; n < 16; ++n)
1002
- t[e + n] = i[r] + i[n];
1003
- }
1004
- return t;
1005
- })();
1006
- function D(i) {
1007
- return typeof BigInt > "u" ? nr : i;
1008
- }
1009
- function nr() {
1010
- throw new Error("BigInt not supported");
1011
- }
1012
- })(ut);
1013
- const R = ut.Buffer, Hr = ut.Buffer;
1014
- function Or(c) {
1015
- return c && c.__esModule && Object.prototype.hasOwnProperty.call(c, "default") ? c.default : c;
1016
- }
1017
- function lr(c) {
1018
- return c instanceof Uint8Array || ArrayBuffer.isView(c) && c.constructor.name === "Uint8Array";
1019
- }
1020
- function pt(c, ...s) {
1021
- if (!lr(c))
1022
- throw new Error("Uint8Array expected");
1023
- if (s.length > 0 && !s.includes(c.length))
1024
- throw new Error("Uint8Array expected of length " + s + ", got length=" + c.length);
1025
- }
1026
- function Tt(c, s = !0) {
1027
- if (c.destroyed)
1028
- throw new Error("Hash instance has been destroyed");
1029
- if (s && c.finished)
1030
- throw new Error("Hash#digest() has already been called");
1031
- }
1032
- function yr(c, s) {
1033
- pt(c);
1034
- const p = s.outputLen;
1035
- if (c.length < p)
1036
- throw new Error("digestInto() expects output buffer of length at least " + p);
1037
- }
1038
- function j(...c) {
1039
- for (let s = 0; s < c.length; s++)
1040
- c[s].fill(0);
1041
- }
1042
- function ct(c) {
1043
- return new DataView(c.buffer, c.byteOffset, c.byteLength);
1044
- }
1045
- function k(c, s) {
1046
- return c << 32 - s | c >>> s;
1047
- }
1048
- function G(c, s) {
1049
- return c << s | c >>> 32 - s >>> 0;
1050
- }
1051
- function wr(c) {
1052
- if (typeof c != "string")
1053
- throw new Error("string expected");
1054
- return new Uint8Array(new TextEncoder().encode(c));
1055
- }
1056
- function Lt(c) {
1057
- return typeof c == "string" && (c = wr(c)), pt(c), c;
1058
- }
1059
- class Br {
1060
- }
1061
- function at(c) {
1062
- const s = (a) => c().update(Lt(a)).digest(), p = c();
1063
- return s.outputLen = p.outputLen, s.blockLen = p.blockLen, s.create = () => c(), s;
1064
- }
1065
- function gr(c, s, p, a) {
1066
- if (typeof c.setBigUint64 == "function")
1067
- return c.setBigUint64(s, p, a);
1068
- const y = BigInt(32), f = BigInt(4294967295), l = Number(p >> y & f), B = Number(p & f), w = a ? 4 : 0, d = a ? 0 : 4;
1069
- c.setUint32(s + w, l, a), c.setUint32(s + d, B, a);
1070
- }
1071
- function St(c, s, p) {
1072
- return c & s ^ ~c & p;
1073
- }
1074
- function Ct(c, s, p) {
1075
- return c & s ^ c & p ^ s & p;
1076
- }
1077
- class lt extends Br {
1078
- constructor(s, p, a, y) {
1079
- super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = s, this.outputLen = p, this.padOffset = a, this.isLE = y, this.buffer = new Uint8Array(s), this.view = ct(this.buffer);
1080
- }
1081
- update(s) {
1082
- Tt(this), s = Lt(s), pt(s);
1083
- const { view: p, buffer: a, blockLen: y } = this, f = s.length;
1084
- for (let l = 0; l < f; ) {
1085
- const B = Math.min(y - this.pos, f - l);
1086
- if (B === y) {
1087
- const w = ct(s);
1088
- for (; y <= f - l; l += y)
1089
- this.process(w, l);
1090
- continue;
1091
- }
1092
- a.set(s.subarray(l, l + B), this.pos), this.pos += B, l += B, this.pos === y && (this.process(p, 0), this.pos = 0);
1093
- }
1094
- return this.length += s.length, this.roundClean(), this;
1095
- }
1096
- digestInto(s) {
1097
- Tt(this), yr(s, this), this.finished = !0;
1098
- const { buffer: p, view: a, blockLen: y, isLE: f } = this;
1099
- let { pos: l } = this;
1100
- p[l++] = 128, j(this.buffer.subarray(l)), this.padOffset > y - l && (this.process(a, 0), l = 0);
1101
- for (let g = l; g < y; g++)
1102
- p[g] = 0;
1103
- gr(a, y - 8, BigInt(this.length * 8), f), this.process(a, 0);
1104
- const B = ct(s), w = this.outputLen;
1105
- if (w % 4)
1106
- throw new Error("_sha2: outputLen should be aligned to 32bit");
1107
- const d = w / 4, o = this.get();
1108
- if (d > o.length)
1109
- throw new Error("_sha2: outputLen bigger than state");
1110
- for (let g = 0; g < d; g++)
1111
- B.setUint32(4 * g, o[g], f);
1112
- }
1113
- digest() {
1114
- const { buffer: s, outputLen: p } = this;
1115
- this.digestInto(s);
1116
- const a = s.slice(0, p);
1117
- return this.destroy(), a;
1118
- }
1119
- _cloneInto(s) {
1120
- s || (s = new this.constructor()), s.set(...this.get());
1121
- const { blockLen: p, buffer: a, length: y, finished: f, destroyed: l, pos: B } = this;
1122
- return s.destroyed = l, s.finished = f, s.length = y, s.pos = B, y % p && s.buffer.set(a), s;
1123
- }
1124
- clone() {
1125
- return this._cloneInto();
1126
- }
1127
- }
1128
- const F = /* @__PURE__ */ Uint32Array.from([
1129
- 1779033703,
1130
- 3144134277,
1131
- 1013904242,
1132
- 2773480762,
1133
- 1359893119,
1134
- 2600822924,
1135
- 528734635,
1136
- 1541459225
1137
- ]), dr = /* @__PURE__ */ Uint32Array.from([
1138
- 1116352408,
1139
- 1899447441,
1140
- 3049323471,
1141
- 3921009573,
1142
- 961987163,
1143
- 1508970993,
1144
- 2453635748,
1145
- 2870763221,
1146
- 3624381080,
1147
- 310598401,
1148
- 607225278,
1149
- 1426881987,
1150
- 1925078388,
1151
- 2162078206,
1152
- 2614888103,
1153
- 3248222580,
1154
- 3835390401,
1155
- 4022224774,
1156
- 264347078,
1157
- 604807628,
1158
- 770255983,
1159
- 1249150122,
1160
- 1555081692,
1161
- 1996064986,
1162
- 2554220882,
1163
- 2821834349,
1164
- 2952996808,
1165
- 3210313671,
1166
- 3336571891,
1167
- 3584528711,
1168
- 113926993,
1169
- 338241895,
1170
- 666307205,
1171
- 773529912,
1172
- 1294757372,
1173
- 1396182291,
1174
- 1695183700,
1175
- 1986661051,
1176
- 2177026350,
1177
- 2456956037,
1178
- 2730485921,
1179
- 2820302411,
1180
- 3259730800,
1181
- 3345764771,
1182
- 3516065817,
1183
- 3600352804,
1184
- 4094571909,
1185
- 275423344,
1186
- 430227734,
1187
- 506948616,
1188
- 659060556,
1189
- 883997877,
1190
- 958139571,
1191
- 1322822218,
1192
- 1537002063,
1193
- 1747873779,
1194
- 1955562222,
1195
- 2024104815,
1196
- 2227730452,
1197
- 2361852424,
1198
- 2428436474,
1199
- 2756734187,
1200
- 3204031479,
1201
- 3329325298
1202
- ]), $ = /* @__PURE__ */ new Uint32Array(64);
1203
- class mr extends lt {
1204
- constructor(s = 32) {
1205
- super(64, s, 8, !1), this.A = F[0] | 0, this.B = F[1] | 0, this.C = F[2] | 0, this.D = F[3] | 0, this.E = F[4] | 0, this.F = F[5] | 0, this.G = F[6] | 0, this.H = F[7] | 0;
1206
- }
1207
- get() {
1208
- const { A: s, B: p, C: a, D: y, E: f, F: l, G: B, H: w } = this;
1209
- return [s, p, a, y, f, l, B, w];
1210
- }
1211
- // prettier-ignore
1212
- set(s, p, a, y, f, l, B, w) {
1213
- this.A = s | 0, this.B = p | 0, this.C = a | 0, this.D = y | 0, this.E = f | 0, this.F = l | 0, this.G = B | 0, this.H = w | 0;
1214
- }
1215
- process(s, p) {
1216
- for (let g = 0; g < 16; g++, p += 4)
1217
- $[g] = s.getUint32(p, !1);
1218
- for (let g = 16; g < 64; g++) {
1219
- const U = $[g - 15], E = $[g - 2], L = k(U, 7) ^ k(U, 18) ^ U >>> 3, P = k(E, 17) ^ k(E, 19) ^ E >>> 10;
1220
- $[g] = P + $[g - 7] + L + $[g - 16] | 0;
1221
- }
1222
- let { A: a, B: y, C: f, D: l, E: B, F: w, G: d, H: o } = this;
1223
- for (let g = 0; g < 64; g++) {
1224
- const U = k(B, 6) ^ k(B, 11) ^ k(B, 25), E = o + U + St(B, w, d) + dr[g] + $[g] | 0, P = (k(a, 2) ^ k(a, 13) ^ k(a, 22)) + Ct(a, y, f) | 0;
1225
- o = d, d = w, w = B, B = l + E | 0, l = f, f = y, y = a, a = E + P | 0;
1226
- }
1227
- a = a + this.A | 0, y = y + this.B | 0, f = f + this.C | 0, l = l + this.D | 0, B = B + this.E | 0, w = w + this.F | 0, d = d + this.G | 0, o = o + this.H | 0, this.set(a, y, f, l, B, w, d, o);
1228
- }
1229
- roundClean() {
1230
- j($);
1231
- }
1232
- destroy() {
1233
- this.set(0, 0, 0, 0, 0, 0, 0, 0), j(this.buffer);
1234
- }
1235
- }
1236
- const Er = /* @__PURE__ */ at(() => new mr()), tt = Er, Q = /* @__PURE__ */ Uint32Array.from([
1237
- 1732584193,
1238
- 4023233417,
1239
- 2562383102,
1240
- 271733878,
1241
- 3285377520
1242
- ]), H = /* @__PURE__ */ new Uint32Array(80);
1243
- class Ir extends lt {
1244
- constructor() {
1245
- super(64, 20, 8, !1), this.A = Q[0] | 0, this.B = Q[1] | 0, this.C = Q[2] | 0, this.D = Q[3] | 0, this.E = Q[4] | 0;
1246
- }
1247
- get() {
1248
- const { A: s, B: p, C: a, D: y, E: f } = this;
1249
- return [s, p, a, y, f];
1250
- }
1251
- set(s, p, a, y, f) {
1252
- this.A = s | 0, this.B = p | 0, this.C = a | 0, this.D = y | 0, this.E = f | 0;
1253
- }
1254
- process(s, p) {
1255
- for (let w = 0; w < 16; w++, p += 4)
1256
- H[w] = s.getUint32(p, !1);
1257
- for (let w = 16; w < 80; w++)
1258
- H[w] = G(H[w - 3] ^ H[w - 8] ^ H[w - 14] ^ H[w - 16], 1);
1259
- let { A: a, B: y, C: f, D: l, E: B } = this;
1260
- for (let w = 0; w < 80; w++) {
1261
- let d, o;
1262
- w < 20 ? (d = St(y, f, l), o = 1518500249) : w < 40 ? (d = y ^ f ^ l, o = 1859775393) : w < 60 ? (d = Ct(y, f, l), o = 2400959708) : (d = y ^ f ^ l, o = 3395469782);
1263
- const g = G(a, 5) + d + B + o + H[w] | 0;
1264
- B = l, l = f, f = G(y, 30), y = a, a = g;
1265
- }
1266
- a = a + this.A | 0, y = y + this.B | 0, f = f + this.C | 0, l = l + this.D | 0, B = B + this.E | 0, this.set(a, y, f, l, B);
1267
- }
1268
- roundClean() {
1269
- j(H);
1270
- }
1271
- destroy() {
1272
- this.set(0, 0, 0, 0, 0), j(this.buffer);
1273
- }
1274
- }
1275
- const xr = /* @__PURE__ */ at(() => new Ir()), Ar = /* @__PURE__ */ Uint8Array.from([
1276
- 7,
1277
- 4,
1278
- 13,
1279
- 1,
1280
- 10,
1281
- 6,
1282
- 15,
1283
- 3,
1284
- 12,
1285
- 0,
1286
- 9,
1287
- 5,
1288
- 2,
1289
- 14,
1290
- 11,
1291
- 8
1292
- ]), Mt = Uint8Array.from(new Array(16).fill(0).map((c, s) => s)), br = Mt.map((c) => (9 * c + 5) % 16), kt = /* @__PURE__ */ (() => {
1293
- const p = [[Mt], [br]];
1294
- for (let a = 0; a < 4; a++)
1295
- for (let y of p)
1296
- y.push(y[a].map((f) => Ar[f]));
1297
- return p;
1298
- })(), Nt = kt[0], Pt = kt[1], Dt = /* @__PURE__ */ [
1299
- [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
1300
- [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
1301
- [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
1302
- [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
1303
- [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
1304
- ].map((c) => Uint8Array.from(c)), Ur = /* @__PURE__ */ Nt.map((c, s) => c.map((p) => Dt[s][p])), Tr = /* @__PURE__ */ Pt.map((c, s) => c.map((p) => Dt[s][p])), Rr = /* @__PURE__ */ Uint32Array.from([
1305
- 0,
1306
- 1518500249,
1307
- 1859775393,
1308
- 2400959708,
1309
- 2840853838
1310
- ]), _r = /* @__PURE__ */ Uint32Array.from([
1311
- 1352829926,
1312
- 1548603684,
1313
- 1836072691,
1314
- 2053994217,
1315
- 0
1316
- ]);
1317
- function Rt(c, s, p, a) {
1318
- return c === 0 ? s ^ p ^ a : c === 1 ? s & p | ~s & a : c === 2 ? (s | ~p) ^ a : c === 3 ? s & a | p & ~a : s ^ (p | ~a);
1319
- }
1320
- const v = /* @__PURE__ */ new Uint32Array(16);
1321
- class Lr extends lt {
1322
- constructor() {
1323
- super(64, 20, 8, !0), this.h0 = 1732584193, this.h1 = -271733879, this.h2 = -1732584194, this.h3 = 271733878, this.h4 = -1009589776;
1324
- }
1325
- get() {
1326
- const { h0: s, h1: p, h2: a, h3: y, h4: f } = this;
1327
- return [s, p, a, y, f];
1328
- }
1329
- set(s, p, a, y, f) {
1330
- this.h0 = s | 0, this.h1 = p | 0, this.h2 = a | 0, this.h3 = y | 0, this.h4 = f | 0;
1331
- }
1332
- process(s, p) {
1333
- for (let E = 0; E < 16; E++, p += 4)
1334
- v[E] = s.getUint32(p, !0);
1335
- let a = this.h0 | 0, y = a, f = this.h1 | 0, l = f, B = this.h2 | 0, w = B, d = this.h3 | 0, o = d, g = this.h4 | 0, U = g;
1336
- for (let E = 0; E < 5; E++) {
1337
- const L = 4 - E, P = Rr[E], q = _r[E], it = Nt[E], X = Pt[E], et = Ur[E], J = Tr[E];
1338
- for (let C = 0; C < 16; C++) {
1339
- const W = G(a + Rt(E, f, B, d) + v[it[C]] + P, et[C]) + g | 0;
1340
- a = g, g = d, d = G(B, 10) | 0, B = f, f = W;
1341
- }
1342
- for (let C = 0; C < 16; C++) {
1343
- const W = G(y + Rt(L, l, w, o) + v[X[C]] + q, J[C]) + U | 0;
1344
- y = U, U = o, o = G(w, 10) | 0, w = l, l = W;
1345
- }
1346
- }
1347
- this.set(this.h1 + B + o | 0, this.h2 + d + U | 0, this.h3 + g + y | 0, this.h4 + a + l | 0, this.h0 + f + w | 0);
1348
- }
1349
- roundClean() {
1350
- j(v);
1351
- }
1352
- destroy() {
1353
- this.destroyed = !0, j(this.buffer), this.set(0, 0, 0, 0, 0);
1354
- }
1355
- }
1356
- const Sr = /* @__PURE__ */ at(() => new Lr()), Ft = Sr, Cr = xr;
1357
- function Mr(c) {
1358
- return R.from(Ft(Uint8Array.from(c)));
1359
- }
1360
- function kr(c) {
1361
- return R.from(Cr(Uint8Array.from(c)));
1362
- }
1363
- function $t(c) {
1364
- return R.from(tt(Uint8Array.from(c)));
1365
- }
1366
- function Nr(c) {
1367
- return R.from(Ft(tt(Uint8Array.from(c))));
1368
- }
1369
- function Pr(c) {
1370
- return R.from(tt(tt(Uint8Array.from(c))));
1371
- }
1372
- const Dr = [
1373
- "BIP0340/challenge",
1374
- "BIP0340/aux",
1375
- "BIP0340/nonce",
1376
- "TapLeaf",
1377
- "TapBranch",
1378
- "TapSighash",
1379
- "TapTweak",
1380
- "KeyAgg list",
1381
- "KeyAgg coefficient"
1382
- ], Ht = {
1383
- "BIP0340/challenge": R.from([
1384
- 123,
1385
- 181,
1386
- 45,
1387
- 122,
1388
- 159,
1389
- 239,
1390
- 88,
1391
- 50,
1392
- 62,
1393
- 177,
1394
- 191,
1395
- 122,
1396
- 64,
1397
- 125,
1398
- 179,
1399
- 130,
1400
- 210,
1401
- 243,
1402
- 242,
1403
- 216,
1404
- 27,
1405
- 177,
1406
- 34,
1407
- 79,
1408
- 73,
1409
- 254,
1410
- 81,
1411
- 143,
1412
- 109,
1413
- 72,
1414
- 211,
1415
- 124,
1416
- 123,
1417
- 181,
1418
- 45,
1419
- 122,
1420
- 159,
1421
- 239,
1422
- 88,
1423
- 50,
1424
- 62,
1425
- 177,
1426
- 191,
1427
- 122,
1428
- 64,
1429
- 125,
1430
- 179,
1431
- 130,
1432
- 210,
1433
- 243,
1434
- 242,
1435
- 216,
1436
- 27,
1437
- 177,
1438
- 34,
1439
- 79,
1440
- 73,
1441
- 254,
1442
- 81,
1443
- 143,
1444
- 109,
1445
- 72,
1446
- 211,
1447
- 124
1448
- ]),
1449
- "BIP0340/aux": R.from([
1450
- 241,
1451
- 239,
1452
- 78,
1453
- 94,
1454
- 192,
1455
- 99,
1456
- 202,
1457
- 218,
1458
- 109,
1459
- 148,
1460
- 202,
1461
- 250,
1462
- 157,
1463
- 152,
1464
- 126,
1465
- 160,
1466
- 105,
1467
- 38,
1468
- 88,
1469
- 57,
1470
- 236,
1471
- 193,
1472
- 31,
1473
- 151,
1474
- 45,
1475
- 119,
1476
- 165,
1477
- 46,
1478
- 216,
1479
- 193,
1480
- 204,
1481
- 144,
1482
- 241,
1483
- 239,
1484
- 78,
1485
- 94,
1486
- 192,
1487
- 99,
1488
- 202,
1489
- 218,
1490
- 109,
1491
- 148,
1492
- 202,
1493
- 250,
1494
- 157,
1495
- 152,
1496
- 126,
1497
- 160,
1498
- 105,
1499
- 38,
1500
- 88,
1501
- 57,
1502
- 236,
1503
- 193,
1504
- 31,
1505
- 151,
1506
- 45,
1507
- 119,
1508
- 165,
1509
- 46,
1510
- 216,
1511
- 193,
1512
- 204,
1513
- 144
1514
- ]),
1515
- "BIP0340/nonce": R.from([
1516
- 7,
1517
- 73,
1518
- 119,
1519
- 52,
1520
- 167,
1521
- 155,
1522
- 203,
1523
- 53,
1524
- 91,
1525
- 155,
1526
- 140,
1527
- 125,
1528
- 3,
1529
- 79,
1530
- 18,
1531
- 28,
1532
- 244,
1533
- 52,
1534
- 215,
1535
- 62,
1536
- 247,
1537
- 45,
1538
- 218,
1539
- 25,
1540
- 135,
1541
- 0,
1542
- 97,
1543
- 251,
1544
- 82,
1545
- 191,
1546
- 235,
1547
- 47,
1548
- 7,
1549
- 73,
1550
- 119,
1551
- 52,
1552
- 167,
1553
- 155,
1554
- 203,
1555
- 53,
1556
- 91,
1557
- 155,
1558
- 140,
1559
- 125,
1560
- 3,
1561
- 79,
1562
- 18,
1563
- 28,
1564
- 244,
1565
- 52,
1566
- 215,
1567
- 62,
1568
- 247,
1569
- 45,
1570
- 218,
1571
- 25,
1572
- 135,
1573
- 0,
1574
- 97,
1575
- 251,
1576
- 82,
1577
- 191,
1578
- 235,
1579
- 47
1580
- ]),
1581
- TapLeaf: R.from([
1582
- 174,
1583
- 234,
1584
- 143,
1585
- 220,
1586
- 66,
1587
- 8,
1588
- 152,
1589
- 49,
1590
- 5,
1591
- 115,
1592
- 75,
1593
- 88,
1594
- 8,
1595
- 29,
1596
- 30,
1597
- 38,
1598
- 56,
1599
- 211,
1600
- 95,
1601
- 28,
1602
- 181,
1603
- 64,
1604
- 8,
1605
- 212,
1606
- 211,
1607
- 87,
1608
- 202,
1609
- 3,
1610
- 190,
1611
- 120,
1612
- 233,
1613
- 238,
1614
- 174,
1615
- 234,
1616
- 143,
1617
- 220,
1618
- 66,
1619
- 8,
1620
- 152,
1621
- 49,
1622
- 5,
1623
- 115,
1624
- 75,
1625
- 88,
1626
- 8,
1627
- 29,
1628
- 30,
1629
- 38,
1630
- 56,
1631
- 211,
1632
- 95,
1633
- 28,
1634
- 181,
1635
- 64,
1636
- 8,
1637
- 212,
1638
- 211,
1639
- 87,
1640
- 202,
1641
- 3,
1642
- 190,
1643
- 120,
1644
- 233,
1645
- 238
1646
- ]),
1647
- TapBranch: R.from([
1648
- 25,
1649
- 65,
1650
- 161,
1651
- 242,
1652
- 229,
1653
- 110,
1654
- 185,
1655
- 95,
1656
- 162,
1657
- 169,
1658
- 241,
1659
- 148,
1660
- 190,
1661
- 92,
1662
- 1,
1663
- 247,
1664
- 33,
1665
- 111,
1666
- 51,
1667
- 237,
1668
- 130,
1669
- 176,
1670
- 145,
1671
- 70,
1672
- 52,
1673
- 144,
1674
- 208,
1675
- 91,
1676
- 245,
1677
- 22,
1678
- 160,
1679
- 21,
1680
- 25,
1681
- 65,
1682
- 161,
1683
- 242,
1684
- 229,
1685
- 110,
1686
- 185,
1687
- 95,
1688
- 162,
1689
- 169,
1690
- 241,
1691
- 148,
1692
- 190,
1693
- 92,
1694
- 1,
1695
- 247,
1696
- 33,
1697
- 111,
1698
- 51,
1699
- 237,
1700
- 130,
1701
- 176,
1702
- 145,
1703
- 70,
1704
- 52,
1705
- 144,
1706
- 208,
1707
- 91,
1708
- 245,
1709
- 22,
1710
- 160,
1711
- 21
1712
- ]),
1713
- TapSighash: R.from([
1714
- 244,
1715
- 10,
1716
- 72,
1717
- 223,
1718
- 75,
1719
- 42,
1720
- 112,
1721
- 200,
1722
- 180,
1723
- 146,
1724
- 75,
1725
- 242,
1726
- 101,
1727
- 70,
1728
- 97,
1729
- 237,
1730
- 61,
1731
- 149,
1732
- 253,
1733
- 102,
1734
- 163,
1735
- 19,
1736
- 235,
1737
- 135,
1738
- 35,
1739
- 117,
1740
- 151,
1741
- 198,
1742
- 40,
1743
- 228,
1744
- 160,
1745
- 49,
1746
- 244,
1747
- 10,
1748
- 72,
1749
- 223,
1750
- 75,
1751
- 42,
1752
- 112,
1753
- 200,
1754
- 180,
1755
- 146,
1756
- 75,
1757
- 242,
1758
- 101,
1759
- 70,
1760
- 97,
1761
- 237,
1762
- 61,
1763
- 149,
1764
- 253,
1765
- 102,
1766
- 163,
1767
- 19,
1768
- 235,
1769
- 135,
1770
- 35,
1771
- 117,
1772
- 151,
1773
- 198,
1774
- 40,
1775
- 228,
1776
- 160,
1777
- 49
1778
- ]),
1779
- TapTweak: R.from([
1780
- 232,
1781
- 15,
1782
- 225,
1783
- 99,
1784
- 156,
1785
- 156,
1786
- 160,
1787
- 80,
1788
- 227,
1789
- 175,
1790
- 27,
1791
- 57,
1792
- 193,
1793
- 67,
1794
- 198,
1795
- 62,
1796
- 66,
1797
- 156,
1798
- 188,
1799
- 235,
1800
- 21,
1801
- 217,
1802
- 64,
1803
- 251,
1804
- 181,
1805
- 197,
1806
- 161,
1807
- 244,
1808
- 175,
1809
- 87,
1810
- 197,
1811
- 233,
1812
- 232,
1813
- 15,
1814
- 225,
1815
- 99,
1816
- 156,
1817
- 156,
1818
- 160,
1819
- 80,
1820
- 227,
1821
- 175,
1822
- 27,
1823
- 57,
1824
- 193,
1825
- 67,
1826
- 198,
1827
- 62,
1828
- 66,
1829
- 156,
1830
- 188,
1831
- 235,
1832
- 21,
1833
- 217,
1834
- 64,
1835
- 251,
1836
- 181,
1837
- 197,
1838
- 161,
1839
- 244,
1840
- 175,
1841
- 87,
1842
- 197,
1843
- 233
1844
- ]),
1845
- "KeyAgg list": R.from([
1846
- 72,
1847
- 28,
1848
- 151,
1849
- 28,
1850
- 60,
1851
- 11,
1852
- 70,
1853
- 215,
1854
- 240,
1855
- 178,
1856
- 117,
1857
- 174,
1858
- 89,
1859
- 141,
1860
- 78,
1861
- 44,
1862
- 126,
1863
- 215,
1864
- 49,
1865
- 156,
1866
- 89,
1867
- 74,
1868
- 92,
1869
- 110,
1870
- 199,
1871
- 158,
1872
- 160,
1873
- 212,
1874
- 153,
1875
- 2,
1876
- 148,
1877
- 240,
1878
- 72,
1879
- 28,
1880
- 151,
1881
- 28,
1882
- 60,
1883
- 11,
1884
- 70,
1885
- 215,
1886
- 240,
1887
- 178,
1888
- 117,
1889
- 174,
1890
- 89,
1891
- 141,
1892
- 78,
1893
- 44,
1894
- 126,
1895
- 215,
1896
- 49,
1897
- 156,
1898
- 89,
1899
- 74,
1900
- 92,
1901
- 110,
1902
- 199,
1903
- 158,
1904
- 160,
1905
- 212,
1906
- 153,
1907
- 2,
1908
- 148,
1909
- 240
1910
- ]),
1911
- "KeyAgg coefficient": R.from([
1912
- 191,
1913
- 201,
1914
- 4,
1915
- 3,
1916
- 77,
1917
- 28,
1918
- 136,
1919
- 232,
1920
- 200,
1921
- 14,
1922
- 34,
1923
- 229,
1924
- 61,
1925
- 36,
1926
- 86,
1927
- 109,
1928
- 100,
1929
- 130,
1930
- 78,
1931
- 214,
1932
- 66,
1933
- 114,
1934
- 129,
1935
- 192,
1936
- 145,
1937
- 0,
1938
- 249,
1939
- 77,
1940
- 205,
1941
- 82,
1942
- 201,
1943
- 129,
1944
- 191,
1945
- 201,
1946
- 4,
1947
- 3,
1948
- 77,
1949
- 28,
1950
- 136,
1951
- 232,
1952
- 200,
1953
- 14,
1954
- 34,
1955
- 229,
1956
- 61,
1957
- 36,
1958
- 86,
1959
- 109,
1960
- 100,
1961
- 130,
1962
- 78,
1963
- 214,
1964
- 66,
1965
- 114,
1966
- 129,
1967
- 192,
1968
- 145,
1969
- 0,
1970
- 249,
1971
- 77,
1972
- 205,
1973
- 82,
1974
- 201,
1975
- 129
1976
- ])
1977
- };
1978
- function Fr(c, s) {
1979
- return $t(R.concat([Ht[c], s]));
1980
- }
1981
- const Gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1982
- __proto__: null,
1983
- TAGGED_HASH_PREFIXES: Ht,
1984
- TAGS: Dr,
1985
- hash160: Nr,
1986
- hash256: Pr,
1987
- ripemd160: Mr,
1988
- sha1: kr,
1989
- sha256: $t,
1990
- taggedHash: Fr
1991
- }, Symbol.toStringTag, { value: "Module" }));
1992
- export {
1993
- R as B,
1994
- Dr as T,
1995
- kr as a,
1996
- $t as b,
1997
- Gr as c,
1998
- Pr as d,
1999
- Ht as e,
2000
- Hr as f,
2001
- Or as g,
2002
- Nr as h,
2003
- Mr as r,
2004
- tt as s,
2005
- Fr as t
2006
- };