@liberfi.io/ui-tokens 3.0.27 → 3.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -18,7 +18,7 @@ import {memo,useMemo,useState,useRef,useCallback,useEffect}from'react';import {L
18
18
  Q 76 2 76 6
19
19
  L 76 72
20
20
  Q 76 76 76 76
21
- `})]})}function Yr({token:e,renderAction:t,isLast:o=false,onSelectToken:r,className:s}){let{t:n}=useTranslation(),i=useCopyToClipboard(),a=useTickAge(e.createdAt),l=e.marketData,d=e.stats?.["1h"],m=useCallback(()=>{r?.(e);},[r,e]),c=useCallback(B=>{B.stopPropagation(),i(e.address,()=>toast.success(n("tokens.copied.address")));},[i,e.address,n]),p=useMemo(()=>d?.volumesInUsd,[d?.volumesInUsd]),u=useMemo(()=>d?.buyVolumesInUsd,[d?.buyVolumesInUsd]),g=useMemo(()=>d?.sellVolumesInUsd,[d?.sellVolumesInUsd]),f=useMemo(()=>d?.trades,[d?.trades]),x=useMemo(()=>l?.marketCapInUsd,[l?.marketCapInUsd]),k=useMemo(()=>l?.tvlInUsd,[l?.tvlInUsd]),h=useMemo(()=>{let B=new SafeBigNumber(x);return B.lt(1e3)?"text-foreground":B.lt(1e6)?"text-secondary":"text-primary"},[x]),b=useMemo(()=>new SafeBigNumber(l?.top10HoldingsRatio).gte(.1),[l?.top10HoldingsRatio]),T=useMemo(()=>new SafeBigNumber(l?.devHoldingsRatio).gte(.1),[l?.devHoldingsRatio]),N=useMemo(()=>new SafeBigNumber(l?.insiderHoldingsRatio).gte(.1),[l?.insiderHoldingsRatio]),y=useMemo(()=>new SafeBigNumber(l?.sniperHoldingsRatio).gte(.1),[l?.sniperHoldingsRatio]),P=useMemo(()=>new SafeBigNumber(l?.bundleHoldingsRatio).gte(.1),[l?.bundleHoldingsRatio]),[L,H]=useMemo(()=>{let B=Number(d?.buys??0),F=Number(d?.sells??0),_=B+F;if(_===0)return [12,12];let gt=Math.round(B/_*24);return [gt,24-gt]},[d?.buys,d?.sells]),te=l?.holders!==void 0&&l.holders>0,Se=l?.proHolders!==void 0&&l.proHolders>0,D=l?.kolHolders!==void 0&&l.kolHolders>0,ie=te||Se||D;return jsxs("div",{className:cn$1("relative w-full h-full overflow-hidden px-4 py-3 hover:bg-content2/40 cursor-pointer",s),style:{borderBottom:o?"none":"1px solid rgba(39,39,42,0.6)"},onClick:r?m:void 0,children:[jsxs("div",{className:"flex items-start gap-2",children:[jsxs("div",{className:"flex-none flex flex-col items-center gap-2",children:[jsx(fe,{token:e,enableSearch:true,enablePreview:!!e.image,showProgress:true,className:"w-20 h-20"}),jsxs("button",{type:"button",className:"text-xs font-mono text-neutral hover:text-foreground leading-none",onClick:c,"aria-label":n("tokens.copied.address"),title:n("tokens.copied.address"),children:[e.address.slice(0,4),"...",e.address.slice(-4)]})]}),jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2.5",children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 min-w-0 text-left",onClick:c,"aria-label":n("tokens.copied.address"),title:n("tokens.copied.address"),children:[jsx("span",{className:"flex-none text-sm font-semibold leading-none whitespace-nowrap overflow-hidden text-ellipsis max-w-24",children:e.symbol}),jsx(StyledTooltip,{content:e.name,children:jsx("span",{className:"text-[13px] leading-none text-neutral truncate max-w-20",children:e.name})}),jsx(CopyIcon,{className:"flex-none w-3.5 h-3.5 text-neutral"})]}),jsxs("div",{className:"flex items-center gap-2 leading-none",children:[jsx("span",{className:"text-[13px] font-mono font-medium text-neutral",children:formatAge(a)}),e.socialMedias?.website&&jsx(Link,{href:e.socialMedias.website,className:"text-neutral hover:text-primary",target:"_blank",onClick:B=>B.stopPropagation(),children:jsx(WebsiteIcon,{className:"w-3.5 h-3.5"})}),e.socialMedias?.twitter&&jsx(Link,{href:e.socialMedias.twitter,className:"text-neutral hover:text-primary",target:"_blank",onClick:B=>B.stopPropagation(),children:jsx(TwitterIcon,{className:"w-3.5 h-3.5"})}),e.socialMedias?.telegram&&jsx(Link,{href:e.socialMedias.telegram,className:"text-neutral hover:text-primary",target:"_blank",onClick:B=>B.stopPropagation(),children:jsx(TelegramIcon,{className:"w-3.5 h-3.5"})}),jsx(Link,{href:searchTwitterUrl(`${e.symbol} OR ${e.address}`),className:"max-sm:hidden text-neutral hover:text-primary",target:"_blank",onClick:B=>B.stopPropagation(),children:jsx(SearchIcon,{className:"w-3.5 h-3.5"})})]}),jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-foreground/80 leading-none",children:[jsxs("span",{className:"inline-flex items-baseline gap-1",children:[jsx("span",{className:"text-neutral",children:"MC"}),jsx("span",{className:cn$1(h),children:formatAmountUSDCompact(x)})]}),jsx("span",{className:"text-neutral/30",children:"\xB7"}),jsxs("span",{className:"inline-flex items-baseline gap-1",children:[jsx("span",{className:"text-neutral",children:"Liq"}),jsx("span",{children:formatAmountUSDCompact(k)})]})]}),ie&&jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-neutral leading-none",children:[te&&jsx(StyledTooltip,{content:n("tokens.tokenInfo.holders"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(PeopleIcon,{className:"w-3 h-3 text-neutral"}),formatAmount(l?.holders)]})}),Se&&jsx(StyledTooltip,{content:n("tokens.tokenInfo.proHolders"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(KlineCandlesIcon,{className:"w-3 h-3 text-neutral"}),formatAmount(l?.proHolders)]})}),D&&jsx(StyledTooltip,{content:n("tokens.tokenInfo.kolHolders"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(StarIcon,{className:"w-3 h-3 text-neutral"}),formatAmount(l?.kolHolders)]})})]})]}),jsxs("div",{className:"flex-none flex flex-col items-end gap-2.5 leading-none font-mono",children:[jsx("div",{className:"flex flex-col items-end gap-1",children:jsx("span",{className:cn$1("text-base font-bold leading-none",h),children:formatAmountUSDCompact(x)})}),jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsxs("div",{className:"flex items-baseline gap-1",children:[jsx("span",{className:"text-xs text-neutral",children:"V"}),jsx("span",{className:"text-xs text-foreground/80",children:formatAmountUSDCompact(p)})]}),jsxs("span",{className:"text-[10px] leading-none",children:[jsx("span",{className:"text-bullish",children:formatAmountUSDCompact(u)}),jsx("span",{className:"text-neutral/50 mx-0.5",children:"/"}),jsx("span",{className:"text-bearish",children:formatAmountUSDCompact(g)})]})]}),jsxs("div",{className:"flex items-baseline gap-1",children:[jsx("span",{className:"text-xs text-neutral",children:"TX"}),jsx("span",{className:"text-xs text-foreground/80",children:formatAmount(f)})]})]})]}),jsxs("div",{className:"mt-2.5 flex items-start gap-4 relative",children:[jsx(HorizontalScrollContainer,{className:"flex-auto min-w-0",forceShowArrows:true,children:jsxs("div",{className:"flex items-center gap-1",children:[jsx(z,{icon:jsx(UserWithStarBadgeIcon,{width:12,height:12}),value:formatPercent(l?.top10HoldingsRatio),tooltip:n("tokens.tokenInfo.top10HoldingsRatio"),warning:b,disable:!l?.top10HoldingsRatio||l?.top10HoldingsRatio==="0"}),jsx(z,{icon:jsx(CookIcon,{width:12,height:12}),value:formatPercent(l?.devHoldingsRatio),tooltip:n("tokens.tokenInfo.devHoldingsRatio"),warning:T,disable:!l?.devHoldingsRatio||l?.devHoldingsRatio==="0"}),jsx(z,{icon:jsx(SniperIcon,{width:12,height:12}),value:formatPercent(l?.sniperHoldingsRatio),tooltip:n("tokens.tokenInfo.sniperHoldingsRatio"),warning:y,disable:!l?.sniperHoldingsRatio||l?.sniperHoldingsRatio==="0"}),jsx(z,{icon:jsx(RatIcon,{width:12,height:12}),value:formatPercent(l?.insiderHoldingsRatio),tooltip:n("tokens.tokenInfo.insiderHoldingsRatio"),warning:N,disable:!l?.insiderHoldingsRatio||l?.insiderHoldingsRatio==="0"}),jsx(z,{icon:jsx(BundlesIcon,{width:12,height:12}),value:formatPercent(l?.bundleHoldingsRatio),tooltip:n("tokens.tokenInfo.bundleHoldingsRatio"),warning:P,disable:!l?.bundleHoldingsRatio||l?.bundleHoldingsRatio==="0"})]})}),t&&jsx("div",{className:"flex-none relative",onClick:B=>B.stopPropagation(),children:t(e)})]})]})}var ld=152,jr=10;function dd({index:e,style:t,data:o,skeletonCount:r,renderItemAction:s,onSelectToken:n}){if(!o)return jsx("div",{style:t,children:jsx(Fo,{isLast:e===r-1})});let i=o[e];return i?jsx("div",{style:t,children:jsx(Yr,{token:i,isLast:e===o.length-1,renderAction:s,onSelectToken:n})}):jsx("div",{style:t,children:jsx(Fo,{isLast:e===o.length-1})})}function Xe({title:e,tokens:t,isLoading:o,itemHeight:r=ld,renderHeaderExtra:s,renderItemAction:n,onSelectToken:i,onPauseChange:a,onScrollingChange:l,className:d,hideHeader:m}){let c=o||!t?void 0:t,p=c?c.length:jr,u=useMemo(()=>({data:c,skeletonCount:jr,renderItemAction:n,onSelectToken:i}),[c,n,i]),[g,f]=useState(false),x=useRef(void 0),k=useRef(false),h=useCallback(()=>{f(true),a?.(true);},[a]),b=useCallback(()=>{f(false),a?.(false);},[a]),T=useCallback(()=>{k.current||(k.current=true,l?.(true)),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{k.current=false,l?.(false);},180);},[l]);return useEffect(()=>()=>{x.current&&clearTimeout(x.current),k.current&&l?.(false);},[l]),jsxs("div",{className:cn$1("w-full h-full bg-[#0a0a0b] overflow-hidden flex flex-col border border-[rgba(39,39,42,0.6)] rounded-lg",d),onMouseEnter:h,onMouseLeave:b,children:[!m&&jsx(Or,{title:e,isPaused:g,extra:s}),jsx("div",{className:"flex-1 w-full overflow-hidden",onScrollCapture:T,children:jsx(List,{className:"h-full w-full",rowCount:p,rowHeight:r,rowComponent:dd,rowProps:u,overscanCount:10})})]})}function Do(e,t){let o={...e};for(let r of Object.keys(t))t[r]!==void 0&&(o[r]=t[r]);return o}var md=["1m","5m","15m","30m","1h","4h","24h"];function pd(e,t){if(!t)return e;if(!e)return t;let o={...e};for(let r of md)t[r]&&(o[r]=e[r]?Do(e[r],t[r]):t[r]);return o}function ud(e,t){return t?e?Do(e,t):t:e}function _t(e,t){return t?e?Do(e,t):t:e}function X(e,t){let{chain:o,address:r,stats:s,marketData:n,socialMedias:i,security:a,launchedFrom:l,migratedTo:d,...m}=t,c={...e};for(let p of Object.keys(m))m[p]!==void 0&&(c[p]=m[p]);return c.stats=pd(e.stats,s),c.marketData=ud(e.marketData,n),c.socialMedias=_t(e.socialMedias,i),c.security=_t(e.security,a),c.launchedFrom=_t(e.launchedFrom,l),c.migratedTo=_t(e.migratedTo,d),c}function $t(e,t){let o=new Map(e.map(r=>[r.address,r]));return t.map(r=>{let s=o.get(r.address);return s?X(s,r):r})}function fd(e){return e.chain!==void 0&&e.address!==void 0&&e.address!==""&&e.name!==void 0&&e.symbol!==void 0&&e.decimals!==void 0}function Re(e,t){if(t.length===0)return e;let o=[...e],r=false;for(let s of t){let n=o.findIndex(i=>i.address===s.address);if(n>=0){o[n]=X(o[n],s),r=true;continue}fd(s)&&(o.push(s),r=true);}return r?o:e}var xd=["24h","12h","30m","15m","30s","15s","1m","5m","1h","4h","1s"],kd=new Set(["price","marketCap","tvl","holders","top10Holdings","top10Ratio","top100Holdings","top100Ratio","creatorsHoldings","creatorsRatio","createdAt","launchedFromProtocolFamily","migratedToProtocolFamily","tag"]),bd=new Set(["priceChange","volumes","trades","traders","buys","sells"]);function Y(e){if(e==null||e==="")return;let t=Number(e);return Number.isFinite(t)?t:void 0}function tn(e){for(let t of xd){if(!e.endsWith(t))continue;let o=e.slice(0,-t.length);return o?{metric:o,resolution:t}:void 0}}function on(e){if(kd.has(e))return true;let t=tn(e);return t?bd.has(t.metric):false}function Kt(e,t){switch(t){case "price":return Y(e.marketData?.priceInUsd);case "marketCap":return Y(e.marketData?.marketCapInUsd);case "tvl":return Y(e.marketData?.tvlInUsd);case "holders":return Y(e.marketData?.holders);case "top10Holdings":return Y(e.marketData?.top10Holdings);case "top10Ratio":return Y(e.marketData?.top10HoldingsRatio);case "top100Holdings":return Y(e.marketData?.top100Holdings);case "top100Ratio":return Y(e.marketData?.top100HoldingsRatio);case "creatorsHoldings":return Y(e.marketData?.devHoldings);case "creatorsRatio":return Y(e.marketData?.devHoldingsRatio);case "createdAt":return e.createdAt?.getTime();case "launchedFromProtocolFamily":return en(e,e.launchedFrom?.protocolFamily);case "migratedToProtocolFamily":return en(e,e.migratedTo?.protocolFamily);case "tag":return e.tags?.[0];}let o=tn(t);if(!o)return;let r=e.stats?.[o.resolution];switch(o.metric){case "priceChange":return Y(r?.priceChange);case "volumes":return Y(r?.volumesInUsd);case "trades":return Y(r?.trades);case "traders":return Y(r?.traders);case "buys":return Y(r?.buys);case "sells":return Y(r?.sells);default:return}}function en(e,t){if(t)return parseTokenProtocolFamily(e.chain,t)??t}var hd=new Set(["top10Ratio","top100Ratio","creatorsRatio"]);function rn(e){let t=e.trim().toLowerCase();return t.length>0?t:void 0}function Td(e){return [e.name,e.symbol].filter(Boolean).join(" ").toLowerCase()}function yd(e){return Array.isArray(e)?e:void 0}function vd(e){return Array.isArray(e)?void 0:e}function nn(e,t){if(!hd.has(e))return t;let o=Number(t);return Number.isFinite(o)?o/100:t}function ge(e,t){let o=vd(t);return o===void 0?void 0:nn(e,o)}function Bo(e,t){return yd(t)?.map(o=>nn(e,o))}function Je(e,t){if(typeof e=="number"){let o=Number(t);return Number.isFinite(o)?e-o:void 0}if(typeof e=="string")return e.localeCompare(String(t))}function zt(e,t){if(typeof e=="number"){let o=Number(t);return Number.isFinite(o)&&e===o}return String(e)===String(t)}function Nd(e,t){if(!on(t.field))return false;let o=Kt(e,t.field),r=o===void 0;if(t.operator==="isNull")return r;if(t.operator==="isNotNull")return !r;if(r)return false;switch(t.operator){case "eq":{let s=ge(t.field,t.value);return s!==void 0&&zt(o,s)}case "ne":{let s=ge(t.field,t.value);return s!==void 0&&!zt(o,s)}case "gt":{let s=ge(t.field,t.value),n=s!==void 0?Je(o,s):void 0;return n!==void 0&&n>0}case "gte":{let s=ge(t.field,t.value),n=s!==void 0?Je(o,s):void 0;return n!==void 0&&n>=0}case "lt":{let s=ge(t.field,t.value),n=s!==void 0?Je(o,s):void 0;return n!==void 0&&n<0}case "lte":{let s=ge(t.field,t.value),n=s!==void 0?Je(o,s):void 0;return n!==void 0&&n<=0}case "between":{let s=Bo(t.field,t.value);if(!s||s.length<2)return false;let n=Je(o,s[0]),i=Je(o,s[1]);return n!==void 0&&i!==void 0&&n>=0&&i<=0}case "in":{let s=Bo(t.field,t.value);return s?s.some(n=>zt(o,n)):false}case "nin":{let s=Bo(t.field,t.value);return s?s.every(n=>!zt(o,n)):false}case "contains":{let s=ge(t.field,t.value);return s!==void 0&&String(o).includes(String(s))}case "notContains":{let s=ge(t.field,t.value);return s!==void 0&&!String(o).includes(String(s))}case "startsWith":{let s=ge(t.field,t.value);return s!==void 0&&String(o).startsWith(String(s))}case "endsWith":{let s=ge(t.field,t.value);return s!==void 0&&String(o).endsWith(String(s))}default:return false}}function le(e,t){let o=t?.keywords?.map(rn).filter(n=>n!==void 0),r=t?.excludeKeywords?.map(rn).filter(n=>n!==void 0),s=t?.filters;return !o?.length&&!r?.length&&!s?.length?e:e.filter(n=>{let i=Td(n);return !(o?.length&&!o.some(a=>i.includes(a))||r?.length&&r.some(a=>i.includes(a))||s?.length&&!s.every(a=>Nd(n,a)))})}function de({applyUpdates:e,paused:t=false,flushInterval:o=500}){let r=useRef(e),s=useRef(t),n=useRef([]),i=useRef(),a=useRef();r.current=e,s.current=t;let l=useCallback(()=>{i.current!==void 0&&(clearTimeout(i.current),i.current=void 0),a.current!==void 0&&(cancelAnimationFrame(a.current),a.current=void 0);},[]),d=useCallback(()=>{if(l(),s.current){i.current=setTimeout(d,o);return}let p=n.current;p.length!==0&&(n.current=[],r.current(p));},[l,o]),m=useCallback(()=>{i.current!==void 0||a.current!==void 0||(i.current=setTimeout(()=>{i.current=void 0,a.current=requestAnimationFrame(()=>{a.current=void 0,d();});},o));},[d,o]),c=useCallback(p=>{p.length!==0&&(n.current.push(...p),m());},[m]);return useEffect(()=>{t||d();},[d,t]),useEffect(()=>l,[l]),{enqueueUpdates:c,flush:d}}function cn({chain:e,tokens:t,onUpdate:o,enabled:r=true}){let{subscribeClient:s}=useDexClient(),n=useRef(new Map),i=useRef(o);i.current=o;let a=useMemo(()=>Array.from(new Set(t.map(m=>m.address.trim()).filter(Boolean))).sort().join(","),[t]),l=useMemo(()=>a?a.split(","):[],[a]),d=()=>{n.current.forEach(m=>m.unsubscribe()),n.current.clear();};useEffect(()=>d,[e,s,r]),useEffect(()=>{if(!r){d();return}let m=new Set(l),c=n.current;for(let[p,u]of c)m.has(p)||(u.unsubscribe(),c.delete(p));for(let p of l)c.has(p)||c.set(p,s.subscribeToken(e,p,u=>{i.current(u);}));},[l,e,r,s]);}var Pd=80;function xn(e){return {chain:e.chain,address:e.address,name:e.name??"",symbol:e.symbol??"",decimals:e.decimals??0,image:e.image,description:e.description,socialMedias:e.socialMedias,launchedFrom:e.launchedFrom,migratedTo:e.migratedTo,createdAt:e.createdAt}}function Rd(e,t,o){return e===t?o:e===o?t:o||t}function Wo(e){let t=e.token?.address??e.tokenAAddress??"",o=e.token;return {...o,chain:e.chain,address:t,name:o?.name??"",symbol:o?.symbol??"",decimals:o?.decimals??0,createdAt:o?.createdAt??e.createdAt,liquidities:[{poolAddress:e.poolAddress,pairAddress:Rd(t,e.tokenAAddress,e.tokenBAddress),image:e.dex?.image,programAddress:e.dex?.programAddress,protocolFamily:e.dex?.protocolFamily,protocolName:e.dex?.protocolName}]}}function Ad(e){return {...xn(Wo(e)),...e.token??{},liquidities:Wo(e).liquidities,createdAt:e.token?.createdAt??e.createdAt}}function gn(e){return e.sort((t,o)=>{let r=t.createdAt?.getTime()??0;return (o.createdAt?.getTime()??0)-r}),e.slice(0,Pd)}function kn({chain:e,filters:t,isPaused:o=false,deferUpdates:r=false,updateFlushInterval:s}){let n=useMemo(()=>({chain:e}),[e]),i=useRef(o);i.current=o;let a=useRef(e),[l,d]=useState(true),[m,c]=useState([]);useEffect(()=>{e!==a.current&&(d(true),c([]),a.current=e);},[e]);let{data:p,isPending:u}=useNewPoolsQuery(n);useEffect(()=>{p&&(c(b=>{let T=i.current,N=b.length===0&&p.length>0,y=[...b];for(let P of p){let L=Ad(P),H=y.findIndex(te=>te.address===L.address);H>=0?y[H]=X(y[H],L):(!T||N)&&y.push(L);}return T?y:gn(y)}),d(false));},[p]);let g=useCallback(b=>{c(T=>{let N=i.current,y=[...T],P=false;for(let L of b){let H=y.findIndex(te=>te.address===L.address);H>=0?(P=true,y[H]=X(y[H],L)):N||(P=true,y.push(xn(L)));}return P?N?y:gn(y):T});},[]),{enqueueUpdates:f}=de({applyUpdates:g,paused:r,flushInterval:s}),x=useCallback(b=>{f(b.map(Wo));},[f]);useNewPoolsSubscription({chain:e},x),useNewTokensMetadataSubscription({chain:e},f),cn({chain:e,tokens:m,onUpdate:f});let k=useMemo(()=>u||l,[u,l]);return {tokens:useMemo(()=>le(m,t),[m,t]),isLoading:k}}function fb({chain:e,filters:t,title:o,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,className:i,hideHeader:a}){let[l,d]=useState(false),[m,c]=useState(false),{tokens:p,isLoading:u}=kn({chain:e,filters:t,isPaused:l,deferUpdates:m}),g=useCallback(f=>{d(f);},[]);return jsx(Xe,{title:o,tokens:p,isLoading:u,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,onPauseChange:g,onScrollingChange:c,className:i,hideHeader:a})}function xe({chain:e,tokens:t,onUpdate:o,enabled:r=true}){let{subscribeClient:s}=useDexClient(),n=useRef(new Map),i=useRef(o);i.current=o;let a=useMemo(()=>Array.from(new Set(t.map(m=>m.address.trim()).filter(Boolean))).sort().join(","),[t]),l=useMemo(()=>a?a.split(","):[],[a]),d=()=>{n.current.forEach(m=>m.unsubscribe()),n.current.clear();};useEffect(()=>d,[e,s,r]),useEffect(()=>{if(!r){d();return}let m=new Set(l),c=n.current;for(let[p,u]of c)m.has(p)||(u.unsubscribe(),c.delete(p));for(let p of l)c.has(p)||c.set(p,s.subscribeToken(e,p,u=>{i.current(u);}));},[l,e,r,s]);}function Cn({chain:e,filters:t,isPaused:o=false,refetchInterval:r=3e4,deferUpdates:s=false,updateFlushInterval:n}){let i=useMemo(()=>({chain:e}),[e]),a=useRef(o);a.current=o;let l=useRef(e),[d,m]=useState(true),[c,p]=useState([]);useEffect(()=>{e!==l.current&&(m(true),p([]),l.current=e);},[e]);let{data:u,isPending:g}=useMigratedTokensQuery(i,{refetchInterval:r});useEffect(()=>{u&&(p(b=>{let T=a.current,N=[...b];for(let y of u){let P=N.findIndex(L=>L.address===y.address);P>=0?N[P]=X(N[P],y):T||N.unshift(y);}return N}),m(false));},[u]);let f=useCallback(b=>{p(T=>Re(T,b));},[]),{enqueueUpdates:x}=de({applyUpdates:f,paused:s,flushInterval:n});xe({chain:e,tokens:c,onUpdate:x});let k=useMemo(()=>g||d,[g,d]);return {tokens:useMemo(()=>le(c,t),[c,t]),isLoading:k}}function Ib({chain:e,filters:t,title:o,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,className:i,hideHeader:a}){let[l,d]=useState(false),[m,c]=useState(false),{tokens:p,isLoading:u}=Cn({chain:e,filters:t,isPaused:l,deferUpdates:m}),g=useCallback(f=>{d(f);},[]);return jsx(Xe,{title:o,tokens:p,isLoading:u,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,onPauseChange:g,onScrollingChange:c,className:i,hideHeader:a})}function Wd(e){return e.sort((t,o)=>{let r=Number(t.migrateProgress??0);return Number(o.migrateProgress??0)-r})}function An({chain:e,filters:t,isPaused:o=false,refetchInterval:r=15e3,deferUpdates:s=false,updateFlushInterval:n}){let i=useMemo(()=>({chain:e}),[e]),a=useRef(o);a.current=o;let l=useRef(e),[d,m]=useState(true),[c,p]=useState([]);useEffect(()=>{e!==l.current&&(m(true),p([]),l.current=e);},[e]);let{data:u,isPending:g}=useFinalStretchTokensQuery(i,{refetchInterval:r});useEffect(()=>{u&&(p(b=>{let T=a.current,N=b.length===0&&u.length>0,y=[...b];for(let P of u){let L=y.findIndex(H=>H.address===P.address);L>=0?y[L]=X(y[L],P):(!T||N)&&y.push(P);}return T?y:Wd(y)}),m(false));},[u]);let f=useCallback(b=>{p(T=>Re(T,b));},[]),{enqueueUpdates:x}=de({applyUpdates:f,paused:s,flushInterval:n});xe({chain:e,tokens:c,onUpdate:x});let k=useMemo(()=>g||d,[g,d]);return {tokens:useMemo(()=>le(c,t),[c,t]),isLoading:k}}function zb({chain:e,filters:t,title:o,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,className:i,hideHeader:a}){let[l,d]=useState(false),[m,c]=useState(false),{tokens:p,isLoading:u}=An({chain:e,filters:t,isPaused:l,deferUpdates:m}),g=useCallback(f=>{d(f);},[]);return jsx(Xe,{title:o,tokens:p,isLoading:u,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,onPauseChange:g,onScrollingChange:c,className:i,hideHeader:a})}var zd=10,qd=atomWithStorage("liberfi:search_histories",[],void 0,{getOnInit:true});function Qt(){let[e,t]=useAtom(qd),o=useCallback(s=>{let n=s.trim();n&&t(i=>{let a=i.filter(l=>l!==n);return [n,...a].slice(0,zd)});},[t]),r=useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:o,clearHistories:r}}function Un({histories:e,onSelect:t,onClear:o,className:r}){let{t:s}=useTranslation();return e.length===0?null:jsxs("div",{className:cn$1("px-4 pb-4",r),children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium",children:s("tokens.search.history")}),jsx(Button,{isIconOnly:true,size:"sm",className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:o,children:jsx(TrashIcon,{width:20,height:20})})]}),jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:e.map(n=>jsx(Chip,{size:"sm",variant:"bordered",className:cn$1("text-neutral","border-border border-1","cursor-pointer","hover:opacity-hover"),onClick:()=>t?.(n),children:n},n))})]})}function On({onSelect:e,className:t}){let{histories:o,clearHistories:r}=Qt();return jsx(Un,{className:cn$1(t),histories:o,onSelect:e,onClear:r})}function Dn({value:e,onValueChange:t,onClear:o,onEscape:r,className:s}){let{t:n}=useTranslation();return jsx("div",{className:s,children:jsx(StyledInput,{autoFocus:true,variant:"bordered",radius:"full",value:e,onValueChange:t,placeholder:n("tokens.search.placeholder"),classNames:{inputWrapper:["!bg-[rgba(39,39,42,0.6)]","!border-[rgba(63,63,70,0.5)]","data-[hover=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!border-[rgba(63,63,70,0.8)]"].join(" ")},startContent:jsx(SearchIcon,{width:20,height:20,className:"text-neutral"}),endContent:e?jsx(Button,{isIconOnly:true,className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:o,children:jsx(XCloseIcon,{width:20,height:20})}):jsx(Kbd,{className:"min-w-8 justify-center text-xs text-neutral bg-transparent border border-[rgba(63,63,70,0.5)] rounded-full cursor-pointer select-none",onMouseDown:i=>{i.preventDefault(),r?.();},children:"Esc"})})})}function Gt({token:e,className:t}){let{t:o}=useTranslation(),r=useTickAge(e.createdAt),s=useMemo(()=>e.marketData?.priceInUsd,[e]),n=useMemo(()=>e.marketData?.marketCapInUsd,[e]),i=useMemo(()=>e.marketData?.tvlInUsd,[e]),a=useMemo(()=>e.stats?.["24h"]?.priceChange,[e]),l=useMemo(()=>a?new SafeBigNumber(a).abs().toString():void 0,[a]),d=useMemo(()=>a!=null&&new SafeBigNumber(a).gte(0),[a]);return jsxs("div",{className:cn$1("w-full h-full px-3 flex items-center justify-between gap-2","hover:cursor-pointer hover:bg-content2 rounded-lg",t),children:[jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2.5",children:[jsx(fe,{token:e,className:"w-10 h-10 flex-none",showProtocolFamily:true,classNames:{searchIcon:"w-5 h-5"}}),jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-0.5",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsx("span",{className:"font-medium text-sm truncate",children:e.symbol}),jsx("span",{className:"text-xs text-primary font-medium",children:formatAge(r)})]}),jsxs("div",{className:"flex items-center gap-1 text-xs text-neutral",children:[jsxs("span",{children:[o("tokens.listHeader.mcShort")," ",formatAmountUSD(n)]}),jsx("span",{children:"/"}),jsxs("span",{children:[o("tokens.listHeader.liqShort")," ",formatAmountUSD(i)]})]})]})]}),jsxs("div",{className:"flex-none w-20 flex flex-col items-end",children:[jsx("span",{className:"text-xs",children:formatPriceUSD(s)}),jsxs("span",{className:cn$1("inline-flex gap-0.5 items-center text-xs",d?"text-bullish":"text-bearish"),children:[d?jsx(TriangleUpIcon,{width:8,height:8}):jsx(TriangleDownIcon,{width:8,height:8}),jsx("span",{children:formatPercent(l)})]})]})]})}function Xt({className:e}){let{t}=useTranslation();return jsxs("div",{className:cn$1("h-9 px-3 flex items-center justify-between","text-xs font-medium text-neutral","sticky top-0 z-10",e),children:[jsx("div",{className:"flex-1",children:jsxs("span",{children:[t("tokens.listHeader.token")," / ",t("tokens.listHeader.age")," /"," ",t("tokens.listHeader.marketCap")," /"," ",t("tokens.listHeader.liquidity")]})}),jsx("div",{className:"flex-none w-20 text-right",children:jsxs("span",{children:[t("tokens.listHeader.price")," / ",t("tokens.listHeader.24hChange")]})})]})}function gc(){return jsxs("div",{className:"w-full h-14 px-3 flex items-center justify-between gap-2",children:[jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[jsx(Skeleton,{className:"flex-none w-8 h-8 rounded-full"}),jsxs("div",{className:"flex flex-col gap-1.5",children:[jsx(Skeleton,{className:"w-24 h-4 rounded-md"}),jsx(Skeleton,{className:"w-36 h-3 rounded-md"})]})]}),jsxs("div",{className:"flex-none w-20 flex flex-col items-end gap-1.5",children:[jsx(Skeleton,{className:"w-14 h-4 rounded-md"}),jsx(Skeleton,{className:"w-10 h-3 rounded-md"})]})]})}function Yt({rows:e=6,className:t}){return jsx("div",{className:cn$1("w-full",t),children:Array.from({length:e}).map((o,r)=>jsx(gc,{},r))})}function $n({keyword:e,chains:t,limit:o=50}){let r=useMemo(()=>({keyword:e,chains:t,limit:o}),[e,t,o]),{data:s,isLoading:n,isFetchingNextPage:i,hasNextPage:a,fetchNextPage:l}=useSearchTokensInfiniteQuery(r,{enabled:!!e});return {tokens:useMemo(()=>s?.pages.flatMap(m=>m.data)??[],[s]),isLoading:n,isFetchingNextPage:i,hasNextPage:a??false,fetchNextPage:l}}var Cc=56;function zn({onSelectToken:e,className:t,...o}){let{tokens:r,isLoading:s,isFetchingNextPage:n,hasNextPage:i,fetchNextPage:a}=$n(o),l=useRef(null),{height:d}=useResizeObserver({ref:l}),m=useCallback(g=>g<r.length,[r]),c=useCallback(async()=>{i&&!n&&await a();},[i,n,a]),p=useMemo(()=>i?r.length+1:r.length,[r,i]),u=useInfiniteLoader({isRowLoaded:m,loadMoreRows:c,rowCount:p,threshold:5});return s?jsxs("div",{className:cn$1("w-full",t),children:[jsx(Xt,{}),jsx(Yt,{})]}):r.length===0?jsxs("div",{className:cn$1("w-full",t),children:[jsx(Xt,{}),jsx(Lc,{})]}):jsxs("div",{className:cn$1("w-full h-full flex flex-col",t),children:[jsx(Xt,{className:"flex-none"}),jsx("div",{className:"flex-auto min-h-0",ref:l,children:jsx(List,{style:{height:d},onRowsRendered:u,rowComponent:wc,rowCount:p,rowHeight:Cc,rowProps:{tokens:r,onSelectToken:e},overscanCount:5})})]})}function wc({index:e,style:t,tokens:o,onSelectToken:r}){let s=o[e];return s?jsx("div",{style:t,onClick:()=>r?.(s),children:jsx(Gt,{token:s})}):jsx("div",{style:t,className:"flex items-center justify-center",children:jsx(Spinner,{size:"sm"})})}function Lc(){let{t:e}=useTranslation();return jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[jsx(EmptyIcon,{width:28,height:28,className:"text-neutral"}),jsx("p",{className:"mt-2 text-sm text-neutral",children:e("tokens.search.noResults")})]})}function Pc(e,t){return typeof e=="number"&&typeof t=="number"?e-t:String(e).localeCompare(String(t))}function je(e,t){let o=Object.keys(t??{})[0];if(!o)return e;let r=t?.[o];if(r!=="asc"&&r!=="desc")return e;let s=e.map((n,i)=>({token:n,index:i,value:Kt(n,o)}));return s.every(({value:n})=>n===void 0)?e:s.sort((n,i)=>{let a=n.value===void 0,l=i.value===void 0;if(a&&l)return n.index-i.index;if(a)return 1;if(l)return -1;let d=Pc(n.value,i.value);return d===0?n.index-i.index:r==="asc"?d:-d}).map(({token:n})=>n)}function eo({chain:e,resolution:t,filters:o,sortDirections:r,refetchInterval:s=12e3,deferUpdates:n=false,updateFlushInterval:i}){let a=useMemo(()=>({chain:e,resolution:t}),[e,t]),l=useRef(a),[d,m]=useState(true);useEffect(()=>{JSON.stringify(a)!==JSON.stringify(l.current)&&(m(true),l.current=a);},[a]);let[c,p]=useState([]),{data:u,isPending:g}=useTrendingTokensQuery(a,{refetchInterval:s});useEffect(()=>{u&&(p(T=>$t(T,u)),m(false));},[u]);let f=useCallback(T=>{p(N=>Re(N,T));},[]),{enqueueUpdates:x}=de({applyUpdates:f,paused:n,flushInterval:i});useTrendingTokensSubscription({chain:e},x),xe({chain:e,tokens:c,onUpdate:x});let k=useMemo(()=>!!(g||d),[g,d]),h=useMemo(()=>le(c,o),[c,o]);return {tokens:useMemo(()=>je(h,r),[h,r]),isLoading:k}}var Uc=Chain.ETHEREUM,Oc="24h",Dc=56;function Gn({chains:e,onSelectToken:t,className:o}){let r=e?.length===1?e[0]:e?.[0]??Uc,{tokens:s,isLoading:n}=eo({chain:r,resolution:Oc});return jsx("div",{className:cn$1("w-full flex flex-col overflow-hidden",o),children:n?jsx(Yt,{}):jsx("div",{className:"overflow-y-auto",children:s.map(i=>jsx("div",{style:{height:Dc},onClick:()=>t?.(i),children:jsx(Gt,{token:i,className:"h-full"})},i.address))})})}function Yn({onKeywordChange:e}){let[t,o]=useState(""),[r,s]=useState(""),{addHistory:n}=Qt(),i=useCallbackRef(e),a=useCallbackRef(n),l=useMemo(()=>debounce(p=>{s(p),i(p),p&&a(p);},500),[i,a]),d=useCallback(p=>{o(p),l(p);},[l]),m=useCallback(p=>{l.cancel(),o(p),s(p),i(p),p&&a(p);},[l,i,a]),c=useCallback(()=>m(""),[m]);return {text:t,keyword:r,setText:d,setKeyword:m,clearKeyword:c}}function jn({chains:e,onKeywordChange:t,onSelectToken:o,onEscape:r}){let{text:s,keyword:n,setText:i,setKeyword:a,clearKeyword:l}=Yn({onKeywordChange:t});return jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsx(Dn,{value:s,onValueChange:i,onClear:l,onPaste:a,onEscape:r}),n?jsx(zn,{className:"flex-auto min-h-0",keyword:n,chains:e,onSelectToken:o}):jsxs("div",{className:"flex-auto min-h-0 flex flex-col overflow-hidden",children:[jsx(On,{onSelect:a}),jsx(Gn,{className:"flex-auto min-h-0",chains:e,onSelectToken:o})]})]})}var qo="search";function UT({id:e=qo}){return jsx(AsyncModal,{id:e,children:t=>jsx(Jc,{...t})})}function Jc({params:e,isOpen:t,onOpenChange:o,onResult:r}){let{t:s}=useTranslation(),{isMobile:n}=useScreen(),i=useCallback(a=>{r(a);},[r]);return jsx(StyledModal,{isOpen:t,onOpenChange:o,size:n?"full":"lg",hideCloseButton:true,backdrop:"blur",radius:"lg",children:jsxs(ModalContent,{className:"w-full h-full",style:{borderRadius:n?void 0:14,border:n?void 0:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:n?void 0:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"},children:[jsxs(ModalHeader,{className:"sm:hidden flex items-center justify-between pt-4 pb-2",children:[jsx("span",{className:"text-base font-semibold",children:s("tokens.search.title")}),jsx(Button,{isIconOnly:true,onPress:()=>o(false),size:"sm",className:"bg-transparent min-w-6 w-6 h-6",children:jsx(XCloseIcon,{width:20,height:20})})]}),jsx(ModalBody,{className:"p-4",children:jsx(jn,{chains:e?.chains,onSelectToken:i,onEscape:()=>o(false)})})]})})}function KT({chains:e,onSelectToken:t,className:o}){let{t:r}=useTranslation(),{isDesktop:s}=useScreen(),{onOpen:n,onClose:i}=useAsyncModal(qo),a=useCallbackRef(t),l=useCallbackRef(async()=>{let m=await n({params:{chains:e}});m&&a(m);}),d=useCallbackRef(()=>{i();});return useEffect(()=>{let m=c=>{let p=document.activeElement,u=!!p&&(p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.getAttribute("contenteditable")==="true");c.key==="/"&&!u&&(c.preventDefault(),l()),c.key==="Escape"&&(c.preventDefault(),d());};return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m);}},[l,d]),s?jsx(Button,{size:"sm",radius:"full",onPress:l,variant:"bordered",startContent:jsx(SearchIcon,{width:16,height:16,className:"text-foreground"}),endContent:jsx(Kbd,{className:"min-w-6 justify-center text-xs text-foreground bg-content3 rounded-lg",children:"/"}),className:cn$1("w-56 min-w-0 h-8 min-h-0 border-transparent hover:border-border bg-content2 pl-3 pr-1.5 text-neutral",o),children:r("tokens.search.placeholder")}):jsx(Button,{size:"sm",radius:"full",isIconOnly:true,onPress:l,variant:"bordered",className:cn$1("w-8 min-w-0 h-8 min-h-0 border-1 border-border bg-content2",o),children:jsx(SearchIcon,{width:16,height:16,className:"text-foreground"})})}function vt(e){return e==null||e===""?"--":formatPercent(Number(e)/100)}function ke(e,t=4,o=4){return e?e.length<=t+o+1?e:`${e.slice(0,t)}\u2026${e.slice(-o)}`:"--"}function Pe(e,t=Date.now()){if(e==null)return "--";let o=typeof e=="string"||typeof e=="number"?new Date(e):e,r=typeof t=="number"?new Date(t):t,s=Math.max(0,Math.floor((r.getTime()-o.getTime())/1e3));if(s<60)return `${s}s`;let n=Math.floor(s/60);if(n<60)return `${n}m`;let i=Math.floor(n/60);if(i<24)return `${i}h`;let a=Math.floor(i/24);if(a<30)return `${a}d`;let l=Math.floor(a/30);return l<12?`${l}mo`:`${Math.floor(a/365)}y`}function U(e,t){let{data:o,isLoading:r}=useTokenQuery({chain:e,address:t}),[s,n]=useState(o);return useEffect(()=>{o&&n(o);},[o]),useTokenSubscription({chain:e,address:t},i=>{i?.length&&n(a=>{if(!a)return a;let l=a;for(let d of i)l=X(l,d);return l});}),{token:s,isLoading:r}}function et({label:e,totalFormatted:t,buysFormatted:o,sellsFormatted:r,totalValue:s=0,buysValue:n=0,className:i}){let a=new SafeBigNumber(s??0),l=new SafeBigNumber(n??0),d=a.eq(0)?0:l.div(a).times(100).toNumber();return jsxs("div",{className:cn$1("flex flex-col gap-1",i),children:[jsxs("div",{className:"flex items-baseline justify-between",children:[jsx("span",{className:"text-xs text-default-500",children:e}),jsx("span",{className:"text-xs text-foreground",children:t})]}),jsx(Progress,{size:"sm",value:d,classNames:{track:"bg-bearish/40",indicator:"bg-bullish"},"aria-label":`${e} buy share`}),jsxs("div",{className:"flex justify-between gap-4 text-[10px]",children:[jsxs("span",{className:"text-bullish",children:["Buys: ",o]}),jsxs("span",{className:"text-bearish",children:["Sells: ",r]})]})]})}function ss({token:e,actions:t,dataStrip:o,className:r,onCopyAddress:s}){let n=e?.address;return jsxs("div",{className:cn$1("flex w-full flex-wrap items-center gap-4 px-4 py-3",r),children:[jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e&&jsx(fe,{token:e,radius:"lg",className:"h-10 w-10"}),jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"truncate text-base font-semibold text-foreground",children:e?.symbol??"--"}),jsx("span",{className:"truncate text-xs text-default-400",children:e?.name})]}),n&&jsxs("button",{type:"button",onClick:()=>s?.(n),className:"flex items-center gap-1 text-[11px] text-default-400 transition-colors hover:text-foreground",title:n,children:[ke(n,6,6),jsx(CopyIcon,{width:12,height:12})]})]})]}),o&&jsx("div",{className:"flex-1 min-w-0",children:o}),t&&jsx("div",{className:"ml-auto flex items-center gap-2",children:t})]})}function is(e,t){return U(e,t)}function ls({price:e,marketCap:t,volume:o,holdersCount:r,socialMedia:s,className:n}){return jsxs("div",{className:cn$1("flex flex-wrap items-center gap-x-6 gap-y-3",n),children:[e,jsxs("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-3",children:[t,o,r]}),jsx("div",{className:"ml-auto",children:s})]})}function My(e,t){return U(e,t)}function cs({holders:e,top10HoldingsRatio:t,top100HoldingsRatio:o,className:r}){return jsxs("div",{className:cn$1("flex flex-col items-start justify-center gap-0.5",r),children:[jsxs("div",{className:"text-xs font-medium text-default-500",children:[jsx("span",{className:"text-foreground",children:e!=null?formatAmount(e):"--"}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:vt(t)}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:vt(o)})]}),jsx("div",{className:"text-[10px] text-default-400",children:"Holders / Top10 / Top100"})]})}function ms(e,t){return U(e,t)}function ps({chain:e,address:t,className:o}){let{token:r}=ms(e,t);return jsx(cs,{holders:r?.marketData?.holders,top10HoldingsRatio:r?.marketData?.top10HoldingsRatio,top100HoldingsRatio:r?.marketData?.top100HoldingsRatio,className:o})}function gs({marketCapInUsd:e,tvlInUsd:t,createdAt:o,className:r}){return jsxs("div",{className:cn$1("flex flex-col items-start justify-center gap-0.5",r),children:[jsxs("div",{className:"text-xs font-medium text-default-500",children:[jsx("span",{className:"text-foreground",children:e?formatAmountUSDCompact(e):"--"}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:t?formatAmountUSDCompact(t):"--"}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:Pe(o)})]}),jsx("div",{className:"text-[10px] text-default-400",children:"MC / Liq / Age"})]})}function xs(e,t){return U(e,t)}function ks({chain:e,address:t,className:o}){let{token:r}=xs(e,t);return jsx(gs,{marketCapInUsd:r?.marketData?.marketCapInUsd,tvlInUsd:r?.marketData?.tvlInUsd,createdAt:r?.createdAt,className:o})}function Ts({priceInUsd:e,price24hAgoInUsd:t,className:o}){let{bearish:r,priceChange:s}=useMemo(()=>{if(!e||!t)return {bearish:false,priceChange:void 0};let n=new SafeBigNumber(e),i=new SafeBigNumber(t);return i.lte(0)?{bearish:false,priceChange:void 0}:{bearish:n.lt(i),priceChange:n.minus(i).div(i).abs().toNumber()}},[e,t]);return jsxs("div",{className:cn$1("group flex flex-col gap-1",o),"data-bearish":r,children:[jsx("div",{className:"text-base font-medium leading-none text-bullish group-data-[bearish=true]:text-bearish",children:e?formatPriceUSD(e):"--"}),jsxs("div",{className:"flex items-center gap-2 text-[10px] leading-none",children:[jsx("span",{className:"text-default-400",children:"24h"}),jsx("span",{className:"text-bullish group-data-[bearish=true]:text-bearish",children:s!=null?formatPercent(s):"--"})]})]})}function ys(e,t){return U(e,t)}function vs({chain:e,address:t,className:o}){let{token:r}=ys(e,t);return jsx(Ts,{priceInUsd:r?.marketData?.priceInUsd,price24hAgoInUsd:r?.stats?.["24h"]?.openPriceInUsd,className:o})}function Pm(e,t){switch(e){case "website":return jsx(WebsiteIcon,{width:t,height:t});case "twitter":return jsx(TwitterIcon,{width:t,height:t});case "telegram":return jsx(TelegramIcon,{width:t,height:t});case "discord":return jsx(DiscordIcon,{width:t,height:t});default:return jsx("span",{className:"text-[9px] font-medium uppercase",children:e.slice(0,2)})}}function Ns({socials:e,className:t,iconSize:o=16}){if(!e)return null;let s=["website","twitter","telegram","discord","github","reddit","youtube","medium"].filter(n=>!!e[n]);return s.length===0?null:jsx("div",{className:cn$1("flex items-center gap-3",t),children:s.map(n=>jsx("a",{href:e[n],target:"_blank",rel:"noreferrer noopener",className:"flex items-center justify-center text-default-400 transition-colors hover:text-foreground",style:{width:o,height:o},children:Pm(n,o)},n))})}function Ss(e,t){return U(e,t)}function Cs({chain:e,address:t,className:o,iconSize:r}){let{token:s}=Ss(e,t);return jsx(Ns,{socials:s?.socialMedias,className:o,iconSize:r})}function Ps({volumesInUsd:e,trades:t,traders:o,className:r}){return jsxs("div",{className:cn$1("flex flex-col items-start justify-center gap-0.5",r),children:[jsxs("div",{className:"text-xs font-medium text-default-500",children:[jsx("span",{className:"text-foreground",children:e?formatAmountUSDCompact(e):"--"}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:t!=null?formatAmount(t):"--"}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:o!=null?formatAmount(o):"--"})]}),jsx("div",{className:"text-[10px] text-default-400",children:"24h Vol / Txs / Traders"})]})}function Rs(e,t){return U(e,t)}function As({chain:e,address:t,className:o}){let{token:r}=Rs(e,t),s=r?.stats?.["24h"];return jsx(Ps,{volumesInUsd:s?.volumesInUsd,trades:s?.trades,traders:s?.traders,className:o})}function Is({chain:e,address:t,className:o}){return jsx(ls,{className:o,price:jsx(vs,{chain:e,address:t}),marketCap:jsx(ks,{chain:e,address:t}),volume:jsx(As,{chain:e,address:t}),holdersCount:jsx(ps,{chain:e,address:t}),socialMedia:jsx(Cs,{chain:e,address:t})})}function g0({chain:e,address:t,actions:o,dataStrip:r,className:s,onCopyAddress:n}){let{token:i}=is(e,t);return jsx(ss,{token:i,actions:o,dataStrip:r===void 0?jsx(Is,{chain:e,address:t}):r,className:s,onCopyAddress:n})}var Um=[{value:"holdingUsd",label:"Value"},{value:"lastActiveAt",label:"Last active"}];function Ms({holders:e,isLoading:t,sortBy:o,onSortByChange:r,onlyTracked:s=false,onOnlyTrackedChange:n,onLoadMore:i,hasMore:a,now:l=Date.now(),wellKnownAddresses:d,className:m,renderAddress:c}){let p=s?e.filter(u=>u.tags&&u.tags.length>0):e;return jsxs("div",{className:cn$1("flex flex-col",m),children:[jsxs("div",{className:"flex items-center justify-between gap-4 px-3 py-2",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("span",{className:"text-xs font-medium text-default-500",children:"Holders"}),jsxs("label",{className:"flex cursor-pointer items-center gap-1 text-[11px] text-default-400",children:[jsx("input",{type:"checkbox",className:"size-3 accent-primary",checked:s,onChange:u=>n?.(u.target.checked)}),"Only Tracked"]})]}),jsx("div",{className:"flex items-center gap-1",children:Um.map(u=>jsx("button",{type:"button",onClick:()=>r(u.value),className:cn$1("rounded px-2 py-1 text-[11px] transition-colors",o===u.value?"bg-default-100 text-foreground":"text-default-400 hover:text-foreground"),children:u.label},u.value))})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[640px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-default-400",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[30%] px-3 py-2 text-left font-normal",children:"Wallet"}),jsx("th",{className:"w-[20%] px-3 py-2 text-left font-normal",children:"Tags"}),jsx("th",{className:"w-[15%] px-3 py-2 text-right font-normal",children:"Value"}),jsx("th",{className:"w-[10%] px-3 py-2 text-right font-normal",children:"%"}),jsx("th",{className:"w-[12%] px-3 py-2 text-right font-normal",children:"First held"}),jsx("th",{className:"w-[13%] px-3 py-2 text-right font-normal",children:"Last active"})]})}),jsxs("tbody",{children:[p.length===0&&!t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-8 text-center text-default-400",children:"No holders"})}),p.map(u=>jsx(Om,{holder:u,now:l,wellKnownAddresses:d,renderAddress:c},u.address)),t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-4 text-center text-default-400",children:"Loading\u2026"})})]})]})}),a&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:i,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-default-600 transition-colors hover:bg-default-200 disabled:opacity-50",children:"Load more"})})]})}function Om({holder:e,now:t,wellKnownAddresses:o,renderAddress:r}){let s=o?.[e.address],n=useMemo(()=>r?r(e.address):s?jsx("span",{className:"rounded bg-default-100 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-default-600",children:s}):jsx("span",{className:"font-mono text-[11px] text-default-500",children:ke(e.address,6,6)}),[e.address,r,s]);return jsxs("tr",{className:"border-b border-default-50 hover:bg-default-50/60",children:[jsx("td",{className:"px-3 py-2 align-middle",children:n}),jsx("td",{className:"px-3 py-2 align-middle",children:jsx(Dt,{tags:e.tags,max:3})}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:formatAmountUSDCompact(e.amountInUsd)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-500",children:vt(e.ratio)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:e.startHoldingAt?Pe(e.startHoldingAt,t):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:e.lastActiveAt?Pe(e.lastActiveAt,t):"--"})]})}function Ds({chain:e,address:t,limit:o=50,initialSortBy:r="holdingUsd"}){let[s,n]=useState(r),[i,a]=useState(void 0),[l,d]=useState([]),m=useCallback(()=>{a(void 0),d([]);},[]),c=useCallback(T=>{T!==s&&(n(T),m());},[s,m]);useEffect(()=>{m();},[e,t,m]);let p=useMemo(()=>({chain:e,address:t,cursor:i,limit:o,sortBy:s}),[e,t,i,o,s]),{data:u,isPending:g,isFetching:f}=useTokenHoldersQuery(p);useEffect(()=>{u&&d(T=>i==null?[u]:T[T.length-1]?.endCursor===u.endCursor?T:[...T,u]);},[u,i]),useTokenSubscription({chain:e,address:t},()=>{});let x=useMemo(()=>l.flatMap(T=>T.data),[l]),k=l[l.length-1],h=!!(k?.hasNext&&k.endCursor),b=useCallback(()=>{!k?.endCursor||!k.hasNext||a(k.endCursor);},[k]);return {holders:x,isLoading:g||f,sortBy:s,setSortBy:c,hasMore:h,loadMore:b}}function O0({chain:e,address:t,limit:o,initialSortBy:r,initialOnlyTracked:s=false,wellKnownAddresses:n,className:i,renderAddress:a}){let[l,d]=useState(s),{holders:m,isLoading:c,sortBy:p,setSortBy:u,hasMore:g,loadMore:f}=Ds({chain:e,address:t,limit:o,initialSortBy:r});return jsx(Ms,{holders:m,isLoading:c,sortBy:p,onSortByChange:u,onlyTracked:l,onOnlyTrackedChange:d,wellKnownAddresses:n,hasMore:g,onLoadMore:f,className:i,renderAddress:a})}var $m=[{value:"timestamp",label:"Latest"},{value:"totalUsd",label:"Top USD"}],Km=[{value:"all",label:"All"},{value:"buy",label:"Buys"},{value:"sell",label:"Sells"}],zm=[{value:"all",label:"All"},{value:"dev",label:"DEV"},{value:"tracked",label:"TRACKED"},{value:"you",label:"YOU"}];function Bs({activities:e,isLoading:t,sortBy:o,onSortByChange:r,typeFilter:s="all",onTypeFilterChange:n,traderFilter:i="all",onTraderFilterChange:a,youWalletAddress:l,currency:d="usd",onCurrencyChange:m,onLoadMore:c,hasMore:p,now:u=Date.now(),nativeDecimals:g=9,nativeSymbol:f="SOL",className:x,onRowClick:k}){let h=Qm(e,i,l);return jsxs("div",{className:cn$1("flex flex-col",x),children:[jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 px-3 py-2",children:[jsxs("div",{className:"flex items-center gap-1",children:[Km.map(b=>jsx("button",{type:"button",onClick:()=>n?.(b.value),className:cn$1("rounded px-2 py-1 text-[11px] transition-colors",s===b.value?"bg-default-100 text-foreground":"text-default-400 hover:text-foreground"),children:b.label},b.value)),jsx("span",{className:"mx-1 h-3 w-px bg-default-200","aria-hidden":true}),zm.map(b=>{let T=i===b.value,N=b.value==="you"&&!l;return jsx("button",{type:"button",disabled:N,onClick:()=>a?.(b.value),className:cn$1("rounded px-2 py-1 text-[11px] transition-colors",T?"bg-default-100 text-foreground":"text-default-400 hover:text-foreground",N&&"cursor-not-allowed opacity-50"),children:b.label},b.value)})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx(Gm,{value:d,nativeSymbol:f,onChange:m}),jsx("div",{className:"flex items-center gap-1",children:$m.map(b=>jsx("button",{type:"button",onClick:()=>r(b.value),className:cn$1("rounded px-2 py-1 text-[11px] transition-colors",o===b.value?"bg-default-100 text-foreground":"text-default-400 hover:text-foreground"),children:b.label},b.value))})]})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[780px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-default-400",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[10%] px-3 py-2 text-left font-normal",children:"Side"}),jsx("th",{className:"w-[25%] px-3 py-2 text-left font-normal",children:"Trader"}),jsx("th",{className:"w-[15%] px-3 py-2 text-right font-normal",children:"Amount"}),jsx("th",{className:"w-[15%] px-3 py-2 text-right font-normal",children:"USD"}),jsx("th",{className:"w-[15%] px-3 py-2 text-right font-normal",children:"Price"}),jsx("th",{className:"w-[10%] px-3 py-2 text-right font-normal",children:"Gas"}),jsx("th",{className:"w-[10%] px-3 py-2 text-right font-normal",children:"Age"})]})}),jsxs("tbody",{children:[h.length===0&&!t&&jsx("tr",{children:jsx("td",{colSpan:7,className:"py-8 text-center text-default-400",children:"No activities"})}),h.map(b=>jsx(Jm,{activity:b,now:u,nativeDecimals:g,nativeSymbol:f,currency:d,onRowClick:k},b.txHash)),t&&jsx("tr",{children:jsx("td",{colSpan:7,className:"py-4 text-center text-default-400",children:"Loading\u2026"})})]})]})}),p&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:c,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-default-600 transition-colors hover:bg-default-200 disabled:opacity-50",children:"Load more"})})]})}function qm(e){return e.type==="buy"?e.to:e.type==="sell"?e.from:e.to}function Qm(e,t,o){if(t==="all")return e;if(t==="you"){if(!o)return [];let s=o.toLowerCase();return e.filter(n=>n.walletAddress?.toLowerCase()===s)}if(t==="dev")return e.filter(s=>s.traderTags?.some(n=>n==="dev"));let r=new Set(["kol","smart","bluechip"]);return e.filter(s=>s.traderTags?.some(n=>r.has(n)))}function Gm({value:e,nativeSymbol:t,onChange:o}){return jsx("div",{className:"flex h-[22px] items-center rounded bg-default-100 p-[2px] text-[11px]",children:[{k:"usd",label:"USD"},{k:"native",label:t}].map(s=>jsx("button",{type:"button",onClick:()=>o?.(s.k),className:cn$1("rounded px-2 transition-colors",e===s.k?"bg-default-200 text-foreground":"text-default-400 hover:text-foreground"),children:s.label},s.k))})}function Xm(e,t,o){if(!e)return "--";let r=Number(e)/Math.pow(10,t);return Number.isFinite(r)?`${formatAmount(r)} ${o}`:"--"}function Jm({activity:e,now:t,nativeDecimals:o,nativeSymbol:r,currency:s,onRowClick:n}){let i=qm(e),a=e.type==="buy"?"Buy":e.type==="sell"?"Sell":e.type.replace(/_/g," "),l=e.type==="buy"?"text-bullish":e.type==="sell"?"text-bearish":"text-default-500";return jsxs("tr",{className:cn$1("border-b border-default-50 hover:bg-default-50/60",n&&"cursor-pointer"),onClick:n?()=>n(e):void 0,children:[jsx("td",{className:cn$1("px-3 py-2 align-middle font-medium capitalize",l),children:a}),jsx("td",{className:"px-3 py-2 align-middle",children:jsxs("div",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:"font-mono text-[11px] text-default-500",children:ke(e.walletAddress,6,6)}),jsx(Wr,{tags:e.traderTags,max:2})]})}),jsxs("td",{className:"px-3 py-2 text-right align-middle",children:[formatAmount(i.amount)," ",i.symbol]}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:s==="native"&&i.amountInNative?`${formatAmount(i.amountInNative)} ${i.symbol}`:i.amountInUsd?formatAmountUSDCompact(i.amountInUsd):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-500",children:i.priceInUsd?`$${formatPrice(i.priceInUsd)}`:"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:Xm(e.gasFee,o,r)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:Pe(e.time,t)})]})}function Vs({chain:e,address:t,limit:o=50,initialSortBy:r,initialTypeFilter:s="all"}){let[n,i]=useState(r),[a,l]=useState(s),[d,m]=useState(void 0),[c,p]=useState([]),[u,g]=useState([]),f=useCallback(()=>{m(void 0),p([]),g([]);},[]),x=useCallback(D=>{D!==n&&(i(D),f());},[n,f]),k=useCallback(D=>{D!==a&&(l(D),f());},[a,f]);useEffect(()=>{f();},[e,t,f]);let h=a==="all"?void 0:a,b=useMemo(()=>({chain:e,address:t,cursor:d,limit:o,sortBy:n,type:h}),[e,t,d,o,n,h]),{data:T,isPending:N,isFetching:y}=useTokenActivitiesQuery(b);useEffect(()=>{T&&p(D=>d==null?[T]:D[D.length-1]?.endCursor===T.endCursor?D:[...D,T]);},[T,d]);let P=(n==null||n==="timestamp")&&a==="all"&&d==null;useTokenActivitiesSubscription({chain:e,address:t},D=>{!P||!D?.length||g(ie=>{let B=new Set(ie.map(_=>_.txHash)),F=D.filter(_=>!B.has(_.txHash));return F.length===0?ie:[...F,...ie].slice(0,100)});});let L=useMemo(()=>{let D=c.flatMap(F=>F.data);if(!P||u.length===0)return D;let ie=new Set(D.map(F=>F.txHash));return [...u.filter(F=>!ie.has(F.txHash)),...D]},[c,u,P]),H=c[c.length-1],te=!!(H?.hasNext&&H.endCursor),Se=useCallback(()=>{!H?.endCursor||!H.hasNext||m(H.endCursor);},[H]);return {activities:L,isLoading:N||y,sortBy:n,setSortBy:x,typeFilter:a,setTypeFilter:k,hasMore:te,loadMore:Se}}function tN({chain:e,address:t,limit:o,initialSortBy:r,initialTypeFilter:s,initialTraderFilter:n="all",initialCurrency:i="usd",youWalletAddress:a,nativeDecimals:l,nativeSymbol:d,className:m,onRowClick:c}){let[p,u]=useState(n),[g,f]=useState(i),{activities:x,isLoading:k,sortBy:h,setSortBy:b,typeFilter:T,setTypeFilter:N,hasMore:y,loadMore:P}=Vs({chain:e,address:t,limit:o,initialSortBy:r,initialTypeFilter:s});return jsx(Bs,{activities:x,isLoading:k,sortBy:h,onSortByChange:b,typeFilter:T,onTypeFilterChange:N,traderFilter:p,onTraderFilterChange:u,youWalletAddress:a,currency:g,onCurrencyChange:f,hasMore:y,onLoadMore:P,className:m,nativeDecimals:l,nativeSymbol:d,onRowClick:c})}function $s({stats:e,resolution:t,className:o}){let r=e?.[t],s=r?.traders??0,n=r?.buyers??0,i=r?.sellers??0;return jsx(et,{className:o,label:`Traders (${t})`,totalFormatted:formatAmount(s),buysFormatted:formatAmount(n),sellsFormatted:formatAmount(i),totalValue:s,buysValue:n})}function Ks(e,t){return U(e,t)}function xN({chain:e,address:t,resolution:o="24h",className:r}){let{token:s}=Ks(e,t);return jsx($s,{stats:s?.stats,resolution:o,className:r})}function zs({stats:e,resolution:t,className:o}){let r=e?.[t],s=r?.trades??0,n=r?.buys??0,i=r?.sells??0;return jsx(et,{className:o,label:`Transactions (${t})`,totalFormatted:formatAmount(s),buysFormatted:formatAmount(n),sellsFormatted:formatAmount(i),totalValue:s,buysValue:n})}function qs(e,t){return U(e,t)}function IN({chain:e,address:t,resolution:o="24h",className:r}){let{token:s}=qs(e,t);return jsx(zs,{stats:s?.stats,resolution:o,className:r})}function Qs({stats:e,resolution:t,className:o}){let r=e?.[t],s=r?.volumesInUsd??"0",n=r?.buyVolumesInUsd??"0",i=r?.sellVolumesInUsd??"0";return jsx(et,{className:o,label:`Volume (${t})`,totalFormatted:formatAmountUSDCompact(s),buysFormatted:formatAmountUSDCompact(n),sellsFormatted:formatAmountUSDCompact(i),totalValue:s,buysValue:n})}function Gs(e,t){return U(e,t)}function qN({chain:e,address:t,resolution:o="24h",className:r}){let{token:s}=Gs(e,t);return jsx(Qs,{stats:s?.stats,resolution:o,className:r})}function Xs({security:e,externalUrl:t,externalLabel:o,className:r}){let s=[{title:"Transfer fee",value:e?.hasTransferFee,safeWhen:false,description:"Whether the token charges a fee on transfer."},{title:"Fee not upgradable",value:e?.isTransferFeeUpgradable,safeWhen:false,description:"Whether the transfer fee can be raised by the token owner."},{title:"Transferable",value:e?.isTransferable,safeWhen:true,description:"Whether token holders can freely transfer the token."},{title:"Not freezable",value:e?.isFreezable,safeWhen:false,description:"Whether the token authority can freeze holder balances."},{title:"Not closable",value:e?.isClosable,safeWhen:false,description:"Whether the token program can be closed by its owner."}],n=s.every(i=>i.value!==void 0&&i.value===i.safeWhen);return jsxs("section",{className:cn$1("flex w-full flex-col gap-3",r),children:[jsxs("div",{className:"flex items-baseline justify-between",children:[jsx("span",{className:"text-sm font-medium text-foreground",children:"Security"}),jsx("span",{className:cn$1("text-xs",e===void 0?"text-default-400":n?"text-success-500":"text-danger-500"),children:e===void 0?"--":n?"Safe":"Review"})]}),jsx("div",{className:"flex flex-col",children:s.map(i=>jsx(ip,{...i},i.title))}),t&&o&&jsx("div",{className:"flex justify-center",children:jsx("a",{href:t,target:"_blank",rel:"noreferrer noopener",className:"text-xs text-default-400 transition-colors hover:text-foreground",children:o})})]})}function ip({title:e,value:t,safeWhen:o,description:r}){let s=t!==void 0&&t===o,n=t===void 0?"--":s?"OK":"Risk";return jsxs("div",{className:"flex h-8 items-center justify-between gap-2",children:[jsx("span",{className:"text-xs text-default-500",title:r,children:e}),jsx("span",{className:cn$1("text-xs",t===void 0?"text-default-400":s?"text-success-500":"text-danger-500"),children:n})]})}function Js(e,t){let{data:o,isLoading:r}=useTokenSecurityQuery({chain:e,address:t});return {security:o,isLoading:r}}function iS({chain:e,address:t,externalUrl:o,externalLabel:r,className:s}){let{security:n}=Js(e,t);return jsx(Xs,{security:n,externalUrl:o,externalLabel:r,className:s})}function js({token:e,className:t}){return e?jsxs("section",{className:cn$1("flex w-full flex-col gap-2",t),children:[jsxs("div",{className:"text-sm font-medium text-foreground",children:["About ",e.symbol]}),e.description?jsx("p",{className:"whitespace-pre-line text-xs text-default-500",children:e.description}):jsx("p",{className:"text-xs text-default-400",children:"No description provided."})]}):null}function ei(e,t){return U(e,t)}function TS({chain:e,address:t,className:o}){let{token:r}=ei(e,t);return jsx(js,{token:r,className:o})}function ri({liquidities:e,totalTvlInUsd:t,collapseAt:o=3,className:r,onPoolClick:s}){let[n,i]=useState(!e||e.length<=o),a=useCallback(()=>i(l=>!l),[]);return jsxs("section",{className:cn$1("flex w-full flex-col gap-3",r),children:[jsxs("div",{className:"flex items-baseline justify-between",children:[jsx("span",{className:"text-sm font-medium text-foreground",children:"Liquidity"}),t&&jsx("span",{className:"text-xs text-foreground",children:formatAmountUSDCompact(t)})]}),(!e||e.length===0)&&jsx("div",{className:"py-4 text-center text-xs text-default-400",children:"No pools"}),e&&e.length>0&&jsxs("div",{className:"flex flex-col gap-2",children:[e.map((l,d)=>jsxs("div",{className:cn$1("flex h-10 w-full items-center justify-between overflow-hidden text-xs",d>=o&&!n&&"hidden",s&&"cursor-pointer hover:bg-default-50"),onClick:s?()=>s(l):void 0,children:[jsxs("div",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:"text-foreground",children:l.protocolFamily??l.protocolName??"Unknown"}),l.poolAddress&&jsxs("span",{className:"font-mono text-[10px] text-default-400",children:["Pool: ",ke(l.poolAddress,6,6)]})]}),jsx("div",{className:"text-default-500",children:formatAmountUSDCompact(l.tvlInUsd??0)})]},l.poolAddress??`${l.protocolFamily}-${d}`)),e.length>o&&jsx("div",{className:"flex justify-center pt-1",children:jsx("button",{type:"button",onClick:a,className:"rounded px-2 py-1 text-xs text-default-400 transition-colors hover:text-foreground",children:n?"Show less":"Show more"})})]})]})}function ni(e,t){return U(e,t)}function DS({chain:e,address:t,collapseAt:o,className:r,onPoolClick:s}){let{token:n}=ni(e,t);return jsx(ri,{liquidities:n?.liquidities,totalTvlInUsd:n?.marketData?.tvlInUsd,collapseAt:o,className:r,onPoolClick:s})}function si({cexes:e,collapseAt:t=4,className:o}){let[r,s]=useState(!e||e.length<=t),n=useCallback(()=>s(i=>!i),[]);return !e||e.length===0?null:jsxs("section",{className:cn$1("w-full",o),children:[jsx("div",{className:"text-sm font-medium text-foreground",children:"CEX listings"}),jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:e.map((i,a)=>{let l=a>=t&&!r,d=jsx(Chip,{startContent:i.logo?jsx(Image,{src:i.logo,width:20,height:20,alt:i.name}):void 0,className:cn$1("bg-default-100 text-xs",l&&"hidden"),children:i.name},i.id);return i.url?jsx("a",{href:i.url,target:"_blank",rel:"noreferrer noopener",className:cn$1(l&&"hidden"),children:d},i.id):d})}),e.length>t&&jsx("div",{className:"mt-3 flex justify-center",children:jsx("button",{type:"button",onClick:n,className:"rounded px-2 py-1 text-xs text-default-400 transition-colors hover:text-foreground",children:r?"Show less":"Show more"})})]})}function ii(e){return {cexes:e}}function YS({cexes:e,collapseAt:t,className:o}){let{cexes:r}=ii(e);return jsx(si,{cexes:r,collapseAt:t,className:o})}function li({categories:e,collapseAt:t=4,className:o,onCategoryClick:r}){let[s,n]=useState(!e||e.length<=t),i=useCallback(()=>n(a=>!a),[]);return !e||e.length===0?null:jsxs("section",{className:cn$1("w-full",o),children:[jsx("div",{className:"text-sm font-medium text-foreground",children:"Categories"}),jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:e.map((a,l)=>{let d=l>=t&&!s;return jsx(Chip,{size:"sm",className:cn$1("bg-default-100",d&&"hidden",r&&"cursor-pointer"),onClick:r?()=>r(a):void 0,children:a},a)})}),e.length>t&&jsx("div",{className:"mt-3 flex justify-center",children:jsx("button",{type:"button",onClick:i,className:"rounded px-2 py-1 text-xs text-default-400 transition-colors hover:text-foreground",children:s?"Show less":"Show more"})})]})}function di(e,t){return U(e,t)}function pC({chain:e,address:t,collapseAt:o,className:r,onCategoryClick:s}){let{token:n}=di(e,t);return jsx(li,{categories:n?.tags,collapseAt:o,className:r,onCategoryClick:s})}var ci=["5m","1h","4h","24h"];function mi({stats:e,resolution:t,className:o}){let r=e?.[t],s=new SafeBigNumber(r?.buyVolumesInUsd??0),n=new SafeBigNumber(r?.sellVolumesInUsd??0),i=s.plus(n),a=s.minus(n),l=i.eq(0)?50:Math.min(100,Math.max(0,s.div(i).times(100).toNumber())),d=[{label:`${t} Vol`,value:formatAmountUSDCompact(i.toString()),className:"text-foreground"},{label:"Buys",value:formatAmountUSDCompact(s.toString()),className:"text-bullish"},{label:"Sells",value:formatAmountUSDCompact(n.toString()),className:"text-bearish"},{label:"Net Vol.",value:formatAmountUSDCompact(a.abs().toString()),className:a.gte(0)?"text-bullish":"text-bearish"}];return jsxs("div",{className:cn$1("flex h-full w-full flex-col",o),children:[jsx("div",{className:"grid flex-1 grid-cols-4 items-center",children:d.map(m=>jsxs("div",{className:"flex flex-col items-start justify-center gap-[2px] px-2",children:[jsx("span",{className:"text-[10px] leading-none text-default-400",children:m.label}),jsx("span",{className:cn$1("text-[13px] font-medium leading-none tabular-nums",m.className),children:m.value})]},m.label))}),jsx("div",{className:"relative h-[2px] w-full overflow-hidden bg-bearish",children:jsx("div",{className:"absolute inset-y-0 left-0 bg-bullish transition-[width] duration-200 ease-out",style:{width:`${l}%`}})})]})}function pi({stats:e,resolutions:t,className:o}){return jsx("div",{className:cn$1("grid h-full w-full grid-cols-4 items-center",o),children:t.map(r=>{let n=e?.[r]?.priceChange,i=n?new SafeBigNumber(n):void 0,a=i?i.gte(0):void 0,l=r,d=i?formatPercent(i,{showPlusGtThanZero:true}):"\u2014";return jsxs("div",{className:"flex flex-col items-start justify-center gap-[2px] px-2",children:[jsx("span",{className:"text-[10px] leading-none text-default-400",children:l}),jsx("span",{className:cn$1("text-[13px] font-medium leading-none tabular-nums",a===void 0?"text-foreground":a?"text-bullish":"text-bearish"),children:d})]},r)})})}function ui({chain:e,address:t}){let{data:o,isLoading:r}=useTokenStatsQuery({chain:e,address:t});return {stats:o,isLoading:r}}function PC({chain:e,address:t,baseResolution:o="5m",hoverResolutions:r=ci,height:s=64,className:n}){let{stats:i}=ui({chain:e,address:t});return jsx(StatsFlipPanel,{className:n,height:s,base:jsx(mi,{stats:i,resolution:o}),hover:jsx(pi,{stats:i,resolutions:r})})}function fi({positions:e,isLoading:t,hasMore:o,onLoadMore:r,currency:s="usd",onCurrencyChange:n,showHidden:i=false,onShowHiddenChange:a,nativeSymbol:l="Native",renderActions:d,className:m}){return jsxs("div",{className:cn$1("flex flex-col",m),children:[jsxs("div",{className:"flex items-center justify-between gap-4 px-3 py-2",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("span",{className:"text-xs font-medium text-default-500",children:"Positions"}),jsxs("label",{className:"flex cursor-pointer items-center gap-1 text-[11px] text-default-400",children:[jsx("input",{type:"checkbox",className:"size-3 accent-primary",checked:i,onChange:c=>a?.(c.target.checked)}),"Show Hidden"]})]}),jsx(Hp,{value:s,nativeSymbol:l,onChange:n})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[720px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-default-400",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[26%] px-3 py-2 text-left font-normal",children:"Token"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"Bought"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"Sold"}),jsx("th",{className:"w-[16%] px-3 py-2 text-right font-normal",children:"Remaining"}),jsx("th",{className:"w-[18%] px-3 py-2 text-right font-normal",children:"PnL"}),jsx("th",{className:"w-[12%] px-3 py-2 text-right font-normal",children:"Actions"})]})}),jsxs("tbody",{children:[e.length===0&&!t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-8 text-center text-default-400",children:"No open positions"})}),e.map(c=>jsx(Fp,{position:c,currency:s,renderActions:d},`${c.chain}:${c.address}`)),t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-4 text-center text-default-400",children:"Loading\u2026"})})]})]})}),o&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:r,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-default-600 transition-colors hover:bg-default-200 disabled:opacity-50",children:"Load more"})})]})}function Hp({value:e,nativeSymbol:t,onChange:o}){return jsx("div",{className:"flex h-[24px] items-center rounded bg-default-100 p-[2px] text-[11px]",children:[{k:"usd",label:"USD"},{k:"native",label:t}].map(s=>jsx("button",{type:"button",onClick:()=>o?.(s.k),className:cn$1("rounded px-2 transition-colors",e===s.k?"bg-default-200 text-foreground":"text-default-400 hover:text-foreground"),children:s.label},s.k))})}function Fp({position:e,currency:t,renderActions:o}){let{bought:r,sold:s,remaining:n,pnl:i}=useMemo(()=>Mp(e,t),[e,t]),a=jsxs("div",{className:"flex items-center gap-2",children:[jsx(Avatar,{src:e.image??void 0,name:(e.symbol??"?").slice(0,1),className:"size-5 shrink-0 rounded-full bg-default-200 text-[10px]",showFallback:true}),jsxs("div",{className:"flex min-w-0 flex-col",children:[jsx("span",{className:"truncate text-foreground",children:e.symbol}),jsx("span",{className:"truncate text-[10px] text-default-400",children:e.name})]})]});return jsxs("tr",{className:"border-b border-default-50 hover:bg-default-50/60",children:[jsx("td",{className:"px-3 py-2 align-middle",children:a}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:r}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:s}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:n}),jsx("td",{className:cn$1("px-3 py-2 text-right align-middle font-medium",i.isPositive===void 0?"text-default-400":i.isPositive?"text-bullish":"text-bearish"),children:jsxs("div",{className:"flex flex-col items-end leading-tight",children:[jsx("span",{children:i.amount}),i.ratio?jsx("span",{className:"text-[10px]",children:i.ratio}):null]})}),jsx("td",{className:"px-3 py-2 text-right align-middle",children:o?o(e):jsx("span",{className:"text-default-400",children:"--"})})]})}function Mp(e,t){let o=t==="usd"?e.buyVolumesInUsd:e.buyVolumes,r=t==="usd"?e.sellVolumesInUsd:e.sellVolumes,s=t==="usd"?e.amountInUsd:e.amount,n=e.totalProfitInUsd,i=t==="usd"?formatAmountUSDCompact(o??0):formatAmount(o??0),a=t==="usd"?formatAmountUSDCompact(r??0):formatAmount(r??0),l=t==="usd"?formatAmountUSDCompact(s??0):formatAmount(s??0),d=n?new SafeBigNumber(n):void 0,m=d?d.gte(0):void 0,c=d?(m?"+":"")+formatAmountUSDCompact(d.toString()):"--",p=e.totalProfitRatio?formatPercent(e.totalProfitRatio,{showPlusGtThanZero:true}):void 0;return {bought:i,sold:a,remaining:l,pnl:{amount:c,ratio:p,isPositive:m}}}function ki({chain:e,wallet:t,limit:o=50,initialShowHidden:r=false}){let[s,n]=useState(void 0),[i,a]=useState([]),[l,d]=useState(r);useEffect(()=>{n(void 0),a([]);},[e,t]);let m=useMemo(()=>({chain:e,address:t??"",cursor:s,limit:o,positionState:"open"}),[e,t,s,o]),{data:c,isPending:p,isFetching:u}=useWalletTokenPositionsQuery(m,{enabled:!!t});useEffect(()=>{c&&a(h=>s==null?[c]:h[h.length-1]?.endCursor===c.endCursor?h:[...h,c]);},[c,s]);let g=useMemo(()=>i.flatMap(h=>h.portfolios),[i]),f=i[i.length-1],x=!!(f?.hasNext&&f.endCursor),k=useCallback(()=>{!f?.endCursor||!f.hasNext||n(f.endCursor);},[f]);return {positions:g,isLoading:!!t&&(p||u),hasMore:x,loadMore:k,showHidden:l,setShowHidden:d}}function qC({chain:e,wallet:t,limit:o,initialCurrency:r="usd",nativeSymbol:s,renderActions:n,className:i}){let[a,l]=useState(r),{positions:d,isLoading:m,hasMore:c,loadMore:p,showHidden:u,setShowHidden:g}=ki({chain:e,wallet:t,limit:o});return jsx(fi,{className:i,positions:d,isLoading:m,hasMore:c,onLoadMore:p,currency:a,onCurrencyChange:l,showHidden:u,onShowHiddenChange:g,nativeSymbol:s,renderActions:n})}function bi({orders:e,isLoading:t,unavailable:o,hasMore:r,onLoadMore:s,stateFilter:n,onStateFilterChange:i,onlyThisToken:a=false,onOnlyThisTokenChange:l,tokenSymbol:d,currency:m="usd",onCurrencyChange:c,nativeSymbol:p="Native",onCancelAll:u,renderActions:g,className:f}){return jsxs("div",{className:cn$1("flex flex-col",f),children:[jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 px-3 py-2",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"flex h-[24px] items-center rounded bg-default-100 p-[2px] text-[11px]",children:[{k:"active",label:"Active Orders"},{k:"history",label:"Order History"}].map(x=>jsx("button",{type:"button",onClick:()=>i(x.k),className:cn$1("rounded px-2 transition-colors",n===x.k?"bg-default-200 text-foreground":"text-default-400 hover:text-foreground"),children:x.label},x.k))}),d?jsxs("label",{className:"flex cursor-pointer items-center gap-1 text-[11px] text-default-400",children:[jsx("input",{type:"checkbox",className:"size-3 accent-primary",checked:a,onChange:x=>l?.(x.target.checked)}),"Only ",d]}):null]}),jsxs("div",{className:"flex items-center gap-2",children:[u?jsx("button",{type:"button",onClick:u,className:"rounded px-2 py-1 text-[11px] text-bearish transition-colors hover:bg-default-100",children:"Cancel All"}):null,jsx(_p,{value:m,nativeSymbol:p,onChange:c})]})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[760px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-default-400",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[22%] px-3 py-2 text-left font-normal",children:"Token"}),jsx("th",{className:"w-[10%] px-3 py-2 text-left font-normal",children:"Type"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"Amount"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"Current MC"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"Target MC"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"Settings"}),jsx("th",{className:"w-[12%] px-3 py-2 text-right font-normal",children:"Action"})]})}),jsxs("tbody",{children:[o?jsx("tr",{children:jsx("td",{colSpan:7,className:"py-10 text-center text-default-400",children:"Limit orders are coming soon."})}):e.length===0&&!t?jsx("tr",{children:jsxs("td",{colSpan:7,className:"py-10 text-center text-default-400",children:["No ",n==="active"?"active":"historical"," orders"]})}):e.map(x=>jsx($p,{order:x,currency:m,renderActions:g},x.id)),t&&!o&&jsx("tr",{children:jsx("td",{colSpan:7,className:"py-4 text-center text-default-400",children:"Loading\u2026"})})]})]})}),!o&&r&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:s,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-default-600 transition-colors hover:bg-default-200 disabled:opacity-50",children:"Load more"})})]})}function _p({value:e,nativeSymbol:t,onChange:o}){return jsx("div",{className:"flex h-[24px] items-center rounded bg-default-100 p-[2px] text-[11px]",children:[{k:"usd",label:"USD"},{k:"native",label:t}].map(s=>jsx("button",{type:"button",onClick:()=>o?.(s.k),className:cn$1("rounded px-2 transition-colors",e===s.k?"bg-default-200 text-foreground":"text-default-400 hover:text-foreground"),children:s.label},s.k))})}function $p({order:e,currency:t,renderActions:o}){let r=useMemo(()=>t==="usd"&&e.amountInUsd?formatAmountUSDCompact(e.amountInUsd):formatAmount(e.amount),[t,e.amount,e.amountInUsd]),s=e.side==="buy"?"Buy":"Sell",n=e.side==="buy"?"text-bullish":"text-bearish";return jsxs("tr",{className:"border-b border-default-50 hover:bg-default-50/60",children:[jsx("td",{className:"px-3 py-2 align-middle",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx(Avatar,{src:e.tokenImage??void 0,name:(e.tokenSymbol??"?").slice(0,1),className:"size-5 shrink-0 rounded-full bg-default-200 text-[10px]",showFallback:true}),jsx("span",{className:"truncate text-foreground",children:e.tokenSymbol??"--"})]})}),jsx("td",{className:cn$1("px-3 py-2 align-middle font-medium",n),children:s}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:r}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-500",children:e.currentMarketCapInUsd?formatAmountUSDCompact(e.currentMarketCapInUsd):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:e.targetMarketCapInUsd?formatAmountUSDCompact(e.targetMarketCapInUsd):e.targetPriceInUsd?formatAmountUSDCompact(e.targetPriceInUsd):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:e.slippage!=null?`Slip ${e.slippage}%`:"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle",children:o?o(e):jsx("span",{className:"text-default-400",children:"--"})})]})}function zp(e){return e instanceof Error&&e.code==="NotImplemented"}function qp(e){return e==="active"?"active":"filled"}function vi({chain:e,wallet:t,tokenAddress:o,limit:r=50,initialStateFilter:s="active",initialOnlyThisToken:n=false}){let[i,a]=useState(s),[l,d]=useState(n),[m,c]=useState(void 0),[p,u]=useState([]);useEffect(()=>{c(void 0),u([]);},[e,t,i,l,o]);let g=useCallback(H=>{H!==i&&a(H);},[i]),f=useMemo(()=>({chain:e,address:t??"",cursor:m,limit:r,state:qp(i),tokenAddress:l?o:void 0}),[e,t,m,r,i,l,o]),{data:x,isPending:k,isFetching:h,error:b}=useWalletLimitOrdersQuery(f,{enabled:!!t});useEffect(()=>{x&&u(H=>m==null?[x]:H[H.length-1]?.endCursor===x.endCursor?H:[...H,x]);},[x,m]);let T=!!b&&zp(b),N=useMemo(()=>p.flatMap(H=>H.data),[p]),y=p[p.length-1],P=!!(y?.hasNext&&y.endCursor),L=useCallback(()=>{!y?.endCursor||!y.hasNext||c(y.endCursor);},[y]);return {orders:N,isLoading:!!t&&!T&&(k||h),unavailable:T,hasMore:P,loadMore:L,stateFilter:i,setStateFilter:g,onlyThisToken:l,setOnlyThisToken:d}}function cw({chain:e,wallet:t,tokenAddress:o,tokenSymbol:r,limit:s,initialStateFilter:n="active",initialCurrency:i="usd",nativeSymbol:a,onCancelAll:l,renderActions:d,className:m}){let[c,p]=useState(i),{orders:u,isLoading:g,unavailable:f,hasMore:x,loadMore:k,stateFilter:h,setStateFilter:b,onlyThisToken:T,setOnlyThisToken:N}=vi({chain:e,wallet:t,tokenAddress:o,limit:s,initialStateFilter:n});return jsx(bi,{className:m,orders:u,isLoading:g,unavailable:f,hasMore:x,onLoadMore:k,stateFilter:h,onStateFilterChange:b,onlyThisToken:T,onOnlyThisTokenChange:N,tokenSymbol:r,currency:c,onCurrencyChange:p,nativeSymbol:a,onCancelAll:f?void 0:l,renderActions:d})}function Si({traders:e,isLoading:t,hasMore:o,onLoadMore:r,onlyTracked:s=false,onOnlyTrackedChange:n,now:i=Date.now(),renderAddress:a,className:l}){let{t:d}=useTranslation();return jsxs("div",{className:cn$1("flex flex-col",l),children:[jsxs("div",{className:"flex items-center justify-between gap-4 px-3 py-2",children:[jsx("span",{className:"text-xs font-medium text-default-500",children:d("tokens.tokenDetail.topTraders")}),jsxs("label",{className:"flex cursor-pointer items-center gap-1 text-[11px] text-default-400",children:[jsx("input",{type:"checkbox",className:"size-3 accent-primary",checked:s,onChange:m=>n?.(m.target.checked)}),"Only Tracked"]})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[680px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-default-400",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[28%] px-3 py-2 text-left font-normal",children:"Wallet"}),jsx("th",{className:"w-[20%] px-3 py-2 text-left font-normal",children:"Tags"}),jsx("th",{className:"w-[15%] px-3 py-2 text-right font-normal",children:"Value"}),jsx("th",{className:"w-[10%] px-3 py-2 text-right font-normal",children:"%"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"Realized PnL"}),jsx("th",{className:"w-[13%] px-3 py-2 text-right font-normal",children:"Last active"})]})}),jsxs("tbody",{children:[e.length===0&&!t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-8 text-center text-default-400",children:"No top traders yet"})}),e.map(m=>jsx(Zp,{trader:m,now:i,renderAddress:a},m.address)),t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-4 text-center text-default-400",children:"Loading\u2026"})})]})]})}),o&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:r,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-default-600 transition-colors hover:bg-default-200 disabled:opacity-50",children:"Load more"})})]})}function Zp({trader:e,now:t,renderAddress:o}){let r=useMemo(()=>o?o(e.address):jsx("span",{className:"font-mono text-[11px] text-default-500",children:ke(e.address,6,6)}),[e.address,o]);return jsxs("tr",{className:"border-b border-default-50 hover:bg-default-50/60",children:[jsx("td",{className:"px-3 py-2 align-middle",children:r}),jsx("td",{className:"px-3 py-2 align-middle",children:jsx(Dt,{tags:e.tags,max:3})}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:formatAmountUSDCompact(e.amountInUsd)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-500",children:"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:formatAmountUSDCompact(e.totalRealizedPnlInUsd)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:e.lastActiveAt?Pe(e.lastActiveAt,t):"--"})]})}function wi({chain:e,address:t,limit:o=50,initialSortBy:r,initialOnlyTracked:s=false}){let[n,i]=useState(r),[a,l]=useState(void 0),[d,m]=useState([]),[c,p]=useState(s),u=useCallback(()=>{l(void 0),m([]);},[]),g=useCallback(L=>{L!==n&&(i(L),u());},[u,n]);useEffect(()=>{u();},[e,t,u]);let f=useMemo(()=>({chain:e,address:t,cursor:a,limit:o,sortBy:n}),[e,t,a,o,n]),{data:x,isPending:k,isFetching:h}=useTokenTopTradersQuery(f);useEffect(()=>{x&&m(L=>a==null?[x]:L[L.length-1]?.endCursor===x.endCursor?L:[...L,x]);},[x,a]);let b=useMemo(()=>d.flatMap(L=>L.data),[d]),T=useMemo(()=>c?b.filter(L=>L.tags&&L.tags.length>0):b,[b,c]),N=d[d.length-1],y=!!(N?.hasNext&&N.endCursor),P=useCallback(()=>{!N?.endCursor||!N.hasNext||l(N.endCursor);},[N]);return {traders:T,isLoading:k||h,sortBy:n,setSortBy:g,hasMore:y,loadMore:P,onlyTracked:c,setOnlyTracked:p}}function Aw({chain:e,address:t,limit:o,className:r,renderAddress:s}){let{traders:n,isLoading:i,hasMore:a,loadMore:l,onlyTracked:d,setOnlyTracked:m}=wi({chain:e,address:t,limit:o});return jsx(Si,{className:r,traders:n,isLoading:i,hasMore:a,onLoadMore:l,onlyTracked:d,onOnlyTrackedChange:m,renderAddress:s})}function Pi({tokens:e,isLoading:t,unavailable:o,hasMore:r,onLoadMore:s,renderTokenLink:n,className:i}){return jsxs("div",{className:cn$1("flex flex-col",i),children:[jsx("div",{className:"flex items-center justify-between gap-4 px-3 py-2",children:jsx("span",{className:"text-xs font-medium text-default-500",children:"Dev Tokens"})}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[700px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-default-400",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[28%] px-3 py-2 text-left font-normal",children:"Token"}),jsx("th",{className:"w-[10%] px-3 py-2 text-center font-normal",children:"Migrated"}),jsx("th",{className:"w-[16%] px-3 py-2 text-right font-normal",children:"Market Cap"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"ATH"}),jsx("th",{className:"w-[16%] px-3 py-2 text-right font-normal",children:"Liquidity"}),jsx("th",{className:"w-[16%] px-3 py-2 text-right font-normal",children:"1h Volume"})]})}),jsxs("tbody",{children:[o?jsx("tr",{children:jsx("td",{colSpan:6,className:"py-10 text-center text-default-400",children:"Dev tokens index is coming soon."})}):e.length===0&&!t?jsx("tr",{children:jsx("td",{colSpan:6,className:"py-8 text-center text-default-400",children:"No dev tokens"})}):e.map(a=>jsx(ou,{token:a,renderTokenLink:n},`${a.chain}:${a.address}`)),!o&&t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-4 text-center text-default-400",children:"Loading\u2026"})})]})]})}),!o&&r&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:s,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-default-600 transition-colors hover:bg-default-200 disabled:opacity-50",children:"Load more"})})]})}function ou({token:e,renderTokenLink:t}){let o=e.marketData?.marketCapInUsd??e.marketData?.marketCap,r=e.marketData?.tvlInUsd,n=e.stats?.["1h"]?.volumesInUsd,i=!!e.migratedTo,a=t?t(e):jsxs("div",{className:"flex items-center gap-2",children:[jsx(Avatar,{src:e.image??void 0,name:(e.symbol??e.name??"?").slice(0,1),className:"size-5 shrink-0 rounded-full bg-default-200 text-[10px]",showFallback:true}),jsxs("div",{className:"flex min-w-0 flex-col",children:[jsx("span",{className:"truncate text-foreground",children:e.symbol}),jsx("span",{className:"truncate text-[10px] text-default-400",children:e.name})]})]});return jsxs("tr",{className:"border-b border-default-50 hover:bg-default-50/60",children:[jsx("td",{className:"px-3 py-2 align-middle",children:a}),jsx("td",{className:"px-3 py-2 text-center align-middle",children:i?jsx("span",{className:"text-bullish",children:"\u2713"}):jsx("span",{className:"text-default-400",children:"\u2014"})}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:o?formatAmountUSDCompact(o):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:r?formatAmountUSDCompact(r):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:n?formatAmountUSDCompact(n):"--"})]})}function Ri({tokens:e,className:t}){let o=e.length,r=e.filter(a=>!!a.migratedTo).length,s=o===0?0:Math.round(r/o*100),n=e.map(a=>a.stats?.["1h"]?.volumesInUsd??"0").reduce((a,l)=>a.plus(new SafeBigNumber(l)),new SafeBigNumber(0)),i=e.map(a=>a.marketData?.marketCapInUsd??a.marketData?.marketCap??"0").reduce((a,l)=>a.plus(new SafeBigNumber(l)),new SafeBigNumber(0));return jsxs("div",{className:cn$1("flex flex-col gap-2 p-3",t),children:[jsx("div",{className:"flex items-center justify-between",children:jsx("span",{className:"text-xs font-medium text-default-500",children:"Token Stats"})}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsx(po,{label:"Total",value:String(o)}),jsx(po,{label:"Migrated",value:`${r} (${s}%)`}),jsx(po,{label:"Total Market Cap",value:formatAmountUSDCompact(i.toString())}),jsx(po,{label:"Total 1h Volume",value:formatAmountUSDCompact(n.toString())})]})]})}function po({label:e,value:t}){return jsxs("div",{className:"flex flex-col gap-[2px]",children:[jsx("span",{className:"text-[10px] text-default-400",children:e}),jsx("span",{className:"text-[13px] font-medium text-foreground",children:t})]})}function su(e){return e instanceof Error&&e.code==="NotImplemented"}function Fi({chain:e,creator:t,limit:o=20}){let[r,s]=useState(void 0),[n,i]=useState([]);useEffect(()=>{s(void 0),i([]);},[e,t]);let a=useMemo(()=>({chain:e,creator:t??"",cursor:r,limit:o}),[e,t,r,o]),{data:l,isPending:d,isFetching:m,error:c}=useTokensByCreatorQuery(a,{enabled:!!t});useEffect(()=>{l&&i(k=>r==null?[l]:k[k.length-1]?.endCursor===l.endCursor?k:[...k,l]);},[l,r]);let p=!!c&&su(c),u=useMemo(()=>n.flatMap(k=>k.data),[n]),g=n[n.length-1],f=!!(g?.hasNext&&g.endCursor),x=useCallback(()=>{!g?.endCursor||!g.hasNext||s(g.endCursor);},[g]);return {tokens:u,isLoading:!!t&&!p&&(d||m),unavailable:p,hasMore:f,loadMore:x}}function qw({chain:e,creator:t,limit:o,showSummary:r=false,renderTokenLink:s,className:n}){let{tokens:i,isLoading:a,unavailable:l,hasMore:d,loadMore:m}=Fi({chain:e,creator:t,limit:o});return jsxs("div",{className:n,children:[jsx(Pi,{tokens:i,isLoading:a,unavailable:l,hasMore:d,onLoadMore:m,renderTokenLink:s}),r&&!l?jsx(Ri,{tokens:i}):null]})}function Oi({token:e,athInUsd:t,athAt:o,globalFeesPaidInUsd:r,rank:s,onTogglePin:n,pinned:i,className:a}){let l=e?.marketData?.priceInUsd,d=e?.marketData?.tvlInUsd,m=e?.marketData?.totalSupply;return jsxs("div",{className:cn$1("flex h-[48px] w-full flex-row items-center gap-4 overflow-x-auto px-3 text-[12px]",a),children:[jsx(lt,{label:"Price",value:l?formatPriceUSD(l):"--"}),jsx(lt,{label:"Liquidity",value:d?formatAmountUSDCompact(d):"--"}),jsx(lt,{label:"Supply",value:m?formatAmount(m):"--"}),r?jsx(lt,{label:"Fees Paid",value:formatAmountUSDCompact(r)}):null,t?jsx(lt,{label:"ATH",value:formatAmountUSDCompact(t),title:o?`All-time high at ${o.toLocaleDateString()}`:void 0}):null,s!==void 0?jsx(lt,{label:"Rank",value:`#${s}`}):null,jsx("div",{className:"flex-1"}),n?jsx("button",{type:"button",onClick:n,"aria-pressed":i,className:cn$1("flex size-[26px] items-center justify-center rounded text-default-400 transition-colors hover:bg-default-100 hover:text-foreground",i&&"text-foreground"),title:i?"Unpin token":"Pin token",children:i?"\u2605":"\u2606"}):null]})}function lt({label:e,value:t,title:o}){return jsxs("div",{className:"flex flex-col items-start justify-center gap-[2px] whitespace-nowrap",title:o,children:[jsx("span",{className:"text-[10px] leading-none text-default-400",children:e}),jsx("span",{className:"text-[13px] font-medium leading-none tabular-nums text-foreground",children:t})]})}function Bi({chain:e,address:t}){return U(e,t)}function aL({chain:e,address:t,athInUsd:o,athAt:r,globalFeesPaidInUsd:s,rank:n,pinned:i,onTogglePin:a,className:l}){let{token:d}=Bi({chain:e,address:t});return jsx(Oi,{className:l,token:d,athInUsd:o,athAt:r,globalFeesPaidInUsd:s,rank:n,pinned:i,onTogglePin:a})}function Ei({tokens:e,isLoading:t,unavailable:o,onTokenClick:r,className:s}){return o?jsx("div",{className:cn$1("flex items-center justify-center p-4 text-center text-[11px] text-default-400",s),children:"Similar tokens coming soon."}):!t&&e.length===0?jsx("div",{className:cn$1("flex items-center justify-center p-4 text-center text-[11px] text-default-400",s),children:"No similar tokens found."}):jsxs("ul",{className:cn$1("flex flex-col",s),children:[e.map(n=>jsxs("li",{className:cn$1("flex cursor-pointer items-center gap-2 border-b border-default-50 px-3 py-2 last:border-0 hover:bg-default-50/60",!r&&"cursor-default"),onClick:r?()=>r(n):void 0,children:[jsx(Avatar,{src:n.image??void 0,name:(n.symbol??"?").slice(0,1),className:"size-5 shrink-0 rounded-full bg-default-200 text-[10px]",showFallback:true}),jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[jsx("span",{className:"truncate text-[12px] text-foreground",children:n.symbol}),jsx("span",{className:"truncate text-[10px] text-default-400",children:n.name})]}),jsx("span",{className:"text-[11px] tabular-nums text-default-500",children:n.marketData?.marketCapInUsd?formatAmountUSDCompact(n.marketData.marketCapInUsd):"--"})]},`${n.chain}:${n.address}`)),t&&jsx("li",{className:"py-2 text-center text-[11px] text-default-400",children:"Loading\u2026"})]})}function Wi({chain:e,address:t,keyword:o,limit:r=10}){let s=!!o&&o.length>0,{data:n,isPending:i,isFetching:a}=useSearchTokensQuery({chains:[e],keyword:o,limit:r+1},{enabled:s});return {tokens:useMemo(()=>{if(!n)return [];let d=t.toLowerCase();return (n.data??[]).filter(m=>m.address.toLowerCase()!==d).slice(0,r)},[n,t,r]),isLoading:s&&(i||a),unavailable:!s}}function NL({chain:e,address:t,keyword:o,limit:r,onTokenClick:s,className:n}){let{tokens:i,isLoading:a,unavailable:l}=Wi({chain:e,address:t,keyword:o,limit:r});return jsx(Ei,{className:n,tokens:i,isLoading:a,unavailable:l,onTokenClick:s})}function Vi({tokens:e=[],unavailable:t=true,onTokenClick:o,className:r}){return t?jsx("div",{className:cn$1("flex items-center justify-center p-4 text-center text-[11px] text-default-400",r),children:"Image-similarity search is coming soon."}):e.length===0?jsx("div",{className:cn$1("flex items-center justify-center p-4 text-center text-[11px] text-default-400",r),children:"No reused-image tokens found."}):jsx("div",{className:cn$1("flex flex-row flex-wrap gap-2 p-3",r),children:e.map(s=>jsx("button",{type:"button",onClick:o?()=>o(s):void 0,className:"flex size-10 items-center justify-center overflow-hidden rounded-full border border-default-100 transition-opacity hover:opacity-80",title:s.symbol,children:jsx(Avatar,{src:s.image??void 0,name:(s.symbol??"?").slice(0,1),className:"size-full bg-default-100 text-[10px] text-default-400",showFallback:true})},`${s.chain}:${s.address}`))})}function _i(e){return {tokens:[],isLoading:false,unavailable:true}}function OL({chain:e,address:t,onTokenClick:o,className:r}){let{tokens:s,unavailable:n}=_i();return jsx(Vi,{className:r,tokens:s,unavailable:n,onTokenClick:o})}function Qi({keywords:e,excludeKeywords:t,onKeywordsChange:o,onExcludeKeywordsChange:r,className:s}){let{t:n}=useTranslation(),[i,a]=useState(e?.join(", ")??""),[l,d]=useState(t?.join(", ")??"");useEffect(()=>{a(p=>{let u=fo(p);return u===void 0&&e===void 0?p:u===void 0?e?.join(", ")??"":e===void 0?"":u.join("")===e.join("")?p:e.join(", ")});},[e]),useEffect(()=>{d(p=>{let u=fo(p);return u===void 0&&t===void 0?p:u===void 0?t?.join(", ")??"":t===void 0?"":u.join("")===t.join("")?p:t.join(", ")});},[t]);let m=useCallback(p=>{a(p),o?.(fo(p));},[o]),c=useCallback(p=>{d(p),r?.(fo(p));},[r]);return jsxs("div",{className:cn$1("grid grid-cols-2 gap-3 px-4",s),children:[jsxs("div",{className:"flex flex-col gap-3",children:[jsx("h3",{className:"text-xs text-neutral",children:n("tokens.filters.keywords.title")}),jsx(StyledInput,{variant:"bordered",radius:"lg",size:"sm",placeholder:n("tokens.filters.keywords.placeholder"),value:i,onValueChange:m})]}),jsxs("div",{className:"flex flex-col gap-3",children:[jsx("h3",{className:"text-xs text-neutral",children:n("tokens.filters.keywords.exclude.title")}),jsx(StyledInput,{variant:"bordered",radius:"lg",size:"sm",placeholder:n("tokens.filters.keywords.placeholder"),value:l,onValueChange:c})]})]})}function fo(e){let t=e.split(",").map(o=>o.trim()).filter(Boolean);return t.length>0?t:void 0}function ji({protocols:e,selectedProtocols:t=[],onSelectedProtocolsChange:o,className:r}){let{t:s}=useTranslation(),[n,i]=useState(t);useEffect(()=>{i(t);},[t]);let a=useMemo(()=>e.every(m=>n.includes(m)),[e,n]),l=useCallback(()=>{if(a){let m=[];i(m),o?.(m);}else {let m=[...e];i(m),o?.(m);}},[e,o,a]),d=useCallback(m=>()=>{if(n.includes(m)){let c=n.filter(p=>p!==m);i(c),o?.(c);}else {let c=[...n,m];i(c),o?.(c);}},[n,o]);return jsxs("div",{className:cn$1("flex flex-col gap-3 px-4",r),children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("h3",{className:"text-xs text-neutral",children:s("tokens.filters.protocols.title")}),jsx(Button,{variant:"light",color:"default",size:"sm",radius:"full",onPress:l,children:s(a?"tokens.filters.protocols.unselectAll":"tokens.filters.protocols.selectAll")})]}),jsx("div",{className:"grid grid-cols-3 gap-3",children:e.map(m=>{let c=Oe(m);return jsx(Button,{variant:"bordered",size:"sm",radius:"full",className:cn$1("w-fit h-6 px-2.5",c.text,c.bg5,"border",c.border,{"opacity-40 data-[hover=true]:!opacity-30":!n.includes(m)}),startContent:jsx(Image,{width:14,height:14,src:`/images/protocols/${m}.svg`,alt:formatTokenProtocolName(m)}),onPress:d(m),children:formatTokenProtocolName(m)},m)})})]})}function ye({title:e,field:t,value:o,onChange:r}){let{t:s}=useTranslation(),[n,i]=useState(o?kr(o).min:NaN),[a,l]=useState(o?kr(o).max:NaN);useEffect(()=>{if(o===void 0)i(NaN),l(NaN);else {let{min:c,max:p}=kr(o);i(c),l(p);}},[o]);let d=useCallback(c=>{i(c),r?.(ra(t,c,a));},[t,r,a]),m=useCallback(c=>{l(c),r?.(ra(t,n,c));},[t,r,n]);return jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsx("h3",{className:"text-xs text-neutral",children:e}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsx(StyledNumberInput,{value:n,onValueChange:d,variant:"bordered",radius:"lg",size:"sm",placeholder:s("tokens.filters.stats.min"),"aria-label":`${e} min`}),jsx(StyledNumberInput,{value:a,onValueChange:m,variant:"bordered",radius:"lg",size:"sm",placeholder:s("tokens.filters.stats.max"),"aria-label":`${e} max`})]})]})}function kr(e){if(e.operator==="between"){let[t,o]=e.value;return {min:t,max:o}}return e.operator==="gte"?{min:e.value,max:NaN}:e.operator==="lte"?{min:NaN,max:e.value}:{min:NaN,max:NaN}}function ra(e,t,o){if(!(isNaN(t)&&isNaN(o)))return isNaN(t)?{field:e,operator:"lte",value:o}:isNaN(o)?{field:e,operator:"gte",value:t}:{field:e,operator:"between",value:[t,o]}}function sa({values:e,onValuesChange:t,className:o}){let{t:r}=useTranslation(),[s,n]=useState(e);useEffect(()=>{n(e);},[e]);let i=useCallback(a=>l=>{if(l===void 0){let d=(s??[]).filter(m=>m.field!==a);d=d.length>0?d:void 0,n(d),t?.(d);}else {let d=[...(s??[]).filter(m=>m.field!==a),l];n(d),t?.(d);}},[s,t]);return jsxs("div",{className:cn$1("flex flex-col gap-4",o),children:[jsx(ye,{field:"holders",title:r("tokens.filters.stats.audits.holders"),value:s?.find(a=>a.field==="holders"),onChange:i("holders")}),jsx(ye,{field:"top10Ratio",title:r("tokens.filters.stats.audits.top10HoldingsRatio"),value:s?.find(a=>a.field==="top10Ratio"),onChange:i("top10Ratio")}),jsx(ye,{field:"top100Ratio",title:r("tokens.filters.stats.audits.top100HoldingsRatio"),value:s?.find(a=>a.field==="top100Ratio"),onChange:i("top100Ratio")}),jsx(ye,{field:"creatorsRatio",title:r("tokens.filters.stats.audits.devHoldingsRatio"),value:s?.find(a=>a.field==="creatorsRatio"),onChange:i("creatorsRatio")})]})}function ia({resolution:e,values:t,onValuesChange:o,className:r}){let{t:s}=useTranslation(),[n,i]=useState(t);useEffect(()=>{i(t);},[t]);let a=useCallback(l=>d=>{if(d===void 0){let m=(n??[]).filter(c=>c.field!==l);m=m.length>0?m:void 0,i(m),o?.(m);}else {let m=[...(n??[]).filter(c=>c.field!==l),d];i(m),o?.(m);}},[n,o]);return jsxs("div",{className:cn$1("flex flex-col gap-4",r),children:[jsx(ye,{field:"marketCap",title:s("tokens.filters.stats.metrics.marketCap"),value:n?.find(l=>l.field==="marketCap"),onChange:a("marketCap")}),jsx(ye,{field:"tvl",title:s("tokens.filters.stats.metrics.liquidity"),value:n?.find(l=>l.field==="tvl"),onChange:a("tvl")}),jsx(ye,{field:`volumes${e}`,title:s("tokens.filters.stats.metrics.volumes",{resolution:s(`common.resolution.${e}`)}),value:n?.find(l=>l.field===`volumes${e}`),onChange:a(`volumes${e}`)}),jsx(ye,{field:`trades${e}`,title:s("tokens.filters.stats.metrics.txns",{resolution:s(`common.resolution.${e}`)}),value:n?.find(l=>l.field===`trades${e}`),onChange:a(`trades${e}`)})]})}function pa({resolution:e,values:t,onValuesChange:o,className:r}){let{t:s}=useTranslation(),[n,i]=useState("audits"),[a,l]=useState(t);useEffect(()=>{l(t);},[t]);let d=useCallback(p=>{l(p),o?.(p);},[o]),m=useMemo(()=>{let p=["holders","top10Ratio","top100Ratio","creatorsRatio"];return a?.filter(u=>p.includes(u.field))?.length??0},[a]),c=useMemo(()=>{let p=["marketCap","tvl",`volumes${e}`,`trades${e}`];return a?.filter(u=>p.includes(u.field)).length??0},[a,e]);return jsxs("div",{className:cn$1("flex flex-col gap-3 px-4",r),children:[jsxs(StyledLightTabs,{color:"default",radius:"full",size:"sm",selectedKey:n,onSelectionChange:i,children:[jsx(Tab,{title:m===0?s("tokens.filters.stats.audits"):jsx(StyledBadge,{color:"primary",size:"sm",content:m,shape:"circle",children:s("tokens.filters.stats.audits")})},"audits"),jsx(Tab,{title:c===0?s("tokens.filters.stats.metrics"):jsx(StyledBadge,{color:"primary",size:"sm",content:c,shape:"circle",children:s("tokens.filters.stats.metrics")})},"metrics")]}),jsx(sa,{values:a,onValuesChange:d,className:cn$1({hidden:n!=="audits"})}),jsx(ia,{values:a,onValuesChange:d,resolution:e,className:cn$1({hidden:n!=="metrics"})})]})}function vo({protocols:e,resolution:t,filters:o,onFiltersChange:r,className:s}){let[n,i]=useState(ua(o?.filters,e));useEffect(()=>{i(ua(o?.filters,e));},[o?.filters,e]);let[a,l]=useState(o?.keywords);useEffect(()=>{l(o?.keywords);},[o?.keywords]);let[d,m]=useState(o?.excludeKeywords);useEffect(()=>{m(o?.excludeKeywords);},[o?.excludeKeywords]);let[c,p]=useState(o?.filters);useEffect(()=>{p(o?.filters);},[o?.filters]);let u=useCallback(k=>{i(k),r?.(yo(e,k,a,d,c));},[e,a,d,c,r]),g=useCallback(k=>{l(k),r?.(yo(e,n,k,d,c));},[e,n,d,c,r]),f=useCallback(k=>{m(k),r?.(yo(e,n,a,k,c));},[e,n,a,c,r]),x=useCallback(k=>{p(k),r?.(yo(e,n,a,d,k));},[e,n,a,d,r]);return jsxs("div",{className:cn$1("flex flex-col gap-4",s),children:[e&&e.length>0&&jsxs(Fragment,{children:[jsx(ji,{protocols:e,selectedProtocols:n,onSelectedProtocolsChange:u}),jsx("div",{style:{height:1,background:"rgba(39,39,42,1)"}})]}),jsx(Qi,{keywords:a,excludeKeywords:d,onKeywordsChange:g,onExcludeKeywordsChange:f}),jsx("div",{style:{height:1,background:"rgba(39,39,42,1)"}}),jsx(pa,{resolution:t,values:c,onValuesChange:x})]})}function ua(e,t){let o=e?.find(r=>r.field==="launchedFromProtocolFamily");return o?o.operator==="in"?o.value:(console.warn("invalid token protocols filter",o),[...t||[]]):[...t||[]]}function yo(e,t,o,r,s){let n=s?[...s.filter(i=>i.field!=="launchedFromProtocolFamily")]:[];return e&&e.length>0&&(e.every(a=>t.includes(a))||n.push({field:"launchedFromProtocolFamily",operator:"in",value:t})),o===void 0&&r===void 0&&n.length===0?void 0:{keywords:o,excludeKeywords:r,filters:n.length>0?n:void 0}}function ka({protocols:e,resolution:t,filters:o,onFiltersChange:r,triggerVariant:s="default",badgePlacement:n="outer",className:i}){let{t:a}=useTranslation(),{isOpen:l,onOpen:d,onClose:m,onOpenChange:c}=useDisclosure(),[p,u]=useState(o),g=useCallback(()=>{u(void 0);},[]),f=useCallback(()=>{r?.(p),m();},[p,r,m]);useEffect(()=>{u(o);},[l,o]);let x=useMemo(()=>Object.values(o||{}).every(k=>k===void 0),[o]);return jsxs(Fragment,{children:[jsxs("button",{type:"button",className:i,onClick:d,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:9999,border:s==="plain"?"none":"1px solid rgba(63,63,70,0.5)",background:s==="plain"?"transparent":"rgba(39,39,42,0.6)",width:32,height:32,minHeight:32,padding:0,cursor:"pointer",position:"relative"},children:[jsx(FilterIcon,{width:16,height:16,className:"text-zinc-400"}),!x&&jsx("span",{style:{position:"absolute",top:n==="icon"?6:-2,right:n==="icon"?6:-2,width:8,height:8,borderRadius:4,background:"#c7ff2e"}})]}),jsx(StyledModal,{isOpen:l,onOpenChange:c,size:"md",scrollBehavior:"inside",children:jsxs(ModalContent,{className:"w-full h-full",children:[jsx(ModalHeader,{className:"px-4 py-2",children:jsx("span",{className:"text-base font-semibold",children:a("tokens.filters.modal.title")})}),jsx(ModalBody,{className:"px-0 pt-0 pb-4",children:jsx(ScrollShadow,{children:jsx(vo,{protocols:e,resolution:t,filters:p,onFiltersChange:u,className:"pb-4"})})}),jsx(ModalFooter,{className:"px-4",children:jsxs("div",{className:"w-full flex justify-between items-center",children:[jsx(Button,{variant:"light",color:"default",size:"sm",radius:"full",startContent:jsx(RefreshIcon,{width:16,height:16}),onPress:g,children:a("common.reset")}),jsx(Button,{color:"primary",size:"sm",radius:"full",onPress:f,children:a("common.apply")})]})})]})})]})}var ya={display:"inline-flex",alignItems:"center",gap:8,borderRadius:9999,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"6px 12px",fontSize:14,fontWeight:700,color:"#d4d4d8",cursor:"pointer",transition:"all 0.15s",height:32},mf={position:"absolute",right:0,top:"100%",zIndex:20,marginTop:8,borderRadius:14,border:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"},pf={height:1,background:"rgba(39,39,42,1)",margin:0};function va({protocols:e,resolution:t,filters:o,onFiltersChange:r,iconOnly:s=false,className:n}){let{t:i}=useTranslation(),[a,l]=useState(false),d=useRef(null),[m,c]=useState(o),p=useCallback(()=>{c(void 0);},[]),u=useCallback(()=>{r?.(m),l(false);},[m,r]);useEffect(()=>{c(o);},[a,o]),useEffect(()=>{let f=x=>{d.current&&!d.current.contains(x.target)&&l(false);};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]),useEffect(()=>{if(!a)return;let f=x=>{x.key==="Escape"&&l(false);};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[a]);let g=useMemo(()=>Object.values(o||{}).every(f=>f===void 0),[o]);return jsxs("div",{ref:d,style:{position:"relative"},children:[jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxs("button",{type:"button",className:n,style:s?{...ya,justifyContent:"center",gap:0,width:32,minWidth:32,padding:0}:ya,onMouseEnter:f=>{f.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:f=>{f.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>l(f=>!f),children:[jsx(FilterIcon,{width:16,height:16,className:"flex-none"}),!s&&jsxs(Fragment,{children:[jsx("span",{className:"hidden sm:block",children:i("tokens.listHeader.filter")}),jsx(uf,{open:a})]})]}),!g&&jsx("span",{style:{position:"absolute",top:-4,right:-4,minWidth:8,height:8,borderRadius:4,background:"#c7ff2e"}})]}),a&&jsxs("div",{style:{...mf,width:420},children:[jsx("div",{style:{padding:"16px 0"},children:jsx(ScrollShadow,{className:"w-full max-h-120 px-4",children:jsx(vo,{protocols:e,resolution:t,filters:m,onFiltersChange:c})})}),jsx("div",{style:pf}),jsxs("div",{style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsx(Button,{variant:"light",size:"sm",color:"default",radius:"full",startContent:jsx(RefreshIcon,{width:16,height:16}),onPress:p,children:i("common.reset")}),jsx(Button,{variant:"solid",size:"sm",color:"primary",radius:"full",onPress:u,children:i("common.apply")})]})]})]})}function uf({open:e}){return jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#71717a",transition:"transform 0.15s",transform:e?"rotate(180deg)":void 0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"m6 9 6 6 6-6"})})}function P1({popoverPlacement:e="bottom-end",iconOnly:t,className:o,desktopOverlay:r="popover",...s}){let{isMobile:n}=useScreen();return n||r==="modal"?jsx(ka,{className:o,...s}):jsx(va,{placement:e,iconOnly:t,className:o,...s})}function Ca({resolution:e,onResolutionChange:t,resolutionOptions:o=["1m","5m","1h","4h","24h"]}){let{t:r}=useTranslation(),s=useCallback(n=>{t?.(n);},[t]);return jsx(StyledPlainTabs,{color:"primary",radius:"lg",selectedKey:e,onSelectionChange:s,"aria-label":"Select Resolution",classNames:{tabList:"gap-0",tab:"px-2",tabContent:"!text-zinc-500 group-data-[hover=true]:!text-foreground group-data-[selected=true]:!text-primary"},children:o.map(n=>jsx(Tab,{title:r(`common.resolution.${n}`)},n))})}var Lf={display:"inline-flex",alignItems:"center",gap:4,borderRadius:9999,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"0 10px",fontSize:12,fontWeight:500,color:"#d4d4d8",cursor:"pointer",height:32,minHeight:32},Pf={position:"absolute",left:0,top:"100%",zIndex:20,marginTop:6,borderRadius:14,border:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden",padding:"6px",minWidth:"100%"};function La({resolution:e,onResolutionChange:t,resolutionOptions:o=["1m","5m","1h","4h","24h"]}){let{t:r}=useTranslation(),[s,n]=useState(false),i=useRef(null),a=useCallback(l=>{t?.(l),n(false);},[t]);return useEffect(()=>{if(!s)return;let l=m=>{i.current&&!i.current.contains(m.target)&&n(false);},d=m=>{m.key==="Escape"&&n(false);};return document.addEventListener("mousedown",l),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",d);}},[s]),jsxs("div",{ref:i,style:{position:"relative",zIndex:50},children:[jsxs("button",{type:"button",style:Lf,onClick:()=>n(l=>!l),children:[jsx("span",{children:e?r(`common.resolution.${e}`):"\u2014"}),jsx(ChevronDownIcon,{width:14,height:14,className:"text-zinc-500",style:{transition:"transform 0.15s",transform:s?"rotate(180deg)":void 0}})]}),s&&jsx("div",{style:Pf,children:o.map(l=>jsx("button",{type:"button",onClick:()=>a(l),className:cn$1("w-full text-left px-3 py-1.5 rounded-lg text-xs font-medium transition-colors cursor-pointer",l===e?"text-primary bg-primary/10":"text-zinc-400 hover:text-foreground hover:bg-zinc-800"),children:r(`common.resolution.${l}`)},l))})]})}function z1(e){let{isMobile:t}=useScreen();return t?jsx(La,{...e}):jsx(Ca,{...e})}var Aa=memo(function({token:t}){let{t:o}=useTranslation(),r=useMemo(()=>t.marketData?.bluechipHoldingsRatio,[t.marketData?.bluechipHoldingsRatio]),s=useMemo(()=>r!==void 0&&new SafeBigNumber(r).gte(.1),[r]),n=useMemo(()=>r===void 0||new SafeBigNumber(r).lt(.05),[r]);return jsx(StyledTooltip,{content:o("tokens.bluechip.explained"),children:jsxs("div",{className:"flex items-center gap-2.5",children:[s&&jsx(HorsePowerHighIcon,{}),n&&jsx(HorsePowerLowIcon,{}),!s&&!n&&jsx(HorsePowerIcon,{}),jsx("span",{className:cn$1(s&&"text-bullish",!s&&!n&&"text-bearish",r===void 0&&"text-neutral"),children:formatPercent(r)})]})})});function Zf(e){return e.length<=10?e:`${e.slice(0,4)}...${e.slice(-4)}`}var Da=memo(function({token:t}){let o=useCopyToClipboard(),[r,s]=useState(false),[n,i]=useState(false),a=useRef(void 0),l=useRef(void 0),{t:d}=useTranslation(),m=useCallback(u=>{u.preventDefault(),u.stopPropagation(),o(t.name,()=>{toast.success(d("tokens.copied.name")),s(true),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{s(false);},2e3);});},[o,t.name,d]),c=useCallback(u=>{u.preventDefault(),u.stopPropagation(),o(t.address,()=>{toast.success(d("tokens.copied.address")),i(true),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{i(false);},2e3);});},[o,t.address,d]);useEffect(()=>()=>{a.current&&clearTimeout(a.current),l.current&&clearTimeout(l.current);},[]);let p=useTickAge(t.createdAt);return jsxs("div",{className:"w-full flex justify-start items-center gap-3",children:[jsx(fe,{token:t,showProgress:false,className:"w-10 h-10 sm:w-16 sm:h-16 flex-none"}),jsxs("div",{className:"flex-auto flex flex-col gap-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsx("span",{className:"flex-none font-medium tracking-[-0.02em]",children:t.symbol}),jsx(StyledTooltip,{content:t.name,children:jsxs("div",{className:"flex-initial flex items-center gap-1 min-w-0 text-neutral hover:text-primary-200 cursor-pointer",onClick:m,children:[jsx("div",{className:"flex-initial whitespace-nowrap truncate",children:t.name}),r?jsx(CheckIcon,{className:"flex-none w-3 h-3 sm:w-3.5 sm:h-3.5"}):jsx(CopyIcon,{className:"flex-none w-3 h-3 sm:w-3.5 sm:h-3.5"})]})})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-primary text-xs sm:text-sm font-medium",children:formatAge(p)}),jsxs("button",{type:"button",className:"group flex items-center gap-1 min-w-0 max-w-28 sm:max-w-36 text-neutral hover:text-primary-200 cursor-pointer",onClick:c,"aria-label":d("tokens.copied.address"),children:[jsx("span",{className:"min-w-0 truncate text-left text-xs font-mono text-neutral/70 group-hover:text-primary-200",children:Zf(t.address)}),n?jsx(CheckIcon,{className:"flex-none w-3 h-3"}):jsx(CopyIcon,{className:"flex-none w-3 h-3"})]}),t.socialMedias?.website&&jsx(Link,{href:t.socialMedias.website,className:"max-sm:hidden text-neutral hover:text-primary",target:"_blank",children:jsx(WebsiteIcon,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})}),t.socialMedias?.twitter&&jsx(Link,{href:t.socialMedias.twitter,className:"max-sm:hidden text-neutral hover:text-primary",target:"_blank",children:jsx(TwitterIcon,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})}),t.socialMedias?.telegram&&jsx(Link,{href:t.socialMedias.telegram,className:"max-sm:hidden text-neutral hover:text-primary",target:"_blank",children:jsx(TelegramIcon,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})}),t.socialMedias?.discord&&jsx(Link,{href:t.socialMedias.discord,className:"max-sm:hidden text-neutral hover:text-primary",target:"_blank",children:jsx(DiscordIcon,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})}),jsx(Link,{href:searchTwitterUrl(`${t.symbol} OR ${t.address}`),className:"max-sm:hidden text-neutral hover:text-primary",target:"_blank",children:jsx(SearchIcon,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]})]})});var Ba=memo(function({token:t}){let{t:o}=useTranslation(),r=t.marketData,s=useMemo(()=>new SafeBigNumber(r?.top10HoldingsRatio).gte(.1),[r?.top10HoldingsRatio]),n=useMemo(()=>new SafeBigNumber(r?.devHoldingsRatio).gte(.1),[r?.devHoldingsRatio]),i=useMemo(()=>new SafeBigNumber(r?.sniperHoldingsRatio).gte(.1),[r?.sniperHoldingsRatio]),a=useMemo(()=>new SafeBigNumber(r?.insiderHoldingsRatio).gte(.1),[r?.insiderHoldingsRatio]),l=useMemo(()=>new SafeBigNumber(r?.bundleHoldingsRatio).gte(.1),[r?.bundleHoldingsRatio]);return jsxs("div",{className:"w-full h-full flex flex-col gap-1 justify-center",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsx(z,{icon:jsx(PeopleIcon,{width:12,height:12}),value:formatAmount(r?.holders),tooltip:o("tokens.tokenInfo.holders"),warning:false,disable:!r?.holders}),jsx(z,{icon:jsx(KlineCandlesIcon,{width:12,height:12}),value:formatAmount(r?.proHolders),tooltip:o("tokens.tokenInfo.proHolders"),warning:false,disable:!r?.proHolders}),jsx(z,{icon:jsx(StarIcon,{width:12,height:12}),value:formatAmount(r?.kolHolders),tooltip:o("tokens.tokenInfo.kolHolders"),warning:false,disable:!r?.kolHolders}),jsx(z,{icon:jsx(UserWithStarBadgeIcon,{width:12,height:12}),value:formatPercent(r?.top10HoldingsRatio),tooltip:o("tokens.tokenInfo.top10HoldingsRatio"),warning:s,disable:!r?.top10HoldingsRatio||r?.top10HoldingsRatio==="0"})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(z,{icon:jsx(CookIcon,{width:12,height:12}),value:formatPercent(r?.devHoldingsRatio),tooltip:o("tokens.tokenInfo.devHoldingsRatio"),warning:n,disable:!r?.devHoldingsRatio||r?.devHoldingsRatio==="0",tooltipPlacement:"bottom"}),jsx(z,{icon:jsx(SniperIcon,{width:12,height:12}),value:formatPercent(r?.sniperHoldingsRatio),tooltip:o("tokens.tokenInfo.sniperHoldingsRatio"),warning:i,disable:!r?.sniperHoldingsRatio||r?.sniperHoldingsRatio==="0",tooltipPlacement:"bottom"}),jsx(z,{icon:jsx(RatIcon,{width:12,height:12}),value:formatPercent(r?.insiderHoldingsRatio),tooltip:o("tokens.tokenInfo.insiderHoldingsRatio"),warning:a,disable:!r?.insiderHoldingsRatio||r?.insiderHoldingsRatio==="0",tooltipPlacement:"bottom"}),jsx(z,{icon:jsx(BundlesIcon,{width:12,height:12}),value:formatPercent(r?.bundleHoldingsRatio),tooltip:o("tokens.tokenInfo.bundleHoldingsRatio"),warning:l,disable:!r?.bundleHoldingsRatio||r?.bundleHoldingsRatio==="0",tooltipPlacement:"bottom"})]})]})});var Ea=memo(function({token:t}){let o=useMemo(()=>t.marketData?.tvlInUsd,[t.marketData?.tvlInUsd]);return jsx(Fragment,{children:formatAmountUSD(o)})});var Wa=memo(function({token:t}){let o=useMemo(()=>t.marketData?.marketCapInUsd,[t.marketData?.marketCapInUsd]);return jsx(Fragment,{children:formatAmountUSD(o)})});var $a=memo(function({token:t,resolution:o}){let r=useMemo(()=>t.marketData?.priceInUsd,[t.marketData?.priceInUsd]),s=useMemo(()=>t.stats?.[o]?.priceChange,[t,o]),n=useMemo(()=>s?new SafeBigNumber(s).abs().toString():void 0,[s]),i=useMemo(()=>s&&new SafeBigNumber(s).gte(0),[s]);return jsxs("div",{className:"flex flex-col gap-1 justify-center items-start",children:[jsx("span",{children:formatPriceUSD(r)}),jsxs("span",{className:cn$1("inline-flex gap-1 items-center text-xs",i?"text-bullish":"text-bearish"),children:[i?jsx(TriangleUpIcon,{width:10,height:10}):jsx(TriangleDownIcon,{width:10,height:10}),jsx("span",{children:formatPercent(n)})]})]})});var za=memo(function({token:t,resolution:o}){let r=useMemo(()=>t.stats?.[o]?.traders,[t.stats?.[o]?.traders]),s=useMemo(()=>t.stats?.[o]?.buyers,[t.stats?.[o]?.buyers]),n=useMemo(()=>t.stats?.[o]?.sellers,[t.stats?.[o]?.sellers]);return jsxs("div",{className:"flex flex-col gap-1 justify-center items-start",children:[jsx("span",{children:formatAmount(r)}),jsxs("div",{className:"flex gap-1 text-xs",children:[jsx("span",{className:"text-bullish",children:formatAmount(s)}),"/",jsx("span",{className:"text-bearish",children:formatAmount(n)})]})]})});var Qa=memo(function({token:t,resolution:o}){let r=useMemo(()=>t.stats?.[o]?.trades,[t.stats?.[o]?.trades]),s=useMemo(()=>t.stats?.[o]?.buys,[t.stats?.[o]?.buys]),n=useMemo(()=>t.stats?.[o]?.sells,[t.stats?.[o]?.sells]);return jsxs("div",{className:"flex flex-col gap-1 justify-center items-start",children:[jsx("span",{children:formatAmount(r)}),jsxs("div",{className:"flex gap-1 text-xs",children:[jsx("span",{className:"text-bullish",children:formatAmount(s)}),"/",jsx("span",{className:"text-bearish",children:formatAmount(n)})]})]})});var Xa=memo(function({token:t,resolution:o}){let r=useMemo(()=>t.stats?.[o]?.volumesInUsd,[t.stats?.[o]?.volumesInUsd]),s=useMemo(()=>t.stats?.[o]?.buyVolumesInUsd,[t.stats?.[o]?.buyVolumesInUsd]),n=useMemo(()=>t.stats?.[o]?.sellVolumesInUsd,[t.stats?.[o]?.sellVolumesInUsd]);return jsxs("div",{className:"flex flex-col gap-1 justify-center items-start",children:[jsx("span",{children:formatAmountUSD(r)}),jsxs("div",{className:"flex gap-1 text-xs",children:[jsx("span",{className:"text-bullish",children:formatAmountUSD(s)}),"/",jsx("span",{className:"text-bearish",children:formatAmountUSD(n)})]})]})});var Pg=`
21
+ `})]})}function Yr({token:e,renderAction:t,isLast:o=false,onSelectToken:r,className:s}){let{t:n}=useTranslation(),i=useCopyToClipboard(),a=useTickAge(e.createdAt),l=e.marketData,d=e.stats?.["1h"],m=useCallback(()=>{r?.(e);},[r,e]),c=useCallback(B=>{B.stopPropagation(),i(e.address,()=>toast.success(n("tokens.copied.address")));},[i,e.address,n]),p=useMemo(()=>d?.volumesInUsd,[d?.volumesInUsd]),u=useMemo(()=>d?.buyVolumesInUsd,[d?.buyVolumesInUsd]),g=useMemo(()=>d?.sellVolumesInUsd,[d?.sellVolumesInUsd]),f=useMemo(()=>d?.trades,[d?.trades]),x=useMemo(()=>l?.marketCapInUsd,[l?.marketCapInUsd]),k=useMemo(()=>l?.tvlInUsd,[l?.tvlInUsd]),h=useMemo(()=>{let B=new SafeBigNumber(x);return B.lt(1e3)?"text-foreground":B.lt(1e6)?"text-secondary":"text-primary"},[x]),b=useMemo(()=>new SafeBigNumber(l?.top10HoldingsRatio).gte(.1),[l?.top10HoldingsRatio]),T=useMemo(()=>new SafeBigNumber(l?.devHoldingsRatio).gte(.1),[l?.devHoldingsRatio]),N=useMemo(()=>new SafeBigNumber(l?.insiderHoldingsRatio).gte(.1),[l?.insiderHoldingsRatio]),y=useMemo(()=>new SafeBigNumber(l?.sniperHoldingsRatio).gte(.1),[l?.sniperHoldingsRatio]),P=useMemo(()=>new SafeBigNumber(l?.bundleHoldingsRatio).gte(.1),[l?.bundleHoldingsRatio]),[L,H]=useMemo(()=>{let B=Number(d?.buys??0),F=Number(d?.sells??0),_=B+F;if(_===0)return [12,12];let gt=Math.round(B/_*24);return [gt,24-gt]},[d?.buys,d?.sells]),te=l?.holders!==void 0&&l.holders>0,Se=l?.proHolders!==void 0&&l.proHolders>0,D=l?.kolHolders!==void 0&&l.kolHolders>0,ie=te||Se||D;return jsxs("div",{className:cn$1("relative w-full h-full overflow-hidden px-4 py-3 hover:bg-content2/40 cursor-pointer",s),style:{borderBottom:o?"none":"1px solid rgba(39,39,42,0.6)"},onClick:r?m:void 0,children:[jsxs("div",{className:"flex items-start gap-2",children:[jsxs("div",{className:"flex-none flex flex-col items-center gap-2",children:[jsx(fe,{token:e,enableSearch:true,enablePreview:!!e.image,showProgress:true,className:"w-20 h-20"}),jsxs("button",{type:"button",className:"text-xs font-mono text-neutral hover:text-foreground leading-none",onClick:c,"aria-label":n("tokens.copied.address"),title:n("tokens.copied.address"),children:[e.address.slice(0,4),"...",e.address.slice(-4)]})]}),jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2.5",children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 min-w-0 text-left",onClick:c,"aria-label":n("tokens.copied.address"),title:n("tokens.copied.address"),children:[jsx("span",{className:"flex-none text-sm font-semibold leading-none whitespace-nowrap overflow-hidden text-ellipsis max-w-24",children:e.symbol}),jsx(StyledTooltip,{content:e.name,children:jsx("span",{className:"text-[13px] leading-none text-neutral truncate max-w-20",children:e.name})}),jsx(CopyIcon,{className:"flex-none w-3.5 h-3.5 text-neutral"})]}),jsxs("div",{className:"flex items-center gap-2 leading-none",children:[jsx("span",{className:"text-[13px] font-mono font-medium text-neutral",children:formatAge(a)}),e.socialMedias?.website&&jsx(Link,{href:e.socialMedias.website,className:"text-neutral hover:text-primary",target:"_blank",onClick:B=>B.stopPropagation(),children:jsx(WebsiteIcon,{className:"w-3.5 h-3.5"})}),e.socialMedias?.twitter&&jsx(Link,{href:e.socialMedias.twitter,className:"text-neutral hover:text-primary",target:"_blank",onClick:B=>B.stopPropagation(),children:jsx(TwitterIcon,{className:"w-3.5 h-3.5"})}),e.socialMedias?.telegram&&jsx(Link,{href:e.socialMedias.telegram,className:"text-neutral hover:text-primary",target:"_blank",onClick:B=>B.stopPropagation(),children:jsx(TelegramIcon,{className:"w-3.5 h-3.5"})}),jsx(Link,{href:searchTwitterUrl(`${e.symbol} OR ${e.address}`),className:"max-sm:hidden text-neutral hover:text-primary",target:"_blank",onClick:B=>B.stopPropagation(),children:jsx(SearchIcon,{className:"w-3.5 h-3.5"})})]}),jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-foreground/80 leading-none",children:[jsxs("span",{className:"inline-flex items-baseline gap-1",children:[jsx("span",{className:"text-neutral",children:"MC"}),jsx("span",{className:cn$1(h),children:formatAmountUSDCompact(x)})]}),jsx("span",{className:"text-neutral/30",children:"\xB7"}),jsxs("span",{className:"inline-flex items-baseline gap-1",children:[jsx("span",{className:"text-neutral",children:"Liq"}),jsx("span",{children:formatAmountUSDCompact(k)})]})]}),ie&&jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-neutral leading-none",children:[te&&jsx(StyledTooltip,{content:n("tokens.tokenInfo.holders"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(PeopleIcon,{className:"w-3 h-3 text-neutral"}),formatAmount(l?.holders)]})}),Se&&jsx(StyledTooltip,{content:n("tokens.tokenInfo.proHolders"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(KlineCandlesIcon,{className:"w-3 h-3 text-neutral"}),formatAmount(l?.proHolders)]})}),D&&jsx(StyledTooltip,{content:n("tokens.tokenInfo.kolHolders"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(StarIcon,{className:"w-3 h-3 text-neutral"}),formatAmount(l?.kolHolders)]})})]})]}),jsxs("div",{className:"flex-none flex flex-col items-end gap-2.5 leading-none font-mono",children:[jsx("div",{className:"flex flex-col items-end gap-1",children:jsx("span",{className:cn$1("text-base font-bold leading-none",h),children:formatAmountUSDCompact(x)})}),jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsxs("div",{className:"flex items-baseline gap-1",children:[jsx("span",{className:"text-xs text-neutral",children:"V"}),jsx("span",{className:"text-xs text-foreground/80",children:formatAmountUSDCompact(p)})]}),jsxs("span",{className:"text-[10px] leading-none",children:[jsx("span",{className:"text-bullish",children:formatAmountUSDCompact(u)}),jsx("span",{className:"text-neutral/50 mx-0.5",children:"/"}),jsx("span",{className:"text-bearish",children:formatAmountUSDCompact(g)})]})]}),jsxs("div",{className:"flex items-baseline gap-1",children:[jsx("span",{className:"text-xs text-neutral",children:"TX"}),jsx("span",{className:"text-xs text-foreground/80",children:formatAmount(f)})]})]})]}),jsxs("div",{className:"mt-2.5 flex items-start gap-4 relative",children:[jsx(HorizontalScrollContainer,{className:"flex-auto min-w-0",forceShowArrows:true,children:jsxs("div",{className:"flex items-center gap-1",children:[jsx(z,{icon:jsx(UserWithStarBadgeIcon,{width:12,height:12}),value:formatPercent(l?.top10HoldingsRatio),tooltip:n("tokens.tokenInfo.top10HoldingsRatio"),warning:b,disable:!l?.top10HoldingsRatio||l?.top10HoldingsRatio==="0"}),jsx(z,{icon:jsx(CookIcon,{width:12,height:12}),value:formatPercent(l?.devHoldingsRatio),tooltip:n("tokens.tokenInfo.devHoldingsRatio"),warning:T,disable:!l?.devHoldingsRatio||l?.devHoldingsRatio==="0"}),jsx(z,{icon:jsx(SniperIcon,{width:12,height:12}),value:formatPercent(l?.sniperHoldingsRatio),tooltip:n("tokens.tokenInfo.sniperHoldingsRatio"),warning:y,disable:!l?.sniperHoldingsRatio||l?.sniperHoldingsRatio==="0"}),jsx(z,{icon:jsx(RatIcon,{width:12,height:12}),value:formatPercent(l?.insiderHoldingsRatio),tooltip:n("tokens.tokenInfo.insiderHoldingsRatio"),warning:N,disable:!l?.insiderHoldingsRatio||l?.insiderHoldingsRatio==="0"}),jsx(z,{icon:jsx(BundlesIcon,{width:12,height:12}),value:formatPercent(l?.bundleHoldingsRatio),tooltip:n("tokens.tokenInfo.bundleHoldingsRatio"),warning:P,disable:!l?.bundleHoldingsRatio||l?.bundleHoldingsRatio==="0"})]})}),t&&jsx("div",{className:"flex-none relative",onClick:B=>B.stopPropagation(),children:t(e)})]})]})}var ld=152,jr=10;function dd({index:e,style:t,data:o,skeletonCount:r,renderItemAction:s,onSelectToken:n}){if(!o)return jsx("div",{style:t,children:jsx(Fo,{isLast:e===r-1})});let i=o[e];return i?jsx("div",{style:t,children:jsx(Yr,{token:i,isLast:e===o.length-1,renderAction:s,onSelectToken:n})}):jsx("div",{style:t,children:jsx(Fo,{isLast:e===o.length-1})})}function Xe({title:e,tokens:t,isLoading:o,itemHeight:r=ld,renderHeaderExtra:s,renderItemAction:n,onSelectToken:i,onPauseChange:a,onScrollingChange:l,className:d,hideHeader:m}){let c=o||!t?void 0:t,p=c?c.length:jr,u=useMemo(()=>({data:c,skeletonCount:jr,renderItemAction:n,onSelectToken:i}),[c,n,i]),[g,f]=useState(false),x=useRef(void 0),k=useRef(false),h=useCallback(()=>{f(true),a?.(true);},[a]),b=useCallback(()=>{f(false),a?.(false);},[a]),T=useCallback(()=>{k.current||(k.current=true,l?.(true)),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{k.current=false,l?.(false);},180);},[l]);return useEffect(()=>()=>{x.current&&clearTimeout(x.current),k.current&&l?.(false);},[l]),jsxs("div",{className:cn$1("w-full h-full bg-[#0a0a0b] overflow-hidden flex flex-col border border-[rgba(39,39,42,0.6)] rounded-lg",d),onMouseEnter:h,onMouseLeave:b,children:[!m&&jsx(Or,{title:e,isPaused:g,extra:s}),jsx("div",{className:"flex-1 w-full overflow-hidden",onScrollCapture:T,children:jsx(List,{className:"h-full w-full",rowCount:p,rowHeight:r,rowComponent:dd,rowProps:u,overscanCount:10})})]})}function Do(e,t){let o={...e};for(let r of Object.keys(t))t[r]!==void 0&&(o[r]=t[r]);return o}var md=["1m","5m","15m","30m","1h","4h","24h"];function pd(e,t){if(!t)return e;if(!e)return t;let o={...e};for(let r of md)t[r]&&(o[r]=e[r]?Do(e[r],t[r]):t[r]);return o}function ud(e,t){return t?e?Do(e,t):t:e}function _t(e,t){return t?e?Do(e,t):t:e}function X(e,t){let{chain:o,address:r,stats:s,marketData:n,socialMedias:i,security:a,launchedFrom:l,migratedTo:d,...m}=t,c={...e};for(let p of Object.keys(m))m[p]!==void 0&&(c[p]=m[p]);return c.stats=pd(e.stats,s),c.marketData=ud(e.marketData,n),c.socialMedias=_t(e.socialMedias,i),c.security=_t(e.security,a),c.launchedFrom=_t(e.launchedFrom,l),c.migratedTo=_t(e.migratedTo,d),c}function $t(e,t){let o=new Map(e.map(r=>[r.address,r]));return t.map(r=>{let s=o.get(r.address);return s?X(s,r):r})}function fd(e){return e.chain!==void 0&&e.address!==void 0&&e.address!==""&&e.name!==void 0&&e.symbol!==void 0&&e.decimals!==void 0}function Re(e,t){if(t.length===0)return e;let o=[...e],r=false;for(let s of t){let n=o.findIndex(i=>i.address===s.address);if(n>=0){o[n]=X(o[n],s),r=true;continue}fd(s)&&(o.push(s),r=true);}return r?o:e}var xd=["24h","12h","30m","15m","30s","15s","1m","5m","1h","4h","1s"],kd=new Set(["price","marketCap","tvl","holders","top10Holdings","top10Ratio","top100Holdings","top100Ratio","creatorsHoldings","creatorsRatio","createdAt","launchedFromProtocolFamily","migratedToProtocolFamily","tag"]),bd=new Set(["priceChange","volumes","trades","traders","buys","sells"]);function Y(e){if(e==null||e==="")return;let t=Number(e);return Number.isFinite(t)?t:void 0}function tn(e){for(let t of xd){if(!e.endsWith(t))continue;let o=e.slice(0,-t.length);return o?{metric:o,resolution:t}:void 0}}function on(e){if(kd.has(e))return true;let t=tn(e);return t?bd.has(t.metric):false}function Kt(e,t){switch(t){case "price":return Y(e.marketData?.priceInUsd);case "marketCap":return Y(e.marketData?.marketCapInUsd);case "tvl":return Y(e.marketData?.tvlInUsd);case "holders":return Y(e.marketData?.holders);case "top10Holdings":return Y(e.marketData?.top10Holdings);case "top10Ratio":return Y(e.marketData?.top10HoldingsRatio);case "top100Holdings":return Y(e.marketData?.top100Holdings);case "top100Ratio":return Y(e.marketData?.top100HoldingsRatio);case "creatorsHoldings":return Y(e.marketData?.devHoldings);case "creatorsRatio":return Y(e.marketData?.devHoldingsRatio);case "createdAt":return e.createdAt?.getTime();case "launchedFromProtocolFamily":return en(e,e.launchedFrom?.protocolFamily);case "migratedToProtocolFamily":return en(e,e.migratedTo?.protocolFamily);case "tag":return e.tags?.[0];}let o=tn(t);if(!o)return;let r=e.stats?.[o.resolution];switch(o.metric){case "priceChange":return Y(r?.priceChange);case "volumes":return Y(r?.volumesInUsd);case "trades":return Y(r?.trades);case "traders":return Y(r?.traders);case "buys":return Y(r?.buys);case "sells":return Y(r?.sells);default:return}}function en(e,t){if(t)return parseTokenProtocolFamily(e.chain,t)??t}var hd=new Set(["top10Ratio","top100Ratio","creatorsRatio"]);function rn(e){let t=e.trim().toLowerCase();return t.length>0?t:void 0}function Td(e){return [e.name,e.symbol].filter(Boolean).join(" ").toLowerCase()}function yd(e){return Array.isArray(e)?e:void 0}function vd(e){return Array.isArray(e)?void 0:e}function nn(e,t){if(!hd.has(e))return t;let o=Number(t);return Number.isFinite(o)?o/100:t}function ge(e,t){let o=vd(t);return o===void 0?void 0:nn(e,o)}function Bo(e,t){return yd(t)?.map(o=>nn(e,o))}function Je(e,t){if(typeof e=="number"){let o=Number(t);return Number.isFinite(o)?e-o:void 0}if(typeof e=="string")return e.localeCompare(String(t))}function zt(e,t){if(typeof e=="number"){let o=Number(t);return Number.isFinite(o)&&e===o}return String(e)===String(t)}function Nd(e,t){if(!on(t.field))return false;let o=Kt(e,t.field),r=o===void 0;if(t.operator==="isNull")return r;if(t.operator==="isNotNull")return !r;if(r)return false;switch(t.operator){case "eq":{let s=ge(t.field,t.value);return s!==void 0&&zt(o,s)}case "ne":{let s=ge(t.field,t.value);return s!==void 0&&!zt(o,s)}case "gt":{let s=ge(t.field,t.value),n=s!==void 0?Je(o,s):void 0;return n!==void 0&&n>0}case "gte":{let s=ge(t.field,t.value),n=s!==void 0?Je(o,s):void 0;return n!==void 0&&n>=0}case "lt":{let s=ge(t.field,t.value),n=s!==void 0?Je(o,s):void 0;return n!==void 0&&n<0}case "lte":{let s=ge(t.field,t.value),n=s!==void 0?Je(o,s):void 0;return n!==void 0&&n<=0}case "between":{let s=Bo(t.field,t.value);if(!s||s.length<2)return false;let n=Je(o,s[0]),i=Je(o,s[1]);return n!==void 0&&i!==void 0&&n>=0&&i<=0}case "in":{let s=Bo(t.field,t.value);return s?s.some(n=>zt(o,n)):false}case "nin":{let s=Bo(t.field,t.value);return s?s.every(n=>!zt(o,n)):false}case "contains":{let s=ge(t.field,t.value);return s!==void 0&&String(o).includes(String(s))}case "notContains":{let s=ge(t.field,t.value);return s!==void 0&&!String(o).includes(String(s))}case "startsWith":{let s=ge(t.field,t.value);return s!==void 0&&String(o).startsWith(String(s))}case "endsWith":{let s=ge(t.field,t.value);return s!==void 0&&String(o).endsWith(String(s))}default:return false}}function le(e,t){let o=t?.keywords?.map(rn).filter(n=>n!==void 0),r=t?.excludeKeywords?.map(rn).filter(n=>n!==void 0),s=t?.filters;return !o?.length&&!r?.length&&!s?.length?e:e.filter(n=>{let i=Td(n);return !(o?.length&&!o.some(a=>i.includes(a))||r?.length&&r.some(a=>i.includes(a))||s?.length&&!s.every(a=>Nd(n,a)))})}function de({applyUpdates:e,paused:t=false,flushInterval:o=500}){let r=useRef(e),s=useRef(t),n=useRef([]),i=useRef(),a=useRef();r.current=e,s.current=t;let l=useCallback(()=>{i.current!==void 0&&(clearTimeout(i.current),i.current=void 0),a.current!==void 0&&(cancelAnimationFrame(a.current),a.current=void 0);},[]),d=useCallback(()=>{if(l(),s.current){i.current=setTimeout(d,o);return}let p=n.current;p.length!==0&&(n.current=[],r.current(p));},[l,o]),m=useCallback(()=>{i.current!==void 0||a.current!==void 0||(i.current=setTimeout(()=>{i.current=void 0,a.current=requestAnimationFrame(()=>{a.current=void 0,d();});},o));},[d,o]),c=useCallback(p=>{p.length!==0&&(n.current.push(...p),m());},[m]);return useEffect(()=>{t||d();},[d,t]),useEffect(()=>l,[l]),{enqueueUpdates:c,flush:d}}function cn({chain:e,tokens:t,onUpdate:o,enabled:r=true}){let{subscribeClient:s}=useDexClient(),n=useRef(new Map),i=useRef(o);i.current=o;let a=useMemo(()=>Array.from(new Set(t.map(m=>m.address.trim()).filter(Boolean))).sort().join(","),[t]),l=useMemo(()=>a?a.split(","):[],[a]),d=()=>{n.current.forEach(m=>m.unsubscribe()),n.current.clear();};useEffect(()=>d,[e,s,r]),useEffect(()=>{if(!r){d();return}let m=new Set(l),c=n.current;for(let[p,u]of c)m.has(p)||(u.unsubscribe(),c.delete(p));for(let p of l)c.has(p)||c.set(p,s.subscribeToken(e,p,u=>{i.current(u);}));},[l,e,r,s]);}var Pd=80;function xn(e){return {chain:e.chain,address:e.address,name:e.name??"",symbol:e.symbol??"",decimals:e.decimals??0,image:e.image,description:e.description,socialMedias:e.socialMedias,launchedFrom:e.launchedFrom,migratedTo:e.migratedTo,createdAt:e.createdAt}}function Rd(e,t,o){return e===t?o:e===o?t:o||t}function Wo(e){let t=e.token?.address??e.tokenAAddress??"",o=e.token;return {...o,chain:e.chain,address:t,name:o?.name??"",symbol:o?.symbol??"",decimals:o?.decimals??0,createdAt:o?.createdAt??e.createdAt,liquidities:[{poolAddress:e.poolAddress,pairAddress:Rd(t,e.tokenAAddress,e.tokenBAddress),image:e.dex?.image,programAddress:e.dex?.programAddress,protocolFamily:e.dex?.protocolFamily,protocolName:e.dex?.protocolName}]}}function Ad(e){return {...xn(Wo(e)),...e.token??{},liquidities:Wo(e).liquidities,createdAt:e.token?.createdAt??e.createdAt}}function gn(e){return e.sort((t,o)=>{let r=t.createdAt?.getTime()??0;return (o.createdAt?.getTime()??0)-r}),e.slice(0,Pd)}function kn({chain:e,filters:t,isPaused:o=false,deferUpdates:r=false,updateFlushInterval:s}){let n=useMemo(()=>({chain:e}),[e]),i=useRef(o);i.current=o;let a=useRef(e),[l,d]=useState(true),[m,c]=useState([]);useEffect(()=>{e!==a.current&&(d(true),c([]),a.current=e);},[e]);let{data:p,isPending:u}=useNewPoolsQuery(n);useEffect(()=>{p&&(c(b=>{let T=i.current,N=b.length===0&&p.length>0,y=[...b];for(let P of p){let L=Ad(P),H=y.findIndex(te=>te.address===L.address);H>=0?y[H]=X(y[H],L):(!T||N)&&y.push(L);}return T?y:gn(y)}),d(false));},[p]);let g=useCallback(b=>{c(T=>{let N=i.current,y=[...T],P=false;for(let L of b){let H=y.findIndex(te=>te.address===L.address);H>=0?(P=true,y[H]=X(y[H],L)):N||(P=true,y.push(xn(L)));}return P?N?y:gn(y):T});},[]),{enqueueUpdates:f}=de({applyUpdates:g,paused:r,flushInterval:s}),x=useCallback(b=>{f(b.map(Wo));},[f]);useNewPoolsSubscription({chain:e},x),useNewTokensMetadataSubscription({chain:e},f),cn({chain:e,tokens:m,onUpdate:f});let k=useMemo(()=>u||l,[u,l]);return {tokens:useMemo(()=>le(m,t),[m,t]),isLoading:k}}function fb({chain:e,filters:t,title:o,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,className:i,hideHeader:a}){let[l,d]=useState(false),[m,c]=useState(false),{tokens:p,isLoading:u}=kn({chain:e,filters:t,isPaused:l,deferUpdates:m}),g=useCallback(f=>{d(f);},[]);return jsx(Xe,{title:o,tokens:p,isLoading:u,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,onPauseChange:g,onScrollingChange:c,className:i,hideHeader:a})}function xe({chain:e,tokens:t,onUpdate:o,enabled:r=true}){let{subscribeClient:s}=useDexClient(),n=useRef(new Map),i=useRef(o);i.current=o;let a=useMemo(()=>Array.from(new Set(t.map(m=>m.address.trim()).filter(Boolean))).sort().join(","),[t]),l=useMemo(()=>a?a.split(","):[],[a]),d=()=>{n.current.forEach(m=>m.unsubscribe()),n.current.clear();};useEffect(()=>d,[e,s,r]),useEffect(()=>{if(!r){d();return}let m=new Set(l),c=n.current;for(let[p,u]of c)m.has(p)||(u.unsubscribe(),c.delete(p));for(let p of l)c.has(p)||c.set(p,s.subscribeToken(e,p,u=>{i.current(u);}));},[l,e,r,s]);}function Cn({chain:e,filters:t,isPaused:o=false,refetchInterval:r=3e4,deferUpdates:s=false,updateFlushInterval:n}){let i=useMemo(()=>({chain:e}),[e]),a=useRef(o);a.current=o;let l=useRef(e),[d,m]=useState(true),[c,p]=useState([]);useEffect(()=>{e!==l.current&&(m(true),p([]),l.current=e);},[e]);let{data:u,isPending:g}=useMigratedTokensQuery(i,{refetchInterval:r});useEffect(()=>{u&&(p(b=>{let T=a.current,N=[...b];for(let y of u){let P=N.findIndex(L=>L.address===y.address);P>=0?N[P]=X(N[P],y):T||N.unshift(y);}return N}),m(false));},[u]);let f=useCallback(b=>{p(T=>Re(T,b));},[]),{enqueueUpdates:x}=de({applyUpdates:f,paused:s,flushInterval:n});xe({chain:e,tokens:c,onUpdate:x});let k=useMemo(()=>g||d,[g,d]);return {tokens:useMemo(()=>le(c,t),[c,t]),isLoading:k}}function Ib({chain:e,filters:t,title:o,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,className:i,hideHeader:a}){let[l,d]=useState(false),[m,c]=useState(false),{tokens:p,isLoading:u}=Cn({chain:e,filters:t,isPaused:l,deferUpdates:m}),g=useCallback(f=>{d(f);},[]);return jsx(Xe,{title:o,tokens:p,isLoading:u,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,onPauseChange:g,onScrollingChange:c,className:i,hideHeader:a})}function Wd(e){return e.sort((t,o)=>{let r=Number(t.migrateProgress??0);return Number(o.migrateProgress??0)-r})}function An({chain:e,filters:t,isPaused:o=false,refetchInterval:r=15e3,deferUpdates:s=false,updateFlushInterval:n}){let i=useMemo(()=>({chain:e}),[e]),a=useRef(o);a.current=o;let l=useRef(e),[d,m]=useState(true),[c,p]=useState([]);useEffect(()=>{e!==l.current&&(m(true),p([]),l.current=e);},[e]);let{data:u,isPending:g}=useFinalStretchTokensQuery(i,{refetchInterval:r});useEffect(()=>{u&&(p(b=>{let T=a.current,N=b.length===0&&u.length>0,y=[...b];for(let P of u){let L=y.findIndex(H=>H.address===P.address);L>=0?y[L]=X(y[L],P):(!T||N)&&y.push(P);}return T?y:Wd(y)}),m(false));},[u]);let f=useCallback(b=>{p(T=>Re(T,b));},[]),{enqueueUpdates:x}=de({applyUpdates:f,paused:s,flushInterval:n});xe({chain:e,tokens:c,onUpdate:x});let k=useMemo(()=>g||d,[g,d]);return {tokens:useMemo(()=>le(c,t),[c,t]),isLoading:k}}function zb({chain:e,filters:t,title:o,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,className:i,hideHeader:a}){let[l,d]=useState(false),[m,c]=useState(false),{tokens:p,isLoading:u}=An({chain:e,filters:t,isPaused:l,deferUpdates:m}),g=useCallback(f=>{d(f);},[]);return jsx(Xe,{title:o,tokens:p,isLoading:u,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,onPauseChange:g,onScrollingChange:c,className:i,hideHeader:a})}var zd=10,qd=atomWithStorage("liberfi:search_histories",[],void 0,{getOnInit:true});function Qt(){let[e,t]=useAtom(qd),o=useCallback(s=>{let n=s.trim();n&&t(i=>{let a=i.filter(l=>l!==n);return [n,...a].slice(0,zd)});},[t]),r=useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:o,clearHistories:r}}function Un({histories:e,onSelect:t,onClear:o,className:r}){let{t:s}=useTranslation();return e.length===0?null:jsxs("div",{className:cn$1("px-4 pb-4",r),children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium",children:s("tokens.search.history")}),jsx(Button,{isIconOnly:true,size:"sm",className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:o,children:jsx(TrashIcon,{width:20,height:20})})]}),jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:e.map(n=>jsx(Chip,{size:"sm",variant:"bordered",className:cn$1("text-neutral","border-border border-1","cursor-pointer","hover:opacity-hover"),onClick:()=>t?.(n),children:n},n))})]})}function On({onSelect:e,className:t}){let{histories:o,clearHistories:r}=Qt();return jsx(Un,{className:cn$1(t),histories:o,onSelect:e,onClear:r})}function Dn({value:e,onValueChange:t,onClear:o,onEscape:r,className:s}){let{t:n}=useTranslation();return jsx("div",{className:s,children:jsx(StyledInput,{autoFocus:true,variant:"bordered",radius:"full",value:e,onValueChange:t,placeholder:n("tokens.search.placeholder"),classNames:{inputWrapper:["!bg-[rgba(39,39,42,0.6)]","!border-[rgba(63,63,70,0.5)]","data-[hover=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!border-[rgba(63,63,70,0.8)]"].join(" ")},startContent:jsx(SearchIcon,{width:20,height:20,className:"text-neutral"}),endContent:e?jsx(Button,{isIconOnly:true,className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:o,children:jsx(XCloseIcon,{width:20,height:20})}):jsx(Kbd,{className:"min-w-8 justify-center text-xs text-neutral bg-transparent border border-[rgba(63,63,70,0.5)] rounded-full cursor-pointer select-none",onMouseDown:i=>{i.preventDefault(),r?.();},children:"Esc"})})})}function Gt({token:e,className:t}){let{t:o}=useTranslation(),r=useTickAge(e.createdAt),s=useMemo(()=>e.marketData?.priceInUsd,[e]),n=useMemo(()=>e.marketData?.marketCapInUsd,[e]),i=useMemo(()=>e.marketData?.tvlInUsd,[e]),a=useMemo(()=>e.stats?.["24h"]?.priceChange,[e]),l=useMemo(()=>a?new SafeBigNumber(a).abs().toString():void 0,[a]),d=useMemo(()=>a!=null&&new SafeBigNumber(a).gte(0),[a]);return jsxs("div",{className:cn$1("w-full h-full px-3 flex items-center justify-between gap-2","hover:cursor-pointer hover:bg-content2 rounded-lg",t),children:[jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2.5",children:[jsx(fe,{token:e,className:"w-10 h-10 flex-none",showProtocolFamily:true,classNames:{searchIcon:"w-5 h-5"}}),jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-0.5",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsx("span",{className:"font-medium text-sm truncate",children:e.symbol}),jsx("span",{className:"text-xs text-primary font-medium",children:formatAge(r)})]}),jsxs("div",{className:"flex items-center gap-1 text-xs text-neutral",children:[jsxs("span",{children:[o("tokens.listHeader.mcShort")," ",formatAmountUSD(n)]}),jsx("span",{children:"/"}),jsxs("span",{children:[o("tokens.listHeader.liqShort")," ",formatAmountUSD(i)]})]})]})]}),jsxs("div",{className:"flex-none w-20 flex flex-col items-end",children:[jsx("span",{className:"text-xs",children:formatPriceUSD(s)}),jsxs("span",{className:cn$1("inline-flex gap-0.5 items-center text-xs",d?"text-bullish":"text-bearish"),children:[d?jsx(TriangleUpIcon,{width:8,height:8}):jsx(TriangleDownIcon,{width:8,height:8}),jsx("span",{children:formatPercent(l)})]})]})]})}function Xt({className:e}){let{t}=useTranslation();return jsxs("div",{className:cn$1("h-9 px-3 flex items-center justify-between","text-xs font-medium text-neutral","sticky top-0 z-10",e),children:[jsx("div",{className:"flex-1",children:jsxs("span",{children:[t("tokens.listHeader.token")," / ",t("tokens.listHeader.age")," /"," ",t("tokens.listHeader.marketCap")," /"," ",t("tokens.listHeader.liquidity")]})}),jsx("div",{className:"flex-none w-20 text-right",children:jsxs("span",{children:[t("tokens.listHeader.price")," / ",t("tokens.listHeader.24hChange")]})})]})}function gc(){return jsxs("div",{className:"w-full h-14 px-3 flex items-center justify-between gap-2",children:[jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[jsx(Skeleton,{className:"flex-none w-8 h-8 rounded-full"}),jsxs("div",{className:"flex flex-col gap-1.5",children:[jsx(Skeleton,{className:"w-24 h-4 rounded-md"}),jsx(Skeleton,{className:"w-36 h-3 rounded-md"})]})]}),jsxs("div",{className:"flex-none w-20 flex flex-col items-end gap-1.5",children:[jsx(Skeleton,{className:"w-14 h-4 rounded-md"}),jsx(Skeleton,{className:"w-10 h-3 rounded-md"})]})]})}function Yt({rows:e=6,className:t}){return jsx("div",{className:cn$1("w-full",t),children:Array.from({length:e}).map((o,r)=>jsx(gc,{},r))})}function $n({keyword:e,chains:t,limit:o=50}){let r=useMemo(()=>({keyword:e,chains:t,limit:o}),[e,t,o]),{data:s,isLoading:n,isFetchingNextPage:i,hasNextPage:a,fetchNextPage:l}=useSearchTokensInfiniteQuery(r,{enabled:!!e});return {tokens:useMemo(()=>s?.pages.flatMap(m=>m.data)??[],[s]),isLoading:n,isFetchingNextPage:i,hasNextPage:a??false,fetchNextPage:l}}var Cc=56;function zn({onSelectToken:e,className:t,...o}){let{tokens:r,isLoading:s,isFetchingNextPage:n,hasNextPage:i,fetchNextPage:a}=$n(o),l=useRef(null),{height:d}=useResizeObserver({ref:l}),m=useCallback(g=>g<r.length,[r]),c=useCallback(async()=>{i&&!n&&await a();},[i,n,a]),p=useMemo(()=>i?r.length+1:r.length,[r,i]),u=useInfiniteLoader({isRowLoaded:m,loadMoreRows:c,rowCount:p,threshold:5});return s?jsxs("div",{className:cn$1("w-full",t),children:[jsx(Xt,{}),jsx(Yt,{})]}):r.length===0?jsxs("div",{className:cn$1("w-full",t),children:[jsx(Xt,{}),jsx(Lc,{})]}):jsxs("div",{className:cn$1("w-full h-full flex flex-col",t),children:[jsx(Xt,{className:"flex-none"}),jsx("div",{className:"flex-auto min-h-0",ref:l,children:jsx(List,{style:{height:d},onRowsRendered:u,rowComponent:wc,rowCount:p,rowHeight:Cc,rowProps:{tokens:r,onSelectToken:e},overscanCount:5})})]})}function wc({index:e,style:t,tokens:o,onSelectToken:r}){let s=o[e];return s?jsx("div",{style:t,onClick:()=>r?.(s),children:jsx(Gt,{token:s})}):jsx("div",{style:t,className:"flex items-center justify-center",children:jsx(Spinner,{size:"sm"})})}function Lc(){let{t:e}=useTranslation();return jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[jsx(EmptyIcon,{width:28,height:28,className:"text-neutral"}),jsx("p",{className:"mt-2 text-sm text-neutral",children:e("tokens.search.noResults")})]})}function Pc(e,t){return typeof e=="number"&&typeof t=="number"?e-t:String(e).localeCompare(String(t))}function je(e,t){let o=Object.keys(t??{})[0];if(!o)return e;let r=t?.[o];if(r!=="asc"&&r!=="desc")return e;let s=e.map((n,i)=>({token:n,index:i,value:Kt(n,o)}));return s.every(({value:n})=>n===void 0)?e:s.sort((n,i)=>{let a=n.value===void 0,l=i.value===void 0;if(a&&l)return n.index-i.index;if(a)return 1;if(l)return -1;let d=Pc(n.value,i.value);return d===0?n.index-i.index:r==="asc"?d:-d}).map(({token:n})=>n)}function eo({chain:e,resolution:t,filters:o,sortDirections:r,refetchInterval:s=3e4,deferUpdates:n=false,updateFlushInterval:i}){let a=useMemo(()=>({chain:e,resolution:t}),[e,t]),l=useRef(a),[d,m]=useState(true);useEffect(()=>{JSON.stringify(a)!==JSON.stringify(l.current)&&(m(true),p([]),l.current=a);},[a]);let[c,p]=useState([]),{data:u,isPending:g}=useTrendingTokensQuery(a,{refetchInterval:s});useEffect(()=>{u&&(p(T=>$t(T,u)),m(false));},[u]);let f=useCallback(T=>{p(N=>Re(N,T));},[]),{enqueueUpdates:x}=de({applyUpdates:f,paused:n,flushInterval:i});useTrendingTokensSubscription({chain:e},x),xe({chain:e,tokens:c,onUpdate:x});let k=useMemo(()=>!!(g||d),[g,d]),h=useMemo(()=>le(c,o),[c,o]);return {tokens:useMemo(()=>je(h,r),[h,r]),isLoading:k}}var Uc=Chain.ETHEREUM,Oc="24h",Dc=56;function Gn({chains:e,onSelectToken:t,className:o}){let r=e?.length===1?e[0]:e?.[0]??Uc,{tokens:s,isLoading:n}=eo({chain:r,resolution:Oc});return jsx("div",{className:cn$1("w-full flex flex-col overflow-hidden",o),children:n?jsx(Yt,{}):jsx("div",{className:"overflow-y-auto",children:s.map(i=>jsx("div",{style:{height:Dc},onClick:()=>t?.(i),children:jsx(Gt,{token:i,className:"h-full"})},i.address))})})}function Yn({onKeywordChange:e}){let[t,o]=useState(""),[r,s]=useState(""),{addHistory:n}=Qt(),i=useCallbackRef(e),a=useCallbackRef(n),l=useMemo(()=>debounce(p=>{s(p),i(p),p&&a(p);},500),[i,a]),d=useCallback(p=>{o(p),l(p);},[l]),m=useCallback(p=>{l.cancel(),o(p),s(p),i(p),p&&a(p);},[l,i,a]),c=useCallback(()=>m(""),[m]);return {text:t,keyword:r,setText:d,setKeyword:m,clearKeyword:c}}function jn({chains:e,onKeywordChange:t,onSelectToken:o,onEscape:r}){let{text:s,keyword:n,setText:i,setKeyword:a,clearKeyword:l}=Yn({onKeywordChange:t});return jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsx(Dn,{value:s,onValueChange:i,onClear:l,onPaste:a,onEscape:r}),n?jsx(zn,{className:"flex-auto min-h-0",keyword:n,chains:e,onSelectToken:o}):jsxs("div",{className:"flex-auto min-h-0 flex flex-col overflow-hidden",children:[jsx(On,{onSelect:a}),jsx(Gn,{className:"flex-auto min-h-0",chains:e,onSelectToken:o})]})]})}var qo="search";function UT({id:e=qo}){return jsx(AsyncModal,{id:e,children:t=>jsx(Jc,{...t})})}function Jc({params:e,isOpen:t,onOpenChange:o,onResult:r}){let{t:s}=useTranslation(),{isMobile:n}=useScreen(),i=useCallback(a=>{r(a);},[r]);return jsx(StyledModal,{isOpen:t,onOpenChange:o,size:n?"full":"lg",hideCloseButton:true,backdrop:"blur",radius:"lg",children:jsxs(ModalContent,{className:"w-full h-full",style:{borderRadius:n?void 0:14,border:n?void 0:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:n?void 0:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"},children:[jsxs(ModalHeader,{className:"sm:hidden flex items-center justify-between pt-4 pb-2",children:[jsx("span",{className:"text-base font-semibold",children:s("tokens.search.title")}),jsx(Button,{isIconOnly:true,onPress:()=>o(false),size:"sm",className:"bg-transparent min-w-6 w-6 h-6",children:jsx(XCloseIcon,{width:20,height:20})})]}),jsx(ModalBody,{className:"p-4",children:jsx(jn,{chains:e?.chains,onSelectToken:i,onEscape:()=>o(false)})})]})})}function KT({chains:e,onSelectToken:t,className:o}){let{t:r}=useTranslation(),{isDesktop:s}=useScreen(),{onOpen:n,onClose:i}=useAsyncModal(qo),a=useCallbackRef(t),l=useCallbackRef(async()=>{let m=await n({params:{chains:e}});m&&a(m);}),d=useCallbackRef(()=>{i();});return useEffect(()=>{let m=c=>{let p=document.activeElement,u=!!p&&(p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.getAttribute("contenteditable")==="true");c.key==="/"&&!u&&(c.preventDefault(),l()),c.key==="Escape"&&(c.preventDefault(),d());};return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m);}},[l,d]),s?jsx(Button,{size:"sm",radius:"full",onPress:l,variant:"bordered",startContent:jsx(SearchIcon,{width:16,height:16,className:"text-foreground"}),endContent:jsx(Kbd,{className:"min-w-6 justify-center text-xs text-foreground bg-content3 rounded-lg",children:"/"}),className:cn$1("w-56 min-w-0 h-8 min-h-0 border-transparent hover:border-border bg-content2 pl-3 pr-1.5 text-neutral",o),children:r("tokens.search.placeholder")}):jsx(Button,{size:"sm",radius:"full",isIconOnly:true,onPress:l,variant:"bordered",className:cn$1("w-8 min-w-0 h-8 min-h-0 border-1 border-border bg-content2",o),children:jsx(SearchIcon,{width:16,height:16,className:"text-foreground"})})}function vt(e){return e==null||e===""?"--":formatPercent(Number(e)/100)}function ke(e,t=4,o=4){return e?e.length<=t+o+1?e:`${e.slice(0,t)}\u2026${e.slice(-o)}`:"--"}function Pe(e,t=Date.now()){if(e==null)return "--";let o=typeof e=="string"||typeof e=="number"?new Date(e):e,r=typeof t=="number"?new Date(t):t,s=Math.max(0,Math.floor((r.getTime()-o.getTime())/1e3));if(s<60)return `${s}s`;let n=Math.floor(s/60);if(n<60)return `${n}m`;let i=Math.floor(n/60);if(i<24)return `${i}h`;let a=Math.floor(i/24);if(a<30)return `${a}d`;let l=Math.floor(a/30);return l<12?`${l}mo`:`${Math.floor(a/365)}y`}function U(e,t){let{data:o,isLoading:r}=useTokenQuery({chain:e,address:t}),[s,n]=useState(o);return useEffect(()=>{o&&n(o);},[o]),useTokenSubscription({chain:e,address:t},i=>{i?.length&&n(a=>{if(!a)return a;let l=a;for(let d of i)l=X(l,d);return l});}),{token:s,isLoading:r}}function et({label:e,totalFormatted:t,buysFormatted:o,sellsFormatted:r,totalValue:s=0,buysValue:n=0,className:i}){let a=new SafeBigNumber(s??0),l=new SafeBigNumber(n??0),d=a.eq(0)?0:l.div(a).times(100).toNumber();return jsxs("div",{className:cn$1("flex flex-col gap-1",i),children:[jsxs("div",{className:"flex items-baseline justify-between",children:[jsx("span",{className:"text-xs text-default-500",children:e}),jsx("span",{className:"text-xs text-foreground",children:t})]}),jsx(Progress,{size:"sm",value:d,classNames:{track:"bg-bearish/40",indicator:"bg-bullish"},"aria-label":`${e} buy share`}),jsxs("div",{className:"flex justify-between gap-4 text-[10px]",children:[jsxs("span",{className:"text-bullish",children:["Buys: ",o]}),jsxs("span",{className:"text-bearish",children:["Sells: ",r]})]})]})}function ss({token:e,actions:t,dataStrip:o,className:r,onCopyAddress:s}){let n=e?.address;return jsxs("div",{className:cn$1("flex w-full flex-wrap items-center gap-4 px-4 py-3",r),children:[jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e&&jsx(fe,{token:e,radius:"lg",className:"h-10 w-10"}),jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"truncate text-base font-semibold text-foreground",children:e?.symbol??"--"}),jsx("span",{className:"truncate text-xs text-default-400",children:e?.name})]}),n&&jsxs("button",{type:"button",onClick:()=>s?.(n),className:"flex items-center gap-1 text-[11px] text-default-400 transition-colors hover:text-foreground",title:n,children:[ke(n,6,6),jsx(CopyIcon,{width:12,height:12})]})]})]}),o&&jsx("div",{className:"flex-1 min-w-0",children:o}),t&&jsx("div",{className:"ml-auto flex items-center gap-2",children:t})]})}function is(e,t){return U(e,t)}function ls({price:e,marketCap:t,volume:o,holdersCount:r,socialMedia:s,className:n}){return jsxs("div",{className:cn$1("flex flex-wrap items-center gap-x-6 gap-y-3",n),children:[e,jsxs("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-3",children:[t,o,r]}),jsx("div",{className:"ml-auto",children:s})]})}function My(e,t){return U(e,t)}function cs({holders:e,top10HoldingsRatio:t,top100HoldingsRatio:o,className:r}){return jsxs("div",{className:cn$1("flex flex-col items-start justify-center gap-0.5",r),children:[jsxs("div",{className:"text-xs font-medium text-default-500",children:[jsx("span",{className:"text-foreground",children:e!=null?formatAmount(e):"--"}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:vt(t)}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:vt(o)})]}),jsx("div",{className:"text-[10px] text-default-400",children:"Holders / Top10 / Top100"})]})}function ms(e,t){return U(e,t)}function ps({chain:e,address:t,className:o}){let{token:r}=ms(e,t);return jsx(cs,{holders:r?.marketData?.holders,top10HoldingsRatio:r?.marketData?.top10HoldingsRatio,top100HoldingsRatio:r?.marketData?.top100HoldingsRatio,className:o})}function gs({marketCapInUsd:e,tvlInUsd:t,createdAt:o,className:r}){return jsxs("div",{className:cn$1("flex flex-col items-start justify-center gap-0.5",r),children:[jsxs("div",{className:"text-xs font-medium text-default-500",children:[jsx("span",{className:"text-foreground",children:e?formatAmountUSDCompact(e):"--"}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:t?formatAmountUSDCompact(t):"--"}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:Pe(o)})]}),jsx("div",{className:"text-[10px] text-default-400",children:"MC / Liq / Age"})]})}function xs(e,t){return U(e,t)}function ks({chain:e,address:t,className:o}){let{token:r}=xs(e,t);return jsx(gs,{marketCapInUsd:r?.marketData?.marketCapInUsd,tvlInUsd:r?.marketData?.tvlInUsd,createdAt:r?.createdAt,className:o})}function Ts({priceInUsd:e,price24hAgoInUsd:t,className:o}){let{bearish:r,priceChange:s}=useMemo(()=>{if(!e||!t)return {bearish:false,priceChange:void 0};let n=new SafeBigNumber(e),i=new SafeBigNumber(t);return i.lte(0)?{bearish:false,priceChange:void 0}:{bearish:n.lt(i),priceChange:n.minus(i).div(i).abs().toNumber()}},[e,t]);return jsxs("div",{className:cn$1("group flex flex-col gap-1",o),"data-bearish":r,children:[jsx("div",{className:"text-base font-medium leading-none text-bullish group-data-[bearish=true]:text-bearish",children:e?formatPriceUSD(e):"--"}),jsxs("div",{className:"flex items-center gap-2 text-[10px] leading-none",children:[jsx("span",{className:"text-default-400",children:"24h"}),jsx("span",{className:"text-bullish group-data-[bearish=true]:text-bearish",children:s!=null?formatPercent(s):"--"})]})]})}function ys(e,t){return U(e,t)}function vs({chain:e,address:t,className:o}){let{token:r}=ys(e,t);return jsx(Ts,{priceInUsd:r?.marketData?.priceInUsd,price24hAgoInUsd:r?.stats?.["24h"]?.openPriceInUsd,className:o})}function Pm(e,t){switch(e){case "website":return jsx(WebsiteIcon,{width:t,height:t});case "twitter":return jsx(TwitterIcon,{width:t,height:t});case "telegram":return jsx(TelegramIcon,{width:t,height:t});case "discord":return jsx(DiscordIcon,{width:t,height:t});default:return jsx("span",{className:"text-[9px] font-medium uppercase",children:e.slice(0,2)})}}function Ns({socials:e,className:t,iconSize:o=16}){if(!e)return null;let s=["website","twitter","telegram","discord","github","reddit","youtube","medium"].filter(n=>!!e[n]);return s.length===0?null:jsx("div",{className:cn$1("flex items-center gap-3",t),children:s.map(n=>jsx("a",{href:e[n],target:"_blank",rel:"noreferrer noopener",className:"flex items-center justify-center text-default-400 transition-colors hover:text-foreground",style:{width:o,height:o},children:Pm(n,o)},n))})}function Ss(e,t){return U(e,t)}function Cs({chain:e,address:t,className:o,iconSize:r}){let{token:s}=Ss(e,t);return jsx(Ns,{socials:s?.socialMedias,className:o,iconSize:r})}function Ps({volumesInUsd:e,trades:t,traders:o,className:r}){return jsxs("div",{className:cn$1("flex flex-col items-start justify-center gap-0.5",r),children:[jsxs("div",{className:"text-xs font-medium text-default-500",children:[jsx("span",{className:"text-foreground",children:e?formatAmountUSDCompact(e):"--"}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:t!=null?formatAmount(t):"--"}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:o!=null?formatAmount(o):"--"})]}),jsx("div",{className:"text-[10px] text-default-400",children:"24h Vol / Txs / Traders"})]})}function Rs(e,t){return U(e,t)}function As({chain:e,address:t,className:o}){let{token:r}=Rs(e,t),s=r?.stats?.["24h"];return jsx(Ps,{volumesInUsd:s?.volumesInUsd,trades:s?.trades,traders:s?.traders,className:o})}function Is({chain:e,address:t,className:o}){return jsx(ls,{className:o,price:jsx(vs,{chain:e,address:t}),marketCap:jsx(ks,{chain:e,address:t}),volume:jsx(As,{chain:e,address:t}),holdersCount:jsx(ps,{chain:e,address:t}),socialMedia:jsx(Cs,{chain:e,address:t})})}function g0({chain:e,address:t,actions:o,dataStrip:r,className:s,onCopyAddress:n}){let{token:i}=is(e,t);return jsx(ss,{token:i,actions:o,dataStrip:r===void 0?jsx(Is,{chain:e,address:t}):r,className:s,onCopyAddress:n})}var Um=[{value:"holdingUsd",label:"Value"},{value:"lastActiveAt",label:"Last active"}];function Ms({holders:e,isLoading:t,sortBy:o,onSortByChange:r,onlyTracked:s=false,onOnlyTrackedChange:n,onLoadMore:i,hasMore:a,now:l=Date.now(),wellKnownAddresses:d,className:m,renderAddress:c}){let p=s?e.filter(u=>u.tags&&u.tags.length>0):e;return jsxs("div",{className:cn$1("flex flex-col",m),children:[jsxs("div",{className:"flex items-center justify-between gap-4 px-3 py-2",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("span",{className:"text-xs font-medium text-default-500",children:"Holders"}),jsxs("label",{className:"flex cursor-pointer items-center gap-1 text-[11px] text-default-400",children:[jsx("input",{type:"checkbox",className:"size-3 accent-primary",checked:s,onChange:u=>n?.(u.target.checked)}),"Only Tracked"]})]}),jsx("div",{className:"flex items-center gap-1",children:Um.map(u=>jsx("button",{type:"button",onClick:()=>r(u.value),className:cn$1("rounded px-2 py-1 text-[11px] transition-colors",o===u.value?"bg-default-100 text-foreground":"text-default-400 hover:text-foreground"),children:u.label},u.value))})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[640px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-default-400",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[30%] px-3 py-2 text-left font-normal",children:"Wallet"}),jsx("th",{className:"w-[20%] px-3 py-2 text-left font-normal",children:"Tags"}),jsx("th",{className:"w-[15%] px-3 py-2 text-right font-normal",children:"Value"}),jsx("th",{className:"w-[10%] px-3 py-2 text-right font-normal",children:"%"}),jsx("th",{className:"w-[12%] px-3 py-2 text-right font-normal",children:"First held"}),jsx("th",{className:"w-[13%] px-3 py-2 text-right font-normal",children:"Last active"})]})}),jsxs("tbody",{children:[p.length===0&&!t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-8 text-center text-default-400",children:"No holders"})}),p.map(u=>jsx(Om,{holder:u,now:l,wellKnownAddresses:d,renderAddress:c},u.address)),t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-4 text-center text-default-400",children:"Loading\u2026"})})]})]})}),a&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:i,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-default-600 transition-colors hover:bg-default-200 disabled:opacity-50",children:"Load more"})})]})}function Om({holder:e,now:t,wellKnownAddresses:o,renderAddress:r}){let s=o?.[e.address],n=useMemo(()=>r?r(e.address):s?jsx("span",{className:"rounded bg-default-100 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-default-600",children:s}):jsx("span",{className:"font-mono text-[11px] text-default-500",children:ke(e.address,6,6)}),[e.address,r,s]);return jsxs("tr",{className:"border-b border-default-50 hover:bg-default-50/60",children:[jsx("td",{className:"px-3 py-2 align-middle",children:n}),jsx("td",{className:"px-3 py-2 align-middle",children:jsx(Dt,{tags:e.tags,max:3})}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:formatAmountUSDCompact(e.amountInUsd)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-500",children:vt(e.ratio)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:e.startHoldingAt?Pe(e.startHoldingAt,t):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:e.lastActiveAt?Pe(e.lastActiveAt,t):"--"})]})}function Ds({chain:e,address:t,limit:o=50,initialSortBy:r="holdingUsd"}){let[s,n]=useState(r),[i,a]=useState(void 0),[l,d]=useState([]),m=useCallback(()=>{a(void 0),d([]);},[]),c=useCallback(T=>{T!==s&&(n(T),m());},[s,m]);useEffect(()=>{m();},[e,t,m]);let p=useMemo(()=>({chain:e,address:t,cursor:i,limit:o,sortBy:s}),[e,t,i,o,s]),{data:u,isPending:g,isFetching:f}=useTokenHoldersQuery(p);useEffect(()=>{u&&d(T=>i==null?[u]:T[T.length-1]?.endCursor===u.endCursor?T:[...T,u]);},[u,i]),useTokenSubscription({chain:e,address:t},()=>{});let x=useMemo(()=>l.flatMap(T=>T.data),[l]),k=l[l.length-1],h=!!(k?.hasNext&&k.endCursor),b=useCallback(()=>{!k?.endCursor||!k.hasNext||a(k.endCursor);},[k]);return {holders:x,isLoading:g||f,sortBy:s,setSortBy:c,hasMore:h,loadMore:b}}function O0({chain:e,address:t,limit:o,initialSortBy:r,initialOnlyTracked:s=false,wellKnownAddresses:n,className:i,renderAddress:a}){let[l,d]=useState(s),{holders:m,isLoading:c,sortBy:p,setSortBy:u,hasMore:g,loadMore:f}=Ds({chain:e,address:t,limit:o,initialSortBy:r});return jsx(Ms,{holders:m,isLoading:c,sortBy:p,onSortByChange:u,onlyTracked:l,onOnlyTrackedChange:d,wellKnownAddresses:n,hasMore:g,onLoadMore:f,className:i,renderAddress:a})}var $m=[{value:"timestamp",label:"Latest"},{value:"totalUsd",label:"Top USD"}],Km=[{value:"all",label:"All"},{value:"buy",label:"Buys"},{value:"sell",label:"Sells"}],zm=[{value:"all",label:"All"},{value:"dev",label:"DEV"},{value:"tracked",label:"TRACKED"},{value:"you",label:"YOU"}];function Bs({activities:e,isLoading:t,sortBy:o,onSortByChange:r,typeFilter:s="all",onTypeFilterChange:n,traderFilter:i="all",onTraderFilterChange:a,youWalletAddress:l,currency:d="usd",onCurrencyChange:m,onLoadMore:c,hasMore:p,now:u=Date.now(),nativeDecimals:g=9,nativeSymbol:f="SOL",className:x,onRowClick:k}){let h=Qm(e,i,l);return jsxs("div",{className:cn$1("flex flex-col",x),children:[jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 px-3 py-2",children:[jsxs("div",{className:"flex items-center gap-1",children:[Km.map(b=>jsx("button",{type:"button",onClick:()=>n?.(b.value),className:cn$1("rounded px-2 py-1 text-[11px] transition-colors",s===b.value?"bg-default-100 text-foreground":"text-default-400 hover:text-foreground"),children:b.label},b.value)),jsx("span",{className:"mx-1 h-3 w-px bg-default-200","aria-hidden":true}),zm.map(b=>{let T=i===b.value,N=b.value==="you"&&!l;return jsx("button",{type:"button",disabled:N,onClick:()=>a?.(b.value),className:cn$1("rounded px-2 py-1 text-[11px] transition-colors",T?"bg-default-100 text-foreground":"text-default-400 hover:text-foreground",N&&"cursor-not-allowed opacity-50"),children:b.label},b.value)})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx(Gm,{value:d,nativeSymbol:f,onChange:m}),jsx("div",{className:"flex items-center gap-1",children:$m.map(b=>jsx("button",{type:"button",onClick:()=>r(b.value),className:cn$1("rounded px-2 py-1 text-[11px] transition-colors",o===b.value?"bg-default-100 text-foreground":"text-default-400 hover:text-foreground"),children:b.label},b.value))})]})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[780px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-default-400",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[10%] px-3 py-2 text-left font-normal",children:"Side"}),jsx("th",{className:"w-[25%] px-3 py-2 text-left font-normal",children:"Trader"}),jsx("th",{className:"w-[15%] px-3 py-2 text-right font-normal",children:"Amount"}),jsx("th",{className:"w-[15%] px-3 py-2 text-right font-normal",children:"USD"}),jsx("th",{className:"w-[15%] px-3 py-2 text-right font-normal",children:"Price"}),jsx("th",{className:"w-[10%] px-3 py-2 text-right font-normal",children:"Gas"}),jsx("th",{className:"w-[10%] px-3 py-2 text-right font-normal",children:"Age"})]})}),jsxs("tbody",{children:[h.length===0&&!t&&jsx("tr",{children:jsx("td",{colSpan:7,className:"py-8 text-center text-default-400",children:"No activities"})}),h.map(b=>jsx(Jm,{activity:b,now:u,nativeDecimals:g,nativeSymbol:f,currency:d,onRowClick:k},b.txHash)),t&&jsx("tr",{children:jsx("td",{colSpan:7,className:"py-4 text-center text-default-400",children:"Loading\u2026"})})]})]})}),p&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:c,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-default-600 transition-colors hover:bg-default-200 disabled:opacity-50",children:"Load more"})})]})}function qm(e){return e.type==="buy"?e.to:e.type==="sell"?e.from:e.to}function Qm(e,t,o){if(t==="all")return e;if(t==="you"){if(!o)return [];let s=o.toLowerCase();return e.filter(n=>n.walletAddress?.toLowerCase()===s)}if(t==="dev")return e.filter(s=>s.traderTags?.some(n=>n==="dev"));let r=new Set(["kol","smart","bluechip"]);return e.filter(s=>s.traderTags?.some(n=>r.has(n)))}function Gm({value:e,nativeSymbol:t,onChange:o}){return jsx("div",{className:"flex h-[22px] items-center rounded bg-default-100 p-[2px] text-[11px]",children:[{k:"usd",label:"USD"},{k:"native",label:t}].map(s=>jsx("button",{type:"button",onClick:()=>o?.(s.k),className:cn$1("rounded px-2 transition-colors",e===s.k?"bg-default-200 text-foreground":"text-default-400 hover:text-foreground"),children:s.label},s.k))})}function Xm(e,t,o){if(!e)return "--";let r=Number(e)/Math.pow(10,t);return Number.isFinite(r)?`${formatAmount(r)} ${o}`:"--"}function Jm({activity:e,now:t,nativeDecimals:o,nativeSymbol:r,currency:s,onRowClick:n}){let i=qm(e),a=e.type==="buy"?"Buy":e.type==="sell"?"Sell":e.type.replace(/_/g," "),l=e.type==="buy"?"text-bullish":e.type==="sell"?"text-bearish":"text-default-500";return jsxs("tr",{className:cn$1("border-b border-default-50 hover:bg-default-50/60",n&&"cursor-pointer"),onClick:n?()=>n(e):void 0,children:[jsx("td",{className:cn$1("px-3 py-2 align-middle font-medium capitalize",l),children:a}),jsx("td",{className:"px-3 py-2 align-middle",children:jsxs("div",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:"font-mono text-[11px] text-default-500",children:ke(e.walletAddress,6,6)}),jsx(Wr,{tags:e.traderTags,max:2})]})}),jsxs("td",{className:"px-3 py-2 text-right align-middle",children:[formatAmount(i.amount)," ",i.symbol]}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:s==="native"&&i.amountInNative?`${formatAmount(i.amountInNative)} ${i.symbol}`:i.amountInUsd?formatAmountUSDCompact(i.amountInUsd):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-500",children:i.priceInUsd?`$${formatPrice(i.priceInUsd)}`:"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:Xm(e.gasFee,o,r)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:Pe(e.time,t)})]})}function Vs({chain:e,address:t,limit:o=50,initialSortBy:r,initialTypeFilter:s="all"}){let[n,i]=useState(r),[a,l]=useState(s),[d,m]=useState(void 0),[c,p]=useState([]),[u,g]=useState([]),f=useCallback(()=>{m(void 0),p([]),g([]);},[]),x=useCallback(D=>{D!==n&&(i(D),f());},[n,f]),k=useCallback(D=>{D!==a&&(l(D),f());},[a,f]);useEffect(()=>{f();},[e,t,f]);let h=a==="all"?void 0:a,b=useMemo(()=>({chain:e,address:t,cursor:d,limit:o,sortBy:n,type:h}),[e,t,d,o,n,h]),{data:T,isPending:N,isFetching:y}=useTokenActivitiesQuery(b);useEffect(()=>{T&&p(D=>d==null?[T]:D[D.length-1]?.endCursor===T.endCursor?D:[...D,T]);},[T,d]);let P=(n==null||n==="timestamp")&&a==="all"&&d==null;useTokenActivitiesSubscription({chain:e,address:t},D=>{!P||!D?.length||g(ie=>{let B=new Set(ie.map(_=>_.txHash)),F=D.filter(_=>!B.has(_.txHash));return F.length===0?ie:[...F,...ie].slice(0,100)});});let L=useMemo(()=>{let D=c.flatMap(F=>F.data);if(!P||u.length===0)return D;let ie=new Set(D.map(F=>F.txHash));return [...u.filter(F=>!ie.has(F.txHash)),...D]},[c,u,P]),H=c[c.length-1],te=!!(H?.hasNext&&H.endCursor),Se=useCallback(()=>{!H?.endCursor||!H.hasNext||m(H.endCursor);},[H]);return {activities:L,isLoading:N||y,sortBy:n,setSortBy:x,typeFilter:a,setTypeFilter:k,hasMore:te,loadMore:Se}}function tN({chain:e,address:t,limit:o,initialSortBy:r,initialTypeFilter:s,initialTraderFilter:n="all",initialCurrency:i="usd",youWalletAddress:a,nativeDecimals:l,nativeSymbol:d,className:m,onRowClick:c}){let[p,u]=useState(n),[g,f]=useState(i),{activities:x,isLoading:k,sortBy:h,setSortBy:b,typeFilter:T,setTypeFilter:N,hasMore:y,loadMore:P}=Vs({chain:e,address:t,limit:o,initialSortBy:r,initialTypeFilter:s});return jsx(Bs,{activities:x,isLoading:k,sortBy:h,onSortByChange:b,typeFilter:T,onTypeFilterChange:N,traderFilter:p,onTraderFilterChange:u,youWalletAddress:a,currency:g,onCurrencyChange:f,hasMore:y,onLoadMore:P,className:m,nativeDecimals:l,nativeSymbol:d,onRowClick:c})}function $s({stats:e,resolution:t,className:o}){let r=e?.[t],s=r?.traders??0,n=r?.buyers??0,i=r?.sellers??0;return jsx(et,{className:o,label:`Traders (${t})`,totalFormatted:formatAmount(s),buysFormatted:formatAmount(n),sellsFormatted:formatAmount(i),totalValue:s,buysValue:n})}function Ks(e,t){return U(e,t)}function xN({chain:e,address:t,resolution:o="24h",className:r}){let{token:s}=Ks(e,t);return jsx($s,{stats:s?.stats,resolution:o,className:r})}function zs({stats:e,resolution:t,className:o}){let r=e?.[t],s=r?.trades??0,n=r?.buys??0,i=r?.sells??0;return jsx(et,{className:o,label:`Transactions (${t})`,totalFormatted:formatAmount(s),buysFormatted:formatAmount(n),sellsFormatted:formatAmount(i),totalValue:s,buysValue:n})}function qs(e,t){return U(e,t)}function IN({chain:e,address:t,resolution:o="24h",className:r}){let{token:s}=qs(e,t);return jsx(zs,{stats:s?.stats,resolution:o,className:r})}function Qs({stats:e,resolution:t,className:o}){let r=e?.[t],s=r?.volumesInUsd??"0",n=r?.buyVolumesInUsd??"0",i=r?.sellVolumesInUsd??"0";return jsx(et,{className:o,label:`Volume (${t})`,totalFormatted:formatAmountUSDCompact(s),buysFormatted:formatAmountUSDCompact(n),sellsFormatted:formatAmountUSDCompact(i),totalValue:s,buysValue:n})}function Gs(e,t){return U(e,t)}function qN({chain:e,address:t,resolution:o="24h",className:r}){let{token:s}=Gs(e,t);return jsx(Qs,{stats:s?.stats,resolution:o,className:r})}function Xs({security:e,externalUrl:t,externalLabel:o,className:r}){let s=[{title:"Transfer fee",value:e?.hasTransferFee,safeWhen:false,description:"Whether the token charges a fee on transfer."},{title:"Fee not upgradable",value:e?.isTransferFeeUpgradable,safeWhen:false,description:"Whether the transfer fee can be raised by the token owner."},{title:"Transferable",value:e?.isTransferable,safeWhen:true,description:"Whether token holders can freely transfer the token."},{title:"Not freezable",value:e?.isFreezable,safeWhen:false,description:"Whether the token authority can freeze holder balances."},{title:"Not closable",value:e?.isClosable,safeWhen:false,description:"Whether the token program can be closed by its owner."}],n=s.every(i=>i.value!==void 0&&i.value===i.safeWhen);return jsxs("section",{className:cn$1("flex w-full flex-col gap-3",r),children:[jsxs("div",{className:"flex items-baseline justify-between",children:[jsx("span",{className:"text-sm font-medium text-foreground",children:"Security"}),jsx("span",{className:cn$1("text-xs",e===void 0?"text-default-400":n?"text-success-500":"text-danger-500"),children:e===void 0?"--":n?"Safe":"Review"})]}),jsx("div",{className:"flex flex-col",children:s.map(i=>jsx(ip,{...i},i.title))}),t&&o&&jsx("div",{className:"flex justify-center",children:jsx("a",{href:t,target:"_blank",rel:"noreferrer noopener",className:"text-xs text-default-400 transition-colors hover:text-foreground",children:o})})]})}function ip({title:e,value:t,safeWhen:o,description:r}){let s=t!==void 0&&t===o,n=t===void 0?"--":s?"OK":"Risk";return jsxs("div",{className:"flex h-8 items-center justify-between gap-2",children:[jsx("span",{className:"text-xs text-default-500",title:r,children:e}),jsx("span",{className:cn$1("text-xs",t===void 0?"text-default-400":s?"text-success-500":"text-danger-500"),children:n})]})}function Js(e,t){let{data:o,isLoading:r}=useTokenSecurityQuery({chain:e,address:t});return {security:o,isLoading:r}}function iS({chain:e,address:t,externalUrl:o,externalLabel:r,className:s}){let{security:n}=Js(e,t);return jsx(Xs,{security:n,externalUrl:o,externalLabel:r,className:s})}function js({token:e,className:t}){return e?jsxs("section",{className:cn$1("flex w-full flex-col gap-2",t),children:[jsxs("div",{className:"text-sm font-medium text-foreground",children:["About ",e.symbol]}),e.description?jsx("p",{className:"whitespace-pre-line text-xs text-default-500",children:e.description}):jsx("p",{className:"text-xs text-default-400",children:"No description provided."})]}):null}function ei(e,t){return U(e,t)}function TS({chain:e,address:t,className:o}){let{token:r}=ei(e,t);return jsx(js,{token:r,className:o})}function ri({liquidities:e,totalTvlInUsd:t,collapseAt:o=3,className:r,onPoolClick:s}){let[n,i]=useState(!e||e.length<=o),a=useCallback(()=>i(l=>!l),[]);return jsxs("section",{className:cn$1("flex w-full flex-col gap-3",r),children:[jsxs("div",{className:"flex items-baseline justify-between",children:[jsx("span",{className:"text-sm font-medium text-foreground",children:"Liquidity"}),t&&jsx("span",{className:"text-xs text-foreground",children:formatAmountUSDCompact(t)})]}),(!e||e.length===0)&&jsx("div",{className:"py-4 text-center text-xs text-default-400",children:"No pools"}),e&&e.length>0&&jsxs("div",{className:"flex flex-col gap-2",children:[e.map((l,d)=>jsxs("div",{className:cn$1("flex h-10 w-full items-center justify-between overflow-hidden text-xs",d>=o&&!n&&"hidden",s&&"cursor-pointer hover:bg-default-50"),onClick:s?()=>s(l):void 0,children:[jsxs("div",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:"text-foreground",children:l.protocolFamily??l.protocolName??"Unknown"}),l.poolAddress&&jsxs("span",{className:"font-mono text-[10px] text-default-400",children:["Pool: ",ke(l.poolAddress,6,6)]})]}),jsx("div",{className:"text-default-500",children:formatAmountUSDCompact(l.tvlInUsd??0)})]},l.poolAddress??`${l.protocolFamily}-${d}`)),e.length>o&&jsx("div",{className:"flex justify-center pt-1",children:jsx("button",{type:"button",onClick:a,className:"rounded px-2 py-1 text-xs text-default-400 transition-colors hover:text-foreground",children:n?"Show less":"Show more"})})]})]})}function ni(e,t){return U(e,t)}function DS({chain:e,address:t,collapseAt:o,className:r,onPoolClick:s}){let{token:n}=ni(e,t);return jsx(ri,{liquidities:n?.liquidities,totalTvlInUsd:n?.marketData?.tvlInUsd,collapseAt:o,className:r,onPoolClick:s})}function si({cexes:e,collapseAt:t=4,className:o}){let[r,s]=useState(!e||e.length<=t),n=useCallback(()=>s(i=>!i),[]);return !e||e.length===0?null:jsxs("section",{className:cn$1("w-full",o),children:[jsx("div",{className:"text-sm font-medium text-foreground",children:"CEX listings"}),jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:e.map((i,a)=>{let l=a>=t&&!r,d=jsx(Chip,{startContent:i.logo?jsx(Image,{src:i.logo,width:20,height:20,alt:i.name}):void 0,className:cn$1("bg-default-100 text-xs",l&&"hidden"),children:i.name},i.id);return i.url?jsx("a",{href:i.url,target:"_blank",rel:"noreferrer noopener",className:cn$1(l&&"hidden"),children:d},i.id):d})}),e.length>t&&jsx("div",{className:"mt-3 flex justify-center",children:jsx("button",{type:"button",onClick:n,className:"rounded px-2 py-1 text-xs text-default-400 transition-colors hover:text-foreground",children:r?"Show less":"Show more"})})]})}function ii(e){return {cexes:e}}function YS({cexes:e,collapseAt:t,className:o}){let{cexes:r}=ii(e);return jsx(si,{cexes:r,collapseAt:t,className:o})}function li({categories:e,collapseAt:t=4,className:o,onCategoryClick:r}){let[s,n]=useState(!e||e.length<=t),i=useCallback(()=>n(a=>!a),[]);return !e||e.length===0?null:jsxs("section",{className:cn$1("w-full",o),children:[jsx("div",{className:"text-sm font-medium text-foreground",children:"Categories"}),jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:e.map((a,l)=>{let d=l>=t&&!s;return jsx(Chip,{size:"sm",className:cn$1("bg-default-100",d&&"hidden",r&&"cursor-pointer"),onClick:r?()=>r(a):void 0,children:a},a)})}),e.length>t&&jsx("div",{className:"mt-3 flex justify-center",children:jsx("button",{type:"button",onClick:i,className:"rounded px-2 py-1 text-xs text-default-400 transition-colors hover:text-foreground",children:s?"Show less":"Show more"})})]})}function di(e,t){return U(e,t)}function pC({chain:e,address:t,collapseAt:o,className:r,onCategoryClick:s}){let{token:n}=di(e,t);return jsx(li,{categories:n?.tags,collapseAt:o,className:r,onCategoryClick:s})}var ci=["5m","1h","4h","24h"];function mi({stats:e,resolution:t,className:o}){let r=e?.[t],s=new SafeBigNumber(r?.buyVolumesInUsd??0),n=new SafeBigNumber(r?.sellVolumesInUsd??0),i=s.plus(n),a=s.minus(n),l=i.eq(0)?50:Math.min(100,Math.max(0,s.div(i).times(100).toNumber())),d=[{label:`${t} Vol`,value:formatAmountUSDCompact(i.toString()),className:"text-foreground"},{label:"Buys",value:formatAmountUSDCompact(s.toString()),className:"text-bullish"},{label:"Sells",value:formatAmountUSDCompact(n.toString()),className:"text-bearish"},{label:"Net Vol.",value:formatAmountUSDCompact(a.abs().toString()),className:a.gte(0)?"text-bullish":"text-bearish"}];return jsxs("div",{className:cn$1("flex h-full w-full flex-col",o),children:[jsx("div",{className:"grid flex-1 grid-cols-4 items-center",children:d.map(m=>jsxs("div",{className:"flex flex-col items-start justify-center gap-[2px] px-2",children:[jsx("span",{className:"text-[10px] leading-none text-default-400",children:m.label}),jsx("span",{className:cn$1("text-[13px] font-medium leading-none tabular-nums",m.className),children:m.value})]},m.label))}),jsx("div",{className:"relative h-[2px] w-full overflow-hidden bg-bearish",children:jsx("div",{className:"absolute inset-y-0 left-0 bg-bullish transition-[width] duration-200 ease-out",style:{width:`${l}%`}})})]})}function pi({stats:e,resolutions:t,className:o}){return jsx("div",{className:cn$1("grid h-full w-full grid-cols-4 items-center",o),children:t.map(r=>{let n=e?.[r]?.priceChange,i=n?new SafeBigNumber(n):void 0,a=i?i.gte(0):void 0,l=r,d=i?formatPercent(i,{showPlusGtThanZero:true}):"\u2014";return jsxs("div",{className:"flex flex-col items-start justify-center gap-[2px] px-2",children:[jsx("span",{className:"text-[10px] leading-none text-default-400",children:l}),jsx("span",{className:cn$1("text-[13px] font-medium leading-none tabular-nums",a===void 0?"text-foreground":a?"text-bullish":"text-bearish"),children:d})]},r)})})}function ui({chain:e,address:t}){let{data:o,isLoading:r}=useTokenStatsQuery({chain:e,address:t});return {stats:o,isLoading:r}}function PC({chain:e,address:t,baseResolution:o="5m",hoverResolutions:r=ci,height:s=64,className:n}){let{stats:i}=ui({chain:e,address:t});return jsx(StatsFlipPanel,{className:n,height:s,base:jsx(mi,{stats:i,resolution:o}),hover:jsx(pi,{stats:i,resolutions:r})})}function fi({positions:e,isLoading:t,hasMore:o,onLoadMore:r,currency:s="usd",onCurrencyChange:n,showHidden:i=false,onShowHiddenChange:a,nativeSymbol:l="Native",renderActions:d,className:m}){return jsxs("div",{className:cn$1("flex flex-col",m),children:[jsxs("div",{className:"flex items-center justify-between gap-4 px-3 py-2",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("span",{className:"text-xs font-medium text-default-500",children:"Positions"}),jsxs("label",{className:"flex cursor-pointer items-center gap-1 text-[11px] text-default-400",children:[jsx("input",{type:"checkbox",className:"size-3 accent-primary",checked:i,onChange:c=>a?.(c.target.checked)}),"Show Hidden"]})]}),jsx(Hp,{value:s,nativeSymbol:l,onChange:n})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[720px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-default-400",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[26%] px-3 py-2 text-left font-normal",children:"Token"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"Bought"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"Sold"}),jsx("th",{className:"w-[16%] px-3 py-2 text-right font-normal",children:"Remaining"}),jsx("th",{className:"w-[18%] px-3 py-2 text-right font-normal",children:"PnL"}),jsx("th",{className:"w-[12%] px-3 py-2 text-right font-normal",children:"Actions"})]})}),jsxs("tbody",{children:[e.length===0&&!t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-8 text-center text-default-400",children:"No open positions"})}),e.map(c=>jsx(Fp,{position:c,currency:s,renderActions:d},`${c.chain}:${c.address}`)),t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-4 text-center text-default-400",children:"Loading\u2026"})})]})]})}),o&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:r,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-default-600 transition-colors hover:bg-default-200 disabled:opacity-50",children:"Load more"})})]})}function Hp({value:e,nativeSymbol:t,onChange:o}){return jsx("div",{className:"flex h-[24px] items-center rounded bg-default-100 p-[2px] text-[11px]",children:[{k:"usd",label:"USD"},{k:"native",label:t}].map(s=>jsx("button",{type:"button",onClick:()=>o?.(s.k),className:cn$1("rounded px-2 transition-colors",e===s.k?"bg-default-200 text-foreground":"text-default-400 hover:text-foreground"),children:s.label},s.k))})}function Fp({position:e,currency:t,renderActions:o}){let{bought:r,sold:s,remaining:n,pnl:i}=useMemo(()=>Mp(e,t),[e,t]),a=jsxs("div",{className:"flex items-center gap-2",children:[jsx(Avatar,{src:e.image??void 0,name:(e.symbol??"?").slice(0,1),className:"size-5 shrink-0 rounded-full bg-default-200 text-[10px]",showFallback:true}),jsxs("div",{className:"flex min-w-0 flex-col",children:[jsx("span",{className:"truncate text-foreground",children:e.symbol}),jsx("span",{className:"truncate text-[10px] text-default-400",children:e.name})]})]});return jsxs("tr",{className:"border-b border-default-50 hover:bg-default-50/60",children:[jsx("td",{className:"px-3 py-2 align-middle",children:a}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:r}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:s}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:n}),jsx("td",{className:cn$1("px-3 py-2 text-right align-middle font-medium",i.isPositive===void 0?"text-default-400":i.isPositive?"text-bullish":"text-bearish"),children:jsxs("div",{className:"flex flex-col items-end leading-tight",children:[jsx("span",{children:i.amount}),i.ratio?jsx("span",{className:"text-[10px]",children:i.ratio}):null]})}),jsx("td",{className:"px-3 py-2 text-right align-middle",children:o?o(e):jsx("span",{className:"text-default-400",children:"--"})})]})}function Mp(e,t){let o=t==="usd"?e.buyVolumesInUsd:e.buyVolumes,r=t==="usd"?e.sellVolumesInUsd:e.sellVolumes,s=t==="usd"?e.amountInUsd:e.amount,n=e.totalProfitInUsd,i=t==="usd"?formatAmountUSDCompact(o??0):formatAmount(o??0),a=t==="usd"?formatAmountUSDCompact(r??0):formatAmount(r??0),l=t==="usd"?formatAmountUSDCompact(s??0):formatAmount(s??0),d=n?new SafeBigNumber(n):void 0,m=d?d.gte(0):void 0,c=d?(m?"+":"")+formatAmountUSDCompact(d.toString()):"--",p=e.totalProfitRatio?formatPercent(e.totalProfitRatio,{showPlusGtThanZero:true}):void 0;return {bought:i,sold:a,remaining:l,pnl:{amount:c,ratio:p,isPositive:m}}}function ki({chain:e,wallet:t,limit:o=50,initialShowHidden:r=false}){let[s,n]=useState(void 0),[i,a]=useState([]),[l,d]=useState(r);useEffect(()=>{n(void 0),a([]);},[e,t]);let m=useMemo(()=>({chain:e,address:t??"",cursor:s,limit:o,positionState:"open"}),[e,t,s,o]),{data:c,isPending:p,isFetching:u}=useWalletTokenPositionsQuery(m,{enabled:!!t});useEffect(()=>{c&&a(h=>s==null?[c]:h[h.length-1]?.endCursor===c.endCursor?h:[...h,c]);},[c,s]);let g=useMemo(()=>i.flatMap(h=>h.portfolios),[i]),f=i[i.length-1],x=!!(f?.hasNext&&f.endCursor),k=useCallback(()=>{!f?.endCursor||!f.hasNext||n(f.endCursor);},[f]);return {positions:g,isLoading:!!t&&(p||u),hasMore:x,loadMore:k,showHidden:l,setShowHidden:d}}function qC({chain:e,wallet:t,limit:o,initialCurrency:r="usd",nativeSymbol:s,renderActions:n,className:i}){let[a,l]=useState(r),{positions:d,isLoading:m,hasMore:c,loadMore:p,showHidden:u,setShowHidden:g}=ki({chain:e,wallet:t,limit:o});return jsx(fi,{className:i,positions:d,isLoading:m,hasMore:c,onLoadMore:p,currency:a,onCurrencyChange:l,showHidden:u,onShowHiddenChange:g,nativeSymbol:s,renderActions:n})}function bi({orders:e,isLoading:t,unavailable:o,hasMore:r,onLoadMore:s,stateFilter:n,onStateFilterChange:i,onlyThisToken:a=false,onOnlyThisTokenChange:l,tokenSymbol:d,currency:m="usd",onCurrencyChange:c,nativeSymbol:p="Native",onCancelAll:u,renderActions:g,className:f}){return jsxs("div",{className:cn$1("flex flex-col",f),children:[jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 px-3 py-2",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"flex h-[24px] items-center rounded bg-default-100 p-[2px] text-[11px]",children:[{k:"active",label:"Active Orders"},{k:"history",label:"Order History"}].map(x=>jsx("button",{type:"button",onClick:()=>i(x.k),className:cn$1("rounded px-2 transition-colors",n===x.k?"bg-default-200 text-foreground":"text-default-400 hover:text-foreground"),children:x.label},x.k))}),d?jsxs("label",{className:"flex cursor-pointer items-center gap-1 text-[11px] text-default-400",children:[jsx("input",{type:"checkbox",className:"size-3 accent-primary",checked:a,onChange:x=>l?.(x.target.checked)}),"Only ",d]}):null]}),jsxs("div",{className:"flex items-center gap-2",children:[u?jsx("button",{type:"button",onClick:u,className:"rounded px-2 py-1 text-[11px] text-bearish transition-colors hover:bg-default-100",children:"Cancel All"}):null,jsx(_p,{value:m,nativeSymbol:p,onChange:c})]})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[760px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-default-400",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[22%] px-3 py-2 text-left font-normal",children:"Token"}),jsx("th",{className:"w-[10%] px-3 py-2 text-left font-normal",children:"Type"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"Amount"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"Current MC"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"Target MC"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"Settings"}),jsx("th",{className:"w-[12%] px-3 py-2 text-right font-normal",children:"Action"})]})}),jsxs("tbody",{children:[o?jsx("tr",{children:jsx("td",{colSpan:7,className:"py-10 text-center text-default-400",children:"Limit orders are coming soon."})}):e.length===0&&!t?jsx("tr",{children:jsxs("td",{colSpan:7,className:"py-10 text-center text-default-400",children:["No ",n==="active"?"active":"historical"," orders"]})}):e.map(x=>jsx($p,{order:x,currency:m,renderActions:g},x.id)),t&&!o&&jsx("tr",{children:jsx("td",{colSpan:7,className:"py-4 text-center text-default-400",children:"Loading\u2026"})})]})]})}),!o&&r&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:s,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-default-600 transition-colors hover:bg-default-200 disabled:opacity-50",children:"Load more"})})]})}function _p({value:e,nativeSymbol:t,onChange:o}){return jsx("div",{className:"flex h-[24px] items-center rounded bg-default-100 p-[2px] text-[11px]",children:[{k:"usd",label:"USD"},{k:"native",label:t}].map(s=>jsx("button",{type:"button",onClick:()=>o?.(s.k),className:cn$1("rounded px-2 transition-colors",e===s.k?"bg-default-200 text-foreground":"text-default-400 hover:text-foreground"),children:s.label},s.k))})}function $p({order:e,currency:t,renderActions:o}){let r=useMemo(()=>t==="usd"&&e.amountInUsd?formatAmountUSDCompact(e.amountInUsd):formatAmount(e.amount),[t,e.amount,e.amountInUsd]),s=e.side==="buy"?"Buy":"Sell",n=e.side==="buy"?"text-bullish":"text-bearish";return jsxs("tr",{className:"border-b border-default-50 hover:bg-default-50/60",children:[jsx("td",{className:"px-3 py-2 align-middle",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx(Avatar,{src:e.tokenImage??void 0,name:(e.tokenSymbol??"?").slice(0,1),className:"size-5 shrink-0 rounded-full bg-default-200 text-[10px]",showFallback:true}),jsx("span",{className:"truncate text-foreground",children:e.tokenSymbol??"--"})]})}),jsx("td",{className:cn$1("px-3 py-2 align-middle font-medium",n),children:s}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:r}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-500",children:e.currentMarketCapInUsd?formatAmountUSDCompact(e.currentMarketCapInUsd):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:e.targetMarketCapInUsd?formatAmountUSDCompact(e.targetMarketCapInUsd):e.targetPriceInUsd?formatAmountUSDCompact(e.targetPriceInUsd):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:e.slippage!=null?`Slip ${e.slippage}%`:"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle",children:o?o(e):jsx("span",{className:"text-default-400",children:"--"})})]})}function zp(e){return e instanceof Error&&e.code==="NotImplemented"}function qp(e){return e==="active"?"active":"filled"}function vi({chain:e,wallet:t,tokenAddress:o,limit:r=50,initialStateFilter:s="active",initialOnlyThisToken:n=false}){let[i,a]=useState(s),[l,d]=useState(n),[m,c]=useState(void 0),[p,u]=useState([]);useEffect(()=>{c(void 0),u([]);},[e,t,i,l,o]);let g=useCallback(H=>{H!==i&&a(H);},[i]),f=useMemo(()=>({chain:e,address:t??"",cursor:m,limit:r,state:qp(i),tokenAddress:l?o:void 0}),[e,t,m,r,i,l,o]),{data:x,isPending:k,isFetching:h,error:b}=useWalletLimitOrdersQuery(f,{enabled:!!t});useEffect(()=>{x&&u(H=>m==null?[x]:H[H.length-1]?.endCursor===x.endCursor?H:[...H,x]);},[x,m]);let T=!!b&&zp(b),N=useMemo(()=>p.flatMap(H=>H.data),[p]),y=p[p.length-1],P=!!(y?.hasNext&&y.endCursor),L=useCallback(()=>{!y?.endCursor||!y.hasNext||c(y.endCursor);},[y]);return {orders:N,isLoading:!!t&&!T&&(k||h),unavailable:T,hasMore:P,loadMore:L,stateFilter:i,setStateFilter:g,onlyThisToken:l,setOnlyThisToken:d}}function cw({chain:e,wallet:t,tokenAddress:o,tokenSymbol:r,limit:s,initialStateFilter:n="active",initialCurrency:i="usd",nativeSymbol:a,onCancelAll:l,renderActions:d,className:m}){let[c,p]=useState(i),{orders:u,isLoading:g,unavailable:f,hasMore:x,loadMore:k,stateFilter:h,setStateFilter:b,onlyThisToken:T,setOnlyThisToken:N}=vi({chain:e,wallet:t,tokenAddress:o,limit:s,initialStateFilter:n});return jsx(bi,{className:m,orders:u,isLoading:g,unavailable:f,hasMore:x,onLoadMore:k,stateFilter:h,onStateFilterChange:b,onlyThisToken:T,onOnlyThisTokenChange:N,tokenSymbol:r,currency:c,onCurrencyChange:p,nativeSymbol:a,onCancelAll:f?void 0:l,renderActions:d})}function Si({traders:e,isLoading:t,hasMore:o,onLoadMore:r,onlyTracked:s=false,onOnlyTrackedChange:n,now:i=Date.now(),renderAddress:a,className:l}){let{t:d}=useTranslation();return jsxs("div",{className:cn$1("flex flex-col",l),children:[jsxs("div",{className:"flex items-center justify-between gap-4 px-3 py-2",children:[jsx("span",{className:"text-xs font-medium text-default-500",children:d("tokens.tokenDetail.topTraders")}),jsxs("label",{className:"flex cursor-pointer items-center gap-1 text-[11px] text-default-400",children:[jsx("input",{type:"checkbox",className:"size-3 accent-primary",checked:s,onChange:m=>n?.(m.target.checked)}),"Only Tracked"]})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[680px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-default-400",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[28%] px-3 py-2 text-left font-normal",children:"Wallet"}),jsx("th",{className:"w-[20%] px-3 py-2 text-left font-normal",children:"Tags"}),jsx("th",{className:"w-[15%] px-3 py-2 text-right font-normal",children:"Value"}),jsx("th",{className:"w-[10%] px-3 py-2 text-right font-normal",children:"%"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"Realized PnL"}),jsx("th",{className:"w-[13%] px-3 py-2 text-right font-normal",children:"Last active"})]})}),jsxs("tbody",{children:[e.length===0&&!t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-8 text-center text-default-400",children:"No top traders yet"})}),e.map(m=>jsx(Zp,{trader:m,now:i,renderAddress:a},m.address)),t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-4 text-center text-default-400",children:"Loading\u2026"})})]})]})}),o&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:r,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-default-600 transition-colors hover:bg-default-200 disabled:opacity-50",children:"Load more"})})]})}function Zp({trader:e,now:t,renderAddress:o}){let r=useMemo(()=>o?o(e.address):jsx("span",{className:"font-mono text-[11px] text-default-500",children:ke(e.address,6,6)}),[e.address,o]);return jsxs("tr",{className:"border-b border-default-50 hover:bg-default-50/60",children:[jsx("td",{className:"px-3 py-2 align-middle",children:r}),jsx("td",{className:"px-3 py-2 align-middle",children:jsx(Dt,{tags:e.tags,max:3})}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:formatAmountUSDCompact(e.amountInUsd)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-500",children:"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:formatAmountUSDCompact(e.totalRealizedPnlInUsd)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:e.lastActiveAt?Pe(e.lastActiveAt,t):"--"})]})}function wi({chain:e,address:t,limit:o=50,initialSortBy:r,initialOnlyTracked:s=false}){let[n,i]=useState(r),[a,l]=useState(void 0),[d,m]=useState([]),[c,p]=useState(s),u=useCallback(()=>{l(void 0),m([]);},[]),g=useCallback(L=>{L!==n&&(i(L),u());},[u,n]);useEffect(()=>{u();},[e,t,u]);let f=useMemo(()=>({chain:e,address:t,cursor:a,limit:o,sortBy:n}),[e,t,a,o,n]),{data:x,isPending:k,isFetching:h}=useTokenTopTradersQuery(f);useEffect(()=>{x&&m(L=>a==null?[x]:L[L.length-1]?.endCursor===x.endCursor?L:[...L,x]);},[x,a]);let b=useMemo(()=>d.flatMap(L=>L.data),[d]),T=useMemo(()=>c?b.filter(L=>L.tags&&L.tags.length>0):b,[b,c]),N=d[d.length-1],y=!!(N?.hasNext&&N.endCursor),P=useCallback(()=>{!N?.endCursor||!N.hasNext||l(N.endCursor);},[N]);return {traders:T,isLoading:k||h,sortBy:n,setSortBy:g,hasMore:y,loadMore:P,onlyTracked:c,setOnlyTracked:p}}function Aw({chain:e,address:t,limit:o,className:r,renderAddress:s}){let{traders:n,isLoading:i,hasMore:a,loadMore:l,onlyTracked:d,setOnlyTracked:m}=wi({chain:e,address:t,limit:o});return jsx(Si,{className:r,traders:n,isLoading:i,hasMore:a,onLoadMore:l,onlyTracked:d,onOnlyTrackedChange:m,renderAddress:s})}function Pi({tokens:e,isLoading:t,unavailable:o,hasMore:r,onLoadMore:s,renderTokenLink:n,className:i}){return jsxs("div",{className:cn$1("flex flex-col",i),children:[jsx("div",{className:"flex items-center justify-between gap-4 px-3 py-2",children:jsx("span",{className:"text-xs font-medium text-default-500",children:"Dev Tokens"})}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[700px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-default-400",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[28%] px-3 py-2 text-left font-normal",children:"Token"}),jsx("th",{className:"w-[10%] px-3 py-2 text-center font-normal",children:"Migrated"}),jsx("th",{className:"w-[16%] px-3 py-2 text-right font-normal",children:"Market Cap"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"ATH"}),jsx("th",{className:"w-[16%] px-3 py-2 text-right font-normal",children:"Liquidity"}),jsx("th",{className:"w-[16%] px-3 py-2 text-right font-normal",children:"1h Volume"})]})}),jsxs("tbody",{children:[o?jsx("tr",{children:jsx("td",{colSpan:6,className:"py-10 text-center text-default-400",children:"Dev tokens index is coming soon."})}):e.length===0&&!t?jsx("tr",{children:jsx("td",{colSpan:6,className:"py-8 text-center text-default-400",children:"No dev tokens"})}):e.map(a=>jsx(ou,{token:a,renderTokenLink:n},`${a.chain}:${a.address}`)),!o&&t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-4 text-center text-default-400",children:"Loading\u2026"})})]})]})}),!o&&r&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:s,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-default-600 transition-colors hover:bg-default-200 disabled:opacity-50",children:"Load more"})})]})}function ou({token:e,renderTokenLink:t}){let o=e.marketData?.marketCapInUsd??e.marketData?.marketCap,r=e.marketData?.tvlInUsd,n=e.stats?.["1h"]?.volumesInUsd,i=!!e.migratedTo,a=t?t(e):jsxs("div",{className:"flex items-center gap-2",children:[jsx(Avatar,{src:e.image??void 0,name:(e.symbol??e.name??"?").slice(0,1),className:"size-5 shrink-0 rounded-full bg-default-200 text-[10px]",showFallback:true}),jsxs("div",{className:"flex min-w-0 flex-col",children:[jsx("span",{className:"truncate text-foreground",children:e.symbol}),jsx("span",{className:"truncate text-[10px] text-default-400",children:e.name})]})]});return jsxs("tr",{className:"border-b border-default-50 hover:bg-default-50/60",children:[jsx("td",{className:"px-3 py-2 align-middle",children:a}),jsx("td",{className:"px-3 py-2 text-center align-middle",children:i?jsx("span",{className:"text-bullish",children:"\u2713"}):jsx("span",{className:"text-default-400",children:"\u2014"})}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:o?formatAmountUSDCompact(o):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:r?formatAmountUSDCompact(r):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:n?formatAmountUSDCompact(n):"--"})]})}function Ri({tokens:e,className:t}){let o=e.length,r=e.filter(a=>!!a.migratedTo).length,s=o===0?0:Math.round(r/o*100),n=e.map(a=>a.stats?.["1h"]?.volumesInUsd??"0").reduce((a,l)=>a.plus(new SafeBigNumber(l)),new SafeBigNumber(0)),i=e.map(a=>a.marketData?.marketCapInUsd??a.marketData?.marketCap??"0").reduce((a,l)=>a.plus(new SafeBigNumber(l)),new SafeBigNumber(0));return jsxs("div",{className:cn$1("flex flex-col gap-2 p-3",t),children:[jsx("div",{className:"flex items-center justify-between",children:jsx("span",{className:"text-xs font-medium text-default-500",children:"Token Stats"})}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsx(po,{label:"Total",value:String(o)}),jsx(po,{label:"Migrated",value:`${r} (${s}%)`}),jsx(po,{label:"Total Market Cap",value:formatAmountUSDCompact(i.toString())}),jsx(po,{label:"Total 1h Volume",value:formatAmountUSDCompact(n.toString())})]})]})}function po({label:e,value:t}){return jsxs("div",{className:"flex flex-col gap-[2px]",children:[jsx("span",{className:"text-[10px] text-default-400",children:e}),jsx("span",{className:"text-[13px] font-medium text-foreground",children:t})]})}function su(e){return e instanceof Error&&e.code==="NotImplemented"}function Fi({chain:e,creator:t,limit:o=20}){let[r,s]=useState(void 0),[n,i]=useState([]);useEffect(()=>{s(void 0),i([]);},[e,t]);let a=useMemo(()=>({chain:e,creator:t??"",cursor:r,limit:o}),[e,t,r,o]),{data:l,isPending:d,isFetching:m,error:c}=useTokensByCreatorQuery(a,{enabled:!!t});useEffect(()=>{l&&i(k=>r==null?[l]:k[k.length-1]?.endCursor===l.endCursor?k:[...k,l]);},[l,r]);let p=!!c&&su(c),u=useMemo(()=>n.flatMap(k=>k.data),[n]),g=n[n.length-1],f=!!(g?.hasNext&&g.endCursor),x=useCallback(()=>{!g?.endCursor||!g.hasNext||s(g.endCursor);},[g]);return {tokens:u,isLoading:!!t&&!p&&(d||m),unavailable:p,hasMore:f,loadMore:x}}function qw({chain:e,creator:t,limit:o,showSummary:r=false,renderTokenLink:s,className:n}){let{tokens:i,isLoading:a,unavailable:l,hasMore:d,loadMore:m}=Fi({chain:e,creator:t,limit:o});return jsxs("div",{className:n,children:[jsx(Pi,{tokens:i,isLoading:a,unavailable:l,hasMore:d,onLoadMore:m,renderTokenLink:s}),r&&!l?jsx(Ri,{tokens:i}):null]})}function Oi({token:e,athInUsd:t,athAt:o,globalFeesPaidInUsd:r,rank:s,onTogglePin:n,pinned:i,className:a}){let l=e?.marketData?.priceInUsd,d=e?.marketData?.tvlInUsd,m=e?.marketData?.totalSupply;return jsxs("div",{className:cn$1("flex h-[48px] w-full flex-row items-center gap-4 overflow-x-auto px-3 text-[12px]",a),children:[jsx(lt,{label:"Price",value:l?formatPriceUSD(l):"--"}),jsx(lt,{label:"Liquidity",value:d?formatAmountUSDCompact(d):"--"}),jsx(lt,{label:"Supply",value:m?formatAmount(m):"--"}),r?jsx(lt,{label:"Fees Paid",value:formatAmountUSDCompact(r)}):null,t?jsx(lt,{label:"ATH",value:formatAmountUSDCompact(t),title:o?`All-time high at ${o.toLocaleDateString()}`:void 0}):null,s!==void 0?jsx(lt,{label:"Rank",value:`#${s}`}):null,jsx("div",{className:"flex-1"}),n?jsx("button",{type:"button",onClick:n,"aria-pressed":i,className:cn$1("flex size-[26px] items-center justify-center rounded text-default-400 transition-colors hover:bg-default-100 hover:text-foreground",i&&"text-foreground"),title:i?"Unpin token":"Pin token",children:i?"\u2605":"\u2606"}):null]})}function lt({label:e,value:t,title:o}){return jsxs("div",{className:"flex flex-col items-start justify-center gap-[2px] whitespace-nowrap",title:o,children:[jsx("span",{className:"text-[10px] leading-none text-default-400",children:e}),jsx("span",{className:"text-[13px] font-medium leading-none tabular-nums text-foreground",children:t})]})}function Bi({chain:e,address:t}){return U(e,t)}function aL({chain:e,address:t,athInUsd:o,athAt:r,globalFeesPaidInUsd:s,rank:n,pinned:i,onTogglePin:a,className:l}){let{token:d}=Bi({chain:e,address:t});return jsx(Oi,{className:l,token:d,athInUsd:o,athAt:r,globalFeesPaidInUsd:s,rank:n,pinned:i,onTogglePin:a})}function Ei({tokens:e,isLoading:t,unavailable:o,onTokenClick:r,className:s}){return o?jsx("div",{className:cn$1("flex items-center justify-center p-4 text-center text-[11px] text-default-400",s),children:"Similar tokens coming soon."}):!t&&e.length===0?jsx("div",{className:cn$1("flex items-center justify-center p-4 text-center text-[11px] text-default-400",s),children:"No similar tokens found."}):jsxs("ul",{className:cn$1("flex flex-col",s),children:[e.map(n=>jsxs("li",{className:cn$1("flex cursor-pointer items-center gap-2 border-b border-default-50 px-3 py-2 last:border-0 hover:bg-default-50/60",!r&&"cursor-default"),onClick:r?()=>r(n):void 0,children:[jsx(Avatar,{src:n.image??void 0,name:(n.symbol??"?").slice(0,1),className:"size-5 shrink-0 rounded-full bg-default-200 text-[10px]",showFallback:true}),jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[jsx("span",{className:"truncate text-[12px] text-foreground",children:n.symbol}),jsx("span",{className:"truncate text-[10px] text-default-400",children:n.name})]}),jsx("span",{className:"text-[11px] tabular-nums text-default-500",children:n.marketData?.marketCapInUsd?formatAmountUSDCompact(n.marketData.marketCapInUsd):"--"})]},`${n.chain}:${n.address}`)),t&&jsx("li",{className:"py-2 text-center text-[11px] text-default-400",children:"Loading\u2026"})]})}function Wi({chain:e,address:t,keyword:o,limit:r=10}){let s=!!o&&o.length>0,{data:n,isPending:i,isFetching:a}=useSearchTokensQuery({chains:[e],keyword:o,limit:r+1},{enabled:s});return {tokens:useMemo(()=>{if(!n)return [];let d=t.toLowerCase();return (n.data??[]).filter(m=>m.address.toLowerCase()!==d).slice(0,r)},[n,t,r]),isLoading:s&&(i||a),unavailable:!s}}function NL({chain:e,address:t,keyword:o,limit:r,onTokenClick:s,className:n}){let{tokens:i,isLoading:a,unavailable:l}=Wi({chain:e,address:t,keyword:o,limit:r});return jsx(Ei,{className:n,tokens:i,isLoading:a,unavailable:l,onTokenClick:s})}function Vi({tokens:e=[],unavailable:t=true,onTokenClick:o,className:r}){return t?jsx("div",{className:cn$1("flex items-center justify-center p-4 text-center text-[11px] text-default-400",r),children:"Image-similarity search is coming soon."}):e.length===0?jsx("div",{className:cn$1("flex items-center justify-center p-4 text-center text-[11px] text-default-400",r),children:"No reused-image tokens found."}):jsx("div",{className:cn$1("flex flex-row flex-wrap gap-2 p-3",r),children:e.map(s=>jsx("button",{type:"button",onClick:o?()=>o(s):void 0,className:"flex size-10 items-center justify-center overflow-hidden rounded-full border border-default-100 transition-opacity hover:opacity-80",title:s.symbol,children:jsx(Avatar,{src:s.image??void 0,name:(s.symbol??"?").slice(0,1),className:"size-full bg-default-100 text-[10px] text-default-400",showFallback:true})},`${s.chain}:${s.address}`))})}function _i(e){return {tokens:[],isLoading:false,unavailable:true}}function OL({chain:e,address:t,onTokenClick:o,className:r}){let{tokens:s,unavailable:n}=_i();return jsx(Vi,{className:r,tokens:s,unavailable:n,onTokenClick:o})}function Qi({keywords:e,excludeKeywords:t,onKeywordsChange:o,onExcludeKeywordsChange:r,className:s}){let{t:n}=useTranslation(),[i,a]=useState(e?.join(", ")??""),[l,d]=useState(t?.join(", ")??"");useEffect(()=>{a(p=>{let u=fo(p);return u===void 0&&e===void 0?p:u===void 0?e?.join(", ")??"":e===void 0?"":u.join("")===e.join("")?p:e.join(", ")});},[e]),useEffect(()=>{d(p=>{let u=fo(p);return u===void 0&&t===void 0?p:u===void 0?t?.join(", ")??"":t===void 0?"":u.join("")===t.join("")?p:t.join(", ")});},[t]);let m=useCallback(p=>{a(p),o?.(fo(p));},[o]),c=useCallback(p=>{d(p),r?.(fo(p));},[r]);return jsxs("div",{className:cn$1("grid grid-cols-2 gap-3 px-4",s),children:[jsxs("div",{className:"flex flex-col gap-3",children:[jsx("h3",{className:"text-xs text-neutral",children:n("tokens.filters.keywords.title")}),jsx(StyledInput,{variant:"bordered",radius:"lg",size:"sm",placeholder:n("tokens.filters.keywords.placeholder"),value:i,onValueChange:m})]}),jsxs("div",{className:"flex flex-col gap-3",children:[jsx("h3",{className:"text-xs text-neutral",children:n("tokens.filters.keywords.exclude.title")}),jsx(StyledInput,{variant:"bordered",radius:"lg",size:"sm",placeholder:n("tokens.filters.keywords.placeholder"),value:l,onValueChange:c})]})]})}function fo(e){let t=e.split(",").map(o=>o.trim()).filter(Boolean);return t.length>0?t:void 0}function ji({protocols:e,selectedProtocols:t=[],onSelectedProtocolsChange:o,className:r}){let{t:s}=useTranslation(),[n,i]=useState(t);useEffect(()=>{i(t);},[t]);let a=useMemo(()=>e.every(m=>n.includes(m)),[e,n]),l=useCallback(()=>{if(a){let m=[];i(m),o?.(m);}else {let m=[...e];i(m),o?.(m);}},[e,o,a]),d=useCallback(m=>()=>{if(n.includes(m)){let c=n.filter(p=>p!==m);i(c),o?.(c);}else {let c=[...n,m];i(c),o?.(c);}},[n,o]);return jsxs("div",{className:cn$1("flex flex-col gap-3 px-4",r),children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("h3",{className:"text-xs text-neutral",children:s("tokens.filters.protocols.title")}),jsx(Button,{variant:"light",color:"default",size:"sm",radius:"full",onPress:l,children:s(a?"tokens.filters.protocols.unselectAll":"tokens.filters.protocols.selectAll")})]}),jsx("div",{className:"grid grid-cols-3 gap-3",children:e.map(m=>{let c=Oe(m);return jsx(Button,{variant:"bordered",size:"sm",radius:"full",className:cn$1("w-fit h-6 px-2.5",c.text,c.bg5,"border",c.border,{"opacity-40 data-[hover=true]:!opacity-30":!n.includes(m)}),startContent:jsx(Image,{width:14,height:14,src:`/images/protocols/${m}.svg`,alt:formatTokenProtocolName(m)}),onPress:d(m),children:formatTokenProtocolName(m)},m)})})]})}function ye({title:e,field:t,value:o,onChange:r}){let{t:s}=useTranslation(),[n,i]=useState(o?kr(o).min:NaN),[a,l]=useState(o?kr(o).max:NaN);useEffect(()=>{if(o===void 0)i(NaN),l(NaN);else {let{min:c,max:p}=kr(o);i(c),l(p);}},[o]);let d=useCallback(c=>{i(c),r?.(ra(t,c,a));},[t,r,a]),m=useCallback(c=>{l(c),r?.(ra(t,n,c));},[t,r,n]);return jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsx("h3",{className:"text-xs text-neutral",children:e}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsx(StyledNumberInput,{value:n,onValueChange:d,variant:"bordered",radius:"lg",size:"sm",placeholder:s("tokens.filters.stats.min"),"aria-label":`${e} min`}),jsx(StyledNumberInput,{value:a,onValueChange:m,variant:"bordered",radius:"lg",size:"sm",placeholder:s("tokens.filters.stats.max"),"aria-label":`${e} max`})]})]})}function kr(e){if(e.operator==="between"){let[t,o]=e.value;return {min:t,max:o}}return e.operator==="gte"?{min:e.value,max:NaN}:e.operator==="lte"?{min:NaN,max:e.value}:{min:NaN,max:NaN}}function ra(e,t,o){if(!(isNaN(t)&&isNaN(o)))return isNaN(t)?{field:e,operator:"lte",value:o}:isNaN(o)?{field:e,operator:"gte",value:t}:{field:e,operator:"between",value:[t,o]}}function sa({values:e,onValuesChange:t,className:o}){let{t:r}=useTranslation(),[s,n]=useState(e);useEffect(()=>{n(e);},[e]);let i=useCallback(a=>l=>{if(l===void 0){let d=(s??[]).filter(m=>m.field!==a);d=d.length>0?d:void 0,n(d),t?.(d);}else {let d=[...(s??[]).filter(m=>m.field!==a),l];n(d),t?.(d);}},[s,t]);return jsxs("div",{className:cn$1("flex flex-col gap-4",o),children:[jsx(ye,{field:"holders",title:r("tokens.filters.stats.audits.holders"),value:s?.find(a=>a.field==="holders"),onChange:i("holders")}),jsx(ye,{field:"top10Ratio",title:r("tokens.filters.stats.audits.top10HoldingsRatio"),value:s?.find(a=>a.field==="top10Ratio"),onChange:i("top10Ratio")}),jsx(ye,{field:"top100Ratio",title:r("tokens.filters.stats.audits.top100HoldingsRatio"),value:s?.find(a=>a.field==="top100Ratio"),onChange:i("top100Ratio")}),jsx(ye,{field:"creatorsRatio",title:r("tokens.filters.stats.audits.devHoldingsRatio"),value:s?.find(a=>a.field==="creatorsRatio"),onChange:i("creatorsRatio")})]})}function ia({resolution:e,values:t,onValuesChange:o,className:r}){let{t:s}=useTranslation(),[n,i]=useState(t);useEffect(()=>{i(t);},[t]);let a=useCallback(l=>d=>{if(d===void 0){let m=(n??[]).filter(c=>c.field!==l);m=m.length>0?m:void 0,i(m),o?.(m);}else {let m=[...(n??[]).filter(c=>c.field!==l),d];i(m),o?.(m);}},[n,o]);return jsxs("div",{className:cn$1("flex flex-col gap-4",r),children:[jsx(ye,{field:"marketCap",title:s("tokens.filters.stats.metrics.marketCap"),value:n?.find(l=>l.field==="marketCap"),onChange:a("marketCap")}),jsx(ye,{field:"tvl",title:s("tokens.filters.stats.metrics.liquidity"),value:n?.find(l=>l.field==="tvl"),onChange:a("tvl")}),jsx(ye,{field:`volumes${e}`,title:s("tokens.filters.stats.metrics.volumes",{resolution:s(`common.resolution.${e}`)}),value:n?.find(l=>l.field===`volumes${e}`),onChange:a(`volumes${e}`)}),jsx(ye,{field:`trades${e}`,title:s("tokens.filters.stats.metrics.txns",{resolution:s(`common.resolution.${e}`)}),value:n?.find(l=>l.field===`trades${e}`),onChange:a(`trades${e}`)})]})}function pa({resolution:e,values:t,onValuesChange:o,className:r}){let{t:s}=useTranslation(),[n,i]=useState("audits"),[a,l]=useState(t);useEffect(()=>{l(t);},[t]);let d=useCallback(p=>{l(p),o?.(p);},[o]),m=useMemo(()=>{let p=["holders","top10Ratio","top100Ratio","creatorsRatio"];return a?.filter(u=>p.includes(u.field))?.length??0},[a]),c=useMemo(()=>{let p=["marketCap","tvl",`volumes${e}`,`trades${e}`];return a?.filter(u=>p.includes(u.field)).length??0},[a,e]);return jsxs("div",{className:cn$1("flex flex-col gap-3 px-4",r),children:[jsxs(StyledLightTabs,{color:"default",radius:"full",size:"sm",selectedKey:n,onSelectionChange:i,children:[jsx(Tab,{title:m===0?s("tokens.filters.stats.audits"):jsx(StyledBadge,{color:"primary",size:"sm",content:m,shape:"circle",children:s("tokens.filters.stats.audits")})},"audits"),jsx(Tab,{title:c===0?s("tokens.filters.stats.metrics"):jsx(StyledBadge,{color:"primary",size:"sm",content:c,shape:"circle",children:s("tokens.filters.stats.metrics")})},"metrics")]}),jsx(sa,{values:a,onValuesChange:d,className:cn$1({hidden:n!=="audits"})}),jsx(ia,{values:a,onValuesChange:d,resolution:e,className:cn$1({hidden:n!=="metrics"})})]})}function vo({protocols:e,resolution:t,filters:o,onFiltersChange:r,className:s}){let[n,i]=useState(ua(o?.filters,e));useEffect(()=>{i(ua(o?.filters,e));},[o?.filters,e]);let[a,l]=useState(o?.keywords);useEffect(()=>{l(o?.keywords);},[o?.keywords]);let[d,m]=useState(o?.excludeKeywords);useEffect(()=>{m(o?.excludeKeywords);},[o?.excludeKeywords]);let[c,p]=useState(o?.filters);useEffect(()=>{p(o?.filters);},[o?.filters]);let u=useCallback(k=>{i(k),r?.(yo(e,k,a,d,c));},[e,a,d,c,r]),g=useCallback(k=>{l(k),r?.(yo(e,n,k,d,c));},[e,n,d,c,r]),f=useCallback(k=>{m(k),r?.(yo(e,n,a,k,c));},[e,n,a,c,r]),x=useCallback(k=>{p(k),r?.(yo(e,n,a,d,k));},[e,n,a,d,r]);return jsxs("div",{className:cn$1("flex flex-col gap-4",s),children:[e&&e.length>0&&jsxs(Fragment,{children:[jsx(ji,{protocols:e,selectedProtocols:n,onSelectedProtocolsChange:u}),jsx("div",{style:{height:1,background:"rgba(39,39,42,1)"}})]}),jsx(Qi,{keywords:a,excludeKeywords:d,onKeywordsChange:g,onExcludeKeywordsChange:f}),jsx("div",{style:{height:1,background:"rgba(39,39,42,1)"}}),jsx(pa,{resolution:t,values:c,onValuesChange:x})]})}function ua(e,t){let o=e?.find(r=>r.field==="launchedFromProtocolFamily");return o?o.operator==="in"?o.value:(console.warn("invalid token protocols filter",o),[...t||[]]):[...t||[]]}function yo(e,t,o,r,s){let n=s?[...s.filter(i=>i.field!=="launchedFromProtocolFamily")]:[];return e&&e.length>0&&(e.every(a=>t.includes(a))||n.push({field:"launchedFromProtocolFamily",operator:"in",value:t})),o===void 0&&r===void 0&&n.length===0?void 0:{keywords:o,excludeKeywords:r,filters:n.length>0?n:void 0}}function ka({protocols:e,resolution:t,filters:o,onFiltersChange:r,triggerVariant:s="default",badgePlacement:n="outer",className:i}){let{t:a}=useTranslation(),{isOpen:l,onOpen:d,onClose:m,onOpenChange:c}=useDisclosure(),[p,u]=useState(o),g=useCallback(()=>{u(void 0);},[]),f=useCallback(()=>{r?.(p),m();},[p,r,m]);useEffect(()=>{u(o);},[l,o]);let x=useMemo(()=>Object.values(o||{}).every(k=>k===void 0),[o]);return jsxs(Fragment,{children:[jsxs("button",{type:"button",className:i,onClick:d,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:9999,border:s==="plain"?"none":"1px solid rgba(63,63,70,0.5)",background:s==="plain"?"transparent":"rgba(39,39,42,0.6)",width:32,height:32,minHeight:32,padding:0,cursor:"pointer",position:"relative"},children:[jsx(FilterIcon,{width:16,height:16,className:"text-zinc-400"}),!x&&jsx("span",{style:{position:"absolute",top:n==="icon"?6:-2,right:n==="icon"?6:-2,width:8,height:8,borderRadius:4,background:"#c7ff2e"}})]}),jsx(StyledModal,{isOpen:l,onOpenChange:c,size:"md",scrollBehavior:"inside",children:jsxs(ModalContent,{className:"w-full h-full",children:[jsx(ModalHeader,{className:"px-4 py-2",children:jsx("span",{className:"text-base font-semibold",children:a("tokens.filters.modal.title")})}),jsx(ModalBody,{className:"px-0 pt-0 pb-4",children:jsx(ScrollShadow,{children:jsx(vo,{protocols:e,resolution:t,filters:p,onFiltersChange:u,className:"pb-4"})})}),jsx(ModalFooter,{className:"px-4",children:jsxs("div",{className:"w-full flex justify-between items-center",children:[jsx(Button,{variant:"light",color:"default",size:"sm",radius:"full",startContent:jsx(RefreshIcon,{width:16,height:16}),onPress:g,children:a("common.reset")}),jsx(Button,{color:"primary",size:"sm",radius:"full",onPress:f,children:a("common.apply")})]})})]})})]})}var ya={display:"inline-flex",alignItems:"center",gap:8,borderRadius:9999,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"6px 12px",fontSize:14,fontWeight:700,color:"#d4d4d8",cursor:"pointer",transition:"all 0.15s",height:32},mf={position:"absolute",right:0,top:"100%",zIndex:20,marginTop:8,borderRadius:14,border:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"},pf={height:1,background:"rgba(39,39,42,1)",margin:0};function va({protocols:e,resolution:t,filters:o,onFiltersChange:r,iconOnly:s=false,className:n}){let{t:i}=useTranslation(),[a,l]=useState(false),d=useRef(null),[m,c]=useState(o),p=useCallback(()=>{c(void 0);},[]),u=useCallback(()=>{r?.(m),l(false);},[m,r]);useEffect(()=>{c(o);},[a,o]),useEffect(()=>{let f=x=>{d.current&&!d.current.contains(x.target)&&l(false);};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]),useEffect(()=>{if(!a)return;let f=x=>{x.key==="Escape"&&l(false);};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[a]);let g=useMemo(()=>Object.values(o||{}).every(f=>f===void 0),[o]);return jsxs("div",{ref:d,style:{position:"relative"},children:[jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxs("button",{type:"button",className:n,style:s?{...ya,justifyContent:"center",gap:0,width:32,minWidth:32,padding:0}:ya,onMouseEnter:f=>{f.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:f=>{f.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>l(f=>!f),children:[jsx(FilterIcon,{width:16,height:16,className:"flex-none"}),!s&&jsxs(Fragment,{children:[jsx("span",{className:"hidden sm:block",children:i("tokens.listHeader.filter")}),jsx(uf,{open:a})]})]}),!g&&jsx("span",{style:{position:"absolute",top:-4,right:-4,minWidth:8,height:8,borderRadius:4,background:"#c7ff2e"}})]}),a&&jsxs("div",{style:{...mf,width:420},children:[jsx("div",{style:{padding:"16px 0"},children:jsx(ScrollShadow,{className:"w-full max-h-120 px-4",children:jsx(vo,{protocols:e,resolution:t,filters:m,onFiltersChange:c})})}),jsx("div",{style:pf}),jsxs("div",{style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsx(Button,{variant:"light",size:"sm",color:"default",radius:"full",startContent:jsx(RefreshIcon,{width:16,height:16}),onPress:p,children:i("common.reset")}),jsx(Button,{variant:"solid",size:"sm",color:"primary",radius:"full",onPress:u,children:i("common.apply")})]})]})]})}function uf({open:e}){return jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#71717a",transition:"transform 0.15s",transform:e?"rotate(180deg)":void 0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"m6 9 6 6 6-6"})})}function P1({popoverPlacement:e="bottom-end",iconOnly:t,className:o,desktopOverlay:r="popover",...s}){let{isMobile:n}=useScreen();return n||r==="modal"?jsx(ka,{className:o,...s}):jsx(va,{placement:e,iconOnly:t,className:o,...s})}function Ca({resolution:e,onResolutionChange:t,resolutionOptions:o=["1m","5m","1h","4h","24h"]}){let{t:r}=useTranslation(),s=useCallback(n=>{t?.(n);},[t]);return jsx(StyledPlainTabs,{color:"primary",radius:"lg",selectedKey:e,onSelectionChange:s,"aria-label":"Select Resolution",classNames:{tabList:"gap-0",tab:"px-2",tabContent:"!text-zinc-500 group-data-[hover=true]:!text-foreground group-data-[selected=true]:!text-primary"},children:o.map(n=>jsx(Tab,{title:r(`common.resolution.${n}`)},n))})}var Lf={display:"inline-flex",alignItems:"center",gap:4,borderRadius:9999,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"0 10px",fontSize:12,fontWeight:500,color:"#d4d4d8",cursor:"pointer",height:32,minHeight:32},Pf={position:"absolute",left:0,top:"100%",zIndex:20,marginTop:6,borderRadius:14,border:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden",padding:"6px",minWidth:"100%"};function La({resolution:e,onResolutionChange:t,resolutionOptions:o=["1m","5m","1h","4h","24h"]}){let{t:r}=useTranslation(),[s,n]=useState(false),i=useRef(null),a=useCallback(l=>{t?.(l),n(false);},[t]);return useEffect(()=>{if(!s)return;let l=m=>{i.current&&!i.current.contains(m.target)&&n(false);},d=m=>{m.key==="Escape"&&n(false);};return document.addEventListener("mousedown",l),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",d);}},[s]),jsxs("div",{ref:i,style:{position:"relative",zIndex:50},children:[jsxs("button",{type:"button",style:Lf,onClick:()=>n(l=>!l),children:[jsx("span",{children:e?r(`common.resolution.${e}`):"\u2014"}),jsx(ChevronDownIcon,{width:14,height:14,className:"text-zinc-500",style:{transition:"transform 0.15s",transform:s?"rotate(180deg)":void 0}})]}),s&&jsx("div",{style:Pf,children:o.map(l=>jsx("button",{type:"button",onClick:()=>a(l),className:cn$1("w-full text-left px-3 py-1.5 rounded-lg text-xs font-medium transition-colors cursor-pointer",l===e?"text-primary bg-primary/10":"text-zinc-400 hover:text-foreground hover:bg-zinc-800"),children:r(`common.resolution.${l}`)},l))})]})}function z1(e){let{isMobile:t}=useScreen();return t?jsx(La,{...e}):jsx(Ca,{...e})}var Aa=memo(function({token:t}){let{t:o}=useTranslation(),r=useMemo(()=>t.marketData?.bluechipHoldingsRatio,[t.marketData?.bluechipHoldingsRatio]),s=useMemo(()=>r!==void 0&&new SafeBigNumber(r).gte(.1),[r]),n=useMemo(()=>r===void 0||new SafeBigNumber(r).lt(.05),[r]);return jsx(StyledTooltip,{content:o("tokens.bluechip.explained"),children:jsxs("div",{className:"flex items-center gap-2.5",children:[s&&jsx(HorsePowerHighIcon,{}),n&&jsx(HorsePowerLowIcon,{}),!s&&!n&&jsx(HorsePowerIcon,{}),jsx("span",{className:cn$1(s&&"text-bullish",!s&&!n&&"text-bearish",r===void 0&&"text-neutral"),children:formatPercent(r)})]})})});function Zf(e){return e.length<=10?e:`${e.slice(0,4)}...${e.slice(-4)}`}var Da=memo(function({token:t}){let o=useCopyToClipboard(),[r,s]=useState(false),[n,i]=useState(false),a=useRef(void 0),l=useRef(void 0),{t:d}=useTranslation(),m=useCallback(u=>{u.preventDefault(),u.stopPropagation(),o(t.name,()=>{toast.success(d("tokens.copied.name")),s(true),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{s(false);},2e3);});},[o,t.name,d]),c=useCallback(u=>{u.preventDefault(),u.stopPropagation(),o(t.address,()=>{toast.success(d("tokens.copied.address")),i(true),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{i(false);},2e3);});},[o,t.address,d]);useEffect(()=>()=>{a.current&&clearTimeout(a.current),l.current&&clearTimeout(l.current);},[]);let p=useTickAge(t.createdAt);return jsxs("div",{className:"w-full flex justify-start items-center gap-3",children:[jsx(fe,{token:t,showProgress:false,className:"w-10 h-10 sm:w-16 sm:h-16 flex-none"}),jsxs("div",{className:"flex-auto flex flex-col gap-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsx("span",{className:"flex-none font-medium tracking-[-0.02em]",children:t.symbol}),jsx(StyledTooltip,{content:t.name,children:jsxs("div",{className:"flex-initial flex items-center gap-1 min-w-0 text-neutral hover:text-primary-200 cursor-pointer",onClick:m,children:[jsx("div",{className:"flex-initial whitespace-nowrap truncate",children:t.name}),r?jsx(CheckIcon,{className:"flex-none w-3 h-3 sm:w-3.5 sm:h-3.5"}):jsx(CopyIcon,{className:"flex-none w-3 h-3 sm:w-3.5 sm:h-3.5"})]})})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-primary text-xs sm:text-sm font-medium",children:formatAge(p)}),jsxs("button",{type:"button",className:"group flex items-center gap-1 min-w-0 max-w-28 sm:max-w-36 text-neutral hover:text-primary-200 cursor-pointer",onClick:c,"aria-label":d("tokens.copied.address"),children:[jsx("span",{className:"min-w-0 truncate text-left text-xs font-mono text-neutral/70 group-hover:text-primary-200",children:Zf(t.address)}),n?jsx(CheckIcon,{className:"flex-none w-3 h-3"}):jsx(CopyIcon,{className:"flex-none w-3 h-3"})]}),t.socialMedias?.website&&jsx(Link,{href:t.socialMedias.website,className:"max-sm:hidden text-neutral hover:text-primary",target:"_blank",children:jsx(WebsiteIcon,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})}),t.socialMedias?.twitter&&jsx(Link,{href:t.socialMedias.twitter,className:"max-sm:hidden text-neutral hover:text-primary",target:"_blank",children:jsx(TwitterIcon,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})}),t.socialMedias?.telegram&&jsx(Link,{href:t.socialMedias.telegram,className:"max-sm:hidden text-neutral hover:text-primary",target:"_blank",children:jsx(TelegramIcon,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})}),t.socialMedias?.discord&&jsx(Link,{href:t.socialMedias.discord,className:"max-sm:hidden text-neutral hover:text-primary",target:"_blank",children:jsx(DiscordIcon,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})}),jsx(Link,{href:searchTwitterUrl(`${t.symbol} OR ${t.address}`),className:"max-sm:hidden text-neutral hover:text-primary",target:"_blank",children:jsx(SearchIcon,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]})]})});var Ba=memo(function({token:t}){let{t:o}=useTranslation(),r=t.marketData,s=useMemo(()=>new SafeBigNumber(r?.top10HoldingsRatio).gte(.1),[r?.top10HoldingsRatio]),n=useMemo(()=>new SafeBigNumber(r?.devHoldingsRatio).gte(.1),[r?.devHoldingsRatio]),i=useMemo(()=>new SafeBigNumber(r?.sniperHoldingsRatio).gte(.1),[r?.sniperHoldingsRatio]),a=useMemo(()=>new SafeBigNumber(r?.insiderHoldingsRatio).gte(.1),[r?.insiderHoldingsRatio]),l=useMemo(()=>new SafeBigNumber(r?.bundleHoldingsRatio).gte(.1),[r?.bundleHoldingsRatio]);return jsxs("div",{className:"w-full h-full flex flex-col gap-1 justify-center",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsx(z,{icon:jsx(PeopleIcon,{width:12,height:12}),value:formatAmount(r?.holders),tooltip:o("tokens.tokenInfo.holders"),warning:false,disable:!r?.holders}),jsx(z,{icon:jsx(KlineCandlesIcon,{width:12,height:12}),value:formatAmount(r?.proHolders),tooltip:o("tokens.tokenInfo.proHolders"),warning:false,disable:!r?.proHolders}),jsx(z,{icon:jsx(StarIcon,{width:12,height:12}),value:formatAmount(r?.kolHolders),tooltip:o("tokens.tokenInfo.kolHolders"),warning:false,disable:!r?.kolHolders}),jsx(z,{icon:jsx(UserWithStarBadgeIcon,{width:12,height:12}),value:formatPercent(r?.top10HoldingsRatio),tooltip:o("tokens.tokenInfo.top10HoldingsRatio"),warning:s,disable:!r?.top10HoldingsRatio||r?.top10HoldingsRatio==="0"})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(z,{icon:jsx(CookIcon,{width:12,height:12}),value:formatPercent(r?.devHoldingsRatio),tooltip:o("tokens.tokenInfo.devHoldingsRatio"),warning:n,disable:!r?.devHoldingsRatio||r?.devHoldingsRatio==="0",tooltipPlacement:"bottom"}),jsx(z,{icon:jsx(SniperIcon,{width:12,height:12}),value:formatPercent(r?.sniperHoldingsRatio),tooltip:o("tokens.tokenInfo.sniperHoldingsRatio"),warning:i,disable:!r?.sniperHoldingsRatio||r?.sniperHoldingsRatio==="0",tooltipPlacement:"bottom"}),jsx(z,{icon:jsx(RatIcon,{width:12,height:12}),value:formatPercent(r?.insiderHoldingsRatio),tooltip:o("tokens.tokenInfo.insiderHoldingsRatio"),warning:a,disable:!r?.insiderHoldingsRatio||r?.insiderHoldingsRatio==="0",tooltipPlacement:"bottom"}),jsx(z,{icon:jsx(BundlesIcon,{width:12,height:12}),value:formatPercent(r?.bundleHoldingsRatio),tooltip:o("tokens.tokenInfo.bundleHoldingsRatio"),warning:l,disable:!r?.bundleHoldingsRatio||r?.bundleHoldingsRatio==="0",tooltipPlacement:"bottom"})]})]})});var Ea=memo(function({token:t}){let o=useMemo(()=>t.marketData?.tvlInUsd,[t.marketData?.tvlInUsd]);return jsx(Fragment,{children:formatAmountUSD(o)})});var Wa=memo(function({token:t}){let o=useMemo(()=>t.marketData?.marketCapInUsd,[t.marketData?.marketCapInUsd]);return jsx(Fragment,{children:formatAmountUSD(o)})});var $a=memo(function({token:t,resolution:o}){let r=useMemo(()=>t.marketData?.priceInUsd,[t.marketData?.priceInUsd]),s=useMemo(()=>t.stats?.[o]?.priceChange,[t,o]),n=useMemo(()=>s?new SafeBigNumber(s).abs().toString():void 0,[s]),i=useMemo(()=>s&&new SafeBigNumber(s).gte(0),[s]);return jsxs("div",{className:"flex flex-col gap-1 justify-center items-start",children:[jsx("span",{children:formatPriceUSD(r)}),jsxs("span",{className:cn$1("inline-flex gap-1 items-center text-xs",i?"text-bullish":"text-bearish"),children:[i?jsx(TriangleUpIcon,{width:10,height:10}):jsx(TriangleDownIcon,{width:10,height:10}),jsx("span",{children:formatPercent(n)})]})]})});var za=memo(function({token:t,resolution:o}){let r=useMemo(()=>t.stats?.[o]?.traders,[t.stats?.[o]?.traders]),s=useMemo(()=>t.stats?.[o]?.buyers,[t.stats?.[o]?.buyers]),n=useMemo(()=>t.stats?.[o]?.sellers,[t.stats?.[o]?.sellers]);return jsxs("div",{className:"flex flex-col gap-1 justify-center items-start",children:[jsx("span",{children:formatAmount(r)}),jsxs("div",{className:"flex gap-1 text-xs",children:[jsx("span",{className:"text-bullish",children:formatAmount(s)}),"/",jsx("span",{className:"text-bearish",children:formatAmount(n)})]})]})});var Qa=memo(function({token:t,resolution:o}){let r=useMemo(()=>t.stats?.[o]?.trades,[t.stats?.[o]?.trades]),s=useMemo(()=>t.stats?.[o]?.buys,[t.stats?.[o]?.buys]),n=useMemo(()=>t.stats?.[o]?.sells,[t.stats?.[o]?.sells]);return jsxs("div",{className:"flex flex-col gap-1 justify-center items-start",children:[jsx("span",{children:formatAmount(r)}),jsxs("div",{className:"flex gap-1 text-xs",children:[jsx("span",{className:"text-bullish",children:formatAmount(s)}),"/",jsx("span",{className:"text-bearish",children:formatAmount(n)})]})]})});var Xa=memo(function({token:t,resolution:o}){let r=useMemo(()=>t.stats?.[o]?.volumesInUsd,[t.stats?.[o]?.volumesInUsd]),s=useMemo(()=>t.stats?.[o]?.buyVolumesInUsd,[t.stats?.[o]?.buyVolumesInUsd]),n=useMemo(()=>t.stats?.[o]?.sellVolumesInUsd,[t.stats?.[o]?.sellVolumesInUsd]);return jsxs("div",{className:"flex flex-col gap-1 justify-center items-start",children:[jsx("span",{children:formatAmountUSD(r)}),jsxs("div",{className:"flex gap-1 text-xs",children:[jsx("span",{className:"text-bullish",children:formatAmountUSD(s)}),"/",jsx("span",{className:"text-bearish",children:formatAmountUSD(n)})]})]})});var Pg=`
22
22
  @keyframes tklShimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
23
- `,Rg={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:"tklShimmer 1.8s ease-in-out infinite",borderRadius:6};function V(e,t,o,r){return {...Rg,animationDelay:`${e}ms`,width:t,height:o,...r}}var Ja=10;function Ya({rowHeight:e,hasActions:t,isMobile:o}){return jsxs(Fragment,{children:[jsx("style",{children:Pg}),Array.from({length:Ja}).map((r,s)=>jsx(Ag,{index:s,rowHeight:e,hasActions:t,isMobile:o,isLast:s===Ja-1},s))]})}function Ag({index:e,rowHeight:t,hasActions:o,isMobile:r,isLast:s}){let n=e*80,i=r?208:320,a=r?40:64,l=r?72:124,d=r?64:97;return jsxs("div",{style:{display:"flex",alignItems:"center",height:t,borderBottom:s?void 0:"1px solid rgba(39,39,42,0.3)"},children:[jsxs("div",{style:{width:i,padding:r?"0 12px":"0 12px 0 24px",display:"flex",alignItems:"center",gap:12,flexShrink:0},children:[jsx("div",{style:V(n,a,a,{borderRadius:8,flexShrink:0})}),jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,flex:1},children:[jsx("div",{style:V(n+30,"60%",20)}),jsx("div",{style:V(n+60,"80%",16)})]})]}),jsxs("div",{style:{width:128,padding:"0 12px",display:"flex",flexDirection:"column",justifyContent:"center",gap:4},children:[jsx("div",{style:V(n+20,72,20)}),jsx("div",{style:V(n+40,52,16)})]}),jsx("div",{style:{width:106,padding:"0 12px",display:"flex",alignItems:"center"},children:jsx("div",{style:V(n+30,64,20)})}),jsx("div",{style:{width:106,padding:"0 12px",display:"flex",alignItems:"center"},children:jsx("div",{style:V(n+40,60,20)})}),jsxs("div",{style:{width:138,padding:"0 12px",display:"flex",flexDirection:"column",justifyContent:"center",gap:4},children:[jsx("div",{style:V(n+50,72,20)}),jsx("div",{style:V(n+70,100,16)})]}),jsxs("div",{style:{width:126,padding:"0 12px",display:"flex",flexDirection:"column",justifyContent:"center",gap:4},children:[jsx("div",{style:V(n+60,48,20)}),jsx("div",{style:V(n+80,80,16)})]}),jsxs("div",{style:{width:126,padding:"0 12px",display:"flex",flexDirection:"column",justifyContent:"center",gap:4},children:[jsx("div",{style:V(n+70,40,20)}),jsx("div",{style:V(n+90,72,16)})]}),jsxs("div",{style:{width:128,padding:"0 12px",display:"flex",alignItems:"center",gap:10},children:[jsx("div",{style:V(n+80,20,20,{borderRadius:4})}),jsx("div",{style:V(n+90,52,20)})]}),jsxs("div",{style:{width:308,padding:"0 12px",display:"flex",alignItems:"center",gap:20},children:[jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsx("div",{style:V(n+80,52,16)}),jsx("div",{style:V(n+100,40,16)}),jsx("div",{style:V(n+120,36,16)})]}),jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsx("div",{style:V(n+90,48,16)}),jsx("div",{style:V(n+110,40,16)}),jsx("div",{style:V(n+130,40,16)})]}),jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsx("div",{style:V(n+100,40,16)}),jsx("div",{style:V(n+120,36,16)})]})]}),o&&jsx("div",{style:{width:l,padding:r?"0 12px 0 0":"0 24px 0 12px",display:"flex",alignItems:"center",justifyContent:"flex-end"},children:jsx("div",{style:V(n+100,d,32,{borderRadius:8})})})]})}var Bg=100,Eg=200,Wg=72;function pt({tokens:e,resolution:t="24h",isLoading:o,ActionsComponent:r,onSelectToken:s,sortDirections:n,onSortChange:i,onScrollingChange:a,height:l=600,itemHeight:d=88,itemHeightMobile:m=72,className:c}){let{isMobile:p}=useScreen(),u=p?m:d,g=useMemo(()=>e.slice(0,Bg),[e]),f=!!o,x=useRef(void 0),k=useRef(false),{t:h}=useTranslation(),b=useCallback(F=>_=>{_.preventDefault(),_.stopPropagation(),s?.(F);},[s]),[T,N]=useState(n??{});useEffect(()=>{N(n??{});},[n]);let y=useCallback(F=>_=>{let gt={[F]:_};N(gt),i?.(gt);},[i]),P=useCallback(()=>{k.current||(k.current=true,a?.(true)),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{k.current=false,a?.(false);},180);},[a]);useEffect(()=>()=>{x.current&&clearTimeout(x.current),k.current&&a?.(false);},[a]);let L=cn$1("h-full mx-auto",c??(r?"max-w-362 sm:max-w-403":"max-w-331 sm:max-w-372")),H=r?"!w-[1438px] min-w-[1438px] max-w-[1438px]":"!w-[1366px] min-w-[1366px] max-w-[1366px]",te=[jsx(TableColumn,{textValue:h("tokens.listHeader.token"),width:p?Eg:320,className:cn$1("bg-[#0a0a0b] sticky left-0 z-10",p&&"!w-[200px] min-w-[200px] max-w-[200px] overflow-hidden","shadow-[1px_0_0_0_rgba(39,39,42,0.6)]"),children:h("tokens.listHeader.token")},"token"),jsx(TableColumn,{textValue:h("tokens.listHeader.price"),width:128,children:jsxs("div",{className:"flex items-center gap-1",children:[jsx(Sortable,{sort:T.price,onSortChange:y("price"),children:h("tokens.listHeader.price")}),jsx("span",{children:"/"}),jsx(Sortable,{sort:T[`priceChange${t}`],onSortChange:y(`priceChange${t}`),children:h("tokens.listHeader.priceChange",{resolution:t})})]})},"price"),jsx(TableColumn,{textValue:h("tokens.listHeader.marketCap"),width:106,children:jsx(Sortable,{sort:T.marketCap,onSortChange:y("marketCap"),children:h("tokens.listHeader.marketCap")})},"marketCap"),jsx(TableColumn,{textValue:h("tokens.listHeader.liquidity"),width:106,children:jsx(Sortable,{sort:T.tvl,onSortChange:y("tvl"),children:h("tokens.listHeader.liquidity")})},"liquidity"),jsx(TableColumn,{textValue:h("tokens.listHeader.volumes",{resolution:t}),width:138,children:jsx(Sortable,{sort:T[`volumes${t}`],onSortChange:y(`volumes${t}`),children:h("tokens.listHeader.volumes",{resolution:t})})},"volumes"),jsx(TableColumn,{textValue:h("tokens.listHeader.txs",{resolution:t}),width:126,children:jsx(Sortable,{sort:T[`trades${t}`],onSortChange:y(`trades${t}`),children:h("tokens.listHeader.txs",{resolution:t})})},"txs"),jsx(TableColumn,{textValue:h("tokens.listHeader.traders",{resolution:t}),width:126,children:jsx(Sortable,{sort:T[`traders${t}`],onSortChange:y(`traders${t}`),children:h("tokens.listHeader.traders",{resolution:t})})},"traders"),jsx(TableColumn,{textValue:h("tokens.listHeader.bluechip"),width:128,children:h("tokens.listHeader.bluechip")},"bluechip"),jsx(TableColumn,{textValue:h("tokens.listHeader.tokenInfo"),width:308,children:h("tokens.listHeader.tokenInfo")},"tokenInfo"),r?jsx(TableColumn,{textValue:h("tokens.listHeader.actions"),width:p?Wg:124,align:"end",className:cn$1("bg-[#0a0a0b] sticky right-0 z-10",p&&"!w-[72px] min-w-[72px] max-w-[72px]","shadow-[-1px_0_0_0_rgba(39,39,42,0.6)]"),children:h("tokens.listHeader.actions")},"actions"):void 0].filter(Boolean),Se=jsx(Ya,{rowHeight:u,hasActions:!!r,isMobile:p}),D=jsxs("div",{children:[jsx(EmptyIcon,{className:"w-10 h-10 mx-auto text-neutral"}),jsx("p",{className:"mt-2 text-sm text-neutral text-center",children:h("common.empty")})]}),ie=F=>[jsx(TableCell,{className:cn$1("sticky left-0 z-10 bg-[#0a0a0b]",p&&"!w-[200px] min-w-[200px] max-w-[200px] overflow-hidden","shadow-[1px_0_0_0_rgba(39,39,42,0.6)]","transition-colors duration-150","[tr:hover_&]:!bg-[#101211]"),children:jsx(Da,{token:F,resolution:t})},"token"),jsx(TableCell,{children:jsx($a,{token:F,resolution:t})},"price"),jsx(TableCell,{children:jsx(Wa,{token:F,resolution:t})},"marketCap"),jsx(TableCell,{children:jsx(Ea,{token:F,resolution:t})},"liquidity"),jsx(TableCell,{children:jsx(Xa,{token:F,resolution:t})},"volumes"),jsx(TableCell,{children:jsx(Qa,{token:F,resolution:t})},"trades"),jsx(TableCell,{children:jsx(za,{token:F,resolution:t})},"traders"),jsx(TableCell,{children:jsx(Aa,{token:F,resolution:t})},"bluechip"),jsx(TableCell,{children:jsx(Ba,{token:F,resolution:t})},"tokenInfo"),r?jsx(TableCell,{className:cn$1("sticky right-0 z-10 bg-[#0a0a0b]",p&&"!w-[72px] min-w-[72px] max-w-[72px]","shadow-[-1px_0_0_0_rgba(39,39,42,0.6)]","transition-colors duration-150","[tr:hover_&]:!bg-[#101211]"),children:jsx("div",{className:cn$1("!absolute inset-y-0 right-3 z-1 w-fit","flex items-center justify-end"),children:jsx(r,{token:F,resolution:t})})},"actions"):void 0].filter(Boolean),B=F=>jsx(TableRow,{onClick:s?b(F):void 0,children:ie(F)},F.address);return p?jsx("div",{"data-token-list-mobile-scroll":true,className:cn$1("h-full min-h-0 w-full overflow-y-auto overflow-x-hidden overscroll-contain","mx-auto",c??(r?"max-w-362 sm:max-w-403":"max-w-331 sm:max-w-372")),style:{height:l},onScroll:P,children:jsx("div",{"data-token-list-horizontal-scroll":true,className:"w-full overflow-x-auto overflow-y-visible",children:jsxs(StyledTable,{isHeaderSticky:true,radius:"none",classNames:{table:cn$1("table-fixed",H),wrapper:"p-0 w-full !max-h-none !overflow-x-visible !overflow-y-visible bg-transparent rounded-none shadow-none",loadingWrapper:"flex-col justify-start items-start",emptyWrapper:"pt-30"},"aria-label":"Tokens",children:[jsx(TableHeader,{children:te}),jsx(TableBody,{items:g,isLoading:f,loadingContent:Se,emptyContent:D,children:B})]})})}):jsxs(StyledTable,{isHeaderSticky:true,isVirtualized:true,radius:"lg",className:L,classNames:{loadingWrapper:"flex-col justify-start items-start",emptyWrapper:"pt-30"},onScrollCapture:P,maxTableHeight:l,rowHeight:u,"aria-label":"Tokens",children:[jsx(TableHeader,{children:te}),jsx(TableBody,{items:e,isLoading:f,loadingContent:Se,emptyContent:D,children:B})]})}function sl({token:e,resolution:t,renderAction:o,isLast:r=false,onSelectToken:s,className:n}){let{t:i}=useTranslation(),a=useCopyToClipboard(),l=useTickAge(e.createdAt),d=useCallback(()=>{s?.(e);},[s,e]),m=useCallback(_=>{_.stopPropagation(),a(e.address,()=>toast.success(i("tokens.copied.address")));},[a,e.address,i]),c=e.marketData,p=e.stats?.[t],u=useMemo(()=>c?.priceInUsd,[c?.priceInUsd]),g=useMemo(()=>p?.priceChange,[p?.priceChange]),f=useMemo(()=>g&&new SafeBigNumber(g).gte(0),[g]),x=useMemo(()=>g?new SafeBigNumber(g).abs().toString():void 0,[g]),k=useMemo(()=>p?.volumesInUsd,[p?.volumesInUsd]),h=useMemo(()=>p?.buyVolumesInUsd,[p?.buyVolumesInUsd]),b=useMemo(()=>p?.sellVolumesInUsd,[p?.sellVolumesInUsd]),T=useMemo(()=>p?.trades,[p?.trades]),N=useMemo(()=>c?.marketCapInUsd,[c?.marketCapInUsd]),y=useMemo(()=>c?.tvlInUsd,[c?.tvlInUsd]),P=useMemo(()=>new SafeBigNumber(c?.top10HoldingsRatio).gte(.1),[c?.top10HoldingsRatio]),L=useMemo(()=>new SafeBigNumber(c?.devHoldingsRatio).gte(.1),[c?.devHoldingsRatio]),H=useMemo(()=>new SafeBigNumber(c?.sniperHoldingsRatio).gte(.1),[c?.sniperHoldingsRatio]),te=useMemo(()=>new SafeBigNumber(c?.insiderHoldingsRatio).gte(.1),[c?.insiderHoldingsRatio]),Se=useMemo(()=>new SafeBigNumber(c?.bundleHoldingsRatio).gte(.1),[c?.bundleHoldingsRatio]),D=c?.holders!==void 0&&c.holders>0,ie=c?.kolHolders!==void 0&&c.kolHolders>0,B=c?.bluechipHolders!==void 0&&c.bluechipHolders>0,F=D||ie||B;return jsxs("div",{className:cn$1("relative w-full h-full overflow-hidden px-4 py-3 hover:bg-content2/40 cursor-pointer",!r&&"border-b",n),style:r?void 0:{borderBottomColor:"rgba(39,39,42,0.6)"},onClick:s?d:void 0,children:[jsxs("div",{className:"flex items-start gap-2",children:[jsxs("div",{className:"flex-none flex flex-col items-center gap-2",children:[jsx(fe,{token:e,enableSearch:true,enablePreview:!!e.image,showProgress:false,className:"w-20 h-20"}),jsxs("button",{type:"button",className:"text-xs font-mono text-neutral hover:text-foreground leading-none",onClick:m,"aria-label":i("tokens.copied.address"),title:i("tokens.copied.address"),children:[e.address.slice(0,4),"...",e.address.slice(-4)]})]}),jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2.5",children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 min-w-0 text-left",onClick:m,"aria-label":i("tokens.copied.address"),title:i("tokens.copied.address"),children:[jsx("span",{className:"flex-none text-sm font-semibold leading-none whitespace-nowrap overflow-hidden text-ellipsis max-w-24",children:e.symbol}),jsx(StyledTooltip,{content:e.name,children:jsx("span",{className:"text-[13px] leading-none text-neutral truncate max-w-20",children:e.name})}),jsx(CopyIcon,{className:"flex-none w-3.5 h-3.5 text-neutral"})]}),jsxs("div",{className:"flex items-center gap-2 leading-none",children:[jsx("span",{className:"text-[13px] font-mono font-medium text-neutral",children:formatAge(l)}),e.socialMedias?.website&&jsx(Link,{href:e.socialMedias.website,className:"text-neutral hover:text-primary",target:"_blank",onClick:_=>_.stopPropagation(),children:jsx(WebsiteIcon,{className:"w-3.5 h-3.5"})}),e.socialMedias?.twitter&&jsx(Link,{href:e.socialMedias.twitter,className:"text-neutral hover:text-primary",target:"_blank",onClick:_=>_.stopPropagation(),children:jsx(TwitterIcon,{className:"w-3.5 h-3.5"})}),e.socialMedias?.telegram&&jsx(Link,{href:e.socialMedias.telegram,className:"text-neutral hover:text-primary",target:"_blank",onClick:_=>_.stopPropagation(),children:jsx(TelegramIcon,{className:"w-3.5 h-3.5"})}),jsx(Link,{href:searchTwitterUrl(`${e.symbol} OR ${e.address}`),className:"max-sm:hidden text-neutral hover:text-primary",target:"_blank",onClick:_=>_.stopPropagation(),children:jsx(SearchIcon,{className:"w-3.5 h-3.5"})})]}),jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-foreground/80 leading-none",children:[jsxs("span",{className:"inline-flex items-baseline gap-1",children:[jsx("span",{className:"text-neutral",children:"MC"}),jsx("span",{children:formatAmountUSDCompact(N)})]}),jsx("span",{className:"text-neutral/30",children:"\xB7"}),jsxs("span",{className:"inline-flex items-baseline gap-1",children:[jsx("span",{className:"text-neutral",children:"Liq"}),jsx("span",{children:formatAmountUSDCompact(y)})]})]}),F&&jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-neutral leading-none",children:[D&&jsx(StyledTooltip,{content:i("tokens.tokenInfo.holders"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(PeopleIcon,{className:"w-3 h-3 text-neutral"}),formatAmount(c?.holders)]})}),ie&&jsx(StyledTooltip,{content:i("tokens.tokenInfo.kolHolders"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(CrownIcon,{className:"w-3 h-3 text-neutral"}),formatAmount(c?.kolHolders)]})}),B&&jsx(StyledTooltip,{content:i("tokens.listHeader.bluechip"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(ShiningStarIcon,{className:"w-3 h-3 text-neutral"}),formatAmount(c?.bluechipHolders)]})})]})]}),jsxs("div",{className:"flex-none flex flex-col items-end gap-2.5 leading-none font-mono",children:[jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsx("span",{className:"text-base font-bold text-foreground leading-none",children:formatPriceUSD(u)}),jsxs("span",{className:cn$1("inline-flex items-center gap-0.5 text-[10px] leading-none",f?"text-bullish":"text-bearish"),children:[f?jsx(TriangleUpIcon,{width:8,height:8}):jsx(TriangleDownIcon,{width:8,height:8}),g===void 0?"--":formatPercent(x)]})]}),jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsxs("div",{className:"flex items-baseline gap-1",children:[jsx("span",{className:"text-xs text-neutral",children:"V"}),jsx("span",{className:"text-xs text-foreground/80",children:formatAmountUSDCompact(k)})]}),jsxs("span",{className:"text-[10px] leading-none",children:[jsx("span",{className:"text-bullish",children:formatAmountUSDCompact(h)}),jsx("span",{className:"text-neutral/50 mx-0.5",children:"/"}),jsx("span",{className:"text-bearish",children:formatAmountUSDCompact(b)})]})]}),jsxs("div",{className:"flex items-baseline gap-1",children:[jsx("span",{className:"text-xs text-neutral",children:"TX"}),jsx("span",{className:"text-xs text-foreground/80",children:formatAmount(T)})]})]})]}),jsxs("div",{className:"mt-2.5 flex items-start gap-4 relative",children:[jsx(HorizontalScrollContainer,{className:"flex-auto min-w-0",forceShowArrows:true,children:jsxs("div",{className:"flex items-center gap-1",children:[jsx(z,{icon:jsx(UserWithStarBadgeIcon,{width:12,height:12}),value:formatPercent(c?.top10HoldingsRatio),tooltip:i("tokens.tokenInfo.top10HoldingsRatio"),warning:P,disable:!c?.top10HoldingsRatio||c?.top10HoldingsRatio==="0"}),jsx(z,{icon:jsx(CookIcon,{width:12,height:12}),value:formatPercent(c?.devHoldingsRatio),tooltip:i("tokens.tokenInfo.devHoldingsRatio"),warning:L,disable:!c?.devHoldingsRatio||c?.devHoldingsRatio==="0"}),jsx(z,{icon:jsx(SniperIcon,{width:12,height:12}),value:formatPercent(c?.sniperHoldingsRatio),tooltip:i("tokens.tokenInfo.sniperHoldingsRatio"),warning:H,disable:!c?.sniperHoldingsRatio||c?.sniperHoldingsRatio==="0"}),jsx(z,{icon:jsx(RatIcon,{width:12,height:12}),value:formatPercent(c?.insiderHoldingsRatio),tooltip:i("tokens.tokenInfo.insiderHoldingsRatio"),warning:te,disable:!c?.insiderHoldingsRatio||c?.insiderHoldingsRatio==="0"}),jsx(z,{icon:jsx(BundlesIcon,{width:12,height:12}),value:formatPercent(c?.bundleHoldingsRatio),tooltip:i("tokens.tokenInfo.bundleHoldingsRatio"),warning:Se,disable:!c?.bundleHoldingsRatio||c?.bundleHoldingsRatio==="0"})]})}),o&&jsx("div",{className:"flex-none relative",onClick:_=>_.stopPropagation(),children:o(e)})]})]})}function il({isLast:e=false}){return jsxs("div",{className:cn$1("w-full h-full overflow-hidden px-4 py-3 animate-pulse",!e&&"border-b"),style:e?void 0:{borderBottomColor:"rgba(39,39,42,0.6)"},children:[jsxs("div",{className:"flex items-start gap-2",children:[jsxs("div",{className:"flex-none flex flex-col items-center gap-2",children:[jsx("div",{className:"w-20 h-20 rounded-lg bg-content2"}),jsx("div",{className:"w-14 h-2.5 rounded bg-content2"})]}),jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("div",{className:"w-16 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-20 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-8 h-3 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-12 h-3 rounded bg-content2"}),jsx("div",{className:"w-12 h-3 rounded bg-content2"}),jsx("div",{className:"w-10 h-3 rounded bg-content2"})]})]}),jsxs("div",{className:"flex-none flex flex-col items-end gap-3",children:[jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsx("div",{className:"w-16 h-4 rounded bg-content2"}),jsx("div",{className:"w-12 h-2.5 rounded bg-content2"})]}),jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsx("div",{className:"w-14 h-3 rounded bg-content2"}),jsx("div",{className:"w-12 h-2.5 rounded bg-content2"})]})]})]}),jsxs("div",{className:"mt-2.5 flex items-center gap-2",children:[jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-1 overflow-hidden",children:[jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"})]}),jsx("div",{className:"w-16 h-7 rounded-md bg-content2 flex-none"})]})]})}var fx=154,al=10;function gx({index:e,style:t,tokens:o,skeletonCount:r,resolution:s,renderAction:n,onSelectToken:i}){return o?jsx("div",{style:t,children:jsx(sl,{token:o[e],resolution:s,isLast:e===o.length-1,renderAction:n,onSelectToken:i})}):jsx("div",{style:t,children:jsx(il,{isLast:e===r-1})})}function DR({tokens:e,resolution:t="24h",isLoading:o,height:r=600,renderAction:s,onSelectToken:n,className:i}){let a=o||!e?void 0:e,l=a?a.length:al,d=useMemo(()=>({tokens:a,skeletonCount:al,resolution:t,renderAction:s,onSelectToken:n}),[a,t,s,n]);return jsx("div",{className:cn$1("w-full h-full overflow-hidden border rounded-lg",i),style:{background:"rgba(24,24,27,0.4)",borderColor:"rgba(39,39,42,0.6)"},children:jsx(List,{className:"h-full w-full",style:{height:r},rowCount:l,rowHeight:fx,overscanCount:5,rowComponent:gx,rowProps:d})})}var Tx=80;function pl(e){return {chain:e.chain,address:e.address,name:e.name??"",symbol:e.symbol??"",decimals:e.decimals??0,image:e.image,description:e.description,socialMedias:e.socialMedias,launchedFrom:e.launchedFrom,migratedTo:e.migratedTo,createdAt:e.createdAt}}function yx(e,t,o){return e===t?o:e===o?t:o||t}function Mr(e){let t=e.token?.address??e.tokenAAddress??"",o=e.token;return {...o,chain:e.chain,address:t,name:o?.name??"",symbol:o?.symbol??"",decimals:o?.decimals??0,createdAt:o?.createdAt??e.createdAt,liquidities:[{poolAddress:e.poolAddress,pairAddress:yx(t,e.tokenAAddress,e.tokenBAddress),image:e.dex?.image,programAddress:e.dex?.programAddress,protocolFamily:e.dex?.protocolFamily,protocolName:e.dex?.protocolName}]}}function vx(e){return {...pl(Mr(e)),...e.token??{},liquidities:Mr(e).liquidities,createdAt:e.token?.createdAt??e.createdAt}}function ml(e){return e.sort((t,o)=>{let r=t.createdAt?.getTime()??0;return (o.createdAt?.getTime()??0)-r}),e.slice(0,Tx)}function Nx(e){if(!(!e?.filters&&!e?.keywords&&!e?.excludeKeywords))return {filters:e.filters,keywords:e.keywords,excludeKeywords:e.excludeKeywords}}function Sx(e){if(!(!e?.sortBy||!e.sortDirection))return {[e.sortBy]:e.sortDirection}}function ul({chain:e,options:t,deferUpdates:o=false,updateFlushInterval:r}){let s=useMemo(()=>({chain:e}),[e]),n=useRef(s),[i,a]=useState(true),[l,d]=useState([]);useEffect(()=>{JSON.stringify(s)!==JSON.stringify(n.current)&&(a(true),d([]),n.current=s);},[s]);let{data:m,isPending:c}=useNewPoolsQuery(s);useEffect(()=>{m&&(d(h=>{let b=[...h];for(let T of m){let N=vx(T),y=b.findIndex(P=>P.address===N.address);y>=0?b[y]=X(b[y],N):b.push(N);}return ml(b)}),a(false));},[m]);let p=useCallback(h=>{d(b=>{let T=[...b],N=false;for(let y of h){let P=T.findIndex(L=>L.address===y.address);P>=0?(N=true,T[P]=X(T[P],y)):(N=true,T.push(pl(y)));}return N?ml(T):b});},[]),{enqueueUpdates:u}=de({applyUpdates:p,paused:o,flushInterval:r}),g=useCallback(h=>{u(h.map(Mr));},[u]);useNewPoolsSubscription({chain:e},g),useNewTokensMetadataSubscription({chain:e},u),xe({chain:e,tokens:l,onUpdate:u});let f=useMemo(()=>!!(c||i),[c,i]),x=useMemo(()=>le(l,Nx(t)),[l,t]);return {tokens:useMemo(()=>je(x,Sx(t)),[x,t]),isLoading:f}}function jR({chain:e,resolution:t,filters:o,ActionsComponent:r,onSelectToken:s,height:n,itemHeight:i,itemHeightMobile:a,className:l}){let[d,m]=useState(),[c,p]=useState(false);useEffect(()=>{m(void 0);},[e]);let u=useMemo(()=>{let x=Object.keys(d??{})[0],k=d?.[x];return {...o,...x&&k?{sortBy:x,sortDirection:k}:void 0}},[o,d]),{tokens:g,isLoading:f}=ul({chain:e,options:u,deferUpdates:c});return jsx(pt,{tokens:g,isLoading:f,resolution:t,height:n,itemHeight:i,itemHeightMobile:a,ActionsComponent:r,onSelectToken:s,sortDirections:d,onSortChange:m,onScrollingChange:p,className:l})}function kl({chain:e,filters:t,sortDirections:o,refetchInterval:r=12e3,deferUpdates:s=false,updateFlushInterval:n}){let i=useMemo(()=>({chain:e}),[e]),a=useRef(i),[l,d]=useState(true);useEffect(()=>{JSON.stringify(i)!==JSON.stringify(a.current)&&(d(true),a.current=i);},[i]);let[m,c]=useState([]),{data:p,isPending:u}=useStockTokensQuery(i,{refetchInterval:r});useEffect(()=>{p&&(c(b=>$t(b,p)),d(false));},[p]);let g=useCallback(b=>{c(T=>Re(T,b));},[]),{enqueueUpdates:f}=de({applyUpdates:g,paused:s,flushInterval:n});useStockTokensSubscription({chain:e},f),xe({chain:e,tokens:m,onUpdate:f});let x=useMemo(()=>!!(u||l),[u,l]),k=useMemo(()=>le(m,t),[m,t]);return {tokens:useMemo(()=>je(k,o),[k,o]),isLoading:x}}function gA({chain:e,resolution:t,filters:o,ActionsComponent:r,onSelectToken:s,height:n,itemHeight:i,itemHeightMobile:a,className:l}){let[d,m]=useState(),[c,p]=useState(false);useEffect(()=>{m(void 0);},[e]);let{tokens:u,isLoading:g}=kl({chain:e,filters:o,sortDirections:d,deferUpdates:c});return jsx(pt,{tokens:u,isLoading:g,resolution:t,height:n,itemHeight:i,itemHeightMobile:a,ActionsComponent:r,onSelectToken:s,sortDirections:d,onSortChange:m,onScrollingChange:p,className:l})}function NA({chain:e,resolution:t,filters:o,ActionsComponent:r,onSelectToken:s,height:n,itemHeight:i,itemHeightMobile:a,className:l}){let[d,m]=useState(),[c,p]=useState(false);useEffect(()=>{m(void 0);},[e]);let{tokens:u,isLoading:g}=eo({chain:e,resolution:t,filters:o,sortDirections:d,deferUpdates:c});return jsx(pt,{tokens:u,isLoading:g,resolution:t,height:n,itemHeight:i,itemHeightMobile:a,ActionsComponent:r,onSelectToken:s,sortDirections:d,onSortChange:m,onScrollingChange:p,className:l})}var Vx=15e3;function _x({chain:e,addresses:t,pollMs:o=Vx}){let r=t.length>0,[s,n]=useState({}),i=useTokensQuery({chain:e,addresses:t},{enabled:r,refetchInterval:o});useEffect(()=>{i.data&&n(c=>{let p={};for(let u of i.data){let g=c[u.address];p[u.address]=g?X(g,u):u;}return p});},[i.data]);let{subscribeClient:a}=useDexClient(),l=useRef(""),d=t.slice().sort().join(",");d!==l.current&&(l.current=d),useEffect(()=>{if(!r)return;let c=[];for(let p of t)c.push(a.subscribeToken(e,p,u=>{n(g=>{let f=g;for(let x of u){let k=f[x.address];if(!k)continue;let h=X(k,x);h!==k&&(f=f===g?{...g}:f,f[x.address]=h);}return f});}));return ()=>{for(let p of c)p.unsubscribe();}},[a,e,d,r]);let m=useCallback(async()=>{await i.refetch();},[i.refetch]);return {tokens:s,isPending:i.isPending,isFetching:i.isFetching,isError:i.isError,isSuccess:i.isSuccess,error:i.error,refetch:m}}export{ci as DEFAULT_FLIP_HOVER_RESOLUTIONS,Pl as HolderTagBadge,Dt as HolderTagBadgeList,z as HoldingRatioChip,jR as NewTokenListWidget,zb as PulseFinalStretchListWidget,Xe as PulseList,Or as PulseListHeader,Yr as PulseListItem,Fo as PulseListItemSkeleton,Ib as PulseMigratedListWidget,fb as PulseNewListWidget,qo as SEARCH_MODAL_ID,Un as SearchHistoryUI,On as SearchHistoryWidget,Dn as SearchInputUI,UT as SearchModal,Gt as SearchResultItemUI,Xt as SearchResultListHeader,Yt as SearchResultListSkeleton,zn as SearchResultListWidget,KT as SearchTokensButton,jn as SearchWidget,gA as StockTokenListWidget,Mo as TRADER_TAG_META,js as TokenAbout,TS as TokenAboutWidget,Bs as TokenActivitiesList,tN as TokenActivitiesListWidget,fe as TokenAvatar,ls as TokenBasicInfo,Is as TokenBasicInfoWidget,li as TokenCategories,pC as TokenCategoriesWidget,si as TokenCexListing,YS as TokenCexListingWidget,Oi as TokenChartBanner,aL as TokenChartBannerWidget,ss as TokenDetailHeader,g0 as TokenDetailHeaderWidget,Pi as TokenDevTokensList,qw as TokenDevTokensListWidget,Ri as TokenDevTokensSummary,cs as TokenHoldersCount,ps as TokenHoldersCountWidget,Ms as TokenHoldersList,O0 as TokenHoldersListWidget,ri as TokenLiquidities,DS as TokenLiquiditiesWidget,pt as TokenList,vo as TokenListFilter,ka as TokenListFilterModal,va as TokenListFilterPopover,P1 as TokenListFilterWidget,Ca as TokenListResolutionSelectorDesktop,La as TokenListResolutionSelectorMobile,z1 as TokenListResolutionSelectorWidget,gs as TokenMarketCap,ks as TokenMarketCapWidget,bi as TokenOrdersList,cw as TokenOrdersListWidget,fi as TokenPositionsList,qC as TokenPositionsListWidget,Ts as TokenPrice,vs as TokenPriceWidget,Vi as TokenReusedImageList,OL as TokenReusedImageListWidget,Xs as TokenSecurity,iS as TokenSecurityWidget,Ei as TokenSimilarTokens,NL as TokenSimilarTokensWidget,Ns as TokenSocialMedia,Cs as TokenSocialMediaWidget,mi as TokenStatsFlipBase,pi as TokenStatsFlipHover,PC as TokenStatsFlipWidget,Si as TokenTopTradersList,Aw as TokenTopTradersListWidget,$s as TokenTradersOverview,xN as TokenTradersOverviewWidget,zs as TokenTransactionsOverview,IN as TokenTransactionsOverviewWidget,Ps as TokenVolume,As as TokenVolumeWidget,Qs as TokenVolumesOverview,qN as TokenVolumesOverviewWidget,Ll as TraderTagBadge,Wr as TraderTagBadgeList,sl as TrendingTokenCard,DR as TrendingTokenCardList,il as TrendingTokenCardSkeleton,NA as TrendingTokenListWidget,ul as useNewTokensScript,An as usePulseFinalStretchListScript,Cn as usePulseMigratedListScript,kn as usePulseNewListScript,Qt as useSearchHistory,$n as useSearchResultListScript,Yn as useSearchScript,kl as useStockTokensScript,ei as useTokenAboutScript,Vs as useTokenActivitiesListScript,My as useTokenBasicInfoScript,di as useTokenCategoriesScript,ii as useTokenCexListingScript,Bi as useTokenChartBannerScript,is as useTokenDetailHeaderScript,Fi as useTokenDevTokensListScript,ms as useTokenHoldersCountScript,Ds as useTokenHoldersListScript,ni as useTokenLiquiditiesScript,xs as useTokenMarketCapScript,vi as useTokenOrdersListScript,ki as useTokenPositionsListScript,ys as useTokenPriceScript,_i as useTokenReusedImageListScript,Js as useTokenSecurityScript,Wi as useTokenSimilarTokensScript,Ss as useTokenSocialMediaScript,ui as useTokenStatsFlipScript,wi as useTokenTopTradersListScript,Ks as useTokenTradersOverviewScript,qs as useTokenTransactionsOverviewScript,Rs as useTokenVolumeScript,Gs as useTokenVolumesOverviewScript,_x as useTokens,eo as useTrendingTokensScript};//# sourceMappingURL=index.mjs.map
23
+ `,Rg={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:"tklShimmer 1.8s ease-in-out infinite",borderRadius:6};function V(e,t,o,r){return {...Rg,animationDelay:`${e}ms`,width:t,height:o,...r}}var Ja=10;function Ya({rowHeight:e,hasActions:t,isMobile:o}){return jsxs(Fragment,{children:[jsx("style",{children:Pg}),Array.from({length:Ja}).map((r,s)=>jsx(Ag,{index:s,rowHeight:e,hasActions:t,isMobile:o,isLast:s===Ja-1},s))]})}function Ag({index:e,rowHeight:t,hasActions:o,isMobile:r,isLast:s}){let n=e*80,i=r?208:320,a=r?40:64,l=r?72:124,d=r?64:97;return jsxs("div",{style:{display:"flex",alignItems:"center",height:t,borderBottom:s?void 0:"1px solid rgba(39,39,42,0.3)"},children:[jsxs("div",{style:{width:i,padding:r?"0 12px":"0 12px 0 24px",display:"flex",alignItems:"center",gap:12,flexShrink:0},children:[jsx("div",{style:V(n,a,a,{borderRadius:8,flexShrink:0})}),jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,flex:1},children:[jsx("div",{style:V(n+30,"60%",20)}),jsx("div",{style:V(n+60,"80%",16)})]})]}),jsxs("div",{style:{width:128,padding:"0 12px",display:"flex",flexDirection:"column",justifyContent:"center",gap:4},children:[jsx("div",{style:V(n+20,72,20)}),jsx("div",{style:V(n+40,52,16)})]}),jsx("div",{style:{width:106,padding:"0 12px",display:"flex",alignItems:"center"},children:jsx("div",{style:V(n+30,64,20)})}),jsx("div",{style:{width:106,padding:"0 12px",display:"flex",alignItems:"center"},children:jsx("div",{style:V(n+40,60,20)})}),jsxs("div",{style:{width:138,padding:"0 12px",display:"flex",flexDirection:"column",justifyContent:"center",gap:4},children:[jsx("div",{style:V(n+50,72,20)}),jsx("div",{style:V(n+70,100,16)})]}),jsxs("div",{style:{width:126,padding:"0 12px",display:"flex",flexDirection:"column",justifyContent:"center",gap:4},children:[jsx("div",{style:V(n+60,48,20)}),jsx("div",{style:V(n+80,80,16)})]}),jsxs("div",{style:{width:126,padding:"0 12px",display:"flex",flexDirection:"column",justifyContent:"center",gap:4},children:[jsx("div",{style:V(n+70,40,20)}),jsx("div",{style:V(n+90,72,16)})]}),jsxs("div",{style:{width:128,padding:"0 12px",display:"flex",alignItems:"center",gap:10},children:[jsx("div",{style:V(n+80,20,20,{borderRadius:4})}),jsx("div",{style:V(n+90,52,20)})]}),jsxs("div",{style:{width:308,padding:"0 12px",display:"flex",alignItems:"center",gap:20},children:[jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsx("div",{style:V(n+80,52,16)}),jsx("div",{style:V(n+100,40,16)}),jsx("div",{style:V(n+120,36,16)})]}),jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsx("div",{style:V(n+90,48,16)}),jsx("div",{style:V(n+110,40,16)}),jsx("div",{style:V(n+130,40,16)})]}),jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsx("div",{style:V(n+100,40,16)}),jsx("div",{style:V(n+120,36,16)})]})]}),o&&jsx("div",{style:{width:l,padding:r?"0 12px 0 0":"0 24px 0 12px",display:"flex",alignItems:"center",justifyContent:"flex-end"},children:jsx("div",{style:V(n+100,d,32,{borderRadius:8})})})]})}var Bg=100,Eg=200,Wg=72;function pt({tokens:e,resolution:t="24h",isLoading:o,ActionsComponent:r,onSelectToken:s,sortDirections:n,onSortChange:i,onScrollingChange:a,height:l=600,itemHeight:d=88,itemHeightMobile:m=72,className:c}){let{isMobile:p}=useScreen(),u=p?m:d,g=useMemo(()=>e.slice(0,Bg),[e]),f=!!o,x=useRef(void 0),k=useRef(false),{t:h}=useTranslation(),b=useCallback(F=>_=>{_.preventDefault(),_.stopPropagation(),s?.(F);},[s]),[T,N]=useState(n??{});useEffect(()=>{N(n??{});},[n]);let y=useCallback(F=>_=>{let gt={[F]:_};N(gt),i?.(gt);},[i]),P=useCallback(()=>{k.current||(k.current=true,a?.(true)),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{k.current=false,a?.(false);},180);},[a]);useEffect(()=>()=>{x.current&&clearTimeout(x.current),k.current&&a?.(false);},[a]);let L=cn$1("h-full mx-auto",c??(r?"max-w-362 sm:max-w-403":"max-w-331 sm:max-w-372")),H=r?"!w-[1438px] min-w-[1438px] max-w-[1438px]":"!w-[1366px] min-w-[1366px] max-w-[1366px]",te=[jsx(TableColumn,{textValue:h("tokens.listHeader.token"),width:p?Eg:320,className:cn$1("bg-[#0a0a0b] sticky left-0 z-10",p&&"!w-[200px] min-w-[200px] max-w-[200px] overflow-hidden","shadow-[1px_0_0_0_rgba(39,39,42,0.6)]"),children:h("tokens.listHeader.token")},"token"),jsx(TableColumn,{textValue:h("tokens.listHeader.price"),width:128,children:jsxs("div",{className:"flex items-center gap-1",children:[jsx(Sortable,{sort:T.price,onSortChange:y("price"),children:h("tokens.listHeader.price")}),jsx("span",{children:"/"}),jsx(Sortable,{sort:T[`priceChange${t}`],onSortChange:y(`priceChange${t}`),children:h("tokens.listHeader.priceChange",{resolution:t})})]})},"price"),jsx(TableColumn,{textValue:h("tokens.listHeader.marketCap"),width:106,children:jsx(Sortable,{sort:T.marketCap,onSortChange:y("marketCap"),children:h("tokens.listHeader.marketCap")})},"marketCap"),jsx(TableColumn,{textValue:h("tokens.listHeader.liquidity"),width:106,children:jsx(Sortable,{sort:T.tvl,onSortChange:y("tvl"),children:h("tokens.listHeader.liquidity")})},"liquidity"),jsx(TableColumn,{textValue:h("tokens.listHeader.volumes",{resolution:t}),width:138,children:jsx(Sortable,{sort:T[`volumes${t}`],onSortChange:y(`volumes${t}`),children:h("tokens.listHeader.volumes",{resolution:t})})},"volumes"),jsx(TableColumn,{textValue:h("tokens.listHeader.txs",{resolution:t}),width:126,children:jsx(Sortable,{sort:T[`trades${t}`],onSortChange:y(`trades${t}`),children:h("tokens.listHeader.txs",{resolution:t})})},"txs"),jsx(TableColumn,{textValue:h("tokens.listHeader.traders",{resolution:t}),width:126,children:jsx(Sortable,{sort:T[`traders${t}`],onSortChange:y(`traders${t}`),children:h("tokens.listHeader.traders",{resolution:t})})},"traders"),jsx(TableColumn,{textValue:h("tokens.listHeader.bluechip"),width:128,children:h("tokens.listHeader.bluechip")},"bluechip"),jsx(TableColumn,{textValue:h("tokens.listHeader.tokenInfo"),width:308,children:h("tokens.listHeader.tokenInfo")},"tokenInfo"),r?jsx(TableColumn,{textValue:h("tokens.listHeader.actions"),width:p?Wg:124,align:"end",className:cn$1("bg-[#0a0a0b] sticky right-0 z-10",p&&"!w-[72px] min-w-[72px] max-w-[72px]","shadow-[-1px_0_0_0_rgba(39,39,42,0.6)]"),children:h("tokens.listHeader.actions")},"actions"):void 0].filter(Boolean),Se=jsx(Ya,{rowHeight:u,hasActions:!!r,isMobile:p}),D=jsxs("div",{children:[jsx(EmptyIcon,{className:"w-10 h-10 mx-auto text-neutral"}),jsx("p",{className:"mt-2 text-sm text-neutral text-center",children:h("common.empty")})]}),ie=F=>[jsx(TableCell,{className:cn$1("sticky left-0 z-10 bg-[#0a0a0b]",p&&"!w-[200px] min-w-[200px] max-w-[200px] overflow-hidden","shadow-[1px_0_0_0_rgba(39,39,42,0.6)]","transition-colors duration-150","[tr:hover_&]:!bg-[#101211]"),children:jsx(Da,{token:F,resolution:t})},"token"),jsx(TableCell,{children:jsx($a,{token:F,resolution:t})},"price"),jsx(TableCell,{children:jsx(Wa,{token:F,resolution:t})},"marketCap"),jsx(TableCell,{children:jsx(Ea,{token:F,resolution:t})},"liquidity"),jsx(TableCell,{children:jsx(Xa,{token:F,resolution:t})},"volumes"),jsx(TableCell,{children:jsx(Qa,{token:F,resolution:t})},"trades"),jsx(TableCell,{children:jsx(za,{token:F,resolution:t})},"traders"),jsx(TableCell,{children:jsx(Aa,{token:F,resolution:t})},"bluechip"),jsx(TableCell,{children:jsx(Ba,{token:F,resolution:t})},"tokenInfo"),r?jsx(TableCell,{className:cn$1("sticky right-0 z-10 bg-[#0a0a0b]",p&&"!w-[72px] min-w-[72px] max-w-[72px]","shadow-[-1px_0_0_0_rgba(39,39,42,0.6)]","transition-colors duration-150","[tr:hover_&]:!bg-[#101211]"),children:jsx("div",{className:cn$1("!absolute inset-y-0 right-3 z-1 w-fit","flex items-center justify-end"),children:jsx(r,{token:F,resolution:t})})},"actions"):void 0].filter(Boolean),B=F=>jsx(TableRow,{onClick:s?b(F):void 0,children:ie(F)},F.address);return p?jsx("div",{"data-token-list-mobile-scroll":true,className:cn$1("h-full min-h-0 w-full overflow-y-auto overflow-x-hidden overscroll-contain","mx-auto",c??(r?"max-w-362 sm:max-w-403":"max-w-331 sm:max-w-372")),style:{height:l},onScroll:P,children:jsx("div",{"data-token-list-horizontal-scroll":true,className:"w-full overflow-x-auto overflow-y-visible",children:jsxs(StyledTable,{isHeaderSticky:true,radius:"none",classNames:{table:cn$1("table-fixed",H),wrapper:"p-0 w-full !max-h-none !overflow-x-visible !overflow-y-visible bg-transparent rounded-none shadow-none",loadingWrapper:"flex-col justify-start items-start",emptyWrapper:"pt-30"},"aria-label":"Tokens",children:[jsx(TableHeader,{children:te}),jsx(TableBody,{items:g,isLoading:f,loadingContent:Se,emptyContent:D,children:B})]})})}):jsxs(StyledTable,{isHeaderSticky:true,isVirtualized:true,radius:"lg",className:L,classNames:{loadingWrapper:"flex-col justify-start items-start",emptyWrapper:"pt-30"},onScrollCapture:P,maxTableHeight:l,rowHeight:u,"aria-label":"Tokens",children:[jsx(TableHeader,{children:te}),jsx(TableBody,{items:e,isLoading:f,loadingContent:Se,emptyContent:D,children:B})]})}function sl({token:e,resolution:t,renderAction:o,isLast:r=false,onSelectToken:s,className:n}){let{t:i}=useTranslation(),a=useCopyToClipboard(),l=useTickAge(e.createdAt),d=useCallback(()=>{s?.(e);},[s,e]),m=useCallback(_=>{_.stopPropagation(),a(e.address,()=>toast.success(i("tokens.copied.address")));},[a,e.address,i]),c=e.marketData,p=e.stats?.[t],u=useMemo(()=>c?.priceInUsd,[c?.priceInUsd]),g=useMemo(()=>p?.priceChange,[p?.priceChange]),f=useMemo(()=>g&&new SafeBigNumber(g).gte(0),[g]),x=useMemo(()=>g?new SafeBigNumber(g).abs().toString():void 0,[g]),k=useMemo(()=>p?.volumesInUsd,[p?.volumesInUsd]),h=useMemo(()=>p?.buyVolumesInUsd,[p?.buyVolumesInUsd]),b=useMemo(()=>p?.sellVolumesInUsd,[p?.sellVolumesInUsd]),T=useMemo(()=>p?.trades,[p?.trades]),N=useMemo(()=>c?.marketCapInUsd,[c?.marketCapInUsd]),y=useMemo(()=>c?.tvlInUsd,[c?.tvlInUsd]),P=useMemo(()=>new SafeBigNumber(c?.top10HoldingsRatio).gte(.1),[c?.top10HoldingsRatio]),L=useMemo(()=>new SafeBigNumber(c?.devHoldingsRatio).gte(.1),[c?.devHoldingsRatio]),H=useMemo(()=>new SafeBigNumber(c?.sniperHoldingsRatio).gte(.1),[c?.sniperHoldingsRatio]),te=useMemo(()=>new SafeBigNumber(c?.insiderHoldingsRatio).gte(.1),[c?.insiderHoldingsRatio]),Se=useMemo(()=>new SafeBigNumber(c?.bundleHoldingsRatio).gte(.1),[c?.bundleHoldingsRatio]),D=c?.holders!==void 0&&c.holders>0,ie=c?.kolHolders!==void 0&&c.kolHolders>0,B=c?.bluechipHolders!==void 0&&c.bluechipHolders>0,F=D||ie||B;return jsxs("div",{className:cn$1("relative w-full h-full overflow-hidden px-4 py-3 hover:bg-content2/40 cursor-pointer",!r&&"border-b",n),style:r?void 0:{borderBottomColor:"rgba(39,39,42,0.6)"},onClick:s?d:void 0,children:[jsxs("div",{className:"flex items-start gap-2",children:[jsxs("div",{className:"flex-none flex flex-col items-center gap-2",children:[jsx(fe,{token:e,enableSearch:true,enablePreview:!!e.image,showProgress:false,className:"w-20 h-20"}),jsxs("button",{type:"button",className:"text-xs font-mono text-neutral hover:text-foreground leading-none",onClick:m,"aria-label":i("tokens.copied.address"),title:i("tokens.copied.address"),children:[e.address.slice(0,4),"...",e.address.slice(-4)]})]}),jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2.5",children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 min-w-0 text-left",onClick:m,"aria-label":i("tokens.copied.address"),title:i("tokens.copied.address"),children:[jsx("span",{className:"flex-none text-sm font-semibold leading-none whitespace-nowrap overflow-hidden text-ellipsis max-w-24",children:e.symbol}),jsx(StyledTooltip,{content:e.name,children:jsx("span",{className:"text-[13px] leading-none text-neutral truncate max-w-20",children:e.name})}),jsx(CopyIcon,{className:"flex-none w-3.5 h-3.5 text-neutral"})]}),jsxs("div",{className:"flex items-center gap-2 leading-none",children:[jsx("span",{className:"text-[13px] font-mono font-medium text-neutral",children:formatAge(l)}),e.socialMedias?.website&&jsx(Link,{href:e.socialMedias.website,className:"text-neutral hover:text-primary",target:"_blank",onClick:_=>_.stopPropagation(),children:jsx(WebsiteIcon,{className:"w-3.5 h-3.5"})}),e.socialMedias?.twitter&&jsx(Link,{href:e.socialMedias.twitter,className:"text-neutral hover:text-primary",target:"_blank",onClick:_=>_.stopPropagation(),children:jsx(TwitterIcon,{className:"w-3.5 h-3.5"})}),e.socialMedias?.telegram&&jsx(Link,{href:e.socialMedias.telegram,className:"text-neutral hover:text-primary",target:"_blank",onClick:_=>_.stopPropagation(),children:jsx(TelegramIcon,{className:"w-3.5 h-3.5"})}),jsx(Link,{href:searchTwitterUrl(`${e.symbol} OR ${e.address}`),className:"max-sm:hidden text-neutral hover:text-primary",target:"_blank",onClick:_=>_.stopPropagation(),children:jsx(SearchIcon,{className:"w-3.5 h-3.5"})})]}),jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-foreground/80 leading-none",children:[jsxs("span",{className:"inline-flex items-baseline gap-1",children:[jsx("span",{className:"text-neutral",children:"MC"}),jsx("span",{children:formatAmountUSDCompact(N)})]}),jsx("span",{className:"text-neutral/30",children:"\xB7"}),jsxs("span",{className:"inline-flex items-baseline gap-1",children:[jsx("span",{className:"text-neutral",children:"Liq"}),jsx("span",{children:formatAmountUSDCompact(y)})]})]}),F&&jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-neutral leading-none",children:[D&&jsx(StyledTooltip,{content:i("tokens.tokenInfo.holders"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(PeopleIcon,{className:"w-3 h-3 text-neutral"}),formatAmount(c?.holders)]})}),ie&&jsx(StyledTooltip,{content:i("tokens.tokenInfo.kolHolders"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(CrownIcon,{className:"w-3 h-3 text-neutral"}),formatAmount(c?.kolHolders)]})}),B&&jsx(StyledTooltip,{content:i("tokens.listHeader.bluechip"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(ShiningStarIcon,{className:"w-3 h-3 text-neutral"}),formatAmount(c?.bluechipHolders)]})})]})]}),jsxs("div",{className:"flex-none flex flex-col items-end gap-2.5 leading-none font-mono",children:[jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsx("span",{className:"text-base font-bold text-foreground leading-none",children:formatPriceUSD(u)}),jsxs("span",{className:cn$1("inline-flex items-center gap-0.5 text-[10px] leading-none",f?"text-bullish":"text-bearish"),children:[f?jsx(TriangleUpIcon,{width:8,height:8}):jsx(TriangleDownIcon,{width:8,height:8}),g===void 0?"--":formatPercent(x)]})]}),jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsxs("div",{className:"flex items-baseline gap-1",children:[jsx("span",{className:"text-xs text-neutral",children:"V"}),jsx("span",{className:"text-xs text-foreground/80",children:formatAmountUSDCompact(k)})]}),jsxs("span",{className:"text-[10px] leading-none",children:[jsx("span",{className:"text-bullish",children:formatAmountUSDCompact(h)}),jsx("span",{className:"text-neutral/50 mx-0.5",children:"/"}),jsx("span",{className:"text-bearish",children:formatAmountUSDCompact(b)})]})]}),jsxs("div",{className:"flex items-baseline gap-1",children:[jsx("span",{className:"text-xs text-neutral",children:"TX"}),jsx("span",{className:"text-xs text-foreground/80",children:formatAmount(T)})]})]})]}),jsxs("div",{className:"mt-2.5 flex items-start gap-4 relative",children:[jsx(HorizontalScrollContainer,{className:"flex-auto min-w-0",forceShowArrows:true,children:jsxs("div",{className:"flex items-center gap-1",children:[jsx(z,{icon:jsx(UserWithStarBadgeIcon,{width:12,height:12}),value:formatPercent(c?.top10HoldingsRatio),tooltip:i("tokens.tokenInfo.top10HoldingsRatio"),warning:P,disable:!c?.top10HoldingsRatio||c?.top10HoldingsRatio==="0"}),jsx(z,{icon:jsx(CookIcon,{width:12,height:12}),value:formatPercent(c?.devHoldingsRatio),tooltip:i("tokens.tokenInfo.devHoldingsRatio"),warning:L,disable:!c?.devHoldingsRatio||c?.devHoldingsRatio==="0"}),jsx(z,{icon:jsx(SniperIcon,{width:12,height:12}),value:formatPercent(c?.sniperHoldingsRatio),tooltip:i("tokens.tokenInfo.sniperHoldingsRatio"),warning:H,disable:!c?.sniperHoldingsRatio||c?.sniperHoldingsRatio==="0"}),jsx(z,{icon:jsx(RatIcon,{width:12,height:12}),value:formatPercent(c?.insiderHoldingsRatio),tooltip:i("tokens.tokenInfo.insiderHoldingsRatio"),warning:te,disable:!c?.insiderHoldingsRatio||c?.insiderHoldingsRatio==="0"}),jsx(z,{icon:jsx(BundlesIcon,{width:12,height:12}),value:formatPercent(c?.bundleHoldingsRatio),tooltip:i("tokens.tokenInfo.bundleHoldingsRatio"),warning:Se,disable:!c?.bundleHoldingsRatio||c?.bundleHoldingsRatio==="0"})]})}),o&&jsx("div",{className:"flex-none relative",onClick:_=>_.stopPropagation(),children:o(e)})]})]})}function il({isLast:e=false}){return jsxs("div",{className:cn$1("w-full h-full overflow-hidden px-4 py-3 animate-pulse",!e&&"border-b"),style:e?void 0:{borderBottomColor:"rgba(39,39,42,0.6)"},children:[jsxs("div",{className:"flex items-start gap-2",children:[jsxs("div",{className:"flex-none flex flex-col items-center gap-2",children:[jsx("div",{className:"w-20 h-20 rounded-lg bg-content2"}),jsx("div",{className:"w-14 h-2.5 rounded bg-content2"})]}),jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("div",{className:"w-16 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-20 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-8 h-3 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-12 h-3 rounded bg-content2"}),jsx("div",{className:"w-12 h-3 rounded bg-content2"}),jsx("div",{className:"w-10 h-3 rounded bg-content2"})]})]}),jsxs("div",{className:"flex-none flex flex-col items-end gap-3",children:[jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsx("div",{className:"w-16 h-4 rounded bg-content2"}),jsx("div",{className:"w-12 h-2.5 rounded bg-content2"})]}),jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsx("div",{className:"w-14 h-3 rounded bg-content2"}),jsx("div",{className:"w-12 h-2.5 rounded bg-content2"})]})]})]}),jsxs("div",{className:"mt-2.5 flex items-center gap-2",children:[jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-1 overflow-hidden",children:[jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"})]}),jsx("div",{className:"w-16 h-7 rounded-md bg-content2 flex-none"})]})]})}var fx=154,al=10;function gx({index:e,style:t,tokens:o,skeletonCount:r,resolution:s,renderAction:n,onSelectToken:i}){return o?jsx("div",{style:t,children:jsx(sl,{token:o[e],resolution:s,isLast:e===o.length-1,renderAction:n,onSelectToken:i})}):jsx("div",{style:t,children:jsx(il,{isLast:e===r-1})})}function DR({tokens:e,resolution:t="24h",isLoading:o,height:r=600,renderAction:s,onSelectToken:n,className:i}){let a=o||!e?void 0:e,l=a?a.length:al,d=useMemo(()=>({tokens:a,skeletonCount:al,resolution:t,renderAction:s,onSelectToken:n}),[a,t,s,n]);return jsx("div",{className:cn$1("w-full h-full overflow-hidden border rounded-lg",i),style:{background:"rgba(24,24,27,0.4)",borderColor:"rgba(39,39,42,0.6)"},children:jsx(List,{className:"h-full w-full",style:{height:r},rowCount:l,rowHeight:fx,overscanCount:5,rowComponent:gx,rowProps:d})})}var Tx=80;function pl(e){return {chain:e.chain,address:e.address,name:e.name??"",symbol:e.symbol??"",decimals:e.decimals??0,image:e.image,description:e.description,socialMedias:e.socialMedias,launchedFrom:e.launchedFrom,migratedTo:e.migratedTo,createdAt:e.createdAt}}function yx(e,t,o){return e===t?o:e===o?t:o||t}function Mr(e){let t=e.token?.address??e.tokenAAddress??"",o=e.token;return {...o,chain:e.chain,address:t,name:o?.name??"",symbol:o?.symbol??"",decimals:o?.decimals??0,createdAt:o?.createdAt??e.createdAt,liquidities:[{poolAddress:e.poolAddress,pairAddress:yx(t,e.tokenAAddress,e.tokenBAddress),image:e.dex?.image,programAddress:e.dex?.programAddress,protocolFamily:e.dex?.protocolFamily,protocolName:e.dex?.protocolName}]}}function vx(e){return {...pl(Mr(e)),...e.token??{},liquidities:Mr(e).liquidities,createdAt:e.token?.createdAt??e.createdAt}}function ml(e){return e.sort((t,o)=>{let r=t.createdAt?.getTime()??0;return (o.createdAt?.getTime()??0)-r}),e.slice(0,Tx)}function Nx(e){if(!(!e?.filters&&!e?.keywords&&!e?.excludeKeywords))return {filters:e.filters,keywords:e.keywords,excludeKeywords:e.excludeKeywords}}function Sx(e){if(!(!e?.sortBy||!e.sortDirection))return {[e.sortBy]:e.sortDirection}}function ul({chain:e,options:t,deferUpdates:o=false,updateFlushInterval:r}){let s=useMemo(()=>({chain:e}),[e]),n=useRef(s),[i,a]=useState(true),[l,d]=useState([]);useEffect(()=>{JSON.stringify(s)!==JSON.stringify(n.current)&&(a(true),d([]),n.current=s);},[s]);let{data:m,isPending:c}=useNewPoolsQuery(s);useEffect(()=>{m&&(d(h=>{let b=[...h];for(let T of m){let N=vx(T),y=b.findIndex(P=>P.address===N.address);y>=0?b[y]=X(b[y],N):b.push(N);}return ml(b)}),a(false));},[m]);let p=useCallback(h=>{d(b=>{let T=[...b],N=false;for(let y of h){let P=T.findIndex(L=>L.address===y.address);P>=0?(N=true,T[P]=X(T[P],y)):(N=true,T.push(pl(y)));}return N?ml(T):b});},[]),{enqueueUpdates:u}=de({applyUpdates:p,paused:o,flushInterval:r}),g=useCallback(h=>{u(h.map(Mr));},[u]);useNewPoolsSubscription({chain:e},g),useNewTokensMetadataSubscription({chain:e},u),xe({chain:e,tokens:l,onUpdate:u});let f=useMemo(()=>!!(c||i),[c,i]),x=useMemo(()=>le(l,Nx(t)),[l,t]);return {tokens:useMemo(()=>je(x,Sx(t)),[x,t]),isLoading:f}}function jR({chain:e,resolution:t,filters:o,ActionsComponent:r,onSelectToken:s,height:n,itemHeight:i,itemHeightMobile:a,className:l}){let[d,m]=useState(),[c,p]=useState(false);useEffect(()=>{m(void 0);},[e,t]);let u=useMemo(()=>{let x=Object.keys(d??{})[0],k=d?.[x];return {...o,...x&&k?{sortBy:x,sortDirection:k}:void 0}},[o,d]),{tokens:g,isLoading:f}=ul({chain:e,options:u,deferUpdates:c});return jsx(pt,{tokens:g,isLoading:f,resolution:t,height:n,itemHeight:i,itemHeightMobile:a,ActionsComponent:r,onSelectToken:s,sortDirections:d,onSortChange:m,onScrollingChange:p,className:l})}function kl({chain:e,filters:t,sortDirections:o,refetchInterval:r=3e4,deferUpdates:s=false,updateFlushInterval:n}){let i=useMemo(()=>({chain:e}),[e]),a=useRef(i),[l,d]=useState(true);useEffect(()=>{JSON.stringify(i)!==JSON.stringify(a.current)&&(d(true),c([]),a.current=i);},[i]);let[m,c]=useState([]),{data:p,isPending:u}=useStockTokensQuery(i,{refetchInterval:r});useEffect(()=>{p&&(c(b=>$t(b,p)),d(false));},[p]);let g=useCallback(b=>{c(T=>Re(T,b));},[]),{enqueueUpdates:f}=de({applyUpdates:g,paused:s,flushInterval:n});useStockTokensSubscription({chain:e},f),xe({chain:e,tokens:m,onUpdate:f});let x=useMemo(()=>!!(u||l),[u,l]),k=useMemo(()=>le(m,t),[m,t]);return {tokens:useMemo(()=>je(k,o),[k,o]),isLoading:x}}function gA({chain:e,resolution:t,filters:o,ActionsComponent:r,onSelectToken:s,height:n,itemHeight:i,itemHeightMobile:a,className:l}){let[d,m]=useState(),[c,p]=useState(false);useEffect(()=>{m(void 0);},[e,t]);let{tokens:u,isLoading:g}=kl({chain:e,filters:o,sortDirections:d,deferUpdates:c});return jsx(pt,{tokens:u,isLoading:g,resolution:t,height:n,itemHeight:i,itemHeightMobile:a,ActionsComponent:r,onSelectToken:s,sortDirections:d,onSortChange:m,onScrollingChange:p,className:l})}function NA({chain:e,resolution:t,filters:o,ActionsComponent:r,onSelectToken:s,height:n,itemHeight:i,itemHeightMobile:a,className:l}){let[d,m]=useState(),[c,p]=useState(false);useEffect(()=>{m(void 0);},[e,t]);let{tokens:u,isLoading:g}=eo({chain:e,resolution:t,filters:o,sortDirections:d,deferUpdates:c});return jsx(pt,{tokens:u,isLoading:g,resolution:t,height:n,itemHeight:i,itemHeightMobile:a,ActionsComponent:r,onSelectToken:s,sortDirections:d,onSortChange:m,onScrollingChange:p,className:l})}var Vx=15e3;function _x({chain:e,addresses:t,pollMs:o=Vx}){let r=t.length>0,[s,n]=useState({}),i=useTokensQuery({chain:e,addresses:t},{enabled:r,refetchInterval:o});useEffect(()=>{i.data&&n(c=>{let p={};for(let u of i.data){let g=c[u.address];p[u.address]=g?X(g,u):u;}return p});},[i.data]);let{subscribeClient:a}=useDexClient(),l=useRef(""),d=t.slice().sort().join(",");d!==l.current&&(l.current=d),useEffect(()=>{if(!r)return;let c=[];for(let p of t)c.push(a.subscribeToken(e,p,u=>{n(g=>{let f=g;for(let x of u){let k=f[x.address];if(!k)continue;let h=X(k,x);h!==k&&(f=f===g?{...g}:f,f[x.address]=h);}return f});}));return ()=>{for(let p of c)p.unsubscribe();}},[a,e,d,r]);let m=useCallback(async()=>{await i.refetch();},[i.refetch]);return {tokens:s,isPending:i.isPending,isFetching:i.isFetching,isError:i.isError,isSuccess:i.isSuccess,error:i.error,refetch:m}}export{ci as DEFAULT_FLIP_HOVER_RESOLUTIONS,Pl as HolderTagBadge,Dt as HolderTagBadgeList,z as HoldingRatioChip,jR as NewTokenListWidget,zb as PulseFinalStretchListWidget,Xe as PulseList,Or as PulseListHeader,Yr as PulseListItem,Fo as PulseListItemSkeleton,Ib as PulseMigratedListWidget,fb as PulseNewListWidget,qo as SEARCH_MODAL_ID,Un as SearchHistoryUI,On as SearchHistoryWidget,Dn as SearchInputUI,UT as SearchModal,Gt as SearchResultItemUI,Xt as SearchResultListHeader,Yt as SearchResultListSkeleton,zn as SearchResultListWidget,KT as SearchTokensButton,jn as SearchWidget,gA as StockTokenListWidget,Mo as TRADER_TAG_META,js as TokenAbout,TS as TokenAboutWidget,Bs as TokenActivitiesList,tN as TokenActivitiesListWidget,fe as TokenAvatar,ls as TokenBasicInfo,Is as TokenBasicInfoWidget,li as TokenCategories,pC as TokenCategoriesWidget,si as TokenCexListing,YS as TokenCexListingWidget,Oi as TokenChartBanner,aL as TokenChartBannerWidget,ss as TokenDetailHeader,g0 as TokenDetailHeaderWidget,Pi as TokenDevTokensList,qw as TokenDevTokensListWidget,Ri as TokenDevTokensSummary,cs as TokenHoldersCount,ps as TokenHoldersCountWidget,Ms as TokenHoldersList,O0 as TokenHoldersListWidget,ri as TokenLiquidities,DS as TokenLiquiditiesWidget,pt as TokenList,vo as TokenListFilter,ka as TokenListFilterModal,va as TokenListFilterPopover,P1 as TokenListFilterWidget,Ca as TokenListResolutionSelectorDesktop,La as TokenListResolutionSelectorMobile,z1 as TokenListResolutionSelectorWidget,gs as TokenMarketCap,ks as TokenMarketCapWidget,bi as TokenOrdersList,cw as TokenOrdersListWidget,fi as TokenPositionsList,qC as TokenPositionsListWidget,Ts as TokenPrice,vs as TokenPriceWidget,Vi as TokenReusedImageList,OL as TokenReusedImageListWidget,Xs as TokenSecurity,iS as TokenSecurityWidget,Ei as TokenSimilarTokens,NL as TokenSimilarTokensWidget,Ns as TokenSocialMedia,Cs as TokenSocialMediaWidget,mi as TokenStatsFlipBase,pi as TokenStatsFlipHover,PC as TokenStatsFlipWidget,Si as TokenTopTradersList,Aw as TokenTopTradersListWidget,$s as TokenTradersOverview,xN as TokenTradersOverviewWidget,zs as TokenTransactionsOverview,IN as TokenTransactionsOverviewWidget,Ps as TokenVolume,As as TokenVolumeWidget,Qs as TokenVolumesOverview,qN as TokenVolumesOverviewWidget,Ll as TraderTagBadge,Wr as TraderTagBadgeList,sl as TrendingTokenCard,DR as TrendingTokenCardList,il as TrendingTokenCardSkeleton,NA as TrendingTokenListWidget,ul as useNewTokensScript,An as usePulseFinalStretchListScript,Cn as usePulseMigratedListScript,kn as usePulseNewListScript,Qt as useSearchHistory,$n as useSearchResultListScript,Yn as useSearchScript,kl as useStockTokensScript,ei as useTokenAboutScript,Vs as useTokenActivitiesListScript,My as useTokenBasicInfoScript,di as useTokenCategoriesScript,ii as useTokenCexListingScript,Bi as useTokenChartBannerScript,is as useTokenDetailHeaderScript,Fi as useTokenDevTokensListScript,ms as useTokenHoldersCountScript,Ds as useTokenHoldersListScript,ni as useTokenLiquiditiesScript,xs as useTokenMarketCapScript,vi as useTokenOrdersListScript,ki as useTokenPositionsListScript,ys as useTokenPriceScript,_i as useTokenReusedImageListScript,Js as useTokenSecurityScript,Wi as useTokenSimilarTokensScript,Ss as useTokenSocialMediaScript,ui as useTokenStatsFlipScript,wi as useTokenTopTradersListScript,Ks as useTokenTradersOverviewScript,qs as useTokenTransactionsOverviewScript,Rs as useTokenVolumeScript,Gs as useTokenVolumesOverviewScript,_x as useTokens,eo as useTrendingTokensScript};//# sourceMappingURL=index.mjs.map
24
24
  //# sourceMappingURL=index.mjs.map