@argent/x-shared 1.34.6 → 1.36.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.
- package/dist/bips-CP71ZN9a.js +1 -0
- package/dist/bips-zBtnMbia.mjs +114 -0
- package/dist/chains/starknet/address.d.ts +2 -2
- package/dist/errors/swap.d.ts +12 -0
- package/dist/features/swap/index.d.ts +3 -0
- package/dist/features/swap/models/index.d.ts +3 -0
- package/dist/features/swap/models/order.model.d.ts +48 -0
- package/dist/features/swap/models/quote.model.d.ts +82 -0
- package/dist/features/swap/models/trade.model.d.ts +186 -0
- package/dist/features/swap/services/implementation.d.ts +14 -0
- package/dist/features/swap/services/index.d.ts +2 -0
- package/dist/features/swap/services/interface.d.ts +8 -0
- package/dist/features/swap/services/order.mock.d.ts +7 -0
- package/dist/features/swap/services/quote.mock.d.ts +29 -0
- package/dist/features/swap/tests/token.mock.d.ts +2 -0
- package/dist/features/swap/tests/trade.mock.d.ts +2 -0
- package/dist/features/swap/tests/walletAccount.mock.d.ts +43 -0
- package/dist/features/swap/utils/index.d.ts +2 -0
- package/dist/features/swap/utils/slippage.d.ts +16 -0
- package/dist/features/swap/utils/totalFee.d.ts +5 -0
- package/dist/index.js +2 -2
- package/dist/index.mjs +1325 -1382
- package/dist/simulation.js +1 -1
- package/dist/simulation.mjs +81 -80
- package/dist/swap.d.ts +2 -0
- package/dist/swap.js +1 -0
- package/dist/swap.mjs +183 -0
- package/dist/tokens/getCurrencySymbol.d.ts +2 -0
- package/dist/tokens/index.d.ts +1 -0
- package/dist/transactionVersion-CACUj2ch.mjs +793 -0
- package/dist/transactionVersion-CaRQ5Df4.js +1 -0
- package/dist/utils/bips.d.ts +7 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/webToken.model-Cl4dvcmj.mjs +1881 -0
- package/dist/webToken.model-Dsd8Rd3e.js +1 -0
- package/package.json +12 -5
- package/dist/transactionVersion-CKz-zi84.js +0 -1
- package/dist/transactionVersion-cwkr7wat.mjs +0 -2665
|
@@ -1,2665 +0,0 @@
|
|
|
1
|
-
import { z as e } from "zod";
|
|
2
|
-
import { validateChecksumAddress as Cr, validateAndParseAddress as Dr, getChecksumAddress as Pr, num as Ne, constants as xe, CairoCustomEnum as jr, uint256 as Qe, hash as St } 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 S = E.startsWith("-");
|
|
12
|
-
return S && (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(`${S ? "-" : ""}${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")}`), qr = (t) => K.safeParse(t).success, zr = qr, $e = (t) => Pr(t), xa = (t) => {
|
|
32
|
-
const o = $e(t), E = o.slice(0, 2), T = o.slice(2, 6), S = o.slice(-4);
|
|
33
|
-
return `${E}${T}…${S}`;
|
|
34
|
-
}, Ba = (t) => {
|
|
35
|
-
const o = $e(t), E = o.slice(0, 2), S = o.slice(2).match(/.{1,4}/g) || [];
|
|
36
|
-
return `${E} ${S.join(" ")}`;
|
|
37
|
-
}, Wr = (t) => !/^0x[0-9a-f]{63,64}$/.test(t), Kr = (t, o) => {
|
|
38
|
-
try {
|
|
39
|
-
return !t || !o ? !1 : Ne.hexToDecimalString(t) === Ne.hexToDecimalString(o);
|
|
40
|
-
} catch {
|
|
41
|
-
}
|
|
42
|
-
return !1;
|
|
43
|
-
}, Yr = (t) => {
|
|
44
|
-
try {
|
|
45
|
-
return Ne.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), S = t.slice(-E);
|
|
56
|
-
return `${T}…${S}`;
|
|
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
|
-
]), qa = (t) => mt.safeParse(t).success, za = (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 S = t[T];
|
|
98
|
-
if (typeof S != "string")
|
|
99
|
-
throw new TypeError("Url must be a string. Received " + S);
|
|
100
|
-
S !== "" && (T > 0 && (S = S.replace(/^[\/]+/, "")), T < t.length - 1 ? S = S.replace(/[\/]+$/, "") : S = S.replace(/[\/]+$/, "/"), o.push(S));
|
|
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 = {} }, S) {
|
|
113
|
-
const { error: D, context: w } = T;
|
|
114
|
-
super(E, { cause: D }), this.errorMessages = S, 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 bt;
|
|
138
|
-
(function(t) {
|
|
139
|
-
t.FAILED_TO_FETCH_URL = "Failed to fetch url", t.FAILED_TO_POST_URL = "Failed to post url";
|
|
140
|
-
})(bt || (bt = {}));
|
|
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 S = {
|
|
152
|
-
ens: t,
|
|
153
|
-
chain: T
|
|
154
|
-
}, D = new URLSearchParams(S), 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 (!zr(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
|
-
})), Nt = 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 Si 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, S = 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], b = ee[s][1];
|
|
290
|
-
r = r.split(l + "*").join(l + "{0," + b + "}").split(l + "+").join(l + "{1," + b + "}");
|
|
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 > S || this.major < 0)
|
|
351
|
-
throw new TypeError("Invalid major version");
|
|
352
|
-
if (this.minor > S || this.minor < 0)
|
|
353
|
-
throw new TypeError("Invalid minor version");
|
|
354
|
-
if (this.patch > S || this.patch < 0)
|
|
355
|
-
throw new TypeError("Invalid patch version");
|
|
356
|
-
l[4] ? this.prerelease = l[4].split(".").map(function(b) {
|
|
357
|
-
if (/^[0-9]+$/.test(b)) {
|
|
358
|
-
var y = +b;
|
|
359
|
-
if (y >= 0 && y < S)
|
|
360
|
-
return y;
|
|
361
|
-
}
|
|
362
|
-
return b;
|
|
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], b = r.prerelease[s];
|
|
383
|
-
if (E("prerelease compare", s, l, b), l === void 0 && b === void 0)
|
|
384
|
-
return 0;
|
|
385
|
-
if (b === void 0)
|
|
386
|
-
return 1;
|
|
387
|
-
if (l === void 0)
|
|
388
|
-
return -1;
|
|
389
|
-
if (l === b)
|
|
390
|
-
continue;
|
|
391
|
-
return h(l, b);
|
|
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], b = r.build[s];
|
|
398
|
-
if (E("prerelease compare", s, l, b), l === void 0 && b === void 0)
|
|
399
|
-
return 0;
|
|
400
|
-
if (b === void 0)
|
|
401
|
-
return 1;
|
|
402
|
-
if (l === void 0)
|
|
403
|
-
return -1;
|
|
404
|
-
if (l === b)
|
|
405
|
-
continue;
|
|
406
|
-
return h(l, b);
|
|
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, b) {
|
|
447
|
-
typeof l == "string" && (b = l, l = void 0);
|
|
448
|
-
try {
|
|
449
|
-
return new j(r, l).inc(s, b).version;
|
|
450
|
-
} catch {
|
|
451
|
-
return null;
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
o.diff = a;
|
|
455
|
-
function a(r, s) {
|
|
456
|
-
if (q(r, s))
|
|
457
|
-
return null;
|
|
458
|
-
var l = me(r), b = me(s), y = "";
|
|
459
|
-
if (l.prerelease.length || b.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] !== b[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), b = i.test(s);
|
|
472
|
-
return l && b && (r = +r, s = +s), r === s ? 0 : l && !b ? -1 : b && !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 b = new j(r, l), y = new j(s, l);
|
|
501
|
-
return b.compare(y) || b.compareBuild(y);
|
|
502
|
-
}
|
|
503
|
-
o.rcompare = N;
|
|
504
|
-
function N(r, s, l) {
|
|
505
|
-
return f(s, r, l);
|
|
506
|
-
}
|
|
507
|
-
o.sort = _;
|
|
508
|
-
function _(r, s) {
|
|
509
|
-
return r.sort(function(l, b) {
|
|
510
|
-
return o.compareBuild(l, b, s);
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
|
-
o.rsort = C;
|
|
514
|
-
function C(r, s) {
|
|
515
|
-
return r.sort(function(l, b) {
|
|
516
|
-
return o.compareBuild(b, 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 = q;
|
|
528
|
-
function q(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 = Se;
|
|
544
|
-
function Se(r, s, l, b) {
|
|
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 q(r, l, b);
|
|
554
|
-
case "!=":
|
|
555
|
-
return M(r, l, b);
|
|
556
|
-
case ">":
|
|
557
|
-
return x(r, l, b);
|
|
558
|
-
case ">=":
|
|
559
|
-
return $(r, l, b);
|
|
560
|
-
case "<":
|
|
561
|
-
return X(r, l, b);
|
|
562
|
-
case "<=":
|
|
563
|
-
return W(r, l, b);
|
|
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 Se(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 b = (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 = Se(this.semver, "<", r.semver, s) && (this.operator === ">=" || this.operator === ">") && (r.operator === "<=" || r.operator === "<"), F = Se(this.semver, ">", r.semver, s) && (this.operator === "<=" || this.operator === "<") && (r.operator === ">=" || r.operator === ">");
|
|
613
|
-
return b || 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, Sr), 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 b = 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(b);
|
|
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(b) {
|
|
655
|
-
return Te(b, s) && l.every(function(y) {
|
|
656
|
-
return b.every(function(v) {
|
|
657
|
-
return y.intersects(v, s);
|
|
658
|
-
});
|
|
659
|
-
});
|
|
660
|
-
});
|
|
661
|
-
});
|
|
662
|
-
};
|
|
663
|
-
function Te(r, s) {
|
|
664
|
-
for (var l = !0, b = r.slice(), y = b.pop(); l && b.length; )
|
|
665
|
-
l = b.every(function(v) {
|
|
666
|
-
return y.intersects(v, s);
|
|
667
|
-
}), y = b.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(b) {
|
|
674
|
-
return b.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(b, y, v, O, V) {
|
|
692
|
-
E("tilde", r, b, 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(b, y, v, O, V) {
|
|
706
|
-
E("caret", r, b, 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(b, y, v, O, V, F) {
|
|
720
|
-
E("xRange", r, b, 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 === "<" ? b = "<0.0.0-0" : b = "*" : 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), b = y + v + "." + O + "." + V + F) : Ee ? b = ">=" + v + ".0.0" + F + " <" + (+v + 1) + ".0.0" + F : se && (b = ">=" + v + "." + O + ".0" + F + " <" + v + "." + (+O + 1) + ".0" + F), E("xRange return", b), b;
|
|
723
|
-
});
|
|
724
|
-
}
|
|
725
|
-
function Ar(r, s) {
|
|
726
|
-
return E("replaceStars", r, s), r.trim().replace(L[d.STAR], "");
|
|
727
|
-
}
|
|
728
|
-
function Sr(r, s, l, b, y, v, O, V, F, ge, Ee, se, ie) {
|
|
729
|
-
return B(l) ? s = "" : B(b) ? s = ">=" + l + ".0.0" : B(y) ? s = ">=" + l + "." + b + ".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 (br(this.set[s], r, this.options))
|
|
742
|
-
return !0;
|
|
743
|
-
return !1;
|
|
744
|
-
};
|
|
745
|
-
function br(r, s, l) {
|
|
746
|
-
for (var b = 0; b < r.length; b++)
|
|
747
|
-
if (!r[b].test(s))
|
|
748
|
-
return !1;
|
|
749
|
-
if (s.prerelease.length && !l.includePrerelease) {
|
|
750
|
-
for (b = 0; b < r.length; b++)
|
|
751
|
-
if (E(r[b].semver), r[b].semver !== de && r[b].semver.prerelease.length > 0) {
|
|
752
|
-
var y = r[b].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 = Nr;
|
|
770
|
-
function Nr(r, s, l) {
|
|
771
|
-
var b = 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) && (!b || y.compare(O) === -1) && (b = O, y = new j(b, l));
|
|
779
|
-
}), b;
|
|
780
|
-
}
|
|
781
|
-
o.minSatisfying = Tr;
|
|
782
|
-
function Tr(r, s, l) {
|
|
783
|
-
var b = 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) && (!b || y.compare(O) === 1) && (b = O, y = new j(b, l));
|
|
791
|
-
}), b;
|
|
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 b = 0; b < r.set.length; ++b) {
|
|
801
|
-
var y = r.set[b];
|
|
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 qe(r, s, "<", l);
|
|
832
|
-
}
|
|
833
|
-
o.gtr = Or;
|
|
834
|
-
function Or(r, s, l) {
|
|
835
|
-
return qe(r, s, ">", l);
|
|
836
|
-
}
|
|
837
|
-
o.outside = qe;
|
|
838
|
-
function qe(r, s, l, b) {
|
|
839
|
-
r = new j(r, b), s = new G(s, b);
|
|
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, b))
|
|
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, b) ? se = ye : O(ye.semver, ie.semver, b) && (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 b; (b = L[d.COERCERTL].exec(r)) && (!l || l.index + l[0].length !== r.length); )
|
|
885
|
-
(!l || b.index + b[0].length !== l.index + l[0].length) && (l = b), L[d.COERCERTL].lastIndex = b.index + b[1].length + b[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 bi = /* @__PURE__ */ mn(dn), Ni = (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, ze = 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, S = 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 (z(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], z(i, 0, Z, a), w = i), n.hasOwnProperty(a = "ROUNDING_MODE") && (i = n[a], z(i, 0, 8, a), k = i), n.hasOwnProperty(a = "EXPONENTIAL_AT") && (i = n[a], i && i.pop ? (z(i[0], -Z, 0, a), z(i[1], 0, Z, a), L = i[0], A = i[1]) : (z(i, -Z, Z, a), L = -(A = i < 0 ? -i : i))), n.hasOwnProperty(a = "RANGE"))
|
|
979
|
-
if (i = n[a], i && i.pop)
|
|
980
|
-
z(i[0], -Z, -1, a), z(i[1], 1, Z, a), d = i[0], Y = i[1];
|
|
981
|
-
else if (z(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], z(i, 0, 9, a), fe = i), n.hasOwnProperty(a = "POW_PRECISION") && (i = n[a], z(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 : z(i, 0, Z), I = ze(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, N, _, C, x, X = i.indexOf("."), q = 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
|
-
be(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, q, M, u), C = _.c, N = _.r, g = _.e), f = g + q + 1, X = C[f], m = u / 2, N = N || f < 0 || C[f + 1] != null, N = M < 4 ? (X != null || N) && (M == 0 || M == (_.s < 0 ? 3 : 2)) : X > m || X == m && (M == 4 || N || M == 6 && C[f - 1] & 1 || M == (_.s < 0 ? 8 : 7)), f < 1 || !C[0])
|
|
1095
|
-
i = N ? be(c.charAt(1), -q, c.charAt(0)) : c.charAt(0);
|
|
1096
|
-
else {
|
|
1097
|
-
if (C.length = f, N)
|
|
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 = be(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, N = h.length, _ = u % Re, C = u / Re | 0;
|
|
1109
|
-
for (h = h.slice(); N--; )
|
|
1110
|
-
f = h[N] % Re, g = h[N] / Re | 0, I = C * f + g * _, c = _ * f + I % Re * Re + m, m = (c / p | 0) + (I / Re | 0) + C * g, h[N] = 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, N, _, C, x, X, q, M, $, W, Se, 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), q = 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
|
-
q.push(1), N = !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), Se = 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
|
-
q[m++] = _, M[0] ? M[$++] = J[Se] || 0 : (M = [J[Se]], $ = 1);
|
|
1158
|
-
} while ((Se++ < Q || M[0] != null) && re--);
|
|
1159
|
-
N = M[0] != null, q[0] || q.splice(0, 1);
|
|
1160
|
-
}
|
|
1161
|
-
if (c == pe) {
|
|
1162
|
-
for (m = 1, re = q[0]; re >= 10; re /= 10, m++) ;
|
|
1163
|
-
te(X, p + (X.e = m + g * U - 1) + 1, I, N);
|
|
1164
|
-
} else
|
|
1165
|
-
X.e = g, X.r = +N;
|
|
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 : z(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) : be(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 = be(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(N, _, C) {
|
|
1201
|
-
return g = (C = C.toLowerCase()) == "x" ? 16 : C == "b" ? 2 : 8, !f || f == g ? _ : N;
|
|
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, N = n.c, _ = Ke;
|
|
1213
|
-
if (N) {
|
|
1214
|
-
e: {
|
|
1215
|
-
for (u = 1, c = N[0]; c >= 10; c /= 10, u++) ;
|
|
1216
|
-
if (p = a - u, p < 0)
|
|
1217
|
-
p += U, I = a, f = N[g = 0], m = ce(f / _[u - I - 1] % 10);
|
|
1218
|
-
else if (g = ze((p + 1) / U), g >= N.length)
|
|
1219
|
-
if (h) {
|
|
1220
|
-
for (; N.length <= g; N.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 = N[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
|
-
N[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 : N[g - 1]) % 10 & 1 || i == (n.s < 0 ? 8 : 7)), a < 1 || !N[0])
|
|
1233
|
-
return N.length = 0, h ? (a -= n.e + 1, N[0] = _[(U - a % U) % U], n.e = -a || 0) : N[0] = n.e = 0, n;
|
|
1234
|
-
if (p == 0 ? (N.length = g, c = 1, g--) : (N.length = g + 1, c = _[U - p], N[g] = I > 0 ? ce(f / _[u - I] % _[I]) * c : 0), h)
|
|
1235
|
-
for (; ; )
|
|
1236
|
-
if (g == 0) {
|
|
1237
|
-
for (p = 1, I = N[0]; I >= 10; I /= 10, p++) ;
|
|
1238
|
-
for (I = N[0] += c, c = 1; I >= 10; I /= 10, c++) ;
|
|
1239
|
-
p != c && (n.e++, N[0] == pe && (N[0] = 1));
|
|
1240
|
-
break;
|
|
1241
|
-
} else {
|
|
1242
|
-
if (N[g] += c, N[g] != pe) break;
|
|
1243
|
-
N[g--] = 0, c = 1;
|
|
1244
|
-
}
|
|
1245
|
-
for (p = N.length; N[--p] === 0; N.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) : be(a, i, "0"), n.s < 0 ? "-" + a : a);
|
|
1254
|
-
}
|
|
1255
|
-
return S.absoluteValue = S.abs = function() {
|
|
1256
|
-
var n = new R(this);
|
|
1257
|
-
return n.s < 0 && (n.s = 1), n;
|
|
1258
|
-
}, S.comparedTo = function(n, a) {
|
|
1259
|
-
return Oe(this, new R(n, a));
|
|
1260
|
-
}, S.decimalPlaces = S.dp = function(n, a) {
|
|
1261
|
-
var i, h, u, p = this;
|
|
1262
|
-
if (n != null)
|
|
1263
|
-
return z(n, 0, Z), a == null ? a = k : z(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
|
-
}, S.dividedBy = S.div = function(n, a) {
|
|
1268
|
-
return o(this, new R(n, a), w, k);
|
|
1269
|
-
}, S.dividedToIntegerBy = S.idiv = function(n, a) {
|
|
1270
|
-
return o(this, new R(n, a), 0, 1);
|
|
1271
|
-
}, S.exponentiatedBy = S.pow = function(n, a) {
|
|
1272
|
-
var i, h, u, p, I, c, f, g, m, N = 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, !N.c || !N.c[0] || N.c[0] == 1 && !N.e && N.c.length == 1 || !n.c || !n.c[0])
|
|
1276
|
-
return m = new R(Math.pow(+j(N), 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 && N.isInteger() && a.isInteger(), h && (N = N.mod(a));
|
|
1280
|
-
} else {
|
|
1281
|
-
if (n.e > 9 && (N.e > 0 || N.e < -1 || (N.e == 0 ? N.c[0] > 1 || c && N.c[1] >= 24e7 : N.c[0] < 8e13 || c && N.c[0] <= 9999975e7)))
|
|
1282
|
-
return p = N.s < 0 && Ue(n) ? -0 : 0, N.e > -1 && (p = 1 / p), new R(f ? 1 / p : p);
|
|
1283
|
-
ee && (p = ze(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(N), !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
|
-
N = N.times(N), p ? N.c && N.c.length > p && (N.c.length = p) : h && (N = N.mod(a));
|
|
1300
|
-
}
|
|
1301
|
-
return h ? m : (f && (m = D.div(m)), a ? m.mod(a) : p ? te(m, ee, k, I) : m);
|
|
1302
|
-
}, S.integerValue = function(n) {
|
|
1303
|
-
var a = new R(this);
|
|
1304
|
-
return n == null ? n = k : z(n, 0, 8), te(a, a.e + 1, n);
|
|
1305
|
-
}, S.isEqualTo = S.eq = function(n, a) {
|
|
1306
|
-
return Oe(this, new R(n, a)) === 0;
|
|
1307
|
-
}, S.isFinite = function() {
|
|
1308
|
-
return !!this.c;
|
|
1309
|
-
}, S.isGreaterThan = S.gt = function(n, a) {
|
|
1310
|
-
return Oe(this, new R(n, a)) > 0;
|
|
1311
|
-
}, S.isGreaterThanOrEqualTo = S.gte = function(n, a) {
|
|
1312
|
-
return (a = Oe(this, new R(n, a))) === 1 || a === 0;
|
|
1313
|
-
}, S.isInteger = function() {
|
|
1314
|
-
return !!this.c && le(this.e / U) > this.c.length - 2;
|
|
1315
|
-
}, S.isLessThan = S.lt = function(n, a) {
|
|
1316
|
-
return Oe(this, new R(n, a)) < 0;
|
|
1317
|
-
}, S.isLessThanOrEqualTo = S.lte = function(n, a) {
|
|
1318
|
-
return (a = Oe(this, new R(n, a))) === -1 || a === 0;
|
|
1319
|
-
}, S.isNaN = function() {
|
|
1320
|
-
return !this.s;
|
|
1321
|
-
}, S.isNegative = function() {
|
|
1322
|
-
return this.s < 0;
|
|
1323
|
-
}, S.isPositive = function() {
|
|
1324
|
-
return this.s > 0;
|
|
1325
|
-
}, S.isZero = function() {
|
|
1326
|
-
return !!this.c && this.c[0] == 0;
|
|
1327
|
-
}, S.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, N = n.c;
|
|
1333
|
-
if (!f || !g) {
|
|
1334
|
-
if (!m || !N) return m ? (n.s = -a, n) : new R(N ? I : NaN);
|
|
1335
|
-
if (!m[0] || !N[0])
|
|
1336
|
-
return N[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 = N), u.reverse(), a = c; a--; u.push(0)) ;
|
|
1343
|
-
u.reverse();
|
|
1344
|
-
} else
|
|
1345
|
-
for (h = (p = (c = m.length) < (a = N.length)) ? c : a, c = a = 0; a < h; a++)
|
|
1346
|
-
if (m[a] != N[a]) {
|
|
1347
|
-
p = m[a] < N[a];
|
|
1348
|
-
break;
|
|
1349
|
-
}
|
|
1350
|
-
if (p && (u = m, m = N, N = u, n.s = -n.s), a = (h = N.length) - (i = m.length), a > 0) for (; a--; m[i++] = 0) ;
|
|
1351
|
-
for (a = pe - 1; h > c; ) {
|
|
1352
|
-
if (m[--h] < N[h]) {
|
|
1353
|
-
for (i = h; i && !m[--i]; m[i] = a) ;
|
|
1354
|
-
--m[i], m[h] += pe;
|
|
1355
|
-
}
|
|
1356
|
-
m[h] -= N[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
|
-
}, S.modulo = S.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
|
-
}, S.multipliedBy = S.times = function(n, a) {
|
|
1364
|
-
var i, h, u, p, I, c, f, g, m, N, _, C, x, X, q, 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, N = W.length, f < N && (x = $, $ = W, W = x, u = f, f = N, N = u), u = f + N, x = []; u--; x.push(0)) ;
|
|
1368
|
-
for (X = pe, q = Re, u = N; --u >= 0; ) {
|
|
1369
|
-
for (i = 0, _ = W[u] % q, C = W[u] / q | 0, I = f, p = u + I; p > u; )
|
|
1370
|
-
g = $[--I] % q, m = $[I] / q | 0, c = C * g + m * _, g = _ * g + c % q * q + x[p] + i, i = (g / X | 0) + (c / q | 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
|
-
}, S.negated = function() {
|
|
1375
|
-
var n = new R(this);
|
|
1376
|
-
return n.s = -n.s || null, n;
|
|
1377
|
-
}, S.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
|
-
}, S.precision = S.sd = function(n, a) {
|
|
1395
|
-
var i, h, u, p = this;
|
|
1396
|
-
if (n != null && n !== !!n)
|
|
1397
|
-
return z(n, 1, Z), a == null ? a = k : z(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
|
-
}, S.shiftedBy = function(n) {
|
|
1405
|
-
return z(n, -We, We), this.times("1e" + n);
|
|
1406
|
-
}, S.squareRoot = S.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
|
-
}, S.toExponential = function(n, a) {
|
|
1426
|
-
return n != null && (z(n, 0, Z), n++), ae(this, n, a, 1);
|
|
1427
|
-
}, S.toFixed = function(n, a) {
|
|
1428
|
-
return n != null && (z(n, 0, Z), n = n + this.e + 1), ae(this, n, a);
|
|
1429
|
-
}, S.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], N = 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 = N ? m + (i.decimalSeparator || "") + ((f = +i.fractionGroupSize) ? N.replace(
|
|
1442
|
-
new RegExp("\\d{" + f + "}\\B", "g"),
|
|
1443
|
-
"$&" + (i.fractionGroupSeparator || "")
|
|
1444
|
-
) : N) : m;
|
|
1445
|
-
}
|
|
1446
|
-
return (i.prefix || "") + h + (i.suffix || "");
|
|
1447
|
-
}, S.toFraction = function(n) {
|
|
1448
|
-
var a, i, h, u, p, I, c, f, g, m, N, _, 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, N = 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, N;
|
|
1457
|
-
}, S.toNumber = function() {
|
|
1458
|
-
return +j(this);
|
|
1459
|
-
}, S.toPrecision = function(n, a) {
|
|
1460
|
-
return n != null && z(n, 1, Z), ae(this, n, a, 2);
|
|
1461
|
-
}, S.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) : be(oe(i.c), u, "0") : n === 10 && _e ? (i = te(new R(i), w + u + 1, k), a = be(oe(i.c), i.e, "0")) : (z(n, 2, Ae.length, "Base"), a = E(be(oe(i.c), u, "0"), 10, n, h, !0)), h < 0 && i.c[0] && (a = "-" + a)), a;
|
|
1464
|
-
}, S.valueOf = S.toJSON = function() {
|
|
1465
|
-
return j(this);
|
|
1466
|
-
}, S._isBigNumber = !0, S[Symbol.toStringTag] = "BigNumber", S[Symbol.for("nodejs.util.inspect.custom")] = S.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, S = t.length, D = t[0] + ""; T < S; ) {
|
|
1474
|
-
for (o = t[T++] + "", E = U - o.length; E--; o = "0" + o) ;
|
|
1475
|
-
D += o;
|
|
1476
|
-
}
|
|
1477
|
-
for (S = D.length; D.charCodeAt(--S) === 48; ) ;
|
|
1478
|
-
return D.slice(0, S + 1 || 1);
|
|
1479
|
-
}
|
|
1480
|
-
function Oe(t, o) {
|
|
1481
|
-
var E, T, S = 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 = S && !S[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, !S || !D) return T ? 0 : !S ^ E ? 1 : -1;
|
|
1486
|
-
if (!T) return L > A ^ E ? 1 : -1;
|
|
1487
|
-
for (k = (L = S.length) < (A = D.length) ? L : A, w = 0; w < k; w++) if (S[w] != D[w]) return S[w] > D[w] ^ E ? 1 : -1;
|
|
1488
|
-
return L == A ? 0 : L > A ^ E ? 1 : -1;
|
|
1489
|
-
}
|
|
1490
|
-
function z(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 be(t, o, E) {
|
|
1502
|
-
var T, S;
|
|
1503
|
-
if (o < 0) {
|
|
1504
|
-
for (S = E + "."; ++o; S += E) ;
|
|
1505
|
-
t = S + t;
|
|
1506
|
-
} else if (T = t.length, ++o > T) {
|
|
1507
|
-
for (S = E, o -= T; --o; S += E) ;
|
|
1508
|
-
t += S;
|
|
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
|
-
}), Sn = e.object({
|
|
1544
|
-
name: e.string(),
|
|
1545
|
-
type: e.literal("event"),
|
|
1546
|
-
data: e.array(lt),
|
|
1547
|
-
keys: e.array(lt)
|
|
1548
|
-
}), bn = e.object({
|
|
1549
|
-
name: e.string(),
|
|
1550
|
-
members: e.array(lt),
|
|
1551
|
-
kind: e.literal("struct"),
|
|
1552
|
-
type: e.literal("event")
|
|
1553
|
-
}), Nn = 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([bn, Sn]), xt = e.array(e.union([An, Tn, Nn, 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 S = this._errors[T], D = S.message, w = (t[D] || 0) + 1;
|
|
1671
|
-
t[D] = w, w >= E && (o = S, 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 S in E)
|
|
1695
|
-
T[S] = E[S];
|
|
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 S = T.randomize ? Math.random() + 1 : 1, D = Math.round(S * 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, S) {
|
|
1707
|
-
if (T instanceof Array && (S = T, T = null), !S) {
|
|
1708
|
-
S = [];
|
|
1709
|
-
for (var D in E)
|
|
1710
|
-
typeof E[D] == "function" && S.push(D);
|
|
1711
|
-
}
|
|
1712
|
-
for (var w = 0; w < S.length; w++) {
|
|
1713
|
-
var k = S[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
|
-
}), qt = 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(qt), zt = 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(zt), Dn = e.array(qt.or(zt)), 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: "WebBaseToken is required" }), $i = He.required().extend({
|
|
1837
|
-
balance: e.string()
|
|
1838
|
-
}), Wt = He.required().extend({
|
|
1839
|
-
id: e.number().optional(),
|
|
1840
|
-
name: e.string().optional(),
|
|
1841
|
-
symbol: e.string().optional(),
|
|
1842
|
-
decimals: e.coerce.number().optional(),
|
|
1843
|
-
iconUrl: e.string().url("").optional().or(e.literal("")),
|
|
1844
|
-
// fallback since some iconUrls are empty, causing validation to fail
|
|
1845
|
-
pricingId: e.number().optional(),
|
|
1846
|
-
category: e.string().optional(),
|
|
1847
|
-
dappId: e.string().optional(),
|
|
1848
|
-
brandColor: e.string().optional()
|
|
1849
|
-
}), Un = Wt.extend({
|
|
1850
|
-
balance: e.string()
|
|
1851
|
-
}), Fn = Wt.extend({
|
|
1852
|
-
currencyValue: e.string(),
|
|
1853
|
-
currencySymbol: e.string().optional(),
|
|
1854
|
-
ccyDayChange: e.string().optional(),
|
|
1855
|
-
ethDayChange: e.string().optional(),
|
|
1856
|
-
unitCurrencyValue: e.string().optional()
|
|
1857
|
-
}), Et = Fn.extend({
|
|
1858
|
-
...Un.shape
|
|
1859
|
-
}), Xi = e.array(Et), Hi = He.extend({
|
|
1860
|
-
...Xt.shape
|
|
1861
|
-
}), qi = He.extend({
|
|
1862
|
-
...Pe.shape
|
|
1863
|
-
}), Ot = Et.extend({
|
|
1864
|
-
accruedFees: e.string(),
|
|
1865
|
-
currentPrice: e.string(),
|
|
1866
|
-
maxPrice: e.string(),
|
|
1867
|
-
minPrice: e.string(),
|
|
1868
|
-
principal: e.string()
|
|
1869
|
-
}), Kt = e.object({
|
|
1870
|
-
address: K.optional(),
|
|
1871
|
-
currencyValue: e.string().default("0")
|
|
1872
|
-
}), Yt = Kt.extend({
|
|
1873
|
-
poolFeePercentage: e.string(),
|
|
1874
|
-
tickSpacingPercentage: e.string().optional(),
|
|
1875
|
-
tokenId: e.string().optional(),
|
|
1876
|
-
unitCurrencyValueToken0: e.string().optional(),
|
|
1877
|
-
unitCurrencyValueToken1: e.string().optional(),
|
|
1878
|
-
token0: Ot,
|
|
1879
|
-
token1: Ot
|
|
1880
|
-
}), zi = e.array(Yt), Wi = e.object({
|
|
1881
|
-
name: e.string().optional(),
|
|
1882
|
-
healthRatio: e.string().optional(),
|
|
1883
|
-
accountAddress: K.optional()
|
|
1884
|
-
}), Zt = Kt.extend({
|
|
1885
|
-
totalBalances: e.record(e.string()),
|
|
1886
|
-
collateral: e.boolean(),
|
|
1887
|
-
debt: e.boolean(),
|
|
1888
|
-
lending: e.boolean(),
|
|
1889
|
-
apy: e.string().optional(),
|
|
1890
|
-
group: e.string().optional(),
|
|
1891
|
-
unitCurrencyValue: e.string().optional(),
|
|
1892
|
-
positionToken: Pe.or(e.undefined()),
|
|
1893
|
-
token: Et.optional(),
|
|
1894
|
-
accountAddress: K.optional(),
|
|
1895
|
-
accountAddressGroup: e.string().optional()
|
|
1896
|
-
}), Ki = e.array(Zt), xn = Yt.or(Zt), Bn = e.record(e.object({
|
|
1897
|
-
name: e.string().optional(),
|
|
1898
|
-
healthRatio: e.string().optional(),
|
|
1899
|
-
accountAddress: K.optional()
|
|
1900
|
-
})), Mn = e.object({
|
|
1901
|
-
type: $t,
|
|
1902
|
-
manageUrl: e.string().url().optional(),
|
|
1903
|
-
name: e.string(),
|
|
1904
|
-
positions: e.array(xn),
|
|
1905
|
-
// other types will be added when available from be
|
|
1906
|
-
positionsTotalValue: e.string(),
|
|
1907
|
-
brandColor: e.string().optional(),
|
|
1908
|
-
groups: Bn.optional(),
|
|
1909
|
-
accountAddress: K
|
|
1910
|
-
}), Gn = e.array(Mn), Yi = e.object({
|
|
1911
|
-
dappId: e.string(),
|
|
1912
|
-
products: Gn
|
|
1913
|
-
}), Vn = e.object({
|
|
1914
|
-
name: e.string().optional(),
|
|
1915
|
-
tokenAddress: K,
|
|
1916
|
-
token: Pe.optional(),
|
|
1917
|
-
amount: e.string().optional(),
|
|
1918
|
-
claimUrl: e.string().optional(),
|
|
1919
|
-
claimStart: e.number(),
|
|
1920
|
-
claimEnd: e.number().optional()
|
|
1921
|
-
}), Zi = e.array(Vn), $n = (t, o = 18) => Vr(t.replace(",", "."), Number(o)), Xn = e.string().trim().refine((t) => t !== "", {
|
|
1922
|
-
message: "Amount is required"
|
|
1923
|
-
}).refine((t) => {
|
|
1924
|
-
try {
|
|
1925
|
-
const o = $n(t).value;
|
|
1926
|
-
if (o < 0n)
|
|
1927
|
-
throw new Error("Amount must be positive");
|
|
1928
|
-
if (o === 0n)
|
|
1929
|
-
throw new Error("Amount can not be zero");
|
|
1930
|
-
if (o > Qe.UINT_256_MAX)
|
|
1931
|
-
throw new Error("Amount is too big");
|
|
1932
|
-
} catch {
|
|
1933
|
-
throw new Error("Amount should be a number");
|
|
1934
|
-
}
|
|
1935
|
-
return !0;
|
|
1936
|
-
}, { message: "Invalid amount" }), Ji = (t) => !!Xn.parse(t), Hn = e.object({
|
|
1937
|
-
data: e.object({
|
|
1938
|
-
code: e.string().optional(),
|
|
1939
|
-
// "STARKNAME_NOT_FOUND",
|
|
1940
|
-
name: e.string().optional(),
|
|
1941
|
-
// "AddressError"
|
|
1942
|
-
message: e.string()
|
|
1943
|
-
// "foo.stark not found"
|
|
1944
|
-
})
|
|
1945
|
-
}), Qi = (t) => {
|
|
1946
|
-
const o = Hn.safeParse(t);
|
|
1947
|
-
if (o.success)
|
|
1948
|
-
return o.data.data.message;
|
|
1949
|
-
}, qn = 3, Jt = process.env.FEE_OVERHEAD ? parseFloat(process.env.FEE_OVERHEAD) : qn, zn = 1.5, Ge = 10, Wn = ({ estimatedFee: t, overheadMultiplier: o = Jt }) => {
|
|
1950
|
-
const T = Ne.toBigInt(t) * BigInt(o * Ge) / BigInt(Ge);
|
|
1951
|
-
return Ne.toHex(T);
|
|
1952
|
-
}, es = ({ suggestedMaxFee: t, overheadMultiplier: o = Jt, starknetJsOverheadMultiplier: E = zn }) => {
|
|
1953
|
-
const S = Ne.toBigInt(t) * BigInt(Ge) / BigInt(E * Ge);
|
|
1954
|
-
return Wn({ estimatedFee: S, overheadMultiplier: o });
|
|
1955
|
-
};
|
|
1956
|
-
var ft;
|
|
1957
|
-
(function(t) {
|
|
1958
|
-
t.SIMULATE_AND_REVIEW_FAILED = "Missing simulation";
|
|
1959
|
-
})(ft || (ft = {}));
|
|
1960
|
-
class ts extends we {
|
|
1961
|
-
constructor(o) {
|
|
1962
|
-
super(o, ft), this.name = "EstimateError";
|
|
1963
|
-
}
|
|
1964
|
-
}
|
|
1965
|
-
const rs = e.object({
|
|
1966
|
-
type: e.enum(["DECLARE", "DEPLOY", "DEPLOY_ACCOUNT", "INVOKE"]).default("INVOKE"),
|
|
1967
|
-
calls: e.array(Nt).or(Nt).optional(),
|
|
1968
|
-
calldata: e.array(e.string()).optional(),
|
|
1969
|
-
classHash: Me.optional(),
|
|
1970
|
-
salt: Me.optional(),
|
|
1971
|
-
signature: e.array(e.string()).optional()
|
|
1972
|
-
}), Kn = e.object({
|
|
1973
|
-
amount: e.bigint(),
|
|
1974
|
-
pricePerUnit: e.bigint()
|
|
1975
|
-
}).or(e.object({ maxFee: e.bigint() })), wt = e.object({
|
|
1976
|
-
feeTokenAddress: K,
|
|
1977
|
-
amount: e.bigint(),
|
|
1978
|
-
pricePerUnit: e.bigint(),
|
|
1979
|
-
max: Kn.optional(),
|
|
1980
|
-
dataGasConsumed: e.bigint().optional(),
|
|
1981
|
-
dataGasPrice: e.bigint().optional()
|
|
1982
|
-
}), Yn = e.object({
|
|
1983
|
-
deployment: wt.optional(),
|
|
1984
|
-
transactions: wt
|
|
1985
|
-
}), Zn = e.union([
|
|
1986
|
-
e.literal("critical"),
|
|
1987
|
-
e.literal("high"),
|
|
1988
|
-
e.literal("caution"),
|
|
1989
|
-
e.literal("info")
|
|
1990
|
-
]), Jn = e.string(), Qn = e.object({
|
|
1991
|
-
name: e.string(),
|
|
1992
|
-
url: e.string(),
|
|
1993
|
-
position: e.number()
|
|
1994
|
-
}), Je = e.object({
|
|
1995
|
-
address: e.string(),
|
|
1996
|
-
name: e.string(),
|
|
1997
|
-
symbol: e.string().optional(),
|
|
1998
|
-
decimals: e.number().optional(),
|
|
1999
|
-
unknown: e.boolean(),
|
|
2000
|
-
iconUrl: e.string().optional(),
|
|
2001
|
-
type: e.string()
|
|
2002
|
-
}), _t = e.discriminatedUnion("type", [
|
|
2003
|
-
e.object({
|
|
2004
|
-
type: e.literal("amount"),
|
|
2005
|
-
label: e.string(),
|
|
2006
|
-
token: Je,
|
|
2007
|
-
amount: e.string(),
|
|
2008
|
-
usd: e.string(),
|
|
2009
|
-
editable: e.boolean()
|
|
2010
|
-
}),
|
|
2011
|
-
e.object({
|
|
2012
|
-
type: e.literal("address"),
|
|
2013
|
-
label: e.string(),
|
|
2014
|
-
address: e.string(),
|
|
2015
|
-
addressName: e.string().optional(),
|
|
2016
|
-
// tbd whether it's isVerified or verified
|
|
2017
|
-
verified: e.boolean().optional()
|
|
2018
|
-
}),
|
|
2019
|
-
e.object({
|
|
2020
|
-
type: e.literal("timestamp"),
|
|
2021
|
-
label: e.string(),
|
|
2022
|
-
value: e.string()
|
|
2023
|
-
}),
|
|
2024
|
-
e.object({
|
|
2025
|
-
type: e.literal("token_address"),
|
|
2026
|
-
label: e.string(),
|
|
2027
|
-
token: Je
|
|
2028
|
-
}),
|
|
2029
|
-
e.object({
|
|
2030
|
-
type: e.literal("calldata"),
|
|
2031
|
-
label: e.string(),
|
|
2032
|
-
entrypoint: e.string(),
|
|
2033
|
-
calldata: e.array(e.string())
|
|
2034
|
-
}),
|
|
2035
|
-
e.object({
|
|
2036
|
-
type: e.literal("text"),
|
|
2037
|
-
label: e.string(),
|
|
2038
|
-
text: e.string()
|
|
2039
|
-
}),
|
|
2040
|
-
e.object({
|
|
2041
|
-
type: e.literal("nft"),
|
|
2042
|
-
label: e.string(),
|
|
2043
|
-
token: Je
|
|
2044
|
-
})
|
|
2045
|
-
]), Qt = e.object({
|
|
2046
|
-
name: e.string(),
|
|
2047
|
-
properties: e.array(_t),
|
|
2048
|
-
defaultProperties: e.array(_t).optional()
|
|
2049
|
-
}), ea = e.union([
|
|
2050
|
-
e.literal("verified"),
|
|
2051
|
-
e.literal("neutral"),
|
|
2052
|
-
e.literal("partial"),
|
|
2053
|
-
e.literal("warn")
|
|
2054
|
-
]), ta = e.object({
|
|
2055
|
-
unknown_token: e.unknown().optional(),
|
|
2056
|
-
date_of_addition: e.string().optional(),
|
|
2057
|
-
contract_address: K.optional(),
|
|
2058
|
-
reason: e.string().optional(),
|
|
2059
|
-
value: e.string().or(e.number()).optional()
|
|
2060
|
-
}), er = e.object({
|
|
2061
|
-
reason: Jn,
|
|
2062
|
-
details: ta.optional(),
|
|
2063
|
-
severity: Zn
|
|
2064
|
-
}), ra = e.object({
|
|
2065
|
-
assessment: ea,
|
|
2066
|
-
warnings: e.array(er).optional(),
|
|
2067
|
-
assessmentReasons: e.array(e.string()).optional(),
|
|
2068
|
-
assessmentDetails: e.object({
|
|
2069
|
-
contract_address: e.string()
|
|
2070
|
-
}).optional(),
|
|
2071
|
-
action: Qt
|
|
2072
|
-
}), tr = e.object({
|
|
2073
|
-
name: e.string(),
|
|
2074
|
-
description: e.string(),
|
|
2075
|
-
logoUrl: e.string(),
|
|
2076
|
-
iconUrl: e.string(),
|
|
2077
|
-
argentVerified: e.boolean(),
|
|
2078
|
-
links: e.array(Qn)
|
|
2079
|
-
}), rr = e.object({
|
|
2080
|
-
assessment: e.union([
|
|
2081
|
-
e.literal("verified"),
|
|
2082
|
-
e.literal("neutral"),
|
|
2083
|
-
e.literal("partial"),
|
|
2084
|
-
e.literal("warn")
|
|
2085
|
-
]),
|
|
2086
|
-
warnings: e.array(er).optional(),
|
|
2087
|
-
assessmentDetails: e.object({
|
|
2088
|
-
contract_address: e.string()
|
|
2089
|
-
}).optional(),
|
|
2090
|
-
targetedDapp: tr.optional(),
|
|
2091
|
-
reviews: e.array(ra)
|
|
2092
|
-
}).optional(), nr = e.object({
|
|
2093
|
-
banner: e.string().nullable().optional(),
|
|
2094
|
-
preview: e.string().nullable().optional(),
|
|
2095
|
-
full: e.string().nullable().optional(),
|
|
2096
|
-
original: e.string().nullable().optional()
|
|
2097
|
-
}), na = e.object({
|
|
2098
|
-
twitter: e.string().optional(),
|
|
2099
|
-
external: e.string().optional(),
|
|
2100
|
-
discord: e.string().optional()
|
|
2101
|
-
}), It = e.object({
|
|
2102
|
-
address: H,
|
|
2103
|
-
decimals: e.number().optional(),
|
|
2104
|
-
symbol: e.string().optional(),
|
|
2105
|
-
name: e.string(),
|
|
2106
|
-
description: e.string().optional(),
|
|
2107
|
-
type: e.string().optional(),
|
|
2108
|
-
usdValue: e.string().optional(),
|
|
2109
|
-
iconUrl: e.string().optional(),
|
|
2110
|
-
unknown: e.boolean().optional(),
|
|
2111
|
-
imageUrls: nr.optional(),
|
|
2112
|
-
links: na.optional()
|
|
2113
|
-
}), aa = e.object({
|
|
2114
|
-
tokenAddress: H,
|
|
2115
|
-
owner: H,
|
|
2116
|
-
spender: H,
|
|
2117
|
-
value: e.string().optional(),
|
|
2118
|
-
approvalForAll: e.boolean(),
|
|
2119
|
-
details: It.optional()
|
|
2120
|
-
}), ia = e.object({
|
|
2121
|
-
tokenAddress: H,
|
|
2122
|
-
from: H,
|
|
2123
|
-
to: H,
|
|
2124
|
-
tokenId: e.string().optional(),
|
|
2125
|
-
value: e.string().optional(),
|
|
2126
|
-
details: It.optional()
|
|
2127
|
-
}), ve = e.union([e.string(), e.number(), e.bigint()]).transform((t) => parseInt(t.toString(), 10)), Lt = {
|
|
2128
|
-
overallFee: ve,
|
|
2129
|
-
gasPrice: ve,
|
|
2130
|
-
gasUsage: ve,
|
|
2131
|
-
dataGasPrice: ve.optional(),
|
|
2132
|
-
dataGasConsumed: ve.optional()
|
|
2133
|
-
}, sa = e.object({
|
|
2134
|
-
...Lt,
|
|
2135
|
-
unit: e.string().transform((t) => t.toUpperCase()).pipe(e.literal("WEI")),
|
|
2136
|
-
maxFee: ve
|
|
2137
|
-
}).or(e.object({
|
|
2138
|
-
...Lt,
|
|
2139
|
-
unit: e.string().transform((t) => t.toUpperCase()).pipe(e.literal("FRI")),
|
|
2140
|
-
maxAmount: ve,
|
|
2141
|
-
maxPricePerUnit: ve
|
|
2142
|
-
})), oa = e.object({
|
|
2143
|
-
type: e.string(),
|
|
2144
|
-
label: e.string(),
|
|
2145
|
-
tokenId: e.string().optional(),
|
|
2146
|
-
value: e.string().optional(),
|
|
2147
|
-
usdValue: e.string().optional(),
|
|
2148
|
-
token: It,
|
|
2149
|
-
sent: e.boolean().optional(),
|
|
2150
|
-
tokenIdDetails: e.object({
|
|
2151
|
-
name: e.string().optional(),
|
|
2152
|
-
description: e.string().optional(),
|
|
2153
|
-
imageUrls: nr.optional()
|
|
2154
|
-
}).optional()
|
|
2155
|
-
}), ca = e.object({
|
|
2156
|
-
approvals: e.array(aa).optional(),
|
|
2157
|
-
transfers: e.array(ia).optional(),
|
|
2158
|
-
calculatedNonce: e.string().optional(),
|
|
2159
|
-
feeEstimation: sa,
|
|
2160
|
-
summary: e.array(oa).optional()
|
|
2161
|
-
}), la = e.object({
|
|
2162
|
-
label: e.string().optional(),
|
|
2163
|
-
code: e.number().optional(),
|
|
2164
|
-
message: e.string().optional(),
|
|
2165
|
-
error: e.string().optional()
|
|
2166
|
-
}), ar = e.object({
|
|
2167
|
-
reviewOfTransaction: rr,
|
|
2168
|
-
simulation: ca,
|
|
2169
|
-
simulationError: e.undefined()
|
|
2170
|
-
}), ir = e.object({
|
|
2171
|
-
reviewOfTransaction: rr,
|
|
2172
|
-
simulation: e.undefined(),
|
|
2173
|
-
simulationError: la
|
|
2174
|
-
}), sr = ar.or(ir), ns = e.object({
|
|
2175
|
-
transactions: e.array(sr)
|
|
2176
|
-
}), as = e.object({
|
|
2177
|
-
transactions: e.array(sr),
|
|
2178
|
-
enrichedFeeEstimation: Yn.optional(),
|
|
2179
|
-
isBackendDown: e.boolean().default(!1).optional()
|
|
2180
|
-
});
|
|
2181
|
-
function is(t) {
|
|
2182
|
-
return ar.safeParse(t).success;
|
|
2183
|
-
}
|
|
2184
|
-
function ss(t) {
|
|
2185
|
-
return ir.safeParse(t).success;
|
|
2186
|
-
}
|
|
2187
|
-
const or = e.object({
|
|
2188
|
-
network: e.string(),
|
|
2189
|
-
hash: e.string(),
|
|
2190
|
-
status: e.string(),
|
|
2191
|
-
blockNumber: e.number().optional(),
|
|
2192
|
-
transactionIndex: e.number()
|
|
2193
|
-
}), Ce = e.object({
|
|
2194
|
-
type: e.enum(["token", "nft"]),
|
|
2195
|
-
tokenAddress: H,
|
|
2196
|
-
amount: e.string().optional(),
|
|
2197
|
-
fiatAmount: e.object({
|
|
2198
|
-
currency: e.string(),
|
|
2199
|
-
currencyAmount: e.number()
|
|
2200
|
-
}).optional().nullable()
|
|
2201
|
-
}), At = e.enum(["ethereum", "starknet", "zksync", "zksync2"]), ua = e.object({
|
|
2202
|
-
type: e.enum(["payment", "gasFee"]),
|
|
2203
|
-
leg: e.enum(["credit", "debit"]),
|
|
2204
|
-
asset: Ce,
|
|
2205
|
-
counterParty: H.optional(),
|
|
2206
|
-
counterPartyNetwork: At.optional()
|
|
2207
|
-
}), fa = e.object({
|
|
2208
|
-
address: H,
|
|
2209
|
-
network: At,
|
|
2210
|
-
type: e.enum(["wallet", "token"])
|
|
2211
|
-
}), pa = e.object({
|
|
2212
|
-
chainId: e.enum(["TESTNET", "MAINNET", "SEPOLIA"]),
|
|
2213
|
-
ethereumNetwork: e.enum(["mainnet", "sepolia"])
|
|
2214
|
-
}), ha = e.enum([
|
|
2215
|
-
"approval",
|
|
2216
|
-
"changePubKey",
|
|
2217
|
-
"dappInteraction",
|
|
2218
|
-
"deploy",
|
|
2219
|
-
"gift",
|
|
2220
|
-
"multicall",
|
|
2221
|
-
"payment",
|
|
2222
|
-
"security",
|
|
2223
|
-
"trade"
|
|
2224
|
-
]), cr = e.enum([
|
|
2225
|
-
"triggerEscapeGuardian",
|
|
2226
|
-
"triggerEscapeSigner",
|
|
2227
|
-
"escapeGuardian",
|
|
2228
|
-
"escapeSigner",
|
|
2229
|
-
"guardianChanged",
|
|
2230
|
-
"guardianBackupChanged",
|
|
2231
|
-
"signerChanged",
|
|
2232
|
-
"cancelEscape",
|
|
2233
|
-
"accountUpgraded",
|
|
2234
|
-
"multisigConfigurationUpdated"
|
|
2235
|
-
]), ma = e.object({
|
|
2236
|
-
name: e.string(),
|
|
2237
|
-
parameters: e.array(e.unknown()).optional()
|
|
2238
|
-
}), da = e.object({
|
|
2239
|
-
guid: e.string().optional(),
|
|
2240
|
-
signerType: e.string().optional(),
|
|
2241
|
-
// StarknetKey, Secp256k1, Secp256r1, Eip191, Webauthn
|
|
2242
|
-
signer: e.object({
|
|
2243
|
-
publicKey: e.string().optional()
|
|
2244
|
-
}).optional()
|
|
2245
|
-
}), ga = e.object({
|
|
2246
|
-
activeAt: e.string().optional(),
|
|
2247
|
-
newGuardian: e.string().optional(),
|
|
2248
|
-
newImplementation: e.string().optional(),
|
|
2249
|
-
newVersion: e.string().optional(),
|
|
2250
|
-
signerGuid: e.string().optional(),
|
|
2251
|
-
signers: e.array(da).optional()
|
|
2252
|
-
}), Ct = e.discriminatedUnion("type", [
|
|
2253
|
-
e.object({
|
|
2254
|
-
type: e.literal("deploy"),
|
|
2255
|
-
deployer: H,
|
|
2256
|
-
contractAddress: H
|
|
2257
|
-
}),
|
|
2258
|
-
e.object({
|
|
2259
|
-
type: e.literal("approval"),
|
|
2260
|
-
spender: H,
|
|
2261
|
-
asset: Ce,
|
|
2262
|
-
approvalType: e.string()
|
|
2263
|
-
}),
|
|
2264
|
-
e.object({
|
|
2265
|
-
type: e.literal("payment"),
|
|
2266
|
-
counterparty: H,
|
|
2267
|
-
leg: e.string(),
|
|
2268
|
-
asset: Ce,
|
|
2269
|
-
counterpartyNetwork: At.optional()
|
|
2270
|
-
}),
|
|
2271
|
-
e.object({
|
|
2272
|
-
type: e.literal("trade"),
|
|
2273
|
-
srcAsset: Ce,
|
|
2274
|
-
destAsset: Ce
|
|
2275
|
-
}),
|
|
2276
|
-
e.object({
|
|
2277
|
-
type: e.literal("security"),
|
|
2278
|
-
action: cr,
|
|
2279
|
-
context: ga.optional()
|
|
2280
|
-
}),
|
|
2281
|
-
e.object({
|
|
2282
|
-
type: e.literal("dappInteraction"),
|
|
2283
|
-
dappAddress: H,
|
|
2284
|
-
function: ma.optional().nullable()
|
|
2285
|
-
// This object is often null. It happens when we were unable to get the ABI or failed decoding the function call
|
|
2286
|
-
})
|
|
2287
|
-
]), Ea = e.union([
|
|
2288
|
-
Ct,
|
|
2289
|
-
e.object({
|
|
2290
|
-
type: e.literal("multicall"),
|
|
2291
|
-
calls: e.array(e.object({
|
|
2292
|
-
details: Ct
|
|
2293
|
-
}))
|
|
2294
|
-
})
|
|
2295
|
-
]), Ia = e.object({
|
|
2296
|
-
dappId: e.string(),
|
|
2297
|
-
name: e.string().optional().nullable()
|
|
2298
|
-
}), lr = e.object({
|
|
2299
|
-
sent: e.boolean(),
|
|
2300
|
-
asset: e.discriminatedUnion("type", [
|
|
2301
|
-
e.object({
|
|
2302
|
-
type: e.literal("nft"),
|
|
2303
|
-
tokenAddress: H,
|
|
2304
|
-
tokenId: e.coerce.number().optional(),
|
|
2305
|
-
amount: e.string().optional(),
|
|
2306
|
-
collectionName: e.string().optional(),
|
|
2307
|
-
collectionPreviewImage: e.string().optional().nullable(),
|
|
2308
|
-
nftName: e.string().optional().nullable(),
|
|
2309
|
-
nftPreviewImage: e.string().optional().nullable()
|
|
2310
|
-
}),
|
|
2311
|
-
e.object({
|
|
2312
|
-
type: e.literal("token"),
|
|
2313
|
-
tokenAddress: H,
|
|
2314
|
-
amount: e.string().optional(),
|
|
2315
|
-
fiatAmount: e.object({
|
|
2316
|
-
currency: e.string(),
|
|
2317
|
-
currencyAmount: e.coerce.string()
|
|
2318
|
-
}).optional().nullable()
|
|
2319
|
-
})
|
|
2320
|
-
])
|
|
2321
|
-
}), Aa = e.object({
|
|
2322
|
-
type: e.string(),
|
|
2323
|
-
// "gas" for example
|
|
2324
|
-
to: H,
|
|
2325
|
-
actualFee: e.object({
|
|
2326
|
-
type: e.string(),
|
|
2327
|
-
tokenAddress: H,
|
|
2328
|
-
amount: e.string().optional(),
|
|
2329
|
-
fiatAmount: e.object({
|
|
2330
|
-
currency: e.string(),
|
|
2331
|
-
currencyAmount: e.number()
|
|
2332
|
-
}).optional().nullable()
|
|
2333
|
-
})
|
|
2334
|
-
}), ur = e.enum(["pending", "success", "failure"]), fr = e.object({
|
|
2335
|
-
compositeId: e.string(),
|
|
2336
|
-
id: e.string().uuid(),
|
|
2337
|
-
status: ur,
|
|
2338
|
-
wallet: H,
|
|
2339
|
-
txSender: H,
|
|
2340
|
-
source: e.string(),
|
|
2341
|
-
type: ha,
|
|
2342
|
-
group: e.enum(["finance", "security"]),
|
|
2343
|
-
submitted: e.number(),
|
|
2344
|
-
lastModified: e.number(),
|
|
2345
|
-
transaction: or,
|
|
2346
|
-
transfers: e.array(ua),
|
|
2347
|
-
// to be clarified
|
|
2348
|
-
fees: e.array(Aa).optional(),
|
|
2349
|
-
relatedAddresses: e.array(fa).nullable(),
|
|
2350
|
-
network: e.string(),
|
|
2351
|
-
networkDetails: pa.optional(),
|
|
2352
|
-
details: Ea,
|
|
2353
|
-
transferSummary: e.array(lr).optional(),
|
|
2354
|
-
dapp: Ia.optional(),
|
|
2355
|
-
actions: e.array(Qt).optional(),
|
|
2356
|
-
title: e.string().optional(),
|
|
2357
|
-
multisigDetails: e.object({
|
|
2358
|
-
signers: e.array(H)
|
|
2359
|
-
}).optional()
|
|
2360
|
-
}), Sa = e.object({
|
|
2361
|
-
title: e.string().optional(),
|
|
2362
|
-
shortTitle: e.string().optional(),
|
|
2363
|
-
subtitle: e.string().optional(),
|
|
2364
|
-
/** let's not import the keys from x-ui here */
|
|
2365
|
-
icon: e.string().optional()
|
|
2366
|
-
}), ba = "native", Na = "rejected", Ta = "cancelled", ya = "queued", os = fr.pick({
|
|
2367
|
-
status: !0,
|
|
2368
|
-
actions: !0,
|
|
2369
|
-
submitted: !0,
|
|
2370
|
-
lastModified: !0,
|
|
2371
|
-
transferSummary: !0,
|
|
2372
|
-
fees: !0,
|
|
2373
|
-
multisigDetails: !0
|
|
2374
|
-
}).extend({
|
|
2375
|
-
status: e.union([
|
|
2376
|
-
ur,
|
|
2377
|
-
e.enum([
|
|
2378
|
-
Na,
|
|
2379
|
-
Ta,
|
|
2380
|
-
ya
|
|
2381
|
-
])
|
|
2382
|
-
]),
|
|
2383
|
-
type: e.literal(ba),
|
|
2384
|
-
transaction: or.pick({
|
|
2385
|
-
hash: !0
|
|
2386
|
-
}),
|
|
2387
|
-
dapp: tr.optional(),
|
|
2388
|
-
meta: Sa.optional()
|
|
2389
|
-
}), Ra = e.array(fr), cs = e.object({
|
|
2390
|
-
activities: Ra,
|
|
2391
|
-
page: e.number(),
|
|
2392
|
-
pageSize: e.number(),
|
|
2393
|
-
totalElements: e.number(),
|
|
2394
|
-
totalPages: e.number()
|
|
2395
|
-
});
|
|
2396
|
-
function ls(t) {
|
|
2397
|
-
return cr.safeParse(t).success;
|
|
2398
|
-
}
|
|
2399
|
-
const pr = (t) => lr.safeParse(t).success, us = (t) => pr(t) && t.asset.type === "token", fs = (t) => pr(t) && t.asset.type === "nft", Dt = {
|
|
2400
|
-
Transfer: St.getSelectorFromName("Transfer"),
|
|
2401
|
-
// 0x99cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9
|
|
2402
|
-
Approval: St.getSelectorFromName("Approval")
|
|
2403
|
-
// 0x134692b230b9e1ffa39098904722134159652b09c5bc41d88d6698779d228ff
|
|
2404
|
-
}, va = (t, o, E) => {
|
|
2405
|
-
for (const T of t) {
|
|
2406
|
-
const { events: S, internal_calls: D } = T;
|
|
2407
|
-
for (const w of S)
|
|
2408
|
-
for (const k of w.keys)
|
|
2409
|
-
k === Dt.Approval && o.push({
|
|
2410
|
-
tokenAddress: K.parse(T.contract_address),
|
|
2411
|
-
owner: w.data[0],
|
|
2412
|
-
spender: w.data[1],
|
|
2413
|
-
value: Qe.uint256ToBN({ low: w.data[2], high: w.data[3] }).toString()
|
|
2414
|
-
}), k === Dt.Transfer && E.push({
|
|
2415
|
-
tokenAddress: K.parse(T.contract_address),
|
|
2416
|
-
from: w.data[0],
|
|
2417
|
-
to: w.data[1],
|
|
2418
|
-
value: Qe.uint256ToBN({ low: w.data[2], high: w.data[3] }).toString()
|
|
2419
|
-
});
|
|
2420
|
-
D && va(D, o, E);
|
|
2421
|
-
}
|
|
2422
|
-
return { approvals: o, transfers: E };
|
|
2423
|
-
}, Oa = /(0x[a-fA-F0-9]+)\s*\('(.*?)'\)/, ps = (t) => {
|
|
2424
|
-
if (!Ur(t))
|
|
2425
|
-
return;
|
|
2426
|
-
const o = t.match(Oa);
|
|
2427
|
-
if (o && !Fr(o[2]))
|
|
2428
|
-
return o[2];
|
|
2429
|
-
};
|
|
2430
|
-
var pt;
|
|
2431
|
-
(function(t) {
|
|
2432
|
-
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";
|
|
2433
|
-
})(pt || (pt = {}));
|
|
2434
|
-
class hs extends we {
|
|
2435
|
-
constructor(o) {
|
|
2436
|
-
super(o, pt), this.name = "ReviewError";
|
|
2437
|
-
}
|
|
2438
|
-
}
|
|
2439
|
-
const ms = e.object({
|
|
2440
|
-
reason: e.string(),
|
|
2441
|
-
severity: e.string().optional(),
|
|
2442
|
-
title: e.string(),
|
|
2443
|
-
description: e.string().optional()
|
|
2444
|
-
}), wa = Object.values(xe.TRANSACTION_VERSION), ds = e.string().default("0x3").refine((t) => {
|
|
2445
|
-
const o = Ne.toBigInt(t);
|
|
2446
|
-
return wa.map((E) => Ne.toBigInt(E)).includes(o);
|
|
2447
|
-
}).transform((t) => Ne.toHex(t));
|
|
2448
|
-
function gs(t) {
|
|
2449
|
-
if (t === xe.TRANSACTION_VERSION.V3 || t === xe.TRANSACTION_VERSION.F3)
|
|
2450
|
-
throw Error("Only txv1 is supported");
|
|
2451
|
-
}
|
|
2452
|
-
export {
|
|
2453
|
-
Ba as $,
|
|
2454
|
-
ke as A,
|
|
2455
|
-
yi as B,
|
|
2456
|
-
ai as C,
|
|
2457
|
-
Fi as D,
|
|
2458
|
-
ki as E,
|
|
2459
|
-
Gi as F,
|
|
2460
|
-
Ya as G,
|
|
2461
|
-
dt as H,
|
|
2462
|
-
Ka as I,
|
|
2463
|
-
di as J,
|
|
2464
|
-
sa as K,
|
|
2465
|
-
ts as L,
|
|
2466
|
-
Tt as M,
|
|
2467
|
-
ii as N,
|
|
2468
|
-
Wn as O,
|
|
2469
|
-
ns as P,
|
|
2470
|
-
ss as Q,
|
|
2471
|
-
hs as R,
|
|
2472
|
-
ti as S,
|
|
2473
|
-
ji as T,
|
|
2474
|
-
jt as U,
|
|
2475
|
-
$r as V,
|
|
2476
|
-
Ve as W,
|
|
2477
|
-
Xr as X,
|
|
2478
|
-
Hr as Y,
|
|
2479
|
-
Fa as Z,
|
|
2480
|
-
xa as _,
|
|
2481
|
-
bt as a,
|
|
2482
|
-
Qi as a$,
|
|
2483
|
-
Ma as a0,
|
|
2484
|
-
Ga as a1,
|
|
2485
|
-
Va as a2,
|
|
2486
|
-
mt as a3,
|
|
2487
|
-
Xa as a4,
|
|
2488
|
-
Ha as a5,
|
|
2489
|
-
qa as a6,
|
|
2490
|
-
za as a7,
|
|
2491
|
-
Wa as a8,
|
|
2492
|
-
$a as a9,
|
|
2493
|
-
Vi as aA,
|
|
2494
|
-
Yt as aB,
|
|
2495
|
-
zi as aC,
|
|
2496
|
-
Wi as aD,
|
|
2497
|
-
Zt as aE,
|
|
2498
|
-
Ki as aF,
|
|
2499
|
-
xn as aG,
|
|
2500
|
-
Bn as aH,
|
|
2501
|
-
Mn as aI,
|
|
2502
|
-
Gn as aJ,
|
|
2503
|
-
Yi as aK,
|
|
2504
|
-
$t as aL,
|
|
2505
|
-
Vn as aM,
|
|
2506
|
-
Zi as aN,
|
|
2507
|
-
He as aO,
|
|
2508
|
-
$i as aP,
|
|
2509
|
-
Wt as aQ,
|
|
2510
|
-
Un as aR,
|
|
2511
|
-
Fn as aS,
|
|
2512
|
-
Et as aT,
|
|
2513
|
-
Xi as aU,
|
|
2514
|
-
Hi as aV,
|
|
2515
|
-
qi as aW,
|
|
2516
|
-
$n as aX,
|
|
2517
|
-
Xn as aY,
|
|
2518
|
-
Ji as aZ,
|
|
2519
|
-
Hn as a_,
|
|
2520
|
-
Zr as aa,
|
|
2521
|
-
Xe as ab,
|
|
2522
|
-
Qr as ac,
|
|
2523
|
-
et as ad,
|
|
2524
|
-
rn as ae,
|
|
2525
|
-
Za as af,
|
|
2526
|
-
Ja as ag,
|
|
2527
|
-
Qa as ah,
|
|
2528
|
-
ei as ai,
|
|
2529
|
-
ri as aj,
|
|
2530
|
-
tn as ak,
|
|
2531
|
-
tt as al,
|
|
2532
|
-
we as am,
|
|
2533
|
-
ut as an,
|
|
2534
|
-
Pe as ao,
|
|
2535
|
-
Xt as ap,
|
|
2536
|
-
xi as aq,
|
|
2537
|
-
vt as ar,
|
|
2538
|
-
qt as as,
|
|
2539
|
-
Bi as at,
|
|
2540
|
-
zt as au,
|
|
2541
|
-
Mi as av,
|
|
2542
|
-
Dn as aw,
|
|
2543
|
-
Pn as ax,
|
|
2544
|
-
jn as ay,
|
|
2545
|
-
kn as az,
|
|
2546
|
-
zr as b,
|
|
2547
|
-
pr as b$,
|
|
2548
|
-
Jt as b0,
|
|
2549
|
-
es as b1,
|
|
2550
|
-
ft as b2,
|
|
2551
|
-
rs as b3,
|
|
2552
|
-
Dt as b4,
|
|
2553
|
-
va as b5,
|
|
2554
|
-
ps as b6,
|
|
2555
|
-
ms as b7,
|
|
2556
|
-
ds as b8,
|
|
2557
|
-
gs as b9,
|
|
2558
|
-
Oi as bA,
|
|
2559
|
-
En as bB,
|
|
2560
|
-
ct as bC,
|
|
2561
|
-
In as bD,
|
|
2562
|
-
An as bE,
|
|
2563
|
-
lt as bF,
|
|
2564
|
-
Sn as bG,
|
|
2565
|
-
bn as bH,
|
|
2566
|
-
Nn as bI,
|
|
2567
|
-
Tn as bJ,
|
|
2568
|
-
xt as bK,
|
|
2569
|
-
yn as bL,
|
|
2570
|
-
Bt as bM,
|
|
2571
|
-
Rn as bN,
|
|
2572
|
-
Ze as bO,
|
|
2573
|
-
vn as bP,
|
|
2574
|
-
On as bQ,
|
|
2575
|
-
wn as bR,
|
|
2576
|
-
_n as bS,
|
|
2577
|
-
wi as bT,
|
|
2578
|
-
_i as bU,
|
|
2579
|
-
Gt as bV,
|
|
2580
|
-
Li as bW,
|
|
2581
|
-
Ci as bX,
|
|
2582
|
-
Vt as bY,
|
|
2583
|
-
Di as bZ,
|
|
2584
|
-
Pi as b_,
|
|
2585
|
-
Ti as ba,
|
|
2586
|
-
pn as bb,
|
|
2587
|
-
Ri as bc,
|
|
2588
|
-
vi as bd,
|
|
2589
|
-
De as be,
|
|
2590
|
-
sn as bf,
|
|
2591
|
-
on as bg,
|
|
2592
|
-
cn as bh,
|
|
2593
|
-
Be as bi,
|
|
2594
|
-
ln as bj,
|
|
2595
|
-
gt as bk,
|
|
2596
|
-
un as bl,
|
|
2597
|
-
fn as bm,
|
|
2598
|
-
he as bn,
|
|
2599
|
-
si as bo,
|
|
2600
|
-
oi as bp,
|
|
2601
|
-
ci as bq,
|
|
2602
|
-
li as br,
|
|
2603
|
-
ui as bs,
|
|
2604
|
-
fi as bt,
|
|
2605
|
-
pi as bu,
|
|
2606
|
-
hi as bv,
|
|
2607
|
-
mi as bw,
|
|
2608
|
-
Ut as bx,
|
|
2609
|
-
Ye as by,
|
|
2610
|
-
Ft as bz,
|
|
2611
|
-
Nt as c,
|
|
2612
|
-
lr as c0,
|
|
2613
|
-
ba as c1,
|
|
2614
|
-
os as c2,
|
|
2615
|
-
ua as c3,
|
|
2616
|
-
Ea as c4,
|
|
2617
|
-
Ia as c5,
|
|
2618
|
-
Aa as c6,
|
|
2619
|
-
fr as c7,
|
|
2620
|
-
Sa as c8,
|
|
2621
|
-
Na as c9,
|
|
2622
|
-
Ta as ca,
|
|
2623
|
-
ya as cb,
|
|
2624
|
-
Ra as cc,
|
|
2625
|
-
cs as cd,
|
|
2626
|
-
ls as ce,
|
|
2627
|
-
us as cf,
|
|
2628
|
-
fs as cg,
|
|
2629
|
-
wt as ch,
|
|
2630
|
-
Yn as ci,
|
|
2631
|
-
_t as cj,
|
|
2632
|
-
Qt as ck,
|
|
2633
|
-
ea as cl,
|
|
2634
|
-
ta as cm,
|
|
2635
|
-
er as cn,
|
|
2636
|
-
ra as co,
|
|
2637
|
-
tr as cp,
|
|
2638
|
-
as as cq,
|
|
2639
|
-
is as cr,
|
|
2640
|
-
Zn as cs,
|
|
2641
|
-
Jn as ct,
|
|
2642
|
-
qr as d,
|
|
2643
|
-
en as e,
|
|
2644
|
-
Jr as f,
|
|
2645
|
-
ni as g,
|
|
2646
|
-
Kr as h,
|
|
2647
|
-
Yr as i,
|
|
2648
|
-
gi as j,
|
|
2649
|
-
Si as k,
|
|
2650
|
-
Ai as l,
|
|
2651
|
-
Ei as m,
|
|
2652
|
-
$e as n,
|
|
2653
|
-
Ii as o,
|
|
2654
|
-
Vr as p,
|
|
2655
|
-
H as q,
|
|
2656
|
-
ht as r,
|
|
2657
|
-
bi as s,
|
|
2658
|
-
K as t,
|
|
2659
|
-
an as u,
|
|
2660
|
-
Ni as v,
|
|
2661
|
-
Me as w,
|
|
2662
|
-
Ln as x,
|
|
2663
|
-
mn as y,
|
|
2664
|
-
Ui as z
|
|
2665
|
-
};
|