@lombard.finance/sdk 4.2.0 → 4.3.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/CHANGELOG.md +0 -94
- package/README.md +10 -59
- package/dist/api.cjs +1 -1
- package/dist/api.js +5 -5
- package/dist/bridge/lib/ccip-config.d.ts.map +1 -1
- package/dist/bridge/lib/config.d.ts +3 -3
- package/dist/bridge/lib/config.d.ts.map +1 -1
- package/dist/bridge.cjs +1 -1
- package/dist/bridge.js +1 -1
- package/dist/btc.cjs +1 -1
- package/dist/btc.js +2 -2
- package/dist/chunks/{BtcActions-D9eBmDj6.cjs → BtcActions-ByhBml_1.cjs} +2 -2
- package/dist/chunks/{BtcActions-D9eBmDj6.cjs.map → BtcActions-ByhBml_1.cjs.map} +1 -1
- package/dist/chunks/{BtcActions-DGqmtxjd.js → BtcActions-C_A1dUQ0.js} +20 -20
- package/dist/chunks/{BtcActions-DGqmtxjd.js.map → BtcActions-C_A1dUQ0.js.map} +1 -1
- package/dist/chunks/{EvmActions-BOwYPThp.cjs → EvmActions-DoYIhj61.cjs} +2 -2
- package/dist/chunks/{EvmActions-BOwYPThp.cjs.map → EvmActions-DoYIhj61.cjs.map} +1 -1
- package/dist/chunks/{EvmActions-MW5mNmqs.js → EvmActions-DucgT60w.js} +45 -45
- package/dist/chunks/{EvmActions-MW5mNmqs.js.map → EvmActions-DucgT60w.js.map} +1 -1
- package/dist/chunks/{ReferralsClient-DUwyIUe3.cjs → ReferralsClient-BC-1wT1q.cjs} +2 -2
- package/dist/chunks/{ReferralsClient-DUwyIUe3.cjs.map → ReferralsClient-BC-1wT1q.cjs.map} +1 -1
- package/dist/chunks/{ReferralsClient-JjWLlIO4.js → ReferralsClient-DbFWWtVi.js} +20 -20
- package/dist/chunks/{ReferralsClient-JjWLlIO4.js.map → ReferralsClient-DbFWWtVi.js.map} +1 -1
- package/dist/chunks/approveLBTC-B5-ZWqct.js +26 -0
- package/dist/chunks/{approveLBTC-DOP0wsm3.js.map → approveLBTC-B5-ZWqct.js.map} +1 -1
- package/dist/chunks/{approveLBTC-CN6rJF6_.cjs → approveLBTC-CZiZmdcX.cjs} +2 -2
- package/dist/chunks/{approveLBTC-CN6rJF6_.cjs.map → approveLBTC-CZiZmdcX.cjs.map} +1 -1
- package/dist/chunks/blockchain-identifier-BmadkNtK.js +113 -0
- package/dist/chunks/blockchain-identifier-BmadkNtK.js.map +1 -0
- package/dist/chunks/{blockchain-identifier-DtIGGlIi.cjs → blockchain-identifier-BzMQWh-C.cjs} +2 -2
- package/dist/chunks/blockchain-identifier-BzMQWh-C.cjs.map +1 -0
- package/dist/chunks/bridge-BzRlY9pP.cjs +12 -0
- package/dist/chunks/bridge-BzRlY9pP.cjs.map +1 -0
- package/dist/chunks/{bridge-DyAiDpxD.js → bridge-CTsiodO1.js} +72 -95
- package/dist/chunks/bridge-CTsiodO1.js.map +1 -0
- package/dist/chunks/{config-_8X_2sG4.js → config-hFKqUyg3.js} +2 -2
- package/dist/chunks/{config-_8X_2sG4.js.map → config-hFKqUyg3.js.map} +1 -1
- package/dist/chunks/{config-DqbLaiRi.cjs → config-l4ZaZw_g.cjs} +2 -2
- package/dist/chunks/{config-DqbLaiRi.cjs.map → config-l4ZaZw_g.cjs.map} +1 -1
- package/dist/chunks/{defi-registry-NGWlyxAY.cjs → defi-registry-BIRv_zkp.cjs} +2 -2
- package/dist/chunks/{defi-registry-NGWlyxAY.cjs.map → defi-registry-BIRv_zkp.cjs.map} +1 -1
- package/dist/chunks/{defi-registry-dhrQMy94.js → defi-registry-wNFN3qyB.js} +7 -7
- package/dist/chunks/{defi-registry-dhrQMy94.js.map → defi-registry-wNFN3qyB.js.map} +1 -1
- package/dist/chunks/{depositStatus-K6gky8zH.cjs → depositStatus-C3-EgT2a.cjs} +2 -2
- package/dist/chunks/{depositStatus-K6gky8zH.cjs.map → depositStatus-C3-EgT2a.cjs.map} +1 -1
- package/dist/chunks/{depositStatus-DeCO-K5Q.js → depositStatus-DM7fRmbN.js} +8 -8
- package/dist/chunks/{depositStatus-DeCO-K5Q.js.map → depositStatus-DM7fRmbN.js.map} +1 -1
- package/dist/chunks/{events-DIKZG4SZ.cjs → events-BTtwgCev.cjs} +2 -2
- package/dist/chunks/{events-DIKZG4SZ.cjs.map → events-BTtwgCev.cjs.map} +1 -1
- package/dist/chunks/{events-CLVUaKQS.js → events-DPi6MDRA.js} +35 -35
- package/dist/chunks/{events-CLVUaKQS.js.map → events-DPi6MDRA.js.map} +1 -1
- package/dist/chunks/{get-exchange-ratio-CM8W0jTw.cjs → get-exchange-ratio-C-7DadfD.cjs} +2 -2
- package/dist/chunks/{get-exchange-ratio-CM8W0jTw.cjs.map → get-exchange-ratio-C-7DadfD.cjs.map} +1 -1
- package/dist/chunks/get-exchange-ratio-NtnkG1kZ.js +20 -0
- package/dist/chunks/{get-exchange-ratio-B0CNEGOB.js.map → get-exchange-ratio-NtnkG1kZ.js.map} +1 -1
- package/dist/chunks/{get-positions-summary-Cled5YPA.js → get-positions-summary-B_MmGHLv.js} +4 -4
- package/dist/chunks/{get-positions-summary-Cled5YPA.js.map → get-positions-summary-B_MmGHLv.js.map} +1 -1
- package/dist/chunks/{get-positions-summary-Co7RZBiK.cjs → get-positions-summary-DkZZYbGP.cjs} +2 -2
- package/dist/chunks/{get-positions-summary-Co7RZBiK.cjs.map → get-positions-summary-DkZZYbGP.cjs.map} +1 -1
- package/dist/chunks/{get-vault-tvl-Bydlvlrv.cjs → get-vault-tvl-DmTUbOY7.cjs} +2 -2
- package/dist/chunks/{get-vault-tvl-Bydlvlrv.cjs.map → get-vault-tvl-DmTUbOY7.cjs.map} +1 -1
- package/dist/chunks/{get-vault-tvl-DxjO9xDs.js → get-vault-tvl-YAXePAW3.js} +4 -4
- package/dist/chunks/{get-vault-tvl-DxjO9xDs.js.map → get-vault-tvl-YAXePAW3.js.map} +1 -1
- package/dist/chunks/{get-vault-withdrawals-CSQqKFB8.js → get-vault-withdrawals-BrpZlt6s.js} +3 -3
- package/dist/chunks/{get-vault-withdrawals-CSQqKFB8.js.map → get-vault-withdrawals-BrpZlt6s.js.map} +1 -1
- package/dist/chunks/{get-vault-withdrawals-DBA3ok0m.cjs → get-vault-withdrawals-CWcYy_sH.cjs} +2 -2
- package/dist/chunks/{get-vault-withdrawals-DBA3ok0m.cjs.map → get-vault-withdrawals-CWcYy_sH.cjs.map} +1 -1
- package/dist/chunks/{getSharesByAddress-De7as74h.cjs → getSharesByAddress-U48H_ygt.cjs} +2 -2
- package/dist/chunks/{getSharesByAddress-De7as74h.cjs.map → getSharesByAddress-U48H_ygt.cjs.map} +1 -1
- package/dist/chunks/{getSharesByAddress-CK2q7gBI.js → getSharesByAddress-cUtkrKTq.js} +14 -14
- package/dist/chunks/{getSharesByAddress-CK2q7gBI.js.map → getSharesByAddress-cUtkrKTq.js.map} +1 -1
- package/dist/chunks/{getUserStakeAndBakeSignature--XsK93Lb.cjs → getUserStakeAndBakeSignature-BxRq2cI1.cjs} +2 -2
- package/dist/chunks/{getUserStakeAndBakeSignature--XsK93Lb.cjs.map → getUserStakeAndBakeSignature-BxRq2cI1.cjs.map} +1 -1
- package/dist/chunks/{getUserStakeAndBakeSignature-2xPkL9v_.js → getUserStakeAndBakeSignature-NGGblnJl.js} +11 -11
- package/dist/chunks/{getUserStakeAndBakeSignature-2xPkL9v_.js.map → getUserStakeAndBakeSignature-NGGblnJl.js.map} +1 -1
- package/dist/chunks/index-BKzxeh1Y.cjs.map +1 -1
- package/dist/chunks/index-CfcQ_g3t.js.map +1 -1
- package/dist/chunks/{lbtc-addresses-NHg9Gk5y.js → lbtc-addresses-BLRmtR3c.js} +2 -2
- package/dist/chunks/{lbtc-addresses-NHg9Gk5y.js.map → lbtc-addresses-BLRmtR3c.js.map} +1 -1
- package/dist/chunks/{lbtc-addresses-bj--zuK9.cjs → lbtc-addresses-xyTYV7hx.cjs} +2 -2
- package/dist/chunks/{lbtc-addresses-bj--zuK9.cjs.map → lbtc-addresses-xyTYV7hx.cjs.map} +1 -1
- package/dist/chunks/{statusConstants-ZJia15m2.js → statusConstants-CJk6vOiM.js} +844 -853
- package/dist/chunks/statusConstants-CJk6vOiM.js.map +1 -0
- package/dist/chunks/statusConstants-fmtIEEEM.cjs +2 -0
- package/dist/chunks/statusConstants-fmtIEEEM.cjs.map +1 -0
- package/dist/chunks/{storeNetworkFeeSignature-BZUZOxns.js → storeNetworkFeeSignature-BZGL2Zn_.js} +8 -8
- package/dist/chunks/{storeNetworkFeeSignature-BZUZOxns.js.map → storeNetworkFeeSignature-BZGL2Zn_.js.map} +1 -1
- package/dist/chunks/{storeNetworkFeeSignature-pV7xUOSo.cjs → storeNetworkFeeSignature-D7yo6lDV.cjs} +2 -2
- package/dist/chunks/{storeNetworkFeeSignature-pV7xUOSo.cjs.map → storeNetworkFeeSignature-D7yo6lDV.cjs.map} +1 -1
- package/dist/chunks/token-addresses-DRBecUa7.cjs +2 -0
- package/dist/chunks/token-addresses-DRBecUa7.cjs.map +1 -0
- package/dist/chunks/token-addresses-FKpA3uc4.js +541 -0
- package/dist/chunks/token-addresses-FKpA3uc4.js.map +1 -0
- package/dist/chunks/{tokens-Bw35TZqd.js → tokens-C6qZHzph.js} +28 -30
- package/dist/chunks/tokens-C6qZHzph.js.map +1 -0
- package/dist/chunks/tokens-D_HeVB5p.cjs +2 -0
- package/dist/chunks/tokens-D_HeVB5p.cjs.map +1 -0
- package/dist/chunks/{unstakeLBTC-Huy_ncVl.js → unstakeLBTC-B4Rwf65e.js} +141 -129
- package/dist/chunks/unstakeLBTC-B4Rwf65e.js.map +1 -0
- package/dist/chunks/unstakeLBTC-Wlfi14de.cjs +2 -0
- package/dist/chunks/unstakeLBTC-Wlfi14de.cjs.map +1 -0
- package/dist/chunks/{withdraw-Z77x7Hj4.cjs → withdraw-C1fMFSwy.cjs} +2 -2
- package/dist/chunks/{withdraw-Z77x7Hj4.cjs.map → withdraw-C1fMFSwy.cjs.map} +1 -1
- package/dist/chunks/{withdraw-CVNVJ7-x.js → withdraw-hHueI2p7.js} +9 -9
- package/dist/chunks/{withdraw-CVNVJ7-x.js.map → withdraw-hHueI2p7.js.map} +1 -1
- package/dist/clients/rpc-url-config.d.ts.map +1 -1
- package/dist/common/chains.d.ts +343 -112
- package/dist/common/chains.d.ts.map +1 -1
- package/dist/common/feature-config.d.ts.map +1 -1
- package/dist/contract-functions/getLBTCMintingFee/getLBTCMintingFee.d.ts +27 -0
- package/dist/contract-functions/getLBTCMintingFee/getLBTCMintingFee.d.ts.map +1 -1
- package/dist/contract-functions/signLbtcDestionationAddr/signLbtcDestinationAddr.d.ts +26 -0
- package/dist/contract-functions/signLbtcDestionationAddr/signLbtcDestinationAddr.d.ts.map +1 -1
- package/dist/contracts.cjs +1 -1
- package/dist/contracts.js +26 -24
- package/dist/core/chains/catalog.d.ts.map +1 -1
- package/dist/core/chains/types.d.ts +0 -1
- package/dist/core/chains/types.d.ts.map +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +29 -29
- package/dist/defi.cjs +1 -1
- package/dist/defi.js +3 -3
- package/dist/entries/contracts.d.ts +2 -2
- package/dist/entries/contracts.d.ts.map +1 -1
- package/dist/entries/evm.d.ts +1 -1
- package/dist/entries/evm.d.ts.map +1 -1
- package/dist/entries/utils.d.ts +1 -1
- package/dist/entries/utils.d.ts.map +1 -1
- package/dist/evm.cjs +1 -1
- package/dist/evm.js +34 -35
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +188 -187
- package/dist/metrics.cjs +1 -1
- package/dist/metrics.js +1 -1
- package/dist/stories/components/decorators/wagmi-decorator.d.ts.map +1 -1
- package/dist/tokens/token-addresses.d.ts.map +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +48 -49
- package/dist/vaults.cjs +1 -1
- package/dist/vaults.js +15 -15
- package/package.json +2 -2
- package/dist/chunks/approveLBTC-DOP0wsm3.js +0 -26
- package/dist/chunks/blockchain-identifier-DtIGGlIi.cjs.map +0 -1
- package/dist/chunks/blockchain-identifier-PNEhu-QU.js +0 -113
- package/dist/chunks/blockchain-identifier-PNEhu-QU.js.map +0 -1
- package/dist/chunks/bridge-DkZMwO7c.cjs +0 -12
- package/dist/chunks/bridge-DkZMwO7c.cjs.map +0 -1
- package/dist/chunks/bridge-DyAiDpxD.js.map +0 -1
- package/dist/chunks/get-exchange-ratio-B0CNEGOB.js +0 -20
- package/dist/chunks/statusConstants-DTDi_4Go.cjs +0 -2
- package/dist/chunks/statusConstants-DTDi_4Go.cjs.map +0 -1
- package/dist/chunks/statusConstants-ZJia15m2.js.map +0 -1
- package/dist/chunks/token-addresses-D859i6tX.cjs +0 -2
- package/dist/chunks/token-addresses-D859i6tX.cjs.map +0 -1
- package/dist/chunks/token-addresses-DmAr89jP.js +0 -579
- package/dist/chunks/token-addresses-DmAr89jP.js.map +0 -1
- package/dist/chunks/tokens-Bw35TZqd.js.map +0 -1
- package/dist/chunks/tokens-DLGMNeqZ.cjs +0 -2
- package/dist/chunks/tokens-DLGMNeqZ.cjs.map +0 -1
- package/dist/chunks/unstakeLBTC-CqZzj9WL.cjs +0 -2
- package/dist/chunks/unstakeLBTC-CqZzj9WL.cjs.map +0 -1
- package/dist/chunks/unstakeLBTC-Huy_ncVl.js.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
var Fe = Object.defineProperty;
|
|
2
|
-
var je = (
|
|
3
|
-
var I = (
|
|
2
|
+
var je = (s, e, t) => e in s ? Fe(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var I = (s, e, t) => je(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import { r as T } from "./index-CfcQ_g3t.js";
|
|
5
|
-
import { A as V } from "./defi-registry-
|
|
6
|
-
import {
|
|
5
|
+
import { A as V } from "./defi-registry-wNFN3qyB.js";
|
|
6
|
+
import { L as He, H as ze, d as We, S as qe, c as Ge, K as Ke, h as Ye, g as Je } from "./token-addresses-FKpA3uc4.js";
|
|
7
7
|
import * as me from "bitcoinjs-lib";
|
|
8
8
|
import { M as Xe } from "./constants-CuT4axsy.js";
|
|
9
|
-
const Qe = "4.
|
|
10
|
-
var et = /* @__PURE__ */ ((
|
|
9
|
+
const Qe = "4.3.0", ss = "@lombard.finance/sdk", ns = typeof window < "u" && typeof window.document < "u" ? "browser" : typeof process < "u" && process.versions && process.versions.node ? "node" : "unknown";
|
|
10
|
+
var et = /* @__PURE__ */ ((s) => (s.UNKNOWN_ERROR = "unknown-error", s.INVALID_CONFIGURATION = "invalid-configuration", s.OPERATION_TIMEOUT = "operation-timeout", s.OPERATION_CANCELLED = "operation-cancelled", s))(et || {}), tt = /* @__PURE__ */ ((s) => (s.PROVIDER_MISSING = "provider-missing", s.PROVIDER_INITIALIZATION_FAILED = "provider-initialization-failed", s.PROVIDER_CALL_FAILED = "provider-call-failed", s.SIGNER_MISSING = "signer-missing", s.USER_REJECTED = "user-rejected", s.NETWORK_MISMATCH = "network-mismatch", s))(tt || {}), st = /* @__PURE__ */ ((s) => (s.ROUTE_NOT_FOUND = "route-not-found", s.INVALID_ROUTE_DEFINITION = "invalid-route-definition", s.UNSUPPORTED_CHAIN = "unsupported-chain", s.UNSUPPORTED_ASSET = "unsupported-asset", s.INCOMPATIBLE_ROUTE = "incompatible-route", s.ENVIRONMENT_MISMATCH = "environment-mismatch", s))(st || {}), Z = /* @__PURE__ */ ((s) => (s.INVALID_ADDRESS = "invalid-address", s.INVALID_AMOUNT = "invalid-amount", s.AMOUNT_TOO_SMALL = "amount-too-small", s.AMOUNT_TOO_LARGE = "amount-too-large", s.INSUFFICIENT_BALANCE = "insufficient-balance", s.INVALID_PARAMETER = "invalid-parameter", s.MISSING_REQUIRED_PARAMETER = "missing-required-parameter", s.INVALID_CHAIN = "invalid-chain", s.INVALID_STATE = "invalid-state", s.INVALID_ASSET = "invalid-asset", s))(Z || {}), nt = /* @__PURE__ */ ((s) => (s.CONTRACT_CALL_FAILED = "contract-call-failed", s.TRANSACTION_FAILED = "transaction-failed", s.TRANSACTION_REVERTED = "transaction-reverted", s.APPROVAL_FAILED = "approval-failed", s.INSUFFICIENT_ALLOWANCE = "insufficient-allowance", s.GAS_ESTIMATION_FAILED = "gas-estimation-failed", s))(nt || {}), at = /* @__PURE__ */ ((s) => (s.INSUFFICIENT_SHARES = "withdraw-insufficient-shares", s.INVALID_AMOUNT = "withdraw-invalid-amount", s.NO_PENDING_WITHDRAWAL = "withdraw-no-pending", s.WITHDRAWAL_ALREADY_FULFILLED = "withdraw-already-fulfilled", s.WITHDRAWAL_EXPIRED = "withdraw-expired", s.WITHDRAWAL_NOT_FOUND = "withdraw-not-found", s.PROTOCOL_NOT_SUPPORTED = "withdraw-protocol-not-supported", s.INSUFFICIENT_LIQUIDITY = "withdraw-insufficient-liquidity", s))(at || {});
|
|
11
11
|
class E extends Error {
|
|
12
|
-
constructor(t,
|
|
13
|
-
super(
|
|
12
|
+
constructor(t, n, a) {
|
|
13
|
+
super(n);
|
|
14
14
|
/** Machine-readable error code */
|
|
15
15
|
I(this, "code");
|
|
16
16
|
/** Additional metadata for debugging */
|
|
@@ -84,11 +84,11 @@ class E extends Error {
|
|
|
84
84
|
/**
|
|
85
85
|
* Factory: Provider missing error
|
|
86
86
|
*/
|
|
87
|
-
static providerMissing(t,
|
|
87
|
+
static providerMissing(t, n) {
|
|
88
88
|
return new E(
|
|
89
89
|
"provider-missing",
|
|
90
|
-
`${
|
|
91
|
-
{ chain: t, providerType:
|
|
90
|
+
`${n} provider not configured for chain ${t}. Please provide a provider via SDK initialization.`,
|
|
91
|
+
{ chain: t, providerType: n }
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
94
|
static moduleMissing(t) {
|
|
@@ -101,8 +101,8 @@ class E extends Error {
|
|
|
101
101
|
/**
|
|
102
102
|
* Factory: Provider call failed error
|
|
103
103
|
*/
|
|
104
|
-
static providerCallFailed(t,
|
|
105
|
-
const a =
|
|
104
|
+
static providerCallFailed(t, n) {
|
|
105
|
+
const a = n instanceof Error ? n.message : n;
|
|
106
106
|
return new E(
|
|
107
107
|
"provider-call-failed",
|
|
108
108
|
`Provider method ${t} failed: ${a}`,
|
|
@@ -152,19 +152,19 @@ class E extends Error {
|
|
|
152
152
|
/**
|
|
153
153
|
* Factory: Invalid parameter
|
|
154
154
|
*/
|
|
155
|
-
static invalidParameter(t,
|
|
156
|
-
return new E("invalid-parameter",
|
|
155
|
+
static invalidParameter(t, n) {
|
|
156
|
+
return new E("invalid-parameter", n, {
|
|
157
157
|
parameter: t
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
161
161
|
* Factory: Invalid address
|
|
162
162
|
*/
|
|
163
|
-
static invalidAddress(t,
|
|
163
|
+
static invalidAddress(t, n) {
|
|
164
164
|
return new E(
|
|
165
165
|
"invalid-address",
|
|
166
|
-
`Invalid address format: ${t}${
|
|
167
|
-
{ address: t, chain:
|
|
166
|
+
`Invalid address format: ${t}${n ? ` for chain ${n}` : ""}`,
|
|
167
|
+
{ address: t, chain: n }
|
|
168
168
|
);
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
@@ -178,21 +178,21 @@ class E extends Error {
|
|
|
178
178
|
/**
|
|
179
179
|
* Factory: Amount too small
|
|
180
180
|
*/
|
|
181
|
-
static amountTooSmall(t,
|
|
181
|
+
static amountTooSmall(t, n, a) {
|
|
182
182
|
return new E(
|
|
183
183
|
"amount-too-small",
|
|
184
|
-
`Amount ${t} is below minimum ${
|
|
185
|
-
{ amount: t, minimum:
|
|
184
|
+
`Amount ${t} is below minimum ${n} ${a}`,
|
|
185
|
+
{ amount: t, minimum: n, asset: a }
|
|
186
186
|
);
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
189
|
* Factory: Insufficient balance
|
|
190
190
|
*/
|
|
191
|
-
static insufficientBalance(t,
|
|
191
|
+
static insufficientBalance(t, n, a) {
|
|
192
192
|
return new E(
|
|
193
193
|
"insufficient-balance",
|
|
194
|
-
`Insufficient ${a} balance. Required: ${t}, Available: ${
|
|
195
|
-
{ required: t, available:
|
|
194
|
+
`Insufficient ${a} balance. Required: ${t}, Available: ${n}`,
|
|
195
|
+
{ required: t, available: n, asset: a }
|
|
196
196
|
);
|
|
197
197
|
}
|
|
198
198
|
/**
|
|
@@ -208,42 +208,42 @@ class E extends Error {
|
|
|
208
208
|
/**
|
|
209
209
|
* Factory: Transaction failed
|
|
210
210
|
*/
|
|
211
|
-
static transactionFailed(t,
|
|
211
|
+
static transactionFailed(t, n) {
|
|
212
212
|
return new E(
|
|
213
213
|
"transaction-failed",
|
|
214
|
-
`Transaction failed: ${
|
|
215
|
-
{ txHash: t, reason:
|
|
214
|
+
`Transaction failed: ${n}`,
|
|
215
|
+
{ txHash: t, reason: n }
|
|
216
216
|
);
|
|
217
217
|
}
|
|
218
218
|
/**
|
|
219
219
|
* Factory: Transaction reverted
|
|
220
220
|
*/
|
|
221
|
-
static transactionReverted(t,
|
|
221
|
+
static transactionReverted(t, n) {
|
|
222
222
|
return new E(
|
|
223
223
|
"transaction-reverted",
|
|
224
|
-
`Transaction reverted${
|
|
225
|
-
{ txHash: t, revertReason:
|
|
224
|
+
`Transaction reverted${n ? `: ${n}` : ""}`,
|
|
225
|
+
{ txHash: t, revertReason: n }
|
|
226
226
|
);
|
|
227
227
|
}
|
|
228
228
|
/**
|
|
229
229
|
* Factory: Approval failed
|
|
230
230
|
*/
|
|
231
|
-
static approvalFailed(t,
|
|
231
|
+
static approvalFailed(t, n) {
|
|
232
232
|
return new E(
|
|
233
233
|
"approval-failed",
|
|
234
|
-
`Failed to approve ${t} for spender ${
|
|
235
|
-
{ token: t, spender:
|
|
234
|
+
`Failed to approve ${t} for spender ${n}`,
|
|
235
|
+
{ token: t, spender: n }
|
|
236
236
|
);
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
function rt(
|
|
240
|
-
return
|
|
239
|
+
function rt(s) {
|
|
240
|
+
return s instanceof E;
|
|
241
241
|
}
|
|
242
|
-
function pe(
|
|
243
|
-
return rt(
|
|
244
|
-
originalError:
|
|
245
|
-
}) : new E("unknown-error", String(
|
|
246
|
-
originalValue:
|
|
242
|
+
function pe(s) {
|
|
243
|
+
return rt(s) ? s : s instanceof Error ? new E("unknown-error", s.message, {
|
|
244
|
+
originalError: s.stack
|
|
245
|
+
}) : new E("unknown-error", String(s), {
|
|
246
|
+
originalValue: s
|
|
247
247
|
});
|
|
248
248
|
}
|
|
249
249
|
const p = {
|
|
@@ -258,86 +258,85 @@ const p = {
|
|
|
258
258
|
RIPPLE: "ripple",
|
|
259
259
|
DOGECOIN: "dogecoin",
|
|
260
260
|
HYPERLIQUID: "hyperliquid"
|
|
261
|
-
}, fe = ":",
|
|
261
|
+
}, fe = ":", y = (s, e) => `${s}${fe}${e}`, o = {
|
|
262
262
|
// Bitcoin chains (BIP122: first 32 chars of genesis block hash in little-endian)
|
|
263
|
-
BITCOIN_MAINNET:
|
|
263
|
+
BITCOIN_MAINNET: y(
|
|
264
264
|
p.BIP122,
|
|
265
265
|
"000000000019d6689c085ae165831e93"
|
|
266
266
|
),
|
|
267
|
-
BITCOIN_SIGNET:
|
|
267
|
+
BITCOIN_SIGNET: y(
|
|
268
268
|
p.BIP122,
|
|
269
269
|
"00000008819873e925422c1ff0f99f7c"
|
|
270
270
|
),
|
|
271
271
|
// EVM chains (EIP155: numeric chain ID)
|
|
272
|
-
ETHEREUM:
|
|
273
|
-
BASE:
|
|
274
|
-
BASE_SEPOLIA:
|
|
275
|
-
OPTIMISM:
|
|
276
|
-
POLYGON:
|
|
277
|
-
BSC:
|
|
278
|
-
BSC_TESTNET:
|
|
279
|
-
AVALANCHE:
|
|
280
|
-
AVALANCHE_FUJI:
|
|
281
|
-
BERACHAIN:
|
|
282
|
-
BERACHAIN_BARTIO:
|
|
283
|
-
BOB:
|
|
284
|
-
CORN:
|
|
285
|
-
ETHERLINK:
|
|
286
|
-
KATANA:
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
SONIC_BLAZE_TESTNET: g(p.EIP155, 57054),
|
|
272
|
+
ETHEREUM: y(p.EIP155, 1),
|
|
273
|
+
BASE: y(p.EIP155, 8453),
|
|
274
|
+
BASE_SEPOLIA: y(p.EIP155, 84532),
|
|
275
|
+
OPTIMISM: y(p.EIP155, 10),
|
|
276
|
+
POLYGON: y(p.EIP155, 137),
|
|
277
|
+
BSC: y(p.EIP155, 56),
|
|
278
|
+
BSC_TESTNET: y(p.EIP155, 97),
|
|
279
|
+
AVALANCHE: y(p.EIP155, 43114),
|
|
280
|
+
AVALANCHE_FUJI: y(p.EIP155, 43113),
|
|
281
|
+
BERACHAIN: y(p.EIP155, 80094),
|
|
282
|
+
BERACHAIN_BARTIO: y(p.EIP155, 80084),
|
|
283
|
+
BOB: y(p.EIP155, 60808),
|
|
284
|
+
CORN: y(p.EIP155, 21e6),
|
|
285
|
+
ETHERLINK: y(p.EIP155, 42793),
|
|
286
|
+
KATANA: y(p.EIP155, 747474),
|
|
287
|
+
MORPH: y(p.EIP155, 2818),
|
|
288
|
+
SONIC: y(p.EIP155, 146),
|
|
289
|
+
SONIC_TESTNET: y(p.EIP155, 57054),
|
|
290
|
+
SONIC_BLAZE_TESTNET: y(p.EIP155, 57054),
|
|
292
291
|
// Alias
|
|
293
|
-
SWELL:
|
|
294
|
-
TAC:
|
|
295
|
-
SEPOLIA:
|
|
296
|
-
HOLESKY:
|
|
297
|
-
MEGAETH:
|
|
298
|
-
MONAD:
|
|
299
|
-
STABLE:
|
|
292
|
+
SWELL: y(p.EIP155, 1923),
|
|
293
|
+
TAC: y(p.EIP155, 239),
|
|
294
|
+
SEPOLIA: y(p.EIP155, 11155111),
|
|
295
|
+
HOLESKY: y(p.EIP155, 17e3),
|
|
296
|
+
MEGAETH: y(p.EIP155, 4326),
|
|
297
|
+
MONAD: y(p.EIP155, 143),
|
|
298
|
+
STABLE: y(p.EIP155, 988),
|
|
300
299
|
// Solana chains (first 32 chars of genesis hash)
|
|
301
|
-
SOLANA_MAINNET:
|
|
300
|
+
SOLANA_MAINNET: y(
|
|
302
301
|
p.SOLANA,
|
|
303
302
|
"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"
|
|
304
303
|
),
|
|
305
|
-
SOLANA_DEVNET:
|
|
304
|
+
SOLANA_DEVNET: y(
|
|
306
305
|
p.SOLANA,
|
|
307
306
|
"EtWTRABZaYq6iMfeYKouRu166VU2xqa1"
|
|
308
307
|
),
|
|
309
|
-
SOLANA_TESTNET:
|
|
308
|
+
SOLANA_TESTNET: y(
|
|
310
309
|
p.SOLANA,
|
|
311
310
|
"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"
|
|
312
311
|
),
|
|
313
312
|
// Sui chains (unofficial namespace, using cluster names)
|
|
314
|
-
SUI_MAINNET:
|
|
315
|
-
SUI_TESTNET:
|
|
316
|
-
SUI_DEVNET:
|
|
313
|
+
SUI_MAINNET: y(p.SUI, "mainnet"),
|
|
314
|
+
SUI_TESTNET: y(p.SUI, "testnet"),
|
|
315
|
+
SUI_DEVNET: y(p.SUI, "devnet"),
|
|
317
316
|
// Starknet chains (uses network identifiers)
|
|
318
|
-
STARKNET_MAINNET:
|
|
319
|
-
STARKNET_SEPOLIA:
|
|
317
|
+
STARKNET_MAINNET: y(p.STARKNET, "SN_MAIN"),
|
|
318
|
+
STARKNET_SEPOLIA: y(p.STARKNET, "SN_SEPOLIA"),
|
|
320
319
|
// Zcash (unofficial namespace)
|
|
321
|
-
ZCASH_MAINNET:
|
|
322
|
-
ZCASH_TESTNET:
|
|
320
|
+
ZCASH_MAINNET: y(p.ZCASH, "mainnet"),
|
|
321
|
+
ZCASH_TESTNET: y(p.ZCASH, "testnet"),
|
|
323
322
|
// Ripple (unofficial namespace)
|
|
324
|
-
RIPPLE_MAINNET:
|
|
325
|
-
RIPPLE_TESTNET:
|
|
323
|
+
RIPPLE_MAINNET: y(p.RIPPLE, "mainnet"),
|
|
324
|
+
RIPPLE_TESTNET: y(p.RIPPLE, "testnet"),
|
|
326
325
|
// Dogecoin (unofficial namespace)
|
|
327
|
-
DOGECOIN_MAINNET:
|
|
328
|
-
DOGECOIN_TESTNET:
|
|
326
|
+
DOGECOIN_MAINNET: y(p.DOGECOIN, "mainnet"),
|
|
327
|
+
DOGECOIN_TESTNET: y(p.DOGECOIN, "testnet"),
|
|
329
328
|
// Custodial (unofficial namespace)
|
|
330
|
-
HYPERLIQUID:
|
|
329
|
+
HYPERLIQUID: y(p.HYPERLIQUID, "mainnet")
|
|
331
330
|
};
|
|
332
|
-
function
|
|
331
|
+
function as(s) {
|
|
333
332
|
return Object.keys(o).find(
|
|
334
|
-
(e) => o[e] ===
|
|
333
|
+
(e) => o[e] === s
|
|
335
334
|
) ?? "";
|
|
336
335
|
}
|
|
337
|
-
function
|
|
338
|
-
return typeof
|
|
336
|
+
function rs(s) {
|
|
337
|
+
return typeof s == "string" && Object.values(o).includes(s);
|
|
339
338
|
}
|
|
340
|
-
const
|
|
339
|
+
const K = {
|
|
341
340
|
// ─────────────────────────────────────────────────────────────────────────
|
|
342
341
|
// Bitcoin
|
|
343
342
|
// ─────────────────────────────────────────────────────────────────────────
|
|
@@ -484,7 +483,7 @@ const G = {
|
|
|
484
483
|
name: "MegaETH",
|
|
485
484
|
type: "evm",
|
|
486
485
|
isTestnet: !1,
|
|
487
|
-
explorerUrl: "https://megaeth
|
|
486
|
+
explorerUrl: "https://megaeth.blockscout.com",
|
|
488
487
|
nativeCurrency: "ETH",
|
|
489
488
|
badgeVariant: "info"
|
|
490
489
|
},
|
|
@@ -539,14 +538,6 @@ const G = {
|
|
|
539
538
|
nativeCurrency: "BERA",
|
|
540
539
|
badgeVariant: "secondary"
|
|
541
540
|
},
|
|
542
|
-
[o.KATANA_TATARA]: {
|
|
543
|
-
name: "Katana Tatara",
|
|
544
|
-
type: "evm",
|
|
545
|
-
isTestnet: !0,
|
|
546
|
-
explorerUrl: "https://explorer.tatara.katanarpc.com",
|
|
547
|
-
nativeCurrency: "BTC.b",
|
|
548
|
-
badgeVariant: "secondary"
|
|
549
|
-
},
|
|
550
541
|
// Note: SONIC_TESTNET and SONIC_BLAZE_TESTNET are the same chain (eip155:57054)
|
|
551
542
|
[o.SONIC_TESTNET]: {
|
|
552
543
|
name: "Sonic Blaze Testnet",
|
|
@@ -710,82 +701,82 @@ const G = {
|
|
|
710
701
|
badgeVariant: "secondary"
|
|
711
702
|
}
|
|
712
703
|
}, it = {
|
|
713
|
-
"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":
|
|
714
|
-
EtWTRABZaYq6iMfeYKouRu166VU2xqa1:
|
|
715
|
-
"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z":
|
|
704
|
+
"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": Ge,
|
|
705
|
+
EtWTRABZaYq6iMfeYKouRu166VU2xqa1: qe,
|
|
706
|
+
"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z": We
|
|
716
707
|
}, ct = {
|
|
717
708
|
SN_MAIN: Je,
|
|
718
709
|
SN_SEPOLIA: Ye
|
|
719
710
|
};
|
|
720
|
-
function ot(
|
|
721
|
-
return ct[
|
|
711
|
+
function ot(s) {
|
|
712
|
+
return ct[s];
|
|
722
713
|
}
|
|
723
|
-
function
|
|
724
|
-
return
|
|
714
|
+
function is(s) {
|
|
715
|
+
return K[s];
|
|
725
716
|
}
|
|
726
|
-
function
|
|
727
|
-
return
|
|
717
|
+
function cs(s) {
|
|
718
|
+
return K[s].name;
|
|
728
719
|
}
|
|
729
|
-
function
|
|
730
|
-
return
|
|
720
|
+
function os(s) {
|
|
721
|
+
return K[s].type;
|
|
731
722
|
}
|
|
732
|
-
function
|
|
733
|
-
return
|
|
723
|
+
function ds(s) {
|
|
724
|
+
return K[s].isTestnet;
|
|
734
725
|
}
|
|
735
|
-
function
|
|
736
|
-
return !
|
|
726
|
+
function us(s) {
|
|
727
|
+
return !K[s].isTestnet;
|
|
737
728
|
}
|
|
738
|
-
function Le(
|
|
739
|
-
return
|
|
729
|
+
function Le(s) {
|
|
730
|
+
return K[s].type === "evm";
|
|
740
731
|
}
|
|
741
|
-
const Q = (
|
|
742
|
-
function
|
|
732
|
+
const Q = (s) => `${s}${fe}`;
|
|
733
|
+
function ls(s) {
|
|
743
734
|
const e = Q(p.EIP155);
|
|
744
|
-
if (
|
|
745
|
-
const r = Number.parseInt(
|
|
735
|
+
if (s.startsWith(e)) {
|
|
736
|
+
const r = Number.parseInt(s.slice(e.length), 10);
|
|
746
737
|
if (He(r)) return r;
|
|
747
738
|
throw new E(
|
|
748
739
|
Z.INVALID_CHAIN,
|
|
749
|
-
`Invalid EVM chain: ${
|
|
740
|
+
`Invalid EVM chain: ${s}`
|
|
750
741
|
);
|
|
751
742
|
}
|
|
752
743
|
const t = Q(p.SOLANA);
|
|
753
|
-
if (
|
|
754
|
-
const r =
|
|
744
|
+
if (s.startsWith(t)) {
|
|
745
|
+
const r = s.slice(t.length), i = `solana:${r}`;
|
|
755
746
|
if (ze(i)) return i;
|
|
756
747
|
const c = it[r];
|
|
757
748
|
if (c) return c;
|
|
758
749
|
throw new E(
|
|
759
750
|
Z.INVALID_CHAIN,
|
|
760
|
-
`Invalid Solana chain: ${
|
|
751
|
+
`Invalid Solana chain: ${s}`
|
|
761
752
|
);
|
|
762
753
|
}
|
|
763
|
-
const
|
|
764
|
-
if (
|
|
765
|
-
if (
|
|
754
|
+
const n = Q(p.SUI);
|
|
755
|
+
if (s.startsWith(n)) {
|
|
756
|
+
if (Ke(s)) return s;
|
|
766
757
|
throw new E(
|
|
767
758
|
Z.INVALID_CHAIN,
|
|
768
|
-
`Invalid Sui chain: ${
|
|
759
|
+
`Invalid Sui chain: ${s}`
|
|
769
760
|
);
|
|
770
761
|
}
|
|
771
762
|
const a = Q(p.STARKNET);
|
|
772
|
-
if (
|
|
773
|
-
const r =
|
|
763
|
+
if (s.startsWith(a)) {
|
|
764
|
+
const r = s.slice(a.length), i = ot(r);
|
|
774
765
|
if (i) return i;
|
|
775
766
|
throw new E(
|
|
776
767
|
Z.INVALID_CHAIN,
|
|
777
|
-
`Invalid Starknet chain: ${
|
|
768
|
+
`Invalid Starknet chain: ${s}`
|
|
778
769
|
);
|
|
779
770
|
}
|
|
780
771
|
throw new E(
|
|
781
772
|
Z.INVALID_CHAIN,
|
|
782
|
-
`Invalid chain: ${
|
|
773
|
+
`Invalid chain: ${s}`
|
|
783
774
|
);
|
|
784
775
|
}
|
|
785
|
-
function
|
|
786
|
-
return `${p.EIP155}${fe}${
|
|
776
|
+
function fs(s) {
|
|
777
|
+
return `${p.EIP155}${fe}${s}`;
|
|
787
778
|
}
|
|
788
|
-
const
|
|
779
|
+
const N = {
|
|
789
780
|
version: "1.0.0",
|
|
790
781
|
assets: {
|
|
791
782
|
// ═══════════════════════════════════════════════════════════════════════
|
|
@@ -1086,46 +1077,46 @@ const S = {
|
|
|
1086
1077
|
}
|
|
1087
1078
|
}
|
|
1088
1079
|
}, dt = 8;
|
|
1089
|
-
function Y(
|
|
1090
|
-
const a =
|
|
1080
|
+
function Y(s, e, t, n) {
|
|
1081
|
+
const a = s.assets[e];
|
|
1091
1082
|
if (a)
|
|
1092
1083
|
return a.deployments.find(
|
|
1093
1084
|
(r) => {
|
|
1094
1085
|
var i;
|
|
1095
|
-
return r.env === t && (r.chain ===
|
|
1086
|
+
return r.env === t && (r.chain === n || ((i = r.chains) == null ? void 0 : i.includes(n)));
|
|
1096
1087
|
}
|
|
1097
1088
|
);
|
|
1098
1089
|
}
|
|
1099
|
-
function
|
|
1090
|
+
function hs(s, e, t, n = N) {
|
|
1100
1091
|
var a;
|
|
1101
|
-
return (a = Y(
|
|
1092
|
+
return (a = Y(n, s, e, t)) == null ? void 0 : a.address;
|
|
1102
1093
|
}
|
|
1103
|
-
function
|
|
1094
|
+
function ms(s, e = N) {
|
|
1104
1095
|
var t;
|
|
1105
|
-
return ((t = e.assets[
|
|
1096
|
+
return ((t = e.assets[s]) == null ? void 0 : t.decimals) ?? dt;
|
|
1106
1097
|
}
|
|
1107
|
-
function
|
|
1098
|
+
function ps(s, e, t, n = N) {
|
|
1108
1099
|
var a;
|
|
1109
|
-
return (a = Y(
|
|
1100
|
+
return (a = Y(n, s, e, t)) == null ? void 0 : a.assetRouter;
|
|
1110
1101
|
}
|
|
1111
|
-
function
|
|
1102
|
+
function gs(s, e, t, n = N) {
|
|
1112
1103
|
var a;
|
|
1113
|
-
return !!((a = Y(
|
|
1104
|
+
return !!((a = Y(n, s, e, t)) != null && a.assetRouter);
|
|
1114
1105
|
}
|
|
1115
|
-
function
|
|
1106
|
+
function vs(s, e, t, n = N) {
|
|
1116
1107
|
var a;
|
|
1117
|
-
return (a = Y(
|
|
1108
|
+
return (a = Y(n, s, e, t)) == null ? void 0 : a.bridgeAdapter;
|
|
1118
1109
|
}
|
|
1119
|
-
function
|
|
1110
|
+
function ys(s, e, t, n = N) {
|
|
1120
1111
|
var a;
|
|
1121
|
-
return (a = Y(
|
|
1112
|
+
return (a = Y(n, s, e, t)) == null ? void 0 : a.publicMarketMaker;
|
|
1122
1113
|
}
|
|
1123
|
-
function
|
|
1124
|
-
return !!Y(
|
|
1114
|
+
function _s(s, e, t, n = N) {
|
|
1115
|
+
return !!Y(n, s, e, t);
|
|
1125
1116
|
}
|
|
1126
|
-
function
|
|
1127
|
-
const a =
|
|
1128
|
-
for (const [r, i] of Object.entries(
|
|
1117
|
+
function As(s, e, t, n = N) {
|
|
1118
|
+
const a = s.toLowerCase();
|
|
1119
|
+
for (const [r, i] of Object.entries(n.assets)) {
|
|
1129
1120
|
if (!i) continue;
|
|
1130
1121
|
if (i.deployments.find(
|
|
1131
1122
|
(u) => {
|
|
@@ -1135,65 +1126,65 @@ function Tn(n, e, t, s = S) {
|
|
|
1135
1126
|
)) return r;
|
|
1136
1127
|
}
|
|
1137
1128
|
}
|
|
1138
|
-
function
|
|
1139
|
-
const
|
|
1140
|
-
if (!
|
|
1129
|
+
function Ts(s, e, t = N) {
|
|
1130
|
+
const n = t.assets[s];
|
|
1131
|
+
if (!n) return [];
|
|
1141
1132
|
const a = [];
|
|
1142
|
-
for (const r of
|
|
1133
|
+
for (const r of n.deployments)
|
|
1143
1134
|
r.env === e && (r.chain && a.push(r.chain), r.chains && a.push(...r.chains));
|
|
1144
1135
|
return a;
|
|
1145
1136
|
}
|
|
1146
|
-
function
|
|
1137
|
+
function Es(s, e, t = N) {
|
|
1147
1138
|
var r;
|
|
1148
|
-
const
|
|
1149
|
-
if (!
|
|
1139
|
+
const n = t.assets[s];
|
|
1140
|
+
if (!n) return [];
|
|
1150
1141
|
const a = /* @__PURE__ */ new Set();
|
|
1151
|
-
for (const i of
|
|
1142
|
+
for (const i of n.deployments)
|
|
1152
1143
|
(i.chain === e || (r = i.chains) != null && r.includes(e)) && a.add(i.env);
|
|
1153
1144
|
return Array.from(a);
|
|
1154
1145
|
}
|
|
1155
|
-
function
|
|
1156
|
-
return Object.keys(
|
|
1146
|
+
function bs(s = N) {
|
|
1147
|
+
return Object.keys(s.assets);
|
|
1157
1148
|
}
|
|
1158
|
-
function
|
|
1159
|
-
const t = e.assets[
|
|
1149
|
+
function xs(s, e = N) {
|
|
1150
|
+
const t = e.assets[s];
|
|
1160
1151
|
if (!t) return [];
|
|
1161
|
-
const
|
|
1152
|
+
const n = /* @__PURE__ */ new Set();
|
|
1162
1153
|
for (const a of t.deployments)
|
|
1163
|
-
a.chain &&
|
|
1164
|
-
return Array.from(
|
|
1154
|
+
a.chain && n.add(a.chain), a.chains && a.chains.forEach((r) => n.add(r));
|
|
1155
|
+
return Array.from(n);
|
|
1165
1156
|
}
|
|
1166
|
-
function ie(
|
|
1167
|
-
const
|
|
1168
|
-
if (!
|
|
1157
|
+
function ie(s, e, t = N) {
|
|
1158
|
+
const n = t.assets[s];
|
|
1159
|
+
if (!n) return [];
|
|
1169
1160
|
const a = /* @__PURE__ */ new Set();
|
|
1170
|
-
for (const r of
|
|
1161
|
+
for (const r of n.deployments)
|
|
1171
1162
|
e.includes(r.env) && (r.chain && a.add(r.chain), r.chains && r.chains.forEach((i) => a.add(i)));
|
|
1172
1163
|
return Array.from(a);
|
|
1173
1164
|
}
|
|
1174
|
-
function
|
|
1175
|
-
const t = e.assets[
|
|
1165
|
+
function Ss(s, e = N) {
|
|
1166
|
+
const t = e.assets[s];
|
|
1176
1167
|
if (t)
|
|
1177
1168
|
return { decimals: t.decimals, symbol: t.symbol, name: t.name };
|
|
1178
1169
|
}
|
|
1179
|
-
function
|
|
1180
|
-
return ie(
|
|
1181
|
-
(
|
|
1170
|
+
function Ns(s, e, t = N) {
|
|
1171
|
+
return ie(s, e, t).filter(
|
|
1172
|
+
(n) => Le(n)
|
|
1182
1173
|
);
|
|
1183
1174
|
}
|
|
1184
|
-
function ut(
|
|
1185
|
-
if (
|
|
1186
|
-
const
|
|
1187
|
-
for (let a = 1; a <
|
|
1188
|
-
const r = new Set(ie(
|
|
1189
|
-
for (const i of
|
|
1190
|
-
r.has(i) ||
|
|
1191
|
-
}
|
|
1192
|
-
return Array.from(
|
|
1175
|
+
function ut(s, e, t = N) {
|
|
1176
|
+
if (s.length === 0) return [];
|
|
1177
|
+
const n = new Set(ie(s[0], e, t));
|
|
1178
|
+
for (let a = 1; a < s.length; a++) {
|
|
1179
|
+
const r = new Set(ie(s[a], e, t));
|
|
1180
|
+
for (const i of n)
|
|
1181
|
+
r.has(i) || n.delete(i);
|
|
1182
|
+
}
|
|
1183
|
+
return Array.from(n);
|
|
1193
1184
|
}
|
|
1194
|
-
function
|
|
1195
|
-
return ut(
|
|
1196
|
-
(
|
|
1185
|
+
function Is(s, e, t = N) {
|
|
1186
|
+
return ut(s, e, t).filter(
|
|
1187
|
+
(n) => Le(n)
|
|
1197
1188
|
);
|
|
1198
1189
|
}
|
|
1199
1190
|
class lt {
|
|
@@ -1229,23 +1220,23 @@ class lt {
|
|
|
1229
1220
|
this.config = void 0;
|
|
1230
1221
|
}
|
|
1231
1222
|
}
|
|
1232
|
-
function De(
|
|
1223
|
+
function De(s, e) {
|
|
1233
1224
|
let t;
|
|
1234
1225
|
switch (e) {
|
|
1235
1226
|
case "evm":
|
|
1236
|
-
t =
|
|
1227
|
+
t = s.evm;
|
|
1237
1228
|
break;
|
|
1238
1229
|
case "bitcoin":
|
|
1239
|
-
t =
|
|
1230
|
+
t = s.bitcoin;
|
|
1240
1231
|
break;
|
|
1241
1232
|
case "solana":
|
|
1242
|
-
t =
|
|
1233
|
+
t = s.solana;
|
|
1243
1234
|
break;
|
|
1244
1235
|
case "sui":
|
|
1245
|
-
t =
|
|
1236
|
+
t = s.sui;
|
|
1246
1237
|
break;
|
|
1247
1238
|
case "starknet":
|
|
1248
|
-
t =
|
|
1239
|
+
t = s.starknet;
|
|
1249
1240
|
break;
|
|
1250
1241
|
default:
|
|
1251
1242
|
t = void 0;
|
|
@@ -1257,7 +1248,7 @@ class ft {
|
|
|
1257
1248
|
I(this, "modules", /* @__PURE__ */ new Map());
|
|
1258
1249
|
I(this, "services", /* @__PURE__ */ new Map());
|
|
1259
1250
|
I(this, "shared", /* @__PURE__ */ new Map());
|
|
1260
|
-
this.config = t, e.forEach((
|
|
1251
|
+
this.config = t, e.forEach((n) => this.modules.set(n.id, n));
|
|
1261
1252
|
}
|
|
1262
1253
|
/**
|
|
1263
1254
|
* Require a module service
|
|
@@ -1305,95 +1296,95 @@ class ft {
|
|
|
1305
1296
|
};
|
|
1306
1297
|
}
|
|
1307
1298
|
}
|
|
1308
|
-
function ht(
|
|
1299
|
+
function ht(s) {
|
|
1309
1300
|
return async (e) => {
|
|
1310
|
-
const t = De(
|
|
1301
|
+
const t = De(s.providers, e);
|
|
1311
1302
|
if (t)
|
|
1312
1303
|
return t();
|
|
1313
1304
|
};
|
|
1314
1305
|
}
|
|
1315
1306
|
const ge = /* @__PURE__ */ new WeakMap();
|
|
1316
|
-
function Pe(
|
|
1317
|
-
let e = ge.get(
|
|
1318
|
-
return e || (e = new ft(
|
|
1307
|
+
function Pe(s) {
|
|
1308
|
+
let e = ge.get(s);
|
|
1309
|
+
return e || (e = new ft(s.modules, s), ge.set(s, e)), e;
|
|
1319
1310
|
}
|
|
1320
|
-
function Be(
|
|
1311
|
+
function Be(s) {
|
|
1321
1312
|
return {
|
|
1322
|
-
env:
|
|
1323
|
-
partner: new lt(
|
|
1324
|
-
getProvider: ht(
|
|
1313
|
+
env: s.env,
|
|
1314
|
+
partner: new lt(s.partner),
|
|
1315
|
+
getProvider: ht(s),
|
|
1325
1316
|
logger: void 0
|
|
1326
1317
|
};
|
|
1327
1318
|
}
|
|
1328
|
-
function
|
|
1329
|
-
const e = Be(
|
|
1319
|
+
function ks(s) {
|
|
1320
|
+
const e = Be(s), t = Pe(s), n = t.require("btc"), a = t.require("api");
|
|
1330
1321
|
return {
|
|
1331
1322
|
...e,
|
|
1332
|
-
btc:
|
|
1323
|
+
btc: n,
|
|
1333
1324
|
api: a,
|
|
1334
1325
|
capabilities: t
|
|
1335
1326
|
};
|
|
1336
1327
|
}
|
|
1337
|
-
function
|
|
1338
|
-
const e = Be(
|
|
1328
|
+
function Cs(s) {
|
|
1329
|
+
const e = Be(s), n = Pe(s).require("evm");
|
|
1339
1330
|
return {
|
|
1340
1331
|
...e,
|
|
1341
|
-
evm:
|
|
1332
|
+
evm: n
|
|
1342
1333
|
};
|
|
1343
1334
|
}
|
|
1344
|
-
const
|
|
1335
|
+
const ws = {
|
|
1345
1336
|
IDLE: "idle",
|
|
1346
1337
|
PREPARING: "preparing",
|
|
1347
1338
|
READY: "ready",
|
|
1348
1339
|
EXECUTING: "executing",
|
|
1349
1340
|
COMPLETED: "completed",
|
|
1350
1341
|
FAILED: "failed"
|
|
1351
|
-
},
|
|
1342
|
+
}, Os = {
|
|
1352
1343
|
IDLE: "idle",
|
|
1353
1344
|
PENDING: "pending",
|
|
1354
1345
|
COMPLETE: "complete",
|
|
1355
1346
|
FAILED: "failed"
|
|
1356
1347
|
};
|
|
1357
1348
|
var x;
|
|
1358
|
-
(function(
|
|
1359
|
-
|
|
1349
|
+
(function(s) {
|
|
1350
|
+
s.assertEqual = (a) => {
|
|
1360
1351
|
};
|
|
1361
1352
|
function e(a) {
|
|
1362
1353
|
}
|
|
1363
|
-
|
|
1354
|
+
s.assertIs = e;
|
|
1364
1355
|
function t(a) {
|
|
1365
1356
|
throw new Error();
|
|
1366
1357
|
}
|
|
1367
|
-
|
|
1358
|
+
s.assertNever = t, s.arrayToEnum = (a) => {
|
|
1368
1359
|
const r = {};
|
|
1369
1360
|
for (const i of a)
|
|
1370
1361
|
r[i] = i;
|
|
1371
1362
|
return r;
|
|
1372
|
-
},
|
|
1373
|
-
const r =
|
|
1363
|
+
}, s.getValidEnumValues = (a) => {
|
|
1364
|
+
const r = s.objectKeys(a).filter((c) => typeof a[a[c]] != "number"), i = {};
|
|
1374
1365
|
for (const c of r)
|
|
1375
1366
|
i[c] = a[c];
|
|
1376
|
-
return
|
|
1377
|
-
},
|
|
1367
|
+
return s.objectValues(i);
|
|
1368
|
+
}, s.objectValues = (a) => s.objectKeys(a).map(function(r) {
|
|
1378
1369
|
return a[r];
|
|
1379
|
-
}),
|
|
1370
|
+
}), s.objectKeys = typeof Object.keys == "function" ? (a) => Object.keys(a) : (a) => {
|
|
1380
1371
|
const r = [];
|
|
1381
1372
|
for (const i in a)
|
|
1382
1373
|
Object.prototype.hasOwnProperty.call(a, i) && r.push(i);
|
|
1383
1374
|
return r;
|
|
1384
|
-
},
|
|
1375
|
+
}, s.find = (a, r) => {
|
|
1385
1376
|
for (const i of a)
|
|
1386
1377
|
if (r(i))
|
|
1387
1378
|
return i;
|
|
1388
|
-
},
|
|
1389
|
-
function
|
|
1379
|
+
}, s.isInteger = typeof Number.isInteger == "function" ? (a) => Number.isInteger(a) : (a) => typeof a == "number" && Number.isFinite(a) && Math.floor(a) === a;
|
|
1380
|
+
function n(a, r = " | ") {
|
|
1390
1381
|
return a.map((i) => typeof i == "string" ? `'${i}'` : i).join(r);
|
|
1391
1382
|
}
|
|
1392
|
-
|
|
1383
|
+
s.joinValues = n, s.jsonStringifyReplacer = (a, r) => typeof r == "bigint" ? r.toString() : r;
|
|
1393
1384
|
})(x || (x = {}));
|
|
1394
1385
|
var ve;
|
|
1395
|
-
(function(
|
|
1396
|
-
|
|
1386
|
+
(function(s) {
|
|
1387
|
+
s.mergeShapes = (e, t) => ({
|
|
1397
1388
|
...e,
|
|
1398
1389
|
...t
|
|
1399
1390
|
// second overwrites first
|
|
@@ -1420,14 +1411,14 @@ const f = x.arrayToEnum([
|
|
|
1420
1411
|
"never",
|
|
1421
1412
|
"map",
|
|
1422
1413
|
"set"
|
|
1423
|
-
]), D = (
|
|
1424
|
-
switch (typeof
|
|
1414
|
+
]), D = (s) => {
|
|
1415
|
+
switch (typeof s) {
|
|
1425
1416
|
case "undefined":
|
|
1426
1417
|
return f.undefined;
|
|
1427
1418
|
case "string":
|
|
1428
1419
|
return f.string;
|
|
1429
1420
|
case "number":
|
|
1430
|
-
return Number.isNaN(
|
|
1421
|
+
return Number.isNaN(s) ? f.nan : f.number;
|
|
1431
1422
|
case "boolean":
|
|
1432
1423
|
return f.boolean;
|
|
1433
1424
|
case "function":
|
|
@@ -1437,7 +1428,7 @@ const f = x.arrayToEnum([
|
|
|
1437
1428
|
case "symbol":
|
|
1438
1429
|
return f.symbol;
|
|
1439
1430
|
case "object":
|
|
1440
|
-
return Array.isArray(
|
|
1431
|
+
return Array.isArray(s) ? f.array : s === null ? f.null : s.then && typeof s.then == "function" && s.catch && typeof s.catch == "function" ? f.promise : typeof Map < "u" && s instanceof Map ? f.map : typeof Set < "u" && s instanceof Set ? f.set : typeof Date < "u" && s instanceof Date ? f.date : f.object;
|
|
1441
1432
|
default:
|
|
1442
1433
|
return f.unknown;
|
|
1443
1434
|
}
|
|
@@ -1464,10 +1455,10 @@ class R extends Error {
|
|
|
1464
1455
|
return this.issues;
|
|
1465
1456
|
}
|
|
1466
1457
|
constructor(e) {
|
|
1467
|
-
super(), this.issues = [], this.addIssue = (
|
|
1468
|
-
this.issues = [...this.issues,
|
|
1469
|
-
}, this.addIssues = (
|
|
1470
|
-
this.issues = [...this.issues, ...
|
|
1458
|
+
super(), this.issues = [], this.addIssue = (n) => {
|
|
1459
|
+
this.issues = [...this.issues, n];
|
|
1460
|
+
}, this.addIssues = (n = []) => {
|
|
1461
|
+
this.issues = [...this.issues, ...n];
|
|
1471
1462
|
};
|
|
1472
1463
|
const t = new.target.prototype;
|
|
1473
1464
|
Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
|
|
@@ -1475,7 +1466,7 @@ class R extends Error {
|
|
|
1475
1466
|
format(e) {
|
|
1476
1467
|
const t = e || function(r) {
|
|
1477
1468
|
return r.message;
|
|
1478
|
-
},
|
|
1469
|
+
}, n = { _errors: [] }, a = (r) => {
|
|
1479
1470
|
for (const i of r.issues)
|
|
1480
1471
|
if (i.code === "invalid_union")
|
|
1481
1472
|
i.unionErrors.map(a);
|
|
@@ -1484,16 +1475,16 @@ class R extends Error {
|
|
|
1484
1475
|
else if (i.code === "invalid_arguments")
|
|
1485
1476
|
a(i.argumentsError);
|
|
1486
1477
|
else if (i.path.length === 0)
|
|
1487
|
-
|
|
1478
|
+
n._errors.push(t(i));
|
|
1488
1479
|
else {
|
|
1489
|
-
let c =
|
|
1480
|
+
let c = n, u = 0;
|
|
1490
1481
|
for (; u < i.path.length; ) {
|
|
1491
1482
|
const h = i.path[u];
|
|
1492
1483
|
u === i.path.length - 1 ? (c[h] = c[h] || { _errors: [] }, c[h]._errors.push(t(i))) : c[h] = c[h] || { _errors: [] }, c = c[h], u++;
|
|
1493
1484
|
}
|
|
1494
1485
|
}
|
|
1495
1486
|
};
|
|
1496
|
-
return a(this),
|
|
1487
|
+
return a(this), n;
|
|
1497
1488
|
}
|
|
1498
1489
|
static assert(e) {
|
|
1499
1490
|
if (!(e instanceof R))
|
|
@@ -1509,40 +1500,40 @@ class R extends Error {
|
|
|
1509
1500
|
return this.issues.length === 0;
|
|
1510
1501
|
}
|
|
1511
1502
|
flatten(e = (t) => t.message) {
|
|
1512
|
-
const t = {},
|
|
1503
|
+
const t = {}, n = [];
|
|
1513
1504
|
for (const a of this.issues)
|
|
1514
1505
|
if (a.path.length > 0) {
|
|
1515
1506
|
const r = a.path[0];
|
|
1516
1507
|
t[r] = t[r] || [], t[r].push(e(a));
|
|
1517
1508
|
} else
|
|
1518
|
-
|
|
1519
|
-
return { formErrors:
|
|
1509
|
+
n.push(e(a));
|
|
1510
|
+
return { formErrors: n, fieldErrors: t };
|
|
1520
1511
|
}
|
|
1521
1512
|
get formErrors() {
|
|
1522
1513
|
return this.flatten();
|
|
1523
1514
|
}
|
|
1524
1515
|
}
|
|
1525
|
-
R.create = (
|
|
1526
|
-
const ce = (
|
|
1516
|
+
R.create = (s) => new R(s);
|
|
1517
|
+
const ce = (s, e) => {
|
|
1527
1518
|
let t;
|
|
1528
|
-
switch (
|
|
1519
|
+
switch (s.code) {
|
|
1529
1520
|
case d.invalid_type:
|
|
1530
|
-
|
|
1521
|
+
s.received === f.undefined ? t = "Required" : t = `Expected ${s.expected}, received ${s.received}`;
|
|
1531
1522
|
break;
|
|
1532
1523
|
case d.invalid_literal:
|
|
1533
|
-
t = `Invalid literal value, expected ${JSON.stringify(
|
|
1524
|
+
t = `Invalid literal value, expected ${JSON.stringify(s.expected, x.jsonStringifyReplacer)}`;
|
|
1534
1525
|
break;
|
|
1535
1526
|
case d.unrecognized_keys:
|
|
1536
|
-
t = `Unrecognized key(s) in object: ${x.joinValues(
|
|
1527
|
+
t = `Unrecognized key(s) in object: ${x.joinValues(s.keys, ", ")}`;
|
|
1537
1528
|
break;
|
|
1538
1529
|
case d.invalid_union:
|
|
1539
1530
|
t = "Invalid input";
|
|
1540
1531
|
break;
|
|
1541
1532
|
case d.invalid_union_discriminator:
|
|
1542
|
-
t = `Invalid discriminator value. Expected ${x.joinValues(
|
|
1533
|
+
t = `Invalid discriminator value. Expected ${x.joinValues(s.options)}`;
|
|
1543
1534
|
break;
|
|
1544
1535
|
case d.invalid_enum_value:
|
|
1545
|
-
t = `Invalid enum value. Expected ${x.joinValues(
|
|
1536
|
+
t = `Invalid enum value. Expected ${x.joinValues(s.options)}, received '${s.received}'`;
|
|
1546
1537
|
break;
|
|
1547
1538
|
case d.invalid_arguments:
|
|
1548
1539
|
t = "Invalid function arguments";
|
|
@@ -1554,13 +1545,13 @@ const ce = (n, e) => {
|
|
|
1554
1545
|
t = "Invalid date";
|
|
1555
1546
|
break;
|
|
1556
1547
|
case d.invalid_string:
|
|
1557
|
-
typeof
|
|
1548
|
+
typeof s.validation == "object" ? "includes" in s.validation ? (t = `Invalid input: must include "${s.validation.includes}"`, typeof s.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${s.validation.position}`)) : "startsWith" in s.validation ? t = `Invalid input: must start with "${s.validation.startsWith}"` : "endsWith" in s.validation ? t = `Invalid input: must end with "${s.validation.endsWith}"` : x.assertNever(s.validation) : s.validation !== "regex" ? t = `Invalid ${s.validation}` : t = "Invalid";
|
|
1558
1549
|
break;
|
|
1559
1550
|
case d.too_small:
|
|
1560
|
-
|
|
1551
|
+
s.type === "array" ? t = `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "more than"} ${s.minimum} element(s)` : s.type === "string" ? t = `String must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "over"} ${s.minimum} character(s)` : s.type === "number" ? t = `Number must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${s.minimum}` : s.type === "bigint" ? t = `Number must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${s.minimum}` : s.type === "date" ? t = `Date must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(s.minimum))}` : t = "Invalid input";
|
|
1561
1552
|
break;
|
|
1562
1553
|
case d.too_big:
|
|
1563
|
-
|
|
1554
|
+
s.type === "array" ? t = `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at most" : "less than"} ${s.maximum} element(s)` : s.type === "string" ? t = `String must contain ${s.exact ? "exactly" : s.inclusive ? "at most" : "under"} ${s.maximum} character(s)` : s.type === "number" ? t = `Number must be ${s.exact ? "exactly" : s.inclusive ? "less than or equal to" : "less than"} ${s.maximum}` : s.type === "bigint" ? t = `BigInt must be ${s.exact ? "exactly" : s.inclusive ? "less than or equal to" : "less than"} ${s.maximum}` : s.type === "date" ? t = `Date must be ${s.exact ? "exactly" : s.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(s.maximum))}` : t = "Invalid input";
|
|
1564
1555
|
break;
|
|
1565
1556
|
case d.custom:
|
|
1566
1557
|
t = "Invalid input";
|
|
@@ -1569,13 +1560,13 @@ const ce = (n, e) => {
|
|
|
1569
1560
|
t = "Intersection results could not be merged";
|
|
1570
1561
|
break;
|
|
1571
1562
|
case d.not_multiple_of:
|
|
1572
|
-
t = `Number must be a multiple of ${
|
|
1563
|
+
t = `Number must be a multiple of ${s.multipleOf}`;
|
|
1573
1564
|
break;
|
|
1574
1565
|
case d.not_finite:
|
|
1575
1566
|
t = "Number must be finite";
|
|
1576
1567
|
break;
|
|
1577
1568
|
default:
|
|
1578
|
-
t = e.defaultError, x.assertNever(
|
|
1569
|
+
t = e.defaultError, x.assertNever(s);
|
|
1579
1570
|
}
|
|
1580
1571
|
return { message: t };
|
|
1581
1572
|
};
|
|
@@ -1583,8 +1574,8 @@ let mt = ce;
|
|
|
1583
1574
|
function pt() {
|
|
1584
1575
|
return mt;
|
|
1585
1576
|
}
|
|
1586
|
-
const gt = (
|
|
1587
|
-
const { data: e, path: t, errorMaps:
|
|
1577
|
+
const gt = (s) => {
|
|
1578
|
+
const { data: e, path: t, errorMaps: n, issueData: a } = s, r = [...t, ...a.path || []], i = {
|
|
1588
1579
|
...a,
|
|
1589
1580
|
path: r
|
|
1590
1581
|
};
|
|
@@ -1595,7 +1586,7 @@ const gt = (n) => {
|
|
|
1595
1586
|
message: a.message
|
|
1596
1587
|
};
|
|
1597
1588
|
let c = "";
|
|
1598
|
-
const u =
|
|
1589
|
+
const u = n.filter((h) => !!h).slice().reverse();
|
|
1599
1590
|
for (const h of u)
|
|
1600
1591
|
c = h(i, { data: e, defaultError: c }).message;
|
|
1601
1592
|
return {
|
|
@@ -1604,15 +1595,15 @@ const gt = (n) => {
|
|
|
1604
1595
|
message: c
|
|
1605
1596
|
};
|
|
1606
1597
|
};
|
|
1607
|
-
function l(
|
|
1608
|
-
const t = pt(),
|
|
1598
|
+
function l(s, e) {
|
|
1599
|
+
const t = pt(), n = gt({
|
|
1609
1600
|
issueData: e,
|
|
1610
|
-
data:
|
|
1611
|
-
path:
|
|
1601
|
+
data: s.data,
|
|
1602
|
+
path: s.path,
|
|
1612
1603
|
errorMaps: [
|
|
1613
|
-
|
|
1604
|
+
s.common.contextualErrorMap,
|
|
1614
1605
|
// contextual error map is first priority
|
|
1615
|
-
|
|
1606
|
+
s.schemaErrorMap,
|
|
1616
1607
|
// then schema-bound map if available
|
|
1617
1608
|
t,
|
|
1618
1609
|
// then global override map
|
|
@@ -1620,7 +1611,7 @@ function l(n, e) {
|
|
|
1620
1611
|
// then global default map
|
|
1621
1612
|
].filter((a) => !!a)
|
|
1622
1613
|
});
|
|
1623
|
-
|
|
1614
|
+
s.common.issues.push(n);
|
|
1624
1615
|
}
|
|
1625
1616
|
class k {
|
|
1626
1617
|
constructor() {
|
|
@@ -1633,75 +1624,75 @@ class k {
|
|
|
1633
1624
|
this.value !== "aborted" && (this.value = "aborted");
|
|
1634
1625
|
}
|
|
1635
1626
|
static mergeArray(e, t) {
|
|
1636
|
-
const
|
|
1627
|
+
const n = [];
|
|
1637
1628
|
for (const a of t) {
|
|
1638
1629
|
if (a.status === "aborted")
|
|
1639
|
-
return
|
|
1640
|
-
a.status === "dirty" && e.dirty(),
|
|
1630
|
+
return g;
|
|
1631
|
+
a.status === "dirty" && e.dirty(), n.push(a.value);
|
|
1641
1632
|
}
|
|
1642
|
-
return { status: e.value, value:
|
|
1633
|
+
return { status: e.value, value: n };
|
|
1643
1634
|
}
|
|
1644
1635
|
static async mergeObjectAsync(e, t) {
|
|
1645
|
-
const
|
|
1636
|
+
const n = [];
|
|
1646
1637
|
for (const a of t) {
|
|
1647
1638
|
const r = await a.key, i = await a.value;
|
|
1648
|
-
|
|
1639
|
+
n.push({
|
|
1649
1640
|
key: r,
|
|
1650
1641
|
value: i
|
|
1651
1642
|
});
|
|
1652
1643
|
}
|
|
1653
|
-
return k.mergeObjectSync(e,
|
|
1644
|
+
return k.mergeObjectSync(e, n);
|
|
1654
1645
|
}
|
|
1655
1646
|
static mergeObjectSync(e, t) {
|
|
1656
|
-
const
|
|
1647
|
+
const n = {};
|
|
1657
1648
|
for (const a of t) {
|
|
1658
1649
|
const { key: r, value: i } = a;
|
|
1659
1650
|
if (r.status === "aborted" || i.status === "aborted")
|
|
1660
|
-
return
|
|
1661
|
-
r.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), r.value !== "__proto__" && (typeof i.value < "u" || a.alwaysSet) && (
|
|
1651
|
+
return g;
|
|
1652
|
+
r.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), r.value !== "__proto__" && (typeof i.value < "u" || a.alwaysSet) && (n[r.value] = i.value);
|
|
1662
1653
|
}
|
|
1663
|
-
return { status: e.value, value:
|
|
1654
|
+
return { status: e.value, value: n };
|
|
1664
1655
|
}
|
|
1665
1656
|
}
|
|
1666
|
-
const
|
|
1657
|
+
const g = Object.freeze({
|
|
1667
1658
|
status: "aborted"
|
|
1668
|
-
}), J = (
|
|
1659
|
+
}), J = (s) => ({ status: "dirty", value: s }), C = (s) => ({ status: "valid", value: s }), ye = (s) => s.status === "aborted", _e = (s) => s.status === "dirty", j = (s) => s.status === "valid", ee = (s) => typeof Promise < "u" && s instanceof Promise;
|
|
1669
1660
|
var m;
|
|
1670
|
-
(function(
|
|
1671
|
-
|
|
1661
|
+
(function(s) {
|
|
1662
|
+
s.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, s.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
1672
1663
|
})(m || (m = {}));
|
|
1673
1664
|
class M {
|
|
1674
|
-
constructor(e, t,
|
|
1675
|
-
this._cachedPath = [], this.parent = e, this.data = t, this._path =
|
|
1665
|
+
constructor(e, t, n, a) {
|
|
1666
|
+
this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = a;
|
|
1676
1667
|
}
|
|
1677
1668
|
get path() {
|
|
1678
1669
|
return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
1679
1670
|
}
|
|
1680
1671
|
}
|
|
1681
|
-
const Ae = (
|
|
1672
|
+
const Ae = (s, e) => {
|
|
1682
1673
|
if (j(e))
|
|
1683
1674
|
return { success: !0, data: e.value };
|
|
1684
|
-
if (!
|
|
1675
|
+
if (!s.common.issues.length)
|
|
1685
1676
|
throw new Error("Validation failed but no issues detected.");
|
|
1686
1677
|
return {
|
|
1687
1678
|
success: !1,
|
|
1688
1679
|
get error() {
|
|
1689
1680
|
if (this._error)
|
|
1690
1681
|
return this._error;
|
|
1691
|
-
const t = new R(
|
|
1682
|
+
const t = new R(s.common.issues);
|
|
1692
1683
|
return this._error = t, this._error;
|
|
1693
1684
|
}
|
|
1694
1685
|
};
|
|
1695
1686
|
};
|
|
1696
|
-
function _(
|
|
1697
|
-
if (!
|
|
1687
|
+
function _(s) {
|
|
1688
|
+
if (!s)
|
|
1698
1689
|
return {};
|
|
1699
|
-
const { errorMap: e, invalid_type_error: t, required_error:
|
|
1700
|
-
if (e && (t ||
|
|
1690
|
+
const { errorMap: e, invalid_type_error: t, required_error: n, description: a } = s;
|
|
1691
|
+
if (e && (t || n))
|
|
1701
1692
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
1702
1693
|
return e ? { errorMap: e, description: a } : { errorMap: (i, c) => {
|
|
1703
|
-
const { message: u } =
|
|
1704
|
-
return i.code === "invalid_enum_value" ? { message: u ?? c.defaultError } : typeof c.data > "u" ? { message: u ??
|
|
1694
|
+
const { message: u } = s;
|
|
1695
|
+
return i.code === "invalid_enum_value" ? { message: u ?? c.defaultError } : typeof c.data > "u" ? { message: u ?? n ?? c.defaultError } : i.code !== "invalid_type" ? { message: c.defaultError } : { message: u ?? t ?? c.defaultError };
|
|
1705
1696
|
}, description: a };
|
|
1706
1697
|
}
|
|
1707
1698
|
class b {
|
|
@@ -1745,13 +1736,13 @@ class b {
|
|
|
1745
1736
|
return Promise.resolve(t);
|
|
1746
1737
|
}
|
|
1747
1738
|
parse(e, t) {
|
|
1748
|
-
const
|
|
1749
|
-
if (
|
|
1750
|
-
return
|
|
1751
|
-
throw
|
|
1739
|
+
const n = this.safeParse(e, t);
|
|
1740
|
+
if (n.success)
|
|
1741
|
+
return n.data;
|
|
1742
|
+
throw n.error;
|
|
1752
1743
|
}
|
|
1753
1744
|
safeParse(e, t) {
|
|
1754
|
-
const
|
|
1745
|
+
const n = {
|
|
1755
1746
|
common: {
|
|
1756
1747
|
issues: [],
|
|
1757
1748
|
async: (t == null ? void 0 : t.async) ?? !1,
|
|
@@ -1762,11 +1753,11 @@ class b {
|
|
|
1762
1753
|
parent: null,
|
|
1763
1754
|
data: e,
|
|
1764
1755
|
parsedType: D(e)
|
|
1765
|
-
}, a = this._parseSync({ data: e, path:
|
|
1766
|
-
return Ae(
|
|
1756
|
+
}, a = this._parseSync({ data: e, path: n.path, parent: n });
|
|
1757
|
+
return Ae(n, a);
|
|
1767
1758
|
}
|
|
1768
1759
|
"~validate"(e) {
|
|
1769
|
-
var
|
|
1760
|
+
var n, a;
|
|
1770
1761
|
const t = {
|
|
1771
1762
|
common: {
|
|
1772
1763
|
issues: [],
|
|
@@ -1787,7 +1778,7 @@ class b {
|
|
|
1787
1778
|
issues: t.common.issues
|
|
1788
1779
|
};
|
|
1789
1780
|
} catch (r) {
|
|
1790
|
-
(a = (
|
|
1781
|
+
(a = (n = r == null ? void 0 : r.message) == null ? void 0 : n.toLowerCase()) != null && a.includes("encountered") && (this["~standard"].async = !0), t.common = {
|
|
1791
1782
|
issues: [],
|
|
1792
1783
|
async: !0
|
|
1793
1784
|
};
|
|
@@ -1799,13 +1790,13 @@ class b {
|
|
|
1799
1790
|
});
|
|
1800
1791
|
}
|
|
1801
1792
|
async parseAsync(e, t) {
|
|
1802
|
-
const
|
|
1803
|
-
if (
|
|
1804
|
-
return
|
|
1805
|
-
throw
|
|
1793
|
+
const n = await this.safeParseAsync(e, t);
|
|
1794
|
+
if (n.success)
|
|
1795
|
+
return n.data;
|
|
1796
|
+
throw n.error;
|
|
1806
1797
|
}
|
|
1807
1798
|
async safeParseAsync(e, t) {
|
|
1808
|
-
const
|
|
1799
|
+
const n = {
|
|
1809
1800
|
common: {
|
|
1810
1801
|
issues: [],
|
|
1811
1802
|
contextualErrorMap: t == null ? void 0 : t.errorMap,
|
|
@@ -1816,26 +1807,26 @@ class b {
|
|
|
1816
1807
|
parent: null,
|
|
1817
1808
|
data: e,
|
|
1818
1809
|
parsedType: D(e)
|
|
1819
|
-
}, a = this._parse({ data: e, path:
|
|
1820
|
-
return Ae(
|
|
1810
|
+
}, a = this._parse({ data: e, path: n.path, parent: n }), r = await (ee(a) ? a : Promise.resolve(a));
|
|
1811
|
+
return Ae(n, r);
|
|
1821
1812
|
}
|
|
1822
1813
|
refine(e, t) {
|
|
1823
|
-
const
|
|
1814
|
+
const n = (a) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(a) : t;
|
|
1824
1815
|
return this._refinement((a, r) => {
|
|
1825
1816
|
const i = e(a), c = () => r.addIssue({
|
|
1826
1817
|
code: d.custom,
|
|
1827
|
-
...
|
|
1818
|
+
...n(a)
|
|
1828
1819
|
});
|
|
1829
1820
|
return typeof Promise < "u" && i instanceof Promise ? i.then((u) => u ? !0 : (c(), !1)) : i ? !0 : (c(), !1);
|
|
1830
1821
|
});
|
|
1831
1822
|
}
|
|
1832
1823
|
refinement(e, t) {
|
|
1833
|
-
return this._refinement((
|
|
1824
|
+
return this._refinement((n, a) => e(n) ? !0 : (a.addIssue(typeof t == "function" ? t(n, a) : t), !1));
|
|
1834
1825
|
}
|
|
1835
1826
|
_refinement(e) {
|
|
1836
|
-
return new
|
|
1827
|
+
return new q({
|
|
1837
1828
|
schema: this,
|
|
1838
|
-
typeName:
|
|
1829
|
+
typeName: v.ZodEffects,
|
|
1839
1830
|
effect: { type: "refinement", refinement: e }
|
|
1840
1831
|
});
|
|
1841
1832
|
}
|
|
@@ -1853,7 +1844,7 @@ class b {
|
|
|
1853
1844
|
return B.create(this, this._def);
|
|
1854
1845
|
}
|
|
1855
1846
|
nullable() {
|
|
1856
|
-
return
|
|
1847
|
+
return G.create(this, this._def);
|
|
1857
1848
|
}
|
|
1858
1849
|
nullish() {
|
|
1859
1850
|
return this.nullable().optional();
|
|
@@ -1865,16 +1856,16 @@ class b {
|
|
|
1865
1856
|
return ae.create(this, this._def);
|
|
1866
1857
|
}
|
|
1867
1858
|
or(e) {
|
|
1868
|
-
return
|
|
1859
|
+
return se.create([this, e], this._def);
|
|
1869
1860
|
}
|
|
1870
1861
|
and(e) {
|
|
1871
|
-
return
|
|
1862
|
+
return ne.create(this, e, this._def);
|
|
1872
1863
|
}
|
|
1873
1864
|
transform(e) {
|
|
1874
|
-
return new
|
|
1865
|
+
return new q({
|
|
1875
1866
|
..._(this._def),
|
|
1876
1867
|
schema: this,
|
|
1877
|
-
typeName:
|
|
1868
|
+
typeName: v.ZodEffects,
|
|
1878
1869
|
effect: { type: "transform", transform: e }
|
|
1879
1870
|
});
|
|
1880
1871
|
}
|
|
@@ -1884,12 +1875,12 @@ class b {
|
|
|
1884
1875
|
..._(this._def),
|
|
1885
1876
|
innerType: this,
|
|
1886
1877
|
defaultValue: t,
|
|
1887
|
-
typeName:
|
|
1878
|
+
typeName: v.ZodDefault
|
|
1888
1879
|
});
|
|
1889
1880
|
}
|
|
1890
1881
|
brand() {
|
|
1891
1882
|
return new Vt({
|
|
1892
|
-
typeName:
|
|
1883
|
+
typeName: v.ZodBranded,
|
|
1893
1884
|
type: this,
|
|
1894
1885
|
..._(this._def)
|
|
1895
1886
|
});
|
|
@@ -1900,7 +1891,7 @@ class b {
|
|
|
1900
1891
|
..._(this._def),
|
|
1901
1892
|
innerType: this,
|
|
1902
1893
|
catchValue: t,
|
|
1903
|
-
typeName:
|
|
1894
|
+
typeName: v.ZodCatch
|
|
1904
1895
|
});
|
|
1905
1896
|
}
|
|
1906
1897
|
describe(e) {
|
|
@@ -1923,41 +1914,41 @@ class b {
|
|
|
1923
1914
|
return this.safeParse(null).success;
|
|
1924
1915
|
}
|
|
1925
1916
|
}
|
|
1926
|
-
const vt = /^c[^\s-]{8,}$/i, yt = /^[0-9a-z]+$/, _t = /^[0-9A-HJKMNP-TV-Z]{26}$/i, At = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Tt = /^[a-z0-9_-]{21}$/i, Et = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, bt = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, xt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,
|
|
1917
|
+
const vt = /^c[^\s-]{8,}$/i, yt = /^[0-9a-z]+$/, _t = /^[0-9A-HJKMNP-TV-Z]{26}$/i, At = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Tt = /^[a-z0-9_-]{21}$/i, Et = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, bt = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, xt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, St = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1927
1918
|
let re;
|
|
1928
|
-
const
|
|
1929
|
-
function Ue(
|
|
1919
|
+
const Nt = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, It = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, kt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Ct = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, wt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Ot = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Me = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", Rt = new RegExp(`^${Me}$`);
|
|
1920
|
+
function Ue(s) {
|
|
1930
1921
|
let e = "[0-5]\\d";
|
|
1931
|
-
|
|
1932
|
-
const t =
|
|
1922
|
+
s.precision ? e = `${e}\\.\\d{${s.precision}}` : s.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
1923
|
+
const t = s.precision ? "+" : "?";
|
|
1933
1924
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
|
|
1934
1925
|
}
|
|
1935
|
-
function Lt(
|
|
1936
|
-
return new RegExp(`^${Ue(
|
|
1926
|
+
function Lt(s) {
|
|
1927
|
+
return new RegExp(`^${Ue(s)}$`);
|
|
1937
1928
|
}
|
|
1938
|
-
function Dt(
|
|
1939
|
-
let e = `${Me}T${Ue(
|
|
1929
|
+
function Dt(s) {
|
|
1930
|
+
let e = `${Me}T${Ue(s)}`;
|
|
1940
1931
|
const t = [];
|
|
1941
|
-
return t.push(
|
|
1932
|
+
return t.push(s.local ? "Z?" : "Z"), s.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
1942
1933
|
}
|
|
1943
|
-
function Pt(
|
|
1944
|
-
return !!((e === "v4" || !e) &&
|
|
1934
|
+
function Pt(s, e) {
|
|
1935
|
+
return !!((e === "v4" || !e) && Nt.test(s) || (e === "v6" || !e) && kt.test(s));
|
|
1945
1936
|
}
|
|
1946
|
-
function Bt(
|
|
1947
|
-
if (!Et.test(
|
|
1937
|
+
function Bt(s, e) {
|
|
1938
|
+
if (!Et.test(s))
|
|
1948
1939
|
return !1;
|
|
1949
1940
|
try {
|
|
1950
|
-
const [t] =
|
|
1941
|
+
const [t] = s.split(".");
|
|
1951
1942
|
if (!t)
|
|
1952
1943
|
return !1;
|
|
1953
|
-
const
|
|
1944
|
+
const n = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), a = JSON.parse(atob(n));
|
|
1954
1945
|
return !(typeof a != "object" || a === null || "typ" in a && (a == null ? void 0 : a.typ) !== "JWT" || !a.alg || e && a.alg !== e);
|
|
1955
1946
|
} catch {
|
|
1956
1947
|
return !1;
|
|
1957
1948
|
}
|
|
1958
1949
|
}
|
|
1959
|
-
function Mt(
|
|
1960
|
-
return !!((e === "v4" || !e) && It.test(
|
|
1950
|
+
function Mt(s, e) {
|
|
1951
|
+
return !!((e === "v4" || !e) && It.test(s) || (e === "v6" || !e) && Ct.test(s));
|
|
1961
1952
|
}
|
|
1962
1953
|
class P extends b {
|
|
1963
1954
|
_parse(e) {
|
|
@@ -1967,9 +1958,9 @@ class P extends b {
|
|
|
1967
1958
|
code: d.invalid_type,
|
|
1968
1959
|
expected: f.string,
|
|
1969
1960
|
received: r.parsedType
|
|
1970
|
-
}),
|
|
1961
|
+
}), g;
|
|
1971
1962
|
}
|
|
1972
|
-
const
|
|
1963
|
+
const n = new k();
|
|
1973
1964
|
let a;
|
|
1974
1965
|
for (const r of this._def.checks)
|
|
1975
1966
|
if (r.kind === "min")
|
|
@@ -1980,7 +1971,7 @@ class P extends b {
|
|
|
1980
1971
|
inclusive: !0,
|
|
1981
1972
|
exact: !1,
|
|
1982
1973
|
message: r.message
|
|
1983
|
-
}),
|
|
1974
|
+
}), n.dirty());
|
|
1984
1975
|
else if (r.kind === "max")
|
|
1985
1976
|
e.data.length > r.value && (a = this._getOrReturnCtx(e, a), l(a, {
|
|
1986
1977
|
code: d.too_big,
|
|
@@ -1989,7 +1980,7 @@ class P extends b {
|
|
|
1989
1980
|
inclusive: !0,
|
|
1990
1981
|
exact: !1,
|
|
1991
1982
|
message: r.message
|
|
1992
|
-
}),
|
|
1983
|
+
}), n.dirty());
|
|
1993
1984
|
else if (r.kind === "length") {
|
|
1994
1985
|
const i = e.data.length > r.value, c = e.data.length < r.value;
|
|
1995
1986
|
(i || c) && (a = this._getOrReturnCtx(e, a), i ? l(a, {
|
|
@@ -2006,49 +1997,49 @@ class P extends b {
|
|
|
2006
1997
|
inclusive: !0,
|
|
2007
1998
|
exact: !0,
|
|
2008
1999
|
message: r.message
|
|
2009
|
-
}),
|
|
2000
|
+
}), n.dirty());
|
|
2010
2001
|
} else if (r.kind === "email")
|
|
2011
2002
|
xt.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
|
|
2012
2003
|
validation: "email",
|
|
2013
2004
|
code: d.invalid_string,
|
|
2014
2005
|
message: r.message
|
|
2015
|
-
}),
|
|
2006
|
+
}), n.dirty());
|
|
2016
2007
|
else if (r.kind === "emoji")
|
|
2017
|
-
re || (re = new RegExp(
|
|
2008
|
+
re || (re = new RegExp(St, "u")), re.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
|
|
2018
2009
|
validation: "emoji",
|
|
2019
2010
|
code: d.invalid_string,
|
|
2020
2011
|
message: r.message
|
|
2021
|
-
}),
|
|
2012
|
+
}), n.dirty());
|
|
2022
2013
|
else if (r.kind === "uuid")
|
|
2023
2014
|
At.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
|
|
2024
2015
|
validation: "uuid",
|
|
2025
2016
|
code: d.invalid_string,
|
|
2026
2017
|
message: r.message
|
|
2027
|
-
}),
|
|
2018
|
+
}), n.dirty());
|
|
2028
2019
|
else if (r.kind === "nanoid")
|
|
2029
2020
|
Tt.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
|
|
2030
2021
|
validation: "nanoid",
|
|
2031
2022
|
code: d.invalid_string,
|
|
2032
2023
|
message: r.message
|
|
2033
|
-
}),
|
|
2024
|
+
}), n.dirty());
|
|
2034
2025
|
else if (r.kind === "cuid")
|
|
2035
2026
|
vt.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
|
|
2036
2027
|
validation: "cuid",
|
|
2037
2028
|
code: d.invalid_string,
|
|
2038
2029
|
message: r.message
|
|
2039
|
-
}),
|
|
2030
|
+
}), n.dirty());
|
|
2040
2031
|
else if (r.kind === "cuid2")
|
|
2041
2032
|
yt.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
|
|
2042
2033
|
validation: "cuid2",
|
|
2043
2034
|
code: d.invalid_string,
|
|
2044
2035
|
message: r.message
|
|
2045
|
-
}),
|
|
2036
|
+
}), n.dirty());
|
|
2046
2037
|
else if (r.kind === "ulid")
|
|
2047
2038
|
_t.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
|
|
2048
2039
|
validation: "ulid",
|
|
2049
2040
|
code: d.invalid_string,
|
|
2050
2041
|
message: r.message
|
|
2051
|
-
}),
|
|
2042
|
+
}), n.dirty());
|
|
2052
2043
|
else if (r.kind === "url")
|
|
2053
2044
|
try {
|
|
2054
2045
|
new URL(e.data);
|
|
@@ -2057,68 +2048,68 @@ class P extends b {
|
|
|
2057
2048
|
validation: "url",
|
|
2058
2049
|
code: d.invalid_string,
|
|
2059
2050
|
message: r.message
|
|
2060
|
-
}),
|
|
2051
|
+
}), n.dirty();
|
|
2061
2052
|
}
|
|
2062
2053
|
else r.kind === "regex" ? (r.regex.lastIndex = 0, r.regex.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
|
|
2063
2054
|
validation: "regex",
|
|
2064
2055
|
code: d.invalid_string,
|
|
2065
2056
|
message: r.message
|
|
2066
|
-
}),
|
|
2057
|
+
}), n.dirty())) : r.kind === "trim" ? e.data = e.data.trim() : r.kind === "includes" ? e.data.includes(r.value, r.position) || (a = this._getOrReturnCtx(e, a), l(a, {
|
|
2067
2058
|
code: d.invalid_string,
|
|
2068
2059
|
validation: { includes: r.value, position: r.position },
|
|
2069
2060
|
message: r.message
|
|
2070
|
-
}),
|
|
2061
|
+
}), n.dirty()) : r.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : r.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : r.kind === "startsWith" ? e.data.startsWith(r.value) || (a = this._getOrReturnCtx(e, a), l(a, {
|
|
2071
2062
|
code: d.invalid_string,
|
|
2072
2063
|
validation: { startsWith: r.value },
|
|
2073
2064
|
message: r.message
|
|
2074
|
-
}),
|
|
2065
|
+
}), n.dirty()) : r.kind === "endsWith" ? e.data.endsWith(r.value) || (a = this._getOrReturnCtx(e, a), l(a, {
|
|
2075
2066
|
code: d.invalid_string,
|
|
2076
2067
|
validation: { endsWith: r.value },
|
|
2077
2068
|
message: r.message
|
|
2078
|
-
}),
|
|
2069
|
+
}), n.dirty()) : r.kind === "datetime" ? Dt(r).test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
|
|
2079
2070
|
code: d.invalid_string,
|
|
2080
2071
|
validation: "datetime",
|
|
2081
2072
|
message: r.message
|
|
2082
|
-
}),
|
|
2073
|
+
}), n.dirty()) : r.kind === "date" ? Rt.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
|
|
2083
2074
|
code: d.invalid_string,
|
|
2084
2075
|
validation: "date",
|
|
2085
2076
|
message: r.message
|
|
2086
|
-
}),
|
|
2077
|
+
}), n.dirty()) : r.kind === "time" ? Lt(r).test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
|
|
2087
2078
|
code: d.invalid_string,
|
|
2088
2079
|
validation: "time",
|
|
2089
2080
|
message: r.message
|
|
2090
|
-
}),
|
|
2081
|
+
}), n.dirty()) : r.kind === "duration" ? bt.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
|
|
2091
2082
|
validation: "duration",
|
|
2092
2083
|
code: d.invalid_string,
|
|
2093
2084
|
message: r.message
|
|
2094
|
-
}),
|
|
2085
|
+
}), n.dirty()) : r.kind === "ip" ? Pt(e.data, r.version) || (a = this._getOrReturnCtx(e, a), l(a, {
|
|
2095
2086
|
validation: "ip",
|
|
2096
2087
|
code: d.invalid_string,
|
|
2097
2088
|
message: r.message
|
|
2098
|
-
}),
|
|
2089
|
+
}), n.dirty()) : r.kind === "jwt" ? Bt(e.data, r.alg) || (a = this._getOrReturnCtx(e, a), l(a, {
|
|
2099
2090
|
validation: "jwt",
|
|
2100
2091
|
code: d.invalid_string,
|
|
2101
2092
|
message: r.message
|
|
2102
|
-
}),
|
|
2093
|
+
}), n.dirty()) : r.kind === "cidr" ? Mt(e.data, r.version) || (a = this._getOrReturnCtx(e, a), l(a, {
|
|
2103
2094
|
validation: "cidr",
|
|
2104
2095
|
code: d.invalid_string,
|
|
2105
2096
|
message: r.message
|
|
2106
|
-
}),
|
|
2097
|
+
}), n.dirty()) : r.kind === "base64" ? wt.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
|
|
2107
2098
|
validation: "base64",
|
|
2108
2099
|
code: d.invalid_string,
|
|
2109
2100
|
message: r.message
|
|
2110
|
-
}),
|
|
2101
|
+
}), n.dirty()) : r.kind === "base64url" ? Ot.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
|
|
2111
2102
|
validation: "base64url",
|
|
2112
2103
|
code: d.invalid_string,
|
|
2113
2104
|
message: r.message
|
|
2114
|
-
}),
|
|
2115
|
-
return { status:
|
|
2105
|
+
}), n.dirty()) : x.assertNever(r);
|
|
2106
|
+
return { status: n.value, value: e.data };
|
|
2116
2107
|
}
|
|
2117
|
-
_regex(e, t,
|
|
2108
|
+
_regex(e, t, n) {
|
|
2118
2109
|
return this.refinement((a) => e.test(a), {
|
|
2119
2110
|
validation: t,
|
|
2120
2111
|
code: d.invalid_string,
|
|
2121
|
-
...m.errToObj(
|
|
2112
|
+
...m.errToObj(n)
|
|
2122
2113
|
});
|
|
2123
2114
|
}
|
|
2124
2115
|
_addCheck(e) {
|
|
@@ -2336,14 +2327,14 @@ class P extends b {
|
|
|
2336
2327
|
return e;
|
|
2337
2328
|
}
|
|
2338
2329
|
}
|
|
2339
|
-
P.create = (
|
|
2330
|
+
P.create = (s) => new P({
|
|
2340
2331
|
checks: [],
|
|
2341
|
-
typeName:
|
|
2342
|
-
coerce: (
|
|
2343
|
-
..._(
|
|
2332
|
+
typeName: v.ZodString,
|
|
2333
|
+
coerce: (s == null ? void 0 : s.coerce) ?? !1,
|
|
2334
|
+
..._(s)
|
|
2344
2335
|
});
|
|
2345
|
-
function Ut(
|
|
2346
|
-
const t = (
|
|
2336
|
+
function Ut(s, e) {
|
|
2337
|
+
const t = (s.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, a = t > n ? t : n, r = Number.parseInt(s.toFixed(a).replace(".", "")), i = Number.parseInt(e.toFixed(a).replace(".", ""));
|
|
2347
2338
|
return r % i / 10 ** a;
|
|
2348
2339
|
}
|
|
2349
2340
|
class H extends b {
|
|
@@ -2357,35 +2348,35 @@ class H extends b {
|
|
|
2357
2348
|
code: d.invalid_type,
|
|
2358
2349
|
expected: f.number,
|
|
2359
2350
|
received: r.parsedType
|
|
2360
|
-
}),
|
|
2351
|
+
}), g;
|
|
2361
2352
|
}
|
|
2362
|
-
let
|
|
2353
|
+
let n;
|
|
2363
2354
|
const a = new k();
|
|
2364
2355
|
for (const r of this._def.checks)
|
|
2365
|
-
r.kind === "int" ? x.isInteger(e.data) || (
|
|
2356
|
+
r.kind === "int" ? x.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
2366
2357
|
code: d.invalid_type,
|
|
2367
2358
|
expected: "integer",
|
|
2368
2359
|
received: "float",
|
|
2369
2360
|
message: r.message
|
|
2370
|
-
}), a.dirty()) : r.kind === "min" ? (r.inclusive ? e.data < r.value : e.data <= r.value) && (
|
|
2361
|
+
}), a.dirty()) : r.kind === "min" ? (r.inclusive ? e.data < r.value : e.data <= r.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
2371
2362
|
code: d.too_small,
|
|
2372
2363
|
minimum: r.value,
|
|
2373
2364
|
type: "number",
|
|
2374
2365
|
inclusive: r.inclusive,
|
|
2375
2366
|
exact: !1,
|
|
2376
2367
|
message: r.message
|
|
2377
|
-
}), a.dirty()) : r.kind === "max" ? (r.inclusive ? e.data > r.value : e.data >= r.value) && (
|
|
2368
|
+
}), a.dirty()) : r.kind === "max" ? (r.inclusive ? e.data > r.value : e.data >= r.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
2378
2369
|
code: d.too_big,
|
|
2379
2370
|
maximum: r.value,
|
|
2380
2371
|
type: "number",
|
|
2381
2372
|
inclusive: r.inclusive,
|
|
2382
2373
|
exact: !1,
|
|
2383
2374
|
message: r.message
|
|
2384
|
-
}), a.dirty()) : r.kind === "multipleOf" ? Ut(e.data, r.value) !== 0 && (
|
|
2375
|
+
}), a.dirty()) : r.kind === "multipleOf" ? Ut(e.data, r.value) !== 0 && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
2385
2376
|
code: d.not_multiple_of,
|
|
2386
2377
|
multipleOf: r.value,
|
|
2387
2378
|
message: r.message
|
|
2388
|
-
}), a.dirty()) : r.kind === "finite" ? Number.isFinite(e.data) || (
|
|
2379
|
+
}), a.dirty()) : r.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
2389
2380
|
code: d.not_finite,
|
|
2390
2381
|
message: r.message
|
|
2391
2382
|
}), a.dirty()) : x.assertNever(r);
|
|
@@ -2403,7 +2394,7 @@ class H extends b {
|
|
|
2403
2394
|
lt(e, t) {
|
|
2404
2395
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
2405
2396
|
}
|
|
2406
|
-
setLimit(e, t,
|
|
2397
|
+
setLimit(e, t, n, a) {
|
|
2407
2398
|
return new H({
|
|
2408
2399
|
...this._def,
|
|
2409
2400
|
checks: [
|
|
@@ -2411,7 +2402,7 @@ class H extends b {
|
|
|
2411
2402
|
{
|
|
2412
2403
|
kind: e,
|
|
2413
2404
|
value: t,
|
|
2414
|
-
inclusive:
|
|
2405
|
+
inclusive: n,
|
|
2415
2406
|
message: m.toString(a)
|
|
2416
2407
|
}
|
|
2417
2408
|
]
|
|
@@ -2504,19 +2495,19 @@ class H extends b {
|
|
|
2504
2495
|
}
|
|
2505
2496
|
get isFinite() {
|
|
2506
2497
|
let e = null, t = null;
|
|
2507
|
-
for (const
|
|
2508
|
-
if (
|
|
2498
|
+
for (const n of this._def.checks) {
|
|
2499
|
+
if (n.kind === "finite" || n.kind === "int" || n.kind === "multipleOf")
|
|
2509
2500
|
return !0;
|
|
2510
|
-
|
|
2501
|
+
n.kind === "min" ? (t === null || n.value > t) && (t = n.value) : n.kind === "max" && (e === null || n.value < e) && (e = n.value);
|
|
2511
2502
|
}
|
|
2512
2503
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
2513
2504
|
}
|
|
2514
2505
|
}
|
|
2515
|
-
H.create = (
|
|
2506
|
+
H.create = (s) => new H({
|
|
2516
2507
|
checks: [],
|
|
2517
|
-
typeName:
|
|
2518
|
-
coerce: (
|
|
2519
|
-
..._(
|
|
2508
|
+
typeName: v.ZodNumber,
|
|
2509
|
+
coerce: (s == null ? void 0 : s.coerce) || !1,
|
|
2510
|
+
..._(s)
|
|
2520
2511
|
});
|
|
2521
2512
|
class z extends b {
|
|
2522
2513
|
constructor() {
|
|
@@ -2531,22 +2522,22 @@ class z extends b {
|
|
|
2531
2522
|
}
|
|
2532
2523
|
if (this._getType(e) !== f.bigint)
|
|
2533
2524
|
return this._getInvalidInput(e);
|
|
2534
|
-
let
|
|
2525
|
+
let n;
|
|
2535
2526
|
const a = new k();
|
|
2536
2527
|
for (const r of this._def.checks)
|
|
2537
|
-
r.kind === "min" ? (r.inclusive ? e.data < r.value : e.data <= r.value) && (
|
|
2528
|
+
r.kind === "min" ? (r.inclusive ? e.data < r.value : e.data <= r.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
2538
2529
|
code: d.too_small,
|
|
2539
2530
|
type: "bigint",
|
|
2540
2531
|
minimum: r.value,
|
|
2541
2532
|
inclusive: r.inclusive,
|
|
2542
2533
|
message: r.message
|
|
2543
|
-
}), a.dirty()) : r.kind === "max" ? (r.inclusive ? e.data > r.value : e.data >= r.value) && (
|
|
2534
|
+
}), a.dirty()) : r.kind === "max" ? (r.inclusive ? e.data > r.value : e.data >= r.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
2544
2535
|
code: d.too_big,
|
|
2545
2536
|
type: "bigint",
|
|
2546
2537
|
maximum: r.value,
|
|
2547
2538
|
inclusive: r.inclusive,
|
|
2548
2539
|
message: r.message
|
|
2549
|
-
}), a.dirty()) : r.kind === "multipleOf" ? e.data % r.value !== BigInt(0) && (
|
|
2540
|
+
}), a.dirty()) : r.kind === "multipleOf" ? e.data % r.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
2550
2541
|
code: d.not_multiple_of,
|
|
2551
2542
|
multipleOf: r.value,
|
|
2552
2543
|
message: r.message
|
|
@@ -2559,7 +2550,7 @@ class z extends b {
|
|
|
2559
2550
|
code: d.invalid_type,
|
|
2560
2551
|
expected: f.bigint,
|
|
2561
2552
|
received: t.parsedType
|
|
2562
|
-
}),
|
|
2553
|
+
}), g;
|
|
2563
2554
|
}
|
|
2564
2555
|
gte(e, t) {
|
|
2565
2556
|
return this.setLimit("min", e, !0, m.toString(t));
|
|
@@ -2573,7 +2564,7 @@ class z extends b {
|
|
|
2573
2564
|
lt(e, t) {
|
|
2574
2565
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
2575
2566
|
}
|
|
2576
|
-
setLimit(e, t,
|
|
2567
|
+
setLimit(e, t, n, a) {
|
|
2577
2568
|
return new z({
|
|
2578
2569
|
...this._def,
|
|
2579
2570
|
checks: [
|
|
@@ -2581,7 +2572,7 @@ class z extends b {
|
|
|
2581
2572
|
{
|
|
2582
2573
|
kind: e,
|
|
2583
2574
|
value: t,
|
|
2584
|
-
inclusive:
|
|
2575
|
+
inclusive: n,
|
|
2585
2576
|
message: m.toString(a)
|
|
2586
2577
|
}
|
|
2587
2578
|
]
|
|
@@ -2645,29 +2636,29 @@ class z extends b {
|
|
|
2645
2636
|
return e;
|
|
2646
2637
|
}
|
|
2647
2638
|
}
|
|
2648
|
-
z.create = (
|
|
2639
|
+
z.create = (s) => new z({
|
|
2649
2640
|
checks: [],
|
|
2650
|
-
typeName:
|
|
2651
|
-
coerce: (
|
|
2652
|
-
..._(
|
|
2641
|
+
typeName: v.ZodBigInt,
|
|
2642
|
+
coerce: (s == null ? void 0 : s.coerce) ?? !1,
|
|
2643
|
+
..._(s)
|
|
2653
2644
|
});
|
|
2654
2645
|
class Te extends b {
|
|
2655
2646
|
_parse(e) {
|
|
2656
2647
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
|
|
2657
|
-
const
|
|
2658
|
-
return l(
|
|
2648
|
+
const n = this._getOrReturnCtx(e);
|
|
2649
|
+
return l(n, {
|
|
2659
2650
|
code: d.invalid_type,
|
|
2660
2651
|
expected: f.boolean,
|
|
2661
|
-
received:
|
|
2662
|
-
}),
|
|
2652
|
+
received: n.parsedType
|
|
2653
|
+
}), g;
|
|
2663
2654
|
}
|
|
2664
2655
|
return C(e.data);
|
|
2665
2656
|
}
|
|
2666
2657
|
}
|
|
2667
|
-
Te.create = (
|
|
2668
|
-
typeName:
|
|
2669
|
-
coerce: (
|
|
2670
|
-
..._(
|
|
2658
|
+
Te.create = (s) => new Te({
|
|
2659
|
+
typeName: v.ZodBoolean,
|
|
2660
|
+
coerce: (s == null ? void 0 : s.coerce) || !1,
|
|
2661
|
+
..._(s)
|
|
2671
2662
|
});
|
|
2672
2663
|
class te extends b {
|
|
2673
2664
|
_parse(e) {
|
|
@@ -2677,15 +2668,15 @@ class te extends b {
|
|
|
2677
2668
|
code: d.invalid_type,
|
|
2678
2669
|
expected: f.date,
|
|
2679
2670
|
received: r.parsedType
|
|
2680
|
-
}),
|
|
2671
|
+
}), g;
|
|
2681
2672
|
}
|
|
2682
2673
|
if (Number.isNaN(e.data.getTime())) {
|
|
2683
2674
|
const r = this._getOrReturnCtx(e);
|
|
2684
2675
|
return l(r, {
|
|
2685
2676
|
code: d.invalid_date
|
|
2686
|
-
}),
|
|
2677
|
+
}), g;
|
|
2687
2678
|
}
|
|
2688
|
-
const
|
|
2679
|
+
const n = new k();
|
|
2689
2680
|
let a;
|
|
2690
2681
|
for (const r of this._def.checks)
|
|
2691
2682
|
r.kind === "min" ? e.data.getTime() < r.value && (a = this._getOrReturnCtx(e, a), l(a, {
|
|
@@ -2695,16 +2686,16 @@ class te extends b {
|
|
|
2695
2686
|
exact: !1,
|
|
2696
2687
|
minimum: r.value,
|
|
2697
2688
|
type: "date"
|
|
2698
|
-
}),
|
|
2689
|
+
}), n.dirty()) : r.kind === "max" ? e.data.getTime() > r.value && (a = this._getOrReturnCtx(e, a), l(a, {
|
|
2699
2690
|
code: d.too_big,
|
|
2700
2691
|
message: r.message,
|
|
2701
2692
|
inclusive: !0,
|
|
2702
2693
|
exact: !1,
|
|
2703
2694
|
maximum: r.value,
|
|
2704
2695
|
type: "date"
|
|
2705
|
-
}),
|
|
2696
|
+
}), n.dirty()) : x.assertNever(r);
|
|
2706
2697
|
return {
|
|
2707
|
-
status:
|
|
2698
|
+
status: n.value,
|
|
2708
2699
|
value: new Date(e.data.getTime())
|
|
2709
2700
|
};
|
|
2710
2701
|
}
|
|
@@ -2741,64 +2732,64 @@ class te extends b {
|
|
|
2741
2732
|
return e != null ? new Date(e) : null;
|
|
2742
2733
|
}
|
|
2743
2734
|
}
|
|
2744
|
-
te.create = (
|
|
2735
|
+
te.create = (s) => new te({
|
|
2745
2736
|
checks: [],
|
|
2746
|
-
coerce: (
|
|
2747
|
-
typeName:
|
|
2748
|
-
..._(
|
|
2737
|
+
coerce: (s == null ? void 0 : s.coerce) || !1,
|
|
2738
|
+
typeName: v.ZodDate,
|
|
2739
|
+
..._(s)
|
|
2749
2740
|
});
|
|
2750
2741
|
class Ee extends b {
|
|
2751
2742
|
_parse(e) {
|
|
2752
2743
|
if (this._getType(e) !== f.symbol) {
|
|
2753
|
-
const
|
|
2754
|
-
return l(
|
|
2744
|
+
const n = this._getOrReturnCtx(e);
|
|
2745
|
+
return l(n, {
|
|
2755
2746
|
code: d.invalid_type,
|
|
2756
2747
|
expected: f.symbol,
|
|
2757
|
-
received:
|
|
2758
|
-
}),
|
|
2748
|
+
received: n.parsedType
|
|
2749
|
+
}), g;
|
|
2759
2750
|
}
|
|
2760
2751
|
return C(e.data);
|
|
2761
2752
|
}
|
|
2762
2753
|
}
|
|
2763
|
-
Ee.create = (
|
|
2764
|
-
typeName:
|
|
2765
|
-
..._(
|
|
2754
|
+
Ee.create = (s) => new Ee({
|
|
2755
|
+
typeName: v.ZodSymbol,
|
|
2756
|
+
..._(s)
|
|
2766
2757
|
});
|
|
2767
2758
|
class be extends b {
|
|
2768
2759
|
_parse(e) {
|
|
2769
2760
|
if (this._getType(e) !== f.undefined) {
|
|
2770
|
-
const
|
|
2771
|
-
return l(
|
|
2761
|
+
const n = this._getOrReturnCtx(e);
|
|
2762
|
+
return l(n, {
|
|
2772
2763
|
code: d.invalid_type,
|
|
2773
2764
|
expected: f.undefined,
|
|
2774
|
-
received:
|
|
2775
|
-
}),
|
|
2765
|
+
received: n.parsedType
|
|
2766
|
+
}), g;
|
|
2776
2767
|
}
|
|
2777
2768
|
return C(e.data);
|
|
2778
2769
|
}
|
|
2779
2770
|
}
|
|
2780
|
-
be.create = (
|
|
2781
|
-
typeName:
|
|
2782
|
-
..._(
|
|
2771
|
+
be.create = (s) => new be({
|
|
2772
|
+
typeName: v.ZodUndefined,
|
|
2773
|
+
..._(s)
|
|
2783
2774
|
});
|
|
2784
2775
|
class xe extends b {
|
|
2785
2776
|
_parse(e) {
|
|
2786
2777
|
if (this._getType(e) !== f.null) {
|
|
2787
|
-
const
|
|
2788
|
-
return l(
|
|
2778
|
+
const n = this._getOrReturnCtx(e);
|
|
2779
|
+
return l(n, {
|
|
2789
2780
|
code: d.invalid_type,
|
|
2790
2781
|
expected: f.null,
|
|
2791
|
-
received:
|
|
2792
|
-
}),
|
|
2782
|
+
received: n.parsedType
|
|
2783
|
+
}), g;
|
|
2793
2784
|
}
|
|
2794
2785
|
return C(e.data);
|
|
2795
2786
|
}
|
|
2796
2787
|
}
|
|
2797
|
-
xe.create = (
|
|
2798
|
-
typeName:
|
|
2799
|
-
..._(
|
|
2788
|
+
xe.create = (s) => new xe({
|
|
2789
|
+
typeName: v.ZodNull,
|
|
2790
|
+
..._(s)
|
|
2800
2791
|
});
|
|
2801
|
-
class
|
|
2792
|
+
class Se extends b {
|
|
2802
2793
|
constructor() {
|
|
2803
2794
|
super(...arguments), this._any = !0;
|
|
2804
2795
|
}
|
|
@@ -2806,11 +2797,11 @@ class Ne extends b {
|
|
|
2806
2797
|
return C(e.data);
|
|
2807
2798
|
}
|
|
2808
2799
|
}
|
|
2809
|
-
|
|
2810
|
-
typeName:
|
|
2811
|
-
..._(
|
|
2800
|
+
Se.create = (s) => new Se({
|
|
2801
|
+
typeName: v.ZodAny,
|
|
2802
|
+
..._(s)
|
|
2812
2803
|
});
|
|
2813
|
-
class
|
|
2804
|
+
class Ne extends b {
|
|
2814
2805
|
constructor() {
|
|
2815
2806
|
super(...arguments), this._unknown = !0;
|
|
2816
2807
|
}
|
|
@@ -2818,9 +2809,9 @@ class Se extends b {
|
|
|
2818
2809
|
return C(e.data);
|
|
2819
2810
|
}
|
|
2820
2811
|
}
|
|
2821
|
-
|
|
2822
|
-
typeName:
|
|
2823
|
-
..._(
|
|
2812
|
+
Ne.create = (s) => new Ne({
|
|
2813
|
+
typeName: v.ZodUnknown,
|
|
2814
|
+
..._(s)
|
|
2824
2815
|
});
|
|
2825
2816
|
class U extends b {
|
|
2826
2817
|
_parse(e) {
|
|
@@ -2829,39 +2820,39 @@ class U extends b {
|
|
|
2829
2820
|
code: d.invalid_type,
|
|
2830
2821
|
expected: f.never,
|
|
2831
2822
|
received: t.parsedType
|
|
2832
|
-
}),
|
|
2823
|
+
}), g;
|
|
2833
2824
|
}
|
|
2834
2825
|
}
|
|
2835
|
-
U.create = (
|
|
2836
|
-
typeName:
|
|
2837
|
-
..._(
|
|
2826
|
+
U.create = (s) => new U({
|
|
2827
|
+
typeName: v.ZodNever,
|
|
2828
|
+
..._(s)
|
|
2838
2829
|
});
|
|
2839
2830
|
class Ie extends b {
|
|
2840
2831
|
_parse(e) {
|
|
2841
2832
|
if (this._getType(e) !== f.undefined) {
|
|
2842
|
-
const
|
|
2843
|
-
return l(
|
|
2833
|
+
const n = this._getOrReturnCtx(e);
|
|
2834
|
+
return l(n, {
|
|
2844
2835
|
code: d.invalid_type,
|
|
2845
2836
|
expected: f.void,
|
|
2846
|
-
received:
|
|
2847
|
-
}),
|
|
2837
|
+
received: n.parsedType
|
|
2838
|
+
}), g;
|
|
2848
2839
|
}
|
|
2849
2840
|
return C(e.data);
|
|
2850
2841
|
}
|
|
2851
2842
|
}
|
|
2852
|
-
Ie.create = (
|
|
2853
|
-
typeName:
|
|
2854
|
-
..._(
|
|
2843
|
+
Ie.create = (s) => new Ie({
|
|
2844
|
+
typeName: v.ZodVoid,
|
|
2845
|
+
..._(s)
|
|
2855
2846
|
});
|
|
2856
2847
|
class O extends b {
|
|
2857
2848
|
_parse(e) {
|
|
2858
|
-
const { ctx: t, status:
|
|
2849
|
+
const { ctx: t, status: n } = this._processInputParams(e), a = this._def;
|
|
2859
2850
|
if (t.parsedType !== f.array)
|
|
2860
2851
|
return l(t, {
|
|
2861
2852
|
code: d.invalid_type,
|
|
2862
2853
|
expected: f.array,
|
|
2863
2854
|
received: t.parsedType
|
|
2864
|
-
}),
|
|
2855
|
+
}), g;
|
|
2865
2856
|
if (a.exactLength !== null) {
|
|
2866
2857
|
const i = t.data.length > a.exactLength.value, c = t.data.length < a.exactLength.value;
|
|
2867
2858
|
(i || c) && (l(t, {
|
|
@@ -2872,7 +2863,7 @@ class O extends b {
|
|
|
2872
2863
|
inclusive: !0,
|
|
2873
2864
|
exact: !0,
|
|
2874
2865
|
message: a.exactLength.message
|
|
2875
|
-
}),
|
|
2866
|
+
}), n.dirty());
|
|
2876
2867
|
}
|
|
2877
2868
|
if (a.minLength !== null && t.data.length < a.minLength.value && (l(t, {
|
|
2878
2869
|
code: d.too_small,
|
|
@@ -2881,17 +2872,17 @@ class O extends b {
|
|
|
2881
2872
|
inclusive: !0,
|
|
2882
2873
|
exact: !1,
|
|
2883
2874
|
message: a.minLength.message
|
|
2884
|
-
}),
|
|
2875
|
+
}), n.dirty()), a.maxLength !== null && t.data.length > a.maxLength.value && (l(t, {
|
|
2885
2876
|
code: d.too_big,
|
|
2886
2877
|
maximum: a.maxLength.value,
|
|
2887
2878
|
type: "array",
|
|
2888
2879
|
inclusive: !0,
|
|
2889
2880
|
exact: !1,
|
|
2890
2881
|
message: a.maxLength.message
|
|
2891
|
-
}),
|
|
2892
|
-
return Promise.all([...t.data].map((i, c) => a.type._parseAsync(new M(t, i, t.path, c)))).then((i) => k.mergeArray(
|
|
2882
|
+
}), n.dirty()), t.common.async)
|
|
2883
|
+
return Promise.all([...t.data].map((i, c) => a.type._parseAsync(new M(t, i, t.path, c)))).then((i) => k.mergeArray(n, i));
|
|
2893
2884
|
const r = [...t.data].map((i, c) => a.type._parseSync(new M(t, i, t.path, c)));
|
|
2894
|
-
return k.mergeArray(
|
|
2885
|
+
return k.mergeArray(n, r);
|
|
2895
2886
|
}
|
|
2896
2887
|
get element() {
|
|
2897
2888
|
return this._def.type;
|
|
@@ -2918,31 +2909,31 @@ class O extends b {
|
|
|
2918
2909
|
return this.min(1, e);
|
|
2919
2910
|
}
|
|
2920
2911
|
}
|
|
2921
|
-
O.create = (
|
|
2922
|
-
type:
|
|
2912
|
+
O.create = (s, e) => new O({
|
|
2913
|
+
type: s,
|
|
2923
2914
|
minLength: null,
|
|
2924
2915
|
maxLength: null,
|
|
2925
2916
|
exactLength: null,
|
|
2926
|
-
typeName:
|
|
2917
|
+
typeName: v.ZodArray,
|
|
2927
2918
|
..._(e)
|
|
2928
2919
|
});
|
|
2929
|
-
function F(
|
|
2930
|
-
if (
|
|
2920
|
+
function F(s) {
|
|
2921
|
+
if (s instanceof S) {
|
|
2931
2922
|
const e = {};
|
|
2932
|
-
for (const t in
|
|
2933
|
-
const
|
|
2934
|
-
e[t] = B.create(F(
|
|
2923
|
+
for (const t in s.shape) {
|
|
2924
|
+
const n = s.shape[t];
|
|
2925
|
+
e[t] = B.create(F(n));
|
|
2935
2926
|
}
|
|
2936
|
-
return new
|
|
2937
|
-
...
|
|
2927
|
+
return new S({
|
|
2928
|
+
...s._def,
|
|
2938
2929
|
shape: () => e
|
|
2939
2930
|
});
|
|
2940
|
-
} else return
|
|
2941
|
-
...
|
|
2942
|
-
type: F(
|
|
2943
|
-
}) :
|
|
2931
|
+
} else return s instanceof O ? new O({
|
|
2932
|
+
...s._def,
|
|
2933
|
+
type: F(s.element)
|
|
2934
|
+
}) : s instanceof B ? B.create(F(s.unwrap())) : s instanceof G ? G.create(F(s.unwrap())) : s instanceof $ ? $.create(s.items.map((e) => F(e))) : s;
|
|
2944
2935
|
}
|
|
2945
|
-
class
|
|
2936
|
+
class S extends b {
|
|
2946
2937
|
constructor() {
|
|
2947
2938
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
2948
2939
|
}
|
|
@@ -2959,9 +2950,9 @@ class N extends b {
|
|
|
2959
2950
|
code: d.invalid_type,
|
|
2960
2951
|
expected: f.object,
|
|
2961
2952
|
received: h.parsedType
|
|
2962
|
-
}),
|
|
2953
|
+
}), g;
|
|
2963
2954
|
}
|
|
2964
|
-
const { status:
|
|
2955
|
+
const { status: n, ctx: a } = this._processInputParams(e), { shape: r, keys: i } = this._getCached(), c = [];
|
|
2965
2956
|
if (!(this._def.catchall instanceof U && this._def.unknownKeys === "strip"))
|
|
2966
2957
|
for (const h in a.data)
|
|
2967
2958
|
i.includes(h) || c.push(h);
|
|
@@ -2986,7 +2977,7 @@ class N extends b {
|
|
|
2986
2977
|
c.length > 0 && (l(a, {
|
|
2987
2978
|
code: d.unrecognized_keys,
|
|
2988
2979
|
keys: c
|
|
2989
|
-
}),
|
|
2980
|
+
}), n.dirty());
|
|
2990
2981
|
else if (h !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
2991
2982
|
} else {
|
|
2992
2983
|
const h = this._def.catchall;
|
|
@@ -3013,19 +3004,19 @@ class N extends b {
|
|
|
3013
3004
|
});
|
|
3014
3005
|
}
|
|
3015
3006
|
return h;
|
|
3016
|
-
}).then((h) => k.mergeObjectSync(
|
|
3007
|
+
}).then((h) => k.mergeObjectSync(n, h)) : k.mergeObjectSync(n, u);
|
|
3017
3008
|
}
|
|
3018
3009
|
get shape() {
|
|
3019
3010
|
return this._def.shape();
|
|
3020
3011
|
}
|
|
3021
3012
|
strict(e) {
|
|
3022
|
-
return m.errToObj, new
|
|
3013
|
+
return m.errToObj, new S({
|
|
3023
3014
|
...this._def,
|
|
3024
3015
|
unknownKeys: "strict",
|
|
3025
3016
|
...e !== void 0 ? {
|
|
3026
|
-
errorMap: (t,
|
|
3017
|
+
errorMap: (t, n) => {
|
|
3027
3018
|
var r, i;
|
|
3028
|
-
const a = ((i = (r = this._def).errorMap) == null ? void 0 : i.call(r, t,
|
|
3019
|
+
const a = ((i = (r = this._def).errorMap) == null ? void 0 : i.call(r, t, n).message) ?? n.defaultError;
|
|
3029
3020
|
return t.code === "unrecognized_keys" ? {
|
|
3030
3021
|
message: m.errToObj(e).message ?? a
|
|
3031
3022
|
} : {
|
|
@@ -3036,13 +3027,13 @@ class N extends b {
|
|
|
3036
3027
|
});
|
|
3037
3028
|
}
|
|
3038
3029
|
strip() {
|
|
3039
|
-
return new
|
|
3030
|
+
return new S({
|
|
3040
3031
|
...this._def,
|
|
3041
3032
|
unknownKeys: "strip"
|
|
3042
3033
|
});
|
|
3043
3034
|
}
|
|
3044
3035
|
passthrough() {
|
|
3045
|
-
return new
|
|
3036
|
+
return new S({
|
|
3046
3037
|
...this._def,
|
|
3047
3038
|
unknownKeys: "passthrough"
|
|
3048
3039
|
});
|
|
@@ -3065,7 +3056,7 @@ class N extends b {
|
|
|
3065
3056
|
// }) as any;
|
|
3066
3057
|
// };
|
|
3067
3058
|
extend(e) {
|
|
3068
|
-
return new
|
|
3059
|
+
return new S({
|
|
3069
3060
|
...this._def,
|
|
3070
3061
|
shape: () => ({
|
|
3071
3062
|
...this._def.shape(),
|
|
@@ -3079,14 +3070,14 @@ class N extends b {
|
|
|
3079
3070
|
* upgrade if you are experiencing issues.
|
|
3080
3071
|
*/
|
|
3081
3072
|
merge(e) {
|
|
3082
|
-
return new
|
|
3073
|
+
return new S({
|
|
3083
3074
|
unknownKeys: e._def.unknownKeys,
|
|
3084
3075
|
catchall: e._def.catchall,
|
|
3085
3076
|
shape: () => ({
|
|
3086
3077
|
...this._def.shape(),
|
|
3087
3078
|
...e._def.shape()
|
|
3088
3079
|
}),
|
|
3089
|
-
typeName:
|
|
3080
|
+
typeName: v.ZodObject
|
|
3090
3081
|
});
|
|
3091
3082
|
}
|
|
3092
3083
|
// merge<
|
|
@@ -3149,25 +3140,25 @@ class N extends b {
|
|
|
3149
3140
|
// return merged;
|
|
3150
3141
|
// }
|
|
3151
3142
|
catchall(e) {
|
|
3152
|
-
return new
|
|
3143
|
+
return new S({
|
|
3153
3144
|
...this._def,
|
|
3154
3145
|
catchall: e
|
|
3155
3146
|
});
|
|
3156
3147
|
}
|
|
3157
3148
|
pick(e) {
|
|
3158
3149
|
const t = {};
|
|
3159
|
-
for (const
|
|
3160
|
-
e[
|
|
3161
|
-
return new
|
|
3150
|
+
for (const n of x.objectKeys(e))
|
|
3151
|
+
e[n] && this.shape[n] && (t[n] = this.shape[n]);
|
|
3152
|
+
return new S({
|
|
3162
3153
|
...this._def,
|
|
3163
3154
|
shape: () => t
|
|
3164
3155
|
});
|
|
3165
3156
|
}
|
|
3166
3157
|
omit(e) {
|
|
3167
3158
|
const t = {};
|
|
3168
|
-
for (const
|
|
3169
|
-
e[
|
|
3170
|
-
return new
|
|
3159
|
+
for (const n of x.objectKeys(this.shape))
|
|
3160
|
+
e[n] || (t[n] = this.shape[n]);
|
|
3161
|
+
return new S({
|
|
3171
3162
|
...this._def,
|
|
3172
3163
|
shape: () => t
|
|
3173
3164
|
});
|
|
@@ -3180,27 +3171,27 @@ class N extends b {
|
|
|
3180
3171
|
}
|
|
3181
3172
|
partial(e) {
|
|
3182
3173
|
const t = {};
|
|
3183
|
-
for (const
|
|
3184
|
-
const a = this.shape[
|
|
3185
|
-
e && !e[
|
|
3174
|
+
for (const n of x.objectKeys(this.shape)) {
|
|
3175
|
+
const a = this.shape[n];
|
|
3176
|
+
e && !e[n] ? t[n] = a : t[n] = a.optional();
|
|
3186
3177
|
}
|
|
3187
|
-
return new
|
|
3178
|
+
return new S({
|
|
3188
3179
|
...this._def,
|
|
3189
3180
|
shape: () => t
|
|
3190
3181
|
});
|
|
3191
3182
|
}
|
|
3192
3183
|
required(e) {
|
|
3193
3184
|
const t = {};
|
|
3194
|
-
for (const
|
|
3195
|
-
if (e && !e[
|
|
3196
|
-
t[
|
|
3185
|
+
for (const n of x.objectKeys(this.shape))
|
|
3186
|
+
if (e && !e[n])
|
|
3187
|
+
t[n] = this.shape[n];
|
|
3197
3188
|
else {
|
|
3198
|
-
let r = this.shape[
|
|
3189
|
+
let r = this.shape[n];
|
|
3199
3190
|
for (; r instanceof B; )
|
|
3200
3191
|
r = r._def.innerType;
|
|
3201
|
-
t[
|
|
3192
|
+
t[n] = r;
|
|
3202
3193
|
}
|
|
3203
|
-
return new
|
|
3194
|
+
return new S({
|
|
3204
3195
|
...this._def,
|
|
3205
3196
|
shape: () => t
|
|
3206
3197
|
});
|
|
@@ -3209,30 +3200,30 @@ class N extends b {
|
|
|
3209
3200
|
return Ve(x.objectKeys(this.shape));
|
|
3210
3201
|
}
|
|
3211
3202
|
}
|
|
3212
|
-
|
|
3213
|
-
shape: () =>
|
|
3203
|
+
S.create = (s, e) => new S({
|
|
3204
|
+
shape: () => s,
|
|
3214
3205
|
unknownKeys: "strip",
|
|
3215
3206
|
catchall: U.create(),
|
|
3216
|
-
typeName:
|
|
3207
|
+
typeName: v.ZodObject,
|
|
3217
3208
|
..._(e)
|
|
3218
3209
|
});
|
|
3219
|
-
|
|
3220
|
-
shape: () =>
|
|
3210
|
+
S.strictCreate = (s, e) => new S({
|
|
3211
|
+
shape: () => s,
|
|
3221
3212
|
unknownKeys: "strict",
|
|
3222
3213
|
catchall: U.create(),
|
|
3223
|
-
typeName:
|
|
3214
|
+
typeName: v.ZodObject,
|
|
3224
3215
|
..._(e)
|
|
3225
3216
|
});
|
|
3226
|
-
|
|
3227
|
-
shape:
|
|
3217
|
+
S.lazycreate = (s, e) => new S({
|
|
3218
|
+
shape: s,
|
|
3228
3219
|
unknownKeys: "strip",
|
|
3229
3220
|
catchall: U.create(),
|
|
3230
|
-
typeName:
|
|
3221
|
+
typeName: v.ZodObject,
|
|
3231
3222
|
..._(e)
|
|
3232
3223
|
});
|
|
3233
|
-
class
|
|
3224
|
+
class se extends b {
|
|
3234
3225
|
_parse(e) {
|
|
3235
|
-
const { ctx: t } = this._processInputParams(e),
|
|
3226
|
+
const { ctx: t } = this._processInputParams(e), n = this._def.options;
|
|
3236
3227
|
function a(r) {
|
|
3237
3228
|
for (const c of r)
|
|
3238
3229
|
if (c.result.status === "valid")
|
|
@@ -3244,10 +3235,10 @@ class ne extends b {
|
|
|
3244
3235
|
return l(t, {
|
|
3245
3236
|
code: d.invalid_union,
|
|
3246
3237
|
unionErrors: i
|
|
3247
|
-
}),
|
|
3238
|
+
}), g;
|
|
3248
3239
|
}
|
|
3249
3240
|
if (t.common.async)
|
|
3250
|
-
return Promise.all(
|
|
3241
|
+
return Promise.all(n.map(async (r) => {
|
|
3251
3242
|
const i = {
|
|
3252
3243
|
...t,
|
|
3253
3244
|
common: {
|
|
@@ -3268,7 +3259,7 @@ class ne extends b {
|
|
|
3268
3259
|
{
|
|
3269
3260
|
let r;
|
|
3270
3261
|
const i = [];
|
|
3271
|
-
for (const u of
|
|
3262
|
+
for (const u of n) {
|
|
3272
3263
|
const h = {
|
|
3273
3264
|
...t,
|
|
3274
3265
|
common: {
|
|
@@ -3291,111 +3282,111 @@ class ne extends b {
|
|
|
3291
3282
|
return l(t, {
|
|
3292
3283
|
code: d.invalid_union,
|
|
3293
3284
|
unionErrors: c
|
|
3294
|
-
}),
|
|
3285
|
+
}), g;
|
|
3295
3286
|
}
|
|
3296
3287
|
}
|
|
3297
3288
|
get options() {
|
|
3298
3289
|
return this._def.options;
|
|
3299
3290
|
}
|
|
3300
3291
|
}
|
|
3301
|
-
|
|
3302
|
-
options:
|
|
3303
|
-
typeName:
|
|
3292
|
+
se.create = (s, e) => new se({
|
|
3293
|
+
options: s,
|
|
3294
|
+
typeName: v.ZodUnion,
|
|
3304
3295
|
..._(e)
|
|
3305
3296
|
});
|
|
3306
|
-
function oe(
|
|
3307
|
-
const t = D(
|
|
3308
|
-
if (
|
|
3309
|
-
return { valid: !0, data:
|
|
3310
|
-
if (t === f.object &&
|
|
3311
|
-
const a = x.objectKeys(e), r = x.objectKeys(
|
|
3297
|
+
function oe(s, e) {
|
|
3298
|
+
const t = D(s), n = D(e);
|
|
3299
|
+
if (s === e)
|
|
3300
|
+
return { valid: !0, data: s };
|
|
3301
|
+
if (t === f.object && n === f.object) {
|
|
3302
|
+
const a = x.objectKeys(e), r = x.objectKeys(s).filter((c) => a.indexOf(c) !== -1), i = { ...s, ...e };
|
|
3312
3303
|
for (const c of r) {
|
|
3313
|
-
const u = oe(
|
|
3304
|
+
const u = oe(s[c], e[c]);
|
|
3314
3305
|
if (!u.valid)
|
|
3315
3306
|
return { valid: !1 };
|
|
3316
3307
|
i[c] = u.data;
|
|
3317
3308
|
}
|
|
3318
3309
|
return { valid: !0, data: i };
|
|
3319
|
-
} else if (t === f.array &&
|
|
3320
|
-
if (
|
|
3310
|
+
} else if (t === f.array && n === f.array) {
|
|
3311
|
+
if (s.length !== e.length)
|
|
3321
3312
|
return { valid: !1 };
|
|
3322
3313
|
const a = [];
|
|
3323
|
-
for (let r = 0; r <
|
|
3324
|
-
const i =
|
|
3314
|
+
for (let r = 0; r < s.length; r++) {
|
|
3315
|
+
const i = s[r], c = e[r], u = oe(i, c);
|
|
3325
3316
|
if (!u.valid)
|
|
3326
3317
|
return { valid: !1 };
|
|
3327
3318
|
a.push(u.data);
|
|
3328
3319
|
}
|
|
3329
3320
|
return { valid: !0, data: a };
|
|
3330
|
-
} else return t === f.date &&
|
|
3321
|
+
} else return t === f.date && n === f.date && +s == +e ? { valid: !0, data: s } : { valid: !1 };
|
|
3331
3322
|
}
|
|
3332
|
-
class
|
|
3323
|
+
class ne extends b {
|
|
3333
3324
|
_parse(e) {
|
|
3334
|
-
const { status: t, ctx:
|
|
3325
|
+
const { status: t, ctx: n } = this._processInputParams(e), a = (r, i) => {
|
|
3335
3326
|
if (ye(r) || ye(i))
|
|
3336
|
-
return
|
|
3327
|
+
return g;
|
|
3337
3328
|
const c = oe(r.value, i.value);
|
|
3338
|
-
return c.valid ? ((_e(r) || _e(i)) && t.dirty(), { status: t.value, value: c.data }) : (l(
|
|
3329
|
+
return c.valid ? ((_e(r) || _e(i)) && t.dirty(), { status: t.value, value: c.data }) : (l(n, {
|
|
3339
3330
|
code: d.invalid_intersection_types
|
|
3340
|
-
}),
|
|
3331
|
+
}), g);
|
|
3341
3332
|
};
|
|
3342
|
-
return
|
|
3333
|
+
return n.common.async ? Promise.all([
|
|
3343
3334
|
this._def.left._parseAsync({
|
|
3344
|
-
data:
|
|
3345
|
-
path:
|
|
3346
|
-
parent:
|
|
3335
|
+
data: n.data,
|
|
3336
|
+
path: n.path,
|
|
3337
|
+
parent: n
|
|
3347
3338
|
}),
|
|
3348
3339
|
this._def.right._parseAsync({
|
|
3349
|
-
data:
|
|
3350
|
-
path:
|
|
3351
|
-
parent:
|
|
3340
|
+
data: n.data,
|
|
3341
|
+
path: n.path,
|
|
3342
|
+
parent: n
|
|
3352
3343
|
})
|
|
3353
3344
|
]).then(([r, i]) => a(r, i)) : a(this._def.left._parseSync({
|
|
3354
|
-
data:
|
|
3355
|
-
path:
|
|
3356
|
-
parent:
|
|
3345
|
+
data: n.data,
|
|
3346
|
+
path: n.path,
|
|
3347
|
+
parent: n
|
|
3357
3348
|
}), this._def.right._parseSync({
|
|
3358
|
-
data:
|
|
3359
|
-
path:
|
|
3360
|
-
parent:
|
|
3349
|
+
data: n.data,
|
|
3350
|
+
path: n.path,
|
|
3351
|
+
parent: n
|
|
3361
3352
|
}));
|
|
3362
3353
|
}
|
|
3363
3354
|
}
|
|
3364
|
-
|
|
3365
|
-
left:
|
|
3355
|
+
ne.create = (s, e, t) => new ne({
|
|
3356
|
+
left: s,
|
|
3366
3357
|
right: e,
|
|
3367
|
-
typeName:
|
|
3358
|
+
typeName: v.ZodIntersection,
|
|
3368
3359
|
..._(t)
|
|
3369
3360
|
});
|
|
3370
3361
|
class $ extends b {
|
|
3371
3362
|
_parse(e) {
|
|
3372
|
-
const { status: t, ctx:
|
|
3373
|
-
if (
|
|
3374
|
-
return l(
|
|
3363
|
+
const { status: t, ctx: n } = this._processInputParams(e);
|
|
3364
|
+
if (n.parsedType !== f.array)
|
|
3365
|
+
return l(n, {
|
|
3375
3366
|
code: d.invalid_type,
|
|
3376
3367
|
expected: f.array,
|
|
3377
|
-
received:
|
|
3378
|
-
}),
|
|
3379
|
-
if (
|
|
3380
|
-
return l(
|
|
3368
|
+
received: n.parsedType
|
|
3369
|
+
}), g;
|
|
3370
|
+
if (n.data.length < this._def.items.length)
|
|
3371
|
+
return l(n, {
|
|
3381
3372
|
code: d.too_small,
|
|
3382
3373
|
minimum: this._def.items.length,
|
|
3383
3374
|
inclusive: !0,
|
|
3384
3375
|
exact: !1,
|
|
3385
3376
|
type: "array"
|
|
3386
|
-
}),
|
|
3387
|
-
!this._def.rest &&
|
|
3377
|
+
}), g;
|
|
3378
|
+
!this._def.rest && n.data.length > this._def.items.length && (l(n, {
|
|
3388
3379
|
code: d.too_big,
|
|
3389
3380
|
maximum: this._def.items.length,
|
|
3390
3381
|
inclusive: !0,
|
|
3391
3382
|
exact: !1,
|
|
3392
3383
|
type: "array"
|
|
3393
3384
|
}), t.dirty());
|
|
3394
|
-
const r = [...
|
|
3385
|
+
const r = [...n.data].map((i, c) => {
|
|
3395
3386
|
const u = this._def.items[c] || this._def.rest;
|
|
3396
|
-
return u ? u._parse(new M(
|
|
3387
|
+
return u ? u._parse(new M(n, i, n.path, c)) : null;
|
|
3397
3388
|
}).filter((i) => !!i);
|
|
3398
|
-
return
|
|
3389
|
+
return n.common.async ? Promise.all(r).then((i) => k.mergeArray(t, i)) : k.mergeArray(t, r);
|
|
3399
3390
|
}
|
|
3400
3391
|
get items() {
|
|
3401
3392
|
return this._def.items;
|
|
@@ -3407,12 +3398,12 @@ class $ extends b {
|
|
|
3407
3398
|
});
|
|
3408
3399
|
}
|
|
3409
3400
|
}
|
|
3410
|
-
$.create = (
|
|
3411
|
-
if (!Array.isArray(
|
|
3401
|
+
$.create = (s, e) => {
|
|
3402
|
+
if (!Array.isArray(s))
|
|
3412
3403
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
3413
3404
|
return new $({
|
|
3414
|
-
items:
|
|
3415
|
-
typeName:
|
|
3405
|
+
items: s,
|
|
3406
|
+
typeName: v.ZodTuple,
|
|
3416
3407
|
rest: null,
|
|
3417
3408
|
..._(e)
|
|
3418
3409
|
});
|
|
@@ -3425,24 +3416,24 @@ class ke extends b {
|
|
|
3425
3416
|
return this._def.valueType;
|
|
3426
3417
|
}
|
|
3427
3418
|
_parse(e) {
|
|
3428
|
-
const { status: t, ctx:
|
|
3429
|
-
if (
|
|
3430
|
-
return l(
|
|
3419
|
+
const { status: t, ctx: n } = this._processInputParams(e);
|
|
3420
|
+
if (n.parsedType !== f.map)
|
|
3421
|
+
return l(n, {
|
|
3431
3422
|
code: d.invalid_type,
|
|
3432
3423
|
expected: f.map,
|
|
3433
|
-
received:
|
|
3434
|
-
}),
|
|
3435
|
-
const a = this._def.keyType, r = this._def.valueType, i = [...
|
|
3436
|
-
key: a._parse(new M(
|
|
3437
|
-
value: r._parse(new M(
|
|
3424
|
+
received: n.parsedType
|
|
3425
|
+
}), g;
|
|
3426
|
+
const a = this._def.keyType, r = this._def.valueType, i = [...n.data.entries()].map(([c, u], h) => ({
|
|
3427
|
+
key: a._parse(new M(n, c, n.path, [h, "key"])),
|
|
3428
|
+
value: r._parse(new M(n, u, n.path, [h, "value"]))
|
|
3438
3429
|
}));
|
|
3439
|
-
if (
|
|
3430
|
+
if (n.common.async) {
|
|
3440
3431
|
const c = /* @__PURE__ */ new Map();
|
|
3441
3432
|
return Promise.resolve().then(async () => {
|
|
3442
3433
|
for (const u of i) {
|
|
3443
3434
|
const h = await u.key, A = await u.value;
|
|
3444
3435
|
if (h.status === "aborted" || A.status === "aborted")
|
|
3445
|
-
return
|
|
3436
|
+
return g;
|
|
3446
3437
|
(h.status === "dirty" || A.status === "dirty") && t.dirty(), c.set(h.value, A.value);
|
|
3447
3438
|
}
|
|
3448
3439
|
return { status: t.value, value: c };
|
|
@@ -3452,37 +3443,37 @@ class ke extends b {
|
|
|
3452
3443
|
for (const u of i) {
|
|
3453
3444
|
const h = u.key, A = u.value;
|
|
3454
3445
|
if (h.status === "aborted" || A.status === "aborted")
|
|
3455
|
-
return
|
|
3446
|
+
return g;
|
|
3456
3447
|
(h.status === "dirty" || A.status === "dirty") && t.dirty(), c.set(h.value, A.value);
|
|
3457
3448
|
}
|
|
3458
3449
|
return { status: t.value, value: c };
|
|
3459
3450
|
}
|
|
3460
3451
|
}
|
|
3461
3452
|
}
|
|
3462
|
-
ke.create = (
|
|
3453
|
+
ke.create = (s, e, t) => new ke({
|
|
3463
3454
|
valueType: e,
|
|
3464
|
-
keyType:
|
|
3465
|
-
typeName:
|
|
3455
|
+
keyType: s,
|
|
3456
|
+
typeName: v.ZodMap,
|
|
3466
3457
|
..._(t)
|
|
3467
3458
|
});
|
|
3468
3459
|
class X extends b {
|
|
3469
3460
|
_parse(e) {
|
|
3470
|
-
const { status: t, ctx:
|
|
3471
|
-
if (
|
|
3472
|
-
return l(
|
|
3461
|
+
const { status: t, ctx: n } = this._processInputParams(e);
|
|
3462
|
+
if (n.parsedType !== f.set)
|
|
3463
|
+
return l(n, {
|
|
3473
3464
|
code: d.invalid_type,
|
|
3474
3465
|
expected: f.set,
|
|
3475
|
-
received:
|
|
3476
|
-
}),
|
|
3466
|
+
received: n.parsedType
|
|
3467
|
+
}), g;
|
|
3477
3468
|
const a = this._def;
|
|
3478
|
-
a.minSize !== null &&
|
|
3469
|
+
a.minSize !== null && n.data.size < a.minSize.value && (l(n, {
|
|
3479
3470
|
code: d.too_small,
|
|
3480
3471
|
minimum: a.minSize.value,
|
|
3481
3472
|
type: "set",
|
|
3482
3473
|
inclusive: !0,
|
|
3483
3474
|
exact: !1,
|
|
3484
3475
|
message: a.minSize.message
|
|
3485
|
-
}), t.dirty()), a.maxSize !== null &&
|
|
3476
|
+
}), t.dirty()), a.maxSize !== null && n.data.size > a.maxSize.value && (l(n, {
|
|
3486
3477
|
code: d.too_big,
|
|
3487
3478
|
maximum: a.maxSize.value,
|
|
3488
3479
|
type: "set",
|
|
@@ -3495,13 +3486,13 @@ class X extends b {
|
|
|
3495
3486
|
const h = /* @__PURE__ */ new Set();
|
|
3496
3487
|
for (const A of u) {
|
|
3497
3488
|
if (A.status === "aborted")
|
|
3498
|
-
return
|
|
3489
|
+
return g;
|
|
3499
3490
|
A.status === "dirty" && t.dirty(), h.add(A.value);
|
|
3500
3491
|
}
|
|
3501
3492
|
return { status: t.value, value: h };
|
|
3502
3493
|
}
|
|
3503
|
-
const c = [...
|
|
3504
|
-
return
|
|
3494
|
+
const c = [...n.data.values()].map((u, h) => r._parse(new M(n, u, n.path, h)));
|
|
3495
|
+
return n.common.async ? Promise.all(c).then((u) => i(u)) : i(c);
|
|
3505
3496
|
}
|
|
3506
3497
|
min(e, t) {
|
|
3507
3498
|
return new X({
|
|
@@ -3522,11 +3513,11 @@ class X extends b {
|
|
|
3522
3513
|
return this.min(1, e);
|
|
3523
3514
|
}
|
|
3524
3515
|
}
|
|
3525
|
-
X.create = (
|
|
3526
|
-
valueType:
|
|
3516
|
+
X.create = (s, e) => new X({
|
|
3517
|
+
valueType: s,
|
|
3527
3518
|
minSize: null,
|
|
3528
3519
|
maxSize: null,
|
|
3529
|
-
typeName:
|
|
3520
|
+
typeName: v.ZodSet,
|
|
3530
3521
|
..._(e)
|
|
3531
3522
|
});
|
|
3532
3523
|
class Ce extends b {
|
|
@@ -3538,9 +3529,9 @@ class Ce extends b {
|
|
|
3538
3529
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
3539
3530
|
}
|
|
3540
3531
|
}
|
|
3541
|
-
Ce.create = (
|
|
3542
|
-
getter:
|
|
3543
|
-
typeName:
|
|
3532
|
+
Ce.create = (s, e) => new Ce({
|
|
3533
|
+
getter: s,
|
|
3534
|
+
typeName: v.ZodLazy,
|
|
3544
3535
|
..._(e)
|
|
3545
3536
|
});
|
|
3546
3537
|
class we extends b {
|
|
@@ -3551,7 +3542,7 @@ class we extends b {
|
|
|
3551
3542
|
received: t.data,
|
|
3552
3543
|
code: d.invalid_literal,
|
|
3553
3544
|
expected: this._def.value
|
|
3554
|
-
}),
|
|
3545
|
+
}), g;
|
|
3555
3546
|
}
|
|
3556
3547
|
return { status: "valid", value: e.data };
|
|
3557
3548
|
}
|
|
@@ -3559,35 +3550,35 @@ class we extends b {
|
|
|
3559
3550
|
return this._def.value;
|
|
3560
3551
|
}
|
|
3561
3552
|
}
|
|
3562
|
-
we.create = (
|
|
3563
|
-
value:
|
|
3564
|
-
typeName:
|
|
3553
|
+
we.create = (s, e) => new we({
|
|
3554
|
+
value: s,
|
|
3555
|
+
typeName: v.ZodLiteral,
|
|
3565
3556
|
..._(e)
|
|
3566
3557
|
});
|
|
3567
|
-
function Ve(
|
|
3568
|
-
return new
|
|
3569
|
-
values:
|
|
3570
|
-
typeName:
|
|
3558
|
+
function Ve(s, e) {
|
|
3559
|
+
return new W({
|
|
3560
|
+
values: s,
|
|
3561
|
+
typeName: v.ZodEnum,
|
|
3571
3562
|
..._(e)
|
|
3572
3563
|
});
|
|
3573
3564
|
}
|
|
3574
|
-
class
|
|
3565
|
+
class W extends b {
|
|
3575
3566
|
_parse(e) {
|
|
3576
3567
|
if (typeof e.data != "string") {
|
|
3577
|
-
const t = this._getOrReturnCtx(e),
|
|
3568
|
+
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
3578
3569
|
return l(t, {
|
|
3579
|
-
expected: x.joinValues(
|
|
3570
|
+
expected: x.joinValues(n),
|
|
3580
3571
|
received: t.parsedType,
|
|
3581
3572
|
code: d.invalid_type
|
|
3582
|
-
}),
|
|
3573
|
+
}), g;
|
|
3583
3574
|
}
|
|
3584
3575
|
if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
|
|
3585
|
-
const t = this._getOrReturnCtx(e),
|
|
3576
|
+
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
3586
3577
|
return l(t, {
|
|
3587
3578
|
received: t.data,
|
|
3588
3579
|
code: d.invalid_enum_value,
|
|
3589
|
-
options:
|
|
3590
|
-
}),
|
|
3580
|
+
options: n
|
|
3581
|
+
}), g;
|
|
3591
3582
|
}
|
|
3592
3583
|
return C(e.data);
|
|
3593
3584
|
}
|
|
@@ -3613,37 +3604,37 @@ class q extends b {
|
|
|
3613
3604
|
return e;
|
|
3614
3605
|
}
|
|
3615
3606
|
extract(e, t = this._def) {
|
|
3616
|
-
return
|
|
3607
|
+
return W.create(e, {
|
|
3617
3608
|
...this._def,
|
|
3618
3609
|
...t
|
|
3619
3610
|
});
|
|
3620
3611
|
}
|
|
3621
3612
|
exclude(e, t = this._def) {
|
|
3622
|
-
return
|
|
3613
|
+
return W.create(this.options.filter((n) => !e.includes(n)), {
|
|
3623
3614
|
...this._def,
|
|
3624
3615
|
...t
|
|
3625
3616
|
});
|
|
3626
3617
|
}
|
|
3627
3618
|
}
|
|
3628
|
-
|
|
3619
|
+
W.create = Ve;
|
|
3629
3620
|
class Oe extends b {
|
|
3630
3621
|
_parse(e) {
|
|
3631
|
-
const t = x.getValidEnumValues(this._def.values),
|
|
3632
|
-
if (
|
|
3622
|
+
const t = x.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
3623
|
+
if (n.parsedType !== f.string && n.parsedType !== f.number) {
|
|
3633
3624
|
const a = x.objectValues(t);
|
|
3634
|
-
return l(
|
|
3625
|
+
return l(n, {
|
|
3635
3626
|
expected: x.joinValues(a),
|
|
3636
|
-
received:
|
|
3627
|
+
received: n.parsedType,
|
|
3637
3628
|
code: d.invalid_type
|
|
3638
|
-
}),
|
|
3629
|
+
}), g;
|
|
3639
3630
|
}
|
|
3640
3631
|
if (this._cache || (this._cache = new Set(x.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
|
|
3641
3632
|
const a = x.objectValues(t);
|
|
3642
|
-
return l(
|
|
3643
|
-
received:
|
|
3633
|
+
return l(n, {
|
|
3634
|
+
received: n.data,
|
|
3644
3635
|
code: d.invalid_enum_value,
|
|
3645
3636
|
options: a
|
|
3646
|
-
}),
|
|
3637
|
+
}), g;
|
|
3647
3638
|
}
|
|
3648
3639
|
return C(e.data);
|
|
3649
3640
|
}
|
|
@@ -3651,9 +3642,9 @@ class Oe extends b {
|
|
|
3651
3642
|
return this._def.values;
|
|
3652
3643
|
}
|
|
3653
3644
|
}
|
|
3654
|
-
Oe.create = (
|
|
3655
|
-
values:
|
|
3656
|
-
typeName:
|
|
3645
|
+
Oe.create = (s, e) => new Oe({
|
|
3646
|
+
values: s,
|
|
3647
|
+
typeName: v.ZodNativeEnum,
|
|
3657
3648
|
..._(e)
|
|
3658
3649
|
});
|
|
3659
3650
|
class ae extends b {
|
|
@@ -3667,109 +3658,109 @@ class ae extends b {
|
|
|
3667
3658
|
code: d.invalid_type,
|
|
3668
3659
|
expected: f.promise,
|
|
3669
3660
|
received: t.parsedType
|
|
3670
|
-
}),
|
|
3671
|
-
const
|
|
3672
|
-
return C(
|
|
3661
|
+
}), g;
|
|
3662
|
+
const n = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
|
|
3663
|
+
return C(n.then((a) => this._def.type.parseAsync(a, {
|
|
3673
3664
|
path: t.path,
|
|
3674
3665
|
errorMap: t.common.contextualErrorMap
|
|
3675
3666
|
})));
|
|
3676
3667
|
}
|
|
3677
3668
|
}
|
|
3678
|
-
ae.create = (
|
|
3679
|
-
type:
|
|
3680
|
-
typeName:
|
|
3669
|
+
ae.create = (s, e) => new ae({
|
|
3670
|
+
type: s,
|
|
3671
|
+
typeName: v.ZodPromise,
|
|
3681
3672
|
..._(e)
|
|
3682
3673
|
});
|
|
3683
|
-
class
|
|
3674
|
+
class q extends b {
|
|
3684
3675
|
innerType() {
|
|
3685
3676
|
return this._def.schema;
|
|
3686
3677
|
}
|
|
3687
3678
|
sourceType() {
|
|
3688
|
-
return this._def.schema._def.typeName ===
|
|
3679
|
+
return this._def.schema._def.typeName === v.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
3689
3680
|
}
|
|
3690
3681
|
_parse(e) {
|
|
3691
|
-
const { status: t, ctx:
|
|
3682
|
+
const { status: t, ctx: n } = this._processInputParams(e), a = this._def.effect || null, r = {
|
|
3692
3683
|
addIssue: (i) => {
|
|
3693
|
-
l(
|
|
3684
|
+
l(n, i), i.fatal ? t.abort() : t.dirty();
|
|
3694
3685
|
},
|
|
3695
3686
|
get path() {
|
|
3696
|
-
return
|
|
3687
|
+
return n.path;
|
|
3697
3688
|
}
|
|
3698
3689
|
};
|
|
3699
3690
|
if (r.addIssue = r.addIssue.bind(r), a.type === "preprocess") {
|
|
3700
|
-
const i = a.transform(
|
|
3701
|
-
if (
|
|
3691
|
+
const i = a.transform(n.data, r);
|
|
3692
|
+
if (n.common.async)
|
|
3702
3693
|
return Promise.resolve(i).then(async (c) => {
|
|
3703
3694
|
if (t.value === "aborted")
|
|
3704
|
-
return
|
|
3695
|
+
return g;
|
|
3705
3696
|
const u = await this._def.schema._parseAsync({
|
|
3706
3697
|
data: c,
|
|
3707
|
-
path:
|
|
3708
|
-
parent:
|
|
3698
|
+
path: n.path,
|
|
3699
|
+
parent: n
|
|
3709
3700
|
});
|
|
3710
|
-
return u.status === "aborted" ?
|
|
3701
|
+
return u.status === "aborted" ? g : u.status === "dirty" || t.value === "dirty" ? J(u.value) : u;
|
|
3711
3702
|
});
|
|
3712
3703
|
{
|
|
3713
3704
|
if (t.value === "aborted")
|
|
3714
|
-
return
|
|
3705
|
+
return g;
|
|
3715
3706
|
const c = this._def.schema._parseSync({
|
|
3716
3707
|
data: i,
|
|
3717
|
-
path:
|
|
3718
|
-
parent:
|
|
3708
|
+
path: n.path,
|
|
3709
|
+
parent: n
|
|
3719
3710
|
});
|
|
3720
|
-
return c.status === "aborted" ?
|
|
3711
|
+
return c.status === "aborted" ? g : c.status === "dirty" || t.value === "dirty" ? J(c.value) : c;
|
|
3721
3712
|
}
|
|
3722
3713
|
}
|
|
3723
3714
|
if (a.type === "refinement") {
|
|
3724
3715
|
const i = (c) => {
|
|
3725
3716
|
const u = a.refinement(c, r);
|
|
3726
|
-
if (
|
|
3717
|
+
if (n.common.async)
|
|
3727
3718
|
return Promise.resolve(u);
|
|
3728
3719
|
if (u instanceof Promise)
|
|
3729
3720
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3730
3721
|
return c;
|
|
3731
3722
|
};
|
|
3732
|
-
if (
|
|
3723
|
+
if (n.common.async === !1) {
|
|
3733
3724
|
const c = this._def.schema._parseSync({
|
|
3734
|
-
data:
|
|
3735
|
-
path:
|
|
3736
|
-
parent:
|
|
3725
|
+
data: n.data,
|
|
3726
|
+
path: n.path,
|
|
3727
|
+
parent: n
|
|
3737
3728
|
});
|
|
3738
|
-
return c.status === "aborted" ?
|
|
3729
|
+
return c.status === "aborted" ? g : (c.status === "dirty" && t.dirty(), i(c.value), { status: t.value, value: c.value });
|
|
3739
3730
|
} else
|
|
3740
|
-
return this._def.schema._parseAsync({ data:
|
|
3731
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((c) => c.status === "aborted" ? g : (c.status === "dirty" && t.dirty(), i(c.value).then(() => ({ status: t.value, value: c.value }))));
|
|
3741
3732
|
}
|
|
3742
3733
|
if (a.type === "transform")
|
|
3743
|
-
if (
|
|
3734
|
+
if (n.common.async === !1) {
|
|
3744
3735
|
const i = this._def.schema._parseSync({
|
|
3745
|
-
data:
|
|
3746
|
-
path:
|
|
3747
|
-
parent:
|
|
3736
|
+
data: n.data,
|
|
3737
|
+
path: n.path,
|
|
3738
|
+
parent: n
|
|
3748
3739
|
});
|
|
3749
3740
|
if (!j(i))
|
|
3750
|
-
return
|
|
3741
|
+
return g;
|
|
3751
3742
|
const c = a.transform(i.value, r);
|
|
3752
3743
|
if (c instanceof Promise)
|
|
3753
3744
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3754
3745
|
return { status: t.value, value: c };
|
|
3755
3746
|
} else
|
|
3756
|
-
return this._def.schema._parseAsync({ data:
|
|
3747
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => j(i) ? Promise.resolve(a.transform(i.value, r)).then((c) => ({
|
|
3757
3748
|
status: t.value,
|
|
3758
3749
|
value: c
|
|
3759
|
-
})) :
|
|
3750
|
+
})) : g);
|
|
3760
3751
|
x.assertNever(a);
|
|
3761
3752
|
}
|
|
3762
3753
|
}
|
|
3763
|
-
|
|
3764
|
-
schema:
|
|
3765
|
-
typeName:
|
|
3754
|
+
q.create = (s, e, t) => new q({
|
|
3755
|
+
schema: s,
|
|
3756
|
+
typeName: v.ZodEffects,
|
|
3766
3757
|
effect: e,
|
|
3767
3758
|
..._(t)
|
|
3768
3759
|
});
|
|
3769
|
-
|
|
3760
|
+
q.createWithPreprocess = (s, e, t) => new q({
|
|
3770
3761
|
schema: e,
|
|
3771
|
-
effect: { type: "preprocess", transform:
|
|
3772
|
-
typeName:
|
|
3762
|
+
effect: { type: "preprocess", transform: s },
|
|
3763
|
+
typeName: v.ZodEffects,
|
|
3773
3764
|
..._(t)
|
|
3774
3765
|
});
|
|
3775
3766
|
class B extends b {
|
|
@@ -3780,12 +3771,12 @@ class B extends b {
|
|
|
3780
3771
|
return this._def.innerType;
|
|
3781
3772
|
}
|
|
3782
3773
|
}
|
|
3783
|
-
B.create = (
|
|
3784
|
-
innerType:
|
|
3785
|
-
typeName:
|
|
3774
|
+
B.create = (s, e) => new B({
|
|
3775
|
+
innerType: s,
|
|
3776
|
+
typeName: v.ZodOptional,
|
|
3786
3777
|
..._(e)
|
|
3787
3778
|
});
|
|
3788
|
-
class
|
|
3779
|
+
class G extends b {
|
|
3789
3780
|
_parse(e) {
|
|
3790
3781
|
return this._getType(e) === f.null ? C(null) : this._def.innerType._parse(e);
|
|
3791
3782
|
}
|
|
@@ -3793,17 +3784,17 @@ class K extends b {
|
|
|
3793
3784
|
return this._def.innerType;
|
|
3794
3785
|
}
|
|
3795
3786
|
}
|
|
3796
|
-
|
|
3797
|
-
innerType:
|
|
3798
|
-
typeName:
|
|
3787
|
+
G.create = (s, e) => new G({
|
|
3788
|
+
innerType: s,
|
|
3789
|
+
typeName: v.ZodNullable,
|
|
3799
3790
|
..._(e)
|
|
3800
3791
|
});
|
|
3801
3792
|
class de extends b {
|
|
3802
3793
|
_parse(e) {
|
|
3803
3794
|
const { ctx: t } = this._processInputParams(e);
|
|
3804
|
-
let
|
|
3805
|
-
return t.parsedType === f.undefined && (
|
|
3806
|
-
data:
|
|
3795
|
+
let n = t.data;
|
|
3796
|
+
return t.parsedType === f.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
|
|
3797
|
+
data: n,
|
|
3807
3798
|
path: t.path,
|
|
3808
3799
|
parent: t
|
|
3809
3800
|
});
|
|
@@ -3812,42 +3803,42 @@ class de extends b {
|
|
|
3812
3803
|
return this._def.innerType;
|
|
3813
3804
|
}
|
|
3814
3805
|
}
|
|
3815
|
-
de.create = (
|
|
3816
|
-
innerType:
|
|
3817
|
-
typeName:
|
|
3806
|
+
de.create = (s, e) => new de({
|
|
3807
|
+
innerType: s,
|
|
3808
|
+
typeName: v.ZodDefault,
|
|
3818
3809
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
3819
3810
|
..._(e)
|
|
3820
3811
|
});
|
|
3821
3812
|
class ue extends b {
|
|
3822
3813
|
_parse(e) {
|
|
3823
|
-
const { ctx: t } = this._processInputParams(e),
|
|
3814
|
+
const { ctx: t } = this._processInputParams(e), n = {
|
|
3824
3815
|
...t,
|
|
3825
3816
|
common: {
|
|
3826
3817
|
...t.common,
|
|
3827
3818
|
issues: []
|
|
3828
3819
|
}
|
|
3829
3820
|
}, a = this._def.innerType._parse({
|
|
3830
|
-
data:
|
|
3831
|
-
path:
|
|
3821
|
+
data: n.data,
|
|
3822
|
+
path: n.path,
|
|
3832
3823
|
parent: {
|
|
3833
|
-
...
|
|
3824
|
+
...n
|
|
3834
3825
|
}
|
|
3835
3826
|
});
|
|
3836
3827
|
return ee(a) ? a.then((r) => ({
|
|
3837
3828
|
status: "valid",
|
|
3838
3829
|
value: r.status === "valid" ? r.value : this._def.catchValue({
|
|
3839
3830
|
get error() {
|
|
3840
|
-
return new R(
|
|
3831
|
+
return new R(n.common.issues);
|
|
3841
3832
|
},
|
|
3842
|
-
input:
|
|
3833
|
+
input: n.data
|
|
3843
3834
|
})
|
|
3844
3835
|
})) : {
|
|
3845
3836
|
status: "valid",
|
|
3846
3837
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
3847
3838
|
get error() {
|
|
3848
|
-
return new R(
|
|
3839
|
+
return new R(n.common.issues);
|
|
3849
3840
|
},
|
|
3850
|
-
input:
|
|
3841
|
+
input: n.data
|
|
3851
3842
|
})
|
|
3852
3843
|
};
|
|
3853
3844
|
}
|
|
@@ -3855,34 +3846,34 @@ class ue extends b {
|
|
|
3855
3846
|
return this._def.innerType;
|
|
3856
3847
|
}
|
|
3857
3848
|
}
|
|
3858
|
-
ue.create = (
|
|
3859
|
-
innerType:
|
|
3860
|
-
typeName:
|
|
3849
|
+
ue.create = (s, e) => new ue({
|
|
3850
|
+
innerType: s,
|
|
3851
|
+
typeName: v.ZodCatch,
|
|
3861
3852
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
3862
3853
|
..._(e)
|
|
3863
3854
|
});
|
|
3864
3855
|
class Re extends b {
|
|
3865
3856
|
_parse(e) {
|
|
3866
3857
|
if (this._getType(e) !== f.nan) {
|
|
3867
|
-
const
|
|
3868
|
-
return l(
|
|
3858
|
+
const n = this._getOrReturnCtx(e);
|
|
3859
|
+
return l(n, {
|
|
3869
3860
|
code: d.invalid_type,
|
|
3870
3861
|
expected: f.nan,
|
|
3871
|
-
received:
|
|
3872
|
-
}),
|
|
3862
|
+
received: n.parsedType
|
|
3863
|
+
}), g;
|
|
3873
3864
|
}
|
|
3874
3865
|
return { status: "valid", value: e.data };
|
|
3875
3866
|
}
|
|
3876
3867
|
}
|
|
3877
|
-
Re.create = (
|
|
3878
|
-
typeName:
|
|
3879
|
-
..._(
|
|
3868
|
+
Re.create = (s) => new Re({
|
|
3869
|
+
typeName: v.ZodNaN,
|
|
3870
|
+
..._(s)
|
|
3880
3871
|
});
|
|
3881
3872
|
class Vt extends b {
|
|
3882
3873
|
_parse(e) {
|
|
3883
|
-
const { ctx: t } = this._processInputParams(e),
|
|
3874
|
+
const { ctx: t } = this._processInputParams(e), n = t.data;
|
|
3884
3875
|
return this._def.type._parse({
|
|
3885
|
-
data:
|
|
3876
|
+
data: n,
|
|
3886
3877
|
path: t.path,
|
|
3887
3878
|
parent: t
|
|
3888
3879
|
});
|
|
@@ -3893,33 +3884,33 @@ class Vt extends b {
|
|
|
3893
3884
|
}
|
|
3894
3885
|
class he extends b {
|
|
3895
3886
|
_parse(e) {
|
|
3896
|
-
const { status: t, ctx:
|
|
3897
|
-
if (
|
|
3887
|
+
const { status: t, ctx: n } = this._processInputParams(e);
|
|
3888
|
+
if (n.common.async)
|
|
3898
3889
|
return (async () => {
|
|
3899
3890
|
const r = await this._def.in._parseAsync({
|
|
3900
|
-
data:
|
|
3901
|
-
path:
|
|
3902
|
-
parent:
|
|
3891
|
+
data: n.data,
|
|
3892
|
+
path: n.path,
|
|
3893
|
+
parent: n
|
|
3903
3894
|
});
|
|
3904
|
-
return r.status === "aborted" ?
|
|
3895
|
+
return r.status === "aborted" ? g : r.status === "dirty" ? (t.dirty(), J(r.value)) : this._def.out._parseAsync({
|
|
3905
3896
|
data: r.value,
|
|
3906
|
-
path:
|
|
3907
|
-
parent:
|
|
3897
|
+
path: n.path,
|
|
3898
|
+
parent: n
|
|
3908
3899
|
});
|
|
3909
3900
|
})();
|
|
3910
3901
|
{
|
|
3911
3902
|
const a = this._def.in._parseSync({
|
|
3912
|
-
data:
|
|
3913
|
-
path:
|
|
3914
|
-
parent:
|
|
3903
|
+
data: n.data,
|
|
3904
|
+
path: n.path,
|
|
3905
|
+
parent: n
|
|
3915
3906
|
});
|
|
3916
|
-
return a.status === "aborted" ?
|
|
3907
|
+
return a.status === "aborted" ? g : a.status === "dirty" ? (t.dirty(), {
|
|
3917
3908
|
status: "dirty",
|
|
3918
3909
|
value: a.value
|
|
3919
3910
|
}) : this._def.out._parseSync({
|
|
3920
3911
|
data: a.value,
|
|
3921
|
-
path:
|
|
3922
|
-
parent:
|
|
3912
|
+
path: n.path,
|
|
3913
|
+
parent: n
|
|
3923
3914
|
});
|
|
3924
3915
|
}
|
|
3925
3916
|
}
|
|
@@ -3927,51 +3918,51 @@ class he extends b {
|
|
|
3927
3918
|
return new he({
|
|
3928
3919
|
in: e,
|
|
3929
3920
|
out: t,
|
|
3930
|
-
typeName:
|
|
3921
|
+
typeName: v.ZodPipeline
|
|
3931
3922
|
});
|
|
3932
3923
|
}
|
|
3933
3924
|
}
|
|
3934
3925
|
class le extends b {
|
|
3935
3926
|
_parse(e) {
|
|
3936
|
-
const t = this._def.innerType._parse(e),
|
|
3937
|
-
return ee(t) ? t.then((a) =>
|
|
3927
|
+
const t = this._def.innerType._parse(e), n = (a) => (j(a) && (a.value = Object.freeze(a.value)), a);
|
|
3928
|
+
return ee(t) ? t.then((a) => n(a)) : n(t);
|
|
3938
3929
|
}
|
|
3939
3930
|
unwrap() {
|
|
3940
3931
|
return this._def.innerType;
|
|
3941
3932
|
}
|
|
3942
3933
|
}
|
|
3943
|
-
le.create = (
|
|
3944
|
-
innerType:
|
|
3945
|
-
typeName:
|
|
3934
|
+
le.create = (s, e) => new le({
|
|
3935
|
+
innerType: s,
|
|
3936
|
+
typeName: v.ZodReadonly,
|
|
3946
3937
|
..._(e)
|
|
3947
3938
|
});
|
|
3948
|
-
var
|
|
3949
|
-
(function(
|
|
3950
|
-
|
|
3951
|
-
})(
|
|
3939
|
+
var v;
|
|
3940
|
+
(function(s) {
|
|
3941
|
+
s.ZodString = "ZodString", s.ZodNumber = "ZodNumber", s.ZodNaN = "ZodNaN", s.ZodBigInt = "ZodBigInt", s.ZodBoolean = "ZodBoolean", s.ZodDate = "ZodDate", s.ZodSymbol = "ZodSymbol", s.ZodUndefined = "ZodUndefined", s.ZodNull = "ZodNull", s.ZodAny = "ZodAny", s.ZodUnknown = "ZodUnknown", s.ZodNever = "ZodNever", s.ZodVoid = "ZodVoid", s.ZodArray = "ZodArray", s.ZodObject = "ZodObject", s.ZodUnion = "ZodUnion", s.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", s.ZodIntersection = "ZodIntersection", s.ZodTuple = "ZodTuple", s.ZodRecord = "ZodRecord", s.ZodMap = "ZodMap", s.ZodSet = "ZodSet", s.ZodFunction = "ZodFunction", s.ZodLazy = "ZodLazy", s.ZodLiteral = "ZodLiteral", s.ZodEnum = "ZodEnum", s.ZodEffects = "ZodEffects", s.ZodNativeEnum = "ZodNativeEnum", s.ZodOptional = "ZodOptional", s.ZodNullable = "ZodNullable", s.ZodDefault = "ZodDefault", s.ZodCatch = "ZodCatch", s.ZodPromise = "ZodPromise", s.ZodBranded = "ZodBranded", s.ZodPipeline = "ZodPipeline", s.ZodReadonly = "ZodReadonly";
|
|
3942
|
+
})(v || (v = {}));
|
|
3952
3943
|
const L = P.create, Zt = H.create, $t = z.create;
|
|
3953
3944
|
U.create;
|
|
3954
3945
|
O.create;
|
|
3955
|
-
const Ft =
|
|
3956
|
-
|
|
3946
|
+
const Ft = S.create, jt = se.create;
|
|
3947
|
+
ne.create;
|
|
3957
3948
|
$.create;
|
|
3958
|
-
|
|
3949
|
+
W.create;
|
|
3959
3950
|
ae.create;
|
|
3960
3951
|
B.create;
|
|
3961
|
-
|
|
3952
|
+
G.create;
|
|
3962
3953
|
function Ht() {
|
|
3963
|
-
const
|
|
3954
|
+
const s = /* @__PURE__ */ new Map();
|
|
3964
3955
|
return {
|
|
3965
3956
|
on(e, t) {
|
|
3966
|
-
let
|
|
3967
|
-
return
|
|
3968
|
-
|
|
3957
|
+
let n = s.get(e);
|
|
3958
|
+
return n || (n = /* @__PURE__ */ new Set(), s.set(e, n)), n.add(t), () => {
|
|
3959
|
+
n == null || n.delete(t), n && n.size === 0 && s.delete(e);
|
|
3969
3960
|
};
|
|
3970
3961
|
},
|
|
3971
3962
|
emit(e, ...t) {
|
|
3972
|
-
const
|
|
3973
|
-
if (!(!
|
|
3974
|
-
for (const a of
|
|
3963
|
+
const n = s.get(e);
|
|
3964
|
+
if (!(!n || n.size === 0))
|
|
3965
|
+
for (const a of n)
|
|
3975
3966
|
try {
|
|
3976
3967
|
a(...t);
|
|
3977
3968
|
} catch (r) {
|
|
@@ -3982,15 +3973,15 @@ function Ht() {
|
|
|
3982
3973
|
}
|
|
3983
3974
|
},
|
|
3984
3975
|
off(e, t) {
|
|
3985
|
-
const
|
|
3986
|
-
|
|
3976
|
+
const n = s.get(e);
|
|
3977
|
+
n && (n.delete(t), n.size === 0 && s.delete(e));
|
|
3987
3978
|
},
|
|
3988
3979
|
clear() {
|
|
3989
|
-
|
|
3980
|
+
s.clear();
|
|
3990
3981
|
}
|
|
3991
3982
|
};
|
|
3992
3983
|
}
|
|
3993
|
-
class
|
|
3984
|
+
class Rs {
|
|
3994
3985
|
constructor(e, t) {
|
|
3995
3986
|
/** Event emitter for this action */
|
|
3996
3987
|
I(this, "eventEmitter");
|
|
@@ -4017,12 +4008,12 @@ class Ln {
|
|
|
4017
4008
|
*
|
|
4018
4009
|
* Uses explicit switch to avoid dynamic property access (security best practice).
|
|
4019
4010
|
*/
|
|
4020
|
-
log(e, t,
|
|
4011
|
+
log(e, t, n) {
|
|
4021
4012
|
if (!this.logger) return;
|
|
4022
4013
|
const a = {
|
|
4023
4014
|
action: this.constructor.name,
|
|
4024
4015
|
status: this._status,
|
|
4025
|
-
...
|
|
4016
|
+
...n
|
|
4026
4017
|
};
|
|
4027
4018
|
switch (e) {
|
|
4028
4019
|
case "debug":
|
|
@@ -4093,11 +4084,11 @@ class Ln {
|
|
|
4093
4084
|
* @throws LombardError if current status is not in expected list
|
|
4094
4085
|
*/
|
|
4095
4086
|
assertStatus(e, t) {
|
|
4096
|
-
const
|
|
4097
|
-
if (!
|
|
4087
|
+
const n = Array.isArray(e) ? e : [e];
|
|
4088
|
+
if (!n.includes(this._status))
|
|
4098
4089
|
throw new E(
|
|
4099
4090
|
Z.INVALID_STATE,
|
|
4100
|
-
`Cannot ${t} while status is ${this._status}, allowed: ${
|
|
4091
|
+
`Cannot ${t} while status is ${this._status}, allowed: ${n.join(", ")}`
|
|
4101
4092
|
);
|
|
4102
4093
|
}
|
|
4103
4094
|
// ─────────────────────────────────────────────────────────────────────────
|
|
@@ -4197,16 +4188,16 @@ class Ln {
|
|
|
4197
4188
|
* ```
|
|
4198
4189
|
*/
|
|
4199
4190
|
async act(e, t) {
|
|
4200
|
-
const
|
|
4191
|
+
const n = performance.now(), a = t ?? "operation";
|
|
4201
4192
|
this.log("debug", `Starting ${a}`, { step: String(a) }), this.clearError(), this.setLoading(!0);
|
|
4202
4193
|
try {
|
|
4203
|
-
const r = await e(), i = performance.now() -
|
|
4194
|
+
const r = await e(), i = performance.now() - n;
|
|
4204
4195
|
return this.recordTiming(String(a), i), this.log("info", `Completed ${a}`, {
|
|
4205
4196
|
step: String(a),
|
|
4206
4197
|
duration: Math.round(i)
|
|
4207
4198
|
}), t !== void 0 && this.updateStatus(t), r;
|
|
4208
4199
|
} catch (r) {
|
|
4209
|
-
const i = performance.now() -
|
|
4200
|
+
const i = performance.now() - n, c = r instanceof E ? r : pe(r);
|
|
4210
4201
|
return this.recordTiming(String(a), i), this.log("error", `Failed ${a}`, {
|
|
4211
4202
|
step: String(a),
|
|
4212
4203
|
duration: Math.round(i),
|
|
@@ -4262,45 +4253,45 @@ class Ln {
|
|
|
4262
4253
|
this.eventEmitter.clear();
|
|
4263
4254
|
}
|
|
4264
4255
|
}
|
|
4265
|
-
function zt(
|
|
4266
|
-
if (!
|
|
4256
|
+
function zt(s) {
|
|
4257
|
+
if (!s || typeof s != "string")
|
|
4267
4258
|
return !1;
|
|
4268
|
-
if (
|
|
4259
|
+
if (s.startsWith("bc1") || s.startsWith("tb1"))
|
|
4269
4260
|
try {
|
|
4270
|
-
return me.address.fromBech32(
|
|
4261
|
+
return me.address.fromBech32(s), !0;
|
|
4271
4262
|
} catch {
|
|
4272
4263
|
return !1;
|
|
4273
4264
|
}
|
|
4274
4265
|
try {
|
|
4275
|
-
return me.address.fromBase58Check(
|
|
4266
|
+
return me.address.fromBase58Check(s), !0;
|
|
4276
4267
|
} catch {
|
|
4277
4268
|
return !1;
|
|
4278
4269
|
}
|
|
4279
4270
|
}
|
|
4280
|
-
function
|
|
4271
|
+
function Wt(s) {
|
|
4281
4272
|
const e = /^[1-9A-HJ-NP-Za-km-z]+$/;
|
|
4282
|
-
if (!
|
|
4273
|
+
if (!s || typeof s != "string" || !e.test(s) || s.length < 32 || s.length > 44)
|
|
4283
4274
|
return !1;
|
|
4284
4275
|
try {
|
|
4285
|
-
return
|
|
4276
|
+
return qt(s).length === 32;
|
|
4286
4277
|
} catch {
|
|
4287
4278
|
return !1;
|
|
4288
4279
|
}
|
|
4289
4280
|
}
|
|
4290
|
-
function
|
|
4281
|
+
function qt(s) {
|
|
4291
4282
|
const e = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz", t = {};
|
|
4292
4283
|
for (let u = 0; u < e.length; u++)
|
|
4293
4284
|
t[e[u]] = u;
|
|
4294
|
-
if (
|
|
4285
|
+
if (s.length === 0)
|
|
4295
4286
|
return new Uint8Array(0);
|
|
4296
|
-
let
|
|
4297
|
-
for (let u = 0; u <
|
|
4298
|
-
|
|
4299
|
-
const a = Math.ceil(
|
|
4300
|
-
for (let u =
|
|
4301
|
-
const h = t[
|
|
4287
|
+
let n = 0;
|
|
4288
|
+
for (let u = 0; u < s.length && s[u] === "1"; u++)
|
|
4289
|
+
n++;
|
|
4290
|
+
const a = Math.ceil(s.length * Math.log(58) / Math.log(256)), r = new Uint8Array(a);
|
|
4291
|
+
for (let u = n; u < s.length; u++) {
|
|
4292
|
+
const h = t[s[u]];
|
|
4302
4293
|
if (h === void 0)
|
|
4303
|
-
throw new Error(`Invalid base58 character: ${
|
|
4294
|
+
throw new Error(`Invalid base58 character: ${s[u]}`);
|
|
4304
4295
|
let A = h;
|
|
4305
4296
|
for (let w = a - 1; w >= 0; w--)
|
|
4306
4297
|
A += 58 * r[w], r[w] = A % 256, A = Math.floor(A / 256);
|
|
@@ -4308,45 +4299,45 @@ function Wt(n) {
|
|
|
4308
4299
|
let i = 0;
|
|
4309
4300
|
for (; i < r.length && r[i] === 0; )
|
|
4310
4301
|
i++;
|
|
4311
|
-
const c = new Uint8Array(
|
|
4312
|
-
return c.fill(0, 0,
|
|
4302
|
+
const c = new Uint8Array(n + (r.length - i));
|
|
4303
|
+
return c.fill(0, 0, n), c.set(r.subarray(i), n), c;
|
|
4313
4304
|
}
|
|
4314
|
-
function Ze(
|
|
4305
|
+
function Ze(s) {
|
|
4315
4306
|
const e = L({ message: "Amount is required" }).min(1, "Amount is required").refine((t) => t !== "0", {
|
|
4316
4307
|
message: "Amount must be greater than 0"
|
|
4317
4308
|
}).refine(
|
|
4318
4309
|
(t) => {
|
|
4319
|
-
const
|
|
4320
|
-
return !Number.isNaN(
|
|
4310
|
+
const n = Number.parseFloat(t);
|
|
4311
|
+
return !Number.isNaN(n) && n > 0;
|
|
4321
4312
|
},
|
|
4322
4313
|
{ message: "Invalid amount format" }
|
|
4323
4314
|
);
|
|
4324
|
-
return
|
|
4325
|
-
(t) => Number.parseFloat(t) >=
|
|
4326
|
-
{ message: `Amount must be at least ${
|
|
4315
|
+
return s !== void 0 && s > 0 ? e.refine(
|
|
4316
|
+
(t) => Number.parseFloat(t) >= s,
|
|
4317
|
+
{ message: `Amount must be at least ${s}` }
|
|
4327
4318
|
) : e;
|
|
4328
4319
|
}
|
|
4329
|
-
const
|
|
4330
|
-
jt([$t(), Zt()]).refine((
|
|
4331
|
-
const
|
|
4320
|
+
const Gt = Ze(), Kt = Ze(Xe), Ls = Gt;
|
|
4321
|
+
jt([$t(), Zt()]).refine((s) => s > 0, { message: "Amount must be greater than 0" });
|
|
4322
|
+
const Ds = L({ message: "Address is required" }).regex(/^0x[a-fA-F0-9]{40}$/, "Invalid EVM address format"), Ps = L({ message: "Address is required" }).refine(Wt, { message: "Invalid Solana address format" }), Bs = L({ message: "Address is required" }).regex(/^0x[a-fA-F0-9]{64}$/, "Invalid Sui address format"), Ms = L({ message: "Address is required" }).regex(/^0x[a-fA-F0-9]{1,64}$/, "Invalid Starknet address format"), Us = L({ message: "Address is required" }).refine(zt, { message: "Invalid Bitcoin address format" }), Yt = L().optional();
|
|
4332
4323
|
L().regex(/^0x[a-fA-F0-9]{64}$/, "Invalid transaction hash");
|
|
4333
4324
|
Ft({
|
|
4334
|
-
amount:
|
|
4325
|
+
amount: Kt,
|
|
4335
4326
|
recipient: L({ message: "Recipient is required" }).min(1, "Recipient is required"),
|
|
4336
4327
|
referralCode: Yt
|
|
4337
4328
|
});
|
|
4338
|
-
function
|
|
4339
|
-
const
|
|
4340
|
-
if (!
|
|
4341
|
-
const a =
|
|
4329
|
+
function Vs(s, e, t = {}) {
|
|
4330
|
+
const n = s.safeParse(e);
|
|
4331
|
+
if (!n.success) {
|
|
4332
|
+
const a = n.error.issues[0], r = a == null ? void 0 : a.path[0], i = (a == null ? void 0 : a.message) ?? "Invalid parameter";
|
|
4342
4333
|
throw r === "amount" ? E.invalidAmount(i) : r === "recipient" ? E.invalidAddress(
|
|
4343
4334
|
e == null ? void 0 : e.recipient,
|
|
4344
4335
|
t.destChain
|
|
4345
4336
|
) : E.invalidParameter(String(r), i);
|
|
4346
4337
|
}
|
|
4347
|
-
return
|
|
4338
|
+
return n.data;
|
|
4348
4339
|
}
|
|
4349
|
-
const
|
|
4340
|
+
const Zs = {
|
|
4350
4341
|
/** Initial state - ready for prepare() */
|
|
4351
4342
|
IDLE: "idle",
|
|
4352
4343
|
// Authorization states (mutually exclusive - action uses one based on config)
|
|
@@ -4360,7 +4351,7 @@ const $n = {
|
|
|
4360
4351
|
READY: "ready",
|
|
4361
4352
|
/** Deposit address generated - awaiting BTC deposit */
|
|
4362
4353
|
ADDRESS_READY: "address_ready"
|
|
4363
|
-
},
|
|
4354
|
+
}, $s = {
|
|
4364
4355
|
IDLE: "idle",
|
|
4365
4356
|
/** User needs to sign fee authorization (Ethereum/Sepolia only) */
|
|
4366
4357
|
NEEDS_FEE_AUTHORIZATION: "needs_fee_authorization",
|
|
@@ -4369,78 +4360,78 @@ const $n = {
|
|
|
4369
4360
|
READY: "ready",
|
|
4370
4361
|
CONFIRMING: "confirming",
|
|
4371
4362
|
COMPLETED: "completed"
|
|
4372
|
-
},
|
|
4363
|
+
}, Fs = {
|
|
4373
4364
|
IDLE: "idle",
|
|
4374
4365
|
READY: "ready",
|
|
4375
4366
|
CONFIRMING: "confirming",
|
|
4376
4367
|
COMPLETED: "completed"
|
|
4377
4368
|
};
|
|
4378
4369
|
export {
|
|
4379
|
-
|
|
4370
|
+
Ns as $,
|
|
4380
4371
|
Ft as A,
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4372
|
+
Zs as B,
|
|
4373
|
+
K as C,
|
|
4374
|
+
Gt as D,
|
|
4375
|
+
et as E,
|
|
4385
4376
|
ft as F,
|
|
4386
4377
|
De as G,
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4378
|
+
N as H,
|
|
4379
|
+
ms as I,
|
|
4380
|
+
Ss as J,
|
|
4381
|
+
gs as K,
|
|
4391
4382
|
E as L,
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4383
|
+
ps as M,
|
|
4384
|
+
Fs as N,
|
|
4385
|
+
vs as O,
|
|
4395
4386
|
lt as P,
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4387
|
+
ys as Q,
|
|
4388
|
+
st as R,
|
|
4389
|
+
ss as S,
|
|
4390
|
+
As as T,
|
|
4391
|
+
Es as U,
|
|
4401
4392
|
Z as V,
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4393
|
+
bs as W,
|
|
4394
|
+
ls as X,
|
|
4395
|
+
Ls as Y,
|
|
4396
|
+
L as Z,
|
|
4397
|
+
Ds as _,
|
|
4398
|
+
o as a,
|
|
4399
|
+
Is as a0,
|
|
4409
4400
|
at as a1,
|
|
4410
|
-
|
|
4401
|
+
Cs as a2,
|
|
4411
4402
|
Yt as a3,
|
|
4412
|
-
|
|
4403
|
+
Kt as a4,
|
|
4413
4404
|
fe as a5,
|
|
4414
4405
|
p as a6,
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4406
|
+
Ps as a7,
|
|
4407
|
+
Ms as a8,
|
|
4408
|
+
Bs as a9,
|
|
4409
|
+
os as aa,
|
|
4410
|
+
ks as ab,
|
|
4411
|
+
nt as b,
|
|
4412
|
+
$s as c,
|
|
4413
|
+
tt as d,
|
|
4414
|
+
ns as e,
|
|
4415
|
+
Qe as f,
|
|
4416
|
+
Os as g,
|
|
4417
|
+
ws as h,
|
|
4418
|
+
as as i,
|
|
4419
|
+
fs as j,
|
|
4420
|
+
xs as k,
|
|
4421
|
+
hs as l,
|
|
4422
|
+
Ts as m,
|
|
4423
|
+
ie as n,
|
|
4424
|
+
is as o,
|
|
4425
|
+
cs as p,
|
|
4426
|
+
_s as q,
|
|
4427
|
+
rs as r,
|
|
4428
|
+
Le as s,
|
|
4429
|
+
rt as t,
|
|
4430
|
+
us as u,
|
|
4431
|
+
ds as v,
|
|
4441
4432
|
pe as w,
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4433
|
+
Us as x,
|
|
4434
|
+
Rs as y,
|
|
4435
|
+
Vs as z
|
|
4445
4436
|
};
|
|
4446
|
-
//# sourceMappingURL=statusConstants-
|
|
4437
|
+
//# sourceMappingURL=statusConstants-CJk6vOiM.js.map
|