import { jsx as t, jsxs as o } from "react/jsx-runtime";
import { getCurrencySymbol as k, prettifyTokenAmount as v, ensureDecimals as b, prettifyCurrencyValue as x } from "@argent/x-shared";
import { useTokenInfo as S } from "../../../providers/TokenProvider.js";
import { Flex as n } from "@chakra-ui/react";
import { useTranslation as T } from "react-i18next";
import { Hideable as w } from "../Hideable.js";
import { TokenActivitySummaryIcon as I } from "../icon/TokenActivitySummaryIcon.js";
import { ActivityRowSubtitle as R } from "./ActivityRowSubtitle.js";
import { getAttributes as j } from "./getAttributes.js";
import { UnknownTokenIcon as z } from "../../../../components/TokenIcon.js";
import { B3 as i } from "../../../../components/typography.generated.js";
const K = ({ summary: e, networkId: c, hideComponent: d }) => {
  var a, u;
  const { t: f } = T(), p = e.asset.tokenAddress, r = S({
    networkId: c,
    address: p
  });
  if (!r)
    return /* @__PURE__ */ t(n, { alignItems: "center", w: "full", children: /* @__PURE__ */ o(n, { gap: "2", alignItems: "center", children: [
      /* @__PURE__ */ t(z, { size: 7 }),
      /* @__PURE__ */ t(i, { children: f("tokenActivitySummaryRow.unknownToken") })
    ] }) });
  const l = e.asset.amount || 0, m = (a = e.asset.fiatAmount) == null ? void 0 : a.currencyAmount, y = k(((u = e.asset.fiatAmount) == null ? void 0 : u.currency) ?? "USD"), s = v({
    amount: l,
    decimals: b(r.decimals),
    symbol: r.symbol
  }), { color: A, prefix: g } = j(e), h = x(m, y);
  return /* @__PURE__ */ o(n, { alignItems: "center", w: "full", children: [
    /* @__PURE__ */ o(n, { gap: "2", alignItems: "center", children: [
      /* @__PURE__ */ t(I, { summary: e, size: 7, networkId: c }),
      /* @__PURE__ */ t(i, { children: r.name })
    ] }),
    /* @__PURE__ */ t(n, { ml: "auto", gap: 1, direction: "column", textAlign: "right", children: /* @__PURE__ */ o(w, { hideComponent: d, children: [
      /* @__PURE__ */ o(i, { color: A, "data-tx-value": l, "data-fe-value": s, children: [
        g,
        s
      ] }),
      m !== void 0 && /* @__PURE__ */ t(R, { children: h })
    ] }) })
  ] });
};
export {
  K as TokenActivitySummaryRow
};
