@aori/mega-swap-widget 0.1.15 → 0.1.16

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 (35) hide show
  1. package/dist/AssetSelectionMenu-QUYLIWF6.cjs +2 -0
  2. package/dist/AssetSelectionMenu-Y22P66NU.js +2 -0
  3. package/dist/ChainSelectionMenu-WP4NUKLE.js +2 -0
  4. package/dist/ChainSelectionMenu-ZD45H7UK.cjs +2 -0
  5. package/dist/{SwapFormHorizontal-TN7TRDH6.js → SwapFormHorizontal-4I62BLL5.js} +1 -1
  6. package/dist/{SwapFormHorizontal-PKQLLSWV.cjs → SwapFormHorizontal-KLHETHO7.cjs} +1 -1
  7. package/dist/{SwapFormSplit-ULDMGQV4.js → SwapFormSplit-IELLBO2H.js} +1 -1
  8. package/dist/{SwapFormSplit-P3SM3A7K.cjs → SwapFormSplit-TCNCJ2RZ.cjs} +1 -1
  9. package/dist/{WidgetWalletPanel-5PATFPG7.js → WidgetWalletPanel-AURKQTEI.js} +1 -1
  10. package/dist/{WidgetWalletPanel-YDJROJ5X.cjs → WidgetWalletPanel-GRMMFVB3.cjs} +1 -1
  11. package/dist/{chunk-DNOZXHWQ.js → chunk-35ZPLEDO.js} +1 -1
  12. package/dist/{chunk-KJGKWM6Y.cjs → chunk-56YIUX2E.cjs} +1 -1
  13. package/dist/{chunk-4DL25Q57.cjs → chunk-6LRPIPEJ.cjs} +1 -1
  14. package/dist/{chunk-5ETKDN5C.js → chunk-CVGCH27X.js} +1 -1
  15. package/dist/{chunk-TN27ALOV.cjs → chunk-DKQEAQKQ.cjs} +1 -1
  16. package/dist/{chunk-BKAIYAE7.js → chunk-G6OBWGMM.js} +1 -1
  17. package/dist/{chunk-TTVEGOCZ.cjs → chunk-GHXNROJ6.cjs} +1 -1
  18. package/dist/{chunk-7ZT3SGKA.js → chunk-HBYURJBD.js} +1 -1
  19. package/dist/{chunk-OOKW3V5M.cjs → chunk-JIKZMC5K.cjs} +1 -1
  20. package/dist/{chunk-GQ63BSRF.js → chunk-QFN5HDLC.js} +1 -1
  21. package/dist/{chunk-GGP6UREO.js → chunk-VRUC4M2Z.js} +1 -1
  22. package/dist/{chunk-RRDWIVV4.cjs → chunk-W5QRZMIR.cjs} +1 -1
  23. package/dist/chunk-WHW7AQLW.js +2 -0
  24. package/dist/chunk-YXIROEIP.cjs +2 -0
  25. package/dist/index.cjs +2 -2
  26. package/dist/index.d.cts +3 -3
  27. package/dist/index.d.ts +3 -3
  28. package/dist/index.js +2 -2
  29. package/package.json +1 -1
  30. package/dist/AssetSelectionMenu-6CVRQVYF.cjs +0 -2
  31. package/dist/AssetSelectionMenu-L4HLQ6EE.js +0 -2
  32. package/dist/ChainSelectionMenu-OEUXOW4U.cjs +0 -2
  33. package/dist/ChainSelectionMenu-ZBCBZLUJ.js +0 -2
  34. package/dist/chunk-62ZNAMP7.js +0 -2
  35. package/dist/chunk-OPACGOVQ.cjs +0 -2
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
+ "use client";var _chunk56YIUX2Ecjs = require('./chunk-56YIUX2E.cjs');require('./chunk-6LRPIPEJ.cjs');require('./chunk-DKQEAQKQ.cjs');require('./chunk-GHXNROJ6.cjs');require('./chunk-NVCIA743.cjs');require('./chunk-34N36GUD.cjs');require('./chunk-T3I3AJXV.cjs');exports.default = _chunk56YIUX2Ecjs.a;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use client";import{a}from"./chunk-35ZPLEDO.js";import"./chunk-G6OBWGMM.js";import"./chunk-HBYURJBD.js";import"./chunk-VRUC4M2Z.js";import"./chunk-SJMURCHX.js";import"./chunk-46H44R7V.js";import"./chunk-73CB2I7U.js";export{a as default};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use client";import{a}from"./chunk-CVGCH27X.js";import"./chunk-G6OBWGMM.js";import"./chunk-VRUC4M2Z.js";import"./chunk-SJMURCHX.js";import"./chunk-73CB2I7U.js";export{a as default};
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
+ "use client";var _chunkJIKZMC5Kcjs = require('./chunk-JIKZMC5K.cjs');require('./chunk-6LRPIPEJ.cjs');require('./chunk-GHXNROJ6.cjs');require('./chunk-NVCIA743.cjs');require('./chunk-T3I3AJXV.cjs');exports.default = _chunkJIKZMC5Kcjs.a;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use client";import{a as ue}from"./chunk-GQ63BSRF.js";import{f as ne,h as ae,i as de,j as w,k as h,l as ce,m as pe,v as me,w as ge}from"./chunk-62ZNAMP7.js";import{a as H}from"./chunk-DNOZXHWQ.js";import{a as U}from"./chunk-5ETKDN5C.js";import{a as le}from"./chunk-BKAIYAE7.js";import"./chunk-OPN7WCJR.js";import{e as re}from"./chunk-7ZT3SGKA.js";import{b as ie,d}from"./chunk-GGP6UREO.js";import"./chunk-SJMURCHX.js";import{a as se}from"./chunk-46H44R7V.js";import"./chunk-73CB2I7U.js";import{useCallback as m,useEffect as Ve,useMemo as De,useRef as je,useState as fe}from"react";import{useShallow as Ge}from"zustand/react/shallow";import{Fragment as N,jsx as e,jsxs as r}from"react/jsx-runtime";var q=()=>{},ze=({onSwapSubmitted:we,onSwapInitiated:he,onBackToSwap:k,onMoreChainsClick:Ee,startPolling:ve,trackNativeTransaction:be})=>{let{web3ConnectionType:Le,hasConnectHandler:xe,lockBase:O,lockQuote:I,disableInverting:Se,swapButtonVariant:R,tokenDisplay:V,tokenBadgeOrientation:A,widgetType:Ce,assetMenuVariant:ye}=ie(),{effectiveInputTokens:ke,effectiveOutputTokens:Ae}=le(),v=ke.length===1,b=Ae.length===1,D=V==="pill"||V==="ghost",F=Ce==="compact",{baseToken:t,quoteToken:o,baseAmount:i,quoteAmount:u,isBaseGasToken:M,isQuoteGasToken:Pe,isWrappingPair:a,isUnwrappingPair:l,baseBalance:g,quoteBalance:_e,setBaseAmount:y,setQuoteAmount:c,swapTokens:j,clearForm:G}=re(),{rfqQuote:Je,status:Ke,handleInputChange:B,ensureForParams:z,stop:Xe,clear:x,refresh:E}=ne(),{address:p}=se(),{openConnectModal:Te}=ae(),{isRecipientInputOpen:W,txStatus:L,view:S,selectedChainFilterChainId:_}=d(Ge(s=>({isRecipientInputOpen:s.isRecipientInputOpen,txStatus:s.txStatus,view:s.view,selectedChainFilterChainId:s.selectedChainFilter?.chainId??null}))),[P,qe]=fe(null),[T,J]=fe(null),Ne=je(!1),n=!1,Oe=De(()=>!t||!o||typeof i!="number"||!u||!p||parseFloat(g.formatted)<i?null:{base:t,quote:o,baseAmount:i,quoteAmount:u,userAddress:p},[t,o,i,u,p,g.formatted]),Ie=m(s=>{J(s),d.getState().startTracking(s)},[]),Re=m(()=>{Ne.current=!0,E()},[E]);Ve(()=>{if(P===null&&!(!t||!o)){if(!i||i<=0){B({amount:null,inputToken:t,outputToken:o,setOutputAmount:c});return}if(a||l){c(i);return}B({amount:i,inputToken:t,outputToken:o,setOutputAmount:c})}},[P,i,t,o,a,l,B,c]);let $=m(()=>{d.getState().setView("baseSelection")},[]),Q=m(()=>{d.getState().setView("quoteSelection")},[]),Fe=m(()=>{x(),j(),y(null),c(null)},[x,j,y,c]),Me=m(async()=>{if(!g.formatted||!t||!o)return;let s=parseFloat(g.formatted);if(!s||s<=0)return;let f;if(M){let C=await de(t.chainId,p??void 0,g.raw);if(f=Math.max(0,s-C),f<=0)return}else f=s*.9999999999;a||l?(y(f),c(f),x()):(y(f),c(null),z({inputToken:t,outputToken:o,inputAmount:f.toString(),setOutputAmount:C=>c(C)}))},[g.formatted,g.raw,t,o,p,M,a,l,y,c,x,z]),Be=m(()=>{x(),G()},[x,G]),K=g.formatted?parseFloat(g.formatted):null,We=!!(i||u),X=ye==="split",Y=X&&(S==="baseSelection"||S==="baseChainSelection"),Z=X&&(S==="quoteSelection"||S==="quoteChainSelection"),ee=m(s=>{let C=d.getState().view==="baseChainSelection"?"base":"quote";d.getState().setChainFilter({chainId:s,side:C}),d.getState().pushRecentChain(s),d.getState().transitionToView(C==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),$e=m(()=>{d.getState().transitionToView("baseChainSelection","chainSelection")},[]),Qe=m(()=>{d.getState().transitionToView("quoteChainSelection","chainSelection")},[]),He=t?.price&&i?`$${(t.price*i).toFixed(2)}`:"$0.00",Ue=o?.price&&u?`$${(o.price*u).toFixed(2)}`:"$0.00",te=P==="trackingTx"&&!!T&&!!t&&!!o&&!!i&&!!u,oe={backgroundColor:R==="default"?"var(--widget-primary)":"transparent",color:R==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:R!=="default"?"1px solid var(--widget-primary)":"none",borderRadius:"var(--widget-radius)"};return r("div",{className:"flex flex-col w-full",children:[te&&T&&t&&o&&i&&u?e("div",{className:"flex-1 min-h-0 overflow-hidden",children:e(ge,{orderHash:T,base:t,quote:o,baseAmount:i,quoteAmount:u,status:L})}):r("div",{className:`grid grid-cols-[1fr_auto_1fr] items-stretch px-4 ${F?"pt-3 pb-1":"pt-4 pb-2"} gap-2`,children:[e("div",{className:`relative flex flex-col gap-1 p-3 rounded-lg overflow-hidden ${Y?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:Y?S==="baseChainSelection"?e(U,{toggle:k??q,side:"base",onChainSelect:ee}):e(H,{toggle:k??q,side:"base",otherAsset:o,onMoreChainsClick:$e,selectedChainFilter:_}):r(N,{children:[D?F?r("div",{className:`flex items-center gap-2 ${A==="right"?"flex-row-reverse":"flex-row"}`,children:[e(h,{toggle:$,side:"base",asset:t,isPlacingOrder:n||O||v,hideDropdown:v}),e("div",{className:"flex-1 min-w-0",children:e(w,{side:"base",asset:t??null,otherAsset:o??null,isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})})]}):r("div",{className:`flex flex-col ${A==="right"?"items-end":"items-start"}`,children:[e(h,{toggle:$,side:"base",asset:t,isPlacingOrder:n||O||v,hideDropdown:v}),e(w,{side:"base",asset:t??null,otherAsset:o??null,isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})]}):r(N,{children:[e(h,{toggle:$,side:"base",asset:t,isPlacingOrder:n||O||v,hideDropdown:v}),e(w,{side:"base",asset:t??null,otherAsset:o??null,isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})]}),r("div",{className:"flex items-center justify-between",children:[e("span",{className:"font-sans text-xs",style:{color:"var(--widget-muted-foreground)"},children:He}),p&&K!==null&&K>0&&e("button",{type:"button",onClick:Me,disabled:n,className:"flex items-center rounded-full px-2 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 transition-colors bg-(--widget-primary) text-(--widget-primary-foreground) hover:bg-(--widget-foreground) hover:text-(--widget-card)",children:"Max"})]})]})}),e("div",{className:"flex items-center justify-center px-1",children:Se?e("div",{className:"flex h-8 w-8 items-center justify-center opacity-20",children:e("span",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"\u2192"})}):e("button",{type:"button",onClick:Fe,"aria-label":"Swap input and output tokens",className:"flex h-8 w-8 items-center justify-center rounded-full cursor-pointer transition-colors bg-(--widget-card) text-(--widget-muted-foreground) hover:bg-(--widget-secondary) hover:text-(--widget-foreground)",style:{border:"1px solid var(--widget-border)"},children:e(pe,{className:"w-3.5 h-3.5"})})}),e("div",{className:`relative flex flex-col gap-1 p-3 rounded-lg overflow-hidden ${Z?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:Z?S==="quoteChainSelection"?e(U,{toggle:k??q,side:"quote",onChainSelect:ee}):e(H,{toggle:k??q,side:"quote",otherAsset:t,onMoreChainsClick:Qe,selectedChainFilter:_}):r(N,{children:[D?F?r("div",{className:`flex items-center gap-2 ${A==="right"?"flex-row-reverse":"flex-row"}`,children:[e(h,{toggle:Q,side:"quote",asset:o,isPlacingOrder:n||I||b,hideDropdown:b}),e("div",{className:"flex-1 min-w-0",children:e(w,{side:"quote",asset:o??null,otherAsset:t??null,isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})})]}):r("div",{className:`flex flex-col ${A==="right"?"items-end":"items-start"}`,children:[e(h,{toggle:Q,side:"quote",asset:o,isPlacingOrder:n||I||b,hideDropdown:b}),e(w,{side:"quote",asset:o??null,otherAsset:t??null,isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})]}):r(N,{children:[e(h,{toggle:Q,side:"quote",asset:o,isPlacingOrder:n||I||b,hideDropdown:b}),e(w,{side:"quote",asset:o??null,otherAsset:t??null,isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})]}),r("div",{className:"flex items-center justify-between",children:[e("span",{className:"font-sans text-xs",style:{color:"var(--widget-muted-foreground)"},children:Ue}),We&&e("button",{type:"button",onClick:Be,disabled:n,className:"flex items-center rounded-full px-2 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 transition-colors text-(--widget-muted-foreground) hover:bg-(--widget-secondary)",children:"Clear"})]})]})})]}),e("div",{className:"flex flex-row items-center w-full overflow-hidden px-4",style:{borderTop:W?"1px solid var(--widget-border)":"none",maxHeight:W?"60px":"0px",opacity:W?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:e(ce,{})}),e("div",{className:"px-4",style:{borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)"},children:e(ue,{})}),e("div",{className:`relative ${te?"px-0":"px-4"} py-4`,children:p&&t&&o&&i&&i>0?e(me,{base:t,baseAmount:i,quote:o,quoteAmount:u??0,userAddress:p,isWrappingPair:a,isUnwrappingPair:l,isBaseGasToken:M,isQuoteGasToken:Pe,reviewActionProps:Oe,reviewState:P,setReviewState:qe,trackedOrderHash:T,setTrackedOrderHash:J,onSwapSubmitted:we,onSwapInitiated:he,onOrderSubmitted:Ie,onStaleQuoteRestart:Re,txStatus:L,startPolling:ve,trackNativeTransaction:be}):!p&&xe?e("button",{onClick:()=>Te(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:oe,children:"Connect Wallet"}):e("button",{disabled:!0,className:"w-full py-3 text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed",style:oe,children:p?"Enter Amount":"Connect Wallet"})})]})},vt=ze;export{vt as default};
2
+ "use client";import{a as ue}from"./chunk-QFN5HDLC.js";import{f as ne,h as ae,i as de,j as w,k as h,l as ce,m as pe,v as me,w as ge}from"./chunk-WHW7AQLW.js";import{a as H}from"./chunk-35ZPLEDO.js";import{a as U}from"./chunk-CVGCH27X.js";import{a as le}from"./chunk-G6OBWGMM.js";import"./chunk-OPN7WCJR.js";import{e as re}from"./chunk-HBYURJBD.js";import{b as ie,d}from"./chunk-VRUC4M2Z.js";import"./chunk-SJMURCHX.js";import{a as se}from"./chunk-46H44R7V.js";import"./chunk-73CB2I7U.js";import{useCallback as m,useEffect as Ve,useMemo as De,useRef as je,useState as fe}from"react";import{useShallow as Ge}from"zustand/react/shallow";import{Fragment as N,jsx as e,jsxs as r}from"react/jsx-runtime";var q=()=>{},ze=({onSwapSubmitted:we,onSwapInitiated:he,onBackToSwap:k,onMoreChainsClick:Ee,startPolling:ve,trackNativeTransaction:be})=>{let{web3ConnectionType:Le,hasConnectHandler:xe,lockBase:O,lockQuote:I,disableInverting:Se,swapButtonVariant:R,tokenDisplay:V,tokenBadgeOrientation:A,widgetType:Ce,assetMenuVariant:ye}=ie(),{effectiveInputTokens:ke,effectiveOutputTokens:Ae}=le(),v=ke.length===1,b=Ae.length===1,D=V==="pill"||V==="ghost",F=Ce==="compact",{baseToken:t,quoteToken:o,baseAmount:i,quoteAmount:u,isBaseGasToken:M,isQuoteGasToken:Pe,isWrappingPair:a,isUnwrappingPair:l,baseBalance:g,quoteBalance:_e,setBaseAmount:y,setQuoteAmount:c,swapTokens:j,clearForm:G}=re(),{rfqQuote:Je,status:Ke,handleInputChange:B,ensureForParams:z,stop:Xe,clear:x,refresh:E}=ne(),{address:p}=se(),{openConnectModal:Te}=ae(),{isRecipientInputOpen:W,txStatus:L,view:S,selectedChainFilterChainId:_}=d(Ge(s=>({isRecipientInputOpen:s.isRecipientInputOpen,txStatus:s.txStatus,view:s.view,selectedChainFilterChainId:s.selectedChainFilter?.chainId??null}))),[P,qe]=fe(null),[T,J]=fe(null),Ne=je(!1),n=!1,Oe=De(()=>!t||!o||typeof i!="number"||!u||!p||parseFloat(g.formatted)<i?null:{base:t,quote:o,baseAmount:i,quoteAmount:u,userAddress:p},[t,o,i,u,p,g.formatted]),Ie=m(s=>{J(s),d.getState().startTracking(s)},[]),Re=m(()=>{Ne.current=!0,E()},[E]);Ve(()=>{if(P===null&&!(!t||!o)){if(!i||i<=0){B({amount:null,inputToken:t,outputToken:o,setOutputAmount:c});return}if(a||l){c(i);return}B({amount:i,inputToken:t,outputToken:o,setOutputAmount:c})}},[P,i,t,o,a,l,B,c]);let $=m(()=>{d.getState().setView("baseSelection")},[]),Q=m(()=>{d.getState().setView("quoteSelection")},[]),Fe=m(()=>{x(),j(),y(null),c(null)},[x,j,y,c]),Me=m(async()=>{if(!g.formatted||!t||!o)return;let s=parseFloat(g.formatted);if(!s||s<=0)return;let f;if(M){let C=await de(t.chainId,p??void 0,g.raw);if(f=Math.max(0,s-C),f<=0)return}else f=s*.9999999999;a||l?(y(f),c(f),x()):(y(f),c(null),z({inputToken:t,outputToken:o,inputAmount:f.toString(),setOutputAmount:C=>c(C)}))},[g.formatted,g.raw,t,o,p,M,a,l,y,c,x,z]),Be=m(()=>{x(),G()},[x,G]),K=g.formatted?parseFloat(g.formatted):null,We=!!(i||u),X=ye==="split",Y=X&&(S==="baseSelection"||S==="baseChainSelection"),Z=X&&(S==="quoteSelection"||S==="quoteChainSelection"),ee=m(s=>{let C=d.getState().view==="baseChainSelection"?"base":"quote";d.getState().setChainFilter({chainId:s,side:C}),d.getState().pushRecentChain(s),d.getState().transitionToView(C==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),$e=m(()=>{d.getState().transitionToView("baseChainSelection","chainSelection")},[]),Qe=m(()=>{d.getState().transitionToView("quoteChainSelection","chainSelection")},[]),He=t?.price&&i?`$${(t.price*i).toFixed(2)}`:"$0.00",Ue=o?.price&&u?`$${(o.price*u).toFixed(2)}`:"$0.00",te=P==="trackingTx"&&!!T&&!!t&&!!o&&!!i&&!!u,oe={backgroundColor:R==="default"?"var(--widget-primary)":"transparent",color:R==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:R!=="default"?"1px solid var(--widget-primary)":"none",borderRadius:"var(--widget-radius)"};return r("div",{className:"flex flex-col w-full",children:[te&&T&&t&&o&&i&&u?e("div",{className:"flex-1 min-h-0 overflow-hidden",children:e(ge,{orderHash:T,base:t,quote:o,baseAmount:i,quoteAmount:u,status:L})}):r("div",{className:`grid grid-cols-[1fr_auto_1fr] items-stretch px-4 ${F?"pt-3 pb-1":"pt-4 pb-2"} gap-2`,children:[e("div",{className:`relative flex flex-col gap-1 p-3 rounded-lg overflow-hidden ${Y?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:Y?S==="baseChainSelection"?e(U,{toggle:k??q,side:"base",onChainSelect:ee}):e(H,{toggle:k??q,side:"base",otherAsset:o,onMoreChainsClick:$e,selectedChainFilter:_}):r(N,{children:[D?F?r("div",{className:`flex items-center gap-2 ${A==="right"?"flex-row-reverse":"flex-row"}`,children:[e(h,{toggle:$,side:"base",asset:t,isPlacingOrder:n||O||v,hideDropdown:v}),e("div",{className:"flex-1 min-w-0",children:e(w,{side:"base",asset:t??null,otherAsset:o??null,isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})})]}):r("div",{className:`flex flex-col ${A==="right"?"items-end":"items-start"}`,children:[e(h,{toggle:$,side:"base",asset:t,isPlacingOrder:n||O||v,hideDropdown:v}),e(w,{side:"base",asset:t??null,otherAsset:o??null,isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})]}):r(N,{children:[e(h,{toggle:$,side:"base",asset:t,isPlacingOrder:n||O||v,hideDropdown:v}),e(w,{side:"base",asset:t??null,otherAsset:o??null,isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})]}),r("div",{className:"flex items-center justify-between",children:[e("span",{className:"font-sans text-xs",style:{color:"var(--widget-muted-foreground)"},children:He}),p&&K!==null&&K>0&&e("button",{type:"button",onClick:Me,disabled:n,className:"flex items-center rounded-full px-2 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 transition-colors bg-(--widget-primary) text-(--widget-primary-foreground) hover:bg-(--widget-foreground) hover:text-(--widget-card)",children:"Max"})]})]})}),e("div",{className:"flex items-center justify-center px-1",children:Se?e("div",{className:"flex h-8 w-8 items-center justify-center opacity-20",children:e("span",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"\u2192"})}):e("button",{type:"button",onClick:Fe,"aria-label":"Swap input and output tokens",className:"flex h-8 w-8 items-center justify-center rounded-full cursor-pointer transition-colors bg-(--widget-card) text-(--widget-muted-foreground) hover:bg-(--widget-secondary) hover:text-(--widget-foreground)",style:{border:"1px solid var(--widget-border)"},children:e(pe,{className:"w-3.5 h-3.5"})})}),e("div",{className:`relative flex flex-col gap-1 p-3 rounded-lg overflow-hidden ${Z?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:Z?S==="quoteChainSelection"?e(U,{toggle:k??q,side:"quote",onChainSelect:ee}):e(H,{toggle:k??q,side:"quote",otherAsset:t,onMoreChainsClick:Qe,selectedChainFilter:_}):r(N,{children:[D?F?r("div",{className:`flex items-center gap-2 ${A==="right"?"flex-row-reverse":"flex-row"}`,children:[e(h,{toggle:Q,side:"quote",asset:o,isPlacingOrder:n||I||b,hideDropdown:b}),e("div",{className:"flex-1 min-w-0",children:e(w,{side:"quote",asset:o??null,otherAsset:t??null,isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})})]}):r("div",{className:`flex flex-col ${A==="right"?"items-end":"items-start"}`,children:[e(h,{toggle:Q,side:"quote",asset:o,isPlacingOrder:n||I||b,hideDropdown:b}),e(w,{side:"quote",asset:o??null,otherAsset:t??null,isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})]}):r(N,{children:[e(h,{toggle:Q,side:"quote",asset:o,isPlacingOrder:n||I||b,hideDropdown:b}),e(w,{side:"quote",asset:o??null,otherAsset:t??null,isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})]}),r("div",{className:"flex items-center justify-between",children:[e("span",{className:"font-sans text-xs",style:{color:"var(--widget-muted-foreground)"},children:Ue}),We&&e("button",{type:"button",onClick:Be,disabled:n,className:"flex items-center rounded-full px-2 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 transition-colors text-(--widget-muted-foreground) hover:bg-(--widget-secondary)",children:"Clear"})]})]})})]}),e("div",{className:"flex flex-row items-center w-full overflow-hidden px-4",style:{borderTop:W?"1px solid var(--widget-border)":"none",maxHeight:W?"60px":"0px",opacity:W?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:e(ce,{})}),e("div",{className:"px-4",style:{borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)"},children:e(ue,{})}),e("div",{className:`relative ${te?"px-0":"px-4"} py-4`,children:p&&t&&o&&i&&i>0?e(me,{base:t,baseAmount:i,quote:o,quoteAmount:u??0,userAddress:p,isWrappingPair:a,isUnwrappingPair:l,isBaseGasToken:M,isQuoteGasToken:Pe,reviewActionProps:Oe,reviewState:P,setReviewState:qe,trackedOrderHash:T,setTrackedOrderHash:J,onSwapSubmitted:we,onSwapInitiated:he,onOrderSubmitted:Ie,onStaleQuoteRestart:Re,txStatus:L,startPolling:ve,trackNativeTransaction:be}):!p&&xe?e("button",{onClick:()=>Te(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:oe,children:"Connect Wallet"}):e("button",{disabled:!0,className:"w-full py-3 text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed",style:oe,children:p?"Enter Amount":"Connect Wallet"})})]})},vt=ze;export{vt as default};
@@ -1,2 +1,2 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
- "use client";var _chunkRRDWIVV4cjs = require('./chunk-RRDWIVV4.cjs');var _chunkOPACGOVQcjs = require('./chunk-OPACGOVQ.cjs');var _chunkKJGKWM6Ycjs = require('./chunk-KJGKWM6Y.cjs');var _chunkOOKW3V5Mcjs = require('./chunk-OOKW3V5M.cjs');var _chunk4DL25Q57cjs = require('./chunk-4DL25Q57.cjs');require('./chunk-KH57FLST.cjs');var _chunkTN27ALOVcjs = require('./chunk-TN27ALOV.cjs');var _chunkTTVEGOCZcjs = require('./chunk-TTVEGOCZ.cjs');require('./chunk-NVCIA743.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');require('./chunk-T3I3AJXV.cjs');var _react = require('react');var _shallow = require('zustand/react/shallow');var _jsxruntime = require('react/jsx-runtime');var q=()=>{},ze=({onSwapSubmitted:we,onSwapInitiated:he,onBackToSwap:k,onMoreChainsClick:Ee,startPolling:ve,trackNativeTransaction:be})=>{let{web3ConnectionType:Le,hasConnectHandler:xe,lockBase:O,lockQuote:I,disableInverting:Se,swapButtonVariant:R,tokenDisplay:V,tokenBadgeOrientation:A,widgetType:Ce,assetMenuVariant:ye}=_chunkTTVEGOCZcjs.b.call(void 0, ),{effectiveInputTokens:ke,effectiveOutputTokens:Ae}=_chunk4DL25Q57cjs.a.call(void 0, ),v=ke.length===1,b=Ae.length===1,D=V==="pill"||V==="ghost",F=Ce==="compact",{baseToken:t,quoteToken:o,baseAmount:i,quoteAmount:u,isBaseGasToken:M,isQuoteGasToken:Pe,isWrappingPair:a,isUnwrappingPair:l,baseBalance:g,quoteBalance:_e,setBaseAmount:y,setQuoteAmount:c,swapTokens:j,clearForm:G}=_chunkTN27ALOVcjs.e.call(void 0, ),{rfqQuote:Je,status:Ke,handleInputChange:B,ensureForParams:z,stop:Xe,clear:x,refresh:E}=_chunkOPACGOVQcjs.f.call(void 0, ),{address:p}=_chunk34N36GUDcjs.a.call(void 0, ),{openConnectModal:Te}=_chunkOPACGOVQcjs.h.call(void 0, ),{isRecipientInputOpen:W,txStatus:L,view:S,selectedChainFilterChainId:_}=_chunkTTVEGOCZcjs.d.call(void 0, _shallow.useShallow.call(void 0, s=>({isRecipientInputOpen:s.isRecipientInputOpen,txStatus:s.txStatus,view:s.view,selectedChainFilterChainId:_nullishCoalesce(_optionalChain([s, 'access', _2 => _2.selectedChainFilter, 'optionalAccess', _3 => _3.chainId]), () => (null))}))),[P,qe]=_react.useState.call(void 0, null),[T,J]=_react.useState.call(void 0, null),Ne=_react.useRef.call(void 0, !1),n=!1,Oe=_react.useMemo.call(void 0, ()=>!t||!o||typeof i!="number"||!u||!p||parseFloat(g.formatted)<i?null:{base:t,quote:o,baseAmount:i,quoteAmount:u,userAddress:p},[t,o,i,u,p,g.formatted]),Ie=_react.useCallback.call(void 0, s=>{J(s),_chunkTTVEGOCZcjs.d.getState().startTracking(s)},[]),Re=_react.useCallback.call(void 0, ()=>{Ne.current=!0,E()},[E]);_react.useEffect.call(void 0, ()=>{if(P===null&&!(!t||!o)){if(!i||i<=0){B({amount:null,inputToken:t,outputToken:o,setOutputAmount:c});return}if(a||l){c(i);return}B({amount:i,inputToken:t,outputToken:o,setOutputAmount:c})}},[P,i,t,o,a,l,B,c]);let $=_react.useCallback.call(void 0, ()=>{_chunkTTVEGOCZcjs.d.getState().setView("baseSelection")},[]),Q=_react.useCallback.call(void 0, ()=>{_chunkTTVEGOCZcjs.d.getState().setView("quoteSelection")},[]),Fe=_react.useCallback.call(void 0, ()=>{x(),j(),y(null),c(null)},[x,j,y,c]),Me=_react.useCallback.call(void 0, async()=>{if(!g.formatted||!t||!o)return;let s=parseFloat(g.formatted);if(!s||s<=0)return;let f;if(M){let C=await _chunkOPACGOVQcjs.i.call(void 0, t.chainId,_nullishCoalesce(p, () => (void 0)),g.raw);if(f=Math.max(0,s-C),f<=0)return}else f=s*.9999999999;a||l?(y(f),c(f),x()):(y(f),c(null),z({inputToken:t,outputToken:o,inputAmount:f.toString(),setOutputAmount:C=>c(C)}))},[g.formatted,g.raw,t,o,p,M,a,l,y,c,x,z]),Be=_react.useCallback.call(void 0, ()=>{x(),G()},[x,G]),K=g.formatted?parseFloat(g.formatted):null,We=!!(i||u),X=ye==="split",Y=X&&(S==="baseSelection"||S==="baseChainSelection"),Z=X&&(S==="quoteSelection"||S==="quoteChainSelection"),ee=_react.useCallback.call(void 0, s=>{let C=_chunkTTVEGOCZcjs.d.getState().view==="baseChainSelection"?"base":"quote";_chunkTTVEGOCZcjs.d.getState().setChainFilter({chainId:s,side:C}),_chunkTTVEGOCZcjs.d.getState().pushRecentChain(s),_chunkTTVEGOCZcjs.d.getState().transitionToView(C==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),$e=_react.useCallback.call(void 0, ()=>{_chunkTTVEGOCZcjs.d.getState().transitionToView("baseChainSelection","chainSelection")},[]),Qe=_react.useCallback.call(void 0, ()=>{_chunkTTVEGOCZcjs.d.getState().transitionToView("quoteChainSelection","chainSelection")},[]),He=_optionalChain([t, 'optionalAccess', _4 => _4.price])&&i?`$${(t.price*i).toFixed(2)}`:"$0.00",Ue=_optionalChain([o, 'optionalAccess', _5 => _5.price])&&u?`$${(o.price*u).toFixed(2)}`:"$0.00",te=P==="trackingTx"&&!!T&&!!t&&!!o&&!!i&&!!u,oe={backgroundColor:R==="default"?"var(--widget-primary)":"transparent",color:R==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:R!=="default"?"1px solid var(--widget-primary)":"none",borderRadius:"var(--widget-radius)"};return _jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",children:[te&&T&&t&&o&&i&&u?_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-h-0 overflow-hidden",children:_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.w,{orderHash:T,base:t,quote:o,baseAmount:i,quoteAmount:u,status:L})}):_jsxruntime.jsxs.call(void 0, "div",{className:`grid grid-cols-[1fr_auto_1fr] items-stretch px-4 ${F?"pt-3 pb-1":"pt-4 pb-2"} gap-2`,children:[_jsxruntime.jsx.call(void 0, "div",{className:`relative flex flex-col gap-1 p-3 rounded-lg overflow-hidden ${Y?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:Y?S==="baseChainSelection"?_jsxruntime.jsx.call(void 0, _chunkOOKW3V5Mcjs.a,{toggle:_nullishCoalesce(k, () => (q)),side:"base",onChainSelect:ee}):_jsxruntime.jsx.call(void 0, _chunkKJGKWM6Ycjs.a,{toggle:_nullishCoalesce(k, () => (q)),side:"base",otherAsset:o,onMoreChainsClick:$e,selectedChainFilter:_}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[D?F?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${A==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.k,{toggle:$,side:"base",asset:t,isPlacingOrder:n||O||v,hideDropdown:v}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.j,{side:"base",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${A==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.k,{toggle:$,side:"base",asset:t,isPlacingOrder:n||O||v,hideDropdown:v}),_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.j,{side:"base",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.k,{toggle:$,side:"base",asset:t,isPlacingOrder:n||O||v,hideDropdown:v}),_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.j,{side:"base",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-sans text-xs",style:{color:"var(--widget-muted-foreground)"},children:He}),p&&K!==null&&K>0&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Me,disabled:n,className:"flex items-center rounded-full px-2 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 transition-colors bg-(--widget-primary) text-(--widget-primary-foreground) hover:bg-(--widget-foreground) hover:text-(--widget-card)",children:"Max"})]})]})}),_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center px-1",children:Se?_jsxruntime.jsx.call(void 0, "div",{className:"flex h-8 w-8 items-center justify-center opacity-20",children:_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"\u2192"})}):_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Fe,"aria-label":"Swap input and output tokens",className:"flex h-8 w-8 items-center justify-center rounded-full cursor-pointer transition-colors bg-(--widget-card) text-(--widget-muted-foreground) hover:bg-(--widget-secondary) hover:text-(--widget-foreground)",style:{border:"1px solid var(--widget-border)"},children:_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.m,{className:"w-3.5 h-3.5"})})}),_jsxruntime.jsx.call(void 0, "div",{className:`relative flex flex-col gap-1 p-3 rounded-lg overflow-hidden ${Z?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:Z?S==="quoteChainSelection"?_jsxruntime.jsx.call(void 0, _chunkOOKW3V5Mcjs.a,{toggle:_nullishCoalesce(k, () => (q)),side:"quote",onChainSelect:ee}):_jsxruntime.jsx.call(void 0, _chunkKJGKWM6Ycjs.a,{toggle:_nullishCoalesce(k, () => (q)),side:"quote",otherAsset:t,onMoreChainsClick:Qe,selectedChainFilter:_}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[D?F?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${A==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.k,{toggle:Q,side:"quote",asset:o,isPlacingOrder:n||I||b,hideDropdown:b}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.j,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${A==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.k,{toggle:Q,side:"quote",asset:o,isPlacingOrder:n||I||b,hideDropdown:b}),_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.j,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.k,{toggle:Q,side:"quote",asset:o,isPlacingOrder:n||I||b,hideDropdown:b}),_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.j,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-sans text-xs",style:{color:"var(--widget-muted-foreground)"},children:Ue}),We&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Be,disabled:n,className:"flex items-center rounded-full px-2 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 transition-colors text-(--widget-muted-foreground) hover:bg-(--widget-secondary)",children:"Clear"})]})]})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-row items-center w-full overflow-hidden px-4",style:{borderTop:W?"1px solid var(--widget-border)":"none",maxHeight:W?"60px":"0px",opacity:W?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.l,{})}),_jsxruntime.jsx.call(void 0, "div",{className:"px-4",style:{borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)"},children:_jsxruntime.jsx.call(void 0, _chunkRRDWIVV4cjs.a,{})}),_jsxruntime.jsx.call(void 0, "div",{className:`relative ${te?"px-0":"px-4"} py-4`,children:p&&t&&o&&i&&i>0?_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.v,{base:t,baseAmount:i,quote:o,quoteAmount:_nullishCoalesce(u, () => (0)),userAddress:p,isWrappingPair:a,isUnwrappingPair:l,isBaseGasToken:M,isQuoteGasToken:Pe,reviewActionProps:Oe,reviewState:P,setReviewState:qe,trackedOrderHash:T,setTrackedOrderHash:J,onSwapSubmitted:we,onSwapInitiated:he,onOrderSubmitted:Ie,onStaleQuoteRestart:Re,txStatus:L,startPolling:ve,trackNativeTransaction:be}):!p&&xe?_jsxruntime.jsx.call(void 0, "button",{onClick:()=>Te(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:oe,children:"Connect Wallet"}):_jsxruntime.jsx.call(void 0, "button",{disabled:!0,className:"w-full py-3 text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed",style:oe,children:p?"Enter Amount":"Connect Wallet"})})]})},vt= exports.default =ze;exports.default = vt;
2
+ "use client";var _chunkW5QRZMIRcjs = require('./chunk-W5QRZMIR.cjs');var _chunkYXIROEIPcjs = require('./chunk-YXIROEIP.cjs');var _chunk56YIUX2Ecjs = require('./chunk-56YIUX2E.cjs');var _chunkJIKZMC5Kcjs = require('./chunk-JIKZMC5K.cjs');var _chunk6LRPIPEJcjs = require('./chunk-6LRPIPEJ.cjs');require('./chunk-KH57FLST.cjs');var _chunkDKQEAQKQcjs = require('./chunk-DKQEAQKQ.cjs');var _chunkGHXNROJ6cjs = require('./chunk-GHXNROJ6.cjs');require('./chunk-NVCIA743.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');require('./chunk-T3I3AJXV.cjs');var _react = require('react');var _shallow = require('zustand/react/shallow');var _jsxruntime = require('react/jsx-runtime');var q=()=>{},ze=({onSwapSubmitted:we,onSwapInitiated:he,onBackToSwap:k,onMoreChainsClick:Ee,startPolling:ve,trackNativeTransaction:be})=>{let{web3ConnectionType:Le,hasConnectHandler:xe,lockBase:O,lockQuote:I,disableInverting:Se,swapButtonVariant:R,tokenDisplay:V,tokenBadgeOrientation:A,widgetType:Ce,assetMenuVariant:ye}=_chunkGHXNROJ6cjs.b.call(void 0, ),{effectiveInputTokens:ke,effectiveOutputTokens:Ae}=_chunk6LRPIPEJcjs.a.call(void 0, ),v=ke.length===1,b=Ae.length===1,D=V==="pill"||V==="ghost",F=Ce==="compact",{baseToken:t,quoteToken:o,baseAmount:i,quoteAmount:u,isBaseGasToken:M,isQuoteGasToken:Pe,isWrappingPair:a,isUnwrappingPair:l,baseBalance:g,quoteBalance:_e,setBaseAmount:y,setQuoteAmount:c,swapTokens:j,clearForm:G}=_chunkDKQEAQKQcjs.e.call(void 0, ),{rfqQuote:Je,status:Ke,handleInputChange:B,ensureForParams:z,stop:Xe,clear:x,refresh:E}=_chunkYXIROEIPcjs.f.call(void 0, ),{address:p}=_chunk34N36GUDcjs.a.call(void 0, ),{openConnectModal:Te}=_chunkYXIROEIPcjs.h.call(void 0, ),{isRecipientInputOpen:W,txStatus:L,view:S,selectedChainFilterChainId:_}=_chunkGHXNROJ6cjs.d.call(void 0, _shallow.useShallow.call(void 0, s=>({isRecipientInputOpen:s.isRecipientInputOpen,txStatus:s.txStatus,view:s.view,selectedChainFilterChainId:_nullishCoalesce(_optionalChain([s, 'access', _2 => _2.selectedChainFilter, 'optionalAccess', _3 => _3.chainId]), () => (null))}))),[P,qe]=_react.useState.call(void 0, null),[T,J]=_react.useState.call(void 0, null),Ne=_react.useRef.call(void 0, !1),n=!1,Oe=_react.useMemo.call(void 0, ()=>!t||!o||typeof i!="number"||!u||!p||parseFloat(g.formatted)<i?null:{base:t,quote:o,baseAmount:i,quoteAmount:u,userAddress:p},[t,o,i,u,p,g.formatted]),Ie=_react.useCallback.call(void 0, s=>{J(s),_chunkGHXNROJ6cjs.d.getState().startTracking(s)},[]),Re=_react.useCallback.call(void 0, ()=>{Ne.current=!0,E()},[E]);_react.useEffect.call(void 0, ()=>{if(P===null&&!(!t||!o)){if(!i||i<=0){B({amount:null,inputToken:t,outputToken:o,setOutputAmount:c});return}if(a||l){c(i);return}B({amount:i,inputToken:t,outputToken:o,setOutputAmount:c})}},[P,i,t,o,a,l,B,c]);let $=_react.useCallback.call(void 0, ()=>{_chunkGHXNROJ6cjs.d.getState().setView("baseSelection")},[]),Q=_react.useCallback.call(void 0, ()=>{_chunkGHXNROJ6cjs.d.getState().setView("quoteSelection")},[]),Fe=_react.useCallback.call(void 0, ()=>{x(),j(),y(null),c(null)},[x,j,y,c]),Me=_react.useCallback.call(void 0, async()=>{if(!g.formatted||!t||!o)return;let s=parseFloat(g.formatted);if(!s||s<=0)return;let f;if(M){let C=await _chunkYXIROEIPcjs.i.call(void 0, t.chainId,_nullishCoalesce(p, () => (void 0)),g.raw);if(f=Math.max(0,s-C),f<=0)return}else f=s*.9999999999;a||l?(y(f),c(f),x()):(y(f),c(null),z({inputToken:t,outputToken:o,inputAmount:f.toString(),setOutputAmount:C=>c(C)}))},[g.formatted,g.raw,t,o,p,M,a,l,y,c,x,z]),Be=_react.useCallback.call(void 0, ()=>{x(),G()},[x,G]),K=g.formatted?parseFloat(g.formatted):null,We=!!(i||u),X=ye==="split",Y=X&&(S==="baseSelection"||S==="baseChainSelection"),Z=X&&(S==="quoteSelection"||S==="quoteChainSelection"),ee=_react.useCallback.call(void 0, s=>{let C=_chunkGHXNROJ6cjs.d.getState().view==="baseChainSelection"?"base":"quote";_chunkGHXNROJ6cjs.d.getState().setChainFilter({chainId:s,side:C}),_chunkGHXNROJ6cjs.d.getState().pushRecentChain(s),_chunkGHXNROJ6cjs.d.getState().transitionToView(C==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),$e=_react.useCallback.call(void 0, ()=>{_chunkGHXNROJ6cjs.d.getState().transitionToView("baseChainSelection","chainSelection")},[]),Qe=_react.useCallback.call(void 0, ()=>{_chunkGHXNROJ6cjs.d.getState().transitionToView("quoteChainSelection","chainSelection")},[]),He=_optionalChain([t, 'optionalAccess', _4 => _4.price])&&i?`$${(t.price*i).toFixed(2)}`:"$0.00",Ue=_optionalChain([o, 'optionalAccess', _5 => _5.price])&&u?`$${(o.price*u).toFixed(2)}`:"$0.00",te=P==="trackingTx"&&!!T&&!!t&&!!o&&!!i&&!!u,oe={backgroundColor:R==="default"?"var(--widget-primary)":"transparent",color:R==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:R!=="default"?"1px solid var(--widget-primary)":"none",borderRadius:"var(--widget-radius)"};return _jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",children:[te&&T&&t&&o&&i&&u?_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-h-0 overflow-hidden",children:_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.w,{orderHash:T,base:t,quote:o,baseAmount:i,quoteAmount:u,status:L})}):_jsxruntime.jsxs.call(void 0, "div",{className:`grid grid-cols-[1fr_auto_1fr] items-stretch px-4 ${F?"pt-3 pb-1":"pt-4 pb-2"} gap-2`,children:[_jsxruntime.jsx.call(void 0, "div",{className:`relative flex flex-col gap-1 p-3 rounded-lg overflow-hidden ${Y?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:Y?S==="baseChainSelection"?_jsxruntime.jsx.call(void 0, _chunkJIKZMC5Kcjs.a,{toggle:_nullishCoalesce(k, () => (q)),side:"base",onChainSelect:ee}):_jsxruntime.jsx.call(void 0, _chunk56YIUX2Ecjs.a,{toggle:_nullishCoalesce(k, () => (q)),side:"base",otherAsset:o,onMoreChainsClick:$e,selectedChainFilter:_}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[D?F?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${A==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.k,{toggle:$,side:"base",asset:t,isPlacingOrder:n||O||v,hideDropdown:v}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.j,{side:"base",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${A==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.k,{toggle:$,side:"base",asset:t,isPlacingOrder:n||O||v,hideDropdown:v}),_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.j,{side:"base",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.k,{toggle:$,side:"base",asset:t,isPlacingOrder:n||O||v,hideDropdown:v}),_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.j,{side:"base",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-sans text-xs",style:{color:"var(--widget-muted-foreground)"},children:He}),p&&K!==null&&K>0&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Me,disabled:n,className:"flex items-center rounded-full px-2 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 transition-colors bg-(--widget-primary) text-(--widget-primary-foreground) hover:bg-(--widget-foreground) hover:text-(--widget-card)",children:"Max"})]})]})}),_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center px-1",children:Se?_jsxruntime.jsx.call(void 0, "div",{className:"flex h-8 w-8 items-center justify-center opacity-20",children:_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"\u2192"})}):_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Fe,"aria-label":"Swap input and output tokens",className:"flex h-8 w-8 items-center justify-center rounded-full cursor-pointer transition-colors bg-(--widget-card) text-(--widget-muted-foreground) hover:bg-(--widget-secondary) hover:text-(--widget-foreground)",style:{border:"1px solid var(--widget-border)"},children:_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.m,{className:"w-3.5 h-3.5"})})}),_jsxruntime.jsx.call(void 0, "div",{className:`relative flex flex-col gap-1 p-3 rounded-lg overflow-hidden ${Z?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:Z?S==="quoteChainSelection"?_jsxruntime.jsx.call(void 0, _chunkJIKZMC5Kcjs.a,{toggle:_nullishCoalesce(k, () => (q)),side:"quote",onChainSelect:ee}):_jsxruntime.jsx.call(void 0, _chunk56YIUX2Ecjs.a,{toggle:_nullishCoalesce(k, () => (q)),side:"quote",otherAsset:t,onMoreChainsClick:Qe,selectedChainFilter:_}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[D?F?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${A==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.k,{toggle:Q,side:"quote",asset:o,isPlacingOrder:n||I||b,hideDropdown:b}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.j,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${A==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.k,{toggle:Q,side:"quote",asset:o,isPlacingOrder:n||I||b,hideDropdown:b}),_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.j,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.k,{toggle:Q,side:"quote",asset:o,isPlacingOrder:n||I||b,hideDropdown:b}),_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.j,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:n,isWrappingPair:a,isUnwrappingPair:l})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-sans text-xs",style:{color:"var(--widget-muted-foreground)"},children:Ue}),We&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Be,disabled:n,className:"flex items-center rounded-full px-2 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 transition-colors text-(--widget-muted-foreground) hover:bg-(--widget-secondary)",children:"Clear"})]})]})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-row items-center w-full overflow-hidden px-4",style:{borderTop:W?"1px solid var(--widget-border)":"none",maxHeight:W?"60px":"0px",opacity:W?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.l,{})}),_jsxruntime.jsx.call(void 0, "div",{className:"px-4",style:{borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)"},children:_jsxruntime.jsx.call(void 0, _chunkW5QRZMIRcjs.a,{})}),_jsxruntime.jsx.call(void 0, "div",{className:`relative ${te?"px-0":"px-4"} py-4`,children:p&&t&&o&&i&&i>0?_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.v,{base:t,baseAmount:i,quote:o,quoteAmount:_nullishCoalesce(u, () => (0)),userAddress:p,isWrappingPair:a,isUnwrappingPair:l,isBaseGasToken:M,isQuoteGasToken:Pe,reviewActionProps:Oe,reviewState:P,setReviewState:qe,trackedOrderHash:T,setTrackedOrderHash:J,onSwapSubmitted:we,onSwapInitiated:he,onOrderSubmitted:Ie,onStaleQuoteRestart:Re,txStatus:L,startPolling:ve,trackNativeTransaction:be}):!p&&xe?_jsxruntime.jsx.call(void 0, "button",{onClick:()=>Te(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:oe,children:"Connect Wallet"}):_jsxruntime.jsx.call(void 0, "button",{disabled:!0,className:"w-full py-3 text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed",style:oe,children:p?"Enter Amount":"Connect Wallet"})})]})},vt= exports.default =ze;exports.default = vt;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use client";import{f as re,h as de,i as ue,j as b,k as S,l as pe,m as me,v as ge,w as fe}from"./chunk-62ZNAMP7.js";import{a as ve}from"./chunk-DNOZXHWQ.js";import{a as xe}from"./chunk-5ETKDN5C.js";import{a as ce}from"./chunk-BKAIYAE7.js";import"./chunk-OPN7WCJR.js";import{e as le}from"./chunk-7ZT3SGKA.js";import{b as ae,d as c}from"./chunk-GGP6UREO.js";import{O as H,W as ie}from"./chunk-SJMURCHX.js";import{a as ne}from"./chunk-46H44R7V.js";import"./chunk-73CB2I7U.js";import{useCallback as x,useEffect as we,useMemo as tt,useRef as he,useState as E}from"react";import{useShallow as st}from"zustand/react/shallow";import{Fragment as q,jsx as e,jsxs as t}from"react/jsx-runtime";var be=()=>{},ot=({onSwapSubmitted:Se,onSwapInitiated:ye,onBackToSwap:j,onMoreChainsClick:at,startPolling:Ne,trackNativeTransaction:Ce})=>{let{web3ConnectionType:it,hasConnectHandler:ke,lockBase:R,lockQuote:F,disableInverting:Ae,swapButtonVariant:I,tokenDisplay:G,tokenBadgeOrientation:A,widgetType:Te,assetMenuVariant:Pe}=ae(),{effectiveInputTokens:Oe,effectiveOutputTokens:qe}=ce(),y=Oe.length===1,N=qe.length===1,z=G==="pill"||G==="ghost",T=Te==="compact",{baseToken:d,quoteToken:u,baseAmount:i,quoteAmount:n,isBaseGasToken:M,isQuoteGasToken:Re,isWrappingPair:p,isUnwrappingPair:m,baseBalance:v,setBaseAmount:k,setQuoteAmount:g,swapTokens:L,clearForm:_}=le(),{handleInputChange:$,ensureForParams:J,clear:C,refresh:K,liquidityError:Fe,routingError:Ie}=re(),{address:f}=ne(),{openConnectModal:Me}=de(),{isRecipientInputOpen:B,txStatus:X,view:w,selectedChainFilterChainId:$e}=c(st(a=>({isRecipientInputOpen:a.isRecipientInputOpen,txStatus:a.txStatus,view:a.view,selectedChainFilterChainId:a.selectedChainFilterChainId??null}))),[P,Be]=E(null),[O,Y]=E(null),We=he(!1),r=!1,Qe=tt(()=>!d||!u||typeof i!="number"||!n||!f||parseFloat(v.formatted)<i?null:{base:d,quote:u,baseAmount:i,quoteAmount:n,userAddress:f},[d,u,i,n,f,v.formatted]),De=x(a=>{Y(a),c.getState().startTracking(a)},[]),Ue=x(()=>{We.current=!0,K()},[K]);we(()=>{if(P===null&&!(!d||!u)){if(!i||i<=0){$({amount:null,inputToken:d,outputToken:u,setOutputAmount:g});return}if(p||m){g(i);return}$({amount:i,inputToken:d,outputToken:u,setOutputAmount:g})}},[P,i,d,u,p,m,$,g]);let Z=i&&n&&parseFloat(n.toString())?parseFloat(i.toString())/parseFloat(n.toString()):0,W=x(()=>{c.getState().setView("baseSelection")},[]),Q=x(()=>{c.getState().setView("quoteSelection")},[]),Ve=x(()=>{C(),L(),k(null),g(null)},[C,L,k,g]),He=x(async()=>{if(!v.formatted||!d||!u)return;let a=parseFloat(v.formatted);if(!a||a<=0)return;let l;if(M){let h=await ue(d.chainId,f??void 0,v.raw);if(l=Math.max(0,a-h),l<=0)return}else l=a*.9999999999;p||m?(k(l),g(l),C()):(k(l),g(null),J({inputToken:d,outputToken:u,inputAmount:l.toString(),setOutputAmount:h=>g(h)}))},[v.formatted,v.raw,d,u,f,M,p,m,k,g,C,J]),Ee=x(()=>{C(),_()},[C,_]),ee=v.formatted?parseFloat(v.formatted):null,je=!!(i||n),s=d,o=u,Ge=s?.price&&i?`$${(s.price*i).toFixed(2)}`:"$0.00",ze=o?.price&&n?`$${(o.price*n).toFixed(2)}`:"$0.00",Le=!!(s&&o&&i&&n),_e=Fe||Ie,te=P==="trackingTx"&&!!O&&!!s&&!!o&&!!i&&!!n,D=Pe==="split",U=D&&(w==="baseSelection"||w==="quoteSelection"||w==="baseChainSelection"||w==="quoteChainSelection"),V=w==="baseSelection"||w==="baseChainSelection"?"base":"quote",Je=V==="base"?o:s,se=he(null),[Ke,Xe]=E(380);we(()=>{if(!D)return;let a=se.current;if(!a)return;let l=new ResizeObserver(h=>{for(let et of h)Xe(et.contentRect.height)});return l.observe(a),()=>l.disconnect()},[D]);let Ye=x(a=>{let h=c.getState().view==="baseChainSelection"?"base":"quote";c.getState().setChainFilter({chainId:a,side:h}),c.getState().pushRecentChain(a),c.getState().transitionToView(h==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),Ze=x(()=>{let a=c.getState().view;a==="baseSelection"?c.getState().transitionToView("baseChainSelection","chainSelection"):a==="quoteSelection"&&c.getState().transitionToView("quoteChainSelection","chainSelection")},[]),oe={backgroundColor:I==="default"?"var(--widget-primary)":"transparent",color:I==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:I!=="default"?"1px solid var(--widget-primary)":"none",borderRadius:"var(--widget-radius)"};return t("div",{className:"flex flex-row w-full",children:[t("div",{ref:se,className:"flex flex-col flex-1 min-w-0",style:{borderRight:"1px solid var(--widget-border)"},children:[te&&O&&s&&o&&i&&n?e("div",{className:"flex-1 min-h-0 overflow-hidden",children:e(fe,{orderHash:O,base:s,quote:o,baseAmount:i,quoteAmount:n,status:X})}):t(q,{children:[t("div",{className:`relative ${T?"px-4 pt-3 pb-1":"px-4 pt-4 pb-2"}`,style:{borderBottom:"1px solid var(--widget-border)"},children:[z?T?t("div",{className:`flex items-center gap-2 ${A==="right"?"flex-row-reverse":"flex-row"}`,children:[e(S,{toggle:W,side:"base",asset:s,isPlacingOrder:r||R||y,hideDropdown:y}),e("div",{className:"flex-1 min-w-0",children:e(b,{side:"base",asset:s??null,otherAsset:o??null,isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})})]}):t("div",{className:`flex flex-col ${A==="right"?"items-end":"items-start"}`,children:[e(S,{toggle:W,side:"base",asset:s,isPlacingOrder:r||R||y,hideDropdown:y}),e(b,{side:"base",asset:s??null,otherAsset:o??null,isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})]}):t(q,{children:[e(S,{toggle:W,side:"base",asset:s,isPlacingOrder:r||R||y,hideDropdown:y}),e(b,{side:"base",asset:s??null,otherAsset:o??null,isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})]}),t("div",{className:"mb-1 flex w-full flex-row items-center justify-between",children:[e("p",{className:"font-sans text-sm",style:{color:"var(--widget-muted-foreground)"},children:Ge}),f&&ee!==null&&ee>0&&e("button",{type:"button",onClick:He,disabled:r,className:"absolute bottom-3 right-4 flex items-center rounded-full px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 bg-(--widget-primary) text-(--widget-primary-foreground) hover:bg-(--widget-foreground) hover:text-(--widget-card) transition-colors",children:"Max"})]})]}),!Ae&&e("div",{className:"flex justify-center -my-4 relative z-10",children:e("button",{type:"button",onClick:Ve,"aria-label":"Swap input and output tokens",className:"flex h-8 w-8 items-center justify-center rounded-full cursor-pointer bg-(--widget-card) text-(--widget-muted-foreground) hover:bg-(--widget-secondary) hover:text-(--widget-foreground) transition-colors",style:{border:"1px solid var(--widget-border)"},children:e(me,{className:"w-3.5 h-3.5"})})}),t("div",{className:`relative ${T?"px-4 pt-4 pb-1":"px-4 pt-6 pb-2"}`,children:[z?T?t("div",{className:`flex items-center gap-2 ${A==="right"?"flex-row-reverse":"flex-row"}`,children:[e(S,{toggle:Q,side:"quote",asset:o,isPlacingOrder:r||F||N,hideDropdown:N}),e("div",{className:"flex-1 min-w-0",children:e(b,{side:"quote",asset:o??null,otherAsset:s??null,isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})})]}):t("div",{className:`flex flex-col ${A==="right"?"items-end":"items-start"}`,children:[e(S,{toggle:Q,side:"quote",asset:o,isPlacingOrder:r||F||N,hideDropdown:N}),e(b,{side:"quote",asset:o??null,otherAsset:s??null,isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})]}):t(q,{children:[e(S,{toggle:Q,side:"quote",asset:o,isPlacingOrder:r||F||N,hideDropdown:N}),e(b,{side:"quote",asset:o??null,otherAsset:s??null,isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})]}),t("div",{className:"flex w-full flex-row items-center justify-between",children:[e("p",{className:"font-sans text-sm",style:{color:"var(--widget-muted-foreground)"},children:ze}),je&&e("button",{type:"button",onClick:Ee,disabled:r,className:"absolute bottom-2 right-4 flex items-center rounded-full px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 text-(--widget-muted-foreground) hover:bg-(--widget-secondary) transition-colors",children:"Clear"})]})]})]}),e("div",{className:"flex flex-row items-center w-full overflow-hidden",style:{borderTop:B?"1px solid var(--widget-border)":"none",maxHeight:B?"60px":"0px",opacity:B?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:e(pe,{})}),e("div",{className:`relative ${te?"px-0":"px-4"} py-4`,children:f&&s&&o&&i&&i>0?e(ge,{base:s,baseAmount:i,quote:o,quoteAmount:n??0,userAddress:f,isWrappingPair:p,isUnwrappingPair:m,isBaseGasToken:M,isQuoteGasToken:Re,reviewActionProps:Qe,reviewState:P,setReviewState:Be,trackedOrderHash:O,setTrackedOrderHash:Y,onSwapSubmitted:Se,onSwapInitiated:ye,onOrderSubmitted:De,onStaleQuoteRestart:Ue,txStatus:X,startPolling:Ne,trackNativeTransaction:Ce}):!f&&ke?e("button",{onClick:()=>Me(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:oe,children:"Connect Wallet"}):e("button",{disabled:!0,className:"w-full py-3 text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed",style:oe,children:f?"Enter Amount":"Connect Wallet"})})]}),e("div",{className:`flex flex-col transition-all duration-300 ${U?"flex-1 min-w-0":"w-48 shrink-0"}`,style:{backgroundColor:"var(--widget-background)",...U?{height:`${Ke}px`}:{}},children:U?e("div",{className:"flex flex-col overflow-hidden p-2",style:{height:"100%"},children:w==="baseChainSelection"||w==="quoteChainSelection"?e(xe,{toggle:j??be,side:V,onChainSelect:Ye}):e(ve,{toggle:j??be,side:V,otherAsset:Je,onMoreChainsClick:Ze,selectedChainFilter:$e})}):t("div",{className:"flex flex-col gap-3 px-4 py-4",children:[e("span",{className:"text-2xs uppercase tracking-wider font-medium",style:{color:"var(--widget-muted-foreground)"},children:"Quote Details"}),Le&&s&&o?t(q,{children:[t("div",{className:"flex flex-col gap-0.5",children:[e("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Rate"}),t("div",{className:"flex items-center gap-1",children:[e(H,{asset:o,size:"3xs",noChain:!0}),t("span",{className:"font-sans text-xs uppercase",children:["1 ",o.symbol]})]}),e("div",{className:"flex items-center gap-1 pl-4",children:t("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:["= ",Z.toFixed(6)]})}),t("div",{className:"flex items-center gap-1 pl-4",children:[e(H,{asset:s,size:"3xs",noChain:!0}),e("span",{className:"font-sans text-xs uppercase",children:s.symbol})]})]}),t("div",{className:"flex flex-col gap-2",style:{borderTop:"1px solid var(--widget-border)",paddingTop:"0.5rem"},children:[t("div",{className:"flex justify-between items-center",children:[e("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"USD Value"}),t("span",{className:"font-sans text-xs",children:["$",s.price?(s.price*Z*parseFloat(n.toString())).toFixed(2):"\u2014"]})]}),t("div",{className:"flex justify-between items-center",children:[e("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Order Type"}),e("span",{className:"text-2xs font-sans",style:{color:"var(--widget-foreground)"},children:"RFQ"})]}),t("div",{className:"flex justify-between items-center",children:[e("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Fill"}),e("span",{className:"text-2xs",style:{color:"var(--widget-primary)"},children:"Exact"})]}),s.chainId!==o.chainId&&t("div",{className:"flex justify-between items-center",children:[e("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Route"}),e("span",{className:"text-2xs font-sans",children:"Cross-chain"})]})]})]}):_e?t("div",{className:"flex flex-col gap-1",children:[e(ie,{className:"h-6 w-6",style:{color:"var(--widget-destructive)"}}),e("span",{className:"text-2xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"})]}):t("div",{className:"flex flex-col gap-2 mt-2",children:[[...Array(4)].map((a,l)=>e("div",{className:"h-3 rounded animate-pulse",style:{backgroundColor:"var(--widget-muted)",width:l%2===0?"80%":"60%",opacity:.5}},l)),e("span",{className:"text-2xs mt-1",style:{color:"var(--widget-muted-foreground)",opacity:.5},children:"Enter an amount"})]})]})})]})},At=ot;export{At as default};
2
+ "use client";import{f as re,h as de,i as ue,j as b,k as S,l as pe,m as me,v as ge,w as fe}from"./chunk-WHW7AQLW.js";import{a as ve}from"./chunk-35ZPLEDO.js";import{a as xe}from"./chunk-CVGCH27X.js";import{a as ce}from"./chunk-G6OBWGMM.js";import"./chunk-OPN7WCJR.js";import{e as le}from"./chunk-HBYURJBD.js";import{b as ae,d as c}from"./chunk-VRUC4M2Z.js";import{O as H,W as ie}from"./chunk-SJMURCHX.js";import{a as ne}from"./chunk-46H44R7V.js";import"./chunk-73CB2I7U.js";import{useCallback as x,useEffect as we,useMemo as tt,useRef as he,useState as E}from"react";import{useShallow as st}from"zustand/react/shallow";import{Fragment as q,jsx as e,jsxs as t}from"react/jsx-runtime";var be=()=>{},ot=({onSwapSubmitted:Se,onSwapInitiated:ye,onBackToSwap:j,onMoreChainsClick:at,startPolling:Ne,trackNativeTransaction:Ce})=>{let{web3ConnectionType:it,hasConnectHandler:ke,lockBase:R,lockQuote:F,disableInverting:Ae,swapButtonVariant:I,tokenDisplay:G,tokenBadgeOrientation:A,widgetType:Te,assetMenuVariant:Pe}=ae(),{effectiveInputTokens:Oe,effectiveOutputTokens:qe}=ce(),y=Oe.length===1,N=qe.length===1,z=G==="pill"||G==="ghost",T=Te==="compact",{baseToken:d,quoteToken:u,baseAmount:i,quoteAmount:n,isBaseGasToken:M,isQuoteGasToken:Re,isWrappingPair:p,isUnwrappingPair:m,baseBalance:v,setBaseAmount:k,setQuoteAmount:g,swapTokens:L,clearForm:_}=le(),{handleInputChange:$,ensureForParams:J,clear:C,refresh:K,liquidityError:Fe,routingError:Ie}=re(),{address:f}=ne(),{openConnectModal:Me}=de(),{isRecipientInputOpen:B,txStatus:X,view:w,selectedChainFilterChainId:$e}=c(st(a=>({isRecipientInputOpen:a.isRecipientInputOpen,txStatus:a.txStatus,view:a.view,selectedChainFilterChainId:a.selectedChainFilterChainId??null}))),[P,Be]=E(null),[O,Y]=E(null),We=he(!1),r=!1,Qe=tt(()=>!d||!u||typeof i!="number"||!n||!f||parseFloat(v.formatted)<i?null:{base:d,quote:u,baseAmount:i,quoteAmount:n,userAddress:f},[d,u,i,n,f,v.formatted]),De=x(a=>{Y(a),c.getState().startTracking(a)},[]),Ue=x(()=>{We.current=!0,K()},[K]);we(()=>{if(P===null&&!(!d||!u)){if(!i||i<=0){$({amount:null,inputToken:d,outputToken:u,setOutputAmount:g});return}if(p||m){g(i);return}$({amount:i,inputToken:d,outputToken:u,setOutputAmount:g})}},[P,i,d,u,p,m,$,g]);let Z=i&&n&&parseFloat(n.toString())?parseFloat(i.toString())/parseFloat(n.toString()):0,W=x(()=>{c.getState().setView("baseSelection")},[]),Q=x(()=>{c.getState().setView("quoteSelection")},[]),Ve=x(()=>{C(),L(),k(null),g(null)},[C,L,k,g]),He=x(async()=>{if(!v.formatted||!d||!u)return;let a=parseFloat(v.formatted);if(!a||a<=0)return;let l;if(M){let h=await ue(d.chainId,f??void 0,v.raw);if(l=Math.max(0,a-h),l<=0)return}else l=a*.9999999999;p||m?(k(l),g(l),C()):(k(l),g(null),J({inputToken:d,outputToken:u,inputAmount:l.toString(),setOutputAmount:h=>g(h)}))},[v.formatted,v.raw,d,u,f,M,p,m,k,g,C,J]),Ee=x(()=>{C(),_()},[C,_]),ee=v.formatted?parseFloat(v.formatted):null,je=!!(i||n),s=d,o=u,Ge=s?.price&&i?`$${(s.price*i).toFixed(2)}`:"$0.00",ze=o?.price&&n?`$${(o.price*n).toFixed(2)}`:"$0.00",Le=!!(s&&o&&i&&n),_e=Fe||Ie,te=P==="trackingTx"&&!!O&&!!s&&!!o&&!!i&&!!n,D=Pe==="split",U=D&&(w==="baseSelection"||w==="quoteSelection"||w==="baseChainSelection"||w==="quoteChainSelection"),V=w==="baseSelection"||w==="baseChainSelection"?"base":"quote",Je=V==="base"?o:s,se=he(null),[Ke,Xe]=E(380);we(()=>{if(!D)return;let a=se.current;if(!a)return;let l=new ResizeObserver(h=>{for(let et of h)Xe(et.contentRect.height)});return l.observe(a),()=>l.disconnect()},[D]);let Ye=x(a=>{let h=c.getState().view==="baseChainSelection"?"base":"quote";c.getState().setChainFilter({chainId:a,side:h}),c.getState().pushRecentChain(a),c.getState().transitionToView(h==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),Ze=x(()=>{let a=c.getState().view;a==="baseSelection"?c.getState().transitionToView("baseChainSelection","chainSelection"):a==="quoteSelection"&&c.getState().transitionToView("quoteChainSelection","chainSelection")},[]),oe={backgroundColor:I==="default"?"var(--widget-primary)":"transparent",color:I==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:I!=="default"?"1px solid var(--widget-primary)":"none",borderRadius:"var(--widget-radius)"};return t("div",{className:"flex flex-row w-full",children:[t("div",{ref:se,className:"flex flex-col flex-1 min-w-0",style:{borderRight:"1px solid var(--widget-border)"},children:[te&&O&&s&&o&&i&&n?e("div",{className:"flex-1 min-h-0 overflow-hidden",children:e(fe,{orderHash:O,base:s,quote:o,baseAmount:i,quoteAmount:n,status:X})}):t(q,{children:[t("div",{className:`relative ${T?"px-4 pt-3 pb-1":"px-4 pt-4 pb-2"}`,style:{borderBottom:"1px solid var(--widget-border)"},children:[z?T?t("div",{className:`flex items-center gap-2 ${A==="right"?"flex-row-reverse":"flex-row"}`,children:[e(S,{toggle:W,side:"base",asset:s,isPlacingOrder:r||R||y,hideDropdown:y}),e("div",{className:"flex-1 min-w-0",children:e(b,{side:"base",asset:s??null,otherAsset:o??null,isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})})]}):t("div",{className:`flex flex-col ${A==="right"?"items-end":"items-start"}`,children:[e(S,{toggle:W,side:"base",asset:s,isPlacingOrder:r||R||y,hideDropdown:y}),e(b,{side:"base",asset:s??null,otherAsset:o??null,isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})]}):t(q,{children:[e(S,{toggle:W,side:"base",asset:s,isPlacingOrder:r||R||y,hideDropdown:y}),e(b,{side:"base",asset:s??null,otherAsset:o??null,isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})]}),t("div",{className:"mb-1 flex w-full flex-row items-center justify-between",children:[e("p",{className:"font-sans text-sm",style:{color:"var(--widget-muted-foreground)"},children:Ge}),f&&ee!==null&&ee>0&&e("button",{type:"button",onClick:He,disabled:r,className:"absolute bottom-3 right-4 flex items-center rounded-full px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 bg-(--widget-primary) text-(--widget-primary-foreground) hover:bg-(--widget-foreground) hover:text-(--widget-card) transition-colors",children:"Max"})]})]}),!Ae&&e("div",{className:"flex justify-center -my-4 relative z-10",children:e("button",{type:"button",onClick:Ve,"aria-label":"Swap input and output tokens",className:"flex h-8 w-8 items-center justify-center rounded-full cursor-pointer bg-(--widget-card) text-(--widget-muted-foreground) hover:bg-(--widget-secondary) hover:text-(--widget-foreground) transition-colors",style:{border:"1px solid var(--widget-border)"},children:e(me,{className:"w-3.5 h-3.5"})})}),t("div",{className:`relative ${T?"px-4 pt-4 pb-1":"px-4 pt-6 pb-2"}`,children:[z?T?t("div",{className:`flex items-center gap-2 ${A==="right"?"flex-row-reverse":"flex-row"}`,children:[e(S,{toggle:Q,side:"quote",asset:o,isPlacingOrder:r||F||N,hideDropdown:N}),e("div",{className:"flex-1 min-w-0",children:e(b,{side:"quote",asset:o??null,otherAsset:s??null,isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})})]}):t("div",{className:`flex flex-col ${A==="right"?"items-end":"items-start"}`,children:[e(S,{toggle:Q,side:"quote",asset:o,isPlacingOrder:r||F||N,hideDropdown:N}),e(b,{side:"quote",asset:o??null,otherAsset:s??null,isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})]}):t(q,{children:[e(S,{toggle:Q,side:"quote",asset:o,isPlacingOrder:r||F||N,hideDropdown:N}),e(b,{side:"quote",asset:o??null,otherAsset:s??null,isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})]}),t("div",{className:"flex w-full flex-row items-center justify-between",children:[e("p",{className:"font-sans text-sm",style:{color:"var(--widget-muted-foreground)"},children:ze}),je&&e("button",{type:"button",onClick:Ee,disabled:r,className:"absolute bottom-2 right-4 flex items-center rounded-full px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 text-(--widget-muted-foreground) hover:bg-(--widget-secondary) transition-colors",children:"Clear"})]})]})]}),e("div",{className:"flex flex-row items-center w-full overflow-hidden",style:{borderTop:B?"1px solid var(--widget-border)":"none",maxHeight:B?"60px":"0px",opacity:B?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:e(pe,{})}),e("div",{className:`relative ${te?"px-0":"px-4"} py-4`,children:f&&s&&o&&i&&i>0?e(ge,{base:s,baseAmount:i,quote:o,quoteAmount:n??0,userAddress:f,isWrappingPair:p,isUnwrappingPair:m,isBaseGasToken:M,isQuoteGasToken:Re,reviewActionProps:Qe,reviewState:P,setReviewState:Be,trackedOrderHash:O,setTrackedOrderHash:Y,onSwapSubmitted:Se,onSwapInitiated:ye,onOrderSubmitted:De,onStaleQuoteRestart:Ue,txStatus:X,startPolling:Ne,trackNativeTransaction:Ce}):!f&&ke?e("button",{onClick:()=>Me(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:oe,children:"Connect Wallet"}):e("button",{disabled:!0,className:"w-full py-3 text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed",style:oe,children:f?"Enter Amount":"Connect Wallet"})})]}),e("div",{className:`flex flex-col transition-all duration-300 ${U?"flex-1 min-w-0":"w-48 shrink-0"}`,style:{backgroundColor:"var(--widget-background)",...U?{height:`${Ke}px`}:{}},children:U?e("div",{className:"flex flex-col overflow-hidden p-2",style:{height:"100%"},children:w==="baseChainSelection"||w==="quoteChainSelection"?e(xe,{toggle:j??be,side:V,onChainSelect:Ye}):e(ve,{toggle:j??be,side:V,otherAsset:Je,onMoreChainsClick:Ze,selectedChainFilter:$e})}):t("div",{className:"flex flex-col gap-3 px-4 py-4",children:[e("span",{className:"text-2xs uppercase tracking-wider font-medium",style:{color:"var(--widget-muted-foreground)"},children:"Quote Details"}),Le&&s&&o?t(q,{children:[t("div",{className:"flex flex-col gap-0.5",children:[e("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Rate"}),t("div",{className:"flex items-center gap-1",children:[e(H,{asset:o,size:"3xs",noChain:!0}),t("span",{className:"font-sans text-xs uppercase",children:["1 ",o.symbol]})]}),e("div",{className:"flex items-center gap-1 pl-4",children:t("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:["= ",Z.toFixed(6)]})}),t("div",{className:"flex items-center gap-1 pl-4",children:[e(H,{asset:s,size:"3xs",noChain:!0}),e("span",{className:"font-sans text-xs uppercase",children:s.symbol})]})]}),t("div",{className:"flex flex-col gap-2",style:{borderTop:"1px solid var(--widget-border)",paddingTop:"0.5rem"},children:[t("div",{className:"flex justify-between items-center",children:[e("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"USD Value"}),t("span",{className:"font-sans text-xs",children:["$",s.price?(s.price*Z*parseFloat(n.toString())).toFixed(2):"\u2014"]})]}),t("div",{className:"flex justify-between items-center",children:[e("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Order Type"}),e("span",{className:"text-2xs font-sans",style:{color:"var(--widget-foreground)"},children:"RFQ"})]}),t("div",{className:"flex justify-between items-center",children:[e("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Fill"}),e("span",{className:"text-2xs",style:{color:"var(--widget-primary)"},children:"Exact"})]}),s.chainId!==o.chainId&&t("div",{className:"flex justify-between items-center",children:[e("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Route"}),e("span",{className:"text-2xs font-sans",children:"Cross-chain"})]})]})]}):_e?t("div",{className:"flex flex-col gap-1",children:[e(ie,{className:"h-6 w-6",style:{color:"var(--widget-destructive)"}}),e("span",{className:"text-2xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"})]}):t("div",{className:"flex flex-col gap-2 mt-2",children:[[...Array(4)].map((a,l)=>e("div",{className:"h-3 rounded animate-pulse",style:{backgroundColor:"var(--widget-muted)",width:l%2===0?"80%":"60%",opacity:.5}},l)),e("span",{className:"text-2xs mt-1",style:{color:"var(--widget-muted-foreground)",opacity:.5},children:"Enter an amount"})]})]})})]})},At=ot;export{At as default};
@@ -1,2 +1,2 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
- "use client";var _chunkOPACGOVQcjs = require('./chunk-OPACGOVQ.cjs');var _chunkKJGKWM6Ycjs = require('./chunk-KJGKWM6Y.cjs');var _chunkOOKW3V5Mcjs = require('./chunk-OOKW3V5M.cjs');var _chunk4DL25Q57cjs = require('./chunk-4DL25Q57.cjs');require('./chunk-KH57FLST.cjs');var _chunkTN27ALOVcjs = require('./chunk-TN27ALOV.cjs');var _chunkTTVEGOCZcjs = require('./chunk-TTVEGOCZ.cjs');var _chunkNVCIA743cjs = require('./chunk-NVCIA743.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');require('./chunk-T3I3AJXV.cjs');var _react = require('react');var _shallow = require('zustand/react/shallow');var _jsxruntime = require('react/jsx-runtime');var be=()=>{},ot=({onSwapSubmitted:Se,onSwapInitiated:ye,onBackToSwap:j,onMoreChainsClick:at,startPolling:Ne,trackNativeTransaction:Ce})=>{let{web3ConnectionType:it,hasConnectHandler:ke,lockBase:R,lockQuote:F,disableInverting:Ae,swapButtonVariant:I,tokenDisplay:G,tokenBadgeOrientation:A,widgetType:Te,assetMenuVariant:Pe}=_chunkTTVEGOCZcjs.b.call(void 0, ),{effectiveInputTokens:Oe,effectiveOutputTokens:qe}=_chunk4DL25Q57cjs.a.call(void 0, ),y=Oe.length===1,N=qe.length===1,z=G==="pill"||G==="ghost",T=Te==="compact",{baseToken:d,quoteToken:u,baseAmount:i,quoteAmount:n,isBaseGasToken:M,isQuoteGasToken:Re,isWrappingPair:p,isUnwrappingPair:m,baseBalance:v,setBaseAmount:k,setQuoteAmount:g,swapTokens:L,clearForm:_}=_chunkTN27ALOVcjs.e.call(void 0, ),{handleInputChange:$,ensureForParams:J,clear:C,refresh:K,liquidityError:Fe,routingError:Ie}=_chunkOPACGOVQcjs.f.call(void 0, ),{address:f}=_chunk34N36GUDcjs.a.call(void 0, ),{openConnectModal:Me}=_chunkOPACGOVQcjs.h.call(void 0, ),{isRecipientInputOpen:B,txStatus:X,view:w,selectedChainFilterChainId:$e}=_chunkTTVEGOCZcjs.d.call(void 0, _shallow.useShallow.call(void 0, a=>({isRecipientInputOpen:a.isRecipientInputOpen,txStatus:a.txStatus,view:a.view,selectedChainFilterChainId:_nullishCoalesce(a.selectedChainFilterChainId, () => (null))}))),[P,Be]=_react.useState.call(void 0, null),[O,Y]=_react.useState.call(void 0, null),We=_react.useRef.call(void 0, !1),r=!1,Qe=_react.useMemo.call(void 0, ()=>!d||!u||typeof i!="number"||!n||!f||parseFloat(v.formatted)<i?null:{base:d,quote:u,baseAmount:i,quoteAmount:n,userAddress:f},[d,u,i,n,f,v.formatted]),De=_react.useCallback.call(void 0, a=>{Y(a),_chunkTTVEGOCZcjs.d.getState().startTracking(a)},[]),Ue=_react.useCallback.call(void 0, ()=>{We.current=!0,K()},[K]);_react.useEffect.call(void 0, ()=>{if(P===null&&!(!d||!u)){if(!i||i<=0){$({amount:null,inputToken:d,outputToken:u,setOutputAmount:g});return}if(p||m){g(i);return}$({amount:i,inputToken:d,outputToken:u,setOutputAmount:g})}},[P,i,d,u,p,m,$,g]);let Z=i&&n&&parseFloat(n.toString())?parseFloat(i.toString())/parseFloat(n.toString()):0,W=_react.useCallback.call(void 0, ()=>{_chunkTTVEGOCZcjs.d.getState().setView("baseSelection")},[]),Q=_react.useCallback.call(void 0, ()=>{_chunkTTVEGOCZcjs.d.getState().setView("quoteSelection")},[]),Ve=_react.useCallback.call(void 0, ()=>{C(),L(),k(null),g(null)},[C,L,k,g]),He=_react.useCallback.call(void 0, async()=>{if(!v.formatted||!d||!u)return;let a=parseFloat(v.formatted);if(!a||a<=0)return;let l;if(M){let h=await _chunkOPACGOVQcjs.i.call(void 0, d.chainId,_nullishCoalesce(f, () => (void 0)),v.raw);if(l=Math.max(0,a-h),l<=0)return}else l=a*.9999999999;p||m?(k(l),g(l),C()):(k(l),g(null),J({inputToken:d,outputToken:u,inputAmount:l.toString(),setOutputAmount:h=>g(h)}))},[v.formatted,v.raw,d,u,f,M,p,m,k,g,C,J]),Ee=_react.useCallback.call(void 0, ()=>{C(),_()},[C,_]),ee=v.formatted?parseFloat(v.formatted):null,je=!!(i||n),s=d,o=u,Ge=_optionalChain([s, 'optionalAccess', _2 => _2.price])&&i?`$${(s.price*i).toFixed(2)}`:"$0.00",ze=_optionalChain([o, 'optionalAccess', _3 => _3.price])&&n?`$${(o.price*n).toFixed(2)}`:"$0.00",Le=!!(s&&o&&i&&n),_e=Fe||Ie,te=P==="trackingTx"&&!!O&&!!s&&!!o&&!!i&&!!n,D=Pe==="split",U=D&&(w==="baseSelection"||w==="quoteSelection"||w==="baseChainSelection"||w==="quoteChainSelection"),V=w==="baseSelection"||w==="baseChainSelection"?"base":"quote",Je=V==="base"?o:s,se=_react.useRef.call(void 0, null),[Ke,Xe]=_react.useState.call(void 0, 380);_react.useEffect.call(void 0, ()=>{if(!D)return;let a=se.current;if(!a)return;let l=new ResizeObserver(h=>{for(let et of h)Xe(et.contentRect.height)});return l.observe(a),()=>l.disconnect()},[D]);let Ye=_react.useCallback.call(void 0, a=>{let h=_chunkTTVEGOCZcjs.d.getState().view==="baseChainSelection"?"base":"quote";_chunkTTVEGOCZcjs.d.getState().setChainFilter({chainId:a,side:h}),_chunkTTVEGOCZcjs.d.getState().pushRecentChain(a),_chunkTTVEGOCZcjs.d.getState().transitionToView(h==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),Ze=_react.useCallback.call(void 0, ()=>{let a=_chunkTTVEGOCZcjs.d.getState().view;a==="baseSelection"?_chunkTTVEGOCZcjs.d.getState().transitionToView("baseChainSelection","chainSelection"):a==="quoteSelection"&&_chunkTTVEGOCZcjs.d.getState().transitionToView("quoteChainSelection","chainSelection")},[]),oe={backgroundColor:I==="default"?"var(--widget-primary)":"transparent",color:I==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:I!=="default"?"1px solid var(--widget-primary)":"none",borderRadius:"var(--widget-radius)"};return _jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row w-full",children:[_jsxruntime.jsxs.call(void 0, "div",{ref:se,className:"flex flex-col flex-1 min-w-0",style:{borderRight:"1px solid var(--widget-border)"},children:[te&&O&&s&&o&&i&&n?_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-h-0 overflow-hidden",children:_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.w,{orderHash:O,base:s,quote:o,baseAmount:i,quoteAmount:n,status:X})}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{className:`relative ${T?"px-4 pt-3 pb-1":"px-4 pt-4 pb-2"}`,style:{borderBottom:"1px solid var(--widget-border)"},children:[z?T?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${A==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.k,{toggle:W,side:"base",asset:s,isPlacingOrder:r||R||y,hideDropdown:y}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.j,{side:"base",asset:_nullishCoalesce(s, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${A==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.k,{toggle:W,side:"base",asset:s,isPlacingOrder:r||R||y,hideDropdown:y}),_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.j,{side:"base",asset:_nullishCoalesce(s, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.k,{toggle:W,side:"base",asset:s,isPlacingOrder:r||R||y,hideDropdown:y}),_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.j,{side:"base",asset:_nullishCoalesce(s, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"mb-1 flex w-full flex-row items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-sans text-sm",style:{color:"var(--widget-muted-foreground)"},children:Ge}),f&&ee!==null&&ee>0&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:He,disabled:r,className:"absolute bottom-3 right-4 flex items-center rounded-full px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 bg-(--widget-primary) text-(--widget-primary-foreground) hover:bg-(--widget-foreground) hover:text-(--widget-card) transition-colors",children:"Max"})]})]}),!Ae&&_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center -my-4 relative z-10",children:_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Ve,"aria-label":"Swap input and output tokens",className:"flex h-8 w-8 items-center justify-center rounded-full cursor-pointer bg-(--widget-card) text-(--widget-muted-foreground) hover:bg-(--widget-secondary) hover:text-(--widget-foreground) transition-colors",style:{border:"1px solid var(--widget-border)"},children:_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.m,{className:"w-3.5 h-3.5"})})}),_jsxruntime.jsxs.call(void 0, "div",{className:`relative ${T?"px-4 pt-4 pb-1":"px-4 pt-6 pb-2"}`,children:[z?T?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${A==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.k,{toggle:Q,side:"quote",asset:o,isPlacingOrder:r||F||N,hideDropdown:N}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.j,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(s, () => (null)),isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${A==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.k,{toggle:Q,side:"quote",asset:o,isPlacingOrder:r||F||N,hideDropdown:N}),_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.j,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(s, () => (null)),isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.k,{toggle:Q,side:"quote",asset:o,isPlacingOrder:r||F||N,hideDropdown:N}),_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.j,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(s, () => (null)),isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex w-full flex-row items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-sans text-sm",style:{color:"var(--widget-muted-foreground)"},children:ze}),je&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Ee,disabled:r,className:"absolute bottom-2 right-4 flex items-center rounded-full px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 text-(--widget-muted-foreground) hover:bg-(--widget-secondary) transition-colors",children:"Clear"})]})]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-row items-center w-full overflow-hidden",style:{borderTop:B?"1px solid var(--widget-border)":"none",maxHeight:B?"60px":"0px",opacity:B?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.l,{})}),_jsxruntime.jsx.call(void 0, "div",{className:`relative ${te?"px-0":"px-4"} py-4`,children:f&&s&&o&&i&&i>0?_jsxruntime.jsx.call(void 0, _chunkOPACGOVQcjs.v,{base:s,baseAmount:i,quote:o,quoteAmount:_nullishCoalesce(n, () => (0)),userAddress:f,isWrappingPair:p,isUnwrappingPair:m,isBaseGasToken:M,isQuoteGasToken:Re,reviewActionProps:Qe,reviewState:P,setReviewState:Be,trackedOrderHash:O,setTrackedOrderHash:Y,onSwapSubmitted:Se,onSwapInitiated:ye,onOrderSubmitted:De,onStaleQuoteRestart:Ue,txStatus:X,startPolling:Ne,trackNativeTransaction:Ce}):!f&&ke?_jsxruntime.jsx.call(void 0, "button",{onClick:()=>Me(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:oe,children:"Connect Wallet"}):_jsxruntime.jsx.call(void 0, "button",{disabled:!0,className:"w-full py-3 text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed",style:oe,children:f?"Enter Amount":"Connect Wallet"})})]}),_jsxruntime.jsx.call(void 0, "div",{className:`flex flex-col transition-all duration-300 ${U?"flex-1 min-w-0":"w-48 shrink-0"}`,style:{backgroundColor:"var(--widget-background)",...U?{height:`${Ke}px`}:{}},children:U?_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col overflow-hidden p-2",style:{height:"100%"},children:w==="baseChainSelection"||w==="quoteChainSelection"?_jsxruntime.jsx.call(void 0, _chunkOOKW3V5Mcjs.a,{toggle:_nullishCoalesce(j, () => (be)),side:V,onChainSelect:Ye}):_jsxruntime.jsx.call(void 0, _chunkKJGKWM6Ycjs.a,{toggle:_nullishCoalesce(j, () => (be)),side:V,otherAsset:Je,onMoreChainsClick:Ze,selectedChainFilter:$e})}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-3 px-4 py-4",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs uppercase tracking-wider font-medium",style:{color:"var(--widget-muted-foreground)"},children:"Quote Details"}),Le&&s&&o?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-0.5",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Rate"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.O,{asset:o,size:"3xs",noChain:!0}),_jsxruntime.jsxs.call(void 0, "span",{className:"font-sans text-xs uppercase",children:["1 ",o.symbol]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center gap-1 pl-4",children:_jsxruntime.jsxs.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:["= ",Z.toFixed(6)]})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-1 pl-4",children:[_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.O,{asset:s,size:"3xs",noChain:!0}),_jsxruntime.jsx.call(void 0, "span",{className:"font-sans text-xs uppercase",children:s.symbol})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2",style:{borderTop:"1px solid var(--widget-border)",paddingTop:"0.5rem"},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"USD Value"}),_jsxruntime.jsxs.call(void 0, "span",{className:"font-sans text-xs",children:["$",s.price?(s.price*Z*parseFloat(n.toString())).toFixed(2):"\u2014"]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Order Type"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs font-sans",style:{color:"var(--widget-foreground)"},children:"RFQ"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Fill"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-primary)"},children:"Exact"})]}),s.chainId!==o.chainId&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Route"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs font-sans",children:"Cross-chain"})]})]})]}):_e?_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.W,{className:"h-6 w-6",style:{color:"var(--widget-destructive)"}}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2 mt-2",children:[[...Array(4)].map((a,l)=>_jsxruntime.jsx.call(void 0, "div",{className:"h-3 rounded animate-pulse",style:{backgroundColor:"var(--widget-muted)",width:l%2===0?"80%":"60%",opacity:.5}},l)),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs mt-1",style:{color:"var(--widget-muted-foreground)",opacity:.5},children:"Enter an amount"})]})]})})]})},At= exports.default =ot;exports.default = At;
2
+ "use client";var _chunkYXIROEIPcjs = require('./chunk-YXIROEIP.cjs');var _chunk56YIUX2Ecjs = require('./chunk-56YIUX2E.cjs');var _chunkJIKZMC5Kcjs = require('./chunk-JIKZMC5K.cjs');var _chunk6LRPIPEJcjs = require('./chunk-6LRPIPEJ.cjs');require('./chunk-KH57FLST.cjs');var _chunkDKQEAQKQcjs = require('./chunk-DKQEAQKQ.cjs');var _chunkGHXNROJ6cjs = require('./chunk-GHXNROJ6.cjs');var _chunkNVCIA743cjs = require('./chunk-NVCIA743.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');require('./chunk-T3I3AJXV.cjs');var _react = require('react');var _shallow = require('zustand/react/shallow');var _jsxruntime = require('react/jsx-runtime');var be=()=>{},ot=({onSwapSubmitted:Se,onSwapInitiated:ye,onBackToSwap:j,onMoreChainsClick:at,startPolling:Ne,trackNativeTransaction:Ce})=>{let{web3ConnectionType:it,hasConnectHandler:ke,lockBase:R,lockQuote:F,disableInverting:Ae,swapButtonVariant:I,tokenDisplay:G,tokenBadgeOrientation:A,widgetType:Te,assetMenuVariant:Pe}=_chunkGHXNROJ6cjs.b.call(void 0, ),{effectiveInputTokens:Oe,effectiveOutputTokens:qe}=_chunk6LRPIPEJcjs.a.call(void 0, ),y=Oe.length===1,N=qe.length===1,z=G==="pill"||G==="ghost",T=Te==="compact",{baseToken:d,quoteToken:u,baseAmount:i,quoteAmount:n,isBaseGasToken:M,isQuoteGasToken:Re,isWrappingPair:p,isUnwrappingPair:m,baseBalance:v,setBaseAmount:k,setQuoteAmount:g,swapTokens:L,clearForm:_}=_chunkDKQEAQKQcjs.e.call(void 0, ),{handleInputChange:$,ensureForParams:J,clear:C,refresh:K,liquidityError:Fe,routingError:Ie}=_chunkYXIROEIPcjs.f.call(void 0, ),{address:f}=_chunk34N36GUDcjs.a.call(void 0, ),{openConnectModal:Me}=_chunkYXIROEIPcjs.h.call(void 0, ),{isRecipientInputOpen:B,txStatus:X,view:w,selectedChainFilterChainId:$e}=_chunkGHXNROJ6cjs.d.call(void 0, _shallow.useShallow.call(void 0, a=>({isRecipientInputOpen:a.isRecipientInputOpen,txStatus:a.txStatus,view:a.view,selectedChainFilterChainId:_nullishCoalesce(a.selectedChainFilterChainId, () => (null))}))),[P,Be]=_react.useState.call(void 0, null),[O,Y]=_react.useState.call(void 0, null),We=_react.useRef.call(void 0, !1),r=!1,Qe=_react.useMemo.call(void 0, ()=>!d||!u||typeof i!="number"||!n||!f||parseFloat(v.formatted)<i?null:{base:d,quote:u,baseAmount:i,quoteAmount:n,userAddress:f},[d,u,i,n,f,v.formatted]),De=_react.useCallback.call(void 0, a=>{Y(a),_chunkGHXNROJ6cjs.d.getState().startTracking(a)},[]),Ue=_react.useCallback.call(void 0, ()=>{We.current=!0,K()},[K]);_react.useEffect.call(void 0, ()=>{if(P===null&&!(!d||!u)){if(!i||i<=0){$({amount:null,inputToken:d,outputToken:u,setOutputAmount:g});return}if(p||m){g(i);return}$({amount:i,inputToken:d,outputToken:u,setOutputAmount:g})}},[P,i,d,u,p,m,$,g]);let Z=i&&n&&parseFloat(n.toString())?parseFloat(i.toString())/parseFloat(n.toString()):0,W=_react.useCallback.call(void 0, ()=>{_chunkGHXNROJ6cjs.d.getState().setView("baseSelection")},[]),Q=_react.useCallback.call(void 0, ()=>{_chunkGHXNROJ6cjs.d.getState().setView("quoteSelection")},[]),Ve=_react.useCallback.call(void 0, ()=>{C(),L(),k(null),g(null)},[C,L,k,g]),He=_react.useCallback.call(void 0, async()=>{if(!v.formatted||!d||!u)return;let a=parseFloat(v.formatted);if(!a||a<=0)return;let l;if(M){let h=await _chunkYXIROEIPcjs.i.call(void 0, d.chainId,_nullishCoalesce(f, () => (void 0)),v.raw);if(l=Math.max(0,a-h),l<=0)return}else l=a*.9999999999;p||m?(k(l),g(l),C()):(k(l),g(null),J({inputToken:d,outputToken:u,inputAmount:l.toString(),setOutputAmount:h=>g(h)}))},[v.formatted,v.raw,d,u,f,M,p,m,k,g,C,J]),Ee=_react.useCallback.call(void 0, ()=>{C(),_()},[C,_]),ee=v.formatted?parseFloat(v.formatted):null,je=!!(i||n),s=d,o=u,Ge=_optionalChain([s, 'optionalAccess', _2 => _2.price])&&i?`$${(s.price*i).toFixed(2)}`:"$0.00",ze=_optionalChain([o, 'optionalAccess', _3 => _3.price])&&n?`$${(o.price*n).toFixed(2)}`:"$0.00",Le=!!(s&&o&&i&&n),_e=Fe||Ie,te=P==="trackingTx"&&!!O&&!!s&&!!o&&!!i&&!!n,D=Pe==="split",U=D&&(w==="baseSelection"||w==="quoteSelection"||w==="baseChainSelection"||w==="quoteChainSelection"),V=w==="baseSelection"||w==="baseChainSelection"?"base":"quote",Je=V==="base"?o:s,se=_react.useRef.call(void 0, null),[Ke,Xe]=_react.useState.call(void 0, 380);_react.useEffect.call(void 0, ()=>{if(!D)return;let a=se.current;if(!a)return;let l=new ResizeObserver(h=>{for(let et of h)Xe(et.contentRect.height)});return l.observe(a),()=>l.disconnect()},[D]);let Ye=_react.useCallback.call(void 0, a=>{let h=_chunkGHXNROJ6cjs.d.getState().view==="baseChainSelection"?"base":"quote";_chunkGHXNROJ6cjs.d.getState().setChainFilter({chainId:a,side:h}),_chunkGHXNROJ6cjs.d.getState().pushRecentChain(a),_chunkGHXNROJ6cjs.d.getState().transitionToView(h==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),Ze=_react.useCallback.call(void 0, ()=>{let a=_chunkGHXNROJ6cjs.d.getState().view;a==="baseSelection"?_chunkGHXNROJ6cjs.d.getState().transitionToView("baseChainSelection","chainSelection"):a==="quoteSelection"&&_chunkGHXNROJ6cjs.d.getState().transitionToView("quoteChainSelection","chainSelection")},[]),oe={backgroundColor:I==="default"?"var(--widget-primary)":"transparent",color:I==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:I!=="default"?"1px solid var(--widget-primary)":"none",borderRadius:"var(--widget-radius)"};return _jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row w-full",children:[_jsxruntime.jsxs.call(void 0, "div",{ref:se,className:"flex flex-col flex-1 min-w-0",style:{borderRight:"1px solid var(--widget-border)"},children:[te&&O&&s&&o&&i&&n?_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-h-0 overflow-hidden",children:_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.w,{orderHash:O,base:s,quote:o,baseAmount:i,quoteAmount:n,status:X})}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{className:`relative ${T?"px-4 pt-3 pb-1":"px-4 pt-4 pb-2"}`,style:{borderBottom:"1px solid var(--widget-border)"},children:[z?T?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${A==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.k,{toggle:W,side:"base",asset:s,isPlacingOrder:r||R||y,hideDropdown:y}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.j,{side:"base",asset:_nullishCoalesce(s, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${A==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.k,{toggle:W,side:"base",asset:s,isPlacingOrder:r||R||y,hideDropdown:y}),_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.j,{side:"base",asset:_nullishCoalesce(s, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.k,{toggle:W,side:"base",asset:s,isPlacingOrder:r||R||y,hideDropdown:y}),_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.j,{side:"base",asset:_nullishCoalesce(s, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"mb-1 flex w-full flex-row items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-sans text-sm",style:{color:"var(--widget-muted-foreground)"},children:Ge}),f&&ee!==null&&ee>0&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:He,disabled:r,className:"absolute bottom-3 right-4 flex items-center rounded-full px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 bg-(--widget-primary) text-(--widget-primary-foreground) hover:bg-(--widget-foreground) hover:text-(--widget-card) transition-colors",children:"Max"})]})]}),!Ae&&_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center -my-4 relative z-10",children:_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Ve,"aria-label":"Swap input and output tokens",className:"flex h-8 w-8 items-center justify-center rounded-full cursor-pointer bg-(--widget-card) text-(--widget-muted-foreground) hover:bg-(--widget-secondary) hover:text-(--widget-foreground) transition-colors",style:{border:"1px solid var(--widget-border)"},children:_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.m,{className:"w-3.5 h-3.5"})})}),_jsxruntime.jsxs.call(void 0, "div",{className:`relative ${T?"px-4 pt-4 pb-1":"px-4 pt-6 pb-2"}`,children:[z?T?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${A==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.k,{toggle:Q,side:"quote",asset:o,isPlacingOrder:r||F||N,hideDropdown:N}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.j,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(s, () => (null)),isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${A==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.k,{toggle:Q,side:"quote",asset:o,isPlacingOrder:r||F||N,hideDropdown:N}),_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.j,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(s, () => (null)),isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.k,{toggle:Q,side:"quote",asset:o,isPlacingOrder:r||F||N,hideDropdown:N}),_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.j,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(s, () => (null)),isPlacingOrder:r,isWrappingPair:p,isUnwrappingPair:m})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex w-full flex-row items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-sans text-sm",style:{color:"var(--widget-muted-foreground)"},children:ze}),je&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Ee,disabled:r,className:"absolute bottom-2 right-4 flex items-center rounded-full px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 text-(--widget-muted-foreground) hover:bg-(--widget-secondary) transition-colors",children:"Clear"})]})]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-row items-center w-full overflow-hidden",style:{borderTop:B?"1px solid var(--widget-border)":"none",maxHeight:B?"60px":"0px",opacity:B?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.l,{})}),_jsxruntime.jsx.call(void 0, "div",{className:`relative ${te?"px-0":"px-4"} py-4`,children:f&&s&&o&&i&&i>0?_jsxruntime.jsx.call(void 0, _chunkYXIROEIPcjs.v,{base:s,baseAmount:i,quote:o,quoteAmount:_nullishCoalesce(n, () => (0)),userAddress:f,isWrappingPair:p,isUnwrappingPair:m,isBaseGasToken:M,isQuoteGasToken:Re,reviewActionProps:Qe,reviewState:P,setReviewState:Be,trackedOrderHash:O,setTrackedOrderHash:Y,onSwapSubmitted:Se,onSwapInitiated:ye,onOrderSubmitted:De,onStaleQuoteRestart:Ue,txStatus:X,startPolling:Ne,trackNativeTransaction:Ce}):!f&&ke?_jsxruntime.jsx.call(void 0, "button",{onClick:()=>Me(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:oe,children:"Connect Wallet"}):_jsxruntime.jsx.call(void 0, "button",{disabled:!0,className:"w-full py-3 text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed",style:oe,children:f?"Enter Amount":"Connect Wallet"})})]}),_jsxruntime.jsx.call(void 0, "div",{className:`flex flex-col transition-all duration-300 ${U?"flex-1 min-w-0":"w-48 shrink-0"}`,style:{backgroundColor:"var(--widget-background)",...U?{height:`${Ke}px`}:{}},children:U?_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col overflow-hidden p-2",style:{height:"100%"},children:w==="baseChainSelection"||w==="quoteChainSelection"?_jsxruntime.jsx.call(void 0, _chunkJIKZMC5Kcjs.a,{toggle:_nullishCoalesce(j, () => (be)),side:V,onChainSelect:Ye}):_jsxruntime.jsx.call(void 0, _chunk56YIUX2Ecjs.a,{toggle:_nullishCoalesce(j, () => (be)),side:V,otherAsset:Je,onMoreChainsClick:Ze,selectedChainFilter:$e})}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-3 px-4 py-4",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs uppercase tracking-wider font-medium",style:{color:"var(--widget-muted-foreground)"},children:"Quote Details"}),Le&&s&&o?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-0.5",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Rate"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.O,{asset:o,size:"3xs",noChain:!0}),_jsxruntime.jsxs.call(void 0, "span",{className:"font-sans text-xs uppercase",children:["1 ",o.symbol]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center gap-1 pl-4",children:_jsxruntime.jsxs.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:["= ",Z.toFixed(6)]})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-1 pl-4",children:[_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.O,{asset:s,size:"3xs",noChain:!0}),_jsxruntime.jsx.call(void 0, "span",{className:"font-sans text-xs uppercase",children:s.symbol})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2",style:{borderTop:"1px solid var(--widget-border)",paddingTop:"0.5rem"},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"USD Value"}),_jsxruntime.jsxs.call(void 0, "span",{className:"font-sans text-xs",children:["$",s.price?(s.price*Z*parseFloat(n.toString())).toFixed(2):"\u2014"]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Order Type"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs font-sans",style:{color:"var(--widget-foreground)"},children:"RFQ"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Fill"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-primary)"},children:"Exact"})]}),s.chainId!==o.chainId&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Route"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs font-sans",children:"Cross-chain"})]})]})]}):_e?_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.W,{className:"h-6 w-6",style:{color:"var(--widget-destructive)"}}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2 mt-2",children:[[...Array(4)].map((a,l)=>_jsxruntime.jsx.call(void 0, "div",{className:"h-3 rounded animate-pulse",style:{backgroundColor:"var(--widget-muted)",width:l%2===0?"80%":"60%",opacity:.5}},l)),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs mt-1",style:{color:"var(--widget-muted-foreground)",opacity:.5},children:"Enter an amount"})]})]})})]})},At= exports.default =ot;exports.default = At;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use client";import{a as oe}from"./chunk-OPN7WCJR.js";import{e as J}from"./chunk-7ZT3SGKA.js";import{b as B,c as q,d as F}from"./chunk-GGP6UREO.js";import{a as X}from"./chunk-LAJ3ELJV.js";import{B as j,D as G,G as H,K as O,N as U,O as V,Q as K,R as Q,c as E,f as M,i as S}from"./chunk-SJMURCHX.js";import{a as _}from"./chunk-46H44R7V.js";import{b as ae}from"./chunk-73CB2I7U.js";import{useCallback as fe,useState as pe}from"react";import{useDisconnect as ge}from"wagmi";import{useCallback as ne,useEffect as ie,useMemo as L,useRef as le}from"react";function Y(s){let{address:n,isConnected:c}=_(),{chainDataMap:y}=H(),i=q(),{getToken:W,tokenRegistry:f}=j(),{supportedInputTokens:x,supportedOutputTokens:w}=B(),a=L(()=>{if(!x.length&&!w.length)return[];let e=new Set,r=[];for(let d of[...x,...w]){let T=`${d.chainId}-${d.address.toLowerCase()}`;e.has(T)||(e.add(T),r.push(d))}return r},[x,w]),{balances:l,isLoading:k,isError:g,refetch:h}=O(n,i,{enabled:c&&s&&!!n,refetchOnWindowFocus:!1},a.length>0?a:void 0),N=L(()=>a.length?new Set(a.map(e=>`${e.chainId}-${e.address.toLowerCase()}`)):null,[a]),t=L(()=>!l||l.length===0?{}:l.filter(r=>!r.assetInfo||!r.balance||r.balance==="0"?!1:N?N.has(`${r.chainId}-${r.address.toLowerCase()}`):S(r.assetInfo)||f.length===0?!0:f.some(d=>d.address.toLowerCase()===r.address.toLowerCase()&&d.chainId===r.chainId)).reduce((r,d)=>{let T=String(d.chainId);return r[T]||(r[T]=[]),r[T].push({token:d.address,amount:d.balance,decimals:d.decimals,assetInfo:d.assetInfo}),r},{}),[l,f,N]),u=L(()=>!l||l.length===0?0:l.reduce((e,r)=>!r.assetInfo||r.decimals===void 0?e:e+parseFloat(r.balance)/10**r.decimals*(r.assetInfo.price||0),0),[l]),b=L(()=>i.length===0?{}:i.reduce((e,r)=>{let d=y[r],T=E(r);return e[r.toString()]={chainId:r,name:T?.displayName||d?.chainKey||`Chain ${r}`},e},{}),[i,y]),v=L(()=>f.map(e=>({address:e.address,chainId:e.chainId})),[f]),m=le(null);ie(()=>()=>{m.current&&clearTimeout(m.current)},[]);let I=ne(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(()=>h(),2e3)},[h]);return{address:n,isConnected:c,groupedAssets:t,totalBalance:u,balancesLoading:k,balancesError:g,chains:b,getToken:W,useTokenWithLazyLoad:G,tokenRegistry:v,refetchBalances:I}}var Z=ae(oe(),1);import{jsx as C,jsxs as $}from"react/jsx-runtime";var ee=({address:s,totalBalance:n,isLoading:c=!1})=>{let y=i=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(i);return C("div",{className:"p-2 w-full flex justify-center",children:$("div",{className:"relative w-full h-[140px] overflow-hidden",style:{borderRadius:"var(--widget-radius)",border:"1px var(--widget-border-style) var(--widget-border)"},children:[$("div",{className:"absolute inset-0 z-0",children:[C("img",{className:"w-full h-full object-cover opacity-60",src:(0,Z.makeGradient)(s),alt:"address gradient"}),C("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 via-black/40 to-transparent"})]}),$("div",{className:"relative z-10 flex h-full flex-col justify-between p-3",children:[$("div",{children:[C("p",{className:"text-2xs uppercase font-sans",style:{color:"var(--widget-muted-foreground)",opacity:.7},children:"Token Balance:"}),c?C(Q,{className:"h-8 w-28 bg-white/10 rounded mt-1"}):C("p",{className:"text-2xl font-bold mt-0.5",style:{color:"var(--widget-foreground)"},children:y(n)})]}),C("div",{className:"flex items-center",children:C(K,{text:s,type:"address",children:C("p",{className:"font-sans text-2xs",style:{color:"var(--widget-foreground)",opacity:.7},children:s})})})]})]})})};import{useCallback as P,useMemo as re,useState as ue}from"react";import{useState as de}from"react";import{jsx as R,jsxs as z}from"react/jsx-runtime";var te=({asset:s,balanceAmount:n,balanceDecimals:c,price:y,onSelect:i,getToken:W,useTokenWithLazyLoad:f})=>{let[x,w]=de(!1),a=c!==void 0?parseFloat(n)/10**c:0,k=f?.(s.chainId,s.address)?.token,g=y??null;return S(s)&&g==null&&(k?.price!=null?g=k.price:W&&(g=W(s.chainId,s.address)?.price??null)),R("div",{role:"button",tabIndex:0,className:"flex h-[52px] w-full flex-row items-center p-3 cursor-pointer transition-colors",style:{borderBottom:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:x?"var(--widget-secondary)":"transparent"},onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),onClick:()=>i?.(s),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),i?.(s))},children:z("div",{className:"flex h-full w-full flex-row items-center justify-between",children:[z("div",{className:"flex h-full flex-row items-center gap-2",children:[R(V,{asset:s,size:"sm"}),z("div",{className:"flex flex-col items-start",children:[R("p",{className:"text-sm font-medium uppercase",style:{color:"var(--widget-foreground)"},children:s.symbol}),a>0&&R("p",{className:"font-sans text-xs",style:{color:"var(--widget-muted-foreground)"},children:a.toFixed(4)})]})]}),R("p",{className:"text-sm font-medium",style:{color:"var(--widget-foreground)"},children:g!=null?`$${(g*a).toFixed(2)}`:"\u2014"})]})})};import{jsx as p,jsxs as D}from"react/jsx-runtime";var ce=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}),me=M(),se=({groupedAssets:s,chains:n,tokenRegistry:c=[],getToken:y,useTokenWithLazyLoad:i,onAssetSelect:W})=>{let[f,x]=ue(new Set),w=P(t=>n?.[t]?.name||me[t]||`Chain ${t}`,[n]),a=re(()=>{let t=new Set;for(let u of c)t.add(`${u.chainId}-${u.address.toLowerCase()}`);return t},[c]),l=P(t=>t.decimals===void 0||!t.assetInfo?.price?0:parseFloat(t.amount)/10**t.decimals*t.assetInfo.price,[]),{filteredGroupedAssets:k,chainTotals:g}=re(()=>{let t=Object.entries(s).map(([v,m])=>{let I=m.filter(e=>e.assetInfo?S(e.assetInfo)?!0:a.size>0?a.has(`${e.assetInfo.chainId}-${e.assetInfo.address?.toLowerCase()??""}`):!0:!1);return[v,I]}).filter(([,v])=>v.length>0),u={};for(let[v,m]of t)u[v]=m.reduce((I,e)=>I+l(e),0);return{filteredGroupedAssets:[...t].sort((v,m)=>(u[m[0]]??0)-(u[v[0]]??0)),chainTotals:u}},[s,a,l]),h=P(t=>{x(u=>{let b=new Set(u);return b.has(t)?b.delete(t):b.add(t),b})},[]),N=t=>ce.format(t);return k.length===0?p("div",{className:"flex items-center justify-center p-6",children:p("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"No token balances found"})}):p("div",{className:"pb-2 pt-1",children:k.map(([t,u])=>{let b=parseInt(t),v=w(b),m=g[t]||0,I=f.has(t);return D("div",{className:"mx-2 mb-2",style:{border:"1px var(--widget-border-style) var(--widget-border)",borderRadius:"var(--widget-radius)",overflow:"hidden"},children:[D("button",{type:"button",onClick:()=>h(t),className:"flex w-full flex-row items-center justify-between p-2 cursor-pointer transition-colors hover:bg-(--widget-secondary)",style:{backgroundColor:"transparent"},children:[D("div",{className:"inline-flex flex-row items-center gap-2",children:[p(U,{chain:b,size:"sm"}),p("p",{className:"text-sm font-medium capitalize",style:{color:"var(--widget-foreground)"},children:v})]}),D("div",{className:"flex items-center gap-2",children:[p("p",{className:"text-sm font-semibold",style:{color:"var(--widget-foreground)"},children:N(m)}),p("span",{className:`transition-transform duration-200 ${I?"rotate-180":""}`,style:{color:"var(--widget-muted-foreground)"},children:p("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:p("path",{d:"M2.5 4.5L6 8L9.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),p("div",{className:`overflow-hidden transition-all duration-200 ease-out ${I?"max-h-[2000px] opacity-100":"max-h-0 opacity-0"}`,children:p("div",{style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:u.map(e=>e.assetInfo?p(te,{asset:e.assetInfo,balanceAmount:e.amount,balanceDecimals:e.decimals,price:e.assetInfo?.price??null,onSelect:W,getToken:y,useTokenWithLazyLoad:i},`${e.assetInfo.chainId}-${e.token}`):null)})})]},t)})})};import{Fragment as ye,jsx as o,jsxs as A}from"react/jsx-runtime";var ve=()=>A("div",{className:"flex flex-col w-full h-full overflow-hidden",children:[o("div",{className:"p-2 w-full flex justify-center",children:o("div",{className:"relative w-full h-[140px] animate-pulse",style:{borderRadius:"var(--widget-radius)",border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:"var(--widget-secondary)"}})}),o("div",{className:"px-2 flex flex-col gap-1.5 mt-1",children:[80,60,72,55,65].map((s,n)=>A("div",{className:"flex items-center justify-between py-1.5",children:[A("div",{className:"flex items-center gap-2",children:[o("div",{className:"h-6 w-6 rounded-full animate-pulse shrink-0",style:{backgroundColor:"var(--widget-secondary)"}}),o("div",{className:"h-3.5 animate-pulse",style:{width:`${s}px`,backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}})]}),o("div",{className:"h-3.5 w-14 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}})]},n))}),o("div",{className:"mt-auto shrink-0 p-2",style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:o("div",{className:"w-full animate-pulse",style:{height:"34px",backgroundColor:"var(--widget-secondary)",opacity:.35,borderRadius:"var(--widget-radius)"}})})]}),_e=()=>{let s=F(N=>N.walletTab),[n,c]=pe(!1),{disconnect:y}=ge(),{setQuoteToken:i}=J(),W=fe(async N=>{await i(N),F.getState().setView("swap")},[i]),{address:f,groupedAssets:x,totalBalance:w,balancesLoading:a,chains:l,getToken:k,useTokenWithLazyLoad:g,tokenRegistry:h}=Y(!0);return f?a&&s==="wallet"?o(ve,{}):A("div",{className:"flex flex-col w-full h-full overflow-hidden",children:[A("div",{className:"flex-1 overflow-y-auto",style:{minHeight:0},children:[s==="wallet"&&A(ye,{children:[o(ee,{address:f,totalBalance:w,isLoading:a}),o(se,{groupedAssets:x,chains:l,tokenRegistry:h,getToken:k,useTokenWithLazyLoad:g,onAssetSelect:W})]}),s==="activity"&&o(X,{isActive:s==="activity"})]}),o("div",{className:"shrink-0 p-2",style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:o("button",{type:"button",onClick:()=>{y(),F.getState().setView("swap")},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),className:"w-full py-2 text-xs font-sans uppercase cursor-pointer transition-colors",style:{backgroundColor:n?"var(--widget-destructive)":"transparent",color:n?"var(--widget-destructive-foreground)":"var(--widget-destructive)",border:"1px var(--widget-border-style) var(--widget-destructive)",borderRadius:"var(--widget-radius)"},children:"Sign Out"})})]}):o("div",{className:"flex flex-col items-center justify-center h-full p-4",children:o("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Connect your wallet to view your portfolio"})})};export{_e as WidgetWalletPanel};
2
+ "use client";import{a as oe}from"./chunk-OPN7WCJR.js";import{e as J}from"./chunk-HBYURJBD.js";import{b as B,c as q,d as F}from"./chunk-VRUC4M2Z.js";import{a as X}from"./chunk-LAJ3ELJV.js";import{B as j,D as G,G as H,K as O,N as U,O as V,Q as K,R as Q,c as E,f as M,i as S}from"./chunk-SJMURCHX.js";import{a as _}from"./chunk-46H44R7V.js";import{b as ae}from"./chunk-73CB2I7U.js";import{useCallback as fe,useState as pe}from"react";import{useDisconnect as ge}from"wagmi";import{useCallback as ne,useEffect as ie,useMemo as L,useRef as le}from"react";function Y(s){let{address:n,isConnected:c}=_(),{chainDataMap:y}=H(),i=q(),{getToken:W,tokenRegistry:f}=j(),{supportedInputTokens:x,supportedOutputTokens:w}=B(),a=L(()=>{if(!x.length&&!w.length)return[];let e=new Set,r=[];for(let d of[...x,...w]){let T=`${d.chainId}-${d.address.toLowerCase()}`;e.has(T)||(e.add(T),r.push(d))}return r},[x,w]),{balances:l,isLoading:k,isError:g,refetch:h}=O(n,i,{enabled:c&&s&&!!n,refetchOnWindowFocus:!1},a.length>0?a:void 0),N=L(()=>a.length?new Set(a.map(e=>`${e.chainId}-${e.address.toLowerCase()}`)):null,[a]),t=L(()=>!l||l.length===0?{}:l.filter(r=>!r.assetInfo||!r.balance||r.balance==="0"?!1:N?N.has(`${r.chainId}-${r.address.toLowerCase()}`):S(r.assetInfo)||f.length===0?!0:f.some(d=>d.address.toLowerCase()===r.address.toLowerCase()&&d.chainId===r.chainId)).reduce((r,d)=>{let T=String(d.chainId);return r[T]||(r[T]=[]),r[T].push({token:d.address,amount:d.balance,decimals:d.decimals,assetInfo:d.assetInfo}),r},{}),[l,f,N]),u=L(()=>!l||l.length===0?0:l.reduce((e,r)=>!r.assetInfo||r.decimals===void 0?e:e+parseFloat(r.balance)/10**r.decimals*(r.assetInfo.price||0),0),[l]),b=L(()=>i.length===0?{}:i.reduce((e,r)=>{let d=y[r],T=E(r);return e[r.toString()]={chainId:r,name:T?.displayName||d?.chainKey||`Chain ${r}`},e},{}),[i,y]),v=L(()=>f.map(e=>({address:e.address,chainId:e.chainId})),[f]),m=le(null);ie(()=>()=>{m.current&&clearTimeout(m.current)},[]);let I=ne(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(()=>h(),2e3)},[h]);return{address:n,isConnected:c,groupedAssets:t,totalBalance:u,balancesLoading:k,balancesError:g,chains:b,getToken:W,useTokenWithLazyLoad:G,tokenRegistry:v,refetchBalances:I}}var Z=ae(oe(),1);import{jsx as C,jsxs as $}from"react/jsx-runtime";var ee=({address:s,totalBalance:n,isLoading:c=!1})=>{let y=i=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(i);return C("div",{className:"p-2 w-full flex justify-center",children:$("div",{className:"relative w-full h-[140px] overflow-hidden",style:{borderRadius:"var(--widget-radius)",border:"1px var(--widget-border-style) var(--widget-border)"},children:[$("div",{className:"absolute inset-0 z-0",children:[C("img",{className:"w-full h-full object-cover opacity-60",src:(0,Z.makeGradient)(s),alt:"address gradient"}),C("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 via-black/40 to-transparent"})]}),$("div",{className:"relative z-10 flex h-full flex-col justify-between p-3",children:[$("div",{children:[C("p",{className:"text-2xs uppercase font-sans",style:{color:"var(--widget-muted-foreground)",opacity:.7},children:"Token Balance:"}),c?C(Q,{className:"h-8 w-28 bg-white/10 rounded mt-1"}):C("p",{className:"text-2xl font-bold mt-0.5",style:{color:"var(--widget-foreground)"},children:y(n)})]}),C("div",{className:"flex items-center",children:C(K,{text:s,type:"address",children:C("p",{className:"font-sans text-2xs",style:{color:"var(--widget-foreground)",opacity:.7},children:s})})})]})]})})};import{useCallback as P,useMemo as re,useState as ue}from"react";import{useState as de}from"react";import{jsx as R,jsxs as z}from"react/jsx-runtime";var te=({asset:s,balanceAmount:n,balanceDecimals:c,price:y,onSelect:i,getToken:W,useTokenWithLazyLoad:f})=>{let[x,w]=de(!1),a=c!==void 0?parseFloat(n)/10**c:0,k=f?.(s.chainId,s.address)?.token,g=y??null;return S(s)&&g==null&&(k?.price!=null?g=k.price:W&&(g=W(s.chainId,s.address)?.price??null)),R("div",{role:"button",tabIndex:0,className:"flex h-[52px] w-full flex-row items-center p-3 cursor-pointer transition-colors",style:{borderBottom:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:x?"var(--widget-secondary)":"transparent"},onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),onClick:()=>i?.(s),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),i?.(s))},children:z("div",{className:"flex h-full w-full flex-row items-center justify-between",children:[z("div",{className:"flex h-full flex-row items-center gap-2",children:[R(V,{asset:s,size:"sm"}),z("div",{className:"flex flex-col items-start",children:[R("p",{className:"text-sm font-medium uppercase",style:{color:"var(--widget-foreground)"},children:s.symbol}),a>0&&R("p",{className:"font-sans text-xs",style:{color:"var(--widget-muted-foreground)"},children:a.toFixed(4)})]})]}),R("p",{className:"text-sm font-medium",style:{color:"var(--widget-foreground)"},children:g!=null?`$${(g*a).toFixed(2)}`:"\u2014"})]})})};import{jsx as p,jsxs as D}from"react/jsx-runtime";var ce=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}),me=M(),se=({groupedAssets:s,chains:n,tokenRegistry:c=[],getToken:y,useTokenWithLazyLoad:i,onAssetSelect:W})=>{let[f,x]=ue(new Set),w=P(t=>n?.[t]?.name||me[t]||`Chain ${t}`,[n]),a=re(()=>{let t=new Set;for(let u of c)t.add(`${u.chainId}-${u.address.toLowerCase()}`);return t},[c]),l=P(t=>t.decimals===void 0||!t.assetInfo?.price?0:parseFloat(t.amount)/10**t.decimals*t.assetInfo.price,[]),{filteredGroupedAssets:k,chainTotals:g}=re(()=>{let t=Object.entries(s).map(([v,m])=>{let I=m.filter(e=>e.assetInfo?S(e.assetInfo)?!0:a.size>0?a.has(`${e.assetInfo.chainId}-${e.assetInfo.address?.toLowerCase()??""}`):!0:!1);return[v,I]}).filter(([,v])=>v.length>0),u={};for(let[v,m]of t)u[v]=m.reduce((I,e)=>I+l(e),0);return{filteredGroupedAssets:[...t].sort((v,m)=>(u[m[0]]??0)-(u[v[0]]??0)),chainTotals:u}},[s,a,l]),h=P(t=>{x(u=>{let b=new Set(u);return b.has(t)?b.delete(t):b.add(t),b})},[]),N=t=>ce.format(t);return k.length===0?p("div",{className:"flex items-center justify-center p-6",children:p("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"No token balances found"})}):p("div",{className:"pb-2 pt-1",children:k.map(([t,u])=>{let b=parseInt(t),v=w(b),m=g[t]||0,I=f.has(t);return D("div",{className:"mx-2 mb-2",style:{border:"1px var(--widget-border-style) var(--widget-border)",borderRadius:"var(--widget-radius)",overflow:"hidden"},children:[D("button",{type:"button",onClick:()=>h(t),className:"flex w-full flex-row items-center justify-between p-2 cursor-pointer transition-colors hover:bg-(--widget-secondary)",style:{backgroundColor:"transparent"},children:[D("div",{className:"inline-flex flex-row items-center gap-2",children:[p(U,{chain:b,size:"sm"}),p("p",{className:"text-sm font-medium capitalize",style:{color:"var(--widget-foreground)"},children:v})]}),D("div",{className:"flex items-center gap-2",children:[p("p",{className:"text-sm font-semibold",style:{color:"var(--widget-foreground)"},children:N(m)}),p("span",{className:`transition-transform duration-200 ${I?"rotate-180":""}`,style:{color:"var(--widget-muted-foreground)"},children:p("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:p("path",{d:"M2.5 4.5L6 8L9.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),p("div",{className:`overflow-hidden transition-all duration-200 ease-out ${I?"max-h-[2000px] opacity-100":"max-h-0 opacity-0"}`,children:p("div",{style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:u.map(e=>e.assetInfo?p(te,{asset:e.assetInfo,balanceAmount:e.amount,balanceDecimals:e.decimals,price:e.assetInfo?.price??null,onSelect:W,getToken:y,useTokenWithLazyLoad:i},`${e.assetInfo.chainId}-${e.token}`):null)})})]},t)})})};import{Fragment as ye,jsx as o,jsxs as A}from"react/jsx-runtime";var ve=()=>A("div",{className:"flex flex-col w-full h-full overflow-hidden",children:[o("div",{className:"p-2 w-full flex justify-center",children:o("div",{className:"relative w-full h-[140px] animate-pulse",style:{borderRadius:"var(--widget-radius)",border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:"var(--widget-secondary)"}})}),o("div",{className:"px-2 flex flex-col gap-1.5 mt-1",children:[80,60,72,55,65].map((s,n)=>A("div",{className:"flex items-center justify-between py-1.5",children:[A("div",{className:"flex items-center gap-2",children:[o("div",{className:"h-6 w-6 rounded-full animate-pulse shrink-0",style:{backgroundColor:"var(--widget-secondary)"}}),o("div",{className:"h-3.5 animate-pulse",style:{width:`${s}px`,backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}})]}),o("div",{className:"h-3.5 w-14 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}})]},n))}),o("div",{className:"mt-auto shrink-0 p-2",style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:o("div",{className:"w-full animate-pulse",style:{height:"34px",backgroundColor:"var(--widget-secondary)",opacity:.35,borderRadius:"var(--widget-radius)"}})})]}),_e=()=>{let s=F(N=>N.walletTab),[n,c]=pe(!1),{disconnect:y}=ge(),{setQuoteToken:i}=J(),W=fe(async N=>{await i(N),F.getState().setView("swap")},[i]),{address:f,groupedAssets:x,totalBalance:w,balancesLoading:a,chains:l,getToken:k,useTokenWithLazyLoad:g,tokenRegistry:h}=Y(!0);return f?a&&s==="wallet"?o(ve,{}):A("div",{className:"flex flex-col w-full h-full overflow-hidden",children:[A("div",{className:"flex-1 overflow-y-auto",style:{minHeight:0},children:[s==="wallet"&&A(ye,{children:[o(ee,{address:f,totalBalance:w,isLoading:a}),o(se,{groupedAssets:x,chains:l,tokenRegistry:h,getToken:k,useTokenWithLazyLoad:g,onAssetSelect:W})]}),s==="activity"&&o(X,{isActive:s==="activity"})]}),o("div",{className:"shrink-0 p-2",style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:o("button",{type:"button",onClick:()=>{y(),F.getState().setView("swap")},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),className:"w-full py-2 text-xs font-sans uppercase cursor-pointer transition-colors",style:{backgroundColor:n?"var(--widget-destructive)":"transparent",color:n?"var(--widget-destructive-foreground)":"var(--widget-destructive)",border:"1px var(--widget-border-style) var(--widget-destructive)",borderRadius:"var(--widget-radius)"},children:"Sign Out"})})]}):o("div",{className:"flex flex-col items-center justify-center h-full p-4",children:o("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Connect your wallet to view your portfolio"})})};export{_e as WidgetWalletPanel};
@@ -1,2 +1,2 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
- "use client";var _chunkKH57FLSTcjs = require('./chunk-KH57FLST.cjs');var _chunkTN27ALOVcjs = require('./chunk-TN27ALOV.cjs');var _chunkTTVEGOCZcjs = require('./chunk-TTVEGOCZ.cjs');var _chunk7HIUB5W6cjs = require('./chunk-7HIUB5W6.cjs');var _chunkNVCIA743cjs = require('./chunk-NVCIA743.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');var _chunkT3I3AJXVcjs = require('./chunk-T3I3AJXV.cjs');var _react = require('react');var _wagmi = require('wagmi');function Y(s){let{address:n,isConnected:c}=_chunk34N36GUDcjs.a.call(void 0, ),{chainDataMap:y}=_chunkNVCIA743cjs.G.call(void 0, ),i=_chunkTTVEGOCZcjs.c.call(void 0, ),{getToken:W,tokenRegistry:f}=_chunkNVCIA743cjs.B.call(void 0, ),{supportedInputTokens:x,supportedOutputTokens:w}=_chunkTTVEGOCZcjs.b.call(void 0, ),a=_react.useMemo.call(void 0, ()=>{if(!x.length&&!w.length)return[];let e=new Set,r=[];for(let d of[...x,...w]){let T=`${d.chainId}-${d.address.toLowerCase()}`;e.has(T)||(e.add(T),r.push(d))}return r},[x,w]),{balances:l,isLoading:k,isError:g,refetch:h}=_chunkNVCIA743cjs.K.call(void 0, n,i,{enabled:c&&s&&!!n,refetchOnWindowFocus:!1},a.length>0?a:void 0),N=_react.useMemo.call(void 0, ()=>a.length?new Set(a.map(e=>`${e.chainId}-${e.address.toLowerCase()}`)):null,[a]),t=_react.useMemo.call(void 0, ()=>!l||l.length===0?{}:l.filter(r=>!r.assetInfo||!r.balance||r.balance==="0"?!1:N?N.has(`${r.chainId}-${r.address.toLowerCase()}`):_chunkNVCIA743cjs.i.call(void 0, r.assetInfo)||f.length===0?!0:f.some(d=>d.address.toLowerCase()===r.address.toLowerCase()&&d.chainId===r.chainId)).reduce((r,d)=>{let T=String(d.chainId);return r[T]||(r[T]=[]),r[T].push({token:d.address,amount:d.balance,decimals:d.decimals,assetInfo:d.assetInfo}),r},{}),[l,f,N]),u=_react.useMemo.call(void 0, ()=>!l||l.length===0?0:l.reduce((e,r)=>!r.assetInfo||r.decimals===void 0?e:e+parseFloat(r.balance)/10**r.decimals*(r.assetInfo.price||0),0),[l]),b=_react.useMemo.call(void 0, ()=>i.length===0?{}:i.reduce((e,r)=>{let d=y[r],T=_chunkNVCIA743cjs.c.call(void 0, r);return e[r.toString()]={chainId:r,name:_optionalChain([T, 'optionalAccess', _2 => _2.displayName])||_optionalChain([d, 'optionalAccess', _3 => _3.chainKey])||`Chain ${r}`},e},{}),[i,y]),v=_react.useMemo.call(void 0, ()=>f.map(e=>({address:e.address,chainId:e.chainId})),[f]),m=_react.useRef.call(void 0, null);_react.useEffect.call(void 0, ()=>()=>{m.current&&clearTimeout(m.current)},[]);let I=_react.useCallback.call(void 0, ()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(()=>h(),2e3)},[h]);return{address:n,isConnected:c,groupedAssets:t,totalBalance:u,balancesLoading:k,balancesError:g,chains:b,getToken:W,useTokenWithLazyLoad:_chunkNVCIA743cjs.D,tokenRegistry:v,refetchBalances:I}}var Z=_chunkT3I3AJXVcjs.b.call(void 0, _chunkKH57FLSTcjs.a.call(void 0, ),1);var _jsxruntime = require('react/jsx-runtime');var ee=({address:s,totalBalance:n,isLoading:c=!1})=>{let y=i=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(i);return _jsxruntime.jsx.call(void 0, "div",{className:"p-2 w-full flex justify-center",children:_jsxruntime.jsxs.call(void 0, "div",{className:"relative w-full h-[140px] overflow-hidden",style:{borderRadius:"var(--widget-radius)",border:"1px var(--widget-border-style) var(--widget-border)"},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"absolute inset-0 z-0",children:[_jsxruntime.jsx.call(void 0, "img",{className:"w-full h-full object-cover opacity-60",src:(0,Z.makeGradient)(s),alt:"address gradient"}),_jsxruntime.jsx.call(void 0, "div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 via-black/40 to-transparent"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"relative z-10 flex h-full flex-col justify-between p-3",children:[_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-2xs uppercase font-sans",style:{color:"var(--widget-muted-foreground)",opacity:.7},children:"Token Balance:"}),c?_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.R,{className:"h-8 w-28 bg-white/10 rounded mt-1"}):_jsxruntime.jsx.call(void 0, "p",{className:"text-2xl font-bold mt-0.5",style:{color:"var(--widget-foreground)"},children:y(n)})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center",children:_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.Q,{text:s,type:"address",children:_jsxruntime.jsx.call(void 0, "p",{className:"font-sans text-2xs",style:{color:"var(--widget-foreground)",opacity:.7},children:s})})})]})]})})};var te=({asset:s,balanceAmount:n,balanceDecimals:c,price:y,onSelect:i,getToken:W,useTokenWithLazyLoad:f})=>{let[x,w]=_react.useState.call(void 0, !1),a=c!==void 0?parseFloat(n)/10**c:0,k=_optionalChain([f, 'optionalCall', _4 => _4(s.chainId,s.address), 'optionalAccess', _5 => _5.token]),g=_nullishCoalesce(y, () => (null));return _chunkNVCIA743cjs.i.call(void 0, s)&&g==null&&(_optionalChain([k, 'optionalAccess', _6 => _6.price])!=null?g=k.price:W&&(g=_nullishCoalesce(_optionalChain([W, 'call', _7 => _7(s.chainId,s.address), 'optionalAccess', _8 => _8.price]), () => (null)))),_jsxruntime.jsx.call(void 0, "div",{role:"button",tabIndex:0,className:"flex h-[52px] w-full flex-row items-center p-3 cursor-pointer transition-colors",style:{borderBottom:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:x?"var(--widget-secondary)":"transparent"},onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),onClick:()=>_optionalChain([i, 'optionalCall', _9 => _9(s)]),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),_optionalChain([i, 'optionalCall', _10 => _10(s)]))},children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row items-center justify-between",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full flex-row items-center gap-2",children:[_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.O,{asset:s,size:"sm"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-medium uppercase",style:{color:"var(--widget-foreground)"},children:s.symbol}),a>0&&_jsxruntime.jsx.call(void 0, "p",{className:"font-sans text-xs",style:{color:"var(--widget-muted-foreground)"},children:a.toFixed(4)})]})]}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-medium",style:{color:"var(--widget-foreground)"},children:g!=null?`$${(g*a).toFixed(2)}`:"\u2014"})]})})};var ce=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}),me=_chunkNVCIA743cjs.f.call(void 0, ),se=({groupedAssets:s,chains:n,tokenRegistry:c=[],getToken:y,useTokenWithLazyLoad:i,onAssetSelect:W})=>{let[f,x]=_react.useState.call(void 0, new Set),w=_react.useCallback.call(void 0, t=>_optionalChain([n, 'optionalAccess', _11 => _11[t], 'optionalAccess', _12 => _12.name])||me[t]||`Chain ${t}`,[n]),a=_react.useMemo.call(void 0, ()=>{let t=new Set;for(let u of c)t.add(`${u.chainId}-${u.address.toLowerCase()}`);return t},[c]),l=_react.useCallback.call(void 0, t=>t.decimals===void 0||!_optionalChain([t, 'access', _13 => _13.assetInfo, 'optionalAccess', _14 => _14.price])?0:parseFloat(t.amount)/10**t.decimals*t.assetInfo.price,[]),{filteredGroupedAssets:k,chainTotals:g}=_react.useMemo.call(void 0, ()=>{let t=Object.entries(s).map(([v,m])=>{let I=m.filter(e=>e.assetInfo?_chunkNVCIA743cjs.i.call(void 0, e.assetInfo)?!0:a.size>0?a.has(`${e.assetInfo.chainId}-${_nullishCoalesce(_optionalChain([e, 'access', _15 => _15.assetInfo, 'access', _16 => _16.address, 'optionalAccess', _17 => _17.toLowerCase, 'call', _18 => _18()]), () => (""))}`):!0:!1);return[v,I]}).filter(([,v])=>v.length>0),u={};for(let[v,m]of t)u[v]=m.reduce((I,e)=>I+l(e),0);return{filteredGroupedAssets:[...t].sort((v,m)=>(_nullishCoalesce(u[m[0]], () => (0)))-(_nullishCoalesce(u[v[0]], () => (0)))),chainTotals:u}},[s,a,l]),h=_react.useCallback.call(void 0, t=>{x(u=>{let b=new Set(u);return b.has(t)?b.delete(t):b.add(t),b})},[]),N=t=>ce.format(t);return k.length===0?_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center p-6",children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"No token balances found"})}):_jsxruntime.jsx.call(void 0, "div",{className:"pb-2 pt-1",children:k.map(([t,u])=>{let b=parseInt(t),v=w(b),m=g[t]||0,I=f.has(t);return _jsxruntime.jsxs.call(void 0, "div",{className:"mx-2 mb-2",style:{border:"1px var(--widget-border-style) var(--widget-border)",borderRadius:"var(--widget-radius)",overflow:"hidden"},children:[_jsxruntime.jsxs.call(void 0, "button",{type:"button",onClick:()=>h(t),className:"flex w-full flex-row items-center justify-between p-2 cursor-pointer transition-colors hover:bg-(--widget-secondary)",style:{backgroundColor:"transparent"},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"inline-flex flex-row items-center gap-2",children:[_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.N,{chain:b,size:"sm"}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-medium capitalize",style:{color:"var(--widget-foreground)"},children:v})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-2",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-semibold",style:{color:"var(--widget-foreground)"},children:N(m)}),_jsxruntime.jsx.call(void 0, "span",{className:`transition-transform duration-200 ${I?"rotate-180":""}`,style:{color:"var(--widget-muted-foreground)"},children:_jsxruntime.jsx.call(void 0, "svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:_jsxruntime.jsx.call(void 0, "path",{d:"M2.5 4.5L6 8L9.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),_jsxruntime.jsx.call(void 0, "div",{className:`overflow-hidden transition-all duration-200 ease-out ${I?"max-h-[2000px] opacity-100":"max-h-0 opacity-0"}`,children:_jsxruntime.jsx.call(void 0, "div",{style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:u.map(e=>e.assetInfo?_jsxruntime.jsx.call(void 0, te,{asset:e.assetInfo,balanceAmount:e.amount,balanceDecimals:e.decimals,price:_nullishCoalesce(_optionalChain([e, 'access', _19 => _19.assetInfo, 'optionalAccess', _20 => _20.price]), () => (null)),onSelect:W,getToken:y,useTokenWithLazyLoad:i},`${e.assetInfo.chainId}-${e.token}`):null)})})]},t)})})};var ve=()=>_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full h-full overflow-hidden",children:[_jsxruntime.jsx.call(void 0, "div",{className:"p-2 w-full flex justify-center",children:_jsxruntime.jsx.call(void 0, "div",{className:"relative w-full h-[140px] animate-pulse",style:{borderRadius:"var(--widget-radius)",border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:"var(--widget-secondary)"}})}),_jsxruntime.jsx.call(void 0, "div",{className:"px-2 flex flex-col gap-1.5 mt-1",children:[80,60,72,55,65].map((s,n)=>_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between py-1.5",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-2",children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-6 w-6 rounded-full animate-pulse shrink-0",style:{backgroundColor:"var(--widget-secondary)"}}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3.5 animate-pulse",style:{width:`${s}px`,backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}})]}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3.5 w-14 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}})]},n))}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-auto shrink-0 p-2",style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:_jsxruntime.jsx.call(void 0, "div",{className:"w-full animate-pulse",style:{height:"34px",backgroundColor:"var(--widget-secondary)",opacity:.35,borderRadius:"var(--widget-radius)"}})})]}),_e= exports.WidgetWalletPanel =()=>{let s=_chunkTTVEGOCZcjs.d.call(void 0, N=>N.walletTab),[n,c]=_react.useState.call(void 0, !1),{disconnect:y}=_wagmi.useDisconnect.call(void 0, ),{setQuoteToken:i}=_chunkTN27ALOVcjs.e.call(void 0, ),W=_react.useCallback.call(void 0, async N=>{await i(N),_chunkTTVEGOCZcjs.d.getState().setView("swap")},[i]),{address:f,groupedAssets:x,totalBalance:w,balancesLoading:a,chains:l,getToken:k,useTokenWithLazyLoad:g,tokenRegistry:h}=Y(!0);return f?a&&s==="wallet"?_jsxruntime.jsx.call(void 0, ve,{}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full h-full overflow-hidden",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex-1 overflow-y-auto",style:{minHeight:0},children:[s==="wallet"&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, ee,{address:f,totalBalance:w,isLoading:a}),_jsxruntime.jsx.call(void 0, se,{groupedAssets:x,chains:l,tokenRegistry:h,getToken:k,useTokenWithLazyLoad:g,onAssetSelect:W})]}),s==="activity"&&_jsxruntime.jsx.call(void 0, _chunk7HIUB5W6cjs.a,{isActive:s==="activity"})]}),_jsxruntime.jsx.call(void 0, "div",{className:"shrink-0 p-2",style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>{y(),_chunkTTVEGOCZcjs.d.getState().setView("swap")},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),className:"w-full py-2 text-xs font-sans uppercase cursor-pointer transition-colors",style:{backgroundColor:n?"var(--widget-destructive)":"transparent",color:n?"var(--widget-destructive-foreground)":"var(--widget-destructive)",border:"1px var(--widget-border-style) var(--widget-destructive)",borderRadius:"var(--widget-radius)"},children:"Sign Out"})})]}):_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col items-center justify-center h-full p-4",children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Connect your wallet to view your portfolio"})})};exports.WidgetWalletPanel = _e;
2
+ "use client";var _chunkKH57FLSTcjs = require('./chunk-KH57FLST.cjs');var _chunkDKQEAQKQcjs = require('./chunk-DKQEAQKQ.cjs');var _chunkGHXNROJ6cjs = require('./chunk-GHXNROJ6.cjs');var _chunk7HIUB5W6cjs = require('./chunk-7HIUB5W6.cjs');var _chunkNVCIA743cjs = require('./chunk-NVCIA743.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');var _chunkT3I3AJXVcjs = require('./chunk-T3I3AJXV.cjs');var _react = require('react');var _wagmi = require('wagmi');function Y(s){let{address:n,isConnected:c}=_chunk34N36GUDcjs.a.call(void 0, ),{chainDataMap:y}=_chunkNVCIA743cjs.G.call(void 0, ),i=_chunkGHXNROJ6cjs.c.call(void 0, ),{getToken:W,tokenRegistry:f}=_chunkNVCIA743cjs.B.call(void 0, ),{supportedInputTokens:x,supportedOutputTokens:w}=_chunkGHXNROJ6cjs.b.call(void 0, ),a=_react.useMemo.call(void 0, ()=>{if(!x.length&&!w.length)return[];let e=new Set,r=[];for(let d of[...x,...w]){let T=`${d.chainId}-${d.address.toLowerCase()}`;e.has(T)||(e.add(T),r.push(d))}return r},[x,w]),{balances:l,isLoading:k,isError:g,refetch:h}=_chunkNVCIA743cjs.K.call(void 0, n,i,{enabled:c&&s&&!!n,refetchOnWindowFocus:!1},a.length>0?a:void 0),N=_react.useMemo.call(void 0, ()=>a.length?new Set(a.map(e=>`${e.chainId}-${e.address.toLowerCase()}`)):null,[a]),t=_react.useMemo.call(void 0, ()=>!l||l.length===0?{}:l.filter(r=>!r.assetInfo||!r.balance||r.balance==="0"?!1:N?N.has(`${r.chainId}-${r.address.toLowerCase()}`):_chunkNVCIA743cjs.i.call(void 0, r.assetInfo)||f.length===0?!0:f.some(d=>d.address.toLowerCase()===r.address.toLowerCase()&&d.chainId===r.chainId)).reduce((r,d)=>{let T=String(d.chainId);return r[T]||(r[T]=[]),r[T].push({token:d.address,amount:d.balance,decimals:d.decimals,assetInfo:d.assetInfo}),r},{}),[l,f,N]),u=_react.useMemo.call(void 0, ()=>!l||l.length===0?0:l.reduce((e,r)=>!r.assetInfo||r.decimals===void 0?e:e+parseFloat(r.balance)/10**r.decimals*(r.assetInfo.price||0),0),[l]),b=_react.useMemo.call(void 0, ()=>i.length===0?{}:i.reduce((e,r)=>{let d=y[r],T=_chunkNVCIA743cjs.c.call(void 0, r);return e[r.toString()]={chainId:r,name:_optionalChain([T, 'optionalAccess', _2 => _2.displayName])||_optionalChain([d, 'optionalAccess', _3 => _3.chainKey])||`Chain ${r}`},e},{}),[i,y]),v=_react.useMemo.call(void 0, ()=>f.map(e=>({address:e.address,chainId:e.chainId})),[f]),m=_react.useRef.call(void 0, null);_react.useEffect.call(void 0, ()=>()=>{m.current&&clearTimeout(m.current)},[]);let I=_react.useCallback.call(void 0, ()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(()=>h(),2e3)},[h]);return{address:n,isConnected:c,groupedAssets:t,totalBalance:u,balancesLoading:k,balancesError:g,chains:b,getToken:W,useTokenWithLazyLoad:_chunkNVCIA743cjs.D,tokenRegistry:v,refetchBalances:I}}var Z=_chunkT3I3AJXVcjs.b.call(void 0, _chunkKH57FLSTcjs.a.call(void 0, ),1);var _jsxruntime = require('react/jsx-runtime');var ee=({address:s,totalBalance:n,isLoading:c=!1})=>{let y=i=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(i);return _jsxruntime.jsx.call(void 0, "div",{className:"p-2 w-full flex justify-center",children:_jsxruntime.jsxs.call(void 0, "div",{className:"relative w-full h-[140px] overflow-hidden",style:{borderRadius:"var(--widget-radius)",border:"1px var(--widget-border-style) var(--widget-border)"},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"absolute inset-0 z-0",children:[_jsxruntime.jsx.call(void 0, "img",{className:"w-full h-full object-cover opacity-60",src:(0,Z.makeGradient)(s),alt:"address gradient"}),_jsxruntime.jsx.call(void 0, "div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 via-black/40 to-transparent"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"relative z-10 flex h-full flex-col justify-between p-3",children:[_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-2xs uppercase font-sans",style:{color:"var(--widget-muted-foreground)",opacity:.7},children:"Token Balance:"}),c?_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.R,{className:"h-8 w-28 bg-white/10 rounded mt-1"}):_jsxruntime.jsx.call(void 0, "p",{className:"text-2xl font-bold mt-0.5",style:{color:"var(--widget-foreground)"},children:y(n)})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center",children:_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.Q,{text:s,type:"address",children:_jsxruntime.jsx.call(void 0, "p",{className:"font-sans text-2xs",style:{color:"var(--widget-foreground)",opacity:.7},children:s})})})]})]})})};var te=({asset:s,balanceAmount:n,balanceDecimals:c,price:y,onSelect:i,getToken:W,useTokenWithLazyLoad:f})=>{let[x,w]=_react.useState.call(void 0, !1),a=c!==void 0?parseFloat(n)/10**c:0,k=_optionalChain([f, 'optionalCall', _4 => _4(s.chainId,s.address), 'optionalAccess', _5 => _5.token]),g=_nullishCoalesce(y, () => (null));return _chunkNVCIA743cjs.i.call(void 0, s)&&g==null&&(_optionalChain([k, 'optionalAccess', _6 => _6.price])!=null?g=k.price:W&&(g=_nullishCoalesce(_optionalChain([W, 'call', _7 => _7(s.chainId,s.address), 'optionalAccess', _8 => _8.price]), () => (null)))),_jsxruntime.jsx.call(void 0, "div",{role:"button",tabIndex:0,className:"flex h-[52px] w-full flex-row items-center p-3 cursor-pointer transition-colors",style:{borderBottom:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:x?"var(--widget-secondary)":"transparent"},onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),onClick:()=>_optionalChain([i, 'optionalCall', _9 => _9(s)]),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),_optionalChain([i, 'optionalCall', _10 => _10(s)]))},children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row items-center justify-between",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full flex-row items-center gap-2",children:[_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.O,{asset:s,size:"sm"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-medium uppercase",style:{color:"var(--widget-foreground)"},children:s.symbol}),a>0&&_jsxruntime.jsx.call(void 0, "p",{className:"font-sans text-xs",style:{color:"var(--widget-muted-foreground)"},children:a.toFixed(4)})]})]}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-medium",style:{color:"var(--widget-foreground)"},children:g!=null?`$${(g*a).toFixed(2)}`:"\u2014"})]})})};var ce=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}),me=_chunkNVCIA743cjs.f.call(void 0, ),se=({groupedAssets:s,chains:n,tokenRegistry:c=[],getToken:y,useTokenWithLazyLoad:i,onAssetSelect:W})=>{let[f,x]=_react.useState.call(void 0, new Set),w=_react.useCallback.call(void 0, t=>_optionalChain([n, 'optionalAccess', _11 => _11[t], 'optionalAccess', _12 => _12.name])||me[t]||`Chain ${t}`,[n]),a=_react.useMemo.call(void 0, ()=>{let t=new Set;for(let u of c)t.add(`${u.chainId}-${u.address.toLowerCase()}`);return t},[c]),l=_react.useCallback.call(void 0, t=>t.decimals===void 0||!_optionalChain([t, 'access', _13 => _13.assetInfo, 'optionalAccess', _14 => _14.price])?0:parseFloat(t.amount)/10**t.decimals*t.assetInfo.price,[]),{filteredGroupedAssets:k,chainTotals:g}=_react.useMemo.call(void 0, ()=>{let t=Object.entries(s).map(([v,m])=>{let I=m.filter(e=>e.assetInfo?_chunkNVCIA743cjs.i.call(void 0, e.assetInfo)?!0:a.size>0?a.has(`${e.assetInfo.chainId}-${_nullishCoalesce(_optionalChain([e, 'access', _15 => _15.assetInfo, 'access', _16 => _16.address, 'optionalAccess', _17 => _17.toLowerCase, 'call', _18 => _18()]), () => (""))}`):!0:!1);return[v,I]}).filter(([,v])=>v.length>0),u={};for(let[v,m]of t)u[v]=m.reduce((I,e)=>I+l(e),0);return{filteredGroupedAssets:[...t].sort((v,m)=>(_nullishCoalesce(u[m[0]], () => (0)))-(_nullishCoalesce(u[v[0]], () => (0)))),chainTotals:u}},[s,a,l]),h=_react.useCallback.call(void 0, t=>{x(u=>{let b=new Set(u);return b.has(t)?b.delete(t):b.add(t),b})},[]),N=t=>ce.format(t);return k.length===0?_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center p-6",children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"No token balances found"})}):_jsxruntime.jsx.call(void 0, "div",{className:"pb-2 pt-1",children:k.map(([t,u])=>{let b=parseInt(t),v=w(b),m=g[t]||0,I=f.has(t);return _jsxruntime.jsxs.call(void 0, "div",{className:"mx-2 mb-2",style:{border:"1px var(--widget-border-style) var(--widget-border)",borderRadius:"var(--widget-radius)",overflow:"hidden"},children:[_jsxruntime.jsxs.call(void 0, "button",{type:"button",onClick:()=>h(t),className:"flex w-full flex-row items-center justify-between p-2 cursor-pointer transition-colors hover:bg-(--widget-secondary)",style:{backgroundColor:"transparent"},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"inline-flex flex-row items-center gap-2",children:[_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.N,{chain:b,size:"sm"}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-medium capitalize",style:{color:"var(--widget-foreground)"},children:v})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-2",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-semibold",style:{color:"var(--widget-foreground)"},children:N(m)}),_jsxruntime.jsx.call(void 0, "span",{className:`transition-transform duration-200 ${I?"rotate-180":""}`,style:{color:"var(--widget-muted-foreground)"},children:_jsxruntime.jsx.call(void 0, "svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:_jsxruntime.jsx.call(void 0, "path",{d:"M2.5 4.5L6 8L9.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),_jsxruntime.jsx.call(void 0, "div",{className:`overflow-hidden transition-all duration-200 ease-out ${I?"max-h-[2000px] opacity-100":"max-h-0 opacity-0"}`,children:_jsxruntime.jsx.call(void 0, "div",{style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:u.map(e=>e.assetInfo?_jsxruntime.jsx.call(void 0, te,{asset:e.assetInfo,balanceAmount:e.amount,balanceDecimals:e.decimals,price:_nullishCoalesce(_optionalChain([e, 'access', _19 => _19.assetInfo, 'optionalAccess', _20 => _20.price]), () => (null)),onSelect:W,getToken:y,useTokenWithLazyLoad:i},`${e.assetInfo.chainId}-${e.token}`):null)})})]},t)})})};var ve=()=>_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full h-full overflow-hidden",children:[_jsxruntime.jsx.call(void 0, "div",{className:"p-2 w-full flex justify-center",children:_jsxruntime.jsx.call(void 0, "div",{className:"relative w-full h-[140px] animate-pulse",style:{borderRadius:"var(--widget-radius)",border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:"var(--widget-secondary)"}})}),_jsxruntime.jsx.call(void 0, "div",{className:"px-2 flex flex-col gap-1.5 mt-1",children:[80,60,72,55,65].map((s,n)=>_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between py-1.5",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-2",children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-6 w-6 rounded-full animate-pulse shrink-0",style:{backgroundColor:"var(--widget-secondary)"}}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3.5 animate-pulse",style:{width:`${s}px`,backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}})]}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3.5 w-14 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}})]},n))}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-auto shrink-0 p-2",style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:_jsxruntime.jsx.call(void 0, "div",{className:"w-full animate-pulse",style:{height:"34px",backgroundColor:"var(--widget-secondary)",opacity:.35,borderRadius:"var(--widget-radius)"}})})]}),_e= exports.WidgetWalletPanel =()=>{let s=_chunkGHXNROJ6cjs.d.call(void 0, N=>N.walletTab),[n,c]=_react.useState.call(void 0, !1),{disconnect:y}=_wagmi.useDisconnect.call(void 0, ),{setQuoteToken:i}=_chunkDKQEAQKQcjs.e.call(void 0, ),W=_react.useCallback.call(void 0, async N=>{await i(N),_chunkGHXNROJ6cjs.d.getState().setView("swap")},[i]),{address:f,groupedAssets:x,totalBalance:w,balancesLoading:a,chains:l,getToken:k,useTokenWithLazyLoad:g,tokenRegistry:h}=Y(!0);return f?a&&s==="wallet"?_jsxruntime.jsx.call(void 0, ve,{}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full h-full overflow-hidden",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex-1 overflow-y-auto",style:{minHeight:0},children:[s==="wallet"&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, ee,{address:f,totalBalance:w,isLoading:a}),_jsxruntime.jsx.call(void 0, se,{groupedAssets:x,chains:l,tokenRegistry:h,getToken:k,useTokenWithLazyLoad:g,onAssetSelect:W})]}),s==="activity"&&_jsxruntime.jsx.call(void 0, _chunk7HIUB5W6cjs.a,{isActive:s==="activity"})]}),_jsxruntime.jsx.call(void 0, "div",{className:"shrink-0 p-2",style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>{y(),_chunkGHXNROJ6cjs.d.getState().setView("swap")},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),className:"w-full py-2 text-xs font-sans uppercase cursor-pointer transition-colors",style:{backgroundColor:n?"var(--widget-destructive)":"transparent",color:n?"var(--widget-destructive-foreground)":"var(--widget-destructive)",border:"1px var(--widget-border-style) var(--widget-destructive)",borderRadius:"var(--widget-radius)"},children:"Sign Out"})})]}):_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col items-center justify-center h-full p-4",children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Connect your wallet to view your portfolio"})})};exports.WidgetWalletPanel = _e;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{a as ge}from"./chunk-BKAIYAE7.js";import{e as he}from"./chunk-7ZT3SGKA.js";import{b as ne,c as pe,d as b}from"./chunk-GGP6UREO.js";import{B as de,C as le,D as ce,K as ue,N as fe,O as D,e as oe,i as R,u as $,v as re,x as ie}from"./chunk-SJMURCHX.js";import{a as me}from"./chunk-46H44R7V.js";import F,{useCallback as we,useEffect as De,useMemo as A}from"react";import{useShallow as ze}from"zustand/react/shallow";import Re from"react";import{jsx as T,jsxs as z}from"react/jsx-runtime";var Q=Re.memo(({asset:i,otherAsset:d,handleFormSelection:f,getToken:Y})=>{let{token:v}=ce(i.chainId,i.address),L=Y(i.chainId,i.address),o=v||L||i.assetInfo;if(!o)return null;let h=o.price!=null&&i.decimals!==void 0?$(o,i.balance,i.decimals):null;return z("button",{type:"button",className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>f(o,d),children:[z("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[T(D,{asset:o,size:"sm",className:"flex-shrink-0"}),z("div",{className:"flex flex-col items-start min-w-0 flex-1",children:[T("span",{className:"text-sm font-thin",style:{color:"var(--widget-secondary-foreground)"},children:o.symbol.length>20?`${o.symbol.substring(0,20)}...`:o.symbol}),T("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:o.name.length>20?`${o.name.substring(0,20)}...`:o.name})]})]}),z("div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[T("span",{className:"text-xs font-sans",style:{color:"var(--widget-muted-foreground)"},children:"Balance:"}),T("span",{className:"text-xs font-sans",style:{color:"var(--widget-foreground)",opacity:.5},children:h!=null?`$${h.toFixed(2)}`:"\u2014"})]})]},`${o.chainId}-${o.address}`)},(i,d)=>i.asset.address===d.asset.address&&i.asset.chainId===d.asset.chainId&&i.asset.balance===d.asset.balance&&i.asset.assetInfo?.price===d.asset.assetInfo?.price&&i.otherAsset.address===d.otherAsset.address);Q.displayName="AssetSelectionBalanceItem";import{jsx as a,jsxs as c}from"react/jsx-runtime";var Fe=({toggle:i,side:d,otherAsset:f,containerHeight:Y,onChainHover:v,onMoreChainsClick:L,selectedChainFilter:o})=>{let{address:H}=me(),{assetSelectionSearch:h,assetSelectionChain:m,assetSelectionCategory:U,recentChainIds:_}=b(ze(e=>({assetSelectionSearch:e.assetSelectionSearch,assetSelectionChain:e.assetSelectionChain,assetSelectionCategory:e.assetSelectionCategory,recentChainIds:e.recentChainIds}))),E=ie(h,300),I=pe(),{inputSelectionSearch:ye,outputSelectionSearch:be,showInputSelectionTokenBalances:ve,showOutputSelectionTokenBalances:xe}=ne(),{effectiveInputTokens:Ie,effectiveOutputTokens:Ce,effectiveInputChains:Se,effectiveOutputChains:ke,effectivePrioritizedInputTokens:Ne,effectivePrioritizedInputChains:$e}=ge(),Te=d==="base"?ye:be,J=d==="base"?ve:xe,{setBaseToken:X,setQuoteToken:Z}=he(),C=d==="base"?Ie:Ce,x=d==="base"?Se:ke,P=d==="base"?Ne:[],B=d==="base"?$e:[],W=x.length===1,S=A(()=>{if(C.length===0)return null;let e=new Set;for(let s of C)e.add(`${s.chainId}-${s.address.toLowerCase()}`);return e},[C]);De(()=>{W?b.getState().setAssetSelectionChain(x[0]):o&&b.getState().setAssetSelectionChain(o)},[o,W,x]);let Ae=F.useMemo(()=>{let s=x.length>0?new Set(x):null,r=oe(I).filter(t=>!s||s.has(t.id)).map(t=>({chainId:t.id,name:t.displayName})),n=new Map(r.map(t=>[t.chainId,t])),u=new Set(B),g=_.filter(t=>!u.has(t)&&n.has(t)),w=5-Math.min(g.length,5),l=[],p=new Set;for(let t of B){if(l.length>=w)break;let y=n.get(t);y&&!p.has(t)&&(l.push(y),p.add(t))}for(let t of g){if(l.length>=5)break;let y=n.get(t);y&&!p.has(t)&&(l.push(y),p.add(t))}for(let t of B){if(l.length>=5)break;if(p.has(t))continue;let y=n.get(t);y&&(l.push(y),p.add(t))}for(let t of r){if(l.length>=5)break;p.has(t.chainId)||l.push(t)}return l},[I,_,x,B]),{enrichedTokens:j,isLoading:Le}=le(m==="all"?"all":m),{tokenRegistry:ee,getToken:K}=de(),Be=A(()=>{let e=new Set;for(let s of ee)e.add(`${s.chainId}-${s.address.toLowerCase()}`);return e},[ee]),q=A(()=>S?j.filter(e=>S.has(`${e.chainId}-${e.address.toLowerCase()}`)):j,[j,S]),G=A(()=>f?q.filter(e=>!(e.chainId===f.chainId&&e.address.toLowerCase()===f.address.toLowerCase())):q,[q,f]),V=F.useMemo(()=>{if(!E)return G;let e=E.toLowerCase();return G.filter(s=>(s.symbol||"").toLowerCase().includes(e)||(s.name||"").toLowerCase().includes(e)||s.address.toLowerCase().includes(e))},[G,E]),k=A(()=>{let e=new Map;for(let s=0;s<P.length;s++){let r=P[s];e.set(`${r.chainId}-${r.address.toLowerCase()}`,s)}return e},[P]),se=F.useMemo(()=>{let e=m==="all"?(V||[]).filter(n=>I.includes(n.chainId)):V||[],s=new Set;return[...e.filter(n=>{let u=`${n.chainId}-${n.address.toLowerCase()}`;return s.has(u)?!1:(s.add(u),!0)})].sort((n,u)=>{let g=`${n.chainId}-${n.address.toLowerCase()}`,N=`${u.chainId}-${u.address.toLowerCase()}`,w=k.get(g),l=k.get(N);if(w!==void 0&&l!==void 0)return w-l;if(w!==void 0)return-1;if(l!==void 0)return 1;let p=R(n),t=R(u);return p&&!t?-1:!p&&t?1:0})},[V,m,I,k]),{balances:M,isLoading:te}=ue(H,I,void 0,C.length>0?C:void 0),ae=F.useMemo(()=>{if(!M)return[];let e=m==="all"?M:M.filter(r=>r.chainId===m),s=new Set;return e.filter(r=>{let n=`${r.chainId}-${(r.address||"").toLowerCase()}`;return s.has(n)?!1:(s.add(n),!0)})},[M,m]),Me=we(e=>{let s=e.target.value.toLowerCase(),r=re(s),n=b.getState();r?(n.setAssetSelectionSearch(r),n.setAssetSelectionAddressInput(r)):(n.setAssetSelectionAddressInput(""),n.setAssetSelectionSearch(s))},[]),O=we(async e=>{d==="base"?await X(e):d==="quote"&&await Z(e),i()},[i,d,X,Z]);return c("div",{className:"w-full h-full flex flex-col pt-1",children:[!W&&c("div",{className:"flex flex-row justify-between py-1 flex-shrink-0 h-10",children:[a("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 text-center justify-center",style:{backgroundColor:m==="all"&&!o?"var(--widget-primary)":"var(--widget-secondary)",color:m==="all"&&!o?"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(),b.getState().setAssetSelectionChain("all")},onMouseEnter:()=>v?.("All Chains"),onMouseLeave:()=>v?.(null),children:"All"}),Ae.map((e,s)=>a("button",{type:"button",className:"flex items-center justify-center px-2 w-full cursor-pointer",style:{backgroundColor:m===e.chainId?"var(--widget-primary)":"var(--widget-secondary)",color:m===e.chainId?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)",borderLeft:s===0?"none":"1px solid var(--widget-border)",borderRight:"1px solid var(--widget-border)"},onClick:r=>{r.stopPropagation(),b.getState().setAssetSelectionChain(e.chainId)},onMouseEnter:()=>v?.(e.name),onMouseLeave:()=>v?.(null),children:a("div",{className:"mb-px h-4 w-4",children:a(fe,{chain:e.chainId,size:"xs"})})},e.chainId)),L&&a("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(),L()},children:"More"})]}),Te&&a("div",{className:"flex-shrink-0",children:c("div",{className:"relative mt-1",children:[a("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:h,onChange:Me}),h&&a("button",{type:"button",onClick:()=>b.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"})]})}),c("div",{className:"flex-1 min-h-0 overflow-auto mt-2",style:{backgroundColor:"var(--widget-background)"},children:[J&&te&&!h&&U==="all"&&c("div",{children:[a("p",{className:"my-1 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:"Your Tokens"}),Array.from({length:3}).map((e,s)=>c("div",{className:"w-full flex items-center justify-between p-3",style:{borderBottom:"1px solid var(--widget-border)"},children:[c("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[a("div",{className:"h-8 w-8 flex-shrink-0 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"9999px"}}),c("div",{className:"flex flex-col gap-1.5 min-w-0 flex-1",children:[a("div",{className:"h-3.5 w-16 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),a("div",{className:"h-3 w-24 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.6,borderRadius:"0.25rem"}})]})]}),c("div",{className:"flex flex-col items-end gap-1.5 flex-shrink-0",children:[a("div",{className:"h-3.5 w-14 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),a("div",{className:"h-3 w-10 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}})]})]},s))]}),J&&!te&&ae.length>0&&!h&&U==="all"&&c("div",{children:[a("p",{className:"my-1 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:"Your Tokens"}),ae.filter(e=>!e.assetInfo||f&&e.assetInfo.chainId===f.chainId&&e.assetInfo.address.toLowerCase()===f.address.toLowerCase()?!1:S?S.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`):R(e.assetInfo)||Be.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`)).sort((e,s)=>{let r=`${e.chainId}-${(e.address||"").toLowerCase()}`,n=`${s.chainId}-${(s.address||"").toLowerCase()}`,u=k.get(r),g=k.get(n);if(u!==void 0&&g!==void 0)return u-g;if(u!==void 0)return-1;if(g!==void 0)return 1;let N=K(e.chainId,e.address)||e.assetInfo,w=K(s.chainId,s.address)||s.assetInfo,l=N&&e.decimals!==void 0?$(N,e.balance,e.decimals):0;return(w&&s.decimals!==void 0?$(w,s.balance,s.decimals):0)-l}).map(e=>!e.assetInfo||!f?null:a(Q,{asset:e,otherAsset:f,handleFormSelection:O,getToken:K},`${e.assetInfo.chainId}-${e.assetInfo.address}`))]}),a("p",{className:"my-2 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:h?"Search Results":"Supported Tokens"}),Le?a("div",{className:"flex items-center justify-center p-8",children:a("span",{style:{color:"var(--widget-muted-foreground)"},children:"Loading tokens..."})}):se.length===0?a("div",{className:"px-4 py-3 text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Token Not Found"}):se.map(e=>c("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:()=>O(e),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),O(e))},children:[c("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[a(D,{asset:e,size:"sm",className:"flex-shrink-0"}),c("div",{className:"flex flex-col items-start min-w-0 flex-1",children:[a("span",{className:"text-sm font-thin truncate",style:{color:"var(--widget-secondary-foreground)"},children:(e.symbol||"").length>20?`${e.symbol.substring(0,20)}...`:e.symbol||"\u2014"}),a("span",{className:"text-xs truncate",style:{color:"var(--widget-muted-foreground)"},children:(e.name||"").length>20?`${e.name.substring(0,20)}...`:e.name||"\u2014"})]})]}),c("div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[a("span",{className:"text-xs font-sans",style:{color:"var(--widget-muted-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"}),c("span",{className:"text-xs font-sans",style:{color:"var(--widget-foreground)",opacity:.5},children:[e.address?.slice(0,6),"...",e.address?.slice(-4)]})]})]},`${e.chainId}-${e.address}`))]})]})},ns=Fe;export{ns as a};
2
+ import{a as ge}from"./chunk-G6OBWGMM.js";import{e as he}from"./chunk-HBYURJBD.js";import{b as ne,c as pe,d as b}from"./chunk-VRUC4M2Z.js";import{B as de,C as le,D as ce,K as ue,N as fe,O as D,e as oe,i as R,u as $,v as re,x as ie}from"./chunk-SJMURCHX.js";import{a as me}from"./chunk-46H44R7V.js";import F,{useCallback as we,useEffect as De,useMemo as A}from"react";import{useShallow as ze}from"zustand/react/shallow";import Re from"react";import{jsx as T,jsxs as z}from"react/jsx-runtime";var Q=Re.memo(({asset:i,otherAsset:d,handleFormSelection:f,getToken:Y})=>{let{token:v}=ce(i.chainId,i.address),L=Y(i.chainId,i.address),o=v||L||i.assetInfo;if(!o)return null;let h=o.price!=null&&i.decimals!==void 0?$(o,i.balance,i.decimals):null;return z("button",{type:"button",className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>f(o,d),children:[z("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[T(D,{asset:o,size:"sm",className:"flex-shrink-0"}),z("div",{className:"flex flex-col items-start min-w-0 flex-1",children:[T("span",{className:"text-sm font-thin",style:{color:"var(--widget-secondary-foreground)"},children:o.symbol.length>20?`${o.symbol.substring(0,20)}...`:o.symbol}),T("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:o.name.length>20?`${o.name.substring(0,20)}...`:o.name})]})]}),z("div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[T("span",{className:"text-xs font-sans",style:{color:"var(--widget-muted-foreground)"},children:"Balance:"}),T("span",{className:"text-xs font-sans",style:{color:"var(--widget-foreground)",opacity:.5},children:h!=null?`$${h.toFixed(2)}`:"\u2014"})]})]},`${o.chainId}-${o.address}`)},(i,d)=>i.asset.address===d.asset.address&&i.asset.chainId===d.asset.chainId&&i.asset.balance===d.asset.balance&&i.asset.assetInfo?.price===d.asset.assetInfo?.price&&i.otherAsset.address===d.otherAsset.address);Q.displayName="AssetSelectionBalanceItem";import{jsx as a,jsxs as c}from"react/jsx-runtime";var Fe=({toggle:i,side:d,otherAsset:f,containerHeight:Y,onChainHover:v,onMoreChainsClick:L,selectedChainFilter:o})=>{let{address:H}=me(),{assetSelectionSearch:h,assetSelectionChain:m,assetSelectionCategory:U,recentChainIds:_}=b(ze(e=>({assetSelectionSearch:e.assetSelectionSearch,assetSelectionChain:e.assetSelectionChain,assetSelectionCategory:e.assetSelectionCategory,recentChainIds:e.recentChainIds}))),E=ie(h,300),I=pe(),{inputSelectionSearch:ye,outputSelectionSearch:be,showInputSelectionTokenBalances:ve,showOutputSelectionTokenBalances:xe}=ne(),{effectiveInputTokens:Ie,effectiveOutputTokens:Ce,effectiveInputChains:Se,effectiveOutputChains:ke,effectivePrioritizedInputTokens:Ne,effectivePrioritizedInputChains:$e}=ge(),Te=d==="base"?ye:be,J=d==="base"?ve:xe,{setBaseToken:X,setQuoteToken:Z}=he(),C=d==="base"?Ie:Ce,x=d==="base"?Se:ke,P=d==="base"?Ne:[],B=d==="base"?$e:[],W=x.length===1,S=A(()=>{if(C.length===0)return null;let e=new Set;for(let s of C)e.add(`${s.chainId}-${s.address.toLowerCase()}`);return e},[C]);De(()=>{W?b.getState().setAssetSelectionChain(x[0]):o&&b.getState().setAssetSelectionChain(o)},[o,W,x]);let Ae=F.useMemo(()=>{let s=x.length>0?new Set(x):null,r=oe(I).filter(t=>!s||s.has(t.id)).map(t=>({chainId:t.id,name:t.displayName})),n=new Map(r.map(t=>[t.chainId,t])),u=new Set(B),g=_.filter(t=>!u.has(t)&&n.has(t)),w=5-Math.min(g.length,5),l=[],p=new Set;for(let t of B){if(l.length>=w)break;let y=n.get(t);y&&!p.has(t)&&(l.push(y),p.add(t))}for(let t of g){if(l.length>=5)break;let y=n.get(t);y&&!p.has(t)&&(l.push(y),p.add(t))}for(let t of B){if(l.length>=5)break;if(p.has(t))continue;let y=n.get(t);y&&(l.push(y),p.add(t))}for(let t of r){if(l.length>=5)break;p.has(t.chainId)||l.push(t)}return l},[I,_,x,B]),{enrichedTokens:j,isLoading:Le}=le(m==="all"?"all":m),{tokenRegistry:ee,getToken:K}=de(),Be=A(()=>{let e=new Set;for(let s of ee)e.add(`${s.chainId}-${s.address.toLowerCase()}`);return e},[ee]),q=A(()=>S?j.filter(e=>S.has(`${e.chainId}-${e.address.toLowerCase()}`)):j,[j,S]),G=A(()=>f?q.filter(e=>!(e.chainId===f.chainId&&e.address.toLowerCase()===f.address.toLowerCase())):q,[q,f]),V=F.useMemo(()=>{if(!E)return G;let e=E.toLowerCase();return G.filter(s=>(s.symbol||"").toLowerCase().includes(e)||(s.name||"").toLowerCase().includes(e)||s.address.toLowerCase().includes(e))},[G,E]),k=A(()=>{let e=new Map;for(let s=0;s<P.length;s++){let r=P[s];e.set(`${r.chainId}-${r.address.toLowerCase()}`,s)}return e},[P]),se=F.useMemo(()=>{let e=m==="all"?(V||[]).filter(n=>I.includes(n.chainId)):V||[],s=new Set;return[...e.filter(n=>{let u=`${n.chainId}-${n.address.toLowerCase()}`;return s.has(u)?!1:(s.add(u),!0)})].sort((n,u)=>{let g=`${n.chainId}-${n.address.toLowerCase()}`,N=`${u.chainId}-${u.address.toLowerCase()}`,w=k.get(g),l=k.get(N);if(w!==void 0&&l!==void 0)return w-l;if(w!==void 0)return-1;if(l!==void 0)return 1;let p=R(n),t=R(u);return p&&!t?-1:!p&&t?1:0})},[V,m,I,k]),{balances:M,isLoading:te}=ue(H,I,void 0,C.length>0?C:void 0),ae=F.useMemo(()=>{if(!M)return[];let e=m==="all"?M:M.filter(r=>r.chainId===m),s=new Set;return e.filter(r=>{let n=`${r.chainId}-${(r.address||"").toLowerCase()}`;return s.has(n)?!1:(s.add(n),!0)})},[M,m]),Me=we(e=>{let s=e.target.value.toLowerCase(),r=re(s),n=b.getState();r?(n.setAssetSelectionSearch(r),n.setAssetSelectionAddressInput(r)):(n.setAssetSelectionAddressInput(""),n.setAssetSelectionSearch(s))},[]),O=we(async e=>{d==="base"?await X(e):d==="quote"&&await Z(e),i()},[i,d,X,Z]);return c("div",{className:"w-full h-full flex flex-col pt-1",children:[!W&&c("div",{className:"flex flex-row justify-between py-1 flex-shrink-0 h-10",children:[a("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 text-center justify-center",style:{backgroundColor:m==="all"&&!o?"var(--widget-primary)":"var(--widget-secondary)",color:m==="all"&&!o?"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(),b.getState().setAssetSelectionChain("all")},onMouseEnter:()=>v?.("All Chains"),onMouseLeave:()=>v?.(null),children:"All"}),Ae.map((e,s)=>a("button",{type:"button",className:"flex items-center justify-center px-2 w-full cursor-pointer",style:{backgroundColor:m===e.chainId?"var(--widget-primary)":"var(--widget-secondary)",color:m===e.chainId?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)",borderLeft:s===0?"none":"1px solid var(--widget-border)",borderRight:"1px solid var(--widget-border)"},onClick:r=>{r.stopPropagation(),b.getState().setAssetSelectionChain(e.chainId)},onMouseEnter:()=>v?.(e.name),onMouseLeave:()=>v?.(null),children:a("div",{className:"mb-px h-4 w-4",children:a(fe,{chain:e.chainId,size:"xs"})})},e.chainId)),L&&a("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(),L()},children:"More"})]}),Te&&a("div",{className:"flex-shrink-0",children:c("div",{className:"relative mt-1",children:[a("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:h,onChange:Me}),h&&a("button",{type:"button",onClick:()=>b.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"})]})}),c("div",{className:"flex-1 min-h-0 overflow-auto mt-2",style:{backgroundColor:"var(--widget-background)"},children:[J&&te&&!h&&U==="all"&&c("div",{children:[a("p",{className:"my-1 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:"Your Tokens"}),Array.from({length:3}).map((e,s)=>c("div",{className:"w-full flex items-center justify-between p-3",style:{borderBottom:"1px solid var(--widget-border)"},children:[c("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[a("div",{className:"h-8 w-8 flex-shrink-0 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"9999px"}}),c("div",{className:"flex flex-col gap-1.5 min-w-0 flex-1",children:[a("div",{className:"h-3.5 w-16 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),a("div",{className:"h-3 w-24 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.6,borderRadius:"0.25rem"}})]})]}),c("div",{className:"flex flex-col items-end gap-1.5 flex-shrink-0",children:[a("div",{className:"h-3.5 w-14 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),a("div",{className:"h-3 w-10 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}})]})]},s))]}),J&&!te&&ae.length>0&&!h&&U==="all"&&c("div",{children:[a("p",{className:"my-1 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:"Your Tokens"}),ae.filter(e=>!e.assetInfo||f&&e.assetInfo.chainId===f.chainId&&e.assetInfo.address.toLowerCase()===f.address.toLowerCase()?!1:S?S.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`):R(e.assetInfo)||Be.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`)).sort((e,s)=>{let r=`${e.chainId}-${(e.address||"").toLowerCase()}`,n=`${s.chainId}-${(s.address||"").toLowerCase()}`,u=k.get(r),g=k.get(n);if(u!==void 0&&g!==void 0)return u-g;if(u!==void 0)return-1;if(g!==void 0)return 1;let N=K(e.chainId,e.address)||e.assetInfo,w=K(s.chainId,s.address)||s.assetInfo,l=N&&e.decimals!==void 0?$(N,e.balance,e.decimals):0;return(w&&s.decimals!==void 0?$(w,s.balance,s.decimals):0)-l}).map(e=>!e.assetInfo||!f?null:a(Q,{asset:e,otherAsset:f,handleFormSelection:O,getToken:K},`${e.assetInfo.chainId}-${e.assetInfo.address}`))]}),a("p",{className:"my-2 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:h?"Search Results":"Supported Tokens"}),Le?a("div",{className:"flex items-center justify-center p-8",children:a("span",{style:{color:"var(--widget-muted-foreground)"},children:"Loading tokens..."})}):se.length===0?a("div",{className:"px-4 py-3 text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Token Not Found"}):se.map(e=>c("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:()=>O(e),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),O(e))},children:[c("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[a(D,{asset:e,size:"sm",className:"flex-shrink-0"}),c("div",{className:"flex flex-col items-start min-w-0 flex-1",children:[a("span",{className:"text-sm font-thin truncate",style:{color:"var(--widget-secondary-foreground)"},children:(e.symbol||"").length>20?`${e.symbol.substring(0,20)}...`:e.symbol||"\u2014"}),a("span",{className:"text-xs truncate",style:{color:"var(--widget-muted-foreground)"},children:(e.name||"").length>20?`${e.name.substring(0,20)}...`:e.name||"\u2014"})]})]}),c("div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[a("span",{className:"text-xs font-sans",style:{color:"var(--widget-muted-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"}),c("span",{className:"text-xs font-sans",style:{color:"var(--widget-foreground)",opacity:.5},children:[e.address?.slice(0,6),"...",e.address?.slice(-4)]})]})]},`${e.chainId}-${e.address}`))]})]})},ns=Fe;export{ns as a};