UNPKG

zksync-easy-onramp

Version:

SDK package for ZKsync easy on ramp

13,239 lines 474 kB
var y5 = Object.defineProperty;
var P0 = (e) => {
  throw TypeError(e);
};
var w5 = (e, r, n) => r in e ? y5(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n;
var X = (e, r, n) => w5(e, typeof r != "symbol" ? r + "" : r, n), I0 = (e, r, n) => r.has(e) || P0("Cannot " + n);
var Ue = (e, r, n) => (I0(e, r, "read from private field"), n ? n.call(e) : r.get(e)), _t = (e, r, n) => r.has(e) ? P0("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(e) : r.set(e, n), Tt = (e, r, n, i) => (I0(e, r, "write to private field"), i ? i.call(e, n) : r.set(e, n), n);
import { webSocket as E5, http as x5, createClient as v5, fallback as T5, parseAbi as yr, zeroHash as S0, pad as El, toHex as xl, keccak256 as hi, toBytes as B0, encodeAbiParameters as R0, parseAbiParameters as C0, formatUnits as _0, AtomicReadyWalletRejectedUpgradeError as P5, encodeFunctionData as gu, parseSignature as I5, isAddress as S5 } from "viem";
var D0;
(function(e) {
  e.ETH = "eth", e.POL = "pol", e.BSC = "bsc", e.DAI = "dai", e.FTM = "ftm", e.AVA = "ava", e.ARB = "arb", e.OPT = "opt", e.ONE = "one", e.FSN = "fsn", e.MOR = "mor", e.CEL = "cel", e.FUS = "fus", e.TLO = "tlo", e.CRO = "cro", e.BOB = "bob", e.RSK = "rsk", e.VEL = "vel", e.MOO = "moo", e.MAM = "mam", e.AUR = "aur", e.EVM = "evm", e.ARN = "arn", e.ERA = "era", e.PZE = "pze", e.LNA = "lna", e.BAS = "bas", e.SCL = "scl", e.MOD = "mod", e.MNT = "mnt", e.BLS = "bls", e.SEI = "sei", e.FRA = "fra", e.TAI = "tai", e.GRA = "gra", e.IMX = "imx", e.KAI = "kai", e.XLY = "xly", e.OPB = "opb", e.WCC = "wcc", e.LSK = "lsk", e.ABS = "abs", e.BER = "ber", e.SON = "son", e.UNI = "uni", e.APE = "ape", e.SOE = "soe", e.INK = "ink", e.LNS = "lns", e.SWL = "swl", e.CRN = "crn", e.ETL = "etl", e.SUP = "sup", e.HYP = "hyp", e.XDC = "xdc", e.BOC = "boc", e.VIC = "vic", e.FLR = "flr", e.KAT = "kat", e.VAN = "van", e.RON = "ron", e.PLU = "plu", e.NIB = "nib", e.HPL = "hpl", e.SOP = "sop", e.PLA = "pla", e.FLW = "flw", e.HMI = "hmi", e.SOL = "sol", e.TER = "ter", e.OAS = "oas", e.SUI = "sui", e.BTC = "btc", e.BCH = "bch", e.LTC = "ltc", e.DGE = "dge", e.TRN = "trn";
})(D0 || (D0 = {}));
var _e;
(function(e) {
  e[e.ETH = 1] = "ETH", e[e.POL = 137] = "POL", e[e.BSC = 56] = "BSC", e[e.DAI = 100] = "DAI", e[e.FTM = 250] = "FTM", e[e.AVA = 43114] = "AVA", e[e.ARB = 42161] = "ARB", e[e.OPT = 10] = "OPT", e[e.ONE = 16666e5] = "ONE", e[e.FSN = 32659] = "FSN", e[e.MOR = 1285] = "MOR", e[e.CEL = 42220] = "CEL", e[e.FUS = 122] = "FUS", e[e.TLO = 40] = "TLO", e[e.CRO = 25] = "CRO", e[e.BOB = 288] = "BOB", e[e.RSK = 30] = "RSK", e[e.VEL = 106] = "VEL", e[e.MOO = 1284] = "MOO", e[e.MAM = 1088] = "MAM", e[e.AUR = 1313161554] = "AUR", e[e.EVM = 9001] = "EVM", e[e.ARN = 42170] = "ARN", e[e.ERA = 324] = "ERA", e[e.PZE = 1101] = "PZE", e[e.LNA = 59144] = "LNA", e[e.BAS = 8453] = "BAS", e[e.SCL = 534352] = "SCL", e[e.MOD = 34443] = "MOD", e[e.MNT = 5e3] = "MNT", e[e.BLS = 81457] = "BLS", e[e.SEI = 1329] = "SEI", e[e.FRA = 252] = "FRA", e[e.TAI = 167e3] = "TAI", e[e.GRA = 1625] = "GRA", e[e.IMX = 13371] = "IMX", e[e.KAI = 8217] = "KAI", e[e.XLY = 196] = "XLY", e[e.OPB = 204] = "OPB", e[e.WCC = 480] = "WCC", e[e.LSK = 1135] = "LSK", e[e.ABS = 2741] = "ABS", e[e.BER = 80094] = "BER", e[e.SON = 146] = "SON", e[e.UNI = 130] = "UNI", e[e.APE = 33139] = "APE", e[e.SOE = 1868] = "SOE", e[e.INK = 57073] = "INK", e[e.LNS = 232] = "LNS", e[e.SWL = 1923] = "SWL", e[e.CRN = 21e6] = "CRN", e[e.ETL = 42793] = "ETL", e[e.SUP = 55244] = "SUP", e[e.HYP = 999] = "HYP", e[e.XDC = 50] = "XDC", e[e.BOC = 60808] = "BOC", e[e.VIC = 88] = "VIC", e[e.FLR = 14] = "FLR", e[e.KAT = 747474] = "KAT", e[e.VAN = 1480] = "VAN", e[e.RON = 2020] = "RON", e[e.PLU = 98866] = "PLU", e[e.NIB = 6900] = "NIB", e[e.HPL = 1337] = "HPL", e[e.SOP = 50104] = "SOP", e[e.PLA = 9745] = "PLA", e[e.FLW = 747] = "FLW", e[e.HMI = 43111] = "HMI", e[e.SOL = 1151111081099710] = "SOL", e[e.TER = 1161011141099710] = "TER", e[e.OAS = 111971151099710] = "OAS", e[e.SUI = 927e13] = "SUI", e[e.BTC = 20000000000001] = "BTC", e[e.BCH = 20000000000002] = "BCH", e[e.LTC = 20000000000003] = "LTC", e[e.DGE = 20000000000004] = "DGE", e[e.TRN = 728126428] = "TRN";
})(_e || (_e = {}));
var Se;
(function(e) {
  e.EVM = "EVM", e.SVM = "SVM", e.MVM = "MVM", e.UTXO = "UTXO", e.TVM = "TVM";
})(Se || (Se = {}));
const ye = /* @__PURE__ */ (() => {
  const e = {
    integrator: "lifi-sdk",
    apiUrl: "https://li.quest/v1",
    rpcUrls: {},
    chains: [],
    providers: [],
    preloadChains: !0,
    debug: !1
  };
  let r;
  return {
    set loading(n) {
      r = n;
    },
    get() {
      return e;
    },
    set(n) {
      const { chains: i, providers: o, rpcUrls: u, ...c } = n;
      return Object.assign(e, c), i && this.setChains(i), o && this.setProviders(o), u && this.setRPCUrls(u), e;
    },
    getProvider(n) {
      return e.providers.find((i) => i.type === n);
    },
    setProviders(n) {
      const i = new Map(e.providers.map((o) => [o.type, o]));
      for (const o of n)
        i.set(o.type, o);
      e.providers = Array.from(i.values());
    },
    setChains(n) {
      const i = n.reduce((o, u) => {
        var c, l;
        return (l = (c = u.metamask) == null ? void 0 : c.rpcUrls) != null && l.length && (o[u.id] = u.metamask.rpcUrls), o;
      }, {});
      this.setRPCUrls(i, [_e.SOL]), e.chains = n, r = void 0;
    },
    async getChains() {
      return r && await r, e.chains;
    },
    async getChainById(n) {
      var o;
      r && await r;
      const i = (o = e.chains) == null ? void 0 : o.find((u) => u.id === n);
      if (!i)
        throw new Error(`ChainId ${n} not found`);
      return i;
    },
    setRPCUrls(n, i) {
      var o;
      for (const u in n) {
        const c = Number(u), l = n[c];
        if (l != null && l.length) {
          if (!((o = e.rpcUrls[c]) != null && o.length))
            e.rpcUrls[c] = Array.from(l);
          else if (!(i != null && i.includes(c))) {
            const h = l.filter((g) => {
              var m;
              return !((m = e.rpcUrls[c]) != null && m.includes(g));
            });
            e.rpcUrls[c].push(...h);
          }
        }
      }
    },
    async getRPCUrls() {
      return r && await r, e.rpcUrls;
    }
  };
})(), B5 = "1.1.0";
let mt = class _a extends Error {
  constructor(r, n = {}) {
    var c;
    const i = n.cause instanceof _a ? n.cause.details : (c = n.cause) != null && c.message ? n.cause.message : n.details, o = n.cause instanceof _a && n.cause.docsPath || n.docsPath, u = [
      r || "An error occurred.",
      "",
      ...n.metaMessages ? [...n.metaMessages, ""] : [],
      ...o ? [`Docs: https://abitype.dev${o}`] : [],
      ...i ? [`Details: ${i}`] : [],
      `Version: abitype@${B5}`
    ].join(`
`);
    super(u), Object.defineProperty(this, "details", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "docsPath", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "metaMessages", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "shortMessage", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "AbiTypeError"
    }), n.cause && (this.cause = n.cause), this.details = i, this.docsPath = o, this.metaMessages = n.metaMessages, this.shortMessage = r;
  }
};
function on(e, r) {
  const n = e.exec(r);
  return n == null ? void 0 : n.groups;
}
const vl = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, Tl = /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/, Pl = /^\(.+?\).*?$/, N0 = /^tuple(?<array>(\[(\d*)\])*)$/;
function Da(e) {
  let r = e.type;
  if (N0.test(e.type) && "components" in e) {
    r = "(";
    const n = e.components.length;
    for (let o = 0; o < n; o++) {
      const u = e.components[o];
      r += Da(u), o < n - 1 && (r += ", ");
    }
    const i = on(N0, e.type);
    return r += `)${(i == null ? void 0 : i.array) ?? ""}`, Da({
      ...e,
      type: r
    });
  }
  return "indexed" in e && e.indexed && (r = `${r} indexed`), e.name ? `${r} ${e.name}` : r;
}
function Vr(e) {
  let r = "";
  const n = e.length;
  for (let i = 0; i < n; i++) {
    const o = e[i];
    r += Da(o), i !== n - 1 && (r += ", ");
  }
  return r;
}
function R5(e) {
  var r;
  return e.type === "function" ? `function ${e.name}(${Vr(e.inputs)})${e.stateMutability && e.stateMutability !== "nonpayable" ? ` ${e.stateMutability}` : ""}${(r = e.outputs) != null && r.length ? ` returns (${Vr(e.outputs)})` : ""}` : e.type === "event" ? `event ${e.name}(${Vr(e.inputs)})` : e.type === "error" ? `error ${e.name}(${Vr(e.inputs)})` : e.type === "constructor" ? `constructor(${Vr(e.inputs)})${e.stateMutability === "payable" ? " payable" : ""}` : e.type === "fallback" ? `fallback() external${e.stateMutability === "payable" ? " payable" : ""}` : "receive() external payable";
}
const Il = /^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
function C5(e) {
  return Il.test(e);
}
function _5(e) {
  return on(Il, e);
}
const Sl = /^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
function D5(e) {
  return Sl.test(e);
}
function N5(e) {
  return on(Sl, e);
}
const Bl = /^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;
function O5(e) {
  return Bl.test(e);
}
function L5(e) {
  return on(Bl, e);
}
const Rl = /^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;
function Cl(e) {
  return Rl.test(e);
}
function M5(e) {
  return on(Rl, e);
}
const _l = /^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;
function F5(e) {
  return _l.test(e);
}
function U5(e) {
  return on(_l, e);
}
const Dl = /^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;
function k5(e) {
  return Dl.test(e);
}
function G5(e) {
  return on(Dl, e);
}
const H5 = /^receive\(\) external payable$/;
function Q5(e) {
  return H5.test(e);
}
const z5 = /* @__PURE__ */ new Set(["indexed"]), Na = /* @__PURE__ */ new Set([
  "calldata",
  "memory",
  "storage"
]);
class $5 extends mt {
  constructor({ type: r }) {
    super("Unknown type.", {
      metaMessages: [
        `Type "${r}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`
      ]
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "UnknownTypeError"
    });
  }
}
class W5 extends mt {
  constructor({ type: r }) {
    super("Unknown type.", {
      metaMessages: [`Type "${r}" is not a valid ABI type.`]
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "UnknownSolidityTypeError"
    });
  }
}
class V5 extends mt {
  constructor({ param: r }) {
    super("Invalid ABI parameter.", {
      details: r
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "InvalidParameterError"
    });
  }
}
class j5 extends mt {
  constructor({ param: r, name: n }) {
    super("Invalid ABI parameter.", {
      details: r,
      metaMessages: [
        `"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`
      ]
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "SolidityProtectedKeywordError"
    });
  }
}
class J5 extends mt {
  constructor({ param: r, type: n, modifier: i }) {
    super("Invalid ABI parameter.", {
      details: r,
      metaMessages: [
        `Modifier "${i}" not allowed${n ? ` in "${n}" type` : ""}.`
      ]
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "InvalidModifierError"
    });
  }
}
class q5 extends mt {
  constructor({ param: r, type: n, modifier: i }) {
    super("Invalid ABI parameter.", {
      details: r,
      metaMessages: [
        `Modifier "${i}" not allowed${n ? ` in "${n}" type` : ""}.`,
        `Data location can only be specified for array, struct, or mapping types, but "${i}" was given.`
      ]
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "InvalidFunctionModifierError"
    });
  }
}
class K5 extends mt {
  constructor({ abiParameter: r }) {
    super("Invalid ABI parameter.", {
      details: JSON.stringify(r, null, 2),
      metaMessages: ["ABI parameter type is invalid."]
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "InvalidAbiTypeParameterError"
    });
  }
}
class wr extends mt {
  constructor({ signature: r, type: n }) {
    super(`Invalid ${n} signature.`, {
      details: r
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "InvalidSignatureError"
    });
  }
}
class Y5 extends mt {
  constructor({ signature: r }) {
    super("Unknown signature.", {
      details: r
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "UnknownSignatureError"
    });
  }
}
class X5 extends mt {
  constructor({ signature: r }) {
    super("Invalid struct signature.", {
      details: r,
      metaMessages: ["No properties exist."]
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "InvalidStructSignatureError"
    });
  }
}
class Z5 extends mt {
  constructor({ type: r }) {
    super("Circular reference detected.", {
      metaMessages: [`Struct "${r}" is a circular reference.`]
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "CircularReferenceError"
    });
  }
}
class ew extends mt {
  constructor({ current: r, depth: n }) {
    super("Unbalanced parentheses.", {
      metaMessages: [
        `"${r.trim()}" has too many ${n > 0 ? "opening" : "closing"} parentheses.`
      ],
      details: `Depth "${n}"`
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "InvalidParenthesisError"
    });
  }
}
function tw(e, r, n) {
  let i = "";
  if (n)
    for (const o of Object.entries(n)) {
      if (!o)
        continue;
      let u = "";
      for (const c of o[1])
        u += `[${c.type}${c.name ? `:${c.name}` : ""}]`;
      i += `(${o[0]}{${u}})`;
    }
  return r ? `${r}:${e}${i}` : e;
}
const ha = /* @__PURE__ */ new Map([
  // Unnamed
  ["address", { type: "address" }],
  ["bool", { type: "bool" }],
  ["bytes", { type: "bytes" }],
  ["bytes32", { type: "bytes32" }],
  ["int", { type: "int256" }],
  ["int256", { type: "int256" }],
  ["string", { type: "string" }],
  ["uint", { type: "uint256" }],
  ["uint8", { type: "uint8" }],
  ["uint16", { type: "uint16" }],
  ["uint24", { type: "uint24" }],
  ["uint32", { type: "uint32" }],
  ["uint64", { type: "uint64" }],
  ["uint96", { type: "uint96" }],
  ["uint112", { type: "uint112" }],
  ["uint160", { type: "uint160" }],
  ["uint192", { type: "uint192" }],
  ["uint256", { type: "uint256" }],
  // Named
  ["address owner", { type: "address", name: "owner" }],
  ["address to", { type: "address", name: "to" }],
  ["bool approved", { type: "bool", name: "approved" }],
  ["bytes _data", { type: "bytes", name: "_data" }],
  ["bytes data", { type: "bytes", name: "data" }],
  ["bytes signature", { type: "bytes", name: "signature" }],
  ["bytes32 hash", { type: "bytes32", name: "hash" }],
  ["bytes32 r", { type: "bytes32", name: "r" }],
  ["bytes32 root", { type: "bytes32", name: "root" }],
  ["bytes32 s", { type: "bytes32", name: "s" }],
  ["string name", { type: "string", name: "name" }],
  ["string symbol", { type: "string", name: "symbol" }],
  ["string tokenURI", { type: "string", name: "tokenURI" }],
  ["uint tokenId", { type: "uint256", name: "tokenId" }],
  ["uint8 v", { type: "uint8", name: "v" }],
  ["uint256 balance", { type: "uint256", name: "balance" }],
  ["uint256 tokenId", { type: "uint256", name: "tokenId" }],
  ["uint256 value", { type: "uint256", name: "value" }],
  // Indexed
  [
    "event:address indexed from",
    { type: "address", name: "from", indexed: !0 }
  ],
  ["event:address indexed to", { type: "address", name: "to", indexed: !0 }],
  [
    "event:uint indexed tokenId",
    { type: "uint256", name: "tokenId", indexed: !0 }
  ],
  [
    "event:uint256 indexed tokenId",
    { type: "uint256", name: "tokenId", indexed: !0 }
  ]
]);
function nw(e, r = {}) {
  if (O5(e))
    return rw(e, r);
  if (D5(e))
    return sw(e, r);
  if (C5(e))
    return iw(e, r);
  if (F5(e))
    return ow(e, r);
  if (k5(e))
    return aw(e);
  if (Q5(e))
    return {
      type: "receive",
      stateMutability: "payable"
    };
  throw new Y5({ signature: e });
}
function rw(e, r = {}) {
  const n = L5(e);
  if (!n)
    throw new wr({ signature: e, type: "function" });
  const i = It(n.parameters), o = [], u = i.length;
  for (let l = 0; l < u; l++)
    o.push(Qn(i[l], {
      modifiers: Na,
      structs: r,
      type: "function"
    }));
  const c = [];
  if (n.returns) {
    const l = It(n.returns), h = l.length;
    for (let g = 0; g < h; g++)
      c.push(Qn(l[g], {
        modifiers: Na,
        structs: r,
        type: "function"
      }));
  }
  return {
    name: n.name,
    type: "function",
    stateMutability: n.stateMutability ?? "nonpayable",
    inputs: o,
    outputs: c
  };
}
function sw(e, r = {}) {
  const n = N5(e);
  if (!n)
    throw new wr({ signature: e, type: "event" });
  const i = It(n.parameters), o = [], u = i.length;
  for (let c = 0; c < u; c++)
    o.push(Qn(i[c], {
      modifiers: z5,
      structs: r,
      type: "event"
    }));
  return { name: n.name, type: "event", inputs: o };
}
function iw(e, r = {}) {
  const n = _5(e);
  if (!n)
    throw new wr({ signature: e, type: "error" });
  const i = It(n.parameters), o = [], u = i.length;
  for (let c = 0; c < u; c++)
    o.push(Qn(i[c], { structs: r, type: "error" }));
  return { name: n.name, type: "error", inputs: o };
}
function ow(e, r = {}) {
  const n = U5(e);
  if (!n)
    throw new wr({ signature: e, type: "constructor" });
  const i = It(n.parameters), o = [], u = i.length;
  for (let c = 0; c < u; c++)
    o.push(Qn(i[c], { structs: r, type: "constructor" }));
  return {
    type: "constructor",
    stateMutability: n.stateMutability ?? "nonpayable",
    inputs: o
  };
}
function aw(e) {
  const r = G5(e);
  if (!r)
    throw new wr({ signature: e, type: "fallback" });
  return {
    type: "fallback",
    stateMutability: r.stateMutability ?? "nonpayable"
  };
}
const uw = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/, cw = /^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/, fw = /^u?int$/;
function Qn(e, r) {
  var y, w;
  const n = tw(e, r == null ? void 0 : r.type, r == null ? void 0 : r.structs);
  if (ha.has(n))
    return ha.get(n);
  const i = Pl.test(e), o = on(i ? cw : uw, e);
  if (!o)
    throw new V5({ param: e });
  if (o.name && dw(o.name))
    throw new j5({ param: e, name: o.name });
  const u = o.name ? { name: o.name } : {}, c = o.modifier === "indexed" ? { indexed: !0 } : {}, l = (r == null ? void 0 : r.structs) ?? {};
  let h, g = {};
  if (i) {
    h = "tuple";
    const x = It(o.type), I = [], R = x.length;
    for (let O = 0; O < R; O++)
      I.push(Qn(x[O], { structs: l }));
    g = { components: I };
  } else if (o.type in l)
    h = "tuple", g = { components: l[o.type] };
  else if (fw.test(o.type))
    h = `${o.type}256`;
  else if (o.type === "address payable")
    h = "address";
  else if (h = o.type, (r == null ? void 0 : r.type) !== "struct" && !Nl(h))
    throw new W5({ type: h });
  if (o.modifier) {
    if (!((w = (y = r == null ? void 0 : r.modifiers) == null ? void 0 : y.has) != null && w.call(y, o.modifier)))
      throw new J5({
        param: e,
        type: r == null ? void 0 : r.type,
        modifier: o.modifier
      });
    if (Na.has(o.modifier) && !hw(h, !!o.array))
      throw new q5({
        param: e,
        type: r == null ? void 0 : r.type,
        modifier: o.modifier
      });
  }
  const m = {
    type: `${h}${o.array ?? ""}`,
    ...u,
    ...c,
    ...g
  };
  return ha.set(n, m), m;
}
function It(e, r = [], n = "", i = 0) {
  const o = e.trim().length;
  for (let u = 0; u < o; u++) {
    const c = e[u], l = e.slice(u + 1);
    switch (c) {
      case ",":
        return i === 0 ? It(l, [...r, n.trim()]) : It(l, r, `${n}${c}`, i);
      case "(":
        return It(l, r, `${n}${c}`, i + 1);
      case ")":
        return It(l, r, `${n}${c}`, i - 1);
      default:
        return It(l, r, `${n}${c}`, i);
    }
  }
  if (n === "")
    return r;
  if (i !== 0)
    throw new ew({ current: n, depth: i });
  return r.push(n.trim()), r;
}
function Nl(e) {
  return e === "address" || e === "bool" || e === "function" || e === "string" || vl.test(e) || Tl.test(e);
}
const lw = /^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;
function dw(e) {
  return e === "address" || e === "bool" || e === "function" || e === "string" || e === "tuple" || vl.test(e) || Tl.test(e) || lw.test(e);
}
function hw(e, r) {
  return r || e === "bytes" || e === "string" || e === "tuple";
}
function pw(e) {
  const r = {}, n = e.length;
  for (let c = 0; c < n; c++) {
    const l = e[c];
    if (!Cl(l))
      continue;
    const h = M5(l);
    if (!h)
      throw new wr({ signature: l, type: "struct" });
    const g = h.properties.split(";"), m = [], y = g.length;
    for (let w = 0; w < y; w++) {
      const I = g[w].trim();
      if (!I)
        continue;
      const R = Qn(I, {
        type: "struct"
      });
      m.push(R);
    }
    if (!m.length)
      throw new X5({ signature: l });
    r[h.name] = m;
  }
  const i = {}, o = Object.entries(r), u = o.length;
  for (let c = 0; c < u; c++) {
    const [l, h] = o[c];
    i[l] = Ol(h, r);
  }
  return i;
}
const gw = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;
function Ol(e, r, n = /* @__PURE__ */ new Set()) {
  const i = [], o = e.length;
  for (let u = 0; u < o; u++) {
    const c = e[u];
    if (Pl.test(c.type))
      i.push(c);
    else {
      const h = on(gw, c.type);
      if (!(h != null && h.type))
        throw new K5({ abiParameter: c });
      const { array: g, type: m } = h;
      if (m in r) {
        if (n.has(m))
          throw new Z5({ type: m });
        i.push({
          ...c,
          type: `tuple${g ?? ""}`,
          components: Ol(r[m] ?? [], r, /* @__PURE__ */ new Set([...n, m]))
        });
      } else if (Nl(m))
        i.push(c);
      else
        throw new $5({ type: m });
    }
  }
  return i;
}
function Ll(e) {
  const r = pw(e), n = [], i = e.length;
  for (let o = 0; o < i; o++) {
    const u = e[o];
    Cl(u) || n.push(nw(u, r));
  }
  return n;
}
function an(e) {
  return typeof e == "string" ? { address: e, type: "json-rpc" } : e;
}
const Ml = "2.38.0";
let jr = {
  getDocsUrl: ({ docsBaseUrl: e, docsPath: r = "", docsSlug: n }) => r ? `${e ?? "https://viem.sh"}${r}${n ? `#${n}` : ""}` : void 0,
  version: `viem@${Ml}`
}, U = class Oa extends Error {
  constructor(r, n = {}) {
    var l;
    const i = (() => {
      var h;
      return n.cause instanceof Oa ? n.cause.details : (h = n.cause) != null && h.message ? n.cause.message : n.details;
    })(), o = n.cause instanceof Oa && n.cause.docsPath || n.docsPath, u = (l = jr.getDocsUrl) == null ? void 0 : l.call(jr, { ...n, docsPath: o }), c = [
      r || "An error occurred.",
      "",
      ...n.metaMessages ? [...n.metaMessages, ""] : [],
      ...u ? [`Docs: ${u}`] : [],
      ...i ? [`Details: ${i}`] : [],
      ...jr.version ? [`Version: ${jr.version}`] : []
    ].join(`
`);
    super(c, n.cause ? { cause: n.cause } : void 0), Object.defineProperty(this, "details", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "docsPath", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "metaMessages", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "shortMessage", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "version", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "BaseError"
    }), this.details = i, this.docsPath = o, this.metaMessages = n.metaMessages, this.name = n.name ?? this.name, this.shortMessage = r, this.version = Ml;
  }
  walk(r) {
    return Fl(this, r);
  }
};
function Fl(e, r) {
  return r != null && r(e) ? e : e && typeof e == "object" && "cause" in e && e.cause !== void 0 ? Fl(e.cause, r) : r ? null : e;
}
class Xr extends U {
  constructor({ address: r }) {
    super(`Address "${r}" is invalid.`, {
      metaMessages: [
        "- Address must be a hex value of 20 bytes (40 hex characters).",
        "- Address must match its checksum counterpart."
      ],
      name: "InvalidAddressError"
    });
  }
}
function Lt(e, { strict: r = !0 } = {}) {
  return !e || typeof e != "string" ? !1 : r ? /^0x[0-9a-fA-F]*$/.test(e) : e.startsWith("0x");
}
class Ul extends U {
  constructor({ offset: r, position: n, size: i }) {
    super(`Slice ${n === "start" ? "starting" : "ending"} at offset "${r}" is out-of-bounds (size: ${i}).`, { name: "SliceOffsetOutOfBoundsError" });
  }
}
let kl = class extends U {
  constructor({ size: r, targetSize: n, type: i }) {
    super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} size (${r}) exceeds padding size (${n}).`, { name: "SizeExceedsPaddingSizeError" });
  }
};
class O0 extends U {
  constructor({ size: r, targetSize: n, type: i }) {
    super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} is expected to be ${n} ${i} long, but is ${r} ${i} long.`, { name: "InvalidBytesLengthError" });
  }
}
function Er(e, { dir: r, size: n = 32 } = {}) {
  return typeof e == "string" ? En(e, { dir: r, size: n }) : mw(e, { dir: r, size: n });
}
function En(e, { dir: r, size: n = 32 } = {}) {
  if (n === null)
    return e;
  const i = e.replace("0x", "");
  if (i.length > n * 2)
    throw new kl({
      size: Math.ceil(i.length / 2),
      targetSize: n,
      type: "hex"
    });
  return `0x${i[r === "right" ? "padEnd" : "padStart"](n * 2, "0")}`;
}
function mw(e, { dir: r, size: n = 32 } = {}) {
  if (n === null)
    return e;
  if (e.length > n)
    throw new kl({
      size: e.length,
      targetSize: n,
      type: "bytes"
    });
  const i = new Uint8Array(n);
  for (let o = 0; o < n; o++) {
    const u = r === "right";
    i[u ? o : n - o - 1] = e[u ? o : e.length - o - 1];
  }
  return i;
}
let Gl = class extends U {
  constructor({ max: r, min: n, signed: i, size: o, value: u }) {
    super(`Number "${u}" is not in safe ${o ? `${o * 8}-bit ${i ? "signed" : "unsigned"} ` : ""}integer range ${r ? `(${n} to ${r})` : `(above ${n})`}`, { name: "IntegerOutOfRangeError" });
  }
};
class bw extends U {
  constructor(r) {
    super(`Bytes value "${r}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, {
      name: "InvalidBytesBooleanError"
    });
  }
}
class Aw extends U {
  constructor({ givenSize: r, maxSize: n }) {
    super(`Size cannot exceed ${n} bytes. Given size: ${r} bytes.`, { name: "SizeOverflowError" });
  }
}
function Be(e) {
  return Lt(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length;
}
function xr(e, { dir: r = "left" } = {}) {
  let n = typeof e == "string" ? e.replace("0x", "") : e, i = 0;
  for (let o = 0; o < n.length - 1 && n[r === "left" ? o : n.length - o - 1].toString() === "0"; o++)
    i++;
  return n = r === "left" ? n.slice(i) : n.slice(0, n.length - i), typeof e == "string" ? (n.length === 1 && r === "right" && (n = `${n}0`), `0x${n.length % 2 === 1 ? `0${n}` : n}`) : n;
}
function Ut(e, { size: r }) {
  if (Be(e) > r)
    throw new Aw({
      givenSize: Be(e),
      maxSize: r
    });
}
function Zt(e, r = {}) {
  const { signed: n } = r;
  r.size && Ut(e, { size: r.size });
  const i = BigInt(e);
  if (!n)
    return i;
  const o = (e.length - 2) / 2, u = (1n << BigInt(o) * 8n - 1n) - 1n;
  return i <= u ? i : i - BigInt(`0x${"f".padStart(o * 2, "f")}`) - 1n;
}
function en(e, r = {}) {
  return Number(Zt(e, r));
}
const yw = /* @__PURE__ */ Array.from({ length: 256 }, (e, r) => r.toString(16).padStart(2, "0"));
function gi(e, r = {}) {
  return typeof e == "number" || typeof e == "bigint" ? te(e, r) : typeof e == "string" ? Ql(e, r) : typeof e == "boolean" ? Hl(e, r) : Ge(e, r);
}
function Hl(e, r = {}) {
  const n = `0x${Number(e)}`;
  return typeof r.size == "number" ? (Ut(n, { size: r.size }), Er(n, { size: r.size })) : n;
}
function Ge(e, r = {}) {
  let n = "";
  for (let o = 0; o < e.length; o++)
    n += yw[e[o]];
  const i = `0x${n}`;
  return typeof r.size == "number" ? (Ut(i, { size: r.size }), Er(i, { dir: "right", size: r.size })) : i;
}
function te(e, r = {}) {
  const { signed: n, size: i } = r, o = BigInt(e);
  let u;
  i ? n ? u = (1n << BigInt(i) * 8n - 1n) - 1n : u = 2n ** (BigInt(i) * 8n) - 1n : typeof e == "number" && (u = BigInt(Number.MAX_SAFE_INTEGER));
  const c = typeof u == "bigint" && n ? -u - 1n : 0;
  if (u && o > u || o < c) {
    const h = typeof e == "bigint" ? "n" : "";
    throw new Gl({
      max: u ? `${u}${h}` : void 0,
      min: `${c}${h}`,
      signed: n,
      size: i,
      value: `${e}${h}`
    });
  }
  const l = `0x${(n && o < 0 ? (1n << BigInt(i * 8)) + BigInt(o) : o).toString(16)}`;
  return i ? Er(l, { size: i }) : l;
}
const ww = /* @__PURE__ */ new TextEncoder();
function Ql(e, r = {}) {
  const n = ww.encode(e);
  return Ge(n, r);
}
const Ew = /* @__PURE__ */ new TextEncoder();
function _i(e, r = {}) {
  return typeof e == "number" || typeof e == "bigint" ? vw(e, r) : typeof e == "boolean" ? xw(e, r) : Lt(e) ? tn(e, r) : Gn(e, r);
}
function xw(e, r = {}) {
  const n = new Uint8Array(1);
  return n[0] = Number(e), typeof r.size == "number" ? (Ut(n, { size: r.size }), Er(n, { size: r.size })) : n;
}
const Kt = {
  zero: 48,
  nine: 57,
  A: 65,
  F: 70,
  a: 97,
  f: 102
};
function L0(e) {
  if (e >= Kt.zero && e <= Kt.nine)
    return e - Kt.zero;
  if (e >= Kt.A && e <= Kt.F)
    return e - (Kt.A - 10);
  if (e >= Kt.a && e <= Kt.f)
    return e - (Kt.a - 10);
}
function tn(e, r = {}) {
  let n = e;
  r.size && (Ut(n, { size: r.size }), n = Er(n, { dir: "right", size: r.size }));
  let i = n.slice(2);
  i.length % 2 && (i = `0${i}`);
  const o = i.length / 2, u = new Uint8Array(o);
  for (let c = 0, l = 0; c < o; c++) {
    const h = L0(i.charCodeAt(l++)), g = L0(i.charCodeAt(l++));
    if (h === void 0 || g === void 0)
      throw new U(`Invalid byte sequence ("${i[l - 2]}${i[l - 1]}" in "${i}").`);
    u[c] = h * 16 + g;
  }
  return u;
}
function vw(e, r) {
  const n = te(e, r);
  return tn(n);
}
function Gn(e, r = {}) {
  const n = Ew.encode(e);
  return typeof r.size == "number" ? (Ut(n, { size: r.size }), Er(n, { dir: "right", size: r.size })) : n;
}
const ai = /* @__PURE__ */ BigInt(2 ** 32 - 1), M0 = /* @__PURE__ */ BigInt(32);
function Tw(e, r = !1) {
  return r ? { h: Number(e & ai), l: Number(e >> M0 & ai) } : { h: Number(e >> M0 & ai) | 0, l: Number(e & ai) | 0 };
}
function Pw(e, r = !1) {
  const n = e.length;
  let i = new Uint32Array(n), o = new Uint32Array(n);
  for (let u = 0; u < n; u++) {
    const { h: c, l } = Tw(e[u], r);
    [i[u], o[u]] = [c, l];
  }
  return [i, o];
}
const Iw = (e, r, n) => e << n | r >>> 32 - n, Sw = (e, r, n) => r << n | e >>> 32 - n, Bw = (e, r, n) => r << n - 32 | e >>> 64 - n, Rw = (e, r, n) => e << n - 32 | r >>> 64 - n, ar = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
function Cw(e) {
  return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
}
function mi(e) {
  if (!Number.isSafeInteger(e) || e < 0)
    throw new Error("positive integer expected, got " + e);
}
function hr(e, ...r) {
  if (!Cw(e))
    throw new Error("Uint8Array expected");
  if (r.length > 0 && !r.includes(e.length))
    throw new Error("Uint8Array expected of length " + r + ", got length=" + e.length);
}
function s3(e) {
  if (typeof e != "function" || typeof e.create != "function")
    throw new Error("Hash should be wrapped by utils.createHasher");
  mi(e.outputLen), mi(e.blockLen);
}
function bi(e, r = !0) {
  if (e.destroyed)
    throw new Error("Hash instance has been destroyed");
  if (r && e.finished)
    throw new Error("Hash#digest() has already been called");
}
function zl(e, r) {
  hr(e);
  const n = r.outputLen;
  if (e.length < n)
    throw new Error("digestInto() expects output buffer of length at least " + n);
}
function _w(e) {
  return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
}
function Zr(...e) {
  for (let r = 0; r < e.length; r++)
    e[r].fill(0);
}
function pa(e) {
  return new DataView(e.buffer, e.byteOffset, e.byteLength);
}
function Dt(e, r) {
  return e << 32 - r | e >>> r;
}
const Dw = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
function Nw(e) {
  return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
}
function Ow(e) {
  for (let r = 0; r < e.length; r++)
    e[r] = Nw(e[r]);
  return e;
}
const F0 = Dw ? (e) => e : Ow;
function Lw(e) {
  if (typeof e != "string")
    throw new Error("string expected");
  return new Uint8Array(new TextEncoder().encode(e));
}
function mu(e) {
  return typeof e == "string" && (e = Lw(e)), hr(e), e;
}
function i3(...e) {
  let r = 0;
  for (let i = 0; i < e.length; i++) {
    const o = e[i];
    hr(o), r += o.length;
  }
  const n = new Uint8Array(r);
  for (let i = 0, o = 0; i < e.length; i++) {
    const u = e[i];
    n.set(u, o), o += u.length;
  }
  return n;
}
class $l {
}
function Wl(e) {
  const r = (i) => e().update(mu(i)).digest(), n = e();
  return r.outputLen = n.outputLen, r.blockLen = n.blockLen, r.create = () => e(), r;
}
function o3(e = 32) {
  if (ar && typeof ar.getRandomValues == "function")
    return ar.getRandomValues(new Uint8Array(e));
  if (ar && typeof ar.randomBytes == "function")
    return Uint8Array.from(ar.randomBytes(e));
  throw new Error("crypto.getRandomValues must be defined");
}
const Mw = BigInt(0), Jr = BigInt(1), Fw = BigInt(2), Uw = BigInt(7), kw = BigInt(256), Gw = BigInt(113), Vl = [], jl = [], Jl = [];
for (let e = 0, r = Jr, n = 1, i = 0; e < 24; e++) {
  [n, i] = [i, (2 * n + 3 * i) % 5], Vl.push(2 * (5 * i + n)), jl.push((e + 1) * (e + 2) / 2 % 64);
  let o = Mw;
  for (let u = 0; u < 7; u++)
    r = (r << Jr ^ (r >> Uw) * Gw) % kw, r & Fw && (o ^= Jr << (Jr << /* @__PURE__ */ BigInt(u)) - Jr);
  Jl.push(o);
}
const ql = Pw(Jl, !0), Hw = ql[0], Qw = ql[1], U0 = (e, r, n) => n > 32 ? Bw(e, r, n) : Iw(e, r, n), k0 = (e, r, n) => n > 32 ? Rw(e, r, n) : Sw(e, r, n);
function zw(e, r = 24) {
  const n = new Uint32Array(10);
  for (let i = 24 - r; i < 24; i++) {
    for (let c = 0; c < 10; c++)
      n[c] = e[c] ^ e[c + 10] ^ e[c + 20] ^ e[c + 30] ^ e[c + 40];
    for (let c = 0; c < 10; c += 2) {
      const l = (c + 8) % 10, h = (c + 2) % 10, g = n[h], m = n[h + 1], y = U0(g, m, 1) ^ n[l], w = k0(g, m, 1) ^ n[l + 1];
      for (let x = 0; x < 50; x += 10)
        e[c + x] ^= y, e[c + x + 1] ^= w;
    }
    let o = e[2], u = e[3];
    for (let c = 0; c < 24; c++) {
      const l = jl[c], h = U0(o, u, l), g = k0(o, u, l), m = Vl[c];
      o = e[m], u = e[m + 1], e[m] = h, e[m + 1] = g;
    }
    for (let c = 0; c < 50; c += 10) {
      for (let l = 0; l < 10; l++)
        n[l] = e[c + l];
      for (let l = 0; l < 10; l++)
        e[c + l] ^= ~n[(l + 2) % 10] & n[(l + 4) % 10];
    }
    e[0] ^= Hw[i], e[1] ^= Qw[i];
  }
  Zr(n);
}
class bu extends $l {
  // NOTE: we accept arguments in bytes instead of bits here.
  constructor(r, n, i, o = !1, u = 24) {
    if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = r, this.suffix = n, this.outputLen = i, this.enableXOF = o, this.rounds = u, mi(i), !(0 < r && r < 200))
      throw new Error("only keccak-f1600 function is supported");
    this.state = new Uint8Array(200), this.state32 = _w(this.state);
  }
  clone() {
    return this._cloneInto();
  }
  keccak() {
    F0(this.state32), zw(this.state32, this.rounds), F0(this.state32), this.posOut = 0, this.pos = 0;
  }
  update(r) {
    bi(this), r = mu(r), hr(r);
    const { blockLen: n, state: i } = this, o = r.length;
    for (let u = 0; u < o; ) {
      const c = Math.min(n - this.pos, o - u);
      for (let l = 0; l < c; l++)
        i[this.pos++] ^= r[u++];
      this.pos === n && this.keccak();
    }
    return this;
  }
  finish() {
    if (this.finished)
      return;
    this.finished = !0;
    const { state: r, suffix: n, pos: i, blockLen: o } = this;
    r[i] ^= n, (n & 128) !== 0 && i === o - 1 && this.keccak(), r[o - 1] ^= 128, this.keccak();
  }
  writeInto(r) {
    bi(this, !1), hr(r), this.finish();
    const n = this.state, { blockLen: i } = this;
    for (let o = 0, u = r.length; o < u; ) {
      this.posOut >= i && this.keccak();
      const c = Math.min(i - this.posOut, u - o);
      r.set(n.subarray(this.posOut, this.posOut + c), o), this.posOut += c, o += c;
    }
    return r;
  }
  xofInto(r) {
    if (!this.enableXOF)
      throw new Error("XOF is not possible for this instance");
    return this.writeInto(r);
  }
  xof(r) {
    return mi(r), this.xofInto(new Uint8Array(r));
  }
  digestInto(r) {
    if (zl(r, this), this.finished)
      throw new Error("digest() was already called");
    return this.writeInto(r), this.destroy(), r;
  }
  digest() {
    return this.digestInto(new Uint8Array(this.outputLen));
  }
  destroy() {
    this.destroyed = !0, Zr(this.state);
  }
  _cloneInto(r) {
    const { blockLen: n, suffix: i, outputLen: o, rounds: u, enableXOF: c } = this;
    return r || (r = new bu(n, i, o, c, u)), r.state32.set(this.state32), r.pos = this.pos, r.posOut = this.posOut, r.finished = this.finished, r.rounds = u, r.suffix = i, r.outputLen = o, r.enableXOF = c, r.destroyed = this.destroyed, r;
  }
}
const $w = (e, r, n) => Wl(() => new bu(r, e, n)), Ww = $w(1, 136, 256 / 8);
function zn(e, r) {
  const n = r || "hex", i = Ww(Lt(e, { strict: !1 }) ? _i(e) : e);
  return n === "bytes" ? i : gi(i);
}
let Au = class extends Map {
  constructor(r) {
    super(), Object.defineProperty(this, "maxSize", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.maxSize = r;
  }
  get(r) {
    const n = super.get(r);
    return super.has(r) && n !== void 0 && (this.delete(r), super.set(r, n)), n;
  }
  set(r, n) {
    if (super.set(r, n), this.maxSize && this.size > this.maxSize) {
      const i = this.keys().next().value;
      i && this.delete(i);
    }
    return this;
  }
};
const Vw = /^0x[a-fA-F0-9]{40}$/, ga = /* @__PURE__ */ new Au(8192);
function xn(e, r) {
  const { strict: n = !0 } = r ?? {}, i = `${e}.${n}`;
  if (ga.has(i))
    return ga.get(i);
  const o = Vw.test(e) ? e.toLowerCase() === e ? !0 : n ? Di(e) === e : !0 : !1;
  return ga.set(i, o), o;
}
const ma = /* @__PURE__ */ new Au(8192);
function Di(e, r) {
  if (ma.has(`${e}.${r}`))
    return ma.get(`${e}.${r}`);
  const n = e.substring(2).toLowerCase(), i = zn(Gn(n), "bytes"), o = n.split("");
  for (let c = 0; c < 40; c += 2)
    i[c >> 1] >> 4 >= 8 && o[c] && (o[c] = o[c].toUpperCase()), (i[c >> 1] & 15) >= 8 && o[c + 1] && (o[c + 1] = o[c + 1].toUpperCase());
  const u = `0x${o.join("")}`;
  return ma.set(`${e}.${r}`, u), u;
}
function jw(e) {
  const r = zn(`0x${e.substring(4)}`).substring(26);
  return Di(`0x${r}`);
}
function vn(e, { includeName: r = !1 } = {}) {
  if (e.type !== "function" && e.type !== "event" && e.type !== "error")
    throw new o6(e.type);
  return `${e.name}(${yu(e.inputs, { includeName: r })})`;
}
function yu(e, { includeName: r = !1 } = {}) {
  return e ? e.map((n) => Jw(n, { includeName: r })).join(r ? ", " : ",") : "";
}
function Jw(e, { includeName: r }) {
  return e.type.startsWith("tuple") ? `(${yu(e.components, { includeName: r })})${e.type.slice(5)}` : e.type + (r && e.name ? ` ${e.name}` : "");
}
class qw extends U {
  constructor({ docsPath: r }) {
    super([
      "A constructor was not found on the ABI.",
      "Make sure you are using the correct ABI and that the constructor exists on it."
    ].join(`
`), {
      docsPath: r,
      name: "AbiConstructorNotFoundError"
    });
  }
}
class G0 extends U {
  constructor({ docsPath: r }) {
    super([
      "Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.",
      "Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."
    ].join(`
`), {
      docsPath: r,
      name: "AbiConstructorParamsNotFoundError"
    });
  }
}
class Kw extends U {
  constructor({ data: r, params: n, size: i }) {
    super([`Data size of ${i} bytes is too small for given parameters.`].join(`
`), {
      metaMessages: [
        `Params: (${yu(n, { includeName: !0 })})`,
        `Data:   ${r} (${i} bytes)`
      ],
      name: "AbiDecodingDataSizeTooSmallError"
    }), Object.defineProperty(this, "data", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "params", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "size", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.data = r, this.params = n, this.size = i;
  }
}
class Ni extends U {
  constructor() {
    super('Cannot decode zero data ("0x") with ABI parameters.', {
      name: "AbiDecodingZeroDataError"
    });
  }
}
class Yw extends U {
  constructor({ expectedLength: r, givenLength: n, type: i }) {
    super([
      `ABI encoding array length mismatch for type ${i}.`,
      `Expected length: ${r}`,
      `Given length: ${n}`
    ].join(`
`), { name: "AbiEncodingArrayLengthMismatchError" });
  }
}
class Xw extends U {
  constructor({ expectedSize: r, value: n }) {
    super(`Size of bytes "${n}" (bytes${Be(n)}) does not match expected size (bytes${r}).`, { name: "AbiEncodingBytesSizeMismatchError" });
  }
}
class Zw extends U {
  constructor({ expectedLength: r, givenLength: n }) {
    super([
      "ABI encoding params/values length mismatch.",
      `Expected length (params): ${r}`,
      `Given length (values): ${n}`
    ].join(`
`), { name: "AbiEncodingLengthMismatchError" });
  }
}
class e6 extends U {
  constructor(r, { docsPath: n }) {
    super([
      `Arguments (\`args\`) were provided to "${r}", but "${r}" on the ABI does not contain any parameters (\`inputs\`).`,
      "Cannot encode error result without knowing what the parameter types are.",
      "Make sure you are using the correct ABI and that the inputs exist on it."
    ].join(`
`), {
      docsPath: n,
      name: "AbiErrorInputsNotFoundError"
    });
  }
}
class H0 extends U {
  constructor(r, { docsPath: n } = {}) {
    super([
      `Error ${r ? `"${r}" ` : ""}not found on ABI.`,
      "Make sure you are using the correct ABI and that the error exists on it."
    ].join(`
`), {
      docsPath: n,
      name: "AbiErrorNotFoundError"
    });
  }
}
class Kl extends U {
  constructor(r, { docsPath: n }) {
    super([
      `Encoded error signature "${r}" not found on ABI.`,
      "Make sure you are using the correct ABI and that the error exists on it.",
      `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${r}.`
    ].join(`
`), {
      docsPath: n,
      name: "AbiErrorSignatureNotFoundError"
    }), Object.defineProperty(this, "signature", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.signature = r;
  }
}
class pr extends U {
  constructor(r, { docsPath: n } = {}) {
    super([
      `Function ${r ? `"${r}" ` : ""}not found on ABI.`,
      "Make sure you are using the correct ABI and that the function exists on it."
    ].join(`
`), {
      docsPath: n,
      name: "AbiFunctionNotFoundError"
    });
  }
}
class Yl extends U {
  constructor(r, { docsPath: n }) {
    super([
      `Function "${r}" does not contain any \`outputs\` on ABI.`,
      "Cannot decode function result without knowing what the parameter types are.",
      "Make sure you are using the correct ABI and that the function exists on it."
    ].join(`
`), {
      docsPath: n,
      name: "AbiFunctionOutputsNotFoundError"
    });
  }
}
class t6 extends U {
  constructor(r, { docsPath: n }) {
    super([
      `Encoded function signature "${r}" not found on ABI.`,
      "Make sure you are using the correct ABI and that the function exists on it.",
      `You can look up the signature here: https://openchain.xyz/signatures?query=${r}.`
    ].join(`
`), {
      docsPath: n,
      name: "AbiFunctionSignatureNotFoundError"
    });
  }
}
class n6 extends U {
  constructor(r, n) {
    super("Found ambiguous types in overloaded ABI items.", {
      metaMessages: [
        `\`${r.type}\` in \`${vn(r.abiItem)}\`, and`,
        `\`${n.type}\` in \`${vn(n.abiItem)}\``,
        "",
        "These types encode differently and cannot be distinguished at runtime.",
        "Remove one of the ambiguous items in the ABI."
      ],
      name: "AbiItemAmbiguityError"
    });
  }
}
class r6 extends U {
  constructor({ expectedSize: r, givenSize: n }) {
    super(`Expected bytes${r}, got bytes${n}.`, {
      name: "BytesSizeMismatchError"
    });
  }
}
class s6 extends U {
  constructor(r, { docsPath: n }) {
    super([
      `Type "${r}" is not a valid encoding type.`,
      "Please provide a valid ABI type."
    ].join(`
`), { docsPath: n, name: "InvalidAbiEncodingType" });
  }
}
class i6 extends U {
  constructor(r, { docsPath: n }) {
    super([
      `Type "${r}" is not a valid decoding type.`,
      "Please provide a valid ABI type."
    ].join(`
`), { docsPath: n, name: "InvalidAbiDecodingType" });
  }
}
class Xl extends U {
  constructor(r) {
    super([`Value "${r}" is not a valid array.`].join(`
`), {
      name: "InvalidArrayError"
    });
  }
}
class o6 extends U {
  constructor(r) {
    super([
      `"${r}" is not a valid definition type.`,
      'Valid types: "function", "event", "error"'
    ].join(`
`), { name: "InvalidDefinitionTypeError" });
  }
}
class Q0 extends U {
  constructor({ offset: r }) {
    super(`Offset \`${r}\` cannot be negative.`, {
      name: "NegativeOffsetError"
    });
  }
}
class a6 extends U {
  constructor({ length: r, position: n }) {
    super(`Position \`${n}\` is out of bounds (\`0 < position < ${r}\`).`, { name: "PositionOutOfBoundsError" });
  }
}
class u6 extends U {
  constructor({ count: r, limit: n }) {
    super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${r}\`).`, { name: "RecursiveReadLimitExceededError" });
  }
}
const c6 = {
  bytes: new Uint8Array(),
  dataView: new DataView(new ArrayBuffer(0)),
  position: 0,
  positionReadCount: /* @__PURE__ */ new Map(),
  recursiveReadCount: 0,
  recursiveReadLimit: Number.POSITIVE_INFINITY,
  assertReadLimit() {
    if (this.recursiveReadCount >= this.recursiveReadLimit)
      throw new u6({
        count: this.recursiveReadCount + 1,
        limit: this.recursiveReadLimit
      });
  },
  assertPosition(e) {
    if (e < 0 || e > this.bytes.length - 1)
      throw new a6({
        length: this.bytes.length,
        position: e
      });
  },
  decrementPosition(e) {
    if (e < 0)
      throw new Q0({ offset: e });
    const r = this.position - e;
    this.assertPosition(r), this.position = r;
  },
  getReadCount(e) {
    return this.positionReadCount.get(e || this.position) || 0;
  },
  incrementPosition(e) {
    if (e < 0)
      throw new Q0({ offset: e });
    const r = this.position + e;
    this.assertPosition(r), this.position = r;
  },
  inspectByte(e) {
    const r = e ?? this.position;
    return this.assertPosition(r), this.bytes[r];
  },
  inspectBytes(e, r) {
    const n = r ?? this.position;
    return this.assertPosition(n + e - 1), this.bytes.subarray(n, n + e);
  },
  inspectUint8(e) {
    const r = e ?? this.position;
    return this.assertPosition(r), this.bytes[r];
  },
  inspectUint16(e) {
    const r = e ?? this.position;
    return this.assertPosition(r + 1), this.dataView.getUint16(r);
  },
  inspectUint24(e) {
    const r = e ?? this.position;
    return this.assertPosition(r + 2), (this.dataView.getUint16(r) << 8) + this.dataView.getUint8(r + 2);
  },
  inspectUint32(e) {
    const r = e ?? this.position;
    return this.assertPosition(r + 3), this.dataView.getUint32(r);
  },
  pushByte(e) {
    this.assertPosition(this.position), this.bytes[this.position] = e, this.position++;
  },
  pushBytes(e) {
    this.assertPosition(this.position + e.length - 1), this.bytes.set(e, this.position), this.position += e.length;
  },
  pushUint8(e) {
    this.assertPosition(this.position), this.bytes[this.position] = e, this.position++;
  },
  pushUint16(e) {
    this.assertPosition(this.position + 1), this.dataView.setUint16(this.position, e), this.position += 2;
  },
  pushUint24(e) {
    this.assertPosition(this.position + 2), this.dataView.setUint16(this.position, e >> 8), this.dataView.setUint8(this.position + 2, e & 255), this.position += 3;
  },
  pushUint32(e) {
    this.assertPosition(this.position + 3), this.dataView.setUint32(this.position, e), this.position += 4;
  },
  readByte() {
    this.assertReadLimit(), this._touch();
    const e = this.inspectByte();
    return this.position++, e;
  },
  readBytes(e, r) {
    this.assertReadLimit(), this._touch();
    const n = this.inspectBytes(e);
    return this.position += r ?? e, n;
  },
  readUint8() {
    this.assertReadLimit(), this._touch();
    const e = this.inspectUint8();
    return this.position += 1, e;
  },
  readUint16() {
    this.assertReadLimit(), this._touch();
    const e = this.inspectUint16();
    return this.position += 2, e;
  },
  readUint24() {
    this.assertReadLimit(), this._touch();
    const e = this.inspectUint24();
    return this.position += 3, e;
  },
  readUint32() {
    this.assertReadLimit(), this._touch();
    const e = this.inspectUint32();
    return this.position += 4, e;
  },
  get remaining() {
    return this.bytes.length - this.position;
  },
  setPosition(e) {
    const r = this.position;
    return this.assertPosition(e), this.position = e, () => this.position = r;
  },
  _touch() {
    if (this.recursiveReadLimit === Number.POSITIVE_INFINITY)
      return;
    const e = this.getReadCount();
    this.positionReadCount.set(this.position, e + 1), e > 0 && this.recursiveReadCount++;
  }
};
function wu(e, { recursiveReadLimit: r = 8192 } = {}) {
  const n = Object.create(c6);
  return n.bytes = e, n.dataView = new DataView(e.buffer, e.byteOffset, e.byteLength), n.positionReadCount = /* @__PURE__ */ new Map(), n.recursiveReadLimit = r, n;
}
function gr(e, r, n, { strict: i } = {}) {
  return Lt(e, { strict: !1 }) ? La(e, r, n, {
    strict: i
  }) : td(e, r, n, {
    strict: i
  });
}
function Zl(e, r) {
  if (typeof r == "number" && r > 0 && r > Be(e) - 1)
    throw new Ul({
      offset: r,
      position: "start",
      size: Be(e)
    });
}
function ed(e, r, n) {
  if (typeof r == "number" && typeof n == "number" && Be(e) !== n - r)
    throw new Ul({
      offset: n,
      position: "end",
      size: Be(e)
    });
}
function td(e, r, n, { strict: i } = {}) {
  Zl(e, r);
  const o = e.slice(r, n);
  return i && ed(o, r, n), o;
}
function La(e, r, n, { strict: i } = {}) {
  Zl(e, r);
  const o = `0x${e.replace("0x", "").slice((r ?? 0) * 2, (n ?? e.length) * 2)}`;
  return i && ed(o, r, n), o;
}
function f6(e, r = {}) {
  typeof r.size < "u" && Ut(e, { size: r.size });
  const n = Ge(e, r);
  return Zt(n, r);
}
function l6(e, r = {}) {
  let n = e;
  if (typeof r.size < "u" && (Ut(n, { size: r.size }), n = xr(n)), n.length > 1 || n[0] > 1)
    throw new bw(n);
  return !!n[0];
}
function Xt(e, r = {}) {
  typeof r.size < "u" && Ut(e, { size: r.size });
  const n = Ge(e, r);
  return en(n, r);
}
function d6(e, r = {}) {
  let n = e;
  return typeof r.size < "u" && (Ut(n, { size: r.size }), n = xr(n, { dir: "right" })), new TextDecoder().decode(n);
}
function nn(e) {
  return typeof e[0] == "string" ? ls(e) : h6(e);
}
function h6(e) {
  let r = 0;
  for (const o of e)
    r += o.length;
  const n = new Uint8Array(r);
  let i = 0;
  for (const o of e)
    n.set(o, i), i += o.length;
  return n;
}
function ls(e) {
  return `0x${e.reduce((r, n) => r + n.replace("0x", ""), "")}`;
}
const p6 = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, nd = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;
function Oi(e, r) {
  if (e.length !== r.length)
    throw new Zw({
      expectedLength: e.length,
      givenLength: r.length
    });
  const n = g6({
    params: e,
    values: r
  }), i = xu(n);
  return i.length === 0 ? "0x" : i;
}
function g6({ params: e, values: r }) {
  const n = [];
  for (let i = 0; i < e.length; i++)
    n.push(Eu({ param: e[i], value: r[i] }));
  return n;
}
function Eu({ param: e, value: r }) {
  const n = vu(e.type);
  if (n) {
    const [i, o] = n;
    return b6(r, { length: i, param: { ...e, type: o } });
  }
  if (e.type === "tuple")
    return x6(r, {
      param: e
    });
  if (e.type === "address")
    return m6(r);
  if (e.type === "bool")
    return y6(r);
  if (e.type.startsWith("uint") || e.type.startsWith("int")) {
    const i = e.type.startsWith("int"), [, , o = "256"] = nd.exec(e.type) ?? [];
    return w6(r, {
      signed: i,
      size: Number(o)
    });
  }
  if (e.type.startsWith("bytes"))
    return A6(r, { param: e });
  if (e.type === "string")
    return E6(r);
  throw new s6(e.type, {
    docsPath: "/docs/contract/encodeAbiParameters"
  });
}
function xu(e) {
  let r = 0;
  for (let u = 0; u < e.length; u++) {
    const { dynamic: c, encoded: l } = e[u];
    c ? r += 32 : r += Be(l);
  }
  const n = [], i = [];
  let o = 0;
  for (let u = 0; u < e.length; u++) {
    const { dynamic: c, encoded: l } = e[u];
    c ? (n.push(te(r + o, { size: 32 })), i.push(l), o += Be(l)) : n.push(l);
  }
  return nn([...n, ...i]);
}
function m6(e) {
  if (!xn(e))
    throw new Xr({ address: e });
  return { dynamic: !1, encoded: En(e.toLowerCase()) };
}
function b6(e, { length: r, param: n }) {
  const i = r === null;
  if (!Array.isArray(e))
    throw new Xl(e);
  if (!i && e.length !== r)
    throw new Yw({
      expectedLength: r,
      givenLength: e.length,
      type: `${n.type}[${r}]`
    });
  let o = !1;
  const u = [];
  for (let c = 0; c < e.length; c++) {
    const l = Eu({ param: n, value: e[c] });
    l.dynamic && (o = !0), u.push(l);
  }
  if (i || o) {
    const c = xu(u);
    if (i) {
      const l = te(u.length, { size: 32 });
      return {
        dynamic: !0,
        encoded: u.length > 0 ? nn([l, c]) : l
      };
    }
    if (o)
      return { dynamic: !0, encoded: c };
  }
  return {
    dynamic: !1,
    encoded: nn(u.map(({ encoded: c }) => c))
  };
}
function A6(e, { param: r }) {
  const [, n] = r.type.split("bytes"), i = Be(e);
  if (!n) {
    let o = e;
    return i % 32 !== 0 && (o = En(o, {
      dir: "right",
      size: Math.ceil((e.length - 2) / 2 / 32) * 32
    })), {
      dynamic: !0,
      encoded: nn([En(te(i, { size: 32 })), o])
    };
  }
  if (i !== Number.parseInt(n, 10))
    throw new Xw({
      expectedSize: Number.parseInt(n, 10),
      value: e
    });
  return { dynamic: !1, encoded: En(e, { dir: "right" }) };
}
function y6(e) {
  if (typeof e != "boolean")
    throw new U(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);
  return { dynamic: !1, encoded: En(Hl(e)) };
}
function w6(e, { signed: r, size: n = 256 }) {
  if (typeof n == "number") {
    const i = 2n ** (BigInt(n) - (r ? 1n : 0n)) - 1n, o = r ? -i - 1n : 0n;
    if (e > i || e < o)
      throw new Gl({
        max: i.toString(),
        min: o.toString(),
        signed: r,
        size: n / 8,
        value: e.toString()
      });
  }
  return {
    dynamic: !1,
    encoded: te(e, {
      size: 32,
      signed: r
    })
  };
}
function E6(e) {
  const r = Ql(e), n = Math.ceil(Be(r) / 32), i = [];
  for (let o = 0; o < n; o++)
    i.push(En(gr(r, o * 32, (o + 1) * 32), {
      dir: "right"
    }));
  return {
    dynamic: !0,
    encoded: nn([
      En(te(Be(r), { size: 32 })),
      ...i
    ])
  };
}
function x6(e, { param: r }) {
  let n = !1;
  const i = [];
  for (let o = 0; o < r.components.length; o++) {
    const u = r.components[o], c = Array.isArray(e) ? o : u.name, l = Eu({
      param: u,
      value: e[c]
    });
    i.push(l), l.dynamic && (n = !0);
  }
  return {
    dynamic: n,
    encoded: n ? xu(i) : nn(i.map(({ encoded: o }) => o))
  };
}
function vu(e) {
  const r = e.match(/^(.*)\[(\d+)?\]$/);
  return r ? (
    // Return `null` if the array is dynamic.
    [r[2] ? Number(r[2]) : null, r[1]]
  ) : void 0;
}
function Tu(e, r) {
  const n = typeof r == "string" ? tn(r) : r, i = wu(n);
  if (Be(n) === 0 && e.length > 0)
    throw new Ni();
  if (Be(r) && Be(r) < 32)
    throw new Kw({
      data: typeof r == "string" ? r : Ge(r),
      params: e,
      size: Be(r)
    });
  let o = 0;
  const u = [];
  for (let c = 0; c < e.length; ++c) {
    const l = e[c];
    i.setPosition(o);
    const [h, g] = lr(i, l, {
      staticPosition: 0
    });
    o += g, u.push(h);
  }
  return u;
}
function lr(e, r, { staticPosition: n }) {
  const i = vu(r.type);
  if (i) {
    const [o, u] = i;
    return T6(e, { ...r, type: u }, { length: o, staticPosition: n });
  }
  if (r.type === "tuple")
    return B6(e, r, { staticPosition: n });
  if (r.type === "address")
    return v6(e);
  if (r.type === "bool")
    return P6(e);
  if (r.type.startsWith("bytes"))
    return I6(e, r, { staticPosition: n });
  if (r.type.startsWith("uint") || r.type.startsWith("int"))
    return S6(e, r);
  if (r.type === "string")
    return R6(e, { staticPosition: n });
  throw new i6(r.type, {
    docsPath: "/docs/contract/decodeAbiParameters"
  });
}
const z0 = 32, Ma = 32;
function v6(e) {
  const r = e.readBytes(32);
  return [Di(Ge(td(r, -20))), 32];
}
function T6(e, r, { length: n, staticPosition: i }) {
  if (!n) {
    const c = Xt(e.readBytes(Ma)), l = i + c, h = l + z0;
    e.setPosition(l);
    const g = Xt(e.readBytes(z0)), m = es(r);
    let y = 0;
    const w = [];
    for (let x = 0; x < g; ++x) {
      e.setPosition(h + (m ? x * 32 : y));
      const [I, R] = lr(e, r, {
        staticPosition: h
      });
      y += R, w.push(I);
    }
    return e.setPosition(i + 32), [w, 32];
  }
  if (es(r)) {
    const c = Xt(e.readBytes(Ma)), l = i + c, h = [];
    for (let g = 0; g < n; ++g) {
      e.setPosition(l + g * 32);
      const [m] = lr(e, r, {
        staticPosition: l
      });
      h.push(m);
    }
    return e.setPosition(i + 32), [h, 32];
  }
  let o = 0;
  const u = [];
  for (let c = 0; c < n; ++c) {
    const [l, h] = lr(e, r, {
      staticPosition: i + o
    });
    o += h, u.push(l);
  }
  return [u, o];
}
function P6(e) {
  return [l6(e.readBytes(32), { size: 32 }), 32];
}
function I6(e, r, { staticPosition: n }) {
  const [i, o] = r.type.split("bytes");
  if (!o) {
    const c = Xt(e.readBytes(32));
    e.setPosition(n + c);
    const l = Xt(e.readBytes(32));
    if (l === 0)
      return e.setPosition(n + 32), ["0x", 32];
    const h = e.readBytes(l);
    return e.setPosition(n + 32), [Ge(h), 32];
  }
  return [Ge(e.readBytes(Number.parseInt(o, 10), 32)), 32];
}
function S6(e, r) {
  const n = r.type.startsWith("int"), i = Number.parseInt(r.type.split("int")[1] || "256", 10), o = e.readBytes(32);
  return [
    i > 48 ? f6(o, { signed: n }) : Xt(o, { signed: n }),
    32
  ];
}
function B6(e, r, { staticPosition: n }) {
  const i = r.components.length === 0 || r.components.some(({ name: c }) => !c), o = i ? [] : {};
  let u = 0;
  if (es(r)) {
    const c = Xt(e.readBytes(Ma)), l = n + c;
    for (let h = 0; h < r.components.length; ++h) {
      const g = r.components[h];
      e.setPosition(l + u);
      const [m, y] = lr(e, g, {
        staticPosition: l
      });
      u += y, o[i ? h : g == null ? void 0 : g.name] = m;
    }
    return e.setPosition(n + 32), [o, 32];
  }
  for (let c = 0; c < r.components.length; ++c) {
    const l = r.components[c], [h, g] = lr(e, l, {
      staticPosition: n
    });
    o[i ? c : l == null ? void 0 : l.name] = h, u += g;
  }
  return [o, u];
}
function R6(e, { staticPosition: r }) {
  const n = Xt(e.readBytes(32)), i = r + n;
  e.setPosition(i);
  const o = Xt(e.readBytes(32));
  if (o === 0)
    return e.setPosition(r + 32), ["", 32];
  const u = e.readBytes(o, 32), c = d6(xr(u));
  return e.setPosition(r + 32), [c, 32];
}
function es(e) {
  var i;
  const { type: r } = e;
  if (r === "string" || r === "bytes" || r.endsWith("[]"))
    return !0;
  if (r === "tuple")
    return (i = e.components) == null ? void 0 : i.some(es);
  const n = vu(e.type);
  return !!(n && es({ ...e, type: n[1] }));
}
const C6 = {
  1: "An `assert` condition failed.",
  17: "Arithmetic operation resulted in underflow or overflow.",
  18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",
  33: "Attempted to convert to an invalid type.",
  34: "Attempted to access a storage byte array that is incorrectly encoded.",
  49: "Performed `.pop()` on an empty array",
  50: "Array index is out of bounds.",
  65: "Allocated too much memory or created an array which is too large.",
  81: "Attempted to call a zero-initialized variable of internal function type."
}, rd = {
  inputs: [
    {
      name: "message",
      type: "string"
    }
  ],
  name: "Error",
  type: "error"
}, _6 = {
  inputs: [
    {
      name: "reason",
      type: "uint256"
    }
  ],
  name: "Panic",
  type: "error"
}, D6 = (e) => zn(_i(e));
function N6(e) {
  return D6(e);
}
function O6(e) {
  let r = !0, n = "", i = 0, o = "", u = !1;
  for (let c = 0; c < e.length; c++) {
    const l = e[c];
    if (["(", ")", ","].includes(l) && (r = !0), l === "(" && i++, l === ")" && i--, !!r) {
      if (i === 0) {
        if (l === " " && ["event", "function", ""].includes(o))
          o = "";
        else if (o += l, l === ")") {
          u = !0;
          break;
        }
        continue;
      }
      if (l === " ") {
        e[c - 1] !== "," && n !== "," && n !== ",(" && (n = "", r = !1);
        continue;
      }
      o += l, n += l;
    }
  }
  if (!u)
    throw new U("Unable to normalize signature.");
  return o;
}
const L6 = (e) => {
  const r = typeof e == "string" ? e : R5(e);
  return O6(r);
};
function sd(e) {
  return N6(L6(e));
}
const ds = (e) => gr(sd(e), 0, 4);
function M6(e) {
  const { abi: r, data: n } = e, i = gr(n, 0, 4);
  if (i === "0x")
    throw new Ni();
  const u = [...r || [], rd, _6].find((c) => c.type === "error" && i === ds(vn(c)));
  if (!u)
    throw new Kl(i, {
      docsPath: "/docs/contract/decodeErrorResult"
    });
  return {
    abiItem: u,
    args: "inputs" in u && u.inputs && u.inputs.length > 0 ? Tu(u.inputs, gr(n, 4)) : void 0,
    errorName: u.name
  };
}
const F6 = sd;
function U6(e) {
  const { abi: r, data: n } = e, i = gr(n, 0, 4), o = r.find((u) => u.type === "function" && i === ds(vn(u)));
  if (!o)
    throw new t6(i, {
      docsPath: "/docs/contract/decodeFunctionData"
    });
  return {
    functionName: o.name,
    args: "inputs" in o && o.inputs && o.inputs.length > 0 ? Tu(o.inputs, gr(n, 4)) : void 0
  };
}
function hs(e) {
  const { abi: r, args: n = [], name: i } = e, o = Lt(i, { strict: !1 }), u = r.filter((l) => o ? l.type === "function" ? ds(l) === i : l.type === "event" ? F6(l) === i : !1 : "name" in l && l.name === i);
  if (u.length === 0)
    return;
  if (u.length === 1)
    return u[0];
  let c;
  for (const l of u) {
    if (!("inputs" in l))
      continue;
    if (!n || n.length === 0) {
      if (!l.inputs || l.inputs.length === 0)
        return l;
      continue;
    }
    if (!l.inputs || l.inputs.length === 0 || l.inputs.length !== n.length)
      continue;
    if (n.every((g, m) => {
      const y = "inputs" in l && l.inputs[m];
      return y ? Fa(g, y) : !1;
    })) {
      if (c && "inputs" in c && c.inputs) {
        const g = id(l.inputs, c.inputs, n);
        if (g)
          throw new n6({
            abiItem: l,
            type: g[0]
          }, {
            abiItem: c,
            type: g[1]
          });
      }
      c = l;
    }
  }
  return c || u[0];
}
function Fa(e, r) {
  const n = typeof e, i = r.type;
  switch (i) {
    case "address":
      return xn(e, { strict: !1 });
    case "bool":
      return n === "boolean";
    case "function":
      return n === "string";
    case "string":
      return n === "string";
    default:
      return i === "tuple" && "components" in r ? Object.values(r.components).every((o, u) => Fa(Object.values(e)[u], o)) : /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(i) ? n === "number" || n === "bigint" : /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(i) ? n === "string" || e instanceof Uint8Array : /[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(i) ? Array.isArray(e) && e.every((o) => Fa(o, {
        ...r,
        // Pop off `[]` or `[M]` from end of type
        type: i.replace(/(\[[0-9]{0,}\])$/, "")
      })) : !1;
  }
}
function id(e, r, n) {
  for (const i in e) {
    const o = e[i], u = r[i];
    if (o.type === "tuple" && u.type === "tuple" && "components" in o && "components" in u)
      return id(o.components, u.components, n[i]);
    const c = [o.type, u.type];
    if (c.includes("address") && c.includes("bytes20") ? !0 : c.includes("address") && c.includes("string") ? xn(n[i], { strict: !1 }) : c.includes("address") && c.includes("bytes") ? xn(n[i], { strict: !1 }) : !1)
      return c;
  }
}
const ba = "/docs/contract/decodeFunctionResult";
function Li(e) {
  const { abi: r, args: n, functionName: i, data: o } = e;
  let u = r[0];
  if (i) {
    const l = hs({ abi: r, args: n, name: i });
    if (!l)
      throw new pr(i, { docsPath: ba });
    u = l;
  }
  if (u.type !== "function")
    throw new pr(void 0, { docsPath: ba });
  if (!u.outputs)
    throw new Yl(u.name, { docsPath: ba });
  const c = Tu(u.outputs, o);
  if (c && c.length > 1)
    return c;
  if (c && c.length === 1)
    return c[0];
}
const Aa = "/docs/contract/encodeDeployData";
function od(e) {
  const { abi: r, args: n, bytecode: i } = e;
  if (!n || n.length === 0)
    return i;
  const o = r.find((c) => "type" in c && c.type === "constructor");
  if (!o)
    throw new qw({ docsPath: Aa });
  if (!("inputs" in o))
    throw new G0({ docsPath: Aa });
  if (!o.inputs || o.inputs.length === 0)
    throw new G0({ docsPath: Aa });
  const u = Oi(o.inputs, n);
  return ls([i, u]);
}
const ya = "/docs/contract/encodeErrorResult";
function $0(e) {
  const { abi: r, errorName: n, args: i } = e;
  let o = r[0];
  if (n) {
    const h = hs({ abi: r, args: i, name: n });
    if (!h)
      throw new H0(n, { docsPath: ya });
    o = h;
  }
  if (o.type !== "error")
    throw new H0(void 0, { docsPath: ya });
  const u = vn(o), c = ds(u);
  let l = "0x";
  if (i && i.length > 0) {
    if (!o.inputs)
      throw new e6(o.name, { docsPath: ya });
    l = Oi(o.inputs, i);
  }
  return ls([c, l]);
}
const W0 = "/docs/contract/encodeFunctionData";
function k6(e) {
  const { abi: r, args: n, functionName: i } = e;
  let o = r[0];
  if (i) {
    const u = hs({
      abi: r,
      args: n,
      name: i
    });
    if (!u)
      throw new pr(i, { docsPath: W0 });
    o = u;
  }
  if (o.type !== "function")
    throw new pr(void 0, { docsPath: W0 });
  return {
    abi: [o],
    functionName: ds(vn(o))
  };
}
function ps(e) {
  const { args: r } = e, { abi: n, functionName: i } = (() => {
    var l;
    return e.abi.length === 1 && ((l = e.functionName) != null && l.startsWith("0x")) ? e : k6(e);
  })(), o = n[0], u = i, c = "inputs" in o && o.inputs ? Oi(o.inputs, r ?? []) : void 0;
  return ls([u, c ?? "0x"]);
}
const wa = "/docs/contract/encodeFunctionResult";
function G6(e) {
  const { abi: r, functionName: n, result: i } = e;
  let o = r[0];
  if (n) {
    const c = hs({ abi: r, name: n });
    if (!c)
      throw new pr(n, { docsPath: wa });
    o = c;
  }
  if (o.type !== "function")
    throw new pr(void 0, { docsPath: wa });
  if (!o.outputs)
    throw new Yl(o.name, { docsPath: wa });
  const u = (() => {
    if (o.outputs.length === 0)
      return [];
    if (o.outputs.length === 1)
      return [i];
    if (Array.isArray(i))
      return i;
    throw new Xl(i);
  })();
  return Oi(o.outputs, u);
}
const rn = (e, r, n) => JSON.stringify(e, (i, o) => typeof o == "bigint" ? o.toString() : o, n);
function ad({ abiItem: e, args: r, includeFunctionName: n = !0, includeName: i = !1 }) {
  if ("name" in e && "inputs" in e && e.inputs)
    return `${n ? e.name : ""}(${e.inputs.map((o, u) => `${i && o.name ? `${o.name}: ` : ""}${typeof r[u] == "object" ? rn(r[u]) : r[u]}`).join(", ")})`;
}
function H6(e, r = "hex") {
  const n = ud(e), i = wu(new Uint8Array(n.length));
  return n.encode(i), r === "hex" ? Ge(i.bytes) : i.bytes;
}
function ud(e) {
  return Array.isArray(e) ? Q6(e.map((r) => ud(r))) : z6(e);
}
function Q6(e) {
  const r = e.reduce((o, u) => o + u.length, 0), n = cd(r);
  return {
    length: r <= 55 ? 1 + r : 1 + n + r,
    encode(o) {
      r <= 55 ? o.pushByte(192 + r) : (o.pushByte(247 + n), n === 1 ? o.pushUint8(r) : n === 2 ? o.pushUint16(r) : n === 3 ? o.pushUint24(r) : o.pushUint32(r));
      for (const { encode: u } of e)
        u(o);
    }
  };
}
function z6(e) {
  const r = typeof e == "string" ? tn(e) : e, n = cd(r.length);
  return {
    length: r.length === 1 && r[0] < 128 ? 1 : r.length <= 55 ? 1 + r.length : 1 + n + r.length,
    encode(o) {
      r.length === 1 && r[0] < 128 ? o.pushBytes(r) : r.length <= 55 ? (o.pushByte(128 + r.length), o.pushBytes(r)) : (o.pushByte(183 + n), n === 1 ? o.pushUint8(r.length) : n === 2 ? o.pushUint16(r.length) : n === 3 ? o.pushUint24(r.length) : o.pushUint32(r.length), o.pushBytes(r));
    }
  };
}
function cd(e) {
  if (e < 2 ** 8)
    return 1;
  if (e < 2 ** 16)
    return 2;
  if (e < 2 ** 24)
    return 3;
  if (e < 2 ** 32)
    return 4;
  throw new U("Length is too large.");
}
function $6(e) {
  const { chainId: r, nonce: n, to: i } = e, o = e.contractAddress ?? e.address, u = zn(ls([
    "0x05",
    H6([
      r ? te(r) : "0x",
      o,
      n ? te(n) : "0x"
    ])
  ]));
  return i === "bytes" ? tn(u) : u;
}
async function W6({ hash: e, signature: r }) {
  const n = Lt(e) ? e : gi(e), { secp256k1: i } = await import("./secp256k1-CoDNEG-O.js");
  return `0x${(() => {
    if (typeof r == "object" && "r" in r && "s" in r) {
      const { r: g, s: m, v: y, yParity: w } = r, x = Number(w ?? y), I = V0(x);
      return new i.Signature(Zt(g), Zt(m)).addRecoveryBit(I);
    }
    const c = Lt(r) ? r : gi(r);
    if (Be(c) !== 65)
      throw new Error("invalid signature length");
    const l = en(`0x${c.slice(130)}`), h = V0(l);
    return i.Signature.fromCompact(c.substring(2, 130)).addRecoveryBit(h);
  })().recoverPublicKey(n.substring(2)).toHex(!1)}`;
}
function V0(e) {
  if (e === 0 || e === 1)
    return e;
  if (e === 27)
    return 0;
  if (e === 28)
    return 1;
  throw new Error("Invalid yParityOrV value");
}
async function V6({ hash: e, signature: r }) {
  return jw(await W6({ hash: e, signature: r }));
}
async function fd(e) {
  const { authorization: r, signature: n } = e;
  return V6({
    hash: $6(r),
    signature: n ?? r
  });
}
const j6 = {
  gwei: 9,
  wei: 18
}, J6 = {
  ether: -9,
  wei: 9
};
function ld(e, r) {
  let n = e.toString();
  const i = n.startsWith("-");
  i && (n = n.slice(1)), n = n.padStart(r, "0");
  let [o, u] = [
    n.slice(0, n.length - r),
    n.slice(n.length - r)
  ];
  return u = u.replace(/(0+)$/, ""), `${i ? "-" : ""}${o || "0"}${u ? `.${u}` : ""}`;
}
function Pu(e, r = "wei") {
  return ld(e, j6[r]);
}
function Xe(e, r = "wei") {
  return ld(e, J6[r]);
}
function gs(e) {
  const r = Object.entries(e).map(([i, o]) => o === void 0 || o === !1 ? null : [i, o]).filter(Boolean), n = r.reduce((i, [o]) => Math.max(i, o.length), 0);
  return r.map(([i, o]) => `  ${`${i}:`.padEnd(n + 1)}  ${o}`).join(`
`);
}
class q6 extends U {
  constructor() {
    super([
      "Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.",
      "Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."
    ].join(`
`), { name: "FeeConflictError" });
  }
}
class K6 extends U {
  constructor({ transaction: r }) {
    super("Cannot infer a transaction type from provided transaction.", {
      metaMessages: [
        "Provided Transaction:",
        "{",
        gs(r),
        "}",
        "",
        "To infer the type, either provide:",
        "- a `type` to the Transaction, or",
        "- an EIP-1559 Transaction with `maxFeePerGas`, or",
        "- an EIP-2930 Transaction with `gasPrice` & `accessList`, or",
        "- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or",
        "- an EIP-7702 Transaction with `authorizationList`, or",
        "- a Legacy Transaction with `gasPrice`"
      ],
      name: "InvalidSerializableTransactionError"
    });
  }
}
class Y6 extends U {
  constructor(r, { account: n, docsPath: i, chain: o, data: u, gas: c, gasPrice: l, maxFeePerGas: h, maxPriorityFeePerGas: g, nonce: m, to: y, value: w }) {
    var I;
    const x = gs({
      chain: o && `${o == null ? void 0 : o.name} (id: ${o == null ? void 0 : o.id})`,
      from: n == null ? void 0 : n.address,
      to: y,
      value: typeof w < "u" && `${Pu(w)} ${((I = o == null ? void 0 : o.nativeCurrency) == null ? void 0 : I.symbol) || "ETH"}`,
      data: u,
      gas: c,
      gasPrice: typeof l < "u" && `${Xe(l)} gwei`,
      maxFeePerGas: typeof h < "u" && `${Xe(h)} gwei`,
      maxPriorityFeePerGas: typeof g < "u" && `${Xe(g)} gwei`,
      nonce: m
    });
    super(r.shortMessage, {
      cause: r,
      docsPath: i,
      metaMessages: [
        ...r.metaMessages ? [...r.metaMessages, " "] : [],
        "Request Arguments:",
        x
      ].filter(Boolean),
      name: "TransactionExecutionError"
    }), Object.defineProperty(this, "cause", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.cause = r;
  }
}
class dd extends U {
  constructor({ blockHash: r, blockNumber: n, blockTag: i, hash: o, index: u }) {
    let c = "Transaction";
    i && u !== void 0 && (c = `Transaction at block time "${i}" at index "${u}"`), r && u !== void 0 && (c = `Transaction at block hash "${r}" at index "${u}"`), n && u !== void 0 && (c = `Transaction at block number "${n}" at index "${u}"`), o && (c = `Transaction with hash "${o}"`), super(`${c} could not be found.`, {
      name: "TransactionNotFoundError"
    });
  }
}
class hd extends U {
  constructor({ hash: r }) {
    super(`Transaction receipt with hash "${r}" could not be found. The Transaction may not be processed on a block yet.`, {
      name: "TransactionReceiptNotFoundError"
    });
  }
}
class X6 extends U {
  constructor({ hash: r }) {
    super(`Timed out while waiting for transaction with hash "${r}" to be confirmed.`, { name: "WaitForTransactionReceiptTimeoutError" });
  }
}
function pd(e) {
  const { kzg: r } = e, n = e.to ?? (typeof e.blobs[0] == "string" ? "hex" : "bytes"), i = typeof e.blobs[0] == "string" ? e.blobs.map((u) => tn(u)) : e.blobs, o = [];
  for (const u of i)
    o.push(Uint8Array.from(r.blobToKzgCommitment(u)));
  return n === "bytes" ? o : o.map((u) => Ge(u));
}
function gd(e) {
  const { kzg: r } = e, n = e.to ?? (typeof e.blobs[0] == "string" ? "hex" : "bytes"), i = typeof e.blobs[0] == "string" ? e.blobs.map((c) => tn(c)) : e.blobs, o = typeof e.commitments[0] == "string" ? e.commitments.map((c) => tn(c)) : e.commitments, u = [];
  for (let c = 0; c < i.length; c++) {
    const l = i[c], h = o[c];
    u.push(Uint8Array.from(r.computeBlobKzgProof(l, h)));
  }
  return n === "bytes" ? u : u.map((c) => Ge(c));
}
function Z6(e, r, n, i) {
  if (typeof e.setBigUint64 == "function")
    return e.setBigUint64(r, n, i);
  const o = BigInt(32), u = BigInt(4294967295), c = Number(n >> o & u), l = Number(n & u), h = i ? 4 : 0, g = i ? 0 : 4;
  e.setUint32(r + h, c, i), e.setUint32(r + g, l, i);
}
function e2(e, r, n) {
  return e & r ^ ~e & n;
}
function t2(e, r, n) {
  return e & r ^ e & n ^ r & n;
}
class n2 extends $l {
  constructor(r, n, i, o) {
    super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = r, this.outputLen = n, this.padOffset = i, this.isLE = o, this.buffer = new Uint8Array(r), this.view = pa(this.buffer);
  }
  update(r) {
    bi(this), r = mu(r), hr(r);
    const { view: n, buffer: i, blockLen: o } = this, u = r.length;
    for (let c = 0; c < u; ) {
      const l = Math.min(o - this.pos, u - c);
      if (l === o) {
        const h = pa(r);
        for (; o <= u - c; c += o)
          this.process(h, c);
        continue;
      }
      i.set(r.subarray(c, c + l), this.pos), this.pos += l, c += l, this.pos === o && (this.process(n, 0), this.pos = 0);
    }
    return this.length += r.length, this.roundClean(), this;
  }
  digestInto(r) {
    bi(this), zl(r, this), this.finished = !0;
    const { buffer: n, view: i, blockLen: o, isLE: u } = this;
    let { pos: c } = this;
    n[c++] = 128, Zr(this.buffer.subarray(c)), this.padOffset > o - c && (this.process(i, 0), c = 0);
    for (let y = c; y < o; y++)
      n[y] = 0;
    Z6(i, o - 8, BigInt(this.length * 8), u), this.process(i, 0);
    const l = pa(r), h = this.outputLen;
    if (h % 4)
      throw new Error("_sha2: outputLen should be aligned to 32bit");
    const g = h / 4, m = this.get();
    if (g > m.length)
      throw new Error("_sha2: outputLen bigger than state");
    for (let y = 0; y < g; y++)
      l.setUint32(4 * y, m[y], u);
  }
  digest() {
    const { buffer: r, outputLen: n } = this;
    this.digestInto(r);
    const i = r.slice(0, n);
    return this.destroy(), i;
  }
  _cloneInto(r) {
    r || (r = new this.constructor()), r.set(...this.get());
    const { blockLen: n, buffer: i, length: o, finished: u, destroyed: c, pos: l } = this;
    return r.destroyed = c, r.finished = u, r.length = o, r.pos = l, o % n && r.buffer.set(i), r;
  }
  clone() {
    return this._cloneInto();
  }
}
const bn = /* @__PURE__ */ Uint32Array.from([
  1779033703,
  3144134277,
  1013904242,
  2773480762,
  1359893119,
  2600822924,
  528734635,
  1541459225
]), r2 = /* @__PURE__ */ Uint32Array.from([
  1116352408,
  1899447441,
  3049323471,
  3921009573,
  961987163,
  1508970993,
  2453635748,
  2870763221,
  3624381080,
  310598401,
  607225278,
  1426881987,
  1925078388,
  2162078206,
  2614888103,
  3248222580,
  3835390401,
  4022224774,
  264347078,
  604807628,
  770255983,
  1249150122,
  1555081692,
  1996064986,
  2554220882,
  2821834349,
  2952996808,
  3210313671,
  3336571891,
  3584528711,
  113926993,
  338241895,
  666307205,
  773529912,
  1294757372,
  1396182291,
  1695183700,
  1986661051,
  2177026350,
  2456956037,
  2730485921,
  2820302411,
  3259730800,
  3345764771,
  3516065817,
  3600352804,
  4094571909,
  275423344,
  430227734,
  506948616,
  659060556,
  883997877,
  958139571,
  1322822218,
  1537002063,
  1747873779,
  1955562222,
  2024104815,
  2227730452,
  2361852424,
  2428436474,
  2756734187,
  3204031479,
  3329325298
]), An = /* @__PURE__ */ new Uint32Array(64);
class s2 extends n2 {
  constructor(r = 32) {
    super(64, r, 8, !1), this.A = bn[0] | 0, this.B = bn[1] | 0, this.C = bn[2] | 0, this.D = bn[3] | 0, this.E = bn[4] | 0, this.F = bn[5] | 0, this.G = bn[6] | 0, this.H = bn[7] | 0;
  }
  get() {
    const { A: r, B: n, C: i, D: o, E: u, F: c, G: l, H: h } = this;
    return [r, n, i, o, u, c, l, h];
  }
  // prettier-ignore
  set(r, n, i, o, u, c, l, h) {
    this.A = r | 0, this.B = n | 0, this.C = i | 0, this.D = o | 0, this.E = u | 0, this.F = c | 0, this.G = l | 0, this.H = h | 0;
  }
  process(r, n) {
    for (let y = 0; y < 16; y++, n += 4)
      An[y] = r.getUint32(n, !1);
    for (let y = 16; y < 64; y++) {
      const w = An[y - 15], x = An[y - 2], I = Dt(w, 7) ^ Dt(w, 18) ^ w >>> 3, R = Dt(x, 17) ^ Dt(x, 19) ^ x >>> 10;
      An[y] = R + An[y - 7] + I + An[y - 16] | 0;
    }
    let { A: i, B: o, C: u, D: c, E: l, F: h, G: g, H: m } = this;
    for (let y = 0; y < 64; y++) {
      const w = Dt(l, 6) ^ Dt(l, 11) ^ Dt(l, 25), x = m + w + e2(l, h, g) + r2[y] + An[y] | 0, R = (Dt(i, 2) ^ Dt(i, 13) ^ Dt(i, 22)) + t2(i, o, u) | 0;
      m = g, g = h, h = l, l = c + x | 0, c = u, u = o, o = i, i = x + R | 0;
    }
    i = i + this.A | 0, o = o + this.B | 0, u = u + this.C | 0, c = c + this.D | 0, l = l + this.E | 0, h = h + this.F | 0, g = g + this.G | 0, m = m + this.H | 0, this.set(i, o, u, c, l, h, g, m);
  }
  roundClean() {
    Zr(An);
  }
  destroy() {
    this.set(0, 0, 0, 0, 0, 0, 0, 0), Zr(this.buffer);
  }
}
const i2 = /* @__PURE__ */ Wl(() => new s2()), o2 = i2;
function a2(e, r) {
  return o2(Lt(e, { strict: !1 }) ? _i(e) : e);
}
function u2(e) {
  const { commitment: r, version: n = 1 } = e, i = e.to ?? (typeof r == "string" ? "hex" : "bytes"), o = a2(r);
  return o.set([n], 0), i === "bytes" ? o : Ge(o);
}
function c2(e) {
  const { commitments: r, version: n } = e, i = e.to, o = [];
  for (const u of r)
    o.push(u2({
      commitment: u,
      to: i,
      version: n
    }));
  return o;
}
const j0 = 6, md = 32, Iu = 4096, bd = md * Iu, J0 = bd * j0 - // terminator byte (0x80).
1 - // zero byte (0x00) appended to each field element.
1 * Iu * j0;
class f2 extends U {
  constructor({ maxSize: r, size: n }) {
    super("Blob size is too large.", {
      metaMessages: [`Max: ${r} bytes`, `Given: ${n} bytes`],
      name: "BlobSizeTooLargeError"
    });
  }
}
class l2 extends U {
  constructor() {
    super("Blob data must not be empty.", { name: "EmptyBlobError" });
  }
}
function d2(e) {
  const r = typeof e.data == "string" ? tn(e.data) : e.data, n = Be(r);
  if (!n)
    throw new l2();
  if (n > J0)
    throw new f2({
      maxSize: J0,
      size: n
    });
  const i = [];
  let o = !0, u = 0;
  for (; o; ) {
    const c = wu(new Uint8Array(bd));
    let l = 0;
    for (; l < Iu; ) {
      const h = r.slice(u, u + (md - 1));
      if (c.pushByte(0), c.pushBytes(h), h.length < 31) {
        c.pushByte(128), o = !1;
        break;
      }
      l++, u += 31;
    }
    i.push(c);
  }
  return i.map((c) => Ge(c.bytes));
}
function h2(e) {
  const { data: r, kzg: n, to: i } = e, o = e.blobs ?? d2({ data: r }), u = e.commitments ?? pd({ blobs: o, kzg: n, to: i }), c = e.proofs ?? gd({ blobs: o, commitments: u, kzg: n, to: i }), l = [];
  for (let h = 0; h < o.length; h++)
    l.push({
      blob: o[h],
      commitment: u[h],
      proof: c[h]
    });
  return l;
}
const p2 = 2n ** 256n - 1n;
class Ua extends U {
  constructor({ blockNumber: r, chain: n, contract: i }) {
    super(`Chain "${n.name}" does not support contract "${i.name}".`, {
      metaMessages: [
        "This could be due to any of the following:",
        ...r && i.blockCreated && i.blockCreated > r ? [
          `- The contract "${i.name}" was not deployed until block ${i.blockCreated} (current block ${r}).`
        ] : [
          `- The chain does not have the contract "${i.name}" configured.`
        ]
      ],
      name: "ChainDoesNotSupportContract"
    });
  }
}
class g2 extends U {
  constructor({ chain: r, currentChainId: n }) {
    super(`The current chain of the wallet (id: ${n}) does not match the target chain for the transaction (id: ${r.id} – ${r.name}).`, {
      metaMessages: [
        `Current Chain ID:  ${n}`,
        `Expected Chain ID: ${r.id} – ${r.name}`
      ],
      name: "ChainMismatchError"
    });
  }
}
class m2 extends U {
  constructor() {
    super([
      "No chain was provided to the request.",
      "Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."
    ].join(`
`), {
      name: "ChainNotFoundError"
    });
  }
}
class Ad extends U {
  constructor() {
    super("No chain was provided to the Client.", {
      name: "ClientChainNotConfiguredError"
    });
  }
}
class cr extends U {
  constructor({ cause: r, message: n } = {}) {
    var o;
    const i = (o = n == null ? void 0 : n.replace("execution reverted: ", "")) == null ? void 0 : o.replace("execution reverted", "");
    super(`Execution reverted ${i ? `with reason: ${i}` : "for an unknown reason"}.`, {
      cause: r,
      name: "ExecutionRevertedError"
    });
  }
}
Object.defineProperty(cr, "code", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: 3
});
Object.defineProperty(cr, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /execution reverted/
});
class Ai extends U {
  constructor({ cause: r, maxFeePerGas: n } = {}) {
    super(`The fee cap (\`maxFeePerGas\`${n ? ` = ${Xe(n)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, {
      cause: r,
      name: "FeeCapTooHighError"
    });
  }
}
Object.defineProperty(Ai, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/
});
class ka extends U {
  constructor({ cause: r, maxFeePerGas: n } = {}) {
    super(`The fee cap (\`maxFeePerGas\`${n ? ` = ${Xe(n)}` : ""} gwei) cannot be lower than the block base fee.`, {
      cause: r,
      name: "FeeCapTooLowError"
    });
  }
}
Object.defineProperty(ka, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/
});
class Ga extends U {
  constructor({ cause: r, nonce: n } = {}) {
    super(`Nonce provided for the transaction ${n ? `(${n}) ` : ""}is higher than the next one expected.`, { cause: r, name: "NonceTooHighError" });
  }
}
Object.defineProperty(Ga, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /nonce too high/
});
class Ha extends U {
  constructor({ cause: r, nonce: n } = {}) {
    super([
      `Nonce provided for the transaction ${n ? `(${n}) ` : ""}is lower than the current nonce of the account.`,
      "Try increasing the nonce or find the latest nonce with `getTransactionCount`."
    ].join(`
`), { cause: r, name: "NonceTooLowError" });
  }
}
Object.defineProperty(Ha, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /nonce too low|transaction already imported|already known/
});
class Qa extends U {
  constructor({ cause: r, nonce: n } = {}) {
    super(`Nonce provided for the transaction ${n ? `(${n}) ` : ""}exceeds the maximum allowed nonce.`, { cause: r, name: "NonceMaxValueError" });
  }
}
Object.defineProperty(Qa, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /nonce has max value/
});
class za extends U {
  constructor({ cause: r } = {}) {
    super([
      "The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."
    ].join(`
`), {
      cause: r,
      metaMessages: [
        "This error could arise when the account does not have enough funds to:",
        " - pay for the total gas fee,",
        " - pay for the value to send.",
        " ",
        "The cost of the transaction is calculated as `gas * gas fee + value`, where:",
        " - `gas` is the amount of gas needed for transaction to execute,",
        " - `gas fee` is the gas fee,",
        " - `value` is the amount of ether to send to the recipient."
      ],
      name: "InsufficientFundsError"
    });
  }
}
Object.defineProperty(za, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /insufficient funds|exceeds transaction sender account balance/
});
class $a extends U {
  constructor({ cause: r, gas: n } = {}) {
    super(`The amount of gas ${n ? `(${n}) ` : ""}provided for the transaction exceeds the limit allowed for the block.`, {
      cause: r,
      name: "IntrinsicGasTooHighError"
    });
  }
}
Object.defineProperty($a, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /intrinsic gas too high|gas limit reached/
});
class Wa extends U {
  constructor({ cause: r, gas: n } = {}) {
    super(`The amount of gas ${n ? `(${n}) ` : ""}provided for the transaction is too low.`, {
      cause: r,
      name: "IntrinsicGasTooLowError"
    });
  }
}
Object.defineProperty(Wa, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /intrinsic gas too low/
});
class Va extends U {
  constructor({ cause: r }) {
    super("The transaction type is not supported for this chain.", {
      cause: r,
      name: "TransactionTypeNotSupportedError"
    });
  }
}
Object.defineProperty(Va, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /transaction type not valid/
});
class yi extends U {
  constructor({ cause: r, maxPriorityFeePerGas: n, maxFeePerGas: i } = {}) {
    super([
      `The provided tip (\`maxPriorityFeePerGas\`${n ? ` = ${Xe(n)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${i ? ` = ${Xe(i)} gwei` : ""}).`
    ].join(`
`), {
      cause: r,
      name: "TipAboveFeeCapError"
    });
  }
}
Object.defineProperty(yi, "nodeMessage", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/
});
class Mi extends U {
  constructor({ cause: r }) {
    super(`An error occurred while executing: ${r == null ? void 0 : r.shortMessage}`, {
      cause: r,
      name: "UnknownNodeError"
    });
  }
}
function b2(e) {
  if (e.type)
    return e.type;
  if (typeof e.authorizationList < "u")
    return "eip7702";
  if (typeof e.blobs < "u" || typeof e.blobVersionedHashes < "u" || typeof e.maxFeePerBlobGas < "u" || typeof e.sidecars < "u")
    return "eip4844";
  if (typeof e.maxFeePerGas < "u" || typeof e.maxPriorityFeePerGas < "u")
    return "eip1559";
  if (typeof e.gasPrice < "u")
    return typeof e.accessList < "u" ? "eip2930" : "legacy";
  throw new K6({ transaction: e });
}
const A2 = (e) => e, yd = (e) => e;
class u3 extends U {
  constructor({ body: r, cause: n, details: i, headers: o, status: u, url: c }) {
    super("HTTP request failed.", {
      cause: n,
      details: i,
      metaMessages: [
        u && `Status: ${u}`,
        `URL: ${yd(c)}`,
        r && `Request body: ${rn(r)}`
      ].filter(Boolean),
      name: "HttpRequestError"
    }), Object.defineProperty(this, "body", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "headers", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "status", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "url", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.body = r, this.headers = o, this.status = u, this.url = c;
  }
}
class wd extends U {
  constructor({ body: r, error: n, url: i }) {
    super("RPC Request failed.", {
      cause: n,
      details: n.message,
      metaMessages: [`URL: ${yd(i)}`, `Request body: ${rn(r)}`],
      name: "RpcRequestError"
    }), Object.defineProperty(this, "code", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "data", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.code = n.code, this.data = n.data;
  }
}
const y2 = -1;
class Ed extends U {
  constructor(r, { code: n, docsPath: i, metaMessages: o, name: u, shortMessage: c }) {
    super(c, {
      cause: r,
      docsPath: i,
      metaMessages: o || (r == null ? void 0 : r.metaMessages),
      name: u || "RpcError"
    }), Object.defineProperty(this, "code", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.name = u || r.name, this.code = r instanceof wd ? r.code : n ?? y2;
  }
}
class xd extends Ed {
  constructor(r, n) {
    super(r, n), Object.defineProperty(this, "data", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.data = n.data;
  }
}
class Fi extends Ed {
  constructor(r) {
    super(r, {
      code: Fi.code,
      name: "InternalRpcError",
      shortMessage: "An internal error was received."
    });
  }
}
Object.defineProperty(Fi, "code", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: -32603
});
class Ui extends xd {
  constructor(r) {
    super(r, {
      code: Ui.code,
      name: "UnsupportedNonOptionalCapabilityError",
      shortMessage: "This Wallet does not support a capability that was not marked as optional."
    });
  }
}
Object.defineProperty(Ui, "code", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: 5700
});
class ki extends xd {
  constructor(r) {
    super(r, {
      code: ki.code,
      name: "AtomicityNotSupportedError",
      shortMessage: "The wallet does not support atomic execution but the request requires it."
    });
  }
}
Object.defineProperty(ki, "code", {
  enumerable: !0,
  configurable: !0,
  writable: !0,
  value: 5760
});
async function ja(e) {
  return new Promise((r) => setTimeout(r, e));
}
function Ja(e, { delay: r = 100, retryCount: n = 2, shouldRetry: i = () => !0 } = {}) {
  return new Promise((o, u) => {
    const c = async ({ count: l = 0 } = {}) => {
      const h = async ({ error: g }) => {
        const m = typeof r == "function" ? r({ count: l, error: g }) : r;
        m && await ja(m), c({ count: l + 1 });
      };
      try {
        const g = await e();
        o(g);
      } catch (g) {
        if (l < n && await i({ count: l, error: g }))
          return h({ error: g });
        u(g);
      }
    };
    c();
  });
}
const w2 = "0.1.1";
function E2() {
  return w2;
}
let vd = class qa extends Error {
  constructor(r, n = {}) {
    const i = (() => {
      var h;
      if (n.cause instanceof qa) {
        if (n.cause.details)
          return n.cause.details;
        if (n.cause.shortMessage)
          return n.cause.shortMessage;
      }
      return n.cause && "details" in n.cause && typeof n.cause.details == "string" ? n.cause.details : (h = n.cause) != null && h.message ? n.cause.message : n.details;
    })(), o = n.cause instanceof qa && n.cause.docsPath || n.docsPath, c = `https://oxlib.sh${o ?? ""}`, l = [
      r || "An error occurred.",
      ...n.metaMessages ? ["", ...n.metaMessages] : [],
      ...i || o ? [
        "",
        i ? `Details: ${i}` : void 0,
        o ? `See: ${c}` : void 0
      ] : []
    ].filter((h) => typeof h == "string").join(`
`);
    super(l, n.cause ? { cause: n.cause } : void 0), Object.defineProperty(this, "details", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "docs", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "docsPath", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "shortMessage", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "cause", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "BaseError"
    }), Object.defineProperty(this, "version", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: `ox@${E2()}`
    }), this.cause = n.cause, this.details = i, this.docs = c, this.docsPath = o, this.shortMessage = r;
  }
  walk(r) {
    return Td(this, r);
  }
};
function Td(e, r) {
  return r != null && r(e) ? e : e && typeof e == "object" && "cause" in e && e.cause ? Td(e.cause, r) : r ? null : e;
}
function x2(e, r = {}) {
  const { dir: n, size: i = 32 } = r;
  if (i === 0)
    return e;
  const o = e.replace("0x", "");
  if (o.length > i * 2)
    throw new P2({
      size: Math.ceil(o.length / 2),
      targetSize: i,
      type: "Hex"
    });
  return `0x${o[n === "right" ? "padEnd" : "padStart"](i * 2, "0")}`;
}
function Yt(e, r = {}) {
  const { signed: n, size: i } = r, o = BigInt(e);
  let u;
  i ? n ? u = (1n << BigInt(i) * 8n - 1n) - 1n : u = 2n ** (BigInt(i) * 8n) - 1n : typeof e == "number" && (u = BigInt(Number.MAX_SAFE_INTEGER));
  const c = typeof u == "bigint" && n ? -u - 1n : 0;
  if (u && o > u || o < c) {
    const g = typeof e == "bigint" ? "n" : "";
    throw new T2({
      max: u ? `${u}${g}` : void 0,
      min: `${c}${g}`,
      signed: n,
      size: i,
      value: `${e}${g}`
    });
  }
  const h = `0x${(n && o < 0 ? (1n << BigInt(i * 8)) + BigInt(o) : o).toString(16)}`;
  return i ? v2(h, i) : h;
}
function v2(e, r) {
  return x2(e, { dir: "left", size: r });
}
class T2 extends vd {
  constructor({ max: r, min: n, signed: i, size: o, value: u }) {
    super(`Number \`${u}\` is not in safe${o ? ` ${o * 8}-bit` : ""}${i ? " signed" : " unsigned"} integer range ${r ? `(\`${n}\` to \`${r}\`)` : `(above \`${n}\`)`}`), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "Hex.IntegerOutOfRangeError"
    });
  }
}
class P2 extends vd {
  constructor({ size: r, targetSize: n, type: i }) {
    super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} size (\`${r}\`) exceeds padding size (\`${n}\`).`), Object.defineProperty(this, "name", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: "Hex.SizeExceedsPaddingSizeError"
    });
  }
}
function I2(e) {
  return {
    address: e.address,
    amount: Yt(e.amount),
    index: Yt(e.index),
    validatorIndex: Yt(e.validatorIndex)
  };
}
function S2(e) {
  return {
    ...typeof e.baseFeePerGas == "bigint" && {
      baseFeePerGas: Yt(e.baseFeePerGas)
    },
    ...typeof e.blobBaseFee == "bigint" && {
      blobBaseFee: Yt(e.blobBaseFee)
    },
    ...typeof e.feeRecipient == "string" && {
      feeRecipient: e.feeRecipient
    },
    ...typeof e.gasLimit == "bigint" && {
      gasLimit: Yt(e.gasLimit)
    },
    ...typeof e.number == "bigint" && {
      number: Yt(e.number)
    },
    ...typeof e.prevRandao == "bigint" && {
      prevRandao: Yt(e.prevRandao)
    },
    ...typeof e.time == "bigint" && {
      time: Yt(e.time)
    },
    ...e.withdrawals && {
      withdrawals: e.withdrawals.map(I2)
    }
  };
}
const Ka = [
  {
    inputs: [
      {
        components: [
          {
            name: "target",
            type: "address"
          },
          {
            name: "allowFailure",
            type: "bool"
          },
          {
            name: "callData",
            type: "bytes"
          }
        ],
        name: "calls",
        type: "tuple[]"
      }
    ],
    name: "aggregate3",
    outputs: [
      {
        components: [
          {
            name: "success",
            type: "bool"
          },
          {
            name: "returnData",
            type: "bytes"
          }
        ],
        name: "returnData",
        type: "tuple[]"
      }
    ],
    stateMutability: "view",
    type: "function"
  },
  {
    inputs: [],
    name: "getCurrentBlockTimestamp",
    outputs: [
      {
        internalType: "uint256",
        name: "timestamp",
        type: "uint256"
      }
    ],
    stateMutability: "view",
    type: "function"
  }
], Ya = [
  {
    name: "query",
    type: "function",
    stateMutability: "view",
    inputs: [
      {
        type: "tuple[]",
        name: "queries",
        components: [
          {
            type: "address",
            name: "sender"
          },
          {
            type: "string[]",
            name: "urls"
          },
          {
            type: "bytes",
            name: "data"
          }
        ]
      }
    ],
    outputs: [
      {
        type: "bool[]",
        name: "failures"
      },
      {
        type: "bytes[]",
        name: "responses"
      }
    ]
  },
  {
    name: "HttpError",
    type: "error",
    inputs: [
      {
        type: "uint16",
        name: "status"
      },
      {
        type: "string",
        name: "message"
      }
    ]
  }
], B2 = [
  {
    inputs: [
      {
        name: "dns",
        type: "bytes"
      }
    ],
    name: "DNSDecodingFailed",
    type: "error"
  },
  {
    inputs: [
      {
        name: "ens",
        type: "string"
      }
    ],
    name: "DNSEncodingFailed",
    type: "error"
  },
  {
    inputs: [],
    name: "EmptyAddress",
    type: "error"
  },
  {
    inputs: [
      {
        name: "status",
        type: "uint16"
      },
      {
        name: "message",
        type: "string"
      }
    ],
    name: "HttpError",
    type: "error"
  },
  {
    inputs: [],
    name: "InvalidBatchGatewayResponse",
    type: "error"
  },
  {
    inputs: [
      {
        name: "errorData",
        type: "bytes"
      }
    ],
    name: "ResolverError",
    type: "error"
  },
  {
    inputs: [
      {
        name: "name",
        type: "bytes"
      },
      {
        name: "resolver",
        type: "address"
      }
    ],
    name: "ResolverNotContract",
    type: "error"
  },
  {
    inputs: [
      {
        name: "name",
        type: "bytes"
      }
    ],
    name: "ResolverNotFound",
    type: "error"
  },
  {
    inputs: [
      {
        name: "primary",
        type: "string"
      },
      {
        name: "primaryAddress",
        type: "bytes"
      }
    ],
    name: "ReverseAddressMismatch",
    type: "error"
  },
  {
    inputs: [
      {
        internalType: "bytes4",
        name: "selector",
        type: "bytes4"
      }
    ],
    name: "UnsupportedResolverProfile",
    type: "error"
  }
], R2 = [
  ...B2,
  {
    name: "resolveWithGateways",
    type: "function",
    stateMutability: "view",
    inputs: [
      { name: "name", type: "bytes" },
      { name: "data", type: "bytes" },
      { name: "gateways", type: "string[]" }
    ],
    outputs: [
      { name: "", type: "bytes" },
      { name: "address", type: "address" }
    ]
  }
], q0 = [
  {
    name: "addr",
    type: "function",
    stateMutability: "view",
    inputs: [{ name: "name", type: "bytes32" }],
    outputs: [{ name: "", type: "address" }]
  },
  {
    name: "addr",
    type: "function",
    stateMutability: "view",
    inputs: [
      { name: "name", type: "bytes32" },
      { name: "coinType", type: "uint256" }
    ],
    outputs: [{ name: "", type: "bytes" }]
  }
], C2 = "0x82ad56cb", _2 = "0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe", D2 = "0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe", Pd = "0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033";
class N2 extends U {
  constructor({ address: r }) {
    super(`State for account "${r}" is set multiple times.`, {
      name: "AccountStateConflictError"
    });
  }
}
class O2 extends U {
  constructor() {
    super("state and stateDiff are set on the same account.", {
      name: "StateAssignmentConflictError"
    });
  }
}
function K0(e) {
  return e.reduce((r, { slot: n, value: i }) => `${r}        ${n}: ${i}
`, "");
}
function L2(e) {
  return e.reduce((r, { address: n, ...i }) => {
    let o = `${r}    ${n}:
`;
    return i.nonce && (o += `      nonce: ${i.nonce}
`), i.balance && (o += `      balance: ${i.balance}
`), i.code && (o += `      code: ${i.code}
`), i.state && (o += `      state:
`, o += K0(i.state)), i.stateDiff && (o += `      stateDiff:
`, o += K0(i.stateDiff)), o;
  }, `  State Override:
`).slice(0, -1);
}
class M2 extends U {
  constructor(r, { account: n, docsPath: i, chain: o, data: u, gas: c, gasPrice: l, maxFeePerGas: h, maxPriorityFeePerGas: g, nonce: m, to: y, value: w, stateOverride: x }) {
    var O;
    const I = n ? an(n) : void 0;
    let R = gs({
      from: I == null ? void 0 : I.address,
      to: y,
      value: typeof w < "u" && `${Pu(w)} ${((O = o == null ? void 0 : o.nativeCurrency) == null ? void 0 : O.symbol) || "ETH"}`,
      data: u,
      gas: c,
      gasPrice: typeof l < "u" && `${Xe(l)} gwei`,
      maxFeePerGas: typeof h < "u" && `${Xe(h)} gwei`,
      maxPriorityFeePerGas: typeof g < "u" && `${Xe(g)} gwei`,
      nonce: m
    });
    x && (R += `
${L2(x)}`), super(r.shortMessage, {
      cause: r,
      docsPath: i,
      metaMessages: [
        ...r.metaMessages ? [...r.metaMessages, " "] : [],
        "Raw Call Arguments:",
        R
      ].filter(Boolean),
      name: "CallExecutionError"
    }), Object.defineProperty(this, "cause", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.cause = r;
  }
}
class F2 extends U {
  constructor(r, { abi: n, args: i, contractAddress: o, docsPath: u, functionName: c, sender: l }) {
    const h = hs({ abi: n, args: i, name: c }), g = h ? ad({
      abiItem: h,
      args: i,
      includeFunctionName: !1,
      includeName: !1
    }) : void 0, m = h ? vn(h, { includeName: !0 }) : void 0, y = gs({
      address: o && A2(o),
      function: m,
      args: g && g !== "()" && `${[...Array((c == null ? void 0 : c.length) ?? 0).keys()].map(() => " ").join("")}${g}`,
      sender: l
    });
    super(r.shortMessage || `An unknown error occurred while executing the contract function "${c}".`, {
      cause: r,
      docsPath: u,
      metaMessages: [
        ...r.metaMessages ? [...r.metaMessages, " "] : [],
        y && "Contract Call:",
        y
      ].filter(Boolean),
      name: "ContractFunctionExecutionError"
    }), Object.defineProperty(this, "abi", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "args", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "cause", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "contractAddress", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "formattedArgs", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "functionName", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "sender", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.abi = n, this.args = i, this.cause = r, this.contractAddress = o, this.functionName = c, this.sender = l;
  }
}
class Xa extends U {
  constructor({ abi: r, data: n, functionName: i, message: o }) {
    let u, c, l, h;
    if (n && n !== "0x")
      try {
        c = M6({ abi: r, data: n });
        const { abiItem: m, errorName: y, args: w } = c;
        if (y === "Error")
          h = w[0];
        else if (y === "Panic") {
          const [x] = w;
          h = C6[x];
        } else {
          const x = m ? vn(m, { includeName: !0 }) : void 0, I = m && w ? ad({
            abiItem: m,
            args: w,
            includeFunctionName: !1,
            includeName: !1
          }) : void 0;
          l = [
            x ? `Error: ${x}` : "",
            I && I !== "()" ? `       ${[...Array((y == null ? void 0 : y.length) ?? 0).keys()].map(() => " ").join("")}${I}` : ""
          ];
        }
      } catch (m) {
        u = m;
      }
    else o && (h = o);
    let g;
    u instanceof Kl && (g = u.signature, l = [
      `Unable to decode signature "${g}" as it was not found on the provided ABI.`,
      "Make sure you are using the correct ABI and that the error exists on it.",
      `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${g}.`
    ]), super(h && h !== "execution reverted" || g ? [
      `The contract function "${i}" reverted with the following ${g ? "signature" : "reason"}:`,
      h || g
    ].join(`
`) : `The contract function "${i}" reverted.`, {
      cause: u,
      metaMessages: l,
      name: "ContractFunctionRevertedError"
    }), Object.defineProperty(this, "data", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "raw", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "reason", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), Object.defineProperty(this, "signature", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.data = c, this.raw = n, this.reason = h, this.signature = g;
  }
}
class U2 extends U {
  constructor({ functionName: r }) {
    super(`The contract function "${r}" returned no data ("0x").`, {
      metaMessages: [
        "This could be due to any of the following:",
        `  - The contract does not have the function "${r}",`,
        "  - The parameters passed to the contract function may be invalid, or",
        "  - The address is not a contract."
      ],
      name: "ContractFunctionZeroDataError"
    });
  }
}
class k2 extends U {
  constructor({ factory: r }) {
    super(`Deployment for counterfactual contract call failed${r ? ` for factory "${r}".` : ""}`, {
      metaMessages: [
        "Please ensure:",
        "- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).",
        "- The `factoryData` is a valid encoded function call for contract deployment function on the factory."
      ],
      name: "CounterfactualDeploymentFailedError"
    });
  }
}
class Su extends U {
  constructor({ data: r, message: n }) {
    super(n || "", { name: "RawContractError" }), Object.defineProperty(this, "code", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: 3
    }), Object.defineProperty(this, "data", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.data = r;
  }
}
function Bu({ blockNumber: e, chain: r, contract: n }) {
  var o;
  const i = (o = r == null ? void 0 : r.contracts) == null ? void 0 : o[n];
  if (!i)
    throw new Ua({
      chain: r,
      contract: { name: n }
    });
  if (e && i.blockCreated && i.blockCreated > e)
    throw new Ua({
      blockNumber: e,
      chain: r,
      contract: {
        name: n,
        blockCreated: i.blockCreated
      }
    });
  return i.address;
}
function Ru(e, r) {
  const n = (e.details || "").toLowerCase(), i = e instanceof U ? e.walk((o) => (o == null ? void 0 : o.code) === cr.code) : e;
  return i instanceof U ? new cr({
    cause: e,
    message: i.details
  }) : cr.nodeMessage.test(n) ? new cr({
    cause: e,
    message: e.details
  }) : Ai.nodeMessage.test(n) ? new Ai({
    cause: e,
    maxFeePerGas: r == null ? void 0 : r.maxFeePerGas
  }) : ka.nodeMessage.test(n) ? new ka({
    cause: e,
    maxFeePerGas: r == null ? void 0 : r.maxFeePerGas
  }) : Ga.nodeMessage.test(n) ? new Ga({ cause: e, nonce: r == null ? void 0 : r.nonce }) : Ha.nodeMessage.test(n) ? new Ha({ cause: e, nonce: r == null ? void 0 : r.nonce }) : Qa.nodeMessage.test(n) ? new Qa({ cause: e, nonce: r == null ? void 0 : r.nonce }) : za.nodeMessage.test(n) ? new za({ cause: e }) : $a.nodeMessage.test(n) ? new $a({ cause: e, gas: r == null ? void 0 : r.gas }) : Wa.nodeMessage.test(n) ? new Wa({ cause: e, gas: r == null ? void 0 : r.gas }) : Va.nodeMessage.test(n) ? new Va({ cause: e }) : yi.nodeMessage.test(n) ? new yi({
    cause: e,
    maxFeePerGas: r == null ? void 0 : r.maxFeePerGas,
    maxPriorityFeePerGas: r == null ? void 0 : r.maxPriorityFeePerGas
  }) : new Mi({
    cause: e
  });
}
function G2(e, { docsPath: r, ...n }) {
  const i = (() => {
    const o = Ru(e, n);
    return o instanceof Mi ? e : o;
  })();
  return new M2(i, {
    docsPath: r,
    ...n
  });
}
function Cu(e, { format: r }) {
  if (!r)
    return {};
  const n = {};
  function i(u) {
    const c = Object.keys(u);
    for (const l of c)
      l in e && (n[l] = e[l]), u[l] && typeof u[l] == "object" && !Array.isArray(u[l]) && i(u[l]);
  }
  const o = r(e || {});
  return i(o), n;
}
const H2 = {
  legacy: "0x0",
  eip2930: "0x1",
  eip1559: "0x2",
  eip4844: "0x3",
  eip7702: "0x4"
};
function _u(e, r) {
  const n = {};
  return typeof e.authorizationList < "u" && (n.authorizationList = Q2(e.authorizationList)), typeof e.accessList < "u" && (n.accessList = e.accessList), typeof e.blobVersionedHashes < "u" && (n.blobVersionedHashes = e.blobVersionedHashes), typeof e.blobs < "u" && (typeof e.blobs[0] != "string" ? n.blobs = e.blobs.map((i) => Ge(i)) : n.blobs = e.blobs), typeof e.data < "u" && (n.data = e.data), typeof e.from < "u" && (n.from = e.from), typeof e.gas < "u" && (n.gas = te(e.gas)), typeof e.gasPrice < "u" && (n.gasPrice = te(e.gasPrice)), typeof e.maxFeePerBlobGas < "u" && (n.maxFeePerBlobGas = te(e.maxFeePerBlobGas)), typeof e.maxFeePerGas < "u" && (n.maxFeePerGas = te(e.maxFeePerGas)), typeof e.maxPriorityFeePerGas < "u" && (n.maxPriorityFeePerGas = te(e.maxPriorityFeePerGas)), typeof e.nonce < "u" && (n.nonce = te(e.nonce)), typeof e.to < "u" && (n.to = e.to), typeof e.type < "u" && (n.type = H2[e.type]), typeof e.value < "u" && (n.value = te(e.value)), n;
}
function Q2(e) {
  return e.map((r) => ({
    address: r.address,
    r: r.r ? te(BigInt(r.r)) : r.r,
    s: r.s ? te(BigInt(r.s)) : r.s,
    chainId: te(r.chainId),
    nonce: te(r.nonce),
    ...typeof r.yParity < "u" ? { yParity: te(r.yParity) } : {},
    ...typeof r.v < "u" && typeof r.yParity > "u" ? { v: te(r.v) } : {}
  }));
}
function Du() {
  let e = () => {
  }, r = () => {
  };
  return { promise: new Promise((i, o) => {
    e = i, r = o;
  }), resolve: e, reject: r };
}
const Ea = /* @__PURE__ */ new Map();
function z2({ fn: e, id: r, shouldSplitBatch: n, wait: i = 0, sort: o }) {
  const u = async () => {
    const m = h();
    c();
    const y = m.map(({ args: w }) => w);
    y.length !== 0 && e(y).then((w) => {
      o && Array.isArray(w) && w.sort(o);
      for (let x = 0; x < m.length; x++) {
        const { resolve: I } = m[x];
        I == null || I([w[x], w]);
      }
    }).catch((w) => {
      for (let x = 0; x < m.length; x++) {
        const { reject: I } = m[x];
        I == null || I(w);
      }
    });
  }, c = () => Ea.delete(r), l = () => h().map(({ args: m }) => m), h = () => Ea.get(r) || [], g = (m) => Ea.set(r, [...h(), m]);
  return {
    flush: c,
    async schedule(m) {
      const { promise: y, resolve: w, reject: x } = Du();
      return (n == null ? void 0 : n([...l(), m])) && u(), h().length > 0 ? (g({ args: m, resolve: w, reject: x }), y) : (g({ args: m, resolve: w, reject: x }), setTimeout(u, i), y);
    }
  };
}
function Y0(e) {
  if (!(!e || e.length === 0))
    return e.reduce((r, { slot: n, value: i }) => {
      if (n.length !== 66)
        throw new O0({
          size: n.length,
          targetSize: 66,
          type: "hex"
        });
      if (i.length !== 66)
        throw new O0({
          size: i.length,
          targetSize: 66,
          type: "hex"
        });
      return r[n] = i, r;
    }, {});
}
function $2(e) {
  const { balance: r, nonce: n, state: i, stateDiff: o, code: u } = e, c = {};
  if (u !== void 0 && (c.code = u), r !== void 0 && (c.balance = te(r)), n !== void 0 && (c.nonce = te(n)), i !== void 0 && (c.state = Y0(i)), o !== void 0) {
    if (c.state)
      throw new O2();
    c.stateDiff = Y0(o);
  }
  return c;
}
function Id(e) {
  if (!e)
    return;
  const r = {};
  for (const { address: n, ...i } of e) {
    if (!xn(n, { strict: !1 }))
      throw new Xr({ address: n });
    if (r[n])
      throw new N2({ address: n });
    r[n] = $2(i);
  }
  return r;
}
function Gi(e) {
  const { account: r, gasPrice: n, maxFeePerGas: i, maxPriorityFeePerGas: o, to: u } = e, c = r ? an(r) : void 0;
  if (c && !xn(c.address))
    throw new Xr({ address: c.address });
  if (u && !xn(u))
    throw new Xr({ address: u });
  if (typeof n < "u" && (typeof i < "u" || typeof o < "u"))
    throw new q6();
  if (i && i > p2)
    throw new Ai({ maxFeePerGas: i });
  if (o && i && o > i)
    throw new yi({ maxFeePerGas: i, maxPriorityFeePerGas: o });
}
async function W2(e, r) {
  var fe, we, je, Le;
  const { account: n = e.account, authorizationList: i, batch: o = !!((fe = e.batch) != null && fe.multicall), blockNumber: u, blockTag: c = e.experimental_blockTag ?? "latest", accessList: l, blobs: h, blockOverrides: g, code: m, data: y, factory: w, factoryData: x, gas: I, gasPrice: R, maxFeePerBlobGas: O, maxFeePerGas: S, maxPriorityFeePerGas: G, nonce: Q, to: _, value: T, stateOverride: C, ...k } = r, F = n ? an(n) : void 0;
  if (m && (w || x))
    throw new U("Cannot provide both `code` & `factory`/`factoryData` as parameters.");
  if (m && _)
    throw new U("Cannot provide both `code` & `to` as parameters.");
  const $ = m && y, W = w && x && _ && y, ne = $ || W, ce = $ ? Sd({
    code: m,
    data: y
  }) : W ? J2({
    data: y,
    factory: w,
    factoryData: x,
    to: _
  }) : y;
  try {
    Gi(r);
    const xe = (typeof u == "bigint" ? te(u) : void 0) || c, bt = g ? S2(g) : void 0, at = Id(C), Ze = (Le = (je = (we = e.chain) == null ? void 0 : we.formatters) == null ? void 0 : je.transactionRequest) == null ? void 0 : Le.format, vr = (Ze || _u)({
      // Pick out extra data that might exist on the chain's transaction request type.
      ...Cu(k, { format: Ze }),
      from: F == null ? void 0 : F.address,
      accessList: l,
      authorizationList: i,
      blobs: h,
      data: ce,
      gas: I,
      gasPrice: R,
      maxFeePerBlobGas: O,
      maxFeePerGas: S,
      maxPriorityFeePerGas: G,
      nonce: Q,
      to: ne ? void 0 : _,
      value: T
    }, "call");
    if (o && V2({ request: vr }) && !at && !bt)
      try {
        return await j2(e, {
          ...vr,
          blockNumber: u,
          blockTag: c
        });
      } catch (et) {
        if (!(et instanceof Ad) && !(et instanceof Ua))
          throw et;
      }
    const $i = (() => {
      const et = [
        vr,
        xe
      ];
      return at && bt ? [...et, at, bt] : at ? [...et, at] : bt ? [...et, {}, bt] : et;
    })(), kt = await e.request({
      method: "eth_call",
      params: $i
    });
    return kt === "0x" ? { data: void 0 } : { data: kt };
  } catch (ze) {
    const xe = q2(ze), { offchainLookup: bt, offchainLookupSignature: at } = await import("./ccip-7k_P9n65.js");
    if (e.ccipRead !== !1 && (xe == null ? void 0 : xe.slice(0, 10)) === at && _)
      return { data: await bt(e, { data: xe, to: _ }) };
    throw ne && (xe == null ? void 0 : xe.slice(0, 10)) === "0x101bb98d" ? new k2({ factory: w }) : G2(ze, {
      ...r,
      account: F,
      chain: e.chain
    });
  }
}
function V2({ request: e }) {
  const { data: r, to: n, ...i } = e;
  return !(!r || r.startsWith(C2) || !n || Object.values(i).filter((o) => typeof o < "u").length > 0);
}
async function j2(e, r) {
  var R;
  const { batchSize: n = 1024, deployless: i = !1, wait: o = 0 } = typeof ((R = e.batch) == null ? void 0 : R.multicall) == "object" ? e.batch.multicall : {}, { blockNumber: u, blockTag: c = e.experimental_blockTag ?? "latest", data: l, to: h } = r, g = (() => {
    if (i)
      return null;
    if (r.multicallAddress)
      return r.multicallAddress;
    if (e.chain)
      return Bu({
        blockNumber: u,
        chain: e.chain,
        contract: "multicall3"
      });
    throw new Ad();
  })(), y = (typeof u == "bigint" ? te(u) : void 0) || c, { schedule: w } = z2({
    id: `${e.uid}.${y}`,
    wait: o,
    shouldSplitBatch(O) {
      return O.reduce((G, { data: Q }) => G + (Q.length - 2), 0) > n * 2;
    },
    fn: async (O) => {
      const S = O.map((_) => ({
        allowFailure: !0,
        callData: _.data,
        target: _.to
      })), G = ps({
        abi: Ka,
        args: [S],
        functionName: "aggregate3"
      }), Q = await e.request({
        method: "eth_call",
        params: [
          {
            ...g === null ? {
              data: Sd({
                code: Pd,
                data: G
              })
            } : { to: g, data: G }
          },
          y
        ]
      });
      return Li({
        abi: Ka,
        args: [S],
        functionName: "aggregate3",
        data: Q || "0x"
      });
    }
  }), [{ returnData: x, success: I }] = await w({ data: l, to: h });
  if (!I)
    throw new Su({ data: x });
  return x === "0x" ? { data: void 0 } : { data: x };
}
function Sd(e) {
  const { code: r, data: n } = e;
  return od({
    abi: Ll(["constructor(bytes, bytes)"]),
    bytecode: _2,
    args: [r, n]
  });
}
function J2(e) {
  const { data: r, factory: n, factoryData: i, to: o } = e;
  return od({
    abi: Ll(["constructor(address, bytes, address, bytes)"]),
    bytecode: D2,
    args: [o, r, n, i]
  });
}
function q2(e) {
  var n;
  if (!(e instanceof U))
    return;
  const r = e.walk();
  return typeof (r == null ? void 0 : r.data) == "object" ? (n = r.data) == null ? void 0 : n.data : r.data;
}
const Bd = "x-batch-gateway:true";
async function K2(e) {
  const { data: r, ccipRequest: n } = e, { args: [i] } = U6({ abi: Ya, data: r }), o = [], u = [];
  return await Promise.all(i.map(async (c, l) => {
    try {
      u[l] = c.urls.includes(Bd) ? await K2({ data: c.data, ccipRequest: n }) : await n(c), o[l] = !1;
    } catch (h) {
      o[l] = !0, u[l] = Y2(h);
    }
  })), G6({
    abi: Ya,
    functionName: "query",
    result: [o, u]
  });
}
function Y2(e) {
  return e.name === "HttpRequestError" && e.status ? $0({
    abi: Ya,
    errorName: "HttpError",
    args: [e.status, e.shortMessage]
  }) : $0({
    abi: [rd],
    errorName: "Error",
    args: ["shortMessage" in e ? e.shortMessage : e.message]
  });
}
function X2({ chain: e, currentChainId: r }) {
  if (!e)
    throw new m2();
  if (r !== e.id)
    throw new g2({ chain: e, currentChainId: r });
}
function Z2(e) {
  return {
    formatters: void 0,
    fees: void 0,
    serializers: void 0,
    ...e
  };
}
const eE = 3;
function Za(e, { abi: r, address: n, args: i, docsPath: o, functionName: u, sender: c }) {
  const l = e instanceof Su ? e : e instanceof U ? e.walk((I) => "data" in I) || e.walk() : {}, { code: h, data: g, details: m, message: y, shortMessage: w } = l, x = e instanceof Ni ? new U2({ functionName: u }) : [eE, Fi.code].includes(h) && (g || m || y || w) ? new Xa({
    abi: r,
    data: typeof g == "object" ? g.data : g,
    functionName: u,
    message: l instanceof wd ? m : w ?? y
  }) : e;
  return new F2(x, {
    abi: r,
    args: i,
    contractAddress: n,
    docsPath: o,
    functionName: u,
    sender: c
  });
}
class tE extends U {
  constructor(r, { account: n, docsPath: i, chain: o, data: u, gas: c, gasPrice: l, maxFeePerGas: h, maxPriorityFeePerGas: g, nonce: m, to: y, value: w }) {
    var I;
    const x = gs({
      from: n == null ? void 0 : n.address,
      to: y,
      value: typeof w < "u" && `${Pu(w)} ${((I = o == null ? void 0 : o.nativeCurrency) == null ? void 0 : I.symbol) || "ETH"}`,
      data: u,
      gas: c,
      gasPrice: typeof l < "u" && `${Xe(l)} gwei`,
      maxFeePerGas: typeof h < "u" && `${Xe(h)} gwei`,
      maxPriorityFeePerGas: typeof g < "u" && `${Xe(g)} gwei`,
      nonce: m
    });
    super(r.shortMessage, {
      cause: r,
      docsPath: i,
      metaMessages: [
        ...r.metaMessages ? [...r.metaMessages, " "] : [],
        "Estimate Gas Arguments:",
        x
      ].filter(Boolean),
      name: "EstimateGasExecutionError"
    }), Object.defineProperty(this, "cause", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.cause = r;
  }
}
function nE(e, { docsPath: r, ...n }) {
  const i = (() => {
    const o = Ru(e, n);
    return o instanceof Mi ? e : o;
  })();
  return new tE(i, {
    docsPath: r,
    ...n
  });
}
function Rd(e, { docsPath: r, ...n }) {
  const i = (() => {
    const o = Ru(e, n);
    return o instanceof Mi ? e : o;
  })();
  return new Y6(i, {
    docsPath: r,
    ...n
  });
}
const Cd = {
  "0x0": "legacy",
  "0x1": "eip2930",
  "0x2": "eip1559",
  "0x3": "eip4844",
  "0x4": "eip7702"
};
function _d(e, r) {
  const n = {
    ...e,
    blockHash: e.blockHash ? e.blockHash : null,
    blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
    chainId: e.chainId ? en(e.chainId) : void 0,
    gas: e.gas ? BigInt(e.gas) : void 0,
    gasPrice: e.gasPrice ? BigInt(e.gasPrice) : void 0,
    maxFeePerBlobGas: e.maxFeePerBlobGas ? BigInt(e.maxFeePerBlobGas) : void 0,
    maxFeePerGas: e.maxFeePerGas ? BigInt(e.maxFeePerGas) : void 0,
    maxPriorityFeePerGas: e.maxPriorityFeePerGas ? BigInt(e.maxPriorityFeePerGas) : void 0,
    nonce: e.nonce ? en(e.nonce) : void 0,
    to: e.to ? e.to : null,
    transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null,
    type: e.type ? Cd[e.type] : void 0,
    typeHex: e.type ? e.type : void 0,
    value: e.value ? BigInt(e.value) : void 0,
    v: e.v ? BigInt(e.v) : void 0
  };
  return e.authorizationList && (n.authorizationList = rE(e.authorizationList)), n.yParity = (() => {
    if (e.yParity)
      return Number(e.yParity);
    if (typeof n.v == "bigint") {
      if (n.v === 0n || n.v === 27n)
        return 0;
      if (n.v === 1n || n.v === 28n)
        return 1;
      if (n.v >= 35n)
        return n.v % 2n === 0n ? 1 : 0;
    }
  })(), n.type === "legacy" && (delete n.accessList, delete n.maxFeePerBlobGas, delete n.maxFeePerGas, delete n.maxPriorityFeePerGas, delete n.yParity), n.type === "eip2930" && (delete n.maxFeePerBlobGas, delete n.maxFeePerGas, delete n.maxPriorityFeePerGas), n.type === "eip1559" && delete n.maxFeePerBlobGas, n;
}
function rE(e) {
  return e.map((r) => ({
    address: r.address,
    chainId: Number(r.chainId),
    nonce: Number(r.nonce),
    r: r.r,
    s: r.s,
    yParity: Number(r.yParity)
  }));
}
function sE(e, r) {
  const n = (e.transactions ?? []).map((i) => typeof i == "string" ? i : _d(i));
  return {
    ...e,
    baseFeePerGas: e.baseFeePerGas ? BigInt(e.baseFeePerGas) : null,
    blobGasUsed: e.blobGasUsed ? BigInt(e.blobGasUsed) : void 0,
    difficulty: e.difficulty ? BigInt(e.difficulty) : void 0,
    excessBlobGas: e.excessBlobGas ? BigInt(e.excessBlobGas) : void 0,
    gasLimit: e.gasLimit ? BigInt(e.gasLimit) : void 0,
    gasUsed: e.gasUsed ? BigInt(e.gasUsed) : void 0,
    hash: e.hash ? e.hash : null,
    logsBloom: e.logsBloom ? e.logsBloom : null,
    nonce: e.nonce ? e.nonce : null,
    number: e.number ? BigInt(e.number) : null,
    size: e.size ? BigInt(e.size) : void 0,
    timestamp: e.timestamp ? BigInt(e.timestamp) : void 0,
    transactions: n,
    totalDifficulty: e.totalDifficulty ? BigInt(e.totalDifficulty) : null
  };
}
function iE(e, { args: r, eventName: n } = {}) {
  return {
    ...e,
    blockHash: e.blockHash ? e.blockHash : null,
    blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
    logIndex: e.logIndex ? Number(e.logIndex) : null,
    transactionHash: e.transactionHash ? e.transactionHash : null,
    transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null,
    ...n ? { args: r, eventName: n } : {}
  };
}
const Dd = {
  "0x0": "reverted",
  "0x1": "success"
};
function oE(e, r) {
  const n = {
    ...e,
    blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
    contractAddress: e.contractAddress ? e.contractAddress : null,
    cumulativeGasUsed: e.cumulativeGasUsed ? BigInt(e.cumulativeGasUsed) : null,
    effectiveGasPrice: e.effectiveGasPrice ? BigInt(e.effectiveGasPrice) : null,
    gasUsed: e.gasUsed ? BigInt(e.gasUsed) : null,
    logs: e.logs ? e.logs.map((i) => iE(i)) : null,
    to: e.to ? e.to : null,
    transactionIndex: e.transactionIndex ? en(e.transactionIndex) : null,
    status: e.status ? Dd[e.status] : null,
    type: e.type ? Cd[e.type] || e.type : null
  };
  return e.blobGasPrice && (n.blobGasPrice = BigInt(e.blobGasPrice)), e.blobGasUsed && (n.blobGasUsed = BigInt(e.blobGasUsed)), n;
}
function se(e, r, n) {
  const i = e[r.name];
  if (typeof i == "function")
    return i;
  const o = e[n];
  return typeof o == "function" ? o : (u) => r(e, u);
}
async function aE(e, { address: r, blockTag: n = "latest", blockNumber: i }) {
  const o = await e.request({
    method: "eth_getTransactionCount",
    params: [
      r,
      typeof i == "bigint" ? te(i) : n
    ]
  }, {
    dedupe: !!i
  });
  return en(o);
}
class uE extends U {
  constructor({ domain: r }) {
    super(`Invalid domain "${rn(r)}".`, {
      metaMessages: ["Must be a valid EIP-712 domain."]
    });
  }
}
class cE extends U {
  constructor({ primaryType: r, types: n }) {
    super(`Invalid primary type \`${r}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`, {
      docsPath: "/api/glossary/Errors#typeddatainvalidprimarytypeerror",
      metaMessages: ["Check that the primary type is a key in `types`."]
    });
  }
}
class fE extends U {
  constructor({ type: r }) {
    super(`Struct type "${r}" is invalid.`, {
      metaMessages: ["Struct type must not be a Solidity type."],
      name: "InvalidStructTypeError"
    });
  }
}
function lE(e) {
  const { domain: r, message: n, primaryType: i, types: o } = e, u = (h, g) => {
    const m = { ...g };
    for (const y of h) {
      const { name: w, type: x } = y;
      x === "address" && (m[w] = m[w].toLowerCase());
    }
    return m;
  }, c = o.EIP712Domain ? r ? u(o.EIP712Domain, r) : {} : {}, l = (() => {
    if (i !== "EIP712Domain")
      return u(o[i], n);
  })();
  return rn({ domain: c, message: l, primaryType: i, types: o });
}
function dE(e) {
  const { domain: r, message: n, primaryType: i, types: o } = e, u = (c, l) => {
    for (const h of c) {
      const { name: g, type: m } = h, y = l[g], w = m.match(nd);
      if (w && (typeof y == "number" || typeof y == "bigint")) {
        const [R, O, S] = w;
        te(y, {
          signed: O === "int",
          size: Number.parseInt(S, 10) / 8
        });
      }
      if (m === "address" && typeof y == "string" && !xn(y))
        throw new Xr({ address: y });
      const x = m.match(p6);
      if (x) {
        const [R, O] = x;
        if (O && Be(y) !== Number.parseInt(O, 10))
          throw new r6({
            expectedSize: Number.parseInt(O, 10),
            givenSize: Be(y)
          });
      }
      const I = o[m];
      I && (pE(m), u(I, y));
    }
  };
  if (o.EIP712Domain && r) {
    if (typeof r != "object")
      throw new uE({ domain: r });
    u(o.EIP712Domain, r);
  }
  if (i !== "EIP712Domain")
    if (o[i])
      u(o[i], n);
    else
      throw new cE({ primaryType: i, types: o });
}
function hE({ domain: e }) {
  return [
    typeof (e == null ? void 0 : e.name) == "string" && { name: "name", type: "string" },
    (e == null ? void 0 : e.version) && { name: "version", type: "string" },
    (typeof (e == null ? void 0 : e.chainId) == "number" || typeof (e == null ? void 0 : e.chainId) == "bigint") && {
      name: "chainId",
      type: "uint256"
    },
    (e == null ? void 0 : e.verifyingContract) && {
      name: "verifyingContract",
      type: "address"
    },
    (e == null ? void 0 : e.salt) && { name: "salt", type: "bytes32" }
  ].filter(Boolean);
}
function pE(e) {
  if (e === "address" || e === "bool" || e === "string" || e.startsWith("bytes") || e.startsWith("uint") || e.startsWith("int"))
    throw new fE({ type: e });
}
class Nd extends U {
  constructor({ docsPath: r } = {}) {
    super([
      "Could not find an Account to execute with this Action.",
      "Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."
    ].join(`
`), {
      docsPath: r,
      docsSlug: "account",
      name: "AccountNotFoundError"
    });
  }
}
class xa extends U {
  constructor({ docsPath: r, metaMessages: n, type: i }) {
    super(`Account type "${i}" is not supported.`, {
      docsPath: r,
      metaMessages: n,
      name: "AccountTypeNotSupportedError"
    });
  }
}
const gE = /* @__PURE__ */ Z2({
  id: 1,
  name: "Ethereum",
  nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
  blockTime: 12e3,
  rpcUrls: {
    default: {
      http: ["https://eth.merkle.io"]
    }
  },
  blockExplorers: {
    default: {
      name: "Etherscan",
      url: "https://etherscan.io",
      apiUrl: "https://api.etherscan.io/api"
    }
  },
  contracts: {
    ensUniversalResolver: {
      address: "0xeeeeeeee14d718c2b47d9923deab1335e144eeee",
      blockCreated: 23085558
    },
    multicall3: {
      address: "0xca11bde05977b3631167028862be2a173976ca11",
      blockCreated: 14353601
    }
  }
}), mE = async (e) => {
  const r = (await ye.getRPCUrls())[e];
  if (!(r != null && r.length))
    throw new Error(`RPC URL not found for chainId: ${e}`);
  return r;
}, Od = {
  [_e.ETH]: "0x578853aa776Eef10CeE6c4dd2B5862bdcE767A8B",
  [_e.POL]: "0x91EDd8708062bd4233f4Dd0FCE15A7cb4d500091"
}, bE = (e) => Od[e], X0 = [
  {
    constant: !0,
    inputs: [
      {
        internalType: "string[]",
        name: "keys",
        type: "string[]"
      },
      {
        internalType: "uint256",
        name: "tokenId",
        type: "uint256"
      }
    ],
    name: "getData",
    outputs: [
      {
        internalType: "address",
        name: "resolver",
        type: "address"
      },
      {
        internalType: "address",
        name: "owner",
        type: "address"
      },
      {
        internalType: "string[]",
        name: "values",
        type: "string[]"
      }
    ],
    payable: !1,
    stateMutability: "view",
    type: "function"
  },
  {
    inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }],
    name: "exists",
    outputs: [{ internalType: "bool", name: "", type: "bool" }],
    stateMutability: "view",
    type: "function"
  }
], AE = {
  [Se.EVM]: "ETH",
  [Se.MVM]: "SUI",
  [Se.SVM]: "SOL",
  [Se.UTXO]: "BTC",
  [Se.TVM]: "TRON"
}, yE = {
  [_e.ETH]: "ETH",
  [_e.BTC]: "BTC",
  [_e.SUI]: "SUI",
  [_e.SOL]: "SOL",
  [_e.BAS]: "BASE",
  [_e.POL]: "MATIC",
  [_e.ARB]: "ARB1",
  [_e.AVA]: "AVAX"
}, wE = {
  [Se.EVM]: "EVM",
  [Se.UTXO]: "BTC",
  [Se.SVM]: "SOL",
  [Se.MVM]: "SUI",
  [Se.TVM]: "TRON"
}, ui = {}, $n = async (e) => {
  var c;
  if (ui[e])
    return ui[e];
  const n = (await mE(e)).map((l) => l.startsWith("wss") ? E5(l) : x5(l, {
    batch: {
      batchSize: 64
    }
  })), i = await ye.getChainById(e), o = {
    ...i,
    ...i.metamask,
    name: i.metamask.chainName,
    rpcUrls: {
      default: { http: i.metamask.rpcUrls },
      public: { http: i.metamask.rpcUrls }
    }
  };
  if (o.id === _e.ETH && (o.contracts = {
    ...gE.contracts,
    ...o.contracts
  }), o.id === _e.ETH || o.id === _e.POL) {
    const l = Od[o.id];
    o.contracts = {
      ...o.contracts,
      unsProxyReader: { address: l }
    };
  }
  const u = ye.getProvider(Se.EVM);
  return ui[e] = v5({
    chain: o,
    transport: T5(n, (c = u == null ? void 0 : u.options) == null ? void 0 : c.fallbackTransportConfig),
    batch: {
      multicall: !0
    }
  }), ui[e];
}, Mt = async (e, r, n, i) => {
  var o, u;
  try {
    return await se(e, r, n)(i);
  } catch (c) {
    if (!((o = e.account) != null && o.address))
      throw c;
    const l = (u = e.chain) == null ? void 0 : u.id;
    if (!l)
      throw c;
    const h = await $n(l);
    return await se(h, r, n)(i);
  }
};
function EE(e) {
  var n, i, o, u, c, l;
  if (!(e instanceof U))
    return !1;
  const r = e.walk((h) => h instanceof Xa);
  return r instanceof Xa ? ((n = r.data) == null ? void 0 : n.errorName) === "HttpError" || ((i = r.data) == null ? void 0 : i.errorName) === "ResolverError" || ((o = r.data) == null ? void 0 : o.errorName) === "ResolverNotContract" || ((u = r.data) == null ? void 0 : u.errorName) === "ResolverNotFound" || ((c = r.data) == null ? void 0 : c.errorName) === "ReverseAddressMismatch" || ((l = r.data) == null ? void 0 : l.errorName) === "UnsupportedResolverProfile" : !1;
}
function Ld(e) {
  if (e.length !== 66 || e.indexOf("[") !== 0 || e.indexOf("]") !== 65)
    return null;
  const r = `0x${e.slice(1, 65)}`;
  return Lt(r) ? r : null;
}
function eu(e) {
  let r = new Uint8Array(32).fill(0);
  if (!e)
    return Ge(r);
  const n = e.split(".");
  for (let i = n.length - 1; i >= 0; i -= 1) {
    const o = Ld(n[i]), u = o ? _i(o) : zn(Gn(n[i]), "bytes");
    r = zn(nn([r, u]), "bytes");
  }
  return Ge(r);
}
function xE(e) {
  return `[${e.slice(2)}]`;
}
function vE(e) {
  const r = new Uint8Array(32).fill(0);
  return e ? Ld(e) || zn(Gn(e)) : Ge(r);
}
function TE(e) {
  const r = e.replace(/^\.|\.$/gm, "");
  if (r.length === 0)
    return new Uint8Array(1);
  const n = new Uint8Array(Gn(r).byteLength + 2);
  let i = 0;
  const o = r.split(".");
  for (let u = 0; u < o.length; u++) {
    let c = Gn(o[u]);
    c.byteLength > 255 && (c = Gn(xE(vE(o[u])))), n[i] = c.length, n.set(c, i + 1), i += c.length + 1;
  }
  return n.byteLength !== i + 1 ? n.slice(0, i + 1) : n;
}
async function Tn(e, r) {
  const { abi: n, address: i, args: o, functionName: u, ...c } = r, l = ps({
    abi: n,
    args: o,
    functionName: u
  });
  try {
    const { data: h } = await se(e, W2, "call")({
      ...c,
      data: l,
      to: i
    });
    return Li({
      abi: n,
      args: o,
      functionName: u,
      data: h || "0x"
    });
  } catch (h) {
    throw Za(h, {
      abi: n,
      address: i,
      args: o,
      docsPath: "/docs/contract/readContract",
      functionName: u
    });
  }
}
async function PE(e, r) {
  const { blockNumber: n, blockTag: i, coinType: o, name: u, gatewayUrls: c, strict: l } = r, { chain: h } = e, g = (() => {
    if (r.universalResolverAddress)
      return r.universalResolverAddress;
    if (!h)
      throw new Error("client chain not configured. universalResolverAddress is required.");
    return Bu({
      blockNumber: n,
      chain: h,
      contract: "ensUniversalResolver"
    });
  })(), m = h == null ? void 0 : h.ensTlds;
  if (m && !m.some((w) => u.endsWith(w)))
    return null;
  const y = o != null ? [eu(u), BigInt(o)] : [eu(u)];
  try {
    const w = ps({
      abi: q0,
      functionName: "addr",
      args: y
    }), x = {
      address: g,
      abi: R2,
      functionName: "resolveWithGateways",
      args: [
        gi(TE(u)),
        w,
        c ?? [Bd]
      ],
      blockNumber: n,
      blockTag: i
    }, R = await se(e, Tn, "readContract")(x);
    if (R[0] === "0x")
      return null;
    const O = Li({
      abi: q0,
      args: y,
      functionName: "addr",
      data: R[0]
    });
    return O === "0x" || xr(O) === "0x00" ? null : O;
  } catch (w) {
    if (l)
      throw w;
    if (EE(w))
      return null;
    throw w;
  }
}
class IE extends U {
  constructor() {
    super("`baseFeeMultiplier` must be greater than 1.", {
      name: "BaseFeeScalarError"
    });
  }
}
class Nu extends U {
  constructor() {
    super("Chain does not support EIP-1559 fees.", {
      name: "Eip1559FeesNotSupportedError"
    });
  }
}
class SE extends U {
  constructor({ maxPriorityFeePerGas: r }) {
    super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Xe(r)} gwei).`, { name: "MaxFeePerGasTooLowError" });
  }
}
class Md extends U {
  constructor({ blockHash: r, blockNumber: n }) {
    let i = "Block";
    r && (i = `Block at hash "${r}"`), n && (i = `Block at number "${n}"`), super(`${i} could not be found.`, { name: "BlockNotFoundError" });
  }
}
async function mr(e, { blockHash: r, blockNumber: n, blockTag: i = e.experimental_blockTag ?? "latest", includeTransactions: o } = {}) {
  var g, m, y;
  const u = o ?? !1, c = n !== void 0 ? te(n) : void 0;
  let l = null;
  if (r ? l = await e.request({
    method: "eth_getBlockByHash",
    params: [r, u]
  }, { dedupe: !0 }) : l = await e.request({
    method: "eth_getBlockByNumber",
    params: [c || i, u]
  }, { dedupe: !!c }), !l)
    throw new Md({ blockHash: r, blockNumber: n });
  return (((y = (m = (g = e.chain) == null ? void 0 : g.formatters) == null ? void 0 : m.block) == null ? void 0 : y.format) || sE)(l, "getBlock");
}
async function Fd(e) {
  const r = await e.request({
    method: "eth_gasPrice"
  });
  return BigInt(r);
}
async function BE(e, r) {
  var u, c;
  const { block: n, chain: i = e.chain, request: o } = r || {};
  try {
    const l = ((u = i == null ? void 0 : i.fees) == null ? void 0 : u.maxPriorityFeePerGas) ?? ((c = i == null ? void 0 : i.fees) == null ? void 0 : c.defaultPriorityFee);
    if (typeof l == "function") {
      const g = n || await se(e, mr, "getBlock")({}), m = await l({
        block: g,
        client: e,
        request: o
      });
      if (m === null)
        throw new Error();
      return m;
    }
    if (typeof l < "u")
      return l;
    const h = await e.request({
      method: "eth_maxPriorityFeePerGas"
    });
    return Zt(h);
  } catch {
    const [l, h] = await Promise.all([
      n ? Promise.resolve(n) : se(e, mr, "getBlock")({}),
      se(e, Fd, "getGasPrice")({})
    ]);
    if (typeof l.baseFeePerGas != "bigint")
      throw new Nu();
    const g = h - l.baseFeePerGas;
    return g < 0n ? 0n : g;
  }
}
async function Z0(e, r) {
  var w, x;
  const { block: n, chain: i = e.chain, request: o, type: u = "eip1559" } = r || {}, c = await (async () => {
    var I, R;
    return typeof ((I = i == null ? void 0 : i.fees) == null ? void 0 : I.baseFeeMultiplier) == "function" ? i.fees.baseFeeMultiplier({
      block: n,
      client: e,
      request: o
    }) : ((R = i == null ? void 0 : i.fees) == null ? void 0 : R.baseFeeMultiplier) ?? 1.2;
  })();
  if (c < 1)
    throw new IE();
  const h = 10 ** (((w = c.toString().split(".")[1]) == null ? void 0 : w.length) ?? 0), g = (I) => I * BigInt(Math.ceil(c * h)) / BigInt(h), m = n || await se(e, mr, "getBlock")({});
  if (typeof ((x = i == null ? void 0 : i.fees) == null ? void 0 : x.estimateFeesPerGas) == "function") {
    const I = await i.fees.estimateFeesPerGas({
      block: n,
      client: e,
      multiply: g,
      request: o,
      type: u
    });
    if (I !== null)
      return I;
  }
  if (u === "eip1559") {
    if (typeof m.baseFeePerGas != "bigint")
      throw new Nu();
    const I = typeof (o == null ? void 0 : o.maxPriorityFeePerGas) == "bigint" ? o.maxPriorityFeePerGas : await BE(e, {
      block: m,
      chain: i,
      request: o
    }), R = g(m.baseFeePerGas);
    return {
      maxFeePerGas: (o == null ? void 0 : o.maxFeePerGas) ?? R + I,
      maxPriorityFeePerGas: I
    };
  }
  return {
    gasPrice: (o == null ? void 0 : o.gasPrice) ?? g(await se(e, Fd, "getGasPrice")({}))
  };
}
async function wi(e) {
  const r = await e.request({
    method: "eth_chainId"
  }, { dedupe: !0 });
  return en(r);
}
const Ud = [
  "blobVersionedHashes",
  "chainId",
  "fees",
  "gas",
  "nonce",
  "type"
], el = /* @__PURE__ */ new Map();
async function kd(e, r) {
  const { account: n = e.account, blobs: i, chain: o, gas: u, kzg: c, nonce: l, nonceManager: h, parameters: g = Ud, type: m } = r, y = n && an(n), w = { ...r, ...y ? { from: y == null ? void 0 : y.address } : {} };
  let x;
  async function I() {
    return x || (x = await se(e, mr, "getBlock")({ blockTag: "latest" }), x);
  }
  let R;
  async function O() {
    return R || (o ? o.id : typeof r.chainId < "u" ? r.chainId : (R = await se(e, wi, "getChainId")({}), R));
  }
  if (g.includes("nonce") && typeof l > "u" && y)
    if (h) {
      const S = await O();
      w.nonce = await h.consume({
        address: y.address,
        chainId: S,
        client: e
      });
    } else
      w.nonce = await se(e, aE, "getTransactionCount")({
        address: y.address,
        blockTag: "pending"
      });
  if ((g.includes("blobVersionedHashes") || g.includes("sidecars")) && i && c) {
    const S = pd({ blobs: i, kzg: c });
    if (g.includes("blobVersionedHashes")) {
      const G = c2({
        commitments: S,
        to: "hex"
      });
      w.blobVersionedHashes = G;
    }
    if (g.includes("sidecars")) {
      const G = gd({ blobs: i, commitments: S, kzg: c }), Q = h2({
        blobs: i,
        commitments: S,
        proofs: G,
        to: "hex"
      });
      w.sidecars = Q;
    }
  }
  if (g.includes("chainId") && (w.chainId = await O()), (g.includes("fees") || g.includes("type")) && typeof m > "u")
    try {
      w.type = b2(w);
    } catch {
      let S = el.get(e.uid);
      if (typeof S > "u") {
        const G = await I();
        S = typeof (G == null ? void 0 : G.baseFeePerGas) == "bigint", el.set(e.uid, S);
      }
      w.type = S ? "eip1559" : "legacy";
    }
  if (g.includes("fees"))
    if (w.type !== "legacy" && w.type !== "eip2930") {
      if (typeof w.maxFeePerGas > "u" || typeof w.maxPriorityFeePerGas > "u") {
        const S = await I(), { maxFeePerGas: G, maxPriorityFeePerGas: Q } = await Z0(e, {
          block: S,
          chain: o,
          request: w
        });
        if (typeof r.maxPriorityFeePerGas > "u" && r.maxFeePerGas && r.maxFeePerGas < Q)
          throw new SE({
            maxPriorityFeePerGas: Q
          });
        w.maxPriorityFeePerGas = Q, w.maxFeePerGas = G;
      }
    } else {
      if (typeof r.maxFeePerGas < "u" || typeof r.maxPriorityFeePerGas < "u")
        throw new Nu();
      if (typeof r.gasPrice > "u") {
        const S = await I(), { gasPrice: G } = await Z0(e, {
          block: S,
          chain: o,
          request: w,
          type: "legacy"
        });
        w.gasPrice = G;
      }
    }
  return g.includes("gas") && typeof u > "u" && (w.gas = await se(e, Gd, "estimateGas")({
    ...w,
    account: y && { address: y.address, type: "json-rpc" }
  })), Gi(w), delete w.parameters, w;
}
async function Gd(e, r) {
  var o, u, c;
  const { account: n = e.account } = r, i = n ? an(n) : void 0;
  try {
    const { accessList: l, authorizationList: h, blobs: g, blobVersionedHashes: m, blockNumber: y, blockTag: w, data: x, gas: I, gasPrice: R, maxFeePerBlobGas: O, maxFeePerGas: S, maxPriorityFeePerGas: G, nonce: Q, value: _, stateOverride: T, ...C } = await kd(e, {
      ...r,
      parameters: (
        // Some RPC Providers do not compute versioned hashes from blobs. We will need
        // to compute them.
        (i == null ? void 0 : i.type) === "local" ? void 0 : ["blobVersionedHashes"]
      )
    }), F = (typeof y == "bigint" ? te(y) : void 0) || w, $ = Id(T), W = await (async () => {
      if (C.to)
        return C.to;
      if (h && h.length > 0)
        return await fd({
          authorization: h[0]
        }).catch(() => {
          throw new U("`to` is required. Could not infer from `authorizationList`");
        });
    })();
    Gi(r);
    const ne = (c = (u = (o = e.chain) == null ? void 0 : o.formatters) == null ? void 0 : u.transactionRequest) == null ? void 0 : c.format, fe = (ne || _u)({
      // Pick out extra data that might exist on the chain's transaction request type.
      ...Cu(C, { format: ne }),
      from: i == null ? void 0 : i.address,
      accessList: l,
      authorizationList: h,
      blobs: g,
      blobVersionedHashes: m,
      data: x,
      gas: I,
      gasPrice: R,
      maxFeePerBlobGas: O,
      maxFeePerGas: S,
      maxPriorityFeePerGas: G,
      nonce: Q,
      to: W,
      value: _
    }, "estimateGas");
    return BigInt(await e.request({
      method: "eth_estimateGas",
      params: $ ? [
        fe,
        F ?? e.experimental_blockTag ?? "latest",
        $
      ] : F ? [fe, F] : [fe]
    }));
  } catch (l) {
    throw nE(l, {
      ...r,
      account: i,
      chain: e.chain
    });
  }
}
async function RE(e, { address: r, blockNumber: n, blockTag: i = e.experimental_blockTag ?? "latest" }) {
  const o = typeof n == "bigint" ? te(n) : void 0, u = await e.request({
    method: "eth_getBalance",
    params: [r, o || i]
  });
  return BigInt(u);
}
const CE = /* @__PURE__ */ new Map(), _E = /* @__PURE__ */ new Map();
function DE(e) {
  const r = (o, u) => ({
    clear: () => u.delete(o),
    get: () => u.get(o),
    set: (c) => u.set(o, c)
  }), n = r(e, CE), i = r(e, _E);
  return {
    clear: () => {
      n.clear(), i.clear();
    },
    promise: n,
    response: i
  };
}
async function NE(e, { cacheKey: r, cacheTime: n = Number.POSITIVE_INFINITY }) {
  const i = DE(r), o = i.response.get();
  if (o && n > 0 && Date.now() - o.created.getTime() < n)
    return o.data;
  let u = i.promise.get();
  u || (u = e(), i.promise.set(u));
  try {
    const c = await u;
    return i.response.set({ created: /* @__PURE__ */ new Date(), data: c }), c;
  } finally {
    i.promise.clear();
  }
}
const OE = (e) => `blockNumber.${e}`;
async function Ou(e, { cacheTime: r = e.cacheTime } = {}) {
  const n = await NE(() => e.request({
    method: "eth_blockNumber"
  }), { cacheKey: OE(e.uid), cacheTime: r });
  return BigInt(n);
}
async function LE(e, { address: r, blockNumber: n, blockTag: i = "latest" }) {
  const o = n !== void 0 ? te(n) : void 0, u = await e.request({
    method: "eth_getCode",
    params: [r, o || i]
  }, { dedupe: !!o });
  if (u !== "0x")
    return u;
}
async function ME(e, { blockHash: r, blockNumber: n, blockTag: i, hash: o, index: u }) {
  var m, y, w;
  const c = i || "latest", l = n !== void 0 ? te(n) : void 0;
  let h = null;
  if (o ? h = await e.request({
    method: "eth_getTransactionByHash",
    params: [o]
  }, { dedupe: !0 }) : r ? h = await e.request({
    method: "eth_getTransactionByBlockHashAndIndex",
    params: [r, te(u)]
  }, { dedupe: !0 }) : h = await e.request({
    method: "eth_getTransactionByBlockNumberAndIndex",
    params: [l || c, te(u)]
  }, { dedupe: !!l }), !h)
    throw new dd({
      blockHash: r,
      blockNumber: n,
      blockTag: c,
      hash: o,
      index: u
    });
  return (((w = (y = (m = e.chain) == null ? void 0 : m.formatters) == null ? void 0 : y.transaction) == null ? void 0 : w.format) || _d)(h, "getTransaction");
}
async function va(e, { hash: r }) {
  var o, u, c;
  const n = await e.request({
    method: "eth_getTransactionReceipt",
    params: [r]
  }, { dedupe: !0 });
  if (!n)
    throw new hd({ hash: r });
  return (((c = (u = (o = e.chain) == null ? void 0 : o.formatters) == null ? void 0 : u.transactionReceipt) == null ? void 0 : c.format) || oE)(n, "getTransactionReceipt");
}
async function Lu(e, r) {
  var G;
  const { account: n, authorizationList: i, allowFailure: o = !0, blockNumber: u, blockOverrides: c, blockTag: l, stateOverride: h } = r, g = r.contracts, { batchSize: m = r.batchSize ?? 1024, deployless: y = r.deployless ?? !1 } = typeof ((G = e.batch) == null ? void 0 : G.multicall) == "object" ? e.batch.multicall : {}, w = (() => {
    if (r.multicallAddress)
      return r.multicallAddress;
    if (y)
      return null;
    if (e.chain)
      return Bu({
        blockNumber: u,
        chain: e.chain,
        contract: "multicall3"
      });
    throw new Error("client chain not configured. multicallAddress is required.");
  })(), x = [[]];
  let I = 0, R = 0;
  for (let Q = 0; Q < g.length; Q++) {
    const { abi: _, address: T, args: C, functionName: k } = g[Q];
    try {
      const F = ps({ abi: _, args: C, functionName: k });
      R += (F.length - 2) / 2, // Check if batching is enabled.
      m > 0 && // Check if the current size of the batch exceeds the size limit.
      R > m && // Check if the current chunk is not already empty.
      x[I].length > 0 && (I++, R = (F.length - 2) / 2, x[I] = []), x[I] = [
        ...x[I],
        {
          allowFailure: !0,
          callData: F,
          target: T
        }
      ];
    } catch (F) {
      const $ = Za(F, {
        abi: _,
        address: T,
        args: C,
        docsPath: "/docs/contract/multicall",
        functionName: k,
        sender: n
      });
      if (!o)
        throw $;
      x[I] = [
        ...x[I],
        {
          allowFailure: !0,
          callData: "0x",
          target: T
        }
      ];
    }
  }
  const O = await Promise.allSettled(x.map((Q) => se(e, Tn, "readContract")({
    ...w === null ? { code: Pd } : { address: w },
    abi: Ka,
    account: n,
    args: [Q],
    authorizationList: i,
    blockNumber: u,
    blockOverrides: c,
    blockTag: l,
    functionName: "aggregate3",
    stateOverride: h
  }))), S = [];
  for (let Q = 0; Q < O.length; Q++) {
    const _ = O[Q];
    if (_.status === "rejected") {
      if (!o)
        throw _.reason;
      for (let C = 0; C < x[Q].length; C++)
        S.push({
          status: "failure",
          error: _.reason,
          result: void 0
        });
      continue;
    }
    const T = _.value;
    for (let C = 0; C < T.length; C++) {
      const { returnData: k, success: F } = T[C], { callData: $ } = x[Q][C], { abi: W, address: ne, functionName: ce, args: fe } = g[S.length];
      try {
        if ($ === "0x")
          throw new Ni();
        if (!F)
          throw new Su({ data: k });
        const we = Li({
          abi: W,
          args: fe,
          data: k,
          functionName: ce
        });
        S.push(o ? { result: we, status: "success" } : we);
      } catch (we) {
        const je = Za(we, {
          abi: W,
          address: ne,
          args: fe,
          docsPath: "/docs/contract/multicall",
          functionName: ce
        });
        if (!o)
          throw je;
        S.push({ error: je, result: void 0, status: "failure" });
      }
    }
  }
  if (S.length !== g.length)
    throw new U("multicall results mismatch");
  return S;
}
const Ta = /* @__PURE__ */ new Map(), tl = /* @__PURE__ */ new Map();
let FE = 0;
function Ei(e, r, n) {
  const i = ++FE, o = () => Ta.get(e) || [], u = () => {
    const m = o();
    Ta.set(e, m.filter((y) => y.id !== i));
  }, c = () => {
    const m = o();
    if (!m.some((w) => w.id === i))
      return;
    const y = tl.get(e);
    if (m.length === 1 && y) {
      const w = y();
      w instanceof Promise && w.catch(() => {
      });
    }
    u();
  }, l = o();
  if (Ta.set(e, [
    ...l,
    { id: i, fns: r }
  ]), l && l.length > 0)
    return c;
  const h = {};
  for (const m in r)
    h[m] = ((...y) => {
      var x, I;
      const w = o();
      if (w.length !== 0)
        for (const R of w)
          (I = (x = R.fns)[m]) == null || I.call(x, ...y);
    });
  const g = n(h);
  return typeof g == "function" && tl.set(e, g), c;
}
function Hd(e, { emitOnBegin: r, initialWaitTime: n, interval: i }) {
  let o = !0;
  const u = () => o = !1;
  return (async () => {
    let l;
    r && (l = await e({ unpoll: u }));
    const h = await (n == null ? void 0 : n(l)) ?? i;
    await ja(h);
    const g = async () => {
      o && (await e({ unpoll: u }), await ja(i), g());
    };
    g();
  })(), u;
}
function UE(e, { emitOnBegin: r = !1, emitMissed: n = !1, onBlockNumber: i, onError: o, poll: u, pollingInterval: c = e.pollingInterval }) {
  const l = typeof u < "u" ? u : !(e.transport.type === "webSocket" || e.transport.type === "ipc" || e.transport.type === "fallback" && (e.transport.transports[0].config.type === "webSocket" || e.transport.transports[0].config.type === "ipc"));
  let h;
  return l ? (() => {
    const y = rn([
      "watchBlockNumber",
      e.uid,
      r,
      n,
      c
    ]);
    return Ei(y, { onBlockNumber: i, onError: o }, (w) => Hd(async () => {
      var x;
      try {
        const I = await se(e, Ou, "getBlockNumber")({ cacheTime: 0 });
        if (h !== void 0) {
          if (I === h)
            return;
          if (I - h > 1 && n)
            for (let R = h + 1n; R < I; R++)
              w.onBlockNumber(R, h), h = R;
        }
        (h === void 0 || I > h) && (w.onBlockNumber(I, h), h = I);
      } catch (I) {
        (x = w.onError) == null || x.call(w, I);
      }
    }, {
      emitOnBegin: r,
      interval: c
    }));
  })() : (() => {
    const y = rn([
      "watchBlockNumber",
      e.uid,
      r,
      n
    ]);
    return Ei(y, { onBlockNumber: i, onError: o }, (w) => {
      let x = !0, I = () => x = !1;
      return (async () => {
        try {
          const R = (() => {
            if (e.transport.type === "fallback") {
              const S = e.transport.transports.find((G) => G.config.type === "webSocket" || G.config.type === "ipc");
              return S ? S.value : e.transport;
            }
            return e.transport;
          })(), { unsubscribe: O } = await R.subscribe({
            params: ["newHeads"],
            onData(S) {
              var Q;
              if (!x)
                return;
              const G = Zt((Q = S.result) == null ? void 0 : Q.number);
              w.onBlockNumber(G, h), h = G;
            },
            onError(S) {
              var G;
              (G = w.onError) == null || G.call(w, S);
            }
          });
          I = O, x || I();
        } catch (R) {
          o == null || o(R);
        }
      })(), () => I();
    });
  })();
}
async function kE(e, r) {
  const {
    checkReplacement: n = !0,
    confirmations: i = 1,
    hash: o,
    onReplaced: u,
    retryCount: c = 6,
    retryDelay: l = ({ count: T }) => ~~(1 << T) * 200,
    // exponential backoff
    timeout: h = 18e4
  } = r, g = rn(["waitForTransactionReceipt", e.uid, o]), m = (() => {
    var T;
    return r.pollingInterval ? r.pollingInterval : (T = e.chain) != null && T.experimental_preconfirmationTime ? e.chain.experimental_preconfirmationTime : e.pollingInterval;
  })();
  let y, w, x, I = !1, R, O;
  const { promise: S, resolve: G, reject: Q } = Du(), _ = h ? setTimeout(() => {
    O == null || O(), R == null || R(), Q(new X6({ hash: o }));
  }, h) : void 0;
  return R = Ei(g, { onReplaced: u, resolve: G, reject: Q }, async (T) => {
    if (x = await se(e, va, "getTransactionReceipt")({ hash: o }).catch(() => {
    }), x && i <= 1) {
      clearTimeout(_), T.resolve(x), R == null || R();
      return;
    }
    O = se(e, UE, "watchBlockNumber")({
      emitMissed: !0,
      emitOnBegin: !0,
      poll: !0,
      pollingInterval: m,
      async onBlockNumber(C) {
        const k = ($) => {
          clearTimeout(_), O == null || O(), $(), R == null || R();
        };
        let F = C;
        if (!I)
          try {
            if (x) {
              if (i > 1 && (!x.blockNumber || F - x.blockNumber + 1n < i))
                return;
              k(() => T.resolve(x));
              return;
            }
            if (n && !y && (I = !0, await Ja(async () => {
              y = await se(e, ME, "getTransaction")({ hash: o }), y.blockNumber && (F = y.blockNumber);
            }, {
              delay: l,
              retryCount: c
            }), I = !1), x = await se(e, va, "getTransactionReceipt")({ hash: o }), i > 1 && (!x.blockNumber || F - x.blockNumber + 1n < i))
              return;
            k(() => T.resolve(x));
          } catch ($) {
            if ($ instanceof dd || $ instanceof hd) {
              if (!y) {
                I = !1;
                return;
              }
              try {
                w = y, I = !0;
                const W = await Ja(() => se(e, mr, "getBlock")({
                  blockNumber: F,
                  includeTransactions: !0
                }), {
                  delay: l,
                  retryCount: c,
                  shouldRetry: ({ error: fe }) => fe instanceof Md
                });
                I = !1;
                const ne = W.transactions.find(({ from: fe, nonce: we }) => fe === w.from && we === w.nonce);
                if (!ne || (x = await se(e, va, "getTransactionReceipt")({
                  hash: ne.hash
                }), i > 1 && (!x.blockNumber || F - x.blockNumber + 1n < i)))
                  return;
                let ce = "replaced";
                ne.to === w.to && ne.value === w.value && ne.input === w.input ? ce = "repriced" : ne.from === ne.to && ne.value === 0n && (ce = "cancelled"), k(() => {
                  var fe;
                  (fe = T.onReplaced) == null || fe.call(T, {
                    reason: ce,
                    replacedTransaction: w,
                    transaction: ne,
                    transactionReceipt: x
                  }), T.resolve(x);
                });
              } catch (W) {
                k(() => T.reject(W));
              }
            } else
              k(() => T.reject($));
          }
      }
    });
  }), S;
}
async function GE(e, { serializedTransaction: r }) {
  return e.request({
    method: "eth_sendRawTransaction",
    params: [r]
  }, { retryCount: 0 });
}
const Pa = new Au(128);
async function Mu(e, r) {
  var G, Q, _, T;
  const { account: n = e.account, chain: i = e.chain, accessList: o, authorizationList: u, blobs: c, data: l, gas: h, gasPrice: g, maxFeePerBlobGas: m, maxFeePerGas: y, maxPriorityFeePerGas: w, nonce: x, type: I, value: R, ...O } = r;
  if (typeof n > "u")
    throw new Nd({
      docsPath: "/docs/actions/wallet/sendTransaction"
    });
  const S = n ? an(n) : null;
  try {
    Gi(r);
    const C = await (async () => {
      if (r.to)
        return r.to;
      if (r.to !== null && u && u.length > 0)
        return await fd({
          authorization: u[0]
        }).catch(() => {
          throw new U("`to` is required. Could not infer from `authorizationList`.");
        });
    })();
    if ((S == null ? void 0 : S.type) === "json-rpc" || S === null) {
      let k;
      i !== null && (k = await se(e, wi, "getChainId")({}), X2({
        currentChainId: k,
        chain: i
      }));
      const F = (_ = (Q = (G = e.chain) == null ? void 0 : G.formatters) == null ? void 0 : Q.transactionRequest) == null ? void 0 : _.format, W = (F || _u)({
        // Pick out extra data that might exist on the chain's transaction request type.
        ...Cu(O, { format: F }),
        accessList: o,
        authorizationList: u,
        blobs: c,
        chainId: k,
        data: l,
        from: S == null ? void 0 : S.address,
        gas: h,
        gasPrice: g,
        maxFeePerBlobGas: m,
        maxFeePerGas: y,
        maxPriorityFeePerGas: w,
        nonce: x,
        to: C,
        type: I,
        value: R
      }, "sendTransaction"), ne = Pa.get(e.uid), ce = ne ? "wallet_sendTransaction" : "eth_sendTransaction";
      try {
        return await e.request({
          method: ce,
          params: [W]
        }, { retryCount: 0 });
      } catch (fe) {
        if (ne === !1)
          throw fe;
        const we = fe;
        if (we.name === "InvalidInputRpcError" || we.name === "InvalidParamsRpcError" || we.name === "MethodNotFoundRpcError" || we.name === "MethodNotSupportedRpcError")
          return await e.request({
            method: "wallet_sendTransaction",
            params: [W]
          }, { retryCount: 0 }).then((je) => (Pa.set(e.uid, !0), je)).catch((je) => {
            const Le = je;
            throw Le.name === "MethodNotFoundRpcError" || Le.name === "MethodNotSupportedRpcError" ? (Pa.set(e.uid, !1), we) : Le;
          });
        throw we;
      }
    }
    if ((S == null ? void 0 : S.type) === "local") {
      const k = await se(e, kd, "prepareTransactionRequest")({
        account: S,
        accessList: o,
        authorizationList: u,
        blobs: c,
        chain: i,
        data: l,
        gas: h,
        gasPrice: g,
        maxFeePerBlobGas: m,
        maxFeePerGas: y,
        maxPriorityFeePerGas: w,
        nonce: x,
        nonceManager: S.nonceManager,
        parameters: [...Ud, "sidecars"],
        type: I,
        value: R,
        ...O,
        to: C
      }), F = (T = i == null ? void 0 : i.serializers) == null ? void 0 : T.transaction, $ = await S.signTransaction(k, {
        serializer: F
      });
      return await se(e, GE, "sendRawTransaction")({
        serializedTransaction: $
      });
    }
    throw (S == null ? void 0 : S.type) === "smart" ? new xa({
      metaMessages: [
        "Consider using the `sendUserOperation` Action instead."
      ],
      docsPath: "/docs/actions/bundler/sendUserOperation",
      type: "smart"
    }) : new xa({
      docsPath: "/docs/actions/wallet/sendTransaction",
      type: S == null ? void 0 : S.type
    });
  } catch (C) {
    throw C instanceof xa ? C : Rd(C, {
      ...r,
      account: S,
      chain: r.chain || void 0
    });
  }
}
async function HE(e) {
  var n;
  return ((n = e.account) == null ? void 0 : n.type) === "local" ? [e.account.address] : (await e.request({ method: "eth_accounts" }, { dedupe: !0 })).map((i) => Di(i));
}
const Qd = "0x5792579257925792579257925792579257925792579257925792579257925792", zd = te(0, {
  size: 32
});
async function QE(e, r) {
  const { account: n = e.account, capabilities: i, chain: o = e.chain, experimental_fallback: u, experimental_fallbackDelay: c = 32, forceAtomic: l = !1, id: h, version: g = "2.0.0" } = r, m = n ? an(n) : null, y = r.calls.map((w) => {
    const x = w, I = x.abi ? ps({
      abi: x.abi,
      functionName: x.functionName,
      args: x.args
    }) : x.data;
    return {
      data: x.dataSuffix && I ? nn([I, x.dataSuffix]) : I,
      to: x.to,
      value: x.value ? te(x.value) : void 0
    };
  });
  try {
    const w = await e.request({
      method: "wallet_sendCalls",
      params: [
        {
          atomicRequired: l,
          calls: y,
          capabilities: i,
          chainId: te(o.id),
          from: m == null ? void 0 : m.address,
          id: h,
          version: g
        }
      ]
    }, { retryCount: 0 });
    return typeof w == "string" ? { id: w } : w;
  } catch (w) {
    const x = w;
    if (u && (x.name === "MethodNotFoundRpcError" || x.name === "MethodNotSupportedRpcError" || x.name === "UnknownRpcError" || x.details.toLowerCase().includes("does not exist / is not available") || x.details.toLowerCase().includes("missing or invalid. request()") || x.details.toLowerCase().includes("did not match any variant of untagged enum") || x.details.toLowerCase().includes("account upgraded to unsupported contract") || x.details.toLowerCase().includes("eip-7702 not supported") || x.details.toLowerCase().includes("unsupported wc_ method") || x.details.toLowerCase().includes("feature toggled misconfigured"))) {
      if (i && Object.values(i).some((G) => !G.optional)) {
        const G = "non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`.";
        throw new Ui(new U(G, {
          details: G
        }));
      }
      if (l && y.length > 1) {
        const S = "`forceAtomic` is not supported on fallback to `eth_sendTransaction`.";
        throw new ki(new U(S, {
          details: S
        }));
      }
      const I = [];
      for (const S of y) {
        const G = Mu(e, {
          account: m,
          chain: o,
          data: S.data,
          to: S.to,
          value: S.value ? Zt(S.value) : void 0
        });
        I.push(G), c > 0 && await new Promise((Q) => setTimeout(Q, c));
      }
      const R = await Promise.allSettled(I);
      if (R.every((S) => S.status === "rejected"))
        throw R[0].reason;
      const O = R.map((S) => S.status === "fulfilled" ? S.value : zd);
      return {
        id: nn([
          ...O,
          te(o.id, { size: 32 }),
          Qd
        ])
      };
    }
    throw Rd(w, {
      ...r,
      account: m,
      chain: r.chain
    });
  }
}
async function zE(e, r) {
  async function n(m) {
    if (m.endsWith(Qd.slice(2))) {
      const w = xr(La(m, -64, -32)), x = La(m, 0, -64).slice(2).match(/.{1,64}/g), I = await Promise.all(x.map((O) => zd.slice(2) !== O ? e.request({
        method: "eth_getTransactionReceipt",
        params: [`0x${O}`]
      }, { dedupe: !0 }) : void 0)), R = I.some((O) => O === null) ? 100 : I.every((O) => (O == null ? void 0 : O.status) === "0x1") ? 200 : I.every((O) => (O == null ? void 0 : O.status) === "0x0") ? 500 : 600;
      return {
        atomic: !1,
        chainId: en(w),
        receipts: I.filter(Boolean),
        status: R,
        version: "2.0.0"
      };
    }
    return e.request({
      method: "wallet_getCallsStatus",
      params: [m]
    });
  }
  const { atomic: i = !1, chainId: o, receipts: u, version: c = "2.0.0", ...l } = await n(r.id), [h, g] = (() => {
    const m = l.status;
    return m >= 100 && m < 200 ? ["pending", m] : m >= 200 && m < 300 ? ["success", m] : m >= 300 && m < 700 ? ["failure", m] : m === "CONFIRMED" ? ["success", 200] : m === "PENDING" ? ["pending", 100] : [void 0, m];
  })();
  return {
    ...l,
    atomic: i,
    // @ts-expect-error: for backwards compatibility
    chainId: o ? en(o) : void 0,
    receipts: (u == null ? void 0 : u.map((m) => ({
      ...m,
      blockNumber: Zt(m.blockNumber),
      gasUsed: Zt(m.gasUsed),
      status: Dd[m.status]
    }))) ?? [],
    statusCode: g,
    status: h,
    version: c
  };
}
async function $E(e, r = {}) {
  const { account: n = e.account, chainId: i } = r, o = n ? an(n) : void 0, u = i ? [o == null ? void 0 : o.address, [te(i)]] : [o == null ? void 0 : o.address], c = await e.request({
    method: "wallet_getCapabilities",
    params: u
  }), l = {};
  for (const [h, g] of Object.entries(c)) {
    l[Number(h)] = {};
    for (let [m, y] of Object.entries(g))
      m === "addSubAccount" && (m = "unstable_addSubAccount"), l[Number(h)][m] = y;
  }
  return typeof i == "number" ? l[i] : l;
}
class WE extends U {
  constructor(r) {
    super(`Call bundle failed with status: ${r.statusCode}`, {
      name: "BundleFailedError"
    }), Object.defineProperty(this, "result", {
      enumerable: !0,
      configurable: !0,
      writable: !0,
      value: void 0
    }), this.result = r;
  }
}
async function VE(e, r) {
  const {
    id: n,
    pollingInterval: i = e.pollingInterval,
    status: o = ({ statusCode: R }) => R === 200 || R >= 300,
    retryCount: u = 4,
    retryDelay: c = ({ count: R }) => ~~(1 << R) * 200,
    // exponential backoff
    timeout: l = 6e4,
    throwOnFailure: h = !1
  } = r, g = rn(["waitForCallsStatus", e.uid, n]), { promise: m, resolve: y, reject: w } = Du();
  let x;
  const I = Ei(g, { resolve: y, reject: w }, (R) => {
    const O = Hd(async () => {
      const S = (G) => {
        clearTimeout(x), O(), G(), I();
      };
      try {
        const G = await Ja(async () => {
          const Q = await se(e, zE, "getCallsStatus")({ id: n });
          if (h && Q.status === "failure")
            throw new WE(Q);
          return Q;
        }, {
          retryCount: u,
          delay: c
        });
        if (!o(G))
          return;
        S(() => R.resolve(G));
      } catch (G) {
        S(() => R.reject(G));
      }
    }, {
      interval: i,
      emitOnBegin: !0
    });
    return O;
  });
  return x = l ? setTimeout(() => {
    I(), clearTimeout(x), w(new jE({ id: n }));
  }, l) : void 0, await m;
}
class jE extends U {
  constructor({ id: r }) {
    super(`Timed out while waiting for call bundle with id "${r}" to be confirmed.`, { name: "WaitForCallsStatusTimeoutError" });
  }
}
async function xi(e, r) {
  const { account: n = e.account, domain: i, message: o, primaryType: u } = r;
  if (!n)
    throw new Nd({
      docsPath: "/docs/actions/wallet/signTypedData"
    });
  const c = an(n), l = {
    EIP712Domain: hE({ domain: i }),
    ...r.types
  };
  if (dE({ domain: i, message: o, primaryType: u, types: l }), c.signTypedData)
    return c.signTypedData({ domain: i, message: o, primaryType: u, types: l });
  const h = lE({ domain: i, message: o, primaryType: u, types: l });
  return e.request({
    method: "eth_signTypedData_v4",
    params: [c.address, h]
  }, { retryCount: 0 });
}
const JE = "0x0000000000000000000000000000000000000000", qE = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
BigInt("0xffffffffffff");
BigInt("0xffffffffffffffffffffffffffffffffffffffff");
const Hi = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn, Fu = (e) => e === JE || e === qE, Uu = yr([
  "function callDiamondWithPermit2(bytes, ((address, uint256), uint256, uint256), bytes) external",
  "function callDiamondWithEIP2612Signature(address, uint256, uint256, uint8, bytes32, bytes32, bytes) external payable",
  "function nextNonce(address) external view returns (uint256)",
  "function callDiamondWithPermit2Witness(bytes, address, ((address, uint256), uint256, uint256), bytes) external payable"
]), Ln = yr([
  "function permit(address, address, uint256, uint256, uint8, bytes32, bytes32) external",
  "function DOMAIN_SEPARATOR() external view returns (bytes32)",
  "function nonces(address) external view returns (uint256)",
  "function name() external view returns (string)",
  "function version() external view returns (string)",
  "function PERMIT_TYPEHASH() external view returns (bytes32)",
  // EIP-5267
  "function eip712Domain() external view returns (bytes1, string, string, uint256, address, bytes32, uint256[])"
]), KE = yr([
  "function approve(address, uint256) external returns (bool)"
]), YE = yr([
  "function allowance(address, address) external view returns (uint256)"
]), XE = yr([
  "function getEthBalance(address) external view returns (uint256)"
]), $d = yr([
  "function balanceOf(address) external view returns (uint256)"
]), ZE = (e) => {
  if (!e.length)
    return;
  const r = [...e].sort((i, o) => i > o ? 1 : i < o ? -1 : 0), n = Math.floor(r.length / 2);
  return r.length % 2 === 0 ? (r[n - 1] + r[n]) / 2n : r[n];
}, ex = (e) => ({
  ...e,
  ...e.metamask,
  blockExplorers: e.metamask.blockExplorerUrls.reduce((r, n, i) => (r[i === 0 ? "default" : `${i}`] = {
    name: n,
    url: n
  }, r), {}),
  name: e.metamask.chainName,
  rpcUrls: {
    default: { http: e.metamask.rpcUrls },
    public: { http: e.metamask.rpcUrls }
  },
  contracts: {
    ...e.multicallAddress ? { multicall3: { address: e.multicallAddress } } : void 0
  }
}), Wd = async (e) => {
  const n = (await Mt(e, mr, "getBlock", {
    includeTransactions: !0
  })).transactions.filter((c) => c.maxPriorityFeePerGas).map((c) => c.maxPriorityFeePerGas);
  if (!n.length)
    return;
  let i = 0n;
  for (const c of n)
    i += c;
  const o = ZE(n) ?? 0n, u = i / BigInt(n.length);
  return o > u ? u : o;
}, ku = async (e) => {
  var n;
  return (n = (await ye.getChains()).find((i) => i.id === e)) == null ? void 0 : n.multicallAddress;
}, vi = (e) => {
  if (e.chainId)
    return Number(e.chainId);
  if (!e.salt)
    return null;
  try {
    const r = Number(e.salt);
    return Number.isNaN(r) ? null : r;
  } catch {
    return null;
  }
}, tx = (e) => e == null ? void 0 : e.startsWith("0xef0100"), nx = async (e, r, n, i) => {
  try {
    return await Mt(e, Tn, "readContract", {
      address: r,
      abi: YE,
      functionName: "allowance",
      args: [n, i]
    });
  } catch {
    return 0n;
  }
}, rx = Hi, Vd = Hi, jd = Hi, sx = "0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f", ix = "0x36c25de3e541d5d970f66e4210d728721220fff5c077cc6cd008b3a0c62adab7", ox = "0xea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb", ax = {
  Permit: [
    { name: "owner", type: "address" },
    { name: "spender", type: "address" },
    { name: "value", type: "uint256" },
    { name: "nonce", type: "uint256" },
    { name: "deadline", type: "uint256" }
  ]
};
function ux({ name: e, version: r, chainId: n, verifyingContract: i, withSalt: o = !1 }) {
  const u = hi(B0(e)), c = hi(B0(r)), l = o ? R0(C0("bytes32, bytes32, bytes32, address, bytes32"), [
    ix,
    u,
    c,
    i,
    El(xl(n), { size: 32 })
  ]) : R0(C0("bytes32, bytes32, bytes32, uint256, address"), [
    sx,
    u,
    c,
    BigInt(n),
    i
  ]);
  return hi(l);
}
function nl({ name: e, version: r, chainId: n, verifyingContract: i, domainSeparator: o }) {
  if (!e || !o)
    return {
      isValid: !1,
      domain: {}
    };
  for (const u of [!1, !0]) {
    const c = ux({
      name: e,
      version: r,
      chainId: n,
      verifyingContract: i,
      withSalt: u
    });
    if (o.toLowerCase() === c.toLowerCase())
      return {
        isValid: !0,
        domain: u ? {
          name: e,
          version: r,
          verifyingContract: i,
          salt: El(xl(n), { size: 32 })
        } : {
          name: e,
          version: r,
          chainId: n,
          verifyingContract: i
        }
      };
  }
  return {
    isValid: !1,
    domain: {}
  };
}
const cx = async (e) => {
  try {
    const r = await Mt(e, LE, "getCode", {
      address: e.account.address
    });
    return !!(!r || r === "0x" || tx(r));
  } catch {
    return !1;
  }
}, fx = async (e, r, n) => {
  try {
    const i = await ku(r), o = [
      {
        address: n,
        abi: Ln,
        functionName: "eip712Domain"
      },
      {
        address: n,
        abi: Ln,
        functionName: "nonces",
        args: [e.account.address]
      }
    ];
    if (i)
      try {
        const [I, R] = await Mt(e, Lu, "multicall", {
          contracts: o,
          multicallAddress: i
        });
        if (I.status !== "success" || R.status !== "success" || !I.result || R.result === void 0)
          throw new Error("EIP-5267 multicall failed");
        const [, O, S, G, Q, _] = I.result;
        return Number(G) !== r || Q.toLowerCase() !== n.toLowerCase() ? void 0 : {
          name: O,
          version: S,
          domain: _ !== S0 ? {
            name: O,
            version: S,
            verifyingContract: n,
            salt: _
          } : {
            name: O,
            version: S,
            chainId: r,
            verifyingContract: n
          },
          permitTypehash: void 0,
          // EIP-5267 doesn't provide permit typehash directly
          nonce: R.result
        };
      } catch {
      }
    const [u, c] = await Promise.allSettled(o.map((I) => Mt(e, Tn, "readContract", I)));
    if (u.status !== "fulfilled" || c.status !== "fulfilled")
      return;
    const [, l, h, g, m, y] = u.value;
    return Number(g) !== r || m.toLowerCase() !== n.toLowerCase() ? void 0 : {
      name: l,
      version: h,
      domain: y !== S0 ? {
        name: l,
        version: h,
        verifyingContract: n,
        salt: y
      } : {
        name: l,
        version: h,
        chainId: r,
        verifyingContract: n
      },
      permitTypehash: void 0,
      // EIP-5267 doesn't provide permit typehash directly
      nonce: c.value
    };
  } catch {
    return;
  }
}, lx = async (e, r, n) => {
  try {
    const i = await fx(e, r, n);
    if (i)
      return i;
    const o = await ku(r), u = [
      {
        address: n,
        abi: Ln,
        functionName: "name"
      },
      {
        address: n,
        abi: Ln,
        functionName: "DOMAIN_SEPARATOR"
      },
      {
        address: n,
        abi: Ln,
        functionName: "PERMIT_TYPEHASH"
      },
      {
        address: n,
        abi: Ln,
        functionName: "nonces",
        args: [e.account.address]
      },
      {
        address: n,
        abi: Ln,
        functionName: "version"
      }
    ];
    if (o)
      try {
        const [R, O, S, G, Q] = await Mt(e, Lu, "multicall", {
          contracts: u,
          multicallAddress: o
        });
        if (R.status !== "success" || O.status !== "success" || G.status !== "success" || !R.result || !O.result || G.result === void 0)
          throw new Error("Multicall failed");
        const { isValid: _, domain: T } = nl({
          name: R.result,
          version: Q.result ?? "1",
          chainId: r,
          verifyingContract: n,
          domainSeparator: O.result
        });
        return _ ? {
          name: R.result,
          domain: T,
          permitTypehash: S.result,
          nonce: G.result,
          version: Q.result ?? "1"
        } : void 0;
      } catch {
      }
    const [c, l, h, g, m] = await Promise.allSettled(u.map((R) => Mt(e, Tn, "readContract", R)));
    if (c.status !== "fulfilled" || l.status !== "fulfilled" || g.status !== "fulfilled")
      return;
    const y = c.value, w = m.status === "fulfilled" ? m.value : "1", { isValid: x, domain: I } = nl({
      name: y,
      version: w,
      chainId: r,
      verifyingContract: n,
      domainSeparator: l.value
    });
    return x ? {
      name: y,
      domain: I,
      permitTypehash: h.status === "fulfilled" ? h.value : void 0,
      nonce: g.value,
      version: w
    } : void 0;
  } catch {
    return;
  }
}, dx = async (e, { chainId: r, tokenAddress: n, spenderAddress: i, amount: o }) => {
  if (!await cx(e))
    return;
  const c = await lx(e, r, n);
  if (!c || c.permitTypehash === ox)
    return;
  const l = BigInt(Math.floor(Date.now() / 1e3) + 1800).toString(), h = {
    owner: e.account.address,
    spender: i,
    value: o.toString(),
    nonce: c.nonce.toString(),
    deadline: l
  };
  return {
    primaryType: "Permit",
    domain: c.domain,
    types: ax,
    message: h
  };
};
var De;
(function(e) {
  e.RPCError = "RPCError", e.ProviderError = "ProviderError", e.ServerError = "ServerError", e.TransactionError = "TransactionError", e.ValidationError = "ValidationError", e.BalanceError = "BalanceError", e.NotFoundError = "NotFoundError", e.UnknownError = "UnknownError", e.SlippageError = "SlippageError", e.HTTPError = "HTTPError";
})(De || (De = {}));
var ie;
(function(e) {
  e[e.InternalError = 1e3] = "InternalError", e[e.ValidationError = 1001] = "ValidationError", e[e.TransactionUnderpriced = 1002] = "TransactionUnderpriced", e[e.TransactionFailed = 1003] = "TransactionFailed", e[e.Timeout = 1004] = "Timeout", e[e.ProviderUnavailable = 1005] = "ProviderUnavailable", e[e.NotFound = 1006] = "NotFound", e[e.ChainSwitchError = 1007] = "ChainSwitchError", e[e.TransactionUnprepared = 1008] = "TransactionUnprepared", e[e.GasLimitError = 1009] = "GasLimitError", e[e.TransactionCanceled = 1010] = "TransactionCanceled", e[e.SlippageError = 1011] = "SlippageError", e[e.SignatureRejected = 1012] = "SignatureRejected", e[e.BalanceError = 1013] = "BalanceError", e[e.AllowanceRequired = 1014] = "AllowanceRequired", e[e.InsufficientFunds = 1015] = "InsufficientFunds", e[e.ExchangeRateUpdateCanceled = 1016] = "ExchangeRateUpdateCanceled", e[e.WalletChangedDuringExecution = 1017] = "WalletChangedDuringExecution", e[e.TransactionExpired = 1018] = "TransactionExpired", e[e.TransactionSimulationFailed = 1019] = "TransactionSimulationFailed", e[e.TransactionConflict = 1020] = "TransactionConflict", e[e.TransactionNotFound = 1021] = "TransactionNotFound", e[e.TransactionRejected = 1022] = "TransactionRejected", e[e.RateLimitExceeded = 1023] = "RateLimitExceeded", e[e.ThirdPartyError = 1024] = "ThirdPartyError", e[e.InsufficientGas = 1025] = "InsufficientGas";
})(ie || (ie = {}));
var Nt;
(function(e) {
  e.UnknownError = "Unknown error occurred.", e.SlippageError = "The slippage is larger than the defined threshold. Please request a new route to get a fresh quote.", e.GasLimitLow = "Gas limit is too low.", e.TransactionUnderpriced = "Transaction is underpriced.", e.TransactionReverted = "Transaction was reverted.";
})(Nt || (Nt = {}));
const hx = (e) => {
  let r = e;
  for (; r != null && r.cause; )
    r = r.cause;
  return r;
};
class St extends Error {
  constructor(n, i, o, u) {
    super(o);
    X(this, "code");
    X(this, "cause");
    this.name = n, this.code = i, this.cause = u;
    const c = hx(this.cause);
    c != null && c.stack && (this.stack = c.stack);
  }
}
class tu extends St {
  constructor(r, n, i) {
    super(De.ProviderError, r, n, i);
  }
}
class Oe extends St {
  constructor(r, n, i) {
    super(De.TransactionError, r, n, i);
  }
}
class px extends St {
  constructor(r, n) {
    super(De.UnknownError, ie.InternalError, r, n);
  }
}
class gx extends St {
  constructor(r, n) {
    super(De.BalanceError, ie.BalanceError, r, n);
  }
}
class mx extends St {
  constructor(r) {
    super(De.ServerError, ie.InternalError, r);
  }
}
class sn extends St {
  constructor(r) {
    super(De.ValidationError, ie.ValidationError, r);
  }
}
const Jd = "@lifi/sdk", ts = "3.12.14";
class Ft extends Error {
  constructor(n, i, o) {
    const u = `${n.message ? `[${n.name}] ${n.message}` : "Unknown error occurred"}
LI.FI SDK version: ${ts}`;
    super(u);
    X(this, "step");
    X(this, "process");
    X(this, "code");
    X(this, "name", "SDKError");
    X(this, "cause");
    this.name = "SDKError", this.step = i, this.process = o, this.cause = n, this.stack = this.cause.stack, this.code = n.code;
  }
}
const bx = /* @__PURE__ */ new Map([
  [
    400,
    { type: De.ValidationError, code: ie.ValidationError }
  ],
  [404, { type: De.NotFoundError, code: ie.NotFound }],
  [
    409,
    {
      type: De.SlippageError,
      code: ie.SlippageError,
      message: Nt.SlippageError
    }
  ],
  [424, { type: De.ServerError, code: ie.ThirdPartyError }],
  [429, { type: De.ServerError, code: ie.RateLimitExceeded }],
  [500, { type: De.ServerError, code: ie.InternalError }]
]), Ax = (e) => bx.get(e) ?? {
  type: De.ServerError,
  code: ie.InternalError
}, yx = (e) => {
  const r = e.status || e.status === 0 ? e.status : "", n = e.statusText || "", i = `${r} ${n}`.trim();
  return `Request failed with ${i ? `status code ${i}` : "an unknown error"}`;
};
class wx extends St {
  constructor(n, i, o) {
    const u = Ax(n.status), c = u != null && u.message ? `
${u.message}` : "", l = yx(n) + c;
    super(De.HTTPError, u.code, l);
    X(this, "response");
    X(this, "status");
    X(this, "url");
    X(this, "fetchOptions");
    X(this, "type");
    X(this, "responseBody");
    this.type = u.type, this.response = n, this.status = n.status, this.message = l, this.url = i, this.fetchOptions = o;
  }
  async buildAdditionalDetails() {
    var n, i;
    this.type && (this.message = `[${this.type}] ${this.message}`);
    try {
      this.responseBody = await this.response.json(), this.responseBody && (this.message += this.message.endsWith(".") ? ` ${(n = this.responseBody) == null ? void 0 : n.message.toString()}` : `. ${(i = this.responseBody) == null ? void 0 : i.message.toString()}`);
    } catch {
    }
    return this;
  }
}
function ns(e) {
  return new Promise((r) => {
    setTimeout(() => r(null), e);
  });
}
const rl = {
  retries: 1
}, Ex = ({ retries: e, ...r }) => ({
  ...r
}), Wn = async (e, r = {
  retries: rl.retries
}) => {
  var c;
  const { userId: n, integrator: i, widgetVersion: o, apiKey: u } = ye.get();
  if (!i)
    throw new Ft(new sn("You need to provide the Integrator property. Please see documentation https://docs.li.fi/integrate-li.fi-js-sdk/set-up-the-sdk"));
  r.retries = r.retries ?? rl.retries;
  try {
    u && (r.headers = {
      ...r.headers,
      "x-lifi-api-key": u
    }), n && (r.headers = {
      ...r.headers,
      "x-lifi-userid": n
    }), o && (r.headers = {
      ...r.headers,
      "x-lifi-widget": o
    }), ts && (r.headers = {
      ...r.headers,
      "x-lifi-sdk": ts
    }), r.headers = {
      ...r.headers,
      "x-lifi-integrator": i
    };
    const l = await fetch(e, Ex(r));
    if (!l.ok)
      throw new wx(l, e, r);
    return await l.json();
  } catch (l) {
    if (r.retries > 0 && l.status === 500)
      return await ns(500), Wn(e, { ...r, retries: r.retries - 1 });
    throw await ((c = l.buildAdditionalDetails) == null ? void 0 : c.call(l)), new Ft(l);
  }
}, xx = (e) => {
  const { id: r, type: n, tool: i, action: o, estimate: u } = e;
  return typeof r == "string" && ["swap", "cross", "lifi"].includes(n) && typeof i == "string" && vx(o) && Tx(u);
}, vx = (e) => {
  const { fromChainId: r, fromAmount: n, fromToken: i, toChainId: o, toToken: u } = e;
  return typeof r == "number" && typeof n == "string" && n !== "" && nu(i) && typeof o == "number" && nu(u);
}, Tx = (e) => {
  const { fromAmount: r, toAmount: n, toAmountMin: i, approvalAddress: o } = e;
  return typeof r == "string" && r !== "" && typeof n == "string" && n !== "" && typeof i == "string" && i !== "" && (typeof o == "string" || o === null);
}, nu = (e) => {
  const { address: r, decimals: n, chainId: i } = e;
  return typeof r == "string" && typeof n == "number" && typeof i == "number";
};
class Px extends Map {
  constructor(n) {
    super();
    X(this, "maxSize");
    this.maxSize = n;
  }
  set(n, i) {
    return super.set(n, i), this.maxSize && this.size > this.maxSize && this.delete(this.keys().next().value), this;
  }
}
const ci = /* @__PURE__ */ new Px(8192);
function Ix(e, { enabled: r = !0, id: n }) {
  if (!r || !n)
    return e();
  if (ci.get(n))
    return ci.get(n);
  const i = e().finally(() => ci.delete(n));
  return ci.set(n, i), i;
}
const Sx = async (e, r) => (xx(e), await Wn(`${ye.get().apiUrl}/advanced/stepTransaction`, {
  method: "POST",
  headers: {
    "Content-Type": "application/json"
  },
  body: JSON.stringify(e),
  signal: r == null ? void 0 : r.signal
})), Bx = async (e, r) => {
  if (!e.txHash)
    throw new Ft(new sn('Required parameter "txHash" is missing.'));
  const n = new URLSearchParams(e);
  return await Wn(`${ye.get().apiUrl}/status?${n}`, {
    signal: r == null ? void 0 : r.signal
  });
}, Rx = async (e, r) => {
  var u, c, l, h, g, m, y, w, x, I, R, O, S, G, Q, _;
  const n = [
    "fromChain",
    "fromToken",
    "fromAddress",
    "fromAmount",
    "toChain",
    "toToken"
  ];
  for (const T of n)
    if (!e[T])
      throw new Ft(new sn(`Required parameter "${T}" is missing.`));
  const i = ye.get();
  e.integrator ?? (e.integrator = i.integrator), e.order ?? (e.order = (u = i.routeOptions) == null ? void 0 : u.order), e.slippage ?? (e.slippage = (c = i.routeOptions) == null ? void 0 : c.slippage), e.referrer ?? (e.referrer = (l = i.routeOptions) == null ? void 0 : l.referrer), e.fee ?? (e.fee = (h = i.routeOptions) == null ? void 0 : h.fee), e.allowBridges ?? (e.allowBridges = (m = (g = i.routeOptions) == null ? void 0 : g.bridges) == null ? void 0 : m.allow), e.denyBridges ?? (e.denyBridges = (w = (y = i.routeOptions) == null ? void 0 : y.bridges) == null ? void 0 : w.deny), e.preferBridges ?? (e.preferBridges = (I = (x = i.routeOptions) == null ? void 0 : x.bridges) == null ? void 0 : I.prefer), e.allowExchanges ?? (e.allowExchanges = (O = (R = i.routeOptions) == null ? void 0 : R.exchanges) == null ? void 0 : O.allow), e.denyExchanges ?? (e.denyExchanges = (G = (S = i.routeOptions) == null ? void 0 : S.exchanges) == null ? void 0 : G.deny), e.preferExchanges ?? (e.preferExchanges = (_ = (Q = i.routeOptions) == null ? void 0 : Q.exchanges) == null ? void 0 : _.prefer);
  for (const T of Object.keys(e))
    e[T] || delete e[T];
  const o = await Wn(`${ye.get().apiUrl}/relayer/quote?${new URLSearchParams(e)}`, {
    signal: r == null ? void 0 : r.signal
  });
  if (o.status === "error")
    throw new St(De.ServerError, o.data.code, o.data.message);
  return o.data;
}, Cx = async (e, r) => {
  const n = ["typedData"];
  for (const u of n)
    if (!e[u])
      throw new Ft(new sn(`Required parameter "${u}" is missing.`));
  const i = e.typedData.some((u) => u.primaryType === "PermitWitnessTransferFrom") ? "/relayer/relay" : "/advanced/relay", o = await Wn(`${ye.get().apiUrl}${i}`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify(e, (u, c) => typeof c == "bigint" ? c.toString() : c),
    signal: r == null ? void 0 : r.signal
  });
  if (o.status === "error")
    throw new St(De.ServerError, o.data.code, o.data.message);
  return o.data;
}, _x = async (e, r) => {
  if (!e.taskId)
    throw new Ft(new sn('Required parameter "taskId" is missing.'));
  const { taskId: n, ...i } = e, o = new URLSearchParams(i), u = await Wn(`${ye.get().apiUrl}/relayer/status/${n}?${o}`, {
    signal: r == null ? void 0 : r.signal
  });
  if (u.status === "error")
    throw new St(De.ServerError, u.data.code, u.data.message);
  return u.data;
}, qd = async (e, r) => {
  if (e)
    for (const o of Object.keys(e))
      e[o] || delete e[o];
  const n = new URLSearchParams(e).toString();
  return (await Ix(() => Wn(`${ye.get().apiUrl}/chains?${n}`, {
    signal: r == null ? void 0 : r.signal
  }), { id: `${qd.name}.${n}` })).chains;
}, Ot = {
  state: {},
  get(e) {
    return this.state[e];
  },
  create(e) {
    var r;
    return this.state[e.route.id] = {
      ...this.state[e.route.id],
      ...e,
      executors: ((r = this.state[e.route.id]) == null ? void 0 : r.executors) ?? []
    }, this.state[e.route.id];
  },
  update(e) {
    this.state[e.route.id] && (this.state[e.route.id] = {
      ...this.state[e.route.id],
      ...e
    });
  },
  delete(e) {
    delete this.state[e];
  }
}, Dx = {
  TOKEN_ALLOWANCE: {
    STARTED: "Setting token allowance",
    PENDING: "Waiting for token allowance",
    DONE: "Token allowance set"
  },
  SWAP: {
    STARTED: "Preparing swap transaction",
    ACTION_REQUIRED: "Sign swap transaction",
    MESSAGE_REQUIRED: "Sign swap message",
    PENDING: "Waiting for swap transaction",
    DONE: "Swap completed"
  },
  CROSS_CHAIN: {
    STARTED: "Preparing bridge transaction",
    ACTION_REQUIRED: "Sign bridge transaction",
    MESSAGE_REQUIRED: "Sign bridge message",
    PENDING: "Waiting for bridge transaction",
    DONE: "Bridge transaction confirmed"
  },
  RECEIVING_CHAIN: {
    PENDING: "Waiting for destination chain",
    DONE: "Bridge completed"
  },
  PERMIT: {
    STARTED: "Preparing transaction",
    ACTION_REQUIRED: "Sign permit message",
    PENDING: "Waiting for permit message",
    DONE: "Permit message signed"
  }
}, Nx = {
  PENDING: {
    BRIDGE_NOT_AVAILABLE: "Bridge communication is temporarily unavailable.",
    CHAIN_NOT_AVAILABLE: "RPC communication is temporarily unavailable.",
    UNKNOWN_ERROR: "An unexpected error occurred. Please seek assistance in the LI.FI discord server.",
    WAIT_SOURCE_CONFIRMATIONS: "The bridge deposit has been received. The bridge is waiting for more confirmations to start the off-chain logic.",
    WAIT_DESTINATION_TRANSACTION: "The bridge off-chain logic is being executed. Wait for the transaction to appear on the destination chain."
  },
  DONE: {
    PARTIAL: "Some of the received tokens are not the requested destination tokens.",
    REFUNDED: "The tokens were refunded to the sender address.",
    COMPLETED: "The transfer is complete."
  },
  FAILED: {},
  INVALID: {},
  NOT_FOUND: {}
};
function sl(e, r) {
  return Dx[e][r];
}
function Ox(e, r) {
  return r ? Nx[e][r] : void 0;
}
class Lx {
  constructor(r) {
    X(this, "routeId");
    X(this, "shouldUpdate", !0);
    /**
     * Initializes the execution object of a Step.
     * @param step  The current step in execution
     * @returns The initialized execution object for this step and a function to update this step
     */
    X(this, "initExecutionObject", (r) => (r.execution || (r.execution = {
      status: "PENDING",
      process: [],
      startedAt: Date.now()
    }, this.updateStepInRoute(r)), r.execution.status === "FAILED" && (r.execution.startedAt = Date.now(), r.execution.status = "PENDING", this.updateStepInRoute(r)), r.execution));
    /**
     * Create and push a new process into the execution.
     * @param step The step that should contain the new process.
     * @param type Type of the process. Used to identify already existing processes.
     * @param chainId Chain Id of the process.
     * @param status By default created process is set to the STARTED status. We can override new process with the needed status.
     * @returns Returns process.
     */
    X(this, "findOrCreateProcess", ({ step: r, type: n, chainId: i, status: o, startedAt: u }) => {
      const c = this.findProcess(r, n, o);
      if (c)
        return c;
      const l = {
        type: n,
        startedAt: u ?? Date.now(),
        message: sl(n, o ?? "STARTED"),
        status: o ?? "STARTED",
        chainId: i
      };
      return r.execution.process.push(l), this.updateStepInRoute(r), l;
    });
    /**
     * Update a process object.
     * @param step The step where the process should be updated
     * @param type  The process type to update
     * @param status The status the process gets.
     * @param [params] Additional parameters to append to the process.
     * @returns The update process
     */
    X(this, "updateProcess", (r, n, i, o) => {
      if (!r.execution)
        throw new Error("Can't update an empty step execution.");
      const u = this.findProcess(r, n);
      if (!u)
        throw new Error("Can't find a process for the given type.");
      switch (i) {
        case "CANCELLED":
          u.doneAt = Date.now();
          break;
        case "FAILED":
          u.doneAt = Date.now(), r.execution.status = "FAILED";
          break;
        case "DONE":
          u.doneAt = Date.now();
          break;
        case "PENDING":
          r.execution.status = "PENDING", u.pendingAt = Date.now();
          break;
        case "ACTION_REQUIRED":
          r.execution.status = "ACTION_REQUIRED", u.actionRequiredAt = Date.now();
          break;
      }
      if (u.status = i, u.message = sl(n, i), o)
        for (const [c, l] of Object.entries(o))
          u[c] = l;
      return r.execution.process = [
        ...r.execution.process.filter((c) => c.status === "DONE"),
        ...r.execution.process.filter((c) => c.status !== "DONE")
      ], this.updateStepInRoute(r), u;
    });
    /**
     * Remove a process from the execution
     * @param step The step where the process should be removed from
     * @param type  The process type to remove
     */
    X(this, "removeProcess", (r, n) => {
      if (!r.execution)
        throw new Error("Execution hasn't been initialized.");
      const i = r.execution.process.findIndex((o) => o.type === n);
      r.execution.process.splice(i, 1), this.updateStepInRoute(r);
    });
    X(this, "updateStepInRoute", (r) => {
      var o, u;
      if (!this.shouldUpdate)
        return r;
      const n = Ot.get(this.routeId);
      if (!n)
        throw new Error("Execution data not found.");
      const i = n.route.steps.findIndex((c) => c.id === r.id);
      if (i === -1)
        throw new Error("Couldn't find a step to update.");
      return n.route.steps[i] = { ...n.route.steps[i], ...r }, (u = (o = n.executionOptions) == null ? void 0 : o.updateRouteHook) == null || u.call(o, n.route), n.route.steps[i];
    });
    this.routeId = r;
  }
  /**
   * Updates the execution object of a Step.
   * @param step  The current step in execution
   * @param status  The status for the execution
   * @param execution Optional. Information about received tokens
   * @returns The step with the updated execution object
   */
  updateExecution(r, n, i) {
    if (!r.execution)
      throw Error("Can't update empty execution.");
    return r.execution.status = n, n === "DONE" && (r.execution.doneAt = Date.now()), i && (r.execution = {
      ...r.execution,
      ...i
    }), this.updateStepInRoute(r), r;
  }
  /**
   * Finds a process of the specified type in the step's execution
   * @param step The step to search in
   * @param type The process type to find
   * @param status Optional status to update the process with if found
   * @returns The found process or undefined if not found
   */
  findProcess(r, n, i) {
    var u;
    if (!((u = r.execution) != null && u.process))
      throw new Error("Execution hasn't been initialized.");
    const o = r.execution.process.find((c) => c.type === n);
    return o && i && o.status !== i && (o.status = i, this.updateStepInRoute(r)), o;
  }
  allowUpdates(r) {
    this.shouldUpdate = r;
  }
}
const Mx = {
  allowInteraction: !0,
  allowUpdates: !0,
  allowExecution: !0
};
let Fx = class {
  constructor(r) {
    X(this, "executionOptions");
    X(this, "statusManager");
    X(this, "allowUserInteraction", !0);
    X(this, "allowExecution", !0);
    X(this, "setInteraction", (r) => {
      const n = {
        ...Mx,
        ...r
      };
      this.allowUserInteraction = n.allowInteraction, this.statusManager.allowUpdates(n.allowUpdates), this.allowExecution = n.allowExecution;
    });
    this.statusManager = new Lx(r.routeId), this.executionOptions = r.executionOptions;
  }
};
const Ux = async (e, r) => {
  const n = await kx(e, [r]);
  return n.length ? n[0] : null;
};
async function kx(e, r) {
  const n = r.reduce((o, u) => (o[u.chainId] || (o[u.chainId] = []), o[u.chainId].push(u), o), {}), i = await Gx(e, n);
  return Object.values(i).flat();
}
async function Gx(e, r) {
  if (!e)
    throw new sn("Missing walletAddress.");
  if (Object.values(r).flat().filter((l) => !nu(l)).length)
    throw new sn("Invalid tokens passed.");
  const o = ye.get().providers.find((l) => l.isAddress(e));
  if (!o)
    throw new Error(`SDK Token Provider for ${e} is not found.`);
  const u = {}, c = await Promise.allSettled(Object.keys(r).map(async (l) => {
    const h = Number.parseInt(l, 10), g = await ye.getChainById(h);
    if (o.type === g.chainType) {
      const m = await o.getBalance(e, r[h]);
      u[h] = m;
    } else
      u[h] = r[h];
  }));
  if (ye.get().debug)
    for (const l of c)
      l.status;
  return u;
}
const Kd = async (e, r, n = 0) => {
  const i = await Ux(e, r.action.fromToken);
  if (i) {
    const o = i.amount ?? 0n, u = BigInt(r.action.fromAmount);
    if (o < u)
      if (n <= 3)
        await ns(200), await Kd(e, r, n + 1);
      else if (u * BigInt((1 - (r.action.slippage ?? 0)) * 1e9) / 1000000000n <= o)
        r.action.fromAmount = o.toString();
      else {
        const c = _0(u, i.decimals), l = _0(o, i.decimals);
        let h = `Your ${i.symbol} balance is too low, you try to transfer ${c} ${i.symbol}, but your wallet only holds ${l} ${i.symbol}. No funds have been sent.`;
        throw o !== 0n && (h += `If the problem consists, please delete this transfer and start a new one with a maximum of ${l} ${i.symbol}.`), new gx("The balance is too low.", new Error(h));
      }
  }
}, Hx = 5e-3;
function Qx(e, r) {
  const n = e.action.slippage || Hx, i = BigInt(e.estimate.toAmountMin), o = BigInt(r.estimate.toAmountMin), u = i - o;
  let c = 0;
  return i > 0 && (c = Number(u * 1000000000n / i) / 1e9), c <= n;
}
const zx = async (e, r, n, i, o) => {
  var c;
  if (Qx(r, n))
    return e.updateStepInRoute(n);
  let u;
  if (i && (u = await ((c = o == null ? void 0 : o.acceptExchangeRateUpdateHook) == null ? void 0 : c.call(o, {
    oldToAmount: r.estimate.toAmount,
    newToAmount: n.estimate.toAmount,
    toToken: n.action.toToken
  }))), !u)
    throw new Oe(ie.ExchangeRateUpdateCanceled, `Exchange rate has changed!
Transaction was not sent, your funds are still in your wallet.
The exchange rate has changed and the previous estimation can not be fulfilled due to value loss.`);
  return e.updateStepInRoute(n);
}, $x = async (e, r) => {
  const i = `It appears that your transaction may not have been successful.
  However, to confirm this, please check your ${(await ye.getChainById(e.action.toChainId)).name} wallet for ${e.action.toToken.symbol}.`;
  return r ? `${i}
    You can also check the&nbsp;<a href="${r}" target="_blank" rel="nofollow noreferrer">block explorer</a> for more information.` : i;
}, Yd = async (e, r = 5e3, n = 3, i = () => !0) => {
  let o, u = 0;
  for (; !o; )
    try {
      o = await e(), o || await ns(r);
    } catch (c) {
      if (!i(u, c) || (u++, u === n))
        throw c;
      await ns(r);
    }
  return o;
}, il = {};
async function Wx(e, r, n, i, o = 5e3) {
  const u = () => Bx({
    fromChain: n.action.fromChainId,
    fromAddress: n.action.fromAddress,
    toChain: n.action.toChainId,
    txHash: r,
    ...n.tool !== "custom" && { bridge: n.tool }
  }).then((h) => {
    switch (h.status) {
      case "DONE":
        return h;
      case "PENDING":
        e == null || e.updateProcess(n, i, "PENDING", {
          substatus: h.substatus,
          substatusMessage: h.substatusMessage || Ox(h.status, h.substatus),
          txLink: h.bridgeExplorerLink
        });
        return;
      case "NOT_FOUND":
        return;
      default:
        return Promise.reject();
    }
  }).catch((h) => {
    process.env.NODE_ENV;
  });
  let c = il[r];
  c || (c = Yd(u, o), il[r] = c);
  const l = await c;
  if (!("receiving" in l))
    throw new mx("Status doesn't contain destination chain information.");
  return l;
}
async function ol(e, r, n, i, o, u) {
  const c = r.txHash || r.taskId;
  let l = r.type;
  try {
    if (!c)
      throw new Error("Transaction hash is undefined.");
    n.id !== i.id && (l = o.findOrCreateProcess({
      step: e,
      type: "RECEIVING_CHAIN",
      status: "PENDING",
      chainId: i.id,
      startedAt: r.doneAt
    }).type);
    const g = await Wx(o, c, e, l, u), m = g.receiving;
    return o.updateProcess(e, l, "DONE", {
      substatus: g.substatus,
      substatusMessage: g.substatusMessage,
      txHash: m == null ? void 0 : m.txHash,
      txLink: (m == null ? void 0 : m.txLink) || `${i.metamask.blockExplorerUrls[0]}tx/${m == null ? void 0 : m.txHash}`
    }), o.updateExecution(e, "DONE", {
      ...g.sending.amount && {
        fromAmount: g.sending.amount
      },
      ...(m == null ? void 0 : m.amount) && { toAmount: m.amount },
      ...(m == null ? void 0 : m.token) && { toToken: m.token },
      internalTxLink: g == null ? void 0 : g.lifiExplorerLink,
      externalTxLink: g == null ? void 0 : g.bridgeExplorerLink,
      gasCosts: [
        {
          amount: g.sending.gasAmount,
          amountUSD: g.sending.gasAmountUSD,
          token: g.sending.gasToken,
          estimate: g.sending.gasUsed,
          limit: g.sending.gasUsed,
          price: g.sending.gasPrice,
          type: "SEND"
        }
      ]
    }), e;
  } catch (h) {
    const g = await $x(e, `${i.metamask.blockExplorerUrls[0]}tx/${c}`);
    throw o.updateProcess(e, l, "FAILED", {
      error: {
        code: ie.TransactionFailed,
        message: "Failed while waiting for status of destination chain transaction.",
        htmlMessage: g
      }
    }), o.updateExecution(e, "FAILED"), h;
  }
}
const Vx = async (e, r) => {
  try {
    return await (await fetch(`https://api.tenderly.co/api/v1/public-contract/${r}/tx/${e}`)).json();
  } catch {
  }
}, ru = async (e, r, n) => {
  if (e instanceof Ft)
    return e.step = e.step ?? r, e.process = e.process ?? n, e;
  const i = await jx(e, r, n);
  return new Ft(i, r, n);
}, jx = async (e, r, n) => {
  var i, o, u, c, l, h, g, m;
  if (e.name === "UserRejectedRequestError" || ((i = e.cause) == null ? void 0 : i.name) === "UserRejectedRequestError" || /**
   * This error is specific to MetaMask and thrown when the user rejects the signature of the native token transfer, at that point, the bundle id is unknown.
   * @see https://github.com/MetaMask/metamask-extension/blob/main/app/scripts/lib/transaction/eip5792.ts#L141-L146
   */
  e.name === "UnknownBundleIdError")
    return new Oe(ie.SignatureRejected, e.message, e);
  if (((o = e.cause) == null ? void 0 : o.code) === -32e3 || // Safe doesn't return proper code, but the error details includes 'rejected'
  e.name === "TransactionExecutionError" && ((c = (u = e.cause) == null ? void 0 : u.details) != null && c.includes("rejected")))
    return new Oe(ie.SignatureRejected, e.message, e);
  if (((l = e.cause) == null ? void 0 : l.code) === -32603)
    return new Oe(ie.TransactionRejected, e.message, e);
  if (e.name === "InsufficientPrefundError" || ((h = e.cause) == null ? void 0 : h.name) === "InsufficientPrefundError" || ((m = (g = e.cause) == null ? void 0 : g.cause) == null ? void 0 : m.name) === "InsufficientPrefundError")
    return new Oe(ie.InsufficientGas, e.message, e);
  if (r && (n != null && n.txHash) && e.code === ie.TransactionFailed && e.message === Nt.TransactionReverted) {
    const y = await Vx(n.txHash, r.action.fromChainId), w = y == null ? void 0 : y.error_message;
    if (w != null && w.toLowerCase().includes("out of gas"))
      return new Oe(ie.GasLimitError, Nt.GasLimitLow, e);
  }
  return e instanceof St ? e : new px(e.message || Nt.UnknownError, e);
}, Jx = (e) => {
  var u, c, l, h;
  if (((u = e.cause) == null ? void 0 : u.code) === P5.code)
    return !0;
  const r = (l = (c = e.cause) == null ? void 0 : c.details) == null ? void 0 : l.toLowerCase(), n = e.name === "TransactionExecutionError" || ((h = e.cause) == null ? void 0 : h.name) === "TransactionExecutionError", i = (r == null ? void 0 : r.includes("rejected")) && (r == null ? void 0 : r.includes("upgrade")), o = r == null ? void 0 : r.includes("7702");
  return n && (i || o);
}, su = (e, r) => {
  var c, l, h, g;
  if (e.primaryType !== "Permit" || Number(e.domain.chainId) !== Number(r.domain.chainId) || e.domain.salt && e.domain.salt !== r.domain.salt)
    return !1;
  const n = e.message;
  if (!n || ((c = n.spender) == null ? void 0 : c.toLowerCase()) !== ((l = r.message.spender) == null ? void 0 : l.toLowerCase()) || ((h = n.owner) == null ? void 0 : h.toLowerCase()) !== ((g = r.message.owner) == null ? void 0 : g.toLowerCase()) || BigInt(n.value || 0) < BigInt(r.message.value || 0))
    return !1;
  const o = parseInt(n.deadline || 0, 10), u = Math.floor(Date.now() / 1e3) + 300;
  return !(o <= u);
}, qx = async (e, r, n, i, o, u) => {
  var h;
  const c = gu({
    abi: KE,
    functionName: "approve",
    args: [n, i]
  });
  if (u)
    return c;
  let l = {
    to: r,
    data: c,
    maxPriorityFeePerGas: ((h = e.account) == null ? void 0 : h.type) === "local" ? await Wd(e) : void 0
  };
  if (o != null && o.updateTransactionRequestHook) {
    const g = await o.updateTransactionRequestHook({
      requestType: "approve",
      ...l
    });
    l = {
      ...l,
      ...g
    };
  }
  return se(e, Mu, "sendTransaction")({
    to: l.to,
    account: e.account,
    data: l.data,
    gas: l.gas,
    gasPrice: l.gasPrice,
    maxFeePerGas: l.maxFeePerGas,
    maxPriorityFeePerGas: l.maxPriorityFeePerGas
  });
};
async function Xd({ client: e, chainId: r, txHash: n, onReplaced: i }) {
  let { transactionReceipt: o, replacementReason: u } = await al(e, n, i);
  if (!(o != null && o.status)) {
    const c = await $n(r), l = await al(c, n, i);
    o = l.transactionReceipt, u = l.replacementReason;
  }
  if ((o == null ? void 0 : o.status) === "reverted")
    throw new Oe(ie.TransactionFailed, "Transaction was reverted.");
  if (u === "cancelled" || u === "replaced")
    throw new Oe(ie.TransactionCanceled, "Transaction was canceled or replaced.");
  return o;
}
async function al(e, r, n) {
  let i, o;
  try {
    o = await kE(e, {
      hash: r,
      onReplaced: (u) => {
        i = u.reason, n == null || n(u);
      }
    });
  } catch {
  }
  return { transactionReceipt: o, replacementReason: i };
}
const Kx = async ({ checkClient: e, chain: r, step: n, statusManager: i, executionOptions: o, allowUserInteraction: u = !1, batchingSupported: c = !1, permit2Supported: l = !1, disableMessageSigning: h = !1 }) => {
  var y;
  let g, m = [];
  try {
    const w = (y = n.typedData) == null ? void 0 : y.filter((T) => T.primaryType === "Permit");
    if (!h && (w != null && w.length)) {
      g = i.findOrCreateProcess({
        step: n,
        type: "PERMIT",
        chainId: n.action.fromChainId
      }), m = g.signedTypedData ?? m;
      for (const C of w) {
        if (m.find((ce) => su(ce, C)))
          continue;
        if (g = i.updateProcess(n, g.type, "ACTION_REQUIRED"), !u)
          return { status: "ACTION_REQUIRED" };
        const F = vi(C.domain) || n.action.fromChainId, $ = await e(n, g, F);
        if (!$)
          return { status: "ACTION_REQUIRED" };
        const W = await se($, xi, "signTypedData")({
          account: $.account,
          domain: C.domain,
          types: C.types,
          primaryType: C.primaryType,
          message: C.message
        }), ne = {
          ...C,
          signature: W
        };
        m.push(ne), g = i.updateProcess(n, g.type, "ACTION_REQUIRED", {
          signedTypedData: m
        });
      }
      if (i.updateProcess(n, g.type, "DONE", {
        signedTypedData: m
      }), m.find((C) => vi(C.domain) === n.action.fromChainId))
        return {
          status: "NATIVE_PERMIT",
          data: m
        };
    }
    g = i.findOrCreateProcess({
      step: n,
      type: "TOKEN_ALLOWANCE",
      chainId: n.action.fromChainId
    });
    const x = await e(n, g);
    if (!x)
      return { status: "ACTION_REQUIRED" };
    if (g.txHash && g.status !== "DONE")
      return await ul(x, g.txHash, g.type, n, r, i), { status: "DONE", data: m };
    i.updateProcess(n, g.type, "STARTED");
    const I = l ? r.permit2 : n.estimate.approvalAddress, R = BigInt(n.action.fromAmount), O = await nx(x, n.action.fromToken.address, x.account.address, I);
    if (R <= O)
      return i.updateProcess(n, g.type, "DONE"), { status: "DONE", data: m };
    const S = !!r.permit2Proxy && !c && !h;
    let G;
    if (S && (G = await Mt(x, dx, "getNativePermit", {
      chainId: r.id,
      tokenAddress: n.action.fromToken.address,
      spenderAddress: r.permit2Proxy,
      amount: R
    })), S && G) {
      if (m = m.length ? m : g.signedTypedData || [], !m.find((C) => su(C, G))) {
        if (i.updateProcess(n, g.type, "ACTION_REQUIRED"), !u)
          return { status: "ACTION_REQUIRED" };
        const C = await se(x, xi, "signTypedData")({
          account: x.account,
          domain: G.domain,
          types: G.types,
          primaryType: G.primaryType,
          message: G.message
        }), k = {
          ...G,
          signature: C
        };
        m.push(k);
      }
      return i.updateProcess(n, g.type, "DONE", {
        signedTypedData: m
      }), {
        status: "NATIVE_PERMIT",
        data: m
      };
    }
    if (i.updateProcess(n, g.type, "ACTION_REQUIRED", {
      txHash: void 0,
      txLink: void 0
    }), !u)
      return { status: "ACTION_REQUIRED" };
    const Q = l ? Hi : R, _ = await qx(
      x,
      n.action.fromToken.address,
      I,
      Q,
      o,
      // We need to return the populated transaction is batching is supported
      // instead of executing transaction on-chain
      c
    );
    return c ? (i.updateProcess(n, g.type, "DONE"), {
      status: "BATCH_APPROVAL",
      data: {
        call: {
          to: n.action.fromToken.address,
          data: _,
          chainId: n.action.fromToken.chainId
        },
        signedTypedData: m
      }
    }) : (await ul(x, _, g.type, n, r, i), { status: "DONE", data: m });
  } catch (w) {
    g || (g = i.findOrCreateProcess({
      step: n,
      type: "TOKEN_ALLOWANCE",
      chainId: n.action.fromChainId
    }));
    const x = await ru(w, n, g);
    throw i.updateProcess(n, g.type, "FAILED", {
      error: {
        message: x.cause.message,
        code: x.code
      }
    }), i.updateExecution(n, "FAILED"), x;
  }
}, ul = async (e, r, n, i, o, u) => {
  const c = o.metamask.blockExplorerUrls[0], l = (m) => `${c}tx/${m}`;
  u.updateProcess(i, n, "PENDING", {
    txHash: r,
    txLink: l(r)
  });
  const h = await Xd({
    client: e,
    chainId: o.id,
    txHash: r,
    onReplaced(m) {
      const y = m.transaction.hash;
      u.updateProcess(i, n, "PENDING", {
        txHash: y,
        txLink: l(y)
      });
    }
  }), g = (h == null ? void 0 : h.transactionHash) || r;
  u.updateProcess(i, n, "DONE", {
    txHash: g,
    txLink: l(g)
  });
};
async function Yx({ client: e, chainId: r, skipReady: n = !1 }) {
  var o, u, c, l, h;
  const i = e ?? await ((u = (o = ye.getProvider(Se.EVM)) == null ? void 0 : o.getWalletClient) == null ? void 0 : u.call(o));
  if (!i)
    throw new Error("WalletClient is not provided.");
  try {
    const g = await Promise.race([
      se(i, $E, "getCapabilities")({ chainId: r }),
      ns(2e3)
    ]);
    return ((c = g == null ? void 0 : g.atomicBatch) == null ? void 0 : c.supported) || ((l = g == null ? void 0 : g.atomic) == null ? void 0 : l.status) === "supported" || !n && ((h = g == null ? void 0 : g.atomic) == null ? void 0 : h.status) === "ready" || !1;
  } catch {
    return !1;
  }
}
const Xx = (e, r, n, i, o) => {
  const { v: u, r: c, s: l } = I5(i);
  return gu({
    abi: Uu,
    functionName: "callDiamondWithEIP2612Signature",
    args: [e, r, n, Number(u), c, l, o]
  });
}, Zx = (e, r, n, i, o, u, c, l) => gu({
  abi: Uu,
  functionName: "callDiamondWithPermit2",
  args: [
    o,
    [[e, r], n, i],
    u
  ]
}), e8 = async (e, r, n, i) => {
  const o = await Mt(e, Tn, "readContract", {
    address: r.permit2Proxy,
    abi: Uu,
    functionName: "nextNonce",
    args: [e.account.address]
  });
  return {
    permitted: {
      token: n,
      amount: i
    },
    spender: r.permit2Proxy,
    nonce: o,
    deadline: BigInt(Math.floor(Date.now() / 1e3) + 1800)
    // 30 minutes
  };
}, t8 = process.env.NODE_ENV === "production", Ia = "Invariant failed";
function rs(e, r) {
  if (e)
    return;
  if (t8)
    throw new Error(Ia);
  const n = typeof r == "function" ? r() : r, i = n ? `${Ia}: ${n}` : Ia;
  throw new Error(i);
}
const n8 = "Permit2";
function Zd(e, r) {
  return {
    name: n8,
    chainId: r,
    verifyingContract: e
  };
}
const Qi = [
  { name: "token", type: "address" },
  { name: "amount", type: "uint256" }
], r8 = {
  TokenPermissions: Qi,
  PermitTransferFrom: [
    { name: "permitted", type: "TokenPermissions" },
    { name: "spender", type: "address" },
    { name: "nonce", type: "uint256" },
    { name: "deadline", type: "uint256" }
  ]
}, s8 = {
  TokenPermissions: Qi,
  PermitBatchTransferFrom: [
    { name: "permitted", type: "TokenPermissions[]" },
    { name: "spender", type: "address" },
    { name: "nonce", type: "uint256" },
    { name: "deadline", type: "uint256" }
  ]
};
function i8(e) {
  return !Array.isArray(e.permitted);
}
function o8(e, r, n, i) {
  rs(jd >= e.deadline, "SIG_DEADLINE_OUT_OF_RANGE"), rs(Vd >= e.nonce, "NONCE_OUT_OF_RANGE");
  const o = Zd(r, n);
  eh(e.permitted);
  const u = i ? {
    TokenPermissions: Qi,
    ...i.witnessType,
    PermitWitnessTransferFrom: [
      { name: "permitted", type: "TokenPermissions" },
      { name: "spender", type: "address" },
      { name: "nonce", type: "uint256" },
      { name: "deadline", type: "uint256" },
      { name: "witness", type: i.witnessTypeName }
    ]
  } : r8, c = i ? Object.assign(e, { witness: i.witness }) : e;
  return {
    domain: o,
    types: u,
    message: c
  };
}
function a8(e, r, n, i) {
  rs(jd >= e.deadline, "SIG_DEADLINE_OUT_OF_RANGE"), rs(Vd >= e.nonce, "NONCE_OUT_OF_RANGE");
  const o = Zd(r, n);
  e.permitted.forEach(eh);
  const u = i ? {
    ...i.witnessType,
    TokenPermissions: Qi,
    PermitBatchWitnessTransferFrom: [
      { name: "permitted", type: "TokenPermissions[]" },
      { name: "spender", type: "address" },
      { name: "nonce", type: "uint256" },
      { name: "deadline", type: "uint256" },
      { name: "witness", type: i.witnessTypeName }
    ]
  } : s8, c = i ? Object.assign(e, { witness: i.witness }) : e;
  return {
    domain: o,
    types: u,
    message: c
  };
}
function u8(e, r, n, i) {
  return i8(e) ? o8(e, r, n, i) : a8(e, r, n, i);
}
function eh(e) {
  rs(rx >= e.amount, "AMOUNT_OUT_OF_RANGE");
}
async function c8(e) {
  const { client: r, chain: n, tokenAddress: i, amount: o, data: u, witness: c } = e, l = await e8(r, n, i, o), h = c ? {
    witness: {
      diamondAddress: n.diamondAddress,
      diamondCalldataHash: hi(u)
    },
    witnessTypeName: "LiFiCall",
    witnessType: {
      LiFiCall: [
        { name: "diamondAddress", type: "address" },
        { name: "diamondCalldataHash", type: "bytes32" }
      ]
    }
  } : void 0, g = u8(l, n.permit2, n.id, h), m = c ? "PermitWitnessTransferFrom" : "PermitTransferFrom", y = await se(r, xi, "signTypedData")({
    account: r.account,
    primaryType: m,
    domain: g.domain,
    types: g.types,
    message: g.message
  });
  return {
    ...g,
    primaryType: m,
    signature: y
  };
}
const f8 = async (e, r, n, i, o, u, c) => {
  if (await se(e, wi, "getChainId")(void 0) === o)
    return e;
  if (u)
    try {
      if (!(c != null && c.switchChainHook))
        throw new tu(ie.ChainSwitchError, "Chain switch hook is not provided.");
      const h = await c.switchChainHook(o);
      let g;
      if (h && (g = await se(h, wi, "getChainId")(void 0)), g !== o)
        throw new tu(ie.ChainSwitchError, "Chain switch required.");
      return h;
    } catch (h) {
      throw r.updateProcess(n, i.type, "FAILED", {
        error: {
          message: h.message,
          code: ie.ChainSwitchError
        }
      }), r.updateExecution(n, "FAILED"), h;
    }
};
function Sa(e) {
  return !!e.typedData && e.typedData.length > 0;
}
function l8(e, r) {
  var n;
  return !!((n = e.typedData) != null && n.some((i) => i.primaryType === "PermitWitnessTransferFrom")) || !1;
}
const d8 = async (e, r, n) => {
  var o;
  const i = await se(e, VE, "waitForCallsStatus")({
    id: r,
    timeout: 864e5
  });
  if (i.status === "success") {
    if (!((o = i.receipts) != null && o.length) || !i.receipts.every((c) => c.transactionHash) || i.receipts.some((c) => c.status === "reverted"))
      throw n == null || n(i), new Oe(ie.TransactionFailed, "Transaction was reverted.");
    return i.receipts.at(-1);
  }
  throw i.statusCode >= 400 && i.statusCode < 500 ? (n == null || n(i), new Oe(ie.TransactionCanceled, "Transaction was canceled.")) : (n == null || n(i), new Oe(ie.TransactionFailed, "Transaction failed."));
}, h8 = async (e, r) => Yd(async () => {
  var i;
  const n = await _x({
    taskId: e,
    fromChain: r.action.fromChainId,
    toChain: r.action.toChainId,
    ...r.tool !== "custom" && { bridge: r.tool }
  }).catch((o) => {
    process.env.NODE_ENV;
  });
  switch (n == null ? void 0 : n.status) {
    case "PENDING":
      return;
    case "DONE": {
      const o = (i = n == null ? void 0 : n.transactionStatus) == null ? void 0 : i.sending;
      return {
        status: "success",
        gasUsed: o == null ? void 0 : o.gasUsed,
        transactionHash: n == null ? void 0 : n.metadata.txHash,
        transactionLink: o == null ? void 0 : o.txLink
      };
    }
    case "FAILED":
      throw new Oe(ie.TransactionFailed, "Transaction was reverted.");
    default:
      throw new Oe(ie.TransactionNotFound, "Transaction not found.");
  }
}, 5e3, 3, (n, i) => !(i instanceof Oe && i.code === ie.TransactionFailed));
class p8 extends Fx {
  constructor(n) {
    super(n);
    X(this, "client");
    // Ensure that we are using the right chain and wallet when executing transactions.
    X(this, "checkClient", async (n, i, o) => {
      var l, h;
      const u = await f8(this.client, this.statusManager, n, i, o ?? n.action.fromChainId, this.allowUserInteraction, this.executionOptions);
      u && (this.client = u);
      let c = (l = this.client.account) == null ? void 0 : l.address;
      if (!c) {
        const g = await se(this.client, HE, "getAddresses")(void 0);
        c = g == null ? void 0 : g[0];
      }
      if ((c == null ? void 0 : c.toLowerCase()) !== ((h = n.action.fromAddress) == null ? void 0 : h.toLowerCase())) {
        const g = "The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.";
        throw this.statusManager.updateProcess(n, i.type, "FAILED", {
          error: {
            code: ie.WalletChangedDuringExecution,
            message: g
          }
        }), this.statusManager.updateExecution(n, "FAILED"), await ru(new Oe(ie.WalletChangedDuringExecution, g), n, i);
      }
      return u;
    });
    X(this, "waitForTransaction", async ({ step: n, process: i, fromChain: o, toChain: u, isBridgeExecution: c }) => {
      const l = (g) => {
        if (g != null && g.transactionHash && g.transactionHash !== i.txHash) {
          const m = Lt(g.transactionHash, {
            strict: !0
          }) ? g.transactionHash : void 0;
          i = this.statusManager.updateProcess(n, i.type, "PENDING", {
            txHash: m,
            txLink: g.transactionLink || (m ? `${o.metamask.blockExplorerUrls[0]}tx/${m}` : void 0)
          });
        }
      };
      let h;
      switch (i.txType) {
        case "batched":
          h = await d8(this.client, i.taskId, (g) => {
            var y;
            const m = (y = g.receipts) == null ? void 0 : y.find((w) => w.status === "reverted");
            m && l(m);
          });
          break;
        case "relayed":
          h = await h8(i.taskId, n);
          break;
        default:
          h = await Xd({
            client: this.client,
            chainId: o.id,
            txHash: i.txHash,
            onReplaced: (g) => {
              this.statusManager.updateProcess(n, i.type, "PENDING", {
                txHash: g.transaction.hash,
                txLink: `${o.metamask.blockExplorerUrls[0]}tx/${g.transaction.hash}`
              });
            }
          });
      }
      l(h), c && (i = this.statusManager.updateProcess(n, i.type, "DONE")), await ol(n, i, o, u, this.statusManager);
    });
    X(this, "prepareUpdatedStep", async (n, i) => {
      var y, w, x;
      const { execution: o, ...u } = n, c = Sa(n), l = l8(n);
      let h;
      if (c && l)
        h = {
          ...await Rx({
            fromChain: u.action.fromChainId,
            fromToken: u.action.fromToken.address,
            fromAddress: u.action.fromAddress,
            fromAmount: u.action.fromAmount,
            toChain: u.action.toChainId,
            toToken: u.action.toToken.address,
            slippage: u.action.slippage,
            toAddress: u.action.toAddress,
            allowBridges: [u.tool]
          }),
          id: u.id
        };
      else {
        const I = i == null ? void 0 : i.filter((G) => G.signature), { typedData: R, ...O } = u, S = I != null && I.length ? { ...O, typedData: I } : O;
        h = await Sx(S);
      }
      const g = await zx(this.statusManager, n, h, this.allowUserInteraction, this.executionOptions);
      if (Object.assign(n, {
        ...g,
        execution: n.execution,
        typedData: h.typedData ?? n.typedData
      }), !n.transactionRequest && !((y = n.typedData) != null && y.length))
        throw new Oe(ie.TransactionUnprepared, "Unable to prepare transaction.");
      let m;
      if (n.transactionRequest && (m = {
        to: n.transactionRequest.to,
        from: n.transactionRequest.from,
        data: n.transactionRequest.data,
        value: n.transactionRequest.value ? BigInt(n.transactionRequest.value) : void 0,
        gas: n.transactionRequest.gasLimit ? BigInt(n.transactionRequest.gasLimit) : void 0,
        // gasPrice: step.transactionRequest.gasPrice
        //   ? BigInt(step.transactionRequest.gasPrice as string)
        //   : undefined,
        // maxFeePerGas: step.transactionRequest.maxFeePerGas
        //   ? BigInt(step.transactionRequest.maxFeePerGas as string)
        //   : undefined,
        maxPriorityFeePerGas: ((w = this.client.account) == null ? void 0 : w.type) === "local" ? await Wd(this.client) : n.transactionRequest.maxPriorityFeePerGas ? BigInt(n.transactionRequest.maxPriorityFeePerGas) : void 0
      }), (x = this.executionOptions) != null && x.updateTransactionRequestHook && m) {
        const I = await this.executionOptions.updateTransactionRequestHook({
          requestType: "transaction",
          ...m
        });
        m = {
          ...m,
          ...I
        };
      }
      return {
        transactionRequest: m,
        // We should always check against the updated step,
        // because the step may be updated with typed data from the previously signed typed data
        isRelayerTransaction: Sa(h)
      };
    });
    X(this, "estimateTransactionRequest", async (n, i) => {
      n.to = i.permit2Proxy;
      try {
        const o = await Mt(this.client, Gd, "estimateGas", {
          account: this.client.account,
          to: n.to,
          data: n.data,
          value: n.value
        });
        n.gas = n.gas && n.gas > o ? n.gas : o;
      } catch {
        n.gas && (n.gas = n.gas + 80000n);
      }
      return n;
    });
    X(this, "executeStep", async (n, i = !1) => {
      var G, Q, _;
      n.execution = this.statusManager.initExecutionObject(n);
      const o = (G = n.execution) == null ? void 0 : G.process.find((T) => T.type === "RECEIVING_CHAIN");
      if (o && o.substatus !== "WAIT_DESTINATION_TRANSACTION" && !await this.checkClient(n, o))
        return n;
      const u = await ye.getChainById(n.action.fromChainId), c = await ye.getChainById(n.action.toChainId), l = [];
      let h = [];
      const g = i || n.tool === "thorswap" || Sa(n) ? !1 : await Yx({
        client: this.client,
        chainId: u.id
      }), m = u.id !== c.id, y = m ? "CROSS_CHAIN" : "SWAP", w = n.execution.process.find((T) => T.type === y), x = u.nativeToken.address === n.action.fromToken.address && Fu(n.action.fromToken.address), I = ((Q = this.executionOptions) == null ? void 0 : Q.disableMessageSigning) || n.type !== "lifi", R = !!u.permit2 && !!u.permit2Proxy && !g && !x && !I && // Approval address is not required for Permit2 per se, but we use it to skip allowance checks for direct transfers
      !!n.estimate.approvalAddress;
      if (
        // No existing swap/bridge transaction is pending
        !(w != null && w.txHash) && // No existing swap/bridge batch/order is pending
        !(w != null && w.taskId) && // Token is not native (address is not zero)
        !x && // Approval address is required for allowance checks, but may be null in special cases (e.g. direct transfers)
        !!n.estimate.approvalAddress
      ) {
        const T = await Kx({
          checkClient: this.checkClient,
          chain: u,
          step: n,
          statusManager: this.statusManager,
          executionOptions: this.executionOptions,
          allowUserInteraction: this.allowUserInteraction,
          batchingSupported: g,
          permit2Supported: R,
          disableMessageSigning: I
        });
        switch (T.status) {
          case "BATCH_APPROVAL":
            l.push(T.data.call), h = T.data.signedTypedData;
            break;
          case "NATIVE_PERMIT":
            h = T.data;
            break;
          case "DONE":
            h = T.data;
            break;
          default:
            if (!this.allowUserInteraction)
              return n;
            break;
        }
      }
      let S = this.statusManager.findProcess(n, y);
      try {
        if ((S == null ? void 0 : S.status) === "DONE")
          return await ol(n, S, u, c, this.statusManager), n;
        if (S != null && S.txHash || S != null && S.taskId)
          return await this.checkClient(n, S) && await this.waitForTransaction({
            step: n,
            process: S,
            fromChain: u,
            toChain: c,
            isBridgeExecution: m
          }), n;
        S = this.statusManager.findOrCreateProcess({
          step: n,
          type: y,
          status: "STARTED",
          chainId: u.id
        }), await Kd(this.client.account.address, n);
        let { transactionRequest: T, isRelayerTransaction: C } = await this.prepareUpdatedStep(n, h);
        if (!await this.checkClient(n, S) || (S = this.statusManager.updateProcess(n, S.type, "ACTION_REQUIRED"), !this.allowUserInteraction))
          return n;
        let F, $, W = "standard", ne;
        if (g && T) {
          const ce = {
            chainId: u.id,
            data: T.data,
            to: T.to,
            value: T.value
          };
          l.push(ce);
          const { id: fe } = await se(this.client, QE, "sendCalls")({
            account: this.client.account,
            calls: l
          });
          $ = fe, W = "batched";
        } else if (C) {
          const ce = (_ = n.typedData) == null ? void 0 : _.filter((Le) => !h.some((ze) => su(ze, Le)));
          if (!(ce != null && ce.length))
            throw new Oe(ie.TransactionUnprepared, "Unable to prepare transaction. Typed data for transfer is not found.");
          this.statusManager.updateProcess(n, S.type, "MESSAGE_REQUIRED");
          for (const Le of ce) {
            if (!this.allowUserInteraction)
              return n;
            const ze = vi(Le.domain) || u.id, xe = await this.checkClient(n, S, ze);
            if (!xe)
              return n;
            const bt = await se(xe, xi, "signTypedData")({
              account: xe.account,
              primaryType: Le.primaryType,
              domain: Le.domain,
              types: Le.types,
              message: Le.message
            });
            h.push({
              ...Le,
              signature: bt
            });
          }
          this.statusManager.updateProcess(n, S.type, "PENDING");
          const { execution: fe, ...we } = n, je = await Cx({
            ...we,
            typedData: h
          });
          $ = je.taskId, W = "relayed", ne = je.txLink;
        } else {
          if (!T)
            throw new Oe(ie.TransactionUnprepared, "Unable to prepare transaction. Transaction request is not found.");
          const ce = h.find((fe) => fe.primaryType === "Permit" && vi(fe.domain) === u.id);
          if (ce)
            T.data = Xx(n.action.fromToken.address, BigInt(n.action.fromAmount), ce.message.deadline, ce.signature, T.data);
          else if (R) {
            this.statusManager.updateProcess(n, S.type, "MESSAGE_REQUIRED");
            const fe = await c8({
              client: this.client,
              chain: u,
              tokenAddress: n.action.fromToken.address,
              amount: BigInt(n.action.fromAmount),
              data: T.data
            });
            T.data = Zx(n.action.fromToken.address, BigInt(n.action.fromAmount), fe.message.nonce, fe.message.deadline, T.data, fe.signature), this.statusManager.updateProcess(n, S.type, "ACTION_REQUIRED");
          }
          (ce || R) && (T = await this.estimateTransactionRequest(T, u)), F = await se(this.client, Mu, "sendTransaction")({
            to: T.to,
            account: this.client.account,
            data: T.data,
            value: T.value,
            gas: T.gas,
            gasPrice: T.gasPrice,
            maxFeePerGas: T.maxFeePerGas,
            maxPriorityFeePerGas: T.maxPriorityFeePerGas,
            chain: ex(u)
          });
        }
        return S = this.statusManager.updateProcess(
          n,
          S.type,
          "PENDING",
          // When atomic batch or relayer are supported, txHash represents the batch hash or taskId rather than an individual transaction hash
          {
            txHash: F,
            taskId: $,
            txType: W,
            txLink: W === "standard" && F ? `${u.metamask.blockExplorerUrls[0]}tx/${F}` : ne
          }
        ), await this.waitForTransaction({
          step: n,
          process: S,
          fromChain: u,
          toChain: c,
          isBridgeExecution: m
        }), n;
      } catch (T) {
        if (Jx(T) && !i)
          return n.execution = void 0, this.executeStep(n, !0);
        const C = await ru(T, n, S);
        throw S = this.statusManager.updateProcess(n, (S == null ? void 0 : S.type) || y, "FAILED", {
          error: {
            message: C.cause.message,
            code: C.code
          }
        }), this.statusManager.updateExecution(n, "FAILED"), C;
      }
    });
    this.client = n.client;
  }
}
const g8 = async (e, r) => {
  if (r.length === 0)
    return [];
  const { chainId: n } = r[0];
  for (const o of r)
    o.chainId;
  const i = await ku(n);
  return i && r.length > 1 ? m8(n, r, e, i) : b8(n, r, e);
}, m8 = async (e, r, n, i) => {
  const o = await $n(e), u = r.map((h) => Fu(h.address) ? {
    address: i,
    abi: XE,
    functionName: "getEthBalance",
    args: [n]
  } : {
    address: h.address,
    abi: $d,
    functionName: "balanceOf",
    args: [n]
  }), [c, l] = await Promise.all([
    Ou(o),
    Lu(o, {
      contracts: u,
      multicallAddress: i
    })
  ]);
  return l.length ? r.map((h, g) => ({
    ...h,
    amount: l[g].result,
    blockNumber: c
  })) : [];
}, b8 = async (e, r, n) => {
  const i = await $n(e), o = r.map((h) => Fu(h.address) ? RE(i, {
    address: n
  }) : Tn(i, {
    address: h.address,
    abi: $d,
    functionName: "balanceOf",
    args: [n]
  })), [u, c] = await Promise.all([
    Ou(i),
    Promise.allSettled(o)
  ]);
  return r.map((h, g) => {
    const m = c[g];
    return m.status === "rejected" ? {
      ...h,
      blockNumber: u
    } : {
      ...h,
      amount: m.value,
      blockNumber: u
    };
  });
};
var A8 = "AEkVMQnvDV0B0wKWAQYBQgDpATQAoQDcAIUApwBsAOMAcACTAE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otdJnxr1l3BqWnQVAeDBEOtPyJQx1q5+mODiClXtYeBLTWtsJ42AMBcf/IFIhpfhYO08hsg0Ik+DpQFNOKReK3o3cudkxWX0soPtI5eSFOA6yNylS+IQjrQtYQ/5s4UcixJfokumBUjpH9ofSjUTwPCapGFndfqqG5IHeMMvfg+88SXm7bNyjk6pGKzL+WxDAdqKtQ72WWVbOk3I+ueGuammmB2pvFZvqIcU/lvW3n9+r2lycnQLE4OX9R1jIgW4cDjJ3v8dAa66mVcfC7ptCr5io6mCaA9qI9T9FFWqo1ZAaMxgxAu8aXqmaOYryMND2sTUfoHvxcYK7hEiJhCLYFDx3PBhE97c2a0ub1/ePJcyJOqr7UaTAPTJ+xvZtjb/40sloY1ltRnTkWILmIP2b7S3AdXCR+YiArMUHwdncpjpyDGfzqGOUoAuaamWzAMacQtb34/M32FEgR5lUEf8fRzFrZUhzQj0fR7/6gdzdnVVvcSneLmtqJ930VCCDORY8CVdQWdo/S3PNkX3pQsPVKWIYGAMrFZoq8bQ/OJBDSXP7KSBdL3QN0Zqd393p6VFc7DnlnFiN00SY5Nux7yadeIM0Upl2rVsu8/VAI";
const cl = /* @__PURE__ */ new Map([[8217, "apostrophe"], [8260, "fraction slash"], [12539, "middle dot"]]), fl = 4;
function y8(e) {
  let r = 0;
  function n() {
    return e[r++] << 8 | e[r++];
  }
  let i = n(), o = 1, u = [0, 1];
  for (let T = 1; T < i; T++)
    u.push(o += n());
  let c = n(), l = r;
  r += c;
  let h = 0, g = 0;
  function m() {
    return h == 0 && (g = g << 8 | e[r++], h = 8), g >> --h & 1;
  }
  const y = 31, w = 2 ** y, x = w >>> 1, I = x >> 1, R = w - 1;
  let O = 0;
  for (let T = 0; T < y; T++) O = O << 1 | m();
  let S = [], G = 0, Q = w;
  for (; ; ) {
    let T = Math.floor(((O - G + 1) * o - 1) / Q), C = 0, k = i;
    for (; k - C > 1; ) {
      let W = C + k >>> 1;
      T < u[W] ? k = W : C = W;
    }
    if (C == 0) break;
    S.push(C);
    let F = G + Math.floor(Q * u[C] / o), $ = G + Math.floor(Q * u[C + 1] / o) - 1;
    for (; ((F ^ $) & x) == 0; )
      O = O << 1 & R | m(), F = F << 1 & R, $ = $ << 1 & R | 1;
    for (; F & ~$ & I; )
      O = O & x | O << 1 & R >>> 1 | m(), F = F << 1 ^ x, $ = ($ ^ x) << 1 | x | 1;
    G = F, Q = 1 + $ - F;
  }
  let _ = i - 4;
  return S.map((T) => {
    switch (T - _) {
      case 3:
        return _ + 65792 + (e[l++] << 16 | e[l++] << 8 | e[l++]);
      case 2:
        return _ + 256 + (e[l++] << 8 | e[l++]);
      case 1:
        return _ + e[l++];
      default:
        return T - 1;
    }
  });
}
function w8(e) {
  let r = 0;
  return () => e[r++];
}
function th(e) {
  return w8(y8(E8(e)));
}
function E8(e) {
  let r = [];
  [..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((o, u) => r[o.charCodeAt(0)] = u);
  let n = e.length, i = new Uint8Array(6 * n >> 3);
  for (let o = 0, u = 0, c = 0, l = 0; o < n; o++)
    l = l << 6 | r[e.charCodeAt(o)], c += 6, c >= 8 && (i[u++] = l >> (c -= 8));
  return i;
}
function x8(e) {
  return e & 1 ? ~e >> 1 : e >> 1;
}
function v8(e, r) {
  let n = Array(e);
  for (let i = 0, o = 0; i < e; i++) n[i] = o += x8(r());
  return n;
}
function ss(e, r = 0) {
  let n = [];
  for (; ; ) {
    let i = e(), o = e();
    if (!o) break;
    r += i;
    for (let u = 0; u < o; u++)
      n.push(r + u);
    r += o + 1;
  }
  return n;
}
function nh(e) {
  return is(() => {
    let r = ss(e);
    if (r.length) return r;
  });
}
function rh(e) {
  let r = [];
  for (; ; ) {
    let n = e();
    if (n == 0) break;
    r.push(T8(n, e));
  }
  for (; ; ) {
    let n = e() - 1;
    if (n < 0) break;
    r.push(P8(n, e));
  }
  return r.flat();
}
function is(e) {
  let r = [];
  for (; ; ) {
    let n = e(r.length);
    if (!n) break;
    r.push(n);
  }
  return r;
}
function sh(e, r, n) {
  let i = Array(e).fill().map(() => []);
  for (let o = 0; o < r; o++)
    v8(e, n).forEach((u, c) => i[c].push(u));
  return i;
}
function T8(e, r) {
  let n = 1 + r(), i = r(), o = is(r);
  return sh(o.length, 1 + e, r).flatMap((c, l) => {
    let [h, ...g] = c;
    return Array(o[l]).fill().map((m, y) => {
      let w = y * i;
      return [h + y * n, g.map((x) => x + w)];
    });
  });
}
function P8(e, r) {
  let n = 1 + r();
  return sh(n, 1 + e, r).map((o) => [o[0], o.slice(1)]);
}
function I8(e) {
  let r = [], n = ss(e);
  return o(i([]), []), r;
  function i(u) {
    let c = e(), l = is(() => {
      let h = ss(e).map((g) => n[g]);
      if (h.length) return i(h);
    });
    return { S: c, B: l, Q: u };
  }
  function o({ S: u, B: c }, l, h) {
    if (!(u & 4 && h === l[l.length - 1])) {
      u & 2 && (h = l[l.length - 1]), u & 1 && r.push(l);
      for (let g of c)
        for (let m of g.Q)
          o(g, [...l, m], h);
    }
  }
}
function S8(e) {
  return e.toString(16).toUpperCase().padStart(2, "0");
}
function ih(e) {
  return `{${S8(e)}}`;
}
function B8(e) {
  let r = [];
  for (let n = 0, i = e.length; n < i; ) {
    let o = e.codePointAt(n);
    n += o < 65536 ? 1 : 2, r.push(o);
  }
  return r;
}
function br(e) {
  let n = e.length;
  if (n < 4096) return String.fromCodePoint(...e);
  let i = [];
  for (let o = 0; o < n; )
    i.push(String.fromCodePoint(...e.slice(o, o += 4096)));
  return i.join("");
}
function R8(e, r) {
  let n = e.length, i = n - r.length;
  for (let o = 0; i == 0 && o < n; o++) i = e[o] - r[o];
  return i;
}
var C8 = "AEUDWAHSCGYATwDVADIAdgAiADQAFAAtABQAIQAPACcADQASAAsAGQAJABIACQARAAUACwAFAAwABQAQAAMABwAEAAoABQAJAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACwANAA0AAwAKAAkABAAdAAYAZwDTAecDNACxCmIB8xhZ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od28QM4pbaMvVJigD/w3BrsjSJrXlqc4ulBYOCceiBN4b/gHajYyupbhEt63a619Ay4wsL6a6w6B+A7TnoyE7BliWHJfzVxxIKM/W3M/J8Bx99Op863Q8eNuIMGRx++VbYfjm+VGYBA3Ap/KEu/wxBNBpJJncwHPG45V8Gh98ZIrGCc20MwijGowZbcS7d1nEgcOW5cddZpHL2XPAIRbColiheZzXTvBxZOY3iMSDSKDrICyJ/iQs1vdplVdH/JrLJsQ2jtTnfCrITIghq3KFX3qAgLWAIp8IffNSdTYptnbGfc8s+qcr3zyzyHp1aJg+jxTF4kD1ry5Wauv5V3xnOGwTFecNzXSLHBW20/pCQjk4uorD0plIhMSTc79+/r4RKPClRYTBYex1Ob5crtfvRQBBv6re/6FhtCqtduag67glqRA77/3ulblh9YRtMdDxkCyJDeNnAuCLPQFmdRRWJtH20Z8DstfJf+5oj5SSB64d0iF5/Ya4KfTWxfivj9Ap2/zbYaTo/1gO3tM6RYsCZharMBFr7Fm61mLSrQnEI4OF1gbVS4k/JE9UotOrnLJZuswoWodCSV8zbybkJSVIP7n8UaE9xCR39rJZmf27HOAPVOGc9pdkQUcRrI0qyVF9Z3j1RHDbxIfwbWzmPVjwIdPJvtmBYwEQIUsIW1S939hcVikK00ozPRI02cqhzVUNzpOxVdrwRPvlh1aIOf0xFEqD3YkGnCnFah/cFN3J2gB7N+bZSGawwkKFu1tpQMrp1W+27YNkyT0TpcFpTqgOqqLabrgcCUPxh97mREOGy4xItzQ9xSl6rq+8BZsHcrQFReS+QeMxJ3P6CnL9EP/eOLDjumLhvrcQrpPiknsofbzBv9gTP0lU+TIVwE6E7CcKfT36q+ZiEOHJ9ayf0dyUJLezAb2M8aNHwd0+OJmsVgTzRWA";
const os = 44032, Ti = 4352, Pi = 4449, Ii = 4519, oh = 19, ah = 21, Ar = 28, Si = ah * Ar, _8 = oh * Si, D8 = os + _8, N8 = Ti + oh, O8 = Pi + ah, L8 = Ii + Ar;
function qr(e) {
  return e >> 24 & 255;
}
function uh(e) {
  return e & 16777215;
}
let iu, ll, ou, pi;
function M8() {
  let e = th(C8);
  iu = new Map(nh(e).flatMap((r, n) => r.map((i) => [i, n + 1 << 24]))), ll = new Set(ss(e)), ou = /* @__PURE__ */ new Map(), pi = /* @__PURE__ */ new Map();
  for (let [r, n] of rh(e)) {
    if (!ll.has(r) && n.length == 2) {
      let [i, o] = n, u = pi.get(i);
      u || (u = /* @__PURE__ */ new Map(), pi.set(i, u)), u.set(o, r);
    }
    ou.set(r, n.reverse());
  }
}
function ch(e) {
  return e >= os && e < D8;
}
function F8(e, r) {
  if (e >= Ti && e < N8 && r >= Pi && r < O8)
    return os + (e - Ti) * Si + (r - Pi) * Ar;
  if (ch(e) && r > Ii && r < L8 && (e - os) % Ar == 0)
    return e + (r - Ii);
  {
    let n = pi.get(e);
    return n && (n = n.get(r), n) ? n : -1;
  }
}
function fh(e) {
  iu || M8();
  let r = [], n = [], i = !1;
  function o(u) {
    let c = iu.get(u);
    c && (i = !0, u |= c), r.push(u);
  }
  for (let u of e)
    for (; ; ) {
      if (u < 128)
        r.push(u);
      else if (ch(u)) {
        let c = u - os, l = c / Si | 0, h = c % Si / Ar | 0, g = c % Ar;
        o(Ti + l), o(Pi + h), g > 0 && o(Ii + g);
      } else {
        let c = ou.get(u);
        c ? n.push(...c) : o(u);
      }
      if (!n.length) break;
      u = n.pop();
    }
  if (i && r.length > 1) {
    let u = qr(r[0]);
    for (let c = 1; c < r.length; c++) {
      let l = qr(r[c]);
      if (l == 0 || u <= l) {
        u = l;
        continue;
      }
      let h = c - 1;
      for (; ; ) {
        let g = r[h + 1];
        if (r[h + 1] = r[h], r[h] = g, !h || (u = qr(r[--h]), u <= l)) break;
      }
      u = qr(r[c]);
    }
  }
  return r;
}
function U8(e) {
  let r = [], n = [], i = -1, o = 0;
  for (let u of e) {
    let c = qr(u), l = uh(u);
    if (i == -1)
      c == 0 ? i = l : r.push(l);
    else if (o > 0 && o >= c)
      c == 0 ? (r.push(i, ...n), n.length = 0, i = l) : n.push(l), o = c;
    else {
      let h = F8(i, l);
      h >= 0 ? i = h : o == 0 && c == 0 ? (r.push(i), i = l) : (n.push(l), o = c);
    }
  }
  return i >= 0 && r.push(i, ...n), r;
}
function lh(e) {
  return fh(e).map(uh);
}
function k8(e) {
  return U8(fh(e));
}
const dl = 45, dh = ".", hh = 65039, ph = 1, Bi = (e) => Array.from(e);
function as(e, r) {
  return e.P.has(r) || e.Q.has(r);
}
class G8 extends Array {
  get is_emoji() {
    return !0;
  }
  // free tagging system
}
let au, gh, Mn, uu, mh, dr, Ba, ur, On, hl, cu;
function Gu() {
  if (au) return;
  let e = th(A8);
  const r = () => ss(e), n = () => new Set(r()), i = (m, y) => y.forEach((w) => m.add(w));
  au = new Map(rh(e)), gh = n(), Mn = r(), uu = new Set(r().map((m) => Mn[m])), Mn = new Set(Mn), mh = n(), n();
  let o = nh(e), u = e();
  const c = () => {
    let m = /* @__PURE__ */ new Set();
    return r().forEach((y) => i(m, o[y])), i(m, r()), m;
  };
  dr = is((m) => {
    let y = is(e).map((w) => w + 96);
    if (y.length) {
      let w = m >= u;
      y[0] -= 32, y = br(y), w && (y = `Restricted[${y}]`);
      let x = c(), I = c(), R = !e();
      return { N: y, P: x, Q: I, M: R, R: w };
    }
  }), Ba = n(), ur = /* @__PURE__ */ new Map();
  let l = r().concat(Bi(Ba)).sort((m, y) => m - y);
  l.forEach((m, y) => {
    let w = e(), x = l[y] = w ? l[y - w] : { V: [], M: /* @__PURE__ */ new Map() };
    x.V.push(m), Ba.has(m) || ur.set(m, x);
  });
  for (let { V: m, M: y } of new Set(ur.values())) {
    let w = [];
    for (let I of m) {
      let R = dr.filter((S) => as(S, I)), O = w.find(({ G: S }) => R.some((G) => S.has(G)));
      O || (O = { G: /* @__PURE__ */ new Set(), V: [] }, w.push(O)), O.V.push(I), i(O.G, R);
    }
    let x = w.flatMap((I) => Bi(I.G));
    for (let { G: I, V: R } of w) {
      let O = new Set(x.filter((S) => !I.has(S)));
      for (let S of R)
        y.set(S, O);
    }
  }
  On = /* @__PURE__ */ new Set();
  let h = /* @__PURE__ */ new Set();
  const g = (m) => On.has(m) ? h.add(m) : On.add(m);
  for (let m of dr) {
    for (let y of m.P) g(y);
    for (let y of m.Q) g(y);
  }
  for (let m of On)
    !ur.has(m) && !h.has(m) && ur.set(m, ph);
  i(On, lh(On)), hl = I8(e).map((m) => G8.from(m)).sort(R8), cu = /* @__PURE__ */ new Map();
  for (let m of hl) {
    let y = [cu];
    for (let w of m) {
      let x = y.map((I) => {
        let R = I.get(w);
        return R || (R = /* @__PURE__ */ new Map(), I.set(w, R)), R;
      });
      w === hh ? y.push(...x) : y = x;
    }
    for (let w of y)
      w.V = m;
  }
}
function Hu(e) {
  return (bh(e) ? "" : `${Qu(zi([e]))} `) + ih(e);
}
function Qu(e) {
  return `"${e}"‎`;
}
function H8(e) {
  if (e.length >= 4 && e[2] == dl && e[3] == dl)
    throw new Error(`invalid label extension: "${br(e.slice(0, 4))}"`);
}
function Q8(e) {
  for (let n = e.lastIndexOf(95); n > 0; )
    if (e[--n] !== 95)
      throw new Error("underscore allowed only at start");
}
function z8(e) {
  let r = e[0], n = cl.get(r);
  if (n) throw Yr(`leading ${n}`);
  let i = e.length, o = -1;
  for (let u = 1; u < i; u++) {
    r = e[u];
    let c = cl.get(r);
    if (c) {
      if (o == u) throw Yr(`${n} + ${c}`);
      o = u + 1, n = c;
    }
  }
  if (o == i) throw Yr(`trailing ${n}`);
}
function zi(e, r = 1 / 0, n = ih) {
  let i = [];
  $8(e[0]) && i.push("◌"), e.length > r && (r >>= 1, e = [...e.slice(0, r), 8230, ...e.slice(-r)]);
  let o = 0, u = e.length;
  for (let c = 0; c < u; c++) {
    let l = e[c];
    bh(l) && (i.push(br(e.slice(o, c))), i.push(n(l)), o = c + 1);
  }
  return i.push(br(e.slice(o, u))), i.join("");
}
function $8(e, r) {
  return Gu(), Mn.has(e);
}
function bh(e) {
  return Gu(), mh.has(e);
}
function W8(e) {
  return q8(V8(e, k8, X8));
}
function V8(e, r, n) {
  if (!e) return [];
  Gu();
  let i = 0;
  return e.split(dh).map((o) => {
    let u = B8(o), c = {
      input: u,
      offset: i
      // codepoint, not substring!
    };
    i += u.length + 1;
    try {
      let l = c.tokens = Y8(u, r, n), h = l.length, g;
      if (!h)
        throw new Error("empty label");
      let m = c.output = l.flat();
      if (Q8(m), !(c.emoji = h > 1 || l[0].is_emoji) && m.every((w) => w < 128))
        H8(m), g = "ASCII";
      else {
        let w = l.flatMap((x) => x.is_emoji ? [] : x);
        if (!w.length)
          g = "Emoji";
        else {
          if (Mn.has(m[0])) throw Yr("leading combining mark");
          for (let R = 1; R < h; R++) {
            let O = l[R];
            if (!O.is_emoji && Mn.has(O[0]))
              throw Yr(`emoji + combining mark: "${br(l[R - 1])} + ${zi([O[0]])}"`);
          }
          z8(m);
          let x = Bi(new Set(w)), [I] = J8(x);
          K8(I, w), j8(I, x), g = I.N;
        }
      }
      c.type = g;
    } catch (l) {
      c.error = l;
    }
    return c;
  });
}
function j8(e, r) {
  let n, i = [];
  for (let o of r) {
    let u = ur.get(o);
    if (u === ph) return;
    if (u) {
      let c = u.M.get(o);
      if (n = n ? n.filter((l) => c.has(l)) : Bi(c), !n.length) return;
    } else
      i.push(o);
  }
  if (n) {
    for (let o of n)
      if (i.every((u) => as(o, u)))
        throw new Error(`whole-script confusable: ${e.N}/${o.N}`);
  }
}
function J8(e) {
  let r = dr;
  for (let n of e) {
    let i = r.filter((o) => as(o, n));
    if (!i.length)
      throw dr.some((o) => as(o, n)) ? yh(r[0], n) : Ah(n);
    if (r = i, i.length == 1) break;
  }
  return r;
}
function q8(e) {
  return e.map(({ input: r, error: n, output: i }) => {
    if (n) {
      let o = n.message;
      throw new Error(e.length == 1 ? o : `Invalid label ${Qu(zi(r, 63))}: ${o}`);
    }
    return br(i);
  }).join(dh);
}
function Ah(e) {
  return new Error(`disallowed character: ${Hu(e)}`);
}
function yh(e, r) {
  let n = Hu(r), i = dr.find((o) => o.P.has(r));
  return i && (n = `${i.N} ${n}`), new Error(`illegal mixture: ${e.N} + ${n}`);
}
function Yr(e) {
  return new Error(`illegal placement: ${e}`);
}
function K8(e, r) {
  for (let n of r)
    if (!as(e, n))
      throw yh(e, n);
  if (e.M) {
    let n = lh(r);
    for (let i = 1, o = n.length; i < o; i++)
      if (uu.has(n[i])) {
        let u = i + 1;
        for (let c; u < o && uu.has(c = n[u]); u++)
          for (let l = i; l < u; l++)
            if (n[l] == c)
              throw new Error(`duplicate non-spacing marks: ${Hu(c)}`);
        if (u - i > fl)
          throw new Error(`excessive non-spacing marks: ${Qu(zi(n.slice(i - 1, u)))} (${u - i}/${fl})`);
        i = u;
      }
  }
}
function Y8(e, r, n) {
  let i = [], o = [];
  for (e = e.slice().reverse(); e.length; ) {
    let u = Z8(e);
    if (u)
      o.length && (i.push(r(o)), o = []), i.push(n(u));
    else {
      let c = e.pop();
      if (On.has(c))
        o.push(c);
      else {
        let l = au.get(c);
        if (l)
          o.push(...l);
        else if (!gh.has(c))
          throw Ah(c);
      }
    }
  }
  return o.length && i.push(r(o)), i;
}
function X8(e) {
  return e.filter((r) => r != hh);
}
function Z8(e, r) {
  let n = cu, i, o = e.length;
  for (; o && (n = n.get(e[--o]), !!n); ) {
    let { V: u } = n;
    u && (i = u, e.length = o);
  }
  return i;
}
var fi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function ev(e) {
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
function tv(e) {
  return W8(e);
}
function nv(e) {
  return tv(e);
}
const rv = async (e) => {
  try {
    const r = await $n(_e.ETH);
    return await PE(r, {
      name: nv(e)
    });
  } catch {
    return;
  }
}, sv = async (e, r, n, i) => {
  try {
    const o = await $n(_e.ETH), u = await $n(_e.POL), c = eu(e), l = [];
    if (n) {
      const g = wE[r], m = yE[n];
      g && (i && l.push(`token.${g}.${m}.${i}.address`), m && l.push(`token.${g}.${m}.address`), l.push(`token.${g}.address`));
    }
    const h = AE[r];
    l.push(`crypto.${h}.address`);
    for (const g of l) {
      const m = await pl(u, { name: c, key: g }) || await pl(o, { name: c, key: g });
      if (m)
        return m;
    }
    return;
  } catch {
    return;
  }
};
async function pl(e, r) {
  var x;
  const { name: n, key: i } = r, o = (x = e.chain) == null ? void 0 : x.id;
  if (!o)
    throw new Error("Chain ID not available");
  const u = bE(o);
  if (!u)
    throw new Error(`UNS contracts are not deployed on chain ${o}`);
  const c = se(e, Tn, "readContract"), l = {
    abi: X0,
    address: u,
    functionName: "exists",
    args: [BigInt(n)]
  };
  if (!await c(l))
    return;
  const g = {
    abi: X0,
    address: u,
    functionName: "getData",
    args: [[i], BigInt(n)]
  }, m = await c(g), [, , y] = m, w = y[0];
  if (!(w === "0x" || w === "" || xr(w) === "0x00"))
    return w;
}
async function iv(e, r, n) {
  return await rv(e) || await sv(e, Se.EVM, r, n);
}
function f3(e) {
  const r = e ?? {};
  return {
    get type() {
      return Se.EVM;
    },
    get options() {
      return r;
    },
    isAddress: S5,
    resolveAddress: iv,
    getBalance: g8,
    getWalletClient: r.getWalletClient,
    async getStepExecutor(n) {
      var u;
      if (!r.getWalletClient)
        throw new Error("Client is not provided.");
      const i = await r.getWalletClient();
      return new p8({
        client: i,
        routeId: n.routeId,
        executionOptions: {
          ...n.executionOptions,
          switchChainHook: r.switchChain ?? ((u = n.executionOptions) == null ? void 0 : u.switchChainHook)
        }
      });
    },
    setOptions(n) {
      Object.assign(r, n);
    }
  };
}
const ov = (e) => {
  for (let r = 0; r < e.steps.length; r++) {
    const n = e.steps[r];
    if (n.execution) {
      const i = n.execution.process.findLastIndex((o) => {
        var u;
        return (!!o.txHash || !!o.taskId || !!((u = o.signedTypedData) != null && u.length)) && o.status !== "FAILED";
      });
      i >= 0 ? n.execution.process = n.execution.process.slice(0, i + 1) : n.execution.process = [];
    }
    n.transactionRequest = void 0;
  }
}, wh = async (e, r) => {
  var o;
  const n = structuredClone(e);
  let i = (o = Ot.get(n.id)) == null ? void 0 : o.promise;
  return i || (Ot.create({ route: n, executionOptions: r }), i = uv(n), Ot.update({
    route: n,
    promise: i
  }), i);
}, av = async (e, r) => {
  const n = Ot.get(e.id);
  if (n && !n.executors.some((o) => !o.allowExecution)) {
    if (zu(e, {
      executeInBackground: r == null ? void 0 : r.executeInBackground
    }), !n.promise)
      throw new Error("Route execution promise not found.");
    return n.promise;
  }
  return ov(e), wh(e, r);
}, uv = async (e) => {
  var r, n, i, o;
  for (let u = 0; u < e.steps.length; u++) {
    const c = Ot.get(e.id);
    if (!c)
      break;
    const l = e.steps[u], h = e.steps[u - 1];
    if (((r = l.execution) == null ? void 0 : r.status) !== "DONE") {
      (n = h == null ? void 0 : h.execution) != null && n.toAmount && (l.action.fromAmount = h.execution.toAmount, (i = l.includedSteps) != null && i.length && (l.includedSteps[0].action.fromAmount = h.execution.toAmount));
      try {
        const g = l.action.fromAddress;
        if (!g)
          throw new Error("Action fromAddress is not specified.");
        const m = ye.get().providers.find((x) => x.isAddress(g));
        if (!m)
          throw new tu(ie.ProviderUnavailable, "SDK Execution Provider not found.");
        const y = await m.getStepExecutor({
          routeId: e.id,
          executionOptions: c.executionOptions
        });
        if (c.executors.push(y), c.executionOptions && zu(e, c.executionOptions), ((o = (await y.executeStep(l)).execution) == null ? void 0 : o.status) !== "DONE" && fu(e), !y.allowExecution)
          return e;
      } catch (g) {
        throw fu(e), g;
      }
    }
  }
  return Ot.delete(e.id), e;
}, zu = (e, r) => {
  const n = Ot.get(e.id);
  if (n) {
    if ("executeInBackground" in r)
      for (const i of n.executors)
        i.setInteraction({
          allowInteraction: !(r != null && r.executeInBackground),
          allowUpdates: !0
        });
    n.executionOptions = {
      ...n.executionOptions,
      ...r
    };
  }
}, fu = (e) => {
  const r = Ot.get(e.id);
  if (!r)
    return e;
  for (const n of r.executors)
    n.setInteraction({
      allowInteraction: !1,
      allowUpdates: !1,
      allowExecution: !1
    });
  return Ot.delete(e.id), r.route;
}, cv = async (e, r) => {
  try {
    (await (await fetch(`https://registry.npmjs.org/${e ?? Jd}/latest`)).json()).version > (r ?? ts);
  } catch {
  }
};
function fv(e) {
  if (!e.integrator)
    throw new Error("Integrator not found. Please see documentation https://docs.li.fi/integrate-li.fi-js-sdk/set-up-the-sdk");
  const r = ye.set(e);
  return !e.disableVersionCheck && process.env.NODE_ENV === "development" && cv(Jd, ts), r;
}
async function lv() {
  ye.loading = qd({
    chainTypes: [Se.EVM, Se.SVM, Se.UTXO, Se.MVM]
  }).then((e) => ye.setChains(e)).catch(), await ye.loading;
}
function dv(e) {
  const r = fv(e);
  return r.preloadChains && lv(), r;
}
const hv = (e) => {
  var n, i;
  if (!e.estimate.fromAmountUSD)
    throw new Ft(new sn("Missing 'fromAmountUSD' in step estimate."));
  if (!e.estimate.toAmountUSD)
    throw new Ft(new sn("Missing 'toAmountUSD' in step estimate."));
  return {
    id: e.id,
    fromChainId: e.action.fromToken.chainId,
    fromToken: e.action.fromToken,
    fromAmount: e.action.fromAmount,
    fromAmountUSD: e.estimate.fromAmountUSD,
    fromAddress: e.action.fromAddress,
    toChainId: e.action.toToken.chainId,
    toToken: e.action.toToken,
    toAmount: e.estimate.toAmount,
    toAmountMin: e.estimate.toAmountMin,
    toAmountUSD: e.estimate.toAmountUSD,
    toAddress: e.action.toAddress || e.action.fromAddress,
    gasCostUSD: ((i = (n = e.estimate.gasCosts) == null ? void 0 : n[0]) == null ? void 0 : i.amountUSD) || "0",
    steps: [e],
    insurance: { state: "NOT_INSURABLE", feeAmountUsd: "0" }
  };
};
function l3(e) {
  if (!e.integrator)
    throw new Error("Integrator name is required");
  return Hn.set(e);
}
const Hn = /* @__PURE__ */ (() => {
  const e = {
    integrator: "zksync easy-onramp",
    apiUrl: "https://easy-onramp-api.zksync.dev/api",
    services: [],
    provider: null,
    dev: !1
  };
  return {
    get() {
      return e;
    },
    set(r) {
      const { ...n } = r;
      return Object.assign(e, n), r.provider && dv({
        integrator: "ZKsync Easy OnRamp",
        providers: [r.provider]
      }), e;
    }
  };
})();
async function d3(e) {
  const r = Hn.get().apiUrl, n = new URL(`${r}/quotes`), i = new URLSearchParams();
  i.append("to", e.toAddress), i.append("chainId", e.chainId.toString()), i.append("token", e.toToken), i.append("routeType", "buy");
  const o = Hn.get().services;
  if (o.length > 0 && i.append("services", o.join(",")), e.fiatCurrency && i.append("fiatCurrency", e.fiatCurrency), e.fiatAmount && i.append("fiatAmount", e.fiatAmount.toString()), Hn.get().dev && i.append("dev", "true"), typeof window < "u" && window.location) {
    const c = `${window.location.protocol}//${window.location.host}`;
    i.append("domain", c);
  }
  return await fetch(`${n}?${i.toString()}`).then((c) => c.json()).then((c) => c).catch((c) => {
    throw c;
  });
}
async function h3() {
  const e = Hn.get().apiUrl, r = new URL(`${e}/config`);
  return await fetch(r).then((i) => i.json()).then((i) => i).catch((i) => {
    throw i;
  });
}
var Kr = { exports: {} };
/**
 * @license
 * Lodash <https://lodash.com/>
 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
 * Released under MIT license <https://lodash.com/license>
 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 */
var pv = Kr.exports, gl;
function gv() {
  return gl || (gl = 1, (function(e, r) {
    (function() {
      var n, i = "4.17.21", o = 200, u = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", c = "Expected a function", l = "Invalid `variable` option passed into `_.template`", h = "__lodash_hash_undefined__", g = 500, m = "__lodash_placeholder__", y = 1, w = 2, x = 4, I = 1, R = 2, O = 1, S = 2, G = 4, Q = 8, _ = 16, T = 32, C = 64, k = 128, F = 256, $ = 512, W = 30, ne = "...", ce = 800, fe = 16, we = 1, je = 2, Le = 3, ze = 1 / 0, xe = 9007199254740991, bt = 17976931348623157e292, at = NaN, Ze = 4294967295, Vu = Ze - 1, vr = Ze >>> 1, $i = [
        ["ary", k],
        ["bind", O],
        ["bindKey", S],
        ["curry", Q],
        ["curryRight", _],
        ["flip", $],
        ["partial", T],
        ["partialRight", C],
        ["rearg", F]
      ], kt = "[object Arguments]", et = "[object Array]", Oh = "[object AsyncFunction]", Tr = "[object Boolean]", Pr = "[object Date]", Lh = "[object DOMException]", ms = "[object Error]", bs = "[object Function]", ju = "[object GeneratorFunction]", At = "[object Map]", Ir = "[object Number]", Mh = "[object Null]", Gt = "[object Object]", Ju = "[object Promise]", Fh = "[object Proxy]", Sr = "[object RegExp]", yt = "[object Set]", Br = "[object String]", As = "[object Symbol]", Uh = "[object Undefined]", Rr = "[object WeakMap]", kh = "[object WeakSet]", Cr = "[object ArrayBuffer]", Vn = "[object DataView]", Wi = "[object Float32Array]", Vi = "[object Float64Array]", ji = "[object Int8Array]", Ji = "[object Int16Array]", qi = "[object Int32Array]", Ki = "[object Uint8Array]", Yi = "[object Uint8ClampedArray]", Xi = "[object Uint16Array]", Zi = "[object Uint32Array]", Gh = /\b__p \+= '';/g, Hh = /\b(__p \+=) '' \+/g, Qh = /(__e\(.*?\)|\b__t\)) \+\n'';/g, qu = /&(?:amp|lt|gt|quot|#39);/g, Ku = /[&<>"']/g, zh = RegExp(qu.source), $h = RegExp(Ku.source), Wh = /<%-([\s\S]+?)%>/g, Vh = /<%([\s\S]+?)%>/g, Yu = /<%=([\s\S]+?)%>/g, jh = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Jh = /^\w*$/, qh = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, eo = /[\\^$.*+?()[\]{}|]/g, Kh = RegExp(eo.source), to = /^\s+/, Yh = /\s/, Xh = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, Zh = /\{\n\/\* \[wrapped with (.+)\] \*/, ep = /,? & /, tp = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, np = /[()=,{}\[\]\/\s]/, rp = /\\(\\)?/g, sp = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, Xu = /\w*$/, ip = /^[-+]0x[0-9a-f]+$/i, op = /^0b[01]+$/i, ap = /^\[object .+?Constructor\]$/, up = /^0o[0-7]+$/i, cp = /^(?:0|[1-9]\d*)$/, fp = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, ys = /($^)/, lp = /['\n\r\u2028\u2029\\]/g, ws = "\\ud800-\\udfff", dp = "\\u0300-\\u036f", hp = "\\ufe20-\\ufe2f", pp = "\\u20d0-\\u20ff", Zu = dp + hp + pp, ec = "\\u2700-\\u27bf", tc = "a-z\\xdf-\\xf6\\xf8-\\xff", gp = "\\xac\\xb1\\xd7\\xf7", mp = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", bp = "\\u2000-\\u206f", Ap = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", nc = "A-Z\\xc0-\\xd6\\xd8-\\xde", rc = "\\ufe0e\\ufe0f", sc = gp + mp + bp + Ap, no = "['’]", yp = "[" + ws + "]", ic = "[" + sc + "]", Es = "[" + Zu + "]", oc = "\\d+", wp = "[" + ec + "]", ac = "[" + tc + "]", uc = "[^" + ws + sc + oc + ec + tc + nc + "]", ro = "\\ud83c[\\udffb-\\udfff]", Ep = "(?:" + Es + "|" + ro + ")", cc = "[^" + ws + "]", so = "(?:\\ud83c[\\udde6-\\uddff]){2}", io = "[\\ud800-\\udbff][\\udc00-\\udfff]", jn = "[" + nc + "]", fc = "\\u200d", lc = "(?:" + ac + "|" + uc + ")", xp = "(?:" + jn + "|" + uc + ")", dc = "(?:" + no + "(?:d|ll|m|re|s|t|ve))?", hc = "(?:" + no + "(?:D|LL|M|RE|S|T|VE))?", pc = Ep + "?", gc = "[" + rc + "]?", vp = "(?:" + fc + "(?:" + [cc, so, io].join("|") + ")" + gc + pc + ")*", Tp = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", Pp = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", mc = gc + pc + vp, Ip = "(?:" + [wp, so, io].join("|") + ")" + mc, Sp = "(?:" + [cc + Es + "?", Es, so, io, yp].join("|") + ")", Bp = RegExp(no, "g"), Rp = RegExp(Es, "g"), oo = RegExp(ro + "(?=" + ro + ")|" + Sp + mc, "g"), Cp = RegExp([
        jn + "?" + ac + "+" + dc + "(?=" + [ic, jn, "$"].join("|") + ")",
        xp + "+" + hc + "(?=" + [ic, jn + lc, "$"].join("|") + ")",
        jn + "?" + lc + "+" + dc,
        jn + "+" + hc,
        Pp,
        Tp,
        oc,
        Ip
      ].join("|"), "g"), _p = RegExp("[" + fc + ws + Zu + rc + "]"), Dp = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, Np = [
        "Array",
        "Buffer",
        "DataView",
        "Date",
        "Error",
        "Float32Array",
        "Float64Array",
        "Function",
        "Int8Array",
        "Int16Array",
        "Int32Array",
        "Map",
        "Math",
        "Object",
        "Promise",
        "RegExp",
        "Set",
        "String",
        "Symbol",
        "TypeError",
        "Uint8Array",
        "Uint8ClampedArray",
        "Uint16Array",
        "Uint32Array",
        "WeakMap",
        "_",
        "clearTimeout",
        "isFinite",
        "parseInt",
        "setTimeout"
      ], Op = -1, me = {};
      me[Wi] = me[Vi] = me[ji] = me[Ji] = me[qi] = me[Ki] = me[Yi] = me[Xi] = me[Zi] = !0, me[kt] = me[et] = me[Cr] = me[Tr] = me[Vn] = me[Pr] = me[ms] = me[bs] = me[At] = me[Ir] = me[Gt] = me[Sr] = me[yt] = me[Br] = me[Rr] = !1;
      var ge = {};
      ge[kt] = ge[et] = ge[Cr] = ge[Vn] = ge[Tr] = ge[Pr] = ge[Wi] = ge[Vi] = ge[ji] = ge[Ji] = ge[qi] = ge[At] = ge[Ir] = ge[Gt] = ge[Sr] = ge[yt] = ge[Br] = ge[As] = ge[Ki] = ge[Yi] = ge[Xi] = ge[Zi] = !0, ge[ms] = ge[bs] = ge[Rr] = !1;
      var Lp = {
        // Latin-1 Supplement block.
        À: "A",
        Á: "A",
        Â: "A",
        Ã: "A",
        Ä: "A",
        Å: "A",
        à: "a",
        á: "a",
        â: "a",
        ã: "a",
        ä: "a",
        å: "a",
        Ç: "C",
        ç: "c",
        Ð: "D",
        ð: "d",
        È: "E",
        É: "E",
        Ê: "E",
        Ë: "E",
        è: "e",
        é: "e",
        ê: "e",
        ë: "e",
        Ì: "I",
        Í: "I",
        Î: "I",
        Ï: "I",
        ì: "i",
        í: "i",
        î: "i",
        ï: "i",
        Ñ: "N",
        ñ: "n",
        Ò: "O",
        Ó: "O",
        Ô: "O",
        Õ: "O",
        Ö: "O",
        Ø: "O",
        ò: "o",
        ó: "o",
        ô: "o",
        õ: "o",
        ö: "o",
        ø: "o",
        Ù: "U",
        Ú: "U",
        Û: "U",
        Ü: "U",
        ù: "u",
        ú: "u",
        û: "u",
        ü: "u",
        Ý: "Y",
        ý: "y",
        ÿ: "y",
        Æ: "Ae",
        æ: "ae",
        Þ: "Th",
        þ: "th",
        ß: "ss",
        // Latin Extended-A block.
        Ā: "A",
        Ă: "A",
        Ą: "A",
        ā: "a",
        ă: "a",
        ą: "a",
        Ć: "C",
        Ĉ: "C",
        Ċ: "C",
        Č: "C",
        ć: "c",
        ĉ: "c",
        ċ: "c",
        č: "c",
        Ď: "D",
        Đ: "D",
        ď: "d",
        đ: "d",
        Ē: "E",
        Ĕ: "E",
        Ė: "E",
        Ę: "E",
        Ě: "E",
        ē: "e",
        ĕ: "e",
        ė: "e",
        ę: "e",
        ě: "e",
        Ĝ: "G",
        Ğ: "G",
        Ġ: "G",
        Ģ: "G",
        ĝ: "g",
        ğ: "g",
        ġ: "g",
        ģ: "g",
        Ĥ: "H",
        Ħ: "H",
        ĥ: "h",
        ħ: "h",
        Ĩ: "I",
        Ī: "I",
        Ĭ: "I",
        Į: "I",
        İ: "I",
        ĩ: "i",
        ī: "i",
        ĭ: "i",
        į: "i",
        ı: "i",
        Ĵ: "J",
        ĵ: "j",
        Ķ: "K",
        ķ: "k",
        ĸ: "k",
        Ĺ: "L",
        Ļ: "L",
        Ľ: "L",
        Ŀ: "L",
        Ł: "L",
        ĺ: "l",
        ļ: "l",
        ľ: "l",
        ŀ: "l",
        ł: "l",
        Ń: "N",
        Ņ: "N",
        Ň: "N",
        Ŋ: "N",
        ń: "n",
        ņ: "n",
        ň: "n",
        ŋ: "n",
        Ō: "O",
        Ŏ: "O",
        Ő: "O",
        ō: "o",
        ŏ: "o",
        ő: "o",
        Ŕ: "R",
        Ŗ: "R",
        Ř: "R",
        ŕ: "r",
        ŗ: "r",
        ř: "r",
        Ś: "S",
        Ŝ: "S",
        Ş: "S",
        Š: "S",
        ś: "s",
        ŝ: "s",
        ş: "s",
        š: "s",
        Ţ: "T",
        Ť: "T",
        Ŧ: "T",
        ţ: "t",
        ť: "t",
        ŧ: "t",
        Ũ: "U",
        Ū: "U",
        Ŭ: "U",
        Ů: "U",
        Ű: "U",
        Ų: "U",
        ũ: "u",
        ū: "u",
        ŭ: "u",
        ů: "u",
        ű: "u",
        ų: "u",
        Ŵ: "W",
        ŵ: "w",
        Ŷ: "Y",
        ŷ: "y",
        Ÿ: "Y",
        Ź: "Z",
        Ż: "Z",
        Ž: "Z",
        ź: "z",
        ż: "z",
        ž: "z",
        IJ: "IJ",
        ij: "ij",
        Œ: "Oe",
        œ: "oe",
        ʼn: "'n",
        ſ: "s"
      }, Mp = {
        "&": "&amp;",
        "<": "&lt;",
        ">": "&gt;",
        '"': "&quot;",
        "'": "&#39;"
      }, Fp = {
        "&amp;": "&",
        "&lt;": "<",
        "&gt;": ">",
        "&quot;": '"',
        "&#39;": "'"
      }, Up = {
        "\\": "\\",
        "'": "'",
        "\n": "n",
        "\r": "r",
        "\u2028": "u2028",
        "\u2029": "u2029"
      }, kp = parseFloat, Gp = parseInt, bc = typeof fi == "object" && fi && fi.Object === Object && fi, Hp = typeof self == "object" && self && self.Object === Object && self, Me = bc || Hp || Function("return this")(), ao = r && !r.nodeType && r, Pn = ao && !0 && e && !e.nodeType && e, Ac = Pn && Pn.exports === ao, uo = Ac && bc.process, ut = (function() {
        try {
          var v = Pn && Pn.require && Pn.require("util").types;
          return v || uo && uo.binding && uo.binding("util");
        } catch {
        }
      })(), yc = ut && ut.isArrayBuffer, wc = ut && ut.isDate, Ec = ut && ut.isMap, xc = ut && ut.isRegExp, vc = ut && ut.isSet, Tc = ut && ut.isTypedArray;
      function tt(v, D, B) {
        switch (B.length) {
          case 0:
            return v.call(D);
          case 1:
            return v.call(D, B[0]);
          case 2:
            return v.call(D, B[0], B[1]);
          case 3:
            return v.call(D, B[0], B[1], B[2]);
        }
        return v.apply(D, B);
      }
      function Qp(v, D, B, z) {
        for (var K = -1, le = v == null ? 0 : v.length; ++K < le; ) {
          var Re = v[K];
          D(z, Re, B(Re), v);
        }
        return z;
      }
      function ct(v, D) {
        for (var B = -1, z = v == null ? 0 : v.length; ++B < z && D(v[B], B, v) !== !1; )
          ;
        return v;
      }
      function zp(v, D) {
        for (var B = v == null ? 0 : v.length; B-- && D(v[B], B, v) !== !1; )
          ;
        return v;
      }
      function Pc(v, D) {
        for (var B = -1, z = v == null ? 0 : v.length; ++B < z; )
          if (!D(v[B], B, v))
            return !1;
        return !0;
      }
      function un(v, D) {
        for (var B = -1, z = v == null ? 0 : v.length, K = 0, le = []; ++B < z; ) {
          var Re = v[B];
          D(Re, B, v) && (le[K++] = Re);
        }
        return le;
      }
      function xs(v, D) {
        var B = v == null ? 0 : v.length;
        return !!B && Jn(v, D, 0) > -1;
      }
      function co(v, D, B) {
        for (var z = -1, K = v == null ? 0 : v.length; ++z < K; )
          if (B(D, v[z]))
            return !0;
        return !1;
      }
      function be(v, D) {
        for (var B = -1, z = v == null ? 0 : v.length, K = Array(z); ++B < z; )
          K[B] = D(v[B], B, v);
        return K;
      }
      function cn(v, D) {
        for (var B = -1, z = D.length, K = v.length; ++B < z; )
          v[K + B] = D[B];
        return v;
      }
      function fo(v, D, B, z) {
        var K = -1, le = v == null ? 0 : v.length;
        for (z && le && (B = v[++K]); ++K < le; )
          B = D(B, v[K], K, v);
        return B;
      }
      function $p(v, D, B, z) {
        var K = v == null ? 0 : v.length;
        for (z && K && (B = v[--K]); K--; )
          B = D(B, v[K], K, v);
        return B;
      }
      function lo(v, D) {
        for (var B = -1, z = v == null ? 0 : v.length; ++B < z; )
          if (D(v[B], B, v))
            return !0;
        return !1;
      }
      var Wp = ho("length");
      function Vp(v) {
        return v.split("");
      }
      function jp(v) {
        return v.match(tp) || [];
      }
      function Ic(v, D, B) {
        var z;
        return B(v, function(K, le, Re) {
          if (D(K, le, Re))
            return z = le, !1;
        }), z;
      }
      function vs(v, D, B, z) {
        for (var K = v.length, le = B + (z ? 1 : -1); z ? le-- : ++le < K; )
          if (D(v[le], le, v))
            return le;
        return -1;
      }
      function Jn(v, D, B) {
        return D === D ? i1(v, D, B) : vs(v, Sc, B);
      }
      function Jp(v, D, B, z) {
        for (var K = B - 1, le = v.length; ++K < le; )
          if (z(v[K], D))
            return K;
        return -1;
      }
      function Sc(v) {
        return v !== v;
      }
      function Bc(v, D) {
        var B = v == null ? 0 : v.length;
        return B ? go(v, D) / B : at;
      }
      function ho(v) {
        return function(D) {
          return D == null ? n : D[v];
        };
      }
      function po(v) {
        return function(D) {
          return v == null ? n : v[D];
        };
      }
      function Rc(v, D, B, z, K) {
        return K(v, function(le, Re, pe) {
          B = z ? (z = !1, le) : D(B, le, Re, pe);
        }), B;
      }
      function qp(v, D) {
        var B = v.length;
        for (v.sort(D); B--; )
          v[B] = v[B].value;
        return v;
      }
      function go(v, D) {
        for (var B, z = -1, K = v.length; ++z < K; ) {
          var le = D(v[z]);
          le !== n && (B = B === n ? le : B + le);
        }
        return B;
      }
      function mo(v, D) {
        for (var B = -1, z = Array(v); ++B < v; )
          z[B] = D(B);
        return z;
      }
      function Kp(v, D) {
        return be(D, function(B) {
          return [B, v[B]];
        });
      }
      function Cc(v) {
        return v && v.slice(0, Oc(v) + 1).replace(to, "");
      }
      function nt(v) {
        return function(D) {
          return v(D);
        };
      }
      function bo(v, D) {
        return be(D, function(B) {
          return v[B];
        });
      }
      function _r(v, D) {
        return v.has(D);
      }
      function _c(v, D) {
        for (var B = -1, z = v.length; ++B < z && Jn(D, v[B], 0) > -1; )
          ;
        return B;
      }
      function Dc(v, D) {
        for (var B = v.length; B-- && Jn(D, v[B], 0) > -1; )
          ;
        return B;
      }
      function Yp(v, D) {
        for (var B = v.length, z = 0; B--; )
          v[B] === D && ++z;
        return z;
      }
      var Xp = po(Lp), Zp = po(Mp);
      function e1(v) {
        return "\\" + Up[v];
      }
      function t1(v, D) {
        return v == null ? n : v[D];
      }
      function qn(v) {
        return _p.test(v);
      }
      function n1(v) {
        return Dp.test(v);
      }
      function r1(v) {
        for (var D, B = []; !(D = v.next()).done; )
          B.push(D.value);
        return B;
      }
      function Ao(v) {
        var D = -1, B = Array(v.size);
        return v.forEach(function(z, K) {
          B[++D] = [K, z];
        }), B;
      }
      function Nc(v, D) {
        return function(B) {
          return v(D(B));
        };
      }
      function fn(v, D) {
        for (var B = -1, z = v.length, K = 0, le = []; ++B < z; ) {
          var Re = v[B];
          (Re === D || Re === m) && (v[B] = m, le[K++] = B);
        }
        return le;
      }
      function Ts(v) {
        var D = -1, B = Array(v.size);
        return v.forEach(function(z) {
          B[++D] = z;
        }), B;
      }
      function s1(v) {
        var D = -1, B = Array(v.size);
        return v.forEach(function(z) {
          B[++D] = [z, z];
        }), B;
      }
      function i1(v, D, B) {
        for (var z = B - 1, K = v.length; ++z < K; )
          if (v[z] === D)
            return z;
        return -1;
      }
      function o1(v, D, B) {
        for (var z = B + 1; z--; )
          if (v[z] === D)
            return z;
        return z;
      }
      function Kn(v) {
        return qn(v) ? u1(v) : Wp(v);
      }
      function wt(v) {
        return qn(v) ? c1(v) : Vp(v);
      }
      function Oc(v) {
        for (var D = v.length; D-- && Yh.test(v.charAt(D)); )
          ;
        return D;
      }
      var a1 = po(Fp);
      function u1(v) {
        for (var D = oo.lastIndex = 0; oo.test(v); )
          ++D;
        return D;
      }
      function c1(v) {
        return v.match(oo) || [];
      }
      function f1(v) {
        return v.match(Cp) || [];
      }
      var l1 = (function v(D) {
        D = D == null ? Me : Yn.defaults(Me.Object(), D, Yn.pick(Me, Np));
        var B = D.Array, z = D.Date, K = D.Error, le = D.Function, Re = D.Math, pe = D.Object, yo = D.RegExp, d1 = D.String, ft = D.TypeError, Ps = B.prototype, h1 = le.prototype, Xn = pe.prototype, Is = D["__core-js_shared__"], Ss = h1.toString, he = Xn.hasOwnProperty, p1 = 0, Lc = (function() {
          var t = /[^.]+$/.exec(Is && Is.keys && Is.keys.IE_PROTO || "");
          return t ? "Symbol(src)_1." + t : "";
        })(), Bs = Xn.toString, g1 = Ss.call(pe), m1 = Me._, b1 = yo(
          "^" + Ss.call(he).replace(eo, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
        ), Rs = Ac ? D.Buffer : n, ln = D.Symbol, Cs = D.Uint8Array, Mc = Rs ? Rs.allocUnsafe : n, _s = Nc(pe.getPrototypeOf, pe), Fc = pe.create, Uc = Xn.propertyIsEnumerable, Ds = Ps.splice, kc = ln ? ln.isConcatSpreadable : n, Dr = ln ? ln.iterator : n, In = ln ? ln.toStringTag : n, Ns = (function() {
          try {
            var t = _n(pe, "defineProperty");
            return t({}, "", {}), t;
          } catch {
          }
        })(), A1 = D.clearTimeout !== Me.clearTimeout && D.clearTimeout, y1 = z && z.now !== Me.Date.now && z.now, w1 = D.setTimeout !== Me.setTimeout && D.setTimeout, Os = Re.ceil, Ls = Re.floor, wo = pe.getOwnPropertySymbols, E1 = Rs ? Rs.isBuffer : n, Gc = D.isFinite, x1 = Ps.join, v1 = Nc(pe.keys, pe), Ce = Re.max, He = Re.min, T1 = z.now, P1 = D.parseInt, Hc = Re.random, I1 = Ps.reverse, Eo = _n(D, "DataView"), Nr = _n(D, "Map"), xo = _n(D, "Promise"), Zn = _n(D, "Set"), Or = _n(D, "WeakMap"), Lr = _n(pe, "create"), Ms = Or && new Or(), er = {}, S1 = Dn(Eo), B1 = Dn(Nr), R1 = Dn(xo), C1 = Dn(Zn), _1 = Dn(Or), Fs = ln ? ln.prototype : n, Mr = Fs ? Fs.valueOf : n, Qc = Fs ? Fs.toString : n;
        function p(t) {
          if (ve(t) && !Y(t) && !(t instanceof ae)) {
            if (t instanceof lt)
              return t;
            if (he.call(t, "__wrapped__"))
              return $f(t);
          }
          return new lt(t);
        }
        var tr = /* @__PURE__ */ (function() {
          function t() {
          }
          return function(s) {
            if (!Ee(s))
              return {};
            if (Fc)
              return Fc(s);
            t.prototype = s;
            var a = new t();
            return t.prototype = n, a;
          };
        })();
        function Us() {
        }
        function lt(t, s) {
          this.__wrapped__ = t, this.__actions__ = [], this.__chain__ = !!s, this.__index__ = 0, this.__values__ = n;
        }
        p.templateSettings = {
          /**
           * Used to detect `data` property values to be HTML-escaped.
           *
           * @memberOf _.templateSettings
           * @type {RegExp}
           */
          escape: Wh,
          /**
           * Used to detect code to be evaluated.
           *
           * @memberOf _.templateSettings
           * @type {RegExp}
           */
          evaluate: Vh,
          /**
           * Used to detect `data` property values to inject.
           *
           * @memberOf _.templateSettings
           * @type {RegExp}
           */
          interpolate: Yu,
          /**
           * Used to reference the data object in the template text.
           *
           * @memberOf _.templateSettings
           * @type {string}
           */
          variable: "",
          /**
           * Used to import variables into the compiled template.
           *
           * @memberOf _.templateSettings
           * @type {Object}
           */
          imports: {
            /**
             * A reference to the `lodash` function.
             *
             * @memberOf _.templateSettings.imports
             * @type {Function}
             */
            _: p
          }
        }, p.prototype = Us.prototype, p.prototype.constructor = p, lt.prototype = tr(Us.prototype), lt.prototype.constructor = lt;
        function ae(t) {
          this.__wrapped__ = t, this.__actions__ = [], this.__dir__ = 1, this.__filtered__ = !1, this.__iteratees__ = [], this.__takeCount__ = Ze, this.__views__ = [];
        }
        function D1() {
          var t = new ae(this.__wrapped__);
          return t.__actions__ = Je(this.__actions__), t.__dir__ = this.__dir__, t.__filtered__ = this.__filtered__, t.__iteratees__ = Je(this.__iteratees__), t.__takeCount__ = this.__takeCount__, t.__views__ = Je(this.__views__), t;
        }
        function N1() {
          if (this.__filtered__) {
            var t = new ae(this);
            t.__dir__ = -1, t.__filtered__ = !0;
          } else
            t = this.clone(), t.__dir__ *= -1;
          return t;
        }
        function O1() {
          var t = this.__wrapped__.value(), s = this.__dir__, a = Y(t), f = s < 0, d = a ? t.length : 0, b = Vg(0, d, this.__views__), A = b.start, E = b.end, P = E - A, N = f ? E : A - 1, L = this.__iteratees__, M = L.length, H = 0, V = He(P, this.__takeCount__);
          if (!a || !f && d == P && V == P)
            return hf(t, this.__actions__);
          var J = [];
          e:
            for (; P-- && H < V; ) {
              N += s;
              for (var ee = -1, q = t[N]; ++ee < M; ) {
                var oe = L[ee], ue = oe.iteratee, it = oe.type, Ve = ue(q);
                if (it == je)
                  q = Ve;
                else if (!Ve) {
                  if (it == we)
                    continue e;
                  break e;
                }
              }
              J[H++] = q;
            }
          return J;
        }
        ae.prototype = tr(Us.prototype), ae.prototype.constructor = ae;
        function Sn(t) {
          var s = -1, a = t == null ? 0 : t.length;
          for (this.clear(); ++s < a; ) {
            var f = t[s];
            this.set(f[0], f[1]);
          }
        }
        function L1() {
          this.__data__ = Lr ? Lr(null) : {}, this.size = 0;
        }
        function M1(t) {
          var s = this.has(t) && delete this.__data__[t];
          return this.size -= s ? 1 : 0, s;
        }
        function F1(t) {
          var s = this.__data__;
          if (Lr) {
            var a = s[t];
            return a === h ? n : a;
          }
          return he.call(s, t) ? s[t] : n;
        }
        function U1(t) {
          var s = this.__data__;
          return Lr ? s[t] !== n : he.call(s, t);
        }
        function k1(t, s) {
          var a = this.__data__;
          return this.size += this.has(t) ? 0 : 1, a[t] = Lr && s === n ? h : s, this;
        }
        Sn.prototype.clear = L1, Sn.prototype.delete = M1, Sn.prototype.get = F1, Sn.prototype.has = U1, Sn.prototype.set = k1;
        function Ht(t) {
          var s = -1, a = t == null ? 0 : t.length;
          for (this.clear(); ++s < a; ) {
            var f = t[s];
            this.set(f[0], f[1]);
          }
        }
        function G1() {
          this.__data__ = [], this.size = 0;
        }
        function H1(t) {
          var s = this.__data__, a = ks(s, t);
          if (a < 0)
            return !1;
          var f = s.length - 1;
          return a == f ? s.pop() : Ds.call(s, a, 1), --this.size, !0;
        }
        function Q1(t) {
          var s = this.__data__, a = ks(s, t);
          return a < 0 ? n : s[a][1];
        }
        function z1(t) {
          return ks(this.__data__, t) > -1;
        }
        function $1(t, s) {
          var a = this.__data__, f = ks(a, t);
          return f < 0 ? (++this.size, a.push([t, s])) : a[f][1] = s, this;
        }
        Ht.prototype.clear = G1, Ht.prototype.delete = H1, Ht.prototype.get = Q1, Ht.prototype.has = z1, Ht.prototype.set = $1;
        function Qt(t) {
          var s = -1, a = t == null ? 0 : t.length;
          for (this.clear(); ++s < a; ) {
            var f = t[s];
            this.set(f[0], f[1]);
          }
        }
        function W1() {
          this.size = 0, this.__data__ = {
            hash: new Sn(),
            map: new (Nr || Ht)(),
            string: new Sn()
          };
        }
        function V1(t) {
          var s = Ys(this, t).delete(t);
          return this.size -= s ? 1 : 0, s;
        }
        function j1(t) {
          return Ys(this, t).get(t);
        }
        function J1(t) {
          return Ys(this, t).has(t);
        }
        function q1(t, s) {
          var a = Ys(this, t), f = a.size;
          return a.set(t, s), this.size += a.size == f ? 0 : 1, this;
        }
        Qt.prototype.clear = W1, Qt.prototype.delete = V1, Qt.prototype.get = j1, Qt.prototype.has = J1, Qt.prototype.set = q1;
        function Bn(t) {
          var s = -1, a = t == null ? 0 : t.length;
          for (this.__data__ = new Qt(); ++s < a; )
            this.add(t[s]);
        }
        function K1(t) {
          return this.__data__.set(t, h), this;
        }
        function Y1(t) {
          return this.__data__.has(t);
        }
        Bn.prototype.add = Bn.prototype.push = K1, Bn.prototype.has = Y1;
        function Et(t) {
          var s = this.__data__ = new Ht(t);
          this.size = s.size;
        }
        function X1() {
          this.__data__ = new Ht(), this.size = 0;
        }
        function Z1(t) {
          var s = this.__data__, a = s.delete(t);
          return this.size = s.size, a;
        }
        function eg(t) {
          return this.__data__.get(t);
        }
        function tg(t) {
          return this.__data__.has(t);
        }
        function ng(t, s) {
          var a = this.__data__;
          if (a instanceof Ht) {
            var f = a.__data__;
            if (!Nr || f.length < o - 1)
              return f.push([t, s]), this.size = ++a.size, this;
            a = this.__data__ = new Qt(f);
          }
          return a.set(t, s), this.size = a.size, this;
        }
        Et.prototype.clear = X1, Et.prototype.delete = Z1, Et.prototype.get = eg, Et.prototype.has = tg, Et.prototype.set = ng;
        function zc(t, s) {
          var a = Y(t), f = !a && Nn(t), d = !a && !f && mn(t), b = !a && !f && !d && ir(t), A = a || f || d || b, E = A ? mo(t.length, d1) : [], P = E.length;
          for (var N in t)
            (s || he.call(t, N)) && !(A && // Safari 9 has enumerable `arguments.length` in strict mode.
            (N == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
            d && (N == "offset" || N == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
            b && (N == "buffer" || N == "byteLength" || N == "byteOffset") || // Skip index properties.
            Vt(N, P))) && E.push(N);
          return E;
        }
        function $c(t) {
          var s = t.length;
          return s ? t[No(0, s - 1)] : n;
        }
        function rg(t, s) {
          return Xs(Je(t), Rn(s, 0, t.length));
        }
        function sg(t) {
          return Xs(Je(t));
        }
        function vo(t, s, a) {
          (a !== n && !xt(t[s], a) || a === n && !(s in t)) && zt(t, s, a);
        }
        function Fr(t, s, a) {
          var f = t[s];
          (!(he.call(t, s) && xt(f, a)) || a === n && !(s in t)) && zt(t, s, a);
        }
        function ks(t, s) {
          for (var a = t.length; a--; )
            if (xt(t[a][0], s))
              return a;
          return -1;
        }
        function ig(t, s, a, f) {
          return dn(t, function(d, b, A) {
            s(f, d, a(d), A);
          }), f;
        }
        function Wc(t, s) {
          return t && Rt(s, Ne(s), t);
        }
        function og(t, s) {
          return t && Rt(s, Ke(s), t);
        }
        function zt(t, s, a) {
          s == "__proto__" && Ns ? Ns(t, s, {
            configurable: !0,
            enumerable: !0,
            value: a,
            writable: !0
          }) : t[s] = a;
        }
        function To(t, s) {
          for (var a = -1, f = s.length, d = B(f), b = t == null; ++a < f; )
            d[a] = b ? n : sa(t, s[a]);
          return d;
        }
        function Rn(t, s, a) {
          return t === t && (a !== n && (t = t <= a ? t : a), s !== n && (t = t >= s ? t : s)), t;
        }
        function dt(t, s, a, f, d, b) {
          var A, E = s & y, P = s & w, N = s & x;
          if (a && (A = d ? a(t, f, d, b) : a(t)), A !== n)
            return A;
          if (!Ee(t))
            return t;
          var L = Y(t);
          if (L) {
            if (A = Jg(t), !E)
              return Je(t, A);
          } else {
            var M = Qe(t), H = M == bs || M == ju;
            if (mn(t))
              return mf(t, E);
            if (M == Gt || M == kt || H && !d) {
              if (A = P || H ? {} : Lf(t), !E)
                return P ? Fg(t, og(A, t)) : Mg(t, Wc(A, t));
            } else {
              if (!ge[M])
                return d ? t : {};
              A = qg(t, M, E);
            }
          }
          b || (b = new Et());
          var V = b.get(t);
          if (V)
            return V;
          b.set(t, A), f0(t) ? t.forEach(function(q) {
            A.add(dt(q, s, a, q, t, b));
          }) : u0(t) && t.forEach(function(q, oe) {
            A.set(oe, dt(q, s, a, oe, t, b));
          });
          var J = N ? P ? $o : zo : P ? Ke : Ne, ee = L ? n : J(t);
          return ct(ee || t, function(q, oe) {
            ee && (oe = q, q = t[oe]), Fr(A, oe, dt(q, s, a, oe, t, b));
          }), A;
        }
        function ag(t) {
          var s = Ne(t);
          return function(a) {
            return Vc(a, t, s);
          };
        }
        function Vc(t, s, a) {
          var f = a.length;
          if (t == null)
            return !f;
          for (t = pe(t); f--; ) {
            var d = a[f], b = s[d], A = t[d];
            if (A === n && !(d in t) || !b(A))
              return !1;
          }
          return !0;
        }
        function jc(t, s, a) {
          if (typeof t != "function")
            throw new ft(c);
          return $r(function() {
            t.apply(n, a);
          }, s);
        }
        function Ur(t, s, a, f) {
          var d = -1, b = xs, A = !0, E = t.length, P = [], N = s.length;
          if (!E)
            return P;
          a && (s = be(s, nt(a))), f ? (b = co, A = !1) : s.length >= o && (b = _r, A = !1, s = new Bn(s));
          e:
            for (; ++d < E; ) {
              var L = t[d], M = a == null ? L : a(L);
              if (L = f || L !== 0 ? L : 0, A && M === M) {
                for (var H = N; H--; )
                  if (s[H] === M)
                    continue e;
                P.push(L);
              } else b(s, M, f) || P.push(L);
            }
          return P;
        }
        var dn = Ef(Bt), Jc = Ef(Io, !0);
        function ug(t, s) {
          var a = !0;
          return dn(t, function(f, d, b) {
            return a = !!s(f, d, b), a;
          }), a;
        }
        function Gs(t, s, a) {
          for (var f = -1, d = t.length; ++f < d; ) {
            var b = t[f], A = s(b);
            if (A != null && (E === n ? A === A && !st(A) : a(A, E)))
              var E = A, P = b;
          }
          return P;
        }
        function cg(t, s, a, f) {
          var d = t.length;
          for (a = Z(a), a < 0 && (a = -a > d ? 0 : d + a), f = f === n || f > d ? d : Z(f), f < 0 && (f += d), f = a > f ? 0 : d0(f); a < f; )
            t[a++] = s;
          return t;
        }
        function qc(t, s) {
          var a = [];
          return dn(t, function(f, d, b) {
            s(f, d, b) && a.push(f);
          }), a;
        }
        function Fe(t, s, a, f, d) {
          var b = -1, A = t.length;
          for (a || (a = Yg), d || (d = []); ++b < A; ) {
            var E = t[b];
            s > 0 && a(E) ? s > 1 ? Fe(E, s - 1, a, f, d) : cn(d, E) : f || (d[d.length] = E);
          }
          return d;
        }
        var Po = xf(), Kc = xf(!0);
        function Bt(t, s) {
          return t && Po(t, s, Ne);
        }
        function Io(t, s) {
          return t && Kc(t, s, Ne);
        }
        function Hs(t, s) {
          return un(s, function(a) {
            return jt(t[a]);
          });
        }
        function Cn(t, s) {
          s = pn(s, t);
          for (var a = 0, f = s.length; t != null && a < f; )
            t = t[Ct(s[a++])];
          return a && a == f ? t : n;
        }
        function Yc(t, s, a) {
          var f = s(t);
          return Y(t) ? f : cn(f, a(t));
        }
        function $e(t) {
          return t == null ? t === n ? Uh : Mh : In && In in pe(t) ? Wg(t) : sm(t);
        }
        function So(t, s) {
          return t > s;
        }
        function fg(t, s) {
          return t != null && he.call(t, s);
        }
        function lg(t, s) {
          return t != null && s in pe(t);
        }
        function dg(t, s, a) {
          return t >= He(s, a) && t < Ce(s, a);
        }
        function Bo(t, s, a) {
          for (var f = a ? co : xs, d = t[0].length, b = t.length, A = b, E = B(b), P = 1 / 0, N = []; A--; ) {
            var L = t[A];
            A && s && (L = be(L, nt(s))), P = He(L.length, P), E[A] = !a && (s || d >= 120 && L.length >= 120) ? new Bn(A && L) : n;
          }
          L = t[0];
          var M = -1, H = E[0];
          e:
            for (; ++M < d && N.length < P; ) {
              var V = L[M], J = s ? s(V) : V;
              if (V = a || V !== 0 ? V : 0, !(H ? _r(H, J) : f(N, J, a))) {
                for (A = b; --A; ) {
                  var ee = E[A];
                  if (!(ee ? _r(ee, J) : f(t[A], J, a)))
                    continue e;
                }
                H && H.push(J), N.push(V);
              }
            }
          return N;
        }
        function hg(t, s, a, f) {
          return Bt(t, function(d, b, A) {
            s(f, a(d), b, A);
          }), f;
        }
        function kr(t, s, a) {
          s = pn(s, t), t = kf(t, s);
          var f = t == null ? t : t[Ct(pt(s))];
          return f == null ? n : tt(f, t, a);
        }
        function Xc(t) {
          return ve(t) && $e(t) == kt;
        }
        function pg(t) {
          return ve(t) && $e(t) == Cr;
        }
        function gg(t) {
          return ve(t) && $e(t) == Pr;
        }
        function Gr(t, s, a, f, d) {
          return t === s ? !0 : t == null || s == null || !ve(t) && !ve(s) ? t !== t && s !== s : mg(t, s, a, f, Gr, d);
        }
        function mg(t, s, a, f, d, b) {
          var A = Y(t), E = Y(s), P = A ? et : Qe(t), N = E ? et : Qe(s);
          P = P == kt ? Gt : P, N = N == kt ? Gt : N;
          var L = P == Gt, M = N == Gt, H = P == N;
          if (H && mn(t)) {
            if (!mn(s))
              return !1;
            A = !0, L = !1;
          }
          if (H && !L)
            return b || (b = new Et()), A || ir(t) ? Df(t, s, a, f, d, b) : zg(t, s, P, a, f, d, b);
          if (!(a & I)) {
            var V = L && he.call(t, "__wrapped__"), J = M && he.call(s, "__wrapped__");
            if (V || J) {
              var ee = V ? t.value() : t, q = J ? s.value() : s;
              return b || (b = new Et()), d(ee, q, a, f, b);
            }
          }
          return H ? (b || (b = new Et()), $g(t, s, a, f, d, b)) : !1;
        }
        function bg(t) {
          return ve(t) && Qe(t) == At;
        }
        function Ro(t, s, a, f) {
          var d = a.length, b = d, A = !f;
          if (t == null)
            return !b;
          for (t = pe(t); d--; ) {
            var E = a[d];
            if (A && E[2] ? E[1] !== t[E[0]] : !(E[0] in t))
              return !1;
          }
          for (; ++d < b; ) {
            E = a[d];
            var P = E[0], N = t[P], L = E[1];
            if (A && E[2]) {
              if (N === n && !(P in t))
                return !1;
            } else {
              var M = new Et();
              if (f)
                var H = f(N, L, P, t, s, M);
              if (!(H === n ? Gr(L, N, I | R, f, M) : H))
                return !1;
            }
          }
          return !0;
        }
        function Zc(t) {
          if (!Ee(t) || Zg(t))
            return !1;
          var s = jt(t) ? b1 : ap;
          return s.test(Dn(t));
        }
        function Ag(t) {
          return ve(t) && $e(t) == Sr;
        }
        function yg(t) {
          return ve(t) && Qe(t) == yt;
        }
        function wg(t) {
          return ve(t) && si(t.length) && !!me[$e(t)];
        }
        function ef(t) {
          return typeof t == "function" ? t : t == null ? Ye : typeof t == "object" ? Y(t) ? rf(t[0], t[1]) : nf(t) : v0(t);
        }
        function Co(t) {
          if (!zr(t))
            return v1(t);
          var s = [];
          for (var a in pe(t))
            he.call(t, a) && a != "constructor" && s.push(a);
          return s;
        }
        function Eg(t) {
          if (!Ee(t))
            return rm(t);
          var s = zr(t), a = [];
          for (var f in t)
            f == "constructor" && (s || !he.call(t, f)) || a.push(f);
          return a;
        }
        function _o(t, s) {
          return t < s;
        }
        function tf(t, s) {
          var a = -1, f = qe(t) ? B(t.length) : [];
          return dn(t, function(d, b, A) {
            f[++a] = s(d, b, A);
          }), f;
        }
        function nf(t) {
          var s = Vo(t);
          return s.length == 1 && s[0][2] ? Ff(s[0][0], s[0][1]) : function(a) {
            return a === t || Ro(a, t, s);
          };
        }
        function rf(t, s) {
          return Jo(t) && Mf(s) ? Ff(Ct(t), s) : function(a) {
            var f = sa(a, t);
            return f === n && f === s ? ia(a, t) : Gr(s, f, I | R);
          };
        }
        function Qs(t, s, a, f, d) {
          t !== s && Po(s, function(b, A) {
            if (d || (d = new Et()), Ee(b))
              xg(t, s, A, a, Qs, f, d);
            else {
              var E = f ? f(Ko(t, A), b, A + "", t, s, d) : n;
              E === n && (E = b), vo(t, A, E);
            }
          }, Ke);
        }
        function xg(t, s, a, f, d, b, A) {
          var E = Ko(t, a), P = Ko(s, a), N = A.get(P);
          if (N) {
            vo(t, a, N);
            return;
          }
          var L = b ? b(E, P, a + "", t, s, A) : n, M = L === n;
          if (M) {
            var H = Y(P), V = !H && mn(P), J = !H && !V && ir(P);
            L = P, H || V || J ? Y(E) ? L = E : Te(E) ? L = Je(E) : V ? (M = !1, L = mf(P, !0)) : J ? (M = !1, L = bf(P, !0)) : L = [] : Wr(P) || Nn(P) ? (L = E, Nn(E) ? L = h0(E) : (!Ee(E) || jt(E)) && (L = Lf(P))) : M = !1;
          }
          M && (A.set(P, L), d(L, P, f, b, A), A.delete(P)), vo(t, a, L);
        }
        function sf(t, s) {
          var a = t.length;
          if (a)
            return s += s < 0 ? a : 0, Vt(s, a) ? t[s] : n;
        }
        function of(t, s, a) {
          s.length ? s = be(s, function(b) {
            return Y(b) ? function(A) {
              return Cn(A, b.length === 1 ? b[0] : b);
            } : b;
          }) : s = [Ye];
          var f = -1;
          s = be(s, nt(j()));
          var d = tf(t, function(b, A, E) {
            var P = be(s, function(N) {
              return N(b);
            });
            return { criteria: P, index: ++f, value: b };
          });
          return qp(d, function(b, A) {
            return Lg(b, A, a);
          });
        }
        function vg(t, s) {
          return af(t, s, function(a, f) {
            return ia(t, f);
          });
        }
        function af(t, s, a) {
          for (var f = -1, d = s.length, b = {}; ++f < d; ) {
            var A = s[f], E = Cn(t, A);
            a(E, A) && Hr(b, pn(A, t), E);
          }
          return b;
        }
        function Tg(t) {
          return function(s) {
            return Cn(s, t);
          };
        }
        function Do(t, s, a, f) {
          var d = f ? Jp : Jn, b = -1, A = s.length, E = t;
          for (t === s && (s = Je(s)), a && (E = be(t, nt(a))); ++b < A; )
            for (var P = 0, N = s[b], L = a ? a(N) : N; (P = d(E, L, P, f)) > -1; )
              E !== t && Ds.call(E, P, 1), Ds.call(t, P, 1);
          return t;
        }
        function uf(t, s) {
          for (var a = t ? s.length : 0, f = a - 1; a--; ) {
            var d = s[a];
            if (a == f || d !== b) {
              var b = d;
              Vt(d) ? Ds.call(t, d, 1) : Mo(t, d);
            }
          }
          return t;
        }
        function No(t, s) {
          return t + Ls(Hc() * (s - t + 1));
        }
        function Pg(t, s, a, f) {
          for (var d = -1, b = Ce(Os((s - t) / (a || 1)), 0), A = B(b); b--; )
            A[f ? b : ++d] = t, t += a;
          return A;
        }
        function Oo(t, s) {
          var a = "";
          if (!t || s < 1 || s > xe)
            return a;
          do
            s % 2 && (a += t), s = Ls(s / 2), s && (t += t);
          while (s);
          return a;
        }
        function re(t, s) {
          return Yo(Uf(t, s, Ye), t + "");
        }
        function Ig(t) {
          return $c(or(t));
        }
        function Sg(t, s) {
          var a = or(t);
          return Xs(a, Rn(s, 0, a.length));
        }
        function Hr(t, s, a, f) {
          if (!Ee(t))
            return t;
          s = pn(s, t);
          for (var d = -1, b = s.length, A = b - 1, E = t; E != null && ++d < b; ) {
            var P = Ct(s[d]), N = a;
            if (P === "__proto__" || P === "constructor" || P === "prototype")
              return t;
            if (d != A) {
              var L = E[P];
              N = f ? f(L, P, E) : n, N === n && (N = Ee(L) ? L : Vt(s[d + 1]) ? [] : {});
            }
            Fr(E, P, N), E = E[P];
          }
          return t;
        }
        var cf = Ms ? function(t, s) {
          return Ms.set(t, s), t;
        } : Ye, Bg = Ns ? function(t, s) {
          return Ns(t, "toString", {
            configurable: !0,
            enumerable: !1,
            value: aa(s),
            writable: !0
          });
        } : Ye;
        function Rg(t) {
          return Xs(or(t));
        }
        function ht(t, s, a) {
          var f = -1, d = t.length;
          s < 0 && (s = -s > d ? 0 : d + s), a = a > d ? d : a, a < 0 && (a += d), d = s > a ? 0 : a - s >>> 0, s >>>= 0;
          for (var b = B(d); ++f < d; )
            b[f] = t[f + s];
          return b;
        }
        function Cg(t, s) {
          var a;
          return dn(t, function(f, d, b) {
            return a = s(f, d, b), !a;
          }), !!a;
        }
        function zs(t, s, a) {
          var f = 0, d = t == null ? f : t.length;
          if (typeof s == "number" && s === s && d <= vr) {
            for (; f < d; ) {
              var b = f + d >>> 1, A = t[b];
              A !== null && !st(A) && (a ? A <= s : A < s) ? f = b + 1 : d = b;
            }
            return d;
          }
          return Lo(t, s, Ye, a);
        }
        function Lo(t, s, a, f) {
          var d = 0, b = t == null ? 0 : t.length;
          if (b === 0)
            return 0;
          s = a(s);
          for (var A = s !== s, E = s === null, P = st(s), N = s === n; d < b; ) {
            var L = Ls((d + b) / 2), M = a(t[L]), H = M !== n, V = M === null, J = M === M, ee = st(M);
            if (A)
              var q = f || J;
            else N ? q = J && (f || H) : E ? q = J && H && (f || !V) : P ? q = J && H && !V && (f || !ee) : V || ee ? q = !1 : q = f ? M <= s : M < s;
            q ? d = L + 1 : b = L;
          }
          return He(b, Vu);
        }
        function ff(t, s) {
          for (var a = -1, f = t.length, d = 0, b = []; ++a < f; ) {
            var A = t[a], E = s ? s(A) : A;
            if (!a || !xt(E, P)) {
              var P = E;
              b[d++] = A === 0 ? 0 : A;
            }
          }
          return b;
        }
        function lf(t) {
          return typeof t == "number" ? t : st(t) ? at : +t;
        }
        function rt(t) {
          if (typeof t == "string")
            return t;
          if (Y(t))
            return be(t, rt) + "";
          if (st(t))
            return Qc ? Qc.call(t) : "";
          var s = t + "";
          return s == "0" && 1 / t == -ze ? "-0" : s;
        }
        function hn(t, s, a) {
          var f = -1, d = xs, b = t.length, A = !0, E = [], P = E;
          if (a)
            A = !1, d = co;
          else if (b >= o) {
            var N = s ? null : Hg(t);
            if (N)
              return Ts(N);
            A = !1, d = _r, P = new Bn();
          } else
            P = s ? [] : E;
          e:
            for (; ++f < b; ) {
              var L = t[f], M = s ? s(L) : L;
              if (L = a || L !== 0 ? L : 0, A && M === M) {
                for (var H = P.length; H--; )
                  if (P[H] === M)
                    continue e;
                s && P.push(M), E.push(L);
              } else d(P, M, a) || (P !== E && P.push(M), E.push(L));
            }
          return E;
        }
        function Mo(t, s) {
          return s = pn(s, t), t = kf(t, s), t == null || delete t[Ct(pt(s))];
        }
        function df(t, s, a, f) {
          return Hr(t, s, a(Cn(t, s)), f);
        }
        function $s(t, s, a, f) {
          for (var d = t.length, b = f ? d : -1; (f ? b-- : ++b < d) && s(t[b], b, t); )
            ;
          return a ? ht(t, f ? 0 : b, f ? b + 1 : d) : ht(t, f ? b + 1 : 0, f ? d : b);
        }
        function hf(t, s) {
          var a = t;
          return a instanceof ae && (a = a.value()), fo(s, function(f, d) {
            return d.func.apply(d.thisArg, cn([f], d.args));
          }, a);
        }
        function Fo(t, s, a) {
          var f = t.length;
          if (f < 2)
            return f ? hn(t[0]) : [];
          for (var d = -1, b = B(f); ++d < f; )
            for (var A = t[d], E = -1; ++E < f; )
              E != d && (b[d] = Ur(b[d] || A, t[E], s, a));
          return hn(Fe(b, 1), s, a);
        }
        function pf(t, s, a) {
          for (var f = -1, d = t.length, b = s.length, A = {}; ++f < d; ) {
            var E = f < b ? s[f] : n;
            a(A, t[f], E);
          }
          return A;
        }
        function Uo(t) {
          return Te(t) ? t : [];
        }
        function ko(t) {
          return typeof t == "function" ? t : Ye;
        }
        function pn(t, s) {
          return Y(t) ? t : Jo(t, s) ? [t] : zf(de(t));
        }
        var _g = re;
        function gn(t, s, a) {
          var f = t.length;
          return a = a === n ? f : a, !s && a >= f ? t : ht(t, s, a);
        }
        var gf = A1 || function(t) {
          return Me.clearTimeout(t);
        };
        function mf(t, s) {
          if (s)
            return t.slice();
          var a = t.length, f = Mc ? Mc(a) : new t.constructor(a);
          return t.copy(f), f;
        }
        function Go(t) {
          var s = new t.constructor(t.byteLength);
          return new Cs(s).set(new Cs(t)), s;
        }
        function Dg(t, s) {
          var a = s ? Go(t.buffer) : t.buffer;
          return new t.constructor(a, t.byteOffset, t.byteLength);
        }
        function Ng(t) {
          var s = new t.constructor(t.source, Xu.exec(t));
          return s.lastIndex = t.lastIndex, s;
        }
        function Og(t) {
          return Mr ? pe(Mr.call(t)) : {};
        }
        function bf(t, s) {
          var a = s ? Go(t.buffer) : t.buffer;
          return new t.constructor(a, t.byteOffset, t.length);
        }
        function Af(t, s) {
          if (t !== s) {
            var a = t !== n, f = t === null, d = t === t, b = st(t), A = s !== n, E = s === null, P = s === s, N = st(s);
            if (!E && !N && !b && t > s || b && A && P && !E && !N || f && A && P || !a && P || !d)
              return 1;
            if (!f && !b && !N && t < s || N && a && d && !f && !b || E && a && d || !A && d || !P)
              return -1;
          }
          return 0;
        }
        function Lg(t, s, a) {
          for (var f = -1, d = t.criteria, b = s.criteria, A = d.length, E = a.length; ++f < A; ) {
            var P = Af(d[f], b[f]);
            if (P) {
              if (f >= E)
                return P;
              var N = a[f];
              return P * (N == "desc" ? -1 : 1);
            }
          }
          return t.index - s.index;
        }
        function yf(t, s, a, f) {
          for (var d = -1, b = t.length, A = a.length, E = -1, P = s.length, N = Ce(b - A, 0), L = B(P + N), M = !f; ++E < P; )
            L[E] = s[E];
          for (; ++d < A; )
            (M || d < b) && (L[a[d]] = t[d]);
          for (; N--; )
            L[E++] = t[d++];
          return L;
        }
        function wf(t, s, a, f) {
          for (var d = -1, b = t.length, A = -1, E = a.length, P = -1, N = s.length, L = Ce(b - E, 0), M = B(L + N), H = !f; ++d < L; )
            M[d] = t[d];
          for (var V = d; ++P < N; )
            M[V + P] = s[P];
          for (; ++A < E; )
            (H || d < b) && (M[V + a[A]] = t[d++]);
          return M;
        }
        function Je(t, s) {
          var a = -1, f = t.length;
          for (s || (s = B(f)); ++a < f; )
            s[a] = t[a];
          return s;
        }
        function Rt(t, s, a, f) {
          var d = !a;
          a || (a = {});
          for (var b = -1, A = s.length; ++b < A; ) {
            var E = s[b], P = f ? f(a[E], t[E], E, a, t) : n;
            P === n && (P = t[E]), d ? zt(a, E, P) : Fr(a, E, P);
          }
          return a;
        }
        function Mg(t, s) {
          return Rt(t, jo(t), s);
        }
        function Fg(t, s) {
          return Rt(t, Nf(t), s);
        }
        function Ws(t, s) {
          return function(a, f) {
            var d = Y(a) ? Qp : ig, b = s ? s() : {};
            return d(a, t, j(f, 2), b);
          };
        }
        function nr(t) {
          return re(function(s, a) {
            var f = -1, d = a.length, b = d > 1 ? a[d - 1] : n, A = d > 2 ? a[2] : n;
            for (b = t.length > 3 && typeof b == "function" ? (d--, b) : n, A && We(a[0], a[1], A) && (b = d < 3 ? n : b, d = 1), s = pe(s); ++f < d; ) {
              var E = a[f];
              E && t(s, E, f, b);
            }
            return s;
          });
        }
        function Ef(t, s) {
          return function(a, f) {
            if (a == null)
              return a;
            if (!qe(a))
              return t(a, f);
            for (var d = a.length, b = s ? d : -1, A = pe(a); (s ? b-- : ++b < d) && f(A[b], b, A) !== !1; )
              ;
            return a;
          };
        }
        function xf(t) {
          return function(s, a, f) {
            for (var d = -1, b = pe(s), A = f(s), E = A.length; E--; ) {
              var P = A[t ? E : ++d];
              if (a(b[P], P, b) === !1)
                break;
            }
            return s;
          };
        }
        function Ug(t, s, a) {
          var f = s & O, d = Qr(t);
          function b() {
            var A = this && this !== Me && this instanceof b ? d : t;
            return A.apply(f ? a : this, arguments);
          }
          return b;
        }
        function vf(t) {
          return function(s) {
            s = de(s);
            var a = qn(s) ? wt(s) : n, f = a ? a[0] : s.charAt(0), d = a ? gn(a, 1).join("") : s.slice(1);
            return f[t]() + d;
          };
        }
        function rr(t) {
          return function(s) {
            return fo(E0(w0(s).replace(Bp, "")), t, "");
          };
        }
        function Qr(t) {
          return function() {
            var s = arguments;
            switch (s.length) {
              case 0:
                return new t();
              case 1:
                return new t(s[0]);
              case 2:
                return new t(s[0], s[1]);
              case 3:
                return new t(s[0], s[1], s[2]);
              case 4:
                return new t(s[0], s[1], s[2], s[3]);
              case 5:
                return new t(s[0], s[1], s[2], s[3], s[4]);
              case 6:
                return new t(s[0], s[1], s[2], s[3], s[4], s[5]);
              case 7:
                return new t(s[0], s[1], s[2], s[3], s[4], s[5], s[6]);
            }
            var a = tr(t.prototype), f = t.apply(a, s);
            return Ee(f) ? f : a;
          };
        }
        function kg(t, s, a) {
          var f = Qr(t);
          function d() {
            for (var b = arguments.length, A = B(b), E = b, P = sr(d); E--; )
              A[E] = arguments[E];
            var N = b < 3 && A[0] !== P && A[b - 1] !== P ? [] : fn(A, P);
            if (b -= N.length, b < a)
              return Bf(
                t,
                s,
                Vs,
                d.placeholder,
                n,
                A,
                N,
                n,
                n,
                a - b
              );
            var L = this && this !== Me && this instanceof d ? f : t;
            return tt(L, this, A);
          }
          return d;
        }
        function Tf(t) {
          return function(s, a, f) {
            var d = pe(s);
            if (!qe(s)) {
              var b = j(a, 3);
              s = Ne(s), a = function(E) {
                return b(d[E], E, d);
              };
            }
            var A = t(s, a, f);
            return A > -1 ? d[b ? s[A] : A] : n;
          };
        }
        function Pf(t) {
          return Wt(function(s) {
            var a = s.length, f = a, d = lt.prototype.thru;
            for (t && s.reverse(); f--; ) {
              var b = s[f];
              if (typeof b != "function")
                throw new ft(c);
              if (d && !A && Ks(b) == "wrapper")
                var A = new lt([], !0);
            }
            for (f = A ? f : a; ++f < a; ) {
              b = s[f];
              var E = Ks(b), P = E == "wrapper" ? Wo(b) : n;
              P && qo(P[0]) && P[1] == (k | Q | T | F) && !P[4].length && P[9] == 1 ? A = A[Ks(P[0])].apply(A, P[3]) : A = b.length == 1 && qo(b) ? A[E]() : A.thru(b);
            }
            return function() {
              var N = arguments, L = N[0];
              if (A && N.length == 1 && Y(L))
                return A.plant(L).value();
              for (var M = 0, H = a ? s[M].apply(this, N) : L; ++M < a; )
                H = s[M].call(this, H);
              return H;
            };
          });
        }
        function Vs(t, s, a, f, d, b, A, E, P, N) {
          var L = s & k, M = s & O, H = s & S, V = s & (Q | _), J = s & $, ee = H ? n : Qr(t);
          function q() {
            for (var oe = arguments.length, ue = B(oe), it = oe; it--; )
              ue[it] = arguments[it];
            if (V)
              var Ve = sr(q), ot = Yp(ue, Ve);
            if (f && (ue = yf(ue, f, d, V)), b && (ue = wf(ue, b, A, V)), oe -= ot, V && oe < N) {
              var Pe = fn(ue, Ve);
              return Bf(
                t,
                s,
                Vs,
                q.placeholder,
                a,
                ue,
                Pe,
                E,
                P,
                N - oe
              );
            }
            var vt = M ? a : this, qt = H ? vt[t] : t;
            return oe = ue.length, E ? ue = im(ue, E) : J && oe > 1 && ue.reverse(), L && P < oe && (ue.length = P), this && this !== Me && this instanceof q && (qt = ee || Qr(qt)), qt.apply(vt, ue);
          }
          return q;
        }
        function If(t, s) {
          return function(a, f) {
            return hg(a, t, s(f), {});
          };
        }
        function js(t, s) {
          return function(a, f) {
            var d;
            if (a === n && f === n)
              return s;
            if (a !== n && (d = a), f !== n) {
              if (d === n)
                return f;
              typeof a == "string" || typeof f == "string" ? (a = rt(a), f = rt(f)) : (a = lf(a), f = lf(f)), d = t(a, f);
            }
            return d;
          };
        }
        function Ho(t) {
          return Wt(function(s) {
            return s = be(s, nt(j())), re(function(a) {
              var f = this;
              return t(s, function(d) {
                return tt(d, f, a);
              });
            });
          });
        }
        function Js(t, s) {
          s = s === n ? " " : rt(s);
          var a = s.length;
          if (a < 2)
            return a ? Oo(s, t) : s;
          var f = Oo(s, Os(t / Kn(s)));
          return qn(s) ? gn(wt(f), 0, t).join("") : f.slice(0, t);
        }
        function Gg(t, s, a, f) {
          var d = s & O, b = Qr(t);
          function A() {
            for (var E = -1, P = arguments.length, N = -1, L = f.length, M = B(L + P), H = this && this !== Me && this instanceof A ? b : t; ++N < L; )
              M[N] = f[N];
            for (; P--; )
              M[N++] = arguments[++E];
            return tt(H, d ? a : this, M);
          }
          return A;
        }
        function Sf(t) {
          return function(s, a, f) {
            return f && typeof f != "number" && We(s, a, f) && (a = f = n), s = Jt(s), a === n ? (a = s, s = 0) : a = Jt(a), f = f === n ? s < a ? 1 : -1 : Jt(f), Pg(s, a, f, t);
          };
        }
        function qs(t) {
          return function(s, a) {
            return typeof s == "string" && typeof a == "string" || (s = gt(s), a = gt(a)), t(s, a);
          };
        }
        function Bf(t, s, a, f, d, b, A, E, P, N) {
          var L = s & Q, M = L ? A : n, H = L ? n : A, V = L ? b : n, J = L ? n : b;
          s |= L ? T : C, s &= ~(L ? C : T), s & G || (s &= -4);
          var ee = [
            t,
            s,
            d,
            V,
            M,
            J,
            H,
            E,
            P,
            N
          ], q = a.apply(n, ee);
          return qo(t) && Gf(q, ee), q.placeholder = f, Hf(q, t, s);
        }
        function Qo(t) {
          var s = Re[t];
          return function(a, f) {
            if (a = gt(a), f = f == null ? 0 : He(Z(f), 292), f && Gc(a)) {
              var d = (de(a) + "e").split("e"), b = s(d[0] + "e" + (+d[1] + f));
              return d = (de(b) + "e").split("e"), +(d[0] + "e" + (+d[1] - f));
            }
            return s(a);
          };
        }
        var Hg = Zn && 1 / Ts(new Zn([, -0]))[1] == ze ? function(t) {
          return new Zn(t);
        } : fa;
        function Rf(t) {
          return function(s) {
            var a = Qe(s);
            return a == At ? Ao(s) : a == yt ? s1(s) : Kp(s, t(s));
          };
        }
        function $t(t, s, a, f, d, b, A, E) {
          var P = s & S;
          if (!P && typeof t != "function")
            throw new ft(c);
          var N = f ? f.length : 0;
          if (N || (s &= -97, f = d = n), A = A === n ? A : Ce(Z(A), 0), E = E === n ? E : Z(E), N -= d ? d.length : 0, s & C) {
            var L = f, M = d;
            f = d = n;
          }
          var H = P ? n : Wo(t), V = [
            t,
            s,
            a,
            f,
            d,
            L,
            M,
            b,
            A,
            E
          ];
          if (H && nm(V, H), t = V[0], s = V[1], a = V[2], f = V[3], d = V[4], E = V[9] = V[9] === n ? P ? 0 : t.length : Ce(V[9] - N, 0), !E && s & (Q | _) && (s &= -25), !s || s == O)
            var J = Ug(t, s, a);
          else s == Q || s == _ ? J = kg(t, s, E) : (s == T || s == (O | T)) && !d.length ? J = Gg(t, s, a, f) : J = Vs.apply(n, V);
          var ee = H ? cf : Gf;
          return Hf(ee(J, V), t, s);
        }
        function Cf(t, s, a, f) {
          return t === n || xt(t, Xn[a]) && !he.call(f, a) ? s : t;
        }
        function _f(t, s, a, f, d, b) {
          return Ee(t) && Ee(s) && (b.set(s, t), Qs(t, s, n, _f, b), b.delete(s)), t;
        }
        function Qg(t) {
          return Wr(t) ? n : t;
        }
        function Df(t, s, a, f, d, b) {
          var A = a & I, E = t.length, P = s.length;
          if (E != P && !(A && P > E))
            return !1;
          var N = b.get(t), L = b.get(s);
          if (N && L)
            return N == s && L == t;
          var M = -1, H = !0, V = a & R ? new Bn() : n;
          for (b.set(t, s), b.set(s, t); ++M < E; ) {
            var J = t[M], ee = s[M];
            if (f)
              var q = A ? f(ee, J, M, s, t, b) : f(J, ee, M, t, s, b);
            if (q !== n) {
              if (q)
                continue;
              H = !1;
              break;
            }
            if (V) {
              if (!lo(s, function(oe, ue) {
                if (!_r(V, ue) && (J === oe || d(J, oe, a, f, b)))
                  return V.push(ue);
              })) {
                H = !1;
                break;
              }
            } else if (!(J === ee || d(J, ee, a, f, b))) {
              H = !1;
              break;
            }
          }
          return b.delete(t), b.delete(s), H;
        }
        function zg(t, s, a, f, d, b, A) {
          switch (a) {
            case Vn:
              if (t.byteLength != s.byteLength || t.byteOffset != s.byteOffset)
                return !1;
              t = t.buffer, s = s.buffer;
            case Cr:
              return !(t.byteLength != s.byteLength || !b(new Cs(t), new Cs(s)));
            case Tr:
            case Pr:
            case Ir:
              return xt(+t, +s);
            case ms:
              return t.name == s.name && t.message == s.message;
            case Sr:
            case Br:
              return t == s + "";
            case At:
              var E = Ao;
            case yt:
              var P = f & I;
              if (E || (E = Ts), t.size != s.size && !P)
                return !1;
              var N = A.get(t);
              if (N)
                return N == s;
              f |= R, A.set(t, s);
              var L = Df(E(t), E(s), f, d, b, A);
              return A.delete(t), L;
            case As:
              if (Mr)
                return Mr.call(t) == Mr.call(s);
          }
          return !1;
        }
        function $g(t, s, a, f, d, b) {
          var A = a & I, E = zo(t), P = E.length, N = zo(s), L = N.length;
          if (P != L && !A)
            return !1;
          for (var M = P; M--; ) {
            var H = E[M];
            if (!(A ? H in s : he.call(s, H)))
              return !1;
          }
          var V = b.get(t), J = b.get(s);
          if (V && J)
            return V == s && J == t;
          var ee = !0;
          b.set(t, s), b.set(s, t);
          for (var q = A; ++M < P; ) {
            H = E[M];
            var oe = t[H], ue = s[H];
            if (f)
              var it = A ? f(ue, oe, H, s, t, b) : f(oe, ue, H, t, s, b);
            if (!(it === n ? oe === ue || d(oe, ue, a, f, b) : it)) {
              ee = !1;
              break;
            }
            q || (q = H == "constructor");
          }
          if (ee && !q) {
            var Ve = t.constructor, ot = s.constructor;
            Ve != ot && "constructor" in t && "constructor" in s && !(typeof Ve == "function" && Ve instanceof Ve && typeof ot == "function" && ot instanceof ot) && (ee = !1);
          }
          return b.delete(t), b.delete(s), ee;
        }
        function Wt(t) {
          return Yo(Uf(t, n, jf), t + "");
        }
        function zo(t) {
          return Yc(t, Ne, jo);
        }
        function $o(t) {
          return Yc(t, Ke, Nf);
        }
        var Wo = Ms ? function(t) {
          return Ms.get(t);
        } : fa;
        function Ks(t) {
          for (var s = t.name + "", a = er[s], f = he.call(er, s) ? a.length : 0; f--; ) {
            var d = a[f], b = d.func;
            if (b == null || b == t)
              return d.name;
          }
          return s;
        }
        function sr(t) {
          var s = he.call(p, "placeholder") ? p : t;
          return s.placeholder;
        }
        function j() {
          var t = p.iteratee || ua;
          return t = t === ua ? ef : t, arguments.length ? t(arguments[0], arguments[1]) : t;
        }
        function Ys(t, s) {
          var a = t.__data__;
          return Xg(s) ? a[typeof s == "string" ? "string" : "hash"] : a.map;
        }
        function Vo(t) {
          for (var s = Ne(t), a = s.length; a--; ) {
            var f = s[a], d = t[f];
            s[a] = [f, d, Mf(d)];
          }
          return s;
        }
        function _n(t, s) {
          var a = t1(t, s);
          return Zc(a) ? a : n;
        }
        function Wg(t) {
          var s = he.call(t, In), a = t[In];
          try {
            t[In] = n;
            var f = !0;
          } catch {
          }
          var d = Bs.call(t);
          return f && (s ? t[In] = a : delete t[In]), d;
        }
        var jo = wo ? function(t) {
          return t == null ? [] : (t = pe(t), un(wo(t), function(s) {
            return Uc.call(t, s);
          }));
        } : la, Nf = wo ? function(t) {
          for (var s = []; t; )
            cn(s, jo(t)), t = _s(t);
          return s;
        } : la, Qe = $e;
        (Eo && Qe(new Eo(new ArrayBuffer(1))) != Vn || Nr && Qe(new Nr()) != At || xo && Qe(xo.resolve()) != Ju || Zn && Qe(new Zn()) != yt || Or && Qe(new Or()) != Rr) && (Qe = function(t) {
          var s = $e(t), a = s == Gt ? t.constructor : n, f = a ? Dn(a) : "";
          if (f)
            switch (f) {
              case S1:
                return Vn;
              case B1:
                return At;
              case R1:
                return Ju;
              case C1:
                return yt;
              case _1:
                return Rr;
            }
          return s;
        });
        function Vg(t, s, a) {
          for (var f = -1, d = a.length; ++f < d; ) {
            var b = a[f], A = b.size;
            switch (b.type) {
              case "drop":
                t += A;
                break;
              case "dropRight":
                s -= A;
                break;
              case "take":
                s = He(s, t + A);
                break;
              case "takeRight":
                t = Ce(t, s - A);
                break;
            }
          }
          return { start: t, end: s };
        }
        function jg(t) {
          var s = t.match(Zh);
          return s ? s[1].split(ep) : [];
        }
        function Of(t, s, a) {
          s = pn(s, t);
          for (var f = -1, d = s.length, b = !1; ++f < d; ) {
            var A = Ct(s[f]);
            if (!(b = t != null && a(t, A)))
              break;
            t = t[A];
          }
          return b || ++f != d ? b : (d = t == null ? 0 : t.length, !!d && si(d) && Vt(A, d) && (Y(t) || Nn(t)));
        }
        function Jg(t) {
          var s = t.length, a = new t.constructor(s);
          return s && typeof t[0] == "string" && he.call(t, "index") && (a.index = t.index, a.input = t.input), a;
        }
        function Lf(t) {
          return typeof t.constructor == "function" && !zr(t) ? tr(_s(t)) : {};
        }
        function qg(t, s, a) {
          var f = t.constructor;
          switch (s) {
            case Cr:
              return Go(t);
            case Tr:
            case Pr:
              return new f(+t);
            case Vn:
              return Dg(t, a);
            case Wi:
            case Vi:
            case ji:
            case Ji:
            case qi:
            case Ki:
            case Yi:
            case Xi:
            case Zi:
              return bf(t, a);
            case At:
              return new f();
            case Ir:
            case Br:
              return new f(t);
            case Sr:
              return Ng(t);
            case yt:
              return new f();
            case As:
              return Og(t);
          }
        }
        function Kg(t, s) {
          var a = s.length;
          if (!a)
            return t;
          var f = a - 1;
          return s[f] = (a > 1 ? "& " : "") + s[f], s = s.join(a > 2 ? ", " : " "), t.replace(Xh, `{
/* [wrapped with ` + s + `] */
`);
        }
        function Yg(t) {
          return Y(t) || Nn(t) || !!(kc && t && t[kc]);
        }
        function Vt(t, s) {
          var a = typeof t;
          return s = s ?? xe, !!s && (a == "number" || a != "symbol" && cp.test(t)) && t > -1 && t % 1 == 0 && t < s;
        }
        function We(t, s, a) {
          if (!Ee(a))
            return !1;
          var f = typeof s;
          return (f == "number" ? qe(a) && Vt(s, a.length) : f == "string" && s in a) ? xt(a[s], t) : !1;
        }
        function Jo(t, s) {
          if (Y(t))
            return !1;
          var a = typeof t;
          return a == "number" || a == "symbol" || a == "boolean" || t == null || st(t) ? !0 : Jh.test(t) || !jh.test(t) || s != null && t in pe(s);
        }
        function Xg(t) {
          var s = typeof t;
          return s == "string" || s == "number" || s == "symbol" || s == "boolean" ? t !== "__proto__" : t === null;
        }
        function qo(t) {
          var s = Ks(t), a = p[s];
          if (typeof a != "function" || !(s in ae.prototype))
            return !1;
          if (t === a)
            return !0;
          var f = Wo(a);
          return !!f && t === f[0];
        }
        function Zg(t) {
          return !!Lc && Lc in t;
        }
        var em = Is ? jt : da;
        function zr(t) {
          var s = t && t.constructor, a = typeof s == "function" && s.prototype || Xn;
          return t === a;
        }
        function Mf(t) {
          return t === t && !Ee(t);
        }
        function Ff(t, s) {
          return function(a) {
            return a == null ? !1 : a[t] === s && (s !== n || t in pe(a));
          };
        }
        function tm(t) {
          var s = ni(t, function(f) {
            return a.size === g && a.clear(), f;
          }), a = s.cache;
          return s;
        }
        function nm(t, s) {
          var a = t[1], f = s[1], d = a | f, b = d < (O | S | k), A = f == k && a == Q || f == k && a == F && t[7].length <= s[8] || f == (k | F) && s[7].length <= s[8] && a == Q;
          if (!(b || A))
            return t;
          f & O && (t[2] = s[2], d |= a & O ? 0 : G);
          var E = s[3];
          if (E) {
            var P = t[3];
            t[3] = P ? yf(P, E, s[4]) : E, t[4] = P ? fn(t[3], m) : s[4];
          }
          return E = s[5], E && (P = t[5], t[5] = P ? wf(P, E, s[6]) : E, t[6] = P ? fn(t[5], m) : s[6]), E = s[7], E && (t[7] = E), f & k && (t[8] = t[8] == null ? s[8] : He(t[8], s[8])), t[9] == null && (t[9] = s[9]), t[0] = s[0], t[1] = d, t;
        }
        function rm(t) {
          var s = [];
          if (t != null)
            for (var a in pe(t))
              s.push(a);
          return s;
        }
        function sm(t) {
          return Bs.call(t);
        }
        function Uf(t, s, a) {
          return s = Ce(s === n ? t.length - 1 : s, 0), function() {
            for (var f = arguments, d = -1, b = Ce(f.length - s, 0), A = B(b); ++d < b; )
              A[d] = f[s + d];
            d = -1;
            for (var E = B(s + 1); ++d < s; )
              E[d] = f[d];
            return E[s] = a(A), tt(t, this, E);
          };
        }
        function kf(t, s) {
          return s.length < 2 ? t : Cn(t, ht(s, 0, -1));
        }
        function im(t, s) {
          for (var a = t.length, f = He(s.length, a), d = Je(t); f--; ) {
            var b = s[f];
            t[f] = Vt(b, a) ? d[b] : n;
          }
          return t;
        }
        function Ko(t, s) {
          if (!(s === "constructor" && typeof t[s] == "function") && s != "__proto__")
            return t[s];
        }
        var Gf = Qf(cf), $r = w1 || function(t, s) {
          return Me.setTimeout(t, s);
        }, Yo = Qf(Bg);
        function Hf(t, s, a) {
          var f = s + "";
          return Yo(t, Kg(f, om(jg(f), a)));
        }
        function Qf(t) {
          var s = 0, a = 0;
          return function() {
            var f = T1(), d = fe - (f - a);
            if (a = f, d > 0) {
              if (++s >= ce)
                return arguments[0];
            } else
              s = 0;
            return t.apply(n, arguments);
          };
        }
        function Xs(t, s) {
          var a = -1, f = t.length, d = f - 1;
          for (s = s === n ? f : s; ++a < s; ) {
            var b = No(a, d), A = t[b];
            t[b] = t[a], t[a] = A;
          }
          return t.length = s, t;
        }
        var zf = tm(function(t) {
          var s = [];
          return t.charCodeAt(0) === 46 && s.push(""), t.replace(qh, function(a, f, d, b) {
            s.push(d ? b.replace(rp, "$1") : f || a);
          }), s;
        });
        function Ct(t) {
          if (typeof t == "string" || st(t))
            return t;
          var s = t + "";
          return s == "0" && 1 / t == -ze ? "-0" : s;
        }
        function Dn(t) {
          if (t != null) {
            try {
              return Ss.call(t);
            } catch {
            }
            try {
              return t + "";
            } catch {
            }
          }
          return "";
        }
        function om(t, s) {
          return ct($i, function(a) {
            var f = "_." + a[0];
            s & a[1] && !xs(t, f) && t.push(f);
          }), t.sort();
        }
        function $f(t) {
          if (t instanceof ae)
            return t.clone();
          var s = new lt(t.__wrapped__, t.__chain__);
          return s.__actions__ = Je(t.__actions__), s.__index__ = t.__index__, s.__values__ = t.__values__, s;
        }
        function am(t, s, a) {
          (a ? We(t, s, a) : s === n) ? s = 1 : s = Ce(Z(s), 0);
          var f = t == null ? 0 : t.length;
          if (!f || s < 1)
            return [];
          for (var d = 0, b = 0, A = B(Os(f / s)); d < f; )
            A[b++] = ht(t, d, d += s);
          return A;
        }
        function um(t) {
          for (var s = -1, a = t == null ? 0 : t.length, f = 0, d = []; ++s < a; ) {
            var b = t[s];
            b && (d[f++] = b);
          }
          return d;
        }
        function cm() {
          var t = arguments.length;
          if (!t)
            return [];
          for (var s = B(t - 1), a = arguments[0], f = t; f--; )
            s[f - 1] = arguments[f];
          return cn(Y(a) ? Je(a) : [a], Fe(s, 1));
        }
        var fm = re(function(t, s) {
          return Te(t) ? Ur(t, Fe(s, 1, Te, !0)) : [];
        }), lm = re(function(t, s) {
          var a = pt(s);
          return Te(a) && (a = n), Te(t) ? Ur(t, Fe(s, 1, Te, !0), j(a, 2)) : [];
        }), dm = re(function(t, s) {
          var a = pt(s);
          return Te(a) && (a = n), Te(t) ? Ur(t, Fe(s, 1, Te, !0), n, a) : [];
        });
        function hm(t, s, a) {
          var f = t == null ? 0 : t.length;
          return f ? (s = a || s === n ? 1 : Z(s), ht(t, s < 0 ? 0 : s, f)) : [];
        }
        function pm(t, s, a) {
          var f = t == null ? 0 : t.length;
          return f ? (s = a || s === n ? 1 : Z(s), s = f - s, ht(t, 0, s < 0 ? 0 : s)) : [];
        }
        function gm(t, s) {
          return t && t.length ? $s(t, j(s, 3), !0, !0) : [];
        }
        function mm(t, s) {
          return t && t.length ? $s(t, j(s, 3), !0) : [];
        }
        function bm(t, s, a, f) {
          var d = t == null ? 0 : t.length;
          return d ? (a && typeof a != "number" && We(t, s, a) && (a = 0, f = d), cg(t, s, a, f)) : [];
        }
        function Wf(t, s, a) {
          var f = t == null ? 0 : t.length;
          if (!f)
            return -1;
          var d = a == null ? 0 : Z(a);
          return d < 0 && (d = Ce(f + d, 0)), vs(t, j(s, 3), d);
        }
        function Vf(t, s, a) {
          var f = t == null ? 0 : t.length;
          if (!f)
            return -1;
          var d = f - 1;
          return a !== n && (d = Z(a), d = a < 0 ? Ce(f + d, 0) : He(d, f - 1)), vs(t, j(s, 3), d, !0);
        }
        function jf(t) {
          var s = t == null ? 0 : t.length;
          return s ? Fe(t, 1) : [];
        }
        function Am(t) {
          var s = t == null ? 0 : t.length;
          return s ? Fe(t, ze) : [];
        }
        function ym(t, s) {
          var a = t == null ? 0 : t.length;
          return a ? (s = s === n ? 1 : Z(s), Fe(t, s)) : [];
        }
        function wm(t) {
          for (var s = -1, a = t == null ? 0 : t.length, f = {}; ++s < a; ) {
            var d = t[s];
            f[d[0]] = d[1];
          }
          return f;
        }
        function Jf(t) {
          return t && t.length ? t[0] : n;
        }
        function Em(t, s, a) {
          var f = t == null ? 0 : t.length;
          if (!f)
            return -1;
          var d = a == null ? 0 : Z(a);
          return d < 0 && (d = Ce(f + d, 0)), Jn(t, s, d);
        }
        function xm(t) {
          var s = t == null ? 0 : t.length;
          return s ? ht(t, 0, -1) : [];
        }
        var vm = re(function(t) {
          var s = be(t, Uo);
          return s.length && s[0] === t[0] ? Bo(s) : [];
        }), Tm = re(function(t) {
          var s = pt(t), a = be(t, Uo);
          return s === pt(a) ? s = n : a.pop(), a.length && a[0] === t[0] ? Bo(a, j(s, 2)) : [];
        }), Pm = re(function(t) {
          var s = pt(t), a = be(t, Uo);
          return s = typeof s == "function" ? s : n, s && a.pop(), a.length && a[0] === t[0] ? Bo(a, n, s) : [];
        });
        function Im(t, s) {
          return t == null ? "" : x1.call(t, s);
        }
        function pt(t) {
          var s = t == null ? 0 : t.length;
          return s ? t[s - 1] : n;
        }
        function Sm(t, s, a) {
          var f = t == null ? 0 : t.length;
          if (!f)
            return -1;
          var d = f;
          return a !== n && (d = Z(a), d = d < 0 ? Ce(f + d, 0) : He(d, f - 1)), s === s ? o1(t, s, d) : vs(t, Sc, d, !0);
        }
        function Bm(t, s) {
          return t && t.length ? sf(t, Z(s)) : n;
        }
        var Rm = re(qf);
        function qf(t, s) {
          return t && t.length && s && s.length ? Do(t, s) : t;
        }
        function Cm(t, s, a) {
          return t && t.length && s && s.length ? Do(t, s, j(a, 2)) : t;
        }
        function _m(t, s, a) {
          return t && t.length && s && s.length ? Do(t, s, n, a) : t;
        }
        var Dm = Wt(function(t, s) {
          var a = t == null ? 0 : t.length, f = To(t, s);
          return uf(t, be(s, function(d) {
            return Vt(d, a) ? +d : d;
          }).sort(Af)), f;
        });
        function Nm(t, s) {
          var a = [];
          if (!(t && t.length))
            return a;
          var f = -1, d = [], b = t.length;
          for (s = j(s, 3); ++f < b; ) {
            var A = t[f];
            s(A, f, t) && (a.push(A), d.push(f));
          }
          return uf(t, d), a;
        }
        function Xo(t) {
          return t == null ? t : I1.call(t);
        }
        function Om(t, s, a) {
          var f = t == null ? 0 : t.length;
          return f ? (a && typeof a != "number" && We(t, s, a) ? (s = 0, a = f) : (s = s == null ? 0 : Z(s), a = a === n ? f : Z(a)), ht(t, s, a)) : [];
        }
        function Lm(t, s) {
          return zs(t, s);
        }
        function Mm(t, s, a) {
          return Lo(t, s, j(a, 2));
        }
        function Fm(t, s) {
          var a = t == null ? 0 : t.length;
          if (a) {
            var f = zs(t, s);
            if (f < a && xt(t[f], s))
              return f;
          }
          return -1;
        }
        function Um(t, s) {
          return zs(t, s, !0);
        }
        function km(t, s, a) {
          return Lo(t, s, j(a, 2), !0);
        }
        function Gm(t, s) {
          var a = t == null ? 0 : t.length;
          if (a) {
            var f = zs(t, s, !0) - 1;
            if (xt(t[f], s))
              return f;
          }
          return -1;
        }
        function Hm(t) {
          return t && t.length ? ff(t) : [];
        }
        function Qm(t, s) {
          return t && t.length ? ff(t, j(s, 2)) : [];
        }
        function zm(t) {
          var s = t == null ? 0 : t.length;
          return s ? ht(t, 1, s) : [];
        }
        function $m(t, s, a) {
          return t && t.length ? (s = a || s === n ? 1 : Z(s), ht(t, 0, s < 0 ? 0 : s)) : [];
        }
        function Wm(t, s, a) {
          var f = t == null ? 0 : t.length;
          return f ? (s = a || s === n ? 1 : Z(s), s = f - s, ht(t, s < 0 ? 0 : s, f)) : [];
        }
        function Vm(t, s) {
          return t && t.length ? $s(t, j(s, 3), !1, !0) : [];
        }
        function jm(t, s) {
          return t && t.length ? $s(t, j(s, 3)) : [];
        }
        var Jm = re(function(t) {
          return hn(Fe(t, 1, Te, !0));
        }), qm = re(function(t) {
          var s = pt(t);
          return Te(s) && (s = n), hn(Fe(t, 1, Te, !0), j(s, 2));
        }), Km = re(function(t) {
          var s = pt(t);
          return s = typeof s == "function" ? s : n, hn(Fe(t, 1, Te, !0), n, s);
        });
        function Ym(t) {
          return t && t.length ? hn(t) : [];
        }
        function Xm(t, s) {
          return t && t.length ? hn(t, j(s, 2)) : [];
        }
        function Zm(t, s) {
          return s = typeof s == "function" ? s : n, t && t.length ? hn(t, n, s) : [];
        }
        function Zo(t) {
          if (!(t && t.length))
            return [];
          var s = 0;
          return t = un(t, function(a) {
            if (Te(a))
              return s = Ce(a.length, s), !0;
          }), mo(s, function(a) {
            return be(t, ho(a));
          });
        }
        function Kf(t, s) {
          if (!(t && t.length))
            return [];
          var a = Zo(t);
          return s == null ? a : be(a, function(f) {
            return tt(s, n, f);
          });
        }
        var eb = re(function(t, s) {
          return Te(t) ? Ur(t, s) : [];
        }), tb = re(function(t) {
          return Fo(un(t, Te));
        }), nb = re(function(t) {
          var s = pt(t);
          return Te(s) && (s = n), Fo(un(t, Te), j(s, 2));
        }), rb = re(function(t) {
          var s = pt(t);
          return s = typeof s == "function" ? s : n, Fo(un(t, Te), n, s);
        }), sb = re(Zo);
        function ib(t, s) {
          return pf(t || [], s || [], Fr);
        }
        function ob(t, s) {
          return pf(t || [], s || [], Hr);
        }
        var ab = re(function(t) {
          var s = t.length, a = s > 1 ? t[s - 1] : n;
          return a = typeof a == "function" ? (t.pop(), a) : n, Kf(t, a);
        });
        function Yf(t) {
          var s = p(t);
          return s.__chain__ = !0, s;
        }
        function ub(t, s) {
          return s(t), t;
        }
        function Zs(t, s) {
          return s(t);
        }
        var cb = Wt(function(t) {
          var s = t.length, a = s ? t[0] : 0, f = this.__wrapped__, d = function(b) {
            return To(b, t);
          };
          return s > 1 || this.__actions__.length || !(f instanceof ae) || !Vt(a) ? this.thru(d) : (f = f.slice(a, +a + (s ? 1 : 0)), f.__actions__.push({
            func: Zs,
            args: [d],
            thisArg: n
          }), new lt(f, this.__chain__).thru(function(b) {
            return s && !b.length && b.push(n), b;
          }));
        });
        function fb() {
          return Yf(this);
        }
        function lb() {
          return new lt(this.value(), this.__chain__);
        }
        function db() {
          this.__values__ === n && (this.__values__ = l0(this.value()));
          var t = this.__index__ >= this.__values__.length, s = t ? n : this.__values__[this.__index__++];
          return { done: t, value: s };
        }
        function hb() {
          return this;
        }
        function pb(t) {
          for (var s, a = this; a instanceof Us; ) {
            var f = $f(a);
            f.__index__ = 0, f.__values__ = n, s ? d.__wrapped__ = f : s = f;
            var d = f;
            a = a.__wrapped__;
          }
          return d.__wrapped__ = t, s;
        }
        function gb() {
          var t = this.__wrapped__;
          if (t instanceof ae) {
            var s = t;
            return this.__actions__.length && (s = new ae(this)), s = s.reverse(), s.__actions__.push({
              func: Zs,
              args: [Xo],
              thisArg: n
            }), new lt(s, this.__chain__);
          }
          return this.thru(Xo);
        }
        function mb() {
          return hf(this.__wrapped__, this.__actions__);
        }
        var bb = Ws(function(t, s, a) {
          he.call(t, a) ? ++t[a] : zt(t, a, 1);
        });
        function Ab(t, s, a) {
          var f = Y(t) ? Pc : ug;
          return a && We(t, s, a) && (s = n), f(t, j(s, 3));
        }
        function yb(t, s) {
          var a = Y(t) ? un : qc;
          return a(t, j(s, 3));
        }
        var wb = Tf(Wf), Eb = Tf(Vf);
        function xb(t, s) {
          return Fe(ei(t, s), 1);
        }
        function vb(t, s) {
          return Fe(ei(t, s), ze);
        }
        function Tb(t, s, a) {
          return a = a === n ? 1 : Z(a), Fe(ei(t, s), a);
        }
        function Xf(t, s) {
          var a = Y(t) ? ct : dn;
          return a(t, j(s, 3));
        }
        function Zf(t, s) {
          var a = Y(t) ? zp : Jc;
          return a(t, j(s, 3));
        }
        var Pb = Ws(function(t, s, a) {
          he.call(t, a) ? t[a].push(s) : zt(t, a, [s]);
        });
        function Ib(t, s, a, f) {
          t = qe(t) ? t : or(t), a = a && !f ? Z(a) : 0;
          var d = t.length;
          return a < 0 && (a = Ce(d + a, 0)), ii(t) ? a <= d && t.indexOf(s, a) > -1 : !!d && Jn(t, s, a) > -1;
        }
        var Sb = re(function(t, s, a) {
          var f = -1, d = typeof s == "function", b = qe(t) ? B(t.length) : [];
          return dn(t, function(A) {
            b[++f] = d ? tt(s, A, a) : kr(A, s, a);
          }), b;
        }), Bb = Ws(function(t, s, a) {
          zt(t, a, s);
        });
        function ei(t, s) {
          var a = Y(t) ? be : tf;
          return a(t, j(s, 3));
        }
        function Rb(t, s, a, f) {
          return t == null ? [] : (Y(s) || (s = s == null ? [] : [s]), a = f ? n : a, Y(a) || (a = a == null ? [] : [a]), of(t, s, a));
        }
        var Cb = Ws(function(t, s, a) {
          t[a ? 0 : 1].push(s);
        }, function() {
          return [[], []];
        });
        function _b(t, s, a) {
          var f = Y(t) ? fo : Rc, d = arguments.length < 3;
          return f(t, j(s, 4), a, d, dn);
        }
        function Db(t, s, a) {
          var f = Y(t) ? $p : Rc, d = arguments.length < 3;
          return f(t, j(s, 4), a, d, Jc);
        }
        function Nb(t, s) {
          var a = Y(t) ? un : qc;
          return a(t, ri(j(s, 3)));
        }
        function Ob(t) {
          var s = Y(t) ? $c : Ig;
          return s(t);
        }
        function Lb(t, s, a) {
          (a ? We(t, s, a) : s === n) ? s = 1 : s = Z(s);
          var f = Y(t) ? rg : Sg;
          return f(t, s);
        }
        function Mb(t) {
          var s = Y(t) ? sg : Rg;
          return s(t);
        }
        function Fb(t) {
          if (t == null)
            return 0;
          if (qe(t))
            return ii(t) ? Kn(t) : t.length;
          var s = Qe(t);
          return s == At || s == yt ? t.size : Co(t).length;
        }
        function Ub(t, s, a) {
          var f = Y(t) ? lo : Cg;
          return a && We(t, s, a) && (s = n), f(t, j(s, 3));
        }
        var kb = re(function(t, s) {
          if (t == null)
            return [];
          var a = s.length;
          return a > 1 && We(t, s[0], s[1]) ? s = [] : a > 2 && We(s[0], s[1], s[2]) && (s = [s[0]]), of(t, Fe(s, 1), []);
        }), ti = y1 || function() {
          return Me.Date.now();
        };
        function Gb(t, s) {
          if (typeof s != "function")
            throw new ft(c);
          return t = Z(t), function() {
            if (--t < 1)
              return s.apply(this, arguments);
          };
        }
        function e0(t, s, a) {
          return s = a ? n : s, s = t && s == null ? t.length : s, $t(t, k, n, n, n, n, s);
        }
        function t0(t, s) {
          var a;
          if (typeof s != "function")
            throw new ft(c);
          return t = Z(t), function() {
            return --t > 0 && (a = s.apply(this, arguments)), t <= 1 && (s = n), a;
          };
        }
        var ea = re(function(t, s, a) {
          var f = O;
          if (a.length) {
            var d = fn(a, sr(ea));
            f |= T;
          }
          return $t(t, f, s, a, d);
        }), n0 = re(function(t, s, a) {
          var f = O | S;
          if (a.length) {
            var d = fn(a, sr(n0));
            f |= T;
          }
          return $t(s, f, t, a, d);
        });
        function r0(t, s, a) {
          s = a ? n : s;
          var f = $t(t, Q, n, n, n, n, n, s);
          return f.placeholder = r0.placeholder, f;
        }
        function s0(t, s, a) {
          s = a ? n : s;
          var f = $t(t, _, n, n, n, n, n, s);
          return f.placeholder = s0.placeholder, f;
        }
        function i0(t, s, a) {
          var f, d, b, A, E, P, N = 0, L = !1, M = !1, H = !0;
          if (typeof t != "function")
            throw new ft(c);
          s = gt(s) || 0, Ee(a) && (L = !!a.leading, M = "maxWait" in a, b = M ? Ce(gt(a.maxWait) || 0, s) : b, H = "trailing" in a ? !!a.trailing : H);
          function V(Pe) {
            var vt = f, qt = d;
            return f = d = n, N = Pe, A = t.apply(qt, vt), A;
          }
          function J(Pe) {
            return N = Pe, E = $r(oe, s), L ? V(Pe) : A;
          }
          function ee(Pe) {
            var vt = Pe - P, qt = Pe - N, T0 = s - vt;
            return M ? He(T0, b - qt) : T0;
          }
          function q(Pe) {
            var vt = Pe - P, qt = Pe - N;
            return P === n || vt >= s || vt < 0 || M && qt >= b;
          }
          function oe() {
            var Pe = ti();
            if (q(Pe))
              return ue(Pe);
            E = $r(oe, ee(Pe));
          }
          function ue(Pe) {
            return E = n, H && f ? V(Pe) : (f = d = n, A);
          }
          function it() {
            E !== n && gf(E), N = 0, f = P = d = E = n;
          }
          function Ve() {
            return E === n ? A : ue(ti());
          }
          function ot() {
            var Pe = ti(), vt = q(Pe);
            if (f = arguments, d = this, P = Pe, vt) {
              if (E === n)
                return J(P);
              if (M)
                return gf(E), E = $r(oe, s), V(P);
            }
            return E === n && (E = $r(oe, s)), A;
          }
          return ot.cancel = it, ot.flush = Ve, ot;
        }
        var Hb = re(function(t, s) {
          return jc(t, 1, s);
        }), Qb = re(function(t, s, a) {
          return jc(t, gt(s) || 0, a);
        });
        function zb(t) {
          return $t(t, $);
        }
        function ni(t, s) {
          if (typeof t != "function" || s != null && typeof s != "function")
            throw new ft(c);
          var a = function() {
            var f = arguments, d = s ? s.apply(this, f) : f[0], b = a.cache;
            if (b.has(d))
              return b.get(d);
            var A = t.apply(this, f);
            return a.cache = b.set(d, A) || b, A;
          };
          return a.cache = new (ni.Cache || Qt)(), a;
        }
        ni.Cache = Qt;
        function ri(t) {
          if (typeof t != "function")
            throw new ft(c);
          return function() {
            var s = arguments;
            switch (s.length) {
              case 0:
                return !t.call(this);
              case 1:
                return !t.call(this, s[0]);
              case 2:
                return !t.call(this, s[0], s[1]);
              case 3:
                return !t.call(this, s[0], s[1], s[2]);
            }
            return !t.apply(this, s);
          };
        }
        function $b(t) {
          return t0(2, t);
        }
        var Wb = _g(function(t, s) {
          s = s.length == 1 && Y(s[0]) ? be(s[0], nt(j())) : be(Fe(s, 1), nt(j()));
          var a = s.length;
          return re(function(f) {
            for (var d = -1, b = He(f.length, a); ++d < b; )
              f[d] = s[d].call(this, f[d]);
            return tt(t, this, f);
          });
        }), ta = re(function(t, s) {
          var a = fn(s, sr(ta));
          return $t(t, T, n, s, a);
        }), o0 = re(function(t, s) {
          var a = fn(s, sr(o0));
          return $t(t, C, n, s, a);
        }), Vb = Wt(function(t, s) {
          return $t(t, F, n, n, n, s);
        });
        function jb(t, s) {
          if (typeof t != "function")
            throw new ft(c);
          return s = s === n ? s : Z(s), re(t, s);
        }
        function Jb(t, s) {
          if (typeof t != "function")
            throw new ft(c);
          return s = s == null ? 0 : Ce(Z(s), 0), re(function(a) {
            var f = a[s], d = gn(a, 0, s);
            return f && cn(d, f), tt(t, this, d);
          });
        }
        function qb(t, s, a) {
          var f = !0, d = !0;
          if (typeof t != "function")
            throw new ft(c);
          return Ee(a) && (f = "leading" in a ? !!a.leading : f, d = "trailing" in a ? !!a.trailing : d), i0(t, s, {
            leading: f,
            maxWait: s,
            trailing: d
          });
        }
        function Kb(t) {
          return e0(t, 1);
        }
        function Yb(t, s) {
          return ta(ko(s), t);
        }
        function Xb() {
          if (!arguments.length)
            return [];
          var t = arguments[0];
          return Y(t) ? t : [t];
        }
        function Zb(t) {
          return dt(t, x);
        }
        function eA(t, s) {
          return s = typeof s == "function" ? s : n, dt(t, x, s);
        }
        function tA(t) {
          return dt(t, y | x);
        }
        function nA(t, s) {
          return s = typeof s == "function" ? s : n, dt(t, y | x, s);
        }
        function rA(t, s) {
          return s == null || Vc(t, s, Ne(s));
        }
        function xt(t, s) {
          return t === s || t !== t && s !== s;
        }
        var sA = qs(So), iA = qs(function(t, s) {
          return t >= s;
        }), Nn = Xc(/* @__PURE__ */ (function() {
          return arguments;
        })()) ? Xc : function(t) {
          return ve(t) && he.call(t, "callee") && !Uc.call(t, "callee");
        }, Y = B.isArray, oA = yc ? nt(yc) : pg;
        function qe(t) {
          return t != null && si(t.length) && !jt(t);
        }
        function Te(t) {
          return ve(t) && qe(t);
        }
        function aA(t) {
          return t === !0 || t === !1 || ve(t) && $e(t) == Tr;
        }
        var mn = E1 || da, uA = wc ? nt(wc) : gg;
        function cA(t) {
          return ve(t) && t.nodeType === 1 && !Wr(t);
        }
        function fA(t) {
          if (t == null)
            return !0;
          if (qe(t) && (Y(t) || typeof t == "string" || typeof t.splice == "function" || mn(t) || ir(t) || Nn(t)))
            return !t.length;
          var s = Qe(t);
          if (s == At || s == yt)
            return !t.size;
          if (zr(t))
            return !Co(t).length;
          for (var a in t)
            if (he.call(t, a))
              return !1;
          return !0;
        }
        function lA(t, s) {
          return Gr(t, s);
        }
        function dA(t, s, a) {
          a = typeof a == "function" ? a : n;
          var f = a ? a(t, s) : n;
          return f === n ? Gr(t, s, n, a) : !!f;
        }
        function na(t) {
          if (!ve(t))
            return !1;
          var s = $e(t);
          return s == ms || s == Lh || typeof t.message == "string" && typeof t.name == "string" && !Wr(t);
        }
        function hA(t) {
          return typeof t == "number" && Gc(t);
        }
        function jt(t) {
          if (!Ee(t))
            return !1;
          var s = $e(t);
          return s == bs || s == ju || s == Oh || s == Fh;
        }
        function a0(t) {
          return typeof t == "number" && t == Z(t);
        }
        function si(t) {
          return typeof t == "number" && t > -1 && t % 1 == 0 && t <= xe;
        }
        function Ee(t) {
          var s = typeof t;
          return t != null && (s == "object" || s == "function");
        }
        function ve(t) {
          return t != null && typeof t == "object";
        }
        var u0 = Ec ? nt(Ec) : bg;
        function pA(t, s) {
          return t === s || Ro(t, s, Vo(s));
        }
        function gA(t, s, a) {
          return a = typeof a == "function" ? a : n, Ro(t, s, Vo(s), a);
        }
        function mA(t) {
          return c0(t) && t != +t;
        }
        function bA(t) {
          if (em(t))
            throw new K(u);
          return Zc(t);
        }
        function AA(t) {
          return t === null;
        }
        function yA(t) {
          return t == null;
        }
        function c0(t) {
          return typeof t == "number" || ve(t) && $e(t) == Ir;
        }
        function Wr(t) {
          if (!ve(t) || $e(t) != Gt)
            return !1;
          var s = _s(t);
          if (s === null)
            return !0;
          var a = he.call(s, "constructor") && s.constructor;
          return typeof a == "function" && a instanceof a && Ss.call(a) == g1;
        }
        var ra = xc ? nt(xc) : Ag;
        function wA(t) {
          return a0(t) && t >= -xe && t <= xe;
        }
        var f0 = vc ? nt(vc) : yg;
        function ii(t) {
          return typeof t == "string" || !Y(t) && ve(t) && $e(t) == Br;
        }
        function st(t) {
          return typeof t == "symbol" || ve(t) && $e(t) == As;
        }
        var ir = Tc ? nt(Tc) : wg;
        function EA(t) {
          return t === n;
        }
        function xA(t) {
          return ve(t) && Qe(t) == Rr;
        }
        function vA(t) {
          return ve(t) && $e(t) == kh;
        }
        var TA = qs(_o), PA = qs(function(t, s) {
          return t <= s;
        });
        function l0(t) {
          if (!t)
            return [];
          if (qe(t))
            return ii(t) ? wt(t) : Je(t);
          if (Dr && t[Dr])
            return r1(t[Dr]());
          var s = Qe(t), a = s == At ? Ao : s == yt ? Ts : or;
          return a(t);
        }
        function Jt(t) {
          if (!t)
            return t === 0 ? t : 0;
          if (t = gt(t), t === ze || t === -ze) {
            var s = t < 0 ? -1 : 1;
            return s * bt;
          }
          return t === t ? t : 0;
        }
        function Z(t) {
          var s = Jt(t), a = s % 1;
          return s === s ? a ? s - a : s : 0;
        }
        function d0(t) {
          return t ? Rn(Z(t), 0, Ze) : 0;
        }
        function gt(t) {
          if (typeof t == "number")
            return t;
          if (st(t))
            return at;
          if (Ee(t)) {
            var s = typeof t.valueOf == "function" ? t.valueOf() : t;
            t = Ee(s) ? s + "" : s;
          }
          if (typeof t != "string")
            return t === 0 ? t : +t;
          t = Cc(t);
          var a = op.test(t);
          return a || up.test(t) ? Gp(t.slice(2), a ? 2 : 8) : ip.test(t) ? at : +t;
        }
        function h0(t) {
          return Rt(t, Ke(t));
        }
        function IA(t) {
          return t ? Rn(Z(t), -xe, xe) : t === 0 ? t : 0;
        }
        function de(t) {
          return t == null ? "" : rt(t);
        }
        var SA = nr(function(t, s) {
          if (zr(s) || qe(s)) {
            Rt(s, Ne(s), t);
            return;
          }
          for (var a in s)
            he.call(s, a) && Fr(t, a, s[a]);
        }), p0 = nr(function(t, s) {
          Rt(s, Ke(s), t);
        }), oi = nr(function(t, s, a, f) {
          Rt(s, Ke(s), t, f);
        }), BA = nr(function(t, s, a, f) {
          Rt(s, Ne(s), t, f);
        }), RA = Wt(To);
        function CA(t, s) {
          var a = tr(t);
          return s == null ? a : Wc(a, s);
        }
        var _A = re(function(t, s) {
          t = pe(t);
          var a = -1, f = s.length, d = f > 2 ? s[2] : n;
          for (d && We(s[0], s[1], d) && (f = 1); ++a < f; )
            for (var b = s[a], A = Ke(b), E = -1, P = A.length; ++E < P; ) {
              var N = A[E], L = t[N];
              (L === n || xt(L, Xn[N]) && !he.call(t, N)) && (t[N] = b[N]);
            }
          return t;
        }), DA = re(function(t) {
          return t.push(n, _f), tt(g0, n, t);
        });
        function NA(t, s) {
          return Ic(t, j(s, 3), Bt);
        }
        function OA(t, s) {
          return Ic(t, j(s, 3), Io);
        }
        function LA(t, s) {
          return t == null ? t : Po(t, j(s, 3), Ke);
        }
        function MA(t, s) {
          return t == null ? t : Kc(t, j(s, 3), Ke);
        }
        function FA(t, s) {
          return t && Bt(t, j(s, 3));
        }
        function UA(t, s) {
          return t && Io(t, j(s, 3));
        }
        function kA(t) {
          return t == null ? [] : Hs(t, Ne(t));
        }
        function GA(t) {
          return t == null ? [] : Hs(t, Ke(t));
        }
        function sa(t, s, a) {
          var f = t == null ? n : Cn(t, s);
          return f === n ? a : f;
        }
        function HA(t, s) {
          return t != null && Of(t, s, fg);
        }
        function ia(t, s) {
          return t != null && Of(t, s, lg);
        }
        var QA = If(function(t, s, a) {
          s != null && typeof s.toString != "function" && (s = Bs.call(s)), t[s] = a;
        }, aa(Ye)), zA = If(function(t, s, a) {
          s != null && typeof s.toString != "function" && (s = Bs.call(s)), he.call(t, s) ? t[s].push(a) : t[s] = [a];
        }, j), $A = re(kr);
        function Ne(t) {
          return qe(t) ? zc(t) : Co(t);
        }
        function Ke(t) {
          return qe(t) ? zc(t, !0) : Eg(t);
        }
        function WA(t, s) {
          var a = {};
          return s = j(s, 3), Bt(t, function(f, d, b) {
            zt(a, s(f, d, b), f);
          }), a;
        }
        function VA(t, s) {
          var a = {};
          return s = j(s, 3), Bt(t, function(f, d, b) {
            zt(a, d, s(f, d, b));
          }), a;
        }
        var jA = nr(function(t, s, a) {
          Qs(t, s, a);
        }), g0 = nr(function(t, s, a, f) {
          Qs(t, s, a, f);
        }), JA = Wt(function(t, s) {
          var a = {};
          if (t == null)
            return a;
          var f = !1;
          s = be(s, function(b) {
            return b = pn(b, t), f || (f = b.length > 1), b;
          }), Rt(t, $o(t), a), f && (a = dt(a, y | w | x, Qg));
          for (var d = s.length; d--; )
            Mo(a, s[d]);
          return a;
        });
        function qA(t, s) {
          return m0(t, ri(j(s)));
        }
        var KA = Wt(function(t, s) {
          return t == null ? {} : vg(t, s);
        });
        function m0(t, s) {
          if (t == null)
            return {};
          var a = be($o(t), function(f) {
            return [f];
          });
          return s = j(s), af(t, a, function(f, d) {
            return s(f, d[0]);
          });
        }
        function YA(t, s, a) {
          s = pn(s, t);
          var f = -1, d = s.length;
          for (d || (d = 1, t = n); ++f < d; ) {
            var b = t == null ? n : t[Ct(s[f])];
            b === n && (f = d, b = a), t = jt(b) ? b.call(t) : b;
          }
          return t;
        }
        function XA(t, s, a) {
          return t == null ? t : Hr(t, s, a);
        }
        function ZA(t, s, a, f) {
          return f = typeof f == "function" ? f : n, t == null ? t : Hr(t, s, a, f);
        }
        var b0 = Rf(Ne), A0 = Rf(Ke);
        function ey(t, s, a) {
          var f = Y(t), d = f || mn(t) || ir(t);
          if (s = j(s, 4), a == null) {
            var b = t && t.constructor;
            d ? a = f ? new b() : [] : Ee(t) ? a = jt(b) ? tr(_s(t)) : {} : a = {};
          }
          return (d ? ct : Bt)(t, function(A, E, P) {
            return s(a, A, E, P);
          }), a;
        }
        function ty(t, s) {
          return t == null ? !0 : Mo(t, s);
        }
        function ny(t, s, a) {
          return t == null ? t : df(t, s, ko(a));
        }
        function ry(t, s, a, f) {
          return f = typeof f == "function" ? f : n, t == null ? t : df(t, s, ko(a), f);
        }
        function or(t) {
          return t == null ? [] : bo(t, Ne(t));
        }
        function sy(t) {
          return t == null ? [] : bo(t, Ke(t));
        }
        function iy(t, s, a) {
          return a === n && (a = s, s = n), a !== n && (a = gt(a), a = a === a ? a : 0), s !== n && (s = gt(s), s = s === s ? s : 0), Rn(gt(t), s, a);
        }
        function oy(t, s, a) {
          return s = Jt(s), a === n ? (a = s, s = 0) : a = Jt(a), t = gt(t), dg(t, s, a);
        }
        function ay(t, s, a) {
          if (a && typeof a != "boolean" && We(t, s, a) && (s = a = n), a === n && (typeof s == "boolean" ? (a = s, s = n) : typeof t == "boolean" && (a = t, t = n)), t === n && s === n ? (t = 0, s = 1) : (t = Jt(t), s === n ? (s = t, t = 0) : s = Jt(s)), t > s) {
            var f = t;
            t = s, s = f;
          }
          if (a || t % 1 || s % 1) {
            var d = Hc();
            return He(t + d * (s - t + kp("1e-" + ((d + "").length - 1))), s);
          }
          return No(t, s);
        }
        var uy = rr(function(t, s, a) {
          return s = s.toLowerCase(), t + (a ? y0(s) : s);
        });
        function y0(t) {
          return oa(de(t).toLowerCase());
        }
        function w0(t) {
          return t = de(t), t && t.replace(fp, Xp).replace(Rp, "");
        }
        function cy(t, s, a) {
          t = de(t), s = rt(s);
          var f = t.length;
          a = a === n ? f : Rn(Z(a), 0, f);
          var d = a;
          return a -= s.length, a >= 0 && t.slice(a, d) == s;
        }
        function fy(t) {
          return t = de(t), t && $h.test(t) ? t.replace(Ku, Zp) : t;
        }
        function ly(t) {
          return t = de(t), t && Kh.test(t) ? t.replace(eo, "\\$&") : t;
        }
        var dy = rr(function(t, s, a) {
          return t + (a ? "-" : "") + s.toLowerCase();
        }), hy = rr(function(t, s, a) {
          return t + (a ? " " : "") + s.toLowerCase();
        }), py = vf("toLowerCase");
        function gy(t, s, a) {
          t = de(t), s = Z(s);
          var f = s ? Kn(t) : 0;
          if (!s || f >= s)
            return t;
          var d = (s - f) / 2;
          return Js(Ls(d), a) + t + Js(Os(d), a);
        }
        function my(t, s, a) {
          t = de(t), s = Z(s);
          var f = s ? Kn(t) : 0;
          return s && f < s ? t + Js(s - f, a) : t;
        }
        function by(t, s, a) {
          t = de(t), s = Z(s);
          var f = s ? Kn(t) : 0;
          return s && f < s ? Js(s - f, a) + t : t;
        }
        function Ay(t, s, a) {
          return a || s == null ? s = 0 : s && (s = +s), P1(de(t).replace(to, ""), s || 0);
        }
        function yy(t, s, a) {
          return (a ? We(t, s, a) : s === n) ? s = 1 : s = Z(s), Oo(de(t), s);
        }
        function wy() {
          var t = arguments, s = de(t[0]);
          return t.length < 3 ? s : s.replace(t[1], t[2]);
        }
        var Ey = rr(function(t, s, a) {
          return t + (a ? "_" : "") + s.toLowerCase();
        });
        function xy(t, s, a) {
          return a && typeof a != "number" && We(t, s, a) && (s = a = n), a = a === n ? Ze : a >>> 0, a ? (t = de(t), t && (typeof s == "string" || s != null && !ra(s)) && (s = rt(s), !s && qn(t)) ? gn(wt(t), 0, a) : t.split(s, a)) : [];
        }
        var vy = rr(function(t, s, a) {
          return t + (a ? " " : "") + oa(s);
        });
        function Ty(t, s, a) {
          return t = de(t), a = a == null ? 0 : Rn(Z(a), 0, t.length), s = rt(s), t.slice(a, a + s.length) == s;
        }
        function Py(t, s, a) {
          var f = p.templateSettings;
          a && We(t, s, a) && (s = n), t = de(t), s = oi({}, s, f, Cf);
          var d = oi({}, s.imports, f.imports, Cf), b = Ne(d), A = bo(d, b), E, P, N = 0, L = s.interpolate || ys, M = "__p += '", H = yo(
            (s.escape || ys).source + "|" + L.source + "|" + (L === Yu ? sp : ys).source + "|" + (s.evaluate || ys).source + "|$",
            "g"
          ), V = "//# sourceURL=" + (he.call(s, "sourceURL") ? (s.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++Op + "]") + `
`;
          t.replace(H, function(q, oe, ue, it, Ve, ot) {
            return ue || (ue = it), M += t.slice(N, ot).replace(lp, e1), oe && (E = !0, M += `' +
__e(` + oe + `) +
'`), Ve && (P = !0, M += `';
` + Ve + `;
__p += '`), ue && (M += `' +
((__t = (` + ue + `)) == null ? '' : __t) +
'`), N = ot + q.length, q;
          }), M += `';
`;
          var J = he.call(s, "variable") && s.variable;
          if (!J)
            M = `with (obj) {
` + M + `
}
`;
          else if (np.test(J))
            throw new K(l);
          M = (P ? M.replace(Gh, "") : M).replace(Hh, "$1").replace(Qh, "$1;"), M = "function(" + (J || "obj") + `) {
` + (J ? "" : `obj || (obj = {});
`) + "var __t, __p = ''" + (E ? ", __e = _.escape" : "") + (P ? `, __j = Array.prototype.join;
function print() { __p += __j.call(arguments, '') }
` : `;
`) + M + `return __p
}`;
          var ee = x0(function() {
            return le(b, V + "return " + M).apply(n, A);
          });
          if (ee.source = M, na(ee))
            throw ee;
          return ee;
        }
        function Iy(t) {
          return de(t).toLowerCase();
        }
        function Sy(t) {
          return de(t).toUpperCase();
        }
        function By(t, s, a) {
          if (t = de(t), t && (a || s === n))
            return Cc(t);
          if (!t || !(s = rt(s)))
            return t;
          var f = wt(t), d = wt(s), b = _c(f, d), A = Dc(f, d) + 1;
          return gn(f, b, A).join("");
        }
        function Ry(t, s, a) {
          if (t = de(t), t && (a || s === n))
            return t.slice(0, Oc(t) + 1);
          if (!t || !(s = rt(s)))
            return t;
          var f = wt(t), d = Dc(f, wt(s)) + 1;
          return gn(f, 0, d).join("");
        }
        function Cy(t, s, a) {
          if (t = de(t), t && (a || s === n))
            return t.replace(to, "");
          if (!t || !(s = rt(s)))
            return t;
          var f = wt(t), d = _c(f, wt(s));
          return gn(f, d).join("");
        }
        function _y(t, s) {
          var a = W, f = ne;
          if (Ee(s)) {
            var d = "separator" in s ? s.separator : d;
            a = "length" in s ? Z(s.length) : a, f = "omission" in s ? rt(s.omission) : f;
          }
          t = de(t);
          var b = t.length;
          if (qn(t)) {
            var A = wt(t);
            b = A.length;
          }
          if (a >= b)
            return t;
          var E = a - Kn(f);
          if (E < 1)
            return f;
          var P = A ? gn(A, 0, E).join("") : t.slice(0, E);
          if (d === n)
            return P + f;
          if (A && (E += P.length - E), ra(d)) {
            if (t.slice(E).search(d)) {
              var N, L = P;
              for (d.global || (d = yo(d.source, de(Xu.exec(d)) + "g")), d.lastIndex = 0; N = d.exec(L); )
                var M = N.index;
              P = P.slice(0, M === n ? E : M);
            }
          } else if (t.indexOf(rt(d), E) != E) {
            var H = P.lastIndexOf(d);
            H > -1 && (P = P.slice(0, H));
          }
          return P + f;
        }
        function Dy(t) {
          return t = de(t), t && zh.test(t) ? t.replace(qu, a1) : t;
        }
        var Ny = rr(function(t, s, a) {
          return t + (a ? " " : "") + s.toUpperCase();
        }), oa = vf("toUpperCase");
        function E0(t, s, a) {
          return t = de(t), s = a ? n : s, s === n ? n1(t) ? f1(t) : jp(t) : t.match(s) || [];
        }
        var x0 = re(function(t, s) {
          try {
            return tt(t, n, s);
          } catch (a) {
            return na(a) ? a : new K(a);
          }
        }), Oy = Wt(function(t, s) {
          return ct(s, function(a) {
            a = Ct(a), zt(t, a, ea(t[a], t));
          }), t;
        });
        function Ly(t) {
          var s = t == null ? 0 : t.length, a = j();
          return t = s ? be(t, function(f) {
            if (typeof f[1] != "function")
              throw new ft(c);
            return [a(f[0]), f[1]];
          }) : [], re(function(f) {
            for (var d = -1; ++d < s; ) {
              var b = t[d];
              if (tt(b[0], this, f))
                return tt(b[1], this, f);
            }
          });
        }
        function My(t) {
          return ag(dt(t, y));
        }
        function aa(t) {
          return function() {
            return t;
          };
        }
        function Fy(t, s) {
          return t == null || t !== t ? s : t;
        }
        var Uy = Pf(), ky = Pf(!0);
        function Ye(t) {
          return t;
        }
        function ua(t) {
          return ef(typeof t == "function" ? t : dt(t, y));
        }
        function Gy(t) {
          return nf(dt(t, y));
        }
        function Hy(t, s) {
          return rf(t, dt(s, y));
        }
        var Qy = re(function(t, s) {
          return function(a) {
            return kr(a, t, s);
          };
        }), zy = re(function(t, s) {
          return function(a) {
            return kr(t, a, s);
          };
        });
        function ca(t, s, a) {
          var f = Ne(s), d = Hs(s, f);
          a == null && !(Ee(s) && (d.length || !f.length)) && (a = s, s = t, t = this, d = Hs(s, Ne(s)));
          var b = !(Ee(a) && "chain" in a) || !!a.chain, A = jt(t);
          return ct(d, function(E) {
            var P = s[E];
            t[E] = P, A && (t.prototype[E] = function() {
              var N = this.__chain__;
              if (b || N) {
                var L = t(this.__wrapped__), M = L.__actions__ = Je(this.__actions__);
                return M.push({ func: P, args: arguments, thisArg: t }), L.__chain__ = N, L;
              }
              return P.apply(t, cn([this.value()], arguments));
            });
          }), t;
        }
        function $y() {
          return Me._ === this && (Me._ = m1), this;
        }
        function fa() {
        }
        function Wy(t) {
          return t = Z(t), re(function(s) {
            return sf(s, t);
          });
        }
        var Vy = Ho(be), jy = Ho(Pc), Jy = Ho(lo);
        function v0(t) {
          return Jo(t) ? ho(Ct(t)) : Tg(t);
        }
        function qy(t) {
          return function(s) {
            return t == null ? n : Cn(t, s);
          };
        }
        var Ky = Sf(), Yy = Sf(!0);
        function la() {
          return [];
        }
        function da() {
          return !1;
        }
        function Xy() {
          return {};
        }
        function Zy() {
          return "";
        }
        function e5() {
          return !0;
        }
        function t5(t, s) {
          if (t = Z(t), t < 1 || t > xe)
            return [];
          var a = Ze, f = He(t, Ze);
          s = j(s), t -= Ze;
          for (var d = mo(f, s); ++a < t; )
            s(a);
          return d;
        }
        function n5(t) {
          return Y(t) ? be(t, Ct) : st(t) ? [t] : Je(zf(de(t)));
        }
        function r5(t) {
          var s = ++p1;
          return de(t) + s;
        }
        var s5 = js(function(t, s) {
          return t + s;
        }, 0), i5 = Qo("ceil"), o5 = js(function(t, s) {
          return t / s;
        }, 1), a5 = Qo("floor");
        function u5(t) {
          return t && t.length ? Gs(t, Ye, So) : n;
        }
        function c5(t, s) {
          return t && t.length ? Gs(t, j(s, 2), So) : n;
        }
        function f5(t) {
          return Bc(t, Ye);
        }
        function l5(t, s) {
          return Bc(t, j(s, 2));
        }
        function d5(t) {
          return t && t.length ? Gs(t, Ye, _o) : n;
        }
        function h5(t, s) {
          return t && t.length ? Gs(t, j(s, 2), _o) : n;
        }
        var p5 = js(function(t, s) {
          return t * s;
        }, 1), g5 = Qo("round"), m5 = js(function(t, s) {
          return t - s;
        }, 0);
        function b5(t) {
          return t && t.length ? go(t, Ye) : 0;
        }
        function A5(t, s) {
          return t && t.length ? go(t, j(s, 2)) : 0;
        }
        return p.after = Gb, p.ary = e0, p.assign = SA, p.assignIn = p0, p.assignInWith = oi, p.assignWith = BA, p.at = RA, p.before = t0, p.bind = ea, p.bindAll = Oy, p.bindKey = n0, p.castArray = Xb, p.chain = Yf, p.chunk = am, p.compact = um, p.concat = cm, p.cond = Ly, p.conforms = My, p.constant = aa, p.countBy = bb, p.create = CA, p.curry = r0, p.curryRight = s0, p.debounce = i0, p.defaults = _A, p.defaultsDeep = DA, p.defer = Hb, p.delay = Qb, p.difference = fm, p.differenceBy = lm, p.differenceWith = dm, p.drop = hm, p.dropRight = pm, p.dropRightWhile = gm, p.dropWhile = mm, p.fill = bm, p.filter = yb, p.flatMap = xb, p.flatMapDeep = vb, p.flatMapDepth = Tb, p.flatten = jf, p.flattenDeep = Am, p.flattenDepth = ym, p.flip = zb, p.flow = Uy, p.flowRight = ky, p.fromPairs = wm, p.functions = kA, p.functionsIn = GA, p.groupBy = Pb, p.initial = xm, p.intersection = vm, p.intersectionBy = Tm, p.intersectionWith = Pm, p.invert = QA, p.invertBy = zA, p.invokeMap = Sb, p.iteratee = ua, p.keyBy = Bb, p.keys = Ne, p.keysIn = Ke, p.map = ei, p.mapKeys = WA, p.mapValues = VA, p.matches = Gy, p.matchesProperty = Hy, p.memoize = ni, p.merge = jA, p.mergeWith = g0, p.method = Qy, p.methodOf = zy, p.mixin = ca, p.negate = ri, p.nthArg = Wy, p.omit = JA, p.omitBy = qA, p.once = $b, p.orderBy = Rb, p.over = Vy, p.overArgs = Wb, p.overEvery = jy, p.overSome = Jy, p.partial = ta, p.partialRight = o0, p.partition = Cb, p.pick = KA, p.pickBy = m0, p.property = v0, p.propertyOf = qy, p.pull = Rm, p.pullAll = qf, p.pullAllBy = Cm, p.pullAllWith = _m, p.pullAt = Dm, p.range = Ky, p.rangeRight = Yy, p.rearg = Vb, p.reject = Nb, p.remove = Nm, p.rest = jb, p.reverse = Xo, p.sampleSize = Lb, p.set = XA, p.setWith = ZA, p.shuffle = Mb, p.slice = Om, p.sortBy = kb, p.sortedUniq = Hm, p.sortedUniqBy = Qm, p.split = xy, p.spread = Jb, p.tail = zm, p.take = $m, p.takeRight = Wm, p.takeRightWhile = Vm, p.takeWhile = jm, p.tap = ub, p.throttle = qb, p.thru = Zs, p.toArray = l0, p.toPairs = b0, p.toPairsIn = A0, p.toPath = n5, p.toPlainObject = h0, p.transform = ey, p.unary = Kb, p.union = Jm, p.unionBy = qm, p.unionWith = Km, p.uniq = Ym, p.uniqBy = Xm, p.uniqWith = Zm, p.unset = ty, p.unzip = Zo, p.unzipWith = Kf, p.update = ny, p.updateWith = ry, p.values = or, p.valuesIn = sy, p.without = eb, p.words = E0, p.wrap = Yb, p.xor = tb, p.xorBy = nb, p.xorWith = rb, p.zip = sb, p.zipObject = ib, p.zipObjectDeep = ob, p.zipWith = ab, p.entries = b0, p.entriesIn = A0, p.extend = p0, p.extendWith = oi, ca(p, p), p.add = s5, p.attempt = x0, p.camelCase = uy, p.capitalize = y0, p.ceil = i5, p.clamp = iy, p.clone = Zb, p.cloneDeep = tA, p.cloneDeepWith = nA, p.cloneWith = eA, p.conformsTo = rA, p.deburr = w0, p.defaultTo = Fy, p.divide = o5, p.endsWith = cy, p.eq = xt, p.escape = fy, p.escapeRegExp = ly, p.every = Ab, p.find = wb, p.findIndex = Wf, p.findKey = NA, p.findLast = Eb, p.findLastIndex = Vf, p.findLastKey = OA, p.floor = a5, p.forEach = Xf, p.forEachRight = Zf, p.forIn = LA, p.forInRight = MA, p.forOwn = FA, p.forOwnRight = UA, p.get = sa, p.gt = sA, p.gte = iA, p.has = HA, p.hasIn = ia, p.head = Jf, p.identity = Ye, p.includes = Ib, p.indexOf = Em, p.inRange = oy, p.invoke = $A, p.isArguments = Nn, p.isArray = Y, p.isArrayBuffer = oA, p.isArrayLike = qe, p.isArrayLikeObject = Te, p.isBoolean = aA, p.isBuffer = mn, p.isDate = uA, p.isElement = cA, p.isEmpty = fA, p.isEqual = lA, p.isEqualWith = dA, p.isError = na, p.isFinite = hA, p.isFunction = jt, p.isInteger = a0, p.isLength = si, p.isMap = u0, p.isMatch = pA, p.isMatchWith = gA, p.isNaN = mA, p.isNative = bA, p.isNil = yA, p.isNull = AA, p.isNumber = c0, p.isObject = Ee, p.isObjectLike = ve, p.isPlainObject = Wr, p.isRegExp = ra, p.isSafeInteger = wA, p.isSet = f0, p.isString = ii, p.isSymbol = st, p.isTypedArray = ir, p.isUndefined = EA, p.isWeakMap = xA, p.isWeakSet = vA, p.join = Im, p.kebabCase = dy, p.last = pt, p.lastIndexOf = Sm, p.lowerCase = hy, p.lowerFirst = py, p.lt = TA, p.lte = PA, p.max = u5, p.maxBy = c5, p.mean = f5, p.meanBy = l5, p.min = d5, p.minBy = h5, p.stubArray = la, p.stubFalse = da, p.stubObject = Xy, p.stubString = Zy, p.stubTrue = e5, p.multiply = p5, p.nth = Bm, p.noConflict = $y, p.noop = fa, p.now = ti, p.pad = gy, p.padEnd = my, p.padStart = by, p.parseInt = Ay, p.random = ay, p.reduce = _b, p.reduceRight = Db, p.repeat = yy, p.replace = wy, p.result = YA, p.round = g5, p.runInContext = v, p.sample = Ob, p.size = Fb, p.snakeCase = Ey, p.some = Ub, p.sortedIndex = Lm, p.sortedIndexBy = Mm, p.sortedIndexOf = Fm, p.sortedLastIndex = Um, p.sortedLastIndexBy = km, p.sortedLastIndexOf = Gm, p.startCase = vy, p.startsWith = Ty, p.subtract = m5, p.sum = b5, p.sumBy = A5, p.template = Py, p.times = t5, p.toFinite = Jt, p.toInteger = Z, p.toLength = d0, p.toLower = Iy, p.toNumber = gt, p.toSafeInteger = IA, p.toString = de, p.toUpper = Sy, p.trim = By, p.trimEnd = Ry, p.trimStart = Cy, p.truncate = _y, p.unescape = Dy, p.uniqueId = r5, p.upperCase = Ny, p.upperFirst = oa, p.each = Xf, p.eachRight = Zf, p.first = Jf, ca(p, (function() {
          var t = {};
          return Bt(p, function(s, a) {
            he.call(p.prototype, a) || (t[a] = s);
          }), t;
        })(), { chain: !1 }), p.VERSION = i, ct(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(t) {
          p[t].placeholder = p;
        }), ct(["drop", "take"], function(t, s) {
          ae.prototype[t] = function(a) {
            a = a === n ? 1 : Ce(Z(a), 0);
            var f = this.__filtered__ && !s ? new ae(this) : this.clone();
            return f.__filtered__ ? f.__takeCount__ = He(a, f.__takeCount__) : f.__views__.push({
              size: He(a, Ze),
              type: t + (f.__dir__ < 0 ? "Right" : "")
            }), f;
          }, ae.prototype[t + "Right"] = function(a) {
            return this.reverse()[t](a).reverse();
          };
        }), ct(["filter", "map", "takeWhile"], function(t, s) {
          var a = s + 1, f = a == we || a == Le;
          ae.prototype[t] = function(d) {
            var b = this.clone();
            return b.__iteratees__.push({
              iteratee: j(d, 3),
              type: a
            }), b.__filtered__ = b.__filtered__ || f, b;
          };
        }), ct(["head", "last"], function(t, s) {
          var a = "take" + (s ? "Right" : "");
          ae.prototype[t] = function() {
            return this[a](1).value()[0];
          };
        }), ct(["initial", "tail"], function(t, s) {
          var a = "drop" + (s ? "" : "Right");
          ae.prototype[t] = function() {
            return this.__filtered__ ? new ae(this) : this[a](1);
          };
        }), ae.prototype.compact = function() {
          return this.filter(Ye);
        }, ae.prototype.find = function(t) {
          return this.filter(t).head();
        }, ae.prototype.findLast = function(t) {
          return this.reverse().find(t);
        }, ae.prototype.invokeMap = re(function(t, s) {
          return typeof t == "function" ? new ae(this) : this.map(function(a) {
            return kr(a, t, s);
          });
        }), ae.prototype.reject = function(t) {
          return this.filter(ri(j(t)));
        }, ae.prototype.slice = function(t, s) {
          t = Z(t);
          var a = this;
          return a.__filtered__ && (t > 0 || s < 0) ? new ae(a) : (t < 0 ? a = a.takeRight(-t) : t && (a = a.drop(t)), s !== n && (s = Z(s), a = s < 0 ? a.dropRight(-s) : a.take(s - t)), a);
        }, ae.prototype.takeRightWhile = function(t) {
          return this.reverse().takeWhile(t).reverse();
        }, ae.prototype.toArray = function() {
          return this.take(Ze);
        }, Bt(ae.prototype, function(t, s) {
          var a = /^(?:filter|find|map|reject)|While$/.test(s), f = /^(?:head|last)$/.test(s), d = p[f ? "take" + (s == "last" ? "Right" : "") : s], b = f || /^find/.test(s);
          d && (p.prototype[s] = function() {
            var A = this.__wrapped__, E = f ? [1] : arguments, P = A instanceof ae, N = E[0], L = P || Y(A), M = function(oe) {
              var ue = d.apply(p, cn([oe], E));
              return f && H ? ue[0] : ue;
            };
            L && a && typeof N == "function" && N.length != 1 && (P = L = !1);
            var H = this.__chain__, V = !!this.__actions__.length, J = b && !H, ee = P && !V;
            if (!b && L) {
              A = ee ? A : new ae(this);
              var q = t.apply(A, E);
              return q.__actions__.push({ func: Zs, args: [M], thisArg: n }), new lt(q, H);
            }
            return J && ee ? t.apply(this, E) : (q = this.thru(M), J ? f ? q.value()[0] : q.value() : q);
          });
        }), ct(["pop", "push", "shift", "sort", "splice", "unshift"], function(t) {
          var s = Ps[t], a = /^(?:push|sort|unshift)$/.test(t) ? "tap" : "thru", f = /^(?:pop|shift)$/.test(t);
          p.prototype[t] = function() {
            var d = arguments;
            if (f && !this.__chain__) {
              var b = this.value();
              return s.apply(Y(b) ? b : [], d);
            }
            return this[a](function(A) {
              return s.apply(Y(A) ? A : [], d);
            });
          };
        }), Bt(ae.prototype, function(t, s) {
          var a = p[s];
          if (a) {
            var f = a.name + "";
            he.call(er, f) || (er[f] = []), er[f].push({ name: s, func: a });
          }
        }), er[Vs(n, S).name] = [{
          name: "wrapper",
          func: n
        }], ae.prototype.clone = D1, ae.prototype.reverse = N1, ae.prototype.value = O1, p.prototype.at = cb, p.prototype.chain = fb, p.prototype.commit = lb, p.prototype.next = db, p.prototype.plant = pb, p.prototype.reverse = gb, p.prototype.toJSON = p.prototype.valueOf = p.prototype.value = mb, p.prototype.first = p.prototype.head, Dr && (p.prototype[Dr] = hb), p;
      }), Yn = l1();
      Pn ? ((Pn.exports = Yn)._ = Yn, ao._ = Yn) : Me._ = Yn;
    }).call(pv);
  })(Kr, Kr.exports)), Kr.exports;
}
var fr = gv();
const ke = [];
for (let e = 0; e < 256; ++e)
  ke.push((e + 256).toString(16).slice(1));
function mv(e, r = 0) {
  return (ke[e[r + 0]] + ke[e[r + 1]] + ke[e[r + 2]] + ke[e[r + 3]] + "-" + ke[e[r + 4]] + ke[e[r + 5]] + "-" + ke[e[r + 6]] + ke[e[r + 7]] + "-" + ke[e[r + 8]] + ke[e[r + 9]] + "-" + ke[e[r + 10]] + ke[e[r + 11]] + ke[e[r + 12]] + ke[e[r + 13]] + ke[e[r + 14]] + ke[e[r + 15]]).toLowerCase();
}
let Ra;
const bv = new Uint8Array(16);
function Av() {
  if (!Ra) {
    if (typeof crypto > "u" || !crypto.getRandomValues)
      throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
    Ra = crypto.getRandomValues.bind(crypto);
  }
  return Ra(bv);
}
const yv = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ml = { randomUUID: yv };
function wv(e, r, n) {
  var o;
  e = e || {};
  const i = e.random ?? ((o = e.rng) == null ? void 0 : o.call(e)) ?? Av();
  if (i.length < 16)
    throw new Error("Random bytes length must be >= 16");
  return i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, mv(i);
}
function Ev(e, r, n) {
  return ml.randomUUID && !e ? ml.randomUUID() : wv(e);
}
const Ae = {
  state: {},
  get(e) {
    return this.state[e] ? fr.cloneDeep(this.state[e]) : void 0;
  },
  getExecutionOptions(e) {
    var r, n, i, o;
    return {
      allowExecution: (n = (r = this.state[e]) == null ? void 0 : r.executionOptions) == null ? void 0 : n.allowExecution,
      executeInBackground: (o = (i = this.state[e]) == null ? void 0 : i.executionOptions) == null ? void 0 : o.executeInBackground
    };
  },
  set(e, r) {
    const n = xv(e);
    return this.state[n.id] = {
      route: n,
      executionOptions: {
        allowExecution: !0,
        executeInBackground: !1,
        ...r
      }
    }, fr.cloneDeep(this.state[n.id]);
  },
  update(e, r) {
    var i, o;
    const n = fr.cloneDeep(r);
    if (this.state[e]) {
      this.state[e] = {
        ...this.state[e],
        route: {
          ...this.state[e].route,
          ...n.route ?? {}
        },
        executionOptions: {
          ...this.state[e].executionOptions,
          ...n.executionOptions ?? {}
        }
      };
      const u = fr.cloneDeep(this.state[e].route);
      return (o = (i = this.state[e].executionOptions) == null ? void 0 : i.onUpdateHook) == null || o.call(i, u), u;
    }
  },
  delete(e) {
    delete this.state[e];
  }
};
function xv(e) {
  if (!e.id) {
    const r = Ev();
    e.id = r, e.steps.forEach((n, i) => {
      n.id = `${r}:${i}`;
    });
  }
  return e;
}
class vv {
  constructor(r) {
    X(this, "routeId");
    X(this, "stepId");
    X(this, "_step");
    this.routeId = r.id.split(":")[0], this.stepId = +r.id.split(":")[1], this._step = fr.cloneDeep(r), this.initExecution();
  }
  initExecution() {
    this._step.execution || (this._step.execution = {
      status: "PENDING",
      process: []
    }), this._step.execution.status === "FAILED" && (this._step.execution.status = "PENDING"), this.updateStepInRoute();
  }
  get step() {
    return this._step;
  }
  get executionOptions() {
    return Ae.getExecutionOptions(this.routeId) ?? {};
  }
  get executionStopped() {
    return this.executionOptions == null ? !0 : !this.executionOptions.allowExecution;
  }
  get interactionDisabled() {
    return this.executionOptions.executeInBackground == null ? !1 : this.executionOptions.executeInBackground;
  }
  get allStepsCompleted() {
    return this._step.execution.process.every((r) => r.status === "DONE");
  }
  completeStep() {
    return this.allStepsCompleted ? (this._step.execution.status = "DONE", this.updateStepInRoute()) : this.updateStepInRoute(!0), this._step;
  }
  findOrCreateProcess(r) {
    const n = this.getProcessByType(r.type);
    return n && n.status === "DONE" ? this.updateProcess(n) : (this._step.execution.process.push(r), this.updateProcess(r));
  }
  updateProcess({
    type: r,
    status: n,
    message: i,
    params: o
  }) {
    const u = this.getProcessByType(r);
    if (!u)
      throw new Error("Can't find a process for the given type.");
    switch (n) {
      case "FAILED":
        this._step.execution.status = "FAILED";
        break;
      case "PENDING":
        this._step.execution.status = "PENDING";
        break;
      case "ACTION_REQUIRED":
        this._step.execution.status = "ACTION_REQUIRED";
        break;
    }
    if (u.status = n, u.message = i, o)
      for (const [l, h] of Object.entries(o))
        u[l] = h;
    const c = n === "FAILED" || n === "ACTION_REQUIRED" && this.interactionDisabled;
    return this.updateStepInRoute(c), u;
  }
  updateStepInRoute(r = !1) {
    const n = Ae.get(this.routeId);
    n && (n.route.steps[this.stepId] = this._step, Ae.update(this.routeId, { route: n.route }), r && Nh(this.routeId));
  }
  /**
   * Injects the lifi steps into the route
   * This expects the array of steps to include *only*
   * a single step.
   * The assumption being that this is a lifi quote
   * not a lifi route.
   * https://docs.li.fi/integrate-li.fi-sdk/request-routes-quotes#difference-between-route-and-quote
   */
  injectLifiSteps(r) {
    const n = Ae.get(this.routeId).route;
    this._step = {
      ...r.steps[0],
      type: "lifi_token_swap",
      id: `${this.routeId}:${this.stepId}`
    }, n.steps[this.stepId] = {
      ...this._step,
      lifiRoute: r
    }, Ae.update(this.routeId, { route: n });
  }
  getProcessByType(r) {
    if (!this._step.execution)
      throw new Error("Can't find a process in an empty execution");
    return this._step.execution.process.find((n) => n.type === r) ?? null;
  }
}
class Eh {
  constructor(r, n) {
    X(this, "routeId");
    X(this, "stepManager");
    this.routeId = r.id, this.stepManager = new vv(fr.cloneDeep(n));
  }
  get route() {
    return Ae.get(this.routeId).route;
  }
}
class Tv extends Eh {
  constructor(r, n) {
    super(r, n);
  }
  async executeStep() {
    let r;
    try {
      if (this.stepManager.step.lifiRoute)
        r = await av(this.stepManager.step.lifiRoute, {
          updateRouteHook: this.onUpdateHook.bind(this),
          executeInBackground: this.stepManager.executionOptions.executeInBackground
        });
      else {
        const n = hv(this.stepManager.step.swapQuote);
        r = await wh(n, {
          updateRouteHook: this.onUpdateHook.bind(this),
          executeInBackground: this.stepManager.executionOptions.executeInBackground
        });
      }
      this.stepManager.injectLifiSteps(r);
    } catch {
    } finally {
      return this.stepManager.completeStep();
    }
  }
  onUpdateHook(r) {
    this.processRoute(r);
  }
  processRoute(r) {
    var i, o, u;
    const n = (o = (i = r.steps[0].execution) == null ? void 0 : i.process) == null ? void 0 : o[r.steps[0].execution.process.length - 1];
    if (n && n.status === "FAILED" && !n.message)
      switch ((u = n.error) == null ? void 0 : u.code) {
        case 1002:
          n.message = Nt.TransactionUnderpriced;
          break;
        case 1003:
          n.message = Nt.TransactionReverted;
          break;
        case 1007:
          n.message = "Chain switch is required.";
          break;
        case 1009:
          n.message = Nt.GasLimitLow;
          break;
        case 1010:
          n.message = "Transaction was cancelled.";
          break;
        case 1011:
          n.message = Nt.SlippageError;
          break;
        case 1012:
          n.message = "Signature required.";
          break;
        case 1013:
          n.message = "The balance is too low to complete transaction.";
          break;
        case 1015:
          n.message = "Insufficient funds to complete transaction.";
          break;
        case 1017:
          n.message = "Wallet was changed during execution.";
          break;
        default:
          n.message = "Action failed.";
          break;
      }
    this.stepManager.injectLifiSteps(r);
  }
}
var li = { exports: {} }, bl;
function Pv() {
  if (bl) return li.exports;
  bl = 1;
  var e = typeof Reflect == "object" ? Reflect : null, r = e && typeof e.apply == "function" ? e.apply : function(T, C, k) {
    return Function.prototype.apply.call(T, C, k);
  }, n;
  e && typeof e.ownKeys == "function" ? n = e.ownKeys : Object.getOwnPropertySymbols ? n = function(T) {
    return Object.getOwnPropertyNames(T).concat(Object.getOwnPropertySymbols(T));
  } : n = function(T) {
    return Object.getOwnPropertyNames(T);
  };
  function i(_) {
  }
  var o = Number.isNaN || function(T) {
    return T !== T;
  };
  function u() {
    u.init.call(this);
  }
  li.exports = u, li.exports.once = S, u.EventEmitter = u, u.prototype._events = void 0, u.prototype._eventsCount = 0, u.prototype._maxListeners = void 0;
  var c = 10;
  function l(_) {
    if (typeof _ != "function")
      throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof _);
  }
  Object.defineProperty(u, "defaultMaxListeners", {
    enumerable: !0,
    get: function() {
      return c;
    },
    set: function(_) {
      if (typeof _ != "number" || _ < 0 || o(_))
        throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + _ + ".");
      c = _;
    }
  }), u.init = function() {
    (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
  }, u.prototype.setMaxListeners = function(T) {
    if (typeof T != "number" || T < 0 || o(T))
      throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + T + ".");
    return this._maxListeners = T, this;
  };
  function h(_) {
    return _._maxListeners === void 0 ? u.defaultMaxListeners : _._maxListeners;
  }
  u.prototype.getMaxListeners = function() {
    return h(this);
  }, u.prototype.emit = function(T) {
    for (var C = [], k = 1; k < arguments.length; k++) C.push(arguments[k]);
    var F = T === "error", $ = this._events;
    if ($ !== void 0)
      F = F && $.error === void 0;
    else if (!F)
      return !1;
    if (F) {
      var W;
      if (C.length > 0 && (W = C[0]), W instanceof Error)
        throw W;
      var ne = new Error("Unhandled error." + (W ? " (" + W.message + ")" : ""));
      throw ne.context = W, ne;
    }
    var ce = $[T];
    if (ce === void 0)
      return !1;
    if (typeof ce == "function")
      r(ce, this, C);
    else
      for (var fe = ce.length, we = I(ce, fe), k = 0; k < fe; ++k)
        r(we[k], this, C);
    return !0;
  };
  function g(_, T, C, k) {
    var F, $, W;
    if (l(C), $ = _._events, $ === void 0 ? ($ = _._events = /* @__PURE__ */ Object.create(null), _._eventsCount = 0) : ($.newListener !== void 0 && (_.emit(
      "newListener",
      T,
      C.listener ? C.listener : C
    ), $ = _._events), W = $[T]), W === void 0)
      W = $[T] = C, ++_._eventsCount;
    else if (typeof W == "function" ? W = $[T] = k ? [C, W] : [W, C] : k ? W.unshift(C) : W.push(C), F = h(_), F > 0 && W.length > F && !W.warned) {
      W.warned = !0;
      var ne = new Error("Possible EventEmitter memory leak detected. " + W.length + " " + String(T) + " listeners added. Use emitter.setMaxListeners() to increase limit");
      ne.name = "MaxListenersExceededWarning", ne.emitter = _, ne.type = T, ne.count = W.length;
    }
    return _;
  }
  u.prototype.addListener = function(T, C) {
    return g(this, T, C, !1);
  }, u.prototype.on = u.prototype.addListener, u.prototype.prependListener = function(T, C) {
    return g(this, T, C, !0);
  };
  function m() {
    if (!this.fired)
      return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
  }
  function y(_, T, C) {
    var k = { fired: !1, wrapFn: void 0, target: _, type: T, listener: C }, F = m.bind(k);
    return F.listener = C, k.wrapFn = F, F;
  }
  u.prototype.once = function(T, C) {
    return l(C), this.on(T, y(this, T, C)), this;
  }, u.prototype.prependOnceListener = function(T, C) {
    return l(C), this.prependListener(T, y(this, T, C)), this;
  }, u.prototype.removeListener = function(T, C) {
    var k, F, $, W, ne;
    if (l(C), F = this._events, F === void 0)
      return this;
    if (k = F[T], k === void 0)
      return this;
    if (k === C || k.listener === C)
      --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete F[T], F.removeListener && this.emit("removeListener", T, k.listener || C));
    else if (typeof k != "function") {
      for ($ = -1, W = k.length - 1; W >= 0; W--)
        if (k[W] === C || k[W].listener === C) {
          ne = k[W].listener, $ = W;
          break;
        }
      if ($ < 0)
        return this;
      $ === 0 ? k.shift() : R(k, $), k.length === 1 && (F[T] = k[0]), F.removeListener !== void 0 && this.emit("removeListener", T, ne || C);
    }
    return this;
  }, u.prototype.off = u.prototype.removeListener, u.prototype.removeAllListeners = function(T) {
    var C, k, F;
    if (k = this._events, k === void 0)
      return this;
    if (k.removeListener === void 0)
      return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : k[T] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete k[T]), this;
    if (arguments.length === 0) {
      var $ = Object.keys(k), W;
      for (F = 0; F < $.length; ++F)
        W = $[F], W !== "removeListener" && this.removeAllListeners(W);
      return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
    }
    if (C = k[T], typeof C == "function")
      this.removeListener(T, C);
    else if (C !== void 0)
      for (F = C.length - 1; F >= 0; F--)
        this.removeListener(T, C[F]);
    return this;
  };
  function w(_, T, C) {
    var k = _._events;
    if (k === void 0)
      return [];
    var F = k[T];
    return F === void 0 ? [] : typeof F == "function" ? C ? [F.listener || F] : [F] : C ? O(F) : I(F, F.length);
  }
  u.prototype.listeners = function(T) {
    return w(this, T, !0);
  }, u.prototype.rawListeners = function(T) {
    return w(this, T, !1);
  }, u.listenerCount = function(_, T) {
    return typeof _.listenerCount == "function" ? _.listenerCount(T) : x.call(_, T);
  }, u.prototype.listenerCount = x;
  function x(_) {
    var T = this._events;
    if (T !== void 0) {
      var C = T[_];
      if (typeof C == "function")
        return 1;
      if (C !== void 0)
        return C.length;
    }
    return 0;
  }
  u.prototype.eventNames = function() {
    return this._eventsCount > 0 ? n(this._events) : [];
  };
  function I(_, T) {
    for (var C = new Array(T), k = 0; k < T; ++k)
      C[k] = _[k];
    return C;
  }
  function R(_, T) {
    for (; T + 1 < _.length; T++)
      _[T] = _[T + 1];
    _.pop();
  }
  function O(_) {
    for (var T = new Array(_.length), C = 0; C < T.length; ++C)
      T[C] = _[C].listener || _[C];
    return T;
  }
  function S(_, T) {
    return new Promise(function(C, k) {
      function F(W) {
        _.removeListener(T, $), k(W);
      }
      function $() {
        typeof _.removeListener == "function" && _.removeListener("error", F), C([].slice.call(arguments));
      }
      Q(_, T, $, { once: !0 }), T !== "error" && G(_, F, { once: !0 });
    });
  }
  function G(_, T, C) {
    typeof _.on == "function" && Q(_, "error", T, C);
  }
  function Q(_, T, C, k) {
    if (typeof _.on == "function")
      k.once ? _.once(T, C) : _.on(T, C);
    else if (typeof _.addEventListener == "function")
      _.addEventListener(T, function F($) {
        k.once && _.removeEventListener(T, F), C($);
      });
    else
      throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof _);
  }
  return li.exports;
}
var Iv = Pv();
const Sv = /* @__PURE__ */ ev(Iv), xh = "%[a-f0-9]{2}", Al = new RegExp("(" + xh + ")|([^%]+?)", "gi"), yl = new RegExp("(" + xh + ")+", "gi");
function lu(e, r) {
  try {
    return [decodeURIComponent(e.join(""))];
  } catch {
  }
  if (e.length === 1)
    return e;
  r = r || 1;
  const n = e.slice(0, r), i = e.slice(r);
  return Array.prototype.concat.call([], lu(n), lu(i));
}
function Bv(e) {
  try {
    return decodeURIComponent(e);
  } catch {
    let r = e.match(Al) || [];
    for (let n = 1; n < r.length; n++)
      e = lu(r, n).join(""), r = e.match(Al) || [];
    return e;
  }
}
function Rv(e) {
  const r = {
    "%FE%FF": "��",
    "%FF%FE": "��"
  };
  let n = yl.exec(e);
  for (; n; ) {
    try {
      r[n[0]] = decodeURIComponent(n[0]);
    } catch {
      const o = Bv(n[0]);
      o !== n[0] && (r[n[0]] = o);
    }
    n = yl.exec(e);
  }
  r["%C2"] = "�";
  const i = Object.keys(r);
  for (const o of i)
    e = e.replace(new RegExp(o, "g"), r[o]);
  return e;
}
function Cv(e) {
  if (typeof e != "string")
    throw new TypeError("Expected `encodedURI` to be of type `string`, got `" + typeof e + "`");
  try {
    return decodeURIComponent(e);
  } catch {
    return Rv(e);
  }
}
function _v(e, r) {
  const n = {};
  if (Array.isArray(r))
    for (const i of r) {
      const o = Object.getOwnPropertyDescriptor(e, i);
      o != null && o.enumerable && Object.defineProperty(n, i, o);
    }
  else
    for (const i of Reflect.ownKeys(e)) {
      const o = Object.getOwnPropertyDescriptor(e, i);
      if (o.enumerable) {
        const u = e[i];
        r(i, u, e) && Object.defineProperty(n, i, o);
      }
    }
  return n;
}
function vh(e, r) {
  if (!(typeof e == "string" && typeof r == "string"))
    throw new TypeError("Expected the arguments to be of type `string`");
  if (e === "" || r === "")
    return [];
  const n = e.indexOf(r);
  return n === -1 ? [] : [
    e.slice(0, n),
    e.slice(n + r.length)
  ];
}
const Dv = (e) => e == null, Nv = (e) => encodeURIComponent(e).replaceAll(/[!'()*]/g, (r) => `%${r.charCodeAt(0).toString(16).toUpperCase()}`), du = Symbol("encodeFragmentIdentifier");
function Ov(e) {
  switch (e.arrayFormat) {
    case "index":
      return (r) => (n, i) => {
        const o = n.length;
        return i === void 0 || e.skipNull && i === null || e.skipEmptyString && i === "" ? n : i === null ? [
          ...n,
          [Ie(r, e), "[", o, "]"].join("")
        ] : [
          ...n,
          [Ie(r, e), "[", Ie(o, e), "]=", Ie(i, e)].join("")
        ];
      };
    case "bracket":
      return (r) => (n, i) => i === void 0 || e.skipNull && i === null || e.skipEmptyString && i === "" ? n : i === null ? [
        ...n,
        [Ie(r, e), "[]"].join("")
      ] : [
        ...n,
        [Ie(r, e), "[]=", Ie(i, e)].join("")
      ];
    case "colon-list-separator":
      return (r) => (n, i) => i === void 0 || e.skipNull && i === null || e.skipEmptyString && i === "" ? n : i === null ? [
        ...n,
        [Ie(r, e), ":list="].join("")
      ] : [
        ...n,
        [Ie(r, e), ":list=", Ie(i, e)].join("")
      ];
    case "comma":
    case "separator":
    case "bracket-separator": {
      const r = e.arrayFormat === "bracket-separator" ? "[]=" : "=";
      return (n) => (i, o) => o === void 0 || e.skipNull && o === null || e.skipEmptyString && o === "" ? i : (o = o === null ? "" : o, i.length === 0 ? [[Ie(n, e), r, Ie(o, e)].join("")] : [[i, Ie(o, e)].join(e.arrayFormatSeparator)]);
    }
    default:
      return (r) => (n, i) => i === void 0 || e.skipNull && i === null || e.skipEmptyString && i === "" ? n : i === null ? [
        ...n,
        Ie(r, e)
      ] : [
        ...n,
        [Ie(r, e), "=", Ie(i, e)].join("")
      ];
  }
}
function Lv(e) {
  let r;
  switch (e.arrayFormat) {
    case "index":
      return (n, i, o) => {
        if (r = /\[(\d*)]$/.exec(n), n = n.replace(/\[\d*]$/, ""), !r) {
          o[n] = i;
          return;
        }
        o[n] === void 0 && (o[n] = {}), o[n][r[1]] = i;
      };
    case "bracket":
      return (n, i, o) => {
        if (r = /(\[])$/.exec(n), n = n.replace(/\[]$/, ""), !r) {
          o[n] = i;
          return;
        }
        if (o[n] === void 0) {
          o[n] = [i];
          return;
        }
        o[n] = [...o[n], i];
      };
    case "colon-list-separator":
      return (n, i, o) => {
        if (r = /(:list)$/.exec(n), n = n.replace(/:list$/, ""), !r) {
          o[n] = i;
          return;
        }
        if (o[n] === void 0) {
          o[n] = [i];
          return;
        }
        o[n] = [...o[n], i];
      };
    case "comma":
    case "separator":
      return (n, i, o) => {
        const c = typeof i == "string" && i.includes(e.arrayFormatSeparator) ? i.split(e.arrayFormatSeparator).map((l) => Fn(l, e)) : i === null ? i : Fn(i, e);
        o[n] = c;
      };
    case "bracket-separator":
      return (n, i, o) => {
        const u = /(\[])$/.test(n);
        if (n = n.replace(/\[]$/, ""), !u) {
          o[n] = i && Fn(i, e);
          return;
        }
        const c = i === null ? [] : Fn(i, e).split(e.arrayFormatSeparator);
        if (o[n] === void 0) {
          o[n] = c;
          return;
        }
        o[n] = [...o[n], ...c];
      };
    default:
      return (n, i, o) => {
        if (o[n] === void 0) {
          o[n] = i;
          return;
        }
        o[n] = [...[o[n]].flat(), i];
      };
  }
}
function Th(e) {
  if (typeof e != "string" || e.length !== 1)
    throw new TypeError("arrayFormatSeparator must be single character string");
}
function Ie(e, r) {
  return r.encode ? r.strict ? Nv(e) : encodeURIComponent(e) : e;
}
function Fn(e, r) {
  return r.decode ? Cv(e) : e;
}
function Ph(e) {
  return Array.isArray(e) ? e.sort() : typeof e == "object" ? Ph(Object.keys(e)).sort((r, n) => Number(r) - Number(n)).map((r) => e[r]) : e;
}
function Ih(e) {
  const r = e.indexOf("#");
  return r !== -1 && (e = e.slice(0, r)), e;
}
function Mv(e) {
  let r = "";
  const n = e.indexOf("#");
  return n !== -1 && (r = e.slice(n)), r;
}
function wl(e, r, n) {
  return n === "string" && typeof e == "string" ? e : typeof n == "function" && typeof e == "string" ? n(e) : n === "boolean" && e === null ? !0 : n === "boolean" && e !== null && (e.toLowerCase() === "true" || e.toLowerCase() === "false") ? e.toLowerCase() === "true" : n === "boolean" && e !== null && (e.toLowerCase() === "1" || e.toLowerCase() === "0") ? e.toLowerCase() === "1" : n === "string[]" && r.arrayFormat !== "none" && typeof e == "string" ? [e] : n === "number[]" && r.arrayFormat !== "none" && !Number.isNaN(Number(e)) && typeof e == "string" && e.trim() !== "" ? [Number(e)] : n === "number" && !Number.isNaN(Number(e)) && typeof e == "string" && e.trim() !== "" ? Number(e) : r.parseBooleans && e !== null && (e.toLowerCase() === "true" || e.toLowerCase() === "false") ? e.toLowerCase() === "true" : r.parseNumbers && !Number.isNaN(Number(e)) && typeof e == "string" && e.trim() !== "" ? Number(e) : e;
}
function $u(e) {
  e = Ih(e);
  const r = e.indexOf("?");
  return r === -1 ? "" : e.slice(r + 1);
}
function Wu(e, r) {
  r = {
    decode: !0,
    sort: !0,
    arrayFormat: "none",
    arrayFormatSeparator: ",",
    parseNumbers: !1,
    parseBooleans: !1,
    types: /* @__PURE__ */ Object.create(null),
    ...r
  }, Th(r.arrayFormatSeparator);
  const n = Lv(r), i = /* @__PURE__ */ Object.create(null);
  if (typeof e != "string" || (e = e.trim().replace(/^[?#&]/, ""), !e))
    return i;
  for (const o of e.split("&")) {
    if (o === "")
      continue;
    const u = r.decode ? o.replaceAll("+", " ") : o;
    let [c, l] = vh(u, "=");
    c === void 0 && (c = u), l = l === void 0 ? null : ["comma", "separator", "bracket-separator"].includes(r.arrayFormat) ? l : Fn(l, r), n(Fn(c, r), l, i);
  }
  for (const [o, u] of Object.entries(i))
    if (typeof u == "object" && u !== null && r.types[o] !== "string")
      for (const [c, l] of Object.entries(u)) {
        const h = r.types[o], g = typeof h == "function" ? h : h ? h.replace("[]", "") : void 0;
        u[c] = wl(l, r, g);
      }
    else typeof u == "object" && u !== null && r.types[o] === "string" ? i[o] = Object.values(u).join(r.arrayFormatSeparator) : i[o] = wl(u, r, r.types[o]);
  return r.sort === !1 ? i : (r.sort === !0 ? Object.keys(i).sort() : Object.keys(i).sort(r.sort)).reduce((o, u) => {
    const c = i[u];
    return o[u] = c && typeof c == "object" && !Array.isArray(c) ? Ph(c) : c, o;
  }, /* @__PURE__ */ Object.create(null));
}
function Sh(e, r) {
  if (!e)
    return "";
  r = {
    encode: !0,
    strict: !0,
    arrayFormat: "none",
    arrayFormatSeparator: ",",
    ...r
  }, Th(r.arrayFormatSeparator);
  const n = (c) => r.skipNull && Dv(e[c]) || r.skipEmptyString && e[c] === "", i = Ov(r), o = {};
  for (const [c, l] of Object.entries(e))
    n(c) || (o[c] = l);
  const u = Object.keys(o);
  return r.sort !== !1 && u.sort(r.sort), u.map((c) => {
    let l = e[c];
    if (r.replacer && (l = r.replacer(c, l), l === void 0) || l === void 0)
      return "";
    if (l === null)
      return Ie(c, r);
    if (Array.isArray(l)) {
      if (l.length === 0 && r.arrayFormat === "bracket-separator")
        return Ie(c, r) + "[]";
      let h = l;
      return r.replacer && (h = l.map(
        (g, m) => r.replacer(`${c}[${m}]`, g)
      ).filter((g) => g !== void 0)), h.reduce(i(c), []).join("&");
    }
    return Ie(c, r) + "=" + Ie(l, r);
  }).filter((c) => c.length > 0).join("&");
}
function Bh(e, r) {
  var o;
  r = {
    decode: !0,
    ...r
  };
  let [n, i] = vh(e, "#");
  return n === void 0 && (n = e), {
    url: ((o = n == null ? void 0 : n.split("?")) == null ? void 0 : o[0]) ?? "",
    query: Wu($u(e), r),
    ...r && r.parseFragmentIdentifier && i ? { fragmentIdentifier: Fn(i, r) } : {}
  };
}
function Rh(e, r) {
  r = {
    encode: !0,
    strict: !0,
    [du]: !0,
    ...r
  };
  const n = Ih(e.url).split("?")[0] || "", i = $u(e.url), o = {
    ...Wu(i, { sort: !1, ...r }),
    ...e.query
  };
  let u = Sh(o, r);
  u && (u = `?${u}`);
  let c = Mv(e.url);
  if (typeof e.fragmentIdentifier == "string") {
    const l = new URL(n);
    l.hash = e.fragmentIdentifier, c = r[du] ? l.hash : `#${e.fragmentIdentifier}`;
  }
  return `${n}${u}${c}`;
}
function Ch(e, r, n) {
  n = {
    parseFragmentIdentifier: !0,
    [du]: !1,
    ...n
  };
  const { url: i, query: o, fragmentIdentifier: u } = Bh(e, n);
  return Rh({
    url: i,
    query: _v(o, r),
    fragmentIdentifier: u
  }, n);
}
function Fv(e, r, n) {
  const i = Array.isArray(r) ? (o) => !r.includes(o) : (o, u) => !r(o, u);
  return Ch(e, i, n);
}
const Uv = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  exclude: Fv,
  extract: $u,
  parse: Wu,
  parseUrl: Bh,
  pick: Ch,
  stringify: Sh,
  stringifyUrl: Rh
}, Symbol.toStringTag, { value: "Module" }));
var hu = ((e) => (e.TRANSAK_WIDGET_INITIALISED = "TRANSAK_WIDGET_INITIALISED", e.TRANSAK_ORDER_CREATED = "TRANSAK_ORDER_CREATED", e.TRANSAK_ORDER_SUCCESSFUL = "TRANSAK_ORDER_SUCCESSFUL", e.TRANSAK_ORDER_CANCELLED = "TRANSAK_ORDER_CANCELLED", e.TRANSAK_ORDER_FAILED = "TRANSAK_ORDER_FAILED", e.TRANSAK_WALLET_REDIRECTION = "TRANSAK_WALLET_REDIRECTION", e.TRANSAK_WIDGET_CLOSE_REQUEST = "TRANSAK_WIDGET_CLOSE_REQUEST", e.TRANSAK_WIDGET_CLOSE = "TRANSAK_WIDGET_CLOSE", e))(hu || {}), kv = { name: "@transak/transak-sdk", version: "4.0.0" }, pu = (e) => {
  if (!e) return !1;
  try {
    return !!new URL(e);
  } catch {
    return !1;
  }
}, Gv = (e) => {
  if (!pu(e)) throw new Error("Invalid URL");
  return e;
};
function _h(e) {
  let { name: r, version: n } = kv, { referrer: i, widgetUrl: o } = e || {};
  if (!pu(i) || !pu(o)) throw new Error("referrer and widgetUrl are required and must be valid URLs");
  let u = Uv.stringifyUrl({ url: o, query: { sdkName: r, sdkVersion: n } }, { arrayFormat: "comma" });
  return Gv(u);
}
function Dh(e) {
  let r = document.createElement("iframe");
  return Object.assign(r, { id: "transakIframe", allow: "camera;microphone;payment", src: e }), r;
}
function Hv() {
  return `
    #transakIframe{
      width: 100%;
      height: 100%;
      border: none;
    }
  `;
}
function Qv() {
  var r;
  let e = document.createElement("style");
  return e.innerHTML = Hv(), (r = document.getElementsByTagName("head")[0]) == null || r.appendChild(e), e;
}
function zv(e) {
  let r = Qv(), n = Dh(_h(e));
  if (e.containerId) {
    let i = document.getElementById(e.containerId);
    if (i) i.appendChild(n);
    else throw new Error("[Transak SDK] => Please enter a valid containerId");
  }
  return { styleElement: r, iframeElement: n };
}
var $v = `
  <svg id="transakCloseIcon" viewBox="0 0 612 612" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
    <path d="M306,0C136.992,0,0,136.992,0,306s136.992,306,306,306c168.988,0,306-137.012,306-306S475.008,0,306,0z M414.19,387.147
    c7.478,7.478,7.478,19.584,0,27.043c-7.479,7.478-19.584,7.478-27.043,0l-81.032-81.033l-81.588,81.588
    c-7.535,7.516-19.737,7.516-27.253,0c-7.535-7.535-7.535-19.737,0-27.254l81.587-81.587l-81.033-81.033
    c-7.478-7.478-7.478-19.584,0-27.042c7.478-7.478,19.584-7.478,27.042,0l81.033,81.033l82.181-82.18
    c7.535-7.535,19.736-7.535,27.253,0c7.535,7.535,7.535,19.737,0,27.253l-82.181,82.181L414.19,387.147z" />
  </svg>
`;
function Wv(e, r, n) {
  return `
    #transakRoot {
      z-index: 9997;
      position: fixed;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      background: rgba(0, 0, 0, 0.6);
    }

    #transakModal {
      z-index: 9998;
      position: fixed;
      width: ${r};
      height: calc(${n} - 24px);
      top: 50%;
      left: 50%;
      transform: translate(-50%, calc(-50% - 12px));
      margin-top: 24px;
    }

    #transakCloseIcon {
      z-index: 9999;
      position: absolute;
      width: 36px;
      height: 36px;
      top: -24px;
      right: 0;
      transition: 0.5s;
      color: #${e};
      background: white;
      border-radius: 50%;
    }

    #transakCloseIcon:hover,
    #transakCloseIcon:focus {
      color: white;
      background: #${e};
      cursor: pointer;
    }

    #transakIframe{
      width: 100%;
      height: 100%;
      border: none;
      border-radius: 10px;
      background: white;
    }

    @media screen and (max-width: 600px) {
      #transakModal {
        width: 100%;
        height: calc(100% - 24px);
      }

      #transakIframe{
        border-radius: 10px 10px 0 0;
      }
    }
  `;
}
function Vv(e) {
  var u;
  let { themeColor: r = "1461db", widgetWidth: n = "480px", widgetHeight: i = "650px" } = e, o = document.createElement("style");
  return o.innerHTML = Wv(r, n, i), (u = document.getElementsByTagName("head")[0]) == null || u.appendChild(o), o;
}
function jv(e, r) {
  var c;
  let n = Vv(e), i = document.createElement("div"), o = document.createElement("div"), u = Dh(_h(e));
  return Object.assign(o, { id: "transakModal", innerHTML: $v }), o.appendChild(u), Object.assign(i, { id: "transakRoot", onclick: () => r() }), i.appendChild(o), document.getElementsByTagName("body")[0].appendChild(i), (c = document.getElementById("transakCloseIcon")) == null || c.addEventListener("click", () => r()), { styleElement: n, rootElement: i, iframeElement: u };
}
var Ca = new Sv.EventEmitter(), Un, kn, us, yn, wn, di, Ri, Ci, cs, fs, Pt = (di = class {
  constructor(e) {
    _t(this, Un);
    _t(this, kn);
    _t(this, us);
    _t(this, yn);
    _t(this, wn, !1);
    X(this, "init", () => {
      Ue(this, wn) || (Ue(this, Ri).call(this), Tt(this, wn, !0));
    });
    X(this, "cleanup", () => {
      var e, r;
      (e = Ue(this, kn)) == null || e.remove(), Ue(this, cs).call(this), (r = Ue(this, yn)) == null || r.remove(), Tt(this, wn, !1);
    });
    X(this, "close", () => {
      var e, r;
      (e = Ue(this, kn)) == null || e.remove(), (r = Ue(this, us)) == null || r.remove(), Ue(this, cs).call(this), Tt(this, yn, void 0), Tt(this, wn, !1);
    });
    _t(this, Ri, () => {
      if (window.addEventListener("message", Ue(this, fs)), Ue(this, Un).containerId) {
        let { styleElement: e, iframeElement: r } = zv(Ue(this, Un));
        Tt(this, kn, e), Tt(this, yn, r);
      } else {
        let { styleElement: e, rootElement: r, iframeElement: n } = jv(Ue(this, Un), Ue(this, Ci));
        Tt(this, kn, e), Tt(this, us, r), Tt(this, yn, n);
      }
    });
    _t(this, Ci, () => {
      var e, r;
      (r = (e = Ue(this, yn)) == null ? void 0 : e.contentWindow) == null || r.postMessage({ event_id: "TRANSAK_WIDGET_CLOSE_REQUEST" }, "*");
    });
    _t(this, cs, () => {
      Ca.removeAllListeners(), window.removeEventListener("message", Ue(this, fs));
    });
    _t(this, fs, (e) => {
      var r;
      (r = e == null ? void 0 : e.data) != null && r.event_id && Ue(this, wn) && Ca.emit(e.data.event_id, e.data.data);
    });
    if (!(e != null && e.widgetUrl)) throw new Error("[Transak SDK] => widgetUrl is required");
    Tt(this, Un, e);
  }
}, Un = new WeakMap(), kn = new WeakMap(), us = new WeakMap(), yn = new WeakMap(), wn = new WeakMap(), Ri = new WeakMap(), Ci = new WeakMap(), cs = new WeakMap(), fs = new WeakMap(), X(di, "EVENTS", hu), X(di, "on", (e, r) => {
  hu[e] && Ca.on(e, r);
}), di);
async function Jv(e) {
  const r = Hn.get().apiUrl, n = new URL(`${r}/order-status/transak`);
  return n.searchParams.append("orderId", e), Hn.get().dev && n.searchParams.append("dev", "true"), await fetch(n).then((o) => o.json()).then((o) => o).catch((o) => {
    throw o;
  });
}
class qv extends Eh {
  constructor(r, n) {
    super(r, n);
  }
  async executeStep() {
    const r = this.stepManager.step;
    if (r.type === "onramp_via_link")
      try {
        const n = await this.openOnRampLink();
        if (n.status !== "DONE")
          return Nh(this.stepManager.routeId), r;
        await this.checkOrderStatus(n.orderId);
      } catch (n) {
        throw new Error(`TRANSAK_STEP_ERROR: ${n.message}`);
      }
    return this.stepManager.completeStep();
  }
  async checkOrderStatus(r) {
    if (!r)
      throw new Error("No Order ID provided to check status.");
    const n = "STATUS_CHECK", i = this.stepManager.findOrCreateProcess({
      status: "PENDING",
      type: n,
      message: "Checking order status with Transak."
    });
    return new Promise((o) => {
      const u = async (l) => {
        const h = await Jv(r);
        if (this.stepManager.executionStopped)
          return clearInterval(l), o(i);
        if (h.status === "AWAITING_PAYMENT_FROM_USER" || h.status === "PAYMENT_DONE_MARKED_BY_USER")
          this.stepManager.updateProcess({
            status: "PENDING",
            type: n,
            message: "Transak order is awaiting for payment."
          });
        else if (h.status === "PROCESSING" || h.status === "PENDING_DELIVERY_FROM_TRANSAK")
          this.stepManager.updateProcess({
            status: "PENDING",
            type: n,
            message: "Payment is pending processing with Transak."
          });
        else if (h.status === "ON_HOLD_PENDING_DELIVERY_FROM_TRANSAK")
          this.stepManager.updateProcess({
            status: "PENDING",
            type: n,
            message: `Order is on hold pending delivery from Transak. Order ID: ${r}`
          });
        else {
          if (h.status === "COMPLETED")
            return clearInterval(l), o(this.stepManager.updateProcess({
              status: "DONE",
              type: n,
              message: "Payment completed successfully.",
              params: {
                toAmount: h.cryptoAmount,
                toToken: h.cryptoCurrency,
                fromAmount: h.fiatAmount,
                fromCurrency: h.fiatCurrency
              }
            }));
          if (h.status === "CANCELLED")
            return clearInterval(l), o(this.stepManager.updateProcess({
              status: "CANCELLED",
              type: n,
              message: "Payment was cancelled."
            }));
          if (h.status === "EXPIRED")
            return clearInterval(l), o(this.stepManager.updateProcess({
              status: "CANCELLED",
              type: n,
              message: "Order expired."
            }));
          if (h.status === "REFUNDED")
            return clearInterval(l), o(this.stepManager.updateProcess({
              status: "CANCELLED",
              type: n,
              message: "Order was refunded."
            }));
          if (h.status === "FAILED")
            return clearInterval(l), o(this.stepManager.updateProcess({
              status: "FAILED",
              type: n,
              message: "Order failed: " + h.statusMessage
            }));
        }
      }, c = setInterval(async () => {
        await u(c);
      }, 3e3);
    });
  }
  async openOnRampLink() {
    const r = "EXTERNAL", n = this.stepManager.findOrCreateProcess({
      status: "ACTION_REQUIRED",
      type: r,
      message: "Complete payment process in Transak window."
    });
    return new Promise((i) => {
      if (n.status === "DONE" && n.orderId || this.stepManager.executionStopped || this.stepManager.interactionDisabled)
        return i(n);
      const o = {
        widgetUrl: this.stepManager.step.link,
        referrer: `${window.location.protocol}//${window.location.host}`
      }, u = new Pt(o);
      u.init(), Pt.on(Pt.EVENTS.TRANSAK_WIDGET_CLOSE, () => (u.close(), i(
        this.stepManager.updateProcess({
          status: "CANCELLED",
          type: r,
          message: "Payment window was closed before completing the process."
        })
      ))), Pt.on(Pt.EVENTS.TRANSAK_ORDER_SUCCESSFUL, (c) => {
        if (c && typeof c == "object" && "id" in c && "status" in c) {
          const l = c.id;
          return u.close(), i(
            this.stepManager.updateProcess({
              status: "DONE",
              type: r,
              message: `Payment completed with Transak. Order ID: ${l}`,
              params: { orderId: l }
            })
          );
        } else
          return u.close(), i(
            this.stepManager.updateProcess({
              status: "FAILED",
              type: r,
              message: "Invalid order data received from Transak."
            })
          );
      }), Pt.on(Pt.EVENTS.TRANSAK_WIDGET_CLOSE_REQUEST, () => (u.close(), i(
        this.stepManager.updateProcess({
          status: "CANCELLED",
          type: r,
          message: "Payment window was closed."
        })
      ))), Pt.on(Pt.EVENTS.TRANSAK_ORDER_FAILED, (c) => {
        const l = (c == null ? void 0 : c.id) || "unknown";
        return u.close(), i(
          this.stepManager.updateProcess({
            status: "FAILED",
            type: r,
            message: `Payment failed with Transak. Order ID: ${l}`,
            params: { orderId: l }
          })
        );
      }), Pt.on(Pt.EVENTS.TRANSAK_ORDER_CANCELLED, () => (u.close(), i(
        this.stepManager.updateProcess({
          status: "CANCELLED",
          type: r,
          message: "Order was cancelled."
        })
      )));
    });
  }
}
function Kv(e, r) {
  if (r.type === "onramp_via_link")
    switch (e.provider.key) {
      case "transak":
        return new qv(e, r);
    }
  else if (r.type === "lifi_token_swap")
    return new Tv(e, r);
  throw new Error(`No executor found for ${r.type}`);
}
async function Yv(e, r) {
  if (e.id) {
    const o = Ae.get(e.id);
    if (o != null && o.promise)
      return o.promise;
  }
  const n = Ae.set({ ...e, status: "RUNNING" }, r), i = Zv(n);
  return Ae.update(n.route.id, { promise: i }), i;
}
function p3(e, r) {
  const n = Ae.get(e.id);
  if (n && "executeInBackground" in r) {
    Ae.update(e.id, { executionOptions: r });
    const i = n.route.steps.find((o) => o.type.includes("lifi"));
    i && i.lifiRoute && zu(i.lifiRoute, { executeInBackground: r.executeInBackground });
  }
}
function Nh(e) {
  const r = Ae.get(e);
  if (!r)
    return;
  Ae.update(
    e,
    {
      route: { ...r.route, status: "HALTING" },
      executionOptions: { allowExecution: !1 }
    }
  );
  const n = r.route.steps.find((i) => i.type.includes("lifi"));
  n && n.lifiRoute && fu(n.lifiRoute);
}
async function g3(e, r) {
  if (!e.id)
    return Promise.reject({ error: new Error("Quote does not have an id. Please call executeRoute instead."), route: e });
  const n = Ae.get(e.id);
  if (n)
    return n.promise;
  const i = await Xv(e);
  return Yv(i, r);
}
async function Xv(e) {
  for (let r = 0; r < e.steps.length; r++) {
    const n = e.steps[r];
    n.execution && (n.execution.process = n.execution.process.filter(
      (i) => i.status === "DONE"
    ));
  }
  return e;
}
async function Zv(e) {
  var o, u;
  for (let c = 0; c < e.route.steps.length; c++) {
    if (((o = e.route.steps[c].execution) == null ? void 0 : o.status) === "DONE")
      continue;
    const h = Kv(e.route, e.route.steps[c]);
    try {
      await h.executeStep();
      const g = Ae.get(e.route.id);
      if (g && !((u = g.executionOptions) != null && u.allowExecution)) {
        const m = Ae.update(g.route.id, { route: { ...g.route, status: "HALTED" } });
        return Ae.delete(m.id), m;
      }
    } catch (g) {
      const m = Ae.get(e.route.id);
      throw Ae.update(m.route.id, { route: { ...m.route, status: "HALTED" } }), Ae.delete(m.route.id), new Error("ERROR in SDK", g);
    }
  }
  const r = Ae.get(e.route.id), n = r.route.steps.every((c) => {
    var l;
    return ((l = c.execution) == null ? void 0 : l.status) === "DONE";
  });
  let i;
  return n ? i = Ae.update(r.route.id, { route: { ...r.route, status: "DONE" } }) : i = Ae.update(r.route.id, { route: { ...r.route, status: "HALTED" } }), Ae.delete(i.id), i;
}
function m3(e, r, n = "include") {
  return r.length ? e.map((o) => ({
    ...o,
    paymentMethods: o.paymentMethods.filter((u) => {
      const c = r.includes(u.method);
      return n === "include" ? c : !c;
    })
  })).filter((o) => o.paymentMethods.length > 0) : [...e];
}
function b3(e, r, n) {
  return {
    type: e,
    provider: n,
    ...r
  };
}
function A3(e, r = !0, n = "asc") {
  const i = (o, u) => {
    const c = n === "asc" ? 1 : -1;
    return (o.pay.totalFeeFiat - u.pay.totalFeeFiat) * c;
  };
  return r ? e.map((o) => ({
    ...o,
    paymentMethods: [...o.paymentMethods].sort(i)
  })) : e.flatMap(
    (o) => o.paymentMethods.map((u) => ({
      ...o,
      paymentMethods: [u]
    }))
  ).sort((o, u) => i(o.paymentMethods[0], u.paymentMethods[0]));
}
function y3(e) {
  return e.flatMap(
    (n) => n.paymentMethods.map((i) => ({
      ...n,
      paymentMethods: [i]
    }))
  ).sort((n, i) => n.paymentMethods[0].receive.amountFiat - i.paymentMethods[0].receive.amountFiat);
}
function w3(e) {
  return e.map((r) => ({
    ...r,
    paymentMethods: r.paymentMethods.sort(
      (n, i) => n.receive.amountFiat - i.receive.amountFiat
    )
  }));
}
export {
  Nh as A,
  U as B,
  p3 as C,
  m3 as D,
  f3 as E,
  b3 as F,
  A3 as G,
  u3 as H,
  Xr as I,
  y3 as J,
  w3 as K,
  K2 as a,
  nn as b,
  W2 as c,
  M6 as d,
  Oi as e,
  Lt as f,
  yd as g,
  $l as h,
  xn as i,
  s3 as j,
  Zr as k,
  Bd as l,
  bi as m,
  hr as n,
  mi as o,
  i3 as p,
  i2 as q,
  o3 as r,
  rn as s,
  mu as t,
  h3 as u,
  d3 as v,
  Hn as w,
  l3 as x,
  Yv as y,
  g3 as z
};
//# sourceMappingURL=index-MjMIrW38.js.map