@edgex-web/components 0.1.0-beta.60 → 0.1.0-beta.61

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.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { o as e, C as i, D as t, n, p as r, L as p, o as d, S as L, T as h, W as D, y as g, r as u, A as w, h as W, w as C, G as m, q as E, z as A, v as O, F as T, t as M, E as S, u as l, j as f, x as P, m as _, k as c, I as v } from "./index-LUllFZkb.mjs";
1
+ import { o as e, C as i, D as t, n, p as r, L as p, o as d, S as L, T as h, W as D, y as g, r as u, A as w, h as W, w as C, G as m, q as E, z as A, v as O, F as T, t as M, E as S, u as l, j as f, x as P, m as _, k as c, I as v } from "./index-CSUvequ1.mjs";
2
2
  import "react";
3
3
  export {
4
4
  e as ChromeLoader,
package/dist/index.umd.js CHANGED
@@ -148,5 +148,5 @@ ${Nb(p)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
148
148
  relative
149
149
  ${c}
150
150
  ${s}
151
- `,children:[t,o&&k.jsx(I0,{ref:d,placement:h.placement||n})]})})]})},ko="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIcSURBVHgBxZc/T8JAGMafA4mDEXFw0DiQmDi4CP5JHGFx0qizg8QvIHwCZHYAvwEm7mji5CJuJv7DxcWYYMLmIEYXY/R8j6tQaBvuaCm/pOlbSu99+rZ97zlgwDBowvNLCdrF6NJ50891OvNC+wrL3JShgZIAnl+JAj97FKXoMNLl7ySGnQDBHMtcVeFGAM8nKNlnlsI0eoIVuwlhzsmXqcwoURSFK1iVRCSdRDDn5PwC3cutingsJOK60nkiYE0unrdi8uFRIDwFBSJiTKOqzgKMl00teXgS2D0Fto+BiVkoIMYs8Xws4iiAkmeVn/n0oqyA2NQEQI4dytoKMEqfQt/haZmrQ4C8e7/4TtsI4JvwDbYDswCjvXr1yakQMXI2KxCD/8RMAtx2ux5gcjIzBAT8LH8bAQwYbwR8fUAb/vtuEsAr0OX5Eng8o30ZqN1BHzFLAkPGkb4AcdfnObigkbM5HdN3+Qb/ekGdrNu4CMyd8Ag6iElo/QBYzcpYByYsm8QkIFSADmI2nEkAc2sUL0ALHsxZBEjLxA+hSu22tb0+KV9Gd18027M2SybNQui+f53R6g/b+gDLVMi7YQsND+c5dTtzamlE0jiyJLwVYZhSqzO27YRSxFD8v1m4Q4xh74gdBUgRQm2QKsH0Ps82xEs9EndK3sgDlWGkW96naANqSzMSHSy4XprZi2kuTqN09VjrBH9AD4vTgfMHJt+rxIFF7EgAAAAASUVORK5CYII=",aP=(e,t)=>Number(e)>Number(t),Tt=e=>{if(!e||e===""||isNaN(Number(e)))return"0.00";const t=Number(e);if(t===0)return"0.00";let n=t.toString();n.includes("e")&&(n=t.toFixed(20));const r=n.split("."),o=r[0];let s=r[1]||"";return s.length>6&&(s=s.substring(0,6)),s=s.replace(/0+$/,""),s?(s.length===1&&(s+="0"),o+"."+s):o+".00"},ou=(e,t="0")=>{if(/[^0-9.]/.test(e))return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(e===".")return{isValid:!0,formattedValue:"0."};if((e.match(/\./g)||[]).length>1)return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(!e||e==="")return{isValid:!0,formattedValue:""};const o=e.split(".");if(o.length===2&&o[1].length>6){const a=o[0]+"."+o[1].substring(0,6);return ou(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:Tt(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},Js={ETHEREUM:1,ARBITRUM:42161,ARBITRUM_SEPOLIA:421614,SEPOLIA:11155111},cP=[Js.ETHEREUM,Js.SEPOLIA,Js.ARBITRUM,Js.ARBITRUM_SEPOLIA],uP=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!cP.includes(t)}return!0},lP=({currentActiveChain:e,selectedToken:t,address:n,onDeposit:r,onCopy:o,onClose:s})=>{const{t:i}=Ht(),c=v.useMemo(()=>uP(e||{}),[e]);return k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&k.jsx("div",{className:"bg-white rounded-lg",children:k.jsx(d0,{value:n,size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&k.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[k.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:n}),k.jsx(d5,{onCopy:()=>{o&&o(n)},text:n,children:k.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[k.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),k.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})},"copy")]}),k.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[k.jsxs("div",{className:"flex items-start",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:ko,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1",children:k.jsx("p",{className:"text-xs text-functional-orange-1",children:i("deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain})})})]}),c&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),k.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:i("deposit.depositTipFor25w")})]})]}),k.jsxs("div",{className:"text-sm",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[k.jsx("span",{className:"text-text-tertiary",children:i("deposit.arrivalTime")}),k.jsx(Gn,{content:k.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[k.jsx("p",{children:i("deposit.arrivaltimeTooltip1",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60,v1:e==null?void 0:e.txConfirm})}),k.jsx("p",{children:i("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:k.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed",children:i("deposit.arrivalEstimated",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60})})})]}),k.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[k.jsx("span",{className:"text-text-tertiary",children:i("deposit.minDeposit")}),k.jsxs("span",{className:"text-text-primary font-medium text-right",children:["10 ",t]})]}),k.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[k.jsx("span",{className:"text-text-tertiary",children:i("deposit.maxDeposit")}),k.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),k.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{r&&r({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t}),s()},children:i("deposit.title")})]})},Mo=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return k.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},fP=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=Tt(Math.max(0,s).toString());return k.jsxs("span",{className:"flex items-center gap-1",children:[Tt(e),k.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${Tt(e)} ${n}`},dP=(e,t,n)=>{if(!e||e===""||e==="0"||e==="0.00")return!1;const r=parseFloat(e),o=parseFloat(t);return!(isNaN(r)||isNaN(o)||r>o||!n)},pP=(e,t,n)=>{if(!Gh(e,n))return!1;try{const r=new Ae(t||"0"),o=new Ae("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},hP=(e,t,n)=>{let r=t||"0";if(Gh(e,n))try{const o=new Ae(r),s=new Ae("200000");o.gt(s)&&(r="200000")}catch(o){console.warn("Error calculating max amount limit:",o)}return r},B0={chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""},defaultChainId:1,platformBalance:"0"};let qe=null;const k0=v.forwardRef((e,t)=>{const[n,r]=v.useState(!1),[o,s]=v.useState(!1),[i,c]=v.useState(B0),a=v.useCallback(h=>{c(h),r(!0)},[]),u=v.useCallback(h=>{c(m=>({...m,...h}))},[]),l=v.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),d=v.useCallback(h=>{s(h)},[]),f=v.useCallback(()=>n,[n]),p=v.useCallback(()=>o,[o]);return v.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:d,isOpen:f,isLoading:p}),[a,l,u,d,f,p]),v.useEffect(()=>(qe={openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:d,isOpen:f,isLoading:p},()=>{qe=null}),[a,l,u,d,f,p]),n?k.jsx(_0,{isOpen:n,isLoading:o,onClose:l,currentActiveAccount:i.currentActiveAccount,chains:i.chains,defaultChainId:i.defaultChainId,platformBalance:i.platformBalance,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,onChainChange:h=>{var m;return(m=i.onChainChange)==null?void 0:m.call(i,h)},onTokenChange:h=>{var m;return(m=i.onTokenChange)==null?void 0:m.call(i,h)}}):null});k0.displayName="DepositManager";const M0=e=>{if(!qe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}qe.openDeposit(e||B0)},L0=()=>{if(!qe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}qe.closeDeposit()},R0=e=>{qe&&qe.updateDepositOptions(e)},ei=e=>{if(!qe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}qe.setDepositLoading(e)},mP=()=>qe?qe.isOpen():!1,D0=()=>qe?qe.isLoading():!1,gP=()=>({openDeposit:M0,closeDeposit:L0,updateDepositOptions:R0,setDepositLoading:ei,isOpen:mP,isLoading:D0}),bP=e=>{const{t}=Ht(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:c,minDeposit:a=10}=e;return v.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const u=parseFloat(r||"0"),l=dP(r,s||"0",o);return!r||u===0||!o?{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:u<a?{text:t("deposit.minDepositParsed",{amount:a,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!l,isNetworkSwitch:!1}},[n,r,o,s,i,c,a,t])};function yP(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:c,usePublicClient:a,useSwitchChain:u}=e.wagmiHooks,l=o==null?void 0:o.tokenAddress,d=(o==null?void 0:o.decimals)??18,f=o==null?void 0:o.contractAddress,p=!l||l.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=u(),{writeContractAsync:m}=c(),w=a(),T=i({address:l,abi:fr,functionName:"allowance",args:[$n(t||""),f],chainId:r,query:{enabled:!!(!p&&t&&r&&l&&f)}}),y=T!=null&&T.isSuccess?T.data:void 0,$=v.useMemo(()=>{if(p)return!0;if(!T.isSuccess||y===void 0||y===0n)return!1;try{const L=xw(String(Number(s||"0")||0),Number(d));return y>=L}catch{return!1}},[p,T.isSuccess,y,s,d]),M=v.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!m||!w||!l||!f)return;const F=$n(l),j=$n(f);if((y||0n)>0n){const A=await m({abi:fr,address:F,functionName:"approve",args:[j,0n]});await w.waitForTransactionReceipt({hash:A})}const x=await m({abi:fr,address:F,functionName:"approve",args:[j,Ul]});await w.waitForTransactionReceipt({hash:x}),T!=null&&T.refetch&&await T.refetch()}catch(L){console.error("[useApprove] onApprove failed:",L)}},[r,n,l,f,y,T,m,w,h]);return{approve:$,onApprove:M}}const wP=({token:e,account:t,chainId:n,wagmiHooks:r,onResult:o})=>{var i;const s=(i=r==null?void 0:r.useBalance)==null?void 0:i.call(r,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(r!=null&&r.useBalance)}});return v.useEffect(()=>{o($n(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},F0=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var T;const s=v.useMemo(()=>r.filter(y=>y.tokenAddress&&y.tokenAddress!=="0x0000000000000000000000000000000000000000"),[r]),[i,c]=v.useState({}),a=v.useCallback((y,$)=>{c(M=>({...M,[y]:$}))},[]),u=(T=o==null?void 0:o.useBalance)==null?void 0:T.call(o,{address:e,chainId:t,query:{enabled:!!e&&!!t&&!!(o!=null&&o.useBalance)}}),[l,d]=v.useState(0),f=v.useMemo(()=>s.map(y=>v.createElement(wP,{key:`${y.tokenAddress}-${l}`,token:y,account:e,chainId:t,contractAddress:n,wagmiHooks:o,onResult:a})),[s,e,t,n,o,a,l]),p=v.useMemo(()=>{const y=u!=null&&u.data?{value:u.data.value,formatted:u.data.formatted,decimals:u.data.decimals,symbol:u.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},$=s.map(L=>{const F=i[$n(L.tokenAddress)],j=F==null?void 0:F.balance,g=j==null?void 0:j.data;return{address:$n(L.tokenAddress),value:(g==null?void 0:g.value)||BigInt(0),formatted:(g==null?void 0:g.formatted)||"0",decimals:(g==null?void 0:g.decimals)||L.decimals}}).filter(L=>L.address),M=$.reduce((L,F)=>({...L,[F.address]:{balance:F}}),{});return{balanceList:$,baseTokenBalance:y,combinedData:M}},[u,i,s]),h=v.useCallback(async()=>p,[p]),m=v.useMemo(()=>{const y=(u==null?void 0:u.isLoading)||!1,$=Object.values(i).some(M=>{var L;return(L=M.balance)==null?void 0:L.isLoading});return y||$},[u==null?void 0:u.isLoading,i]),w=v.useCallback(()=>d(y=>y+1),[]);return{multicallRun:h,multicallRefresh:w,multicallResult:p,validErcTokens:s,isLoading:m,queryComponents:f}},vP=({address:e,currentActiveChain:t,selectedToken:n,platformBalance:r,isLoading:o,wagmiHooks:s,onChainChange:i,onDeposit:c})=>{const{t:a}=Ht(),u=s.useAccount(),l=t.tokenList.find(D=>D.token===n),d=t.chainId,[f,p]=v.useState("");v.useEffect(()=>{p("")},[n,t.chainId]);const{multicallResult:h,queryComponents:m}=F0({account:e,chainId:t.chainId,contractAddress:(l==null?void 0:l.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:s}),w=v.useMemo(()=>{var U;if(!l)return"0";if(!l.tokenAddress||l.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return h.baseTokenBalance.formatted;const D=h.combinedData[l.tokenAddress];return((U=D==null?void 0:D.balance)==null?void 0:U.formatted)||"0"},[l,h]),T="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",y="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",$=v.useMemo(()=>{var D,U;return ja({chain:_a,transport:pa(t.rpcUrl||((D=window==null?void 0:window.ENV)==null?void 0:D.CHAIN_RPC_URL_42161)||((U=window==null?void 0:window.ENV)==null?void 0:U.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),M="1000000000000",{formatted:L}=bs({client:$,tokenAddress:T,holder:y,decimals:6,fallbackFormatted:M,pollingInterval:12e3}),[F,j]=v.useState(!1),{approve:g,onApprove:x}=yP({account:e,accountChainId:u.chainId,targetChainId:+t.chainId,tokenInfo:l,amount:f,wagmiHooks:s}),A=v.useCallback(async()=>{if(!F)try{j(!0),await x()}catch(D){console.error("Approve failed:",D)}finally{j(!1)}},[F,x]),I=v.useMemo(()=>+u.chainId!=+t.chainId,[u.chainId,t.chainId]),N=v.useCallback(async()=>{i&&i(d)},[i,d]);v.useEffect(()=>{I&&N()},[I,N]);const{showLayerZeroTip:P,layerZeroTipKey:S}=v.useMemo(()=>{const D=+t.chainId==42161||+t.chainId==421614,U=(n==null?void 0:n.toUpperCase())==="USDT",_=new Ae(f||"0"),H=new Ae("200000");let K=!1,W;if(D&&U&&f)if(_.gte(H))K=!0,W="deposit.layerZeroDepositTipGte200k";else{const Z=L;if(typeof Z=="string"&&Z.length>0){const J=new Ae(Z);!J.isNaN()&&_.gte(J)&&(K=!0,W="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:K,layerZeroTipKey:W}},[t.chainId,n,f,L]),E=v.useCallback(()=>hP(+t.chainId,w||"0",n),[w,t==null?void 0:t.chainId,n]),C=v.useMemo(()=>pP(+t.chainId,f,n),[t==null?void 0:t.chainId,f,n]),O=bP({isNetworkMismatch:I,depositAmount:f,approved:g,currentTokenBalance:w,selectedToken:n,showLayerZeroTip:P,minDeposit:10}),b=D=>{const U=D.target.value,_=E(),H=ou(U,_);if(H.isValid)p(H.formattedValue),H.errorType;else return H.errorType==="exceed_balance",void 0},B=v.useCallback(async()=>{ei(!0);try{c&&c({amount:f,chainId:d,tokenAddress:(l==null?void 0:l.tokenAddress)||"",tokenSymbol:n})}catch(D){console.error("Deposit error:",D),ei(!1)}},[c,f,d,l==null?void 0:l.tokenAddress,n]);return k.jsxs(k.Fragment,{children:[m,k.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[k.jsx("input",{type:"text",placeholder:a("deposit.amount"),value:f,onChange:b,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),k.jsx("button",{onClick:()=>{const D=E();p(D)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:a("deposit.max")})]}),k.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),k.jsxs("div",{className:"flex justify-between items-center",children:[k.jsx(Gn,{content:a("deposit.availableDesc"),children:k.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:a("deposit.available")})}),k.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:fP(w||"0",f,n)})]})]}),!g&&aP(f||"0",0)&&k.jsxs("div",{className:"flex justify-center flex-col items-center",children:[k.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:a("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),k.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:a("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),k.jsx("button",{className:"w-[180px] h-8 bg-fill-btn-primary hover:bg-fill-btn-primary-hover text-text-on-sec-btn rounded-xl text-sm font-medium transition-colors my-4 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center",onClick:A,disabled:F,children:F?k.jsx(Mo,{size:"xs",inline:!0}):a("deposit.enableWithToken",{token:n})})]}),P&&k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:ko,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:a(S||"deposit.layerZeroDepositTip")})]}),k.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),C&&k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:ko,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:a("deposit.depositTipFor25w")})]}),C&&k.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:!(C||P)&&k.jsx("img",{src:ko,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:a("deposit.noPrivateKeyWalletWarning")})]}),k.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[k.jsx("span",{className:"text-sm text-text-tertiary",children:a("deposit.arrivalTime")}),k.jsx(Gn,{content:k.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[k.jsx("p",{children:a("deposit.arrivaltimeTooltip1",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60,v1:t==null?void 0:t.txConfirm})}),k.jsx("p",{children:a("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:k.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed text-sm",children:a("deposit.arrivalEstimated",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60})})})]}),k.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[k.jsx("span",{className:"text-sm text-text-tertiary",children:a("deposit.equity")}),k.jsx("span",{className:"text-sm text-text-primary font-medium",children:f?k.jsxs("span",{className:"flex items-center gap-1",children:[Tt(r),k.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),Tt((parseFloat(r)+parseFloat(f)).toString())," ",n]}):`${Tt(r)} ${n}`})]})]}),k.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${O.disabled||o?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:B,disabled:O.disabled||o,children:[(o||I)&&k.jsx(Mo,{size:"xs"}),O.text]})]})},j0=e=>e.toLocaleUpperCase()===Fn?Fn:Ua,ti=e=>j0(e.wallet)===Fn,xP=e=>j0(e.wallet)===Ua,_0=({isOpen:e,isLoading:t=!1,onClose:n,currentActiveAccount:r,chains:o,defaultChainId:s,platformBalance:i="0",wagmiHooks:c,onDeposit:a,onCopy:u,onChainChange:l,onTokenChange:d})=>{const{t:f}=Ht(),[p,h]=v.useState(()=>{var M;return!o||o.length===0?1:s||((M=o[0])==null?void 0:M.chainId)||1}),m=o.find(M=>M.chainId===p)||o[0],[w,T]=v.useState(()=>{var j;if(!o||o.length===0)return"";const M=s||((j=o[0])==null?void 0:j.chainId),L=o.find(g=>g.chainId===M);if(!L||!L.tokenList||L.tokenList.length===0)return"";const F=L.tokenList[0];return(F==null?void 0:F.token)||""}),y=v.useCallback(M=>{h(M),l==null||l(M)},[l]),$=v.useCallback(M=>{T(M),d==null||d(M)},[d]);return e?Le.createPortal(k.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:k.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[99] flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onClick:()=>{n()},"aria-hidden":"true",children:k.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:M=>{M.stopPropagation()},children:[k.jsxs("div",{className:"flex items-center justify-between mb-4",children:[k.jsx("h2",{className:"text-lg font-semibold text-white",children:f("deposit.title")}),k.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:k.jsx(Wd,{className:"h-4 w-4"})})]}),k.jsx(qh,{currentActiveChain:m,chainList:o,onChainChange:y,curSelectToken:w,onTokenChange:$,walletType:ti(r)?Fn:Ua}),ti(r)&&k.jsx(lP,{address:r.smartWalletAddress,currentActiveChain:m,selectedToken:w,onDeposit:a,onCopy:u,onClose:n}),xP(r)&&k.jsx(vP,{address:r.ethAddress,currentActiveChain:m,selectedToken:w,platformBalance:i,isLoading:t,wagmiHooks:c,onChainChange:y,onDeposit:a,onClose:n})]})})}),document.body):null},EP=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",walletType:i="evm",receiverAddress:c="",onWithdrawAmountChange:a,onReceiverAddressChange:u,onAmountChanged:l,showPoolBalanceInsufficientTip:d=!1})=>{const{t:f}=Ht(),p=v.useMemo(()=>{if(!Ge(r==null?void 0:r.chainId)){const $=new Ae(e||"0").minus(s||"0").decimalPlaces(2,Ae.ROUND_DOWN);return $.isNegative()?"0.00":$.toString()}return e||"0"},[e,s,r==null?void 0:r.chainId]),h=v.useMemo(()=>o||"0",[o]),m=v.useMemo(()=>{const $=(n==null?void 0:n.feeRate)||(r==null?void 0:r.feeRate)||0;try{return new Ae($||0).times(100).toString()}catch{return"0"}},[n==null?void 0:n.feeRate,r==null?void 0:r.feeRate]),w=$=>{const M=$.target.value,F=ou(M,h||"0");if(F.isValid)a(F.formattedValue),F.errorType;else return F.errorType==="exceed_balance",void 0;l==null||l(F.formattedValue)},T=()=>{a(h),l==null||l(h)},y=()=>{const $=parseFloat(o||"0"),M=parseFloat(e||"0");if(M>0){const L=$-M,F=Tt(Math.max(0,L).toString());return k.jsxs("span",{className:"flex items-center gap-1",children:[Tt(o||"0"),k.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),F," ",t]})}return`${Tt(o||"0")} ${t}`};return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[k.jsx("input",{type:"text",placeholder:f("deposit.amount"),value:e,onChange:w,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),k.jsx("button",{onClick:T,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:f("deposit.max")})]}),k.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),k.jsxs("div",{className:"flex justify-between items-center",children:[k.jsx(Gn,{content:f("withdraw.availableDesc"),children:k.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:f("deposit.available")})}),k.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:y()})]})]}),i==="mpc"&&!Ge(r==null?void 0:r.chainId)&&k.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:k.jsx("input",{type:"text",placeholder:f("withdraw.receiverAddress"),value:c,onChange:$=>u==null?void 0:u($.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"})}),k.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:Ge(r==null?void 0:r.chainId)?k.jsxs(k.Fragment,{children:[k.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:f("withdraw.noticeDesc")}),k.jsx("a",{className:"block text-xs leading-[18px] mt-1 text-theme-normal",href:"https://edgex-1.gitbook.io/edgeX-documentation/getting-started/deposits-and-withdrawals/withdrawals",rel:"noreferrer",target:"_blank",children:f("withdraw.commonWithdraw")})]}):k.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:f("withdraw.crossChainTips")})}),d&&k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:ko,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:f("withdraw.poolBalanceInsufficientTip")})]}),k.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[k.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[k.jsx(Gn,{content:k.jsxs("div",{children:[k.jsx("div",{children:f("withdraw.speedNote")}),k.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[k.jsx(No,{selectedLevel:$t.FAST,maxLevel:3}),k.jsx("span",{children:f("withdraw.speedNoteSpeed1")})]}),k.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[k.jsx(No,{selectedLevel:$t.Medium,maxLevel:3}),k.jsx("span",{children:f("withdraw.speedNoteSpeed2")})]}),k.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[k.jsx(No,{selectedLevel:$t.SLOW,maxLevel:3}),k.jsx("span",{children:f("withdraw.speedNoteSpeed3")})]})]}),children:k.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:f("withdraw.speed")})}),k.jsx("div",{className:"flex items-center",children:k.jsx(No,{selectedLevel:Ge(r==null?void 0:r.chainId)?$t.SLOW:$t.FAST,maxLevel:3})})]}),!Ge(r==null?void 0:r.chainId)&&k.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[k.jsx(Gn,{content:f("withdraw.feeCalculationTip"),children:k.jsxs("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:[f("withdraw.fee"),"/",f("withdraw.feeRate")]})}),k.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t," / ",m,"%"]})]}),k.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[k.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:f(Ge(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),k.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[Tt(p)," ",t]})]})]})]})},SP=[],PP={};let Ze=null;const U0=v.forwardRef((e,t)=>{const[n,r]=v.useState(!1),[o,s]=v.useState(!1),[i,c]=v.useState({chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),a=v.useCallback(h=>{c(h||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),r(!0)},[]),u=v.useCallback(h=>{c(m=>({...m,...h}))},[]),l=v.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),d=v.useCallback(h=>{s(h)},[]),f=v.useCallback(()=>n,[n]),p=v.useCallback(()=>o,[o]);return v.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:d,isOpen:f,isLoading:p}),[a,l,u,d,f,p]),v.useEffect(()=>(Ze={openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:d,isOpen:f,isLoading:p},()=>{Ze=null}),[a,l,u,d,f,p]),n?k.jsx(G0,{isOpen:n,isLoading:o,onClose:l,config:i.config||{symbol:"USDT"},currentActiveAccount:i.currentActiveAccount,chains:i.chains||SP,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,defaultAmount:i.defaultAmount,metadata:i.metadata||PP,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged}):null});U0.displayName="WithdrawManager";const z0=e=>{if(!Ze){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ze.openWithdraw(e||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}})},H0=()=>{if(!Ze){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ze.closeWithdraw()},W0=e=>{if(!Ze){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ze.updateWithdrawOptions(e)},ni=e=>{if(!Ze){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ze.setWithdrawLoading(e)},AP=()=>Ze?Ze.isOpen():!1,V0=()=>Ze?Ze.isLoading():!1,$P=()=>({openWithdraw:z0,closeWithdraw:H0,updateWithdrawOptions:W0,setWithdrawLoading:ni,isOpen:AP,isLoading:V0}),TP=({address:e,walletType:t,chains:n,defaultChainId:r,defaultTokenAddress:o,defaultAmount:s="",metadata:i,currentEquity:c,platformBalance:a="0",fee:u="0.00",isLoading:l=!1,wagmiHooks:d,onWithdraw:f,onClose:p,onChainChange:h,onTokenChange:m,onAmountChanged:w})=>{var Me;const{t:T}=Ht(),y=v.useMemo(()=>{const Y=[56,97],ee=me=>n==null?void 0:n.find(de=>Number(de==null?void 0:de.chainId)===me),Q=ee(Y[0])||ee(Y[1]);return Q==null?void 0:Q.rpcUrl},[n]),$=v.useMemo(()=>{const Y=[42161,421614],ee=me=>n==null?void 0:n.find(de=>Number(de==null?void 0:de.chainId)===me),Q=ee(Y[0])||ee(Y[1]);return Q==null?void 0:Q.rpcUrl},[n]),M=v.useMemo(()=>{var qn,Je;const Y="USDC";if(!n||n.length===0)return{chainId:1,tokenSymbol:""};const ee=Zn=>Array.isArray(Zn.tokenList)&&Zn.tokenList.some(ri=>(ri.token||ri.symbol||"").toUpperCase()===Y),Q=n.find(ee)||n[0];if(!Q||!Array.isArray(Q.tokenList)||Q.tokenList.length===0)return{chainId:(Q==null?void 0:Q.chainId)||1,tokenSymbol:""};const me=Q.tokenList.find(Zn=>(Zn.token||Zn.symbol||"").toUpperCase()===Y),de=(me==null?void 0:me.token)||(me==null?void 0:me.symbol)||((qn=Q.tokenList[0])==null?void 0:qn.token)||((Je=Q.tokenList[0])==null?void 0:Je.symbol)||"";return{chainId:Q.chainId,tokenSymbol:de}},[n]),{ARB_USDC_BALANCE:L,ARB_USDT_BALANCE:F,BNB_USDT_BALANCE:j}=Xv({bscRpcUrl:y,arbitrumRpcUrl:$}),[g,x]=v.useState(()=>M.chainId),[A,I]=v.useState(()=>M.tokenSymbol),[N,P]=v.useState(s),[S,E]=v.useState(""),C=v.useCallback(Y=>{x(Y),h==null||h(Y)},[h]),O=v.useCallback(Y=>{I(Y),m==null||m(Y)},[m]),b=v.useRef(!0),B=v.useRef(A),D=v.useRef(g);v.useEffect(()=>{if(b.current){b.current=!1,B.current=A,D.current=g;return}(B.current!==A||D.current!==g)&&(P(""),B.current=A,D.current=g)},[A,g]);const U=n&&n.length>0?n.find(Y=>Y.chainId===g)||n[0]:null,_=(Me=U==null?void 0:U.tokenList)==null?void 0:Me.find(Y=>Y.token===A),{multicallResult:H,queryComponents:K}=F0({account:e,chainId:g,contractAddress:void 0,tokens:(U==null?void 0:U.tokenList)||[],wagmiHooks:d}),W=v.useMemo(()=>{var ee;if(!_)return;if(!_.tokenAddress||_.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return H.baseTokenBalance.formatted;const Y=H.combinedData[_.tokenAddress];return((ee=Y==null?void 0:Y.balance)==null?void 0:ee.formatted)||"0"},[_,H]),Z=Y=>{if(!Y)return"0";const ee=Y.indexOf(".");return ee>=0?Y.slice(0,ee):Y},G=v.useMemo(()=>{const Y=(A||"").toUpperCase(),ee=Number(g),Q=me=>{const de=Z(me);try{const Je=new Ae(de||"0").minus(1e4);return Je.isGreaterThan(0)?Je.toFixed(0):"0"}catch{return"0"}};if(Ge(ee))return"∞";if(ee===42161||ee===421614){if(Y==="USDT")return Q(F);if(Y==="USDC")return Q(L)}return(ee===56||ee===97)&&Y==="USDT"?Q(j):"0"},[g,A,L,F,j]),J=v.useMemo(()=>{if(Ge(g))return!1;try{const Y=new Ae(N||"0"),ee=new Ae((G||"0").toString());return Y.isGreaterThan(ee)}catch{return!1}},[g,N,G]),ne=v.useMemo(()=>{const Y={},ee=(A||"").toUpperCase(),Q=me=>{const de=Z(me);try{const Je=new Ae(de||"0").minus(1e4);return Je.isGreaterThan(0)?Je.toFixed(0):"0"}catch{return"0"}};return(n||[]).forEach(me=>{const de=Number(me==null?void 0:me.chainId);if(de){if(Ge(de)){Y[de]="∞";return}if(de===42161||de===421614){ee==="USDT"?Y[de]=Q(F):ee==="USDC"?Y[de]=Q(L):Y[de]="0";return}if(de===56||de===97){ee==="USDT"?Y[de]=Q(j):Y[de]="0";return}Y[de]="0"}}),Y},[n,A,L,F,j]),le=v.useMemo(()=>{const Y=new Ae(N||"0"),ee=new Ae(u||"0"),Q=Ge(g);let me=!1;if(!Q)try{const de=new Ae((G||"0").toString());me=Y.isGreaterThan(de)}catch{me=!1}return!N||Y.isZero()||!Q&&Y.isLessThan(ee)||!Q&&me?{text:T("withdraw.confirmWithdraw"),disabled:!0}:t==="mpc"&&!Q&&!S.trim()?{text:T("withdraw.invalidReceiverAddress"),disabled:!0}:{text:T("withdraw.confirmWithdraw"),disabled:!1}},[T,g,N,t,S,u,G]),Se=v.useCallback(async()=>{ni(!0);try{if(f){const ee={amount:new Ae(N||"0").toString(),chainId:g,tokenAddress:(_==null?void 0:_.tokenAddress)||"",tokenSymbol:A};t==="mpc"&&!Ge(g)&&(ee.receiverAddress=S),f(ee)}}catch{ni(!1)}},[f,N,g,_==null?void 0:_.tokenAddress,A,t,S]);return!n||n.length===0?k.jsx("div",{className:"text-center py-8",children:k.jsx("p",{className:"text-gray-400",children:"No chains available"})}):U?k.jsxs(k.Fragment,{children:[K,k.jsx(qh,{currentActiveChain:U,chainList:n,chainPoolBalances:ne,onChainChange:C,curSelectToken:A,onTokenChange:O,walletType:"EVM",txType:"withdraw"}),k.jsxs("div",{className:"p-3 my-4 bg-fill-input-primary rounded-lg flex items-center justify-between h-[38px]",children:[k.jsx("div",{className:"text-text-secondary text-sm",children:Ge(g)?T("withdraw.poolBalance"):T("withdraw.crossChainPoolBalance")}),k.jsxs("div",{className:"text-text-primary text-sm font-medium",children:[G," ",A]})]}),k.jsx(EP,{withdrawAmount:N,curSelectToken:A,tokenInfo:_,curSelectTokenData:{balance:_==null?void 0:_.balance,allowance:_==null?void 0:_.allowance},currentActiveChain:U,currentEquity:c||0,amount:N,decimals:(_==null?void 0:_.decimals)||6,tokenBalance:W,platformBalance:a,fee:u,walletType:t,receiverAddress:S,onWithdrawAmountChange:P,onReceiverAddressChange:E,onAmountChanged:w,showPoolBalanceInsufficientTip:J,poolBalanceMap:ne}),k.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${le.disabled||l?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:Se,disabled:le.disabled||l,children:[l&&k.jsx(Mo,{size:"xs"}),le.text]})]}):k.jsx("div",{className:"text-center py-8",children:k.jsx("p",{className:"text-gray-400",children:"Loading..."})})},G0=({isOpen:e,isLoading:t=!1,onClose:n,config:r,currentActiveAccount:o,chains:s,defaultChainId:i,defaultTokenAddress:c,defaultAmount:a="",metadata:u,currentEquity:l=5e3,platformBalance:d="0",fee:f,wagmiHooks:p,onWithdraw:h,onChainChange:m,onTokenChange:w,onAmountChanged:T})=>{const{t:y}=Ht();return e?Le.createPortal(k.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:k.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[99] flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onClick:()=>{n()},"aria-hidden":"true",children:k.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:$=>{$.stopPropagation()},children:[k.jsxs("div",{className:"flex items-center justify-between mb-4",children:[k.jsx("h2",{className:"text-lg font-semibold text-white",children:y("withdraw.withdraw")}),k.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:k.jsx(Wd,{className:"h-4 w-4"})})]}),k.jsx(TP,{chains:s,address:ti(o)?o.smartWalletAddress:o.ethAddress,walletType:ti(o)?"mpc":"evm",defaultChainId:i,defaultTokenAddress:c,defaultAmount:a,metadata:u,currentEquity:l,platformBalance:d,fee:f,isLoading:t,wagmiHooks:p,onWithdraw:h,onClose:n,onChainChange:m,onTokenChange:w,onAmountChanged:T})]})})}),document.body):null};ie.ChromeLoader=Mo,ie.ComponentProvider=bm,ie.DEFAULT_LOCALE=Ro,ie.Deposit=_0,ie.DepositManager=k0,ie.LOCALE_NAMES=hm,ie.LoadingSpinner=Mo,ie.SUPPORTED_LOCALES=si,ie.Tooltip=Gn,ie.Withdraw=G0,ie.WithdrawManager=U0,ie.closeDeposit=L0,ie.closeWithdraw=H0,ie.formatThousands=wm,ie.isDepositLoading=D0,ie.isWithdrawLoading=V0,ie.openDeposit=M0,ie.openWithdraw=z0,ie.setDepositLoading=ei,ie.setWithdrawLoading=ni,ie.updateDepositOptions=R0,ie.updateWithdrawOptions=W0,ie.useComponentConfig=bu,ie.useDeposit=Qv,ie.useDepositManager=gP,ie.useTranslation=Ht,ie.useWithdraw=Jv,ie.useWithdrawManager=$P,Object.defineProperty(ie,Symbol.toStringTag,{value:"Module"})});
151
+ `,children:[t,o&&k.jsx(I0,{ref:d,placement:h.placement||n})]})})]})},ko="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIcSURBVHgBxZc/T8JAGMafA4mDEXFw0DiQmDi4CP5JHGFx0qizg8QvIHwCZHYAvwEm7mji5CJuJv7DxcWYYMLmIEYXY/R8j6tQaBvuaCm/pOlbSu99+rZ97zlgwDBowvNLCdrF6NJ50891OvNC+wrL3JShgZIAnl+JAj97FKXoMNLl7ySGnQDBHMtcVeFGAM8nKNlnlsI0eoIVuwlhzsmXqcwoURSFK1iVRCSdRDDn5PwC3cutingsJOK60nkiYE0unrdi8uFRIDwFBSJiTKOqzgKMl00teXgS2D0Fto+BiVkoIMYs8Xws4iiAkmeVn/n0oqyA2NQEQI4dytoKMEqfQt/haZmrQ4C8e7/4TtsI4JvwDbYDswCjvXr1yakQMXI2KxCD/8RMAtx2ux5gcjIzBAT8LH8bAQwYbwR8fUAb/vtuEsAr0OX5Eng8o30ZqN1BHzFLAkPGkb4AcdfnObigkbM5HdN3+Qb/ekGdrNu4CMyd8Ag6iElo/QBYzcpYByYsm8QkIFSADmI2nEkAc2sUL0ALHsxZBEjLxA+hSu22tb0+KV9Gd18027M2SybNQui+f53R6g/b+gDLVMi7YQsND+c5dTtzamlE0jiyJLwVYZhSqzO27YRSxFD8v1m4Q4xh74gdBUgRQm2QKsH0Ps82xEs9EndK3sgDlWGkW96naANqSzMSHSy4XprZi2kuTqN09VjrBH9AD4vTgfMHJt+rxIFF7EgAAAAASUVORK5CYII=",aP=(e,t)=>Number(e)>Number(t),Tt=e=>{if(!e||e===""||isNaN(Number(e)))return"0.00";const t=Number(e);if(t===0)return"0.00";let n=t.toString();n.includes("e")&&(n=t.toFixed(20));const r=n.split("."),o=r[0];let s=r[1]||"";return s.length>6&&(s=s.substring(0,6)),s=s.replace(/0+$/,""),s?(s.length===1&&(s+="0"),o+"."+s):o+".00"},ou=(e,t="0")=>{if(/[^0-9.]/.test(e))return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(e===".")return{isValid:!0,formattedValue:"0."};if((e.match(/\./g)||[]).length>1)return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(!e||e==="")return{isValid:!0,formattedValue:""};const o=e.split(".");if(o.length===2&&o[1].length>6){const a=o[0]+"."+o[1].substring(0,6);return ou(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:Tt(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},Js={ETHEREUM:1,ARBITRUM:42161,ARBITRUM_SEPOLIA:421614,SEPOLIA:11155111},cP=[Js.ETHEREUM,Js.SEPOLIA,Js.ARBITRUM,Js.ARBITRUM_SEPOLIA],uP=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!cP.includes(t)}return!0},lP=({currentActiveChain:e,selectedToken:t,address:n,onDeposit:r,onCopy:o,onClose:s})=>{const{t:i}=Ht(),c=v.useMemo(()=>uP(e||{}),[e]);return k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&k.jsx("div",{className:"bg-white rounded-lg",children:k.jsx(d0,{value:n,size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&k.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[k.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:n}),k.jsx(d5,{onCopy:()=>{o&&o(n)},text:n,children:k.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[k.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),k.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})},"copy")]}),k.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[k.jsxs("div",{className:"flex items-start",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:ko,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1",children:k.jsx("p",{className:"text-xs text-functional-orange-1",children:i("deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain})})})]}),c&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),k.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:i("deposit.depositTipFor25w")})]})]}),k.jsxs("div",{className:"text-sm",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[k.jsx("span",{className:"text-text-tertiary",children:i("deposit.arrivalTime")}),k.jsx(Gn,{content:k.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[k.jsx("p",{children:i("deposit.arrivaltimeTooltip1",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60,v1:e==null?void 0:e.txConfirm})}),k.jsx("p",{children:i("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:k.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed",children:i("deposit.arrivalEstimated",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60})})})]}),k.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[k.jsx("span",{className:"text-text-tertiary",children:i("deposit.minDeposit")}),k.jsxs("span",{className:"text-text-primary font-medium text-right",children:["10 ",t]})]}),k.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[k.jsx("span",{className:"text-text-tertiary",children:i("deposit.maxDeposit")}),k.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),k.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{r&&r({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t}),s()},children:i("deposit.title")})]})},Mo=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return k.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},fP=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=Tt(Math.max(0,s).toString());return k.jsxs("span",{className:"flex items-center gap-1",children:[Tt(e),k.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${Tt(e)} ${n}`},dP=(e,t,n)=>{if(!e||e===""||e==="0"||e==="0.00")return!1;const r=parseFloat(e),o=parseFloat(t);return!(isNaN(r)||isNaN(o)||r>o||!n)},pP=(e,t,n)=>{if(!Gh(e,n))return!1;try{const r=new Ae(t||"0"),o=new Ae("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},hP=(e,t,n)=>{let r=t||"0";if(Gh(e,n))try{const o=new Ae(r),s=new Ae("200000");o.gt(s)&&(r="200000")}catch(o){console.warn("Error calculating max amount limit:",o)}return r},B0={chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""},defaultChainId:1,platformBalance:"0"};let qe=null;const k0=v.forwardRef((e,t)=>{const[n,r]=v.useState(!1),[o,s]=v.useState(!1),[i,c]=v.useState(B0),a=v.useCallback(h=>{c(h),r(!0)},[]),u=v.useCallback(h=>{c(m=>({...m,...h}))},[]),l=v.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),d=v.useCallback(h=>{s(h)},[]),f=v.useCallback(()=>n,[n]),p=v.useCallback(()=>o,[o]);return v.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:d,isOpen:f,isLoading:p}),[a,l,u,d,f,p]),v.useEffect(()=>(qe={openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:d,isOpen:f,isLoading:p},()=>{qe=null}),[a,l,u,d,f,p]),n?k.jsx(_0,{isOpen:n,isLoading:o,onClose:l,currentActiveAccount:i.currentActiveAccount,chains:i.chains,defaultChainId:i.defaultChainId,platformBalance:i.platformBalance,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,onChainChange:h=>{var m;return(m=i.onChainChange)==null?void 0:m.call(i,h)},onTokenChange:h=>{var m;return(m=i.onTokenChange)==null?void 0:m.call(i,h)}}):null});k0.displayName="DepositManager";const M0=e=>{if(!qe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}qe.openDeposit(e||B0)},L0=()=>{if(!qe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}qe.closeDeposit()},R0=e=>{qe&&qe.updateDepositOptions(e)},ei=e=>{if(!qe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}qe.setDepositLoading(e)},mP=()=>qe?qe.isOpen():!1,D0=()=>qe?qe.isLoading():!1,gP=()=>({openDeposit:M0,closeDeposit:L0,updateDepositOptions:R0,setDepositLoading:ei,isOpen:mP,isLoading:D0}),bP=e=>{const{t}=Ht(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:c,minDeposit:a=10}=e;return v.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const u=parseFloat(r||"0"),l=dP(r,s||"0",o);return!r||u===0||!o?{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:u<a?{text:t("deposit.minDepositParsed",{amount:a,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!l,isNetworkSwitch:!1}},[n,r,o,s,i,c,a,t])};function yP(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:c,usePublicClient:a,useSwitchChain:u}=e.wagmiHooks,l=o==null?void 0:o.tokenAddress,d=(o==null?void 0:o.decimals)??18,f=o==null?void 0:o.contractAddress,p=!l||l.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=u(),{writeContractAsync:m}=c(),w=a(),T=i({address:l,abi:fr,functionName:"allowance",args:[$n(t||""),f],chainId:r,query:{enabled:!!(!p&&t&&r&&l&&f)}}),y=T!=null&&T.isSuccess?T.data:void 0,$=v.useMemo(()=>{if(p)return!0;if(!T.isSuccess||y===void 0||y===0n)return!1;try{const L=xw(String(Number(s||"0")||0),Number(d));return y>=L}catch{return!1}},[p,T.isSuccess,y,s,d]),M=v.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!m||!w||!l||!f)return;const F=$n(l),j=$n(f);if((y||0n)>0n){const A=await m({abi:fr,address:F,functionName:"approve",args:[j,0n]});await w.waitForTransactionReceipt({hash:A})}const x=await m({abi:fr,address:F,functionName:"approve",args:[j,Ul]});await w.waitForTransactionReceipt({hash:x}),T!=null&&T.refetch&&await T.refetch()}catch(L){console.error("[useApprove] onApprove failed:",L)}},[r,n,l,f,y,T,m,w,h]);return{approve:$,onApprove:M}}const wP=({token:e,account:t,chainId:n,wagmiHooks:r,onResult:o})=>{var i;const s=(i=r==null?void 0:r.useBalance)==null?void 0:i.call(r,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(r!=null&&r.useBalance)}});return v.useEffect(()=>{o($n(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},F0=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var T;const s=v.useMemo(()=>r.filter(y=>y.tokenAddress&&y.tokenAddress!=="0x0000000000000000000000000000000000000000"),[r]),[i,c]=v.useState({}),a=v.useCallback((y,$)=>{c(M=>({...M,[y]:$}))},[]),u=(T=o==null?void 0:o.useBalance)==null?void 0:T.call(o,{address:e,chainId:t,query:{enabled:!!e&&!!t&&!!(o!=null&&o.useBalance)}}),[l,d]=v.useState(0),f=v.useMemo(()=>s.map(y=>v.createElement(wP,{key:`${y.tokenAddress}-${l}`,token:y,account:e,chainId:t,contractAddress:n,wagmiHooks:o,onResult:a})),[s,e,t,n,o,a,l]),p=v.useMemo(()=>{const y=u!=null&&u.data?{value:u.data.value,formatted:u.data.formatted,decimals:u.data.decimals,symbol:u.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},$=s.map(L=>{const F=i[$n(L.tokenAddress)],j=F==null?void 0:F.balance,g=j==null?void 0:j.data;return{address:$n(L.tokenAddress),value:(g==null?void 0:g.value)||BigInt(0),formatted:(g==null?void 0:g.formatted)||"0",decimals:(g==null?void 0:g.decimals)||L.decimals}}).filter(L=>L.address),M=$.reduce((L,F)=>({...L,[F.address]:{balance:F}}),{});return{balanceList:$,baseTokenBalance:y,combinedData:M}},[u,i,s]),h=v.useCallback(async()=>p,[p]),m=v.useMemo(()=>{const y=(u==null?void 0:u.isLoading)||!1,$=Object.values(i).some(M=>{var L;return(L=M.balance)==null?void 0:L.isLoading});return y||$},[u==null?void 0:u.isLoading,i]),w=v.useCallback(()=>d(y=>y+1),[]);return{multicallRun:h,multicallRefresh:w,multicallResult:p,validErcTokens:s,isLoading:m,queryComponents:f}},vP=({address:e,currentActiveChain:t,selectedToken:n,platformBalance:r,isLoading:o,wagmiHooks:s,onChainChange:i,onDeposit:c})=>{const{t:a}=Ht(),u=s.useAccount(),l=t.tokenList.find(D=>D.token===n),d=t.chainId,[f,p]=v.useState("");v.useEffect(()=>{p("")},[n,t.chainId]);const{multicallResult:h,queryComponents:m}=F0({account:e,chainId:t.chainId,contractAddress:(l==null?void 0:l.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:s}),w=v.useMemo(()=>{var U;if(!l)return"0";if(!l.tokenAddress||l.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return h.baseTokenBalance.formatted;const D=h.combinedData[l.tokenAddress];return((U=D==null?void 0:D.balance)==null?void 0:U.formatted)||"0"},[l,h]),T="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",y="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",$=v.useMemo(()=>{var D,U;return ja({chain:_a,transport:pa(t.rpcUrl||((D=window==null?void 0:window.ENV)==null?void 0:D.CHAIN_RPC_URL_42161)||((U=window==null?void 0:window.ENV)==null?void 0:U.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),M="1000000000000",{formatted:L}=bs({client:$,tokenAddress:T,holder:y,decimals:6,fallbackFormatted:M,pollingInterval:12e3}),[F,j]=v.useState(!1),{approve:g,onApprove:x}=yP({account:e,accountChainId:u.chainId,targetChainId:+t.chainId,tokenInfo:l,amount:f,wagmiHooks:s}),A=v.useCallback(async()=>{if(!F)try{j(!0),await x()}catch(D){console.error("Approve failed:",D)}finally{j(!1)}},[F,x]),I=v.useMemo(()=>+u.chainId!=+t.chainId,[u.chainId,t.chainId]),N=v.useCallback(async()=>{i&&i(d)},[i,d]);v.useEffect(()=>{I&&N()},[I,N]);const{showLayerZeroTip:P,layerZeroTipKey:S}=v.useMemo(()=>{const D=+t.chainId==42161||+t.chainId==421614,U=(n==null?void 0:n.toUpperCase())==="USDT",_=new Ae(f||"0"),H=new Ae("200000");let K=!1,W;if(D&&U&&f)if(_.gte(H))K=!0,W="deposit.layerZeroDepositTipGte200k";else{const Z=L;if(typeof Z=="string"&&Z.length>0){const J=new Ae(Z);!J.isNaN()&&_.gte(J)&&(K=!0,W="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:K,layerZeroTipKey:W}},[t.chainId,n,f,L]),E=v.useCallback(()=>hP(+t.chainId,w||"0",n),[w,t==null?void 0:t.chainId,n]),C=v.useMemo(()=>pP(+t.chainId,f,n),[t==null?void 0:t.chainId,f,n]),O=bP({isNetworkMismatch:I,depositAmount:f,approved:g,currentTokenBalance:w,selectedToken:n,showLayerZeroTip:P,minDeposit:10}),b=D=>{const U=D.target.value,_=E(),H=ou(U,_);if(H.isValid)p(H.formattedValue),H.errorType;else return H.errorType==="exceed_balance",void 0},B=v.useCallback(async()=>{ei(!0);try{c&&c({amount:f,chainId:d,tokenAddress:(l==null?void 0:l.tokenAddress)||"",tokenSymbol:n})}catch(D){console.error("Deposit error:",D),ei(!1)}},[c,f,d,l==null?void 0:l.tokenAddress,n]);return k.jsxs(k.Fragment,{children:[m,k.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[k.jsx("input",{type:"text",placeholder:a("deposit.amount"),value:f,onChange:b,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),k.jsx("button",{onClick:()=>{const D=E();p(D)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:a("deposit.max")})]}),k.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),k.jsxs("div",{className:"flex justify-between items-center",children:[k.jsx(Gn,{content:a("deposit.availableDesc"),children:k.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:a("deposit.available")})}),k.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:fP(w||"0",f,n)})]})]}),!g&&aP(f||"0",0)&&k.jsxs("div",{className:"flex justify-center flex-col items-center",children:[k.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:a("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),k.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:a("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),k.jsx("button",{className:"w-[180px] h-8 bg-fill-btn-primary hover:bg-fill-btn-primary-hover text-text-on-sec-btn rounded-xl text-sm font-medium transition-colors my-4 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center",onClick:A,disabled:F,children:F?k.jsx(Mo,{size:"xs",inline:!0}):a("deposit.enableWithToken",{token:n})})]}),P&&k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:ko,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:a(S||"deposit.layerZeroDepositTip")})]}),k.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),C&&k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:ko,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:a("deposit.depositTipFor25w")})]}),C&&k.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:!(C||P)&&k.jsx("img",{src:ko,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:a("deposit.noPrivateKeyWalletWarning")})]}),k.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[k.jsx("span",{className:"text-sm text-text-tertiary",children:a("deposit.arrivalTime")}),k.jsx(Gn,{content:k.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[k.jsx("p",{children:a("deposit.arrivaltimeTooltip1",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60,v1:t==null?void 0:t.txConfirm})}),k.jsx("p",{children:a("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:k.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed text-sm",children:a("deposit.arrivalEstimated",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60})})})]}),k.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[k.jsx("span",{className:"text-sm text-text-tertiary",children:a("deposit.equity")}),k.jsx("span",{className:"text-sm text-text-primary font-medium",children:f?k.jsxs("span",{className:"flex items-center gap-1",children:[Tt(r),k.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),Tt((parseFloat(r)+parseFloat(f)).toString())," ",n]}):`${Tt(r)} ${n}`})]})]}),k.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${O.disabled||o?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:B,disabled:O.disabled||o,children:[(o||I)&&k.jsx(Mo,{size:"xs"}),O.text]})]})},j0=e=>e.toLocaleUpperCase()===Fn?Fn:Ua,ti=e=>j0(e.wallet)===Fn,xP=e=>j0(e.wallet)===Ua,_0=({isOpen:e,isLoading:t=!1,onClose:n,currentActiveAccount:r,chains:o,defaultChainId:s,platformBalance:i="0",wagmiHooks:c,onDeposit:a,onCopy:u,onChainChange:l,onTokenChange:d})=>{const{t:f}=Ht(),[p,h]=v.useState(()=>{var M;return!o||o.length===0?1:s||((M=o[0])==null?void 0:M.chainId)||1}),m=o.find(M=>M.chainId===p)||o[0],[w,T]=v.useState(()=>{var j;if(!o||o.length===0)return"";const M=s||((j=o[0])==null?void 0:j.chainId),L=o.find(g=>g.chainId===M);if(!L||!L.tokenList||L.tokenList.length===0)return"";const F=L.tokenList[0];return(F==null?void 0:F.token)||""}),y=v.useCallback(M=>{h(M),l==null||l(M)},[l]),$=v.useCallback(M=>{T(M),d==null||d(M)},[d]);return e?Le.createPortal(k.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:k.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[49] flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onClick:()=>{n()},"aria-hidden":"true",children:k.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:M=>{M.stopPropagation()},children:[k.jsxs("div",{className:"flex items-center justify-between mb-4",children:[k.jsx("h2",{className:"text-lg font-semibold text-white",children:f("deposit.title")}),k.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:k.jsx(Wd,{className:"h-4 w-4"})})]}),k.jsx(qh,{currentActiveChain:m,chainList:o,onChainChange:y,curSelectToken:w,onTokenChange:$,walletType:ti(r)?Fn:Ua}),ti(r)&&k.jsx(lP,{address:r.smartWalletAddress,currentActiveChain:m,selectedToken:w,onDeposit:a,onCopy:u,onClose:n}),xP(r)&&k.jsx(vP,{address:r.ethAddress,currentActiveChain:m,selectedToken:w,platformBalance:i,isLoading:t,wagmiHooks:c,onChainChange:y,onDeposit:a,onClose:n})]})})}),document.body):null},EP=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",walletType:i="evm",receiverAddress:c="",onWithdrawAmountChange:a,onReceiverAddressChange:u,onAmountChanged:l,showPoolBalanceInsufficientTip:d=!1})=>{const{t:f}=Ht(),p=v.useMemo(()=>{if(!Ge(r==null?void 0:r.chainId)){const $=new Ae(e||"0").minus(s||"0").decimalPlaces(2,Ae.ROUND_DOWN);return $.isNegative()?"0.00":$.toString()}return e||"0"},[e,s,r==null?void 0:r.chainId]),h=v.useMemo(()=>o||"0",[o]),m=v.useMemo(()=>{const $=(n==null?void 0:n.feeRate)||(r==null?void 0:r.feeRate)||0;try{return new Ae($||0).times(100).toString()}catch{return"0"}},[n==null?void 0:n.feeRate,r==null?void 0:r.feeRate]),w=$=>{const M=$.target.value,F=ou(M,h||"0");if(F.isValid)a(F.formattedValue),F.errorType;else return F.errorType==="exceed_balance",void 0;l==null||l(F.formattedValue)},T=()=>{a(h),l==null||l(h)},y=()=>{const $=parseFloat(o||"0"),M=parseFloat(e||"0");if(M>0){const L=$-M,F=Tt(Math.max(0,L).toString());return k.jsxs("span",{className:"flex items-center gap-1",children:[Tt(o||"0"),k.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),F," ",t]})}return`${Tt(o||"0")} ${t}`};return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[k.jsx("input",{type:"text",placeholder:f("deposit.amount"),value:e,onChange:w,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),k.jsx("button",{onClick:T,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:f("deposit.max")})]}),k.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),k.jsxs("div",{className:"flex justify-between items-center",children:[k.jsx(Gn,{content:f("withdraw.availableDesc"),children:k.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:f("deposit.available")})}),k.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:y()})]})]}),i==="mpc"&&!Ge(r==null?void 0:r.chainId)&&k.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:k.jsx("input",{type:"text",placeholder:f("withdraw.receiverAddress"),value:c,onChange:$=>u==null?void 0:u($.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"})}),k.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:Ge(r==null?void 0:r.chainId)?k.jsxs(k.Fragment,{children:[k.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:f("withdraw.noticeDesc")}),k.jsx("a",{className:"block text-xs leading-[18px] mt-1 text-theme-normal",href:"https://edgex-1.gitbook.io/edgeX-documentation/getting-started/deposits-and-withdrawals/withdrawals",rel:"noreferrer",target:"_blank",children:f("withdraw.commonWithdraw")})]}):k.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:f("withdraw.crossChainTips")})}),d&&k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:ko,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:f("withdraw.poolBalanceInsufficientTip")})]}),k.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[k.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[k.jsx(Gn,{content:k.jsxs("div",{children:[k.jsx("div",{children:f("withdraw.speedNote")}),k.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[k.jsx(No,{selectedLevel:$t.FAST,maxLevel:3}),k.jsx("span",{children:f("withdraw.speedNoteSpeed1")})]}),k.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[k.jsx(No,{selectedLevel:$t.Medium,maxLevel:3}),k.jsx("span",{children:f("withdraw.speedNoteSpeed2")})]}),k.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[k.jsx(No,{selectedLevel:$t.SLOW,maxLevel:3}),k.jsx("span",{children:f("withdraw.speedNoteSpeed3")})]})]}),children:k.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:f("withdraw.speed")})}),k.jsx("div",{className:"flex items-center",children:k.jsx(No,{selectedLevel:Ge(r==null?void 0:r.chainId)?$t.SLOW:$t.FAST,maxLevel:3})})]}),!Ge(r==null?void 0:r.chainId)&&k.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[k.jsx(Gn,{content:f("withdraw.feeCalculationTip"),children:k.jsxs("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:[f("withdraw.fee"),"/",f("withdraw.feeRate")]})}),k.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t," / ",m,"%"]})]}),k.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[k.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:f(Ge(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),k.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[Tt(p)," ",t]})]})]})]})},SP=[],PP={};let Ze=null;const U0=v.forwardRef((e,t)=>{const[n,r]=v.useState(!1),[o,s]=v.useState(!1),[i,c]=v.useState({chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),a=v.useCallback(h=>{c(h||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),r(!0)},[]),u=v.useCallback(h=>{c(m=>({...m,...h}))},[]),l=v.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),d=v.useCallback(h=>{s(h)},[]),f=v.useCallback(()=>n,[n]),p=v.useCallback(()=>o,[o]);return v.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:d,isOpen:f,isLoading:p}),[a,l,u,d,f,p]),v.useEffect(()=>(Ze={openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:d,isOpen:f,isLoading:p},()=>{Ze=null}),[a,l,u,d,f,p]),n?k.jsx(G0,{isOpen:n,isLoading:o,onClose:l,config:i.config||{symbol:"USDT"},currentActiveAccount:i.currentActiveAccount,chains:i.chains||SP,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,defaultAmount:i.defaultAmount,metadata:i.metadata||PP,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged}):null});U0.displayName="WithdrawManager";const z0=e=>{if(!Ze){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ze.openWithdraw(e||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}})},H0=()=>{if(!Ze){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ze.closeWithdraw()},W0=e=>{if(!Ze){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ze.updateWithdrawOptions(e)},ni=e=>{if(!Ze){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ze.setWithdrawLoading(e)},AP=()=>Ze?Ze.isOpen():!1,V0=()=>Ze?Ze.isLoading():!1,$P=()=>({openWithdraw:z0,closeWithdraw:H0,updateWithdrawOptions:W0,setWithdrawLoading:ni,isOpen:AP,isLoading:V0}),TP=({address:e,walletType:t,chains:n,defaultChainId:r,defaultTokenAddress:o,defaultAmount:s="",metadata:i,currentEquity:c,platformBalance:a="0",fee:u="0.00",isLoading:l=!1,wagmiHooks:d,onWithdraw:f,onClose:p,onChainChange:h,onTokenChange:m,onAmountChanged:w})=>{var Me;const{t:T}=Ht(),y=v.useMemo(()=>{const Y=[56,97],ee=me=>n==null?void 0:n.find(de=>Number(de==null?void 0:de.chainId)===me),Q=ee(Y[0])||ee(Y[1]);return Q==null?void 0:Q.rpcUrl},[n]),$=v.useMemo(()=>{const Y=[42161,421614],ee=me=>n==null?void 0:n.find(de=>Number(de==null?void 0:de.chainId)===me),Q=ee(Y[0])||ee(Y[1]);return Q==null?void 0:Q.rpcUrl},[n]),M=v.useMemo(()=>{var qn,Je;const Y="USDC";if(!n||n.length===0)return{chainId:1,tokenSymbol:""};const ee=Zn=>Array.isArray(Zn.tokenList)&&Zn.tokenList.some(ri=>(ri.token||ri.symbol||"").toUpperCase()===Y),Q=n.find(ee)||n[0];if(!Q||!Array.isArray(Q.tokenList)||Q.tokenList.length===0)return{chainId:(Q==null?void 0:Q.chainId)||1,tokenSymbol:""};const me=Q.tokenList.find(Zn=>(Zn.token||Zn.symbol||"").toUpperCase()===Y),de=(me==null?void 0:me.token)||(me==null?void 0:me.symbol)||((qn=Q.tokenList[0])==null?void 0:qn.token)||((Je=Q.tokenList[0])==null?void 0:Je.symbol)||"";return{chainId:Q.chainId,tokenSymbol:de}},[n]),{ARB_USDC_BALANCE:L,ARB_USDT_BALANCE:F,BNB_USDT_BALANCE:j}=Xv({bscRpcUrl:y,arbitrumRpcUrl:$}),[g,x]=v.useState(()=>M.chainId),[A,I]=v.useState(()=>M.tokenSymbol),[N,P]=v.useState(s),[S,E]=v.useState(""),C=v.useCallback(Y=>{x(Y),h==null||h(Y)},[h]),O=v.useCallback(Y=>{I(Y),m==null||m(Y)},[m]),b=v.useRef(!0),B=v.useRef(A),D=v.useRef(g);v.useEffect(()=>{if(b.current){b.current=!1,B.current=A,D.current=g;return}(B.current!==A||D.current!==g)&&(P(""),B.current=A,D.current=g)},[A,g]);const U=n&&n.length>0?n.find(Y=>Y.chainId===g)||n[0]:null,_=(Me=U==null?void 0:U.tokenList)==null?void 0:Me.find(Y=>Y.token===A),{multicallResult:H,queryComponents:K}=F0({account:e,chainId:g,contractAddress:void 0,tokens:(U==null?void 0:U.tokenList)||[],wagmiHooks:d}),W=v.useMemo(()=>{var ee;if(!_)return;if(!_.tokenAddress||_.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return H.baseTokenBalance.formatted;const Y=H.combinedData[_.tokenAddress];return((ee=Y==null?void 0:Y.balance)==null?void 0:ee.formatted)||"0"},[_,H]),Z=Y=>{if(!Y)return"0";const ee=Y.indexOf(".");return ee>=0?Y.slice(0,ee):Y},G=v.useMemo(()=>{const Y=(A||"").toUpperCase(),ee=Number(g),Q=me=>{const de=Z(me);try{const Je=new Ae(de||"0").minus(1e4);return Je.isGreaterThan(0)?Je.toFixed(0):"0"}catch{return"0"}};if(Ge(ee))return"∞";if(ee===42161||ee===421614){if(Y==="USDT")return Q(F);if(Y==="USDC")return Q(L)}return(ee===56||ee===97)&&Y==="USDT"?Q(j):"0"},[g,A,L,F,j]),J=v.useMemo(()=>{if(Ge(g))return!1;try{const Y=new Ae(N||"0"),ee=new Ae((G||"0").toString());return Y.isGreaterThan(ee)}catch{return!1}},[g,N,G]),ne=v.useMemo(()=>{const Y={},ee=(A||"").toUpperCase(),Q=me=>{const de=Z(me);try{const Je=new Ae(de||"0").minus(1e4);return Je.isGreaterThan(0)?Je.toFixed(0):"0"}catch{return"0"}};return(n||[]).forEach(me=>{const de=Number(me==null?void 0:me.chainId);if(de){if(Ge(de)){Y[de]="∞";return}if(de===42161||de===421614){ee==="USDT"?Y[de]=Q(F):ee==="USDC"?Y[de]=Q(L):Y[de]="0";return}if(de===56||de===97){ee==="USDT"?Y[de]=Q(j):Y[de]="0";return}Y[de]="0"}}),Y},[n,A,L,F,j]),le=v.useMemo(()=>{const Y=new Ae(N||"0"),ee=new Ae(u||"0"),Q=Ge(g);let me=!1;if(!Q)try{const de=new Ae((G||"0").toString());me=Y.isGreaterThan(de)}catch{me=!1}return!N||Y.isZero()||!Q&&Y.isLessThan(ee)||!Q&&me?{text:T("withdraw.confirmWithdraw"),disabled:!0}:t==="mpc"&&!Q&&!S.trim()?{text:T("withdraw.invalidReceiverAddress"),disabled:!0}:{text:T("withdraw.confirmWithdraw"),disabled:!1}},[T,g,N,t,S,u,G]),Se=v.useCallback(async()=>{ni(!0);try{if(f){const ee={amount:new Ae(N||"0").toString(),chainId:g,tokenAddress:(_==null?void 0:_.tokenAddress)||"",tokenSymbol:A};t==="mpc"&&!Ge(g)&&(ee.receiverAddress=S),f(ee)}}catch{ni(!1)}},[f,N,g,_==null?void 0:_.tokenAddress,A,t,S]);return!n||n.length===0?k.jsx("div",{className:"text-center py-8",children:k.jsx("p",{className:"text-gray-400",children:"No chains available"})}):U?k.jsxs(k.Fragment,{children:[K,k.jsx(qh,{currentActiveChain:U,chainList:n,chainPoolBalances:ne,onChainChange:C,curSelectToken:A,onTokenChange:O,walletType:"EVM",txType:"withdraw"}),k.jsxs("div",{className:"p-3 my-4 bg-fill-input-primary rounded-lg flex items-center justify-between h-[38px]",children:[k.jsx("div",{className:"text-text-secondary text-sm",children:Ge(g)?T("withdraw.poolBalance"):T("withdraw.crossChainPoolBalance")}),k.jsxs("div",{className:"text-text-primary text-sm font-medium",children:[G," ",A]})]}),k.jsx(EP,{withdrawAmount:N,curSelectToken:A,tokenInfo:_,curSelectTokenData:{balance:_==null?void 0:_.balance,allowance:_==null?void 0:_.allowance},currentActiveChain:U,currentEquity:c||0,amount:N,decimals:(_==null?void 0:_.decimals)||6,tokenBalance:W,platformBalance:a,fee:u,walletType:t,receiverAddress:S,onWithdrawAmountChange:P,onReceiverAddressChange:E,onAmountChanged:w,showPoolBalanceInsufficientTip:J,poolBalanceMap:ne}),k.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${le.disabled||l?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:Se,disabled:le.disabled||l,children:[l&&k.jsx(Mo,{size:"xs"}),le.text]})]}):k.jsx("div",{className:"text-center py-8",children:k.jsx("p",{className:"text-gray-400",children:"Loading..."})})},G0=({isOpen:e,isLoading:t=!1,onClose:n,config:r,currentActiveAccount:o,chains:s,defaultChainId:i,defaultTokenAddress:c,defaultAmount:a="",metadata:u,currentEquity:l=5e3,platformBalance:d="0",fee:f,wagmiHooks:p,onWithdraw:h,onChainChange:m,onTokenChange:w,onAmountChanged:T})=>{const{t:y}=Ht();return e?Le.createPortal(k.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:k.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[49] flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onClick:()=>{n()},"aria-hidden":"true",children:k.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:$=>{$.stopPropagation()},children:[k.jsxs("div",{className:"flex items-center justify-between mb-4",children:[k.jsx("h2",{className:"text-lg font-semibold text-white",children:y("withdraw.withdraw")}),k.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:k.jsx(Wd,{className:"h-4 w-4"})})]}),k.jsx(TP,{chains:s,address:ti(o)?o.smartWalletAddress:o.ethAddress,walletType:ti(o)?"mpc":"evm",defaultChainId:i,defaultTokenAddress:c,defaultAmount:a,metadata:u,currentEquity:l,platformBalance:d,fee:f,isLoading:t,wagmiHooks:p,onWithdraw:h,onClose:n,onChainChange:m,onTokenChange:w,onAmountChanged:T})]})})}),document.body):null};ie.ChromeLoader=Mo,ie.ComponentProvider=bm,ie.DEFAULT_LOCALE=Ro,ie.Deposit=_0,ie.DepositManager=k0,ie.LOCALE_NAMES=hm,ie.LoadingSpinner=Mo,ie.SUPPORTED_LOCALES=si,ie.Tooltip=Gn,ie.Withdraw=G0,ie.WithdrawManager=U0,ie.closeDeposit=L0,ie.closeWithdraw=H0,ie.formatThousands=wm,ie.isDepositLoading=D0,ie.isWithdrawLoading=V0,ie.openDeposit=M0,ie.openWithdraw=z0,ie.setDepositLoading=ei,ie.setWithdrawLoading=ni,ie.updateDepositOptions=R0,ie.updateWithdrawOptions=W0,ie.useComponentConfig=bu,ie.useDeposit=Qv,ie.useDepositManager=gP,ie.useTranslation=Ht,ie.useWithdraw=Jv,ie.useWithdrawManager=$P,Object.defineProperty(ie,Symbol.toStringTag,{value:"Module"})});
152
152
  //# sourceMappingURL=index.umd.js.map