@liberfi.io/ui-tokens 3.0.21 → 3.0.23
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.d.mts +83 -41
- package/dist/index.d.ts +83 -41
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -13
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {memo,useMemo,useState,useRef,useCallback,useEffect}from'react';import {List}from'react-window';import {StyledTooltip,HorsePowerHighIcon,HorsePowerLowIcon,HorsePowerIcon,cn,useCopyToClipboard,toast,CheckIcon,CopyIcon,Link,WebsiteIcon,TwitterIcon,TelegramIcon,DiscordIcon,SearchIcon,PeopleIcon,KlineCandlesIcon,StarIcon,UserWithStarBadgeIcon,CookIcon,SniperIcon,RatIcon,BundlesIcon,TriangleUpIcon,TriangleDownIcon,Avatar,CameraIcon,Image,PauseIcon,HorizontalScrollContainer,Button,TrashIcon,Chip,StyledInput,XCloseIcon,Kbd,Spinner,EmptyIcon,useScreen,StyledModal,ModalContent,ModalHeader,ModalBody,useDisclosure,FilterIcon,ScrollShadow,ModalFooter,RefreshIcon,StyledPlainTabs,Tab,ChevronDownIcon,TableColumn,Sortable,StyledTable,TableHeader,TableBody,CrownIcon,ShiningStarIcon,TableRow,Skeleton,Progress,StyledLightTabs,StyledBadge,TableCell,StyledNumberInput}from'@liberfi.io/ui';import {useTranslation}from'@liberfi.io/i18n';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {useTickAge,useResizeObserver,useCallbackRef}from'@liberfi.io/hooks';import {SafeBigNumber,formatPercent,formatAge,searchTwitterUrl,formatAmount,formatAmountUSD,formatPriceUSD,parseTokenProtocolFamily,searchImageUrl,formatAmountUSDCompact,debounce,formatPrice,formatTokenProtocolName}from'@liberfi.io/utils';export{formatAmount}from'@liberfi.io/utils';import {SolanaTokenProtocol,Chain}from'@liberfi.io/types';import {useNewPoolsQuery,useNewPoolsSubscription,useMigratedTokensQuery,useFinalStretchTokensQuery,useSearchTokensInfiniteQuery,useTrendingTokensQuery,useTrendingTokensSubscription,useTokenHoldersQuery,useTokenSubscription,useTokenActivitiesQuery,useTokenActivitiesSubscription,useTokenSecurityQuery,useTokenStatsQuery,useWalletTokenPositionsQuery,useWalletLimitOrdersQuery,useTokenTopTradersQuery,useTokensByCreatorQuery,useSearchTokensQuery,useNewTokensQuery,useNewTokensSubscription,useStockTokensQuery,useStockTokensSubscription,useTokensQuery,useDexClient,useTokensSubscription,useTokenQuery}from'@liberfi.io/react';import {AsyncModal,useAsyncModal,StatsFlipPanel}from'@liberfi.io/ui-scaffold';import {useAtom}from'jotai';import {atomWithStorage}from'jotai/utils';import {useInfiniteLoader}from'react-window-infinite-loader';function Pr({title:e,isPaused:t,extra:o,className:r}){let{t:s}=useTranslation();return jsxs("div",{className:cn("w-full h-12 px-3 flex-none bg-[#0a0a0b] flex items-center justify-between gap-4 border-b border-[rgba(39,39,42,0.6)]",r),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("h2",{className:"font-semibold",children:e}),t&&jsxs("div",{className:"flex items-center gap-1 text-primary",children:[jsx(PauseIcon,{className:"w-4 h-4"}),jsx("span",{className:"text-xs hidden sm:inline",children:s("tokens.pulse.paused")})]})]}),o&&jsx("div",{className:"flex items-center gap-3",children:o})]})}function Rr({isLast:e=false,className:t}){return jsxs("div",{className:cn("w-full h-full overflow-hidden px-4 py-3 animate-pulse border-b",t),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-sm 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.5",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"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-10 h-3 rounded bg-content2"}),jsx("div",{className:"w-10 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-2.5",children:[jsx("div",{className:"flex flex-col items-end gap-1",children:jsx("div",{className:"w-16 h-4 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"})]}),jsx("div",{className:"w-10 h-2.5 rounded bg-content2"})]})]}),jsxs("div",{className:"mt-2.5 flex items-center gap-4",children:[jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-1",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"})]})]})}function $({icon:e,value:t,tooltip:o,warning:r,disable:s=false,className:n,tooltipPlacement:i="top"}){return jsx(StyledTooltip,{content:o,placement:i,children:jsxs("div",{className:cn("shrink-0 px-2 py-0.5 flex items-center gap-1 rounded-full text-xs border border-border/60",r?"text-danger-500":s?"text-neutral":"text-primary",n),children:[e,jsx("span",{children:t})]})})}var Io={kol:{label:"KOL",bgClass:"bg-yellow-500/15",textClass:"text-yellow-400"},smart:{label:"Smart",bgClass:"bg-sky-500/15",textClass:"text-sky-400"},sniper:{label:"Sniper",bgClass:"bg-red-500/15",textClass:"text-red-400"},dev:{label:"Dev",bgClass:"bg-orange-500/15",textClass:"text-orange-400"},bundle:{label:"Bundle",bgClass:"bg-purple-500/15",textClass:"text-purple-400"},bluechip:{label:"Bluechip",bgClass:"bg-emerald-500/15",textClass:"text-emerald-400"},insider:{label:"Insider",bgClass:"bg-fuchsia-500/15",textClass:"text-fuchsia-400"},fresh:{label:"Fresh",bgClass:"bg-teal-500/15",textClass:"text-teal-400"}};function xl({tag:e,className:t}){let o=Io[e]??{label:e,bgClass:"bg-default/20",textClass:"text-default-500"};return jsx("span",{className:cn("inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium uppercase leading-none tracking-wide",o.bgClass,o.textClass,t),children:o.label})}function Mr({tags:e,className:t,max:o}){if(!e||e.length===0)return null;let r=o!=null&&o>0?e.slice(0,o):e,s=e.length-r.length;return jsxs("div",{className:cn("flex flex-wrap items-center gap-1",t),children:[r.map(n=>jsx(xl,{tag:n},n)),s>0&&jsxs("span",{className:"inline-flex items-center rounded bg-default/20 px-1.5 py-0.5 text-[10px] font-medium text-default-500",children:["+",s]})]})}function kl({tag:e,className:t}){let o=Io[e]??{label:e,bgClass:"bg-default/20",textClass:"text-default-500"};return jsx("span",{className:cn("inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium uppercase leading-none tracking-wide",o.bgClass,o.textClass,t),children:o.label})}function Ot({tags:e,className:t,max:o}){if(!e||e.length===0)return null;let r=o!=null&&o>0?e.slice(0,o):e,s=e.length-r.length;return jsxs("div",{className:cn("flex flex-wrap items-center gap-1",t),children:[r.map(n=>jsx(kl,{tag:n},n)),s>0&&jsxs("span",{className:"inline-flex items-center rounded bg-default/20 px-1.5 py-0.5 text-[10px] font-medium text-default-500",children:["+",s]})]})}var hl={[SolanaTokenProtocol.BAGS]:{text:"text-bags",bg:"bg-bags",bg5:"bg-bags/5",bg20:"bg-bags/20",border:"border-bags"},[SolanaTokenProtocol.BELIEVE]:{text:"text-believe",bg:"bg-believe",bg5:"bg-believe/5",bg20:"bg-believe/20",border:"border-believe"},[SolanaTokenProtocol.BONK]:{text:"text-bonk",bg:"bg-bonk",bg5:"bg-bonk/5",bg20:"bg-bonk/20",border:"border-bonk"},[SolanaTokenProtocol.BOOP]:{text:"text-boop",bg:"bg-boop",bg5:"bg-boop/5",bg20:"bg-boop/20",border:"border-boop"},[SolanaTokenProtocol.HEAVEN]:{text:"text-heaven",bg:"bg-heaven",bg5:"bg-heaven/5",bg20:"bg-heaven/20",border:"border-heaven"},[SolanaTokenProtocol.JUPSTUDIO]:{text:"text-jupstudio",bg:"bg-jupstudio",bg5:"bg-jupstudio/5",bg20:"bg-jupstudio/20",border:"border-jupstudio"},[SolanaTokenProtocol.LAUNCHLAB]:{text:"text-launchlab",bg:"bg-launchlab",bg5:"bg-launchlab/5",bg20:"bg-launchlab/20",border:"border-launchlab"},[SolanaTokenProtocol.METEORA]:{text:"text-meteora",bg:"bg-meteora",bg5:"bg-meteora/5",bg20:"bg-meteora/20",border:"border-meteora"},[SolanaTokenProtocol.MOONIT]:{text:"text-moonit",bg:"bg-moonit",bg5:"bg-moonit/5",bg20:"bg-moonit/20",border:"border-moonit"},[SolanaTokenProtocol.MOONSHOT]:{text:"text-moonshot",bg:"bg-moonshot",bg5:"bg-moonshot/5",bg20:"bg-moonshot/20",border:"border-moonshot"},[SolanaTokenProtocol.ORCA]:{text:"text-orca",bg:"bg-orca",bg5:"bg-orca/5",bg20:"bg-orca/20",border:"border-orca"},[SolanaTokenProtocol.PUMP]:{text:"text-pump",bg:"bg-pump",bg5:"bg-pump/5",bg20:"bg-pump/20",border:"border-pump"},[SolanaTokenProtocol.RAYDIUM]:{text:"text-raydium",bg:"bg-raydium",bg5:"bg-raydium/5",bg20:"bg-raydium/20",border:"border-raydium"},[SolanaTokenProtocol.SUGAR]:{text:"text-sugar",bg:"bg-sugar",bg5:"bg-sugar/5",bg20:"bg-sugar/20",border:"border-sugar"},[SolanaTokenProtocol.VIRTUAL_CURVE]:{text:"text-virtual-curve",bg:"bg-virtual-curve",bg5:"bg-virtual-curve/5",bg20:"bg-virtual-curve/20",border:"border-virtual-curve"},[SolanaTokenProtocol.PUMP_AMM]:{text:"text-pump-amm",bg:"bg-pump-amm",bg5:"bg-pump-amm/5",bg20:"bg-pump-amm/20",border:"border-pump-amm"}},bl={text:"text-neutral",bg:"bg-neutral",bg5:"bg-neutral/5",bg20:"bg-neutral/20",border:"border-neutral"};function Me(e){return hl[e]??bl}function ce({token:e,enablePreview:t=true,enableSearch:o=true,showProgress:r=true,showProtocolFamily:s=true,radius:n="sm",className:i,classNames:a}){let l=useMemo(()=>e.launchedFrom?.protocolFamily?parseTokenProtocolFamily(e.chain,e.launchedFrom.protocolFamily):void 0,[e.chain,e.launchedFrom?.protocolFamily]),d=useMemo(()=>s&&l,[s,l]),m=useMemo(()=>r&&e.migrateProgress&&new SafeBigNumber(e.migrateProgress).lt(100),[r,e.migrateProgress]),c=useMemo(()=>o&&e.image,[o,e.image]),p=useMemo(()=>(e.symbol??e.name??e.address??"L").slice(0,1).toUpperCase(),[e.symbol,e.name,e.address]),[u,f]=useState(false),k=useCallback(()=>{f(true);},[]),x=useCallback(()=>{f(false);},[]),g=useCallback(h=>{if(h.stopPropagation(),!e.image)return;let b=searchImageUrl(e.image);window.open(b,"_blank");},[e.image]);return jsxs("div",{className:cn("relative justify-center items-center",i??"w-15 h-15"),children:[!m&&jsx("div",{className:cn("absolute inset-0",`rounded-${n}`,l?Me(l).bg:"bg-[rgba(39,39,42,0.6)]",a?.background)}),m&&jsx("div",{className:cn("absolute -inset-0.5",`rounded-${n}`),children:jsx(Cl,{className:cn(l?Me(l).text:"text-[rgba(39,39,42,0.6)]",a?.progress),progress:e.migrateProgress??"0"})}),jsx("div",{className:cn("absolute inset-0 p-px flex items-center justify-center",`rounded-${n}`,l?Me(l).bg20:"bg-[rgba(39,39,42,0.12)]",a?.avatarWrapper),children:jsx(Nl,{token:e,radius:n,enableSearch:o,enablePreview:t,classNames:a,children:jsxs("div",{className:cn("relative w-full h-full bg-content1 flex items-center justify-center p-0.5",`rounded-${n}`,u&&c&&"cursor-pointer"),onMouseEnter:k,onMouseLeave:x,children:[jsx(Avatar,{showFallback:true,src:e.image,name:p,className:cn("w-full h-full bg-content1 text-neutral text-2xl",`rounded-${n}`,a?.avatar)}),u&&c&&jsx("div",{className:cn("absolute inset-0 bg-content1/80 flex items-center justify-center",`rounded-${n}`,a?.searchWrapper),onClick:g,children:jsx(CameraIcon,{className:cn("w-6 h-6",a?.searchIcon)})})]})})}),d&&jsx("div",{className:"contents",children:jsx(StyledTooltip,{content:e.launchedFrom?.protocolFamily??l,placement:"bottom",children:jsx("div",{className:cn("absolute -bottom-1 -right-1 rounded-full p-px w-4 h-4",l&&Me(l).bg,a?.protocolFamilyIconWrapper),children:jsx(Image,{removeWrapper:true,src:`/images/protocols/${l}.svg`,className:cn("w-full h-full rounded-full bg-content1",a?.protocolFamilyIcon)})})})})]})}function Nl({token:e,radius:t,enableSearch:o,enablePreview:r,classNames:s,children:n}){return useMemo(()=>r&&e.image,[r,e.image])?jsx(StyledTooltip,{content:jsx(Sl,{token:e,radius:t,enableSearch:o,classNames:s}),closeDelay:100,placement:"bottom-start",classNames:{content:"p-1"},children:n}):n}function Sl({token:e,enableSearch:t,radius:o,classNames:r}){let s=useMemo(()=>t&&e.image,[t,e.image]),n=useMemo(()=>(e.symbol??e.name??e.address??"L").slice(0,1).toUpperCase(),[e.symbol,e.name,e.address]),[i,a]=useState(false),l=useCallback(()=>{a(true);},[]),d=useCallback(()=>{a(false);},[]),m=useCallback(c=>{if(c.stopPropagation(),!e.image)return;let p=searchImageUrl(e.image);window.open(p,"_blank");},[e.image]);return jsxs("div",{className:cn("relative flex items-center justify-center w-60 h-60",`rounded-${o}`,i&&s&&"cursor-pointer",r?.previewWrapper),onMouseEnter:l,onMouseLeave:d,children:[jsx(Avatar,{showFallback:true,src:e.image,name:n,className:cn("w-full h-full bg-content1 text-neutral text-3xl",`rounded-${o}`,r?.previewAvatar)}),i&&s&&jsx("div",{className:cn("absolute inset-0 bg-content1/80 flex items-center justify-center",`rounded-${o}`,r?.previewSearchWrapper),onClick:m,children:jsx(CameraIcon,{className:cn("w-10 h-10",r?.previewSearchIcon)})})]})}function Cl({progress:e,className:t}){let o=useMemo(()=>296-Number(e)*296/100,[e]);return jsxs("svg",{viewBox:"0 0 78 78",className:"w-full h-full",children:[jsx("path",{className:`${t} opacity-40`,stroke:"currentColor",fill:"transparent",strokeWidth:"1",d:`
|
|
1
|
+
import {memo,useMemo,useState,useRef,useCallback,useEffect}from'react';import {List}from'react-window';import {StyledTooltip,HorsePowerHighIcon,HorsePowerLowIcon,HorsePowerIcon,cn,useCopyToClipboard,toast,CheckIcon,CopyIcon,Link,WebsiteIcon,TwitterIcon,TelegramIcon,DiscordIcon,SearchIcon,PeopleIcon,KlineCandlesIcon,StarIcon,UserWithStarBadgeIcon,CookIcon,SniperIcon,RatIcon,BundlesIcon,TriangleUpIcon,TriangleDownIcon,Avatar,CameraIcon,Image,PauseIcon,HorizontalScrollContainer,Button,TrashIcon,Chip,StyledInput,XCloseIcon,Kbd,Spinner,EmptyIcon,useScreen,StyledModal,ModalContent,ModalHeader,ModalBody,useDisclosure,FilterIcon,ScrollShadow,ModalFooter,RefreshIcon,StyledPlainTabs,Tab,ChevronDownIcon,TableColumn,Sortable,StyledTable,TableHeader,TableBody,CrownIcon,ShiningStarIcon,TableRow,Skeleton,Progress,StyledLightTabs,StyledBadge,TableCell,StyledNumberInput}from'@liberfi.io/ui';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {useTickAge,useResizeObserver,useCallbackRef}from'@liberfi.io/hooks';import {useTranslation}from'@liberfi.io/i18n';import {SafeBigNumber,formatPercent,formatAge,searchTwitterUrl,formatAmount,formatAmountUSD,formatPriceUSD,parseTokenProtocolFamily,searchImageUrl,formatAmountUSDCompact,debounce,formatPrice,formatTokenProtocolName}from'@liberfi.io/utils';export{formatAmount}from'@liberfi.io/utils';import {SolanaTokenProtocol,Chain}from'@liberfi.io/types';import {useNewPoolsQuery,useNewPoolsSubscription,useMigratedTokensQuery,useFinalStretchTokensQuery,useSearchTokensInfiniteQuery,useTrendingTokensQuery,useTrendingTokensSubscription,useTokenHoldersQuery,useTokenSubscription,useTokenActivitiesQuery,useTokenActivitiesSubscription,useTokenSecurityQuery,useTokenStatsQuery,useWalletTokenPositionsQuery,useWalletLimitOrdersQuery,useTokenTopTradersQuery,useTokensByCreatorQuery,useSearchTokensQuery,useStockTokensQuery,useStockTokensSubscription,useTokensQuery,useDexClient,useTokensSubscription,useTokenQuery}from'@liberfi.io/react';import {AsyncModal,useAsyncModal,StatsFlipPanel}from'@liberfi.io/ui-scaffold';import {useAtom}from'jotai';import {atomWithStorage}from'jotai/utils';import {useInfiniteLoader}from'react-window-infinite-loader';function Ur({title:e,isPaused:t,extra:o,className:r}){return jsxs("div",{className:cn("w-full h-12 px-3 flex-none bg-[#0a0a0b] flex items-center justify-between gap-4 border-b border-[rgba(39,39,42,0.6)]",r),children:[jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[jsx("h2",{className:"min-w-0 truncate font-semibold",children:e}),t&&jsx("div",{className:"flex flex-none items-center gap-1 text-primary",children:jsx(PauseIcon,{className:"w-4 h-4"})})]}),o&&jsx("div",{className:"flex min-w-0 items-center gap-3",children:o})]})}function Ho({isLast:e=false,className:t}){return jsxs("div",{className:cn("w-full h-full overflow-hidden px-4 py-3 animate-pulse",t),style:{borderBottom:e?"none":"1px solid 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-sm 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.5",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"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-10 h-3 rounded bg-content2"}),jsx("div",{className:"w-10 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-2.5",children:[jsx("div",{className:"flex flex-col items-end gap-1",children:jsx("div",{className:"w-16 h-4 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"})]}),jsx("div",{className:"w-10 h-2.5 rounded bg-content2"})]})]}),jsxs("div",{className:"mt-2.5 flex items-center gap-4",children:[jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-1",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"})]})]})}function z({icon:e,value:t,tooltip:o,warning:r,disable:s=false,className:n,tooltipPlacement:i="top"}){return jsx(StyledTooltip,{content:o,placement:i,children:jsxs("div",{className:cn("shrink-0 px-2 py-0.5 flex items-center gap-1 rounded-full text-xs border border-border/60",r?"text-danger-500":s?"text-neutral":"text-primary",n),children:[e,jsx("span",{children:t})]})})}var Fo={kol:{label:"KOL",bgClass:"bg-yellow-500/15",textClass:"text-yellow-400"},smart:{label:"Smart",bgClass:"bg-sky-500/15",textClass:"text-sky-400"},sniper:{label:"Sniper",bgClass:"bg-red-500/15",textClass:"text-red-400"},dev:{label:"Dev",bgClass:"bg-orange-500/15",textClass:"text-orange-400"},bundle:{label:"Bundle",bgClass:"bg-purple-500/15",textClass:"text-purple-400"},bluechip:{label:"Bluechip",bgClass:"bg-emerald-500/15",textClass:"text-emerald-400"},insider:{label:"Insider",bgClass:"bg-fuchsia-500/15",textClass:"text-fuchsia-400"},fresh:{label:"Fresh",bgClass:"bg-teal-500/15",textClass:"text-teal-400"}};function Nl({tag:e,className:t}){let o=Fo[e]??{label:e,bgClass:"bg-default/20",textClass:"text-default-500"};return jsx("span",{className:cn("inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium uppercase leading-none tracking-wide",o.bgClass,o.textClass,t),children:o.label})}function Br({tags:e,className:t,max:o}){if(!e||e.length===0)return null;let r=o!=null&&o>0?e.slice(0,o):e,s=e.length-r.length;return jsxs("div",{className:cn("flex flex-wrap items-center gap-1",t),children:[r.map(n=>jsx(Nl,{tag:n},n)),s>0&&jsxs("span",{className:"inline-flex items-center rounded bg-default/20 px-1.5 py-0.5 text-[10px] font-medium text-default-500",children:["+",s]})]})}function Sl({tag:e,className:t}){let o=Fo[e]??{label:e,bgClass:"bg-default/20",textClass:"text-default-500"};return jsx("span",{className:cn("inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium uppercase leading-none tracking-wide",o.bgClass,o.textClass,t),children:o.label})}function Dt({tags:e,className:t,max:o}){if(!e||e.length===0)return null;let r=o!=null&&o>0?e.slice(0,o):e,s=e.length-r.length;return jsxs("div",{className:cn("flex flex-wrap items-center gap-1",t),children:[r.map(n=>jsx(Sl,{tag:n},n)),s>0&&jsxs("span",{className:"inline-flex items-center rounded bg-default/20 px-1.5 py-0.5 text-[10px] font-medium text-default-500",children:["+",s]})]})}var Cl={[SolanaTokenProtocol.BAGS]:{text:"text-bags",bg:"bg-bags",bg5:"bg-bags/5",bg20:"bg-bags/20",border:"border-bags"},[SolanaTokenProtocol.BELIEVE]:{text:"text-believe",bg:"bg-believe",bg5:"bg-believe/5",bg20:"bg-believe/20",border:"border-believe"},[SolanaTokenProtocol.BONK]:{text:"text-bonk",bg:"bg-bonk",bg5:"bg-bonk/5",bg20:"bg-bonk/20",border:"border-bonk"},[SolanaTokenProtocol.BOOP]:{text:"text-boop",bg:"bg-boop",bg5:"bg-boop/5",bg20:"bg-boop/20",border:"border-boop"},[SolanaTokenProtocol.HEAVEN]:{text:"text-heaven",bg:"bg-heaven",bg5:"bg-heaven/5",bg20:"bg-heaven/20",border:"border-heaven"},[SolanaTokenProtocol.JUPSTUDIO]:{text:"text-jupstudio",bg:"bg-jupstudio",bg5:"bg-jupstudio/5",bg20:"bg-jupstudio/20",border:"border-jupstudio"},[SolanaTokenProtocol.LAUNCHLAB]:{text:"text-launchlab",bg:"bg-launchlab",bg5:"bg-launchlab/5",bg20:"bg-launchlab/20",border:"border-launchlab"},[SolanaTokenProtocol.METEORA]:{text:"text-meteora",bg:"bg-meteora",bg5:"bg-meteora/5",bg20:"bg-meteora/20",border:"border-meteora"},[SolanaTokenProtocol.MOONIT]:{text:"text-moonit",bg:"bg-moonit",bg5:"bg-moonit/5",bg20:"bg-moonit/20",border:"border-moonit"},[SolanaTokenProtocol.MOONSHOT]:{text:"text-moonshot",bg:"bg-moonshot",bg5:"bg-moonshot/5",bg20:"bg-moonshot/20",border:"border-moonshot"},[SolanaTokenProtocol.ORCA]:{text:"text-orca",bg:"bg-orca",bg5:"bg-orca/5",bg20:"bg-orca/20",border:"border-orca"},[SolanaTokenProtocol.PUMP]:{text:"text-pump",bg:"bg-pump",bg5:"bg-pump/5",bg20:"bg-pump/20",border:"border-pump"},[SolanaTokenProtocol.RAYDIUM]:{text:"text-raydium",bg:"bg-raydium",bg5:"bg-raydium/5",bg20:"bg-raydium/20",border:"border-raydium"},[SolanaTokenProtocol.SUGAR]:{text:"text-sugar",bg:"bg-sugar",bg5:"bg-sugar/5",bg20:"bg-sugar/20",border:"border-sugar"},[SolanaTokenProtocol.VIRTUAL_CURVE]:{text:"text-virtual-curve",bg:"bg-virtual-curve",bg5:"bg-virtual-curve/5",bg20:"bg-virtual-curve/20",border:"border-virtual-curve"},[SolanaTokenProtocol.PUMP_AMM]:{text:"text-pump-amm",bg:"bg-pump-amm",bg5:"bg-pump-amm/5",bg20:"bg-pump-amm/20",border:"border-pump-amm"}},wl={text:"text-neutral",bg:"bg-neutral",bg5:"bg-neutral/5",bg20:"bg-neutral/20",border:"border-neutral"};function Oe(e){return Cl[e]??wl}function fe({token:e,enablePreview:t=true,enableSearch:o=true,showProgress:r=true,showProtocolFamily:s=true,radius:n="sm",className:i,classNames:l}){let a=useMemo(()=>e.launchedFrom?.protocolFamily?parseTokenProtocolFamily(e.chain,e.launchedFrom.protocolFamily):void 0,[e.chain,e.launchedFrom?.protocolFamily]),d=useMemo(()=>s&&a,[s,a]),m=useMemo(()=>r&&e.migrateProgress&&new SafeBigNumber(e.migrateProgress).lt(100),[r,e.migrateProgress]),c=useMemo(()=>o&&e.image,[o,e.image]),p=useMemo(()=>(e.symbol??e.name??e.address??"L").slice(0,1).toUpperCase(),[e.symbol,e.name,e.address]),[u,g]=useState(false),f=useCallback(()=>{g(true);},[]),x=useCallback(()=>{g(false);},[]),b=useCallback(h=>{if(h.stopPropagation(),!e.image)return;let k=searchImageUrl(e.image);window.open(k,"_blank");},[e.image]);return jsxs("div",{className:cn("relative justify-center items-center",i??"w-15 h-15"),children:[!m&&jsx("div",{className:cn("absolute inset-0",`rounded-${n}`,a?Oe(a).bg:"bg-[rgba(39,39,42,0.6)]",l?.background)}),m&&jsx("div",{className:cn("absolute -inset-0.5",`rounded-${n}`),children:jsx(Hl,{className:cn(a?Oe(a).text:"text-[rgba(39,39,42,0.6)]",l?.progress),progress:e.migrateProgress??"0"})}),jsx("div",{className:cn("absolute inset-0 p-px flex items-center justify-center",`rounded-${n}`,a?Oe(a).bg20:"bg-[rgba(39,39,42,0.12)]",l?.avatarWrapper),children:jsx(Al,{token:e,radius:n,enableSearch:o,enablePreview:t,classNames:l,children:jsxs("div",{className:cn("relative w-full h-full bg-content1 flex items-center justify-center p-0.5",`rounded-${n}`,u&&c&&"cursor-pointer"),onMouseEnter:f,onMouseLeave:x,children:[jsx(Avatar,{showFallback:true,src:e.image,name:p,className:cn("w-full h-full bg-content1 text-neutral text-2xl",`rounded-${n}`,l?.avatar)}),u&&c&&jsx("div",{className:cn("absolute inset-0 bg-content1/80 flex items-center justify-center",`rounded-${n}`,l?.searchWrapper),onClick:b,children:jsx(CameraIcon,{className:cn("w-6 h-6",l?.searchIcon)})})]})})}),d&&jsx("div",{className:"contents",children:jsx(StyledTooltip,{content:e.launchedFrom?.protocolFamily??a,placement:"bottom",children:jsx("div",{className:cn("absolute -bottom-1 -right-1 rounded-full p-px w-4 h-4",a&&Oe(a).bg,l?.protocolFamilyIconWrapper),children:jsx(Image,{removeWrapper:true,src:`/images/protocols/${a}.svg`,className:cn("w-full h-full rounded-full bg-content1",l?.protocolFamilyIcon)})})})})]})}function Al({token:e,radius:t,enableSearch:o,enablePreview:r,classNames:s,children:n}){return useMemo(()=>r&&e.image,[r,e.image])?jsx(StyledTooltip,{content:jsx(Il,{token:e,radius:t,enableSearch:o,classNames:s}),closeDelay:100,placement:"bottom-start",classNames:{content:"p-1"},children:n}):n}function Il({token:e,enableSearch:t,radius:o,classNames:r}){let s=useMemo(()=>t&&e.image,[t,e.image]),n=useMemo(()=>(e.symbol??e.name??e.address??"L").slice(0,1).toUpperCase(),[e.symbol,e.name,e.address]),[i,l]=useState(false),a=useCallback(()=>{l(true);},[]),d=useCallback(()=>{l(false);},[]),m=useCallback(c=>{if(c.stopPropagation(),!e.image)return;let p=searchImageUrl(e.image);window.open(p,"_blank");},[e.image]);return jsxs("div",{className:cn("relative flex items-center justify-center w-60 h-60",`rounded-${o}`,i&&s&&"cursor-pointer",r?.previewWrapper),onMouseEnter:a,onMouseLeave:d,children:[jsx(Avatar,{showFallback:true,src:e.image,name:n,className:cn("w-full h-full bg-content1 text-neutral text-3xl",`rounded-${o}`,r?.previewAvatar)}),i&&s&&jsx("div",{className:cn("absolute inset-0 bg-content1/80 flex items-center justify-center",`rounded-${o}`,r?.previewSearchWrapper),onClick:m,children:jsx(CameraIcon,{className:cn("w-10 h-10",r?.previewSearchIcon)})})]})}function Hl({progress:e,className:t}){let o=useMemo(()=>296-Number(e)*296/100,[e]);return jsxs("svg",{viewBox:"0 0 78 78",className:"w-full h-full",children:[jsx("path",{className:`${t} opacity-40`,stroke:"currentColor",fill:"transparent",strokeWidth:"1",d:`
|
|
2
2
|
M 76 76
|
|
3
3
|
L 6 76
|
|
4
4
|
Q 2 76 2 72
|
|
@@ -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 Kr({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(U=>{U.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]),f=useMemo(()=>d?.sellVolumesInUsd,[d?.sellVolumesInUsd]),k=useMemo(()=>d?.trades,[d?.trades]),x=useMemo(()=>l?.marketCapInUsd,[l?.marketCapInUsd]),g=useMemo(()=>l?.tvlInUsd,[l?.tvlInUsd]),h=useMemo(()=>{let U=new SafeBigNumber(x);return U.lt(1e3)?"text-foreground":U.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]),I=useMemo(()=>new SafeBigNumber(l?.insiderHoldingsRatio).gte(.1),[l?.insiderHoldingsRatio]),M=useMemo(()=>new SafeBigNumber(l?.sniperHoldingsRatio).gte(.1),[l?.sniperHoldingsRatio]),Q=useMemo(()=>new SafeBigNumber(l?.bundleHoldingsRatio).gte(.1),[l?.bundleHoldingsRatio]),[Se,_]=useMemo(()=>{let U=Number(d?.buys??0),P=Number(d?.sells??0),W=U+P;if(W===0)return [12,12];let ft=Math.round(U/W*24);return [ft,24-ft]},[d?.buys,d?.sells]),be=l?.holders!==void 0&&l.holders>0,Te=l?.proHolders!==void 0&&l.proHolders>0,F=l?.kolHolders!==void 0&&l.kolHolders>0,ne=be||Te||F;return jsxs("div",{className:cn("relative w-full h-full overflow-hidden px-4 py-3 hover:bg-content2/40 cursor-pointer border-b",s),style:o?void 0:{borderBottomColor:"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(ce,{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:U=>U.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:U=>U.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:U=>U.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:U=>U.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(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(g)})]})]}),ne&&jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-neutral leading-none",children:[be&&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)]})}),Te&&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)]})}),F&&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("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(f)})]})]}),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(k)})]})]})]}),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($,{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($,{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($,{icon:jsx(SniperIcon,{width:12,height:12}),value:formatPercent(l?.sniperHoldingsRatio),tooltip:n("tokens.tokenInfo.sniperHoldingsRatio"),warning:M,disable:!l?.sniperHoldingsRatio||l?.sniperHoldingsRatio==="0"}),jsx($,{icon:jsx(RatIcon,{width:12,height:12}),value:formatPercent(l?.insiderHoldingsRatio),tooltip:n("tokens.tokenInfo.insiderHoldingsRatio"),warning:I,disable:!l?.insiderHoldingsRatio||l?.insiderHoldingsRatio==="0"}),jsx($,{icon:jsx(BundlesIcon,{width:12,height:12}),value:formatPercent(l?.bundleHoldingsRatio),tooltip:n("tokens.tokenInfo.bundleHoldingsRatio"),warning:Q,disable:!l?.bundleHoldingsRatio||l?.bundleHoldingsRatio==="0"})]})}),t&&jsx("div",{className:"flex-none relative",onClick:U=>U.stopPropagation(),children:t(e)})]})]})}var Jl=152,qr=10;function Yl({index:e,style:t,data:o,skeletonCount:r,renderItemAction:s,onSelectToken:n}){return o?jsx("div",{style:t,children:jsx(Kr,{token:o[e],isLast:e===o.length-1,renderAction:s,onSelectToken:n})}):jsx("div",{style:t,children:jsx(Rr,{isLast:e===r-1})})}function Ge({title:e,tokens:t,isLoading:o,itemHeight:r=Jl,renderHeaderExtra:s,renderItemAction:n,onSelectToken:i,onPauseChange:a,className:l,hideHeader:d}){let m=o||!t?void 0:t,c=m?m.length:qr,p=useMemo(()=>({data:m,skeletonCount:qr,renderItemAction:n,onSelectToken:i}),[m,n,i]),[u,f]=useState(false),k=useCallback(()=>{f(true),a?.(true);},[a]),x=useCallback(()=>{f(false),a?.(false);},[a]);return jsxs("div",{className:cn("w-full h-full bg-[#0a0a0b] overflow-hidden flex flex-col border border-[rgba(39,39,42,0.6)] rounded-lg",l),onMouseEnter:k,onMouseLeave:x,children:[!d&&jsx(Pr,{title:e,isPaused:u,extra:s}),jsx("div",{className:"flex-1 w-full overflow-hidden",children:jsx(List,{className:"h-full w-full",rowCount:c,rowHeight:r,rowComponent:Yl,rowProps:p,overscanCount:5})})]})}function Fo(e,t){let o={...e};for(let r of Object.keys(t))t[r]!==void 0&&(o[r]=t[r]);return o}var jl=["1m","5m","15m","30m","1h","4h","24h"];function ed(e,t){if(!t)return e;if(!e)return t;let o={...e};for(let r of jl)t[r]&&(o[r]=e[r]?Fo(e[r],t[r]):t[r]);return o}function td(e,t){return t?e?Fo(e,t):t:e}function Vt(e,t){return t?e?Fo(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=ed(e.stats,s),c.marketData=td(e.marketData,n),c.socialMedias=Vt(e.socialMedias,i),c.security=Vt(e.security,a),c.launchedFrom=Vt(e.launchedFrom,l),c.migratedTo=Vt(e.migratedTo,d),c}function Xe(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 od(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 Ce(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}od(s)&&(o.push(s),r=true);}return r?o:e}function Jr({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 id=80;function rn(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 ad(e,t,o){return e===t?o:e===o?t:o||t}function Uo(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:ad(t,e.tokenAAddress,e.tokenBAddress),image:e.dex?.image,programAddress:e.dex?.programAddress,protocolFamily:e.dex?.protocolFamily,protocolName:e.dex?.protocolName}]}}function ld(e){return {...rn(Uo(e)),...e.token??{},liquidities:Uo(e).liquidities,createdAt:e.token?.createdAt??e.createdAt}}function on(e){return e.sort((t,o)=>{let r=t.createdAt?.getTime()??0;return (o.createdAt?.getTime()??0)-r}),e.slice(0,id)}function nn({chain:e,isPaused:t=false}){let o=useMemo(()=>({chain:e}),[e]),r=useRef(t);r.current=t;let s=useRef(e),[n,i]=useState(true),[a,l]=useState([]);useEffect(()=>{e!==s.current&&(i(true),l([]),s.current=e);},[e]);let{data:d,isPending:m}=useNewPoolsQuery(o);useEffect(()=>{d&&(l(f=>{let k=r.current,x=f.length===0&&d.length>0,g=[...f];for(let h of d){let b=ld(h),T=g.findIndex(I=>I.address===b.address);T>=0?g[T]=X(g[T],b):(!k||x)&&g.push(b);}return k?g:on(g)}),i(false));},[d]);let c=useCallback(f=>{l(k=>{let x=r.current,g=[...k],h=false;for(let b of f){let T=g.findIndex(I=>I.address===b.address);T>=0?(h=true,g[T]=X(g[T],b)):x||(h=true,g.push(rn(b)));}return h?x?g:on(g):k});},[]),p=useCallback(f=>{c(f.map(Uo));},[c]);useNewPoolsSubscription({chain:e},p),Jr({chain:e,tokens:a,onUpdate:c});let u=useMemo(()=>m||n,[m,n]);return {tokens:a,isLoading:u}}function Xk({chain:e,title:t,renderHeaderExtra:o,renderItemAction:r,onSelectToken:s,className:n,hideHeader:i}){let[a,l]=useState(false),{tokens:d,isLoading:m}=nn({chain:e,isPaused:a}),c=useCallback(p=>{l(p);},[]);return jsx(Ge,{title:t,tokens:d,isLoading:m,renderHeaderExtra:o,renderItemAction:r,onSelectToken:s,onPauseChange:c,className:n,hideHeader:i})}function we({chain:e,tokens:t,onUpdate:o,enabled:r=true}){let s=useMemo(()=>Array.from(new Set(t.map(i=>i.address.trim()).filter(Boolean))).sort().join(","),[t]),n=useMemo(()=>s?s.split(","):[],[s]);useTokensSubscription({chain:e,addresses:n},o,{enabled:r&&n.length>0});}function mn({chain:e,isPaused:t=false,refetchInterval:o=3e4}){let r=useMemo(()=>({chain:e}),[e]),s=useRef(t);s.current=t;let n=useRef(e),[i,a]=useState(true),[l,d]=useState([]);useEffect(()=>{e!==n.current&&(a(true),d([]),n.current=e);},[e]);let{data:m,isPending:c}=useMigratedTokensQuery(r,{refetchInterval:o});useEffect(()=>{m&&(d(f=>{let k=s.current,x=[...f];for(let g of m){let h=x.findIndex(b=>b.address===g.address);h>=0?x[h]=X(x[h],g):k||x.unshift(g);}return x}),a(false));},[m]);let p=useCallback(f=>{d(k=>Ce(k,f));},[]);we({chain:e,tokens:l,onUpdate:p});let u=useMemo(()=>c||i,[c,i]);return {tokens:l,isLoading:u}}function ch({chain:e,title:t,renderHeaderExtra:o,renderItemAction:r,onSelectToken:s,className:n,hideHeader:i}){let[a,l]=useState(false),{tokens:d,isLoading:m}=mn({chain:e,isPaused:a}),c=useCallback(p=>{l(p);},[]);return jsx(Ge,{title:t,tokens:d,isLoading:m,renderHeaderExtra:o,renderItemAction:r,onSelectToken:s,onPauseChange:c,className:n,hideHeader:i})}function Td(e){return e.sort((t,o)=>{let r=Number(t.migrateProgress??0);return Number(o.migrateProgress??0)-r})}function xn({chain:e,isPaused:t=false,refetchInterval:o=15e3}){let r=useMemo(()=>({chain:e}),[e]),s=useRef(t);s.current=t;let n=useRef(e),[i,a]=useState(true),[l,d]=useState([]);useEffect(()=>{e!==n.current&&(a(true),d([]),n.current=e);},[e]);let{data:m,isPending:c}=useFinalStretchTokensQuery(r,{refetchInterval:o});useEffect(()=>{m&&(d(f=>{let k=s.current,x=f.length===0&&m.length>0,g=[...f];for(let h of m){let b=g.findIndex(T=>T.address===h.address);b>=0?g[b]=X(g[b],h):(!k||x)&&g.push(h);}return k?g:Td(g)}),a(false));},[m]);let p=useCallback(f=>{d(k=>Ce(k,f));},[]);we({chain:e,tokens:l,onUpdate:p});let u=useMemo(()=>c||i,[c,i]);return {tokens:l,isLoading:u}}function vh({chain:e,title:t,renderHeaderExtra:o,renderItemAction:r,onSelectToken:s,className:n,hideHeader:i}){let[a,l]=useState(false),{tokens:d,isLoading:m}=xn({chain:e,isPaused:a}),c=useCallback(p=>{l(p);},[]);return jsx(Ge,{title:t,tokens:d,isLoading:m,renderHeaderExtra:o,renderItemAction:r,onSelectToken:s,onPauseChange:c,className:n,hideHeader:i})}var wd=10,Ld=atomWithStorage("liberfi:search_histories",[],void 0,{getOnInit:true});function _t(){let[e,t]=useAtom(Ld),o=useCallback(s=>{let n=s.trim();n&&t(i=>{let a=i.filter(l=>l!==n);return [n,...a].slice(0,wd)});},[t]),r=useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:o,clearHistories:r}}function Tn({histories:e,onSelect:t,onClear:o,className:r}){let{t:s}=useTranslation();return e.length===0?null:jsxs("div",{className:cn("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("text-neutral","border-border border-1","cursor-pointer","hover:opacity-hover"),onClick:()=>t?.(n),children:n},n))})]})}function yn({onSelect:e,className:t}){let{histories:o,clearHistories:r}=_t();return jsx(Tn,{className:cn(t),histories:o,onSelect:e,onClear:r})}function vn({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 $t({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("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(ce,{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("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 Kt({className:e}){let{t}=useTranslation();return jsxs("div",{className:cn("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 Jd(){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 qt({rows:e=6,className:t}){return jsx("div",{className:cn("w-full",t),children:Array.from({length:e}).map((o,r)=>jsx(Jd,{},r))})}function Pn({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 ic=56;function An({onSelectToken:e,className:t,...o}){let{tokens:r,isLoading:s,isFetchingNextPage:n,hasNextPage:i,fetchNextPage:a}=Pn(o),l=useRef(null),{height:d}=useResizeObserver({ref:l}),m=useCallback(f=>f<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("w-full",t),children:[jsx(Kt,{}),jsx(qt,{})]}):r.length===0?jsxs("div",{className:cn("w-full",t),children:[jsx(Kt,{}),jsx(lc,{})]}):jsxs("div",{className:cn("w-full h-full flex flex-col",t),children:[jsx(Kt,{className:"flex-none"}),jsx("div",{className:"flex-auto min-h-0",ref:l,children:jsx(List,{style:{height:d},onRowsRendered:u,rowComponent:ac,rowCount:p,rowHeight:ic,rowProps:{tokens:r,onSelectToken:e},overscanCount:5})})]})}function ac({index:e,style:t,tokens:o,onSelectToken:r}){let s=o[e];return s?jsx("div",{style:t,onClick:()=>r?.(s),children:jsx($t,{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")})]})}var cc=["24h","12h","30m","15m","30s","15s","1m","5m","1h","4h","1s"],mc=new Set(["price","marketCap","tvl","holders","top10Holdings","top10Ratio","top100Holdings","top100Ratio","creatorsHoldings","creatorsRatio","createdAt","launchedFromProtocolFamily","migratedToProtocolFamily","tag"]),pc=new Set(["priceChange","volumes","trades","traders","buys","sells"]);function J(e){if(e==null||e==="")return;let t=Number(e);return Number.isFinite(t)?t:void 0}function In(e){for(let t of cc){if(!e.endsWith(t))continue;let o=e.slice(0,-t.length);return o?{metric:o,resolution:t}:void 0}}function Mn(e){if(mc.has(e))return true;let t=In(e);return t?pc.has(t.metric):false}function Gt(e,t){switch(t){case "price":return J(e.marketData?.priceInUsd);case "marketCap":return J(e.marketData?.marketCapInUsd);case "tvl":return J(e.marketData?.tvlInUsd);case "holders":return J(e.marketData?.holders);case "top10Holdings":return J(e.marketData?.top10Holdings);case "top10Ratio":return J(e.marketData?.top10HoldingsRatio);case "top100Holdings":return J(e.marketData?.top100Holdings);case "top100Ratio":return J(e.marketData?.top100HoldingsRatio);case "creatorsHoldings":return J(e.marketData?.devHoldings);case "creatorsRatio":return J(e.marketData?.devHoldingsRatio);case "createdAt":return e.createdAt?.getTime();case "launchedFromProtocolFamily":return Hn(e,e.launchedFrom?.protocolFamily);case "migratedToProtocolFamily":return Hn(e,e.migratedTo?.protocolFamily);case "tag":return e.tags?.[0];}let o=In(t);if(!o)return;let r=e.stats?.[o.resolution];switch(o.metric){case "priceChange":return J(r?.priceChange);case "volumes":return J(r?.volumesInUsd);case "trades":return J(r?.trades);case "traders":return J(r?.traders);case "buys":return J(r?.buys);case "sells":return J(r?.sells);default:return}}function Hn(e,t){if(t)return parseTokenProtocolFamily(e.chain,t)??t}var uc=new Set(["top10Ratio","top100Ratio","creatorsRatio"]);function Fn(e){let t=e.trim().toLowerCase();return t.length>0?t:void 0}function fc(e){return [e.name,e.symbol].filter(Boolean).join(" ").toLowerCase()}function gc(e){return Array.isArray(e)?e:void 0}function xc(e){return Array.isArray(e)?void 0:e}function Un(e,t){if(!uc.has(e))return t;let o=Number(t);return Number.isFinite(o)?o/100:t}function me(e,t){let o=xc(t);return o===void 0?void 0:Un(e,o)}function Eo(e,t){return gc(t)?.map(o=>Un(e,o))}function Ze(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 Xt(e,t){if(typeof e=="number"){let o=Number(t);return Number.isFinite(o)&&e===o}return String(e)===String(t)}function kc(e,t){if(!Mn(t.field))return false;let o=Gt(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=me(t.field,t.value);return s!==void 0&&Xt(o,s)}case "ne":{let s=me(t.field,t.value);return s!==void 0&&!Xt(o,s)}case "gt":{let s=me(t.field,t.value),n=s!==void 0?Ze(o,s):void 0;return n!==void 0&&n>0}case "gte":{let s=me(t.field,t.value),n=s!==void 0?Ze(o,s):void 0;return n!==void 0&&n>=0}case "lt":{let s=me(t.field,t.value),n=s!==void 0?Ze(o,s):void 0;return n!==void 0&&n<0}case "lte":{let s=me(t.field,t.value),n=s!==void 0?Ze(o,s):void 0;return n!==void 0&&n<=0}case "between":{let s=Eo(t.field,t.value);if(!s||s.length<2)return false;let n=Ze(o,s[0]),i=Ze(o,s[1]);return n!==void 0&&i!==void 0&&n>=0&&i<=0}case "in":{let s=Eo(t.field,t.value);return s?s.some(n=>Xt(o,n)):false}case "nin":{let s=Eo(t.field,t.value);return s?s.every(n=>!Xt(o,n)):false}case "contains":{let s=me(t.field,t.value);return s!==void 0&&String(o).includes(String(s))}case "notContains":{let s=me(t.field,t.value);return s!==void 0&&!String(o).includes(String(s))}case "startsWith":{let s=me(t.field,t.value);return s!==void 0&&String(o).startsWith(String(s))}case "endsWith":{let s=me(t.field,t.value);return s!==void 0&&String(o).endsWith(String(s))}default:return false}}function Jt(e,t){let o=t?.keywords?.map(Fn).filter(n=>n!==void 0),r=t?.excludeKeywords?.map(Fn).filter(n=>n!==void 0),s=t?.filters;return !o?.length&&!r?.length&&!s?.length?e:e.filter(n=>{let i=fc(n);return !(o?.length&&!o.some(a=>i.includes(a))||r?.length&&r.some(a=>i.includes(a))||s?.length&&!s.every(a=>kc(n,a)))})}function hc(e,t){return typeof e=="number"&&typeof t=="number"?e-t:String(e).localeCompare(String(t))}function Yt(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:Gt(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=hc(n.value,i.value);return d===0?n.index-i.index:r==="asc"?d:-d}).map(({token:n})=>n)}function je({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 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:f}=useTrendingTokensQuery(a,{refetchInterval:s});useEffect(()=>{u&&(p(T=>Xe(T,u)),m(false));},[u]);let k=useCallback(T=>{p(I=>Ce(I,T));},[]),{enqueueUpdates:x}=je({applyUpdates:k,paused:n,flushInterval:i});useTrendingTokensSubscription({chain:e},x),we({chain:e,tokens:c,onUpdate:x});let g=useMemo(()=>!!(f||d),[f,d]),h=useMemo(()=>Jt(c,o),[c,o]);return {tokens:useMemo(()=>Yt(h,r),[h,r]),isLoading:g}}var Cc=Chain.ETHEREUM,wc="24h",Lc=56;function Wn({chains:e,onSelectToken:t,className:o}){let r=e?.length===1?e[0]:e?.[0]??Cc,{tokens:s,isLoading:n}=eo({chain:r,resolution:wc});return jsx("div",{className:cn("w-full flex flex-col overflow-hidden",o),children:n?jsx(qt,{}):jsx("div",{className:"overflow-y-auto",children:s.map(i=>jsx("div",{style:{height:Lc},onClick:()=>t?.(i),children:jsx($t,{token:i,className:"h-full"})},i.address))})})}function _n({onKeywordChange:e}){let[t,o]=useState(""),[r,s]=useState(""),{addHistory:n}=_t(),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 Kn({chains:e,onKeywordChange:t,onSelectToken:o,onEscape:r}){let{text:s,keyword:n,setText:i,setKeyword:a,clearKeyword:l}=_n({onKeywordChange:t});return jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsx(vn,{value:s,onValueChange:i,onClear:l,onPaste:a,onEscape:r}),n?jsx(An,{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(yn,{onSelect:a}),jsx(Wn,{className:"flex-auto min-h-0",chains:e,onSelectToken:o})]})]})}var Bo="search";function hT({id:e=Bo}){return jsx(AsyncModal,{id:e,children:t=>jsx(Bc,{...t})})}function Bc({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(Kn,{chains:e?.chains,onSelectToken:i,onEscape:()=>o(false)})})]})})}function LT({chains:e,onSelectToken:t,className:o}){let{t:r}=useTranslation(),{isDesktop:s}=useScreen(),{onOpen:n,onClose:i}=useAsyncModal(Bo),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("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("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 Oe(e){return e==null||e===""?"--":formatPercent(Number(e)/100)}function pe(e,t=4,o=4){return e?e.length<=t+o+1?e:`${e.slice(0,t)}\u2026${e.slice(-o)}`:"--"}function Ne(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 A(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("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 Jn({token:e,actions:t,dataStrip:o,className:r,onCopyAddress:s}){let n=e?.address;return jsxs("div",{className:cn("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(ce,{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:[pe(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 Yn(e,t){return A(e,t)}function jn({price:e,marketCap:t,volume:o,holdersCount:r,socialMedia:s,className:n}){return jsxs("div",{className:cn("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 ky(e,t){return A(e,t)}function ts({holders:e,top10HoldingsRatio:t,top100HoldingsRatio:o,className:r}){return jsxs("div",{className:cn("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:Oe(t)}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:Oe(o)})]}),jsx("div",{className:"text-[10px] text-default-400",children:"Holders / Top10 / Top100"})]})}function os(e,t){return A(e,t)}function rs({chain:e,address:t,className:o}){let{token:r}=os(e,t);return jsx(ts,{holders:r?.marketData?.holders,top10HoldingsRatio:r?.marketData?.top10HoldingsRatio,top100HoldingsRatio:r?.marketData?.top100HoldingsRatio,className:o})}function is({marketCapInUsd:e,tvlInUsd:t,createdAt:o,className:r}){return jsxs("div",{className:cn("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:Ne(o)})]}),jsx("div",{className:"text-[10px] text-default-400",children:"MC / Liq / Age"})]})}function as(e,t){return A(e,t)}function ls({chain:e,address:t,className:o}){let{token:r}=as(e,t);return jsx(is,{marketCapInUsd:r?.marketData?.marketCapInUsd,tvlInUsd:r?.marketData?.tvlInUsd,createdAt:r?.createdAt,className:o})}function ms({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("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 ps(e,t){return A(e,t)}function us({chain:e,address:t,className:o}){let{token:r}=ps(e,t);return jsx(ms,{priceInUsd:r?.marketData?.priceInUsd,price24hAgoInUsd:r?.stats?.["24h"]?.openPriceInUsd,className:o})}function hm(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 fs({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("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:hm(n,o)},n))})}function gs(e,t){return A(e,t)}function xs({chain:e,address:t,className:o,iconSize:r}){let{token:s}=gs(e,t);return jsx(fs,{socials:s?.socialMedias,className:o,iconSize:r})}function bs({volumesInUsd:e,trades:t,traders:o,className:r}){return jsxs("div",{className:cn("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 Ts(e,t){return A(e,t)}function ys({chain:e,address:t,className:o}){let{token:r}=Ts(e,t),s=r?.stats?.["24h"];return jsx(bs,{volumesInUsd:s?.volumesInUsd,trades:s?.trades,traders:s?.traders,className:o})}function vs({chain:e,address:t,className:o}){return jsx(jn,{className:o,price:jsx(us,{chain:e,address:t}),marketCap:jsx(ls,{chain:e,address:t}),volume:jsx(ys,{chain:e,address:t}),holdersCount:jsx(rs,{chain:e,address:t}),socialMedia:jsx(xs,{chain:e,address:t})})}function Zv({chain:e,address:t,actions:o,dataStrip:r,className:s,onCopyAddress:n}){let{token:i}=Yn(e,t);return jsx(Jn,{token:i,actions:o,dataStrip:r===void 0?jsx(vs,{chain:e,address:t}):r,className:s,onCopyAddress:n})}var Cm=[{value:"holdingUsd",label:"Value"},{value:"lastActiveAt",label:"Last active"}];function Cs({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("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:Cm.map(u=>jsx("button",{type:"button",onClick:()=>r(u.value),className:cn("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(wm,{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 wm({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:pe(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(Ot,{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:Oe(e.ratio)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:e.startHoldingAt?Ne(e.startHoldingAt,t):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:e.lastActiveAt?Ne(e.lastActiveAt,t):"--"})]})}function Ps({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:f,isFetching:k}=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]),g=l[l.length-1],h=!!(g?.hasNext&&g.endCursor),b=useCallback(()=>{!g?.endCursor||!g.hasNext||a(g.endCursor);},[g]);return {holders:x,isLoading:f||k,sortBy:s,setSortBy:c,hasMore:h,loadMore:b}}function b0({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:f,loadMore:k}=Ps({chain:e,address:t,limit:o,initialSortBy:r});return jsx(Cs,{holders:m,isLoading:c,sortBy:p,onSortByChange:u,onlyTracked:l,onOnlyTrackedChange:d,wellKnownAddresses:n,hasMore:f,onLoadMore:k,className:i,renderAddress:a})}var Mm=[{value:"timestamp",label:"Latest"},{value:"totalUsd",label:"Top USD"}],Fm=[{value:"all",label:"All"},{value:"buy",label:"Buys"},{value:"sell",label:"Sells"}],Um=[{value:"all",label:"All"},{value:"dev",label:"DEV"},{value:"tracked",label:"TRACKED"},{value:"you",label:"YOU"}];function Rs({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:f=9,nativeSymbol:k="SOL",className:x,onRowClick:g}){let h=Dm(e,i,l);return jsxs("div",{className:cn("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:[Fm.map(b=>jsx("button",{type:"button",onClick:()=>n?.(b.value),className:cn("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}),Um.map(b=>{let T=i===b.value,I=b.value==="you"&&!l;return jsx("button",{type:"button",disabled:I,onClick:()=>a?.(b.value),className:cn("rounded px-2 py-1 text-[11px] transition-colors",T?"bg-default-100 text-foreground":"text-default-400 hover:text-foreground",I&&"cursor-not-allowed opacity-50"),children:b.label},b.value)})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx(Em,{value:d,nativeSymbol:k,onChange:m}),jsx("div",{className:"flex items-center gap-1",children:Mm.map(b=>jsx("button",{type:"button",onClick:()=>r(b.value),className:cn("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(Bm,{activity:b,now:u,nativeDecimals:f,nativeSymbol:k,currency:d,onRowClick:g},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 Om(e){return e.type==="buy"?e.to:e.type==="sell"?e.from:e.to}function Dm(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 Em({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("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 Wm(e,t,o){if(!e)return "--";let r=Number(e)/Math.pow(10,t);return Number.isFinite(r)?`${formatAmount(r)} ${o}`:"--"}function Bm({activity:e,now:t,nativeDecimals:o,nativeSymbol:r,currency:s,onRowClick:n}){let i=Om(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("border-b border-default-50 hover:bg-default-50/60",n&&"cursor-pointer"),onClick:n?()=>n(e):void 0,children:[jsx("td",{className:cn("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:pe(e.walletAddress,6,6)}),jsx(Mr,{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:Wm(e.gasFee,o,r)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:Ne(e.time,t)})]})}function Is({chain:e,address:t,limit:o=50,initialSortBy:r="timestamp",initialTypeFilter:s="all"}){let[n,i]=useState(r),[a,l]=useState(s),[d,m]=useState(void 0),[c,p]=useState([]),[u,f]=useState([]),k=useCallback(()=>{m(void 0),p([]),f([]);},[]),x=useCallback(F=>{F!==n&&(i(F),k());},[n,k]),g=useCallback(F=>{F!==a&&(l(F),k());},[a,k]);useEffect(()=>{k();},[e,t,k]);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:I,isFetching:M}=useTokenActivitiesQuery(b);useEffect(()=>{T&&p(F=>d==null?[T]:F[F.length-1]?.endCursor===T.endCursor?F:[...F,T]);},[T,d]);let Q=n==="timestamp"&&a==="all"&&d==null;useTokenActivitiesSubscription({chain:e,address:t},F=>{!Q||!F?.length||f(ne=>{let U=new Set(ne.map(W=>W.txHash)),P=F.filter(W=>!U.has(W.txHash));return P.length===0?ne:[...P,...ne].slice(0,100)});});let Se=useMemo(()=>{let F=c.flatMap(P=>P.data);if(!Q||u.length===0)return F;let ne=new Set(F.map(P=>P.txHash));return [...u.filter(P=>!ne.has(P.txHash)),...F]},[c,u,Q]),_=c[c.length-1],be=!!(_?.hasNext&&_.endCursor),Te=useCallback(()=>{!_?.endCursor||!_.hasNext||m(_.endCursor);},[_]);return {activities:Se,isLoading:I||M,sortBy:n,setSortBy:x,typeFilter:a,setTypeFilter:g,hasMore:be,loadMore:Te}}function E0({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),[f,k]=useState(i),{activities:x,isLoading:g,sortBy:h,setSortBy:b,typeFilter:T,setTypeFilter:I,hasMore:M,loadMore:Q}=Is({chain:e,address:t,limit:o,initialSortBy:r,initialTypeFilter:s});return jsx(Rs,{activities:x,isLoading:g,sortBy:h,onSortByChange:b,typeFilter:T,onTypeFilterChange:I,traderFilter:p,onTraderFilterChange:u,youWalletAddress:a,currency:f,onCurrencyChange:k,hasMore:M,onLoadMore:Q,className:m,nativeDecimals:l,nativeSymbol:d,onRowClick:c})}function Fs({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 Us(e,t){return A(e,t)}function j0({chain:e,address:t,resolution:o="24h",className:r}){let{token:s}=Us(e,t);return jsx(Fs,{stats:s?.stats,resolution:o,className:r})}function Os({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 Ds(e,t){return A(e,t)}function fN({chain:e,address:t,resolution:o="24h",className:r}){let{token:s}=Ds(e,t);return jsx(Os,{stats:s?.stats,resolution:o,className:r})}function Es({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 Ws(e,t){return A(e,t)}function RN({chain:e,address:t,resolution:o="24h",className:r}){let{token:s}=Ws(e,t);return jsx(Es,{stats:s?.stats,resolution:o,className:r})}function Bs({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("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("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(Jm,{...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 Jm({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("text-xs",t===void 0?"text-default-400":s?"text-success-500":"text-danger-500"),children:n})]})}function Vs(e,t){let{data:o,isLoading:r}=useTokenSecurityQuery({chain:e,address:t});return {security:o,isLoading:r}}function $N({chain:e,address:t,externalUrl:o,externalLabel:r,className:s}){let{security:n}=Vs(e,t);return jsx(Bs,{security:n,externalUrl:o,externalLabel:r,className:s})}function Ks({token:e,className:t}){return e?jsxs("section",{className:cn("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 zs(e,t){return A(e,t)}function rS({chain:e,address:t,className:o}){let{token:r}=zs(e,t);return jsx(Ks,{token:r,className:o})}function Gs({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("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("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: ",pe(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 Xs(e,t){return A(e,t)}function TS({chain:e,address:t,collapseAt:o,className:r,onPoolClick:s}){let{token:n}=Xs(e,t);return jsx(Gs,{liquidities:n?.liquidities,totalTvlInUsd:n?.marketData?.tvlInUsd,collapseAt:o,className:r,onPoolClick:s})}function Js({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("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("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(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 Ys(e){return {cexes:e}}function FS({cexes:e,collapseAt:t,className:o}){let{cexes:r}=Ys(e);return jsx(Js,{cexes:r,collapseAt:t,className:o})}function js({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("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("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 ei(e,t){return A(e,t)}function XS({chain:e,address:t,collapseAt:o,className:r,onCategoryClick:s}){let{token:n}=ei(e,t);return jsx(js,{categories:n?.tags,collapseAt:o,className:r,onCategoryClick:s})}var ti=["5m","1h","4h","24h"];function oi({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("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("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 ri({stats:e,resolutions:t,className:o}){return jsx("div",{className:cn("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("text-[13px] font-medium leading-none tabular-nums",a===void 0?"text-foreground":a?"text-bullish":"text-bearish"),children:d})]},r)})})}function ni({chain:e,address:t}){let{data:o,isLoading:r}=useTokenStatsQuery({chain:e,address:t});return {stats:o,isLoading:r}}function mC({chain:e,address:t,baseResolution:o="5m",hoverResolutions:r=ti,height:s=64,className:n}){let{stats:i}=ni({chain:e,address:t});return jsx(StatsFlipPanel,{className:n,height:s,base:jsx(oi,{stats:i,resolution:o}),hover:jsx(ri,{stats:i,resolutions:r})})}function si({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("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(vp,{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(Np,{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 vp({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("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 Np({position:e,currency:t,renderActions:o}){let{bought:r,sold:s,remaining:n,pnl:i}=useMemo(()=>Sp(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("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 Sp(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 li({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 f=useMemo(()=>i.flatMap(h=>h.portfolios),[i]),k=i[i.length-1],x=!!(k?.hasNext&&k.endCursor),g=useCallback(()=>{!k?.endCursor||!k.hasNext||n(k.endCursor);},[k]);return {positions:f,isLoading:!!t&&(p||u),hasMore:x,loadMore:g,showHidden:l,setShowHidden:d}}function RC({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:f}=li({chain:e,wallet:t,limit:o});return jsx(si,{className:i,positions:d,isLoading:m,hasMore:c,onLoadMore:p,currency:a,onCurrencyChange:l,showHidden:u,onShowHiddenChange:f,nativeSymbol:s,renderActions:n})}function di({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:f,className:k}){return jsxs("div",{className:cn("flex flex-col",k),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("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(Ip,{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(Mp,{order:x,currency:m,renderActions:f},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 Ip({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("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 Mp({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("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 Up(e){return e instanceof Error&&e.code==="NotImplemented"}function Op(e){return e==="active"?"active":"filled"}function ui({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 f=useCallback(_=>{_!==i&&a(_);},[i]),k=useMemo(()=>({chain:e,address:t??"",cursor:m,limit:r,state:Op(i),tokenAddress:l?o:void 0}),[e,t,m,r,i,l,o]),{data:x,isPending:g,isFetching:h,error:b}=useWalletLimitOrdersQuery(k,{enabled:!!t});useEffect(()=>{x&&u(_=>m==null?[x]:_[_.length-1]?.endCursor===x.endCursor?_:[..._,x]);},[x,m]);let T=!!b&&Up(b),I=useMemo(()=>p.flatMap(_=>_.data),[p]),M=p[p.length-1],Q=!!(M?.hasNext&&M.endCursor),Se=useCallback(()=>{!M?.endCursor||!M.hasNext||c(M.endCursor);},[M]);return {orders:I,isLoading:!!t&&!T&&(g||h),unavailable:T,hasMore:Q,loadMore:Se,stateFilter:i,setStateFilter:f,onlyThisToken:l,setOnlyThisToken:d}}function QC({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:f,unavailable:k,hasMore:x,loadMore:g,stateFilter:h,setStateFilter:b,onlyThisToken:T,setOnlyThisToken:I}=ui({chain:e,wallet:t,tokenAddress:o,limit:s,initialStateFilter:n});return jsx(di,{className:m,orders:u,isLoading:f,unavailable:k,hasMore:x,onLoadMore:g,stateFilter:h,onStateFilterChange:b,onlyThisToken:T,onOnlyThisTokenChange:I,tokenSymbol:r,currency:c,onCurrencyChange:p,nativeSymbol:a,onCancelAll:k?void 0:l,renderActions:d})}function fi({traders:e,isLoading:t,hasMore:o,onLoadMore:r,onlyTracked:s=false,onOnlyTrackedChange:n,now:i=Date.now(),renderAddress:a,className:l}){return jsxs("div",{className:cn("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:"Top Traders"}),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:d=>n?.(d.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(d=>jsx(_p,{trader:d,now:i,renderAddress:a},d.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 _p({trader:e,now:t,renderAddress:o}){let r=useMemo(()=>o?o(e.address):jsx("span",{className:"font-mono text-[11px] text-default-500",children:pe(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(Ot,{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:Oe(e.ratio)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:"\u2014"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:e.lastActiveAt?Ne(e.lastActiveAt,t):"--"})]})}function xi({chain:e,address:t,limit:o=50,initialOnlyTracked: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,sortBy:"realizedPnl"}),[e,t,s,o]),{data:c,isPending:p,isFetching:u}=useTokenTopTradersQuery(m);useEffect(()=>{c&&a(b=>s==null?[c]:b[b.length-1]?.endCursor===c.endCursor?b:[...b,c]);},[c,s]);let f=useMemo(()=>i.flatMap(b=>b.data),[i]),k=useMemo(()=>l?f.filter(b=>b.tags&&b.tags.length>0):f,[f,l]),x=i[i.length-1],g=!!(x?.hasNext&&x.endCursor),h=useCallback(()=>{!x?.endCursor||!x.hasNext||n(x.endCursor);},[x]);return {traders:k,isLoading:p||u,hasMore:g,loadMore:h,onlyTracked:l,setOnlyTracked:d}}function pw({chain:e,address:t,limit:o,className:r,renderAddress:s}){let{traders:n,isLoading:i,hasMore:a,loadMore:l,onlyTracked:d,setOnlyTracked:m}=xi({chain:e,address:t,limit:o});return jsx(fi,{className:r,traders:n,isLoading:i,hasMore:a,onLoadMore:l,onlyTracked:d,onOnlyTrackedChange:m,renderAddress:s})}function hi({tokens:e,isLoading:t,unavailable:o,hasMore:r,onLoadMore:s,renderTokenLink:n,className:i}){return jsxs("div",{className:cn("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(Qp,{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 Qp({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 bi({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("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(mo,{label:"Total",value:String(o)}),jsx(mo,{label:"Migrated",value:`${r} (${s}%)`}),jsx(mo,{label:"Total Market Cap",value:formatAmountUSDCompact(i.toString())}),jsx(mo,{label:"Total 1h Volume",value:formatAmountUSDCompact(n.toString())})]})]})}function mo({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 Jp(e){return e instanceof Error&&e.code==="NotImplemented"}function Ni({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(g=>r==null?[l]:g[g.length-1]?.endCursor===l.endCursor?g:[...g,l]);},[l,r]);let p=!!c&&Jp(c),u=useMemo(()=>n.flatMap(g=>g.data),[n]),f=n[n.length-1],k=!!(f?.hasNext&&f.endCursor),x=useCallback(()=>{!f?.endCursor||!f.hasNext||s(f.endCursor);},[f]);return {tokens:u,isLoading:!!t&&!p&&(d||m),unavailable:p,hasMore:k,loadMore:x}}function Pw({chain:e,creator:t,limit:o,showSummary:r=false,renderTokenLink:s,className:n}){let{tokens:i,isLoading:a,unavailable:l,hasMore:d,loadMore:m}=Ni({chain:e,creator:t,limit:o});return jsxs("div",{className:n,children:[jsx(hi,{tokens:i,isLoading:a,unavailable:l,hasMore:d,onLoadMore:m,renderTokenLink:s}),r&&!l?jsx(bi,{tokens:i}):null]})}function wi({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("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("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 Pi({chain:e,address:t}){return A(e,t)}function $w({chain:e,address:t,athInUsd:o,athAt:r,globalFeesPaidInUsd:s,rank:n,pinned:i,onTogglePin:a,className:l}){let{token:d}=Pi({chain:e,address:t});return jsx(wi,{className:l,token:d,athInUsd:o,athAt:r,globalFeesPaidInUsd:s,rank:n,pinned:i,onTogglePin:a})}function Ri({tokens:e,isLoading:t,unavailable:o,onTokenClick:r,className:s}){return o?jsx("div",{className:cn("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("flex items-center justify-center p-4 text-center text-[11px] text-default-400",s),children:"No similar tokens found."}):jsxs("ul",{className:cn("flex flex-col",s),children:[e.map(n=>jsxs("li",{className:cn("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 Ai({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 sL({chain:e,address:t,keyword:o,limit:r,onTokenClick:s,className:n}){let{tokens:i,isLoading:a,unavailable:l}=Ai({chain:e,address:t,keyword:o,limit:r});return jsx(Ri,{className:n,tokens:i,isLoading:a,unavailable:l,onTokenClick:s})}function Hi({tokens:e=[],unavailable:t=true,onTokenClick:o,className:r}){return t?jsx("div",{className:cn("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("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("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 Ii(e){return {tokens:[],isLoading:false,unavailable:true}}function hL({chain:e,address:t,onTokenClick:o,className:r}){let{tokens:s,unavailable:n}=Ii();return jsx(Hi,{className:r,tokens:s,unavailable:n,onTokenClick:o})}function Di({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=uo(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=uo(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?.(uo(p));},[o]),c=useCallback(p=>{d(p),r?.(uo(p));},[r]);return jsxs("div",{className:cn("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 uo(e){let t=e.split(",").map(o=>o.trim()).filter(Boolean);return t.length>0?t:void 0}function $i({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("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=Me(m);return jsx(Button,{variant:"bordered",size:"sm",radius:"full",className:cn("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 xe({title:e,field:t,value:o,onChange:r}){let{t:s}=useTranslation(),[n,i]=useState(o?mr(o).min:NaN),[a,l]=useState(o?mr(o).max:NaN);useEffect(()=>{if(o===void 0)i(NaN),l(NaN);else {let{min:c,max:p}=mr(o);i(c),l(p);}},[o]);let d=useCallback(c=>{i(c),r?.(Qi(t,c,a));},[t,r,a]),m=useCallback(c=>{l(c),r?.(Qi(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 mr(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 Qi(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 Xi({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("flex flex-col gap-4",o),children:[jsx(xe,{field:"holders",title:r("tokens.filters.stats.audits.holders"),value:s?.find(a=>a.field==="holders"),onChange:i("holders")}),jsx(xe,{field:"top10Ratio",title:r("tokens.filters.stats.audits.top10HoldingsRatio"),value:s?.find(a=>a.field==="top10Ratio"),onChange:i("top10Ratio")}),jsx(xe,{field:"top100Ratio",title:r("tokens.filters.stats.audits.top100HoldingsRatio"),value:s?.find(a=>a.field==="top100Ratio"),onChange:i("top100Ratio")}),jsx(xe,{field:"creatorsRatio",title:r("tokens.filters.stats.audits.devHoldingsRatio"),value:s?.find(a=>a.field==="creatorsRatio"),onChange:i("creatorsRatio")})]})}function Ji({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("flex flex-col gap-4",r),children:[jsx(xe,{field:"marketCap",title:s("tokens.filters.stats.metrics.marketCap"),value:n?.find(l=>l.field==="marketCap"),onChange:a("marketCap")}),jsx(xe,{field:"tvl",title:s("tokens.filters.stats.metrics.liquidity"),value:n?.find(l=>l.field==="tvl"),onChange:a("tvl")}),jsx(xe,{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(xe,{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 oa({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("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(Xi,{values:a,onValuesChange:d,className:cn({hidden:n!=="audits"})}),jsx(Ji,{values:a,onValuesChange:d,resolution:e,className:cn({hidden:n!=="metrics"})})]})}function yo({protocols:e,resolution:t,filters:o,onFiltersChange:r,className:s}){let[n,i]=useState(ra(o?.filters,e));useEffect(()=>{i(ra(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(g=>{i(g),r?.(To(e,g,a,d,c));},[e,a,d,c,r]),f=useCallback(g=>{l(g),r?.(To(e,n,g,d,c));},[e,n,d,c,r]),k=useCallback(g=>{m(g),r?.(To(e,n,a,g,c));},[e,n,a,c,r]),x=useCallback(g=>{p(g),r?.(To(e,n,a,d,g));},[e,n,a,d,r]);return jsxs("div",{className:cn("flex flex-col gap-4",s),children:[e&&e.length>0&&jsxs(Fragment,{children:[jsx($i,{protocols:e,selectedProtocols:n,onSelectedProtocolsChange:u}),jsx("div",{style:{height:1,background:"rgba(39,39,42,1)"}})]}),jsx(Di,{keywords:a,excludeKeywords:d,onKeywordsChange:f,onExcludeKeywordsChange:k}),jsx("div",{style:{height:1,background:"rgba(39,39,42,1)"}}),jsx(oa,{resolution:t,values:c,onValuesChange:x})]})}function ra(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 To(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 aa({protocols:e,resolution:t,filters:o,onFiltersChange:r}){let{t:s}=useTranslation(),{isOpen:n,onOpen:i,onClose:a,onOpenChange:l}=useDisclosure(),[d,m]=useState(o),c=useCallback(()=>{m(void 0);},[]),p=useCallback(()=>{r?.(d),a();},[d,r,a]);useEffect(()=>{m(o);},[n,o]);let u=useMemo(()=>Object.values(o||{}).every(f=>f===void 0),[o]);return jsxs(Fragment,{children:[jsxs("button",{type:"button",onClick:i,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:9999,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",width:32,height:32,minHeight:32,cursor:"pointer",position:"relative"},children:[jsx(FilterIcon,{width:16,height:16,className:"text-zinc-400"}),!u&&jsx("span",{style:{position:"absolute",top:-2,right:-2,width:8,height:8,borderRadius:4,background:"#c7ff2e"}})]}),jsx(StyledModal,{isOpen:n,onOpenChange:l,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:s("tokens.filters.modal.title")})}),jsx(ModalBody,{className:"px-0 pt-0 pb-4",children:jsx(ScrollShadow,{children:jsx(yo,{protocols:e,resolution:t,filters:d,onFiltersChange:m,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:c,children:s("common.reset")}),jsx(Button,{color:"primary",size:"sm",radius:"full",onPress:p,children:s("common.apply")})]})})]})})]})}var tf={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},of={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"},rf={height:1,background:"rgba(39,39,42,1)",margin:0};function ma({protocols:e,resolution:t,filters:o,onFiltersChange:r}){let{t:s}=useTranslation(),[n,i]=useState(false),a=useRef(null),[l,d]=useState(o),m=useCallback(()=>{d(void 0);},[]),c=useCallback(()=>{r?.(l),i(false);},[l,r]);useEffect(()=>{d(o);},[n,o]),useEffect(()=>{let u=f=>{a.current&&!a.current.contains(f.target)&&i(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[]),useEffect(()=>{if(!n)return;let u=f=>{f.key==="Escape"&&i(false);};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[n]);let p=useMemo(()=>Object.values(o||{}).every(u=>u===void 0),[o]);return jsxs("div",{ref:a,style:{position:"relative"},children:[jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxs("button",{type:"button",style:tf,onMouseEnter:u=>{u.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:u=>{u.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>i(u=>!u),children:[jsx(FilterIcon,{width:16,height:16,className:"flex-none"}),jsx("span",{className:"hidden sm:block",children:s("tokens.listHeader.filter")}),jsx(nf,{open:n})]}),!p&&jsx("span",{style:{position:"absolute",top:-4,right:-4,minWidth:8,height:8,borderRadius:4,background:"#c7ff2e"}})]}),n&&jsxs("div",{style:{...of,width:420},children:[jsx("div",{style:{padding:"16px 0"},children:jsx(ScrollShadow,{className:"w-full max-h-120 px-4",children:jsx(yo,{protocols:e,resolution:t,filters:l,onFiltersChange:d})})}),jsx("div",{style:rf}),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:m,children:s("common.reset")}),jsx(Button,{variant:"solid",size:"sm",color:"primary",radius:"full",onPress:c,children:s("common.apply")})]})]})]})}function nf({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 c1({popoverPlacement:e="bottom-end",...t}){let{isMobile:o}=useScreen();return o?jsx(aa,{...t}):jsx(ma,{placement:e,...t})}function fa({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 hf={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},bf={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 xa({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:hf,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:bf,children:o.map(l=>jsx("button",{type:"button",onClick:()=>a(l),className:cn("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 L1(e){let{isMobile:t}=useScreen();return t?jsx(xa,{...e}):jsx(fa,{...e})}var ba=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(s&&"text-bullish",!s&&!n&&"text-bearish",r===void 0&&"text-neutral"),children:formatPercent(r)})]})})});function $f(e){return e.length<=10?e:`${e.slice(0,4)}...${e.slice(-4)}`}var wa=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(ce,{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:$f(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 La=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($,{icon:jsx(PeopleIcon,{width:12,height:12}),value:formatAmount(r?.holders),tooltip:o("tokens.tokenInfo.holders"),warning:false,disable:!r?.holders}),jsx($,{icon:jsx(KlineCandlesIcon,{width:12,height:12}),value:formatAmount(r?.proHolders),tooltip:o("tokens.tokenInfo.proHolders"),warning:false,disable:!r?.proHolders}),jsx($,{icon:jsx(StarIcon,{width:12,height:12}),value:formatAmount(r?.kolHolders),tooltip:o("tokens.tokenInfo.kolHolders"),warning:false,disable:!r?.kolHolders}),jsx($,{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($,{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($,{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($,{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($,{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 Pa=memo(function({token:t}){let o=useMemo(()=>t.marketData?.tvlInUsd,[t.marketData?.tvlInUsd]);return jsx(Fragment,{children:formatAmountUSD(o)})});var Ra=memo(function({token:t}){let o=useMemo(()=>t.marketData?.marketCapInUsd,[t.marketData?.marketCapInUsd]);return jsx(Fragment,{children:formatAmountUSD(o)})});var Ia=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("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 Fa=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 Oa=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 Ea=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 bg=`
|
|
21
|
+
`})]})}function Jr({token:e,renderAction:t,isLast:o=false,onSelectToken:r,className:s}){let{t:n}=useTranslation(),i=useCopyToClipboard(),l=useTickAge(e.createdAt),a=e.marketData,d=e.stats?.["1h"],m=useCallback(()=>{r?.(e);},[r,e]),c=useCallback(D=>{D.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(()=>a?.marketCapInUsd,[a?.marketCapInUsd]),b=useMemo(()=>a?.tvlInUsd,[a?.tvlInUsd]),h=useMemo(()=>{let D=new SafeBigNumber(x);return D.lt(1e3)?"text-foreground":D.lt(1e6)?"text-secondary":"text-primary"},[x]),k=useMemo(()=>new SafeBigNumber(a?.top10HoldingsRatio).gte(.1),[a?.top10HoldingsRatio]),T=useMemo(()=>new SafeBigNumber(a?.devHoldingsRatio).gte(.1),[a?.devHoldingsRatio]),C=useMemo(()=>new SafeBigNumber(a?.insiderHoldingsRatio).gte(.1),[a?.insiderHoldingsRatio]),y=useMemo(()=>new SafeBigNumber(a?.sniperHoldingsRatio).gte(.1),[a?.sniperHoldingsRatio]),L=useMemo(()=>new SafeBigNumber(a?.bundleHoldingsRatio).gte(.1),[a?.bundleHoldingsRatio]),[W,I]=useMemo(()=>{let D=Number(d?.buys??0),H=Number(d?.sells??0),_=D+H;if(_===0)return [12,12];let xt=Math.round(D/_*24);return [xt,24-xt]},[d?.buys,d?.sells]),te=a?.holders!==void 0&&a.holders>0,Se=a?.proHolders!==void 0&&a.proHolders>0,O=a?.kolHolders!==void 0&&a.kolHolders>0,ie=te||Se||O;return jsxs("div",{className:cn("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(l)}),e.socialMedias?.website&&jsx(Link,{href:e.socialMedias.website,className:"text-neutral hover:text-primary",target:"_blank",onClick:D=>D.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:D=>D.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:D=>D.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:D=>D.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(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(b)})]})]}),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(a?.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(a?.proHolders)]})}),O&&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(a?.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("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(a?.top10HoldingsRatio),tooltip:n("tokens.tokenInfo.top10HoldingsRatio"),warning:k,disable:!a?.top10HoldingsRatio||a?.top10HoldingsRatio==="0"}),jsx(z,{icon:jsx(CookIcon,{width:12,height:12}),value:formatPercent(a?.devHoldingsRatio),tooltip:n("tokens.tokenInfo.devHoldingsRatio"),warning:T,disable:!a?.devHoldingsRatio||a?.devHoldingsRatio==="0"}),jsx(z,{icon:jsx(SniperIcon,{width:12,height:12}),value:formatPercent(a?.sniperHoldingsRatio),tooltip:n("tokens.tokenInfo.sniperHoldingsRatio"),warning:y,disable:!a?.sniperHoldingsRatio||a?.sniperHoldingsRatio==="0"}),jsx(z,{icon:jsx(RatIcon,{width:12,height:12}),value:formatPercent(a?.insiderHoldingsRatio),tooltip:n("tokens.tokenInfo.insiderHoldingsRatio"),warning:C,disable:!a?.insiderHoldingsRatio||a?.insiderHoldingsRatio==="0"}),jsx(z,{icon:jsx(BundlesIcon,{width:12,height:12}),value:formatPercent(a?.bundleHoldingsRatio),tooltip:n("tokens.tokenInfo.bundleHoldingsRatio"),warning:L,disable:!a?.bundleHoldingsRatio||a?.bundleHoldingsRatio==="0"})]})}),t&&jsx("div",{className:"flex-none relative",onClick:D=>D.stopPropagation(),children:t(e)})]})]})}var nd=152,Zr=10;function sd({index:e,style:t,data:o,skeletonCount:r,renderItemAction:s,onSelectToken:n}){if(!o)return jsx("div",{style:t,children:jsx(Ho,{isLast:e===r-1})});let i=o[e];return i?jsx("div",{style:t,children:jsx(Jr,{token:i,isLast:e===o.length-1,renderAction:s,onSelectToken:n})}):jsx("div",{style:t,children:jsx(Ho,{isLast:e===o.length-1})})}function Je({title:e,tokens:t,isLoading:o,itemHeight:r=nd,renderHeaderExtra:s,renderItemAction:n,onSelectToken:i,onPauseChange:l,onScrollingChange:a,className:d,hideHeader:m}){let c=o||!t?void 0:t,p=c?c.length:Zr,u=useMemo(()=>({data:c,skeletonCount:Zr,renderItemAction:n,onSelectToken:i}),[c,n,i]),[g,f]=useState(false),x=useRef(void 0),b=useRef(false),h=useCallback(()=>{f(true),l?.(true);},[l]),k=useCallback(()=>{f(false),l?.(false);},[l]),T=useCallback(()=>{b.current||(b.current=true,a?.(true)),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{b.current=false,a?.(false);},180);},[a]);return useEffect(()=>()=>{x.current&&clearTimeout(x.current),b.current&&a?.(false);},[a]),jsxs("div",{className:cn("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:k,children:[!m&&jsx(Ur,{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:sd,rowProps:u,overscanCount:10})})]})}function Oo(e,t){let o={...e};for(let r of Object.keys(t))t[r]!==void 0&&(o[r]=t[r]);return o}var ad=["1m","5m","15m","30m","1h","4h","24h"];function ld(e,t){if(!t)return e;if(!e)return t;let o={...e};for(let r of ad)t[r]&&(o[r]=e[r]?Oo(e[r],t[r]):t[r]);return o}function dd(e,t){return t?e?Oo(e,t):t:e}function _t(e,t){return t?e?Oo(e,t):t:e}function X(e,t){let{chain:o,address:r,stats:s,marketData:n,socialMedias:i,security:l,launchedFrom:a,migratedTo:d,...m}=t,c={...e};for(let p of Object.keys(m))m[p]!==void 0&&(c[p]=m[p]);return c.stats=ld(e.stats,s),c.marketData=dd(e.marketData,n),c.socialMedias=_t(e.socialMedias,i),c.security=_t(e.security,l),c.launchedFrom=_t(e.launchedFrom,a),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 cd(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}cd(s)&&(o.push(s),r=true);}return r?o:e}var pd=["24h","12h","30m","15m","30s","15s","1m","5m","1h","4h","1s"],ud=new Set(["price","marketCap","tvl","holders","top10Holdings","top10Ratio","top100Holdings","top100Ratio","creatorsHoldings","creatorsRatio","createdAt","launchedFromProtocolFamily","migratedToProtocolFamily","tag"]),fd=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 en(e){for(let t of pd){if(!e.endsWith(t))continue;let o=e.slice(0,-t.length);return o?{metric:o,resolution:t}:void 0}}function tn(e){if(ud.has(e))return true;let t=en(e);return t?fd.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 jr(e,e.launchedFrom?.protocolFamily);case "migratedToProtocolFamily":return jr(e,e.migratedTo?.protocolFamily);case "tag":return e.tags?.[0];}let o=en(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 jr(e,t){if(t)return parseTokenProtocolFamily(e.chain,t)??t}var gd=new Set(["top10Ratio","top100Ratio","creatorsRatio"]);function on(e){let t=e.trim().toLowerCase();return t.length>0?t:void 0}function xd(e){return [e.name,e.symbol].filter(Boolean).join(" ").toLowerCase()}function kd(e){return Array.isArray(e)?e:void 0}function bd(e){return Array.isArray(e)?void 0:e}function rn(e,t){if(!gd.has(e))return t;let o=Number(t);return Number.isFinite(o)?o/100:t}function ge(e,t){let o=bd(t);return o===void 0?void 0:rn(e,o)}function Do(e,t){return kd(t)?.map(o=>rn(e,o))}function Ye(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 hd(e,t){if(!tn(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?Ye(o,s):void 0;return n!==void 0&&n>0}case "gte":{let s=ge(t.field,t.value),n=s!==void 0?Ye(o,s):void 0;return n!==void 0&&n>=0}case "lt":{let s=ge(t.field,t.value),n=s!==void 0?Ye(o,s):void 0;return n!==void 0&&n<0}case "lte":{let s=ge(t.field,t.value),n=s!==void 0?Ye(o,s):void 0;return n!==void 0&&n<=0}case "between":{let s=Do(t.field,t.value);if(!s||s.length<2)return false;let n=Ye(o,s[0]),i=Ye(o,s[1]);return n!==void 0&&i!==void 0&&n>=0&&i<=0}case "in":{let s=Do(t.field,t.value);return s?s.some(n=>zt(o,n)):false}case "nin":{let s=Do(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(on).filter(n=>n!==void 0),r=t?.excludeKeywords?.map(on).filter(n=>n!==void 0),s=t?.filters;return !o?.length&&!r?.length&&!s?.length?e:e.filter(n=>{let i=xd(n);return !(o?.length&&!o.some(l=>i.includes(l))||r?.length&&r.some(l=>i.includes(l))||s?.length&&!s.every(l=>hd(n,l)))})}function de({applyUpdates:e,paused:t=false,flushInterval:o=500}){let r=useRef(e),s=useRef(t),n=useRef([]),i=useRef(),l=useRef();r.current=e,s.current=t;let a=useCallback(()=>{i.current!==void 0&&(clearTimeout(i.current),i.current=void 0),l.current!==void 0&&(cancelAnimationFrame(l.current),l.current=void 0);},[]),d=useCallback(()=>{if(a(),s.current){i.current=setTimeout(d,o);return}let p=n.current;p.length!==0&&(n.current=[],r.current(p));},[a,o]),m=useCallback(()=>{i.current!==void 0||l.current!==void 0||(i.current=setTimeout(()=>{i.current=void 0,l.current=requestAnimationFrame(()=>{l.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(()=>a,[a]),{enqueueUpdates:c,flush:d}}function dn({chain:e,tokens:t,onUpdate:o,enabled:r=true}){let{subscribeClient:s}=useDexClient(),n=useRef(new Map),i=useRef(o);i.current=o;let l=useMemo(()=>Array.from(new Set(t.map(m=>m.address.trim()).filter(Boolean))).sort().join(","),[t]),a=useMemo(()=>l?l.split(","):[],[l]),d=()=>{n.current.forEach(m=>m.unsubscribe()),n.current.clear();};useEffect(()=>d,[e,s,r]),useEffect(()=>{if(!r){d();return}let m=new Set(a),c=n.current;for(let[p,u]of c)m.has(p)||(u.unsubscribe(),c.delete(p));for(let p of a)c.has(p)||c.set(p,s.subscribeToken(e,p,u=>{i.current(u);}));},[a,e,r,s]);}var Nd=80;function gn(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 Sd(e,t,o){return e===t?o:e===o?t:o||t}function Bo(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:Sd(t,e.tokenAAddress,e.tokenBAddress),image:e.dex?.image,programAddress:e.dex?.programAddress,protocolFamily:e.dex?.protocolFamily,protocolName:e.dex?.protocolName}]}}function Cd(e){return {...gn(Bo(e)),...e.token??{},liquidities:Bo(e).liquidities,createdAt:e.token?.createdAt??e.createdAt}}function fn(e){return e.sort((t,o)=>{let r=t.createdAt?.getTime()??0;return (o.createdAt?.getTime()??0)-r}),e.slice(0,Nd)}function xn({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 l=useRef(e),[a,d]=useState(true),[m,c]=useState([]);useEffect(()=>{e!==l.current&&(d(true),c([]),l.current=e);},[e]);let{data:p,isPending:u}=useNewPoolsQuery(n);useEffect(()=>{p&&(c(k=>{let T=i.current,C=k.length===0&&p.length>0,y=[...k];for(let L of p){let W=Cd(L),I=y.findIndex(te=>te.address===W.address);I>=0?y[I]=X(y[I],W):(!T||C)&&y.push(W);}return T?y:fn(y)}),d(false));},[p]);let g=useCallback(k=>{c(T=>{let C=i.current,y=[...T],L=false;for(let W of k){let I=y.findIndex(te=>te.address===W.address);I>=0?(L=true,y[I]=X(y[I],W)):C||(L=true,y.push(gn(W)));}return L?C?y:fn(y):T});},[]),{enqueueUpdates:f}=de({applyUpdates:g,paused:r,flushInterval:s}),x=useCallback(k=>{f(k.map(Bo));},[f]);useNewPoolsSubscription({chain:e},x),dn({chain:e,tokens:m,onUpdate:f});let b=useMemo(()=>u||a,[u,a]);return {tokens:useMemo(()=>le(m,t),[m,t]),isLoading:b}}function db({chain:e,filters:t,title:o,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,className:i,hideHeader:l}){let[a,d]=useState(false),[m,c]=useState(false),{tokens:p,isLoading:u}=xn({chain:e,filters:t,isPaused:a,deferUpdates:m}),g=useCallback(f=>{d(f);},[]);return jsx(Je,{title:o,tokens:p,isLoading:u,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,onPauseChange:g,onScrollingChange:c,className:i,hideHeader:l})}function xe({chain:e,tokens:t,onUpdate:o,enabled:r=true}){let s=useMemo(()=>Array.from(new Set(t.map(i=>i.address.trim()).filter(Boolean))).sort().join(","),[t]),n=useMemo(()=>s?s.split(","):[],[s]);useTokensSubscription({chain:e,addresses:n},o,{enabled:r&&n.length>0});}function vn({chain:e,filters:t,isPaused:o=false,refetchInterval:r=3e4,deferUpdates:s=false,updateFlushInterval:n}){let i=useMemo(()=>({chain:e}),[e]),l=useRef(o);l.current=o;let a=useRef(e),[d,m]=useState(true),[c,p]=useState([]);useEffect(()=>{e!==a.current&&(m(true),p([]),a.current=e);},[e]);let{data:u,isPending:g}=useMigratedTokensQuery(i,{refetchInterval:r});useEffect(()=>{u&&(p(k=>{let T=l.current,C=[...k];for(let y of u){let L=C.findIndex(W=>W.address===y.address);L>=0?C[L]=X(C[L],y):T||C.unshift(y);}return C}),m(false));},[u]);let f=useCallback(k=>{p(T=>Re(T,k));},[]),{enqueueUpdates:x}=de({applyUpdates:f,paused:s,flushInterval:n});xe({chain:e,tokens:c,onUpdate:x});let b=useMemo(()=>g||d,[g,d]);return {tokens:useMemo(()=>le(c,t),[c,t]),isLoading:b}}function wb({chain:e,filters:t,title:o,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,className:i,hideHeader:l}){let[a,d]=useState(false),[m,c]=useState(false),{tokens:p,isLoading:u}=vn({chain:e,filters:t,isPaused:a,deferUpdates:m}),g=useCallback(f=>{d(f);},[]);return jsx(Je,{title:o,tokens:p,isLoading:u,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,onPauseChange:g,onScrollingChange:c,className:i,hideHeader:l})}function Ud(e){return e.sort((t,o)=>{let r=Number(t.migrateProgress??0);return Number(o.migrateProgress??0)-r})}function Ln({chain:e,filters:t,isPaused:o=false,refetchInterval:r=15e3,deferUpdates:s=false,updateFlushInterval:n}){let i=useMemo(()=>({chain:e}),[e]),l=useRef(o);l.current=o;let a=useRef(e),[d,m]=useState(true),[c,p]=useState([]);useEffect(()=>{e!==a.current&&(m(true),p([]),a.current=e);},[e]);let{data:u,isPending:g}=useFinalStretchTokensQuery(i,{refetchInterval:r});useEffect(()=>{u&&(p(k=>{let T=l.current,C=k.length===0&&u.length>0,y=[...k];for(let L of u){let W=y.findIndex(I=>I.address===L.address);W>=0?y[W]=X(y[W],L):(!T||C)&&y.push(L);}return T?y:Ud(y)}),m(false));},[u]);let f=useCallback(k=>{p(T=>Re(T,k));},[]),{enqueueUpdates:x}=de({applyUpdates:f,paused:s,flushInterval:n});xe({chain:e,tokens:c,onUpdate:x});let b=useMemo(()=>g||d,[g,d]);return {tokens:useMemo(()=>le(c,t),[c,t]),isLoading:b}}function Wb({chain:e,filters:t,title:o,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,className:i,hideHeader:l}){let[a,d]=useState(false),[m,c]=useState(false),{tokens:p,isLoading:u}=Ln({chain:e,filters:t,isPaused:a,deferUpdates:m}),g=useCallback(f=>{d(f);},[]);return jsx(Je,{title:o,tokens:p,isLoading:u,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,onPauseChange:g,onScrollingChange:c,className:i,hideHeader:l})}var Wd=10,Vd=atomWithStorage("liberfi:search_histories",[],void 0,{getOnInit:true});function Qt(){let[e,t]=useAtom(Vd),o=useCallback(s=>{let n=s.trim();n&&t(i=>{let l=i.filter(a=>a!==n);return [n,...l].slice(0,Wd)});},[t]),r=useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:o,clearHistories:r}}function Hn({histories:e,onSelect:t,onClear:o,className:r}){let{t:s}=useTranslation();return e.length===0?null:jsxs("div",{className:cn("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("text-neutral","border-border border-1","cursor-pointer","hover:opacity-hover"),onClick:()=>t?.(n),children:n},n))})]})}function Fn({onSelect:e,className:t}){let{histories:o,clearHistories:r}=Qt();return jsx(Hn,{className:cn(t),histories:o,onSelect:e,onClear:r})}function Mn({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]),l=useMemo(()=>e.stats?.["24h"]?.priceChange,[e]),a=useMemo(()=>l?new SafeBigNumber(l).abs().toString():void 0,[l]),d=useMemo(()=>l!=null&&new SafeBigNumber(l).gte(0),[l]);return jsxs("div",{className:cn("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("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(a)})]})]})]})}function Xt({className:e}){let{t}=useTranslation();return jsxs("div",{className:cn("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 cc(){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("w-full",t),children:Array.from({length:e}).map((o,r)=>jsx(cc,{},r))})}function Wn({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:l,fetchNextPage:a}=useSearchTokensInfiniteQuery(r,{enabled:!!e});return {tokens:useMemo(()=>s?.pages.flatMap(m=>m.data)??[],[s]),isLoading:n,isFetchingNextPage:i,hasNextPage:l??false,fetchNextPage:a}}var Tc=56;function _n({onSelectToken:e,className:t,...o}){let{tokens:r,isLoading:s,isFetchingNextPage:n,hasNextPage:i,fetchNextPage:l}=Wn(o),a=useRef(null),{height:d}=useResizeObserver({ref:a}),m=useCallback(g=>g<r.length,[r]),c=useCallback(async()=>{i&&!n&&await l();},[i,n,l]),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("w-full",t),children:[jsx(Xt,{}),jsx(Yt,{})]}):r.length===0?jsxs("div",{className:cn("w-full",t),children:[jsx(Xt,{}),jsx(vc,{})]}):jsxs("div",{className:cn("w-full h-full flex flex-col",t),children:[jsx(Xt,{className:"flex-none"}),jsx("div",{className:"flex-auto min-h-0",ref:a,children:jsx(List,{style:{height:d},onRowsRendered:u,rowComponent:yc,rowCount:p,rowHeight:Tc,rowProps:{tokens:r,onSelectToken:e},overscanCount:5})})]})}function yc({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 vc(){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 Nc(e,t){return typeof e=="number"&&typeof t=="number"?e-t:String(e).localeCompare(String(t))}function et(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 l=n.value===void 0,a=i.value===void 0;if(l&&a)return n.index-i.index;if(l)return 1;if(a)return -1;let d=Nc(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 l=useMemo(()=>({chain:e,resolution:t}),[e,t]),a=useRef(l),[d,m]=useState(true);useEffect(()=>{JSON.stringify(l)!==JSON.stringify(a.current)&&(m(true),a.current=l);},[l]);let[c,p]=useState([]),{data:u,isPending:g}=useTrendingTokensQuery(l,{refetchInterval:s});useEffect(()=>{u&&(p(T=>$t(T,u)),m(false));},[u]);let f=useCallback(T=>{p(C=>Re(C,T));},[]),{enqueueUpdates:x}=de({applyUpdates:f,paused:n,flushInterval:i});useTrendingTokensSubscription({chain:e},x),xe({chain:e,tokens:c,onUpdate:x});let b=useMemo(()=>!!(g||d),[g,d]),h=useMemo(()=>le(c,o),[c,o]);return {tokens:useMemo(()=>et(h,r),[h,r]),isLoading:b}}var Ac=Chain.ETHEREUM,Ic="24h",Hc=56;function zn({chains:e,onSelectToken:t,className:o}){let r=e?.length===1?e[0]:e?.[0]??Ac,{tokens:s,isLoading:n}=eo({chain:r,resolution:Ic});return jsx("div",{className:cn("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:Hc},onClick:()=>t?.(i),children:jsx(Gt,{token:i,className:"h-full"})},i.address))})})}function Gn({onKeywordChange:e}){let[t,o]=useState(""),[r,s]=useState(""),{addHistory:n}=Qt(),i=useCallbackRef(e),l=useCallbackRef(n),a=useMemo(()=>debounce(p=>{s(p),i(p),p&&l(p);},500),[i,l]),d=useCallback(p=>{o(p),a(p);},[a]),m=useCallback(p=>{a.cancel(),o(p),s(p),i(p),p&&l(p);},[a,i,l]),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:l,clearKeyword:a}=Gn({onKeywordChange:t});return jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsx(Mn,{value:s,onValueChange:i,onClear:a,onPaste:l,onEscape:r}),n?jsx(_n,{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(Fn,{onSelect:l}),jsx(zn,{className:"flex-auto min-h-0",chains:e,onSelectToken:o})]})]})}var zo="search";function AT({id:e=zo}){return jsx(AsyncModal,{id:e,children:t=>jsx(zc,{...t})})}function zc({params:e,isOpen:t,onOpenChange:o,onResult:r}){let{t:s}=useTranslation(),{isMobile:n}=useScreen(),i=useCallback(l=>{r(l);},[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 BT({chains:e,onSelectToken:t,className:o}){let{t:r}=useTranslation(),{isDesktop:s}=useScreen(),{onOpen:n,onClose:i}=useAsyncModal(zo),l=useCallbackRef(t),a=useCallbackRef(async()=>{let m=await n({params:{chains:e}});m&&l(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(),a()),c.key==="Escape"&&(c.preventDefault(),d());};return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m);}},[a,d]),s?jsx(Button,{size:"sm",radius:"full",onPress:a,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("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:a,variant:"bordered",className:cn("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 Ee(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 l=Math.floor(i/24);if(l<30)return `${l}d`;let a=Math.floor(l/30);return a<12?`${a}mo`:`${Math.floor(l/365)}y`}function M(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(l=>{if(!l)return l;let a=l;for(let d of i)a=X(a,d);return a});}),{token:s,isLoading:r}}function tt({label:e,totalFormatted:t,buysFormatted:o,sellsFormatted:r,totalValue:s=0,buysValue:n=0,className:i}){let l=new SafeBigNumber(s??0),a=new SafeBigNumber(n??0),d=l.eq(0)?0:a.div(l).times(100).toNumber();return jsxs("div",{className:cn("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 os({token:e,actions:t,dataStrip:o,className:r,onCopyAddress:s}){let n=e?.address;return jsxs("div",{className:cn("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 rs(e,t){return M(e,t)}function ss({price:e,marketCap:t,volume:o,holdersCount:r,socialMedia:s,className:n}){return jsxs("div",{className:cn("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 Ry(e,t){return M(e,t)}function as({holders:e,top10HoldingsRatio:t,top100HoldingsRatio:o,className:r}){return jsxs("div",{className:cn("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:Ee(t)}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:Ee(o)})]}),jsx("div",{className:"text-[10px] text-default-400",children:"Holders / Top10 / Top100"})]})}function ls(e,t){return M(e,t)}function ds({chain:e,address:t,className:o}){let{token:r}=ls(e,t);return jsx(as,{holders:r?.marketData?.holders,top10HoldingsRatio:r?.marketData?.top10HoldingsRatio,top100HoldingsRatio:r?.marketData?.top100HoldingsRatio,className:o})}function ps({marketCapInUsd:e,tvlInUsd:t,createdAt:o,className:r}){return jsxs("div",{className:cn("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 us(e,t){return M(e,t)}function fs({chain:e,address:t,className:o}){let{token:r}=us(e,t);return jsx(ps,{marketCapInUsd:r?.marketData?.marketCapInUsd,tvlInUsd:r?.marketData?.tvlInUsd,createdAt:r?.createdAt,className:o})}function ks({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("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 bs(e,t){return M(e,t)}function hs({chain:e,address:t,className:o}){let{token:r}=bs(e,t);return jsx(ks,{priceInUsd:r?.marketData?.priceInUsd,price24hAgoInUsd:r?.stats?.["24h"]?.openPriceInUsd,className:o})}function Nm(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 Ts({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("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:Nm(n,o)},n))})}function ys(e,t){return M(e,t)}function vs({chain:e,address:t,className:o,iconSize:r}){let{token:s}=ys(e,t);return jsx(Ts,{socials:s?.socialMedias,className:o,iconSize:r})}function Cs({volumesInUsd:e,trades:t,traders:o,className:r}){return jsxs("div",{className:cn("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 ws(e,t){return M(e,t)}function Ls({chain:e,address:t,className:o}){let{token:r}=ws(e,t),s=r?.stats?.["24h"];return jsx(Cs,{volumesInUsd:s?.volumesInUsd,trades:s?.trades,traders:s?.traders,className:o})}function Ps({chain:e,address:t,className:o}){return jsx(ss,{className:o,price:jsx(hs,{chain:e,address:t}),marketCap:jsx(fs,{chain:e,address:t}),volume:jsx(Ls,{chain:e,address:t}),holdersCount:jsx(ds,{chain:e,address:t}),socialMedia:jsx(vs,{chain:e,address:t})})}function c0({chain:e,address:t,actions:o,dataStrip:r,className:s,onCopyAddress:n}){let{token:i}=rs(e,t);return jsx(os,{token:i,actions:o,dataStrip:r===void 0?jsx(Ps,{chain:e,address:t}):r,className:s,onCopyAddress:n})}var Am=[{value:"holdingUsd",label:"Value"},{value:"lastActiveAt",label:"Last active"}];function Is({holders:e,isLoading:t,sortBy:o,onSortByChange:r,onlyTracked:s=false,onOnlyTrackedChange:n,onLoadMore:i,hasMore:l,now:a=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("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:Am.map(u=>jsx("button",{type:"button",onClick:()=>r(u.value),className:cn("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(Im,{holder:u,now:a,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"})})]})]})}),l&&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 Im({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:Ee(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 Ms({chain:e,address:t,limit:o=50,initialSortBy:r="holdingUsd"}){let[s,n]=useState(r),[i,l]=useState(void 0),[a,d]=useState([]),m=useCallback(()=>{l(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(()=>a.flatMap(T=>T.data),[a]),b=a[a.length-1],h=!!(b?.hasNext&&b.endCursor),k=useCallback(()=>{!b?.endCursor||!b.hasNext||l(b.endCursor);},[b]);return {holders:x,isLoading:g||f,sortBy:s,setSortBy:c,hasMore:h,loadMore:k}}function I0({chain:e,address:t,limit:o,initialSortBy:r,initialOnlyTracked:s=false,wellKnownAddresses:n,className:i,renderAddress:l}){let[a,d]=useState(s),{holders:m,isLoading:c,sortBy:p,setSortBy:u,hasMore:g,loadMore:f}=Ms({chain:e,address:t,limit:o,initialSortBy:r});return jsx(Is,{holders:m,isLoading:c,sortBy:p,onSortByChange:u,onlyTracked:a,onOnlyTrackedChange:d,wellKnownAddresses:n,hasMore:g,onLoadMore:f,className:i,renderAddress:l})}var Em=[{value:"timestamp",label:"Latest"},{value:"totalUsd",label:"Top USD"}],Bm=[{value:"all",label:"All"},{value:"buy",label:"Buys"},{value:"sell",label:"Sells"}],Wm=[{value:"all",label:"All"},{value:"dev",label:"DEV"},{value:"tracked",label:"TRACKED"},{value:"you",label:"YOU"}];function Us({activities:e,isLoading:t,sortBy:o,onSortByChange:r,typeFilter:s="all",onTypeFilterChange:n,traderFilter:i="all",onTraderFilterChange:l,youWalletAddress:a,currency:d="usd",onCurrencyChange:m,onLoadMore:c,hasMore:p,now:u=Date.now(),nativeDecimals:g=9,nativeSymbol:f="SOL",className:x,onRowClick:b}){let h=_m(e,i,a);return jsxs("div",{className:cn("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:[Bm.map(k=>jsx("button",{type:"button",onClick:()=>n?.(k.value),className:cn("rounded px-2 py-1 text-[11px] transition-colors",s===k.value?"bg-default-100 text-foreground":"text-default-400 hover:text-foreground"),children:k.label},k.value)),jsx("span",{className:"mx-1 h-3 w-px bg-default-200","aria-hidden":true}),Wm.map(k=>{let T=i===k.value,C=k.value==="you"&&!a;return jsx("button",{type:"button",disabled:C,onClick:()=>l?.(k.value),className:cn("rounded px-2 py-1 text-[11px] transition-colors",T?"bg-default-100 text-foreground":"text-default-400 hover:text-foreground",C&&"cursor-not-allowed opacity-50"),children:k.label},k.value)})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx($m,{value:d,nativeSymbol:f,onChange:m}),jsx("div",{className:"flex items-center gap-1",children:Em.map(k=>jsx("button",{type:"button",onClick:()=>r(k.value),className:cn("rounded px-2 py-1 text-[11px] transition-colors",o===k.value?"bg-default-100 text-foreground":"text-default-400 hover:text-foreground"),children:k.label},k.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(k=>jsx(zm,{activity:k,now:u,nativeDecimals:g,nativeSymbol:f,currency:d,onRowClick:b},k.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 Vm(e){return e.type==="buy"?e.to:e.type==="sell"?e.from:e.to}function _m(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 $m({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("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 Km(e,t,o){if(!e)return "--";let r=Number(e)/Math.pow(10,t);return Number.isFinite(r)?`${formatAmount(r)} ${o}`:"--"}function zm({activity:e,now:t,nativeDecimals:o,nativeSymbol:r,currency:s,onRowClick:n}){let i=Vm(e),l=e.type==="buy"?"Buy":e.type==="sell"?"Sell":e.type.replace(/_/g," "),a=e.type==="buy"?"text-bullish":e.type==="sell"?"text-bearish":"text-default-500";return jsxs("tr",{className:cn("border-b border-default-50 hover:bg-default-50/60",n&&"cursor-pointer"),onClick:n?()=>n(e):void 0,children:[jsx("td",{className:cn("px-3 py-2 align-middle font-medium capitalize",a),children:l}),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(Br,{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:Km(e.gasFee,o,r)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:Pe(e.time,t)})]})}function Es({chain:e,address:t,limit:o=50,initialSortBy:r="timestamp",initialTypeFilter:s="all"}){let[n,i]=useState(r),[l,a]=useState(s),[d,m]=useState(void 0),[c,p]=useState([]),[u,g]=useState([]),f=useCallback(()=>{m(void 0),p([]),g([]);},[]),x=useCallback(O=>{O!==n&&(i(O),f());},[n,f]),b=useCallback(O=>{O!==l&&(a(O),f());},[l,f]);useEffect(()=>{f();},[e,t,f]);let h=l==="all"?void 0:l,k=useMemo(()=>({chain:e,address:t,cursor:d,limit:o,sortBy:n,type:h}),[e,t,d,o,n,h]),{data:T,isPending:C,isFetching:y}=useTokenActivitiesQuery(k);useEffect(()=>{T&&p(O=>d==null?[T]:O[O.length-1]?.endCursor===T.endCursor?O:[...O,T]);},[T,d]);let L=n==="timestamp"&&l==="all"&&d==null;useTokenActivitiesSubscription({chain:e,address:t},O=>{!L||!O?.length||g(ie=>{let D=new Set(ie.map(_=>_.txHash)),H=O.filter(_=>!D.has(_.txHash));return H.length===0?ie:[...H,...ie].slice(0,100)});});let W=useMemo(()=>{let O=c.flatMap(H=>H.data);if(!L||u.length===0)return O;let ie=new Set(O.map(H=>H.txHash));return [...u.filter(H=>!ie.has(H.txHash)),...O]},[c,u,L]),I=c[c.length-1],te=!!(I?.hasNext&&I.endCursor),Se=useCallback(()=>{!I?.endCursor||!I.hasNext||m(I.endCursor);},[I]);return {activities:W,isLoading:C||y,sortBy:n,setSortBy:x,typeFilter:l,setTypeFilter:b,hasMore:te,loadMore:Se}}function J0({chain:e,address:t,limit:o,initialSortBy:r,initialTypeFilter:s,initialTraderFilter:n="all",initialCurrency:i="usd",youWalletAddress:l,nativeDecimals:a,nativeSymbol:d,className:m,onRowClick:c}){let[p,u]=useState(n),[g,f]=useState(i),{activities:x,isLoading:b,sortBy:h,setSortBy:k,typeFilter:T,setTypeFilter:C,hasMore:y,loadMore:L}=Es({chain:e,address:t,limit:o,initialSortBy:r,initialTypeFilter:s});return jsx(Us,{activities:x,isLoading:b,sortBy:h,onSortByChange:k,typeFilter:T,onTypeFilterChange:C,traderFilter:p,onTraderFilterChange:u,youWalletAddress:l,currency:g,onCurrencyChange:f,hasMore:y,onLoadMore:L,className:m,nativeDecimals:a,nativeSymbol:d,onRowClick:c})}function Ws({stats:e,resolution:t,className:o}){let r=e?.[t],s=r?.traders??0,n=r?.buyers??0,i=r?.sellers??0;return jsx(tt,{className:o,label:`Traders (${t})`,totalFormatted:formatAmount(s),buysFormatted:formatAmount(n),sellsFormatted:formatAmount(i),totalValue:s,buysValue:n})}function Vs(e,t){return M(e,t)}function mN({chain:e,address:t,resolution:o="24h",className:r}){let{token:s}=Vs(e,t);return jsx(Ws,{stats:s?.stats,resolution:o,className:r})}function _s({stats:e,resolution:t,className:o}){let r=e?.[t],s=r?.trades??0,n=r?.buys??0,i=r?.sells??0;return jsx(tt,{className:o,label:`Transactions (${t})`,totalFormatted:formatAmount(s),buysFormatted:formatAmount(n),sellsFormatted:formatAmount(i),totalValue:s,buysValue:n})}function $s(e,t){return M(e,t)}function wN({chain:e,address:t,resolution:o="24h",className:r}){let{token:s}=$s(e,t);return jsx(_s,{stats:s?.stats,resolution:o,className:r})}function Ks({stats:e,resolution:t,className:o}){let r=e?.[t],s=r?.volumesInUsd??"0",n=r?.buyVolumesInUsd??"0",i=r?.sellVolumesInUsd??"0";return jsx(tt,{className:o,label:`Volume (${t})`,totalFormatted:formatAmountUSDCompact(s),buysFormatted:formatAmountUSDCompact(n),sellsFormatted:formatAmountUSDCompact(i),totalValue:s,buysValue:n})}function zs(e,t){return M(e,t)}function VN({chain:e,address:t,resolution:o="24h",className:r}){let{token:s}=zs(e,t);return jsx(Ks,{stats:s?.stats,resolution:o,className:r})}function qs({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("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("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(tp,{...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 tp({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("text-xs",t===void 0?"text-default-400":s?"text-success-500":"text-danger-500"),children:n})]})}function Qs(e,t){let{data:o,isLoading:r}=useTokenSecurityQuery({chain:e,address:t});return {security:o,isLoading:r}}function tS({chain:e,address:t,externalUrl:o,externalLabel:r,className:s}){let{security:n}=Qs(e,t);return jsx(qs,{security:n,externalUrl:o,externalLabel:r,className:s})}function Js({token:e,className:t}){return e?jsxs("section",{className:cn("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 Ys(e,t){return M(e,t)}function gS({chain:e,address:t,className:o}){let{token:r}=Ys(e,t);return jsx(Js,{token:r,className:o})}function ei({liquidities:e,totalTvlInUsd:t,collapseAt:o=3,className:r,onPoolClick:s}){let[n,i]=useState(!e||e.length<=o),l=useCallback(()=>i(a=>!a),[]);return jsxs("section",{className:cn("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((a,d)=>jsxs("div",{className:cn("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(a):void 0,children:[jsxs("div",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:"text-foreground",children:a.protocolFamily??a.protocolName??"Unknown"}),a.poolAddress&&jsxs("span",{className:"font-mono text-[10px] text-default-400",children:["Pool: ",ke(a.poolAddress,6,6)]})]}),jsx("div",{className:"text-default-500",children:formatAmountUSDCompact(a.tvlInUsd??0)})]},a.poolAddress??`${a.protocolFamily}-${d}`)),e.length>o&&jsx("div",{className:"flex justify-center pt-1",children:jsx("button",{type:"button",onClick:l,className:"rounded px-2 py-1 text-xs text-default-400 transition-colors hover:text-foreground",children:n?"Show less":"Show more"})})]})]})}function ti(e,t){return M(e,t)}function HS({chain:e,address:t,collapseAt:o,className:r,onPoolClick:s}){let{token:n}=ti(e,t);return jsx(ei,{liquidities:n?.liquidities,totalTvlInUsd:n?.marketData?.tvlInUsd,collapseAt:o,className:r,onPoolClick:s})}function oi({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("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,l)=>{let a=l>=t&&!r,d=jsx(Chip,{startContent:i.logo?jsx(Image,{src:i.logo,width:20,height:20,alt:i.name}):void 0,className:cn("bg-default-100 text-xs",a&&"hidden"),children:i.name},i.id);return i.url?jsx("a",{href:i.url,target:"_blank",rel:"noreferrer noopener",className:cn(a&&"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 ri(e){return {cexes:e}}function qS({cexes:e,collapseAt:t,className:o}){let{cexes:r}=ri(e);return jsx(oi,{cexes:r,collapseAt:t,className:o})}function si({categories:e,collapseAt:t=4,className:o,onCategoryClick:r}){let[s,n]=useState(!e||e.length<=t),i=useCallback(()=>n(l=>!l),[]);return !e||e.length===0?null:jsxs("section",{className:cn("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((l,a)=>{let d=a>=t&&!s;return jsx(Chip,{size:"sm",className:cn("bg-default-100",d&&"hidden",r&&"cursor-pointer"),onClick:r?()=>r(l):void 0,children:l},l)})}),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 ii(e,t){return M(e,t)}function aC({chain:e,address:t,collapseAt:o,className:r,onCategoryClick:s}){let{token:n}=ii(e,t);return jsx(si,{categories:n?.tags,collapseAt:o,className:r,onCategoryClick:s})}var ai=["5m","1h","4h","24h"];function li({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),l=s.minus(n),a=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(l.abs().toString()),className:l.gte(0)?"text-bullish":"text-bearish"}];return jsxs("div",{className:cn("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("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:`${a}%`}})})]})}function di({stats:e,resolutions:t,className:o}){return jsx("div",{className:cn("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,l=i?i.gte(0):void 0,a=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:a}),jsx("span",{className:cn("text-[13px] font-medium leading-none tabular-nums",l===void 0?"text-foreground":l?"text-bullish":"text-bearish"),children:d})]},r)})})}function ci({chain:e,address:t}){let{data:o,isLoading:r}=useTokenStatsQuery({chain:e,address:t});return {stats:o,isLoading:r}}function NC({chain:e,address:t,baseResolution:o="5m",hoverResolutions:r=ai,height:s=64,className:n}){let{stats:i}=ci({chain:e,address:t});return jsx(StatsFlipPanel,{className:n,height:s,base:jsx(li,{stats:i,resolution:o}),hover:jsx(di,{stats:i,resolutions:r})})}function mi({positions:e,isLoading:t,hasMore:o,onLoadMore:r,currency:s="usd",onCurrencyChange:n,showHidden:i=false,onShowHiddenChange:l,nativeSymbol:a="Native",renderActions:d,className:m}){return jsxs("div",{className:cn("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=>l?.(c.target.checked)}),"Show Hidden"]})]}),jsx(Lp,{value:s,nativeSymbol:a,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(Pp,{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 Lp({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("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 Pp({position:e,currency:t,renderActions:o}){let{bought:r,sold:s,remaining:n,pnl:i}=useMemo(()=>Rp(e,t),[e,t]),l=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:l}),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("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 Rp(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),l=t==="usd"?formatAmountUSDCompact(r??0):formatAmount(r??0),a=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:l,remaining:a,pnl:{amount:c,ratio:p,isPositive:m}}}function fi({chain:e,wallet:t,limit:o=50,initialShowHidden:r=false}){let[s,n]=useState(void 0),[i,l]=useState([]),[a,d]=useState(r);useEffect(()=>{n(void 0),l([]);},[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&&l(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),b=useCallback(()=>{!f?.endCursor||!f.hasNext||n(f.endCursor);},[f]);return {positions:g,isLoading:!!t&&(p||u),hasMore:x,loadMore:b,showHidden:a,setShowHidden:d}}function VC({chain:e,wallet:t,limit:o,initialCurrency:r="usd",nativeSymbol:s,renderActions:n,className:i}){let[l,a]=useState(r),{positions:d,isLoading:m,hasMore:c,loadMore:p,showHidden:u,setShowHidden:g}=fi({chain:e,wallet:t,limit:o});return jsx(mi,{className:i,positions:d,isLoading:m,hasMore:c,onLoadMore:p,currency:l,onCurrencyChange:a,showHidden:u,onShowHiddenChange:g,nativeSymbol:s,renderActions:n})}function gi({orders:e,isLoading:t,unavailable:o,hasMore:r,onLoadMore:s,stateFilter:n,onStateFilterChange:i,onlyThisToken:l=false,onOnlyThisTokenChange:a,tokenSymbol:d,currency:m="usd",onCurrencyChange:c,nativeSymbol:p="Native",onCancelAll:u,renderActions:g,className:f}){return jsxs("div",{className:cn("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("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:l,onChange:x=>a?.(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(Dp,{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(Ep,{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 Dp({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("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 Ep({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("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 Wp(e){return e instanceof Error&&e.code==="NotImplemented"}function Vp(e){return e==="active"?"active":"filled"}function hi({chain:e,wallet:t,tokenAddress:o,limit:r=50,initialStateFilter:s="active",initialOnlyThisToken:n=false}){let[i,l]=useState(s),[a,d]=useState(n),[m,c]=useState(void 0),[p,u]=useState([]);useEffect(()=>{c(void 0),u([]);},[e,t,i,a,o]);let g=useCallback(I=>{I!==i&&l(I);},[i]),f=useMemo(()=>({chain:e,address:t??"",cursor:m,limit:r,state:Vp(i),tokenAddress:a?o:void 0}),[e,t,m,r,i,a,o]),{data:x,isPending:b,isFetching:h,error:k}=useWalletLimitOrdersQuery(f,{enabled:!!t});useEffect(()=>{x&&u(I=>m==null?[x]:I[I.length-1]?.endCursor===x.endCursor?I:[...I,x]);},[x,m]);let T=!!k&&Wp(k),C=useMemo(()=>p.flatMap(I=>I.data),[p]),y=p[p.length-1],L=!!(y?.hasNext&&y.endCursor),W=useCallback(()=>{!y?.endCursor||!y.hasNext||c(y.endCursor);},[y]);return {orders:C,isLoading:!!t&&!T&&(b||h),unavailable:T,hasMore:L,loadMore:W,stateFilter:i,setStateFilter:g,onlyThisToken:a,setOnlyThisToken:d}}function sw({chain:e,wallet:t,tokenAddress:o,tokenSymbol:r,limit:s,initialStateFilter:n="active",initialCurrency:i="usd",nativeSymbol:l,onCancelAll:a,renderActions:d,className:m}){let[c,p]=useState(i),{orders:u,isLoading:g,unavailable:f,hasMore:x,loadMore:b,stateFilter:h,setStateFilter:k,onlyThisToken:T,setOnlyThisToken:C}=hi({chain:e,wallet:t,tokenAddress:o,limit:s,initialStateFilter:n});return jsx(gi,{className:m,orders:u,isLoading:g,unavailable:f,hasMore:x,onLoadMore:b,stateFilter:h,onStateFilterChange:k,onlyThisToken:T,onOnlyThisTokenChange:C,tokenSymbol:r,currency:c,onCurrencyChange:p,nativeSymbol:l,onCancelAll:f?void 0:a,renderActions:d})}function Ti({traders:e,isLoading:t,hasMore:o,onLoadMore:r,onlyTracked:s=false,onOnlyTrackedChange:n,now:i=Date.now(),renderAddress:l,className:a}){return jsxs("div",{className:cn("flex flex-col",a),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:"Top Traders"}),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:d=>n?.(d.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(d=>jsx(Qp,{trader:d,now:i,renderAddress:l},d.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 Qp({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:Ee(e.ratio)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:"\u2014"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:e.lastActiveAt?Pe(e.lastActiveAt,t):"--"})]})}function vi({chain:e,address:t,limit:o=50,initialOnlyTracked:r=false}){let[s,n]=useState(void 0),[i,l]=useState([]),[a,d]=useState(r);useEffect(()=>{n(void 0),l([]);},[e,t]);let m=useMemo(()=>({chain:e,address:t,cursor:s,limit:o,sortBy:"realizedPnl"}),[e,t,s,o]),{data:c,isPending:p,isFetching:u}=useTokenTopTradersQuery(m);useEffect(()=>{c&&l(k=>s==null?[c]:k[k.length-1]?.endCursor===c.endCursor?k:[...k,c]);},[c,s]);let g=useMemo(()=>i.flatMap(k=>k.data),[i]),f=useMemo(()=>a?g.filter(k=>k.tags&&k.tags.length>0):g,[g,a]),x=i[i.length-1],b=!!(x?.hasNext&&x.endCursor),h=useCallback(()=>{!x?.endCursor||!x.hasNext||n(x.endCursor);},[x]);return {traders:f,isLoading:p||u,hasMore:b,loadMore:h,onlyTracked:a,setOnlyTracked:d}}function Sw({chain:e,address:t,limit:o,className:r,renderAddress:s}){let{traders:n,isLoading:i,hasMore:l,loadMore:a,onlyTracked:d,setOnlyTracked:m}=vi({chain:e,address:t,limit:o});return jsx(Ti,{className:r,traders:n,isLoading:i,hasMore:l,onLoadMore:a,onlyTracked:d,onOnlyTrackedChange:m,renderAddress:s})}function Si({tokens:e,isLoading:t,unavailable:o,hasMore:r,onLoadMore:s,renderTokenLink:n,className:i}){return jsxs("div",{className:cn("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(l=>jsx(Zp,{token:l,renderTokenLink:n},`${l.chain}:${l.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 Zp({token:e,renderTokenLink:t}){let o=e.marketData?.marketCapInUsd??e.marketData?.marketCap,r=e.marketData?.tvlInUsd,n=e.stats?.["1h"]?.volumesInUsd,i=!!e.migratedTo,l=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:l}),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 Ci({tokens:e,className:t}){let o=e.length,r=e.filter(l=>!!l.migratedTo).length,s=o===0?0:Math.round(r/o*100),n=e.map(l=>l.stats?.["1h"]?.volumesInUsd??"0").reduce((l,a)=>l.plus(new SafeBigNumber(a)),new SafeBigNumber(0)),i=e.map(l=>l.marketData?.marketCapInUsd??l.marketData?.marketCap??"0").reduce((l,a)=>l.plus(new SafeBigNumber(a)),new SafeBigNumber(0));return jsxs("div",{className:cn("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(mo,{label:"Total",value:String(o)}),jsx(mo,{label:"Migrated",value:`${r} (${s}%)`}),jsx(mo,{label:"Total Market Cap",value:formatAmountUSDCompact(i.toString())}),jsx(mo,{label:"Total 1h Volume",value:formatAmountUSDCompact(n.toString())})]})]})}function mo({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 tu(e){return e instanceof Error&&e.code==="NotImplemented"}function Ri({chain:e,creator:t,limit:o=20}){let[r,s]=useState(void 0),[n,i]=useState([]);useEffect(()=>{s(void 0),i([]);},[e,t]);let l=useMemo(()=>({chain:e,creator:t??"",cursor:r,limit:o}),[e,t,r,o]),{data:a,isPending:d,isFetching:m,error:c}=useTokensByCreatorQuery(l,{enabled:!!t});useEffect(()=>{a&&i(b=>r==null?[a]:b[b.length-1]?.endCursor===a.endCursor?b:[...b,a]);},[a,r]);let p=!!c&&tu(c),u=useMemo(()=>n.flatMap(b=>b.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 Ww({chain:e,creator:t,limit:o,showSummary:r=false,renderTokenLink:s,className:n}){let{tokens:i,isLoading:l,unavailable:a,hasMore:d,loadMore:m}=Ri({chain:e,creator:t,limit:o});return jsxs("div",{className:n,children:[jsx(Si,{tokens:i,isLoading:l,unavailable:a,hasMore:d,onLoadMore:m,renderTokenLink:s}),r&&!a?jsx(Ci,{tokens:i}):null]})}function Hi({token:e,athInUsd:t,athAt:o,globalFeesPaidInUsd:r,rank:s,onTogglePin:n,pinned:i,className:l}){let a=e?.marketData?.priceInUsd,d=e?.marketData?.tvlInUsd,m=e?.marketData?.totalSupply;return jsxs("div",{className:cn("flex h-[48px] w-full flex-row items-center gap-4 overflow-x-auto px-3 text-[12px]",l),children:[jsx(dt,{label:"Price",value:a?formatPriceUSD(a):"--"}),jsx(dt,{label:"Liquidity",value:d?formatAmountUSDCompact(d):"--"}),jsx(dt,{label:"Supply",value:m?formatAmount(m):"--"}),r?jsx(dt,{label:"Fees Paid",value:formatAmountUSDCompact(r)}):null,t?jsx(dt,{label:"ATH",value:formatAmountUSDCompact(t),title:o?`All-time high at ${o.toLocaleDateString()}`:void 0}):null,s!==void 0?jsx(dt,{label:"Rank",value:`#${s}`}):null,jsx("div",{className:"flex-1"}),n?jsx("button",{type:"button",onClick:n,"aria-pressed":i,className:cn("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 dt({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 Mi({chain:e,address:t}){return M(e,t)}function tL({chain:e,address:t,athInUsd:o,athAt:r,globalFeesPaidInUsd:s,rank:n,pinned:i,onTogglePin:l,className:a}){let{token:d}=Mi({chain:e,address:t});return jsx(Hi,{className:a,token:d,athInUsd:o,athAt:r,globalFeesPaidInUsd:s,rank:n,pinned:i,onTogglePin:l})}function Ui({tokens:e,isLoading:t,unavailable:o,onTokenClick:r,className:s}){return o?jsx("div",{className:cn("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("flex items-center justify-center p-4 text-center text-[11px] text-default-400",s),children:"No similar tokens found."}):jsxs("ul",{className:cn("flex flex-col",s),children:[e.map(n=>jsxs("li",{className:cn("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 Oi({chain:e,address:t,keyword:o,limit:r=10}){let s=!!o&&o.length>0,{data:n,isPending:i,isFetching:l}=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||l),unavailable:!s}}function kL({chain:e,address:t,keyword:o,limit:r,onTokenClick:s,className:n}){let{tokens:i,isLoading:l,unavailable:a}=Oi({chain:e,address:t,keyword:o,limit:r});return jsx(Ui,{className:n,tokens:i,isLoading:l,unavailable:a,onTokenClick:s})}function Di({tokens:e=[],unavailable:t=true,onTokenClick:o,className:r}){return t?jsx("div",{className:cn("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("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("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 Ei(e){return {tokens:[],isLoading:false,unavailable:true}}function AL({chain:e,address:t,onTokenClick:o,className:r}){let{tokens:s,unavailable:n}=Ei();return jsx(Di,{className:r,tokens:s,unavailable:n,onTokenClick:o})}function $i({keywords:e,excludeKeywords:t,onKeywordsChange:o,onExcludeKeywordsChange:r,className:s}){let{t:n}=useTranslation(),[i,l]=useState(e?.join(", ")??""),[a,d]=useState(t?.join(", ")??"");useEffect(()=>{l(p=>{let u=uo(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=uo(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=>{l(p),o?.(uo(p));},[o]),c=useCallback(p=>{d(p),r?.(uo(p));},[r]);return jsxs("div",{className:cn("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:a,onValueChange:c})]})]})}function uo(e){let t=e.split(",").map(o=>o.trim()).filter(Boolean);return t.length>0?t:void 0}function Xi({protocols:e,selectedProtocols:t=[],onSelectedProtocolsChange:o,className:r}){let{t:s}=useTranslation(),[n,i]=useState(t);useEffect(()=>{i(t);},[t]);let l=useMemo(()=>e.every(m=>n.includes(m)),[e,n]),a=useCallback(()=>{if(l){let m=[];i(m),o?.(m);}else {let m=[...e];i(m),o?.(m);}},[e,o,l]),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("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:a,children:s(l?"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("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?xr(o).min:NaN),[l,a]=useState(o?xr(o).max:NaN);useEffect(()=>{if(o===void 0)i(NaN),a(NaN);else {let{min:c,max:p}=xr(o);i(c),a(p);}},[o]);let d=useCallback(c=>{i(c),r?.(ji(t,c,l));},[t,r,l]),m=useCallback(c=>{a(c),r?.(ji(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:l,onValueChange:m,variant:"bordered",radius:"lg",size:"sm",placeholder:s("tokens.filters.stats.max"),"aria-label":`${e} max`})]})]})}function xr(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 ji(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 ta({values:e,onValuesChange:t,className:o}){let{t:r}=useTranslation(),[s,n]=useState(e);useEffect(()=>{n(e);},[e]);let i=useCallback(l=>a=>{if(a===void 0){let d=(s??[]).filter(m=>m.field!==l);d=d.length>0?d:void 0,n(d),t?.(d);}else {let d=[...(s??[]).filter(m=>m.field!==l),a];n(d),t?.(d);}},[s,t]);return jsxs("div",{className:cn("flex flex-col gap-4",o),children:[jsx(ye,{field:"holders",title:r("tokens.filters.stats.audits.holders"),value:s?.find(l=>l.field==="holders"),onChange:i("holders")}),jsx(ye,{field:"top10Ratio",title:r("tokens.filters.stats.audits.top10HoldingsRatio"),value:s?.find(l=>l.field==="top10Ratio"),onChange:i("top10Ratio")}),jsx(ye,{field:"top100Ratio",title:r("tokens.filters.stats.audits.top100HoldingsRatio"),value:s?.find(l=>l.field==="top100Ratio"),onChange:i("top100Ratio")}),jsx(ye,{field:"creatorsRatio",title:r("tokens.filters.stats.audits.devHoldingsRatio"),value:s?.find(l=>l.field==="creatorsRatio"),onChange:i("creatorsRatio")})]})}function oa({resolution:e,values:t,onValuesChange:o,className:r}){let{t:s}=useTranslation(),[n,i]=useState(t);useEffect(()=>{i(t);},[t]);let l=useCallback(a=>d=>{if(d===void 0){let m=(n??[]).filter(c=>c.field!==a);m=m.length>0?m:void 0,i(m),o?.(m);}else {let m=[...(n??[]).filter(c=>c.field!==a),d];i(m),o?.(m);}},[n,o]);return jsxs("div",{className:cn("flex flex-col gap-4",r),children:[jsx(ye,{field:"marketCap",title:s("tokens.filters.stats.metrics.marketCap"),value:n?.find(a=>a.field==="marketCap"),onChange:l("marketCap")}),jsx(ye,{field:"tvl",title:s("tokens.filters.stats.metrics.liquidity"),value:n?.find(a=>a.field==="tvl"),onChange:l("tvl")}),jsx(ye,{field:`volumes${e}`,title:s("tokens.filters.stats.metrics.volumes",{resolution:s(`common.resolution.${e}`)}),value:n?.find(a=>a.field===`volumes${e}`),onChange:l(`volumes${e}`)}),jsx(ye,{field:`trades${e}`,title:s("tokens.filters.stats.metrics.txns",{resolution:s(`common.resolution.${e}`)}),value:n?.find(a=>a.field===`trades${e}`),onChange:l(`trades${e}`)})]})}function la({resolution:e,values:t,onValuesChange:o,className:r}){let{t:s}=useTranslation(),[n,i]=useState("audits"),[l,a]=useState(t);useEffect(()=>{a(t);},[t]);let d=useCallback(p=>{a(p),o?.(p);},[o]),m=useMemo(()=>{let p=["holders","top10Ratio","top100Ratio","creatorsRatio"];return l?.filter(u=>p.includes(u.field))?.length??0},[l]),c=useMemo(()=>{let p=["marketCap","tvl",`volumes${e}`,`trades${e}`];return l?.filter(u=>p.includes(u.field)).length??0},[l,e]);return jsxs("div",{className:cn("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(ta,{values:l,onValuesChange:d,className:cn({hidden:n!=="audits"})}),jsx(oa,{values:l,onValuesChange:d,resolution:e,className:cn({hidden:n!=="metrics"})})]})}function yo({protocols:e,resolution:t,filters:o,onFiltersChange:r,className:s}){let[n,i]=useState(da(o?.filters,e));useEffect(()=>{i(da(o?.filters,e));},[o?.filters,e]);let[l,a]=useState(o?.keywords);useEffect(()=>{a(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(b=>{i(b),r?.(To(e,b,l,d,c));},[e,l,d,c,r]),g=useCallback(b=>{a(b),r?.(To(e,n,b,d,c));},[e,n,d,c,r]),f=useCallback(b=>{m(b),r?.(To(e,n,l,b,c));},[e,n,l,c,r]),x=useCallback(b=>{p(b),r?.(To(e,n,l,d,b));},[e,n,l,d,r]);return jsxs("div",{className:cn("flex flex-col gap-4",s),children:[e&&e.length>0&&jsxs(Fragment,{children:[jsx(Xi,{protocols:e,selectedProtocols:n,onSelectedProtocolsChange:u}),jsx("div",{style:{height:1,background:"rgba(39,39,42,1)"}})]}),jsx($i,{keywords:l,excludeKeywords:d,onKeywordsChange:g,onExcludeKeywordsChange:f}),jsx("div",{style:{height:1,background:"rgba(39,39,42,1)"}}),jsx(la,{resolution:t,values:c,onValuesChange:x})]})}function da(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 To(e,t,o,r,s){let n=s?[...s.filter(i=>i.field!=="launchedFromProtocolFamily")]:[];return e&&e.length>0&&(e.every(l=>t.includes(l))||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 ua({protocols:e,resolution:t,filters:o,onFiltersChange:r,triggerVariant:s="default",badgePlacement:n="outer",className:i}){let{t:l}=useTranslation(),{isOpen:a,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);},[a,o]);let x=useMemo(()=>Object.values(o||{}).every(b=>b===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:a,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:l("tokens.filters.modal.title")})}),jsx(ModalBody,{className:"px-0 pt-0 pb-4",children:jsx(ScrollShadow,{children:jsx(yo,{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:l("common.reset")}),jsx(Button,{color:"primary",size:"sm",radius:"full",onPress:f,children:l("common.apply")})]})})]})})]})}var ka={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},af={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"},lf={height:1,background:"rgba(39,39,42,1)",margin:0};function ba({protocols:e,resolution:t,filters:o,onFiltersChange:r,iconOnly:s=false,className:n}){let{t:i}=useTranslation(),[l,a]=useState(false),d=useRef(null),[m,c]=useState(o),p=useCallback(()=>{c(void 0);},[]),u=useCallback(()=>{r?.(m),a(false);},[m,r]);useEffect(()=>{c(o);},[l,o]),useEffect(()=>{let f=x=>{d.current&&!d.current.contains(x.target)&&a(false);};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]),useEffect(()=>{if(!l)return;let f=x=>{x.key==="Escape"&&a(false);};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[l]);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?{...ka,justifyContent:"center",gap:0,width:32,minWidth:32,padding:0}:ka,onMouseEnter:f=>{f.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:f=>{f.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>a(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(df,{open:l})]})]}),!g&&jsx("span",{style:{position:"absolute",top:-4,right:-4,minWidth:8,height:8,borderRadius:4,background:"#c7ff2e"}})]}),l&&jsxs("div",{style:{...af,width:420},children:[jsx("div",{style:{padding:"16px 0"},children:jsx(ScrollShadow,{className:"w-full max-h-120 px-4",children:jsx(yo,{protocols:e,resolution:t,filters:m,onFiltersChange:c})})}),jsx("div",{style:lf}),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 df({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 v1({popoverPlacement:e="bottom-end",iconOnly:t,className:o,desktopOverlay:r="popover",...s}){let{isMobile:n}=useScreen();return n||r==="modal"?jsx(ua,{className:o,...s}):jsx(ba,{placement:e,iconOnly:t,className:o,...s})}function ya({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 Nf={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},Sf={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 Na({resolution:e,onResolutionChange:t,resolutionOptions:o=["1m","5m","1h","4h","24h"]}){let{t:r}=useTranslation(),[s,n]=useState(false),i=useRef(null),l=useCallback(a=>{t?.(a),n(false);},[t]);return useEffect(()=>{if(!s)return;let a=m=>{i.current&&!i.current.contains(m.target)&&n(false);},d=m=>{m.key==="Escape"&&n(false);};return document.addEventListener("mousedown",a),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",d);}},[s]),jsxs("div",{ref:i,style:{position:"relative",zIndex:50},children:[jsxs("button",{type:"button",style:Nf,onClick:()=>n(a=>!a),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:Sf,children:o.map(a=>jsx("button",{type:"button",onClick:()=>l(a),className:cn("w-full text-left px-3 py-1.5 rounded-lg text-xs font-medium transition-colors cursor-pointer",a===e?"text-primary bg-primary/10":"text-zinc-400 hover:text-foreground hover:bg-zinc-800"),children:r(`common.resolution.${a}`)},a))})]})}function B1(e){let{isMobile:t}=useScreen();return t?jsx(Na,{...e}):jsx(ya,{...e})}var wa=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(s&&"text-bullish",!s&&!n&&"text-bearish",r===void 0&&"text-neutral"),children:formatPercent(r)})]})})});function Gf(e){return e.length<=10?e:`${e.slice(0,4)}...${e.slice(-4)}`}var Fa=memo(function({token:t}){let o=useCopyToClipboard(),[r,s]=useState(false),[n,i]=useState(false),l=useRef(void 0),a=useRef(void 0),{t:d}=useTranslation(),m=useCallback(u=>{u.preventDefault(),u.stopPropagation(),o(t.name,()=>{toast.success(d("tokens.copied.name")),s(true),l.current&&clearTimeout(l.current),l.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),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{i(false);},2e3);});},[o,t.address,d]);useEffect(()=>()=>{l.current&&clearTimeout(l.current),a.current&&clearTimeout(a.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:Gf(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 Ma=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]),l=useMemo(()=>new SafeBigNumber(r?.insiderHoldingsRatio).gte(.1),[r?.insiderHoldingsRatio]),a=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:l,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:a,disable:!r?.bundleHoldingsRatio||r?.bundleHoldingsRatio==="0",tooltipPlacement:"bottom"})]})]})});var Ua=memo(function({token:t}){let o=useMemo(()=>t.marketData?.tvlInUsd,[t.marketData?.tvlInUsd]);return jsx(Fragment,{children:formatAmountUSD(o)})});var Oa=memo(function({token:t}){let o=useMemo(()=>t.marketData?.marketCapInUsd,[t.marketData?.marketCapInUsd]);return jsx(Fragment,{children:formatAmountUSD(o)})});var Ba=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("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 Va=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 $a=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 za=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 Sg=`
|
|
22
22
|
@keyframes tklShimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
|
|
23
|
-
`,Tg={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 E(e,t,o,r){return {...Tg,animationDelay:`${e}ms`,width:t,height:o,...r}}var Wa=10;function Ba({rowHeight:e,hasActions:t,isMobile:o}){return jsxs(Fragment,{children:[jsx("style",{children:bg}),Array.from({length:Wa}).map((r,s)=>jsx(yg,{index:s,rowHeight:e,hasActions:t,isMobile:o,isLast:s===Wa-1},s))]})}function yg({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:E(n,a,a,{borderRadius:8,flexShrink:0})}),jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,flex:1},children:[jsx("div",{style:E(n+30,"60%",20)}),jsx("div",{style:E(n+60,"80%",16)})]})]}),jsxs("div",{style:{width:128,padding:"0 12px",display:"flex",flexDirection:"column",justifyContent:"center",gap:4},children:[jsx("div",{style:E(n+20,72,20)}),jsx("div",{style:E(n+40,52,16)})]}),jsx("div",{style:{width:106,padding:"0 12px",display:"flex",alignItems:"center"},children:jsx("div",{style:E(n+30,64,20)})}),jsx("div",{style:{width:106,padding:"0 12px",display:"flex",alignItems:"center"},children:jsx("div",{style:E(n+40,60,20)})}),jsxs("div",{style:{width:138,padding:"0 12px",display:"flex",flexDirection:"column",justifyContent:"center",gap:4},children:[jsx("div",{style:E(n+50,72,20)}),jsx("div",{style:E(n+70,100,16)})]}),jsxs("div",{style:{width:126,padding:"0 12px",display:"flex",flexDirection:"column",justifyContent:"center",gap:4},children:[jsx("div",{style:E(n+60,48,20)}),jsx("div",{style:E(n+80,80,16)})]}),jsxs("div",{style:{width:126,padding:"0 12px",display:"flex",flexDirection:"column",justifyContent:"center",gap:4},children:[jsx("div",{style:E(n+70,40,20)}),jsx("div",{style:E(n+90,72,16)})]}),jsxs("div",{style:{width:128,padding:"0 12px",display:"flex",alignItems:"center",gap:10},children:[jsx("div",{style:E(n+80,20,20,{borderRadius:4})}),jsx("div",{style:E(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:E(n+80,52,16)}),jsx("div",{style:E(n+100,40,16)}),jsx("div",{style:E(n+120,36,16)})]}),jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsx("div",{style:E(n+90,48,16)}),jsx("div",{style:E(n+110,40,16)}),jsx("div",{style:E(n+130,40,16)})]}),jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsx("div",{style:E(n+100,40,16)}),jsx("div",{style:E(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:E(n+100,d,32,{borderRadius:8})})})]})}var Rg=100,Ag=200,Hg=72;function mt({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,f=useMemo(()=>e.slice(0,Rg),[e]),k=o&&e.length===0,x=useRef(void 0),g=useRef(false),{t:h}=useTranslation(),b=useCallback(P=>W=>{W.preventDefault(),W.stopPropagation(),s?.(P);},[s]),[T,I]=useState(n??{});useEffect(()=>{I(n??{});},[n]);let M=useCallback(P=>W=>{let ft={[P]:W};I(ft),i?.(ft);},[i]),Q=useCallback(()=>{g.current||(g.current=true,a?.(true)),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{g.current=false,a?.(false);},180);},[a]);useEffect(()=>()=>{x.current&&clearTimeout(x.current),g.current&&a?.(false);},[a]);let Se=cn("h-full mx-auto",c??(r?"max-w-362 sm:max-w-403":"max-w-331 sm:max-w-372")),_=r?"!w-[1438px] min-w-[1438px] max-w-[1438px]":"!w-[1366px] min-w-[1366px] max-w-[1366px]",be=[jsx(TableColumn,{textValue:h("tokens.listHeader.token"),width:p?Ag:320,className:cn("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:M("price"),children:h("tokens.listHeader.price")}),jsx("span",{children:"/"}),jsx(Sortable,{sort:T[`priceChange${t}`],onSortChange:M(`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:M("marketCap"),children:h("tokens.listHeader.marketCap")})},"marketCap"),jsx(TableColumn,{textValue:h("tokens.listHeader.liquidity"),width:106,children:jsx(Sortable,{sort:T.tvl,onSortChange:M("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:M(`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:M(`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:M(`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?Hg:124,align:"end",className:cn("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),Te=jsx(Ba,{rowHeight:u,hasActions:!!r,isMobile:p}),F=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")})]}),ne=P=>[jsx(TableCell,{className:cn("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(wa,{token:P,resolution:t})},"token"),jsx(TableCell,{children:jsx(Ia,{token:P,resolution:t})},"price"),jsx(TableCell,{children:jsx(Ra,{token:P,resolution:t})},"marketCap"),jsx(TableCell,{children:jsx(Pa,{token:P,resolution:t})},"liquidity"),jsx(TableCell,{children:jsx(Ea,{token:P,resolution:t})},"volumes"),jsx(TableCell,{children:jsx(Oa,{token:P,resolution:t})},"trades"),jsx(TableCell,{children:jsx(Fa,{token:P,resolution:t})},"traders"),jsx(TableCell,{children:jsx(ba,{token:P,resolution:t})},"bluechip"),jsx(TableCell,{children:jsx(La,{token:P,resolution:t})},"tokenInfo"),r?jsx(TableCell,{className:cn("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("!absolute inset-y-0 right-3 z-1 w-fit","flex items-center justify-end"),children:jsx(r,{token:P,resolution:t})})},"actions"):void 0].filter(Boolean),U=P=>jsx(TableRow,{onClick:s?b(P):void 0,children:ne(P)},P.address);return p?jsx("div",{"data-token-list-mobile-scroll":true,className:cn("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:Q,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("table-fixed",_),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:be}),jsx(TableBody,{items:f,isLoading:k,loadingContent:Te,emptyContent:F,children:U})]})})}):jsxs(StyledTable,{isHeaderSticky:true,isVirtualized:true,radius:"lg",className:Se,classNames:{loadingWrapper:"flex-col justify-start items-start",emptyWrapper:"pt-30"},onScrollCapture:Q,maxTableHeight:l,rowHeight:u,"aria-label":"Tokens",children:[jsx(TableHeader,{children:be}),jsx(TableBody,{items:e,isLoading:k,loadingContent:Te,emptyContent:F,children:U})]})}function Ga({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(W=>{W.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]),f=useMemo(()=>p?.priceChange,[p?.priceChange]),k=useMemo(()=>f&&new SafeBigNumber(f).gte(0),[f]),x=useMemo(()=>f?new SafeBigNumber(f).abs().toString():void 0,[f]),g=useMemo(()=>p?.volumesInUsd,[p?.volumesInUsd]),h=useMemo(()=>p?.buyVolumesInUsd,[p?.buyVolumesInUsd]),b=useMemo(()=>p?.sellVolumesInUsd,[p?.sellVolumesInUsd]),T=useMemo(()=>p?.trades,[p?.trades]),I=useMemo(()=>c?.marketCapInUsd,[c?.marketCapInUsd]),M=useMemo(()=>c?.tvlInUsd,[c?.tvlInUsd]),Q=useMemo(()=>new SafeBigNumber(c?.top10HoldingsRatio).gte(.1),[c?.top10HoldingsRatio]),Se=useMemo(()=>new SafeBigNumber(c?.devHoldingsRatio).gte(.1),[c?.devHoldingsRatio]),_=useMemo(()=>new SafeBigNumber(c?.sniperHoldingsRatio).gte(.1),[c?.sniperHoldingsRatio]),be=useMemo(()=>new SafeBigNumber(c?.insiderHoldingsRatio).gte(.1),[c?.insiderHoldingsRatio]),Te=useMemo(()=>new SafeBigNumber(c?.bundleHoldingsRatio).gte(.1),[c?.bundleHoldingsRatio]),F=c?.holders!==void 0&&c.holders>0,ne=c?.kolHolders!==void 0&&c.kolHolders>0,U=c?.bluechipHolders!==void 0&&c.bluechipHolders>0,P=F||ne||U;return jsxs("div",{className:cn("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(ce,{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:W=>W.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:W=>W.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:W=>W.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:W=>W.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(I)})]}),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(M)})]})]}),P&&jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-neutral leading-none",children:[F&&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)]})}),ne&&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)]})}),U&&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("inline-flex items-center gap-0.5 text-[10px] leading-none",k?"text-bullish":"text-bearish"),children:[k?jsx(TriangleUpIcon,{width:8,height:8}):jsx(TriangleDownIcon,{width:8,height:8}),f===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(g)})]}),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($,{icon:jsx(UserWithStarBadgeIcon,{width:12,height:12}),value:formatPercent(c?.top10HoldingsRatio),tooltip:i("tokens.tokenInfo.top10HoldingsRatio"),warning:Q,disable:!c?.top10HoldingsRatio||c?.top10HoldingsRatio==="0"}),jsx($,{icon:jsx(CookIcon,{width:12,height:12}),value:formatPercent(c?.devHoldingsRatio),tooltip:i("tokens.tokenInfo.devHoldingsRatio"),warning:Se,disable:!c?.devHoldingsRatio||c?.devHoldingsRatio==="0"}),jsx($,{icon:jsx(SniperIcon,{width:12,height:12}),value:formatPercent(c?.sniperHoldingsRatio),tooltip:i("tokens.tokenInfo.sniperHoldingsRatio"),warning:_,disable:!c?.sniperHoldingsRatio||c?.sniperHoldingsRatio==="0"}),jsx($,{icon:jsx(RatIcon,{width:12,height:12}),value:formatPercent(c?.insiderHoldingsRatio),tooltip:i("tokens.tokenInfo.insiderHoldingsRatio"),warning:be,disable:!c?.insiderHoldingsRatio||c?.insiderHoldingsRatio==="0"}),jsx($,{icon:jsx(BundlesIcon,{width:12,height:12}),value:formatPercent(c?.bundleHoldingsRatio),tooltip:i("tokens.tokenInfo.bundleHoldingsRatio"),warning:Te,disable:!c?.bundleHoldingsRatio||c?.bundleHoldingsRatio==="0"})]})}),o&&jsx("div",{className:"flex-none relative",onClick:W=>W.stopPropagation(),children:o(e)})]})]})}function Xa({isLast:e=false}){return jsxs("div",{className:cn("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 sx=154,Ja=10;function ix({index:e,style:t,tokens:o,skeletonCount:r,resolution:s,renderAction:n,onSelectToken:i}){return o?jsx("div",{style:t,children:jsx(Ga,{token:o[e],resolution:s,isLast:e===o.length-1,renderAction:n,onSelectToken:i})}):jsx("div",{style:t,children:jsx(Xa,{isLast:e===r-1})})}function bR({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:Ja,d=useMemo(()=>({tokens:a,skeletonCount:Ja,resolution:t,renderAction:s,onSelectToken:n}),[a,t,s,n]);return jsx("div",{className:cn("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:sx,overscanCount:5,rowComponent:ix,rowProps:d})})}var mx=80;function px(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 el(e){return e.sort((t,o)=>{let r=t.createdAt?.getTime()??0;return (o.createdAt?.getTime()??0)-r}),e.slice(0,mx)}function tl({chain:e,resolution:t,options:o,refetchInterval:r=12e3,deferUpdates:s=false,updateFlushInterval:n}){let i=useMemo(()=>({chain:e,resolution:t,...o}),[e,t,o]),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}=useNewTokensQuery(i,{refetchInterval:r});useEffect(()=>{p&&(c(g=>el(Xe(g,p))),d(false));},[p]);let f=useCallback(g=>{c(h=>{let b=[...h],T=false;for(let I of g){let M=b.findIndex(Q=>Q.address===I.address);M>=0?(T=true,b[M]=X(b[M],I)):(T=true,b.push(px(I)));}return T?el(b):h});},[]),{enqueueUpdates:k}=je({applyUpdates:f,paused:s,flushInterval:n});useNewTokensSubscription({chain:e},k);let x=useMemo(()=>!!(u||l),[u,l]);return {tokens:m,isLoading:x}}function IR({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],g=d?.[x];return {...o,...x&&g?{sortBy:x,sortDirection:g}:void 0}},[o,d]),{tokens:f,isLoading:k}=tl({chain:e,resolution:t,options:u,deferUpdates:c});return jsx(mt,{tokens:f,isLoading:k,resolution:t,height:n,itemHeight:i,itemHeightMobile:a,ActionsComponent:r,onSelectToken:s,sortDirections:d,onSortChange:m,onScrollingChange:p,className:l})}function sl({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=>Xe(b,p)),d(false));},[p]);let f=useCallback(b=>{c(T=>Ce(T,b));},[]),{enqueueUpdates:k}=je({applyUpdates:f,paused:s,flushInterval:n});useStockTokensSubscription({chain:e},k),we({chain:e,tokens:m,onUpdate:k});let x=useMemo(()=>!!(u||l),[u,l]),g=useMemo(()=>Jt(m,t),[m,t]);return {tokens:useMemo(()=>Yt(g,o),[g,o]),isLoading:x}}function GR({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:f}=sl({chain:e,filters:o,sortDirections:d,deferUpdates:c});return jsx(mt,{tokens:u,isLoading:f,resolution:t,height:n,itemHeight:i,itemHeightMobile:a,ActionsComponent:r,onSelectToken:s,sortDirections:d,onSortChange:m,onScrollingChange:p,className:l})}function oA({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:f}=eo({chain:e,resolution:t,filters:o,sortDirections:d,deferUpdates:c});return jsx(mt,{tokens:u,isLoading:f,resolution:t,height:n,itemHeight:i,itemHeightMobile:a,ActionsComponent:r,onSelectToken:s,sortDirections:d,onSortChange:m,onScrollingChange:p,className:l})}var Rx=15e3;function Ax({chain:e,addresses:t,pollMs:o=Rx}){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 f=c[u.address];p[u.address]=f?X(f,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(f=>{let k=f;for(let x of u){let g=k[x.address];if(!g)continue;let h=X(g,x);h!==g&&(k=k===f?{...f}:k,k[x.address]=h);}return k});}));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{ti as DEFAULT_FLIP_HOVER_RESOLUTIONS,kl as HolderTagBadge,Ot as HolderTagBadgeList,$ as HoldingRatioChip,IR as NewTokenListWidget,vh as PulseFinalStretchListWidget,Ge as PulseList,Pr as PulseListHeader,Kr as PulseListItem,Rr as PulseListItemSkeleton,ch as PulseMigratedListWidget,Xk as PulseNewListWidget,Bo as SEARCH_MODAL_ID,Tn as SearchHistoryUI,yn as SearchHistoryWidget,vn as SearchInputUI,hT as SearchModal,$t as SearchResultItemUI,Kt as SearchResultListHeader,qt as SearchResultListSkeleton,An as SearchResultListWidget,LT as SearchTokensButton,Kn as SearchWidget,GR as StockTokenListWidget,Io as TRADER_TAG_META,Ks as TokenAbout,rS as TokenAboutWidget,Rs as TokenActivitiesList,E0 as TokenActivitiesListWidget,ce as TokenAvatar,jn as TokenBasicInfo,vs as TokenBasicInfoWidget,js as TokenCategories,XS as TokenCategoriesWidget,Js as TokenCexListing,FS as TokenCexListingWidget,wi as TokenChartBanner,$w as TokenChartBannerWidget,Jn as TokenDetailHeader,Zv as TokenDetailHeaderWidget,hi as TokenDevTokensList,Pw as TokenDevTokensListWidget,bi as TokenDevTokensSummary,ts as TokenHoldersCount,rs as TokenHoldersCountWidget,Cs as TokenHoldersList,b0 as TokenHoldersListWidget,Gs as TokenLiquidities,TS as TokenLiquiditiesWidget,mt as TokenList,yo as TokenListFilter,aa as TokenListFilterModal,ma as TokenListFilterPopover,c1 as TokenListFilterWidget,fa as TokenListResolutionSelectorDesktop,xa as TokenListResolutionSelectorMobile,L1 as TokenListResolutionSelectorWidget,is as TokenMarketCap,ls as TokenMarketCapWidget,di as TokenOrdersList,QC as TokenOrdersListWidget,si as TokenPositionsList,RC as TokenPositionsListWidget,ms as TokenPrice,us as TokenPriceWidget,Hi as TokenReusedImageList,hL as TokenReusedImageListWidget,Bs as TokenSecurity,$N as TokenSecurityWidget,Ri as TokenSimilarTokens,sL as TokenSimilarTokensWidget,fs as TokenSocialMedia,xs as TokenSocialMediaWidget,oi as TokenStatsFlipBase,ri as TokenStatsFlipHover,mC as TokenStatsFlipWidget,fi as TokenTopTradersList,pw as TokenTopTradersListWidget,Fs as TokenTradersOverview,j0 as TokenTradersOverviewWidget,Os as TokenTransactionsOverview,fN as TokenTransactionsOverviewWidget,bs as TokenVolume,ys as TokenVolumeWidget,Es as TokenVolumesOverview,RN as TokenVolumesOverviewWidget,xl as TraderTagBadge,Mr as TraderTagBadgeList,Ga as TrendingTokenCard,bR as TrendingTokenCardList,Xa as TrendingTokenCardSkeleton,oA as TrendingTokenListWidget,tl as useNewTokensScript,xn as usePulseFinalStretchListScript,mn as usePulseMigratedListScript,nn as usePulseNewListScript,_t as useSearchHistory,Pn as useSearchResultListScript,_n as useSearchScript,sl as useStockTokensScript,zs as useTokenAboutScript,Is as useTokenActivitiesListScript,ky as useTokenBasicInfoScript,ei as useTokenCategoriesScript,Ys as useTokenCexListingScript,Pi as useTokenChartBannerScript,Yn as useTokenDetailHeaderScript,Ni as useTokenDevTokensListScript,os as useTokenHoldersCountScript,Ps as useTokenHoldersListScript,Xs as useTokenLiquiditiesScript,as as useTokenMarketCapScript,ui as useTokenOrdersListScript,li as useTokenPositionsListScript,ps as useTokenPriceScript,Ii as useTokenReusedImageListScript,Vs as useTokenSecurityScript,Ai as useTokenSimilarTokensScript,gs as useTokenSocialMediaScript,ni as useTokenStatsFlipScript,xi as useTokenTopTradersListScript,Us as useTokenTradersOverviewScript,Ds as useTokenTransactionsOverviewScript,Ts as useTokenVolumeScript,Ws as useTokenVolumesOverviewScript,Ax as useTokens,eo as useTrendingTokensScript};//# sourceMappingURL=index.mjs.map
|
|
23
|
+
`,Cg={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 {...Cg,animationDelay:`${e}ms`,width:t,height:o,...r}}var qa=10;function Qa({rowHeight:e,hasActions:t,isMobile:o}){return jsxs(Fragment,{children:[jsx("style",{children:Sg}),Array.from({length:qa}).map((r,s)=>jsx(wg,{index:s,rowHeight:e,hasActions:t,isMobile:o,isLast:s===qa-1},s))]})}function wg({index:e,rowHeight:t,hasActions:o,isMobile:r,isLast:s}){let n=e*80,i=r?208:320,l=r?40:64,a=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,l,l,{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:a,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 Mg=100,Ug=200,Og=72;function ut({tokens:e,resolution:t="24h",isLoading:o,ActionsComponent:r,onSelectToken:s,sortDirections:n,onSortChange:i,onScrollingChange:l,height:a=600,itemHeight:d=88,itemHeightMobile:m=72,className:c}){let{isMobile:p}=useScreen(),u=p?m:d,g=useMemo(()=>e.slice(0,Mg),[e]),f=o&&e.length===0,x=useRef(void 0),b=useRef(false),{t:h}=useTranslation(),k=useCallback(H=>_=>{_.preventDefault(),_.stopPropagation(),s?.(H);},[s]),[T,C]=useState(n??{});useEffect(()=>{C(n??{});},[n]);let y=useCallback(H=>_=>{let xt={[H]:_};C(xt),i?.(xt);},[i]),L=useCallback(()=>{b.current||(b.current=true,l?.(true)),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{b.current=false,l?.(false);},180);},[l]);useEffect(()=>()=>{x.current&&clearTimeout(x.current),b.current&&l?.(false);},[l]);let W=cn("h-full mx-auto",c??(r?"max-w-362 sm:max-w-403":"max-w-331 sm:max-w-372")),I=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?Ug:320,className:cn("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?Og:124,align:"end",className:cn("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(Qa,{rowHeight:u,hasActions:!!r,isMobile:p}),O=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=H=>[jsx(TableCell,{className:cn("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(Fa,{token:H,resolution:t})},"token"),jsx(TableCell,{children:jsx(Ba,{token:H,resolution:t})},"price"),jsx(TableCell,{children:jsx(Oa,{token:H,resolution:t})},"marketCap"),jsx(TableCell,{children:jsx(Ua,{token:H,resolution:t})},"liquidity"),jsx(TableCell,{children:jsx(za,{token:H,resolution:t})},"volumes"),jsx(TableCell,{children:jsx($a,{token:H,resolution:t})},"trades"),jsx(TableCell,{children:jsx(Va,{token:H,resolution:t})},"traders"),jsx(TableCell,{children:jsx(wa,{token:H,resolution:t})},"bluechip"),jsx(TableCell,{children:jsx(Ma,{token:H,resolution:t})},"tokenInfo"),r?jsx(TableCell,{className:cn("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("!absolute inset-y-0 right-3 z-1 w-fit","flex items-center justify-end"),children:jsx(r,{token:H,resolution:t})})},"actions"):void 0].filter(Boolean),D=H=>jsx(TableRow,{onClick:s?k(H):void 0,children:ie(H)},H.address);return p?jsx("div",{"data-token-list-mobile-scroll":true,className:cn("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:a},onScroll:L,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("table-fixed",I),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:O,children:D})]})})}):jsxs(StyledTable,{isHeaderSticky:true,isVirtualized:true,radius:"lg",className:W,classNames:{loadingWrapper:"flex-col justify-start items-start",emptyWrapper:"pt-30"},onScrollCapture:L,maxTableHeight:a,rowHeight:u,"aria-label":"Tokens",children:[jsx(TableHeader,{children:te}),jsx(TableBody,{items:e,isLoading:f,loadingContent:Se,emptyContent:O,children:D})]})}function tl({token:e,resolution:t,renderAction:o,isLast:r=false,onSelectToken:s,className:n}){let{t:i}=useTranslation(),l=useCopyToClipboard(),a=useTickAge(e.createdAt),d=useCallback(()=>{s?.(e);},[s,e]),m=useCallback(_=>{_.stopPropagation(),l(e.address,()=>toast.success(i("tokens.copied.address")));},[l,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]),b=useMemo(()=>p?.volumesInUsd,[p?.volumesInUsd]),h=useMemo(()=>p?.buyVolumesInUsd,[p?.buyVolumesInUsd]),k=useMemo(()=>p?.sellVolumesInUsd,[p?.sellVolumesInUsd]),T=useMemo(()=>p?.trades,[p?.trades]),C=useMemo(()=>c?.marketCapInUsd,[c?.marketCapInUsd]),y=useMemo(()=>c?.tvlInUsd,[c?.tvlInUsd]),L=useMemo(()=>new SafeBigNumber(c?.top10HoldingsRatio).gte(.1),[c?.top10HoldingsRatio]),W=useMemo(()=>new SafeBigNumber(c?.devHoldingsRatio).gte(.1),[c?.devHoldingsRatio]),I=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]),O=c?.holders!==void 0&&c.holders>0,ie=c?.kolHolders!==void 0&&c.kolHolders>0,D=c?.bluechipHolders!==void 0&&c.bluechipHolders>0,H=O||ie||D;return jsxs("div",{className:cn("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(a)}),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(C)})]}),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)})]})]}),H&&jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-neutral leading-none",children:[O&&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)]})}),D&&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("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(b)})]}),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(k)})]})]}),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:L,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:W,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:I,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 ol({isLast:e=false}){return jsxs("div",{className:cn("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 cx=154,rl=10;function mx({index:e,style:t,tokens:o,skeletonCount:r,resolution:s,renderAction:n,onSelectToken:i}){return o?jsx("div",{style:t,children:jsx(tl,{token:o[e],resolution:s,isLast:e===o.length-1,renderAction:n,onSelectToken:i})}):jsx("div",{style:t,children:jsx(ol,{isLast:e===r-1})})}function IR({tokens:e,resolution:t="24h",isLoading:o,height:r=600,renderAction:s,onSelectToken:n,className:i}){let l=o||!e?void 0:e,a=l?l.length:rl,d=useMemo(()=>({tokens:l,skeletonCount:rl,resolution:t,renderAction:s,onSelectToken:n}),[l,t,s,n]);return jsx("div",{className:cn("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:a,rowHeight:cx,overscanCount:5,rowComponent:mx,rowProps:d})})}var gx=80;function ll(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 xx(e,t,o){return e===t?o:e===o?t:o||t}function Fr(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:xx(t,e.tokenAAddress,e.tokenBAddress),image:e.dex?.image,programAddress:e.dex?.programAddress,protocolFamily:e.dex?.protocolFamily,protocolName:e.dex?.protocolName}]}}function kx(e){return {...ll(Fr(e)),...e.token??{},liquidities:Fr(e).liquidities,createdAt:e.token?.createdAt??e.createdAt}}function al(e){return e.sort((t,o)=>{let r=t.createdAt?.getTime()??0;return (o.createdAt?.getTime()??0)-r}),e.slice(0,gx)}function bx(e){if(!(!e?.filters&&!e?.keywords&&!e?.excludeKeywords))return {filters:e.filters,keywords:e.keywords,excludeKeywords:e.excludeKeywords}}function hx(e){if(!(!e?.sortBy||!e.sortDirection))return {[e.sortBy]:e.sortDirection}}function dl({chain:e,options:t,deferUpdates:o=false,updateFlushInterval:r}){let s=useMemo(()=>({chain:e}),[e]),n=useRef(s),[i,l]=useState(true),[a,d]=useState([]);useEffect(()=>{JSON.stringify(s)!==JSON.stringify(n.current)&&(l(true),d([]),n.current=s);},[s]);let{data:m,isPending:c}=useNewPoolsQuery(s);useEffect(()=>{m&&(d(h=>{let k=[...h];for(let T of m){let C=kx(T),y=k.findIndex(L=>L.address===C.address);y>=0?k[y]=X(k[y],C):k.push(C);}return al(k)}),l(false));},[m]);let p=useCallback(h=>{d(k=>{let T=[...k],C=false;for(let y of h){let L=T.findIndex(W=>W.address===y.address);L>=0?(C=true,T[L]=X(T[L],y)):(C=true,T.push(ll(y)));}return C?al(T):k});},[]),{enqueueUpdates:u}=de({applyUpdates:p,paused:o,flushInterval:r}),g=useCallback(h=>{u(h.map(Fr));},[u]);useNewPoolsSubscription({chain:e},g),xe({chain:e,tokens:a,onUpdate:u});let f=useMemo(()=>!!(c||i),[c,i]),x=useMemo(()=>le(a,bx(t)),[a,t]);return {tokens:useMemo(()=>et(x,hx(t)),[x,t]),isLoading:f}}function QR({chain:e,resolution:t,filters:o,ActionsComponent:r,onSelectToken:s,height:n,itemHeight:i,itemHeightMobile:l,className:a}){let[d,m]=useState(),[c,p]=useState(false);useEffect(()=>{m(void 0);},[e]);let u=useMemo(()=>{let x=Object.keys(d??{})[0],b=d?.[x];return {...o,...x&&b?{sortBy:x,sortDirection:b}:void 0}},[o,d]),{tokens:g,isLoading:f}=dl({chain:e,options:u,deferUpdates:c});return jsx(ut,{tokens:g,isLoading:f,resolution:t,height:n,itemHeight:i,itemHeightMobile:l,ActionsComponent:r,onSelectToken:s,sortDirections:d,onSortChange:m,onScrollingChange:p,className:a})}function ul({chain:e,filters:t,sortDirections:o,refetchInterval:r=12e3,deferUpdates:s=false,updateFlushInterval:n}){let i=useMemo(()=>({chain:e}),[e]),l=useRef(i),[a,d]=useState(true);useEffect(()=>{JSON.stringify(i)!==JSON.stringify(l.current)&&(d(true),l.current=i);},[i]);let[m,c]=useState([]),{data:p,isPending:u}=useStockTokensQuery(i,{refetchInterval:r});useEffect(()=>{p&&(c(k=>$t(k,p)),d(false));},[p]);let g=useCallback(k=>{c(T=>Re(T,k));},[]),{enqueueUpdates:f}=de({applyUpdates:g,paused:s,flushInterval:n});useStockTokensSubscription({chain:e},f),xe({chain:e,tokens:m,onUpdate:f});let x=useMemo(()=>!!(u||a),[u,a]),b=useMemo(()=>le(m,t),[m,t]);return {tokens:useMemo(()=>et(b,o),[b,o]),isLoading:x}}function dA({chain:e,resolution:t,filters:o,ActionsComponent:r,onSelectToken:s,height:n,itemHeight:i,itemHeightMobile:l,className:a}){let[d,m]=useState(),[c,p]=useState(false);useEffect(()=>{m(void 0);},[e]);let{tokens:u,isLoading:g}=ul({chain:e,filters:o,sortDirections:d,deferUpdates:c});return jsx(ut,{tokens:u,isLoading:g,resolution:t,height:n,itemHeight:i,itemHeightMobile:l,ActionsComponent:r,onSelectToken:s,sortDirections:d,onSortChange:m,onScrollingChange:p,className:a})}function kA({chain:e,resolution:t,filters:o,ActionsComponent:r,onSelectToken:s,height:n,itemHeight:i,itemHeightMobile:l,className:a}){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(ut,{tokens:u,isLoading:g,resolution:t,height:n,itemHeight:i,itemHeightMobile:l,ActionsComponent:r,onSelectToken:s,sortDirections:d,onSortChange:m,onScrollingChange:p,className:a})}var Ox=15e3;function Dx({chain:e,addresses:t,pollMs:o=Ox}){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:l}=useDexClient(),a=useRef(""),d=t.slice().sort().join(",");d!==a.current&&(a.current=d),useEffect(()=>{if(!r)return;let c=[];for(let p of t)c.push(l.subscribeToken(e,p,u=>{n(g=>{let f=g;for(let x of u){let b=f[x.address];if(!b)continue;let h=X(b,x);h!==b&&(f=f===g?{...g}:f,f[x.address]=h);}return f});}));return ()=>{for(let p of c)p.unsubscribe();}},[l,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{ai as DEFAULT_FLIP_HOVER_RESOLUTIONS,Sl as HolderTagBadge,Dt as HolderTagBadgeList,z as HoldingRatioChip,QR as NewTokenListWidget,Wb as PulseFinalStretchListWidget,Je as PulseList,Ur as PulseListHeader,Jr as PulseListItem,Ho as PulseListItemSkeleton,wb as PulseMigratedListWidget,db as PulseNewListWidget,zo as SEARCH_MODAL_ID,Hn as SearchHistoryUI,Fn as SearchHistoryWidget,Mn as SearchInputUI,AT as SearchModal,Gt as SearchResultItemUI,Xt as SearchResultListHeader,Yt as SearchResultListSkeleton,_n as SearchResultListWidget,BT as SearchTokensButton,Jn as SearchWidget,dA as StockTokenListWidget,Fo as TRADER_TAG_META,Js as TokenAbout,gS as TokenAboutWidget,Us as TokenActivitiesList,J0 as TokenActivitiesListWidget,fe as TokenAvatar,ss as TokenBasicInfo,Ps as TokenBasicInfoWidget,si as TokenCategories,aC as TokenCategoriesWidget,oi as TokenCexListing,qS as TokenCexListingWidget,Hi as TokenChartBanner,tL as TokenChartBannerWidget,os as TokenDetailHeader,c0 as TokenDetailHeaderWidget,Si as TokenDevTokensList,Ww as TokenDevTokensListWidget,Ci as TokenDevTokensSummary,as as TokenHoldersCount,ds as TokenHoldersCountWidget,Is as TokenHoldersList,I0 as TokenHoldersListWidget,ei as TokenLiquidities,HS as TokenLiquiditiesWidget,ut as TokenList,yo as TokenListFilter,ua as TokenListFilterModal,ba as TokenListFilterPopover,v1 as TokenListFilterWidget,ya as TokenListResolutionSelectorDesktop,Na as TokenListResolutionSelectorMobile,B1 as TokenListResolutionSelectorWidget,ps as TokenMarketCap,fs as TokenMarketCapWidget,gi as TokenOrdersList,sw as TokenOrdersListWidget,mi as TokenPositionsList,VC as TokenPositionsListWidget,ks as TokenPrice,hs as TokenPriceWidget,Di as TokenReusedImageList,AL as TokenReusedImageListWidget,qs as TokenSecurity,tS as TokenSecurityWidget,Ui as TokenSimilarTokens,kL as TokenSimilarTokensWidget,Ts as TokenSocialMedia,vs as TokenSocialMediaWidget,li as TokenStatsFlipBase,di as TokenStatsFlipHover,NC as TokenStatsFlipWidget,Ti as TokenTopTradersList,Sw as TokenTopTradersListWidget,Ws as TokenTradersOverview,mN as TokenTradersOverviewWidget,_s as TokenTransactionsOverview,wN as TokenTransactionsOverviewWidget,Cs as TokenVolume,Ls as TokenVolumeWidget,Ks as TokenVolumesOverview,VN as TokenVolumesOverviewWidget,Nl as TraderTagBadge,Br as TraderTagBadgeList,tl as TrendingTokenCard,IR as TrendingTokenCardList,ol as TrendingTokenCardSkeleton,kA as TrendingTokenListWidget,dl as useNewTokensScript,Ln as usePulseFinalStretchListScript,vn as usePulseMigratedListScript,xn as usePulseNewListScript,Qt as useSearchHistory,Wn as useSearchResultListScript,Gn as useSearchScript,ul as useStockTokensScript,Ys as useTokenAboutScript,Es as useTokenActivitiesListScript,Ry as useTokenBasicInfoScript,ii as useTokenCategoriesScript,ri as useTokenCexListingScript,Mi as useTokenChartBannerScript,rs as useTokenDetailHeaderScript,Ri as useTokenDevTokensListScript,ls as useTokenHoldersCountScript,Ms as useTokenHoldersListScript,ti as useTokenLiquiditiesScript,us as useTokenMarketCapScript,hi as useTokenOrdersListScript,fi as useTokenPositionsListScript,bs as useTokenPriceScript,Ei as useTokenReusedImageListScript,Qs as useTokenSecurityScript,Oi as useTokenSimilarTokensScript,ys as useTokenSocialMediaScript,ci as useTokenStatsFlipScript,vi as useTokenTopTradersListScript,Vs as useTokenTradersOverviewScript,$s as useTokenTransactionsOverviewScript,ws as useTokenVolumeScript,zs as useTokenVolumesOverviewScript,Dx as useTokens,eo as useTrendingTokensScript};//# sourceMappingURL=index.mjs.map
|
|
24
24
|
//# sourceMappingURL=index.mjs.map
|