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