import { jsx as e, jsxs as o, Fragment as A } from "react/jsx-runtime";
import { formatTruncatedAddress as u } from "@argent/x-shared";
import { isRejectOnChainActivity as v, NativeActivityTypeNative as D } from "@argent/x-shared/simulation";
import { Text as S } from "@chakra-ui/react";
import { upperFirst as g } from "lodash-es";
import { ActivityAddressDescription as j } from "./ActivityAddressDescription.js";
import { ActivityDappDescription as k } from "./ActivityDappDescription.js";
import { ActivityRowSubtitle as d } from "./ActivityRowSubtitle.js";
import { ActivityStakerDescription as I } from "./ActivityStakerDescription.js";
function R(r) {
  if (r === "failure" || r === "rejected" || r === "cancelled") {
    const i = r === "failure" ? "Reverted" : g(r);
    return /* @__PURE__ */ o(A, { children: [
      " ",
      "·",
      " ",
      /* @__PURE__ */ e(S, { as: "span", color: "text-danger", children: i })
    ] });
  }
}
const z = ({ activity: r, networkId: i }) => {
  var s, m, p, c, a;
  const { type: l, status: h, transferSummary: n = [], dapp: f } = r, t = R(h);
  if (v(r))
    return null;
  if (f)
    return /* @__PURE__ */ e(k, { dapp: f, suffix: t });
  if (l === D) {
    if ((m = (s = r.meta) == null ? void 0 : s.investment) != null && m.stakerInfo) {
      const x = (c = (p = r.meta) == null ? void 0 : p.investment) == null ? void 0 : c.stakerInfo;
      return /* @__PURE__ */ e(I, { stakerInfo: x, suffix: t });
    }
    return /* @__PURE__ */ o(d, { children: [
      ((a = r.meta) == null ? void 0 : a.subtitle) ?? u(r.transaction.hash),
      t
    ] });
  }
  return (n == null ? void 0 : n.length) === 1 ? /* @__PURE__ */ e(j, { activity: r, networkId: i, suffix: t }) : /* @__PURE__ */ o(d, { children: [
    u(r.transaction.hash),
    t
  ] });
};
export {
  z as ActivityDescription
};
