@prosopo/procaptcha-bundle 3.1.6 → 3.2.3

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 (174) hide show
  1. package/CHANGELOG.md +114 -0
  2. package/dist/cjs/index.cjs +10 -1
  3. package/dist/cjs/util/configCreator.cjs +0 -1
  4. package/dist/index.js +10 -1
  5. package/dist/util/configCreator.js +0 -1
  6. package/package.json +16 -16
  7. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/components.d.ts +0 -5
  8. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/components.d.ts.map +0 -1
  9. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/components.js +0 -5
  10. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/components.js.map +0 -1
  11. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts +0 -16
  12. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts.map +0 -1
  13. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js +0 -135
  14. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js.map +0 -1
  15. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.d.ts +0 -2
  16. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.d.ts.map +0 -1
  17. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.js +0 -36
  18. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.js.map +0 -1
  19. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.d.ts +0 -2
  20. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.d.ts.map +0 -1
  21. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.js +0 -69
  22. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.js.map +0 -1
  23. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.d.ts +0 -2
  24. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.d.ts.map +0 -1
  25. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js +0 -136
  26. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js.map +0 -1
  27. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.d.ts +0 -8
  28. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +0 -1
  29. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js +0 -15
  30. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js.map +0 -1
  31. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.d.ts +0 -6
  32. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.d.ts.map +0 -1
  33. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.js +0 -11
  34. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.js.map +0 -1
  35. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.d.ts +0 -10
  36. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.d.ts.map +0 -1
  37. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.js +0 -2
  38. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.js.map +0 -1
  39. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts +0 -24
  40. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts.map +0 -1
  41. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js +0 -49
  42. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js.map +0 -1
  43. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.d.ts +0 -3
  44. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.d.ts.map +0 -1
  45. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.js +0 -8
  46. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.js.map +0 -1
  47. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts +0 -4
  48. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts.map +0 -1
  49. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.js +0 -14
  50. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.js.map +0 -1
  51. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.d.ts +0 -4
  52. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.d.ts.map +0 -1
  53. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.js +0 -9
  54. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.js.map +0 -1
  55. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.d.ts +0 -4
  56. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.d.ts.map +0 -1
  57. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.js +0 -9
  58. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.js.map +0 -1
  59. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/config.d.ts +0 -6
  60. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/config.d.ts.map +0 -1
  61. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/config.js +0 -13
  62. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/config.js.map +0 -1
  63. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.d.ts +0 -5
  64. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.d.ts.map +0 -1
  65. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.js +0 -24
  66. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.js.map +0 -1
  67. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/language.d.ts +0 -3
  68. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/language.d.ts.map +0 -1
  69. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/language.js +0 -17
  70. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/language.js.map +0 -1
  71. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.d.ts +0 -3
  72. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.d.ts.map +0 -1
  73. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.js +0 -9
  74. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.js.map +0 -1
  75. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts +0 -18
  76. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts.map +0 -1
  77. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js +0 -66
  78. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js.map +0 -1
  79. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.d.ts +0 -9
  80. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.d.ts.map +0 -1
  81. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.js +0 -19
  82. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.js.map +0 -1
  83. package/dist/bundle/ProcaptchaWidget-CJ-4hVS1.js +0 -187
  84. package/dist/bundle/ProcaptchaWidget-Cw3s7cGX.js +0 -1014
  85. package/dist/bundle/Signer-DP9drQ55.js +0 -23
  86. package/dist/bundle/bnChunk-DRlDxTFg.js +0 -1137
  87. package/dist/bundle/browser-ponyfill-CvzSbL_o.js +0 -339
  88. package/dist/bundle/builder-ByZ5z580.js +0 -46
  89. package/dist/bundle/captchaComponentProvider-Cn75EmSH.js +0 -1002
  90. package/dist/bundle/captchaRenderer-s4QuLEen.js +0 -71
  91. package/dist/bundle/commonChunk-BjvuHlB1.js +0 -180
  92. package/dist/bundle/components.d.ts +0 -5
  93. package/dist/bundle/components.d.ts.map +0 -1
  94. package/dist/bundle/emotion-element-c39617d8.browser.esm-BNNnmykm.js +0 -916
  95. package/dist/bundle/fp.esm-DYWeNGcH.js +0 -1654
  96. package/dist/bundle/index-BuQg3Zno.js +0 -1884
  97. package/dist/bundle/index-DIdd2cUz.js +0 -5416
  98. package/dist/bundle/index-IgqrmVIs.js +0 -601
  99. package/dist/bundle/index.d.ts +0 -16
  100. package/dist/bundle/index.d.ts.map +0 -1
  101. package/dist/bundle/locales/ar/translation.json +0 -57
  102. package/dist/bundle/locales/az/translation.json +0 -57
  103. package/dist/bundle/locales/cs/translation.json +0 -57
  104. package/dist/bundle/locales/de/translation.json +0 -57
  105. package/dist/bundle/locales/el/translation.json +0 -57
  106. package/dist/bundle/locales/en/translation.json +0 -57
  107. package/dist/bundle/locales/es/translation.json +0 -57
  108. package/dist/bundle/locales/fi/translation.json +0 -57
  109. package/dist/bundle/locales/fr/translation.json +0 -57
  110. package/dist/bundle/locales/hi/translation.json +0 -57
  111. package/dist/bundle/locales/hu/translation.json +0 -57
  112. package/dist/bundle/locales/id/translation.json +0 -57
  113. package/dist/bundle/locales/it/translation.json +0 -57
  114. package/dist/bundle/locales/ja/translation.json +0 -57
  115. package/dist/bundle/locales/jv/translation.json +0 -57
  116. package/dist/bundle/locales/ko/translation.json +0 -57
  117. package/dist/bundle/locales/ml/translation.json +0 -57
  118. package/dist/bundle/locales/ms/translation.json +0 -57
  119. package/dist/bundle/locales/nl/translation.json +0 -57
  120. package/dist/bundle/locales/no/translation.json +0 -57
  121. package/dist/bundle/locales/pl/translation.json +0 -57
  122. package/dist/bundle/locales/pt/translation.json +0 -57
  123. package/dist/bundle/locales/pt-BR/translation.json +0 -57
  124. package/dist/bundle/locales/ro/translation.json +0 -57
  125. package/dist/bundle/locales/ru/translation.json +0 -57
  126. package/dist/bundle/locales/sr/translation.json +0 -57
  127. package/dist/bundle/locales/sv/translation.json +0 -57
  128. package/dist/bundle/locales/th/translation.json +0 -57
  129. package/dist/bundle/locales/tr/translation.json +0 -57
  130. package/dist/bundle/locales/uk/translation.json +0 -57
  131. package/dist/bundle/locales/vi/translation.json +0 -57
  132. package/dist/bundle/locales/zh-CN/translation.json +0 -57
  133. package/dist/bundle/nobleChunk-Bbltwf44.js +0 -2728
  134. package/dist/bundle/procaptcha.bundle.js +0 -8
  135. package/dist/bundle/tests/util/captchaType.test.d.ts +0 -2
  136. package/dist/bundle/tests/util/captchaType.test.d.ts.map +0 -1
  137. package/dist/bundle/tests/util/config.test.d.ts +0 -2
  138. package/dist/bundle/tests/util/config.test.d.ts.map +0 -1
  139. package/dist/bundle/tests/util/renderLogic.test.d.ts +0 -2
  140. package/dist/bundle/tests/util/renderLogic.test.d.ts.map +0 -1
  141. package/dist/bundle/util/captcha/captchaComponentProvider.d.ts +0 -8
  142. package/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +0 -1
  143. package/dist/bundle/util/captcha/captchaComponentsList.d.ts +0 -6
  144. package/dist/bundle/util/captcha/captchaComponentsList.d.ts.map +0 -1
  145. package/dist/bundle/util/captcha/captchaProps.d.ts +0 -10
  146. package/dist/bundle/util/captcha/captchaProps.d.ts.map +0 -1
  147. package/dist/bundle/util/captcha/captchaRenderer.d.ts +0 -24
  148. package/dist/bundle/util/captcha/captchaRenderer.d.ts.map +0 -1
  149. package/dist/bundle/util/captcha/captchaType.d.ts +0 -3
  150. package/dist/bundle/util/captcha/captchaType.d.ts.map +0 -1
  151. package/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts +0 -4
  152. package/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts.map +0 -1
  153. package/dist/bundle/util/captcha/components/imageCaptcha.d.ts +0 -4
  154. package/dist/bundle/util/captcha/components/imageCaptcha.d.ts.map +0 -1
  155. package/dist/bundle/util/captcha/components/powCaptcha.d.ts +0 -4
  156. package/dist/bundle/util/captcha/components/powCaptcha.d.ts.map +0 -1
  157. package/dist/bundle/util/config.d.ts +0 -6
  158. package/dist/bundle/util/config.d.ts.map +0 -1
  159. package/dist/bundle/util/configCreator.d.ts +0 -5
  160. package/dist/bundle/util/configCreator.d.ts.map +0 -1
  161. package/dist/bundle/util/language.d.ts +0 -3
  162. package/dist/bundle/util/language.d.ts.map +0 -1
  163. package/dist/bundle/util/timeout.d.ts +0 -3
  164. package/dist/bundle/util/timeout.d.ts.map +0 -1
  165. package/dist/bundle/util/widgetFactory.d.ts +0 -18
  166. package/dist/bundle/util/widgetFactory.d.ts.map +0 -1
  167. package/dist/bundle/util/widgetThemeResolver.d.ts +0 -9
  168. package/dist/bundle/util/widgetThemeResolver.d.ts.map +0 -1
  169. package/dist/bundle/utilChunk-DPr6oTOj.js +0 -317
  170. package/dist/bundle/utilCryptoChunk-D6ZLkbFV.js +0 -1236
  171. package/dist/bundle/web2Chunk-CNoojUDK.js +0 -3967
  172. package/dist/bundle/web3Chunk-BlYvY4Ea.js +0 -525
  173. package/dist/bundle/zodChunk-aEfPZzrp.js +0 -2882
  174. package/stats.html +0 -4842
@@ -1,1236 +0,0 @@
1
- var Ee = (r) => {
2
- throw TypeError(r);
3
- };
4
- var xe = (r, e, t) => e.has(r) || Ee("Cannot " + t);
5
- var k = (r, e, t) => (xe(r, e, "read from private field"), t ? t.call(r) : e.get(r)), W = (r, e, t) => e.has(r) ? Ee("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), J = (r, e, t, n) => (xe(r, e, "write to private field"), n ? n.call(r, t) : e.set(r, t), t);
6
- import { b as Ae, s as zr, r as U, a as Te, n as y, c as D, R as g, u as he, i as _e, d as S, e as ze, m as Cr, f as Hr, g as Lr, k as Or, h as Fr, p as Mr, j as qr, l as Vr } from "./nobleChunk-Bbltwf44.js";
7
- import { u as h, a as Kr, b as I, s as V, i as Ce, c as He, x as Yr, o as Wr, d as Z, e as C, f as Jr, g as Zr, h as Gr, j as Xr, k as Qr, l as et, m as rt, n as Ue, p as tt, q as nt } from "./utilChunk-DPr6oTOj.js";
8
- import { B as ot } from "./bnChunk-DRlDxTFg.js";
9
- function fe(r) {
10
- return r instanceof Uint8Array || ArrayBuffer.isView(r) && r.constructor.name === "Uint8Array";
11
- }
12
- function st(r, ...e) {
13
- if (!fe(r))
14
- throw new Error("Uint8Array expected");
15
- if (e.length > 0 && !e.includes(r.length))
16
- throw new Error("Uint8Array expected of length " + e + ", got length=" + r.length);
17
- }
18
- function Le(r, e) {
19
- return Array.isArray(e) ? e.length === 0 ? !0 : r ? e.every((t) => typeof t == "string") : e.every((t) => Number.isSafeInteger(t)) : !1;
20
- }
21
- function P(r, e) {
22
- if (typeof e != "string")
23
- throw new Error(`${r}: string expected`);
24
- return !0;
25
- }
26
- function T(r) {
27
- if (!Number.isSafeInteger(r))
28
- throw new Error(`invalid integer: ${r}`);
29
- }
30
- function O(r) {
31
- if (!Array.isArray(r))
32
- throw new Error("array expected");
33
- }
34
- function F(r, e) {
35
- if (!Le(!0, e))
36
- throw new Error(`${r}: array of strings expected`);
37
- }
38
- function Oe(r, e) {
39
- if (!Le(!1, e))
40
- throw new Error(`${r}: array of numbers expected`);
41
- }
42
- // @__NO_SIDE_EFFECTS__
43
- function Fe(...r) {
44
- const e = (s) => s, t = (s, i) => (a) => s(i(a)), n = r.map((s) => s.encode).reduceRight(t, e), o = r.map((s) => s.decode).reduce(t, e);
45
- return { encode: n, decode: o };
46
- }
47
- // @__NO_SIDE_EFFECTS__
48
- function Me(r) {
49
- const e = typeof r == "string" ? r.split("") : r, t = e.length;
50
- F("alphabet", e);
51
- const n = new Map(e.map((o, s) => [o, s]));
52
- return {
53
- encode: (o) => (O(o), o.map((s) => {
54
- if (!Number.isSafeInteger(s) || s < 0 || s >= t)
55
- throw new Error(`alphabet.encode: digit index outside alphabet "${s}". Allowed: ${r}`);
56
- return e[s];
57
- })),
58
- decode: (o) => (O(o), o.map((s) => {
59
- P("alphabet.decode", s);
60
- const i = n.get(s);
61
- if (i === void 0)
62
- throw new Error(`Unknown letter: "${s}". Allowed: ${r}`);
63
- return i;
64
- }))
65
- };
66
- }
67
- // @__NO_SIDE_EFFECTS__
68
- function qe(r = "") {
69
- return P("join", r), {
70
- encode: (e) => (F("join.decode", e), e.join(r)),
71
- decode: (e) => (P("join.decode", e), e.split(r))
72
- };
73
- }
74
- // @__NO_SIDE_EFFECTS__
75
- function at(r, e = "=") {
76
- return T(r), P("padding", e), {
77
- encode(t) {
78
- for (F("padding.encode", t); t.length * r % 8; )
79
- t.push(e);
80
- return t;
81
- },
82
- decode(t) {
83
- F("padding.decode", t);
84
- let n = t.length;
85
- if (n * r % 8)
86
- throw new Error("padding: invalid, string should have whole number of bytes");
87
- for (; n > 0 && t[n - 1] === e; n--)
88
- if ((n - 1) * r % 8 === 0)
89
- throw new Error("padding: invalid, string has too much padding");
90
- return t.slice(0, n);
91
- }
92
- };
93
- }
94
- function Se(r, e, t) {
95
- if (e < 2)
96
- throw new Error(`convertRadix: invalid from=${e}, base cannot be less than 2`);
97
- if (t < 2)
98
- throw new Error(`convertRadix: invalid to=${t}, base cannot be less than 2`);
99
- if (O(r), !r.length)
100
- return [];
101
- let n = 0;
102
- const o = [], s = Array.from(r, (a) => {
103
- if (T(a), a < 0 || a >= e)
104
- throw new Error(`invalid integer: ${a}`);
105
- return a;
106
- }), i = s.length;
107
- for (; ; ) {
108
- let a = 0, l = !0;
109
- for (let c = n; c < i; c++) {
110
- const u = s[c], d = e * a, p = d + u;
111
- if (!Number.isSafeInteger(p) || d / e !== a || p - u !== d)
112
- throw new Error("convertRadix: carry overflow");
113
- const b = p / t;
114
- a = p % t;
115
- const w = Math.floor(b);
116
- if (s[c] = w, !Number.isSafeInteger(w) || w * t + a !== p)
117
- throw new Error("convertRadix: carry overflow");
118
- if (l)
119
- w ? l = !1 : n = c;
120
- else continue;
121
- }
122
- if (o.push(a), l)
123
- break;
124
- }
125
- for (let a = 0; a < r.length - 1 && r[a] === 0; a++)
126
- o.push(0);
127
- return o.reverse();
128
- }
129
- const Ve = (r, e) => e === 0 ? r : Ve(e, r % e), M = /* @__NO_SIDE_EFFECTS__ */ (r, e) => r + (e - Ve(r, e)), G = /* @__PURE__ */ (() => {
130
- let r = [];
131
- for (let e = 0; e < 40; e++)
132
- r.push(2 ** e);
133
- return r;
134
- })();
135
- function Be(r, e, t, n) {
136
- if (O(r), e <= 0 || e > 32)
137
- throw new Error(`convertRadix2: wrong from=${e}`);
138
- if (t <= 0 || t > 32)
139
- throw new Error(`convertRadix2: wrong to=${t}`);
140
- if (/* @__PURE__ */ M(e, t) > 32)
141
- throw new Error(`convertRadix2: carry overflow from=${e} to=${t} carryBits=${/* @__PURE__ */ M(e, t)}`);
142
- let o = 0, s = 0;
143
- const i = G[e], a = G[t] - 1, l = [];
144
- for (const c of r) {
145
- if (T(c), c >= i)
146
- throw new Error(`convertRadix2: invalid data word=${c} from=${e}`);
147
- if (o = o << e | c, s + e > 32)
148
- throw new Error(`convertRadix2: carry overflow pos=${s} from=${e}`);
149
- for (s += e; s >= t; s -= t)
150
- l.push((o >> s - t & a) >>> 0);
151
- const u = G[s];
152
- if (u === void 0)
153
- throw new Error("invalid carry");
154
- o &= u - 1;
155
- }
156
- if (o = o << t - s & a, !n && s >= e)
157
- throw new Error("Excess padding");
158
- if (!n && o > 0)
159
- throw new Error(`Non-zero padding: ${o}`);
160
- return n && s > 0 && l.push(o >>> 0), l;
161
- }
162
- // @__NO_SIDE_EFFECTS__
163
- function it(r) {
164
- T(r);
165
- const e = 2 ** 8;
166
- return {
167
- encode: (t) => {
168
- if (!fe(t))
169
- throw new Error("radix.encode input should be Uint8Array");
170
- return Se(Array.from(t), e, r);
171
- },
172
- decode: (t) => (Oe("radix.decode", t), Uint8Array.from(Se(t, r, e)))
173
- };
174
- }
175
- // @__NO_SIDE_EFFECTS__
176
- function ct(r, e = !1) {
177
- if (T(r), r <= 0 || r > 32)
178
- throw new Error("radix2: bits should be in (0..32]");
179
- if (/* @__PURE__ */ M(8, r) > 32 || /* @__PURE__ */ M(r, 8) > 32)
180
- throw new Error("radix2: carry overflow");
181
- return {
182
- encode: (t) => {
183
- if (!fe(t))
184
- throw new Error("radix2.encode input should be Uint8Array");
185
- return Be(Array.from(t), 8, r, !e);
186
- },
187
- decode: (t) => (Oe("radix2.decode", t), Uint8Array.from(Be(t, r, 8, e)))
188
- };
189
- }
190
- const lt = typeof Uint8Array.from([]).toBase64 == "function" && typeof Uint8Array.fromBase64 == "function", ut = (r, e) => {
191
- P("base64", r);
192
- const t = /^[A-Za-z0-9=+/]+$/, n = "base64";
193
- if (r.length > 0 && !t.test(r))
194
- throw new Error("invalid base64");
195
- return Uint8Array.fromBase64(r, { alphabet: n, lastChunkHandling: "strict" });
196
- }, dt = lt ? {
197
- encode(r) {
198
- return st(r), r.toBase64();
199
- },
200
- decode(r) {
201
- return ut(r);
202
- }
203
- } : /* @__PURE__ */ Fe(/* @__PURE__ */ ct(6), /* @__PURE__ */ Me("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ at(6), /* @__PURE__ */ qe("")), ht = /* @__NO_SIDE_EFFECTS__ */ (r) => /* @__PURE__ */ Fe(/* @__PURE__ */ it(58), /* @__PURE__ */ Me(r), /* @__PURE__ */ qe("")), ft = /* @__PURE__ */ ht("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
204
- function Ke({ coder: r, ipfs: e }, t) {
205
- return (n, o) => (t(n, o), r.decode(e && o ? n.substring(1) : n));
206
- }
207
- function Ye({ coder: r, ipfs: e }) {
208
- return (t, n) => {
209
- const o = r.encode(h(t));
210
- return e && n ? `${e}${o}` : o;
211
- };
212
- }
213
- function We({
214
- chars: r,
215
- ipfs: e,
216
- type: t,
217
- withPadding: n
218
- }) {
219
- return (o, s) => {
220
- if (typeof o != "string")
221
- throw new Error(`Expected ${t} string input`);
222
- if (e && s && !o.startsWith(e))
223
- throw new Error(
224
- `Expected ipfs-compatible ${t} to start with '${e}'`
225
- );
226
- for (let i = s ? 1 : 0, a = o.length; i < a; i++) {
227
- const l = o[i];
228
- if (l === void 0)
229
- throw new Error(`Invalid undefined value at index ${i}`);
230
- if (!r.includes(l)) if (n && o[i] === "=") {
231
- if (i !== a - 1) {
232
- if (o[i + 1] !== "=") throw new Error(
233
- `Invalid ${t} padding sequence "${o[i]}${o[i + 1]}" at index ${i}`
234
- );
235
- }
236
- } else
237
- throw new Error(
238
- `Invalid ${t} character "${o[i]}" (0x${o.charCodeAt(i).toString(16)}) at index ${i}`
239
- );
240
- }
241
- return !0;
242
- };
243
- }
244
- const pe = {
245
- chars: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",
246
- coder: ft,
247
- ipfs: "z",
248
- type: "base58"
249
- }, Je = /* @__PURE__ */ We(pe), Ze = /* @__PURE__ */ Ke(pe, Je), Ge = /* @__PURE__ */ Ye(pe);
250
- function Xe(r) {
251
- return (...e) => Kr(r(...e));
252
- }
253
- function K(r, e = 256, t, n) {
254
- const o = Math.ceil(e / 8), s = h(r);
255
- return t ? Ae(s, { dkLen: o, key: t }) : Ae(s, { dkLen: o });
256
- }
257
- const Qe = /* @__PURE__ */ Xe(K), pt = V("SS58PRE");
258
- function er(r) {
259
- return K(I(pt, r), 512);
260
- }
261
- function gt(r) {
262
- if (r[0] === void 0)
263
- throw new Error("Invalid address: first byte cannot be undefined");
264
- if (r[1] === void 0)
265
- throw new Error("Invalid address: second byte cannot be undefined");
266
- 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(
267
- r.length
268
- ), o = r.length - (n ? 2 : 1), s = er(r.subarray(0, o));
269
- return [(r[0] & 128) === 0 && ![46, 47].includes(r[0]) && (n ? r[r.length - 2] === s[0] && r[r.length - 1] === s[1] : r[r.length - 1] === s[0]), o, e, t];
270
- }
271
- const H = {
272
- allowedDecodedLengths: [1, 2, 4, 8, 32, 33],
273
- // publicKey has prefix + 2 checksum bytes, short only prefix + 1 checksum byte
274
- allowedEncodedLengths: [3, 4, 6, 10, 35, 36, 37, 38],
275
- prefix: 42
276
- };
277
- function ge(r, e, t = -1) {
278
- if (!r)
279
- throw new Error("Invalid empty address passed");
280
- if (Ce(r) || He(r))
281
- return h(r);
282
- try {
283
- const n = Ze(r);
284
- if (!H.allowedEncodedLengths.includes(n.length))
285
- throw new Error("Invalid decoded address length");
286
- const [o, s, i, a] = gt(n);
287
- if (!o && !e)
288
- throw new Error("Invalid decoded address checksum");
289
- if (t !== -1 && t !== a)
290
- throw new Error(
291
- `Expected ss58Format ${t}, received ${a}`
292
- );
293
- return n.slice(i, s);
294
- } catch (n) {
295
- throw new Error(`Decoding ${r}: ${n.message}`);
296
- }
297
- }
298
- function mt(r, e = H.prefix) {
299
- const t = ge(r);
300
- if (e < 0 || e > 16383 || [46, 47].includes(e))
301
- throw new Error("Out of range ss58Format specified");
302
- if (!H.allowedDecodedLengths.includes(t.length))
303
- throw new Error(
304
- `Expected a valid key to convert, with length ${H.allowedDecodedLengths.join(", ")}`
305
- );
306
- const n = I(
307
- e < 64 ? [e] : [
308
- (e & 252) >> 2 | 64,
309
- e >> 8 | (e & 3) << 6
310
- ],
311
- t
312
- );
313
- return Ge(
314
- I(
315
- n,
316
- er(n).subarray(0, [32, 33].includes(t.length) ? 2 : 1)
317
- )
318
- );
319
- }
320
- const me = {
321
- chars: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
322
- coder: dt,
323
- type: "base64",
324
- withPadding: !0
325
- }, rr = /* @__PURE__ */ We(me), yt = /* @__PURE__ */ Ke(me, rr), tr = /* @__PURE__ */ Ye(me);
326
- function z(r, e) {
327
- return r << e | r >>> 32 - e;
328
- }
329
- function E(r, e) {
330
- let t = r[e + 3] & 255;
331
- return t = t << 8 | r[e + 2] & 255, t = t << 8 | r[e + 1] & 255, t << 8 | r[e + 0] & 255;
332
- }
333
- function X(r, e, t) {
334
- for (let n = 0; n < 4; n++)
335
- r[e + n] = t & 255, t >>>= 8;
336
- }
337
- function wt(r, e, t, n, o) {
338
- let s = 0;
339
- for (let i = 0; i < o; i++) s |= r[e + i] ^ t[n + i];
340
- return (1 & s - 1 >>> 8) - 1;
341
- }
342
- function oe(r, e, t, n, o) {
343
- const s = new Uint32Array(16), i = new Uint32Array(16), a = new Uint32Array(16), l = new Uint32Array(4);
344
- let c, u, d;
345
- for (c = 0; c < 4; c++)
346
- i[5 * c] = E(n, 4 * c), i[1 + c] = E(t, 4 * c), i[6 + c] = E(e, 4 * c), i[11 + c] = E(t, 16 + 4 * c);
347
- for (c = 0; c < 16; c++) a[c] = i[c];
348
- for (c = 0; c < 20; c++) {
349
- for (u = 0; u < 4; u++) {
350
- for (d = 0; d < 4; d++) l[d] = i[(5 * u + 4 * d) % 16];
351
- for (l[1] ^= z(l[0] + l[3] | 0, 7), l[2] ^= z(l[1] + l[0] | 0, 9), l[3] ^= z(l[2] + l[1] | 0, 13), l[0] ^= z(l[3] + l[2] | 0, 18), d = 0; d < 4; d++) s[4 * u + (u + d) % 4] = l[d];
352
- }
353
- for (d = 0; d < 16; d++) i[d] = s[d];
354
- }
355
- if (o) {
356
- for (c = 0; c < 16; c++) i[c] = i[c] + a[c] | 0;
357
- for (c = 0; c < 4; c++)
358
- i[5 * c] = i[5 * c] - E(n, 4 * c) | 0, i[6 + c] = i[6 + c] - E(e, 4 * c) | 0;
359
- for (c = 0; c < 4; c++)
360
- X(r, 4 * c, i[5 * c]), X(r, 16 + 4 * c, i[6 + c]);
361
- } else
362
- for (c = 0; c < 16; c++) X(r, 4 * c, i[c] + a[c] | 0);
363
- }
364
- const se = new Uint8Array([
365
- 101,
366
- 120,
367
- 112,
368
- 97,
369
- 110,
370
- 100,
371
- 32,
372
- 51,
373
- 50,
374
- 45,
375
- 98,
376
- 121,
377
- 116,
378
- 101,
379
- 32,
380
- 107
381
- ]);
382
- function bt(r, e, t, n, o, s, i) {
383
- const a = new Uint8Array(16), l = new Uint8Array(64);
384
- let c, u;
385
- if (!o) return 0;
386
- for (u = 0; u < 16; u++) a[u] = 0;
387
- for (u = 0; u < 8; u++) a[u] = s[u];
388
- for (; o >= 64; ) {
389
- for (oe(l, a, i, se, !1), u = 0; u < 64; u++) r[e + u] = (t ? t[n + u] : 0) ^ l[u];
390
- for (c = 1, u = 8; u < 16; u++)
391
- c = c + (a[u] & 255) | 0, a[u] = c & 255, c >>>= 8;
392
- o -= 64, e += 64, t && (n += 64);
393
- }
394
- if (o > 0)
395
- for (oe(l, a, i, se, !1), u = 0; u < o; u++) r[e + u] = (t ? t[n + u] : 0) ^ l[u];
396
- return 0;
397
- }
398
- function ae(r, e, t, n, o, s, i) {
399
- const a = new Uint8Array(32);
400
- return oe(a, s, i, se, !0), bt(r, e, t, n, o, s.subarray(16), a);
401
- }
402
- function Q(r, e) {
403
- let t = 0;
404
- for (let n = 0; n < 17; n++)
405
- t = t + (r[n] + e[n] | 0) | 0, r[n] = t & 255, t >>>= 8;
406
- }
407
- const vt = new Uint32Array([
408
- 5,
409
- 0,
410
- 0,
411
- 0,
412
- 0,
413
- 0,
414
- 0,
415
- 0,
416
- 0,
417
- 0,
418
- 0,
419
- 0,
420
- 0,
421
- 0,
422
- 0,
423
- 0,
424
- 252
425
- ]);
426
- function nr(r, e, t, n, o, s) {
427
- let i, a, l;
428
- const c = new Uint32Array(17), u = new Uint32Array(17), d = new Uint32Array(17), p = new Uint32Array(17), b = new Uint32Array(17);
429
- for (a = 0; a < 17; a++) u[a] = d[a] = 0;
430
- for (a = 0; a < 16; a++) u[a] = s[a];
431
- for (u[3] &= 15, u[4] &= 252, u[7] &= 15, u[8] &= 252, u[11] &= 15, u[12] &= 252, u[15] &= 15; o > 0; ) {
432
- for (a = 0; a < 17; a++) p[a] = 0;
433
- for (a = 0; a < 16 && a < o; ++a) p[a] = t[n + a];
434
- for (p[a] = 1, n += a, o -= a, Q(d, p), i = 0; i < 17; i++)
435
- for (c[i] = 0, a = 0; a < 17; a++)
436
- c[i] = c[i] + d[a] * (a <= i ? u[i - a] : 320 * u[i + 17 - a] | 0) | 0 | 0;
437
- for (i = 0; i < 17; i++) d[i] = c[i];
438
- for (l = 0, a = 0; a < 16; a++)
439
- l = l + d[a] | 0, d[a] = l & 255, l >>>= 8;
440
- for (l = l + d[16] | 0, d[16] = l & 3, l = 5 * (l >>> 2) | 0, a = 0; a < 16; a++)
441
- l = l + d[a] | 0, d[a] = l & 255, l >>>= 8;
442
- l = l + d[16] | 0, d[16] = l;
443
- }
444
- for (a = 0; a < 17; a++) b[a] = d[a];
445
- Q(d, vt);
446
- const w = -(d[16] >>> 7) | 0;
447
- for (a = 0; a < 17; a++) d[a] ^= w & (b[a] ^ d[a]);
448
- for (a = 0; a < 16; a++) p[a] = s[a + 16];
449
- for (p[16] = 0, Q(d, p), a = 0; a < 16; a++) r[e + a] = d[a];
450
- return 0;
451
- }
452
- function kt(r, e, t, n, o, s) {
453
- const i = new Uint8Array(16);
454
- return nr(i, 0, t, n, o, s), wt(r, e, i, 0, 16);
455
- }
456
- function Et(r, e, t, n, o) {
457
- if (t < 32) return -1;
458
- ae(r, 0, e, 0, t, n, o), nr(r, 16, r, 32, t - 32, r);
459
- for (let s = 0; s < 16; s++) r[s] = 0;
460
- return 0;
461
- }
462
- function xt(r, e, t, n, o) {
463
- const s = new Uint8Array(32);
464
- if (t < 32 || (ae(s, 0, null, 0, 32, n, o), kt(e, 16, e, 32, t - 32, s) !== 0)) return -1;
465
- ae(r, 0, e, 0, t, n, o);
466
- for (let i = 0; i < 32; i++) r[i] = 0;
467
- return 0;
468
- }
469
- const At = 32, Ut = 24, ie = 32, ce = 16;
470
- function or(r, e) {
471
- if (r.length !== At) throw new Error("bad key size");
472
- if (e.length !== Ut)
473
- throw new Error("bad nonce size");
474
- }
475
- function sr(...r) {
476
- for (let e = 0, t = r.length; e < t; e++)
477
- if (!(r[e] instanceof Uint8Array))
478
- throw new TypeError("unexpected type, use Uint8Array");
479
- }
480
- function St(r, e, t) {
481
- sr(r, e, t), or(t, e);
482
- const n = new Uint8Array(ie + r.length), o = new Uint8Array(n.length);
483
- for (let s = 0; s < r.length; s++)
484
- n[s + ie] = r[s];
485
- return Et(o, n, n.length, e, t), o.subarray(ce);
486
- }
487
- function Bt(r, e, t) {
488
- sr(r, e, t), or(t, e);
489
- const n = new Uint8Array(ce + r.length), o = new Uint8Array(n.length);
490
- for (let s = 0; s < r.length; s++)
491
- n[s + ce] = r[s];
492
- return n.length < 32 || xt(o, n, n.length, e, t) !== 0 ? null : o.subarray(ie);
493
- }
494
- function ar(r, e, t) {
495
- return Bt(r, e, t);
496
- }
497
- const Rt = Yr.crypto;
498
- function $t(r) {
499
- return Rt.getRandomValues(r);
500
- }
501
- function _(r = 32) {
502
- return $t(new Uint8Array(r));
503
- }
504
- const Nt = /* @__PURE__ */ Xe(_);
505
- function Dt(r, e, t = _(24)) {
506
- return {
507
- encrypted: St(r, t, e),
508
- nonce: t
509
- };
510
- }
511
- const L = {
512
- N: 32768,
513
- p: 1,
514
- r: 8
515
- };
516
- function ir(r, e = _(), t = L, n) {
517
- const o = h(r);
518
- return {
519
- params: t,
520
- password: zr(o, e, Wr({ dkLen: 64 }, t)),
521
- salt: e
522
- };
523
- }
524
- const ee = { isLe: !0 }, re = { bitLength: 32, isLe: !0 }, It = { bitLength: 256, isLe: !0 };
525
- function cr(r) {
526
- const e = r.subarray(0, 32), t = Z(r.subarray(32, 36), ee).toNumber(), n = Z(r.subarray(36, 40), ee).toNumber(), o = Z(r.subarray(40, 44), ee).toNumber();
527
- if (t !== L.N || n !== L.p || o !== L.r)
528
- throw new Error("Invalid injected scrypt params found");
529
- return { params: { N: t, p: n, r: o }, salt: e };
530
- }
531
- function Pt(r, { N: e, p: t, r: n }) {
532
- return I(
533
- r,
534
- C(e, re),
535
- C(t, re),
536
- C(n, re)
537
- );
538
- }
539
- const ye = [
540
- "scrypt",
541
- "xsalsa20-poly1305"
542
- ], lr = ["none"], ur = "3", le = 24, dr = 44;
543
- function jt(r, e, t = ye) {
544
- if (!r)
545
- throw new Error("No encrypted data available to decode");
546
- if (t.includes("xsalsa20-poly1305") && !e)
547
- throw new Error("Password required to decode encrypted data");
548
- let n = r;
549
- if (e) {
550
- let o;
551
- if (t.includes("scrypt")) {
552
- const { params: s, salt: i } = cr(r);
553
- o = ir(e, i, s).password, r = r.subarray(dr);
554
- } else
555
- o = V(e);
556
- n = ar(
557
- r.subarray(le),
558
- r.subarray(0, le),
559
- Jr(o, 256, !0)
560
- );
561
- }
562
- if (!n)
563
- throw new Error("Unable to decode using the supplied passphrase");
564
- return n;
565
- }
566
- function Tt(r, e, t) {
567
- return {
568
- encoded: tr(r),
569
- encoding: {
570
- content: e,
571
- type: t ? ye : lr,
572
- version: ur
573
- }
574
- };
575
- }
576
- const _t = /^\d+$/, zt = 32;
577
- var A, v;
578
- const ke = class ke {
579
- constructor() {
580
- W(this, A, new Uint8Array(32));
581
- W(this, v, !1);
582
- }
583
- static from(e) {
584
- const t = new ke(), [n, o] = e.startsWith("/") ? [e.substring(1), !0] : [e, !1];
585
- return t.soft(_t.test(n) ? new ot(n, 10) : n), o ? t.harden() : t;
586
- }
587
- get chainCode() {
588
- return k(this, A);
589
- }
590
- get isHard() {
591
- return k(this, v);
592
- }
593
- get isSoft() {
594
- return !k(this, v);
595
- }
596
- hard(e) {
597
- return this.soft(e).harden();
598
- }
599
- harden() {
600
- return J(this, v, !0), this;
601
- }
602
- soft(e) {
603
- return Zr(e) || Gr(e) || Xr(e) ? this.soft(C(e, It)) : He(e) ? this.soft(Qr(e)) : et(e) ? this.soft(rt(V(e))) : e.length > zt ? this.soft(K(e)) : (k(this, A).fill(0), k(this, A).set(e, 0), this);
604
- }
605
- soften() {
606
- return J(this, v, !1), this;
607
- }
608
- };
609
- A = new WeakMap(), v = new WeakMap();
610
- let ue = ke;
611
- const Ct = /\/(\/?)([^/]+)/g;
612
- function hr(r) {
613
- const e = r.match(Ct), t = [];
614
- let n = "";
615
- if (e) {
616
- n = e.join("");
617
- for (const o of e)
618
- t.push(ue.from(o.substring(1)));
619
- }
620
- if (n !== r)
621
- throw new Error(
622
- `Re-constructed path "${n}" does not match input`
623
- );
624
- return {
625
- parts: e,
626
- path: t
627
- };
628
- }
629
- const Ht = /^(\w+( \w+)*)((\/\/?[^/]+)*)(\/\/\/(.*))?$/;
630
- function Lt(r) {
631
- const e = r.match(Ht);
632
- if (e === null)
633
- throw new Error("Unable to match provided value to a secret URI");
634
- const [, t, , n, , , o] = e;
635
- if (!t)
636
- throw new Error("Unable to extract phrase from provided value");
637
- const { path: s } = hr(n || "");
638
- return {
639
- derivePath: n || "",
640
- password: o,
641
- path: s,
642
- phrase: t
643
- };
644
- }
645
- const fr = BigInt(0), pr = BigInt(3);
646
- function te(r) {
647
- if (typeof r == "string")
648
- return he(r);
649
- if (_e(r))
650
- return r;
651
- throw new Error("Wrong data");
652
- }
653
- function f(r, e, ...t) {
654
- if (!_e(e))
655
- throw new Error(`${r}: Uint8Array expected`);
656
- if (t.length && !t.includes(e.length))
657
- throw new Error(`${r}: Uint8Array expected of length ${t}, not of length=${e.length}`);
658
- }
659
- function q(r, e) {
660
- if (!Number.isSafeInteger(e) || e < 0 || e > 4294967295)
661
- throw new Error(`${r}: wrong u32 integer: ${e}`);
662
- return e;
663
- }
664
- function B(...r) {
665
- for (const e of r)
666
- e.fill(0);
667
- }
668
- const x = Uint8Array.of(), we = Hr.CURVE.n;
669
- function Re(r, e) {
670
- f(r, e, 32);
671
- const t = S(e);
672
- return ze(r, t, fr, we), t;
673
- }
674
- const j = (r) => Cr(r, we), N = 166, m = {
675
- I: 1,
676
- A: 2,
677
- C: 4,
678
- T: 8,
679
- M: 16,
680
- K: 32
681
- };
682
- class be {
683
- constructor(e) {
684
- this.state = new Uint8Array(200), this.pos = 0, this.posBegin = 0, this.curFlags = 0, this.state.set([1, N + 2, 1, 0, 1, 96], 0), this.state.set(he("STROBEv1.0.2"), 6), this.state32 = Lr(this.state), this.keccakF1600(), this.metaAD(e, !1);
685
- }
686
- keccakF1600() {
687
- Or(this.state32);
688
- }
689
- runF() {
690
- this.state[this.pos] ^= this.posBegin, this.state[this.pos + 1] ^= 4, this.state[N + 1] ^= 128, this.keccakF1600(), this.pos = 0, this.posBegin = 0;
691
- }
692
- // keccak.update()
693
- absorb(e) {
694
- for (let t = 0; t < e.length; t++)
695
- this.state[this.pos++] ^= e[t], this.pos === N && this.runF();
696
- }
697
- // keccak.xof()
698
- squeeze(e) {
699
- const t = new Uint8Array(e);
700
- for (let n = 0; n < t.length; n++)
701
- t[n] = this.state[this.pos], this.state[this.pos++] = 0, this.pos === N && this.runF();
702
- return t;
703
- }
704
- overwrite(e) {
705
- for (let t = 0; t < e.length; t++)
706
- this.state[this.pos++] = e[t], this.pos === N && this.runF();
707
- }
708
- beginOp(e, t) {
709
- if (t) {
710
- if (this.curFlags !== e)
711
- throw new Error(`Continued op with changed flags from ${this.curFlags.toString(2)} to ${e.toString(2)}`);
712
- return;
713
- }
714
- if ((e & m.T) !== 0)
715
- throw new Error("T flag is not supported");
716
- const n = this.posBegin;
717
- this.posBegin = this.pos + 1, this.curFlags = e, this.absorb(new Uint8Array([n, e])), (e & (m.C | m.K)) !== 0 && this.pos !== 0 && this.runF();
718
- }
719
- // Public API
720
- metaAD(e, t) {
721
- this.beginOp(m.M | m.A, t), this.absorb(te(e));
722
- }
723
- AD(e, t) {
724
- this.beginOp(m.A, t), this.absorb(te(e));
725
- }
726
- PRF(e, t) {
727
- return this.beginOp(m.I | m.A | m.C, t), this.squeeze(e);
728
- }
729
- KEY(e, t) {
730
- this.beginOp(m.A | m.C, t), this.overwrite(te(e));
731
- }
732
- // Utils
733
- clone() {
734
- const e = new be("0");
735
- return e.pos = this.pos, e.posBegin = this.posBegin, e.state.set(this.state), e.curFlags = this.curFlags, e;
736
- }
737
- clean() {
738
- this.state.fill(0), this.pos = 0, this.curFlags = 0, this.posBegin = 0;
739
- }
740
- }
741
- class Ot {
742
- constructor(e) {
743
- this.strobe = new be("Merlin v1.0"), this.appendMessage("dom-sep", e);
744
- }
745
- appendMessage(e, t) {
746
- this.strobe.metaAD(e, !1), q("Merlin.appendMessage", t.length), this.strobe.metaAD(y(t.length, 4), !0), this.strobe.AD(t, !1);
747
- }
748
- challengeBytes(e, t) {
749
- return this.strobe.metaAD(e, !1), q("Merlin.challengeBytes", t), this.strobe.metaAD(y(t, 4), !0), this.strobe.PRF(t, !1);
750
- }
751
- clean() {
752
- this.strobe.clean();
753
- }
754
- }
755
- class R extends Ot {
756
- constructor(e, t = U) {
757
- super(e), this.rng = t;
758
- }
759
- label(e) {
760
- this.appendMessage("", e);
761
- }
762
- bytes(e) {
763
- return this.appendMessage("sign-bytes", e), this;
764
- }
765
- protoName(e) {
766
- this.appendMessage("proto-name", e);
767
- }
768
- commitPoint(e, t) {
769
- this.appendMessage(e, t.toRawBytes());
770
- }
771
- challengeScalar(e) {
772
- return j(S(this.challengeBytes(e, 64)));
773
- }
774
- witnessScalar(e, t = []) {
775
- return j(S(this.witnessBytes(e, 64, t)));
776
- }
777
- witnessBytes(e, t, n = []) {
778
- q("SigningContext.witnessBytes", t);
779
- const o = this.strobe.clone();
780
- for (const i of n)
781
- o.metaAD(e, !1), q("SigningContext.witnessBytes nonce length", i.length), o.metaAD(y(i.length, 4), !0), o.KEY(i, !1);
782
- const s = this.rng(32);
783
- return o.metaAD("rng", !1), o.KEY(s, !1), o.metaAD(y(t, 4), !1), o.PRF(t, !1);
784
- }
785
- }
786
- const Ft = Fr(256), gr = (r) => y(r << pr & Ft, 32), $ = (r) => S(r) >> pr;
787
- function Y(r) {
788
- f("secretKey", r, 64);
789
- const e = $(r.subarray(0, 32));
790
- return g.BASE.multiply(e).toRawBytes();
791
- }
792
- function mr(r) {
793
- f("seed", r, 32);
794
- const e = Te(r);
795
- e[0] &= 248, e[31] &= 63, e[31] |= 64;
796
- const t = gr($(e.subarray(0, 32))), n = e.subarray(32, 64), o = D(t, n);
797
- return B(t, n, e), o;
798
- }
799
- const yr = he("substrate");
800
- function Mt(r, e, t = U) {
801
- f("message", e), f("secretKey", r, 64);
802
- const n = new R("SigningContext", t);
803
- n.label(yr), n.bytes(e);
804
- const o = $(r.subarray(0, 32)), s = r.subarray(32, 64), i = g.fromHex(Y(r));
805
- n.protoName("Schnorr-sig"), n.commitPoint("sign:pk", i);
806
- const a = n.witnessScalar("signing", [s]), l = g.BASE.multiply(a);
807
- n.commitPoint("sign:R", l);
808
- const c = n.challengeScalar("sign:c"), u = j(c * o + a), d = D(l.toRawBytes(), y(u, 32));
809
- return d[63] |= 128, n.clean(), d;
810
- }
811
- function qt(r, e, t) {
812
- if (f("message", r), f("signature", e, 64), f("publicKey", t, 32), (e[63] & 128) === 0)
813
- throw new Error("Schnorrkel marker missing");
814
- const n = Uint8Array.from(e.subarray(32, 64));
815
- n[31] &= 127;
816
- const o = g.fromHex(e.subarray(0, 32)), s = S(n);
817
- ze("s", s, fr, we);
818
- const i = new R("SigningContext");
819
- i.label(yr), i.bytes(r);
820
- const a = g.fromHex(t);
821
- if (a.equals(g.ZERO))
822
- return !1;
823
- i.protoName("Schnorr-sig"), i.commitPoint("sign:pk", a), i.commitPoint("sign:R", o);
824
- const l = i.challengeScalar("sign:c"), c = g.BASE.multiply(s), u = a.negate().multiply(l).add(c);
825
- return i.clean(), B(n), u.equals(o);
826
- }
827
- const wr = {
828
- secretSoft(r, e, t = U) {
829
- f("secretKey", r, 64), f("chainCode", e, 32);
830
- const n = $(r.subarray(0, 32)), o = r.subarray(32, 64), s = g.fromHex(Y(r)), i = new R("SchnorrRistrettoHDKD", t);
831
- i.bytes(x), i.appendMessage("chain-code", e), i.commitPoint("public-key", s);
832
- const a = i.challengeScalar("HDKD-scalar"), l = i.challengeBytes("HDKD-chaincode", 32), c = D(y(n, 32), o), u = i.witnessBytes("HDKD-nonce", 32, [o, c]), d = gr(j(n + a)), p = D(d, u);
833
- return B(d, u, c, l), i.clean(), p;
834
- },
835
- secretHard(r, e) {
836
- f("secretKey", r, 64), f("chainCode", e, 32);
837
- const t = y($(r.subarray(0, 32)), 32), n = new R("SchnorrRistrettoHDKD");
838
- n.bytes(x), n.appendMessage("chain-code", e), n.appendMessage("secret-key", t);
839
- const o = n.challengeBytes("HDKD-hard", 32), s = n.challengeBytes("HDKD-chaincode", 32);
840
- n.clean();
841
- const i = mr(o);
842
- return B(t, o, s), n.clean(), i;
843
- }
844
- }, $e = {
845
- proove(r, e, t, n, o, s) {
846
- n.protoName("DLEQProof"), n.commitPoint("vrf:h", o);
847
- const i = n.witnessScalar("proving\x000", [e]), a = g.BASE.multiply(i);
848
- n.commitPoint("vrf:R=g^r", a);
849
- const l = o.multiply(i);
850
- n.commitPoint("vrf:h^r", l), n.commitPoint("vrf:pk", t), n.commitPoint("vrf:h^sk", s);
851
- const c = n.challengeScalar("prove"), u = j(i - c * r);
852
- return { proof: { c, s: u }, proofBatchable: { R: a, Hr: l, s: u } };
853
- },
854
- verify(r, e, t, n, o) {
855
- if (r.equals(g.ZERO))
856
- return !1;
857
- e.protoName("DLEQProof"), e.commitPoint("vrf:h", t);
858
- const s = r.multiply(o.c).add(g.BASE.multiply(o.s));
859
- e.commitPoint("vrf:R=g^r", s);
860
- const i = n.multiply(o.c).add(t.multiply(o.s));
861
- e.commitPoint("vrf:h^r", i), e.commitPoint("vrf:pk", r), e.commitPoint("vrf:h^sk", n);
862
- const a = e.challengeScalar("prove");
863
- return o.c === a ? { R: s, Hr: i, s: o.s } : !1;
864
- }
865
- };
866
- function Ne(r, e, t, n, o = U) {
867
- const s = new R("SigningContext", o);
868
- s.label(r), s.bytes(e), s.commitPoint("vrf-nm-pk", n);
869
- const i = s.challengeBytes("VRFHash", 64), a = g.hashToCurve(i), l = new R("VRF", o);
870
- return t.length && l.label(t), s.clean(), B(i), { input: a, t: l };
871
- }
872
- const br = {
873
- sign(r, e, t = x, n = x, o = U) {
874
- f("msg", r), f("secretKey", e, 64), f("ctx", t), f("extra", n);
875
- const s = $(e.subarray(0, 32)), i = e.subarray(32, 64), a = g.fromHex(Y(e)), { input: l, t: c } = Ne(t, r, n, a, o), u = l.multiply(s), d = { output: u }, { proof: p } = $e.proove(s, i, a, c, l, u), b = y(p.c, 32), w = y(p.s, 32), _r = D(d.output.toRawBytes(), b, w);
876
- return B(i, b, w), _r;
877
- },
878
- verify(r, e, t, n = x, o = x, s = U) {
879
- f("msg", r), f("signature", e, 96), f("pubkey", t, 32), f("ctx", n), f("extra", o);
880
- const i = g.fromHex(t);
881
- if (i.equals(g.ZERO))
882
- return !1;
883
- const a = {
884
- c: Re("signature.c", e.subarray(32, 64)),
885
- s: Re("signature.s", e.subarray(64, 96))
886
- }, { input: l, t: c } = Ne(n, r, o, i, s), u = g.fromHex(e.subarray(0, 32));
887
- if (u.equals(g.ZERO))
888
- throw new Error("vrf.verify: wrong output point (identity)");
889
- return $e.verify(i, c, l, u, a) !== !1;
890
- }
891
- }, de = 64, Vt = 32, ne = de + Vt;
892
- function Kt(r) {
893
- const e = h(r);
894
- if (e.length !== ne)
895
- throw new Error(
896
- `Expected keypair with ${ne} bytes, found ${e.length}`
897
- );
898
- return {
899
- publicKey: e.slice(de, ne),
900
- secretKey: e.slice(0, de)
901
- };
902
- }
903
- function vr(r) {
904
- return (e, t) => {
905
- if (!Ce(t) || t.length !== 32)
906
- throw new Error("Invalid chainCode passed to derive");
907
- const n = r(e.secretKey, t), o = Y(n);
908
- return Kt(I(n, o));
909
- };
910
- }
911
- const kr = /* @__PURE__ */ vr(wr.secretHard), Er = /* @__PURE__ */ vr(wr.secretSoft);
912
- function xr(r, { chainCode: e, isSoft: t }) {
913
- return t ? Er(r, e) : kr(r, e);
914
- }
915
- const De = {
916
- sr25519: xr,
917
- ecdsa: () => {
918
- throw new Error("ECDSA key derivation not implemented yet");
919
- },
920
- ed25519: () => {
921
- throw new Error("ED25519 key derivation not implemented yet");
922
- },
923
- ethereum: () => {
924
- throw new Error("Ethereum key derivation not implemented yet");
925
- }
926
- };
927
- function Yt(r, e, t) {
928
- if (!t)
929
- throw new Error("Invalid type provided");
930
- if (!De[t])
931
- throw new Error(`Unsupported keypair type: ${t}`);
932
- const n = De[t];
933
- let o = r;
934
- for (const s of e)
935
- o = n(o, s);
936
- return o;
937
- }
938
- function Ar(r, e = _(), t = 2048, n) {
939
- const o = h(r), s = h(e);
940
- return {
941
- password: Mr(Te, o, s, { c: t, dkLen: 64 }),
942
- rounds: t,
943
- salt: e
944
- };
945
- }
946
- const Ur = { 256: qr }, Sr = Ur[256], Br = "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(
947
- "|"
948
- ), Ie = "Invalid mnemonic", Rr = "Invalid entropy", Wt = "Invalid mnemonic checksum";
949
- function Jt(r) {
950
- return (r || "").normalize("NFKD");
951
- }
952
- function $r(r) {
953
- return Number.parseInt(r, 2);
954
- }
955
- function Nr(r) {
956
- return r.map((e) => e.toString(2).padStart(8, "0")).join("");
957
- }
958
- function Dr(r) {
959
- return Nr(Array.from(Sr(r))).slice(
960
- 0,
961
- r.length * 8 / 32
962
- );
963
- }
964
- function Ir(r, e = Br) {
965
- const t = Jt(r).split(" ");
966
- if (t.length % 3 !== 0)
967
- throw new Error(Ie);
968
- const n = t.map((u) => {
969
- const d = e.indexOf(u);
970
- if (d === -1)
971
- throw new Error(Ie);
972
- return d.toString(2).padStart(11, "0");
973
- }).join(""), o = Math.floor(n.length / 33) * 32, s = n.slice(0, o), i = n.slice(o), a = s.match(/(.{1,8})/g), l = a == null ? void 0 : a.map($r);
974
- if (!l || l.length % 4 !== 0 || l.length < 16 || l.length > 32)
975
- throw new Error(Rr);
976
- const c = h(l);
977
- if (Dr(c) !== i)
978
- throw new Error(Wt);
979
- return c;
980
- }
981
- function Zt(r, e = Br) {
982
- if (r.length % 4 !== 0 || r.length < 16 || r.length > 32)
983
- throw new Error(Rr);
984
- const t = `${Nr(Array.from(r))}${Dr(r)}`.match(
985
- /(.{1,11})/g
986
- ), n = t == null ? void 0 : t.map((o) => e[$r(o)]);
987
- if (!n || n.length < 12)
988
- throw new Error("Unable to map entropy to mnemonic");
989
- return n.join(" ");
990
- }
991
- function Gt(r, e) {
992
- try {
993
- Ir(r, e);
994
- } catch {
995
- return !1;
996
- }
997
- return !0;
998
- }
999
- function Pr(r, e, t) {
1000
- return Ir(r, e);
1001
- }
1002
- function jr(r, e) {
1003
- return Gt(r, e);
1004
- }
1005
- function Xt(r, e = "", t, n) {
1006
- if (!jr(r, t))
1007
- throw new Error("Invalid bip39 mnemonic specified");
1008
- const o = Pr(r, t), s = V(`mnemonic${e}`);
1009
- return Ar(o, s).password.slice(0, 32);
1010
- }
1011
- function Qt(r, e) {
1012
- if (![33, 65].includes(r.length))
1013
- throw new Error(
1014
- `Invalid publicKey provided, received ${r.length} bytes input`
1015
- );
1016
- return r.length === 33 ? r : Vr.ProjectivePoint.fromHex(r).toRawBytes(!0);
1017
- }
1018
- function ve(r, e, t) {
1019
- const n = h(r), o = h(e), s = h(t);
1020
- if (s.length !== 32)
1021
- throw new Error("Invalid publicKey length, expected 32 bytes");
1022
- if (o.length !== 64)
1023
- throw new Error("Invalid signature length, expected 64 bytes");
1024
- return qt(n, o, s);
1025
- }
1026
- const en = [
1027
- //["ecdsa", secp256k1VerifyHasher("blake2")],
1028
- //["ethereum", secp256k1VerifyHasher("keccak")],
1029
- [
1030
- "ecdsa",
1031
- () => {
1032
- throw new Error("Not Implemented");
1033
- }
1034
- ],
1035
- [
1036
- "ethereum",
1037
- () => {
1038
- throw new Error("Not Implemented");
1039
- }
1040
- ]
1041
- ], rn = [
1042
- //["ed25519", ed25519Verify],
1043
- [
1044
- "ed25519",
1045
- () => {
1046
- throw new Error("Not Implemented");
1047
- }
1048
- ],
1049
- ["sr25519", ve],
1050
- ...en
1051
- ], tn = [
1052
- "ed25519",
1053
- "sr25519",
1054
- "ecdsa"
1055
- ];
1056
- function nn(r, { message: e, publicKey: t, signature: n }, o = rn) {
1057
- return r.isValid = o.some(([s, i]) => {
1058
- try {
1059
- if (i(e, n, t))
1060
- return r.crypto = s, !0;
1061
- } catch {
1062
- }
1063
- return !1;
1064
- }), r;
1065
- }
1066
- function on(r, { message: e, publicKey: t, signature: n }) {
1067
- const o = n[0];
1068
- if (o === void 0)
1069
- throw new Error(
1070
- "Invalid signature, expected first byte to indicate crypto type"
1071
- );
1072
- if (![0, 1, 2].includes(o))
1073
- throw new Error(
1074
- `Unknown crypto type, expected signature prefix [0..2], found ${n[0]}`
1075
- );
1076
- const s = tn[o];
1077
- if (!s)
1078
- throw new Error(`Unknown crypto type, found ${o}`);
1079
- r.crypto = s;
1080
- try {
1081
- r.isValid = {
1082
- sr25519: () => ve(e, n.subarray(1), t),
1083
- ecdsa: () => !1,
1084
- ethereum: () => !1,
1085
- ed25519: () => !1
1086
- }[s]();
1087
- } catch {
1088
- }
1089
- return r;
1090
- }
1091
- function sn(r) {
1092
- const e = r[0];
1093
- if (e === void 0)
1094
- throw new Error(
1095
- "Invalid signature, expected first byte to indicate crypto type"
1096
- );
1097
- return [0, 1, 2].includes(e) && [65, 66].includes(r.length) ? on : nn;
1098
- }
1099
- function an(r, e, t) {
1100
- const n = h(e);
1101
- if (![64, 65, 66].includes(n.length))
1102
- throw new Error(
1103
- `Invalid signature length, expected [64..66] bytes, found ${n.length}`
1104
- );
1105
- const o = ge(t), s = {
1106
- message: h(r),
1107
- publicKey: o,
1108
- signature: n
1109
- }, i = {
1110
- crypto: "none",
1111
- isValid: !1,
1112
- isWrapped: Ue(s.message, !0),
1113
- publicKey: o
1114
- }, a = Ue(s.message, !1), l = sn(n);
1115
- return l(i, s), i.crypto !== "none" || i.isWrapped && !a ? i : (s.message = a ? tt(s.message) : nt(s.message), l(i, s));
1116
- }
1117
- function cn(r) {
1118
- const e = h(r);
1119
- if (e.length !== 32)
1120
- throw new Error(`Expected a seed of 32 bytes, found ${e.length}`);
1121
- const t = mr(e), n = S(t.subarray(0, 32)) >> 3n, o = g.BASE.multiply(n).toRawBytes();
1122
- return {
1123
- publicKey: new Uint8Array(o),
1124
- secretKey: new Uint8Array(t)
1125
- };
1126
- }
1127
- function ln(r, { publicKey: e, secretKey: t }) {
1128
- const n = typeof r == "string" ? new TextEncoder().encode(r) : r, o = h(t);
1129
- if (o.length !== 64)
1130
- throw new Error(
1131
- `Expected secretKey to be 64 bytes, found ${o.length}`
1132
- );
1133
- return Mt(o, n);
1134
- }
1135
- const Pe = new Uint8Array();
1136
- function un(r, { secretKey: e }, t = Pe, n = Pe) {
1137
- const o = h(r), s = h(e), i = h(t), a = h(n);
1138
- if (s.length !== 64)
1139
- throw new Error("Invalid secretKey length, expected 64 bytes");
1140
- return br.sign(o, s, i, a);
1141
- }
1142
- const je = new Uint8Array();
1143
- function dn(r, e, t, n = je, o = je) {
1144
- const s = h(r), i = h(e), a = h(t), l = h(n), c = h(o);
1145
- if (a.length !== 32)
1146
- throw new Error("Invalid publicKey length, expected 32 bytes");
1147
- if (i.length !== 96)
1148
- throw new Error("Invalid vrfSign output length, expected 96 bytes");
1149
- return br.verify(
1150
- s,
1151
- i,
1152
- a,
1153
- l,
1154
- c
1155
- );
1156
- }
1157
- function Tr(r, e) {
1158
- return Qe(r, e);
1159
- }
1160
- function hn(r) {
1161
- return Tr(r.join(""));
1162
- }
1163
- const yn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1164
- __proto__: null,
1165
- ENCODING: ye,
1166
- ENCODING_NONE: lr,
1167
- ENCODING_VERSION: ur,
1168
- NONCE_LENGTH: le,
1169
- SCRYPT_LENGTH: dr,
1170
- base58Decode: Ze,
1171
- base58Encode: Ge,
1172
- base58Validate: Je,
1173
- base64Decode: yt,
1174
- base64Encode: tr,
1175
- base64Validate: rr,
1176
- blake2AsHex: Qe,
1177
- blake2AsU8a: K,
1178
- decodeAddress: ge,
1179
- encodeAddress: mt,
1180
- entropyToMnemonic: Zt,
1181
- hexHash: Tr,
1182
- hexHashArray: hn,
1183
- jsonDecryptData: jt,
1184
- jsonEncryptFormat: Tt,
1185
- keyExtractPath: hr,
1186
- keyExtractSuri: Lt,
1187
- keyFromPath: Yt,
1188
- keyHdkdSr25519: xr,
1189
- mnemonicToEntropy: Pr,
1190
- mnemonicToMiniSecret: Xt,
1191
- mnemonicValidate: jr,
1192
- naclDecrypt: ar,
1193
- naclEncrypt: Dt,
1194
- pbkdf2Encode: Ar,
1195
- randomAsHex: Nt,
1196
- randomAsU8a: _,
1197
- scryptEncode: ir,
1198
- scryptFromU8a: cr,
1199
- scryptToU8a: Pt,
1200
- secp256k1Compress: Qt,
1201
- sha256AsU8a: Sr,
1202
- shaAsU8a: Ur,
1203
- signatureVerify: an,
1204
- sr25519DeriveHard: kr,
1205
- sr25519DeriveSoft: Er,
1206
- sr25519FromSeed: cn,
1207
- sr25519Sign: ln,
1208
- sr25519Verify: ve,
1209
- sr25519VrfSign: un,
1210
- sr25519VrfVerify: dn
1211
- }, Symbol.toStringTag, { value: "Module" }));
1212
- export {
1213
- Pt as a,
1214
- Tt as b,
1215
- dn as c,
1216
- un as d,
1217
- an as e,
1218
- Qt as f,
1219
- ln as g,
1220
- Yt as h,
1221
- cn as i,
1222
- jt as j,
1223
- hr as k,
1224
- ge as l,
1225
- mt as m,
1226
- Dt as n,
1227
- yt as o,
1228
- Lt as p,
1229
- Xt as q,
1230
- Tr as r,
1231
- ir as s,
1232
- $t as t,
1233
- hn as u,
1234
- Nt as v,
1235
- yn as w
1236
- };