@orca-so/wavebreak
Version:
The wavebreak JS client for interacting with the wavebreak program.
1,304 lines (1,302 loc) • 437 kB
JavaScript
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
let VI, iC, nC, sC, gA, uC, wC, ZI, hC, GC, Bg, jI, _C, UC, LC, OC, pC, Eg, Qg, PC, gC, xC, XC, eg, ig, $C, BC, IB, EB, iB, nB, sB, uB, og, wB, hB, GB, _B, UB, ag, Rt, ft, Mt, Yt, dt, kt, tt, St, mt, Dt, Gt, Ft, ot, Jt, _t, Ut, yt, Lt, ut, Tt, nt, at, rt, Nt, lt, wt, ct, ht, st, _, et, it, Zc, Wc, xc, zc, yc, Xc, Kc, jc, Nc, lc, wc, Rc, Vt, xt, Wt, Zt, Xt, zt, jt, $t, An, gn, In, Cn, Bn, En, Qn, en, on, tn, nn, an, rn, sn, cn, pt, Dn, un, Rn, ln, wn, Nn, dn, hn, Sn, Mn, Gn, yn, fn, _n, kn, Fn, Un, mn, Jn, Ln, Tn, Yn, On, bn, vc, qc, Jc, Yc, bc, Oc, pc, uc, Gc, WI, zI, AC, CC, QC, Oa, ac, sc, rc, cc, Sc, Lr, Kr, vr, Wo, zo, At, Ct, Qt, Xr, gs, Jr, br, Pr, xo, Xo, $o, It, Et, Zr, As, dc, La, hA, z, ec, mr, xI, Ur, Vo, es, os, is, tC, oC, ns, rs, as, rC, aC, cs, us, Ds, DC, cC, Tr, ic, ls, Ns, ws, lC, RC, Or, hs, Ms, Ss, dC, NC, Ta, rI, aI, XI, Yr, Zo, ys, _s, fs, MC, SC, Fs, ms, Us, fC, yC, pr, nc, qr, $I, Hr, jo, Vr, Ls, Ys, Ts, FC, kC, bs, ps, Ks, JC, mC, qs, vs, Ps, YC, TC, Ya, wo, lo, xs, Zs, Ws, KC, bC, zs, $s, js, qC, HC, Ka, qa, PA, qA, VA, vA, Pa, cI, sI, va, ho, No, Va, uI, DI, xa, lI, Wa, NI, wI, RI, za, hI, dI, ja, MI, SI, $a, Mo, So, Ar, yI, GI, Cr, _I, fI, Br, FI, kI, Er, mI, UI, oc, g0, C0, I0, VC, vC, Wr, IC, xr, gt, E0, e0, Q0, ZC, WC, zr, o0, n0, t0, jC, zC, Qr, LI, JI, tc, r0, c0, s0, gB, AB, $r, EC, jr, Bt, u0, l0, R0, BB, CB, Is, N0, h0, d0, eB, QB, or, YI, TI, M0, y0, G0, tB, oB, _0, F0, k0, rB, aB, ar, WA, xA, m0, L0, J0, DB, cB, Y0, b0, O0, lB, RB, cr, XA, ZA, Dr, sA, rA, ur, bI, OI, Rr, ng, tg, lr, pI, KI, wr, yo, Go, Nr, qI, HI, p0, q0, H0, dB, NB, v0, x0, V0, MB, SB, dr, _o, fo, hr, Fo, ko, Sr, mo, Uo, Z0, z0, X0, fB, yB, $0, gc, Ac, FB, kB, Cc, Ec, Bc, JB, mB, Es, Gr, Yo, To, Mr, yr, bo, Oo, Lo, Jo, fr, po, Ko, _r, qo, Ho, kr, vI, PI, Fr, vo, Po, Dc, pa, Cs, Bs, ba, Ha, Xa, Ir, ir, nr, sr, Qs, hc, Za, gr, er, ts, ss, Rs, ds, Gs, ks, Js, Os, Hs, Vs, Xs, A0, B0, i0, a0, D0, w0, S0, f0, U0, T0, K0, P0, W0, j0, Ic, Qc, tr, rr, Fc, Hc, mc, Mc, Lc, Tc, Uc, fc, _c, kc, Pc, Vc;
let __tla = (async () => {
var OB = 1, bB = 2, KB = 3, pB = 4, HB = 5, qB = 6, PB = 7, vB = 8, VB = 9, xB = 10, WB = -32700, ZB = -32603, XB = -32602, zB = -32601, jB = -32600, $B = -32016, AE = -32015, gE = -32014, IE = -32013, CE = -32012, BE = -32011, EE = -32010, QE = -32009, eE = -32008, iE = -32007, oE = -32006, tE = -32005, nE = -32004, aE = -32003, rE = -32002, sE = -32001, Mg = 28e5, Gg = 2800001, cE = 2800002, DE = 2800003, uE = 2800004, RE = 2800005, yg = 2800006, fg = 2800007, gg = 2800008, _g = 2800009, lE = 2800010, wE = 2800011, kg = 323e4, Fg = 32300001, Ug = 3230002, NE = 3230003, dE = 3230004, mg = 361e4, Jg = 3610001, hE = 3610002, SE = 3610003, ME = 3610004, GE = 3610005, yE = 3610006, fE = 3610007, _E = 3611e3, kE = 3704e3, FE = 3704001, UE = 3704002, mE = 3704003, JE = 3704004, LE = 4128e3, TE = 4128001, YE = 4128002, OE = 4615e3, bE = 4615001, KE = 4615002, pE = 4615003, HE = 4615004, qE = 4615005, PE = 4615006, vE = 4615007, VE = 4615008, xE = 4615009, WE = 4615010, ZE = 4615011, XE = 4615012, zE = 4615013, jE = 4615014, $E = 4615015, AQ = 4615016, gQ = 4615017, IQ = 4615018, CQ = 4615019, BQ = 4615020, EQ = 4615021, QQ = 4615022, eQ = 4615023, iQ = 4615024, oQ = 4615025, Lg = 4615026, tQ = 4615027, nQ = 4615028, aQ = 4615029, rQ = 4615030, sQ = 4615031, cQ = 4615032, DQ = 4615033, uQ = 4615034, RQ = 4615035, lQ = 4615036, wQ = 4615037, NQ = 4615038, dQ = 4615039, hQ = 4615040, SQ = 4615041, MQ = 4615042, GQ = 4615043, yQ = 4615044, fQ = 4615045, _Q = 4615046, kQ = 4615047, FQ = 4615048, UQ = 4615049, mQ = 4615050, JQ = 4615051, LQ = 4615052, TQ = 4615053, YQ = 4615054, OQ = 5508e3, bQ = 5508001, KQ = 5508002, pQ = 5508003, HQ = 5508004, qQ = 5508005, PQ = 5508006, vQ = 5508007, VQ = 5508008, xQ = 5508009, WQ = 5508010, ZQ = 5508011, XQ = 5663e3, zQ = 5663001, jQ = 5663002, $Q = 5663003, Ae = 5663004, ge = 5663005, Ie = 5663006, Ce = 5663007, Be = 5663008, Ee = 5663009, Qe = 5663010, ee = 5663011, ie = 5663012, oe = 5663013, te = 5663014, ne = 5663015, ae = 5663016, re = 5663017, se = 5663018, ce = 5663019, De = 5663020, ue = 705e4, Re = 7050001, le = 7050002, we = 7050003, Ne = 7050004, de = 7050005, he = 7050006, Se = 7050007, Me = 7050008, Ge = 7050009, ye = 7050010, fe = 7050011, _e = 7050012, ke = 7050013, Fe = 7050014, Ue = 7050015, me = 7050016, Je = 7050017, Le = 7050018, Te = 7050019, Ye = 7050020, Oe = 7050021, be = 7050022, Ke = 7050023, pe = 7050024, He = 7050025, qe = 7050026, Pe = 7050027, ve = 7050028, Ve = 7050029, xe = 7050030, We = 7050031, Ze = 7050032, Xe = 7050033, ze = 7050034, je = 7050035, $e = 7050036, Tg = 8078e3, Yg = 8078001, Og = 8078002, Ai = 8078003, bg = 8078004, Kg = 8078005, pg = 8078006, Hg = 8078007, qg = 8078008, Pg = 8078009, vg = 8078010, Vg = 8078011, bA = 8078012, gi = 8078013, Ii = 8078014, Ci = 8078015, Bi = 8078016, xg = 8078017, Wg = 8078018, Ei = 8078019, Qi = 8078020, ei = 8078021, Ig = 8078022, ii = 81e5, oi = 8100001, ti = 8100002, ni = 8100003, ai = 819e4, ri = 8190001, si = 8190002, ci = 8190003, Di = 8190004, ui = 99e5, Ri = 9900001, li = 9900002, wi = 9900003, Ni = 9900004;
function Zg(A) {
return Array.isArray(A) ? "%5B" + A.map(Zg).join("%2C%20") + "%5D" : typeof A == "bigint" ? `${A}n` : encodeURIComponent(String(A != null && Object.getPrototypeOf(A) === null ? {
...A
} : A));
}
function di([A, g]) {
return `${A}=${Zg(g)}`;
}
function hi(A) {
const g = Object.entries(A).map(di).join("&");
return btoa(g);
}
var Si = {
[kg]: "Account not found at address: $address",
[dE]: "Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",
[NE]: "Expected decoded account at address: $address",
[Ug]: "Failed to decode account data at address: $address",
[Fg]: "Accounts not found at addresses: $addresses",
[_g]: "Unable to find a viable program address bump seed.",
[cE]: "$putativeAddress is not a base58-encoded address.",
[Mg]: "Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",
[DE]: "The `CryptoKey` must be an `Ed25519` public key.",
[wE]: "$putativeOffCurveAddress is not a base58-encoded off-curve address.",
[gg]: "Invalid seeds; point must fall off the Ed25519 curve.",
[uE]: "Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",
[yg]: "A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",
[fg]: "The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",
[RE]: "Expected program derived address bump to be in the range [0, 255], got: $bump.",
[lE]: "Program address cannot end with PDA marker.",
[Gg]: "Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",
[pB]: "Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",
[OB]: "The network has progressed past the last block for which this transaction could have been committed.",
[Tg]: "Codec [$codecDescription] cannot decode empty byte arrays.",
[Ig]: "Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.",
[Qi]: "Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].",
[Kg]: "Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",
[pg]: "Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",
[bg]: "Encoder and decoder must either both be fixed-size or variable-size.",
[qg]: "Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.",
[Og]: "Expected a fixed-size codec, got a variable-size one.",
[gi]: "Codec [$codecDescription] expected a positive byte length, got $bytesLength.",
[Ai]: "Expected a variable-size codec, got a fixed-size one.",
[Ei]: "Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].",
[Yg]: "Codec [$codecDescription] expected $expected bytes, got $bytesLength.",
[Wg]: "Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].",
[Pg]: "Invalid discriminated union variant. Expected one of [$variants], got $value.",
[vg]: "Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.",
[Ci]: "Invalid literal union variant. Expected one of [$variants], got $value.",
[Hg]: "Expected [$codecDescription] to have $expected items, got $actual.",
[bA]: "Invalid value $value for base $base with alphabet $alphabet.",
[Bi]: "Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",
[Vg]: "Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",
[Ii]: "Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",
[ei]: "Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",
[xg]: "Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",
[_E]: "No random values implementation could be found.",
[xE]: "instruction requires an uninitialized account",
[eQ]: "instruction tries to borrow reference for an account which is already borrowed",
[iQ]: "instruction left account with an outstanding borrowed reference",
[EQ]: "program other than the account's owner changed the size of the account data",
[qE]: "account data too small for instruction",
[QQ]: "instruction expected an executable account",
[_Q]: "An account does not have enough lamports to be rent-exempt",
[FQ]: "Program arithmetic overflowed",
[fQ]: "Failed to serialize or deserialize account data: $encodedData",
[YQ]: "Builtin programs must consume compute units",
[cQ]: "Cross-program invocation call depth too deep",
[NQ]: "Computational budget exceeded",
[Lg]: "custom program error: #$code",
[gQ]: "instruction contains duplicate accounts",
[oQ]: "instruction modifications of multiply-passed account differ",
[rQ]: "executable accounts must be rent exempt",
[nQ]: "instruction changed executable accounts data",
[aQ]: "instruction changed the balance of an executable account",
[IQ]: "instruction changed executable bit of an account",
[jE]: "instruction modified data of an account it does not own",
[zE]: "instruction spent from the balance of an account it does not own",
[bE]: "generic instruction error",
[mQ]: "Provided owner is not allowed",
[GQ]: "Account is immutable",
[yQ]: "Incorrect authority provided",
[vE]: "incorrect program id for instruction",
[PE]: "insufficient funds for instruction",
[HE]: "invalid account data for instruction",
[kQ]: "Invalid account owner",
[KE]: "invalid program argument",
[tQ]: "program returned invalid error code",
[pE]: "invalid instruction data",
[wQ]: "Failed to reallocate account data",
[lQ]: "Provided seeds do not result in a valid address",
[JQ]: "Accounts data allocations exceeded the maximum allowed per transaction",
[LQ]: "Max accounts exceeded",
[TQ]: "Max instruction trace length exceeded",
[RQ]: "Length of the seed is too long for address generation",
[DQ]: "An account required by the instruction is missing",
[VE]: "missing required signature for instruction",
[XE]: "instruction illegally modified the program id of an account",
[BQ]: "insufficient account keys for instruction",
[dQ]: "Cross-program invocation with unauthorized signer or writable account",
[hQ]: "Failed to create program execution environment",
[MQ]: "Program failed to compile",
[SQ]: "Program failed to complete",
[AQ]: "instruction modified data of a read-only account",
[$E]: "instruction changed the balance of a read-only account",
[uQ]: "Cross-program invocation reentrancy not allowed for this instruction",
[CQ]: "instruction modified rent epoch of an account",
[ZE]: "sum of account balances before and after instruction do not match",
[WE]: "instruction requires an initialized account",
[OE]: "",
[sQ]: "Unsupported program id",
[UQ]: "Unsupported sysvar",
[LE]: "The instruction does not have any accounts.",
[TE]: "The instruction does not have any data.",
[YE]: "Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",
[HB]: "Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",
[bB]: "The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",
[li]: "Invariant violation: Found no abortable iterable cache entry for key `$cacheKey`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",
[Ni]: "Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.",
[Ri]: "Invariant violation: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",
[ui]: "Invariant violation: WebSocket message iterator is missing state storage. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",
[wi]: "Invariant violation: Switch statement non-exhaustive. Received unexpected value `$unexpectedValue`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",
[ZB]: "JSON-RPC error: Internal JSON-RPC error ($__serverMessage)",
[XB]: "JSON-RPC error: Invalid method parameter(s) ($__serverMessage)",
[jB]: "JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)",
[zB]: "JSON-RPC error: The method does not exist / is not available ($__serverMessage)",
[WB]: "JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)",
[CE]: "$__serverMessage",
[sE]: "$__serverMessage",
[nE]: "$__serverMessage",
[gE]: "$__serverMessage",
[EE]: "$__serverMessage",
[QE]: "$__serverMessage",
[$B]: "Minimum context slot has not been reached",
[tE]: "Node is unhealthy; behind by $numSlotsBehind slots",
[eE]: "No snapshot",
[rE]: "Transaction simulation failed",
[iE]: "$__serverMessage",
[BE]: "Transaction history is not available from this node",
[oE]: "$__serverMessage",
[IE]: "Transaction signature length mismatch",
[aE]: "Transaction signature verification failure",
[AE]: "$__serverMessage",
[kE]: "Key pair bytes must be of length 64, got $byteLength.",
[FE]: "Expected private key bytes with length 32. Actual length: $actualLength.",
[UE]: "Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",
[JE]: "The provided private key does not match the provided public key.",
[mE]: "Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",
[qB]: "Lamports value must be in the range [0, 2e64-1]",
[PB]: "`$value` cannot be parsed as a `BigInt`",
[xB]: "$message",
[vB]: "`$value` cannot be parsed as a `Number`",
[KB]: "No nonce account could be found at address `$nonceAccountAddress`",
[ai]: "The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",
[si]: "WebSocket was closed before payload could be added to the send buffer",
[ci]: "WebSocket connection closed",
[Di]: "WebSocket failed to connect",
[ri]: "Failed to obtain a subscription id from the server",
[ni]: "Could not find an API plan for RPC method: `$method`",
[ii]: "The $argumentLabel argument to the `$methodName` RPC method$optionalPathLabel was `$value`. This number is unsafe for use with the Solana JSON-RPC because it exceeds `Number.MAX_SAFE_INTEGER`.",
[ti]: "HTTP error ($statusCode): $message",
[oi]: "HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",
[OQ]: "Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",
[bQ]: "The provided value does not implement the `KeyPairSigner` interface",
[pQ]: "The provided value does not implement the `MessageModifyingSigner` interface",
[HQ]: "The provided value does not implement the `MessagePartialSigner` interface",
[KQ]: "The provided value does not implement any of the `MessageSigner` interfaces",
[PQ]: "The provided value does not implement the `TransactionModifyingSigner` interface",
[vQ]: "The provided value does not implement the `TransactionPartialSigner` interface",
[VQ]: "The provided value does not implement the `TransactionSendingSigner` interface",
[qQ]: "The provided value does not implement any of the `TransactionSigner` interfaces",
[xQ]: "More than one `TransactionSendingSigner` was identified.",
[WQ]: "No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.",
[ZQ]: "Wallet account signers do not support signing multiple messages/transactions in a single operation",
[fE]: "Cannot export a non-extractable key.",
[Jg]: "No digest implementation could be found.",
[mg]: "Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",
[hE]: `This runtime does not support the generation of Ed25519 key pairs.
Install @solana/webcrypto-ed25519-polyfill and call its \`install\` function before generating keys in environments that do not support Ed25519.
For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20.`,
[SE]: "No signature verification implementation could be found.",
[ME]: "No key generation implementation could be found.",
[GE]: "No signing implementation could be found.",
[yE]: "No key export implementation could be found.",
[VB]: "Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",
[me]: "Transaction processing left an account with an outstanding borrowed reference",
[Re]: "Account in use",
[le]: "Account loaded twice",
[we]: "Attempt to debit an account but found no record of a prior credit.",
[Ke]: "Transaction loads an address table account that doesn't exist",
[Se]: "This transaction has already been processed",
[Me]: "Blockhash not found",
[Ge]: "Loader call chain is too deep",
[Ue]: "Transactions are currently disabled due to cluster maintenance",
[xe]: "Transaction contains a duplicate instruction ($index) that is not allowed",
[de]: "Insufficient funds for fee",
[We]: "Transaction results in an account ($accountIndex) with insufficient funds for rent",
[he]: "This account may not be used to pay transaction fees",
[fe]: "Transaction contains an invalid account reference",
[He]: "Transaction loads an address table account with invalid data",
[qe]: "Transaction address table lookup uses an invalid index",
[pe]: "Transaction loads an address table account with an invalid owner",
[Xe]: "LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",
[ke]: "This program may not be used for executing instructions",
[Pe]: "Transaction leaves an account with a lower balance than rent-exempt minimum",
[Te]: "Transaction loads a writable account that cannot be written",
[Ze]: "Transaction exceeded max loaded accounts data size cap",
[ye]: "Transaction requires a fee but has no signature present",
[Ne]: "Attempt to load a program that does not exist",
[je]: "Execution of the program referenced by account at index $accountIndex is temporarily restricted.",
[ze]: "ResanitizationNeeded",
[Fe]: "Transaction failed to sanitize accounts offsets correctly",
[_e]: "Transaction did not pass signature verification",
[be]: "Transaction locked too many accounts",
[$e]: "Sum of account balances before and after transaction do not match",
[ue]: "The transaction failed with the error `$errorName`",
[Le]: "Transaction version is unsupported",
[Oe]: "Transaction would exceed account data limit within the block",
[Ve]: "Transaction would exceed total account data limit",
[Ye]: "Transaction would exceed max account limit within the block",
[Je]: "Transaction would exceed max Block Cost Limit",
[ve]: "Transaction would exceed max Vote Cost Limit",
[ne]: "Attempted to sign a transaction with an address that is not a signer for it",
[Qe]: "Transaction is missing an address at index: $index.",
[ae]: "Transaction has no expected signers therefore it cannot be encoded",
[De]: "Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",
[jQ]: "Transaction does not have a blockhash lifetime",
[$Q]: "Transaction is not a durable nonce transaction",
[ge]: "Contents of these address lookup tables unknown: $lookupTableAddresses",
[Ie]: "Lookup of address at index $highestRequestedIndex failed for lookup table `$lookupTableAddress`. Highest known index is $highestKnownIndex. The lookup table may have been extended since its contents were retrieved",
[Be]: "No fee payer set in CompiledTransaction",
[Ce]: "Could not find program address at index $index",
[se]: "Failed to estimate the compute unit consumption for this transaction message. This is likely because simulating the transaction failed. Inspect the `cause` property of this error to learn more",
[ce]: "Transaction failed when it was simulated in order to estimate the compute unit consumption. The compute unit estimate provided is for a transaction that failed when simulated and may not be representative of the compute units this transaction would consume if successful. Inspect the `cause` property of this error to learn more",
[ee]: "Transaction is missing a fee payer.",
[ie]: "Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",
[te]: "Transaction first instruction is not advance nonce account instruction.",
[oe]: "Transaction with no instructions cannot be durable nonce transaction.",
[XQ]: "This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",
[zQ]: "This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",
[re]: "The transaction message expected the transaction to have $signerAddressesLength signatures, got $signaturesLength.",
[Ee]: "Transaction is missing signatures for addresses: $addresses.",
[Ae]: "Transaction version must be in the range [0, 127]. `$actualVersion` given"
}, eA = "i", BA = "t";
function Mi(A, g = {}) {
const I = Si[A];
if (I.length === 0) return "";
let B;
function C(Q) {
if (B[BA] === 2) {
const e = I.slice(B[eA] + 1, Q);
E.push(e in g ? `${g[e]}` : `$${e}`);
} else B[BA] === 1 && E.push(I.slice(B[eA], Q));
}
const E = [];
return I.split("").forEach((Q, e) => {
if (e === 0) {
B = {
[eA]: 0,
[BA]: I[0] === "\\" ? 0 : I[0] === "$" ? 2 : 1
};
return;
}
let r;
switch (B[BA]) {
case 0:
r = {
[eA]: e,
[BA]: 1
};
break;
case 1:
Q === "\\" ? r = {
[eA]: e,
[BA]: 0
} : Q === "$" && (r = {
[eA]: e,
[BA]: 2
});
break;
case 2:
Q === "\\" ? r = {
[eA]: e,
[BA]: 0
} : Q === "$" ? r = {
[eA]: e,
[BA]: 2
} : Q.match(/\w/) || (r = {
[eA]: e,
[BA]: 1
});
break;
}
r && (B !== r && C(e), B = r);
}), C(), E.join("");
}
function Gi(A, g = {}) {
if (process.env.NODE_ENV !== "production") return Mi(A, g);
{
let I = `Solana error #${A}; Decode this error by running \`npx @solana/errors decode -- ${A}`;
return Object.keys(g).length && (I += ` '${hi(g)}'`), `${I}\``;
}
}
function Xg(A, g) {
return A instanceof Error && A.name === "SolanaError" ? g !== void 0 ? A.context.__code === g : true : false;
}
var J = class extends Error {
constructor(...[A, g]) {
let I, B;
if (g) {
const { cause: E, ...Q } = g;
E && (B = {
cause: E
}), Object.keys(Q).length > 0 && (I = Q);
}
const C = Gi(A, I);
super(C, B);
__publicField(this, "cause", this.cause);
__publicField(this, "context");
this.context = {
__code: A,
...I
}, this.name = "SolanaError";
}
}, yi = (A, g) => {
if (A.length >= g) return A;
const I = new Uint8Array(g).fill(0);
return I.set(A), I;
}, fi = (A, g) => yi(A.length <= g ? A : A.slice(0, g), g);
function S(A, g, I) {
const B = I === 0 && A.length === g.length ? A : A.slice(I, I + g.length);
return B.length !== g.length ? false : g.every((C, E) => C === B[E]);
}
function oA(A, g) {
return "fixedSize" in g ? g.fixedSize : g.getSizeFromValue(A);
}
function j(A) {
return Object.freeze({
...A,
encode: (g) => {
const I = new Uint8Array(oA(g, A));
return A.write(g, I, 0), I;
}
});
}
function $(A) {
return Object.freeze({
...A,
decode: (g, I = 0) => A.read(g, I)[0]
});
}
function v(A) {
return "fixedSize" in A && typeof A.fixedSize == "number";
}
function zg(A) {
if (!v(A)) throw new J(Og);
}
function _i(A) {
return !v(A);
}
function D(A, g) {
if (v(A) !== v(g)) throw new J(bg);
if (v(A) && v(g) && A.fixedSize !== g.fixedSize) throw new J(Kg, {
decoderFixedSize: g.fixedSize,
encoderFixedSize: A.fixedSize
});
if (!v(A) && !v(g) && A.maxSize !== g.maxSize) throw new J(pg, {
decoderMaxSize: g.maxSize,
encoderMaxSize: A.maxSize
});
return {
...g,
...A,
decode: g.decode,
encode: A.encode,
read: g.read,
write: A.write
};
}
function ki(A, g, I = 0) {
if (g.length - I <= 0) throw new J(Tg, {
codecDescription: A
});
}
function Cg(A, g, I, B = 0) {
const C = I.length - B;
if (C < g) throw new J(Yg, {
bytesLength: C,
codecDescription: A,
expected: g
});
}
function V(A, g) {
const I = (Q, e, r) => {
const h = A.encode(Q);
return r = g.write(h.length, e, r), e.set(h, r), r + h.length;
};
if (v(g) && v(A)) return j({
...A,
fixedSize: g.fixedSize + A.fixedSize,
write: I
});
const B = v(g) ? g.fixedSize : g.maxSize ?? null, C = v(A) ? A.fixedSize : A.maxSize ?? null, E = B !== null && C !== null ? B + C : null;
return j({
...A,
...E !== null ? {
maxSize: E
} : {},
getSizeFromValue: (Q) => {
const e = oA(Q, A);
return oA(e, g) + e;
},
write: I
});
}
function x(A, g) {
const I = (Q, e) => {
const [r, h] = g.read(Q, e), W = Number(r);
return e = h, (e > 0 || Q.length > W) && (Q = Q.slice(e, e + W)), Cg("addDecoderSizePrefix", W, Q), [
A.decode(Q),
e + W
];
};
if (v(g) && v(A)) return $({
...A,
fixedSize: g.fixedSize + A.fixedSize,
read: I
});
const B = v(g) ? g.fixedSize : g.maxSize ?? null, C = v(A) ? A.fixedSize : A.maxSize ?? null, E = B !== null && C !== null ? B + C : null;
return $({
...A,
...E !== null ? {
maxSize: E
} : {},
read: I
});
}
function M(A, g) {
return j({
fixedSize: g,
write: (I, B, C) => {
const E = A.encode(I), Q = E.length > g ? E.slice(0, g) : E;
return B.set(Q, C), C + g;
}
});
}
function G(A, g) {
return $({
fixedSize: g,
read: (I, B) => {
Cg("fixCodecSize", g, I, B), (B > 0 || I.length > g) && (I = I.slice(B, B + g)), v(A) && (I = fi(I, A.fixedSize));
const [C] = A.read(I, 0);
return [
C,
B + g
];
}
});
}
function d(A, g) {
return j({
..._i(A) ? {
...A,
getSizeFromValue: (I) => A.getSizeFromValue(g(I))
} : A,
write: (I, B, C) => A.write(g(I), B, C)
});
}
function lA(A, g) {
return $({
...A,
read: (I, B) => {
const [C, E] = A.read(I, B);
return [
g(C, I, B),
E
];
}
});
}
function Fi(A, g, I = g) {
if (!g.match(new RegExp(`^[${A}]*$`))) throw new J(bA, {
alphabet: A,
base: A.length,
value: I
});
}
var Ui = (A) => j({
getSizeFromValue: (g) => {
const [I, B] = cg(g, A[0]);
if (!B) return g.length;
const C = Dg(B, A);
return I.length + Math.ceil(C.toString(16).length / 2);
},
write(g, I, B) {
if (Fi(A, g), g === "") return B;
const [C, E] = cg(g, A[0]);
if (!E) return I.set(new Uint8Array(C.length).fill(0), B), B + C.length;
let Q = Dg(E, A);
const e = [];
for (; Q > 0n; ) e.unshift(Number(Q % 256n)), Q /= 256n;
const r = [
...Array(C.length).fill(0),
...e
];
return I.set(r, B), B + r.length;
}
}), mi = (A) => $({
read(g, I) {
const B = I === 0 ? g : g.slice(I);
if (B.length === 0) return [
"",
0
];
let C = B.findIndex((r) => r !== 0);
C = C === -1 ? B.length : C;
const E = A[0].repeat(C);
if (C === B.length) return [
E,
g.length
];
const Q = B.slice(C).reduce((r, h) => r * 256n + BigInt(h), 0n), e = Ji(Q, A);
return [
E + e,
g.length
];
}
});
function cg(A, g) {
const [I, B] = A.split(new RegExp(`((?!${g}).*)`));
return [
I,
B
];
}
function Dg(A, g) {
const I = BigInt(g.length);
let B = 0n;
for (const C of A) B *= I, B += BigInt(g.indexOf(C));
return B;
}
function Ji(A, g) {
const I = BigInt(g.length), B = [];
for (; A > 0n; ) B.unshift(g[Number(A % I)]), A /= I;
return B.join("");
}
var jg = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz", Li = () => Ui(jg), Ti = () => mi(jg), ug = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Yi = () => j({
getSizeFromValue: (A) => {
try {
return atob(A).length;
} catch {
throw new J(bA, {
alphabet: ug,
base: 64,
value: A
});
}
},
write(A, g, I) {
try {
const B = atob(A).split("").map((C) => C.charCodeAt(0));
return g.set(B, I), B.length + I;
} catch {
throw new J(bA, {
alphabet: ug,
base: 64,
value: A
});
}
}
}), Oi = (A) => A.replace(/\u0000/g, ""), bi = globalThis.TextDecoder, Rg = globalThis.TextEncoder, Z = () => {
let A;
return j({
getSizeFromValue: (g) => (A || (A = new Rg())).encode(g).length,
write: (g, I, B) => {
const C = (A || (A = new Rg())).encode(g);
return I.set(C, B), B + C.length;
}
});
}, X = () => {
let A;
return $({
read(g, I) {
const B = (A || (A = new bi())).decode(g.slice(I));
return [
Oi(B),
g.length
];
}
});
};
function GA(A, g) {
try {
return "exists" in A && !A.exists ? A : Object.freeze({
...A,
data: g.decode(A.data)
});
} catch {
throw new J(Ug, {
address: A.address
});
}
}
function $g(A, g) {
if (!g) return Object.freeze({
address: A,
exists: false
});
const I = Yi().encode(g.data[0]);
return Object.freeze({
...Ki(g),
address: A,
data: I,
exists: true
});
}
function Ki(A) {
return Object.freeze({
executable: A.executable,
lamports: A.lamports,
programAddress: A.owner,
space: A.space
});
}
async function yA(A, g, I = {}) {
const { abortSignal: B, ...C } = I, E = await A.getAccountInfo(g, {
...C,
encoding: "base64"
}).send({
abortSignal: B
});
return $g(g, E.value);
}
async function fA(A, g, I = {}) {
const { abortSignal: B, ...C } = I;
return (await A.getMultipleAccounts(g, {
...C,
encoding: "base64"
}).send({
abortSignal: B
})).value.map((Q, e) => $g(g[e], Q));
}
function _A(A) {
if (!A.exists) throw new J(kg, {
address: A.address
});
}
function kA(A) {
const g = A.filter((I) => !I.exists);
if (g.length > 0) {
const I = g.map((B) => B.address);
throw new J(Fg, {
addresses: I
});
}
}
function pi() {
if (!globalThis.isSecureContext) throw new J(mg);
}
function Hi() {
var _a2;
if (pi(), typeof globalThis.crypto > "u" || typeof ((_a2 = globalThis.crypto.subtle) == null ? void 0 : _a2.digest) != "function") throw new J(Jg);
}
var zA, jA;
function AI() {
return zA || (zA = Li()), zA;
}
function qi() {
return jA || (jA = Ti()), jA;
}
function Pi(A) {
if (A.length < 32 || A.length > 44) throw new J(Gg, {
actualLength: A.length
});
const B = AI().encode(A).byteLength;
if (B !== 32) throw new J(Mg, {
actualLength: B
});
}
function vi(A) {
return Pi(A), A;
}
function s() {
return d(M(AI(), 32), (A) => vi(A));
}
function c() {
return G(qi(), 32);
}
function Vi() {
return D(s(), c());
}
var xi = 37095705934669439343138083508754565189542113879843219016388785533085940283555n, AA = 57896044618658097711785492504343953926634992332820282019728792003956564819949n, lg = 19681161376707505956807079304988542015446066515923890162744021073123829784752n;
function CA(A) {
const g = A % AA;
return g >= 0n ? g : AA + g;
}
function EA(A, g) {
let I = A;
for (; g-- > 0n; ) I *= I, I %= AA;
return I;
}
function Wi(A) {
const I = A * A % AA * A % AA, B = EA(I, 2n) * I % AA, C = EA(B, 1n) * A % AA, E = EA(C, 5n) * C % AA, Q = EA(E, 10n) * E % AA, e = EA(Q, 20n) * Q % AA, r = EA(e, 40n) * e % AA, h = EA(r, 80n) * r % AA, W = EA(h, 80n) * r % AA, IA = EA(W, 10n) * E % AA;
return EA(IA, 2n) * A % AA;
}
function Zi(A, g) {
const I = CA(g * g * g), B = CA(I * I * g), C = Wi(A * B);
let E = CA(A * I * C);
const Q = CA(g * E * E), e = E, r = CA(E * lg), h = Q === A, W = Q === CA(-A), IA = Q === CA(-A * lg);
return h && (E = e), (W || IA) && (E = r), (CA(E) & 1n) === 1n && (E = CA(-E)), !h && !W ? null : E;
}
function Xi(A, g) {
const I = CA(A * A), B = CA(I - 1n), C = CA(xi * I + 1n), E = Zi(B, C);
if (E === null) return false;
const Q = (g & 128) !== 0;
return !(E === 0n && Q);
}
function zi(A) {
const g = A.toString(16);
return g.length === 1 ? `0${g}` : g;
}
function ji(A) {
const I = `0x${A.reduce((B, C, E) => `${zi(E === 31 ? C & -129 : C)}${B}`, "")}`;
return BigInt(I);
}
function $i(A) {
if (A.byteLength !== 32) return false;
const g = ji(A);
return Xi(g, A[31]);
}
var wg = 32, Ng = 16, Ao = [
80,
114,
111,
103,
114,
97,
109,
68,
101,
114,
105,
118,
101,
100,
65,
100,
100,
114,
101,
115,
115
];
async function go({ programAddress: A, seeds: g }) {
if (Hi(), g.length > Ng) throw new J(yg, {
actual: g.length,
maxSeeds: Ng
});
let I;
const B = g.reduce((r, h, W) => {
const IA = typeof h == "string" ? (I || (I = new TextEncoder())).encode(h) : h;
if (IA.byteLength > wg) throw new J(fg, {
actual: IA.byteLength,
index: W,
maxSeedLength: wg
});
return r.push(...IA), r;
}, []), C = Vi(), E = C.encode(A), Q = await crypto.subtle.digest("SHA-256", new Uint8Array([
...B,
...E,
...Ao
])), e = new Uint8Array(Q);
if ($i(e)) throw new J(gg);
return C.decode(e);
}
async function FA({ programAddress: A, seeds: g }) {
let I = 255;
for (; I > 0; ) try {
return [
await go({
programAddress: A,
seeds: [
...g,
new Uint8Array([
I
])
]
}),
I
];
} catch (B) {
if (Xg(B, gg)) I--;
else throw B;
}
throw new J(_g);
}
function Io(A, g, I, B) {
if (B < g || B > I) throw new J(Vg, {
codecDescription: A,
max: I,
min: g,
value: B
});
}
function gI(A) {
return (A == null ? void 0 : A.endian) !== 1;
}
function wA(A) {
return j({
fixedSize: A.size,
write(g, I, B) {
A.range && Io(A.name, A.range[0], A.range[1], g);
const C = new ArrayBuffer(A.size);
return A.set(new DataView(C), g, gI(A.config)), I.set(new Uint8Array(C), B), B + A.size;
}
});
}
function NA(A) {
return $({
fixedSize: A.size,
read(g, I = 0) {
ki(A.name, g, I), Cg(A.name, A.size, g, I);
const B = new DataView(Co(g, I, A.size));
return [
A.get(B, gI(A.config)),
I + A.size
];
}
});
}
function Co(A, g, I) {
const B = A.byteOffset + (g ?? 0), C = I ?? A.byteLength;
return A.buffer.slice(B, B + C);
}
var KA = (A = {}) => wA({
config: A,
name: "i32",
range: [
-+"0x7fffffff" - 1,
+"0x7fffffff"
],
set: (g, I, B) => g.setInt32(0, Number(I), B),
size: 4
}), pA = (A = {}) => NA({
config: A,
get: (g, I) => g.getInt32(0, I),
name: "i32",
size: 4
}), U = (A = {}) => wA({
config: A,
name: "u128",
range: [
0n,
BigInt("0xffffffffffffffffffffffffffffffff")
],
set: (g, I, B) => {
const C = B ? 8 : 0, E = B ? 0 : 8, Q = 0xffffffffffffffffn;
g.setBigUint64(C, BigInt(I) >> 64n, B), g.setBigUint64(E, BigInt(I) & Q, B);
},
size: 16
}), m = (A = {}) => NA({
config: A,
get: (g, I) => {
const B = I ? 8 : 0, C = I ? 0 : 8, E = g.getBigUint64(B, I), Q = g.getBigUint64(C, I);
return (E << 64n) + Q;
},
name: "u128",
size: 16
}), R = (A = {}) => wA({
config: A,
name: "u16",
range: [
0,
+"0xffff"
],
set: (g, I, B) => g.setUint16(0, Number(I), B),
size: 2
}), l = (A = {}) => NA({
config: A,
get: (g, I) => g.getUint16(0, I),
name: "u16",
size: 2
}), L = (A = {}) => wA({
config: A,
name: "u32",
range: [
0,
+"0xffffffff"
],
set: (g, I, B) => g.setUint32(0, Number(I), B),
size: 4
}), T = (A = {}) => NA({
config: A,
get: (g, I) => g.getUint32(0, I),
name: "u32",
size: 4
}), o = (A = {}) => wA({
config: A,
name: "u64",
range: [
0n,
BigInt("0xffffffffffffffff")
],
set: (g, I, B) => g.setBigUint64(0, BigInt(I), B),
size: 8
}), t = (A = {}) => NA({
config: A,
get: (g, I) => g.getBigUint64(0, I),
name: "u64",
size: 8
}), i = () => wA({
name: "u8",
range: [
0,
+"0xff"
],
set: (A, g) => A.setUint8(0, Number(g)),
size: 1
}), N = () => NA({
get: (A) => A.getUint8(0),
name: "u8",
size: 1
});
function II(A, g, I) {
if (g !== I) throw new J(Hg, {
actual: I,
codecDescription: A,
expected: g
});
}
function Bo(A) {
return A.reduce((g, I) => g === null || I === null ? null : Math.max(g, I), 0);
}
function tA(A) {
return A.reduce((g, I) => g === null || I === null ? null : g + I, 0);
}
function dA(A) {
return v(A) ? A.fixedSize : null;
}
function cA(A) {
return v(A) ? A.fixedSize : A.maxSize ?? null;
}
function q(A, g = {}) {
const I = g.size ?? L(), B = HA(I, dA(A)), C = HA(I, cA(A)) ?? void 0;
return j({
...B !== null ? {
fixedSize: B
} : {
getSizeFromValue: (E) => (typeof I == "object" ? oA(E.length, I) : 0) + [
...E
].reduce((e, r) => e + oA(r, A), 0),
maxSize: C
},
write: (E, Q, e) => (typeof I == "number" && II("array", I, E.length), typeof I == "object" && (e = I.write(E.length, Q, e)), E.forEach((r) => {
e = A.write(r, Q, e);
}), e)
});
}
function P(A, g = {}) {
const I = g.size ?? T(), B = dA(A), C = HA(I, B), E = HA(I, cA(A)) ?? void 0;
return $({
...C !== null ? {
fixedSize: C
} : {
maxSize: E
},
read: (Q, e) => {
const r = [];
if (typeof I == "object" && Q.slice(e).length === 0) return [
r,
e
];
if (I === "remainder") {
for (; e < Q.length; ) {
const [IA, UA] = A.read(Q, e);
e = UA, r.push(IA);
}
return [
r,
e
];
}
const [h, W] = typeof I == "number" ? [
I,
e
] : I.read(Q, e);
e = W;
for (let IA = 0; IA < h; IA += 1) {
const [UA, YB] = A.read(Q, e);
e = YB, r.push(UA);
}
return [
r,
e
];
}
});
}
function HA(A, g) {
return typeof A != "number" ? null : A === 0 ? 0 : g === null ? null : g * A;
}
function b(A = {}) {
return d(A.size ?? i(), (g) => g ? 1 : 0);
}
function K(A = {}) {
return lA(A.size ?? N(), (g) => Number(g) === 1);
}
function y() {
return j({
getSizeFromValue: (A) => A.length,
write: (A, g, I) => (g.set(A, I), I + A.length)
});
}
function f() {
return $({
read: (A, g) => {
const I = A.slice(g);
return [
I,
g + I.length
];
}
});
}
var Eo = () => $({
read(A, g) {
return [
A.slice(g).reduce((B, C) => B + C.toString(16).padStart(2, "0"), ""),
A.length
];
}
});
function Qo(A) {
return j({
fixedSize: A.length,
write: (g, I, B) => (I.set(A, B), B + A.length)
});
}
function eo(A) {
return $({
fixedSize: A.length,
read: (g, I) => {
const B = Eo();
if (!S(g, A, I)) throw new J(Wg, {
constant: A,
data: g,
hexConstant: B.decode(A),
hexData: B.decode(g),
offset: I
});
return [
void 0,
I + A.length
];
}
});
}
function p(A) {
const g = tA(A.map(dA)), I = tA(A.map(cA)) ?? void 0;
return j({
...g === null ? {
getSizeFromValue: (B) => A.map((C, E) => oA(B[E], C)).reduce((C, E) => C + E, 0),
maxSize: I
} : {
fixedSize: g
},
write: (B, C, E) => (II("tuple", A.length, B.length), A.forEach((Q, e) => {
E = Q.write(B[e], C, E);
}), E)
});
}
function H(A) {
const g = tA(A.map(dA)), I = tA(A.map(cA)) ?? void 0;
return $({
...g === null ? {
maxSize: I
} : {
fixedSize: g
},
read: (B, C) => {
const E = [];
return A.forEach((Q) => {
const [e, r] = Q.read(B, C);
E.push(e), C = r;
}), [
E,
C
];
}
});
}
function CI(A, g) {
const I = EI(A), B = (E, Q, e) => {
const r = g(E);
return $A(A, r), A[r].write(E, Q, e);
};
if (I !== null) return j({
fixedSize: I,
write: B
});
const C = QI(A);
return j({
...C !== null ? {
maxSize: C
} : {},
getSizeFromValue: (E) => {
const Q = g(E);
return $A(A, Q), oA(E, A[Q]);
},
write: B
});
}
function BI(A, g) {
const I = EI(A), B = (E, Q) => {
const e = g(E, Q);
return $A(A, e), A[e].read(E, Q);
};
if (I !== null) return $({
fixedSize: I,
read: B
});
const C = QI(A);
return $({
...C !== null ? {
maxSize: C
} : {},
read: B
});
}
function $A(A, g) {
if (typeof A[g] > "u") throw new J(xg, {
maxRange: A.length - 1,
minRange: 0,
variant: g
});
}
function EI(A) {
if (A.length === 0) return 0;
if (!v(A[0])) return null;
const g = A[0].fixedSize;
return A.every((B) => v(B) && B.fixedSize === g) ? g : null;
}
function QI(A) {
return Bo(A.map((g) => cA(g)));
}
function DA(A, g = {}) {
const I = g.discriminator ?? "__kind", B = g.size ?? i();
return CI(A.map(([, C], E) => d(p([
B,
C
]), (Q) => [
E,
Q
])), (C) => io(A, C[I]));
}
function uA(A, g = {}) {
const I = g.discriminator ?? "__kind", B = g.size ?? N();
return BI(A.map(([C, E]) => lA(H([
B,
E
]), ([, Q]) => ({
[I]: C,
...Q
}))), (C, E) => Number(B.read(C, E)[0]));
}
function io(A, g) {
const I = A.findIndex(([B]) => g === B);
if (I < 0) throw new J(Pg, {
value: g,
variants: A.map(([B]) => B)
});
return I;
}
function eI(A) {
const g = [
...new Set(Object.values(A).filter((Q) => typeof Q == "number"))
].sort(), I = Object.fromEntries(Object.entries(A).slice(g.length)), B = Object.keys(I), C = Object.values(I), E = [
.../* @__PURE__ */ new Set([
...B,
...C.filter((Q) => typeof Q == "string")
])
];
return {
enumKeys: B,
enumRecord: I,
enumValues: C,
numericalValues: g,
stringValues: E
};
}
function oo({ enumKeys: A, enumValues: g, variant: I }) {
const B = iI(g, (C) => C === I);
return B >= 0 ? B : A.findIndex((C) => C === I);
}
function to({ discriminator: A, enumKeys: g, enumValues: I, useValuesAsDiscriminators: B }) {
return B ? iI(I, (C) => C === A) : A >= 0 && A < g.length ? A : -1;
}
function iI(A, g) {
let I = A.length;
for (; I--; ) if (g(A[I], I, A)) return I;
return -1;
}
function oI(A) {
if (A.length === 0) return "";
let g = [
A[0],
A[0]
];
const I = [];
for (let B = 1; B < A.length; B++) {
const C = A[B];
g[1] + 1 === C ? g[1] = C : (I.push(g[0] === g[1] ? `${g[0]}` : `${g[0]}-${g[1]}`), g = [
C,
C
]);
}
return I.push(g[0] === g[1] ? `${g[0]}` : `${g[0]}-${g[1]}`), I.join(", ");
}
function nA(A, g = {}) {
const I = g.size ?? i(), B = g.useValuesAsDiscriminators ?? false, { enumKeys: C, enumValues: E, numericalValues: Q, stringValues: e } = eI(A);
if (B && E.some((r) => typeof r == "string")) throw new J(Ig, {
stringValues: E.filter((r) => typeof r == "string")
});
return d(I, (r) => {
const h = oo({
enumKeys: C,
enumValues: E,
variant: r
});
if (h < 0) throw new J(vg, {
formattedNumericalValues: oI(Q),
numericalValues: Q,
stringValues: e,
variant: r
});
return B ? E[h] : h;
});
}
function aA(A, g = {}) {
const I = g.size ?? N(), B = g.useValuesAsDiscriminators ?? false, { enumKeys: C, enumValues: E, numericalValues: Q } = eI(A);
if (B && E.some((e) => typeof e == "string")) throw new J(Ig, {
stringValues: E.filter((e) => typeof e == "string")
});
return lA(I, (e) => {
const r = Number(e), h = to({
discriminator: r,
enumKeys: C,
enumValues: E,
useValuesAsDiscriminators: B
});
if (h < 0) {
const W = B ? Q : [
...Array(C.length).keys()
];
throw new J(qg, {
discriminator: r,
formattedValidDiscriminators: oI(W),
validDiscriminators: W
});
}
return E[h];
});
}
function JA() {
return j({
fixedSize: 0,
write: (A, g, I) => I
});
}
function LA() {
return $({
fixedSize: 0,
read: (A, g) => [
void 0,
g
]
});
}
function n(A) {
const g = A.map(([, C]) => C), I = tA(g.map(dA)), B = tA(g.map(cA)) ?? void 0;
return j({
...I === null ? {
getSizeFromValue: (C) => A.map(([E, Q]) => oA(C[E], Q)).reduce((E, Q) => E + Q, 0),
maxSize: B
} : {
fixedSize: I
},
write: (C, E, Q) => (A.forEach(([e, r]) => {
Q = r.write(C[e], E, Q);
}), Q)
});
}
function a(A) {
const g = A.map(([, C]) => C), I = tA(g.map(dA)), B = tA(g.map(cA)) ?? void 0;
return $({
...I === null ? {
maxSize