import { jsxs as h, Fragment as S, jsx as r } from "react/jsx-runtime";
import { getCurrencySymbol as O, prettifyCurrencyValue as V } from "@argent/x-shared";
import { isRejectOnChainActivity as C, isUpgradeActivity as D, isTokenActivitySummary as E } from "@argent/x-shared/simulation";
import { isEmpty as F, groupBy as H } from "lodash-es";
import { memo as U } from "react";
import { useCurrency as q } from "../../../providers/CurrencyProvider.js";
import { Hideable as a } from "../Hideable.js";
import { TokenActivitySummaryText as z } from "../icon/TokenActivitySummaryText.js";
import { ActivityRowSubtitle as b } from "./ActivityRowSubtitle.js";
import { ActivityRowTitle as u } from "./ActivityRowTitle.js";
import { getAttributes as G, receiveAttributes as x } from "./getAttributes.js";
import { getSendOrReceiveAmount as l } from "./getSendOrReceiveAmount.js";
import { SendOrReceiveActivityText as s } from "./SendOrReceiveActivityText.js";
const J = ({ activity: y, networkId: m, hideComponent: n }) => {
  var v, p;
  const f = q(), { status: A, transferSummary: o = [] } = y;
  if (F(o) || C(y) || D(y))
    return null;
  const c = A === "rejected" || A === "failure" || A === "cancelled" ? "line-through" : void 0;
  if (o.length === 1 && E(o[0])) {
    const t = o[0], { prefix: d, color: R } = G(t), T = (v = t.asset.fiatAmount) == null ? void 0 : v.currencyAmount, j = (f == null ? void 0 : f.symbol) || O(((p = t.asset.fiatAmount) == null ? void 0 : p.currency) || ""), g = V(T, j), B = l(o);
    return /* @__PURE__ */ h(S, { children: [
      /* @__PURE__ */ r(u, { "data-value": B, color: R, textDecoration: c, children: /* @__PURE__ */ h(a, { hideComponent: n, children: [
        d,
        /* @__PURE__ */ r(z, { summary: t, networkId: m })
      ] }) }),
      g !== void 0 && /* @__PURE__ */ r(b, { textDecoration: c, children: /* @__PURE__ */ r(a, { hideComponent: n, children: g }) })
    ] });
  }
  const { send: e, receive: i } = H(o, (t) => t.sent ? "send" : "receive");
  if (i != null && i.length && (e != null && e.length)) {
    const t = l(i), d = l(e);
    return /* @__PURE__ */ h(S, { children: [
      /* @__PURE__ */ r(u, { "data-value": t, color: x.color, textDecoration: c, children: /* @__PURE__ */ r(a, { hideComponent: n, children: /* @__PURE__ */ r(s, { summaryArray: i, networkId: m }) }) }),
      /* @__PURE__ */ r(b, { "data-value": d, textDecoration: c, children: /* @__PURE__ */ r(a, { hideComponent: n, children: /* @__PURE__ */ r(s, { summaryArray: e, networkId: m }) }) })
    ] });
  }
  if (i != null && i.length) {
    const t = l(o);
    return /* @__PURE__ */ r(u, { "data-value": t, color: x.color, textDecoration: c, children: /* @__PURE__ */ r(a, { hideComponent: n, children: /* @__PURE__ */ r(s, { summaryArray: i, networkId: m }) }) });
  }
  if (e != null && e.length) {
    const t = l(o);
    return /* @__PURE__ */ r(u, { "data-value": t, textDecoration: c, children: /* @__PURE__ */ r(a, { hideComponent: n, children: /* @__PURE__ */ r(s, { summaryArray: e, networkId: m }) }) });
  }
}, k = U(J);
export {
  k as ActivityBalanceChange
};
