@nexus-cross/dapp-ui 1.1.0-beta.2 → 1.1.0-beta.3

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
@@ -2,14 +2,14 @@ function ce(e){if(e)return Xo(e);let t=typeof process<"u"?process.env?.NEXT_PUBL
2
2
  `);M(`.al-trigger-btn{display:inline-flex;align-items:center;justify-content:center;padding:8px;border:none;background:transparent;border-radius:8px;cursor:pointer;transition:background-color .15s ease}.al-trigger-btn[data-theme=dark]{color:#edf1f3}.al-trigger-btn[data-theme=light]{color:#1e232e}
3
3
  `);M(`@keyframes al-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
4
4
  `);M(`.al-popover-content{z-index:100001;border-radius:16px;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:24px 4px;box-sizing:border-box}.al-popover-content .al-grid{grid-template-columns:repeat(4,100px);row-gap:24px;column-gap:0;padding:0;justify-content:center}.al-popover-content .al-grid-item{flex-direction:column;justify-content:flex-start;align-items:center;gap:8px;padding:8px 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:54px;height:54px;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;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{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: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:36px;height:36px;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.5;letter-spacing:-.16px;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:-.16px;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(--al-text);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:transparent;border-radius:8px;cursor:pointer;transition:background-color .15s ease;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:var(--al-bg-hover)}.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:-.16px;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:-.1px;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:#7346f3;color:var(--al-badge-new-text);font-family:Pretendard,Inter,sans-serif;font-size:9px;font-weight:700;flex-shrink:0}
5
- `);M("");import{jsx as mo}from"react/jsx-runtime";function en({env:e,theme:t="dark",mobileBreakpoint:r=768,domain:o,children:n}){let c=lt(`(max-width: ${r}px)`),[s,l]=ct.useState(!1),d=ct.useCallback(()=>l(!1),[]),i=ce(e),a=ct.useMemo(()=>({env:i,theme:t,isMobile:c,open:s,domain:o,close:d}),[i,t,c,s,o,d]);return mo(po.Provider,{value:a,children:c?mo(Zr.Root,{direction:"right",open:s,onOpenChange:l,noBodyStyles:!0,children:n},"drawer"):mo(Jo.Root,{open:s,onOpenChange:l,children:n},"popover")})}import*as rn from"@radix-ui/react-popover";import{Drawer as Yr}from"vaul";import{jsx as de,jsxs as Kr}from"react/jsx-runtime";function tn({size:e=18}){return Kr("svg",{className:"al-trigger-icon",width:e,height:e,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[de("rect",{width:"4",height:"4",fill:"currentColor"}),de("rect",{x:"7",width:"4",height:"4",fill:"currentColor"}),de("rect",{x:"14",width:"4",height:"4",fill:"currentColor"}),de("rect",{y:"7",width:"4",height:"4",fill:"currentColor"}),de("rect",{x:"7",y:"7",width:"4",height:"4",fill:"currentColor"}),de("rect",{x:"14",y:"7",width:"4",height:"4",fill:"currentColor"}),de("rect",{y:"14",width:"4",height:"4",fill:"currentColor"}),de("rect",{x:"7",y:"14",width:"4",height:"4",fill:"currentColor"}),de("rect",{x:"14",y:"14",width:"4",height:"4",fill:"currentColor"})]})}function on(){return de("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:de("path",{d:"M12 19L5 12M5 12L12 5M5 12H19",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function nn(){return de("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:de("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as Dt}from"react/jsx-runtime";function an({asChild:e,children:t}){let{isMobile:r,theme:o}=Ot(),n=t!=null,c=e??!0,s=n?t:Dt("button",{type:"button",className:"al-trigger-btn","data-theme":o,children:Dt(tn,{size:r?12:18})});return r?Dt(Yr.Trigger,{asChild:c,children:s}):Dt(rn.Trigger,{asChild:c,children:s})}import*as Xe from"react";import*as Ft from"@radix-ui/react-popover";import{Drawer as dt}from"vaul";import{useQuery as Jr}from"@tanstack/react-query";var sn={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 Qr="https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",Xr="https://contents.crosstoken.io/frontend/common/app-launcher/icons";function Le(e,t){return`${e==="production"?Xr:Qr}/${t}.png`}function ln(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:Le(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:Le(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:Le(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:Le(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:Le(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:Le(t,"nft"),order:8e3,type:"nft",badge:null,isNew:!1},{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:Le(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:Le(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:Le(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:Le(t,"explorer"),order:12e3,type:"explorer",badge:null,isNew:!1}]}}function Wt(e){let t=ce(e);return Jr({queryKey:["global-menu",t],queryFn:async({signal:r})=>{try{let o=await fetch(sn[t],{cache:"no-store",signal:r});if(!o.ok)throw new Error(`Failed to fetch global menu: ${o.status}`);return o.json()}catch(o){if(r.aborted)throw o;return ln(t)}},staleTime:0,gcTime:0,retry:!1,refetchOnMount:!0})}function Z(...e){return e.filter(Boolean).join(" ")}import{jsx as te,jsxs as Nt}from"react/jsx-runtime";function dn({align:e="end",sideOffset:t=12,className:r}){let{env:o,theme:n,isMobile:c,domain:s,close:l}=Ot(),{data:d}=Wt(o),i=Xe.useMemo(()=>(d?.items??[]).sort((h,R)=>h.order-R.order),[d]),a=8,m=Xe.useRef(null),y=Xe.useCallback(h=>{m.current={x:h.clientX,y:h.clientY}},[]),w=typeof window<"u"?window.location.pathname:"",g=Xe.useCallback((h,R)=>{if(m.current){let C=h.clientX-m.current.x,B=h.clientY-m.current.y;if(m.current=null,Math.abs(C)>a||Math.abs(B)>a)return}let L=R.url[o]??R.url.production,O=cn(L,s);if(!O)try{let C=new URL(L).pathname;if(w===C||w.startsWith(C+"/")){l();return}}catch{}O?window.open(L,"_blank","noopener,noreferrer"):window.location.href=L,l()},[o,s,l,w]),f=te("div",{className:"al-grid","data-theme":n,children:i.map(h=>{let R=h.url[o]??h.url.production,L=cn(R,s),O=!1;if(!L)try{let C=new URL(R).pathname;O=w===C||w.startsWith(C+"/")}catch{O=!1}return Nt("button",{type:"button",className:"al-grid-item","data-active":O||void 0,onPointerDown:y,onClick:C=>g(C,h),children:[Nt("div",{className:"al-grid-item-left",children:[te("div",{className:"al-grid-item-icon",children:te("img",{src:h.iconUrl,alt:h.label,width:24,height:24,loading:"lazy"})}),te("span",{className:"al-grid-item-label",children:h.label}),h.isNew&&te("span",{className:"al-badge-new",children:"N"})]}),te("div",{className:"al-grid-item-right",children:h.badge&&te("span",{className:"al-badge",children:h.badge})})]},h.id)})});return c?Nt(dt.Portal,{children:[te(dt.Overlay,{className:"al-drawer-overlay"}),Nt(dt.Content,{className:Z("al-drawer-content",r),"data-theme":n,children:[Nt("div",{className:"al-drawer-header",children:[te(dt.Close,{className:"al-drawer-close",children:te(on,{})}),te(dt.Title,{className:"al-drawer-title",children:"CROSS Services"}),te(dt.Close,{className:"al-drawer-close",children:te(nn,{})})]}),te("div",{className:"al-drawer-body",children:f})]})]}):te(Ft.Portal,{children:te(Ft.Content,{align:e,sideOffset:t,className:Z("al-popover-content",r),"data-theme":n,children:f})})}function cn(e,t){try{let r=new URL(e).hostname;return typeof window>"u"?!0:r!==(t??window.location.hostname)}catch{return!1}}import*as ie from"react";import*as hr from"@radix-ui/react-popover";import{Drawer as La}from"vaul";import{createContext as ei,useContext as ti}from"react";var fo=ei(null);function Be(){let e=ti(fo);if(!e)throw new Error("WalletInfo compound components must be used within <WalletInfo>");return e}var uo=(o=>(o.CROSSx="crossx",o.MetaMask="io.metamask",o.Binance="com.binance.wallet",o))(uo||{}),Bt={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 S from"react";import Je from"bignumber.js";function oi(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 et(e,t){if(!e||e==="0")return"0.00";let r=new Je(e).shiftedBy(-t),o=r.isGreaterThanOrEqualTo(1)?2:4;return r.toFormat(o,Je.ROUND_DOWN)}function ue(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}function go(e){let t=typeof e=="string"?parseFloat(e):e;if(Number.isNaN(t)||t===0)return"$0.00";let r=t>=1?2:4,o=Math.pow(10,r);return`$${(Math.floor(t*o)/o).toLocaleString("en-US",{minimumFractionDigits:r,maximumFractionDigits:r})}`}function pn(e,t,r){let n=new Je(e).shiftedBy(-t).multipliedBy(new Je(r));return n.isZero()||n.isNaN()?"$0.00":`$${(n.integerValue(Je.ROUND_DOWN).isGreaterThanOrEqualTo(1)?n.decimalPlaces(2,Je.ROUND_DOWN):n.decimalPlaces(4,Je.ROUND_DOWN)).toFormat()}`}function mn(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 r=t;if(r.includes("e")||r.includes("E")){let s=Number(r);if(!Number.isFinite(s)||s===0)return{displayValue:"0",isLowerBound:!1};r=oi(s.toFixed(18))}let[o="0",n=""]=r.split(".");if(Number(o)>=1){let s=n.slice(0,2).padEnd(2,"0");return{displayValue:`${Number(o).toLocaleString("en-US")}.${s}`,isLowerBound:!1}}return n.length<4?{displayValue:`${o}.${n}`,isLowerBound:!1}:n.slice(0,4)==="0000"?{displayValue:"0.0001",isLowerBound:!0}:{displayValue:`0.${n.slice(0,4)}`,isLowerBound:!1}}var ge={dev:"https://stg-wallet-server.crosstoken.io/api",stage:"https://stg-wallet-server.crosstoken.io/api",production:"https://wallet-server.crosstoken.io/api"},se={dev:{cross:612044,bsc:97},stage:{cross:612044,bsc:97},production:{cross:612055,bsc:56}};var wo={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"},fn={cross:"https://contents.crosstoken.io/wallet/token/images/CROSS.svg",bsc:"https://contents.crosstoken.io/wallet/token/images/BSC.svg"};function ho(e,t){let r=se[e];if(t===r.cross)return fn.cross;if(t===r.bsc)return fn.bsc}var ni={dev:"https://dev-portrait.crosstoken.io",stage:"https://dev-portrait.crosstoken.io",production:"https://portrait.crosstoken.io"};function Lt(e,t,r={}){if(!t||!t.startsWith("0x"))return;let{size:o=120,bg:n,format:c="png"}=r,s=ni[e],l=n?`&bg=${n}`:"";return`${s}/portrait/evm/${t}.${c}?size=${o}${l}`}import{jsx as $,jsxs as Vt}from"react/jsx-runtime";function un({size:e=16,className:t}){return Vt("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[$("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"}),$("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 bo({size:e=16,className:t}){return $("svg",{width:e,height:e,viewBox:"4 4 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:$("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 Rt({size:e=16,className:t}){return $("svg",{width:e,height:e,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:$("path",{d:"M11.6667 3.5L5.25 9.91667L2.33334 7",stroke:"currentColor",strokeWidth:1.16667,strokeLinecap:"round",strokeLinejoin:"round"})})}function xo({size:e=24,className:t}){return $("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:$("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function gn({size:e=20,className:t}){return Vt("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[$("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"}),$("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 wn({size:e=20,className:t}){return $("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,children:$("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 hn({size:e=20,className:t}){return $("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:$("path",{d:"M12.5 15L7.5 10L12.5 5",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function bn({size:e=20,className:t}){return $("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:$("path",{d:"M8 5L13 10L8 15",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function xn({size:e=20,className:t}){return $("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:$("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function vn({size:e=16,className:t}){return Vt("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[$("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"}),$("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 yn({size:e=16,className:t}){return Vt("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[$("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"}),$("path",{d:"M1.667 1.667l16.666 16.666",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function kn({size:e=42,className:t}){return $("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 42 42",fill:"none",className:t,children:$("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})})}import{useMemo as ri}from"react";import{useQuery as ii}from"@tanstack/react-query";var ai="send:chain-info";function si(e){return"data"in e&&e.data?e.data:e}function vo(e,...t){let r=e.replace(/\/+$/,""),o=t.map(n=>n.replace(/^\/+|\/+$/g,"")).filter(Boolean);return[r,...o].join("/")}function li(e,t,r,o){if(o)return t===se[e].cross?Cn(t,o):r?.explorer_url?vo(r.explorer_url,r.explorer_postfix?.transaction??"tx",o):ci(e,t,o)}function Cn(e,t){return vo("https://explorer.crosstoken.io",String(e),"tx",t)}function ci(e,t,r){let o=se[e];if(t===o.cross)return Cn(t,r);if(t===o.bsc)return vo(e==="production"?"https://bscscan.com":"https://testnet.bscscan.com","tx",r)}function Nn(e,t,r,o=!0){let n=ge[e],{data:c,...s}=ii({queryKey:[ai,e,t],queryFn:async({signal:d})=>{let i=await fetch(`${n}/v1/public/chain/info/${t}`,{cache:"no-store",signal:d});if(!i.ok)throw new Error(`Failed to fetch chain info: ${i.status}`);let a=await i.json();if("code"in a&&a.code!==void 0&&a.code!==200)throw new Error(`Chain info API error: ${a.code}`);return si(a)},enabled:o,staleTime:300*1e3});return{transactionUrl:ri(()=>li(e,t,c,r),[t,c,e,r]),...s}}var Ln="0x0000000000000000000000000000000000000001";var di="0xa9059cbb",pi=/^0x[a-fA-F0-9]{40}$/,mi="nexus-cross:dapp-ui:send:recent:",Rn=10;function fi(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return e.slice(0,t)}function It(e){return e.toLowerCase()}function Tt(e){return pi.test(e)}function yo(e){return It(e.address)===Ln}function ko(e){return`${mi}${e.toLowerCase()}`}function pt(e){if(typeof window>"u")return[];try{let t=window.localStorage.getItem(ko(e));if(!t)return[];let r=JSON.parse(t);return Array.isArray(r)?r.filter(o=>o!==null&&typeof o=="object"&&Tt(o.address)&&typeof o.updatedAt=="number").slice(0,Rn):[]}catch{return[]}}function Co(e,t){if(typeof window>"u")return[];let r=It(t),o=[{address:r,updatedAt:Date.now()},...pt(e).filter(n=>n.address!==r)].slice(0,Rn);try{window.localStorage.setItem(ko(e),JSON.stringify(o))}catch{return pt(e)}return o}function No(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(ko(e))}catch{}}function Lo(e,t){let r=e.trim();if(!r)return{error:"Enter an amount."};if(!/^\d+(\.\d*)?$/.test(r))return{error:"Enter a valid amount."};let[o="0",n=""]=r.split(".");if(n.length>t)return{error:`Max ${t} decimal places.`};let c=BigInt(o||"0"),s=n.padEnd(t,"0"),l=s?BigInt(s):0n,d=10n**BigInt(t),i=c*d+l;return i<=0n?{error:"Amount must be greater than 0."}:{value:i}}function Ro(e,t){let r=BigInt(e||"0"),o=10n**BigInt(t),n=r/o,c=r%o;if(c===0n)return n.toString();let s=fi(c.toString().padStart(t,"0"));return`${n.toString()}.${s}`}function Io(e,t){let r=e.replace(/^0x/,"").toLowerCase().padStart(64,"0"),o=t.toString(16).padStart(64,"0");return`${di}${r}${o}`}M(`.wi-token-item--button{position:relative;width:100%;border:none;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer;border-radius:12px;padding:6px 8px;margin:-2px -8px;transition:background-color .15s ease,transform .15s ease}.wi-token-item--button:before{content:"";position:absolute;inset:-6px -16px;border-radius:16px}.wi-token-item--button:active{transform:scale(.99)}.wi-token-item--button:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px}.wi-view-send{animation:wi-slide-in-right .25s ease-out}.wi-send-body{flex:1;min-height:0;overflow:hidden}.wi-drawer-content[data-direction=bottom][data-view=send]{max-height:85dvh}.send-page{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.send-scroll{flex:1;min-height:0;display:flex;flex-direction:column;gap:16px;overflow-y:auto;overflow-x:hidden;padding:16px 24px 18px;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.15) transparent;overscroll-behavior:contain}[data-theme=light] .send-scroll{scrollbar-color:rgba(0,0,0,.12) transparent}.send-scroll::-webkit-scrollbar{width:4px}.send-scroll::-webkit-scrollbar-track{background:transparent}.send-scroll::-webkit-scrollbar-thumb{background:#ffffff26;border-radius:4px}[data-theme=light] .send-scroll::-webkit-scrollbar-thumb{background:#0000001f}.send-section{display:flex;flex-direction:column;gap:8px}.send-asset-card{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:14px;border:1px solid var(--wi-border-subtle);border-radius:18px;background:var(--wi-surface-default);color:inherit;font:inherit;text-align:left;cursor:pointer;transition:border-color .15s ease,background-color .15s ease}.send-asset-card:disabled{cursor:default}.send-asset-card:not(:disabled):hover,.send-asset-card[aria-expanded=true]{border-color:var(--wi-primary);background:var(--wi-surface-subtle)}.send-token-list{display:flex;flex-direction:column;gap:6px;max-height:180px;overflow-y:auto;padding:6px;border:1px solid var(--wi-border-subtle);border-radius:16px;background:var(--wi-surface-default)}.send-token-option{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:48px;border:none;border-radius:12px;background:transparent;color:inherit;font:inherit;text-align:left;padding:8px;cursor:pointer}.send-token-option:hover,.send-token-option[data-selected]{background:var(--wi-surface-subtle)}.send-token-option:focus-visible,.send-asset-card:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px}.send-token-option-icon{flex-shrink:0;width:28px;height:28px;border-radius:8px;object-fit:contain;background:transparent}.send-token-option-symbol{color:var(--wi-texticon-primary);font-size:13px;font-weight:700;line-height:1.3}.send-token-option-balance{color:var(--wi-texticon-secondary);font-size:12px;font-weight:600;line-height:1.3;white-space:nowrap}.send-asset-left{display:flex;align-items:center;gap:12px;min-width:0}.send-asset-icon{flex-shrink:0;width:40px;height:40px;border-radius:12px;object-fit:contain;background:transparent}.send-asset-info,.send-asset-balance{min-width:0;display:flex;flex-direction:column}.send-asset-symbol{color:var(--wi-texticon-primary);font-size:15px;font-weight:700;line-height:1.3}.send-asset-name,.send-balance-label{color:var(--wi-texticon-tertiary);font-size:12px;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.send-asset-balance{align-items:flex-end;text-align:right}.send-balance-value{color:var(--wi-texticon-primary);font-size:13px;font-weight:600;line-height:1.35;white-space:nowrap}.send-form{display:flex;flex-direction:column;gap:14px}.send-field{display:flex;flex-direction:column;gap:8px}.send-label-row{display:flex;align-items:center;justify-content:space-between;gap:8px}.send-label{color:var(--wi-texticon-secondary);font-size:13px;font-weight:600;line-height:1.3}.send-input,.send-amount-wrap{width:100%;box-sizing:border-box;border:1px solid var(--wi-border-subtle);border-radius:14px;background:var(--wi-surface-default);color:var(--wi-texticon-primary);font:inherit}.send-input{min-height:46px;padding:0 14px;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.send-input:focus{border-color:var(--wi-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--wi-primary) 18%,transparent)}.send-address-wrap[data-invalid],.send-amount-wrap[data-invalid]{border-color:#ff6b6b}.send-address-wrap[data-invalid]:focus-within,.send-amount-wrap[data-invalid]:focus-within{border-color:#ff6b6b;box-shadow:0 0 0 3px #ff6b6b29}.send-input::placeholder{color:var(--wi-texticon-tertiary)}.send-address-wrap{display:flex;align-items:center;width:100%;box-sizing:border-box;border:1px solid var(--wi-border-subtle);border-radius:14px;background:var(--wi-surface-default);transition:border-color .15s ease,box-shadow .15s ease}.send-address-wrap:focus-within{border-color:var(--wi-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--wi-primary) 18%,transparent)}.send-input--address{flex:1;min-width:0;border:none;background:transparent;box-shadow:none}.send-input--address:focus{box-shadow:none}.send-address-book-btn{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;width:42px;height:42px;margin-right:2px;border:none;border-radius:12px;background:transparent;color:var(--wi-texticon-tertiary);cursor:pointer;transition:background-color .15s ease,color .15s ease}.send-address-book-btn:hover,.send-address-book-btn[aria-expanded=true]{background:var(--wi-surface-subtle);color:var(--wi-primary)}.send-address-book-btn:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px}.send-address-picker{display:flex;flex-direction:column;gap:12px;padding:14px;border:1px solid var(--wi-border-subtle);border-radius:18px;background:var(--wi-surface-default)}.send-address-tabs{display:flex;align-items:center;gap:22px;border-bottom:1px solid var(--wi-border-subtle)}.send-address-tab{position:relative;border:none;background:transparent;color:var(--wi-texticon-tertiary);font:inherit;font-size:14px;font-weight:800;line-height:1.3;padding:0 0 12px;cursor:pointer}.send-address-tab[data-active]{color:var(--wi-primary)}.send-address-tab[data-active]:after{content:"";position:absolute;left:50%;bottom:-1px;width:34px;height:4px;border-radius:999px;background:var(--wi-primary);transform:translate(-50%)}.send-address-list{display:flex;flex-direction:column;gap:10px;max-height:224px;overflow-y:auto;padding-right:10px;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.18) transparent}[data-theme=light] .send-address-list{scrollbar-color:rgba(0,0,0,.14) transparent}.send-address-list::-webkit-scrollbar{width:3px}.send-address-list::-webkit-scrollbar-track{background:transparent}.send-address-list::-webkit-scrollbar-thumb{background:#ffffff2e;border-radius:999px}[data-theme=light] .send-address-list::-webkit-scrollbar-thumb{background:#00000024}.send-address-option{display:flex;align-items:center;gap:12px;width:100%;min-height:54px;border:none;border-radius:14px;background:transparent;color:inherit;font:inherit;text-align:left;padding:8px;cursor:pointer;transition:background-color .15s ease}.send-address-option:hover{background:var(--wi-surface-subtle)}.send-address-option:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px}.send-address-avatar{flex-shrink:0;position:relative;display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:50%;background:var(--wi-surface-subtle);color:var(--wi-primary);font-size:12px;font-weight:800;overflow:hidden}.send-address-avatar-img{position:relative;z-index:1;width:36px;height:36px;border-radius:50%;object-fit:cover}.send-address-avatar-fallback{position:absolute;inset:0;display:inline-flex;align-items:center;justify-content:center}.send-address-copy{min-width:0;display:flex;flex-direction:column;gap:2px}.send-address-name{color:var(--wi-texticon-primary);font-size:14px;font-weight:800;line-height:1.3}.send-address-value{color:var(--wi-texticon-tertiary);font-size:12px;font-weight:600;line-height:1.3}.send-address-empty{display:flex;align-items:center;justify-content:center;min-height:120px;color:var(--wi-texticon-tertiary);font-size:14px;font-weight:700}.send-amount-wrap{display:flex;align-items:center;padding-right:12px}.send-amount-wrap:focus-within{border-color:var(--wi-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--wi-primary) 18%,transparent)}.send-input--amount{border:none;background:transparent;box-shadow:none;flex:1;min-width:0}.send-input--amount:focus{box-shadow:none}.send-amount-symbol{color:var(--wi-texticon-secondary);font-size:13px;font-weight:700}.send-field-error{margin:-2px 0 0;color:#ff6b6b;font-size:12px;font-weight:600;line-height:1.35}.send-max-btn{border:none;border-radius:999px;background:var(--wi-surface-subtle);color:var(--wi-primary);font:inherit;font-size:12px;font-weight:700;padding:4px 10px;cursor:pointer}.send-max-btn:disabled{cursor:not-allowed;opacity:.45}.send-meta{display:flex;align-items:center;justify-content:space-between;gap:12px;color:var(--wi-texticon-tertiary);font-size:12px;line-height:1.4}.send-meta span:last-child{color:var(--wi-texticon-secondary);font-weight:600}.send-message{border-radius:14px;padding:10px 12px;font-size:12px;line-height:1.45}.send-message--error{background:#ff50501f;color:#ff6b6b}.send-message--success{background:color-mix(in srgb,var(--wi-primary) 12%,transparent);color:var(--wi-primary)}.send-message span{font-weight:700}.send-submit-btn{width:100%;min-height:48px;border:none;border-radius:999px;background:var(--wi-primary);color:var(--wi-primary-contrast, #001410);font:inherit;font-size:15px;font-weight:800;cursor:pointer;transition:opacity .15s ease,transform .15s ease}.send-submit-btn:hover:not(:disabled):not([data-disabled]){transform:translateY(-1px)}.send-submit-btn:disabled,.send-submit-btn[data-disabled]{cursor:not-allowed;opacity:.45}.send-footer{flex-shrink:0;padding:14px 24px 24px;border-top:1px solid var(--wi-border-subtle);background:var(--wi-surface-bg)}.send-page--success{background:var(--wi-surface-bg)}.send-success-body{flex:1;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;padding:32px 24px;text-align:center}.send-success-icon{display:inline-flex;align-items:center;justify-content:center}.send-success-icon[data-pending]{width:56px;height:56px;border-radius:50%;background:color-mix(in srgb,var(--wi-primary) 14%,transparent)}.send-success-spinner{width:28px;height:28px;border:3px solid color-mix(in srgb,var(--wi-primary) 22%,transparent);border-top-color:var(--wi-primary);border-radius:50%;animation:cross-send-spin .8s linear infinite}.send-success-copy{display:flex;flex-direction:column;gap:8px}.send-success-title{margin:0;color:var(--wi-texticon-primary);font-size:22px;font-weight:800;line-height:1.25}.send-success-desc{margin:0;color:var(--wi-texticon-tertiary);font-size:14px;font-weight:600;line-height:1.45}.send-success-hash-card{width:100%;display:flex;flex-direction:column;gap:8px;padding:14px;border:1px solid var(--wi-border-subtle);border-radius:18px;background:var(--wi-surface-default);box-sizing:border-box}.send-success-hash-label{color:var(--wi-texticon-tertiary);font-size:12px;font-weight:700;line-height:1.3;text-align:left}.send-success-hash-row{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;border:none;border-radius:12px;background:var(--wi-surface-subtle);color:var(--wi-texticon-primary);font:inherit;font-size:14px;font-weight:800;padding:12px}.send-success-hash-link{flex:1;display:inline-flex;align-items:center;align-self:stretch;min-width:0;border:none;background:transparent;color:inherit;font:inherit;font-weight:inherit;padding:0;text-align:left;text-decoration:none;cursor:pointer;user-select:none}.send-success-hash-link:hover{color:var(--wi-primary)}.send-success-hash-link:focus-visible,.send-success-copy-btn:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px}.send-success-copy-btn{display:inline-flex;align-items:center;justify-content:center;min-width:32px;border:none;background:transparent;color:var(--wi-primary);font:inherit;font-size:12px;font-weight:800;padding:0;cursor:pointer}@keyframes cross-send-spin{to{transform:rotate(360deg)}}
6
- `);import{jsx as v,jsxs as T}from"react/jsx-runtime";var ui=1500,gi=120;function To(e){return`${e.chainId}:${e.address.toLowerCase()}`}function In(e,t){return e.name||`Account ${(e.index??t)+1}`}function Tn(e){return e.trim().slice(0,1).toUpperCase()||"A"}function wi(e){return new Promise(t=>setTimeout(t,e))}function hi(e){let{status:t}=e;return t==="reverted"||t==="0x0"||t===0||t===0n||t===!1}function bi(e){return!!(e.token||e.recipient||e.amount)}function xi(){return T("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[v("path",{d:"M4.5 4.5C4.5 3.67 5.17 3 6 3h8.25c.69 0 1.25.56 1.25 1.25V16.5H6A1.5 1.5 0 0 1 4.5 15V4.5Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),v("path",{d:"M4.5 14.5C4.5 13.67 5.17 13 6 13h9.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"}),v("path",{d:"M8 6.5h4M8 9h3",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function vi(){return T("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none","aria-hidden":"true",children:[v("circle",{cx:"28",cy:"28",r:"28",fill:"var(--wi-primary)"}),v("path",{d:"M17 28.5L24.2 35.5L39 20.5",stroke:"var(--wi-primary-contrast, #001410)",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ht({env:e,theme:t="dark",walletAddress:r,accounts:o=[],token:n,tokens:c=[],onTokenChange:s,sendTransaction:l,getTransactionReceipt:d,onSuccess:i,onConfirmSuccess:a,onOutlink:m}){let[y,w]=S.useState(""),[g,f]=S.useState(""),[h,R]=S.useState(""),[L,O]=S.useState({}),[C,B]=S.useState(""),[b,N]=S.useState(!1),[V,I]=S.useState(!1),[Y,j]=S.useState(!1),[X,_e]=S.useState("account"),we=S.useRef(void 0),[Ae,xe]=S.useState(()=>pt(r)),[q,J]=S.useState("idle"),ve=yo(n),re=S.useMemo(()=>BigInt(n.quantity.numeric||"0"),[n.quantity.numeric]),qe=S.useMemo(()=>et(n.quantity.numeric,n.quantity.decimals),[n.quantity.numeric,n.quantity.decimals]),Oe=S.useMemo(()=>o.filter(u=>u.address.toLowerCase()!==r.toLowerCase()),[o,r]),rt=S.useMemo(()=>{let u=new Map;return Oe.forEach((P,D)=>{u.set(P.address.toLowerCase(),{account:P,index:D})}),u},[Oe]),Pe=Oe.length>0,ye=S.useMemo(()=>ce(e),[e]),De=t==="dark"?"1A1A2E":"F3F6F8",ke=c.length>0?c:[n],le=ke.length>1&&!!s,{transactionUrl:me}=Nn(ye,n.chainId,C||void 0,!!C);S.useEffect(()=>{R(""),O({}),B(""),J("idle")},[n.address,n.chainId,y,g]),S.useEffect(()=>{f(""),N(!1)},[n.address,n.chainId]),S.useEffect(()=>{xe(pt(r))},[r]),S.useEffect(()=>()=>clearTimeout(we.current),[]),S.useEffect(()=>{!Pe&&X==="account"&&_e("recent")},[X,Pe]);let We=S.useCallback(()=>{f(Ro(n.quantity.numeric,n.quantity.decimals))},[n.quantity.numeric,n.quantity.decimals]),fe=S.useCallback(u=>{w(u),I(!1)},[]),Ce=S.useCallback(()=>{let u={},P=y.trim(),D=Lo(g,n.quantity.decimals),H;return P?Tt(P)||(u.recipient="Enter a valid EVM recipient address."):u.recipient="Enter a recipient address.","error"in D?u.amount=D.error:(H=D.value,H>re&&(u.amount="Amount exceeds available balance.")),!ve&&!Tt(n.address)&&(u.token="Token contract address is invalid."),{errors:u,rawAmount:H,trimmedRecipient:P}},[g,re,ve,y,n.address,n.quantity.decimals]),Ge=S.useCallback(async()=>{if(C)try{await navigator.clipboard.writeText(C),j(!0),clearTimeout(we.current),we.current=setTimeout(()=>j(!1),2e3)}catch{}},[C]),it=S.useCallback(()=>{if(!me||!C)return;let u=H=>{typeof window>"u"||window.open(H,"_blank","noopener,noreferrer")};if(!m){u(me);return}let P=m(me,{category:"send",origin:"send-transaction",payload:{chainId:n.chainId,txHash:C}});if(P&&(typeof P=="object"||typeof P=="function")&&typeof P.then=="function"){let H=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null;P.then(G=>{if(G===null){H?.close();return}let ee=G??me;if(H)try{H.location.href=ee}catch{H.close(),u(ee)}else u(ee)});return}let D=P;D!==null&&u(D??me)},[m,n.chainId,me,C]),yt=S.useCallback(async u=>{if(u.preventDefault(),R(""),B(""),!l){J("error"),R("Sending is not available for this wallet.");return}let{errors:P,rawAmount:D,trimmedRecipient:H}=Ce();if(O(P),bi(P)||D===void 0){J("error");return}let G=H;try{J("submitting");let ee=ve?await l({to:G,value:D,chainId:n.chainId}):await l({to:It(n.address),data:Io(G,D),value:0n,chainId:n.chainId});if(B(ee),J("confirming"),xe(Co(r,G)),i?.(ee),!d){J("success");return}for(let Ze=0;Ze<gi;Ze+=1){let Ke=await d({hash:ee,chainId:n.chainId}).catch(()=>null);if(Ke){if(hi(Ke)){J("error"),R("Transaction reverted on-chain.");return}J("success");return}await wi(ui)}J("error"),R("Transaction receipt was not found. Please check again later.")}catch(ee){J("error"),R(ee instanceof Error?ee.message:"Failed to send transaction.")}},[g,d,ve,i,l,n.address,n.chainId,Ce,r]),Ne=q==="submitting"||re<=0n||!y.trim()||!g.trim();if((q==="confirming"||q==="success")&&C){let u=q==="success";return T("div",{className:"send-page send-page--success",children:[T("div",{className:"send-success-body","data-vaul-no-drag":!0,children:[v("div",{className:"send-success-icon","data-pending":!u||void 0,children:u?v(vi,{}):v("span",{className:"send-success-spinner"})}),T("div",{className:"send-success-copy",children:[v("h3",{className:"send-success-title",children:u?"Transfer Complete":"Transfer in Progress"}),v("p",{className:"send-success-desc",children:u?"Transfer complete.":"Transfer in progress. Waiting for confirmation."})]}),T("div",{className:"send-success-hash-card",children:[v("span",{className:"send-success-hash-label",children:"Transaction Hash"}),T("div",{className:"send-success-hash-row","data-vaul-no-drag":!0,children:[v("button",{type:"button",className:"send-success-hash-link",onClick:it,"aria-label":"Open transaction in explorer",children:ue(C)}),v("button",{type:"button",className:"send-success-copy-btn",onClick:Ge,"aria-label":"Copy transaction hash",children:Y?v(Rt,{size:16}):"Copy"})]})]})]}),v("div",{className:"send-footer",children:v("button",{type:"button",className:"send-submit-btn",onClick:a,disabled:!u,children:u?"Completed":"Sending..."})})]})}return T("form",{className:"send-page",onSubmit:yt,children:[T("div",{className:"send-scroll","data-vaul-no-drag":!0,children:[T("section",{className:"send-section","aria-label":"Select token to send",children:[v("span",{className:"send-label",children:"Token"}),T("button",{type:"button",className:"send-asset-card",onClick:()=>{le&&N(u=>!u)},disabled:!le,"aria-expanded":le?b:void 0,children:[T("span",{className:"send-asset-left",children:[v("img",{className:"send-asset-icon",src:n.icon_url,alt:n.symbol,width:40,height:40,draggable:!1,onError:u=>{u.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),T("span",{className:"send-asset-info",children:[v("span",{className:"send-asset-symbol",children:n.symbol}),v("span",{className:"send-asset-name",children:n.name})]})]}),T("span",{className:"send-asset-balance",children:[v("span",{className:"send-balance-label",children:"Available"}),T("span",{className:"send-balance-value",children:[qe," ",n.symbol]})]})]}),le&&b&&v("div",{className:"send-token-list",role:"listbox",children:ke.map(u=>{let P=To(u)===To(n);return T("button",{type:"button",role:"option","aria-selected":P,className:"send-token-option","data-selected":P||void 0,onClick:()=>s?.(u),children:[T("span",{className:"send-asset-left",children:[v("img",{className:"send-token-option-icon",src:u.icon_url,alt:u.symbol,width:28,height:28,draggable:!1,onError:D=>{D.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),T("span",{className:"send-asset-info",children:[v("span",{className:"send-token-option-symbol",children:u.symbol}),v("span",{className:"send-asset-name",children:u.name})]})]}),v("span",{className:"send-token-option-balance",children:et(u.quantity.numeric,u.quantity.decimals)})]},To(u))})}),L.token&&v("p",{className:"send-field-error",role:"alert",children:L.token})]}),T("section",{className:"send-field","aria-label":"Recipient address",children:[v("span",{className:"send-label",children:"To"}),T("div",{className:"send-address-wrap","data-invalid":L.recipient||void 0,children:[v("input",{className:"send-input send-input--address",value:y,onChange:u=>w(u.target.value),placeholder:"0x...",autoComplete:"off",spellCheck:!1,"aria-invalid":!!L.recipient,"aria-describedby":L.recipient?"send-recipient-error":void 0}),v("button",{type:"button",className:"send-address-book-btn",onClick:()=>I(u=>!u),"aria-label":"Open address book","aria-expanded":V,children:v(xi,{})})]}),L.recipient&&v("p",{id:"send-recipient-error",className:"send-field-error",role:"alert",children:L.recipient}),V&&T("div",{className:"send-address-picker",children:[T("div",{className:"send-address-tabs",role:"tablist",children:[Pe&&v("button",{type:"button",role:"tab",className:"send-address-tab","data-active":X==="account"||void 0,"aria-selected":X==="account",onClick:()=>_e("account"),children:"My Account"}),v("button",{type:"button",role:"tab",className:"send-address-tab","data-active":X==="recent"||void 0,"aria-selected":X==="recent",onClick:()=>_e("recent"),children:"Recent"})]}),Pe&&X==="account"?v("div",{className:"send-address-list",children:Oe.map((u,P)=>{let D=In(u,P),H=Lt(ye,u.address,{size:56,bg:De});return T("button",{type:"button",className:"send-address-option",onClick:()=>fe(u.address),children:[T("span",{className:"send-address-avatar","aria-hidden":!0,children:[H&&v("img",{className:"send-address-avatar-img",src:H,alt:"",width:36,height:36,draggable:!1,onError:G=>{G.currentTarget.style.display="none"}}),v("span",{className:"send-address-avatar-fallback",children:Tn(D)})]}),T("span",{className:"send-address-copy",children:[v("span",{className:"send-address-name",children:D}),v("span",{className:"send-address-value",children:ue(u.address)})]})]},u.address)})}):Ae.length>0?v("div",{className:"send-address-list",children:Ae.map(u=>{let P=rt.get(u.address.toLowerCase()),D=P?In(P.account,P.index):void 0,H=Lt(ye,u.address,{size:56,bg:De});return T("button",{type:"button",className:"send-address-option",onClick:()=>fe(u.address),children:[T("span",{className:"send-address-avatar","aria-hidden":!0,children:[H&&v("img",{className:"send-address-avatar-img",src:H,alt:"",width:36,height:36,draggable:!1,onError:G=>{G.currentTarget.style.display="none"}}),v("span",{className:"send-address-avatar-fallback",children:D?Tn(D):u.address.slice(2,4).toUpperCase()})]}),T("span",{className:"send-address-copy",children:[v("span",{className:"send-address-name",children:D??ue(u.address)}),v("span",{className:"send-address-value",children:P?ue(P.account.address):"Recently sent"})]})]},u.address)})}):v("div",{className:"send-address-empty",children:"No Send History"})]})]}),T("section",{className:"send-field","aria-labelledby":"send-amount-label",children:[T("span",{className:"send-label-row",children:[v("span",{id:"send-amount-label",className:"send-label",children:"Amount"}),v("button",{type:"button",className:"send-max-btn",onClick:We,disabled:re<=0n||q==="submitting",children:"Max"})]}),T("div",{className:"send-amount-wrap","data-invalid":L.amount||void 0,children:[v("input",{className:"send-input send-input--amount",value:g,onChange:u=>f(u.target.value),placeholder:"0.00",inputMode:"decimal",autoComplete:"off","aria-labelledby":"send-amount-label","aria-invalid":!!L.amount,"aria-describedby":L.amount?"send-amount-error":void 0}),v("span",{className:"send-amount-symbol",children:n.symbol})]}),L.amount&&v("p",{id:"send-amount-error",className:"send-field-error",role:"alert",children:L.amount})]}),T("div",{className:"send-meta",children:[v("span",{children:"From"}),v("span",{children:ue(r)})]}),T("div",{className:"send-meta",children:[v("span",{children:"Network"}),T("span",{children:["Chain ID ",n.chainId]})]}),h&&v("div",{className:"send-message send-message--error",role:"alert",children:h})]}),v("div",{className:"send-footer",children:v("button",{type:"submit",className:"send-submit-btn",disabled:q==="submitting","data-disabled":Ne||void 0,"aria-disabled":Ne,children:q==="submitting"?"Sending...":"Send"})})]})}import*as En from"@radix-ui/react-popover";import{Drawer as yi}from"vaul";import{jsx as $t,jsxs as ki}from"react/jsx-runtime";function Pn({asChild:e,className:t,children:r}){let{isMobile:o,theme:n,walletAddress:c}=Be(),s=r!=null,l=e??!0,d=s?r:ki("button",{type:"button",className:Z("wi-trigger-btn",t),"data-theme":n,"data-mobile":o||void 0,children:[$t(un,{size:o?14:16}),$t("span",{className:"wi-trigger-address",children:ue(c)})]});return o?$t(yi.Trigger,{asChild:l,children:d}):$t(En.Trigger,{asChild:l,children:d})}import*as F from"react";import*as Yt from"@radix-ui/react-popover";import{Drawer as Kt}from"vaul";import St from"bignumber.js";import{useQueries as Ci}from"@tanstack/react-query";import{useMemo as Ni}from"react";var Eo="user-balance";async function Li(e,t,r,o){let n=new URLSearchParams({networkId:`eip155:${t}`,account:r}),c=await fetch(`${e}/v1/public/token/balance?${n}`,{cache:"no-store",signal:o});if(!c.ok)throw new Error(`Failed to fetch token balance: ${c.status}`);let s=await c.json();if(s.code!==200)throw new Error(`Token balance API error: ${s.code}`);return s.data}function mt(e,t,r=!0){let o=ge[e],n=se[e],c=[n.cross,n.bsc],s=Ci({queries:c.map(a=>({queryKey:[Eo,e,t,a],queryFn:({signal:m})=>Li(o,a,t,m),enabled:!!t&&r,staleTime:0,refetchInterval:r?5e3:!1}))}),l=s.some(a=>a.isLoading),d=s.some(a=>a.isError);return{tokens:Ni(()=>{let a=[];for(let m of s)m.data&&a.push(...m.data);return a},[s]),isLoading:l,isError:d}}import{useQuery as Ri,useQueries as Ii}from"@tanstack/react-query";import{useMemo as Ti}from"react";var Ei="forge-holdings",Pi="forge-token-image";async function Si(e,t,r){let o=await fetch(`${e}/v1/users/${t}/holdings`,{cache:"no-store",signal:r});if(!o.ok)throw new Error(`Failed to fetch forge holdings: ${o.status}`);let n=await o.json();if(!n.success)throw new Error("Forge holdings API error");return n.data.items}async function Mi(e,t,r){let o=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store",signal:r});if(!o.ok)return{address:t,image_url:""};let n=await o.json();return n.success?{address:t,image_url:n.data.token.image_url}:{address:t,image_url:""}}function Sn(e,t,r=!0){let o=wo[e],{data:n,...c}=Ri({queryKey:[Ei,e,t],queryFn:({signal:s})=>Si(o,t,s),enabled:!!t&&r,staleTime:0,refetchInterval:r?5e3:!1});return{holdings:n??[],...c}}function Mn(e,t,r=!0){let o=wo[e],n=Ii({queries:t.map(s=>({queryKey:[Pi,e,s],queryFn:({signal:l})=>Mi(o,s,l),enabled:r,staleTime:1/0}))});return{imageMap:Ti(()=>{let s=new Map;for(let l of n)l.data&&s.set(l.data.address,l.data.image_url);return s},[n])}}import{useQuery as _i}from"@tanstack/react-query";import{useMemo as Ai}from"react";var Po="token-stats";function tt(e,t){return`${e}:${t.toLowerCase()}`}function ft(e,t=!0){let r=ge[e],{data:o,...n}=_i({queryKey:[Po,e],queryFn:async({signal:s})=>{let l=await fetch(`${r}/v1/public/token/stats`,{cache:"no-store",signal:s});if(!l.ok)throw new Error(`Failed to fetch token stats: ${l.status}`);let d=await l.json();if(d.code!==200)throw new Error(`Token stats API error: ${d.code}`);return d},enabled:t,staleTime:3e4});return{statsMap:Ai(()=>{let s=new Map;if(!o?.data)return s;for(let l of o.data){let d=tt(l.chain_id,l.address);s.set(d,l)}return s},[o]),...n}}import{useQuery as Oi}from"@tanstack/react-query";import{useMemo as Di}from"react";var Wi="token-info";function So(e,t){return`${t.toLowerCase()}_${e}`}function _n(e,t=!0){let r=ge[e],{data:o,...n}=Oi({queryKey:[Wi,e],queryFn:async({signal:s})=>{let l=await fetch(`${r}/v1/public/token/info`,{cache:"no-store",signal:s});if(!l.ok)throw new Error(`Failed to fetch token info: ${l.status}`);let d=await l.json();if(d.code!==200)throw new Error(`Token info API error: ${d.code}`);return d},enabled:t,staleTime:1/0});return{categoryMap:Di(()=>{let s=new Map;if(!o?.data)return s;for(let l of o.data){let d=So(l.chain_id,l.address);s.set(d,l.category)}return s},[o]),...n}}import{useMemo as Fi}from"react";import Mo from"bignumber.js";function An(e,t,r){let{tokens:o,isLoading:n}=mt(e,t,r),{statsMap:c}=ft(e,r);return Fi(()=>{let s=new Mo(0);for(let a of o){let m=c.get(tt(a.chainId,a.address));if(!m)continue;let w=new Mo(a.quantity.numeric).shiftedBy(-a.quantity.decimals).multipliedBy(new Mo(m.price));w.isNaN()||(s=s.plus(w))}let l=s.toFixed(),{displayValue:d,isLowerBound:i}=mn(l);return{totalUsd:l,displayValue:d,isLowerBound:i,isLoading:n}},[o,c,n])}import{QRCodeSVG as ya}from"qrcode.react";function Re(e,t,r,o){if(!o||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.defaultPrevented)return;e.preventDefault();let n;try{n=o(t,r)}catch(i){console.error("[dapp-ui] onOutlink threw:",i);return}let c=i=>{typeof window>"u"||window.open(i,"_blank","noopener,noreferrer")};if((i=>!!i&&(typeof i=="object"||typeof i=="function")&&typeof i.then=="function")(n)){let i=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null,a=m=>{if(m===null){i?.close();return}let y=m??t;if(i)try{i.location.href=y}catch{i.close(),c(y)}else c(y)};n.then(a,m=>{console.error("[dapp-ui] onOutlink rejected:",m),i?.close()});return}let l=n;if(l===null)return;c(l??t)}import*as nt from"react";import{Drawer as xa}from"vaul";import{createContext as Bi,useContext as Vi}from"react";var Et=Bi(null);function oe(){let e=Vi(Et);if(!e)throw new Error("WalletPortfolio compound components must be used within <WalletPortfolio>");return e}import{Drawer as Hi}from"vaul";import{jsx as On}from"react/jsx-runtime";function Dn({asChild:e,children:t}){let{walletAddress:r}=oe(),o=t!=null,n=e??!0,c=o?t:On("button",{type:"button",children:ue(r)});return On(Hi.Trigger,{asChild:n,children:c})}import{Drawer as Zt}from"vaul";import*as be from"react";import{useQueryClient as wa}from"@tanstack/react-query";import{useMemo as Gi}from"react";import _o from"bignumber.js";import{useQuery as $i}from"@tanstack/react-query";import{useMemo as Bn}from"react";var Ut={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"},Wn={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},zt={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"},Ve={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},Ie={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"},Fn={dev:{cross:"https://stg-dex-api.crosstoken.io/dex",crossd:"https://stg-crossd-dex-api.crosstoken.io/dex",forge:"https://stg-forge-dex-api.crosstoken.io/dex"},stage:{cross:"https://stg-dex-api.crosstoken.io/dex",crossd:"https://stg-crossd-dex-api.crosstoken.io/dex",forge:"https://stg-forge-dex-api.crosstoken.io/dex"},production:{cross:"https://dex-api.crosstoken.io/dex",crossd:"https://crossd-dex-api.crosstoken.io/dex",forge:"https://forge-dex-api.crosstoken.io/dex"}};var Ui="wp:reward-pools";function jt(e,t=!0){let r=Ut[e],{data:o,...n}=$i({queryKey:[Ui,e],queryFn:async({signal:l})=>{let d=await fetch(`${r}/v1/pools`,{cache:"no-store",signal:l});if(!d.ok)throw new Error(`Failed to fetch pools: ${d.status}`);let i=await d.json();if(i.code!==200)throw new Error(`Pools API error: ${i.code}`);return i},enabled:t,staleTime:0}),c=Bn(()=>o?.data.pools.filter(l=>l.pool_type==="CrossPool")??[],[o]),s=Bn(()=>o?.data.pools.filter(l=>l.pool_type==="GamePool")??[],[o]);return{crossPools:c,gamePools:s,allPools:o?.data.pools??[],...n}}import{useQuery as zi}from"@tanstack/react-query";import{useMemo as ji}from"react";var qi="wp:user-deposits";function qt(e,t,r=!0){let o=Ut[e],n=r&&!!t,{data:c,...s}=zi({queryKey:[qi,e,t],queryFn:async({signal:d})=>{let i=await fetch(`${o}/v1/users/${t}/deposits`,{cache:"no-store",signal:d});if(!i.ok)throw new Error(`Deposits fetch failed: ${i.status}`);let a=await i.json();if(a.code!==200)throw new Error(`Deposits API error: ${a.code}`);return a},enabled:n,staleTime:0});return{depositMap:ji(()=>{let d=new Map;if(!c?.data.user_deposits)return d;for(let i of c.data.user_deposits)d.set(i.pool_address.toLowerCase(),i);return d},[c]),deposits:c?.data.user_deposits??[],...s}}import{useQuery as Vn}from"@tanstack/react-query";import{useMemo as Hn}from"react";function Te(e,t,r,o=!0){let n=Fn[e][t],c=o&&!!r,{data:s,...l}=Vn({queryKey:["wp:dex-pairs",e,t],queryFn:async({signal:g})=>{let f=await fetch(`${n}/pair-info`,{cache:"no-store",signal:g});if(!f.ok)throw new Error(`pair-info fetch failed: ${f.status}`);let h=await f.json();if(h.code!==200)throw new Error(`pair-info API error: ${h.code}`);return h},enabled:o,staleTime:0}),d=s?.data??[],i=Hn(()=>{let g=new Map;for(let f of d)g.set(f.pair_address.toLowerCase(),f);return g},[d]),{data:a,...m}=Vn({queryKey:["wp:dex-orders",e,t,r],queryFn:async({signal:g})=>{let f=Math.floor(Date.now()/1e3),h=new URLSearchParams({owner:r,size:"200",start_date:"0",end_date:String(f)}),R=await fetch(`${n}/open-order?${h}`,{cache:"no-store",signal:g});if(!R.ok)throw new Error(`open-order fetch failed: ${R.status}`);let L=await R.json();if(L.code!==200)throw new Error(`open-order API error: ${L.code}`);return L.data?.data??[]},enabled:c,staleTime:0}),y=a??[],w=Hn(()=>{let g=new Map;for(let f of y){let h=f.pair.toLowerCase();g.has(h)||g.set(h,{buys:[],sells:[]});let R=g.get(h);f.order_side===1?R.buys.push(f):R.sells.push(f)}return g},[y]);return{allPairs:d,pairMap:i,orders:y,ordersByPair:w,isEmpty:y.length===0,isLoading:l.isLoading||m.isLoading}}var Zi=["var(--wp-blue)","var(--wp-purple)","var(--wp-red)","var(--wp-orange)"],$n="var(--wp-green)",Un=4;function zn(e,t,r=!0){let o=r&&!!t,{allPools:n}=jt(e,o),{depositMap:c}=qt(e,t,o),{allPairs:s,pairMap:l,ordersByPair:d}=Te(e,"cross",t,o),{allPairs:i,pairMap:a,ordersByPair:m}=Te(e,"crossd",t,o),{allPairs:y,pairMap:w,ordersByPair:g}=Te(e,"forge",t,o);return Gi(()=>{let f=new Map,h=new Map,R=(b,N)=>{!Number.isFinite(N)||N<=0||h.set(b,(h.get(b)??0)+N)};for(let b of n){let N=Number(b.deposit_token.price);N>0&&f.set(b.deposit_token.symbol,N);for(let V of b.reward_tokens){let I=Number(V.price);I>0&&f.set(V.symbol,I)}}for(let b of[...s,...i,...y]){let N=f.get(b.quote_symbol),V=Number(b.billboard?.price);N&&V>0&&!f.has(b.base_symbol)&&f.set(b.base_symbol,V*N)}for(let b of n){let N=c.get(b.pool_address.toLowerCase());if(!N)continue;let V=new _o(N.deposited_amount).shiftedBy(-b.deposit_token.decimals).toNumber();if(R(b.deposit_token.symbol,V),b.reward_tokens.length>0){let I=b.reward_tokens[0],Y=new _o(N.claimable_reward).shiftedBy(-I.decimals).toNumber();R(I.symbol,Y)}}let L=[{pairMap:l,ordersByPair:d},{pairMap:a,ordersByPair:m},{pairMap:w,ordersByPair:g}];for(let{pairMap:b,ordersByPair:N}of L)for(let[V,I]of N){let Y=b.get(V);if(Y){for(let j of I.buys){let X=Number(j.amount)-Number(j.filled);R(Y.quote_symbol,X*Number(j.price))}for(let j of I.sells){let X=Number(j.amount)-Number(j.filled);R(Y.base_symbol,X)}}}let O=[],C=0;for(let[b,N]of h){let V=f.get(b)??0,I=N*V;I>0&&(O.push({symbol:b,usdValue:I}),C+=I)}O.sort((b,N)=>N.usdValue-b.usdValue);let B=[];if(C>0){let b=O.slice(0,Un),N=O.slice(Un);for(let I=0;I<b.length;I++)B.push({symbol:b[I].symbol,usdValue:b[I].usdValue,percentage:Math.round(b[I].usdValue/C*100),color:Zi[I]??$n});if(N.length>0){let I=N.reduce((Y,j)=>Y+j.usdValue,0);B.push({symbol:"Others",usdValue:I,percentage:Math.round(I/C*100),color:$n})}let V=B.reduce((I,Y)=>I+Y.percentage,0);V!==100&&B.length>0&&(B[0].percentage+=100-V)}return{totalUsd:C,formattedTotal:C>0?`$${new _o(C).toFormat(2)}`:"$0.00",segments:B}},[n,c,s,l,d,i,a,m,y,w,g])}import{jsx as ut,jsxs as Ki}from"react/jsx-runtime";function jn({size:e=22,className:t}){return ut("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ut("path",{d:"M14 4L7 11L14 18",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function qn({size:e=22,className:t}){return Ki("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[ut("path",{d:"M18.333 3.667v5.5h-5.5",stroke:"currentColor",strokeWidth:1.833,strokeLinecap:"round",strokeLinejoin:"round"}),ut("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 Gn({size:e=12,className:t}){return ut("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ut("path",{d:"M6 11A5 5 0 106 1a5 5 0 000 10zM6 8V6M6 4h.005",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})})}import{useQuery as Yi}from"@tanstack/react-query";import{useMemo as Qi}from"react";var Xi="wp:token-info";function He(e,t=!0){let r=ge[e],o=se[e].cross,{data:n,...c}=Yi({queryKey:[Xi,e],queryFn:async({signal:i})=>{let a=await fetch(`${r}/v1/public/token/info`,{cache:"no-store",signal:i});if(!a.ok)throw new Error(`Failed to fetch token info: ${a.status}`);let m=await a.json();if(m.code!==200)throw new Error(`Token info API error: ${m.code}`);return m},enabled:t,staleTime:300*1e3}),{byChainAddr:s,byChainSym:l}=Qi(()=>{let i=new Map,a=new Map;if(!n?.data)return{byChainAddr:i,byChainSym:a};for(let m of n.data){let y=m.address.toLowerCase();i.set(`${m.chain_id}:${y}`,m),i.set(y,m);let w=m.symbol.replace(/^t/,"").toUpperCase(),g=`${m.chain_id}:${w}`;a.has(g)||a.set(g,m),a.has(w)||a.set(w,m)}return{byChainAddr:i,byChainSym:a}},[n]);return{getTokenImage:(i,a)=>{let m=i.toLowerCase(),y=s.get(`${o}:${m}`);if(y?.image)return y.image;let w=s.get(m);if(w?.image)return w.image;if(a){let g=a.replace(/^t/,"").toUpperCase(),f=l.get(`${o}:${g}`);if(f?.image)return f.image;let h=l.get(g);if(h?.image)return h.image}return""},...c}}import{jsx as Gt,jsxs as Zn}from"react/jsx-runtime";function Ee({title:e,icon:t,iconFit:r="cover",isEmpty:o,children:n}){return Zn("div",{className:"wp-svc-card",children:[Zn("div",{className:"wp-svc-card-head",children:[Gt("img",{className:"wp-svc-card-icon",src:t,alt:"",style:{objectFit:r}}),Gt("span",{className:"wp-svc-card-title",children:e})]}),o?Gt("div",{className:"wp-svc-empty",children:"No assets yet"}):Gt("div",{className:"wp-svc-items",children:n})]})}import Pt from"bignumber.js";import{jsx as ot,jsxs as Se}from"react/jsx-runtime";var Ji="CROSS Rewards";function Kn(e,t){let r=new Pt(e).shiftedBy(-t);return r.isZero()?"0":r.isGreaterThanOrEqualTo(1)?r.toFormat(2,Pt.ROUND_DOWN):r.toFormat(4,Pt.ROUND_DOWN)}function Yn(){let{env:e,walletAddress:t,onOutlink:r}=oe(),o=!!t,{allPools:n}=jt(e,o),{depositMap:c}=qt(e,t,o),{getTokenImage:s}=He(e,o),l=a=>`${Wn[e]}/rewards/${a.pool_address}?action=withdraw`,d=`${Ie[e]}/reward.png`,i=n.filter(a=>{let m=c.get(a.pool_address.toLowerCase()),y=m?.deposited_amount??"0",w=m?.claimable_reward??"0";return!(new Pt(y).isZero()&&new Pt(w).isZero())});return ot(Ee,{title:Ji,icon:d,isEmpty:i.length===0,children:i.map(a=>{let m=c.get(a.pool_address.toLowerCase()),y=m?.deposited_amount??"0",w=l(a);return Se("a",{className:"wp-item","data-side":"reward",href:w,target:"_blank",rel:"noopener noreferrer",onClick:g=>Re(g,w,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:a,userDeposit:m}},r),children:[Se("div",{className:"wp-item-body",children:[Se("div",{className:"wp-item-field",children:[Se("span",{className:"wp-item-label",children:["Deposited (",a.deposit_token.symbol,")"]}),Se("div",{className:"wp-svc-token",children:[s(a.deposit_token.address,a.deposit_token.symbol)&&ot("img",{className:"wp-svc-token-icon",src:s(a.deposit_token.address,a.deposit_token.symbol),alt:""}),ot("span",{children:Kn(y,a.deposit_token.decimals)})]})]}),Se("div",{className:"wp-item-field",children:[Se("span",{className:"wp-item-label",children:["Rewards (",a.reward_tokens.map(g=>g.symbol).join(", "),")"]}),a.reward_tokens.map(g=>{let f=s(g.address,g.symbol);return Se("div",{className:"wp-svc-token",children:[f&&ot("img",{className:"wp-svc-token-icon",src:f,alt:""}),ot("span",{children:m?Kn(m.claimable_reward,g.decimals):"0"})]},g.address)})]})]}),Se("div",{className:"wp-item-badges",children:[ot("span",{className:"wp-badge wp-badge--mint",children:"Claim"}),ot("span",{className:"wp-badge wp-badge--muted",children:"Withdraw"})]})]},a.pool_address)})})}import Xn from"bignumber.js";import{Fragment as ea,jsx as pe,jsxs as ne}from"react/jsx-runtime";function Ao(e){let t=new Xn(e);if(t.isNaN())return e;let r=t.decimalPlaces()??0;return t.toFormat(r)}function Qn(e){let t=new Xn(e.amount).minus(e.filled);return Ao(t.toString())}function gt({market:e,pairMap:t,ordersByPair:r,getDexUrl:o,getTokenImage:n}){let{onOutlink:c}=oe(),s=[];for(let[l,d]of r){let i=t.get(l),a=i?n(i.base_address,i.base_symbol):"",m=i?n(i.quote_address,i.quote_symbol):"",y=o(l);for(let w of d.buys)s.push(ne("a",{className:"wp-item","data-side":"buy",href:y,target:"_blank",rel:"noopener noreferrer",onClick:g=>Re(g,y,{category:"portfolio",origin:"portfolio-dex-order",payload:{market:e,side:"buy",order:w,pair:i}},c),children:[ne("div",{className:"wp-item-body",children:[ne("div",{className:"wp-item-field",children:[ne("span",{className:"wp-item-label wp-item-label--buy",children:["Buy",i?.base_symbol?` (${i.base_symbol})`:""]}),ne("div",{className:"wp-svc-token",children:[a&&pe("img",{className:"wp-svc-token-icon",src:a,alt:""}),pe("span",{children:Qn(w)})]})]}),ne("div",{className:"wp-item-field",children:[ne("span",{className:"wp-item-label",children:["Price",i?.quote_symbol?` (${i.quote_symbol})`:""]}),ne("div",{className:"wp-svc-token",children:[m&&pe("img",{className:"wp-svc-token-icon",src:m,alt:""}),pe("span",{children:Ao(w.price)})]})]})]}),pe("div",{className:"wp-item-badges",children:pe("span",{className:"wp-badge wp-badge--red",children:"Cancel"})})]},`buy-${w.order_id}`));for(let w of d.sells)s.push(ne("a",{className:"wp-item","data-side":"sell",href:y,target:"_blank",rel:"noopener noreferrer",onClick:g=>Re(g,y,{category:"portfolio",origin:"portfolio-dex-order",payload:{market:e,side:"sell",order:w,pair:i}},c),children:[ne("div",{className:"wp-item-body",children:[ne("div",{className:"wp-item-field",children:[ne("span",{className:"wp-item-label wp-item-label--sell",children:["Sell",i?.base_symbol?` (${i.base_symbol})`:""]}),ne("div",{className:"wp-svc-token",children:[a&&pe("img",{className:"wp-svc-token-icon",src:a,alt:""}),pe("span",{children:Qn(w)})]})]}),ne("div",{className:"wp-item-field",children:[ne("span",{className:"wp-item-label",children:["Price",i?.quote_symbol?` (${i.quote_symbol})`:""]}),ne("div",{className:"wp-svc-token",children:[m&&pe("img",{className:"wp-svc-token-icon",src:m,alt:""}),pe("span",{children:Ao(w.price)})]})]})]}),pe("div",{className:"wp-item-badges",children:pe("span",{className:"wp-badge wp-badge--red",children:"Cancel"})})]},`sell-${w.order_id}`))}return pe(ea,{children:s})}import{jsx as Jn}from"react/jsx-runtime";var ta="Gametoken - CROSS";function er(){let{env:e,walletAddress:t}=oe(),r=!!t,{pairMap:o,ordersByPair:n,isEmpty:c}=Te(e,"cross",t,r),{getTokenImage:s}=He(e,r),l=i=>{let a=o.get(i.toLowerCase());return`${Ve[e]}/gametoken/cross/${a?.base_symbol??""}`},d=`${Ie[e]}/dex.png`;return Jn(Ee,{title:ta,icon:d,isEmpty:c,children:Jn(gt,{market:"cross",pairMap:o,ordersByPair:n,getDexUrl:l,getTokenImage:s})})}import{jsx as tr}from"react/jsx-runtime";var oa="Gametoken - CROSSD";function or(){let{env:e,walletAddress:t}=oe(),r=!!t,{pairMap:o,ordersByPair:n,isEmpty:c}=Te(e,"crossd",t,r),{getTokenImage:s}=He(e,r),l=i=>{let a=o.get(i.toLowerCase());return`${Ve[e]}/gametoken/crossd/${a?.base_symbol??""}`},d=`${Ie[e]}/dex.png`;return tr(Ee,{title:oa,icon:d,isEmpty:c,children:tr(gt,{market:"crossd",pairMap:o,ordersByPair:n,getDexUrl:l,getTokenImage:s})})}import{jsx as nr}from"react/jsx-runtime";var na="Gametoken - Forge";function rr(){let{env:e,walletAddress:t}=oe(),r=!!t,{pairMap:o,ordersByPair:n,isEmpty:c}=Te(e,"forge",t,r),{getTokenImage:s}=He(e,r);if(c)return null;let l=i=>{let a=o.get(i.toLowerCase());return`${Ve[e]}/gametoken/forge/${a?.base_symbol??""}`},d=`${Ie[e]}/dex.png`;return nr(Ee,{title:na,icon:d,isEmpty:c,children:nr(gt,{market:"forge",pairMap:o,ordersByPair:n,getDexUrl:l,getTokenImage:s})})}import Oo from"bignumber.js";import{useMemo as da}from"react";import{useQuery as ra}from"@tanstack/react-query";var ia="wp:forge-pools";function ir(e,t,r=!0){let o=zt[e],n=r&&!!t,{data:c,...s}=ra({queryKey:[ia,e,t],queryFn:async()=>{let d=await fetch(`${o}/v1/users/${t}/pools`,{cache:"no-store"});if(!d.ok)throw new Error(`forge pools fetch failed: ${d.status}`);return(await d.json()).data?.items??[]},enabled:n,staleTime:0}),l=c??[];return{pools:l,isEmpty:l.length===0,...s}}import{useQueries as aa}from"@tanstack/react-query";import{useMemo as sa}from"react";var la="wp:forge-token-detail";async function ca(e,t){let r=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store"});return r.ok?(await r.json())?.data?.token??null:null}function ar(e,t,r=!0){let o=zt[e],n=aa({queries:t.map(l=>({queryKey:[la,e,l],queryFn:()=>ca(o,l),enabled:r&&!!l,staleTime:3e4}))}),c=sa(()=>{let l=new Map;for(let d=0;d<n.length;d++){let i=n[d]?.data,a=t[d];i&&a&&l.set(a.toLowerCase(),i)}return l},[n,t]),s=n.some(l=>l.isLoading);return{detailMap:c,isLoading:s}}import{jsx as he,jsxs as wt}from"react/jsx-runtime";var pa="Forge",ma=18,fa="https://contents.crosstoken.io/wallet/token/images/FT.png";function ua(e){if(!e||e==="0")return"0";let t=new Oo(e).shiftedBy(-ma);return t.isZero()?"0":t.isGreaterThanOrEqualTo(1)?t.toFormat(2,Oo.ROUND_DOWN):t.toFormat(4,Oo.ROUND_DOWN)}function ga(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 sr(){let{env:e,walletAddress:t,onOutlink:r}=oe(),o=!!t,{pools:n,isEmpty:c}=ir(e,t,o),s=da(()=>n.map(a=>a.token.address),[n]),{detailMap:l}=ar(e,s,o&&s.length>0),d=a=>`${Ve[e]}/forge/token/${a.token.address}`,i=`${Ie[e]}/forge.png`;return he(Ee,{title:pa,icon:i,iconFit:"contain",isEmpty:c,children:n.map(a=>{let m=l.get(a.token.address.toLowerCase()),y=m?.image_url||m?.image||a.token.image||fa,w=m?.symbol||a.token.symbol,g=d(a);return wt("a",{className:"wp-item","data-side":"lp",href:g,target:"_blank",rel:"noopener noreferrer",onClick:f=>Re(f,g,{category:"portfolio",origin:"portfolio-forge",payload:{pool:a,tokenDetail:m}},r),children:[wt("div",{className:"wp-item-body",children:[wt("div",{className:"wp-item-field",children:[wt("span",{className:"wp-item-label",children:["Pair (",w,")"]}),he("div",{className:"wp-svc-token",children:he("img",{className:"wp-svc-token-icon",src:y,alt:""})})]}),wt("div",{className:"wp-item-field",children:[he("span",{className:"wp-item-label",children:"LP Balance"}),he("div",{className:"wp-svc-token",children:he("span",{children:ua(a.lp_balance)})})]}),wt("div",{className:"wp-item-field",children:[he("span",{className:"wp-item-label",children:"Ownership"}),he("div",{className:"wp-svc-token",children:he("span",{children:ga(a.pool_ownership)})})]})]}),he("div",{className:"wp-item-badges",children:he("span",{className:"wp-badge wp-badge--mint",children:"Withdraw"})})]},a.pair_address)})})}M(`.wp-fullscreen[data-theme=dark],.wp-embed[data-theme=dark]{--wp-bg: var(--cck-surface-bg, #202530);--wp-card: var(--cck-surface-default, #292f40);--wp-border: var(--cck-border-default, #313b51);--wp-text: var(--cck-texticon-primary, #ffffff);--wp-text-60: var(--cck-texticon-secondary, #d3d7df);--wp-text-40: #8c97ad;--wp-text-30: var(--cck-texticon-tertiary, #717d97);--wp-mint: #00d4aa;--wp-green: var(--cck-primary, #019d92);--wp-red: var(--cck-error, #e70077);--wp-blue: #0488fc;--wp-purple: #7346f3;--wp-orange: #ff9d00}.wp-fullscreen[data-theme=light],.wp-embed[data-theme=light]{--wp-bg: var(--cck-surface-bg, #f5f6f8);--wp-card: var(--cck-surface-default, #ffffff);--wp-border: var(--cck-border-default, #e2e5ea);--wp-text: var(--cck-texticon-primary, #202530);--wp-text-60: var(--cck-texticon-secondary, #49556e);--wp-text-40: #8c97ad;--wp-text-30: var(--cck-texticon-tertiary, #a0a9b8);--wp-mint: #00d4aa;--wp-green: var(--cck-primary, #019d92);--wp-red: var(--cck-error, #e70077);--wp-blue: #0488fc;--wp-purple: #7346f3;--wp-orange: #ff9d00}.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:Sora,sans-serif;font-feature-settings:"calt" 0,"lnum" 1,"pnum" 1;box-sizing:border-box;-webkit-font-smoothing:antialiased}.wp-embed{width:100%;height:100%;min-height:0;background:var(--wp-bg);display:flex;flex-direction:column;overflow:hidden;font-family:Sora,sans-serif;font-feature-settings:"calt" 0,"lnum" 1,"pnum" 1;box-sizing:border-box;-webkit-font-smoothing:antialiased;color:var(--wp-text)}.wp-overlay{position:fixed;inset:0;z-index:49;background:#0009}.wp-header{display:flex;align-items:center;gap:20px;height:60px;padding:0 20px;flex-shrink:0}.wp-header-btn{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--wp-text);flex-shrink:0}.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:Roboto,Sora,sans-serif;font-size:16px;font-weight:600;line-height:24px;letter-spacing:.15px;text-align:center;color:var(--wp-text);margin:0}.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:rgba(255,255,255,.08) transparent}.wp-body::-webkit-scrollbar{width:4px}.wp-body::-webkit-scrollbar-track{background:transparent}.wp-body::-webkit-scrollbar-thumb{background:#ffffff14;border-radius:4px}.wp-body-inner{padding:16px 16px 128px;display:flex;flex-direction:column;gap:20px}.wp-svc-card{display:flex;flex-direction:column;gap:8px}.wp-svc-card-head{display:flex;align-items:center;gap:8px}.wp-svc-card-icon{width:20px;height:20px;border-radius:4px;flex-shrink:0;object-fit:cover}.wp-svc-card-title{font-size:14px;font-weight:600;line-height:1.3;color:var(--wp-text-60);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wp-svc-items{display:flex;flex-direction:column;gap:10px}.wp-item{position:relative;background:var(--wp-card);border-radius:12px;padding:14px 40px 14px 16px;display:flex;flex-direction:column;gap:6px;box-shadow:0 1px 3px #00000014,0 2px 8px #0000000a;overflow:hidden;text-decoration:none;cursor:pointer;transition:box-shadow .2s ease,transform .15s ease}.wp-item:hover{box-shadow:0 2px 6px #0000001f,0 4px 14px #0000000f;transform:translateY(-1px)}.wp-item:active{transform:translateY(0);box-shadow:0 1px 3px #00000014}.wp-item:before{content:"";position:absolute;top:0;left:0;width:3px;height:100%;border-radius:3px 0 0 3px;background:var(--wp-border)}.wp-item:after{content:"";position:absolute;right:14px;top:50%;transform:translateY(-50%);width:12px;height:12px;background:currentColor;opacity:.25;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3.5 1.5h7v7M10.5 1.5L1.5 10.5' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3.5 1.5h7v7M10.5 1.5L1.5 10.5' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;transition:opacity .15s}.wp-item:hover:after{opacity:.5}.wp-item[data-side=buy]:before{background:var(--wp-green)}.wp-item[data-side=sell]:before{background:var(--wp-red)}.wp-item[data-side=reward]:before{background:var(--wp-mint)}.wp-item[data-side=lp]:before{background:var(--wp-purple)}.wp-item-body{display:flex;gap:12px}.wp-item-field{flex:1;display:flex;flex-direction:column;gap:4px;min-width:0}.wp-item-label{font-size:11px;font-weight:500;line-height:1.3;color:var(--wp-text-40);letter-spacing:.03em;text-transform:uppercase}.wp-item-label--buy{color:var(--wp-green)}.wp-item-label--sell{color:var(--wp-red)}.wp-svc-token{display:flex;align-items:center;gap:8px;min-width:0}.wp-svc-token>span{font-size:14px;font-weight:600;line-height:1.4;color:var(--wp-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-svc-token-icon{width:22px;height:22px;border-radius:50%;flex-shrink:0;object-fit:cover}.wp-svc-buy{color:var(--wp-green)}.wp-svc-sell{color:var(--wp-red)}.wp-badge{display:inline-flex;align-items:center;font-size:10px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;padding:2px 7px;border-radius:4px;border:1px solid transparent;pointer-events:none}.wp-badge--mint{color:var(--wp-mint);background:#00d4aa1a;border-color:#00d4aa40}.wp-badge--muted{color:var(--wp-text-40);background:#8c97ad14;border-color:#8c97ad2e}.wp-badge--red{color:var(--wp-red);background:#e7007714;border-color:#e7007733}.wp-item-badges{display:flex;align-items:center;gap:6px}.wp-svc-empty{display:flex;align-items:center;justify-content:center;height:56px;background:var(--wp-card);border-radius:12px;font-size:13px;font-weight:400;color:var(--wp-text-30);box-shadow:0 1px 3px #00000014}@media(max-width:375px){.wp-header{gap:12px;padding:0 12px}.wp-top{padding:0 12px 12px;gap:12px}.wp-total{font-size:22px}.wp-legend{gap:10px}.wp-legend-label{font-size:11px}.wp-body-inner{padding:12px 12px 128px;gap:14px}.wp-svc-items{gap:8px}.wp-item{padding:12px 36px 12px 14px;gap:6px;border-radius:10px}.wp-item:after{right:10px;width:11px;height:11px}.wp-item-body{gap:10px}.wp-svc-token{gap:6px}.wp-svc-token>span{font-size:13px}.wp-svc-token-icon{width:20px;height:20px}}.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}
7
- `);import{Fragment as ba,jsx as U,jsxs as $e}from"react/jsx-runtime";var Do=5,ha="wp:";function ht({env:e,theme:t="dark",walletAddress:r,onBack:o,showHeader:n=!0,variant:c="embed",className:s,sendTransaction:l,onOutlink:d}){let i=ce(e),a=!!r,m=wa(),{segments:y}=zn(i,r,a),[w,g]=be.useState(Do),[f,h]=be.useState(!1),R=be.useCallback(()=>{m.invalidateQueries({predicate:b=>typeof b.queryKey[0]=="string"&&b.queryKey[0].startsWith(ha)})},[m]),L=be.useCallback(()=>{R(),h(!0),setTimeout(()=>h(!1),600),g(Do)},[R]);be.useEffect(()=>{if(!a)return;let b=setInterval(()=>{g(N=>N<=1?(L(),Do):N-1)},1e3);return()=>clearInterval(b)},[a,L]);let O=be.useCallback(()=>{o?.()},[o]),C=be.useMemo(()=>({env:i,theme:t,open:!0,walletAddress:r,close:O,sendTransaction:l,onOutlink:d}),[i,t,r,O,l,d]),B=$e(ba,{children:[n&&$e("div",{className:"wp-header",children:[o?U("button",{type:"button",className:"wp-header-btn",onClick:o,children:U(jn,{})}):U("span",{className:"wp-header-btn","aria-hidden":!0}),U("h2",{className:"wp-header-title",children:"My Portfolio"}),$e("button",{type:"button",className:"wp-header-btn wp-refresh-btn",onClick:L,children:[U(qn,{className:f?"wp-spin-once":void 0}),a&&U("span",{className:"wp-refresh-badge",children:w})]})]}),U("div",{className:"wp-top",children:y.length>0&&$e("div",{className:"wp-asset",children:[$e("div",{className:"wp-asset-head",children:[U("span",{className:"wp-asset-head-label",children:"Consolidated Asset"}),U("span",{className:"wp-asset-head-icon",children:U(Gn,{})})]}),U("div",{className:"wp-bar",children:y.map(b=>U("div",{className:"wp-bar-seg",style:{flex:`${b.percentage} 0 0`,background:b.color},children:b.percentage>=5&&$e("span",{className:"wp-bar-seg-pct",children:[b.percentage,"%"]})},b.symbol))}),U("div",{className:"wp-legend",children:y.map(b=>$e("div",{className:"wp-legend-item",children:[U("span",{className:"wp-legend-dot",style:{background:b.color}}),U("span",{className:"wp-legend-label",children:b.symbol})]},b.symbol))})]})}),U("div",{className:"wp-body",children:$e("div",{className:"wp-body-inner",children:[U(Yn,{}),U(er,{}),U(or,{}),U(rr,{}),U(sr,{})]})})]});return U(Et.Provider,{value:C,children:c==="none"?B:U("div",{className:Z(c==="fullscreen"?"wp-fullscreen":"wp-embed",s),"data-theme":t,children:B})})}import{jsx as Wo,jsxs as lr}from"react/jsx-runtime";function cr({className:e}){let{env:t,theme:r,walletAddress:o,close:n,sendTransaction:c}=oe();return lr(Zt.Portal,{children:[Wo(Zt.Overlay,{className:"wp-overlay"}),lr(Zt.Content,{className:Z("wp-fullscreen",e),"data-theme":r,children:[Wo(Zt.Title,{className:"wp-sr-only",children:"My Portfolio"}),Wo(ht,{env:t,theme:r,walletAddress:o,onBack:n,variant:"none",sendTransaction:c})]})]})}import{jsx as dr}from"react/jsx-runtime";function va({env:e,theme:t="dark",walletAddress:r,open:o,onOpenChange:n,sendTransaction:c,onOutlink:s,children:l}){let d=ce(e),i=o!==void 0,[a,m]=nt.useState(!1),y=i?o:a,w=nt.useCallback(h=>{i||m(h),n?.(h)},[i,n]),g=nt.useCallback(()=>w(!1),[w]),f=nt.useMemo(()=>({env:d,theme:t,open:y,walletAddress:r,close:g,sendTransaction:c,onOutlink:s}),[d,t,y,r,g,c,s]);return dr(Et.Provider,{value:f,children:dr(xa.Root,{direction:"bottom",open:y,onOpenChange:w,noBodyStyles:!0,children:l})})}var pr=Object.assign(va,{Trigger:Dn,Content:cr});import{Fragment as Bo,jsx as p,jsxs as k}from"react/jsx-runtime";function Fo(e,t,r){let o=se[e],n=r.toUpperCase();if(t===o.cross&&n.includes("CROSSD"))return 0;if(t===o.cross&&n==="CROSS")return 1;if(t===o.bsc&&n==="CROSS")return 2}function ka(e){return parseInt(e.split(":")[1],10)}function Ca(e){let t=e.lastIndexOf(".");return t===-1?{main:e,decimal:""}:{main:e.slice(0,t),decimal:e.slice(t)}}function Na(e){let t=e.toLowerCase().replace(/^0x/,""),r=t.length>=8?t.slice(0,8):t.padEnd(8,"0"),o=parseInt(r.slice(0,4),16)%360,n=(o+60+parseInt(r.slice(4,8),16)%120)%360;return`linear-gradient(135deg, hsl(${o} 85% 65%), hsl(${n} 80% 55%))`}function mr({align:e="end",sideOffset:t=12,className:r,children:o}){let{env:n,theme:c,isMobile:s,open:l,drawerDirection:d,modal:i,showBalance:a,showForgeToken:m,showGameToken:y,showQR:w,qrLogoSrc:g,walletAddress:f,accountName:h,sendAccounts:R,profileImageUrl:L,preferredTokens:O,close:C,onSelectWallet:B,onCopyAddress:b,onDisconnect:N,disconnectLabel:V,termsUrl:I,termsLabel:Y,privacyUrl:j,privacyLabel:X,portalStyle:_e,navContent:we,navPosition:Ae,footerContent:xe,view:q,setView:J,selectedSendToken:ve,setSelectedSendToken:re,showPortfolio:qe,portfolioTitle:Oe,showTotalAssets:rt,totalAssetsLabel:Pe,sendTransaction:ye,getTransactionReceipt:De,onOutlink:ke}=Be(),{tokens:le,isLoading:me}=mt(n,f,l&&a),{statsMap:We}=ft(n,a),{categoryMap:fe}=_n(n,a),Ce=a&&rt,{displayValue:Ge,isLowerBound:it,isLoading:yt}=An(n,f,l&&Ce),[Ne,u]=F.useState(!1),P=F.useRef(null),[D,H]=F.useState(0),{holdings:G,isLoading:ee}=Sn(n,f,l&&a&&m),Ze=F.useMemo(()=>G.map(x=>x.token),[G]),{imageMap:Ke}=Mn(n,Ze,m&&G.length>0),at=F.useMemo(()=>{let x=[],_=[],W=[],Q=new Map((O??[]).map((A,K)=>[`${ka(A.chainId)}:${A.address.toLowerCase()}`,K]));for(let A of le){let K=Fo(n,A.chainId,A.symbol)!==void 0,Ye=`${A.chainId}:${A.address.toLowerCase()}`,Qe=Q.get(Ye),co=new St(A.quantity.numeric).shiftedBy(-A.quantity.decimals);if(K)x.push(A);else if(Qe!==void 0)_.push(A);else if(co.isGreaterThan(0)){if(!y&&fe.get(So(A.chainId,A.address))==="game")continue;W.push(A)}}return x.sort((A,K)=>{let Ye=Fo(n,A.chainId,A.symbol)??99,Qe=Fo(n,K.chainId,K.symbol)??99;return Ye-Qe}),_.sort((A,K)=>{let Ye=Q.get(`${A.chainId}:${A.address.toLowerCase()}`)??99,Qe=Q.get(`${K.chainId}:${K.address.toLowerCase()}`)??99;return Ye-Qe}),W.sort((A,K)=>{let Ye=We.get(tt(A.chainId,A.address)),Qe=We.get(tt(K.chainId,K.address)),co=new St(A.quantity.numeric).shiftedBy(-A.quantity.decimals).multipliedBy(Ye?.price??0);return new St(K.quantity.numeric).shiftedBy(-K.quantity.decimals).multipliedBy(Qe?.price??0).minus(co).toNumber()}),[...x,..._,...W]},[le,n,We,y,fe,O]),kt=F.useMemo(()=>{if(!m)return[];let x=new Set(le.map(_=>_.address.toLowerCase()));return[...G].filter(_=>!x.has(_.token.toLowerCase())).sort((_,W)=>{let Q=new St(_.value);return new St(W.value).minus(Q).toNumber()})},[G,m,le]),st=F.useRef(!1),Fe=F.useCallback(x=>{st.current=!0,J(x)},[J]),_r=F.useCallback(()=>{re(null),Fe("wallet")},[re,Fe]),Ar=F.useCallback(x=>{re(x),Fe("send")},[re,Fe]),Or=F.useCallback(()=>{re(null),Fe("wallet")},[re,Fe]);F.useEffect(()=>{l||(st.current=!1)},[l]);let Uo=F.useRef(null);F.useEffect(()=>{let x=Uo.current;if(!x||!s)return;let _=W=>{W.pointerType==="touch"&&W.stopPropagation()};return x.addEventListener("pointerdown",_),()=>x.removeEventListener("pointerdown",_)},[s]);let[Ct,zo]=F.useState(!1),ao=F.useRef(void 0);F.useEffect(()=>()=>clearTimeout(ao.current),[]),F.useEffect(()=>{let x=P.current;if(!x||xe===null){H(0);return}let _=()=>{H(x.offsetHeight)};if(_(),typeof ResizeObserver>"u")return;let W=new ResizeObserver(_);return W.observe(x),()=>W.disconnect()},[xe]);let jo=F.useCallback(async()=>{if(!Ct)try{await navigator.clipboard.writeText(f),zo(!0),clearTimeout(ao.current),ao.current=setTimeout(()=>zo(!1),2e3),b?.(f,!0)}catch{b?.(f,!1)}},[f,b,Ct]),so=F.useCallback(x=>{x.currentTarget.setAttribute("data-loaded","true")},[]),Dr=F.useMemo(()=>({background:Na(f)}),[f]),qo=F.useMemo(()=>L||Lt(n,f,{size:120,bg:c==="dark"?"1A1A2E":"F3F6F8"}),[L,n,f,c]),lo=F.useMemo(()=>Ca(Ge),[Ge]),Wr=I||j?k("div",{className:"wi-legal-links",children:[I&&p("a",{className:"wi-legal-link",href:I,target:"_blank",rel:"noopener noreferrer",onClick:x=>Re(x,I,{category:"terms",origin:"terms"},ke),children:Y}),I&&j&&p("span",{className:"wi-legal-sep","aria-hidden":!0,children:"\xB7"}),j&&p("a",{className:"wi-legal-link",href:j,target:"_blank",rel:"noopener noreferrer",onClick:x=>Re(x,j,{category:"privacy",origin:"privacy"},ke),children:X})]}):null,Go=N?k("button",{type:"button",className:"wi-disconnect-btn",onClick:()=>{N(),C()},children:[p(gn,{size:12}),p("span",{className:"wi-disconnect-label",children:V})]}):null,Fr=k("div",{className:Z("wi-view-inner",st.current&&"wi-view-wallet"),children:[Ce&&(()=>{let x=qe;return k(x?"button":"div",{...x?{type:"button",onClick:()=>Fe("portfolio"),"aria-label":"View Portfolio"}:{},className:"wi-total-section","data-clickable":x||void 0,children:[k("div",{className:"wi-total-head",children:[p("span",{className:"wi-total-label",children:Pe}),p("span",{role:"button",tabIndex:0,className:"wi-total-eye",onClick:W=>{W.stopPropagation(),u(Q=>!Q)},onKeyDown:W=>{(W.key==="Enter"||W.key===" ")&&(W.preventDefault(),W.stopPropagation(),u(Q=>!Q))},"aria-label":Ne?"Show balance":"Hide balance",children:Ne?p(yn,{}):p(vn,{})})]}),k("div",{className:"wi-total-body",children:[yt?p("div",{className:"wi-skeleton-block wi-total-skeleton",style:{width:160,height:36}}):p("div",{className:"wi-total-value","data-hidden":Ne||void 0,children:Ne?p("span",{className:"wi-total-mask",children:"\u2022\u2022\u2022\u2022\u2022\u2022"}):k(Bo,{children:[it&&p("span",{className:"wi-total-lte",children:"\u2264"}),p("span",{className:"wi-total-currency",children:"$"}),p("span",{className:"wi-total-amount",children:lo.main}),lo.decimal&&p("span",{className:"wi-total-decimal",children:lo.decimal})]})}),x&&p("span",{className:"wi-total-chevron","aria-hidden":!0,children:p(bn,{size:18})})]})]})})(),Ae==="top"&&we&&p("div",{className:"wi-nav-fixed",children:we}),a&&p("div",{ref:Uo,className:"wi-scrollable-body","data-vaul-no-drag":!0,children:k("div",{className:"wi-token-list",children:[me&&Array.from({length:5},(x,_)=>k("div",{className:"wi-skeleton-item",children:[k("div",{className:"wi-skeleton-left",children:[p("div",{className:"wi-skeleton-block wi-skeleton-icon"}),k("div",{className:"wi-skeleton-lines",children:[p("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),p("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),k("div",{className:"wi-skeleton-right",children:[p("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),p("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},_)),!me&&at.length===0&&!m&&p("div",{className:"wi-empty",children:"No Tokens Found"}),at.map(x=>{let _=We.get(tt(x.chainId,x.address)),W=_?parseFloat(_.percent_change_24h):null,Q=W!==null&&W>=0,A=ho(n,x.chainId);return k("button",{type:"button",className:"wi-token-item wi-token-item--button",onClick:()=>Ar(x),"aria-label":`Send ${x.symbol}`,children:[k("div",{className:"wi-token-left",children:[k("div",{className:"wi-token-icon-wrap",children:[p("img",{src:x.icon_url,alt:x.symbol,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:so,onError:K=>{K.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),A&&p("img",{src:A,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:K=>{K.currentTarget.style.display="none"}})]}),k("div",{className:"wi-token-info",children:[p("span",{className:"wi-token-name",children:x.symbol}),_&&k("div",{className:"wi-token-price-row",children:[p("span",{className:"wi-token-price",children:go(_.price)}),p("span",{className:"wi-token-change","data-positive":Q,"data-zero":W===0||void 0,children:W!==null&&(W===0?"0%":`${Q?"+":"-"}${(Q?Math.floor:Math.ceil)(Math.abs(W)*100)/100}%`)})]})]})]}),k("div",{className:"wi-token-right",children:[p("span",{className:"wi-token-balance",children:et(x.quantity.numeric,x.quantity.decimals)}),_&&p("span",{className:"wi-token-value",children:pn(x.quantity.numeric,x.quantity.decimals,_.price)})]})]},`${x.address}-${x.chainId}`)}),m&&ee&&Array.from({length:3},(x,_)=>k("div",{className:"wi-skeleton-item",children:[k("div",{className:"wi-skeleton-left",children:[p("div",{className:"wi-skeleton-block wi-skeleton-icon"}),k("div",{className:"wi-skeleton-lines",children:[p("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),p("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),k("div",{className:"wi-skeleton-right",children:[p("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),p("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},`forge-sk-${_}`)),m&&!ee&&!me&&at.length===0&&kt.length===0&&p("div",{className:"wi-empty",children:"No Tokens Found"}),m&&kt.map(x=>{let _=Ke.get(x.token)||"",W=ho(n,se[n].cross);return k("div",{className:"wi-token-item",children:[k("div",{className:"wi-token-left",children:[k("div",{className:"wi-token-icon-wrap",children:[p("img",{src:_||"https://contents.crosstoken.io/wallet/token/images/FT.png",alt:x.token_name,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:so,onError:Q=>{Q.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),W&&p("img",{src:W,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:Q=>{Q.currentTarget.style.display="none"}})]}),k("div",{className:"wi-token-info",children:[p("span",{className:"wi-token-name",children:x.token_name}),p("div",{className:"wi-token-price-row",children:k("span",{className:"wi-token-price",children:[et(x.current_price,18)," CROSS"]})})]})]}),k("div",{className:"wi-token-right",children:[p("span",{className:"wi-token-balance",children:et(x.balance,18)}),p("span",{className:"wi-token-value",children:go(x.current_value_usd)})]})]},`forge-${x.token}`)})]})}),Ae==="bottom"&&we&&p("div",{className:"wi-nav-fixed",children:we}),Go&&p("div",{className:"wi-wallet-disconnect-row",children:Go})]},"wallet"),Br=qe?p("div",{className:Z("wi-view-inner wi-portfolio-body",st.current&&"wi-view-portfolio"),children:p(ht,{env:n,theme:c,walletAddress:f,showHeader:!1,sendTransaction:ye,onOutlink:ke})},"portfolio"):null,Vr=ve?p("div",{className:Z("wi-view-inner wi-send-body",st.current&&"wi-view-send"),children:p(Ht,{env:n,theme:c,walletAddress:f,accountName:h,accounts:R,token:ve,tokens:at,onTokenChange:re,sendTransaction:ye,getTransactionReceipt:De,onConfirmSuccess:Or,onOutlink:ke})},"send"):null,Hr=p("div",{className:Z("wi-view-inner wi-qr-body",st.current&&"wi-view-qr"),children:k("div",{className:"wi-qr-section",children:[k("div",{className:"wi-qr-card",children:[k("div",{className:"wi-qr-code",children:[p(ya,{value:f,size:180,level:"H",marginSize:2,...g&&{imageSettings:{src:g,height:33,width:33,excavate:!0}}}),!g&&p("div",{className:"wi-qr-logo",children:p(kn,{size:33})})]}),p("p",{className:"wi-qr-address",children:f}),k("button",{type:"button",className:"wi-qr-copy-btn",onClick:jo,children:[p("span",{className:"wi-qr-copy-icon",children:Ct?p(Rt,{size:16}):p(bo,{size:16})}),p("span",{className:"wi-qr-copy-text",children:Ct?"Copied!":"Copy address"})]})]}),Wr]})},"qr"),$r=q==="qr"||q==="portfolio"||q==="send",Zo=xe!==null?p("div",{className:"wi-builtin-footer",children:xe}):null,Ko=k("div",{className:"wi-account-text",children:[B?k("button",{type:"button",className:"wi-account-row wi-account-row--btn",onClick:B,"aria-label":"Switch account",children:[p("span",{className:"wi-account-name",children:h??"Account 1"}),p("span",{className:"wi-account-switch","aria-hidden":"true",children:p(xn,{size:12})})]}):p("div",{className:"wi-account-row",children:p("span",{className:"wi-account-name",children:h??"Account 1"})}),k("button",{type:"button",className:"wi-address-row-btn",onClick:jo,"aria-label":"Copy address",children:[p("span",{className:"wi-account-address",children:ue(f)}),p("span",{className:"wi-account-copy",children:Ct?p(Rt,{size:14}):p(bo,{size:14})})]})]}),Yo=k(Bo,{children:[o,$r?k("div",{className:"wi-sticky-header",children:[k("div",{className:"wi-header wi-header--wallet wi-header--sub-account",children:[p("button",{type:"button",className:"wi-header-back",onClick:_r,"aria-label":"Back",children:p(hn,{})}),p("div",{className:"wi-account-block wi-account-block--sub-account",children:Ko}),p("button",{type:"button",className:"wi-header-action",onClick:C,"aria-label":"Close",children:p(xo,{size:24})})]}),p("hr",{className:"wi-divider"})]}):k("div",{className:"wi-sticky-header",children:[k("div",{className:"wi-header wi-header--wallet",children:[k("div",{className:"wi-account-block",children:[k("div",{className:"wi-avatar",children:[p("div",{className:"wi-avatar-fallback",style:Dr}),qo&&p("img",{src:qo,alt:"",className:"wi-avatar-img",width:30,height:30,draggable:!1,onLoad:so,onError:x=>{x.currentTarget.style.display="none"}})]}),Ko]}),k("div",{className:"wi-header-actions",children:[w&&p("button",{type:"button",className:"wi-header-action",onClick:()=>Fe("qr"),"aria-label":"Show QR code",children:p(wn,{size:20})}),p("button",{type:"button",className:"wi-header-action",onClick:C,"aria-label":"Close",children:p(xo,{size:24})})]})]}),p("hr",{className:"wi-divider"})]}),k("div",{className:"wi-view-container",children:[q==="wallet"&&Fr,q==="qr"&&Hr,q==="portfolio"&&Br,q==="send"&&Vr]}),Zo&&q!=="portfolio"&&q!=="send"&&p("div",{className:"wi-sticky-footer",children:p("div",{className:"wi-footer",ref:P,children:Zo})})]}),Qo={..._e,...D>0?{"--wi-footer-height":`${D}px`}:null};return s?k(Kt.Portal,{children:[i&&p(Kt.Overlay,{className:"wi-drawer-overlay"}),k(Kt.Content,{className:Z("wi-drawer-content",r),"data-theme":c,style:Qo,"data-direction":d,"data-no-balance":!a||void 0,"data-has-footer":D>0||void 0,"data-view":q,children:[p(Kt.Title,{className:"wi-sr-only",children:"My Wallet"}),Yo]})]}):k(Bo,{children:[i&&l&&p("div",{className:"wi-drawer-overlay",onClick:C}),p(Yt.Portal,{children:p(Yt.Content,{align:e,sideOffset:t,className:Z("wi-popover-content",r),"data-theme":c,style:Qo,"data-no-balance":!a||void 0,"data-has-footer":D>0||void 0,"data-view":q,children:Yo})})]})}import*as fr from"react";function ur({position:e="top",children:t}){let{setNavContent:r,setNavPosition:o}=Be();return fr.useEffect(()=>(r(t),o(e),()=>r(null)),[t,e,r,o]),null}import*as gr from"react";function wr({children:e}){let{setFooterContent:t}=Be();return gr.useEffect(()=>(t(e),()=>t(null)),[e,t]),null}M(`[data-theme=dark].wi-popover-content,[data-theme=dark].wi-drawer-content{--wi-primary: var(--cck-primary, #019d92);--wi-secondary: var(--cck-secondary, #e70077);--wi-surface-bg: var(--cck-surface-bg, #121212);--wi-surface-default: var(--cck-surface-default, rgba(255, 255, 255, .05));--wi-surface-subtle: var(--cck-surface-subtle, rgba(255, 255, 255, .1));--wi-border-default: var(--cck-border-default, rgba(255, 255, 255, .05));--wi-border-subtle: var(--cck-border-subtle, rgba(255, 255, 255, .1));--wi-texticon-primary: var(--cck-texticon-primary, #ffffff);--wi-texticon-secondary: var(--cck-texticon-secondary, rgba(255, 255, 255, .7));--wi-texticon-tertiary: var(--cck-texticon-tertiary, rgba(255, 255, 255, .5));--wi-on-primary: var(--cck-on-primary, #ffffff);--wi-error: var(--cck-error, #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(--cck-primary, #019d92);--wi-secondary: var(--cck-secondary, #e70077);--wi-surface-bg: var(--cck-surface-bg, #ffffff);--wi-surface-default: var(--cck-surface-default, rgba(18, 18, 18, .05));--wi-surface-subtle: var(--cck-surface-subtle, rgba(18, 18, 18, .1));--wi-border-default: var(--cck-border-default, rgba(18, 18, 18, .05));--wi-border-subtle: var(--cck-border-subtle, rgba(18, 18, 18, .1));--wi-texticon-primary: var(--cck-texticon-primary, #121212);--wi-texticon-secondary: var(--cck-texticon-secondary, rgba(18, 18, 18, .7));--wi-texticon-tertiary: var(--cck-texticon-tertiary, rgba(18, 18, 18, .5));--wi-on-primary: var(--cck-on-primary, #ffffff);--wi-error: var(--cck-error, #e70077);--wi-shadow: 0 2px 16px -2px rgba(0, 0, 0, .15)}
5
+ `);M("");import{jsx as mo}from"react/jsx-runtime";function en({env:e,theme:t="dark",mobileBreakpoint:r=768,domain:o,children:n}){let c=lt(`(max-width: ${r}px)`),[i,l]=ct.useState(!1),d=ct.useCallback(()=>l(!1),[]),a=ce(e),s=ct.useMemo(()=>({env:a,theme:t,isMobile:c,open:i,domain:o,close:d}),[a,t,c,i,o,d]);return mo(po.Provider,{value:s,children:c?mo(Zr.Root,{direction:"right",open:i,onOpenChange:l,noBodyStyles:!0,children:n},"drawer"):mo(Jo.Root,{open:i,onOpenChange:l,children:n},"popover")})}import*as rn from"@radix-ui/react-popover";import{Drawer as Yr}from"vaul";import{jsx as de,jsxs as Kr}from"react/jsx-runtime";function tn({size:e=18}){return Kr("svg",{className:"al-trigger-icon",width:e,height:e,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[de("rect",{width:"4",height:"4",fill:"currentColor"}),de("rect",{x:"7",width:"4",height:"4",fill:"currentColor"}),de("rect",{x:"14",width:"4",height:"4",fill:"currentColor"}),de("rect",{y:"7",width:"4",height:"4",fill:"currentColor"}),de("rect",{x:"7",y:"7",width:"4",height:"4",fill:"currentColor"}),de("rect",{x:"14",y:"7",width:"4",height:"4",fill:"currentColor"}),de("rect",{y:"14",width:"4",height:"4",fill:"currentColor"}),de("rect",{x:"7",y:"14",width:"4",height:"4",fill:"currentColor"}),de("rect",{x:"14",y:"14",width:"4",height:"4",fill:"currentColor"})]})}function on(){return de("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:de("path",{d:"M12 19L5 12M5 12L12 5M5 12H19",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function nn(){return de("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:de("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as Dt}from"react/jsx-runtime";function an({asChild:e,children:t}){let{isMobile:r,theme:o}=Ot(),n=t!=null,c=e??!0,i=n?t:Dt("button",{type:"button",className:"al-trigger-btn","data-theme":o,children:Dt(tn,{size:r?12:18})});return r?Dt(Yr.Trigger,{asChild:c,children:i}):Dt(rn.Trigger,{asChild:c,children:i})}import*as Xe from"react";import*as Ft from"@radix-ui/react-popover";import{Drawer as dt}from"vaul";import{useQuery as Jr}from"@tanstack/react-query";var sn={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 Qr="https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",Xr="https://contents.crosstoken.io/frontend/common/app-launcher/icons";function Le(e,t){return`${e==="production"?Xr:Qr}/${t}.png`}function ln(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:Le(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:Le(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:Le(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:Le(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:Le(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:Le(t,"nft"),order:8e3,type:"nft",badge:null,isNew:!1},{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:Le(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:Le(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:Le(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:Le(t,"explorer"),order:12e3,type:"explorer",badge:null,isNew:!1}]}}function Wt(e){let t=ce(e);return Jr({queryKey:["global-menu",t],queryFn:async({signal:r})=>{try{let o=await fetch(sn[t],{cache:"no-store",signal:r});if(!o.ok)throw new Error(`Failed to fetch global menu: ${o.status}`);return o.json()}catch(o){if(r.aborted)throw o;return ln(t)}},staleTime:0,gcTime:0,retry:!1,refetchOnMount:!0})}function Z(...e){return e.filter(Boolean).join(" ")}import{jsx as te,jsxs as Nt}from"react/jsx-runtime";function dn({align:e="end",sideOffset:t=12,className:r}){let{env:o,theme:n,isMobile:c,domain:i,close:l}=Ot(),{data:d}=Wt(o),a=Xe.useMemo(()=>(d?.items??[]).sort((h,R)=>h.order-R.order),[d]),s=8,m=Xe.useRef(null),y=Xe.useCallback(h=>{m.current={x:h.clientX,y:h.clientY}},[]),w=typeof window<"u"?window.location.pathname:"",g=Xe.useCallback((h,R)=>{if(m.current){let k=h.clientX-m.current.x,V=h.clientY-m.current.y;if(m.current=null,Math.abs(k)>s||Math.abs(V)>s)return}let L=R.url[o]??R.url.production,_=cn(L,i);if(!_)try{let k=new URL(L).pathname;if(w===k||w.startsWith(k+"/")){l();return}}catch{}_?window.open(L,"_blank","noopener,noreferrer"):window.location.href=L,l()},[o,i,l,w]),f=te("div",{className:"al-grid","data-theme":n,children:a.map(h=>{let R=h.url[o]??h.url.production,L=cn(R,i),_=!1;if(!L)try{let k=new URL(R).pathname;_=w===k||w.startsWith(k+"/")}catch{_=!1}return Nt("button",{type:"button",className:"al-grid-item","data-active":_||void 0,onPointerDown:y,onClick:k=>g(k,h),children:[Nt("div",{className:"al-grid-item-left",children:[te("div",{className:"al-grid-item-icon",children:te("img",{src:h.iconUrl,alt:h.label,width:24,height:24,loading:"lazy"})}),te("span",{className:"al-grid-item-label",children:h.label}),h.isNew&&te("span",{className:"al-badge-new",children:"N"})]}),te("div",{className:"al-grid-item-right",children:h.badge&&te("span",{className:"al-badge",children:h.badge})})]},h.id)})});return c?Nt(dt.Portal,{children:[te(dt.Overlay,{className:"al-drawer-overlay"}),Nt(dt.Content,{className:Z("al-drawer-content",r),"data-theme":n,children:[Nt("div",{className:"al-drawer-header",children:[te(dt.Close,{className:"al-drawer-close",children:te(on,{})}),te(dt.Title,{className:"al-drawer-title",children:"CROSS Services"}),te(dt.Close,{className:"al-drawer-close",children:te(nn,{})})]}),te("div",{className:"al-drawer-body",children:f})]})]}):te(Ft.Portal,{children:te(Ft.Content,{align:e,sideOffset:t,className:Z("al-popover-content",r),"data-theme":n,children:f})})}function cn(e,t){try{let r=new URL(e).hostname;return typeof window>"u"?!0:r!==(t??window.location.hostname)}catch{return!1}}import*as ie from"react";import*as hr from"@radix-ui/react-popover";import{Drawer as La}from"vaul";import{createContext as ei,useContext as ti}from"react";var fo=ei(null);function Be(){let e=ti(fo);if(!e)throw new Error("WalletInfo compound components must be used within <WalletInfo>");return e}var uo=(o=>(o.CROSSx="crossx",o.MetaMask="io.metamask",o.Binance="com.binance.wallet",o))(uo||{}),Bt={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 S from"react";import Je from"bignumber.js";function oi(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 et(e,t){if(!e||e==="0")return"0.00";let r=new Je(e).shiftedBy(-t),o=r.isGreaterThanOrEqualTo(1)?2:4;return r.toFormat(o,Je.ROUND_DOWN)}function ue(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}function go(e){let t=typeof e=="string"?parseFloat(e):e;if(Number.isNaN(t)||t===0)return"$0.00";let r=t>=1?2:4,o=Math.pow(10,r);return`$${(Math.floor(t*o)/o).toLocaleString("en-US",{minimumFractionDigits:r,maximumFractionDigits:r})}`}function pn(e,t,r){let n=new Je(e).shiftedBy(-t).multipliedBy(new Je(r));return n.isZero()||n.isNaN()?"$0.00":`$${(n.integerValue(Je.ROUND_DOWN).isGreaterThanOrEqualTo(1)?n.decimalPlaces(2,Je.ROUND_DOWN):n.decimalPlaces(4,Je.ROUND_DOWN)).toFormat()}`}function mn(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 r=t;if(r.includes("e")||r.includes("E")){let i=Number(r);if(!Number.isFinite(i)||i===0)return{displayValue:"0",isLowerBound:!1};r=oi(i.toFixed(18))}let[o="0",n=""]=r.split(".");if(Number(o)>=1){let i=n.slice(0,2).padEnd(2,"0");return{displayValue:`${Number(o).toLocaleString("en-US")}.${i}`,isLowerBound:!1}}return n.length<4?{displayValue:`${o}.${n}`,isLowerBound:!1}:n.slice(0,4)==="0000"?{displayValue:"0.0001",isLowerBound:!0}:{displayValue:`0.${n.slice(0,4)}`,isLowerBound:!1}}var ge={dev:"https://stg-wallet-server.crosstoken.io/api",stage:"https://stg-wallet-server.crosstoken.io/api",production:"https://wallet-server.crosstoken.io/api"},se={dev:{cross:612044,bsc:97},stage:{cross:612044,bsc:97},production:{cross:612055,bsc:56}};var wo={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"},fn={cross:"https://contents.crosstoken.io/wallet/token/images/CROSS.svg",bsc:"https://contents.crosstoken.io/wallet/token/images/BSC.svg"};function ho(e,t){let r=se[e];if(t===r.cross)return fn.cross;if(t===r.bsc)return fn.bsc}var ni={dev:"https://dev-portrait.crosstoken.io",stage:"https://dev-portrait.crosstoken.io",production:"https://portrait.crosstoken.io"};function Lt(e,t,r={}){if(!t||!t.startsWith("0x"))return;let{size:o=120,bg:n,format:c="png"}=r,i=ni[e],l=n?`&bg=${n}`:"";return`${i}/portrait/evm/${t}.${c}?size=${o}${l}`}import{jsx as $,jsxs as Vt}from"react/jsx-runtime";function un({size:e=16,className:t}){return Vt("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[$("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"}),$("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 bo({size:e=16,className:t}){return $("svg",{width:e,height:e,viewBox:"4 4 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:$("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 Rt({size:e=16,className:t}){return $("svg",{width:e,height:e,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:$("path",{d:"M11.6667 3.5L5.25 9.91667L2.33334 7",stroke:"currentColor",strokeWidth:1.16667,strokeLinecap:"round",strokeLinejoin:"round"})})}function xo({size:e=24,className:t}){return $("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:$("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function gn({size:e=20,className:t}){return Vt("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[$("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"}),$("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 wn({size:e=20,className:t}){return $("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,children:$("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 hn({size:e=20,className:t}){return $("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:$("path",{d:"M12.5 15L7.5 10L12.5 5",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function bn({size:e=20,className:t}){return $("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:$("path",{d:"M8 5L13 10L8 15",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function xn({size:e=20,className:t}){return $("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:$("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function vn({size:e=16,className:t}){return Vt("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[$("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"}),$("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 yn({size:e=16,className:t}){return Vt("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[$("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"}),$("path",{d:"M1.667 1.667l16.666 16.666",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function kn({size:e=42,className:t}){return $("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 42 42",fill:"none",className:t,children:$("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})})}import{useMemo as ri}from"react";import{useQuery as ii}from"@tanstack/react-query";var ai="send:chain-info";function si(e){return"data"in e&&e.data?e.data:e}function vo(e,...t){let r=e.replace(/\/+$/,""),o=t.map(n=>n.replace(/^\/+|\/+$/g,"")).filter(Boolean);return[r,...o].join("/")}function li(e,t,r,o){if(o)return t===se[e].cross?Cn(t,o):r?.explorer_url?vo(r.explorer_url,r.explorer_postfix?.transaction??"tx",o):ci(e,t,o)}function Cn(e,t){return vo("https://explorer.crosstoken.io",String(e),"tx",t)}function ci(e,t,r){let o=se[e];if(t===o.cross)return Cn(t,r);if(t===o.bsc)return vo(e==="production"?"https://bscscan.com":"https://testnet.bscscan.com","tx",r)}function Nn(e,t,r,o=!0){let n=ge[e],{data:c,...i}=ii({queryKey:[ai,e,t],queryFn:async({signal:d})=>{let a=await fetch(`${n}/v1/public/chain/info/${t}`,{cache:"no-store",signal:d});if(!a.ok)throw new Error(`Failed to fetch chain info: ${a.status}`);let s=await a.json();if("code"in s&&s.code!==void 0&&s.code!==200)throw new Error(`Chain info API error: ${s.code}`);return si(s)},enabled:o,staleTime:300*1e3});return{transactionUrl:ri(()=>li(e,t,c,r),[t,c,e,r]),...i}}var Ln="0x0000000000000000000000000000000000000001";var di="0xa9059cbb",pi=/^0x[a-fA-F0-9]{40}$/,mi="nexus-cross:dapp-ui:send:recent:",Rn=10;function fi(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return e.slice(0,t)}function Tt(e){return e.toLowerCase()}function It(e){return pi.test(e)}function yo(e){return Tt(e.address)===Ln}function ko(e){return`${mi}${e.toLowerCase()}`}function pt(e){if(typeof window>"u")return[];try{let t=window.localStorage.getItem(ko(e));if(!t)return[];let r=JSON.parse(t);return Array.isArray(r)?r.filter(o=>o!==null&&typeof o=="object"&&It(o.address)&&typeof o.updatedAt=="number").slice(0,Rn):[]}catch{return[]}}function Co(e,t){if(typeof window>"u")return[];let r=Tt(t),o=[{address:r,updatedAt:Date.now()},...pt(e).filter(n=>n.address!==r)].slice(0,Rn);try{window.localStorage.setItem(ko(e),JSON.stringify(o))}catch{return pt(e)}return o}function No(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(ko(e))}catch{}}function Lo(e,t){let r=e.trim();if(!r)return{error:"Enter an amount."};if(!/^\d+(\.\d*)?$/.test(r))return{error:"Enter a valid amount."};let[o="0",n=""]=r.split(".");if(n.length>t)return{error:`Max ${t} decimal places.`};let c=BigInt(o||"0"),i=n.padEnd(t,"0"),l=i?BigInt(i):0n,d=10n**BigInt(t),a=c*d+l;return a<=0n?{error:"Amount must be greater than 0."}:{value:a}}function Ro(e,t){let r=BigInt(e||"0"),o=10n**BigInt(t),n=r/o,c=r%o;if(c===0n)return n.toString();let i=fi(c.toString().padStart(t,"0"));return`${n.toString()}.${i}`}function To(e,t){let r=e.replace(/^0x/,"").toLowerCase().padStart(64,"0"),o=t.toString(16).padStart(64,"0");return`${di}${r}${o}`}M(`.wi-token-item--button{position:relative;width:100%;border:none;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer;border-radius:12px;padding:6px 8px;margin:-2px -8px;transition:background-color .15s ease,transform .15s ease}.wi-token-item--button:before{content:"";position:absolute;inset:-6px -16px;border-radius:16px}.wi-token-item--button:active{transform:scale(.99)}.wi-token-item--button:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px}.wi-view-send{animation:wi-slide-in-right .25s ease-out}.wi-send-body{flex:1;min-height:0;overflow:hidden}.wi-drawer-content[data-direction=bottom][data-view=send]{max-height:85dvh}.send-page{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.send-scroll{flex:1;min-height:0;display:flex;flex-direction:column;gap:16px;overflow-y:auto;overflow-x:hidden;padding:16px 24px 18px;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.15) transparent;overscroll-behavior:contain}[data-theme=light] .send-scroll{scrollbar-color:rgba(0,0,0,.12) transparent}.send-scroll::-webkit-scrollbar{width:4px}.send-scroll::-webkit-scrollbar-track{background:transparent}.send-scroll::-webkit-scrollbar-thumb{background:#ffffff26;border-radius:4px}[data-theme=light] .send-scroll::-webkit-scrollbar-thumb{background:#0000001f}.send-section{display:flex;flex-direction:column;gap:8px}.send-asset-card{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:14px;border:1px solid var(--wi-border-subtle);border-radius:18px;background:var(--wi-surface-default);color:inherit;font:inherit;text-align:left;cursor:pointer;transition:border-color .15s ease,background-color .15s ease}.send-asset-card:disabled{cursor:default}.send-asset-card:not(:disabled):hover,.send-asset-card[aria-expanded=true]{border-color:var(--wi-primary);background:var(--wi-surface-subtle)}.send-token-list{display:flex;flex-direction:column;gap:6px;max-height:180px;overflow-y:auto;padding:6px;border:1px solid var(--wi-border-subtle);border-radius:16px;background:var(--wi-surface-default)}.send-token-option{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:48px;border:none;border-radius:12px;background:transparent;color:inherit;font:inherit;text-align:left;padding:8px;cursor:pointer}.send-token-option:hover,.send-token-option[data-selected]{background:var(--wi-surface-subtle)}.send-token-option:focus-visible,.send-asset-card:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px}.send-token-option-icon{flex-shrink:0;width:28px;height:28px;border-radius:8px;object-fit:contain;background:transparent}.send-token-option-symbol{color:var(--wi-texticon-primary);font-size:13px;font-weight:700;line-height:1.3}.send-token-option-balance{color:var(--wi-texticon-secondary);font-size:12px;font-weight:600;line-height:1.3;white-space:nowrap}.send-asset-left{display:flex;align-items:center;gap:12px;min-width:0}.send-asset-icon{flex-shrink:0;width:40px;height:40px;border-radius:12px;object-fit:contain;background:transparent}.send-asset-info,.send-asset-balance{min-width:0;display:flex;flex-direction:column}.send-asset-symbol{color:var(--wi-texticon-primary);font-size:15px;font-weight:700;line-height:1.3}.send-asset-name,.send-balance-label{color:var(--wi-texticon-tertiary);font-size:12px;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.send-asset-balance{align-items:flex-end;text-align:right}.send-balance-value{color:var(--wi-texticon-primary);font-size:13px;font-weight:600;line-height:1.35;white-space:nowrap}.send-form{display:flex;flex-direction:column;gap:14px}.send-field{display:flex;flex-direction:column;gap:8px}.send-label-row{display:flex;align-items:center;justify-content:space-between;gap:8px}.send-label{color:var(--wi-texticon-secondary);font-size:13px;font-weight:600;line-height:1.3}.send-input,.send-amount-wrap{width:100%;box-sizing:border-box;border:1px solid var(--wi-border-subtle);border-radius:14px;background:var(--wi-surface-default);color:var(--wi-texticon-primary);font:inherit}.send-input{min-height:46px;padding:0 14px;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.send-input:focus{border-color:var(--wi-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--wi-primary) 18%,transparent)}.send-address-wrap[data-invalid],.send-amount-wrap[data-invalid]{border-color:#ff6b6b}.send-address-wrap[data-invalid]:focus-within,.send-amount-wrap[data-invalid]:focus-within{border-color:#ff6b6b;box-shadow:0 0 0 3px #ff6b6b29}.send-input::placeholder{color:var(--wi-texticon-tertiary)}.send-address-wrap{display:flex;align-items:center;width:100%;box-sizing:border-box;border:1px solid var(--wi-border-subtle);border-radius:14px;background:var(--wi-surface-default);transition:border-color .15s ease,box-shadow .15s ease}.send-address-wrap:focus-within{border-color:var(--wi-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--wi-primary) 18%,transparent)}.send-input--address{flex:1;min-width:0;border:none;background:transparent;box-shadow:none}.send-input--address:focus{box-shadow:none}.send-address-book-btn{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;width:42px;height:42px;margin-right:2px;border:none;border-radius:12px;background:transparent;color:var(--wi-texticon-tertiary);cursor:pointer;transition:background-color .15s ease,color .15s ease}.send-address-book-btn:hover,.send-address-book-btn[aria-expanded=true]{background:var(--wi-surface-subtle);color:var(--wi-primary)}.send-address-book-btn:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px}.send-address-picker{display:flex;flex-direction:column;gap:12px;padding:14px;border:1px solid var(--wi-border-subtle);border-radius:18px;background:var(--wi-surface-default)}.send-address-tabs{display:flex;align-items:center;gap:22px;border-bottom:1px solid var(--wi-border-subtle)}.send-address-tab{position:relative;border:none;background:transparent;color:var(--wi-texticon-tertiary);font:inherit;font-size:14px;font-weight:800;line-height:1.3;padding:0 0 12px;cursor:pointer}.send-address-tab[data-active]{color:var(--wi-primary)}.send-address-tab[data-active]:after{content:"";position:absolute;left:50%;bottom:-1px;width:34px;height:4px;border-radius:999px;background:var(--wi-primary);transform:translate(-50%)}.send-address-list{display:flex;flex-direction:column;gap:10px;max-height:224px;overflow-y:auto;padding-right:10px;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.18) transparent}[data-theme=light] .send-address-list{scrollbar-color:rgba(0,0,0,.14) transparent}.send-address-list::-webkit-scrollbar{width:3px}.send-address-list::-webkit-scrollbar-track{background:transparent}.send-address-list::-webkit-scrollbar-thumb{background:#ffffff2e;border-radius:999px}[data-theme=light] .send-address-list::-webkit-scrollbar-thumb{background:#00000024}.send-address-option{display:flex;align-items:center;gap:12px;width:100%;min-height:54px;border:none;border-radius:14px;background:transparent;color:inherit;font:inherit;text-align:left;padding:8px;cursor:pointer;transition:background-color .15s ease}.send-address-option:hover{background:var(--wi-surface-subtle)}.send-address-option:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px}.send-address-avatar{flex-shrink:0;position:relative;display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:50%;background:var(--wi-surface-subtle);color:var(--wi-primary);font-size:12px;font-weight:800;overflow:hidden}.send-address-avatar-img{position:relative;z-index:1;width:36px;height:36px;border-radius:50%;object-fit:cover}.send-address-avatar-fallback{position:absolute;inset:0;display:inline-flex;align-items:center;justify-content:center}.send-address-copy{min-width:0;display:flex;flex-direction:column;gap:2px}.send-address-name{color:var(--wi-texticon-primary);font-size:14px;font-weight:800;line-height:1.3}.send-address-value{color:var(--wi-texticon-tertiary);font-size:12px;font-weight:600;line-height:1.3}.send-address-empty{display:flex;align-items:center;justify-content:center;min-height:120px;color:var(--wi-texticon-tertiary);font-size:14px;font-weight:700}.send-amount-wrap{display:flex;align-items:center;padding-right:12px}.send-amount-wrap:focus-within{border-color:var(--wi-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--wi-primary) 18%,transparent)}.send-input--amount{border:none;background:transparent;box-shadow:none;flex:1;min-width:0}.send-input--amount:focus{box-shadow:none}.send-amount-symbol{color:var(--wi-texticon-secondary);font-size:13px;font-weight:700}.send-field-error{margin:-2px 0 0;color:#ff6b6b;font-size:12px;font-weight:600;line-height:1.35}.send-max-btn{border:none;border-radius:999px;background:var(--wi-surface-subtle);color:var(--wi-primary);font:inherit;font-size:12px;font-weight:700;padding:4px 10px;cursor:pointer}.send-max-btn:disabled{cursor:not-allowed;opacity:.45}.send-meta{display:flex;align-items:center;justify-content:space-between;gap:12px;color:var(--wi-texticon-tertiary);font-size:12px;line-height:1.4}.send-meta span:last-child{color:var(--wi-texticon-secondary);font-weight:600}.send-message{border-radius:14px;padding:10px 12px;font-size:12px;line-height:1.45}.send-message--error{background:#ff50501f;color:#ff6b6b}.send-message--success{background:color-mix(in srgb,var(--wi-primary) 12%,transparent);color:var(--wi-primary)}.send-message span{font-weight:700}.send-submit-btn{width:100%;min-height:48px;border:none;border-radius:999px;background:var(--wi-primary);color:var(--wi-primary-contrast, #001410);font:inherit;font-size:15px;font-weight:800;cursor:pointer;transition:opacity .15s ease,transform .15s ease}.send-submit-btn:hover:not(:disabled):not([data-disabled]){transform:translateY(-1px)}.send-submit-btn:disabled,.send-submit-btn[data-disabled]{cursor:not-allowed;opacity:.45}.send-footer{flex-shrink:0;padding:14px 24px 24px;border-top:1px solid var(--wi-border-subtle);background:var(--wi-surface-bg)}.send-page--success{background:var(--wi-surface-bg)}.send-success-body{flex:1;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;padding:32px 24px;text-align:center}.send-success-icon{display:inline-flex;align-items:center;justify-content:center}.send-success-icon[data-pending]{width:56px;height:56px;border-radius:50%;background:color-mix(in srgb,var(--wi-primary) 14%,transparent)}.send-success-spinner{width:28px;height:28px;border:3px solid color-mix(in srgb,var(--wi-primary) 22%,transparent);border-top-color:var(--wi-primary);border-radius:50%;animation:cross-send-spin .8s linear infinite}.send-success-copy{display:flex;flex-direction:column;gap:8px}.send-success-title{margin:0;color:var(--wi-texticon-primary);font-size:22px;font-weight:800;line-height:1.25}.send-success-desc{margin:0;color:var(--wi-texticon-tertiary);font-size:14px;font-weight:600;line-height:1.45}.send-success-hash-card{width:100%;display:flex;flex-direction:column;gap:8px;padding:14px;border:1px solid var(--wi-border-subtle);border-radius:18px;background:var(--wi-surface-default);box-sizing:border-box}.send-success-hash-label{color:var(--wi-texticon-tertiary);font-size:12px;font-weight:700;line-height:1.3;text-align:left}.send-success-hash-row{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;border:none;border-radius:12px;background:var(--wi-surface-subtle);color:var(--wi-texticon-primary);font:inherit;font-size:14px;font-weight:800;padding:12px}.send-success-hash-link{flex:1;display:inline-flex;align-items:center;align-self:stretch;min-width:0;border:none;background:transparent;color:inherit;font:inherit;font-weight:inherit;padding:0;text-align:left;text-decoration:none;cursor:pointer;user-select:none}.send-success-hash-link:hover{color:var(--wi-primary)}.send-success-hash-link:focus-visible,.send-success-copy-btn:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px}.send-success-copy-btn{display:inline-flex;align-items:center;justify-content:center;min-width:32px;border:none;background:transparent;color:var(--wi-primary);font:inherit;font-size:12px;font-weight:800;padding:0;cursor:pointer}@keyframes cross-send-spin{to{transform:rotate(360deg)}}
6
+ `);import{jsx as v,jsxs as I}from"react/jsx-runtime";var ui=1500,gi=120;function Io(e){return`${e.chainId}:${e.address.toLowerCase()}`}function Tn(e,t){return e.name||`Account ${(e.index??t)+1}`}function In(e){return e.trim().slice(0,1).toUpperCase()||"A"}function wi(e){return new Promise(t=>setTimeout(t,e))}function hi(e){let{status:t}=e;return t==="reverted"||t==="0x0"||t===0||t===0n||t===!1}function bi(e){return!!(e.token||e.recipient||e.amount)}function xi(){return I("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[v("path",{d:"M4.5 4.5C4.5 3.67 5.17 3 6 3h8.25c.69 0 1.25.56 1.25 1.25V16.5H6A1.5 1.5 0 0 1 4.5 15V4.5Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),v("path",{d:"M4.5 14.5C4.5 13.67 5.17 13 6 13h9.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"}),v("path",{d:"M8 6.5h4M8 9h3",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function vi(){return I("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none","aria-hidden":"true",children:[v("circle",{cx:"28",cy:"28",r:"28",fill:"var(--wi-primary)"}),v("path",{d:"M17 28.5L24.2 35.5L39 20.5",stroke:"var(--wi-primary-contrast, #001410)",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ht({env:e,theme:t="dark",walletAddress:r,accounts:o=[],token:n,tokens:c=[],onTokenChange:i,sendTransaction:l,getTransactionReceipt:d,onSuccess:a,onConfirmSuccess:s,onOutlink:m}){let[y,w]=S.useState(""),[g,f]=S.useState(""),[h,R]=S.useState(""),[L,_]=S.useState({}),[k,V]=S.useState(""),[C,x]=S.useState(!1),[B,T]=S.useState(!1),[Y,j]=S.useState(!1),[X,Ae]=S.useState("account"),we=S.useRef(void 0),[Oe,xe]=S.useState(()=>pt(r)),[q,J]=S.useState("idle"),ve=yo(n),re=S.useMemo(()=>BigInt(n.quantity.numeric||"0"),[n.quantity.numeric]),qe=S.useMemo(()=>et(n.quantity.numeric,n.quantity.decimals),[n.quantity.numeric,n.quantity.decimals]),De=S.useMemo(()=>o.filter(u=>u.address.toLowerCase()!==r.toLowerCase()),[o,r]),rt=S.useMemo(()=>{let u=new Map;return De.forEach((P,D)=>{u.set(P.address.toLowerCase(),{account:P,index:D})}),u},[De]),Pe=De.length>0,ye=S.useMemo(()=>ce(e),[e]),Se=t==="dark"?"1A1A2E":"F3F6F8",ke=c.length>0?c:[n],le=ke.length>1&&!!i,{transactionUrl:me}=Nn(ye,n.chainId,k||void 0,!!k);S.useEffect(()=>{R(""),_({}),V(""),J("idle")},[n.address,n.chainId,y,g]),S.useEffect(()=>{f(""),x(!1)},[n.address,n.chainId]),S.useEffect(()=>{xe(pt(r))},[r]),S.useEffect(()=>()=>clearTimeout(we.current),[]),S.useEffect(()=>{!Pe&&X==="account"&&Ae("recent")},[X,Pe]);let We=S.useCallback(()=>{f(Ro(n.quantity.numeric,n.quantity.decimals))},[n.quantity.numeric,n.quantity.decimals]),fe=S.useCallback(u=>{w(u),T(!1)},[]),Ce=S.useCallback(()=>{let u={},P=y.trim(),D=Lo(g,n.quantity.decimals),H;return P?It(P)||(u.recipient="Enter a valid EVM recipient address."):u.recipient="Enter a recipient address.","error"in D?u.amount=D.error:(H=D.value,H>re&&(u.amount="Amount exceeds available balance.")),!ve&&!It(n.address)&&(u.token="Token contract address is invalid."),{errors:u,rawAmount:H,trimmedRecipient:P}},[g,re,ve,y,n.address,n.quantity.decimals]),Ge=S.useCallback(async()=>{if(k)try{await navigator.clipboard.writeText(k),j(!0),clearTimeout(we.current),we.current=setTimeout(()=>j(!1),2e3)}catch{}},[k]),it=S.useCallback(()=>{if(!me||!k)return;let u=H=>{typeof window>"u"||window.open(H,"_blank","noopener,noreferrer")};if(!m){u(me);return}let P=m(me,{category:"send",origin:"send-transaction",payload:{chainId:n.chainId,txHash:k}});if(P&&(typeof P=="object"||typeof P=="function")&&typeof P.then=="function"){let H=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null;P.then(G=>{if(G===null){H?.close();return}let ee=G??me;if(H)try{H.location.href=ee}catch{H.close(),u(ee)}else u(ee)});return}let D=P;D!==null&&u(D??me)},[m,n.chainId,me,k]),yt=S.useCallback(async u=>{if(u.preventDefault(),R(""),V(""),!l){J("error"),R("Sending is not available for this wallet.");return}let{errors:P,rawAmount:D,trimmedRecipient:H}=Ce();if(_(P),bi(P)||D===void 0){J("error");return}let G=H;try{J("submitting");let ee=ve?await l({to:G,value:D,chainId:n.chainId}):await l({to:Tt(n.address),data:To(G,D),value:0n,chainId:n.chainId});if(V(ee),J("confirming"),xe(Co(r,G)),a?.(ee),!d){J("success");return}for(let Ze=0;Ze<gi;Ze+=1){let Ke=await d({hash:ee,chainId:n.chainId}).catch(()=>null);if(Ke){if(hi(Ke)){J("error"),R("Transaction reverted on-chain.");return}J("success");return}await wi(ui)}J("error"),R("Transaction receipt was not found. Please check again later.")}catch(ee){J("error"),R(ee instanceof Error?ee.message:"Failed to send transaction.")}},[g,d,ve,a,l,n.address,n.chainId,Ce,r]),Ne=q==="submitting"||re<=0n||!y.trim()||!g.trim();if((q==="confirming"||q==="success")&&k){let u=q==="success";return I("div",{className:"send-page send-page--success",children:[I("div",{className:"send-success-body","data-vaul-no-drag":!0,children:[v("div",{className:"send-success-icon","data-pending":!u||void 0,children:u?v(vi,{}):v("span",{className:"send-success-spinner"})}),I("div",{className:"send-success-copy",children:[v("h3",{className:"send-success-title",children:u?"Transfer Complete":"Transfer in Progress"}),v("p",{className:"send-success-desc",children:u?"Transfer complete.":"Transfer in progress. Waiting for confirmation."})]}),I("div",{className:"send-success-hash-card",children:[v("span",{className:"send-success-hash-label",children:"Transaction Hash"}),I("div",{className:"send-success-hash-row","data-vaul-no-drag":!0,children:[v("button",{type:"button",className:"send-success-hash-link",onClick:it,"aria-label":"Open transaction in explorer",children:ue(k)}),v("button",{type:"button",className:"send-success-copy-btn",onClick:Ge,"aria-label":"Copy transaction hash",children:Y?v(Rt,{size:16}):"Copy"})]})]})]}),v("div",{className:"send-footer",children:v("button",{type:"button",className:"send-submit-btn",onClick:s,disabled:!u,children:u?"Completed":"Sending..."})})]})}return I("form",{className:"send-page",onSubmit:yt,children:[I("div",{className:"send-scroll","data-vaul-no-drag":!0,children:[I("section",{className:"send-section","aria-label":"Select token to send",children:[v("span",{className:"send-label",children:"Token"}),I("button",{type:"button",className:"send-asset-card",onClick:()=>{le&&x(u=>!u)},disabled:!le,"aria-expanded":le?C:void 0,children:[I("span",{className:"send-asset-left",children:[v("img",{className:"send-asset-icon",src:n.icon_url,alt:n.symbol,width:40,height:40,draggable:!1,onError:u=>{u.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),I("span",{className:"send-asset-info",children:[v("span",{className:"send-asset-symbol",children:n.symbol}),v("span",{className:"send-asset-name",children:n.name})]})]}),I("span",{className:"send-asset-balance",children:[v("span",{className:"send-balance-label",children:"Available"}),I("span",{className:"send-balance-value",children:[qe," ",n.symbol]})]})]}),le&&C&&v("div",{className:"send-token-list",role:"listbox",children:ke.map(u=>{let P=Io(u)===Io(n);return I("button",{type:"button",role:"option","aria-selected":P,className:"send-token-option","data-selected":P||void 0,onClick:()=>i?.(u),children:[I("span",{className:"send-asset-left",children:[v("img",{className:"send-token-option-icon",src:u.icon_url,alt:u.symbol,width:28,height:28,draggable:!1,onError:D=>{D.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),I("span",{className:"send-asset-info",children:[v("span",{className:"send-token-option-symbol",children:u.symbol}),v("span",{className:"send-asset-name",children:u.name})]})]}),v("span",{className:"send-token-option-balance",children:et(u.quantity.numeric,u.quantity.decimals)})]},Io(u))})}),L.token&&v("p",{className:"send-field-error",role:"alert",children:L.token})]}),I("section",{className:"send-field","aria-label":"Recipient address",children:[v("span",{className:"send-label",children:"To"}),I("div",{className:"send-address-wrap","data-invalid":L.recipient||void 0,children:[v("input",{className:"send-input send-input--address",value:y,onChange:u=>w(u.target.value),placeholder:"0x...",autoComplete:"off",spellCheck:!1,"aria-invalid":!!L.recipient,"aria-describedby":L.recipient?"send-recipient-error":void 0}),v("button",{type:"button",className:"send-address-book-btn",onClick:()=>T(u=>!u),"aria-label":"Open address book","aria-expanded":B,children:v(xi,{})})]}),L.recipient&&v("p",{id:"send-recipient-error",className:"send-field-error",role:"alert",children:L.recipient}),B&&I("div",{className:"send-address-picker",children:[I("div",{className:"send-address-tabs",role:"tablist",children:[Pe&&v("button",{type:"button",role:"tab",className:"send-address-tab","data-active":X==="account"||void 0,"aria-selected":X==="account",onClick:()=>Ae("account"),children:"My Account"}),v("button",{type:"button",role:"tab",className:"send-address-tab","data-active":X==="recent"||void 0,"aria-selected":X==="recent",onClick:()=>Ae("recent"),children:"Recent"})]}),Pe&&X==="account"?v("div",{className:"send-address-list",children:De.map((u,P)=>{let D=Tn(u,P),H=Lt(ye,u.address,{size:56,bg:Se});return I("button",{type:"button",className:"send-address-option",onClick:()=>fe(u.address),children:[I("span",{className:"send-address-avatar","aria-hidden":!0,children:[H&&v("img",{className:"send-address-avatar-img",src:H,alt:"",width:36,height:36,draggable:!1,onError:G=>{G.currentTarget.style.display="none"}}),v("span",{className:"send-address-avatar-fallback",children:In(D)})]}),I("span",{className:"send-address-copy",children:[v("span",{className:"send-address-name",children:D}),v("span",{className:"send-address-value",children:ue(u.address)})]})]},u.address)})}):Oe.length>0?v("div",{className:"send-address-list",children:Oe.map(u=>{let P=rt.get(u.address.toLowerCase()),D=P?Tn(P.account,P.index):void 0,H=Lt(ye,u.address,{size:56,bg:Se});return I("button",{type:"button",className:"send-address-option",onClick:()=>fe(u.address),children:[I("span",{className:"send-address-avatar","aria-hidden":!0,children:[H&&v("img",{className:"send-address-avatar-img",src:H,alt:"",width:36,height:36,draggable:!1,onError:G=>{G.currentTarget.style.display="none"}}),v("span",{className:"send-address-avatar-fallback",children:D?In(D):u.address.slice(2,4).toUpperCase()})]}),I("span",{className:"send-address-copy",children:[v("span",{className:"send-address-name",children:D??ue(u.address)}),v("span",{className:"send-address-value",children:P?ue(P.account.address):"Recently sent"})]})]},u.address)})}):v("div",{className:"send-address-empty",children:"No Send History"})]})]}),I("section",{className:"send-field","aria-labelledby":"send-amount-label",children:[I("span",{className:"send-label-row",children:[v("span",{id:"send-amount-label",className:"send-label",children:"Amount"}),v("button",{type:"button",className:"send-max-btn",onClick:We,disabled:re<=0n||q==="submitting",children:"Max"})]}),I("div",{className:"send-amount-wrap","data-invalid":L.amount||void 0,children:[v("input",{className:"send-input send-input--amount",value:g,onChange:u=>f(u.target.value),placeholder:"0.00",inputMode:"decimal",autoComplete:"off","aria-labelledby":"send-amount-label","aria-invalid":!!L.amount,"aria-describedby":L.amount?"send-amount-error":void 0}),v("span",{className:"send-amount-symbol",children:n.symbol})]}),L.amount&&v("p",{id:"send-amount-error",className:"send-field-error",role:"alert",children:L.amount})]}),I("div",{className:"send-meta",children:[v("span",{children:"From"}),v("span",{children:ue(r)})]}),I("div",{className:"send-meta",children:[v("span",{children:"Network"}),I("span",{children:["Chain ID ",n.chainId]})]}),h&&v("div",{className:"send-message send-message--error",role:"alert",children:h})]}),v("div",{className:"send-footer",children:v("button",{type:"submit",className:"send-submit-btn",disabled:q==="submitting","data-disabled":Ne||void 0,"aria-disabled":Ne,children:q==="submitting"?"Sending...":"Send"})})]})}import*as En from"@radix-ui/react-popover";import{Drawer as yi}from"vaul";import{jsx as $t,jsxs as ki}from"react/jsx-runtime";function Pn({asChild:e,className:t,children:r}){let{isMobile:o,theme:n,walletAddress:c}=Be(),i=r!=null,l=e??!0,d=i?r:ki("button",{type:"button",className:Z("wi-trigger-btn",t),"data-theme":n,"data-mobile":o||void 0,children:[$t(un,{size:o?14:16}),$t("span",{className:"wi-trigger-address",children:ue(c)})]});return o?$t(yi.Trigger,{asChild:l,children:d}):$t(En.Trigger,{asChild:l,children:d})}import*as F from"react";import*as Yt from"@radix-ui/react-popover";import{Drawer as Kt}from"vaul";import St from"bignumber.js";import{useQueries as Ci}from"@tanstack/react-query";import{useMemo as Ni}from"react";var Eo="user-balance";async function Li(e,t,r,o){let n=new URLSearchParams({networkId:`eip155:${t}`,account:r}),c=await fetch(`${e}/v1/public/token/balance?${n}`,{cache:"no-store",signal:o});if(!c.ok)throw new Error(`Failed to fetch token balance: ${c.status}`);let i=await c.json();if(i.code!==200)throw new Error(`Token balance API error: ${i.code}`);return i.data}function mt(e,t,r=!0){let o=ge[e],n=se[e],c=[n.cross,n.bsc],i=Ci({queries:c.map(s=>({queryKey:[Eo,e,t,s],queryFn:({signal:m})=>Li(o,s,t,m),enabled:!!t&&r,staleTime:0,refetchInterval:r?5e3:!1}))}),l=i.some(s=>s.isLoading),d=i.some(s=>s.isError);return{tokens:Ni(()=>{let s=[];for(let m of i)m.data&&s.push(...m.data);return s},[i]),isLoading:l,isError:d}}import{useQuery as Ri,useQueries as Ti}from"@tanstack/react-query";import{useMemo as Ii}from"react";var Ei="forge-holdings",Pi="forge-token-image";async function Si(e,t,r){let o=await fetch(`${e}/v1/users/${t}/holdings`,{cache:"no-store",signal:r});if(!o.ok)throw new Error(`Failed to fetch forge holdings: ${o.status}`);let n=await o.json();if(!n.success)throw new Error("Forge holdings API error");return n.data.items}async function Mi(e,t,r){let o=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store",signal:r});if(!o.ok)return{address:t,image_url:""};let n=await o.json();return n.success?{address:t,image_url:n.data.token.image_url}:{address:t,image_url:""}}function Sn(e,t,r=!0){let o=wo[e],{data:n,...c}=Ri({queryKey:[Ei,e,t],queryFn:({signal:i})=>Si(o,t,i),enabled:!!t&&r,staleTime:0,refetchInterval:r?5e3:!1});return{holdings:n??[],...c}}function Mn(e,t,r=!0){let o=wo[e],n=Ti({queries:t.map(i=>({queryKey:[Pi,e,i],queryFn:({signal:l})=>Mi(o,i,l),enabled:r,staleTime:1/0}))});return{imageMap:Ii(()=>{let i=new Map;for(let l of n)l.data&&i.set(l.data.address,l.data.image_url);return i},[n])}}import{useQuery as _i}from"@tanstack/react-query";import{useMemo as Ai}from"react";var Po="token-stats";function tt(e,t){return`${e}:${t.toLowerCase()}`}function ft(e,t=!0){let r=ge[e],{data:o,...n}=_i({queryKey:[Po,e],queryFn:async({signal:i})=>{let l=await fetch(`${r}/v1/public/token/stats`,{cache:"no-store",signal:i});if(!l.ok)throw new Error(`Failed to fetch token stats: ${l.status}`);let d=await l.json();if(d.code!==200)throw new Error(`Token stats API error: ${d.code}`);return d},enabled:t,staleTime:3e4});return{statsMap:Ai(()=>{let i=new Map;if(!o?.data)return i;for(let l of o.data){let d=tt(l.chain_id,l.address);i.set(d,l)}return i},[o]),...n}}import{useQuery as Oi}from"@tanstack/react-query";import{useMemo as Di}from"react";var Wi="token-info";function So(e,t){return`${t.toLowerCase()}_${e}`}function _n(e,t=!0){let r=ge[e],{data:o,...n}=Oi({queryKey:[Wi,e],queryFn:async({signal:i})=>{let l=await fetch(`${r}/v1/public/token/info`,{cache:"no-store",signal:i});if(!l.ok)throw new Error(`Failed to fetch token info: ${l.status}`);let d=await l.json();if(d.code!==200)throw new Error(`Token info API error: ${d.code}`);return d},enabled:t,staleTime:1/0});return{categoryMap:Di(()=>{let i=new Map;if(!o?.data)return i;for(let l of o.data){let d=So(l.chain_id,l.address);i.set(d,l.category)}return i},[o]),...n}}import{useMemo as Fi}from"react";import Mo from"bignumber.js";function An(e,t,r){let{tokens:o,isLoading:n}=mt(e,t,r),{statsMap:c}=ft(e,r);return Fi(()=>{let i=new Mo(0);for(let s of o){let m=c.get(tt(s.chainId,s.address));if(!m)continue;let w=new Mo(s.quantity.numeric).shiftedBy(-s.quantity.decimals).multipliedBy(new Mo(m.price));w.isNaN()||(i=i.plus(w))}let l=i.toFixed(),{displayValue:d,isLowerBound:a}=mn(l);return{totalUsd:l,displayValue:d,isLowerBound:a,isLoading:n}},[o,c,n])}import{QRCodeSVG as ya}from"qrcode.react";function Re(e,t,r,o){if(!o||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.defaultPrevented)return;e.preventDefault();let n;try{n=o(t,r)}catch(a){console.error("[dapp-ui] onOutlink threw:",a);return}let c=a=>{typeof window>"u"||window.open(a,"_blank","noopener,noreferrer")};if((a=>!!a&&(typeof a=="object"||typeof a=="function")&&typeof a.then=="function")(n)){let a=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null,s=m=>{if(m===null){a?.close();return}let y=m??t;if(a)try{a.location.href=y}catch{a.close(),c(y)}else c(y)};n.then(s,m=>{console.error("[dapp-ui] onOutlink rejected:",m),a?.close()});return}let l=n;if(l===null)return;c(l??t)}import*as nt from"react";import{Drawer as xa}from"vaul";import{createContext as Bi,useContext as Vi}from"react";var Et=Bi(null);function oe(){let e=Vi(Et);if(!e)throw new Error("WalletPortfolio compound components must be used within <WalletPortfolio>");return e}import{Drawer as Hi}from"vaul";import{jsx as On}from"react/jsx-runtime";function Dn({asChild:e,children:t}){let{walletAddress:r}=oe(),o=t!=null,n=e??!0,c=o?t:On("button",{type:"button",children:ue(r)});return On(Hi.Trigger,{asChild:n,children:c})}import{Drawer as Zt}from"vaul";import*as be from"react";import{useQueryClient as wa}from"@tanstack/react-query";import{useMemo as Gi}from"react";import _o from"bignumber.js";import{useQuery as $i}from"@tanstack/react-query";import{useMemo as Bn}from"react";var Ut={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"},Wn={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},zt={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"},Ve={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},Te={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"},Fn={dev:{cross:"https://stg-dex-api.crosstoken.io/dex",crossd:"https://stg-crossd-dex-api.crosstoken.io/dex",forge:"https://stg-forge-dex-api.crosstoken.io/dex"},stage:{cross:"https://stg-dex-api.crosstoken.io/dex",crossd:"https://stg-crossd-dex-api.crosstoken.io/dex",forge:"https://stg-forge-dex-api.crosstoken.io/dex"},production:{cross:"https://dex-api.crosstoken.io/dex",crossd:"https://crossd-dex-api.crosstoken.io/dex",forge:"https://forge-dex-api.crosstoken.io/dex"}};var Ui="wp:reward-pools";function jt(e,t=!0){let r=Ut[e],{data:o,...n}=$i({queryKey:[Ui,e],queryFn:async({signal:l})=>{let d=await fetch(`${r}/v1/pools`,{cache:"no-store",signal:l});if(!d.ok)throw new Error(`Failed to fetch pools: ${d.status}`);let a=await d.json();if(a.code!==200)throw new Error(`Pools API error: ${a.code}`);return a},enabled:t,staleTime:0}),c=Bn(()=>o?.data.pools.filter(l=>l.pool_type==="CrossPool")??[],[o]),i=Bn(()=>o?.data.pools.filter(l=>l.pool_type==="GamePool")??[],[o]);return{crossPools:c,gamePools:i,allPools:o?.data.pools??[],...n}}import{useQuery as zi}from"@tanstack/react-query";import{useMemo as ji}from"react";var qi="wp:user-deposits";function qt(e,t,r=!0){let o=Ut[e],n=r&&!!t,{data:c,...i}=zi({queryKey:[qi,e,t],queryFn:async({signal:d})=>{let a=await fetch(`${o}/v1/users/${t}/deposits`,{cache:"no-store",signal:d});if(!a.ok)throw new Error(`Deposits fetch failed: ${a.status}`);let s=await a.json();if(s.code!==200)throw new Error(`Deposits API error: ${s.code}`);return s},enabled:n,staleTime:0});return{depositMap:ji(()=>{let d=new Map;if(!c?.data.user_deposits)return d;for(let a of c.data.user_deposits)d.set(a.pool_address.toLowerCase(),a);return d},[c]),deposits:c?.data.user_deposits??[],...i}}import{useQuery as Vn}from"@tanstack/react-query";import{useMemo as Hn}from"react";function Ie(e,t,r,o=!0){let n=Fn[e][t],c=o&&!!r,{data:i,...l}=Vn({queryKey:["wp:dex-pairs",e,t],queryFn:async({signal:g})=>{let f=await fetch(`${n}/pair-info`,{cache:"no-store",signal:g});if(!f.ok)throw new Error(`pair-info fetch failed: ${f.status}`);let h=await f.json();if(h.code!==200)throw new Error(`pair-info API error: ${h.code}`);return h},enabled:o,staleTime:0}),d=i?.data??[],a=Hn(()=>{let g=new Map;for(let f of d)g.set(f.pair_address.toLowerCase(),f);return g},[d]),{data:s,...m}=Vn({queryKey:["wp:dex-orders",e,t,r],queryFn:async({signal:g})=>{let f=Math.floor(Date.now()/1e3),h=new URLSearchParams({owner:r,size:"200",start_date:"0",end_date:String(f)}),R=await fetch(`${n}/open-order?${h}`,{cache:"no-store",signal:g});if(!R.ok)throw new Error(`open-order fetch failed: ${R.status}`);let L=await R.json();if(L.code!==200)throw new Error(`open-order API error: ${L.code}`);return L.data?.data??[]},enabled:c,staleTime:0}),y=s??[],w=Hn(()=>{let g=new Map;for(let f of y){let h=f.pair.toLowerCase();g.has(h)||g.set(h,{buys:[],sells:[]});let R=g.get(h);f.order_side===1?R.buys.push(f):R.sells.push(f)}return g},[y]);return{allPairs:d,pairMap:a,orders:y,ordersByPair:w,isEmpty:y.length===0,isLoading:l.isLoading||m.isLoading}}var Zi=["var(--wp-blue)","var(--wp-purple)","var(--wp-red)","var(--wp-orange)"],$n="var(--wp-green)",Un=4;function zn(e,t,r=!0){let o=r&&!!t,{allPools:n}=jt(e,o),{depositMap:c}=qt(e,t,o),{allPairs:i,pairMap:l,ordersByPair:d}=Ie(e,"cross",t,o),{allPairs:a,pairMap:s,ordersByPair:m}=Ie(e,"crossd",t,o),{allPairs:y,pairMap:w,ordersByPair:g}=Ie(e,"forge",t,o);return Gi(()=>{let f=new Map,h=new Map,R=(C,x)=>{!Number.isFinite(x)||x<=0||h.set(C,(h.get(C)??0)+x)};for(let C of n){let x=Number(C.deposit_token.price);x>0&&f.set(C.deposit_token.symbol,x);for(let B of C.reward_tokens){let T=Number(B.price);T>0&&f.set(B.symbol,T)}}for(let C of[...i,...a,...y]){let x=f.get(C.quote_symbol),B=Number(C.billboard?.price);x&&B>0&&!f.has(C.base_symbol)&&f.set(C.base_symbol,B*x)}for(let C of n){let x=c.get(C.pool_address.toLowerCase());if(!x)continue;let B=new _o(x.deposited_amount).shiftedBy(-C.deposit_token.decimals).toNumber();if(R(C.deposit_token.symbol,B),C.reward_tokens.length>0){let T=C.reward_tokens[0],Y=new _o(x.claimable_reward).shiftedBy(-T.decimals).toNumber();R(T.symbol,Y)}}let L=[{pairMap:l,ordersByPair:d},{pairMap:s,ordersByPair:m},{pairMap:w,ordersByPair:g}];for(let{pairMap:C,ordersByPair:x}of L)for(let[B,T]of x){let Y=C.get(B);if(Y){for(let j of T.buys){let X=Number(j.amount)-Number(j.filled);R(Y.quote_symbol,X*Number(j.price))}for(let j of T.sells){let X=Number(j.amount)-Number(j.filled);R(Y.base_symbol,X)}}}let _=[],k=0;for(let[C,x]of h){let B=f.get(C)??0,T=x*B;T>0&&(_.push({symbol:C,usdValue:T}),k+=T)}_.sort((C,x)=>x.usdValue-C.usdValue);let V=[];if(k>0){let C=_.slice(0,Un),x=_.slice(Un);for(let T=0;T<C.length;T++)V.push({symbol:C[T].symbol,usdValue:C[T].usdValue,percentage:Math.round(C[T].usdValue/k*100),color:Zi[T]??$n});if(x.length>0){let T=x.reduce((Y,j)=>Y+j.usdValue,0);V.push({symbol:"Others",usdValue:T,percentage:Math.round(T/k*100),color:$n})}let B=V.reduce((T,Y)=>T+Y.percentage,0);B!==100&&V.length>0&&(V[0].percentage+=100-B)}return{totalUsd:k,formattedTotal:k>0?`$${new _o(k).toFormat(2)}`:"$0.00",segments:V}},[n,c,i,l,d,a,s,m,y,w,g])}import{jsx as ut,jsxs as Ki}from"react/jsx-runtime";function jn({size:e=22,className:t}){return ut("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ut("path",{d:"M14 4L7 11L14 18",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function qn({size:e=22,className:t}){return Ki("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[ut("path",{d:"M18.333 3.667v5.5h-5.5",stroke:"currentColor",strokeWidth:1.833,strokeLinecap:"round",strokeLinejoin:"round"}),ut("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 Gn({size:e=12,className:t}){return ut("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ut("path",{d:"M6 11A5 5 0 106 1a5 5 0 000 10zM6 8V6M6 4h.005",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})})}import{useQuery as Yi}from"@tanstack/react-query";import{useMemo as Qi}from"react";var Xi="wp:token-info";function He(e,t=!0){let r=ge[e],o=se[e].cross,{data:n,...c}=Yi({queryKey:[Xi,e],queryFn:async({signal:a})=>{let s=await fetch(`${r}/v1/public/token/info`,{cache:"no-store",signal:a});if(!s.ok)throw new Error(`Failed to fetch token info: ${s.status}`);let m=await s.json();if(m.code!==200)throw new Error(`Token info API error: ${m.code}`);return m},enabled:t,staleTime:300*1e3}),{byChainAddr:i,byChainSym:l}=Qi(()=>{let a=new Map,s=new Map;if(!n?.data)return{byChainAddr:a,byChainSym:s};for(let m of n.data){let y=m.address.toLowerCase();a.set(`${m.chain_id}:${y}`,m),a.set(y,m);let w=m.symbol.replace(/^t/,"").toUpperCase(),g=`${m.chain_id}:${w}`;s.has(g)||s.set(g,m),s.has(w)||s.set(w,m)}return{byChainAddr:a,byChainSym:s}},[n]);return{getTokenImage:(a,s)=>{let m=a.toLowerCase(),y=i.get(`${o}:${m}`);if(y?.image)return y.image;let w=i.get(m);if(w?.image)return w.image;if(s){let g=s.replace(/^t/,"").toUpperCase(),f=l.get(`${o}:${g}`);if(f?.image)return f.image;let h=l.get(g);if(h?.image)return h.image}return""},...c}}import{jsx as Gt,jsxs as Zn}from"react/jsx-runtime";function Ee({title:e,icon:t,iconFit:r="cover",isEmpty:o,children:n}){return Zn("div",{className:"wp-svc-card",children:[Zn("div",{className:"wp-svc-card-head",children:[Gt("img",{className:"wp-svc-card-icon",src:t,alt:"",style:{objectFit:r}}),Gt("span",{className:"wp-svc-card-title",children:e})]}),o?Gt("div",{className:"wp-svc-empty",children:"No assets yet"}):Gt("div",{className:"wp-svc-items",children:n})]})}import Pt from"bignumber.js";import{jsx as ot,jsxs as Me}from"react/jsx-runtime";var Ji="CROSS Rewards";function Kn(e,t){let r=new Pt(e).shiftedBy(-t);return r.isZero()?"0":r.isGreaterThanOrEqualTo(1)?r.toFormat(2,Pt.ROUND_DOWN):r.toFormat(4,Pt.ROUND_DOWN)}function Yn(){let{env:e,walletAddress:t,onOutlink:r}=oe(),o=!!t,{allPools:n}=jt(e,o),{depositMap:c}=qt(e,t,o),{getTokenImage:i}=He(e,o),l=s=>`${Wn[e]}/rewards/${s.pool_address}?action=withdraw`,d=`${Te[e]}/reward.png`,a=n.filter(s=>{let m=c.get(s.pool_address.toLowerCase()),y=m?.deposited_amount??"0",w=m?.claimable_reward??"0";return!(new Pt(y).isZero()&&new Pt(w).isZero())});return ot(Ee,{title:Ji,icon:d,isEmpty:a.length===0,children:a.map(s=>{let m=c.get(s.pool_address.toLowerCase()),y=m?.deposited_amount??"0",w=l(s);return Me("a",{className:"wp-item","data-side":"reward",href:w,target:"_blank",rel:"noopener noreferrer",onClick:g=>Re(g,w,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:s,userDeposit:m}},r),children:[Me("div",{className:"wp-item-body",children:[Me("div",{className:"wp-item-field",children:[Me("span",{className:"wp-item-label",children:["Deposited (",s.deposit_token.symbol,")"]}),Me("div",{className:"wp-svc-token",children:[i(s.deposit_token.address,s.deposit_token.symbol)&&ot("img",{className:"wp-svc-token-icon",src:i(s.deposit_token.address,s.deposit_token.symbol),alt:""}),ot("span",{children:Kn(y,s.deposit_token.decimals)})]})]}),Me("div",{className:"wp-item-field",children:[Me("span",{className:"wp-item-label",children:["Rewards (",s.reward_tokens.map(g=>g.symbol).join(", "),")"]}),s.reward_tokens.map(g=>{let f=i(g.address,g.symbol);return Me("div",{className:"wp-svc-token",children:[f&&ot("img",{className:"wp-svc-token-icon",src:f,alt:""}),ot("span",{children:m?Kn(m.claimable_reward,g.decimals):"0"})]},g.address)})]})]}),Me("div",{className:"wp-item-badges",children:[ot("span",{className:"wp-badge wp-badge--mint",children:"Claim"}),ot("span",{className:"wp-badge wp-badge--muted",children:"Withdraw"})]})]},s.pool_address)})})}import Xn from"bignumber.js";import{Fragment as ea,jsx as pe,jsxs as ne}from"react/jsx-runtime";function Ao(e){let t=new Xn(e);if(t.isNaN())return e;let r=t.decimalPlaces()??0;return t.toFormat(r)}function Qn(e){let t=new Xn(e.amount).minus(e.filled);return Ao(t.toString())}function gt({market:e,pairMap:t,ordersByPair:r,getDexUrl:o,getTokenImage:n}){let{onOutlink:c}=oe(),i=[];for(let[l,d]of r){let a=t.get(l),s=a?n(a.base_address,a.base_symbol):"",m=a?n(a.quote_address,a.quote_symbol):"",y=o(l);for(let w of d.buys)i.push(ne("a",{className:"wp-item","data-side":"buy",href:y,target:"_blank",rel:"noopener noreferrer",onClick:g=>Re(g,y,{category:"portfolio",origin:"portfolio-dex-order",payload:{market:e,side:"buy",order:w,pair:a}},c),children:[ne("div",{className:"wp-item-body",children:[ne("div",{className:"wp-item-field",children:[ne("span",{className:"wp-item-label wp-item-label--buy",children:["Buy",a?.base_symbol?` (${a.base_symbol})`:""]}),ne("div",{className:"wp-svc-token",children:[s&&pe("img",{className:"wp-svc-token-icon",src:s,alt:""}),pe("span",{children:Qn(w)})]})]}),ne("div",{className:"wp-item-field",children:[ne("span",{className:"wp-item-label",children:["Price",a?.quote_symbol?` (${a.quote_symbol})`:""]}),ne("div",{className:"wp-svc-token",children:[m&&pe("img",{className:"wp-svc-token-icon",src:m,alt:""}),pe("span",{children:Ao(w.price)})]})]})]}),pe("div",{className:"wp-item-badges",children:pe("span",{className:"wp-badge wp-badge--red",children:"Cancel"})})]},`buy-${w.order_id}`));for(let w of d.sells)i.push(ne("a",{className:"wp-item","data-side":"sell",href:y,target:"_blank",rel:"noopener noreferrer",onClick:g=>Re(g,y,{category:"portfolio",origin:"portfolio-dex-order",payload:{market:e,side:"sell",order:w,pair:a}},c),children:[ne("div",{className:"wp-item-body",children:[ne("div",{className:"wp-item-field",children:[ne("span",{className:"wp-item-label wp-item-label--sell",children:["Sell",a?.base_symbol?` (${a.base_symbol})`:""]}),ne("div",{className:"wp-svc-token",children:[s&&pe("img",{className:"wp-svc-token-icon",src:s,alt:""}),pe("span",{children:Qn(w)})]})]}),ne("div",{className:"wp-item-field",children:[ne("span",{className:"wp-item-label",children:["Price",a?.quote_symbol?` (${a.quote_symbol})`:""]}),ne("div",{className:"wp-svc-token",children:[m&&pe("img",{className:"wp-svc-token-icon",src:m,alt:""}),pe("span",{children:Ao(w.price)})]})]})]}),pe("div",{className:"wp-item-badges",children:pe("span",{className:"wp-badge wp-badge--red",children:"Cancel"})})]},`sell-${w.order_id}`))}return pe(ea,{children:i})}import{jsx as Jn}from"react/jsx-runtime";var ta="Gametoken - CROSS";function er(){let{env:e,walletAddress:t}=oe(),r=!!t,{pairMap:o,ordersByPair:n,isEmpty:c}=Ie(e,"cross",t,r),{getTokenImage:i}=He(e,r),l=a=>{let s=o.get(a.toLowerCase());return`${Ve[e]}/gametoken/cross/${s?.base_symbol??""}`},d=`${Te[e]}/dex.png`;return Jn(Ee,{title:ta,icon:d,isEmpty:c,children:Jn(gt,{market:"cross",pairMap:o,ordersByPair:n,getDexUrl:l,getTokenImage:i})})}import{jsx as tr}from"react/jsx-runtime";var oa="Gametoken - CROSSD";function or(){let{env:e,walletAddress:t}=oe(),r=!!t,{pairMap:o,ordersByPair:n,isEmpty:c}=Ie(e,"crossd",t,r),{getTokenImage:i}=He(e,r),l=a=>{let s=o.get(a.toLowerCase());return`${Ve[e]}/gametoken/crossd/${s?.base_symbol??""}`},d=`${Te[e]}/dex.png`;return tr(Ee,{title:oa,icon:d,isEmpty:c,children:tr(gt,{market:"crossd",pairMap:o,ordersByPair:n,getDexUrl:l,getTokenImage:i})})}import{jsx as nr}from"react/jsx-runtime";var na="Gametoken - Forge";function rr(){let{env:e,walletAddress:t}=oe(),r=!!t,{pairMap:o,ordersByPair:n,isEmpty:c}=Ie(e,"forge",t,r),{getTokenImage:i}=He(e,r);if(c)return null;let l=a=>{let s=o.get(a.toLowerCase());return`${Ve[e]}/gametoken/forge/${s?.base_symbol??""}`},d=`${Te[e]}/dex.png`;return nr(Ee,{title:na,icon:d,isEmpty:c,children:nr(gt,{market:"forge",pairMap:o,ordersByPair:n,getDexUrl:l,getTokenImage:i})})}import Oo from"bignumber.js";import{useMemo as da}from"react";import{useQuery as ra}from"@tanstack/react-query";var ia="wp:forge-pools";function ir(e,t,r=!0){let o=zt[e],n=r&&!!t,{data:c,...i}=ra({queryKey:[ia,e,t],queryFn:async()=>{let d=await fetch(`${o}/v1/users/${t}/pools`,{cache:"no-store"});if(!d.ok)throw new Error(`forge pools fetch failed: ${d.status}`);return(await d.json()).data?.items??[]},enabled:n,staleTime:0}),l=c??[];return{pools:l,isEmpty:l.length===0,...i}}import{useQueries as aa}from"@tanstack/react-query";import{useMemo as sa}from"react";var la="wp:forge-token-detail";async function ca(e,t){let r=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store"});return r.ok?(await r.json())?.data?.token??null:null}function ar(e,t,r=!0){let o=zt[e],n=aa({queries:t.map(l=>({queryKey:[la,e,l],queryFn:()=>ca(o,l),enabled:r&&!!l,staleTime:3e4}))}),c=sa(()=>{let l=new Map;for(let d=0;d<n.length;d++){let a=n[d]?.data,s=t[d];a&&s&&l.set(s.toLowerCase(),a)}return l},[n,t]),i=n.some(l=>l.isLoading);return{detailMap:c,isLoading:i}}import{jsx as he,jsxs as wt}from"react/jsx-runtime";var pa="Forge",ma=18,fa="https://contents.crosstoken.io/wallet/token/images/FT.png";function ua(e){if(!e||e==="0")return"0";let t=new Oo(e).shiftedBy(-ma);return t.isZero()?"0":t.isGreaterThanOrEqualTo(1)?t.toFormat(2,Oo.ROUND_DOWN):t.toFormat(4,Oo.ROUND_DOWN)}function ga(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 sr(){let{env:e,walletAddress:t,onOutlink:r}=oe(),o=!!t,{pools:n,isEmpty:c}=ir(e,t,o),i=da(()=>n.map(s=>s.token.address),[n]),{detailMap:l}=ar(e,i,o&&i.length>0),d=s=>`${Ve[e]}/forge/token/${s.token.address}`,a=`${Te[e]}/forge.png`;return he(Ee,{title:pa,icon:a,iconFit:"contain",isEmpty:c,children:n.map(s=>{let m=l.get(s.token.address.toLowerCase()),y=m?.image_url||m?.image||s.token.image||fa,w=m?.symbol||s.token.symbol,g=d(s);return wt("a",{className:"wp-item","data-side":"lp",href:g,target:"_blank",rel:"noopener noreferrer",onClick:f=>Re(f,g,{category:"portfolio",origin:"portfolio-forge",payload:{pool:s,tokenDetail:m}},r),children:[wt("div",{className:"wp-item-body",children:[wt("div",{className:"wp-item-field",children:[wt("span",{className:"wp-item-label",children:["Pair (",w,")"]}),he("div",{className:"wp-svc-token",children:he("img",{className:"wp-svc-token-icon",src:y,alt:""})})]}),wt("div",{className:"wp-item-field",children:[he("span",{className:"wp-item-label",children:"LP Balance"}),he("div",{className:"wp-svc-token",children:he("span",{children:ua(s.lp_balance)})})]}),wt("div",{className:"wp-item-field",children:[he("span",{className:"wp-item-label",children:"Ownership"}),he("div",{className:"wp-svc-token",children:he("span",{children:ga(s.pool_ownership)})})]})]}),he("div",{className:"wp-item-badges",children:he("span",{className:"wp-badge wp-badge--mint",children:"Withdraw"})})]},s.pair_address)})})}M(`.wp-fullscreen[data-theme=dark],.wp-embed[data-theme=dark]{--wp-bg: var(--cck-surface-bg, #202530);--wp-card: var(--cck-surface-default, #292f40);--wp-border: var(--cck-border-default, #313b51);--wp-text: var(--cck-texticon-primary, #ffffff);--wp-text-60: var(--cck-texticon-secondary, #d3d7df);--wp-text-40: #8c97ad;--wp-text-30: var(--cck-texticon-tertiary, #717d97);--wp-mint: #00d4aa;--wp-green: var(--cck-primary, #019d92);--wp-red: var(--cck-error, #e70077);--wp-blue: #0488fc;--wp-purple: #7346f3;--wp-orange: #ff9d00}.wp-fullscreen[data-theme=light],.wp-embed[data-theme=light]{--wp-bg: var(--cck-surface-bg, #f5f6f8);--wp-card: var(--cck-surface-default, #ffffff);--wp-border: var(--cck-border-default, #e2e5ea);--wp-text: var(--cck-texticon-primary, #202530);--wp-text-60: var(--cck-texticon-secondary, #49556e);--wp-text-40: #8c97ad;--wp-text-30: var(--cck-texticon-tertiary, #a0a9b8);--wp-mint: #00d4aa;--wp-green: var(--cck-primary, #019d92);--wp-red: var(--cck-error, #e70077);--wp-blue: #0488fc;--wp-purple: #7346f3;--wp-orange: #ff9d00}.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:Sora,sans-serif;font-feature-settings:"calt" 0,"lnum" 1,"pnum" 1;box-sizing:border-box;-webkit-font-smoothing:antialiased}.wp-embed{width:100%;height:100%;min-height:0;background:var(--wp-bg);display:flex;flex-direction:column;overflow:hidden;font-family:Sora,sans-serif;font-feature-settings:"calt" 0,"lnum" 1,"pnum" 1;box-sizing:border-box;-webkit-font-smoothing:antialiased;color:var(--wp-text)}.wp-overlay{position:fixed;inset:0;z-index:49;background:#0009}.wp-header{display:flex;align-items:center;gap:20px;height:60px;padding:0 20px;flex-shrink:0}.wp-header-btn{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--wp-text);flex-shrink:0}.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:Roboto,Sora,sans-serif;font-size:16px;font-weight:600;line-height:24px;letter-spacing:.15px;text-align:center;color:var(--wp-text);margin:0}.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:rgba(255,255,255,.08) transparent}.wp-body::-webkit-scrollbar{width:4px}.wp-body::-webkit-scrollbar-track{background:transparent}.wp-body::-webkit-scrollbar-thumb{background:#ffffff14;border-radius:4px}.wp-body-inner{padding:16px 16px 128px;display:flex;flex-direction:column;gap:20px}.wp-svc-card{display:flex;flex-direction:column;gap:8px}.wp-svc-card-head{display:flex;align-items:center;gap:8px}.wp-svc-card-icon{width:20px;height:20px;border-radius:4px;flex-shrink:0;object-fit:cover}.wp-svc-card-title{font-size:14px;font-weight:600;line-height:1.3;color:var(--wp-text-60);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wp-svc-items{display:flex;flex-direction:column;gap:10px}.wp-item{position:relative;background:var(--wp-card);border-radius:12px;padding:14px 40px 14px 16px;display:flex;flex-direction:column;gap:6px;box-shadow:0 1px 3px #00000014,0 2px 8px #0000000a;overflow:hidden;text-decoration:none;cursor:pointer;transition:box-shadow .2s ease,transform .15s ease}.wp-item:hover{box-shadow:0 2px 6px #0000001f,0 4px 14px #0000000f;transform:translateY(-1px)}.wp-item:active{transform:translateY(0);box-shadow:0 1px 3px #00000014}.wp-item:before{content:"";position:absolute;top:0;left:0;width:3px;height:100%;border-radius:3px 0 0 3px;background:var(--wp-border)}.wp-item:after{content:"";position:absolute;right:14px;top:50%;transform:translateY(-50%);width:12px;height:12px;background:currentColor;opacity:.25;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3.5 1.5h7v7M10.5 1.5L1.5 10.5' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3.5 1.5h7v7M10.5 1.5L1.5 10.5' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;transition:opacity .15s}.wp-item:hover:after{opacity:.5}.wp-item[data-side=buy]:before{background:var(--wp-green)}.wp-item[data-side=sell]:before{background:var(--wp-red)}.wp-item[data-side=reward]:before{background:var(--wp-mint)}.wp-item[data-side=lp]:before{background:var(--wp-purple)}.wp-item-body{display:flex;gap:12px}.wp-item-field{flex:1;display:flex;flex-direction:column;gap:4px;min-width:0}.wp-item-label{font-size:11px;font-weight:500;line-height:1.3;color:var(--wp-text-40);letter-spacing:.03em;text-transform:uppercase}.wp-item-label--buy{color:var(--wp-green)}.wp-item-label--sell{color:var(--wp-red)}.wp-svc-token{display:flex;align-items:center;gap:8px;min-width:0}.wp-svc-token>span{font-size:14px;font-weight:600;line-height:1.4;color:var(--wp-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-svc-token-icon{width:22px;height:22px;border-radius:50%;flex-shrink:0;object-fit:cover}.wp-svc-buy{color:var(--wp-green)}.wp-svc-sell{color:var(--wp-red)}.wp-badge{display:inline-flex;align-items:center;font-size:10px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;padding:2px 7px;border-radius:4px;border:1px solid transparent;pointer-events:none}.wp-badge--mint{color:var(--wp-mint);background:#00d4aa1a;border-color:#00d4aa40}.wp-badge--muted{color:var(--wp-text-40);background:#8c97ad14;border-color:#8c97ad2e}.wp-badge--red{color:var(--wp-red);background:#e7007714;border-color:#e7007733}.wp-item-badges{display:flex;align-items:center;gap:6px}.wp-svc-empty{display:flex;align-items:center;justify-content:center;height:56px;background:var(--wp-card);border-radius:12px;font-size:13px;font-weight:400;color:var(--wp-text-30);box-shadow:0 1px 3px #00000014}@media(max-width:375px){.wp-header{gap:12px;padding:0 12px}.wp-top{padding:0 12px 12px;gap:12px}.wp-total{font-size:22px}.wp-legend{gap:10px}.wp-legend-label{font-size:11px}.wp-body-inner{padding:12px 12px 128px;gap:14px}.wp-svc-items{gap:8px}.wp-item{padding:12px 36px 12px 14px;gap:6px;border-radius:10px}.wp-item:after{right:10px;width:11px;height:11px}.wp-item-body{gap:10px}.wp-svc-token{gap:6px}.wp-svc-token>span{font-size:13px}.wp-svc-token-icon{width:20px;height:20px}}.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}
7
+ `);import{Fragment as ba,jsx as U,jsxs as $e}from"react/jsx-runtime";var Do=5,ha="wp:";function ht({env:e,theme:t="dark",walletAddress:r,onBack:o,showHeader:n=!0,variant:c="embed",className:i,sendTransaction:l,getTransactionReceipt:d,onOutlink:a}){let s=ce(e),m=!!r,y=wa(),{segments:w}=zn(s,r,m),[g,f]=be.useState(Do),[h,R]=be.useState(!1),L=be.useCallback(()=>{y.invalidateQueries({predicate:x=>typeof x.queryKey[0]=="string"&&x.queryKey[0].startsWith(ha)})},[y]),_=be.useCallback(()=>{L(),R(!0),setTimeout(()=>R(!1),600),f(Do)},[L]);be.useEffect(()=>{if(!m)return;let x=setInterval(()=>{f(B=>B<=1?(_(),Do):B-1)},1e3);return()=>clearInterval(x)},[m,_]);let k=be.useCallback(()=>{o?.()},[o]),V=be.useMemo(()=>({env:s,theme:t,open:!0,walletAddress:r,close:k,sendTransaction:l,getTransactionReceipt:d,onOutlink:a}),[s,t,r,k,l,d,a]),C=$e(ba,{children:[n&&$e("div",{className:"wp-header",children:[o?U("button",{type:"button",className:"wp-header-btn",onClick:o,children:U(jn,{})}):U("span",{className:"wp-header-btn","aria-hidden":!0}),U("h2",{className:"wp-header-title",children:"My Portfolio"}),$e("button",{type:"button",className:"wp-header-btn wp-refresh-btn",onClick:_,children:[U(qn,{className:h?"wp-spin-once":void 0}),m&&U("span",{className:"wp-refresh-badge",children:g})]})]}),U("div",{className:"wp-top",children:w.length>0&&$e("div",{className:"wp-asset",children:[$e("div",{className:"wp-asset-head",children:[U("span",{className:"wp-asset-head-label",children:"Consolidated Asset"}),U("span",{className:"wp-asset-head-icon",children:U(Gn,{})})]}),U("div",{className:"wp-bar",children:w.map(x=>U("div",{className:"wp-bar-seg",style:{flex:`${x.percentage} 0 0`,background:x.color},children:x.percentage>=5&&$e("span",{className:"wp-bar-seg-pct",children:[x.percentage,"%"]})},x.symbol))}),U("div",{className:"wp-legend",children:w.map(x=>$e("div",{className:"wp-legend-item",children:[U("span",{className:"wp-legend-dot",style:{background:x.color}}),U("span",{className:"wp-legend-label",children:x.symbol})]},x.symbol))})]})}),U("div",{className:"wp-body",children:$e("div",{className:"wp-body-inner",children:[U(Yn,{}),U(er,{}),U(or,{}),U(rr,{}),U(sr,{})]})})]});return U(Et.Provider,{value:V,children:c==="none"?C:U("div",{className:Z(c==="fullscreen"?"wp-fullscreen":"wp-embed",i),"data-theme":t,children:C})})}import{jsx as Wo,jsxs as lr}from"react/jsx-runtime";function cr({className:e}){let{env:t,theme:r,walletAddress:o,close:n,sendTransaction:c}=oe();return lr(Zt.Portal,{children:[Wo(Zt.Overlay,{className:"wp-overlay"}),lr(Zt.Content,{className:Z("wp-fullscreen",e),"data-theme":r,children:[Wo(Zt.Title,{className:"wp-sr-only",children:"My Portfolio"}),Wo(ht,{env:t,theme:r,walletAddress:o,onBack:n,variant:"none",sendTransaction:c})]})]})}import{jsx as dr}from"react/jsx-runtime";function va({env:e,theme:t="dark",walletAddress:r,open:o,onOpenChange:n,sendTransaction:c,onOutlink:i,children:l}){let d=ce(e),a=o!==void 0,[s,m]=nt.useState(!1),y=a?o:s,w=nt.useCallback(h=>{a||m(h),n?.(h)},[a,n]),g=nt.useCallback(()=>w(!1),[w]),f=nt.useMemo(()=>({env:d,theme:t,open:y,walletAddress:r,close:g,sendTransaction:c,onOutlink:i}),[d,t,y,r,g,c,i]);return dr(Et.Provider,{value:f,children:dr(xa.Root,{direction:"bottom",open:y,onOpenChange:w,noBodyStyles:!0,children:l})})}var pr=Object.assign(va,{Trigger:Dn,Content:cr});import{Fragment as Bo,jsx as p,jsxs as N}from"react/jsx-runtime";function Fo(e,t,r){let o=se[e],n=r.toUpperCase();if(t===o.cross&&n.includes("CROSSD"))return 0;if(t===o.cross&&n==="CROSS")return 1;if(t===o.bsc&&n==="CROSS")return 2}function ka(e){return parseInt(e.split(":")[1],10)}function Ca(e){let t=e.lastIndexOf(".");return t===-1?{main:e,decimal:""}:{main:e.slice(0,t),decimal:e.slice(t)}}function Na(e){let t=e.toLowerCase().replace(/^0x/,""),r=t.length>=8?t.slice(0,8):t.padEnd(8,"0"),o=parseInt(r.slice(0,4),16)%360,n=(o+60+parseInt(r.slice(4,8),16)%120)%360;return`linear-gradient(135deg, hsl(${o} 85% 65%), hsl(${n} 80% 55%))`}function mr({align:e="end",sideOffset:t=12,className:r,children:o}){let{env:n,theme:c,isMobile:i,open:l,drawerDirection:d,modal:a,showBalance:s,showForgeToken:m,showGameToken:y,showQR:w,qrLogoSrc:g,walletAddress:f,accountName:h,sendAccounts:R,profileImageUrl:L,preferredTokens:_,close:k,onSelectWallet:V,onCopyAddress:C,onDisconnect:x,disconnectLabel:B,termsUrl:T,termsLabel:Y,privacyUrl:j,privacyLabel:X,portalStyle:Ae,navContent:we,navPosition:Oe,footerContent:xe,view:q,setView:J,selectedSendToken:ve,setSelectedSendToken:re,showPortfolio:qe,portfolioTitle:De,showTotalAssets:rt,totalAssetsLabel:Pe,sendTransaction:ye,getTransactionReceipt:Se,onOutlink:ke}=Be(),{tokens:le,isLoading:me}=mt(n,f,l&&s),{statsMap:We}=ft(n,s),{categoryMap:fe}=_n(n,s),Ce=s&&rt,{displayValue:Ge,isLowerBound:it,isLoading:yt}=An(n,f,l&&Ce),[Ne,u]=F.useState(!1),P=F.useRef(null),[D,H]=F.useState(0),{holdings:G,isLoading:ee}=Sn(n,f,l&&s&&m),Ze=F.useMemo(()=>G.map(b=>b.token),[G]),{imageMap:Ke}=Mn(n,Ze,m&&G.length>0),at=F.useMemo(()=>{let b=[],A=[],W=[],Q=new Map((_??[]).map((O,K)=>[`${ka(O.chainId)}:${O.address.toLowerCase()}`,K]));for(let O of le){let K=Fo(n,O.chainId,O.symbol)!==void 0,Ye=`${O.chainId}:${O.address.toLowerCase()}`,Qe=Q.get(Ye),co=new St(O.quantity.numeric).shiftedBy(-O.quantity.decimals);if(K)b.push(O);else if(Qe!==void 0)A.push(O);else if(co.isGreaterThan(0)){if(!y&&fe.get(So(O.chainId,O.address))==="game")continue;W.push(O)}}return b.sort((O,K)=>{let Ye=Fo(n,O.chainId,O.symbol)??99,Qe=Fo(n,K.chainId,K.symbol)??99;return Ye-Qe}),A.sort((O,K)=>{let Ye=Q.get(`${O.chainId}:${O.address.toLowerCase()}`)??99,Qe=Q.get(`${K.chainId}:${K.address.toLowerCase()}`)??99;return Ye-Qe}),W.sort((O,K)=>{let Ye=We.get(tt(O.chainId,O.address)),Qe=We.get(tt(K.chainId,K.address)),co=new St(O.quantity.numeric).shiftedBy(-O.quantity.decimals).multipliedBy(Ye?.price??0);return new St(K.quantity.numeric).shiftedBy(-K.quantity.decimals).multipliedBy(Qe?.price??0).minus(co).toNumber()}),[...b,...A,...W]},[le,n,We,y,fe,_]),kt=F.useMemo(()=>{if(!m)return[];let b=new Set(le.map(A=>A.address.toLowerCase()));return[...G].filter(A=>!b.has(A.token.toLowerCase())).sort((A,W)=>{let Q=new St(A.value);return new St(W.value).minus(Q).toNumber()})},[G,m,le]),st=F.useRef(!1),Fe=F.useCallback(b=>{st.current=!0,J(b)},[J]),_r=F.useCallback(()=>{re(null),Fe("wallet")},[re,Fe]),Ar=F.useCallback(b=>{re(b),Fe("send")},[re,Fe]),Or=F.useCallback(()=>{re(null),Fe("wallet")},[re,Fe]);F.useEffect(()=>{l||(st.current=!1)},[l]);let Uo=F.useRef(null);F.useEffect(()=>{let b=Uo.current;if(!b||!i)return;let A=W=>{W.pointerType==="touch"&&W.stopPropagation()};return b.addEventListener("pointerdown",A),()=>b.removeEventListener("pointerdown",A)},[i]);let[Ct,zo]=F.useState(!1),ao=F.useRef(void 0);F.useEffect(()=>()=>clearTimeout(ao.current),[]),F.useEffect(()=>{let b=P.current;if(!b||xe===null){H(0);return}let A=()=>{H(b.offsetHeight)};if(A(),typeof ResizeObserver>"u")return;let W=new ResizeObserver(A);return W.observe(b),()=>W.disconnect()},[xe]);let jo=F.useCallback(async()=>{if(!Ct)try{await navigator.clipboard.writeText(f),zo(!0),clearTimeout(ao.current),ao.current=setTimeout(()=>zo(!1),2e3),C?.(f,!0)}catch{C?.(f,!1)}},[f,C,Ct]),so=F.useCallback(b=>{b.currentTarget.setAttribute("data-loaded","true")},[]),Dr=F.useMemo(()=>({background:Na(f)}),[f]),qo=F.useMemo(()=>L||Lt(n,f,{size:120,bg:c==="dark"?"1A1A2E":"F3F6F8"}),[L,n,f,c]),lo=F.useMemo(()=>Ca(Ge),[Ge]),Wr=T||j?N("div",{className:"wi-legal-links",children:[T&&p("a",{className:"wi-legal-link",href:T,target:"_blank",rel:"noopener noreferrer",onClick:b=>Re(b,T,{category:"terms",origin:"terms"},ke),children:Y}),T&&j&&p("span",{className:"wi-legal-sep","aria-hidden":!0,children:"\xB7"}),j&&p("a",{className:"wi-legal-link",href:j,target:"_blank",rel:"noopener noreferrer",onClick:b=>Re(b,j,{category:"privacy",origin:"privacy"},ke),children:X})]}):null,Go=x?N("button",{type:"button",className:"wi-disconnect-btn",onClick:()=>{x(),k()},children:[p(gn,{size:12}),p("span",{className:"wi-disconnect-label",children:B})]}):null,Fr=N("div",{className:Z("wi-view-inner",st.current&&"wi-view-wallet"),children:[Ce&&(()=>{let b=qe;return N(b?"button":"div",{...b?{type:"button",onClick:()=>Fe("portfolio"),"aria-label":"View Portfolio"}:{},className:"wi-total-section","data-clickable":b||void 0,children:[N("div",{className:"wi-total-head",children:[p("span",{className:"wi-total-label",children:Pe}),p("span",{role:"button",tabIndex:0,className:"wi-total-eye",onClick:W=>{W.stopPropagation(),u(Q=>!Q)},onKeyDown:W=>{(W.key==="Enter"||W.key===" ")&&(W.preventDefault(),W.stopPropagation(),u(Q=>!Q))},"aria-label":Ne?"Show balance":"Hide balance",children:Ne?p(yn,{}):p(vn,{})})]}),N("div",{className:"wi-total-body",children:[yt?p("div",{className:"wi-skeleton-block wi-total-skeleton",style:{width:160,height:36}}):p("div",{className:"wi-total-value","data-hidden":Ne||void 0,children:Ne?p("span",{className:"wi-total-mask",children:"\u2022\u2022\u2022\u2022\u2022\u2022"}):N(Bo,{children:[it&&p("span",{className:"wi-total-lte",children:"\u2264"}),p("span",{className:"wi-total-currency",children:"$"}),p("span",{className:"wi-total-amount",children:lo.main}),lo.decimal&&p("span",{className:"wi-total-decimal",children:lo.decimal})]})}),b&&p("span",{className:"wi-total-chevron","aria-hidden":!0,children:p(bn,{size:18})})]})]})})(),Oe==="top"&&we&&p("div",{className:"wi-nav-fixed",children:we}),s&&p("div",{ref:Uo,className:"wi-scrollable-body","data-vaul-no-drag":!0,children:N("div",{className:"wi-token-list",children:[me&&Array.from({length:5},(b,A)=>N("div",{className:"wi-skeleton-item",children:[N("div",{className:"wi-skeleton-left",children:[p("div",{className:"wi-skeleton-block wi-skeleton-icon"}),N("div",{className:"wi-skeleton-lines",children:[p("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),p("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),N("div",{className:"wi-skeleton-right",children:[p("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),p("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},A)),!me&&at.length===0&&!m&&p("div",{className:"wi-empty",children:"No Tokens Found"}),at.map(b=>{let A=We.get(tt(b.chainId,b.address)),W=A?parseFloat(A.percent_change_24h):null,Q=W!==null&&W>=0,O=ho(n,b.chainId);return N("button",{type:"button",className:"wi-token-item wi-token-item--button",onClick:()=>Ar(b),"aria-label":`Send ${b.symbol}`,children:[N("div",{className:"wi-token-left",children:[N("div",{className:"wi-token-icon-wrap",children:[p("img",{src:b.icon_url,alt:b.symbol,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:so,onError:K=>{K.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),O&&p("img",{src:O,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:K=>{K.currentTarget.style.display="none"}})]}),N("div",{className:"wi-token-info",children:[p("span",{className:"wi-token-name",children:b.symbol}),A&&N("div",{className:"wi-token-price-row",children:[p("span",{className:"wi-token-price",children:go(A.price)}),p("span",{className:"wi-token-change","data-positive":Q,"data-zero":W===0||void 0,children:W!==null&&(W===0?"0%":`${Q?"+":"-"}${(Q?Math.floor:Math.ceil)(Math.abs(W)*100)/100}%`)})]})]})]}),N("div",{className:"wi-token-right",children:[p("span",{className:"wi-token-balance",children:et(b.quantity.numeric,b.quantity.decimals)}),A&&p("span",{className:"wi-token-value",children:pn(b.quantity.numeric,b.quantity.decimals,A.price)})]})]},`${b.address}-${b.chainId}`)}),m&&ee&&Array.from({length:3},(b,A)=>N("div",{className:"wi-skeleton-item",children:[N("div",{className:"wi-skeleton-left",children:[p("div",{className:"wi-skeleton-block wi-skeleton-icon"}),N("div",{className:"wi-skeleton-lines",children:[p("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),p("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),N("div",{className:"wi-skeleton-right",children:[p("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),p("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},`forge-sk-${A}`)),m&&!ee&&!me&&at.length===0&&kt.length===0&&p("div",{className:"wi-empty",children:"No Tokens Found"}),m&&kt.map(b=>{let A=Ke.get(b.token)||"",W=ho(n,se[n].cross);return N("div",{className:"wi-token-item",children:[N("div",{className:"wi-token-left",children:[N("div",{className:"wi-token-icon-wrap",children:[p("img",{src:A||"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:so,onError:Q=>{Q.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),W&&p("img",{src:W,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:Q=>{Q.currentTarget.style.display="none"}})]}),N("div",{className:"wi-token-info",children:[p("span",{className:"wi-token-name",children:b.token_name}),p("div",{className:"wi-token-price-row",children:N("span",{className:"wi-token-price",children:[et(b.current_price,18)," CROSS"]})})]})]}),N("div",{className:"wi-token-right",children:[p("span",{className:"wi-token-balance",children:et(b.balance,18)}),p("span",{className:"wi-token-value",children:go(b.current_value_usd)})]})]},`forge-${b.token}`)})]})}),Oe==="bottom"&&we&&p("div",{className:"wi-nav-fixed",children:we}),Go&&p("div",{className:"wi-wallet-disconnect-row",children:Go})]},"wallet"),Br=qe?p("div",{className:Z("wi-view-inner wi-portfolio-body",st.current&&"wi-view-portfolio"),children:p(ht,{env:n,theme:c,walletAddress:f,showHeader:!1,sendTransaction:ye,getTransactionReceipt:Se,onOutlink:ke})},"portfolio"):null,Vr=ve?p("div",{className:Z("wi-view-inner wi-send-body",st.current&&"wi-view-send"),children:p(Ht,{env:n,theme:c,walletAddress:f,accountName:h,accounts:R,token:ve,tokens:at,onTokenChange:re,sendTransaction:ye,getTransactionReceipt:Se,onConfirmSuccess:Or,onOutlink:ke})},"send"):null,Hr=p("div",{className:Z("wi-view-inner wi-qr-body",st.current&&"wi-view-qr"),children:N("div",{className:"wi-qr-section",children:[N("div",{className:"wi-qr-card",children:[N("div",{className:"wi-qr-code",children:[p(ya,{value:f,size:180,level:"H",marginSize:2,...g&&{imageSettings:{src:g,height:33,width:33,excavate:!0}}}),!g&&p("div",{className:"wi-qr-logo",children:p(kn,{size:33})})]}),p("p",{className:"wi-qr-address",children:f}),N("button",{type:"button",className:"wi-qr-copy-btn",onClick:jo,children:[p("span",{className:"wi-qr-copy-icon",children:Ct?p(Rt,{size:16}):p(bo,{size:16})}),p("span",{className:"wi-qr-copy-text",children:Ct?"Copied!":"Copy address"})]})]}),Wr]})},"qr"),$r=q==="qr"||q==="portfolio"||q==="send",Zo=xe!==null?p("div",{className:"wi-builtin-footer",children:xe}):null,Ko=N("div",{className:"wi-account-text",children:[V?N("button",{type:"button",className:"wi-account-row wi-account-row--btn",onClick:V,"aria-label":"Switch account",children:[p("span",{className:"wi-account-name",children:h??"Account 1"}),p("span",{className:"wi-account-switch","aria-hidden":"true",children:p(xn,{size:12})})]}):p("div",{className:"wi-account-row",children:p("span",{className:"wi-account-name",children:h??"Account 1"})}),N("button",{type:"button",className:"wi-address-row-btn",onClick:jo,"aria-label":"Copy address",children:[p("span",{className:"wi-account-address",children:ue(f)}),p("span",{className:"wi-account-copy",children:Ct?p(Rt,{size:14}):p(bo,{size:14})})]})]}),Yo=N(Bo,{children:[o,$r?N("div",{className:"wi-sticky-header",children:[N("div",{className:"wi-header wi-header--wallet wi-header--sub-account",children:[p("button",{type:"button",className:"wi-header-back",onClick:_r,"aria-label":"Back",children:p(hn,{})}),p("div",{className:"wi-account-block wi-account-block--sub-account",children:Ko}),p("button",{type:"button",className:"wi-header-action",onClick:k,"aria-label":"Close",children:p(xo,{size:24})})]}),p("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:[p("div",{className:"wi-avatar-fallback",style:Dr}),qo&&p("img",{src:qo,alt:"",className:"wi-avatar-img",width:30,height:30,draggable:!1,onLoad:so,onError:b=>{b.currentTarget.style.display="none"}})]}),Ko]}),N("div",{className:"wi-header-actions",children:[w&&p("button",{type:"button",className:"wi-header-action",onClick:()=>Fe("qr"),"aria-label":"Show QR code",children:p(wn,{size:20})}),p("button",{type:"button",className:"wi-header-action",onClick:k,"aria-label":"Close",children:p(xo,{size:24})})]})]}),p("hr",{className:"wi-divider"})]}),N("div",{className:"wi-view-container",children:[q==="wallet"&&Fr,q==="qr"&&Hr,q==="portfolio"&&Br,q==="send"&&Vr]}),Zo&&q!=="portfolio"&&q!=="send"&&p("div",{className:"wi-sticky-footer",children:p("div",{className:"wi-footer",ref:P,children:Zo})})]}),Qo={...Ae,...D>0?{"--wi-footer-height":`${D}px`}:null};return i?N(Kt.Portal,{children:[a&&p(Kt.Overlay,{className:"wi-drawer-overlay"}),N(Kt.Content,{className:Z("wi-drawer-content",r),"data-theme":c,style:Qo,"data-direction":d,"data-no-balance":!s||void 0,"data-has-footer":D>0||void 0,"data-view":q,children:[p(Kt.Title,{className:"wi-sr-only",children:"My Wallet"}),Yo]})]}):N(Bo,{children:[a&&l&&p("div",{className:"wi-drawer-overlay",onClick:k}),p(Yt.Portal,{children:p(Yt.Content,{align:e,sideOffset:t,className:Z("wi-popover-content",r),"data-theme":c,style:Qo,"data-no-balance":!s||void 0,"data-has-footer":D>0||void 0,"data-view":q,children:Yo})})]})}import*as fr from"react";function ur({position:e="top",children:t}){let{setNavContent:r,setNavPosition:o}=Be();return fr.useEffect(()=>(r(t),o(e),()=>r(null)),[t,e,r,o]),null}import*as gr from"react";function wr({children:e}){let{setFooterContent:t}=Be();return gr.useEffect(()=>(t(e),()=>t(null)),[e,t]),null}M(`[data-theme=dark].wi-popover-content,[data-theme=dark].wi-drawer-content{--wi-primary: var(--cck-primary, #019d92);--wi-secondary: var(--cck-secondary, #e70077);--wi-surface-bg: var(--cck-surface-bg, #121212);--wi-surface-default: var(--cck-surface-default, rgba(255, 255, 255, .05));--wi-surface-subtle: var(--cck-surface-subtle, rgba(255, 255, 255, .1));--wi-border-default: var(--cck-border-default, rgba(255, 255, 255, .05));--wi-border-subtle: var(--cck-border-subtle, rgba(255, 255, 255, .1));--wi-texticon-primary: var(--cck-texticon-primary, #ffffff);--wi-texticon-secondary: var(--cck-texticon-secondary, rgba(255, 255, 255, .7));--wi-texticon-tertiary: var(--cck-texticon-tertiary, rgba(255, 255, 255, .5));--wi-on-primary: var(--cck-on-primary, #ffffff);--wi-error: var(--cck-error, #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(--cck-primary, #019d92);--wi-secondary: var(--cck-secondary, #e70077);--wi-surface-bg: var(--cck-surface-bg, #ffffff);--wi-surface-default: var(--cck-surface-default, rgba(18, 18, 18, .05));--wi-surface-subtle: var(--cck-surface-subtle, rgba(18, 18, 18, .1));--wi-border-default: var(--cck-border-default, rgba(18, 18, 18, .05));--wi-border-subtle: var(--cck-border-subtle, rgba(18, 18, 18, .1));--wi-texticon-primary: var(--cck-texticon-primary, #121212);--wi-texticon-secondary: var(--cck-texticon-secondary, rgba(18, 18, 18, .7));--wi-texticon-tertiary: var(--cck-texticon-tertiary, rgba(18, 18, 18, .5));--wi-on-primary: var(--cck-on-primary, #ffffff);--wi-error: var(--cck-error, #e70077);--wi-shadow: 0 2px 16px -2px rgba(0, 0, 0, .15)}
8
8
  `);M(`.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}
9
9
  `);M(`@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}}
10
10
  `);M(`.wi-popover-content{z-index:100001;width:343px;border-radius:24px;border:1px solid var(--wi-border-default);background:var(--wi-surface-bg);box-shadow:var(--wi-shadow);animation:wi-fade-in .15s ease-out;height:552px;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(552px + var(--wi-footer-height, 0px)),calc(100dvh - 32px))}.wi-drawer-overlay{position:fixed;inset:0;z-index:100000;background:#0009}.wi-drawer-content{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:auto;left:0;right:0;width:100%;max-height:60vh;margin:0 auto}.wi-drawer-content[data-has-footer][data-direction=bottom]{max-height:min(calc(60vh + var(--wi-footer-height, 0px)),85dvh)}.wi-drawer-content[data-direction=bottom][data-view=qr]{max-height:85dvh}.wi-popover-content[data-view=qr]{height:auto;max-height:calc(100dvh - 32px);overflow-y:auto}.wi-drawer-content[data-view=qr]{overflow-y:auto}.wi-sticky-header{flex-shrink:0}.wi-header{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:20px 24px}.wi-header--wallet{align-items:flex-start}.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:38px;height:38px;padding:4px;border-radius:50%;background:var(--wi-surface-bg);box-sizing:border-box;overflow:hidden}.wi-avatar-fallback{position:absolute;inset:4px;border-radius:50%;z-index:0}.wi-avatar-img{position:relative;z-index:1;width:30px;height:30px;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 4px;margin:-2px -4px;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:14px;font-weight:600;line-height:1.4;color:var(--wi-texticon-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wi-account-switch{display:inline-flex;align-items:center;justify-content:center;padding:2px;border:none;background:transparent;color:var(--wi-texticon-tertiary);border-radius:4px;flex-shrink:0}.wi-address-row-btn{display:inline-flex;align-items:center;gap:4px;padding:0;border:none;background:transparent;cursor:pointer;color:inherit;font:inherit;text-align:left;min-width:0;transition:opacity .15s ease}.wi-address-row-btn:hover{opacity:.7}.wi-account-address{font-family:inherit;font-size:12px;font-weight:400;line-height:1.4;color:var(--wi-texticon-tertiary);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}.wi-header-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}.wi-header-action{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(--wi-texticon-primary);flex-shrink:0;transition:opacity .15s ease,background .15s ease}.wi-header-action:hover{opacity:.75}.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(--wi-texticon-primary);transition:opacity .15s ease}.wi-header-close:hover{opacity:.7}.wi-total-section{margin:16px 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}button.wi-total-section{cursor:pointer;transition:opacity .15s ease}button.wi-total-section:hover,button.wi-total-section:focus-visible{outline:none;opacity:.85}.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-chevron{display:inline-flex;align-items:center;justify-content:center;color:var(--wi-texticon-tertiary);flex-shrink:0;transition:transform .15s ease,color .15s ease}button.wi-total-section:hover .wi-total-chevron,button.wi-total-section:focus-visible .wi-total-chevron{color:var(--wi-texticon-primary);transform:translate(2px)}.wi-total-label{font-family:inherit;font-size:12px;font-weight:400;line-height:1.4;color:var(--wi-texticon-tertiary)}.wi-total-eye{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;color:var(--wi-texticon-tertiary);cursor:pointer;transition:opacity .15s ease;border-radius:4px}.wi-total-eye:hover{opacity:.7}.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.3;color:var(--wi-texticon-primary);font-variant-numeric:tabular-nums;min-height:36px;white-space:nowrap}.wi-total-currency,.wi-total-amount{font-size:28px}.wi-total-decimal{font-size:20px;color:var(--wi-texticon-primary)}.wi-total-lte{margin-right:2px;font-weight:500;font-size:20px;color:var(--wi-texticon-secondary)}.wi-total-mask{letter-spacing:2px;font-size:28px;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:16px 24px 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:12px}.wi-token-item{display:flex;align-items:center;justify-content:space-between;padding:4px 0}.wi-token-left{display:flex;align-items:center;gap:12px;min-width:0}.wi-token-icon-wrap{position:relative;width:32px;height:32px;flex-shrink:0}.wi-token-icon{width:28px;height:28px;border-radius:8px;object-fit:contain;opacity:0;transition:opacity .2s ease;background:var(--wi-surface-default)}.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:14px;font-weight:600;line-height:1.3;color:var(--wi-texticon-primary);white-space:nowrap}.wi-token-price-row{display:flex;align-items:center;gap:4px}.wi-token-price{font-family:inherit;font-size:12px;font-weight:400;line-height:1.3;color:var(--wi-texticon-secondary);white-space:nowrap}.wi-token-change{font-family:inherit;font-size:12px;font-weight:400;line-height:1.3;white-space:nowrap}.wi-token-change[data-positive=true]{color:var(--wi-primary)}.wi-token-change[data-positive=false]{color:var(--wi-secondary)}.wi-token-change[data-zero]{opacity:.8}.wi-token-right{display:flex;flex-direction:column;align-items:flex-end;flex-shrink:0}.wi-token-balance{font-family:inherit;font-size:14px;font-weight:600;line-height:1.3;color:var(--wi-texticon-primary);white-space:nowrap}.wi-token-value{font-family:inherit;font-size:12px;font-weight:400;line-height:1.3;color:var(--wi-texticon-secondary);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:8px 24px 16px}.wi-disconnect-btn{display:inline-flex;align-items:center;justify-content:center;gap:4px;min-height:16px;padding:0;border:none;background:transparent;color:var(--wi-texticon-tertiary);font-family:inherit;font-size:12px;font-weight:400;line-height:1.3;cursor:pointer;transition:opacity .15s ease}.wi-disconnect-btn:hover{opacity:.75}.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;margin-top:16px;font-family:inherit;font-size:10px;font-weight:400;line-height:1.3;color:var(--wi-texticon-tertiary)}.wi-legal-link{color:inherit;text-decoration:underline;text-underline-offset:2px;transition:opacity .15s ease}.wi-legal-link:hover{opacity:.75}.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;padding:0;border:none;background:transparent;cursor:pointer;color:var(--wi-texticon-primary);flex-shrink:0;transition:opacity .15s ease}.wi-header-back:hover{opacity:.7}.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:0 0 auto;min-height:424px;overflow:visible}.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-top{padding:16px 20px;gap:14px}.wi-portfolio-body .wp-body-inner{padding:4px 20px 24px;gap:16px}.wi-qr-section{flex:0 0 auto;min-height:424px;display:flex;flex-direction:column;overflow:visible;padding:16px 24px}.wi-qr-card{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;flex:0 0 auto;min-height:356px;padding:32px 24px;background:var(--wi-border-default);border:1px solid var(--wi-border-default);border-radius:12px}.wi-qr-code{position:relative;display:flex;align-items:center;justify-content:center}.wi-qr-logo{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);pointer-events:none}.wi-qr-address{font-family:inherit;font-size:14px;font-weight:400;line-height:1.3;color:var(--wi-texticon-primary);text-align:center;word-break:break-all;max-width:247px;margin:0}.wi-qr-copy-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:8px 12px;border:1px solid var(--wi-border-subtle);background:var(--wi-surface-default);border-radius:8px;cursor:pointer;transition:opacity .15s ease}.wi-qr-copy-btn:hover{opacity:.7}.wi-qr-copy-icon{display:inline-flex;color:var(--wi-texticon-secondary)}.wi-qr-copy-text{font-family:inherit;font-size:12px;font-weight:600;line-height:1.3;color:var(--wi-texticon-secondary);white-space:nowrap}
11
11
  `);M(`.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}
12
- `);import{jsx as Vo}from"react/jsx-runtime";var Ra="https://terms.crosstoken.io/docs/cross-terms-of-use",Ia="https://terms.crosstoken.io/docs/nexus-privacy-policy";function Ta({env:e,theme:t="dark",mobileBreakpoint:r=768,drawerDirection:o,modal:n,showBalance:c=!1,showForgeToken:s=!1,showGameToken:l=!0,showQR:d=!0,qrLogoSrc:i,walletAddress:a,accountName:m,sendAccounts:y,profileImageUrl:w,connectorId:g,connectorName:f,connectorIconUrl:h,preferredTokens:R=[],onSelectWallet:L,onCopyAddress:O,onDisconnect:C,disconnectLabel:B="Disconnect",termsUrl:b=Ra,termsLabel:N="Terms of Service",privacyUrl:V=Ia,privacyLabel:I="Privacy Policy",open:Y,onOpenChange:j,showPortfolio:X=!1,portfolioTitle:_e="My Portfolio",showTotalAssets:we=!0,totalAssetsLabel:Ae="Total Assets USD",sendTransaction:xe,getTransactionReceipt:q,onOutlink:J,style:ve,children:re}){let qe=ce(e),Oe=g?Bt[g]:void 0,rt=f??Oe?.name,Pe=h??Oe?.iconUrl,ye=lt(`(max-width: ${r}px)`),De=o??(c?"right":"bottom"),ke=n??!1,le=Y!==void 0,[me,We]=ie.useState(!1),fe=le?Y:me,Ce=ie.useCallback(kt=>{le||We(kt),j?.(kt)},[le,j]),Ge=ie.useCallback(()=>Ce(!1),[Ce]),[it,yt]=ie.useState(null),[Ne,u]=ie.useState("top"),[P,D]=ie.useState(null),[H,G]=ie.useState("wallet"),[ee,Ze]=ie.useState(null);ie.useEffect(()=>{fe||(G("wallet"),Ze(null))},[fe]);let Ke=ie.useCallback(()=>{No(a),C?.()},[C,a]),at=ie.useMemo(()=>({env:qe,theme:t,isMobile:ye,open:fe,drawerDirection:De,modal:ke,showBalance:c,showForgeToken:s,showGameToken:l,showQR:d,qrLogoSrc:i,walletAddress:a,accountName:m,sendAccounts:y,profileImageUrl:w,connectorName:rt,connectorIconUrl:Pe,preferredTokens:R,close:Ge,onSelectWallet:L,onCopyAddress:O,onDisconnect:C?Ke:void 0,disconnectLabel:B,termsUrl:b,termsLabel:N,privacyUrl:V,privacyLabel:I,portalStyle:ve,navContent:it,navPosition:Ne,setNavContent:yt,setNavPosition:u,footerContent:P,setFooterContent:D,view:H,setView:G,selectedSendToken:ee,setSelectedSendToken:Ze,showPortfolio:X,portfolioTitle:_e,showTotalAssets:we,totalAssetsLabel:Ae,sendTransaction:xe,getTransactionReceipt:q,onOutlink:J}),[qe,t,ye,fe,De,ke,c,s,l,d,i,a,m,y,w,rt,Pe,R,Ge,L,O,C,Ke,B,b,N,V,I,ve,it,Ne,P,H,ee,X,_e,we,Ae,xe,q,J]);return Vo(fo.Provider,{value:at,children:ye?Vo(La.Root,{direction:De,open:fe,onOpenChange:Ce,noBodyStyles:!0,children:re},"drawer"):Vo(hr.Root,{open:fe,onOpenChange:Ce,children:re},"popover")})}var bt=Object.assign(Ta,{Trigger:Pn,Content:mr,Nav:ur,Footer:wr});import*as Me from"react";import*as Er from"@radix-ui/react-dialog";import{Drawer as Oa}from"vaul";import{createContext as Ea,useContext as Pa}from"react";var Qt=Ea(null);function Mt(){let e=Pa(Qt);if(!e)throw new Error("WalletConnectModal compound components must be used within <WalletConnectModal>");return e}import{useState as br,useEffect as Sa,useCallback as Ma}from"react";function Xt(){let[e,t]=br([]),[r,o]=br(!0);Sa(()=>{if(typeof window>"u"){o(!1);return}let c=[],s=d=>{let{info:i}=d.detail;i?.rdns&&!c.some(a=>a.rdns===i.rdns)&&(c.push({rdns:i.rdns,name:i.name,icon:i.icon}),t([...c]))};window.addEventListener("eip6963:announceProvider",s),window.addEventListener("eip6963:crossAnnounceProvider",s),window.dispatchEvent(new Event("eip6963:requestProvider")),window.dispatchEvent(new Event("eip6963:crossRequestProvider"));let l=setTimeout(()=>o(!1),500);return()=>{window.removeEventListener("eip6963:announceProvider",s),window.removeEventListener("eip6963:crossAnnounceProvider",s),clearTimeout(l)}},[]);let n=Ma(c=>e.some(s=>s.rdns===c),[e]);return{wallets:e,isDetected:n,isLoading:r}}import*as vr from"@radix-ui/react-dialog";import{Drawer as _a}from"vaul";import{jsx as xr}from"react/jsx-runtime";function yr({asChild:e,children:t}){let{isMobile:r}=Mt(),o=r?_a.Trigger:vr.Trigger;return xr(o,{asChild:e??t!=null,children:t??xr("button",{type:"button",children:"Connect Wallet"})})}import*as Ue from"@radix-ui/react-dialog";import{Drawer as eo}from"vaul";import{jsx as z,jsxs as xt}from"react/jsx-runtime";function Jt(){return xt("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[z("circle",{cx:"20",cy:"20",r:"20",fill:"#00D5AA"}),z("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 kr(){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:[z("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"}),z("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"}),z("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"}),z("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"}),z("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"}),z("path",{d:"M22.1857 36.1951V39.831H17.6699V36.1951H22.1857Z",fill:"#C0C4CD"}),z("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"})]}),z("defs",{children:z("clipPath",{id:"clip0_1331_27065",children:z("rect",{width:"40",height:"40",fill:"white"})})})]})}function Cr(){return xt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"247",height:"246",viewBox:"0 0 247 246",fill:"none",children:[z("rect",{width:"247.005",height:"245.105",rx:"36",fill:"#121212"}),z("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"}),z("path",{d:"M59.8364 99.8915V59.7551H12.0414L30.4787 77.8377V99.8915H59.8364Z",fill:"#2FD7FF"}),z("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 Nr(){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:[z("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"}),z("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"})]}),z("defs",{children:z("clipPath",{id:"clip0_1185_7785",children:z("rect",{width:"28",height:"28",fill:"white"})})})]})}function Lr(){return z("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:z("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var Ho={cross_embedded:{id:"cross_embedded",name:"CROSSx with Social",description:"Sign in with Google or Apple",icon:Jt,featured:!0},cross_wallet:{id:"cross_wallet",name:"CROSSx",description:"App approval is required",icon:Jt},cross_extension:{id:"cross_extension",name:"CROSSx Extension",description:"Browser extension approval is required",icon:Jt,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:kr,rdns:"io.metamask"},verse8:{id:"verse8",name:"Verse8 Wallet",description:"Optimized for Forge and Verse8 ecosystem",icon:Cr,badge:"For Forge"},tron:{id:"tron",name:"Tron Wallet",description:"Dedicated for Tron-based transactions and assets",icon:Nr,badge:"For SHOP"}};function vt(e){return Ho[e]}import{Fragment as Aa,jsx as E,jsxs as ae}from"react/jsx-runtime";function Rr({wallet:e,detected:t,onConnect:r}){let o=()=>{if(e.installUrl&&!t){window.open(e.installUrl,"_blank","noopener,noreferrer");return}r()},n=e.icon;return ae("button",{type:"button",className:"wcm-wallet-item",onClick:o,children:[ae("div",{className:"wcm-wallet-item-left",children:[E("div",{className:"wcm-wallet-icon",children:E(n,{})}),ae("div",{className:"wcm-wallet-info",children:[ae("div",{className:"wcm-wallet-name-row",children:[E("span",{className:"wcm-wallet-name",children:e.name}),e.badge&&E("span",{className:"wcm-wallet-badge",children:e.badge})]}),E("span",{className:"wcm-wallet-desc",children:e.description})]})]}),e.installUrl&&(t?E("span",{className:"wcm-installed-label",children:"Installed"}):E("span",{className:"wcm-install-btn",children:"Install"}))]})}function Ir(){let{wallets:e,activeWalletIds:t,isDetected:r,close:o,isMobile:n}=Mt(),c=t.filter(d=>{let i=vt(d).visibility;return!i||i==="always"?!0:i==="desktop-only"?!n:i==="mobile-only"?n:!0}),s=c.filter(d=>vt(d).featured),l=c.filter(d=>!vt(d).featured);return ae(Aa,{children:[ae("div",{className:"wcm-header",children:[ae("div",{className:"wcm-header-text",children:[E("h2",{className:"wcm-title",children:"Connect Wallet"}),E("p",{className:"wcm-subtitle",children:"Connect with one of our available wallet providers to continue."})]}),E("button",{type:"button",className:"wcm-close-btn",onClick:o,children:E(Lr,{})})]}),E("div",{className:"wcm-divider"}),ae("div",{className:"wcm-body",children:[s.map(d=>{let i=vt(d),a=i.rdns?r(i.rdns):!1;return E(Rr,{wallet:i,detected:a,onConnect:()=>{e[d]?.(),o()}},d)}),s.length>0&&l.length>0&&ae("div",{className:"wcm-separator",children:[E("div",{className:"wcm-separator-line"}),E("span",{className:"wcm-separator-text",children:"or"}),E("div",{className:"wcm-separator-line"})]}),E("div",{className:"wcm-wallet-list",children:l.map(d=>{let i=vt(d),a=i.rdns?r(i.rdns):!1;return E(Rr,{wallet:i,detected:a,onConnect:()=>{e[d]?.(),o()}},d)})}),ae("div",{className:"wcm-help",children:[E("p",{className:"wcm-help-title",children:"Wallet not detected?"}),ae("ul",{className:"wcm-help-list",children:[E("li",{children:"Ensure your wallet extension is installed and unlocked"}),E("li",{children:"Try refreshing the page"}),E("li",{children:"Some wallets may require you to first open the extension"}),E("li",{children:"You can try clicking the wallet anyway"})]})]}),E("div",{className:"wcm-divider"}),E("p",{className:"wcm-terms",children:"By connecting your wallet and accessing this service, you acknowledge and agree to be bound by the applicable terms and conditions."})]})]})}function Tr({className:e}){let{isMobile:t,theme:r,portalStyle:o}=Mt();return t?ae(eo.Portal,{children:[E(eo.Overlay,{className:"wcm-overlay"}),ae(eo.Content,{className:Z("wcm-drawer-content",e),"data-theme":r,style:o,children:[E(eo.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),E("div",{className:"wcm-drawer-handle"}),E("div",{className:"wcm-drawer-body",children:E(Ir,{})})]})]}):ae(Ue.Portal,{children:[E(Ue.Overlay,{className:"wcm-overlay"}),ae(Ue.Content,{className:Z("wcm-dialog-content",e),"data-theme":r,style:o,children:[E(Ue.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),E("div",{className:"wcm-dialog-body",children:E(Ir,{})})]})]})}M(`[data-theme=dark]{--wcm-primary: var(--cck-primary, #9b8cef);--wcm-secondary: var(--cck-secondary, #ff3aa3);--wcm-surface-bg: var(--cck-surface-bg, #202530);--wcm-surface-default: var(--cck-surface-default, #292f40);--wcm-surface-subtle: var(--cck-surface-subtle, #313b51);--wcm-border-default: var(--cck-border-default, #313b51);--wcm-border-subtle: var(--cck-border-subtle, #49556e);--wcm-texticon-primary: var(--cck-texticon-primary, #ffffff);--wcm-texticon-secondary: var(--cck-texticon-secondary, #eff0f4);--wcm-texticon-tertiary: var(--cck-texticon-tertiary, #717d97)}[data-theme=light]{--wcm-primary: var(--cck-primary, #019d92);--wcm-secondary: var(--cck-secondary, #e70077);--wcm-surface-bg: var(--cck-surface-bg, #ffffff);--wcm-surface-default: var(--cck-surface-default, rgba(18, 18, 18, .05));--wcm-surface-subtle: var(--cck-surface-subtle, rgba(18, 18, 18, .1));--wcm-border-default: var(--cck-border-default, rgba(18, 18, 18, .05));--wcm-border-subtle: var(--cck-border-subtle, rgba(18, 18, 18, .1));--wcm-texticon-primary: var(--cck-texticon-primary, #121212);--wcm-texticon-secondary: var(--cck-texticon-secondary, rgba(18, 18, 18, .7));--wcm-texticon-tertiary: var(--cck-texticon-tertiary, rgba(18, 18, 18, .5))}
12
+ `);import{jsx as Vo}from"react/jsx-runtime";var Ra="https://terms.crosstoken.io/docs/cross-terms-of-use",Ta="https://terms.crosstoken.io/docs/nexus-privacy-policy";function Ia({env:e,theme:t="dark",mobileBreakpoint:r=768,drawerDirection:o,modal:n,showBalance:c=!1,showForgeToken:i=!1,showGameToken:l=!0,showQR:d=!0,qrLogoSrc:a,walletAddress:s,accountName:m,sendAccounts:y,profileImageUrl:w,connectorId:g,connectorName:f,connectorIconUrl:h,preferredTokens:R=[],onSelectWallet:L,onCopyAddress:_,onDisconnect:k,disconnectLabel:V="Disconnect",termsUrl:C=Ra,termsLabel:x="Terms of Service",privacyUrl:B=Ta,privacyLabel:T="Privacy Policy",open:Y,onOpenChange:j,showPortfolio:X=!1,portfolioTitle:Ae="My Portfolio",showTotalAssets:we=!0,totalAssetsLabel:Oe="Total Assets USD",sendTransaction:xe,getTransactionReceipt:q,onOutlink:J,style:ve,children:re}){let qe=ce(e),De=g?Bt[g]:void 0,rt=f??De?.name,Pe=h??De?.iconUrl,ye=lt(`(max-width: ${r}px)`),Se=o??(c?"right":"bottom"),ke=n??!1,le=Y!==void 0,[me,We]=ie.useState(!1),fe=le?Y:me,Ce=ie.useCallback(kt=>{le||We(kt),j?.(kt)},[le,j]),Ge=ie.useCallback(()=>Ce(!1),[Ce]),[it,yt]=ie.useState(null),[Ne,u]=ie.useState("top"),[P,D]=ie.useState(null),[H,G]=ie.useState("wallet"),[ee,Ze]=ie.useState(null);ie.useEffect(()=>{fe||(G("wallet"),Ze(null))},[fe]);let Ke=ie.useCallback(()=>{No(s),k?.()},[k,s]),at=ie.useMemo(()=>({env:qe,theme:t,isMobile:ye,open:fe,drawerDirection:Se,modal:ke,showBalance:c,showForgeToken:i,showGameToken:l,showQR:d,qrLogoSrc:a,walletAddress:s,accountName:m,sendAccounts:y,profileImageUrl:w,connectorName:rt,connectorIconUrl:Pe,preferredTokens:R,close:Ge,onSelectWallet:L,onCopyAddress:_,onDisconnect:k?Ke:void 0,disconnectLabel:V,termsUrl:C,termsLabel:x,privacyUrl:B,privacyLabel:T,portalStyle:ve,navContent:it,navPosition:Ne,setNavContent:yt,setNavPosition:u,footerContent:P,setFooterContent:D,view:H,setView:G,selectedSendToken:ee,setSelectedSendToken:Ze,showPortfolio:X,portfolioTitle:Ae,showTotalAssets:we,totalAssetsLabel:Oe,sendTransaction:xe,getTransactionReceipt:q,onOutlink:J}),[qe,t,ye,fe,Se,ke,c,i,l,d,a,s,m,y,w,rt,Pe,R,Ge,L,_,k,Ke,V,C,x,B,T,ve,it,Ne,P,H,ee,X,Ae,we,Oe,xe,q,J]);return Vo(fo.Provider,{value:at,children:ye?Vo(La.Root,{direction:Se,open:fe,onOpenChange:Ce,noBodyStyles:!0,children:re},"drawer"):Vo(hr.Root,{open:fe,onOpenChange:Ce,children:re},"popover")})}var bt=Object.assign(Ia,{Trigger:Pn,Content:mr,Nav:ur,Footer:wr});import*as _e from"react";import*as Er from"@radix-ui/react-dialog";import{Drawer as Oa}from"vaul";import{createContext as Ea,useContext as Pa}from"react";var Qt=Ea(null);function Mt(){let e=Pa(Qt);if(!e)throw new Error("WalletConnectModal compound components must be used within <WalletConnectModal>");return e}import{useState as br,useEffect as Sa,useCallback as Ma}from"react";function Xt(){let[e,t]=br([]),[r,o]=br(!0);Sa(()=>{if(typeof window>"u"){o(!1);return}let c=[],i=d=>{let{info:a}=d.detail;a?.rdns&&!c.some(s=>s.rdns===a.rdns)&&(c.push({rdns:a.rdns,name:a.name,icon:a.icon}),t([...c]))};window.addEventListener("eip6963:announceProvider",i),window.addEventListener("eip6963:crossAnnounceProvider",i),window.dispatchEvent(new Event("eip6963:requestProvider")),window.dispatchEvent(new Event("eip6963:crossRequestProvider"));let l=setTimeout(()=>o(!1),500);return()=>{window.removeEventListener("eip6963:announceProvider",i),window.removeEventListener("eip6963:crossAnnounceProvider",i),clearTimeout(l)}},[]);let n=Ma(c=>e.some(i=>i.rdns===c),[e]);return{wallets:e,isDetected:n,isLoading:r}}import*as vr from"@radix-ui/react-dialog";import{Drawer as _a}from"vaul";import{jsx as xr}from"react/jsx-runtime";function yr({asChild:e,children:t}){let{isMobile:r}=Mt(),o=r?_a.Trigger:vr.Trigger;return xr(o,{asChild:e??t!=null,children:t??xr("button",{type:"button",children:"Connect Wallet"})})}import*as Ue from"@radix-ui/react-dialog";import{Drawer as eo}from"vaul";import{jsx as z,jsxs as xt}from"react/jsx-runtime";function Jt(){return xt("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[z("circle",{cx:"20",cy:"20",r:"20",fill:"#00D5AA"}),z("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 kr(){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:[z("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"}),z("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"}),z("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"}),z("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"}),z("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"}),z("path",{d:"M22.1857 36.1951V39.831H17.6699V36.1951H22.1857Z",fill:"#C0C4CD"}),z("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"})]}),z("defs",{children:z("clipPath",{id:"clip0_1331_27065",children:z("rect",{width:"40",height:"40",fill:"white"})})})]})}function Cr(){return xt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"247",height:"246",viewBox:"0 0 247 246",fill:"none",children:[z("rect",{width:"247.005",height:"245.105",rx:"36",fill:"#121212"}),z("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"}),z("path",{d:"M59.8364 99.8915V59.7551H12.0414L30.4787 77.8377V99.8915H59.8364Z",fill:"#2FD7FF"}),z("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 Nr(){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:[z("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"}),z("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"})]}),z("defs",{children:z("clipPath",{id:"clip0_1185_7785",children:z("rect",{width:"28",height:"28",fill:"white"})})})]})}function Lr(){return z("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:z("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var Ho={cross_embedded:{id:"cross_embedded",name:"CROSSx with Social",description:"Sign in with Google or Apple",icon:Jt,featured:!0},cross_wallet:{id:"cross_wallet",name:"CROSSx",description:"App approval is required",icon:Jt},cross_extension:{id:"cross_extension",name:"CROSSx Extension",description:"Browser extension approval is required",icon:Jt,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:kr,rdns:"io.metamask"},verse8:{id:"verse8",name:"Verse8 Wallet",description:"Optimized for Forge and Verse8 ecosystem",icon:Cr,badge:"For Forge"},tron:{id:"tron",name:"Tron Wallet",description:"Dedicated for Tron-based transactions and assets",icon:Nr,badge:"For SHOP"}};function vt(e){return Ho[e]}import{Fragment as Aa,jsx as E,jsxs as ae}from"react/jsx-runtime";function Rr({wallet:e,detected:t,onConnect:r}){let o=()=>{if(e.installUrl&&!t){window.open(e.installUrl,"_blank","noopener,noreferrer");return}r()},n=e.icon;return ae("button",{type:"button",className:"wcm-wallet-item",onClick:o,children:[ae("div",{className:"wcm-wallet-item-left",children:[E("div",{className:"wcm-wallet-icon",children:E(n,{})}),ae("div",{className:"wcm-wallet-info",children:[ae("div",{className:"wcm-wallet-name-row",children:[E("span",{className:"wcm-wallet-name",children:e.name}),e.badge&&E("span",{className:"wcm-wallet-badge",children:e.badge})]}),E("span",{className:"wcm-wallet-desc",children:e.description})]})]}),e.installUrl&&(t?E("span",{className:"wcm-installed-label",children:"Installed"}):E("span",{className:"wcm-install-btn",children:"Install"}))]})}function Tr(){let{wallets:e,activeWalletIds:t,isDetected:r,close:o,isMobile:n}=Mt(),c=t.filter(d=>{let a=vt(d).visibility;return!a||a==="always"?!0:a==="desktop-only"?!n:a==="mobile-only"?n:!0}),i=c.filter(d=>vt(d).featured),l=c.filter(d=>!vt(d).featured);return ae(Aa,{children:[ae("div",{className:"wcm-header",children:[ae("div",{className:"wcm-header-text",children:[E("h2",{className:"wcm-title",children:"Connect Wallet"}),E("p",{className:"wcm-subtitle",children:"Connect with one of our available wallet providers to continue."})]}),E("button",{type:"button",className:"wcm-close-btn",onClick:o,children:E(Lr,{})})]}),E("div",{className:"wcm-divider"}),ae("div",{className:"wcm-body",children:[i.map(d=>{let a=vt(d),s=a.rdns?r(a.rdns):!1;return E(Rr,{wallet:a,detected:s,onConnect:()=>{e[d]?.(),o()}},d)}),i.length>0&&l.length>0&&ae("div",{className:"wcm-separator",children:[E("div",{className:"wcm-separator-line"}),E("span",{className:"wcm-separator-text",children:"or"}),E("div",{className:"wcm-separator-line"})]}),E("div",{className:"wcm-wallet-list",children:l.map(d=>{let a=vt(d),s=a.rdns?r(a.rdns):!1;return E(Rr,{wallet:a,detected:s,onConnect:()=>{e[d]?.(),o()}},d)})}),ae("div",{className:"wcm-help",children:[E("p",{className:"wcm-help-title",children:"Wallet not detected?"}),ae("ul",{className:"wcm-help-list",children:[E("li",{children:"Ensure your wallet extension is installed and unlocked"}),E("li",{children:"Try refreshing the page"}),E("li",{children:"Some wallets may require you to first open the extension"}),E("li",{children:"You can try clicking the wallet anyway"})]})]}),E("div",{className:"wcm-divider"}),E("p",{className:"wcm-terms",children:"By connecting your wallet and accessing this service, you acknowledge and agree to be bound by the applicable terms and conditions."})]})]})}function Ir({className:e}){let{isMobile:t,theme:r,portalStyle:o}=Mt();return t?ae(eo.Portal,{children:[E(eo.Overlay,{className:"wcm-overlay"}),ae(eo.Content,{className:Z("wcm-drawer-content",e),"data-theme":r,style:o,children:[E(eo.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),E("div",{className:"wcm-drawer-handle"}),E("div",{className:"wcm-drawer-body",children:E(Tr,{})})]})]}):ae(Ue.Portal,{children:[E(Ue.Overlay,{className:"wcm-overlay"}),ae(Ue.Content,{className:Z("wcm-dialog-content",e),"data-theme":r,style:o,children:[E(Ue.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),E("div",{className:"wcm-dialog-body",children:E(Tr,{})})]})]})}M(`[data-theme=dark]{--wcm-primary: var(--cck-primary, #9b8cef);--wcm-secondary: var(--cck-secondary, #ff3aa3);--wcm-surface-bg: var(--cck-surface-bg, #202530);--wcm-surface-default: var(--cck-surface-default, #292f40);--wcm-surface-subtle: var(--cck-surface-subtle, #313b51);--wcm-border-default: var(--cck-border-default, #313b51);--wcm-border-subtle: var(--cck-border-subtle, #49556e);--wcm-texticon-primary: var(--cck-texticon-primary, #ffffff);--wcm-texticon-secondary: var(--cck-texticon-secondary, #eff0f4);--wcm-texticon-tertiary: var(--cck-texticon-tertiary, #717d97)}[data-theme=light]{--wcm-primary: var(--cck-primary, #019d92);--wcm-secondary: var(--cck-secondary, #e70077);--wcm-surface-bg: var(--cck-surface-bg, #ffffff);--wcm-surface-default: var(--cck-surface-default, rgba(18, 18, 18, .05));--wcm-surface-subtle: var(--cck-surface-subtle, rgba(18, 18, 18, .1));--wcm-border-default: var(--cck-border-default, rgba(18, 18, 18, .05));--wcm-border-subtle: var(--cck-border-subtle, rgba(18, 18, 18, .1));--wcm-texticon-primary: var(--cck-texticon-primary, #121212);--wcm-texticon-secondary: var(--cck-texticon-secondary, rgba(18, 18, 18, .7));--wcm-texticon-tertiary: var(--cck-texticon-tertiary, rgba(18, 18, 18, .5))}
13
13
  `);M(`.wcm-overlay{position:fixed;inset:0;z-index:100000;background:#0009}.wcm-dialog-content{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(--wcm-surface-bg);border:4px solid var(--wcm-border-default);border-radius:24px;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:rgba(255,255,255,.15) transparent}[data-theme=light] .wcm-dialog-body,[data-theme=light] .wcm-drawer-body{scrollbar-color:rgba(0,0,0,.12) 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:#ffffff26;border-radius:4px}.wcm-dialog-body::-webkit-scrollbar-thumb:hover,.wcm-drawer-body::-webkit-scrollbar-thumb:hover{background:#ffffff40}[data-theme=light] .wcm-dialog-body::-webkit-scrollbar-thumb,[data-theme=light] .wcm-drawer-body::-webkit-scrollbar-thumb{background:#0000001f}[data-theme=light] .wcm-dialog-body::-webkit-scrollbar-thumb:hover,[data-theme=light] .wcm-drawer-body::-webkit-scrollbar-thumb:hover{background:#0003}.wcm-drawer-content{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(--wcm-surface-bg);border-top-left-radius:24px;border-top-right-radius:24px;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:24px 0 0 24px}.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 24px 24px 0}.wcm-drawer-content[data-vaul-drawer-direction=top]{inset:0 0 auto;border-radius:0 0 24px 24px}.wcm-drawer-handle{width:60px;height:4px;border-radius:999px;background:var(--wcm-border-subtle);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{position:relative;display:flex;flex-direction:column;align-items:center;padding:24px 24px 20px}.wcm-header-text{display:flex;flex-direction:column;gap:4px;width:100%;padding-right:48px}.wcm-title{font-family:inherit;font-weight:600;font-size:22px;line-height:1.3;color:var(--wcm-texticon-primary);margin:0}.wcm-subtitle{font-family:inherit;font-weight:400;font-size:14px;line-height:1.3;color:var(--wcm-texticon-secondary);margin:0}.wcm-close-btn{position:absolute;top:12px;right:12px;display:flex;align-items:center;justify-content:center;width:48px;height:48px;border:none;border-radius:999px;background:transparent;color:var(--wcm-texticon-primary);cursor:pointer;padding:0}.wcm-close-btn:hover{color:var(--wcm-texticon-secondary)}.wcm-divider{width:100%;height:1px;background:var(--wcm-border-default);border:none;margin:0}.wcm-body{display:flex;flex-direction:column;gap:16px;padding:20px 24px 24px}.wcm-wallet-item{display:flex;align-items:center;gap:8px;width:100%;padding:16px;background:var(--wcm-surface-default);border:1px solid transparent;border-radius:20px;cursor:pointer;text-align:left;transition:border-color .15s;font-family:inherit}.wcm-wallet-item:hover{border-color:var(--wcm-primary)}.wcm-wallet-item-left{display:flex;align-items:center;gap:16px;flex:1;min-width:0}.wcm-wallet-icon{flex-shrink:0;width:40px;height:40px;display:flex;align-items:center;justify-content:center}.wcm-wallet-icon>svg{width:40px;height:40px}.wcm-wallet-info{display:flex;flex-direction:column;justify-content:center;min-width:0}.wcm-wallet-name-row{display:flex;align-items:center;gap:8px}.wcm-wallet-name{font-family:inherit;font-weight:700;font-size:18px;line-height:1.3;color:var(--wcm-texticon-primary);white-space:nowrap}.wcm-wallet-desc{font-family:inherit;font-weight:400;font-size:14px;line-height:1.4;color:var(--wcm-texticon-secondary)}.wcm-wallet-badge{display:inline-flex;align-items:center;justify-content:center;height:20px;padding:0 8px;border:1px solid var(--wcm-secondary);border-radius:999px;font-family:inherit;font-weight:700;font-size:12px;line-height:1.3;color:var(--wcm-secondary);white-space:nowrap}.wcm-install-btn{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;background:var(--wcm-primary);border-radius:12px;font-family:inherit;font-weight:600;font-size:14px;line-height:1.4;color:var(--wcm-surface-bg);white-space:nowrap}.wcm-installed-label{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;background:var(--wcm-surface-subtle);border-radius:12px;font-family:inherit;font-weight:600;font-size:14px;line-height:1.4;color:var(--wcm-texticon-secondary);white-space:nowrap}.wcm-separator{display:flex;align-items:center;gap:16px;width:100%}.wcm-separator-line{flex:1;height:1px;background:var(--wcm-border-default)}.wcm-separator-text{font-family:inherit;font-weight:400;font-size:16px;line-height:1.3;color:var(--wcm-texticon-tertiary);white-space:nowrap}.wcm-wallet-list{display:flex;flex-direction:column;gap:8px}.wcm-help{display:flex;flex-direction:column;gap:4px}.wcm-help-title{font-family:inherit;font-weight:600;font-size:14px;line-height:1.4;color:var(--wcm-texticon-primary);margin:0}.wcm-help-list{list-style:none;padding:0;margin:0}.wcm-help-list li{display:flex;align-items:center;gap:8px;font-family:inherit;font-weight:400;font-size:14px;line-height:1.4;color:var(--wcm-texticon-secondary)}.wcm-help-list li:before{content:"";display:block;flex-shrink:0;width:4px;height:4px;min-width:4px;min-height:4px;background:var(--wcm-texticon-secondary)}.wcm-terms{font-family:inherit;font-weight:400;font-size:12px;line-height:1.3;color:var(--wcm-texticon-secondary);text-align:center;margin:0}.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}
14
14
  `);M(`@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)}}
15
- `);import{jsx as _t}from"react/jsx-runtime";function Da({wallets:e,theme:t="dark",mobileBreakpoint:r=768,drawerDirection:o="bottom",dialogWidth:n,drawerMaxWidth:c,drawerMinWidth:s,style:l,open:d,onOpenChange:i,children:a}){let m=lt(`(max-width: ${r}px)`),[y,w]=Me.useState(!1),g=d!==void 0,f=g?d:y,h=Me.useCallback(N=>{g||w(N),i?.(N)},[g,i]),R=Me.useCallback(()=>h(!1),[h]),{isDetected:L}=Xt(),O=Me.useMemo(()=>Object.keys(e),[e]),C=Me.useMemo(()=>{let N={};return n&&(N["--wcm-dialog-width"]=n),c&&(N["--wcm-drawer-max-width"]=c),s&&(N["--wcm-drawer-min-width"]=s),{...N,...l}},[n,c,s,l]),B=Me.useMemo(()=>({theme:t,isMobile:m,open:f,setOpen:h,close:R,wallets:e,activeWalletIds:O,isDetected:L,portalStyle:C}),[t,m,f,h,R,e,O,L,C]),b=_t("div",{"data-theme":t,style:C,children:a});return m?_t(Qt.Provider,{value:B,children:_t(Oa.Root,{direction:o,open:f,onOpenChange:h,noBodyStyles:!0,children:b},"drawer")}):_t(Qt.Provider,{value:B,children:_t(Er.Root,{open:f,onOpenChange:h,children:b})})}var Pr=Object.assign(Da,{Trigger:yr,Content:Tr});var Wa='<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>',Fa='<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>',Ba='<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>',Va='<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>',Ha='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><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 At(e){return`data:image/svg+xml,${encodeURIComponent(e)}`}var to=At(Wa),oo=At(Fa),no=At(Ba),ro=At(Va),io=At(Ha);import{jsx as je,jsxs as $o}from"react/jsx-runtime";function Mr({isConnecting:e,address:t,provider:r,providerName:o,accountName:n,sendAccounts:c,onConnect:s,onDisconnect:l,onCopy:d,onSelectWallet:i,label:a="Connect Wallet",connectingLabel:m="Connecting...",disconnectLabel:y,className:w,theme:g="dark",env:f,showBalance:h=!0,showPortfolio:R,drawerDirection:L,modal:O,connectorId:C,style:B,sendTransaction:b,getTransactionReceipt:N}){if(e)return $o("button",{type:"button",disabled:!0,className:w,style:w?void 0:{...ze.button,...ze.buttonLoading},"aria-busy":"true",children:[je("style",{children:ja}),je("span",{style:ze.spinner,"aria-hidden":"true"}),m]});if(t){let V=o??za(r),I=r?$a[r]:void 0;return $o(bt,{env:f,theme:g,drawerDirection:L,modal:O,showBalance:h,showPortfolio:R,walletAddress:t,accountName:n,sendAccounts:c,connectorId:C,onSelectWallet:i,onCopyAddress:d?(Y,j)=>{j&&d()}:void 0,onDisconnect:l,disconnectLabel:y,style:B,sendTransaction:b,getTransactionReceipt:N,children:[je(bt.Trigger,{asChild:!0,children:$o("button",{type:"button",className:w,style:w?void 0:ze.connectedBtn,"aria-label":`Connected with ${V}: ${Sr(t)}`,children:[I?je("img",{src:I,alt:"",width:20,height:20,style:ze.connectedIcon}):je("span",{style:ze.connectedIconPlaceholder,"aria-hidden":"true"}),je("span",{style:ze.connectedAddress,children:Sr(t)})]})}),je(bt.Content,{align:"end",sideOffset:8})]})}return je("button",{type:"button",onClick:s,className:w,style:w?void 0:ze.button,children:a})}var $a={google:ro,apple:io,cross:to,metamask:oo,binance:no},Ua={google:"Google",apple:"Apple",cross:"CROSSx",metamask:"MetaMask",binance:"Binance Wallet"};function za(e){return e?Ua[e]:"Wallet"}function Sr(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}var ja="@keyframes cross-cb-spin{to{transform:rotate(360deg)}}",ze={button:{padding:"10px 24px",borderRadius:"12px",border:"none",background:"#00D5AA",color:"#000",fontWeight:700,fontSize:"14px",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"8px",transition:"opacity 0.15s",fontFamily:"inherit"},buttonLoading:{opacity:.7,cursor:"default"},spinner:{display:"inline-block",width:"14px",height:"14px",border:"2px solid #00000030",borderTopColor:"#000",borderRadius:"50%",animation:"cross-cb-spin 0.6s linear infinite"},connectedBtn:{display:"inline-flex",alignItems:"center",gap:"8px",padding:"8px 14px",borderRadius:"999px",border:"1px solid var(--wi-border-default, #2a2d3a)",background:"var(--wi-surface-default, #1e232e)",color:"var(--wi-texticon-primary, #ffffff)",fontWeight:600,fontSize:"14px",cursor:"pointer",fontFamily:"inherit"},connectedIcon:{width:"20px",height:"20px",borderRadius:"50%",objectFit:"contain",flexShrink:0,background:"transparent"},connectedIconPlaceholder:{display:"inline-block",width:"20px",height:"20px",borderRadius:"50%",background:"var(--wi-surface-subtle, #2a2d3a)",flexShrink:0},connectedAddress:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:"13px",letterSpacing:"0.02em"}};export{io as APPLE_ICON,en as AppLauncher,dn as AppLauncherContent,an as AppLauncherTrigger,no as BINANCE_ICON,Bt as CONNECTOR_REGISTRY,to as CROSSX_ICON,Mr as ConnectButton,uo as ConnectorId,ro as GOOGLE_ICON,oo as METAMASK_ICON,Ht as SendPage,Po as TOKEN_STATS_QUERY_KEY,Eo as USER_BALANCE_QUERY_KEY,Ho as WALLET_REGISTRY,Pr as WalletConnectModal,bt as WalletInfo,pr as WalletPortfolio,ht as WalletPortfolioBody,ce as resolveEnvironment,Wt as useGlobalMenu,mt as useTokenBalance,ft as useTokenStats,Xt as useWalletDetect};
15
+ `);import{jsx as _t}from"react/jsx-runtime";function Da({wallets:e,theme:t="dark",mobileBreakpoint:r=768,drawerDirection:o="bottom",dialogWidth:n,drawerMaxWidth:c,drawerMinWidth:i,style:l,open:d,onOpenChange:a,children:s}){let m=lt(`(max-width: ${r}px)`),[y,w]=_e.useState(!1),g=d!==void 0,f=g?d:y,h=_e.useCallback(x=>{g||w(x),a?.(x)},[g,a]),R=_e.useCallback(()=>h(!1),[h]),{isDetected:L}=Xt(),_=_e.useMemo(()=>Object.keys(e),[e]),k=_e.useMemo(()=>{let x={};return n&&(x["--wcm-dialog-width"]=n),c&&(x["--wcm-drawer-max-width"]=c),i&&(x["--wcm-drawer-min-width"]=i),{...x,...l}},[n,c,i,l]),V=_e.useMemo(()=>({theme:t,isMobile:m,open:f,setOpen:h,close:R,wallets:e,activeWalletIds:_,isDetected:L,portalStyle:k}),[t,m,f,h,R,e,_,L,k]),C=_t("div",{"data-theme":t,style:k,children:s});return m?_t(Qt.Provider,{value:V,children:_t(Oa.Root,{direction:o,open:f,onOpenChange:h,noBodyStyles:!0,children:C},"drawer")}):_t(Qt.Provider,{value:V,children:_t(Er.Root,{open:f,onOpenChange:h,children:C})})}var Pr=Object.assign(Da,{Trigger:yr,Content:Ir});var Wa='<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>',Fa='<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>',Ba='<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>',Va='<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>',Ha='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><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 At(e){return`data:image/svg+xml,${encodeURIComponent(e)}`}var to=At(Wa),oo=At(Fa),no=At(Ba),ro=At(Va),io=At(Ha);import{jsx as je,jsxs as $o}from"react/jsx-runtime";function Mr({isConnecting:e,address:t,provider:r,providerName:o,accountName:n,sendAccounts:c,onConnect:i,onDisconnect:l,onCopy:d,onSelectWallet:a,label:s="Connect Wallet",connectingLabel:m="Connecting...",disconnectLabel:y,className:w,theme:g="dark",env:f,showBalance:h=!0,showPortfolio:R,drawerDirection:L,modal:_,connectorId:k,style:V,sendTransaction:C,getTransactionReceipt:x}){if(e)return $o("button",{type:"button",disabled:!0,className:w,style:w?void 0:{...ze.button,...ze.buttonLoading},"aria-busy":"true",children:[je("style",{children:ja}),je("span",{style:ze.spinner,"aria-hidden":"true"}),m]});if(t){let B=o??za(r),T=r?$a[r]:void 0;return $o(bt,{env:f,theme:g,drawerDirection:L,modal:_,showBalance:h,showPortfolio:R,walletAddress:t,accountName:n,sendAccounts:c,connectorId:k,onSelectWallet:a,onCopyAddress:d?(Y,j)=>{j&&d()}:void 0,onDisconnect:l,disconnectLabel:y,style:V,sendTransaction:C,getTransactionReceipt:x,children:[je(bt.Trigger,{asChild:!0,children:$o("button",{type:"button",className:w,style:w?void 0:ze.connectedBtn,"aria-label":`Connected with ${B}: ${Sr(t)}`,children:[T?je("img",{src:T,alt:"",width:20,height:20,style:ze.connectedIcon}):je("span",{style:ze.connectedIconPlaceholder,"aria-hidden":"true"}),je("span",{style:ze.connectedAddress,children:Sr(t)})]})}),je(bt.Content,{align:"end",sideOffset:8})]})}return je("button",{type:"button",onClick:i,className:w,style:w?void 0:ze.button,children:s})}var $a={google:ro,apple:io,cross:to,metamask:oo,binance:no},Ua={google:"Google",apple:"Apple",cross:"CROSSx",metamask:"MetaMask",binance:"Binance Wallet"};function za(e){return e?Ua[e]:"Wallet"}function Sr(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}var ja="@keyframes cross-cb-spin{to{transform:rotate(360deg)}}",ze={button:{padding:"10px 24px",borderRadius:"12px",border:"none",background:"#00D5AA",color:"#000",fontWeight:700,fontSize:"14px",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"8px",transition:"opacity 0.15s",fontFamily:"inherit"},buttonLoading:{opacity:.7,cursor:"default"},spinner:{display:"inline-block",width:"14px",height:"14px",border:"2px solid #00000030",borderTopColor:"#000",borderRadius:"50%",animation:"cross-cb-spin 0.6s linear infinite"},connectedBtn:{display:"inline-flex",alignItems:"center",gap:"8px",padding:"8px 14px",borderRadius:"999px",border:"1px solid var(--wi-border-default, #2a2d3a)",background:"var(--wi-surface-default, #1e232e)",color:"var(--wi-texticon-primary, #ffffff)",fontWeight:600,fontSize:"14px",cursor:"pointer",fontFamily:"inherit"},connectedIcon:{width:"20px",height:"20px",borderRadius:"50%",objectFit:"contain",flexShrink:0,background:"transparent"},connectedIconPlaceholder:{display:"inline-block",width:"20px",height:"20px",borderRadius:"50%",background:"var(--wi-surface-subtle, #2a2d3a)",flexShrink:0},connectedAddress:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:"13px",letterSpacing:"0.02em"}};export{io as APPLE_ICON,en as AppLauncher,dn as AppLauncherContent,an as AppLauncherTrigger,no as BINANCE_ICON,Bt as CONNECTOR_REGISTRY,to as CROSSX_ICON,Mr as ConnectButton,uo as ConnectorId,ro as GOOGLE_ICON,oo as METAMASK_ICON,Ht as SendPage,Po as TOKEN_STATS_QUERY_KEY,Eo as USER_BALANCE_QUERY_KEY,Ho as WALLET_REGISTRY,Pr as WalletConnectModal,bt as WalletInfo,pr as WalletPortfolio,ht as WalletPortfolioBody,ce as resolveEnvironment,Wt as useGlobalMenu,mt as useTokenBalance,ft as useTokenStats,Xt as useWalletDetect};