@argent/x-shared 1.34.5 → 1.35.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 (43) hide show
  1. package/dist/bips-CP71ZN9a.js +1 -0
  2. package/dist/bips-zBtnMbia.mjs +114 -0
  3. package/dist/chains/starknet/address.d.ts +2 -2
  4. package/dist/errors/swap.d.ts +12 -0
  5. package/dist/features/swap/index.d.ts +3 -0
  6. package/dist/features/swap/models/index.d.ts +3 -0
  7. package/dist/features/swap/models/order.model.d.ts +48 -0
  8. package/dist/features/swap/models/quote.model.d.ts +82 -0
  9. package/dist/features/swap/models/trade.model.d.ts +186 -0
  10. package/dist/features/swap/services/implementation.d.ts +14 -0
  11. package/dist/features/swap/services/index.d.ts +2 -0
  12. package/dist/features/swap/services/interface.d.ts +8 -0
  13. package/dist/features/swap/services/order.mock.d.ts +7 -0
  14. package/dist/features/swap/services/quote.mock.d.ts +29 -0
  15. package/dist/features/swap/tests/token.mock.d.ts +2 -0
  16. package/dist/features/swap/tests/trade.mock.d.ts +2 -0
  17. package/dist/features/swap/tests/walletAccount.mock.d.ts +43 -0
  18. package/dist/features/swap/utils/index.d.ts +2 -0
  19. package/dist/features/swap/utils/slippage.d.ts +16 -0
  20. package/dist/features/swap/utils/totalFee.d.ts +5 -0
  21. package/dist/index.js +2 -2
  22. package/dist/index.mjs +1326 -1407
  23. package/dist/nfts/BackendNftService.d.ts +2 -4
  24. package/dist/nfts/INFTService.d.ts +1 -1
  25. package/dist/simulation.js +1 -1
  26. package/dist/simulation.mjs +101 -100
  27. package/dist/swap.d.ts +2 -0
  28. package/dist/swap.js +1 -0
  29. package/dist/swap.mjs +183 -0
  30. package/dist/tokens/service/implementation.d.ts +3 -3
  31. package/dist/tokens/service/interface.d.ts +2 -2
  32. package/dist/tokens/service/types/defiPosition.model.d.ts +117 -0
  33. package/dist/tokens/service/types/index.d.ts +1 -0
  34. package/dist/tokens/service/types/{token.model.d.ts → webToken.model.d.ts} +27 -18
  35. package/dist/transactionVersion-CACUj2ch.mjs +793 -0
  36. package/dist/transactionVersion-CaRQ5Df4.js +1 -0
  37. package/dist/utils/bips.d.ts +7 -0
  38. package/dist/utils/index.d.ts +1 -0
  39. package/dist/webToken.model-Cl4dvcmj.mjs +1881 -0
  40. package/dist/webToken.model-Dsd8Rd3e.js +1 -0
  41. package/package.json +9 -2
  42. package/dist/transactionVersion-CL9JUEKt.js +0 -1
  43. package/dist/transactionVersion-CpEa4gsg.mjs +0 -2661
@@ -1,2661 +0,0 @@
1
- import { z as e } from "zod";
2
- import { validateChecksumAddress as Cr, validateAndParseAddress as Dr, getChecksumAddress as Pr, num as be, constants as xe, CairoCustomEnum as jr, uint256 as Qe, hash as Nt } from "starknet";
3
- import { memoize as Pt, noop as kr, isString as Ur, isEmpty as Fr } from "lodash-es";
4
- import "@scure/base";
5
- import { jsx as xr } from "react/jsx-runtime";
6
- import { createContext as Br, useContext as Mr, useEffect as Gr } from "react";
7
- import "object-hash";
8
- import "swr";
9
- function Vr(t, o) {
10
- let [E, T = ""] = t.split(".");
11
- const N = E.startsWith("-");
12
- return N && (E = E.slice(1)), T.length > o ? Number(T[o]) >= 5 ? T = (BigInt(T.slice(0, o)) + 1n).toString().padStart(o, "0") : T = T.slice(0, o) : T = T.padEnd(o, "0"), {
13
- value: BigInt(`${N ? "-" : ""}${E}${T}`),
14
- decimals: o
15
- };
16
- }
17
- const jt = e.string().refine((t) => {
18
- if (t.toLowerCase() === t)
19
- return !0;
20
- try {
21
- return Cr(t) && Wr(t);
22
- } catch {
23
- }
24
- return !1;
25
- }, "Invalid address (checksum error)"), $r = e.string().refine((t) => {
26
- try {
27
- return Dr(t);
28
- } catch {
29
- }
30
- return !1;
31
- }, "Invalid address (validation error)"), Ve = e.string().regex(/^0x[0-9a-fA-F]+$/, "Invalid address"), Xr = Ve.min(50, "Addresses must at least be 50 characters long").max(66, "Addresses must at most be 66 characters long"), Hr = Ve.length(66, "Address must be 66 characters long"), K = Xr.pipe(jt).transform((t) => `0x${(t.startsWith("0x") ? t.slice(2) : t).padStart(64, "0")}`), Fa = K.or(e.literal("")).transform((t) => t === "" ? void 0 : t).optional(), H = Ve.transform((t) => `0x${t.replace(/^0x/, "").toLowerCase().padStart(64, "0")}`), zr = (t) => K.safeParse(t).success, qr = zr, $e = (t) => Pr(t), xa = (t) => {
32
- const o = $e(t), E = o.slice(0, 2), T = o.slice(2, 6), N = o.slice(-4);
33
- return `${E}${T}…${N}`;
34
- }, Ba = (t) => {
35
- const o = $e(t), E = o.slice(0, 2), N = o.slice(2).match(/.{1,4}/g) || [];
36
- return `${E} ${N.join(" ")}`;
37
- }, Wr = (t) => !/^0x[0-9a-f]{63,64}$/.test(t), Kr = (t, o) => {
38
- try {
39
- return !t || !o ? !1 : be.hexToDecimalString(t) === be.hexToDecimalString(o);
40
- } catch {
41
- }
42
- return !1;
43
- }, Yr = (t) => {
44
- try {
45
- return be.toBigInt(Ve.parse(t)) === xe.ZERO;
46
- } catch {
47
- }
48
- return !1;
49
- }, Ma = (t, o) => !!(o != null && o.some((E) => Kr(E, t))), Ga = Pt((t) => {
50
- const o = t.slice(0, 6), E = t.slice(-4);
51
- return `${o}…${E}`;
52
- }), Va = Pt((t, o) => {
53
- if (t.length < o)
54
- return t;
55
- const E = Math.floor((o - 1) / 2), T = t.slice(0, E), N = t.slice(-E);
56
- return `${T}…${N}`;
57
- }), $a = e.string().regex(/^[a-zA-Z0-9.-]*$/g, "Invalid address character").max(66, "Address cannot be over 66 characters"), Zr = Hr.pipe(jt).pipe($r), Xe = e.string().regex(/^([a-zA-Z0-9-]+\.)+argent.xyz$/, "Invalid Argent name").max(253, "Argent name cannot be over 253 characters"), Jr = (t) => Xe.safeParse(t).success, Qr = (t, o) => {
58
- try {
59
- return o ? et(t) === et(o) : !1;
60
- } catch {
61
- }
62
- return !1;
63
- }, et = (t) => Xe.parse(t).toLowerCase(), ht = e.string().regex(/^([a-zA-Z0-9-]+\.)+stark$/, "Invalid Starknet ID").max(50, "Starknet ID cannot be over 50 characters"), en = (t) => ht.safeParse(t).success, tn = (t, o) => {
64
- try {
65
- return o ? tt(t) === tt(o) : !1;
66
- } catch {
67
- }
68
- return !1;
69
- }, tt = (t) => ht.parse(t).toLowerCase(), mt = e.union([
70
- Xe,
71
- ht
72
- ]), Xa = e.union([
73
- K,
74
- mt
75
- ]), Ha = e.union([
76
- Zr,
77
- mt
78
- ]), za = (t) => mt.safeParse(t).success, qa = (t, o) => {
79
- try {
80
- return o ? Qr(t, o) || tn(t, o) : !1;
81
- } catch {
82
- }
83
- return !1;
84
- }, Wa = (t) => en(t) ? tt(t) : Jr(t) ? et(t) : $e(t), rn = e.union([e.literal("0"), e.literal("1")]), Ka = "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", Ya = "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d", Za = "0x1a736d6ed154502257f02b1ccdf4d9d1089f80811cd6acad48e6b6a9d1f2003", Ja = "0x036078334509b514626504edc9fb252328d1a240e4e948bef8d0c08dff45927f", Qa = "0x737ee2f87ce571a58c6c8da558ec18a07ceb64a6172d5ec46171fbc80077a48", ei = "0x6e150953b26271a740bf2b6e9bca17cc52c68d765f761295de51ceb8526ee72", ti = "0x4d07e40e93398ed3c76981e72dd1fd22557a78ce36c0515f679e27f0bb5bc5f";
85
- function nn(t) {
86
- var o = [];
87
- if (t.length === 0)
88
- return "";
89
- if (typeof t[0] != "string")
90
- throw new TypeError("Url must be a string. Received " + t[0]);
91
- if (t[0].match(/^[^/:]+:\/*$/) && t.length > 1) {
92
- var E = t.shift();
93
- t[0] = E + t[0];
94
- }
95
- t[0].match(/^file:\/\/\//) ? t[0] = t[0].replace(/^([^/:]+):\/*/, "$1:///") : t[0] = t[0].replace(/^([^/:]+):\/*/, "$1://");
96
- for (var T = 0; T < t.length; T++) {
97
- var N = t[T];
98
- if (typeof N != "string")
99
- throw new TypeError("Url must be a string. Received " + N);
100
- N !== "" && (T > 0 && (N = N.replace(/^[\/]+/, "")), T < t.length - 1 ? N = N.replace(/[\/]+$/, "") : N = N.replace(/[\/]+$/, "/"), o.push(N));
101
- }
102
- var D = o.join("/");
103
- D = D.replace(/\/(\?|&|#[^!])/g, "$1");
104
- var w = D.split("?");
105
- return D = w.shift() + (w.length > 0 ? "?" : "") + w.join("&"), D;
106
- }
107
- function an() {
108
- var t;
109
- return typeof arguments[0] == "object" ? t = arguments[0] : t = [].slice.call(arguments), nn(t);
110
- }
111
- class we extends Error {
112
- constructor({ code: o, message: E, options: T = {} }, N) {
113
- const { error: D, context: w } = T;
114
- super(E, { cause: D }), this.errorMessages = N, this.name = "BaseError", this.context = w, this.code = o, this.setMessageByCode(o, E);
115
- }
116
- setMessageByCode(o, E) {
117
- !o || !this.errorMessages || E || (this.message = this.errorMessages[o]);
118
- }
119
- toString() {
120
- return this.message || "";
121
- }
122
- }
123
- var rt;
124
- (function(t) {
125
- t.NOT_VALID = "Invalid address", t.NOT_FOUND = "Address not found", t.STARKNAME_NOT_FOUND = "Stark name not found", t.STARKNAME_ERROR = "Could not get address from stark name", t.STARKNAME_INVALID_ADDRESS = "Stark name resolved to an invalid address", t.ARGENT_NAME_NOT_FOUND = "Argent name not found", t.NO_ADDRESS_FROM_ARGENT_NAME = "Could not get address from Argent name", t.ARGENT_NAME_INVALID_ADDRESS = "Argent name resolved to an invalid address", t.NO_ADDRESS_FROM_DOMAIN = "Could not get address from domain", t.ARGENT_NAME_INVALID_NETWORK = "Argent name is not enabled on the requested network";
126
- })(rt || (rt = {}));
127
- class ke extends we {
128
- constructor(o) {
129
- super(o, rt), this.name = "AddressError";
130
- }
131
- }
132
- class dt extends Error {
133
- constructor(o, E, T) {
134
- super(o), this.status = E, this.data = T, Object.setPrototypeOf(this, dt.prototype);
135
- }
136
- }
137
- var St;
138
- (function(t) {
139
- t.FAILED_TO_FETCH_URL = "Failed to fetch url", t.FAILED_TO_POST_URL = "Failed to post url";
140
- })(St || (St = {}));
141
- const ri = e.object({
142
- walletAddress: H,
143
- ens: Xe,
144
- chain: e.enum(["ethereum", "starknet"]),
145
- deleted: e.boolean(),
146
- walletDeployed: e.boolean()
147
- }).or(e.object({
148
- status: e.string()
149
- }));
150
- async function ni(t, o, E, T = "starknet") {
151
- const N = {
152
- ens: t,
153
- chain: T
154
- }, D = new URLSearchParams(N), w = an(E, "wallet", `?${D}`);
155
- try {
156
- const k = await o.get(w), L = k && "walletAddress" in k ? k.walletAddress : void 0;
157
- if (!L)
158
- throw new ke({
159
- code: "NO_ADDRESS_FROM_ARGENT_NAME"
160
- });
161
- if (Yr(L))
162
- throw new ke({
163
- code: "ARGENT_NAME_NOT_FOUND",
164
- message: `${t} not found`
165
- });
166
- if (!qr(L))
167
- throw new ke({
168
- code: "ARGENT_NAME_INVALID_ADDRESS",
169
- message: `${t} resolved to an invalid address (${L})`
170
- });
171
- return $e(L);
172
- } catch (k) {
173
- throw k instanceof dt && k.status === 404 ? new ke({
174
- code: "ARGENT_NAME_NOT_FOUND",
175
- message: `${t} not found`
176
- }) : k;
177
- }
178
- }
179
- var nt;
180
- (function(t) {
181
- t.NOT_VALID = "Invalid call";
182
- })(nt || (nt = {}));
183
- class ai extends we {
184
- constructor(o) {
185
- super(o, nt), this.name = "CallError";
186
- }
187
- }
188
- var at;
189
- (function(t) {
190
- t.NO_NETWORK_OR_MULTICALL = "Missing networkId or multicall", t.NOT_FOUND = "Network not found";
191
- })(at || (at = {}));
192
- class ii extends we {
193
- constructor(o) {
194
- super(o, at), this.name = "NetworkError";
195
- }
196
- }
197
- const De = e.union([e.string(), e.number(), e.bigint()]), sn = e.object({
198
- low: De,
199
- high: De
200
- }), on = e.array(e.string()).and(e.object({
201
- __compiled__: e.boolean().optional()
202
- }).optional()), cn = e.lazy(() => e.array(e.union([Be, e.array(Be), gt]))), Be = e.union([
203
- De,
204
- sn,
205
- e.any(),
206
- e.boolean()
207
- ]), ln = e.lazy(() => e.record(e.union([Be, e.array(Be), gt]))), gt = e.lazy(() => e.union([ln, cn])), un = e.union([gt, on]).optional(), fn = e.lazy(() => e.object({
208
- contractAddress: e.string(),
209
- calldata: un,
210
- entrypoint: e.string().optional()
211
- })), bt = e.lazy(() => fn.and(e.object({
212
- entrypoint: e.string()
213
- }))), he = e.string().refine((t) => typeof parseInt(t) == "number"), si = e.tuple([he]), oi = e.tuple([he]), ci = e.object({
214
- new_threshold: e.string().refine((t) => typeof parseInt(t) == "number"),
215
- signers_to_add: e.array(he)
216
- }), li = e.object({
217
- new_threshold: e.string().refine((t) => typeof parseInt(t) == "number"),
218
- signers_to_remove: e.array(he)
219
- }), ui = e.object({
220
- signer_to_remove: he,
221
- signer_to_add: he
222
- }), fi = e.tuple([he]), pi = e.tuple([he]), hi = e.tuple([he]), mi = e.tuple([he]).rest(he), di = e.object({
223
- recipient: K,
224
- amount: e.object({
225
- low: De,
226
- high: De
227
- })
228
- }), pn = e.string().regex(/^(0x)?[0-9a-fA-F]+$/, "Invalid hex string"), Me = pn.transform((t) => {
229
- const o = t.startsWith("0x") ? t.slice(2) : t;
230
- return `0x${o.length % 2 === 0 ? o : `0${o}`}`;
231
- }), gi = e.object({
232
- cairoVersion: rn,
233
- accountClassHash: Me
234
- }), hn = e.array(e.string()), Ei = e.object({
235
- implementation: e.string(),
236
- selector: Me,
237
- calldata: hn
238
- }), Ii = e.object({
239
- owner: e.string(),
240
- guardian: e.string().optional().transform((t) => t ?? "0")
241
- });
242
- var Tt;
243
- (function(t) {
244
- t.Starknet = "Starknet", t.Secp256k1 = "Secp256k1", t.Secp256r1 = "Secp256r1", t.Eip191 = "Eip191", t.Webauthn = "Webauthn";
245
- })(Tt || (Tt = {}));
246
- function Ai(t, o) {
247
- const E = {
248
- Starknet: void 0,
249
- Secp256k1: void 0,
250
- Secp256r1: void 0,
251
- Eip191: void 0,
252
- Webauthn: void 0
253
- };
254
- return E[o] = t, new jr(E);
255
- }
256
- var it;
257
- (function(t) {
258
- t.NOT_FOUND = "Account not found", t.CALCULATED_ADDRESS_NO_MATCH = "Calculated address does not match account address";
259
- })(it || (it = {}));
260
- class Ni extends we {
261
- constructor(o) {
262
- super(o, it), this.name = "AccountError";
263
- }
264
- }
265
- function mn(t) {
266
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
267
- }
268
- var st = { exports: {} };
269
- (function(t, o) {
270
- o = t.exports = j;
271
- var E;
272
- typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? E = function() {
273
- var r = Array.prototype.slice.call(arguments, 0);
274
- r.unshift("SEMVER"), console.log.apply(console, r);
275
- } : E = function() {
276
- }, o.SEMVER_SPEC_VERSION = "2.0.0";
277
- var T = 256, N = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
278
- 9007199254740991, D = 16, w = T - 6, k = o.re = [], L = o.safeRe = [], A = o.src = [], d = o.tokens = {}, Y = 0;
279
- function P(r) {
280
- d[r] = Y++;
281
- }
282
- var fe = "[a-zA-Z0-9-]", ee = [
283
- ["\\s", 1],
284
- ["\\d", T],
285
- [fe, w]
286
- ];
287
- function Ie(r) {
288
- for (var s = 0; s < ee.length; s++) {
289
- var l = ee[s][0], S = ee[s][1];
290
- r = r.split(l + "*").join(l + "{0," + S + "}").split(l + "+").join(l + "{1," + S + "}");
291
- }
292
- return r;
293
- }
294
- P("NUMERICIDENTIFIER"), A[d.NUMERICIDENTIFIER] = "0|[1-9]\\d*", P("NUMERICIDENTIFIERLOOSE"), A[d.NUMERICIDENTIFIERLOOSE] = "\\d+", P("NONNUMERICIDENTIFIER"), A[d.NONNUMERICIDENTIFIER] = "\\d*[a-zA-Z-]" + fe + "*", P("MAINVERSION"), A[d.MAINVERSION] = "(" + A[d.NUMERICIDENTIFIER] + ")\\.(" + A[d.NUMERICIDENTIFIER] + ")\\.(" + A[d.NUMERICIDENTIFIER] + ")", P("MAINVERSIONLOOSE"), A[d.MAINVERSIONLOOSE] = "(" + A[d.NUMERICIDENTIFIERLOOSE] + ")\\.(" + A[d.NUMERICIDENTIFIERLOOSE] + ")\\.(" + A[d.NUMERICIDENTIFIERLOOSE] + ")", P("PRERELEASEIDENTIFIER"), A[d.PRERELEASEIDENTIFIER] = "(?:" + A[d.NUMERICIDENTIFIER] + "|" + A[d.NONNUMERICIDENTIFIER] + ")", P("PRERELEASEIDENTIFIERLOOSE"), A[d.PRERELEASEIDENTIFIERLOOSE] = "(?:" + A[d.NUMERICIDENTIFIERLOOSE] + "|" + A[d.NONNUMERICIDENTIFIER] + ")", P("PRERELEASE"), A[d.PRERELEASE] = "(?:-(" + A[d.PRERELEASEIDENTIFIER] + "(?:\\." + A[d.PRERELEASEIDENTIFIER] + ")*))", P("PRERELEASELOOSE"), A[d.PRERELEASELOOSE] = "(?:-?(" + A[d.PRERELEASEIDENTIFIERLOOSE] + "(?:\\." + A[d.PRERELEASEIDENTIFIERLOOSE] + ")*))", P("BUILDIDENTIFIER"), A[d.BUILDIDENTIFIER] = fe + "+", P("BUILD"), A[d.BUILD] = "(?:\\+(" + A[d.BUILDIDENTIFIER] + "(?:\\." + A[d.BUILDIDENTIFIER] + ")*))", P("FULL"), P("FULLPLAIN"), A[d.FULLPLAIN] = "v?" + A[d.MAINVERSION] + A[d.PRERELEASE] + "?" + A[d.BUILD] + "?", A[d.FULL] = "^" + A[d.FULLPLAIN] + "$", P("LOOSEPLAIN"), A[d.LOOSEPLAIN] = "[v=\\s]*" + A[d.MAINVERSIONLOOSE] + A[d.PRERELEASELOOSE] + "?" + A[d.BUILD] + "?", P("LOOSE"), A[d.LOOSE] = "^" + A[d.LOOSEPLAIN] + "$", P("GTLT"), A[d.GTLT] = "((?:<|>)?=?)", P("XRANGEIDENTIFIERLOOSE"), A[d.XRANGEIDENTIFIERLOOSE] = A[d.NUMERICIDENTIFIERLOOSE] + "|x|X|\\*", P("XRANGEIDENTIFIER"), A[d.XRANGEIDENTIFIER] = A[d.NUMERICIDENTIFIER] + "|x|X|\\*", P("XRANGEPLAIN"), A[d.XRANGEPLAIN] = "[v=\\s]*(" + A[d.XRANGEIDENTIFIER] + ")(?:\\.(" + A[d.XRANGEIDENTIFIER] + ")(?:\\.(" + A[d.XRANGEIDENTIFIER] + ")(?:" + A[d.PRERELEASE] + ")?" + A[d.BUILD] + "?)?)?", P("XRANGEPLAINLOOSE"), A[d.XRANGEPLAINLOOSE] = "[v=\\s]*(" + A[d.XRANGEIDENTIFIERLOOSE] + ")(?:\\.(" + A[d.XRANGEIDENTIFIERLOOSE] + ")(?:\\.(" + A[d.XRANGEIDENTIFIERLOOSE] + ")(?:" + A[d.PRERELEASELOOSE] + ")?" + A[d.BUILD] + "?)?)?", P("XRANGE"), A[d.XRANGE] = "^" + A[d.GTLT] + "\\s*" + A[d.XRANGEPLAIN] + "$", P("XRANGELOOSE"), A[d.XRANGELOOSE] = "^" + A[d.GTLT] + "\\s*" + A[d.XRANGEPLAINLOOSE] + "$", P("COERCE"), A[d.COERCE] = "(^|[^\\d])(\\d{1," + D + "})(?:\\.(\\d{1," + D + "}))?(?:\\.(\\d{1," + D + "}))?(?:$|[^\\d])", P("COERCERTL"), k[d.COERCERTL] = new RegExp(A[d.COERCE], "g"), L[d.COERCERTL] = new RegExp(Ie(A[d.COERCE]), "g"), P("LONETILDE"), A[d.LONETILDE] = "(?:~>?)", P("TILDETRIM"), A[d.TILDETRIM] = "(\\s*)" + A[d.LONETILDE] + "\\s+", k[d.TILDETRIM] = new RegExp(A[d.TILDETRIM], "g"), L[d.TILDETRIM] = new RegExp(Ie(A[d.TILDETRIM]), "g");
295
- var Ae = "$1~";
296
- P("TILDE"), A[d.TILDE] = "^" + A[d.LONETILDE] + A[d.XRANGEPLAIN] + "$", P("TILDELOOSE"), A[d.TILDELOOSE] = "^" + A[d.LONETILDE] + A[d.XRANGEPLAINLOOSE] + "$", P("LONECARET"), A[d.LONECARET] = "(?:\\^)", P("CARETTRIM"), A[d.CARETTRIM] = "(\\s*)" + A[d.LONECARET] + "\\s+", k[d.CARETTRIM] = new RegExp(A[d.CARETTRIM], "g"), L[d.CARETTRIM] = new RegExp(Ie(A[d.CARETTRIM]), "g");
297
- var _e = "$1^";
298
- P("CARET"), A[d.CARET] = "^" + A[d.LONECARET] + A[d.XRANGEPLAIN] + "$", P("CARETLOOSE"), A[d.CARETLOOSE] = "^" + A[d.LONECARET] + A[d.XRANGEPLAINLOOSE] + "$", P("COMPARATORLOOSE"), A[d.COMPARATORLOOSE] = "^" + A[d.GTLT] + "\\s*(" + A[d.LOOSEPLAIN] + ")$|^$", P("COMPARATOR"), A[d.COMPARATOR] = "^" + A[d.GTLT] + "\\s*(" + A[d.FULLPLAIN] + ")$|^$", P("COMPARATORTRIM"), A[d.COMPARATORTRIM] = "(\\s*)" + A[d.GTLT] + "\\s*(" + A[d.LOOSEPLAIN] + "|" + A[d.XRANGEPLAIN] + ")", k[d.COMPARATORTRIM] = new RegExp(A[d.COMPARATORTRIM], "g"), L[d.COMPARATORTRIM] = new RegExp(Ie(A[d.COMPARATORTRIM]), "g");
299
- var R = "$1$2$3";
300
- P("HYPHENRANGE"), A[d.HYPHENRANGE] = "^\\s*(" + A[d.XRANGEPLAIN] + ")\\s+-\\s+(" + A[d.XRANGEPLAIN] + ")\\s*$", P("HYPHENRANGELOOSE"), A[d.HYPHENRANGELOOSE] = "^\\s*(" + A[d.XRANGEPLAINLOOSE] + ")\\s+-\\s+(" + A[d.XRANGEPLAINLOOSE] + ")\\s*$", P("STAR"), A[d.STAR] = "(<|>)?=?\\s*\\*";
301
- for (var ae = 0; ae < Y; ae++)
302
- E(ae, A[ae]), k[ae] || (k[ae] = new RegExp(A[ae]), L[ae] = new RegExp(Ie(A[ae])));
303
- o.parse = me;
304
- function me(r, s) {
305
- if ((!s || typeof s != "object") && (s = {
306
- loose: !!s,
307
- includePrerelease: !1
308
- }), r instanceof j)
309
- return r;
310
- if (typeof r != "string" || r.length > T)
311
- return null;
312
- var l = s.loose ? L[d.LOOSE] : L[d.FULL];
313
- if (!l.test(r))
314
- return null;
315
- try {
316
- return new j(r, s);
317
- } catch {
318
- return null;
319
- }
320
- }
321
- o.valid = Le;
322
- function Le(r, s) {
323
- var l = me(r, s);
324
- return l ? l.version : null;
325
- }
326
- o.clean = te;
327
- function te(r, s) {
328
- var l = me(r.trim().replace(/^[=v]+/, ""), s);
329
- return l ? l.version : null;
330
- }
331
- o.SemVer = j;
332
- function j(r, s) {
333
- if ((!s || typeof s != "object") && (s = {
334
- loose: !!s,
335
- includePrerelease: !1
336
- }), r instanceof j) {
337
- if (r.loose === s.loose)
338
- return r;
339
- r = r.version;
340
- } else if (typeof r != "string")
341
- throw new TypeError("Invalid Version: " + r);
342
- if (r.length > T)
343
- throw new TypeError("version is longer than " + T + " characters");
344
- if (!(this instanceof j))
345
- return new j(r, s);
346
- E("SemVer", r, s), this.options = s, this.loose = !!s.loose;
347
- var l = r.trim().match(s.loose ? L[d.LOOSE] : L[d.FULL]);
348
- if (!l)
349
- throw new TypeError("Invalid Version: " + r);
350
- if (this.raw = r, this.major = +l[1], this.minor = +l[2], this.patch = +l[3], this.major > N || this.major < 0)
351
- throw new TypeError("Invalid major version");
352
- if (this.minor > N || this.minor < 0)
353
- throw new TypeError("Invalid minor version");
354
- if (this.patch > N || this.patch < 0)
355
- throw new TypeError("Invalid patch version");
356
- l[4] ? this.prerelease = l[4].split(".").map(function(S) {
357
- if (/^[0-9]+$/.test(S)) {
358
- var y = +S;
359
- if (y >= 0 && y < N)
360
- return y;
361
- }
362
- return S;
363
- }) : this.prerelease = [], this.build = l[5] ? l[5].split(".") : [], this.format();
364
- }
365
- j.prototype.format = function() {
366
- return this.version = this.major + "." + this.minor + "." + this.patch, this.prerelease.length && (this.version += "-" + this.prerelease.join(".")), this.version;
367
- }, j.prototype.toString = function() {
368
- return this.version;
369
- }, j.prototype.compare = function(r) {
370
- return E("SemVer.compare", this.version, this.options, r), r instanceof j || (r = new j(r, this.options)), this.compareMain(r) || this.comparePre(r);
371
- }, j.prototype.compareMain = function(r) {
372
- return r instanceof j || (r = new j(r, this.options)), h(this.major, r.major) || h(this.minor, r.minor) || h(this.patch, r.patch);
373
- }, j.prototype.comparePre = function(r) {
374
- if (r instanceof j || (r = new j(r, this.options)), this.prerelease.length && !r.prerelease.length)
375
- return -1;
376
- if (!this.prerelease.length && r.prerelease.length)
377
- return 1;
378
- if (!this.prerelease.length && !r.prerelease.length)
379
- return 0;
380
- var s = 0;
381
- do {
382
- var l = this.prerelease[s], S = r.prerelease[s];
383
- if (E("prerelease compare", s, l, S), l === void 0 && S === void 0)
384
- return 0;
385
- if (S === void 0)
386
- return 1;
387
- if (l === void 0)
388
- return -1;
389
- if (l === S)
390
- continue;
391
- return h(l, S);
392
- } while (++s);
393
- }, j.prototype.compareBuild = function(r) {
394
- r instanceof j || (r = new j(r, this.options));
395
- var s = 0;
396
- do {
397
- var l = this.build[s], S = r.build[s];
398
- if (E("prerelease compare", s, l, S), l === void 0 && S === void 0)
399
- return 0;
400
- if (S === void 0)
401
- return 1;
402
- if (l === void 0)
403
- return -1;
404
- if (l === S)
405
- continue;
406
- return h(l, S);
407
- } while (++s);
408
- }, j.prototype.inc = function(r, s) {
409
- switch (r) {
410
- case "premajor":
411
- this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", s);
412
- break;
413
- case "preminor":
414
- this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", s);
415
- break;
416
- case "prepatch":
417
- this.prerelease.length = 0, this.inc("patch", s), this.inc("pre", s);
418
- break;
419
- case "prerelease":
420
- this.prerelease.length === 0 && this.inc("patch", s), this.inc("pre", s);
421
- break;
422
- case "major":
423
- (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) && this.major++, this.minor = 0, this.patch = 0, this.prerelease = [];
424
- break;
425
- case "minor":
426
- (this.patch !== 0 || this.prerelease.length === 0) && this.minor++, this.patch = 0, this.prerelease = [];
427
- break;
428
- case "patch":
429
- this.prerelease.length === 0 && this.patch++, this.prerelease = [];
430
- break;
431
- case "pre":
432
- if (this.prerelease.length === 0)
433
- this.prerelease = [0];
434
- else {
435
- for (var l = this.prerelease.length; --l >= 0; )
436
- typeof this.prerelease[l] == "number" && (this.prerelease[l]++, l = -2);
437
- l === -1 && this.prerelease.push(0);
438
- }
439
- s && (this.prerelease[0] === s ? isNaN(this.prerelease[1]) && (this.prerelease = [s, 0]) : this.prerelease = [s, 0]);
440
- break;
441
- default:
442
- throw new Error("invalid increment argument: " + r);
443
- }
444
- return this.format(), this.raw = this.version, this;
445
- }, o.inc = n;
446
- function n(r, s, l, S) {
447
- typeof l == "string" && (S = l, l = void 0);
448
- try {
449
- return new j(r, l).inc(s, S).version;
450
- } catch {
451
- return null;
452
- }
453
- }
454
- o.diff = a;
455
- function a(r, s) {
456
- if (z(r, s))
457
- return null;
458
- var l = me(r), S = me(s), y = "";
459
- if (l.prerelease.length || S.prerelease.length) {
460
- y = "pre";
461
- var v = "prerelease";
462
- }
463
- for (var O in l)
464
- if ((O === "major" || O === "minor" || O === "patch") && l[O] !== S[O])
465
- return y + O;
466
- return v;
467
- }
468
- o.compareIdentifiers = h;
469
- var i = /^[0-9]+$/;
470
- function h(r, s) {
471
- var l = i.test(r), S = i.test(s);
472
- return l && S && (r = +r, s = +s), r === s ? 0 : l && !S ? -1 : S && !l ? 1 : r < s ? -1 : 1;
473
- }
474
- o.rcompareIdentifiers = u;
475
- function u(r, s) {
476
- return h(s, r);
477
- }
478
- o.major = p;
479
- function p(r, s) {
480
- return new j(r, s).major;
481
- }
482
- o.minor = I;
483
- function I(r, s) {
484
- return new j(r, s).minor;
485
- }
486
- o.patch = c;
487
- function c(r, s) {
488
- return new j(r, s).patch;
489
- }
490
- o.compare = f;
491
- function f(r, s, l) {
492
- return new j(r, l).compare(new j(s, l));
493
- }
494
- o.compareLoose = g;
495
- function g(r, s) {
496
- return f(r, s, !0);
497
- }
498
- o.compareBuild = m;
499
- function m(r, s, l) {
500
- var S = new j(r, l), y = new j(s, l);
501
- return S.compare(y) || S.compareBuild(y);
502
- }
503
- o.rcompare = b;
504
- function b(r, s, l) {
505
- return f(s, r, l);
506
- }
507
- o.sort = _;
508
- function _(r, s) {
509
- return r.sort(function(l, S) {
510
- return o.compareBuild(l, S, s);
511
- });
512
- }
513
- o.rsort = C;
514
- function C(r, s) {
515
- return r.sort(function(l, S) {
516
- return o.compareBuild(S, l, s);
517
- });
518
- }
519
- o.gt = x;
520
- function x(r, s, l) {
521
- return f(r, s, l) > 0;
522
- }
523
- o.lt = X;
524
- function X(r, s, l) {
525
- return f(r, s, l) < 0;
526
- }
527
- o.eq = z;
528
- function z(r, s, l) {
529
- return f(r, s, l) === 0;
530
- }
531
- o.neq = M;
532
- function M(r, s, l) {
533
- return f(r, s, l) !== 0;
534
- }
535
- o.gte = $;
536
- function $(r, s, l) {
537
- return f(r, s, l) >= 0;
538
- }
539
- o.lte = W;
540
- function W(r, s, l) {
541
- return f(r, s, l) <= 0;
542
- }
543
- o.cmp = Ne;
544
- function Ne(r, s, l, S) {
545
- switch (s) {
546
- case "===":
547
- return typeof r == "object" && (r = r.version), typeof l == "object" && (l = l.version), r === l;
548
- case "!==":
549
- return typeof r == "object" && (r = r.version), typeof l == "object" && (l = l.version), r !== l;
550
- case "":
551
- case "=":
552
- case "==":
553
- return z(r, l, S);
554
- case "!=":
555
- return M(r, l, S);
556
- case ">":
557
- return x(r, l, S);
558
- case ">=":
559
- return $(r, l, S);
560
- case "<":
561
- return X(r, l, S);
562
- case "<=":
563
- return W(r, l, S);
564
- default:
565
- throw new TypeError("Invalid operator: " + s);
566
- }
567
- }
568
- o.Comparator = Q;
569
- function Q(r, s) {
570
- if ((!s || typeof s != "object") && (s = {
571
- loose: !!s,
572
- includePrerelease: !1
573
- }), r instanceof Q) {
574
- if (r.loose === !!s.loose)
575
- return r;
576
- r = r.value;
577
- }
578
- if (!(this instanceof Q))
579
- return new Q(r, s);
580
- r = r.trim().split(/\s+/).join(" "), E("comparator", r, s), this.options = s, this.loose = !!s.loose, this.parse(r), this.semver === de ? this.value = "" : this.value = this.operator + this.semver.version, E("comp", this);
581
- }
582
- var de = {};
583
- Q.prototype.parse = function(r) {
584
- var s = this.options.loose ? L[d.COMPARATORLOOSE] : L[d.COMPARATOR], l = r.match(s);
585
- if (!l)
586
- throw new TypeError("Invalid comparator: " + r);
587
- this.operator = l[1] !== void 0 ? l[1] : "", this.operator === "=" && (this.operator = ""), l[2] ? this.semver = new j(l[2], this.options.loose) : this.semver = de;
588
- }, Q.prototype.toString = function() {
589
- return this.value;
590
- }, Q.prototype.test = function(r) {
591
- if (E("Comparator.test", r, this.options.loose), this.semver === de || r === de)
592
- return !0;
593
- if (typeof r == "string")
594
- try {
595
- r = new j(r, this.options);
596
- } catch {
597
- return !1;
598
- }
599
- return Ne(r, this.operator, this.semver, this.options);
600
- }, Q.prototype.intersects = function(r, s) {
601
- if (!(r instanceof Q))
602
- throw new TypeError("a Comparator is required");
603
- (!s || typeof s != "object") && (s = {
604
- loose: !!s,
605
- includePrerelease: !1
606
- });
607
- var l;
608
- if (this.operator === "")
609
- return this.value === "" ? !0 : (l = new G(r.value, s), je(this.value, l, s));
610
- if (r.operator === "")
611
- return r.value === "" ? !0 : (l = new G(this.value, s), je(r.semver, l, s));
612
- var S = (this.operator === ">=" || this.operator === ">") && (r.operator === ">=" || r.operator === ">"), y = (this.operator === "<=" || this.operator === "<") && (r.operator === "<=" || r.operator === "<"), v = this.semver.version === r.semver.version, O = (this.operator === ">=" || this.operator === "<=") && (r.operator === ">=" || r.operator === "<="), V = Ne(this.semver, "<", r.semver, s) && (this.operator === ">=" || this.operator === ">") && (r.operator === "<=" || r.operator === "<"), F = Ne(this.semver, ">", r.semver, s) && (this.operator === "<=" || this.operator === "<") && (r.operator === ">=" || r.operator === ">");
613
- return S || y || v && O || V || F;
614
- }, o.Range = G;
615
- function G(r, s) {
616
- if ((!s || typeof s != "object") && (s = {
617
- loose: !!s,
618
- includePrerelease: !1
619
- }), r instanceof G)
620
- return r.loose === !!s.loose && r.includePrerelease === !!s.includePrerelease ? r : new G(r.raw, s);
621
- if (r instanceof Q)
622
- return new G(r.value, s);
623
- if (!(this instanceof G))
624
- return new G(r, s);
625
- if (this.options = s, this.loose = !!s.loose, this.includePrerelease = !!s.includePrerelease, this.raw = r.trim().split(/\s+/).join(" "), this.set = this.raw.split("||").map(function(l) {
626
- return this.parseRange(l.trim());
627
- }, this).filter(function(l) {
628
- return l.length;
629
- }), !this.set.length)
630
- throw new TypeError("Invalid SemVer Range: " + this.raw);
631
- this.format();
632
- }
633
- G.prototype.format = function() {
634
- return this.range = this.set.map(function(r) {
635
- return r.join(" ").trim();
636
- }).join("||").trim(), this.range;
637
- }, G.prototype.toString = function() {
638
- return this.range;
639
- }, G.prototype.parseRange = function(r) {
640
- var s = this.options.loose, l = s ? L[d.HYPHENRANGELOOSE] : L[d.HYPHENRANGE];
641
- r = r.replace(l, Nr), E("hyphen replace", r), r = r.replace(L[d.COMPARATORTRIM], R), E("comparator trim", r, L[d.COMPARATORTRIM]), r = r.replace(L[d.TILDETRIM], Ae), r = r.replace(L[d.CARETTRIM], _e), r = r.split(/\s+/).join(" ");
642
- var S = s ? L[d.COMPARATORLOOSE] : L[d.COMPARATOR], y = r.split(" ").map(function(v) {
643
- return J(v, this.options);
644
- }, this).join(" ").split(/\s+/);
645
- return this.options.loose && (y = y.filter(function(v) {
646
- return !!v.match(S);
647
- })), y = y.map(function(v) {
648
- return new Q(v, this.options);
649
- }, this), y;
650
- }, G.prototype.intersects = function(r, s) {
651
- if (!(r instanceof G))
652
- throw new TypeError("a Range is required");
653
- return this.set.some(function(l) {
654
- return Te(l, s) && r.set.some(function(S) {
655
- return Te(S, s) && l.every(function(y) {
656
- return S.every(function(v) {
657
- return y.intersects(v, s);
658
- });
659
- });
660
- });
661
- });
662
- };
663
- function Te(r, s) {
664
- for (var l = !0, S = r.slice(), y = S.pop(); l && S.length; )
665
- l = S.every(function(v) {
666
- return y.intersects(v, s);
667
- }), y = S.pop();
668
- return l;
669
- }
670
- o.toComparators = re;
671
- function re(r, s) {
672
- return new G(r, s).set.map(function(l) {
673
- return l.map(function(S) {
674
- return S.value;
675
- }).join(" ").trim().split(" ");
676
- });
677
- }
678
- function J(r, s) {
679
- return E("comp", r, s), r = dr(r, s), E("caret", r), r = hr(r, s), E("tildes", r), r = Er(r, s), E("xrange", r), r = Ar(r, s), E("stars", r), r;
680
- }
681
- function B(r) {
682
- return !r || r.toLowerCase() === "x" || r === "*";
683
- }
684
- function hr(r, s) {
685
- return r.trim().split(/\s+/).map(function(l) {
686
- return mr(l, s);
687
- }).join(" ");
688
- }
689
- function mr(r, s) {
690
- var l = s.loose ? L[d.TILDELOOSE] : L[d.TILDE];
691
- return r.replace(l, function(S, y, v, O, V) {
692
- E("tilde", r, S, y, v, O, V);
693
- var F;
694
- return B(y) ? F = "" : B(v) ? F = ">=" + y + ".0.0 <" + (+y + 1) + ".0.0" : B(O) ? F = ">=" + y + "." + v + ".0 <" + y + "." + (+v + 1) + ".0" : V ? (E("replaceTilde pr", V), F = ">=" + y + "." + v + "." + O + "-" + V + " <" + y + "." + (+v + 1) + ".0") : F = ">=" + y + "." + v + "." + O + " <" + y + "." + (+v + 1) + ".0", E("tilde return", F), F;
695
- });
696
- }
697
- function dr(r, s) {
698
- return r.trim().split(/\s+/).map(function(l) {
699
- return gr(l, s);
700
- }).join(" ");
701
- }
702
- function gr(r, s) {
703
- E("caret", r, s);
704
- var l = s.loose ? L[d.CARETLOOSE] : L[d.CARET];
705
- return r.replace(l, function(S, y, v, O, V) {
706
- E("caret", r, S, y, v, O, V);
707
- var F;
708
- return B(y) ? F = "" : B(v) ? F = ">=" + y + ".0.0 <" + (+y + 1) + ".0.0" : B(O) ? y === "0" ? F = ">=" + y + "." + v + ".0 <" + y + "." + (+v + 1) + ".0" : F = ">=" + y + "." + v + ".0 <" + (+y + 1) + ".0.0" : V ? (E("replaceCaret pr", V), y === "0" ? v === "0" ? F = ">=" + y + "." + v + "." + O + "-" + V + " <" + y + "." + v + "." + (+O + 1) : F = ">=" + y + "." + v + "." + O + "-" + V + " <" + y + "." + (+v + 1) + ".0" : F = ">=" + y + "." + v + "." + O + "-" + V + " <" + (+y + 1) + ".0.0") : (E("no pr"), y === "0" ? v === "0" ? F = ">=" + y + "." + v + "." + O + " <" + y + "." + v + "." + (+O + 1) : F = ">=" + y + "." + v + "." + O + " <" + y + "." + (+v + 1) + ".0" : F = ">=" + y + "." + v + "." + O + " <" + (+y + 1) + ".0.0"), E("caret return", F), F;
709
- });
710
- }
711
- function Er(r, s) {
712
- return E("replaceXRanges", r, s), r.split(/\s+/).map(function(l) {
713
- return Ir(l, s);
714
- }).join(" ");
715
- }
716
- function Ir(r, s) {
717
- r = r.trim();
718
- var l = s.loose ? L[d.XRANGELOOSE] : L[d.XRANGE];
719
- return r.replace(l, function(S, y, v, O, V, F) {
720
- E("xRange", r, S, y, v, O, V, F);
721
- var ge = B(v), Ee = ge || B(O), se = Ee || B(V), ie = se;
722
- return y === "=" && ie && (y = ""), F = s.includePrerelease ? "-0" : "", ge ? y === ">" || y === "<" ? S = "<0.0.0-0" : S = "*" : y && ie ? (Ee && (O = 0), V = 0, y === ">" ? (y = ">=", Ee ? (v = +v + 1, O = 0, V = 0) : (O = +O + 1, V = 0)) : y === "<=" && (y = "<", Ee ? v = +v + 1 : O = +O + 1), S = y + v + "." + O + "." + V + F) : Ee ? S = ">=" + v + ".0.0" + F + " <" + (+v + 1) + ".0.0" + F : se && (S = ">=" + v + "." + O + ".0" + F + " <" + v + "." + (+O + 1) + ".0" + F), E("xRange return", S), S;
723
- });
724
- }
725
- function Ar(r, s) {
726
- return E("replaceStars", r, s), r.trim().replace(L[d.STAR], "");
727
- }
728
- function Nr(r, s, l, S, y, v, O, V, F, ge, Ee, se, ie) {
729
- return B(l) ? s = "" : B(S) ? s = ">=" + l + ".0.0" : B(y) ? s = ">=" + l + "." + S + ".0" : s = ">=" + s, B(F) ? V = "" : B(ge) ? V = "<" + (+F + 1) + ".0.0" : B(Ee) ? V = "<" + F + "." + (+ge + 1) + ".0" : se ? V = "<=" + F + "." + ge + "." + Ee + "-" + se : V = "<=" + V, (s + " " + V).trim();
730
- }
731
- G.prototype.test = function(r) {
732
- if (!r)
733
- return !1;
734
- if (typeof r == "string")
735
- try {
736
- r = new j(r, this.options);
737
- } catch {
738
- return !1;
739
- }
740
- for (var s = 0; s < this.set.length; s++)
741
- if (Sr(this.set[s], r, this.options))
742
- return !0;
743
- return !1;
744
- };
745
- function Sr(r, s, l) {
746
- for (var S = 0; S < r.length; S++)
747
- if (!r[S].test(s))
748
- return !1;
749
- if (s.prerelease.length && !l.includePrerelease) {
750
- for (S = 0; S < r.length; S++)
751
- if (E(r[S].semver), r[S].semver !== de && r[S].semver.prerelease.length > 0) {
752
- var y = r[S].semver;
753
- if (y.major === s.major && y.minor === s.minor && y.patch === s.patch)
754
- return !0;
755
- }
756
- return !1;
757
- }
758
- return !0;
759
- }
760
- o.satisfies = je;
761
- function je(r, s, l) {
762
- try {
763
- s = new G(s, l);
764
- } catch {
765
- return !1;
766
- }
767
- return s.test(r);
768
- }
769
- o.maxSatisfying = br;
770
- function br(r, s, l) {
771
- var S = null, y = null;
772
- try {
773
- var v = new G(s, l);
774
- } catch {
775
- return null;
776
- }
777
- return r.forEach(function(O) {
778
- v.test(O) && (!S || y.compare(O) === -1) && (S = O, y = new j(S, l));
779
- }), S;
780
- }
781
- o.minSatisfying = Tr;
782
- function Tr(r, s, l) {
783
- var S = null, y = null;
784
- try {
785
- var v = new G(s, l);
786
- } catch {
787
- return null;
788
- }
789
- return r.forEach(function(O) {
790
- v.test(O) && (!S || y.compare(O) === 1) && (S = O, y = new j(S, l));
791
- }), S;
792
- }
793
- o.minVersion = yr;
794
- function yr(r, s) {
795
- r = new G(r, s);
796
- var l = new j("0.0.0");
797
- if (r.test(l) || (l = new j("0.0.0-0"), r.test(l)))
798
- return l;
799
- l = null;
800
- for (var S = 0; S < r.set.length; ++S) {
801
- var y = r.set[S];
802
- y.forEach(function(v) {
803
- var O = new j(v.semver.version);
804
- switch (v.operator) {
805
- case ">":
806
- O.prerelease.length === 0 ? O.patch++ : O.prerelease.push(0), O.raw = O.format();
807
- case "":
808
- case ">=":
809
- (!l || x(l, O)) && (l = O);
810
- break;
811
- case "<":
812
- case "<=":
813
- break;
814
- default:
815
- throw new Error("Unexpected operation: " + v.operator);
816
- }
817
- });
818
- }
819
- return l && r.test(l) ? l : null;
820
- }
821
- o.validRange = Rr;
822
- function Rr(r, s) {
823
- try {
824
- return new G(r, s).range || "*";
825
- } catch {
826
- return null;
827
- }
828
- }
829
- o.ltr = vr;
830
- function vr(r, s, l) {
831
- return ze(r, s, "<", l);
832
- }
833
- o.gtr = Or;
834
- function Or(r, s, l) {
835
- return ze(r, s, ">", l);
836
- }
837
- o.outside = ze;
838
- function ze(r, s, l, S) {
839
- r = new j(r, S), s = new G(s, S);
840
- var y, v, O, V, F;
841
- switch (l) {
842
- case ">":
843
- y = x, v = W, O = X, V = ">", F = ">=";
844
- break;
845
- case "<":
846
- y = X, v = $, O = x, V = "<", F = "<=";
847
- break;
848
- default:
849
- throw new TypeError('Must provide a hilo val of "<" or ">"');
850
- }
851
- if (je(r, s, S))
852
- return !1;
853
- for (var ge = 0; ge < s.set.length; ++ge) {
854
- var Ee = s.set[ge], se = null, ie = null;
855
- if (Ee.forEach(function(ye) {
856
- ye.semver === de && (ye = new Q(">=0.0.0")), se = se || ye, ie = ie || ye, y(ye.semver, se.semver, S) ? se = ye : O(ye.semver, ie.semver, S) && (ie = ye);
857
- }), se.operator === V || se.operator === F || (!ie.operator || ie.operator === V) && v(r, ie.semver))
858
- return !1;
859
- if (ie.operator === F && O(r, ie.semver))
860
- return !1;
861
- }
862
- return !0;
863
- }
864
- o.prerelease = wr;
865
- function wr(r, s) {
866
- var l = me(r, s);
867
- return l && l.prerelease.length ? l.prerelease : null;
868
- }
869
- o.intersects = _r;
870
- function _r(r, s, l) {
871
- return r = new G(r, l), s = new G(s, l), r.intersects(s);
872
- }
873
- o.coerce = Lr;
874
- function Lr(r, s) {
875
- if (r instanceof j)
876
- return r;
877
- if (typeof r == "number" && (r = String(r)), typeof r != "string")
878
- return null;
879
- s = s || {};
880
- var l = null;
881
- if (!s.rtl)
882
- l = r.match(L[d.COERCE]);
883
- else {
884
- for (var S; (S = L[d.COERCERTL].exec(r)) && (!l || l.index + l[0].length !== r.length); )
885
- (!l || S.index + S[0].length !== l.index + l[0].length) && (l = S), L[d.COERCERTL].lastIndex = S.index + S[1].length + S[2].length;
886
- L[d.COERCERTL].lastIndex = -1;
887
- }
888
- return l === null ? null : me(l[2] + "." + (l[3] || "0") + "." + (l[4] || "0"), s);
889
- }
890
- })(st, st.exports);
891
- var dn = st.exports;
892
- const Si = /* @__PURE__ */ mn(dn), bi = (t) => t == null ? [] : Array.isArray(t) ? t : [t], Ti = e.any().refine((t) => typeof t == "bigint", {
893
- message: "Value must be a BigInt"
894
- }).transform((t) => BigInt(t));
895
- var gn = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, qe = Math.ceil, ce = Math.floor, ne = "[BigNumber Error] ", yt = ne + "Number primitive has more than 15 significant digits: ", pe = 1e14, U = 14, We = 9007199254740991, Ke = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], Re = 1e7, Z = 1e9;
896
- function kt(t) {
897
- var o, E, T, N = R.prototype = { constructor: R, toString: null, valueOf: null }, D = new R(1), w = 20, k = 4, L = -7, A = 21, d = -1e7, Y = 1e7, P = !1, fe = 1, ee = 0, Ie = {
898
- prefix: "",
899
- groupSize: 3,
900
- secondaryGroupSize: 0,
901
- groupSeparator: ",",
902
- decimalSeparator: ".",
903
- fractionGroupSize: 0,
904
- fractionGroupSeparator: " ",
905
- // non-breaking space
906
- suffix: ""
907
- }, Ae = "0123456789abcdefghijklmnopqrstuvwxyz", _e = !0;
908
- function R(n, a) {
909
- var i, h, u, p, I, c, f, g, m = this;
910
- if (!(m instanceof R)) return new R(n, a);
911
- if (a == null) {
912
- if (n && n._isBigNumber === !0) {
913
- m.s = n.s, !n.c || n.e > Y ? m.c = m.e = null : n.e < d ? m.c = [m.e = 0] : (m.e = n.e, m.c = n.c.slice());
914
- return;
915
- }
916
- if ((c = typeof n == "number") && n * 0 == 0) {
917
- if (m.s = 1 / n < 0 ? (n = -n, -1) : 1, n === ~~n) {
918
- for (p = 0, I = n; I >= 10; I /= 10, p++) ;
919
- p > Y ? m.c = m.e = null : (m.e = p, m.c = [n]);
920
- return;
921
- }
922
- g = String(n);
923
- } else {
924
- if (!gn.test(g = String(n))) return T(m, g, c);
925
- m.s = g.charCodeAt(0) == 45 ? (g = g.slice(1), -1) : 1;
926
- }
927
- (p = g.indexOf(".")) > -1 && (g = g.replace(".", "")), (I = g.search(/e/i)) > 0 ? (p < 0 && (p = I), p += +g.slice(I + 1), g = g.substring(0, I)) : p < 0 && (p = g.length);
928
- } else {
929
- if (q(a, 2, Ae.length, "Base"), a == 10 && _e)
930
- return m = new R(n), te(m, w + m.e + 1, k);
931
- if (g = String(n), c = typeof n == "number") {
932
- if (n * 0 != 0) return T(m, g, c, a);
933
- if (m.s = 1 / n < 0 ? (g = g.slice(1), -1) : 1, R.DEBUG && g.replace(/^0\.0*|\./, "").length > 15)
934
- throw Error(yt + n);
935
- } else
936
- m.s = g.charCodeAt(0) === 45 ? (g = g.slice(1), -1) : 1;
937
- for (i = Ae.slice(0, a), p = I = 0, f = g.length; I < f; I++)
938
- if (i.indexOf(h = g.charAt(I)) < 0) {
939
- if (h == ".") {
940
- if (I > p) {
941
- p = f;
942
- continue;
943
- }
944
- } else if (!u && (g == g.toUpperCase() && (g = g.toLowerCase()) || g == g.toLowerCase() && (g = g.toUpperCase()))) {
945
- u = !0, I = -1, p = 0;
946
- continue;
947
- }
948
- return T(m, String(n), c, a);
949
- }
950
- c = !1, g = E(g, a, 10, m.s), (p = g.indexOf(".")) > -1 ? g = g.replace(".", "") : p = g.length;
951
- }
952
- for (I = 0; g.charCodeAt(I) === 48; I++) ;
953
- for (f = g.length; g.charCodeAt(--f) === 48; ) ;
954
- if (g = g.slice(I, ++f)) {
955
- if (f -= I, c && R.DEBUG && f > 15 && (n > We || n !== ce(n)))
956
- throw Error(yt + m.s * n);
957
- if ((p = p - I - 1) > Y)
958
- m.c = m.e = null;
959
- else if (p < d)
960
- m.c = [m.e = 0];
961
- else {
962
- if (m.e = p, m.c = [], I = (p + 1) % U, p < 0 && (I += U), I < f) {
963
- for (I && m.c.push(+g.slice(0, I)), f -= U; I < f; )
964
- m.c.push(+g.slice(I, I += U));
965
- I = U - (g = g.slice(I)).length;
966
- } else
967
- I -= f;
968
- for (; I--; g += "0") ;
969
- m.c.push(+g);
970
- }
971
- } else
972
- m.c = [m.e = 0];
973
- }
974
- R.clone = kt, R.ROUND_UP = 0, R.ROUND_DOWN = 1, R.ROUND_CEIL = 2, R.ROUND_FLOOR = 3, R.ROUND_HALF_UP = 4, R.ROUND_HALF_DOWN = 5, R.ROUND_HALF_EVEN = 6, R.ROUND_HALF_CEIL = 7, R.ROUND_HALF_FLOOR = 8, R.EUCLID = 9, R.config = R.set = function(n) {
975
- var a, i;
976
- if (n != null)
977
- if (typeof n == "object") {
978
- if (n.hasOwnProperty(a = "DECIMAL_PLACES") && (i = n[a], q(i, 0, Z, a), w = i), n.hasOwnProperty(a = "ROUNDING_MODE") && (i = n[a], q(i, 0, 8, a), k = i), n.hasOwnProperty(a = "EXPONENTIAL_AT") && (i = n[a], i && i.pop ? (q(i[0], -Z, 0, a), q(i[1], 0, Z, a), L = i[0], A = i[1]) : (q(i, -Z, Z, a), L = -(A = i < 0 ? -i : i))), n.hasOwnProperty(a = "RANGE"))
979
- if (i = n[a], i && i.pop)
980
- q(i[0], -Z, -1, a), q(i[1], 1, Z, a), d = i[0], Y = i[1];
981
- else if (q(i, -Z, Z, a), i)
982
- d = -(Y = i < 0 ? -i : i);
983
- else
984
- throw Error(ne + a + " cannot be zero: " + i);
985
- if (n.hasOwnProperty(a = "CRYPTO"))
986
- if (i = n[a], i === !!i)
987
- if (i)
988
- if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes))
989
- P = i;
990
- else
991
- throw P = !i, Error(ne + "crypto unavailable");
992
- else
993
- P = i;
994
- else
995
- throw Error(ne + a + " not true or false: " + i);
996
- if (n.hasOwnProperty(a = "MODULO_MODE") && (i = n[a], q(i, 0, 9, a), fe = i), n.hasOwnProperty(a = "POW_PRECISION") && (i = n[a], q(i, 0, Z, a), ee = i), n.hasOwnProperty(a = "FORMAT"))
997
- if (i = n[a], typeof i == "object") Ie = i;
998
- else throw Error(ne + a + " not an object: " + i);
999
- if (n.hasOwnProperty(a = "ALPHABET"))
1000
- if (i = n[a], typeof i == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(i))
1001
- _e = i.slice(0, 10) == "0123456789", Ae = i;
1002
- else
1003
- throw Error(ne + a + " invalid: " + i);
1004
- } else
1005
- throw Error(ne + "Object expected: " + n);
1006
- return {
1007
- DECIMAL_PLACES: w,
1008
- ROUNDING_MODE: k,
1009
- EXPONENTIAL_AT: [L, A],
1010
- RANGE: [d, Y],
1011
- CRYPTO: P,
1012
- MODULO_MODE: fe,
1013
- POW_PRECISION: ee,
1014
- FORMAT: Ie,
1015
- ALPHABET: Ae
1016
- };
1017
- }, R.isBigNumber = function(n) {
1018
- if (!n || n._isBigNumber !== !0) return !1;
1019
- if (!R.DEBUG) return !0;
1020
- var a, i, h = n.c, u = n.e, p = n.s;
1021
- e: if ({}.toString.call(h) == "[object Array]") {
1022
- if ((p === 1 || p === -1) && u >= -Z && u <= Z && u === ce(u)) {
1023
- if (h[0] === 0) {
1024
- if (u === 0 && h.length === 1) return !0;
1025
- break e;
1026
- }
1027
- if (a = (u + 1) % U, a < 1 && (a += U), String(h[0]).length == a) {
1028
- for (a = 0; a < h.length; a++)
1029
- if (i = h[a], i < 0 || i >= pe || i !== ce(i)) break e;
1030
- if (i !== 0) return !0;
1031
- }
1032
- }
1033
- } else if (h === null && u === null && (p === null || p === 1 || p === -1))
1034
- return !0;
1035
- throw Error(ne + "Invalid BigNumber: " + n);
1036
- }, R.maximum = R.max = function() {
1037
- return me(arguments, -1);
1038
- }, R.minimum = R.min = function() {
1039
- return me(arguments, 1);
1040
- }, R.random = function() {
1041
- var n = 9007199254740992, a = Math.random() * n & 2097151 ? function() {
1042
- return ce(Math.random() * n);
1043
- } : function() {
1044
- return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
1045
- };
1046
- return function(i) {
1047
- var h, u, p, I, c, f = 0, g = [], m = new R(D);
1048
- if (i == null ? i = w : q(i, 0, Z), I = qe(i / U), P)
1049
- if (crypto.getRandomValues) {
1050
- for (h = crypto.getRandomValues(new Uint32Array(I *= 2)); f < I; )
1051
- c = h[f] * 131072 + (h[f + 1] >>> 11), c >= 9e15 ? (u = crypto.getRandomValues(new Uint32Array(2)), h[f] = u[0], h[f + 1] = u[1]) : (g.push(c % 1e14), f += 2);
1052
- f = I / 2;
1053
- } else if (crypto.randomBytes) {
1054
- for (h = crypto.randomBytes(I *= 7); f < I; )
1055
- c = (h[f] & 31) * 281474976710656 + h[f + 1] * 1099511627776 + h[f + 2] * 4294967296 + h[f + 3] * 16777216 + (h[f + 4] << 16) + (h[f + 5] << 8) + h[f + 6], c >= 9e15 ? crypto.randomBytes(7).copy(h, f) : (g.push(c % 1e14), f += 7);
1056
- f = I / 7;
1057
- } else
1058
- throw P = !1, Error(ne + "crypto unavailable");
1059
- if (!P)
1060
- for (; f < I; )
1061
- c = a(), c < 9e15 && (g[f++] = c % 1e14);
1062
- for (I = g[--f], i %= U, I && i && (c = Ke[U - i], g[f] = ce(I / c) * c); g[f] === 0; g.pop(), f--) ;
1063
- if (f < 0)
1064
- g = [p = 0];
1065
- else {
1066
- for (p = -1; g[0] === 0; g.splice(0, 1), p -= U) ;
1067
- for (f = 1, c = g[0]; c >= 10; c /= 10, f++) ;
1068
- f < U && (p -= U - f);
1069
- }
1070
- return m.e = p, m.c = g, m;
1071
- };
1072
- }(), R.sum = function() {
1073
- for (var n = 1, a = arguments, i = new R(a[0]); n < a.length; ) i = i.plus(a[n++]);
1074
- return i;
1075
- }, E = /* @__PURE__ */ function() {
1076
- var n = "0123456789";
1077
- function a(i, h, u, p) {
1078
- for (var I, c = [0], f, g = 0, m = i.length; g < m; ) {
1079
- for (f = c.length; f--; c[f] *= h) ;
1080
- for (c[0] += p.indexOf(i.charAt(g++)), I = 0; I < c.length; I++)
1081
- c[I] > u - 1 && (c[I + 1] == null && (c[I + 1] = 0), c[I + 1] += c[I] / u | 0, c[I] %= u);
1082
- }
1083
- return c.reverse();
1084
- }
1085
- return function(i, h, u, p, I) {
1086
- var c, f, g, m, b, _, C, x, X = i.indexOf("."), z = w, M = k;
1087
- for (X >= 0 && (m = ee, ee = 0, i = i.replace(".", ""), x = new R(h), _ = x.pow(i.length - X), ee = m, x.c = a(
1088
- Se(oe(_.c), _.e, "0"),
1089
- 10,
1090
- u,
1091
- n
1092
- ), x.e = x.c.length), C = a(i, h, u, I ? (c = Ae, n) : (c = n, Ae)), g = m = C.length; C[--m] == 0; C.pop()) ;
1093
- if (!C[0]) return c.charAt(0);
1094
- if (X < 0 ? --g : (_.c = C, _.e = g, _.s = p, _ = o(_, x, z, M, u), C = _.c, b = _.r, g = _.e), f = g + z + 1, X = C[f], m = u / 2, b = b || f < 0 || C[f + 1] != null, b = M < 4 ? (X != null || b) && (M == 0 || M == (_.s < 0 ? 3 : 2)) : X > m || X == m && (M == 4 || b || M == 6 && C[f - 1] & 1 || M == (_.s < 0 ? 8 : 7)), f < 1 || !C[0])
1095
- i = b ? Se(c.charAt(1), -z, c.charAt(0)) : c.charAt(0);
1096
- else {
1097
- if (C.length = f, b)
1098
- for (--u; ++C[--f] > u; )
1099
- C[f] = 0, f || (++g, C = [1].concat(C));
1100
- for (m = C.length; !C[--m]; ) ;
1101
- for (X = 0, i = ""; X <= m; i += c.charAt(C[X++])) ;
1102
- i = Se(i, g, c.charAt(0));
1103
- }
1104
- return i;
1105
- };
1106
- }(), o = /* @__PURE__ */ function() {
1107
- function n(h, u, p) {
1108
- var I, c, f, g, m = 0, b = h.length, _ = u % Re, C = u / Re | 0;
1109
- for (h = h.slice(); b--; )
1110
- f = h[b] % Re, g = h[b] / Re | 0, I = C * f + g * _, c = _ * f + I % Re * Re + m, m = (c / p | 0) + (I / Re | 0) + C * g, h[b] = c % p;
1111
- return m && (h = [m].concat(h)), h;
1112
- }
1113
- function a(h, u, p, I) {
1114
- var c, f;
1115
- if (p != I)
1116
- f = p > I ? 1 : -1;
1117
- else
1118
- for (c = f = 0; c < p; c++)
1119
- if (h[c] != u[c]) {
1120
- f = h[c] > u[c] ? 1 : -1;
1121
- break;
1122
- }
1123
- return f;
1124
- }
1125
- function i(h, u, p, I) {
1126
- for (var c = 0; p--; )
1127
- h[p] -= c, c = h[p] < u[p] ? 1 : 0, h[p] = c * I + h[p] - u[p];
1128
- for (; !h[0] && h.length > 1; h.splice(0, 1)) ;
1129
- }
1130
- return function(h, u, p, I, c) {
1131
- var f, g, m, b, _, C, x, X, z, M, $, W, Ne, Q, de, G, Te, re = h.s == u.s ? 1 : -1, J = h.c, B = u.c;
1132
- if (!J || !J[0] || !B || !B[0])
1133
- return new R(
1134
- // Return NaN if either NaN, or both Infinity or 0.
1135
- !h.s || !u.s || (J ? B && J[0] == B[0] : !B) ? NaN : (
1136
- // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
1137
- J && J[0] == 0 || !B ? re * 0 : re / 0
1138
- )
1139
- );
1140
- for (X = new R(re), z = X.c = [], g = h.e - u.e, re = p + g + 1, c || (c = pe, g = le(h.e / U) - le(u.e / U), re = re / U | 0), m = 0; B[m] == (J[m] || 0); m++) ;
1141
- if (B[m] > (J[m] || 0) && g--, re < 0)
1142
- z.push(1), b = !0;
1143
- else {
1144
- for (Q = J.length, G = B.length, m = 0, re += 2, _ = ce(c / (B[0] + 1)), _ > 1 && (B = n(B, _, c), J = n(J, _, c), G = B.length, Q = J.length), Ne = G, M = J.slice(0, G), $ = M.length; $ < G; M[$++] = 0) ;
1145
- Te = B.slice(), Te = [0].concat(Te), de = B[0], B[1] >= c / 2 && de++;
1146
- do {
1147
- if (_ = 0, f = a(B, M, G, $), f < 0) {
1148
- if (W = M[0], G != $ && (W = W * c + (M[1] || 0)), _ = ce(W / de), _ > 1)
1149
- for (_ >= c && (_ = c - 1), C = n(B, _, c), x = C.length, $ = M.length; a(C, M, x, $) == 1; )
1150
- _--, i(C, G < x ? Te : B, x, c), x = C.length, f = 1;
1151
- else
1152
- _ == 0 && (f = _ = 1), C = B.slice(), x = C.length;
1153
- if (x < $ && (C = [0].concat(C)), i(M, C, $, c), $ = M.length, f == -1)
1154
- for (; a(B, M, G, $) < 1; )
1155
- _++, i(M, G < $ ? Te : B, $, c), $ = M.length;
1156
- } else f === 0 && (_++, M = [0]);
1157
- z[m++] = _, M[0] ? M[$++] = J[Ne] || 0 : (M = [J[Ne]], $ = 1);
1158
- } while ((Ne++ < Q || M[0] != null) && re--);
1159
- b = M[0] != null, z[0] || z.splice(0, 1);
1160
- }
1161
- if (c == pe) {
1162
- for (m = 1, re = z[0]; re >= 10; re /= 10, m++) ;
1163
- te(X, p + (X.e = m + g * U - 1) + 1, I, b);
1164
- } else
1165
- X.e = g, X.r = +b;
1166
- return X;
1167
- };
1168
- }();
1169
- function ae(n, a, i, h) {
1170
- var u, p, I, c, f;
1171
- if (i == null ? i = k : q(i, 0, 8), !n.c) return n.toString();
1172
- if (u = n.c[0], I = n.e, a == null)
1173
- f = oe(n.c), f = h == 1 || h == 2 && (I <= L || I >= A) ? Fe(f, I) : Se(f, I, "0");
1174
- else if (n = te(new R(n), a, i), p = n.e, f = oe(n.c), c = f.length, h == 1 || h == 2 && (a <= p || p <= L)) {
1175
- for (; c < a; f += "0", c++) ;
1176
- f = Fe(f, p);
1177
- } else if (a -= I, f = Se(f, p, "0"), p + 1 > c) {
1178
- if (--a > 0) for (f += "."; a--; f += "0") ;
1179
- } else if (a += p - c, a > 0)
1180
- for (p + 1 == c && (f += "."); a--; f += "0") ;
1181
- return n.s < 0 && u ? "-" + f : f;
1182
- }
1183
- function me(n, a) {
1184
- for (var i, h, u = 1, p = new R(n[0]); u < n.length; u++)
1185
- h = new R(n[u]), (!h.s || (i = Oe(p, h)) === a || i === 0 && p.s === a) && (p = h);
1186
- return p;
1187
- }
1188
- function Le(n, a, i) {
1189
- for (var h = 1, u = a.length; !a[--u]; a.pop()) ;
1190
- for (u = a[0]; u >= 10; u /= 10, h++) ;
1191
- return (i = h + i * U - 1) > Y ? n.c = n.e = null : i < d ? n.c = [n.e = 0] : (n.e = i, n.c = a), n;
1192
- }
1193
- T = /* @__PURE__ */ function() {
1194
- var n = /^(-?)0([xbo])(?=\w[\w.]*$)/i, a = /^([^.]+)\.$/, i = /^\.([^.]+)$/, h = /^-?(Infinity|NaN)$/, u = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
1195
- return function(p, I, c, f) {
1196
- var g, m = c ? I : I.replace(u, "");
1197
- if (h.test(m))
1198
- p.s = isNaN(m) ? null : m < 0 ? -1 : 1;
1199
- else {
1200
- if (!c && (m = m.replace(n, function(b, _, C) {
1201
- return g = (C = C.toLowerCase()) == "x" ? 16 : C == "b" ? 2 : 8, !f || f == g ? _ : b;
1202
- }), f && (g = f, m = m.replace(a, "$1").replace(i, "0.$1")), I != m))
1203
- return new R(m, g);
1204
- if (R.DEBUG)
1205
- throw Error(ne + "Not a" + (f ? " base " + f : "") + " number: " + I);
1206
- p.s = null;
1207
- }
1208
- p.c = p.e = null;
1209
- };
1210
- }();
1211
- function te(n, a, i, h) {
1212
- var u, p, I, c, f, g, m, b = n.c, _ = Ke;
1213
- if (b) {
1214
- e: {
1215
- for (u = 1, c = b[0]; c >= 10; c /= 10, u++) ;
1216
- if (p = a - u, p < 0)
1217
- p += U, I = a, f = b[g = 0], m = ce(f / _[u - I - 1] % 10);
1218
- else if (g = qe((p + 1) / U), g >= b.length)
1219
- if (h) {
1220
- for (; b.length <= g; b.push(0)) ;
1221
- f = m = 0, u = 1, p %= U, I = p - U + 1;
1222
- } else
1223
- break e;
1224
- else {
1225
- for (f = c = b[g], u = 1; c >= 10; c /= 10, u++) ;
1226
- p %= U, I = p - U + u, m = I < 0 ? 0 : ce(f / _[u - I - 1] % 10);
1227
- }
1228
- if (h = h || a < 0 || // Are there any non-zero digits after the rounding digit?
1229
- // The expression n % pows10[d - j - 1] returns all digits of n to the right
1230
- // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
1231
- b[g + 1] != null || (I < 0 ? f : f % _[u - I - 1]), h = i < 4 ? (m || h) && (i == 0 || i == (n.s < 0 ? 3 : 2)) : m > 5 || m == 5 && (i == 4 || h || i == 6 && // Check whether the digit to the left of the rounding digit is odd.
1232
- (p > 0 ? I > 0 ? f / _[u - I] : 0 : b[g - 1]) % 10 & 1 || i == (n.s < 0 ? 8 : 7)), a < 1 || !b[0])
1233
- return b.length = 0, h ? (a -= n.e + 1, b[0] = _[(U - a % U) % U], n.e = -a || 0) : b[0] = n.e = 0, n;
1234
- if (p == 0 ? (b.length = g, c = 1, g--) : (b.length = g + 1, c = _[U - p], b[g] = I > 0 ? ce(f / _[u - I] % _[I]) * c : 0), h)
1235
- for (; ; )
1236
- if (g == 0) {
1237
- for (p = 1, I = b[0]; I >= 10; I /= 10, p++) ;
1238
- for (I = b[0] += c, c = 1; I >= 10; I /= 10, c++) ;
1239
- p != c && (n.e++, b[0] == pe && (b[0] = 1));
1240
- break;
1241
- } else {
1242
- if (b[g] += c, b[g] != pe) break;
1243
- b[g--] = 0, c = 1;
1244
- }
1245
- for (p = b.length; b[--p] === 0; b.pop()) ;
1246
- }
1247
- n.e > Y ? n.c = n.e = null : n.e < d && (n.c = [n.e = 0]);
1248
- }
1249
- return n;
1250
- }
1251
- function j(n) {
1252
- var a, i = n.e;
1253
- return i === null ? n.toString() : (a = oe(n.c), a = i <= L || i >= A ? Fe(a, i) : Se(a, i, "0"), n.s < 0 ? "-" + a : a);
1254
- }
1255
- return N.absoluteValue = N.abs = function() {
1256
- var n = new R(this);
1257
- return n.s < 0 && (n.s = 1), n;
1258
- }, N.comparedTo = function(n, a) {
1259
- return Oe(this, new R(n, a));
1260
- }, N.decimalPlaces = N.dp = function(n, a) {
1261
- var i, h, u, p = this;
1262
- if (n != null)
1263
- return q(n, 0, Z), a == null ? a = k : q(a, 0, 8), te(new R(p), n + p.e + 1, a);
1264
- if (!(i = p.c)) return null;
1265
- if (h = ((u = i.length - 1) - le(this.e / U)) * U, u = i[u]) for (; u % 10 == 0; u /= 10, h--) ;
1266
- return h < 0 && (h = 0), h;
1267
- }, N.dividedBy = N.div = function(n, a) {
1268
- return o(this, new R(n, a), w, k);
1269
- }, N.dividedToIntegerBy = N.idiv = function(n, a) {
1270
- return o(this, new R(n, a), 0, 1);
1271
- }, N.exponentiatedBy = N.pow = function(n, a) {
1272
- var i, h, u, p, I, c, f, g, m, b = this;
1273
- if (n = new R(n), n.c && !n.isInteger())
1274
- throw Error(ne + "Exponent not an integer: " + j(n));
1275
- if (a != null && (a = new R(a)), c = n.e > 14, !b.c || !b.c[0] || b.c[0] == 1 && !b.e && b.c.length == 1 || !n.c || !n.c[0])
1276
- return m = new R(Math.pow(+j(b), c ? n.s * (2 - Ue(n)) : +j(n))), a ? m.mod(a) : m;
1277
- if (f = n.s < 0, a) {
1278
- if (a.c ? !a.c[0] : !a.s) return new R(NaN);
1279
- h = !f && b.isInteger() && a.isInteger(), h && (b = b.mod(a));
1280
- } else {
1281
- if (n.e > 9 && (b.e > 0 || b.e < -1 || (b.e == 0 ? b.c[0] > 1 || c && b.c[1] >= 24e7 : b.c[0] < 8e13 || c && b.c[0] <= 9999975e7)))
1282
- return p = b.s < 0 && Ue(n) ? -0 : 0, b.e > -1 && (p = 1 / p), new R(f ? 1 / p : p);
1283
- ee && (p = qe(ee / U + 2));
1284
- }
1285
- for (c ? (i = new R(0.5), f && (n.s = 1), g = Ue(n)) : (u = Math.abs(+j(n)), g = u % 2), m = new R(D); ; ) {
1286
- if (g) {
1287
- if (m = m.times(b), !m.c) break;
1288
- p ? m.c.length > p && (m.c.length = p) : h && (m = m.mod(a));
1289
- }
1290
- if (u) {
1291
- if (u = ce(u / 2), u === 0) break;
1292
- g = u % 2;
1293
- } else if (n = n.times(i), te(n, n.e + 1, 1), n.e > 14)
1294
- g = Ue(n);
1295
- else {
1296
- if (u = +j(n), u === 0) break;
1297
- g = u % 2;
1298
- }
1299
- b = b.times(b), p ? b.c && b.c.length > p && (b.c.length = p) : h && (b = b.mod(a));
1300
- }
1301
- return h ? m : (f && (m = D.div(m)), a ? m.mod(a) : p ? te(m, ee, k, I) : m);
1302
- }, N.integerValue = function(n) {
1303
- var a = new R(this);
1304
- return n == null ? n = k : q(n, 0, 8), te(a, a.e + 1, n);
1305
- }, N.isEqualTo = N.eq = function(n, a) {
1306
- return Oe(this, new R(n, a)) === 0;
1307
- }, N.isFinite = function() {
1308
- return !!this.c;
1309
- }, N.isGreaterThan = N.gt = function(n, a) {
1310
- return Oe(this, new R(n, a)) > 0;
1311
- }, N.isGreaterThanOrEqualTo = N.gte = function(n, a) {
1312
- return (a = Oe(this, new R(n, a))) === 1 || a === 0;
1313
- }, N.isInteger = function() {
1314
- return !!this.c && le(this.e / U) > this.c.length - 2;
1315
- }, N.isLessThan = N.lt = function(n, a) {
1316
- return Oe(this, new R(n, a)) < 0;
1317
- }, N.isLessThanOrEqualTo = N.lte = function(n, a) {
1318
- return (a = Oe(this, new R(n, a))) === -1 || a === 0;
1319
- }, N.isNaN = function() {
1320
- return !this.s;
1321
- }, N.isNegative = function() {
1322
- return this.s < 0;
1323
- }, N.isPositive = function() {
1324
- return this.s > 0;
1325
- }, N.isZero = function() {
1326
- return !!this.c && this.c[0] == 0;
1327
- }, N.minus = function(n, a) {
1328
- var i, h, u, p, I = this, c = I.s;
1329
- if (n = new R(n, a), a = n.s, !c || !a) return new R(NaN);
1330
- if (c != a)
1331
- return n.s = -a, I.plus(n);
1332
- var f = I.e / U, g = n.e / U, m = I.c, b = n.c;
1333
- if (!f || !g) {
1334
- if (!m || !b) return m ? (n.s = -a, n) : new R(b ? I : NaN);
1335
- if (!m[0] || !b[0])
1336
- return b[0] ? (n.s = -a, n) : new R(m[0] ? I : (
1337
- // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
1338
- k == 3 ? -0 : 0
1339
- ));
1340
- }
1341
- if (f = le(f), g = le(g), m = m.slice(), c = f - g) {
1342
- for ((p = c < 0) ? (c = -c, u = m) : (g = f, u = b), u.reverse(), a = c; a--; u.push(0)) ;
1343
- u.reverse();
1344
- } else
1345
- for (h = (p = (c = m.length) < (a = b.length)) ? c : a, c = a = 0; a < h; a++)
1346
- if (m[a] != b[a]) {
1347
- p = m[a] < b[a];
1348
- break;
1349
- }
1350
- if (p && (u = m, m = b, b = u, n.s = -n.s), a = (h = b.length) - (i = m.length), a > 0) for (; a--; m[i++] = 0) ;
1351
- for (a = pe - 1; h > c; ) {
1352
- if (m[--h] < b[h]) {
1353
- for (i = h; i && !m[--i]; m[i] = a) ;
1354
- --m[i], m[h] += pe;
1355
- }
1356
- m[h] -= b[h];
1357
- }
1358
- for (; m[0] == 0; m.splice(0, 1), --g) ;
1359
- return m[0] ? Le(n, m, g) : (n.s = k == 3 ? -1 : 1, n.c = [n.e = 0], n);
1360
- }, N.modulo = N.mod = function(n, a) {
1361
- var i, h, u = this;
1362
- return n = new R(n, a), !u.c || !n.s || n.c && !n.c[0] ? new R(NaN) : !n.c || u.c && !u.c[0] ? new R(u) : (fe == 9 ? (h = n.s, n.s = 1, i = o(u, n, 0, 3), n.s = h, i.s *= h) : i = o(u, n, 0, fe), n = u.minus(i.times(n)), !n.c[0] && fe == 1 && (n.s = u.s), n);
1363
- }, N.multipliedBy = N.times = function(n, a) {
1364
- var i, h, u, p, I, c, f, g, m, b, _, C, x, X, z, M = this, $ = M.c, W = (n = new R(n, a)).c;
1365
- if (!$ || !W || !$[0] || !W[0])
1366
- return !M.s || !n.s || $ && !$[0] && !W || W && !W[0] && !$ ? n.c = n.e = n.s = null : (n.s *= M.s, !$ || !W ? n.c = n.e = null : (n.c = [0], n.e = 0)), n;
1367
- for (h = le(M.e / U) + le(n.e / U), n.s *= M.s, f = $.length, b = W.length, f < b && (x = $, $ = W, W = x, u = f, f = b, b = u), u = f + b, x = []; u--; x.push(0)) ;
1368
- for (X = pe, z = Re, u = b; --u >= 0; ) {
1369
- for (i = 0, _ = W[u] % z, C = W[u] / z | 0, I = f, p = u + I; p > u; )
1370
- g = $[--I] % z, m = $[I] / z | 0, c = C * g + m * _, g = _ * g + c % z * z + x[p] + i, i = (g / X | 0) + (c / z | 0) + C * m, x[p--] = g % X;
1371
- x[p] = i;
1372
- }
1373
- return i ? ++h : x.splice(0, 1), Le(n, x, h);
1374
- }, N.negated = function() {
1375
- var n = new R(this);
1376
- return n.s = -n.s || null, n;
1377
- }, N.plus = function(n, a) {
1378
- var i, h = this, u = h.s;
1379
- if (n = new R(n, a), a = n.s, !u || !a) return new R(NaN);
1380
- if (u != a)
1381
- return n.s = -a, h.minus(n);
1382
- var p = h.e / U, I = n.e / U, c = h.c, f = n.c;
1383
- if (!p || !I) {
1384
- if (!c || !f) return new R(u / 0);
1385
- if (!c[0] || !f[0]) return f[0] ? n : new R(c[0] ? h : u * 0);
1386
- }
1387
- if (p = le(p), I = le(I), c = c.slice(), u = p - I) {
1388
- for (u > 0 ? (I = p, i = f) : (u = -u, i = c), i.reverse(); u--; i.push(0)) ;
1389
- i.reverse();
1390
- }
1391
- for (u = c.length, a = f.length, u - a < 0 && (i = f, f = c, c = i, a = u), u = 0; a; )
1392
- u = (c[--a] = c[a] + f[a] + u) / pe | 0, c[a] = pe === c[a] ? 0 : c[a] % pe;
1393
- return u && (c = [u].concat(c), ++I), Le(n, c, I);
1394
- }, N.precision = N.sd = function(n, a) {
1395
- var i, h, u, p = this;
1396
- if (n != null && n !== !!n)
1397
- return q(n, 1, Z), a == null ? a = k : q(a, 0, 8), te(new R(p), n, a);
1398
- if (!(i = p.c)) return null;
1399
- if (u = i.length - 1, h = u * U + 1, u = i[u]) {
1400
- for (; u % 10 == 0; u /= 10, h--) ;
1401
- for (u = i[0]; u >= 10; u /= 10, h++) ;
1402
- }
1403
- return n && p.e + 1 > h && (h = p.e + 1), h;
1404
- }, N.shiftedBy = function(n) {
1405
- return q(n, -We, We), this.times("1e" + n);
1406
- }, N.squareRoot = N.sqrt = function() {
1407
- var n, a, i, h, u, p = this, I = p.c, c = p.s, f = p.e, g = w + 4, m = new R("0.5");
1408
- if (c !== 1 || !I || !I[0])
1409
- return new R(!c || c < 0 && (!I || I[0]) ? NaN : I ? p : 1 / 0);
1410
- if (c = Math.sqrt(+j(p)), c == 0 || c == 1 / 0 ? (a = oe(I), (a.length + f) % 2 == 0 && (a += "0"), c = Math.sqrt(+a), f = le((f + 1) / 2) - (f < 0 || f % 2), c == 1 / 0 ? a = "5e" + f : (a = c.toExponential(), a = a.slice(0, a.indexOf("e") + 1) + f), i = new R(a)) : i = new R(c + ""), i.c[0]) {
1411
- for (f = i.e, c = f + g, c < 3 && (c = 0); ; )
1412
- if (u = i, i = m.times(u.plus(o(p, u, g, 1))), oe(u.c).slice(0, c) === (a = oe(i.c)).slice(0, c))
1413
- if (i.e < f && --c, a = a.slice(c - 3, c + 1), a == "9999" || !h && a == "4999") {
1414
- if (!h && (te(u, u.e + w + 2, 0), u.times(u).eq(p))) {
1415
- i = u;
1416
- break;
1417
- }
1418
- g += 4, c += 4, h = 1;
1419
- } else {
1420
- (!+a || !+a.slice(1) && a.charAt(0) == "5") && (te(i, i.e + w + 2, 1), n = !i.times(i).eq(p));
1421
- break;
1422
- }
1423
- }
1424
- return te(i, i.e + w + 1, k, n);
1425
- }, N.toExponential = function(n, a) {
1426
- return n != null && (q(n, 0, Z), n++), ae(this, n, a, 1);
1427
- }, N.toFixed = function(n, a) {
1428
- return n != null && (q(n, 0, Z), n = n + this.e + 1), ae(this, n, a);
1429
- }, N.toFormat = function(n, a, i) {
1430
- var h, u = this;
1431
- if (i == null)
1432
- n != null && a && typeof a == "object" ? (i = a, a = null) : n && typeof n == "object" ? (i = n, n = a = null) : i = Ie;
1433
- else if (typeof i != "object")
1434
- throw Error(ne + "Argument not an object: " + i);
1435
- if (h = u.toFixed(n, a), u.c) {
1436
- var p, I = h.split("."), c = +i.groupSize, f = +i.secondaryGroupSize, g = i.groupSeparator || "", m = I[0], b = I[1], _ = u.s < 0, C = _ ? m.slice(1) : m, x = C.length;
1437
- if (f && (p = c, c = f, f = p, x -= p), c > 0 && x > 0) {
1438
- for (p = x % c || c, m = C.substr(0, p); p < x; p += c) m += g + C.substr(p, c);
1439
- f > 0 && (m += g + C.slice(p)), _ && (m = "-" + m);
1440
- }
1441
- h = b ? m + (i.decimalSeparator || "") + ((f = +i.fractionGroupSize) ? b.replace(
1442
- new RegExp("\\d{" + f + "}\\B", "g"),
1443
- "$&" + (i.fractionGroupSeparator || "")
1444
- ) : b) : m;
1445
- }
1446
- return (i.prefix || "") + h + (i.suffix || "");
1447
- }, N.toFraction = function(n) {
1448
- var a, i, h, u, p, I, c, f, g, m, b, _, C = this, x = C.c;
1449
- if (n != null && (c = new R(n), !c.isInteger() && (c.c || c.s !== 1) || c.lt(D)))
1450
- throw Error(ne + "Argument " + (c.isInteger() ? "out of range: " : "not an integer: ") + j(c));
1451
- if (!x) return new R(C);
1452
- for (a = new R(D), g = i = new R(D), h = f = new R(D), _ = oe(x), p = a.e = _.length - C.e - 1, a.c[0] = Ke[(I = p % U) < 0 ? U + I : I], n = !n || c.comparedTo(a) > 0 ? p > 0 ? a : g : c, I = Y, Y = 1 / 0, c = new R(_), f.c[0] = 0; m = o(c, a, 0, 1), u = i.plus(m.times(h)), u.comparedTo(n) != 1; )
1453
- i = h, h = u, g = f.plus(m.times(u = g)), f = u, a = c.minus(m.times(u = a)), c = u;
1454
- return u = o(n.minus(i), h, 0, 1), f = f.plus(u.times(g)), i = i.plus(u.times(h)), f.s = g.s = C.s, p = p * 2, b = o(g, h, p, k).minus(C).abs().comparedTo(
1455
- o(f, i, p, k).minus(C).abs()
1456
- ) < 1 ? [g, h] : [f, i], Y = I, b;
1457
- }, N.toNumber = function() {
1458
- return +j(this);
1459
- }, N.toPrecision = function(n, a) {
1460
- return n != null && q(n, 1, Z), ae(this, n, a, 2);
1461
- }, N.toString = function(n) {
1462
- var a, i = this, h = i.s, u = i.e;
1463
- return u === null ? h ? (a = "Infinity", h < 0 && (a = "-" + a)) : a = "NaN" : (n == null ? a = u <= L || u >= A ? Fe(oe(i.c), u) : Se(oe(i.c), u, "0") : n === 10 && _e ? (i = te(new R(i), w + u + 1, k), a = Se(oe(i.c), i.e, "0")) : (q(n, 2, Ae.length, "Base"), a = E(Se(oe(i.c), u, "0"), 10, n, h, !0)), h < 0 && i.c[0] && (a = "-" + a)), a;
1464
- }, N.valueOf = N.toJSON = function() {
1465
- return j(this);
1466
- }, N._isBigNumber = !0, N[Symbol.toStringTag] = "BigNumber", N[Symbol.for("nodejs.util.inspect.custom")] = N.valueOf, t != null && R.set(t), R;
1467
- }
1468
- function le(t) {
1469
- var o = t | 0;
1470
- return t > 0 || t === o ? o : o - 1;
1471
- }
1472
- function oe(t) {
1473
- for (var o, E, T = 1, N = t.length, D = t[0] + ""; T < N; ) {
1474
- for (o = t[T++] + "", E = U - o.length; E--; o = "0" + o) ;
1475
- D += o;
1476
- }
1477
- for (N = D.length; D.charCodeAt(--N) === 48; ) ;
1478
- return D.slice(0, N + 1 || 1);
1479
- }
1480
- function Oe(t, o) {
1481
- var E, T, N = t.c, D = o.c, w = t.s, k = o.s, L = t.e, A = o.e;
1482
- if (!w || !k) return null;
1483
- if (E = N && !N[0], T = D && !D[0], E || T) return E ? T ? 0 : -k : w;
1484
- if (w != k) return w;
1485
- if (E = w < 0, T = L == A, !N || !D) return T ? 0 : !N ^ E ? 1 : -1;
1486
- if (!T) return L > A ^ E ? 1 : -1;
1487
- for (k = (L = N.length) < (A = D.length) ? L : A, w = 0; w < k; w++) if (N[w] != D[w]) return N[w] > D[w] ^ E ? 1 : -1;
1488
- return L == A ? 0 : L > A ^ E ? 1 : -1;
1489
- }
1490
- function q(t, o, E, T) {
1491
- if (t < o || t > E || t !== ce(t))
1492
- throw Error(ne + (T || "Argument") + (typeof t == "number" ? t < o || t > E ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(t));
1493
- }
1494
- function Ue(t) {
1495
- var o = t.c.length - 1;
1496
- return le(t.e / U) == o && t.c[o] % 2 != 0;
1497
- }
1498
- function Fe(t, o) {
1499
- return (t.length > 1 ? t.charAt(0) + "." + t.slice(1) : t) + (o < 0 ? "e" : "e+") + o;
1500
- }
1501
- function Se(t, o, E) {
1502
- var T, N;
1503
- if (o < 0) {
1504
- for (N = E + "."; ++o; N += E) ;
1505
- t = N + t;
1506
- } else if (T = t.length, ++o > T) {
1507
- for (N = E, o -= T; --o; N += E) ;
1508
- t += N;
1509
- } else o < T && (t = t.slice(0, o) + "." + t.slice(o));
1510
- return t;
1511
- }
1512
- var yi = kt();
1513
- const Ri = e.boolean().transform((t) => String(t)), vi = e.string().transform((t) => t === "true");
1514
- var ot;
1515
- (function(t) {
1516
- t[t.function = 0] = "function", t[t.l1_handler = 1] = "l1_handler", t[t.constructor = 2] = "constructor";
1517
- })(ot || (ot = {}));
1518
- const Ut = e.array(e.string()), Ye = e.object({
1519
- selector: e.string(),
1520
- offset: e.string(),
1521
- builtins: Ut.optional()
1522
- }), Ft = e.object({
1523
- CONSTRUCTOR: e.array(Ye),
1524
- EXTERNAL: e.array(Ye),
1525
- L1_HANDLER: e.array(Ye)
1526
- }), Oi = e.string(), En = e.object({
1527
- builtins: Ut,
1528
- data: e.array(e.string())
1529
- }), ct = e.object({
1530
- name: e.string(),
1531
- type: e.union([e.literal("felt"), e.literal("felt*"), e.string()])
1532
- }), In = e.nativeEnum(ot), An = e.object({
1533
- inputs: e.array(ct),
1534
- name: e.string(),
1535
- outputs: e.array(ct),
1536
- stateMutability: e.literal("view").optional(),
1537
- state_mutability: e.string().optional(),
1538
- type: In
1539
- }), lt = e.object({
1540
- name: e.string(),
1541
- type: e.union([e.literal("felt"), e.literal("felt*"), e.string()]),
1542
- kind: e.union([e.literal("key"), e.literal("data")])
1543
- }), Nn = e.object({
1544
- name: e.string(),
1545
- type: e.literal("event"),
1546
- data: e.array(lt),
1547
- keys: e.array(lt)
1548
- }), Sn = e.object({
1549
- name: e.string(),
1550
- members: e.array(lt),
1551
- kind: e.literal("struct"),
1552
- type: e.literal("event")
1553
- }), bn = e.object({
1554
- members: e.array(ct.and(e.object({
1555
- offset: e.number()
1556
- }))),
1557
- name: e.string(),
1558
- size: e.number(),
1559
- type: e.literal("struct")
1560
- }), Tn = e.union([Sn, Nn]), xt = e.array(e.union([An, Tn, bn, e.any()])), yn = e.object({
1561
- program: En,
1562
- entry_points_by_type: Ft,
1563
- abi: xt
1564
- }), Bt = e.array(e.string()), Rn = e.object({
1565
- type_names: e.array(e.tuple([e.number(), e.string()])),
1566
- libfunc_names: e.array(e.tuple([e.number(), e.string()])),
1567
- user_func_names: e.array(e.tuple([e.number(), e.string()]))
1568
- }), Ze = e.object({
1569
- selector: e.string(),
1570
- function_idx: e.number()
1571
- }), vn = e.object({
1572
- CONSTRUCTOR: e.array(Ze),
1573
- EXTERNAL: e.array(Ze),
1574
- L1_HANDLER: e.array(Ze)
1575
- }), On = e.object({
1576
- sierra_program: Bt,
1577
- sierra_program_debug_info: Rn.optional(),
1578
- contract_class_version: e.string(),
1579
- entry_points_by_type: vn,
1580
- abi: xt
1581
- }), wn = e.array(e.tuple([e.number(), e.array(e.string())])), _n = e.object({
1582
- prime: e.string(),
1583
- compiler_version: e.string(),
1584
- bytecode: Bt,
1585
- hints: e.array(e.any()),
1586
- pythonic_hints: wn,
1587
- entry_points_by_type: Ft
1588
- }), wi = _n, _i = e.union([
1589
- yn,
1590
- On
1591
- ]), Mt = Br(null), Gt = () => Mr(Mt), Li = () => {
1592
- var t;
1593
- return !!((t = Gt()) != null && t.emitter);
1594
- }, Ci = ({ emitter: t, children: o }) => /* @__PURE__ */ xr(Mt.Provider, { value: {
1595
- emitter: t
1596
- }, children: o });
1597
- let Rt = !1;
1598
- const Vt = () => {
1599
- var E;
1600
- const t = (E = Gt()) == null ? void 0 : E.emitter;
1601
- if (!t && !Rt) {
1602
- Rt = !0;
1603
- return;
1604
- }
1605
- return t;
1606
- }, Di = () => {
1607
- const t = Vt();
1608
- return t ? t.emit.bind(t) : kr;
1609
- }, Pi = () => {
1610
- const t = Vt();
1611
- return (E, T) => {
1612
- Gr(() => t ? t.on(E, T) : void 0, [E, T]);
1613
- };
1614
- };
1615
- var Ln = {};
1616
- function ue(t, o) {
1617
- typeof o == "boolean" && (o = { forever: o }), this._originalTimeouts = JSON.parse(JSON.stringify(t)), this._timeouts = t, this._options = o || {}, this._maxRetryTime = o && o.maxRetryTime || 1 / 0, this._fn = null, this._errors = [], this._attempts = 1, this._operationTimeout = null, this._operationTimeoutCb = null, this._timeout = null, this._operationStart = null, this._timer = null, this._options.forever && (this._cachedTimeouts = this._timeouts.slice(0));
1618
- }
1619
- var Cn = ue;
1620
- ue.prototype.reset = function() {
1621
- this._attempts = 1, this._timeouts = this._originalTimeouts.slice(0);
1622
- };
1623
- ue.prototype.stop = function() {
1624
- this._timeout && clearTimeout(this._timeout), this._timer && clearTimeout(this._timer), this._timeouts = [], this._cachedTimeouts = null;
1625
- };
1626
- ue.prototype.retry = function(t) {
1627
- if (this._timeout && clearTimeout(this._timeout), !t)
1628
- return !1;
1629
- var o = (/* @__PURE__ */ new Date()).getTime();
1630
- if (t && o - this._operationStart >= this._maxRetryTime)
1631
- return this._errors.push(t), this._errors.unshift(new Error("RetryOperation timeout occurred")), !1;
1632
- this._errors.push(t);
1633
- var E = this._timeouts.shift();
1634
- if (E === void 0)
1635
- if (this._cachedTimeouts)
1636
- this._errors.splice(0, this._errors.length - 1), E = this._cachedTimeouts.slice(-1);
1637
- else
1638
- return !1;
1639
- var T = this;
1640
- return this._timer = setTimeout(function() {
1641
- T._attempts++, T._operationTimeoutCb && (T._timeout = setTimeout(function() {
1642
- T._operationTimeoutCb(T._attempts);
1643
- }, T._operationTimeout), T._options.unref && T._timeout.unref()), T._fn(T._attempts);
1644
- }, E), this._options.unref && this._timer.unref(), !0;
1645
- };
1646
- ue.prototype.attempt = function(t, o) {
1647
- this._fn = t, o && (o.timeout && (this._operationTimeout = o.timeout), o.cb && (this._operationTimeoutCb = o.cb));
1648
- var E = this;
1649
- this._operationTimeoutCb && (this._timeout = setTimeout(function() {
1650
- E._operationTimeoutCb();
1651
- }, E._operationTimeout)), this._operationStart = (/* @__PURE__ */ new Date()).getTime(), this._fn(this._attempts);
1652
- };
1653
- ue.prototype.try = function(t) {
1654
- this.attempt(t);
1655
- };
1656
- ue.prototype.start = function(t) {
1657
- this.attempt(t);
1658
- };
1659
- ue.prototype.start = ue.prototype.try;
1660
- ue.prototype.errors = function() {
1661
- return this._errors;
1662
- };
1663
- ue.prototype.attempts = function() {
1664
- return this._attempts;
1665
- };
1666
- ue.prototype.mainError = function() {
1667
- if (this._errors.length === 0)
1668
- return null;
1669
- for (var t = {}, o = null, E = 0, T = 0; T < this._errors.length; T++) {
1670
- var N = this._errors[T], D = N.message, w = (t[D] || 0) + 1;
1671
- t[D] = w, w >= E && (o = N, E = w);
1672
- }
1673
- return o;
1674
- };
1675
- (function(t) {
1676
- var o = Cn;
1677
- t.operation = function(E) {
1678
- var T = t.timeouts(E);
1679
- return new o(T, {
1680
- forever: E && (E.forever || E.retries === 1 / 0),
1681
- unref: E && E.unref,
1682
- maxRetryTime: E && E.maxRetryTime
1683
- });
1684
- }, t.timeouts = function(E) {
1685
- if (E instanceof Array)
1686
- return [].concat(E);
1687
- var T = {
1688
- retries: 10,
1689
- factor: 2,
1690
- minTimeout: 1 * 1e3,
1691
- maxTimeout: 1 / 0,
1692
- randomize: !1
1693
- };
1694
- for (var N in E)
1695
- T[N] = E[N];
1696
- if (T.minTimeout > T.maxTimeout)
1697
- throw new Error("minTimeout is greater than maxTimeout");
1698
- for (var D = [], w = 0; w < T.retries; w++)
1699
- D.push(this.createTimeout(w, T));
1700
- return E && E.forever && !D.length && D.push(this.createTimeout(w, T)), D.sort(function(k, L) {
1701
- return k - L;
1702
- }), D;
1703
- }, t.createTimeout = function(E, T) {
1704
- var N = T.randomize ? Math.random() + 1 : 1, D = Math.round(N * Math.max(T.minTimeout, 1) * Math.pow(T.factor, E));
1705
- return D = Math.min(D, T.maxTimeout), D;
1706
- }, t.wrap = function(E, T, N) {
1707
- if (T instanceof Array && (N = T, T = null), !N) {
1708
- N = [];
1709
- for (var D in E)
1710
- typeof E[D] == "function" && N.push(D);
1711
- }
1712
- for (var w = 0; w < N.length; w++) {
1713
- var k = N[w], L = E[k];
1714
- E[k] = (function(d) {
1715
- var Y = t.operation(T), P = Array.prototype.slice.call(arguments, 1), fe = P.pop();
1716
- P.push(function(ee) {
1717
- Y.retry(ee) || (ee && (arguments[0] = Y.mainError()), fe.apply(this, arguments));
1718
- }), Y.attempt(function() {
1719
- d.apply(E, P);
1720
- });
1721
- }).bind(E, L), E[k].options = T;
1722
- }
1723
- };
1724
- })(Ln);
1725
- var ut;
1726
- (function(t) {
1727
- t.NO_TOKEN_API_URL = "NO_TOKEN_API_URL is not defined", t.NO_TOKEN_PRICE_API_URL = "NO_TOKEN_PRICE_API_URL is not defined", t.TOKENS_DEFI_DECOMPOSITION_URL = "TOKENS_DEFI_DECOMPOSITION_URL is not defined", t.TOKENS_AIRDROPS_API_URL = "TOKENS_AIRDROPS_API_URL is not defined", t.TOKEN_PARSING_ERROR = "Unable to parse token data response", t.TOKEN_PRICE_PARSING_ERROR = "Unable to parse token price response", t.TOKEN_DEFI_DECOMPOSITION_PARSING_ERROR = "Unable to parse token defi decomposition response", t.TOKEN_PRICE_NOT_FOUND = "Token price not found", t.TOKEN_NOT_FOUND = "Token not found", t.TOKEN_DETAILS_NOT_FOUND = "Token details not found", t.FEE_TOKEN_NOT_FOUND = "Fee token not found", t.UNABLE_TO_CALCULATE_CURRENCY_VALUE = "Unable to calculate currency value", t.UNSAFE_DECIMALS = "Unsafe decimals in token";
1728
- })(ut || (ut = {}));
1729
- class ji extends we {
1730
- constructor(o) {
1731
- super(o, ut), this.name = "TokenError";
1732
- }
1733
- }
1734
- const $t = e.union([
1735
- e.literal("concentratedLiquidityPosition"),
1736
- e.literal("collateralizedDebtPosition")
1737
- ]), ki = e.object({
1738
- status: e.literal("initialising")
1739
- }).or(e.object({
1740
- status: e.literal("initialised"),
1741
- balances: e.array(e.object({
1742
- tokenAddress: H,
1743
- tokenBalance: e.string()
1744
- }))
1745
- })), Pe = e.object({
1746
- id: e.number(),
1747
- address: K,
1748
- brandColor: e.string().optional(),
1749
- name: e.string(),
1750
- symbol: e.string(),
1751
- decimals: e.number(),
1752
- iconUrl: e.string().optional(),
1753
- sendable: e.boolean(),
1754
- popular: e.boolean(),
1755
- refundable: e.boolean(),
1756
- listed: e.boolean(),
1757
- tradable: e.boolean(),
1758
- category: e.union([
1759
- e.literal("tokens"),
1760
- e.literal("currencies"),
1761
- e.literal("savings")
1762
- ]),
1763
- pricingId: e.number().optional(),
1764
- dappId: e.string().optional(),
1765
- marketData: e.object({
1766
- marketCap: e.number(),
1767
- marketCap24hChange: e.number(),
1768
- dailyVolume: e.number(),
1769
- rank: e.number()
1770
- }).optional(),
1771
- tags: e.array(e.string()).optional()
1772
- }), Ui = e.object({
1773
- tokens: e.array(Pe)
1774
- }), Fi = Pe, Xt = e.object({
1775
- pricingId: e.number(),
1776
- ethValue: e.string(),
1777
- ccyValue: e.string(),
1778
- ethDayChange: e.string(),
1779
- ccyDayChange: e.string()
1780
- }), xi = e.object({
1781
- prices: e.array(Xt)
1782
- }), vt = e.object({
1783
- tokenAddress: H,
1784
- principal: e.string(),
1785
- accruedFees: e.string(),
1786
- minPrice: e.string(),
1787
- maxPrice: e.string(),
1788
- currentPrice: e.string()
1789
- }), Ht = e.object({
1790
- tokenAddress: K.optional(),
1791
- totalBalances: e.record(e.string())
1792
- }), zt = Ht.extend({
1793
- tokenId: e.string(),
1794
- data: e.object({
1795
- poolFeePercentage: e.string(),
1796
- tickSpacingPercentage: e.string().optional(),
1797
- token0: vt,
1798
- token1: vt
1799
- })
1800
- }), Bi = e.array(zt), qt = Ht.extend({
1801
- data: e.object({
1802
- apy: e.string().optional(),
1803
- group: e.number().optional(),
1804
- collateral: e.boolean(),
1805
- debt: e.boolean(),
1806
- lending: e.boolean()
1807
- })
1808
- }), Mi = e.array(qt), Dn = e.array(zt.or(qt)), Pn = e.object({
1809
- name: e.string(),
1810
- manageUrl: e.string(),
1811
- type: $t,
1812
- groups: e.record(e.object({
1813
- name: e.string().optional(),
1814
- healthRatio: e.string().optional()
1815
- })).optional(),
1816
- positions: Dn
1817
- }), jn = e.object({
1818
- dappId: e.string(),
1819
- products: e.array(Pn)
1820
- }), Gi = e.object({
1821
- dapps: e.array(jn)
1822
- }), kn = e.object({
1823
- name: e.string().optional(),
1824
- tokenAddress: K,
1825
- amount: e.string().optional(),
1826
- claimUrl: e.string().optional(),
1827
- claimStart: e.number(),
1828
- claimEnd: e.number().optional()
1829
- }), Vi = e.object({
1830
- accountAddress: K,
1831
- chain: e.string(),
1832
- airdrops: e.array(kn)
1833
- }), He = e.object({
1834
- address: K,
1835
- networkId: e.string({ required_error: "Network is required" })
1836
- }, { required_error: "BaseToken is required" });
1837
- He.required().extend({
1838
- balance: e.string()
1839
- });
1840
- const Wt = He.required().extend({
1841
- id: e.number().optional(),
1842
- name: e.string().optional(),
1843
- symbol: e.string().optional(),
1844
- decimals: e.coerce.number().optional(),
1845
- iconUrl: e.string().url("").optional().or(e.literal("")),
1846
- // fallback since some iconUrls are empty, causing validation to fail
1847
- pricingId: e.number().optional(),
1848
- category: e.string().optional(),
1849
- dappId: e.string().optional(),
1850
- brandColor: e.string().optional()
1851
- }), Un = Wt.extend({
1852
- balance: e.string()
1853
- }), Fn = Wt.extend({
1854
- currencyValue: e.string(),
1855
- ccyDayChange: e.string().optional(),
1856
- ethDayChange: e.string().optional(),
1857
- unitCurrencyValue: e.string().optional()
1858
- }), Et = Fn.extend({
1859
- ...Un.shape
1860
- });
1861
- e.array(Et);
1862
- He.extend({
1863
- ...Xt.shape
1864
- });
1865
- He.extend({
1866
- ...Pe.shape
1867
- });
1868
- const Ot = Et.extend({
1869
- accruedFees: e.string(),
1870
- currentPrice: e.string(),
1871
- maxPrice: e.string(),
1872
- minPrice: e.string(),
1873
- principal: e.string()
1874
- }), Kt = e.object({
1875
- address: K.optional(),
1876
- currencyValue: e.string().default("0")
1877
- }), Yt = Kt.extend({
1878
- poolFeePercentage: e.string(),
1879
- tickSpacingPercentage: e.string().optional(),
1880
- tokenId: e.string().optional(),
1881
- unitCurrencyValueToken0: e.string().optional(),
1882
- unitCurrencyValueToken1: e.string().optional(),
1883
- token0: Ot,
1884
- token1: Ot
1885
- }), $i = e.array(Yt), Xi = e.object({
1886
- name: e.string().optional(),
1887
- healthRatio: e.string().optional(),
1888
- accountAddress: K.optional()
1889
- }), Zt = Kt.extend({
1890
- totalBalances: e.record(e.string()),
1891
- collateral: e.boolean(),
1892
- debt: e.boolean(),
1893
- lending: e.boolean(),
1894
- apy: e.string().optional(),
1895
- group: e.string().optional(),
1896
- unitCurrencyValue: e.string().optional(),
1897
- positionToken: Pe.or(e.undefined()),
1898
- token: Et.optional(),
1899
- accountAddress: K.optional(),
1900
- accountAddressGroup: e.string().optional()
1901
- }), Hi = e.array(Zt), xn = Yt.or(Zt), Bn = e.record(e.object({
1902
- name: e.string().optional(),
1903
- healthRatio: e.string().optional(),
1904
- accountAddress: K.optional()
1905
- })), Mn = e.object({
1906
- type: $t,
1907
- manageUrl: e.string().url().optional(),
1908
- name: e.string(),
1909
- positions: e.array(xn),
1910
- // other types will be added when available from be
1911
- positionsTotalValue: e.string(),
1912
- brandColor: e.string().optional(),
1913
- groups: Bn.optional(),
1914
- accountAddress: K
1915
- }), Gn = e.array(Mn), zi = e.object({
1916
- dappId: e.string(),
1917
- products: Gn
1918
- }), Vn = e.object({
1919
- name: e.string().optional(),
1920
- tokenAddress: K,
1921
- token: Pe.optional(),
1922
- amount: e.string().optional(),
1923
- claimUrl: e.string().optional(),
1924
- claimStart: e.number(),
1925
- claimEnd: e.number().optional()
1926
- }), qi = e.array(Vn), $n = (t, o = 18) => Vr(t.replace(",", "."), Number(o)), Xn = e.string().trim().refine((t) => t !== "", {
1927
- message: "Amount is required"
1928
- }).refine((t) => {
1929
- try {
1930
- const o = $n(t).value;
1931
- if (o < 0n)
1932
- throw new Error("Amount must be positive");
1933
- if (o === 0n)
1934
- throw new Error("Amount can not be zero");
1935
- if (o > Qe.UINT_256_MAX)
1936
- throw new Error("Amount is too big");
1937
- } catch {
1938
- throw new Error("Amount should be a number");
1939
- }
1940
- return !0;
1941
- }, { message: "Invalid amount" }), Wi = (t) => !!Xn.parse(t), Hn = e.object({
1942
- data: e.object({
1943
- code: e.string().optional(),
1944
- // "STARKNAME_NOT_FOUND",
1945
- name: e.string().optional(),
1946
- // "AddressError"
1947
- message: e.string()
1948
- // "foo.stark not found"
1949
- })
1950
- }), Ki = (t) => {
1951
- const o = Hn.safeParse(t);
1952
- if (o.success)
1953
- return o.data.data.message;
1954
- }, zn = 3, Jt = process.env.FEE_OVERHEAD ? parseFloat(process.env.FEE_OVERHEAD) : zn, qn = 1.5, Ge = 10, Wn = ({ estimatedFee: t, overheadMultiplier: o = Jt }) => {
1955
- const T = be.toBigInt(t) * BigInt(o * Ge) / BigInt(Ge);
1956
- return be.toHex(T);
1957
- }, Yi = ({ suggestedMaxFee: t, overheadMultiplier: o = Jt, starknetJsOverheadMultiplier: E = qn }) => {
1958
- const N = be.toBigInt(t) * BigInt(Ge) / BigInt(E * Ge);
1959
- return Wn({ estimatedFee: N, overheadMultiplier: o });
1960
- };
1961
- var ft;
1962
- (function(t) {
1963
- t.SIMULATE_AND_REVIEW_FAILED = "Missing simulation";
1964
- })(ft || (ft = {}));
1965
- class Zi extends we {
1966
- constructor(o) {
1967
- super(o, ft), this.name = "EstimateError";
1968
- }
1969
- }
1970
- const Ji = e.object({
1971
- type: e.enum(["DECLARE", "DEPLOY", "DEPLOY_ACCOUNT", "INVOKE"]).default("INVOKE"),
1972
- calls: e.array(bt).or(bt).optional(),
1973
- calldata: e.array(e.string()).optional(),
1974
- classHash: Me.optional(),
1975
- salt: Me.optional(),
1976
- signature: e.array(e.string()).optional()
1977
- }), Kn = e.object({
1978
- amount: e.bigint(),
1979
- pricePerUnit: e.bigint()
1980
- }).or(e.object({ maxFee: e.bigint() })), wt = e.object({
1981
- feeTokenAddress: K,
1982
- amount: e.bigint(),
1983
- pricePerUnit: e.bigint(),
1984
- max: Kn.optional(),
1985
- dataGasConsumed: e.bigint().optional(),
1986
- dataGasPrice: e.bigint().optional()
1987
- }), Yn = e.object({
1988
- deployment: wt.optional(),
1989
- transactions: wt
1990
- }), Zn = e.union([
1991
- e.literal("critical"),
1992
- e.literal("high"),
1993
- e.literal("caution"),
1994
- e.literal("info")
1995
- ]), Jn = e.string(), Qn = e.object({
1996
- name: e.string(),
1997
- url: e.string(),
1998
- position: e.number()
1999
- }), Je = e.object({
2000
- address: e.string(),
2001
- name: e.string(),
2002
- symbol: e.string().optional(),
2003
- decimals: e.number().optional(),
2004
- unknown: e.boolean(),
2005
- iconUrl: e.string().optional(),
2006
- type: e.string()
2007
- }), _t = e.discriminatedUnion("type", [
2008
- e.object({
2009
- type: e.literal("amount"),
2010
- label: e.string(),
2011
- token: Je,
2012
- amount: e.string(),
2013
- usd: e.string(),
2014
- editable: e.boolean()
2015
- }),
2016
- e.object({
2017
- type: e.literal("address"),
2018
- label: e.string(),
2019
- address: e.string(),
2020
- addressName: e.string().optional(),
2021
- // tbd whether it's isVerified or verified
2022
- verified: e.boolean().optional()
2023
- }),
2024
- e.object({
2025
- type: e.literal("timestamp"),
2026
- label: e.string(),
2027
- value: e.string()
2028
- }),
2029
- e.object({
2030
- type: e.literal("token_address"),
2031
- label: e.string(),
2032
- token: Je
2033
- }),
2034
- e.object({
2035
- type: e.literal("calldata"),
2036
- label: e.string(),
2037
- entrypoint: e.string(),
2038
- calldata: e.array(e.string())
2039
- }),
2040
- e.object({
2041
- type: e.literal("text"),
2042
- label: e.string(),
2043
- text: e.string()
2044
- }),
2045
- e.object({
2046
- type: e.literal("nft"),
2047
- label: e.string(),
2048
- token: Je
2049
- })
2050
- ]), Qt = e.object({
2051
- name: e.string(),
2052
- properties: e.array(_t),
2053
- defaultProperties: e.array(_t).optional()
2054
- }), ea = e.union([
2055
- e.literal("verified"),
2056
- e.literal("neutral"),
2057
- e.literal("partial"),
2058
- e.literal("warn")
2059
- ]), ta = e.object({
2060
- unknown_token: e.unknown().optional(),
2061
- date_of_addition: e.string().optional(),
2062
- contract_address: K.optional(),
2063
- reason: e.string().optional(),
2064
- value: e.string().or(e.number()).optional()
2065
- }), er = e.object({
2066
- reason: Jn,
2067
- details: ta.optional(),
2068
- severity: Zn
2069
- }), ra = e.object({
2070
- assessment: ea,
2071
- warnings: e.array(er).optional(),
2072
- assessmentReasons: e.array(e.string()).optional(),
2073
- assessmentDetails: e.object({
2074
- contract_address: e.string()
2075
- }).optional(),
2076
- action: Qt
2077
- }), tr = e.object({
2078
- name: e.string(),
2079
- description: e.string(),
2080
- logoUrl: e.string(),
2081
- iconUrl: e.string(),
2082
- argentVerified: e.boolean(),
2083
- links: e.array(Qn)
2084
- }), rr = e.object({
2085
- assessment: e.union([
2086
- e.literal("verified"),
2087
- e.literal("neutral"),
2088
- e.literal("partial"),
2089
- e.literal("warn")
2090
- ]),
2091
- warnings: e.array(er).optional(),
2092
- assessmentDetails: e.object({
2093
- contract_address: e.string()
2094
- }).optional(),
2095
- targetedDapp: tr.optional(),
2096
- reviews: e.array(ra)
2097
- }).optional(), nr = e.object({
2098
- banner: e.string().nullable().optional(),
2099
- preview: e.string().nullable().optional(),
2100
- full: e.string().nullable().optional(),
2101
- original: e.string().nullable().optional()
2102
- }), na = e.object({
2103
- twitter: e.string().optional(),
2104
- external: e.string().optional(),
2105
- discord: e.string().optional()
2106
- }), It = e.object({
2107
- address: H,
2108
- decimals: e.number().optional(),
2109
- symbol: e.string().optional(),
2110
- name: e.string(),
2111
- description: e.string().optional(),
2112
- type: e.string().optional(),
2113
- usdValue: e.string().optional(),
2114
- iconUrl: e.string().optional(),
2115
- unknown: e.boolean().optional(),
2116
- imageUrls: nr.optional(),
2117
- links: na.optional()
2118
- }), aa = e.object({
2119
- tokenAddress: H,
2120
- owner: H,
2121
- spender: H,
2122
- value: e.string().optional(),
2123
- approvalForAll: e.boolean(),
2124
- details: It.optional()
2125
- }), ia = e.object({
2126
- tokenAddress: H,
2127
- from: H,
2128
- to: H,
2129
- tokenId: e.string().optional(),
2130
- value: e.string().optional(),
2131
- details: It.optional()
2132
- }), ve = e.union([e.string(), e.number(), e.bigint()]).transform((t) => parseInt(t.toString(), 10)), Lt = {
2133
- overallFee: ve,
2134
- gasPrice: ve,
2135
- gasUsage: ve,
2136
- dataGasPrice: ve.optional(),
2137
- dataGasConsumed: ve.optional()
2138
- }, sa = e.object({
2139
- ...Lt,
2140
- unit: e.string().transform((t) => t.toUpperCase()).pipe(e.literal("WEI")),
2141
- maxFee: ve
2142
- }).or(e.object({
2143
- ...Lt,
2144
- unit: e.string().transform((t) => t.toUpperCase()).pipe(e.literal("FRI")),
2145
- maxAmount: ve,
2146
- maxPricePerUnit: ve
2147
- })), oa = e.object({
2148
- type: e.string(),
2149
- label: e.string(),
2150
- tokenId: e.string().optional(),
2151
- value: e.string().optional(),
2152
- usdValue: e.string().optional(),
2153
- token: It,
2154
- sent: e.boolean().optional(),
2155
- tokenIdDetails: e.object({
2156
- name: e.string().optional(),
2157
- description: e.string().optional(),
2158
- imageUrls: nr.optional()
2159
- }).optional()
2160
- }), ca = e.object({
2161
- approvals: e.array(aa).optional(),
2162
- transfers: e.array(ia).optional(),
2163
- calculatedNonce: e.string().optional(),
2164
- feeEstimation: sa,
2165
- summary: e.array(oa).optional()
2166
- }), la = e.object({
2167
- label: e.string().optional(),
2168
- code: e.number().optional(),
2169
- message: e.string().optional(),
2170
- error: e.string().optional()
2171
- }), ar = e.object({
2172
- reviewOfTransaction: rr,
2173
- simulation: ca,
2174
- simulationError: e.undefined()
2175
- }), ir = e.object({
2176
- reviewOfTransaction: rr,
2177
- simulation: e.undefined(),
2178
- simulationError: la
2179
- }), sr = ar.or(ir), Qi = e.object({
2180
- transactions: e.array(sr)
2181
- }), es = e.object({
2182
- transactions: e.array(sr),
2183
- enrichedFeeEstimation: Yn.optional(),
2184
- isBackendDown: e.boolean().default(!1).optional()
2185
- });
2186
- function ts(t) {
2187
- return ar.safeParse(t).success;
2188
- }
2189
- function rs(t) {
2190
- return ir.safeParse(t).success;
2191
- }
2192
- const or = e.object({
2193
- network: e.string(),
2194
- hash: e.string(),
2195
- status: e.string(),
2196
- blockNumber: e.number().optional(),
2197
- transactionIndex: e.number()
2198
- }), Ce = e.object({
2199
- type: e.enum(["token", "nft"]),
2200
- tokenAddress: H,
2201
- amount: e.string().optional(),
2202
- fiatAmount: e.object({
2203
- currency: e.string(),
2204
- currencyAmount: e.number()
2205
- }).optional().nullable()
2206
- }), At = e.enum(["ethereum", "starknet", "zksync", "zksync2"]), ua = e.object({
2207
- type: e.enum(["payment", "gasFee"]),
2208
- leg: e.enum(["credit", "debit"]),
2209
- asset: Ce,
2210
- counterParty: H.optional(),
2211
- counterPartyNetwork: At.optional()
2212
- }), fa = e.object({
2213
- address: H,
2214
- network: At,
2215
- type: e.enum(["wallet", "token"])
2216
- }), pa = e.object({
2217
- chainId: e.enum(["TESTNET", "MAINNET", "SEPOLIA"]),
2218
- ethereumNetwork: e.enum(["mainnet", "sepolia"])
2219
- }), ha = e.enum([
2220
- "approval",
2221
- "changePubKey",
2222
- "dappInteraction",
2223
- "deploy",
2224
- "gift",
2225
- "multicall",
2226
- "payment",
2227
- "security",
2228
- "trade"
2229
- ]), cr = e.enum([
2230
- "triggerEscapeGuardian",
2231
- "triggerEscapeSigner",
2232
- "escapeGuardian",
2233
- "escapeSigner",
2234
- "guardianChanged",
2235
- "guardianBackupChanged",
2236
- "signerChanged",
2237
- "cancelEscape",
2238
- "accountUpgraded",
2239
- "multisigConfigurationUpdated"
2240
- ]), ma = e.object({
2241
- name: e.string(),
2242
- parameters: e.array(e.unknown()).optional()
2243
- }), da = e.object({
2244
- guid: e.string().optional(),
2245
- signerType: e.string().optional(),
2246
- // StarknetKey, Secp256k1, Secp256r1, Eip191, Webauthn
2247
- signer: e.object({
2248
- publicKey: e.string().optional()
2249
- }).optional()
2250
- }), ga = e.object({
2251
- activeAt: e.string().optional(),
2252
- newGuardian: e.string().optional(),
2253
- newImplementation: e.string().optional(),
2254
- newVersion: e.string().optional(),
2255
- signerGuid: e.string().optional(),
2256
- signers: e.array(da).optional()
2257
- }), Ct = e.discriminatedUnion("type", [
2258
- e.object({
2259
- type: e.literal("deploy"),
2260
- deployer: H,
2261
- contractAddress: H
2262
- }),
2263
- e.object({
2264
- type: e.literal("approval"),
2265
- spender: H,
2266
- asset: Ce,
2267
- approvalType: e.string()
2268
- }),
2269
- e.object({
2270
- type: e.literal("payment"),
2271
- counterparty: H,
2272
- leg: e.string(),
2273
- asset: Ce,
2274
- counterpartyNetwork: At.optional()
2275
- }),
2276
- e.object({
2277
- type: e.literal("trade"),
2278
- srcAsset: Ce,
2279
- destAsset: Ce
2280
- }),
2281
- e.object({
2282
- type: e.literal("security"),
2283
- action: cr,
2284
- context: ga.optional()
2285
- }),
2286
- e.object({
2287
- type: e.literal("dappInteraction"),
2288
- dappAddress: H,
2289
- function: ma.optional().nullable()
2290
- // This object is often null. It happens when we were unable to get the ABI or failed decoding the function call
2291
- })
2292
- ]), Ea = e.union([
2293
- Ct,
2294
- e.object({
2295
- type: e.literal("multicall"),
2296
- calls: e.array(e.object({
2297
- details: Ct
2298
- }))
2299
- })
2300
- ]), Ia = e.object({
2301
- dappId: e.string(),
2302
- name: e.string().optional().nullable()
2303
- }), lr = e.object({
2304
- sent: e.boolean(),
2305
- asset: e.discriminatedUnion("type", [
2306
- e.object({
2307
- type: e.literal("nft"),
2308
- tokenAddress: H,
2309
- tokenId: e.coerce.number().optional(),
2310
- amount: e.string().optional(),
2311
- collectionName: e.string().optional(),
2312
- collectionPreviewImage: e.string().optional().nullable(),
2313
- nftName: e.string().optional().nullable(),
2314
- nftPreviewImage: e.string().optional().nullable()
2315
- }),
2316
- e.object({
2317
- type: e.literal("token"),
2318
- tokenAddress: H,
2319
- amount: e.string().optional(),
2320
- fiatAmount: e.object({
2321
- currency: e.string(),
2322
- currencyAmount: e.coerce.string()
2323
- }).optional().nullable()
2324
- })
2325
- ])
2326
- }), Aa = e.object({
2327
- type: e.string(),
2328
- // "gas" for example
2329
- to: H,
2330
- actualFee: e.object({
2331
- type: e.string(),
2332
- tokenAddress: H,
2333
- amount: e.string().optional(),
2334
- fiatAmount: e.object({
2335
- currency: e.string(),
2336
- currencyAmount: e.number()
2337
- }).optional().nullable()
2338
- })
2339
- }), ur = e.enum(["pending", "success", "failure"]), fr = e.object({
2340
- compositeId: e.string(),
2341
- id: e.string().uuid(),
2342
- status: ur,
2343
- wallet: H,
2344
- txSender: H,
2345
- source: e.string(),
2346
- type: ha,
2347
- group: e.enum(["finance", "security"]),
2348
- submitted: e.number(),
2349
- lastModified: e.number(),
2350
- transaction: or,
2351
- transfers: e.array(ua),
2352
- // to be clarified
2353
- fees: e.array(Aa).optional(),
2354
- relatedAddresses: e.array(fa).nullable(),
2355
- network: e.string(),
2356
- networkDetails: pa.optional(),
2357
- details: Ea,
2358
- transferSummary: e.array(lr).optional(),
2359
- dapp: Ia.optional(),
2360
- actions: e.array(Qt).optional(),
2361
- title: e.string().optional(),
2362
- multisigDetails: e.object({
2363
- signers: e.array(H)
2364
- }).optional()
2365
- }), Na = e.object({
2366
- title: e.string().optional(),
2367
- shortTitle: e.string().optional(),
2368
- subtitle: e.string().optional(),
2369
- /** let's not import the keys from x-ui here */
2370
- icon: e.string().optional()
2371
- }), Sa = "native", ba = "rejected", Ta = "cancelled", ya = "queued", ns = fr.pick({
2372
- status: !0,
2373
- actions: !0,
2374
- submitted: !0,
2375
- lastModified: !0,
2376
- transferSummary: !0,
2377
- fees: !0,
2378
- multisigDetails: !0
2379
- }).extend({
2380
- status: e.union([
2381
- ur,
2382
- e.enum([
2383
- ba,
2384
- Ta,
2385
- ya
2386
- ])
2387
- ]),
2388
- type: e.literal(Sa),
2389
- transaction: or.pick({
2390
- hash: !0
2391
- }),
2392
- dapp: tr.optional(),
2393
- meta: Na.optional()
2394
- }), Ra = e.array(fr), as = e.object({
2395
- activities: Ra,
2396
- page: e.number(),
2397
- pageSize: e.number(),
2398
- totalElements: e.number(),
2399
- totalPages: e.number()
2400
- });
2401
- function is(t) {
2402
- return cr.safeParse(t).success;
2403
- }
2404
- const pr = (t) => lr.safeParse(t).success, ss = (t) => pr(t) && t.asset.type === "token", os = (t) => pr(t) && t.asset.type === "nft", Dt = {
2405
- Transfer: Nt.getSelectorFromName("Transfer"),
2406
- // 0x99cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9
2407
- Approval: Nt.getSelectorFromName("Approval")
2408
- // 0x134692b230b9e1ffa39098904722134159652b09c5bc41d88d6698779d228ff
2409
- }, va = (t, o, E) => {
2410
- for (const T of t) {
2411
- const { events: N, internal_calls: D } = T;
2412
- for (const w of N)
2413
- for (const k of w.keys)
2414
- k === Dt.Approval && o.push({
2415
- tokenAddress: K.parse(T.contract_address),
2416
- owner: w.data[0],
2417
- spender: w.data[1],
2418
- value: Qe.uint256ToBN({ low: w.data[2], high: w.data[3] }).toString()
2419
- }), k === Dt.Transfer && E.push({
2420
- tokenAddress: K.parse(T.contract_address),
2421
- from: w.data[0],
2422
- to: w.data[1],
2423
- value: Qe.uint256ToBN({ low: w.data[2], high: w.data[3] }).toString()
2424
- });
2425
- D && va(D, o, E);
2426
- }
2427
- return { approvals: o, transfers: E };
2428
- }, Oa = /(0x[a-fA-F0-9]+)\s*\('(.*?)'\)/, cs = (t) => {
2429
- if (!Ur(t))
2430
- return;
2431
- const o = t.match(Oa);
2432
- if (o && !Fr(o[2]))
2433
- return o[2];
2434
- };
2435
- var pt;
2436
- (function(t) {
2437
- t.SIMULATE_AND_REVIEW_FAILED = "Something went wrong fetching review", t.NO_CALLS_FOUND = "No calls found", t.ONCHAIN_FEE_ESTIMATION_FAILED = "Failed to estimate fees onchain";
2438
- })(pt || (pt = {}));
2439
- class ls extends we {
2440
- constructor(o) {
2441
- super(o, pt), this.name = "ReviewError";
2442
- }
2443
- }
2444
- const us = e.object({
2445
- reason: e.string(),
2446
- severity: e.string().optional(),
2447
- title: e.string(),
2448
- description: e.string().optional()
2449
- }), wa = Object.values(xe.TRANSACTION_VERSION), fs = e.string().default("0x3").refine((t) => {
2450
- const o = be.toBigInt(t);
2451
- return wa.map((E) => be.toBigInt(E)).includes(o);
2452
- }).transform((t) => be.toHex(t));
2453
- function ps(t) {
2454
- if (t === xe.TRANSACTION_VERSION.V3 || t === xe.TRANSACTION_VERSION.F3)
2455
- throw Error("Only txv1 is supported");
2456
- }
2457
- export {
2458
- Ba as $,
2459
- ke as A,
2460
- yi as B,
2461
- ai as C,
2462
- Fi as D,
2463
- ki as E,
2464
- Gi as F,
2465
- Ya as G,
2466
- dt as H,
2467
- Ka as I,
2468
- di as J,
2469
- sa as K,
2470
- Zi as L,
2471
- Tt as M,
2472
- ii as N,
2473
- Wn as O,
2474
- Qi as P,
2475
- rs as Q,
2476
- ls as R,
2477
- ti as S,
2478
- ji as T,
2479
- jt as U,
2480
- $r as V,
2481
- Ve as W,
2482
- Xr as X,
2483
- Hr as Y,
2484
- Fa as Z,
2485
- xa as _,
2486
- St as a,
2487
- fs as a$,
2488
- Ma as a0,
2489
- Ga as a1,
2490
- Va as a2,
2491
- mt as a3,
2492
- Xa as a4,
2493
- Ha as a5,
2494
- za as a6,
2495
- qa as a7,
2496
- Wa as a8,
2497
- $a as a9,
2498
- Vi as aA,
2499
- Yt as aB,
2500
- $i as aC,
2501
- Xi as aD,
2502
- Zt as aE,
2503
- Hi as aF,
2504
- xn as aG,
2505
- Bn as aH,
2506
- Mn as aI,
2507
- Gn as aJ,
2508
- zi as aK,
2509
- $t as aL,
2510
- Vn as aM,
2511
- qi as aN,
2512
- $n as aO,
2513
- Xn as aP,
2514
- Wi as aQ,
2515
- Hn as aR,
2516
- Ki as aS,
2517
- Jt as aT,
2518
- Yi as aU,
2519
- ft as aV,
2520
- Ji as aW,
2521
- Dt as aX,
2522
- va as aY,
2523
- cs as aZ,
2524
- us as a_,
2525
- Zr as aa,
2526
- Xe as ab,
2527
- Qr as ac,
2528
- et as ad,
2529
- rn as ae,
2530
- Za as af,
2531
- Ja as ag,
2532
- Qa as ah,
2533
- ei as ai,
2534
- ri as aj,
2535
- tn as ak,
2536
- tt as al,
2537
- we as am,
2538
- ut as an,
2539
- Pe as ao,
2540
- Xt as ap,
2541
- xi as aq,
2542
- vt as ar,
2543
- zt as as,
2544
- Bi as at,
2545
- qt as au,
2546
- Mi as av,
2547
- Dn as aw,
2548
- Pn as ax,
2549
- jn as ay,
2550
- kn as az,
2551
- qr as b,
2552
- Na as b$,
2553
- ps as b0,
2554
- Ti as b1,
2555
- pn as b2,
2556
- Ri as b3,
2557
- vi as b4,
2558
- De as b5,
2559
- sn as b6,
2560
- on as b7,
2561
- cn as b8,
2562
- Be as b9,
2563
- Tn as bA,
2564
- xt as bB,
2565
- yn as bC,
2566
- Bt as bD,
2567
- Rn as bE,
2568
- Ze as bF,
2569
- vn as bG,
2570
- On as bH,
2571
- wn as bI,
2572
- _n as bJ,
2573
- wi as bK,
2574
- _i as bL,
2575
- Gt as bM,
2576
- Li as bN,
2577
- Ci as bO,
2578
- Vt as bP,
2579
- Di as bQ,
2580
- Pi as bR,
2581
- pr as bS,
2582
- lr as bT,
2583
- Sa as bU,
2584
- ns as bV,
2585
- ua as bW,
2586
- Ea as bX,
2587
- Ia as bY,
2588
- Aa as bZ,
2589
- fr as b_,
2590
- ln as ba,
2591
- gt as bb,
2592
- un as bc,
2593
- fn as bd,
2594
- he as be,
2595
- si as bf,
2596
- oi as bg,
2597
- ci as bh,
2598
- li as bi,
2599
- ui as bj,
2600
- fi as bk,
2601
- pi as bl,
2602
- hi as bm,
2603
- mi as bn,
2604
- Ut as bo,
2605
- Ye as bp,
2606
- Ft as bq,
2607
- Oi as br,
2608
- En as bs,
2609
- ct as bt,
2610
- In as bu,
2611
- An as bv,
2612
- lt as bw,
2613
- Nn as bx,
2614
- Sn as by,
2615
- bn as bz,
2616
- bt as c,
2617
- ba as c0,
2618
- Ta as c1,
2619
- ya as c2,
2620
- Ra as c3,
2621
- as as c4,
2622
- is as c5,
2623
- ss as c6,
2624
- os as c7,
2625
- wt as c8,
2626
- Yn as c9,
2627
- _t as ca,
2628
- Qt as cb,
2629
- ea as cc,
2630
- ta as cd,
2631
- er as ce,
2632
- ra as cf,
2633
- tr as cg,
2634
- es as ch,
2635
- ts as ci,
2636
- Zn as cj,
2637
- Jn as ck,
2638
- zr as d,
2639
- en as e,
2640
- Jr as f,
2641
- ni as g,
2642
- Kr as h,
2643
- Yr as i,
2644
- gi as j,
2645
- Ni as k,
2646
- Ai as l,
2647
- Ei as m,
2648
- $e as n,
2649
- Ii as o,
2650
- Vr as p,
2651
- H as q,
2652
- ht as r,
2653
- Si as s,
2654
- K as t,
2655
- an as u,
2656
- bi as v,
2657
- Me as w,
2658
- Ln as x,
2659
- mn as y,
2660
- Ui as z
2661
- };