@prosopo/procaptcha-bundle 2.6.12 → 3.0.6

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 (117) hide show
  1. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts.map +1 -1
  2. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js +3 -2
  3. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js.map +1 -1
  4. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +1 -1
  5. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js +4 -0
  6. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js.map +1 -1
  7. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.d.ts +1 -1
  8. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.d.ts.map +1 -1
  9. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts.map +1 -1
  10. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js +1 -1
  11. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js.map +1 -1
  12. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.d.ts +1 -1
  13. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.d.ts.map +1 -1
  14. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.js +2 -2
  15. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.js.map +1 -1
  16. package/CHANGELOG.md +141 -0
  17. package/dist/bundle/ProcaptchaWidget-BpzncYOb.js +612 -0
  18. package/dist/bundle/ProcaptchaWidget-D961oZ27.js +148 -0
  19. package/dist/bundle/bnChunk-DRlDxTFg.js +1137 -0
  20. package/dist/bundle/{browser-ponyfill-Bctlk3uB.js → browser-ponyfill-CvzSbL_o.js} +31 -30
  21. package/dist/bundle/builder-CQlqPNRd.js +37 -0
  22. package/dist/bundle/captchaComponentProvider-Dw6ydLe3.js +802 -0
  23. package/dist/bundle/{captchaRenderer-BAMErqQN.js → captchaRenderer-CY8KuZK-.js} +22 -22
  24. package/dist/bundle/commonChunk-24zMb_mF.js +189 -0
  25. package/dist/bundle/emotion-element-5486c51c.browser.esm-PRDDgd_k.js +918 -0
  26. package/dist/bundle/{fp.esm-DYWeNGcH.js → fp.esm-BADUiinQ.js} +548 -648
  27. package/dist/bundle/index-BRg_gWPo.js +1328 -0
  28. package/dist/bundle/{index-ByKGlSkE.js → index-BzOMq-ud.js} +2 -2
  29. package/dist/bundle/{index-1qH2dz7u.js → index-DqwVRCwA.js} +166 -199
  30. package/dist/bundle/index.d.ts.map +1 -1
  31. package/dist/bundle/locales/ar/translation.json +4 -3
  32. package/dist/bundle/locales/az/translation.json +4 -3
  33. package/dist/bundle/locales/cs/translation.json +4 -3
  34. package/dist/bundle/locales/de/translation.json +4 -3
  35. package/dist/bundle/locales/el/translation.json +4 -3
  36. package/dist/bundle/locales/en/translation.json +4 -3
  37. package/dist/bundle/locales/es/translation.json +4 -3
  38. package/dist/bundle/locales/fi/translation.json +4 -3
  39. package/dist/bundle/locales/fr/translation.json +4 -3
  40. package/dist/bundle/locales/hi/translation.json +4 -3
  41. package/dist/bundle/locales/hu/translation.json +4 -3
  42. package/dist/bundle/locales/id/translation.json +4 -3
  43. package/dist/bundle/locales/it/translation.json +4 -3
  44. package/dist/bundle/locales/ja/translation.json +4 -3
  45. package/dist/bundle/locales/jv/translation.json +4 -3
  46. package/dist/bundle/locales/ko/translation.json +4 -3
  47. package/dist/bundle/locales/ml/translation.json +4 -3
  48. package/dist/bundle/locales/ms/translation.json +4 -3
  49. package/dist/bundle/locales/nl/translation.json +4 -3
  50. package/dist/bundle/locales/no/translation.json +4 -3
  51. package/dist/bundle/locales/pl/translation.json +4 -3
  52. package/dist/bundle/locales/pt/translation.json +4 -3
  53. package/dist/bundle/locales/{pt-br → pt-BR}/translation.json +4 -3
  54. package/dist/bundle/locales/ro/translation.json +4 -3
  55. package/dist/bundle/locales/ru/translation.json +4 -3
  56. package/dist/bundle/locales/sr/translation.json +4 -3
  57. package/dist/bundle/locales/sv/translation.json +4 -3
  58. package/dist/bundle/locales/th/translation.json +4 -3
  59. package/dist/bundle/locales/tr/translation.json +4 -3
  60. package/dist/bundle/locales/uk/translation.json +4 -3
  61. package/dist/bundle/locales/vi/translation.json +4 -3
  62. package/dist/bundle/locales/{zh-cn → zh-CN}/translation.json +4 -3
  63. package/dist/bundle/nobleChunk-Xl5XLrx3.js +3635 -0
  64. package/dist/bundle/procaptcha.bundle.js +6 -5
  65. package/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +1 -1
  66. package/dist/bundle/util/captcha/captchaComponentsList.d.ts +1 -1
  67. package/dist/bundle/util/captcha/captchaComponentsList.d.ts.map +1 -1
  68. package/dist/bundle/util/captcha/captchaRenderer.d.ts.map +1 -1
  69. package/dist/bundle/util/configCreator.d.ts +1 -1
  70. package/dist/bundle/util/configCreator.d.ts.map +1 -1
  71. package/dist/bundle/utilChunk-sqstc6C5.js +317 -0
  72. package/dist/bundle/utilCryptoChunk-CIPUtfoO.js +1256 -0
  73. package/dist/bundle/web2Chunk-7Vd8yt2r.js +3711 -0
  74. package/dist/bundle/{hash-CrwduMDb.js → web3Chunk-DrUvbVNW.js} +257 -695
  75. package/dist/bundle/{translations-DEL070wJ.js → zodChunk-wTu9ZHzV.js} +46 -82
  76. package/dist/cjs/index.cjs +8 -2
  77. package/dist/cjs/util/captcha/captchaComponentProvider.cjs +4 -0
  78. package/dist/cjs/util/captcha/captchaRenderer.cjs +2 -1
  79. package/dist/cjs/util/configCreator.cjs +2 -2
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +3 -2
  82. package/dist/index.js.map +1 -1
  83. package/dist/util/captcha/captchaComponentProvider.d.ts +1 -1
  84. package/dist/util/captcha/captchaComponentProvider.d.ts.map +1 -1
  85. package/dist/util/captcha/captchaComponentProvider.js +4 -0
  86. package/dist/util/captcha/captchaComponentProvider.js.map +1 -1
  87. package/dist/util/captcha/captchaComponentsList.d.ts +1 -1
  88. package/dist/util/captcha/captchaComponentsList.d.ts.map +1 -1
  89. package/dist/util/captcha/captchaRenderer.d.ts.map +1 -1
  90. package/dist/util/captcha/captchaRenderer.js +1 -1
  91. package/dist/util/captcha/captchaRenderer.js.map +1 -1
  92. package/dist/util/configCreator.d.ts +1 -1
  93. package/dist/util/configCreator.d.ts.map +1 -1
  94. package/dist/util/configCreator.js +2 -2
  95. package/dist/util/configCreator.js.map +1 -1
  96. package/package.json +21 -14
  97. package/stats.html +1 -1
  98. package/vite.config.ts +47 -4
  99. package/vite.serve.config.ts +2 -0
  100. package/vite.test.config.ts +1 -1
  101. package/webpack.config.cjs +5 -0
  102. package/dist/bundle/ProcaptchaWidget-DPyDGPiI.js +0 -156
  103. package/dist/bundle/ProcaptchaWidget-DoqUlwHS.js +0 -636
  104. package/dist/bundle/_commonjsHelpers-DaMA6jEr.js +0 -8
  105. package/dist/bundle/asU8a-BixKX-w0.js +0 -9
  106. package/dist/bundle/bip39-D7YSihxf.js +0 -260
  107. package/dist/bundle/captchaComponentProvider-BL18T1UE.js +0 -1242
  108. package/dist/bundle/emotion-element-5486c51c.browser.esm-Bjt1gs1F.js +0 -1807
  109. package/dist/bundle/i18nFrontend-DCv3P9jv.js +0 -2273
  110. package/dist/bundle/index-BeN3et18.js +0 -4844
  111. package/dist/bundle/index-BjRdPnnE.js +0 -1198
  112. package/dist/bundle/index-CBquknc2.js +0 -81
  113. package/dist/bundle/index-QVME9Prx.js +0 -32
  114. package/dist/bundle/sha256-CGE_4eEY.js +0 -171
  115. package/dist/bundle/spread-DEmVz7RJ.js +0 -15
  116. package/dist/bundle/toU8a-CPMbkkSw.js +0 -109
  117. package/dist/bundle/useTranslation-BJsfZyOx.js +0 -158
@@ -0,0 +1,1256 @@
1
+ import { u as h, a as hr, b as D, s as q, i as $e, c as De, x as fr, o as pr, d as Y, e as z, f as gr, g as yr, h as mr, j as wr, k as br, l as vr, m as kr, n as ye, p as Er, q as xr } from "./utilChunk-sqstc6C5.js";
2
+ import { b as me, s as Ar, r as x, a as Ur, n as m, c as I, R as g, u as ie, i as Ie, d as A, e as Ne, m as Sr, f as Br, g as _r, k as Rr, h as $r, p as Dr, j as Ir, l as Nr, o as Pr } from "./nobleChunk-Xl5XLrx3.js";
3
+ import { B as Tr } from "./bnChunk-DRlDxTFg.js";
4
+ function ce(r) {
5
+ return r instanceof Uint8Array || ArrayBuffer.isView(r) && r.constructor.name === "Uint8Array";
6
+ }
7
+ function jr(r, ...e) {
8
+ if (!ce(r))
9
+ throw new Error("Uint8Array expected");
10
+ if (e.length > 0 && !e.includes(r.length))
11
+ throw new Error("Uint8Array expected of length " + e + ", got length=" + r.length);
12
+ }
13
+ function Pe(r, e) {
14
+ return Array.isArray(e) ? e.length === 0 ? !0 : r ? e.every((t) => typeof t == "string") : e.every((t) => Number.isSafeInteger(t)) : !1;
15
+ }
16
+ function N(r, e) {
17
+ if (typeof e != "string")
18
+ throw new Error(`${r}: string expected`);
19
+ return !0;
20
+ }
21
+ function T(r) {
22
+ if (!Number.isSafeInteger(r))
23
+ throw new Error(`invalid integer: ${r}`);
24
+ }
25
+ function L(r) {
26
+ if (!Array.isArray(r))
27
+ throw new Error("array expected");
28
+ }
29
+ function H(r, e) {
30
+ if (!Pe(!0, e))
31
+ throw new Error(`${r}: array of strings expected`);
32
+ }
33
+ function Te(r, e) {
34
+ if (!Pe(!1, e))
35
+ throw new Error(`${r}: array of numbers expected`);
36
+ }
37
+ // @__NO_SIDE_EFFECTS__
38
+ function je(...r) {
39
+ const e = (a) => a, t = (a, s) => (i) => a(s(i)), n = r.map((a) => a.encode).reduceRight(t, e), o = r.map((a) => a.decode).reduce(t, e);
40
+ return { encode: n, decode: o };
41
+ }
42
+ // @__NO_SIDE_EFFECTS__
43
+ function ze(r) {
44
+ const e = typeof r == "string" ? r.split("") : r, t = e.length;
45
+ H("alphabet", e);
46
+ const n = new Map(e.map((o, a) => [o, a]));
47
+ return {
48
+ encode: (o) => (L(o), o.map((a) => {
49
+ if (!Number.isSafeInteger(a) || a < 0 || a >= t)
50
+ throw new Error(`alphabet.encode: digit index outside alphabet "${a}". Allowed: ${r}`);
51
+ return e[a];
52
+ })),
53
+ decode: (o) => (L(o), o.map((a) => {
54
+ N("alphabet.decode", a);
55
+ const s = n.get(a);
56
+ if (s === void 0)
57
+ throw new Error(`Unknown letter: "${a}". Allowed: ${r}`);
58
+ return s;
59
+ }))
60
+ };
61
+ }
62
+ // @__NO_SIDE_EFFECTS__
63
+ function Ce(r = "") {
64
+ return N("join", r), {
65
+ encode: (e) => (H("join.decode", e), e.join(r)),
66
+ decode: (e) => (N("join.decode", e), e.split(r))
67
+ };
68
+ }
69
+ // @__NO_SIDE_EFFECTS__
70
+ function zr(r, e = "=") {
71
+ return T(r), N("padding", e), {
72
+ encode(t) {
73
+ for (H("padding.encode", t); t.length * r % 8; )
74
+ t.push(e);
75
+ return t;
76
+ },
77
+ decode(t) {
78
+ H("padding.decode", t);
79
+ let n = t.length;
80
+ if (n * r % 8)
81
+ throw new Error("padding: invalid, string should have whole number of bytes");
82
+ for (; n > 0 && t[n - 1] === e; n--)
83
+ if ((n - 1) * r % 8 === 0)
84
+ throw new Error("padding: invalid, string has too much padding");
85
+ return t.slice(0, n);
86
+ }
87
+ };
88
+ }
89
+ function we(r, e, t) {
90
+ if (e < 2)
91
+ throw new Error(`convertRadix: invalid from=${e}, base cannot be less than 2`);
92
+ if (t < 2)
93
+ throw new Error(`convertRadix: invalid to=${t}, base cannot be less than 2`);
94
+ if (L(r), !r.length)
95
+ return [];
96
+ let n = 0;
97
+ const o = [], a = Array.from(r, (i) => {
98
+ if (T(i), i < 0 || i >= e)
99
+ throw new Error(`invalid integer: ${i}`);
100
+ return i;
101
+ }), s = a.length;
102
+ for (; ; ) {
103
+ let i = 0, l = !0;
104
+ for (let c = n; c < s; c++) {
105
+ const u = a[c], d = e * i, p = d + u;
106
+ if (!Number.isSafeInteger(p) || d / e !== i || p - u !== d)
107
+ throw new Error("convertRadix: carry overflow");
108
+ const b = p / t;
109
+ i = p % t;
110
+ const w = Math.floor(b);
111
+ if (a[c] = w, !Number.isSafeInteger(w) || w * t + i !== p)
112
+ throw new Error("convertRadix: carry overflow");
113
+ if (l)
114
+ w ? l = !1 : n = c;
115
+ else continue;
116
+ }
117
+ if (o.push(i), l)
118
+ break;
119
+ }
120
+ for (let i = 0; i < r.length - 1 && r[i] === 0; i++)
121
+ o.push(0);
122
+ return o.reverse();
123
+ }
124
+ const Oe = (r, e) => e === 0 ? r : Oe(e, r % e), F = /* @__NO_SIDE_EFFECTS__ */ (r, e) => r + (e - Oe(r, e)), W = /* @__PURE__ */ (() => {
125
+ let r = [];
126
+ for (let e = 0; e < 40; e++)
127
+ r.push(2 ** e);
128
+ return r;
129
+ })();
130
+ function be(r, e, t, n) {
131
+ if (L(r), e <= 0 || e > 32)
132
+ throw new Error(`convertRadix2: wrong from=${e}`);
133
+ if (t <= 0 || t > 32)
134
+ throw new Error(`convertRadix2: wrong to=${t}`);
135
+ if (/* @__PURE__ */ F(e, t) > 32)
136
+ throw new Error(`convertRadix2: carry overflow from=${e} to=${t} carryBits=${/* @__PURE__ */ F(e, t)}`);
137
+ let o = 0, a = 0;
138
+ const s = W[e], i = W[t] - 1, l = [];
139
+ for (const c of r) {
140
+ if (T(c), c >= s)
141
+ throw new Error(`convertRadix2: invalid data word=${c} from=${e}`);
142
+ if (o = o << e | c, a + e > 32)
143
+ throw new Error(`convertRadix2: carry overflow pos=${a} from=${e}`);
144
+ for (a += e; a >= t; a -= t)
145
+ l.push((o >> a - t & i) >>> 0);
146
+ const u = W[a];
147
+ if (u === void 0)
148
+ throw new Error("invalid carry");
149
+ o &= u - 1;
150
+ }
151
+ if (o = o << t - a & i, !n && a >= e)
152
+ throw new Error("Excess padding");
153
+ if (!n && o > 0)
154
+ throw new Error(`Non-zero padding: ${o}`);
155
+ return n && a > 0 && l.push(o >>> 0), l;
156
+ }
157
+ // @__NO_SIDE_EFFECTS__
158
+ function Cr(r) {
159
+ T(r);
160
+ const e = 2 ** 8;
161
+ return {
162
+ encode: (t) => {
163
+ if (!ce(t))
164
+ throw new Error("radix.encode input should be Uint8Array");
165
+ return we(Array.from(t), e, r);
166
+ },
167
+ decode: (t) => (Te("radix.decode", t), Uint8Array.from(we(t, r, e)))
168
+ };
169
+ }
170
+ // @__NO_SIDE_EFFECTS__
171
+ function Or(r, e = !1) {
172
+ if (T(r), r <= 0 || r > 32)
173
+ throw new Error("radix2: bits should be in (0..32]");
174
+ if (/* @__PURE__ */ F(8, r) > 32 || /* @__PURE__ */ F(r, 8) > 32)
175
+ throw new Error("radix2: carry overflow");
176
+ return {
177
+ encode: (t) => {
178
+ if (!ce(t))
179
+ throw new Error("radix2.encode input should be Uint8Array");
180
+ return be(Array.from(t), 8, r, !e);
181
+ },
182
+ decode: (t) => (Te("radix2.decode", t), Uint8Array.from(be(t, r, 8, e)))
183
+ };
184
+ }
185
+ const Lr = typeof Uint8Array.from([]).toBase64 == "function" && typeof Uint8Array.fromBase64 == "function", Hr = (r, e) => {
186
+ N("base64", r);
187
+ const t = /^[A-Za-z0-9=+/]+$/, n = "base64";
188
+ if (r.length > 0 && !t.test(r))
189
+ throw new Error("invalid base64");
190
+ return Uint8Array.fromBase64(r, { alphabet: n, lastChunkHandling: "strict" });
191
+ }, Fr = Lr ? {
192
+ encode(r) {
193
+ return jr(r), r.toBase64();
194
+ },
195
+ decode(r) {
196
+ return Hr(r);
197
+ }
198
+ } : /* @__PURE__ */ je(/* @__PURE__ */ Or(6), /* @__PURE__ */ ze("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ zr(6), /* @__PURE__ */ Ce("")), Mr = /* @__NO_SIDE_EFFECTS__ */ (r) => /* @__PURE__ */ je(/* @__PURE__ */ Cr(58), /* @__PURE__ */ ze(r), /* @__PURE__ */ Ce("")), qr = /* @__PURE__ */ Mr("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
199
+ function Le({ coder: r, ipfs: e }, t) {
200
+ return (n, o) => (t(n, o), r.decode(e && o ? n.substring(1) : n));
201
+ }
202
+ function He({ coder: r, ipfs: e }) {
203
+ return (t, n) => {
204
+ const o = r.encode(h(t));
205
+ return e && n ? `${e}${o}` : o;
206
+ };
207
+ }
208
+ function Fe({ chars: r, ipfs: e, type: t, withPadding: n }) {
209
+ return (o, a) => {
210
+ if (typeof o != "string")
211
+ throw new Error(`Expected ${t} string input`);
212
+ if (e && a && !o.startsWith(e))
213
+ throw new Error(`Expected ipfs-compatible ${t} to start with '${e}'`);
214
+ for (let s = a ? 1 : 0, i = o.length; s < i; s++) {
215
+ const l = o[s];
216
+ if (l === void 0)
217
+ throw new Error(`Invalid undefined value at index ${s}`);
218
+ if (!r.includes(l)) if (n && o[s] === "=") {
219
+ if (s !== i - 1) {
220
+ if (o[s + 1] !== "=") throw new Error(`Invalid ${t} padding sequence "${o[s]}${o[s + 1]}" at index ${s}`);
221
+ }
222
+ } else
223
+ throw new Error(`Invalid ${t} character "${o[s]}" (0x${o.charCodeAt(s).toString(16)}) at index ${s}`);
224
+ }
225
+ return !0;
226
+ };
227
+ }
228
+ const le = {
229
+ chars: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",
230
+ coder: qr,
231
+ ipfs: "z",
232
+ type: "base58"
233
+ }, Vr = Fe(le), Kr = Le(le, Vr), Yr = He(le);
234
+ function Me(r) {
235
+ return (...e) => hr(r(...e));
236
+ }
237
+ function ue(r, e = 256, t, n) {
238
+ const o = Math.ceil(e / 8), a = h(r);
239
+ return t ? me(a, { dkLen: o, key: t }) : me(a, { dkLen: o });
240
+ }
241
+ const Wt = Me(ue), Wr = q("SS58PRE");
242
+ function qe(r) {
243
+ return ue(D(Wr, r), 512);
244
+ }
245
+ function Jr(r) {
246
+ if (r[0] === void 0)
247
+ throw new Error("Invalid address: first byte cannot be undefined");
248
+ if (r[1] === void 0)
249
+ throw new Error("Invalid address: second byte cannot be undefined");
250
+ const e = r[0] & 64 ? 2 : 1, t = e === 1 ? r[0] : (r[0] & 63) << 2 | r[1] >> 6 | (r[1] & 63) << 8, n = [34 + e, 35 + e].includes(r.length), o = r.length - (n ? 2 : 1), a = qe(r.subarray(0, o));
251
+ return [(r[0] & 128) === 0 && ![46, 47].includes(r[0]) && (n ? r[r.length - 2] === a[0] && r[r.length - 1] === a[1] : r[r.length - 1] === a[0]), o, e, t];
252
+ }
253
+ const C = {
254
+ allowedDecodedLengths: [1, 2, 4, 8, 32, 33],
255
+ allowedEncodedLengths: [3, 4, 6, 10, 35, 36, 37, 38],
256
+ prefix: 42
257
+ };
258
+ function Ve(r, e, t = -1) {
259
+ if (!r)
260
+ throw new Error("Invalid empty address passed");
261
+ if ($e(r) || De(r))
262
+ return h(r);
263
+ try {
264
+ const n = Kr(r);
265
+ if (!C.allowedEncodedLengths.includes(n.length))
266
+ throw new Error("Invalid decoded address length");
267
+ const [o, a, s, i] = Jr(n);
268
+ if (!o && !e)
269
+ throw new Error("Invalid decoded address checksum");
270
+ if (t !== -1 && t !== i)
271
+ throw new Error(`Expected ss58Format ${t}, received ${i}`);
272
+ return n.slice(s, a);
273
+ } catch (n) {
274
+ throw new Error(`Decoding ${r}: ${n.message}`);
275
+ }
276
+ }
277
+ function Jt(r, e = C.prefix) {
278
+ const t = Ve(r);
279
+ if (e < 0 || e > 16383 || [46, 47].includes(e))
280
+ throw new Error("Out of range ss58Format specified");
281
+ if (!C.allowedDecodedLengths.includes(t.length))
282
+ throw new Error(`Expected a valid key to convert, with length ${C.allowedDecodedLengths.join(", ")}`);
283
+ const n = D(e < 64 ? [e] : [
284
+ (e & 252) >> 2 | 64,
285
+ e >> 8 | (e & 3) << 6
286
+ ], t);
287
+ return Yr(D(n, qe(n).subarray(0, [32, 33].includes(t.length) ? 2 : 1)));
288
+ }
289
+ const de = {
290
+ chars: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
291
+ coder: Fr,
292
+ type: "base64",
293
+ withPadding: !0
294
+ }, Gr = Fe(de), Gt = Le(de, Gr), Zr = He(de);
295
+ function j(r, e) {
296
+ return r << e | r >>> 32 - e;
297
+ }
298
+ function v(r, e) {
299
+ let t = r[e + 3] & 255;
300
+ return t = t << 8 | r[e + 2] & 255, t = t << 8 | r[e + 1] & 255, t << 8 | r[e + 0] & 255;
301
+ }
302
+ function J(r, e, t) {
303
+ for (let n = 0; n < 4; n++)
304
+ r[e + n] = t & 255, t >>>= 8;
305
+ }
306
+ function Xr(r, e, t, n, o) {
307
+ let a = 0;
308
+ for (let s = 0; s < o; s++)
309
+ a |= r[e + s] ^ t[n + s];
310
+ return (1 & a - 1 >>> 8) - 1;
311
+ }
312
+ function re(r, e, t, n, o) {
313
+ const a = new Uint32Array(16), s = new Uint32Array(16), i = new Uint32Array(16), l = new Uint32Array(4);
314
+ let c, u, d;
315
+ for (c = 0; c < 4; c++)
316
+ s[5 * c] = v(n, 4 * c), s[1 + c] = v(t, 4 * c), s[6 + c] = v(e, 4 * c), s[11 + c] = v(t, 16 + 4 * c);
317
+ for (c = 0; c < 16; c++)
318
+ i[c] = s[c];
319
+ for (c = 0; c < 20; c++) {
320
+ for (u = 0; u < 4; u++) {
321
+ for (d = 0; d < 4; d++)
322
+ l[d] = s[(5 * u + 4 * d) % 16];
323
+ for (l[1] ^= j(l[0] + l[3] | 0, 7), l[2] ^= j(l[1] + l[0] | 0, 9), l[3] ^= j(l[2] + l[1] | 0, 13), l[0] ^= j(l[3] + l[2] | 0, 18), d = 0; d < 4; d++)
324
+ a[4 * u + (u + d) % 4] = l[d];
325
+ }
326
+ for (d = 0; d < 16; d++)
327
+ s[d] = a[d];
328
+ }
329
+ if (o) {
330
+ for (c = 0; c < 16; c++)
331
+ s[c] = s[c] + i[c] | 0;
332
+ for (c = 0; c < 4; c++)
333
+ s[5 * c] = s[5 * c] - v(n, 4 * c) | 0, s[6 + c] = s[6 + c] - v(e, 4 * c) | 0;
334
+ for (c = 0; c < 4; c++)
335
+ J(r, 4 * c, s[5 * c]), J(r, 16 + 4 * c, s[6 + c]);
336
+ } else
337
+ for (c = 0; c < 16; c++)
338
+ J(r, 4 * c, s[c] + i[c] | 0);
339
+ }
340
+ const te = new Uint8Array([
341
+ 101,
342
+ 120,
343
+ 112,
344
+ 97,
345
+ 110,
346
+ 100,
347
+ 32,
348
+ 51,
349
+ 50,
350
+ 45,
351
+ 98,
352
+ 121,
353
+ 116,
354
+ 101,
355
+ 32,
356
+ 107
357
+ ]);
358
+ function Qr(r, e, t, n, o, a, s) {
359
+ const i = new Uint8Array(16), l = new Uint8Array(64);
360
+ let c, u;
361
+ if (!o)
362
+ return 0;
363
+ for (u = 0; u < 16; u++)
364
+ i[u] = 0;
365
+ for (u = 0; u < 8; u++)
366
+ i[u] = a[u];
367
+ for (; o >= 64; ) {
368
+ for (re(l, i, s, te, !1), u = 0; u < 64; u++)
369
+ r[e + u] = (t ? t[n + u] : 0) ^ l[u];
370
+ for (c = 1, u = 8; u < 16; u++)
371
+ c = c + (i[u] & 255) | 0, i[u] = c & 255, c >>>= 8;
372
+ o -= 64, e += 64, t && (n += 64);
373
+ }
374
+ if (o > 0)
375
+ for (re(l, i, s, te, !1), u = 0; u < o; u++)
376
+ r[e + u] = (t ? t[n + u] : 0) ^ l[u];
377
+ return 0;
378
+ }
379
+ function ne(r, e, t, n, o, a, s) {
380
+ const i = new Uint8Array(32);
381
+ return re(i, a, s, te, !0), Qr(r, e, t, n, o, a.subarray(16), i);
382
+ }
383
+ function G(r, e) {
384
+ let t = 0;
385
+ for (let n = 0; n < 17; n++)
386
+ t = t + (r[n] + e[n] | 0) | 0, r[n] = t & 255, t >>>= 8;
387
+ }
388
+ const et = new Uint32Array([
389
+ 5,
390
+ 0,
391
+ 0,
392
+ 0,
393
+ 0,
394
+ 0,
395
+ 0,
396
+ 0,
397
+ 0,
398
+ 0,
399
+ 0,
400
+ 0,
401
+ 0,
402
+ 0,
403
+ 0,
404
+ 0,
405
+ 252
406
+ ]);
407
+ function Ke(r, e, t, n, o, a) {
408
+ let s, i, l;
409
+ const c = new Uint32Array(17), u = new Uint32Array(17), d = new Uint32Array(17), p = new Uint32Array(17), b = new Uint32Array(17);
410
+ for (i = 0; i < 17; i++)
411
+ u[i] = d[i] = 0;
412
+ for (i = 0; i < 16; i++)
413
+ u[i] = a[i];
414
+ for (u[3] &= 15, u[4] &= 252, u[7] &= 15, u[8] &= 252, u[11] &= 15, u[12] &= 252, u[15] &= 15; o > 0; ) {
415
+ for (i = 0; i < 17; i++)
416
+ p[i] = 0;
417
+ for (i = 0; i < 16 && i < o; ++i)
418
+ p[i] = t[n + i];
419
+ for (p[i] = 1, n += i, o -= i, G(d, p), s = 0; s < 17; s++)
420
+ for (c[s] = 0, i = 0; i < 17; i++)
421
+ c[s] = c[s] + d[i] * (i <= s ? u[s - i] : 320 * u[s + 17 - i] | 0) | 0 | 0;
422
+ for (s = 0; s < 17; s++)
423
+ d[s] = c[s];
424
+ for (l = 0, i = 0; i < 16; i++)
425
+ l = l + d[i] | 0, d[i] = l & 255, l >>>= 8;
426
+ for (l = l + d[16] | 0, d[16] = l & 3, l = 5 * (l >>> 2) | 0, i = 0; i < 16; i++)
427
+ l = l + d[i] | 0, d[i] = l & 255, l >>>= 8;
428
+ l = l + d[16] | 0, d[16] = l;
429
+ }
430
+ for (i = 0; i < 17; i++)
431
+ b[i] = d[i];
432
+ G(d, et);
433
+ const w = -(d[16] >>> 7) | 0;
434
+ for (i = 0; i < 17; i++)
435
+ d[i] ^= w & (b[i] ^ d[i]);
436
+ for (i = 0; i < 16; i++)
437
+ p[i] = a[i + 16];
438
+ for (p[16] = 0, G(d, p), i = 0; i < 16; i++)
439
+ r[e + i] = d[i];
440
+ return 0;
441
+ }
442
+ function rt(r, e, t, n, o, a) {
443
+ const s = new Uint8Array(16);
444
+ return Ke(s, 0, t, n, o, a), Xr(r, e, s, 0, 16);
445
+ }
446
+ function tt(r, e, t, n, o) {
447
+ if (t < 32)
448
+ return -1;
449
+ ne(r, 0, e, 0, t, n, o), Ke(r, 16, r, 32, t - 32, r);
450
+ for (let a = 0; a < 16; a++)
451
+ r[a] = 0;
452
+ return 0;
453
+ }
454
+ function nt(r, e, t, n, o) {
455
+ const a = new Uint8Array(32);
456
+ if (t < 32 || (ne(a, 0, null, 0, 32, n, o), rt(e, 16, e, 32, t - 32, a) !== 0))
457
+ return -1;
458
+ ne(r, 0, e, 0, t, n, o);
459
+ for (let s = 0; s < 32; s++)
460
+ r[s] = 0;
461
+ return 0;
462
+ }
463
+ const ot = 32, at = 24, oe = 32, ae = 16;
464
+ function Ye(r, e) {
465
+ if (r.length !== ot)
466
+ throw new Error("bad key size");
467
+ if (e.length !== at)
468
+ throw new Error("bad nonce size");
469
+ }
470
+ function We(...r) {
471
+ for (let e = 0, t = r.length; e < t; e++)
472
+ if (!(r[e] instanceof Uint8Array))
473
+ throw new TypeError("unexpected type, use Uint8Array");
474
+ }
475
+ function st(r, e, t) {
476
+ We(r, e, t), Ye(t, e);
477
+ const n = new Uint8Array(oe + r.length), o = new Uint8Array(n.length);
478
+ for (let a = 0; a < r.length; a++)
479
+ n[a + oe] = r[a];
480
+ return tt(o, n, n.length, e, t), o.subarray(ae);
481
+ }
482
+ function it(r, e, t) {
483
+ We(r, e, t), Ye(t, e);
484
+ const n = new Uint8Array(ae + r.length), o = new Uint8Array(n.length);
485
+ for (let a = 0; a < r.length; a++)
486
+ n[a + ae] = r[a];
487
+ return n.length < 32 || nt(o, n, n.length, e, t) !== 0 ? null : o.subarray(oe);
488
+ }
489
+ function ct(r, e, t) {
490
+ return it(r, e, t);
491
+ }
492
+ const lt = fr.crypto;
493
+ function ut(r) {
494
+ return lt.getRandomValues(r);
495
+ }
496
+ function V(r = 32) {
497
+ return ut(new Uint8Array(r));
498
+ }
499
+ const Zt = Me(V);
500
+ function Xt(r, e, t = V(24)) {
501
+ return {
502
+ encrypted: st(r, t, e),
503
+ nonce: t
504
+ };
505
+ }
506
+ const O = {
507
+ N: 32768,
508
+ p: 1,
509
+ r: 8
510
+ };
511
+ function dt(r, e = V(), t = O, n) {
512
+ const o = h(r);
513
+ return {
514
+ params: t,
515
+ password: Ar(o, e, pr({ dkLen: 64 }, t)),
516
+ salt: e
517
+ };
518
+ }
519
+ const Z = { isLe: !0 }, X = { bitLength: 32, isLe: !0 }, ht = { bitLength: 256, isLe: !0 };
520
+ function ft(r) {
521
+ const e = r.subarray(0, 32), t = Y(r.subarray(32, 36), Z).toNumber(), n = Y(r.subarray(36, 40), Z).toNumber(), o = Y(r.subarray(40, 44), Z).toNumber();
522
+ if (t !== O.N || n !== O.p || o !== O.r)
523
+ throw new Error("Invalid injected scrypt params found");
524
+ return { params: { N: t, p: n, r: o }, salt: e };
525
+ }
526
+ function Qt(r, { N: e, p: t, r: n }) {
527
+ return D(r, z(e, X), z(t, X), z(n, X));
528
+ }
529
+ const Je = [
530
+ "scrypt",
531
+ "xsalsa20-poly1305"
532
+ ], pt = ["none"], gt = "3", ve = 24, yt = 32 + 3 * 4;
533
+ function en(r, e, t = Je) {
534
+ if (!r)
535
+ throw new Error("No encrypted data available to decode");
536
+ if (t.includes("xsalsa20-poly1305") && !e)
537
+ throw new Error("Password required to decode encrypted data");
538
+ let n = r;
539
+ if (e) {
540
+ let o;
541
+ if (t.includes("scrypt")) {
542
+ const { params: a, salt: s } = ft(r);
543
+ o = dt(e, s, a).password, r = r.subarray(yt);
544
+ } else
545
+ o = q(e);
546
+ n = ct(r.subarray(ve), r.subarray(0, ve), gr(o, 256, !0));
547
+ }
548
+ if (!n)
549
+ throw new Error("Unable to decode using the supplied passphrase");
550
+ return n;
551
+ }
552
+ function rn(r, e, t) {
553
+ return {
554
+ encoded: Zr(r),
555
+ encoding: {
556
+ content: e,
557
+ type: t ? Je : pt,
558
+ version: gt
559
+ }
560
+ };
561
+ }
562
+ var ke = function() {
563
+ return ke = Object.assign || function(e) {
564
+ for (var t, n = 1, o = arguments.length; n < o; n++) {
565
+ t = arguments[n];
566
+ for (var a in t) Object.prototype.hasOwnProperty.call(t, a) && (e[a] = t[a]);
567
+ }
568
+ return e;
569
+ }, ke.apply(this, arguments);
570
+ };
571
+ function tn(r, e, t, n) {
572
+ function o(a) {
573
+ return a instanceof t ? a : new t(function(s) {
574
+ s(a);
575
+ });
576
+ }
577
+ return new (t || (t = Promise))(function(a, s) {
578
+ function i(u) {
579
+ try {
580
+ c(n.next(u));
581
+ } catch (d) {
582
+ s(d);
583
+ }
584
+ }
585
+ function l(u) {
586
+ try {
587
+ c(n.throw(u));
588
+ } catch (d) {
589
+ s(d);
590
+ }
591
+ }
592
+ function c(u) {
593
+ u.done ? a(u.value) : o(u.value).then(i, l);
594
+ }
595
+ c((n = n.apply(r, e || [])).next());
596
+ });
597
+ }
598
+ function nn(r, e) {
599
+ var t = { label: 0, sent: function() {
600
+ if (a[0] & 1) throw a[1];
601
+ return a[1];
602
+ }, trys: [], ops: [] }, n, o, a, s = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
603
+ return s.next = i(0), s.throw = i(1), s.return = i(2), typeof Symbol == "function" && (s[Symbol.iterator] = function() {
604
+ return this;
605
+ }), s;
606
+ function i(c) {
607
+ return function(u) {
608
+ return l([c, u]);
609
+ };
610
+ }
611
+ function l(c) {
612
+ if (n) throw new TypeError("Generator is already executing.");
613
+ for (; s && (s = 0, c[0] && (t = 0)), t; ) try {
614
+ if (n = 1, o && (a = c[0] & 2 ? o.return : c[0] ? o.throw || ((a = o.return) && a.call(o), 0) : o.next) && !(a = a.call(o, c[1])).done) return a;
615
+ switch (o = 0, a && (c = [c[0] & 2, a.value]), c[0]) {
616
+ case 0:
617
+ case 1:
618
+ a = c;
619
+ break;
620
+ case 4:
621
+ return t.label++, { value: c[1], done: !1 };
622
+ case 5:
623
+ t.label++, o = c[1], c = [0];
624
+ continue;
625
+ case 7:
626
+ c = t.ops.pop(), t.trys.pop();
627
+ continue;
628
+ default:
629
+ if (a = t.trys, !(a = a.length > 0 && a[a.length - 1]) && (c[0] === 6 || c[0] === 2)) {
630
+ t = 0;
631
+ continue;
632
+ }
633
+ if (c[0] === 3 && (!a || c[1] > a[0] && c[1] < a[3])) {
634
+ t.label = c[1];
635
+ break;
636
+ }
637
+ if (c[0] === 6 && t.label < a[1]) {
638
+ t.label = a[1], a = c;
639
+ break;
640
+ }
641
+ if (a && t.label < a[2]) {
642
+ t.label = a[2], t.ops.push(c);
643
+ break;
644
+ }
645
+ a[2] && t.ops.pop(), t.trys.pop();
646
+ continue;
647
+ }
648
+ c = e.call(r, t);
649
+ } catch (u) {
650
+ c = [6, u], o = 0;
651
+ } finally {
652
+ n = a = 0;
653
+ }
654
+ if (c[0] & 5) throw c[1];
655
+ return { value: c[0] ? c[1] : void 0, done: !0 };
656
+ }
657
+ }
658
+ function on(r, e, t) {
659
+ if (t || arguments.length === 2) for (var n = 0, o = e.length, a; n < o; n++)
660
+ (a || !(n in e)) && (a || (a = Array.prototype.slice.call(e, 0, n)), a[n] = e[n]);
661
+ return r.concat(a || Array.prototype.slice.call(e));
662
+ }
663
+ function _(r, e, t, n) {
664
+ if (t === "a" && !n) throw new TypeError("Private accessor was defined without a getter");
665
+ if (typeof e == "function" ? r !== e || !n : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
666
+ return t === "m" ? n : t === "a" ? n.call(r) : n ? n.value : e.get(r);
667
+ }
668
+ function Ee(r, e, t, n, o) {
669
+ if (n === "m") throw new TypeError("Private method is not writable");
670
+ if (n === "a" && !o) throw new TypeError("Private accessor was defined without a setter");
671
+ if (typeof e == "function" ? r !== e || !o : !e.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
672
+ return n === "a" ? o.call(r, t) : o ? o.value = t : e.set(r, t), t;
673
+ }
674
+ var $, k;
675
+ const mt = /^\d+$/, wt = 32;
676
+ class he {
677
+ constructor() {
678
+ $.set(this, new Uint8Array(32)), k.set(this, !1);
679
+ }
680
+ static from(e) {
681
+ const t = new he(), [n, o] = e.startsWith("/") ? [e.substring(1), !0] : [e, !1];
682
+ return t.soft(mt.test(n) ? new Tr(n, 10) : n), o ? t.harden() : t;
683
+ }
684
+ get chainCode() {
685
+ return _(this, $, "f");
686
+ }
687
+ get isHard() {
688
+ return _(this, k, "f");
689
+ }
690
+ get isSoft() {
691
+ return !_(this, k, "f");
692
+ }
693
+ hard(e) {
694
+ return this.soft(e).harden();
695
+ }
696
+ harden() {
697
+ return Ee(this, k, !0, "f"), this;
698
+ }
699
+ soft(e) {
700
+ return yr(e) || mr(e) || wr(e) ? this.soft(z(e, ht)) : De(e) ? this.soft(br(e)) : vr(e) ? this.soft(kr(q(e))) : e.length > wt ? this.soft(ue(e)) : (_(this, $, "f").fill(0), _(this, $, "f").set(e, 0), this);
701
+ }
702
+ soften() {
703
+ return Ee(this, k, !1, "f"), this;
704
+ }
705
+ }
706
+ $ = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap();
707
+ const bt = /\/(\/?)([^/]+)/g;
708
+ function vt(r) {
709
+ const e = r.match(bt), t = [];
710
+ let n = "";
711
+ if (e) {
712
+ n = e.join("");
713
+ for (const o of e)
714
+ t.push(he.from(o.substring(1)));
715
+ }
716
+ if (n !== r)
717
+ throw new Error(`Re-constructed path "${n}" does not match input`);
718
+ return {
719
+ parts: e,
720
+ path: t
721
+ };
722
+ }
723
+ const kt = /^(\w+( \w+)*)((\/\/?[^/]+)*)(\/\/\/(.*))?$/;
724
+ function an(r) {
725
+ const e = r.match(kt);
726
+ if (e === null)
727
+ throw new Error("Unable to match provided value to a secret URI");
728
+ const [, t, , n, , , o] = e;
729
+ if (!t)
730
+ throw new Error("Unable to extract phrase from provided value");
731
+ const { path: a } = vt(n || "");
732
+ return {
733
+ derivePath: n || "",
734
+ password: o,
735
+ path: a,
736
+ phrase: t
737
+ };
738
+ }
739
+ const Ge = BigInt(0), Ze = BigInt(3);
740
+ function Q(r) {
741
+ if (typeof r == "string")
742
+ return ie(r);
743
+ if (Ie(r))
744
+ return r;
745
+ throw new Error("Wrong data");
746
+ }
747
+ function f(r, e, ...t) {
748
+ if (!Ie(e))
749
+ throw new Error(`${r}: Uint8Array expected`);
750
+ if (t.length && !t.includes(e.length))
751
+ throw new Error(`${r}: Uint8Array expected of length ${t}, not of length=${e.length}`);
752
+ }
753
+ function M(r, e) {
754
+ if (!Number.isSafeInteger(e) || e < 0 || e > 4294967295)
755
+ throw new Error(`${r}: wrong u32 integer: ${e}`);
756
+ return e;
757
+ }
758
+ function U(...r) {
759
+ for (const e of r)
760
+ e.fill(0);
761
+ }
762
+ const E = Uint8Array.of(), fe = Br.CURVE.n;
763
+ function xe(r, e) {
764
+ f(r, e, 32);
765
+ const t = A(e);
766
+ return Ne(r, t, Ge, fe), t;
767
+ }
768
+ const P = (r) => Sr(r, fe), R = 166, y = {
769
+ I: 1,
770
+ A: 2,
771
+ C: 4,
772
+ T: 8,
773
+ M: 16,
774
+ K: 32
775
+ };
776
+ class pe {
777
+ constructor(e) {
778
+ this.state = new Uint8Array(200), this.pos = 0, this.posBegin = 0, this.curFlags = 0, this.state.set([1, R + 2, 1, 0, 1, 96], 0), this.state.set(ie("STROBEv1.0.2"), 6), this.state32 = _r(this.state), this.keccakF1600(), this.metaAD(e, !1);
779
+ }
780
+ keccakF1600() {
781
+ Rr(this.state32);
782
+ }
783
+ runF() {
784
+ this.state[this.pos] ^= this.posBegin, this.state[this.pos + 1] ^= 4, this.state[R + 1] ^= 128, this.keccakF1600(), this.pos = 0, this.posBegin = 0;
785
+ }
786
+ // keccak.update()
787
+ absorb(e) {
788
+ for (let t = 0; t < e.length; t++)
789
+ this.state[this.pos++] ^= e[t], this.pos === R && this.runF();
790
+ }
791
+ // keccak.xof()
792
+ squeeze(e) {
793
+ const t = new Uint8Array(e);
794
+ for (let n = 0; n < t.length; n++)
795
+ t[n] = this.state[this.pos], this.state[this.pos++] = 0, this.pos === R && this.runF();
796
+ return t;
797
+ }
798
+ overwrite(e) {
799
+ for (let t = 0; t < e.length; t++)
800
+ this.state[this.pos++] = e[t], this.pos === R && this.runF();
801
+ }
802
+ beginOp(e, t) {
803
+ if (t) {
804
+ if (this.curFlags !== e)
805
+ throw new Error(`Continued op with changed flags from ${this.curFlags.toString(2)} to ${e.toString(2)}`);
806
+ return;
807
+ }
808
+ if ((e & y.T) !== 0)
809
+ throw new Error("T flag is not supported");
810
+ const n = this.posBegin;
811
+ this.posBegin = this.pos + 1, this.curFlags = e, this.absorb(new Uint8Array([n, e])), (e & (y.C | y.K)) !== 0 && this.pos !== 0 && this.runF();
812
+ }
813
+ // Public API
814
+ metaAD(e, t) {
815
+ this.beginOp(y.M | y.A, t), this.absorb(Q(e));
816
+ }
817
+ AD(e, t) {
818
+ this.beginOp(y.A, t), this.absorb(Q(e));
819
+ }
820
+ PRF(e, t) {
821
+ return this.beginOp(y.I | y.A | y.C, t), this.squeeze(e);
822
+ }
823
+ KEY(e, t) {
824
+ this.beginOp(y.A | y.C, t), this.overwrite(Q(e));
825
+ }
826
+ // Utils
827
+ clone() {
828
+ const e = new pe("0");
829
+ return e.pos = this.pos, e.posBegin = this.posBegin, e.state.set(this.state), e.curFlags = this.curFlags, e;
830
+ }
831
+ clean() {
832
+ this.state.fill(0), this.pos = 0, this.curFlags = 0, this.posBegin = 0;
833
+ }
834
+ }
835
+ class Et {
836
+ constructor(e) {
837
+ this.strobe = new pe("Merlin v1.0"), this.appendMessage("dom-sep", e);
838
+ }
839
+ appendMessage(e, t) {
840
+ this.strobe.metaAD(e, !1), M("Merlin.appendMessage", t.length), this.strobe.metaAD(m(t.length, 4), !0), this.strobe.AD(t, !1);
841
+ }
842
+ challengeBytes(e, t) {
843
+ return this.strobe.metaAD(e, !1), M("Merlin.challengeBytes", t), this.strobe.metaAD(m(t, 4), !0), this.strobe.PRF(t, !1);
844
+ }
845
+ clean() {
846
+ this.strobe.clean();
847
+ }
848
+ }
849
+ class S extends Et {
850
+ constructor(e, t = x) {
851
+ super(e), this.rng = t;
852
+ }
853
+ label(e) {
854
+ this.appendMessage("", e);
855
+ }
856
+ bytes(e) {
857
+ return this.appendMessage("sign-bytes", e), this;
858
+ }
859
+ protoName(e) {
860
+ this.appendMessage("proto-name", e);
861
+ }
862
+ commitPoint(e, t) {
863
+ this.appendMessage(e, t.toRawBytes());
864
+ }
865
+ challengeScalar(e) {
866
+ return P(A(this.challengeBytes(e, 64)));
867
+ }
868
+ witnessScalar(e, t = []) {
869
+ return P(A(this.witnessBytes(e, 64, t)));
870
+ }
871
+ witnessBytes(e, t, n = []) {
872
+ M("SigningContext.witnessBytes", t);
873
+ const o = this.strobe.clone();
874
+ for (const s of n)
875
+ o.metaAD(e, !1), M("SigningContext.witnessBytes nonce length", s.length), o.metaAD(m(s.length, 4), !0), o.KEY(s, !1);
876
+ const a = this.rng(32);
877
+ return o.metaAD("rng", !1), o.KEY(a, !1), o.metaAD(m(t, 4), !1), o.PRF(t, !1);
878
+ }
879
+ }
880
+ const xt = $r(256), Xe = (r) => m(r << Ze & xt, 32), B = (r) => A(r) >> Ze;
881
+ function K(r) {
882
+ f("secretKey", r, 64);
883
+ const e = B(r.subarray(0, 32));
884
+ return g.BASE.multiply(e).toRawBytes();
885
+ }
886
+ function Qe(r) {
887
+ f("seed", r, 32);
888
+ const e = Ur(r);
889
+ e[0] &= 248, e[31] &= 63, e[31] |= 64;
890
+ const t = Xe(B(e.subarray(0, 32))), n = e.subarray(32, 64), o = I(t, n);
891
+ return U(t, n, e), o;
892
+ }
893
+ const er = ie("substrate");
894
+ function At(r, e, t = x) {
895
+ f("message", e), f("secretKey", r, 64);
896
+ const n = new S("SigningContext", t);
897
+ n.label(er), n.bytes(e);
898
+ const o = B(r.subarray(0, 32)), a = r.subarray(32, 64), s = g.fromHex(K(r));
899
+ n.protoName("Schnorr-sig"), n.commitPoint("sign:pk", s);
900
+ const i = n.witnessScalar("signing", [a]), l = g.BASE.multiply(i);
901
+ n.commitPoint("sign:R", l);
902
+ const c = n.challengeScalar("sign:c"), u = P(c * o + i), d = I(l.toRawBytes(), m(u, 32));
903
+ return d[63] |= 128, n.clean(), d;
904
+ }
905
+ function Ut(r, e, t) {
906
+ if (f("message", r), f("signature", e, 64), f("publicKey", t, 32), (e[63] & 128) === 0)
907
+ throw new Error("Schnorrkel marker missing");
908
+ const n = Uint8Array.from(e.subarray(32, 64));
909
+ n[31] &= 127;
910
+ const o = g.fromHex(e.subarray(0, 32)), a = A(n);
911
+ Ne("s", a, Ge, fe);
912
+ const s = new S("SigningContext");
913
+ s.label(er), s.bytes(r);
914
+ const i = g.fromHex(t);
915
+ if (i.equals(g.ZERO))
916
+ return !1;
917
+ s.protoName("Schnorr-sig"), s.commitPoint("sign:pk", i), s.commitPoint("sign:R", o);
918
+ const l = s.challengeScalar("sign:c"), c = g.BASE.multiply(a), u = i.negate().multiply(l).add(c);
919
+ return s.clean(), U(n), u.equals(o);
920
+ }
921
+ const rr = {
922
+ secretSoft(r, e, t = x) {
923
+ f("secretKey", r, 64), f("chainCode", e, 32);
924
+ const n = B(r.subarray(0, 32)), o = r.subarray(32, 64), a = g.fromHex(K(r)), s = new S("SchnorrRistrettoHDKD", t);
925
+ s.bytes(E), s.appendMessage("chain-code", e), s.commitPoint("public-key", a);
926
+ const i = s.challengeScalar("HDKD-scalar"), l = s.challengeBytes("HDKD-chaincode", 32), c = I(m(n, 32), o), u = s.witnessBytes("HDKD-nonce", 32, [o, c]), d = Xe(P(n + i)), p = I(d, u);
927
+ return U(d, u, c, l), s.clean(), p;
928
+ },
929
+ secretHard(r, e) {
930
+ f("secretKey", r, 64), f("chainCode", e, 32);
931
+ const t = m(B(r.subarray(0, 32)), 32), n = new S("SchnorrRistrettoHDKD");
932
+ n.bytes(E), n.appendMessage("chain-code", e), n.appendMessage("secret-key", t);
933
+ const o = n.challengeBytes("HDKD-hard", 32), a = n.challengeBytes("HDKD-chaincode", 32);
934
+ n.clean();
935
+ const s = Qe(o);
936
+ return U(t, o, a), n.clean(), s;
937
+ }
938
+ }, Ae = {
939
+ proove(r, e, t, n, o, a) {
940
+ n.protoName("DLEQProof"), n.commitPoint("vrf:h", o);
941
+ const s = n.witnessScalar("proving\x000", [e]), i = g.BASE.multiply(s);
942
+ n.commitPoint("vrf:R=g^r", i);
943
+ const l = o.multiply(s);
944
+ n.commitPoint("vrf:h^r", l), n.commitPoint("vrf:pk", t), n.commitPoint("vrf:h^sk", a);
945
+ const c = n.challengeScalar("prove"), u = P(s - c * r);
946
+ return { proof: { c, s: u }, proofBatchable: { R: i, Hr: l, s: u } };
947
+ },
948
+ verify(r, e, t, n, o) {
949
+ if (r.equals(g.ZERO))
950
+ return !1;
951
+ e.protoName("DLEQProof"), e.commitPoint("vrf:h", t);
952
+ const a = r.multiply(o.c).add(g.BASE.multiply(o.s));
953
+ e.commitPoint("vrf:R=g^r", a);
954
+ const s = n.multiply(o.c).add(t.multiply(o.s));
955
+ e.commitPoint("vrf:h^r", s), e.commitPoint("vrf:pk", r), e.commitPoint("vrf:h^sk", n);
956
+ const i = e.challengeScalar("prove");
957
+ return o.c === i ? { R: a, Hr: s, s: o.s } : !1;
958
+ }
959
+ };
960
+ function Ue(r, e, t, n, o = x) {
961
+ const a = new S("SigningContext", o);
962
+ a.label(r), a.bytes(e), a.commitPoint("vrf-nm-pk", n);
963
+ const s = a.challengeBytes("VRFHash", 64), i = g.hashToCurve(s), l = new S("VRF", o);
964
+ return t.length && l.label(t), a.clean(), U(s), { input: i, t: l };
965
+ }
966
+ const tr = {
967
+ sign(r, e, t = E, n = E, o = x) {
968
+ f("msg", r), f("secretKey", e, 64), f("ctx", t), f("extra", n);
969
+ const a = B(e.subarray(0, 32)), s = e.subarray(32, 64), i = g.fromHex(K(e)), { input: l, t: c } = Ue(t, r, n, i, o), u = l.multiply(a), d = { output: u }, { proof: p } = Ae.proove(a, s, i, c, l, u), b = m(p.c, 32), w = m(p.s, 32), dr = I(d.output.toRawBytes(), b, w);
970
+ return U(s, b, w), dr;
971
+ },
972
+ verify(r, e, t, n = E, o = E, a = x) {
973
+ f("msg", r), f("signature", e, 96), f("pubkey", t, 32), f("ctx", n), f("extra", o);
974
+ const s = g.fromHex(t);
975
+ if (s.equals(g.ZERO))
976
+ return !1;
977
+ const i = {
978
+ c: xe("signature.c", e.subarray(32, 64)),
979
+ s: xe("signature.s", e.subarray(64, 96))
980
+ }, { input: l, t: c } = Ue(n, r, o, s, a), u = g.fromHex(e.subarray(0, 32));
981
+ if (u.equals(g.ZERO))
982
+ throw new Error("vrf.verify: wrong output point (identity)");
983
+ return Ae.verify(s, c, l, u, i) !== !1;
984
+ }
985
+ }, se = 64, St = 32, ee = se + St;
986
+ function Bt(r) {
987
+ const e = h(r);
988
+ if (e.length !== ee)
989
+ throw new Error(`Expected keypair with ${ee} bytes, found ${e.length}`);
990
+ return {
991
+ publicKey: e.slice(se, ee),
992
+ secretKey: e.slice(0, se)
993
+ };
994
+ }
995
+ function nr(r) {
996
+ return (e, t) => {
997
+ if (!$e(t) || t.length !== 32)
998
+ throw new Error("Invalid chainCode passed to derive");
999
+ const n = r(e.secretKey, t), o = K(n);
1000
+ return Bt(D(n, o));
1001
+ };
1002
+ }
1003
+ const _t = nr(rr.secretHard), Rt = nr(rr.secretSoft);
1004
+ function $t(r, { chainCode: e, isSoft: t }) {
1005
+ return t ? Rt(r, e) : _t(r, e);
1006
+ }
1007
+ const Se = {
1008
+ sr25519: $t,
1009
+ ecdsa: () => {
1010
+ throw new Error("ECDSA key derivation not implemented yet");
1011
+ },
1012
+ ed25519: () => {
1013
+ throw new Error("ED25519 key derivation not implemented yet");
1014
+ },
1015
+ ethereum: () => {
1016
+ throw new Error("Ethereum key derivation not implemented yet");
1017
+ }
1018
+ };
1019
+ function sn(r, e, t) {
1020
+ if (!t)
1021
+ throw new Error("Invalid type provided");
1022
+ if (!Se[t])
1023
+ throw new Error(`Unsupported keypair type: ${t}`);
1024
+ const n = Se[t];
1025
+ let o = r;
1026
+ for (const a of e)
1027
+ o = n(o, a);
1028
+ return o;
1029
+ }
1030
+ function Dt(r, e = V(), t = 2048, n) {
1031
+ const o = h(r), a = h(e);
1032
+ return {
1033
+ password: Dr(Ir, o, a, { c: t, dkLen: 64 }),
1034
+ rounds: t,
1035
+ salt: e
1036
+ };
1037
+ }
1038
+ const It = { 256: Nr }, Nt = It[256], or = "abandon|ability|able|about|above|absent|absorb|abstract|absurd|abuse|access|accident|account|accuse|achieve|acid|acoustic|acquire|across|act|action|actor|actress|actual|adapt|add|addict|address|adjust|admit|adult|advance|advice|aerobic|affair|afford|afraid|again|age|agent|agree|ahead|aim|air|airport|aisle|alarm|album|alcohol|alert|alien|all|alley|allow|almost|alone|alpha|already|also|alter|always|amateur|amazing|among|amount|amused|analyst|anchor|ancient|anger|angle|angry|animal|ankle|announce|annual|another|answer|antenna|antique|anxiety|any|apart|apology|appear|apple|approve|april|arch|arctic|area|arena|argue|arm|armed|armor|army|around|arrange|arrest|arrive|arrow|art|artefact|artist|artwork|ask|aspect|assault|asset|assist|assume|asthma|athlete|atom|attack|attend|attitude|attract|auction|audit|august|aunt|author|auto|autumn|average|avocado|avoid|awake|aware|away|awesome|awful|awkward|axis|baby|bachelor|bacon|badge|bag|balance|balcony|ball|bamboo|banana|banner|bar|barely|bargain|barrel|base|basic|basket|battle|beach|bean|beauty|because|become|beef|before|begin|behave|behind|believe|below|belt|bench|benefit|best|betray|better|between|beyond|bicycle|bid|bike|bind|biology|bird|birth|bitter|black|blade|blame|blanket|blast|bleak|bless|blind|blood|blossom|blouse|blue|blur|blush|board|boat|body|boil|bomb|bone|bonus|book|boost|border|boring|borrow|boss|bottom|bounce|box|boy|bracket|brain|brand|brass|brave|bread|breeze|brick|bridge|brief|bright|bring|brisk|broccoli|broken|bronze|broom|brother|brown|brush|bubble|buddy|budget|buffalo|build|bulb|bulk|bullet|bundle|bunker|burden|burger|burst|bus|business|busy|butter|buyer|buzz|cabbage|cabin|cable|cactus|cage|cake|call|calm|camera|camp|can|canal|cancel|candy|cannon|canoe|canvas|canyon|capable|capital|captain|car|carbon|card|cargo|carpet|carry|cart|case|cash|casino|castle|casual|cat|catalog|catch|category|cattle|caught|cause|caution|cave|ceiling|celery|cement|census|century|cereal|certain|chair|chalk|champion|change|chaos|chapter|charge|chase|chat|cheap|check|cheese|chef|cherry|chest|chicken|chief|child|chimney|choice|choose|chronic|chuckle|chunk|churn|cigar|cinnamon|circle|citizen|city|civil|claim|clap|clarify|claw|clay|clean|clerk|clever|click|client|cliff|climb|clinic|clip|clock|clog|close|cloth|cloud|clown|club|clump|cluster|clutch|coach|coast|coconut|code|coffee|coil|coin|collect|color|column|combine|come|comfort|comic|common|company|concert|conduct|confirm|congress|connect|consider|control|convince|cook|cool|copper|copy|coral|core|corn|correct|cost|cotton|couch|country|couple|course|cousin|cover|coyote|crack|cradle|craft|cram|crane|crash|crater|crawl|crazy|cream|credit|creek|crew|cricket|crime|crisp|critic|crop|cross|crouch|crowd|crucial|cruel|cruise|crumble|crunch|crush|cry|crystal|cube|culture|cup|cupboard|curious|current|curtain|curve|cushion|custom|cute|cycle|dad|damage|damp|dance|danger|daring|dash|daughter|dawn|day|deal|debate|debris|decade|december|decide|decline|decorate|decrease|deer|defense|define|defy|degree|delay|deliver|demand|demise|denial|dentist|deny|depart|depend|deposit|depth|deputy|derive|describe|desert|design|desk|despair|destroy|detail|detect|develop|device|devote|diagram|dial|diamond|diary|dice|diesel|diet|differ|digital|dignity|dilemma|dinner|dinosaur|direct|dirt|disagree|discover|disease|dish|dismiss|disorder|display|distance|divert|divide|divorce|dizzy|doctor|document|dog|doll|dolphin|domain|donate|donkey|donor|door|dose|double|dove|draft|dragon|drama|drastic|draw|dream|dress|drift|drill|drink|drip|drive|drop|drum|dry|duck|dumb|dune|during|dust|dutch|duty|dwarf|dynamic|eager|eagle|early|earn|earth|easily|east|easy|echo|ecology|economy|edge|edit|educate|effort|egg|eight|either|elbow|elder|electric|elegant|element|elephant|elevator|elite|else|embark|embody|embrace|emerge|emotion|employ|empower|empty|enable|enact|end|endless|endorse|enemy|energy|enforce|engage|engine|enhance|enjoy|enlist|enough|enrich|enroll|ensure|enter|entire|entry|envelope|episode|equal|equip|era|erase|erode|erosion|error|erupt|escape|essay|essence|estate|eternal|ethics|evidence|evil|evoke|evolve|exact|example|excess|exchange|excite|exclude|excuse|execute|exercise|exhaust|exhibit|exile|exist|exit|exotic|expand|expect|expire|explain|expose|express|extend|extra|eye|eyebrow|fabric|face|faculty|fade|faint|faith|fall|false|fame|family|famous|fan|fancy|fantasy|farm|fashion|fat|fatal|father|fatigue|fault|favorite|feature|february|federal|fee|feed|feel|female|fence|festival|fetch|fever|few|fiber|fiction|field|figure|file|film|filter|final|find|fine|finger|finish|fire|firm|first|fiscal|fish|fit|fitness|fix|flag|flame|flash|flat|flavor|flee|flight|flip|float|flock|floor|flower|fluid|flush|fly|foam|focus|fog|foil|fold|follow|food|foot|force|forest|forget|fork|fortune|forum|forward|fossil|foster|found|fox|fragile|frame|frequent|fresh|friend|fringe|frog|front|frost|frown|frozen|fruit|fuel|fun|funny|furnace|fury|future|gadget|gain|galaxy|gallery|game|gap|garage|garbage|garden|garlic|garment|gas|gasp|gate|gather|gauge|gaze|general|genius|genre|gentle|genuine|gesture|ghost|giant|gift|giggle|ginger|giraffe|girl|give|glad|glance|glare|glass|glide|glimpse|globe|gloom|glory|glove|glow|glue|goat|goddess|gold|good|goose|gorilla|gospel|gossip|govern|gown|grab|grace|grain|grant|grape|grass|gravity|great|green|grid|grief|grit|grocery|group|grow|grunt|guard|guess|guide|guilt|guitar|gun|gym|habit|hair|half|hammer|hamster|hand|happy|harbor|hard|harsh|harvest|hat|have|hawk|hazard|head|health|heart|heavy|hedgehog|height|hello|helmet|help|hen|hero|hidden|high|hill|hint|hip|hire|history|hobby|hockey|hold|hole|holiday|hollow|home|honey|hood|hope|horn|horror|horse|hospital|host|hotel|hour|hover|hub|huge|human|humble|humor|hundred|hungry|hunt|hurdle|hurry|hurt|husband|hybrid|ice|icon|idea|identify|idle|ignore|ill|illegal|illness|image|imitate|immense|immune|impact|impose|improve|impulse|inch|include|income|increase|index|indicate|indoor|industry|infant|inflict|inform|inhale|inherit|initial|inject|injury|inmate|inner|innocent|input|inquiry|insane|insect|inside|inspire|install|intact|interest|into|invest|invite|involve|iron|island|isolate|issue|item|ivory|jacket|jaguar|jar|jazz|jealous|jeans|jelly|jewel|job|join|joke|journey|joy|judge|juice|jump|jungle|junior|junk|just|kangaroo|keen|keep|ketchup|key|kick|kid|kidney|kind|kingdom|kiss|kit|kitchen|kite|kitten|kiwi|knee|knife|knock|know|lab|label|labor|ladder|lady|lake|lamp|language|laptop|large|later|latin|laugh|laundry|lava|law|lawn|lawsuit|layer|lazy|leader|leaf|learn|leave|lecture|left|leg|legal|legend|leisure|lemon|lend|length|lens|leopard|lesson|letter|level|liar|liberty|library|license|life|lift|light|like|limb|limit|link|lion|liquid|list|little|live|lizard|load|loan|lobster|local|lock|logic|lonely|long|loop|lottery|loud|lounge|love|loyal|lucky|luggage|lumber|lunar|lunch|luxury|lyrics|machine|mad|magic|magnet|maid|mail|main|major|make|mammal|man|manage|mandate|mango|mansion|manual|maple|marble|march|margin|marine|market|marriage|mask|mass|master|match|material|math|matrix|matter|maximum|maze|meadow|mean|measure|meat|mechanic|medal|media|melody|melt|member|memory|mention|menu|mercy|merge|merit|merry|mesh|message|metal|method|middle|midnight|milk|million|mimic|mind|minimum|minor|minute|miracle|mirror|misery|miss|mistake|mix|mixed|mixture|mobile|model|modify|mom|moment|monitor|monkey|monster|month|moon|moral|more|morning|mosquito|mother|motion|motor|mountain|mouse|move|movie|much|muffin|mule|multiply|muscle|museum|mushroom|music|must|mutual|myself|mystery|myth|naive|name|napkin|narrow|nasty|nation|nature|near|neck|need|negative|neglect|neither|nephew|nerve|nest|net|network|neutral|never|news|next|nice|night|noble|noise|nominee|noodle|normal|north|nose|notable|note|nothing|notice|novel|now|nuclear|number|nurse|nut|oak|obey|object|oblige|obscure|observe|obtain|obvious|occur|ocean|october|odor|off|offer|office|often|oil|okay|old|olive|olympic|omit|once|one|onion|online|only|open|opera|opinion|oppose|option|orange|orbit|orchard|order|ordinary|organ|orient|original|orphan|ostrich|other|outdoor|outer|output|outside|oval|oven|over|own|owner|oxygen|oyster|ozone|pact|paddle|page|pair|palace|palm|panda|panel|panic|panther|paper|parade|parent|park|parrot|party|pass|patch|path|patient|patrol|pattern|pause|pave|payment|peace|peanut|pear|peasant|pelican|pen|penalty|pencil|people|pepper|perfect|permit|person|pet|phone|photo|phrase|physical|piano|picnic|picture|piece|pig|pigeon|pill|pilot|pink|pioneer|pipe|pistol|pitch|pizza|place|planet|plastic|plate|play|please|pledge|pluck|plug|plunge|poem|poet|point|polar|pole|police|pond|pony|pool|popular|portion|position|possible|post|potato|pottery|poverty|powder|power|practice|praise|predict|prefer|prepare|present|pretty|prevent|price|pride|primary|print|priority|prison|private|prize|problem|process|produce|profit|program|project|promote|proof|property|prosper|protect|proud|provide|public|pudding|pull|pulp|pulse|pumpkin|punch|pupil|puppy|purchase|purity|purpose|purse|push|put|puzzle|pyramid|quality|quantum|quarter|question|quick|quit|quiz|quote|rabbit|raccoon|race|rack|radar|radio|rail|rain|raise|rally|ramp|ranch|random|range|rapid|rare|rate|rather|raven|raw|razor|ready|real|reason|rebel|rebuild|recall|receive|recipe|record|recycle|reduce|reflect|reform|refuse|region|regret|regular|reject|relax|release|relief|rely|remain|remember|remind|remove|render|renew|rent|reopen|repair|repeat|replace|report|require|rescue|resemble|resist|resource|response|result|retire|retreat|return|reunion|reveal|review|reward|rhythm|rib|ribbon|rice|rich|ride|ridge|rifle|right|rigid|ring|riot|ripple|risk|ritual|rival|river|road|roast|robot|robust|rocket|romance|roof|rookie|room|rose|rotate|rough|round|route|royal|rubber|rude|rug|rule|run|runway|rural|sad|saddle|sadness|safe|sail|salad|salmon|salon|salt|salute|same|sample|sand|satisfy|satoshi|sauce|sausage|save|say|scale|scan|scare|scatter|scene|scheme|school|science|scissors|scorpion|scout|scrap|screen|script|scrub|sea|search|season|seat|second|secret|section|security|seed|seek|segment|select|sell|seminar|senior|sense|sentence|series|service|session|settle|setup|seven|shadow|shaft|shallow|share|shed|shell|sheriff|shield|shift|shine|ship|shiver|shock|shoe|shoot|shop|short|shoulder|shove|shrimp|shrug|shuffle|shy|sibling|sick|side|siege|sight|sign|silent|silk|silly|silver|similar|simple|since|sing|siren|sister|situate|six|size|skate|sketch|ski|skill|skin|skirt|skull|slab|slam|sleep|slender|slice|slide|slight|slim|slogan|slot|slow|slush|small|smart|smile|smoke|smooth|snack|snake|snap|sniff|snow|soap|soccer|social|sock|soda|soft|solar|soldier|solid|solution|solve|someone|song|soon|sorry|sort|soul|sound|soup|source|south|space|spare|spatial|spawn|speak|special|speed|spell|spend|sphere|spice|spider|spike|spin|spirit|split|spoil|sponsor|spoon|sport|spot|spray|spread|spring|spy|square|squeeze|squirrel|stable|stadium|staff|stage|stairs|stamp|stand|start|state|stay|steak|steel|stem|step|stereo|stick|still|sting|stock|stomach|stone|stool|story|stove|strategy|street|strike|strong|struggle|student|stuff|stumble|style|subject|submit|subway|success|such|sudden|suffer|sugar|suggest|suit|summer|sun|sunny|sunset|super|supply|supreme|sure|surface|surge|surprise|surround|survey|suspect|sustain|swallow|swamp|swap|swarm|swear|sweet|swift|swim|swing|switch|sword|symbol|symptom|syrup|system|table|tackle|tag|tail|talent|talk|tank|tape|target|task|taste|tattoo|taxi|teach|team|tell|ten|tenant|tennis|tent|term|test|text|thank|that|theme|then|theory|there|they|thing|this|thought|three|thrive|throw|thumb|thunder|ticket|tide|tiger|tilt|timber|time|tiny|tip|tired|tissue|title|toast|tobacco|today|toddler|toe|together|toilet|token|tomato|tomorrow|tone|tongue|tonight|tool|tooth|top|topic|topple|torch|tornado|tortoise|toss|total|tourist|toward|tower|town|toy|track|trade|traffic|tragic|train|transfer|trap|trash|travel|tray|treat|tree|trend|trial|tribe|trick|trigger|trim|trip|trophy|trouble|truck|true|truly|trumpet|trust|truth|try|tube|tuition|tumble|tuna|tunnel|turkey|turn|turtle|twelve|twenty|twice|twin|twist|two|type|typical|ugly|umbrella|unable|unaware|uncle|uncover|under|undo|unfair|unfold|unhappy|uniform|unique|unit|universe|unknown|unlock|until|unusual|unveil|update|upgrade|uphold|upon|upper|upset|urban|urge|usage|use|used|useful|useless|usual|utility|vacant|vacuum|vague|valid|valley|valve|van|vanish|vapor|various|vast|vault|vehicle|velvet|vendor|venture|venue|verb|verify|version|very|vessel|veteran|viable|vibrant|vicious|victory|video|view|village|vintage|violin|virtual|virus|visa|visit|visual|vital|vivid|vocal|voice|void|volcano|volume|vote|voyage|wage|wagon|wait|walk|wall|walnut|want|warfare|warm|warrior|wash|wasp|waste|water|wave|way|wealth|weapon|wear|weasel|weather|web|wedding|weekend|weird|welcome|west|wet|whale|what|wheat|wheel|when|where|whip|whisper|wide|width|wife|wild|will|win|window|wine|wing|wink|winner|winter|wire|wisdom|wise|wish|witness|wolf|woman|wonder|wood|wool|word|work|world|worry|worth|wrap|wreck|wrestle|wrist|write|wrong|yard|year|yellow|you|young|youth|zebra|zero|zone|zoo".split("|"), Be = "Invalid mnemonic", ar = "Invalid entropy", Pt = "Invalid mnemonic checksum";
1039
+ function Tt(r) {
1040
+ return (r || "").normalize("NFKD");
1041
+ }
1042
+ function sr(r) {
1043
+ return Number.parseInt(r, 2);
1044
+ }
1045
+ function ir(r) {
1046
+ return r.map((e) => e.toString(2).padStart(8, "0")).join("");
1047
+ }
1048
+ function cr(r) {
1049
+ return ir(Array.from(Nt(r))).slice(0, r.length * 8 / 32);
1050
+ }
1051
+ function ge(r, e = or) {
1052
+ const t = Tt(r).split(" ");
1053
+ if (t.length % 3 !== 0)
1054
+ throw new Error(Be);
1055
+ const n = t.map((u) => {
1056
+ const d = e.indexOf(u);
1057
+ if (d === -1)
1058
+ throw new Error(Be);
1059
+ return d.toString(2).padStart(11, "0");
1060
+ }).join(""), o = Math.floor(n.length / 33) * 32, a = n.slice(0, o), s = n.slice(o), i = a.match(/(.{1,8})/g), l = i == null ? void 0 : i.map(sr);
1061
+ if (!l || l.length % 4 !== 0 || l.length < 16 || l.length > 32)
1062
+ throw new Error(ar);
1063
+ const c = h(l);
1064
+ if (cr(c) !== s)
1065
+ throw new Error(Pt);
1066
+ return c;
1067
+ }
1068
+ function jt(r, e = or) {
1069
+ if (r.length % 4 !== 0 || r.length < 16 || r.length > 32)
1070
+ throw new Error(ar);
1071
+ const t = `${ir(Array.from(r))}${cr(r)}`.match(/(.{1,11})/g), n = t == null ? void 0 : t.map((o) => e[sr(o)]);
1072
+ if (!n || n.length < 12)
1073
+ throw new Error("Unable to map entropy to mnemonic");
1074
+ return n.join(" ");
1075
+ }
1076
+ function lr(r, e) {
1077
+ try {
1078
+ ge(r, e);
1079
+ } catch {
1080
+ return !1;
1081
+ }
1082
+ return !0;
1083
+ }
1084
+ const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1085
+ __proto__: null,
1086
+ entropyToMnemonic: jt,
1087
+ mnemonicToEntropy: ge,
1088
+ validateMnemonic: lr
1089
+ }, Symbol.toStringTag, { value: "Module" }));
1090
+ function zt(r, e, t) {
1091
+ return ge(r, e);
1092
+ }
1093
+ function Ct(r, e) {
1094
+ return lr(r, e);
1095
+ }
1096
+ function ln(r, e = "", t, n) {
1097
+ if (!Ct(r, t))
1098
+ throw new Error("Invalid bip39 mnemonic specified");
1099
+ const o = zt(r, t), a = q(`mnemonic${e}`);
1100
+ return Dt(o, a).password.slice(0, 32);
1101
+ }
1102
+ function un(r, e) {
1103
+ if (![33, 65].includes(r.length))
1104
+ throw new Error(`Invalid publicKey provided, received ${r.length} bytes input`);
1105
+ return r.length === 33 ? r : Pr.ProjectivePoint.fromHex(r).toRawBytes(!0);
1106
+ }
1107
+ function ur(r, e, t) {
1108
+ const n = h(r), o = h(e), a = h(t);
1109
+ if (a.length !== 32)
1110
+ throw new Error("Invalid publicKey length, expected 32 bytes");
1111
+ if (o.length !== 64)
1112
+ throw new Error("Invalid signature length, expected 64 bytes");
1113
+ return Ut(n, o, a);
1114
+ }
1115
+ const Ot = [
1116
+ [
1117
+ "ecdsa",
1118
+ () => {
1119
+ throw new Error("Not Implemented");
1120
+ }
1121
+ ],
1122
+ [
1123
+ "ethereum",
1124
+ () => {
1125
+ throw new Error("Not Implemented");
1126
+ }
1127
+ ]
1128
+ ], Lt = [
1129
+ [
1130
+ "ed25519",
1131
+ () => {
1132
+ throw new Error("Not Implemented");
1133
+ }
1134
+ ],
1135
+ ["sr25519", ur],
1136
+ ...Ot
1137
+ ], Ht = [
1138
+ "ed25519",
1139
+ "sr25519",
1140
+ "ecdsa"
1141
+ ];
1142
+ function Ft(r, { message: e, publicKey: t, signature: n }, o = Lt) {
1143
+ return r.isValid = o.some(([a, s]) => {
1144
+ try {
1145
+ if (s(e, n, t))
1146
+ return r.crypto = a, !0;
1147
+ } catch {
1148
+ }
1149
+ return !1;
1150
+ }), r;
1151
+ }
1152
+ function Mt(r, { message: e, publicKey: t, signature: n }) {
1153
+ const o = n[0];
1154
+ if (o === void 0)
1155
+ throw new Error("Invalid signature, expected first byte to indicate crypto type");
1156
+ if (![0, 1, 2].includes(o))
1157
+ throw new Error(`Unknown crypto type, expected signature prefix [0..2], found ${n[0]}`);
1158
+ const a = Ht[o];
1159
+ if (!a)
1160
+ throw new Error(`Unknown crypto type, found ${o}`);
1161
+ r.crypto = a;
1162
+ try {
1163
+ r.isValid = {
1164
+ sr25519: () => ur(e, n.subarray(1), t),
1165
+ ecdsa: () => !1,
1166
+ ethereum: () => !1,
1167
+ ed25519: () => !1
1168
+ }[a]();
1169
+ } catch {
1170
+ }
1171
+ return r;
1172
+ }
1173
+ function qt(r) {
1174
+ const e = r[0];
1175
+ if (!e)
1176
+ throw new Error("Invalid signature, expected first byte to indicate crypto type");
1177
+ return [0, 1, 2].includes(e) && [65, 66].includes(r.length) ? Mt : Ft;
1178
+ }
1179
+ function dn(r, e, t) {
1180
+ const n = h(e);
1181
+ if (![64, 65, 66].includes(n.length))
1182
+ throw new Error(`Invalid signature length, expected [64..66] bytes, found ${n.length}`);
1183
+ const o = Ve(t), a = {
1184
+ message: h(r),
1185
+ publicKey: o,
1186
+ signature: n
1187
+ }, s = {
1188
+ crypto: "none",
1189
+ isValid: !1,
1190
+ isWrapped: ye(a.message, !0),
1191
+ publicKey: o
1192
+ }, i = ye(a.message, !1), l = qt(n);
1193
+ return l(s, a), s.crypto !== "none" || s.isWrapped && !i ? s : (a.message = i ? Er(a.message) : xr(a.message), l(s, a));
1194
+ }
1195
+ function hn(r) {
1196
+ const e = h(r);
1197
+ if (e.length !== 32)
1198
+ throw new Error(`Expected a seed of 32 bytes, found ${e.length}`);
1199
+ const t = Qe(e), n = A(t.subarray(0, 32)) >> 3n, o = g.BASE.multiply(n).toRawBytes();
1200
+ return {
1201
+ publicKey: new Uint8Array(o),
1202
+ secretKey: new Uint8Array(t)
1203
+ };
1204
+ }
1205
+ function fn(r, { publicKey: e, secretKey: t }) {
1206
+ const n = typeof r == "string" ? new TextEncoder().encode(r) : r, o = h(t);
1207
+ if (o.length !== 64)
1208
+ throw new Error(`Expected secretKey to be 64 bytes, found ${o.length}`);
1209
+ return At(o, n);
1210
+ }
1211
+ const _e = new Uint8Array();
1212
+ function pn(r, { secretKey: e }, t = _e, n = _e) {
1213
+ const o = h(r), a = h(e), s = h(t), i = h(n);
1214
+ if (a.length !== 64)
1215
+ throw new Error("Invalid secretKey length, expected 64 bytes");
1216
+ return tr.sign(o, a, s, i);
1217
+ }
1218
+ const Re = new Uint8Array();
1219
+ function gn(r, e, t, n = Re, o = Re) {
1220
+ const a = h(r), s = h(e), i = h(t), l = h(n), c = h(o);
1221
+ if (i.length !== 32)
1222
+ throw new Error("Invalid publicKey length, expected 32 bytes");
1223
+ if (s.length !== 96)
1224
+ throw new Error("Invalid vrfSign output length, expected 96 bytes");
1225
+ return tr.verify(a, s, i, l, c);
1226
+ }
1227
+ export {
1228
+ cn as A,
1229
+ _,
1230
+ Qt as a,
1231
+ Wt as b,
1232
+ rn as c,
1233
+ gn as d,
1234
+ pn as e,
1235
+ dn as f,
1236
+ un as g,
1237
+ fn as h,
1238
+ sn as i,
1239
+ en as j,
1240
+ vt as k,
1241
+ hn as l,
1242
+ Ve as m,
1243
+ Xt as n,
1244
+ Jt as o,
1245
+ Ee as p,
1246
+ Gt as q,
1247
+ an as r,
1248
+ dt as s,
1249
+ ln as t,
1250
+ ut as u,
1251
+ Zt as v,
1252
+ tn as w,
1253
+ ke as x,
1254
+ nn as y,
1255
+ on as z
1256
+ };