import { isEvmChain as c } from "../../utils/evm/isEvmChain.js";
import { EVM_CHAIN_BASE_TOKENS as f } from "../../constants/chains.js";
import { getTokenBalanceKey as m } from "../../utils/intents/getTokenBalanceKey.js";
import { CHAINS_MAP as d } from "./types.js";
import { revertAlchemyChainsMap as C } from "./utils.js";
const w = (n, i) => {
  const s = {}, a = C(d);
  return i.forEach((o) => {
    let r;
    if (o.tokenAddress)
      r = n.find((e) => o.tokenAddress ? e.contractAddress?.toLowerCase() === o.tokenAddress.toLowerCase() : !1);
    else {
      const e = a[o.network];
      e && (r = n.find(
        (t) => t.contractAddress == null && t.blockchain.toLowerCase() === e.toLowerCase() && t.symbol.toLowerCase() === (c(e) ? f[e] ?? e : e).toLowerCase()
      ));
    }
    if (r) {
      const e = BigInt(o.tokenBalance).toString();
      e !== "0" && (s[m(r)] = e);
    }
  }), s;
};
export {
  w as parse
};
//# sourceMappingURL=parse.js.map
