@argent/x-shared 1.30.1 → 1.31.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.
@@ -1,2171 +0,0 @@
1
- import { z as e } from "zod";
2
- import { jsx as ir } from "react/jsx-runtime";
3
- import { memoize as gt, noop as or } from "lodash-es";
4
- import { createContext as cr, useContext as lr, useEffect as ur } from "react";
5
- import { validateChecksumAddress as fr, validateAndParseAddress as hr, getChecksumAddress as pr, num as ze, constants as dr, CairoCustomEnum as mr } from "starknet";
6
- import "swr";
7
- const It = e.string().refine((n) => {
8
- if (n.toLowerCase() === n)
9
- return !0;
10
- try {
11
- return fr(n) && Sr(n);
12
- } catch {
13
- }
14
- return !1;
15
- }, "Invalid address (checksum error)"), Er = e.string().refine((n) => {
16
- try {
17
- return hr(n);
18
- } catch {
19
- }
20
- return !1;
21
- }, "Invalid address (validation error)"), ke = e.string().regex(/^0x[0-9a-fA-F]+$/, "Invalid address"), gr = ke.min(50, "Addresses must at least be 50 characters long").max(66, "Addresses must at most be 66 characters long"), Ir = ke.length(66, "Address must be 66 characters long"), Te = gr.pipe(It).transform((n) => `0x${(n.startsWith("0x") ? n.slice(2) : n).padStart(64, "0")}`), xn = Te.or(e.literal("")).transform((n) => n === "" ? void 0 : n).optional(), q = ke.transform((n) => `0x${n.replace(/^0x/, "").toLowerCase().padStart(64, "0")}`), Ar = (n) => Te.safeParse(n).success, Nr = Ar, Ue = (n) => pr(n), Mn = (n) => {
22
- const p = Ue(n), R = p.slice(0, 2), _ = p.slice(2, 6), S = p.slice(-4);
23
- return `${R}${_}…${S}`;
24
- }, Gn = (n) => {
25
- const p = Ue(n), R = p.slice(0, 2), S = p.slice(2).match(/.{1,4}/g) || [];
26
- return `${R} ${S.join(" ")}`;
27
- }, Sr = (n) => !/^0x[0-9a-f]{63,64}$/.test(n), Rr = (n, p) => {
28
- try {
29
- return !n || !p ? !1 : ze.hexToDecimalString(n) === ze.hexToDecimalString(p);
30
- } catch {
31
- }
32
- return !1;
33
- }, Or = (n) => {
34
- try {
35
- return ze.toBigInt(ke.parse(n)) === dr.ZERO;
36
- } catch {
37
- }
38
- return !1;
39
- }, Bn = (n, p) => !!(p != null && p.some((R) => Rr(R, n))), $n = gt((n) => {
40
- const p = n.slice(0, 6), R = n.slice(-4);
41
- return `${p}…${R}`;
42
- }), Xn = gt((n, p) => {
43
- if (n.length < p)
44
- return n;
45
- const R = Math.floor((p - 1) / 2), _ = n.slice(0, R), S = n.slice(-R);
46
- return `${_}…${S}`;
47
- }), Vn = e.string().regex(/^[a-zA-Z0-9.-]*$/g, "Invalid address character").max(66, "Address cannot be over 66 characters"), vr = Ir.pipe(It).pipe(Er), Fe = e.string().regex(/^([a-zA-Z0-9-]+\.)+argent.xyz$/, "Invalid Argent name").max(253, "Argent name cannot be over 253 characters"), Tr = (n) => Fe.safeParse(n).success, wr = (n, p) => {
48
- try {
49
- return p ? qe(n) === qe(p) : !1;
50
- } catch {
51
- }
52
- return !1;
53
- }, qe = (n) => Fe.parse(n).toLowerCase(), nt = e.string().regex(/^([a-zA-Z0-9-]+\.)+stark$/, "Invalid Starknet ID").max(50, "Starknet ID cannot be over 50 characters"), yr = (n) => nt.safeParse(n).success, br = (n, p) => {
54
- try {
55
- return p ? We(n) === We(p) : !1;
56
- } catch {
57
- }
58
- return !1;
59
- }, We = (n) => nt.parse(n).toLowerCase(), at = e.union([
60
- Fe,
61
- nt
62
- ]), Hn = e.union([
63
- Te,
64
- at
65
- ]), zn = e.union([
66
- vr,
67
- at
68
- ]), qn = (n) => at.safeParse(n).success, Wn = (n, p) => {
69
- try {
70
- return p ? wr(n, p) || br(n, p) : !1;
71
- } catch {
72
- }
73
- return !1;
74
- }, Yn = (n) => yr(n) ? We(n) : Tr(n) ? qe(n) : Ue(n), Lr = e.union([e.literal("0"), e.literal("1")]), Zn = "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", Kn = "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d", Jn = "0x1a736d6ed154502257f02b1ccdf4d9d1089f80811cd6acad48e6b6a9d1f2003", Qn = "0x036078334509b514626504edc9fb252328d1a240e4e948bef8d0c08dff45927f", ea = "0x737ee2f87ce571a58c6c8da558ec18a07ceb64a6172d5ec46171fbc80077a48", ta = "0x6e150953b26271a740bf2b6e9bca17cc52c68d765f761295de51ceb8526ee72", ra = "0x4d07e40e93398ed3c76981e72dd1fd22557a78ce36c0515f679e27f0bb5bc5f";
75
- function Cr(n) {
76
- var p = [];
77
- if (n.length === 0)
78
- return "";
79
- if (typeof n[0] != "string")
80
- throw new TypeError("Url must be a string. Received " + n[0]);
81
- if (n[0].match(/^[^/:]+:\/*$/) && n.length > 1) {
82
- var R = n.shift();
83
- n[0] = R + n[0];
84
- }
85
- n[0].match(/^file:\/\/\//) ? n[0] = n[0].replace(/^([^/:]+):\/*/, "$1:///") : n[0] = n[0].replace(/^([^/:]+):\/*/, "$1://");
86
- for (var _ = 0; _ < n.length; _++) {
87
- var S = n[_];
88
- if (typeof S != "string")
89
- throw new TypeError("Url must be a string. Received " + S);
90
- S !== "" && (_ > 0 && (S = S.replace(/^[\/]+/, "")), _ < n.length - 1 ? S = S.replace(/[\/]+$/, "") : S = S.replace(/[\/]+$/, "/"), p.push(S));
91
- }
92
- var B = p.join("/");
93
- B = B.replace(/\/(\?|&|#[^!])/g, "$1");
94
- var M = B.split("?");
95
- return B = M.shift() + (M.length > 0 ? "?" : "") + M.join("&"), B;
96
- }
97
- function _r() {
98
- var n;
99
- return typeof arguments[0] == "object" ? n = arguments[0] : n = [].slice.call(arguments), Cr(n);
100
- }
101
- class xe extends Error {
102
- constructor({ code: p, message: R, options: _ = {} }, S) {
103
- const { error: B, context: M } = _;
104
- super(R, { cause: B }), this.errorMessages = S, this.name = "BaseError", this.context = M, this.code = p, this.setMessageByCode(p, R);
105
- }
106
- setMessageByCode(p, R) {
107
- !p || !this.errorMessages || R || (this.message = this.errorMessages[p]);
108
- }
109
- }
110
- var Ye;
111
- (function(n) {
112
- n.NOT_VALID = "Invalid address", n.NOT_FOUND = "Address not found", n.STARKNAME_NOT_FOUND = "Stark name not found", n.STARKNAME_ERROR = "Could not get address from stark name", n.STARKNAME_INVALID_ADDRESS = "Stark name resolved to an invalid address", n.ARGENT_NAME_NOT_FOUND = "Argent name not found", n.NO_ADDRESS_FROM_ARGENT_NAME = "Could not get address from Argent name", n.ARGENT_NAME_INVALID_ADDRESS = "Argent name resolved to an invalid address", n.NO_ADDRESS_FROM_DOMAIN = "Could not get address from domain", n.ARGENT_NAME_INVALID_NETWORK = "Argent name is not enabled on the requested network";
113
- })(Ye || (Ye = {}));
114
- class _e extends xe {
115
- constructor(p) {
116
- super(p, Ye), this.name = "AddressError";
117
- }
118
- }
119
- class st extends Error {
120
- constructor(p, R, _) {
121
- super(p), this.status = R, this.data = _, Object.setPrototypeOf(this, st.prototype);
122
- }
123
- }
124
- var lt;
125
- (function(n) {
126
- n.FAILED_TO_FETCH_URL = "Failed to fetch url", n.FAILED_TO_POST_URL = "Failed to post url";
127
- })(lt || (lt = {}));
128
- const na = e.object({
129
- walletAddress: q,
130
- ens: Fe,
131
- chain: e.enum(["ethereum", "starknet"]),
132
- deleted: e.boolean(),
133
- walletDeployed: e.boolean()
134
- }).or(e.object({
135
- status: e.string()
136
- }));
137
- async function aa(n, p, R, _ = "starknet") {
138
- const S = {
139
- ens: n,
140
- chain: _
141
- }, B = new URLSearchParams(S), M = _r(R, "wallet", `?${B}`);
142
- try {
143
- const F = await p.get(M), L = F && "walletAddress" in F ? F.walletAddress : void 0;
144
- if (!L)
145
- throw new _e({
146
- code: "NO_ADDRESS_FROM_ARGENT_NAME"
147
- });
148
- if (Or(L))
149
- throw new _e({
150
- code: "ARGENT_NAME_NOT_FOUND",
151
- message: `${n} not found`
152
- });
153
- if (!Nr(L))
154
- throw new _e({
155
- code: "ARGENT_NAME_INVALID_ADDRESS",
156
- message: `${n} resolved to an invalid address (${L})`
157
- });
158
- return Ue(L);
159
- } catch (F) {
160
- throw F instanceof st && F.status === 404 ? new _e({
161
- code: "ARGENT_NAME_NOT_FOUND",
162
- message: `${n} not found`
163
- }) : F;
164
- }
165
- }
166
- var Ze;
167
- (function(n) {
168
- n.NOT_VALID = "Invalid call";
169
- })(Ze || (Ze = {}));
170
- class sa extends xe {
171
- constructor(p) {
172
- super(p, Ze), this.name = "CallError";
173
- }
174
- }
175
- var Ke;
176
- (function(n) {
177
- n.NO_NETWORK_OR_MULTICALL = "Missing networkId or multicall", n.NOT_FOUND = "Network not found";
178
- })(Ke || (Ke = {}));
179
- class ia extends xe {
180
- constructor(p) {
181
- super(p, Ke), this.name = "NetworkError";
182
- }
183
- }
184
- const Le = e.union([e.string(), e.number(), e.bigint()]), Dr = e.object({
185
- low: Le,
186
- high: Le
187
- }), Pr = e.array(e.string()).and(e.object({
188
- __compiled__: e.boolean().optional()
189
- }).optional()), jr = e.lazy(() => e.array(e.union([je, e.array(je), it]))), je = e.union([
190
- Le,
191
- Dr,
192
- e.any(),
193
- e.boolean()
194
- ]), kr = e.lazy(() => e.record(e.union([je, e.array(je), it]))), it = e.lazy(() => e.union([kr, jr])), Ur = e.lazy(() => e.object({
195
- contractAddress: e.string(),
196
- calldata: e.union([it, Pr]).optional(),
197
- entrypoint: e.string().optional()
198
- })), oa = e.lazy(() => Ur.and(e.object({
199
- entrypoint: e.string()
200
- }))), ue = e.string().refine((n) => typeof parseInt(n) == "number"), ca = e.tuple([ue]), la = e.tuple([ue]), ua = e.object({
201
- new_threshold: e.string().refine((n) => typeof parseInt(n) == "number"),
202
- signers_to_add: e.array(ue)
203
- }), fa = e.object({
204
- new_threshold: e.string().refine((n) => typeof parseInt(n) == "number"),
205
- signers_to_remove: e.array(ue)
206
- }), ha = e.object({
207
- signer_to_remove: ue,
208
- signer_to_add: ue
209
- }), pa = e.tuple([ue]), da = e.tuple([ue]), ma = e.tuple([ue]), Ea = e.tuple([ue]).rest(ue), ga = e.object({
210
- recipient: Te,
211
- amount: e.object({
212
- low: Le,
213
- high: Le
214
- })
215
- }), Fr = e.string().regex(/^(0x)?[0-9a-fA-F]+$/, "Invalid hex string"), At = Fr.transform((n) => {
216
- const p = n.startsWith("0x") ? n.slice(2) : n;
217
- return `0x${p.length % 2 === 0 ? p : `0${p}`}`;
218
- }), Ia = e.object({
219
- cairoVersion: Lr,
220
- accountClassHash: At
221
- }), xr = e.array(e.string()), Aa = e.object({
222
- implementation: e.string(),
223
- selector: At,
224
- calldata: xr
225
- }), Na = e.object({
226
- owner: e.string(),
227
- guardian: e.string().optional().transform((n) => n ?? "0")
228
- });
229
- var ut;
230
- (function(n) {
231
- n.Starknet = "Starknet", n.Secp256k1 = "Secp256k1", n.Secp256r1 = "Secp256r1", n.Eip191 = "Eip191", n.Webauthn = "Webauthn";
232
- })(ut || (ut = {}));
233
- function Sa(n, p) {
234
- const R = {
235
- Starknet: void 0,
236
- Secp256k1: void 0,
237
- Secp256r1: void 0,
238
- Eip191: void 0,
239
- Webauthn: void 0
240
- };
241
- return R[p] = n, new mr(R);
242
- }
243
- var Je;
244
- (function(n) {
245
- n.NOT_FOUND = "Account not found", n.CALCULATED_ADDRESS_NO_MATCH = "Calculated address does not match account address";
246
- })(Je || (Je = {}));
247
- class Ra extends xe {
248
- constructor(p) {
249
- super(p, Je), this.name = "AccountError";
250
- }
251
- }
252
- function Mr(n) {
253
- return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
254
- }
255
- var Qe = { exports: {} };
256
- (function(n, p) {
257
- p = n.exports = C;
258
- var R;
259
- typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? R = function() {
260
- var t = Array.prototype.slice.call(arguments, 0);
261
- t.unshift("SEMVER"), console.log.apply(console, t);
262
- } : R = function() {
263
- }, p.SEMVER_SPEC_VERSION = "2.0.0";
264
- var _ = 256, S = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
265
- 9007199254740991, B = 16, M = _ - 6, F = p.re = [], L = p.safeRe = [], I = p.src = [], m = p.tokens = {}, J = 0;
266
- function D(t) {
267
- m[t] = J++;
268
- }
269
- var me = "[a-zA-Z0-9-]", ae = [
270
- ["\\s", 1],
271
- ["\\d", _],
272
- [me, M]
273
- ];
274
- function Ee(t) {
275
- for (var i = 0; i < ae.length; i++) {
276
- var c = ae[i][0], A = ae[i][1];
277
- t = t.split(c + "*").join(c + "{0," + A + "}").split(c + "+").join(c + "{1," + A + "}");
278
- }
279
- return t;
280
- }
281
- D("NUMERICIDENTIFIER"), I[m.NUMERICIDENTIFIER] = "0|[1-9]\\d*", D("NUMERICIDENTIFIERLOOSE"), I[m.NUMERICIDENTIFIERLOOSE] = "\\d+", D("NONNUMERICIDENTIFIER"), I[m.NONNUMERICIDENTIFIER] = "\\d*[a-zA-Z-]" + me + "*", D("MAINVERSION"), I[m.MAINVERSION] = "(" + I[m.NUMERICIDENTIFIER] + ")\\.(" + I[m.NUMERICIDENTIFIER] + ")\\.(" + I[m.NUMERICIDENTIFIER] + ")", D("MAINVERSIONLOOSE"), I[m.MAINVERSIONLOOSE] = "(" + I[m.NUMERICIDENTIFIERLOOSE] + ")\\.(" + I[m.NUMERICIDENTIFIERLOOSE] + ")\\.(" + I[m.NUMERICIDENTIFIERLOOSE] + ")", D("PRERELEASEIDENTIFIER"), I[m.PRERELEASEIDENTIFIER] = "(?:" + I[m.NUMERICIDENTIFIER] + "|" + I[m.NONNUMERICIDENTIFIER] + ")", D("PRERELEASEIDENTIFIERLOOSE"), I[m.PRERELEASEIDENTIFIERLOOSE] = "(?:" + I[m.NUMERICIDENTIFIERLOOSE] + "|" + I[m.NONNUMERICIDENTIFIER] + ")", D("PRERELEASE"), I[m.PRERELEASE] = "(?:-(" + I[m.PRERELEASEIDENTIFIER] + "(?:\\." + I[m.PRERELEASEIDENTIFIER] + ")*))", D("PRERELEASELOOSE"), I[m.PRERELEASELOOSE] = "(?:-?(" + I[m.PRERELEASEIDENTIFIERLOOSE] + "(?:\\." + I[m.PRERELEASEIDENTIFIERLOOSE] + ")*))", D("BUILDIDENTIFIER"), I[m.BUILDIDENTIFIER] = me + "+", D("BUILD"), I[m.BUILD] = "(?:\\+(" + I[m.BUILDIDENTIFIER] + "(?:\\." + I[m.BUILDIDENTIFIER] + ")*))", D("FULL"), D("FULLPLAIN"), I[m.FULLPLAIN] = "v?" + I[m.MAINVERSION] + I[m.PRERELEASE] + "?" + I[m.BUILD] + "?", I[m.FULL] = "^" + I[m.FULLPLAIN] + "$", D("LOOSEPLAIN"), I[m.LOOSEPLAIN] = "[v=\\s]*" + I[m.MAINVERSIONLOOSE] + I[m.PRERELEASELOOSE] + "?" + I[m.BUILD] + "?", D("LOOSE"), I[m.LOOSE] = "^" + I[m.LOOSEPLAIN] + "$", D("GTLT"), I[m.GTLT] = "((?:<|>)?=?)", D("XRANGEIDENTIFIERLOOSE"), I[m.XRANGEIDENTIFIERLOOSE] = I[m.NUMERICIDENTIFIERLOOSE] + "|x|X|\\*", D("XRANGEIDENTIFIER"), I[m.XRANGEIDENTIFIER] = I[m.NUMERICIDENTIFIER] + "|x|X|\\*", D("XRANGEPLAIN"), I[m.XRANGEPLAIN] = "[v=\\s]*(" + I[m.XRANGEIDENTIFIER] + ")(?:\\.(" + I[m.XRANGEIDENTIFIER] + ")(?:\\.(" + I[m.XRANGEIDENTIFIER] + ")(?:" + I[m.PRERELEASE] + ")?" + I[m.BUILD] + "?)?)?", D("XRANGEPLAINLOOSE"), I[m.XRANGEPLAINLOOSE] = "[v=\\s]*(" + I[m.XRANGEIDENTIFIERLOOSE] + ")(?:\\.(" + I[m.XRANGEIDENTIFIERLOOSE] + ")(?:\\.(" + I[m.XRANGEIDENTIFIERLOOSE] + ")(?:" + I[m.PRERELEASELOOSE] + ")?" + I[m.BUILD] + "?)?)?", D("XRANGE"), I[m.XRANGE] = "^" + I[m.GTLT] + "\\s*" + I[m.XRANGEPLAIN] + "$", D("XRANGELOOSE"), I[m.XRANGELOOSE] = "^" + I[m.GTLT] + "\\s*" + I[m.XRANGEPLAINLOOSE] + "$", D("COERCE"), I[m.COERCE] = "(^|[^\\d])(\\d{1," + B + "})(?:\\.(\\d{1," + B + "}))?(?:\\.(\\d{1," + B + "}))?(?:$|[^\\d])", D("COERCERTL"), F[m.COERCERTL] = new RegExp(I[m.COERCE], "g"), L[m.COERCERTL] = new RegExp(Ee(I[m.COERCE]), "g"), D("LONETILDE"), I[m.LONETILDE] = "(?:~>?)", D("TILDETRIM"), I[m.TILDETRIM] = "(\\s*)" + I[m.LONETILDE] + "\\s+", F[m.TILDETRIM] = new RegExp(I[m.TILDETRIM], "g"), L[m.TILDETRIM] = new RegExp(Ee(I[m.TILDETRIM]), "g");
282
- var ge = "$1~";
283
- D("TILDE"), I[m.TILDE] = "^" + I[m.LONETILDE] + I[m.XRANGEPLAIN] + "$", D("TILDELOOSE"), I[m.TILDELOOSE] = "^" + I[m.LONETILDE] + I[m.XRANGEPLAINLOOSE] + "$", D("LONECARET"), I[m.LONECARET] = "(?:\\^)", D("CARETTRIM"), I[m.CARETTRIM] = "(\\s*)" + I[m.LONECARET] + "\\s+", F[m.CARETTRIM] = new RegExp(I[m.CARETTRIM], "g"), L[m.CARETTRIM] = new RegExp(Ee(I[m.CARETTRIM]), "g");
284
- var we = "$1^";
285
- D("CARET"), I[m.CARET] = "^" + I[m.LONECARET] + I[m.XRANGEPLAIN] + "$", D("CARETLOOSE"), I[m.CARETLOOSE] = "^" + I[m.LONECARET] + I[m.XRANGEPLAINLOOSE] + "$", D("COMPARATORLOOSE"), I[m.COMPARATORLOOSE] = "^" + I[m.GTLT] + "\\s*(" + I[m.LOOSEPLAIN] + ")$|^$", D("COMPARATOR"), I[m.COMPARATOR] = "^" + I[m.GTLT] + "\\s*(" + I[m.FULLPLAIN] + ")$|^$", D("COMPARATORTRIM"), I[m.COMPARATORTRIM] = "(\\s*)" + I[m.GTLT] + "\\s*(" + I[m.LOOSEPLAIN] + "|" + I[m.XRANGEPLAIN] + ")", F[m.COMPARATORTRIM] = new RegExp(I[m.COMPARATORTRIM], "g"), L[m.COMPARATORTRIM] = new RegExp(Ee(I[m.COMPARATORTRIM]), "g");
286
- var v = "$1$2$3";
287
- D("HYPHENRANGE"), I[m.HYPHENRANGE] = "^\\s*(" + I[m.XRANGEPLAIN] + ")\\s+-\\s+(" + I[m.XRANGEPLAIN] + ")\\s*$", D("HYPHENRANGELOOSE"), I[m.HYPHENRANGELOOSE] = "^\\s*(" + I[m.XRANGEPLAINLOOSE] + ")\\s+-\\s+(" + I[m.XRANGEPLAINLOOSE] + ")\\s*$", D("STAR"), I[m.STAR] = "(<|>)?=?\\s*\\*";
288
- for (var re = 0; re < J; re++)
289
- R(re, I[re]), F[re] || (F[re] = new RegExp(I[re]), L[re] = new RegExp(Ee(I[re])));
290
- p.parse = fe;
291
- function fe(t, i) {
292
- if ((!i || typeof i != "object") && (i = {
293
- loose: !!i,
294
- includePrerelease: !1
295
- }), t instanceof C)
296
- return t;
297
- if (typeof t != "string" || t.length > _)
298
- return null;
299
- var c = i.loose ? L[m.LOOSE] : L[m.FULL];
300
- if (!c.test(t))
301
- return null;
302
- try {
303
- return new C(t, i);
304
- } catch {
305
- return null;
306
- }
307
- }
308
- p.valid = ye;
309
- function ye(t, i) {
310
- var c = fe(t, i);
311
- return c ? c.version : null;
312
- }
313
- p.clean = Q;
314
- function Q(t, i) {
315
- var c = fe(t.trim().replace(/^[=v]+/, ""), i);
316
- return c ? c.version : null;
317
- }
318
- p.SemVer = C;
319
- function C(t, i) {
320
- if ((!i || typeof i != "object") && (i = {
321
- loose: !!i,
322
- includePrerelease: !1
323
- }), t instanceof C) {
324
- if (t.loose === i.loose)
325
- return t;
326
- t = t.version;
327
- } else if (typeof t != "string")
328
- throw new TypeError("Invalid Version: " + t);
329
- if (t.length > _)
330
- throw new TypeError("version is longer than " + _ + " characters");
331
- if (!(this instanceof C))
332
- return new C(t, i);
333
- R("SemVer", t, i), this.options = i, this.loose = !!i.loose;
334
- var c = t.trim().match(i.loose ? L[m.LOOSE] : L[m.FULL]);
335
- if (!c)
336
- throw new TypeError("Invalid Version: " + t);
337
- if (this.raw = t, this.major = +c[1], this.minor = +c[2], this.patch = +c[3], this.major > S || this.major < 0)
338
- throw new TypeError("Invalid major version");
339
- if (this.minor > S || this.minor < 0)
340
- throw new TypeError("Invalid minor version");
341
- if (this.patch > S || this.patch < 0)
342
- throw new TypeError("Invalid patch version");
343
- c[4] ? this.prerelease = c[4].split(".").map(function(A) {
344
- if (/^[0-9]+$/.test(A)) {
345
- var O = +A;
346
- if (O >= 0 && O < S)
347
- return O;
348
- }
349
- return A;
350
- }) : this.prerelease = [], this.build = c[5] ? c[5].split(".") : [], this.format();
351
- }
352
- C.prototype.format = function() {
353
- return this.version = this.major + "." + this.minor + "." + this.patch, this.prerelease.length && (this.version += "-" + this.prerelease.join(".")), this.version;
354
- }, C.prototype.toString = function() {
355
- return this.version;
356
- }, C.prototype.compare = function(t) {
357
- return R("SemVer.compare", this.version, this.options, t), t instanceof C || (t = new C(t, this.options)), this.compareMain(t) || this.comparePre(t);
358
- }, C.prototype.compareMain = function(t) {
359
- return t instanceof C || (t = new C(t, this.options)), h(this.major, t.major) || h(this.minor, t.minor) || h(this.patch, t.patch);
360
- }, C.prototype.comparePre = function(t) {
361
- if (t instanceof C || (t = new C(t, this.options)), this.prerelease.length && !t.prerelease.length)
362
- return -1;
363
- if (!this.prerelease.length && t.prerelease.length)
364
- return 1;
365
- if (!this.prerelease.length && !t.prerelease.length)
366
- return 0;
367
- var i = 0;
368
- do {
369
- var c = this.prerelease[i], A = t.prerelease[i];
370
- if (R("prerelease compare", i, c, A), c === void 0 && A === void 0)
371
- return 0;
372
- if (A === void 0)
373
- return 1;
374
- if (c === void 0)
375
- return -1;
376
- if (c === A)
377
- continue;
378
- return h(c, A);
379
- } while (++i);
380
- }, C.prototype.compareBuild = function(t) {
381
- t instanceof C || (t = new C(t, this.options));
382
- var i = 0;
383
- do {
384
- var c = this.build[i], A = t.build[i];
385
- if (R("prerelease compare", i, c, A), c === void 0 && A === void 0)
386
- return 0;
387
- if (A === void 0)
388
- return 1;
389
- if (c === void 0)
390
- return -1;
391
- if (c === A)
392
- continue;
393
- return h(c, A);
394
- } while (++i);
395
- }, C.prototype.inc = function(t, i) {
396
- switch (t) {
397
- case "premajor":
398
- this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", i);
399
- break;
400
- case "preminor":
401
- this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", i);
402
- break;
403
- case "prepatch":
404
- this.prerelease.length = 0, this.inc("patch", i), this.inc("pre", i);
405
- break;
406
- case "prerelease":
407
- this.prerelease.length === 0 && this.inc("patch", i), this.inc("pre", i);
408
- break;
409
- case "major":
410
- (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) && this.major++, this.minor = 0, this.patch = 0, this.prerelease = [];
411
- break;
412
- case "minor":
413
- (this.patch !== 0 || this.prerelease.length === 0) && this.minor++, this.patch = 0, this.prerelease = [];
414
- break;
415
- case "patch":
416
- this.prerelease.length === 0 && this.patch++, this.prerelease = [];
417
- break;
418
- case "pre":
419
- if (this.prerelease.length === 0)
420
- this.prerelease = [0];
421
- else {
422
- for (var c = this.prerelease.length; --c >= 0; )
423
- typeof this.prerelease[c] == "number" && (this.prerelease[c]++, c = -2);
424
- c === -1 && this.prerelease.push(0);
425
- }
426
- i && (this.prerelease[0] === i ? isNaN(this.prerelease[1]) && (this.prerelease = [i, 0]) : this.prerelease = [i, 0]);
427
- break;
428
- default:
429
- throw new Error("invalid increment argument: " + t);
430
- }
431
- return this.format(), this.raw = this.version, this;
432
- }, p.inc = r;
433
- function r(t, i, c, A) {
434
- typeof c == "string" && (A = c, c = void 0);
435
- try {
436
- return new C(t, c).inc(i, A).version;
437
- } catch {
438
- return null;
439
- }
440
- }
441
- p.diff = a;
442
- function a(t, i) {
443
- if (H(t, i))
444
- return null;
445
- var c = fe(t), A = fe(i), O = "";
446
- if (c.prerelease.length || A.prerelease.length) {
447
- O = "pre";
448
- var T = "prerelease";
449
- }
450
- for (var w in c)
451
- if ((w === "major" || w === "minor" || w === "patch") && c[w] !== A[w])
452
- return O + w;
453
- return T;
454
- }
455
- p.compareIdentifiers = h;
456
- var s = /^[0-9]+$/;
457
- function h(t, i) {
458
- var c = s.test(t), A = s.test(i);
459
- return c && A && (t = +t, i = +i), t === i ? 0 : c && !A ? -1 : A && !c ? 1 : t < i ? -1 : 1;
460
- }
461
- p.rcompareIdentifiers = l;
462
- function l(t, i) {
463
- return h(i, t);
464
- }
465
- p.major = f;
466
- function f(t, i) {
467
- return new C(t, i).major;
468
- }
469
- p.minor = g;
470
- function g(t, i) {
471
- return new C(t, i).minor;
472
- }
473
- p.patch = o;
474
- function o(t, i) {
475
- return new C(t, i).patch;
476
- }
477
- p.compare = u;
478
- function u(t, i, c) {
479
- return new C(t, c).compare(new C(i, c));
480
- }
481
- p.compareLoose = E;
482
- function E(t, i) {
483
- return u(t, i, !0);
484
- }
485
- p.compareBuild = d;
486
- function d(t, i, c) {
487
- var A = new C(t, c), O = new C(i, c);
488
- return A.compare(O) || A.compareBuild(O);
489
- }
490
- p.rcompare = N;
491
- function N(t, i, c) {
492
- return u(i, t, c);
493
- }
494
- p.sort = y;
495
- function y(t, i) {
496
- return t.sort(function(c, A) {
497
- return p.compareBuild(c, A, i);
498
- });
499
- }
500
- p.rsort = b;
501
- function b(t, i) {
502
- return t.sort(function(c, A) {
503
- return p.compareBuild(A, c, i);
504
- });
505
- }
506
- p.gt = k;
507
- function k(t, i, c) {
508
- return u(t, i, c) > 0;
509
- }
510
- p.lt = V;
511
- function V(t, i, c) {
512
- return u(t, i, c) < 0;
513
- }
514
- p.eq = H;
515
- function H(t, i, c) {
516
- return u(t, i, c) === 0;
517
- }
518
- p.neq = x;
519
- function x(t, i, c) {
520
- return u(t, i, c) !== 0;
521
- }
522
- p.gte = X;
523
- function X(t, i, c) {
524
- return u(t, i, c) >= 0;
525
- }
526
- p.lte = W;
527
- function W(t, i, c) {
528
- return u(t, i, c) <= 0;
529
- }
530
- p.cmp = Ie;
531
- function Ie(t, i, c, A) {
532
- switch (i) {
533
- case "===":
534
- return typeof t == "object" && (t = t.version), typeof c == "object" && (c = c.version), t === c;
535
- case "!==":
536
- return typeof t == "object" && (t = t.version), typeof c == "object" && (c = c.version), t !== c;
537
- case "":
538
- case "=":
539
- case "==":
540
- return H(t, c, A);
541
- case "!=":
542
- return x(t, c, A);
543
- case ">":
544
- return k(t, c, A);
545
- case ">=":
546
- return X(t, c, A);
547
- case "<":
548
- return V(t, c, A);
549
- case "<=":
550
- return W(t, c, A);
551
- default:
552
- throw new TypeError("Invalid operator: " + i);
553
- }
554
- }
555
- p.Comparator = K;
556
- function K(t, i) {
557
- if ((!i || typeof i != "object") && (i = {
558
- loose: !!i,
559
- includePrerelease: !1
560
- }), t instanceof K) {
561
- if (t.loose === !!i.loose)
562
- return t;
563
- t = t.value;
564
- }
565
- if (!(this instanceof K))
566
- return new K(t, i);
567
- t = t.trim().split(/\s+/).join(" "), R("comparator", t, i), this.options = i, this.loose = !!i.loose, this.parse(t), this.semver === he ? this.value = "" : this.value = this.operator + this.semver.version, R("comp", this);
568
- }
569
- var he = {};
570
- K.prototype.parse = function(t) {
571
- var i = this.options.loose ? L[m.COMPARATORLOOSE] : L[m.COMPARATOR], c = t.match(i);
572
- if (!c)
573
- throw new TypeError("Invalid comparator: " + t);
574
- this.operator = c[1] !== void 0 ? c[1] : "", this.operator === "=" && (this.operator = ""), c[2] ? this.semver = new C(c[2], this.options.loose) : this.semver = he;
575
- }, K.prototype.toString = function() {
576
- return this.value;
577
- }, K.prototype.test = function(t) {
578
- if (R("Comparator.test", t, this.options.loose), this.semver === he || t === he)
579
- return !0;
580
- if (typeof t == "string")
581
- try {
582
- t = new C(t, this.options);
583
- } catch {
584
- return !1;
585
- }
586
- return Ie(t, this.operator, this.semver, this.options);
587
- }, K.prototype.intersects = function(t, i) {
588
- if (!(t instanceof K))
589
- throw new TypeError("a Comparator is required");
590
- (!i || typeof i != "object") && (i = {
591
- loose: !!i,
592
- includePrerelease: !1
593
- });
594
- var c;
595
- if (this.operator === "")
596
- return this.value === "" ? !0 : (c = new G(t.value, i), Ce(this.value, c, i));
597
- if (t.operator === "")
598
- return t.value === "" ? !0 : (c = new G(this.value, i), Ce(t.semver, c, i));
599
- var A = (this.operator === ">=" || this.operator === ">") && (t.operator === ">=" || t.operator === ">"), O = (this.operator === "<=" || this.operator === "<") && (t.operator === "<=" || t.operator === "<"), T = this.semver.version === t.semver.version, w = (this.operator === ">=" || this.operator === "<=") && (t.operator === ">=" || t.operator === "<="), $ = Ie(this.semver, "<", t.semver, i) && (this.operator === ">=" || this.operator === ">") && (t.operator === "<=" || t.operator === "<"), j = Ie(this.semver, ">", t.semver, i) && (this.operator === "<=" || this.operator === "<") && (t.operator === ">=" || t.operator === ">");
600
- return A || O || T && w || $ || j;
601
- }, p.Range = G;
602
- function G(t, i) {
603
- if ((!i || typeof i != "object") && (i = {
604
- loose: !!i,
605
- includePrerelease: !1
606
- }), t instanceof G)
607
- return t.loose === !!i.loose && t.includePrerelease === !!i.includePrerelease ? t : new G(t.raw, i);
608
- if (t instanceof K)
609
- return new G(t.value, i);
610
- if (!(this instanceof G))
611
- return new G(t, i);
612
- if (this.options = i, this.loose = !!i.loose, this.includePrerelease = !!i.includePrerelease, this.raw = t.trim().split(/\s+/).join(" "), this.set = this.raw.split("||").map(function(c) {
613
- return this.parseRange(c.trim());
614
- }, this).filter(function(c) {
615
- return c.length;
616
- }), !this.set.length)
617
- throw new TypeError("Invalid SemVer Range: " + this.raw);
618
- this.format();
619
- }
620
- G.prototype.format = function() {
621
- return this.range = this.set.map(function(t) {
622
- return t.join(" ").trim();
623
- }).join("||").trim(), this.range;
624
- }, G.prototype.toString = function() {
625
- return this.range;
626
- }, G.prototype.parseRange = function(t) {
627
- var i = this.options.loose, c = i ? L[m.HYPHENRANGELOOSE] : L[m.HYPHENRANGE];
628
- t = t.replace(c, Yt), R("hyphen replace", t), t = t.replace(L[m.COMPARATORTRIM], v), R("comparator trim", t, L[m.COMPARATORTRIM]), t = t.replace(L[m.TILDETRIM], ge), t = t.replace(L[m.CARETTRIM], we), t = t.split(/\s+/).join(" ");
629
- var A = i ? L[m.COMPARATORLOOSE] : L[m.COMPARATOR], O = t.split(" ").map(function(T) {
630
- return Z(T, this.options);
631
- }, this).join(" ").split(/\s+/);
632
- return this.options.loose && (O = O.filter(function(T) {
633
- return !!T.match(A);
634
- })), O = O.map(function(T) {
635
- return new K(T, this.options);
636
- }, this), O;
637
- }, G.prototype.intersects = function(t, i) {
638
- if (!(t instanceof G))
639
- throw new TypeError("a Range is required");
640
- return this.set.some(function(c) {
641
- return Ne(c, i) && t.set.some(function(A) {
642
- return Ne(A, i) && c.every(function(O) {
643
- return A.every(function(T) {
644
- return O.intersects(T, i);
645
- });
646
- });
647
- });
648
- });
649
- };
650
- function Ne(t, i) {
651
- for (var c = !0, A = t.slice(), O = A.pop(); c && A.length; )
652
- c = A.every(function(T) {
653
- return O.intersects(T, i);
654
- }), O = A.pop();
655
- return c;
656
- }
657
- p.toComparators = ee;
658
- function ee(t, i) {
659
- return new G(t, i).set.map(function(c) {
660
- return c.map(function(A) {
661
- return A.value;
662
- }).join(" ").trim().split(" ");
663
- });
664
- }
665
- function Z(t, i) {
666
- return R("comp", t, i), t = Vt(t, i), R("caret", t), t = $t(t, i), R("tildes", t), t = zt(t, i), R("xrange", t), t = Wt(t, i), R("stars", t), t;
667
- }
668
- function U(t) {
669
- return !t || t.toLowerCase() === "x" || t === "*";
670
- }
671
- function $t(t, i) {
672
- return t.trim().split(/\s+/).map(function(c) {
673
- return Xt(c, i);
674
- }).join(" ");
675
- }
676
- function Xt(t, i) {
677
- var c = i.loose ? L[m.TILDELOOSE] : L[m.TILDE];
678
- return t.replace(c, function(A, O, T, w, $) {
679
- R("tilde", t, A, O, T, w, $);
680
- var j;
681
- return U(O) ? j = "" : U(T) ? j = ">=" + O + ".0.0 <" + (+O + 1) + ".0.0" : U(w) ? j = ">=" + O + "." + T + ".0 <" + O + "." + (+T + 1) + ".0" : $ ? (R("replaceTilde pr", $), j = ">=" + O + "." + T + "." + w + "-" + $ + " <" + O + "." + (+T + 1) + ".0") : j = ">=" + O + "." + T + "." + w + " <" + O + "." + (+T + 1) + ".0", R("tilde return", j), j;
682
- });
683
- }
684
- function Vt(t, i) {
685
- return t.trim().split(/\s+/).map(function(c) {
686
- return Ht(c, i);
687
- }).join(" ");
688
- }
689
- function Ht(t, i) {
690
- R("caret", t, i);
691
- var c = i.loose ? L[m.CARETLOOSE] : L[m.CARET];
692
- return t.replace(c, function(A, O, T, w, $) {
693
- R("caret", t, A, O, T, w, $);
694
- var j;
695
- return U(O) ? j = "" : U(T) ? j = ">=" + O + ".0.0 <" + (+O + 1) + ".0.0" : U(w) ? O === "0" ? j = ">=" + O + "." + T + ".0 <" + O + "." + (+T + 1) + ".0" : j = ">=" + O + "." + T + ".0 <" + (+O + 1) + ".0.0" : $ ? (R("replaceCaret pr", $), O === "0" ? T === "0" ? j = ">=" + O + "." + T + "." + w + "-" + $ + " <" + O + "." + T + "." + (+w + 1) : j = ">=" + O + "." + T + "." + w + "-" + $ + " <" + O + "." + (+T + 1) + ".0" : j = ">=" + O + "." + T + "." + w + "-" + $ + " <" + (+O + 1) + ".0.0") : (R("no pr"), O === "0" ? T === "0" ? j = ">=" + O + "." + T + "." + w + " <" + O + "." + T + "." + (+w + 1) : j = ">=" + O + "." + T + "." + w + " <" + O + "." + (+T + 1) + ".0" : j = ">=" + O + "." + T + "." + w + " <" + (+O + 1) + ".0.0"), R("caret return", j), j;
696
- });
697
- }
698
- function zt(t, i) {
699
- return R("replaceXRanges", t, i), t.split(/\s+/).map(function(c) {
700
- return qt(c, i);
701
- }).join(" ");
702
- }
703
- function qt(t, i) {
704
- t = t.trim();
705
- var c = i.loose ? L[m.XRANGELOOSE] : L[m.XRANGE];
706
- return t.replace(c, function(A, O, T, w, $, j) {
707
- R("xRange", t, A, O, T, w, $, j);
708
- var pe = U(T), de = pe || U(w), se = de || U($), ne = se;
709
- return O === "=" && ne && (O = ""), j = i.includePrerelease ? "-0" : "", pe ? O === ">" || O === "<" ? A = "<0.0.0-0" : A = "*" : O && ne ? (de && (w = 0), $ = 0, O === ">" ? (O = ">=", de ? (T = +T + 1, w = 0, $ = 0) : (w = +w + 1, $ = 0)) : O === "<=" && (O = "<", de ? T = +T + 1 : w = +w + 1), A = O + T + "." + w + "." + $ + j) : de ? A = ">=" + T + ".0.0" + j + " <" + (+T + 1) + ".0.0" + j : se && (A = ">=" + T + "." + w + ".0" + j + " <" + T + "." + (+w + 1) + ".0" + j), R("xRange return", A), A;
710
- });
711
- }
712
- function Wt(t, i) {
713
- return R("replaceStars", t, i), t.trim().replace(L[m.STAR], "");
714
- }
715
- function Yt(t, i, c, A, O, T, w, $, j, pe, de, se, ne) {
716
- return U(c) ? i = "" : U(A) ? i = ">=" + c + ".0.0" : U(O) ? i = ">=" + c + "." + A + ".0" : i = ">=" + i, U(j) ? $ = "" : U(pe) ? $ = "<" + (+j + 1) + ".0.0" : U(de) ? $ = "<" + j + "." + (+pe + 1) + ".0" : se ? $ = "<=" + j + "." + pe + "." + de + "-" + se : $ = "<=" + $, (i + " " + $).trim();
717
- }
718
- G.prototype.test = function(t) {
719
- if (!t)
720
- return !1;
721
- if (typeof t == "string")
722
- try {
723
- t = new C(t, this.options);
724
- } catch {
725
- return !1;
726
- }
727
- for (var i = 0; i < this.set.length; i++)
728
- if (Zt(this.set[i], t, this.options))
729
- return !0;
730
- return !1;
731
- };
732
- function Zt(t, i, c) {
733
- for (var A = 0; A < t.length; A++)
734
- if (!t[A].test(i))
735
- return !1;
736
- if (i.prerelease.length && !c.includePrerelease) {
737
- for (A = 0; A < t.length; A++)
738
- if (R(t[A].semver), t[A].semver !== he && t[A].semver.prerelease.length > 0) {
739
- var O = t[A].semver;
740
- if (O.major === i.major && O.minor === i.minor && O.patch === i.patch)
741
- return !0;
742
- }
743
- return !1;
744
- }
745
- return !0;
746
- }
747
- p.satisfies = Ce;
748
- function Ce(t, i, c) {
749
- try {
750
- i = new G(i, c);
751
- } catch {
752
- return !1;
753
- }
754
- return i.test(t);
755
- }
756
- p.maxSatisfying = Kt;
757
- function Kt(t, i, c) {
758
- var A = null, O = null;
759
- try {
760
- var T = new G(i, c);
761
- } catch {
762
- return null;
763
- }
764
- return t.forEach(function(w) {
765
- T.test(w) && (!A || O.compare(w) === -1) && (A = w, O = new C(A, c));
766
- }), A;
767
- }
768
- p.minSatisfying = Jt;
769
- function Jt(t, i, c) {
770
- var A = null, O = null;
771
- try {
772
- var T = new G(i, c);
773
- } catch {
774
- return null;
775
- }
776
- return t.forEach(function(w) {
777
- T.test(w) && (!A || O.compare(w) === 1) && (A = w, O = new C(A, c));
778
- }), A;
779
- }
780
- p.minVersion = Qt;
781
- function Qt(t, i) {
782
- t = new G(t, i);
783
- var c = new C("0.0.0");
784
- if (t.test(c) || (c = new C("0.0.0-0"), t.test(c)))
785
- return c;
786
- c = null;
787
- for (var A = 0; A < t.set.length; ++A) {
788
- var O = t.set[A];
789
- O.forEach(function(T) {
790
- var w = new C(T.semver.version);
791
- switch (T.operator) {
792
- case ">":
793
- w.prerelease.length === 0 ? w.patch++ : w.prerelease.push(0), w.raw = w.format();
794
- case "":
795
- case ">=":
796
- (!c || k(c, w)) && (c = w);
797
- break;
798
- case "<":
799
- case "<=":
800
- break;
801
- default:
802
- throw new Error("Unexpected operation: " + T.operator);
803
- }
804
- });
805
- }
806
- return c && t.test(c) ? c : null;
807
- }
808
- p.validRange = er;
809
- function er(t, i) {
810
- try {
811
- return new G(t, i).range || "*";
812
- } catch {
813
- return null;
814
- }
815
- }
816
- p.ltr = tr;
817
- function tr(t, i, c) {
818
- return Me(t, i, "<", c);
819
- }
820
- p.gtr = rr;
821
- function rr(t, i, c) {
822
- return Me(t, i, ">", c);
823
- }
824
- p.outside = Me;
825
- function Me(t, i, c, A) {
826
- t = new C(t, A), i = new G(i, A);
827
- var O, T, w, $, j;
828
- switch (c) {
829
- case ">":
830
- O = k, T = W, w = V, $ = ">", j = ">=";
831
- break;
832
- case "<":
833
- O = V, T = X, w = k, $ = "<", j = "<=";
834
- break;
835
- default:
836
- throw new TypeError('Must provide a hilo val of "<" or ">"');
837
- }
838
- if (Ce(t, i, A))
839
- return !1;
840
- for (var pe = 0; pe < i.set.length; ++pe) {
841
- var de = i.set[pe], se = null, ne = null;
842
- if (de.forEach(function(Se) {
843
- Se.semver === he && (Se = new K(">=0.0.0")), se = se || Se, ne = ne || Se, O(Se.semver, se.semver, A) ? se = Se : w(Se.semver, ne.semver, A) && (ne = Se);
844
- }), se.operator === $ || se.operator === j || (!ne.operator || ne.operator === $) && T(t, ne.semver))
845
- return !1;
846
- if (ne.operator === j && w(t, ne.semver))
847
- return !1;
848
- }
849
- return !0;
850
- }
851
- p.prerelease = nr;
852
- function nr(t, i) {
853
- var c = fe(t, i);
854
- return c && c.prerelease.length ? c.prerelease : null;
855
- }
856
- p.intersects = ar;
857
- function ar(t, i, c) {
858
- return t = new G(t, c), i = new G(i, c), t.intersects(i);
859
- }
860
- p.coerce = sr;
861
- function sr(t, i) {
862
- if (t instanceof C)
863
- return t;
864
- if (typeof t == "number" && (t = String(t)), typeof t != "string")
865
- return null;
866
- i = i || {};
867
- var c = null;
868
- if (!i.rtl)
869
- c = t.match(L[m.COERCE]);
870
- else {
871
- for (var A; (A = L[m.COERCERTL].exec(t)) && (!c || c.index + c[0].length !== t.length); )
872
- (!c || A.index + A[0].length !== c.index + c[0].length) && (c = A), L[m.COERCERTL].lastIndex = A.index + A[1].length + A[2].length;
873
- L[m.COERCERTL].lastIndex = -1;
874
- }
875
- return c === null ? null : fe(c[2] + "." + (c[3] || "0") + "." + (c[4] || "0"), i);
876
- }
877
- })(Qe, Qe.exports);
878
- var Gr = Qe.exports;
879
- const Oa = /* @__PURE__ */ Mr(Gr), va = (n) => n == null ? [] : Array.isArray(n) ? n : [n], Ta = e.any().refine((n) => typeof n == "bigint", {
880
- message: "Value must be a BigInt"
881
- }).transform((n) => BigInt(n));
882
- var Br = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, Ge = Math.ceil, oe = Math.floor, te = "[BigNumber Error] ", ft = te + "Number primitive has more than 15 significant digits: ", le = 1e14, P = 14, Be = 9007199254740991, $e = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], Re = 1e7, Y = 1e9;
883
- function Nt(n) {
884
- var p, R, _, S = v.prototype = { constructor: v, toString: null, valueOf: null }, B = new v(1), M = 20, F = 4, L = -7, I = 21, m = -1e7, J = 1e7, D = !1, me = 1, ae = 0, Ee = {
885
- prefix: "",
886
- groupSize: 3,
887
- secondaryGroupSize: 0,
888
- groupSeparator: ",",
889
- decimalSeparator: ".",
890
- fractionGroupSize: 0,
891
- fractionGroupSeparator: " ",
892
- // non-breaking space
893
- suffix: ""
894
- }, ge = "0123456789abcdefghijklmnopqrstuvwxyz", we = !0;
895
- function v(r, a) {
896
- var s, h, l, f, g, o, u, E, d = this;
897
- if (!(d instanceof v)) return new v(r, a);
898
- if (a == null) {
899
- if (r && r._isBigNumber === !0) {
900
- d.s = r.s, !r.c || r.e > J ? d.c = d.e = null : r.e < m ? d.c = [d.e = 0] : (d.e = r.e, d.c = r.c.slice());
901
- return;
902
- }
903
- if ((o = typeof r == "number") && r * 0 == 0) {
904
- if (d.s = 1 / r < 0 ? (r = -r, -1) : 1, r === ~~r) {
905
- for (f = 0, g = r; g >= 10; g /= 10, f++) ;
906
- f > J ? d.c = d.e = null : (d.e = f, d.c = [r]);
907
- return;
908
- }
909
- E = String(r);
910
- } else {
911
- if (!Br.test(E = String(r))) return _(d, E, o);
912
- d.s = E.charCodeAt(0) == 45 ? (E = E.slice(1), -1) : 1;
913
- }
914
- (f = E.indexOf(".")) > -1 && (E = E.replace(".", "")), (g = E.search(/e/i)) > 0 ? (f < 0 && (f = g), f += +E.slice(g + 1), E = E.substring(0, g)) : f < 0 && (f = E.length);
915
- } else {
916
- if (z(a, 2, ge.length, "Base"), a == 10 && we)
917
- return d = new v(r), Q(d, M + d.e + 1, F);
918
- if (E = String(r), o = typeof r == "number") {
919
- if (r * 0 != 0) return _(d, E, o, a);
920
- if (d.s = 1 / r < 0 ? (E = E.slice(1), -1) : 1, v.DEBUG && E.replace(/^0\.0*|\./, "").length > 15)
921
- throw Error(ft + r);
922
- } else
923
- d.s = E.charCodeAt(0) === 45 ? (E = E.slice(1), -1) : 1;
924
- for (s = ge.slice(0, a), f = g = 0, u = E.length; g < u; g++)
925
- if (s.indexOf(h = E.charAt(g)) < 0) {
926
- if (h == ".") {
927
- if (g > f) {
928
- f = u;
929
- continue;
930
- }
931
- } else if (!l && (E == E.toUpperCase() && (E = E.toLowerCase()) || E == E.toLowerCase() && (E = E.toUpperCase()))) {
932
- l = !0, g = -1, f = 0;
933
- continue;
934
- }
935
- return _(d, String(r), o, a);
936
- }
937
- o = !1, E = R(E, a, 10, d.s), (f = E.indexOf(".")) > -1 ? E = E.replace(".", "") : f = E.length;
938
- }
939
- for (g = 0; E.charCodeAt(g) === 48; g++) ;
940
- for (u = E.length; E.charCodeAt(--u) === 48; ) ;
941
- if (E = E.slice(g, ++u)) {
942
- if (u -= g, o && v.DEBUG && u > 15 && (r > Be || r !== oe(r)))
943
- throw Error(ft + d.s * r);
944
- if ((f = f - g - 1) > J)
945
- d.c = d.e = null;
946
- else if (f < m)
947
- d.c = [d.e = 0];
948
- else {
949
- if (d.e = f, d.c = [], g = (f + 1) % P, f < 0 && (g += P), g < u) {
950
- for (g && d.c.push(+E.slice(0, g)), u -= P; g < u; )
951
- d.c.push(+E.slice(g, g += P));
952
- g = P - (E = E.slice(g)).length;
953
- } else
954
- g -= u;
955
- for (; g--; E += "0") ;
956
- d.c.push(+E);
957
- }
958
- } else
959
- d.c = [d.e = 0];
960
- }
961
- v.clone = Nt, v.ROUND_UP = 0, v.ROUND_DOWN = 1, v.ROUND_CEIL = 2, v.ROUND_FLOOR = 3, v.ROUND_HALF_UP = 4, v.ROUND_HALF_DOWN = 5, v.ROUND_HALF_EVEN = 6, v.ROUND_HALF_CEIL = 7, v.ROUND_HALF_FLOOR = 8, v.EUCLID = 9, v.config = v.set = function(r) {
962
- var a, s;
963
- if (r != null)
964
- if (typeof r == "object") {
965
- if (r.hasOwnProperty(a = "DECIMAL_PLACES") && (s = r[a], z(s, 0, Y, a), M = s), r.hasOwnProperty(a = "ROUNDING_MODE") && (s = r[a], z(s, 0, 8, a), F = s), r.hasOwnProperty(a = "EXPONENTIAL_AT") && (s = r[a], s && s.pop ? (z(s[0], -Y, 0, a), z(s[1], 0, Y, a), L = s[0], I = s[1]) : (z(s, -Y, Y, a), L = -(I = s < 0 ? -s : s))), r.hasOwnProperty(a = "RANGE"))
966
- if (s = r[a], s && s.pop)
967
- z(s[0], -Y, -1, a), z(s[1], 1, Y, a), m = s[0], J = s[1];
968
- else if (z(s, -Y, Y, a), s)
969
- m = -(J = s < 0 ? -s : s);
970
- else
971
- throw Error(te + a + " cannot be zero: " + s);
972
- if (r.hasOwnProperty(a = "CRYPTO"))
973
- if (s = r[a], s === !!s)
974
- if (s)
975
- if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes))
976
- D = s;
977
- else
978
- throw D = !s, Error(te + "crypto unavailable");
979
- else
980
- D = s;
981
- else
982
- throw Error(te + a + " not true or false: " + s);
983
- if (r.hasOwnProperty(a = "MODULO_MODE") && (s = r[a], z(s, 0, 9, a), me = s), r.hasOwnProperty(a = "POW_PRECISION") && (s = r[a], z(s, 0, Y, a), ae = s), r.hasOwnProperty(a = "FORMAT"))
984
- if (s = r[a], typeof s == "object") Ee = s;
985
- else throw Error(te + a + " not an object: " + s);
986
- if (r.hasOwnProperty(a = "ALPHABET"))
987
- if (s = r[a], typeof s == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(s))
988
- we = s.slice(0, 10) == "0123456789", ge = s;
989
- else
990
- throw Error(te + a + " invalid: " + s);
991
- } else
992
- throw Error(te + "Object expected: " + r);
993
- return {
994
- DECIMAL_PLACES: M,
995
- ROUNDING_MODE: F,
996
- EXPONENTIAL_AT: [L, I],
997
- RANGE: [m, J],
998
- CRYPTO: D,
999
- MODULO_MODE: me,
1000
- POW_PRECISION: ae,
1001
- FORMAT: Ee,
1002
- ALPHABET: ge
1003
- };
1004
- }, v.isBigNumber = function(r) {
1005
- if (!r || r._isBigNumber !== !0) return !1;
1006
- if (!v.DEBUG) return !0;
1007
- var a, s, h = r.c, l = r.e, f = r.s;
1008
- e: if ({}.toString.call(h) == "[object Array]") {
1009
- if ((f === 1 || f === -1) && l >= -Y && l <= Y && l === oe(l)) {
1010
- if (h[0] === 0) {
1011
- if (l === 0 && h.length === 1) return !0;
1012
- break e;
1013
- }
1014
- if (a = (l + 1) % P, a < 1 && (a += P), String(h[0]).length == a) {
1015
- for (a = 0; a < h.length; a++)
1016
- if (s = h[a], s < 0 || s >= le || s !== oe(s)) break e;
1017
- if (s !== 0) return !0;
1018
- }
1019
- }
1020
- } else if (h === null && l === null && (f === null || f === 1 || f === -1))
1021
- return !0;
1022
- throw Error(te + "Invalid BigNumber: " + r);
1023
- }, v.maximum = v.max = function() {
1024
- return fe(arguments, -1);
1025
- }, v.minimum = v.min = function() {
1026
- return fe(arguments, 1);
1027
- }, v.random = function() {
1028
- var r = 9007199254740992, a = Math.random() * r & 2097151 ? function() {
1029
- return oe(Math.random() * r);
1030
- } : function() {
1031
- return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
1032
- };
1033
- return function(s) {
1034
- var h, l, f, g, o, u = 0, E = [], d = new v(B);
1035
- if (s == null ? s = M : z(s, 0, Y), g = Ge(s / P), D)
1036
- if (crypto.getRandomValues) {
1037
- for (h = crypto.getRandomValues(new Uint32Array(g *= 2)); u < g; )
1038
- o = h[u] * 131072 + (h[u + 1] >>> 11), o >= 9e15 ? (l = crypto.getRandomValues(new Uint32Array(2)), h[u] = l[0], h[u + 1] = l[1]) : (E.push(o % 1e14), u += 2);
1039
- u = g / 2;
1040
- } else if (crypto.randomBytes) {
1041
- for (h = crypto.randomBytes(g *= 7); u < g; )
1042
- o = (h[u] & 31) * 281474976710656 + h[u + 1] * 1099511627776 + h[u + 2] * 4294967296 + h[u + 3] * 16777216 + (h[u + 4] << 16) + (h[u + 5] << 8) + h[u + 6], o >= 9e15 ? crypto.randomBytes(7).copy(h, u) : (E.push(o % 1e14), u += 7);
1043
- u = g / 7;
1044
- } else
1045
- throw D = !1, Error(te + "crypto unavailable");
1046
- if (!D)
1047
- for (; u < g; )
1048
- o = a(), o < 9e15 && (E[u++] = o % 1e14);
1049
- for (g = E[--u], s %= P, g && s && (o = $e[P - s], E[u] = oe(g / o) * o); E[u] === 0; E.pop(), u--) ;
1050
- if (u < 0)
1051
- E = [f = 0];
1052
- else {
1053
- for (f = -1; E[0] === 0; E.splice(0, 1), f -= P) ;
1054
- for (u = 1, o = E[0]; o >= 10; o /= 10, u++) ;
1055
- u < P && (f -= P - u);
1056
- }
1057
- return d.e = f, d.c = E, d;
1058
- };
1059
- }(), v.sum = function() {
1060
- for (var r = 1, a = arguments, s = new v(a[0]); r < a.length; ) s = s.plus(a[r++]);
1061
- return s;
1062
- }, R = /* @__PURE__ */ function() {
1063
- var r = "0123456789";
1064
- function a(s, h, l, f) {
1065
- for (var g, o = [0], u, E = 0, d = s.length; E < d; ) {
1066
- for (u = o.length; u--; o[u] *= h) ;
1067
- for (o[0] += f.indexOf(s.charAt(E++)), g = 0; g < o.length; g++)
1068
- o[g] > l - 1 && (o[g + 1] == null && (o[g + 1] = 0), o[g + 1] += o[g] / l | 0, o[g] %= l);
1069
- }
1070
- return o.reverse();
1071
- }
1072
- return function(s, h, l, f, g) {
1073
- var o, u, E, d, N, y, b, k, V = s.indexOf("."), H = M, x = F;
1074
- for (V >= 0 && (d = ae, ae = 0, s = s.replace(".", ""), k = new v(h), y = k.pow(s.length - V), ae = d, k.c = a(
1075
- Ae(ie(y.c), y.e, "0"),
1076
- 10,
1077
- l,
1078
- r
1079
- ), k.e = k.c.length), b = a(s, h, l, g ? (o = ge, r) : (o = r, ge)), E = d = b.length; b[--d] == 0; b.pop()) ;
1080
- if (!b[0]) return o.charAt(0);
1081
- if (V < 0 ? --E : (y.c = b, y.e = E, y.s = f, y = p(y, k, H, x, l), b = y.c, N = y.r, E = y.e), u = E + H + 1, V = b[u], d = l / 2, N = N || u < 0 || b[u + 1] != null, N = x < 4 ? (V != null || N) && (x == 0 || x == (y.s < 0 ? 3 : 2)) : V > d || V == d && (x == 4 || N || x == 6 && b[u - 1] & 1 || x == (y.s < 0 ? 8 : 7)), u < 1 || !b[0])
1082
- s = N ? Ae(o.charAt(1), -H, o.charAt(0)) : o.charAt(0);
1083
- else {
1084
- if (b.length = u, N)
1085
- for (--l; ++b[--u] > l; )
1086
- b[u] = 0, u || (++E, b = [1].concat(b));
1087
- for (d = b.length; !b[--d]; ) ;
1088
- for (V = 0, s = ""; V <= d; s += o.charAt(b[V++])) ;
1089
- s = Ae(s, E, o.charAt(0));
1090
- }
1091
- return s;
1092
- };
1093
- }(), p = /* @__PURE__ */ function() {
1094
- function r(h, l, f) {
1095
- var g, o, u, E, d = 0, N = h.length, y = l % Re, b = l / Re | 0;
1096
- for (h = h.slice(); N--; )
1097
- u = h[N] % Re, E = h[N] / Re | 0, g = b * u + E * y, o = y * u + g % Re * Re + d, d = (o / f | 0) + (g / Re | 0) + b * E, h[N] = o % f;
1098
- return d && (h = [d].concat(h)), h;
1099
- }
1100
- function a(h, l, f, g) {
1101
- var o, u;
1102
- if (f != g)
1103
- u = f > g ? 1 : -1;
1104
- else
1105
- for (o = u = 0; o < f; o++)
1106
- if (h[o] != l[o]) {
1107
- u = h[o] > l[o] ? 1 : -1;
1108
- break;
1109
- }
1110
- return u;
1111
- }
1112
- function s(h, l, f, g) {
1113
- for (var o = 0; f--; )
1114
- h[f] -= o, o = h[f] < l[f] ? 1 : 0, h[f] = o * g + h[f] - l[f];
1115
- for (; !h[0] && h.length > 1; h.splice(0, 1)) ;
1116
- }
1117
- return function(h, l, f, g, o) {
1118
- var u, E, d, N, y, b, k, V, H, x, X, W, Ie, K, he, G, Ne, ee = h.s == l.s ? 1 : -1, Z = h.c, U = l.c;
1119
- if (!Z || !Z[0] || !U || !U[0])
1120
- return new v(
1121
- // Return NaN if either NaN, or both Infinity or 0.
1122
- !h.s || !l.s || (Z ? U && Z[0] == U[0] : !U) ? NaN : (
1123
- // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
1124
- Z && Z[0] == 0 || !U ? ee * 0 : ee / 0
1125
- )
1126
- );
1127
- for (V = new v(ee), H = V.c = [], E = h.e - l.e, ee = f + E + 1, o || (o = le, E = ce(h.e / P) - ce(l.e / P), ee = ee / P | 0), d = 0; U[d] == (Z[d] || 0); d++) ;
1128
- if (U[d] > (Z[d] || 0) && E--, ee < 0)
1129
- H.push(1), N = !0;
1130
- else {
1131
- for (K = Z.length, G = U.length, d = 0, ee += 2, y = oe(o / (U[0] + 1)), y > 1 && (U = r(U, y, o), Z = r(Z, y, o), G = U.length, K = Z.length), Ie = G, x = Z.slice(0, G), X = x.length; X < G; x[X++] = 0) ;
1132
- Ne = U.slice(), Ne = [0].concat(Ne), he = U[0], U[1] >= o / 2 && he++;
1133
- do {
1134
- if (y = 0, u = a(U, x, G, X), u < 0) {
1135
- if (W = x[0], G != X && (W = W * o + (x[1] || 0)), y = oe(W / he), y > 1)
1136
- for (y >= o && (y = o - 1), b = r(U, y, o), k = b.length, X = x.length; a(b, x, k, X) == 1; )
1137
- y--, s(b, G < k ? Ne : U, k, o), k = b.length, u = 1;
1138
- else
1139
- y == 0 && (u = y = 1), b = U.slice(), k = b.length;
1140
- if (k < X && (b = [0].concat(b)), s(x, b, X, o), X = x.length, u == -1)
1141
- for (; a(U, x, G, X) < 1; )
1142
- y++, s(x, G < X ? Ne : U, X, o), X = x.length;
1143
- } else u === 0 && (y++, x = [0]);
1144
- H[d++] = y, x[0] ? x[X++] = Z[Ie] || 0 : (x = [Z[Ie]], X = 1);
1145
- } while ((Ie++ < K || x[0] != null) && ee--);
1146
- N = x[0] != null, H[0] || H.splice(0, 1);
1147
- }
1148
- if (o == le) {
1149
- for (d = 1, ee = H[0]; ee >= 10; ee /= 10, d++) ;
1150
- Q(V, f + (V.e = d + E * P - 1) + 1, g, N);
1151
- } else
1152
- V.e = E, V.r = +N;
1153
- return V;
1154
- };
1155
- }();
1156
- function re(r, a, s, h) {
1157
- var l, f, g, o, u;
1158
- if (s == null ? s = F : z(s, 0, 8), !r.c) return r.toString();
1159
- if (l = r.c[0], g = r.e, a == null)
1160
- u = ie(r.c), u = h == 1 || h == 2 && (g <= L || g >= I) ? Pe(u, g) : Ae(u, g, "0");
1161
- else if (r = Q(new v(r), a, s), f = r.e, u = ie(r.c), o = u.length, h == 1 || h == 2 && (a <= f || f <= L)) {
1162
- for (; o < a; u += "0", o++) ;
1163
- u = Pe(u, f);
1164
- } else if (a -= g, u = Ae(u, f, "0"), f + 1 > o) {
1165
- if (--a > 0) for (u += "."; a--; u += "0") ;
1166
- } else if (a += f - o, a > 0)
1167
- for (f + 1 == o && (u += "."); a--; u += "0") ;
1168
- return r.s < 0 && l ? "-" + u : u;
1169
- }
1170
- function fe(r, a) {
1171
- for (var s, h, l = 1, f = new v(r[0]); l < r.length; l++)
1172
- h = new v(r[l]), (!h.s || (s = ve(f, h)) === a || s === 0 && f.s === a) && (f = h);
1173
- return f;
1174
- }
1175
- function ye(r, a, s) {
1176
- for (var h = 1, l = a.length; !a[--l]; a.pop()) ;
1177
- for (l = a[0]; l >= 10; l /= 10, h++) ;
1178
- return (s = h + s * P - 1) > J ? r.c = r.e = null : s < m ? r.c = [r.e = 0] : (r.e = s, r.c = a), r;
1179
- }
1180
- _ = /* @__PURE__ */ function() {
1181
- var r = /^(-?)0([xbo])(?=\w[\w.]*$)/i, a = /^([^.]+)\.$/, s = /^\.([^.]+)$/, h = /^-?(Infinity|NaN)$/, l = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
1182
- return function(f, g, o, u) {
1183
- var E, d = o ? g : g.replace(l, "");
1184
- if (h.test(d))
1185
- f.s = isNaN(d) ? null : d < 0 ? -1 : 1;
1186
- else {
1187
- if (!o && (d = d.replace(r, function(N, y, b) {
1188
- return E = (b = b.toLowerCase()) == "x" ? 16 : b == "b" ? 2 : 8, !u || u == E ? y : N;
1189
- }), u && (E = u, d = d.replace(a, "$1").replace(s, "0.$1")), g != d))
1190
- return new v(d, E);
1191
- if (v.DEBUG)
1192
- throw Error(te + "Not a" + (u ? " base " + u : "") + " number: " + g);
1193
- f.s = null;
1194
- }
1195
- f.c = f.e = null;
1196
- };
1197
- }();
1198
- function Q(r, a, s, h) {
1199
- var l, f, g, o, u, E, d, N = r.c, y = $e;
1200
- if (N) {
1201
- e: {
1202
- for (l = 1, o = N[0]; o >= 10; o /= 10, l++) ;
1203
- if (f = a - l, f < 0)
1204
- f += P, g = a, u = N[E = 0], d = oe(u / y[l - g - 1] % 10);
1205
- else if (E = Ge((f + 1) / P), E >= N.length)
1206
- if (h) {
1207
- for (; N.length <= E; N.push(0)) ;
1208
- u = d = 0, l = 1, f %= P, g = f - P + 1;
1209
- } else
1210
- break e;
1211
- else {
1212
- for (u = o = N[E], l = 1; o >= 10; o /= 10, l++) ;
1213
- f %= P, g = f - P + l, d = g < 0 ? 0 : oe(u / y[l - g - 1] % 10);
1214
- }
1215
- if (h = h || a < 0 || // Are there any non-zero digits after the rounding digit?
1216
- // The expression n % pows10[d - j - 1] returns all digits of n to the right
1217
- // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
1218
- N[E + 1] != null || (g < 0 ? u : u % y[l - g - 1]), h = s < 4 ? (d || h) && (s == 0 || s == (r.s < 0 ? 3 : 2)) : d > 5 || d == 5 && (s == 4 || h || s == 6 && // Check whether the digit to the left of the rounding digit is odd.
1219
- (f > 0 ? g > 0 ? u / y[l - g] : 0 : N[E - 1]) % 10 & 1 || s == (r.s < 0 ? 8 : 7)), a < 1 || !N[0])
1220
- return N.length = 0, h ? (a -= r.e + 1, N[0] = y[(P - a % P) % P], r.e = -a || 0) : N[0] = r.e = 0, r;
1221
- if (f == 0 ? (N.length = E, o = 1, E--) : (N.length = E + 1, o = y[P - f], N[E] = g > 0 ? oe(u / y[l - g] % y[g]) * o : 0), h)
1222
- for (; ; )
1223
- if (E == 0) {
1224
- for (f = 1, g = N[0]; g >= 10; g /= 10, f++) ;
1225
- for (g = N[0] += o, o = 1; g >= 10; g /= 10, o++) ;
1226
- f != o && (r.e++, N[0] == le && (N[0] = 1));
1227
- break;
1228
- } else {
1229
- if (N[E] += o, N[E] != le) break;
1230
- N[E--] = 0, o = 1;
1231
- }
1232
- for (f = N.length; N[--f] === 0; N.pop()) ;
1233
- }
1234
- r.e > J ? r.c = r.e = null : r.e < m && (r.c = [r.e = 0]);
1235
- }
1236
- return r;
1237
- }
1238
- function C(r) {
1239
- var a, s = r.e;
1240
- return s === null ? r.toString() : (a = ie(r.c), a = s <= L || s >= I ? Pe(a, s) : Ae(a, s, "0"), r.s < 0 ? "-" + a : a);
1241
- }
1242
- return S.absoluteValue = S.abs = function() {
1243
- var r = new v(this);
1244
- return r.s < 0 && (r.s = 1), r;
1245
- }, S.comparedTo = function(r, a) {
1246
- return ve(this, new v(r, a));
1247
- }, S.decimalPlaces = S.dp = function(r, a) {
1248
- var s, h, l, f = this;
1249
- if (r != null)
1250
- return z(r, 0, Y), a == null ? a = F : z(a, 0, 8), Q(new v(f), r + f.e + 1, a);
1251
- if (!(s = f.c)) return null;
1252
- if (h = ((l = s.length - 1) - ce(this.e / P)) * P, l = s[l]) for (; l % 10 == 0; l /= 10, h--) ;
1253
- return h < 0 && (h = 0), h;
1254
- }, S.dividedBy = S.div = function(r, a) {
1255
- return p(this, new v(r, a), M, F);
1256
- }, S.dividedToIntegerBy = S.idiv = function(r, a) {
1257
- return p(this, new v(r, a), 0, 1);
1258
- }, S.exponentiatedBy = S.pow = function(r, a) {
1259
- var s, h, l, f, g, o, u, E, d, N = this;
1260
- if (r = new v(r), r.c && !r.isInteger())
1261
- throw Error(te + "Exponent not an integer: " + C(r));
1262
- if (a != null && (a = new v(a)), o = r.e > 14, !N.c || !N.c[0] || N.c[0] == 1 && !N.e && N.c.length == 1 || !r.c || !r.c[0])
1263
- return d = new v(Math.pow(+C(N), o ? r.s * (2 - De(r)) : +C(r))), a ? d.mod(a) : d;
1264
- if (u = r.s < 0, a) {
1265
- if (a.c ? !a.c[0] : !a.s) return new v(NaN);
1266
- h = !u && N.isInteger() && a.isInteger(), h && (N = N.mod(a));
1267
- } else {
1268
- if (r.e > 9 && (N.e > 0 || N.e < -1 || (N.e == 0 ? N.c[0] > 1 || o && N.c[1] >= 24e7 : N.c[0] < 8e13 || o && N.c[0] <= 9999975e7)))
1269
- return f = N.s < 0 && De(r) ? -0 : 0, N.e > -1 && (f = 1 / f), new v(u ? 1 / f : f);
1270
- ae && (f = Ge(ae / P + 2));
1271
- }
1272
- for (o ? (s = new v(0.5), u && (r.s = 1), E = De(r)) : (l = Math.abs(+C(r)), E = l % 2), d = new v(B); ; ) {
1273
- if (E) {
1274
- if (d = d.times(N), !d.c) break;
1275
- f ? d.c.length > f && (d.c.length = f) : h && (d = d.mod(a));
1276
- }
1277
- if (l) {
1278
- if (l = oe(l / 2), l === 0) break;
1279
- E = l % 2;
1280
- } else if (r = r.times(s), Q(r, r.e + 1, 1), r.e > 14)
1281
- E = De(r);
1282
- else {
1283
- if (l = +C(r), l === 0) break;
1284
- E = l % 2;
1285
- }
1286
- N = N.times(N), f ? N.c && N.c.length > f && (N.c.length = f) : h && (N = N.mod(a));
1287
- }
1288
- return h ? d : (u && (d = B.div(d)), a ? d.mod(a) : f ? Q(d, ae, F, g) : d);
1289
- }, S.integerValue = function(r) {
1290
- var a = new v(this);
1291
- return r == null ? r = F : z(r, 0, 8), Q(a, a.e + 1, r);
1292
- }, S.isEqualTo = S.eq = function(r, a) {
1293
- return ve(this, new v(r, a)) === 0;
1294
- }, S.isFinite = function() {
1295
- return !!this.c;
1296
- }, S.isGreaterThan = S.gt = function(r, a) {
1297
- return ve(this, new v(r, a)) > 0;
1298
- }, S.isGreaterThanOrEqualTo = S.gte = function(r, a) {
1299
- return (a = ve(this, new v(r, a))) === 1 || a === 0;
1300
- }, S.isInteger = function() {
1301
- return !!this.c && ce(this.e / P) > this.c.length - 2;
1302
- }, S.isLessThan = S.lt = function(r, a) {
1303
- return ve(this, new v(r, a)) < 0;
1304
- }, S.isLessThanOrEqualTo = S.lte = function(r, a) {
1305
- return (a = ve(this, new v(r, a))) === -1 || a === 0;
1306
- }, S.isNaN = function() {
1307
- return !this.s;
1308
- }, S.isNegative = function() {
1309
- return this.s < 0;
1310
- }, S.isPositive = function() {
1311
- return this.s > 0;
1312
- }, S.isZero = function() {
1313
- return !!this.c && this.c[0] == 0;
1314
- }, S.minus = function(r, a) {
1315
- var s, h, l, f, g = this, o = g.s;
1316
- if (r = new v(r, a), a = r.s, !o || !a) return new v(NaN);
1317
- if (o != a)
1318
- return r.s = -a, g.plus(r);
1319
- var u = g.e / P, E = r.e / P, d = g.c, N = r.c;
1320
- if (!u || !E) {
1321
- if (!d || !N) return d ? (r.s = -a, r) : new v(N ? g : NaN);
1322
- if (!d[0] || !N[0])
1323
- return N[0] ? (r.s = -a, r) : new v(d[0] ? g : (
1324
- // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
1325
- F == 3 ? -0 : 0
1326
- ));
1327
- }
1328
- if (u = ce(u), E = ce(E), d = d.slice(), o = u - E) {
1329
- for ((f = o < 0) ? (o = -o, l = d) : (E = u, l = N), l.reverse(), a = o; a--; l.push(0)) ;
1330
- l.reverse();
1331
- } else
1332
- for (h = (f = (o = d.length) < (a = N.length)) ? o : a, o = a = 0; a < h; a++)
1333
- if (d[a] != N[a]) {
1334
- f = d[a] < N[a];
1335
- break;
1336
- }
1337
- if (f && (l = d, d = N, N = l, r.s = -r.s), a = (h = N.length) - (s = d.length), a > 0) for (; a--; d[s++] = 0) ;
1338
- for (a = le - 1; h > o; ) {
1339
- if (d[--h] < N[h]) {
1340
- for (s = h; s && !d[--s]; d[s] = a) ;
1341
- --d[s], d[h] += le;
1342
- }
1343
- d[h] -= N[h];
1344
- }
1345
- for (; d[0] == 0; d.splice(0, 1), --E) ;
1346
- return d[0] ? ye(r, d, E) : (r.s = F == 3 ? -1 : 1, r.c = [r.e = 0], r);
1347
- }, S.modulo = S.mod = function(r, a) {
1348
- var s, h, l = this;
1349
- return r = new v(r, a), !l.c || !r.s || r.c && !r.c[0] ? new v(NaN) : !r.c || l.c && !l.c[0] ? new v(l) : (me == 9 ? (h = r.s, r.s = 1, s = p(l, r, 0, 3), r.s = h, s.s *= h) : s = p(l, r, 0, me), r = l.minus(s.times(r)), !r.c[0] && me == 1 && (r.s = l.s), r);
1350
- }, S.multipliedBy = S.times = function(r, a) {
1351
- var s, h, l, f, g, o, u, E, d, N, y, b, k, V, H, x = this, X = x.c, W = (r = new v(r, a)).c;
1352
- if (!X || !W || !X[0] || !W[0])
1353
- return !x.s || !r.s || X && !X[0] && !W || W && !W[0] && !X ? r.c = r.e = r.s = null : (r.s *= x.s, !X || !W ? r.c = r.e = null : (r.c = [0], r.e = 0)), r;
1354
- for (h = ce(x.e / P) + ce(r.e / P), r.s *= x.s, u = X.length, N = W.length, u < N && (k = X, X = W, W = k, l = u, u = N, N = l), l = u + N, k = []; l--; k.push(0)) ;
1355
- for (V = le, H = Re, l = N; --l >= 0; ) {
1356
- for (s = 0, y = W[l] % H, b = W[l] / H | 0, g = u, f = l + g; f > l; )
1357
- E = X[--g] % H, d = X[g] / H | 0, o = b * E + d * y, E = y * E + o % H * H + k[f] + s, s = (E / V | 0) + (o / H | 0) + b * d, k[f--] = E % V;
1358
- k[f] = s;
1359
- }
1360
- return s ? ++h : k.splice(0, 1), ye(r, k, h);
1361
- }, S.negated = function() {
1362
- var r = new v(this);
1363
- return r.s = -r.s || null, r;
1364
- }, S.plus = function(r, a) {
1365
- var s, h = this, l = h.s;
1366
- if (r = new v(r, a), a = r.s, !l || !a) return new v(NaN);
1367
- if (l != a)
1368
- return r.s = -a, h.minus(r);
1369
- var f = h.e / P, g = r.e / P, o = h.c, u = r.c;
1370
- if (!f || !g) {
1371
- if (!o || !u) return new v(l / 0);
1372
- if (!o[0] || !u[0]) return u[0] ? r : new v(o[0] ? h : l * 0);
1373
- }
1374
- if (f = ce(f), g = ce(g), o = o.slice(), l = f - g) {
1375
- for (l > 0 ? (g = f, s = u) : (l = -l, s = o), s.reverse(); l--; s.push(0)) ;
1376
- s.reverse();
1377
- }
1378
- for (l = o.length, a = u.length, l - a < 0 && (s = u, u = o, o = s, a = l), l = 0; a; )
1379
- l = (o[--a] = o[a] + u[a] + l) / le | 0, o[a] = le === o[a] ? 0 : o[a] % le;
1380
- return l && (o = [l].concat(o), ++g), ye(r, o, g);
1381
- }, S.precision = S.sd = function(r, a) {
1382
- var s, h, l, f = this;
1383
- if (r != null && r !== !!r)
1384
- return z(r, 1, Y), a == null ? a = F : z(a, 0, 8), Q(new v(f), r, a);
1385
- if (!(s = f.c)) return null;
1386
- if (l = s.length - 1, h = l * P + 1, l = s[l]) {
1387
- for (; l % 10 == 0; l /= 10, h--) ;
1388
- for (l = s[0]; l >= 10; l /= 10, h++) ;
1389
- }
1390
- return r && f.e + 1 > h && (h = f.e + 1), h;
1391
- }, S.shiftedBy = function(r) {
1392
- return z(r, -Be, Be), this.times("1e" + r);
1393
- }, S.squareRoot = S.sqrt = function() {
1394
- var r, a, s, h, l, f = this, g = f.c, o = f.s, u = f.e, E = M + 4, d = new v("0.5");
1395
- if (o !== 1 || !g || !g[0])
1396
- return new v(!o || o < 0 && (!g || g[0]) ? NaN : g ? f : 1 / 0);
1397
- if (o = Math.sqrt(+C(f)), o == 0 || o == 1 / 0 ? (a = ie(g), (a.length + u) % 2 == 0 && (a += "0"), o = Math.sqrt(+a), u = ce((u + 1) / 2) - (u < 0 || u % 2), o == 1 / 0 ? a = "5e" + u : (a = o.toExponential(), a = a.slice(0, a.indexOf("e") + 1) + u), s = new v(a)) : s = new v(o + ""), s.c[0]) {
1398
- for (u = s.e, o = u + E, o < 3 && (o = 0); ; )
1399
- if (l = s, s = d.times(l.plus(p(f, l, E, 1))), ie(l.c).slice(0, o) === (a = ie(s.c)).slice(0, o))
1400
- if (s.e < u && --o, a = a.slice(o - 3, o + 1), a == "9999" || !h && a == "4999") {
1401
- if (!h && (Q(l, l.e + M + 2, 0), l.times(l).eq(f))) {
1402
- s = l;
1403
- break;
1404
- }
1405
- E += 4, o += 4, h = 1;
1406
- } else {
1407
- (!+a || !+a.slice(1) && a.charAt(0) == "5") && (Q(s, s.e + M + 2, 1), r = !s.times(s).eq(f));
1408
- break;
1409
- }
1410
- }
1411
- return Q(s, s.e + M + 1, F, r);
1412
- }, S.toExponential = function(r, a) {
1413
- return r != null && (z(r, 0, Y), r++), re(this, r, a, 1);
1414
- }, S.toFixed = function(r, a) {
1415
- return r != null && (z(r, 0, Y), r = r + this.e + 1), re(this, r, a);
1416
- }, S.toFormat = function(r, a, s) {
1417
- var h, l = this;
1418
- if (s == null)
1419
- r != null && a && typeof a == "object" ? (s = a, a = null) : r && typeof r == "object" ? (s = r, r = a = null) : s = Ee;
1420
- else if (typeof s != "object")
1421
- throw Error(te + "Argument not an object: " + s);
1422
- if (h = l.toFixed(r, a), l.c) {
1423
- var f, g = h.split("."), o = +s.groupSize, u = +s.secondaryGroupSize, E = s.groupSeparator || "", d = g[0], N = g[1], y = l.s < 0, b = y ? d.slice(1) : d, k = b.length;
1424
- if (u && (f = o, o = u, u = f, k -= f), o > 0 && k > 0) {
1425
- for (f = k % o || o, d = b.substr(0, f); f < k; f += o) d += E + b.substr(f, o);
1426
- u > 0 && (d += E + b.slice(f)), y && (d = "-" + d);
1427
- }
1428
- h = N ? d + (s.decimalSeparator || "") + ((u = +s.fractionGroupSize) ? N.replace(
1429
- new RegExp("\\d{" + u + "}\\B", "g"),
1430
- "$&" + (s.fractionGroupSeparator || "")
1431
- ) : N) : d;
1432
- }
1433
- return (s.prefix || "") + h + (s.suffix || "");
1434
- }, S.toFraction = function(r) {
1435
- var a, s, h, l, f, g, o, u, E, d, N, y, b = this, k = b.c;
1436
- if (r != null && (o = new v(r), !o.isInteger() && (o.c || o.s !== 1) || o.lt(B)))
1437
- throw Error(te + "Argument " + (o.isInteger() ? "out of range: " : "not an integer: ") + C(o));
1438
- if (!k) return new v(b);
1439
- for (a = new v(B), E = s = new v(B), h = u = new v(B), y = ie(k), f = a.e = y.length - b.e - 1, a.c[0] = $e[(g = f % P) < 0 ? P + g : g], r = !r || o.comparedTo(a) > 0 ? f > 0 ? a : E : o, g = J, J = 1 / 0, o = new v(y), u.c[0] = 0; d = p(o, a, 0, 1), l = s.plus(d.times(h)), l.comparedTo(r) != 1; )
1440
- s = h, h = l, E = u.plus(d.times(l = E)), u = l, a = o.minus(d.times(l = a)), o = l;
1441
- return l = p(r.minus(s), h, 0, 1), u = u.plus(l.times(E)), s = s.plus(l.times(h)), u.s = E.s = b.s, f = f * 2, N = p(E, h, f, F).minus(b).abs().comparedTo(
1442
- p(u, s, f, F).minus(b).abs()
1443
- ) < 1 ? [E, h] : [u, s], J = g, N;
1444
- }, S.toNumber = function() {
1445
- return +C(this);
1446
- }, S.toPrecision = function(r, a) {
1447
- return r != null && z(r, 1, Y), re(this, r, a, 2);
1448
- }, S.toString = function(r) {
1449
- var a, s = this, h = s.s, l = s.e;
1450
- return l === null ? h ? (a = "Infinity", h < 0 && (a = "-" + a)) : a = "NaN" : (r == null ? a = l <= L || l >= I ? Pe(ie(s.c), l) : Ae(ie(s.c), l, "0") : r === 10 && we ? (s = Q(new v(s), M + l + 1, F), a = Ae(ie(s.c), s.e, "0")) : (z(r, 2, ge.length, "Base"), a = R(Ae(ie(s.c), l, "0"), 10, r, h, !0)), h < 0 && s.c[0] && (a = "-" + a)), a;
1451
- }, S.valueOf = S.toJSON = function() {
1452
- return C(this);
1453
- }, S._isBigNumber = !0, S[Symbol.toStringTag] = "BigNumber", S[Symbol.for("nodejs.util.inspect.custom")] = S.valueOf, n != null && v.set(n), v;
1454
- }
1455
- function ce(n) {
1456
- var p = n | 0;
1457
- return n > 0 || n === p ? p : p - 1;
1458
- }
1459
- function ie(n) {
1460
- for (var p, R, _ = 1, S = n.length, B = n[0] + ""; _ < S; ) {
1461
- for (p = n[_++] + "", R = P - p.length; R--; p = "0" + p) ;
1462
- B += p;
1463
- }
1464
- for (S = B.length; B.charCodeAt(--S) === 48; ) ;
1465
- return B.slice(0, S + 1 || 1);
1466
- }
1467
- function ve(n, p) {
1468
- var R, _, S = n.c, B = p.c, M = n.s, F = p.s, L = n.e, I = p.e;
1469
- if (!M || !F) return null;
1470
- if (R = S && !S[0], _ = B && !B[0], R || _) return R ? _ ? 0 : -F : M;
1471
- if (M != F) return M;
1472
- if (R = M < 0, _ = L == I, !S || !B) return _ ? 0 : !S ^ R ? 1 : -1;
1473
- if (!_) return L > I ^ R ? 1 : -1;
1474
- for (F = (L = S.length) < (I = B.length) ? L : I, M = 0; M < F; M++) if (S[M] != B[M]) return S[M] > B[M] ^ R ? 1 : -1;
1475
- return L == I ? 0 : L > I ^ R ? 1 : -1;
1476
- }
1477
- function z(n, p, R, _) {
1478
- if (n < p || n > R || n !== oe(n))
1479
- throw Error(te + (_ || "Argument") + (typeof n == "number" ? n < p || n > R ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n));
1480
- }
1481
- function De(n) {
1482
- var p = n.c.length - 1;
1483
- return ce(n.e / P) == p && n.c[p] % 2 != 0;
1484
- }
1485
- function Pe(n, p) {
1486
- return (n.length > 1 ? n.charAt(0) + "." + n.slice(1) : n) + (p < 0 ? "e" : "e+") + p;
1487
- }
1488
- function Ae(n, p, R) {
1489
- var _, S;
1490
- if (p < 0) {
1491
- for (S = R + "."; ++p; S += R) ;
1492
- n = S + n;
1493
- } else if (_ = n.length, ++p > _) {
1494
- for (S = R, p -= _; --p; S += R) ;
1495
- n += S;
1496
- } else p < _ && (n = n.slice(0, p) + "." + n.slice(p));
1497
- return n;
1498
- }
1499
- var wa = Nt();
1500
- const ya = e.boolean().transform((n) => String(n)), ba = e.string().transform((n) => n === "true");
1501
- var et;
1502
- (function(n) {
1503
- n[n.function = 0] = "function", n[n.l1_handler = 1] = "l1_handler", n[n.constructor = 2] = "constructor";
1504
- })(et || (et = {}));
1505
- const St = e.array(e.string()), Xe = e.object({
1506
- selector: e.string(),
1507
- offset: e.string(),
1508
- builtins: St.optional()
1509
- }), Rt = e.object({
1510
- CONSTRUCTOR: e.array(Xe),
1511
- EXTERNAL: e.array(Xe),
1512
- L1_HANDLER: e.array(Xe)
1513
- }), La = e.string(), $r = e.object({
1514
- builtins: St,
1515
- data: e.array(e.string())
1516
- }), tt = e.object({
1517
- name: e.string(),
1518
- type: e.union([e.literal("felt"), e.literal("felt*"), e.string()])
1519
- }), Xr = e.nativeEnum(et), Vr = e.object({
1520
- inputs: e.array(tt),
1521
- name: e.string(),
1522
- outputs: e.array(tt),
1523
- stateMutability: e.literal("view").optional(),
1524
- state_mutability: e.string().optional(),
1525
- type: Xr
1526
- }), rt = e.object({
1527
- name: e.string(),
1528
- type: e.union([e.literal("felt"), e.literal("felt*"), e.string()]),
1529
- kind: e.union([e.literal("key"), e.literal("data")])
1530
- }), Hr = e.object({
1531
- name: e.string(),
1532
- type: e.literal("event"),
1533
- data: e.array(rt),
1534
- keys: e.array(rt)
1535
- }), zr = e.object({
1536
- name: e.string(),
1537
- members: e.array(rt),
1538
- kind: e.literal("struct"),
1539
- type: e.literal("event")
1540
- }), qr = e.object({
1541
- members: e.array(tt.and(e.object({
1542
- offset: e.number()
1543
- }))),
1544
- name: e.string(),
1545
- size: e.number(),
1546
- type: e.literal("struct")
1547
- }), Wr = e.union([zr, Hr]), Ot = e.array(e.union([Vr, Wr, qr, e.any()])), Yr = e.object({
1548
- program: $r,
1549
- entry_points_by_type: Rt,
1550
- abi: Ot
1551
- }), vt = e.array(e.string()), Zr = e.object({
1552
- type_names: e.array(e.tuple([e.number(), e.string()])),
1553
- libfunc_names: e.array(e.tuple([e.number(), e.string()])),
1554
- user_func_names: e.array(e.tuple([e.number(), e.string()]))
1555
- }), Ve = e.object({
1556
- selector: e.string(),
1557
- function_idx: e.number()
1558
- }), Kr = e.object({
1559
- CONSTRUCTOR: e.array(Ve),
1560
- EXTERNAL: e.array(Ve),
1561
- L1_HANDLER: e.array(Ve)
1562
- }), Jr = e.object({
1563
- sierra_program: vt,
1564
- sierra_program_debug_info: Zr.optional(),
1565
- contract_class_version: e.string(),
1566
- entry_points_by_type: Kr,
1567
- abi: Ot
1568
- }), Qr = e.array(e.tuple([e.number(), e.array(e.string())])), en = e.object({
1569
- prime: e.string(),
1570
- compiler_version: e.string(),
1571
- bytecode: vt,
1572
- hints: e.array(e.any()),
1573
- pythonic_hints: Qr,
1574
- entry_points_by_type: Rt
1575
- }), Ca = en, _a = e.union([
1576
- Yr,
1577
- Jr
1578
- ]), Tt = cr(null), wt = () => lr(Tt), Da = () => {
1579
- var n;
1580
- return !!((n = wt()) != null && n.emitter);
1581
- }, Pa = ({ emitter: n, children: p }) => /* @__PURE__ */ ir(Tt.Provider, { value: {
1582
- emitter: n
1583
- }, children: p });
1584
- let ht = !1;
1585
- const yt = () => {
1586
- var R;
1587
- const n = (R = wt()) == null ? void 0 : R.emitter;
1588
- if (!n && !ht) {
1589
- ht = !0;
1590
- return;
1591
- }
1592
- return n;
1593
- }, ja = () => {
1594
- const n = yt();
1595
- return n ? n.emit.bind(n) : or;
1596
- }, ka = () => {
1597
- const n = yt();
1598
- return (R, _) => {
1599
- ur(() => n ? n.on(R, _) : void 0, [R, _]);
1600
- };
1601
- }, tn = e.object({
1602
- amount: e.bigint(),
1603
- pricePerUnit: e.bigint()
1604
- }).or(e.object({ maxFee: e.bigint() })), pt = e.object({
1605
- feeTokenAddress: Te,
1606
- amount: e.bigint(),
1607
- pricePerUnit: e.bigint(),
1608
- max: tn.optional(),
1609
- dataGasConsumed: e.bigint().optional(),
1610
- dataGasPrice: e.bigint().optional()
1611
- }), rn = e.object({
1612
- deployment: pt.optional(),
1613
- transactions: pt
1614
- }), nn = e.union([
1615
- e.literal("critical"),
1616
- e.literal("high"),
1617
- e.literal("caution"),
1618
- e.literal("info")
1619
- ]), an = e.string(), sn = e.object({
1620
- name: e.string(),
1621
- url: e.string(),
1622
- position: e.number()
1623
- }), He = e.object({
1624
- address: e.string(),
1625
- name: e.string(),
1626
- symbol: e.string().optional(),
1627
- decimals: e.number().optional(),
1628
- unknown: e.boolean(),
1629
- iconUrl: e.string().optional(),
1630
- type: e.string()
1631
- }), dt = e.discriminatedUnion("type", [
1632
- e.object({
1633
- type: e.literal("amount"),
1634
- label: e.string(),
1635
- token: He,
1636
- amount: e.string(),
1637
- usd: e.string(),
1638
- editable: e.boolean()
1639
- }),
1640
- e.object({
1641
- type: e.literal("address"),
1642
- label: e.string(),
1643
- address: e.string(),
1644
- addressName: e.string().optional(),
1645
- // tbd whether it's isVerified or verified
1646
- verified: e.boolean().optional()
1647
- }),
1648
- e.object({
1649
- type: e.literal("timestamp"),
1650
- label: e.string(),
1651
- value: e.string()
1652
- }),
1653
- e.object({
1654
- type: e.literal("token_address"),
1655
- label: e.string(),
1656
- token: He
1657
- }),
1658
- e.object({
1659
- type: e.literal("calldata"),
1660
- label: e.string(),
1661
- entrypoint: e.string(),
1662
- calldata: e.array(e.string())
1663
- }),
1664
- e.object({
1665
- type: e.literal("text"),
1666
- label: e.string(),
1667
- text: e.string()
1668
- }),
1669
- e.object({
1670
- type: e.literal("nft"),
1671
- label: e.string(),
1672
- token: He
1673
- })
1674
- ]), bt = e.object({
1675
- name: e.string(),
1676
- properties: e.array(dt),
1677
- defaultProperties: e.array(dt).optional()
1678
- }), on = e.union([
1679
- e.literal("verified"),
1680
- e.literal("neutral"),
1681
- e.literal("partial"),
1682
- e.literal("warn")
1683
- ]), cn = e.object({
1684
- unknown_token: e.unknown().optional(),
1685
- date_of_addition: e.string().optional(),
1686
- contract_address: Te.optional(),
1687
- reason: e.string().optional(),
1688
- value: e.string().or(e.number()).optional()
1689
- }), Lt = e.object({
1690
- reason: an,
1691
- details: cn.optional(),
1692
- severity: nn
1693
- }), ln = e.object({
1694
- assessment: on,
1695
- warnings: e.array(Lt).optional(),
1696
- assessmentReasons: e.array(e.string()).optional(),
1697
- assessmentDetails: e.object({
1698
- contract_address: e.string()
1699
- }).optional(),
1700
- action: bt
1701
- }), Ct = e.object({
1702
- name: e.string(),
1703
- description: e.string(),
1704
- logoUrl: e.string(),
1705
- iconUrl: e.string(),
1706
- argentVerified: e.boolean(),
1707
- links: e.array(sn)
1708
- }), _t = e.object({
1709
- assessment: e.union([
1710
- e.literal("verified"),
1711
- e.literal("neutral"),
1712
- e.literal("partial"),
1713
- e.literal("warn")
1714
- ]),
1715
- warnings: e.array(Lt).optional(),
1716
- assessmentDetails: e.object({
1717
- contract_address: e.string()
1718
- }).optional(),
1719
- targetedDapp: Ct.optional(),
1720
- reviews: e.array(ln)
1721
- }).optional(), Dt = e.object({
1722
- banner: e.string().nullable().optional(),
1723
- preview: e.string().nullable().optional(),
1724
- full: e.string().nullable().optional(),
1725
- original: e.string().nullable().optional()
1726
- }), un = e.object({
1727
- twitter: e.string().optional(),
1728
- external: e.string().optional(),
1729
- discord: e.string().optional()
1730
- }), ot = e.object({
1731
- address: q,
1732
- decimals: e.number().optional(),
1733
- symbol: e.string().optional(),
1734
- name: e.string(),
1735
- description: e.string().optional(),
1736
- type: e.string().optional(),
1737
- usdValue: e.string().optional(),
1738
- iconUrl: e.string().optional(),
1739
- unknown: e.boolean().optional(),
1740
- imageUrls: Dt.optional(),
1741
- links: un.optional()
1742
- }), fn = e.object({
1743
- tokenAddress: q,
1744
- owner: q,
1745
- spender: q,
1746
- value: e.string().optional(),
1747
- approvalForAll: e.boolean(),
1748
- details: ot.optional()
1749
- }), hn = e.object({
1750
- tokenAddress: q,
1751
- from: q,
1752
- to: q,
1753
- tokenId: e.string().optional(),
1754
- value: e.string().optional(),
1755
- details: ot.optional()
1756
- }), Oe = e.union([e.string(), e.number(), e.bigint()]).transform((n) => parseInt(n.toString(), 10)), mt = {
1757
- overallFee: Oe,
1758
- gasPrice: Oe,
1759
- gasUsage: Oe,
1760
- dataGasPrice: Oe.optional(),
1761
- dataGasConsumed: Oe.optional()
1762
- }, pn = e.object({
1763
- ...mt,
1764
- unit: e.string().transform((n) => n.toUpperCase()).pipe(e.literal("WEI")),
1765
- maxFee: Oe
1766
- }).or(e.object({
1767
- ...mt,
1768
- unit: e.string().transform((n) => n.toUpperCase()).pipe(e.literal("FRI")),
1769
- maxAmount: Oe,
1770
- maxPricePerUnit: Oe
1771
- })), dn = e.object({
1772
- type: e.string(),
1773
- label: e.string(),
1774
- tokenId: e.string().optional(),
1775
- value: e.string().optional(),
1776
- usdValue: e.string().optional(),
1777
- token: ot,
1778
- sent: e.boolean().optional(),
1779
- tokenIdDetails: e.object({
1780
- name: e.string().optional(),
1781
- description: e.string().optional(),
1782
- imageUrls: Dt.optional()
1783
- }).optional()
1784
- }), mn = e.object({
1785
- approvals: e.array(fn).optional(),
1786
- transfers: e.array(hn).optional(),
1787
- calculatedNonce: e.string().optional(),
1788
- feeEstimation: pn,
1789
- summary: e.array(dn).optional()
1790
- }), En = e.object({
1791
- label: e.string().optional(),
1792
- code: e.number().optional(),
1793
- message: e.string().optional(),
1794
- error: e.string().optional()
1795
- }), Pt = e.object({
1796
- reviewOfTransaction: _t,
1797
- simulation: mn,
1798
- simulationError: e.undefined()
1799
- }), jt = e.object({
1800
- reviewOfTransaction: _t,
1801
- simulation: e.undefined(),
1802
- simulationError: En
1803
- }), kt = Pt.or(jt), Ua = e.object({
1804
- transactions: e.array(kt)
1805
- }), Fa = e.object({
1806
- transactions: e.array(kt),
1807
- enrichedFeeEstimation: rn.optional(),
1808
- isBackendDown: e.boolean().default(!1).optional()
1809
- });
1810
- function xa(n) {
1811
- return Pt.safeParse(n).success;
1812
- }
1813
- function Ma(n) {
1814
- return jt.safeParse(n).success;
1815
- }
1816
- function Ga(n) {
1817
- return n.error ? n.error : n.message && n.code ? `${n.code}: ${n.message}` : "Unknown error";
1818
- }
1819
- const Ut = e.object({
1820
- network: e.string(),
1821
- hash: e.string(),
1822
- status: e.string(),
1823
- blockNumber: e.number().optional(),
1824
- transactionIndex: e.number()
1825
- }), be = e.object({
1826
- type: e.enum(["token", "nft"]),
1827
- tokenAddress: q,
1828
- amount: e.string().optional(),
1829
- fiatAmount: e.object({
1830
- currency: e.string(),
1831
- currencyAmount: e.number()
1832
- }).optional().nullable()
1833
- }), ct = e.enum(["ethereum", "starknet", "zksync", "zksync2"]), gn = e.object({
1834
- type: e.enum(["payment", "gasFee"]),
1835
- leg: e.enum(["credit", "debit"]),
1836
- asset: be,
1837
- counterParty: q.optional(),
1838
- counterPartyNetwork: ct.optional()
1839
- }), In = e.object({
1840
- address: q,
1841
- network: ct,
1842
- type: e.enum(["wallet", "token"])
1843
- }), An = e.object({
1844
- chainId: e.enum(["TESTNET", "MAINNET", "SEPOLIA"]),
1845
- ethereumNetwork: e.enum(["mainnet", "sepolia"])
1846
- }), Nn = e.enum([
1847
- "approval",
1848
- "changePubKey",
1849
- "dappInteraction",
1850
- "deploy",
1851
- "gift",
1852
- "multicall",
1853
- "payment",
1854
- "security",
1855
- "trade"
1856
- ]), Ft = e.enum([
1857
- "triggerEscapeGuardian",
1858
- "triggerEscapeSigner",
1859
- "escapeGuardian",
1860
- "escapeSigner",
1861
- "guardianChanged",
1862
- "guardianBackupChanged",
1863
- "signerChanged",
1864
- "cancelEscape",
1865
- "accountUpgraded",
1866
- "multisigConfigurationUpdated"
1867
- ]), Sn = e.object({
1868
- name: e.string(),
1869
- parameters: e.array(e.unknown()).optional()
1870
- }), Rn = e.object({
1871
- activeAt: e.string().optional(),
1872
- newGuardian: e.string().optional(),
1873
- newImplementation: e.string().optional(),
1874
- newVersion: e.string().optional()
1875
- }), Et = e.discriminatedUnion("type", [
1876
- e.object({
1877
- type: e.literal("deploy"),
1878
- deployer: q,
1879
- contractAddress: q
1880
- }),
1881
- e.object({
1882
- type: e.literal("approval"),
1883
- spender: q,
1884
- asset: be,
1885
- approvalType: e.string()
1886
- }),
1887
- e.object({
1888
- type: e.literal("payment"),
1889
- counterparty: q,
1890
- leg: e.string(),
1891
- asset: be,
1892
- counterpartyNetwork: ct.optional()
1893
- }),
1894
- e.object({
1895
- type: e.literal("trade"),
1896
- srcAsset: be,
1897
- destAsset: be
1898
- }),
1899
- e.object({
1900
- type: e.literal("security"),
1901
- action: Ft,
1902
- context: Rn.optional()
1903
- }),
1904
- e.object({
1905
- type: e.literal("dappInteraction"),
1906
- dappAddress: q,
1907
- function: Sn.optional().nullable()
1908
- // This object is often null. It happens when we were unable to get the ABI or failed decoding the function call
1909
- })
1910
- ]), On = e.union([
1911
- Et,
1912
- e.object({
1913
- type: e.literal("multicall"),
1914
- calls: e.array(e.object({
1915
- details: Et
1916
- }))
1917
- })
1918
- ]), vn = e.object({
1919
- dappId: e.string(),
1920
- name: e.string().optional().nullable()
1921
- }), xt = e.object({
1922
- sent: e.boolean(),
1923
- asset: e.discriminatedUnion("type", [
1924
- e.object({
1925
- type: e.literal("nft"),
1926
- tokenAddress: q,
1927
- tokenId: e.coerce.number().optional(),
1928
- amount: e.string().optional(),
1929
- collectionName: e.string().optional(),
1930
- collectionPreviewImage: e.string().optional().nullable(),
1931
- nftName: e.string().optional().nullable(),
1932
- nftPreviewImage: e.string().optional().nullable()
1933
- }),
1934
- e.object({
1935
- type: e.literal("token"),
1936
- tokenAddress: q,
1937
- amount: e.string().optional(),
1938
- fiatAmount: e.object({
1939
- currency: e.string(),
1940
- currencyAmount: e.coerce.string()
1941
- }).optional().nullable()
1942
- })
1943
- ])
1944
- }), Tn = e.object({
1945
- type: e.string(),
1946
- // "gas" for example
1947
- to: q,
1948
- actualFee: e.object({
1949
- type: e.string(),
1950
- tokenAddress: q,
1951
- amount: e.string().optional(),
1952
- fiatAmount: e.object({
1953
- currency: e.string(),
1954
- currencyAmount: e.number()
1955
- }).optional().nullable()
1956
- })
1957
- }), Mt = e.enum(["pending", "success", "failure"]), Gt = e.object({
1958
- compositeId: e.string(),
1959
- id: e.string().uuid(),
1960
- status: Mt,
1961
- wallet: q,
1962
- txSender: q,
1963
- source: e.string(),
1964
- type: Nn,
1965
- group: e.enum(["finance", "security"]),
1966
- submitted: e.number(),
1967
- lastModified: e.number(),
1968
- transaction: Ut,
1969
- transfers: e.array(gn),
1970
- // to be clarified
1971
- fees: e.array(Tn).optional(),
1972
- relatedAddresses: e.array(In).nullable(),
1973
- network: e.string(),
1974
- networkDetails: An.optional(),
1975
- details: On,
1976
- transferSummary: e.array(xt).optional(),
1977
- dapp: vn.optional(),
1978
- actions: e.array(bt).optional(),
1979
- title: e.string().optional()
1980
- }), wn = e.object({
1981
- title: e.string().optional(),
1982
- shortTitle: e.string().optional(),
1983
- subtitle: e.string().optional(),
1984
- /** let's not import the keys from x-ui here */
1985
- icon: e.string().optional()
1986
- }), yn = "native", bn = "rejected", Ln = "cancelled", Cn = "queued", Ba = Gt.pick({
1987
- status: !0,
1988
- actions: !0,
1989
- submitted: !0,
1990
- lastModified: !0,
1991
- transferSummary: !0,
1992
- fees: !0
1993
- }).extend({
1994
- status: e.union([
1995
- Mt,
1996
- e.enum([
1997
- bn,
1998
- Ln,
1999
- Cn
2000
- ])
2001
- ]),
2002
- type: e.literal(yn),
2003
- transaction: Ut.pick({
2004
- hash: !0
2005
- }),
2006
- dapp: Ct.optional(),
2007
- meta: wn.optional()
2008
- }), _n = e.array(Gt), $a = e.object({
2009
- activities: _n,
2010
- page: e.number(),
2011
- pageSize: e.number(),
2012
- totalElements: e.number(),
2013
- totalPages: e.number()
2014
- });
2015
- function Xa(n) {
2016
- return Ft.safeParse(n).success;
2017
- }
2018
- const Bt = (n) => xt.safeParse(n).success, Va = (n) => Bt(n) && n.asset.type === "token", Ha = (n) => Bt(n) && n.asset.type === "nft";
2019
- export {
2020
- Yn as $,
2021
- _e as A,
2022
- wa as B,
2023
- sa as C,
2024
- pn as D,
2025
- Zn as E,
2026
- Ua as F,
2027
- Ma as G,
2028
- st as H,
2029
- It as I,
2030
- Er as J,
2031
- ke as K,
2032
- gr as L,
2033
- ut as M,
2034
- ia as N,
2035
- Ir as O,
2036
- xn as P,
2037
- Mn as Q,
2038
- Gn as R,
2039
- ra as S,
2040
- Bn as T,
2041
- $n as U,
2042
- Xn as V,
2043
- at as W,
2044
- Hn as X,
2045
- zn as Y,
2046
- qn as Z,
2047
- Wn as _,
2048
- lt as a,
2049
- ja as a$,
2050
- Vn as a0,
2051
- vr as a1,
2052
- Fe as a2,
2053
- wr as a3,
2054
- qe as a4,
2055
- Lr as a5,
2056
- Jn as a6,
2057
- Qn as a7,
2058
- ea as a8,
2059
- ta as a9,
2060
- Xe as aA,
2061
- Rt as aB,
2062
- La as aC,
2063
- $r as aD,
2064
- tt as aE,
2065
- Xr as aF,
2066
- Vr as aG,
2067
- rt as aH,
2068
- Hr as aI,
2069
- zr as aJ,
2070
- qr as aK,
2071
- Wr as aL,
2072
- Ot as aM,
2073
- Yr as aN,
2074
- vt as aO,
2075
- Zr as aP,
2076
- Ve as aQ,
2077
- Kr as aR,
2078
- Jr as aS,
2079
- Qr as aT,
2080
- en as aU,
2081
- Ca as aV,
2082
- _a as aW,
2083
- wt as aX,
2084
- Da as aY,
2085
- Pa as aZ,
2086
- yt as a_,
2087
- na as aa,
2088
- br as ab,
2089
- We as ac,
2090
- Ta as ad,
2091
- Fr as ae,
2092
- ya as af,
2093
- ba as ag,
2094
- Le as ah,
2095
- Dr as ai,
2096
- Pr as aj,
2097
- jr as ak,
2098
- je as al,
2099
- kr as am,
2100
- it as an,
2101
- Ur as ao,
2102
- ue as ap,
2103
- ca as aq,
2104
- la as ar,
2105
- ua as as,
2106
- fa as at,
2107
- ha as au,
2108
- pa as av,
2109
- da as aw,
2110
- ma as ax,
2111
- Ea as ay,
2112
- St as az,
2113
- Nr as b,
2114
- ka as b0,
2115
- Bt as b1,
2116
- xt as b2,
2117
- yn as b3,
2118
- Ba as b4,
2119
- gn as b5,
2120
- On as b6,
2121
- vn as b7,
2122
- Tn as b8,
2123
- Gt as b9,
2124
- wn as ba,
2125
- bn as bb,
2126
- Ln as bc,
2127
- Cn as bd,
2128
- _n as be,
2129
- $a as bf,
2130
- Xa as bg,
2131
- Va as bh,
2132
- Ha as bi,
2133
- pt as bj,
2134
- rn as bk,
2135
- dt as bl,
2136
- bt as bm,
2137
- on as bn,
2138
- cn as bo,
2139
- Lt as bp,
2140
- ln as bq,
2141
- Ct as br,
2142
- Fa as bs,
2143
- xa as bt,
2144
- Ga as bu,
2145
- nn as bv,
2146
- an as bw,
2147
- oa as c,
2148
- Ar as d,
2149
- yr as e,
2150
- Tr as f,
2151
- aa as g,
2152
- Rr as h,
2153
- Or as i,
2154
- Ia as j,
2155
- Ra as k,
2156
- Sa as l,
2157
- Aa as m,
2158
- Ue as n,
2159
- Na as o,
2160
- q as p,
2161
- nt as q,
2162
- Te as r,
2163
- Oa as s,
2164
- va as t,
2165
- _r as u,
2166
- At as v,
2167
- Mr as w,
2168
- xe as x,
2169
- Kn as y,
2170
- ga as z
2171
- };