@aori/mega-swap-widget 0.1.1 → 0.1.2

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.
Files changed (30) hide show
  1. package/README.md +9 -1
  2. package/dist/AssetSelectionMenu-4E576X3D.cjs +2 -0
  3. package/dist/AssetSelectionMenu-ZFY7XFRX.js +2 -0
  4. package/dist/ChainSelectionMenu-SKXLHK3S.js +2 -0
  5. package/dist/ChainSelectionMenu-VU3SIBVL.cjs +2 -0
  6. package/dist/{SwapFormHorizontal-XMZKEAIL.js → SwapFormHorizontal-GI4X7ISS.js} +1 -1
  7. package/dist/{SwapFormHorizontal-ACRBI6GC.cjs → SwapFormHorizontal-V557YBX2.cjs} +1 -1
  8. package/dist/{SwapFormSplit-SOC2XMBW.js → SwapFormSplit-52RBMJIO.js} +1 -1
  9. package/dist/{SwapFormSplit-XHAGOXQX.cjs → SwapFormSplit-PQCS3BPT.cjs} +1 -1
  10. package/dist/{WidgetWalletPanel-KZFLFLUD.js → WidgetWalletPanel-XYV3YL4I.js} +1 -1
  11. package/dist/{WidgetWalletPanel-FQDNFYFL.cjs → WidgetWalletPanel-YBMN5KZH.cjs} +1 -1
  12. package/dist/{chunk-F7IECVJU.js → chunk-4BQRVCQR.js} +1 -1
  13. package/dist/{chunk-Z2BLIAFE.js → chunk-4LJJMEOG.js} +1 -1
  14. package/dist/{chunk-JSWDMAZQ.js → chunk-726CI6GC.js} +1 -1
  15. package/dist/{chunk-XUTR7YYC.cjs → chunk-DUIRZSBV.cjs} +1 -1
  16. package/dist/{chunk-CHDFHEPH.js → chunk-EW2OR6CJ.js} +1 -1
  17. package/dist/{chunk-TWJY6EY4.js → chunk-FDQKBTWP.js} +1 -1
  18. package/dist/{chunk-E44WNKS4.cjs → chunk-HTWUZKYO.cjs} +1 -1
  19. package/dist/{chunk-BX3KCZRT.cjs → chunk-LXEKOQAG.cjs} +1 -1
  20. package/dist/{chunk-NQ4QSGGF.cjs → chunk-MCT3UZTP.cjs} +1 -1
  21. package/dist/{chunk-537OMWA3.cjs → chunk-UZWGYG2S.cjs} +1 -1
  22. package/dist/{chunk-4XEJKRRM.js → chunk-XYF2YBR3.js} +1 -1
  23. package/dist/{chunk-C3X6NJIB.cjs → chunk-XZRXVBSB.cjs} +1 -1
  24. package/dist/index.cjs +2 -2
  25. package/dist/index.js +1 -1
  26. package/package.json +1 -1
  27. package/dist/AssetSelectionMenu-INISSBWT.js +0 -2
  28. package/dist/AssetSelectionMenu-ZT2PDBHV.cjs +0 -2
  29. package/dist/ChainSelectionMenu-N65VG257.js +0 -2
  30. package/dist/ChainSelectionMenu-URYJUECJ.cjs +0 -2
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{e as g}from"./chunk-4XEJKRRM.js";import{f as y}from"./chunk-JSWDMAZQ.js";import{P as m,X as f,b as w}from"./chunk-CHDFHEPH.js";import E,{useEffect as $,useState as j}from"react";import{jsx as e,jsxs as t}from"react/jsx-runtime";function x(a){if(a===0)return"0";let o=Math.abs(a);return o>=1e4?a.toFixed(0):o>=1e3?a.toFixed(1):o>=100?a.toFixed(2):o>=1?a.toFixed(4):o>=.01?a.toFixed(6):a.toExponential(3)}var N=E.memo(()=>{let[a,o]=j(!1),{liquidityError:b,routingError:h}=g(),{baseAmount:r,baseToken:s,quoteAmount:l,quoteToken:i}=y(),{quoteLoaderVariant:p,widgetType:F}=w(),u=F==="compact",n=r&&l&&parseFloat(l.toString())?parseFloat(r.toString())/parseFloat(l.toString()):0,v=b||h,c=s&&i&&r&&parseFloat(r.toString())&&l;return $(()=>{p==="expanded"&&c&&o(!0)},[p,c]),p==="none"?null:p==="default"?e("div",{className:`relative box-border flex flex-row pt-1 h-8 w-full items-center${u?" justify-start overflow-x-auto":" justify-center"}`,children:e("div",{className:`flex h-full items-center${u?" min-w-max":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&i?r&&parseFloat(r.toString())?l?t("div",{className:"translate-y-px font-mono flex flex-row items-center gap-2 whitespace-nowrap",children:[t("div",{className:"flex flex-row items-center gap-1",children:[e(m,{asset:i,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",children:["1 ",i?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),t("div",{className:"flex flex-row items-center gap-1",children:[e(m,{asset:s,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",children:[x(n)," ",s?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:s?.price?`\u2248 $${(s.price*n).toFixed(2)}`:""})]}):v?t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),e(f,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),e(f,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"})})}):t("div",{className:"flex flex-col w-full",children:[e("div",{className:`relative box-border flex flex-row pt-1 h-8 w-full items-center cursor-pointer${u?" overflow-x-auto":""}`,role:"button",tabIndex:0,onClick:()=>c&&o(d=>!d),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),c&&o(S=>!S))},children:e("div",{className:`flex h-full items-center${u?" min-w-max overflow-x-auto":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&i?r&&parseFloat(r.toString())?l?t("div",{className:"translate-y-px font-mono flex w-full flex-row items-center justify-between",children:[t("div",{className:"flex flex-row items-center gap-2 whitespace-nowrap",children:[t("div",{className:"flex flex-row items-center gap-1",children:[e(m,{asset:i,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",children:["1 ",i?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),t("div",{className:"flex flex-row items-center gap-1",children:[e(m,{asset:s,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",children:[x(n)," ",s?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:s?.price?`\u2248 $${(s.price*n).toFixed(2)}`:""})]}),e("span",{className:"text-xs ml-2 transition-transform duration-200 shrink-0",style:{color:"var(--widget-muted-foreground)",transform:a?"rotate(180deg)":"rotate(0deg)",display:"inline-block"},children:"\u25BE"})]}):v?t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),e(f,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),e(f,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"})})}),e("div",{className:"overflow-hidden transition-all duration-200",style:{maxHeight:a&&c?"80px":"0px",opacity:a&&c?1:0},children:t("div",{className:"flex flex-col gap-0.5 pb-1 font-mono",children:[t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"USD Value"}),t("span",{children:["$",s?.price&&l?(s.price*n*parseFloat(l.toString())).toFixed(2):"\u2014"]})]}),t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Rate"}),e("span",{className:"uppercase",children:n>0?`${x(n)} ${s?.symbol??""}`:"\u2014"})]}),t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Order Type"}),e("span",{children:"RFQ (Exact Fill)"})]})]})})]})});N.displayName="QuoteLoader";var R=N;export{R as a};
2
+ import{e as g}from"./chunk-XYF2YBR3.js";import{f as y}from"./chunk-726CI6GC.js";import{P as m,X as f,b as w}from"./chunk-EW2OR6CJ.js";import E,{useEffect as $,useState as j}from"react";import{jsx as e,jsxs as t}from"react/jsx-runtime";function x(a){if(a===0)return"0";let o=Math.abs(a);return o>=1e4?a.toFixed(0):o>=1e3?a.toFixed(1):o>=100?a.toFixed(2):o>=1?a.toFixed(4):o>=.01?a.toFixed(6):a.toExponential(3)}var N=E.memo(()=>{let[a,o]=j(!1),{liquidityError:b,routingError:h}=g(),{baseAmount:r,baseToken:s,quoteAmount:l,quoteToken:i}=y(),{quoteLoaderVariant:p,widgetType:F}=w(),u=F==="compact",n=r&&l&&parseFloat(l.toString())?parseFloat(r.toString())/parseFloat(l.toString()):0,v=b||h,c=s&&i&&r&&parseFloat(r.toString())&&l;return $(()=>{p==="expanded"&&c&&o(!0)},[p,c]),p==="none"?null:p==="default"?e("div",{className:`relative box-border flex flex-row pt-1 h-8 w-full items-center${u?" justify-start overflow-x-auto":" justify-center"}`,children:e("div",{className:`flex h-full items-center${u?" min-w-max":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&i?r&&parseFloat(r.toString())?l?t("div",{className:"translate-y-px font-mono flex flex-row items-center gap-2 whitespace-nowrap",children:[t("div",{className:"flex flex-row items-center gap-1",children:[e(m,{asset:i,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",children:["1 ",i?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),t("div",{className:"flex flex-row items-center gap-1",children:[e(m,{asset:s,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",children:[x(n)," ",s?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:s?.price?`\u2248 $${(s.price*n).toFixed(2)}`:""})]}):v?t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),e(f,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),e(f,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"})})}):t("div",{className:"flex flex-col w-full",children:[e("div",{className:`relative box-border flex flex-row pt-1 h-8 w-full items-center cursor-pointer${u?" overflow-x-auto":""}`,role:"button",tabIndex:0,onClick:()=>c&&o(d=>!d),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),c&&o(S=>!S))},children:e("div",{className:`flex h-full items-center${u?" min-w-max overflow-x-auto":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&i?r&&parseFloat(r.toString())?l?t("div",{className:"translate-y-px font-mono flex w-full flex-row items-center justify-between",children:[t("div",{className:"flex flex-row items-center gap-2 whitespace-nowrap",children:[t("div",{className:"flex flex-row items-center gap-1",children:[e(m,{asset:i,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",children:["1 ",i?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),t("div",{className:"flex flex-row items-center gap-1",children:[e(m,{asset:s,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",children:[x(n)," ",s?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:s?.price?`\u2248 $${(s.price*n).toFixed(2)}`:""})]}),e("span",{className:"text-xs ml-2 transition-transform duration-200 shrink-0",style:{color:"var(--widget-muted-foreground)",transform:a?"rotate(180deg)":"rotate(0deg)",display:"inline-block"},children:"\u25BE"})]}):v?t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),e(f,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),e(f,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"})})}),e("div",{className:"overflow-hidden transition-all duration-200",style:{maxHeight:a&&c?"80px":"0px",opacity:a&&c?1:0},children:t("div",{className:"flex flex-col gap-0.5 pb-1 font-mono",children:[t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"USD Value"}),t("span",{children:["$",s?.price&&l?(s.price*n*parseFloat(l.toString())).toFixed(2):"\u2014"]})]}),t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Rate"}),e("span",{className:"uppercase",children:n>0?`${x(n)} ${s?.symbol??""}`:"\u2014"})]}),t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Order Type"}),e("span",{children:"RFQ (Exact Fill)"})]})]})})]})});N.displayName="QuoteLoader";var R=N;export{R as a};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{c as p,f as re}from"./chunk-JSWDMAZQ.js";import{F as Z,G as ee,H as te,L as se,O as ae,P as N,_ as ne,b as Y,g as K,k as A,w as x,x as J,z as X}from"./chunk-CHDFHEPH.js";import{a as oe}from"./chunk-46H44R7V.js";import $,{useCallback as ie,useEffect as ke,useMemo as z}from"react";import{useShallow as Ae}from"zustand/react/shallow";import Ce from"react";import{jsx as I,jsxs as T}from"react/jsx-runtime";var H=Ce.memo(({asset:n,otherAsset:i,handleFormSelection:S,getToken:G})=>{let{token:g}=te(n.chainId,n.address),C=G(n.chainId,n.address),a=g||C||n.assetInfo;if(!a)return null;let f=a.price!=null&&n.decimals!==void 0?x(a,n.balance,n.decimals):null;return T("button",{type:"button",className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>S(a,i),children:[T("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[I(N,{asset:a,size:"md",className:"flex-shrink-0"}),T("div",{className:"flex flex-col items-start min-w-0 flex-1",children:[I("span",{className:"text-base font-medium",style:{color:"var(--widget-foreground)"},children:a.symbol.length>20?`${a.symbol.substring(0,20)}...`:a.symbol}),I("span",{className:"text-sm",style:{color:"var(--widget-foreground)",opacity:.6},children:a.name.length>20?`${a.name.substring(0,20)}...`:a.name})]})]}),T("div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[I("span",{className:"text-xs font-mono",style:{color:"var(--widget-foreground)",opacity:.5},children:"Balance:"}),I("span",{className:"text-xs font-mono",style:{color:"var(--widget-foreground)"},children:f!=null?`$${f.toFixed(2)}`:"\u2014"})]})]},`${a.chainId}-${a.address}`)},(n,i)=>n.asset.address===i.asset.address&&n.asset.chainId===i.asset.chainId&&n.asset.balance===i.asset.balance&&n.asset.assetInfo?.price===i.asset.assetInfo?.price&&n.otherAsset.address===i.otherAsset.address);H.displayName="AssetSelectionBalanceItem";import{jsx as o,jsxs as m}from"react/jsx-runtime";var Ne=({toggle:n,side:i,otherAsset:S,containerHeight:G,onChainHover:g,onMoreChainsClick:C,selectedChainFilter:a})=>{let{address:_}=oe(),{assetSelectionSearch:f,assetSelectionChain:c,assetSelectionCategory:le,recentChainIds:W}=p(Ae(e=>({assetSelectionSearch:e.assetSelectionSearch,assetSelectionChain:e.assetSelectionChain,assetSelectionCategory:e.assetSelectionCategory,recentChainIds:e.recentChainIds}))),L=X(f,300),b=ne(),{supportedInputTokens:de,supportedOutputTokens:ce,supportedInputChains:ue,supportedOutputChains:me,inputSelectionSearch:fe,outputSelectionSearch:pe,showInputSelectionTokenBalances:he,showOutputSelectionTokenBalances:ge}=Y(),we=i==="base"?fe:pe,be=i==="base"?he:ge,{setBaseToken:q,setQuoteToken:V}=re(),y=i==="base"?de:ce,w=i==="base"?ue:me,B=w.length===1,v=z(()=>{if(y.length===0)return null;let e=new Set;for(let t of y)e.add(`${t.chainId}-${t.address.toLowerCase()}`);return e},[y]);ke(()=>{B?p.getState().setAssetSelectionChain(w[0]):a&&p.getState().setAssetSelectionChain(a)},[a,B,w]);let ye=$.useMemo(()=>{let r=w.length>0?new Set(w):null,s=K(b).filter(l=>!r||r.has(l.id)).map(l=>({chainId:l.id,name:l.displayName})),d=new Map(s.map(l=>[l.chainId,l])),u=[],h=new Set,Q=d.get(4326);Q&&(u.push(Q),h.add(4326));for(let l of W){if(u.length>=5)break;if(h.has(l))continue;let U=d.get(l);U&&(u.push(U),h.add(l))}for(let l of s){if(u.length>=5)break;h.has(l.chainId)||u.push(l)}return u},[b,W,w]),{enrichedTokens:M,isLoading:ve}=ee(c==="all"?"all":c),{tokenRegistry:j,getToken:D}=Z(),xe=z(()=>{let e=new Set;for(let t of j)e.add(`${t.chainId}-${t.address.toLowerCase()}`);return e},[j]),E=z(()=>v?M.filter(e=>v.has(`${e.chainId}-${e.address.toLowerCase()}`)):M,[M,v]),R=$.useMemo(()=>{if(!L)return E;let e=L.toLowerCase();return E.filter(t=>(t.symbol||"").toLowerCase().includes(e)||(t.name||"").toLowerCase().includes(e)||t.address.toLowerCase().includes(e))},[E,L]),O=$.useMemo(()=>{let e=c==="all"?(R||[]).filter(s=>b.includes(s.chainId)):R||[],t=new Set;return[...e.filter(s=>{let d=`${s.chainId}-${s.address.toLowerCase()}`;return t.has(d)?!1:(t.add(d),!0)})].sort((s,d)=>{let u=A(s),h=A(d);return u&&!h?-1:!u&&h?1:s.marketCap&&!d.marketCap?-1:!s.marketCap&&d.marketCap?1:!s.marketCap&&!d.marketCap?0:d.marketCap-s.marketCap})},[R,c,b]),{balances:k,isLoading:Ie}=se(_,b,void 0,y.length>0?y:void 0),P=$.useMemo(()=>{if(!k)return[];let e=c==="all"?k:k.filter(r=>r.chainId===c),t=new Set;return e.filter(r=>{let s=`${r.chainId}-${(r.address||"").toLowerCase()}`;return t.has(s)?!1:(t.add(s),!0)})},[k,c]),Se=ie(e=>{let t=e.target.value.toLowerCase(),r=J(t),s=p.getState();r?(s.setAssetSelectionSearch(r),s.setAssetSelectionAddressInput(r)):(s.setAssetSelectionAddressInput(""),s.setAssetSelectionSearch(t))},[]),F=ie(async e=>{i==="base"?await q(e):i==="quote"&&await V(e),n()},[n,i,q,V]);return m("div",{className:"w-full h-full flex flex-col pt-2.5",children:[!B&&m("div",{className:"flex flex-row justify-between py-1 flex-shrink-0 h-10",children:[o("button",{type:"button",className:"flex flex-row items-center w-full h-full px-2.5 whitespace-nowrap font-bold uppercase text-xs cursor-pointer",style:{backgroundColor:c==="all"&&!a?"var(--widget-primary)":"var(--widget-secondary)",color:c==="all"&&!a?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)",borderRadius:"var(--widget-radius) 0 0 var(--widget-radius)"},onClick:e=>{e.stopPropagation(),p.getState().setAssetSelectionChain("all")},onMouseEnter:()=>g?.("All Chains"),onMouseLeave:()=>g?.(null),children:"All"}),ye.map((e,t)=>o("button",{type:"button",className:"flex items-center justify-center px-2 w-full cursor-pointer",style:{backgroundColor:c===e.chainId?"var(--widget-primary)":"var(--widget-secondary)",color:c===e.chainId?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)",borderLeft:t===0?"none":"1px solid var(--widget-border)",borderRight:"1px solid var(--widget-border)"},onClick:r=>{r.stopPropagation(),p.getState().setAssetSelectionChain(e.chainId)},onMouseEnter:()=>g?.(e.name),onMouseLeave:()=>g?.(null),children:o("div",{className:"mb-px h-4 w-4",children:o(ae,{chain:e.chainId,size:"xs"})})},e.chainId)),C&&o("button",{type:"button",className:"flex flex-row cursor-pointer items-center w-full h-full px-2.5 whitespace-nowrap uppercase font-bold text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)",borderRadius:"0 var(--widget-radius) var(--widget-radius) 0"},onClick:e=>{e.stopPropagation(),C()},children:"More"})]}),we&&o("div",{className:"flex-shrink-0",children:m("div",{className:"relative mt-1",children:[o("input",{className:"w-full h-10 px-4 text-sm",style:{backgroundColor:"var(--widget-card)",color:"var(--widget-card-foreground)",border:"1px solid var(--widget-border)"},placeholder:"Search tokens by name, symbol, or address...",autoComplete:"off",value:f,onChange:Se}),f&&o("button",{type:"button",onClick:()=>p.getState().setAssetSelectionSearch(""),className:"absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer rounded-full px-2 py-1 text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)"},children:"clear"})]})}),m("div",{className:"flex-1 min-h-0 overflow-auto mt-2",style:{backgroundColor:"var(--widget-background)"},children:[be&&!Ie&&P.length>0&&!f&&le==="all"&&m("div",{children:[o("p",{className:"my-1 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:"Your Tokens"}),P.filter(e=>e.assetInfo?v?v.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`):A(e.assetInfo)||xe.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`):!1).sort((e,t)=>{let r=D(e.chainId,e.address)||e.assetInfo,s=D(t.chainId,t.address)||t.assetInfo,d=r&&e.decimals!==void 0?x(r,e.balance,e.decimals):0;return(s&&t.decimals!==void 0?x(s,t.balance,t.decimals):0)-d}).map(e=>!e.assetInfo||!S?null:o(H,{asset:e,otherAsset:S,handleFormSelection:F,getToken:D},`${e.assetInfo.chainId}-${e.assetInfo.address}`))]}),o("p",{className:"my-2 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:f?"Search Results":"Supported Tokens"}),ve?o("div",{className:"flex items-center justify-center p-8",children:o("span",{style:{color:"var(--widget-muted-foreground)"},children:"Loading tokens..."})}):O.length===0?o("div",{className:"px-4 py-3 text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Token Not Found"}):O.map(e=>m("div",{role:"button",tabIndex:0,className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>F(e),onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),F(e))},children:[m("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[o(N,{asset:e,size:"md",className:"flex-shrink-0"}),m("div",{className:"flex flex-col items-start min-w-0 flex-1",children:[o("span",{className:"text-base font-medium truncate",style:{color:"var(--widget-foreground)"},children:(e.symbol||"").length>20?`${e.symbol.substring(0,20)}...`:e.symbol||"\u2014"}),o("span",{className:"text-sm truncate",style:{color:"var(--widget-muted-foreground)"},children:(e.name||"").length>20?`${e.name.substring(0,20)}...`:e.name||"\u2014"})]})]}),m("div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[o("span",{className:"text-xs font-mono",style:{color:"var(--widget-foreground)"},children:e.price?`$${e.price>=999999?`${(e.price/1e6).toFixed(2)}M`:e.price.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:e.price<1?5:2})}`:"\u2014"}),m("span",{className:"text-xs font-mono",style:{color:"var(--widget-muted-foreground)"},children:[e.address?.slice(0,6),"...",e.address?.slice(-4)]})]})]},`${e.chainId}-${e.address}`))]})]})},Ue=Ne;export{Ue as a};
2
+ import{c as p,f as re}from"./chunk-726CI6GC.js";import{F as Z,G as ee,H as te,L as se,O as ae,P as N,_ as ne,b as Y,g as K,k as A,w as x,x as J,z as X}from"./chunk-EW2OR6CJ.js";import{a as oe}from"./chunk-46H44R7V.js";import $,{useCallback as ie,useEffect as ke,useMemo as z}from"react";import{useShallow as Ae}from"zustand/react/shallow";import Ce from"react";import{jsx as I,jsxs as T}from"react/jsx-runtime";var H=Ce.memo(({asset:n,otherAsset:i,handleFormSelection:S,getToken:G})=>{let{token:g}=te(n.chainId,n.address),C=G(n.chainId,n.address),a=g||C||n.assetInfo;if(!a)return null;let f=a.price!=null&&n.decimals!==void 0?x(a,n.balance,n.decimals):null;return T("button",{type:"button",className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>S(a,i),children:[T("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[I(N,{asset:a,size:"md",className:"flex-shrink-0"}),T("div",{className:"flex flex-col items-start min-w-0 flex-1",children:[I("span",{className:"text-base font-medium",style:{color:"var(--widget-foreground)"},children:a.symbol.length>20?`${a.symbol.substring(0,20)}...`:a.symbol}),I("span",{className:"text-sm",style:{color:"var(--widget-foreground)",opacity:.6},children:a.name.length>20?`${a.name.substring(0,20)}...`:a.name})]})]}),T("div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[I("span",{className:"text-xs font-mono",style:{color:"var(--widget-foreground)",opacity:.5},children:"Balance:"}),I("span",{className:"text-xs font-mono",style:{color:"var(--widget-foreground)"},children:f!=null?`$${f.toFixed(2)}`:"\u2014"})]})]},`${a.chainId}-${a.address}`)},(n,i)=>n.asset.address===i.asset.address&&n.asset.chainId===i.asset.chainId&&n.asset.balance===i.asset.balance&&n.asset.assetInfo?.price===i.asset.assetInfo?.price&&n.otherAsset.address===i.otherAsset.address);H.displayName="AssetSelectionBalanceItem";import{jsx as o,jsxs as m}from"react/jsx-runtime";var Ne=({toggle:n,side:i,otherAsset:S,containerHeight:G,onChainHover:g,onMoreChainsClick:C,selectedChainFilter:a})=>{let{address:_}=oe(),{assetSelectionSearch:f,assetSelectionChain:c,assetSelectionCategory:le,recentChainIds:W}=p(Ae(e=>({assetSelectionSearch:e.assetSelectionSearch,assetSelectionChain:e.assetSelectionChain,assetSelectionCategory:e.assetSelectionCategory,recentChainIds:e.recentChainIds}))),L=X(f,300),b=ne(),{supportedInputTokens:de,supportedOutputTokens:ce,supportedInputChains:ue,supportedOutputChains:me,inputSelectionSearch:fe,outputSelectionSearch:pe,showInputSelectionTokenBalances:he,showOutputSelectionTokenBalances:ge}=Y(),we=i==="base"?fe:pe,be=i==="base"?he:ge,{setBaseToken:q,setQuoteToken:V}=re(),y=i==="base"?de:ce,w=i==="base"?ue:me,B=w.length===1,v=z(()=>{if(y.length===0)return null;let e=new Set;for(let t of y)e.add(`${t.chainId}-${t.address.toLowerCase()}`);return e},[y]);ke(()=>{B?p.getState().setAssetSelectionChain(w[0]):a&&p.getState().setAssetSelectionChain(a)},[a,B,w]);let ye=$.useMemo(()=>{let r=w.length>0?new Set(w):null,s=K(b).filter(l=>!r||r.has(l.id)).map(l=>({chainId:l.id,name:l.displayName})),d=new Map(s.map(l=>[l.chainId,l])),u=[],h=new Set,Q=d.get(4326);Q&&(u.push(Q),h.add(4326));for(let l of W){if(u.length>=5)break;if(h.has(l))continue;let U=d.get(l);U&&(u.push(U),h.add(l))}for(let l of s){if(u.length>=5)break;h.has(l.chainId)||u.push(l)}return u},[b,W,w]),{enrichedTokens:M,isLoading:ve}=ee(c==="all"?"all":c),{tokenRegistry:j,getToken:D}=Z(),xe=z(()=>{let e=new Set;for(let t of j)e.add(`${t.chainId}-${t.address.toLowerCase()}`);return e},[j]),E=z(()=>v?M.filter(e=>v.has(`${e.chainId}-${e.address.toLowerCase()}`)):M,[M,v]),R=$.useMemo(()=>{if(!L)return E;let e=L.toLowerCase();return E.filter(t=>(t.symbol||"").toLowerCase().includes(e)||(t.name||"").toLowerCase().includes(e)||t.address.toLowerCase().includes(e))},[E,L]),O=$.useMemo(()=>{let e=c==="all"?(R||[]).filter(s=>b.includes(s.chainId)):R||[],t=new Set;return[...e.filter(s=>{let d=`${s.chainId}-${s.address.toLowerCase()}`;return t.has(d)?!1:(t.add(d),!0)})].sort((s,d)=>{let u=A(s),h=A(d);return u&&!h?-1:!u&&h?1:s.marketCap&&!d.marketCap?-1:!s.marketCap&&d.marketCap?1:!s.marketCap&&!d.marketCap?0:d.marketCap-s.marketCap})},[R,c,b]),{balances:k,isLoading:Ie}=se(_,b,void 0,y.length>0?y:void 0),P=$.useMemo(()=>{if(!k)return[];let e=c==="all"?k:k.filter(r=>r.chainId===c),t=new Set;return e.filter(r=>{let s=`${r.chainId}-${(r.address||"").toLowerCase()}`;return t.has(s)?!1:(t.add(s),!0)})},[k,c]),Se=ie(e=>{let t=e.target.value.toLowerCase(),r=J(t),s=p.getState();r?(s.setAssetSelectionSearch(r),s.setAssetSelectionAddressInput(r)):(s.setAssetSelectionAddressInput(""),s.setAssetSelectionSearch(t))},[]),F=ie(async e=>{i==="base"?await q(e):i==="quote"&&await V(e),n()},[n,i,q,V]);return m("div",{className:"w-full h-full flex flex-col pt-2.5",children:[!B&&m("div",{className:"flex flex-row justify-between py-1 flex-shrink-0 h-10",children:[o("button",{type:"button",className:"flex flex-row items-center w-full h-full px-2.5 whitespace-nowrap font-bold uppercase text-xs cursor-pointer",style:{backgroundColor:c==="all"&&!a?"var(--widget-primary)":"var(--widget-secondary)",color:c==="all"&&!a?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)",borderRadius:"var(--widget-radius) 0 0 var(--widget-radius)"},onClick:e=>{e.stopPropagation(),p.getState().setAssetSelectionChain("all")},onMouseEnter:()=>g?.("All Chains"),onMouseLeave:()=>g?.(null),children:"All"}),ye.map((e,t)=>o("button",{type:"button",className:"flex items-center justify-center px-2 w-full cursor-pointer",style:{backgroundColor:c===e.chainId?"var(--widget-primary)":"var(--widget-secondary)",color:c===e.chainId?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)",borderLeft:t===0?"none":"1px solid var(--widget-border)",borderRight:"1px solid var(--widget-border)"},onClick:r=>{r.stopPropagation(),p.getState().setAssetSelectionChain(e.chainId)},onMouseEnter:()=>g?.(e.name),onMouseLeave:()=>g?.(null),children:o("div",{className:"mb-px h-4 w-4",children:o(ae,{chain:e.chainId,size:"xs"})})},e.chainId)),C&&o("button",{type:"button",className:"flex flex-row cursor-pointer items-center w-full h-full px-2.5 whitespace-nowrap uppercase font-bold text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)",borderRadius:"0 var(--widget-radius) var(--widget-radius) 0"},onClick:e=>{e.stopPropagation(),C()},children:"More"})]}),we&&o("div",{className:"flex-shrink-0",children:m("div",{className:"relative mt-1",children:[o("input",{className:"w-full h-10 px-4 text-sm",style:{backgroundColor:"var(--widget-card)",color:"var(--widget-card-foreground)",border:"1px solid var(--widget-border)"},placeholder:"Search tokens by name, symbol, or address...",autoComplete:"off",value:f,onChange:Se}),f&&o("button",{type:"button",onClick:()=>p.getState().setAssetSelectionSearch(""),className:"absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer rounded-full px-2 py-1 text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)"},children:"clear"})]})}),m("div",{className:"flex-1 min-h-0 overflow-auto mt-2",style:{backgroundColor:"var(--widget-background)"},children:[be&&!Ie&&P.length>0&&!f&&le==="all"&&m("div",{children:[o("p",{className:"my-1 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:"Your Tokens"}),P.filter(e=>e.assetInfo?v?v.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`):A(e.assetInfo)||xe.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`):!1).sort((e,t)=>{let r=D(e.chainId,e.address)||e.assetInfo,s=D(t.chainId,t.address)||t.assetInfo,d=r&&e.decimals!==void 0?x(r,e.balance,e.decimals):0;return(s&&t.decimals!==void 0?x(s,t.balance,t.decimals):0)-d}).map(e=>!e.assetInfo||!S?null:o(H,{asset:e,otherAsset:S,handleFormSelection:F,getToken:D},`${e.assetInfo.chainId}-${e.assetInfo.address}`))]}),o("p",{className:"my-2 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:f?"Search Results":"Supported Tokens"}),ve?o("div",{className:"flex items-center justify-center p-8",children:o("span",{style:{color:"var(--widget-muted-foreground)"},children:"Loading tokens..."})}):O.length===0?o("div",{className:"px-4 py-3 text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Token Not Found"}):O.map(e=>m("div",{role:"button",tabIndex:0,className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>F(e),onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),F(e))},children:[m("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[o(N,{asset:e,size:"md",className:"flex-shrink-0"}),m("div",{className:"flex flex-col items-start min-w-0 flex-1",children:[o("span",{className:"text-base font-medium truncate",style:{color:"var(--widget-foreground)"},children:(e.symbol||"").length>20?`${e.symbol.substring(0,20)}...`:e.symbol||"\u2014"}),o("span",{className:"text-sm truncate",style:{color:"var(--widget-muted-foreground)"},children:(e.name||"").length>20?`${e.name.substring(0,20)}...`:e.name||"\u2014"})]})]}),m("div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[o("span",{className:"text-xs font-mono",style:{color:"var(--widget-foreground)"},children:e.price?`$${e.price>=999999?`${(e.price/1e6).toFixed(2)}M`:e.price.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:e.price<1?5:2})}`:"\u2014"}),m("span",{className:"text-xs font-mono",style:{color:"var(--widget-muted-foreground)"},children:[e.address?.slice(0,6),"...",e.address?.slice(-4)]})]})]},`${e.chainId}-${e.address}`))]})]})},Ue=Ne;export{Ue as a};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{D,E as y,M as H,e as g}from"./chunk-CHDFHEPH.js";import{a as P}from"./chunk-46H44R7V.js";import{create as ee}from"zustand";import{useCallback as q,useEffect as te,useRef as ne}from"react";var x=ee()(n=>({baseToken:null,quoteToken:null,setBaseTokenDirect:e=>n({baseToken:e}),setQuoteTokenDirect:e=>n({quoteToken:e}),swapTokensDirect:()=>n(e=>({baseToken:e.quoteToken,quoteToken:e.baseToken}))}));function O(n){let{data:e,isLoading:c}=D(),o=x(),T=ne(!1),t=n?.defaultBaseToken??null,l=n?.defaultQuoteToken??null;te(()=>{if(!e||e.length===0||T.current)return;T.current=!0;let u=k=>e.find(m=>m.chainId===k.chainId&&m.address.toLowerCase()===k.address.toLowerCase())??null,r=t?u(t):null,p=l?u(l):null;r&&p&&r.chainId===p.chainId&&r.address.toLowerCase()===p.address.toLowerCase()?(o.setBaseTokenDirect(r),o.setQuoteTokenDirect(null)):(o.setBaseTokenDirect(r),o.setQuoteTokenDirect(p))},[e,t,l,o]);let h=q(u=>{if(!u){o.setBaseTokenDirect(null);return}let r=x.getState();r.quoteToken&&u.chainId===r.quoteToken.chainId&&u.address.toLowerCase()===r.quoteToken.address.toLowerCase()?o.swapTokensDirect():o.setBaseTokenDirect(u)},[o]),f=q(u=>{if(!u){o.setQuoteTokenDirect(null);return}let r=x.getState();r.baseToken&&u.chainId===r.baseToken.chainId&&u.address.toLowerCase()===r.baseToken.address.toLowerCase()?o.swapTokensDirect():o.setQuoteTokenDirect(u)},[o]),w=q(()=>{o.swapTokensDirect()},[o]);return{baseToken:o.baseToken,quoteToken:o.quoteToken,setBaseToken:h,setQuoteToken:f,swapTokens:w,isLoading:c}}import{create as se}from"zustand";var W=se()(n=>({view:"swap",isTransitioning:!1,transitionType:"navigation",selectedChainFilter:null,hoveredChainName:null,isRecipientInputOpen:!1,recipient:null,hasAllowanceError:!1,baseAmount:null,quoteAmount:null,isTrackingTx:!1,trackingOrderHash:null,txStatus:"pending",walletTab:"wallet",assetSelectionSearch:"",assetSelectionChain:"all",assetSelectionCategory:"all",assetSelectionAddressInput:"",recentChainIds:[],setView:e=>n({view:e,isTransitioning:!0,...e!=="wallet"&&{walletTab:"wallet"}}),setWalletTab:e=>n({walletTab:e}),setIsTransitioning:e=>n({isTransitioning:e}),transitionToView:(e,c="navigation")=>n({isTransitioning:!0,transitionType:c,view:e,...e!=="wallet"&&{walletTab:"wallet"}}),setChainFilter:e=>n({selectedChainFilter:e}),setHoveredChainName:e=>n({hoveredChainName:e}),toggleRecipientInput:()=>n(e=>({isRecipientInputOpen:!e.isRecipientInputOpen,recipient:e.isRecipientInputOpen?null:e.recipient})),setRecipient:e=>n({recipient:e}),setHasAllowanceError:e=>n({hasAllowanceError:e}),setBaseAmount:e=>n({baseAmount:e}),setQuoteAmount:e=>n({quoteAmount:e}),clearAmounts:()=>n({baseAmount:null,quoteAmount:null}),setIsTrackingTx:e=>n({isTrackingTx:e}),setTrackingOrderHash:e=>n({trackingOrderHash:e}),setTxStatus:e=>n({txStatus:e}),startTracking:e=>n({isTrackingTx:!0,trackingOrderHash:e,txStatus:"pending"}),stopTracking:()=>n({isTrackingTx:!1,trackingOrderHash:null,txStatus:"pending"}),setAssetSelectionSearch:e=>n({assetSelectionSearch:e}),setAssetSelectionChain:e=>n({assetSelectionChain:e}),setAssetSelectionCategory:e=>n({assetSelectionCategory:e}),setAssetSelectionAddressInput:e=>n({assetSelectionAddressInput:e}),pushRecentChain:e=>n(c=>{if(e===4326)return c;let T=c.recentChainIds.filter(t=>t!==e);return{recentChainIds:[e,...T].slice(0,3)}}),resetAssetSelection:()=>n({assetSelectionSearch:"",assetSelectionChain:"all",assetSelectionCategory:"all",assetSelectionAddressInput:""}),resetUI:()=>n({view:"swap",isTransitioning:!1,selectedChainFilter:null,hoveredChainName:null,isRecipientInputOpen:!1,recipient:null,hasAllowanceError:!1,baseAmount:null,quoteAmount:null,isTrackingTx:!1,trackingOrderHash:null,txStatus:"pending",walletTab:"wallet",assetSelectionSearch:"",assetSelectionChain:"all",assetSelectionCategory:"all",assetSelectionAddressInput:""})}));import{useCallback as S,useMemo as d}from"react";import{parseUnits as E}from"viem";import{useShallow as oe}from"zustand/react/shallow";var U=(n,e,c,o)=>{let{address:T}=P(),{baseToken:t,quoteToken:l,setBaseToken:h,setQuoteToken:f,swapTokens:w,isLoading:u}=O({defaultBaseToken:n,defaultQuoteToken:e}),{baseAmount:r,quoteAmount:p,setBaseAmount:k,setQuoteAmount:m,clearAmounts:F}=W(oe(s=>({baseAmount:s.baseAmount,quoteAmount:s.quoteAmount,setBaseAmount:s.setBaseAmount,setQuoteAmount:s.setQuoteAmount,clearAmounts:s.clearAmounts}))),{data:Q}=y(t?.address,t?.chainId),{data:R}=y(l?.address,l?.chainId),a=d(()=>{if(!t)return null;let s=Q?.price??t.price;return s===t.price?t:{...t,price:s}},[t,Q?.price]),i=d(()=>{if(!l)return null;let s=R?.price??l.price;return s===l.price?l:{...l,price:s}},[l,R?.price]),{baseBalance:A,quoteBalance:I,isLoading:L}=H(T,a,i),b=d(()=>!A||A.raw==="0"?null:A,[A]),C=d(()=>!I||I.raw==="0"?null:I,[I]),v=d(()=>{if(!a?.chainId)return!1;let s=g(a.chainId);return a.address.toLowerCase()===s?.gasToken.address?.toLowerCase()},[a]),B=d(()=>{if(!i?.chainId)return!1;let s=g(i.chainId);return i.address.toLowerCase()===s?.gasToken.address?.toLowerCase()},[i]),V=d(()=>{if(!v||!a?.chainId||!i||a.chainId!==i.chainId||a.chainId===988)return!1;let s=g(a.chainId);return i.address.toLowerCase()===s?.wrappedAsset.address?.toLowerCase()},[v,a,i]),G=d(()=>{if(!a?.chainId||!i||!B||a.chainId!==i.chainId||a.chainId===988)return!1;let s=g(a.chainId);return a.address.toLowerCase()===s?.wrappedAsset.address?.toLowerCase()},[a,i,B]),M=d(()=>({raw:b?.raw??"0",formatted:b?.formatted??"0"}),[b]),_=d(()=>({raw:C?.raw??"0",formatted:C?.formatted??"0"}),[C]),z=d(()=>!a||typeof r!="number"||a.decimals===void 0||a.decimals===null?null:E(r.toFixed(a.decimals),a.decimals).toString(),[a,r]),J=d(()=>!i||typeof p!="number"||i.decimals===void 0||i.decimals===null?null:E(p.toFixed(i.decimals),i.decimals).toString(),[i,p]),K=S(async s=>{h(s),m(null),c?.(s)},[h,m,c]),X=S(async s=>{f(s),o?.(s)},[f,o]),Y=S(s=>k(s),[k]),Z=S(s=>m(s),[m]),$=S(()=>{w(),l&&c?.(l),t&&o?.(t)},[w,t,l,c,o]),j=S(()=>F(),[F]);return{baseToken:a,baseAmount:r,quoteToken:i,quoteAmount:p,isBaseGasToken:v,isQuoteGasToken:B,isWrappingPair:V,isUnwrappingPair:G,baseBalance:M,quoteBalance:_,baseAmountRaw:z,quoteAmountRaw:J,isBaseBalanceLoading:L,isQuoteBalanceLoading:L,isRegistryLoading:u,setBaseToken:K,setQuoteToken:X,setBaseAmount:Y,setQuoteAmount:Z,swapTokens:$,clearForm:j}};import{createContext as ae,useContext as ie,useMemo as re}from"react";import{jsx as le}from"react/jsx-runtime";var N=ae(null),ye=({children:n,defaultBaseToken:e,defaultQuoteToken:c,onBaseTokenChange:o,onQuoteTokenChange:T})=>{let t=U(e,c,o,T),l=re(()=>t,[t.baseToken,t.quoteToken,t.baseAmount,t.quoteAmount,t.isBaseGasToken,t.isQuoteGasToken,t.isWrappingPair,t.isUnwrappingPair,t.baseBalance,t.quoteBalance,t.baseAmountRaw,t.quoteAmountRaw,t.isBaseBalanceLoading,t.isQuoteBalanceLoading,t.setBaseToken,t.setQuoteToken,t.setBaseAmount,t.setQuoteAmount,t.swapTokens,t.clearForm,t.isRegistryLoading]);return le(N.Provider,{value:l,children:n})},qe=()=>{let n=ie(N);if(!n)throw new Error("useSwapFormContext must be used within SwapFormProvider");return n};export{x as a,O as b,W as c,U as d,ye as e,qe as f};
2
+ import{D,E as y,M as H,e as g}from"./chunk-EW2OR6CJ.js";import{a as P}from"./chunk-46H44R7V.js";import{create as ee}from"zustand";import{useCallback as q,useEffect as te,useRef as ne}from"react";var x=ee()(n=>({baseToken:null,quoteToken:null,setBaseTokenDirect:e=>n({baseToken:e}),setQuoteTokenDirect:e=>n({quoteToken:e}),swapTokensDirect:()=>n(e=>({baseToken:e.quoteToken,quoteToken:e.baseToken}))}));function O(n){let{data:e,isLoading:c}=D(),o=x(),T=ne(!1),t=n?.defaultBaseToken??null,l=n?.defaultQuoteToken??null;te(()=>{if(!e||e.length===0||T.current)return;T.current=!0;let u=k=>e.find(m=>m.chainId===k.chainId&&m.address.toLowerCase()===k.address.toLowerCase())??null,r=t?u(t):null,p=l?u(l):null;r&&p&&r.chainId===p.chainId&&r.address.toLowerCase()===p.address.toLowerCase()?(o.setBaseTokenDirect(r),o.setQuoteTokenDirect(null)):(o.setBaseTokenDirect(r),o.setQuoteTokenDirect(p))},[e,t,l,o]);let h=q(u=>{if(!u){o.setBaseTokenDirect(null);return}let r=x.getState();r.quoteToken&&u.chainId===r.quoteToken.chainId&&u.address.toLowerCase()===r.quoteToken.address.toLowerCase()?o.swapTokensDirect():o.setBaseTokenDirect(u)},[o]),f=q(u=>{if(!u){o.setQuoteTokenDirect(null);return}let r=x.getState();r.baseToken&&u.chainId===r.baseToken.chainId&&u.address.toLowerCase()===r.baseToken.address.toLowerCase()?o.swapTokensDirect():o.setQuoteTokenDirect(u)},[o]),w=q(()=>{o.swapTokensDirect()},[o]);return{baseToken:o.baseToken,quoteToken:o.quoteToken,setBaseToken:h,setQuoteToken:f,swapTokens:w,isLoading:c}}import{create as se}from"zustand";var W=se()(n=>({view:"swap",isTransitioning:!1,transitionType:"navigation",selectedChainFilter:null,hoveredChainName:null,isRecipientInputOpen:!1,recipient:null,hasAllowanceError:!1,baseAmount:null,quoteAmount:null,isTrackingTx:!1,trackingOrderHash:null,txStatus:"pending",walletTab:"wallet",assetSelectionSearch:"",assetSelectionChain:"all",assetSelectionCategory:"all",assetSelectionAddressInput:"",recentChainIds:[],setView:e=>n({view:e,isTransitioning:!0,...e!=="wallet"&&{walletTab:"wallet"}}),setWalletTab:e=>n({walletTab:e}),setIsTransitioning:e=>n({isTransitioning:e}),transitionToView:(e,c="navigation")=>n({isTransitioning:!0,transitionType:c,view:e,...e!=="wallet"&&{walletTab:"wallet"}}),setChainFilter:e=>n({selectedChainFilter:e}),setHoveredChainName:e=>n({hoveredChainName:e}),toggleRecipientInput:()=>n(e=>({isRecipientInputOpen:!e.isRecipientInputOpen,recipient:e.isRecipientInputOpen?null:e.recipient})),setRecipient:e=>n({recipient:e}),setHasAllowanceError:e=>n({hasAllowanceError:e}),setBaseAmount:e=>n({baseAmount:e}),setQuoteAmount:e=>n({quoteAmount:e}),clearAmounts:()=>n({baseAmount:null,quoteAmount:null}),setIsTrackingTx:e=>n({isTrackingTx:e}),setTrackingOrderHash:e=>n({trackingOrderHash:e}),setTxStatus:e=>n({txStatus:e}),startTracking:e=>n({isTrackingTx:!0,trackingOrderHash:e,txStatus:"pending"}),stopTracking:()=>n({isTrackingTx:!1,trackingOrderHash:null,txStatus:"pending"}),setAssetSelectionSearch:e=>n({assetSelectionSearch:e}),setAssetSelectionChain:e=>n({assetSelectionChain:e}),setAssetSelectionCategory:e=>n({assetSelectionCategory:e}),setAssetSelectionAddressInput:e=>n({assetSelectionAddressInput:e}),pushRecentChain:e=>n(c=>{if(e===4326)return c;let T=c.recentChainIds.filter(t=>t!==e);return{recentChainIds:[e,...T].slice(0,3)}}),resetAssetSelection:()=>n({assetSelectionSearch:"",assetSelectionChain:"all",assetSelectionCategory:"all",assetSelectionAddressInput:""}),resetUI:()=>n({view:"swap",isTransitioning:!1,selectedChainFilter:null,hoveredChainName:null,isRecipientInputOpen:!1,recipient:null,hasAllowanceError:!1,baseAmount:null,quoteAmount:null,isTrackingTx:!1,trackingOrderHash:null,txStatus:"pending",walletTab:"wallet",assetSelectionSearch:"",assetSelectionChain:"all",assetSelectionCategory:"all",assetSelectionAddressInput:""})}));import{useCallback as S,useMemo as d}from"react";import{parseUnits as E}from"viem";import{useShallow as oe}from"zustand/react/shallow";var U=(n,e,c,o)=>{let{address:T}=P(),{baseToken:t,quoteToken:l,setBaseToken:h,setQuoteToken:f,swapTokens:w,isLoading:u}=O({defaultBaseToken:n,defaultQuoteToken:e}),{baseAmount:r,quoteAmount:p,setBaseAmount:k,setQuoteAmount:m,clearAmounts:F}=W(oe(s=>({baseAmount:s.baseAmount,quoteAmount:s.quoteAmount,setBaseAmount:s.setBaseAmount,setQuoteAmount:s.setQuoteAmount,clearAmounts:s.clearAmounts}))),{data:Q}=y(t?.address,t?.chainId),{data:R}=y(l?.address,l?.chainId),a=d(()=>{if(!t)return null;let s=Q?.price??t.price;return s===t.price?t:{...t,price:s}},[t,Q?.price]),i=d(()=>{if(!l)return null;let s=R?.price??l.price;return s===l.price?l:{...l,price:s}},[l,R?.price]),{baseBalance:A,quoteBalance:I,isLoading:L}=H(T,a,i),b=d(()=>!A||A.raw==="0"?null:A,[A]),C=d(()=>!I||I.raw==="0"?null:I,[I]),v=d(()=>{if(!a?.chainId)return!1;let s=g(a.chainId);return a.address.toLowerCase()===s?.gasToken.address?.toLowerCase()},[a]),B=d(()=>{if(!i?.chainId)return!1;let s=g(i.chainId);return i.address.toLowerCase()===s?.gasToken.address?.toLowerCase()},[i]),V=d(()=>{if(!v||!a?.chainId||!i||a.chainId!==i.chainId||a.chainId===988)return!1;let s=g(a.chainId);return i.address.toLowerCase()===s?.wrappedAsset.address?.toLowerCase()},[v,a,i]),G=d(()=>{if(!a?.chainId||!i||!B||a.chainId!==i.chainId||a.chainId===988)return!1;let s=g(a.chainId);return a.address.toLowerCase()===s?.wrappedAsset.address?.toLowerCase()},[a,i,B]),M=d(()=>({raw:b?.raw??"0",formatted:b?.formatted??"0"}),[b]),_=d(()=>({raw:C?.raw??"0",formatted:C?.formatted??"0"}),[C]),z=d(()=>!a||typeof r!="number"||a.decimals===void 0||a.decimals===null?null:E(r.toFixed(a.decimals),a.decimals).toString(),[a,r]),J=d(()=>!i||typeof p!="number"||i.decimals===void 0||i.decimals===null?null:E(p.toFixed(i.decimals),i.decimals).toString(),[i,p]),K=S(async s=>{h(s),m(null),c?.(s)},[h,m,c]),X=S(async s=>{f(s),o?.(s)},[f,o]),Y=S(s=>k(s),[k]),Z=S(s=>m(s),[m]),$=S(()=>{w(),l&&c?.(l),t&&o?.(t)},[w,t,l,c,o]),j=S(()=>F(),[F]);return{baseToken:a,baseAmount:r,quoteToken:i,quoteAmount:p,isBaseGasToken:v,isQuoteGasToken:B,isWrappingPair:V,isUnwrappingPair:G,baseBalance:M,quoteBalance:_,baseAmountRaw:z,quoteAmountRaw:J,isBaseBalanceLoading:L,isQuoteBalanceLoading:L,isRegistryLoading:u,setBaseToken:K,setQuoteToken:X,setBaseAmount:Y,setQuoteAmount:Z,swapTokens:$,clearForm:j}};import{createContext as ae,useContext as ie,useMemo as re}from"react";import{jsx as le}from"react/jsx-runtime";var N=ae(null),ye=({children:n,defaultBaseToken:e,defaultQuoteToken:c,onBaseTokenChange:o,onQuoteTokenChange:T})=>{let t=U(e,c,o,T),l=re(()=>t,[t.baseToken,t.quoteToken,t.baseAmount,t.quoteAmount,t.isBaseGasToken,t.isQuoteGasToken,t.isWrappingPair,t.isUnwrappingPair,t.baseBalance,t.quoteBalance,t.baseAmountRaw,t.quoteAmountRaw,t.isBaseBalanceLoading,t.isQuoteBalanceLoading,t.setBaseToken,t.setQuoteToken,t.setBaseAmount,t.setQuoteAmount,t.swapTokens,t.clearForm,t.isRegistryLoading]);return le(N.Provider,{value:l,children:n})},qe=()=>{let n=ie(N);if(!n)throw new Error("useSwapFormContext must be used within SwapFormProvider");return n};export{x as a,O as b,W as c,U as d,ye as e,qe as f};
@@ -1,2 +1,2 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
2
- var _chunkNQ4QSGGFcjs = require('./chunk-NQ4QSGGF.cjs');var _chunk537OMWA3cjs = require('./chunk-537OMWA3.cjs');var _chunkBX3KCZRTcjs = require('./chunk-BX3KCZRT.cjs');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _jsxruntime = require('react/jsx-runtime');function x(a){if(a===0)return"0";let o=Math.abs(a);return o>=1e4?a.toFixed(0):o>=1e3?a.toFixed(1):o>=100?a.toFixed(2):o>=1?a.toFixed(4):o>=.01?a.toFixed(6):a.toExponential(3)}var N=_react2.default.memo(()=>{let[a,o]=_react.useState.call(void 0, !1),{liquidityError:b,routingError:h}=_chunkNQ4QSGGFcjs.e.call(void 0, ),{baseAmount:r,baseToken:s,quoteAmount:l,quoteToken:i}=_chunk537OMWA3cjs.f.call(void 0, ),{quoteLoaderVariant:p,widgetType:F}=_chunkBX3KCZRTcjs.b.call(void 0, ),u=F==="compact",n=r&&l&&parseFloat(l.toString())?parseFloat(r.toString())/parseFloat(l.toString()):0,v=b||h,c=s&&i&&r&&parseFloat(r.toString())&&l;return _react.useEffect.call(void 0, ()=>{p==="expanded"&&c&&o(!0)},[p,c]),p==="none"?null:p==="default"?_jsxruntime.jsx.call(void 0, "div",{className:`relative box-border flex flex-row pt-1 h-8 w-full items-center${u?" justify-start overflow-x-auto":" justify-center"}`,children:_jsxruntime.jsx.call(void 0, "div",{className:`flex h-full items-center${u?" min-w-max":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&i?r&&parseFloat(r.toString())?l?_jsxruntime.jsxs.call(void 0, "div",{className:"translate-y-px font-mono flex flex-row items-center gap-2 whitespace-nowrap",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkBX3KCZRTcjs.P,{asset:i,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",children:["1 ",_optionalChain([i, 'optionalAccess', _ => _.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkBX3KCZRTcjs.P,{asset:s,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",children:[x(n)," ",_optionalChain([s, 'optionalAccess', _2 => _2.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:_optionalChain([s, 'optionalAccess', _3 => _3.price])?`\u2248 $${(s.price*n).toFixed(2)}`:""})]}):v?_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),_jsxruntime.jsx.call(void 0, _chunkBX3KCZRTcjs.X,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),_jsxruntime.jsx.call(void 0, _chunkBX3KCZRTcjs.X,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):_jsxruntime.jsx.call(void 0, "div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"}):_jsxruntime.jsx.call(void 0, "div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"})})}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",children:[_jsxruntime.jsx.call(void 0, "div",{className:`relative box-border flex flex-row pt-1 h-8 w-full items-center cursor-pointer${u?" overflow-x-auto":""}`,role:"button",tabIndex:0,onClick:()=>c&&o(d=>!d),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),c&&o(S=>!S))},children:_jsxruntime.jsx.call(void 0, "div",{className:`flex h-full items-center${u?" min-w-max overflow-x-auto":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&i?r&&parseFloat(r.toString())?l?_jsxruntime.jsxs.call(void 0, "div",{className:"translate-y-px font-mono flex w-full flex-row items-center justify-between",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-2 whitespace-nowrap",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkBX3KCZRTcjs.P,{asset:i,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",children:["1 ",_optionalChain([i, 'optionalAccess', _4 => _4.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkBX3KCZRTcjs.P,{asset:s,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",children:[x(n)," ",_optionalChain([s, 'optionalAccess', _5 => _5.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:_optionalChain([s, 'optionalAccess', _6 => _6.price])?`\u2248 $${(s.price*n).toFixed(2)}`:""})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs ml-2 transition-transform duration-200 shrink-0",style:{color:"var(--widget-muted-foreground)",transform:a?"rotate(180deg)":"rotate(0deg)",display:"inline-block"},children:"\u25BE"})]}):v?_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),_jsxruntime.jsx.call(void 0, _chunkBX3KCZRTcjs.X,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),_jsxruntime.jsx.call(void 0, _chunkBX3KCZRTcjs.X,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):_jsxruntime.jsx.call(void 0, "div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"}):_jsxruntime.jsx.call(void 0, "div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"})})}),_jsxruntime.jsx.call(void 0, "div",{className:"overflow-hidden transition-all duration-200",style:{maxHeight:a&&c?"80px":"0px",opacity:a&&c?1:0},children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-0.5 pb-1 font-mono",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"USD Value"}),_jsxruntime.jsxs.call(void 0, "span",{children:["$",_optionalChain([s, 'optionalAccess', _7 => _7.price])&&l?(s.price*n*parseFloat(l.toString())).toFixed(2):"\u2014"]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"Rate"}),_jsxruntime.jsx.call(void 0, "span",{className:"uppercase",children:n>0?`${x(n)} ${_nullishCoalesce(_optionalChain([s, 'optionalAccess', _8 => _8.symbol]), () => (""))}`:"\u2014"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"Order Type"}),_jsxruntime.jsx.call(void 0, "span",{children:"RFQ (Exact Fill)"})]})]})})]})});N.displayName="QuoteLoader";var R=N;exports.a = R;
2
+ var _chunkMCT3UZTPcjs = require('./chunk-MCT3UZTP.cjs');var _chunkUZWGYG2Scjs = require('./chunk-UZWGYG2S.cjs');var _chunkLXEKOQAGcjs = require('./chunk-LXEKOQAG.cjs');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _jsxruntime = require('react/jsx-runtime');function x(a){if(a===0)return"0";let o=Math.abs(a);return o>=1e4?a.toFixed(0):o>=1e3?a.toFixed(1):o>=100?a.toFixed(2):o>=1?a.toFixed(4):o>=.01?a.toFixed(6):a.toExponential(3)}var N=_react2.default.memo(()=>{let[a,o]=_react.useState.call(void 0, !1),{liquidityError:b,routingError:h}=_chunkMCT3UZTPcjs.e.call(void 0, ),{baseAmount:r,baseToken:s,quoteAmount:l,quoteToken:i}=_chunkUZWGYG2Scjs.f.call(void 0, ),{quoteLoaderVariant:p,widgetType:F}=_chunkLXEKOQAGcjs.b.call(void 0, ),u=F==="compact",n=r&&l&&parseFloat(l.toString())?parseFloat(r.toString())/parseFloat(l.toString()):0,v=b||h,c=s&&i&&r&&parseFloat(r.toString())&&l;return _react.useEffect.call(void 0, ()=>{p==="expanded"&&c&&o(!0)},[p,c]),p==="none"?null:p==="default"?_jsxruntime.jsx.call(void 0, "div",{className:`relative box-border flex flex-row pt-1 h-8 w-full items-center${u?" justify-start overflow-x-auto":" justify-center"}`,children:_jsxruntime.jsx.call(void 0, "div",{className:`flex h-full items-center${u?" min-w-max":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&i?r&&parseFloat(r.toString())?l?_jsxruntime.jsxs.call(void 0, "div",{className:"translate-y-px font-mono flex flex-row items-center gap-2 whitespace-nowrap",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkLXEKOQAGcjs.P,{asset:i,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",children:["1 ",_optionalChain([i, 'optionalAccess', _ => _.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkLXEKOQAGcjs.P,{asset:s,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",children:[x(n)," ",_optionalChain([s, 'optionalAccess', _2 => _2.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:_optionalChain([s, 'optionalAccess', _3 => _3.price])?`\u2248 $${(s.price*n).toFixed(2)}`:""})]}):v?_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),_jsxruntime.jsx.call(void 0, _chunkLXEKOQAGcjs.X,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),_jsxruntime.jsx.call(void 0, _chunkLXEKOQAGcjs.X,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):_jsxruntime.jsx.call(void 0, "div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"}):_jsxruntime.jsx.call(void 0, "div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"})})}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",children:[_jsxruntime.jsx.call(void 0, "div",{className:`relative box-border flex flex-row pt-1 h-8 w-full items-center cursor-pointer${u?" overflow-x-auto":""}`,role:"button",tabIndex:0,onClick:()=>c&&o(d=>!d),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),c&&o(S=>!S))},children:_jsxruntime.jsx.call(void 0, "div",{className:`flex h-full items-center${u?" min-w-max overflow-x-auto":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&i?r&&parseFloat(r.toString())?l?_jsxruntime.jsxs.call(void 0, "div",{className:"translate-y-px font-mono flex w-full flex-row items-center justify-between",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-2 whitespace-nowrap",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkLXEKOQAGcjs.P,{asset:i,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",children:["1 ",_optionalChain([i, 'optionalAccess', _4 => _4.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkLXEKOQAGcjs.P,{asset:s,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",children:[x(n)," ",_optionalChain([s, 'optionalAccess', _5 => _5.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:_optionalChain([s, 'optionalAccess', _6 => _6.price])?`\u2248 $${(s.price*n).toFixed(2)}`:""})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs ml-2 transition-transform duration-200 shrink-0",style:{color:"var(--widget-muted-foreground)",transform:a?"rotate(180deg)":"rotate(0deg)",display:"inline-block"},children:"\u25BE"})]}):v?_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),_jsxruntime.jsx.call(void 0, _chunkLXEKOQAGcjs.X,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),_jsxruntime.jsx.call(void 0, _chunkLXEKOQAGcjs.X,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):_jsxruntime.jsx.call(void 0, "div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"}):_jsxruntime.jsx.call(void 0, "div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"})})}),_jsxruntime.jsx.call(void 0, "div",{className:"overflow-hidden transition-all duration-200",style:{maxHeight:a&&c?"80px":"0px",opacity:a&&c?1:0},children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-0.5 pb-1 font-mono",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"USD Value"}),_jsxruntime.jsxs.call(void 0, "span",{children:["$",_optionalChain([s, 'optionalAccess', _7 => _7.price])&&l?(s.price*n*parseFloat(l.toString())).toFixed(2):"\u2014"]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"Rate"}),_jsxruntime.jsx.call(void 0, "span",{className:"uppercase",children:n>0?`${x(n)} ${_nullishCoalesce(_optionalChain([s, 'optionalAccess', _8 => _8.symbol]), () => (""))}`:"\u2014"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"Order Type"}),_jsxruntime.jsx.call(void 0, "span",{children:"RFQ (Exact Fill)"})]})]})})]})});N.displayName="QuoteLoader";var R=N;exports.a = R;
@@ -7,7 +7,7 @@ import{createContext as gA,useContext as lA,useMemo as cA}from"react";var fA=gA(
7
7
  .aori-cm-check { stroke-dasharray: 73; stroke-dashoffset: 73; animation: aori-cm-check 0.4s ease-in-out 0.4s forwards; }
8
8
  .aori-cm-fill-mask { animation: aori-cm-fill 0.3s ease-in-out 0.3s forwards; }
9
9
  `}),Z2("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:[H("circle",{fill:"var(--widget-status-completed)",cx:"66.5",cy:"66.5",r:"54.5"}),H("circle",{className:"aori-cm-fill-mask",fill:"var(--widget-background)",cx:"66.5",cy:"66.5",r:"55.5"}),H("circle",{className:"aori-cm-outline",stroke:"var(--widget-status-completed)",strokeWidth:"4",cx:"66.5",cy:"66.5",r:"54.5",fill:"none"}),H("polyline",{className:"aori-cm-check",stroke:"var(--widget-background)",strokeWidth:"6",fill:"none",points:"41 70 56 85 92 49"})]})]})}import{jsx as J2,jsxs as Se}from"react/jsx-runtime";function _2(A){return Se("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...A,children:[J2("path",{d:"M14 8H4C2.897 8 2 8.897 2 10V20C2 21.103 2.897 22 4 22H14C15.103 22 16 21.103 16 20V10C16 8.897 15.103 8 14 8Z",fill:"currentColor"}),J2("path",{d:"M20 2H10C8.896 2 8 2.896 8 4V6H9H16C17.104 6 18 6.896 18 8V15V16H20C21.104 16 22 15.104 22 14V4C22 2.896 21.104 2 20 2Z",fill:"currentColor"})]})}import{jsx as v,jsxs as w2}from"react/jsx-runtime";var Re=(A,e)=>{let[t,r]=N(""),[o,a]=N(""),[s,i]=N([]),l=AA(null),n="abcdefghijklmnopqrstuvwxyz",g=c=>{let f="";for(let C=0;C<c;C++)f+=n[Math.floor(Math.random()*n.length)];return f};return $2(()=>{l.current&&clearInterval(l.current);let c=0,f=()=>{if(c>=A.length){r(A),a(""),i(new Array(A.length).fill(e)),l.current&&(clearInterval(l.current),l.current=null);return}let C=A.substring(0,c),d=Math.max(0,A.length-c),B=d>0?g(d):"",u=new Array(A.length).fill(!1).map((p,P)=>P<c?e:!1);r(C),a(B),i(u),c++};return l.current=setInterval(f,25),()=>{l.current&&clearInterval(l.current)}},[A,e]),{displayText:t,suffix:o,characterColors:s}},je=({targetText:A,isError:e,font:t=""})=>{let{displayText:r,suffix:o,characterColors:a}=Re(A,e);return w2("span",{className:t,children:[r.split("").map((s,i)=>v("span",{style:a[i]?{color:"var(--widget-destructive)"}:void 0,children:s},`revealed-${i}`)),o&&v("span",{style:{color:"var(--widget-muted-foreground)",opacity:.3},children:o})]})},Ke=({text:A,type:e,color:t="white",size:r="text-base",font:o="font-medium",className:a="",children:s,showCopyIcon:i=!0,disableScramble:l=!1})=>{let[n,g]=N(!1),[c,f]=N(""),C=AA(null);$2(()=>()=>{C.current&&(clearTimeout(C.current),C.current=null)},[]);let d=()=>{C.current&&(clearTimeout(C.current),C.current=null),navigator.clipboard.writeText(A).then(()=>{g(!0),C.current=setTimeout(()=>{g(!1),C.current=null},2e3)}).catch(()=>{f("Failed to copy"),C.current=setTimeout(()=>{f(""),C.current=null},3e3)})},B=t==="teal"?"text-textSuccess":"text-text",p=(()=>{if(c)return c;if(n)switch(e){case"address":return"Address Copied!";case"hash":return"Hash Copied!";case"link":return"Link Copied!";case"pair":return"Pair Copied!";case"data":return"Data Copied!";default:return"Copied!"}return s?"":e==="address"||e==="hash"?A2(A):A})(),P=!!c,Q2=`${n}-${c}-${A}`;return v("div",{className:"relative",children:v("button",{type:"button",className:`relative flex cursor-pointer items-center bg-transparent border-none p-0 ${a} ${t==="black"?"px-4 rounded-full h-8 bg-gray-800":""}`,onClick:O=>{O.stopPropagation(),d()},children:w2("span",{className:`flex items-center gap-0.5 ${B} ${r} ${o}`,children:[c||n?l?p:v("span",{children:v(je,{targetText:p,isError:P,font:o})},Q2):s??p,i&&!c&&w2("div",{className:"relative ml-1 h-3 w-3",children:[v(_2,{className:`absolute inset-0 ${n?"opacity-0":"opacity-100"} transition-opacity duration-200 ${o}`}),v("div",{className:`absolute inset-0 ${n?"opacity-100":"opacity-0"} transition-opacity duration-200`,children:v(k,{className:"h-3 w-3"})})]})]})})})},ke=Ke;import{jsx as eA}from"react/jsx-runtime";var Xe=A=>eA("div",{className:"flex animate-pulse",children:eA("div",{...A})}),ze=Xe;import{jsx as tA}from"react/jsx-runtime";function Ve(A){return tA("svg",{width:"417",height:"417",viewBox:"0 0 417 417",fill:"none",xmlns:"http://www.w3.org/2000/svg",...A,children:tA("path",{d:"M215.855 0.0932617C153.901 0.0932617 95.6665 30.1873 58.0271 80.0623L0.393888 45.4993L0.273444 243.343L165.433 144.53L112.347 112.655C138.423 82.3423 175.941 64.0923 215.854 64.0923C292.366 64.0923 354.606 128.686 354.606 208.092C354.606 287.498 292.366 352.092 215.854 352.092L215.854 416.092C326.362 416.092 416.273 322.779 416.273 208.092C416.273 93.4053 326.363 0.0932617 215.855 0.0932617Z",fill:"currentColor"})})}import{jsx as X,jsxs as qe}from"react/jsx-runtime";function We(A){return X("svg",{viewBox:"0 0 60.671 60.671",...A,children:X("g",{children:qe("g",{children:[X("ellipse",{cx:"30.336",cy:"12.097",rx:"11.997",ry:"12.097",fill:"currentColor"}),X("path",{d:`M35.64,30.079H25.031c-7.021,0-12.714,5.739-12.714,12.821v17.771h36.037V42.9
10
- C48.354,35.818,42.661,30.079,35.64,30.079z`,fill:"currentColor"})]})})})}import{jsx as rA}from"react/jsx-runtime";function Ze(A){return rA("svg",{viewBox:"0 0 10 6",fill:"none",xmlns:"http://www.w3.org/2000/svg",...A,children:rA("path",{d:"M10 0L5 6L0 0H10Z",fill:"currentColor"})})}import Je from"react";import{jsx as D2,jsxs as At}from"react/jsx-runtime";var _e={3:"h-3 w-3",4:"h-4 w-4",5:"h-5 w-5",6:"h-6 w-6",8:"h-8 w-8",10:"h-10 w-10"},nA=Je.memo(({size:A,color:e,className:t})=>{let r=_e[A]??`h-${A} w-${A}`;return D2("div",{className:`inline-flex items-center justify-center ${t??""}`,children:At("svg",{"aria-hidden":"true",className:`${r} animate-spin`,style:e?{color:e}:{color:"currentColor"},viewBox:"0 0 100 101",xmlns:"http://www.w3.org/2000/svg",children:[D2("path",{id:"track-text-muted",d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor",opacity:".2"}),D2("path",{id:"thumb-fill-inverse",d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentColor"})]})})});nA.displayName="LoadingSpinner";var $e=nA;import{jsx as M,jsxs as oA}from"react/jsx-runtime";function aA(A){return oA("svg",{viewBox:"0 0 133 133",...A,children:[M("style",{children:`
10
+ C48.354,35.818,42.661,30.079,35.64,30.079z`,fill:"currentColor"})]})})})}import{jsx as rA}from"react/jsx-runtime";function Ze(A){return rA("svg",{viewBox:"0 0 10 6",width:"10",height:"6",fill:"none",xmlns:"http://www.w3.org/2000/svg",...A,children:rA("path",{d:"M10 0L5 6L0 0H10Z",fill:"currentColor"})})}import Je from"react";import{jsx as D2,jsxs as At}from"react/jsx-runtime";var _e={3:"h-3 w-3",4:"h-4 w-4",5:"h-5 w-5",6:"h-6 w-6",8:"h-8 w-8",10:"h-10 w-10"},nA=Je.memo(({size:A,color:e,className:t})=>{let r=_e[A]??`h-${A} w-${A}`;return D2("div",{className:`inline-flex items-center justify-center ${t??""}`,children:At("svg",{"aria-hidden":"true",className:`${r} animate-spin`,style:e?{color:e}:{color:"currentColor"},viewBox:"0 0 100 101",xmlns:"http://www.w3.org/2000/svg",children:[D2("path",{id:"track-text-muted",d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor",opacity:".2"}),D2("path",{id:"thumb-fill-inverse",d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentColor"})]})})});nA.displayName="LoadingSpinner";var $e=nA;import{jsx as M,jsxs as oA}from"react/jsx-runtime";function aA(A){return oA("svg",{viewBox:"0 0 133 133",...A,children:[M("style",{children:`
11
11
  @keyframes aori-rd-circle { from { stroke-dashoffset: 343; } to { stroke-dashoffset: 0; } }
12
12
  @keyframes aori-rd-fill { from { opacity: 1; } to { opacity: 0; } }
13
13
  @keyframes aori-rd-arc { from { stroke-dashoffset: 140; } to { stroke-dashoffset: 0; } }
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{O as p,_ as g,g as c,z as m}from"./chunk-CHDFHEPH.js";import h,{useCallback as C,useState as b}from"react";import{jsx as o,jsxs as t}from"react/jsx-runtime";var y=({toggle:x,side:w,onChainSelect:i,onChainHover:l,containerHeight:N})=>{let[a,d]=b(""),r=m(a,300),v=g(),s=c(v),u=h.useMemo(()=>{if(!r)return s;let e=r.toLowerCase();return s.filter(n=>n.displayName.toLowerCase().includes(e)||n.name.toLowerCase().includes(e)||n.id.toString().includes(e))},[s,r]),f=C(e=>i(e),[i]);return t("div",{className:"w-full h-full flex flex-col",children:[o("div",{className:"flex-shrink-0",children:t("div",{className:"relative mt-1",children:[o("input",{className:"w-full h-10 px-4 text-sm",style:{backgroundColor:"var(--widget-card)",color:"var(--widget-card-foreground)",border:"1px solid var(--widget-border)"},placeholder:"Search chains by name or chain ID...",autoComplete:"off",value:a,onChange:e=>d(e.target.value.toLowerCase())}),a&&o("button",{type:"button",onClick:()=>d(""),className:"absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer rounded-full px-2 py-1 text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)"},children:"clear"})]})}),t("div",{className:"flex-1 min-h-0 overflow-auto mt-2",style:{backgroundColor:"var(--widget-background)"},children:[o("p",{className:"my-2 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:a?"Search Results":"Available Chains"}),u.length===0?o("div",{className:"px-4 py-3 text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Chain Not Found"}):u.map(e=>t("button",{type:"button",className:"w-full flex items-center justify-between p-3 cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>f(e.id),onMouseEnter:()=>l?.(e.displayName),onMouseLeave:()=>l?.(null),children:[t("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[o("div",{className:"flex-shrink-0",children:o(p,{chain:e.id,size:"md"})}),o("span",{className:"text-base font-medium truncate",style:{color:"var(--widget-foreground)"},children:e.displayName})]}),t("span",{className:"text-xs font-mono",style:{color:"var(--widget-muted-foreground)"},children:["Chain ID: ",e.id]})]},e.id))]})]})},M=y;export{M as a};
2
+ import{O as p,_ as g,g as c,z as m}from"./chunk-EW2OR6CJ.js";import h,{useCallback as C,useState as b}from"react";import{jsx as o,jsxs as t}from"react/jsx-runtime";var y=({toggle:x,side:w,onChainSelect:i,onChainHover:l,containerHeight:N})=>{let[a,d]=b(""),r=m(a,300),v=g(),s=c(v),u=h.useMemo(()=>{if(!r)return s;let e=r.toLowerCase();return s.filter(n=>n.displayName.toLowerCase().includes(e)||n.name.toLowerCase().includes(e)||n.id.toString().includes(e))},[s,r]),f=C(e=>i(e),[i]);return t("div",{className:"w-full h-full flex flex-col",children:[o("div",{className:"flex-shrink-0",children:t("div",{className:"relative mt-1",children:[o("input",{className:"w-full h-10 px-4 text-sm",style:{backgroundColor:"var(--widget-card)",color:"var(--widget-card-foreground)",border:"1px solid var(--widget-border)"},placeholder:"Search chains by name or chain ID...",autoComplete:"off",value:a,onChange:e=>d(e.target.value.toLowerCase())}),a&&o("button",{type:"button",onClick:()=>d(""),className:"absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer rounded-full px-2 py-1 text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)"},children:"clear"})]})}),t("div",{className:"flex-1 min-h-0 overflow-auto mt-2",style:{backgroundColor:"var(--widget-background)"},children:[o("p",{className:"my-2 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:a?"Search Results":"Available Chains"}),u.length===0?o("div",{className:"px-4 py-3 text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Chain Not Found"}):u.map(e=>t("button",{type:"button",className:"w-full flex items-center justify-between p-3 cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>f(e.id),onMouseEnter:()=>l?.(e.displayName),onMouseLeave:()=>l?.(null),children:[t("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[o("div",{className:"flex-shrink-0",children:o(p,{chain:e.id,size:"md"})}),o("span",{className:"text-base font-medium truncate",style:{color:"var(--widget-foreground)"},children:e.displayName})]}),t("span",{className:"text-xs font-mono",style:{color:"var(--widget-muted-foreground)"},children:["Chain ID: ",e.id]})]},e.id))]})]})},M=y;export{M as a};
@@ -1,2 +1,2 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
2
- var _chunk537OMWA3cjs = require('./chunk-537OMWA3.cjs');var _chunkBX3KCZRTcjs = require('./chunk-BX3KCZRT.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _shallow = require('zustand/react/shallow');var _jsxruntime = require('react/jsx-runtime');var H=_react2.default.memo(({asset:n,otherAsset:i,handleFormSelection:S,getToken:G})=>{let{token:g}=_chunkBX3KCZRTcjs.H.call(void 0, n.chainId,n.address),C=G(n.chainId,n.address),a=g||C||n.assetInfo;if(!a)return null;let f=a.price!=null&&n.decimals!==void 0?_chunkBX3KCZRTcjs.w.call(void 0, a,n.balance,n.decimals):null;return _jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>S(a,i),children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, _chunkBX3KCZRTcjs.P,{asset:a,size:"md",className:"flex-shrink-0"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-base font-medium",style:{color:"var(--widget-foreground)"},children:a.symbol.length>20?`${a.symbol.substring(0,20)}...`:a.symbol}),_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",style:{color:"var(--widget-foreground)",opacity:.6},children:a.name.length>20?`${a.name.substring(0,20)}...`:a.name})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-mono",style:{color:"var(--widget-foreground)",opacity:.5},children:"Balance:"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-mono",style:{color:"var(--widget-foreground)"},children:f!=null?`$${f.toFixed(2)}`:"\u2014"})]})]},`${a.chainId}-${a.address}`)},(n,i)=>n.asset.address===i.asset.address&&n.asset.chainId===i.asset.chainId&&n.asset.balance===i.asset.balance&&_optionalChain([n, 'access', _2 => _2.asset, 'access', _3 => _3.assetInfo, 'optionalAccess', _4 => _4.price])===_optionalChain([i, 'access', _5 => _5.asset, 'access', _6 => _6.assetInfo, 'optionalAccess', _7 => _7.price])&&n.otherAsset.address===i.otherAsset.address);H.displayName="AssetSelectionBalanceItem";var Ne=({toggle:n,side:i,otherAsset:S,containerHeight:G,onChainHover:g,onMoreChainsClick:C,selectedChainFilter:a})=>{let{address:_}=_chunk34N36GUDcjs.a.call(void 0, ),{assetSelectionSearch:f,assetSelectionChain:c,assetSelectionCategory:le,recentChainIds:W}=_chunk537OMWA3cjs.c.call(void 0, _shallow.useShallow.call(void 0, e=>({assetSelectionSearch:e.assetSelectionSearch,assetSelectionChain:e.assetSelectionChain,assetSelectionCategory:e.assetSelectionCategory,recentChainIds:e.recentChainIds}))),L=_chunkBX3KCZRTcjs.z.call(void 0, f,300),b=_chunkBX3KCZRTcjs._.call(void 0, ),{supportedInputTokens:de,supportedOutputTokens:ce,supportedInputChains:ue,supportedOutputChains:me,inputSelectionSearch:fe,outputSelectionSearch:pe,showInputSelectionTokenBalances:he,showOutputSelectionTokenBalances:ge}=_chunkBX3KCZRTcjs.b.call(void 0, ),we=i==="base"?fe:pe,be=i==="base"?he:ge,{setBaseToken:q,setQuoteToken:V}=_chunk537OMWA3cjs.f.call(void 0, ),y=i==="base"?de:ce,w=i==="base"?ue:me,B=w.length===1,v=_react.useMemo.call(void 0, ()=>{if(y.length===0)return null;let e=new Set;for(let t of y)e.add(`${t.chainId}-${t.address.toLowerCase()}`);return e},[y]);_react.useEffect.call(void 0, ()=>{B?_chunk537OMWA3cjs.c.getState().setAssetSelectionChain(w[0]):a&&_chunk537OMWA3cjs.c.getState().setAssetSelectionChain(a)},[a,B,w]);let ye=_react2.default.useMemo(()=>{let r=w.length>0?new Set(w):null,s=_chunkBX3KCZRTcjs.g.call(void 0, b).filter(l=>!r||r.has(l.id)).map(l=>({chainId:l.id,name:l.displayName})),d=new Map(s.map(l=>[l.chainId,l])),u=[],h=new Set,Q=d.get(4326);Q&&(u.push(Q),h.add(4326));for(let l of W){if(u.length>=5)break;if(h.has(l))continue;let U=d.get(l);U&&(u.push(U),h.add(l))}for(let l of s){if(u.length>=5)break;h.has(l.chainId)||u.push(l)}return u},[b,W,w]),{enrichedTokens:M,isLoading:ve}=_chunkBX3KCZRTcjs.G.call(void 0, c==="all"?"all":c),{tokenRegistry:j,getToken:D}=_chunkBX3KCZRTcjs.F.call(void 0, ),xe=_react.useMemo.call(void 0, ()=>{let e=new Set;for(let t of j)e.add(`${t.chainId}-${t.address.toLowerCase()}`);return e},[j]),E=_react.useMemo.call(void 0, ()=>v?M.filter(e=>v.has(`${e.chainId}-${e.address.toLowerCase()}`)):M,[M,v]),R=_react2.default.useMemo(()=>{if(!L)return E;let e=L.toLowerCase();return E.filter(t=>(t.symbol||"").toLowerCase().includes(e)||(t.name||"").toLowerCase().includes(e)||t.address.toLowerCase().includes(e))},[E,L]),O=_react2.default.useMemo(()=>{let e=c==="all"?(R||[]).filter(s=>b.includes(s.chainId)):R||[],t=new Set;return[...e.filter(s=>{let d=`${s.chainId}-${s.address.toLowerCase()}`;return t.has(d)?!1:(t.add(d),!0)})].sort((s,d)=>{let u=_chunkBX3KCZRTcjs.k.call(void 0, s),h=_chunkBX3KCZRTcjs.k.call(void 0, d);return u&&!h?-1:!u&&h?1:s.marketCap&&!d.marketCap?-1:!s.marketCap&&d.marketCap?1:!s.marketCap&&!d.marketCap?0:d.marketCap-s.marketCap})},[R,c,b]),{balances:k,isLoading:Ie}=_chunkBX3KCZRTcjs.L.call(void 0, _,b,void 0,y.length>0?y:void 0),P=_react2.default.useMemo(()=>{if(!k)return[];let e=c==="all"?k:k.filter(r=>r.chainId===c),t=new Set;return e.filter(r=>{let s=`${r.chainId}-${(r.address||"").toLowerCase()}`;return t.has(s)?!1:(t.add(s),!0)})},[k,c]),Se=_react.useCallback.call(void 0, e=>{let t=e.target.value.toLowerCase(),r=_chunkBX3KCZRTcjs.x.call(void 0, t),s=_chunk537OMWA3cjs.c.getState();r?(s.setAssetSelectionSearch(r),s.setAssetSelectionAddressInput(r)):(s.setAssetSelectionAddressInput(""),s.setAssetSelectionSearch(t))},[]),F=_react.useCallback.call(void 0, async e=>{i==="base"?await q(e):i==="quote"&&await V(e),n()},[n,i,q,V]);return _jsxruntime.jsxs.call(void 0, "div",{className:"w-full h-full flex flex-col pt-2.5",children:[!B&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row justify-between py-1 flex-shrink-0 h-10",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"flex flex-row items-center w-full h-full px-2.5 whitespace-nowrap font-bold uppercase text-xs cursor-pointer",style:{backgroundColor:c==="all"&&!a?"var(--widget-primary)":"var(--widget-secondary)",color:c==="all"&&!a?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)",borderRadius:"var(--widget-radius) 0 0 var(--widget-radius)"},onClick:e=>{e.stopPropagation(),_chunk537OMWA3cjs.c.getState().setAssetSelectionChain("all")},onMouseEnter:()=>_optionalChain([g, 'optionalCall', _8 => _8("All Chains")]),onMouseLeave:()=>_optionalChain([g, 'optionalCall', _9 => _9(null)]),children:"All"}),ye.map((e,t)=>_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"flex items-center justify-center px-2 w-full cursor-pointer",style:{backgroundColor:c===e.chainId?"var(--widget-primary)":"var(--widget-secondary)",color:c===e.chainId?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)",borderLeft:t===0?"none":"1px solid var(--widget-border)",borderRight:"1px solid var(--widget-border)"},onClick:r=>{r.stopPropagation(),_chunk537OMWA3cjs.c.getState().setAssetSelectionChain(e.chainId)},onMouseEnter:()=>_optionalChain([g, 'optionalCall', _10 => _10(e.name)]),onMouseLeave:()=>_optionalChain([g, 'optionalCall', _11 => _11(null)]),children:_jsxruntime.jsx.call(void 0, "div",{className:"mb-px h-4 w-4",children:_jsxruntime.jsx.call(void 0, _chunkBX3KCZRTcjs.O,{chain:e.chainId,size:"xs"})})},e.chainId)),C&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"flex flex-row cursor-pointer items-center w-full h-full px-2.5 whitespace-nowrap uppercase font-bold text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)",borderRadius:"0 var(--widget-radius) var(--widget-radius) 0"},onClick:e=>{e.stopPropagation(),C()},children:"More"})]}),we&&_jsxruntime.jsx.call(void 0, "div",{className:"flex-shrink-0",children:_jsxruntime.jsxs.call(void 0, "div",{className:"relative mt-1",children:[_jsxruntime.jsx.call(void 0, "input",{className:"w-full h-10 px-4 text-sm",style:{backgroundColor:"var(--widget-card)",color:"var(--widget-card-foreground)",border:"1px solid var(--widget-border)"},placeholder:"Search tokens by name, symbol, or address...",autoComplete:"off",value:f,onChange:Se}),f&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>_chunk537OMWA3cjs.c.getState().setAssetSelectionSearch(""),className:"absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer rounded-full px-2 py-1 text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)"},children:"clear"})]})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex-1 min-h-0 overflow-auto mt-2",style:{backgroundColor:"var(--widget-background)"},children:[be&&!Ie&&P.length>0&&!f&&le==="all"&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "p",{className:"my-1 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:"Your Tokens"}),P.filter(e=>e.assetInfo?v?v.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`):_chunkBX3KCZRTcjs.k.call(void 0, e.assetInfo)||xe.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`):!1).sort((e,t)=>{let r=D(e.chainId,e.address)||e.assetInfo,s=D(t.chainId,t.address)||t.assetInfo,d=r&&e.decimals!==void 0?_chunkBX3KCZRTcjs.w.call(void 0, r,e.balance,e.decimals):0;return(s&&t.decimals!==void 0?_chunkBX3KCZRTcjs.w.call(void 0, s,t.balance,t.decimals):0)-d}).map(e=>!e.assetInfo||!S?null:_jsxruntime.jsx.call(void 0, H,{asset:e,otherAsset:S,handleFormSelection:F,getToken:D},`${e.assetInfo.chainId}-${e.assetInfo.address}`))]}),_jsxruntime.jsx.call(void 0, "p",{className:"my-2 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:f?"Search Results":"Supported Tokens"}),ve?_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center p-8",children:_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-muted-foreground)"},children:"Loading tokens..."})}):O.length===0?_jsxruntime.jsx.call(void 0, "div",{className:"px-4 py-3 text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Token Not Found"}):O.map(e=>_jsxruntime.jsxs.call(void 0, "div",{role:"button",tabIndex:0,className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>F(e),onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),F(e))},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, _chunkBX3KCZRTcjs.P,{asset:e,size:"md",className:"flex-shrink-0"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-base font-medium truncate",style:{color:"var(--widget-foreground)"},children:(e.symbol||"").length>20?`${e.symbol.substring(0,20)}...`:e.symbol||"\u2014"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-sm truncate",style:{color:"var(--widget-muted-foreground)"},children:(e.name||"").length>20?`${e.name.substring(0,20)}...`:e.name||"\u2014"})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-mono",style:{color:"var(--widget-foreground)"},children:e.price?`$${e.price>=999999?`${(e.price/1e6).toFixed(2)}M`:e.price.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:e.price<1?5:2})}`:"\u2014"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs font-mono",style:{color:"var(--widget-muted-foreground)"},children:[_optionalChain([e, 'access', _12 => _12.address, 'optionalAccess', _13 => _13.slice, 'call', _14 => _14(0,6)]),"...",_optionalChain([e, 'access', _15 => _15.address, 'optionalAccess', _16 => _16.slice, 'call', _17 => _17(-4)])]})]})]},`${e.chainId}-${e.address}`))]})]})},Ue= exports.a =Ne;exports.a = Ue;
2
+ var _chunkUZWGYG2Scjs = require('./chunk-UZWGYG2S.cjs');var _chunkLXEKOQAGcjs = require('./chunk-LXEKOQAG.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _shallow = require('zustand/react/shallow');var _jsxruntime = require('react/jsx-runtime');var H=_react2.default.memo(({asset:n,otherAsset:i,handleFormSelection:S,getToken:G})=>{let{token:g}=_chunkLXEKOQAGcjs.H.call(void 0, n.chainId,n.address),C=G(n.chainId,n.address),a=g||C||n.assetInfo;if(!a)return null;let f=a.price!=null&&n.decimals!==void 0?_chunkLXEKOQAGcjs.w.call(void 0, a,n.balance,n.decimals):null;return _jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>S(a,i),children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, _chunkLXEKOQAGcjs.P,{asset:a,size:"md",className:"flex-shrink-0"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-base font-medium",style:{color:"var(--widget-foreground)"},children:a.symbol.length>20?`${a.symbol.substring(0,20)}...`:a.symbol}),_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",style:{color:"var(--widget-foreground)",opacity:.6},children:a.name.length>20?`${a.name.substring(0,20)}...`:a.name})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-mono",style:{color:"var(--widget-foreground)",opacity:.5},children:"Balance:"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-mono",style:{color:"var(--widget-foreground)"},children:f!=null?`$${f.toFixed(2)}`:"\u2014"})]})]},`${a.chainId}-${a.address}`)},(n,i)=>n.asset.address===i.asset.address&&n.asset.chainId===i.asset.chainId&&n.asset.balance===i.asset.balance&&_optionalChain([n, 'access', _2 => _2.asset, 'access', _3 => _3.assetInfo, 'optionalAccess', _4 => _4.price])===_optionalChain([i, 'access', _5 => _5.asset, 'access', _6 => _6.assetInfo, 'optionalAccess', _7 => _7.price])&&n.otherAsset.address===i.otherAsset.address);H.displayName="AssetSelectionBalanceItem";var Ne=({toggle:n,side:i,otherAsset:S,containerHeight:G,onChainHover:g,onMoreChainsClick:C,selectedChainFilter:a})=>{let{address:_}=_chunk34N36GUDcjs.a.call(void 0, ),{assetSelectionSearch:f,assetSelectionChain:c,assetSelectionCategory:le,recentChainIds:W}=_chunkUZWGYG2Scjs.c.call(void 0, _shallow.useShallow.call(void 0, e=>({assetSelectionSearch:e.assetSelectionSearch,assetSelectionChain:e.assetSelectionChain,assetSelectionCategory:e.assetSelectionCategory,recentChainIds:e.recentChainIds}))),L=_chunkLXEKOQAGcjs.z.call(void 0, f,300),b=_chunkLXEKOQAGcjs._.call(void 0, ),{supportedInputTokens:de,supportedOutputTokens:ce,supportedInputChains:ue,supportedOutputChains:me,inputSelectionSearch:fe,outputSelectionSearch:pe,showInputSelectionTokenBalances:he,showOutputSelectionTokenBalances:ge}=_chunkLXEKOQAGcjs.b.call(void 0, ),we=i==="base"?fe:pe,be=i==="base"?he:ge,{setBaseToken:q,setQuoteToken:V}=_chunkUZWGYG2Scjs.f.call(void 0, ),y=i==="base"?de:ce,w=i==="base"?ue:me,B=w.length===1,v=_react.useMemo.call(void 0, ()=>{if(y.length===0)return null;let e=new Set;for(let t of y)e.add(`${t.chainId}-${t.address.toLowerCase()}`);return e},[y]);_react.useEffect.call(void 0, ()=>{B?_chunkUZWGYG2Scjs.c.getState().setAssetSelectionChain(w[0]):a&&_chunkUZWGYG2Scjs.c.getState().setAssetSelectionChain(a)},[a,B,w]);let ye=_react2.default.useMemo(()=>{let r=w.length>0?new Set(w):null,s=_chunkLXEKOQAGcjs.g.call(void 0, b).filter(l=>!r||r.has(l.id)).map(l=>({chainId:l.id,name:l.displayName})),d=new Map(s.map(l=>[l.chainId,l])),u=[],h=new Set,Q=d.get(4326);Q&&(u.push(Q),h.add(4326));for(let l of W){if(u.length>=5)break;if(h.has(l))continue;let U=d.get(l);U&&(u.push(U),h.add(l))}for(let l of s){if(u.length>=5)break;h.has(l.chainId)||u.push(l)}return u},[b,W,w]),{enrichedTokens:M,isLoading:ve}=_chunkLXEKOQAGcjs.G.call(void 0, c==="all"?"all":c),{tokenRegistry:j,getToken:D}=_chunkLXEKOQAGcjs.F.call(void 0, ),xe=_react.useMemo.call(void 0, ()=>{let e=new Set;for(let t of j)e.add(`${t.chainId}-${t.address.toLowerCase()}`);return e},[j]),E=_react.useMemo.call(void 0, ()=>v?M.filter(e=>v.has(`${e.chainId}-${e.address.toLowerCase()}`)):M,[M,v]),R=_react2.default.useMemo(()=>{if(!L)return E;let e=L.toLowerCase();return E.filter(t=>(t.symbol||"").toLowerCase().includes(e)||(t.name||"").toLowerCase().includes(e)||t.address.toLowerCase().includes(e))},[E,L]),O=_react2.default.useMemo(()=>{let e=c==="all"?(R||[]).filter(s=>b.includes(s.chainId)):R||[],t=new Set;return[...e.filter(s=>{let d=`${s.chainId}-${s.address.toLowerCase()}`;return t.has(d)?!1:(t.add(d),!0)})].sort((s,d)=>{let u=_chunkLXEKOQAGcjs.k.call(void 0, s),h=_chunkLXEKOQAGcjs.k.call(void 0, d);return u&&!h?-1:!u&&h?1:s.marketCap&&!d.marketCap?-1:!s.marketCap&&d.marketCap?1:!s.marketCap&&!d.marketCap?0:d.marketCap-s.marketCap})},[R,c,b]),{balances:k,isLoading:Ie}=_chunkLXEKOQAGcjs.L.call(void 0, _,b,void 0,y.length>0?y:void 0),P=_react2.default.useMemo(()=>{if(!k)return[];let e=c==="all"?k:k.filter(r=>r.chainId===c),t=new Set;return e.filter(r=>{let s=`${r.chainId}-${(r.address||"").toLowerCase()}`;return t.has(s)?!1:(t.add(s),!0)})},[k,c]),Se=_react.useCallback.call(void 0, e=>{let t=e.target.value.toLowerCase(),r=_chunkLXEKOQAGcjs.x.call(void 0, t),s=_chunkUZWGYG2Scjs.c.getState();r?(s.setAssetSelectionSearch(r),s.setAssetSelectionAddressInput(r)):(s.setAssetSelectionAddressInput(""),s.setAssetSelectionSearch(t))},[]),F=_react.useCallback.call(void 0, async e=>{i==="base"?await q(e):i==="quote"&&await V(e),n()},[n,i,q,V]);return _jsxruntime.jsxs.call(void 0, "div",{className:"w-full h-full flex flex-col pt-2.5",children:[!B&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row justify-between py-1 flex-shrink-0 h-10",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"flex flex-row items-center w-full h-full px-2.5 whitespace-nowrap font-bold uppercase text-xs cursor-pointer",style:{backgroundColor:c==="all"&&!a?"var(--widget-primary)":"var(--widget-secondary)",color:c==="all"&&!a?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)",borderRadius:"var(--widget-radius) 0 0 var(--widget-radius)"},onClick:e=>{e.stopPropagation(),_chunkUZWGYG2Scjs.c.getState().setAssetSelectionChain("all")},onMouseEnter:()=>_optionalChain([g, 'optionalCall', _8 => _8("All Chains")]),onMouseLeave:()=>_optionalChain([g, 'optionalCall', _9 => _9(null)]),children:"All"}),ye.map((e,t)=>_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"flex items-center justify-center px-2 w-full cursor-pointer",style:{backgroundColor:c===e.chainId?"var(--widget-primary)":"var(--widget-secondary)",color:c===e.chainId?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)",borderLeft:t===0?"none":"1px solid var(--widget-border)",borderRight:"1px solid var(--widget-border)"},onClick:r=>{r.stopPropagation(),_chunkUZWGYG2Scjs.c.getState().setAssetSelectionChain(e.chainId)},onMouseEnter:()=>_optionalChain([g, 'optionalCall', _10 => _10(e.name)]),onMouseLeave:()=>_optionalChain([g, 'optionalCall', _11 => _11(null)]),children:_jsxruntime.jsx.call(void 0, "div",{className:"mb-px h-4 w-4",children:_jsxruntime.jsx.call(void 0, _chunkLXEKOQAGcjs.O,{chain:e.chainId,size:"xs"})})},e.chainId)),C&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"flex flex-row cursor-pointer items-center w-full h-full px-2.5 whitespace-nowrap uppercase font-bold text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)",borderRadius:"0 var(--widget-radius) var(--widget-radius) 0"},onClick:e=>{e.stopPropagation(),C()},children:"More"})]}),we&&_jsxruntime.jsx.call(void 0, "div",{className:"flex-shrink-0",children:_jsxruntime.jsxs.call(void 0, "div",{className:"relative mt-1",children:[_jsxruntime.jsx.call(void 0, "input",{className:"w-full h-10 px-4 text-sm",style:{backgroundColor:"var(--widget-card)",color:"var(--widget-card-foreground)",border:"1px solid var(--widget-border)"},placeholder:"Search tokens by name, symbol, or address...",autoComplete:"off",value:f,onChange:Se}),f&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>_chunkUZWGYG2Scjs.c.getState().setAssetSelectionSearch(""),className:"absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer rounded-full px-2 py-1 text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)"},children:"clear"})]})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex-1 min-h-0 overflow-auto mt-2",style:{backgroundColor:"var(--widget-background)"},children:[be&&!Ie&&P.length>0&&!f&&le==="all"&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "p",{className:"my-1 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:"Your Tokens"}),P.filter(e=>e.assetInfo?v?v.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`):_chunkLXEKOQAGcjs.k.call(void 0, e.assetInfo)||xe.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`):!1).sort((e,t)=>{let r=D(e.chainId,e.address)||e.assetInfo,s=D(t.chainId,t.address)||t.assetInfo,d=r&&e.decimals!==void 0?_chunkLXEKOQAGcjs.w.call(void 0, r,e.balance,e.decimals):0;return(s&&t.decimals!==void 0?_chunkLXEKOQAGcjs.w.call(void 0, s,t.balance,t.decimals):0)-d}).map(e=>!e.assetInfo||!S?null:_jsxruntime.jsx.call(void 0, H,{asset:e,otherAsset:S,handleFormSelection:F,getToken:D},`${e.assetInfo.chainId}-${e.assetInfo.address}`))]}),_jsxruntime.jsx.call(void 0, "p",{className:"my-2 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:f?"Search Results":"Supported Tokens"}),ve?_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center p-8",children:_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-muted-foreground)"},children:"Loading tokens..."})}):O.length===0?_jsxruntime.jsx.call(void 0, "div",{className:"px-4 py-3 text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Token Not Found"}):O.map(e=>_jsxruntime.jsxs.call(void 0, "div",{role:"button",tabIndex:0,className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>F(e),onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),F(e))},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, _chunkLXEKOQAGcjs.P,{asset:e,size:"md",className:"flex-shrink-0"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-base font-medium truncate",style:{color:"var(--widget-foreground)"},children:(e.symbol||"").length>20?`${e.symbol.substring(0,20)}...`:e.symbol||"\u2014"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-sm truncate",style:{color:"var(--widget-muted-foreground)"},children:(e.name||"").length>20?`${e.name.substring(0,20)}...`:e.name||"\u2014"})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-mono",style:{color:"var(--widget-foreground)"},children:e.price?`$${e.price>=999999?`${(e.price/1e6).toFixed(2)}M`:e.price.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:e.price<1?5:2})}`:"\u2014"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs font-mono",style:{color:"var(--widget-muted-foreground)"},children:[_optionalChain([e, 'access', _12 => _12.address, 'optionalAccess', _13 => _13.slice, 'call', _14 => _14(0,6)]),"...",_optionalChain([e, 'access', _15 => _15.address, 'optionalAccess', _16 => _16.slice, 'call', _17 => _17(-4)])]})]})]},`${e.chainId}-${e.address}`))]})]})},Ue= exports.a =Ne;exports.a = Ue;
@@ -7,7 +7,7 @@ var _react = require('react'); var _react2 = _interopRequireDefault(_react);var
7
7
  .aori-cm-check { stroke-dasharray: 73; stroke-dashoffset: 73; animation: aori-cm-check 0.4s ease-in-out 0.4s forwards; }
8
8
  .aori-cm-fill-mask { animation: aori-cm-fill 0.3s ease-in-out 0.3s forwards; }
9
9
  `}),_jsxruntime.jsxs.call(void 0, "g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:[_jsxruntime.jsx.call(void 0, "circle",{fill:"var(--widget-status-completed)",cx:"66.5",cy:"66.5",r:"54.5"}),_jsxruntime.jsx.call(void 0, "circle",{className:"aori-cm-fill-mask",fill:"var(--widget-background)",cx:"66.5",cy:"66.5",r:"55.5"}),_jsxruntime.jsx.call(void 0, "circle",{className:"aori-cm-outline",stroke:"var(--widget-status-completed)",strokeWidth:"4",cx:"66.5",cy:"66.5",r:"54.5",fill:"none"}),_jsxruntime.jsx.call(void 0, "polyline",{className:"aori-cm-check",stroke:"var(--widget-background)",strokeWidth:"6",fill:"none",points:"41 70 56 85 92 49"})]})]})}function _2(A){return _jsxruntime.jsxs.call(void 0, "svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...A,children:[_jsxruntime.jsx.call(void 0, "path",{d:"M14 8H4C2.897 8 2 8.897 2 10V20C2 21.103 2.897 22 4 22H14C15.103 22 16 21.103 16 20V10C16 8.897 15.103 8 14 8Z",fill:"currentColor"}),_jsxruntime.jsx.call(void 0, "path",{d:"M20 2H10C8.896 2 8 2.896 8 4V6H9H16C17.104 6 18 6.896 18 8V15V16H20C21.104 16 22 15.104 22 14V4C22 2.896 21.104 2 20 2Z",fill:"currentColor"})]})}var Re=(A,e)=>{let[t,r]=_react.useState.call(void 0, ""),[o,a]=_react.useState.call(void 0, ""),[s,i]=_react.useState.call(void 0, []),l=_react.useRef.call(void 0, null),n="abcdefghijklmnopqrstuvwxyz",g=c=>{let f="";for(let C=0;C<c;C++)f+=n[Math.floor(Math.random()*n.length)];return f};return _react.useEffect.call(void 0, ()=>{l.current&&clearInterval(l.current);let c=0,f=()=>{if(c>=A.length){r(A),a(""),i(new Array(A.length).fill(e)),l.current&&(clearInterval(l.current),l.current=null);return}let C=A.substring(0,c),d=Math.max(0,A.length-c),B=d>0?g(d):"",u=new Array(A.length).fill(!1).map((p,P)=>P<c?e:!1);r(C),a(B),i(u),c++};return l.current=setInterval(f,25),()=>{l.current&&clearInterval(l.current)}},[A,e]),{displayText:t,suffix:o,characterColors:s}},je=({targetText:A,isError:e,font:t=""})=>{let{displayText:r,suffix:o,characterColors:a}=Re(A,e);return _jsxruntime.jsxs.call(void 0, "span",{className:t,children:[r.split("").map((s,i)=>_jsxruntime.jsx.call(void 0, "span",{style:a[i]?{color:"var(--widget-destructive)"}:void 0,children:s},`revealed-${i}`)),o&&_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-muted-foreground)",opacity:.3},children:o})]})},Ke=({text:A,type:e,color:t="white",size:r="text-base",font:o="font-medium",className:a="",children:s,showCopyIcon:i=!0,disableScramble:l=!1})=>{let[n,g]=_react.useState.call(void 0, !1),[c,f]=_react.useState.call(void 0, ""),C=_react.useRef.call(void 0, null);_react.useEffect.call(void 0, ()=>()=>{C.current&&(clearTimeout(C.current),C.current=null)},[]);let d=()=>{C.current&&(clearTimeout(C.current),C.current=null),navigator.clipboard.writeText(A).then(()=>{g(!0),C.current=setTimeout(()=>{g(!1),C.current=null},2e3)}).catch(()=>{f("Failed to copy"),C.current=setTimeout(()=>{f(""),C.current=null},3e3)})},B=t==="teal"?"text-textSuccess":"text-text",p=(()=>{if(c)return c;if(n)switch(e){case"address":return"Address Copied!";case"hash":return"Hash Copied!";case"link":return"Link Copied!";case"pair":return"Pair Copied!";case"data":return"Data Copied!";default:return"Copied!"}return s?"":e==="address"||e==="hash"?A2(A):A})(),P=!!c,Q2=`${n}-${c}-${A}`;return _jsxruntime.jsx.call(void 0, "div",{className:"relative",children:_jsxruntime.jsx.call(void 0, "button",{type:"button",className:`relative flex cursor-pointer items-center bg-transparent border-none p-0 ${a} ${t==="black"?"px-4 rounded-full h-8 bg-gray-800":""}`,onClick:O=>{O.stopPropagation(),d()},children:_jsxruntime.jsxs.call(void 0, "span",{className:`flex items-center gap-0.5 ${B} ${r} ${o}`,children:[c||n?l?p:_jsxruntime.jsx.call(void 0, "span",{children:_jsxruntime.jsx.call(void 0, je,{targetText:p,isError:P,font:o})},Q2):_nullishCoalesce(s, () => (p)),i&&!c&&_jsxruntime.jsxs.call(void 0, "div",{className:"relative ml-1 h-3 w-3",children:[_jsxruntime.jsx.call(void 0, _2,{className:`absolute inset-0 ${n?"opacity-0":"opacity-100"} transition-opacity duration-200 ${o}`}),_jsxruntime.jsx.call(void 0, "div",{className:`absolute inset-0 ${n?"opacity-100":"opacity-0"} transition-opacity duration-200`,children:_jsxruntime.jsx.call(void 0, k,{className:"h-3 w-3"})})]})]})})})},ke= exports.R =Ke;var Xe=A=>_jsxruntime.jsx.call(void 0, "div",{className:"flex animate-pulse",children:_jsxruntime.jsx.call(void 0, "div",{...A})}),ze= exports.S =Xe;function Ve(A){return _jsxruntime.jsx.call(void 0, "svg",{width:"417",height:"417",viewBox:"0 0 417 417",fill:"none",xmlns:"http://www.w3.org/2000/svg",...A,children:_jsxruntime.jsx.call(void 0, "path",{d:"M215.855 0.0932617C153.901 0.0932617 95.6665 30.1873 58.0271 80.0623L0.393888 45.4993L0.273444 243.343L165.433 144.53L112.347 112.655C138.423 82.3423 175.941 64.0923 215.854 64.0923C292.366 64.0923 354.606 128.686 354.606 208.092C354.606 287.498 292.366 352.092 215.854 352.092L215.854 416.092C326.362 416.092 416.273 322.779 416.273 208.092C416.273 93.4053 326.363 0.0932617 215.855 0.0932617Z",fill:"currentColor"})})}function We(A){return _jsxruntime.jsx.call(void 0, "svg",{viewBox:"0 0 60.671 60.671",...A,children:_jsxruntime.jsx.call(void 0, "g",{children:_jsxruntime.jsxs.call(void 0, "g",{children:[_jsxruntime.jsx.call(void 0, "ellipse",{cx:"30.336",cy:"12.097",rx:"11.997",ry:"12.097",fill:"currentColor"}),_jsxruntime.jsx.call(void 0, "path",{d:`M35.64,30.079H25.031c-7.021,0-12.714,5.739-12.714,12.821v17.771h36.037V42.9
10
- C48.354,35.818,42.661,30.079,35.64,30.079z`,fill:"currentColor"})]})})})}function Ze(A){return _jsxruntime.jsx.call(void 0, "svg",{viewBox:"0 0 10 6",fill:"none",xmlns:"http://www.w3.org/2000/svg",...A,children:_jsxruntime.jsx.call(void 0, "path",{d:"M10 0L5 6L0 0H10Z",fill:"currentColor"})})}var _e={3:"h-3 w-3",4:"h-4 w-4",5:"h-5 w-5",6:"h-6 w-6",8:"h-8 w-8",10:"h-10 w-10"},nA=_react2.default.memo(({size:A,color:e,className:t})=>{let r=_nullishCoalesce(_e[A], () => (`h-${A} w-${A}`));return _jsxruntime.jsx.call(void 0, "div",{className:`inline-flex items-center justify-center ${_nullishCoalesce(t, () => (""))}`,children:_jsxruntime.jsxs.call(void 0, "svg",{"aria-hidden":"true",className:`${r} animate-spin`,style:e?{color:e}:{color:"currentColor"},viewBox:"0 0 100 101",xmlns:"http://www.w3.org/2000/svg",children:[_jsxruntime.jsx.call(void 0, "path",{id:"track-text-muted",d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor",opacity:".2"}),_jsxruntime.jsx.call(void 0, "path",{id:"thumb-fill-inverse",d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentColor"})]})})});nA.displayName="LoadingSpinner";var $e=nA;function aA(A){return _jsxruntime.jsxs.call(void 0, "svg",{viewBox:"0 0 133 133",...A,children:[_jsxruntime.jsx.call(void 0, "style",{children:`
10
+ C48.354,35.818,42.661,30.079,35.64,30.079z`,fill:"currentColor"})]})})})}function Ze(A){return _jsxruntime.jsx.call(void 0, "svg",{viewBox:"0 0 10 6",width:"10",height:"6",fill:"none",xmlns:"http://www.w3.org/2000/svg",...A,children:_jsxruntime.jsx.call(void 0, "path",{d:"M10 0L5 6L0 0H10Z",fill:"currentColor"})})}var _e={3:"h-3 w-3",4:"h-4 w-4",5:"h-5 w-5",6:"h-6 w-6",8:"h-8 w-8",10:"h-10 w-10"},nA=_react2.default.memo(({size:A,color:e,className:t})=>{let r=_nullishCoalesce(_e[A], () => (`h-${A} w-${A}`));return _jsxruntime.jsx.call(void 0, "div",{className:`inline-flex items-center justify-center ${_nullishCoalesce(t, () => (""))}`,children:_jsxruntime.jsxs.call(void 0, "svg",{"aria-hidden":"true",className:`${r} animate-spin`,style:e?{color:e}:{color:"currentColor"},viewBox:"0 0 100 101",xmlns:"http://www.w3.org/2000/svg",children:[_jsxruntime.jsx.call(void 0, "path",{id:"track-text-muted",d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor",opacity:".2"}),_jsxruntime.jsx.call(void 0, "path",{id:"thumb-fill-inverse",d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentColor"})]})})});nA.displayName="LoadingSpinner";var $e=nA;function aA(A){return _jsxruntime.jsxs.call(void 0, "svg",{viewBox:"0 0 133 133",...A,children:[_jsxruntime.jsx.call(void 0, "style",{children:`
11
11
  @keyframes aori-rd-circle { from { stroke-dashoffset: 343; } to { stroke-dashoffset: 0; } }
12
12
  @keyframes aori-rd-fill { from { opacity: 1; } to { opacity: 0; } }
13
13
  @keyframes aori-rd-arc { from { stroke-dashoffset: 140; } to { stroke-dashoffset: 0; } }