@nexus-cross/dapp-ui 1.3.3-beta.1 → 1.3.3-beta.10

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.js CHANGED
@@ -1,21 +1,21 @@
1
- function Dr(e){try{return import.meta.env?.[e]}catch{return}}function Hr(e){if(!(typeof process>"u"))return process.env?.[e]}function Pe(e){if(e)return Gr(e);let t=Dr("VITE_CROSSX_ENVIRONMENT")??Dr("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??Hr("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??Hr("CROSSX_ENVIRONMENT");return Gr(t)}function Gr(e){switch(e?.toLowerCase()){case"dev":case"development":return"dev";case"stage":case"staging":case"stg":return"stage";default:return"production"}}var Go="1.3.3";var Vn="__nexusCrossAppLauncherRuntime";function Ys(){if(typeof window>"u")return null;let e=window;return e[Vn]??(e[Vn]={mode:"dapp-ui"}),e[Vn]}function Zs(e){if(e.scheduled)return;e.scheduled=!0;let t=()=>{if(e.scheduled=!1,e.loggedMode!==e.mode){if(e.mode==="connect-kit-react"){let n=e.connectKitVersion??"unknown";console.info(`[CROSSx App Launcher] connect-kit-react v${n} \uCD08\uAE30\uD654 \uC644\uB8CC (dapp-ui v${Go}, \uC0AC\uC6A9 \uBAA8\uB4DC: connect-kit)`)}else console.info(`[CROSSx App Launcher] dapp-ui v${Go} \uCD08\uAE30\uD654 \uC644\uB8CC (\uC0AC\uC6A9 \uBAA8\uB4DC: dapp-ui only)`);e.loggedMode=e.mode}};typeof queueMicrotask=="function"?queueMicrotask(t):Promise.resolve().then(t)}function Uo(e){let t=Ys();t&&(e?.mode==="connect-kit-react"?t.mode="connect-kit-react":t.mode||(t.mode="dapp-ui"),e?.connectKitVersion&&(t.connectKitVersion=e.connectKitVersion),Zs(t))}import*as ln from"react";import*as Ur from"@radix-ui/react-popover";import{Drawer as nl}from"vaul";import{createContext as Xs,useContext as Js}from"react";var $o=Xs(null);function qn(){let e=Js($o);if(!e)throw new Error("AppLauncher compound components must be used within <AppLauncher>");return e}import{useState as el,useEffect as tl}from"react";function sn(e){let[t,n]=el(!1);return tl(()=>{let o=window.matchMedia(e);n(o.matches);let r=a=>n(a.matches);return o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[e]),t}function _(e,{insertAt:t}={}){if(!e||typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",t==="top"&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}_(`[data-theme=dark]{--al-bg: var(--ds-surface-default, #1e232e);--al-bg-hover: var(--ds-surface-medium, #252b39);--al-text: var(--ds-content-highest, #ffffff);--al-text-secondary: var(--ds-content-medium, #ffffffa6);--al-border: var(--ds-border-default, #ffffff12);--al-shadow: var(--ds-shadow-modal, 0px 4px 30px -1px rgba(0, 0, 0, .7));--al-badge-bg: var(--ds-accent-primary-low, #123235);--al-badge-text: var(--ds-accent-primary-default, #00ceb2);--al-badge-new-text: var(--ds-system-purple-on, #ffffff);--al-drawer-overlay: var(--ds-overlay-dim, #000000b3)}[data-theme=light]{--al-bg: var(--ds-surface-default, #ffffff);--al-bg-hover: var(--ds-surface-medium, #f5f7fa);--al-text: var(--ds-content-highest, #000000);--al-text-secondary: var(--ds-content-medium, #000000a6);--al-border: var(--ds-border-default, #00000012);--al-shadow: var(--ds-shadow-modal, 0px 4px 30px -1px rgba(0, 0, 0, .15));--al-badge-bg: var(--ds-accent-primary-low, #e7f9f8);--al-badge-text: var(--ds-accent-primary-default, #00b4b7);--al-badge-new-text: var(--ds-system-purple-on, #ffffff);--al-drawer-overlay: var(--ds-overlay-dim, #00000080)}
2
- `);_(`.al-trigger-btn{--at-bg: transparent;--at-bg-hover: #eaedf1;--at-color: var(--ds-content-high, rgba(0, 0, 0, .85));--at-border: none;--at-border-radius: 8px;--at-size: 36px;--at-padding: 0;--at-press-scale: .95;--at-transition: background-color .15s ease;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:var(--at-size);height:var(--at-size);padding:var(--at-padding);border:var(--at-border);background:var(--at-bg);border-radius:var(--at-border-radius);color:var(--at-color);cursor:pointer;transition:var(--at-transition)}.al-trigger-btn:hover,.al-trigger-btn[data-state=open]{background:var(--at-bg-hover)}.al-trigger-btn:active:not(:disabled){background:var(--at-bg-hover);transform:scale(var(--at-press-scale))}.al-trigger-btn[data-theme=dark]{--at-color: var(--ds-content-high, rgba(255, 255, 255, .85));--at-bg-hover: #252b39}.al-trigger-btn[data-theme=light]{--at-color: var(--ds-content-high, rgba(0, 0, 0, .85))}
3
- `);_(`@keyframes al-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
4
- `);_(`.al-popover-content{-webkit-font-smoothing:antialiased;z-index:100001;border-radius:24px;background:var(--al-bg);border:1px solid var(--al-popover-border, var(--al-border));box-shadow:var(--al-popover-shadow, var(--al-shadow));animation:al-fade-in .15s ease-out;max-height:80vh;overflow-x:hidden;overflow-y:auto;padding:20px 4px;box-sizing:border-box}.al-popover-content .al-grid{grid-template-columns:repeat(4,100px);row-gap:16px;column-gap:0;padding:0;justify-content:center;align-items:start}.al-popover-content .al-grid-item{flex-direction:column;justify-content:flex-start;align-items:center;gap:6px;padding:12px 0;width:100px;min-width:0;border-radius:10px}.al-popover-content .al-grid-item-left{flex-direction:column;align-items:center;gap:8px;width:100%;overflow:visible}.al-popover-content .al-grid-item-icon{width:50px;height:50px;border-radius:10.125px;overflow:hidden}.al-popover-content .al-grid-item-icon img{object-fit:cover}.al-popover-content .al-grid-item-label{font-family:Inter,sans-serif;font-size:12px;font-weight:500;line-height:1.1;letter-spacing:0;text-align:center;color:var(--al-text);max-width:100%;white-space:normal;overflow-wrap:anywhere}.al-popover-content .al-grid-item-right,.al-popover-content .al-badge-new{display:none}.al-drawer-overlay{position:fixed;inset:0;z-index:100000;background:var(--al-drawer-overlay)}.al-drawer-content{-webkit-font-smoothing:antialiased;position:fixed;top:0;right:0;bottom:0;z-index:100001;width:100vw;background:var(--al-bg);overflow-x:hidden;overflow-y:hidden;display:flex;flex-direction:column;box-sizing:border-box}.al-drawer-body{flex:1;overflow-y:auto;overscroll-behavior-y:contain;min-height:0}.al-drawer-content .al-grid{display:flex;flex-direction:column;grid-template-columns:none;max-width:100%;overflow:hidden;flex-shrink:0;gap:0;row-gap:0;column-gap:0;padding:8px 16px}.al-drawer-content .al-grid-item{width:100%;max-width:100%;gap:8px;padding:16px 12px;border-radius:8px;overflow:hidden;background:transparent}.al-drawer-content .al-grid-item:hover,.al-drawer-content .al-grid-item[data-active=true]{background:var(--al-bg-hover)}.al-drawer-content .al-grid-item-left{gap:8px;flex:1 1 auto;min-width:0}.al-drawer-content .al-grid-item-icon{width:32px;height:32px;border-radius:6.75px;overflow:hidden}.al-drawer-content .al-grid-item-icon img{width:100%;height:100%;object-fit:cover;border-radius:6.75px}.al-drawer-content .al-grid-item-label{font-size:16px;line-height:1.35;letter-spacing:0;font-weight:400}.al-drawer-content .al-grid-item[data-active=true] .al-grid-item-label{font-weight:500}.al-drawer-header{display:flex;align-items:center;justify-content:space-between;padding:16px;flex-shrink:0}.al-drawer-title{font-family:Inter,sans-serif;font-size:16px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--al-text);margin:0}.al-drawer-close{display:inline-flex;align-items:center;justify-content:center;padding:4px;border:none;background:transparent;border-radius:4px;cursor:pointer;color:var(--ds-content-low, #00000066);transition:opacity .15s ease}.al-drawer-close:hover{opacity:.7}.al-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:4px;padding:8px}.al-grid-item{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:16px 12px;border:none;background:var(--al-bg);border-radius:8px;cursor:pointer;transition:none;color:var(--al-text);text-align:left;font-family:Inter,sans-serif;flex-shrink:0}.al-grid-item:hover,.al-grid-item[data-active=true]{background:#252b39!important}:root[data-ds-theme=light] .al-grid-item:hover,:root[data-ds-theme=light] .al-grid-item[data-active=true]{background:#eff3f8!important}.al-grid-item-left{display:flex;align-items:center;gap:8px;min-width:0;overflow:hidden}.al-grid-item-right{display:flex;align-items:center;gap:6px;flex-shrink:0}.al-grid-item-icon{display:flex;align-items:center;justify-content:center;width:24px;height:24px;flex-shrink:0}.al-grid-item-icon img{width:100%;height:100%;object-fit:contain}.al-grid-item-label{font-family:Inter,sans-serif;font-size:16px;font-weight:500;line-height:150%;letter-spacing:0;color:var(--al-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.al-badge{display:flex;padding:1px 4px 2px;justify-content:center;align-items:center;gap:2px;border-radius:3px;background:var(--al-badge-bg);color:var(--al-badge-text);font-family:Pretendard,Inter,sans-serif;font-size:10px;font-weight:600;line-height:150%;letter-spacing:0;white-space:nowrap;flex-shrink:0}.al-badge-new{display:flex;width:16px;height:16px;justify-content:center;align-items:center;aspect-ratio:1/1;border-radius:12px;background:var(--ds-system-purple-high, #7346f3);color:var(--al-badge-new-text);font-family:Pretendard,Inter,sans-serif;font-size:9px;font-weight:700;flex-shrink:0}
5
- `);_("");import{jsx as jo}from"react/jsx-runtime";function $r({env:e,theme:t="dark",mobileBreakpoint:n=768,domain:o,children:r}){let a=sn(`(max-width: ${n}px)`),[i,s]=ln.useState(!1),c=ln.useCallback(()=>s(!1),[]),l=Pe(e),d=ln.useMemo(()=>({env:l,theme:t,isMobile:a,open:i,domain:o,close:c}),[l,t,a,i,o,c]);return jo($o.Provider,{value:d,children:a?jo(nl.Root,{direction:"right",open:i,onOpenChange:s,noBodyStyles:!0,children:r},"drawer"):jo(Ur.Root,{open:i,onOpenChange:s,children:r},"popover")})}import*as Kr from"@radix-ui/react-popover";import{Drawer as rl}from"vaul";import{jsx as je,jsxs as ol}from"react/jsx-runtime";function jr({size:e=18}){return ol("svg",{className:"al-trigger-icon",width:e,height:e,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[je("rect",{width:"4",height:"4",rx:"2",fill:"currentColor"}),je("rect",{x:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),je("rect",{x:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),je("rect",{y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),je("rect",{x:"7",y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),je("rect",{x:"14",y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),je("rect",{y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),je("rect",{x:"7",y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),je("rect",{x:"14",y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"})]})}function Vr(){return je("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:je("path",{d:"M12 19L5 12M5 12L12 5M5 12H19",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function qr(){return je("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:je("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as Kn}from"react/jsx-runtime";function Qr({asChild:e,children:t,className:n,style:o}){let{isMobile:r,theme:a}=qn(),i=t!=null,s=e??!0,c=n?`al-trigger-btn ${n}`:"al-trigger-btn",l=i?t:Kn("button",{type:"button",className:c,"data-theme":a,style:o,children:Kn(jr,{size:18})});return r?Kn(rl.Trigger,{asChild:s,children:l}):Kn(Kr.Trigger,{asChild:s,children:l})}import*as Zt from"react";import*as Yn from"@radix-ui/react-popover";import{Drawer as cn}from"vaul";import{useQuery as sl}from"@tanstack/react-query";var Yr={dev:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/app-launcher.json",stage:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/app-launcher.json",production:"https://contents.crosstoken.io/frontend/common/app-launcher/app-launcher.json"};var il="https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",al="https://contents.crosstoken.io/frontend/common/app-launcher/icons";function ct(e,t){return`${e==="production"?al:il}/${t}.png`}function Zr(e){let t=e==="production"?"production":"stage";return{version:"0.0.1-fallback",items:[{id:"gametoken-cross",label:"Gametoken",description:"Trade game tokens easily using CROSS.",url:{dev:"https://dev-x.crosstoken.io/gametoken/CROSS",stage:"https://stg-x.crosstoken.io/gametoken/CROSS",production:"https://x.crosstoken.io/gametoken/CROSS"},iconUrl:ct(t,"dex"),order:1e3,type:"gametoken",badge:null,isNew:!1},{id:"forge",label:"Forge",description:"Launch Your Game, Ignite the Market",url:{dev:"https://stg-x.crosstoken.io/forge",stage:"https://stg-x.crosstoken.io/forge",production:"https://x.crosstoken.io/forge"},iconUrl:ct(t,"forge"),order:4e3,type:"forge",badge:null,isNew:!0},{id:"crossd",label:"Bridge (CROSSD)",description:"The first decentralized exchange on the CROSS network.",url:{dev:"https://stg.crossdefi.io/swap-bridge",stage:"https://stg.crossdefi.io/swap-bridge",production:"https://www.crossdefi.io/swap-bridge"},iconUrl:ct(t,"crossd"),order:5e3,type:"crossd",badge:null,isNew:!1},{id:"prediction",label:"Prediction",description:"Prediction market",url:{dev:"https://stg-prediction.crossdefi.io",stage:"https://stg-prediction.crossdefi.io",production:"https://prediction.crossdefi.io/"},iconUrl:ct(t,"prediction"),order:6e3,type:"prediction",badge:null,isNew:!0},{id:"rewards",label:"Rewards",description:"Deposit CROSS and earn rewards. Grow together.",url:{dev:"https://stg-x.crosstoken.io/rewards",stage:"https://stg-x.crosstoken.io/rewards",production:"https://x.crosstoken.io/rewards"},iconUrl:ct(t,"reward"),order:7e3,type:"rewards",badge:null,isNew:!1},{id:"nft",label:"NFT",description:"Trade and collect NFTs in the CROSS ecosystem.",url:{dev:"https://stg.crossnft.io/",stage:"https://stg.crossnft.io/",production:"https://www.crossnft.io/"},iconUrl:ct(t,"nft"),order:8e3,type:"nft",badge:null,isNew:!1},{id:"play",label:"Play",description:"Discover and play games on CROSS.",url:{dev:"https://stg-play.cross.nexus",stage:"https://stg-play.cross.nexus",production:"https://play.cross.nexus"},iconUrl:ct(t,"play"),order:8500,type:"play",badge:null,isNew:!0},{id:"shop",label:"Shop",description:"Game Payment Platform & In-Game Currency Store.",url:{dev:"https://www.dev.cross.shop/",stage:"https://www.stage.cross.shop/",production:"https://www.cross.shop/"},iconUrl:ct(t,"shop"),order:9e3,type:"shop",badge:null,isNew:!1},{id:"points",label:"Points",description:"Dive into CROSS World, Earn CROSS Points",url:{dev:"https://stg-x.crosstoken.io/points",stage:"https://stg-x.crosstoken.io/points",production:"https://x.crosstoken.io/points"},iconUrl:ct(t,"point"),order:1e4,type:"points",badge:null,isNew:!1},{id:"wave",label:"Wave",description:"Stream, support, and earn in the CROSS ecosystem.",url:{dev:"https://stg-wave.crosstoken.io/en",stage:"https://stg-wave.crosstoken.io/en",production:"https://wave.crosstoken.io/en"},iconUrl:ct(t,"wave"),order:11e4,type:"wave",badge:null,isNew:!1},{id:"explorer",label:"Explorer",description:"View transactions, blocks, and token data on the CROSS network.",url:{dev:"https://stg-explorer.crosstoken.io/612055",stage:"https://stg-explorer.crosstoken.io/612055",production:"https://explorer.crosstoken.io/612055"},iconUrl:ct(t,"explorer"),order:12e3,type:"explorer",badge:null,isNew:!1}]}}function Qn(e){let t=Pe(e);return sl({queryKey:["global-menu",t],queryFn:async({signal:n})=>{try{let o=await fetch(Yr[t],{cache:"no-store",signal:n});if(!o.ok)throw new Error(`Failed to fetch global menu: ${o.status}`);return o.json()}catch(o){if(n.aborted)throw o;return Zr(t)}},staleTime:0,gcTime:0,retry:!1,refetchOnMount:!0})}function X(...e){return e.filter(Boolean).join(" ")}import{jsx as Se,jsxs as Sn}from"react/jsx-runtime";function ll(e){return e.id==="cross-staking"||e.type==="cross-staking"}function Jr({align:e="end",sideOffset:t=8,className:n}){let{env:o,theme:r,isMobile:a,domain:i,close:s}=qn(),{data:c}=Qn(o),l=Zt.useMemo(()=>(c?.items??[]).sort((w,v)=>w.order-v.order),[c]),d=8,f=Zt.useRef(null),h=Zt.useCallback(w=>{f.current={x:w.clientX,y:w.clientY}},[]),m=typeof window<"u"?window.location.pathname:"",y=Zt.useCallback((w,v)=>{if(f.current){let E=w.clientX-f.current.x,C=w.clientY-f.current.y;if(f.current=null,Math.abs(E)>d||Math.abs(C)>d)return}let B=v.url[o]??v.url.production,u=Xr(B,i);if(!u)try{let E=new URL(B).pathname;if(m===E||m.startsWith(E+"/")){s();return}}catch{}u?window.open(B,"_blank","noopener,noreferrer"):window.location.href=B,s()},[o,i,s,m]),x=Se("div",{className:"al-grid","data-theme":r,children:l.map(w=>{let v=w.url[o]??w.url.production,B=Xr(v,i),u=!1;if(!B)try{let E=new URL(v).pathname;u=m===E||m.startsWith(E+"/")}catch{u=!1}return Sn("button",{type:"button",className:"al-grid-item","data-active":u||void 0,onPointerDown:h,onClick:E=>y(E,w),children:[Sn("div",{className:"al-grid-item-left",children:[Se("div",{className:"al-grid-item-icon",children:Se("img",{src:w.iconUrl,alt:w.label,width:24,height:24,loading:"lazy"})}),Se("span",{className:"al-grid-item-label",children:w.label}),w.isNew&&Se("span",{className:"al-badge-new",children:"N"})]}),Se("div",{className:"al-grid-item-right",children:w.badge&&!ll(w)&&Se("span",{className:"al-badge",children:w.badge})})]},w.id)})});return a?Sn(cn.Portal,{children:[Se(cn.Overlay,{className:"al-drawer-overlay"}),Sn(cn.Content,{className:X("al-drawer-content",n),"data-theme":r,children:[Sn("div",{className:"al-drawer-header",children:[Se(cn.Close,{className:"al-drawer-close",children:Se(Vr,{})}),Se(cn.Title,{className:"al-drawer-title",children:"CROSS Services"}),Se(cn.Close,{className:"al-drawer-close",children:Se(qr,{})})]}),Se("div",{className:"al-drawer-body",children:x})]})]}):Se(Yn.Portal,{children:Se(Yn.Content,{align:e,sideOffset:t,className:X("al-popover-content",n),"data-theme":r,children:x})})}function Xr(e,t){try{let n=new URL(e).hostname;return typeof window>"u"?!0:n!==(t??window.location.hostname)}catch{return!1}}import*as Me from"react";import*as us from"@radix-ui/react-popover";import{Drawer as Ud}from"vaul";import{createContext as cl,useContext as dl}from"react";var Vo=cl(null);function Ot(){let e=dl(Vo);if(!e)throw new Error("WalletInfo compound components must be used within <WalletInfo>");return e}var qo=(o=>(o.CROSSx="crossx",o.MetaMask="io.metamask",o.Binance="com.binance.wallet",o))(qo||{}),Zn={crossx:{name:"CROSSx",iconUrl:"https://contents.crosstoken.io/wallet/token/images/tCROSS.svg"},"io.metamask":{name:"MetaMask",iconUrl:"https://upload.wikimedia.org/wikipedia/commons/3/36/MetaMask_Fox.svg"},"com.binance.wallet":{name:"Binance Wallet",iconUrl:"https://public.bnbstatic.com/static/images/common/favicon.ico"}};import*as $i from"react";import{jsx as V,jsxs as Rn}from"react/jsx-runtime";function ei({size:e=16,className:t}){return Rn("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[V("path",{d:"M12.6667 4.66667V2.66667C12.6667 2.48986 12.5964 2.32029 12.4714 2.19526C12.3464 2.07024 12.1768 2 12 2H3.33333C2.97971 2 2.64057 2.14048 2.39052 2.39052C2.14048 2.64057 2 2.97971 2 3.33333C2 3.68696 2.14048 4.02609 2.39052 4.27614C2.64057 4.52619 2.97971 4.66667 3.33333 4.66667H13.3333C13.5101 4.66667 13.6797 4.7369 13.8047 4.86193C13.9298 4.98695 14 5.15652 14 5.33333V8M14 8H12C11.6464 8 11.3072 8.14048 11.0572 8.39052C10.8071 8.64057 10.6667 8.97971 10.6667 9.33333C10.6667 9.68696 10.8071 10.0261 11.0572 10.2761C11.3072 10.5262 11.6464 10.6667 12 10.6667H14C14.1768 10.6667 14.3464 10.5964 14.4714 10.4714C14.5964 10.3464 14.6667 10.1768 14.6667 10V8.66667C14.6667 8.48986 14.5964 8.32029 14.4714 8.19526C14.3464 8.07024 14.1768 8 14 8Z",stroke:"currentColor",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"}),V("path",{d:"M2 3.33325V12.6666C2 13.0202 2.14048 13.3593 2.39052 13.6094C2.64057 13.8594 2.97971 13.9999 3.33333 13.9999H13.3333C13.5101 13.9999 13.6797 13.9297 13.8047 13.8047C13.9298 13.6796 14 13.5101 14 13.3333V10.6666",stroke:"currentColor",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ko({size:e=16,className:t}){return V("svg",{width:e,height:e,viewBox:"4 4 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:V("path",{d:"M9.40284 17.0647H4.85156V4.84656H17.0697V9.39783H15.4407V6.47565H6.48066V15.4356H9.40284V17.0647ZM21.5192 12.5644H12.5592V21.5244H21.5192V12.5644ZM23.1483 10.9353V23.1535H10.9301V10.9353H23.1483Z",fill:"currentColor"})})}function Cn({size:e=16,className:t}){return V("svg",{width:e,height:e,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:V("path",{d:"M11.6667 3.5L5.25 9.91667L2.33334 7",stroke:"currentColor",strokeWidth:1.16667,strokeLinecap:"round",strokeLinejoin:"round"})})}function St({size:e=24,className:t}){return V("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:V("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function ti({size:e=20,className:t}){return Rn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[V("path",{d:"M7.5 17.5H4.167A1.667 1.667 0 012.5 15.833V4.167A1.667 1.667 0 014.167 2.5H7.5",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),V("path",{d:"M13.333 14.167L17.5 10l-4.167-4.167M17.5 10H7.5",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Qo({size:e=20,className:t}){return V("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,children:V("path",{d:"M7.91305 10.8327C8.60341 10.8327 9.16305 11.3924 9.16305 12.0827V16.2458C9.16305 16.9361 8.60341 17.4958 7.91305 17.4958H3.75C3.05964 17.4958 2.5 16.9361 2.5 16.2458L2.5 12.0827C2.5 11.3924 3.05964 10.8327 3.75 10.8327H7.91305ZM14.1685 17.4958H12.5027V15.83H14.1685V17.4958ZM17.5 17.4958H15.8342V15.83H17.5V17.4958ZM4.16576 12.4985V15.83H7.49729V12.4985H4.16576ZM12.5027 15.83H10.8369V14.1642H12.5027V15.83ZM15.8342 15.83H14.1685V14.1642H15.8342V15.83ZM14.1685 14.1642H12.5027V12.4985H14.1685V14.1642ZM17.5 14.1642H15.8342V12.4985H17.5V14.1642ZM12.5027 12.4985H10.8369V10.8327H12.5027V12.4985ZM15.8342 12.4985H14.1685V10.8327H15.8342V12.4985ZM7.91305 2.50391C8.60341 2.50391 9.16305 3.06355 9.16305 3.75391V7.91696C9.16305 8.60731 8.60341 9.16696 7.91305 9.16696H3.75C3.05964 9.16696 2.5 8.60731 2.5 7.91696L2.5 3.75391C2.5 3.06355 3.05964 2.50391 3.75 2.50391L7.91305 2.50391ZM16.2419 2.50391C16.9322 2.50391 17.4919 3.06355 17.4919 3.75391V7.91696C17.4919 8.60731 16.9322 9.16696 16.2419 9.16696H12.0788C11.3885 9.16696 10.8288 8.60731 10.8288 7.91696V3.75391C10.8288 3.06355 11.3885 2.50391 12.0788 2.50391L16.2419 2.50391ZM4.16576 4.16967L4.16576 7.50119L7.49729 7.50119L7.49729 4.16967L4.16576 4.16967ZM12.4946 4.16967V7.50119H15.8261V4.16967H12.4946Z",fill:"currentColor",fillOpacity:1})})}function Pt({size:e=20,className:t}){return V("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:V("path",{d:"M12.5 15L7.5 10L12.5 5",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function Xt({size:e=20,className:t}){return V("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:V("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function ni({size:e=16,className:t}){return Rn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[V("path",{d:"M1.667 10S4.167 4.167 10 4.167 18.333 10 18.333 10 15.833 15.833 10 15.833 1.667 10 1.667 10z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),V("path",{d:"M10 12.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function oi({size:e=16,className:t}){return Rn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[V("path",{d:"M14.95 14.95A8.283 8.283 0 0110 16.667c-5.833 0-8.333-5.833-8.333-5.833a15.238 15.238 0 014.183-4.884m3.267-1.55A7.55 7.55 0 0110 4.167c5.833 0 8.333 5.833 8.333 5.833a15.28 15.28 0 01-1.783 2.633M11.767 11.767a2.5 2.5 0 11-3.534-3.534",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),V("path",{d:"M1.667 1.667l16.666 16.666",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ri({size:e=42,className:t}){return V("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 42 42",fill:"none",className:t,children:V("path",{d:"M20.7314 2C31.0766 2 39.4628 10.3863 39.4629 20.7314C39.4629 31.0766 31.0766 39.4629 20.7314 39.4629C10.3863 39.4628 2 31.0766 2 20.7314C2.00007 10.3864 10.3864 2.00007 20.7314 2ZM20.5938 30.0586L21.1084 30.5732L21.623 30.0586V25.2471H21.1084C20.9344 25.2471 20.7626 25.235 20.5938 25.2158V30.0586ZM16.4834 24.6611L14.6514 26.4922L15.3799 27.2207L17.1797 25.4209L18.3193 24.2803C18.0487 24.0673 17.8025 23.8251 17.5869 23.5566L16.4834 24.6611ZM26.8691 27.2207L27.5967 26.4922L26.3516 25.2471H24.8955L26.8691 27.2207ZM11.2666 20.7314L11.7822 21.2471H16.624C16.6048 21.0781 16.5938 20.9065 16.5938 20.7324C16.5938 20.5585 16.6049 20.3866 16.624 20.2178H11.7812L11.2666 20.7314ZM20.5938 11.4053V16.2471C20.7626 16.2279 20.9345 16.2178 21.1084 16.2178H21.623V11.4053L21.1084 10.8906L20.5938 11.4053ZM14.6514 15.0029L16.4521 16.8027L17.5732 17.9238C17.7874 17.6546 18.0315 17.4104 18.3008 17.1963L15.3799 14.2754L14.6514 15.0029ZM25.0371 16.1074L24.9268 16.2178H26.3818L27.5957 15.0029L26.8682 14.2754L25.0371 16.1074Z",fill:"#019D92",stroke:"white",strokeWidth:4})})}function ii({size:e=20,className:t}){return V("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:V("path",{d:"M9.19133 10.8077C9.04905 10.6657 8.87947 10.554 8.69283 10.4792L2.78881 8.11167C2.71832 8.08338 2.65816 8.03421 2.61642 7.97075C2.57468 7.90729 2.55335 7.83258 2.5553 7.75665C2.55724 7.68072 2.58237 7.6072 2.6273 7.54596C2.67224 7.48472 2.73483 7.4387 2.80668 7.41406L16.9525 2.5747C17.0185 2.55087 17.0899 2.54632 17.1583 2.56159C17.2268 2.57685 17.2895 2.6113 17.3391 2.66089C17.3887 2.71049 17.4231 2.77319 17.4384 2.84165C17.4536 2.9101 17.4491 2.9815 17.4253 3.04746L12.5859 17.1933C12.5613 17.2651 12.5152 17.3277 12.454 17.3727C12.3928 17.4176 12.3192 17.4427 12.2433 17.4447C12.1674 17.4466 12.0927 17.4253 12.0292 17.3835C11.9658 17.3418 11.9166 17.2817 11.8883 17.2112L9.52073 11.3056C9.44567 11.1191 9.33362 10.9498 9.19133 10.8077ZM9.19133 10.8077L17.3367 2.66404",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function ai({size:e=20,className:t}){return V("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:V("path",{d:"M10.8333 14.1667V7.5M15 14.1667V4.16667M2.5 2.5V15.8333C2.5 16.2754 2.67559 16.6993 2.98816 17.0118C3.30072 17.3244 3.72464 17.5 4.16667 17.5H17.5M6.66667 14.1667V11.6667",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function si({size:e=20,className:t}){return V("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:V("path",{d:"M6.6665 9.99984H13.3332M9.99984 6.6665V13.3332M18.3332 9.99984C18.3332 14.6022 14.6022 18.3332 9.99984 18.3332C5.39746 18.3332 1.6665 14.6022 1.6665 9.99984C1.6665 5.39746 5.39746 1.6665 9.99984 1.6665C14.6022 1.6665 18.3332 5.39746 18.3332 9.99984Z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function li({size:e=20,className:t}){return V("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:V("path",{d:"M6.667 2.5 3.333 5.833 6.667 9.167M3.333 5.833h13.334M13.333 17.5l3.334-3.333-3.334-3.334M16.667 14.167H3.333",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function ci({size:e=20,className:t}){return Rn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[V("circle",{cx:"10",cy:"10",r:"10",fill:"currentColor"}),V("path",{d:"M6 10.2L8.6 12.8L14 7.2",stroke:"var(--ds-accent-primary-on, #ffffff)",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"})]})}import*as P from"react";import Jt from"bignumber.js";function pl(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return t>0&&e.charCodeAt(t-1)===46&&t--,e.slice(0,t)}function zt(e,t){if(!e||e==="0")return"0.00";let n=new Jt(e).shiftedBy(-t),o=n.isGreaterThanOrEqualTo(1)?2:4;return n.toFormat(o,Jt.ROUND_DOWN)}function Ve(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Yo(e){let t=typeof e=="string"?parseFloat(e):e;if(Number.isNaN(t)||t===0)return"$0.00";let n=t>=1?2:4,o=Math.pow(10,n);return`$${(Math.floor(t*o)/o).toLocaleString("en-US",{minimumFractionDigits:n,maximumFractionDigits:n})}`}function di(e,t,n){let r=new Jt(e).shiftedBy(-t).multipliedBy(new Jt(n));return r.isZero()||r.isNaN()?"$0.00":`$${(r.integerValue(Jt.ROUND_DOWN).isGreaterThanOrEqualTo(1)?r.decimalPlaces(2,Jt.ROUND_DOWN):r.decimalPlaces(4,Jt.ROUND_DOWN)).toFormat()}`}function pi(e){if(e===""||e===null||e===void 0)return{displayValue:"0",isLowerBound:!1};let t=typeof e=="number"?e.toString():e;if(t==="0"||t==="0.0")return{displayValue:"0",isLowerBound:!1};let n=t;if(n.includes("e")||n.includes("E")){let i=Number(n);if(!Number.isFinite(i)||i===0)return{displayValue:"0",isLowerBound:!1};n=pl(i.toFixed(18))}let[o="0",r=""]=n.split(".");if(Number(o)>=1){let i=r.slice(0,2).padEnd(2,"0");return{displayValue:`${Number(o).toLocaleString("en-US")}.${i}`,isLowerBound:!1}}return r.length<4?{displayValue:`${o}.${r}`,isLowerBound:!1}:r.slice(0,4)==="0000"?{displayValue:"0.0001",isLowerBound:!0}:{displayValue:`0.${r.slice(0,4)}`,isLowerBound:!1}}import{useMemo as fl}from"react";import{useQuery as ul}from"@tanstack/react-query";var Je={dev:"https://stg-wallet-server.crosstoken.io/api",stage:"https://stg-wallet-server.crosstoken.io/api",production:"https://wallet-server.crosstoken.io/api"},Ce={dev:{cross:612044,bsc:97},stage:{cross:612044,bsc:97},production:{cross:612055,bsc:56}};var ml="send:chain-info";function gl(e){if("data"in e&&e.data!==void 0){let t=e.data;if(Array.isArray(t)){let n=t[0];if(!n)throw new Error("Chain info payload is empty.");return n}return t}return e}function Zo(e,...t){let n=e.replace(/\/+$/,""),o=t.map(r=>r.replace(/^\/+|\/+$/g,"")).filter(Boolean);return[n,...o].join("/")}function hl(e,t,n,o){if(o)return t===Ce[e].cross?fi(t,o):n?.explorer_url?Zo(n.explorer_url,n.explorer_postfix?.transaction??"tx",o):bl(e,t,o)}function fi(e,t){return Zo("https://explorer.crosstoken.io",String(e),"tx",t)}function bl(e,t,n){let o=Ce[e];if(t===o.cross)return fi(t,n);if(t===o.bsc)return Zo(e==="production"?"https://bscscan.com":"https://testnet.bscscan.com","tx",n)}function Xn(e,t,n,o=!0){let r=Je[e],a=ul({queryKey:[ml,e,t],queryFn:async({signal:c})=>{let l=await fetch(`${r}/v1/public/chain/info/${t}`,{cache:"no-store",signal:c});if(!l.ok)throw new Error(`Failed to fetch chain info: ${l.status}`);let d=await l.json();if("code"in d&&d.code!==void 0&&d.code!==200)throw new Error(`Chain info API error: ${d.code}`);return gl(d)},enabled:o,staleTime:300*1e3}),i=a.data;return{transactionUrl:fl(()=>hl(e,t,i,n),[t,i,e,n]),chainInfo:i,...a}}var ui="0x0000000000000000000000000000000000000001";var wl="0xa9059cbb",xl=/^0x[a-fA-F0-9]{40}$/,vl="nexus-cross:dapp-ui:send:recent:",mi=10;function yl(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return e.slice(0,t)}function Nn(e){return e.toLowerCase()}function Ct(e){return xl.test(e)}function pn(e){return Nn(e.address)===ui}function Xo(e){return`${vl}${e.toLowerCase()}`}function dn(e){if(typeof window>"u")return[];try{let t=window.localStorage.getItem(Xo(e));if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(o=>o!==null&&typeof o=="object"&&Ct(o.address)&&typeof o.updatedAt=="number").slice(0,mi):[]}catch{return[]}}function Jo(e,t){if(typeof window>"u")return[];let n=Nn(t),o=[{address:n,updatedAt:Date.now()},...dn(e).filter(r=>r.address!==n)].slice(0,mi);try{window.localStorage.setItem(Xo(e),JSON.stringify(o))}catch{return dn(e)}return o}function er(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(Xo(e))}catch{}}function en(e,t){let n=e.trim();if(!n)return{error:"Enter an amount."};if(!/^\d+(\.\d*)?$/.test(n))return{error:"Enter a valid amount."};let[o="0",r=""]=n.split(".");if(r.length>t)return{error:`Max ${t} decimal places.`};let a=BigInt(o||"0"),i=r.padEnd(t,"0"),s=i?BigInt(i):0n,c=10n**BigInt(t),l=a*c+s;return l<=0n?{error:"Amount must be greater than 0."}:{value:l}}function Tn(e,t){let n=BigInt(e||"0"),o=10n**BigInt(t),r=n/o,a=n%o;if(a===0n)return r.toString();let i=yl(a.toString().padStart(t,"0"));return`${r.toString()}.${i}`}function tr(e,t){let n=e.replace(/^0x/,"").toLowerCase().padStart(64,"0"),o=t.toString(16).padStart(64,"0");return`${wl}${n}${o}`}function gi(e,t=0){if(t>4||e===null||e===void 0)return"";if(typeof e=="string")return e.toLowerCase();if(typeof e!="object")return"";let n=e,o=[];return typeof n.name=="string"&&o.push(n.name),typeof n.shortMessage=="string"&&o.push(n.shortMessage),typeof n.message=="string"&&o.push(n.message),typeof n.details=="string"&&o.push(n.details),n.cause!==void 0&&o.push(gi(n.cause,t+1)),o.join(`
6
- `).toLowerCase()}function kl(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;if(e&&typeof e=="object"){let t=e;if(typeof t.shortMessage=="string")return t.shortMessage;if(typeof t.message=="string")return t.message}return""}function nr(e,t={},n="Failed to send transaction."){let o=gi(e);if(!o)return n;let r=t.nativeSymbol?.trim()||"gas token",a=t.networkName?.trim();if(o.includes("user rejected")||o.includes("userrejected")||o.includes("user denied")||o.includes("user cancelled")||o.includes("user canceled")||o.includes("action_rejected")||o.includes("rejected by user"))return"Transaction was cancelled.";if(o.includes("insufficientfunds")||o.includes("insufficient funds")||o.includes("exceeds the balance of the account")||o.includes("insufficient balance for transfer")){let i=a?` on ${a}`:"";return`Not enough ${r} to cover the gas fee.Please top up your ${r} balance and try again.`}return o.includes("transaction underpriced")||o.includes("replacement transaction underpriced")||o.includes("fee too low")?"Gas fee was too low for the network. Please try again.":o.includes("nonce too low")||o.includes("nonce has already been used")||o.includes("nonce too high")?"Pending transactions are out of order. Refresh the page and try again.":o.includes("execution reverted")||o.includes("contractfunctionrevertederror")||o.includes("contractfunctionexecutionerror")?"The transaction was rejected by the contract. The recipient or token may be invalid.":o.match(/chain \d+ is not configured/)?"This network is not registered in the app. Contact support.":o.includes("http request failed")||o.includes("failed to fetch")||o.includes("network request failed")||o.includes("timeout")||o.includes("econnreset")||o.includes("rpc error")||o.includes("429")?"Network connection failed. Check your internet and try again.":o.includes("estimategas")||o.includes("gas estimation failed")?"Could not estimate the gas fee. The recipient address or amount may be invalid.":kl(e)||n}var Sl=2000000000n,Cl=1000000000n;async function Jn(e,t,n){let o=new AbortController,r=setTimeout(()=>o.abort(),8e3),a=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:t,params:n}),signal:o.signal}).finally(()=>clearTimeout(r));if(!a.ok)throw new Error(`RPC ${t} HTTP ${a.status}`);let i=await a.json();if(i.error)throw new Error(`RPC ${t}: ${i.error.message}`);if(i.result===void 0)throw new Error(`RPC ${t}: empty result`);return i.result}function eo(e){return BigInt(e)}function Rl(e){return`0x${e.toString(16)}`}function Nl(e){let t={to:e.to};return e.from&&(t.from=e.from),e.value!==void 0&&e.value>0n&&(t.value=Rl(e.value)),e.data&&(t.data=e.data),t}function Tl(e){return e===56||e===97}async function hi(e){try{let t=await Jn(e,"eth_gasPrice",[]);return{gasPrice:eo(t)}}catch{return{gasPrice:Sl}}}async function Il(e,t){let n=Cl;try{let o=await Jn(e,"eth_maxPriorityFeePerGas",[]);n=eo(o)}catch{}return{maxFeePerGas:t+n,maxPriorityFeePerGas:n}}async function Ll(e,t){if(t)return hi(e);let n;try{n=(await Jn(e,"eth_getBlockByNumber",["latest",!1]))?.baseFeePerGas}catch{}return n?Il(e,eo(n)):hi(e)}async function bi(e,t){let n=Tl(t.chainId),o=Nl(t),[r,a]=await Promise.all([Jn(e,"eth_estimateGas",[o]),Ll(e,n)]);return{gasLimit:eo(r),gasPrice:a.gasPrice,maxFeePerGas:a.maxFeePerGas,maxPriorityFeePerGas:a.maxPriorityFeePerGas}}function wi(e){let{estimateGas:t,sendTransaction:n,getTransactionReceipt:o}=e;return{canSend:!!n,canEstimateGas(r){return!!t||!!r},async estimateGas(r,a){if(t)return t(r);if(a)return bi(a,r);throw new Error("Gas estimation is not available.")},async sendTransaction(r){if(!n)throw new Error("Sending is not available for this wallet.");return n(r)},getTransactionReceipt:o}}var El=1500,Al=120;function xi(e){return!!(e.token||e.recipient||e.amount)}function or({recipient:e,amount:t,token:n,balanceRaw:o}){let r={},a=e.trim(),i=en(t,n.quantity.decimals),s;return a?Ct(a)||(r.recipient="Enter a valid EVM recipient address."):r.recipient="Enter a recipient address.","error"in i?r.amount=i.error:(s=i.value,s>o&&(r.amount="Amount exceeds available balance.")),!pn(n)&&!Ct(n.address)&&(r.token="Token contract address is invalid."),{errors:r,rawAmount:r.amount?void 0:s,recipient:a&&Ct(a)?a:void 0}}function rr({token:e,walletAddress:t,recipient:n,rawAmount:o}){let r=t;return pn(e)?{to:n,value:o,chainId:e.chainId,from:r}:{to:Nn(e.address),data:tr(n,o),value:0n,chainId:e.chainId,from:r}}function Pl(e){let{status:t}=e;return t==="reverted"||t==="0x0"||t===0||t===0n||t===!1}var Bl=e=>new Promise(t=>setTimeout(t,e));async function vi({repository:e,args:t,chainId:n,onSubmitted:o,pollIntervalMs:r=El,pollMaxAttempts:a=Al}){let i=await e.sendTransaction(t);o(i);let{getTransactionReceipt:s}=e;if(!s)return"success";for(let c=0;c<a;c+=1){let l=await s({hash:i,chainId:n}).catch(()=>null);if(l)return Pl(l)?"reverted":"success";await Bl(r)}return"timeout"}var yi=["token","recipient","amount","review"];function ki(e){let{env:t,walletAddress:n,accountName:o,accounts:r=[],initialStep:a="recipient",token:i,tokens:s=[],onTokenChange:c,sendTransaction:l,getTransactionReceipt:d,estimateGas:f,getTokenPriceUsd:h,onSubmitted:m,onSuccess:y,onFailed:x,onExit:w,onOutlink:v}=e,B=P.useMemo(()=>wi({sendTransaction:l,getTransactionReceipt:d,estimateGas:f}),[l,d,f]),[u,E]=P.useState(i);P.useEffect(()=>{E(i)},[i.address,i.chainId]);let[C,A]=P.useState(a),[M,Z]=P.useState(""),[W,G]=P.useState(""),[q,O]=P.useState({}),[ie,ue]=P.useState("idle"),[te,ae]=P.useState(""),[De,se]=P.useState(""),[K,le]=P.useState(null),[J,U]=P.useState(!1),[He,pe]=P.useState(""),Ie=P.useRef(0),[Le,it]=P.useState(null),[we,Ft]=P.useState(""),[_e,bt]=P.useState(()=>dn(n)),Lt=P.useMemo(()=>Pe(t),[t]),{transactionUrl:ce,chainInfo:me}=Xn(Lt,u.chainId,te||void 0,!0),Qe=me?.currency_symbol??"",xe=me?.name??`Chain ID ${u.chainId}`,ge=P.useRef({nativeSymbol:Qe||void 0,networkName:xe,tokenSymbol:u.symbol});ge.current={nativeSymbol:Qe||void 0,networkName:xe,tokenSymbol:u.symbol};let he=P.useMemo(()=>BigInt(u.quantity.numeric||"0"),[u.quantity.numeric]),Mt=P.useMemo(()=>zt(u.quantity.numeric,u.quantity.decimals),[u.quantity.numeric,u.quantity.decimals]),Ge=h?.(u),at=P.useMemo(()=>{if(Ge===void 0)return;let S=parseFloat(W.replace(/,/g,""));return Number.isFinite(S)?S*Ge:0},[W,Ge]);P.useEffect(()=>{G(""),O({})},[u.address,u.chainId]),P.useEffect(()=>{Ie.current+=1,le(null),pe(""),U(!1)},[u.address,u.chainId,M,W]),P.useEffect(()=>{bt(dn(n))},[n]);let ve=P.useCallback(S=>{Z(S),O($=>({...$,recipient:void 0}))},[]),wt=P.useCallback(S=>{G(S),O($=>({...$,amount:void 0}))},[]),xt=P.useCallback(()=>{G(Tn(u.quantity.numeric,u.quantity.decimals)),O(S=>({...S,amount:void 0}))},[u.quantity.numeric,u.quantity.decimals]),Ee=P.useCallback(S=>{E(S),c?.(S),A("recipient")},[c]),st=P.useCallback(()=>A("token"),[]),Ye=P.useCallback(()=>{A(S=>{if(S==="result")return"review";if(S===a)return w?.(),S;let $=yi.indexOf(S);return $<=0?(w?.(),S):yi[$-1]})},[a,w]),ne=P.useCallback(()=>{let{errors:S}=or({recipient:M,amount:"1",token:u,balanceRaw:he});if(S.recipient){O($=>({...$,recipient:S.recipient}));return}O($=>({...$,recipient:void 0})),A("amount")},[M,u,he]),Ze=P.useCallback(S=>{Z(S),O($=>({...$,recipient:void 0})),A("amount")},[]),ye=P.useCallback(()=>{let S=or({recipient:M,amount:W,token:u,balanceRaw:he});O(S.errors),!(xi(S.errors)||S.rawAmount===void 0||!S.recipient)&&(it(S.rawAmount),Ft(S.recipient),le(null),pe(""),ue("idle"),A("review"))},[M,W,u,he]);P.useEffect(()=>{if(C!=="review"||!we||Le===null||K!==null||J||He||!B.canEstimateGas(me?.rpc))return;let S=++Ie.current;U(!0),pe(""),(async()=>{try{let $=rr({token:u,walletAddress:n,recipient:we,rawAmount:Le}),ee=await B.estimateGas($,me?.rpc);if(Ie.current!==S)return;le(ee)}catch($){if(Ie.current!==S)return;pe(nr($,ge.current,"Failed to estimate gas."))}finally{Ie.current===S&&U(!1)}})()},[C,we,Le,K,J,He,B,me?.rpc,u,n]);let vt=P.useCallback(async()=>{if(!(!we||Le===null)){se(""),ae(""),ue("submitting");try{let S="",$=await vi({repository:B,args:rr({token:u,walletAddress:n,recipient:we,rawAmount:Le}),chainId:u.chainId,onSubmitted:ee=>{S=ee,ae(ee),ue("confirming"),bt(Jo(n,we)),m?.({txHash:ee,chainId:u.chainId,amount:W,tokenSymbol:u.symbol,recipient:we})}});if($==="success")ue("success"),S&&y?y?.(S):A("result");else if($==="reverted"){let ee="Transaction reverted on-chain.";ue("error"),se(ee),S&&x?x({txHash:S,chainId:u.chainId,message:ee}):A("result")}else{let ee="Transaction receipt was not found. Please check again later.";ue("error"),se(ee),S&&x?x({txHash:S,chainId:u.chainId,message:ee}):A("result")}}catch(S){ue("error"),se(nr(S,{nativeSymbol:Qe||void 0,networkName:xe,tokenSymbol:u.symbol})),A("result")}}},[B,we,Le,u,W,n,m,y,x,Qe,xe]),[Ue,yt]=P.useState(!1),kt=P.useRef(void 0);P.useEffect(()=>()=>clearTimeout(kt.current),[]);let Et=P.useCallback(async()=>{if(te)try{await navigator.clipboard.writeText(te),yt(!0),clearTimeout(kt.current),kt.current=setTimeout(()=>yt(!1),2e3)}catch{}},[te]),_t=P.useCallback(()=>{if(!ce||!te)return;let S=ke=>{typeof window<"u"&&window.open(ke,"_blank","noopener,noreferrer")};if(!v){S(ce);return}let $=v(ce,{category:"send",origin:"send-transaction",payload:{chainId:u.chainId,txHash:te}});if($&&typeof $.then=="function"){let ke=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null;$.then(At=>{if(At===null){ke?.close();return}let Oe=At??ce;if(ke)try{ke.location.href=Oe}catch{ke.close(),S(Oe)}else S(Oe)});return}let ee=$;ee!==null&&S(ee??ce)},[v,u.chainId,ce,te]),lt=P.useCallback(()=>{se(""),ae(""),ue("idle"),le(null),pe(""),A("review")},[]);return{step:C,status:ie,token:u,tokens:s.length>0?s:[u],recipient:M,amount:W,amountUsd:at,fieldErrors:q,error:De,txHash:te,gasEstimate:K,gasLoading:J,gasError:He,reviewRawAmount:Le,reviewRecipient:we,recentAddresses:_e,accounts:r,accountName:o,walletAddress:n,resolvedEnv:Lt,transactionUrl:ce,networkName:xe,nativeSymbol:Qe,nativeDecimals:me?.currency_decimals??u.quantity.decimals,balanceRaw:he,balanceText:Mt,priceUsd:Ge,canSelectToken:(s.length>0?s:[u]).length>1,canSend:B.canSend,getTokenPriceUsd:h,setRecipient:ve,setAmount:wt,setMax:xt,selectToken:Ee,goToTokenSelect:st,selectRecipient:Ze,submitRecipient:ne,submitAmount:ye,confirmSend:vt,retry:lt,back:Ye,hashCopied:Ue,copyHash:Et,openTransaction:_t}}import*as dt from"react";function to(e,t,n=10){if(t<=0)return e.toString();let o=10n**BigInt(t),r=e/o,a=e%o;if(a===0n)return r.toString();let s=a.toString().padStart(t,"0").slice(0,Math.max(0,Math.min(n,t)));return s=s.replace(/0+$/,""),s?`${r.toString()}.${s}`:r.toString()}function ir(e,t){return to(e,t,6)}function Si(e){return to(e,9,2)}function Ci(e){return e.toLocaleString("en-US")}function Ri(e){return e===56||e===97}function no(e){return e.gasPrice??e.maxFeePerGas}function Ni(e,t=!1){return t?no(e)!==void 0?"legacy":null:e.maxFeePerGas!==void 0?"dynamic":e.gasPrice!==void 0?"legacy":null}function Ti(e,t=!1){if(t){let n=no(e);return n!==void 0?e.gasLimit*n:null}return e.maxFeePerGas!==void 0?e.gasLimit*e.maxFeePerGas:e.gasPrice!==void 0?e.gasLimit*e.gasPrice:null}function oo(e){return!Number.isFinite(e)||e<=0?"$0.00":`$${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}import{jsx as In,jsxs as ar}from"react/jsx-runtime";function Ii({flow:e}){let{amount:t,setAmount:n,amountUsd:o,balanceText:r,balanceRaw:a,token:i,setMax:s}=e,c=dt.useRef(null),l=dt.useCallback(()=>{requestAnimationFrame(()=>{let x=c.current;if(!x)return;let w=x.value.length;x.setSelectionRange(w,w)})},[]);dt.useEffect(()=>{c.current?.focus(),l()},[l]),dt.useEffect(()=>{t===""&&(h(!1),l())},[t,l]);let d=dt.useMemo(()=>{let x=en(t,i.quantity.decimals);return"value"in x&&x.value>a},[t,i.quantity.decimals,a]),[f,h]=dt.useState(!1),m=!f&&t===""?"0.00":t,y=t.trim()===""||t.trim()==="0";return In("div",{className:"sf-body sf-amount",children:ar("div",{className:"sf-amount-center",children:[In("span",{className:"sf-amount-usd",children:o!==void 0?oo(o):"\xA0"}),In("div",{className:"sf-amount-input-wrap","data-over":d||void 0,"data-empty":y||void 0,onClick:()=>c.current?.focus(),children:In("input",{ref:c,className:"sf-amount-input",value:m,onChange:x=>{let w=x.target.value;if(f)n(w);else if(t===""){if(w.length<4)return;h(!0);let v=w.startsWith("0.00")?w.slice(4):w;n(v)}else h(!0),n(w)},placeholder:"0.00",inputMode:"decimal",autoComplete:"off","aria-label":`Amount in ${i.symbol}`,size:1})}),ar("div",{className:"sf-amount-balance",children:[In("span",{children:"Balance:"}),ar("button",{type:"button",className:"sf-amount-max",onClick:s,children:[r," ",i.symbol]})]})]})})}import*as pt from"react";var sr={dev:"https://stg-bonding-curve-api.crosstoken.io/api",stage:"https://stg-bonding-curve-api.crosstoken.io/api",production:"https://bonding-curve-api.crosstoken.io/api"},Li={cross:"https://contents.crosstoken.io/wallet/token/images/CROSS.svg",bsc:"https://contents.crosstoken.io/wallet/token/images/BSC.svg"};function Ln(e,t){let n=Ce[e];if(t===n.cross)return Li.cross;if(t===n.bsc)return Li.bsc}var Fl={dev:"https://dev-portrait.crosstoken.io",stage:"https://dev-portrait.crosstoken.io",production:"https://portrait.crosstoken.io"};function tn(e,t,n={}){if(!t||!t.startsWith("0x"))return;let{size:o=120,bg:r,format:a="png"}=n,i=Fl[e],s=r?`&bg=${r}`:"";return`${i}/portrait/evm/${t}.${a}?size=${o}${s}`}import{jsx as et,jsxs as ro}from"react/jsx-runtime";function Ei({size:e=20,className:t}){return ro("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,"aria-hidden":"true",children:[et("circle",{cx:"9",cy:"9",r:"6",stroke:"currentColor",strokeWidth:"1.7"}),et("path",{d:"m17 17-3.2-3.2",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function Ai({size:e=20,className:t}){return et("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",className:t,"aria-hidden":"true",children:et("path",{d:"M9 2h6a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zM8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-2M12 11v6M9 14h6",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function Pi({size:e=20,className:t}){return ro("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,"aria-hidden":"true",children:[et("circle",{cx:"10",cy:"10",r:"10",fill:"currentColor",opacity:"0.12"}),et("path",{d:"M7 7l6 6M13 7l-6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})]})}function Bi({size:e=16,className:t}){return et("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",className:t,"aria-hidden":"true",children:et("path",{d:"M8 3v10m0 0 4-4m-4 4-4-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function Fi({size:e=56,className:t}){return ro("svg",{width:e,height:e,viewBox:"0 0 56 56",fill:"none",className:t,"aria-hidden":"true",children:[et("circle",{cx:"28",cy:"28",r:"28",fill:"var(--ds-accent-primary-default, #00b4b7)"}),et("path",{d:"M17 28.5 24.2 35.5 39 20.5",stroke:"var(--ds-accent-primary-on, #ffffff)",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Mi({size:e=56,className:t}){return ro("svg",{width:e,height:e,viewBox:"0 0 56 56",fill:"none",className:t,"aria-hidden":"true",children:[et("circle",{cx:"28",cy:"28",r:"28",fill:"var(--ds-system-red-default, #da0b2e)"}),et("path",{d:"M20 20 36 36m0-16L20 36",stroke:"#ffffff",strokeWidth:"4",strokeLinecap:"round"})]})}import{jsx as de,jsxs as Rt}from"react/jsx-runtime";function _i(e,t){return e.name||`Account ${(e.index??t)+1}`}function Oi(e){return e.trim().slice(0,1).toUpperCase()||"A"}function zi(e){return e.toLowerCase()}function Wi({flow:e}){let{recipient:t,setRecipient:n,fieldErrors:o,recentAddresses:r,accounts:a,walletAddress:i,resolvedEnv:s,selectRecipient:c}=e,l=pt.useMemo(()=>a.filter(u=>u.address.toLowerCase()!==i.toLowerCase()),[a,i]),d=l.length>0,f=pt.useMemo(()=>new Map(l.map((u,E)=>[zi(u.address),{account:u,index:E}])),[l]),[h,m]=pt.useState("recent"),y=pt.useRef(null);pt.useEffect(()=>{y.current?.focus()},[]);let x="1A1A2E",w=pt.useCallback(async()=>{try{let u=await navigator.clipboard.readText();u&&n(u.trim())}catch{}},[n]),v=t.trim().length>0,B=Ct(t.trim());return Rt("div",{className:"sf-recipient",children:[Rt("div",{className:"sf-recipient-top",children:[Rt("div",{className:"sf-address-field","data-filled":v||void 0,"data-invalid":o.recipient||void 0,children:[de("textarea",{ref:y,className:"sf-address-input",value:t,onChange:u=>n(u.target.value),placeholder:"Enter the recipient's address",autoComplete:"off",spellCheck:!1,"aria-label":"Recipient address",rows:v?2:1}),v?de("button",{type:"button",className:"sf-address-action",onClick:()=>n(""),"aria-label":"Clear",children:de(Pi,{size:20})}):de("button",{type:"button",className:"sf-address-action",onClick:w,"aria-label":"Paste from clipboard",children:de(Ai,{size:20})})]}),o.recipient&&de("p",{className:"sf-field-error",role:"alert",children:o.recipient}),Rt("div",{className:"sf-tabs",role:"tablist",children:[de("button",{type:"button",role:"tab",className:"sf-tab","data-active":h==="recent"||void 0,"aria-selected":h==="recent",onClick:()=>m("recent"),children:"Recent"}),d&&de("button",{type:"button",role:"tab",className:"sf-tab","data-active":h==="account"||void 0,"aria-selected":h==="account",onClick:()=>m("account"),children:"My Account"})]})]}),de("div",{className:"sf-address-list",children:h==="account"&&d?l.map((u,E)=>{let C=_i(u,E),A=tn(s,u.address,{size:56,bg:x});return Rt("button",{type:"button",className:"sf-address-row",onClick:()=>c(u.address),children:[Rt("span",{className:"sf-address-avatar",children:[A&&de("img",{src:A,alt:"",width:40,height:40,draggable:!1,onError:M=>{M.currentTarget.style.display="none"}}),de("span",{className:"sf-address-avatar-fallback",children:Oi(C)})]}),Rt("span",{className:"sf-address-meta",children:[de("span",{className:"sf-address-name",children:C}),de("span",{className:"sf-address-value",children:Ve(u.address)})]})]},u.address)}):r.length>0?r.map(u=>{let E=f.get(zi(u.address)),C=E?_i(E.account,E.index):Ve(u.address),A=tn(s,u.address,{size:56,bg:x});return Rt("button",{type:"button",className:"sf-address-row",onClick:()=>c(u.address),children:[Rt("span",{className:"sf-address-avatar",children:[A&&de("img",{src:A,alt:"",width:40,height:40,draggable:!1,onError:M=>{M.currentTarget.style.display="none"}}),de("span",{className:"sf-address-avatar-fallback",children:Oi(C)})]}),Rt("span",{className:"sf-address-meta",children:[de("span",{className:"sf-address-name",children:C}),de("span",{className:"sf-address-value",children:Ve(u.address)})]})]},u.address)}):de("div",{className:"sf-empty",children:"No send history"})}),v&&!B&&!o.recipient&&de("p",{className:"sf-field-error",role:"alert",children:"Enter a valid EVM recipient address."})]})}import{jsx as Be,jsxs as fn}from"react/jsx-runtime";function Hi({flow:e}){let{status:t,txHash:n,error:o,copyHash:r,hashCopied:a,openTransaction:i}=e,s=t==="error",c=t==="success";return s?fn("div",{className:"sf-body sf-result sf-result--error",children:[Be("span",{className:"sf-result-icon",children:Be(Mi,{size:56})}),fn("div",{className:"sf-result-copy",children:[Be("h3",{className:"sf-result-title",children:"Transaction Failed"}),Be("p",{className:"sf-result-desc",children:o||"Something went wrong. Please try again."})]}),n&&Be(Di,{txHash:n,hashCopied:a,onCopy:r,onOpen:i})]}):fn("div",{className:"sf-body sf-result",children:[Be("span",{className:"sf-result-icon","data-pending":!c||void 0,children:c?Be(Fi,{size:56}):Be("span",{className:"sf-result-spinner"})}),fn("div",{className:"sf-result-copy",children:[Be("h3",{className:"sf-result-title",children:c?"Transaction Complete":"Transaction in Progress"}),Be("p",{className:"sf-result-desc",children:c?"Your transfer was sent successfully.":"Transfer in progress. Waiting for confirmation."})]}),n&&Be(Di,{txHash:n,hashCopied:a,onCopy:r,onOpen:i})]})}function Di({txHash:e,hashCopied:t,onCopy:n,onOpen:o}){return fn("div",{className:"sf-result-hash-card",children:[Be("span",{className:"sf-result-hash-label",children:"Transaction Hash"}),fn("div",{className:"sf-result-hash-row",children:[Be("button",{type:"button",className:"sf-result-hash-link",onClick:o,"aria-label":"Open transaction in explorer",children:Ve(e)}),Be("button",{type:"button",className:"sf-result-copy-btn",onClick:n,"aria-label":"Copy transaction hash",children:t?Be(Cn,{size:16}):"Copy"})]})]})}import{jsx as oe,jsxs as ze}from"react/jsx-runtime";var io="\u2014";function Gi({flow:e}){let{token:t,reviewRawAmount:n,reviewRecipient:o,accountName:r,accounts:a,walletAddress:i,networkName:s,nativeSymbol:c,nativeDecimals:l,gasEstimate:d,gasLoading:f,gasError:h,error:m,resolvedEnv:y}=e,x=pn(t),w=n!==null?to(n,t.quantity.decimals):"",v=r?.trim()||`Account ${(a[0]?.index??0)+1}`,B=tn(y,i,{size:56,bg:"1A1A2E"}),u=c||(x?t.symbol:""),E=Ri(t.chainId),C=d?Ni(d,E):null,A=d?Ti(d,E):null,M=O=>O!==null&&u?`${ir(O,l)} ${u}`:io,Z=O=>O!==void 0?`${Si(O)} Gwei`:io,W=(()=>{if(!x||!d||A===null||n===null)return io;let O=n+A;return`${ir(O,l)} ${u||t.symbol}`})(),G=O=>f?"\u2026":O,q=[{label:"Est. Tx Fee",value:G(M(A))},...C==="dynamic"?[{label:"Max Priority Fee",value:G(Z(d?.maxPriorityFeePerGas))},{label:"Max Gas Fee",value:G(Z(d?.maxFeePerGas))}]:C==="legacy"?[{label:"Gas Price",value:G(Z(d?no(d):void 0))}]:[],{label:"Gas Limit",value:G(d?Ci(d.gasLimit):io)}];return ze("div",{className:"sf-body sf-review",children:[ze("div",{className:"sf-review-amount",children:[oe("img",{className:"sf-review-amount-icon",src:t.icon_url,alt:"",width:40,height:40,draggable:!1,onError:O=>{O.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),ze("span",{className:"sf-review-amount-value",children:[w,oe("span",{className:"sf-review-amount-symbol",children:t.symbol})]})]}),ze("div",{className:"sf-review-parties",children:[ze("div",{className:"sf-review-card sf-review-party",children:[oe("span",{className:"sf-review-party-label",children:"From"}),ze("div",{className:"sf-review-party-head",children:[oe("span",{className:"sf-review-party-avatar",children:B&&oe("img",{src:B,alt:"",width:28,height:28,draggable:!1,onError:O=>{O.currentTarget.style.display="none"}})}),oe("span",{className:"sf-review-party-name",children:v})]}),oe("span",{className:"sf-review-party-addr",children:i})]}),oe("span",{className:"sf-review-arrow","aria-hidden":!0,children:oe(Bi,{size:16})}),ze("div",{className:"sf-review-card sf-review-party",children:[oe("span",{className:"sf-review-party-label",children:"To"}),oe("span",{className:"sf-review-party-addr",children:o})]})]}),ze("section",{className:"sf-review-card",children:[oe("h3",{className:"sf-review-section-title",children:"Summary"}),ze("div",{className:"sf-review-row",children:[oe("span",{className:"sf-review-row-label",children:"Network"}),oe("span",{className:"sf-review-row-value",children:s})]}),q.map(O=>ze("div",{className:"sf-review-row",children:[oe("span",{className:"sf-review-row-label",children:O.label}),oe("span",{className:"sf-review-row-value",children:O.value})]},O.label))]}),ze("section",{className:"sf-review-card",children:[oe("h3",{className:"sf-review-section-title",children:"Total"}),ze("div",{className:"sf-review-row",children:[oe("span",{className:"sf-review-row-label",children:"Total Amount"}),ze("span",{className:"sf-review-row-value",children:[w," ",t.symbol]})]}),x&&ze("div",{className:"sf-review-row",children:[oe("span",{className:"sf-review-row-label",children:"Max. Total Amount"}),oe("span",{className:"sf-review-row-value",children:G(W)})]})]}),(h||m)&&oe("div",{className:"sf-message sf-message--error",role:"alert",children:h||m})]})}import*as ao from"react";import{jsx as Wt,jsxs as nn}from"react/jsx-runtime";function Ui({flow:e}){let[t,n]=ao.useState(""),o=t.trim().toLowerCase(),r=ao.useMemo(()=>o?e.tokens.filter(a=>a.symbol.toLowerCase().includes(o)||a.name.toLowerCase().includes(o)):e.tokens,[e.tokens,o]);return nn("div",{className:"sf-body sf-token-select",children:[nn("div",{className:"sf-search",children:[Wt(Ei,{size:20}),Wt("input",{className:"sf-search-input",value:t,onChange:a=>n(a.target.value),placeholder:"Search Tokens",autoComplete:"off",spellCheck:!1,"aria-label":"Search tokens"})]}),nn("div",{className:"sf-token-list",children:[r.map(a=>{let i=`${a.chainId}:${a.address.toLowerCase()}`,s=Ln(e.resolvedEnv,a.chainId),c=e.getTokenPriceUsd?.(a);return nn("button",{type:"button",className:"sf-token-row",onClick:()=>e.selectToken(a),children:[nn("span",{className:"sf-token-left",children:[nn("span",{className:"sf-token-icon-wrap",children:[Wt("img",{className:"sf-token-icon",src:a.icon_url,alt:"",width:40,height:40,loading:"lazy",draggable:!1,onError:l=>{l.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),s&&Wt("img",{className:"sf-token-chain-badge",src:s,alt:"","aria-hidden":!0,width:16,height:16,loading:"lazy",draggable:!1,onError:l=>{l.currentTarget.style.display="none"}})]}),Wt("span",{className:"sf-token-name",children:a.symbol})]}),nn("span",{className:"sf-token-right",children:[Wt("span",{className:"sf-token-balance",children:zt(a.quantity.numeric,a.quantity.decimals)}),c!==void 0&&Wt("span",{className:"sf-token-price",children:oo(c)})]})]},i)}),r.length===0&&Wt("div",{className:"sf-empty",children:"No tokens found"})]})]})}_(`.sf-root{display:flex;flex-direction:column;flex:1;min-height:0;font-family:inherit}.sf-header{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:24px;flex-shrink:0;position:relative;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.sf-header .sf-header-btn:last-child{position:absolute;top:24px;right:24px}.sf-header-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;flex-shrink:0;padding:0;border:none;background:transparent;color:var(--ds-content-low, rgba(0, 0, 0, .4));cursor:pointer;filter:none;transition:color .15s ease}.sf-header-btn:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85));filter:none}.sf-header-title{position:absolute;left:50%;transform:translate(-50%);text-align:center;font-family:inherit;font-size:18px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);pointer-events:none}.sf-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.15) transparent;overscroll-behavior:contain}[data-theme=light] .sf-body{scrollbar-color:rgba(0,0,0,.12) transparent}.sf-body::-webkit-scrollbar{width:4px;height:4px}.sf-body::-webkit-scrollbar-track,.sf-body::-webkit-scrollbar-corner{background:transparent}.sf-body::-webkit-scrollbar-thumb{border-radius:4px;background:#ffffff26}.sf-body::-webkit-scrollbar-thumb:hover{background:#ffffff40}[data-theme=light] .sf-body::-webkit-scrollbar-thumb{background:#0000001f}[data-theme=light] .sf-body::-webkit-scrollbar-thumb:hover{background:#0003}.sf-empty{padding:32px 0;text-align:center;font-family:inherit;font-size:14px;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-field-error{margin:8px 24px 0;font-family:inherit;font-size:12px;line-height:1.5;color:var(--ds-system-red-default, #da0b2e)}.sf-message--error{margin:16px 0 0;padding:12px 16px;background:var(--ds-system-red-low, #ffeeee);color:var(--ds-system-red-high, #d20609);font-family:inherit;font-size:13px;line-height:1.5;border-radius:12px;width:100%;box-sizing:border-box}.sf-footer{display:flex;flex-shrink:0;padding:16px 24px 24px}.sf-footer:empty{display:none}.sf-footer-row{display:flex;gap:8px;width:100%}.sf-footer-row .sf-btn,.sf-footer-row .sf-btn--secondary{flex:1 1 0;min-width:0}.sf-footer>.sf-btn{width:100%}.sf-btn{appearance:none;display:inline-flex;align-items:center;justify-content:center;flex:1;height:48px;padding:0 24px;border:none;border-radius:12px;font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer;transition:background-color .15s ease,transform .1s ease}.sf-btn--primary{background:var(--ds-accent-primary-default, #00b4b7);color:var(--ds-accent-primary-on, #ffffff)}.sf-btn--primary:hover:not(:disabled):not([data-disabled]){background:var(--ds-accent-primary-high, #00a0a2)}.sf-btn--primary:active:not(:disabled):not([data-disabled]){transform:scale(.97)}.sf-btn--primary[data-disabled],.sf-btn--primary:disabled{background:var(--ds-accent-primary-default, #00b4b7);color:var(--ds-accent-primary-on, #ffffff);cursor:default;opacity:.5}.sf-btn--secondary{flex:0 0 120px;background:var(--ds-surface-default, #ffffff);border:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));color:var(--ds-content-high, rgba(0, 0, 0, .85))}.sf-token-select{padding:0;display:flex;flex-direction:column}.sf-token-select .sf-search{margin:16px 24px}.sf-token-select .sf-token-list{width:100%;margin-top:0}.sf-search{display:flex;align-items:center;gap:8px;padding:12px 16px;border-radius:12px;border:1.5px solid transparent;background:var(--ds-surface-medium, #f5f7fa);color:var(--ds-content-low, rgba(0, 0, 0, .4));box-sizing:border-box;transition:border-color .15s ease}.sf-search:hover{border-color:var(--ds-border-medium, rgba(0, 0, 0, .18))}.sf-search:focus-within{border-color:var(--ds-accent-primary-default, #00b4b7)}.sf-search-input{flex:1;min-width:0;border:none;background:transparent;outline:none;font-family:inherit;font-size:16px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.sf-search-input::placeholder{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-token-list{display:flex;flex-direction:column;margin-top:8px}.sf-token-row{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;padding:12px 24px;border:none;background:transparent;cursor:pointer;text-align:left;font-family:inherit;border-radius:0;box-sizing:border-box;transition:background-color .15s ease}.sf-token-row:hover{background:var(--ds-surface-medium, rgba(0, 0, 0, .04))}.sf-token-left{display:flex;align-items:center;gap:16px;min-width:0}.sf-token-icon-wrap{position:relative;width:40px;height:40px;flex-shrink:0}.sf-token-icon{width:40px;height:40px;border-radius:0;object-fit:contain}.sf-token-chain-badge{position:absolute;right:-2px;bottom:-2px;width:16px;height:16px;border-radius:50%;object-fit:cover}.sf-token-name{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.sf-token-right{display:flex;flex-direction:column;align-items:flex-end;flex-shrink:0}.sf-token-balance{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);white-space:nowrap}.sf-token-price{font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4));white-space:nowrap}.sf-recipient{display:flex;flex-direction:column;flex:1;min-height:0}.sf-recipient-top{display:flex;flex-direction:column;padding:16px 24px 0}.sf-address-field{display:flex;align-items:center;gap:8px;padding:12px;border-radius:12px;border:1.5px solid transparent;background:var(--ds-surface-medium, #f5f7fa);transition:border-color .15s ease;box-sizing:border-box}.sf-address-field:hover{border-color:var(--ds-border-medium, rgba(0, 0, 0, .18))}.sf-address-field:focus-within{border-color:var(--ds-accent-primary-default, #00b4b7)}.sf-address-field[data-filled]{border-color:var(--ds-accent-primary-default, #00b4b7)}.sf-address-field[data-invalid]{border-color:var(--ds-system-red-default, #da0b2e)}.sf-address-input{flex:1;min-width:0;border:none;background:transparent;outline:none;resize:none;overflow:hidden;font-family:inherit;font-size:16px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));word-break:break-word;overflow-wrap:anywhere}.sf-address-input::placeholder{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-address-action{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;flex-shrink:0;padding:0;border:none;background:transparent;border-radius:6px;color:var(--ds-content-low, rgba(0, 0, 0, .4));cursor:pointer;transition:color .15s ease}.sf-address-action:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.sf-address-field[data-filled] .sf-address-action{border-radius:9999px}.sf-tabs{display:flex;gap:0;margin:16px 0 0}.sf-tab{position:relative;padding:8px 12px;border:none;background:transparent;cursor:pointer;font-family:inherit;font-size:16px;font-weight:600;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-tab[data-active]{color:var(--ds-accent-primary-high, #00a0a2)}.sf-tab[data-active]:after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:3px;border-radius:9999px;background:var(--ds-accent-primary-high, #00a0a2)}.sf-address-list{display:flex;flex-direction:column;width:100%;margin-top:8px}.sf-address-row{display:flex;align-items:center;gap:16px;width:100%;padding:12px 24px;border:none;background:transparent;cursor:pointer;text-align:left;font-family:inherit;border-radius:0;box-sizing:border-box;transition:background-color .15s ease}.sf-address-row:hover{background:var(--ds-surface-medium, rgba(0, 0, 0, .04))}.sf-address-avatar{position:relative;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;flex-shrink:0;border-radius:50%;overflow:hidden;background:var(--ds-surface-high, #edf1f2);color:var(--ds-content-medium, rgba(0, 0, 0, .65));font-size:14px;font-weight:600}.sf-address-avatar img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}.sf-address-avatar-fallback{position:relative;z-index:0}.sf-address-meta{display:flex;flex-direction:column;min-width:0}.sf-address-name{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sf-address-value{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.wi-drawer-content .sf-header{padding:16px}.wi-drawer-content .sf-header .sf-header-btn:last-child{top:16px;right:16px}.wi-drawer-content .sf-token-select{padding:0}.wi-drawer-content .sf-token-select .sf-search{margin:16px}.wi-drawer-content .sf-token-row{padding:12px 16px}.wi-drawer-content .sf-recipient-top{padding:16px 16px 0}.wi-drawer-content .sf-address-row{padding:12px 16px}.wi-drawer-content .sf-footer{padding:12px 16px 24px}.wi-drawer-content .sf-field-error,.wi-drawer-content .sf-message--error{margin:16px 0 0;width:auto}.sf-amount{display:flex;flex-direction:column}.sf-amount-center{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:8px;padding:64px 24px 48px;text-align:center}.sf-amount-usd{font-family:inherit;font-size:14px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4));min-height:21px}.sf-amount-input-wrap{display:flex;justify-content:center;max-width:100%}.sf-amount-input{width:auto;max-width:100%;border:none;background:transparent;outline:none;text-align:center;font-family:inherit;font-size:40px;font-weight:700;line-height:1.25;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);field-sizing:content}.sf-amount-input-wrap[data-empty] .sf-amount-input,.sf-amount-input::placeholder{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-amount-input-wrap[data-over] .sf-amount-input{color:var(--ds-system-red-default, #da0b2e)}.sf-amount-balance{display:inline-flex;align-items:center;gap:4px;font-family:inherit;font-size:14px;font-weight:400;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-amount-max{border:none;background:transparent;padding:0;cursor:pointer;font:inherit;color:var(--ds-content-medium, rgba(0, 0, 0, .65));text-decoration:underline;text-underline-offset:2px;transition:color .15s ease}.sf-amount-max:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-drawer-content .sf-amount-center{padding:64px 16px 48px}.sf-review{display:flex;flex-direction:column;gap:16px;padding:24px}.sf-review-amount{display:flex;align-items:center;gap:12px;padding:0;background:transparent}.sf-review-amount-icon{width:40px;height:40px;border-radius:0;object-fit:contain;flex-shrink:0}.sf-review-amount-value{display:inline-flex;flex-direction:column;align-items:flex-start;gap:0;font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);word-break:break-all}.sf-review-amount-symbol{font-size:12px;font-weight:400;line-height:1.5;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-review-parties{position:relative;display:flex;flex-direction:column;gap:0}.sf-review-arrow{position:relative;z-index:1;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;margin:-4px auto;border-radius:50%;background:var(--ds-surface-default, #ffffff);border:1px solid var(--ds-border-medium, rgba(0, 0, 0, .18));color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-review-card{display:flex;flex-direction:column;gap:8px;padding:16px;border-radius:12px;background:var(--ds-surface-medium, #f5f7fa)}.sf-review-party-label{font-family:inherit;font-size:12px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-review-party-head{display:flex;align-items:center;gap:8px}.sf-review-party-avatar{display:inline-flex;width:24px;height:24px;border-radius:50%;overflow:hidden;background:var(--ds-surface-high, #edf1f2);flex-shrink:0}.sf-review-party-avatar img{width:100%;height:100%;object-fit:cover}.sf-review-party-name{font-family:inherit;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.sf-review-party-addr{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:12px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65));word-break:break-all}.sf-review-section-title{margin:0 0 4px;font-family:inherit;font-size:16px;font-weight:600;letter-spacing:-.01em;color:var(--ds-content-highest, #000000)}.sf-review-row{display:flex;flex-direction:column;align-items:flex-start;gap:4px}.sf-review-row-label{font-family:inherit;font-size:12px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-review-row-value{font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));text-align:left;word-break:break-all}.wi-drawer-content .sf-review{padding:16px}.sf-result{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;padding:48px 24px;text-align:center}.sf-result-icon{display:inline-flex;align-items:center;justify-content:center;width:56px;height:56px}.sf-result-spinner{width:56px;height:56px;border-radius:50%;border:4px solid var(--ds-border-medium, rgba(0, 0, 0, .18));border-top-color:var(--ds-accent-primary-default, #00b4b7);animation:sf-spin .8s linear infinite}@keyframes sf-spin{to{transform:rotate(360deg)}}.sf-result-copy{display:flex;flex-direction:column;gap:8px}.sf-result-title{margin:0;font-family:inherit;font-size:18px;font-weight:600;letter-spacing:-.01em;color:var(--ds-content-highest, #000000)}.sf-result-desc{margin:0;font-family:inherit;font-size:14px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-result-hash-card{display:flex;flex-direction:column;gap:8px;width:100%;padding:16px;border-radius:12px;background:var(--ds-surface-medium, #f5f7fa);text-align:left}.sf-result-hash-label{font-family:inherit;font-size:12px;font-weight:500;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-result-hash-row{display:flex;align-items:center;justify-content:space-between;gap:8px}.sf-result-hash-link{border:none;background:transparent;padding:0;cursor:pointer;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:14px;color:var(--ds-accent-primary-high, #00a0a2)}.sf-result-copy-btn{display:inline-flex;align-items:center;justify-content:center;min-width:44px;height:28px;padding:0 10px;border:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));border-radius:8px;background:var(--ds-surface-default, #ffffff);cursor:pointer;font-family:inherit;font-size:12px;font-weight:500;color:var(--ds-content-high, rgba(0, 0, 0, .85))}
7
- `);import{jsx as be,jsxs as so}from"react/jsx-runtime";var Ml={token:"Send",recipient:"Send",amount:"Send",review:"Sign Transaction",result:""};function lo({onClose:e,onBackToWallet:t,onConfirmSuccess:n,onSuccess:o,className:r,...a}){let i=$i.useCallback(v=>{o?.(v),n?.(v)},[n,o]),c=ki({...a,onSuccess:o||n?i:void 0,onExit:t}),{step:l,status:d}=c,f=Ct(c.recipient.trim()),h=en(c.amount,c.token.quantity.decimals),m="value"in h&&h.value<=c.balanceRaw,y=d==="submitting"||d==="confirming",x=l!=="result",w=Ml[l]??"";return so("div",{className:X("sf-root",r),"data-step":l,children:[so("header",{className:"sf-header",children:[x?be("button",{type:"button",className:"sf-header-btn",onClick:c.back,"aria-label":"Back",children:be(Pt,{size:24})}):be("span",{className:"sf-header-btn","aria-hidden":!0}),be("span",{className:"sf-header-title",children:w}),be("button",{type:"button",className:"sf-header-btn",onClick:e,"aria-label":"Close",children:be(St,{size:24})})]}),l==="token"&&be(Ui,{flow:c}),l==="recipient"&&be(Wi,{flow:c}),l==="amount"&&be(Ii,{flow:c}),l==="review"&&be(Gi,{flow:c}),l==="result"&&be(Hi,{flow:c}),so("footer",{className:"sf-footer","data-step":l,children:[l==="recipient"&&be("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.submitRecipient,"data-disabled":!f||void 0,"aria-disabled":!f,children:"Next"}),l==="amount"&&be("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.submitAmount,"data-disabled":!m||void 0,"aria-disabled":!m,children:"Next"}),l==="review"&&so("div",{className:"sf-footer-row",children:[be("button",{type:"button",className:"sf-btn sf-btn--secondary",onClick:c.back,disabled:y,children:"Cancel"}),be("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.confirmSend,disabled:y||!c.canSend,children:y?"Sending...":"Send"})]}),l==="result"&&d==="success"&&be("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:()=>n?.(c.txHash||void 0),children:"All done"}),l==="result"&&d==="error"&&be("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.retry,children:"Try Again"})]})]})}import*as ji from"@radix-ui/react-popover";import{Drawer as _l}from"vaul";import{jsx as co,jsxs as Ol}from"react/jsx-runtime";function Vi({asChild:e,className:t,children:n}){let{isMobile:o,theme:r,walletAddress:a}=Ot(),i=n!=null,s=e??!0,c=i?n:Ol("button",{type:"button",className:X("wi-trigger-btn",t),"data-theme":r,"data-mobile":o||void 0,children:[co(ei,{size:o?14:16}),co("span",{className:"wi-trigger-address",children:Ve(a)})]});return o?co(_l.Trigger,{asChild:s,children:c}):co(ji.Trigger,{asChild:s,children:c})}import*as F from"react";import*as So from"@radix-ui/react-popover";import{Drawer as yo}from"vaul";import Bn from"bignumber.js";import{useQueries as zl}from"@tanstack/react-query";import{useMemo as Wl}from"react";var lr="user-balance";async function Dl(e,t,n,o){let r=new URLSearchParams({networkId:`eip155:${t}`,account:n}),a=await fetch(`${e}/v1/public/token/balance?${r}`,{cache:"no-store",signal:o});if(!a.ok)throw new Error(`Failed to fetch token balance: ${a.status}`);let i=await a.json();if(i.code!==200)throw new Error(`Token balance API error: ${i.code}`);return i.data}function Dt(e,t,n=!0){let o=Je[e],r=Ce[e],a=[r.cross,r.bsc],i=zl({queries:a.map(d=>({queryKey:[lr,e,t,d],queryFn:({signal:f})=>Dl(o,d,t,f),enabled:!!t&&n,staleTime:0,refetchInterval:n?5e3:!1}))}),s=i.some(d=>d.isLoading),c=i.some(d=>d.isError);return{tokens:Wl(()=>{let d=[];for(let f of i)f.data&&d.push(...f.data);return d},[i]),isLoading:s,isError:c}}import{useQuery as Hl,useQueries as Gl}from"@tanstack/react-query";import{useMemo as Ul}from"react";var $l="forge-holdings",jl="forge-token-image";async function Vl(e,t,n){let o=await fetch(`${e}/v1/users/${t}/holdings`,{cache:"no-store",signal:n});if(!o.ok)throw new Error(`Failed to fetch forge holdings: ${o.status}`);let r=await o.json();if(!r.success)throw new Error("Forge holdings API error");return r.data.items}async function ql(e,t,n){let o=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store",signal:n});if(!o.ok)return{address:t,image_url:""};let r=await o.json();return r.success?{address:t,image_url:r.data.token.image_url}:{address:t,image_url:""}}function qi(e,t,n=!0){let o=sr[e],{data:r,...a}=Hl({queryKey:[$l,e,t],queryFn:({signal:i})=>Vl(o,t,i),enabled:!!t&&n,staleTime:0,refetchInterval:n?5e3:!1});return{holdings:r??[],...a}}function Ki(e,t,n=!0){let o=sr[e],r=Gl({queries:t.map(i=>({queryKey:[jl,e,i],queryFn:({signal:s})=>ql(o,i,s),enabled:n,staleTime:1/0}))});return{imageMap:Ul(()=>{let i=new Map;for(let s of r)s.data&&i.set(s.data.address,s.data.image_url);return i},[r])}}import{useQuery as Kl}from"@tanstack/react-query";import{useMemo as Ql}from"react";var cr="token-stats";function ft(e,t){return`${e}:${t.toLowerCase()}`}function Ht(e,t=!0){let n=Je[e],{data:o,...r}=Kl({queryKey:[cr,e],queryFn:async({signal:i})=>{let s=await fetch(`${n}/v1/public/token/stats`,{cache:"no-store",signal:i});if(!s.ok)throw new Error(`Failed to fetch token stats: ${s.status}`);let c=await s.json();if(c.code!==200)throw new Error(`Token stats API error: ${c.code}`);return c},enabled:t,staleTime:3e4});return{statsMap:Ql(()=>{let i=new Map;if(!o?.data)return i;for(let s of o.data){let c=ft(s.chain_id,s.address);i.set(c,s)}return i},[o]),...r}}import{useQuery as Yl}from"@tanstack/react-query";import{useMemo as Zl}from"react";var Xl="token-info";function dr(e,t){return`${t.toLowerCase()}_${e}`}function Qi(e,t=!0){let n=Je[e],{data:o,...r}=Yl({queryKey:[Xl,e],queryFn:async({signal:i})=>{let s=await fetch(`${n}/v1/public/token/info`,{cache:"no-store",signal:i});if(!s.ok)throw new Error(`Failed to fetch token info: ${s.status}`);let c=await s.json();if(c.code!==200)throw new Error(`Token info API error: ${c.code}`);return c},enabled:t,staleTime:1/0});return{categoryMap:Zl(()=>{let i=new Map;if(!o?.data)return i;for(let s of o.data){let c=dr(s.chain_id,s.address);i.set(c,s.category)}return i},[o]),...r}}import{useMemo as Jl}from"react";import pr from"bignumber.js";function Yi(e,t,n){let{tokens:o,isLoading:r}=Dt(e,t,n),{statsMap:a}=Ht(e,n);return Jl(()=>{let i=new pr(0);for(let d of o){let f=a.get(ft(d.chainId,d.address));if(!f)continue;let m=new pr(d.quantity.numeric).shiftedBy(-d.quantity.decimals).multipliedBy(new pr(f.price));m.isNaN()||(i=i.plus(m))}let s=i.toFixed(),{displayValue:c,isLowerBound:l}=pi(s);return{totalUsd:s,displayValue:c,isLowerBound:l,isLoading:r}},[o,a,r])}import{QRCodeSVG as zd}from"qrcode.react";function qe(e,t,n,o){if(!o||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.defaultPrevented)return;e.preventDefault();let r;try{r=o(t,n)}catch(l){console.error("[dapp-ui] onOutlink threw:",l);return}let a=l=>{typeof window>"u"||window.open(l,"_blank","noopener,noreferrer")};if((l=>!!l&&(typeof l=="object"||typeof l=="function")&&typeof l.then=="function")(r)){let l=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null,d=f=>{if(f===null){l?.close();return}let h=f??t;if(l)try{l.location.href=h}catch{l.close(),a(h)}else a(h)};r.then(d,f=>{console.error("[dapp-ui] onOutlink rejected:",f),l?.close()});return}let s=r;if(s===null)return;a(s??t)}import*as rn from"react";import{Drawer as Yc}from"vaul";import{createContext as ec,useContext as tc}from"react";var En=ec(null);function tt(){let e=tc(En);if(!e)throw new Error("WalletPortfolio compound components must be used within <WalletPortfolio>");return e}import{Drawer as nc}from"vaul";import{jsx as Zi}from"react/jsx-runtime";function Xi({asChild:e,children:t}){let{walletAddress:n}=tt(),o=t!=null,r=e??!0,a=o?t:Zi("button",{type:"button",children:Ve(n)});return Zi(nc.Trigger,{asChild:r,children:a})}import{Drawer as ho}from"vaul";import*as gt from"react";import{useQueryClient as qc}from"@tanstack/react-query";import{jsx as on,jsxs as ta}from"react/jsx-runtime";function Ji({size:e=22,className:t}){return ta("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[on("path",{d:"M18.333 3.667v5.5h-5.5",stroke:"currentColor",strokeWidth:1.833,strokeLinecap:"round",strokeLinejoin:"round"}),on("path",{d:"M16.17 13.75a7.333 7.333 0 11-1.54-7.59L18.333 9.167",stroke:"currentColor",strokeWidth:1.833,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ea({size:e=24,className:t}){return on("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,"aria-hidden":"true",children:on("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function Bt({size:e=12,className:t}){return ta("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,"aria-hidden":"true",children:[on("path",{d:"M5 2H2.5A1.5 1.5 0 0 0 1 3.5V9.5A1.5 1.5 0 0 0 2.5 11H8.5A1.5 1.5 0 0 0 10 9.5V7",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"}),on("path",{d:"M7 1H11V5",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"}),on("path",{d:"M11 1L6 6",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"})]})}import{useQuery as oc}from"@tanstack/react-query";import{useMemo as sa}from"react";var po={dev:"https://stg-cross-game-reward-api.crosstoken.io/api",stage:"https://stg-cross-game-reward-api.crosstoken.io/api",production:"https://cross-game-reward-api.crosstoken.io/api"},na={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},fo={dev:"https://stg-bonding-curve-api.crosstoken.io/api",stage:"https://stg-bonding-curve-api.crosstoken.io/api",production:"https://bonding-curve-api.crosstoken.io/api"},oa={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},un={dev:"https://stg-posa-api.crosstoken.io/api/v1",stage:"https://stg-posa-api.crosstoken.io/api/v1",production:"https://posa-api.crosstoken.io/api/v1"},An={dev:"https://dev-stake.ogfcorp.com",stage:"https://stg-stake.ogfcorp.com",production:"https://stake.ogfcorp.com"},ra={dev:`${An.dev}/portfolio`,stage:`${An.stage}/portfolio`,production:`${An.production}/portfolio`},ia={dev:"https://stg-game-swap-api.cross.nexus/v1",stage:"https://stg-game-swap-api.cross.nexus/v1",production:"https://game-swap-api.cross.nexus/v1"},aa={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},Gt={dev:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",stage:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",production:"https://contents.crosstoken.io/frontend/common/app-launcher/icons"};var rc="wp:reward-pools";function uo(e,t=!0){let n=po[e],{data:o,...r}=oc({queryKey:[rc,e],queryFn:async({signal:s})=>{let c=await fetch(`${n}/v1/pools`,{cache:"no-store",signal:s});if(!c.ok)throw new Error(`Failed to fetch pools: ${c.status}`);let l=await c.json();if(l.code!==200)throw new Error(`Pools API error: ${l.code}`);return l},enabled:t,staleTime:0}),a=sa(()=>o?.data.pools.filter(s=>s.pool_type==="CrossPool")??[],[o]),i=sa(()=>o?.data.pools.filter(s=>s.pool_type==="GamePool")??[],[o]);return{crossPools:a,gamePools:i,allPools:o?.data.pools??[],...r}}import{useQuery as ic}from"@tanstack/react-query";import{useMemo as ac}from"react";var sc="wp:user-deposits";function la(e,t,n=!0){let o=po[e],r=n&&!!t,{data:a,...i}=ic({queryKey:[sc,e,t],queryFn:async({signal:c})=>{let l=await fetch(`${o}/v1/users/${t}/deposits`,{cache:"no-store",signal:c});if(!l.ok)throw new Error(`Deposits fetch failed: ${l.status}`);let d=await l.json();if(d.code!==200)throw new Error(`Deposits API error: ${d.code}`);return d},enabled:r,staleTime:0});return{depositMap:ac(()=>{let c=new Map;if(!a?.data.user_deposits)return c;for(let l of a.data.user_deposits)c.set(l.pool_address.toLowerCase(),l);return c},[a]),deposits:a?.data.user_deposits??[],...i}}import{useQuery as lc}from"@tanstack/react-query";import{useMemo as cc}from"react";var dc="wp:token-info";function ca(e,t=!0){let n=Je[e],o=Ce[e].cross,{data:r,...a}=lc({queryKey:[dc,e],queryFn:async({signal:l})=>{let d=await fetch(`${n}/v1/public/token/info`,{cache:"no-store",signal:l});if(!d.ok)throw new Error(`Failed to fetch token info: ${d.status}`);let f=await d.json();if(f.code!==200)throw new Error(`Token info API error: ${f.code}`);return f},enabled:t,staleTime:300*1e3}),{byChainAddr:i,byChainSym:s}=cc(()=>{let l=new Map,d=new Map;if(!r?.data)return{byChainAddr:l,byChainSym:d};for(let f of r.data){let h=f.address.toLowerCase();l.set(`${f.chain_id}:${h}`,f),l.set(h,f);let m=f.symbol.replace(/^t/,"").toUpperCase(),y=`${f.chain_id}:${m}`;d.has(y)||d.set(y,f),d.has(m)||d.set(m,f)}return{byChainAddr:l,byChainSym:d}},[r]);return{getTokenImage:(l,d)=>{let f=l.toLowerCase(),h=i.get(`${o}:${f}`);if(h?.image)return h.image;let m=i.get(f);if(m?.image)return m.image;if(d){let y=d.replace(/^t/,"").toUpperCase(),x=s.get(`${o}:${y}`);if(x?.image)return x.image;let w=s.get(y);if(w?.image)return w.image}return""},...a}}import mn from"bignumber.js";var pc=/^(\d{4}-\d{2}-\d{2})/;function da(e){if(!e||e.length===0)return;let t=new Map,n;for(let{key:r,cumulative:a}of e.map(i=>({key:pc.exec(i.reference_date)?.[1],cumulative:i.cumulative_earned})).filter(i=>!!i.key&&i.cumulative!=null).sort((i,s)=>i.key<s.key?-1:i.key>s.key?1:0))t.set(r,a),n=r;if(n===void 0)return;let o=new Date().toISOString().slice(0,10);return t.get(o)??t.get(n)}function gn(e,t){let n=new mn(e).shiftedBy(-t);return!n.isFinite()||n.isZero()?"0":n.isGreaterThanOrEqualTo(1)?n.toFormat(2,mn.ROUND_DOWN):n.toFormat(4,mn.ROUND_DOWN)}function fr(e){return gn(e,0)}function hn(e,t,n){let o=new mn(n||"0");if(!o.isFinite()||o.isLessThanOrEqualTo(0))return null;let r=new mn(e||"0").shiftedBy(-t).times(o);return r.isFinite()?`$${r.toFormat(2,mn.ROUND_DOWN)}`:null}import{jsx as mo,jsxs as pa}from"react/jsx-runtime";function Ut({title:e,icon:t,iconFit:n="cover",isEmpty:o,children:r}){return pa("div",{className:"wp-svc-card",children:[pa("div",{className:"wp-svc-card-head",children:[mo("img",{className:"wp-svc-card-icon",src:t,alt:"",style:{objectFit:n}}),mo("span",{className:"wp-svc-card-title",children:e})]}),o?mo("div",{className:"wp-svc-empty",children:"No assets yet"}):mo("div",{className:"wp-svc-items",children:r})]})}import ur from"bignumber.js";import{jsx as Re,jsxs as Fe}from"react/jsx-runtime";var fc="CROSS Rewards";function uc(e){return new ur(e||"0").isGreaterThan(0)}function fa(){let{env:e,walletAddress:t,onOutlink:n}=tt(),o=!!t,{allPools:r}=uo(e,o),{depositMap:a}=la(e,t,o),{getTokenImage:i}=ca(e,o),s=(d,f)=>`${na[e]}/rewards/${d.pool_address}?action=${f}`,c=`${Gt[e]}/reward.png`,l=r.filter(d=>{let f=a.get(d.pool_address.toLowerCase()),h=f?.deposited_amount??"0",m=f?.claimable_reward??"0";return!(new ur(h).isZero()&&new ur(m).isZero())});return Re(Ut,{title:fc,icon:c,isEmpty:l.length===0,children:l.map(d=>{let f=a.get(d.pool_address.toLowerCase()),h=f?.deposited_amount??"0",m=f?.claimable_reward??"0",y=s(d,"withdraw"),x=s(d,"claim"),w=i(d.deposit_token.address,d.deposit_token.symbol),v=d.reward_tokens[0],B=v?i(v.address,v.symbol):"",u=d.reward_tokens.map(G=>G.symbol),E=u.length>0?`${d.deposit_token.symbol}-${u.join("/")}`:d.deposit_token.symbol,C=v?gn(m,v.decimals):"0",A=v?.symbol??"Reward",M=hn(h,d.deposit_token.decimals,d.deposit_token.price),Z=v?hn(m,v.decimals,v.price):null,W=!!f&&uc(m);return Fe("article",{className:"wp-item","data-side":"reward",children:[Fe("div",{className:"wp-item-body",children:[Fe("div",{className:"wp-item-line",children:[Re("span",{className:"wp-item-label",children:"Pool (Deposit - Earn)"}),Fe("div",{className:"wp-svc-token",children:[Fe("span",{className:"wp-token-stack","aria-hidden":!0,children:[w&&Re("img",{className:"wp-svc-token-icon",src:w,alt:""}),B&&Re("img",{className:"wp-svc-token-icon",src:B,alt:""})]}),Re("span",{children:E})]})]}),Fe("div",{className:"wp-item-line",children:[Re("span",{className:"wp-item-label",children:"Deposited"}),Fe("div",{className:"wp-svc-token",children:[w&&Re("img",{className:"wp-svc-token-icon",src:w,alt:""}),Fe("div",{className:"wp-svc-amount",children:[Re("span",{className:"wp-svc-amount-main",children:gn(h,d.deposit_token.decimals)}),M&&Re("span",{className:"wp-item-usd",children:M})]})]})]}),Fe("div",{className:"wp-item-line",children:[Fe("span",{className:"wp-item-label",children:["Claimable (",A,")"]}),Fe("div",{className:"wp-svc-token",children:[B&&Re("img",{className:"wp-svc-token-icon",src:B,alt:""}),Fe("div",{className:"wp-svc-amount",children:[Re("span",{className:"wp-svc-amount-main",children:C}),Z&&Re("span",{className:"wp-item-usd",children:Z})]})]})]})]}),Fe("div",{className:"wp-item-tags",children:[Fe("a",{className:"wp-tag wp-tag--muted",href:y,target:"_blank",rel:"noopener noreferrer",onClick:G=>qe(G,y,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:d,userDeposit:f}},n),children:[Re("span",{className:"wp-tag-label",children:"Withdraw"}),Re(Bt,{size:12,className:"wp-tag-icon"})]}),Fe("a",{className:"wp-tag wp-tag--mint","data-disabled":!W||void 0,"aria-disabled":!W||void 0,href:W?x:void 0,target:W?"_blank":void 0,rel:W?"noopener noreferrer":void 0,onClick:G=>{if(!W){G.preventDefault();return}qe(G,x,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:d,userDeposit:f}},n)},children:[Re("span",{className:"wp-tag-label",children:"Claim"}),Re(Bt,{size:12,className:"wp-tag-icon"})]})]})]},d.pool_address)})})}import*as mr from"react";import{useQuery as mc}from"@tanstack/react-query";var gc="wp:stake-info";function ua(e,t,n=!0){let o=un[e],r=n&&!!t,{data:a,...i}=mc({queryKey:[gc,e,t],queryFn:async({signal:c})=>{let l=await fetch(`${o}/stake/${t}`,{cache:"no-store",signal:c});if(!l.ok)throw new Error(`Stake info fetch failed: ${l.status}`);let d=await l.json();if(d.code!==0&&d.code!==200)throw new Error(`Stake info API error: ${d.code}`);return d},enabled:r,staleTime:0});return{stakeInfo:a?.data,...i}}import{useQuery as hc}from"@tanstack/react-query";var bc="wp:stake-rewards",wc=31;function ma(e,t,n=!0){let o=un[e],r=n&&!!t,{data:a,...i}=hc({queryKey:[bc,e,t],queryFn:async({signal:s})=>{let c=await fetch(`${o}/rewards/${t}?limit=${wc}`,{cache:"no-store",signal:s});if(!c.ok)throw new Error(`Stake rewards fetch failed: ${c.status}`);let l=await c.json();if(l.code!==0&&l.code!==200)throw new Error(`Stake rewards API error: ${l.code}`);return l.data?.data??[]},enabled:r,staleTime:0});return{latestReward:a?.[0]??null,aprAccrued:da(a),...i}}import{useQuery as xc}from"@tanstack/react-query";var vc="wp:network-stats";function ga(e,t=!0){let n=un[e],{data:o,...r}=xc({queryKey:[vc,e],queryFn:async({signal:i})=>{let s=await fetch(`${n}/network/stats`,{cache:"no-store",signal:i});if(!s.ok)throw new Error(`Network stats fetch failed: ${s.status}`);let c=await s.json();if(c.code!==0&&c.code!==200)throw new Error(`Network stats API error: ${c.code}`);return c},enabled:t,staleTime:0});return{networkStats:o?.data,...r}}import{useQuery as yc}from"@tanstack/react-query";var kc="wp:staking-onchain";function ha(e,t,n=!0){let o=n&&!!t&&!!e,{data:r,...a}=yc({queryKey:[kc,e],queryFn:async()=>{if(!t)throw new Error("stakingRewardsReader not provided");return t(e)},enabled:o,staleTime:0});return{onchain:r,...a}}import{useMemo as ba}from"react";import Sc from"bignumber.js";function wa(e){return e?.trim().toUpperCase()==="CROSS"}function xa(e){return new Sc(e||"0").isGreaterThan(0)}function go(e,t,n=!0){let{allPools:o}=uo(e,n),r=ba(()=>{for(let l of o)for(let d of[l.deposit_token,...l.reward_tokens])if(wa(d?.symbol)&&xa(d.price))return d.price},[o]),a=n&&r===void 0,{tokens:i}=Dt(e,t,a),{statsMap:s}=Ht(e,a),c=Ce[e].cross;return ba(()=>{if(r)return r;let l=i.find(d=>d.chainId===c&&wa(d.symbol));if(l){let d=s.get(ft(l.chainId,l.address));if(d&&xa(d.price))return d.price}return"0"},[r,i,s,c])}import $t from"bignumber.js";import{Fragment as Rc,jsx as Ke,jsxs as ut}from"react/jsx-runtime";var Cc="CROSS Staking";function va(e){if(!e)return"\u2014";let t=new $t(e);return t.isFinite()?`${t.toFormat(2,$t.ROUND_DOWN)}%`:"\u2014"}function ya(){let{env:e,walletAddress:t,onOutlink:n,stakingRewardsReader:o}=tt(),r=!!t,{stakeInfo:a}=ua(e,t,r),{latestReward:i,aprAccrued:s}=ma(e,t,r),{networkStats:c}=ga(e,r),{onchain:l}=ha(t,o,r),d=go(e,t,r),f=`${Gt[e]}/cross-staking.png`,h=ra[e],m=a?.total_stake??"0",y=mr.useMemo(()=>l?new $t(l.earnedWei.toString()).shiftedBy(-18).toString(10):i?.cumulative_earned??a?.rewards_earned??"0",[l,i,a]),x=mr.useMemo(()=>l?new $t(l.stakedWei.toString()).shiftedBy(-18):new $t(m),[l,m]),w=s!==void 0?new $t(s):void 0,v=a?.days_since_first_stake,B=w!==void 0&&w.isFinite()&&x.isGreaterThan(0)&&v!==null&&v!==void 0?w.div(x).times(365).div(Math.max(1,v)).times(100):void 0,u=!(new $t(m).isZero()&&new $t(y).isZero()),E=An[e],C=hn(m,0,d),A=hn(y,0,d);return Ke(Ut,{title:Cc,icon:f,iconFit:"contain",isEmpty:!1,children:ut("article",{className:"wp-item","data-side":"stake",children:[Ke("div",{className:"wp-item-body",children:u?ut(Rc,{children:[ut("div",{className:"wp-item-line",children:[Ke("span",{className:"wp-item-label",children:"Staked"}),ut("div",{className:"wp-svc-amount",children:[ut("span",{className:"wp-svc-amount-main",children:[fr(m)," CROSS"]}),C&&Ke("span",{className:"wp-item-usd",children:C})]})]}),ut("div",{className:"wp-item-line",children:[Ke("span",{className:"wp-item-label",children:"Rewards Earned"}),ut("div",{className:"wp-svc-amount",children:[ut("span",{className:"wp-svc-amount-main",children:[fr(y)," CROSS"]}),A&&Ke("span",{className:"wp-item-usd",children:A})]})]}),ut("div",{className:"wp-item-line",children:[Ke("span",{className:"wp-item-label",children:"My APR"}),Ke("span",{children:va(B?.toString(10))})]})]}):ut("div",{className:"wp-item-line",children:[Ke("span",{className:"wp-item-label",children:"Delegation APR"}),Ke("span",{children:va(c?.apr)})]})}),Ke("div",{className:"wp-item-tags",children:ut("a",{className:"wp-tag wp-tag--mint",href:u?h:E,target:"_blank",rel:"noopener noreferrer",onClick:M=>qe(M,u?h:E,{category:"portfolio",origin:"portfolio-stake",payload:{stakeInfo:a,networkStats:c}},n),children:[Ke("span",{className:"wp-tag-label",children:u?"Manage":"Stake Now"}),Ke(Bt,{size:12,className:"wp-tag-icon"})]})})]})})}import*as gr from"react";import{useQuery as Nc}from"@tanstack/react-query";var Tc="wp:game-swap-pools";function ka(e,t,n=!0){let o=ia[e],r=n&&!!t,{data:a,...i}=Nc({queryKey:[Tc,e,t],queryFn:async({signal:s})=>{let c=await fetch(`${o}/addresses/${t}/portfolio`,{cache:"no-store",signal:s});if(!c.ok)throw new Error(`Game-swap portfolio fetch failed: ${c.status}`);return(await c.json()).pools??[]},enabled:r,staleTime:0});return{pools:a??[],...i}}import{useQuery as Ic}from"@tanstack/react-query";var Lc="wp:game-swap-lp-balances";function Sa(e,t,n,o){let r=[...n].map(c=>c.toLowerCase()).sort(),a=!!o&&!!t&&r.length>0,{data:i,...s}=Ic({queryKey:[Lc,e,t,r],queryFn:async()=>{if(!o)return{};let c=await o(r),l={};for(let[d,f]of Object.entries(c))l[d.toLowerCase()]=f;return l},enabled:a,staleTime:0});return{balances:i??{},...s}}import Nt from"bignumber.js";import{jsx as nt,jsxs as mt}from"react/jsx-runtime";var Ec="Game Swap LP",Ra=18,Ac=new Nt("0.0001");function Ca(e){return e?.trim().toUpperCase()==="CROSS"}function Pc(e){return e&&e>0?e:Ra}function Bc(e){let t=Ca(e.token_a?.symbol)&&!Ca(e.token_b?.symbol),n=t?e.reserve_a:e.reserve_b,o=Pc(t?e.token_a?.decimals:e.token_b?.decimals),r=new Nt(n||"0").shiftedBy(-o);return!r.isFinite()||r.isLessThanOrEqualTo(0)?new Nt(0):r.times(2)}function Fc(e,t){let n=e.token_a?.symbol?.trim()||"TOKEN",o=e.token_b?.symbol?.trim()||"CROSS",r=t?.decimals??Ra,a,i;if(t&&t.totalSupply&&t.totalSupply>BigInt(0)){let s=new Nt(t.balance.toString()),c=new Nt(t.totalSupply.toString()),l=s.div(c);a=l.times(100);let d=l.times(Bc(e));if(d.isGreaterThan(0)){let f=new Nt(e.cross_usd||"0");i=f.isGreaterThan(0)?`$${d.times(f).toFormat(2,Nt.ROUND_DOWN)}`:`${d.toFormat(4,Nt.ROUND_DOWN)} CROSS`}}return{pool:e,tokenASymbol:n,tokenBSymbol:o,info:t,lpAmountRaw:t?.balance.toString(),lpDecimals:r,sharePercent:a,valueText:i}}function Na(){let{env:e,walletAddress:t,onOutlink:n,lpBalanceReader:o}=tt(),r=!!t,{pools:a}=ka(e,t,r),i=gr.useMemo(()=>a.map(h=>h.pair_address).filter(Boolean),[a]),{balances:s}=Sa(e,t,i,o),c=`${Gt[e]}/dex.png`,l=!!o,d=gr.useMemo(()=>{let h=a.map(m=>Fc(m,s[m.pair_address?.toLowerCase()]));return l?h.filter(m=>m.lpAmountRaw?new Nt(m.lpAmountRaw).shiftedBy(-m.lpDecimals).isGreaterThanOrEqualTo(Ac):!1):h},[a,s,l]),f=h=>{let m=h.token_a?.address??h.pair_address;return`${aa[e]}/tokens/${m}?trade=deposit`};return nt(Ut,{title:Ec,icon:c,iconFit:"contain",isEmpty:d.length===0,children:d.map(h=>{let{pool:m}=h,y=f(m),x=`${h.tokenASymbol} / ${h.tokenBSymbol}`,w=m.token_a?.logo_url,v=m.token_b?.logo_url;return mt("article",{className:"wp-item","data-side":"game-swap",children:[mt("div",{className:"wp-item-body",children:[mt("div",{className:"wp-item-line",children:[nt("span",{className:"wp-item-label",children:"Pool"}),mt("div",{className:"wp-svc-token",children:[mt("span",{className:"wp-token-stack","aria-hidden":!0,children:[w&&nt("img",{className:"wp-svc-token-icon",src:w,alt:""}),v&&nt("img",{className:"wp-svc-token-icon",src:v,alt:""})]}),nt("span",{children:x})]})]}),h.lpAmountRaw!==void 0&&mt("div",{className:"wp-item-line",children:[nt("span",{className:"wp-item-label",children:"My LP"}),mt("span",{children:[gn(h.lpAmountRaw,h.lpDecimals)," LP"]})]}),h.sharePercent!==void 0&&mt("div",{className:"wp-item-line",children:[nt("span",{className:"wp-item-label",children:"Pool Share"}),mt("span",{children:[h.sharePercent.toFormat(2,Nt.ROUND_DOWN),"%"]})]}),h.valueText!==void 0&&mt("div",{className:"wp-item-line",children:[nt("span",{className:"wp-item-label",children:"Value"}),nt("span",{children:h.valueText})]})]}),nt("div",{className:"wp-item-tags",children:mt("a",{className:"wp-tag wp-tag--mint",href:y,target:"_blank",rel:"noopener noreferrer",onClick:B=>qe(B,y,{category:"portfolio",origin:"portfolio-game-swap",payload:{pool:m}},n),children:[nt("span",{className:"wp-tag-label",children:"Manage"}),nt(Bt,{size:12,className:"wp-tag-icon"})]})})]},m.pair_address)})})}import Vt from"bignumber.js";import{useMemo as Hc}from"react";import{useQuery as Mc}from"@tanstack/react-query";var _c="wp:forge-pools";function Ta(e,t,n=!0){let o=fo[e],r=n&&!!t,{data:a,...i}=Mc({queryKey:[_c,e,t],queryFn:async()=>{let c=await fetch(`${o}/v1/users/${t}/pools`,{cache:"no-store"});if(!c.ok)throw new Error(`forge pools fetch failed: ${c.status}`);return(await c.json()).data?.items??[]},enabled:r,staleTime:0}),s=a??[];return{pools:s,isEmpty:s.length===0,...i}}import{useQueries as Oc}from"@tanstack/react-query";import{useMemo as zc}from"react";var Wc="wp:forge-token-detail";async function Dc(e,t){let n=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store"});return n.ok?(await n.json())?.data?.token??null:null}function Ia(e,t,n=!0){let o=fo[e],r=Oc({queries:t.map(s=>({queryKey:[Wc,e,s],queryFn:()=>Dc(o,s),enabled:n&&!!s,staleTime:3e4}))}),a=zc(()=>{let s=new Map;for(let c=0;c<r.length;c++){let l=r[c]?.data,d=t[c];l&&d&&s.set(d.toLowerCase(),l)}return s},[r,t]),i=r.some(s=>s.isLoading);return{detailMap:a,isLoading:i}}import{jsx as We,jsxs as jt}from"react/jsx-runtime";var Gc="Forge",La=18,Uc="https://contents.crosstoken.io/wallet/token/images/FT.png";function $c(e){if(!e||e==="0")return"0";let t=new Vt(e).shiftedBy(-La);return t.isZero()?"0":t.isGreaterThanOrEqualTo(1)?t.toFormat(2,Vt.ROUND_DOWN):t.toFormat(4,Vt.ROUND_DOWN)}function jc(e){let t=Number(e);return!Number.isFinite(t)||t<=0?"0%":t>=1?`${(Math.floor(t*100)/100).toFixed(2)}%`:`${(Math.floor(t*1e4)/1e4).toFixed(4)}%`}function Vc(e,t,n){let o=new Vt(n||"0");if(!o.isGreaterThan(0))return null;let r=new Vt(e.total_supply||"0"),a=new Vt(e.lp_balance||"0"),i=new Vt(t?.reserve_b||"0").shiftedBy(-La);if(!r.isGreaterThan(0)||!a.isGreaterThan(0)||!i.isGreaterThan(0))return null;let s=i.times(2),l=a.div(r).times(s).times(o);return l.isFinite()?`$${l.toFormat(2,Vt.ROUND_DOWN)}`:null}function Ea(){let{env:e,walletAddress:t,onOutlink:n}=tt(),o=!!t,{pools:r,isEmpty:a}=Ta(e,t,o),i=Hc(()=>r.map(f=>f.token.address),[r]),{detailMap:s}=Ia(e,i,o&&i.length>0),c=go(e,t,o),l=f=>`${oa[e]}/forge/token/${f.token.address}`,d=`${Gt[e]}/forge.png`;return We(Ut,{title:Gc,icon:d,iconFit:"contain",isEmpty:a,children:r.map(f=>{let h=s.get(f.token.address.toLowerCase()),m=h?.image_url||h?.image||f.token.image||Uc,y=h?.symbol||f.token.symbol,x=l(f),w=Vc(f,h,c);return jt("a",{className:"wp-item","data-side":"lp",href:x,target:"_blank",rel:"noopener noreferrer",onClick:v=>qe(v,x,{category:"portfolio",origin:"portfolio-forge",payload:{pool:f,tokenDetail:h}},n),children:[jt("div",{className:"wp-item-body",children:[jt("div",{className:"wp-item-line",children:[We("span",{className:"wp-item-label",children:"Asset"}),jt("div",{className:"wp-svc-token",children:[We("img",{className:"wp-svc-token-icon",src:m,alt:""}),We("span",{children:y}),h?.name&&We("span",{className:"wp-token-subtle",children:h.name})]})]}),jt("div",{className:"wp-item-line",children:[We("span",{className:"wp-item-label",children:"LP Balance"}),We("div",{className:"wp-svc-token",children:jt("div",{className:"wp-svc-amount",children:[We("span",{className:"wp-svc-amount-main",children:$c(f.lp_balance)}),w&&We("span",{className:"wp-item-usd",children:w})]})})]}),jt("div",{className:"wp-item-line",children:[We("span",{className:"wp-item-label",children:"Ownership"}),We("span",{className:"wp-line-value",children:jc(f.pool_ownership)})]})]}),We("div",{className:"wp-item-tags",children:jt("span",{className:"wp-tag wp-tag--muted",children:[We("span",{className:"wp-tag-label",children:"Withdraw"}),We(Bt,{size:12,className:"wp-tag-icon"})]})})]},f.pair_address)})})}_(`.wp-fullscreen[data-theme=dark],.wp-embed[data-theme=dark]{--wp-bg: var(--ds-bg-default, #202530);--wp-header-bg: var(--ds-surface-default, #252b39);--wp-card: var(--ds-surface-medium, #252b39);--wp-control: #292f40;--wp-border: var(--ds-border-default, #292f40);--wp-panel-border: var(--ds-border-medium, rgba(255, 255, 255, .18));--wp-panel-shadow: 0px 4px 30px -1px rgba(0, 0, 0, .28);--wp-text: var(--ds-content-highest, #ffffff);--wp-text-60: var(--ds-content-high, rgba(255, 255, 255, .85));--wp-text-40: var(--ds-content-medium, rgba(255, 255, 255, .65));--wp-text-30: var(--ds-content-low, rgba(255, 255, 255, .4));--wp-chrome-text: #ffffff;--wp-tooltip-bg: #151a23;--wp-tooltip-text: #ffffff;--wp-mint: var(--ds-accent-primary-default, #00a0a2);--wp-green: var(--ds-accent-primary-default, #00a0a2);--wp-accent-soft: var(--ds-accent-primary-low, rgba(0, 160, 162, .14));--wp-red: var(--ds-system-red-default, #e70077);--wp-blue: #0488fc;--wp-purple: #7346f3;--wp-orange: #ff9d00;--wp-claim-primary: #9b8cef;--wp-claim-primary-text: #202530;--wp-claim-secondary-bg: var(--wp-control);--wp-claim-success: #00d4aa;--wp-claim-success-soft: rgba(0, 212, 170, .18);--wp-claim-error: #ff3aa3;--wp-claim-error-soft: rgba(255, 58, 163, .16)}.wp-fullscreen[data-theme=light],.wp-embed[data-theme=light]{--wp-bg: var(--ds-bg-dim, #f5f7fa);--wp-header-bg: var(--ds-surface-default, #ffffff);--wp-card: var(--ds-surface-default, #ffffff);--wp-control: var(--ds-surface-medium, #f5f7fa);--wp-border: var(--ds-border-default, rgba(0, 0, 0, .07));--wp-panel-border: var(--ds-border-medium, rgba(0, 0, 0, .18));--wp-panel-shadow: 0px 4px 30px -1px rgba(0, 0, 0, .15);--wp-text: var(--ds-content-highest, #000000);--wp-text-60: var(--ds-content-high, rgba(0, 0, 0, .85));--wp-text-40: var(--ds-content-medium, rgba(0, 0, 0, .65));--wp-text-30: var(--ds-content-low, rgba(0, 0, 0, .4));--wp-chrome-text: var(--ds-content-high, rgba(0, 0, 0, .85));--wp-card-shadow: none;--wp-tooltip-bg: #192023;--wp-tooltip-text: #ffffff;--wp-mint: var(--ds-accent-primary-default, #00a0a2);--wp-green: var(--ds-accent-primary-default, #00a0a2);--wp-accent-soft: var(--ds-accent-primary-low, #e7f9f8);--wp-red: var(--ds-system-red-default, #e70077);--wp-blue: #0488fc;--wp-purple: #7346f3;--wp-orange: #ff9d00;--wp-claim-primary: #7346f3;--wp-claim-primary-text: #ffffff;--wp-claim-secondary-bg: #ffffff;--wp-claim-success: #019d92;--wp-claim-success-soft: rgba(1, 157, 146, .15);--wp-claim-error: #e70077;--wp-claim-error-soft: rgba(231, 0, 119, .12)}.wp-fullscreen{position:fixed!important;top:12px!important;left:max(12px,calc((100vw - 393px)/2))!important;right:max(12px,calc((100vw - 393px)/2))!important;bottom:12px!important;width:auto!important;height:calc(100dvh - 24px)!important;max-height:calc(100dvh - 24px)!important;z-index:50;background:var(--wp-bg);border:1px solid var(--wp-panel-border);border-radius:24px;box-shadow:var(--wp-panel-shadow);display:flex;flex-direction:column;overflow:hidden;font-family:inherit;font-feature-settings:"calt" 0,"lnum" 1,"pnum" 1;box-sizing:border-box;-webkit-font-smoothing:antialiased;color:var(--wp-chrome-text)}.wp-embed{width:100%;height:100%;min-height:0;background:var(--wp-bg);display:flex;flex-direction:column;overflow:hidden;position:relative;font-family:inherit;font-feature-settings:"calt" 0,"lnum" 1,"pnum" 1;box-sizing:border-box;-webkit-font-smoothing:antialiased;color:var(--wp-chrome-text)}.wp-overlay{position:fixed;inset:0;z-index:49;background:#0009}.wp-header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;min-height:73px;padding:24px;position:relative;border-bottom:1px solid var(--wp-border);background:var(--wp-header-bg);color:var(--wp-chrome-text);flex-shrink:0;box-sizing:border-box}.wp-header-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--ds-content-low, rgba(0, 0, 0, .4));flex-shrink:0;transition:color .15s ease}.wp-header-btn:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wp-header-edge{display:flex;align-items:center;width:24px;min-width:24px}.wp-header-edge--right{justify-content:flex-end}.wp-header-edge--right .wp-header-btn{position:absolute;top:24px;right:24px}.wp-header-spacer{display:block;width:24px;height:24px}.wp-header-avatar{width:38px;height:38px;flex-shrink:0;border-radius:50%;overflow:hidden;display:inline-flex;align-items:center;justify-content:center;background:var(--wp-header-avatar-bg)}.wp-header-avatar-img{width:30px;height:30px;object-fit:cover;display:block}.wp-fullscreen[data-theme=dark] .wp-header-avatar,.wp-embed[data-theme=dark] .wp-header-avatar{--wp-header-avatar-bg: hsl(221.3 24.6% 25.5%)}.wp-fullscreen[data-theme=light] .wp-header-avatar,.wp-embed[data-theme=light] .wp-header-avatar{--wp-header-avatar-bg: rgba(18, 18, 18, .1)}.wp-refresh-btn{position:relative}.wp-refresh-badge{position:absolute;top:-6px;right:-8px;min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:var(--wp-mint);color:#fff;font-size:10px;font-weight:600;line-height:16px;text-align:center}.wp-spin-once{animation:wp-spin-once .6s ease-in-out}@keyframes wp-spin-once{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.wp-header-title{flex:1;font-family:inherit;font-size:18px;font-weight:600;line-height:1.5;letter-spacing:-.01em;text-align:center;color:var(--ds-content-highest, #000000);margin:0}.wp-header-account{flex:1;display:flex;align-items:center;gap:12px;min-width:0}.wp-header-wallet-name{flex:1;min-width:0;font-family:inherit;font-size:15px;font-weight:600;line-height:160%;letter-spacing:0;color:var(--wp-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-top{flex-shrink:0;padding:0 16px 16px;display:flex;flex-direction:column;gap:16px}.wp-identity{display:flex;flex-direction:column;gap:8px}.wp-address{display:inline-flex;align-items:center;gap:8px}.wp-address-label{font-size:12px;font-weight:400;line-height:1.4;color:var(--wp-text-40)}.wp-address-chevron{display:inline-flex;align-items:center;color:var(--wp-text-40)}.wp-total{font-size:28px;font-weight:600;line-height:1.3;color:var(--wp-text);margin:0}.wp-asset{display:flex;flex-direction:column;gap:8px}.wp-asset-head{display:flex;align-items:center;gap:4px}.wp-asset-head-label{font-size:12px;font-weight:400;line-height:1.4;color:var(--wp-text-40)}.wp-asset-head-icon{display:inline-flex;color:var(--wp-text-40)}.wp-bar{display:flex;height:20px;border-radius:4px;overflow:hidden}.wp-bar-seg{display:flex;align-items:center;justify-content:center;min-width:8px}.wp-bar-seg-pct{font-size:10px;font-weight:400;line-height:1.3;color:#fff;white-space:nowrap}.wp-legend{display:flex;align-items:center;justify-content:center;gap:16px;flex-wrap:wrap}.wp-legend-item{display:flex;align-items:center;gap:4px}.wp-legend-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.wp-legend-label{font-size:12px;font-weight:400;line-height:1.4;color:var(--wp-text-40)}.wp-tabs{flex-shrink:0;padding:8px 16px}.wp-tabs-inner{display:flex;align-items:center;padding:0 2px}.wp-tabs-list{display:flex;gap:20px;flex:1}.wp-tab{display:flex;flex-direction:column;align-items:center;justify-content:space-between;height:44px;padding-top:12px;background:transparent;border:none;cursor:pointer}.wp-tab-text{font-size:14px;font-weight:600;line-height:1.4;color:var(--wp-text-30);white-space:nowrap}.wp-tab[data-active=true] .wp-tab-text{color:var(--wp-mint)}.wp-tab-bar{width:20px;height:4px;border-radius:2px;background:var(--wp-mint);opacity:0}.wp-tab[data-active=true] .wp-tab-bar{opacity:1}.wp-tabs-filter-wrap{position:relative;display:flex;align-items:center;width:44px;height:44px;flex-shrink:0}.wp-tabs-filter-grad{position:absolute;inset:0;background:linear-gradient(to left,var(--wp-bg) 74%,transparent);pointer-events:none}.wp-tabs-filter{position:relative;display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--wp-text-40)}.wp-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--wp-border) transparent}.wp-body::-webkit-scrollbar{width:4px}.wp-body::-webkit-scrollbar-track{background:transparent}.wp-body::-webkit-scrollbar-thumb{background:var(--wp-border);border-radius:4px}.wp-body-inner{padding:16px 16px 32px;display:flex;flex-direction:column;gap:32px}.wp-summary-card{display:flex;flex-direction:column;gap:8px;width:100%;padding:0;border-radius:0;background:transparent;box-shadow:none;box-sizing:border-box}.wp-summary-head{position:relative;display:flex;align-items:center;justify-content:flex-start;gap:4px}.wp-summary-label{font-size:14px;font-weight:400;line-height:1.5;letter-spacing:0;color:var(--wp-text-40);white-space:nowrap}.wp-address{display:inline-flex;align-items:center;gap:8px;min-width:0}.wp-address-avatar{width:16px;height:16px;border-radius:50%;flex-shrink:0;background:radial-gradient(circle at 68% 34%,#ff78d1 0 18%,transparent 19%),radial-gradient(circle at 34% 66%,#00d4aa 0 20%,transparent 21%),linear-gradient(135deg,#7346f3,#0488fc)}.wp-address-label{font-size:12px;font-weight:400;line-height:1.4;letter-spacing:0;color:var(--wp-text-40);white-space:nowrap}.wp-address-chevron{display:inline-flex;align-items:center;color:var(--wp-text-40);flex-shrink:0}.wp-summary-badge{display:inline-flex;align-items:center;justify-content:center;padding:4px 8px;border-radius:999px;background:#019d921a;color:var(--wp-mint);font-size:12px;font-weight:400;line-height:1.4;letter-spacing:0;white-space:nowrap}.wp-summary-estimate{position:relative;display:inline-flex;align-items:center;gap:6px;flex-shrink:0}.wp-estimate-info{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--wp-text-40);cursor:help}.wp-estimate-tooltip{position:absolute;top:calc(100% + 8px);left:0;right:auto;z-index:3;display:flex;flex-direction:column;gap:8px;width:min(280px,calc(100vw - 48px));padding:12px;border-radius:8px;background:var(--wp-tooltip-bg);box-shadow:0 12px 32px #0000003d;color:var(--wp-tooltip-text);font-size:12px;font-weight:400;line-height:1.4;letter-spacing:0;text-align:left;white-space:normal;opacity:0;pointer-events:none;transform:translateY(-4px);visibility:hidden;transition:opacity .15s ease,transform .15s ease,visibility .15s ease}.wp-estimate-tooltip-title{display:block;font-size:12px;font-weight:600;line-height:1.3}.wp-estimate-tooltip-group{display:flex;flex-direction:column;gap:4px}.wp-estimate-tooltip-item{display:block;color:#ffffffc7}.wp-estimate-tooltip-item:before{content:"- "}.wp-estimate-info:hover .wp-estimate-tooltip,.wp-estimate-info:focus .wp-estimate-tooltip,.wp-estimate-info:focus-visible .wp-estimate-tooltip{opacity:1;transform:translateY(0);visibility:visible}.wp-total{font-family:var( --wp-total-font-family, Sora, Inter, system-ui, -apple-system, sans-serif );font-size:36px;font-weight:600;line-height:1.25;letter-spacing:0;color:var(--wp-text);margin:0}.wp-svc-card{display:flex;flex-direction:column;gap:12px;width:100%}.wp-svc-card-head{display:flex;align-items:center;gap:6px}.wp-svc-card-icon{width:24px;height:24px;border-radius:4px;flex-shrink:0;object-fit:cover}.wp-svc-card-title{font-size:16px;font-weight:600;line-height:1.5;letter-spacing:0;color:var(--wp-text-60);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wp-svc-items{display:flex;flex-direction:column;gap:8px;width:100%;padding:0;border-radius:0;background:transparent;box-shadow:none;box-sizing:border-box}.wp-item{position:relative;display:flex;flex-direction:column;gap:20px;width:100%;padding:12px;border-radius:12px;background:var(--wp-card);box-shadow:var(--wp-card-shadow, none);box-sizing:border-box;color:inherit;text-decoration:none;cursor:pointer;outline:none;transition:opacity .15s ease}.wp-item+.wp-item{padding-top:12px;border-top:0}.wp-item:hover{opacity:.88}.wp-item-body{display:flex;flex-direction:column;gap:12px;min-width:0}.wp-order-head{display:flex;align-items:center;width:100%}.wp-item-line{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:21px;min-width:0}.wp-item-label{flex-shrink:0;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--wp-text-30);white-space:nowrap}.wp-line-value,.wp-order-side{min-width:0;overflow:hidden;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--wp-text-60);text-align:right;text-overflow:ellipsis;white-space:nowrap}.wp-order-side--buy{color:var(--wp-mint)}.wp-order-side--sell{color:var(--wp-red)}.wp-svc-token{display:flex;align-items:center;justify-content:flex-end;gap:6px;min-width:0;min-height:21px}.wp-svc-token>span{font-size:14px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--wp-text-60);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-svc-token-icon{width:16px;height:16px;border-radius:50%;flex-shrink:0;object-fit:cover}.wp-token-stack{display:inline-flex;align-items:center;justify-content:flex-end;width:29px;min-width:29px;overflow:visible}.wp-token-stack .wp-svc-token-icon+.wp-svc-token-icon{margin-left:-3.5px}.wp-token-subtle,.wp-item-usd{color:var(--wp-text-30)!important}.wp-svc-amount{display:flex;flex-direction:column;align-items:flex-end;justify-content:center;gap:1px;min-width:0}.wp-svc-amount-main{font-size:14px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--wp-text-60);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.wp-svc-amount .wp-item-usd{font-size:12px;font-weight:500;line-height:1.35}.wp-order-token{display:flex;align-items:center;gap:8px;min-width:0}.wp-order-token .wp-svc-token-icon{width:32px;height:32px}.wp-order-token-meta{display:flex;min-width:0;flex-direction:column;justify-content:center}.wp-order-token-symbol{overflow:hidden;color:var(--wp-text-60);font-size:14px;font-weight:500;line-height:1.5;text-overflow:ellipsis;white-space:nowrap}.wp-order-token-pair{overflow:hidden;color:var(--wp-text-30);font-size:12px;font-weight:500;line-height:1.5;text-overflow:ellipsis;white-space:nowrap}.wp-item-tags{display:flex;align-items:stretch;gap:8px;width:100%}.wp-tag{appearance:none;display:inline-flex;flex:1 1 0;align-items:center;justify-content:center;gap:0;min-width:0;min-height:33px;padding:6px 10px;border-radius:6px;border:0;background:var(--wp-control);font-family:inherit;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:0;color:var(--wp-text-40);text-align:center;text-decoration:none;white-space:nowrap;box-sizing:border-box;transition:background-color .15s ease,border-color .15s ease,color .15s ease,transform .15s ease}a.wp-tag,button.wp-tag{cursor:pointer}.wp-tag:hover{background:var(--wp-control);transform:none}.wp-tag:focus-visible{outline:2px solid var(--wp-mint);outline-offset:2px}.wp-tag[aria-disabled=true],.wp-tag[data-disabled]{cursor:default;opacity:.48;pointer-events:none}.wp-tag-label{display:inline-flex;align-items:center}.wp-tag-icon{display:none}.wp-tag:hover .wp-tag-icon{transform:none}.wp-tag--mint{color:var(--wp-mint);background:var(--wp-accent-soft)}.wp-tag--mint:hover{background:var(--wp-accent-soft)}.wp-tag--muted{color:var(--wp-text-40)}.wp-svc-empty{display:flex;align-items:center;justify-content:center;min-height:74px;padding:20px 16px;background:var(--wp-card);border-radius:12px;box-shadow:var(--wp-card-shadow, none);font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0;color:var(--wp-text-30);box-sizing:border-box}.wp-claim-overlay{position:absolute;inset:0;z-index:8;display:flex;align-items:flex-end;justify-content:center;background:#00000094;box-sizing:border-box}.wp-claim-sheet{display:flex;flex-direction:column;width:100%;max-width:375px;max-height:calc(100% - 24px);overflow:hidden;border-radius:24px 24px 0 0;background:var(--wp-bg);color:var(--wp-text);box-shadow:0 -18px 48px #00000042;animation:wp-claim-slide-up .22s ease-out}@keyframes wp-claim-slide-up{0%{transform:translateY(18px);opacity:0}to{transform:translateY(0);opacity:1}}.wp-claim-grabber{display:flex;align-items:flex-start;justify-content:center;height:38px;min-height:38px;padding-top:12px;box-sizing:border-box}.wp-claim-grabber span{display:block;width:52px;height:5px;border-radius:999px;background:var(--wp-control)}.wp-claim-content{display:flex;flex-direction:column;align-items:center;gap:16px;width:100%;padding:20px;box-sizing:border-box}.wp-claim-icon{display:inline-flex;align-items:center;justify-content:center;width:64px;height:64px;border-radius:50%;flex-shrink:0}.wp-claim-icon--success{background:var(--wp-claim-success-soft);color:var(--wp-claim-success)}.wp-claim-icon--pending{background:#9b8cef29;color:var(--wp-claim-primary)}.wp-claim-icon--error{background:var(--wp-claim-error-soft);color:var(--wp-claim-error);font-size:30px;font-weight:600;line-height:1}.wp-claim-icon--token{background:#00d4aa29}.wp-claim-icon--token img{width:48px;height:48px;border-radius:50%;object-fit:cover}.wp-claim-icon--token span{display:inline-flex;align-items:center;justify-content:center;width:48px;height:48px;border-radius:50%;background:var(--wp-mint);color:#101820;font-size:18px;font-weight:600}.wp-claim-spinner{width:36px;height:36px;border-radius:50%;border:3px solid rgba(155,140,239,.28);border-top-color:var(--wp-claim-primary);animation:wp-claim-spin .8s linear infinite}@keyframes wp-claim-spin{to{transform:rotate(360deg)}}.wp-claim-copy{display:flex;flex-direction:column;align-items:center;gap:16px;width:100%;text-align:center}.wp-claim-title{margin:0;font-size:20px;font-weight:600;line-height:1.3;letter-spacing:0;color:var(--wp-text)}.wp-claim-desc{max-width:335px;margin:0;font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0;color:var(--wp-text-40)}.wp-claim-heading{display:flex;flex-direction:column;align-items:flex-start;gap:8px;width:100%}.wp-claim-error-message{margin:0;color:var(--wp-claim-error);font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0}.wp-claim-reward-card{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;min-height:60px;padding:16px;border-radius:8px;background:var(--wp-card);box-sizing:border-box}.wp-claim-reward-token{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:50%;flex-shrink:0;overflow:hidden;background:var(--wp-control)}.wp-claim-reward-token img{width:28px;height:28px;object-fit:cover}.wp-claim-reward-token span{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;background:var(--wp-mint);color:#101820;font-size:13px;font-weight:600;line-height:1}.wp-claim-reward-symbol{flex:1 1 auto;min-width:0;overflow:hidden;color:var(--wp-text);font-size:18px;font-weight:600;line-height:1.3;letter-spacing:0;text-overflow:ellipsis;white-space:nowrap}.wp-claim-reward-amount{flex-shrink:0;color:var(--wp-text);font-size:20px;font-weight:600;line-height:1.3;letter-spacing:0;white-space:nowrap}.wp-claim-account-card{display:flex;flex-direction:column;gap:12px;width:100%;padding:16px;border-radius:8px;background:var(--wp-card);box-sizing:border-box}.wp-claim-account-row{display:flex;align-items:center;justify-content:space-between;gap:4px;width:100%;min-height:40px}.wp-claim-account-row>span{flex-shrink:0;color:var(--wp-text-40);font-size:14px;font-weight:400;line-height:1.3;letter-spacing:0;white-space:nowrap}.wp-claim-account{display:flex;align-items:center;gap:8px;min-width:0}.wp-claim-account strong{overflow:hidden;color:var(--wp-text);font-size:15px;font-weight:600;line-height:1.6;letter-spacing:0;text-overflow:ellipsis;white-space:nowrap}.wp-claim-account-avatar{width:32px;height:32px;border-radius:50%;flex-shrink:0;background:radial-gradient(circle at 30% 28%,#d87aff 0 12%,transparent 13%),radial-gradient(circle at 68% 28%,#f0a1ff 0 12%,transparent 13%),radial-gradient(circle at 32% 70%,#b561e7 0 13%,transparent 14%),radial-gradient(circle at 70% 70%,#d4a2ff 0 13%,transparent 14%),radial-gradient(circle at 50% 50%,#8c4fc4 0 18%,transparent 19%),#4a315f;box-shadow:inset 0 0 0 3.37px var(--wp-control)}.wp-claim-divider{display:block;width:100%;height:1px;background:var(--wp-border)}.wp-claim-detail-list{display:flex;flex-direction:column;gap:8px;width:100%}.wp-claim-detail-row{display:flex;align-items:center;justify-content:space-between;gap:20px;width:100%;min-height:20px}.wp-claim-detail-row>span{min-width:0;color:var(--wp-text-40);font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0;white-space:nowrap}.wp-claim-detail-row--sub>span:before{content:"";display:inline-block;width:3px;height:3px;margin:0 8px 3px;background:currentColor}.wp-claim-detail-row strong{min-width:0;overflow:hidden;color:var(--wp-text);font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0;text-align:right;text-overflow:ellipsis;white-space:nowrap}.wp-claim-list{display:flex;flex-direction:column;gap:8px;width:100%;padding-bottom:8px}.wp-claim-list-item{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:56px;padding:8px 16px;border-radius:8px;background:var(--wp-card);box-sizing:border-box}.wp-claim-list-item>span{flex-shrink:0;font-size:14px;font-weight:400;line-height:1.3;color:var(--wp-text-40);white-space:nowrap}.wp-claim-list-item strong{display:inline-flex;align-items:center;justify-content:flex-end;gap:4px;min-width:0;overflow:hidden;color:var(--wp-text);font-size:14px;font-weight:400;line-height:1.3;text-align:right;text-overflow:ellipsis;white-space:nowrap}.wp-claim-list-item img{width:16px;height:16px;border-radius:50%;flex-shrink:0}.wp-claim-hash{appearance:none;display:inline-flex;align-items:center;justify-content:flex-end;gap:4px;min-width:0;padding:0;border:none;background:transparent;color:var(--wp-text);cursor:pointer;font:inherit}.wp-claim-hash svg{flex-shrink:0;color:var(--wp-text-60)}.wp-claim-gas-card{display:flex;flex-direction:column;gap:4px;width:100%;padding:14px 16px;border-radius:8px;border:1px solid var(--wp-border);background:var(--wp-card);box-sizing:border-box}.wp-claim-gas-row{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:28px}.wp-claim-gas-row>span{min-width:0;font-size:12px;font-weight:400;line-height:1.3;color:var(--wp-text-40)}.wp-claim-gas-row strong{min-width:0;overflow:hidden;color:var(--wp-text);font-size:12px;font-weight:400;line-height:1.3;text-align:right;text-overflow:ellipsis;white-space:nowrap}.wp-claim-gas-row--primary{min-height:32px}.wp-claim-gas-row--primary>span,.wp-claim-gas-row--primary strong{font-size:14px;color:var(--wp-text)}.wp-claim-fee-label{position:relative;display:inline-flex;align-items:center;text-decoration:underline dotted;text-underline-offset:3px;cursor:help;overflow:visible!important}.wp-claim-fee-tooltip{position:absolute;left:0;bottom:calc(100% + 8px);z-index:2;width:min(260px,calc(100vw - 64px));padding:10px 12px;border-radius:8px;background:var(--wp-tooltip-bg);color:var(--wp-tooltip-text);box-shadow:0 12px 32px #0000003d;font-size:11px;font-weight:400;line-height:1.4;text-align:left;text-decoration:none;white-space:normal;opacity:0;pointer-events:none;transform:translateY(4px);visibility:hidden;transition:opacity .15s ease,transform .15s ease,visibility .15s ease}.wp-claim-fee-label:hover .wp-claim-fee-tooltip,.wp-claim-fee-label:focus .wp-claim-fee-tooltip,.wp-claim-fee-label:focus-visible .wp-claim-fee-tooltip{opacity:1;transform:translateY(0);visibility:visible}.wp-claim-actions{display:flex;align-items:center;gap:8px;width:100%}.wp-claim-primary,.wp-claim-secondary{appearance:none;display:inline-flex;align-items:center;justify-content:center;width:100%;min-width:0;height:52px;padding:0 24px;border:none;border-radius:40px;font-family:inherit;font-size:15px;font-weight:600;line-height:1.3;letter-spacing:0;white-space:nowrap;cursor:pointer}.wp-claim-primary{background:var(--wp-claim-primary);color:var(--wp-claim-primary-text)}.wp-claim-primary:disabled{cursor:default;opacity:.72}.wp-claim-secondary{background:var(--wp-claim-secondary-bg, var(--wp-control));color:var(--wp-claim-primary)}.wp-claim-actions[data-count="2"] .wp-claim-primary{flex:1 1 0}.wp-claim-actions[data-count="2"] .wp-claim-secondary{flex:0 0 120px}.wp-claim-button-spinner{width:16px;height:16px;border-radius:50%;border:2px solid rgba(32,37,48,.28);border-top-color:var(--wp-claim-primary-text);animation:wp-claim-spin .8s linear infinite}.wp-claim-home-indicator{display:flex;align-items:flex-end;justify-content:center;height:34px;min-height:34px;padding-bottom:8px;box-sizing:border-box}.wp-claim-home-indicator span{display:block;width:134px;height:5px;border-radius:16px;background:var(--wp-text-40)}@media(max-width:359px){.wp-header{gap:12px;padding:0 12px}.wp-total{font-size:24px}.wp-body-inner{padding:0 12px 128px;gap:20px}.wp-svc-items,.wp-claim-content{padding:18px 14px}.wp-item-line{gap:10px}.wp-svc-token>span{max-width:168px}}.wp-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.wi-drawer-content .wp-header,.wi-portfolio-body .wp-header{padding:16px}.wi-drawer-content .wp-header-edge--right .wp-header-btn,.wi-portfolio-body .wp-header-edge--right .wp-header-btn{top:16px;right:16px}
8
- `);import{Fragment as Qc,jsx as Ne,jsxs as br}from"react/jsx-runtime";var hr=5,Kc="wp:";function bn({env:e,theme:t="light",walletAddress:n,onBack:o,showHeader:r=!0,variant:a="embed",className:i,onOutlink:s,lpBalanceReader:c,stakingRewardsReader:l}){let d=Pe(e),f=!!n,h=qc(),[,m]=gt.useState(hr),[y,x]=gt.useState(!1),w=gt.useCallback(()=>{h.invalidateQueries({predicate:C=>typeof C.queryKey[0]=="string"&&C.queryKey[0].startsWith(Kc)})},[h]),v=gt.useCallback(()=>{w(),x(!0),setTimeout(()=>x(!1),600),m(hr)},[w]);gt.useEffect(()=>{if(!f)return;let C=setInterval(()=>{m(A=>A<=1?(v(),hr):A-1)},1e3);return()=>clearInterval(C)},[f,v]);let B=gt.useCallback(()=>{o?.()},[o]),u=gt.useMemo(()=>({env:d,theme:t,open:!0,walletAddress:n,close:B,onOutlink:s,lpBalanceReader:c,stakingRewardsReader:l}),[d,t,n,B,s,c,l]),E=br(Qc,{children:[r&&br("div",{className:"wp-header",children:[Ne("div",{className:"wp-header-edge wp-header-edge--left",children:o?Ne("button",{type:"button",className:"wp-header-btn","aria-label":"Back",onClick:o,children:Ne(Pt,{size:24})}):Ne("span",{className:"wp-header-spacer","aria-hidden":!0})}),Ne("h2",{className:"wp-header-title",children:"Portfolio"}),Ne("div",{className:"wp-header-edge wp-header-edge--right",children:Ne("button",{type:"button",className:X("wp-header-btn",o?void 0:"wp-refresh-btn"),"aria-label":o?"Close portfolio":"Refresh portfolio",onClick:o??v,children:o?Ne(ea,{}):Ne(Ji,{className:y?"wp-spin-once":void 0})})})]}),Ne("div",{className:"wp-body",children:br("div",{className:"wp-body-inner",children:[Ne(fa,{}),Ne(ya,{}),Ne(Na,{}),Ne(Ea,{})]})})]});return Ne(En.Provider,{value:u,children:a==="none"?E:Ne("div",{className:X(a==="fullscreen"?"wp-fullscreen":"wp-embed",i),"data-theme":t,children:E})})}import{jsx as wr,jsxs as Aa}from"react/jsx-runtime";function Pa({className:e}){let{env:t,theme:n,walletAddress:o,close:r,onOutlink:a,lpBalanceReader:i,stakingRewardsReader:s}=tt();return Aa(ho.Portal,{children:[wr(ho.Overlay,{className:"wp-overlay"}),Aa(ho.Content,{className:X("wp-fullscreen",e),"data-theme":n,children:[wr(ho.Title,{className:"wp-sr-only",children:"Portfolio"}),wr(bn,{env:t,theme:n,walletAddress:o,onBack:r,variant:"none",onOutlink:a,lpBalanceReader:i,stakingRewardsReader:s})]})]})}import{jsx as Ba}from"react/jsx-runtime";function Zc({env:e,theme:t="light",walletAddress:n,open:o,onOpenChange:r,onOutlink:a,lpBalanceReader:i,stakingRewardsReader:s,children:c}){let l=Pe(e),d=o!==void 0,[f,h]=rn.useState(!1),m=d?o:f,y=rn.useCallback(v=>{d||h(v),r?.(v)},[d,r]),x=rn.useCallback(()=>y(!1),[y]),w=rn.useMemo(()=>({env:l,theme:t,open:m,walletAddress:n,close:x,onOutlink:a,lpBalanceReader:i,stakingRewardsReader:s}),[l,t,m,n,x,a,i,s]);return Ba(En.Provider,{value:w,children:Ba(Yc.Root,{direction:"bottom",open:m,onOpenChange:y,noBodyStyles:!0,children:c})})}var Fa=Object.assign(Zc,{Trigger:Xi,Content:Pa});import*as R from"react";import{createPortal as wn}from"react-dom";import qt from"bignumber.js";import{jsx as ot,jsxs as Xc}from"react/jsx-runtime";function Ma({size:e=20,className:t}){return Xc("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,"aria-hidden":"true",children:[ot("circle",{cx:"9",cy:"9",r:"6",stroke:"currentColor",strokeWidth:1.7}),ot("path",{d:"m17 17-3.2-3.2",stroke:"currentColor",strokeWidth:1.7,strokeLinecap:"round"})]})}function _a({size:e=16,className:t}){return ot("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ot("path",{d:"M2.667 8a5.333 5.333 0 1 0 1.562-3.771L2.667 5.79M2.667 2.667v3.124h3.124M8 5.333V8l1.667 1",stroke:"currentColor",strokeWidth:1.333,strokeLinecap:"round",strokeLinejoin:"round"})})}function Oa({size:e=16,className:t}){return ot("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ot("path",{d:"M2.667 4h4M9.333 4h4M6.667 2.667v2.666M2.667 12h4M9.333 12h4M9.333 10.667v2.666M2.667 8h1.666M7 8h6.333M4.333 6.667v2.666",stroke:"currentColor",strokeWidth:1.333,strokeLinecap:"round",strokeLinejoin:"round"})})}function za({size:e=20,className:t}){return ot("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ot("path",{d:"M10 4.167v11.666M4.167 10 10 15.833 15.833 10",stroke:"currentColor",strokeWidth:1.667,strokeLinecap:"round",strokeLinejoin:"round"})})}function Wa({size:e=16,className:t}){return ot("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,"aria-hidden":"true",children:ot("path",{d:"M3.333 8h9.334M8.667 4l4 4-4 4",stroke:"currentColor",strokeWidth:1.333,strokeLinecap:"round",strokeLinejoin:"round"})})}function Da({size:e=12,className:t}){return ot("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ot("path",{d:"M3.5 2 1.5 4l2 2M1.5 4h9M8.5 10l2-2-2-2M10.5 8h-9",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"})})}import*as T from"react";import Ua from"bignumber.js";function Ha(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Ga(e){return!e.isFinite()||e.isNaN()||e.lte(0)?"":e.decimalPlaces(6,Ua.ROUND_DOWN).toFixed()}function Jc(e){return e.fromToken.symbol.toLowerCase()===e.toToken.symbol.toLowerCase()||e.fromToken.chainId===e.toToken.chainId&&e.fromToken.address.toLowerCase()===e.toToken.address.toLowerCase()}function ed(e){let t=e.fromToken.priceUsd,n=e.toToken.priceUsd,o=e.lastChangedBy==="to"?e.toAmount:e.fromAmount,r=new Ua(o||"0");return!r.isFinite()||r.isNaN()||r.lte(0)?{fromAmount:e.fromAmount,toAmount:e.toAmount}:Ha(t)&&Ha(n)?e.lastChangedBy==="to"?{fromAmount:Ga(r.multipliedBy(n).dividedBy(t))}:{toAmount:Ga(r.multipliedBy(t).dividedBy(n))}:Jc(e)?e.lastChangedBy==="to"?{fromAmount:e.toAmount}:{toAmount:e.fromAmount}:{fromAmount:e.lastChangedBy==="to"?"":e.fromAmount,toAmount:e.lastChangedBy==="from"?"":e.toAmount}}function $a({getQuote:e,submitBridge:t}){return{canQuote:!!e,canSubmit:!!t,async getQuote(n){return e?e(n):ed(n)},async submitBridge(n){if(!t)throw new Error("Bridge submit handler is not configured.");return t(n)}}}var ja=15,td=18;function nd(e){let t=e.replace(/[^\d.]/g,""),n=t.indexOf(".");n!==-1&&(t=t.slice(0,n+1)+t.slice(n+1).replace(/\./g,""));let o=t.indexOf(".");if(o===-1)return t.slice(0,ja);let r=t.slice(0,o).slice(0,ja),a=t.slice(o+1).slice(0,td);return`${r}.${a}`}function od(e){let t=Number(e??"0");if(!Number.isFinite(t)||t<.1)return"1";let n=o=>Math.floor(o*100)/100;if(t<3){let o=n(t*3);return String(o<1?1:o)}return"10"}function Va(e){let t=e.toUpperCase();return t.startsWith("T")&&t.slice(1).startsWith("CROSS")?t.slice(1):t}function rd(e,t){if(!e||!t||e.chainId!==t.chainId)return!1;let n=new Set([Va(e.symbol),Va(t.symbol)]);return n.has("CROSS")&&n.has("CROSSD")}function ht(e,t){return!!e&&!!t&&e.chainId===t.chainId&&e.address.toLowerCase()===t.address.toLowerCase()}function bo(e){return e[0]}function xr(e,t,n,o){if(n&&!ht(n,t))return n;let r=t?o?.(t,e):void 0;if(r?.length)return r[0];if(!t)return e[1]??bo(e);let a=e.findIndex(s=>ht(s,t)),i=a>=0?e[a+1]:void 0;return i&&!ht(i,t)?i:e.find(s=>!ht(s,t))??t}function qa({fromToken:e,toToken:t,fromAmount:n,toAmount:o,lastChangedBy:r,slippage:a}){return{fromToken:e,toToken:t,fromAmount:n,toAmount:o,lastChangedBy:r,slippage:a}}function Ka(e,t){let n=e instanceof Error?e.message:typeof e=="string"?e:"",o=e&&typeof e=="object"&&"code"in e?String(e.code):"",r=n.toLowerCase();return o==="4001"||r.includes("user rejected")||r.includes("user denied")||r.includes("rejected the request")||r.includes("request rejected")?"Transaction request was rejected.":n.split(`
9
- `)[0]?.trim()||t}function Qa(e){let{tokens:t,initialFromToken:n,initialToToken:o,getToTokens:r,getApproval:a,approveBridge:i,history:s=[],initialSlippage:c="1",termsUrl:l,getQuote:d,submitBridge:f,onSubmitted:h,onSuccess:m,onFailed:y,onExit:x}=e,w=T.useMemo(()=>$a({getQuote:d,submitBridge:f}),[d,f]),[v,B]=T.useState("form"),[u,E]=T.useState(n??bo(t)),[C,A]=T.useState(()=>xr(t,n??bo(t),o,r)),[M,Z]=T.useState(""),[W,G]=T.useState(""),[q,O]=T.useState("from"),[ie,ue]=T.useState(c),[te,ae]=T.useState(null),De=T.useMemo(()=>rd(u,C),[u,C]),se=T.useMemo(()=>De?"1":ie==="auto"?od(te?.priceImpact):ie,[De,ie,te?.priceImpact]),[K,le]=T.useState(""),[J,U]=T.useState("idle"),[He,pe]=T.useState(""),[Ie,Le]=T.useState(null),[it,we]=T.useState([]),[Ft,_e]=T.useState(!1),[bt,Lt]=T.useState(!1),[ce,me]=T.useState(null),[Qe,xe]=T.useState(!1),[ge,he]=T.useState(null),[Mt,Ge]=T.useState(null),[at,ve]=T.useState(!1),[wt,xt]=T.useState(!1),Ee=T.useRef(0),st=T.useRef(null),Ye=T.useCallback(()=>{st.current&&(clearTimeout(st.current),st.current=null)},[]),ne=T.useCallback(L=>{Ye(),Ge(L)},[Ye]);T.useEffect(()=>Ye,[Ye]),T.useEffect(()=>{let L=t.find(re=>ht(re,u))??bo(t),Q=L?r?.(L,t):void 0,H=Q?.find(re=>ht(re,C))??(Q?void 0:t.find(re=>ht(re,C)))??xr(t,L,void 0,r);E(L),A(H)},[r,t,u,C]);let Ze=T.useCallback((L,Q)=>{let H=nd(L);Q==="from"?Z(H):G(H),O(Q),le("")},[]),ye=T.useCallback(()=>{Ee.current+=1,Z(""),G(""),O("from"),ae(null),le(""),pe(""),U("idle"),me(null),xe(!1),he(null),ve(!1),ne(null)},[ne]),vt=T.useCallback(L=>{ht(L,u)||(E(L),A(xr(t,L,void 0,r)),ye())},[u,r,ye,t]),Ue=T.useCallback(L=>{ht(L,C)||ht(L,u)||(A(L),ye())},[u,ye,C]),yt=T.useMemo(()=>u?r?.(u,t)??t.filter(L=>!ht(L,u)):[],[u,r,t]),kt=T.useCallback(()=>{u?.balance&&Ze(u.balance,"from")},[u?.balance,Ze]),Et=T.useCallback(()=>{!u||!C||(E(C),A(u),ye())},[u,ye,C]),_t=T.useCallback(()=>{Ee.current+=1,Z(""),G(""),O("from"),ae(null),le(""),pe("")},[]);T.useEffect(()=>{if(!u||!C)return;if(!M&&!W){ae(null),le(""),U("idle");return}let L=++Ee.current,Q=qa({fromToken:u,toToken:C,fromAmount:M,toAmount:W,lastChangedBy:q,slippage:ie});U(w.canQuote?"quoting":"idle"),(async()=>{try{let H=await w.getQuote(Q);if(Ee.current!==L)return;H.fromAmount!==void 0&&q==="to"&&Z(H.fromAmount),H.toAmount!==void 0&&q==="from"&&G(H.toAmount),ae(H.summary??null),le(H.error??"")}catch(H){if(Ee.current!==L)return;le(H instanceof Error?H.message:"Failed to quote bridge.")}finally{Ee.current===L&&U("idle")}})()},[M,u,q,w,ie,W,C]);let lt=T.useCallback(()=>!u||!C?null:qa({fromToken:u,toToken:C,fromAmount:M,toAmount:W,lastChangedBy:q,slippage:se}),[se,M,u,q,W,C]),S=T.useCallback(async(L,Q)=>{pe(""),ve(!1),xe(!1),U("submitting");try{if(!Q?.skipApprovalCheck&&a){let re=await a(L);if(re){me(re),he(L),U("idle");return}}me(null),he(null),ne("processing");let H=await w.submitBridge(L);Le(H),U("success"),we(re=>[{id:H.txHash,timestamp:new Date().toISOString(),txHash:H.txHash,fromToken:H.fromToken,toToken:H.toToken,fromAmount:H.fromAmount,toAmount:H.toAmount,summary:te??void 0,status:"pending"},...re.filter(Hn=>Hn.txHash!==H.txHash)]),_t(),xt(!0),ne(null),ve(!0),h?.(H),m?.(H)}catch(H){let re=Ka(H,"Failed to submit bridge.");ne(null),pe(re),U("error"),y?.({message:re})}},[a,y,h,m,w,_t,ne,te]),$=T.useCallback(async()=>{if(K)return;let L=lt();if(L){if(!bt){he(L),_e(!0);return}await S(L)}},[lt,K,S,bt]),ee=T.useCallback(async()=>{let L=ge??lt();L&&(Lt(!0),_e(!1),await S(L))},[lt,ge,S]),ke=T.useCallback(()=>{_e(!1),he(null)},[]),At=T.useCallback(async()=>{if(!(J==="submitting"||!ce||!ge||!i)){pe(""),U("submitting");try{await i(ge,ce),me(null),U("idle"),xe(!0)}catch(L){let Q=Ka(L,"Failed to approve token.");pe(Q),U("error"),y?.({message:Q})}}},[ce,i,y,ge,S,J]),Oe=T.useCallback(()=>{J!=="submitting"&&(me(null),xe(!1),he(null),U("idle"))},[J]),Wn=T.useCallback(async()=>{J==="submitting"||!ge||(xe(!1),await S(ge,{skipApprovalCheck:!0}))},[ge,S,J]),Bo=T.useCallback(()=>{ve(!1)},[]),yn=T.useCallback(L=>{B(L),L==="history"&&xt(!1)},[]),Xe=T.useCallback(()=>{if(v==="history"){yn("form");return}x?.()},[x,yn,v]),Dn=T.useMemo(()=>[...s,...it.filter(L=>!s.some(Q=>Q.txHash===L.txHash))],[s,it]);return{step:v,setStep:yn,status:J,error:He,quoteError:K,fromToken:u,toToken:C,tokens:t,availableToTokens:yt,fromAmount:M,toAmount:W,lastChangedBy:q,slippage:ie,effectiveSlippage:se,slippageLocked:De,setSlippage:ue,summary:te,history:Dn,submitted:Ie,canSubmit:w.canSubmit,termsOpen:Ft,approvalInfo:ce,approvalSuccessOpen:Qe,approveBridge:i,pendingSubmitInput:ge,submitToast:Mt,successDialogOpen:at,dismissSuccessDialog:Bo,hasNewHistory:wt,termsUrl:l,setFromToken:E,setToToken:A,selectFromToken:vt,selectToToken:Ue,setAmount:Ze,setMax:kt,swapTokens:Et,submit:$,confirmTerms:ee,cancelTerms:ke,confirmApproval:At,cancelApproval:Oe,continueAfterApproval:Wn,back:Xe}}_(`.bf-root{--bf-bg: var(--ds-bg-default, #1e232e);--bf-surface: var(--ds-surface-medium, rgba(255, 255, 255, .05));--bf-surface-hover: var(--ds-surface-high, rgba(255, 255, 255, .08));--bf-border: var(--ds-border-default, rgba(255, 255, 255, .07));--bf-text-high: var(--ds-content-high, rgba(255, 255, 255, .85));--bf-text-medium: var(--ds-content-medium, rgba(255, 255, 255, .65));--bf-text-low: var(--ds-content-low, rgba(255, 255, 255, .4));--bf-toast-bg: #1e232e;--bf-toast-color: rgba(255, 255, 255, .85);position:relative;display:flex;flex:1;min-height:0;flex-direction:column;overflow:hidden;background:var(--bf-bg);color:var(--ds-content-highest, #ffffff);font-family:inherit}[data-theme=dark].wi-popover-content .bf-root,[data-theme=dark].wi-drawer-content .bf-root{--bf-bg: var(--ds-bg-default, #121212);--bf-surface: var(--ds-surface-medium, rgba(255, 255, 255, .05));--bf-surface-hover: var(--ds-surface-high, rgba(255, 255, 255, .1));--bf-border: var(--ds-border-default, rgba(255, 255, 255, .05));--bf-text-high: var(--ds-content-high, rgba(255, 255, 255, .85));--bf-text-medium: var(--ds-content-medium, rgba(255, 255, 255, .7));--bf-text-low: var(--ds-content-low, rgba(255, 255, 255, .5))}[data-theme=light].wi-popover-content .bf-root,[data-theme=light].wi-drawer-content .bf-root{--bf-bg: var(--ds-bg-default, #ffffff);--bf-surface: var(--ds-surface-medium, rgba(18, 18, 18, .05));--bf-surface-hover: var(--ds-surface-high, rgba(18, 18, 18, .1));--bf-border: var(--ds-border-default, rgba(18, 18, 18, .05));--bf-text-high: var(--ds-content-high, rgba(18, 18, 18, .85));--bf-text-medium: var(--ds-content-medium, rgba(18, 18, 18, .7));--bf-text-low: var(--ds-content-low, rgba(18, 18, 18, .5))}.bf-root[data-view=history]{background:var(--ds-bg-dim, #f5f7fa);color:var(--ds-content-high, rgba(0, 0, 0, .85))}.bf-header{position:relative;display:flex;flex-shrink:0;align-items:center;justify-content:space-between;padding:24px;border-bottom:1px solid var(--bf-border);background:var(--ds-bg-default, var(--bf-bg));box-sizing:border-box}.bf-root[data-view=history] .bf-header{padding:24px;border-bottom-color:var(--ds-border-default, rgba(0, 0, 0, .07));background:var(--ds-surface-default, #ffffff)}.bf-header-btn{display:inline-flex;width:24px;height:24px;flex-shrink:0;align-items:center;justify-content:center;padding:0;border:0;background:transparent;color:var(--ds-content-low, rgba(0, 0, 0, .4));cursor:pointer;transition:color .15s ease}.bf-header-btn:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.bf-header .bf-header-btn:last-child{position:absolute;top:24px;right:24px}.bf-header-title{position:absolute;left:50%;transform:translate(-50%);font-size:18px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--bf-text-high);white-space:nowrap}.bf-root[data-view=history] .bf-header-title{color:var(--ds-content-highest, #000000)}.bf-body,.bf-history-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;box-sizing:border-box}.bf-body{padding:24px}.bf-history-body{display:flex;flex-direction:column;gap:12px;padding:24px;background:var(--ds-bg-dim, #f5f7fa)}.bf-toolbar{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:12px}.bf-chip{display:inline-flex;align-items:center;gap:4px;min-height:33px;padding:6px 8px;border:0;border-radius:12px;background:var(--bf-surface);color:var(--bf-text-medium);font:inherit;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer}.bf-chip:hover:not(:disabled){color:var(--bf-text-high);background:var(--bf-surface-hover)}.bf-chip:disabled{cursor:default}.bf-chip-history{position:relative}.bf-chip-dot{position:absolute;top:4px;right:4px;width:6px;height:6px;border-radius:999px;background:var(--ds-system-red-default, #da0b2e)}.bf-swap-card{position:relative;display:flex;flex-direction:column;gap:12px;margin-bottom:12px}.bf-field-error{margin-top:-4px;color:var(--ds-system-red-default, #ff2b5f);font-size:13px;font-weight:500;line-height:1.5;letter-spacing:0}.bf-amount-panel{display:flex;min-height:110px;flex-direction:column;gap:8px;padding:16px;border:1px solid transparent;border-radius:12px;background:var(--bf-surface);box-sizing:border-box;transition:border-color .2s ease}.bf-amount-panel:hover{border-color:var(--bf-border)}.bf-amount-head{display:flex;align-items:center;justify-content:space-between;gap:8px;color:var(--bf-text-high);font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-balance{display:inline-flex;align-items:center;justify-content:flex-end;gap:4px;min-width:0;color:var(--bf-text-low);font-size:12px;white-space:nowrap}.bf-amount-main{display:flex;align-items:center;justify-content:space-between;gap:12px}.bf-amount-input-wrap{display:flex;min-width:0;flex:1;flex-direction:column;gap:4px}.bf-amount-input{width:100%;min-width:0;padding:0;border:0;background:transparent;color:var(--bf-text-high);font:inherit;font-size:18px;font-weight:600;line-height:1.5;letter-spacing:-.01em;outline:none}.bf-amount-input::placeholder{color:var(--ds-content-lowest, rgba(0, 0, 0, .25))}.bf-amount-usd{color:var(--bf-text-low);font-size:12px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-token-pill{display:inline-flex;flex-shrink:0;align-items:center;gap:6px;min-height:33px;padding:6px 8px 6px 6px;border:1px solid var(--bf-border);border-radius:9999px;background:var(--bf-bg);color:var(--bf-text-high);font:inherit;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer}.bf-token-pill:hover:not(:disabled){background:var(--bf-surface-hover)}.bf-token-pill:disabled{cursor:default;opacity:.6}.bf-token-icon{position:relative;display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;overflow:hidden;border-radius:0;background:var(--ds-accent-primary-default, #00ceb2);color:var(--ds-accent-primary-on, #000000);font-size:11px;font-weight:700}.bf-token-icon[data-has-image=true]{background:transparent}.bf-token-icon img{width:100%;height:100%;border-radius:0;object-fit:cover}.bf-token-fallback{line-height:1}.bf-token-picker-overlay{--bf-bg: #1e232e;--bf-surface: rgba(255, 255, 255, .05);--bf-surface-hover: rgba(255, 255, 255, .08);--bf-border: rgba(255, 255, 255, .07);--bf-text-high: rgba(255, 255, 255, .85);--bf-text-medium: rgba(255, 255, 255, .65);--bf-text-low: rgba(255, 255, 255, .4);position:fixed;inset:0;z-index:100002;display:flex;align-items:center;justify-content:center;padding:24px;background:#00000085;pointer-events:auto;box-sizing:border-box}.bf-token-picker-overlay[data-theme=light]{--bf-bg: #ffffff;--bf-surface: rgba(18, 18, 18, .05);--bf-surface-hover: rgba(18, 18, 18, .08);--bf-border: rgba(18, 18, 18, .07);--bf-text-high: rgba(18, 18, 18, .85);--bf-text-medium: rgba(18, 18, 18, .65);--bf-text-low: rgba(18, 18, 18, .4)}.bf-token-picker{display:flex;width:min(480px,calc(100vw - 48px));height:min(466px,calc(100dvh - 48px));max-height:calc(100dvh - 48px);min-height:0;flex-direction:column;overflow:hidden;border:1px solid var(--bf-border);border-radius:24px;background:var(--bf-bg);color:var(--bf-text-high);box-shadow:0 24px 80px #0006;box-sizing:border-box}.bf-token-picker-handle{display:none}.bf-token-picker-head{position:relative;display:flex;min-height:73px;flex-shrink:0;align-items:center;justify-content:flex-start;padding:24px 56px 24px 24px;border-bottom:1px solid var(--bf-border);box-sizing:border-box}.bf-token-picker-head h3{margin:0;color:var(--bf-text-high);font-size:20px;font-weight:600;line-height:1.25;letter-spacing:0}.bf-token-picker-close{position:absolute;top:24px;right:24px;display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;padding:0;border:0;background:transparent;color:var(--bf-text-medium);cursor:pointer}.bf-token-picker-close:hover{color:var(--bf-text-high)}.bf-token-search{display:flex;min-height:48px;flex-shrink:0;align-items:center;gap:8px;margin:16px 24px;padding:12px 16px;border:1px solid transparent;border-radius:12px;background:var(--ds-surface-medium, rgba(18, 18, 18, .05));color:var(--bf-text-low);box-sizing:border-box}.bf-token-search:focus-within{border-color:var(--ds-accent-primary-default, #00ceb2)}.bf-token-search input{width:100%;min-width:0;padding:0;border:0;outline:0;background:transparent;color:var(--bf-text-high);font:inherit;font-size:16px;font-weight:500;line-height:1.5;letter-spacing:0}.bf-token-search input::placeholder{color:var(--bf-text-low)}.bf-token-list{display:flex;min-height:0;flex:1;flex-direction:column;gap:0;overflow-y:auto;overflow-x:hidden;padding:0 24px 24px;scrollbar-width:thin;box-sizing:border-box}.bf-token-row{position:relative;display:flex;width:100%;min-height:69px;align-items:center;justify-content:space-between;gap:12px;padding:12px;border:1px solid transparent;border-radius:12px;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer;box-sizing:border-box}.bf-token-row:hover:not([data-selected=true]){background:var(--ds-surface-medium, rgba(18, 18, 18, .05))}.bf-token-row[data-selected=true]{border-color:var(--ds-accent-primary-default, #00b4b7);background:var(--ds-surface-medium, rgba(18, 18, 18, .05))}.bf-token-row-left{display:inline-flex;min-width:0;align-items:center;gap:16px}.bf-token-meta{display:flex;min-width:0;flex-direction:column}.bf-token-symbol{overflow:hidden;color:var(--bf-text-high);font-size:16px;font-weight:600;line-height:1.5;letter-spacing:0;text-overflow:ellipsis;white-space:nowrap}.bf-token-name{overflow:hidden;color:var(--bf-text-low);font-size:12px;font-weight:500;line-height:1.5;letter-spacing:0;text-overflow:ellipsis;white-space:nowrap}.bf-token-row-right{display:flex;min-width:86px;max-width:42%;flex-shrink:0;flex-direction:column;align-items:flex-end}.bf-token-balance,.bf-token-price{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.bf-token-balance{color:var(--bf-text-high);font-size:14px;font-weight:600;line-height:1.5;letter-spacing:0}.bf-token-price{color:var(--bf-text-low);font-size:12px;font-weight:500;line-height:1.5;letter-spacing:0}.bf-token-row[data-selected=true] .bf-token-symbol{color:var(--bf-text-high)}.bf-token-row[data-selected=true] .bf-token-balance{color:var(--bf-text-high);font-size:16px}.bf-token-row[data-selected=true] .bf-token-price{color:var(--bf-text-low);font-size:14px}.bf-token-empty{padding:32px 16px;color:var(--bf-text-low);font-size:14px;font-weight:500;line-height:1.5;text-align:center}.bf-slippage-overlay{position:fixed;inset:0;z-index:100002;display:flex;align-items:center;justify-content:center;padding:24px;background:#00000085;pointer-events:auto;box-sizing:border-box}.bf-slippage-dialog{display:flex;width:min(480px,calc(100vw - 48px));height:auto;min-height:min(316px,calc(100dvh - 48px));max-height:calc(100dvh - 48px);flex-direction:column;overflow:hidden;border:1px solid var(--ds-border-medium, rgba(0, 0, 0, .18));border-radius:24px;background:var(--ds-surface-default, #ffffff);color:var(--ds-content-highest, #000000);box-shadow:var(--ds-shadow-modal, 0 4px 30px -1px rgba(0, 0, 0, .15));box-sizing:border-box}.bf-slippage-head{position:relative;display:flex;min-height:73px;flex-shrink:0;align-items:center;justify-content:flex-start;padding:24px 56px 24px 24px;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));background:var(--ds-surface-default, #ffffff);box-sizing:border-box}.bf-slippage-head h3{margin:0;color:var(--ds-content-highest, #000000);font-size:20px;font-weight:600;line-height:1.25;letter-spacing:0}.bf-slippage-close{position:absolute;top:24px;right:24px;display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;padding:0;border:0;background:transparent;color:var(--ds-content-low, rgba(0, 0, 0, .4));cursor:pointer}.bf-slippage-close:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.bf-slippage-body{display:flex;flex:1;min-height:0;flex-direction:column;gap:24px;padding:24px;box-sizing:border-box}.bf-slippage-desc{margin:0;color:var(--ds-content-medium, rgba(0, 0, 0, .65));font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-slippage-controls{display:flex;flex-direction:column;gap:12px;width:100%}.bf-slippage-presets{display:flex;gap:8px;width:100%}.bf-slippage-preset{appearance:none;display:inline-flex;flex:1 1 0;min-width:0;min-height:48px;align-items:center;justify-content:center;padding:12px 8px;border:1px solid transparent;border-radius:12px;background:var(--ds-surface-medium, #f5f7fa);color:var(--ds-content-medium, rgba(0, 0, 0, .65));font:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer;box-sizing:border-box}.bf-slippage-preset:hover,.bf-slippage-preset[data-selected=true]{border-color:var(--ds-accent-primary-default, #00b4b7);background:var(--ds-accent-primary-low, #e7f9f8)}.bf-slippage-custom{display:flex;min-height:48px;align-items:center;gap:8px;padding:12px;border:1px solid transparent;border-radius:12px;background:var(--ds-surface-medium, #f5f7fa);color:var(--ds-content-high, rgba(0, 0, 0, .85));box-sizing:border-box}.bf-slippage-custom:focus-within,.bf-slippage-custom[data-selected=true]{border-color:var(--ds-accent-primary-default, #00b4b7)}.bf-slippage-custom input{width:100%;min-width:0;padding:0;border:0;outline:0;background:transparent;color:var(--ds-content-high, rgba(0, 0, 0, .85));font:inherit;font-size:16px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-slippage-custom input::placeholder{color:var(--ds-content-lowest, rgba(0, 0, 0, .25))}.bf-slippage-custom span:not(.bf-sr-only){flex-shrink:0;color:var(--ds-content-high, rgba(0, 0, 0, .85));font-size:16px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-slippage-apply{appearance:none;margin-top:auto;width:100%;min-height:48px;padding:12px;border:0;border-radius:12px;background:var(--ds-accent-primary-default, #00b4b7);color:var(--ds-accent-primary-on-primary, #ffffff);font:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer;box-sizing:border-box}.bf-slippage-apply:hover{filter:brightness(.96)}.bf-slippage-apply:disabled{cursor:not-allowed;opacity:.5;filter:none}.bf-slippage-message{margin:0;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-slippage-message[data-variant=warning]{color:var(--ds-system-orange-high, #e56f00)}.bf-slippage-message[data-variant=error]{color:var(--ds-system-red-default, #da0b2e)}.bf-action-modal-overlay{--bf-bg: var(--ds-bg-default, #1e232e);--bf-surface: var(--ds-surface-medium, rgba(255, 255, 255, .05));--bf-surface-hover: var(--ds-surface-high, rgba(255, 255, 255, .08));--bf-border: var(--ds-border-default, rgba(255, 255, 255, .12));--bf-text-high: var(--ds-content-high, rgba(255, 255, 255, .92));--bf-text-medium: var(--ds-content-medium, rgba(255, 255, 255, .65));--bf-text-low: var(--ds-content-low, rgba(255, 255, 255, .4));position:fixed;inset:0;z-index:100003;display:flex;align-items:center;justify-content:center;padding:24px;background:#040912b8;pointer-events:auto;box-sizing:border-box}.bf-action-modal-overlay[data-theme=light]{--bf-bg: var(--ds-bg-default, #ffffff);--bf-surface: var(--ds-surface-medium, rgba(18, 18, 18, .05));--bf-surface-hover: var(--ds-surface-high, rgba(18, 18, 18, .1));--bf-border: var(--ds-border-default, rgba(18, 18, 18, .08));--bf-text-high: var(--ds-content-high, rgba(18, 18, 18, .85));--bf-text-medium: var(--ds-content-medium, rgba(18, 18, 18, .65));--bf-text-low: var(--ds-content-low, rgba(18, 18, 18, .4))}.bf-action-modal{display:flex;width:min(480px,calc(100vw - 48px));flex-direction:column;align-items:center;gap:24px;padding:48px 24px 24px;border:1px solid var(--bf-border);border-radius:24px;background:var(--bf-bg);color:#fff;box-shadow:0 24px 80px #00000073;box-sizing:border-box}.bf-action-modal h3{width:100%;margin:0;color:var(--bf-text-high);font-size:24px;font-weight:700;line-height:1.25;text-align:center;letter-spacing:0}.bf-action-modal-desc{max-width:380px;margin:0;color:var(--bf-text-low);font-size:15px;font-weight:500;line-height:1.45;text-align:center;letter-spacing:0}.bf-terms-check-row{display:grid;width:100%;min-height:56px;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px;padding:14px 16px;border:none;border-radius:12px;background:var(--bf-surface);color:var(--bf-text-medium);font-size:16px;font-weight:700;line-height:1.4;box-sizing:border-box;cursor:pointer;touch-action:manipulation;user-select:none}.bf-terms-check-button{appearance:none;display:grid;min-width:0;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:12px;padding:0;border:0;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer;touch-action:manipulation}.bf-terms-check-button:focus-visible .bf-terms-checkbox{outline:2px solid var(--ds-accent-primary-default, #00ceb2);outline-offset:2px}.bf-terms-checkbox{position:relative;display:inline-flex;width:20px;height:20px;align-items:center;justify-content:center;border:1px solid rgba(124,143,180,.72);border-radius:5px;background:transparent;box-sizing:border-box}.bf-terms-checkbox[data-checked=true]{border-color:var(--ds-accent-primary-default, #00ceb2);background:var(--ds-accent-primary-default, #00ceb2)}.bf-terms-checkbox[data-checked=true]:after{width:8px;height:4px;border:solid var(--ds-accent-primary-on, #000000);border-width:0 0 2px 2px;content:"";transform:rotate(-45deg) translate(1px,-1px)}.bf-terms-check-row a{position:relative;z-index:1;color:var(--ds-accent-primary-default, #00ceb2);font-size:14px;font-weight:700;text-decoration:none;white-space:nowrap}.bf-terms-privacy{max-width:380px;margin:0;color:var(--bf-text-low);font-size:15px;font-weight:500;line-height:1.45;text-align:center;letter-spacing:0}.bf-action-primary,.bf-action-secondary{display:inline-flex;width:100%;min-height:56px;align-items:center;justify-content:center;padding:14px 16px;border:0;border-radius:12px;font:inherit;font-size:18px;font-weight:700;line-height:1.4;letter-spacing:0;cursor:pointer}.bf-action-primary{background:var(--ds-accent-primary-default, #00ceb2);color:var(--ds-accent-primary-on, #000000)}.bf-action-primary:disabled{cursor:not-allowed;opacity:.35}.bf-action-primary[aria-busy=true]{gap:8px;opacity:1}.bf-action-button-spinner{width:18px;height:18px;border:2px solid rgba(0,0,0,.22);border-top-color:currentColor;border-right-color:currentColor;border-radius:999px;animation:bf-loading-spin .9s linear infinite}.bf-action-secondary{background:var(--bf-surface);color:var(--bf-text-low)}.bf-action-secondary:disabled{cursor:not-allowed;opacity:.5}.bf-approve-address-box{display:flex;width:100%;flex-direction:column;gap:10px;padding:16px;border:1px solid var(--bf-border);border-radius:12px;background:var(--bf-surface);box-sizing:border-box}.bf-approve-address-box>span{color:var(--bf-text-low);font-size:14px;font-weight:700;line-height:1.4}.bf-approve-address-box>div{display:flex;min-width:0;align-items:center;justify-content:space-between;gap:12px}.bf-approve-address-box strong{min-width:0;overflow:hidden;color:var(--bf-text-high);font-size:15px;font-weight:500;line-height:1.5;text-overflow:ellipsis;white-space:nowrap}.bf-copy-button{flex-shrink:0;min-width:48px;min-height:32px;padding:6px 10px;border:1px solid rgba(0,206,178,.65);border-radius:8px;background:transparent;color:var(--ds-accent-primary-default, #00ceb2);font:inherit;font-size:12px;font-weight:700;line-height:1.2;cursor:pointer}.bf-copy-button:disabled{cursor:not-allowed;opacity:.45}.bf-action-buttons{display:grid;width:100%;grid-template-columns:1fr 1fr;gap:12px}.bf-approval-success-modal{gap:28px}.bf-success-mark{position:relative;display:inline-flex;width:96px;height:96px;flex-shrink:0;align-items:center;justify-content:center;border:12px solid rgba(0,206,178,.12);border-radius:999px;background:#00ceb2a8;box-shadow:0 0 0 10px #00ceb20f;box-sizing:border-box}.bf-success-mark:after{width:34px;height:18px;border:solid #ffffff;border-width:0 0 6px 6px;content:"";transform:rotate(-45deg) translate(2px,-3px)}.bf-status-toast{position:absolute;right:16px;bottom:14px;left:16px;z-index:5;display:flex;align-items:center;gap:12px;min-height:52px;padding:12px;border-radius:12px;background:var(--bf-toast-bg, #1e232e);color:var(--bf-toast-color, rgba(255, 255, 255, .85));box-shadow:0 8px 24px #0000003d;box-sizing:border-box}.bf-status-toast-icon{display:inline-flex;width:28px;height:28px;flex-shrink:0;align-items:center;justify-content:center;border-radius:999px}.bf-status-spinner{width:20px;height:20px;border:3px solid rgba(255,255,255,.18);border-top-color:var(--ds-accent-primary-default, #00ceb2);border-right-color:var(--ds-accent-primary-default, #00ceb2);border-radius:999px;animation:bf-loading-spin .9s linear infinite}.bf-status-check{position:relative;width:20px;height:20px;border-radius:999px;background:var(--ds-accent-primary-default, #00ceb2)}.bf-status-check:after{position:absolute;top:6px;left:5px;width:8px;height:4px;border:solid var(--ds-accent-primary-on, #000000);border-width:0 0 2px 2px;content:"";transform:rotate(-45deg)}.bf-status-toast-copy{display:flex;min-width:0;flex:1;flex-direction:column}.bf-status-toast-copy strong,.bf-status-toast-copy span{overflow:hidden;text-overflow:ellipsis}.bf-status-toast-copy strong{color:var(--ds-content-inverted, #ffffff);font-size:14px;font-weight:600;line-height:1.5;letter-spacing:-.01em}.bf-status-toast-copy span{color:var(--ds-content-inverted, #ffffff);font-size:12px;font-weight:400;line-height:1.5;letter-spacing:-.01em}.bf-status-toast[data-variant=success] .bf-status-toast-copy span{color:var(--ds-accent-primary-on-inverted, #00e8c9)}.bf-status-toast[data-variant=error]{border:1px solid rgba(255,43,95,.28);background:var(--bf-toast-bg, #1e232e)}.bf-status-toast[data-variant=error] .bf-status-toast-copy strong{color:#fff}.bf-status-error-mark{display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;border-radius:999px;background:var(--ds-system-red-default, #ff2b5f);color:#fff;font-size:14px;font-weight:700;line-height:1}.bf-status-toast[data-variant=error] .bf-status-toast-copy span{color:#ffffffe0}.bf-success-overlay{--bf-bg: var(--ds-bg-default, #1e232e);--bf-border: var(--ds-border-default, rgba(255, 255, 255, .12));--bf-text-high: var(--ds-content-high, rgba(255, 255, 255, .92));--bf-text-medium: var(--ds-content-medium, rgba(255, 255, 255, .65));position:fixed;inset:0;z-index:100003;display:flex;align-items:center;justify-content:center;padding:24px;background:#000000b8;pointer-events:auto;box-sizing:border-box}.bf-success-overlay[data-theme=light]{--bf-bg: #ffffff;--bf-border: rgba(18, 18, 18, .08);--bf-text-high: rgba(18, 18, 18, .85);--bf-text-medium: rgba(18, 18, 18, .65);--bf-text-low: rgba(18, 18, 18, .4)}.bf-success-modal{display:flex;width:min(480px,calc(100vw - 48px));flex-direction:column;overflow:hidden;border:1px solid var(--bf-border);border-radius:24px;background:var(--bf-bg);color:var(--bf-text-high);box-shadow:0 24px 80px #00000073;box-sizing:border-box}.bf-success-head{display:flex;min-height:73px;align-items:center;justify-content:space-between;gap:16px;padding:24px;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));box-sizing:border-box}.bf-success-head h3{min-width:0;margin:0;overflow:hidden;color:var(--ds-content-highest, #000000);font-size:20px;font-weight:600;line-height:1.25;text-overflow:ellipsis;white-space:nowrap}.bf-success-close{display:inline-flex;width:24px;height:24px;flex-shrink:0;align-items:center;justify-content:center;padding:0;border:0;background:transparent;color:var(--ds-content-low, rgba(0, 0, 0, .4));cursor:pointer}.bf-success-close:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.bf-success-body{display:flex;flex-direction:column;align-items:center;gap:24px;padding:40px 24px 24px;box-sizing:border-box}.bf-success-copy{display:flex;width:100%;flex-direction:column;align-items:center;gap:4px;color:var(--bf-text-medium);text-align:center}.bf-success-copy strong{color:var(--bf-text-high);font-size:24px;font-weight:700;line-height:1.25;letter-spacing:0}.bf-success-copy span{color:var(--bf-text-medium);font-size:15px;font-weight:500;line-height:1.5;letter-spacing:0}.bf-success-route{display:flex;align-items:center;justify-content:center;gap:12px}.bf-success-route .bf-token-icon{width:48px!important;height:48px!important;background:transparent;font-size:18px}.bf-success-route-arrow{color:var(--bf-text-low);font-size:24px;font-weight:500;line-height:1}.bf-success-ok{display:inline-flex;width:100%;min-height:48px;align-items:center;justify-content:center;padding:12px;border:0;border-radius:12px;background:#00b4b7e0;color:#fff;font:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer}@media(max-width:767px){.bf-success-body{padding:40px 24px 24px}.bf-success-copy strong{font-size:22px}.bf-success-copy span{font-size:14px}.bf-success-mark{width:88px;height:88px}.bf-success-route .bf-token-icon{width:44px!important;height:44px!important}}@keyframes bf-loading-spin{to{transform:rotate(360deg)}}.bf-swap-toggle{position:absolute;top:100px;left:50%;z-index:1;display:inline-flex;width:32px;height:32px;align-items:center;justify-content:center;padding:0;border:0;border-radius:9999px;background:var(--ds-accent-primary-default, #00ceb2);color:var(--ds-accent-primary-on, #000000);box-shadow:0 1px 5px #0000001f;cursor:pointer}.bf-swap-card[data-has-from-error=true] .bf-swap-toggle{top:132px}.bf-details{display:flex;flex-direction:column;gap:24px}.bf-exchange-rate{display:flex;width:100%;align-items:center;justify-content:center;gap:4px;padding:0 0 24px;border:0;background:transparent;color:var(--bf-text-low);font:inherit;font-size:12px;font-weight:500;line-height:1.5;letter-spacing:-.01em;cursor:pointer}.bf-exchange-rate:hover{color:var(--bf-text-medium)}.bf-detail-section,.bf-history-card{display:flex;flex-direction:column;gap:12px;padding:0;border-radius:12px;background:transparent;box-sizing:border-box}.bf-liquidity{display:flex;flex-direction:column;gap:12px;padding:16px;border-radius:12px;background:var(--bf-surface);box-sizing:border-box}.bf-root[data-view=history] .bf-liquidity,.bf-root[data-view=history] .bf-detail-section,.bf-root[data-view=history] .bf-history-card{background:var(--ds-surface-default, #ffffff)}.bf-detail-section h3{margin:0;color:var(--bf-text-high);font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em}.bf-tx-fee-section{gap:12px}.bf-tx-fee-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.bf-collapse-head{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;margin:0;padding:0;background:none;border:none;color:inherit;font:inherit;text-align:left;cursor:pointer}.bf-detail-section[data-open=true] .bf-collapse-head{padding-bottom:12px;border-bottom:1px solid var(--bf-border)}.bf-collapse-chevron{flex-shrink:0;color:var(--bf-text-low);transition:transform .2s ease}.bf-detail-section[data-open=true] .bf-collapse-chevron{transform:rotate(180deg)}.bf-collapse-body{display:flex;flex-direction:column;gap:14px}.bf-root[data-view=history] .bf-detail-section[data-open=true] .bf-collapse-head{border-bottom-color:var(--ds-border-default, rgba(0, 0, 0, .07))}.bf-root[data-view=history] .bf-collapse-chevron{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.bf-tx-fee-total{display:inline-flex;align-items:center;justify-content:flex-end;gap:8px;min-width:0;color:var(--bf-text-medium);font-size:14px;font-weight:600;line-height:1.4;text-align:right}.bf-tx-fee-total>span[data-delegated=true]{text-decoration:line-through;text-decoration-thickness:2px;text-decoration-color:currentColor}.bf-fee-delegated{display:inline-flex;align-items:center;justify-content:center;min-height:24px;padding:2px 8px;border-radius:6px;background:#379cff2e;color:#4eb3ff;font-size:10px;font-weight:500;line-height:1.3;white-space:nowrap}.bf-tx-fee-token{width:16px;height:16px;flex-shrink:0;border-radius:999px;object-fit:cover}.bf-info-card{gap:14px}.bf-info-section{display:flex;flex-direction:column;gap:10px}.bf-info-section+.bf-info-section{padding-top:2px}.bf-info-section h4{margin:0;color:var(--bf-text-high);font-size:14px;font-weight:600;line-height:1.5}.bf-root[data-view=history] .bf-detail-section h3,.bf-root[data-view=history] .bf-info-section h4{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.bf-info-rows{display:flex;flex-direction:column;gap:8px}.bf-info-row{display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0;font-size:12px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-liquidity-head{display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-info-label{display:inline-flex;align-items:center;gap:6px;min-width:0;color:var(--bf-text-low)}.bf-tree-marker{width:10px;flex-shrink:0;color:var(--bf-text-low)}.bf-info-value{min-width:0;color:var(--bf-text-medium);text-align:right}.bf-info-route,.bf-info-value-token{display:inline-flex;align-items:center;gap:4px}.bf-info-route .bf-token-icon,.bf-info-value-token .bf-token-icon{flex-shrink:0}.bf-info-route-arrow{color:var(--bf-text-medium)}.bf-root[data-view=history] .bf-info-route-arrow{color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.bf-info-value[data-tone=accent]{color:var(--ds-accent-primary-high, #00a0a2)}.bf-info-value[data-tone=warning]{color:var(--ds-system-orange-high, #e56f00)}.bf-root[data-view=history] .bf-info-label,.bf-root[data-view=history] .bf-liquidity-head,.bf-root[data-view=history] .bf-tree-marker{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.bf-root[data-view=history] .bf-info-value{color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.bf-root[data-view=history] .bf-info-value[data-tone=accent]{color:var(--ds-accent-primary-high, #00a0a2)}.bf-root[data-view=history] .bf-info-value[data-tone=warning]{color:var(--ds-system-orange-high, #e56f00)}.bf-liquidity-status{display:inline-flex;align-items:center;gap:6px;padding:4px 12px;border-radius:999px;font-size:13px;font-weight:600;line-height:1.4;white-space:nowrap}.bf-liquidity-status:before{content:"";display:inline-block;width:7px;height:7px;border-radius:50%;flex-shrink:0}.bf-liquidity-status[data-status=normal],.bf-liquidity-status:not([data-status]){background:#00ceb21f;color:var(--ds-accent-primary-default, #00ceb2)}.bf-liquidity-status[data-status=normal]:before,.bf-liquidity-status:not([data-status]):before{background:var(--ds-accent-primary-default, #00ceb2)}.bf-liquidity-status[data-status=low]{background:#e56f001f;color:#e56f00}.bf-liquidity-status[data-status=low]:before{background:#e56f00}.bf-liquidity-status[data-status=rebalancing]{background:#da0b2e1a;color:#da0b2e}.bf-liquidity-status[data-status=rebalancing]:before{background:#da0b2e}.bf-liquidity-track{height:8px;overflow:hidden;border-radius:999px;background:var(--bf-surface-hover)}.bf-liquidity-track span{display:block;height:100%;border-radius:inherit;background:var(--ds-accent-primary-default, #00ceb2)}.bf-error{padding:12px;border-radius:12px;background:#da0b2e1f;color:var(--ds-system-red-default, #da0b2e);font-size:13px;line-height:1.4}.bf-footer{display:flex;flex-shrink:0;flex-direction:column;align-items:center;gap:10px;padding:12px 24px 24px;background:var(--ds-bg-default, var(--bf-bg))}.bf-next{width:100%;min-height:48px;padding:12px;border:0;border-radius:12px;background:var(--ds-accent-primary-default, #00ceb2);color:var(--ds-accent-primary-on, #000000);font:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer}.bf-next:disabled{cursor:default;opacity:.6}.bf-powered{display:inline-flex;align-items:center;gap:3px;color:var(--bf-text-low);font-size:12px;font-weight:500;line-height:1.5;letter-spacing:-.01em;text-decoration:none}.bf-powered:focus-visible{border-radius:4px;outline:2px solid var(--ds-accent-primary-default, #00ceb2);outline-offset:2px}.bf-powered-brand{text-decoration:underline;text-underline-offset:2px}.bf-history-tabs{display:flex;align-items:center;gap:4px;width:100%}.bf-history-tab{position:relative;display:inline-flex;min-height:37px;align-items:center;justify-content:center;padding:8px 12px;border:0;background:transparent;color:var(--ds-content-lowest, rgba(0, 0, 0, .25));font:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:0;cursor:pointer}.bf-history-tab[data-active=true]{color:var(--ds-accent-primary-high, #00a0a2)}.bf-history-tab[data-active=true]:after{position:absolute;right:8px;bottom:0;left:8px;height:3px;border-radius:999px;background:var(--ds-accent-primary-high, #00a0a2);content:""}.bf-history-tab-dot{position:absolute;top:8px;right:4px;width:6px;height:6px;border-radius:999px;background:var(--ds-system-red-default, #da0b2e)}.bf-history-list{display:flex;flex-direction:column;gap:12px}.bf-history-item{display:flex;flex-direction:column;gap:8px;padding:12px;border-radius:12px;background:var(--ds-surface-default, #ffffff);box-sizing:border-box}.bf-history-item-head,.bf-history-meta,.bf-history-route,.bf-history-route-token{display:inline-flex;align-items:center}.bf-history-item-head{justify-content:space-between;gap:12px;width:100%}.bf-history-status{display:inline-flex;min-height:24px;align-items:center;justify-content:center;padding:3px 8px;border-radius:4px;background:var(--ds-system-orange-low, #fcf5e9);color:var(--ds-system-orange-high, #e56f00);font-size:12px;font-weight:500;line-height:1.5;letter-spacing:0;white-space:nowrap}.bf-history-status[data-status=completed]{background:var(--ds-system-green-low, #e7f9f8);color:var(--ds-system-green-high, #00a0a2)}.bf-history-status[data-status=failed]{background:var(--ds-system-red-low, rgba(218, 11, 46, .12));color:var(--ds-system-red-default, #da0b2e)}.bf-history-time{min-width:0;color:var(--ds-content-low, rgba(0, 0, 0, .4));font-size:12px;font-weight:500;line-height:1.5;letter-spacing:0;text-align:right;white-space:nowrap}.bf-history-item-body{display:flex;flex-direction:column;gap:4px}.bf-history-amount{color:var(--ds-content-high, rgba(0, 0, 0, .85));font-size:16px;font-weight:600;line-height:1.5;letter-spacing:0}.bf-history-meta{justify-content:space-between;gap:12px;min-width:0}.bf-history-usd{min-width:0;color:var(--ds-content-low, rgba(0, 0, 0, .4));font-size:12px;font-weight:500;line-height:1.5;letter-spacing:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.bf-history-route{justify-content:flex-end;gap:4px;min-width:0;color:var(--ds-content-high, rgba(0, 0, 0, .85));font-size:12px;font-weight:600;line-height:1.5;letter-spacing:0}.bf-history-route-token{gap:4px;min-width:0}.bf-history-route-token span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.bf-history-route-arrow{flex-shrink:0;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.bf-empty{padding:32px 16px;text-align:center;color:var(--ds-content-low, rgba(0, 0, 0, .4));font-size:14px}.bf-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@media(max-width:767px){.bf-token-picker-overlay{align-items:flex-end;padding:0}.bf-token-picker{width:100%;max-height:82dvh;min-height:min(520px,82dvh);border-right:0;border-bottom:0;border-left:0;border-radius:24px 24px 0 0}.bf-token-picker-handle{display:block;width:40px;height:4px;flex-shrink:0;align-self:center;margin:10px 0 0;border-radius:999px;background:#ffffff38}.bf-token-picker-head{min-height:55px;padding:12px 56px 16px 24px;border-bottom:0}.bf-token-picker-close{top:13px}.bf-token-search{margin:0 16px 12px}.bf-token-list{padding:0 16px 16px}.bf-slippage-overlay{align-items:flex-end;padding:0}.bf-slippage-dialog{width:100%;height:auto;min-height:316px;max-height:82dvh;border-right:0;border-bottom:0;border-left:0;border-radius:24px 24px 0 0}}.wi-drawer-content .bf-header{padding:16px}.wi-drawer-content .bf-header .bf-header-btn:last-child{top:16px;right:16px}.wi-drawer-content .bf-body,.wi-drawer-content .bf-history-body{padding:16px}
10
- `);import{Fragment as yr,jsx as p,jsxs as k}from"react/jsx-runtime";var ts=R.createContext(void 0);function xn(){return R.useContext(ts)}function id(e){let[t,n]=R.useState(void 0);return R.useEffect(()=>{let o=e.current;if(!o)return;let r=()=>{let i=o.closest("[data-theme]");n(i?.getAttribute("data-theme")??void 0)};r();let a=new MutationObserver(r);return a.observe(document.documentElement,{attributes:!0,subtree:!0,attributeFilter:["data-theme"]}),()=>a.disconnect()},[e]),t}var Ya=[{value:"0.1",label:"0.1%"},{value:"0.5",label:"0.5%"},{value:"1",label:"1%"},{value:"5",label:"5%"}],ad={dev:"https://dev.crossdefi.io",stage:"https://stg.crossdefi.io",production:"https://crossdefi.io"},sd=[{value:"all",label:"ALL"},{value:"completed",label:"Completed"},{value:"pending",label:"Pending"}];function ld(e,t){return e==="auto"?t?`Auto ${t}%`:"Auto":e?`${e}%`:"1%"}function Za(e){let t=e.replace(/[^\d.]/g,""),[n="",...o]=t.split("."),r=o.join("");return o.length===0?n:`${n}.${r.slice(0,2)}`}function cd(e){return`${e.chainId}:${e.address.toLowerCase()}`}function ns(e){let t=Number(e);return Number.isFinite(t)?t.toLocaleString("en-US",{maximumFractionDigits:t>=1?2:6}):e||"0"}function Xa(e,t){let n=Number(e||"0"),o=t?.priceUsd??0;return`\u2248 $${(Number.isFinite(n)?n*o:0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})} USD`}function dd(e){if(e.priceUsd===void 0)return null;let t=new qt(e.balance||"0");return t.isFinite()?`\u2248 $${t.multipliedBy(e.priceUsd).toFormat(2)} USD`:null}function pd(e){if(e.priceUsd===void 0)return null;let t=new qt(e.priceUsd);return t.isFinite()?`$${t.toFormat(t.isLessThan(1)?4:2)}`:null}function os(e){if(!e.isFinite()||e.isNaN())return"0";let n=e.decimalPlaces(6,qt.ROUND_DOWN).toFixed(6).replace(/\.?0+$/,""),[o="0",r]=n.split("."),a=new qt(o||"0").toFormat(0);return r?`${a}.${r}`:a}function fd(e){return e.length<=14?e:`${e.slice(0,6)}...${e.slice(-6)}`}function ud(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=o=>o.toString().padStart(2,"0");return[`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`,`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`].join(" ")}function md(e){let t=new qt(e||"0");return!t.isFinite()||t.isNaN()?e||"0":os(t)}function gd(e,t){if(t?.priceUsd===void 0)return null;let n=new qt(e||"0").multipliedBy(t.priceUsd);return!n.isFinite()||n.isNaN()?null:`$${n.toFormat(2)}`}function xo(e){return e.status==="success"?"completed":e.status==="failed"?"failed":"pending"}function hd(e,t){return t==="all"?!0:xo(e)===t}function bd(e){return e==="completed"?"Completed":e==="failed"?"Failed":"Pending"}function Ja(e){return e===56||e===97?"BSC":e===612044||e===5555?"CROSS":`Chain ${e}`}function rs(e,t){return!!e&&!!t&&e.chainId===t.chainId&&e.address.toLowerCase()===t.address.toLowerCase()}function is(e,t){if(!(!e||!t))return e.chainId===t.chainId?"swap":rs(e,t)||e.symbol.toLowerCase()===t.symbol.toLowerCase()?"bridge":"swap-bridge"}function as(e){return e==="swap"||e==="deposit-swap"||e==="swap-withdraw"}function wo(e){return!e||e==="0"||Number(e)===0}function wd(e){let t=e.trim().toLowerCase();return t?t.startsWith("minimum ")?{from:e}:t.startsWith("available ")&&t.includes("or more")?{to:e}:t.includes("insufficient balance")||t.includes("not enough balance")||t.includes("exceeds balance")?{from:e}:t.includes("insufficient liquidity")||t.includes("not enough liquidity")?{to:e}:{}:{}}function xd(e){let t=e.fromToken,n=e.toToken,o=is(t,n),r=e.fromAmount||"0",a=e.toAmount||"0",i=o!==void 0&&!as(o),s=o!==void 0&&o!=="bridge";return{pathType:o,bridgeInfo:i?[{label:"Route",value:t&&n?`${Ja(t.chainId)} \u2192 ${Ja(n.chainId)}`:"-"},{label:"Validator Fee",value:wo(r)?"0":"Free",tone:wo(r)?"default":"accent"},{label:"Network Fee",value:wo(r)?"0":"Free",tone:wo(r)?"default":"accent"}]:void 0,swapInfo:s?[t&&n?{label:"Route",value:"",routeTokens:[{symbol:t.symbol,iconUrl:t.iconUrl},{symbol:n.symbol,iconUrl:n.iconUrl}]}:{label:"Route",value:"-"},{label:"Price Impact",value:"0%"},{label:"In Amount",value:r,valueToken:t?{symbol:t.symbol,iconUrl:t.iconUrl}:void 0},{label:"Swap Fee",value:"0",valueToken:t?{symbol:t.symbol,iconUrl:t.iconUrl}:void 0},{label:"Out Amount",value:a,valueToken:n?{symbol:n.symbol,iconUrl:n.iconUrl}:void 0}]:void 0,txFee:[{label:"Priority Fee Per Gas",value:"0 Gwei"},{label:"Max Fee Per Gas",value:"0 Gwei"},{label:"Gas Limit",value:"0"}],txFeeInfo:{estTxFee:"0",isDelegateFee:!1}}}function Pn({token:e,size:t=20}){let n=e?.iconUrl;return p("span",{className:"bf-token-icon","data-has-image":!!n?"true":"false",style:{width:t,height:t},children:n?p("img",{src:n,alt:"",width:t,height:t,draggable:!1}):p("span",{className:"bf-token-fallback",children:e?.symbol?.slice(0,1)??"?"})})}function es({label:e,token:t,amount:n,usd:o,onAmountChange:r,onTokenClick:a}){return k("section",{className:"bf-amount-panel",children:[k("div",{className:"bf-amount-head",children:[p("span",{children:e}),k("span",{className:"bf-balance",children:[ns(t?.balance??"0")," ",t?.symbol??""]})]}),k("div",{className:"bf-amount-main",children:[k("label",{className:"bf-amount-input-wrap",children:[k("span",{className:"bf-sr-only",children:[e," amount"]}),p("input",{type:"text",inputMode:"decimal",value:n,onChange:i=>r(i.target.value),placeholder:"0",className:"bf-amount-input"}),p("span",{className:"bf-amount-usd",children:o})]}),k("button",{type:"button",className:"bf-token-pill",onClick:a,disabled:!a,"aria-label":`Select ${e.toLowerCase()} token`,children:[p(Pn,{token:t}),p("span",{children:t?.symbol??"Select"}),p(Xt,{size:16})]})]})]})}function vd({flow:e,side:t,onClose:n}){let o=R.useId(),[r,a]=R.useState(""),[i,s]=R.useState(null),c=t==="from"?e.fromToken:e.toToken;R.useEffect(()=>{s(document.body)},[]),R.useEffect(()=>{let m=y=>{y.key==="Escape"&&n()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[n]);let l=R.useMemo(()=>t==="from"?e.tokens:e.availableToTokens,[e.availableToTokens,e.tokens,t]),d=R.useMemo(()=>{let m=r.trim().toLowerCase();return m?l.filter(y=>y.symbol.toLowerCase().includes(m)||y.name.toLowerCase().includes(m)):l},[r,l]),f=R.useCallback(m=>{t==="from"?e.selectFromToken(m):e.selectToToken(m),n()},[e,n,t]);if(!i)return null;let h=xn();return wn(p("div",{className:"bf-token-picker-overlay","data-theme":h,role:"presentation",onMouseDown:m=>{m.target===m.currentTarget&&n()},children:k("section",{className:"bf-token-picker",role:"dialog","aria-modal":"true","aria-labelledby":o,children:[p("span",{className:"bf-token-picker-handle","aria-hidden":"true"}),k("header",{className:"bf-token-picker-head",children:[p("h3",{id:o,children:"Select a token"}),p("button",{type:"button",className:"bf-token-picker-close",onClick:n,"aria-label":"Close token selector",children:p(St,{size:24})})]}),k("label",{className:"bf-token-search",children:[p(Ma,{size:20}),p("span",{className:"bf-sr-only",children:"Search tokens"}),p("input",{value:r,onChange:m=>a(m.target.value),placeholder:"Search Tokens",autoComplete:"off",spellCheck:!1})]}),k("div",{className:"bf-token-list",children:[d.map(m=>{let y=rs(m,c),x=y?pd(m):dd(m);return k("button",{type:"button",className:"bf-token-row","data-selected":y?"true":"false",onClick:()=>f(m),children:[k("span",{className:"bf-token-row-left",children:[p(Pn,{token:m,size:40}),k("span",{className:"bf-token-meta",children:[p("span",{className:"bf-token-symbol",children:m.symbol}),!y&&p("span",{className:"bf-token-name",children:m.name})]})]}),k("span",{className:"bf-token-row-right",children:[k("span",{className:"bf-token-balance",children:[ns(m.balance),y?null:` ${m.symbol}`]}),x&&p("span",{className:"bf-token-price",children:x})]})]},cd(m))}),d.length===0&&p("div",{className:"bf-token-empty",children:"No tokens found"})]})]})}),i)}function yd({flow:e,onClose:t}){let n=R.useId(),[o,r]=R.useState(null),a=Ya.find(x=>x.value===e.slippage),[i,s]=R.useState(e.slippage&&!a?e.slippage:""),c=i.trim()!==""&&i.trim()!==".",l=c?Number(i):NaN,d=Number.isFinite(l)&&l>50,f=Number.isFinite(l)&&l>=10&&!d,h=x=>{e.setSlippage(x),t()},m=()=>{!c||d||(e.setSlippage(Za(i)),t())};if(R.useEffect(()=>{r(document.body)},[]),R.useEffect(()=>{let x=w=>{w.key==="Escape"&&t()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[t]),!o)return null;let y=xn();return wn(p("div",{className:"bf-slippage-overlay","data-theme":y,role:"presentation",onMouseDown:x=>{x.target===x.currentTarget&&t()},children:k("section",{className:"bf-slippage-dialog",role:"dialog","aria-modal":"true","aria-labelledby":n,children:[k("header",{className:"bf-slippage-head",children:[p("h3",{id:n,children:"Slippage Settings"}),p("button",{type:"button",className:"bf-slippage-close",onClick:t,"aria-label":"Close slippage settings",children:p(St,{size:24})})]}),k("div",{className:"bf-slippage-body",children:[p("p",{className:"bf-slippage-desc",children:"The maximum price difference you are willing to accept before the transaction is reverted. Higher slippage increases the chance of execution but may result in a worse price."}),k("div",{className:"bf-slippage-controls",children:[p("div",{className:"bf-slippage-presets",children:Ya.map(x=>p("button",{type:"button",className:"bf-slippage-preset","data-selected":!c&&e.slippage===x.value?"true":"false",onClick:()=>h(x.value),children:x.label},x.value))}),k("label",{className:"bf-slippage-custom","data-selected":c?"true":"false",children:[p("span",{className:"bf-sr-only",children:"Custom slippage percent"}),p("input",{value:i,onChange:x=>{s(Za(x.target.value))},onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),m())},inputMode:"decimal",placeholder:"Enter custom slippage",autoComplete:"off",spellCheck:!1}),p("span",{"aria-hidden":"true",children:"%"})]})]}),d?p("p",{className:"bf-slippage-message","data-variant":"error",children:"Slippage cannot exceed 50%."}):f?p("p",{className:"bf-slippage-message","data-variant":"warning",children:"Your transaction may be frontrun due to high slippage."}):null,c&&p("button",{type:"button",className:"bf-slippage-apply",onClick:m,disabled:d,children:"Apply"})]})]})}),o)}function kd({flow:e}){let t=R.useId(),[n,o]=R.useState(!1),[r,a]=R.useState(null),i=xn();return R.useEffect(()=>{a(document.body)},[]),R.useEffect(()=>{let s=c=>{c.key==="Escape"&&e.cancelTerms()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e]),!r||!e.termsOpen?null:wn(p("div",{className:"bf-action-modal-overlay","data-theme":i,role:"presentation",onPointerDown:s=>{s.target===s.currentTarget&&e.cancelTerms()},children:k("section",{className:"bf-action-modal bf-terms-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:[p("h3",{id:t,children:"Agree to Terms of Service"}),p("p",{className:"bf-action-modal-desc",children:"Please make sure to review the Terms of Service before using CROSSD."}),k("div",{className:"bf-terms-check-row","data-checked":n?"true":"false",children:[k("button",{type:"button",className:"bf-terms-check-button",role:"checkbox","aria-checked":n,onClick:()=>o(s=>!s),children:[p("span",{className:"bf-terms-checkbox","data-checked":n?"true":"false","aria-hidden":"true"}),p("span",{children:"Agree to Terms of Use"})]}),e.termsUrl&&p("a",{href:e.termsUrl,target:"_blank",rel:"noreferrer",children:"Terms of Service"})]}),p("p",{className:"bf-terms-privacy",children:"I have read and acknowledged the Privacy Policy to use CROSSD"}),p("button",{type:"button",className:"bf-action-primary",disabled:!n||e.status==="submitting",onClick:e.confirmTerms,children:"Confirm"})]})}),r)}function Sd({value:e,disabled:t=!1}){let[n,o]=R.useState(!1);return p("button",{type:"button",className:"bf-copy-button","aria-label":"Copy token address",disabled:t,onClick:()=>{t||navigator.clipboard?.writeText(e).then(()=>{o(!0),window.setTimeout(()=>o(!1),1200)})},children:n?"OK":"Copy"})}function Cd({flow:e,approval:t}){let n=R.useId(),[o,r]=R.useState(null),a=xn();if(R.useEffect(()=>{r(document.body)},[]),R.useEffect(()=>{let c=l=>{e.status!=="submitting"&&l.key==="Escape"&&e.cancelApproval()};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e]),!o)return null;let i=e.status==="submitting"||!e.approveBridge,s=e.status==="submitting";return wn(p("div",{className:"bf-action-modal-overlay","data-theme":a,role:"presentation",children:k("section",{className:"bf-action-modal bf-approve-modal",role:"dialog","aria-modal":"true","aria-labelledby":n,children:[k("h3",{id:n,children:["Approve ",t.token.symbol]}),p(Pn,{token:t.token,size:72}),k("div",{className:"bf-approve-address-box",children:[p("span",{children:"Token Address"}),k("div",{children:[p("strong",{children:t.tokenAddress}),p(Sd,{value:t.tokenAddress,disabled:s})]})]}),k("div",{className:"bf-action-buttons",children:[p("button",{type:"button",className:"bf-action-secondary",onClick:e.cancelApproval,disabled:e.status==="submitting",children:"Cancel"}),k("button",{type:"button",className:"bf-action-primary",onClick:e.confirmApproval,disabled:i,"aria-busy":s,children:[s&&p("span",{className:"bf-action-button-spinner","aria-hidden":"true"}),p("span",{children:s?"Approving...":"Approve"})]})]})]})}),o)}function Rd({flow:e}){let t=R.useId(),[n,o]=R.useState(null),r=xn();return R.useEffect(()=>{o(document.body)},[]),R.useEffect(()=>{if(!e.approvalSuccessOpen)return;let a=i=>{i.key==="Escape"&&e.cancelApproval()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e]),!n||!e.approvalSuccessOpen?null:wn(p("div",{className:"bf-action-modal-overlay","data-theme":r,role:"presentation",children:k("section",{className:"bf-action-modal bf-approval-success-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:[p("h3",{id:t,children:"Approval Success"}),p("span",{className:"bf-success-mark","aria-hidden":"true"}),k("p",{className:"bf-action-modal-desc",children:["Token approval confirmed successfully.",p("br",{}),"Please continue to the next step."]}),k("div",{className:"bf-action-buttons",children:[p("button",{type:"button",className:"bf-action-secondary",onClick:e.cancelApproval,children:"Cancel"}),p("button",{type:"button",className:"bf-action-primary",onClick:e.continueAfterApproval,children:"Continue"})]})]})}),n)}function Nd({fromAmount:e,toAmount:t,fromToken:n,toToken:o}){let[r,a]=R.useState(!1),i=R.useMemo(()=>{let l=new qt(e||"0"),d=new qt(t||"0");return!l.isFinite()||!d.isFinite()||l.lte(0)||d.lte(0)?null:r?l.dividedBy(d):d.dividedBy(l)},[e,r,t]);if(!i||!n||!o)return null;let s=r?o.symbol:n.symbol,c=r?n.symbol:o.symbol;return k("button",{type:"button",className:"bf-exchange-rate",onClick:()=>a(l=>!l),children:[k("span",{children:["1 ",s]}),p(Da,{size:12}),k("span",{children:[os(i)," ",c]})]})}function Td({flow:e}){return e.submitToast?k("div",{className:"bf-status-toast","data-variant":"processing",role:"status","aria-live":"polite",children:[p("span",{className:"bf-status-toast-icon","aria-hidden":"true",children:p("span",{className:"bf-status-spinner"})}),k("span",{className:"bf-status-toast-copy",children:[p("strong",{children:"Transaction Processing"}),p("span",{children:"Your transaction is being processed on the blockchain"})]})]}):null}function Id({message:e}){let[t,n]=R.useState(!1);return R.useEffect(()=>{if(!e){n(!1);return}n(!0);let o=window.setTimeout(()=>{n(!1)},3500);return()=>window.clearTimeout(o)},[e]),!e||!t?null:k("div",{className:"bf-status-toast","data-variant":"error",role:"alert","aria-live":"assertive",children:[p("span",{className:"bf-status-toast-icon","aria-hidden":"true",children:p("span",{className:"bf-status-error-mark",children:"!"})}),k("span",{className:"bf-status-toast-copy",children:[p("strong",{children:"Error"}),p("span",{children:e})]})]})}function Ld(e){switch(e){case"swap":case"deposit-swap":case"swap-withdraw":return"Swap Transaction Sent";case"bridge":return"Bridge Transaction Sent";case"swap-bridge":return"Swap & Bridge Transaction Sent";case"bridge-swap":return"Bridge & Swap Transaction Sent";default:return"Transaction Sent"}}function Ed({flow:e}){let t=R.useId(),[n,o]=R.useState(null),r=e.submitted,a=xn();return R.useEffect(()=>{o(document.body)},[]),R.useEffect(()=>{if(!e.successDialogOpen)return;let i=s=>{s.key==="Escape"&&e.dismissSuccessDialog()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[e]),!n||!e.successDialogOpen||!r?null:wn(p("div",{className:"bf-success-overlay","data-theme":a,role:"presentation",children:p("section",{className:"bf-success-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:k("div",{className:"bf-success-body",children:[p("span",{className:"bf-success-mark","aria-hidden":"true"}),k("div",{className:"bf-success-copy",children:[p("strong",{id:t,children:Ld(r.pathType)}),p("span",{children:"Please check the results in the history."})]}),p("div",{className:"bf-success-route","aria-hidden":"true",children:(r.routeTokens&&r.routeTokens.length>0?r.routeTokens:[{symbol:r.fromToken.symbol,iconUrl:r.fromToken.iconUrl},{symbol:r.toToken.symbol,iconUrl:r.toToken.iconUrl}]).map((i,s)=>k(R.Fragment,{children:[s>0&&p("span",{className:"bf-success-route-arrow",children:"\u2192"}),p(vr,{token:i,size:43})]},`${i.symbol}-${s}`))}),p("button",{type:"button",className:"bf-success-ok",onClick:e.dismissSuccessDialog,children:"OK"})]})})}),n)}function vr({token:e,size:t=16}){let n=!!e.iconUrl;return p("span",{className:"bf-token-icon","data-has-image":n?"true":"false",style:{width:t,height:t},children:e.iconUrl?p("img",{src:e.iconUrl,alt:"",width:t,height:t,draggable:!1}):p("span",{className:"bf-token-fallback",children:e.symbol?.slice(0,1)??"?"})})}function Ad({row:e}){return e.routeTokens&&e.routeTokens.length>0?p("span",{className:"bf-info-route",children:e.routeTokens.map((t,n)=>k(R.Fragment,{children:[n>0&&p("span",{className:"bf-info-route-arrow","aria-hidden":"true",children:"\u2192"}),p(vr,{token:t})]},`${t.symbol}-${n}`))}):e.valueToken?k("span",{className:"bf-info-value-token",children:[p(vr,{token:e.valueToken}),p("span",{children:e.value})]}):p(yr,{children:e.value})}function ss({rows:e}){return!e||e.length===0?null:p("div",{className:"bf-info-rows",children:e.map((t,n)=>k("div",{className:"bf-info-row",children:[k("span",{className:"bf-info-label",children:[p("span",{className:"bf-tree-marker",children:n===e.length-1?"\u2514":"\u251C"}),p("span",{children:t.label})]}),p("span",{className:"bf-info-value","data-tone":t.tone??"default",children:p(Ad,{row:t})})]},`${t.label}-${t.value}`))})}function Pd(e,t,n){return e.pathType==="bridge"?"Bridge Info":as(e.pathType)?"Swap Info":t&&n?"Swap & Bridge Info":t?"Bridge Info":"Swap Info"}function Bd({summary:e}){let t=!!e.bridgeInfo?.length,n=!!e.swapInfo?.length,o=t&&n,r=e.pathType==="bridge-swap"?["bridge","swap"]:["swap","bridge"];return p(yr,{children:r.map(a=>{let i=a==="swap"?e.swapInfo:e.bridgeInfo;return i?.length?k("div",{className:"bf-info-section",children:[o&&p("h4",{children:a==="swap"?"Swap Info":"Bridge Info"}),p(ss,{rows:i})]},a):null})})}function Fd({summary:e}){let t=!!e.bridgeInfo?.length,n=!!e.swapInfo?.length,o=!!e.txFee?.length,r=Pd(e,t,n),[a,i]=R.useState(!0),[s,c]=R.useState(!0);return k("div",{className:"bf-details",children:[e.liquidity&&k("section",{className:"bf-liquidity",children:[k("div",{className:"bf-liquidity-head",children:[p("span",{children:e.liquidity.label??"Available Liquidity"}),p("span",{className:"bf-liquidity-status","data-status":e.liquidity.status,children:e.liquidity.status??"Normal"})]}),p("div",{className:"bf-liquidity-track",children:p("span",{style:{width:`${e.liquidity.percentage??50}%`}})})]}),(t||n)&&k("section",{className:"bf-detail-section bf-info-card","data-open":a?"true":"false",children:[k("button",{type:"button",className:"bf-collapse-head","aria-expanded":a,onClick:()=>i(l=>!l),children:[p("h3",{children:r}),p(Xt,{size:16,className:"bf-collapse-chevron"})]}),a&&p("div",{className:"bf-collapse-body",children:p(Bd,{summary:e})})]}),o&&k("section",{className:"bf-detail-section bf-tx-fee-section","data-open":s?"true":"false",children:[k("button",{type:"button",className:"bf-collapse-head bf-tx-fee-head","aria-expanded":s,onClick:()=>c(l=>!l),children:[p("h3",{children:"Est. Tx Fee"}),k("div",{className:"bf-tx-fee-total",children:[e.txFeeInfo?.isDelegateFee&&p("span",{className:"bf-fee-delegated",children:"Fee Delegated"}),e.txFeeInfo?.tokenIconUrl&&p("img",{className:"bf-tx-fee-token",src:e.txFeeInfo.tokenIconUrl,alt:e.txFeeInfo.tokenSymbol??"",width:16,height:16,draggable:!1}),p("span",{"data-delegated":e.txFeeInfo?.isDelegateFee&&Number(e.txFeeInfo?.estTxFee)>0?"true":void 0,children:e.txFeeInfo?.estTxFee??"0"}),p(Xt,{size:16,className:"bf-collapse-chevron"})]})]}),s&&p("div",{className:"bf-collapse-body",children:p(ss,{rows:e.txFee})})]})]})}function Md({item:e}){let t=xo(e),n=gd(e.fromAmount,e.fromToken);return k("article",{className:"bf-history-item",children:[k("div",{className:"bf-history-item-head",children:[p("span",{className:"bf-history-status","data-status":t,children:bd(t)}),p("time",{className:"bf-history-time",dateTime:e.timestamp,children:ud(e.timestamp)})]}),k("div",{className:"bf-history-item-body",children:[k("strong",{className:"bf-history-amount",children:[md(e.fromAmount)," ",e.fromToken.symbol]}),k("div",{className:"bf-history-meta",children:[p("span",{className:"bf-history-usd",children:n??fd(e.txHash)}),k("span",{className:"bf-history-route",children:[k("span",{className:"bf-history-route-token",children:[p(Pn,{token:e.fromToken,size:16}),p("span",{children:e.fromToken.symbol})]}),p(Wa,{size:16,className:"bf-history-route-arrow"}),k("span",{className:"bf-history-route-token",children:[p(Pn,{token:e.toToken,size:16}),p("span",{children:e.toToken.symbol})]})]})]})]})]})}function _d({flow:e}){let[t,n]=R.useState("all"),o=e.history.some(i=>xo(i)==="pending"),r=e.history.filter(i=>hd(i,t)),a=t==="all"?"No bridge history yet.":`No ${t} bridge history.`;return k("main",{className:"bf-history-body",children:[p("nav",{className:"bf-history-tabs","aria-label":"Bridge history filters",children:sd.map(i=>k("button",{type:"button",className:"bf-history-tab","data-active":t===i.value?"true":"false",onClick:()=>n(i.value),children:[p("span",{children:i.label}),i.value==="pending"&&o&&p("span",{className:"bf-history-tab-dot","aria-hidden":"true"})]},i.value))}),r.length>0?p("div",{className:"bf-history-list",children:r.map(i=>p(Md,{item:i},i.id||i.txHash))}):p("div",{className:"bf-empty",children:a})]})}function Od({flow:e,env:t}){let[n,o]=R.useState(null),[r,a]=R.useState(!1),[i,s]=R.useState(0),l=!!(e.fromAmount.trim()||e.toAmount.trim())?e.summary??xd(e):null,d=ad[t],f=wd(e.quoteError),h=e.quoteError&&!f.from&&!f.to?e.quoteError:"",m=e.error||h,y=e.history.some(v=>xo(v)==="pending"),w=(l?.pathType??is(e.fromToken,e.toToken))!=="bridge";return k(yr,{children:[k("main",{className:"bf-body",children:[k("div",{className:"bf-toolbar",children:[k("button",{type:"button",className:"bf-chip bf-chip-history",onClick:()=>e.setStep("history"),children:[p(_a,{}),p("span",{children:"History"}),(y||e.hasNewHistory)&&p("span",{className:"bf-chip-dot","aria-hidden":"true"})]}),w&&k("button",{type:"button",className:"bf-chip",onClick:()=>a(!0),disabled:e.slippageLocked,"aria-haspopup":"dialog","aria-expanded":r,children:[p(Oa,{}),p("span",{children:e.slippageLocked?"Auto 1%":ld(e.slippage,e.effectiveSlippage)})]})]}),k("div",{className:"bf-swap-card","data-has-from-error":f.from?"true":"false",children:[p(es,{label:"From",token:e.fromToken,amount:e.fromAmount,usd:Xa(e.fromAmount,e.fromToken),onAmountChange:v=>e.setAmount(v,"from"),onTokenClick:()=>o("from")}),f.from&&p("div",{className:"bf-field-error",children:f.from}),p("button",{type:"button",className:"bf-swap-toggle",onClick:()=>{e.swapTokens(),s(v=>v+360)},style:{transform:`translateX(-50%) rotate(${i}deg)`,transition:"transform 0.2s ease"},children:p(za,{size:22})}),p(es,{label:"To",token:e.toToken,amount:e.toAmount,usd:Xa(e.toAmount,e.toToken),onAmountChange:v=>e.setAmount(v,"to"),onTokenClick:()=>o("to")}),f.to&&p("div",{className:"bf-field-error",children:f.to})]}),p(Nd,{fromAmount:e.fromAmount,toAmount:e.toAmount,fromToken:e.fromToken,toToken:e.toToken}),l&&p(Fd,{summary:l})]}),k("footer",{className:"bf-footer",children:[p("button",{type:"button",className:"bf-next",onClick:e.submit,disabled:e.status==="submitting"||!!e.quoteError,children:e.status==="submitting"?"Processing...":"Next"}),k("a",{className:"bf-powered",href:d,target:"_blank",rel:"noreferrer",children:["Powered by ",p("span",{className:"bf-powered-brand",children:"CROSS DeFi"})]})]}),n&&p(vd,{flow:e,side:n,onClose:()=>o(null)}),r&&p(yd,{flow:e,onClose:()=>a(!1)}),p(kd,{flow:e}),e.approvalInfo&&p(Cd,{flow:e,approval:e.approvalInfo}),p(Rd,{flow:e}),p(Td,{flow:e}),p(Id,{message:e.submitToast?"":m}),p(Ed,{flow:e})]})}function vo({onClose:e,onBackToWallet:t,env:n,className:o,...r}){let a=R.useMemo(()=>Pe(n),[n]),i=Qa({...r,onExit:t}),s=R.useRef(null),c=id(s),l=i.step==="history"?"History":"Swap & Bridge";return p(ts.Provider,{value:c,children:k("div",{ref:s,className:X("bf-root",o),"data-view":i.step,"data-status":i.status,children:[k("header",{className:"bf-header",children:[p("button",{type:"button",className:"bf-header-btn",onClick:i.back,"aria-label":"Back",children:p(Pt,{size:24})}),p("span",{className:"bf-header-title",children:l}),p("button",{type:"button",className:"bf-header-btn",onClick:e,"aria-label":"Close",children:p(St,{size:24})})]}),i.step==="history"?p(_d,{flow:i}):p(Od,{flow:i,env:a})]})})}import{Fragment as ko,jsx as g,jsxs as N}from"react/jsx-runtime";var Wd="On-ramp is not available in your region.";function kr(e,t,n){let o=Ce[e],r=n.toUpperCase();if(t===o.cross&&r.includes("CROSSD"))return 0;if(t===o.cross&&r==="CROSS")return 1;if(t===o.bsc&&r==="CROSS")return 2}function Dd(e){return parseInt(e.split(":")[1],10)}function Hd(e){let t=e.lastIndexOf(".");return t===-1?{main:e,decimal:""}:{main:e.slice(0,t),decimal:e.slice(t)}}function Gd(e){let t=e.toLowerCase().replace(/^0x/,""),n=t.length>=8?t.slice(0,8):t.padEnd(8,"0"),o=parseInt(n.slice(0,4),16)%360,r=(o+60+parseInt(n.slice(4,8),16)%120)%360;return`linear-gradient(135deg, hsl(${o} 85% 65%), hsl(${r} 80% 55%))`}function ls({align:e="end",sideOffset:t=12,className:n,children:o}){let{env:r,theme:a,isMobile:i,open:s,drawerDirection:c,modal:l,showBalance:d,showForgeToken:f,showGameToken:h,showQR:m,showBridge:y,qrLogoSrc:x,walletAddress:w,accountName:v,sendAccounts:B,profileImageUrl:u,preferredTokens:E,close:C,onSelectWallet:A,onCopyAddress:M,onBuy:Z,onDisconnect:W,disconnectLabel:G,termsUrl:q,termsLabel:O,privacyUrl:ie,privacyLabel:ue,portalStyle:te,navContent:ae,navPosition:De,footerContent:se,view:K,setView:le,selectedSendToken:J,setSelectedSendToken:U,showPortfolio:He,portfolioTitle:pe,showTotalAssets:Ie,totalAssetsLabel:Le,sendTransaction:it,getTransactionReceipt:we,estimateGas:Ft,onOutlink:_e,lpBalanceReader:bt,stakingRewardsReader:Lt,bridgeTokens:ce,bridgeHistory:me,getBridgeQuote:Qe,getBridgeToTokens:xe,getBridgeApproval:ge,approveBridge:he,submitBridge:Mt,onReceive:Ge,onBridge:at,onSend:ve,onBuyDisabledMessage:wt}=Ot(),[xt,Ee]=F.useState(null),st=F.useRef(void 0),Ye=F.useCallback(b=>{Ee(b),clearTimeout(st.current),st.current=setTimeout(()=>Ee(null),4e3)},[]);F.useEffect(()=>()=>clearTimeout(st.current),[]);let ne=!!wt,Ze=F.useCallback(()=>{if(ne){Ye(wt);return}let b=Z?.();b&&typeof b.then=="function"&&b.catch(()=>{Ye(wt??Wd)})},[ne,wt,Z,Ye]),{tokens:ye,isLoading:vt}=Dt(r,w,s&&d),{statsMap:Ue}=Ht(r,d),{categoryMap:yt}=Qi(r,d),kt=d&&Ie,{displayValue:Et,isLowerBound:_t,isLoading:lt}=Yi(r,w,s&&kt),[S,$]=F.useState(!1),ee=F.useRef(null),[ke,At]=F.useState(0),{holdings:Oe,isLoading:Wn}=qi(r,w,s&&d&&f),Bo=F.useMemo(()=>Oe.map(b=>b.token),[Oe]),{imageMap:yn}=Ki(r,Bo,f&&Oe.length>0),Xe=F.useMemo(()=>{let b=[],I=[],j=[],Ae=new Map((E??[]).map((Y,fe)=>[`${Dd(Y.chainId)}:${Y.address.toLowerCase()}`,fe]));for(let Y of ye){let fe=kr(r,Y.chainId,Y.symbol)!==void 0,Qt=`${Y.chainId}:${Y.address.toLowerCase()}`,Yt=Ae.get(Qt),Ho=new Bn(Y.quantity.numeric).shiftedBy(-Y.quantity.decimals);if(fe)b.push(Y);else if(Yt!==void 0)I.push(Y);else if(Ho.isGreaterThan(0)){if(!h&&yt.get(dr(Y.chainId,Y.address))==="game")continue;j.push(Y)}}return b.sort((Y,fe)=>{let Qt=kr(r,Y.chainId,Y.symbol)??99,Yt=kr(r,fe.chainId,fe.symbol)??99;return Qt-Yt}),I.sort((Y,fe)=>{let Qt=Ae.get(`${Y.chainId}:${Y.address.toLowerCase()}`)??99,Yt=Ae.get(`${fe.chainId}:${fe.address.toLowerCase()}`)??99;return Qt-Yt}),j.sort((Y,fe)=>{let Qt=Ue.get(ft(Y.chainId,Y.address)),Yt=Ue.get(ft(fe.chainId,fe.address)),Ho=new Bn(Y.quantity.numeric).shiftedBy(-Y.quantity.decimals).multipliedBy(Qt?.price??0);return new Bn(fe.quantity.numeric).shiftedBy(-fe.quantity.decimals).multipliedBy(Yt?.price??0).minus(Ho).toNumber()}),[...b,...I,...j]},[ye,r,Ue,h,yt,E]),Dn=F.useMemo(()=>{if(!f)return[];let b=new Set(ye.map(I=>I.address.toLowerCase()));return[...Oe].filter(I=>!b.has(I.token.toLowerCase())).sort((I,j)=>{let Ae=new Bn(I.value);return new Bn(j.value).minus(Ae).toNumber()})},[Oe,f,ye]),L=F.useRef(!1),[Q,H]=F.useState(null),re=F.useRef(void 0),Hn=Q?.chainId??J?.chainId??Xe[0]?.chainId??0,{transactionUrl:Fo}=Xn(r,Hn,Q?.txHash,!!(Q?.txHash&&Hn)),$e=F.useCallback(b=>{L.current=!0,le(b)},[le]),[_s,Mo]=F.useState("recipient"),Gn=F.useCallback(()=>{U(null),Mo("recipient"),$e("wallet")},[U,$e]),_o=F.useCallback((b,I="recipient")=>{Mo(I),U(b),$e("send")},[U,$e]),Os=F.useCallback(()=>{if(at){at();return}$e("bridge")},[at,$e]),zs=F.useCallback(b=>{clearTimeout(re.current),U(null),$e("wallet"),H({status:"pending",txHash:b.txHash,chainId:b.chainId,description:`${b.amount} ${b.tokenSymbol} to ${Ve(b.recipient)}`})},[U,$e]),Ws=F.useCallback(b=>{let I=J?.chainId;U(null),$e("wallet"),!(!b||!I)&&(H(j=>({status:"success",txHash:b,chainId:I,description:j?.txHash===b?j.description:"Tap to see your transaction"})),clearTimeout(re.current),re.current=setTimeout(()=>H(null),5e3))},[J?.chainId,U,$e]),Ds=F.useCallback(b=>{let I=b.txHash;I&&(H({status:"error",txHash:I,chainId:b.chainId,description:b.message}),clearTimeout(re.current),re.current=setTimeout(()=>H(null),5e3))},[]),Oo=F.useMemo(()=>{if(Ge)return Ge;if(m)return()=>$e("qr")},[Ge,m,$e]),Ir=F.useMemo(()=>{if(ve)return ve;if(Xe.length===0)return;let b=Xe[0];return()=>_o(b,"token")},[ve,Xe,_o]);F.useEffect(()=>{s||(L.current=!1,Mo("recipient"))},[s]);let Lr=F.useRef(null);F.useEffect(()=>{let b=Lr.current;if(!b||!i)return;let I=j=>{j.pointerType==="touch"&&j.stopPropagation()};return b.addEventListener("pointerdown",I),()=>b.removeEventListener("pointerdown",I)},[i]);let[an,Er]=F.useState(!1),zo=F.useRef(void 0),[kn,Un]=F.useState(!1);F.useEffect(()=>{if(!kn)return;let b=()=>Un(!1),I=Ae=>{Ae.key==="Escape"&&Un(!1)},j=setTimeout(()=>{document.addEventListener("mousedown",b,!0),document.addEventListener("keydown",I,!0)},0);return()=>{clearTimeout(j),document.removeEventListener("mousedown",b,!0),document.removeEventListener("keydown",I,!0)}},[kn]),F.useEffect(()=>()=>clearTimeout(zo.current),[]),F.useEffect(()=>()=>clearTimeout(re.current),[]),F.useEffect(()=>{let b=ee.current;if(!b||se===null){At(0);return}let I=()=>{At(b.offsetHeight)};if(I(),typeof ResizeObserver>"u")return;let j=new ResizeObserver(I);return j.observe(b),()=>j.disconnect()},[se]);let Ar=F.useCallback(async()=>{if(!an)try{await navigator.clipboard.writeText(w),Er(!0),clearTimeout(zo.current),zo.current=setTimeout(()=>Er(!1),2e3),M?.(w,!0)}catch{M?.(w,!1)}},[w,M,an]),$n=F.useCallback(b=>{b.currentTarget.setAttribute("data-loaded","true")},[]),Pr=F.useMemo(()=>({background:Gd(w)}),[w]),jn=F.useMemo(()=>u||tn(r,w,{size:120,bg:a==="dark"?"1A1A2E":"F3F6F8"}),[u,r,w,a]),Wo=F.useMemo(()=>Hd(Et),[Et]),Br=q||ie?N("div",{className:"wi-legal-links",children:[q&&g("a",{className:"wi-legal-link",href:q,target:"_blank",rel:"noopener noreferrer",onClick:b=>qe(b,q,{category:"terms",origin:"terms"},_e),children:O}),q&&ie&&g("span",{className:"wi-legal-sep","aria-hidden":!0,children:"\xB7"}),ie&&g("a",{className:"wi-legal-link",href:ie,target:"_blank",rel:"noopener noreferrer",onClick:b=>qe(b,ie,{category:"privacy",origin:"privacy"},_e),children:ue})]}):null,Fr=W?N("button",{type:"button",className:"wi-disconnect-btn",onClick:()=>{W(),C()},children:[g(ti,{size:16}),g("span",{className:"wi-disconnect-label",children:G})]}):null,Hs=d&&!ae?N("div",{className:"wi-action-row","aria-label":"Wallet actions",children:[N("button",{type:"button",className:X("wi-action-card",ne&&"wi-action-card--dimmed"),onClick:Ze,disabled:!Z&&!ne,"aria-disabled":ne||void 0,"aria-label":"Buy",children:[g(si,{size:20}),g("span",{children:"Buy"})]}),y?N("button",{type:"button",className:"wi-action-card",onClick:Os,"aria-label":"Bridge",children:[g(li,{size:20}),g("span",{children:"Bridge"})]}):N("button",{type:"button",className:"wi-action-card",onClick:Oo,disabled:!Oo,"aria-label":"Receive",children:[g(Qo,{size:20}),g("span",{children:"Receive"})]}),N("button",{type:"button",className:"wi-action-card",onClick:Ir,disabled:!Ir,"aria-label":"Send",children:[g(ii,{size:20}),g("span",{children:"Send"})]}),N("button",{type:"button",className:"wi-action-card",onClick:()=>$e("portfolio"),disabled:!He,"aria-label":"View portfolio",children:[g(ai,{size:20}),g("span",{children:"Portfolio"})]})]}):null,Gs=N("div",{className:X("wi-view-inner",L.current&&"wi-view-wallet"),children:[kt&&N("div",{className:"wi-total-section",children:[N("div",{className:"wi-total-head",children:[g("span",{className:"wi-total-label",children:Le}),g("span",{role:"button",tabIndex:0,className:"wi-total-eye",onClick:b=>{b.stopPropagation(),$(I=>!I)},onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),b.stopPropagation(),$(I=>!I))},"aria-label":S?"Show balance":"Hide balance",children:S?g(oi,{}):g(ni,{})})]}),g("div",{className:"wi-total-body",children:lt?g("div",{className:"wi-skeleton-block wi-total-skeleton",style:{width:160,height:42}}):g("div",{className:"wi-total-value","data-hidden":S||void 0,children:S?g("span",{className:"wi-total-mask",children:"\u2022\u2022\u2022\u2022\u2022\u2022"}):N(ko,{children:[_t&&g("span",{className:"wi-total-lte",children:"\u2264"}),g("span",{className:"wi-total-currency",children:"$"}),g("span",{className:"wi-total-amount",children:Wo.main}),Wo.decimal&&g("span",{className:"wi-total-decimal",children:Wo.decimal})]})})})]}),De==="top"&&(ae?g("div",{className:"wi-nav-fixed",children:ae}):Hs),d&&g("div",{ref:Lr,className:"wi-scrollable-body","data-vaul-no-drag":!0,children:N("div",{className:"wi-token-list",children:[vt&&Array.from({length:5},(b,I)=>N("div",{className:"wi-skeleton-item",children:[N("div",{className:"wi-skeleton-left",children:[g("div",{className:"wi-skeleton-block wi-skeleton-icon"}),N("div",{className:"wi-skeleton-lines",children:[g("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),g("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),N("div",{className:"wi-skeleton-right",children:[g("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),g("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},I)),!vt&&Xe.length===0&&!f&&g("div",{className:"wi-empty",children:"No Tokens Found"}),Xe.map(b=>{let I=Ue.get(ft(b.chainId,b.address)),j=I?parseFloat(I.percent_change_24h):null,Ae=j!==null&&j>=0,Y=Ln(r,b.chainId);return N("button",{type:"button",className:"wi-token-item wi-token-item--button",onClick:()=>_o(b),"aria-label":`Send ${b.symbol}`,children:[N("div",{className:"wi-token-left",children:[N("div",{className:"wi-token-icon-wrap",children:[g("img",{src:b.icon_url,alt:b.symbol,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:$n,onError:fe=>{fe.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),Y&&g("img",{src:Y,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:fe=>{fe.currentTarget.style.display="none"}})]}),N("div",{className:"wi-token-info",children:[g("span",{className:"wi-token-name",children:b.symbol}),I&&N("div",{className:"wi-token-price-row",children:[g("span",{className:"wi-token-price",children:Yo(I.price)}),g("span",{className:"wi-token-change","data-positive":Ae,"data-zero":j===0||void 0,children:j!==null&&(j===0?"0%":`${Ae?"+":"-"}${(Ae?Math.floor:Math.ceil)(Math.abs(j)*100)/100}%`)})]})]})]}),N("div",{className:"wi-token-right",children:[g("span",{className:"wi-token-balance",children:zt(b.quantity.numeric,b.quantity.decimals)}),I&&g("span",{className:"wi-token-value",children:di(b.quantity.numeric,b.quantity.decimals,I.price)})]})]},`${b.address}-${b.chainId}`)}),f&&Wn&&Array.from({length:3},(b,I)=>N("div",{className:"wi-skeleton-item",children:[N("div",{className:"wi-skeleton-left",children:[g("div",{className:"wi-skeleton-block wi-skeleton-icon"}),N("div",{className:"wi-skeleton-lines",children:[g("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),g("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),N("div",{className:"wi-skeleton-right",children:[g("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),g("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},`forge-sk-${I}`)),f&&!Wn&&!vt&&Xe.length===0&&Dn.length===0&&g("div",{className:"wi-empty",children:"No Tokens Found"}),f&&Dn.map(b=>{let I=yn.get(b.token)||"",j=Ln(r,Ce[r].cross);return N("div",{className:"wi-token-item",children:[N("div",{className:"wi-token-left",children:[N("div",{className:"wi-token-icon-wrap",children:[g("img",{src:I||"https://contents.crosstoken.io/wallet/token/images/FT.png",alt:b.token_name,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:$n,onError:Ae=>{Ae.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),j&&g("img",{src:j,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:Ae=>{Ae.currentTarget.style.display="none"}})]}),N("div",{className:"wi-token-info",children:[g("span",{className:"wi-token-name",children:b.token_name}),g("div",{className:"wi-token-price-row",children:N("span",{className:"wi-token-price",children:[zt(b.current_price,18)," CROSS"]})})]})]}),N("div",{className:"wi-token-right",children:[g("span",{className:"wi-token-balance",children:zt(b.balance,18)}),g("span",{className:"wi-token-value",children:Yo(b.current_value_usd)})]})]},`forge-${b.token}`)})]})}),De==="bottom"&&ae&&g("div",{className:"wi-nav-fixed",children:ae}),Fr&&g("div",{className:"wi-wallet-disconnect-row",children:Fr})]},"wallet"),Us=He?g("div",{className:X("wi-view-inner wi-portfolio-body",L.current&&"wi-view-portfolio"),children:g(bn,{env:r,theme:a,walletAddress:w,showHeader:!1,onOutlink:_e,lpBalanceReader:bt,stakingRewardsReader:Lt})},"portfolio"):null,$s=J?g("div",{className:X("wi-view-inner wi-send-body",L.current&&"wi-view-send"),children:g(lo,{env:r,theme:a,walletAddress:w,accountName:v,accounts:B,initialStep:_s,token:J,tokens:Xe,onTokenChange:U,sendTransaction:it,getTransactionReceipt:we,estimateGas:Ft,getTokenPriceUsd:b=>{let I=Ue.get(ft(b.chainId,b.address));if(!I?.price)return;let j=parseFloat(I.price);return Number.isFinite(j)?j:void 0},onClose:C,onBackToWallet:Gn,onSubmitted:zs,onSuccess:Ws,onFailed:Ds,onOutlink:_e})},"send"):null,js=F.useMemo(()=>ce||Xe.map(b=>{let I=Ue.get(ft(b.chainId,b.address)),j=I?.price?parseFloat(I.price):void 0;return{name:b.name,symbol:b.symbol,chainId:b.chainId,address:b.address,decimals:b.quantity.decimals,balance:Tn(b.quantity.numeric,b.quantity.decimals),iconUrl:b.icon_url,priceUsd:Number.isFinite(j)?j:void 0}}),[ce,Ue,Xe]),Vs=g("div",{className:X("wi-view-inner wi-bridge-body",L.current&&"wi-view-send"),children:g(vo,{env:r,walletAddress:w,tokens:js,history:me,termsUrl:q,getQuote:Qe,getToTokens:xe,getApproval:ge,approveBridge:he,submitBridge:Mt,onClose:C,onBackToWallet:Gn})},"bridge"),Do=!!A&&v?.trim().toLowerCase()!=="my wallet",Mr=N(ko,{children:[N("span",{className:"wi-receive-avatar",children:[g("span",{className:"wi-avatar-fallback",style:Pr}),jn&&g("img",{src:jn,alt:"",className:"wi-avatar-img",width:24,height:24,draggable:!1,onLoad:$n,onError:b=>{b.currentTarget.style.display="none"}})]}),g("span",{className:"wi-receive-account-name",children:v??"Account 1"}),Do&&g("span",{className:"wi-receive-chevron","data-open":kn,"aria-hidden":"true",children:g(Xt,{size:16})})]}),qs=N("div",{className:X("wi-view-inner wi-qr-body",L.current&&"wi-view-qr"),children:[N("div",{className:"wi-receive-section",children:[Do?g("button",{type:"button",className:"wi-receive-account wi-receive-account--btn",onClick:()=>{Un(!0),A?.()},"aria-label":"Switch account",children:Mr}):g("div",{className:"wi-receive-account",children:Mr}),N("div",{className:"wi-qr-block",children:[N("div",{className:"wi-qr-box",children:[g(zd,{value:w,size:180,level:"H",marginSize:2,...x&&{imageSettings:{src:x,height:33,width:33,excavate:!0}}}),!x&&g("div",{className:"wi-qr-logo",children:g(ri,{size:33})})]}),g("p",{className:"wi-qr-address",children:w})]}),N("button",{type:"button",className:"wi-qr-copy-btn",onClick:Ar,children:[g("span",{className:"wi-qr-copy-icon",children:an?g(Cn,{size:16}):g(Ko,{size:16})}),g("span",{className:"wi-qr-copy-text",children:an?"Copied!":"Copy address"})]})]}),Br&&g("div",{className:"wi-receive-footer",children:Br})]},"qr"),Ks=K==="qr"||K==="portfolio"||K==="send"||K==="bridge",_r=se!==null?g("div",{className:"wi-builtin-footer",children:se}):null,Or=N("div",{className:"wi-account-text",children:[Do?N("button",{type:"button",className:"wi-account-row wi-account-row--btn",onClick:()=>{Un(!0),A?.()},"aria-label":"Switch account","aria-expanded":kn,children:[g("span",{className:"wi-account-name",children:v??"Account 1"}),g("span",{className:"wi-account-switch","data-open":kn,"aria-hidden":"true",children:g(Xt,{size:20})})]}):g("div",{className:"wi-account-row",children:g("span",{className:"wi-account-name",children:v??"Account 1"})}),N("button",{type:"button",className:"wi-address-row-btn",onClick:Ar,"aria-label":"Copy address",children:[g("span",{className:"wi-account-address",children:Ve(w)}),g("span",{className:"wi-account-copy","data-copied":an,children:an?g(Cn,{size:12}):g(Ko,{size:12})})]})]}),zr=N(ko,{children:[o,K==="qr"?g("div",{className:"wi-sticky-header",children:N("div",{className:"wi-header wi-header--receive",children:[g("button",{type:"button",className:"wi-header-back",onClick:Gn,"aria-label":"Back",children:g(Pt,{size:24})}),g("span",{className:"wi-receive-title",children:"Receive"}),g("button",{type:"button",className:"wi-header-action",onClick:C,"aria-label":"Close",children:g(St,{size:24})})]})}):K==="send"||K==="bridge"?null:Ks?N("div",{className:"wi-sticky-header",children:[N("div",{className:"wi-header wi-header--wallet wi-header--sub-account",children:[g("button",{type:"button",className:"wi-header-back",onClick:Gn,"aria-label":"Back",children:g(Pt,{size:24})}),g("div",{className:"wi-account-block wi-account-block--sub-account",children:Or}),g("button",{type:"button",className:"wi-header-action",onClick:C,"aria-label":"Close",children:g(St,{size:24})})]}),g("hr",{className:"wi-divider"})]}):N("div",{className:"wi-sticky-header",children:[N("div",{className:"wi-header wi-header--wallet",children:[N("div",{className:"wi-account-block",children:[N("div",{className:"wi-avatar",children:[g("div",{className:"wi-avatar-fallback",style:Pr}),jn&&g("img",{src:jn,alt:"",className:"wi-avatar-img",width:28,height:28,draggable:!1,onLoad:$n,onError:b=>{b.currentTarget.style.display="none"}})]}),Or]}),N("div",{className:"wi-header-actions",children:[m&&y&&g("button",{type:"button",className:"wi-header-action wi-header-action--qr",onClick:Oo,"aria-label":"Show QR code",children:g(Qo,{size:20})}),g("button",{type:"button",className:"wi-header-action",onClick:C,"aria-label":"Close",children:g(St,{size:24})})]})]}),g("hr",{className:"wi-divider"})]}),N("div",{className:"wi-view-container",children:[K==="wallet"&&Gs,K==="qr"&&qs,K==="portfolio"&&Us,K==="send"&&$s,K==="bridge"&&Vs]}),K==="wallet"&&xt&&g("div",{className:"wi-action-toast",role:"status","aria-live":"polite",children:xt}),K==="wallet"&&Q&&N("a",{className:"wi-send-toast",href:Fo??"#",target:"_blank",rel:"noopener noreferrer",onClick:b=>{if(!Fo){b.preventDefault();return}qe(b,Fo,{category:"send",origin:"send-transaction",payload:{chainId:Q.chainId,txHash:Q.txHash}},_e)},children:[g("span",{className:"wi-send-toast-icon","data-status":Q.status,"aria-hidden":!0,children:Q.status==="pending"?g("span",{className:"wi-send-toast-spinner"}):Q.status==="error"?g("span",{className:"wi-send-toast-error-dot"}):g(ci,{size:20})}),N("span",{className:"wi-send-toast-copy",children:[g("span",{className:"wi-send-toast-title",children:Q.status==="pending"?"Sending...":Q.status==="error"?"Send failed":"Send complete"}),g("span",{className:"wi-send-toast-desc",children:Q.status==="pending"||Q.status==="error"?Q.description:"Tap to see your transaction"})]})]}),_r&&K!=="portfolio"&&K!=="send"&&g("div",{className:"wi-sticky-footer",children:g("div",{className:"wi-footer",ref:ee,children:_r})})]}),Wr={...te,...ke>0?{"--wi-footer-height":`${ke}px`}:null};return i?N(yo.Portal,{children:[l&&g(yo.Overlay,{className:"wi-drawer-overlay"}),N(yo.Content,{className:X("wi-drawer-content",n),"data-theme":a,"data-vaul-no-drag":c==="left"||c==="right"?!0:void 0,style:Wr,"data-direction":c,"data-no-balance":!d||void 0,"data-has-footer":ke>0||void 0,"data-view":K,children:[g(yo.Title,{className:"wi-sr-only",children:"My Wallet"}),zr]})]}):N(ko,{children:[l&&s&&g("div",{className:"wi-drawer-overlay",onClick:C}),g(So.Portal,{children:g(So.Content,{align:e,sideOffset:t,className:X("wi-popover-content",n),"data-theme":a,style:Wr,"data-no-balance":!d||void 0,"data-has-footer":ke>0||void 0,"data-view":K,children:zr})})]})}import*as cs from"react";function ds({position:e="top",children:t}){let{setNavContent:n,setNavPosition:o}=Ot();return cs.useEffect(()=>(n(t),o(e),()=>n(null)),[t,e,n,o]),null}import*as ps from"react";function fs({children:e}){let{setFooterContent:t}=Ot();return ps.useEffect(()=>(t(e),()=>t(null)),[e,t]),null}_(`[data-theme=dark].wi-popover-content,[data-theme=dark].wi-drawer-content{--wi-primary: var(--ds-accent-primary-default, #019d92);--wi-secondary: var(--ds-system-red-default, #e70077);--wi-surface-bg: var(--ds-bg-default, #121212);--wi-surface-default: var(--ds-surface-medium, rgba(255, 255, 255, .05));--wi-surface-subtle: var(--ds-surface-high, rgba(255, 255, 255, .1));--wi-border-default: var(--ds-border-default, rgba(255, 255, 255, .05));--wi-border-subtle: var(--ds-border-medium, rgba(255, 255, 255, .1));--wi-texticon-primary: var(--ds-content-highest, #ffffff);--wi-texticon-secondary: var(--ds-content-medium, rgba(255, 255, 255, .7));--wi-texticon-tertiary: var(--ds-content-low, rgba(255, 255, 255, .5));--wi-on-primary: var(--ds-accent-primary-on, #ffffff);--wi-error: var(--ds-system-red-default, #e70077);--wi-shadow: 0 2px 16px -2px rgba(0, 0, 0, .4)}[data-theme=light].wi-popover-content,[data-theme=light].wi-drawer-content{--wi-primary: var(--ds-accent-primary-default, #019d92);--wi-secondary: var(--ds-system-red-default, #e70077);--wi-surface-bg: var(--ds-bg-default, #ffffff);--wi-surface-default: var(--ds-surface-medium, rgba(18, 18, 18, .05));--wi-surface-subtle: var(--ds-surface-high, rgba(18, 18, 18, .1));--wi-border-default: var(--ds-border-default, rgba(18, 18, 18, .05));--wi-border-subtle: var(--ds-border-medium, rgba(18, 18, 18, .1));--wi-texticon-primary: var(--ds-content-highest, #121212);--wi-texticon-secondary: var(--ds-content-medium, rgba(18, 18, 18, .7));--wi-texticon-tertiary: var(--ds-content-low, rgba(18, 18, 18, .5));--wi-on-primary: var(--ds-accent-primary-on, #ffffff);--wi-error: var(--ds-system-red-default, #e70077);--wi-shadow: 0 2px 16px -2px rgba(0, 0, 0, .15)}
11
- `);_(`.wi-trigger-btn{display:inline-flex;align-items:center;gap:8px;padding:8px 16px;border:1px solid rgba(255,255,255,.2);background:#1a2332;border-radius:9999px;cursor:pointer;color:#fff;font-family:inherit;font-size:16px;font-weight:500;line-height:24px;letter-spacing:-.3125px;transition:opacity .15s ease}.wi-trigger-btn:hover{opacity:.85}.wi-trigger-btn[data-theme=light]{background:#f3f6f8;border-color:#1212121a;color:#121212}.wi-trigger-btn[data-mobile]{font-size:14px;padding:6px 12px;gap:6px;line-height:20px}.wi-trigger-address{white-space:nowrap}.wi-divider{height:1px;background:var(--wi-border-default);margin:0;border:none;flex-shrink:0}[data-theme=light] .wi-divider{background:#1212121a}[data-theme=dark] .wi-divider{background:#ffffff1a}
12
- `);_(`@keyframes wi-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@keyframes wi-shimmer{0%{transform:translate(-100%)}to{transform:translate(100%)}}@keyframes wi-slide-in-right{0%{transform:translate(40px);opacity:0}to{transform:translate(0);opacity:1}}@keyframes wi-slide-in-left{0%{transform:translate(-40px);opacity:0}to{transform:translate(0);opacity:1}}
13
- `);_(`.wi-popover-content{-webkit-font-smoothing:antialiased;z-index:100001;width:393px;border-radius:24px;border:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));background:var(--wi-surface-bg);box-shadow:var(--ds-shadow-modal, var(--wi-shadow));animation:wi-fade-in .15s ease-out;height:600px;overflow:hidden;display:flex;flex-direction:column}.wi-popover-content[data-no-balance]{height:auto}.wi-popover-content[data-has-footer]:not([data-no-balance]){height:min(calc(600px + var(--wi-footer-height, 0px)),calc(100dvh - 32px))}.wi-drawer-overlay{position:fixed;inset:0;z-index:100000;background:#0009}.wi-drawer-content{-webkit-font-smoothing:antialiased;position:fixed;top:0;right:0;bottom:0;z-index:100001;width:100vw;max-height:100vh;background:var(--wi-surface-bg);overflow:hidden;display:flex;flex-direction:column;box-sizing:border-box}.wi-drawer-content[data-no-balance]{bottom:auto;max-height:none}.wi-drawer-content[data-no-balance][data-direction=bottom]{bottom:0;top:auto;border-radius:24px 24px 0 0}.wi-drawer-content[data-direction=left]{right:auto;left:0}.wi-drawer-content[data-direction=bottom]{top:0;left:0;right:0;width:100%;max-height:100dvh;margin:0 auto}.wi-drawer-content[data-direction=bottom][data-view=qr]{max-height:100dvh}.wi-popover-content[data-view=qr]{max-height:calc(100dvh - 32px)}.wi-sticky-header{flex-shrink:0;position:relative}.wi-header{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:24px}.wi-header--wallet{align-items:flex-start;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.wi-header--wallet+.wi-divider{display:none}.wi-header--sub-account{align-items:center}.wi-header--sub-account .wi-header-back{width:32px;height:38px}.wi-header--sub-account .wi-header-action{flex-shrink:0}.wi-account-block{display:flex;align-items:center;gap:8px;flex:1;min-width:0}.wi-account-block--sub-account{align-items:center}.wi-avatar{flex-shrink:0;position:relative;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border-radius:50%;background:var(--wi-surface-bg);box-sizing:border-box;overflow:hidden}.wi-avatar-fallback{position:absolute;inset:0;border-radius:50%;z-index:0}.wi-avatar-img{position:relative;z-index:1;width:32px;height:32px;border-radius:50%;object-fit:cover;background:transparent}.wi-account-text{display:flex;flex-direction:column;gap:2px;min-width:0}.wi-account-row{display:flex;align-items:center;gap:8px;min-width:0}.wi-account-row--btn{padding:2px;margin:0;width:fit-content;border:none;background:transparent;cursor:pointer;color:inherit;font:inherit;border-radius:6px;transition:background-color .15s ease,opacity .15s ease}.wi-account-row--btn:hover{background:var(--wi-surface-subtle, rgba(255, 255, 255, .06))}.wi-account-row--btn:focus-visible{outline:2px solid var(--wi-primary, #00d5aa);outline-offset:2px}.wi-account-name{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wi-account-switch{display:inline-flex;align-items:center;justify-content:center;padding:2px 0;border:none;background:transparent;color:var(--ds-content-low, rgba(0, 0, 0, .4));border-radius:4px;flex-shrink:0;transition:color .15s ease,transform .2s ease}.wi-account-switch[data-open=true]{transform:rotate(180deg)}.wi-account-row--btn:hover .wi-account-switch{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-address-row-btn{display:inline-flex;align-items:center;gap:4px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--ds-content-medium, rgba(0, 0, 0, .65));font:inherit;text-align:left;min-width:0;transition:color .15s ease}.wi-address-row-btn:hover .wi-account-address,.wi-address-row-btn:hover .wi-account-copy{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-account-address{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:12px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wi-account-copy{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;color:var(--wi-texticon-tertiary);flex-shrink:0;transition:color .15s ease}.wi-account-copy[data-copied=true]{color:var(--ds-system-green-high, #00a869)}.wi-header-actions{display:flex;align-items:center;gap:16px;flex-shrink:0;margin-top:-4px}.wi-header-action{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;background:transparent;border-radius:0;cursor:pointer;color:var(--ds-content-low, rgba(0, 0, 0, .4));flex-shrink:0;transition:color .15s ease}.wi-header-action:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-header-action--qr{width:32px;height:32px;border-radius:8px;background:var(--ds-surface-medium, #f5f7fa);color:var(--ds-content-medium, rgba(0, 0, 0, .65));transition:background-color .15s ease,color .15s ease}.wi-header-action--qr:hover{background:var(--ds-surface-high, rgba(0, 0, 0, .08));color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-header--receive{align-items:center;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.wi-header--receive .wi-header-action,.wi-header--sub-account .wi-header-action{position:absolute;top:24px;right:24px}.wi-receive-title{position:absolute;left:50%;transform:translate(-50%);font-family:inherit;font-size:18px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);text-align:center;pointer-events:none}.wi-header-info{flex:1;display:flex;flex-direction:column;gap:8px;min-width:0}.wi-header-title{font-family:inherit;font-size:16px;font-weight:600;line-height:1.3;color:var(--wi-texticon-primary);margin:0}.wi-header-close{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;padding:0;border:none;background:var(--wi-surface-default);border-radius:8px;cursor:pointer;color:var(--ds-content-low, #00000066);transition:opacity .15s ease}.wi-header-close:hover{opacity:.7}.wi-total-section{margin:24px 24px 0;padding:0;flex-shrink:0;display:flex;flex-direction:column;gap:8px;border:none;background:transparent;border-radius:12px;color:inherit;font:inherit;text-align:left;width:auto}.wi-action-row{display:flex;align-items:flex-start;gap:8px;width:auto;margin:24px 24px 0}.wi-action-card{appearance:none;display:flex;flex:1 1 0;min-width:0;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:10px 8px;border:none;border-radius:12px;background:var(--ds-surface-medium, #f5f7fa);color:var(--ds-content-high, rgba(0, 0, 0, .85));font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;text-align:center;cursor:pointer;transition:background-color .15s ease,color .15s ease}.wi-action-card:hover:not(:disabled){background:#2e3544!important;color:var(--ds-content-high, rgba(0, 0, 0, .85))}:root[data-ds-theme=light] .wi-action-card:hover:not(:disabled){background:#e4e8ef!important;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-action-card:disabled{cursor:default}.wi-action-card>svg{flex-shrink:0}.wi-action-card:not(:disabled){transition:background-color .15s ease,transform .1s ease}.wi-action-card:active:not(:disabled){transform:scale(.93)}.wi-total-head{display:flex;align-items:center;gap:4px}.wi-total-body{display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0}.wi-total-label{font-family:inherit;font-size:14px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.wi-total-eye{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;color:var(--ds-content-low, rgba(0, 0, 0, .4));cursor:pointer;transition:color .15s ease;border-radius:4px}.wi-total-eye:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-total-eye:focus-visible{outline:1px solid var(--wi-texticon-secondary);outline-offset:2px}.wi-total-value{display:flex;align-items:baseline;gap:0;font-family:inherit;font-weight:600;line-height:1.25;color:var(--ds-content-highest, #000000);font-variant-numeric:tabular-nums;min-height:45px;white-space:nowrap}.wi-total-currency,.wi-total-amount,.wi-total-decimal{font-size:36px;color:var(--ds-content-highest, #000000)}.wi-total-lte{margin-right:2px;font-weight:500;font-size:22px;color:var(--wi-texticon-secondary)}.wi-total-mask{letter-spacing:2px;font-size:32px;color:var(--wi-texticon-secondary)}.wi-total-skeleton{border-radius:6px}.wi-scrollable-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;padding:8px 0 0;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.15) transparent;overscroll-behavior:contain}.wi-drawer-content .wi-scrollable-body{touch-action:pan-y}[data-theme=light] .wi-scrollable-body{scrollbar-color:rgba(0,0,0,.12) transparent}.wi-scrollable-body::-webkit-scrollbar{width:4px}.wi-scrollable-body::-webkit-scrollbar-track{background:transparent}.wi-scrollable-body::-webkit-scrollbar-thumb{background:#ffffff26;border-radius:4px}.wi-scrollable-body::-webkit-scrollbar-thumb:hover{background:#ffffff40}[data-theme=light] .wi-scrollable-body::-webkit-scrollbar-thumb{background:#0000001f}[data-theme=light] .wi-scrollable-body::-webkit-scrollbar-thumb:hover{background:#0003}.wi-nav-fixed{flex-shrink:0;padding:0 24px}.wi-token-list{display:flex;flex-direction:column;gap:0;padding:8px 0}.wi-token-item{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px 24px;border:none;background:transparent;text-align:left;font-family:inherit;width:100%;box-sizing:border-box}.wi-token-item--button{cursor:pointer;background:var(--ds-surface-default, #ffffff);transition:none}.wi-token-item--button:hover{background:#252b39!important}:root[data-ds-theme=light] .wi-token-item--button:hover{background:#eff3f8!important}button.wi-token-item:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px;border-radius:4px}.wi-token-left{display:flex;align-items:center;gap:16px;min-width:0}.wi-token-icon-wrap{position:relative;width:40px;height:40px;flex-shrink:0}.wi-token-icon{width:40px;height:40px;border-radius:0;object-fit:contain;opacity:0;transition:opacity .2s ease}.wi-token-icon[data-loaded=true]{opacity:1}.wi-token-chain-badge{position:absolute;right:0;bottom:0;width:14px;height:14px;border-radius:50%;background:var(--wi-surface-bg);box-shadow:0 0 0 1.5px var(--wi-surface-bg);object-fit:contain}.wi-token-info{display:flex;flex-direction:column;min-width:0}.wi-token-name{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.wi-token-price-row{display:flex;align-items:center;gap:8px}.wi-token-price{font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4));white-space:nowrap}.wi-token-change{font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;white-space:nowrap}.wi-token-change[data-positive=true]{color:var(--ds-system-green-high, #00a0a2)}.wi-token-change[data-positive=false]{color:var(--ds-system-red-high, #a80927)}.wi-token-change[data-zero]{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.wi-token-right{display:flex;flex-direction:column;align-items:flex-end;flex-shrink:0}.wi-token-balance{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);white-space:nowrap}.wi-token-value{font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4));white-space:nowrap}.wi-sticky-footer{flex-shrink:0}.wi-footer{padding:16px 24px 24px}.wi-builtin-footer{display:flex;flex-direction:column;gap:8px;align-items:stretch}.wi-wallet-disconnect-row{display:flex;justify-content:flex-end;flex-shrink:0;padding:16px 24px;border-top:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.wi-send-toast{position:absolute;left:15px;right:15px;bottom:20px;z-index:2;display:flex;align-items:center;gap:12px;min-height:52px;padding:12px;border-radius:12px;background:var(--ds-surface-inverted, #1e232e);color:var(--ds-content-inverted, #ffffff);box-sizing:border-box;text-decoration:none}.wi-action-toast{position:absolute;left:15px;right:15px;bottom:20px;z-index:3;padding:12px 14px;border-radius:12px;background:var(--ds-surface-inverted, #1e232e);color:var(--ds-content-inverted, #ffffff);font-size:14px;line-height:1.4;text-align:center;box-sizing:border-box;animation:wi-action-toast-in .18s ease-out}.wi-popover-content:has(.wi-wallet-disconnect-row) .wi-action-toast,.wi-drawer-content:has(.wi-wallet-disconnect-row) .wi-action-toast{bottom:72px}@keyframes wi-action-toast-in{0%{transform:translateY(8px);opacity:0}to{transform:translateY(0);opacity:1}}.wi-action-card--dimmed{opacity:.4;cursor:pointer}.wi-action-card--dimmed:hover{opacity:.5}.wi-popover-content:has(.wi-wallet-disconnect-row) .wi-send-toast,.wi-drawer-content:has(.wi-wallet-disconnect-row) .wi-send-toast{bottom:72px}.wi-send-toast:hover{opacity:.92}.wi-send-toast-icon{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;flex-shrink:0;color:var(--ds-accent-primary-default, #00b4b7)}.wi-send-toast-spinner{width:18px;height:18px;border:2px solid rgba(0,232,201,.22);border-top-color:var(--ds-accent-primary-on-inverted, #00e8c9);border-radius:50%;animation:wi-send-toast-spin .8s linear infinite}.wi-send-toast-error-dot{width:18px;height:18px;border-radius:50%;background:var(--ds-system-red-default, #ff3358)}@keyframes wi-send-toast-spin{to{transform:rotate(360deg)}}.wi-send-toast-copy{display:flex;min-width:0;flex-direction:column}.wi-send-toast-title{font-family:inherit;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-inverted, #ffffff)}.wi-send-toast-desc{font-family:inherit;font-size:12px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-accent-primary-on-inverted, #00e8c9)}.wi-send-toast-icon[data-status=error]+.wi-send-toast-copy .wi-send-toast-desc{color:var(--ds-system-red-default, #ff3358)}.wi-disconnect-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:16px;padding:0;border:none;background:transparent;color:var(--ds-content-low, rgba(0, 0, 0, .4));font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;cursor:pointer;transition:color .15s ease}.wi-disconnect-btn:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-disconnect-label{white-space:nowrap}.wi-legal-links{display:inline-flex;align-items:center;justify-content:center;gap:6px;width:100%;flex-shrink:0;font-family:inherit;font-size:14px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.wi-receive-avatar .wi-avatar-fallback{position:absolute;inset:0;border-radius:50%;z-index:0}.wi-receive-avatar .wi-avatar-img{width:24px;height:24px}.wi-legal-link{color:var(--ds-content-low, rgba(0, 0, 0, .4));text-decoration:underline;text-underline-offset:2px;transition:color .15s ease}.wi-legal-link:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-legal-sep{color:inherit}.wi-empty{display:flex;align-items:center;justify-content:center;padding:32px 0;font-family:inherit;font-size:16px;color:var(--wi-texticon-secondary)}.wi-skeleton-item{display:flex;align-items:center;justify-content:space-between;padding:4px 0}.wi-skeleton-left{display:flex;align-items:center;gap:12px}.wi-skeleton-block{border-radius:6px;background:var(--wi-border-default);position:relative;overflow:hidden}.wi-skeleton-block:after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,.06) 50%,transparent 100%);animation:wi-shimmer 1.5s ease-in-out infinite}[data-theme=light] .wi-skeleton-block:after{background:linear-gradient(90deg,transparent 0%,rgba(0,0,0,.04) 50%,transparent 100%)}.wi-skeleton-icon{width:32px;height:32px;border-radius:50%;flex-shrink:0}.wi-skeleton-lines{display:flex;flex-direction:column;gap:6px}.wi-skeleton-right{display:flex;flex-direction:column;align-items:flex-end;gap:6px}.wi-header-back{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--ds-content-low, rgba(0, 0, 0, .4));flex-shrink:0;transition:color .15s ease}.wi-header-back:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-view-container{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.wi-popover-content[data-view=qr] .wi-view-container,.wi-drawer-content[data-view=qr] .wi-view-container{flex:1;min-height:0}.wi-view-inner{display:flex;flex-direction:column;flex:1;min-height:0}.wi-view-wallet{animation:wi-slide-in-left .25s ease-out}.wi-view-qr,.wi-view-portfolio{animation:wi-slide-in-right .25s ease-out}.wi-qr-body{flex:1;min-height:0;display:flex;flex-direction:column}.wi-portfolio-body{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.wi-portfolio-body>.wp-embed{flex:1;min-height:0}.wi-portfolio-body .wp-body-inner{padding:16px 16px 32px;gap:32px}.wi-receive-section{flex:1;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;padding:24px}.wi-receive-account{display:inline-flex;align-items:center;gap:8px;padding:4px 8px 4px 4px;border:0;background:var(--ds-surface-high, #edf1f2);border-radius:9999px;font-family:inherit;color:inherit}.wi-receive-account--btn{cursor:pointer;transition:none}.wi-receive-account--btn:hover{background:#2e3544}:root[data-ds-theme=light] .wi-receive-account--btn:hover{background:#e4e8ef}.wi-receive-avatar{position:relative;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:50%;overflow:hidden;flex-shrink:0}.wi-receive-account-name{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.wi-receive-account>svg{color:var(--ds-content-medium, rgba(0, 0, 0, .65));flex-shrink:0}.wi-receive-chevron{display:inline-flex;align-items:center;color:var(--ds-content-medium, rgba(0, 0, 0, .65));flex-shrink:0;transition:transform .2s ease}.wi-receive-chevron[data-open=true]{transform:rotate(180deg)}.wi-qr-block{display:flex;flex-direction:column;align-items:center;gap:16px}.wi-qr-box{position:relative;display:flex;align-items:center;justify-content:center;padding:10px;background:#fff;border-radius:6px;overflow:hidden}.wi-qr-logo{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);pointer-events:none}.wi-qr-address{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:16px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65));text-align:center;word-break:break-all;max-width:281px;margin:0}.wi-qr-copy-btn{display:inline-flex;align-items:center;justify-content:center;gap:9px;padding:12px 16px;border:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));background:var(--ds-surface-default, #ffffff);border-radius:12px;cursor:pointer;transition:border-color .15s ease}.wi-qr-copy-btn:hover{border-color:var(--ds-border-medium, rgba(0, 0, 0, .18))}.wi-qr-copy-icon{display:inline-flex;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-qr-copy-text{font-family:inherit;font-size:16px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.wi-receive-footer{flex-shrink:0;display:flex;align-items:center;justify-content:center;padding:16px 24px;border-top:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.wi-drawer-content .wi-header{padding:16px}.wi-drawer-content .wi-header--receive .wi-header-action,.wi-drawer-content .wi-header--sub-account .wi-header-action{top:16px;right:16px}.wi-drawer-content .wi-total-section,.wi-drawer-content .wi-action-row{margin:16px 16px 0}.wi-drawer-content .wi-nav-fixed{padding:0 16px}.wi-drawer-content .wi-token-item{padding:12px 16px}.wi-drawer-content .wi-wallet-disconnect-row{padding:16px}
14
- `);_(`.wi-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}
15
- `);import{jsx as Sr}from"react/jsx-runtime";var $d="https://terms.crosstoken.io/docs/cross-terms-of-use",jd="https://terms.crosstoken.io/docs/nexus-privacy-policy";function Vd({env:e,theme:t="dark",mobileBreakpoint:n=768,drawerDirection:o,modal:r,showBalance:a=!1,showForgeToken:i=!1,showGameToken:s=!0,showQR:c=!0,showBridge:l=!0,qrLogoSrc:d,walletAddress:f,accountName:h,sendAccounts:m,profileImageUrl:y,connectorId:x,connectorName:w,connectorIconUrl:v,preferredTokens:B=[],onSelectWallet:u,onCopyAddress:E,onBuy:C,onBuyDisabledMessage:A,onDisconnect:M,disconnectLabel:Z="Disconnect",termsUrl:W=$d,termsLabel:G="Terms of Service",privacyUrl:q=jd,privacyLabel:O="Privacy Policy",open:ie,onOpenChange:ue,showPortfolio:te=!1,portfolioTitle:ae="My Portfolio",showTotalAssets:De=!0,totalAssetsLabel:se="Total Assets USD",sendTransaction:K,getTransactionReceipt:le,estimateGas:J,onOutlink:U,lpBalanceReader:He,stakingRewardsReader:pe,bridgeTokens:Ie,bridgeHistory:Le,getBridgeQuote:it,getBridgeToTokens:we,getBridgeApproval:Ft,approveBridge:_e,submitBridge:bt,onReceive:Lt,onBridge:ce,onSend:me,style:Qe,children:xe}){let ge=Pe(e),he=x?Zn[x]:void 0,Mt=w??he?.name,Ge=v??he?.iconUrl,at=sn(`(max-width: ${n}px)`),ve=o??(a?"right":"bottom"),wt=ve==="left"||ve==="right",xt=r??!1,Ee=ie!==void 0,[st,Ye]=Me.useState(!1),ne=Ee?ie:st,Ze=Me.useCallback(Oe=>{Ee||Ye(Oe),ue?.(Oe)},[Ee,ue]),ye=Me.useCallback(()=>Ze(!1),[Ze]),[vt,Ue]=Me.useState(null),[yt,kt]=Me.useState("top"),[Et,_t]=Me.useState(null),[lt,S]=Me.useState("wallet"),[$,ee]=Me.useState(null);Me.useEffect(()=>{ne||(S("wallet"),ee(null))},[ne]);let ke=Me.useCallback(()=>{er(f),M?.()},[M,f]),At=Me.useMemo(()=>({env:ge,theme:t,isMobile:at,open:ne,drawerDirection:ve,modal:xt,showBalance:a,showForgeToken:i,showGameToken:s,showQR:c,showBridge:l,qrLogoSrc:d,walletAddress:f,accountName:h,sendAccounts:m,profileImageUrl:y,connectorName:Mt,connectorIconUrl:Ge,preferredTokens:B,close:ye,onSelectWallet:u,onCopyAddress:E,onBuy:C,onBuyDisabledMessage:A,onDisconnect:M?ke:void 0,disconnectLabel:Z,termsUrl:W,termsLabel:G,privacyUrl:q,privacyLabel:O,portalStyle:Qe,navContent:vt,navPosition:yt,setNavContent:Ue,setNavPosition:kt,footerContent:Et,setFooterContent:_t,view:lt,setView:S,selectedSendToken:$,setSelectedSendToken:ee,showPortfolio:te,portfolioTitle:ae,showTotalAssets:De,totalAssetsLabel:se,sendTransaction:K,getTransactionReceipt:le,estimateGas:J,onOutlink:U,lpBalanceReader:He,stakingRewardsReader:pe,bridgeTokens:Ie,bridgeHistory:Le,getBridgeQuote:it,getBridgeToTokens:we,getBridgeApproval:Ft,approveBridge:_e,submitBridge:bt,onReceive:Lt,onBridge:ce,onSend:me}),[ge,t,at,ne,ve,xt,a,i,s,c,l,d,f,h,m,y,Mt,Ge,B,ye,u,E,C,A,M,ke,Z,W,G,q,O,Qe,vt,yt,Et,lt,$,te,ae,De,se,K,le,J,U,He,pe,Ie,Le,it,we,Ft,_e,bt,Lt,ce,me]);return Sr(Vo.Provider,{value:At,children:at?Sr(Ud.Root,{direction:ve,open:ne,onOpenChange:Ze,handleOnly:wt,noBodyStyles:!0,repositionInputs:!1,children:xe},"drawer"):Sr(us.Root,{open:ne,onOpenChange:Ze,children:xe},"popover")})}var vn=Object.assign(Vd,{Trigger:Vi,Content:ls,Nav:ds,Footer:fs});import*as It from"react";import*as Es from"@radix-ui/react-dialog";import{Drawer as ep}from"vaul";import{createContext as qd,useContext as Kd}from"react";var Co=qd(null);function Fn(){let e=Kd(Co);if(!e)throw new Error("WalletConnectModal compound components must be used within <WalletConnectModal>");return e}import{useState as ms,useEffect as Qd,useCallback as Yd}from"react";function Ro(){let[e,t]=ms([]),[n,o]=ms(!0);Qd(()=>{if(typeof window>"u"){o(!1);return}let a=[],i=c=>{let{info:l}=c.detail;l?.rdns&&!a.some(d=>d.rdns===l.rdns)&&(a.push({rdns:l.rdns,name:l.name,icon:l.icon}),t([...a]))};window.addEventListener("eip6963:announceProvider",i),window.addEventListener("eip6963:crossAnnounceProvider",i),window.dispatchEvent(new Event("eip6963:requestProvider")),window.dispatchEvent(new Event("eip6963:crossRequestProvider"));let s=setTimeout(()=>o(!1),500);return()=>{window.removeEventListener("eip6963:announceProvider",i),window.removeEventListener("eip6963:crossAnnounceProvider",i),clearTimeout(s)}},[]);let r=Yd(a=>e.some(i=>i.rdns===a),[e]);return{wallets:e,isDetected:r,isLoading:n}}import*as hs from"@radix-ui/react-dialog";import{Drawer as Zd}from"vaul";import{jsx as gs}from"react/jsx-runtime";function bs({asChild:e,children:t}){let{isMobile:n}=Fn(),o=n?Zd.Trigger:hs.Trigger;return gs(o,{asChild:e??t!=null,children:t??gs("button",{type:"button",children:"Connect Wallet"})})}import*as Tt from"@radix-ui/react-dialog";import{Drawer as To}from"vaul";import{jsx as D,jsxs as Kt}from"react/jsx-runtime";function No(){return Kt("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[D("circle",{cx:"20",cy:"20",r:"20",fill:"#00D5AA"}),D("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.3225 2.85742L23.7249 6.25982V11.8301L28.1175 7.43757L32.9292 12.2493L28.5806 16.5979H20.3225C18.4435 16.5979 16.9201 18.1212 16.9201 20.0003C16.9201 21.8794 18.4434 23.4027 20.3225 23.4027H28.5372L32.9293 27.7948L28.1176 32.6066L23.7249 28.2139V33.7407L20.3225 37.1431L16.9201 33.7407V28.2584L12.5719 32.6066L7.76022 27.7948L12.1524 23.4027H6.58209L3.17969 20.0003L6.58209 16.5979H12.1089L7.76035 12.2493L12.5721 7.43757L16.9201 11.7857V6.25982L20.3225 2.85742Z",fill:"black"})]})}function ws(){return Kt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",children:[Kt("g",{clipPath:"url(#clip0_1331_27065)",children:[D("path",{d:"M37.2488 38.4674L28.6626 35.8175L22.1876 39.8295L17.6699 39.8274L11.191 35.8175L2.60875 38.4674L-0.00195312 29.3328L2.60875 19.1947L-0.00195312 10.6234L2.60875 0L16.0192 8.30453H23.838L37.2488 0L39.8595 10.6234L37.2488 19.1947L39.8595 29.3328L37.2488 38.4674Z",fill:"#FF5C16"}),D("path",{d:"M2.60938 0L16.0201 8.31037L15.4868 14.0137L2.60938 0ZM11.1919 29.3366L17.0925 33.9956L11.1919 35.8175V29.3366ZM16.6209 21.6342L15.4868 14.0175L8.22768 19.1971L8.22374 19.195V19.1988L8.24628 24.5302L11.1899 21.6345L16.6209 21.6342ZM37.2477 0L23.837 8.31037L24.3685 14.0137L37.2477 0ZM28.6654 29.3366L22.7646 33.9956L28.6654 35.8175V29.3366ZM31.6313 19.1985V19.1947L31.6297 19.1968L24.3705 14.0175L23.2364 21.6342H28.6651L31.6108 24.5296L31.6313 19.1985Z",fill:"#FF5C16"}),D("path",{d:"M11.191 35.8175L2.60875 38.4674L-0.00195312 29.3366H11.191V35.8175ZM16.62 21.6321L18.2595 32.6435L15.9873 26.5208L8.24368 24.5296L11.189 21.6324H16.62V21.6321ZM28.6662 35.8175L37.2488 38.4674L39.8595 29.3366H28.6662V35.8175ZM23.2375 21.6321L21.598 32.6435L23.8699 26.5208L31.6138 24.5296L28.6665 21.6324H23.2375V21.6321Z",fill:"#E34807"}),D("path",{d:"M-0.00195312 29.3328L2.60875 19.1947H8.22284L8.2434 24.5278L15.9876 26.519L18.2595 32.6414L17.0916 33.9897L11.191 29.3307H-0.00195312V29.3328ZM39.8595 29.3328L37.2488 19.1947H31.6344L31.6138 24.5278L23.8702 26.519L21.598 32.6414L22.7657 33.9897L28.6665 29.3307H39.8595V29.3328ZM23.838 8.30444H16.0192L15.4882 14.0078L18.2597 32.6355H21.598L24.3713 14.0078L23.838 8.30444Z",fill:"#FF8D5D"}),D("path",{d:"M2.60875 0L-0.00195312 10.6234L2.60875 19.1947H8.22284L15.4859 14.0137L2.60875 0ZM14.9975 23.8438H12.4541L11.0693 25.2508L15.9893 26.515L14.9975 23.842V23.8438ZM37.2488 0L39.8595 10.6234L37.2488 19.1947H31.6344L24.3716 14.0137L37.2488 0ZM24.8637 23.8438H27.4107L28.7955 25.2526L23.8699 26.5191L24.8637 23.8418V23.8438ZM22.1857 36.1956L22.7659 33.9936L21.598 32.6453H18.2572L17.0896 33.9936L17.6696 36.1956",fill:"#661800"}),D("path",{d:"M22.1857 36.1951V39.831H17.6699V36.1951H22.1857Z",fill:"#C0C4CD"}),D("path",{d:"M11.1914 35.8131L17.672 39.8289V36.193L17.0917 33.9912L11.1914 35.8131ZM28.6649 35.8131L22.1841 39.8289V36.193L22.7644 33.9912L28.6649 35.8131Z",fill:"#E7EBF6"})]}),D("defs",{children:D("clipPath",{id:"clip0_1331_27065",children:D("rect",{width:"40",height:"40",fill:"white"})})})]})}function xs(){return Kt("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[D("path",{d:"M12.23 16.81L20 9.04L27.77 16.81L32.29 12.29L20 0L7.71 12.29L12.23 16.81Z",fill:"#F3BA2F"}),D("path",{d:"M9.04 20L4.52 15.48L0 20L4.52 24.52L9.04 20Z",fill:"#F3BA2F"}),D("path",{d:"M12.23 23.19L20 30.96L27.77 23.19L32.29 27.71L20 40L7.71 27.71L12.23 23.19Z",fill:"#F3BA2F"}),D("path",{d:"M35.48 24.52L40 20L35.48 15.48L30.96 20L35.48 24.52Z",fill:"#F3BA2F"}),D("path",{d:"M24.58 20L20 15.41L16.61 18.8L16.22 19.19L15.42 19.99L20 24.59L24.59 20L24.58 20Z",fill:"#F3BA2F"})]})}function vs(){return Kt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"247",height:"246",viewBox:"0 0 247 246",fill:"none",children:[D("rect",{width:"247.005",height:"245.105",rx:"36",fill:"#121212"}),D("path",{d:"M89.1233 136.695V59.7551H118.481V140.524L74.5862 184.774L30.4787 140.524V107.55H59.9073V136.695L74.5862 151.303L89.1233 136.695Z",fill:"white"}),D("path",{d:"M59.8364 99.8915V59.7551H12.0414L30.4787 77.8377V99.8915H59.8364Z",fill:"#2FD7FF"}),D("path",{d:"M199.534 59.9334C202.562 60.0484 208.427 60.4824 212.031 63.6902C215.635 66.898 216.937 71.0498 216.937 73.1199V104.017L198.767 114.828L216.937 125.561V172.713C216.937 174.511 216.405 178.276 211.034 181.377C205.664 184.477 202.613 184.969 201.758 184.827H143.949C141.879 184.904 136.712 184.182 132.602 180.686C128.493 177.19 128.462 175.216 128.462 173.515V125.561L146.173 114.828L128.462 104.017V71.1268C128.462 69.721 130.109 65.7781 133.237 63.5701C137.147 60.8101 141.112 59.9334 144.409 59.9334H199.534ZM158.3 122.264V166.221H187.033V122.264H158.3ZM158.3 107.794H187.033V78.5272H158.3V107.794Z",fill:"white"})]})}function ys(){return Kt("svg",{width:"40",height:"40",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Kt("g",{clipPath:"url(#clip0_1185_7785)",children:[D("path",{d:"M14 28C21.75 28 28 21.75 28 14C28 6.25 21.75 0 14 0C6.25 0 0 6.25 0 14C0 21.75 6.25 28 14 28Z",fill:"#EB0029"}),D("path",{d:"M19.4975 8.36232L6 6L13.103 23L23 11.5311L19.4975 8.36232ZM19.2801 9.4034L21.3449 11.27L15.6975 12.2424L19.2801 9.4034ZM14.4714 12.0479L8.51876 7.35252L18.247 9.05524L14.4714 12.0479ZM14.0467 12.8782L13.0765 20.5098L7.84385 7.98492L14.0467 12.8782ZM14.9454 13.2835L21.1983 12.2064L14.026 20.518L14.9454 13.2835Z",fill:"white"})]}),D("defs",{children:D("clipPath",{id:"clip0_1185_7785",children:D("rect",{width:"28",height:"28",fill:"white"})})})]})}function ks(){return Kt("svg",{width:"40",height:"40",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[D("path",{fill:"#FFC107",d:"M43.6 20.5H42V20H24v8h11.3A12 12 0 1 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 1 0 44 24c0-1.2-.1-2.4-.4-3.5z"}),D("path",{fill:"#FF3D00",d:"M6.3 14.7l6.6 4.8A12 12 0 0 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 0 0 6.3 14.7z"}),D("path",{fill:"#4CAF50",d:"M24 44c5.2 0 10-2 13.6-5.2l-6.3-5.3A12 12 0 0 1 12.7 28l-6.5 5A20 20 0 0 0 24 44z"}),D("path",{fill:"#1976D2",d:"M43.6 20.5H42V20H24v8h11.3a12 12 0 0 1-4.1 5.5l6.3 5.3C41 35.7 44 30.3 44 24c0-1.2-.1-2.4-.4-3.5z"})]})}function Ss(){return D("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:D("path",{d:"M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.53 4.08zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"})})}function Cs(){return D("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:D("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var Cr={cross_embedded:{id:"cross_embedded",name:"CROSSx with Social",description:"Sign in with Google or Apple",icon:No},cross_wallet:{id:"cross_wallet",name:"CROSSx",description:"App approval is required",icon:No,featured:!0},cross_extension:{id:"cross_extension",name:"CROSSx Extension",description:"Browser extension approval is required",icon:No,rdns:"nexus.to.crosswallet.desktop",installUrl:"https://chromewebstore.google.com/detail/crossx/nninbdadmocnokibpaaohnoepbnpdgcg",visibility:"desktop-only"},metamask:{id:"metamask",name:"MetaMask",description:"Browser extension approval is required",icon:ws,rdns:"io.metamask"},binance:{id:"binance",name:"Binance",description:"Mobile app only \u2014 Add CROSS network first",icon:xs},verse8:{id:"verse8",name:"Verse8 Wallet",description:"Optimized for Forge and Verse8 ecosystem",icon:vs,badge:"For Forge"},tron:{id:"tron",name:"Tron Wallet",description:"Dedicated for Tron-based transactions and assets",icon:ys,badge:"For SHOP"}};function Rr(e){return Cr[e]}var Nr={google:{id:"google",name:"Google",icon:ks},apple:{id:"apple",name:"Apple",icon:Ss}};function Rs(e){return Nr[e]}import{Fragment as Is,jsx as z,jsxs as Te}from"react/jsx-runtime";function Xd({wallet:e,detected:t,onConnect:n}){let o=()=>{if(e.installUrl&&!t){window.open(e.installUrl,"_blank","noopener,noreferrer");return}n()},r=e.icon,a=e.featured===!0;return Te("button",{type:"button",className:X("wcm-wallet-item",a&&"wcm-wallet-item--featured"),onClick:o,children:[Te("div",{className:"wcm-wallet-item-left",children:[z("div",{className:"wcm-wallet-icon",children:z(r,{})}),Te("div",{className:"wcm-wallet-name-row",children:[z("span",{className:"wcm-wallet-name",children:e.name}),e.badge&&z("span",{className:"wcm-wallet-badge",children:e.badge})]})]}),e.installUrl&&(t?z("span",{className:"wcm-installed-label",children:"Installed"}):z("span",{className:"wcm-install-btn",children:"Install"}))]})}function Jd({social:e,onSignIn:t}){let n=e.icon,o=`Sign in with ${e.name}`;return Te("button",{type:"button",className:"wcm-social-item","data-provider":e.id,onClick:t,"aria-label":o,children:[z("span",{className:"wcm-social-icon",children:z(n,{})}),z("span",{className:"wcm-social-name",children:o})]})}function Ns(){let{wallets:e,activeWalletIds:t,socialProviders:n,activeSocialIds:o,termsUrl:r,privacyUrl:a,isDetected:i,close:s,isMobile:c}=Fn(),l=t.filter(h=>{let m=Rr(h).visibility;return!m||m==="always"?!0:m==="desktop-only"?!c:m==="mobile-only"?c:!0}),d=o.length>0,f=l.length>0;return Te(Is,{children:[Te("div",{className:"wcm-header",children:[Te("div",{className:"wcm-header-text",children:[z("h2",{className:"wcm-title",children:"CROSS Wallet"}),!c&&z("p",{className:"wcm-subtitle",children:"Sign in instantly with your social account"})]}),z("button",{type:"button",className:"wcm-close-btn",onClick:s,"aria-label":"Close",children:z(Cs,{})})]}),Te("div",{className:"wcm-body",children:[d&&Te(Is,{children:[!c&&Te("div",{className:"wcm-section-header",children:[z("span",{className:"wcm-section-title",children:"Social Account Wallet Connect"}),z("span",{className:"wcm-recommended-badge",children:"Recommended"})]}),z("div",{className:"wcm-social-grid",children:o.map(h=>{let m=Rs(h);return z(Jd,{social:m,onSignIn:()=>{n[h]?.(),s()}},h)})}),f&&Te("div",{className:"wcm-separator",children:[z("div",{className:"wcm-separator-line"}),z("span",{className:"wcm-separator-text",children:"Other Wallets"}),z("div",{className:"wcm-separator-line"})]})]}),f&&z("div",{className:"wcm-wallet-list",children:l.map(h=>{let m=Rr(h),y=m.rdns?i(m.rdns):!1;return z(Xd,{wallet:m,detected:y,onConnect:()=>{e[h]?.(),s()}},h)})}),Te("p",{className:"wcm-terms",children:["By continuing, you agree to NEXUS"," ",z(Ts,{href:r,children:"Terms of Service"})," and consent to its ",z(Ts,{href:a,children:"Privacy Policy"}),"."]})]})]})}function Ts({href:e,children:t}){return e?z("a",{className:"wcm-terms-link",href:e,target:"_blank",rel:"noopener noreferrer",children:t}):z("span",{className:"wcm-terms-link",children:t})}function Ls({className:e}){let{isMobile:t,theme:n,portalStyle:o}=Fn();return t?Te(To.Portal,{children:[z(To.Overlay,{className:"wcm-overlay"}),Te(To.Content,{className:X("wcm-drawer-content",e),"data-theme":n,style:o,children:[z(To.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),z("div",{className:"wcm-drawer-handle"}),z("div",{className:"wcm-drawer-body",children:z(Ns,{})})]})]}):Te(Tt.Portal,{children:[z(Tt.Overlay,{className:"wcm-overlay"}),Te(Tt.Content,{className:X("wcm-dialog-content",e),"data-theme":n,style:o,children:[z(Tt.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),z(Tt.Description,{className:"wcm-sr-only",children:"Sign in with a social provider or pick a wallet to connect."}),z("div",{className:"wcm-dialog-body",children:z(Ns,{})})]})]})}_(`.wcm-overlay{position:fixed;inset:0;z-index:100000;background:var(--ds-overlay-dim, rgba(0, 0, 0, .5));-webkit-backdrop-filter:var(--ds-bg-blur-7, blur(3.5px));backdrop-filter:var(--ds-bg-blur-7, blur(3.5px))}.wcm-dialog-content{-webkit-font-smoothing:antialiased;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:100001;width:var(--wcm-dialog-width, 480px);max-height:90vh;overflow:hidden;display:flex;flex-direction:column;background:var(--ds-surface-default, #ffffff);border:1px solid var(--ds-border-default, #00000012);border-radius:24px;box-shadow:var(--ds-shadow-modal, 0 4px 30px -1px rgba(0, 0, 0, .15));outline:none;animation:wcm-dialog-show .2s ease-out;font-family:inherit}.wcm-dialog-content[data-state=closed]{animation:wcm-dialog-hide .15s ease-in}.wcm-dialog-body,.wcm-drawer-body{scrollbar-width:thin;scrollbar-color:var(--ds-border-medium, rgba(0, 0, 0, .18)) transparent}.wcm-dialog-body::-webkit-scrollbar,.wcm-drawer-body::-webkit-scrollbar{width:4px}.wcm-dialog-body::-webkit-scrollbar-track,.wcm-drawer-body::-webkit-scrollbar-track{background:transparent}.wcm-dialog-body::-webkit-scrollbar-thumb,.wcm-drawer-body::-webkit-scrollbar-thumb{background:var(--ds-border-medium, rgba(0, 0, 0, .18));border-radius:4px}.wcm-drawer-content{-webkit-font-smoothing:antialiased;position:fixed;bottom:0;left:0;right:0;z-index:100001;width:100%;max-width:var(--wcm-drawer-max-width, none);min-width:var(--wcm-drawer-min-width, 0);max-height:85dvh;margin:0 auto;display:flex;flex-direction:column;background:var(--ds-surface-default, #ffffff);border:1px solid var(--ds-border-default, #00000012);border-top-left-radius:16px;border-top-right-radius:16px;outline:none;font-family:inherit;box-sizing:border-box}.wcm-drawer-content[data-vaul-drawer-direction=right]{inset:0 0 0 auto;max-height:100vh;width:var(--wcm-drawer-max-width, 400px);max-width:100vw;border-radius:16px 0 0 16px}.wcm-drawer-content[data-vaul-drawer-direction=left]{inset:0 auto 0 0;max-height:100vh;width:var(--wcm-drawer-max-width, 400px);max-width:100vw;border-radius:0 16px 16px 0}.wcm-drawer-content[data-vaul-drawer-direction=top]{inset:0 0 auto;border-radius:0 0 16px 16px}.wcm-drawer-handle{width:60px;height:4px;border-radius:999px;background:var(--ds-border-medium, rgba(0, 0, 0, .18));margin:12px auto 8px;flex-shrink:0}.wcm-drawer-content[data-vaul-drawer-direction=left] .wcm-drawer-handle,.wcm-drawer-content[data-vaul-drawer-direction=right] .wcm-drawer-handle{display:none}.wcm-dialog-body,.wcm-drawer-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden}.wcm-drawer-body{overscroll-behavior:contain}.wcm-header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:24px;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.wcm-header-text{display:flex;flex-direction:column;gap:4px;min-width:0}.wcm-title{font-family:Inter,sans-serif;font-weight:600;font-size:20px;line-height:1.25;letter-spacing:0;color:var(--ds-content-highest, #000000);margin:0}.wcm-subtitle{font-family:Inter,sans-serif;font-weight:400;font-size:14px;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65));margin:0}.wcm-close-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;flex-shrink:0;border:none;background:transparent;color:var(--ds-content-low, #00000066);cursor:pointer;padding:0;transition:opacity .15s ease}.wcm-close-btn:hover{opacity:.6}.wcm-close-btn>svg{width:24px;height:24px}.wcm-divider{display:none}.wcm-body{display:flex;flex-direction:column;gap:16px;padding:24px}.wcm-section-header{display:flex;align-items:center;gap:8px;width:100%}.wcm-section-title{font-family:Inter,sans-serif;font-weight:600;font-size:16px;line-height:1;letter-spacing:0;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wcm-recommended-badge{display:inline-flex;align-items:center;justify-content:center;padding:4px 8px;background:var(--ds-accent-primary-low, #e7f9f8);border-radius:9999px;font-family:Inter,sans-serif;font-weight:500;font-size:12px;line-height:1;letter-spacing:0;color:var(--ds-accent-primary-high, #00a0a2);white-space:nowrap}.wcm-social-grid{display:grid;gap:8px;width:100%}.wcm-dialog-body .wcm-social-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.wcm-drawer-body .wcm-social-grid{grid-template-columns:1fr}.wcm-social-item{display:flex;background:var(--ds-surface-medium, #f5f7fa);border:none;border-radius:12px;cursor:pointer;transition:none;font-family:inherit;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wcm-social-item:hover{background:#2e3544!important}:root[data-ds-theme=light] .wcm-social-item:hover{background:#eff3f8!important}.wcm-social-item[data-provider=apple] .wcm-social-icon{color:#000}[data-theme=dark] .wcm-social-item[data-provider=apple] .wcm-social-icon{color:#fff}.wcm-dialog-body .wcm-social-item{flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px}.wcm-drawer-body .wcm-social-item{flex-direction:row;align-items:center;justify-content:flex-start;gap:12px;padding:16px}.wcm-social-icon{flex-shrink:0;width:32px;height:32px;display:flex;align-items:center;justify-content:center}.wcm-social-icon>svg{width:32px;height:32px}.wcm-social-name{font-family:Inter,sans-serif;font-weight:600;font-size:14px;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.wcm-separator{display:flex;align-items:center;gap:12px;width:100%}.wcm-separator-line{flex:1;height:1px;background:var(--ds-border-default, rgba(0, 0, 0, .07))}.wcm-separator-text{font-family:Inter,sans-serif;font-weight:500;font-size:12px;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4));white-space:nowrap}.wcm-wallet-list{display:flex;flex-direction:column;gap:8px}.wcm-wallet-item{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;padding:20px 16px;background:var(--ds-surface-medium, #f5f7fa);border:none;border-radius:12px;cursor:pointer;text-align:left;transition:none;font-family:inherit}.wcm-wallet-item:hover{background:#2e3544!important}:root[data-ds-theme=light] .wcm-wallet-item:hover{background:#eff3f8!important}.wcm-wallet-item-left{display:flex;align-items:center;gap:8px;flex:1;min-width:0}.wcm-wallet-icon{flex-shrink:0;width:28px;height:28px;display:flex;align-items:center;justify-content:center}.wcm-wallet-icon>svg,.wcm-wallet-icon>img{width:28px;height:28px;border-radius:0;object-fit:cover}.wcm-wallet-name-row{display:flex;align-items:center;gap:8px;min-width:0}.wcm-wallet-name{font-family:Inter,sans-serif;font-weight:600;font-size:16px;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.wcm-wallet-badge{display:inline-flex;align-items:center;justify-content:center;padding:4px 8px;background:var(--ds-system-purple-low, #f5f3ff);border:.5px solid var(--ds-system-purple-default, #7e54f4);border-radius:9999px;font-family:Inter,sans-serif;font-weight:500;font-size:12px;line-height:1;letter-spacing:0;color:var(--ds-system-purple-high, #7346f3);white-space:nowrap}.wcm-install-btn{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;padding:4px 8px;background:var(--ds-accent-primary-default, #00b4b7);border-radius:6px;font-family:Inter,sans-serif;font-weight:500;font-size:12px;line-height:1;letter-spacing:0;color:var(--ds-accent-primary-on, #ffffff);white-space:nowrap}.wcm-installed-label{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;font-family:Inter,sans-serif;font-weight:500;font-size:12px;line-height:1;letter-spacing:0;color:var(--ds-content-low, rgba(0, 0, 0, .4));white-space:nowrap}.wcm-terms{font-family:Inter,sans-serif;font-weight:400;font-size:12px;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65));text-align:center;margin:0}.wcm-terms-link{color:var(--ds-accent-primary-high, #00a0a2);text-decoration:none}.wcm-terms-link:hover{text-decoration:underline}.wcm-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}
16
- `);_(`@keyframes wcm-overlay-show{0%{opacity:0}to{opacity:1}}@keyframes wcm-overlay-hide{0%{opacity:1}to{opacity:0}}@keyframes wcm-dialog-show{0%{opacity:0;transform:translate(-50%,-48%) scale(.96)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}@keyframes wcm-dialog-hide{0%{opacity:1;transform:translate(-50%,-50%) scale(1)}to{opacity:0;transform:translate(-50%,-48%) scale(.96)}}
17
- `);import{jsx as Mn}from"react/jsx-runtime";var tp={};function np({wallets:e,socialProviders:t=tp,termsUrl:n,privacyUrl:o,theme:r="dark",mobileBreakpoint:a=768,drawerDirection:i="bottom",dialogWidth:s,drawerMaxWidth:c,drawerMinWidth:l,style:d,open:f,onOpenChange:h,children:m}){let y=sn(`(max-width: ${a}px)`),[x,w]=It.useState(!1),v=f!==void 0,B=v?f:x,u=It.useCallback(q=>{v||w(q),h?.(q)},[v,h]),E=It.useCallback(()=>u(!1),[u]),{isDetected:C}=Ro(),A=It.useMemo(()=>Object.keys(e),[e]),M=It.useMemo(()=>Object.keys(t),[t]),Z=It.useMemo(()=>{let q={};return s&&(q["--wcm-dialog-width"]=s),c&&(q["--wcm-drawer-max-width"]=c),l&&(q["--wcm-drawer-min-width"]=l),{...q,...d}},[s,c,l,d]),W=It.useMemo(()=>({theme:r,isMobile:y,open:B,setOpen:u,close:E,wallets:e,activeWalletIds:A,socialProviders:t,activeSocialIds:M,termsUrl:n,privacyUrl:o,isDetected:C,portalStyle:Z}),[r,y,B,u,E,e,A,t,M,n,o,C,Z]),G=Mn("div",{"data-theme":r,style:Z,children:m});return y?Mn(Co.Provider,{value:W,children:Mn(ep.Root,{direction:i,open:B,onOpenChange:u,noBodyStyles:!0,children:G},"drawer")}):Mn(Co.Provider,{value:W,children:Mn(Es.Root,{open:B,onOpenChange:u,children:G})})}var As=Object.assign(np,{Trigger:bs,Content:Ls});_(`.cb-button{--cb-bg: var(--ds-accent-primary-default, #00b4b7);--cb-bg-hover: var(--cb-bg);--cb-color: var(--ds-accent-primary-on-primary, #ffffff);--cb-border: none;--cb-radius: 8px;--cb-height: 36px;--cb-padding: 8px 16px;--cb-font-family: Inter, system-ui, -apple-system, sans-serif;--cb-font-size: 14px;--cb-font-weight: 500;--cb-line-height: 1.5;--cb-letter-spacing: -.01em;--cb-gap: 8px;--cb-transition: opacity .15s;--cb-loading-opacity: .7;--cb-press-scale: .95;--cb-icon-size: 18px;--cb-spinner-size: 18px;--cb-spinner-thumb: currentColor;--cb-spinner-track: color-mix(in srgb, currentColor 20%, transparent)}.cb-pill{--cb-pill-bg: var(--ds-surface-default, #ffffff);--cb-pill-bg-hover: var(--cb-pill-bg);--cb-pill-color: var(--ds-content-high, rgba(0, 0, 0, .85));--cb-pill-border: 1px solid var(--ds-border-default, rgba(0, 0, 0, .07));--cb-pill-border-hover: 1px solid var(--ds-border-medium, rgba(0, 0, 0, .18));--cb-pill-radius: 8px;--cb-pill-height: 36px;--cb-pill-padding: 1px 13px;--cb-pill-press-scale: .95;--cb-pill-font-family: Inter, system-ui, -apple-system, sans-serif;--cb-pill-font-size: 14px;--cb-pill-font-weight: 500;--cb-pill-line-height: 1.5;--cb-pill-gap: 8px;--cb-pill-icon-size: 18px;--cb-pill-icon-placeholder-bg: var(--ds-surface-medium, #f5f7fa);--cb-pill-address-font: Inter, system-ui, -apple-system, sans-serif;--cb-pill-address-font-size: 14px;--cb-pill-address-letter-spacing: -.01em}
18
- `);_(`.cb-button{-webkit-font-smoothing:antialiased;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;height:var(--cb-height);gap:var(--cb-gap);padding:var(--cb-padding);border-radius:var(--cb-radius);border:var(--cb-border);background:var(--cb-bg);color:var(--cb-color);font-family:var(--cb-font-family);font-size:var(--cb-font-size);font-weight:var(--cb-font-weight);line-height:var(--cb-line-height);letter-spacing:var(--cb-letter-spacing);cursor:pointer;transition:var(--cb-transition)}.cb-button:hover:not(:disabled){background:var(--cb-bg-hover)}.cb-button:active:not(:disabled){transform:scale(var(--cb-press-scale))}.cb-button:disabled,.cb-button[aria-busy=true]{cursor:default;opacity:var(--cb-loading-opacity)}.cb-spinner{display:inline-block;width:var(--cb-spinner-size);height:var(--cb-spinner-size);border:2px solid var(--cb-spinner-track);border-top-color:var(--cb-spinner-thumb);border-radius:50%;animation:cb-spin .6s linear infinite;flex-shrink:0}.cb-button-icon{width:var(--cb-icon-size);height:var(--cb-icon-size);flex-shrink:0}.cb-button-label{white-space:nowrap}.cb-pill{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;height:var(--cb-pill-height);gap:var(--cb-pill-gap);padding:var(--cb-pill-padding);border-radius:var(--cb-pill-radius);border:var(--cb-pill-border);background:var(--cb-pill-bg);color:var(--cb-pill-color);font-family:var(--cb-pill-font-family);font-size:var(--cb-pill-font-size);font-weight:var(--cb-pill-font-weight);line-height:var(--cb-pill-line-height);cursor:pointer}.cb-pill:hover{background:var(--cb-pill-bg-hover)}.cb-pill:active:not(:disabled){transform:scale(var(--cb-pill-press-scale))}.cb-pill-icon{width:var(--cb-pill-icon-size);height:var(--cb-pill-icon-size);border-radius:50%;object-fit:contain;flex-shrink:0;background:transparent}[data-theme=dark] .cb-pill-icon[data-provider=apple]{filter:invert(1)}.cb-pill-icon-placeholder{display:inline-block;width:var(--cb-pill-icon-size);height:var(--cb-pill-icon-size);border-radius:50%;background:var(--cb-pill-icon-placeholder-bg);flex-shrink:0}.cb-pill-address{font-family:var(--cb-pill-address-font);font-size:var(--cb-pill-address-font-size);letter-spacing:var(--cb-pill-address-letter-spacing);white-space:nowrap}@media(max-width:767.98px){.cb-button,.cb-pill{width:36px;min-width:36px;padding:0}.cb-button{height:36px}.cb-button-label,.cb-pill-address{display:none}}@keyframes cb-spin{to{transform:rotate(360deg)}}
19
- `);var op='<svg preserveAspectRatio="none" width="100%" height="100%" overflow="visible" style="display: block;" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#c0)"><path d="M18 36C27.9411 36 36 27.9411 36 18C36 8.05887 27.9411 0 18 0C8.05887 0 0 8.05887 0 18C0 27.9411 8.05887 36 18 36Z" fill="#00D5AA"/><path fill-rule="evenodd" clip-rule="evenodd" d="M18.2903 2.57169L21.3525 5.63385V10.6471L25.3058 6.69381L29.6364 11.0244L25.7226 14.9381H18.2903C16.5992 14.9381 15.2283 16.309 15.2283 18.0003C15.2283 19.6915 16.5992 21.0624 18.2903 21.0624H25.6836L29.6365 25.0154L25.3059 29.3459L21.3525 25.3925V30.3666L18.2903 33.4288L15.2283 30.3666V25.4326L11.3148 29.3459L6.98426 25.0154L10.9372 21.0624H5.92394L2.86178 18.0003L5.92394 14.9381H10.8981L6.98437 11.0244L11.3149 6.69383L15.2283 10.6071V5.63385L18.2903 2.57169Z" fill="#000"/></g><defs><clipPath id="c0"><rect width="36" height="36" fill="#fff"/></clipPath></defs></svg>',rp='<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 28 28" fill="none"><g clip-path="url(#m0)"><path d="M26.07 26.93L20.06 25.07L15.53 27.88L12.37 27.88L7.83 25.07L1.83 26.93L0 20.53L1.83 13.44L0 7.44L1.83 0L11.21 5.81H16.69L26.07 0L27.9 7.44L26.07 13.44L27.9 20.53Z" fill="#FF5C16"/><path d="M7.83 20.54L11.96 23.8L7.83 25.07V20.54Z" fill="#FF5C16"/><path d="M20.06 20.54L15.93 23.8L20.06 25.07L20.06 20.54Z" fill="#FF5C16"/><path d="M11.63 15.14L12.78 22.85L11.19 18.56L5.77 17.17L7.83 15.14H11.63Z" fill="#E34807"/><path d="M16.27 15.14L15.12 22.85L16.71 18.56L22.13 17.17L20.07 15.14H16.27Z" fill="#E34807"/><path d="M0 20.53L1.83 13.44H5.76L5.77 17.17L11.19 18.56L12.78 22.85L11.96 23.79L7.83 20.53H0Z" fill="#FF8D5D"/><path d="M27.9 20.53L26.07 13.44H22.14L22.13 17.17L16.71 18.56L15.12 22.85L15.94 23.79L20.07 20.53H27.9Z" fill="#FF8D5D"/><path d="M16.69 5.81H11.21L10.84 9.81L12.78 22.85H15.12L17.06 9.81L16.69 5.81Z" fill="#FF8D5D"/><path d="M15.53 25.34V27.88H12.37V25.34H15.53Z" fill="#C0C4CD"/><path d="M7.83 25.07L12.37 27.88V25.34L11.96 23.79L7.83 25.07Z" fill="#E7EBF6"/><path d="M20.07 25.07L15.53 27.88V25.34L15.94 23.79L20.07 25.07Z" fill="#E7EBF6"/></g><defs><clipPath id="m0"><rect width="28" height="28" fill="#fff"/></clipPath></defs></svg>',ip='<svg width="100%" height="100%" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.23 16.81L20 9.04L27.77 16.81L32.29 12.29L20 0L7.71 12.29L12.23 16.81Z" fill="#F3BA2F"/><path d="M9.04 20L4.52 15.48L0 20L4.52 24.52L9.04 20Z" fill="#F3BA2F"/><path d="M12.23 23.19L20 30.96L27.77 23.19L32.29 27.71L20 40L7.71 27.71L12.23 23.19Z" fill="#F3BA2F"/><path d="M35.48 24.52L40 20L35.48 15.48L30.96 20L35.48 24.52Z" fill="#F3BA2F"/><path d="M24.58 20L20 15.41L16.61 18.8L16.22 19.19L15.42 19.99L20 24.59L24.59 20L24.58 20Z" fill="#F3BA2F"/></svg>',ap='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><path fill="#FFC107" d="M43.6 20.5H42V20H24v8h11.3A12 12 0 1 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 1 0 44 24c0-1.2-.1-2.4-.4-3.5z"/><path fill="#FF3D00" d="M6.3 14.7l6.6 4.8A12 12 0 0 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 0 0 6.3 14.7z"/><path fill="#4CAF50" d="M24 44c5.2 0 10-2 13.6-5.2l-6.3-5.3A12 12 0 0 1 12.7 28l-6.5 5A20 20 0 0 0 24 44z"/><path fill="#1976D2" d="M43.6 20.5H42V20H24v8h11.3a12 12 0 0 1-4.1 5.5l6.3 5.3C41 35.7 44 30.3 44 24c0-1.2-.1-2.4-.4-3.5z"/></svg>',sp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path d="M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.53 4.08zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"/></svg>';function _n(e){return`data:image/svg+xml,${encodeURIComponent(e)}`}var Io=_n(op),Lo=_n(rp),Eo=_n(ip),Ao=_n(ap),Po=_n(sp);import{jsx as rt,jsxs as On}from"react/jsx-runtime";function Bs({isConnecting:e,address:t,provider:n,providerName:o,accountName:r,sendAccounts:a,onConnect:i,onDisconnect:s,onCopy:c,onSelectWallet:l,onBuy:d,onBuyDisabledMessage:f,label:h="Connect Wallet",connectingLabel:m="Connecting...",disconnectLabel:y,className:x,theme:w="dark",env:v,showBalance:B=!0,showPortfolio:u,drawerDirection:E,modal:C,connectorId:A,style:M,walletInfoStyle:Z,sendTransaction:W,getTransactionReceipt:G,estimateGas:q,onReceive:O,onBridge:ie,onSend:ue,bridgeTokens:te,bridgeHistory:ae,getBridgeQuote:De,getBridgeToTokens:se,getBridgeApproval:K,approveBridge:le,submitBridge:J}){let U=x?`cb-button ${x}`:"cb-button",He=x?`cb-pill ${x}`:"cb-pill";if(e)return On("button",{type:"button",disabled:!0,className:U,style:M,"aria-busy":"true",children:[rt("span",{className:"cb-spinner","aria-hidden":"true"}),rt("span",{className:"cb-button-label",children:m})]});if(t){let pe=o??pp(n),Ie=n?cp[n]:void 0;return On(vn,{env:v,theme:w,drawerDirection:E,modal:C,showBalance:B,showPortfolio:u,walletAddress:t,accountName:r,sendAccounts:a,connectorId:A,onSelectWallet:l,onCopyAddress:c?(Le,it)=>{it&&c()}:void 0,onDisconnect:s,disconnectLabel:y,style:Z,sendTransaction:W,getTransactionReceipt:G,estimateGas:q,onReceive:O,onBridge:ie,onBuy:d,onBuyDisabledMessage:f,onSend:ue,bridgeTokens:te,bridgeHistory:ae,getBridgeQuote:De,getBridgeToTokens:se,getBridgeApproval:K,approveBridge:le,submitBridge:J,children:[rt(vn.Trigger,{asChild:!0,children:On("button",{type:"button",className:He,style:M,"aria-label":`Connected with ${pe}: ${Ps(t)}`,children:[Ie?rt("img",{src:Ie,alt:"",width:18,height:18,className:"cb-pill-icon","data-provider":n}):rt("span",{className:"cb-pill-icon-placeholder","aria-hidden":"true"}),rt("span",{className:"cb-pill-address",children:Ps(t)})]})}),rt(vn.Content,{align:"end",sideOffset:8})]})}return On("button",{type:"button",onClick:i,className:U,style:M,"aria-label":typeof h=="string"?h:"Connect Wallet",children:[rt(lp,{}),rt("span",{className:"cb-button-label",children:h})]})}function lp(){return On("svg",{className:"cb-button-icon",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[rt("path",{d:"M3.75 5.25H14.25C15.0784 5.25 15.75 5.92157 15.75 6.75V13.5C15.75 14.3284 15.0784 15 14.25 15H3.75C2.92157 15 2.25 14.3284 2.25 13.5V4.5C2.25 3.67157 2.92157 3 3.75 3H13.5",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"}),rt("path",{d:"M12 9.75H15.75V12.75H12C11.1716 12.75 10.5 12.0784 10.5 11.25C10.5 10.4216 11.1716 9.75 12 9.75Z",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"}),rt("path",{d:"M12.75 11.25H12.7575",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}var cp={google:Ao,apple:Po,cross:Io,metamask:Lo,binance:Eo},dp={google:"Google",apple:"Apple",cross:"CROSSx",metamask:"MetaMask",binance:"Binance Wallet"};function pp(e){return e?dp[e]:"Wallet"}function Ps(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}import*as Fs from"react";_(`.sb-button{--sb-bg: var(--ds-surface-default, #ffffff);--sb-border: var(--ds-border-default, rgba(0, 0, 0, .07));--sb-border-hover: var(--ds-border-default, rgba(0, 0, 0, .07));--sb-color: var(--ds-content-medium, rgba(0, 0, 0, .65));--sb-color-hover: var(--ds-content-high, rgba(0, 0, 0, .85));--sb-radius: 8px;--sb-height: 36px;--sb-padding: 1px 11px;--sb-gap: 4px;--sb-font-size: 14px;--sb-font-weight: 500;--sb-line-height: 21px;--sb-letter-spacing: 0;--sb-blur: 0px;--sb-border-width: 1px;--sb-icon-size: 18px;--sb-icon-hover-rotation: 180deg;--sb-spinner-size: 18px;--sb-spinner-thumb: currentColor;--sb-spinner-track: color-mix(in srgb, currentColor 20%, transparent);--sb-disabled-opacity: .6;--sb-press-scale: .95;--sb-hover-duration: .2s;--sb-icon-duration: .3s;--sb-easing: ease}.sb-button[data-theme=dark]{--sb-bg: var(--ds-surface-default, #1e232e);--sb-border: var(--ds-border-default, #ffffff12);--sb-border-hover: var(--ds-border-medium, #ffffff2e);--sb-color: var(--ds-content-medium, #ffffffa6);--sb-color-hover: var(--ds-content-high, #ffffffd9)}.sb-button[data-theme=light]{--sb-bg: var(--ds-surface-default, #ffffff);--sb-border: var(--ds-border-default, #00000012);--sb-border-hover: var(--ds-border-medium, #0000002e);--sb-color: var(--ds-content-medium, #000000a6);--sb-color-hover: var(--ds-content-high, #000000d9)}
20
- `);_(`.sb-button{-webkit-font-smoothing:antialiased;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;height:var(--sb-height);gap:var(--sb-gap);padding:var(--sb-padding);border-radius:var(--sb-radius);border:var(--sb-border-width) solid var(--sb-border);background:var(--sb-bg);backdrop-filter:blur(var(--sb-blur));-webkit-backdrop-filter:blur(var(--sb-blur));color:var(--sb-color);font-family:Inter,system-ui,-apple-system,sans-serif;font-weight:var(--sb-font-weight);font-size:var(--sb-font-size);line-height:var(--sb-line-height);letter-spacing:var(--sb-letter-spacing);cursor:pointer;transition:border-color var(--sb-hover-duration) var(--sb-easing),color var(--sb-hover-duration) var(--sb-easing)}@media(hover:hover){.sb-button:hover:not(:disabled){border-color:var(--sb-border-hover);color:var(--sb-color-hover)}.sb-button:hover:not(:disabled) .sb-button-icon{transform:rotate(var(--sb-icon-hover-rotation))}}.sb-button:active:not(:disabled){transform:scale(var(--sb-press-scale))}.sb-button:disabled,.sb-button[aria-busy=true]{cursor:default;opacity:var(--sb-disabled-opacity)}.sb-button-icon{width:var(--sb-icon-size);height:var(--sb-icon-size);flex-shrink:0;color:inherit;transition:transform var(--sb-icon-duration) var(--sb-easing),color var(--sb-icon-duration) var(--sb-easing)}.sb-spinner{display:inline-block;width:var(--sb-spinner-size);height:var(--sb-spinner-size);border:2px solid var(--sb-spinner-track);border-top-color:var(--sb-spinner-thumb);border-radius:50%;animation:sb-spin .6s linear infinite;flex-shrink:0}.sb-label{white-space:nowrap}@keyframes sb-spin{to{transform:rotate(360deg)}}
21
- `);import{jsx as zn,jsxs as up}from"react/jsx-runtime";var Tr="https://skills.cross.nexus";function Ms({label:e="Skills",href:t=Tr,onClick:n,className:o,style:r,theme:a,disabled:i=!1,isLoading:s=!1,loadingLabel:c="Loading...",openInNewTab:l=!1,type:d="button"}){let[f,h]=Fs.useState(!1),m=async B=>{if(t&&!n){l?window.open(t,"_blank","noopener,noreferrer"):window.location.href=t;return}if(n)try{h(!0),await n()}finally{h(!1)}},y=i||s||f,x=s||f,w=x?c:e,v=o?`sb-button ${o}`:"sb-button";return up("button",{type:d,onClick:m,disabled:y,className:v,"data-theme":a,style:r,"aria-busy":x,children:[x?zn("span",{className:"sb-spinner","aria-hidden":"true"}):zn(fp,{}),zn("span",{className:"sb-label",children:w})]})}function fp(){return zn("svg",{className:"sb-button-icon",viewBox:"0 0 34 34",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:zn("path",{d:"M15.5879 3.95142C16.0211 2.78097 17.6761 2.78099 18.1094 3.95142L19.6221 8.03833C20.6569 10.8348 22.8618 13.0396 25.6582 14.0745L29.7451 15.5872C30.9157 16.0204 30.9157 17.6754 29.7451 18.1086L25.6582 19.6213C22.8618 20.6562 20.657 22.861 19.6221 25.6575L18.1094 29.7444C17.6762 30.9149 16.0211 30.9149 15.5879 29.7444L14.0752 25.6575C13.0403 22.861 10.8355 20.6562 8.03906 19.6213L3.95215 18.1086C2.78172 17.6754 2.7817 16.0204 3.95215 15.5872L8.03906 14.0745C10.8355 13.0396 13.0403 10.8348 14.0752 8.03833L15.5879 3.95142Z",stroke:"currentColor",strokeWidth:"1.93556"})})}Uo({mode:"dapp-ui"});export{Po as APPLE_ICON,$r as AppLauncher,Jr as AppLauncherContent,Qr as AppLauncherTrigger,Eo as BINANCE_ICON,vo as BridgeFlow,Zn as CONNECTOR_REGISTRY,Io as CROSSX_ICON,Bs as ConnectButton,qo as ConnectorId,Tr as DEFAULT_SKILLS_HREF,Ao as GOOGLE_ICON,Lo as METAMASK_ICON,Nr as SOCIAL_REGISTRY,lo as SendFlow,Ms as SkillsButton,cr as TOKEN_STATS_QUERY_KEY,lr as USER_BALANCE_QUERY_KEY,Cr as WALLET_REGISTRY,As as WalletConnectModal,vn as WalletInfo,Fa as WalletPortfolio,bn as WalletPortfolioBody,Uo as announceAppLauncherUsage,Pe as resolveEnvironment,Qn as useGlobalMenu,Dt as useTokenBalance,Ht as useTokenStats,Ro as useWalletDetect};
1
+ function Kr(e){try{return import.meta.env?.[e]}catch{return}}function Qr(e){if(!(typeof process>"u"))return process.env?.[e]}function Pe(e){if(e)return Yr(e);let t=Kr("VITE_CROSSX_ENVIRONMENT")??Kr("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??Qr("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??Qr("CROSSX_ENVIRONMENT");return Yr(t)}function Yr(e){switch(e?.toLowerCase()){case"dev":case"development":return"dev";case"stage":case"staging":case"stg":return"stage";default:return"production"}}var Yo="1.3.3";var Xn="__nexusCrossAppLauncherRuntime";function il(){if(typeof window>"u")return null;let e=window;return e[Xn]??(e[Xn]={mode:"dapp-ui"}),e[Xn]}function al(e){if(e.scheduled)return;e.scheduled=!0;let t=()=>{if(e.scheduled=!1,e.loggedMode!==e.mode){if(e.mode==="connect-kit-react"){let n=e.connectKitVersion??"unknown";console.info(`[CROSSx App Launcher] connect-kit-react v${n} \uCD08\uAE30\uD654 \uC644\uB8CC (dapp-ui v${Yo}, \uC0AC\uC6A9 \uBAA8\uB4DC: connect-kit)`)}else console.info(`[CROSSx App Launcher] dapp-ui v${Yo} \uCD08\uAE30\uD654 \uC644\uB8CC (\uC0AC\uC6A9 \uBAA8\uB4DC: dapp-ui only)`);e.loggedMode=e.mode}};typeof queueMicrotask=="function"?queueMicrotask(t):Promise.resolve().then(t)}function Zo(e){let t=il();t&&(e?.mode==="connect-kit-react"?t.mode="connect-kit-react":t.mode||(t.mode="dapp-ui"),e?.connectKitVersion&&(t.connectKitVersion=e.connectKitVersion),al(t))}import*as bn from"react";import*as Zr from"@radix-ui/react-popover";import{Drawer as pl}from"vaul";import{createContext as sl,useContext as ll}from"react";var Xo=sl(null);function Jn(){let e=ll(Xo);if(!e)throw new Error("AppLauncher compound components must be used within <AppLauncher>");return e}import{useState as cl,useEffect as dl}from"react";function hn(e){let[t,n]=cl(!1);return dl(()=>{let o=window.matchMedia(e);n(o.matches);let r=a=>n(a.matches);return o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[e]),t}function D(e,{insertAt:t}={}){if(!e||typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",t==="top"&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}D(`[data-theme=dark]{--al-bg: var(--ds-surface-default, #1e232e);--al-bg-hover: var(--ds-surface-medium, #252b39);--al-text: var(--ds-content-highest, #ffffff);--al-text-secondary: var(--ds-content-medium, #ffffffa6);--al-border: var(--ds-border-default, #ffffff12);--al-shadow: var(--ds-shadow-modal, 0px 4px 30px -1px rgba(0, 0, 0, .7));--al-badge-bg: var(--ds-accent-primary-low, #123235);--al-badge-text: var(--ds-accent-primary-default, #00ceb2);--al-badge-new-text: var(--ds-system-purple-on, #ffffff);--al-drawer-overlay: var(--ds-overlay-dim, #000000b3)}[data-theme=light]{--al-bg: var(--ds-surface-default, #ffffff);--al-bg-hover: var(--ds-surface-medium, #f5f7fa);--al-text: var(--ds-content-highest, #000000);--al-text-secondary: var(--ds-content-medium, #000000a6);--al-border: var(--ds-border-default, #00000012);--al-shadow: var(--ds-shadow-modal, 0px 4px 30px -1px rgba(0, 0, 0, .15));--al-badge-bg: var(--ds-accent-primary-low, #e7f9f8);--al-badge-text: var(--ds-accent-primary-default, #00b4b7);--al-badge-new-text: var(--ds-system-purple-on, #ffffff);--al-drawer-overlay: var(--ds-overlay-dim, #00000080)}
2
+ `);D(`.al-trigger-btn{--at-bg: transparent;--at-bg-hover: #eaedf1;--at-color: var(--ds-content-high, rgba(0, 0, 0, .85));--at-border: none;--at-border-radius: 8px;--at-size: 36px;--at-padding: 0;--at-press-scale: .95;--at-transition: background-color .15s ease;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:var(--at-size);height:var(--at-size);padding:var(--at-padding);border:var(--at-border);background:var(--at-bg);border-radius:var(--at-border-radius);color:var(--at-color);cursor:pointer;transition:var(--at-transition)}.al-trigger-btn:hover,.al-trigger-btn[data-state=open]{background:var(--at-bg-hover)}.al-trigger-btn:active:not(:disabled){background:var(--at-bg-hover);transform:scale(var(--at-press-scale))}.al-trigger-btn[data-theme=dark]{--at-color: var(--ds-content-high, rgba(255, 255, 255, .85));--at-bg-hover: #252b39}.al-trigger-btn[data-theme=light]{--at-color: var(--ds-content-high, rgba(0, 0, 0, .85))}
3
+ `);D(`@keyframes al-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
4
+ `);D(`.al-popover-content{-webkit-font-smoothing:antialiased;z-index:100001;border-radius:24px;background:var(--al-bg);border:1px solid var(--al-popover-border, var(--al-border));box-shadow:var(--al-popover-shadow, var(--al-shadow));animation:al-fade-in .15s ease-out;max-height:80vh;overflow-x:hidden;overflow-y:auto;padding:20px 4px;box-sizing:border-box}.al-popover-content .al-grid{grid-template-columns:repeat(4,100px);row-gap:16px;column-gap:0;padding:0;justify-content:center;align-items:start}.al-popover-content .al-grid-item{flex-direction:column;justify-content:flex-start;align-items:center;gap:6px;padding:12px 0;width:100px;min-width:0;border-radius:10px}.al-popover-content .al-grid-item-left{flex-direction:column;align-items:center;gap:8px;width:100%;overflow:visible}.al-popover-content .al-grid-item-icon{width:50px;height:50px;border-radius:10.125px;overflow:hidden}.al-popover-content .al-grid-item-icon img{object-fit:cover}.al-popover-content .al-grid-item-label{font-family:Inter,sans-serif;font-size:12px;font-weight:500;line-height:1.1;letter-spacing:0;text-align:center;color:var(--al-text);max-width:100%;white-space:normal;overflow-wrap:anywhere}.al-popover-content .al-grid-item-right,.al-popover-content .al-badge-new{display:none}.al-drawer-overlay{position:fixed;inset:0;z-index:100000;background:var(--al-drawer-overlay)}.al-drawer-content{-webkit-font-smoothing:antialiased;position:fixed;top:0;right:0;bottom:0;z-index:100001;width:100vw;background:var(--al-bg);overflow-x:hidden;overflow-y:hidden;display:flex;flex-direction:column;box-sizing:border-box}.al-drawer-body{flex:1;overflow-y:auto;overscroll-behavior-y:contain;min-height:0}.al-drawer-content .al-grid{display:flex;flex-direction:column;grid-template-columns:none;max-width:100%;overflow:hidden;flex-shrink:0;gap:0;row-gap:0;column-gap:0;padding:8px 16px}.al-drawer-content .al-grid-item{width:100%;max-width:100%;gap:8px;padding:16px 12px;border-radius:8px;overflow:hidden;background:transparent}.al-drawer-content .al-grid-item:hover,.al-drawer-content .al-grid-item[data-active=true]{background:var(--al-bg-hover)}.al-drawer-content .al-grid-item-left{gap:8px;flex:1 1 auto;min-width:0}.al-drawer-content .al-grid-item-icon{width:32px;height:32px;border-radius:6.75px;overflow:hidden}.al-drawer-content .al-grid-item-icon img{width:100%;height:100%;object-fit:cover;border-radius:6.75px}.al-drawer-content .al-grid-item-label{font-size:16px;line-height:1.35;letter-spacing:0;font-weight:400}.al-drawer-content .al-grid-item[data-active=true] .al-grid-item-label{font-weight:500}.al-drawer-header{display:flex;align-items:center;justify-content:space-between;padding:16px;flex-shrink:0}.al-drawer-title{font-family:Inter,sans-serif;font-size:16px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--al-text);margin:0}.al-drawer-close{display:inline-flex;align-items:center;justify-content:center;padding:4px;border:none;background:transparent;border-radius:4px;cursor:pointer;color:var(--ds-content-low, #00000066);transition:opacity .15s ease}.al-drawer-close:hover{opacity:.7}.al-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:4px;padding:8px}.al-grid-item{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:16px 12px;border:none;background:var(--al-bg);border-radius:8px;cursor:pointer;transition:none;color:var(--al-text);text-align:left;font-family:Inter,sans-serif;flex-shrink:0}.al-grid-item:hover,.al-grid-item[data-active=true]{background:#252b39!important}:root[data-ds-theme=light] .al-grid-item:hover,:root[data-ds-theme=light] .al-grid-item[data-active=true]{background:#eff3f8!important}.al-grid-item-left{display:flex;align-items:center;gap:8px;min-width:0;overflow:hidden}.al-grid-item-right{display:flex;align-items:center;gap:6px;flex-shrink:0}.al-grid-item-icon{display:flex;align-items:center;justify-content:center;width:24px;height:24px;flex-shrink:0}.al-grid-item-icon img{width:100%;height:100%;object-fit:contain}.al-grid-item-label{font-family:Inter,sans-serif;font-size:16px;font-weight:500;line-height:150%;letter-spacing:0;color:var(--al-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.al-badge{display:flex;padding:1px 4px 2px;justify-content:center;align-items:center;gap:2px;border-radius:3px;background:var(--al-badge-bg);color:var(--al-badge-text);font-family:Pretendard,Inter,sans-serif;font-size:10px;font-weight:600;line-height:150%;letter-spacing:0;white-space:nowrap;flex-shrink:0}.al-badge-new{display:flex;width:16px;height:16px;justify-content:center;align-items:center;aspect-ratio:1/1;border-radius:12px;background:var(--ds-system-purple-high, #7346f3);color:var(--al-badge-new-text);font-family:Pretendard,Inter,sans-serif;font-size:9px;font-weight:700;flex-shrink:0}
5
+ `);D("");import{jsx as Jo}from"react/jsx-runtime";function Xr({env:e,theme:t="dark",mobileBreakpoint:n=768,domain:o,children:r}){let a=hn(`(max-width: ${n}px)`),[i,s]=bn.useState(!1),c=bn.useCallback(()=>s(!1),[]),l=Pe(e),d=bn.useMemo(()=>({env:l,theme:t,isMobile:a,open:i,domain:o,close:c}),[l,t,a,i,o,c]);return Jo(Xo.Provider,{value:d,children:a?Jo(pl.Root,{direction:"right",open:i,onOpenChange:s,noBodyStyles:!0,children:r},"drawer"):Jo(Zr.Root,{open:i,onOpenChange:s,children:r},"popover")})}import*as ni from"@radix-ui/react-popover";import{Drawer as ul}from"vaul";import{jsx as Xe,jsxs as fl}from"react/jsx-runtime";function Jr({size:e=18}){return fl("svg",{className:"al-trigger-icon",width:e,height:e,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Xe("rect",{width:"4",height:"4",rx:"2",fill:"currentColor"}),Xe("rect",{x:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),Xe("rect",{x:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),Xe("rect",{y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),Xe("rect",{x:"7",y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),Xe("rect",{x:"14",y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),Xe("rect",{y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),Xe("rect",{x:"7",y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),Xe("rect",{x:"14",y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"})]})}function ei(){return Xe("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Xe("path",{d:"M12 19L5 12M5 12L12 5M5 12H19",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function ti(){return Xe("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Xe("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as eo}from"react/jsx-runtime";function oi({asChild:e,children:t,className:n,style:o}){let{isMobile:r,theme:a}=Jn(),i=t!=null,s=e??!0,c=n?`al-trigger-btn ${n}`:"al-trigger-btn",l=i?t:eo("button",{type:"button",className:c,"data-theme":a,style:o,children:eo(Jr,{size:18})});return r?eo(ul.Trigger,{asChild:s,children:l}):eo(ni.Trigger,{asChild:s,children:l})}import*as on from"react";import*as no from"@radix-ui/react-popover";import{Drawer as wn}from"vaul";import{useQuery as hl}from"@tanstack/react-query";var ri={dev:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/app-launcher.json",stage:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/app-launcher.json",production:"https://contents.crosstoken.io/frontend/common/app-launcher/app-launcher.json"};var ml="https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",gl="https://contents.crosstoken.io/frontend/common/app-launcher/icons";function wt(e,t){return`${e==="production"?gl:ml}/${t}.png`}function ii(e){let t=e==="production"?"production":"stage";return{version:"0.0.1-fallback",items:[{id:"gametoken-cross",label:"Gametoken",description:"Trade game tokens easily using CROSS.",url:{dev:"https://dev-x.crosstoken.io/gametoken/CROSS",stage:"https://stg-x.crosstoken.io/gametoken/CROSS",production:"https://x.crosstoken.io/gametoken/CROSS"},iconUrl:wt(t,"dex"),order:1e3,type:"gametoken",badge:null,isNew:!1},{id:"forge",label:"Forge",description:"Launch Your Game, Ignite the Market",url:{dev:"https://stg-x.crosstoken.io/forge",stage:"https://stg-x.crosstoken.io/forge",production:"https://x.crosstoken.io/forge"},iconUrl:wt(t,"forge"),order:4e3,type:"forge",badge:null,isNew:!0},{id:"crossd",label:"Bridge (CROSSD)",description:"The first decentralized exchange on the CROSS network.",url:{dev:"https://stg.crossdefi.io/swap-bridge",stage:"https://stg.crossdefi.io/swap-bridge",production:"https://www.crossdefi.io/swap-bridge"},iconUrl:wt(t,"crossd"),order:5e3,type:"crossd",badge:null,isNew:!1},{id:"prediction",label:"Prediction",description:"Prediction market",url:{dev:"https://stg-prediction.crossdefi.io",stage:"https://stg-prediction.crossdefi.io",production:"https://prediction.crossdefi.io/"},iconUrl:wt(t,"prediction"),order:6e3,type:"prediction",badge:null,isNew:!0},{id:"rewards",label:"Rewards",description:"Deposit CROSS and earn rewards. Grow together.",url:{dev:"https://stg-x.crosstoken.io/rewards",stage:"https://stg-x.crosstoken.io/rewards",production:"https://x.crosstoken.io/rewards"},iconUrl:wt(t,"reward"),order:7e3,type:"rewards",badge:null,isNew:!1},{id:"nft",label:"NFT",description:"Trade and collect NFTs in the CROSS ecosystem.",url:{dev:"https://stg.crossnft.io/",stage:"https://stg.crossnft.io/",production:"https://www.crossnft.io/"},iconUrl:wt(t,"nft"),order:8e3,type:"nft",badge:null,isNew:!1},{id:"play",label:"Play",description:"Discover and play games on CROSS.",url:{dev:"https://stg-play.cross.nexus",stage:"https://stg-play.cross.nexus",production:"https://play.cross.nexus"},iconUrl:wt(t,"play"),order:8500,type:"play",badge:null,isNew:!0},{id:"shop",label:"Shop",description:"Game Payment Platform & In-Game Currency Store.",url:{dev:"https://www.dev.cross.shop/",stage:"https://www.stage.cross.shop/",production:"https://www.cross.shop/"},iconUrl:wt(t,"shop"),order:9e3,type:"shop",badge:null,isNew:!1},{id:"points",label:"Points",description:"Dive into CROSS World, Earn CROSS Points",url:{dev:"https://stg-x.crosstoken.io/points",stage:"https://stg-x.crosstoken.io/points",production:"https://x.crosstoken.io/points"},iconUrl:wt(t,"point"),order:1e4,type:"points",badge:null,isNew:!1},{id:"wave",label:"Wave",description:"Stream, support, and earn in the CROSS ecosystem.",url:{dev:"https://stg-wave.crosstoken.io/en",stage:"https://stg-wave.crosstoken.io/en",production:"https://wave.crosstoken.io/en"},iconUrl:wt(t,"wave"),order:11e4,type:"wave",badge:null,isNew:!1},{id:"explorer",label:"Explorer",description:"View transactions, blocks, and token data on the CROSS network.",url:{dev:"https://stg-explorer.crosstoken.io/612055",stage:"https://stg-explorer.crosstoken.io/612055",production:"https://explorer.crosstoken.io/612055"},iconUrl:wt(t,"explorer"),order:12e3,type:"explorer",badge:null,isNew:!1}]}}function to(e){let t=Pe(e);return hl({queryKey:["global-menu",t],queryFn:async({signal:n})=>{try{let o=await fetch(ri[t],{cache:"no-store",signal:n});if(!o.ok)throw new Error(`Failed to fetch global menu: ${o.status}`);return o.json()}catch(o){if(n.aborted)throw o;return ii(t)}},staleTime:0,gcTime:0,retry:!1,refetchOnMount:!0})}function Z(...e){return e.filter(Boolean).join(" ")}import{jsx as Re,jsxs as Pn}from"react/jsx-runtime";function bl(e){return e.id==="cross-staking"||e.type==="cross-staking"}function si({align:e="end",sideOffset:t=8,className:n}){let{env:o,theme:r,isMobile:a,domain:i,close:s}=Jn(),{data:c}=to(o),l=on.useMemo(()=>(c?.items??[]).sort((w,k)=>w.order-k.order),[c]),d=8,u=on.useRef(null),h=on.useCallback(w=>{u.current={x:w.clientX,y:w.clientY}},[]),m=typeof window<"u"?window.location.pathname:"",v=on.useCallback((w,k)=>{if(u.current){let I=w.clientX-u.current.x,N=w.clientY-u.current.y;if(u.current=null,Math.abs(I)>d||Math.abs(N)>d)return}let E=k.url[o]??k.url.production,f=ai(E,i);if(!f)try{let I=new URL(E).pathname;if(m===I||m.startsWith(I+"/")){s();return}}catch{}f?window.open(E,"_blank","noopener,noreferrer"):window.location.href=E,s()},[o,i,s,m]),x=Re("div",{className:"al-grid","data-theme":r,children:l.map(w=>{let k=w.url[o]??w.url.production,E=ai(k,i),f=!1;if(!E)try{let I=new URL(k).pathname;f=m===I||m.startsWith(I+"/")}catch{f=!1}return Pn("button",{type:"button",className:"al-grid-item","data-active":f||void 0,onPointerDown:h,onClick:I=>v(I,w),children:[Pn("div",{className:"al-grid-item-left",children:[Re("div",{className:"al-grid-item-icon",children:Re("img",{src:w.iconUrl,alt:w.label,width:24,height:24,loading:"lazy"})}),Re("span",{className:"al-grid-item-label",children:w.label}),w.isNew&&Re("span",{className:"al-badge-new",children:"N"})]}),Re("div",{className:"al-grid-item-right",children:w.badge&&!bl(w)&&Re("span",{className:"al-badge",children:w.badge})})]},w.id)})});return a?Pn(wn.Portal,{children:[Re(wn.Overlay,{className:"al-drawer-overlay"}),Pn(wn.Content,{className:Z("al-drawer-content",n),"data-theme":r,children:[Pn("div",{className:"al-drawer-header",children:[Re(wn.Close,{className:"al-drawer-close",children:Re(ei,{})}),Re(wn.Title,{className:"al-drawer-title",children:"CROSS Services"}),Re(wn.Close,{className:"al-drawer-close",children:Re(ti,{})})]}),Re("div",{className:"al-drawer-body",children:x})]})]}):Re(no.Portal,{children:Re(no.Content,{align:e,sideOffset:t,className:Z("al-popover-content",n),"data-theme":r,children:x})})}function ai(e,t){try{let n=new URL(e).hostname;return typeof window>"u"?!0:n!==(t??window.location.hostname)}catch{return!1}}import*as _e from"react";import*as ys from"@radix-ui/react-popover";import{Drawer as op}from"vaul";import{createContext as wl,useContext as xl}from"react";var er=wl(null);function Ht(){let e=xl(er);if(!e)throw new Error("WalletInfo compound components must be used within <WalletInfo>");return e}var tr=(o=>(o.CROSSx="crossx",o.MetaMask="io.metamask",o.Binance="com.binance.wallet",o))(tr||{}),oo={crossx:{name:"CROSSx",iconUrl:"https://contents.crosstoken.io/wallet/token/images/tCROSS.svg"},"io.metamask":{name:"MetaMask",iconUrl:"https://upload.wikimedia.org/wikipedia/commons/3/36/MetaMask_Fox.svg"},"com.binance.wallet":{name:"Binance Wallet",iconUrl:"https://public.bnbstatic.com/static/images/common/favicon.ico"}};import*as Yi from"react";import{jsx as V,jsxs as Fn}from"react/jsx-runtime";function li({size:e=16,className:t}){return Fn("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[V("path",{d:"M12.6667 4.66667V2.66667C12.6667 2.48986 12.5964 2.32029 12.4714 2.19526C12.3464 2.07024 12.1768 2 12 2H3.33333C2.97971 2 2.64057 2.14048 2.39052 2.39052C2.14048 2.64057 2 2.97971 2 3.33333C2 3.68696 2.14048 4.02609 2.39052 4.27614C2.64057 4.52619 2.97971 4.66667 3.33333 4.66667H13.3333C13.5101 4.66667 13.6797 4.7369 13.8047 4.86193C13.9298 4.98695 14 5.15652 14 5.33333V8M14 8H12C11.6464 8 11.3072 8.14048 11.0572 8.39052C10.8071 8.64057 10.6667 8.97971 10.6667 9.33333C10.6667 9.68696 10.8071 10.0261 11.0572 10.2761C11.3072 10.5262 11.6464 10.6667 12 10.6667H14C14.1768 10.6667 14.3464 10.5964 14.4714 10.4714C14.5964 10.3464 14.6667 10.1768 14.6667 10V8.66667C14.6667 8.48986 14.5964 8.32029 14.4714 8.19526C14.3464 8.07024 14.1768 8 14 8Z",stroke:"currentColor",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"}),V("path",{d:"M2 3.33325V12.6666C2 13.0202 2.14048 13.3593 2.39052 13.6094C2.64057 13.8594 2.97971 13.9999 3.33333 13.9999H13.3333C13.5101 13.9999 13.6797 13.9297 13.8047 13.8047C13.9298 13.6796 14 13.5101 14 13.3333V10.6666",stroke:"currentColor",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Bn({size:e=16,className:t}){return V("svg",{width:e,height:e,viewBox:"4 4 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:V("path",{d:"M9.40284 17.0647H4.85156V4.84656H17.0697V9.39783H15.4407V6.47565H6.48066V15.4356H9.40284V17.0647ZM21.5192 12.5644H12.5592V21.5244H21.5192V12.5644ZM23.1483 10.9353V23.1535H10.9301V10.9353H23.1483Z",fill:"currentColor"})})}function rn({size:e=16,className:t}){return V("svg",{width:e,height:e,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:V("path",{d:"M11.6667 3.5L5.25 9.91667L2.33334 7",stroke:"currentColor",strokeWidth:1.16667,strokeLinecap:"round",strokeLinejoin:"round"})})}function Lt({size:e=24,className:t}){return V("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:V("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function ci({size:e=20,className:t}){return Fn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[V("path",{d:"M7.5 17.5H4.167A1.667 1.667 0 012.5 15.833V4.167A1.667 1.667 0 014.167 2.5H7.5",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),V("path",{d:"M13.333 14.167L17.5 10l-4.167-4.167M17.5 10H7.5",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function nr({size:e=20,className:t}){return V("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,children:V("path",{d:"M7.91305 10.8327C8.60341 10.8327 9.16305 11.3924 9.16305 12.0827V16.2458C9.16305 16.9361 8.60341 17.4958 7.91305 17.4958H3.75C3.05964 17.4958 2.5 16.9361 2.5 16.2458L2.5 12.0827C2.5 11.3924 3.05964 10.8327 3.75 10.8327H7.91305ZM14.1685 17.4958H12.5027V15.83H14.1685V17.4958ZM17.5 17.4958H15.8342V15.83H17.5V17.4958ZM4.16576 12.4985V15.83H7.49729V12.4985H4.16576ZM12.5027 15.83H10.8369V14.1642H12.5027V15.83ZM15.8342 15.83H14.1685V14.1642H15.8342V15.83ZM14.1685 14.1642H12.5027V12.4985H14.1685V14.1642ZM17.5 14.1642H15.8342V12.4985H17.5V14.1642ZM12.5027 12.4985H10.8369V10.8327H12.5027V12.4985ZM15.8342 12.4985H14.1685V10.8327H15.8342V12.4985ZM7.91305 2.50391C8.60341 2.50391 9.16305 3.06355 9.16305 3.75391V7.91696C9.16305 8.60731 8.60341 9.16696 7.91305 9.16696H3.75C3.05964 9.16696 2.5 8.60731 2.5 7.91696L2.5 3.75391C2.5 3.06355 3.05964 2.50391 3.75 2.50391L7.91305 2.50391ZM16.2419 2.50391C16.9322 2.50391 17.4919 3.06355 17.4919 3.75391V7.91696C17.4919 8.60731 16.9322 9.16696 16.2419 9.16696H12.0788C11.3885 9.16696 10.8288 8.60731 10.8288 7.91696V3.75391C10.8288 3.06355 11.3885 2.50391 12.0788 2.50391L16.2419 2.50391ZM4.16576 4.16967L4.16576 7.50119L7.49729 7.50119L7.49729 4.16967L4.16576 4.16967ZM12.4946 4.16967V7.50119H15.8261V4.16967H12.4946Z",fill:"currentColor",fillOpacity:1})})}function an({size:e=20,className:t}){return V("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:V("path",{d:"M12.5 15L7.5 10L12.5 5",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function sn({size:e=20,className:t}){return V("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:V("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function di({size:e=16,className:t}){return Fn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[V("path",{d:"M1.667 10S4.167 4.167 10 4.167 18.333 10 18.333 10 15.833 15.833 10 15.833 1.667 10 1.667 10z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),V("path",{d:"M10 12.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function pi({size:e=16,className:t}){return Fn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[V("path",{d:"M14.95 14.95A8.283 8.283 0 0110 16.667c-5.833 0-8.333-5.833-8.333-5.833a15.238 15.238 0 014.183-4.884m3.267-1.55A7.55 7.55 0 0110 4.167c5.833 0 8.333 5.833 8.333 5.833a15.28 15.28 0 01-1.783 2.633M11.767 11.767a2.5 2.5 0 11-3.534-3.534",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),V("path",{d:"M1.667 1.667l16.666 16.666",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function fi({size:e=42,className:t}){return V("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 42 42",fill:"none",className:t,children:V("path",{d:"M20.7314 2C31.0766 2 39.4628 10.3863 39.4629 20.7314C39.4629 31.0766 31.0766 39.4629 20.7314 39.4629C10.3863 39.4628 2 31.0766 2 20.7314C2.00007 10.3864 10.3864 2.00007 20.7314 2ZM20.5938 30.0586L21.1084 30.5732L21.623 30.0586V25.2471H21.1084C20.9344 25.2471 20.7626 25.235 20.5938 25.2158V30.0586ZM16.4834 24.6611L14.6514 26.4922L15.3799 27.2207L17.1797 25.4209L18.3193 24.2803C18.0487 24.0673 17.8025 23.8251 17.5869 23.5566L16.4834 24.6611ZM26.8691 27.2207L27.5967 26.4922L26.3516 25.2471H24.8955L26.8691 27.2207ZM11.2666 20.7314L11.7822 21.2471H16.624C16.6048 21.0781 16.5938 20.9065 16.5938 20.7324C16.5938 20.5585 16.6049 20.3866 16.624 20.2178H11.7812L11.2666 20.7314ZM20.5938 11.4053V16.2471C20.7626 16.2279 20.9345 16.2178 21.1084 16.2178H21.623V11.4053L21.1084 10.8906L20.5938 11.4053ZM14.6514 15.0029L16.4521 16.8027L17.5732 17.9238C17.7874 17.6546 18.0315 17.4104 18.3008 17.1963L15.3799 14.2754L14.6514 15.0029ZM25.0371 16.1074L24.9268 16.2178H26.3818L27.5957 15.0029L26.8682 14.2754L25.0371 16.1074Z",fill:"#019D92",stroke:"white",strokeWidth:4})})}function ui({size:e=20,className:t}){return V("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:V("path",{d:"M9.19133 10.8077C9.04905 10.6657 8.87947 10.554 8.69283 10.4792L2.78881 8.11167C2.71832 8.08338 2.65816 8.03421 2.61642 7.97075C2.57468 7.90729 2.55335 7.83258 2.5553 7.75665C2.55724 7.68072 2.58237 7.6072 2.6273 7.54596C2.67224 7.48472 2.73483 7.4387 2.80668 7.41406L16.9525 2.5747C17.0185 2.55087 17.0899 2.54632 17.1583 2.56159C17.2268 2.57685 17.2895 2.6113 17.3391 2.66089C17.3887 2.71049 17.4231 2.77319 17.4384 2.84165C17.4536 2.9101 17.4491 2.9815 17.4253 3.04746L12.5859 17.1933C12.5613 17.2651 12.5152 17.3277 12.454 17.3727C12.3928 17.4176 12.3192 17.4427 12.2433 17.4447C12.1674 17.4466 12.0927 17.4253 12.0292 17.3835C11.9658 17.3418 11.9166 17.2817 11.8883 17.2112L9.52073 11.3056C9.44567 11.1191 9.33362 10.9498 9.19133 10.8077ZM9.19133 10.8077L17.3367 2.66404",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function mi({size:e=20,className:t}){return V("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:V("path",{d:"M10.8333 14.1667V7.5M15 14.1667V4.16667M2.5 2.5V15.8333C2.5 16.2754 2.67559 16.6993 2.98816 17.0118C3.30072 17.3244 3.72464 17.5 4.16667 17.5H17.5M6.66667 14.1667V11.6667",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function gi({size:e=20,className:t}){return V("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:V("path",{d:"M6.6665 9.99984H13.3332M9.99984 6.6665V13.3332M18.3332 9.99984C18.3332 14.6022 14.6022 18.3332 9.99984 18.3332C5.39746 18.3332 1.6665 14.6022 1.6665 9.99984C1.6665 5.39746 5.39746 1.6665 9.99984 1.6665C14.6022 1.6665 18.3332 5.39746 18.3332 9.99984Z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function hi({size:e=20,className:t}){return V("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:V("path",{d:"M6.667 2.5 3.333 5.833 6.667 9.167M3.333 5.833h13.334M13.333 17.5l3.334-3.333-3.334-3.334M16.667 14.167H3.333",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function bi({size:e=20,className:t}){return Fn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[V("circle",{cx:"10",cy:"10",r:"10",fill:"currentColor"}),V("path",{d:"M6 10.2L8.6 12.8L14 7.2",stroke:"var(--ds-accent-primary-on, #ffffff)",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"})]})}import*as A from"react";import ln from"bignumber.js";function vl(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return t>0&&e.charCodeAt(t-1)===46&&t--,e.slice(0,t)}function Gt(e,t){if(!e||e==="0")return"0.00";let n=new ln(e).shiftedBy(-t),o=n.isGreaterThanOrEqualTo(1)?2:4;return n.toFormat(o,ln.ROUND_DOWN)}function Je(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}function or(e){let t=typeof e=="string"?parseFloat(e):e;if(Number.isNaN(t)||t===0)return"$0.00";let n=t>=1?2:4,o=Math.pow(10,n);return`$${(Math.floor(t*o)/o).toLocaleString("en-US",{minimumFractionDigits:n,maximumFractionDigits:n})}`}function wi(e,t,n){let r=new ln(e).shiftedBy(-t).multipliedBy(new ln(n));return r.isZero()||r.isNaN()?"$0.00":`$${(r.integerValue(ln.ROUND_DOWN).isGreaterThanOrEqualTo(1)?r.decimalPlaces(2,ln.ROUND_DOWN):r.decimalPlaces(4,ln.ROUND_DOWN)).toFormat()}`}function xi(e){if(e===""||e===null||e===void 0)return{displayValue:"0",isLowerBound:!1};let t=typeof e=="number"?e.toString():e;if(t==="0"||t==="0.0")return{displayValue:"0",isLowerBound:!1};let n=t;if(n.includes("e")||n.includes("E")){let i=Number(n);if(!Number.isFinite(i)||i===0)return{displayValue:"0",isLowerBound:!1};n=vl(i.toFixed(18))}let[o="0",r=""]=n.split(".");if(Number(o)>=1){let i=r.slice(0,2).padEnd(2,"0");return{displayValue:`${Number(o).toLocaleString("en-US")}.${i}`,isLowerBound:!1}}return r.length<4?{displayValue:`${o}.${r}`,isLowerBound:!1}:r.slice(0,4)==="0000"?{displayValue:"0.0001",isLowerBound:!0}:{displayValue:`0.${r.slice(0,4)}`,isLowerBound:!1}}import{useMemo as yl}from"react";import{useQuery as kl}from"@tanstack/react-query";var st={dev:"https://stg-wallet-server.crosstoken.io/api",stage:"https://stg-wallet-server.crosstoken.io/api",production:"https://wallet-server.crosstoken.io/api"},we={dev:{cross:612044,bsc:97},stage:{cross:612044,bsc:97},production:{cross:612055,bsc:56}};var Sl="send:chain-info";function Cl(e){if("data"in e&&e.data!==void 0){let t=e.data;if(Array.isArray(t)){let n=t[0];if(!n)throw new Error("Chain info payload is empty.");return n}return t}return e}function rr(e,...t){let n=e.replace(/\/+$/,""),o=t.map(r=>r.replace(/^\/+|\/+$/g,"")).filter(Boolean);return[n,...o].join("/")}function Rl(e,t,n,o){if(o)return t===we[e].cross?vi(t,o):n?.explorer_url?rr(n.explorer_url,n.explorer_postfix?.transaction??"tx",o):Nl(e,t,o)}function vi(e,t){return rr("https://explorer.crosstoken.io",String(e),"tx",t)}function Nl(e,t,n){let o=we[e];if(t===o.cross)return vi(t,n);if(t===o.bsc)return rr(e==="production"?"https://bscscan.com":"https://testnet.bscscan.com","tx",n)}function ro(e,t,n,o=!0){let r=st[e],a=kl({queryKey:[Sl,e,t],queryFn:async({signal:c})=>{let l=await fetch(`${r}/v1/public/chain/info/${t}`,{cache:"no-store",signal:c});if(!l.ok)throw new Error(`Failed to fetch chain info: ${l.status}`);let d=await l.json();if("code"in d&&d.code!==void 0&&d.code!==200)throw new Error(`Chain info API error: ${d.code}`);return Cl(d)},enabled:o,staleTime:300*1e3}),i=a.data;return{transactionUrl:yl(()=>Rl(e,t,i,n),[t,i,e,n]),chainInfo:i,...a}}var yi="0x0000000000000000000000000000000000000001";var Tl="0xa9059cbb",Il=/^0x[a-fA-F0-9]{40}$/,Ll="nexus-cross:dapp-ui:send:recent:",ki=10;function El(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return e.slice(0,t)}function Mn(e){return e.toLowerCase()}function Et(e){return Il.test(e)}function Ut(e){return Mn(e.address)===yi}function ir(e){return`${Ll}${e.toLowerCase()}`}function xn(e){if(typeof window>"u")return[];try{let t=window.localStorage.getItem(ir(e));if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(o=>o!==null&&typeof o=="object"&&Et(o.address)&&typeof o.updatedAt=="number").slice(0,ki):[]}catch{return[]}}function ar(e,t){if(typeof window>"u")return[];let n=Mn(t),o=[{address:n,updatedAt:Date.now()},...xn(e).filter(r=>r.address!==n)].slice(0,ki);try{window.localStorage.setItem(ir(e),JSON.stringify(o))}catch{return xn(e)}return o}function sr(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(ir(e))}catch{}}function cn(e,t){let n=e.trim();if(!n)return{error:"Enter an amount."};if(!/^\d+(\.\d*)?$/.test(n))return{error:"Enter a valid amount."};let[o="0",r=""]=n.split(".");if(r.length>t)return{error:`Max ${t} decimal places.`};let a=BigInt(o||"0"),i=r.padEnd(t,"0"),s=i?BigInt(i):0n,c=10n**BigInt(t),l=a*c+s;return l<=0n?{error:"Amount must be greater than 0."}:{value:l}}function lr(e,t){let n=BigInt(e||"0"),o=10n**BigInt(t),r=n/o,a=n%o;if(a===0n)return r.toString();let i=El(a.toString().padStart(t,"0"));return`${r.toString()}.${i}`}function cr(e,t){let n=e.replace(/^0x/,"").toLowerCase().padStart(64,"0"),o=t.toString(16).padStart(64,"0");return`${Tl}${n}${o}`}function io(e,t,n=10){if(t<=0)return e.toString();let o=10n**BigInt(t),r=e/o,a=e%o;if(a===0n)return r.toString();let s=a.toString().padStart(t,"0").slice(0,Math.max(0,Math.min(n,t)));return s=s.replace(/0+$/,""),s?`${r.toString()}.${s}`:r.toString()}function dr(e,t){return io(e,t,6)}function Si(e){return io(e,9,2)}function Ci(e){return e.toLocaleString("en-US")}function ao(e){return e===56||e===97}function so(e){return e.gasPrice??e.maxFeePerGas}function Ri(e,t=!1){return t?so(e)!==void 0?"legacy":null:e.maxFeePerGas!==void 0?"dynamic":e.gasPrice!==void 0?"legacy":null}function lo(e,t=!1){if(t){let n=so(e);return n!==void 0?e.gasLimit*n:null}return e.maxFeePerGas!==void 0?e.gasLimit*e.maxFeePerGas:e.gasPrice!==void 0?e.gasLimit*e.gasPrice:null}function co(e){return!Number.isFinite(e)||e<=0?"$0.00":`$${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function Ni(e,t=0){if(t>4||e===null||e===void 0)return"";if(typeof e=="string")return e.toLowerCase();if(typeof e!="object")return"";let n=e,o=[];return typeof n.name=="string"&&o.push(n.name),typeof n.shortMessage=="string"&&o.push(n.shortMessage),typeof n.message=="string"&&o.push(n.message),typeof n.details=="string"&&o.push(n.details),n.cause!==void 0&&o.push(Ni(n.cause,t+1)),o.join(`
6
+ `).toLowerCase()}function Al(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;if(e&&typeof e=="object"){let t=e;if(typeof t.shortMessage=="string")return t.shortMessage;if(typeof t.message=="string")return t.message}return""}function pr(e,t={},n="Failed to send transaction."){let o=Ni(e);if(!o)return n;let r=t.nativeSymbol?.trim()||"gas token",a=t.networkName?.trim();if(o.includes("user rejected")||o.includes("userrejected")||o.includes("user denied")||o.includes("user cancelled")||o.includes("user canceled")||o.includes("action_rejected")||o.includes("rejected by user"))return"Transaction was cancelled.";if(o.includes("insufficientfunds")||o.includes("insufficient funds")||o.includes("exceeds the balance of the account")||o.includes("insufficient balance for transfer")){let i=a?` on ${a}`:"";return`Not enough ${r} to cover the gas fee.Please top up your ${r} balance and try again.`}return o.includes("transaction underpriced")||o.includes("replacement transaction underpriced")||o.includes("fee too low")?"Gas fee was too low for the network. Please try again.":o.includes("nonce too low")||o.includes("nonce has already been used")||o.includes("nonce too high")?"Pending transactions are out of order. Refresh the page and try again.":o.includes("execution reverted")||o.includes("contractfunctionrevertederror")||o.includes("contractfunctionexecutionerror")?"The transaction was rejected by the contract. The recipient or token may be invalid.":o.match(/chain \d+ is not configured/)?"This network is not registered in the app. Contact support.":o.includes("http request failed")||o.includes("failed to fetch")||o.includes("network request failed")||o.includes("timeout")||o.includes("econnreset")||o.includes("rpc error")||o.includes("429")?"Network connection failed. Check your internet and try again.":o.includes("estimategas")||o.includes("gas estimation failed")?"Could not estimate the gas fee. The recipient address or amount may be invalid.":Al(e)||n}var Pl=2000000000n,Bl=1000000000n;async function po(e,t,n){let o=new AbortController,r=setTimeout(()=>o.abort(),8e3),a=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:t,params:n}),signal:o.signal}).finally(()=>clearTimeout(r));if(!a.ok)throw new Error(`RPC ${t} HTTP ${a.status}`);let i=await a.json();if(i.error)throw new Error(`RPC ${t}: ${i.error.message}`);if(i.result===void 0)throw new Error(`RPC ${t}: empty result`);return i.result}function fo(e){return BigInt(e)}function Fl(e){return`0x${e.toString(16)}`}function Ml(e){let t={to:e.to};return e.from&&(t.from=e.from),e.value!==void 0&&e.value>0n&&(t.value=Fl(e.value)),e.data&&(t.data=e.data),t}function _l(e){return e===56||e===97}async function Ti(e){try{let t=await po(e,"eth_gasPrice",[]);return{gasPrice:fo(t)}}catch{return{gasPrice:Pl}}}async function Ol(e,t){let n=Bl;try{let o=await po(e,"eth_maxPriorityFeePerGas",[]);n=fo(o)}catch{}return{maxFeePerGas:t+n,maxPriorityFeePerGas:n}}async function zl(e,t){if(t)return Ti(e);let n;try{n=(await po(e,"eth_getBlockByNumber",["latest",!1]))?.baseFeePerGas}catch{}return n?Ol(e,fo(n)):Ti(e)}async function Ii(e,t){let n=_l(t.chainId),o=Ml(t),[r,a]=await Promise.all([po(e,"eth_estimateGas",[o]),zl(e,n)]);return{gasLimit:fo(r),gasPrice:a.gasPrice,maxFeePerGas:a.maxFeePerGas,maxPriorityFeePerGas:a.maxPriorityFeePerGas}}function Li(e){let{estimateGas:t,sendTransaction:n,getTransactionReceipt:o}=e;return{canSend:!!n,canEstimateGas(r){return!!t||!!r},async estimateGas(r,a){if(t)return t(r);if(a)return Ii(a,r);throw new Error("Gas estimation is not available.")},async sendTransaction(r){if(!n)throw new Error("Sending is not available for this wallet.");return n(r)},getTransactionReceipt:o}}var Dl=1500,Wl=120;function Ei(e){return!!(e.token||e.recipient||e.amount)}function fr({recipient:e,amount:t,token:n,balanceRaw:o}){let r={},a=e.trim(),i=cn(t,n.quantity.decimals),s;return a?Et(a)||(r.recipient="Enter a valid EVM recipient address."):r.recipient="Enter a recipient address.","error"in i?r.amount=i.error:(s=i.value,s>o&&(r.amount="Amount exceeds available balance.")),!Ut(n)&&!Et(n.address)&&(r.token="Token contract address is invalid."),{errors:r,rawAmount:r.amount?void 0:s,recipient:a&&Et(a)?a:void 0}}function ur({token:e,walletAddress:t,recipient:n,rawAmount:o}){let r=t;return Ut(e)?{to:n,value:o,chainId:e.chainId,from:r}:{to:Mn(e.address),data:cr(n,o),value:0n,chainId:e.chainId,from:r}}function Hl(e){let{status:t}=e;return t==="reverted"||t==="0x0"||t===0||t===0n||t===!1}var Gl=e=>new Promise(t=>setTimeout(t,e));async function Ai({repository:e,args:t,chainId:n,onSubmitted:o,pollIntervalMs:r=Dl,pollMaxAttempts:a=Wl}){let i=await e.sendTransaction(t);o(i);let{getTransactionReceipt:s}=e;if(!s)return"success";for(let c=0;c<a;c+=1){let l=await s({hash:i,chainId:n}).catch(()=>null);if(l)return Hl(l)?"reverted":"success";await Gl(r)}return"timeout"}var Pi=["token","recipient","amount","review"];function Bi(e){let{env:t,walletAddress:n,accountName:o,accounts:r=[],initialStep:a="recipient",token:i,tokens:s=[],onTokenChange:c,sendTransaction:l,getTransactionReceipt:d,estimateGas:u,getTokenPriceUsd:h,onSubmitted:m,onSuccess:v,onFailed:x,onExit:w,onOutlink:k}=e,E=A.useMemo(()=>Li({sendTransaction:l,getTransactionReceipt:d,estimateGas:u}),[l,d,u]),[f,I]=A.useState(i);A.useEffect(()=>{I(i)},[i.address,i.chainId]);let[N,P]=A.useState(a),[M,Y]=A.useState(""),[_,K]=A.useState(""),[z,X]=A.useState({}),[O,me]=A.useState("idle"),[te,ie]=A.useState(""),[je,ae]=A.useState(""),[H,se]=A.useState(null),[ee,G]=A.useState(!1),[Ve,pe]=A.useState(""),Le=A.useRef(0),[fe,ut]=A.useState(null),[ve,Dt]=A.useState(""),[Oe,Rt]=A.useState(()=>xn(n)),_t=A.useMemo(()=>Pe(t),[t]),{transactionUrl:le,chainInfo:ge}=ro(_t,f.chainId,te||void 0,!0),nt=ge?.currency_symbol??"",ye=ge?.name??`Chain ID ${f.chainId}`,he=A.useRef({nativeSymbol:nt||void 0,networkName:ye,tokenSymbol:f.symbol});he.current={nativeSymbol:nt||void 0,networkName:ye,tokenSymbol:f.symbol};let ce=A.useMemo(()=>BigInt(f.quantity.numeric||"0"),[f.quantity.numeric]),Nt=A.useMemo(()=>Gt(f.quantity.numeric,f.quantity.decimals),[f.quantity.numeric,f.quantity.decimals]),qe=h?.(f),Tt=A.useMemo(()=>{if(qe===void 0)return;let S=parseFloat(_.replace(/,/g,""));return Number.isFinite(S)?S*qe:0},[_,qe]);A.useEffect(()=>{K(""),X({})},[f.address,f.chainId]),A.useEffect(()=>{Le.current+=1,se(null),pe(""),G(!1)},[f.address,f.chainId,M,_]),A.useEffect(()=>{Rt(xn(n))},[n]);let Ke=A.useCallback(S=>{Y(S),X($=>({...$,recipient:void 0}))},[]),ot=A.useCallback(S=>{K(S),X($=>({...$,amount:void 0}))},[]),ze=A.useCallback(()=>{K(Nt.replace(/,/g,"")),X(S=>({...S,amount:void 0}))},[Nt]),ke=A.useCallback(S=>{I(S),c?.(S),P("recipient")},[c]),mt=A.useCallback(()=>P("token"),[]),Qe=A.useCallback(()=>{P(S=>{if(S==="result")return"review";if(S===a)return w?.(),S;let $=Pi.indexOf(S);return $<=0?(w?.(),S):Pi[$-1]})},[a,w]),De=A.useCallback(()=>{let{errors:S}=fr({recipient:M,amount:"1",token:f,balanceRaw:ce});if(S.recipient){X($=>({...$,recipient:S.recipient}));return}X($=>({...$,recipient:void 0})),P("amount")},[M,f,ce]),be=A.useCallback(S=>{Y(S),X($=>({...$,recipient:void 0})),P("amount")},[]),ne=A.useCallback(()=>{let S=fr({recipient:M,amount:_,token:f,balanceRaw:ce});X(S.errors),!(Ei(S.errors)||S.rawAmount===void 0||!S.recipient)&&(ut(S.rawAmount),Dt(S.recipient),se(null),pe(""),me("idle"),P("review"))},[M,_,f,ce]);A.useEffect(()=>{if(N!=="review"||!ve||fe===null||H!==null||ee||Ve||!E.canEstimateGas(ge?.rpc))return;let S=++Le.current;G(!0),pe(""),(async()=>{try{let $=ur({token:f,walletAddress:n,recipient:ve,rawAmount:fe}),oe=await E.estimateGas($,ge?.rpc);if(Le.current!==S)return;se(oe)}catch($){if(Le.current!==S)return;pe(pr($,he.current,"Failed to estimate gas."))}finally{Le.current===S&&G(!1)}})()},[N,ve,fe,H,ee,Ve,E,ge?.rpc,f,n]);let rt=A.useMemo(()=>{if(!Ut(f)||!H||fe===null)return!1;let S=lo(H,ao(f.chainId));return S===null?!1:fe+S>ce},[f,H,fe,ce]),gt=A.useCallback(async()=>{if(!(!ve||fe===null)&&!rt){ae(""),ie(""),me("submitting");try{let S="",$=await Ai({repository:E,args:ur({token:f,walletAddress:n,recipient:ve,rawAmount:fe}),chainId:f.chainId,onSubmitted:oe=>{S=oe,ie(oe),me("confirming"),Rt(ar(n,ve)),m?.({txHash:oe,chainId:f.chainId,amount:_,tokenSymbol:f.symbol,recipient:ve})}});if($==="success")me("success"),S&&v?v?.(S):P("result");else if($==="reverted"){let oe="Transaction reverted on-chain.";me("error"),ae(oe),S&&x?x({txHash:S,chainId:f.chainId,message:oe}):P("result")}else{let oe="Transaction receipt was not found. Please check again later.";me("error"),ae(oe),S&&x?x({txHash:S,chainId:f.chainId,message:oe}):P("result")}}catch(S){me("error"),ae(pr(S,{nativeSymbol:nt||void 0,networkName:ye,tokenSymbol:f.symbol})),P("result")}}},[E,ve,fe,rt,f,_,n,m,v,x,nt,ye]),[We,ht]=A.useState(!1),it=A.useRef(void 0);A.useEffect(()=>()=>clearTimeout(it.current),[]);let He=A.useCallback(async()=>{if(te)try{await navigator.clipboard.writeText(te),ht(!0),clearTimeout(it.current),it.current=setTimeout(()=>ht(!1),2e3)}catch{}},[te]),Ge=A.useCallback(()=>{if(!le||!te)return;let S=Ye=>{typeof window<"u"&&window.open(Ye,"_blank","noopener,noreferrer")};if(!k){S(le);return}let $=k(le,{category:"send",origin:"send-transaction",payload:{chainId:f.chainId,txHash:te}});if($&&typeof $.then=="function"){let Ye=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null;$.then(at=>{if(at===null){Ye?.close();return}let It=at??le;if(Ye)try{Ye.location.href=It}catch{Ye.close(),S(It)}else S(It)});return}let oe=$;oe!==null&&S(oe??le)},[k,f.chainId,le,te]),Ue=A.useCallback(()=>{ae(""),ie(""),me("idle"),se(null),pe(""),P("review")},[]);return{step:N,status:O,token:f,tokens:s.length>0?s:[f],recipient:M,amount:_,amountUsd:Tt,fieldErrors:z,error:je,txHash:te,gasEstimate:H,gasLoading:ee,gasError:Ve,insufficientGas:rt,reviewRawAmount:fe,reviewRecipient:ve,recentAddresses:Oe,accounts:r,accountName:o,walletAddress:n,resolvedEnv:_t,transactionUrl:le,networkName:ye,nativeSymbol:nt,nativeDecimals:ge?.currency_decimals??f.quantity.decimals,balanceRaw:ce,balanceText:Nt,priceUsd:qe,canSelectToken:(s.length>0?s:[f]).length>1,canSend:E.canSend,getTokenPriceUsd:h,setRecipient:Ke,setAmount:ot,setMax:ze,selectToken:ke,goToTokenSelect:mt,selectRecipient:be,submitRecipient:De,submitAmount:ne,confirmSend:gt,retry:Ue,back:Qe,hashCopied:We,copyHash:He,openTransaction:Ge}}import*as xt from"react";import{jsx as _n,jsxs as mr}from"react/jsx-runtime";function Fi({flow:e}){let{amount:t,setAmount:n,amountUsd:o,balanceText:r,balanceRaw:a,token:i,setMax:s}=e,c=xt.useRef(null),l=xt.useCallback(()=>{requestAnimationFrame(()=>{let x=c.current;if(!x)return;let w=x.value.length;x.setSelectionRange(w,w)})},[]);xt.useEffect(()=>{c.current?.focus(),l()},[l]),xt.useEffect(()=>{t===""&&(h(!1),l())},[t,l]);let d=xt.useMemo(()=>{let x=cn(t,i.quantity.decimals);return"value"in x&&x.value>a},[t,i.quantity.decimals,a]),[u,h]=xt.useState(!1),m=!u&&t===""?"0.00":t,v=t.trim()===""||t.trim()==="0";return _n("div",{className:"sf-body sf-amount",children:mr("div",{className:"sf-amount-center",children:[_n("span",{className:"sf-amount-usd",children:o!==void 0?co(o):"\xA0"}),_n("div",{className:"sf-amount-input-wrap","data-over":d||void 0,"data-empty":v||void 0,onClick:()=>c.current?.focus(),children:_n("input",{ref:c,className:"sf-amount-input",value:m,onChange:x=>{let w=x.target.value;if(u)n(w);else if(t===""){if(w.length<4)return;h(!0);let k=w.startsWith("0.00")?w.slice(4):w;n(k)}else h(!0),n(w)},placeholder:"0.00",inputMode:"decimal",autoComplete:"off","aria-label":`Amount in ${i.symbol}`,size:1})}),mr("div",{className:"sf-amount-balance",children:[_n("span",{children:"Balance:"}),mr("button",{type:"button",className:"sf-amount-max",onClick:s,children:[r," ",i.symbol]})]})]})})}import*as vt from"react";var gr={dev:"https://stg-bonding-curve-api.crosstoken.io/api",stage:"https://stg-bonding-curve-api.crosstoken.io/api",production:"https://bonding-curve-api.crosstoken.io/api"},Mi={cross:"https://contents.crosstoken.io/wallet/token/images/CROSS.svg",bsc:"https://contents.crosstoken.io/wallet/token/images/BSC.svg"};function On(e,t){let n=we[e];if(t===n.cross)return Mi.cross;if(t===n.bsc)return Mi.bsc}var Ul={dev:"https://dev-portrait.crosstoken.io",stage:"https://dev-portrait.crosstoken.io",production:"https://portrait.crosstoken.io"};function Ot(e,t,n={}){if(!t||!t.startsWith("0x"))return;let{size:o=120,bg:r,format:a="png"}=n,i=Ul[e],s=r?`&bg=${r}`:"";return`${i}/portrait/evm/${t}.${a}?size=${o}${s}`}import{jsx as lt,jsxs as uo}from"react/jsx-runtime";function _i({size:e=20,className:t}){return uo("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,"aria-hidden":"true",children:[lt("circle",{cx:"9",cy:"9",r:"6",stroke:"currentColor",strokeWidth:"1.7"}),lt("path",{d:"m17 17-3.2-3.2",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function Oi({size:e=20,className:t}){return lt("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",className:t,"aria-hidden":"true",children:lt("path",{d:"M9 2h6a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zM8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-2M12 11v6M9 14h6",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function zi({size:e=20,className:t}){return uo("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,"aria-hidden":"true",children:[lt("circle",{cx:"10",cy:"10",r:"10",fill:"currentColor",opacity:"0.12"}),lt("path",{d:"M7 7l6 6M13 7l-6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})]})}function Di({size:e=16,className:t}){return lt("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",className:t,"aria-hidden":"true",children:lt("path",{d:"M8 3v10m0 0 4-4m-4 4-4-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function Wi({size:e=56,className:t}){return uo("svg",{width:e,height:e,viewBox:"0 0 56 56",fill:"none",className:t,"aria-hidden":"true",children:[lt("circle",{cx:"28",cy:"28",r:"28",fill:"var(--ds-accent-primary-default, #00b4b7)"}),lt("path",{d:"M17 28.5 24.2 35.5 39 20.5",stroke:"var(--ds-accent-primary-on, #ffffff)",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Hi({size:e=56,className:t}){return uo("svg",{width:e,height:e,viewBox:"0 0 56 56",fill:"none",className:t,"aria-hidden":"true",children:[lt("circle",{cx:"28",cy:"28",r:"28",fill:"var(--ds-system-red-default, #da0b2e)"}),lt("path",{d:"M20 20 36 36m0-16L20 36",stroke:"#ffffff",strokeWidth:"4",strokeLinecap:"round"})]})}import{jsx as de,jsxs as At}from"react/jsx-runtime";function Gi(e,t){return e.name||`Account ${(e.index??t)+1}`}function Ui(e){return e.trim().slice(0,1).toUpperCase()||"A"}function $i(e){return e.toLowerCase()}function ji({flow:e}){let{recipient:t,setRecipient:n,fieldErrors:o,recentAddresses:r,accounts:a,walletAddress:i,resolvedEnv:s,selectRecipient:c}=e,l=vt.useMemo(()=>a.filter(f=>f.address.toLowerCase()!==i.toLowerCase()),[a,i]),d=l.length>0,u=vt.useMemo(()=>new Map(l.map((f,I)=>[$i(f.address),{account:f,index:I}])),[l]),[h,m]=vt.useState("recent"),v=vt.useRef(null);vt.useEffect(()=>{v.current?.focus()},[]);let x="1A1A2E",w=vt.useCallback(async()=>{try{let f=await navigator.clipboard.readText();f&&n(f.trim())}catch{}},[n]),k=t.trim().length>0,E=Et(t.trim());return At("div",{className:"sf-recipient",children:[At("div",{className:"sf-recipient-top",children:[At("div",{className:"sf-address-field","data-filled":k||void 0,"data-invalid":o.recipient||void 0,children:[de("textarea",{ref:v,className:"sf-address-input",value:t,onChange:f=>n(f.target.value),placeholder:"Enter the recipient's address",autoComplete:"off",spellCheck:!1,"aria-label":"Recipient address",rows:k?2:1}),k?de("button",{type:"button",className:"sf-address-action",onClick:()=>n(""),"aria-label":"Clear",children:de(zi,{size:20})}):de("button",{type:"button",className:"sf-address-action",onClick:w,"aria-label":"Paste from clipboard",children:de(Oi,{size:20})})]}),o.recipient&&de("p",{className:"sf-field-error",role:"alert",children:o.recipient}),At("div",{className:"sf-tabs",role:"tablist",children:[de("button",{type:"button",role:"tab",className:"sf-tab","data-active":h==="recent"||void 0,"aria-selected":h==="recent",onClick:()=>m("recent"),children:"Recent"}),d&&de("button",{type:"button",role:"tab",className:"sf-tab","data-active":h==="account"||void 0,"aria-selected":h==="account",onClick:()=>m("account"),children:"My Account"})]})]}),de("div",{className:"sf-address-list",children:h==="account"&&d?l.map((f,I)=>{let N=Gi(f,I),P=Ot(s,f.address,{size:56,bg:x});return At("button",{type:"button",className:"sf-address-row",onClick:()=>c(f.address),children:[At("span",{className:"sf-address-avatar",children:[P&&de("img",{src:P,alt:"",width:40,height:40,draggable:!1,onError:M=>{M.currentTarget.style.display="none"}}),de("span",{className:"sf-address-avatar-fallback",children:Ui(N)})]}),At("span",{className:"sf-address-meta",children:[de("span",{className:"sf-address-name",children:N}),de("span",{className:"sf-address-value",children:Je(f.address)})]})]},f.address)}):r.length>0?r.map(f=>{let I=u.get($i(f.address)),N=I?Gi(I.account,I.index):Je(f.address),P=Ot(s,f.address,{size:56,bg:x});return At("button",{type:"button",className:"sf-address-row",onClick:()=>c(f.address),children:[At("span",{className:"sf-address-avatar",children:[P&&de("img",{src:P,alt:"",width:40,height:40,draggable:!1,onError:M=>{M.currentTarget.style.display="none"}}),de("span",{className:"sf-address-avatar-fallback",children:Ui(N)})]}),At("span",{className:"sf-address-meta",children:[de("span",{className:"sf-address-name",children:N}),de("span",{className:"sf-address-value",children:Je(f.address)})]})]},f.address)}):de("div",{className:"sf-empty",children:"No send history"})}),k&&!E&&!o.recipient&&de("p",{className:"sf-field-error",role:"alert",children:"Enter a valid EVM recipient address."})]})}import{jsx as Be,jsxs as vn}from"react/jsx-runtime";function qi({flow:e}){let{status:t,txHash:n,error:o,copyHash:r,hashCopied:a,openTransaction:i}=e,s=t==="error",c=t==="success";return s?vn("div",{className:"sf-body sf-result sf-result--error",children:[Be("span",{className:"sf-result-icon",children:Be(Hi,{size:56})}),vn("div",{className:"sf-result-copy",children:[Be("h3",{className:"sf-result-title",children:"Transaction Failed"}),Be("p",{className:"sf-result-desc",children:o||"Something went wrong. Please try again."})]}),n&&Be(Vi,{txHash:n,hashCopied:a,onCopy:r,onOpen:i})]}):vn("div",{className:"sf-body sf-result",children:[Be("span",{className:"sf-result-icon","data-pending":!c||void 0,children:c?Be(Wi,{size:56}):Be("span",{className:"sf-result-spinner"})}),vn("div",{className:"sf-result-copy",children:[Be("h3",{className:"sf-result-title",children:c?"Transaction Complete":"Transaction in Progress"}),Be("p",{className:"sf-result-desc",children:c?"Your transfer was sent successfully.":"Transfer in progress. Waiting for confirmation."})]}),n&&Be(Vi,{txHash:n,hashCopied:a,onCopy:r,onOpen:i})]})}function Vi({txHash:e,hashCopied:t,onCopy:n,onOpen:o}){return vn("div",{className:"sf-result-hash-card",children:[Be("span",{className:"sf-result-hash-label",children:"Transaction Hash"}),vn("div",{className:"sf-result-hash-row",children:[Be("button",{type:"button",className:"sf-result-hash-link",onClick:o,"aria-label":"Open transaction in explorer",children:Je(e)}),Be("button",{type:"button",className:"sf-result-copy-btn",onClick:n,"aria-label":"Copy transaction hash",children:t?Be(rn,{size:16}):"Copy"})]})]})}import{jsx as re,jsxs as Fe}from"react/jsx-runtime";var mo="\u2014";function Ki({flow:e}){let{token:t,reviewRawAmount:n,reviewRecipient:o,accountName:r,accounts:a,walletAddress:i,networkName:s,nativeSymbol:c,nativeDecimals:l,gasEstimate:d,gasLoading:u,gasError:h,insufficientGas:m,error:v,resolvedEnv:x}=e,w=Ut(t),k=n!==null?io(n,t.quantity.decimals):"",E=r?.trim()||`Account ${(a[0]?.index??0)+1}`,f=Ot(x,i,{size:56,bg:"1A1A2E"}),I=c||(w?t.symbol:""),N=ao(t.chainId),P=d?Ri(d,N):null,M=d?lo(d,N):null,Y=O=>O!==null&&I?`${dr(O,l)} ${I}`:mo,_=O=>O!==void 0?`${Si(O)} Gwei`:mo,K=(()=>{if(!w||!d||M===null||n===null)return mo;let O=n+M;return`${dr(O,l)} ${I||t.symbol}`})(),z=O=>u?"\u2026":O,X=[{label:"Est. Tx Fee",value:z(Y(M))},...P==="dynamic"?[{label:"Max Priority Fee",value:z(_(d?.maxPriorityFeePerGas))},{label:"Max Gas Fee",value:z(_(d?.maxFeePerGas))}]:P==="legacy"?[{label:"Gas Price",value:z(_(d?so(d):void 0))}]:[],{label:"Gas Limit",value:z(d?Ci(d.gasLimit):mo)}];return Fe("div",{className:"sf-body sf-review",children:[Fe("div",{className:"sf-review-amount",children:[re("img",{className:"sf-review-amount-icon",src:t.icon_url,alt:"",width:40,height:40,draggable:!1,onError:O=>{O.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),Fe("span",{className:"sf-review-amount-value",children:[k,re("span",{className:"sf-review-amount-symbol",children:t.symbol})]})]}),Fe("div",{className:"sf-review-parties",children:[Fe("div",{className:"sf-review-card sf-review-party",children:[re("span",{className:"sf-review-party-label",children:"From"}),Fe("div",{className:"sf-review-party-head",children:[re("span",{className:"sf-review-party-avatar",children:f&&re("img",{src:f,alt:"",width:28,height:28,draggable:!1,onError:O=>{O.currentTarget.style.display="none"}})}),re("span",{className:"sf-review-party-name",children:E})]}),re("span",{className:"sf-review-party-addr",children:i})]}),re("span",{className:"sf-review-arrow","aria-hidden":!0,children:re(Di,{size:16})}),Fe("div",{className:"sf-review-card sf-review-party",children:[re("span",{className:"sf-review-party-label",children:"To"}),re("span",{className:"sf-review-party-addr",children:o})]})]}),Fe("section",{className:"sf-review-card",children:[re("h3",{className:"sf-review-section-title",children:"Summary"}),Fe("div",{className:"sf-review-row",children:[re("span",{className:"sf-review-row-label",children:"Network"}),re("span",{className:"sf-review-row-value",children:s})]}),X.map(O=>Fe("div",{className:"sf-review-row",children:[re("span",{className:"sf-review-row-label",children:O.label}),re("span",{className:"sf-review-row-value",children:O.value})]},O.label))]}),Fe("section",{className:"sf-review-card",children:[re("h3",{className:"sf-review-section-title",children:"Total"}),Fe("div",{className:"sf-review-row",children:[re("span",{className:"sf-review-row-label",children:"Total Amount"}),Fe("span",{className:"sf-review-row-value",children:[k," ",t.symbol]})]}),w&&Fe("div",{className:"sf-review-row",children:[re("span",{className:"sf-review-row-label",children:"Max. Total Amount"}),re("span",{className:"sf-review-row-value",children:z(K)})]})]}),m&&!h&&!v&&Fe("div",{className:"sf-message sf-message--error",role:"alert",children:["Not enough ",I||t.symbol," to cover the amount plus the network fee. Reduce the amount and try again."]}),(h||v)&&re("div",{className:"sf-message sf-message--error",role:"alert",children:h||v})]})}import*as go from"react";import{jsx as $t,jsxs as dn}from"react/jsx-runtime";function Qi({flow:e}){let[t,n]=go.useState(""),o=t.trim().toLowerCase(),r=go.useMemo(()=>o?e.tokens.filter(a=>a.symbol.toLowerCase().includes(o)||a.name.toLowerCase().includes(o)):e.tokens,[e.tokens,o]);return dn("div",{className:"sf-body sf-token-select",children:[dn("div",{className:"sf-search",children:[$t(_i,{size:20}),$t("input",{className:"sf-search-input",value:t,onChange:a=>n(a.target.value),placeholder:"Search Tokens",autoComplete:"off",spellCheck:!1,"aria-label":"Search tokens"})]}),dn("div",{className:"sf-token-list",children:[r.map(a=>{let i=`${a.chainId}:${a.address.toLowerCase()}`,s=On(e.resolvedEnv,a.chainId),c=e.getTokenPriceUsd?.(a);return dn("button",{type:"button",className:"sf-token-row",onClick:()=>e.selectToken(a),children:[dn("span",{className:"sf-token-left",children:[dn("span",{className:"sf-token-icon-wrap",children:[$t("img",{className:"sf-token-icon",src:a.icon_url,alt:"",width:40,height:40,loading:"lazy",draggable:!1,onError:l=>{l.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),s&&$t("img",{className:"sf-token-chain-badge",src:s,alt:"","aria-hidden":!0,width:16,height:16,loading:"lazy",draggable:!1,onError:l=>{l.currentTarget.style.display="none"}})]}),$t("span",{className:"sf-token-name",children:a.symbol})]}),dn("span",{className:"sf-token-right",children:[$t("span",{className:"sf-token-balance",children:Gt(a.quantity.numeric,a.quantity.decimals)}),c!==void 0&&$t("span",{className:"sf-token-price",children:co(c)})]})]},i)}),r.length===0&&$t("div",{className:"sf-empty",children:"No tokens found"})]})]})}D(`.sf-root{display:flex;flex-direction:column;flex:1;min-height:0;font-family:inherit}.sf-header{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:24px;flex-shrink:0;position:relative;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.sf-header .sf-header-btn:last-child{position:absolute;top:24px;right:24px}.sf-header-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;flex-shrink:0;padding:0;border:none;background:transparent;color:var(--ds-content-low, rgba(0, 0, 0, .4));cursor:pointer;filter:none;transition:color .15s ease}.sf-header-btn:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85));filter:none}.sf-header-title{position:absolute;left:50%;transform:translate(-50%);text-align:center;font-family:inherit;font-size:18px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);pointer-events:none}.sf-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.15) transparent;overscroll-behavior:contain}[data-theme=light] .sf-body{scrollbar-color:rgba(0,0,0,.12) transparent}.sf-body::-webkit-scrollbar{width:4px;height:4px}.sf-body::-webkit-scrollbar-track,.sf-body::-webkit-scrollbar-corner{background:transparent}.sf-body::-webkit-scrollbar-thumb{border-radius:4px;background:#ffffff26}.sf-body::-webkit-scrollbar-thumb:hover{background:#ffffff40}[data-theme=light] .sf-body::-webkit-scrollbar-thumb{background:#0000001f}[data-theme=light] .sf-body::-webkit-scrollbar-thumb:hover{background:#0003}.sf-empty{padding:32px 0;text-align:center;font-family:inherit;font-size:14px;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-field-error{margin:8px 24px 0;font-family:inherit;font-size:12px;line-height:1.5;color:var(--ds-system-red-default, #da0b2e)}.sf-message--error{margin:16px 0 0;padding:12px 16px;background:var(--ds-system-red-low, #ffeeee);color:var(--ds-system-red-high, #d20609);font-family:inherit;font-size:13px;line-height:1.5;border-radius:12px;width:100%;box-sizing:border-box}.sf-footer{display:flex;flex-shrink:0;padding:16px 24px 24px}.sf-footer:empty{display:none}.sf-footer-row{display:flex;gap:8px;width:100%}.sf-footer-row .sf-btn,.sf-footer-row .sf-btn--secondary{flex:1 1 0;min-width:0}.sf-footer>.sf-btn{width:100%}.sf-btn{appearance:none;display:inline-flex;align-items:center;justify-content:center;flex:1;height:48px;padding:0 24px;border:none;border-radius:12px;font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer;transition:background-color .15s ease,transform .1s ease}.sf-btn--primary{background:var(--ds-accent-primary-default, #00b4b7);color:var(--ds-accent-primary-on, #ffffff)}.sf-btn--primary:hover:not(:disabled):not([data-disabled]){background:var(--ds-accent-primary-high, #00a0a2)}.sf-btn--primary:active:not(:disabled):not([data-disabled]){transform:scale(.97)}.sf-btn--primary[data-disabled],.sf-btn--primary:disabled{background:var(--ds-accent-primary-default, #00b4b7);color:var(--ds-accent-primary-on, #ffffff);cursor:default;opacity:.5}.sf-btn--secondary{flex:0 0 120px;background:var(--ds-surface-default, #ffffff);border:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));color:var(--ds-content-high, rgba(0, 0, 0, .85))}.sf-token-select{padding:0;display:flex;flex-direction:column}.sf-token-select .sf-search{margin:16px 24px}.sf-token-select .sf-token-list{width:100%;margin-top:0}.sf-search{display:flex;align-items:center;gap:8px;padding:12px 16px;border-radius:12px;border:1.5px solid transparent;background:var(--ds-surface-medium, #f5f7fa);color:var(--ds-content-low, rgba(0, 0, 0, .4));box-sizing:border-box;transition:border-color .15s ease}.sf-search:hover{border-color:var(--ds-border-medium, rgba(0, 0, 0, .18))}.sf-search:focus-within{border-color:var(--ds-accent-primary-default, #00b4b7)}.sf-search-input{flex:1;min-width:0;border:none;background:transparent;outline:none;font-family:inherit;font-size:16px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.sf-search-input::placeholder{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-token-list{display:flex;flex-direction:column;margin-top:8px}.sf-token-row{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;padding:12px 24px;border:none;background:transparent;cursor:pointer;text-align:left;font-family:inherit;border-radius:0;box-sizing:border-box;transition:background-color .15s ease}.sf-token-row:hover{background:var(--ds-surface-medium, rgba(0, 0, 0, .04))}.sf-token-left{display:flex;align-items:center;gap:16px;min-width:0}.sf-token-icon-wrap{position:relative;width:40px;height:40px;flex-shrink:0}.sf-token-icon{width:40px;height:40px;border-radius:0;object-fit:contain}.sf-token-chain-badge{position:absolute;right:-2px;bottom:-2px;width:16px;height:16px;border-radius:50%;object-fit:cover}.sf-token-name{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.sf-token-right{display:flex;flex-direction:column;align-items:flex-end;flex-shrink:0}.sf-token-balance{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);white-space:nowrap}.sf-token-price{font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4));white-space:nowrap}.sf-recipient{display:flex;flex-direction:column;flex:1;min-height:0}.sf-recipient-top{display:flex;flex-direction:column;padding:16px 24px 0}.sf-address-field{display:flex;align-items:center;gap:8px;padding:12px;border-radius:12px;border:1.5px solid transparent;background:var(--ds-surface-medium, #f5f7fa);transition:border-color .15s ease;box-sizing:border-box}.sf-address-field:hover{border-color:var(--ds-border-medium, rgba(0, 0, 0, .18))}.sf-address-field:focus-within{border-color:var(--ds-accent-primary-default, #00b4b7)}.sf-address-field[data-filled]{border-color:var(--ds-accent-primary-default, #00b4b7)}.sf-address-field[data-invalid]{border-color:var(--ds-system-red-default, #da0b2e)}.sf-address-input{flex:1;min-width:0;border:none;background:transparent;outline:none;resize:none;overflow:hidden;font-family:inherit;font-size:16px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));word-break:break-word;overflow-wrap:anywhere}.sf-address-input::placeholder{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-address-action{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;flex-shrink:0;padding:0;border:none;background:transparent;border-radius:6px;color:var(--ds-content-low, rgba(0, 0, 0, .4));cursor:pointer;transition:color .15s ease}.sf-address-action:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.sf-address-field[data-filled] .sf-address-action{border-radius:9999px}.sf-tabs{display:flex;gap:0;margin:16px 0 0}.sf-tab{position:relative;padding:8px 12px;border:none;background:transparent;cursor:pointer;font-family:inherit;font-size:16px;font-weight:600;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-tab[data-active]{color:var(--ds-accent-primary-high, #00a0a2)}.sf-tab[data-active]:after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:3px;border-radius:9999px;background:var(--ds-accent-primary-high, #00a0a2)}.sf-address-list{display:flex;flex-direction:column;width:100%;margin-top:8px}.sf-address-row{display:flex;align-items:center;gap:16px;width:100%;padding:12px 24px;border:none;background:transparent;cursor:pointer;text-align:left;font-family:inherit;border-radius:0;box-sizing:border-box;transition:background-color .15s ease}.sf-address-row:hover{background:var(--ds-surface-medium, rgba(0, 0, 0, .04))}.sf-address-avatar{position:relative;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;flex-shrink:0;border-radius:50%;overflow:hidden;background:var(--ds-surface-high, #edf1f2);color:var(--ds-content-medium, rgba(0, 0, 0, .65));font-size:14px;font-weight:600}.sf-address-avatar img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}.sf-address-avatar-fallback{position:relative;z-index:0}.sf-address-meta{display:flex;flex-direction:column;min-width:0}.sf-address-name{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sf-address-value{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.wi-drawer-content .sf-header{padding:16px}.wi-drawer-content .sf-header .sf-header-btn:last-child{top:16px;right:16px}.wi-drawer-content .sf-token-select{padding:0}.wi-drawer-content .sf-token-select .sf-search{margin:16px}.wi-drawer-content .sf-token-row{padding:12px 16px}.wi-drawer-content .sf-recipient-top{padding:16px 16px 0}.wi-drawer-content .sf-address-row{padding:12px 16px}.wi-drawer-content .sf-footer{padding:12px 16px 24px}.wi-drawer-content .sf-field-error,.wi-drawer-content .sf-message--error{margin:16px 0 0;width:auto}.sf-amount{display:flex;flex-direction:column}.sf-amount-center{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:8px;padding:64px 24px 48px;text-align:center}.sf-amount-usd{font-family:inherit;font-size:14px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4));min-height:21px}.sf-amount-input-wrap{display:flex;justify-content:center;max-width:100%}.sf-amount-input{width:auto;max-width:100%;border:none;background:transparent;outline:none;text-align:center;font-family:inherit;font-size:40px;font-weight:700;line-height:1.25;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);field-sizing:content}.sf-amount-input-wrap[data-empty] .sf-amount-input,.sf-amount-input::placeholder{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-amount-input-wrap[data-over] .sf-amount-input{color:var(--ds-system-red-default, #da0b2e)}.sf-amount-balance{display:inline-flex;align-items:center;gap:4px;font-family:inherit;font-size:14px;font-weight:400;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-amount-max{border:none;background:transparent;padding:0;cursor:pointer;font:inherit;color:var(--ds-content-medium, rgba(0, 0, 0, .65));text-decoration:underline;text-underline-offset:2px;transition:color .15s ease}.sf-amount-max:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-drawer-content .sf-amount-center{padding:64px 16px 48px}.sf-review{display:flex;flex-direction:column;gap:16px;padding:24px}.sf-review-amount{display:flex;align-items:center;gap:12px;padding:0;background:transparent}.sf-review-amount-icon{width:40px;height:40px;border-radius:0;object-fit:contain;flex-shrink:0}.sf-review-amount-value{display:inline-flex;flex-direction:column;align-items:flex-start;gap:0;font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);word-break:break-all}.sf-review-amount-symbol{font-size:12px;font-weight:400;line-height:1.5;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-review-parties{position:relative;display:flex;flex-direction:column;gap:0}.sf-review-arrow{position:relative;z-index:1;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;margin:-4px auto;border-radius:50%;background:var(--ds-surface-default, #ffffff);border:1px solid var(--ds-border-medium, rgba(0, 0, 0, .18));color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-review-card{display:flex;flex-direction:column;gap:8px;padding:16px;border-radius:12px;background:var(--ds-surface-medium, #f5f7fa)}.sf-review-party-label{font-family:inherit;font-size:12px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-review-party-head{display:flex;align-items:center;gap:8px}.sf-review-party-avatar{display:inline-flex;width:24px;height:24px;border-radius:50%;overflow:hidden;background:var(--ds-surface-high, #edf1f2);flex-shrink:0}.sf-review-party-avatar img{width:100%;height:100%;object-fit:cover}.sf-review-party-name{font-family:inherit;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.sf-review-party-addr{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:12px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65));word-break:break-all}.sf-review-section-title{margin:0 0 4px;font-family:inherit;font-size:16px;font-weight:600;letter-spacing:-.01em;color:var(--ds-content-highest, #000000)}.sf-review-row{display:flex;flex-direction:column;align-items:flex-start;gap:4px}.sf-review-row-label{font-family:inherit;font-size:12px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-review-row-value{font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));text-align:left;word-break:break-all}.wi-drawer-content .sf-review{padding:16px}.sf-result{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;padding:48px 24px;text-align:center}.sf-result-icon{display:inline-flex;align-items:center;justify-content:center;width:56px;height:56px}.sf-result-spinner{width:56px;height:56px;border-radius:50%;border:4px solid var(--ds-border-medium, rgba(0, 0, 0, .18));border-top-color:var(--ds-accent-primary-default, #00b4b7);animation:sf-spin .8s linear infinite}@keyframes sf-spin{to{transform:rotate(360deg)}}.sf-result-copy{display:flex;flex-direction:column;gap:8px}.sf-result-title{margin:0;font-family:inherit;font-size:18px;font-weight:600;letter-spacing:-.01em;color:var(--ds-content-highest, #000000)}.sf-result-desc{margin:0;font-family:inherit;font-size:14px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-result-hash-card{display:flex;flex-direction:column;gap:8px;width:100%;padding:16px;border-radius:12px;background:var(--ds-surface-medium, #f5f7fa);text-align:left}.sf-result-hash-label{font-family:inherit;font-size:12px;font-weight:500;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-result-hash-row{display:flex;align-items:center;justify-content:space-between;gap:8px}.sf-result-hash-link{border:none;background:transparent;padding:0;cursor:pointer;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:14px;color:var(--ds-accent-primary-high, #00a0a2)}.sf-result-copy-btn{display:inline-flex;align-items:center;justify-content:center;min-width:44px;height:28px;padding:0 10px;border:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));border-radius:8px;background:var(--ds-surface-default, #ffffff);cursor:pointer;font-family:inherit;font-size:12px;font-weight:500;color:var(--ds-content-high, rgba(0, 0, 0, .85))}
7
+ `);import{jsx as xe,jsxs as ho}from"react/jsx-runtime";var $l={token:"Send",recipient:"Send",amount:"Send",review:"Sign Transaction",result:""};function bo({onClose:e,onBackToWallet:t,onConfirmSuccess:n,onSuccess:o,className:r,...a}){let i=Yi.useCallback(k=>{o?.(k),n?.(k)},[n,o]),c=Bi({...a,onSuccess:o||n?i:void 0,onExit:t}),{step:l,status:d}=c,u=Et(c.recipient.trim()),h=cn(c.amount,c.token.quantity.decimals),m="value"in h&&h.value<=c.balanceRaw,v=d==="submitting"||d==="confirming",x=l!=="result",w=$l[l]??"";return ho("div",{className:Z("sf-root",r),"data-step":l,children:[ho("header",{className:"sf-header",children:[x?xe("button",{type:"button",className:"sf-header-btn",onClick:c.back,"aria-label":"Back",children:xe(an,{size:24})}):xe("span",{className:"sf-header-btn","aria-hidden":!0}),xe("span",{className:"sf-header-title",children:w}),xe("button",{type:"button",className:"sf-header-btn",onClick:e,"aria-label":"Close",children:xe(Lt,{size:24})})]}),l==="token"&&xe(Qi,{flow:c}),l==="recipient"&&xe(ji,{flow:c}),l==="amount"&&xe(Fi,{flow:c}),l==="review"&&xe(Ki,{flow:c}),l==="result"&&xe(qi,{flow:c}),ho("footer",{className:"sf-footer","data-step":l,children:[l==="recipient"&&xe("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.submitRecipient,"data-disabled":!u||void 0,"aria-disabled":!u,children:"Next"}),l==="amount"&&xe("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.submitAmount,"data-disabled":!m||void 0,"aria-disabled":!m,children:"Next"}),l==="review"&&ho("div",{className:"sf-footer-row",children:[xe("button",{type:"button",className:"sf-btn sf-btn--secondary",onClick:c.back,disabled:v,children:"Cancel"}),xe("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.confirmSend,disabled:v||!c.canSend||c.insufficientGas,children:v?"Sending...":"Send"})]}),l==="result"&&d==="success"&&xe("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:()=>n?.(c.txHash||void 0),children:"All done"}),l==="result"&&d==="error"&&xe("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.retry,children:"Try Again"})]})]})}import*as Zi from"@radix-ui/react-popover";import{Drawer as jl}from"vaul";import{jsx as wo,jsxs as Vl}from"react/jsx-runtime";function Xi({asChild:e,className:t,children:n}){let{isMobile:o,theme:r,walletAddress:a}=Ht(),i=n!=null,s=e??!0,c=i?n:Vl("button",{type:"button",className:Z("wi-trigger-btn",t),"data-theme":r,"data-mobile":o||void 0,children:[wo(li,{size:o?14:16}),wo("span",{className:"wi-trigger-address",children:Je(a)})]});return o?wo(jl.Trigger,{asChild:s,children:c}):wo(Zi.Trigger,{asChild:s,children:c})}import*as B from"react";import*as Ao from"@radix-ui/react-popover";import{Drawer as Lo}from"vaul";import Hn from"bignumber.js";import{useQueries as ql}from"@tanstack/react-query";import{useMemo as Kl}from"react";var hr="user-balance";async function Ql(e,t,n,o){let r=new URLSearchParams({networkId:`eip155:${t}`,account:n}),a=await fetch(`${e}/v1/public/token/balance?${r}`,{cache:"no-store",signal:o});if(!a.ok)throw new Error(`Failed to fetch token balance: ${a.status}`);let i=await a.json();if(i.code!==200)throw new Error(`Token balance API error: ${i.code}`);return i.data}function jt(e,t,n=!0){let o=st[e],r=we[e],a=[r.cross,r.bsc],i=ql({queries:a.map(d=>({queryKey:[hr,e,t,d],queryFn:({signal:u})=>Ql(o,d,t,u),enabled:!!t&&n,staleTime:0,refetchInterval:n?5e3:!1}))}),s=i.some(d=>d.isLoading),c=i.some(d=>d.isError);return{tokens:Kl(()=>{let d=[];for(let u of i)u.data&&d.push(...u.data);return d},[i]),isLoading:s,isError:c}}import{useQuery as Yl,useQueries as Zl}from"@tanstack/react-query";import{useMemo as Xl}from"react";var Jl="forge-holdings",ec="forge-token-image";async function tc(e,t,n){let o=await fetch(`${e}/v1/users/${t}/holdings`,{cache:"no-store",signal:n});if(!o.ok)throw new Error(`Failed to fetch forge holdings: ${o.status}`);let r=await o.json();if(!r.success)throw new Error("Forge holdings API error");return r.data.items}async function nc(e,t,n){let o=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store",signal:n});if(!o.ok)return{address:t,image_url:""};let r=await o.json();return r.success?{address:t,image_url:r.data.token.image_url}:{address:t,image_url:""}}function Ji(e,t,n=!0){let o=gr[e],{data:r,...a}=Yl({queryKey:[Jl,e,t],queryFn:({signal:i})=>tc(o,t,i),enabled:!!t&&n,staleTime:0,refetchInterval:n?5e3:!1});return{holdings:r??[],...a}}function ea(e,t,n=!0){let o=gr[e],r=Zl({queries:t.map(i=>({queryKey:[ec,e,i],queryFn:({signal:s})=>nc(o,i,s),enabled:n,staleTime:1/0}))});return{imageMap:Xl(()=>{let i=new Map;for(let s of r)s.data&&i.set(s.data.address,s.data.image_url);return i},[r])}}import{useQuery as oc}from"@tanstack/react-query";import{useMemo as rc}from"react";var br="token-stats";function yt(e,t){return`${e}:${t.toLowerCase()}`}function Vt(e,t=!0){let n=st[e],{data:o,...r}=oc({queryKey:[br,e],queryFn:async({signal:i})=>{let s=await fetch(`${n}/v1/public/token/stats`,{cache:"no-store",signal:i});if(!s.ok)throw new Error(`Failed to fetch token stats: ${s.status}`);let c=await s.json();if(c.code!==200)throw new Error(`Token stats API error: ${c.code}`);return c},enabled:t,staleTime:3e4});return{statsMap:rc(()=>{let i=new Map;if(!o?.data)return i;for(let s of o.data){let c=yt(s.chain_id,s.address);i.set(c,s)}return i},[o]),...r}}import{useQuery as ic}from"@tanstack/react-query";var ac="crossd-apy",sc="https://crossd-dashboard-api.crossdefi.io/api/v1/overview";function ta(){let{data:e,...t}=ic({queryKey:[ac],queryFn:async({signal:n})=>{let o=await fetch(sc,{cache:"no-store",signal:n});if(!o.ok)throw new Error(`Failed to fetch CROSSD overview: ${o.status}`);let r=await o.json();if(r.code!==200)throw new Error(`CROSSD overview API error: ${r.code}`);let a=parseFloat(r.data.est_last_epoch_apy);if(!Number.isFinite(a))throw new Error("CROSSD overview returned a non-numeric APY");return a*100},staleTime:6e4});return{apyPercent:e??null,...t}}import{useQuery as lc}from"@tanstack/react-query";import{useMemo as cc}from"react";var dc="token-info";function wr(e,t){return`${t.toLowerCase()}_${e}`}function na(e,t=!0){let n=st[e],{data:o,...r}=lc({queryKey:[dc,e],queryFn:async({signal:i})=>{let s=await fetch(`${n}/v1/public/token/info`,{cache:"no-store",signal:i});if(!s.ok)throw new Error(`Failed to fetch token info: ${s.status}`);let c=await s.json();if(c.code!==200)throw new Error(`Token info API error: ${c.code}`);return c},enabled:t,staleTime:1/0});return{categoryMap:cc(()=>{let i=new Map;if(!o?.data)return i;for(let s of o.data){let c=wr(s.chain_id,s.address);i.set(c,s.category)}return i},[o]),...r}}import{useMemo as pc}from"react";import xr from"bignumber.js";function oa(e,t,n){let{tokens:o,isLoading:r}=jt(e,t,n),{statsMap:a}=Vt(e,n);return pc(()=>{let i=new xr(0);for(let d of o){let u=a.get(yt(d.chainId,d.address));if(!u)continue;let m=new xr(d.quantity.numeric).shiftedBy(-d.quantity.decimals).multipliedBy(new xr(u.price));m.isNaN()||(i=i.plus(m))}let s=i.toFixed(),{displayValue:c,isLowerBound:l}=xi(s);return{totalUsd:s,displayValue:c,isLowerBound:l,isLoading:r}},[o,a,r])}import{QRCodeSVG as Xd}from"qrcode.react";function et(e,t,n,o){if(!o||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.defaultPrevented)return;e.preventDefault();let r;try{r=o(t,n)}catch(l){console.error("[dapp-ui] onOutlink threw:",l);return}let a=l=>{typeof window>"u"||window.open(l,"_blank","noopener,noreferrer")};if((l=>!!l&&(typeof l=="object"||typeof l=="function")&&typeof l.then=="function")(r)){let l=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null,d=u=>{if(u===null){l?.close();return}let h=u??t;if(l)try{l.location.href=h}catch{l.close(),a(h)}else a(h)};r.then(d,u=>{console.error("[dapp-ui] onOutlink rejected:",u),l?.close()});return}let s=r;if(s===null)return;a(s??t)}import*as un from"react";import{Drawer as ld}from"vaul";import{createContext as fc,useContext as uc}from"react";var zn=fc(null);function ct(){let e=uc(zn);if(!e)throw new Error("WalletPortfolio compound components must be used within <WalletPortfolio>");return e}import{Drawer as mc}from"vaul";import{jsx as ra}from"react/jsx-runtime";function ia({asChild:e,children:t}){let{walletAddress:n}=ct(),o=t!=null,r=e??!0,a=o?t:ra("button",{type:"button",children:Je(n)});return ra(mc.Trigger,{asChild:r,children:a})}import{Drawer as Co}from"vaul";import*as Te from"react";import{useQueryClient as id}from"@tanstack/react-query";import{jsx as pn,jsxs as la}from"react/jsx-runtime";function aa({size:e=22,className:t}){return pn("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:pn("path",{d:"M14 4L7 11L14 18",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function sa({size:e=22,className:t}){return la("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[pn("path",{d:"M18.333 3.667v5.5h-5.5",stroke:"currentColor",strokeWidth:1.833,strokeLinecap:"round",strokeLinejoin:"round"}),pn("path",{d:"M16.17 13.75a7.333 7.333 0 11-1.54-7.59L18.333 9.167",stroke:"currentColor",strokeWidth:1.833,strokeLinecap:"round",strokeLinejoin:"round"})]})}function zt({size:e=12,className:t}){return la("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,"aria-hidden":"true",children:[pn("path",{d:"M5 2H2.5A1.5 1.5 0 0 0 1 3.5V9.5A1.5 1.5 0 0 0 2.5 11H8.5A1.5 1.5 0 0 0 10 9.5V7",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"}),pn("path",{d:"M7 1H11V5",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"}),pn("path",{d:"M11 1L6 6",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"})]})}import yn from"bignumber.js";var gc=/^(\d{4}-\d{2}-\d{2})/;function ca(e){if(!e||e.length===0)return;let t=new Map,n;for(let{key:r,cumulative:a}of e.map(i=>({key:gc.exec(i.reference_date)?.[1],cumulative:i.cumulative_earned})).filter(i=>!!i.key&&i.cumulative!=null).sort((i,s)=>i.key<s.key?-1:i.key>s.key?1:0))t.set(r,a),n=r;if(n===void 0)return;let o=new Date().toISOString().slice(0,10);return t.get(o)??t.get(n)}function da(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function kn(e,t){let n=new yn(e).shiftedBy(-t);return!n.isFinite()||n.isZero()?"0":n.isGreaterThanOrEqualTo(1)?n.toFormat(2,yn.ROUND_DOWN):n.toFormat(4,yn.ROUND_DOWN)}function vr(e){return kn(e,0)}function Sn(e,t,n){let o=new yn(n||"0");if(!o.isFinite()||o.isLessThanOrEqualTo(0))return null;let r=new yn(e||"0").shiftedBy(-t).times(o);return r.isFinite()?`$${r.toFormat(2,yn.ROUND_DOWN)}`:null}import{useQuery as hc}from"@tanstack/react-query";import{useMemo as ha}from"react";var xo={dev:"https://stg-cross-game-reward-api.crosstoken.io/api",stage:"https://stg-cross-game-reward-api.crosstoken.io/api",production:"https://cross-game-reward-api.crosstoken.io/api"},pa={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},vo={dev:"https://stg-bonding-curve-api.crosstoken.io/api",stage:"https://stg-bonding-curve-api.crosstoken.io/api",production:"https://bonding-curve-api.crosstoken.io/api"},fa={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},Cn={dev:"https://stg-posa-api.crosstoken.io/api/v1",stage:"https://stg-posa-api.crosstoken.io/api/v1",production:"https://posa-api.crosstoken.io/api/v1"},Dn={dev:"https://dev-stake.ogfcorp.com",stage:"https://stg-stake.ogfcorp.com",production:"https://stake.ogfcorp.com"},ua={dev:`${Dn.dev}/portfolio`,stage:`${Dn.stage}/portfolio`,production:`${Dn.production}/portfolio`},ma={dev:"https://stg-game-swap-api.cross.nexus/v1",stage:"https://stg-game-swap-api.cross.nexus/v1",production:"https://game-swap-api.cross.nexus/v1"},ga={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},qt={dev:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",stage:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",production:"https://contents.crosstoken.io/frontend/common/app-launcher/icons"};var bc="wp:reward-pools";function yo(e,t=!0){let n=xo[e],{data:o,...r}=hc({queryKey:[bc,e],queryFn:async({signal:s})=>{let c=await fetch(`${n}/v1/pools`,{cache:"no-store",signal:s});if(!c.ok)throw new Error(`Failed to fetch pools: ${c.status}`);let l=await c.json();if(l.code!==200)throw new Error(`Pools API error: ${l.code}`);return l},enabled:t,staleTime:0}),a=ha(()=>o?.data.pools.filter(s=>s.pool_type==="CrossPool")??[],[o]),i=ha(()=>o?.data.pools.filter(s=>s.pool_type==="GamePool")??[],[o]);return{crossPools:a,gamePools:i,allPools:o?.data.pools??[],...r}}import{useQuery as wc}from"@tanstack/react-query";import{useMemo as xc}from"react";var vc="wp:user-deposits";function ba(e,t,n=!0){let o=xo[e],r=n&&!!t,{data:a,...i}=wc({queryKey:[vc,e,t],queryFn:async({signal:c})=>{let l=await fetch(`${o}/v1/users/${t}/deposits`,{cache:"no-store",signal:c});if(!l.ok)throw new Error(`Deposits fetch failed: ${l.status}`);let d=await l.json();if(d.code!==200)throw new Error(`Deposits API error: ${d.code}`);return d},enabled:r,staleTime:0});return{depositMap:xc(()=>{let c=new Map;if(!a?.data.user_deposits)return c;for(let l of a.data.user_deposits)c.set(l.pool_address.toLowerCase(),l);return c},[a]),deposits:a?.data.user_deposits??[],...i}}import{useQuery as yc}from"@tanstack/react-query";import{useMemo as kc}from"react";var Sc="wp:token-info";function wa(e,t=!0){let n=st[e],o=we[e].cross,{data:r,...a}=yc({queryKey:[Sc,e],queryFn:async({signal:l})=>{let d=await fetch(`${n}/v1/public/token/info`,{cache:"no-store",signal:l});if(!d.ok)throw new Error(`Failed to fetch token info: ${d.status}`);let u=await d.json();if(u.code!==200)throw new Error(`Token info API error: ${u.code}`);return u},enabled:t,staleTime:300*1e3}),{byChainAddr:i,byChainSym:s}=kc(()=>{let l=new Map,d=new Map;if(!r?.data)return{byChainAddr:l,byChainSym:d};for(let u of r.data){let h=u.address.toLowerCase();l.set(`${u.chain_id}:${h}`,u),l.set(h,u);let m=u.symbol.replace(/^t/,"").toUpperCase(),v=`${u.chain_id}:${m}`;d.has(v)||d.set(v,u),d.has(m)||d.set(m,u)}return{byChainAddr:l,byChainSym:d}},[r]);return{getTokenImage:(l,d)=>{let u=l.toLowerCase(),h=i.get(`${o}:${u}`);if(h?.image)return h.image;let m=i.get(u);if(m?.image)return m.image;if(d){let v=d.replace(/^t/,"").toUpperCase(),x=s.get(`${o}:${v}`);if(x?.image)return x.image;let w=s.get(v);if(w?.image)return w.image}return""},...a}}import{jsx as ko,jsxs as xa}from"react/jsx-runtime";function Kt({title:e,icon:t,iconFit:n="cover",isEmpty:o,children:r}){return xa("div",{className:"wp-svc-card",children:[xa("div",{className:"wp-svc-card-head",children:[ko("img",{className:"wp-svc-card-icon",src:t,alt:"",style:{objectFit:n}}),ko("span",{className:"wp-svc-card-title",children:e})]}),o?ko("div",{className:"wp-svc-empty",children:"No assets yet"}):ko("div",{className:"wp-svc-items",children:r})]})}import yr from"bignumber.js";import{jsx as Ne,jsxs as Me}from"react/jsx-runtime";var Cc="CROSS Rewards";function Rc(e){return new yr(e||"0").isGreaterThan(0)}function va(){let{env:e,walletAddress:t,onOutlink:n}=ct(),o=!!t,{allPools:r}=yo(e,o),{depositMap:a}=ba(e,t,o),{getTokenImage:i}=wa(e,o),s=(d,u)=>`${pa[e]}/rewards/${d.pool_address}?action=${u}`,c=`${qt[e]}/reward.png`,l=r.filter(d=>{let u=a.get(d.pool_address.toLowerCase()),h=u?.deposited_amount??"0",m=u?.claimable_reward??"0";return!(new yr(h).isZero()&&new yr(m).isZero())});return Ne(Kt,{title:Cc,icon:c,isEmpty:l.length===0,children:l.map(d=>{let u=a.get(d.pool_address.toLowerCase()),h=u?.deposited_amount??"0",m=u?.claimable_reward??"0",v=s(d,"withdraw"),x=s(d,"claim"),w=i(d.deposit_token.address,d.deposit_token.symbol),k=d.reward_tokens[0],E=k?i(k.address,k.symbol):"",f=d.reward_tokens.map(K=>K.symbol),I=f.length>0?`${d.deposit_token.symbol}-${f.join("/")}`:d.deposit_token.symbol,N=k?kn(m,k.decimals):"0",P=k?.symbol??"Reward",M=Sn(h,d.deposit_token.decimals,d.deposit_token.price),Y=k?Sn(m,k.decimals,k.price):null,_=!!u&&Rc(m);return Me("article",{className:"wp-item","data-side":"reward",children:[Me("div",{className:"wp-item-body",children:[Me("div",{className:"wp-item-line",children:[Ne("span",{className:"wp-item-label",children:"Pool (Deposit - Earn)"}),Me("div",{className:"wp-svc-token",children:[Me("span",{className:"wp-token-stack","aria-hidden":!0,children:[w&&Ne("img",{className:"wp-svc-token-icon",src:w,alt:""}),E&&Ne("img",{className:"wp-svc-token-icon",src:E,alt:""})]}),Ne("span",{children:I})]})]}),Me("div",{className:"wp-item-line",children:[Ne("span",{className:"wp-item-label",children:"Deposited"}),Me("div",{className:"wp-svc-token wp-svc-token--amount",children:[w&&Ne("img",{className:"wp-svc-token-icon",src:w,alt:""}),Me("div",{className:"wp-svc-amount",children:[Ne("span",{className:"wp-svc-amount-main",children:kn(h,d.deposit_token.decimals)}),M&&Ne("span",{className:"wp-item-usd",children:M})]})]})]}),Me("div",{className:"wp-item-line",children:[Me("span",{className:"wp-item-label",children:["Claimable (",P,")"]}),Me("div",{className:"wp-svc-token wp-svc-token--amount",children:[E&&Ne("img",{className:"wp-svc-token-icon",src:E,alt:""}),Me("div",{className:"wp-svc-amount",children:[Ne("span",{className:"wp-svc-amount-main",children:N}),Y&&Ne("span",{className:"wp-item-usd",children:Y})]})]})]})]}),Me("div",{className:"wp-item-tags",children:[Me("a",{className:"wp-tag wp-tag--muted",href:v,target:"_blank",rel:"noopener noreferrer",onClick:K=>et(K,v,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:d,userDeposit:u}},n),children:[Ne("span",{className:"wp-tag-label",children:"Withdraw"}),Ne(zt,{size:12,className:"wp-tag-icon"})]}),Me("a",{className:"wp-tag wp-tag--mint","data-disabled":!_||void 0,"aria-disabled":!_||void 0,href:_?x:void 0,target:_?"_blank":void 0,rel:_?"noopener noreferrer":void 0,onClick:K=>{if(!_){K.preventDefault();return}et(K,x,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:d,userDeposit:u}},n)},children:[Ne("span",{className:"wp-tag-label",children:"Claim"}),Ne(zt,{size:12,className:"wp-tag-icon"})]})]})]},d.pool_address)})})}import*as kr from"react";import{useQuery as Nc}from"@tanstack/react-query";var Tc="wp:stake-info";function ya(e,t,n=!0){let o=Cn[e],r=n&&!!t,{data:a,...i}=Nc({queryKey:[Tc,e,t],queryFn:async({signal:c})=>{let l=await fetch(`${o}/stake/${t}`,{cache:"no-store",signal:c});if(!l.ok)throw new Error(`Stake info fetch failed: ${l.status}`);let d=await l.json();if(d.code!==0&&d.code!==200)throw new Error(`Stake info API error: ${d.code}`);return d},enabled:r,staleTime:0});return{stakeInfo:a?.data,...i}}import{useQuery as Ic}from"@tanstack/react-query";var Lc="wp:stake-rewards",Ec=31;function ka(e,t,n=!0){let o=Cn[e],r=n&&!!t,{data:a,...i}=Ic({queryKey:[Lc,e,t],queryFn:async({signal:s})=>{let c=await fetch(`${o}/rewards/${t}?limit=${Ec}`,{cache:"no-store",signal:s});if(!c.ok)throw new Error(`Stake rewards fetch failed: ${c.status}`);let l=await c.json();if(l.code!==0&&l.code!==200)throw new Error(`Stake rewards API error: ${l.code}`);return l.data?.data??[]},enabled:r,staleTime:0});return{latestReward:a?.[0]??null,aprAccrued:ca(a),...i}}import{useQuery as Ac}from"@tanstack/react-query";var Pc="wp:network-stats";function Sa(e,t=!0){let n=Cn[e],{data:o,...r}=Ac({queryKey:[Pc,e],queryFn:async({signal:i})=>{let s=await fetch(`${n}/network/stats`,{cache:"no-store",signal:i});if(!s.ok)throw new Error(`Network stats fetch failed: ${s.status}`);let c=await s.json();if(c.code!==0&&c.code!==200)throw new Error(`Network stats API error: ${c.code}`);return c},enabled:t,staleTime:0});return{networkStats:o?.data,...r}}import{useQuery as Bc}from"@tanstack/react-query";var Fc="wp:staking-onchain";function Ca(e,t,n=!0){let o=n&&!!t&&!!e,{data:r,...a}=Bc({queryKey:[Fc,e],queryFn:async()=>{if(!t)throw new Error("stakingRewardsReader not provided");return t(e)},enabled:o,staleTime:0});return{onchain:r,...a}}import{useMemo as Ra}from"react";import Mc from"bignumber.js";function Na(e){return e?.trim().toUpperCase()==="CROSS"}function Ta(e){return new Mc(e||"0").isGreaterThan(0)}function So(e,t,n=!0){let{allPools:o}=yo(e,n),r=Ra(()=>{for(let l of o)for(let d of[l.deposit_token,...l.reward_tokens])if(Na(d?.symbol)&&Ta(d.price))return d.price},[o]),a=n&&r===void 0,{tokens:i}=jt(e,t,a),{statsMap:s}=Vt(e,a),c=we[e].cross;return Ra(()=>{if(r)return r;let l=i.find(d=>d.chainId===c&&Na(d.symbol));if(l){let d=s.get(yt(l.chainId,l.address));if(d&&Ta(d.price))return d.price}return"0"},[r,i,s,c])}import Qt from"bignumber.js";import{Fragment as Oc,jsx as tt,jsxs as kt}from"react/jsx-runtime";var _c="CROSS Staking";function Ia(e){if(!e)return"\u2014";let t=new Qt(e);return t.isFinite()?`${t.toFormat(2,Qt.ROUND_DOWN)}%`:"\u2014"}function La(){let{env:e,walletAddress:t,onOutlink:n,stakingRewardsReader:o}=ct(),r=!!t,{stakeInfo:a}=ya(e,t,r),{latestReward:i,aprAccrued:s}=ka(e,t,r),{networkStats:c}=Sa(e,r),{onchain:l}=Ca(t,o,r),d=So(e,t,r),u=`${qt[e]}/cross-staking.png`,h=ua[e],m=a?.total_stake??"0",v=kr.useMemo(()=>l?new Qt(l.earnedWei.toString()).shiftedBy(-18).toString(10):i?.cumulative_earned??a?.rewards_earned??"0",[l,i,a]),x=kr.useMemo(()=>l?new Qt(l.stakedWei.toString()).shiftedBy(-18):new Qt(m),[l,m]),w=s!==void 0?new Qt(s):void 0,k=a?.days_since_first_stake,E=w!==void 0&&w.isFinite()&&x.isGreaterThan(0)&&k!==null&&k!==void 0?w.div(x).times(365).div(Math.max(1,k)).times(100):void 0,f=!(new Qt(m).isZero()&&new Qt(v).isZero()),I=Dn[e],N=Sn(m,0,d),P=Sn(v,0,d);return tt(Kt,{title:_c,icon:u,iconFit:"contain",isEmpty:!1,children:kt("article",{className:"wp-item","data-side":"stake",children:[tt("div",{className:"wp-item-body",children:f?kt(Oc,{children:[kt("div",{className:"wp-item-line",children:[tt("span",{className:"wp-item-label",children:"Staked"}),kt("div",{className:"wp-svc-amount",children:[kt("span",{className:"wp-svc-amount-main",children:[vr(m)," CROSS"]}),N&&tt("span",{className:"wp-item-usd",children:N})]})]}),kt("div",{className:"wp-item-line",children:[tt("span",{className:"wp-item-label",children:"Rewards Earned"}),kt("div",{className:"wp-svc-amount",children:[kt("span",{className:"wp-svc-amount-main",children:[vr(v)," CROSS"]}),P&&tt("span",{className:"wp-item-usd",children:P})]})]}),kt("div",{className:"wp-item-line",children:[tt("span",{className:"wp-item-label",children:"My APR"}),tt("span",{children:Ia(E?.toString(10))})]})]}):kt("div",{className:"wp-item-line",children:[tt("span",{className:"wp-item-label",children:"Delegation APR"}),tt("span",{children:Ia(c?.apr)})]})}),tt("div",{className:"wp-item-tags",children:kt("a",{className:"wp-tag wp-tag--mint",href:f?h:I,target:"_blank",rel:"noopener noreferrer",onClick:M=>et(M,f?h:I,{category:"portfolio",origin:"portfolio-stake",payload:{stakeInfo:a,networkStats:c}},n),children:[tt("span",{className:"wp-tag-label",children:f?"Manage":"Stake Now"}),tt(zt,{size:12,className:"wp-tag-icon"})]})})]})})}import*as Sr from"react";import{useQuery as zc}from"@tanstack/react-query";var Dc="wp:game-swap-pools";function Ea(e,t,n=!0){let o=ma[e],r=n&&!!t,{data:a,...i}=zc({queryKey:[Dc,e,t],queryFn:async({signal:s})=>{let c=await fetch(`${o}/addresses/${t}/portfolio`,{cache:"no-store",signal:s});if(!c.ok)throw new Error(`Game-swap portfolio fetch failed: ${c.status}`);return(await c.json()).pools??[]},enabled:r,staleTime:0});return{pools:a??[],...i}}import{useQuery as Wc}from"@tanstack/react-query";var Hc="wp:game-swap-lp-balances";function Aa(e,t,n,o){let r=[...n].map(c=>c.toLowerCase()).sort(),a=!!o&&!!t&&r.length>0,{data:i,...s}=Wc({queryKey:[Hc,e,t,r],queryFn:async()=>{if(!o)return{};let c=await o(r),l={};for(let[d,u]of Object.entries(c))l[d.toLowerCase()]=u;return l},enabled:a,staleTime:0});return{balances:i??{},...s}}import Pt from"bignumber.js";import{jsx as dt,jsxs as St}from"react/jsx-runtime";var Gc="Game Swap LP",Ba=18,Uc=new Pt("0.0001");function Pa(e){return e?.trim().toUpperCase()==="CROSS"}function $c(e){return e&&e>0?e:Ba}function jc(e){let t=Pa(e.token_a?.symbol)&&!Pa(e.token_b?.symbol),n=t?e.reserve_a:e.reserve_b,o=$c(t?e.token_a?.decimals:e.token_b?.decimals),r=new Pt(n||"0").shiftedBy(-o);return!r.isFinite()||r.isLessThanOrEqualTo(0)?new Pt(0):r.times(2)}function Vc(e,t){let n=e.token_a?.symbol?.trim()||"TOKEN",o=e.token_b?.symbol?.trim()||"CROSS",r=t?.decimals??Ba,a,i;if(t&&t.totalSupply&&t.totalSupply>BigInt(0)){let s=new Pt(t.balance.toString()),c=new Pt(t.totalSupply.toString()),l=s.div(c);a=l.times(100);let d=l.times(jc(e));if(d.isGreaterThan(0)){let u=new Pt(e.cross_usd||"0");i=u.isGreaterThan(0)?`$${d.times(u).toFormat(2,Pt.ROUND_DOWN)}`:`${d.toFormat(4,Pt.ROUND_DOWN)} CROSS`}}return{pool:e,tokenASymbol:n,tokenBSymbol:o,info:t,lpAmountRaw:t?.balance.toString(),lpDecimals:r,sharePercent:a,valueText:i}}function Fa(){let{env:e,walletAddress:t,onOutlink:n,lpBalanceReader:o}=ct(),r=!!t,{pools:a}=Ea(e,t,r),i=Sr.useMemo(()=>a.map(h=>h.pair_address).filter(Boolean),[a]),{balances:s}=Aa(e,t,i,o),c=`${qt[e]}/dex.png`,l=!!o,d=Sr.useMemo(()=>{let h=a.map(m=>Vc(m,s[m.pair_address?.toLowerCase()]));return l?h.filter(m=>m.lpAmountRaw?new Pt(m.lpAmountRaw).shiftedBy(-m.lpDecimals).isGreaterThanOrEqualTo(Uc):!1):h},[a,s,l]),u=h=>{let m=h.token_a?.address??h.pair_address;return`${ga[e]}/tokens/${m}?trade=deposit`};return dt(Kt,{title:Gc,icon:c,iconFit:"contain",isEmpty:d.length===0,children:d.map(h=>{let{pool:m}=h,v=u(m),x=`${h.tokenASymbol} / ${h.tokenBSymbol}`,w=m.token_a?.logo_url,k=m.token_b?.logo_url;return St("article",{className:"wp-item","data-side":"game-swap",children:[St("div",{className:"wp-item-body",children:[St("div",{className:"wp-item-line",children:[dt("span",{className:"wp-item-label",children:"Pool"}),St("div",{className:"wp-svc-token",children:[St("span",{className:"wp-token-stack","aria-hidden":!0,children:[w&&dt("img",{className:"wp-svc-token-icon",src:w,alt:""}),k&&dt("img",{className:"wp-svc-token-icon",src:k,alt:""})]}),dt("span",{children:x})]})]}),h.lpAmountRaw!==void 0&&St("div",{className:"wp-item-line",children:[dt("span",{className:"wp-item-label",children:"My LP"}),St("span",{children:[kn(h.lpAmountRaw,h.lpDecimals)," LP"]})]}),h.sharePercent!==void 0&&St("div",{className:"wp-item-line",children:[dt("span",{className:"wp-item-label",children:"Pool Share"}),St("span",{children:[h.sharePercent.toFormat(2,Pt.ROUND_DOWN),"%"]})]}),h.valueText!==void 0&&St("div",{className:"wp-item-line",children:[dt("span",{className:"wp-item-label",children:"Value"}),dt("span",{children:h.valueText})]})]}),dt("div",{className:"wp-item-tags",children:St("a",{className:"wp-tag wp-tag--mint",href:v,target:"_blank",rel:"noopener noreferrer",onClick:E=>et(E,v,{category:"portfolio",origin:"portfolio-game-swap",payload:{pool:m}},n),children:[dt("span",{className:"wp-tag-label",children:"Manage"}),dt(zt,{size:12,className:"wp-tag-icon"})]})})]},m.pair_address)})})}import Zt from"bignumber.js";import{useMemo as Jc}from"react";import{useQuery as qc}from"@tanstack/react-query";var Kc="wp:forge-pools";function Ma(e,t,n=!0){let o=vo[e],r=n&&!!t,{data:a,...i}=qc({queryKey:[Kc,e,t],queryFn:async()=>{let c=await fetch(`${o}/v1/users/${t}/pools`,{cache:"no-store"});if(!c.ok)throw new Error(`forge pools fetch failed: ${c.status}`);return(await c.json()).data?.items??[]},enabled:r,staleTime:0}),s=a??[];return{pools:s,isEmpty:s.length===0,...i}}import{useQueries as Qc}from"@tanstack/react-query";import{useMemo as Yc}from"react";var Zc="wp:forge-token-detail";async function Xc(e,t){let n=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store"});return n.ok?(await n.json())?.data?.token??null:null}function _a(e,t,n=!0){let o=vo[e],r=Qc({queries:t.map(s=>({queryKey:[Zc,e,s],queryFn:()=>Xc(o,s),enabled:n&&!!s,staleTime:3e4}))}),a=Yc(()=>{let s=new Map;for(let c=0;c<r.length;c++){let l=r[c]?.data,d=t[c];l&&d&&s.set(d.toLowerCase(),l)}return s},[r,t]),i=r.some(s=>s.isLoading);return{detailMap:a,isLoading:i}}import{jsx as $e,jsxs as Yt}from"react/jsx-runtime";var ed="Forge",Oa=18,td="https://contents.crosstoken.io/wallet/token/images/FT.png";function nd(e){if(!e||e==="0")return"0";let t=new Zt(e).shiftedBy(-Oa);return t.isZero()?"0":t.isGreaterThanOrEqualTo(1)?t.toFormat(2,Zt.ROUND_DOWN):t.toFormat(4,Zt.ROUND_DOWN)}function od(e){let t=Number(e);return!Number.isFinite(t)||t<=0?"0%":t>=1?`${(Math.floor(t*100)/100).toFixed(2)}%`:`${(Math.floor(t*1e4)/1e4).toFixed(4)}%`}function rd(e,t,n){let o=new Zt(n||"0");if(!o.isGreaterThan(0))return null;let r=new Zt(e.total_supply||"0"),a=new Zt(e.lp_balance||"0"),i=new Zt(t?.reserve_b||"0").shiftedBy(-Oa);if(!r.isGreaterThan(0)||!a.isGreaterThan(0)||!i.isGreaterThan(0))return null;let s=i.times(2),l=a.div(r).times(s).times(o);return l.isFinite()?`$${l.toFormat(2,Zt.ROUND_DOWN)}`:null}function za(){let{env:e,walletAddress:t,onOutlink:n}=ct(),o=!!t,{pools:r,isEmpty:a}=Ma(e,t,o),i=Jc(()=>r.map(u=>u.token.address),[r]),{detailMap:s}=_a(e,i,o&&i.length>0),c=So(e,t,o),l=u=>`${fa[e]}/forge/token/${u.token.address}`,d=`${qt[e]}/forge.png`;return $e(Kt,{title:ed,icon:d,iconFit:"contain",isEmpty:a,children:r.map(u=>{let h=s.get(u.token.address.toLowerCase()),m=h?.image_url||h?.image||u.token.image||td,v=h?.symbol||u.token.symbol,x=l(u),w=rd(u,h,c);return Yt("a",{className:"wp-item","data-side":"lp",href:x,target:"_blank",rel:"noopener noreferrer",onClick:k=>et(k,x,{category:"portfolio",origin:"portfolio-forge",payload:{pool:u,tokenDetail:h}},n),children:[Yt("div",{className:"wp-item-body",children:[Yt("div",{className:"wp-item-line",children:[$e("span",{className:"wp-item-label",children:"Asset"}),Yt("div",{className:"wp-svc-token",children:[$e("img",{className:"wp-svc-token-icon",src:m,alt:""}),$e("span",{children:v}),h?.name&&$e("span",{className:"wp-token-subtle",children:h.name})]})]}),Yt("div",{className:"wp-item-line",children:[$e("span",{className:"wp-item-label",children:"LP Balance"}),$e("div",{className:"wp-svc-token wp-svc-token--amount",children:Yt("div",{className:"wp-svc-amount",children:[$e("span",{className:"wp-svc-amount-main",children:nd(u.lp_balance)}),w&&$e("span",{className:"wp-item-usd",children:w})]})})]}),Yt("div",{className:"wp-item-line",children:[$e("span",{className:"wp-item-label",children:"Ownership"}),$e("span",{className:"wp-line-value",children:od(u.pool_ownership)})]})]}),$e("div",{className:"wp-item-tags",children:Yt("span",{className:"wp-tag wp-tag--muted",children:[$e("span",{className:"wp-tag-label",children:"Withdraw"}),$e(zt,{size:12,className:"wp-tag-icon"})]})})]},u.pair_address)})})}D(`.wp-fullscreen[data-theme=dark],.wp-embed[data-theme=dark]{--wp-bg: var(--ds-bg-default, #202530);--wp-header-bg: var(--ds-surface-default, #252b39);--wp-card: var(--ds-surface-medium, #252b39);--wp-control: #292f40;--wp-border: var(--ds-border-default, #292f40);--wp-panel-border: var(--ds-border-medium, rgba(255, 255, 255, .18));--wp-panel-shadow: 0px 4px 30px -1px rgba(0, 0, 0, .28);--wp-text: var(--ds-content-highest, #ffffff);--wp-text-60: var(--ds-content-high, rgba(255, 255, 255, .85));--wp-text-40: var(--ds-content-medium, rgba(255, 255, 255, .65));--wp-text-30: var(--ds-content-low, rgba(255, 255, 255, .4));--wp-chrome-text: #ffffff;--wp-tooltip-bg: #151a23;--wp-tooltip-text: #ffffff;--wp-mint: var(--ds-accent-primary-default, #00a0a2);--wp-green: var(--ds-accent-primary-default, #00a0a2);--wp-accent-soft: var(--ds-accent-primary-low, rgba(0, 160, 162, .14));--wp-red: var(--ds-system-red-default, #e70077);--wp-blue: #0488fc;--wp-purple: #7346f3;--wp-orange: #ff9d00;--wp-claim-primary: #9b8cef;--wp-claim-primary-text: #202530;--wp-claim-secondary-bg: var(--wp-control);--wp-claim-success: #00d4aa;--wp-claim-success-soft: rgba(0, 212, 170, .18);--wp-claim-error: #ff3aa3;--wp-claim-error-soft: rgba(255, 58, 163, .16)}.wp-fullscreen[data-theme=light],.wp-embed[data-theme=light]{--wp-bg: var(--ds-bg-dim, #f5f7fa);--wp-header-bg: var(--ds-surface-default, #ffffff);--wp-card: var(--ds-surface-default, #ffffff);--wp-control: var(--ds-surface-medium, #f5f7fa);--wp-border: var(--ds-border-default, rgba(0, 0, 0, .07));--wp-panel-border: var(--ds-border-medium, rgba(0, 0, 0, .18));--wp-panel-shadow: 0px 4px 30px -1px rgba(0, 0, 0, .15);--wp-text: var(--ds-content-highest, #000000);--wp-text-60: var(--ds-content-high, rgba(0, 0, 0, .85));--wp-text-40: var(--ds-content-medium, rgba(0, 0, 0, .65));--wp-text-30: var(--ds-content-low, rgba(0, 0, 0, .4));--wp-chrome-text: var(--ds-content-high, rgba(0, 0, 0, .85));--wp-card-shadow: none;--wp-tooltip-bg: #192023;--wp-tooltip-text: #ffffff;--wp-mint: var(--ds-accent-primary-default, #00a0a2);--wp-green: var(--ds-accent-primary-default, #00a0a2);--wp-accent-soft: var(--ds-accent-primary-low, #e7f9f8);--wp-red: var(--ds-system-red-default, #e70077);--wp-blue: #0488fc;--wp-purple: #7346f3;--wp-orange: #ff9d00;--wp-claim-primary: #7346f3;--wp-claim-primary-text: #ffffff;--wp-claim-secondary-bg: #ffffff;--wp-claim-success: #019d92;--wp-claim-success-soft: rgba(1, 157, 146, .15);--wp-claim-error: #e70077;--wp-claim-error-soft: rgba(231, 0, 119, .12)}.wp-fullscreen{position:fixed!important;inset:0!important;width:100%!important;height:100dvh!important;max-height:100dvh!important;z-index:50;background:var(--wp-bg);display:flex;flex-direction:column;overflow:hidden;font-family:inherit;font-feature-settings:"calt" 0,"lnum" 1,"pnum" 1;box-sizing:border-box;-webkit-font-smoothing:antialiased;color:var(--wp-chrome-text)}.wp-embed{width:100%;height:100%;min-height:0;background:var(--wp-bg);display:flex;flex-direction:column;overflow:hidden;position:relative;font-family:inherit;font-feature-settings:"calt" 0,"lnum" 1,"pnum" 1;box-sizing:border-box;-webkit-font-smoothing:antialiased;color:var(--wp-chrome-text)}.wp-overlay{position:fixed;inset:0;z-index:49;background:#0009}.wp-header{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:73px;padding:24px;position:relative;border-bottom:1px solid var(--wp-border);background:var(--wp-header-bg);color:var(--wp-chrome-text);flex-shrink:0;box-sizing:border-box}.wp-fullscreen .wp-header{height:60px;min-height:60px;padding:11px 20px;border-bottom:none;background:transparent}.wp-fullscreen .wp-header-btn{width:22px;height:22px;color:var(--wp-chrome-text)}.wp-fullscreen .wp-header-btn:hover{color:var(--wp-chrome-text)}.wp-header-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--ds-content-low, rgba(0, 0, 0, .4));flex-shrink:0;transition:color .15s ease}.wp-header-btn:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wp-header-edge{display:flex;align-items:center;width:24px;min-width:24px}.wp-header-edge--right{justify-content:flex-end}.wp-header-edge--right .wp-header-btn{position:absolute;top:24px;right:24px}.wp-header-spacer{display:block;width:24px;height:24px}.wp-header-avatar{width:38px;height:38px;flex-shrink:0;border-radius:50%;overflow:hidden;display:inline-flex;align-items:center;justify-content:center;background:var(--wp-header-avatar-bg)}.wp-header-avatar-img{width:30px;height:30px;object-fit:cover;display:block}.wp-fullscreen[data-theme=dark] .wp-header-avatar,.wp-embed[data-theme=dark] .wp-header-avatar{--wp-header-avatar-bg: hsl(221.3 24.6% 25.5%)}.wp-fullscreen[data-theme=light] .wp-header-avatar,.wp-embed[data-theme=light] .wp-header-avatar{--wp-header-avatar-bg: rgba(18, 18, 18, .1)}.wp-refresh-btn{position:relative}.wp-refresh-badge{position:absolute;top:-6px;right:-8px;min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:var(--wp-mint);color:#fff;font-size:10px;font-weight:600;line-height:16px;text-align:center}.wp-spin-once{animation:wp-spin-once .6s ease-in-out}@keyframes wp-spin-once{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.wp-header-title{flex:1;font-family:inherit;font-size:18px;font-weight:600;line-height:1.5;letter-spacing:-.01em;text-align:center;color:var(--ds-content-highest, #000000);margin:0}.wp-header-account{flex:1;display:flex;align-items:center;gap:12px;min-width:0}.wp-header-account-meta{display:flex;flex-direction:column;justify-content:center;min-width:0;gap:2px}.wp-header-wallet-name{min-width:0;font-family:inherit;font-size:15px;font-weight:600;line-height:1.4;letter-spacing:0;color:var(--wp-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-header-address-btn{display:inline-flex;align-items:center;gap:4px;align-self:flex-start;max-width:100%;padding:0;border:0;background:transparent;cursor:pointer;font:inherit}.wp-header-address{min-width:0;font-size:12px;font-weight:400;line-height:1.4;letter-spacing:0;color:var(--wp-text-40);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-header-address-copy{display:inline-flex;align-items:center;flex-shrink:0;color:var(--wp-text-40);transition:color .15s ease}.wp-header-address-btn:hover .wp-header-address-copy{color:var(--wp-text-60)}.wp-header-address-copy[data-copied=true]{color:var(--wp-mint)}.wp-top{flex-shrink:0;padding:0 16px 16px;display:flex;flex-direction:column;gap:16px}.wp-identity{display:flex;flex-direction:column;gap:8px}.wp-address{display:inline-flex;align-items:center;gap:8px}.wp-address-label{font-size:12px;font-weight:400;line-height:1.4;color:var(--wp-text-40)}.wp-address-chevron{display:inline-flex;align-items:center;color:var(--wp-text-40)}.wp-total{font-size:28px;font-weight:600;line-height:1.3;color:var(--wp-text);margin:0}.wp-asset{display:flex;flex-direction:column;gap:8px}.wp-asset-head{display:flex;align-items:center;gap:4px}.wp-asset-head-label{font-size:12px;font-weight:400;line-height:1.4;color:var(--wp-text-40)}.wp-asset-head-icon{display:inline-flex;color:var(--wp-text-40)}.wp-bar{display:flex;height:20px;border-radius:4px;overflow:hidden}.wp-bar-seg{display:flex;align-items:center;justify-content:center;min-width:8px}.wp-bar-seg-pct{font-size:10px;font-weight:400;line-height:1.3;color:#fff;white-space:nowrap}.wp-legend{display:flex;align-items:center;justify-content:center;gap:16px;flex-wrap:wrap}.wp-legend-item{display:flex;align-items:center;gap:4px}.wp-legend-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.wp-legend-label{font-size:12px;font-weight:400;line-height:1.4;color:var(--wp-text-40)}.wp-tabs{flex-shrink:0;padding:8px 16px}.wp-tabs-inner{display:flex;align-items:center;padding:0 2px}.wp-tabs-list{display:flex;gap:20px;flex:1}.wp-tab{display:flex;flex-direction:column;align-items:center;justify-content:space-between;height:44px;padding-top:12px;background:transparent;border:none;cursor:pointer}.wp-tab-text{font-size:14px;font-weight:600;line-height:1.4;color:var(--wp-text-30);white-space:nowrap}.wp-tab[data-active=true] .wp-tab-text{color:var(--wp-mint)}.wp-tab-bar{width:20px;height:4px;border-radius:2px;background:var(--wp-mint);opacity:0}.wp-tab[data-active=true] .wp-tab-bar{opacity:1}.wp-tabs-filter-wrap{position:relative;display:flex;align-items:center;width:44px;height:44px;flex-shrink:0}.wp-tabs-filter-grad{position:absolute;inset:0;background:linear-gradient(to left,var(--wp-bg) 74%,transparent);pointer-events:none}.wp-tabs-filter{position:relative;display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--wp-text-40)}.wp-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--wp-border) transparent}.wp-body::-webkit-scrollbar{width:4px}.wp-body::-webkit-scrollbar-track{background:transparent}.wp-body::-webkit-scrollbar-thumb{background:var(--wp-border);border-radius:4px}.wp-body-inner{padding:16px 16px 32px;display:flex;flex-direction:column;gap:32px}.wp-fullscreen .wp-body-inner{padding-top:8px;gap:24px}.wp-summary-card{display:flex;flex-direction:column;gap:8px;width:100%;padding:0;border-radius:0;background:transparent;box-shadow:none;box-sizing:border-box}.wp-summary-head{position:relative;display:flex;align-items:center;justify-content:flex-start;gap:4px}.wp-summary-label{font-size:14px;font-weight:400;line-height:1.5;letter-spacing:0;color:var(--wp-text-40);white-space:nowrap}.wp-address{display:inline-flex;align-items:center;gap:8px;min-width:0}.wp-address-avatar{width:16px;height:16px;border-radius:50%;flex-shrink:0;background:radial-gradient(circle at 68% 34%,#ff78d1 0 18%,transparent 19%),radial-gradient(circle at 34% 66%,#00d4aa 0 20%,transparent 21%),linear-gradient(135deg,#7346f3,#0488fc)}.wp-address-label{font-size:12px;font-weight:400;line-height:1.4;letter-spacing:0;color:var(--wp-text-40);white-space:nowrap}.wp-address-chevron{display:inline-flex;align-items:center;color:var(--wp-text-40);flex-shrink:0}.wp-summary-badge{display:inline-flex;align-items:center;justify-content:center;padding:4px 8px;border-radius:999px;background:#019d921a;color:var(--wp-mint);font-size:12px;font-weight:400;line-height:1.4;letter-spacing:0;white-space:nowrap}.wp-summary-estimate{position:relative;display:inline-flex;align-items:center;gap:6px;flex-shrink:0}.wp-estimate-info{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--wp-text-40);cursor:help}.wp-estimate-tooltip{position:absolute;top:calc(100% + 8px);left:0;right:auto;z-index:3;display:flex;flex-direction:column;gap:8px;width:min(280px,calc(100vw - 48px));padding:12px;border-radius:8px;background:var(--wp-tooltip-bg);box-shadow:0 12px 32px #0000003d;color:var(--wp-tooltip-text);font-size:12px;font-weight:400;line-height:1.4;letter-spacing:0;text-align:left;white-space:normal;opacity:0;pointer-events:none;transform:translateY(-4px);visibility:hidden;transition:opacity .15s ease,transform .15s ease,visibility .15s ease}.wp-estimate-tooltip-title{display:block;font-size:12px;font-weight:600;line-height:1.3}.wp-estimate-tooltip-group{display:flex;flex-direction:column;gap:4px}.wp-estimate-tooltip-item{display:block;color:#ffffffc7}.wp-estimate-tooltip-item:before{content:"- "}.wp-estimate-info:hover .wp-estimate-tooltip,.wp-estimate-info:focus .wp-estimate-tooltip,.wp-estimate-info:focus-visible .wp-estimate-tooltip{opacity:1;transform:translateY(0);visibility:visible}.wp-total{font-family:var( --wp-total-font-family, Sora, Inter, system-ui, -apple-system, sans-serif );font-size:36px;font-weight:600;line-height:1.25;letter-spacing:0;color:var(--wp-text);margin:0}.wp-svc-card{display:flex;flex-direction:column;gap:12px;width:100%}.wp-svc-card-head{display:flex;align-items:center;gap:6px}.wp-svc-card-icon{width:24px;height:24px;border-radius:4px;flex-shrink:0;object-fit:cover}.wp-svc-card-title{font-size:16px;font-weight:600;line-height:1.5;letter-spacing:0;color:var(--wp-text-60);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wp-svc-items{display:flex;flex-direction:column;gap:8px;width:100%;padding:0;border-radius:0;background:transparent;box-shadow:none;box-sizing:border-box}.wp-item{position:relative;display:flex;flex-direction:column;gap:20px;width:100%;padding:12px;border-radius:12px;background:var(--wp-card);box-shadow:var(--wp-card-shadow, none);box-sizing:border-box;color:inherit;text-decoration:none;cursor:pointer;outline:none;transition:opacity .15s ease}.wp-item+.wp-item{padding-top:12px;border-top:0}.wp-item:hover{opacity:.88}.wp-item-body{display:flex;flex-direction:column;gap:12px;min-width:0}.wp-order-head{display:flex;align-items:center;width:100%}.wp-item-line{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:21px;min-width:0}.wp-item-label{flex-shrink:0;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--wp-text-30);white-space:nowrap}.wp-line-value,.wp-order-side{min-width:0;overflow:hidden;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--wp-text-60);text-align:right;text-overflow:ellipsis;white-space:nowrap}.wp-order-side--buy{color:var(--wp-mint)}.wp-order-side--sell{color:var(--wp-red)}.wp-svc-token{display:flex;align-items:center;justify-content:flex-end;gap:6px;min-width:0;min-height:21px}.wp-svc-token>span{font-size:14px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--wp-text-60);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-svc-token-icon{width:16px;height:16px;border-radius:50%;flex-shrink:0;object-fit:cover}.wp-svc-token--amount{align-items:flex-start}.wp-svc-token--amount>.wp-svc-token-icon{margin-top:2.5px}.wp-token-stack{display:inline-flex;align-items:center;justify-content:flex-end;width:29px;min-width:29px;overflow:visible}.wp-token-stack .wp-svc-token-icon+.wp-svc-token-icon{margin-left:-3.5px}.wp-token-subtle,.wp-item-usd{color:var(--wp-text-30)!important}.wp-svc-amount{display:flex;flex-direction:column;align-items:flex-end;justify-content:center;gap:1px;min-width:0}.wp-svc-amount-main{font-size:14px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--wp-text-60);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.wp-svc-amount .wp-item-usd{font-size:12px;font-weight:500;line-height:1.35}.wp-order-token{display:flex;align-items:center;gap:8px;min-width:0}.wp-order-token .wp-svc-token-icon{width:32px;height:32px}.wp-order-token-meta{display:flex;min-width:0;flex-direction:column;justify-content:center}.wp-order-token-symbol{overflow:hidden;color:var(--wp-text-60);font-size:14px;font-weight:500;line-height:1.5;text-overflow:ellipsis;white-space:nowrap}.wp-order-token-pair{overflow:hidden;color:var(--wp-text-30);font-size:12px;font-weight:500;line-height:1.5;text-overflow:ellipsis;white-space:nowrap}.wp-item-tags{display:flex;align-items:stretch;gap:8px;width:100%}.wp-tag{appearance:none;display:inline-flex;flex:1 1 0;align-items:center;justify-content:center;gap:0;min-width:0;min-height:33px;padding:6px 10px;border-radius:6px;border:0;background:var(--wp-control);font-family:inherit;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:0;color:var(--wp-text-40);text-align:center;text-decoration:none;white-space:nowrap;box-sizing:border-box;transition:background-color .15s ease,border-color .15s ease,color .15s ease,transform .15s ease}a.wp-tag,button.wp-tag{cursor:pointer}.wp-tag:hover{background:var(--wp-control);transform:none}.wp-tag:focus-visible{outline:2px solid var(--wp-mint);outline-offset:2px}.wp-tag[aria-disabled=true],.wp-tag[data-disabled]{cursor:default;opacity:.48;pointer-events:none}.wp-tag-label{display:inline-flex;align-items:center}.wp-tag-icon{display:none}.wp-tag:hover .wp-tag-icon{transform:none}.wp-tag--mint{color:var(--wp-mint);background:var(--wp-accent-soft)}.wp-tag--mint:hover{background:var(--wp-accent-soft)}.wp-tag--muted{color:var(--wp-text-40)}.wp-svc-empty{display:flex;align-items:center;justify-content:center;min-height:74px;padding:20px 16px;background:var(--wp-card);border-radius:12px;box-shadow:var(--wp-card-shadow, none);font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0;color:var(--wp-text-30);box-sizing:border-box}.wp-claim-overlay{position:absolute;inset:0;z-index:8;display:flex;align-items:flex-end;justify-content:center;background:#00000094;box-sizing:border-box}.wp-claim-sheet{display:flex;flex-direction:column;width:100%;max-width:375px;max-height:calc(100% - 24px);overflow:hidden;border-radius:24px 24px 0 0;background:var(--wp-bg);color:var(--wp-text);box-shadow:0 -18px 48px #00000042;animation:wp-claim-slide-up .22s ease-out}@keyframes wp-claim-slide-up{0%{transform:translateY(18px);opacity:0}to{transform:translateY(0);opacity:1}}.wp-claim-grabber{display:flex;align-items:flex-start;justify-content:center;height:38px;min-height:38px;padding-top:12px;box-sizing:border-box}.wp-claim-grabber span{display:block;width:52px;height:5px;border-radius:999px;background:var(--wp-control)}.wp-claim-content{display:flex;flex-direction:column;align-items:center;gap:16px;width:100%;padding:20px;box-sizing:border-box}.wp-claim-icon{display:inline-flex;align-items:center;justify-content:center;width:64px;height:64px;border-radius:50%;flex-shrink:0}.wp-claim-icon--success{background:var(--wp-claim-success-soft);color:var(--wp-claim-success)}.wp-claim-icon--pending{background:#9b8cef29;color:var(--wp-claim-primary)}.wp-claim-icon--error{background:var(--wp-claim-error-soft);color:var(--wp-claim-error);font-size:30px;font-weight:600;line-height:1}.wp-claim-icon--token{background:#00d4aa29}.wp-claim-icon--token img{width:48px;height:48px;border-radius:50%;object-fit:cover}.wp-claim-icon--token span{display:inline-flex;align-items:center;justify-content:center;width:48px;height:48px;border-radius:50%;background:var(--wp-mint);color:#101820;font-size:18px;font-weight:600}.wp-claim-spinner{width:36px;height:36px;border-radius:50%;border:3px solid rgba(155,140,239,.28);border-top-color:var(--wp-claim-primary);animation:wp-claim-spin .8s linear infinite}@keyframes wp-claim-spin{to{transform:rotate(360deg)}}.wp-claim-copy{display:flex;flex-direction:column;align-items:center;gap:16px;width:100%;text-align:center}.wp-claim-title{margin:0;font-size:20px;font-weight:600;line-height:1.3;letter-spacing:0;color:var(--wp-text)}.wp-claim-desc{max-width:335px;margin:0;font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0;color:var(--wp-text-40)}.wp-claim-heading{display:flex;flex-direction:column;align-items:flex-start;gap:8px;width:100%}.wp-claim-error-message{margin:0;color:var(--wp-claim-error);font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0}.wp-claim-reward-card{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;min-height:60px;padding:16px;border-radius:8px;background:var(--wp-card);box-sizing:border-box}.wp-claim-reward-token{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:50%;flex-shrink:0;overflow:hidden;background:var(--wp-control)}.wp-claim-reward-token img{width:28px;height:28px;object-fit:cover}.wp-claim-reward-token span{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;background:var(--wp-mint);color:#101820;font-size:13px;font-weight:600;line-height:1}.wp-claim-reward-symbol{flex:1 1 auto;min-width:0;overflow:hidden;color:var(--wp-text);font-size:18px;font-weight:600;line-height:1.3;letter-spacing:0;text-overflow:ellipsis;white-space:nowrap}.wp-claim-reward-amount{flex-shrink:0;color:var(--wp-text);font-size:20px;font-weight:600;line-height:1.3;letter-spacing:0;white-space:nowrap}.wp-claim-account-card{display:flex;flex-direction:column;gap:12px;width:100%;padding:16px;border-radius:8px;background:var(--wp-card);box-sizing:border-box}.wp-claim-account-row{display:flex;align-items:center;justify-content:space-between;gap:4px;width:100%;min-height:40px}.wp-claim-account-row>span{flex-shrink:0;color:var(--wp-text-40);font-size:14px;font-weight:400;line-height:1.3;letter-spacing:0;white-space:nowrap}.wp-claim-account{display:flex;align-items:center;gap:8px;min-width:0}.wp-claim-account strong{overflow:hidden;color:var(--wp-text);font-size:15px;font-weight:600;line-height:1.6;letter-spacing:0;text-overflow:ellipsis;white-space:nowrap}.wp-claim-account-avatar{width:32px;height:32px;border-radius:50%;flex-shrink:0;background:radial-gradient(circle at 30% 28%,#d87aff 0 12%,transparent 13%),radial-gradient(circle at 68% 28%,#f0a1ff 0 12%,transparent 13%),radial-gradient(circle at 32% 70%,#b561e7 0 13%,transparent 14%),radial-gradient(circle at 70% 70%,#d4a2ff 0 13%,transparent 14%),radial-gradient(circle at 50% 50%,#8c4fc4 0 18%,transparent 19%),#4a315f;box-shadow:inset 0 0 0 3.37px var(--wp-control)}.wp-claim-divider{display:block;width:100%;height:1px;background:var(--wp-border)}.wp-claim-detail-list{display:flex;flex-direction:column;gap:8px;width:100%}.wp-claim-detail-row{display:flex;align-items:center;justify-content:space-between;gap:20px;width:100%;min-height:20px}.wp-claim-detail-row>span{min-width:0;color:var(--wp-text-40);font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0;white-space:nowrap}.wp-claim-detail-row--sub>span:before{content:"";display:inline-block;width:3px;height:3px;margin:0 8px 3px;background:currentColor}.wp-claim-detail-row strong{min-width:0;overflow:hidden;color:var(--wp-text);font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0;text-align:right;text-overflow:ellipsis;white-space:nowrap}.wp-claim-list{display:flex;flex-direction:column;gap:8px;width:100%;padding-bottom:8px}.wp-claim-list-item{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:56px;padding:8px 16px;border-radius:8px;background:var(--wp-card);box-sizing:border-box}.wp-claim-list-item>span{flex-shrink:0;font-size:14px;font-weight:400;line-height:1.3;color:var(--wp-text-40);white-space:nowrap}.wp-claim-list-item strong{display:inline-flex;align-items:center;justify-content:flex-end;gap:4px;min-width:0;overflow:hidden;color:var(--wp-text);font-size:14px;font-weight:400;line-height:1.3;text-align:right;text-overflow:ellipsis;white-space:nowrap}.wp-claim-list-item img{width:16px;height:16px;border-radius:50%;flex-shrink:0}.wp-claim-hash{appearance:none;display:inline-flex;align-items:center;justify-content:flex-end;gap:4px;min-width:0;padding:0;border:none;background:transparent;color:var(--wp-text);cursor:pointer;font:inherit}.wp-claim-hash svg{flex-shrink:0;color:var(--wp-text-60)}.wp-claim-gas-card{display:flex;flex-direction:column;gap:4px;width:100%;padding:14px 16px;border-radius:8px;border:1px solid var(--wp-border);background:var(--wp-card);box-sizing:border-box}.wp-claim-gas-row{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:28px}.wp-claim-gas-row>span{min-width:0;font-size:12px;font-weight:400;line-height:1.3;color:var(--wp-text-40)}.wp-claim-gas-row strong{min-width:0;overflow:hidden;color:var(--wp-text);font-size:12px;font-weight:400;line-height:1.3;text-align:right;text-overflow:ellipsis;white-space:nowrap}.wp-claim-gas-row--primary{min-height:32px}.wp-claim-gas-row--primary>span,.wp-claim-gas-row--primary strong{font-size:14px;color:var(--wp-text)}.wp-claim-fee-label{position:relative;display:inline-flex;align-items:center;text-decoration:underline dotted;text-underline-offset:3px;cursor:help;overflow:visible!important}.wp-claim-fee-tooltip{position:absolute;left:0;bottom:calc(100% + 8px);z-index:2;width:min(260px,calc(100vw - 64px));padding:10px 12px;border-radius:8px;background:var(--wp-tooltip-bg);color:var(--wp-tooltip-text);box-shadow:0 12px 32px #0000003d;font-size:11px;font-weight:400;line-height:1.4;text-align:left;text-decoration:none;white-space:normal;opacity:0;pointer-events:none;transform:translateY(4px);visibility:hidden;transition:opacity .15s ease,transform .15s ease,visibility .15s ease}.wp-claim-fee-label:hover .wp-claim-fee-tooltip,.wp-claim-fee-label:focus .wp-claim-fee-tooltip,.wp-claim-fee-label:focus-visible .wp-claim-fee-tooltip{opacity:1;transform:translateY(0);visibility:visible}.wp-claim-actions{display:flex;align-items:center;gap:8px;width:100%}.wp-claim-primary,.wp-claim-secondary{appearance:none;display:inline-flex;align-items:center;justify-content:center;width:100%;min-width:0;height:52px;padding:0 24px;border:none;border-radius:40px;font-family:inherit;font-size:15px;font-weight:600;line-height:1.3;letter-spacing:0;white-space:nowrap;cursor:pointer}.wp-claim-primary{background:var(--wp-claim-primary);color:var(--wp-claim-primary-text)}.wp-claim-primary:disabled{cursor:default;opacity:.72}.wp-claim-secondary{background:var(--wp-claim-secondary-bg, var(--wp-control));color:var(--wp-claim-primary)}.wp-claim-actions[data-count="2"] .wp-claim-primary{flex:1 1 0}.wp-claim-actions[data-count="2"] .wp-claim-secondary{flex:0 0 120px}.wp-claim-button-spinner{width:16px;height:16px;border-radius:50%;border:2px solid rgba(32,37,48,.28);border-top-color:var(--wp-claim-primary-text);animation:wp-claim-spin .8s linear infinite}.wp-claim-home-indicator{display:flex;align-items:flex-end;justify-content:center;height:34px;min-height:34px;padding-bottom:8px;box-sizing:border-box}.wp-claim-home-indicator span{display:block;width:134px;height:5px;border-radius:16px;background:var(--wp-text-40)}@media(max-width:359px){.wp-header{gap:12px;padding:0 12px}.wp-total{font-size:24px}.wp-body-inner{padding:0 12px 128px;gap:20px}.wp-svc-items,.wp-claim-content{padding:18px 14px}.wp-item-line{gap:10px}.wp-svc-token>span{max-width:168px}}.wp-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.wi-drawer-content .wp-header,.wi-portfolio-body .wp-header{padding:16px}.wi-drawer-content .wp-header-edge--right .wp-header-btn,.wi-portfolio-body .wp-header-edge--right .wp-header-btn{top:16px;right:16px}
8
+ `);import{Fragment as sd,jsx as ue,jsxs as fn}from"react/jsx-runtime";var Cr=5,ad="wp:";function Rn({env:e,theme:t="light",walletAddress:n,walletName:o,onBack:r,showHeader:a=!0,variant:i="embed",className:s,onOutlink:c,lpBalanceReader:l,stakingRewardsReader:d}){let u=Pe(e),h=!!n,m=id(),[v,x]=Te.useState(Cr),[w,k]=Te.useState(!1),[E,f]=Te.useState(!1),I=Te.useRef(void 0),N=Te.useCallback(()=>{m.invalidateQueries({predicate:X=>typeof X.queryKey[0]=="string"&&X.queryKey[0].startsWith(ad)})},[m]),P=Te.useCallback(()=>{N(),k(!0),setTimeout(()=>k(!1),600),x(Cr)},[N]);Te.useEffect(()=>{if(!h)return;let X=setInterval(()=>{x(O=>O<=1?(P(),Cr):O-1)},1e3);return()=>clearInterval(X)},[h,P]);let M=Te.useCallback(()=>{r?.()},[r]),Y=h?Ot(u,n,{size:64}):void 0,_=Te.useCallback(async()=>{if(!(E||!n))try{await navigator.clipboard.writeText(n),f(!0),clearTimeout(I.current),I.current=setTimeout(()=>f(!1),2e3)}catch{}},[n,E]);Te.useEffect(()=>()=>clearTimeout(I.current),[]);let K=Te.useMemo(()=>({env:u,theme:t,open:!0,walletAddress:n,close:M,onOutlink:c,lpBalanceReader:l,stakingRewardsReader:d}),[u,t,n,M,c,l,d]),z=fn(sd,{children:[a&&fn("div",{className:"wp-header",children:[fn("div",{className:"wp-header-account",children:[r&&ue("button",{type:"button",className:"wp-header-btn","aria-label":"Back",onClick:r,children:ue(aa,{})}),ue("span",{className:"wp-header-avatar","aria-hidden":!0,children:Y&&ue("img",{src:Y,alt:"",className:"wp-header-avatar-img",draggable:!1})}),(o||n)&&fn("div",{className:"wp-header-account-meta",children:[o&&ue("span",{className:"wp-header-wallet-name",title:o,children:o}),n&&fn("button",{type:"button",className:"wp-header-address-btn",onClick:_,"aria-label":"Copy wallet address",children:[ue("span",{className:"wp-header-address",children:da(n)}),ue("span",{className:"wp-header-address-copy","data-copied":E,children:E?ue(rn,{size:14}):ue(Bn,{size:14})})]})]})]}),fn("button",{type:"button",className:"wp-header-btn wp-refresh-btn","aria-label":"Refresh portfolio",onClick:P,children:[ue(sa,{className:w?"wp-spin-once":void 0}),h&&ue("span",{className:"wp-refresh-badge",children:v})]})]}),ue("div",{className:"wp-body",children:fn("div",{className:"wp-body-inner",children:[ue(va,{}),ue(La,{}),ue(Fa,{}),ue(za,{})]})})]});return ue(zn.Provider,{value:K,children:i==="none"?z:ue("div",{className:Z(i==="fullscreen"?"wp-fullscreen":"wp-embed",s),"data-theme":t,children:z})})}import{jsx as Rr,jsxs as Da}from"react/jsx-runtime";function Wa({className:e}){let{env:t,theme:n,walletAddress:o,close:r,onOutlink:a,lpBalanceReader:i,stakingRewardsReader:s}=ct();return Da(Co.Portal,{children:[Rr(Co.Overlay,{className:"wp-overlay"}),Da(Co.Content,{className:Z("wp-fullscreen",e),"data-theme":n,children:[Rr(Co.Title,{className:"wp-sr-only",children:"Portfolio"}),Rr(Rn,{env:t,theme:n,walletAddress:o,onBack:r,variant:"none",onOutlink:a,lpBalanceReader:i,stakingRewardsReader:s})]})]})}import{jsx as Ha}from"react/jsx-runtime";function cd({env:e,theme:t="light",walletAddress:n,open:o,onOpenChange:r,onOutlink:a,lpBalanceReader:i,stakingRewardsReader:s,children:c}){let l=Pe(e),d=o!==void 0,[u,h]=un.useState(!1),m=d?o:u,v=un.useCallback(k=>{d||h(k),r?.(k)},[d,r]),x=un.useCallback(()=>v(!1),[v]),w=un.useMemo(()=>({env:l,theme:t,open:m,walletAddress:n,close:x,onOutlink:a,lpBalanceReader:i,stakingRewardsReader:s}),[l,t,m,n,x,a,i,s]);return Ha(zn.Provider,{value:w,children:Ha(ld.Root,{direction:"bottom",open:m,onOpenChange:v,noBodyStyles:!0,children:c})})}var Ga=Object.assign(cd,{Trigger:ia,Content:Wa});import*as R from"react";import{createPortal as Nn}from"react-dom";import Bt from"bignumber.js";import{jsx as pt,jsxs as dd}from"react/jsx-runtime";function Ua({size:e=20,className:t}){return dd("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,"aria-hidden":"true",children:[pt("circle",{cx:"9",cy:"9",r:"6",stroke:"currentColor",strokeWidth:1.7}),pt("path",{d:"m17 17-3.2-3.2",stroke:"currentColor",strokeWidth:1.7,strokeLinecap:"round"})]})}function $a({size:e=16,className:t}){return pt("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:pt("path",{d:"M2.667 8a5.333 5.333 0 1 0 1.562-3.771L2.667 5.79M2.667 2.667v3.124h3.124M8 5.333V8l1.667 1",stroke:"currentColor",strokeWidth:1.333,strokeLinecap:"round",strokeLinejoin:"round"})})}function ja({size:e=16,className:t}){return pt("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:pt("path",{d:"M2.667 4h4M9.333 4h4M6.667 2.667v2.666M2.667 12h4M9.333 12h4M9.333 10.667v2.666M2.667 8h1.666M7 8h6.333M4.333 6.667v2.666",stroke:"currentColor",strokeWidth:1.333,strokeLinecap:"round",strokeLinejoin:"round"})})}function Va({size:e=20,className:t}){return pt("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:pt("path",{d:"M10 4.167v11.666M4.167 10 10 15.833 15.833 10",stroke:"currentColor",strokeWidth:1.667,strokeLinecap:"round",strokeLinejoin:"round"})})}function qa({size:e=16,className:t}){return pt("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,"aria-hidden":"true",children:pt("path",{d:"M3.333 8h9.334M8.667 4l4 4-4 4",stroke:"currentColor",strokeWidth:1.333,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ka({size:e=12,className:t}){return pt("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:pt("path",{d:"M3.5 2 1.5 4l2 2M1.5 4h9M8.5 10l2-2-2-2M10.5 8h-9",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"})})}import*as T from"react";import Za from"bignumber.js";function Qa(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Ya(e){return!e.isFinite()||e.isNaN()||e.lte(0)?"":e.decimalPlaces(6,Za.ROUND_DOWN).toFixed()}function pd(e){return e.fromToken.symbol.toLowerCase()===e.toToken.symbol.toLowerCase()||e.fromToken.chainId===e.toToken.chainId&&e.fromToken.address.toLowerCase()===e.toToken.address.toLowerCase()}function fd(e){let t=e.fromToken.priceUsd,n=e.toToken.priceUsd,o=e.lastChangedBy==="to"?e.toAmount:e.fromAmount,r=new Za(o||"0");return!r.isFinite()||r.isNaN()||r.lte(0)?{fromAmount:e.fromAmount,toAmount:e.toAmount}:Qa(t)&&Qa(n)?e.lastChangedBy==="to"?{fromAmount:Ya(r.multipliedBy(n).dividedBy(t))}:{toAmount:Ya(r.multipliedBy(t).dividedBy(n))}:pd(e)?e.lastChangedBy==="to"?{fromAmount:e.toAmount}:{toAmount:e.fromAmount}:{fromAmount:e.lastChangedBy==="to"?"":e.fromAmount,toAmount:e.lastChangedBy==="from"?"":e.toAmount}}function Xa({getQuote:e,submitBridge:t}){return{canQuote:!!e,canSubmit:!!t,async getQuote(n){return e?e(n):fd(n)},async submitBridge(n){if(!t)throw new Error("Bridge submit handler is not configured.");return t(n)}}}var Ja=15,ud=18;function md(e){let t=e.replace(/[^\d.]/g,""),n=t.indexOf(".");n!==-1&&(t=t.slice(0,n+1)+t.slice(n+1).replace(/\./g,""));let o=t.indexOf(".");if(o===-1)return t.slice(0,Ja);let r=t.slice(0,o).slice(0,Ja),a=t.slice(o+1).slice(0,ud);return`${r}.${a}`}function gd(e){let t=Number(e??"0");if(!Number.isFinite(t)||t<.1)return"1";let n=o=>Math.floor(o*100)/100;if(t<3){let o=n(t*3);return String(o<1?1:o)}return"10"}function es(e){let t=e.toUpperCase();return t.startsWith("T")&&t.slice(1).startsWith("CROSS")?t.slice(1):t}function hd(e,t){if(!e||!t||e.chainId!==t.chainId)return!1;let n=new Set([es(e.symbol),es(t.symbol)]);return n.has("CROSS")&&n.has("CROSSD")}function Ct(e,t){return!!e&&!!t&&e.chainId===t.chainId&&e.address.toLowerCase()===t.address.toLowerCase()}function Ro(e){return e[0]}function Nr(e,t,n,o){if(n&&!Ct(n,t))return n;let r=t?o?.(t,e):void 0;if(r?.length)return r[0];if(!t)return e[1]??Ro(e);let a=e.findIndex(s=>Ct(s,t)),i=a>=0?e[a+1]:void 0;return i&&!Ct(i,t)?i:e.find(s=>!Ct(s,t))??t}function ts({fromToken:e,toToken:t,fromAmount:n,toAmount:o,lastChangedBy:r,slippage:a}){return{fromToken:e,toToken:t,fromAmount:n,toAmount:o,lastChangedBy:r,slippage:a}}function Tr(e){let t=e instanceof Error?e.message:typeof e=="string"?e:"",n=e&&typeof e=="object"&&"code"in e?String(e.code):"",o=t.toLowerCase();return n==="4001"||o.includes("user rejected")||o.includes("user denied")||o.includes("rejected the request")||o.includes("request rejected")}function ns(e,t){return Tr(e)?"Transaction request was rejected.":(e instanceof Error?e.message:typeof e=="string"?e:"").split(`
9
+ `)[0]?.trim()||t}function os(e){let{tokens:t,initialFromToken:n,initialToToken:o,getToTokens:r,getApproval:a,approveBridge:i,history:s=[],initialSlippage:c="1",termsUrl:l,getQuote:d,submitBridge:u,onSubmitted:h,onSuccess:m,onFailed:v,onExit:x}=e,w=T.useMemo(()=>Xa({getQuote:d,submitBridge:u}),[d,u]),[k,E]=T.useState("form"),[f,I]=T.useState(n??Ro(t)),[N,P]=T.useState(()=>Nr(t,n??Ro(t),o,r)),[M,Y]=T.useState(""),[_,K]=T.useState(""),[z,X]=T.useState("from"),[O,me]=T.useState(c),[te,ie]=T.useState(null),je=T.useMemo(()=>hd(f,N),[f,N]),ae=T.useMemo(()=>je?"1":O==="auto"?gd(te?.priceImpact):O,[je,O,te?.priceImpact]),[H,se]=T.useState(""),[ee,G]=T.useState("idle"),[Ve,pe]=T.useState(""),[Le,fe]=T.useState(null),[ut,ve]=T.useState([]),[Dt,Oe]=T.useState(!1),[Rt,_t]=T.useState(!1),[le,ge]=T.useState(null),[nt,ye]=T.useState(!1),[he,ce]=T.useState(null),[Nt,qe]=T.useState(null),[Tt,Ke]=T.useState(!1),[ot,ze]=T.useState(!1),ke=T.useRef(0),mt=T.useRef(null),Qe=T.useCallback(()=>{mt.current&&(clearTimeout(mt.current),mt.current=null)},[]),De=T.useCallback(F=>{Qe(),qe(F)},[Qe]);T.useEffect(()=>Qe,[Qe]),T.useEffect(()=>{let F=t.find(J=>Ct(J,f))??Ro(t),Se=F?r?.(F,t):void 0,q=Se?.find(J=>Ct(J,N))??(Se?void 0:t.find(J=>Ct(J,N)))??Nr(t,F,void 0,r);I(F),P(q)},[r,t,f,N]);let be=T.useCallback((F,Se)=>{let q=md(F);Se==="from"?Y(q):K(q),X(Se),se("")},[]),ne=T.useCallback(()=>{ke.current+=1,Y(""),K(""),X("from"),ie(null),se(""),pe(""),G("idle"),ge(null),ye(!1),ce(null),Ke(!1),De(null)},[De]),rt=T.useCallback(F=>{Ct(F,f)||(I(F),P(Nr(t,F,void 0,r)),ne())},[f,r,ne,t]),gt=T.useCallback(F=>{Ct(F,N)||Ct(F,f)||(P(F),ne())},[f,ne,N]),We=T.useMemo(()=>f?r?.(f,t)??t.filter(F=>!Ct(F,f)):[],[f,r,t]),ht=T.useCallback(()=>{f?.balance&&be(f.balance,"from")},[f?.balance,be]),it=T.useCallback(()=>{!f||!N||(I(N),P(f),ne())},[f,ne,N]),He=T.useCallback(()=>{ke.current+=1,Y(""),K(""),X("from"),ie(null),se(""),pe("")},[]);T.useEffect(()=>{if(!f||!N)return;if(!M&&!_){ie(null),se(""),G("idle");return}let F=++ke.current,Se=ts({fromToken:f,toToken:N,fromAmount:M,toAmount:_,lastChangedBy:z,slippage:O});G(w.canQuote?"quoting":"idle"),(async()=>{try{let q=await w.getQuote(Se);if(ke.current!==F)return;q.fromAmount!==void 0&&z==="to"&&Y(q.fromAmount),q.toAmount!==void 0&&z==="from"&&K(q.toAmount),ie(q.summary??null),se(q.error??"")}catch(q){if(ke.current!==F)return;se(q instanceof Error?q.message:"Failed to quote bridge.")}finally{ke.current===F&&G("idle")}})()},[M,f,z,w,O,_,N]);let Ge=T.useCallback(()=>!f||!N?null:ts({fromToken:f,toToken:N,fromAmount:M,toAmount:_,lastChangedBy:z,slippage:ae}),[ae,M,f,z,_,N]),Ue=T.useCallback(async(F,Se)=>{pe(""),Ke(!1),ye(!1),G("submitting");try{if(!Se?.skipApprovalCheck&&a){let J=await a(F);if(J){ge(J),ce(F),G("idle");return}}ge(null),ce(null),De("processing");let q=await w.submitBridge(F);fe(q),G("success"),ve(J=>[{id:q.txHash,timestamp:new Date().toISOString(),txHash:q.txHash,fromToken:q.fromToken,toToken:q.toToken,fromAmount:q.fromAmount,toAmount:q.toAmount,summary:te??void 0,status:"pending"},...J.filter(Kn=>Kn.txHash!==q.txHash)]),He(),ze(!0),De(null),Ke(!0),h?.(q),m?.(q)}catch(q){if(De(null),Tr(q)){G("idle");return}let J=ns(q,"Failed to submit bridge.");pe(J),G("error"),v?.({message:J})}},[a,v,h,m,w,He,De,te]),S=T.useCallback(async()=>{if(H)return;let F=Ge();if(F){if(!Rt){ce(F),Oe(!0);return}await Ue(F)}},[Ge,H,Ue,Rt]),$=T.useCallback(async()=>{let F=he??Ge();F&&(_t(!0),Oe(!1),await Ue(F))},[Ge,he,Ue]),oe=T.useCallback(()=>{Oe(!1),ce(null)},[]),Ye=T.useCallback(async()=>{if(!(ee==="submitting"||!le||!he||!i)){pe(""),G("submitting");try{await i(he,le),ge(null),G("idle"),ye(!0)}catch(F){if(Tr(F)){G("idle");return}let Se=ns(F,"Failed to approve token.");pe(Se),G("error"),v?.({message:Se})}}},[le,i,v,he,Ue,ee]),at=T.useCallback(()=>{ee!=="submitting"&&(ge(null),ye(!1),ce(null),G("idle"))},[ee]),It=T.useCallback(async()=>{ee==="submitting"||!he||(ye(!1),await Ue(he,{skipApprovalCheck:!0}))},[he,Ue,ee]),Jt=T.useCallback(()=>{Ke(!1)},[]),Wt=T.useCallback(F=>{E(F),F==="history"&&ze(!1)},[]),qn=T.useCallback(()=>{if(k==="history"){Wt("form");return}x?.()},[x,Wt,k]),en=T.useMemo(()=>[...s,...ut.filter(F=>!s.some(Se=>Se.txHash===F.txHash))],[s,ut]);return{step:k,setStep:Wt,status:ee,error:Ve,quoteError:H,fromToken:f,toToken:N,tokens:t,availableToTokens:We,fromAmount:M,toAmount:_,lastChangedBy:z,slippage:O,effectiveSlippage:ae,slippageLocked:je,setSlippage:me,summary:te,history:en,submitted:Le,canSubmit:w.canSubmit,termsOpen:Dt,approvalInfo:le,approvalSuccessOpen:nt,approveBridge:i,pendingSubmitInput:he,submitToast:Nt,successDialogOpen:Tt,dismissSuccessDialog:Jt,hasNewHistory:ot,termsUrl:l,setFromToken:I,setToToken:P,selectFromToken:rt,selectToToken:gt,setAmount:be,setMax:ht,swapTokens:it,submit:S,confirmTerms:$,cancelTerms:oe,confirmApproval:Ye,cancelApproval:at,continueAfterApproval:It,back:qn}}D(`.bf-root{--bf-bg: var(--ds-bg-default, #1e232e);--bf-surface: var(--ds-surface-medium, rgba(255, 255, 255, .05));--bf-surface-hover: var(--ds-surface-high, rgba(255, 255, 255, .08));--bf-border: var(--ds-border-default, rgba(255, 255, 255, .07));--bf-text-high: var(--ds-content-high, rgba(255, 255, 255, .85));--bf-text-medium: var(--ds-content-medium, rgba(255, 255, 255, .65));--bf-text-low: var(--ds-content-low, rgba(255, 255, 255, .4));--bf-toast-bg: #1e232e;--bf-toast-color: rgba(255, 255, 255, .85);position:relative;display:flex;flex:1;min-height:0;flex-direction:column;overflow:hidden;background:var(--bf-bg);color:var(--ds-content-highest, #ffffff);font-family:inherit}[data-theme=dark].wi-popover-content .bf-root,[data-theme=dark].wi-drawer-content .bf-root{--bf-bg: var(--ds-bg-default, #121212);--bf-surface: var(--ds-surface-medium, rgba(255, 255, 255, .05));--bf-surface-hover: var(--ds-surface-high, rgba(255, 255, 255, .1));--bf-border: var(--ds-border-default, rgba(255, 255, 255, .05));--bf-text-high: var(--ds-content-high, rgba(255, 255, 255, .85));--bf-text-medium: var(--ds-content-medium, rgba(255, 255, 255, .7));--bf-text-low: var(--ds-content-low, rgba(255, 255, 255, .5))}[data-theme=light].wi-popover-content .bf-root,[data-theme=light].wi-drawer-content .bf-root{--bf-bg: var(--ds-bg-default, #ffffff);--bf-surface: var(--ds-surface-medium, rgba(18, 18, 18, .05));--bf-surface-hover: var(--ds-surface-high, rgba(18, 18, 18, .1));--bf-border: var(--ds-border-default, rgba(18, 18, 18, .05));--bf-text-high: var(--ds-content-high, rgba(18, 18, 18, .85));--bf-text-medium: var(--ds-content-medium, rgba(18, 18, 18, .7));--bf-text-low: var(--ds-content-low, rgba(18, 18, 18, .5))}.bf-root[data-view=history]{background:var(--ds-bg-dim, #f5f7fa);color:var(--ds-content-high, rgba(0, 0, 0, .85))}.bf-header{position:relative;display:flex;flex-shrink:0;align-items:center;justify-content:space-between;padding:24px;border-bottom:1px solid var(--bf-border);background:var(--ds-bg-default, var(--bf-bg));box-sizing:border-box}.bf-root[data-view=history] .bf-header{padding:24px;border-bottom-color:var(--ds-border-default, rgba(0, 0, 0, .07));background:var(--ds-surface-default, #ffffff)}.bf-header-btn{display:inline-flex;width:24px;height:24px;flex-shrink:0;align-items:center;justify-content:center;padding:0;border:0;background:transparent;color:var(--ds-content-low, rgba(0, 0, 0, .4));cursor:pointer;transition:color .15s ease}.bf-header-btn:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.bf-header .bf-header-btn:last-child{position:absolute;top:24px;right:24px}.bf-header-title{position:absolute;left:50%;transform:translate(-50%);font-size:18px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--bf-text-high);white-space:nowrap}.bf-root[data-view=history] .bf-header-title{color:var(--ds-content-highest, #000000)}.bf-body,.bf-history-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;box-sizing:border-box}.bf-body{padding:24px}.bf-history-body{display:flex;flex-direction:column;gap:12px;padding:24px;background:var(--ds-bg-dim, #f5f7fa)}.bf-toolbar{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:12px}.bf-chip{display:inline-flex;align-items:center;gap:4px;min-height:33px;padding:6px 8px;border:0;border-radius:12px;background:var(--bf-surface);color:var(--bf-text-medium);font:inherit;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer}.bf-chip:hover:not(:disabled){color:var(--bf-text-high);background:var(--bf-surface-hover)}.bf-chip:disabled{cursor:default}.bf-chip-history{position:relative}.bf-chip-dot{position:absolute;top:4px;right:4px;width:6px;height:6px;border-radius:999px;background:var(--ds-system-red-default, #da0b2e)}.bf-swap-card{position:relative;display:flex;flex-direction:column;gap:12px;margin-bottom:12px}.bf-field-error{margin-top:-4px;color:var(--ds-system-red-default, #ff2b5f);font-size:13px;font-weight:500;line-height:1.5;letter-spacing:0}.bf-amount-panel{display:flex;min-height:110px;flex-direction:column;gap:8px;padding:16px;border:1px solid transparent;border-radius:12px;background:var(--bf-surface);box-sizing:border-box;transition:border-color .2s ease}.bf-amount-panel:hover{border-color:var(--bf-border)}.bf-amount-head{display:flex;align-items:center;justify-content:space-between;gap:8px;color:var(--bf-text-high);font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-balance{display:inline-flex;align-items:center;justify-content:flex-end;gap:4px;min-width:0;color:var(--bf-text-low);font-size:12px;white-space:nowrap}.bf-amount-main{display:flex;align-items:center;justify-content:space-between;gap:12px}.bf-amount-input-wrap{display:flex;min-width:0;flex:1;flex-direction:column;gap:4px}.bf-amount-input{width:100%;min-width:0;padding:0;border:0;background:transparent;color:var(--bf-text-high);font:inherit;font-size:18px;font-weight:600;line-height:1.5;letter-spacing:-.01em;outline:none}.bf-amount-input::placeholder{color:var(--ds-content-lowest, rgba(0, 0, 0, .25))}.bf-amount-usd{overflow:hidden;color:var(--bf-text-low);font-size:12px;font-weight:500;line-height:1.5;letter-spacing:-.01em;white-space:nowrap;text-overflow:ellipsis}.bf-token-pill{display:inline-flex;flex-shrink:0;align-items:center;gap:6px;min-height:33px;padding:6px 8px 6px 6px;border:1px solid var(--bf-border);border-radius:9999px;background:var(--bf-bg);color:var(--bf-text-high);font:inherit;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer}.bf-token-pill:hover:not(:disabled):not([data-locked=true]){background:var(--bf-surface-hover)}.bf-token-pill:disabled{cursor:default;opacity:.6}.bf-token-pill[data-locked=true]{cursor:default}.bf-token-icon{position:relative;display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;overflow:hidden;border-radius:0;background:var(--ds-accent-primary-default, #00ceb2);color:var(--ds-accent-primary-on, #000000);font-size:11px;font-weight:700}.bf-token-icon[data-has-image=true]{background:transparent}.bf-token-icon img{width:100%;height:100%;border-radius:0;object-fit:cover}.bf-token-fallback{line-height:1}.bf-token-picker-overlay{--bf-bg: #1e232e;--bf-surface: rgba(255, 255, 255, .05);--bf-surface-hover: rgba(255, 255, 255, .08);--bf-border: rgba(255, 255, 255, .07);--bf-text-high: rgba(255, 255, 255, .85);--bf-text-medium: rgba(255, 255, 255, .65);--bf-text-low: rgba(255, 255, 255, .4);position:fixed;inset:0;z-index:100002;display:flex;align-items:center;justify-content:center;padding:24px;background:#00000085;pointer-events:auto;box-sizing:border-box}.bf-token-picker-overlay[data-theme=light]{--bf-bg: #ffffff;--bf-surface: rgba(18, 18, 18, .05);--bf-surface-hover: rgba(18, 18, 18, .08);--bf-border: rgba(18, 18, 18, .07);--bf-text-high: rgba(18, 18, 18, .85);--bf-text-medium: rgba(18, 18, 18, .65);--bf-text-low: rgba(18, 18, 18, .4)}.bf-token-picker{display:flex;width:min(480px,calc(100vw - 48px));height:min(466px,calc(100dvh - 48px));max-height:calc(100dvh - 48px);min-height:0;flex-direction:column;overflow:hidden;border:1px solid var(--bf-border);border-radius:24px;background:var(--bf-bg);color:var(--bf-text-high);box-shadow:0 24px 80px #0006;box-sizing:border-box}.bf-token-picker-handle{display:none}.bf-token-picker-head{position:relative;display:flex;min-height:73px;flex-shrink:0;align-items:center;justify-content:flex-start;padding:24px 56px 24px 24px;border-bottom:1px solid var(--bf-border);box-sizing:border-box}.bf-token-picker-head h3{margin:0;color:var(--bf-text-high);font-size:20px;font-weight:600;line-height:1.25;letter-spacing:0}.bf-token-picker-close{position:absolute;top:24px;right:24px;display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;padding:0;border:0;background:transparent;color:var(--bf-text-medium);cursor:pointer}.bf-token-picker-close:hover{color:var(--bf-text-high)}.bf-token-search{display:flex;min-height:48px;flex-shrink:0;align-items:center;gap:8px;margin:16px 24px;padding:12px 16px;border:1px solid transparent;border-radius:12px;background:var(--ds-surface-medium, rgba(18, 18, 18, .05));color:var(--bf-text-low);box-sizing:border-box}.bf-token-search:focus-within{border-color:var(--ds-accent-primary-default, #00ceb2)}.bf-token-search input{width:100%;min-width:0;padding:0;border:0;outline:0;background:transparent;color:var(--bf-text-high);font:inherit;font-size:16px;font-weight:500;line-height:1.5;letter-spacing:0}.bf-token-search input::placeholder{color:var(--bf-text-low)}.bf-token-list{display:flex;min-height:0;flex:1;flex-direction:column;gap:0;overflow-y:auto;overflow-x:hidden;padding:0 24px 24px;scrollbar-width:thin;box-sizing:border-box}.bf-token-row{position:relative;display:flex;width:100%;min-height:69px;align-items:center;justify-content:space-between;gap:12px;padding:12px;border:1px solid transparent;border-radius:12px;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer;box-sizing:border-box}.bf-token-row:hover:not([data-selected=true]){background:var(--ds-surface-medium, rgba(18, 18, 18, .05))}.bf-token-row[data-selected=true]{border-color:var(--ds-accent-primary-default, #00b4b7);background:var(--ds-surface-medium, rgba(18, 18, 18, .05))}.bf-token-row-left{display:inline-flex;min-width:0;align-items:center;gap:16px}.bf-token-meta{display:flex;min-width:0;flex-direction:column}.bf-token-symbol{overflow:hidden;color:var(--bf-text-high);font-size:16px;font-weight:600;line-height:1.5;letter-spacing:0;text-overflow:ellipsis;white-space:nowrap}.bf-token-name{overflow:hidden;color:var(--bf-text-low);font-size:12px;font-weight:500;line-height:1.5;letter-spacing:0;text-overflow:ellipsis;white-space:nowrap}.bf-token-row-right{display:flex;min-width:86px;max-width:42%;flex-shrink:0;flex-direction:column;align-items:flex-end}.bf-token-balance,.bf-token-price{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.bf-token-balance{color:var(--bf-text-high);font-size:14px;font-weight:600;line-height:1.5;letter-spacing:0}.bf-token-price{color:var(--bf-text-low);font-size:12px;font-weight:500;line-height:1.5;letter-spacing:0}.bf-token-row[data-selected=true] .bf-token-symbol{color:var(--bf-text-high)}.bf-token-row[data-selected=true] .bf-token-balance{color:var(--bf-text-high);font-size:16px}.bf-token-row[data-selected=true] .bf-token-price{color:var(--bf-text-low);font-size:14px}.bf-token-empty{padding:32px 16px;color:var(--bf-text-low);font-size:14px;font-weight:500;line-height:1.5;text-align:center}.bf-slippage-overlay{position:fixed;inset:0;z-index:100002;display:flex;align-items:center;justify-content:center;padding:24px;background:#00000085;pointer-events:auto;box-sizing:border-box}.bf-slippage-dialog{display:flex;width:min(480px,calc(100vw - 48px));height:auto;min-height:min(316px,calc(100dvh - 48px));max-height:calc(100dvh - 48px);flex-direction:column;overflow:hidden;border:1px solid var(--ds-border-medium, rgba(0, 0, 0, .18));border-radius:24px;background:var(--ds-surface-default, #ffffff);color:var(--ds-content-highest, #000000);box-shadow:var(--ds-shadow-modal, 0 4px 30px -1px rgba(0, 0, 0, .15));box-sizing:border-box}.bf-slippage-head{position:relative;display:flex;min-height:73px;flex-shrink:0;align-items:center;justify-content:flex-start;padding:24px 56px 24px 24px;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));background:var(--ds-surface-default, #ffffff);box-sizing:border-box}.bf-slippage-head h3{margin:0;color:var(--ds-content-highest, #000000);font-size:20px;font-weight:600;line-height:1.25;letter-spacing:0}.bf-slippage-close{position:absolute;top:24px;right:24px;display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;padding:0;border:0;background:transparent;color:var(--ds-content-low, rgba(0, 0, 0, .4));cursor:pointer}.bf-slippage-close:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.bf-slippage-body{display:flex;flex:1;min-height:0;flex-direction:column;gap:24px;padding:24px;box-sizing:border-box}.bf-slippage-desc{margin:0;color:var(--ds-content-medium, rgba(0, 0, 0, .65));font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-slippage-controls{display:flex;flex-direction:column;gap:12px;width:100%}.bf-slippage-presets{display:flex;gap:8px;width:100%}.bf-slippage-preset{appearance:none;display:inline-flex;flex:1 1 0;min-width:0;min-height:48px;align-items:center;justify-content:center;padding:12px 8px;border:1px solid transparent;border-radius:12px;background:var(--ds-surface-medium, #f5f7fa);color:var(--ds-content-medium, rgba(0, 0, 0, .65));font:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer;box-sizing:border-box}.bf-slippage-preset:hover,.bf-slippage-preset[data-selected=true]{border-color:var(--ds-accent-primary-default, #00b4b7);background:var(--ds-accent-primary-low, #e7f9f8)}.bf-slippage-custom{display:flex;min-height:48px;align-items:center;gap:8px;padding:12px;border:1px solid transparent;border-radius:12px;background:var(--ds-surface-medium, #f5f7fa);color:var(--ds-content-high, rgba(0, 0, 0, .85));box-sizing:border-box}.bf-slippage-custom:focus-within,.bf-slippage-custom[data-selected=true]{border-color:var(--ds-accent-primary-default, #00b4b7)}.bf-slippage-custom input{width:100%;min-width:0;padding:0;border:0;outline:0;background:transparent;color:var(--ds-content-high, rgba(0, 0, 0, .85));font:inherit;font-size:16px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-slippage-custom input::placeholder{color:var(--ds-content-lowest, rgba(0, 0, 0, .25))}.bf-slippage-custom span:not(.bf-sr-only){flex-shrink:0;color:var(--ds-content-high, rgba(0, 0, 0, .85));font-size:16px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-slippage-apply{appearance:none;margin-top:auto;width:100%;min-height:48px;padding:12px;border:0;border-radius:12px;background:var(--ds-accent-primary-default, #00b4b7);color:var(--ds-accent-primary-on-primary, #ffffff);font:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer;box-sizing:border-box}.bf-slippage-apply:hover{filter:brightness(.96)}.bf-slippage-apply:disabled{cursor:not-allowed;opacity:.5;filter:none}.bf-slippage-message{margin:0;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-slippage-message[data-variant=warning]{color:var(--ds-system-orange-high, #e56f00)}.bf-slippage-message[data-variant=error]{color:var(--ds-system-red-default, #da0b2e)}.bf-action-modal-overlay{--bf-bg: var(--ds-bg-default, #1e232e);--bf-surface: var(--ds-surface-medium, rgba(255, 255, 255, .05));--bf-surface-hover: var(--ds-surface-high, rgba(255, 255, 255, .08));--bf-border: var(--ds-border-default, rgba(255, 255, 255, .12));--bf-text-high: var(--ds-content-high, rgba(255, 255, 255, .92));--bf-text-medium: var(--ds-content-medium, rgba(255, 255, 255, .65));--bf-text-low: var(--ds-content-low, rgba(255, 255, 255, .4));position:fixed;inset:0;z-index:100003;display:flex;align-items:center;justify-content:center;padding:24px;background:#040912b8;pointer-events:auto;box-sizing:border-box}.bf-action-modal-overlay[data-theme=light]{--bf-bg: var(--ds-bg-default, #ffffff);--bf-surface: var(--ds-surface-medium, rgba(18, 18, 18, .05));--bf-surface-hover: var(--ds-surface-high, rgba(18, 18, 18, .1));--bf-border: var(--ds-border-default, rgba(18, 18, 18, .08));--bf-text-high: var(--ds-content-high, rgba(18, 18, 18, .85));--bf-text-medium: var(--ds-content-medium, rgba(18, 18, 18, .65));--bf-text-low: var(--ds-content-low, rgba(18, 18, 18, .4))}.bf-action-modal{display:flex;width:min(480px,calc(100vw - 48px));flex-direction:column;align-items:center;gap:24px;padding:48px 24px 24px;border:1px solid var(--bf-border);border-radius:24px;background:var(--bf-bg);color:#fff;box-shadow:0 24px 80px #00000073;box-sizing:border-box}.bf-action-modal h3{width:100%;margin:0;color:var(--bf-text-high);font-size:24px;font-weight:700;line-height:1.25;text-align:center;letter-spacing:0}.bf-action-modal-desc{max-width:380px;margin:0;color:var(--bf-text-low);font-size:15px;font-weight:500;line-height:1.45;text-align:center;letter-spacing:0}.bf-terms-check-row{display:grid;width:100%;min-height:56px;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px;padding:14px 16px;border:none;border-radius:12px;background:var(--bf-surface);color:var(--bf-text-medium);font-size:16px;font-weight:700;line-height:1.4;box-sizing:border-box;cursor:pointer;touch-action:manipulation;user-select:none}.bf-terms-check-button{appearance:none;display:grid;min-width:0;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:12px;padding:0;border:0;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer;touch-action:manipulation}.bf-terms-check-button:focus-visible .bf-terms-checkbox{outline:2px solid var(--ds-accent-primary-default, #00ceb2);outline-offset:2px}.bf-terms-checkbox{position:relative;display:inline-flex;width:20px;height:20px;align-items:center;justify-content:center;border:1px solid rgba(124,143,180,.72);border-radius:5px;background:transparent;box-sizing:border-box}.bf-terms-checkbox[data-checked=true]{border-color:var(--ds-accent-primary-default, #00ceb2);background:var(--ds-accent-primary-default, #00ceb2)}.bf-terms-checkbox[data-checked=true]:after{width:8px;height:4px;border:solid var(--ds-accent-primary-on, #000000);border-width:0 0 2px 2px;content:"";transform:rotate(-45deg) translate(1px,-1px)}.bf-terms-check-row a{position:relative;z-index:1;color:var(--ds-accent-primary-default, #00ceb2);font-size:14px;font-weight:700;text-decoration:none;white-space:nowrap}.bf-terms-privacy{max-width:380px;margin:0;color:var(--bf-text-low);font-size:15px;font-weight:500;line-height:1.45;text-align:center;letter-spacing:0}.bf-action-primary,.bf-action-secondary{display:inline-flex;width:100%;min-height:56px;align-items:center;justify-content:center;padding:14px 16px;border:0;border-radius:12px;font:inherit;font-size:18px;font-weight:700;line-height:1.4;letter-spacing:0;cursor:pointer}.bf-action-primary{background:var(--ds-accent-primary-default, #00ceb2);color:var(--ds-accent-primary-on, #000000)}.bf-action-primary:disabled{cursor:not-allowed;opacity:.35}.bf-action-primary[aria-busy=true]{gap:8px;opacity:1}.bf-action-button-spinner{width:18px;height:18px;border:2px solid rgba(0,0,0,.22);border-top-color:currentColor;border-right-color:currentColor;border-radius:999px;animation:bf-loading-spin .9s linear infinite}.bf-action-secondary{background:var(--bf-surface);color:var(--bf-text-low)}.bf-action-secondary:disabled{cursor:not-allowed;opacity:.5}.bf-approve-address-box{display:flex;width:100%;flex-direction:column;gap:10px;padding:16px;border:1px solid var(--bf-border);border-radius:12px;background:var(--bf-surface);box-sizing:border-box}.bf-approve-address-box>span{color:var(--bf-text-low);font-size:14px;font-weight:700;line-height:1.4}.bf-approve-address-box>div{display:flex;min-width:0;align-items:center;justify-content:space-between;gap:12px}.bf-approve-address-box strong{min-width:0;overflow:hidden;color:var(--bf-text-high);font-size:15px;font-weight:500;line-height:1.5;text-overflow:ellipsis;white-space:nowrap}.bf-copy-button{flex-shrink:0;min-width:48px;min-height:32px;padding:6px 10px;border:1px solid rgba(0,206,178,.65);border-radius:8px;background:transparent;color:var(--ds-accent-primary-default, #00ceb2);font:inherit;font-size:12px;font-weight:700;line-height:1.2;cursor:pointer}.bf-copy-button:disabled{cursor:not-allowed;opacity:.45}.bf-action-buttons{display:grid;width:100%;grid-template-columns:1fr 1fr;gap:12px}.bf-approval-success-modal{gap:28px}.bf-success-mark{position:relative;display:inline-flex;width:96px;height:96px;flex-shrink:0;align-items:center;justify-content:center;border:12px solid rgba(0,206,178,.12);border-radius:999px;background:#00ceb2a8;box-shadow:0 0 0 10px #00ceb20f;box-sizing:border-box}.bf-success-mark:after{width:34px;height:18px;border:solid #ffffff;border-width:0 0 6px 6px;content:"";transform:rotate(-45deg) translate(2px,-3px)}.bf-status-toast{position:absolute;right:16px;bottom:14px;left:16px;z-index:5;display:flex;align-items:center;gap:12px;min-height:52px;padding:12px;border-radius:12px;background:var(--bf-toast-bg, #1e232e);color:var(--bf-toast-color, rgba(255, 255, 255, .85));box-shadow:0 8px 24px #0000003d;box-sizing:border-box}.bf-status-toast-icon{display:inline-flex;width:28px;height:28px;flex-shrink:0;align-items:center;justify-content:center;border-radius:999px}.bf-status-spinner{width:20px;height:20px;border:3px solid rgba(255,255,255,.18);border-top-color:var(--ds-accent-primary-default, #00ceb2);border-right-color:var(--ds-accent-primary-default, #00ceb2);border-radius:999px;animation:bf-loading-spin .9s linear infinite}.bf-status-check{position:relative;width:20px;height:20px;border-radius:999px;background:var(--ds-accent-primary-default, #00ceb2)}.bf-status-check:after{position:absolute;top:6px;left:5px;width:8px;height:4px;border:solid var(--ds-accent-primary-on, #000000);border-width:0 0 2px 2px;content:"";transform:rotate(-45deg)}.bf-status-toast-copy{display:flex;min-width:0;flex:1;flex-direction:column}.bf-status-toast-copy strong,.bf-status-toast-copy span{overflow:hidden;text-overflow:ellipsis}.bf-status-toast-copy strong{color:#fff;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:-.01em}.bf-status-toast-copy span{color:var(--bf-toast-color, rgba(255, 255, 255, .85));font-size:12px;font-weight:400;line-height:1.5;letter-spacing:-.01em}.bf-status-toast[data-variant=success] .bf-status-toast-copy span{color:var(--ds-accent-primary-on-inverted, #00e8c9)}.bf-status-toast[data-variant=error]{border:1px solid rgba(255,43,95,.28);background:var(--bf-toast-bg, #1e232e)}.bf-status-toast[data-variant=error] .bf-status-toast-copy strong{color:#fff}.bf-status-error-mark{display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;border-radius:999px;background:var(--ds-system-red-default, #ff2b5f);color:#fff;font-size:14px;font-weight:700;line-height:1}.bf-status-toast[data-variant=error] .bf-status-toast-copy span{color:#ffffffe0}.bf-success-overlay{--bf-bg: var(--ds-bg-default, #1e232e);--bf-border: var(--ds-border-default, rgba(255, 255, 255, .12));--bf-text-high: var(--ds-content-high, rgba(255, 255, 255, .92));--bf-text-medium: var(--ds-content-medium, rgba(255, 255, 255, .65));position:fixed;inset:0;z-index:100003;display:flex;align-items:center;justify-content:center;padding:24px;background:#000000b8;pointer-events:auto;box-sizing:border-box}.bf-success-overlay[data-theme=light]{--bf-bg: #ffffff;--bf-border: rgba(18, 18, 18, .08);--bf-text-high: rgba(18, 18, 18, .85);--bf-text-medium: rgba(18, 18, 18, .65);--bf-text-low: rgba(18, 18, 18, .4)}.bf-success-modal{display:flex;width:min(480px,calc(100vw - 48px));flex-direction:column;overflow:hidden;border:1px solid var(--bf-border);border-radius:24px;background:var(--bf-bg);color:var(--bf-text-high);box-shadow:0 24px 80px #00000073;box-sizing:border-box}.bf-success-head{display:flex;min-height:73px;align-items:center;justify-content:space-between;gap:16px;padding:24px;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));box-sizing:border-box}.bf-success-head h3{min-width:0;margin:0;overflow:hidden;color:var(--ds-content-highest, #000000);font-size:20px;font-weight:600;line-height:1.25;text-overflow:ellipsis;white-space:nowrap}.bf-success-close{display:inline-flex;width:24px;height:24px;flex-shrink:0;align-items:center;justify-content:center;padding:0;border:0;background:transparent;color:var(--ds-content-low, rgba(0, 0, 0, .4));cursor:pointer}.bf-success-close:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.bf-success-body{display:flex;flex-direction:column;align-items:center;gap:24px;padding:40px 24px 24px;box-sizing:border-box}.bf-success-copy{display:flex;width:100%;flex-direction:column;align-items:center;gap:4px;color:var(--bf-text-medium);text-align:center}.bf-success-copy strong{color:var(--bf-text-high);font-size:24px;font-weight:700;line-height:1.25;letter-spacing:0}.bf-success-copy span{color:var(--bf-text-medium);font-size:15px;font-weight:500;line-height:1.5;letter-spacing:0}.bf-success-route{display:flex;align-items:center;justify-content:center;gap:12px}.bf-success-route .bf-token-icon{width:48px!important;height:48px!important;background:transparent;font-size:18px}.bf-success-route-arrow{color:var(--bf-text-low);font-size:24px;font-weight:500;line-height:1}.bf-success-ok{display:inline-flex;width:100%;min-height:48px;align-items:center;justify-content:center;padding:12px;border:0;border-radius:12px;background:#00b4b7e0;color:#fff;font:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer}@media(max-width:767px){.bf-success-body{padding:40px 24px 24px}.bf-success-copy strong{font-size:22px}.bf-success-copy span{font-size:14px}.bf-success-mark{width:88px;height:88px}.bf-success-route .bf-token-icon{width:44px!important;height:44px!important}}@keyframes bf-loading-spin{to{transform:rotate(360deg)}}.bf-swap-toggle{position:absolute;top:100px;left:50%;z-index:1;display:inline-flex;width:32px;height:32px;align-items:center;justify-content:center;padding:0;border:0;border-radius:9999px;background:var(--ds-accent-primary-default, #00ceb2);color:var(--ds-accent-primary-on, #000000);box-shadow:0 1px 5px #0000001f;cursor:pointer}.bf-swap-card[data-has-from-error=true] .bf-swap-toggle{top:132px}.bf-details{display:flex;flex-direction:column;gap:24px}.bf-exchange-rate{display:flex;width:100%;align-items:center;justify-content:center;gap:4px;padding:0 0 24px;border:0;background:transparent;color:var(--bf-text-low);font:inherit;font-size:12px;font-weight:500;line-height:1.5;letter-spacing:-.01em;cursor:pointer}.bf-exchange-rate:hover{color:var(--bf-text-medium)}.bf-detail-section,.bf-history-card{display:flex;flex-direction:column;gap:12px;padding:0;border-radius:12px;background:transparent;box-sizing:border-box}.bf-liquidity{display:flex;flex-direction:column;gap:12px;padding:16px;border-radius:12px;background:var(--bf-surface);box-sizing:border-box}.bf-root[data-view=history] .bf-liquidity,.bf-root[data-view=history] .bf-detail-section,.bf-root[data-view=history] .bf-history-card{background:var(--ds-surface-default, #ffffff)}.bf-detail-section h3{margin:0;color:var(--bf-text-high);font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em}.bf-tx-fee-section{gap:12px}.bf-tx-fee-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.bf-collapse-head{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;margin:0;padding:0;background:none;border:none;color:inherit;font:inherit;text-align:left;cursor:pointer}.bf-detail-section[data-open=true] .bf-collapse-head{padding-bottom:12px;border-bottom:1px solid var(--bf-border)}.bf-collapse-chevron{flex-shrink:0;color:var(--bf-text-low);transition:transform .2s ease}.bf-detail-section[data-open=true] .bf-collapse-chevron{transform:rotate(180deg)}.bf-collapse-body{display:flex;flex-direction:column;gap:14px}.bf-root[data-view=history] .bf-detail-section[data-open=true] .bf-collapse-head{border-bottom-color:var(--ds-border-default, rgba(0, 0, 0, .07))}.bf-root[data-view=history] .bf-collapse-chevron{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.bf-tx-fee-total{display:inline-flex;align-items:center;justify-content:flex-end;gap:8px;min-width:0;color:var(--bf-text-medium);font-size:14px;font-weight:600;line-height:1.4;text-align:right}.bf-tx-fee-total>span[data-delegated=true]{text-decoration:line-through;text-decoration-thickness:2px;text-decoration-color:currentColor}.bf-fee-delegated{display:inline-flex;align-items:center;justify-content:center;min-height:24px;padding:2px 8px;border-radius:6px;background:#379cff2e;color:#4eb3ff;font-size:10px;font-weight:500;line-height:1.3;white-space:nowrap}.bf-tx-fee-token{width:16px;height:16px;flex-shrink:0;border-radius:999px;object-fit:cover}.bf-info-card{gap:14px}.bf-info-section{display:flex;flex-direction:column;gap:10px}.bf-info-section+.bf-info-section{padding-top:2px}.bf-info-section h4{margin:0;color:var(--bf-text-high);font-size:14px;font-weight:600;line-height:1.5}.bf-root[data-view=history] .bf-detail-section h3,.bf-root[data-view=history] .bf-info-section h4{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.bf-info-rows{display:flex;flex-direction:column;gap:8px}.bf-info-row{display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0;font-size:12px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-liquidity-head{display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-info-label{display:inline-flex;align-items:center;gap:6px;min-width:0;color:var(--bf-text-low)}.bf-tree-marker{width:10px;flex-shrink:0;color:var(--bf-text-low)}.bf-info-value{min-width:0;color:var(--bf-text-medium);text-align:right}.bf-info-route,.bf-info-value-token{display:inline-flex;align-items:center;gap:4px}.bf-info-route .bf-token-icon,.bf-info-value-token .bf-token-icon{flex-shrink:0}.bf-info-route-arrow{color:var(--bf-text-medium)}.bf-root[data-view=history] .bf-info-route-arrow{color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.bf-info-value[data-tone=accent]{color:var(--ds-accent-primary-high, #00a0a2)}.bf-info-value[data-tone=warning]{color:var(--ds-system-orange-high, #e56f00)}.bf-root[data-view=history] .bf-info-label,.bf-root[data-view=history] .bf-liquidity-head,.bf-root[data-view=history] .bf-tree-marker{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.bf-root[data-view=history] .bf-info-value{color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.bf-root[data-view=history] .bf-info-value[data-tone=accent]{color:var(--ds-accent-primary-high, #00a0a2)}.bf-root[data-view=history] .bf-info-value[data-tone=warning]{color:var(--ds-system-orange-high, #e56f00)}.bf-liquidity-status{display:inline-flex;align-items:center;gap:6px;padding:4px 12px;border-radius:999px;font-size:13px;font-weight:600;line-height:1.4;white-space:nowrap}.bf-liquidity-status:before{content:"";display:inline-block;width:7px;height:7px;border-radius:50%;flex-shrink:0}.bf-liquidity-status[data-status=normal],.bf-liquidity-status:not([data-status]){background:#00ceb21f;color:var(--ds-accent-primary-default, #00ceb2)}.bf-liquidity-status[data-status=normal]:before,.bf-liquidity-status:not([data-status]):before{background:var(--ds-accent-primary-default, #00ceb2)}.bf-liquidity-status[data-status=low]{background:#e56f001f;color:#e56f00}.bf-liquidity-status[data-status=low]:before{background:#e56f00}.bf-liquidity-status[data-status=rebalancing]{background:#da0b2e1a;color:#da0b2e}.bf-liquidity-status[data-status=rebalancing]:before{background:#da0b2e}.bf-liquidity-track{height:8px;overflow:hidden;border-radius:999px;background:var(--bf-surface-hover)}.bf-liquidity-track span{display:block;height:100%;border-radius:inherit;background:var(--ds-accent-primary-default, #00ceb2)}.bf-error{padding:12px;border-radius:12px;background:#da0b2e1f;color:var(--ds-system-red-default, #da0b2e);font-size:13px;line-height:1.4}.bf-footer{display:flex;flex-shrink:0;flex-direction:column;align-items:center;gap:10px;padding:12px 24px 24px;background:var(--ds-bg-default, var(--bf-bg))}.bf-next{width:100%;min-height:48px;padding:12px;border:0;border-radius:12px;background:var(--ds-accent-primary-default, #00ceb2);color:var(--ds-accent-primary-on, #000000);font:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer}.bf-next:disabled{cursor:default;opacity:.6}.bf-powered{display:inline-flex;align-items:center;gap:3px;color:var(--bf-text-low);font-size:12px;font-weight:500;line-height:1.5;letter-spacing:-.01em;text-decoration:none}.bf-powered:focus-visible{border-radius:4px;outline:2px solid var(--ds-accent-primary-default, #00ceb2);outline-offset:2px}.bf-powered-brand{text-decoration:underline;text-underline-offset:2px}.bf-history-tabs{display:flex;align-items:center;gap:4px;width:100%}.bf-history-tab{position:relative;display:inline-flex;min-height:37px;align-items:center;justify-content:center;padding:8px 12px;border:0;background:transparent;color:var(--ds-content-lowest, rgba(0, 0, 0, .25));font:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:0;cursor:pointer}.bf-history-tab[data-active=true]{color:var(--ds-accent-primary-high, #00a0a2)}.bf-history-tab[data-active=true]:after{position:absolute;right:8px;bottom:0;left:8px;height:3px;border-radius:999px;background:var(--ds-accent-primary-high, #00a0a2);content:""}.bf-history-tab-dot{position:absolute;top:8px;right:4px;width:6px;height:6px;border-radius:999px;background:var(--ds-system-red-default, #da0b2e)}.bf-history-list{display:flex;flex-direction:column;gap:12px}.bf-history-item{display:flex;flex-direction:column;gap:8px;padding:12px;border-radius:12px;background:var(--ds-surface-default, #ffffff);box-sizing:border-box}.bf-history-item-head,.bf-history-meta,.bf-history-route,.bf-history-route-token{display:inline-flex;align-items:center}.bf-history-item-head{justify-content:space-between;gap:12px;width:100%}.bf-history-status{display:inline-flex;min-height:24px;align-items:center;justify-content:center;padding:3px 8px;border-radius:4px;background:var(--ds-system-orange-low, #fcf5e9);color:var(--ds-system-orange-high, #e56f00);font-size:12px;font-weight:500;line-height:1.5;letter-spacing:0;white-space:nowrap}.bf-history-status[data-status=completed]{background:var(--ds-system-green-low, #e7f9f8);color:var(--ds-system-green-high, #00a0a2)}.bf-history-status[data-status=failed]{background:var(--ds-system-red-low, rgba(218, 11, 46, .12));color:var(--ds-system-red-default, #da0b2e)}.bf-history-time{min-width:0;color:var(--ds-content-low, rgba(0, 0, 0, .4));font-size:12px;font-weight:500;line-height:1.5;letter-spacing:0;text-align:right;white-space:nowrap}.bf-history-item-body{display:flex;flex-direction:column;gap:4px}.bf-history-amount{color:var(--ds-content-high, rgba(0, 0, 0, .85));font-size:16px;font-weight:600;line-height:1.5;letter-spacing:0}.bf-history-meta{justify-content:space-between;gap:12px;min-width:0}.bf-history-usd{min-width:0;color:var(--ds-content-low, rgba(0, 0, 0, .4));font-size:12px;font-weight:500;line-height:1.5;letter-spacing:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.bf-history-route{justify-content:flex-end;gap:4px;min-width:0;color:var(--ds-content-high, rgba(0, 0, 0, .85));font-size:12px;font-weight:600;line-height:1.5;letter-spacing:0}.bf-history-route-token{gap:4px;min-width:0}.bf-history-route-token span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.bf-history-route-arrow{flex-shrink:0;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.bf-empty{padding:32px 16px;text-align:center;color:var(--ds-content-low, rgba(0, 0, 0, .4));font-size:14px}.bf-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@media(max-width:767px){.bf-token-picker-overlay{align-items:flex-end;padding:0}.bf-token-picker{width:100%;max-height:82dvh;min-height:min(520px,82dvh);border-right:0;border-bottom:0;border-left:0;border-radius:24px 24px 0 0}.bf-token-picker-handle{display:block;width:40px;height:4px;flex-shrink:0;align-self:center;margin:10px 0 0;border-radius:999px;background:#ffffff38}.bf-token-picker-head{min-height:55px;padding:12px 56px 16px 24px;border-bottom:0}.bf-token-picker-close{top:13px}.bf-token-search{margin:0 16px 12px}.bf-token-list{padding:0 16px 16px}.bf-slippage-overlay{align-items:flex-end;padding:0}.bf-slippage-dialog{width:100%;height:auto;min-height:316px;max-height:82dvh;border-right:0;border-bottom:0;border-left:0;border-radius:24px 24px 0 0}}.wi-drawer-content .bf-header{padding:16px}.wi-drawer-content .bf-header .bf-header-btn:last-child{top:16px;right:16px}.wi-drawer-content .bf-body,.wi-drawer-content .bf-history-body{padding:16px}
10
+ `);import{Fragment as Lr,jsx as p,jsxs as y}from"react/jsx-runtime";var cs=R.createContext(void 0);function Tn(){return R.useContext(cs)}function bd(e){let[t,n]=R.useState(void 0);return R.useEffect(()=>{let o=e.current;if(!o)return;let r=()=>{let i=o.closest("[data-theme]");n(i?.getAttribute("data-theme")??void 0)};r();let a=new MutationObserver(r);return a.observe(document.documentElement,{attributes:!0,subtree:!0,attributeFilter:["data-theme"]}),()=>a.disconnect()},[e]),t}var rs=[{value:"0.1",label:"0.1%"},{value:"0.5",label:"0.5%"},{value:"1",label:"1%"},{value:"5",label:"5%"}],wd={dev:"https://dev.crossdefi.io",stage:"https://stg.crossdefi.io",production:"https://crossdefi.io"},xd=[{value:"all",label:"ALL"},{value:"completed",label:"Completed"},{value:"pending",label:"Pending"}];function vd(e,t){return e==="auto"?t?`Auto ${t}%`:"Auto":e?`${e}%`:"1%"}function is(e){let t=e.replace(/[^\d.]/g,""),[n="",...o]=t.split("."),r=o.join("");return o.length===0?n:`${n}.${r.slice(0,2)}`}function yd(e){return`${e.chainId}:${e.address.toLowerCase()}`}function ds(e){let t=Number(e);return Number.isFinite(t)?t.toLocaleString("en-US",{maximumFractionDigits:t>=1?2:6}):e||"0"}function as(e,t){let n=Number(e||"0"),o=t?.priceUsd??0;return`\u2248 $${(Number.isFinite(n)?n*o:0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})} USD`}function kd(e,t=6){if(!e)return e;let[n,o=""]=e.split(".");if(!o)return n;let r=o.slice(0,t).replace(/0+$/,"");return r?`${n}.${r}`:n}function Sd(e,t){if(!t)return!1;let n=new Bt(e||"0"),o=new Bt(t.balance||"0");return!n.isFinite()||!o.isFinite()?!1:n.isGreaterThan(o)}function Cd(e){if(e.priceUsd===void 0)return null;let t=new Bt(e.balance||"0");return t.isFinite()?`\u2248 $${t.multipliedBy(e.priceUsd).toFormat(2)} USD`:null}function Rd(e){if(e.priceUsd===void 0)return null;let t=new Bt(e.priceUsd);return t.isFinite()?`$${t.toFormat(t.isLessThan(1)?4:2)}`:null}function ps(e){if(!e.isFinite()||e.isNaN())return"0";let n=e.decimalPlaces(6,Bt.ROUND_DOWN).toFixed(6).replace(/\.?0+$/,""),[o="0",r]=n.split("."),a=new Bt(o||"0").toFormat(0);return r?`${a}.${r}`:a}function Nd(e){return e.length<=14?e:`${e.slice(0,6)}...${e.slice(-6)}`}function Td(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=o=>o.toString().padStart(2,"0");return[`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`,`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`].join(" ")}function Id(e){let t=new Bt(e||"0");return!t.isFinite()||t.isNaN()?e||"0":ps(t)}function Ld(e,t){if(t?.priceUsd===void 0)return null;let n=new Bt(e||"0").multipliedBy(t.priceUsd);return!n.isFinite()||n.isNaN()?null:`$${n.toFormat(2)}`}function To(e){return e.status==="success"?"completed":e.status==="failed"?"failed":"pending"}function Ed(e,t){return t==="all"?!0:To(e)===t}function Ad(e){return e==="completed"?"Completed":e==="failed"?"Failed":"Pending"}function ss(e){return e===56||e===97?"BSC":e===612044||e===5555?"CROSS":`Chain ${e}`}function fs(e,t){return!!e&&!!t&&e.chainId===t.chainId&&e.address.toLowerCase()===t.address.toLowerCase()}function us(e,t){if(!(!e||!t))return e.chainId===t.chainId?"swap":fs(e,t)||e.symbol.toLowerCase()===t.symbol.toLowerCase()?"bridge":"swap-bridge"}function ms(e){return e==="swap"||e==="deposit-swap"||e==="swap-withdraw"}function No(e){return!e||e==="0"||Number(e)===0}function Pd(e){let t=e.trim().toLowerCase();return t?t.startsWith("minimum ")?{from:e}:t.startsWith("available ")&&t.includes("or more")?{to:e}:t.includes("insufficient balance")||t.includes("not enough balance")||t.includes("exceeds balance")||t.includes("insufficient network fee")?{from:e}:t.includes("insufficient liquidity")||t.includes("not enough liquidity")?{to:e}:{}:{}}function Bd(e){let t=e.fromToken,n=e.toToken,o=us(t,n),r=e.fromAmount||"0",a=e.toAmount||"0",i=o!==void 0&&!ms(o),s=o!==void 0&&o!=="bridge";return{pathType:o,bridgeInfo:i?[{label:"Route",value:t&&n?`${ss(t.chainId)} \u2192 ${ss(n.chainId)}`:"-"},{label:"Validator Fee",value:No(r)?"0":"Free",tone:No(r)?"default":"accent"},{label:"Network Fee",value:No(r)?"0":"Free",tone:No(r)?"default":"accent"}]:void 0,swapInfo:s?[t&&n?{label:"Route",value:"",routeTokens:[{symbol:t.symbol,iconUrl:t.iconUrl},{symbol:n.symbol,iconUrl:n.iconUrl}]}:{label:"Route",value:"-"},{label:"Price Impact",value:"0%"},{label:"In Amount",value:r,valueToken:t?{symbol:t.symbol,iconUrl:t.iconUrl}:void 0},{label:"Swap Fee",value:"0",valueToken:t?{symbol:t.symbol,iconUrl:t.iconUrl}:void 0},{label:"Out Amount",value:a,valueToken:n?{symbol:n.symbol,iconUrl:n.iconUrl}:void 0}]:void 0,txFee:[{label:"Priority Fee Per Gas",value:"0 Gwei"},{label:"Max Fee Per Gas",value:"0 Gwei"},{label:"Gas Limit",value:"0"}],txFeeInfo:{estTxFee:"0",isDelegateFee:!1}}}function Wn({token:e,size:t=20}){let n=e?.iconUrl;return p("span",{className:"bf-token-icon","data-has-image":!!n?"true":"false",style:{width:t,height:t},children:n?p("img",{src:n,alt:"",width:t,height:t,draggable:!1}):p("span",{className:"bf-token-fallback",children:e?.symbol?.slice(0,1)??"?"})})}function ls({label:e,token:t,amount:n,usd:o,onAmountChange:r,onTokenClick:a,locked:i=!1}){return y("section",{className:"bf-amount-panel",children:[y("div",{className:"bf-amount-head",children:[p("span",{children:e}),y("span",{className:"bf-balance",children:[ds(t?.balance??"0")," ",t?.symbol??""]})]}),y("div",{className:"bf-amount-main",children:[y("label",{className:"bf-amount-input-wrap",children:[y("span",{className:"bf-sr-only",children:[e," amount"]}),p("input",{type:"text",inputMode:"decimal",value:n,onChange:s=>r(s.target.value),placeholder:"0",className:"bf-amount-input"}),p("span",{className:"bf-amount-usd",children:o})]}),y("button",{type:"button",className:"bf-token-pill",onClick:i?void 0:a,disabled:!i&&!a,"data-locked":i?"true":void 0,"aria-label":`Select ${e.toLowerCase()} token`,children:[p(Wn,{token:t}),p("span",{children:t?.symbol??"Select"}),!i&&p(sn,{size:16})]})]})]})}function Fd({flow:e,side:t,onClose:n}){let o=R.useId(),[r,a]=R.useState(""),[i,s]=R.useState(null),c=t==="from"?e.fromToken:e.toToken;R.useEffect(()=>{s(document.body)},[]),R.useEffect(()=>{let m=v=>{v.key==="Escape"&&n()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[n]);let l=R.useMemo(()=>t==="from"?e.tokens:e.availableToTokens,[e.availableToTokens,e.tokens,t]),d=R.useMemo(()=>{let m=r.trim().toLowerCase();return m?l.filter(v=>v.symbol.toLowerCase().includes(m)||v.name.toLowerCase().includes(m)):l},[r,l]),u=R.useCallback(m=>{t==="from"?e.selectFromToken(m):e.selectToToken(m),n()},[e,n,t]);if(!i)return null;let h=Tn();return Nn(p("div",{className:"bf-token-picker-overlay","data-theme":h,role:"presentation",onMouseDown:m=>{m.target===m.currentTarget&&n()},children:y("section",{className:"bf-token-picker",role:"dialog","aria-modal":"true","aria-labelledby":o,children:[p("span",{className:"bf-token-picker-handle","aria-hidden":"true"}),y("header",{className:"bf-token-picker-head",children:[p("h3",{id:o,children:"Select a token"}),p("button",{type:"button",className:"bf-token-picker-close",onClick:n,"aria-label":"Close token selector",children:p(Lt,{size:24})})]}),y("label",{className:"bf-token-search",children:[p(Ua,{size:20}),p("span",{className:"bf-sr-only",children:"Search tokens"}),p("input",{value:r,onChange:m=>a(m.target.value),placeholder:"Search Tokens",autoComplete:"off",spellCheck:!1})]}),y("div",{className:"bf-token-list",children:[d.map(m=>{let v=fs(m,c),x=v?Rd(m):Cd(m);return y("button",{type:"button",className:"bf-token-row","data-selected":v?"true":"false",onClick:()=>u(m),children:[y("span",{className:"bf-token-row-left",children:[p(Wn,{token:m,size:40}),y("span",{className:"bf-token-meta",children:[p("span",{className:"bf-token-symbol",children:m.symbol}),!v&&p("span",{className:"bf-token-name",children:m.name})]})]}),y("span",{className:"bf-token-row-right",children:[y("span",{className:"bf-token-balance",children:[ds(m.balance),v?null:` ${m.symbol}`]}),x&&p("span",{className:"bf-token-price",children:x})]})]},yd(m))}),d.length===0&&p("div",{className:"bf-token-empty",children:"No tokens found"})]})]})}),i)}function Md({flow:e,onClose:t}){let n=R.useId(),[o,r]=R.useState(null),a=rs.find(x=>x.value===e.slippage),[i,s]=R.useState(e.slippage&&!a?e.slippage:""),c=i.trim()!==""&&i.trim()!==".",l=c?Number(i):NaN,d=Number.isFinite(l)&&l>50,u=Number.isFinite(l)&&l>5&&!d,h=x=>{e.setSlippage(x),t()},m=()=>{!c||d||(e.setSlippage(is(i)),t())};if(R.useEffect(()=>{r(document.body)},[]),R.useEffect(()=>{let x=w=>{w.key==="Escape"&&t()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[t]),!o)return null;let v=Tn();return Nn(p("div",{className:"bf-slippage-overlay","data-theme":v,role:"presentation",onMouseDown:x=>{x.target===x.currentTarget&&t()},children:y("section",{className:"bf-slippage-dialog",role:"dialog","aria-modal":"true","aria-labelledby":n,children:[y("header",{className:"bf-slippage-head",children:[p("h3",{id:n,children:"Slippage Settings"}),p("button",{type:"button",className:"bf-slippage-close",onClick:t,"aria-label":"Close slippage settings",children:p(Lt,{size:24})})]}),y("div",{className:"bf-slippage-body",children:[p("p",{className:"bf-slippage-desc",children:"The maximum price difference you are willing to accept before the transaction is reverted. Higher slippage increases the chance of execution but may result in a worse price."}),y("div",{className:"bf-slippage-controls",children:[p("div",{className:"bf-slippage-presets",children:rs.map(x=>p("button",{type:"button",className:"bf-slippage-preset","data-selected":!c&&e.slippage===x.value?"true":"false",onClick:()=>h(x.value),children:x.label},x.value))}),y("label",{className:"bf-slippage-custom","data-selected":c?"true":"false",children:[p("span",{className:"bf-sr-only",children:"Custom slippage percent"}),p("input",{value:i,onChange:x=>{s(is(x.target.value))},onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),m())},inputMode:"decimal",placeholder:"Enter custom slippage",autoComplete:"off",spellCheck:!1}),p("span",{"aria-hidden":"true",children:"%"})]})]}),d?p("p",{className:"bf-slippage-message","data-variant":"error",children:"Slippage cannot exceed 50%."}):u?p("p",{className:"bf-slippage-message","data-variant":"warning",children:"Your transaction may be frontrun due to high slippage."}):null,c&&p("button",{type:"button",className:"bf-slippage-apply",onClick:m,disabled:d,children:"Apply"})]})]})}),o)}function _d({flow:e}){let t=R.useId(),[n,o]=R.useState(!1),[r,a]=R.useState(null),i=Tn();return R.useEffect(()=>{a(document.body)},[]),R.useEffect(()=>{let s=c=>{c.key==="Escape"&&e.cancelTerms()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e]),!r||!e.termsOpen?null:Nn(p("div",{className:"bf-action-modal-overlay","data-theme":i,role:"presentation",onPointerDown:s=>{s.target===s.currentTarget&&e.cancelTerms()},children:y("section",{className:"bf-action-modal bf-terms-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:[p("h3",{id:t,children:"Agree to Terms of Service"}),p("p",{className:"bf-action-modal-desc",children:"Please make sure to review the Terms of Service before using CROSSD."}),y("div",{className:"bf-terms-check-row","data-checked":n?"true":"false",children:[y("button",{type:"button",className:"bf-terms-check-button",role:"checkbox","aria-checked":n,onClick:()=>o(s=>!s),children:[p("span",{className:"bf-terms-checkbox","data-checked":n?"true":"false","aria-hidden":"true"}),p("span",{children:"Agree to Terms of Use"})]}),e.termsUrl&&p("a",{href:e.termsUrl,target:"_blank",rel:"noreferrer",children:"Terms of Service"})]}),p("p",{className:"bf-terms-privacy",children:"I have read and acknowledged the Privacy Policy to use CROSSD"}),p("button",{type:"button",className:"bf-action-primary",disabled:!n||e.status==="submitting",onClick:e.confirmTerms,children:"Confirm"})]})}),r)}function Od({value:e,disabled:t=!1}){let[n,o]=R.useState(!1);return p("button",{type:"button",className:"bf-copy-button","aria-label":"Copy token address",disabled:t,onClick:()=>{t||navigator.clipboard?.writeText(e).then(()=>{o(!0),window.setTimeout(()=>o(!1),1200)})},children:n?"OK":"Copy"})}function zd({flow:e,approval:t}){let n=R.useId(),[o,r]=R.useState(null),a=Tn();if(R.useEffect(()=>{r(document.body)},[]),R.useEffect(()=>{let c=l=>{e.status!=="submitting"&&l.key==="Escape"&&e.cancelApproval()};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e]),!o)return null;let i=e.status==="submitting"||!e.approveBridge,s=e.status==="submitting";return Nn(p("div",{className:"bf-action-modal-overlay","data-theme":a,role:"presentation",children:y("section",{className:"bf-action-modal bf-approve-modal",role:"dialog","aria-modal":"true","aria-labelledby":n,children:[y("h3",{id:n,children:["Approve ",t.token.symbol]}),p(Wn,{token:t.token,size:72}),y("div",{className:"bf-approve-address-box",children:[p("span",{children:"Token Address"}),y("div",{children:[p("strong",{children:t.tokenAddress}),p(Od,{value:t.tokenAddress,disabled:s})]})]}),y("div",{className:"bf-action-buttons",children:[p("button",{type:"button",className:"bf-action-secondary",onClick:e.cancelApproval,disabled:e.status==="submitting",children:"Cancel"}),y("button",{type:"button",className:"bf-action-primary",onClick:e.confirmApproval,disabled:i,"aria-busy":s,children:[s&&p("span",{className:"bf-action-button-spinner","aria-hidden":"true"}),p("span",{children:s?"Approving...":"Approve"})]})]})]})}),o)}function Dd({flow:e}){let t=R.useId(),[n,o]=R.useState(null),r=Tn();return R.useEffect(()=>{o(document.body)},[]),R.useEffect(()=>{if(!e.approvalSuccessOpen)return;let a=i=>{i.key==="Escape"&&e.cancelApproval()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e]),!n||!e.approvalSuccessOpen?null:Nn(p("div",{className:"bf-action-modal-overlay","data-theme":r,role:"presentation",children:y("section",{className:"bf-action-modal bf-approval-success-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:[p("h3",{id:t,children:"Approval Success"}),p("span",{className:"bf-success-mark","aria-hidden":"true"}),y("p",{className:"bf-action-modal-desc",children:["Token approval confirmed successfully.",p("br",{}),"Please continue to the next step."]}),y("div",{className:"bf-action-buttons",children:[p("button",{type:"button",className:"bf-action-secondary",onClick:e.cancelApproval,children:"Cancel"}),p("button",{type:"button",className:"bf-action-primary",onClick:e.continueAfterApproval,children:"Continue"})]})]})}),n)}function Wd({fromAmount:e,toAmount:t,fromToken:n,toToken:o}){let[r,a]=R.useState(!1),i=R.useMemo(()=>{let l=new Bt(e||"0"),d=new Bt(t||"0");return!l.isFinite()||!d.isFinite()||l.lte(0)||d.lte(0)?null:r?l.dividedBy(d):d.dividedBy(l)},[e,r,t]);if(!i||!n||!o||n.symbol===o.symbol)return null;let s=r?o.symbol:n.symbol,c=r?n.symbol:o.symbol;return y("button",{type:"button",className:"bf-exchange-rate",onClick:()=>a(l=>!l),children:[y("span",{children:["1 ",s]}),p(Ka,{size:12}),y("span",{children:[ps(i)," ",c]})]})}function Hd({flow:e}){return e.submitToast?y("div",{className:"bf-status-toast","data-variant":"processing",role:"status","aria-live":"polite",children:[p("span",{className:"bf-status-toast-icon","aria-hidden":"true",children:p("span",{className:"bf-status-spinner"})}),y("span",{className:"bf-status-toast-copy",children:[p("strong",{children:"Transaction Processing"}),p("span",{children:"Your transaction is being processed on the blockchain"})]})]}):null}function Gd({message:e}){let[t,n]=R.useState(!1);return R.useEffect(()=>{if(!e){n(!1);return}n(!0);let o=window.setTimeout(()=>{n(!1)},3500);return()=>window.clearTimeout(o)},[e]),!e||!t?null:y("div",{className:"bf-status-toast","data-variant":"error",role:"alert","aria-live":"assertive",children:[p("span",{className:"bf-status-toast-icon","aria-hidden":"true",children:p("span",{className:"bf-status-error-mark",children:"!"})}),y("span",{className:"bf-status-toast-copy",children:[p("strong",{children:"Error"}),p("span",{children:e})]})]})}function Ud(e){switch(e){case"swap":case"deposit-swap":case"swap-withdraw":return"Swap Transaction Sent";case"bridge":return"Bridge Transaction Sent";case"swap-bridge":return"Swap & Bridge Transaction Sent";case"bridge-swap":return"Bridge & Swap Transaction Sent";default:return"Transaction Sent"}}function $d({flow:e}){let t=R.useId(),[n,o]=R.useState(null),r=e.submitted,a=Tn();return R.useEffect(()=>{o(document.body)},[]),R.useEffect(()=>{if(!e.successDialogOpen)return;let i=s=>{s.key==="Escape"&&e.dismissSuccessDialog()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[e]),!n||!e.successDialogOpen||!r?null:Nn(p("div",{className:"bf-success-overlay","data-theme":a,role:"presentation",children:p("section",{className:"bf-success-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:y("div",{className:"bf-success-body",children:[p("span",{className:"bf-success-mark","aria-hidden":"true"}),y("div",{className:"bf-success-copy",children:[p("strong",{id:t,children:Ud(r.pathType)}),p("span",{children:"Please check the results in the history."})]}),p("div",{className:"bf-success-route","aria-hidden":"true",children:(r.routeTokens&&r.routeTokens.length>0?r.routeTokens:[{symbol:r.fromToken.symbol,iconUrl:r.fromToken.iconUrl},{symbol:r.toToken.symbol,iconUrl:r.toToken.iconUrl}]).map((i,s)=>y(R.Fragment,{children:[s>0&&p("span",{className:"bf-success-route-arrow",children:"\u2192"}),p(Ir,{token:i,size:43})]},`${i.symbol}-${s}`))}),p("button",{type:"button",className:"bf-success-ok",onClick:e.dismissSuccessDialog,children:"OK"})]})})}),n)}function Ir({token:e,size:t=16}){let n=!!e.iconUrl;return p("span",{className:"bf-token-icon","data-has-image":n?"true":"false",style:{width:t,height:t},children:e.iconUrl?p("img",{src:e.iconUrl,alt:"",width:t,height:t,draggable:!1}):p("span",{className:"bf-token-fallback",children:e.symbol?.slice(0,1)??"?"})})}function jd({row:e}){return e.routeTokens&&e.routeTokens.length>0?p("span",{className:"bf-info-route",children:e.routeTokens.map((t,n)=>y(R.Fragment,{children:[n>0&&p("span",{className:"bf-info-route-arrow","aria-hidden":"true",children:"\u2192"}),p(Ir,{token:t})]},`${t.symbol}-${n}`))}):e.valueToken?y("span",{className:"bf-info-value-token",children:[p(Ir,{token:e.valueToken}),p("span",{children:e.value})]}):p(Lr,{children:e.value})}function gs({rows:e}){return!e||e.length===0?null:p("div",{className:"bf-info-rows",children:e.map((t,n)=>y("div",{className:"bf-info-row",children:[y("span",{className:"bf-info-label",children:[p("span",{className:"bf-tree-marker",children:n===e.length-1?"\u2514":"\u251C"}),p("span",{children:t.label})]}),p("span",{className:"bf-info-value","data-tone":t.tone??"default",children:p(jd,{row:t})})]},`${t.label}-${t.value}`))})}function Vd(e,t,n){return e.pathType==="bridge"?"Bridge Info":ms(e.pathType)?"Swap Info":t&&n?"Swap & Bridge Info":t?"Bridge Info":"Swap Info"}function qd({summary:e}){let t=!!e.bridgeInfo?.length,n=!!e.swapInfo?.length,o=t&&n,r=e.pathType==="bridge-swap"?["bridge","swap"]:["swap","bridge"];return p(Lr,{children:r.map(a=>{let i=a==="swap"?e.swapInfo:e.bridgeInfo;return i?.length?y("div",{className:"bf-info-section",children:[o&&p("h4",{children:a==="swap"?"Swap Info":"Bridge Info"}),p(gs,{rows:i})]},a):null})})}function Kd({summary:e}){let t=!!e.bridgeInfo?.length,n=!!e.swapInfo?.length,o=!!e.txFee?.length,r=Vd(e,t,n),[a,i]=R.useState(!0),[s,c]=R.useState(!0);return y("div",{className:"bf-details",children:[e.liquidity&&y("section",{className:"bf-liquidity",children:[y("div",{className:"bf-liquidity-head",children:[p("span",{children:e.liquidity.label??"Available Liquidity"}),p("span",{className:"bf-liquidity-status","data-status":e.liquidity.status,children:e.liquidity.status??"Normal"})]}),p("div",{className:"bf-liquidity-track",children:p("span",{style:{width:`${e.liquidity.percentage??50}%`}})})]}),(t||n)&&y("section",{className:"bf-detail-section bf-info-card","data-open":a?"true":"false",children:[y("button",{type:"button",className:"bf-collapse-head","aria-expanded":a,onClick:()=>i(l=>!l),children:[p("h3",{children:r}),p(sn,{size:16,className:"bf-collapse-chevron"})]}),a&&p("div",{className:"bf-collapse-body",children:p(qd,{summary:e})})]}),o&&y("section",{className:"bf-detail-section bf-tx-fee-section","data-open":s?"true":"false",children:[y("button",{type:"button",className:"bf-collapse-head bf-tx-fee-head","aria-expanded":s,onClick:()=>c(l=>!l),children:[p("h3",{children:"Est. Tx Fee"}),y("div",{className:"bf-tx-fee-total",children:[e.txFeeInfo?.isDelegateFee&&p("span",{className:"bf-fee-delegated",children:"Fee Delegated"}),e.txFeeInfo?.tokenIconUrl&&p("img",{className:"bf-tx-fee-token",src:e.txFeeInfo.tokenIconUrl,alt:e.txFeeInfo.tokenSymbol??"",width:16,height:16,draggable:!1}),p("span",{"data-delegated":e.txFeeInfo?.isDelegateFee&&Number(e.txFeeInfo?.estTxFee)>0?"true":void 0,children:kd(e.txFeeInfo?.estTxFee??"0")}),p(sn,{size:16,className:"bf-collapse-chevron"})]})]}),s&&p("div",{className:"bf-collapse-body",children:p(gs,{rows:e.txFee})})]})]})}function Qd({item:e}){let t=To(e),n=Ld(e.fromAmount,e.fromToken);return y("article",{className:"bf-history-item",children:[y("div",{className:"bf-history-item-head",children:[p("span",{className:"bf-history-status","data-status":t,children:Ad(t)}),p("time",{className:"bf-history-time",dateTime:e.timestamp,children:Td(e.timestamp)})]}),y("div",{className:"bf-history-item-body",children:[y("strong",{className:"bf-history-amount",children:[Id(e.fromAmount)," ",e.fromToken.symbol]}),y("div",{className:"bf-history-meta",children:[p("span",{className:"bf-history-usd",children:n??Nd(e.txHash)}),y("span",{className:"bf-history-route",children:[y("span",{className:"bf-history-route-token",children:[p(Wn,{token:e.fromToken,size:16}),p("span",{children:e.fromToken.symbol})]}),p(qa,{size:16,className:"bf-history-route-arrow"}),y("span",{className:"bf-history-route-token",children:[p(Wn,{token:e.toToken,size:16}),p("span",{children:e.toToken.symbol})]})]})]})]})]})}function Yd({flow:e}){let[t,n]=R.useState("all"),o=e.history.some(i=>To(i)==="pending"),r=e.history.filter(i=>Ed(i,t)),a=t==="all"?"No bridge history yet.":`No ${t} bridge history.`;return y("main",{className:"bf-history-body",children:[p("nav",{className:"bf-history-tabs","aria-label":"Bridge history filters",children:xd.map(i=>y("button",{type:"button",className:"bf-history-tab","data-active":t===i.value?"true":"false",onClick:()=>n(i.value),children:[p("span",{children:i.label}),i.value==="pending"&&o&&p("span",{className:"bf-history-tab-dot","aria-hidden":"true"})]},i.value))}),r.length>0?p("div",{className:"bf-history-list",children:r.map(i=>p(Qd,{item:i},i.id||i.txHash))}):p("div",{className:"bf-empty",children:a})]})}function Zd({flow:e,env:t}){let[n,o]=R.useState(null),[r,a]=R.useState(!1),[i,s]=R.useState(0),l=!!(e.fromAmount.trim()||e.toAmount.trim())?e.summary??Bd(e):null,d=wd[t],u=Pd(e.quoteError),h=Sd(e.fromAmount,e.fromToken),m=h?"Insufficient balance":u.from,v=e.quoteError&&!u.from&&!u.to?e.quoteError:"",x=e.error||v,w=e.history.some(f=>To(f)==="pending"),E=(l?.pathType??us(e.fromToken,e.toToken))!=="bridge";return y(Lr,{children:[y("main",{className:"bf-body",children:[y("div",{className:"bf-toolbar",children:[y("button",{type:"button",className:"bf-chip bf-chip-history",onClick:()=>e.setStep("history"),children:[p($a,{}),p("span",{children:"History"}),(w||e.hasNewHistory)&&p("span",{className:"bf-chip-dot","aria-hidden":"true"})]}),E&&y("button",{type:"button",className:"bf-chip",onClick:()=>a(!0),disabled:e.slippageLocked,"aria-haspopup":"dialog","aria-expanded":r,children:[p(ja,{}),p("span",{children:e.slippageLocked?"Auto 1%":vd(e.slippage,e.effectiveSlippage)})]})]}),y("div",{className:"bf-swap-card","data-has-from-error":m?"true":"false",children:[p(ls,{label:"From",token:e.fromToken,amount:e.fromAmount,usd:as(e.fromAmount,e.fromToken),onAmountChange:f=>e.setAmount(f,"from"),onTokenClick:()=>o("from")}),m&&p("div",{className:"bf-field-error",children:m}),p("button",{type:"button",className:"bf-swap-toggle",onClick:()=>{e.swapTokens(),s(f=>f+360)},style:{transform:`translateX(-50%) rotate(${i}deg)`,transition:"transform 0.2s ease"},children:p(Va,{size:22})}),p(ls,{label:"To",token:e.toToken,amount:e.toAmount,usd:as(e.toAmount,e.toToken),onAmountChange:f=>e.setAmount(f,"to"),onTokenClick:()=>o("to"),locked:e.availableToTokens.length<=1}),u.to&&p("div",{className:"bf-field-error",children:u.to})]}),p(Wd,{fromAmount:e.fromAmount,toAmount:e.toAmount,fromToken:e.fromToken,toToken:e.toToken}),l&&p(Kd,{summary:l})]}),y("footer",{className:"bf-footer",children:[p("button",{type:"button",className:"bf-next",onClick:e.submit,disabled:e.status==="submitting"||!!e.quoteError||h,children:e.status==="submitting"?"Processing...":"Next"}),y("a",{className:"bf-powered",href:d,target:"_blank",rel:"noreferrer",children:["Powered by ",p("span",{className:"bf-powered-brand",children:"CROSS DeFi"})]})]}),n&&p(Fd,{flow:e,side:n,onClose:()=>o(null)}),r&&p(Md,{flow:e,onClose:()=>a(!1)}),p(_d,{flow:e}),e.approvalInfo&&p(zd,{flow:e,approval:e.approvalInfo}),p(Dd,{flow:e}),p(Hd,{flow:e}),p(Gd,{message:e.submitToast?"":x}),p($d,{flow:e})]})}function Io({onClose:e,onBackToWallet:t,env:n,className:o,...r}){let a=R.useMemo(()=>Pe(n),[n]),i=os({...r,onExit:t}),s=R.useRef(null),c=bd(s),l=i.step==="history"?"History":"Swap & Bridge";return p(cs.Provider,{value:c,children:y("div",{ref:s,className:Z("bf-root",o),"data-view":i.step,"data-status":i.status,children:[y("header",{className:"bf-header",children:[p("button",{type:"button",className:"bf-header-btn",onClick:i.back,"aria-label":"Back",children:p(an,{size:24})}),p("span",{className:"bf-header-title",children:l}),p("button",{type:"button",className:"bf-header-btn",onClick:e,"aria-label":"Close",children:p(Lt,{size:24})})]}),i.step==="history"?p(Yd,{flow:i}):p(Zd,{flow:i,env:a})]})})}import{Fragment as Eo,jsx as g,jsxs as C}from"react/jsx-runtime";var Jd="On-ramp is not available in your region.";function Er(e,t,n){let o=we[e],r=n.toUpperCase();if(t===o.cross&&r.includes("CROSSD"))return 0;if(t===o.cross&&r==="CROSS")return 1;if(t===o.bsc&&r==="CROSS")return 2}function ep(e){return parseInt(e.split(":")[1],10)}function tp(e){let t=e.lastIndexOf(".");return t===-1?{main:e,decimal:""}:{main:e.slice(0,t),decimal:e.slice(t)}}function np(e){let t=e.toLowerCase().replace(/^0x/,""),n=t.length>=8?t.slice(0,8):t.padEnd(8,"0"),o=parseInt(n.slice(0,4),16)%360,r=(o+60+parseInt(n.slice(4,8),16)%120)%360;return`linear-gradient(135deg, hsl(${o} 85% 65%), hsl(${r} 80% 55%))`}function hs({align:e="end",sideOffset:t=12,className:n,children:o}){let{env:r,theme:a,isMobile:i,open:s,drawerDirection:c,modal:l,showBalance:d,showForgeToken:u,showGameToken:h,showQR:m,showBridge:v,qrLogoSrc:x,walletAddress:w,accountName:k,sendAccounts:E,profileImageUrl:f,preferredTokens:I,close:N,onSelectWallet:P,onCopyAddress:M,onBuy:Y,onDisconnect:_,disconnectLabel:K,termsUrl:z,termsLabel:X,privacyUrl:O,privacyLabel:me,portalStyle:te,navContent:ie,navPosition:je,footerContent:ae,view:H,setView:se,selectedSendToken:ee,setSelectedSendToken:G,showPortfolio:Ve,portfolioTitle:pe,showTotalAssets:Le,totalAssetsLabel:fe,sendTransaction:ut,getTransactionReceipt:ve,estimateGas:Dt,onOutlink:Oe,lpBalanceReader:Rt,stakingRewardsReader:_t,bridgeTokens:le,bridgeHistory:ge,getBridgeQuote:nt,getBridgeToTokens:ye,getBridgeApproval:he,approveBridge:ce,submitBridge:Nt,onReceive:qe,onBridge:Tt,onSend:Ke,onBuyDisabledMessage:ot,onBridgeDisabledMessage:ze,onSendDisabledMessage:ke}=Ht(),[mt,Qe]=B.useState(null),De=B.useRef(void 0),be=B.useCallback(b=>{Qe(b),clearTimeout(De.current),De.current=setTimeout(()=>Qe(null),4e3)},[]);B.useEffect(()=>()=>clearTimeout(De.current),[]);let ne=!!ot,rt=B.useCallback(()=>{if(ne){be(ot);return}let b=Y?.();b&&typeof b.then=="function"&&b.catch(()=>{be(ot??Jd)})},[ne,ot,Y,be]),gt=!!ze,We=!!ke,{tokens:ht,isLoading:it}=jt(r,w,s&&d),{statsMap:He}=Vt(r,d),{apyPercent:Ge}=ta(),{categoryMap:Ue}=na(r,d),S=d&&Le,{displayValue:$,isLowerBound:oe,isLoading:Ye}=oa(r,w,s&&S),[at,It]=B.useState(!1),Jt=B.useRef(null),[Wt,qn]=B.useState(0),{holdings:en,isLoading:F}=Ji(r,w,s&&d&&u),Se=B.useMemo(()=>en.map(b=>b.token),[en]),{imageMap:q}=ea(r,Se,u&&en.length>0),J=B.useMemo(()=>{let b=[],L=[],j=[],Ae=new Map((I??[]).map((Q,Ce)=>[`${ep(Q.chainId)}:${Q.address.toLowerCase()}`,Ce]));for(let Q of ht){let Ce=Er(r,Q.chainId,Q.symbol)!==void 0,bt=`${Q.chainId}:${Q.address.toLowerCase()}`,nn=Ae.get(bt),Qo=new Hn(Q.quantity.numeric).shiftedBy(-Q.quantity.decimals);if(Ce)b.push(Q);else if(nn!==void 0)L.push(Q);else if(Qo.isGreaterThan(0)){if(!h&&Ue.get(wr(Q.chainId,Q.address))==="game")continue;j.push(Q)}}return b.sort((Q,Ce)=>{let bt=Er(r,Q.chainId,Q.symbol)??99,nn=Er(r,Ce.chainId,Ce.symbol)??99;return bt-nn}),L.sort((Q,Ce)=>{let bt=Ae.get(`${Q.chainId}:${Q.address.toLowerCase()}`)??99,nn=Ae.get(`${Ce.chainId}:${Ce.address.toLowerCase()}`)??99;return bt-nn}),j.sort((Q,Ce)=>{let bt=He.get(yt(Q.chainId,Q.address)),nn=He.get(yt(Ce.chainId,Ce.address)),Qo=new Hn(Q.quantity.numeric).shiftedBy(-Q.quantity.decimals).multipliedBy(bt?.price??0);return new Hn(Ce.quantity.numeric).shiftedBy(-Ce.quantity.decimals).multipliedBy(nn?.price??0).minus(Qo).toNumber()}),[...b,...L,...j]},[ht,r,He,h,Ue,I]),Kn=B.useMemo(()=>{if(!u)return[];let b=new Set(ht.map(L=>L.address.toLowerCase()));return[...en].filter(L=>!b.has(L.token.toLowerCase())).sort((L,j)=>{let Ae=new Hn(L.value);return new Hn(j.value).minus(Ae).toNumber()})},[en,u,ht]),tn=B.useRef(!1),[Ee,Ln]=B.useState(null),mn=B.useRef(void 0),_r=Ee?.chainId??ee?.chainId??J[0]?.chainId??0,{transactionUrl:Ho}=ro(r,_r,Ee?.txHash,!!(Ee?.txHash&&_r)),Ze=B.useCallback(b=>{tn.current=!0,se(b)},[se]),[$s,Go]=B.useState("recipient"),Qn=B.useCallback(()=>{G(null),Go("recipient"),Ze("wallet")},[G,Ze]),Uo=B.useCallback((b,L="recipient")=>{if(We){be(ke);return}Go(L),G(b),Ze("send")},[We,ke,be,G,Ze]),js=B.useCallback(()=>{if(gt){be(ze);return}if(Tt){Tt();return}Ze("bridge")},[gt,ze,Tt,Ze,be]),Vs=B.useCallback(b=>{clearTimeout(mn.current),G(null),Ze("wallet"),Ln({status:"pending",txHash:b.txHash,chainId:b.chainId,description:`${b.amount} ${b.tokenSymbol} to ${Je(b.recipient)}`})},[G,Ze]),qs=B.useCallback(b=>{let L=ee?.chainId;G(null),Ze("wallet"),!(!b||!L)&&(Ln(j=>({status:"success",txHash:b,chainId:L,description:j?.txHash===b?j.description:"Tap to see your transaction"})),clearTimeout(mn.current),mn.current=setTimeout(()=>Ln(null),5e3))},[ee?.chainId,G,Ze]),Ks=B.useCallback(b=>{let L=b.txHash;L&&(Ln({status:"error",txHash:L,chainId:b.chainId,description:b.message}),clearTimeout(mn.current),mn.current=setTimeout(()=>Ln(null),5e3))},[]),$o=B.useMemo(()=>{if(qe)return qe;if(m)return()=>Ze("qr")},[qe,m,Ze]),jo=B.useMemo(()=>{if(Ke)return Ke;if(J.length===0)return;let b=J[0];return()=>Uo(b,"token")},[Ke,J,Uo]),Qs=B.useCallback(()=>{if(We){be(ke);return}jo?.()},[We,ke,jo,be]);B.useEffect(()=>{s||(tn.current=!1,Go("recipient"))},[s]);let Or=B.useRef(null);B.useEffect(()=>{let b=Or.current;if(!b||!i)return;let L=j=>{j.pointerType==="touch"&&j.stopPropagation()};return b.addEventListener("pointerdown",L),()=>b.removeEventListener("pointerdown",L)},[i]);let[gn,zr]=B.useState(!1),Vo=B.useRef(void 0),[En,An]=B.useState(!1);B.useEffect(()=>{if(!En)return;let b=()=>An(!1),L=Ae=>{Ae.key==="Escape"&&An(!1)},j=setTimeout(()=>{document.addEventListener("mousedown",b,!0),document.addEventListener("keydown",L,!0)},0);return()=>{clearTimeout(j),document.removeEventListener("mousedown",b,!0),document.removeEventListener("keydown",L,!0)}},[En]),B.useEffect(()=>{An(!1)},[w]),B.useEffect(()=>()=>clearTimeout(Vo.current),[]),B.useEffect(()=>()=>clearTimeout(mn.current),[]),B.useEffect(()=>{let b=Jt.current;if(!b||ae===null){qn(0);return}let L=()=>{qn(b.offsetHeight)};if(L(),typeof ResizeObserver>"u")return;let j=new ResizeObserver(L);return j.observe(b),()=>j.disconnect()},[ae]);let Dr=B.useCallback(async()=>{if(!gn)try{await navigator.clipboard.writeText(w),zr(!0),clearTimeout(Vo.current),Vo.current=setTimeout(()=>zr(!1),2e3),M?.(w,!0)}catch{M?.(w,!1)}},[w,M,gn]),Yn=B.useCallback(b=>{b.currentTarget.setAttribute("data-loaded","true")},[]),Wr=B.useMemo(()=>({background:np(w)}),[w]),Zn=B.useMemo(()=>f||Ot(r,w,{size:120,bg:a==="dark"?"1A1A2E":"F3F6F8"}),[f,r,w,a]),qo=B.useMemo(()=>tp($),[$]),Hr=z||O?C("div",{className:"wi-legal-links",children:[z&&g("a",{className:"wi-legal-link",href:z,target:"_blank",rel:"noopener noreferrer",onClick:b=>et(b,z,{category:"terms",origin:"terms"},Oe),children:X}),z&&O&&g("span",{className:"wi-legal-sep","aria-hidden":!0,children:"\xB7"}),O&&g("a",{className:"wi-legal-link",href:O,target:"_blank",rel:"noopener noreferrer",onClick:b=>et(b,O,{category:"privacy",origin:"privacy"},Oe),children:me})]}):null,Gr=_?C("button",{type:"button",className:"wi-disconnect-btn",onClick:()=>{_(),N()},children:[g(ci,{size:16}),g("span",{className:"wi-disconnect-label",children:K})]}):null,Ys=d&&!ie?C("div",{className:"wi-action-row","aria-label":"Wallet actions",children:[C("button",{type:"button",className:Z("wi-action-card",ne&&"wi-action-card--dimmed"),onClick:rt,disabled:!Y&&!ne,"aria-disabled":ne||void 0,"aria-label":"Buy",children:[g(gi,{size:20}),g("span",{children:"Buy"})]}),v?C("button",{type:"button",className:Z("wi-action-card",gt&&"wi-action-card--dimmed"),onClick:js,"aria-disabled":gt||void 0,"aria-label":"Bridge",children:[g(hi,{size:20}),g("span",{children:"Bridge"})]}):C("button",{type:"button",className:"wi-action-card",onClick:$o,disabled:!$o,"aria-label":"Receive",children:[g(nr,{size:20}),g("span",{children:"Receive"})]}),C("button",{type:"button",className:Z("wi-action-card",We&&"wi-action-card--dimmed"),onClick:Qs,disabled:!We&&!jo,"aria-disabled":We||void 0,"aria-label":"Send",children:[g(ui,{size:20}),g("span",{children:"Send"})]}),C("button",{type:"button",className:"wi-action-card",onClick:()=>Ze("portfolio"),disabled:!Ve,"aria-label":"View portfolio",children:[g(mi,{size:20}),g("span",{children:"Portfolio"})]})]}):null,Zs=C("div",{className:Z("wi-view-inner",tn.current&&"wi-view-wallet"),children:[S&&C("div",{className:"wi-total-section",children:[C("div",{className:"wi-total-head",children:[g("span",{className:"wi-total-label",children:fe}),g("span",{role:"button",tabIndex:0,className:"wi-total-eye",onClick:b=>{b.stopPropagation(),It(L=>!L)},onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),b.stopPropagation(),It(L=>!L))},"aria-label":at?"Show balance":"Hide balance",children:at?g(pi,{}):g(di,{})})]}),g("div",{className:"wi-total-body",children:Ye?g("div",{className:"wi-skeleton-block wi-total-skeleton",style:{width:160,height:42}}):g("div",{className:"wi-total-value","data-hidden":at||void 0,children:at?g("span",{className:"wi-total-mask",children:"\u2022\u2022\u2022\u2022\u2022\u2022"}):C(Eo,{children:[oe&&g("span",{className:"wi-total-lte",children:"\u2264"}),g("span",{className:"wi-total-currency",children:"$"}),g("span",{className:"wi-total-amount",children:qo.main}),qo.decimal&&g("span",{className:"wi-total-decimal",children:qo.decimal})]})})})]}),je==="top"&&(ie?g("div",{className:"wi-nav-fixed",children:ie}):Ys),d&&g("div",{ref:Or,className:"wi-scrollable-body","data-vaul-no-drag":!0,children:C("div",{className:"wi-token-list",children:[it&&Array.from({length:5},(b,L)=>C("div",{className:"wi-skeleton-item",children:[C("div",{className:"wi-skeleton-left",children:[g("div",{className:"wi-skeleton-block wi-skeleton-icon"}),C("div",{className:"wi-skeleton-lines",children:[g("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),g("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),C("div",{className:"wi-skeleton-right",children:[g("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),g("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},L)),!it&&J.length===0&&!u&&g("div",{className:"wi-empty",children:"No Tokens Found"}),J.map(b=>{let L=He.get(yt(b.chainId,b.address)),j=L?parseFloat(L.percent_change_24h):null,Ae=j!==null&&j>=0,Q=On(r,b.chainId),Ce=b.chainId===we[r].cross&&b.symbol.toUpperCase().includes("CROSSD");return C("button",{type:"button",className:"wi-token-item wi-token-item--button",onClick:()=>Uo(b),"aria-label":`Send ${b.symbol}`,children:[C("div",{className:"wi-token-left",children:[C("div",{className:"wi-token-icon-wrap",children:[g("img",{src:b.icon_url,alt:b.symbol,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:Yn,onError:bt=>{bt.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),Q&&g("img",{src:Q,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:bt=>{bt.currentTarget.style.display="none"}})]}),C("div",{className:"wi-token-info",children:[C("span",{className:"wi-token-name-row",children:[g("span",{className:"wi-token-name",children:b.symbol}),Ce&&Ge!==null&&g("span",{className:"wi-token-apy",children:`APY ${Ge>=0?"+":"-"}${(Ge>=0?Math.floor:Math.ceil)(Math.abs(Ge)*100)/100}%`})]}),L&&C("div",{className:"wi-token-price-row",children:[g("span",{className:"wi-token-price",children:or(L.price)}),g("span",{className:"wi-token-change","data-positive":Ae,"data-zero":j===0||void 0,children:j!==null&&(j===0?"0%":`${Ae?"+":"-"}${(Ae?Math.floor:Math.ceil)(Math.abs(j)*100)/100}%`)})]})]})]}),C("div",{className:"wi-token-right",children:[g("span",{className:"wi-token-balance",children:Gt(b.quantity.numeric,b.quantity.decimals)}),L&&g("span",{className:"wi-token-value",children:wi(b.quantity.numeric,b.quantity.decimals,L.price)})]})]},`${b.address}-${b.chainId}`)}),u&&F&&Array.from({length:3},(b,L)=>C("div",{className:"wi-skeleton-item",children:[C("div",{className:"wi-skeleton-left",children:[g("div",{className:"wi-skeleton-block wi-skeleton-icon"}),C("div",{className:"wi-skeleton-lines",children:[g("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),g("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),C("div",{className:"wi-skeleton-right",children:[g("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),g("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},`forge-sk-${L}`)),u&&!F&&!it&&J.length===0&&Kn.length===0&&g("div",{className:"wi-empty",children:"No Tokens Found"}),u&&Kn.map(b=>{let L=q.get(b.token)||"",j=On(r,we[r].cross);return C("div",{className:"wi-token-item",children:[C("div",{className:"wi-token-left",children:[C("div",{className:"wi-token-icon-wrap",children:[g("img",{src:L||"https://contents.crosstoken.io/wallet/token/images/FT.png",alt:b.token_name,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:Yn,onError:Ae=>{Ae.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),j&&g("img",{src:j,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:Ae=>{Ae.currentTarget.style.display="none"}})]}),C("div",{className:"wi-token-info",children:[g("span",{className:"wi-token-name",children:b.token_name}),g("div",{className:"wi-token-price-row",children:C("span",{className:"wi-token-price",children:[Gt(b.current_price,18)," CROSS"]})})]})]}),C("div",{className:"wi-token-right",children:[g("span",{className:"wi-token-balance",children:Gt(b.balance,18)}),g("span",{className:"wi-token-value",children:or(b.current_value_usd)})]})]},`forge-${b.token}`)})]})}),je==="bottom"&&ie&&g("div",{className:"wi-nav-fixed",children:ie}),Gr&&g("div",{className:"wi-wallet-disconnect-row",children:Gr})]},"wallet"),Xs=Ve?g("div",{className:Z("wi-view-inner wi-portfolio-body",tn.current&&"wi-view-portfolio"),children:g(Rn,{env:r,theme:a,walletAddress:w,showHeader:!1,onOutlink:Oe,lpBalanceReader:Rt,stakingRewardsReader:_t})},"portfolio"):null,Js=ee?g("div",{className:Z("wi-view-inner wi-send-body",tn.current&&"wi-view-send"),children:g(bo,{env:r,theme:a,walletAddress:w,accountName:k,accounts:E,initialStep:$s,token:ee,tokens:J,onTokenChange:G,sendTransaction:ut,getTransactionReceipt:ve,estimateGas:Dt,getTokenPriceUsd:b=>{let L=He.get(yt(b.chainId,b.address));if(!L?.price)return;let j=parseFloat(L.price);return Number.isFinite(j)?j:void 0},onClose:N,onBackToWallet:Qn,onSubmitted:Vs,onSuccess:qs,onFailed:Ks,onOutlink:Oe})},"send"):null,el=B.useMemo(()=>le||J.map(b=>{let L=He.get(yt(b.chainId,b.address)),j=L?.price?parseFloat(L.price):void 0;return{name:b.name,symbol:b.symbol,chainId:b.chainId,address:b.address,decimals:b.quantity.decimals,balance:lr(b.quantity.numeric,b.quantity.decimals),iconUrl:b.icon_url,priceUsd:Number.isFinite(j)?j:void 0}}),[le,He,J]),tl=g("div",{className:Z("wi-view-inner wi-bridge-body",tn.current&&"wi-view-send"),children:g(Io,{env:r,walletAddress:w,tokens:el,history:ge,termsUrl:z,getQuote:nt,getToTokens:ye,getApproval:he,approveBridge:ce,submitBridge:Nt,onClose:N,onBackToWallet:Qn})},"bridge"),Ko=!!P&&k?.trim().toLowerCase()!=="my wallet",Ur=C(Eo,{children:[C("span",{className:"wi-receive-avatar",children:[g("span",{className:"wi-avatar-fallback",style:Wr}),Zn&&g("img",{src:Zn,alt:"",className:"wi-avatar-img",width:24,height:24,draggable:!1,onLoad:Yn,onError:b=>{b.currentTarget.style.display="none"}})]}),g("span",{className:"wi-receive-account-name",children:k??"Account 1"}),Ko&&g("span",{className:"wi-receive-chevron","data-open":En,"aria-hidden":"true",children:g(sn,{size:16})})]}),nl=C("div",{className:Z("wi-view-inner wi-qr-body",tn.current&&"wi-view-qr"),children:[C("div",{className:"wi-receive-section",children:[Ko?g("button",{type:"button",className:"wi-receive-account wi-receive-account--btn",onClick:()=>{An(!0),P?.()},"aria-label":"Switch account",children:Ur}):g("div",{className:"wi-receive-account",children:Ur}),C("div",{className:"wi-qr-block",children:[C("div",{className:"wi-qr-box",children:[g(Xd,{value:w,size:180,level:"H",marginSize:2,...x&&{imageSettings:{src:x,height:33,width:33,excavate:!0}}}),!x&&g("div",{className:"wi-qr-logo",children:g(fi,{size:33})})]}),g("p",{className:"wi-qr-address",children:w})]}),C("button",{type:"button",className:"wi-qr-copy-btn",onClick:Dr,children:[g("span",{className:"wi-qr-copy-icon",children:gn?g(rn,{size:16}):g(Bn,{size:16})}),g("span",{className:"wi-qr-copy-text",children:gn?"Copied!":"Copy address"})]})]}),Hr&&g("div",{className:"wi-receive-footer",children:Hr})]},"qr"),ol=H==="qr"||H==="portfolio"||H==="send"||H==="bridge",$r=ae!==null?g("div",{className:"wi-builtin-footer",children:ae}):null,jr=C("div",{className:"wi-account-text",children:[Ko?C("button",{type:"button",className:"wi-account-row wi-account-row--btn",onClick:()=>{An(!0),P?.()},"aria-label":"Switch account","aria-expanded":En,children:[g("span",{className:"wi-account-name",children:k??"Account 1"}),g("span",{className:"wi-account-switch","data-open":En,"aria-hidden":"true",children:g(sn,{size:20})})]}):g("div",{className:"wi-account-row",children:g("span",{className:"wi-account-name",children:k??"Account 1"})}),C("button",{type:"button",className:"wi-address-row-btn",onClick:Dr,"aria-label":"Copy address",children:[g("span",{className:"wi-account-address",children:Je(w)}),g("span",{className:"wi-account-copy","data-copied":gn,children:gn?g(rn,{size:12}):g(Bn,{size:12})})]})]}),Vr=C(Eo,{children:[o,H==="qr"?g("div",{className:"wi-sticky-header",children:C("div",{className:"wi-header wi-header--receive",children:[g("button",{type:"button",className:"wi-header-back",onClick:Qn,"aria-label":"Back",children:g(an,{size:24})}),g("span",{className:"wi-receive-title",children:"Receive"}),g("button",{type:"button",className:"wi-header-action",onClick:N,"aria-label":"Close",children:g(Lt,{size:24})})]})}):H==="send"||H==="bridge"?null:ol?C("div",{className:"wi-sticky-header",children:[C("div",{className:"wi-header wi-header--wallet wi-header--sub-account",children:[g("button",{type:"button",className:"wi-header-back",onClick:Qn,"aria-label":"Back",children:g(an,{size:24})}),g("div",{className:"wi-account-block wi-account-block--sub-account",children:jr}),g("button",{type:"button",className:"wi-header-action",onClick:N,"aria-label":"Close",children:g(Lt,{size:24})})]}),g("hr",{className:"wi-divider"})]}):C("div",{className:"wi-sticky-header",children:[C("div",{className:"wi-header wi-header--wallet",children:[C("div",{className:"wi-account-block",children:[C("div",{className:"wi-avatar",children:[g("div",{className:"wi-avatar-fallback",style:Wr}),Zn&&g("img",{src:Zn,alt:"",className:"wi-avatar-img",width:28,height:28,draggable:!1,onLoad:Yn,onError:b=>{b.currentTarget.style.display="none"}})]}),jr]}),C("div",{className:"wi-header-actions",children:[m&&v&&g("button",{type:"button",className:"wi-header-action wi-header-action--qr",onClick:$o,"aria-label":"Show QR code",children:g(nr,{size:20})}),g("button",{type:"button",className:"wi-header-action",onClick:N,"aria-label":"Close",children:g(Lt,{size:24})})]})]}),g("hr",{className:"wi-divider"})]}),C("div",{className:"wi-view-container",children:[H==="wallet"&&Zs,H==="qr"&&nl,H==="portfolio"&&Xs,H==="send"&&Js,H==="bridge"&&tl]}),H==="wallet"&&mt&&g("div",{className:"wi-action-toast",role:"status","aria-live":"polite",children:mt}),H==="wallet"&&Ee&&C("a",{className:"wi-send-toast",href:Ho??"#",target:"_blank",rel:"noopener noreferrer",onClick:b=>{if(!Ho){b.preventDefault();return}et(b,Ho,{category:"send",origin:"send-transaction",payload:{chainId:Ee.chainId,txHash:Ee.txHash}},Oe)},children:[g("span",{className:"wi-send-toast-icon","data-status":Ee.status,"aria-hidden":!0,children:Ee.status==="pending"?g("span",{className:"wi-send-toast-spinner"}):Ee.status==="error"?g("span",{className:"wi-send-toast-error-dot"}):g(bi,{size:20})}),C("span",{className:"wi-send-toast-copy",children:[g("span",{className:"wi-send-toast-title",children:Ee.status==="pending"?"Sending...":Ee.status==="error"?"Send failed":"Send complete"}),g("span",{className:"wi-send-toast-desc",children:Ee.status==="pending"||Ee.status==="error"?Ee.description:"Tap to see your transaction"})]})]}),$r&&H!=="portfolio"&&H!=="send"&&g("div",{className:"wi-sticky-footer",children:g("div",{className:"wi-footer",ref:Jt,children:$r})})]}),qr={...te,...Wt>0?{"--wi-footer-height":`${Wt}px`}:null};return i?C(Lo.Portal,{children:[l&&g(Lo.Overlay,{className:"wi-drawer-overlay"}),C(Lo.Content,{className:Z("wi-drawer-content",n),"data-theme":a,"data-vaul-no-drag":c==="left"||c==="right"?!0:void 0,style:qr,"data-direction":c,"data-no-balance":!d||void 0,"data-has-footer":Wt>0||void 0,"data-view":H,children:[g(Lo.Title,{className:"wi-sr-only",children:"My Wallet"}),Vr]})]}):C(Eo,{children:[l&&s&&g("div",{className:"wi-drawer-overlay",onClick:N}),g(Ao.Portal,{children:g(Ao.Content,{align:e,sideOffset:t,className:Z("wi-popover-content",n),"data-theme":a,style:qr,"data-no-balance":!d||void 0,"data-has-footer":Wt>0||void 0,"data-view":H,children:Vr})})]})}import*as bs from"react";function ws({position:e="top",children:t}){let{setNavContent:n,setNavPosition:o}=Ht();return bs.useEffect(()=>(n(t),o(e),()=>n(null)),[t,e,n,o]),null}import*as xs from"react";function vs({children:e}){let{setFooterContent:t}=Ht();return xs.useEffect(()=>(t(e),()=>t(null)),[e,t]),null}D(`[data-theme=dark].wi-popover-content,[data-theme=dark].wi-drawer-content{--wi-primary: var(--ds-accent-primary-default, #019d92);--wi-secondary: var(--ds-system-red-default, #e70077);--wi-surface-bg: var(--ds-bg-default, #121212);--wi-surface-default: var(--ds-surface-medium, rgba(255, 255, 255, .05));--wi-surface-subtle: var(--ds-surface-high, rgba(255, 255, 255, .1));--wi-border-default: var(--ds-border-default, rgba(255, 255, 255, .05));--wi-border-subtle: var(--ds-border-medium, rgba(255, 255, 255, .1));--wi-texticon-primary: var(--ds-content-highest, #ffffff);--wi-texticon-secondary: var(--ds-content-medium, rgba(255, 255, 255, .7));--wi-texticon-tertiary: var(--ds-content-low, rgba(255, 255, 255, .5));--wi-on-primary: var(--ds-accent-primary-on, #ffffff);--wi-error: var(--ds-system-red-default, #e70077);--wi-shadow: 0 2px 16px -2px rgba(0, 0, 0, .4)}[data-theme=light].wi-popover-content,[data-theme=light].wi-drawer-content{--wi-primary: var(--ds-accent-primary-default, #019d92);--wi-secondary: var(--ds-system-red-default, #e70077);--wi-surface-bg: var(--ds-bg-default, #ffffff);--wi-surface-default: var(--ds-surface-medium, rgba(18, 18, 18, .05));--wi-surface-subtle: var(--ds-surface-high, rgba(18, 18, 18, .1));--wi-border-default: var(--ds-border-default, rgba(18, 18, 18, .05));--wi-border-subtle: var(--ds-border-medium, rgba(18, 18, 18, .1));--wi-texticon-primary: var(--ds-content-highest, #121212);--wi-texticon-secondary: var(--ds-content-medium, rgba(18, 18, 18, .7));--wi-texticon-tertiary: var(--ds-content-low, rgba(18, 18, 18, .5));--wi-on-primary: var(--ds-accent-primary-on, #ffffff);--wi-error: var(--ds-system-red-default, #e70077);--wi-shadow: 0 2px 16px -2px rgba(0, 0, 0, .15)}
11
+ `);D(`.wi-trigger-btn{display:inline-flex;align-items:center;gap:8px;padding:8px 16px;border:1px solid rgba(255,255,255,.2);background:#1a2332;border-radius:9999px;cursor:pointer;color:#fff;font-family:inherit;font-size:16px;font-weight:500;line-height:24px;letter-spacing:-.3125px;transition:opacity .15s ease}.wi-trigger-btn:hover{opacity:.85}.wi-trigger-btn[data-theme=light]{background:#f3f6f8;border-color:#1212121a;color:#121212}.wi-trigger-btn[data-mobile]{font-size:14px;padding:6px 12px;gap:6px;line-height:20px}.wi-trigger-address{white-space:nowrap}.wi-divider{height:1px;background:var(--wi-border-default);margin:0;border:none;flex-shrink:0}[data-theme=light] .wi-divider{background:#1212121a}[data-theme=dark] .wi-divider{background:#ffffff1a}
12
+ `);D(`@keyframes wi-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@keyframes wi-shimmer{0%{transform:translate(-100%)}to{transform:translate(100%)}}@keyframes wi-slide-in-right{0%{transform:translate(40px);opacity:0}to{transform:translate(0);opacity:1}}@keyframes wi-slide-in-left{0%{transform:translate(-40px);opacity:0}to{transform:translate(0);opacity:1}}
13
+ `);D(`.wi-popover-content{-webkit-font-smoothing:antialiased;z-index:100001;width:393px;border-radius:24px;border:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));background:var(--wi-surface-bg);box-shadow:var(--ds-shadow-modal, var(--wi-shadow));animation:wi-fade-in .15s ease-out;height:600px;overflow:hidden;display:flex;flex-direction:column}.wi-popover-content[data-no-balance]{height:auto}.wi-popover-content[data-has-footer]:not([data-no-balance]){height:min(calc(600px + var(--wi-footer-height, 0px)),calc(100dvh - 32px))}.wi-drawer-overlay{position:fixed;inset:0;z-index:100000;background:#0009}.wi-drawer-content{-webkit-font-smoothing:antialiased;position:fixed;top:0;right:0;bottom:0;z-index:100001;width:100vw;max-height:100vh;background:var(--wi-surface-bg);overflow:hidden;display:flex;flex-direction:column;box-sizing:border-box}.wi-drawer-content[data-no-balance]{bottom:auto;max-height:none}.wi-drawer-content[data-no-balance][data-direction=bottom]{bottom:0;top:auto;border-radius:24px 24px 0 0}.wi-drawer-content[data-direction=left]{right:auto;left:0}.wi-drawer-content[data-direction=bottom]{top:0;left:0;right:0;width:100%;max-height:100dvh;margin:0 auto}.wi-drawer-content[data-direction=bottom][data-view=qr]{max-height:100dvh}.wi-popover-content[data-view=qr]{max-height:calc(100dvh - 32px)}.wi-sticky-header{flex-shrink:0;position:relative}.wi-header{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:24px}.wi-header--wallet{align-items:flex-start;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.wi-header--wallet+.wi-divider{display:none}.wi-header--sub-account{align-items:center}.wi-header--sub-account .wi-header-back{width:32px;height:38px}.wi-header--sub-account .wi-header-action{flex-shrink:0}.wi-account-block{display:flex;align-items:center;gap:8px;flex:1;min-width:0}.wi-account-block--sub-account{align-items:center}.wi-avatar{flex-shrink:0;position:relative;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border-radius:50%;background:var(--wi-surface-bg);box-sizing:border-box;overflow:hidden}.wi-avatar-fallback{position:absolute;inset:0;border-radius:50%;z-index:0}.wi-avatar-img{position:relative;z-index:1;width:32px;height:32px;border-radius:50%;object-fit:cover;background:transparent}.wi-account-text{display:flex;flex-direction:column;gap:2px;min-width:0}.wi-account-row{display:flex;align-items:center;gap:8px;min-width:0}.wi-account-row--btn{padding:2px;margin:0;width:fit-content;border:none;background:transparent;cursor:pointer;color:inherit;font:inherit;border-radius:6px;transition:background-color .15s ease,opacity .15s ease}.wi-account-row--btn:hover{background:var(--wi-surface-subtle, rgba(255, 255, 255, .06))}.wi-account-row--btn:focus-visible{outline:2px solid var(--wi-primary, #00d5aa);outline-offset:2px}.wi-account-name{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wi-account-switch{display:inline-flex;align-items:center;justify-content:center;padding:2px 0;border:none;background:transparent;color:var(--ds-content-low, rgba(0, 0, 0, .4));border-radius:4px;flex-shrink:0;transition:color .15s ease,transform .2s ease}.wi-account-switch[data-open=true]{transform:rotate(180deg)}.wi-account-row--btn:hover .wi-account-switch{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-address-row-btn{display:inline-flex;align-items:center;gap:4px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--ds-content-medium, rgba(0, 0, 0, .65));font:inherit;text-align:left;min-width:0;transition:color .15s ease}.wi-address-row-btn:hover .wi-account-address,.wi-address-row-btn:hover .wi-account-copy{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-account-address{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:12px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wi-account-copy{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;color:var(--wi-texticon-tertiary);flex-shrink:0;transition:color .15s ease}.wi-account-copy[data-copied=true]{color:var(--ds-system-green-high, #00a869)}.wi-header-actions{display:flex;align-items:center;gap:16px;flex-shrink:0;margin-top:-4px}.wi-header-action{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;background:transparent;border-radius:0;cursor:pointer;color:var(--ds-content-low, rgba(0, 0, 0, .4));flex-shrink:0;transition:color .15s ease}.wi-header-action:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-header-action--qr{width:32px;height:32px;border-radius:8px;background:var(--ds-surface-medium, #f5f7fa);color:var(--ds-content-medium, rgba(0, 0, 0, .65));transition:background-color .15s ease,color .15s ease}.wi-header-action--qr:hover{background:var(--ds-surface-high, rgba(0, 0, 0, .08));color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-header--receive{align-items:center;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.wi-header--receive .wi-header-action,.wi-header--sub-account .wi-header-action{position:absolute;top:24px;right:24px}.wi-receive-title{position:absolute;left:50%;transform:translate(-50%);font-family:inherit;font-size:18px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);text-align:center;pointer-events:none}.wi-header-info{flex:1;display:flex;flex-direction:column;gap:8px;min-width:0}.wi-header-title{font-family:inherit;font-size:16px;font-weight:600;line-height:1.3;color:var(--wi-texticon-primary);margin:0}.wi-header-close{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;padding:0;border:none;background:var(--wi-surface-default);border-radius:8px;cursor:pointer;color:var(--ds-content-low, #00000066);transition:opacity .15s ease}.wi-header-close:hover{opacity:.7}.wi-total-section{margin:24px 24px 0;padding:0;flex-shrink:0;display:flex;flex-direction:column;gap:8px;border:none;background:transparent;border-radius:12px;color:inherit;font:inherit;text-align:left;width:auto}.wi-action-row{display:flex;align-items:flex-start;gap:8px;width:auto;margin:24px 24px 0}.wi-action-card{appearance:none;display:flex;flex:1 1 0;min-width:0;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:10px 8px;border:none;border-radius:12px;background:var(--ds-surface-medium, #f5f7fa);color:var(--ds-content-high, rgba(0, 0, 0, .85));font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;text-align:center;cursor:pointer;transition:background-color .15s ease,color .15s ease}.wi-action-card:hover:not(:disabled){background:#2e3544!important;color:var(--ds-content-high, rgba(0, 0, 0, .85))}:root[data-ds-theme=light] .wi-action-card:hover:not(:disabled){background:#e4e8ef!important;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-action-card:disabled{cursor:default}.wi-action-card>svg{flex-shrink:0}.wi-action-card:not(:disabled){transition:background-color .15s ease,transform .1s ease}.wi-action-card:active:not(:disabled){transform:scale(.93)}.wi-total-head{display:flex;align-items:center;gap:4px}.wi-total-body{display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0}.wi-total-label{font-family:inherit;font-size:14px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.wi-total-eye{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;color:var(--ds-content-low, rgba(0, 0, 0, .4));cursor:pointer;transition:color .15s ease;border-radius:4px}.wi-total-eye:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-total-eye:focus-visible{outline:1px solid var(--wi-texticon-secondary);outline-offset:2px}.wi-total-value{display:flex;align-items:baseline;gap:0;font-family:inherit;font-weight:600;line-height:1.25;color:var(--ds-content-highest, #000000);font-variant-numeric:tabular-nums;min-height:45px;white-space:nowrap}.wi-total-currency,.wi-total-amount,.wi-total-decimal{font-size:36px;color:var(--ds-content-highest, #000000)}.wi-total-lte{margin-right:2px;font-weight:500;font-size:22px;color:var(--wi-texticon-secondary)}.wi-total-mask{letter-spacing:2px;font-size:32px;color:var(--wi-texticon-secondary)}.wi-total-skeleton{border-radius:6px}.wi-scrollable-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;padding:8px 0 0;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.15) transparent;overscroll-behavior:contain}.wi-drawer-content .wi-scrollable-body{touch-action:pan-y}[data-theme=light] .wi-scrollable-body{scrollbar-color:rgba(0,0,0,.12) transparent}.wi-scrollable-body::-webkit-scrollbar{width:4px}.wi-scrollable-body::-webkit-scrollbar-track{background:transparent}.wi-scrollable-body::-webkit-scrollbar-thumb{background:#ffffff26;border-radius:4px}.wi-scrollable-body::-webkit-scrollbar-thumb:hover{background:#ffffff40}[data-theme=light] .wi-scrollable-body::-webkit-scrollbar-thumb{background:#0000001f}[data-theme=light] .wi-scrollable-body::-webkit-scrollbar-thumb:hover{background:#0003}.wi-nav-fixed{flex-shrink:0;padding:0 24px}.wi-token-list{display:flex;flex-direction:column;gap:0;padding:8px 0}.wi-token-item{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px 24px;border:none;background:transparent;text-align:left;font-family:inherit;width:100%;box-sizing:border-box}.wi-token-item--button{cursor:pointer;background:var(--ds-surface-default, #ffffff);transition:none}.wi-token-item--button:hover{background:#252b39!important}:root[data-ds-theme=light] .wi-token-item--button:hover{background:#eff3f8!important}button.wi-token-item:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px;border-radius:4px}.wi-token-left{display:flex;align-items:center;gap:16px;min-width:0}.wi-token-icon-wrap{position:relative;width:40px;height:40px;flex-shrink:0}.wi-token-icon{width:40px;height:40px;border-radius:0;object-fit:contain;opacity:0;transition:opacity .2s ease}.wi-token-icon[data-loaded=true]{opacity:1}.wi-token-chain-badge{position:absolute;right:0;bottom:0;width:14px;height:14px;border-radius:50%;background:var(--wi-surface-bg);box-shadow:0 0 0 1.5px var(--wi-surface-bg);object-fit:contain}.wi-token-info{display:flex;flex-direction:column;min-width:0}.wi-token-name-row{display:flex;align-items:center;gap:6px;min-width:0}.wi-token-name{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.wi-token-apy{flex-shrink:0;font-family:inherit;font-size:12px;font-weight:600;line-height:1;color:var(--ds-system-purple-high, #9b78ff);background:var(--ds-system-purple-low, #2e2854);padding:4px;border-radius:6px;white-space:nowrap}.wi-token-price-row{display:flex;align-items:center;gap:8px}.wi-token-price{font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4));white-space:nowrap}.wi-token-change{font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;white-space:nowrap}.wi-token-change[data-positive=true]{color:var(--ds-system-green-high, #00a0a2)}.wi-token-change[data-positive=false]{color:var(--ds-system-red-high, #a80927)}.wi-token-change[data-zero]{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.wi-token-right{display:flex;flex-direction:column;align-items:flex-end;flex-shrink:0}.wi-token-balance{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);white-space:nowrap}.wi-token-value{font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4));white-space:nowrap}.wi-sticky-footer{flex-shrink:0}.wi-footer{padding:16px 24px 24px}.wi-builtin-footer{display:flex;flex-direction:column;gap:8px;align-items:stretch}.wi-wallet-disconnect-row{display:flex;justify-content:flex-end;flex-shrink:0;padding:16px 24px;border-top:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.wi-send-toast{position:absolute;left:15px;right:15px;bottom:20px;z-index:2;display:flex;align-items:center;gap:12px;min-height:52px;padding:12px;border-radius:12px;background:var(--ds-surface-inverted, #1e232e);color:var(--ds-content-inverted, #ffffff);box-sizing:border-box;text-decoration:none}.wi-action-toast{position:absolute;left:15px;right:15px;bottom:20px;z-index:3;padding:12px 14px;border-radius:12px;background:var(--ds-surface-inverted, #1e232e);color:var(--ds-content-inverted, #ffffff);font-size:14px;line-height:1.4;text-align:center;box-sizing:border-box;animation:wi-action-toast-in .18s ease-out}.wi-popover-content:has(.wi-wallet-disconnect-row) .wi-action-toast,.wi-drawer-content:has(.wi-wallet-disconnect-row) .wi-action-toast{bottom:72px}@keyframes wi-action-toast-in{0%{transform:translateY(8px);opacity:0}to{transform:translateY(0);opacity:1}}.wi-action-card--dimmed{opacity:.4;cursor:pointer}.wi-action-card--dimmed:hover{opacity:.5}.wi-popover-content:has(.wi-wallet-disconnect-row) .wi-send-toast,.wi-drawer-content:has(.wi-wallet-disconnect-row) .wi-send-toast{bottom:72px}.wi-send-toast:hover{opacity:.92}.wi-send-toast-icon{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;flex-shrink:0;color:var(--ds-accent-primary-default, #00b4b7)}.wi-send-toast-spinner{width:18px;height:18px;border:2px solid rgba(0,232,201,.22);border-top-color:var(--ds-accent-primary-on-inverted, #00e8c9);border-radius:50%;animation:wi-send-toast-spin .8s linear infinite}.wi-send-toast-error-dot{width:18px;height:18px;border-radius:50%;background:var(--ds-system-red-default, #ff3358)}@keyframes wi-send-toast-spin{to{transform:rotate(360deg)}}.wi-send-toast-copy{display:flex;min-width:0;flex-direction:column}.wi-send-toast-title{font-family:inherit;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-inverted, #ffffff)}.wi-send-toast-desc{font-family:inherit;font-size:12px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-accent-primary-on-inverted, #00e8c9)}.wi-send-toast-icon[data-status=error]+.wi-send-toast-copy .wi-send-toast-desc{color:var(--ds-system-red-default, #ff3358)}.wi-disconnect-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:16px;padding:0;border:none;background:transparent;color:var(--ds-content-low, rgba(0, 0, 0, .4));font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;cursor:pointer;transition:color .15s ease}.wi-disconnect-btn:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-disconnect-label{white-space:nowrap}.wi-legal-links{display:inline-flex;align-items:center;justify-content:center;gap:6px;width:100%;flex-shrink:0;font-family:inherit;font-size:14px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.wi-receive-avatar .wi-avatar-fallback{position:absolute;inset:0;border-radius:50%;z-index:0}.wi-receive-avatar .wi-avatar-img{width:24px;height:24px}.wi-legal-link{color:var(--ds-content-low, rgba(0, 0, 0, .4));text-decoration:underline;text-underline-offset:2px;transition:color .15s ease}.wi-legal-link:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-legal-sep{color:inherit}.wi-empty{display:flex;align-items:center;justify-content:center;padding:32px 0;font-family:inherit;font-size:16px;color:var(--wi-texticon-secondary)}.wi-skeleton-item{display:flex;align-items:center;justify-content:space-between;padding:4px 0}.wi-skeleton-left{display:flex;align-items:center;gap:12px}.wi-skeleton-block{border-radius:6px;background:var(--wi-border-default);position:relative;overflow:hidden}.wi-skeleton-block:after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,.06) 50%,transparent 100%);animation:wi-shimmer 1.5s ease-in-out infinite}[data-theme=light] .wi-skeleton-block:after{background:linear-gradient(90deg,transparent 0%,rgba(0,0,0,.04) 50%,transparent 100%)}.wi-skeleton-icon{width:32px;height:32px;border-radius:50%;flex-shrink:0}.wi-skeleton-lines{display:flex;flex-direction:column;gap:6px}.wi-skeleton-right{display:flex;flex-direction:column;align-items:flex-end;gap:6px}.wi-header-back{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--ds-content-low, rgba(0, 0, 0, .4));flex-shrink:0;transition:color .15s ease}.wi-header-back:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-view-container{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.wi-popover-content[data-view=qr] .wi-view-container,.wi-drawer-content[data-view=qr] .wi-view-container{flex:1;min-height:0}.wi-view-inner{display:flex;flex-direction:column;flex:1;min-height:0}.wi-view-wallet{animation:wi-slide-in-left .25s ease-out}.wi-view-qr,.wi-view-portfolio{animation:wi-slide-in-right .25s ease-out}.wi-qr-body{flex:1;min-height:0;display:flex;flex-direction:column}.wi-portfolio-body{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.wi-portfolio-body>.wp-embed{flex:1;min-height:0}.wi-portfolio-body .wp-body-inner{padding:16px 16px 32px;gap:32px}.wi-receive-section{flex:1;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;padding:24px}.wi-receive-account{display:inline-flex;align-items:center;gap:8px;padding:4px 8px 4px 4px;border:0;background:var(--ds-surface-high, #edf1f2);border-radius:9999px;font-family:inherit;color:inherit}.wi-receive-account--btn{cursor:pointer;transition:none}.wi-receive-account--btn:hover{background:#2e3544}:root[data-ds-theme=light] .wi-receive-account--btn:hover{background:#e4e8ef}.wi-receive-avatar{position:relative;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:50%;overflow:hidden;flex-shrink:0}.wi-receive-account-name{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.wi-receive-account>svg{color:var(--ds-content-medium, rgba(0, 0, 0, .65));flex-shrink:0}.wi-receive-chevron{display:inline-flex;align-items:center;color:var(--ds-content-medium, rgba(0, 0, 0, .65));flex-shrink:0;transition:transform .2s ease}.wi-receive-chevron[data-open=true]{transform:rotate(180deg)}.wi-qr-block{display:flex;flex-direction:column;align-items:center;gap:16px}.wi-qr-box{position:relative;display:flex;align-items:center;justify-content:center;padding:10px;background:#fff;border-radius:6px;overflow:hidden}.wi-qr-logo{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);pointer-events:none}.wi-qr-address{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:16px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65));text-align:center;word-break:break-all;max-width:281px;margin:0}.wi-qr-copy-btn{display:inline-flex;align-items:center;justify-content:center;gap:9px;padding:12px 16px;border:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));background:var(--ds-surface-default, #ffffff);border-radius:12px;cursor:pointer;transition:border-color .15s ease}.wi-qr-copy-btn:hover{border-color:var(--ds-border-medium, rgba(0, 0, 0, .18))}.wi-qr-copy-icon{display:inline-flex;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-qr-copy-text{font-family:inherit;font-size:16px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.wi-receive-footer{flex-shrink:0;display:flex;align-items:center;justify-content:center;padding:16px 24px;border-top:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.wi-drawer-content .wi-header{padding:16px}.wi-drawer-content .wi-header--receive .wi-header-action,.wi-drawer-content .wi-header--sub-account .wi-header-action{top:16px;right:16px}.wi-drawer-content .wi-total-section,.wi-drawer-content .wi-action-row{margin:16px 16px 0}.wi-drawer-content .wi-nav-fixed{padding:0 16px}.wi-drawer-content .wi-token-item{padding:12px 16px}.wi-drawer-content .wi-wallet-disconnect-row{padding:16px}
14
+ `);D(`.wi-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}
15
+ `);import{jsx as Ar}from"react/jsx-runtime";var rp="https://terms.crosstoken.io/docs/cross-terms-of-use",ip="https://terms.crosstoken.io/docs/nexus-privacy-policy";function ap({env:e,theme:t="dark",mobileBreakpoint:n=768,drawerDirection:o,modal:r,showBalance:a=!1,showForgeToken:i=!1,showGameToken:s=!0,showQR:c=!0,showBridge:l=!0,qrLogoSrc:d,walletAddress:u,accountName:h,sendAccounts:m,profileImageUrl:v,connectorId:x,connectorName:w,connectorIconUrl:k,preferredTokens:E=[],onSelectWallet:f,onCopyAddress:I,onBuy:N,onBuyDisabledMessage:P,onBridgeDisabledMessage:M,onSendDisabledMessage:Y,onDisconnect:_,disconnectLabel:K="Disconnect",termsUrl:z=rp,termsLabel:X="Terms of Service",privacyUrl:O=ip,privacyLabel:me="Privacy Policy",open:te,onOpenChange:ie,showPortfolio:je=!1,portfolioTitle:ae="My Portfolio",showTotalAssets:H=!0,totalAssetsLabel:se="Total Assets USD",sendTransaction:ee,getTransactionReceipt:G,estimateGas:Ve,onOutlink:pe,lpBalanceReader:Le,stakingRewardsReader:fe,bridgeTokens:ut,bridgeHistory:ve,getBridgeQuote:Dt,getBridgeToTokens:Oe,getBridgeApproval:Rt,approveBridge:_t,submitBridge:le,onReceive:ge,onBridge:nt,onSend:ye,style:he,children:ce}){let Nt=Pe(e),qe=x?oo[x]:void 0,Tt=w??qe?.name,Ke=k??qe?.iconUrl,ot=hn(`(max-width: ${n}px)`),ze=o??(a?"right":"bottom"),ke=ze==="left"||ze==="right",mt=r??!1,Qe=te!==void 0,[De,be]=_e.useState(!1),ne=Qe?te:De,rt=_e.useCallback(Jt=>{Qe||be(Jt),ie?.(Jt)},[Qe,ie]),gt=_e.useCallback(()=>rt(!1),[rt]),[We,ht]=_e.useState(null),[it,He]=_e.useState("top"),[Ge,Ue]=_e.useState(null),[S,$]=_e.useState("wallet"),[oe,Ye]=_e.useState(null);_e.useEffect(()=>{ne||($("wallet"),Ye(null))},[ne]);let at=_e.useCallback(()=>{sr(u),_?.()},[_,u]),It=_e.useMemo(()=>({env:Nt,theme:t,isMobile:ot,open:ne,drawerDirection:ze,modal:mt,showBalance:a,showForgeToken:i,showGameToken:s,showQR:c,showBridge:l,qrLogoSrc:d,walletAddress:u,accountName:h,sendAccounts:m,profileImageUrl:v,connectorName:Tt,connectorIconUrl:Ke,preferredTokens:E,close:gt,onSelectWallet:f,onCopyAddress:I,onBuy:N,onBuyDisabledMessage:P,onBridgeDisabledMessage:M,onSendDisabledMessage:Y,onDisconnect:_?at:void 0,disconnectLabel:K,termsUrl:z,termsLabel:X,privacyUrl:O,privacyLabel:me,portalStyle:he,navContent:We,navPosition:it,setNavContent:ht,setNavPosition:He,footerContent:Ge,setFooterContent:Ue,view:S,setView:$,selectedSendToken:oe,setSelectedSendToken:Ye,showPortfolio:je,portfolioTitle:ae,showTotalAssets:H,totalAssetsLabel:se,sendTransaction:ee,getTransactionReceipt:G,estimateGas:Ve,onOutlink:pe,lpBalanceReader:Le,stakingRewardsReader:fe,bridgeTokens:ut,bridgeHistory:ve,getBridgeQuote:Dt,getBridgeToTokens:Oe,getBridgeApproval:Rt,approveBridge:_t,submitBridge:le,onReceive:ge,onBridge:nt,onSend:ye}),[Nt,t,ot,ne,ze,mt,a,i,s,c,l,d,u,h,m,v,Tt,Ke,E,gt,f,I,N,P,M,Y,_,at,K,z,X,O,me,he,We,it,Ge,S,oe,je,ae,H,se,ee,G,Ve,pe,Le,fe,ut,ve,Dt,Oe,Rt,_t,le,ge,nt,ye]);return Ar(er.Provider,{value:It,children:ot?Ar(op.Root,{direction:ze,open:ne,onOpenChange:rt,handleOnly:ke,noBodyStyles:!0,repositionInputs:!1,children:ce},"drawer"):Ar(ys.Root,{open:ne,onOpenChange:rt,children:ce},"popover")})}var In=Object.assign(ap,{Trigger:Xi,Content:hs,Nav:ws,Footer:vs});import*as Mt from"react";import*as zs from"@radix-ui/react-dialog";import{Drawer as mp}from"vaul";import{createContext as sp,useContext as lp}from"react";var Po=sp(null);function Gn(){let e=lp(Po);if(!e)throw new Error("WalletConnectModal compound components must be used within <WalletConnectModal>");return e}import{useState as ks,useEffect as cp,useCallback as dp}from"react";function Bo(){let[e,t]=ks([]),[n,o]=ks(!0);cp(()=>{if(typeof window>"u"){o(!1);return}let a=[],i=c=>{let{info:l}=c.detail;l?.rdns&&!a.some(d=>d.rdns===l.rdns)&&(a.push({rdns:l.rdns,name:l.name,icon:l.icon}),t([...a]))};window.addEventListener("eip6963:announceProvider",i),window.addEventListener("eip6963:crossAnnounceProvider",i),window.dispatchEvent(new Event("eip6963:requestProvider")),window.dispatchEvent(new Event("eip6963:crossRequestProvider"));let s=setTimeout(()=>o(!1),500);return()=>{window.removeEventListener("eip6963:announceProvider",i),window.removeEventListener("eip6963:crossAnnounceProvider",i),clearTimeout(s)}},[]);let r=dp(a=>e.some(i=>i.rdns===a),[e]);return{wallets:e,isDetected:r,isLoading:n}}import*as Cs from"@radix-ui/react-dialog";import{Drawer as pp}from"vaul";import{jsx as Ss}from"react/jsx-runtime";function Rs({asChild:e,children:t}){let{isMobile:n}=Gn(),o=n?pp.Trigger:Cs.Trigger;return Ss(o,{asChild:e??t!=null,children:t??Ss("button",{type:"button",children:"Connect Wallet"})})}import*as Ft from"@radix-ui/react-dialog";import{Drawer as Mo}from"vaul";import{jsx as U,jsxs as Xt}from"react/jsx-runtime";function Fo(){return Xt("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[U("circle",{cx:"20",cy:"20",r:"20",fill:"#00D5AA"}),U("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.3225 2.85742L23.7249 6.25982V11.8301L28.1175 7.43757L32.9292 12.2493L28.5806 16.5979H20.3225C18.4435 16.5979 16.9201 18.1212 16.9201 20.0003C16.9201 21.8794 18.4434 23.4027 20.3225 23.4027H28.5372L32.9293 27.7948L28.1176 32.6066L23.7249 28.2139V33.7407L20.3225 37.1431L16.9201 33.7407V28.2584L12.5719 32.6066L7.76022 27.7948L12.1524 23.4027H6.58209L3.17969 20.0003L6.58209 16.5979H12.1089L7.76035 12.2493L12.5721 7.43757L16.9201 11.7857V6.25982L20.3225 2.85742Z",fill:"black"})]})}function Ns(){return Xt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",children:[Xt("g",{clipPath:"url(#clip0_1331_27065)",children:[U("path",{d:"M37.2488 38.4674L28.6626 35.8175L22.1876 39.8295L17.6699 39.8274L11.191 35.8175L2.60875 38.4674L-0.00195312 29.3328L2.60875 19.1947L-0.00195312 10.6234L2.60875 0L16.0192 8.30453H23.838L37.2488 0L39.8595 10.6234L37.2488 19.1947L39.8595 29.3328L37.2488 38.4674Z",fill:"#FF5C16"}),U("path",{d:"M2.60938 0L16.0201 8.31037L15.4868 14.0137L2.60938 0ZM11.1919 29.3366L17.0925 33.9956L11.1919 35.8175V29.3366ZM16.6209 21.6342L15.4868 14.0175L8.22768 19.1971L8.22374 19.195V19.1988L8.24628 24.5302L11.1899 21.6345L16.6209 21.6342ZM37.2477 0L23.837 8.31037L24.3685 14.0137L37.2477 0ZM28.6654 29.3366L22.7646 33.9956L28.6654 35.8175V29.3366ZM31.6313 19.1985V19.1947L31.6297 19.1968L24.3705 14.0175L23.2364 21.6342H28.6651L31.6108 24.5296L31.6313 19.1985Z",fill:"#FF5C16"}),U("path",{d:"M11.191 35.8175L2.60875 38.4674L-0.00195312 29.3366H11.191V35.8175ZM16.62 21.6321L18.2595 32.6435L15.9873 26.5208L8.24368 24.5296L11.189 21.6324H16.62V21.6321ZM28.6662 35.8175L37.2488 38.4674L39.8595 29.3366H28.6662V35.8175ZM23.2375 21.6321L21.598 32.6435L23.8699 26.5208L31.6138 24.5296L28.6665 21.6324H23.2375V21.6321Z",fill:"#E34807"}),U("path",{d:"M-0.00195312 29.3328L2.60875 19.1947H8.22284L8.2434 24.5278L15.9876 26.519L18.2595 32.6414L17.0916 33.9897L11.191 29.3307H-0.00195312V29.3328ZM39.8595 29.3328L37.2488 19.1947H31.6344L31.6138 24.5278L23.8702 26.519L21.598 32.6414L22.7657 33.9897L28.6665 29.3307H39.8595V29.3328ZM23.838 8.30444H16.0192L15.4882 14.0078L18.2597 32.6355H21.598L24.3713 14.0078L23.838 8.30444Z",fill:"#FF8D5D"}),U("path",{d:"M2.60875 0L-0.00195312 10.6234L2.60875 19.1947H8.22284L15.4859 14.0137L2.60875 0ZM14.9975 23.8438H12.4541L11.0693 25.2508L15.9893 26.515L14.9975 23.842V23.8438ZM37.2488 0L39.8595 10.6234L37.2488 19.1947H31.6344L24.3716 14.0137L37.2488 0ZM24.8637 23.8438H27.4107L28.7955 25.2526L23.8699 26.5191L24.8637 23.8418V23.8438ZM22.1857 36.1956L22.7659 33.9936L21.598 32.6453H18.2572L17.0896 33.9936L17.6696 36.1956",fill:"#661800"}),U("path",{d:"M22.1857 36.1951V39.831H17.6699V36.1951H22.1857Z",fill:"#C0C4CD"}),U("path",{d:"M11.1914 35.8131L17.672 39.8289V36.193L17.0917 33.9912L11.1914 35.8131ZM28.6649 35.8131L22.1841 39.8289V36.193L22.7644 33.9912L28.6649 35.8131Z",fill:"#E7EBF6"})]}),U("defs",{children:U("clipPath",{id:"clip0_1331_27065",children:U("rect",{width:"40",height:"40",fill:"white"})})})]})}function Ts(){return Xt("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[U("path",{d:"M12.23 16.81L20 9.04L27.77 16.81L32.29 12.29L20 0L7.71 12.29L12.23 16.81Z",fill:"#F3BA2F"}),U("path",{d:"M9.04 20L4.52 15.48L0 20L4.52 24.52L9.04 20Z",fill:"#F3BA2F"}),U("path",{d:"M12.23 23.19L20 30.96L27.77 23.19L32.29 27.71L20 40L7.71 27.71L12.23 23.19Z",fill:"#F3BA2F"}),U("path",{d:"M35.48 24.52L40 20L35.48 15.48L30.96 20L35.48 24.52Z",fill:"#F3BA2F"}),U("path",{d:"M24.58 20L20 15.41L16.61 18.8L16.22 19.19L15.42 19.99L20 24.59L24.59 20L24.58 20Z",fill:"#F3BA2F"})]})}function Is(){return Xt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"247",height:"246",viewBox:"0 0 247 246",fill:"none",children:[U("rect",{width:"247.005",height:"245.105",rx:"36",fill:"#121212"}),U("path",{d:"M89.1233 136.695V59.7551H118.481V140.524L74.5862 184.774L30.4787 140.524V107.55H59.9073V136.695L74.5862 151.303L89.1233 136.695Z",fill:"white"}),U("path",{d:"M59.8364 99.8915V59.7551H12.0414L30.4787 77.8377V99.8915H59.8364Z",fill:"#2FD7FF"}),U("path",{d:"M199.534 59.9334C202.562 60.0484 208.427 60.4824 212.031 63.6902C215.635 66.898 216.937 71.0498 216.937 73.1199V104.017L198.767 114.828L216.937 125.561V172.713C216.937 174.511 216.405 178.276 211.034 181.377C205.664 184.477 202.613 184.969 201.758 184.827H143.949C141.879 184.904 136.712 184.182 132.602 180.686C128.493 177.19 128.462 175.216 128.462 173.515V125.561L146.173 114.828L128.462 104.017V71.1268C128.462 69.721 130.109 65.7781 133.237 63.5701C137.147 60.8101 141.112 59.9334 144.409 59.9334H199.534ZM158.3 122.264V166.221H187.033V122.264H158.3ZM158.3 107.794H187.033V78.5272H158.3V107.794Z",fill:"white"})]})}function Ls(){return Xt("svg",{width:"40",height:"40",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Xt("g",{clipPath:"url(#clip0_1185_7785)",children:[U("path",{d:"M14 28C21.75 28 28 21.75 28 14C28 6.25 21.75 0 14 0C6.25 0 0 6.25 0 14C0 21.75 6.25 28 14 28Z",fill:"#EB0029"}),U("path",{d:"M19.4975 8.36232L6 6L13.103 23L23 11.5311L19.4975 8.36232ZM19.2801 9.4034L21.3449 11.27L15.6975 12.2424L19.2801 9.4034ZM14.4714 12.0479L8.51876 7.35252L18.247 9.05524L14.4714 12.0479ZM14.0467 12.8782L13.0765 20.5098L7.84385 7.98492L14.0467 12.8782ZM14.9454 13.2835L21.1983 12.2064L14.026 20.518L14.9454 13.2835Z",fill:"white"})]}),U("defs",{children:U("clipPath",{id:"clip0_1185_7785",children:U("rect",{width:"28",height:"28",fill:"white"})})})]})}function Es(){return Xt("svg",{width:"40",height:"40",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[U("path",{fill:"#FFC107",d:"M43.6 20.5H42V20H24v8h11.3A12 12 0 1 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 1 0 44 24c0-1.2-.1-2.4-.4-3.5z"}),U("path",{fill:"#FF3D00",d:"M6.3 14.7l6.6 4.8A12 12 0 0 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 0 0 6.3 14.7z"}),U("path",{fill:"#4CAF50",d:"M24 44c5.2 0 10-2 13.6-5.2l-6.3-5.3A12 12 0 0 1 12.7 28l-6.5 5A20 20 0 0 0 24 44z"}),U("path",{fill:"#1976D2",d:"M43.6 20.5H42V20H24v8h11.3a12 12 0 0 1-4.1 5.5l6.3 5.3C41 35.7 44 30.3 44 24c0-1.2-.1-2.4-.4-3.5z"})]})}function As(){return U("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:U("path",{d:"M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.53 4.08zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"})})}function Ps(){return U("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:U("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var Pr={cross_embedded:{id:"cross_embedded",name:"CROSSx with Social",description:"Sign in with Google or Apple",icon:Fo},cross_wallet:{id:"cross_wallet",name:"CROSSx",description:"App approval is required",icon:Fo,featured:!0},cross_extension:{id:"cross_extension",name:"CROSSx Extension",description:"Browser extension approval is required",icon:Fo,rdns:"nexus.to.crosswallet.desktop",installUrl:"https://chromewebstore.google.com/detail/crossx/nninbdadmocnokibpaaohnoepbnpdgcg",visibility:"desktop-only"},metamask:{id:"metamask",name:"MetaMask",description:"Browser extension approval is required",icon:Ns,rdns:"io.metamask"},binance:{id:"binance",name:"Binance",description:"Mobile app only \u2014 Add CROSS network first",icon:Ts},verse8:{id:"verse8",name:"Verse8 Wallet",description:"Optimized for Forge and Verse8 ecosystem",icon:Is,badge:"For Forge"},tron:{id:"tron",name:"Tron Wallet",description:"Dedicated for Tron-based transactions and assets",icon:Ls,badge:"For SHOP"}};function Br(e){return Pr[e]}var Fr={google:{id:"google",name:"Google",icon:Es},apple:{id:"apple",name:"Apple",icon:As}};function Bs(e){return Fr[e]}import{Fragment as _s,jsx as W,jsxs as Ie}from"react/jsx-runtime";function fp({wallet:e,detected:t,onConnect:n}){let o=()=>{if(e.installUrl&&!t){window.open(e.installUrl,"_blank","noopener,noreferrer");return}n()},r=e.icon,a=e.featured===!0;return Ie("button",{type:"button",className:Z("wcm-wallet-item",a&&"wcm-wallet-item--featured"),onClick:o,children:[Ie("div",{className:"wcm-wallet-item-left",children:[W("div",{className:"wcm-wallet-icon",children:W(r,{})}),Ie("div",{className:"wcm-wallet-name-row",children:[W("span",{className:"wcm-wallet-name",children:e.name}),e.badge&&W("span",{className:"wcm-wallet-badge",children:e.badge})]})]}),e.installUrl&&(t?W("span",{className:"wcm-installed-label",children:"Installed"}):W("span",{className:"wcm-install-btn",children:"Install"}))]})}function up({social:e,onSignIn:t}){let n=e.icon,o=`Sign in with ${e.name}`;return Ie("button",{type:"button",className:"wcm-social-item","data-provider":e.id,onClick:t,"aria-label":o,children:[W("span",{className:"wcm-social-icon",children:W(n,{})}),W("span",{className:"wcm-social-name",children:o})]})}function Fs(){let{wallets:e,activeWalletIds:t,socialProviders:n,activeSocialIds:o,termsUrl:r,privacyUrl:a,isDetected:i,close:s,isMobile:c}=Gn(),l=t.filter(h=>{let m=Br(h).visibility;return!m||m==="always"?!0:m==="desktop-only"?!c:m==="mobile-only"?c:!0}),d=o.length>0,u=l.length>0;return Ie(_s,{children:[Ie("div",{className:"wcm-header",children:[Ie("div",{className:"wcm-header-text",children:[W("h2",{className:"wcm-title",children:"CROSS Wallet"}),!c&&W("p",{className:"wcm-subtitle",children:"Sign in instantly with your social account"})]}),W("button",{type:"button",className:"wcm-close-btn",onClick:s,"aria-label":"Close",children:W(Ps,{})})]}),Ie("div",{className:"wcm-body",children:[d&&Ie(_s,{children:[!c&&Ie("div",{className:"wcm-section-header",children:[W("span",{className:"wcm-section-title",children:"Social Account Wallet Connect"}),W("span",{className:"wcm-recommended-badge",children:"Recommended"})]}),W("div",{className:"wcm-social-grid",children:o.map(h=>{let m=Bs(h);return W(up,{social:m,onSignIn:()=>{n[h]?.(),s()}},h)})}),u&&Ie("div",{className:"wcm-separator",children:[W("div",{className:"wcm-separator-line"}),W("span",{className:"wcm-separator-text",children:"Other Wallets"}),W("div",{className:"wcm-separator-line"})]})]}),u&&W("div",{className:"wcm-wallet-list",children:l.map(h=>{let m=Br(h),v=m.rdns?i(m.rdns):!1;return W(fp,{wallet:m,detected:v,onConnect:()=>{e[h]?.(),s()}},h)})}),Ie("p",{className:"wcm-terms",children:["By continuing, you agree to NEXUS"," ",W(Ms,{href:r,children:"Terms of Service"})," and consent to its ",W(Ms,{href:a,children:"Privacy Policy"}),"."]})]})]})}function Ms({href:e,children:t}){return e?W("a",{className:"wcm-terms-link",href:e,target:"_blank",rel:"noopener noreferrer",children:t}):W("span",{className:"wcm-terms-link",children:t})}function Os({className:e}){let{isMobile:t,theme:n,portalStyle:o}=Gn();return t?Ie(Mo.Portal,{children:[W(Mo.Overlay,{className:"wcm-overlay"}),Ie(Mo.Content,{className:Z("wcm-drawer-content",e),"data-theme":n,style:o,children:[W(Mo.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),W("div",{className:"wcm-drawer-handle"}),W("div",{className:"wcm-drawer-body",children:W(Fs,{})})]})]}):Ie(Ft.Portal,{children:[W(Ft.Overlay,{className:"wcm-overlay"}),Ie(Ft.Content,{className:Z("wcm-dialog-content",e),"data-theme":n,style:o,children:[W(Ft.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),W(Ft.Description,{className:"wcm-sr-only",children:"Sign in with a social provider or pick a wallet to connect."}),W("div",{className:"wcm-dialog-body",children:W(Fs,{})})]})]})}D(`.wcm-overlay{position:fixed;inset:0;z-index:100000;background:var(--ds-overlay-dim, rgba(0, 0, 0, .5));-webkit-backdrop-filter:var(--ds-bg-blur-7, blur(3.5px));backdrop-filter:var(--ds-bg-blur-7, blur(3.5px))}.wcm-dialog-content{-webkit-font-smoothing:antialiased;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:100001;width:var(--wcm-dialog-width, 480px);max-height:90vh;overflow:hidden;display:flex;flex-direction:column;background:var(--ds-surface-default, #ffffff);border:1px solid var(--ds-border-default, #00000012);border-radius:24px;box-shadow:var(--ds-shadow-modal, 0 4px 30px -1px rgba(0, 0, 0, .15));outline:none;animation:wcm-dialog-show .2s ease-out;font-family:inherit}.wcm-dialog-content[data-state=closed]{animation:wcm-dialog-hide .15s ease-in}.wcm-dialog-body,.wcm-drawer-body{scrollbar-width:thin;scrollbar-color:var(--ds-border-medium, rgba(0, 0, 0, .18)) transparent}.wcm-dialog-body::-webkit-scrollbar,.wcm-drawer-body::-webkit-scrollbar{width:4px}.wcm-dialog-body::-webkit-scrollbar-track,.wcm-drawer-body::-webkit-scrollbar-track{background:transparent}.wcm-dialog-body::-webkit-scrollbar-thumb,.wcm-drawer-body::-webkit-scrollbar-thumb{background:var(--ds-border-medium, rgba(0, 0, 0, .18));border-radius:4px}.wcm-drawer-content{-webkit-font-smoothing:antialiased;position:fixed;bottom:0;left:0;right:0;z-index:100001;width:100%;max-width:var(--wcm-drawer-max-width, none);min-width:var(--wcm-drawer-min-width, 0);max-height:85dvh;margin:0 auto;display:flex;flex-direction:column;background:var(--ds-surface-default, #ffffff);border:1px solid var(--ds-border-default, #00000012);border-top-left-radius:16px;border-top-right-radius:16px;outline:none;font-family:inherit;box-sizing:border-box}.wcm-drawer-content[data-vaul-drawer-direction=right]{inset:0 0 0 auto;max-height:100vh;width:var(--wcm-drawer-max-width, 400px);max-width:100vw;border-radius:16px 0 0 16px}.wcm-drawer-content[data-vaul-drawer-direction=left]{inset:0 auto 0 0;max-height:100vh;width:var(--wcm-drawer-max-width, 400px);max-width:100vw;border-radius:0 16px 16px 0}.wcm-drawer-content[data-vaul-drawer-direction=top]{inset:0 0 auto;border-radius:0 0 16px 16px}.wcm-drawer-handle{width:60px;height:4px;border-radius:999px;background:var(--ds-border-medium, rgba(0, 0, 0, .18));margin:12px auto 8px;flex-shrink:0}.wcm-drawer-content[data-vaul-drawer-direction=left] .wcm-drawer-handle,.wcm-drawer-content[data-vaul-drawer-direction=right] .wcm-drawer-handle{display:none}.wcm-dialog-body,.wcm-drawer-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden}.wcm-drawer-body{overscroll-behavior:contain}.wcm-header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:24px;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.wcm-header-text{display:flex;flex-direction:column;gap:4px;min-width:0}.wcm-title{font-family:Inter,sans-serif;font-weight:600;font-size:20px;line-height:1.25;letter-spacing:0;color:var(--ds-content-highest, #000000);margin:0}.wcm-subtitle{font-family:Inter,sans-serif;font-weight:400;font-size:14px;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65));margin:0}.wcm-close-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;flex-shrink:0;border:none;background:transparent;color:var(--ds-content-low, #00000066);cursor:pointer;padding:0;transition:opacity .15s ease}.wcm-close-btn:hover{opacity:.6}.wcm-close-btn>svg{width:24px;height:24px}.wcm-divider{display:none}.wcm-body{display:flex;flex-direction:column;gap:16px;padding:24px}.wcm-section-header{display:flex;align-items:center;gap:8px;width:100%}.wcm-section-title{font-family:Inter,sans-serif;font-weight:600;font-size:16px;line-height:1;letter-spacing:0;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wcm-recommended-badge{display:inline-flex;align-items:center;justify-content:center;padding:4px 8px;background:var(--ds-accent-primary-low, #e7f9f8);border-radius:9999px;font-family:Inter,sans-serif;font-weight:500;font-size:12px;line-height:1;letter-spacing:0;color:var(--ds-accent-primary-high, #00a0a2);white-space:nowrap}.wcm-social-grid{display:grid;gap:8px;width:100%}.wcm-dialog-body .wcm-social-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.wcm-drawer-body .wcm-social-grid{grid-template-columns:1fr}.wcm-social-item{display:flex;background:var(--ds-surface-medium, #f5f7fa);border:none;border-radius:12px;cursor:pointer;transition:none;font-family:inherit;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wcm-social-item:hover{background:#2e3544!important}:root[data-ds-theme=light] .wcm-social-item:hover{background:#eff3f8!important}.wcm-social-item[data-provider=apple] .wcm-social-icon{color:#000}[data-theme=dark] .wcm-social-item[data-provider=apple] .wcm-social-icon{color:#fff}.wcm-dialog-body .wcm-social-item{flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px}.wcm-drawer-body .wcm-social-item{flex-direction:row;align-items:center;justify-content:flex-start;gap:12px;padding:16px}.wcm-social-icon{flex-shrink:0;width:32px;height:32px;display:flex;align-items:center;justify-content:center}.wcm-social-icon>svg{width:32px;height:32px}.wcm-social-name{font-family:Inter,sans-serif;font-weight:600;font-size:14px;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.wcm-separator{display:flex;align-items:center;gap:12px;width:100%}.wcm-separator-line{flex:1;height:1px;background:var(--ds-border-default, rgba(0, 0, 0, .07))}.wcm-separator-text{font-family:Inter,sans-serif;font-weight:500;font-size:12px;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4));white-space:nowrap}.wcm-wallet-list{display:flex;flex-direction:column;gap:8px}.wcm-wallet-item{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;padding:20px 16px;background:var(--ds-surface-medium, #f5f7fa);border:none;border-radius:12px;cursor:pointer;text-align:left;transition:none;font-family:inherit}.wcm-wallet-item:hover{background:#2e3544!important}:root[data-ds-theme=light] .wcm-wallet-item:hover{background:#eff3f8!important}.wcm-wallet-item-left{display:flex;align-items:center;gap:8px;flex:1;min-width:0}.wcm-wallet-icon{flex-shrink:0;width:28px;height:28px;display:flex;align-items:center;justify-content:center}.wcm-wallet-icon>svg,.wcm-wallet-icon>img{width:28px;height:28px;border-radius:0;object-fit:cover}.wcm-wallet-name-row{display:flex;align-items:center;gap:8px;min-width:0}.wcm-wallet-name{font-family:Inter,sans-serif;font-weight:600;font-size:16px;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.wcm-wallet-badge{display:inline-flex;align-items:center;justify-content:center;padding:4px 8px;background:var(--ds-system-purple-low, #f5f3ff);border:.5px solid var(--ds-system-purple-default, #7e54f4);border-radius:9999px;font-family:Inter,sans-serif;font-weight:500;font-size:12px;line-height:1;letter-spacing:0;color:var(--ds-system-purple-high, #7346f3);white-space:nowrap}.wcm-install-btn{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;padding:4px 8px;background:var(--ds-accent-primary-default, #00b4b7);border-radius:6px;font-family:Inter,sans-serif;font-weight:500;font-size:12px;line-height:1;letter-spacing:0;color:var(--ds-accent-primary-on, #ffffff);white-space:nowrap}.wcm-installed-label{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;font-family:Inter,sans-serif;font-weight:500;font-size:12px;line-height:1;letter-spacing:0;color:var(--ds-content-low, rgba(0, 0, 0, .4));white-space:nowrap}.wcm-terms{font-family:Inter,sans-serif;font-weight:400;font-size:12px;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65));text-align:center;margin:0}.wcm-terms-link{color:var(--ds-accent-primary-high, #00a0a2);text-decoration:none}.wcm-terms-link:hover{text-decoration:underline}.wcm-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}
16
+ `);D(`@keyframes wcm-overlay-show{0%{opacity:0}to{opacity:1}}@keyframes wcm-overlay-hide{0%{opacity:1}to{opacity:0}}@keyframes wcm-dialog-show{0%{opacity:0;transform:translate(-50%,-48%) scale(.96)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}@keyframes wcm-dialog-hide{0%{opacity:1;transform:translate(-50%,-50%) scale(1)}to{opacity:0;transform:translate(-50%,-48%) scale(.96)}}
17
+ `);import{jsx as Un}from"react/jsx-runtime";var gp={};function hp({wallets:e,socialProviders:t=gp,termsUrl:n,privacyUrl:o,theme:r="dark",mobileBreakpoint:a=768,drawerDirection:i="bottom",dialogWidth:s,drawerMaxWidth:c,drawerMinWidth:l,style:d,open:u,onOpenChange:h,children:m}){let v=hn(`(max-width: ${a}px)`),[x,w]=Mt.useState(!1),k=u!==void 0,E=k?u:x,f=Mt.useCallback(z=>{k||w(z),h?.(z)},[k,h]),I=Mt.useCallback(()=>f(!1),[f]),{isDetected:N}=Bo(),P=Mt.useMemo(()=>Object.keys(e),[e]),M=Mt.useMemo(()=>Object.keys(t),[t]),Y=Mt.useMemo(()=>{let z={};return s&&(z["--wcm-dialog-width"]=s),c&&(z["--wcm-drawer-max-width"]=c),l&&(z["--wcm-drawer-min-width"]=l),{...z,...d}},[s,c,l,d]),_=Mt.useMemo(()=>({theme:r,isMobile:v,open:E,setOpen:f,close:I,wallets:e,activeWalletIds:P,socialProviders:t,activeSocialIds:M,termsUrl:n,privacyUrl:o,isDetected:N,portalStyle:Y}),[r,v,E,f,I,e,P,t,M,n,o,N,Y]),K=Un("div",{"data-theme":r,style:Y,children:m});return v?Un(Po.Provider,{value:_,children:Un(mp.Root,{direction:i,open:E,onOpenChange:f,noBodyStyles:!0,children:K},"drawer")}):Un(Po.Provider,{value:_,children:Un(zs.Root,{open:E,onOpenChange:f,children:K})})}var Ds=Object.assign(hp,{Trigger:Rs,Content:Os});D(`.cb-button{--cb-bg: var(--ds-accent-primary-default, #00b4b7);--cb-bg-hover: var(--cb-bg);--cb-color: var(--ds-accent-primary-on-primary, #ffffff);--cb-border: none;--cb-radius: 8px;--cb-height: 36px;--cb-padding: 8px 16px;--cb-font-family: Inter, system-ui, -apple-system, sans-serif;--cb-font-size: 14px;--cb-font-weight: 500;--cb-line-height: 1.5;--cb-letter-spacing: -.01em;--cb-gap: 8px;--cb-transition: opacity .15s;--cb-loading-opacity: .7;--cb-press-scale: .95;--cb-icon-size: 18px;--cb-spinner-size: 18px;--cb-spinner-thumb: currentColor;--cb-spinner-track: color-mix(in srgb, currentColor 20%, transparent)}.cb-pill{--cb-pill-bg: var(--ds-surface-default, #ffffff);--cb-pill-bg-hover: var(--cb-pill-bg);--cb-pill-color: var(--ds-content-high, rgba(0, 0, 0, .85));--cb-pill-border: 1px solid var(--ds-border-default, rgba(0, 0, 0, .07));--cb-pill-border-hover: 1px solid var(--ds-border-medium, rgba(0, 0, 0, .18));--cb-pill-radius: 8px;--cb-pill-height: 36px;--cb-pill-padding: 1px 13px;--cb-pill-press-scale: .95;--cb-pill-font-family: Inter, system-ui, -apple-system, sans-serif;--cb-pill-font-size: 14px;--cb-pill-font-weight: 500;--cb-pill-line-height: 1.5;--cb-pill-gap: 8px;--cb-pill-icon-size: 18px;--cb-pill-icon-placeholder-bg: var(--ds-surface-medium, #f5f7fa);--cb-pill-address-font: Inter, system-ui, -apple-system, sans-serif;--cb-pill-address-font-size: 14px;--cb-pill-address-letter-spacing: -.01em}
18
+ `);D(`.cb-button{-webkit-font-smoothing:antialiased;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;height:var(--cb-height);gap:var(--cb-gap);padding:var(--cb-padding);border-radius:var(--cb-radius);border:var(--cb-border);background:var(--cb-bg);color:var(--cb-color);font-family:var(--cb-font-family);font-size:var(--cb-font-size);font-weight:var(--cb-font-weight);line-height:var(--cb-line-height);letter-spacing:var(--cb-letter-spacing);cursor:pointer;transition:var(--cb-transition)}.cb-button:hover:not(:disabled){background:var(--cb-bg-hover)}.cb-button:active:not(:disabled){transform:scale(var(--cb-press-scale))}.cb-button:disabled,.cb-button[aria-busy=true]{cursor:default;opacity:var(--cb-loading-opacity)}.cb-spinner{display:inline-block;width:var(--cb-spinner-size);height:var(--cb-spinner-size);border:2px solid var(--cb-spinner-track);border-top-color:var(--cb-spinner-thumb);border-radius:50%;animation:cb-spin .6s linear infinite;flex-shrink:0}.cb-button-icon{width:var(--cb-icon-size);height:var(--cb-icon-size);flex-shrink:0}.cb-button-label{white-space:nowrap}.cb-pill{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;height:var(--cb-pill-height);gap:var(--cb-pill-gap);padding:var(--cb-pill-padding);border-radius:var(--cb-pill-radius);border:var(--cb-pill-border);background:var(--cb-pill-bg);color:var(--cb-pill-color);font-family:var(--cb-pill-font-family);font-size:var(--cb-pill-font-size);font-weight:var(--cb-pill-font-weight);line-height:var(--cb-pill-line-height);cursor:pointer}.cb-pill:hover{background:var(--cb-pill-bg-hover)}.cb-pill:active:not(:disabled){transform:scale(var(--cb-pill-press-scale))}.cb-pill-icon{width:var(--cb-pill-icon-size);height:var(--cb-pill-icon-size);border-radius:50%;object-fit:contain;flex-shrink:0;background:transparent}[data-theme=dark] .cb-pill-icon[data-provider=apple]{filter:invert(1)}.cb-pill-icon-placeholder{display:inline-block;width:var(--cb-pill-icon-size);height:var(--cb-pill-icon-size);border-radius:50%;background:var(--cb-pill-icon-placeholder-bg);flex-shrink:0}.cb-pill-address{font-family:var(--cb-pill-address-font);font-size:var(--cb-pill-address-font-size);letter-spacing:var(--cb-pill-address-letter-spacing);white-space:nowrap}@media(max-width:767.98px){.cb-button,.cb-pill{width:36px;min-width:36px;padding:0}.cb-button{height:36px}.cb-button-label,.cb-pill-address{display:none}}@keyframes cb-spin{to{transform:rotate(360deg)}}
19
+ `);var bp='<svg preserveAspectRatio="none" width="100%" height="100%" overflow="visible" style="display: block;" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#c0)"><path d="M18 36C27.9411 36 36 27.9411 36 18C36 8.05887 27.9411 0 18 0C8.05887 0 0 8.05887 0 18C0 27.9411 8.05887 36 18 36Z" fill="#00D5AA"/><path fill-rule="evenodd" clip-rule="evenodd" d="M18.2903 2.57169L21.3525 5.63385V10.6471L25.3058 6.69381L29.6364 11.0244L25.7226 14.9381H18.2903C16.5992 14.9381 15.2283 16.309 15.2283 18.0003C15.2283 19.6915 16.5992 21.0624 18.2903 21.0624H25.6836L29.6365 25.0154L25.3059 29.3459L21.3525 25.3925V30.3666L18.2903 33.4288L15.2283 30.3666V25.4326L11.3148 29.3459L6.98426 25.0154L10.9372 21.0624H5.92394L2.86178 18.0003L5.92394 14.9381H10.8981L6.98437 11.0244L11.3149 6.69383L15.2283 10.6071V5.63385L18.2903 2.57169Z" fill="#000"/></g><defs><clipPath id="c0"><rect width="36" height="36" fill="#fff"/></clipPath></defs></svg>',wp='<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 28 28" fill="none"><g clip-path="url(#m0)"><path d="M26.07 26.93L20.06 25.07L15.53 27.88L12.37 27.88L7.83 25.07L1.83 26.93L0 20.53L1.83 13.44L0 7.44L1.83 0L11.21 5.81H16.69L26.07 0L27.9 7.44L26.07 13.44L27.9 20.53Z" fill="#FF5C16"/><path d="M7.83 20.54L11.96 23.8L7.83 25.07V20.54Z" fill="#FF5C16"/><path d="M20.06 20.54L15.93 23.8L20.06 25.07L20.06 20.54Z" fill="#FF5C16"/><path d="M11.63 15.14L12.78 22.85L11.19 18.56L5.77 17.17L7.83 15.14H11.63Z" fill="#E34807"/><path d="M16.27 15.14L15.12 22.85L16.71 18.56L22.13 17.17L20.07 15.14H16.27Z" fill="#E34807"/><path d="M0 20.53L1.83 13.44H5.76L5.77 17.17L11.19 18.56L12.78 22.85L11.96 23.79L7.83 20.53H0Z" fill="#FF8D5D"/><path d="M27.9 20.53L26.07 13.44H22.14L22.13 17.17L16.71 18.56L15.12 22.85L15.94 23.79L20.07 20.53H27.9Z" fill="#FF8D5D"/><path d="M16.69 5.81H11.21L10.84 9.81L12.78 22.85H15.12L17.06 9.81L16.69 5.81Z" fill="#FF8D5D"/><path d="M15.53 25.34V27.88H12.37V25.34H15.53Z" fill="#C0C4CD"/><path d="M7.83 25.07L12.37 27.88V25.34L11.96 23.79L7.83 25.07Z" fill="#E7EBF6"/><path d="M20.07 25.07L15.53 27.88V25.34L15.94 23.79L20.07 25.07Z" fill="#E7EBF6"/></g><defs><clipPath id="m0"><rect width="28" height="28" fill="#fff"/></clipPath></defs></svg>',xp='<svg width="100%" height="100%" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.23 16.81L20 9.04L27.77 16.81L32.29 12.29L20 0L7.71 12.29L12.23 16.81Z" fill="#F3BA2F"/><path d="M9.04 20L4.52 15.48L0 20L4.52 24.52L9.04 20Z" fill="#F3BA2F"/><path d="M12.23 23.19L20 30.96L27.77 23.19L32.29 27.71L20 40L7.71 27.71L12.23 23.19Z" fill="#F3BA2F"/><path d="M35.48 24.52L40 20L35.48 15.48L30.96 20L35.48 24.52Z" fill="#F3BA2F"/><path d="M24.58 20L20 15.41L16.61 18.8L16.22 19.19L15.42 19.99L20 24.59L24.59 20L24.58 20Z" fill="#F3BA2F"/></svg>',vp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><path fill="#FFC107" d="M43.6 20.5H42V20H24v8h11.3A12 12 0 1 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 1 0 44 24c0-1.2-.1-2.4-.4-3.5z"/><path fill="#FF3D00" d="M6.3 14.7l6.6 4.8A12 12 0 0 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 0 0 6.3 14.7z"/><path fill="#4CAF50" d="M24 44c5.2 0 10-2 13.6-5.2l-6.3-5.3A12 12 0 0 1 12.7 28l-6.5 5A20 20 0 0 0 24 44z"/><path fill="#1976D2" d="M43.6 20.5H42V20H24v8h11.3a12 12 0 0 1-4.1 5.5l6.3 5.3C41 35.7 44 30.3 44 24c0-1.2-.1-2.4-.4-3.5z"/></svg>',yp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path d="M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.53 4.08zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"/></svg>';function $n(e){return`data:image/svg+xml,${encodeURIComponent(e)}`}var _o=$n(bp),Oo=$n(wp),zo=$n(xp),Do=$n(vp),Wo=$n(yp);import{jsx as ft,jsxs as jn}from"react/jsx-runtime";function Hs({isConnecting:e,address:t,provider:n,providerName:o,accountName:r,sendAccounts:a,onConnect:i,onDisconnect:s,onCopy:c,onSelectWallet:l,onBuy:d,onBuyDisabledMessage:u,label:h="Connect Wallet",connectingLabel:m="Connecting...",disconnectLabel:v,className:x,theme:w="dark",env:k,showBalance:E=!0,showPortfolio:f,drawerDirection:I,modal:N,connectorId:P,style:M,walletInfoStyle:Y,sendTransaction:_,getTransactionReceipt:K,estimateGas:z,onReceive:X,onBridge:O,onSend:me,bridgeTokens:te,bridgeHistory:ie,getBridgeQuote:je,getBridgeToTokens:ae,getBridgeApproval:H,approveBridge:se,submitBridge:ee}){let G=x?`cb-button ${x}`:"cb-button",Ve=x?`cb-pill ${x}`:"cb-pill";if(e)return jn("button",{type:"button",disabled:!0,className:G,style:M,"aria-busy":"true",children:[ft("span",{className:"cb-spinner","aria-hidden":"true"}),ft("span",{className:"cb-button-label",children:m})]});if(t){let pe=o??Rp(n),Le=n?Sp[n]:void 0;return jn(In,{env:k,theme:w,drawerDirection:I,modal:N,showBalance:E,showPortfolio:f,walletAddress:t,accountName:r,sendAccounts:a,connectorId:P,onSelectWallet:l,onCopyAddress:c?(fe,ut)=>{ut&&c()}:void 0,onDisconnect:s,disconnectLabel:v,style:Y,sendTransaction:_,getTransactionReceipt:K,estimateGas:z,onReceive:X,onBridge:O,onBuy:d,onBuyDisabledMessage:u,onSend:me,bridgeTokens:te,bridgeHistory:ie,getBridgeQuote:je,getBridgeToTokens:ae,getBridgeApproval:H,approveBridge:se,submitBridge:ee,children:[ft(In.Trigger,{asChild:!0,children:jn("button",{type:"button",className:Ve,style:M,"aria-label":`Connected with ${pe}: ${Ws(t)}`,children:[Le?ft("img",{src:Le,alt:"",width:18,height:18,className:"cb-pill-icon","data-provider":n}):ft("span",{className:"cb-pill-icon-placeholder","aria-hidden":"true"}),ft("span",{className:"cb-pill-address",children:Ws(t)})]})}),ft(In.Content,{align:"end",sideOffset:8})]})}return jn("button",{type:"button",onClick:i,className:G,style:M,"aria-label":typeof h=="string"?h:"Connect Wallet",children:[ft(kp,{}),ft("span",{className:"cb-button-label",children:h})]})}function kp(){return jn("svg",{className:"cb-button-icon",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[ft("path",{d:"M3.75 5.25H14.25C15.0784 5.25 15.75 5.92157 15.75 6.75V13.5C15.75 14.3284 15.0784 15 14.25 15H3.75C2.92157 15 2.25 14.3284 2.25 13.5V4.5C2.25 3.67157 2.92157 3 3.75 3H13.5",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"}),ft("path",{d:"M12 9.75H15.75V12.75H12C11.1716 12.75 10.5 12.0784 10.5 11.25C10.5 10.4216 11.1716 9.75 12 9.75Z",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"}),ft("path",{d:"M12.75 11.25H12.7575",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}var Sp={google:Do,apple:Wo,cross:_o,metamask:Oo,binance:zo},Cp={google:"Google",apple:"Apple",cross:"CROSSx",metamask:"MetaMask",binance:"Binance Wallet"};function Rp(e){return e?Cp[e]:"Wallet"}function Ws(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}import*as Gs from"react";D(`.sb-button{--sb-bg: var(--ds-surface-default, #ffffff);--sb-border: var(--ds-border-default, rgba(0, 0, 0, .07));--sb-border-hover: var(--ds-border-default, rgba(0, 0, 0, .07));--sb-color: var(--ds-content-medium, rgba(0, 0, 0, .65));--sb-color-hover: var(--ds-content-high, rgba(0, 0, 0, .85));--sb-radius: 8px;--sb-height: 36px;--sb-padding: 1px 11px;--sb-gap: 4px;--sb-font-size: 14px;--sb-font-weight: 500;--sb-line-height: 21px;--sb-letter-spacing: 0;--sb-blur: 0px;--sb-border-width: 1px;--sb-icon-size: 18px;--sb-icon-hover-rotation: 180deg;--sb-spinner-size: 18px;--sb-spinner-thumb: currentColor;--sb-spinner-track: color-mix(in srgb, currentColor 20%, transparent);--sb-disabled-opacity: .6;--sb-press-scale: .95;--sb-hover-duration: .2s;--sb-icon-duration: .3s;--sb-easing: ease}.sb-button[data-theme=dark]{--sb-bg: var(--ds-surface-default, #1e232e);--sb-border: var(--ds-border-default, #ffffff12);--sb-border-hover: var(--ds-border-medium, #ffffff2e);--sb-color: var(--ds-content-medium, #ffffffa6);--sb-color-hover: var(--ds-content-high, #ffffffd9)}.sb-button[data-theme=light]{--sb-bg: var(--ds-surface-default, #ffffff);--sb-border: var(--ds-border-default, #00000012);--sb-border-hover: var(--ds-border-medium, #0000002e);--sb-color: var(--ds-content-medium, #000000a6);--sb-color-hover: var(--ds-content-high, #000000d9)}
20
+ `);D(`.sb-button{-webkit-font-smoothing:antialiased;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;height:var(--sb-height);gap:var(--sb-gap);padding:var(--sb-padding);border-radius:var(--sb-radius);border:var(--sb-border-width) solid var(--sb-border);background:var(--sb-bg);backdrop-filter:blur(var(--sb-blur));-webkit-backdrop-filter:blur(var(--sb-blur));color:var(--sb-color);font-family:Inter,system-ui,-apple-system,sans-serif;font-weight:var(--sb-font-weight);font-size:var(--sb-font-size);line-height:var(--sb-line-height);letter-spacing:var(--sb-letter-spacing);cursor:pointer;transition:border-color var(--sb-hover-duration) var(--sb-easing),color var(--sb-hover-duration) var(--sb-easing)}@media(hover:hover){.sb-button:hover:not(:disabled){border-color:var(--sb-border-hover);color:var(--sb-color-hover)}.sb-button:hover:not(:disabled) .sb-button-icon{transform:rotate(var(--sb-icon-hover-rotation))}}.sb-button:active:not(:disabled){transform:scale(var(--sb-press-scale))}.sb-button:disabled,.sb-button[aria-busy=true]{cursor:default;opacity:var(--sb-disabled-opacity)}.sb-button-icon{width:var(--sb-icon-size);height:var(--sb-icon-size);flex-shrink:0;color:inherit;transition:transform var(--sb-icon-duration) var(--sb-easing),color var(--sb-icon-duration) var(--sb-easing)}.sb-spinner{display:inline-block;width:var(--sb-spinner-size);height:var(--sb-spinner-size);border:2px solid var(--sb-spinner-track);border-top-color:var(--sb-spinner-thumb);border-radius:50%;animation:sb-spin .6s linear infinite;flex-shrink:0}.sb-label{white-space:nowrap}@keyframes sb-spin{to{transform:rotate(360deg)}}
21
+ `);import{jsx as Vn,jsxs as Tp}from"react/jsx-runtime";var Mr="https://www.onechain.nexus/skills";function Us({label:e="Skills",href:t=Mr,onClick:n,className:o,style:r,theme:a,disabled:i=!1,isLoading:s=!1,loadingLabel:c="Loading...",openInNewTab:l=!1,type:d="button"}){let[u,h]=Gs.useState(!1),m=async E=>{if(t&&!n){l?window.open(t,"_blank","noopener,noreferrer"):window.location.href=t;return}if(n)try{h(!0),await n()}finally{h(!1)}},v=i||s||u,x=s||u,w=x?c:e,k=o?`sb-button ${o}`:"sb-button";return Tp("button",{type:d,onClick:m,disabled:v,className:k,"data-theme":a,style:r,"aria-busy":x,children:[x?Vn("span",{className:"sb-spinner","aria-hidden":"true"}):Vn(Np,{}),Vn("span",{className:"sb-label",children:w})]})}function Np(){return Vn("svg",{className:"sb-button-icon",viewBox:"0 0 34 34",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:Vn("path",{d:"M15.5879 3.95142C16.0211 2.78097 17.6761 2.78099 18.1094 3.95142L19.6221 8.03833C20.6569 10.8348 22.8618 13.0396 25.6582 14.0745L29.7451 15.5872C30.9157 16.0204 30.9157 17.6754 29.7451 18.1086L25.6582 19.6213C22.8618 20.6562 20.657 22.861 19.6221 25.6575L18.1094 29.7444C17.6762 30.9149 16.0211 30.9149 15.5879 29.7444L14.0752 25.6575C13.0403 22.861 10.8355 20.6562 8.03906 19.6213L3.95215 18.1086C2.78172 17.6754 2.7817 16.0204 3.95215 15.5872L8.03906 14.0745C10.8355 13.0396 13.0403 10.8348 14.0752 8.03833L15.5879 3.95142Z",stroke:"currentColor",strokeWidth:"1.93556"})})}Zo({mode:"dapp-ui"});export{Wo as APPLE_ICON,Xr as AppLauncher,si as AppLauncherContent,oi as AppLauncherTrigger,zo as BINANCE_ICON,Io as BridgeFlow,oo as CONNECTOR_REGISTRY,_o as CROSSX_ICON,Hs as ConnectButton,tr as ConnectorId,Mr as DEFAULT_SKILLS_HREF,Do as GOOGLE_ICON,Oo as METAMASK_ICON,Fr as SOCIAL_REGISTRY,bo as SendFlow,Us as SkillsButton,br as TOKEN_STATS_QUERY_KEY,hr as USER_BALANCE_QUERY_KEY,Pr as WALLET_REGISTRY,Ds as WalletConnectModal,In as WalletInfo,Ga as WalletPortfolio,Rn as WalletPortfolioBody,Zo as announceAppLauncherUsage,Pe as resolveEnvironment,to as useGlobalMenu,jt as useTokenBalance,Vt as useTokenStats,Bo as useWalletDetect};