bitcoin-wallet-connector 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/README.md +24 -21
  2. package/lib/BitcoinConnectionProvider.d.ts +3 -3
  3. package/lib/BitcoinWalletConnector-BC92ulXx.js +2 -0
  4. package/lib/BitcoinWalletConnector-BC92ulXx.js.map +1 -0
  5. package/lib/{BitcoinWalletAdapterConnector-Bq835yj0.mjs → BitcoinWalletConnector-CS0BshOl.mjs} +11 -19
  6. package/lib/BitcoinWalletConnector-CS0BshOl.mjs.map +1 -0
  7. package/lib/{BitcoinWalletAdapterConnector.d.ts → BitcoinWalletConnector.d.ts} +4 -5
  8. package/lib/BitgetWalletAdapter.impl-D8kqiYDi.mjs +11 -0
  9. package/lib/BitgetWalletAdapter.impl-D8kqiYDi.mjs.map +1 -0
  10. package/lib/BitgetWalletAdapter.impl-DiyzNQ9d.js +2 -0
  11. package/lib/BitgetWalletAdapter.impl-DiyzNQ9d.js.map +1 -0
  12. package/lib/{LeatherWalletAdapter.impl-RUYx555r.mjs → LeatherWalletAdapter.impl-B1PoZS7z.mjs} +48 -37
  13. package/lib/LeatherWalletAdapter.impl-B1PoZS7z.mjs.map +1 -0
  14. package/lib/LeatherWalletAdapter.impl-BIWirus3.js +2 -0
  15. package/lib/LeatherWalletAdapter.impl-BIWirus3.js.map +1 -0
  16. package/lib/{MagicEdenWalletAdapter.impl-CrA6SGvG.mjs → MagicEdenWalletAdapter.impl-B3d5lbkD.mjs} +31 -20
  17. package/lib/MagicEdenWalletAdapter.impl-B3d5lbkD.mjs.map +1 -0
  18. package/lib/MagicEdenWalletAdapter.impl-DLBP3p4o.js +2 -0
  19. package/lib/MagicEdenWalletAdapter.impl-DLBP3p4o.js.map +1 -0
  20. package/lib/OkxWalletAdapter.impl-7cj96tmr.js +2 -0
  21. package/lib/OkxWalletAdapter.impl-7cj96tmr.js.map +1 -0
  22. package/lib/{OkxWalletAdapter.impl-BepoUL1B.mjs → OkxWalletAdapter.impl-nRgHsPTn.mjs} +13 -9
  23. package/lib/OkxWalletAdapter.impl-nRgHsPTn.mjs.map +1 -0
  24. package/lib/{UnisatCompatibleWalletAdapterImpl-M38FqkZI.mjs → UnisatCompatibleWalletAdapterImpl-8lRRF7Zj.mjs} +18 -10
  25. package/lib/UnisatCompatibleWalletAdapterImpl-8lRRF7Zj.mjs.map +1 -0
  26. package/lib/{UnisatCompatibleWalletAdapterImpl-Cq2Oqk1b.js → UnisatCompatibleWalletAdapterImpl-C-JWrc9s.js} +2 -2
  27. package/lib/UnisatCompatibleWalletAdapterImpl-C-JWrc9s.js.map +1 -0
  28. package/lib/UnisatWalletAdapter.impl-DXDfnHz_.js +2 -0
  29. package/lib/UnisatWalletAdapter.impl-DXDfnHz_.js.map +1 -0
  30. package/lib/UnisatWalletAdapter.impl-DvA33Ikj.mjs +19 -0
  31. package/lib/UnisatWalletAdapter.impl-DvA33Ikj.mjs.map +1 -0
  32. package/lib/WalletAdapters.types-CExaiK0o.js +2 -0
  33. package/lib/WalletAdapters.types-CExaiK0o.js.map +1 -0
  34. package/lib/WalletAdapters.types-DBvhI1hu.mjs +20 -0
  35. package/lib/WalletAdapters.types-DBvhI1hu.mjs.map +1 -0
  36. package/lib/WalletAdapters.types.d.ts +7 -12
  37. package/lib/{XverseCompatibleWalletAdapterImpl-Bf-BK5VK.js → XverseCompatibleWalletAdapterImpl-Dp_GUxQM.js} +2 -2
  38. package/lib/XverseCompatibleWalletAdapterImpl-Dp_GUxQM.js.map +1 -0
  39. package/lib/{XverseCompatibleWalletAdapterImpl-DXKnO_-V.mjs → XverseCompatibleWalletAdapterImpl-bgp9xDYH.mjs} +12 -8
  40. package/lib/XverseCompatibleWalletAdapterImpl-bgp9xDYH.mjs.map +1 -0
  41. package/lib/{XverseWalletAdapter.impl-CZO0RQva.mjs → XverseWalletAdapter.impl-BOpY4Vf8.mjs} +15 -15
  42. package/lib/XverseWalletAdapter.impl-BOpY4Vf8.mjs.map +1 -0
  43. package/lib/XverseWalletAdapter.impl-D0eOtEOa.js +2 -0
  44. package/lib/XverseWalletAdapter.impl-D0eOtEOa.js.map +1 -0
  45. package/lib/adapters/BitgetWalletAdapter.d.ts +6 -2
  46. package/lib/adapters/LeatherWalletAdapter.d.ts +4 -2
  47. package/lib/adapters/LeatherWalletAdapter.impl.d.ts +8 -1
  48. package/lib/adapters/MagicEdenWalletAdapter.d.ts +5 -2
  49. package/lib/adapters/MagicEdenWalletAdapter.impl.d.ts +1 -1
  50. package/lib/adapters/MockAddressWalletAdapter.d.ts +8 -32
  51. package/lib/adapters/OkxWalletAdapter.d.ts +3 -2
  52. package/lib/adapters/OkxWalletAdapter.impl.d.ts +5 -1
  53. package/lib/adapters/UnisatWalletAdapter.d.ts +3 -2
  54. package/lib/adapters/UnisatWalletAdapter.impl.d.ts +4 -0
  55. package/lib/adapters/XverseWalletAdapter.d.ts +3 -2
  56. package/lib/adapters/XverseWalletAdapter.impl.d.ts +1 -1
  57. package/lib/adapters/index.d.ts +6 -6
  58. package/lib/adapters.js +1 -1
  59. package/lib/adapters.mjs +8 -8
  60. package/lib/constants-B7qVf97f.mjs +5 -0
  61. package/lib/constants-B7qVf97f.mjs.map +1 -0
  62. package/lib/constants-Dr0_Mix2.js +2 -0
  63. package/lib/constants-Dr0_Mix2.js.map +1 -0
  64. package/lib/constants.d.ts +1 -0
  65. package/lib/{index-D7YwhNAG.mjs → index-DM4G-LJz.mjs} +639 -590
  66. package/lib/index-DM4G-LJz.mjs.map +1 -0
  67. package/lib/index-jRY8YhyK.js +2 -0
  68. package/lib/index-jRY8YhyK.js.map +1 -0
  69. package/lib/index.d.ts +1 -1
  70. package/lib/index.js +1 -1
  71. package/lib/index.mjs +13 -13
  72. package/lib/react.js +1 -1
  73. package/lib/react.js.map +1 -1
  74. package/lib/react.mjs +7 -7
  75. package/lib/react.mjs.map +1 -1
  76. package/lib/{transaction-CiLOYSE_.mjs → transaction-4ShhFCwN.mjs} +2 -2
  77. package/lib/{transaction-CiLOYSE_.mjs.map → transaction-4ShhFCwN.mjs.map} +1 -1
  78. package/lib/{transaction-CzdnbXSo.js → transaction-B6SlpRzN.js} +2 -2
  79. package/lib/{transaction-CzdnbXSo.js.map → transaction-B6SlpRzN.js.map} +1 -1
  80. package/lib/utils/UnisatCompatibleWalletAdapterImpl.d.ts +11 -3
  81. package/lib/utils/XverseCompatibleWalletAdapterImpl.d.ts +4 -0
  82. package/lib/utils/XverseCompatibleWalletAdapterImpl_legacy.d.ts +7 -2
  83. package/package.json +9 -10
  84. package/src/BitcoinConnectionProvider.stories.tsx +111 -43
  85. package/src/BitcoinConnectionProvider.tsx +5 -5
  86. package/src/{BitcoinWalletAdapterConnector.ts → BitcoinWalletConnector.ts} +18 -26
  87. package/src/WalletAdapters.types.ts +13 -22
  88. package/src/adapters/BitgetWalletAdapter.impl.ts +2 -1
  89. package/src/adapters/BitgetWalletAdapter.ts +9 -7
  90. package/src/adapters/LeatherWalletAdapter.impl.ts +23 -13
  91. package/src/adapters/LeatherWalletAdapter.ts +11 -8
  92. package/src/adapters/MagicEdenWalletAdapter.impl.ts +9 -8
  93. package/src/adapters/MagicEdenWalletAdapter.ts +17 -14
  94. package/src/adapters/MockAddressWalletAdapter.ts +61 -35
  95. package/src/adapters/OkxWalletAdapter.impl.ts +12 -7
  96. package/src/adapters/OkxWalletAdapter.ts +10 -7
  97. package/src/adapters/UnisatWalletAdapter.impl.ts +8 -2
  98. package/src/adapters/UnisatWalletAdapter.ts +9 -7
  99. package/src/adapters/XverseWalletAdapter.impl.ts +6 -6
  100. package/src/adapters/XverseWalletAdapter.ts +10 -7
  101. package/src/adapters/index.ts +6 -6
  102. package/src/constants.ts +1 -0
  103. package/src/index.ts +1 -1
  104. package/src/utils/UnisatCompatibleWalletAdapterImpl.ts +11 -2
  105. package/src/utils/XverseCompatibleWalletAdapterImpl.ts +4 -0
  106. package/src/utils/XverseCompatibleWalletAdapterImpl_legacy.ts +19 -7
  107. package/lib/BitcoinWalletAdapterConnector-Bq835yj0.mjs.map +0 -1
  108. package/lib/BitcoinWalletAdapterConnector-DMef0iHV.js +0 -2
  109. package/lib/BitcoinWalletAdapterConnector-DMef0iHV.js.map +0 -1
  110. package/lib/BitgetWalletAdapter.impl-C_HLO7Oi.mjs +0 -10
  111. package/lib/BitgetWalletAdapter.impl-C_HLO7Oi.mjs.map +0 -1
  112. package/lib/BitgetWalletAdapter.impl-CxnKMf7U.js +0 -2
  113. package/lib/BitgetWalletAdapter.impl-CxnKMf7U.js.map +0 -1
  114. package/lib/LeatherWalletAdapter.impl-B2QgX_tO.js +0 -2
  115. package/lib/LeatherWalletAdapter.impl-B2QgX_tO.js.map +0 -1
  116. package/lib/LeatherWalletAdapter.impl-RUYx555r.mjs.map +0 -1
  117. package/lib/MagicEdenWalletAdapter.impl-CrA6SGvG.mjs.map +0 -1
  118. package/lib/MagicEdenWalletAdapter.impl-Di3Nu2S5.js +0 -2
  119. package/lib/MagicEdenWalletAdapter.impl-Di3Nu2S5.js.map +0 -1
  120. package/lib/OkxWalletAdapter.impl-BepoUL1B.mjs.map +0 -1
  121. package/lib/OkxWalletAdapter.impl-C8kesjGu.js +0 -2
  122. package/lib/OkxWalletAdapter.impl-C8kesjGu.js.map +0 -1
  123. package/lib/UnisatCompatibleWalletAdapterImpl-Cq2Oqk1b.js.map +0 -1
  124. package/lib/UnisatCompatibleWalletAdapterImpl-M38FqkZI.mjs.map +0 -1
  125. package/lib/UnisatWalletAdapter.impl-CJB22se8.mjs +0 -14
  126. package/lib/UnisatWalletAdapter.impl-CJB22se8.mjs.map +0 -1
  127. package/lib/UnisatWalletAdapter.impl-EISvxdpc.js +0 -2
  128. package/lib/UnisatWalletAdapter.impl-EISvxdpc.js.map +0 -1
  129. package/lib/WalletAdapters.types-CnvOqHFH.mjs +0 -32
  130. package/lib/WalletAdapters.types-CnvOqHFH.mjs.map +0 -1
  131. package/lib/WalletAdapters.types-De_x1lzr.js +0 -2
  132. package/lib/WalletAdapters.types-De_x1lzr.js.map +0 -1
  133. package/lib/XverseCompatibleWalletAdapterImpl-Bf-BK5VK.js.map +0 -1
  134. package/lib/XverseCompatibleWalletAdapterImpl-DXKnO_-V.mjs.map +0 -1
  135. package/lib/XverseWalletAdapter.impl-CZO0RQva.mjs.map +0 -1
  136. package/lib/XverseWalletAdapter.impl-lJwMi-Iv.js +0 -2
  137. package/lib/XverseWalletAdapter.impl-lJwMi-Iv.js.map +0 -1
  138. package/lib/index-D7YwhNAG.mjs.map +0 -1
  139. package/lib/index-Zx0KcpYx.js +0 -2
  140. package/lib/index-Zx0KcpYx.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { a as dt, B as Nt, b as zt, W as er } from "./WalletAdapters.types-CnvOqHFH.mjs";
1
+ import { W as Be, a as dt, b as zt } from "./WalletAdapters.types-DBvhI1hu.mjs";
2
2
  function Pt({
3
3
  getPrecondition: t,
4
4
  initializer: e,
@@ -9,18 +9,18 @@ function Pt({
9
9
  o != null && (clearInterval(o), o = null);
10
10
  }, a = (u) => {
11
11
  r = u;
12
- for (const g of i)
13
- g(u);
12
+ for (const y of i)
13
+ y(u);
14
14
  }, f = async () => {
15
15
  if (r != null || s) return;
16
16
  const u = t();
17
17
  if (u != null) {
18
18
  s = !0;
19
19
  try {
20
- const g = await e(u.value);
21
- a(g), c();
22
- } catch (g) {
23
- console.warn("[WalletAdapter] Failed to initialize adapter", g);
20
+ const y = await e(u.value);
21
+ a(y), c();
22
+ } catch (y) {
23
+ console.warn("[WalletAdapter] Failed to initialize adapter", y);
24
24
  } finally {
25
25
  s = !1;
26
26
  }
@@ -39,134 +39,83 @@ function Pt({
39
39
  })
40
40
  };
41
41
  }
42
- const Pn = "bitget.bitcoin", _n = {
42
+ const _n = "bitget.bitcoin", Hn = {
43
43
  name: "Bitget",
44
- iconUrl: import("./bitget-C7oB4Ffq.mjs").then((t) => t.default),
44
+ iconUrl: () => import("./bitget-C7oB4Ffq.mjs").then((t) => t.default),
45
45
  websiteUrl: "https://web3.bitget.com/",
46
46
  downloadUrl: "https://web3.bitget.com/en/wallet-download"
47
- }, Hn = Pt({
47
+ }, Ln = Pt({
48
48
  getPrecondition: () => window.bitkeep?.unisat == null ? null : { value: window.bitkeep.unisat },
49
49
  initializer: async (t) => {
50
- const { BitgetWalletAdapterImpl: e } = await import("./BitgetWalletAdapter.impl-C_HLO7Oi.mjs");
50
+ const { BitgetWalletAdapterImpl: e } = await import("./BitgetWalletAdapter.impl-D8kqiYDi.mjs");
51
51
  return new e(t);
52
52
  }
53
- }), Qs = {
54
- adapterId: Pn,
55
- metadata: _n,
56
- getAdapter: () => Hn
57
- }, Ln = "LeatherProvider.BitcoinProvider", Tn = {
53
+ });
54
+ function ei() {
55
+ return {
56
+ adapterId: _n,
57
+ metadata: Hn,
58
+ getAdapter: () => Ln
59
+ };
60
+ }
61
+ const Tn = "LeatherProvider.BitcoinProvider", Nn = {
58
62
  name: "Leather",
59
- iconUrl: import("./leather-BoQG_CPn.mjs").then((t) => t.default),
63
+ iconUrl: () => import("./leather-BoQG_CPn.mjs").then((t) => t.default),
60
64
  websiteUrl: "https://leather.io/",
61
65
  downloadUrl: "https://leather.io/wallet"
62
- }, Nn = Pt({
66
+ }, Cn = Pt({
63
67
  getPrecondition: () => {
64
68
  const t = window.LeatherProvider?.request;
65
69
  return t == null ? null : { value: t };
66
70
  },
67
71
  initializer: async (t) => {
68
- const { LeatherWalletAdapterImpl: e } = await import("./LeatherWalletAdapter.impl-RUYx555r.mjs");
72
+ const { LeatherWalletAdapterImpl: e } = await import("./LeatherWalletAdapter.impl-B1PoZS7z.mjs");
69
73
  return new e(t);
70
74
  }
71
- }), Js = {
72
- adapterId: Ln,
73
- metadata: Tn,
74
- getAdapter: () => Nn
75
- }, Cn = "magiceden.bitcoin", Dn = (t) => Pt({
75
+ });
76
+ function ri() {
77
+ return {
78
+ adapterId: Tn,
79
+ metadata: Nn,
80
+ getAdapter: () => Cn
81
+ };
82
+ }
83
+ const Dn = "magiceden.bitcoin", Kn = {
84
+ name: "Magic Eden",
85
+ /**
86
+ * https://docs-wallet.magiceden.io/resources/logos-and-brand-assets
87
+ */
88
+ iconUrl: () => import("./magiceden-Cg7d3agI.mjs").then((t) => t.default),
89
+ websiteUrl: "https://wallet.magiceden.io/",
90
+ downloadUrl: "https://wallet.magiceden.io/download"
91
+ }, Vn = (t) => Pt({
76
92
  getPrecondition: () => {
77
93
  const e = window.magicEden?.bitcoin;
78
94
  return e?.isMagicEden ? { value: e } : null;
79
95
  },
80
96
  initializer: async (e) => {
81
- const { MagicEdenWalletAdapterImpl: n } = await import("./MagicEdenWalletAdapter.impl-CrA6SGvG.mjs");
97
+ const { MagicEdenWalletAdapterImpl: n } = await import("./MagicEdenWalletAdapter.impl-B3d5lbkD.mjs");
82
98
  return new n(t, e);
83
99
  }
84
- }), ti = (t) => {
85
- const e = Dn(t);
100
+ }), ni = (t) => {
101
+ const e = Vn(t.network);
86
102
  return {
87
- adapterId: Cn,
88
- /**
89
- * https://docs-wallet.magiceden.io/resources/logos-and-brand-assets
90
- */
91
- metadata: {
92
- name: "Magic Eden",
93
- iconUrl: import("./magiceden-Cg7d3agI.mjs").then((n) => n.default),
94
- websiteUrl: "https://wallet.magiceden.io/",
95
- downloadUrl: "https://wallet.magiceden.io/download"
96
- },
103
+ adapterId: Dn,
104
+ metadata: Kn,
97
105
  getAdapter: () => e
98
106
  };
99
- }, Kn = "okxwallet.bitcoin", Vn = {
100
- name: "OKX Wallet",
101
- iconUrl: import("./okx-DWbHwazu.mjs").then((t) => t.default),
102
- websiteUrl: "https://web3.okx.com/",
103
- downloadUrl: "https://web3.okx.com/download"
104
- }, Mn = Pt({
105
- getPrecondition: () => {
106
- const t = window.okxwallet?.bitcoin;
107
- return t == null ? null : { value: t };
108
- },
109
- initializer: async (t) => {
110
- const { OkxWalletAdapterImpl: e } = await import("./OkxWalletAdapter.impl-BepoUL1B.mjs");
111
- return new e(t);
112
- }
113
- }), ei = {
114
- adapterId: Kn,
115
- metadata: Vn,
116
- getAdapter: () => Mn
117
- }, Wn = "unisat", qn = {
118
- name: "UniSat",
119
- /**
120
- * https://next-cdn.unisat.io/_/2025-v965/UniSat%20Logo.zip
121
- */
122
- iconUrl: import("./unisat-pLgab4nG.mjs").then((t) => t.default),
123
- websiteUrl: "https://unisat.io/",
124
- downloadUrl: "https://unisat.io/download"
125
- }, jn = Pt({
126
- getPrecondition: () => {
127
- const t = window.unisat;
128
- return t == null ? null : { value: t };
129
- },
130
- initializer: async (t) => {
131
- const { UnisatWalletAdapterImpl: e } = await import("./UnisatWalletAdapter.impl-CJB22se8.mjs");
132
- return new e(t);
133
- }
134
- }), ri = {
135
- adapterId: Wn,
136
- metadata: qn,
137
- getAdapter: () => jn
138
- }, Sr = "XverseProviders.BitcoinProvider", Fn = {
139
- name: "Xverse",
140
- iconUrl: import("./xverse-iHLNanCB.mjs").then((t) => t.default),
141
- websiteUrl: "https://xverse.app/",
142
- downloadUrl: "https://www.xverse.app/download"
143
- }, Zn = Pt({
144
- getPrecondition: () => {
145
- const t = (window.btc_providers ?? []).find(
146
- (e) => e.id === Sr
147
- );
148
- return t == null ? null : { value: t };
149
- },
150
- initializer: async () => {
151
- const { XverseWalletAdapterImpl: t } = await import("./XverseWalletAdapter.impl-CZO0RQva.mjs");
152
- return new t();
153
- }
154
- }), ni = {
155
- adapterId: Sr,
156
- metadata: Fn,
157
- getAdapter: () => Zn
158
107
  };
159
- function $t(t) {
108
+ function It(t) {
160
109
  return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
161
110
  }
162
111
  function vr(t) {
163
- if (!$t(t))
112
+ if (!It(t))
164
113
  throw new Error("Uint8Array expected");
165
114
  }
166
- function Ir(t, e) {
115
+ function $r(t, e) {
167
116
  return Array.isArray(e) ? e.length === 0 ? !0 : t ? e.every((n) => typeof n == "string") : e.every((n) => Number.isSafeInteger(n)) : !1;
168
117
  }
169
- function Ne(t) {
118
+ function Ce(t) {
170
119
  if (typeof t != "function")
171
120
  throw new Error("function expected");
172
121
  return !0;
@@ -185,11 +134,11 @@ function ee(t) {
185
134
  throw new Error("array expected");
186
135
  }
187
136
  function re(t, e) {
188
- if (!Ir(!0, e))
137
+ if (!$r(!0, e))
189
138
  throw new Error(`${t}: array of strings expected`);
190
139
  }
191
- function Ce(t, e) {
192
- if (!Ir(!1, e))
140
+ function De(t, e) {
141
+ if (!$r(!1, e))
193
142
  throw new Error(`${t}: array of numbers expected`);
194
143
  }
195
144
  // @__NO_SIDE_EFFECTS__
@@ -225,7 +174,7 @@ function he(t = "") {
225
174
  };
226
175
  }
227
176
  // @__NO_SIDE_EFFECTS__
228
- function zn(t, e = "=") {
177
+ function Mn(t, e = "=") {
229
178
  return _t(t), wt("padding", e), {
230
179
  encode(n) {
231
180
  for (re("padding.encode", n); n.length * t % 8; )
@@ -245,8 +194,8 @@ function zn(t, e = "=") {
245
194
  };
246
195
  }
247
196
  // @__NO_SIDE_EFFECTS__
248
- function Gn(t) {
249
- return Ne(t), { encode: (e) => e, decode: (e) => t(e) };
197
+ function Wn(t) {
198
+ return Ce(t), { encode: (e) => e, decode: (e) => t(e) };
250
199
  }
251
200
  function rr(t, e, n) {
252
201
  if (e < 2)
@@ -264,13 +213,13 @@ function rr(t, e, n) {
264
213
  for (; ; ) {
265
214
  let c = 0, a = !0;
266
215
  for (let f = r; f < i; f++) {
267
- const d = s[f], u = e * c, g = u + d;
268
- if (!Number.isSafeInteger(g) || u / e !== c || g - d !== u)
216
+ const d = s[f], u = e * c, y = u + d;
217
+ if (!Number.isSafeInteger(y) || u / e !== c || y - d !== u)
269
218
  throw new Error("convertRadix: carry overflow");
270
- const l = g / n;
271
- c = g % n;
219
+ const l = y / n;
220
+ c = y % n;
272
221
  const b = Math.floor(l);
273
- if (s[f] = b, !Number.isSafeInteger(b) || b * n + c !== g)
222
+ if (s[f] = b, !Number.isSafeInteger(b) || b * n + c !== y)
274
223
  throw new Error("convertRadix: carry overflow");
275
224
  if (a)
276
225
  b ? a = !1 : r = f;
@@ -283,13 +232,13 @@ function rr(t, e, n) {
283
232
  o.push(0);
284
233
  return o.reverse();
285
234
  }
286
- const $r = (t, e) => e === 0 ? t : $r(e, t % e), ne = /* @__NO_SIDE_EFFECTS__ */ (t, e) => t + (e - $r(t, e)), Jt = /* @__PURE__ */ (() => {
235
+ const Ir = (t, e) => e === 0 ? t : Ir(e, t % e), ne = /* @__NO_SIDE_EFFECTS__ */ (t, e) => t + (e - Ir(t, e)), Jt = /* @__PURE__ */ (() => {
287
236
  let t = [];
288
237
  for (let e = 0; e < 40; e++)
289
238
  t.push(2 ** e);
290
239
  return t;
291
240
  })();
292
- function Re(t, e, n, r) {
241
+ function Ue(t, e, n, r) {
293
242
  if (ee(t), e <= 0 || e > 32)
294
243
  throw new Error(`convertRadix2: wrong from=${e}`);
295
244
  if (n <= 0 || n > 32)
@@ -317,51 +266,51 @@ function Re(t, e, n, r) {
317
266
  return r && s > 0 && a.push(o >>> 0), a;
318
267
  }
319
268
  // @__NO_SIDE_EFFECTS__
320
- function Yn(t) {
269
+ function qn(t) {
321
270
  _t(t);
322
271
  const e = 2 ** 8;
323
272
  return {
324
273
  encode: (n) => {
325
- if (!$t(n))
274
+ if (!It(n))
326
275
  throw new Error("radix.encode input should be Uint8Array");
327
276
  return rr(Array.from(n), e, t);
328
277
  },
329
- decode: (n) => (Ce("radix.decode", n), Uint8Array.from(rr(n, t, e)))
278
+ decode: (n) => (De("radix.decode", n), Uint8Array.from(rr(n, t, e)))
330
279
  };
331
280
  }
332
281
  // @__NO_SIDE_EFFECTS__
333
- function De(t, e = !1) {
282
+ function Ke(t, e = !1) {
334
283
  if (_t(t), t <= 0 || t > 32)
335
284
  throw new Error("radix2: bits should be in (0..32]");
336
285
  if (/* @__PURE__ */ ne(8, t) > 32 || /* @__PURE__ */ ne(t, 8) > 32)
337
286
  throw new Error("radix2: carry overflow");
338
287
  return {
339
288
  encode: (n) => {
340
- if (!$t(n))
289
+ if (!It(n))
341
290
  throw new Error("radix2.encode input should be Uint8Array");
342
- return Re(Array.from(n), 8, t, !e);
291
+ return Ue(Array.from(n), 8, t, !e);
343
292
  },
344
- decode: (n) => (Ce("radix2.decode", n), Uint8Array.from(Re(n, t, 8, e)))
293
+ decode: (n) => (De("radix2.decode", n), Uint8Array.from(Ue(n, t, 8, e)))
345
294
  };
346
295
  }
347
296
  function nr(t) {
348
- return Ne(t), function(...e) {
297
+ return Ce(t), function(...e) {
349
298
  try {
350
299
  return t.apply(null, e);
351
300
  } catch {
352
301
  }
353
302
  };
354
303
  }
355
- function Xn(t, e) {
356
- return _t(t), Ne(e), {
304
+ function jn(t, e) {
305
+ return _t(t), Ce(e), {
357
306
  encode(n) {
358
- if (!$t(n))
307
+ if (!It(n))
359
308
  throw new Error("checksum.encode: input should be Uint8Array");
360
309
  const r = e(n).slice(0, t), o = new Uint8Array(n.length + t);
361
310
  return o.set(n), o.set(r, n.length), o;
362
311
  },
363
312
  decode(n) {
364
- if (!$t(n))
313
+ if (!It(n))
365
314
  throw new Error("checksum.decode: input should be Uint8Array");
366
315
  const r = n.slice(0, -t), o = n.slice(-t), s = e(r).slice(0, t);
367
316
  for (let i = 0; i < t; i++)
@@ -371,21 +320,21 @@ function Xn(t, e) {
371
320
  }
372
321
  };
373
322
  }
374
- const Qn = typeof Uint8Array.from([]).toBase64 == "function" && typeof Uint8Array.fromBase64 == "function", Jn = (t, e) => {
323
+ const Fn = typeof Uint8Array.from([]).toBase64 == "function" && typeof Uint8Array.fromBase64 == "function", Zn = (t, e) => {
375
324
  wt("base64", t);
376
325
  const n = /^[A-Za-z0-9=+/]+$/, r = "base64";
377
326
  if (t.length > 0 && !n.test(t))
378
327
  throw new Error("invalid base64");
379
328
  return Uint8Array.fromBase64(t, { alphabet: r, lastChunkHandling: "strict" });
380
- }, oi = Qn ? {
329
+ }, oi = Fn ? {
381
330
  encode(t) {
382
331
  return vr(t), t.toBase64();
383
332
  },
384
333
  decode(t) {
385
- return Jn(t);
334
+ return Zn(t);
386
335
  }
387
- } : /* @__PURE__ */ Mt(/* @__PURE__ */ De(6), /* @__PURE__ */ de("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ zn(6), /* @__PURE__ */ he("")), to = /* @__NO_SIDE_EFFECTS__ */ (t) => /* @__PURE__ */ Mt(/* @__PURE__ */ Yn(58), /* @__PURE__ */ de(t), /* @__PURE__ */ he("")), eo = /* @__PURE__ */ to("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"), ro = (t) => /* @__PURE__ */ Mt(Xn(4, (e) => t(t(e))), eo), Ue = /* @__PURE__ */ Mt(/* @__PURE__ */ de("qpzry9x8gf2tvdw0s3jn54khce6mua7l"), /* @__PURE__ */ he("")), or = [996825010, 642813549, 513874426, 1027748829, 705979059];
388
- function Ct(t) {
336
+ } : /* @__PURE__ */ Mt(/* @__PURE__ */ Ke(6), /* @__PURE__ */ de("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ Mn(6), /* @__PURE__ */ he("")), zn = /* @__NO_SIDE_EFFECTS__ */ (t) => /* @__PURE__ */ Mt(/* @__PURE__ */ qn(58), /* @__PURE__ */ de(t), /* @__PURE__ */ he("")), Gn = /* @__PURE__ */ zn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"), Yn = (t) => /* @__PURE__ */ Mt(jn(4, (e) => t(t(e))), Gn), ke = /* @__PURE__ */ Mt(/* @__PURE__ */ de("qpzry9x8gf2tvdw0s3jn54khce6mua7l"), /* @__PURE__ */ he("")), or = [996825010, 642813549, 513874426, 1027748829, 705979059];
337
+ function Nt(t) {
389
338
  const e = t >> 25;
390
339
  let n = (t & 33554431) << 5;
391
340
  for (let r = 0; r < or.length; r++)
@@ -399,36 +348,36 @@ function sr(t, e, n = 1) {
399
348
  const i = t.charCodeAt(s);
400
349
  if (i < 33 || i > 126)
401
350
  throw new Error(`Invalid prefix (${t})`);
402
- o = Ct(o) ^ i >> 5;
351
+ o = Nt(o) ^ i >> 5;
403
352
  }
404
- o = Ct(o);
353
+ o = Nt(o);
405
354
  for (let s = 0; s < r; s++)
406
- o = Ct(o) ^ t.charCodeAt(s) & 31;
355
+ o = Nt(o) ^ t.charCodeAt(s) & 31;
407
356
  for (let s of e)
408
- o = Ct(o) ^ s;
357
+ o = Nt(o) ^ s;
409
358
  for (let s = 0; s < 6; s++)
410
- o = Ct(o);
411
- return o ^= n, Ue.encode(Re([o % Jt[30]], 30, 5, !1));
359
+ o = Nt(o);
360
+ return o ^= n, ke.encode(Ue([o % Jt[30]], 30, 5, !1));
412
361
  }
413
362
  // @__NO_SIDE_EFFECTS__
414
363
  function Or(t) {
415
- const e = t === "bech32" ? 1 : 734539939, n = /* @__PURE__ */ De(5), r = n.decode, o = n.encode, s = nr(r);
416
- function i(u, g, l = 90) {
417
- wt("bech32.encode prefix", u), $t(g) && (g = Array.from(g)), Ce("bech32.encode", g);
364
+ const e = t === "bech32" ? 1 : 734539939, n = /* @__PURE__ */ Ke(5), r = n.decode, o = n.encode, s = nr(r);
365
+ function i(u, y, l = 90) {
366
+ wt("bech32.encode prefix", u), It(y) && (y = Array.from(y)), De("bech32.encode", y);
418
367
  const b = u.length;
419
368
  if (b === 0)
420
369
  throw new TypeError(`Invalid prefix length ${b}`);
421
- const v = b + 7 + g.length;
370
+ const v = b + 7 + y.length;
422
371
  if (l !== !1 && v > l)
423
372
  throw new TypeError(`Length ${v} exceeds limit ${l}`);
424
- const S = u.toLowerCase(), O = sr(S, g, e);
425
- return `${S}1${Ue.encode(g)}${O}`;
373
+ const S = u.toLowerCase(), O = sr(S, y, e);
374
+ return `${S}1${ke.encode(y)}${O}`;
426
375
  }
427
- function c(u, g = 90) {
376
+ function c(u, y = 90) {
428
377
  wt("bech32.decode input", u);
429
378
  const l = u.length;
430
- if (l < 8 || g !== !1 && l > g)
431
- throw new TypeError(`invalid string length: ${l} (${u}). Expected (8..${g})`);
379
+ if (l < 8 || y !== !1 && l > y)
380
+ throw new TypeError(`invalid string length: ${l} (${u}). Expected (8..${y})`);
432
381
  const b = u.toLowerCase();
433
382
  if (u !== b && u !== u.toUpperCase())
434
383
  throw new Error("String must be lowercase or uppercase");
@@ -438,18 +387,18 @@ function Or(t) {
438
387
  const S = b.slice(0, v), O = b.slice(v + 1);
439
388
  if (O.length < 6)
440
389
  throw new Error("Data must be at least 6 characters long");
441
- const V = Ue.decode(O).slice(0, -6), F = sr(S, V, e);
390
+ const V = ke.decode(O).slice(0, -6), F = sr(S, V, e);
442
391
  if (!O.endsWith(F))
443
392
  throw new Error(`Invalid checksum in ${u}: expected "${F}"`);
444
393
  return { prefix: S, words: V };
445
394
  }
446
395
  const a = nr(c);
447
396
  function f(u) {
448
- const { prefix: g, words: l } = c(u, !1);
449
- return { prefix: g, words: l, bytes: r(l) };
397
+ const { prefix: y, words: l } = c(u, !1);
398
+ return { prefix: y, words: l, bytes: r(l) };
450
399
  }
451
- function d(u, g) {
452
- return i(u, o(g));
400
+ function d(u, y) {
401
+ return i(u, o(y));
453
402
  }
454
403
  return {
455
404
  encode: i,
@@ -462,22 +411,22 @@ function Or(t) {
462
411
  toWords: o
463
412
  };
464
413
  }
465
- const ke = /* @__PURE__ */ Or("bech32"), Rr = /* @__PURE__ */ Or("bech32m"), no = {
414
+ const Pe = /* @__PURE__ */ Or("bech32"), Rr = /* @__PURE__ */ Or("bech32m"), Xn = {
466
415
  encode: (t) => new TextDecoder().decode(t),
467
416
  decode: (t) => new TextEncoder().encode(t)
468
- }, oo = typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", so = {
417
+ }, Qn = typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", Jn = {
469
418
  encode(t) {
470
419
  return vr(t), t.toHex();
471
420
  },
472
421
  decode(t) {
473
422
  return wt("hex", t), Uint8Array.fromHex(t);
474
423
  }
475
- }, rt = oo ? so : /* @__PURE__ */ Mt(/* @__PURE__ */ De(4), /* @__PURE__ */ de("0123456789abcdef"), /* @__PURE__ */ he(""), /* @__PURE__ */ Gn((t) => {
424
+ }, rt = Qn ? Jn : /* @__PURE__ */ Mt(/* @__PURE__ */ Ke(4), /* @__PURE__ */ de("0123456789abcdef"), /* @__PURE__ */ he(""), /* @__PURE__ */ Wn((t) => {
476
425
  if (typeof t != "string" || t.length % 2 !== 0)
477
426
  throw new TypeError(`hex.decode: expected string, got ${typeof t} with length ${t.length}`);
478
427
  return t.toLowerCase();
479
428
  }));
480
- function Ke(t) {
429
+ function Ve(t) {
481
430
  return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
482
431
  }
483
432
  function mt(t, e = "") {
@@ -487,7 +436,7 @@ function mt(t, e = "") {
487
436
  }
488
437
  }
489
438
  function k(t, e, n = "") {
490
- const r = Ke(t), o = t?.length, s = e !== void 0;
439
+ const r = Ve(t), o = t?.length, s = e !== void 0;
491
440
  if (!r || s && o !== e) {
492
441
  const i = n && `"${n}" `, c = s ? ` of length ${e}` : "", a = r ? `length=${o}` : `type=${typeof t}`;
493
442
  throw new Error(i + "expected Uint8Array" + c + ", got " + a);
@@ -505,7 +454,7 @@ function oe(t, e = !0) {
505
454
  if (e && t.finished)
506
455
  throw new Error("Hash#digest() has already been called");
507
456
  }
508
- function io(t, e) {
457
+ function to(t, e) {
509
458
  k(t, void 0, "digestInto() output");
510
459
  const n = e.outputLen;
511
460
  if (t.length < n)
@@ -515,7 +464,7 @@ function Ot(...t) {
515
464
  for (let e = 0; e < t.length; e++)
516
465
  t[e].fill(0);
517
466
  }
518
- function Be(t) {
467
+ function Se(t) {
519
468
  return new DataView(t.buffer, t.byteOffset, t.byteLength);
520
469
  }
521
470
  function tt(t, e) {
@@ -524,13 +473,13 @@ function tt(t, e) {
524
473
  function Gt(t, e) {
525
474
  return t << e | t >>> 32 - e >>> 0;
526
475
  }
527
- const kr = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", co = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
476
+ const kr = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", eo = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
528
477
  function le(t) {
529
478
  if (k(t), kr)
530
479
  return t.toHex();
531
480
  let e = "";
532
481
  for (let n = 0; n < t.length; n++)
533
- e += co[t[n]];
482
+ e += eo[t[n]];
534
483
  return e;
535
484
  }
536
485
  const st = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
@@ -584,13 +533,13 @@ function pe(t = 32) {
584
533
  throw new Error("crypto.getRandomValues must be defined");
585
534
  return e.getRandomValues(new Uint8Array(t));
586
535
  }
587
- const ao = (t) => ({
536
+ const ro = (t) => ({
588
537
  oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, t])
589
538
  });
590
- function fo(t, e, n) {
539
+ function no(t, e, n) {
591
540
  return t & e ^ ~t & n;
592
541
  }
593
- function uo(t, e, n) {
542
+ function oo(t, e, n) {
594
543
  return t & e ^ t & n ^ e & n;
595
544
  }
596
545
  class _r {
@@ -606,7 +555,7 @@ class _r {
606
555
  pos = 0;
607
556
  destroyed = !1;
608
557
  constructor(e, n, r, o) {
609
- this.blockLen = e, this.outputLen = n, this.padOffset = r, this.isLE = o, this.buffer = new Uint8Array(e), this.view = Be(this.buffer);
558
+ this.blockLen = e, this.outputLen = n, this.padOffset = r, this.isLE = o, this.buffer = new Uint8Array(e), this.view = Se(this.buffer);
610
559
  }
611
560
  update(e) {
612
561
  oe(this), k(e);
@@ -614,7 +563,7 @@ class _r {
614
563
  for (let i = 0; i < s; ) {
615
564
  const c = Math.min(o - this.pos, s - i);
616
565
  if (c === o) {
617
- const a = Be(e);
566
+ const a = Se(e);
618
567
  for (; o <= s - i; i += o)
619
568
  this.process(a, i);
620
569
  continue;
@@ -624,14 +573,14 @@ class _r {
624
573
  return this.length += e.length, this.roundClean(), this;
625
574
  }
626
575
  digestInto(e) {
627
- oe(this), io(e, this), this.finished = !0;
576
+ oe(this), to(e, this), this.finished = !0;
628
577
  const { buffer: n, view: r, blockLen: o, isLE: s } = this;
629
578
  let { pos: i } = this;
630
579
  n[i++] = 128, Ot(this.buffer.subarray(i)), this.padOffset > o - i && (this.process(r, 0), i = 0);
631
580
  for (let u = i; u < o; u++)
632
581
  n[u] = 0;
633
582
  r.setBigUint64(o - 8, BigInt(this.length * 8), s), this.process(r, 0);
634
- const c = Be(e), a = this.outputLen;
583
+ const c = Se(e), a = this.outputLen;
635
584
  if (a % 4)
636
585
  throw new Error("_sha2: outputLen must be aligned to 32bit");
637
586
  const f = a / 4, d = this.get();
@@ -664,7 +613,7 @@ const ht = /* @__PURE__ */ Uint32Array.from([
664
613
  2600822924,
665
614
  528734635,
666
615
  1541459225
667
- ]), ho = /* @__PURE__ */ Uint32Array.from([
616
+ ]), so = /* @__PURE__ */ Uint32Array.from([
668
617
  1116352408,
669
618
  1899447441,
670
619
  3049323471,
@@ -730,7 +679,7 @@ const ht = /* @__PURE__ */ Uint32Array.from([
730
679
  3204031479,
731
680
  3329325298
732
681
  ]), lt = /* @__PURE__ */ new Uint32Array(64);
733
- class lo extends _r {
682
+ class io extends _r {
734
683
  constructor(e) {
735
684
  super(64, e, 8, !1);
736
685
  }
@@ -746,12 +695,12 @@ class lo extends _r {
746
695
  for (let u = 0; u < 16; u++, n += 4)
747
696
  lt[u] = e.getUint32(n, !1);
748
697
  for (let u = 16; u < 64; u++) {
749
- const g = lt[u - 15], l = lt[u - 2], b = tt(g, 7) ^ tt(g, 18) ^ g >>> 3, v = tt(l, 17) ^ tt(l, 19) ^ l >>> 10;
698
+ const y = lt[u - 15], l = lt[u - 2], b = tt(y, 7) ^ tt(y, 18) ^ y >>> 3, v = tt(l, 17) ^ tt(l, 19) ^ l >>> 10;
750
699
  lt[u] = v + lt[u - 7] + b + lt[u - 16] | 0;
751
700
  }
752
701
  let { A: r, B: o, C: s, D: i, E: c, F: a, G: f, H: d } = this;
753
702
  for (let u = 0; u < 64; u++) {
754
- const g = tt(c, 6) ^ tt(c, 11) ^ tt(c, 25), l = d + g + fo(c, a, f) + ho[u] + lt[u] | 0, v = (tt(r, 2) ^ tt(r, 13) ^ tt(r, 22)) + uo(r, o, s) | 0;
703
+ const y = tt(c, 6) ^ tt(c, 11) ^ tt(c, 25), l = d + y + no(c, a, f) + so[u] + lt[u] | 0, v = (tt(r, 2) ^ tt(r, 13) ^ tt(r, 22)) + oo(r, o, s) | 0;
755
704
  d = f, f = a, a = c, c = i + l | 0, i = s, s = o, o = r, r = l + v | 0;
756
705
  }
757
706
  r = r + this.A | 0, o = o + this.B | 0, s = s + this.C | 0, i = i + this.D | 0, c = c + this.E | 0, a = a + this.F | 0, f = f + this.G | 0, d = d + this.H | 0, this.set(r, o, s, i, c, a, f, d);
@@ -763,7 +712,7 @@ class lo extends _r {
763
712
  this.set(0, 0, 0, 0, 0, 0, 0, 0), Ot(this.buffer);
764
713
  }
765
714
  }
766
- class po extends lo {
715
+ class co extends io {
767
716
  // We cannot use array here since array allows indexing by variable
768
717
  // which means optimizer/compiler cannot use registers.
769
718
  A = ht[0] | 0;
@@ -779,10 +728,10 @@ class po extends lo {
779
728
  }
780
729
  }
781
730
  const at = /* @__PURE__ */ Pr(
782
- () => new po(),
783
- /* @__PURE__ */ ao(1)
731
+ () => new co(),
732
+ /* @__PURE__ */ ro(1)
784
733
  );
785
- const Ve = /* @__PURE__ */ BigInt(0), Pe = /* @__PURE__ */ BigInt(1);
734
+ const Me = /* @__PURE__ */ BigInt(0), _e = /* @__PURE__ */ BigInt(1);
786
735
  function ie(t, e = "") {
787
736
  if (typeof t != "boolean") {
788
737
  const n = e && `"${e}" `;
@@ -805,13 +754,13 @@ function Yt(t) {
805
754
  function Lr(t) {
806
755
  if (typeof t != "string")
807
756
  throw new Error("hex string expected, got " + typeof t);
808
- return t === "" ? Ve : BigInt("0x" + t);
757
+ return t === "" ? Me : BigInt("0x" + t);
809
758
  }
810
759
  function ut(t) {
811
760
  return Lr(le(t));
812
761
  }
813
762
  function Tr(t) {
814
- return Lr(le(wo(k(t)).reverse()));
763
+ return Lr(le(ao(k(t)).reverse()));
815
764
  }
816
765
  function we(t, e) {
817
766
  mt(e), t = Hr(t);
@@ -823,10 +772,10 @@ function we(t, e) {
823
772
  function Nr(t, e) {
824
773
  return we(t, e).reverse();
825
774
  }
826
- function wo(t) {
775
+ function ao(t) {
827
776
  return Uint8Array.from(t);
828
777
  }
829
- function go(t) {
778
+ function fo(t) {
830
779
  return Uint8Array.from(t, (e, n) => {
831
780
  const r = e.charCodeAt(0);
832
781
  if (e.length !== 1 || r > 127)
@@ -834,37 +783,37 @@ function go(t) {
834
783
  return r;
835
784
  });
836
785
  }
837
- const te = (t) => typeof t == "bigint" && Ve <= t;
838
- function yo(t, e, n) {
786
+ const te = (t) => typeof t == "bigint" && Me <= t;
787
+ function uo(t, e, n) {
839
788
  return te(t) && te(e) && te(n) && e <= t && t < n;
840
789
  }
841
- function bo(t, e, n, r) {
842
- if (!yo(e, n, r))
790
+ function ho(t, e, n, r) {
791
+ if (!uo(e, n, r))
843
792
  throw new Error("expected valid " + t + ": " + n + " <= n < " + r + ", got " + e);
844
793
  }
845
- function Eo(t) {
794
+ function lo(t) {
846
795
  let e;
847
- for (e = 0; t > Ve; t >>= Pe, e += 1)
796
+ for (e = 0; t > Me; t >>= _e, e += 1)
848
797
  ;
849
798
  return e;
850
799
  }
851
- const Me = (t) => (Pe << BigInt(t)) - Pe;
852
- function mo(t, e, n) {
800
+ const We = (t) => (_e << BigInt(t)) - _e;
801
+ function po(t, e, n) {
853
802
  if (mt(t, "hashLen"), mt(e, "qByteLen"), typeof n != "function")
854
803
  throw new Error("hmacFn must be a function");
855
804
  const r = (S) => new Uint8Array(S), o = Uint8Array.of(), s = Uint8Array.of(0), i = Uint8Array.of(1), c = 1e3;
856
805
  let a = r(t), f = r(t), d = 0;
857
806
  const u = () => {
858
807
  a.fill(1), f.fill(0), d = 0;
859
- }, g = (...S) => n(f, et(a, ...S)), l = (S = o) => {
860
- f = g(s, S), a = g(), S.length !== 0 && (f = g(i, S), a = g());
808
+ }, y = (...S) => n(f, et(a, ...S)), l = (S = o) => {
809
+ f = y(s, S), a = y(), S.length !== 0 && (f = y(i, S), a = y());
861
810
  }, b = () => {
862
811
  if (d++ >= c)
863
812
  throw new Error("drbg: tried max amount of iterations");
864
813
  let S = 0;
865
814
  const O = [];
866
815
  for (; S < e; ) {
867
- a = g();
816
+ a = y();
868
817
  const V = a.slice();
869
818
  O.push(V), S += a.length;
870
819
  }
@@ -878,7 +827,7 @@ function mo(t, e, n) {
878
827
  return u(), V;
879
828
  };
880
829
  }
881
- function We(t, e = {}, n = {}) {
830
+ function qe(t, e = {}, n = {}) {
882
831
  if (!t || typeof t != "object")
883
832
  throw new Error("expected valid options object");
884
833
  function r(s, i, c) {
@@ -902,7 +851,7 @@ function cr(t) {
902
851
  return e.set(n, s), s;
903
852
  };
904
853
  }
905
- const j = /* @__PURE__ */ BigInt(0), q = /* @__PURE__ */ BigInt(1), yt = /* @__PURE__ */ BigInt(2), Cr = /* @__PURE__ */ BigInt(3), Dr = /* @__PURE__ */ BigInt(4), Kr = /* @__PURE__ */ BigInt(5), xo = /* @__PURE__ */ BigInt(7), Vr = /* @__PURE__ */ BigInt(8), Ao = /* @__PURE__ */ BigInt(9), Mr = /* @__PURE__ */ BigInt(16);
854
+ const j = /* @__PURE__ */ BigInt(0), q = /* @__PURE__ */ BigInt(1), gt = /* @__PURE__ */ BigInt(2), Cr = /* @__PURE__ */ BigInt(3), Dr = /* @__PURE__ */ BigInt(4), Kr = /* @__PURE__ */ BigInt(5), wo = /* @__PURE__ */ BigInt(7), Vr = /* @__PURE__ */ BigInt(8), yo = /* @__PURE__ */ BigInt(9), Mr = /* @__PURE__ */ BigInt(16);
906
855
  function X(t, e) {
907
856
  const n = t % e;
908
857
  return n >= j ? n : e + n;
@@ -927,66 +876,66 @@ function ar(t, e) {
927
876
  throw new Error("invert: does not exist");
928
877
  return X(o, e);
929
878
  }
930
- function qe(t, e, n) {
879
+ function je(t, e, n) {
931
880
  if (!t.eql(t.sqr(e), n))
932
881
  throw new Error("Cannot find square root");
933
882
  }
934
883
  function Wr(t, e) {
935
884
  const n = (t.ORDER + q) / Dr, r = t.pow(e, n);
936
- return qe(t, r, e), r;
885
+ return je(t, r, e), r;
937
886
  }
938
- function Bo(t, e) {
939
- const n = (t.ORDER - Kr) / Vr, r = t.mul(e, yt), o = t.pow(r, n), s = t.mul(e, o), i = t.mul(t.mul(s, yt), o), c = t.mul(s, t.sub(i, t.ONE));
940
- return qe(t, c, e), c;
887
+ function go(t, e) {
888
+ const n = (t.ORDER - Kr) / Vr, r = t.mul(e, gt), o = t.pow(r, n), s = t.mul(e, o), i = t.mul(t.mul(s, gt), o), c = t.mul(s, t.sub(i, t.ONE));
889
+ return je(t, c, e), c;
941
890
  }
942
- function So(t) {
943
- const e = ge(t), n = qr(t), r = n(e, e.neg(e.ONE)), o = n(e, r), s = n(e, e.neg(r)), i = (t + xo) / Mr;
891
+ function bo(t) {
892
+ const e = ye(t), n = qr(t), r = n(e, e.neg(e.ONE)), o = n(e, r), s = n(e, e.neg(r)), i = (t + wo) / Mr;
944
893
  return (c, a) => {
945
894
  let f = c.pow(a, i), d = c.mul(f, r);
946
- const u = c.mul(f, o), g = c.mul(f, s), l = c.eql(c.sqr(d), a), b = c.eql(c.sqr(u), a);
947
- f = c.cmov(f, d, l), d = c.cmov(g, u, b);
895
+ const u = c.mul(f, o), y = c.mul(f, s), l = c.eql(c.sqr(d), a), b = c.eql(c.sqr(u), a);
896
+ f = c.cmov(f, d, l), d = c.cmov(y, u, b);
948
897
  const v = c.eql(c.sqr(d), a), S = c.cmov(f, d, v);
949
- return qe(c, S, a), S;
898
+ return je(c, S, a), S;
950
899
  };
951
900
  }
952
901
  function qr(t) {
953
902
  if (t < Cr)
954
903
  throw new Error("sqrt is not defined for small field");
955
904
  let e = t - q, n = 0;
956
- for (; e % yt === j; )
957
- e /= yt, n++;
958
- let r = yt;
959
- const o = ge(t);
905
+ for (; e % gt === j; )
906
+ e /= gt, n++;
907
+ let r = gt;
908
+ const o = ye(t);
960
909
  for (; fr(o, r) === 1; )
961
910
  if (r++ > 1e3)
962
911
  throw new Error("Cannot find square root: probably non-prime P");
963
912
  if (n === 1)
964
913
  return Wr;
965
914
  let s = o.pow(r, e);
966
- const i = (e + q) / yt;
915
+ const i = (e + q) / gt;
967
916
  return function(a, f) {
968
917
  if (a.is0(f))
969
918
  return f;
970
919
  if (fr(a, f) !== 1)
971
920
  throw new Error("Cannot find square root");
972
- let d = n, u = a.mul(a.ONE, s), g = a.pow(f, e), l = a.pow(f, i);
973
- for (; !a.eql(g, a.ONE); ) {
974
- if (a.is0(g))
921
+ let d = n, u = a.mul(a.ONE, s), y = a.pow(f, e), l = a.pow(f, i);
922
+ for (; !a.eql(y, a.ONE); ) {
923
+ if (a.is0(y))
975
924
  return a.ZERO;
976
- let b = 1, v = a.sqr(g);
925
+ let b = 1, v = a.sqr(y);
977
926
  for (; !a.eql(v, a.ONE); )
978
927
  if (b++, v = a.sqr(v), b === d)
979
928
  throw new Error("Cannot find square root");
980
929
  const S = q << BigInt(d - b - 1), O = a.pow(u, S);
981
- d = b, u = a.sqr(O), g = a.mul(g, u), l = a.mul(l, O);
930
+ d = b, u = a.sqr(O), y = a.mul(y, u), l = a.mul(l, O);
982
931
  }
983
932
  return l;
984
933
  };
985
934
  }
986
- function vo(t) {
987
- return t % Dr === Cr ? Wr : t % Vr === Kr ? Bo : t % Mr === Ao ? So(t) : qr(t);
935
+ function Eo(t) {
936
+ return t % Dr === Cr ? Wr : t % Vr === Kr ? go : t % Mr === yo ? bo(t) : qr(t);
988
937
  }
989
- const Io = [
938
+ const mo = [
990
939
  "create",
991
940
  "isValid",
992
941
  "is0",
@@ -1005,15 +954,15 @@ const Io = [
1005
954
  "mulN",
1006
955
  "sqrN"
1007
956
  ];
1008
- function $o(t) {
957
+ function xo(t) {
1009
958
  const e = {
1010
959
  ORDER: "bigint",
1011
960
  BYTES: "number",
1012
961
  BITS: "number"
1013
- }, n = Io.reduce((r, o) => (r[o] = "function", r), e);
1014
- return We(t, n), t;
962
+ }, n = mo.reduce((r, o) => (r[o] = "function", r), e);
963
+ return qe(t, n), t;
1015
964
  }
1016
- function Oo(t, e, n) {
965
+ function Ao(t, e, n) {
1017
966
  if (n < j)
1018
967
  throw new Error("invalid exponent, negatives unsupported");
1019
968
  if (n === j)
@@ -1030,17 +979,17 @@ function jr(t, e, n = !1) {
1030
979
  return e.reduceRight((i, c, a) => t.is0(c) ? i : (r[a] = t.mul(i, r[a]), t.mul(i, c)), s), r;
1031
980
  }
1032
981
  function fr(t, e) {
1033
- const n = (t.ORDER - q) / yt, r = t.pow(e, n), o = t.eql(r, t.ONE), s = t.eql(r, t.ZERO), i = t.eql(r, t.neg(t.ONE));
982
+ const n = (t.ORDER - q) / gt, r = t.pow(e, n), o = t.eql(r, t.ONE), s = t.eql(r, t.ZERO), i = t.eql(r, t.neg(t.ONE));
1034
983
  if (!o && !s && !i)
1035
984
  throw new Error("invalid Legendre symbol result");
1036
985
  return o ? 1 : s ? 0 : -1;
1037
986
  }
1038
- function Ro(t, e) {
987
+ function Bo(t, e) {
1039
988
  e !== void 0 && mt(e);
1040
989
  const n = e !== void 0 ? e : t.toString(2).length, r = Math.ceil(n / 8);
1041
990
  return { nBitLength: n, nByteLength: r };
1042
991
  }
1043
- class Uo {
992
+ class So {
1044
993
  ORDER;
1045
994
  BITS;
1046
995
  BYTES;
@@ -1056,7 +1005,7 @@ class Uo {
1056
1005
  throw new Error("invalid field: expected ORDER > 0, got " + e);
1057
1006
  let r;
1058
1007
  this.isLE = !1, n != null && typeof n == "object" && (typeof n.BITS == "number" && (r = n.BITS), typeof n.sqrt == "function" && (this.sqrt = n.sqrt), typeof n.isLE == "boolean" && (this.isLE = n.isLE), n.allowedLengths && (this._lengths = n.allowedLengths?.slice()), typeof n.modFromBytes == "boolean" && (this._mod = n.modFromBytes));
1059
- const { nBitLength: o, nByteLength: s } = Ro(e, r);
1008
+ const { nBitLength: o, nByteLength: s } = Bo(e, r);
1060
1009
  if (s > 2048)
1061
1010
  throw new Error("invalid field: expected ORDER of <= 2048 bytes");
1062
1011
  this.ORDER = e, this.BITS = o, this.BYTES = s, this._sqrt = void 0, Object.preventExtensions(this);
@@ -1098,7 +1047,7 @@ class Uo {
1098
1047
  return X(e * n, this.ORDER);
1099
1048
  }
1100
1049
  pow(e, n) {
1101
- return Oo(this, e, n);
1050
+ return Ao(this, e, n);
1102
1051
  }
1103
1052
  div(e, n) {
1104
1053
  return X(e * ar(n, this.ORDER), this.ORDER);
@@ -1120,7 +1069,7 @@ class Uo {
1120
1069
  return ar(e, this.ORDER);
1121
1070
  }
1122
1071
  sqrt(e) {
1123
- return this._sqrt || (this._sqrt = vo(this.ORDER)), this._sqrt(this, e);
1072
+ return this._sqrt || (this._sqrt = Eo(this.ORDER)), this._sqrt(this, e);
1124
1073
  }
1125
1074
  toBytes(e) {
1126
1075
  return this.isLE ? Nr(e, this.BYTES) : we(e, this.BYTES);
@@ -1151,8 +1100,8 @@ class Uo {
1151
1100
  return r ? n : e;
1152
1101
  }
1153
1102
  }
1154
- function ge(t, e = {}) {
1155
- return new Uo(t, e);
1103
+ function ye(t, e = {}) {
1104
+ return new So(t, e);
1156
1105
  }
1157
1106
  function Fr(t) {
1158
1107
  if (typeof t != "bigint")
@@ -1185,19 +1134,19 @@ function Gr(t, e) {
1185
1134
  if (!Number.isSafeInteger(t) || t <= 0 || t > e)
1186
1135
  throw new Error("invalid window size, expected [1.." + e + "], got W=" + t);
1187
1136
  }
1188
- function Se(t, e) {
1137
+ function ve(t, e) {
1189
1138
  Gr(t, e);
1190
- const n = Math.ceil(e / t) + 1, r = 2 ** (t - 1), o = 2 ** t, s = Me(t), i = BigInt(t);
1139
+ const n = Math.ceil(e / t) + 1, r = 2 ** (t - 1), o = 2 ** t, s = We(t), i = BigInt(t);
1191
1140
  return { windows: n, windowSize: r, mask: s, maxNumber: o, shiftBy: i };
1192
1141
  }
1193
1142
  function dr(t, e, n) {
1194
1143
  const { windowSize: r, mask: o, maxNumber: s, shiftBy: i } = n;
1195
1144
  let c = Number(t & o), a = t >> i;
1196
1145
  c > r && (c -= s, a += bt);
1197
- const f = e * r, d = f + Math.abs(c) - 1, u = c === 0, g = c < 0, l = e % 2 !== 0;
1198
- return { nextN: a, offset: d, isZero: u, isNeg: g, isNegF: l, offsetF: f };
1146
+ const f = e * r, d = f + Math.abs(c) - 1, u = c === 0, y = c < 0, l = e % 2 !== 0;
1147
+ return { nextN: a, offset: d, isZero: u, isNeg: y, isNegF: l, offsetF: f };
1199
1148
  }
1200
- const ve = /* @__PURE__ */ new WeakMap(), Yr = /* @__PURE__ */ new WeakMap();
1149
+ const $e = /* @__PURE__ */ new WeakMap(), Yr = /* @__PURE__ */ new WeakMap();
1201
1150
  function Ie(t) {
1202
1151
  return Yr.get(t) || 1;
1203
1152
  }
@@ -1205,7 +1154,7 @@ function hr(t) {
1205
1154
  if (t !== Rt)
1206
1155
  throw new Error("invalid wNAF");
1207
1156
  }
1208
- class ko {
1157
+ class vo {
1209
1158
  BASE;
1210
1159
  ZERO;
1211
1160
  Fn;
@@ -1234,7 +1183,7 @@ class ko {
1234
1183
  * @returns precomputed point tables flattened to a single array
1235
1184
  */
1236
1185
  precomputeWindow(e, n) {
1237
- const { windows: r, windowSize: o } = Se(n, this.bits), s = [];
1186
+ const { windows: r, windowSize: o } = ve(n, this.bits), s = [];
1238
1187
  let i = e, c = i;
1239
1188
  for (let a = 0; a < r; a++) {
1240
1189
  c = i, s.push(c);
@@ -1254,10 +1203,10 @@ class ko {
1254
1203
  if (!this.Fn.isValid(r))
1255
1204
  throw new Error("invalid scalar");
1256
1205
  let o = this.ZERO, s = this.BASE;
1257
- const i = Se(e, this.bits);
1206
+ const i = ve(e, this.bits);
1258
1207
  for (let c = 0; c < i.windows; c++) {
1259
- const { nextN: a, offset: f, isZero: d, isNeg: u, isNegF: g, offsetF: l } = dr(r, c, i);
1260
- r = a, d ? s = s.add(ce(g, n[l])) : o = o.add(ce(u, n[f]));
1208
+ const { nextN: a, offset: f, isZero: d, isNeg: u, isNegF: y, offsetF: l } = dr(r, c, i);
1209
+ r = a, d ? s = s.add(ce(y, n[l])) : o = o.add(ce(u, n[f]));
1261
1210
  }
1262
1211
  return hr(r), { p: o, f: s };
1263
1212
  }
@@ -1267,7 +1216,7 @@ class ko {
1267
1216
  * @returns point
1268
1217
  */
1269
1218
  wNAFUnsafe(e, n, r, o = this.ZERO) {
1270
- const s = Se(e, this.bits);
1219
+ const s = ve(e, this.bits);
1271
1220
  for (let i = 0; i < s.windows && r !== Rt; i++) {
1272
1221
  const { nextN: c, offset: a, isZero: f, isNeg: d } = dr(r, i, s);
1273
1222
  if (r = c, !f) {
@@ -1278,8 +1227,8 @@ class ko {
1278
1227
  return hr(r), o;
1279
1228
  }
1280
1229
  getPrecomputes(e, n, r) {
1281
- let o = ve.get(n);
1282
- return o || (o = this.precomputeWindow(n, e), e !== 1 && (typeof r == "function" && (o = r(o)), ve.set(n, o))), o;
1230
+ let o = $e.get(n);
1231
+ return o || (o = this.precomputeWindow(n, e), e !== 1 && (typeof r == "function" && (o = r(o)), $e.set(n, o))), o;
1283
1232
  }
1284
1233
  cached(e, n, r) {
1285
1234
  const o = Ie(e);
@@ -1293,13 +1242,13 @@ class ko {
1293
1242
  // using windowed method. This specifies window size and
1294
1243
  // stores precomputed values. Usually only base point would be precomputed.
1295
1244
  createCache(e, n) {
1296
- Gr(n, this.bits), Yr.set(e, n), ve.delete(e);
1245
+ Gr(n, this.bits), Yr.set(e, n), $e.delete(e);
1297
1246
  }
1298
1247
  hasCache(e) {
1299
1248
  return Ie(e) !== 1;
1300
1249
  }
1301
1250
  }
1302
- function Po(t, e, n, r) {
1251
+ function $o(t, e, n, r) {
1303
1252
  let o = e, s = t.ZERO, i = t.ZERO;
1304
1253
  for (; n > Rt || r > Rt; )
1305
1254
  n & bt && (s = s.add(o)), r & bt && (i = i.add(o)), o = o.double(), n >>= bt, r >>= bt;
@@ -1309,11 +1258,11 @@ function lr(t, e, n) {
1309
1258
  if (e) {
1310
1259
  if (e.ORDER !== t)
1311
1260
  throw new Error("Field.ORDER must match order: Fp == p, Fn == n");
1312
- return $o(e), e;
1261
+ return xo(e), e;
1313
1262
  } else
1314
- return ge(t, { isLE: n });
1263
+ return ye(t, { isLE: n });
1315
1264
  }
1316
- function _o(t, e, n = {}, r) {
1265
+ function Io(t, e, n = {}, r) {
1317
1266
  if (r === void 0 && (r = t === "edwards"), !e || typeof e != "object")
1318
1267
  throw new Error(`expected valid ${t} CURVE object`);
1319
1268
  for (const a of ["p", "n", "h"]) {
@@ -1378,35 +1327,35 @@ class Qr {
1378
1327
  const Jr = (t, e, n) => new Qr(t, e).update(n).digest();
1379
1328
  Jr.create = (t, e) => new Qr(t, e);
1380
1329
  const pr = (t, e) => (t + (t >= 0 ? e : -e) / tn) / e;
1381
- function Ho(t, e, n) {
1330
+ function Oo(t, e, n) {
1382
1331
  const [[r, o], [s, i]] = e, c = pr(i * t, n), a = pr(-o * t, n);
1383
1332
  let f = t - c * r - a * s, d = -c * o - a * i;
1384
- const u = f < it, g = d < it;
1385
- u && (f = -f), g && (d = -d);
1386
- const l = Me(Math.ceil(Eo(n) / 2)) + It;
1333
+ const u = f < it, y = d < it;
1334
+ u && (f = -f), y && (d = -d);
1335
+ const l = We(Math.ceil(lo(n) / 2)) + $t;
1387
1336
  if (f < it || f >= l || d < it || d >= l)
1388
1337
  throw new Error("splitScalar (endomorphism): failed, k=" + t);
1389
- return { k1neg: u, k1: f, k2neg: g, k2: d };
1338
+ return { k1neg: u, k1: f, k2neg: y, k2: d };
1390
1339
  }
1391
- function _e(t) {
1340
+ function He(t) {
1392
1341
  if (!["compact", "recovered", "der"].includes(t))
1393
1342
  throw new Error('Signature format must be "compact", "recovered", or "der"');
1394
1343
  return t;
1395
1344
  }
1396
- function $e(t, e) {
1345
+ function Oe(t, e) {
1397
1346
  const n = {};
1398
1347
  for (let r of Object.keys(e))
1399
1348
  n[r] = t[r] === void 0 ? e[r] : t[r];
1400
- return ie(n.lowS, "lowS"), ie(n.prehash, "prehash"), n.format !== void 0 && _e(n.format), n;
1349
+ return ie(n.lowS, "lowS"), ie(n.prehash, "prehash"), n.format !== void 0 && He(n.format), n;
1401
1350
  }
1402
- class Lo extends Error {
1351
+ class Ro extends Error {
1403
1352
  constructor(e = "") {
1404
1353
  super(e);
1405
1354
  }
1406
1355
  }
1407
1356
  const pt = {
1408
1357
  // asn.1 DER encoding utils
1409
- Err: Lo,
1358
+ Err: Ro,
1410
1359
  // Basic building block is TLV (Tag-Length-Value)
1411
1360
  _tlv: {
1412
1361
  encode: (t, e) => {
@@ -1491,12 +1440,12 @@ const pt = {
1491
1440
  const { _tlv: e, _int: n } = pt, r = e.encode(2, n.encode(t.r)), o = e.encode(2, n.encode(t.s)), s = r + o;
1492
1441
  return e.encode(48, s);
1493
1442
  }
1494
- }, it = BigInt(0), It = BigInt(1), tn = BigInt(2), Xt = BigInt(3), To = BigInt(4);
1495
- function No(t, e = {}) {
1496
- const n = _o("weierstrass", t, e), { Fp: r, Fn: o } = n;
1443
+ }, it = BigInt(0), $t = BigInt(1), tn = BigInt(2), Xt = BigInt(3), Uo = BigInt(4);
1444
+ function ko(t, e = {}) {
1445
+ const n = Io("weierstrass", t, e), { Fp: r, Fn: o } = n;
1497
1446
  let s = n.CURVE;
1498
1447
  const { h: i, n: c } = s;
1499
- We(e, {}, {
1448
+ qe(e, {}, {
1500
1449
  allowInfinityPoint: "boolean",
1501
1450
  clearCofactor: "function",
1502
1451
  isTorsionFree: "function",
@@ -1513,18 +1462,18 @@ function No(t, e = {}) {
1513
1462
  throw new Error("compression is not supported: Field does not have .isOdd()");
1514
1463
  }
1515
1464
  function u(R, w, p) {
1516
- const { x: h, y } = w.toAffine(), m = r.toBytes(h);
1465
+ const { x: h, y: g } = w.toAffine(), m = r.toBytes(h);
1517
1466
  if (ie(p, "isCompressed"), p) {
1518
1467
  d();
1519
- const A = !r.isOdd(y);
1468
+ const A = !r.isOdd(g);
1520
1469
  return et(en(A), m);
1521
1470
  } else
1522
- return et(Uint8Array.of(4), m, r.toBytes(y));
1471
+ return et(Uint8Array.of(4), m, r.toBytes(g));
1523
1472
  }
1524
- function g(R) {
1473
+ function y(R) {
1525
1474
  k(R, void 0, "Point");
1526
- const { publicKey: w, publicKeyUncompressed: p } = f, h = R.length, y = R[0], m = R.subarray(1);
1527
- if (h === w && (y === 2 || y === 3)) {
1475
+ const { publicKey: w, publicKeyUncompressed: p } = f, h = R.length, g = R[0], m = R.subarray(1);
1476
+ if (h === w && (g === 2 || g === 3)) {
1528
1477
  const A = r.fromBytes(m);
1529
1478
  if (!r.isValid(A))
1530
1479
  throw new Error("bad point: is not on curve, wrong x");
@@ -1538,8 +1487,8 @@ function No(t, e = {}) {
1538
1487
  }
1539
1488
  d();
1540
1489
  const B = r.isOdd(E);
1541
- return (y & 1) === 1 !== B && (E = r.neg(E)), { x: A, y: E };
1542
- } else if (h === p && y === 4) {
1490
+ return (g & 1) === 1 !== B && (E = r.neg(E)), { x: A, y: E };
1491
+ } else if (h === p && g === 4) {
1543
1492
  const A = r.BYTES, x = r.fromBytes(m.subarray(0, A)), E = r.fromBytes(m.subarray(A, A * 2));
1544
1493
  if (!S(x, E))
1545
1494
  throw new Error("bad point: is not on curve");
@@ -1547,7 +1496,7 @@ function No(t, e = {}) {
1547
1496
  } else
1548
1497
  throw new Error(`bad point: got length ${h}, expected compressed=${w} or uncompressed=${p}`);
1549
1498
  }
1550
- const l = e.toBytes || u, b = e.fromBytes || g;
1499
+ const l = e.toBytes || u, b = e.fromBytes || y;
1551
1500
  function v(R) {
1552
1501
  const w = r.sqr(R), p = r.mul(w, R);
1553
1502
  return r.add(r.add(p, r.mul(R, s.a)), s.b);
@@ -1558,7 +1507,7 @@ function No(t, e = {}) {
1558
1507
  }
1559
1508
  if (!S(s.Gx, s.Gy))
1560
1509
  throw new Error("bad curve params: generator point");
1561
- const O = r.mul(r.pow(s.a, Xt), To), V = r.mul(r.sqr(s.b), BigInt(27));
1510
+ const O = r.mul(r.pow(s.a, Xt), Uo), V = r.mul(r.sqr(s.b), BigInt(27));
1562
1511
  if (r.is0(r.add(O, V)))
1563
1512
  throw new Error("bad curve params: a or b");
1564
1513
  function F(R, w, p = !1) {
@@ -1573,15 +1522,15 @@ function No(t, e = {}) {
1573
1522
  function C(R) {
1574
1523
  if (!a || !a.basises)
1575
1524
  throw new Error("no endo");
1576
- return Ho(R, a.basises, o.ORDER);
1525
+ return Oo(R, a.basises, o.ORDER);
1577
1526
  }
1578
1527
  const z = cr((R, w) => {
1579
- const { X: p, Y: h, Z: y } = R;
1580
- if (r.eql(y, r.ONE))
1528
+ const { X: p, Y: h, Z: g } = R;
1529
+ if (r.eql(g, r.ONE))
1581
1530
  return { x: p, y: h };
1582
1531
  const m = R.is0();
1583
- w == null && (w = m ? r.ONE : r.inv(y));
1584
- const A = r.mul(p, w), x = r.mul(h, w), E = r.mul(y, w);
1532
+ w == null && (w = m ? r.ONE : r.inv(g));
1533
+ const A = r.mul(p, w), x = r.mul(h, w), E = r.mul(g, w);
1585
1534
  if (m)
1586
1535
  return { x: r.ZERO, y: r.ZERO };
1587
1536
  if (!r.eql(E, r.ONE))
@@ -1602,8 +1551,8 @@ function No(t, e = {}) {
1602
1551
  throw new Error("bad point: not in prime-order subgroup");
1603
1552
  return !0;
1604
1553
  });
1605
- function Tt(R, w, p, h, y) {
1606
- return p = new U(r.mul(p.X, R), p.Y, p.Z), w = ce(h, w), p = ce(y, p), w.add(p);
1554
+ function Tt(R, w, p, h, g) {
1555
+ return p = new U(r.mul(p.X, R), p.Y, p.Z), w = ce(h, w), p = ce(g, p), w.add(p);
1607
1556
  }
1608
1557
  class U {
1609
1558
  // base / generator point
@@ -1654,7 +1603,7 @@ function No(t, e = {}) {
1654
1603
  * @returns
1655
1604
  */
1656
1605
  precompute(w = 8, p = !0) {
1657
- return gt.createCache(this, w), p || this.multiply(Xt), this;
1606
+ return yt.createCache(this, w), p || this.multiply(Xt), this;
1658
1607
  }
1659
1608
  // TODO: return `this`
1660
1609
  /** A point on curve is valid if it conforms to equation. */
@@ -1670,7 +1619,7 @@ function No(t, e = {}) {
1670
1619
  /** Compare one point to another. */
1671
1620
  equals(w) {
1672
1621
  M(w);
1673
- const { X: p, Y: h, Z: y } = this, { X: m, Y: A, Z: x } = w, E = r.eql(r.mul(p, x), r.mul(m, y)), B = r.eql(r.mul(h, x), r.mul(A, y));
1622
+ const { X: p, Y: h, Z: g } = this, { X: m, Y: A, Z: x } = w, E = r.eql(r.mul(p, x), r.mul(m, g)), B = r.eql(r.mul(h, x), r.mul(A, g));
1674
1623
  return E && B;
1675
1624
  }
1676
1625
  /** Flips point to one corresponding to (x, -y) in Affine coordinates. */
@@ -1682,9 +1631,9 @@ function No(t, e = {}) {
1682
1631
  // https://eprint.iacr.org/2015/1060, algorithm 3
1683
1632
  // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
1684
1633
  double() {
1685
- const { a: w, b: p } = s, h = r.mul(p, Xt), { X: y, Y: m, Z: A } = this;
1686
- let x = r.ZERO, E = r.ZERO, B = r.ZERO, I = r.mul(y, y), L = r.mul(m, m), P = r.mul(A, A), $ = r.mul(y, m);
1687
- return $ = r.add($, $), B = r.mul(y, A), B = r.add(B, B), x = r.mul(w, B), E = r.mul(h, P), E = r.add(x, E), x = r.sub(L, E), E = r.add(L, E), E = r.mul(x, E), x = r.mul($, x), B = r.mul(h, B), P = r.mul(w, P), $ = r.sub(I, P), $ = r.mul(w, $), $ = r.add($, B), B = r.add(I, I), I = r.add(B, I), I = r.add(I, P), I = r.mul(I, $), E = r.add(E, I), P = r.mul(m, A), P = r.add(P, P), I = r.mul(P, $), x = r.sub(x, I), B = r.mul(P, L), B = r.add(B, B), B = r.add(B, B), new U(x, E, B);
1634
+ const { a: w, b: p } = s, h = r.mul(p, Xt), { X: g, Y: m, Z: A } = this;
1635
+ let x = r.ZERO, E = r.ZERO, B = r.ZERO, $ = r.mul(g, g), L = r.mul(m, m), P = r.mul(A, A), I = r.mul(g, m);
1636
+ return I = r.add(I, I), B = r.mul(g, A), B = r.add(B, B), x = r.mul(w, B), E = r.mul(h, P), E = r.add(x, E), x = r.sub(L, E), E = r.add(L, E), E = r.mul(x, E), x = r.mul(I, x), B = r.mul(h, B), P = r.mul(w, P), I = r.sub($, P), I = r.mul(w, I), I = r.add(I, B), B = r.add($, $), $ = r.add(B, $), $ = r.add($, P), $ = r.mul($, I), E = r.add(E, $), P = r.mul(m, A), P = r.add(P, P), $ = r.mul(P, I), x = r.sub(x, $), B = r.mul(P, L), B = r.add(B, B), B = r.add(B, B), new U(x, E, B);
1688
1637
  }
1689
1638
  // Renes-Costello-Batina exception-free addition formula.
1690
1639
  // There is 30% faster Jacobian formula, but it is not complete.
@@ -1692,13 +1641,13 @@ function No(t, e = {}) {
1692
1641
  // Cost: 12M + 0S + 3*a + 3*b3 + 23add.
1693
1642
  add(w) {
1694
1643
  M(w);
1695
- const { X: p, Y: h, Z: y } = this, { X: m, Y: A, Z: x } = w;
1696
- let E = r.ZERO, B = r.ZERO, I = r.ZERO;
1644
+ const { X: p, Y: h, Z: g } = this, { X: m, Y: A, Z: x } = w;
1645
+ let E = r.ZERO, B = r.ZERO, $ = r.ZERO;
1697
1646
  const L = s.a, P = r.mul(s.b, Xt);
1698
- let $ = r.mul(p, m), _ = r.mul(h, A), D = r.mul(y, x), J = r.add(p, h), H = r.add(m, A);
1699
- J = r.mul(J, H), H = r.add($, _), J = r.sub(J, H), H = r.add(p, y);
1647
+ let I = r.mul(p, m), _ = r.mul(h, A), D = r.mul(g, x), J = r.add(p, h), H = r.add(m, A);
1648
+ J = r.mul(J, H), H = r.add(I, _), J = r.sub(J, H), H = r.add(p, g);
1700
1649
  let W = r.add(m, x);
1701
- return H = r.mul(H, W), W = r.add($, D), H = r.sub(H, W), W = r.add(h, y), E = r.add(A, x), W = r.mul(W, E), E = r.add(_, D), W = r.sub(W, E), I = r.mul(L, H), E = r.mul(P, D), I = r.add(E, I), E = r.sub(_, I), I = r.add(_, I), B = r.mul(E, I), _ = r.add($, $), _ = r.add(_, $), D = r.mul(L, D), H = r.mul(P, H), _ = r.add(_, D), D = r.sub($, D), D = r.mul(L, D), H = r.add(H, D), $ = r.mul(_, H), B = r.add(B, $), $ = r.mul(W, H), E = r.mul(J, E), E = r.sub(E, $), $ = r.mul(J, _), I = r.mul(W, I), I = r.add(I, $), new U(E, B, I);
1650
+ return H = r.mul(H, W), W = r.add(I, D), H = r.sub(H, W), W = r.add(h, g), E = r.add(A, x), W = r.mul(W, E), E = r.add(_, D), W = r.sub(W, E), $ = r.mul(L, H), E = r.mul(P, D), $ = r.add(E, $), E = r.sub(_, $), $ = r.add(_, $), B = r.mul(E, $), _ = r.add(I, I), _ = r.add(_, I), D = r.mul(L, D), H = r.mul(P, H), _ = r.add(_, D), D = r.sub(I, D), D = r.mul(L, D), H = r.add(H, D), I = r.mul(_, H), B = r.add(B, I), I = r.mul(W, H), E = r.mul(J, E), E = r.sub(E, I), I = r.mul(J, _), $ = r.mul(W, $), $ = r.add($, I), new U(E, B, $);
1702
1651
  }
1703
1652
  subtract(w) {
1704
1653
  return this.add(w.negate());
@@ -1719,16 +1668,16 @@ function No(t, e = {}) {
1719
1668
  const { endo: p } = e;
1720
1669
  if (!o.isValidNot0(w))
1721
1670
  throw new Error("invalid scalar: out of range");
1722
- let h, y;
1723
- const m = (A) => gt.cached(this, A, (x) => ur(U, x));
1671
+ let h, g;
1672
+ const m = (A) => yt.cached(this, A, (x) => ur(U, x));
1724
1673
  if (p) {
1725
- const { k1neg: A, k1: x, k2neg: E, k2: B } = C(w), { p: I, f: L } = m(x), { p: P, f: $ } = m(B);
1726
- y = L.add($), h = Tt(p.beta, I, P, A, E);
1674
+ const { k1neg: A, k1: x, k2neg: E, k2: B } = C(w), { p: $, f: L } = m(x), { p: P, f: I } = m(B);
1675
+ g = L.add(I), h = Tt(p.beta, $, P, A, E);
1727
1676
  } else {
1728
1677
  const { p: A, f: x } = m(w);
1729
- h = A, y = x;
1678
+ h = A, g = x;
1730
1679
  }
1731
- return ur(U, [h, y])[0];
1680
+ return ur(U, [h, g])[0];
1732
1681
  }
1733
1682
  /**
1734
1683
  * Non-constant-time multiplication. Uses double-and-add algorithm.
@@ -1741,15 +1690,15 @@ function No(t, e = {}) {
1741
1690
  throw new Error("invalid scalar: out of range");
1742
1691
  if (w === it || h.is0())
1743
1692
  return U.ZERO;
1744
- if (w === It)
1693
+ if (w === $t)
1745
1694
  return h;
1746
- if (gt.hasCache(this))
1695
+ if (yt.hasCache(this))
1747
1696
  return this.multiply(w);
1748
1697
  if (p) {
1749
- const { k1neg: y, k1: m, k2neg: A, k2: x } = C(w), { p1: E, p2: B } = Po(U, h, m, x);
1750
- return Tt(p.beta, E, B, y, A);
1698
+ const { k1neg: g, k1: m, k2neg: A, k2: x } = C(w), { p1: E, p2: B } = $o(U, h, m, x);
1699
+ return Tt(p.beta, E, B, g, A);
1751
1700
  } else
1752
- return gt.unsafe(h, w);
1701
+ return yt.unsafe(h, w);
1753
1702
  }
1754
1703
  /**
1755
1704
  * Converts Projective point to affine (x, y) coordinates.
@@ -1764,11 +1713,11 @@ function No(t, e = {}) {
1764
1713
  */
1765
1714
  isTorsionFree() {
1766
1715
  const { isTorsionFree: w } = e;
1767
- return i === It ? !0 : w ? w(U, this) : gt.unsafe(this, c).is0();
1716
+ return i === $t ? !0 : w ? w(U, this) : yt.unsafe(this, c).is0();
1768
1717
  }
1769
1718
  clearCofactor() {
1770
1719
  const { clearCofactor: w } = e;
1771
- return i === It ? this : w ? w(U, this) : this.multiplyUnsafe(i);
1720
+ return i === $t ? this : w ? w(U, this) : this.multiplyUnsafe(i);
1772
1721
  }
1773
1722
  isSmallOrder() {
1774
1723
  return this.multiplyUnsafe(i).is0();
@@ -1783,7 +1732,7 @@ function No(t, e = {}) {
1783
1732
  return `<Point ${this.is0() ? "ZERO" : this.toHex()}>`;
1784
1733
  }
1785
1734
  }
1786
- const Ft = o.BITS, gt = new ko(U, e.endo ? Math.ceil(Ft / 2) : Ft);
1735
+ const Ft = o.BITS, yt = new vo(U, e.endo ? Math.ceil(Ft / 2) : Ft);
1787
1736
  return U.BASE.precompute(8), U;
1788
1737
  }
1789
1738
  function en(t) {
@@ -1798,7 +1747,7 @@ function rn(t, e) {
1798
1747
  signature: 2 * e.BYTES
1799
1748
  };
1800
1749
  }
1801
- function Co(t, e = {}) {
1750
+ function Po(t, e = {}) {
1802
1751
  const { Fn: n } = t, r = e.randomBytes || pe, o = Object.assign(rn(t.Fp, n), { seed: Zr(n.ORDER) });
1803
1752
  function s(l) {
1804
1753
  try {
@@ -1825,7 +1774,7 @@ function Co(t, e = {}) {
1825
1774
  }
1826
1775
  function f(l) {
1827
1776
  const { secretKey: b, publicKey: v, publicKeyUncompressed: S } = o;
1828
- if (!Ke(l) || "_lengths" in n && n._lengths || b === v)
1777
+ if (!Ve(l) || "_lengths" in n && n._lengths || b === v)
1829
1778
  return;
1830
1779
  const O = k(l, void 0, "key").length;
1831
1780
  return O === v || O === S;
@@ -1842,25 +1791,25 @@ function Co(t, e = {}) {
1842
1791
  isValidSecretKey: s,
1843
1792
  isValidPublicKey: i,
1844
1793
  randomSecretKey: c
1845
- }, g = Xr(c, a);
1846
- return Object.freeze({ getPublicKey: a, getSharedSecret: d, keygen: g, Point: t, utils: u, lengths: o });
1794
+ }, y = Xr(c, a);
1795
+ return Object.freeze({ getPublicKey: a, getSharedSecret: d, keygen: y, Point: t, utils: u, lengths: o });
1847
1796
  }
1848
- function Do(t, e, n = {}) {
1849
- Ur(e), We(n, {}, {
1797
+ function _o(t, e, n = {}) {
1798
+ Ur(e), qe(n, {}, {
1850
1799
  hmac: "function",
1851
1800
  lowS: "boolean",
1852
1801
  randomBytes: "function",
1853
1802
  bits2int: "function",
1854
1803
  bits2int_modN: "function"
1855
1804
  }), n = Object.assign({}, n);
1856
- const r = n.randomBytes || pe, o = n.hmac || ((p, h) => Jr(e, p, h)), { Fp: s, Fn: i } = t, { ORDER: c, BITS: a } = i, { keygen: f, getPublicKey: d, getSharedSecret: u, utils: g, lengths: l } = Co(t, n), b = {
1805
+ const r = n.randomBytes || pe, o = n.hmac || ((p, h) => Jr(e, p, h)), { Fp: s, Fn: i } = t, { ORDER: c, BITS: a } = i, { keygen: f, getPublicKey: d, getSharedSecret: u, utils: y, lengths: l } = Po(t, n), b = {
1857
1806
  prehash: !0,
1858
1807
  lowS: typeof n.lowS == "boolean" ? n.lowS : !0,
1859
1808
  format: "compact",
1860
1809
  extraEntropy: !1
1861
1810
  }, v = c * tn < s.ORDER;
1862
1811
  function S(p) {
1863
- const h = c >> It;
1812
+ const h = c >> $t;
1864
1813
  return p > h;
1865
1814
  }
1866
1815
  function O(p, h) {
@@ -1873,35 +1822,35 @@ function Do(t, e, n = {}) {
1873
1822
  throw new Error('"recovered" sig type is not supported for cofactor >2 curves');
1874
1823
  }
1875
1824
  function F(p, h) {
1876
- _e(h);
1877
- const y = l.signature, m = h === "compact" ? y : h === "recovered" ? y + 1 : void 0;
1825
+ He(h);
1826
+ const g = l.signature, m = h === "compact" ? g : h === "recovered" ? g + 1 : void 0;
1878
1827
  return k(p, m);
1879
1828
  }
1880
1829
  class M {
1881
1830
  r;
1882
1831
  s;
1883
1832
  recovery;
1884
- constructor(h, y, m) {
1885
- if (this.r = O("r", h), this.s = O("s", y), m != null) {
1833
+ constructor(h, g, m) {
1834
+ if (this.r = O("r", h), this.s = O("s", g), m != null) {
1886
1835
  if (V(), ![0, 1, 2, 3].includes(m))
1887
1836
  throw new Error("invalid recovery id");
1888
1837
  this.recovery = m;
1889
1838
  }
1890
1839
  Object.freeze(this);
1891
1840
  }
1892
- static fromBytes(h, y = b.format) {
1893
- F(h, y);
1841
+ static fromBytes(h, g = b.format) {
1842
+ F(h, g);
1894
1843
  let m;
1895
- if (y === "der") {
1896
- const { r: B, s: I } = pt.toSig(k(h));
1897
- return new M(B, I);
1844
+ if (g === "der") {
1845
+ const { r: B, s: $ } = pt.toSig(k(h));
1846
+ return new M(B, $);
1898
1847
  }
1899
- y === "recovered" && (m = h[0], y = "compact", h = h.subarray(1));
1848
+ g === "recovered" && (m = h[0], g = "compact", h = h.subarray(1));
1900
1849
  const A = l.signature / 2, x = h.subarray(0, A), E = h.subarray(A, A * 2);
1901
1850
  return new M(i.fromBytes(x), i.fromBytes(E), m);
1902
1851
  }
1903
- static fromHex(h, y) {
1904
- return this.fromBytes(se(h), y);
1852
+ static fromHex(h, g) {
1853
+ return this.fromBytes(se(h), g);
1905
1854
  }
1906
1855
  assertRecovery() {
1907
1856
  const { recovery: h } = this;
@@ -1913,10 +1862,10 @@ function Do(t, e, n = {}) {
1913
1862
  return new M(this.r, this.s, h);
1914
1863
  }
1915
1864
  recoverPublicKey(h) {
1916
- const { r: y, s: m } = this, A = this.assertRecovery(), x = A === 2 || A === 3 ? y + c : y;
1865
+ const { r: g, s: m } = this, A = this.assertRecovery(), x = A === 2 || A === 3 ? g + c : g;
1917
1866
  if (!s.isValid(x))
1918
1867
  throw new Error("invalid recovery id: sig.r+curve.n != R.x");
1919
- const E = s.toBytes(x), B = t.fromBytes(et(en((A & 1) === 0), E)), I = i.inv(x), L = z(k(h, void 0, "msgHash")), P = i.create(-L * I), $ = i.create(m * I), _ = t.BASE.multiplyUnsafe(P).add(B.multiplyUnsafe($));
1868
+ const E = s.toBytes(x), B = t.fromBytes(et(en((A & 1) === 0), E)), $ = i.inv(x), L = z(k(h, void 0, "msgHash")), P = i.create(-L * $), I = i.create(m * $), _ = t.BASE.multiplyUnsafe(P).add(B.multiplyUnsafe(I));
1920
1869
  if (_.is0())
1921
1870
  throw new Error("invalid recovery: point at infinify");
1922
1871
  return _.assertValidity(), _;
@@ -1926,9 +1875,9 @@ function Do(t, e, n = {}) {
1926
1875
  return S(this.s);
1927
1876
  }
1928
1877
  toBytes(h = b.format) {
1929
- if (_e(h), h === "der")
1878
+ if (He(h), h === "der")
1930
1879
  return se(pt.hexFromSig(this));
1931
- const { r: y, s: m } = this, A = i.toBytes(y), x = i.toBytes(m);
1880
+ const { r: g, s: m } = this, A = i.toBytes(g), x = i.toBytes(m);
1932
1881
  return h === "recovered" ? (V(), et(Uint8Array.of(this.assertRecovery()), A, x)) : et(A, x);
1933
1882
  }
1934
1883
  toHex(h) {
@@ -1938,30 +1887,30 @@ function Do(t, e, n = {}) {
1938
1887
  const C = n.bits2int || function(h) {
1939
1888
  if (h.length > 8192)
1940
1889
  throw new Error("input is too large");
1941
- const y = ut(h), m = h.length * 8 - a;
1942
- return m > 0 ? y >> BigInt(m) : y;
1890
+ const g = ut(h), m = h.length * 8 - a;
1891
+ return m > 0 ? g >> BigInt(m) : g;
1943
1892
  }, z = n.bits2int_modN || function(h) {
1944
1893
  return i.create(C(h));
1945
- }, Ae = Me(a);
1894
+ }, Ae = We(a);
1946
1895
  function Tt(p) {
1947
- return bo("num < 2^" + a, p, it, Ae), i.toBytes(p);
1896
+ return ho("num < 2^" + a, p, it, Ae), i.toBytes(p);
1948
1897
  }
1949
1898
  function U(p, h) {
1950
1899
  return k(p, void 0, "message"), h ? k(e(p), void 0, "prehashed message") : p;
1951
1900
  }
1952
- function Ft(p, h, y) {
1953
- const { lowS: m, prehash: A, extraEntropy: x } = $e(y, b);
1901
+ function Ft(p, h, g) {
1902
+ const { lowS: m, prehash: A, extraEntropy: x } = Oe(g, b);
1954
1903
  p = U(p, A);
1955
1904
  const E = z(p), B = i.fromBytes(h);
1956
1905
  if (!i.isValidNot0(B))
1957
1906
  throw new Error("invalid private key");
1958
- const I = [Tt(B), Tt(E)];
1907
+ const $ = [Tt(B), Tt(E)];
1959
1908
  if (x != null && x !== !1) {
1960
1909
  const _ = x === !0 ? r(l.secretKey) : x;
1961
- I.push(k(_, void 0, "extraEntropy"));
1910
+ $.push(k(_, void 0, "extraEntropy"));
1962
1911
  }
1963
- const L = et(...I), P = E;
1964
- function $(_) {
1912
+ const L = et(...$), P = E;
1913
+ function I(_) {
1965
1914
  const D = C(_);
1966
1915
  if (!i.isValidNot0(D))
1967
1916
  return;
@@ -1971,51 +1920,51 @@ function Do(t, e, n = {}) {
1971
1920
  const Zt = i.create(J * i.create(P + W * B));
1972
1921
  if (Zt === it)
1973
1922
  return;
1974
- let Je = (H.x === W ? 0 : 2) | Number(H.y & It), tr = Zt;
1975
- return m && S(Zt) && (tr = i.neg(Zt), Je ^= 1), new M(W, tr, v ? void 0 : Je);
1923
+ let tr = (H.x === W ? 0 : 2) | Number(H.y & $t), er = Zt;
1924
+ return m && S(Zt) && (er = i.neg(Zt), tr ^= 1), new M(W, er, v ? void 0 : tr);
1976
1925
  }
1977
- return { seed: L, k2sig: $ };
1926
+ return { seed: L, k2sig: I };
1978
1927
  }
1979
- function gt(p, h, y = {}) {
1980
- const { seed: m, k2sig: A } = Ft(p, h, y);
1981
- return mo(e.outputLen, i.BYTES, o)(m, A).toBytes(y.format);
1928
+ function yt(p, h, g = {}) {
1929
+ const { seed: m, k2sig: A } = Ft(p, h, g);
1930
+ return po(e.outputLen, i.BYTES, o)(m, A).toBytes(g.format);
1982
1931
  }
1983
- function R(p, h, y, m = {}) {
1984
- const { lowS: A, prehash: x, format: E } = $e(m, b);
1985
- if (y = k(y, void 0, "publicKey"), h = U(h, x), !Ke(p)) {
1932
+ function R(p, h, g, m = {}) {
1933
+ const { lowS: A, prehash: x, format: E } = Oe(m, b);
1934
+ if (g = k(g, void 0, "publicKey"), h = U(h, x), !Ve(p)) {
1986
1935
  const B = p instanceof M ? ", use sig.toBytes()" : "";
1987
1936
  throw new Error("verify expects Uint8Array signature" + B);
1988
1937
  }
1989
1938
  F(p, E);
1990
1939
  try {
1991
- const B = M.fromBytes(p, E), I = t.fromBytes(y);
1940
+ const B = M.fromBytes(p, E), $ = t.fromBytes(g);
1992
1941
  if (A && B.hasHighS())
1993
1942
  return !1;
1994
- const { r: L, s: P } = B, $ = z(h), _ = i.inv(P), D = i.create($ * _), J = i.create(L * _), H = t.BASE.multiplyUnsafe(D).add(I.multiplyUnsafe(J));
1943
+ const { r: L, s: P } = B, I = z(h), _ = i.inv(P), D = i.create(I * _), J = i.create(L * _), H = t.BASE.multiplyUnsafe(D).add($.multiplyUnsafe(J));
1995
1944
  return H.is0() ? !1 : i.create(H.x) === L;
1996
1945
  } catch {
1997
1946
  return !1;
1998
1947
  }
1999
1948
  }
2000
- function w(p, h, y = {}) {
2001
- const { prehash: m } = $e(y, b);
1949
+ function w(p, h, g = {}) {
1950
+ const { prehash: m } = Oe(g, b);
2002
1951
  return h = U(h, m), M.fromBytes(p, "recovered").recoverPublicKey(h).toBytes();
2003
1952
  }
2004
1953
  return Object.freeze({
2005
1954
  keygen: f,
2006
1955
  getPublicKey: d,
2007
1956
  getSharedSecret: u,
2008
- utils: g,
1957
+ utils: y,
2009
1958
  lengths: l,
2010
1959
  Point: t,
2011
- sign: gt,
1960
+ sign: yt,
2012
1961
  verify: R,
2013
1962
  recoverPublicKey: w,
2014
1963
  Signature: M,
2015
1964
  hash: e
2016
1965
  });
2017
1966
  }
2018
- const ye = {
1967
+ const ge = {
2019
1968
  p: BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),
2020
1969
  n: BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),
2021
1970
  h: BigInt(1),
@@ -2023,35 +1972,35 @@ const ye = {
2023
1972
  b: BigInt(7),
2024
1973
  Gx: BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
2025
1974
  Gy: BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")
2026
- }, Ko = {
1975
+ }, Ho = {
2027
1976
  beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
2028
1977
  basises: [
2029
1978
  [BigInt("0x3086d221a7d46bcde86c90e49284eb15"), -BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],
2030
1979
  [BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), BigInt("0x3086d221a7d46bcde86c90e49284eb15")]
2031
1980
  ]
2032
- }, Vo = /* @__PURE__ */ BigInt(0), He = /* @__PURE__ */ BigInt(2);
2033
- function Mo(t) {
2034
- const e = ye.p, n = BigInt(3), r = BigInt(6), o = BigInt(11), s = BigInt(22), i = BigInt(23), c = BigInt(44), a = BigInt(88), f = t * t * t % e, d = f * f * t % e, u = G(d, n, e) * d % e, g = G(u, n, e) * d % e, l = G(g, He, e) * f % e, b = G(l, o, e) * l % e, v = G(b, s, e) * b % e, S = G(v, c, e) * v % e, O = G(S, a, e) * S % e, V = G(O, c, e) * v % e, F = G(V, n, e) * d % e, M = G(F, i, e) * b % e, C = G(M, r, e) * f % e, z = G(C, He, e);
1981
+ }, Lo = /* @__PURE__ */ BigInt(0), Le = /* @__PURE__ */ BigInt(2);
1982
+ function To(t) {
1983
+ const e = ge.p, n = BigInt(3), r = BigInt(6), o = BigInt(11), s = BigInt(22), i = BigInt(23), c = BigInt(44), a = BigInt(88), f = t * t * t % e, d = f * f * t % e, u = G(d, n, e) * d % e, y = G(u, n, e) * d % e, l = G(y, Le, e) * f % e, b = G(l, o, e) * l % e, v = G(b, s, e) * b % e, S = G(v, c, e) * v % e, O = G(S, a, e) * S % e, V = G(O, c, e) * v % e, F = G(V, n, e) * d % e, M = G(F, i, e) * b % e, C = G(M, r, e) * f % e, z = G(C, Le, e);
2035
1984
  if (!ae.eql(ae.sqr(z), t))
2036
1985
  throw new Error("Cannot find square root");
2037
1986
  return z;
2038
1987
  }
2039
- const ae = ge(ye.p, { sqrt: Mo }), Bt = /* @__PURE__ */ No(ye, {
1988
+ const ae = ye(ge.p, { sqrt: To }), Bt = /* @__PURE__ */ ko(ge, {
2040
1989
  Fp: ae,
2041
- endo: Ko
2042
- }), vt = /* @__PURE__ */ Do(Bt, at), wr = {};
1990
+ endo: Ho
1991
+ }), vt = /* @__PURE__ */ _o(Bt, at), wr = {};
2043
1992
  function fe(t, ...e) {
2044
1993
  let n = wr[t];
2045
1994
  if (n === void 0) {
2046
- const r = at(go(t));
1995
+ const r = at(fo(t));
2047
1996
  n = et(r, r), wr[t] = n;
2048
1997
  }
2049
1998
  return at(et(n, ...e));
2050
1999
  }
2051
- const je = (t) => t.toBytes(!0).slice(1), Fe = (t) => t % He === Vo;
2052
- function Le(t) {
2000
+ const Fe = (t) => t.toBytes(!0).slice(1), Ze = (t) => t % Le === Lo;
2001
+ function Te(t) {
2053
2002
  const { Fn: e, BASE: n } = Bt, r = e.fromBytes(t), o = n.multiply(r);
2054
- return { scalar: Fe(o.y) ? r : e.neg(r), bytes: je(o) };
2003
+ return { scalar: Ze(o.y) ? r : e.neg(r), bytes: Fe(o) };
2055
2004
  }
2056
2005
  function nn(t) {
2057
2006
  const e = ae;
@@ -2059,7 +2008,7 @@ function nn(t) {
2059
2008
  throw new Error("invalid x: Fail if x ≥ p");
2060
2009
  const n = e.create(t * t), r = e.create(n * t + BigInt(7));
2061
2010
  let o = e.sqrt(r);
2062
- Fe(o) || (o = e.neg(o));
2011
+ Ze(o) || (o = e.neg(o));
2063
2012
  const s = Bt.fromAffine({ x: t, y: o });
2064
2013
  return s.assertValidity(), s;
2065
2014
  }
@@ -2067,12 +2016,12 @@ const Dt = ut;
2067
2016
  function on(...t) {
2068
2017
  return Bt.Fn.create(Dt(fe("BIP0340/challenge", ...t)));
2069
2018
  }
2070
- function gr(t) {
2071
- return Le(t).bytes;
2019
+ function yr(t) {
2020
+ return Te(t).bytes;
2072
2021
  }
2073
- function Wo(t, e, n = pe(32)) {
2074
- const { Fn: r } = Bt, o = k(t, void 0, "message"), { bytes: s, scalar: i } = Le(e), c = k(n, 32, "auxRand"), a = r.toBytes(i ^ Dt(fe("BIP0340/aux", c))), f = fe("BIP0340/nonce", a, s, o), { bytes: d, scalar: u } = Le(f), g = on(d, s, o), l = new Uint8Array(64);
2075
- if (l.set(d, 0), l.set(r.toBytes(r.create(u + g * i)), 32), !sn(l, o, s))
2022
+ function No(t, e, n = pe(32)) {
2023
+ const { Fn: r } = Bt, o = k(t, void 0, "message"), { bytes: s, scalar: i } = Te(e), c = k(n, 32, "auxRand"), a = r.toBytes(i ^ Dt(fe("BIP0340/aux", c))), f = fe("BIP0340/nonce", a, s, o), { bytes: d, scalar: u } = Te(f), y = on(d, s, o), l = new Uint8Array(64);
2024
+ if (l.set(d, 0), l.set(r.toBytes(r.create(u + y * i)), 32), !sn(l, o, s))
2076
2025
  throw new Error("sign: Invalid signature produced");
2077
2026
  return l;
2078
2027
  }
@@ -2085,25 +2034,25 @@ function sn(t, e, n) {
2085
2034
  const u = Dt(i.subarray(32, 64));
2086
2035
  if (!o.isValidNot0(u))
2087
2036
  return !1;
2088
- const g = on(o.toBytes(d), je(f), c), l = s.multiplyUnsafe(u).add(f.multiplyUnsafe(o.neg(g))), { x: b, y: v } = l.toAffine();
2089
- return !(l.is0() || !Fe(v) || b !== d);
2037
+ const y = on(o.toBytes(d), Fe(f), c), l = s.multiplyUnsafe(u).add(f.multiplyUnsafe(o.neg(y))), { x: b, y: v } = l.toAffine();
2038
+ return !(l.is0() || !Ze(v) || b !== d);
2090
2039
  } catch {
2091
2040
  return !1;
2092
2041
  }
2093
2042
  }
2094
2043
  const St = /* @__PURE__ */ (() => {
2095
- const n = (r = pe(48)) => zr(r, ye.n);
2044
+ const n = (r = pe(48)) => zr(r, ge.n);
2096
2045
  return {
2097
- keygen: Xr(n, gr),
2098
- getPublicKey: gr,
2099
- sign: Wo,
2046
+ keygen: Xr(n, yr),
2047
+ getPublicKey: yr,
2048
+ sign: No,
2100
2049
  verify: sn,
2101
2050
  Point: Bt,
2102
2051
  utils: {
2103
2052
  randomSecretKey: n,
2104
2053
  taggedHash: fe,
2105
2054
  lift_x: nn,
2106
- pointToBytes: je
2055
+ pointToBytes: Fe
2107
2056
  },
2108
2057
  lengths: {
2109
2058
  secretKey: 32,
@@ -2113,7 +2062,7 @@ const St = /* @__PURE__ */ (() => {
2113
2062
  seed: 48
2114
2063
  }
2115
2064
  };
2116
- })(), qo = /* @__PURE__ */ Uint8Array.from([
2065
+ })(), Co = /* @__PURE__ */ Uint8Array.from([
2117
2066
  7,
2118
2067
  4,
2119
2068
  13,
@@ -2130,11 +2079,11 @@ const St = /* @__PURE__ */ (() => {
2130
2079
  14,
2131
2080
  11,
2132
2081
  8
2133
- ]), cn = Uint8Array.from(new Array(16).fill(0).map((t, e) => e)), jo = cn.map((t) => (9 * t + 5) % 16), an = /* @__PURE__ */ (() => {
2134
- const n = [[cn], [jo]];
2082
+ ]), cn = Uint8Array.from(new Array(16).fill(0).map((t, e) => e)), Do = cn.map((t) => (9 * t + 5) % 16), an = /* @__PURE__ */ (() => {
2083
+ const n = [[cn], [Do]];
2135
2084
  for (let r = 0; r < 4; r++)
2136
2085
  for (let o of n)
2137
- o.push(o[r].map((s) => qo[s]));
2086
+ o.push(o[r].map((s) => Co[s]));
2138
2087
  return n;
2139
2088
  })(), fn = an[0], un = an[1], dn = /* @__PURE__ */ [
2140
2089
  [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
@@ -2142,24 +2091,24 @@ const St = /* @__PURE__ */ (() => {
2142
2091
  [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
2143
2092
  [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
2144
2093
  [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
2145
- ].map((t) => Uint8Array.from(t)), Fo = /* @__PURE__ */ fn.map((t, e) => t.map((n) => dn[e][n])), Zo = /* @__PURE__ */ un.map((t, e) => t.map((n) => dn[e][n])), zo = /* @__PURE__ */ Uint32Array.from([
2094
+ ].map((t) => Uint8Array.from(t)), Ko = /* @__PURE__ */ fn.map((t, e) => t.map((n) => dn[e][n])), Vo = /* @__PURE__ */ un.map((t, e) => t.map((n) => dn[e][n])), Mo = /* @__PURE__ */ Uint32Array.from([
2146
2095
  0,
2147
2096
  1518500249,
2148
2097
  1859775393,
2149
2098
  2400959708,
2150
2099
  2840853838
2151
- ]), Go = /* @__PURE__ */ Uint32Array.from([
2100
+ ]), Wo = /* @__PURE__ */ Uint32Array.from([
2152
2101
  1352829926,
2153
2102
  1548603684,
2154
2103
  1836072691,
2155
2104
  2053994217,
2156
2105
  0
2157
2106
  ]);
2158
- function yr(t, e, n, r) {
2107
+ function gr(t, e, n, r) {
2159
2108
  return t === 0 ? e ^ n ^ r : t === 1 ? e & n | ~e & r : t === 2 ? (e | ~n) ^ r : t === 3 ? e & r | n & ~r : e ^ (n | ~r);
2160
2109
  }
2161
2110
  const Qt = /* @__PURE__ */ new Uint32Array(16);
2162
- class Yo extends _r {
2111
+ class qo extends _r {
2163
2112
  h0 = 1732584193;
2164
2113
  h1 = -271733879;
2165
2114
  h2 = -1732584194;
@@ -2178,19 +2127,19 @@ class Yo extends _r {
2178
2127
  process(e, n) {
2179
2128
  for (let l = 0; l < 16; l++, n += 4)
2180
2129
  Qt[l] = e.getUint32(n, !0);
2181
- let r = this.h0 | 0, o = r, s = this.h1 | 0, i = s, c = this.h2 | 0, a = c, f = this.h3 | 0, d = f, u = this.h4 | 0, g = u;
2130
+ let r = this.h0 | 0, o = r, s = this.h1 | 0, i = s, c = this.h2 | 0, a = c, f = this.h3 | 0, d = f, u = this.h4 | 0, y = u;
2182
2131
  for (let l = 0; l < 5; l++) {
2183
- const b = 4 - l, v = zo[l], S = Go[l], O = fn[l], V = un[l], F = Fo[l], M = Zo[l];
2132
+ const b = 4 - l, v = Mo[l], S = Wo[l], O = fn[l], V = un[l], F = Ko[l], M = Vo[l];
2184
2133
  for (let C = 0; C < 16; C++) {
2185
- const z = Gt(r + yr(l, s, c, f) + Qt[O[C]] + v, F[C]) + u | 0;
2134
+ const z = Gt(r + gr(l, s, c, f) + Qt[O[C]] + v, F[C]) + u | 0;
2186
2135
  r = u, u = f, f = Gt(c, 10) | 0, c = s, s = z;
2187
2136
  }
2188
2137
  for (let C = 0; C < 16; C++) {
2189
- const z = Gt(o + yr(b, i, a, d) + Qt[V[C]] + S, M[C]) + g | 0;
2190
- o = g, g = d, d = Gt(a, 10) | 0, a = i, i = z;
2138
+ const z = Gt(o + gr(b, i, a, d) + Qt[V[C]] + S, M[C]) + y | 0;
2139
+ o = y, y = d, d = Gt(a, 10) | 0, a = i, i = z;
2191
2140
  }
2192
2141
  }
2193
- this.set(this.h1 + c + d | 0, this.h2 + f + g | 0, this.h3 + u + o | 0, this.h4 + r + i | 0, this.h0 + s + a | 0);
2142
+ this.set(this.h1 + c + d | 0, this.h2 + f + y | 0, this.h3 + u + o | 0, this.h4 + r + i | 0, this.h0 + s + a | 0);
2194
2143
  }
2195
2144
  roundClean() {
2196
2145
  Ot(Qt);
@@ -2199,7 +2148,7 @@ class Yo extends _r {
2199
2148
  this.destroyed = !0, Ot(this.buffer), this.set(0, 0, 0, 0, 0);
2200
2149
  }
2201
2150
  }
2202
- const Xo = /* @__PURE__ */ Pr(() => new Yo()), Qo = /* @__PURE__ */ Uint8Array.of(), si = /* @__PURE__ */ Uint8Array.of(0);
2151
+ const jo = /* @__PURE__ */ Pr(() => new qo()), Fo = /* @__PURE__ */ Uint8Array.of(), si = /* @__PURE__ */ Uint8Array.of(0);
2203
2152
  function Ut(t, e) {
2204
2153
  if (t.length !== e.length)
2205
2154
  return !1;
@@ -2211,7 +2160,7 @@ function Ut(t, e) {
2211
2160
  function Y(t) {
2212
2161
  return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
2213
2162
  }
2214
- function Jo(...t) {
2163
+ function Zo(...t) {
2215
2164
  let e = 0;
2216
2165
  for (let r = 0; r < t.length; r++) {
2217
2166
  const o = t[r];
@@ -2233,10 +2182,10 @@ function Wt(t) {
2233
2182
  function ot(t) {
2234
2183
  return Number.isSafeInteger(t);
2235
2184
  }
2236
- const Ze = {
2185
+ const ze = {
2237
2186
  equalBytes: Ut,
2238
2187
  isBytes: Y,
2239
- concatBytes: Jo
2188
+ concatBytes: Zo
2240
2189
  }, ln = (t) => {
2241
2190
  if (t !== null && typeof t != "string" && !Q(t) && !Y(t) && !ot(t))
2242
2191
  throw new Error(`lengthCoder: expected null | number | Uint8Array | CoderType, got ${t} (${typeof t})`);
@@ -2309,8 +2258,8 @@ const Ze = {
2309
2258
  if (c !== void 0 && !T.set(t, c, s >>> n % i, o))
2310
2259
  return !1;
2311
2260
  const d = c !== void 0 ? c + 1 : n / i, u = f !== void 0 ? f : a / i;
2312
- for (let g = d; g < u; g++)
2313
- if (!T.set(t, g, s, o))
2261
+ for (let y = d; y < u; y++)
2262
+ if (!T.set(t, y, s, o))
2314
2263
  return !1;
2315
2264
  return !(f !== void 0 && c !== f && !T.set(t, f, s << i - a % i, o));
2316
2265
  }
@@ -2353,7 +2302,7 @@ const Ze = {
2353
2302
  return s;
2354
2303
  }
2355
2304
  };
2356
- class ze {
2305
+ class Ge {
2357
2306
  pos = 0;
2358
2307
  data;
2359
2308
  opts;
@@ -2425,7 +2374,7 @@ class ze {
2425
2374
  offsetReader(e) {
2426
2375
  if (e > this.data.length)
2427
2376
  throw this.err("offsetReader: Unexpected end of buffer");
2428
- return new ze(this.absBytes(e), this.opts, this.stack, this, e);
2377
+ return new Ge(this.absBytes(e), this.opts, this.stack, this, e);
2429
2378
  }
2430
2379
  bytes(e, n = !1) {
2431
2380
  if (this.bitPos)
@@ -2481,7 +2430,7 @@ class ze {
2481
2430
  }
2482
2431
  }
2483
2432
  }
2484
- class ts {
2433
+ class zo {
2485
2434
  pos = 0;
2486
2435
  stack;
2487
2436
  // We could have a single buffer here and re-alloc it with
@@ -2560,8 +2509,8 @@ class ts {
2560
2509
  }
2561
2510
  }
2562
2511
  }
2563
- const Te = (t) => Uint8Array.from(t).reverse();
2564
- function es(t, e, n) {
2512
+ const Ne = (t) => Uint8Array.from(t).reverse();
2513
+ function Go(t, e, n) {
2565
2514
  if (n) {
2566
2515
  const r = 2n ** (e - 1n);
2567
2516
  if (t < -r || t >= r)
@@ -2576,11 +2525,11 @@ function pn(t) {
2576
2525
  decodeStream: t.decodeStream,
2577
2526
  size: t.size,
2578
2527
  encode: (e) => {
2579
- const n = new ts();
2528
+ const n = new zo();
2580
2529
  return t.encodeStream(n, e), n.finish();
2581
2530
  },
2582
2531
  decode: (e, n = {}) => {
2583
- const r = new ze(e, n), o = t.decodeStream(r);
2532
+ const r = new Ge(e, n), o = t.decodeStream(r);
2584
2533
  return r.finish(), o;
2585
2534
  }
2586
2535
  };
@@ -2618,7 +2567,7 @@ const Z = (t) => {
2618
2567
  function Q(t) {
2619
2568
  return Wt(t) && Ee(t) && typeof t.encodeStream == "function" && typeof t.decodeStream == "function" && (t.size === void 0 || ot(t.size));
2620
2569
  }
2621
- function rs() {
2570
+ function Yo() {
2622
2571
  return {
2623
2572
  encode: (t) => {
2624
2573
  if (!Array.isArray(t))
@@ -2641,7 +2590,7 @@ function rs() {
2641
2590
  }
2642
2591
  };
2643
2592
  }
2644
- const ns = {
2593
+ const Xo = {
2645
2594
  encode: (t) => {
2646
2595
  if (typeof t != "bigint")
2647
2596
  throw new Error(`expected bigint, got ${typeof t}`);
@@ -2655,7 +2604,7 @@ const ns = {
2655
2604
  return BigInt(t);
2656
2605
  }
2657
2606
  };
2658
- function os(t) {
2607
+ function Qo(t) {
2659
2608
  if (!Wt(t))
2660
2609
  throw new Error("plain object expected");
2661
2610
  return {
@@ -2671,7 +2620,7 @@ function os(t) {
2671
2620
  }
2672
2621
  };
2673
2622
  }
2674
- function ss(t, e = !1) {
2623
+ function Jo(t, e = !1) {
2675
2624
  if (!ot(t))
2676
2625
  throw new Error(`decimal/precision: wrong value ${t}`);
2677
2626
  if (typeof e != "boolean")
@@ -2707,7 +2656,7 @@ function ss(t, e = !1) {
2707
2656
  }
2708
2657
  };
2709
2658
  }
2710
- function is(t) {
2659
+ function ts(t) {
2711
2660
  if (!Array.isArray(t))
2712
2661
  throw new Error(`expected array, got ${typeof t}`);
2713
2662
  for (const e of t)
@@ -2736,7 +2685,7 @@ const wn = (t) => {
2736
2685
  if (!Ee(t))
2737
2686
  throw new Error("BaseCoder expected");
2738
2687
  return { encode: t.decode, decode: t.encode };
2739
- }, gn = { dict: rs, numberBigint: ns, tsEnum: os, decimal: ss, match: is, reverse: wn }, Ge = (t, e = !1, n = !1, r = !0) => {
2688
+ }, yn = { dict: Yo, numberBigint: Xo, tsEnum: Qo, decimal: Jo, match: ts, reverse: wn }, Ye = (t, e = !1, n = !1, r = !0) => {
2740
2689
  if (!ot(t))
2741
2690
  throw new Error(`bigint/size: wrong value ${t}`);
2742
2691
  if (typeof e != "boolean")
@@ -2763,7 +2712,7 @@ const wn = (t) => {
2763
2712
  i.bytes(e ? f.reverse() : f);
2764
2713
  },
2765
2714
  decodeStream: (i) => {
2766
- const c = i.bytes(r ? t : Math.min(t, i.leftBytes)), a = e ? c : Te(c);
2715
+ const c = i.bytes(r ? t : Math.min(t, i.leftBytes)), a = e ? c : Ne(c);
2767
2716
  let f = 0n;
2768
2717
  for (let d = 0; d < a.length; d++)
2769
2718
  f |= BigInt(a[d]) << 8n * BigInt(d);
@@ -2772,10 +2721,10 @@ const wn = (t) => {
2772
2721
  validate: (i) => {
2773
2722
  if (typeof i != "bigint")
2774
2723
  throw new Error(`bigint: invalid value: ${i}`);
2775
- return es(i, 8n * o, !!n), i;
2724
+ return Go(i, 8n * o, !!n), i;
2776
2725
  }
2777
2726
  });
2778
- }, ii = /* @__PURE__ */ Ge(32, !1), cs = /* @__PURE__ */ Ge(8, !0), ci = /* @__PURE__ */ Ge(8, !0, !0), as = (t, e) => Z({
2727
+ }, ii = /* @__PURE__ */ Ye(32, !1), es = /* @__PURE__ */ Ye(8, !0), ci = /* @__PURE__ */ Ye(8, !0, !0), rs = (t, e) => Z({
2779
2728
  size: t,
2780
2729
  encodeStream: (n, r) => n.writeView(t, (o) => e.write(o, r)),
2781
2730
  decodeStream: (n) => n.readView(t, e.read),
@@ -2796,7 +2745,7 @@ const wn = (t) => {
2796
2745
  if (0 > a || a >= i)
2797
2746
  throw new Error(`uintView: value out of bounds. Expected 0 <= ${a} < ${i}`);
2798
2747
  };
2799
- return as(t, {
2748
+ return rs(t, {
2800
2749
  write: n.write,
2801
2750
  read: n.read,
2802
2751
  validate: e ? s : c
@@ -2807,13 +2756,13 @@ const wn = (t) => {
2807
2756
  }), ai = /* @__PURE__ */ qt(4, !1, {
2808
2757
  read: (t, e) => t.getUint32(e, !1),
2809
2758
  write: (t, e) => t.setUint32(0, e, !1)
2810
- }), yn = /* @__PURE__ */ qt(4, !0, {
2759
+ }), gn = /* @__PURE__ */ qt(4, !0, {
2811
2760
  read: (t, e) => t.getInt32(e, !0),
2812
2761
  write: (t, e) => t.setInt32(0, e, !0)
2813
2762
  }), br = /* @__PURE__ */ qt(2, !1, {
2814
2763
  read: (t, e) => t.getUint16(e, !0),
2815
2764
  write: (t, e) => t.setUint16(0, e, !0)
2816
- }), fs = /* @__PURE__ */ qt(1, !1, {
2765
+ }), ns = /* @__PURE__ */ qt(1, !1, {
2817
2766
  read: (t, e) => t.getUint8(e),
2818
2767
  write: (t, e) => t.setUint8(0, e)
2819
2768
  }), jt = (t, e = !1) => {
@@ -2823,7 +2772,7 @@ const wn = (t) => {
2823
2772
  return Z({
2824
2773
  size: typeof t == "number" ? t : void 0,
2825
2774
  encodeStream: (o, s) => {
2826
- r || n.encodeStream(o, s.length), o.bytes(e ? Te(s) : s), r && o.bytes(t);
2775
+ r || n.encodeStream(o, s.length), o.bytes(e ? Ne(s) : s), r && o.bytes(t);
2827
2776
  },
2828
2777
  decodeStream: (o) => {
2829
2778
  let s;
@@ -2834,7 +2783,7 @@ const wn = (t) => {
2834
2783
  s = o.bytes(i - o.pos), o.bytes(t.length);
2835
2784
  } else
2836
2785
  s = o.bytes(t === null ? o.leftBytes : n.decodeStream(o));
2837
- return e ? Te(s) : s;
2786
+ return e ? Ne(s) : s;
2838
2787
  },
2839
2788
  validate: (o) => {
2840
2789
  if (!Y(o))
@@ -2848,7 +2797,7 @@ function fi(t, e) {
2848
2797
  throw new Error(`prefix: invalid inner value ${e}`);
2849
2798
  return kt(jt(t), wn(e));
2850
2799
  }
2851
- const ui = (t, e = !1) => be(kt(jt(t, e), no), (n) => {
2800
+ const ui = (t, e = !1) => be(kt(jt(t, e), Xn), (n) => {
2852
2801
  if (typeof n != "string")
2853
2802
  throw new Error(`expected string, got ${typeof n}`);
2854
2803
  return n;
@@ -2892,7 +2841,7 @@ function kt(t, e) {
2892
2841
  }
2893
2842
  });
2894
2843
  }
2895
- const us = (t, e = !1) => {
2844
+ const os = (t, e = !1) => {
2896
2845
  if (!Y(t))
2897
2846
  throw new Error(`flag/flagValue: expected Uint8Array, got ${typeof t}`);
2898
2847
  if (typeof e != "boolean")
@@ -2913,7 +2862,7 @@ const us = (t, e = !1) => {
2913
2862
  }
2914
2863
  });
2915
2864
  };
2916
- function ds(t, e, n) {
2865
+ function ss(t, e, n) {
2917
2866
  if (!Q(e))
2918
2867
  throw new Error(`flagged: invalid inner value ${e}`);
2919
2868
  return Z({
@@ -3018,7 +2967,7 @@ function li(t) {
3018
2967
  }
3019
2968
  });
3020
2969
  }
3021
- function Ye(t, e) {
2970
+ function Xe(t, e) {
3022
2971
  if (!Q(e))
3023
2972
  throw new Error(`array: invalid inner value ${e}`);
3024
2973
  const n = ln(typeof t == "string" ? `../${t}` : t);
@@ -3070,8 +3019,8 @@ function Ye(t, e) {
3070
3019
  }
3071
3020
  });
3072
3021
  }
3073
- const Ht = vt.Point, Er = Ht.Fn, En = Ht.Fn.ORDER, mn = (t) => t % 2n === 0n, N = Ze.isBytes, xn = Ze.concatBytes, An = Ze.equalBytes, Xe = (t) => Xo(at(t)), pi = (...t) => at(at(xn(...t))), wi = St.getPublicKey, gi = vt.getPublicKey, mr = (t) => t.r < En / 2n;
3074
- function yi(t, e, n = !1) {
3022
+ const Ht = vt.Point, Er = Ht.Fn, En = Ht.Fn.ORDER, mn = (t) => t % 2n === 0n, N = ze.isBytes, xn = ze.concatBytes, An = ze.equalBytes, Qe = (t) => jo(at(t)), pi = (...t) => at(at(xn(...t))), wi = St.getPublicKey, yi = vt.getPublicKey, mr = (t) => t.r < En / 2n;
3023
+ function gi(t, e, n = !1) {
3075
3024
  let r = vt.Signature.fromBytes(vt.sign(t, e, { prehash: !1 }));
3076
3025
  if (n && !mr(r)) {
3077
3026
  const o = new Uint8Array(32);
@@ -3082,11 +3031,11 @@ function yi(t, e, n = !1) {
3082
3031
  }
3083
3032
  return r.toBytes("der");
3084
3033
  }
3085
- const bi = St.sign, hs = St.utils.taggedHash, ct = {
3034
+ const bi = St.sign, is = St.utils.taggedHash, ct = {
3086
3035
  ecdsa: 0,
3087
3036
  schnorr: 1
3088
3037
  };
3089
- function ls(t, e) {
3038
+ function cs(t, e) {
3090
3039
  const n = t.length;
3091
3040
  if (e === ct.ecdsa) {
3092
3041
  if (n === 32)
@@ -3109,16 +3058,16 @@ function Ei(t, e = Uint8Array.of()) {
3109
3058
  const n = St.utils, r = ut(t), o = Ht.BASE.multiply(r), s = mn(o.y) ? r : Er.neg(r), i = n.pointToBytes(o), c = Bn(i, e);
3110
3059
  return we(Er.add(s, c), 32);
3111
3060
  }
3112
- function ps(t, e) {
3061
+ function as(t, e) {
3113
3062
  const n = St.utils, r = Bn(t, e), s = n.lift_x(ut(t)).add(Ht.BASE.multiply(r)), i = mn(s.y) ? 0 : 1;
3114
3063
  return [n.pointToBytes(s), i];
3115
3064
  }
3116
- const ws = at(Ht.BASE.toBytes(!1)), At = {
3065
+ const fs = at(Ht.BASE.toBytes(!1)), At = {
3117
3066
  bech32: "bc",
3118
3067
  pubKeyHash: 0,
3119
3068
  scriptHash: 5,
3120
3069
  wif: 128
3121
- }, gs = {
3070
+ }, us = {
3122
3071
  bech32: "tb",
3123
3072
  pubKeyHash: 111,
3124
3073
  scriptHash: 196,
@@ -3133,7 +3082,7 @@ function mi(t, e) {
3133
3082
  return Math.sign(t[r] - e[r]);
3134
3083
  return Math.sign(t.length - e.length);
3135
3084
  }
3136
- function ys(t) {
3085
+ function ds(t) {
3137
3086
  const e = {};
3138
3087
  for (const n in t) {
3139
3088
  if (e[t[n]] !== void 0)
@@ -3265,7 +3214,7 @@ const K = {
3265
3214
  CHECKSIGADD: 186,
3266
3215
  // Invalid
3267
3216
  INVALID: 255
3268
- }, bs = ys(K);
3217
+ }, hs = ds(K);
3269
3218
  function Sn(t = 6, e = !1) {
3270
3219
  return Z({
3271
3220
  encodeStream: (n, r) => {
@@ -3294,7 +3243,7 @@ function Sn(t = 6, e = !1) {
3294
3243
  }
3295
3244
  });
3296
3245
  }
3297
- function Es(t, e = 4, n = !0) {
3246
+ function ls(t, e = 4, n = !0) {
3298
3247
  if (typeof t == "number")
3299
3248
  return t;
3300
3249
  if (N(t))
@@ -3337,7 +3286,7 @@ const Kt = Z({
3337
3286
  if (n < K.PUSHDATA1)
3338
3287
  r = n;
3339
3288
  else if (n === K.PUSHDATA1)
3340
- r = fs.decodeStream(t);
3289
+ r = ns.decodeStream(t);
3341
3290
  else if (n === K.PUSHDATA2)
3342
3291
  r = br.decodeStream(t);
3343
3292
  else if (n === K.PUSHDATA4)
@@ -3350,7 +3299,7 @@ const Kt = Z({
3350
3299
  else if (K.OP_1 <= n && n <= K.OP_16)
3351
3300
  e.push(n - (K.OP_1 - 1));
3352
3301
  else {
3353
- const r = bs[n];
3302
+ const r = hs[n];
3354
3303
  if (r === void 0)
3355
3304
  throw new Error(`Unknown opcode=${n.toString(16)}`);
3356
3305
  e.push(r);
@@ -3362,7 +3311,7 @@ const Kt = Z({
3362
3311
  253: [253, 2, 253n, 65535n],
3363
3312
  254: [254, 4, 65536n, 4294967295n],
3364
3313
  255: [255, 8, 4294967296n, 18446744073709551615n]
3365
- }, Qe = Z({
3314
+ }, Je = Z({
3366
3315
  encodeStream: (t, e) => {
3367
3316
  if (typeof e == "number" && (e = BigInt(e)), 0n <= e && e <= 252n)
3368
3317
  return t.byte(Number(e));
@@ -3387,7 +3336,7 @@ const Kt = Z({
3387
3336
  throw t.err(`Wrong CompactSize(${8 * r})`);
3388
3337
  return s;
3389
3338
  }
3390
- }), ms = kt(Qe, gn.numberBigint), xe = jt(Qe), xs = Ye(ms, xe), ue = (t) => Ye(Qe, t), vn = me({
3339
+ }), ps = kt(Je, yn.numberBigint), xe = jt(Je), ws = Xe(ps, xe), ue = (t) => Xe(Je, t), vn = me({
3391
3340
  txid: jt(32, !0),
3392
3341
  // hash(prev_tx),
3393
3342
  index: xt,
@@ -3396,28 +3345,28 @@ const Kt = Z({
3396
3345
  // btc merges input and output script, executes it. If ok = tx passes
3397
3346
  sequence: xt
3398
3347
  // ?
3399
- }), In = me({ amount: cs, script: xe }), As = me({
3400
- version: yn,
3401
- segwitFlag: us(new Uint8Array([0, 1])),
3348
+ }), $n = me({ amount: es, script: xe }), ys = me({
3349
+ version: gn,
3350
+ segwitFlag: os(new Uint8Array([0, 1])),
3402
3351
  inputs: ue(vn),
3403
- outputs: ue(In),
3404
- witnesses: ds("segwitFlag", Ye("inputs/length", xs)),
3352
+ outputs: ue($n),
3353
+ witnesses: ss("segwitFlag", Xe("inputs/length", ws)),
3405
3354
  // < 500000000 Block number at which this transaction is unlocked
3406
3355
  // >= 500000000 UNIX timestamp at which this transaction is unlocked
3407
3356
  // Handled as part of PSBTv2
3408
3357
  lockTime: xt
3409
3358
  });
3410
- function Bs(t) {
3359
+ function gs(t) {
3411
3360
  if (t.segwitFlag && t.witnesses && !t.witnesses.length)
3412
3361
  throw new Error("Segwit flag with empty witnesses array");
3413
3362
  return t;
3414
3363
  }
3415
- const xi = be(As, Bs), Ai = me({
3416
- version: yn,
3364
+ const xi = be(ys, gs), Ai = me({
3365
+ version: gn,
3417
3366
  inputs: ue(vn),
3418
- outputs: ue(In),
3367
+ outputs: ue($n),
3419
3368
  lockTime: xt
3420
- }), Ss = {
3369
+ }), bs = {
3421
3370
  encode(t) {
3422
3371
  if (!(t.length !== 2 || t[0] !== 1 || !N(t[1]) || rt.encode(t[1]) !== "4e73"))
3423
3372
  return { type: "p2a", script: Kt.encode(t) };
@@ -3429,42 +3378,42 @@ const xi = be(As, Bs), Ai = me({
3429
3378
  };
3430
3379
  function Et(t, e) {
3431
3380
  try {
3432
- return ls(t, e), !0;
3381
+ return cs(t, e), !0;
3433
3382
  } catch {
3434
3383
  return !1;
3435
3384
  }
3436
3385
  }
3437
- const vs = {
3386
+ const Es = {
3438
3387
  encode(t) {
3439
3388
  if (!(t.length !== 2 || !N(t[0]) || !Et(t[0], ct.ecdsa) || t[1] !== "CHECKSIG"))
3440
3389
  return { type: "pk", pubkey: t[0] };
3441
3390
  },
3442
3391
  decode: (t) => t.type === "pk" ? [t.pubkey, "CHECKSIG"] : void 0
3443
- }, Is = {
3392
+ }, ms = {
3444
3393
  encode(t) {
3445
3394
  if (!(t.length !== 5 || t[0] !== "DUP" || t[1] !== "HASH160" || !N(t[2])) && !(t[3] !== "EQUALVERIFY" || t[4] !== "CHECKSIG"))
3446
3395
  return { type: "pkh", hash: t[2] };
3447
3396
  },
3448
3397
  decode: (t) => t.type === "pkh" ? ["DUP", "HASH160", t.hash, "EQUALVERIFY", "CHECKSIG"] : void 0
3449
- }, $s = {
3398
+ }, xs = {
3450
3399
  encode(t) {
3451
3400
  if (!(t.length !== 3 || t[0] !== "HASH160" || !N(t[1]) || t[2] !== "EQUAL"))
3452
3401
  return { type: "sh", hash: t[1] };
3453
3402
  },
3454
3403
  decode: (t) => t.type === "sh" ? ["HASH160", t.hash, "EQUAL"] : void 0
3455
- }, Os = {
3404
+ }, As = {
3456
3405
  encode(t) {
3457
3406
  if (!(t.length !== 2 || t[0] !== 0 || !N(t[1])) && t[1].length === 32)
3458
3407
  return { type: "wsh", hash: t[1] };
3459
3408
  },
3460
3409
  decode: (t) => t.type === "wsh" ? [0, t.hash] : void 0
3461
- }, Rs = {
3410
+ }, Bs = {
3462
3411
  encode(t) {
3463
3412
  if (!(t.length !== 2 || t[0] !== 0 || !N(t[1])) && t[1].length === 20)
3464
3413
  return { type: "wpkh", hash: t[1] };
3465
3414
  },
3466
3415
  decode: (t) => t.type === "wpkh" ? [0, t.hash] : void 0
3467
- }, Us = {
3416
+ }, Ss = {
3468
3417
  encode(t) {
3469
3418
  const e = t.length - 1;
3470
3419
  if (t[e] !== "CHECKMULTISIG")
@@ -3482,13 +3431,13 @@ const vs = {
3482
3431
  },
3483
3432
  // checkmultisig(n, ..pubkeys, m)
3484
3433
  decode: (t) => t.type === "ms" ? [t.m, ...t.pubkeys, t.pubkeys.length, "CHECKMULTISIG"] : void 0
3485
- }, ks = {
3434
+ }, vs = {
3486
3435
  encode(t) {
3487
3436
  if (!(t.length !== 2 || t[0] !== 1 || !N(t[1])))
3488
3437
  return { type: "tr", pubkey: t[1] };
3489
3438
  },
3490
3439
  decode: (t) => t.type === "tr" ? [1, t.pubkey] : void 0
3491
- }, Ps = {
3440
+ }, $s = {
3492
3441
  encode(t) {
3493
3442
  const e = t.length - 1;
3494
3443
  if (t[e] !== "CHECKSIG")
@@ -3515,12 +3464,12 @@ const vs = {
3515
3464
  e.push(t.pubkeys[n], "CHECKSIGVERIFY");
3516
3465
  return e.push(t.pubkeys[t.pubkeys.length - 1], "CHECKSIG"), e;
3517
3466
  }
3518
- }, _s = {
3467
+ }, Is = {
3519
3468
  encode(t) {
3520
3469
  const e = t.length - 1;
3521
3470
  if (t[e] !== "NUMEQUAL" || t[1] !== "CHECKSIG")
3522
3471
  return;
3523
- const n = [], r = Es(t[e - 1]);
3472
+ const n = [], r = ls(t[e - 1]);
3524
3473
  if (typeof r == "number") {
3525
3474
  for (let o = 0; o < e - 1; o++) {
3526
3475
  const s = t[o];
@@ -3544,24 +3493,24 @@ const vs = {
3544
3493
  e.push(t.pubkeys[n], "CHECKSIGADD");
3545
3494
  return e.push(t.m, "NUMEQUAL"), e;
3546
3495
  }
3547
- }, Hs = {
3496
+ }, Os = {
3548
3497
  encode(t) {
3549
3498
  return { type: "unknown", script: Kt.encode(t) };
3550
3499
  },
3551
3500
  decode: (t) => t.type === "unknown" ? Kt.decode(t.script) : void 0
3552
- }, Ls = [
3501
+ }, Rs = [
3502
+ bs,
3503
+ Es,
3504
+ ms,
3505
+ xs,
3506
+ As,
3507
+ Bs,
3553
3508
  Ss,
3554
3509
  vs,
3555
- Is,
3556
3510
  $s,
3557
- Os,
3558
- Rs,
3559
- Us,
3560
- ks,
3561
- Ps,
3562
- _s,
3563
- Hs
3564
- ], Ts = kt(Kt, gn.match(Ls)), nt = be(Ts, (t) => {
3511
+ Is,
3512
+ Os
3513
+ ], Us = kt(Kt, yn.match(Rs)), nt = be(Us, (t) => {
3565
3514
  if (t.type === "pk" && !Et(t.pubkey, ct.ecdsa))
3566
3515
  throw new Error("OutScript/pk: wrong key");
3567
3516
  if ((t.type === "pkh" || t.type === "sh" || t.type === "wpkh") && (!N(t.hash) || t.hash.length !== 20))
@@ -3601,13 +3550,13 @@ function Ar(t, e) {
3601
3550
  if (n.type === "wpkh" || n.type === "sh")
3602
3551
  throw new Error(`checkScript: P2${n.type} cannot be wrapped in P2WSH`);
3603
3552
  }
3604
- function Ns(t, e, n) {
3553
+ function ks(t, e, n) {
3605
3554
  if (t) {
3606
3555
  const r = nt.decode(t);
3607
3556
  if (r.type === "tr_ns" || r.type === "tr_ms" || r.type === "ms" || r.type == "pk")
3608
3557
  throw new Error(`checkScript: non-wrapped ${r.type}`);
3609
3558
  if (r.type === "sh" && e) {
3610
- if (!An(r.hash, Xe(e)))
3559
+ if (!An(r.hash, Qe(e)))
3611
3560
  throw new Error("checkScript: sh wrong redeemScript hash");
3612
3561
  const o = nt.decode(e);
3613
3562
  if (o.type === "tr" || o.type === "tr_ns" || o.type === "tr_ms")
@@ -3622,12 +3571,12 @@ function Ns(t, e, n) {
3622
3571
  r.type === "wsh" && n && Ar(r, n);
3623
3572
  }
3624
3573
  }
3625
- const Cs = (t, e = At) => {
3574
+ const Ps = (t, e = At) => {
3626
3575
  const n = t.script;
3627
3576
  if (!N(n))
3628
3577
  throw new Error(`Wrong script: ${typeof t.script}, expected Uint8Array`);
3629
- const r = Xe(n), o = nt.encode({ type: "sh", hash: r });
3630
- return Ns(o, n, t.witnessScript), t.witnessScript ? {
3578
+ const r = Qe(n), o = nt.encode({ type: "sh", hash: r });
3579
+ return ks(o, n, t.witnessScript), t.witnessScript ? {
3631
3580
  type: "sh",
3632
3581
  redeemScript: n,
3633
3582
  script: nt.encode({ type: "sh", hash: r }),
@@ -3641,27 +3590,27 @@ const Cs = (t, e = At) => {
3641
3590
  address: Vt(e).encode({ type: "sh", hash: r }),
3642
3591
  hash: r
3643
3592
  };
3644
- }, Ds = (t, e = At) => {
3593
+ }, _s = (t, e = At) => {
3645
3594
  if (!Et(t, ct.ecdsa))
3646
3595
  throw new Error("P2WPKH: invalid publicKey");
3647
3596
  if (t.length === 65)
3648
3597
  throw new Error("P2WPKH: uncompressed public key");
3649
- const n = Xe(t);
3598
+ const n = Qe(t);
3650
3599
  return {
3651
3600
  type: "wpkh",
3652
3601
  script: nt.encode({ type: "wpkh", hash: n }),
3653
3602
  address: Vt(e).encode({ type: "wpkh", hash: n }),
3654
3603
  hash: n
3655
3604
  };
3656
- }, Ks = 192, Bi = (t, e = Ks) => hs("TapLeaf", new Uint8Array([e]), xe.encode(t));
3657
- function Vs(t, e, n = At, r = !1, o) {
3605
+ }, Hs = 192, Bi = (t, e = Hs) => is("TapLeaf", new Uint8Array([e]), xe.encode(t));
3606
+ function Ls(t, e, n = At, r = !1, o) {
3658
3607
  if (!t)
3659
3608
  throw new Error("p2tr: should have pubKey or scriptTree (or both)");
3660
- const s = typeof t == "string" ? rt.decode(t) : t || ws;
3609
+ const s = typeof t == "string" ? rt.decode(t) : t || fs;
3661
3610
  if (!Et(s, ct.schnorr))
3662
3611
  throw new Error("p2tr: non-schnorr pubkey");
3663
3612
  {
3664
- const i = ps(s, Qo)[0];
3613
+ const i = as(s, Fo)[0];
3665
3614
  return {
3666
3615
  type: "tr",
3667
3616
  script: nt.encode({ type: "tr", pubkey: i }),
@@ -3673,7 +3622,7 @@ function Vs(t, e, n = At, r = !1, o) {
3673
3622
  };
3674
3623
  }
3675
3624
  }
3676
- const $n = ro(at);
3625
+ const In = Yn(at);
3677
3626
  function On(t, e) {
3678
3627
  if (e.length < 2 || e.length > 40)
3679
3628
  throw new Error("Witness: invalid length");
@@ -3682,24 +3631,24 @@ function On(t, e) {
3682
3631
  if (t === 0 && !(e.length === 20 || e.length === 32))
3683
3632
  throw new Error("Witness: invalid length for version");
3684
3633
  }
3685
- function Oe(t, e, n = At) {
3634
+ function Re(t, e, n = At) {
3686
3635
  On(t, e);
3687
- const r = t === 0 ? ke : Rr;
3636
+ const r = t === 0 ? Pe : Rr;
3688
3637
  return r.encode(n.bech32, [t].concat(r.toWords(e)));
3689
3638
  }
3690
3639
  function Br(t, e) {
3691
- return $n.encode(xn(Uint8Array.from(e), t));
3640
+ return In.encode(xn(Uint8Array.from(e), t));
3692
3641
  }
3693
3642
  function Vt(t = At) {
3694
3643
  return {
3695
3644
  encode(e) {
3696
3645
  const { type: n } = e;
3697
3646
  if (n === "wpkh")
3698
- return Oe(0, e.hash, t);
3647
+ return Re(0, e.hash, t);
3699
3648
  if (n === "wsh")
3700
- return Oe(0, e.hash, t);
3649
+ return Re(0, e.hash, t);
3701
3650
  if (n === "tr")
3702
- return Oe(1, e.pubkey, t);
3651
+ return Re(1, e.pubkey, t);
3703
3652
  if (n === "pkh")
3704
3653
  return Br(e.hash, [t.pubKeyHash]);
3705
3654
  if (n === "sh")
@@ -3712,7 +3661,7 @@ function Vt(t = At) {
3712
3661
  if (t.bech32 && e.toLowerCase().startsWith(`${t.bech32}1`)) {
3713
3662
  let r;
3714
3663
  try {
3715
- if (r = ke.decode(e), r.words[0] !== 0)
3664
+ if (r = Pe.decode(e), r.words[0] !== 0)
3716
3665
  throw new Error(`bech32: wrong version=${r.words[0]}`);
3717
3666
  } catch {
3718
3667
  if (r = Rr.decode(e), r.words[0] === 0)
@@ -3720,7 +3669,7 @@ function Vt(t = At) {
3720
3669
  }
3721
3670
  if (r.prefix !== t.bech32)
3722
3671
  throw new Error(`wrong bech32 prefix=${r.prefix}`);
3723
- const [o, ...s] = r.words, i = ke.fromWords(s);
3672
+ const [o, ...s] = r.words, i = Pe.fromWords(s);
3724
3673
  if (On(o, i), o === 0 && i.length === 32)
3725
3674
  return { type: "wsh", hash: i };
3726
3675
  if (o === 0 && i.length === 20)
@@ -3729,7 +3678,7 @@ function Vt(t = At) {
3729
3678
  return { type: "tr", pubkey: i };
3730
3679
  throw new Error("Unknown witness program");
3731
3680
  }
3732
- const n = $n.decode(e);
3681
+ const n = In.decode(e);
3733
3682
  if (n.length !== 21)
3734
3683
  throw new Error("Invalid base58 address");
3735
3684
  if (n[0] === t.pubKeyHash)
@@ -3743,19 +3692,19 @@ function Vt(t = At) {
3743
3692
  }
3744
3693
  };
3745
3694
  }
3746
- function Si(t) {
3747
- return t === "mainnet" ? At : t === "testnet" ? gs : At;
3695
+ function Sr(t) {
3696
+ return t === "mainnet" ? At : t === "testnet" ? us : At;
3748
3697
  }
3749
3698
  function Lt(t) {
3750
3699
  return t.bech32 === "bc";
3751
3700
  }
3752
- function Ms(t, e) {
3753
- return Ws(t, e) ? "p2pkh" : qs(t, e) ? "p2sh" : Rn(t, e) ? "p2wpkh" : js(t, e) ? "p2wsh" : Un(t, e) ? "p2tr" : "unknown";
3701
+ function Ts(t, e) {
3702
+ return Ns(t, e) ? "p2pkh" : Cs(t, e) ? "p2sh" : Rn(t, e) ? "p2wpkh" : Ds(t, e) ? "p2wsh" : Un(t, e) ? "p2tr" : "unknown";
3754
3703
  }
3755
- function Ws(t, e) {
3704
+ function Ns(t, e) {
3756
3705
  return Lt(t) ? e.startsWith("1") : e.startsWith("m") || e.startsWith("n");
3757
3706
  }
3758
- function qs(t, e) {
3707
+ function Cs(t, e) {
3759
3708
  return Lt(t) ? e.startsWith("3") : e.startsWith("2");
3760
3709
  }
3761
3710
  function Rn(t, e) {
@@ -3764,38 +3713,67 @@ function Rn(t, e) {
3764
3713
  function Un(t, e) {
3765
3714
  return Lt(t) ? e.startsWith("bc1p") : e.startsWith("tb1p");
3766
3715
  }
3767
- function js(t, e) {
3716
+ function Ds(t, e) {
3768
3717
  return Un(t, e) || Rn(t, e) ? !1 : Lt(t) ? e.startsWith("bc1") : e.startsWith("tb1");
3769
3718
  }
3770
- function Fs(t, e) {
3719
+ function Ks(t, e) {
3771
3720
  if (e.byteLength !== 33)
3772
3721
  throw new Error("Invalid public key length");
3773
3722
  return e.slice(1);
3774
3723
  }
3775
- function vi(t, e) {
3776
- return Vs(
3777
- Fs(t, e),
3724
+ function Si(t, e) {
3725
+ return Ls(
3726
+ Ks(t, e),
3778
3727
  void 0,
3779
3728
  t
3780
3729
  ).tapInternalKey;
3781
3730
  }
3782
- function Ii(t, e) {
3783
- return Cs(Ds(e, t), t).redeemScript;
3731
+ function vi(t, e) {
3732
+ return Ps(_s(e, t), t).redeemScript;
3784
3733
  }
3785
- function Zs(t, e) {
3734
+ function Vs(t, e) {
3786
3735
  const n = Vt(t).decode(e);
3787
3736
  return nt.encode(n);
3788
3737
  }
3789
- function zs(t, e) {
3790
- return rt.encode(Zs(t, e));
3738
+ function Ms(t, e) {
3739
+ return rt.encode(Vs(t, e));
3740
+ }
3741
+ class Ct extends Error {
3742
+ constructor(e, n) {
3743
+ super(e, n), this.name = "BitcoinWalletAdapterError";
3744
+ }
3745
+ }
3746
+ class $i extends Ct {
3747
+ constructor(e, n) {
3748
+ super(e, n), this.name = "UserRejectError";
3749
+ }
3791
3750
  }
3792
- const Gs = "0000000000000000000000000000000000000000000000000000000000000000", kn = "0000000000000000000000000000000000000000000000000000000000000000", Ys = rt.encode(
3751
+ const Ws = "0000000000000000000000000000000000000000000000000000000000000000", kn = "0000000000000000000000000000000000000000000000000000000000000000", qs = rt.encode(
3793
3752
  Kt.encode(["OP_1", rt.decode(kn), "OP_1", "CHECKMULTISIG"])
3794
- );
3795
- class $i {
3753
+ ), Ii = (t, e, n) => ({
3754
+ adapterId: `mocked.${e.adapterId}`,
3755
+ metadata: {
3756
+ ...e.metadata,
3757
+ name: `Mocked ${e.metadata.name}`
3758
+ },
3759
+ getAdapter() {
3760
+ const r = e.getAdapter();
3761
+ return {
3762
+ subscribe(o) {
3763
+ return r.subscribe((s) => {
3764
+ o(
3765
+ new js(t, s, n)
3766
+ );
3767
+ });
3768
+ }
3769
+ };
3770
+ }
3771
+ });
3772
+ class js {
3796
3773
  constructor(e, n, r) {
3797
- this.network = e, this.inner = n, this.addresses = r;
3774
+ this.inner = n, this.addresses = r, this.network = e === Be.TESTNET ? Sr("testnet") : Sr("mainnet");
3798
3775
  }
3776
+ network;
3799
3777
  async connect() {
3800
3778
  await this.inner.connect();
3801
3779
  }
@@ -3804,20 +3782,20 @@ class $i {
3804
3782
  }
3805
3783
  async getAddresses() {
3806
3784
  const e = await this.inner.getAddresses(), n = (s, i) => {
3807
- const c = Ms(this.network, i.address), a = c === "p2tr" ? zt.P2TR : c === "p2sh" ? zt.P2SH_P2WPKH : c === "p2wpkh" ? zt.P2WPKH : c === "p2pkh" ? zt.P2PKH : void 0;
3785
+ const c = Ts(this.network, i.address), a = c === "p2tr" ? zt.P2TR : c === "p2sh" ? zt.P2SH_P2WPKH : c === "p2wpkh" ? zt.P2WPKH : c === "p2pkh" ? zt.P2PKH : void 0;
3808
3786
  if (a == null)
3809
- throw new Nt(
3787
+ throw new Ct(
3810
3788
  `[MockAddressWalletAdapter] Please provide a supported ${s} address`
3811
3789
  );
3812
3790
  return {
3813
- network: Lt(this.network) ? er.MAINNET : er.TESTNET,
3791
+ network: Lt(this.network) ? Be.MAINNET : Be.TESTNET,
3814
3792
  purposes: i.purposes,
3815
3793
  addressType: a,
3816
3794
  address: i.address,
3817
- scriptPubKey: zs(this.network, i.address),
3795
+ scriptPubKey: Ms(this.network, i.address),
3818
3796
  publicKey: kn,
3819
- redeemScript: Ys,
3820
- tapInternalKey: Gs
3797
+ redeemScript: qs,
3798
+ tapInternalKey: Ws
3821
3799
  };
3822
3800
  };
3823
3801
  let r, o;
@@ -3842,28 +3820,12 @@ class $i {
3842
3820
  });
3843
3821
  }
3844
3822
  async signMessage(e, n) {
3845
- throw new Nt(
3846
- "[MockAddressWalletAdapter] it's a mock adapter, can't send inscription"
3847
- );
3848
- }
3849
- get sendBitcoinFeeRateCapability() {
3850
- return this.inner.sendBitcoinFeeRateCapability;
3851
- }
3852
- get sendInscriptionFeeRateCapability() {
3853
- return this.inner.sendInscriptionFeeRateCapability;
3854
- }
3855
- sendBitcoin(e, n, r) {
3856
- throw new Nt(
3857
- "[MockAddressWalletAdapter] it's a mock adapter, can't send bitcoin"
3858
- );
3859
- }
3860
- sendInscription(e, n, r) {
3861
- throw new Nt(
3823
+ throw new Ct(
3862
3824
  "[MockAddressWalletAdapter] it's a mock adapter, can't send inscription"
3863
3825
  );
3864
3826
  }
3865
3827
  signAndFinalizePsbt(e) {
3866
- throw new Nt(
3828
+ throw new Ct(
3867
3829
  "[MockAddressWalletAdapter] it's a mock adapter, can't sign transaction"
3868
3830
  );
3869
3831
  }
@@ -3873,74 +3835,161 @@ class $i {
3873
3835
  }
3874
3836
  };
3875
3837
  }
3838
+ get sendBitcoinFeeRateCapability() {
3839
+ return this.inner.sendBitcoinFeeRateCapability;
3840
+ }
3841
+ sendBitcoin(e, n, r) {
3842
+ throw new Ct(
3843
+ "[MockAddressWalletAdapter] it's a mock adapter, can't send bitcoin"
3844
+ );
3845
+ }
3846
+ }
3847
+ const Fs = "okxwallet.bitcoin", Zs = {
3848
+ name: "OKX Wallet",
3849
+ iconUrl: () => import("./okx-DWbHwazu.mjs").then((t) => t.default),
3850
+ websiteUrl: "https://web3.okx.com/",
3851
+ downloadUrl: "https://web3.okx.com/download"
3852
+ }, zs = Pt({
3853
+ getPrecondition: () => {
3854
+ const t = window.okxwallet?.bitcoin;
3855
+ return t == null ? null : { value: t };
3856
+ },
3857
+ initializer: async (t) => {
3858
+ const { OkxWalletAdapterImpl: e } = await import("./OkxWalletAdapter.impl-nRgHsPTn.mjs");
3859
+ return new e(t);
3860
+ }
3861
+ });
3862
+ function Oi() {
3863
+ return {
3864
+ adapterId: Fs,
3865
+ metadata: Zs,
3866
+ getAdapter: () => zs
3867
+ };
3868
+ }
3869
+ const Gs = "unisat", Ys = {
3870
+ name: "UniSat",
3871
+ /**
3872
+ * https://next-cdn.unisat.io/_/2025-v965/UniSat%20Logo.zip
3873
+ */
3874
+ iconUrl: () => import("./unisat-pLgab4nG.mjs").then((t) => t.default),
3875
+ websiteUrl: "https://unisat.io/",
3876
+ downloadUrl: "https://unisat.io/download"
3877
+ }, Xs = Pt({
3878
+ getPrecondition: () => {
3879
+ const t = window.unisat;
3880
+ return t == null ? null : { value: t };
3881
+ },
3882
+ initializer: async (t) => {
3883
+ const { UnisatWalletAdapterImpl: e } = await import("./UnisatWalletAdapter.impl-DvA33Ikj.mjs");
3884
+ return new e(t);
3885
+ }
3886
+ });
3887
+ function Ri() {
3888
+ return {
3889
+ adapterId: Gs,
3890
+ metadata: Ys,
3891
+ getAdapter: () => Xs
3892
+ };
3893
+ }
3894
+ const Pn = "XverseProviders.BitcoinProvider", Qs = {
3895
+ name: "Xverse",
3896
+ iconUrl: () => import("./xverse-iHLNanCB.mjs").then((t) => t.default),
3897
+ websiteUrl: "https://xverse.app/",
3898
+ downloadUrl: "https://www.xverse.app/download"
3899
+ }, Js = Pt({
3900
+ getPrecondition: () => {
3901
+ const t = (window.btc_providers ?? []).find(
3902
+ (e) => e.id === Pn
3903
+ );
3904
+ return t == null ? null : { value: t };
3905
+ },
3906
+ initializer: async () => {
3907
+ const { XverseWalletAdapterImpl: t } = await import("./XverseWalletAdapter.impl-BOpY4Vf8.mjs");
3908
+ return new t();
3909
+ }
3910
+ });
3911
+ function Ui() {
3912
+ return {
3913
+ adapterId: Pn,
3914
+ metadata: Qs,
3915
+ getAdapter: () => Js
3916
+ };
3876
3917
  }
3877
3918
  export {
3878
- cs as $,
3879
- mi as A,
3880
- Qs as B,
3881
- ms as C,
3882
- kt as D,
3883
- Qo as E,
3884
- gn as F,
3885
- li as G,
3886
- di as H,
3919
+ pi as $,
3920
+ cs as A,
3921
+ ei as B,
3922
+ hi as C,
3923
+ ui as D,
3924
+ ps as E,
3925
+ ai as F,
3926
+ ns as G,
3927
+ Z as H,
3887
3928
  ci as I,
3888
- Qe as J,
3889
- pi as K,
3890
- Js as L,
3891
- ti as M,
3929
+ Ai as J,
3930
+ fi as K,
3931
+ ri as L,
3932
+ ni as M,
3892
3933
  si as N,
3893
- ei as O,
3934
+ Oi as O,
3894
3935
  ct as P,
3895
- At as Q,
3896
- xs as R,
3897
- Vt as S,
3898
- nt as T,
3899
- ri as U,
3936
+ Fo as Q,
3937
+ ws as R,
3938
+ mi as S,
3939
+ kt as T,
3940
+ Ri as U,
3900
3941
  xe as V,
3901
- Ns as W,
3902
- ni as X,
3903
- ii as Y,
3904
- Kt as Z,
3905
- yn as _,
3906
- $i as a,
3907
- at as a0,
3908
- xn as a1,
3909
- Bi as a2,
3910
- hs as a3,
3911
- N as a4,
3912
- wi as a5,
3913
- ps as a6,
3914
- bi as a7,
3915
- gi as a8,
3916
- Xe as a9,
3917
- yi as aa,
3918
- ys as ab,
3919
- Ei as ac,
3920
- Si as b,
3921
- Zs as c,
3922
- Ms as d,
3923
- Ii as e,
3924
- Sr as f,
3925
- vi as g,
3942
+ yn as W,
3943
+ Ui as X,
3944
+ li as Y,
3945
+ di as Z,
3946
+ Je as _,
3947
+ Ii as a,
3948
+ At as a0,
3949
+ Vt as a1,
3950
+ nt as a2,
3951
+ ks as a3,
3952
+ ii as a4,
3953
+ Kt as a5,
3954
+ gn as a6,
3955
+ es as a7,
3956
+ at as a8,
3957
+ xn as a9,
3958
+ Bi as aa,
3959
+ is as ab,
3960
+ N as ac,
3961
+ wi as ad,
3962
+ as as ae,
3963
+ bi as af,
3964
+ yi as ag,
3965
+ Qe as ah,
3966
+ gi as ai,
3967
+ ds as aj,
3968
+ Ei as ak,
3969
+ Tn as b,
3970
+ Nn as c,
3971
+ Sr as d,
3972
+ Vs as e,
3973
+ Ct as f,
3974
+ Si as g,
3926
3975
  rt as h,
3927
- oi as i,
3928
- Cn as j,
3929
- jt as k,
3930
- xt as l,
3931
- In as m,
3932
- xi as n,
3933
- Ye as o,
3934
- An as p,
3935
- ls as q,
3936
- hi as r,
3976
+ $i as i,
3977
+ Ys as j,
3978
+ Ts as k,
3979
+ vi as l,
3980
+ Hn as m,
3981
+ Qs as n,
3982
+ Pn as o,
3983
+ oi as p,
3984
+ Kn as q,
3985
+ Dn as r,
3937
3986
  me as s,
3938
- ui as t,
3939
- ai as u,
3987
+ jt as t,
3988
+ xt as u,
3940
3989
  be as v,
3941
- fs as w,
3942
- Z as x,
3943
- Ai as y,
3944
- fi as z
3990
+ $n as w,
3991
+ xi as x,
3992
+ Xe as y,
3993
+ An as z
3945
3994
  };
3946
- //# sourceMappingURL=index-D7YwhNAG.mjs.map
3995
+ //# sourceMappingURL=index-DM4G-LJz.mjs.map