@nexus-cross/dapp-ui 1.1.1-beta.6 → 1.1.1
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 +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
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
3
|
`);O(`@keyframes al-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
|
|
4
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("");var bn=require("react/jsx-runtime");function jn({env:e,theme:t="dark",mobileBreakpoint:n=768,domain:o,children:r}){let i=It(`(max-width: ${n}px)`),[l,p]=St.useState(!1),m=St.useCallback(()=>p(!1),[]),d=ue(e),c=St.useMemo(()=>({env:d,theme:t,isMobile:i,open:l,domain:o,close:m}),[d,t,i,l,o,m]);return(0,bn.jsx)(Un.Provider,{value:c,children:i?(0,bn.jsx)(Oo.Drawer.Root,{direction:"right",open:l,onOpenChange:p,noBodyStyles:!0,children:r},"drawer"):(0,bn.jsx)(Ao.Root,{open:l,onOpenChange:p,children:r},"popover")})}var Bo=U(require("@radix-ui/react-popover"),1),$o=require("vaul");var ae=require("react/jsx-runtime");function Fo({size:e=18}){return(0,ae.jsxs)("svg",{className:"al-trigger-icon",width:e,height:e,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,ae.jsx)("rect",{width:"4",height:"4",fill:"currentColor"}),(0,ae.jsx)("rect",{x:"7",width:"4",height:"4",fill:"currentColor"}),(0,ae.jsx)("rect",{x:"14",width:"4",height:"4",fill:"currentColor"}),(0,ae.jsx)("rect",{y:"7",width:"4",height:"4",fill:"currentColor"}),(0,ae.jsx)("rect",{x:"7",y:"7",width:"4",height:"4",fill:"currentColor"}),(0,ae.jsx)("rect",{x:"14",y:"7",width:"4",height:"4",fill:"currentColor"}),(0,ae.jsx)("rect",{y:"14",width:"4",height:"4",fill:"currentColor"}),(0,ae.jsx)("rect",{x:"7",y:"14",width:"4",height:"4",fill:"currentColor"}),(0,ae.jsx)("rect",{x:"14",y:"14",width:"4",height:"4",fill:"currentColor"})]})}function Do(){return(0,ae.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,ae.jsx)("path",{d:"M12 19L5 12M5 12L12 5M5 12H19",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Wo(){return(0,ae.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,ae.jsx)("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var Gt=require("react/jsx-runtime");function qn({asChild:e,children:t}){let{isMobile:n,theme:o}=hn(),r=t!=null,i=e??!0,l=r?t:(0,Gt.jsx)("button",{type:"button",className:"al-trigger-btn","data-theme":o,children:(0,Gt.jsx)(Fo,{size:n?12:18})});return n?(0,Gt.jsx)($o.Drawer.Trigger,{asChild:i,children:l}):(0,Gt.jsx)(Bo.Trigger,{asChild:i,children:l})}var wt=U(require("react"),1),vn=U(require("@radix-ui/react-popover"),1),gt=require("vaul");var Go=require("@tanstack/react-query");var Vo={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 Oi="https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",Fi="https://contents.crosstoken.io/frontend/common/app-launcher/icons";function Ae(e,t){return`${e==="production"?Fi:Oi}/${t}.png`}function Ho(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:Ae(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:Ae(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:Ae(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:Ae(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:Ae(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:Ae(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:Ae(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:Ae(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:Ae(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:Ae(t,"explorer"),order:12e3,type:"explorer",badge:null,isNew:!1}]}}function zt(e){let t=ue(e);return(0,Go.useQuery)({queryKey:["global-menu",t],queryFn:async({signal:n})=>{try{let o=await fetch(Vo[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 Ho(t)}},staleTime:0,gcTime:0,retry:!1,refetchOnMount:!0})}function Y(...e){return e.filter(Boolean).join(" ")}var q=require("react/jsx-runtime");function Zn({align:e="end",sideOffset:t=12,className:n}){let{env:o,theme:r,isMobile:i,domain:l,close:p}=hn(),{data:m}=zt(o),d=wt.useMemo(()=>(m?.items??[]).sort((h,P)=>h.order-P.order),[m]),c=8,f=wt.useRef(null),y=wt.useCallback(h=>{f.current={x:h.clientX,y:h.clientY}},[]),x=typeof window<"u"?window.location.pathname:"",g=wt.useCallback((h,P)=>{if(f.current){let N=h.clientX-f.current.x,z=h.clientY-f.current.y;if(f.current=null,Math.abs(N)>c||Math.abs(z)>c)return}let A=P.url[o]??P.url.production,S=zo(A,l);if(!S)try{let N=new URL(A).pathname;if(x===N||x.startsWith(N+"/")){p();return}}catch{}S?window.open(A,"_blank","noopener,noreferrer"):window.location.href=A,p()},[o,l,p,x]),w=(0,q.jsx)("div",{className:"al-grid","data-theme":r,children:d.map(h=>{let P=h.url[o]??h.url.production,A=zo(P,l),S=!1;if(!A)try{let N=new URL(P).pathname;S=x===N||x.startsWith(N+"/")}catch{S=!1}return(0,q.jsxs)("button",{type:"button",className:"al-grid-item","data-active":S||void 0,onPointerDown:y,onClick:N=>g(N,h),children:[(0,q.jsxs)("div",{className:"al-grid-item-left",children:[(0,q.jsx)("div",{className:"al-grid-item-icon",children:(0,q.jsx)("img",{src:h.iconUrl,alt:h.label,width:24,height:24,loading:"lazy"})}),(0,q.jsx)("span",{className:"al-grid-item-label",children:h.label}),h.isNew&&(0,q.jsx)("span",{className:"al-badge-new",children:"N"})]}),(0,q.jsx)("div",{className:"al-grid-item-right",children:h.badge&&(0,q.jsx)("span",{className:"al-badge",children:h.badge})})]},h.id)})});return i?(0,q.jsxs)(gt.Drawer.Portal,{children:[(0,q.jsx)(gt.Drawer.Overlay,{className:"al-drawer-overlay"}),(0,q.jsxs)(gt.Drawer.Content,{className:Y("al-drawer-content",n),"data-theme":r,children:[(0,q.jsxs)("div",{className:"al-drawer-header",children:[(0,q.jsx)(gt.Drawer.Close,{className:"al-drawer-close",children:(0,q.jsx)(Do,{})}),(0,q.jsx)(gt.Drawer.Title,{className:"al-drawer-title",children:"CROSS Services"}),(0,q.jsx)(gt.Drawer.Close,{className:"al-drawer-close",children:(0,q.jsx)(Wo,{})})]}),(0,q.jsx)("div",{className:"al-drawer-body",children:w})]})]}):(0,q.jsx)(vn.Portal,{children:(0,q.jsx)(vn.Content,{align:e,sideOffset:t,className:Y("al-popover-content",n),"data-theme":r,children:w})})}function zo(e,t){try{let n=new URL(e).hostname;return typeof window>"u"?!0:n!==(t??window.location.hostname)}catch{return!1}}var pe=U(require("react"),1),mi=U(require("@radix-ui/react-popover"),1),ui=require("vaul");var yn=require("react"),Kn=(0,yn.createContext)(null);function Xe(){let e=(0,yn.useContext)(Kn);if(!e)throw new Error("WalletInfo compound components must be used within <WalletInfo>");return e}var kn=(o=>(o.CROSSx="crossx",o.MetaMask="io.metamask",o.Binance="com.binance.wallet",o))(kn||{}),Ut={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"}};var R=U(require("react"),1);var Je=U(require("bignumber.js"),1);function Di(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 Je.default(e).shiftedBy(-t),o=n.isGreaterThanOrEqualTo(1)?2:4;return n.toFormat(o,Je.default.ROUND_DOWN)}function Ce(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Yn(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 Uo(e,t,n){let r=new Je.default(e).shiftedBy(-t).multipliedBy(new Je.default(n));return r.isZero()||r.isNaN()?"$0.00":`$${(r.integerValue(Je.default.ROUND_DOWN).isGreaterThanOrEqualTo(1)?r.decimalPlaces(2,Je.default.ROUND_DOWN):r.decimalPlaces(4,Je.default.ROUND_DOWN)).toFormat()}`}function jo(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 l=Number(n);if(!Number.isFinite(l)||l===0)return{displayValue:"0",isLowerBound:!1};n=Di(l.toFixed(18))}let[o="0",r=""]=n.split(".");if(Number(o)>=1){let l=r.slice(0,2).padEnd(2,"0");return{displayValue:`${Number(o).toLocaleString("en-US")}.${l}`,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 Ne={dev:"https://stg-wallet-server.crosstoken.io/api",stage:"https://stg-wallet-server.crosstoken.io/api",production:"https://wallet-server.crosstoken.io/api"},fe={dev:{cross:612044,bsc:97},stage:{cross:612044,bsc:97},production:{cross:612055,bsc:56}};var Qn={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"},qo={cross:"https://contents.crosstoken.io/wallet/token/images/CROSS.svg",bsc:"https://contents.crosstoken.io/wallet/token/images/BSC.svg"};function Xn(e,t){let n=fe[e];if(t===n.cross)return qo.cross;if(t===n.bsc)return qo.bsc}var Wi={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:i="png"}=n,l=Wi[e],p=r?`&bg=${r}`:"";return`${l}/portrait/evm/${t}.${i}?size=${o}${p}`}var D=require("react/jsx-runtime");function Zo({size:e=16,className:t}){return(0,D.jsxs)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[(0,D.jsx)("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"}),(0,D.jsx)("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 Jn({size:e=16,className:t}){return(0,D.jsx)("svg",{width:e,height:e,viewBox:"4 4 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,D.jsx)("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 jt({size:e=16,className:t}){return(0,D.jsx)("svg",{width:e,height:e,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,D.jsx)("path",{d:"M11.6667 3.5L5.25 9.91667L2.33334 7",stroke:"currentColor",strokeWidth:1.16667,strokeLinecap:"round",strokeLinejoin:"round"})})}function eo({size:e=24,className:t}){return(0,D.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,D.jsx)("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ko({size:e=20,className:t}){return(0,D.jsxs)("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[(0,D.jsx)("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"}),(0,D.jsx)("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 Yo({size:e=20,className:t}){return(0,D.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,children:(0,D.jsx)("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 Qo({size:e=20,className:t}){return(0,D.jsx)("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,D.jsx)("path",{d:"M12.5 15L7.5 10L12.5 5",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function Xo({size:e=20,className:t}){return(0,D.jsx)("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,D.jsx)("path",{d:"M8 5L13 10L8 15",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function Jo({size:e=20,className:t}){return(0,D.jsx)("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,D.jsx)("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function er({size:e=16,className:t}){return(0,D.jsxs)("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[(0,D.jsx)("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"}),(0,D.jsx)("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 tr({size:e=16,className:t}){return(0,D.jsxs)("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[(0,D.jsx)("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"}),(0,D.jsx)("path",{d:"M1.667 1.667l16.666 16.666",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function nr({size:e=42,className:t}){return(0,D.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 42 42",fill:"none",className:t,children:(0,D.jsx)("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})})}var or=require("react"),rr=require("@tanstack/react-query");var Bi="send:chain-info";function $i(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 to(e,...t){let n=e.replace(/\/+$/,""),o=t.map(r=>r.replace(/^\/+|\/+$/g,"")).filter(Boolean);return[n,...o].join("/")}function Vi(e,t,n,o){if(o)return t===fe[e].cross?ir(t,o):n?.explorer_url?to(n.explorer_url,n.explorer_postfix?.transaction??"tx",o):Hi(e,t,o)}function ir(e,t){return to("https://explorer.crosstoken.io",String(e),"tx",t)}function Hi(e,t,n){let o=fe[e];if(t===o.cross)return ir(t,n);if(t===o.bsc)return to(e==="production"?"https://bscscan.com":"https://testnet.bscscan.com","tx",n)}function ar(e,t,n,o=!0){let r=Ne[e],i=(0,rr.useQuery)({queryKey:[Bi,e,t],queryFn:async({signal:m})=>{let d=await fetch(`${r}/v1/public/chain/info/${t}`,{cache:"no-store",signal:m});if(!d.ok)throw new Error(`Failed to fetch chain info: ${d.status}`);let c=await d.json();if("code"in c&&c.code!==void 0&&c.code!==200)throw new Error(`Chain info API error: ${c.code}`);return $i(c)},enabled:o,staleTime:300*1e3}),l=i.data;return{transactionUrl:(0,or.useMemo)(()=>Vi(e,t,l,n),[t,l,e,n]),chainInfo:l,...i}}var sr="0x0000000000000000000000000000000000000001";var Gi="0xa9059cbb",zi=/^0x[a-fA-F0-9]{40}$/,Ui="nexus-cross:dapp-ui:send:recent:",lr=10;function ji(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return e.slice(0,t)}function qt(e){return e.toLowerCase()}function Zt(e){return zi.test(e)}function no(e){return qt(e.address)===sr}function oo(e){return`${Ui}${e.toLowerCase()}`}function Mt(e){if(typeof window>"u")return[];try{let t=window.localStorage.getItem(oo(e));if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(o=>o!==null&&typeof o=="object"&&Zt(o.address)&&typeof o.updatedAt=="number").slice(0,lr):[]}catch{return[]}}function ro(e,t){if(typeof window>"u")return[];let n=qt(t),o=[{address:n,updatedAt:Date.now()},...Mt(e).filter(r=>r.address!==n)].slice(0,lr);try{window.localStorage.setItem(oo(e),JSON.stringify(o))}catch{return Mt(e)}return o}function io(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(oo(e))}catch{}}function ao(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 i=BigInt(o||"0"),l=r.padEnd(t,"0"),p=l?BigInt(l):0n,m=10n**BigInt(t),d=i*m+p;return d<=0n?{error:"Amount must be greater than 0."}:{value:d}}function so(e,t){let n=BigInt(e||"0"),o=10n**BigInt(t),r=n/o,i=n%o;if(i===0n)return r.toString();let l=ji(i.toString().padStart(t,"0"));return`${r.toString()}.${l}`}function lo(e,t){let n=e.replace(/^0x/,"").toLowerCase().padStart(64,"0"),o=t.toString(16).padStart(64,"0");return`${Gi}${n}${o}`}var qi=2000000000n,Zi=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 Nn(e){return BigInt(e)}function Ki(e){return`0x${e.toString(16)}`}function Yi(e){let t={to:e.to};return e.from&&(t.from=e.from),e.value!==void 0&&e.value>0n&&(t.value=Ki(e.value)),e.data&&(t.data=e.data),t}function Qi(e){return e===56||e===97}async function cr(e){try{let t=await Cn(e,"eth_gasPrice",[]);return{gasPrice:Nn(t)}}catch{return{gasPrice:qi}}}async function Xi(e,t){let n=Zi;try{let o=await Cn(e,"eth_maxPriorityFeePerGas",[]);n=Nn(o)}catch{}return{maxFeePerGas:t+n,maxPriorityFeePerGas:n}}async function Ji(e,t){if(t)return cr(e);let n;try{n=(await Cn(e,"eth_getBlockByNumber",["latest",!1]))?.baseFeePerGas}catch{}return n?Xi(e,Nn(n)):cr(e)}async function dr(e,t){let n=Qi(t.chainId),o=Yi(t),[r,i]=await Promise.all([Cn(e,"eth_estimateGas",[o]),Ji(e,n)]);return{gasLimit:Nn(r),gasPrice:i.gasPrice,maxFeePerGas:i.maxFeePerGas,maxPriorityFeePerGas:i.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;min-width:100px;color:var(--wi-texticon-tertiary);font-size:13px;line-height:1.3;white-space:nowrap}.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)}
|
|
5
|
+
`);O("");var bn=require("react/jsx-runtime");function jn({env:e,theme:t="dark",mobileBreakpoint:n=768,domain:o,children:r}){let i=It(`(max-width: ${n}px)`),[l,p]=St.useState(!1),m=St.useCallback(()=>p(!1),[]),d=ue(e),c=St.useMemo(()=>({env:d,theme:t,isMobile:i,open:l,domain:o,close:m}),[d,t,i,l,o,m]);return(0,bn.jsx)(Un.Provider,{value:c,children:i?(0,bn.jsx)(Oo.Drawer.Root,{direction:"right",open:l,onOpenChange:p,noBodyStyles:!0,children:r},"drawer"):(0,bn.jsx)(Ao.Root,{open:l,onOpenChange:p,children:r},"popover")})}var Bo=U(require("@radix-ui/react-popover"),1),$o=require("vaul");var ae=require("react/jsx-runtime");function Fo({size:e=18}){return(0,ae.jsxs)("svg",{className:"al-trigger-icon",width:e,height:e,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,ae.jsx)("rect",{width:"4",height:"4",fill:"currentColor"}),(0,ae.jsx)("rect",{x:"7",width:"4",height:"4",fill:"currentColor"}),(0,ae.jsx)("rect",{x:"14",width:"4",height:"4",fill:"currentColor"}),(0,ae.jsx)("rect",{y:"7",width:"4",height:"4",fill:"currentColor"}),(0,ae.jsx)("rect",{x:"7",y:"7",width:"4",height:"4",fill:"currentColor"}),(0,ae.jsx)("rect",{x:"14",y:"7",width:"4",height:"4",fill:"currentColor"}),(0,ae.jsx)("rect",{y:"14",width:"4",height:"4",fill:"currentColor"}),(0,ae.jsx)("rect",{x:"7",y:"14",width:"4",height:"4",fill:"currentColor"}),(0,ae.jsx)("rect",{x:"14",y:"14",width:"4",height:"4",fill:"currentColor"})]})}function Do(){return(0,ae.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,ae.jsx)("path",{d:"M12 19L5 12M5 12L12 5M5 12H19",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Wo(){return(0,ae.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,ae.jsx)("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var Gt=require("react/jsx-runtime");function qn({asChild:e,children:t}){let{isMobile:n,theme:o}=hn(),r=t!=null,i=e??!0,l=r?t:(0,Gt.jsx)("button",{type:"button",className:"al-trigger-btn","data-theme":o,children:(0,Gt.jsx)(Fo,{size:n?12:18})});return n?(0,Gt.jsx)($o.Drawer.Trigger,{asChild:i,children:l}):(0,Gt.jsx)(Bo.Trigger,{asChild:i,children:l})}var wt=U(require("react"),1),vn=U(require("@radix-ui/react-popover"),1),gt=require("vaul");var Go=require("@tanstack/react-query");var Vo={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 Oi="https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",Fi="https://contents.crosstoken.io/frontend/common/app-launcher/icons";function Ae(e,t){return`${e==="production"?Fi:Oi}/${t}.png`}function Ho(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:Ae(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:Ae(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:Ae(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:Ae(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:Ae(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:Ae(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:Ae(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:Ae(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:Ae(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:Ae(t,"explorer"),order:12e3,type:"explorer",badge:null,isNew:!1}]}}function zt(e){let t=ue(e);return(0,Go.useQuery)({queryKey:["global-menu",t],queryFn:async({signal:n})=>{try{let o=await fetch(Vo[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 Ho(t)}},staleTime:0,gcTime:0,retry:!1,refetchOnMount:!0})}function Y(...e){return e.filter(Boolean).join(" ")}var q=require("react/jsx-runtime");function Zn({align:e="end",sideOffset:t=12,className:n}){let{env:o,theme:r,isMobile:i,domain:l,close:p}=hn(),{data:m}=zt(o),d=wt.useMemo(()=>(m?.items??[]).sort((h,P)=>h.order-P.order),[m]),c=8,f=wt.useRef(null),y=wt.useCallback(h=>{f.current={x:h.clientX,y:h.clientY}},[]),x=typeof window<"u"?window.location.pathname:"",g=wt.useCallback((h,P)=>{if(f.current){let N=h.clientX-f.current.x,z=h.clientY-f.current.y;if(f.current=null,Math.abs(N)>c||Math.abs(z)>c)return}let A=P.url[o]??P.url.production,S=zo(A,l);if(!S)try{let N=new URL(A).pathname;if(x===N||x.startsWith(N+"/")){p();return}}catch{}S?window.open(A,"_blank","noopener,noreferrer"):window.location.href=A,p()},[o,l,p,x]),w=(0,q.jsx)("div",{className:"al-grid","data-theme":r,children:d.map(h=>{let P=h.url[o]??h.url.production,A=zo(P,l),S=!1;if(!A)try{let N=new URL(P).pathname;S=x===N||x.startsWith(N+"/")}catch{S=!1}return(0,q.jsxs)("button",{type:"button",className:"al-grid-item","data-active":S||void 0,onPointerDown:y,onClick:N=>g(N,h),children:[(0,q.jsxs)("div",{className:"al-grid-item-left",children:[(0,q.jsx)("div",{className:"al-grid-item-icon",children:(0,q.jsx)("img",{src:h.iconUrl,alt:h.label,width:24,height:24,loading:"lazy"})}),(0,q.jsx)("span",{className:"al-grid-item-label",children:h.label}),h.isNew&&(0,q.jsx)("span",{className:"al-badge-new",children:"N"})]}),(0,q.jsx)("div",{className:"al-grid-item-right",children:h.badge&&(0,q.jsx)("span",{className:"al-badge",children:h.badge})})]},h.id)})});return i?(0,q.jsxs)(gt.Drawer.Portal,{children:[(0,q.jsx)(gt.Drawer.Overlay,{className:"al-drawer-overlay"}),(0,q.jsxs)(gt.Drawer.Content,{className:Y("al-drawer-content",n),"data-theme":r,children:[(0,q.jsxs)("div",{className:"al-drawer-header",children:[(0,q.jsx)(gt.Drawer.Close,{className:"al-drawer-close",children:(0,q.jsx)(Do,{})}),(0,q.jsx)(gt.Drawer.Title,{className:"al-drawer-title",children:"CROSS Services"}),(0,q.jsx)(gt.Drawer.Close,{className:"al-drawer-close",children:(0,q.jsx)(Wo,{})})]}),(0,q.jsx)("div",{className:"al-drawer-body",children:w})]})]}):(0,q.jsx)(vn.Portal,{children:(0,q.jsx)(vn.Content,{align:e,sideOffset:t,className:Y("al-popover-content",n),"data-theme":r,children:w})})}function zo(e,t){try{let n=new URL(e).hostname;return typeof window>"u"?!0:n!==(t??window.location.hostname)}catch{return!1}}var pe=U(require("react"),1),mi=U(require("@radix-ui/react-popover"),1),ui=require("vaul");var yn=require("react"),Kn=(0,yn.createContext)(null);function Xe(){let e=(0,yn.useContext)(Kn);if(!e)throw new Error("WalletInfo compound components must be used within <WalletInfo>");return e}var kn=(o=>(o.CROSSx="crossx",o.MetaMask="io.metamask",o.Binance="com.binance.wallet",o))(kn||{}),Ut={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"}};var R=U(require("react"),1);var Je=U(require("bignumber.js"),1);function Di(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 Je.default(e).shiftedBy(-t),o=n.isGreaterThanOrEqualTo(1)?2:4;return n.toFormat(o,Je.default.ROUND_DOWN)}function Ce(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Yn(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 Uo(e,t,n){let r=new Je.default(e).shiftedBy(-t).multipliedBy(new Je.default(n));return r.isZero()||r.isNaN()?"$0.00":`$${(r.integerValue(Je.default.ROUND_DOWN).isGreaterThanOrEqualTo(1)?r.decimalPlaces(2,Je.default.ROUND_DOWN):r.decimalPlaces(4,Je.default.ROUND_DOWN)).toFormat()}`}function jo(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 l=Number(n);if(!Number.isFinite(l)||l===0)return{displayValue:"0",isLowerBound:!1};n=Di(l.toFixed(18))}let[o="0",r=""]=n.split(".");if(Number(o)>=1){let l=r.slice(0,2).padEnd(2,"0");return{displayValue:`${Number(o).toLocaleString("en-US")}.${l}`,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 Ne={dev:"https://stg-wallet-server.crosstoken.io/api",stage:"https://stg-wallet-server.crosstoken.io/api",production:"https://wallet-server.crosstoken.io/api"},fe={dev:{cross:612044,bsc:97},stage:{cross:612044,bsc:97},production:{cross:612055,bsc:56}};var Qn={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"},qo={cross:"https://contents.crosstoken.io/wallet/token/images/CROSS.svg",bsc:"https://contents.crosstoken.io/wallet/token/images/BSC.svg"};function Xn(e,t){let n=fe[e];if(t===n.cross)return qo.cross;if(t===n.bsc)return qo.bsc}var Wi={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:i="png"}=n,l=Wi[e],p=r?`&bg=${r}`:"";return`${l}/portrait/evm/${t}.${i}?size=${o}${p}`}var D=require("react/jsx-runtime");function Zo({size:e=16,className:t}){return(0,D.jsxs)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[(0,D.jsx)("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"}),(0,D.jsx)("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 Jn({size:e=16,className:t}){return(0,D.jsx)("svg",{width:e,height:e,viewBox:"4 4 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,D.jsx)("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 jt({size:e=16,className:t}){return(0,D.jsx)("svg",{width:e,height:e,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,D.jsx)("path",{d:"M11.6667 3.5L5.25 9.91667L2.33334 7",stroke:"currentColor",strokeWidth:1.16667,strokeLinecap:"round",strokeLinejoin:"round"})})}function eo({size:e=24,className:t}){return(0,D.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,D.jsx)("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ko({size:e=20,className:t}){return(0,D.jsxs)("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[(0,D.jsx)("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"}),(0,D.jsx)("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 Yo({size:e=20,className:t}){return(0,D.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,children:(0,D.jsx)("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 Qo({size:e=20,className:t}){return(0,D.jsx)("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,D.jsx)("path",{d:"M12.5 15L7.5 10L12.5 5",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function Xo({size:e=20,className:t}){return(0,D.jsx)("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,D.jsx)("path",{d:"M8 5L13 10L8 15",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function Jo({size:e=20,className:t}){return(0,D.jsx)("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,D.jsx)("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function er({size:e=16,className:t}){return(0,D.jsxs)("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[(0,D.jsx)("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"}),(0,D.jsx)("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 tr({size:e=16,className:t}){return(0,D.jsxs)("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[(0,D.jsx)("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"}),(0,D.jsx)("path",{d:"M1.667 1.667l16.666 16.666",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function nr({size:e=42,className:t}){return(0,D.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 42 42",fill:"none",className:t,children:(0,D.jsx)("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})})}var or=require("react"),rr=require("@tanstack/react-query");var Bi="send:chain-info";function $i(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 to(e,...t){let n=e.replace(/\/+$/,""),o=t.map(r=>r.replace(/^\/+|\/+$/g,"")).filter(Boolean);return[n,...o].join("/")}function Vi(e,t,n,o){if(o)return t===fe[e].cross?ir(t,o):n?.explorer_url?to(n.explorer_url,n.explorer_postfix?.transaction??"tx",o):Hi(e,t,o)}function ir(e,t){return to("https://explorer.crosstoken.io",String(e),"tx",t)}function Hi(e,t,n){let o=fe[e];if(t===o.cross)return ir(t,n);if(t===o.bsc)return to(e==="production"?"https://bscscan.com":"https://testnet.bscscan.com","tx",n)}function ar(e,t,n,o=!0){let r=Ne[e],i=(0,rr.useQuery)({queryKey:[Bi,e,t],queryFn:async({signal:m})=>{let d=await fetch(`${r}/v1/public/chain/info/${t}`,{cache:"no-store",signal:m});if(!d.ok)throw new Error(`Failed to fetch chain info: ${d.status}`);let c=await d.json();if("code"in c&&c.code!==void 0&&c.code!==200)throw new Error(`Chain info API error: ${c.code}`);return $i(c)},enabled:o,staleTime:300*1e3}),l=i.data;return{transactionUrl:(0,or.useMemo)(()=>Vi(e,t,l,n),[t,l,e,n]),chainInfo:l,...i}}var sr="0x0000000000000000000000000000000000000001";var Gi="0xa9059cbb",zi=/^0x[a-fA-F0-9]{40}$/,Ui="nexus-cross:dapp-ui:send:recent:",lr=10;function ji(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return e.slice(0,t)}function qt(e){return e.toLowerCase()}function Zt(e){return zi.test(e)}function no(e){return qt(e.address)===sr}function oo(e){return`${Ui}${e.toLowerCase()}`}function Mt(e){if(typeof window>"u")return[];try{let t=window.localStorage.getItem(oo(e));if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(o=>o!==null&&typeof o=="object"&&Zt(o.address)&&typeof o.updatedAt=="number").slice(0,lr):[]}catch{return[]}}function ro(e,t){if(typeof window>"u")return[];let n=qt(t),o=[{address:n,updatedAt:Date.now()},...Mt(e).filter(r=>r.address!==n)].slice(0,lr);try{window.localStorage.setItem(oo(e),JSON.stringify(o))}catch{return Mt(e)}return o}function io(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(oo(e))}catch{}}function ao(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 i=BigInt(o||"0"),l=r.padEnd(t,"0"),p=l?BigInt(l):0n,m=10n**BigInt(t),d=i*m+p;return d<=0n?{error:"Amount must be greater than 0."}:{value:d}}function so(e,t){let n=BigInt(e||"0"),o=10n**BigInt(t),r=n/o,i=n%o;if(i===0n)return r.toString();let l=ji(i.toString().padStart(t,"0"));return`${r.toString()}.${l}`}function lo(e,t){let n=e.replace(/^0x/,"").toLowerCase().padStart(64,"0"),o=t.toString(16).padStart(64,"0");return`${Gi}${n}${o}`}var qi=2000000000n,Zi=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 Nn(e){return BigInt(e)}function Ki(e){return`0x${e.toString(16)}`}function Yi(e){let t={to:e.to};return e.from&&(t.from=e.from),e.value!==void 0&&e.value>0n&&(t.value=Ki(e.value)),e.data&&(t.data=e.data),t}function Qi(e){return e===56||e===97}async function cr(e){try{let t=await Cn(e,"eth_gasPrice",[]);return{gasPrice:Nn(t)}}catch{return{gasPrice:qi}}}async function Xi(e,t){let n=Zi;try{let o=await Cn(e,"eth_maxPriorityFeePerGas",[]);n=Nn(o)}catch{}return{maxFeePerGas:t+n,maxPriorityFeePerGas:n}}async function Ji(e,t){if(t)return cr(e);let n;try{n=(await Cn(e,"eth_getBlockByNumber",["latest",!1]))?.baseFeePerGas}catch{}return n?Xi(e,Nn(n)):cr(e)}async function dr(e,t){let n=Qi(t.chainId),o=Yi(t),[r,i]=await Promise.all([Cn(e,"eth_estimateGas",[o]),Ji(e,n)]);return{gasLimit:Nn(r),gasPrice:i.gasPrice,maxFeePerGas:i.maxFeePerGas,maxPriorityFeePerGas:i.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;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;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;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;min-width:100px;color:var(--wi-texticon-tertiary);font-size:13px;line-height:1.3;white-space:nowrap}.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
6
|
`);var a=require("react/jsx-runtime"),ea=1500,ta=120;function co(e){return`${e.chainId}:${e.address.toLowerCase()}`}function pr(e,t){return e.name||`Account ${(e.index??t)+1}`}function mr(e){return e.trim().slice(0,1).toUpperCase()||"A"}function na(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 ra(e){return!!(e.token||e.recipient||e.amount)}function uo(e,t,n=10){if(t<=0)return e.toString();let o=10n**BigInt(t),r=e/o,i=e%o;if(i===0n)return r.toString();let p=i.toString().padStart(t,"0").slice(0,Math.max(0,Math.min(n,t)));return p=p.replace(/0+$/,""),p?`${r.toString()}.${p}`:r.toString()}function po(e,t){return uo(e,t,6)}function mo(e){return uo(e,9,2)}function ia(e){return e.toLocaleString("en-US")}function aa(e){return e.maxFeePerGas!==void 0?"dynamic":e.gasPrice!==void 0?"legacy":null}function sa(e){return e.maxFeePerGas!==void 0?e.gasLimit*e.maxFeePerGas:e.gasPrice!==void 0?e.gasLimit*e.gasPrice:null}function la(){return(0,a.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[(0,a.jsx)("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"}),(0,a.jsx)("path",{d:"M4.5 14.5C4.5 13.67 5.17 13 6 13h9.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"}),(0,a.jsx)("path",{d:"M8 6.5h4M8 9h3",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function ca(){return(0,a.jsxs)("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none","aria-hidden":"true",children:[(0,a.jsx)("circle",{cx:"28",cy:"28",r:"28",fill:"var(--wi-primary)"}),(0,a.jsx)("path",{d:"M17 28.5L24.2 35.5L39 20.5",stroke:"var(--wi-primary-contrast, #001410)",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Kt({env:e,theme:t="dark",walletAddress:n,accountName:o,accounts:r=[],token:i,tokens:l=[],onTokenChange:p,sendTransaction:m,getTransactionReceipt:d,estimateGas:c,onSuccess:f,onConfirmSuccess:y,onOutlink:x}){let[g,w]=R.useState(""),[h,P]=R.useState(""),[A,S]=R.useState(""),[N,z]=R.useState({}),[v,E]=R.useState(""),[H,k]=R.useState(!1),[j,Z]=R.useState(!1),[xe,it]=R.useState(!1),[le,Be]=R.useState("account"),Le=R.useRef(void 0),X=R.useRef(void 0),je=R.useRef(null),qe=R.useRef(null),[ge,Ze]=R.useState(()=>Mt(n)),[be,te]=R.useState("idle"),[K,Se]=R.useState(null),[ce,Me]=R.useState(!1),[ve,me]=R.useState(""),ye=R.useRef(0),[ne,Re]=R.useState(null),[re,at]=R.useState(""),ke=no(i),Ke=R.useMemo(()=>BigInt(i.quantity.numeric||"0"),[i.quantity.numeric]),$e=R.useMemo(()=>ht(i.quantity.numeric,i.quantity.decimals),[i.quantity.numeric,i.quantity.decimals]),Ve=R.useMemo(()=>r.filter(u=>u.address.toLowerCase()!==n.toLowerCase()),[r,n]),st=R.useMemo(()=>{let u=new Map;return Ve.forEach((L,M)=>{u.set(L.address.toLowerCase(),{account:L,index:M})}),u},[Ve]),Ee=Ve.length>0,He=R.useMemo(()=>ue(e),[e]),Te=t==="dark"?"1A1A2E":"F3F6F8",Ye=l.length>0?l:[i],Ge=Ye.length>1&&!!p,{transactionUrl:Pe,chainInfo:we}=ar(He,i.chainId,v||void 0,!0),lt=we?.currency_symbol??"",Qe=we?.name??`Chain ID ${i.chainId}`;R.useEffect(()=>{S(""),z({}),E(""),te("idle"),Se(null),me(""),Me(!1),ye.current+=1},[i.address,i.chainId,g,h]),R.useEffect(()=>{P(""),k(!1)},[i.address,i.chainId]),R.useEffect(()=>{Ze(Mt(n))},[n]),R.useEffect(()=>()=>{clearTimeout(Le.current),clearTimeout(X.current)},[]),R.useEffect(()=>{!Ee&&le==="account"&&Be("recent")},[le,Ee]),R.useEffect(()=>{let u=window.visualViewport,L=je.current;if(!u||!L)return;let M=()=>{let de=document.activeElement;return L.contains(de)&&(de instanceof HTMLInputElement||de instanceof HTMLTextAreaElement)},I=48,G=()=>{L.style.paddingBottom=""},ie=()=>{if(!M()){G();return}let de=Math.max(0,window.innerHeight-u.height-u.offsetTop);de>0?L.style.paddingBottom=`${de+I}px`:G();let mt=document.activeElement;mt instanceof HTMLElement&&requestAnimationFrame(()=>{let $t=mt.getBoundingClientRect(),un=L.getBoundingClientRect().bottom-de-I,Ht=$t.bottom-un;Ht>0&&L.scrollBy({top:Ht,behavior:"smooth"})})},pt=()=>{setTimeout(()=>{M()||G()},0)};return u.addEventListener("resize",ie),window.addEventListener("resize",ie),L.addEventListener("focusout",pt),()=>{u.removeEventListener("resize",ie),window.removeEventListener("resize",ie),L.removeEventListener("focusout",pt),G()}},[]);let _e=R.useCallback(()=>{clearTimeout(X.current),X.current=setTimeout(()=>{qe.current?.scrollIntoView({behavior:"smooth",block:"nearest"})},10)},[]),Hn=R.useCallback(()=>{P(so(i.quantity.numeric,i.quantity.decimals))},[i.quantity.numeric,i.quantity.decimals]),cn=R.useCallback(u=>{w(u),Z(!1)},[]),dn=R.useCallback(()=>{let u={},L=g.trim(),M=ao(h,i.quantity.decimals),I;return L?Zt(L)||(u.recipient="Enter a valid EVM recipient address."):u.recipient="Enter a recipient address.","error"in M?u.amount=M.error:(I=M.value,I>Ke&&(u.amount="Amount exceeds available balance.")),!ke&&!Zt(i.address)&&(u.token="Token contract address is invalid."),{errors:u,rawAmount:I,trimmedRecipient:L}},[h,Ke,ke,g,i.address,i.quantity.decimals]),pn=R.useCallback(async()=>{if(v)try{await navigator.clipboard.writeText(v),it(!0),clearTimeout(Le.current),Le.current=setTimeout(()=>it(!1),2e3)}catch{}},[v]),ct=R.useCallback(()=>{if(!Pe||!v)return;let u=I=>{typeof window>"u"||window.open(I,"_blank","noopener,noreferrer")};if(!x){u(Pe);return}let L=x(Pe,{category:"send",origin:"send-transaction",payload:{chainId:i.chainId,txHash:v}});if(L&&(typeof L=="object"||typeof L=="function")&&typeof L.then=="function"){let I=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null;L.then(G=>{if(G===null){I?.close();return}let ie=G??Pe;if(I)try{I.location.href=ie}catch{I.close(),u(ie)}else u(ie)});return}let M=L;M!==null&&u(M??Pe)},[x,i.chainId,Pe,v]),dt=R.useCallback((u,L)=>ke?{to:u,value:L,chainId:i.chainId,from:n}:{to:qt(i.address),data:lo(u,L),value:0n,chainId:i.chainId,from:n},[ke,i.address,i.chainId,n]),Tt=R.useCallback(async(u,L,M)=>{if(!c&&!M)return;let I=++ye.current;Me(!0),me("");try{let G=dt(u,L),ie=c?await c(G):await dr(M,G);if(ye.current!==I)return;Se(ie)}catch(G){if(ye.current!==I)return;me(G instanceof Error?G.message:"Failed to estimate gas.")}finally{ye.current===I&&Me(!1)}},[dt,c]),mn=R.useCallback(u=>{if(u.preventDefault(),S(""),E(""),!m){te("error"),S("Sending is not available for this wallet.");return}let{errors:L,rawAmount:M,trimmedRecipient:I}=dn();if(z(L),ra(L)||M===void 0){te("error");return}let G=I;Re(M),at(G),Se(null),me(""),te("review")},[m,dn]);R.useEffect(()=>{be==="review"&&(!re||ne===null||K===null&&(ce||ve||!c&&!we?.rpc||Tt(re,ne,we?.rpc)))},[we?.rpc,c,Tt,K,ve,ce,ne,re,be]);let Wt=R.useCallback(async()=>{if(!(!m||!re||ne===null)){S(""),E("");try{te("submitting");let u=await m(dt(re,ne));if(E(u),te("confirming"),Ze(ro(n,re)),f?.(u),!d){te("success");return}for(let L=0;L<ta;L+=1){let M=await d({hash:u,chainId:i.chainId}).catch(()=>null);if(M){if(oa(M)){te("error"),S("Transaction reverted on-chain.");return}te("success");return}await na(ea)}te("error"),S("Transaction receipt was not found. Please check again later.")}catch(u){te("error"),S(u instanceof Error?u.message:"Failed to send transaction.")}}},[dt,d,f,ne,re,m,i.chainId,n]),Gn=R.useCallback(()=>{ye.current+=1,Se(null),me(""),Me(!1),S(""),te("idle")},[]),Bt=Ke<=0n||!g.trim()||!h.trim();if(be==="review"||be==="submitting"){let u=be==="submitting",L=ne!==null?uo(ne,i.quantity.decimals):h.trim(),M=o?.trim()||`Account ${(r[0]?.index??0)+1}`,I="\u2014",G=lt||(ke?i.symbol:""),ie=we?.currency_decimals??(ke?i.quantity.decimals:18),pt=K?aa(K):null,de=K?sa(K):null,mt=de!==null&&G?`${po(de,ie)} ${G}`:I,$t=K?ia(K.gasLimit):I,Vt=K?.maxPriorityFeePerGas!==void 0?`${mo(K.maxPriorityFeePerGas)} Gwei`:I,un=K?.maxFeePerGas!==void 0?`${mo(K.maxFeePerGas)} Gwei`:I,Ht=K?.gasPrice!==void 0?`${mo(K.gasPrice)} Gwei`:I,So=`${L} ${i.symbol}`,fn=(()=>{if(!K||de===null)return I;if(ke&&ne!==null){let Pt=ne+de;return`${po(Pt,ie)} ${G||i.symbol}`}return G?`${po(de,ie)} ${G}`:I})();return(0,a.jsxs)("div",{className:"send-page send-page--review",children:[(0,a.jsxs)("div",{className:"send-scroll send-review-scroll","data-vaul-no-drag":!0,children:[(0,a.jsxs)("div",{className:"send-review-amount",children:[(0,a.jsx)("img",{className:"send-review-amount-icon",src:i.icon_url,alt:"",width:32,height:32,draggable:!1,onError:Pt=>{Pt.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),(0,a.jsxs)("span",{className:"send-review-amount-value",children:[L," ",i.symbol]})]}),(0,a.jsxs)("div",{className:"send-review-parties",children:[(0,a.jsxs)("div",{className:"send-review-party",children:[(0,a.jsx)("span",{className:"send-review-party-label",children:"From"}),(0,a.jsxs)("div",{className:"send-review-party-info",children:[(0,a.jsx)("span",{className:"send-review-party-name",children:M}),(0,a.jsx)("span",{className:"send-review-party-addr",children:n})]})]}),(0,a.jsxs)("div",{className:"send-review-party",children:[(0,a.jsx)("span",{className:"send-review-party-label",children:"To"}),(0,a.jsx)("div",{className:"send-review-party-info",children:(0,a.jsx)("span",{className:"send-review-party-addr",children:re})})]})]}),(0,a.jsxs)("section",{className:"send-review-section",children:[(0,a.jsx)("h3",{className:"send-review-section-title",children:"Summary"}),(0,a.jsxs)("div",{className:"send-review-row",children:[(0,a.jsx)("span",{className:"send-review-row-label",children:"Network"}),(0,a.jsxs)("span",{className:"send-review-row-value send-review-network",children:[(0,a.jsx)("span",{className:"send-review-network-dot","aria-hidden":!0}),Qe]})]}),(0,a.jsxs)("div",{className:"send-review-row",children:[(0,a.jsx)("span",{className:"send-review-row-label",children:"Est. Tx Fee"}),(0,a.jsx)("span",{className:"send-review-row-value",children:ce?"\u2026":mt})]}),pt==="dynamic"?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"send-review-row",children:[(0,a.jsx)("span",{className:"send-review-row-label",children:"Max Priority Fee"}),(0,a.jsx)("span",{className:"send-review-row-value",children:ce?"\u2026":Vt})]}),(0,a.jsxs)("div",{className:"send-review-row",children:[(0,a.jsx)("span",{className:"send-review-row-label",children:"Max Gas Fee"}),(0,a.jsx)("span",{className:"send-review-row-value",children:ce?"\u2026":un})]})]}):pt==="legacy"?(0,a.jsxs)("div",{className:"send-review-row",children:[(0,a.jsx)("span",{className:"send-review-row-label",children:"Gas Price"}),(0,a.jsx)("span",{className:"send-review-row-value",children:ce?"\u2026":Ht})]}):null,(0,a.jsxs)("div",{className:"send-review-row",children:[(0,a.jsx)("span",{className:"send-review-row-label",children:"Gas Limit"}),(0,a.jsx)("span",{className:"send-review-row-value",children:ce?"\u2026":$t})]})]}),(0,a.jsxs)("section",{className:"send-review-section",children:[(0,a.jsx)("h3",{className:"send-review-section-title",children:"Total"}),(0,a.jsxs)("div",{className:"send-review-row",children:[(0,a.jsx)("span",{className:"send-review-row-label",children:"Total Amount"}),(0,a.jsx)("span",{className:"send-review-row-value",children:So})]}),(0,a.jsxs)("div",{className:"send-review-row",children:[(0,a.jsx)("span",{className:"send-review-row-label",children:"Max. Total Amount"}),(0,a.jsx)("span",{className:"send-review-row-value",children:ce?"\u2026":fn})]})]}),ve&&(0,a.jsx)("div",{className:"send-message send-message--error",role:"alert",children:ve}),A&&(0,a.jsx)("div",{className:"send-message send-message--error",role:"alert",children:A})]}),(0,a.jsxs)("div",{className:"send-footer send-footer--review",children:[(0,a.jsx)("button",{type:"button",className:"send-review-btn send-review-btn--cancel",onClick:Gn,disabled:u,children:"Cancel"}),(0,a.jsx)("button",{type:"button",className:"send-review-btn send-review-btn--confirm",onClick:Wt,disabled:u,children:u?"Sending...":"Send"})]})]})}if((be==="confirming"||be==="success")&&v){let u=be==="success";return(0,a.jsxs)("div",{className:"send-page send-page--success",children:[(0,a.jsxs)("div",{className:"send-success-body","data-vaul-no-drag":!0,children:[(0,a.jsx)("div",{className:"send-success-icon","data-pending":!u||void 0,children:u?(0,a.jsx)(ca,{}):(0,a.jsx)("span",{className:"send-success-spinner"})}),(0,a.jsxs)("div",{className:"send-success-copy",children:[(0,a.jsx)("h3",{className:"send-success-title",children:u?"Transaction Complete":"Transaction in Progress"}),(0,a.jsx)("p",{className:"send-success-desc",children:u?"Your transfer was sent successfully.":"Transfer in progress. Waiting for confirmation."})]}),(0,a.jsxs)("div",{className:"send-success-hash-card",children:[(0,a.jsx)("span",{className:"send-success-hash-label",children:"Transaction Hash"}),(0,a.jsxs)("div",{className:"send-success-hash-row","data-vaul-no-drag":!0,children:[(0,a.jsx)("button",{type:"button",className:"send-success-hash-link",onClick:ct,"aria-label":"Open transaction in explorer",children:Ce(v)}),(0,a.jsx)("button",{type:"button",className:"send-success-copy-btn",onClick:pn,"aria-label":"Copy transaction hash",children:xe?(0,a.jsx)(jt,{size:16}):"Copy"})]})]})]}),(0,a.jsx)("div",{className:"send-footer",children:(0,a.jsx)("button",{type:"button",className:"send-submit-btn",onClick:y,disabled:!u,children:u?"All done":"Sending..."})})]})}return(0,a.jsxs)("form",{className:"send-page",onSubmit:mn,children:[(0,a.jsxs)("div",{className:"send-scroll","data-vaul-no-drag":!0,ref:je,children:[(0,a.jsxs)("section",{className:"send-section","aria-label":"Select token to send",children:[(0,a.jsx)("span",{className:"send-label",children:"Token"}),(0,a.jsxs)("button",{type:"button",className:"send-asset-card",onClick:()=>{Ge&&k(u=>!u)},disabled:!Ge,"aria-expanded":Ge?H:void 0,children:[(0,a.jsxs)("span",{className:"send-asset-left",children:[(0,a.jsx)("img",{className:"send-asset-icon",src:i.icon_url,alt:i.symbol,width:40,height:40,draggable:!1,onError:u=>{u.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),(0,a.jsxs)("span",{className:"send-asset-info",children:[(0,a.jsx)("span",{className:"send-asset-symbol",children:i.symbol}),(0,a.jsx)("span",{className:"send-asset-name",children:i.name})]})]}),(0,a.jsxs)("span",{className:"send-asset-balance",children:[(0,a.jsx)("span",{className:"send-balance-label",children:"Available"}),(0,a.jsxs)("span",{className:"send-balance-value",children:[$e," ",i.symbol]})]})]}),Ge&&H&&(0,a.jsx)("div",{className:"send-token-list",role:"listbox",children:Ye.map(u=>{let L=co(u)===co(i);return(0,a.jsxs)("button",{type:"button",role:"option","aria-selected":L,className:"send-token-option","data-selected":L||void 0,onClick:()=>p?.(u),children:[(0,a.jsxs)("span",{className:"send-asset-left",children:[(0,a.jsx)("img",{className:"send-token-option-icon",src:u.icon_url,alt:u.symbol,width:28,height:28,draggable:!1,onError:M=>{M.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),(0,a.jsxs)("span",{className:"send-asset-info",children:[(0,a.jsx)("span",{className:"send-token-option-symbol",children:u.symbol}),(0,a.jsx)("span",{className:"send-asset-name",children:u.name})]})]}),(0,a.jsx)("span",{className:"send-token-option-balance",children:ht(u.quantity.numeric,u.quantity.decimals)})]},co(u))})}),N.token&&(0,a.jsx)("p",{className:"send-field-error",role:"alert",children:N.token})]}),(0,a.jsxs)("section",{className:"send-field","aria-label":"Recipient address",children:[(0,a.jsx)("span",{className:"send-label",children:"To"}),(0,a.jsxs)("div",{className:"send-address-wrap","data-invalid":N.recipient||void 0,children:[(0,a.jsx)("input",{className:"send-input send-input--address",value:g,onChange:u=>w(u.target.value),placeholder:"0x...",autoComplete:"off",spellCheck:!1,"aria-invalid":!!N.recipient,"aria-describedby":N.recipient?"send-recipient-error":void 0}),(0,a.jsx)("button",{type:"button",className:"send-address-book-btn",onClick:()=>Z(u=>!u),"aria-label":"Open address book","aria-expanded":j,children:(0,a.jsx)(la,{})})]}),N.recipient&&(0,a.jsx)("p",{id:"send-recipient-error",className:"send-field-error",role:"alert",children:N.recipient}),j&&(0,a.jsxs)("div",{className:"send-address-picker",children:[(0,a.jsxs)("div",{className:"send-address-tabs",role:"tablist",children:[Ee&&(0,a.jsx)("button",{type:"button",role:"tab",className:"send-address-tab","data-active":le==="account"||void 0,"aria-selected":le==="account",onClick:()=>Be("account"),children:"My Account"}),(0,a.jsx)("button",{type:"button",role:"tab",className:"send-address-tab","data-active":le==="recent"||void 0,"aria-selected":le==="recent",onClick:()=>Be("recent"),children:"Recent"})]}),Ee&&le==="account"?(0,a.jsx)("div",{className:"send-address-list",children:Ve.map((u,L)=>{let M=pr(u,L),I=xt(He,u.address,{size:56,bg:Te});return(0,a.jsxs)("button",{type:"button",className:"send-address-option",onClick:()=>cn(u.address),children:[(0,a.jsxs)("span",{className:"send-address-avatar","aria-hidden":!0,children:[I&&(0,a.jsx)("img",{className:"send-address-avatar-img",src:I,alt:"",width:36,height:36,draggable:!1,onError:G=>{G.currentTarget.style.display="none"}}),(0,a.jsx)("span",{className:"send-address-avatar-fallback",children:mr(M)})]}),(0,a.jsxs)("span",{className:"send-address-copy",children:[(0,a.jsx)("span",{className:"send-address-name",children:M}),(0,a.jsx)("span",{className:"send-address-value",children:Ce(u.address)})]})]},u.address)})}):ge.length>0?(0,a.jsx)("div",{className:"send-address-list",children:ge.map(u=>{let L=st.get(u.address.toLowerCase()),M=L?pr(L.account,L.index):void 0,I=xt(He,u.address,{size:56,bg:Te});return(0,a.jsxs)("button",{type:"button",className:"send-address-option",onClick:()=>cn(u.address),children:[(0,a.jsxs)("span",{className:"send-address-avatar","aria-hidden":!0,children:[I&&(0,a.jsx)("img",{className:"send-address-avatar-img",src:I,alt:"",width:36,height:36,draggable:!1,onError:G=>{G.currentTarget.style.display="none"}}),(0,a.jsx)("span",{className:"send-address-avatar-fallback",children:M?mr(M):u.address.slice(2,4).toUpperCase()})]}),(0,a.jsxs)("span",{className:"send-address-copy",children:[(0,a.jsx)("span",{className:"send-address-name",children:M??Ce(u.address)}),(0,a.jsx)("span",{className:"send-address-value",children:L?Ce(L.account.address):"Recently sent"})]})]},u.address)})}):(0,a.jsx)("div",{className:"send-address-empty",children:"No Send History"})]})]}),(0,a.jsxs)("section",{className:"send-field","aria-labelledby":"send-amount-label",children:[(0,a.jsxs)("span",{className:"send-label-row",children:[(0,a.jsx)("span",{id:"send-amount-label",className:"send-label",children:"Amount"}),(0,a.jsx)("button",{type:"button",className:"send-max-btn",onClick:Hn,disabled:Ke<=0n,children:"Max"})]}),(0,a.jsxs)("div",{className:"send-amount-wrap","data-invalid":N.amount||void 0,children:[(0,a.jsx)("input",{ref:qe,className:"send-input send-input--amount",value:h,onChange:u=>P(u.target.value),onFocus:_e,placeholder:"0.00",inputMode:"decimal",autoComplete:"off","aria-labelledby":"send-amount-label","aria-invalid":!!N.amount,"aria-describedby":N.amount?"send-amount-error":void 0}),(0,a.jsx)("span",{className:"send-amount-symbol",children:i.symbol})]}),N.amount&&(0,a.jsx)("p",{id:"send-amount-error",className:"send-field-error",role:"alert",children:N.amount})]}),(0,a.jsxs)("div",{className:"send-meta",children:[(0,a.jsx)("span",{children:"From"}),(0,a.jsx)("span",{children:Ce(n)})]}),(0,a.jsxs)("div",{className:"send-meta",children:[(0,a.jsx)("span",{children:"Network"}),(0,a.jsxs)("span",{children:["Chain ID ",i.chainId]})]}),A&&(0,a.jsx)("div",{className:"send-message send-message--error",role:"alert",children:A})]}),(0,a.jsx)("div",{className:"send-footer",children:(0,a.jsx)("button",{type:"submit",className:"send-submit-btn","data-disabled":Bt||void 0,"aria-disabled":Bt,children:"Send"})})]})}var ur=U(require("@radix-ui/react-popover"),1),fr=require("vaul");var bt=require("react/jsx-runtime");function gr({asChild:e,className:t,children:n}){let{isMobile:o,theme:r,walletAddress:i}=Xe(),l=n!=null,p=e??!0,m=l?n:(0,bt.jsxs)("button",{type:"button",className:Y("wi-trigger-btn",t),"data-theme":r,"data-mobile":o||void 0,children:[(0,bt.jsx)(Zo,{size:o?14:16}),(0,bt.jsx)("span",{className:"wi-trigger-address",children:Ce(i)})]});return o?(0,bt.jsx)(fr.Drawer.Trigger,{asChild:p,children:m}):(0,bt.jsx)(ur.Trigger,{asChild:p,children:m})}var V=U(require("react"),1),Fn=U(require("@radix-ui/react-popover"),1),Xt=require("vaul");var Ot=U(require("bignumber.js"),1);var wr=require("@tanstack/react-query"),hr=require("react");var Ln="user-balance";async function da(e,t,n,o){let r=new URLSearchParams({networkId:`eip155:${t}`,account:n}),i=await fetch(`${e}/v1/public/token/balance?${r}`,{cache:"no-store",signal:o});if(!i.ok)throw new Error(`Failed to fetch token balance: ${i.status}`);let l=await i.json();if(l.code!==200)throw new Error(`Token balance API error: ${l.code}`);return l.data}function vt(e,t,n=!0){let o=Ne[e],r=fe[e],i=[r.cross,r.bsc],l=(0,wr.useQueries)({queries:i.map(c=>({queryKey:[Ln,e,t,c],queryFn:({signal:f})=>da(o,c,t,f),enabled:!!t&&n,staleTime:0,refetchInterval:n?5e3:!1}))}),p=l.some(c=>c.isLoading),m=l.some(c=>c.isError);return{tokens:(0,hr.useMemo)(()=>{let c=[];for(let f of l)f.data&&c.push(...f.data);return c},[l]),isLoading:p,isError:m}}var Rn=require("@tanstack/react-query"),xr=require("react");var pa="forge-holdings",ma="forge-token-image";async function ua(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 fa(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 br(e,t,n=!0){let o=Qn[e],{data:r,...i}=(0,Rn.useQuery)({queryKey:[pa,e,t],queryFn:({signal:l})=>ua(o,t,l),enabled:!!t&&n,staleTime:0,refetchInterval:n?5e3:!1});return{holdings:r??[],...i}}function vr(e,t,n=!0){let o=Qn[e],r=(0,Rn.useQueries)({queries:t.map(l=>({queryKey:[ma,e,l],queryFn:({signal:p})=>fa(o,l,p),enabled:n,staleTime:1/0}))});return{imageMap:(0,xr.useMemo)(()=>{let l=new Map;for(let p of r)p.data&&l.set(p.data.address,p.data.image_url);return l},[r])}}var yr=require("@tanstack/react-query"),kr=require("react");var En="token-stats";function yt(e,t){return`${e}:${t.toLowerCase()}`}function kt(e,t=!0){let n=Ne[e],{data:o,...r}=(0,yr.useQuery)({queryKey:[En,e],queryFn:async({signal:l})=>{let p=await fetch(`${n}/v1/public/token/stats`,{cache:"no-store",signal:l});if(!p.ok)throw new Error(`Failed to fetch token stats: ${p.status}`);let m=await p.json();if(m.code!==200)throw new Error(`Token stats API error: ${m.code}`);return m},enabled:t,staleTime:3e4});return{statsMap:(0,kr.useMemo)(()=>{let l=new Map;if(!o?.data)return l;for(let p of o.data){let m=yt(p.chain_id,p.address);l.set(m,p)}return l},[o]),...r}}var Cr=require("@tanstack/react-query"),Nr=require("react");var ga="token-info";function fo(e,t){return`${t.toLowerCase()}_${e}`}function Lr(e,t=!0){let n=Ne[e],{data:o,...r}=(0,Cr.useQuery)({queryKey:[ga,e],queryFn:async({signal:l})=>{let p=await fetch(`${n}/v1/public/token/info`,{cache:"no-store",signal:l});if(!p.ok)throw new Error(`Failed to fetch token info: ${p.status}`);let m=await p.json();if(m.code!==200)throw new Error(`Token info API error: ${m.code}`);return m},enabled:t,staleTime:1/0});return{categoryMap:(0,Nr.useMemo)(()=>{let l=new Map;if(!o?.data)return l;for(let p of o.data){let m=fo(p.chain_id,p.address);l.set(m,p.category)}return l},[o]),...r}}var Rr=require("react"),Tn=U(require("bignumber.js"),1);function Er(e,t,n){let{tokens:o,isLoading:r}=vt(e,t,n),{statsMap:i}=kt(e,n);return(0,Rr.useMemo)(()=>{let l=new Tn.default(0);for(let c of o){let f=i.get(yt(c.chainId,c.address));if(!f)continue;let x=new Tn.default(c.quantity.numeric).shiftedBy(-c.quantity.decimals).multipliedBy(new Tn.default(f.price));x.isNaN()||(l=l.plus(x))}let p=l.toFixed(),{displayValue:m,isLowerBound:d}=jo(p);return{totalUsd:p,displayValue:m,isLowerBound:d,isLoading:r}},[o,i,r])}var ai=require("qrcode.react");function Oe(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(d){console.error("[dapp-ui] onOutlink threw:",d);return}let i=d=>{typeof window>"u"||window.open(d,"_blank","noopener,noreferrer")};if((d=>!!d&&(typeof d=="object"||typeof d=="function")&&typeof d.then=="function")(r)){let d=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null,c=f=>{if(f===null){d?.close();return}let y=f??t;if(d)try{d.location.href=y}catch{d.close(),i(y)}else i(y)};r.then(c,f=>{console.error("[dapp-ui] onOutlink rejected:",f),d?.close()});return}let p=r;if(p===null)return;i(p??t)}var Lt=U(require("react"),1),ii=require("vaul");var Pn=require("react"),Yt=(0,Pn.createContext)(null);function se(){let e=(0,Pn.useContext)(Yt);if(!e)throw new Error("WalletPortfolio compound components must be used within <WalletPortfolio>");return e}var Tr=require("vaul");var go=require("react/jsx-runtime");function Pr({asChild:e,children:t}){let{walletAddress:n}=se(),o=t!=null,r=e??!0,i=o?t:(0,go.jsx)("button",{type:"button",children:Ce(n)});return(0,go.jsx)(Tr.Drawer.Trigger,{asChild:r,children:i})}var Qt=require("vaul");var Ie=U(require("react"),1),oi=require("@tanstack/react-query");var Dr=require("react"),An=U(require("bignumber.js"),1);var Mr=require("@tanstack/react-query"),wo=require("react");var In={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"},Ir={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},Sn={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"},et={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"},Sr={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 wa="wp:reward-pools";function Mn(e,t=!0){let n=In[e],{data:o,...r}=(0,Mr.useQuery)({queryKey:[wa,e],queryFn:async({signal:p})=>{let m=await fetch(`${n}/v1/pools`,{cache:"no-store",signal:p});if(!m.ok)throw new Error(`Failed to fetch pools: ${m.status}`);let d=await m.json();if(d.code!==200)throw new Error(`Pools API error: ${d.code}`);return d},enabled:t,staleTime:0}),i=(0,wo.useMemo)(()=>o?.data.pools.filter(p=>p.pool_type==="CrossPool")??[],[o]),l=(0,wo.useMemo)(()=>o?.data.pools.filter(p=>p.pool_type==="GamePool")??[],[o]);return{crossPools:i,gamePools:l,allPools:o?.data.pools??[],...r}}var _r=require("@tanstack/react-query"),Ar=require("react");var ha="wp:user-deposits";function _n(e,t,n=!0){let o=In[e],r=n&&!!t,{data:i,...l}=(0,_r.useQuery)({queryKey:[ha,e,t],queryFn:async({signal:m})=>{let d=await fetch(`${o}/v1/users/${t}/deposits`,{cache:"no-store",signal:m});if(!d.ok)throw new Error(`Deposits fetch failed: ${d.status}`);let c=await d.json();if(c.code!==200)throw new Error(`Deposits API error: ${c.code}`);return c},enabled:r,staleTime:0});return{depositMap:(0,Ar.useMemo)(()=>{let m=new Map;if(!i?.data.user_deposits)return m;for(let d of i.data.user_deposits)m.set(d.pool_address.toLowerCase(),d);return m},[i]),deposits:i?.data.user_deposits??[],...l}}var ho=require("@tanstack/react-query"),xo=require("react");function De(e,t,n,o=!0){let r=Sr[e][t],i=o&&!!n,{data:l,...p}=(0,ho.useQuery)({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}),m=l?.data??[],d=(0,xo.useMemo)(()=>{let g=new Map;for(let w of m)g.set(w.pair_address.toLowerCase(),w);return g},[m]),{data:c,...f}=(0,ho.useQuery)({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)}),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 A=await P.json();if(A.code!==200)throw new Error(`open-order API error: ${A.code}`);return A.data?.data??[]},enabled:i,staleTime:0}),y=c??[],x=(0,xo.useMemo)(()=>{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:m,pairMap:d,orders:y,ordersByPair:x,isEmpty:y.length===0,isLoading:p.isLoading||f.isLoading}}var xa=["var(--wp-blue)","var(--wp-purple)","var(--wp-red)","var(--wp-orange)"],Or="var(--wp-green)",Fr=4;function Wr(e,t,n=!0){let o=n&&!!t,{allPools:r}=Mn(e,o),{depositMap:i}=_n(e,t,o),{allPairs:l,pairMap:p,ordersByPair:m}=De(e,"cross",t,o),{allPairs:d,pairMap:c,ordersByPair:f}=De(e,"crossd",t,o),{allPairs:y,pairMap:x,ordersByPair:g}=De(e,"forge",t,o);return(0,Dr.useMemo)(()=>{let w=new Map,h=new Map,P=(v,E)=>{!Number.isFinite(E)||E<=0||h.set(v,(h.get(v)??0)+E)};for(let v of r){let E=Number(v.deposit_token.price);E>0&&w.set(v.deposit_token.symbol,E);for(let H of v.reward_tokens){let k=Number(H.price);k>0&&w.set(H.symbol,k)}}for(let v of[...l,...d,...y]){let E=w.get(v.quote_symbol),H=Number(v.billboard?.price);E&&H>0&&!w.has(v.base_symbol)&&w.set(v.base_symbol,H*E)}for(let v of r){let E=i.get(v.pool_address.toLowerCase());if(!E)continue;let H=new An.default(E.deposited_amount).shiftedBy(-v.deposit_token.decimals).toNumber();if(P(v.deposit_token.symbol,H),v.reward_tokens.length>0){let k=v.reward_tokens[0],j=new An.default(E.claimable_reward).shiftedBy(-k.decimals).toNumber();P(k.symbol,j)}}let A=[{pairMap:p,ordersByPair:m},{pairMap:c,ordersByPair:f},{pairMap:x,ordersByPair:g}];for(let{pairMap:v,ordersByPair:E}of A)for(let[H,k]of E){let j=v.get(H);if(j){for(let Z of k.buys){let xe=Number(Z.amount)-Number(Z.filled);P(j.quote_symbol,xe*Number(Z.price))}for(let Z of k.sells){let xe=Number(Z.amount)-Number(Z.filled);P(j.base_symbol,xe)}}}let S=[],N=0;for(let[v,E]of h){let H=w.get(v)??0,k=E*H;k>0&&(S.push({symbol:v,usdValue:k}),N+=k)}S.sort((v,E)=>E.usdValue-v.usdValue);let z=[];if(N>0){let v=S.slice(0,Fr),E=S.slice(Fr);for(let k=0;k<v.length;k++)z.push({symbol:v[k].symbol,usdValue:v[k].usdValue,percentage:Math.round(v[k].usdValue/N*100),color:xa[k]??Or});if(E.length>0){let k=E.reduce((j,Z)=>j+Z.usdValue,0);z.push({symbol:"Others",usdValue:k,percentage:Math.round(k/N*100),color:Or})}let H=z.reduce((k,j)=>k+j.percentage,0);H!==100&&z.length>0&&(z[0].percentage+=100-H)}return{totalUsd:N,formattedTotal:N>0?`$${new An.default(N).toFormat(2)}`:"$0.00",segments:z}},[r,i,l,p,m,d,c,f,y,x,g])}var ze=require("react/jsx-runtime");function Br({size:e=22,className:t}){return(0,ze.jsx)("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,ze.jsx)("path",{d:"M14 4L7 11L14 18",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function $r({size:e=22,className:t}){return(0,ze.jsxs)("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[(0,ze.jsx)("path",{d:"M18.333 3.667v5.5h-5.5",stroke:"currentColor",strokeWidth:1.833,strokeLinecap:"round",strokeLinejoin:"round"}),(0,ze.jsx)("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 Vr({size:e=12,className:t}){return(0,ze.jsx)("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,ze.jsx)("path",{d:"M6 11A5 5 0 106 1a5 5 0 000 10zM6 8V6M6 4h.005",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})})}var Hr=require("@tanstack/react-query"),Gr=require("react");var ba="wp:token-info";function tt(e,t=!0){let n=Ne[e],o=fe[e].cross,{data:r,...i}=(0,Hr.useQuery)({queryKey:[ba,e],queryFn:async({signal:d})=>{let c=await fetch(`${n}/v1/public/token/info`,{cache:"no-store",signal:d});if(!c.ok)throw new Error(`Failed to fetch token info: ${c.status}`);let f=await c.json();if(f.code!==200)throw new Error(`Token info API error: ${f.code}`);return f},enabled:t,staleTime:300*1e3}),{byChainAddr:l,byChainSym:p}=(0,Gr.useMemo)(()=>{let d=new Map,c=new Map;if(!r?.data)return{byChainAddr:d,byChainSym:c};for(let f of r.data){let y=f.address.toLowerCase();d.set(`${f.chain_id}:${y}`,f),d.set(y,f);let x=f.symbol.replace(/^t/,"").toUpperCase(),g=`${f.chain_id}:${x}`;c.has(g)||c.set(g,f),c.has(x)||c.set(x,f)}return{byChainAddr:d,byChainSym:c}},[r]);return{getTokenImage:(d,c)=>{let f=d.toLowerCase(),y=l.get(`${o}:${f}`);if(y?.image)return y.image;let x=l.get(f);if(x?.image)return x.image;if(c){let g=c.replace(/^t/,"").toUpperCase(),w=p.get(`${o}:${g}`);if(w?.image)return w.image;let h=p.get(g);if(h?.image)return h.image}return""},...i}}var nt=require("react/jsx-runtime");function We({title:e,icon:t,iconFit:n="cover",isEmpty:o,children:r}){return(0,nt.jsxs)("div",{className:"wp-svc-card",children:[(0,nt.jsxs)("div",{className:"wp-svc-card-head",children:[(0,nt.jsx)("img",{className:"wp-svc-card-icon",src:t,alt:"",style:{objectFit:n}}),(0,nt.jsx)("span",{className:"wp-svc-card-title",children:e})]}),o?(0,nt.jsx)("div",{className:"wp-svc-empty",children:"No assets yet"}):(0,nt.jsx)("div",{className:"wp-svc-items",children:r})]})}var _t=U(require("bignumber.js"),1),ee=require("react/jsx-runtime"),va="CROSS Rewards";function zr(e,t){let n=new _t.default(e).shiftedBy(-t);return n.isZero()?"0":n.isGreaterThanOrEqualTo(1)?n.toFormat(2,_t.default.ROUND_DOWN):n.toFormat(4,_t.default.ROUND_DOWN)}function Ur(){let{env:e,walletAddress:t,onOutlink:n}=se(),o=!!t,{allPools:r}=Mn(e,o),{depositMap:i}=_n(e,t,o),{getTokenImage:l}=tt(e,o),p=c=>`${Ir[e]}/rewards/${c.pool_address}?action=withdraw`,m=`${Fe[e]}/reward.png`,d=r.filter(c=>{let f=i.get(c.pool_address.toLowerCase()),y=f?.deposited_amount??"0",x=f?.claimable_reward??"0";return!(new _t.default(y).isZero()&&new _t.default(x).isZero())});return(0,ee.jsx)(We,{title:va,icon:m,isEmpty:d.length===0,children:d.map(c=>{let f=i.get(c.pool_address.toLowerCase()),y=f?.deposited_amount??"0",x=p(c);return(0,ee.jsxs)("a",{className:"wp-item","data-side":"reward",href:x,target:"_blank",rel:"noopener noreferrer",onClick:g=>Oe(g,x,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:c,userDeposit:f}},n),children:[(0,ee.jsxs)("div",{className:"wp-item-body",children:[(0,ee.jsxs)("div",{className:"wp-item-field",children:[(0,ee.jsxs)("span",{className:"wp-item-label",children:["Deposited (",c.deposit_token.symbol,")"]}),(0,ee.jsxs)("div",{className:"wp-svc-token",children:[l(c.deposit_token.address,c.deposit_token.symbol)&&(0,ee.jsx)("img",{className:"wp-svc-token-icon",src:l(c.deposit_token.address,c.deposit_token.symbol),alt:""}),(0,ee.jsx)("span",{children:zr(y,c.deposit_token.decimals)})]})]}),(0,ee.jsxs)("div",{className:"wp-item-field",children:[(0,ee.jsxs)("span",{className:"wp-item-label",children:["Rewards (",c.reward_tokens.map(g=>g.symbol).join(", "),")"]}),c.reward_tokens.map(g=>{let w=l(g.address,g.symbol);return(0,ee.jsxs)("div",{className:"wp-svc-token",children:[w&&(0,ee.jsx)("img",{className:"wp-svc-token-icon",src:w,alt:""}),(0,ee.jsx)("span",{children:f?zr(f.claimable_reward,g.decimals):"0"})]},g.address)})]})]}),(0,ee.jsxs)("div",{className:"wp-item-badges",children:[(0,ee.jsx)("span",{className:"wp-badge wp-badge--mint",children:"Claim"}),(0,ee.jsx)("span",{className:"wp-badge wp-badge--muted",children:"Withdraw"})]})]},c.pool_address)})})}var vo=U(require("bignumber.js"),1);var _=require("react/jsx-runtime");function bo(e){let t=new vo.default(e);if(t.isNaN())return e;let n=t.decimalPlaces()??0;return t.toFormat(n)}function jr(e){let t=new vo.default(e.amount).minus(e.filled);return bo(t.toString())}function At({market:e,pairMap:t,ordersByPair:n,getDexUrl:o,getTokenImage:r}){let{onOutlink:i}=se(),l=[];for(let[p,m]of n){let d=t.get(p),c=d?r(d.base_address,d.base_symbol):"",f=d?r(d.quote_address,d.quote_symbol):"",y=o(p);for(let x of m.buys)l.push((0,_.jsxs)("a",{className:"wp-item","data-side":"buy",href:y,target:"_blank",rel:"noopener noreferrer",onClick:g=>Oe(g,y,{category:"portfolio",origin:"portfolio-dex-order",payload:{market:e,side:"buy",order:x,pair:d}},i),children:[(0,_.jsxs)("div",{className:"wp-item-body",children:[(0,_.jsxs)("div",{className:"wp-item-field",children:[(0,_.jsxs)("span",{className:"wp-item-label wp-item-label--buy",children:["Buy",d?.base_symbol?` (${d.base_symbol})`:""]}),(0,_.jsxs)("div",{className:"wp-svc-token",children:[c&&(0,_.jsx)("img",{className:"wp-svc-token-icon",src:c,alt:""}),(0,_.jsx)("span",{children:jr(x)})]})]}),(0,_.jsxs)("div",{className:"wp-item-field",children:[(0,_.jsxs)("span",{className:"wp-item-label",children:["Price",d?.quote_symbol?` (${d.quote_symbol})`:""]}),(0,_.jsxs)("div",{className:"wp-svc-token",children:[f&&(0,_.jsx)("img",{className:"wp-svc-token-icon",src:f,alt:""}),(0,_.jsx)("span",{children:bo(x.price)})]})]})]}),(0,_.jsx)("div",{className:"wp-item-badges",children:(0,_.jsx)("span",{className:"wp-badge wp-badge--red",children:"Cancel"})})]},`buy-${x.order_id}`));for(let x of m.sells)l.push((0,_.jsxs)("a",{className:"wp-item","data-side":"sell",href:y,target:"_blank",rel:"noopener noreferrer",onClick:g=>Oe(g,y,{category:"portfolio",origin:"portfolio-dex-order",payload:{market:e,side:"sell",order:x,pair:d}},i),children:[(0,_.jsxs)("div",{className:"wp-item-body",children:[(0,_.jsxs)("div",{className:"wp-item-field",children:[(0,_.jsxs)("span",{className:"wp-item-label wp-item-label--sell",children:["Sell",d?.base_symbol?` (${d.base_symbol})`:""]}),(0,_.jsxs)("div",{className:"wp-svc-token",children:[c&&(0,_.jsx)("img",{className:"wp-svc-token-icon",src:c,alt:""}),(0,_.jsx)("span",{children:jr(x)})]})]}),(0,_.jsxs)("div",{className:"wp-item-field",children:[(0,_.jsxs)("span",{className:"wp-item-label",children:["Price",d?.quote_symbol?` (${d.quote_symbol})`:""]}),(0,_.jsxs)("div",{className:"wp-svc-token",children:[f&&(0,_.jsx)("img",{className:"wp-svc-token-icon",src:f,alt:""}),(0,_.jsx)("span",{children:bo(x.price)})]})]})]}),(0,_.jsx)("div",{className:"wp-item-badges",children:(0,_.jsx)("span",{className:"wp-badge wp-badge--red",children:"Cancel"})})]},`sell-${x.order_id}`))}return(0,_.jsx)(_.Fragment,{children:l})}var yo=require("react/jsx-runtime"),ya="Gametoken - CROSS";function qr(){let{env:e,walletAddress:t}=se(),n=!!t,{pairMap:o,ordersByPair:r,isEmpty:i}=De(e,"cross",t,n),{getTokenImage:l}=tt(e,n),p=d=>{let c=o.get(d.toLowerCase());return`${et[e]}/gametoken/cross/${c?.base_symbol??""}`},m=`${Fe[e]}/dex.png`;return(0,yo.jsx)(We,{title:ya,icon:m,isEmpty:i,children:(0,yo.jsx)(At,{market:"cross",pairMap:o,ordersByPair:r,getDexUrl:p,getTokenImage:l})})}var ko=require("react/jsx-runtime"),ka="Gametoken - CROSSD";function Zr(){let{env:e,walletAddress:t}=se(),n=!!t,{pairMap:o,ordersByPair:r,isEmpty:i}=De(e,"crossd",t,n),{getTokenImage:l}=tt(e,n),p=d=>{let c=o.get(d.toLowerCase());return`${et[e]}/gametoken/crossd/${c?.base_symbol??""}`},m=`${Fe[e]}/dex.png`;return(0,ko.jsx)(We,{title:ka,icon:m,isEmpty:i,children:(0,ko.jsx)(At,{market:"crossd",pairMap:o,ordersByPair:r,getDexUrl:p,getTokenImage:l})})}var Co=require("react/jsx-runtime"),Ca="Gametoken - Forge";function Kr(){let{env:e,walletAddress:t}=se(),n=!!t,{pairMap:o,ordersByPair:r,isEmpty:i}=De(e,"forge",t,n),{getTokenImage:l}=tt(e,n);if(i)return null;let p=d=>{let c=o.get(d.toLowerCase());return`${et[e]}/gametoken/forge/${c?.base_symbol??""}`},m=`${Fe[e]}/dex.png`;return(0,Co.jsx)(We,{title:Ca,icon:m,isEmpty:i,children:(0,Co.jsx)(At,{market:"forge",pairMap:o,ordersByPair:r,getDexUrl:p,getTokenImage:l})})}var On=U(require("bignumber.js"),1),ti=require("react");var Yr=require("@tanstack/react-query");var Na="wp:forge-pools";function Qr(e,t,n=!0){let o=Sn[e],r=n&&!!t,{data:i,...l}=(0,Yr.useQuery)({queryKey:[Na,e,t],queryFn:async()=>{let m=await fetch(`${o}/v1/users/${t}/pools`,{cache:"no-store"});if(!m.ok)throw new Error(`forge pools fetch failed: ${m.status}`);return(await m.json()).data?.items??[]},enabled:r,staleTime:0}),p=i??[];return{pools:p,isEmpty:p.length===0,...l}}var Xr=require("@tanstack/react-query"),Jr=require("react");var La="wp:forge-token-detail";async function Ra(e,t){let n=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store"});return n.ok?(await n.json())?.data?.token??null:null}function ei(e,t,n=!0){let o=Sn[e],r=(0,Xr.useQueries)({queries:t.map(p=>({queryKey:[La,e,p],queryFn:()=>Ra(o,p),enabled:n&&!!p,staleTime:3e4}))}),i=(0,Jr.useMemo)(()=>{let p=new Map;for(let m=0;m<r.length;m++){let d=r[m]?.data,c=t[m];d&&c&&p.set(c.toLowerCase(),d)}return p},[r,t]),l=r.some(p=>p.isLoading);return{detailMap:i,isLoading:l}}var Q=require("react/jsx-runtime"),Ea="Forge",Ta=18,Pa="https://contents.crosstoken.io/wallet/token/images/FT.png";function Ia(e){if(!e||e==="0")return"0";let t=new On.default(e).shiftedBy(-Ta);return t.isZero()?"0":t.isGreaterThanOrEqualTo(1)?t.toFormat(2,On.default.ROUND_DOWN):t.toFormat(4,On.default.ROUND_DOWN)}function Sa(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 ni(){let{env:e,walletAddress:t,onOutlink:n}=se(),o=!!t,{pools:r,isEmpty:i}=Qr(e,t,o),l=(0,ti.useMemo)(()=>r.map(c=>c.token.address),[r]),{detailMap:p}=ei(e,l,o&&l.length>0),m=c=>`${et[e]}/forge/token/${c.token.address}`,d=`${Fe[e]}/forge.png`;return(0,Q.jsx)(We,{title:Ea,icon:d,iconFit:"contain",isEmpty:i,children:r.map(c=>{let f=p.get(c.token.address.toLowerCase()),y=f?.image_url||f?.image||c.token.image||Pa,x=f?.symbol||c.token.symbol,g=m(c);return(0,Q.jsxs)("a",{className:"wp-item","data-side":"lp",href:g,target:"_blank",rel:"noopener noreferrer",onClick:w=>Oe(w,g,{category:"portfolio",origin:"portfolio-forge",payload:{pool:c,tokenDetail:f}},n),children:[(0,Q.jsxs)("div",{className:"wp-item-body",children:[(0,Q.jsxs)("div",{className:"wp-item-field",children:[(0,Q.jsxs)("span",{className:"wp-item-label",children:["Pair (",x,")"]}),(0,Q.jsx)("div",{className:"wp-svc-token",children:(0,Q.jsx)("img",{className:"wp-svc-token-icon",src:y,alt:""})})]}),(0,Q.jsxs)("div",{className:"wp-item-field",children:[(0,Q.jsx)("span",{className:"wp-item-label",children:"LP Balance"}),(0,Q.jsx)("div",{className:"wp-svc-token",children:(0,Q.jsx)("span",{children:Ia(c.lp_balance)})})]}),(0,Q.jsxs)("div",{className:"wp-item-field",children:[(0,Q.jsx)("span",{className:"wp-item-label",children:"Ownership"}),(0,Q.jsx)("div",{className:"wp-svc-token",children:(0,Q.jsx)("span",{children:Sa(c.pool_ownership)})})]})]}),(0,Q.jsx)("div",{className:"wp-item-badges",children:(0,Q.jsx)("span",{className:"wp-badge wp-badge--mint",children:"Withdraw"})})]},c.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: hsl(221.3 24.6% 25.5%)}.wp-fullscreen[data-theme=light] .wp-header-avatar,.wp-embed[data-theme=light] .wp-header-avatar{--wp-header-avatar-bg: rgba(18, 18, 18, .1)}.wp-refresh-btn{position:relative}.wp-refresh-badge{position:absolute;top:-6px;right:-8px;min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:var(--wp-mint);color:#fff;font-size:10px;font-weight:600;line-height:16px;text-align:center}.wp-spin-once{animation:wp-spin-once .6s ease-in-out}@keyframes wp-spin-once{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.wp-header-title{flex:1;font-family:inherit;font-size: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
7
|
`);var T=require("react/jsx-runtime"),No=5,Ma="wp:";function Ct({env:e,theme:t="dark",walletAddress:n,walletName:o,onBack:r,showHeader:i=!0,variant:l="embed",className:p,sendTransaction:m,getTransactionReceipt:d,onOutlink:c}){let f=ue(e),y=!!n,x=(0,oi.useQueryClient)(),{segments:g}=Wr(f,n,y),[w,h]=Ie.useState(No),[P,A]=Ie.useState(!1),S=Ie.useCallback(()=>{x.invalidateQueries({predicate:k=>typeof k.queryKey[0]=="string"&&k.queryKey[0].startsWith(Ma)})},[x]),N=Ie.useCallback(()=>{S(),A(!0),setTimeout(()=>A(!1),600),h(No)},[S]);Ie.useEffect(()=>{if(!y)return;let k=setInterval(()=>{h(j=>j<=1?(N(),No):j-1)},1e3);return()=>clearInterval(k)},[y,N]);let z=Ie.useCallback(()=>{r?.()},[r]),v=y?xt(f,n,{size:64}):void 0,E=Ie.useMemo(()=>({env:f,theme:t,open:!0,walletAddress:n,close:z,sendTransaction:m,getTransactionReceipt:d,onOutlink:c}),[f,t,n,z,m,d,c]),H=(0,T.jsxs)(T.Fragment,{children:[i&&(0,T.jsxs)("div",{className:"wp-header",children:[(0,T.jsxs)("div",{className:"wp-header-account",children:[r?(0,T.jsx)("button",{type:"button",className:"wp-header-btn",onClick:r,children:(0,T.jsx)(Br,{})}):(0,T.jsx)("span",{className:"wp-header-avatar","aria-hidden":!0,children:v&&(0,T.jsx)("img",{src:v,alt:"",className:"wp-header-avatar-img",draggable:!1})}),o&&(0,T.jsx)("span",{className:"wp-header-wallet-name",title:o,children:o})]}),(0,T.jsxs)("button",{type:"button",className:"wp-header-btn wp-refresh-btn",onClick:N,children:[(0,T.jsx)($r,{className:P?"wp-spin-once":void 0}),y&&(0,T.jsx)("span",{className:"wp-refresh-badge",children:w})]})]}),(0,T.jsx)("div",{className:"wp-top",children:g.length>0&&(0,T.jsxs)("div",{className:"wp-asset",children:[(0,T.jsxs)("div",{className:"wp-asset-head",children:[(0,T.jsx)("span",{className:"wp-asset-head-label",children:"Consolidated Asset"}),(0,T.jsx)("span",{className:"wp-asset-head-icon",children:(0,T.jsx)(Vr,{})})]}),(0,T.jsx)("div",{className:"wp-bar",children:g.map(k=>(0,T.jsx)("div",{className:"wp-bar-seg",style:{flex:`${k.percentage} 0 0`,background:k.color},children:k.percentage>=5&&(0,T.jsxs)("span",{className:"wp-bar-seg-pct",children:[k.percentage,"%"]})},k.symbol))}),(0,T.jsx)("div",{className:"wp-legend",children:g.map(k=>(0,T.jsxs)("div",{className:"wp-legend-item",children:[(0,T.jsx)("span",{className:"wp-legend-dot",style:{background:k.color}}),(0,T.jsx)("span",{className:"wp-legend-label",children:k.symbol})]},k.symbol))})]})}),(0,T.jsx)("div",{className:"wp-body",children:(0,T.jsxs)("div",{className:"wp-body-inner",children:[(0,T.jsx)(Ur,{}),(0,T.jsx)(qr,{}),(0,T.jsx)(Zr,{}),(0,T.jsx)(Kr,{}),(0,T.jsx)(ni,{})]})})]});return(0,T.jsx)(Yt.Provider,{value:E,children:l==="none"?H:(0,T.jsx)("div",{className:Y(l==="fullscreen"?"wp-fullscreen":"wp-embed",p),"data-theme":t,children:H})})}var Nt=require("react/jsx-runtime");function ri({className:e}){let{env:t,theme:n,walletAddress:o,close:r,sendTransaction:i}=se();return(0,Nt.jsxs)(Qt.Drawer.Portal,{children:[(0,Nt.jsx)(Qt.Drawer.Overlay,{className:"wp-overlay"}),(0,Nt.jsxs)(Qt.Drawer.Content,{className:Y("wp-fullscreen",e),"data-theme":n,children:[(0,Nt.jsx)(Qt.Drawer.Title,{className:"wp-sr-only",children:"My Portfolio"}),(0,Nt.jsx)(Ct,{env:t,theme:n,walletAddress:o,onBack:r,variant:"none",sendTransaction:i})]})]})}var Lo=require("react/jsx-runtime");function _a({env:e,theme:t="dark",walletAddress:n,open:o,onOpenChange:r,sendTransaction:i,onOutlink:l,children:p}){let m=ue(e),d=o!==void 0,[c,f]=Lt.useState(!1),y=d?o:c,x=Lt.useCallback(h=>{d||f(h),r?.(h)},[d,r]),g=Lt.useCallback(()=>x(!1),[x]),w=Lt.useMemo(()=>({env:m,theme:t,open:y,walletAddress:n,close:g,sendTransaction:i,onOutlink:l}),[m,t,y,n,g,i,l]);return(0,Lo.jsx)(Yt.Provider,{value:w,children:(0,Lo.jsx)(ii.Drawer.Root,{direction:"bottom",open:y,onOpenChange:x,noBodyStyles:!0,children:p})})}var Ro=Object.assign(_a,{Trigger:Pr,Content:ri});var s=require("react/jsx-runtime");function Eo(e,t,n){let o=fe[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 Aa(e){return parseInt(e.split(":")[1],10)}function Oa(e){let t=e.lastIndexOf(".");return t===-1?{main:e,decimal:""}:{main:e.slice(0,t),decimal:e.slice(t)}}function Fa(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 si({align:e="end",sideOffset:t=12,className:n,children:o}){let{env:r,theme:i,isMobile:l,open:p,drawerDirection:m,modal:d,showBalance:c,showForgeToken:f,showGameToken:y,showQR:x,qrLogoSrc:g,walletAddress:w,accountName:h,sendAccounts:P,profileImageUrl:A,preferredTokens:S,close:N,onSelectWallet:z,onCopyAddress:v,onDisconnect:E,disconnectLabel:H,termsUrl:k,termsLabel:j,privacyUrl:Z,privacyLabel:xe,portalStyle:it,navContent:le,navPosition:Be,footerContent:Le,view:X,setView:je,selectedSendToken:qe,setSelectedSendToken:ge,showPortfolio:Ze,portfolioTitle:be,showTotalAssets:te,totalAssetsLabel:K,sendTransaction:Se,getTransactionReceipt:ce,estimateGas:Me,onOutlink:ve}=Xe(),{tokens:me,isLoading:ye}=vt(r,w,p&&c),{statsMap:ne}=kt(r,c),{categoryMap:Re}=Lr(r,c),re=c&&te,{displayValue:at,isLowerBound:ke,isLoading:Ke}=Er(r,w,p&&re),[$e,Ve]=V.useState(!1),st=V.useRef(null),[Ee,He]=V.useState(0),{holdings:Te,isLoading:Ye}=br(r,w,p&&c&&f),Ge=V.useMemo(()=>Te.map(b=>b.token),[Te]),{imageMap:Pe}=vr(r,Ge,f&&Te.length>0),we=V.useMemo(()=>{let b=[],W=[],$=[],oe=new Map((S??[]).map((B,J)=>[`${Aa(B.chainId)}:${B.address.toLowerCase()}`,J]));for(let B of me){let J=Eo(r,B.chainId,B.symbol)!==void 0,ut=`${B.chainId}:${B.address.toLowerCase()}`,ft=oe.get(ut),zn=new Ot.default(B.quantity.numeric).shiftedBy(-B.quantity.decimals);if(J)b.push(B);else if(ft!==void 0)W.push(B);else if(zn.isGreaterThan(0)){if(!y&&Re.get(fo(B.chainId,B.address))==="game")continue;$.push(B)}}return b.sort((B,J)=>{let ut=Eo(r,B.chainId,B.symbol)??99,ft=Eo(r,J.chainId,J.symbol)??99;return ut-ft}),W.sort((B,J)=>{let ut=oe.get(`${B.chainId}:${B.address.toLowerCase()}`)??99,ft=oe.get(`${J.chainId}:${J.address.toLowerCase()}`)??99;return ut-ft}),$.sort((B,J)=>{let ut=ne.get(yt(B.chainId,B.address)),ft=ne.get(yt(J.chainId,J.address)),zn=new Ot.default(B.quantity.numeric).shiftedBy(-B.quantity.decimals).multipliedBy(ut?.price??0);return new Ot.default(J.quantity.numeric).shiftedBy(-J.quantity.decimals).multipliedBy(ft?.price??0).minus(zn).toNumber()}),[...b,...W,...$]},[me,r,ne,y,Re,S]),lt=V.useMemo(()=>{if(!f)return[];let b=new Set(me.map(W=>W.address.toLowerCase()));return[...Te].filter(W=>!b.has(W.token.toLowerCase())).sort((W,$)=>{let oe=new Ot.default(W.value);return new Ot.default($.value).minus(oe).toNumber()})},[Te,f,me]),Qe=V.useRef(!1),_e=V.useCallback(b=>{Qe.current=!0,je(b)},[je]),Hn=V.useCallback(()=>{ge(null),_e("wallet")},[ge,_e]),cn=V.useCallback(b=>{ge(b),_e("send")},[ge,_e]),dn=V.useCallback(()=>{ge(null),_e("wallet")},[ge,_e]);V.useEffect(()=>{p||(Qe.current=!1)},[p]);let pn=V.useRef(null);V.useEffect(()=>{let b=pn.current;if(!b||!l)return;let W=$=>{$.pointerType==="touch"&&$.stopPropagation()};return b.addEventListener("pointerdown",W),()=>b.removeEventListener("pointerdown",W)},[l]);let[ct,dt]=V.useState(!1),Tt=V.useRef(void 0);V.useEffect(()=>()=>clearTimeout(Tt.current),[]),V.useEffect(()=>{let b=st.current;if(!b||Le===null){He(0);return}let W=()=>{He(b.offsetHeight)};if(W(),typeof ResizeObserver>"u")return;let $=new ResizeObserver(W);return $.observe(b),()=>$.disconnect()},[Le]);let mn=V.useCallback(async()=>{if(!ct)try{await navigator.clipboard.writeText(w),dt(!0),clearTimeout(Tt.current),Tt.current=setTimeout(()=>dt(!1),2e3),v?.(w,!0)}catch{v?.(w,!1)}},[w,v,ct]),Wt=V.useCallback(b=>{b.currentTarget.setAttribute("data-loaded","true")},[]),Gn=V.useMemo(()=>({background:Fa(w)}),[w]),Bt=V.useMemo(()=>A||xt(r,w,{size:120,bg:i==="dark"?"1A1A2E":"F3F6F8"}),[A,r,w,i]),u=V.useMemo(()=>Oa(at),[at]),L=k||Z?(0,s.jsxs)("div",{className:"wi-legal-links",children:[k&&(0,s.jsx)("a",{className:"wi-legal-link",href:k,target:"_blank",rel:"noopener noreferrer",onClick:b=>Oe(b,k,{category:"terms",origin:"terms"},ve),children:j}),k&&Z&&(0,s.jsx)("span",{className:"wi-legal-sep","aria-hidden":!0,children:"\xB7"}),Z&&(0,s.jsx)("a",{className:"wi-legal-link",href:Z,target:"_blank",rel:"noopener noreferrer",onClick:b=>Oe(b,Z,{category:"privacy",origin:"privacy"},ve),children:xe})]}):null,M=E?(0,s.jsxs)("button",{type:"button",className:"wi-disconnect-btn",onClick:()=>{E(),N()},children:[(0,s.jsx)(Ko,{size:12}),(0,s.jsx)("span",{className:"wi-disconnect-label",children:H})]}):null,I=(0,s.jsxs)("div",{className:Y("wi-view-inner",Qe.current&&"wi-view-wallet"),children:[re&&(()=>{let b=Ze;return(0,s.jsxs)(b?"button":"div",{...b?{type:"button",onClick:()=>_e("portfolio"),"aria-label":"View Portfolio"}:{},className:"wi-total-section","data-clickable":b||void 0,children:[(0,s.jsxs)("div",{className:"wi-total-head",children:[(0,s.jsx)("span",{className:"wi-total-label",children:K}),(0,s.jsx)("span",{role:"button",tabIndex:0,className:"wi-total-eye",onClick:$=>{$.stopPropagation(),Ve(oe=>!oe)},onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),$.stopPropagation(),Ve(oe=>!oe))},"aria-label":$e?"Show balance":"Hide balance",children:$e?(0,s.jsx)(tr,{}):(0,s.jsx)(er,{})})]}),(0,s.jsxs)("div",{className:"wi-total-body",children:[Ke?(0,s.jsx)("div",{className:"wi-skeleton-block wi-total-skeleton",style:{width:160,height:36}}):(0,s.jsx)("div",{className:"wi-total-value","data-hidden":$e||void 0,children:$e?(0,s.jsx)("span",{className:"wi-total-mask",children:"\u2022\u2022\u2022\u2022\u2022\u2022"}):(0,s.jsxs)(s.Fragment,{children:[ke&&(0,s.jsx)("span",{className:"wi-total-lte",children:"\u2264"}),(0,s.jsx)("span",{className:"wi-total-currency",children:"$"}),(0,s.jsx)("span",{className:"wi-total-amount",children:u.main}),u.decimal&&(0,s.jsx)("span",{className:"wi-total-decimal",children:u.decimal})]})}),b&&(0,s.jsx)("span",{className:"wi-total-chevron","aria-hidden":!0,children:(0,s.jsx)(Xo,{size:18})})]})]})})(),Be==="top"&&le&&(0,s.jsx)("div",{className:"wi-nav-fixed",children:le}),c&&(0,s.jsx)("div",{ref:pn,className:"wi-scrollable-body","data-vaul-no-drag":!0,children:(0,s.jsxs)("div",{className:"wi-token-list",children:[ye&&Array.from({length:5},(b,W)=>(0,s.jsxs)("div",{className:"wi-skeleton-item",children:[(0,s.jsxs)("div",{className:"wi-skeleton-left",children:[(0,s.jsx)("div",{className:"wi-skeleton-block wi-skeleton-icon"}),(0,s.jsxs)("div",{className:"wi-skeleton-lines",children:[(0,s.jsx)("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),(0,s.jsx)("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),(0,s.jsxs)("div",{className:"wi-skeleton-right",children:[(0,s.jsx)("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),(0,s.jsx)("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},W)),!ye&&we.length===0&&!f&&(0,s.jsx)("div",{className:"wi-empty",children:"No Tokens Found"}),we.map(b=>{let W=ne.get(yt(b.chainId,b.address)),$=W?parseFloat(W.percent_change_24h):null,oe=$!==null&&$>=0,B=Xn(r,b.chainId);return(0,s.jsxs)("button",{type:"button",className:"wi-token-item wi-token-item--button",onClick:()=>cn(b),"aria-label":`Send ${b.symbol}`,children:[(0,s.jsxs)("div",{className:"wi-token-left",children:[(0,s.jsxs)("div",{className:"wi-token-icon-wrap",children:[(0,s.jsx)("img",{src:b.icon_url,alt:b.symbol,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&&(0,s.jsx)("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"}})]}),(0,s.jsxs)("div",{className:"wi-token-info",children:[(0,s.jsx)("span",{className:"wi-token-name",children:b.symbol}),W&&(0,s.jsxs)("div",{className:"wi-token-price-row",children:[(0,s.jsx)("span",{className:"wi-token-price",children:Yn(W.price)}),(0,s.jsx)("span",{className:"wi-token-change","data-positive":oe,"data-zero":$===0||void 0,children:$!==null&&($===0?"0%":`${oe?"+":"-"}${(oe?Math.floor:Math.ceil)(Math.abs($)*100)/100}%`)})]})]})]}),(0,s.jsxs)("div",{className:"wi-token-right",children:[(0,s.jsx)("span",{className:"wi-token-balance",children:ht(b.quantity.numeric,b.quantity.decimals)}),W&&(0,s.jsx)("span",{className:"wi-token-value",children:Uo(b.quantity.numeric,b.quantity.decimals,W.price)})]})]},`${b.address}-${b.chainId}`)}),f&&Ye&&Array.from({length:3},(b,W)=>(0,s.jsxs)("div",{className:"wi-skeleton-item",children:[(0,s.jsxs)("div",{className:"wi-skeleton-left",children:[(0,s.jsx)("div",{className:"wi-skeleton-block wi-skeleton-icon"}),(0,s.jsxs)("div",{className:"wi-skeleton-lines",children:[(0,s.jsx)("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),(0,s.jsx)("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),(0,s.jsxs)("div",{className:"wi-skeleton-right",children:[(0,s.jsx)("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),(0,s.jsx)("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},`forge-sk-${W}`)),f&&!Ye&&!ye&&we.length===0&<.length===0&&(0,s.jsx)("div",{className:"wi-empty",children:"No Tokens Found"}),f&<.map(b=>{let W=Pe.get(b.token)||"",$=Xn(r,fe[r].cross);return(0,s.jsxs)("div",{className:"wi-token-item",children:[(0,s.jsxs)("div",{className:"wi-token-left",children:[(0,s.jsxs)("div",{className:"wi-token-icon-wrap",children:[(0,s.jsx)("img",{src:W||"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:oe=>{oe.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),$&&(0,s.jsx)("img",{src:$,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:oe=>{oe.currentTarget.style.display="none"}})]}),(0,s.jsxs)("div",{className:"wi-token-info",children:[(0,s.jsx)("span",{className:"wi-token-name",children:b.token_name}),(0,s.jsx)("div",{className:"wi-token-price-row",children:(0,s.jsxs)("span",{className:"wi-token-price",children:[ht(b.current_price,18)," CROSS"]})})]})]}),(0,s.jsxs)("div",{className:"wi-token-right",children:[(0,s.jsx)("span",{className:"wi-token-balance",children:ht(b.balance,18)}),(0,s.jsx)("span",{className:"wi-token-value",children:Yn(b.current_value_usd)})]})]},`forge-${b.token}`)})]})}),Be==="bottom"&&le&&(0,s.jsx)("div",{className:"wi-nav-fixed",children:le}),M&&(0,s.jsx)("div",{className:"wi-wallet-disconnect-row",children:M})]},"wallet"),G=Ze?(0,s.jsx)("div",{className:Y("wi-view-inner wi-portfolio-body",Qe.current&&"wi-view-portfolio"),children:(0,s.jsx)(Ct,{env:r,theme:i,walletAddress:w,showHeader:!1,sendTransaction:Se,getTransactionReceipt:ce,onOutlink:ve})},"portfolio"):null,ie=qe?(0,s.jsx)("div",{className:Y("wi-view-inner wi-send-body",Qe.current&&"wi-view-send"),children:(0,s.jsx)(Kt,{env:r,theme:i,walletAddress:w,accountName:h,accounts:P,token:qe,tokens:we,onTokenChange:ge,sendTransaction:Se,getTransactionReceipt:ce,estimateGas:Me,onConfirmSuccess:dn,onOutlink:ve})},"send"):null,pt=(0,s.jsx)("div",{className:Y("wi-view-inner wi-qr-body",Qe.current&&"wi-view-qr"),children:(0,s.jsxs)("div",{className:"wi-qr-section",children:[(0,s.jsxs)("div",{className:"wi-qr-card",children:[(0,s.jsxs)("div",{className:"wi-qr-code",children:[(0,s.jsx)(ai.QRCodeSVG,{value:w,size:180,level:"H",marginSize:2,...g&&{imageSettings:{src:g,height:33,width:33,excavate:!0}}}),!g&&(0,s.jsx)("div",{className:"wi-qr-logo",children:(0,s.jsx)(nr,{size:33})})]}),(0,s.jsx)("p",{className:"wi-qr-address",children:w}),(0,s.jsxs)("button",{type:"button",className:"wi-qr-copy-btn",onClick:mn,children:[(0,s.jsx)("span",{className:"wi-qr-copy-icon",children:ct?(0,s.jsx)(jt,{size:16}):(0,s.jsx)(Jn,{size:16})}),(0,s.jsx)("span",{className:"wi-qr-copy-text",children:ct?"Copied!":"Copy address"})]})]}),L]})},"qr"),de=X==="qr"||X==="portfolio"||X==="send",mt=Le!==null?(0,s.jsx)("div",{className:"wi-builtin-footer",children:Le}):null,$t=!!z&&h?.trim().toLowerCase()!=="my wallet",Vt=(0,s.jsxs)("div",{className:"wi-account-text",children:[$t?(0,s.jsxs)("button",{type:"button",className:"wi-account-row wi-account-row--btn",onClick:z,"aria-label":"Switch account",children:[(0,s.jsx)("span",{className:"wi-account-name",children:h??"Account 1"}),(0,s.jsx)("span",{className:"wi-account-switch","aria-hidden":"true",children:(0,s.jsx)(Jo,{size:12})})]}):(0,s.jsx)("div",{className:"wi-account-row",children:(0,s.jsx)("span",{className:"wi-account-name",children:h??"Account 1"})}),(0,s.jsxs)("button",{type:"button",className:"wi-address-row-btn",onClick:mn,"aria-label":"Copy address",children:[(0,s.jsx)("span",{className:"wi-account-address",children:Ce(w)}),(0,s.jsx)("span",{className:"wi-account-copy",children:ct?(0,s.jsx)(jt,{size:14}):(0,s.jsx)(Jn,{size:14})})]})]}),fn=(0,s.jsxs)(s.Fragment,{children:[o,de?(0,s.jsxs)("div",{className:"wi-sticky-header",children:[(0,s.jsxs)("div",{className:"wi-header wi-header--wallet wi-header--sub-account",children:[(0,s.jsx)("button",{type:"button",className:"wi-header-back",onClick:Hn,"aria-label":"Back",children:(0,s.jsx)(Qo,{})}),(0,s.jsx)("div",{className:"wi-account-block wi-account-block--sub-account",children:Vt}),(0,s.jsx)("button",{type:"button",className:"wi-header-action",onClick:N,"aria-label":"Close",children:(0,s.jsx)(eo,{size:24})})]}),(0,s.jsx)("hr",{className:"wi-divider"})]}):(0,s.jsxs)("div",{className:"wi-sticky-header",children:[(0,s.jsxs)("div",{className:"wi-header wi-header--wallet",children:[(0,s.jsxs)("div",{className:"wi-account-block",children:[(0,s.jsxs)("div",{className:"wi-avatar",children:[(0,s.jsx)("div",{className:"wi-avatar-fallback",style:Gn}),Bt&&(0,s.jsx)("img",{src:Bt,alt:"",className:"wi-avatar-img",width:30,height:30,draggable:!1,onLoad:Wt,onError:b=>{b.currentTarget.style.display="none"}})]}),Vt]}),(0,s.jsxs)("div",{className:"wi-header-actions",children:[x&&(0,s.jsx)("button",{type:"button",className:"wi-header-action",onClick:()=>_e("qr"),"aria-label":"Show QR code",children:(0,s.jsx)(Yo,{size:20})}),(0,s.jsx)("button",{type:"button",className:"wi-header-action",onClick:N,"aria-label":"Close",children:(0,s.jsx)(eo,{size:24})})]})]}),(0,s.jsx)("hr",{className:"wi-divider"})]}),(0,s.jsxs)("div",{className:"wi-view-container",children:[X==="wallet"&&I,X==="qr"&&pt,X==="portfolio"&&G,X==="send"&&ie]}),mt&&X!=="portfolio"&&X!=="send"&&(0,s.jsx)("div",{className:"wi-sticky-footer",children:(0,s.jsx)("div",{className:"wi-footer",ref:st,children:mt})})]}),Pt={...it,...Ee>0?{"--wi-footer-height":`${Ee}px`}:null};return l?(0,s.jsxs)(Xt.Drawer.Portal,{children:[d&&(0,s.jsx)(Xt.Drawer.Overlay,{className:"wi-drawer-overlay"}),(0,s.jsxs)(Xt.Drawer.Content,{className:Y("wi-drawer-content",n),"data-theme":i,style:Pt,"data-direction":m,"data-no-balance":!c||void 0,"data-has-footer":Ee>0||void 0,"data-view":X,children:[(0,s.jsx)(Xt.Drawer.Title,{className:"wi-sr-only",children:"My Wallet"}),fn]})]}):(0,s.jsxs)(s.Fragment,{children:[d&&p&&(0,s.jsx)("div",{className:"wi-drawer-overlay",onClick:N}),(0,s.jsx)(Fn.Portal,{children:(0,s.jsx)(Fn.Content,{align:e,sideOffset:t,className:Y("wi-popover-content",n),"data-theme":i,style:Pt,"data-no-balance":!c||void 0,"data-has-footer":Ee>0||void 0,"data-view":X,children:fn})})]})}var li=U(require("react"),1);function ci({position:e="top",children:t}){let{setNavContent:n,setNavPosition:o}=Xe();return li.useEffect(()=>(n(t),o(e),()=>n(null)),[t,e,n,o]),null}var di=U(require("react"),1);function pi({children:e}){let{setFooterContent:t}=Xe();return di.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
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}
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ function ge(e){if(e)return bo(e);let t=typeof process<"u"?process.env?.NEXT_PUBL
|
|
|
2
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
3
|
`);O(`@keyframes al-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
|
|
4
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 Dn}from"react/jsx-runtime";function yo({env:e,theme:t="dark",mobileBreakpoint:n=768,domain:o,children:r}){let i=Lt(`(max-width: ${n}px)`),[a,c]=Rt.useState(!1),d=Rt.useCallback(()=>c(!1),[]),l=ge(e),s=Rt.useMemo(()=>({env:l,theme:t,isMobile:i,open:a,domain:o,close:d}),[l,t,i,a,o,d]);return Dn(Fn.Provider,{value:s,children:i?Dn(ai.Root,{direction:"right",open:a,onOpenChange:c,noBodyStyles:!0,children:r},"drawer"):Dn(vo.Root,{open:a,onOpenChange:c,children:r},"popover")})}import*as Lo from"@radix-ui/react-popover";import{Drawer as li}from"vaul";import{jsx as we,jsxs as si}from"react/jsx-runtime";function ko({size:e=18}){return si("svg",{className:"al-trigger-icon",width:e,height:e,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[we("rect",{width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"7",width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"14",width:"4",height:"4",fill:"currentColor"}),we("rect",{y:"7",width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"7",y:"7",width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"14",y:"7",width:"4",height:"4",fill:"currentColor"}),we("rect",{y:"14",width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"7",y:"14",width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"14",y:"14",width:"4",height:"4",fill:"currentColor"})]})}function Co(){return we("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:we("path",{d:"M12 19L5 12M5 12L12 5M5 12H19",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function No(){return we("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:we("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as sn}from"react/jsx-runtime";function Ro({asChild:e,children:t}){let{isMobile:n,theme:o}=an(),r=t!=null,i=e??!0,a=r?t:sn("button",{type:"button",className:"al-trigger-btn","data-theme":o,children:sn(ko,{size:n?12:18})});return n?sn(li.Trigger,{asChild:i,children:a}):sn(Lo.Trigger,{asChild:i,children:a})}import*as wt from"react";import*as cn from"@radix-ui/react-popover";import{Drawer as Et}from"vaul";import{useQuery as pi}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 ci="https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",di="https://contents.crosstoken.io/frontend/common/app-launcher/icons";function Oe(e,t){return`${e==="production"?di:ci}/${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 ln(e){let t=ge(e);return pi({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 oe,jsxs as Gt}from"react/jsx-runtime";function Io({align:e="end",sideOffset:t=12,className:n}){let{env:o,theme:r,isMobile:i,domain:a,close:c}=an(),{data:d}=ln(o),l=wt.useMemo(()=>(d?.items??[]).sort((h,P)=>h.order-P.order),[d]),s=8,u=wt.useRef(null),k=wt.useCallback(h=>{u.current={x:h.clientX,y:h.clientY}},[]),x=typeof window<"u"?window.location.pathname:"",g=wt.useCallback((h,P)=>{if(u.current){let N=h.clientX-u.current.x,H=h.clientY-u.current.y;if(u.current=null,Math.abs(N)>s||Math.abs(H)>s)return}let A=P.url[o]??P.url.production,S=Po(A,a);if(!S)try{let N=new URL(A).pathname;if(x===N||x.startsWith(N+"/")){c();return}}catch{}S?window.open(A,"_blank","noopener,noreferrer"):window.location.href=A,c()},[o,a,c,x]),w=oe("div",{className:"al-grid","data-theme":r,children:l.map(h=>{let P=h.url[o]??h.url.production,A=Po(P,a),S=!1;if(!A)try{let N=new URL(P).pathname;S=x===N||x.startsWith(N+"/")}catch{S=!1}return Gt("button",{type:"button",className:"al-grid-item","data-active":S||void 0,onPointerDown:k,onClick:N=>g(N,h),children:[Gt("div",{className:"al-grid-item-left",children:[oe("div",{className:"al-grid-item-icon",children:oe("img",{src:h.iconUrl,alt:h.label,width:24,height:24,loading:"lazy"})}),oe("span",{className:"al-grid-item-label",children:h.label}),h.isNew&&oe("span",{className:"al-badge-new",children:"N"})]}),oe("div",{className:"al-grid-item-right",children:h.badge&&oe("span",{className:"al-badge",children:h.badge})})]},h.id)})});return i?Gt(Et.Portal,{children:[oe(Et.Overlay,{className:"al-drawer-overlay"}),Gt(Et.Content,{className:K("al-drawer-content",n),"data-theme":r,children:[Gt("div",{className:"al-drawer-header",children:[oe(Et.Close,{className:"al-drawer-close",children:oe(Co,{})}),oe(Et.Title,{className:"al-drawer-title",children:"CROSS Services"}),oe(Et.Close,{className:"al-drawer-close",children:oe(No,{})})]}),oe("div",{className:"al-drawer-body",children:w})]})]}):oe(cn.Portal,{children:oe(cn.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 ce from"react";import*as Br from"@radix-ui/react-popover";import{Drawer as Za}from"vaul";import{createContext as mi,useContext as ui}from"react";var Wn=mi(null);function et(){let e=ui(Wn);if(!e)throw new Error("WalletInfo compound components must be used within <WalletInfo>");return e}var Bn=(o=>(o.CROSSx="crossx",o.MetaMask="io.metamask",o.Binance="com.binance.wallet",o))(Bn||{}),dn={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 R from"react";import ht from"bignumber.js";function fi(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 xt(e,t){if(!e||e==="0")return"0.00";let n=new ht(e).shiftedBy(-t),o=n.isGreaterThanOrEqualTo(1)?2:4;return n.toFormat(o,ht.ROUND_DOWN)}function Ce(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}function $n(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 ht(e).shiftedBy(-t).multipliedBy(new ht(n));return r.isZero()||r.isNaN()?"$0.00":`$${(r.integerValue(ht.ROUND_DOWN).isGreaterThanOrEqualTo(1)?r.decimalPlaces(2,ht.ROUND_DOWN):r.decimalPlaces(4,ht.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 a=Number(n);if(!Number.isFinite(a)||a===0)return{displayValue:"0",isLowerBound:!1};n=fi(a.toFixed(18))}let[o="0",r=""]=n.split(".");if(Number(o)>=1){let a=r.slice(0,2).padEnd(2,"0");return{displayValue:`${Number(o).toLocaleString("en-US")}.${a}`,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 Ne={dev:"https://stg-wallet-server.crosstoken.io/api",stage:"https://stg-wallet-server.crosstoken.io/api",production:"https://wallet-server.crosstoken.io/api"},me={dev:{cross:612044,bsc:97},stage:{cross:612044,bsc:97},production:{cross:612055,bsc:56}};var Vn={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 Hn(e,t){let n=me[e];if(t===n.cross)return _o.cross;if(t===n.bsc)return _o.bsc}var gi={dev:"https://dev-portrait.crosstoken.io",stage:"https://dev-portrait.crosstoken.io",production:"https://portrait.crosstoken.io"};function bt(e,t,n={}){if(!t||!t.startsWith("0x"))return;let{size:o=120,bg:r,format:i="png"}=n,a=gi[e],c=r?`&bg=${r}`:"";return`${a}/portrait/evm/${t}.${i}?size=${o}${c}`}import{jsx as G,jsxs as pn}from"react/jsx-runtime";function Ao({size:e=16,className:t}){return pn("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[G("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"}),G("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 Gn({size:e=16,className:t}){return G("svg",{width:e,height:e,viewBox:"4 4 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:G("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 zt({size:e=16,className:t}){return G("svg",{width:e,height:e,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:G("path",{d:"M11.6667 3.5L5.25 9.91667L2.33334 7",stroke:"currentColor",strokeWidth:1.16667,strokeLinecap:"round",strokeLinejoin:"round"})})}function zn({size:e=24,className:t}){return G("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:G("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function Oo({size:e=20,className:t}){return pn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[G("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"}),G("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 Fo({size:e=20,className:t}){return G("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,children:G("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 G("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:G("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 G("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:G("path",{d:"M8 5L13 10L8 15",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function Bo({size:e=20,className:t}){return G("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:G("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function $o({size:e=16,className:t}){return pn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[G("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"}),G("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 pn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[G("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"}),G("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 G("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 42 42",fill:"none",className:t,children:G("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 wi}from"react";import{useQuery as hi}from"@tanstack/react-query";var xi="send:chain-info";function bi(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 Un(e,...t){let n=e.replace(/\/+$/,""),o=t.map(r=>r.replace(/^\/+|\/+$/g,"")).filter(Boolean);return[n,...o].join("/")}function vi(e,t,n,o){if(o)return t===me[e].cross?Go(t,o):n?.explorer_url?Un(n.explorer_url,n.explorer_postfix?.transaction??"tx",o):yi(e,t,o)}function Go(e,t){return Un("https://explorer.crosstoken.io",String(e),"tx",t)}function yi(e,t,n){let o=me[e];if(t===o.cross)return Go(t,n);if(t===o.bsc)return Un(e==="production"?"https://bscscan.com":"https://testnet.bscscan.com","tx",n)}function zo(e,t,n,o=!0){let r=Ne[e],i=hi({queryKey:[xi,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 bi(s)},enabled:o,staleTime:300*1e3}),a=i.data;return{transactionUrl:wi(()=>vi(e,t,a,n),[t,a,e,n]),chainInfo:a,...i}}var Uo="0x0000000000000000000000000000000000000001";var ki="0xa9059cbb",Ci=/^0x[a-fA-F0-9]{40}$/,Ni="nexus-cross:dapp-ui:send:recent:",jo=10;function Li(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return e.slice(0,t)}function Ut(e){return e.toLowerCase()}function jt(e){return Ci.test(e)}function jn(e){return Ut(e.address)===Uo}function qn(e){return`${Ni}${e.toLowerCase()}`}function Tt(e){if(typeof window>"u")return[];try{let t=window.localStorage.getItem(qn(e));if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(o=>o!==null&&typeof o=="object"&&jt(o.address)&&typeof o.updatedAt=="number").slice(0,jo):[]}catch{return[]}}function Zn(e,t){if(typeof window>"u")return[];let n=Ut(t),o=[{address:n,updatedAt:Date.now()},...Tt(e).filter(r=>r.address!==n)].slice(0,jo);try{window.localStorage.setItem(qn(e),JSON.stringify(o))}catch{return Tt(e)}return o}function Kn(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(qn(e))}catch{}}function Yn(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 i=BigInt(o||"0"),a=r.padEnd(t,"0"),c=a?BigInt(a):0n,d=10n**BigInt(t),l=i*d+c;return l<=0n?{error:"Amount must be greater than 0."}:{value:l}}function Qn(e,t){let n=BigInt(e||"0"),o=10n**BigInt(t),r=n/o,i=n%o;if(i===0n)return r.toString();let a=Li(i.toString().padStart(t,"0"));return`${r.toString()}.${a}`}function Xn(e,t){let n=e.replace(/^0x/,"").toLowerCase().padStart(64,"0"),o=t.toString(16).padStart(64,"0");return`${ki}${n}${o}`}var Ri=2000000000n,Ei=1000000000n;async function mn(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 un(e){return BigInt(e)}function Ti(e){return`0x${e.toString(16)}`}function Pi(e){let t={to:e.to};return e.from&&(t.from=e.from),e.value!==void 0&&e.value>0n&&(t.value=Ti(e.value)),e.data&&(t.data=e.data),t}function Ii(e){return e===56||e===97}async function qo(e){try{let t=await mn(e,"eth_gasPrice",[]);return{gasPrice:un(t)}}catch{return{gasPrice:Ri}}}async function Si(e,t){let n=Ei;try{let o=await mn(e,"eth_maxPriorityFeePerGas",[]);n=un(o)}catch{}return{maxFeePerGas:t+n,maxPriorityFeePerGas:n}}async function Mi(e,t){if(t)return qo(e);let n;try{n=(await mn(e,"eth_getBlockByNumber",["latest",!1]))?.baseFeePerGas}catch{}return n?Si(e,un(n)):qo(e)}async function Zo(e,t){let n=Ii(t.chainId),o=Pi(t),[r,i]=await Promise.all([mn(e,"eth_estimateGas",[o]),Mi(e,n)]);return{gasLimit:un(r),gasPrice:i.gasPrice,maxFeePerGas:i.maxFeePerGas,maxPriorityFeePerGas:i.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;min-width:100px;color:var(--wi-texticon-tertiary);font-size:13px;line-height:1.3;white-space:nowrap}.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)}
|
|
5
|
+
`);O("");import{jsx as Dn}from"react/jsx-runtime";function yo({env:e,theme:t="dark",mobileBreakpoint:n=768,domain:o,children:r}){let i=Lt(`(max-width: ${n}px)`),[a,c]=Rt.useState(!1),d=Rt.useCallback(()=>c(!1),[]),l=ge(e),s=Rt.useMemo(()=>({env:l,theme:t,isMobile:i,open:a,domain:o,close:d}),[l,t,i,a,o,d]);return Dn(Fn.Provider,{value:s,children:i?Dn(ai.Root,{direction:"right",open:a,onOpenChange:c,noBodyStyles:!0,children:r},"drawer"):Dn(vo.Root,{open:a,onOpenChange:c,children:r},"popover")})}import*as Lo from"@radix-ui/react-popover";import{Drawer as li}from"vaul";import{jsx as we,jsxs as si}from"react/jsx-runtime";function ko({size:e=18}){return si("svg",{className:"al-trigger-icon",width:e,height:e,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[we("rect",{width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"7",width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"14",width:"4",height:"4",fill:"currentColor"}),we("rect",{y:"7",width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"7",y:"7",width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"14",y:"7",width:"4",height:"4",fill:"currentColor"}),we("rect",{y:"14",width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"7",y:"14",width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"14",y:"14",width:"4",height:"4",fill:"currentColor"})]})}function Co(){return we("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:we("path",{d:"M12 19L5 12M5 12L12 5M5 12H19",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function No(){return we("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:we("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as sn}from"react/jsx-runtime";function Ro({asChild:e,children:t}){let{isMobile:n,theme:o}=an(),r=t!=null,i=e??!0,a=r?t:sn("button",{type:"button",className:"al-trigger-btn","data-theme":o,children:sn(ko,{size:n?12:18})});return n?sn(li.Trigger,{asChild:i,children:a}):sn(Lo.Trigger,{asChild:i,children:a})}import*as wt from"react";import*as cn from"@radix-ui/react-popover";import{Drawer as Et}from"vaul";import{useQuery as pi}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 ci="https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",di="https://contents.crosstoken.io/frontend/common/app-launcher/icons";function Oe(e,t){return`${e==="production"?di:ci}/${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 ln(e){let t=ge(e);return pi({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 oe,jsxs as Gt}from"react/jsx-runtime";function Io({align:e="end",sideOffset:t=12,className:n}){let{env:o,theme:r,isMobile:i,domain:a,close:c}=an(),{data:d}=ln(o),l=wt.useMemo(()=>(d?.items??[]).sort((h,P)=>h.order-P.order),[d]),s=8,u=wt.useRef(null),k=wt.useCallback(h=>{u.current={x:h.clientX,y:h.clientY}},[]),x=typeof window<"u"?window.location.pathname:"",g=wt.useCallback((h,P)=>{if(u.current){let N=h.clientX-u.current.x,H=h.clientY-u.current.y;if(u.current=null,Math.abs(N)>s||Math.abs(H)>s)return}let A=P.url[o]??P.url.production,S=Po(A,a);if(!S)try{let N=new URL(A).pathname;if(x===N||x.startsWith(N+"/")){c();return}}catch{}S?window.open(A,"_blank","noopener,noreferrer"):window.location.href=A,c()},[o,a,c,x]),w=oe("div",{className:"al-grid","data-theme":r,children:l.map(h=>{let P=h.url[o]??h.url.production,A=Po(P,a),S=!1;if(!A)try{let N=new URL(P).pathname;S=x===N||x.startsWith(N+"/")}catch{S=!1}return Gt("button",{type:"button",className:"al-grid-item","data-active":S||void 0,onPointerDown:k,onClick:N=>g(N,h),children:[Gt("div",{className:"al-grid-item-left",children:[oe("div",{className:"al-grid-item-icon",children:oe("img",{src:h.iconUrl,alt:h.label,width:24,height:24,loading:"lazy"})}),oe("span",{className:"al-grid-item-label",children:h.label}),h.isNew&&oe("span",{className:"al-badge-new",children:"N"})]}),oe("div",{className:"al-grid-item-right",children:h.badge&&oe("span",{className:"al-badge",children:h.badge})})]},h.id)})});return i?Gt(Et.Portal,{children:[oe(Et.Overlay,{className:"al-drawer-overlay"}),Gt(Et.Content,{className:K("al-drawer-content",n),"data-theme":r,children:[Gt("div",{className:"al-drawer-header",children:[oe(Et.Close,{className:"al-drawer-close",children:oe(Co,{})}),oe(Et.Title,{className:"al-drawer-title",children:"CROSS Services"}),oe(Et.Close,{className:"al-drawer-close",children:oe(No,{})})]}),oe("div",{className:"al-drawer-body",children:w})]})]}):oe(cn.Portal,{children:oe(cn.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 ce from"react";import*as Br from"@radix-ui/react-popover";import{Drawer as Za}from"vaul";import{createContext as mi,useContext as ui}from"react";var Wn=mi(null);function et(){let e=ui(Wn);if(!e)throw new Error("WalletInfo compound components must be used within <WalletInfo>");return e}var Bn=(o=>(o.CROSSx="crossx",o.MetaMask="io.metamask",o.Binance="com.binance.wallet",o))(Bn||{}),dn={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 R from"react";import ht from"bignumber.js";function fi(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 xt(e,t){if(!e||e==="0")return"0.00";let n=new ht(e).shiftedBy(-t),o=n.isGreaterThanOrEqualTo(1)?2:4;return n.toFormat(o,ht.ROUND_DOWN)}function Ce(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}function $n(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 ht(e).shiftedBy(-t).multipliedBy(new ht(n));return r.isZero()||r.isNaN()?"$0.00":`$${(r.integerValue(ht.ROUND_DOWN).isGreaterThanOrEqualTo(1)?r.decimalPlaces(2,ht.ROUND_DOWN):r.decimalPlaces(4,ht.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 a=Number(n);if(!Number.isFinite(a)||a===0)return{displayValue:"0",isLowerBound:!1};n=fi(a.toFixed(18))}let[o="0",r=""]=n.split(".");if(Number(o)>=1){let a=r.slice(0,2).padEnd(2,"0");return{displayValue:`${Number(o).toLocaleString("en-US")}.${a}`,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 Ne={dev:"https://stg-wallet-server.crosstoken.io/api",stage:"https://stg-wallet-server.crosstoken.io/api",production:"https://wallet-server.crosstoken.io/api"},me={dev:{cross:612044,bsc:97},stage:{cross:612044,bsc:97},production:{cross:612055,bsc:56}};var Vn={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 Hn(e,t){let n=me[e];if(t===n.cross)return _o.cross;if(t===n.bsc)return _o.bsc}var gi={dev:"https://dev-portrait.crosstoken.io",stage:"https://dev-portrait.crosstoken.io",production:"https://portrait.crosstoken.io"};function bt(e,t,n={}){if(!t||!t.startsWith("0x"))return;let{size:o=120,bg:r,format:i="png"}=n,a=gi[e],c=r?`&bg=${r}`:"";return`${a}/portrait/evm/${t}.${i}?size=${o}${c}`}import{jsx as G,jsxs as pn}from"react/jsx-runtime";function Ao({size:e=16,className:t}){return pn("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[G("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"}),G("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 Gn({size:e=16,className:t}){return G("svg",{width:e,height:e,viewBox:"4 4 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:G("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 zt({size:e=16,className:t}){return G("svg",{width:e,height:e,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:G("path",{d:"M11.6667 3.5L5.25 9.91667L2.33334 7",stroke:"currentColor",strokeWidth:1.16667,strokeLinecap:"round",strokeLinejoin:"round"})})}function zn({size:e=24,className:t}){return G("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:G("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function Oo({size:e=20,className:t}){return pn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[G("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"}),G("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 Fo({size:e=20,className:t}){return G("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,children:G("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 G("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:G("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 G("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:G("path",{d:"M8 5L13 10L8 15",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function Bo({size:e=20,className:t}){return G("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:G("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function $o({size:e=16,className:t}){return pn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[G("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"}),G("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 pn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[G("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"}),G("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 G("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 42 42",fill:"none",className:t,children:G("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 wi}from"react";import{useQuery as hi}from"@tanstack/react-query";var xi="send:chain-info";function bi(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 Un(e,...t){let n=e.replace(/\/+$/,""),o=t.map(r=>r.replace(/^\/+|\/+$/g,"")).filter(Boolean);return[n,...o].join("/")}function vi(e,t,n,o){if(o)return t===me[e].cross?Go(t,o):n?.explorer_url?Un(n.explorer_url,n.explorer_postfix?.transaction??"tx",o):yi(e,t,o)}function Go(e,t){return Un("https://explorer.crosstoken.io",String(e),"tx",t)}function yi(e,t,n){let o=me[e];if(t===o.cross)return Go(t,n);if(t===o.bsc)return Un(e==="production"?"https://bscscan.com":"https://testnet.bscscan.com","tx",n)}function zo(e,t,n,o=!0){let r=Ne[e],i=hi({queryKey:[xi,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 bi(s)},enabled:o,staleTime:300*1e3}),a=i.data;return{transactionUrl:wi(()=>vi(e,t,a,n),[t,a,e,n]),chainInfo:a,...i}}var Uo="0x0000000000000000000000000000000000000001";var ki="0xa9059cbb",Ci=/^0x[a-fA-F0-9]{40}$/,Ni="nexus-cross:dapp-ui:send:recent:",jo=10;function Li(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return e.slice(0,t)}function Ut(e){return e.toLowerCase()}function jt(e){return Ci.test(e)}function jn(e){return Ut(e.address)===Uo}function qn(e){return`${Ni}${e.toLowerCase()}`}function Tt(e){if(typeof window>"u")return[];try{let t=window.localStorage.getItem(qn(e));if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(o=>o!==null&&typeof o=="object"&&jt(o.address)&&typeof o.updatedAt=="number").slice(0,jo):[]}catch{return[]}}function Zn(e,t){if(typeof window>"u")return[];let n=Ut(t),o=[{address:n,updatedAt:Date.now()},...Tt(e).filter(r=>r.address!==n)].slice(0,jo);try{window.localStorage.setItem(qn(e),JSON.stringify(o))}catch{return Tt(e)}return o}function Kn(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(qn(e))}catch{}}function Yn(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 i=BigInt(o||"0"),a=r.padEnd(t,"0"),c=a?BigInt(a):0n,d=10n**BigInt(t),l=i*d+c;return l<=0n?{error:"Amount must be greater than 0."}:{value:l}}function Qn(e,t){let n=BigInt(e||"0"),o=10n**BigInt(t),r=n/o,i=n%o;if(i===0n)return r.toString();let a=Li(i.toString().padStart(t,"0"));return`${r.toString()}.${a}`}function Xn(e,t){let n=e.replace(/^0x/,"").toLowerCase().padStart(64,"0"),o=t.toString(16).padStart(64,"0");return`${ki}${n}${o}`}var Ri=2000000000n,Ei=1000000000n;async function mn(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 un(e){return BigInt(e)}function Ti(e){return`0x${e.toString(16)}`}function Pi(e){let t={to:e.to};return e.from&&(t.from=e.from),e.value!==void 0&&e.value>0n&&(t.value=Ti(e.value)),e.data&&(t.data=e.data),t}function Ii(e){return e===56||e===97}async function qo(e){try{let t=await mn(e,"eth_gasPrice",[]);return{gasPrice:un(t)}}catch{return{gasPrice:Ri}}}async function Si(e,t){let n=Ei;try{let o=await mn(e,"eth_maxPriorityFeePerGas",[]);n=un(o)}catch{}return{maxFeePerGas:t+n,maxPriorityFeePerGas:n}}async function Mi(e,t){if(t)return qo(e);let n;try{n=(await mn(e,"eth_getBlockByNumber",["latest",!1]))?.baseFeePerGas}catch{}return n?Si(e,un(n)):qo(e)}async function Zo(e,t){let n=Ii(t.chainId),o=Pi(t),[r,i]=await Promise.all([mn(e,"eth_estimateGas",[o]),Mi(e,n)]);return{gasLimit:un(r),gasPrice:i.gasPrice,maxFeePerGas:i.maxFeePerGas,maxPriorityFeePerGas:i.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;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;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;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;min-width:100px;color:var(--wi-texticon-tertiary);font-size:13px;line-height:1.3;white-space:nowrap}.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
6
|
`);import{Fragment as Gi,jsx as f,jsxs as v}from"react/jsx-runtime";var _i=1500,Ai=120;function Jn(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 Oi(e){return new Promise(t=>setTimeout(t,e))}function Fi(e){let{status:t}=e;return t==="reverted"||t==="0x0"||t===0||t===0n||t===!1}function Di(e){return!!(e.token||e.recipient||e.amount)}function no(e,t,n=10){if(t<=0)return e.toString();let o=10n**BigInt(t),r=e/o,i=e%o;if(i===0n)return r.toString();let c=i.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 eo(e,t){return no(e,t,6)}function to(e){return no(e,9,2)}function Wi(e){return e.toLocaleString("en-US")}function Bi(e){return e.maxFeePerGas!==void 0?"dynamic":e.gasPrice!==void 0?"legacy":null}function $i(e){return e.maxFeePerGas!==void 0?e.gasLimit*e.maxFeePerGas:e.gasPrice!==void 0?e.gasLimit*e.gasPrice:null}function Vi(){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 Hi(){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 fn({env:e,theme:t="dark",walletAddress:n,accountName:o,accounts:r=[],token:i,tokens:a=[],onTokenChange:c,sendTransaction:d,getTransactionReceipt:l,estimateGas:s,onSuccess:u,onConfirmSuccess:k,onOutlink:x}){let[g,w]=R.useState(""),[h,P]=R.useState(""),[A,S]=R.useState(""),[N,H]=R.useState({}),[y,T]=R.useState(""),[$,C]=R.useState(!1),[U,q]=R.useState(!1),[xe,at]=R.useState(!1),[ae,$e]=R.useState("account"),Le=R.useRef(void 0),Y=R.useRef(void 0),Ze=R.useRef(null),Ke=R.useRef(null),[ue,Ye]=R.useState(()=>Tt(n)),[be,X]=R.useState("idle"),[Z,Me]=R.useState(null),[se,_e]=R.useState(!1),[ve,pe]=R.useState(""),ye=R.useRef(0),[J,Re]=R.useState(null),[te,st]=R.useState(""),ke=jn(i),Qe=R.useMemo(()=>BigInt(i.quantity.numeric||"0"),[i.quantity.numeric]),Ve=R.useMemo(()=>xt(i.quantity.numeric,i.quantity.decimals),[i.quantity.numeric,i.quantity.decimals]),He=R.useMemo(()=>r.filter(m=>m.address.toLowerCase()!==n.toLowerCase()),[r,n]),lt=R.useMemo(()=>{let m=new Map;return He.forEach((L,M)=>{m.set(L.address.toLowerCase(),{account:L,index:M})}),m},[He]),Ee=He.length>0,Ge=R.useMemo(()=>ge(e),[e]),Te=t==="dark"?"1A1A2E":"F3F6F8",Xe=a.length>0?a:[i],ze=Xe.length>1&&!!c,{transactionUrl:Pe,chainInfo:fe}=zo(Ge,i.chainId,y||void 0,!0),ct=fe?.currency_symbol??"",Je=fe?.name??`Chain ID ${i.chainId}`;R.useEffect(()=>{S(""),H({}),T(""),X("idle"),Me(null),pe(""),_e(!1),ye.current+=1},[i.address,i.chainId,g,h]),R.useEffect(()=>{P(""),C(!1)},[i.address,i.chainId]),R.useEffect(()=>{Ye(Tt(n))},[n]),R.useEffect(()=>()=>{clearTimeout(Le.current),clearTimeout(Y.current)},[]),R.useEffect(()=>{!Ee&&ae==="account"&&$e("recent")},[ae,Ee]),R.useEffect(()=>{let m=window.visualViewport,L=Ze.current;if(!m||!L)return;let M=()=>{let le=document.activeElement;return L.contains(le)&&(le instanceof HTMLInputElement||le instanceof HTMLTextAreaElement)},I=48,V=()=>{L.style.paddingBottom=""},ne=()=>{if(!M()){V();return}let le=Math.max(0,window.innerHeight-m.height-m.offsetTop);le>0?L.style.paddingBottom=`${le+I}px`:V();let ut=document.activeElement;ut instanceof HTMLElement&&requestAnimationFrame(()=>{let $t=ut.getBoundingClientRect(),on=L.getBoundingClientRect().bottom-le-I,Ht=$t.bottom-on;Ht>0&&L.scrollBy({top:Ht,behavior:"smooth"})})},mt=()=>{setTimeout(()=>{M()||V()},0)};return m.addEventListener("resize",ne),window.addEventListener("resize",ne),L.addEventListener("focusout",mt),()=>{m.removeEventListener("resize",ne),window.removeEventListener("resize",ne),L.removeEventListener("focusout",mt),V()}},[]);let Ae=R.useCallback(()=>{clearTimeout(Y.current),Y.current=setTimeout(()=>{Ke.current?.scrollIntoView({behavior:"smooth",block:"nearest"})},10)},[]),_n=R.useCallback(()=>{P(Qn(i.quantity.numeric,i.quantity.decimals))},[i.quantity.numeric,i.quantity.decimals]),Jt=R.useCallback(m=>{w(m),q(!1)},[]),en=R.useCallback(()=>{let m={},L=g.trim(),M=Yn(h,i.quantity.decimals),I;return L?jt(L)||(m.recipient="Enter a valid EVM recipient address."):m.recipient="Enter a recipient address.","error"in M?m.amount=M.error:(I=M.value,I>Qe&&(m.amount="Amount exceeds available balance.")),!ke&&!jt(i.address)&&(m.token="Token contract address is invalid."),{errors:m,rawAmount:I,trimmedRecipient:L}},[h,Qe,ke,g,i.address,i.quantity.decimals]),tn=R.useCallback(async()=>{if(y)try{await navigator.clipboard.writeText(y),at(!0),clearTimeout(Le.current),Le.current=setTimeout(()=>at(!1),2e3)}catch{}},[y]),dt=R.useCallback(()=>{if(!Pe||!y)return;let m=I=>{typeof window>"u"||window.open(I,"_blank","noopener,noreferrer")};if(!x){m(Pe);return}let L=x(Pe,{category:"send",origin:"send-transaction",payload:{chainId:i.chainId,txHash:y}});if(L&&(typeof L=="object"||typeof L=="function")&&typeof L.then=="function"){let I=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null;L.then(V=>{if(V===null){I?.close();return}let ne=V??Pe;if(I)try{I.location.href=ne}catch{I.close(),m(ne)}else m(ne)});return}let M=L;M!==null&&m(M??Pe)},[x,i.chainId,Pe,y]),pt=R.useCallback((m,L)=>ke?{to:m,value:L,chainId:i.chainId,from:n}:{to:Ut(i.address),data:Xn(m,L),value:0n,chainId:i.chainId,from:n},[ke,i.address,i.chainId,n]),Ct=R.useCallback(async(m,L,M)=>{if(!s&&!M)return;let I=++ye.current;_e(!0),pe("");try{let V=pt(m,L),ne=s?await s(V):await Zo(M,V);if(ye.current!==I)return;Me(ne)}catch(V){if(ye.current!==I)return;pe(V instanceof Error?V.message:"Failed to estimate gas.")}finally{ye.current===I&&_e(!1)}},[pt,s]),nn=R.useCallback(m=>{if(m.preventDefault(),S(""),T(""),!d){X("error"),S("Sending is not available for this wallet.");return}let{errors:L,rawAmount:M,trimmedRecipient:I}=en();if(H(L),Di(L)||M===void 0){X("error");return}let V=I;Re(M),st(V),Me(null),pe(""),X("review")},[d,en]);R.useEffect(()=>{be==="review"&&(!te||J===null||Z===null&&(se||ve||!s&&!fe?.rpc||Ct(te,J,fe?.rpc)))},[fe?.rpc,s,Ct,Z,ve,se,J,te,be]);let Wt=R.useCallback(async()=>{if(!(!d||!te||J===null)){S(""),T("");try{X("submitting");let m=await d(pt(te,J));if(T(m),X("confirming"),Ye(Zn(n,te)),u?.(m),!l){X("success");return}for(let L=0;L<Ai;L+=1){let M=await l({hash:m,chainId:i.chainId}).catch(()=>null);if(M){if(Fi(M)){X("error"),S("Transaction reverted on-chain.");return}X("success");return}await Oi(_i)}X("error"),S("Transaction receipt was not found. Please check again later.")}catch(m){X("error"),S(m instanceof Error?m.message:"Failed to send transaction.")}}},[pt,l,u,J,te,d,i.chainId,n]),An=R.useCallback(()=>{ye.current+=1,Me(null),pe(""),_e(!1),S(""),X("idle")},[]),Bt=Qe<=0n||!g.trim()||!h.trim();if(be==="review"||be==="submitting"){let m=be==="submitting",L=J!==null?no(J,i.quantity.decimals):h.trim(),M=o?.trim()||`Account ${(r[0]?.index??0)+1}`,I="\u2014",V=ct||(ke?i.symbol:""),ne=fe?.currency_decimals??(ke?i.quantity.decimals:18),mt=Z?Bi(Z):null,le=Z?$i(Z):null,ut=le!==null&&V?`${eo(le,ne)} ${V}`:I,$t=Z?Wi(Z.gasLimit):I,Vt=Z?.maxPriorityFeePerGas!==void 0?`${to(Z.maxPriorityFeePerGas)} Gwei`:I,on=Z?.maxFeePerGas!==void 0?`${to(Z.maxFeePerGas)} Gwei`:I,Ht=Z?.gasPrice!==void 0?`${to(Z.gasPrice)} Gwei`:I,xo=`${L} ${i.symbol}`,rn=(()=>{if(!Z||le===null)return I;if(ke&&J!==null){let Nt=J+le;return`${eo(Nt,ne)} ${V||i.symbol}`}return V?`${eo(le,ne)} ${V}`: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:[f("img",{className:"send-review-amount-icon",src:i.icon_url,alt:"",width:32,height:32,draggable:!1,onError:Nt=>{Nt.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),v("span",{className:"send-review-amount-value",children:[L," ",i.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:M}),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}),Je]})]}),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:se?"\u2026":ut})]}),mt==="dynamic"?v(Gi,{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:se?"\u2026":Vt})]}),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:se?"\u2026":on})]})]}):mt==="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:se?"\u2026":Ht})]}):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:se?"\u2026":$t})]})]}),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:se?"\u2026":rn})]})]}),ve&&f("div",{className:"send-message send-message--error",role:"alert",children:ve}),A&&f("div",{className:"send-message send-message--error",role:"alert",children:A})]}),v("div",{className:"send-footer send-footer--review",children:[f("button",{type:"button",className:"send-review-btn send-review-btn--cancel",onClick:An,disabled:m,children:"Cancel"}),f("button",{type:"button",className:"send-review-btn send-review-btn--confirm",onClick:Wt,disabled:m,children:m?"Sending...":"Send"})]})]})}if((be==="confirming"||be==="success")&&y){let m=be==="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(Hi,{}):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:dt,"aria-label":"Open transaction in explorer",children:Ce(y)}),f("button",{type:"button",className:"send-success-copy-btn",onClick:tn,"aria-label":"Copy transaction hash",children:xe?f(zt,{size:16}):"Copy"})]})]})]}),f("div",{className:"send-footer",children:f("button",{type:"button",className:"send-submit-btn",onClick:k,disabled:!m,children:m?"All done":"Sending..."})})]})}return v("form",{className:"send-page",onSubmit:nn,children:[v("div",{className:"send-scroll","data-vaul-no-drag":!0,ref:Ze,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:()=>{ze&&C(m=>!m)},disabled:!ze,"aria-expanded":ze?$:void 0,children:[v("span",{className:"send-asset-left",children:[f("img",{className:"send-asset-icon",src:i.icon_url,alt:i.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:i.symbol}),f("span",{className:"send-asset-name",children:i.name})]})]}),v("span",{className:"send-asset-balance",children:[f("span",{className:"send-balance-label",children:"Available"}),v("span",{className:"send-balance-value",children:[Ve," ",i.symbol]})]})]}),ze&&$&&f("div",{className:"send-token-list",role:"listbox",children:Xe.map(m=>{let L=Jn(m)===Jn(i);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:M=>{M.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:xt(m.quantity.numeric,m.quantity.decimals)})]},Jn(m))})}),N.token&&f("p",{className:"send-field-error",role:"alert",children:N.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":N.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":!!N.recipient,"aria-describedby":N.recipient?"send-recipient-error":void 0}),f("button",{type:"button",className:"send-address-book-btn",onClick:()=>q(m=>!m),"aria-label":"Open address book","aria-expanded":U,children:f(Vi,{})})]}),N.recipient&&f("p",{id:"send-recipient-error",className:"send-field-error",role:"alert",children:N.recipient}),U&&v("div",{className:"send-address-picker",children:[v("div",{className:"send-address-tabs",role:"tablist",children:[Ee&&f("button",{type:"button",role:"tab",className:"send-address-tab","data-active":ae==="account"||void 0,"aria-selected":ae==="account",onClick:()=>$e("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:()=>$e("recent"),children:"Recent"})]}),Ee&&ae==="account"?f("div",{className:"send-address-list",children:He.map((m,L)=>{let M=Ko(m,L),I=bt(Ge,m.address,{size:56,bg:Te});return v("button",{type:"button",className:"send-address-option",onClick:()=>Jt(m.address),children:[v("span",{className:"send-address-avatar","aria-hidden":!0,children:[I&&f("img",{className:"send-address-avatar-img",src:I,alt:"",width:36,height:36,draggable:!1,onError:V=>{V.currentTarget.style.display="none"}}),f("span",{className:"send-address-avatar-fallback",children:Yo(M)})]}),v("span",{className:"send-address-copy",children:[f("span",{className:"send-address-name",children:M}),f("span",{className:"send-address-value",children:Ce(m.address)})]})]},m.address)})}):ue.length>0?f("div",{className:"send-address-list",children:ue.map(m=>{let L=lt.get(m.address.toLowerCase()),M=L?Ko(L.account,L.index):void 0,I=bt(Ge,m.address,{size:56,bg:Te});return v("button",{type:"button",className:"send-address-option",onClick:()=>Jt(m.address),children:[v("span",{className:"send-address-avatar","aria-hidden":!0,children:[I&&f("img",{className:"send-address-avatar-img",src:I,alt:"",width:36,height:36,draggable:!1,onError:V=>{V.currentTarget.style.display="none"}}),f("span",{className:"send-address-avatar-fallback",children:M?Yo(M):m.address.slice(2,4).toUpperCase()})]}),v("span",{className:"send-address-copy",children:[f("span",{className:"send-address-name",children:M??Ce(m.address)}),f("span",{className:"send-address-value",children:L?Ce(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:_n,disabled:Qe<=0n,children:"Max"})]}),v("div",{className:"send-amount-wrap","data-invalid":N.amount||void 0,children:[f("input",{ref:Ke,className:"send-input send-input--amount",value:h,onChange:m=>P(m.target.value),onFocus:Ae,placeholder:"0.00",inputMode:"decimal",autoComplete:"off","aria-labelledby":"send-amount-label","aria-invalid":!!N.amount,"aria-describedby":N.amount?"send-amount-error":void 0}),f("span",{className:"send-amount-symbol",children:i.symbol})]}),N.amount&&f("p",{id:"send-amount-error",className:"send-field-error",role:"alert",children:N.amount})]}),v("div",{className:"send-meta",children:[f("span",{children:"From"}),f("span",{children:Ce(n)})]}),v("div",{className:"send-meta",children:[f("span",{children:"Network"}),v("span",{children:["Chain ID ",i.chainId]})]}),A&&f("div",{className:"send-message send-message--error",role:"alert",children:A})]}),f("div",{className:"send-footer",children:f("button",{type:"submit",className:"send-submit-btn","data-disabled":Bt||void 0,"aria-disabled":Bt,children:"Send"})})]})}import*as Qo from"@radix-ui/react-popover";import{Drawer as zi}from"vaul";import{jsx as gn,jsxs as Ui}from"react/jsx-runtime";function Xo({asChild:e,className:t,children:n}){let{isMobile:o,theme:r,walletAddress:i}=et(),a=n!=null,c=e??!0,d=a?n:Ui("button",{type:"button",className:K("wi-trigger-btn",t),"data-theme":r,"data-mobile":o||void 0,children:[gn(Ao,{size:o?14:16}),gn("span",{className:"wi-trigger-address",children:Ce(i)})]});return o?gn(zi.Trigger,{asChild:c,children:d}):gn(Qo.Trigger,{asChild:c,children:d})}import*as B from"react";import*as Cn from"@radix-ui/react-popover";import{Drawer as kn}from"vaul";import Kt from"bignumber.js";import{useQueries as ji}from"@tanstack/react-query";import{useMemo as qi}from"react";var oo="user-balance";async function Zi(e,t,n,o){let r=new URLSearchParams({networkId:`eip155:${t}`,account:n}),i=await fetch(`${e}/v1/public/token/balance?${r}`,{cache:"no-store",signal:o});if(!i.ok)throw new Error(`Failed to fetch token balance: ${i.status}`);let a=await i.json();if(a.code!==200)throw new Error(`Token balance API error: ${a.code}`);return a.data}function Pt(e,t,n=!0){let o=Ne[e],r=me[e],i=[r.cross,r.bsc],a=ji({queries:i.map(s=>({queryKey:[oo,e,t,s],queryFn:({signal:u})=>Zi(o,s,t,u),enabled:!!t&&n,staleTime:0,refetchInterval:n?5e3:!1}))}),c=a.some(s=>s.isLoading),d=a.some(s=>s.isError);return{tokens:qi(()=>{let s=[];for(let u of a)u.data&&s.push(...u.data);return s},[a]),isLoading:c,isError:d}}import{useQuery as Ki,useQueries as Yi}from"@tanstack/react-query";import{useMemo as Qi}from"react";var Xi="forge-holdings",Ji="forge-token-image";async function ea(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 ta(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=Vn[e],{data:r,...i}=Ki({queryKey:[Xi,e,t],queryFn:({signal:a})=>ea(o,t,a),enabled:!!t&&n,staleTime:0,refetchInterval:n?5e3:!1});return{holdings:r??[],...i}}function er(e,t,n=!0){let o=Vn[e],r=Yi({queries:t.map(a=>({queryKey:[Ji,e,a],queryFn:({signal:c})=>ta(o,a,c),enabled:n,staleTime:1/0}))});return{imageMap:Qi(()=>{let a=new Map;for(let c of r)c.data&&a.set(c.data.address,c.data.image_url);return a},[r])}}import{useQuery as na}from"@tanstack/react-query";import{useMemo as oa}from"react";var ro="token-stats";function vt(e,t){return`${e}:${t.toLowerCase()}`}function It(e,t=!0){let n=Ne[e],{data:o,...r}=na({queryKey:[ro,e],queryFn:async({signal:a})=>{let c=await fetch(`${n}/v1/public/token/stats`,{cache:"no-store",signal:a});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:oa(()=>{let a=new Map;if(!o?.data)return a;for(let c of o.data){let d=vt(c.chain_id,c.address);a.set(d,c)}return a},[o]),...r}}import{useQuery as ra}from"@tanstack/react-query";import{useMemo as ia}from"react";var aa="token-info";function io(e,t){return`${t.toLowerCase()}_${e}`}function tr(e,t=!0){let n=Ne[e],{data:o,...r}=ra({queryKey:[aa,e],queryFn:async({signal:a})=>{let c=await fetch(`${n}/v1/public/token/info`,{cache:"no-store",signal:a});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:ia(()=>{let a=new Map;if(!o?.data)return a;for(let c of o.data){let d=io(c.chain_id,c.address);a.set(d,c.category)}return a},[o]),...r}}import{useMemo as sa}from"react";import ao from"bignumber.js";function nr(e,t,n){let{tokens:o,isLoading:r}=Pt(e,t,n),{statsMap:i}=It(e,n);return sa(()=>{let a=new ao(0);for(let s of o){let u=i.get(vt(s.chainId,s.address));if(!u)continue;let x=new ao(s.quantity.numeric).shiftedBy(-s.quantity.decimals).multipliedBy(new ao(u.price));x.isNaN()||(a=a.plus(x))}let c=a.toFixed(),{displayValue:d,isLowerBound:l}=Mo(c);return{totalUsd:c,displayValue:d,isLowerBound:l,isLoading:r}},[o,i,r])}import{QRCodeSVG as za}from"qrcode.react";function Fe(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 i=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 k=u??t;if(l)try{l.location.href=k}catch{l.close(),i(k)}else i(k)};r.then(s,u=>{console.error("[dapp-ui] onOutlink rejected:",u),l?.close()});return}let c=r;if(c===null)return;i(c??t)}import*as kt from"react";import{Drawer as Ha}from"vaul";import{createContext as la,useContext as ca}from"react";var qt=la(null);function re(){let e=ca(qt);if(!e)throw new Error("WalletPortfolio compound components must be used within <WalletPortfolio>");return e}import{Drawer as da}from"vaul";import{jsx as or}from"react/jsx-runtime";function rr({asChild:e,children:t}){let{walletAddress:n}=re(),o=t!=null,r=e??!0,i=o?t:or("button",{type:"button",children:Ce(n)});return or(da.Trigger,{asChild:r,children:i})}import{Drawer as yn}from"vaul";import*as Se from"react";import{useQueryClient as Ba}from"@tanstack/react-query";import{useMemo as wa}from"react";import so from"bignumber.js";import{useQuery as pa}from"@tanstack/react-query";import{useMemo as sr}from"react";var wn={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"},ir={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},hn={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"},tt={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},De={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"},ar={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 ma="wp:reward-pools";function xn(e,t=!0){let n=wn[e],{data:o,...r}=pa({queryKey:[ma,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}),i=sr(()=>o?.data.pools.filter(c=>c.pool_type==="CrossPool")??[],[o]),a=sr(()=>o?.data.pools.filter(c=>c.pool_type==="GamePool")??[],[o]);return{crossPools:i,gamePools:a,allPools:o?.data.pools??[],...r}}import{useQuery as ua}from"@tanstack/react-query";import{useMemo as fa}from"react";var ga="wp:user-deposits";function bn(e,t,n=!0){let o=wn[e],r=n&&!!t,{data:i,...a}=ua({queryKey:[ga,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:fa(()=>{let d=new Map;if(!i?.data.user_deposits)return d;for(let l of i.data.user_deposits)d.set(l.pool_address.toLowerCase(),l);return d},[i]),deposits:i?.data.user_deposits??[],...a}}import{useQuery as lr}from"@tanstack/react-query";import{useMemo as cr}from"react";function We(e,t,n,o=!0){let r=ar[e][t],i=o&&!!n,{data:a,...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=a?.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)}),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 A=await P.json();if(A.code!==200)throw new Error(`open-order API error: ${A.code}`);return A.data?.data??[]},enabled:i,staleTime:0}),k=s??[],x=cr(()=>{let g=new Map;for(let w of k){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},[k]);return{allPairs:d,pairMap:l,orders:k,ordersByPair:x,isEmpty:k.length===0,isLoading:c.isLoading||u.isLoading}}var ha=["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}=xn(e,o),{depositMap:i}=bn(e,t,o),{allPairs:a,pairMap:c,ordersByPair:d}=We(e,"cross",t,o),{allPairs:l,pairMap:s,ordersByPair:u}=We(e,"crossd",t,o),{allPairs:k,pairMap:x,ordersByPair:g}=We(e,"forge",t,o);return wa(()=>{let w=new Map,h=new Map,P=(y,T)=>{!Number.isFinite(T)||T<=0||h.set(y,(h.get(y)??0)+T)};for(let y of r){let T=Number(y.deposit_token.price);T>0&&w.set(y.deposit_token.symbol,T);for(let $ of y.reward_tokens){let C=Number($.price);C>0&&w.set($.symbol,C)}}for(let y of[...a,...l,...k]){let T=w.get(y.quote_symbol),$=Number(y.billboard?.price);T&&$>0&&!w.has(y.base_symbol)&&w.set(y.base_symbol,$*T)}for(let y of r){let T=i.get(y.pool_address.toLowerCase());if(!T)continue;let $=new so(T.deposited_amount).shiftedBy(-y.deposit_token.decimals).toNumber();if(P(y.deposit_token.symbol,$),y.reward_tokens.length>0){let C=y.reward_tokens[0],U=new so(T.claimable_reward).shiftedBy(-C.decimals).toNumber();P(C.symbol,U)}}let A=[{pairMap:c,ordersByPair:d},{pairMap:s,ordersByPair:u},{pairMap:x,ordersByPair:g}];for(let{pairMap:y,ordersByPair:T}of A)for(let[$,C]of T){let U=y.get($);if(U){for(let q of C.buys){let xe=Number(q.amount)-Number(q.filled);P(U.quote_symbol,xe*Number(q.price))}for(let q of C.sells){let xe=Number(q.amount)-Number(q.filled);P(U.base_symbol,xe)}}}let S=[],N=0;for(let[y,T]of h){let $=w.get(y)??0,C=T*$;C>0&&(S.push({symbol:y,usdValue:C}),N+=C)}S.sort((y,T)=>T.usdValue-y.usdValue);let H=[];if(N>0){let y=S.slice(0,pr),T=S.slice(pr);for(let C=0;C<y.length;C++)H.push({symbol:y[C].symbol,usdValue:y[C].usdValue,percentage:Math.round(y[C].usdValue/N*100),color:ha[C]??dr});if(T.length>0){let C=T.reduce((U,q)=>U+q.usdValue,0);H.push({symbol:"Others",usdValue:C,percentage:Math.round(C/N*100),color:dr})}let $=H.reduce((C,U)=>C+U.percentage,0);$!==100&&H.length>0&&(H[0].percentage+=100-$)}return{totalUsd:N,formattedTotal:N>0?`$${new so(N).toFormat(2)}`:"$0.00",segments:H}},[r,i,a,c,d,l,s,u,k,x,g])}import{jsx as St,jsxs as xa}from"react/jsx-runtime";function ur({size:e=22,className:t}){return St("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:St("path",{d:"M14 4L7 11L14 18",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function fr({size:e=22,className:t}){return xa("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[St("path",{d:"M18.333 3.667v5.5h-5.5",stroke:"currentColor",strokeWidth:1.833,strokeLinecap:"round",strokeLinejoin:"round"}),St("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 St("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:St("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 ba}from"@tanstack/react-query";import{useMemo as va}from"react";var ya="wp:token-info";function nt(e,t=!0){let n=Ne[e],o=me[e].cross,{data:r,...i}=ba({queryKey:[ya,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:a,byChainSym:c}=va(()=>{let l=new Map,s=new Map;if(!r?.data)return{byChainAddr:l,byChainSym:s};for(let u of r.data){let k=u.address.toLowerCase();l.set(`${u.chain_id}:${k}`,u),l.set(k,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(),k=a.get(`${o}:${u}`);if(k?.image)return k.image;let x=a.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""},...i}}import{jsx as vn,jsxs as wr}from"react/jsx-runtime";function Be({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:[vn("img",{className:"wp-svc-card-icon",src:t,alt:"",style:{objectFit:n}}),vn("span",{className:"wp-svc-card-title",children:e})]}),o?vn("div",{className:"wp-svc-empty",children:"No assets yet"}):vn("div",{className:"wp-svc-items",children:r})]})}import Zt from"bignumber.js";import{jsx as yt,jsxs as Ue}from"react/jsx-runtime";var ka="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}=re(),o=!!t,{allPools:r}=xn(e,o),{depositMap:i}=bn(e,t,o),{getTokenImage:a}=nt(e,o),c=s=>`${ir[e]}/rewards/${s.pool_address}?action=withdraw`,d=`${De[e]}/reward.png`,l=r.filter(s=>{let u=i.get(s.pool_address.toLowerCase()),k=u?.deposited_amount??"0",x=u?.claimable_reward??"0";return!(new Zt(k).isZero()&&new Zt(x).isZero())});return yt(Be,{title:ka,icon:d,isEmpty:l.length===0,children:l.map(s=>{let u=i.get(s.pool_address.toLowerCase()),k=u?.deposited_amount??"0",x=c(s);return Ue("a",{className:"wp-item","data-side":"reward",href:x,target:"_blank",rel:"noopener noreferrer",onClick:g=>Fe(g,x,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:s,userDeposit:u}},n),children:[Ue("div",{className:"wp-item-body",children:[Ue("div",{className:"wp-item-field",children:[Ue("span",{className:"wp-item-label",children:["Deposited (",s.deposit_token.symbol,")"]}),Ue("div",{className:"wp-svc-token",children:[a(s.deposit_token.address,s.deposit_token.symbol)&&yt("img",{className:"wp-svc-token-icon",src:a(s.deposit_token.address,s.deposit_token.symbol),alt:""}),yt("span",{children:hr(k,s.deposit_token.decimals)})]})]}),Ue("div",{className:"wp-item-field",children:[Ue("span",{className:"wp-item-label",children:["Rewards (",s.reward_tokens.map(g=>g.symbol).join(", "),")"]}),s.reward_tokens.map(g=>{let w=a(g.address,g.symbol);return Ue("div",{className:"wp-svc-token",children:[w&&yt("img",{className:"wp-svc-token-icon",src:w,alt:""}),yt("span",{children:u?hr(u.claimable_reward,g.decimals):"0"})]},g.address)})]})]}),Ue("div",{className:"wp-item-badges",children:[yt("span",{className:"wp-badge wp-badge--mint",children:"Claim"}),yt("span",{className:"wp-badge wp-badge--muted",children:"Withdraw"})]})]},s.pool_address)})})}import vr from"bignumber.js";import{Fragment as Ca,jsx as he,jsxs as ie}from"react/jsx-runtime";function lo(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 lo(t.toString())}function Mt({market:e,pairMap:t,ordersByPair:n,getDexUrl:o,getTokenImage:r}){let{onOutlink:i}=re(),a=[];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):"",k=o(c);for(let x of d.buys)a.push(ie("a",{className:"wp-item","data-side":"buy",href:k,target:"_blank",rel:"noopener noreferrer",onClick:g=>Fe(g,k,{category:"portfolio",origin:"portfolio-dex-order",payload:{market:e,side:"buy",order:x,pair:l}},i),children:[ie("div",{className:"wp-item-body",children:[ie("div",{className:"wp-item-field",children:[ie("span",{className:"wp-item-label wp-item-label--buy",children:["Buy",l?.base_symbol?` (${l.base_symbol})`:""]}),ie("div",{className:"wp-svc-token",children:[s&&he("img",{className:"wp-svc-token-icon",src:s,alt:""}),he("span",{children:br(x)})]})]}),ie("div",{className:"wp-item-field",children:[ie("span",{className:"wp-item-label",children:["Price",l?.quote_symbol?` (${l.quote_symbol})`:""]}),ie("div",{className:"wp-svc-token",children:[u&&he("img",{className:"wp-svc-token-icon",src:u,alt:""}),he("span",{children:lo(x.price)})]})]})]}),he("div",{className:"wp-item-badges",children:he("span",{className:"wp-badge wp-badge--red",children:"Cancel"})})]},`buy-${x.order_id}`));for(let x of d.sells)a.push(ie("a",{className:"wp-item","data-side":"sell",href:k,target:"_blank",rel:"noopener noreferrer",onClick:g=>Fe(g,k,{category:"portfolio",origin:"portfolio-dex-order",payload:{market:e,side:"sell",order:x,pair:l}},i),children:[ie("div",{className:"wp-item-body",children:[ie("div",{className:"wp-item-field",children:[ie("span",{className:"wp-item-label wp-item-label--sell",children:["Sell",l?.base_symbol?` (${l.base_symbol})`:""]}),ie("div",{className:"wp-svc-token",children:[s&&he("img",{className:"wp-svc-token-icon",src:s,alt:""}),he("span",{children:br(x)})]})]}),ie("div",{className:"wp-item-field",children:[ie("span",{className:"wp-item-label",children:["Price",l?.quote_symbol?` (${l.quote_symbol})`:""]}),ie("div",{className:"wp-svc-token",children:[u&&he("img",{className:"wp-svc-token-icon",src:u,alt:""}),he("span",{children:lo(x.price)})]})]})]}),he("div",{className:"wp-item-badges",children:he("span",{className:"wp-badge wp-badge--red",children:"Cancel"})})]},`sell-${x.order_id}`))}return he(Ca,{children:a})}import{jsx as yr}from"react/jsx-runtime";var Na="Gametoken - CROSS";function kr(){let{env:e,walletAddress:t}=re(),n=!!t,{pairMap:o,ordersByPair:r,isEmpty:i}=We(e,"cross",t,n),{getTokenImage:a}=nt(e,n),c=l=>{let s=o.get(l.toLowerCase());return`${tt[e]}/gametoken/cross/${s?.base_symbol??""}`},d=`${De[e]}/dex.png`;return yr(Be,{title:Na,icon:d,isEmpty:i,children:yr(Mt,{market:"cross",pairMap:o,ordersByPair:r,getDexUrl:c,getTokenImage:a})})}import{jsx as Cr}from"react/jsx-runtime";var La="Gametoken - CROSSD";function Nr(){let{env:e,walletAddress:t}=re(),n=!!t,{pairMap:o,ordersByPair:r,isEmpty:i}=We(e,"crossd",t,n),{getTokenImage:a}=nt(e,n),c=l=>{let s=o.get(l.toLowerCase());return`${tt[e]}/gametoken/crossd/${s?.base_symbol??""}`},d=`${De[e]}/dex.png`;return Cr(Be,{title:La,icon:d,isEmpty:i,children:Cr(Mt,{market:"crossd",pairMap:o,ordersByPair:r,getDexUrl:c,getTokenImage:a})})}import{jsx as Lr}from"react/jsx-runtime";var Ra="Gametoken - Forge";function Rr(){let{env:e,walletAddress:t}=re(),n=!!t,{pairMap:o,ordersByPair:r,isEmpty:i}=We(e,"forge",t,n),{getTokenImage:a}=nt(e,n);if(i)return null;let c=l=>{let s=o.get(l.toLowerCase());return`${tt[e]}/gametoken/forge/${s?.base_symbol??""}`},d=`${De[e]}/dex.png`;return Lr(Be,{title:Ra,icon:d,isEmpty:i,children:Lr(Mt,{market:"forge",pairMap:o,ordersByPair:r,getDexUrl:c,getTokenImage:a})})}import co from"bignumber.js";import{useMemo as _a}from"react";import{useQuery as Ea}from"@tanstack/react-query";var Ta="wp:forge-pools";function Er(e,t,n=!0){let o=hn[e],r=n&&!!t,{data:i,...a}=Ea({queryKey:[Ta,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=i??[];return{pools:c,isEmpty:c.length===0,...a}}import{useQueries as Pa}from"@tanstack/react-query";import{useMemo as Ia}from"react";var Sa="wp:forge-token-detail";async function Ma(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=hn[e],r=Pa({queries:t.map(c=>({queryKey:[Sa,e,c],queryFn:()=>Ma(o,c),enabled:n&&!!c,staleTime:3e4}))}),i=Ia(()=>{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]),a=r.some(c=>c.isLoading);return{detailMap:i,isLoading:a}}import{jsx as Ie,jsxs as _t}from"react/jsx-runtime";var Aa="Forge",Oa=18,Fa="https://contents.crosstoken.io/wallet/token/images/FT.png";function Da(e){if(!e||e==="0")return"0";let t=new co(e).shiftedBy(-Oa);return t.isZero()?"0":t.isGreaterThanOrEqualTo(1)?t.toFormat(2,co.ROUND_DOWN):t.toFormat(4,co.ROUND_DOWN)}function Wa(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}=re(),o=!!t,{pools:r,isEmpty:i}=Er(e,t,o),a=_a(()=>r.map(s=>s.token.address),[r]),{detailMap:c}=Tr(e,a,o&&a.length>0),d=s=>`${tt[e]}/forge/token/${s.token.address}`,l=`${De[e]}/forge.png`;return Ie(Be,{title:Aa,icon:l,iconFit:"contain",isEmpty:i,children:r.map(s=>{let u=c.get(s.token.address.toLowerCase()),k=u?.image_url||u?.image||s.token.image||Fa,x=u?.symbol||s.token.symbol,g=d(s);return _t("a",{className:"wp-item","data-side":"lp",href:g,target:"_blank",rel:"noopener noreferrer",onClick:w=>Fe(w,g,{category:"portfolio",origin:"portfolio-forge",payload:{pool:s,tokenDetail:u}},n),children:[_t("div",{className:"wp-item-body",children:[_t("div",{className:"wp-item-field",children:[_t("span",{className:"wp-item-label",children:["Pair (",x,")"]}),Ie("div",{className:"wp-svc-token",children:Ie("img",{className:"wp-svc-token-icon",src:k,alt:""})})]}),_t("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:Da(s.lp_balance)})})]}),_t("div",{className:"wp-item-field",children:[Ie("span",{className:"wp-item-label",children:"Ownership"}),Ie("div",{className:"wp-svc-token",children:Ie("span",{children:Wa(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: hsl(221.3 24.6% 25.5%)}.wp-fullscreen[data-theme=light] .wp-header-avatar,.wp-embed[data-theme=light] .wp-header-avatar{--wp-header-avatar-bg: rgba(18, 18, 18, .1)}.wp-refresh-btn{position:relative}.wp-refresh-badge{position:absolute;top:-6px;right:-8px;min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:var(--wp-mint);color:#fff;font-size:10px;font-weight:600;line-height:16px;text-align:center}.wp-spin-once{animation:wp-spin-once .6s ease-in-out}@keyframes wp-spin-once{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.wp-header-title{flex:1;font-family:inherit;font-size: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
7
|
`);import{Fragment as Va,jsx as z,jsxs as je}from"react/jsx-runtime";var po=5,$a="wp:";function At({env:e,theme:t="dark",walletAddress:n,walletName:o,onBack:r,showHeader:i=!0,variant:a="embed",className:c,sendTransaction:d,getTransactionReceipt:l,onOutlink:s}){let u=ge(e),k=!!n,x=Ba(),{segments:g}=mr(u,n,k),[w,h]=Se.useState(po),[P,A]=Se.useState(!1),S=Se.useCallback(()=>{x.invalidateQueries({predicate:C=>typeof C.queryKey[0]=="string"&&C.queryKey[0].startsWith($a)})},[x]),N=Se.useCallback(()=>{S(),A(!0),setTimeout(()=>A(!1),600),h(po)},[S]);Se.useEffect(()=>{if(!k)return;let C=setInterval(()=>{h(U=>U<=1?(N(),po):U-1)},1e3);return()=>clearInterval(C)},[k,N]);let H=Se.useCallback(()=>{r?.()},[r]),y=k?bt(u,n,{size:64}):void 0,T=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]),$=je(Va,{children:[i&&je("div",{className:"wp-header",children:[je("div",{className:"wp-header-account",children:[r?z("button",{type:"button",className:"wp-header-btn",onClick:r,children:z(ur,{})}):z("span",{className:"wp-header-avatar","aria-hidden":!0,children:y&&z("img",{src:y,alt:"",className:"wp-header-avatar-img",draggable:!1})}),o&&z("span",{className:"wp-header-wallet-name",title:o,children:o})]}),je("button",{type:"button",className:"wp-header-btn wp-refresh-btn",onClick:N,children:[z(fr,{className:P?"wp-spin-once":void 0}),k&&z("span",{className:"wp-refresh-badge",children:w})]})]}),z("div",{className:"wp-top",children:g.length>0&&je("div",{className:"wp-asset",children:[je("div",{className:"wp-asset-head",children:[z("span",{className:"wp-asset-head-label",children:"Consolidated Asset"}),z("span",{className:"wp-asset-head-icon",children:z(gr,{})})]}),z("div",{className:"wp-bar",children:g.map(C=>z("div",{className:"wp-bar-seg",style:{flex:`${C.percentage} 0 0`,background:C.color},children:C.percentage>=5&&je("span",{className:"wp-bar-seg-pct",children:[C.percentage,"%"]})},C.symbol))}),z("div",{className:"wp-legend",children:g.map(C=>je("div",{className:"wp-legend-item",children:[z("span",{className:"wp-legend-dot",style:{background:C.color}}),z("span",{className:"wp-legend-label",children:C.symbol})]},C.symbol))})]})}),z("div",{className:"wp-body",children:je("div",{className:"wp-body-inner",children:[z(xr,{}),z(kr,{}),z(Nr,{}),z(Rr,{}),z(Pr,{})]})})]});return z(qt.Provider,{value:T,children:a==="none"?$:z("div",{className:K(a==="fullscreen"?"wp-fullscreen":"wp-embed",c),"data-theme":t,children:$})})}import{jsx as mo,jsxs as Ir}from"react/jsx-runtime";function Sr({className:e}){let{env:t,theme:n,walletAddress:o,close:r,sendTransaction:i}=re();return Ir(yn.Portal,{children:[mo(yn.Overlay,{className:"wp-overlay"}),Ir(yn.Content,{className:K("wp-fullscreen",e),"data-theme":n,children:[mo(yn.Title,{className:"wp-sr-only",children:"My Portfolio"}),mo(At,{env:t,theme:n,walletAddress:o,onBack:r,variant:"none",sendTransaction:i})]})]})}import{jsx as Mr}from"react/jsx-runtime";function Ga({env:e,theme:t="dark",walletAddress:n,open:o,onOpenChange:r,sendTransaction:i,onOutlink:a,children:c}){let d=ge(e),l=o!==void 0,[s,u]=kt.useState(!1),k=l?o:s,x=kt.useCallback(h=>{l||u(h),r?.(h)},[l,r]),g=kt.useCallback(()=>x(!1),[x]),w=kt.useMemo(()=>({env:d,theme:t,open:k,walletAddress:n,close:g,sendTransaction:i,onOutlink:a}),[d,t,k,n,g,i,a]);return Mr(qt.Provider,{value:w,children:Mr(Ha.Root,{direction:"bottom",open:k,onOpenChange:x,noBodyStyles:!0,children:c})})}var _r=Object.assign(Ga,{Trigger:rr,Content:Sr});import{Fragment as fo,jsx as p,jsxs as E}from"react/jsx-runtime";function uo(e,t,n){let o=me[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 Ua(e){return parseInt(e.split(":")[1],10)}function ja(e){let t=e.lastIndexOf(".");return t===-1?{main:e,decimal:""}:{main:e.slice(0,t),decimal:e.slice(t)}}function qa(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:i,isMobile:a,open:c,drawerDirection:d,modal:l,showBalance:s,showForgeToken:u,showGameToken:k,showQR:x,qrLogoSrc:g,walletAddress:w,accountName:h,sendAccounts:P,profileImageUrl:A,preferredTokens:S,close:N,onSelectWallet:H,onCopyAddress:y,onDisconnect:T,disconnectLabel:$,termsUrl:C,termsLabel:U,privacyUrl:q,privacyLabel:xe,portalStyle:at,navContent:ae,navPosition:$e,footerContent:Le,view:Y,setView:Ze,selectedSendToken:Ke,setSelectedSendToken:ue,showPortfolio:Ye,portfolioTitle:be,showTotalAssets:X,totalAssetsLabel:Z,sendTransaction:Me,getTransactionReceipt:se,estimateGas:_e,onOutlink:ve}=et(),{tokens:pe,isLoading:ye}=Pt(r,w,c&&s),{statsMap:J}=It(r,s),{categoryMap:Re}=tr(r,s),te=s&&X,{displayValue:st,isLowerBound:ke,isLoading:Qe}=nr(r,w,c&&te),[Ve,He]=B.useState(!1),lt=B.useRef(null),[Ee,Ge]=B.useState(0),{holdings:Te,isLoading:Xe}=Jo(r,w,c&&s&&u),ze=B.useMemo(()=>Te.map(b=>b.token),[Te]),{imageMap:Pe}=er(r,ze,u&&Te.length>0),fe=B.useMemo(()=>{let b=[],F=[],W=[],ee=new Map((S??[]).map((D,Q)=>[`${Ua(D.chainId)}:${D.address.toLowerCase()}`,Q]));for(let D of pe){let Q=uo(r,D.chainId,D.symbol)!==void 0,ft=`${D.chainId}:${D.address.toLowerCase()}`,gt=ee.get(ft),On=new Kt(D.quantity.numeric).shiftedBy(-D.quantity.decimals);if(Q)b.push(D);else if(gt!==void 0)F.push(D);else if(On.isGreaterThan(0)){if(!k&&Re.get(io(D.chainId,D.address))==="game")continue;W.push(D)}}return b.sort((D,Q)=>{let ft=uo(r,D.chainId,D.symbol)??99,gt=uo(r,Q.chainId,Q.symbol)??99;return ft-gt}),F.sort((D,Q)=>{let ft=ee.get(`${D.chainId}:${D.address.toLowerCase()}`)??99,gt=ee.get(`${Q.chainId}:${Q.address.toLowerCase()}`)??99;return ft-gt}),W.sort((D,Q)=>{let ft=J.get(vt(D.chainId,D.address)),gt=J.get(vt(Q.chainId,Q.address)),On=new Kt(D.quantity.numeric).shiftedBy(-D.quantity.decimals).multipliedBy(ft?.price??0);return new Kt(Q.quantity.numeric).shiftedBy(-Q.quantity.decimals).multipliedBy(gt?.price??0).minus(On).toNumber()}),[...b,...F,...W]},[pe,r,J,k,Re,S]),ct=B.useMemo(()=>{if(!u)return[];let b=new Set(pe.map(F=>F.address.toLowerCase()));return[...Te].filter(F=>!b.has(F.token.toLowerCase())).sort((F,W)=>{let ee=new Kt(F.value);return new Kt(W.value).minus(ee).toNumber()})},[Te,u,pe]),Je=B.useRef(!1),Ae=B.useCallback(b=>{Je.current=!0,Ze(b)},[Ze]),_n=B.useCallback(()=>{ue(null),Ae("wallet")},[ue,Ae]),Jt=B.useCallback(b=>{ue(b),Ae("send")},[ue,Ae]),en=B.useCallback(()=>{ue(null),Ae("wallet")},[ue,Ae]);B.useEffect(()=>{c||(Je.current=!1)},[c]);let tn=B.useRef(null);B.useEffect(()=>{let b=tn.current;if(!b||!a)return;let F=W=>{W.pointerType==="touch"&&W.stopPropagation()};return b.addEventListener("pointerdown",F),()=>b.removeEventListener("pointerdown",F)},[a]);let[dt,pt]=B.useState(!1),Ct=B.useRef(void 0);B.useEffect(()=>()=>clearTimeout(Ct.current),[]),B.useEffect(()=>{let b=lt.current;if(!b||Le===null){Ge(0);return}let F=()=>{Ge(b.offsetHeight)};if(F(),typeof ResizeObserver>"u")return;let W=new ResizeObserver(F);return W.observe(b),()=>W.disconnect()},[Le]);let nn=B.useCallback(async()=>{if(!dt)try{await navigator.clipboard.writeText(w),pt(!0),clearTimeout(Ct.current),Ct.current=setTimeout(()=>pt(!1),2e3),y?.(w,!0)}catch{y?.(w,!1)}},[w,y,dt]),Wt=B.useCallback(b=>{b.currentTarget.setAttribute("data-loaded","true")},[]),An=B.useMemo(()=>({background:qa(w)}),[w]),Bt=B.useMemo(()=>A||bt(r,w,{size:120,bg:i==="dark"?"1A1A2E":"F3F6F8"}),[A,r,w,i]),m=B.useMemo(()=>ja(st),[st]),L=C||q?E("div",{className:"wi-legal-links",children:[C&&p("a",{className:"wi-legal-link",href:C,target:"_blank",rel:"noopener noreferrer",onClick:b=>Fe(b,C,{category:"terms",origin:"terms"},ve),children:U}),C&&q&&p("span",{className:"wi-legal-sep","aria-hidden":!0,children:"\xB7"}),q&&p("a",{className:"wi-legal-link",href:q,target:"_blank",rel:"noopener noreferrer",onClick:b=>Fe(b,q,{category:"privacy",origin:"privacy"},ve),children:xe})]}):null,M=T?E("button",{type:"button",className:"wi-disconnect-btn",onClick:()=>{T(),N()},children:[p(Oo,{size:12}),p("span",{className:"wi-disconnect-label",children:$})]}):null,I=E("div",{className:K("wi-view-inner",Je.current&&"wi-view-wallet"),children:[te&&(()=>{let b=Ye;return E(b?"button":"div",{...b?{type:"button",onClick:()=>Ae("portfolio"),"aria-label":"View Portfolio"}:{},className:"wi-total-section","data-clickable":b||void 0,children:[E("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:W=>{W.stopPropagation(),He(ee=>!ee)},onKeyDown:W=>{(W.key==="Enter"||W.key===" ")&&(W.preventDefault(),W.stopPropagation(),He(ee=>!ee))},"aria-label":Ve?"Show balance":"Hide balance",children:Ve?p(Vo,{}):p($o,{})})]}),E("div",{className:"wi-total-body",children:[Qe?p("div",{className:"wi-skeleton-block wi-total-skeleton",style:{width:160,height:36}}):p("div",{className:"wi-total-value","data-hidden":Ve||void 0,children:Ve?p("span",{className:"wi-total-mask",children:"\u2022\u2022\u2022\u2022\u2022\u2022"}):E(fo,{children:[ke&&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})})]})]})})(),$e==="top"&&ae&&p("div",{className:"wi-nav-fixed",children:ae}),s&&p("div",{ref:tn,className:"wi-scrollable-body","data-vaul-no-drag":!0,children:E("div",{className:"wi-token-list",children:[ye&&Array.from({length:5},(b,F)=>E("div",{className:"wi-skeleton-item",children:[E("div",{className:"wi-skeleton-left",children:[p("div",{className:"wi-skeleton-block wi-skeleton-icon"}),E("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}})]})]}),E("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)),!ye&&fe.length===0&&!u&&p("div",{className:"wi-empty",children:"No Tokens Found"}),fe.map(b=>{let F=J.get(vt(b.chainId,b.address)),W=F?parseFloat(F.percent_change_24h):null,ee=W!==null&&W>=0,D=Hn(r,b.chainId);return E("button",{type:"button",className:"wi-token-item wi-token-item--button",onClick:()=>Jt(b),"aria-label":`Send ${b.symbol}`,children:[E("div",{className:"wi-token-left",children:[E("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"}}),D&&p("img",{src:D,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:Q=>{Q.currentTarget.style.display="none"}})]}),E("div",{className:"wi-token-info",children:[p("span",{className:"wi-token-name",children:b.symbol}),F&&E("div",{className:"wi-token-price-row",children:[p("span",{className:"wi-token-price",children:$n(F.price)}),p("span",{className:"wi-token-change","data-positive":ee,"data-zero":W===0||void 0,children:W!==null&&(W===0?"0%":`${ee?"+":"-"}${(ee?Math.floor:Math.ceil)(Math.abs(W)*100)/100}%`)})]})]})]}),E("div",{className:"wi-token-right",children:[p("span",{className:"wi-token-balance",children:xt(b.quantity.numeric,b.quantity.decimals)}),F&&p("span",{className:"wi-token-value",children:So(b.quantity.numeric,b.quantity.decimals,F.price)})]})]},`${b.address}-${b.chainId}`)}),u&&Xe&&Array.from({length:3},(b,F)=>E("div",{className:"wi-skeleton-item",children:[E("div",{className:"wi-skeleton-left",children:[p("div",{className:"wi-skeleton-block wi-skeleton-icon"}),E("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}})]})]}),E("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}`)),u&&!Xe&&!ye&&fe.length===0&&ct.length===0&&p("div",{className:"wi-empty",children:"No Tokens Found"}),u&&ct.map(b=>{let F=Pe.get(b.token)||"",W=Hn(r,me[r].cross);return E("div",{className:"wi-token-item",children:[E("div",{className:"wi-token-left",children:[E("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:ee=>{ee.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:ee=>{ee.currentTarget.style.display="none"}})]}),E("div",{className:"wi-token-info",children:[p("span",{className:"wi-token-name",children:b.token_name}),p("div",{className:"wi-token-price-row",children:E("span",{className:"wi-token-price",children:[xt(b.current_price,18)," CROSS"]})})]})]}),E("div",{className:"wi-token-right",children:[p("span",{className:"wi-token-balance",children:xt(b.balance,18)}),p("span",{className:"wi-token-value",children:$n(b.current_value_usd)})]})]},`forge-${b.token}`)})]})}),$e==="bottom"&&ae&&p("div",{className:"wi-nav-fixed",children:ae}),M&&p("div",{className:"wi-wallet-disconnect-row",children:M})]},"wallet"),V=Ye?p("div",{className:K("wi-view-inner wi-portfolio-body",Je.current&&"wi-view-portfolio"),children:p(At,{env:r,theme:i,walletAddress:w,showHeader:!1,sendTransaction:Me,getTransactionReceipt:se,onOutlink:ve})},"portfolio"):null,ne=Ke?p("div",{className:K("wi-view-inner wi-send-body",Je.current&&"wi-view-send"),children:p(fn,{env:r,theme:i,walletAddress:w,accountName:h,accounts:P,token:Ke,tokens:fe,onTokenChange:ue,sendTransaction:Me,getTransactionReceipt:se,estimateGas:_e,onConfirmSuccess:en,onOutlink:ve})},"send"):null,mt=p("div",{className:K("wi-view-inner wi-qr-body",Je.current&&"wi-view-qr"),children:E("div",{className:"wi-qr-section",children:[E("div",{className:"wi-qr-card",children:[E("div",{className:"wi-qr-code",children:[p(za,{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}),E("button",{type:"button",className:"wi-qr-copy-btn",onClick:nn,children:[p("span",{className:"wi-qr-copy-icon",children:dt?p(zt,{size:16}):p(Gn,{size:16})}),p("span",{className:"wi-qr-copy-text",children:dt?"Copied!":"Copy address"})]})]}),L]})},"qr"),le=Y==="qr"||Y==="portfolio"||Y==="send",ut=Le!==null?p("div",{className:"wi-builtin-footer",children:Le}):null,$t=!!H&&h?.trim().toLowerCase()!=="my wallet",Vt=E("div",{className:"wi-account-text",children:[$t?E("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"})}),E("button",{type:"button",className:"wi-address-row-btn",onClick:nn,"aria-label":"Copy address",children:[p("span",{className:"wi-account-address",children:Ce(w)}),p("span",{className:"wi-account-copy",children:dt?p(zt,{size:14}):p(Gn,{size:14})})]})]}),rn=E(fo,{children:[o,le?E("div",{className:"wi-sticky-header",children:[E("div",{className:"wi-header wi-header--wallet wi-header--sub-account",children:[p("button",{type:"button",className:"wi-header-back",onClick:_n,"aria-label":"Back",children:p(Do,{})}),p("div",{className:"wi-account-block wi-account-block--sub-account",children:Vt}),p("button",{type:"button",className:"wi-header-action",onClick:N,"aria-label":"Close",children:p(zn,{size:24})})]}),p("hr",{className:"wi-divider"})]}):E("div",{className:"wi-sticky-header",children:[E("div",{className:"wi-header wi-header--wallet",children:[E("div",{className:"wi-account-block",children:[E("div",{className:"wi-avatar",children:[p("div",{className:"wi-avatar-fallback",style:An}),Bt&&p("img",{src:Bt,alt:"",className:"wi-avatar-img",width:30,height:30,draggable:!1,onLoad:Wt,onError:b=>{b.currentTarget.style.display="none"}})]}),Vt]}),E("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(Fo,{size:20})}),p("button",{type:"button",className:"wi-header-action",onClick:N,"aria-label":"Close",children:p(zn,{size:24})})]})]}),p("hr",{className:"wi-divider"})]}),E("div",{className:"wi-view-container",children:[Y==="wallet"&&I,Y==="qr"&&mt,Y==="portfolio"&&V,Y==="send"&&ne]}),ut&&Y!=="portfolio"&&Y!=="send"&&p("div",{className:"wi-sticky-footer",children:p("div",{className:"wi-footer",ref:lt,children:ut})})]}),Nt={...at,...Ee>0?{"--wi-footer-height":`${Ee}px`}:null};return a?E(kn.Portal,{children:[l&&p(kn.Overlay,{className:"wi-drawer-overlay"}),E(kn.Content,{className:K("wi-drawer-content",n),"data-theme":i,style:Nt,"data-direction":d,"data-no-balance":!s||void 0,"data-has-footer":Ee>0||void 0,"data-view":Y,children:[p(kn.Title,{className:"wi-sr-only",children:"My Wallet"}),rn]})]}):E(fo,{children:[l&&c&&p("div",{className:"wi-drawer-overlay",onClick:N}),p(Cn.Portal,{children:p(Cn.Content,{align:e,sideOffset:t,className:K("wi-popover-content",n),"data-theme":i,style:Nt,"data-no-balance":!s||void 0,"data-has-footer":Ee>0||void 0,"data-view":Y,children:rn})})]})}import*as Or from"react";function Fr({position:e="top",children:t}){let{setNavContent:n,setNavPosition:o}=et();return Or.useEffect(()=>(n(t),o(e),()=>n(null)),[t,e,n,o]),null}import*as Dr from"react";function Wr({children:e}){let{setFooterContent:t}=et();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
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}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexus-cross/dapp-ui",
|
|
3
|
-
"version": "1.1.1
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Shared DApp UI components for the CROSS ecosystem — AppLauncher, WalletInfo, WalletPortfolio, WalletConnectModal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|