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