@aori/mega-swap-widget 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/README.md +9 -1
  2. package/dist/AssetSelectionMenu-4E576X3D.cjs +2 -0
  3. package/dist/AssetSelectionMenu-ZFY7XFRX.js +2 -0
  4. package/dist/ChainSelectionMenu-SKXLHK3S.js +2 -0
  5. package/dist/ChainSelectionMenu-VU3SIBVL.cjs +2 -0
  6. package/dist/{SwapFormHorizontal-XMZKEAIL.js → SwapFormHorizontal-GI4X7ISS.js} +1 -1
  7. package/dist/{SwapFormHorizontal-ACRBI6GC.cjs → SwapFormHorizontal-V557YBX2.cjs} +1 -1
  8. package/dist/{SwapFormSplit-SOC2XMBW.js → SwapFormSplit-52RBMJIO.js} +1 -1
  9. package/dist/{SwapFormSplit-XHAGOXQX.cjs → SwapFormSplit-PQCS3BPT.cjs} +1 -1
  10. package/dist/{WidgetWalletPanel-KZFLFLUD.js → WidgetWalletPanel-XYV3YL4I.js} +1 -1
  11. package/dist/{WidgetWalletPanel-FQDNFYFL.cjs → WidgetWalletPanel-YBMN5KZH.cjs} +1 -1
  12. package/dist/{chunk-F7IECVJU.js → chunk-4BQRVCQR.js} +1 -1
  13. package/dist/{chunk-Z2BLIAFE.js → chunk-4LJJMEOG.js} +1 -1
  14. package/dist/{chunk-JSWDMAZQ.js → chunk-726CI6GC.js} +1 -1
  15. package/dist/{chunk-XUTR7YYC.cjs → chunk-DUIRZSBV.cjs} +1 -1
  16. package/dist/{chunk-CHDFHEPH.js → chunk-EW2OR6CJ.js} +1 -1
  17. package/dist/{chunk-TWJY6EY4.js → chunk-FDQKBTWP.js} +1 -1
  18. package/dist/{chunk-E44WNKS4.cjs → chunk-HTWUZKYO.cjs} +1 -1
  19. package/dist/{chunk-BX3KCZRT.cjs → chunk-LXEKOQAG.cjs} +1 -1
  20. package/dist/{chunk-NQ4QSGGF.cjs → chunk-MCT3UZTP.cjs} +1 -1
  21. package/dist/{chunk-537OMWA3.cjs → chunk-UZWGYG2S.cjs} +1 -1
  22. package/dist/{chunk-4XEJKRRM.js → chunk-XYF2YBR3.js} +1 -1
  23. package/dist/{chunk-C3X6NJIB.cjs → chunk-XZRXVBSB.cjs} +1 -1
  24. package/dist/index.cjs +2 -2
  25. package/dist/index.js +1 -1
  26. package/package.json +1 -1
  27. package/dist/AssetSelectionMenu-INISSBWT.js +0 -2
  28. package/dist/AssetSelectionMenu-ZT2PDBHV.cjs +0 -2
  29. package/dist/ChainSelectionMenu-N65VG257.js +0 -2
  30. package/dist/ChainSelectionMenu-URYJUECJ.cjs +0 -2
package/README.md CHANGED
@@ -77,7 +77,15 @@ const config: AoriSwapWidgetConfig = {
77
77
  };
78
78
  ```
79
79
 
80
- ### 2. Render
80
+ ### 2. Import styles
81
+
82
+ ```ts
83
+ import '@aori/mega-swap-widget/styles.css';
84
+ ```
85
+
86
+ Add this import once in your app's entry point (e.g. `_app.tsx`, `layout.tsx`, or `main.tsx`). Without it, the widget will render unstyled.
87
+
88
+ ### 3. Render
81
89
 
82
90
  ```tsx
83
91
  import { SwapWidget } from '@aori/mega-swap-widget';
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
+ "use client";var _chunkHTWUZKYOcjs = require('./chunk-HTWUZKYO.cjs');require('./chunk-UZWGYG2S.cjs');require('./chunk-LXEKOQAG.cjs');require('./chunk-34N36GUD.cjs');require('./chunk-T3I3AJXV.cjs');exports.default = _chunkHTWUZKYOcjs.a;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use client";import{a}from"./chunk-4LJJMEOG.js";import"./chunk-726CI6GC.js";import"./chunk-EW2OR6CJ.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-FDQKBTWP.js";import"./chunk-EW2OR6CJ.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 _chunkXZRXVBSBcjs = require('./chunk-XZRXVBSB.cjs');require('./chunk-LXEKOQAG.cjs');require('./chunk-T3I3AJXV.cjs');exports.default = _chunkXZRXVBSBcjs.a;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use client";import{a as ne}from"./chunk-F7IECVJU.js";import{e as oe,g as se,h as f,i as w,j as re,v as ae,w as le}from"./chunk-4XEJKRRM.js";import{a as $}from"./chunk-Z2BLIAFE.js";import{a as B}from"./chunk-TWJY6EY4.js";import"./chunk-OPN7WCJR.js";import{c as d,f as ie}from"./chunk-JSWDMAZQ.js";import{b as ee}from"./chunk-CHDFHEPH.js";import{a as te}from"./chunk-46H44R7V.js";import"./chunk-73CB2I7U.js";import{useCallback as p,useEffect as Fe,useMemo as Me,useRef as Ie,useState as de}from"react";import{useShallow as We}from"zustand/react/shallow";import{Fragment as k,jsx as e,jsxs as r}from"react/jsx-runtime";var P=()=>{},$e=({onSwapComplete:ue,onSwapInitiated:ce,onBackToSwap:h,onMoreChainsClick:Be})=>{let{web3ConnectionType:He,hasConnectHandler:pe,lockBase:O,lockQuote:N,disableInverting:me,swapButtonVariant:q,tokenDisplay:H,tokenBadgeOrientation:x,widgetType:ge,assetMenuVariant:fe}=ee(),Q=H==="pill"||H==="ghost",T=ge==="compact",{baseToken:t,quoteToken:o,baseAmount:i,quoteAmount:u,isBaseGasToken:we,isQuoteGasToken:ve,isWrappingPair:a,isUnwrappingPair:l,baseBalance:g,quoteBalance:Qe,setBaseAmount:R,setQuoteAmount:c,swapTokens:U,clearForm:V}=ie(),{rfqQuote:Ue,status:Ve,handleInputChange:F,ensureForParams:j,stop:je,clear:S,refresh:G}=oe(),{address:m}=te(),{openConnectModal:be}=se(),{isRecipientInputOpen:M,txStatus:z,view:v,selectedChainFilterChainId:D}=d(We(n=>({isRecipientInputOpen:n.isRecipientInputOpen,txStatus:n.txStatus,view:n.view,selectedChainFilterChainId:n.selectedChainFilter?.chainId??null}))),[C,he]=de(null),[y,E]=de(null),xe=Ie(!1),s=!1,Se=Me(()=>!t||!o||typeof i!="number"||!u||!m||parseFloat(g.formatted)<i?null:{base:t,quote:o,baseAmount:i,quoteAmount:u,userAddress:m},[t,o,i,u,m,g.formatted]),Ce=p(n=>{E(n),d.getState().startTracking(n)},[]),ye=p(()=>{xe.current=!0,G()},[G]);Fe(()=>{if(C===null&&!(!t||!o)){if(!i||i<=0){F({amount:null,inputToken:t,outputToken:o,setOutputAmount:c});return}if(a||l){c(i);return}F({amount:i,inputToken:t,outputToken:o,setOutputAmount:c})}},[C,i,t,o,a,l,F,c]);let I=p(()=>{d.getState().setView("baseSelection")},[]),W=p(()=>{d.getState().setView("quoteSelection")},[]),Ae=p(()=>{U(),c(null)},[U,c]),Pe=p(()=>{if(!g.formatted||!t||!o)return;let n=parseFloat(g.formatted);if(!n||n<=0)return;let b=n*.9999999999;a||l?(R(b),c(b),S()):(R(b),c(null),j({inputToken:t,outputToken:o,inputAmount:b.toString(),setOutputAmount:A=>c(A)}))},[g.formatted,t,o,a,l,R,c,S,j]),ke=p(()=>{S(),V()},[S,V]),_=g.formatted?parseFloat(g.formatted):null,Oe=!!(i||u),L=fe==="split",J=L&&(v==="baseSelection"||v==="baseChainSelection"),K=L&&(v==="quoteSelection"||v==="quoteChainSelection"),X=p(n=>{let A=d.getState().view==="baseChainSelection"?"base":"quote";d.getState().setChainFilter({chainId:n,side:A}),d.getState().pushRecentChain(n),d.getState().transitionToView(A==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),Ne=p(()=>{d.getState().transitionToView("baseChainSelection","chainSelection")},[]),qe=p(()=>{d.getState().transitionToView("quoteChainSelection","chainSelection")},[]),Te=t?.price&&i?`$${(t.price*i).toFixed(2)}`:"$0.00",Re=o?.price&&u?`$${(o.price*u).toFixed(2)}`:"$0.00",Y=C==="trackingTx"&&!!y&&!!t&&!!o&&!!i&&!!u,Z={backgroundColor:q==="default"?"var(--widget-primary)":"transparent",color:q==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:q!=="default"?"1px solid var(--widget-primary)":"none",borderRadius:"var(--widget-radius)"};return r("div",{className:"flex flex-col w-full",children:[Y&&y&&t&&o&&i&&u?e("div",{className:"flex-1 min-h-0 overflow-hidden",children:e(le,{orderHash:y,base:t,quote:o,baseAmount:i,quoteAmount:u,status:z})}):r("div",{className:`grid grid-cols-[1fr_auto_1fr] items-stretch px-4 ${T?"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 ${J?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:J?v==="baseChainSelection"?e(B,{toggle:h??P,side:"base",onChainSelect:X}):e($,{toggle:h??P,side:"base",otherAsset:o,onMoreChainsClick:Ne,selectedChainFilter:D}):r(k,{children:[Q?T?r("div",{className:`flex items-center gap-2 ${x==="right"?"flex-row-reverse":"flex-row"}`,children:[e(w,{toggle:I,side:"base",asset:t,isPlacingOrder:s||O}),e("div",{className:"flex-1 min-w-0",children:e(f,{side:"base",asset:t??null,otherAsset:o??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})})]}):r("div",{className:`flex flex-col ${x==="right"?"items-end":"items-start"}`,children:[e(w,{toggle:I,side:"base",asset:t,isPlacingOrder:s||O}),e(f,{side:"base",asset:t??null,otherAsset:o??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}):r(k,{children:[e(w,{toggle:I,side:"base",asset:t,isPlacingOrder:s||O}),e(f,{side:"base",asset:t??null,otherAsset:o??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}),r("div",{className:"flex items-center justify-between",children:[e("span",{className:"mono text-xs",style:{color:"var(--widget-muted-foreground)"},children:Te}),m&&_!==null&&_>0&&e("button",{type:"button",onClick:Pe,disabled:s,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:me?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:Ae,"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("span",{className:"text-2xs",children:"\u2194"})})}),e("div",{className:`relative flex flex-col gap-1 p-3 rounded-lg overflow-hidden ${K?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:K?v==="quoteChainSelection"?e(B,{toggle:h??P,side:"quote",onChainSelect:X}):e($,{toggle:h??P,side:"quote",otherAsset:t,onMoreChainsClick:qe,selectedChainFilter:D}):r(k,{children:[Q?T?r("div",{className:`flex items-center gap-2 ${x==="right"?"flex-row-reverse":"flex-row"}`,children:[e(w,{toggle:W,side:"quote",asset:o,isPlacingOrder:s||N}),e("div",{className:"flex-1 min-w-0",children:e(f,{side:"quote",asset:o??null,otherAsset:t??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})})]}):r("div",{className:`flex flex-col ${x==="right"?"items-end":"items-start"}`,children:[e(w,{toggle:W,side:"quote",asset:o,isPlacingOrder:s||N}),e(f,{side:"quote",asset:o??null,otherAsset:t??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}):r(k,{children:[e(w,{toggle:W,side:"quote",asset:o,isPlacingOrder:s||N}),e(f,{side:"quote",asset:o??null,otherAsset:t??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}),r("div",{className:"flex items-center justify-between",children:[e("span",{className:"mono text-xs",style:{color:"var(--widget-muted-foreground)"},children:Re}),Oe&&e("button",{type:"button",onClick:ke,disabled:s,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:M?"1px solid var(--widget-border)":"none",maxHeight:M?"60px":"0px",opacity:M?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:e(re,{})}),e("div",{className:"px-4",style:{borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)"},children:e(ne,{})}),e("div",{className:`relative ${Y?"px-0":"px-4"} py-4`,children:m&&t&&o&&i&&i>0?e(ae,{base:t,baseAmount:i,quote:o,quoteAmount:u??0,userAddress:m,isWrappingPair:a,isUnwrappingPair:l,isBaseGasToken:we,isQuoteGasToken:ve,reviewActionProps:Se,reviewState:C,setReviewState:he,trackedOrderHash:y,setTrackedOrderHash:E,onSwapComplete:ue,onSwapInitiated:ce,onOrderSubmitted:Ce,onStaleQuoteRestart:ye,txStatus:z}):!m&&pe?e("button",{onClick:()=>be(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:Z,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:Z,children:m?"Enter Amount":"Connect Wallet"})})]})},rt=$e;export{rt as default};
2
+ "use client";import{a as ne}from"./chunk-4BQRVCQR.js";import{e as oe,g as se,h as f,i as w,j as re,v as ae,w as le}from"./chunk-XYF2YBR3.js";import{a as $}from"./chunk-4LJJMEOG.js";import{a as B}from"./chunk-FDQKBTWP.js";import"./chunk-OPN7WCJR.js";import{c as d,f as ie}from"./chunk-726CI6GC.js";import{b as ee}from"./chunk-EW2OR6CJ.js";import{a as te}from"./chunk-46H44R7V.js";import"./chunk-73CB2I7U.js";import{useCallback as p,useEffect as Fe,useMemo as Me,useRef as Ie,useState as de}from"react";import{useShallow as We}from"zustand/react/shallow";import{Fragment as k,jsx as e,jsxs as r}from"react/jsx-runtime";var P=()=>{},$e=({onSwapComplete:ue,onSwapInitiated:ce,onBackToSwap:h,onMoreChainsClick:Be})=>{let{web3ConnectionType:He,hasConnectHandler:pe,lockBase:O,lockQuote:N,disableInverting:me,swapButtonVariant:q,tokenDisplay:H,tokenBadgeOrientation:x,widgetType:ge,assetMenuVariant:fe}=ee(),Q=H==="pill"||H==="ghost",T=ge==="compact",{baseToken:t,quoteToken:o,baseAmount:i,quoteAmount:u,isBaseGasToken:we,isQuoteGasToken:ve,isWrappingPair:a,isUnwrappingPair:l,baseBalance:g,quoteBalance:Qe,setBaseAmount:R,setQuoteAmount:c,swapTokens:U,clearForm:V}=ie(),{rfqQuote:Ue,status:Ve,handleInputChange:F,ensureForParams:j,stop:je,clear:S,refresh:G}=oe(),{address:m}=te(),{openConnectModal:be}=se(),{isRecipientInputOpen:M,txStatus:z,view:v,selectedChainFilterChainId:D}=d(We(n=>({isRecipientInputOpen:n.isRecipientInputOpen,txStatus:n.txStatus,view:n.view,selectedChainFilterChainId:n.selectedChainFilter?.chainId??null}))),[C,he]=de(null),[y,E]=de(null),xe=Ie(!1),s=!1,Se=Me(()=>!t||!o||typeof i!="number"||!u||!m||parseFloat(g.formatted)<i?null:{base:t,quote:o,baseAmount:i,quoteAmount:u,userAddress:m},[t,o,i,u,m,g.formatted]),Ce=p(n=>{E(n),d.getState().startTracking(n)},[]),ye=p(()=>{xe.current=!0,G()},[G]);Fe(()=>{if(C===null&&!(!t||!o)){if(!i||i<=0){F({amount:null,inputToken:t,outputToken:o,setOutputAmount:c});return}if(a||l){c(i);return}F({amount:i,inputToken:t,outputToken:o,setOutputAmount:c})}},[C,i,t,o,a,l,F,c]);let I=p(()=>{d.getState().setView("baseSelection")},[]),W=p(()=>{d.getState().setView("quoteSelection")},[]),Ae=p(()=>{U(),c(null)},[U,c]),Pe=p(()=>{if(!g.formatted||!t||!o)return;let n=parseFloat(g.formatted);if(!n||n<=0)return;let b=n*.9999999999;a||l?(R(b),c(b),S()):(R(b),c(null),j({inputToken:t,outputToken:o,inputAmount:b.toString(),setOutputAmount:A=>c(A)}))},[g.formatted,t,o,a,l,R,c,S,j]),ke=p(()=>{S(),V()},[S,V]),_=g.formatted?parseFloat(g.formatted):null,Oe=!!(i||u),L=fe==="split",J=L&&(v==="baseSelection"||v==="baseChainSelection"),K=L&&(v==="quoteSelection"||v==="quoteChainSelection"),X=p(n=>{let A=d.getState().view==="baseChainSelection"?"base":"quote";d.getState().setChainFilter({chainId:n,side:A}),d.getState().pushRecentChain(n),d.getState().transitionToView(A==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),Ne=p(()=>{d.getState().transitionToView("baseChainSelection","chainSelection")},[]),qe=p(()=>{d.getState().transitionToView("quoteChainSelection","chainSelection")},[]),Te=t?.price&&i?`$${(t.price*i).toFixed(2)}`:"$0.00",Re=o?.price&&u?`$${(o.price*u).toFixed(2)}`:"$0.00",Y=C==="trackingTx"&&!!y&&!!t&&!!o&&!!i&&!!u,Z={backgroundColor:q==="default"?"var(--widget-primary)":"transparent",color:q==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:q!=="default"?"1px solid var(--widget-primary)":"none",borderRadius:"var(--widget-radius)"};return r("div",{className:"flex flex-col w-full",children:[Y&&y&&t&&o&&i&&u?e("div",{className:"flex-1 min-h-0 overflow-hidden",children:e(le,{orderHash:y,base:t,quote:o,baseAmount:i,quoteAmount:u,status:z})}):r("div",{className:`grid grid-cols-[1fr_auto_1fr] items-stretch px-4 ${T?"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 ${J?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:J?v==="baseChainSelection"?e(B,{toggle:h??P,side:"base",onChainSelect:X}):e($,{toggle:h??P,side:"base",otherAsset:o,onMoreChainsClick:Ne,selectedChainFilter:D}):r(k,{children:[Q?T?r("div",{className:`flex items-center gap-2 ${x==="right"?"flex-row-reverse":"flex-row"}`,children:[e(w,{toggle:I,side:"base",asset:t,isPlacingOrder:s||O}),e("div",{className:"flex-1 min-w-0",children:e(f,{side:"base",asset:t??null,otherAsset:o??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})})]}):r("div",{className:`flex flex-col ${x==="right"?"items-end":"items-start"}`,children:[e(w,{toggle:I,side:"base",asset:t,isPlacingOrder:s||O}),e(f,{side:"base",asset:t??null,otherAsset:o??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}):r(k,{children:[e(w,{toggle:I,side:"base",asset:t,isPlacingOrder:s||O}),e(f,{side:"base",asset:t??null,otherAsset:o??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}),r("div",{className:"flex items-center justify-between",children:[e("span",{className:"mono text-xs",style:{color:"var(--widget-muted-foreground)"},children:Te}),m&&_!==null&&_>0&&e("button",{type:"button",onClick:Pe,disabled:s,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:me?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:Ae,"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("span",{className:"text-2xs",children:"\u2194"})})}),e("div",{className:`relative flex flex-col gap-1 p-3 rounded-lg overflow-hidden ${K?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:K?v==="quoteChainSelection"?e(B,{toggle:h??P,side:"quote",onChainSelect:X}):e($,{toggle:h??P,side:"quote",otherAsset:t,onMoreChainsClick:qe,selectedChainFilter:D}):r(k,{children:[Q?T?r("div",{className:`flex items-center gap-2 ${x==="right"?"flex-row-reverse":"flex-row"}`,children:[e(w,{toggle:W,side:"quote",asset:o,isPlacingOrder:s||N}),e("div",{className:"flex-1 min-w-0",children:e(f,{side:"quote",asset:o??null,otherAsset:t??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})})]}):r("div",{className:`flex flex-col ${x==="right"?"items-end":"items-start"}`,children:[e(w,{toggle:W,side:"quote",asset:o,isPlacingOrder:s||N}),e(f,{side:"quote",asset:o??null,otherAsset:t??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}):r(k,{children:[e(w,{toggle:W,side:"quote",asset:o,isPlacingOrder:s||N}),e(f,{side:"quote",asset:o??null,otherAsset:t??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}),r("div",{className:"flex items-center justify-between",children:[e("span",{className:"mono text-xs",style:{color:"var(--widget-muted-foreground)"},children:Re}),Oe&&e("button",{type:"button",onClick:ke,disabled:s,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:M?"1px solid var(--widget-border)":"none",maxHeight:M?"60px":"0px",opacity:M?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:e(re,{})}),e("div",{className:"px-4",style:{borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)"},children:e(ne,{})}),e("div",{className:`relative ${Y?"px-0":"px-4"} py-4`,children:m&&t&&o&&i&&i>0?e(ae,{base:t,baseAmount:i,quote:o,quoteAmount:u??0,userAddress:m,isWrappingPair:a,isUnwrappingPair:l,isBaseGasToken:we,isQuoteGasToken:ve,reviewActionProps:Se,reviewState:C,setReviewState:he,trackedOrderHash:y,setTrackedOrderHash:E,onSwapComplete:ue,onSwapInitiated:ce,onOrderSubmitted:Ce,onStaleQuoteRestart:ye,txStatus:z}):!m&&pe?e("button",{onClick:()=>be(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:Z,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:Z,children:m?"Enter Amount":"Connect Wallet"})})]})},rt=$e;export{rt 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 _chunkXUTR7YYCcjs = require('./chunk-XUTR7YYC.cjs');var _chunkNQ4QSGGFcjs = require('./chunk-NQ4QSGGF.cjs');var _chunkE44WNKS4cjs = require('./chunk-E44WNKS4.cjs');var _chunkC3X6NJIBcjs = require('./chunk-C3X6NJIB.cjs');require('./chunk-KH57FLST.cjs');var _chunk537OMWA3cjs = require('./chunk-537OMWA3.cjs');var _chunkBX3KCZRTcjs = require('./chunk-BX3KCZRT.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 P=()=>{},$e=({onSwapComplete:ue,onSwapInitiated:ce,onBackToSwap:h,onMoreChainsClick:Be})=>{let{web3ConnectionType:He,hasConnectHandler:pe,lockBase:O,lockQuote:N,disableInverting:me,swapButtonVariant:q,tokenDisplay:H,tokenBadgeOrientation:x,widgetType:ge,assetMenuVariant:fe}=_chunkBX3KCZRTcjs.b.call(void 0, ),Q=H==="pill"||H==="ghost",T=ge==="compact",{baseToken:t,quoteToken:o,baseAmount:i,quoteAmount:u,isBaseGasToken:we,isQuoteGasToken:ve,isWrappingPair:a,isUnwrappingPair:l,baseBalance:g,quoteBalance:Qe,setBaseAmount:R,setQuoteAmount:c,swapTokens:U,clearForm:V}=_chunk537OMWA3cjs.f.call(void 0, ),{rfqQuote:Ue,status:Ve,handleInputChange:F,ensureForParams:j,stop:je,clear:S,refresh:G}=_chunkNQ4QSGGFcjs.e.call(void 0, ),{address:m}=_chunk34N36GUDcjs.a.call(void 0, ),{openConnectModal:be}=_chunkNQ4QSGGFcjs.g.call(void 0, ),{isRecipientInputOpen:M,txStatus:z,view:v,selectedChainFilterChainId:D}=_chunk537OMWA3cjs.c.call(void 0, _shallow.useShallow.call(void 0, n=>({isRecipientInputOpen:n.isRecipientInputOpen,txStatus:n.txStatus,view:n.view,selectedChainFilterChainId:_nullishCoalesce(_optionalChain([n, 'access', _2 => _2.selectedChainFilter, 'optionalAccess', _3 => _3.chainId]), () => (null))}))),[C,he]=_react.useState.call(void 0, null),[y,E]=_react.useState.call(void 0, null),xe=_react.useRef.call(void 0, !1),s=!1,Se=_react.useMemo.call(void 0, ()=>!t||!o||typeof i!="number"||!u||!m||parseFloat(g.formatted)<i?null:{base:t,quote:o,baseAmount:i,quoteAmount:u,userAddress:m},[t,o,i,u,m,g.formatted]),Ce=_react.useCallback.call(void 0, n=>{E(n),_chunk537OMWA3cjs.c.getState().startTracking(n)},[]),ye=_react.useCallback.call(void 0, ()=>{xe.current=!0,G()},[G]);_react.useEffect.call(void 0, ()=>{if(C===null&&!(!t||!o)){if(!i||i<=0){F({amount:null,inputToken:t,outputToken:o,setOutputAmount:c});return}if(a||l){c(i);return}F({amount:i,inputToken:t,outputToken:o,setOutputAmount:c})}},[C,i,t,o,a,l,F,c]);let I=_react.useCallback.call(void 0, ()=>{_chunk537OMWA3cjs.c.getState().setView("baseSelection")},[]),W=_react.useCallback.call(void 0, ()=>{_chunk537OMWA3cjs.c.getState().setView("quoteSelection")},[]),Ae=_react.useCallback.call(void 0, ()=>{U(),c(null)},[U,c]),Pe=_react.useCallback.call(void 0, ()=>{if(!g.formatted||!t||!o)return;let n=parseFloat(g.formatted);if(!n||n<=0)return;let b=n*.9999999999;a||l?(R(b),c(b),S()):(R(b),c(null),j({inputToken:t,outputToken:o,inputAmount:b.toString(),setOutputAmount:A=>c(A)}))},[g.formatted,t,o,a,l,R,c,S,j]),ke=_react.useCallback.call(void 0, ()=>{S(),V()},[S,V]),_=g.formatted?parseFloat(g.formatted):null,Oe=!!(i||u),L=fe==="split",J=L&&(v==="baseSelection"||v==="baseChainSelection"),K=L&&(v==="quoteSelection"||v==="quoteChainSelection"),X=_react.useCallback.call(void 0, n=>{let A=_chunk537OMWA3cjs.c.getState().view==="baseChainSelection"?"base":"quote";_chunk537OMWA3cjs.c.getState().setChainFilter({chainId:n,side:A}),_chunk537OMWA3cjs.c.getState().pushRecentChain(n),_chunk537OMWA3cjs.c.getState().transitionToView(A==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),Ne=_react.useCallback.call(void 0, ()=>{_chunk537OMWA3cjs.c.getState().transitionToView("baseChainSelection","chainSelection")},[]),qe=_react.useCallback.call(void 0, ()=>{_chunk537OMWA3cjs.c.getState().transitionToView("quoteChainSelection","chainSelection")},[]),Te=_optionalChain([t, 'optionalAccess', _4 => _4.price])&&i?`$${(t.price*i).toFixed(2)}`:"$0.00",Re=_optionalChain([o, 'optionalAccess', _5 => _5.price])&&u?`$${(o.price*u).toFixed(2)}`:"$0.00",Y=C==="trackingTx"&&!!y&&!!t&&!!o&&!!i&&!!u,Z={backgroundColor:q==="default"?"var(--widget-primary)":"transparent",color:q==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:q!=="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:[Y&&y&&t&&o&&i&&u?_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-h-0 overflow-hidden",children:_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.w,{orderHash:y,base:t,quote:o,baseAmount:i,quoteAmount:u,status:z})}):_jsxruntime.jsxs.call(void 0, "div",{className:`grid grid-cols-[1fr_auto_1fr] items-stretch px-4 ${T?"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 ${J?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:J?v==="baseChainSelection"?_jsxruntime.jsx.call(void 0, _chunkC3X6NJIBcjs.a,{toggle:_nullishCoalesce(h, () => (P)),side:"base",onChainSelect:X}):_jsxruntime.jsx.call(void 0, _chunkE44WNKS4cjs.a,{toggle:_nullishCoalesce(h, () => (P)),side:"base",otherAsset:o,onMoreChainsClick:Ne,selectedChainFilter:D}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[Q?T?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${x==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.i,{toggle:I,side:"base",asset:t,isPlacingOrder:s||O}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.h,{side:"base",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${x==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.i,{toggle:I,side:"base",asset:t,isPlacingOrder:s||O}),_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.h,{side:"base",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.i,{toggle:I,side:"base",asset:t,isPlacingOrder:s||O}),_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.h,{side:"base",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "span",{className:"mono text-xs",style:{color:"var(--widget-muted-foreground)"},children:Te}),m&&_!==null&&_>0&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Pe,disabled:s,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:me?_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:Ae,"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, "span",{className:"text-2xs",children:"\u2194"})})}),_jsxruntime.jsx.call(void 0, "div",{className:`relative flex flex-col gap-1 p-3 rounded-lg overflow-hidden ${K?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:K?v==="quoteChainSelection"?_jsxruntime.jsx.call(void 0, _chunkC3X6NJIBcjs.a,{toggle:_nullishCoalesce(h, () => (P)),side:"quote",onChainSelect:X}):_jsxruntime.jsx.call(void 0, _chunkE44WNKS4cjs.a,{toggle:_nullishCoalesce(h, () => (P)),side:"quote",otherAsset:t,onMoreChainsClick:qe,selectedChainFilter:D}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[Q?T?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${x==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.i,{toggle:W,side:"quote",asset:o,isPlacingOrder:s||N}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${x==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.i,{toggle:W,side:"quote",asset:o,isPlacingOrder:s||N}),_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.i,{toggle:W,side:"quote",asset:o,isPlacingOrder:s||N}),_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "span",{className:"mono text-xs",style:{color:"var(--widget-muted-foreground)"},children:Re}),Oe&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:ke,disabled:s,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:M?"1px solid var(--widget-border)":"none",maxHeight:M?"60px":"0px",opacity:M?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.j,{})}),_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, _chunkXUTR7YYCcjs.a,{})}),_jsxruntime.jsx.call(void 0, "div",{className:`relative ${Y?"px-0":"px-4"} py-4`,children:m&&t&&o&&i&&i>0?_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.v,{base:t,baseAmount:i,quote:o,quoteAmount:_nullishCoalesce(u, () => (0)),userAddress:m,isWrappingPair:a,isUnwrappingPair:l,isBaseGasToken:we,isQuoteGasToken:ve,reviewActionProps:Se,reviewState:C,setReviewState:he,trackedOrderHash:y,setTrackedOrderHash:E,onSwapComplete:ue,onSwapInitiated:ce,onOrderSubmitted:Ce,onStaleQuoteRestart:ye,txStatus:z}):!m&&pe?_jsxruntime.jsx.call(void 0, "button",{onClick:()=>be(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:Z,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:Z,children:m?"Enter Amount":"Connect Wallet"})})]})},rt= exports.default =$e;exports.default = rt;
2
+ "use client";var _chunkDUIRZSBVcjs = require('./chunk-DUIRZSBV.cjs');var _chunkMCT3UZTPcjs = require('./chunk-MCT3UZTP.cjs');var _chunkHTWUZKYOcjs = require('./chunk-HTWUZKYO.cjs');var _chunkXZRXVBSBcjs = require('./chunk-XZRXVBSB.cjs');require('./chunk-KH57FLST.cjs');var _chunkUZWGYG2Scjs = require('./chunk-UZWGYG2S.cjs');var _chunkLXEKOQAGcjs = require('./chunk-LXEKOQAG.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 P=()=>{},$e=({onSwapComplete:ue,onSwapInitiated:ce,onBackToSwap:h,onMoreChainsClick:Be})=>{let{web3ConnectionType:He,hasConnectHandler:pe,lockBase:O,lockQuote:N,disableInverting:me,swapButtonVariant:q,tokenDisplay:H,tokenBadgeOrientation:x,widgetType:ge,assetMenuVariant:fe}=_chunkLXEKOQAGcjs.b.call(void 0, ),Q=H==="pill"||H==="ghost",T=ge==="compact",{baseToken:t,quoteToken:o,baseAmount:i,quoteAmount:u,isBaseGasToken:we,isQuoteGasToken:ve,isWrappingPair:a,isUnwrappingPair:l,baseBalance:g,quoteBalance:Qe,setBaseAmount:R,setQuoteAmount:c,swapTokens:U,clearForm:V}=_chunkUZWGYG2Scjs.f.call(void 0, ),{rfqQuote:Ue,status:Ve,handleInputChange:F,ensureForParams:j,stop:je,clear:S,refresh:G}=_chunkMCT3UZTPcjs.e.call(void 0, ),{address:m}=_chunk34N36GUDcjs.a.call(void 0, ),{openConnectModal:be}=_chunkMCT3UZTPcjs.g.call(void 0, ),{isRecipientInputOpen:M,txStatus:z,view:v,selectedChainFilterChainId:D}=_chunkUZWGYG2Scjs.c.call(void 0, _shallow.useShallow.call(void 0, n=>({isRecipientInputOpen:n.isRecipientInputOpen,txStatus:n.txStatus,view:n.view,selectedChainFilterChainId:_nullishCoalesce(_optionalChain([n, 'access', _2 => _2.selectedChainFilter, 'optionalAccess', _3 => _3.chainId]), () => (null))}))),[C,he]=_react.useState.call(void 0, null),[y,E]=_react.useState.call(void 0, null),xe=_react.useRef.call(void 0, !1),s=!1,Se=_react.useMemo.call(void 0, ()=>!t||!o||typeof i!="number"||!u||!m||parseFloat(g.formatted)<i?null:{base:t,quote:o,baseAmount:i,quoteAmount:u,userAddress:m},[t,o,i,u,m,g.formatted]),Ce=_react.useCallback.call(void 0, n=>{E(n),_chunkUZWGYG2Scjs.c.getState().startTracking(n)},[]),ye=_react.useCallback.call(void 0, ()=>{xe.current=!0,G()},[G]);_react.useEffect.call(void 0, ()=>{if(C===null&&!(!t||!o)){if(!i||i<=0){F({amount:null,inputToken:t,outputToken:o,setOutputAmount:c});return}if(a||l){c(i);return}F({amount:i,inputToken:t,outputToken:o,setOutputAmount:c})}},[C,i,t,o,a,l,F,c]);let I=_react.useCallback.call(void 0, ()=>{_chunkUZWGYG2Scjs.c.getState().setView("baseSelection")},[]),W=_react.useCallback.call(void 0, ()=>{_chunkUZWGYG2Scjs.c.getState().setView("quoteSelection")},[]),Ae=_react.useCallback.call(void 0, ()=>{U(),c(null)},[U,c]),Pe=_react.useCallback.call(void 0, ()=>{if(!g.formatted||!t||!o)return;let n=parseFloat(g.formatted);if(!n||n<=0)return;let b=n*.9999999999;a||l?(R(b),c(b),S()):(R(b),c(null),j({inputToken:t,outputToken:o,inputAmount:b.toString(),setOutputAmount:A=>c(A)}))},[g.formatted,t,o,a,l,R,c,S,j]),ke=_react.useCallback.call(void 0, ()=>{S(),V()},[S,V]),_=g.formatted?parseFloat(g.formatted):null,Oe=!!(i||u),L=fe==="split",J=L&&(v==="baseSelection"||v==="baseChainSelection"),K=L&&(v==="quoteSelection"||v==="quoteChainSelection"),X=_react.useCallback.call(void 0, n=>{let A=_chunkUZWGYG2Scjs.c.getState().view==="baseChainSelection"?"base":"quote";_chunkUZWGYG2Scjs.c.getState().setChainFilter({chainId:n,side:A}),_chunkUZWGYG2Scjs.c.getState().pushRecentChain(n),_chunkUZWGYG2Scjs.c.getState().transitionToView(A==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),Ne=_react.useCallback.call(void 0, ()=>{_chunkUZWGYG2Scjs.c.getState().transitionToView("baseChainSelection","chainSelection")},[]),qe=_react.useCallback.call(void 0, ()=>{_chunkUZWGYG2Scjs.c.getState().transitionToView("quoteChainSelection","chainSelection")},[]),Te=_optionalChain([t, 'optionalAccess', _4 => _4.price])&&i?`$${(t.price*i).toFixed(2)}`:"$0.00",Re=_optionalChain([o, 'optionalAccess', _5 => _5.price])&&u?`$${(o.price*u).toFixed(2)}`:"$0.00",Y=C==="trackingTx"&&!!y&&!!t&&!!o&&!!i&&!!u,Z={backgroundColor:q==="default"?"var(--widget-primary)":"transparent",color:q==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:q!=="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:[Y&&y&&t&&o&&i&&u?_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-h-0 overflow-hidden",children:_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.w,{orderHash:y,base:t,quote:o,baseAmount:i,quoteAmount:u,status:z})}):_jsxruntime.jsxs.call(void 0, "div",{className:`grid grid-cols-[1fr_auto_1fr] items-stretch px-4 ${T?"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 ${J?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:J?v==="baseChainSelection"?_jsxruntime.jsx.call(void 0, _chunkXZRXVBSBcjs.a,{toggle:_nullishCoalesce(h, () => (P)),side:"base",onChainSelect:X}):_jsxruntime.jsx.call(void 0, _chunkHTWUZKYOcjs.a,{toggle:_nullishCoalesce(h, () => (P)),side:"base",otherAsset:o,onMoreChainsClick:Ne,selectedChainFilter:D}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[Q?T?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${x==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.i,{toggle:I,side:"base",asset:t,isPlacingOrder:s||O}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.h,{side:"base",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${x==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.i,{toggle:I,side:"base",asset:t,isPlacingOrder:s||O}),_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.h,{side:"base",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.i,{toggle:I,side:"base",asset:t,isPlacingOrder:s||O}),_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.h,{side:"base",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "span",{className:"mono text-xs",style:{color:"var(--widget-muted-foreground)"},children:Te}),m&&_!==null&&_>0&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Pe,disabled:s,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:me?_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:Ae,"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, "span",{className:"text-2xs",children:"\u2194"})})}),_jsxruntime.jsx.call(void 0, "div",{className:`relative flex flex-col gap-1 p-3 rounded-lg overflow-hidden ${K?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:K?v==="quoteChainSelection"?_jsxruntime.jsx.call(void 0, _chunkXZRXVBSBcjs.a,{toggle:_nullishCoalesce(h, () => (P)),side:"quote",onChainSelect:X}):_jsxruntime.jsx.call(void 0, _chunkHTWUZKYOcjs.a,{toggle:_nullishCoalesce(h, () => (P)),side:"quote",otherAsset:t,onMoreChainsClick:qe,selectedChainFilter:D}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[Q?T?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${x==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.i,{toggle:W,side:"quote",asset:o,isPlacingOrder:s||N}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${x==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.i,{toggle:W,side:"quote",asset:o,isPlacingOrder:s||N}),_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.i,{toggle:W,side:"quote",asset:o,isPlacingOrder:s||N}),_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "span",{className:"mono text-xs",style:{color:"var(--widget-muted-foreground)"},children:Re}),Oe&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:ke,disabled:s,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:M?"1px solid var(--widget-border)":"none",maxHeight:M?"60px":"0px",opacity:M?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.j,{})}),_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, _chunkDUIRZSBVcjs.a,{})}),_jsxruntime.jsx.call(void 0, "div",{className:`relative ${Y?"px-0":"px-4"} py-4`,children:m&&t&&o&&i&&i>0?_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.v,{base:t,baseAmount:i,quote:o,quoteAmount:_nullishCoalesce(u, () => (0)),userAddress:m,isWrappingPair:a,isUnwrappingPair:l,isBaseGasToken:we,isQuoteGasToken:ve,reviewActionProps:Se,reviewState:C,setReviewState:he,trackedOrderHash:y,setTrackedOrderHash:E,onSwapComplete:ue,onSwapInitiated:ce,onOrderSubmitted:Ce,onStaleQuoteRestart:ye,txStatus:z}):!m&&pe?_jsxruntime.jsx.call(void 0, "button",{onClick:()=>be(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:Z,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:Z,children:m?"Enter Amount":"Connect Wallet"})})]})},rt= exports.default =$e;exports.default = rt;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use client";import{e as ae,g as ne,h as b,i as h,j as re,v as le,w as de}from"./chunk-4XEJKRRM.js";import{a as ce}from"./chunk-Z2BLIAFE.js";import{a as ue}from"./chunk-TWJY6EY4.js";import"./chunk-OPN7WCJR.js";import{c as l,f as ie}from"./chunk-JSWDMAZQ.js";import{P as U,X as se,b as te}from"./chunk-CHDFHEPH.js";import{a as oe}from"./chunk-46H44R7V.js";import"./chunk-73CB2I7U.js";import{useCallback as f,useEffect as pe,useMemo as Ge,useRef as me,useState as V}from"react";import{useShallow as Le}from"zustand/react/shallow";import{Fragment as P,jsx as e,jsxs as t}from"react/jsx-runtime";var ge=()=>{},_e=({onSwapComplete:fe,onSwapInitiated:xe,onBackToSwap:H,onMoreChainsClick:Je})=>{let{web3ConnectionType:Ke,hasConnectHandler:ve,lockBase:O,lockQuote:T,disableInverting:we,swapButtonVariant:q,tokenDisplay:j,tokenBadgeOrientation:y,widgetType:be,assetMenuVariant:he}=te(),E=j==="pill"||j==="ghost",N=be==="compact",{baseToken:d,quoteToken:c,baseAmount:a,quoteAmount:n,isBaseGasToken:Se,isQuoteGasToken:ye,isWrappingPair:u,isUnwrappingPair:p,baseBalance:w,setBaseAmount:R,setQuoteAmount:g,swapTokens:D,clearForm:z}=ie(),{handleInputChange:F,ensureForParams:G,clear:C,refresh:L,liquidityError:Ne,routingError:Ce}=ae(),{address:x}=oe(),{openConnectModal:ke}=ne(),{isRecipientInputOpen:I,txStatus:_,view:v,selectedChainFilterChainId:Ae}=l(Le(i=>({isRecipientInputOpen:i.isRecipientInputOpen,txStatus:i.txStatus,view:i.view,selectedChainFilterChainId:i.selectedChainFilterChainId??null}))),[k,Pe]=V(null),[A,J]=V(null),Oe=me(!1),r=!1,Te=Ge(()=>!d||!c||typeof a!="number"||!n||!x||parseFloat(w.formatted)<a?null:{base:d,quote:c,baseAmount:a,quoteAmount:n,userAddress:x},[d,c,a,n,x,w.formatted]),qe=f(i=>{J(i),l.getState().startTracking(i)},[]),Re=f(()=>{Oe.current=!0,L()},[L]);pe(()=>{if(k===null&&!(!d||!c)){if(!a||a<=0){F({amount:null,inputToken:d,outputToken:c,setOutputAmount:g});return}if(u||p){g(a);return}F({amount:a,inputToken:d,outputToken:c,setOutputAmount:g})}},[k,a,d,c,u,p,F,g]);let K=a&&n&&parseFloat(n.toString())?parseFloat(a.toString())/parseFloat(n.toString()):0,M=f(()=>{l.getState().setView("baseSelection")},[]),$=f(()=>{l.getState().setView("quoteSelection")},[]),Fe=f(()=>{D(),g(null)},[D,g]),Ie=f(()=>{if(!w.formatted||!d||!c)return;let i=parseFloat(w.formatted);if(!i||i<=0)return;let m=i*.9999999999;u||p?(R(m),g(m),C()):(R(m),g(null),G({inputToken:d,outputToken:c,inputAmount:m.toString(),setOutputAmount:S=>g(S)}))},[w.formatted,d,c,u,p,R,g,C,G]),Me=f(()=>{C(),z()},[C,z]),X=w.formatted?parseFloat(w.formatted):null,$e=!!(a||n),s=d,o=c,We=s?.price&&a?`$${(s.price*a).toFixed(2)}`:"$0.00",Be=o?.price&&n?`$${(o.price*n).toFixed(2)}`:"$0.00",Qe=!!(s&&o&&a&&n),Ue=Ne||Ce,Y=k==="trackingTx"&&!!A&&!!s&&!!o&&!!a&&!!n,W=he==="split",B=W&&(v==="baseSelection"||v==="quoteSelection"||v==="baseChainSelection"||v==="quoteChainSelection"),Q=v==="baseSelection"||v==="baseChainSelection"?"base":"quote",Ve=Q==="base"?o:s,Z=me(null),[He,je]=V(380);pe(()=>{if(!W)return;let i=Z.current;if(!i)return;let m=new ResizeObserver(S=>{for(let ze of S)je(ze.contentRect.height)});return m.observe(i),()=>m.disconnect()},[W]);let Ee=f(i=>{let S=l.getState().view==="baseChainSelection"?"base":"quote";l.getState().setChainFilter({chainId:i,side:S}),l.getState().pushRecentChain(i),l.getState().transitionToView(S==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),De=f(()=>{let i=l.getState().view;i==="baseSelection"?l.getState().transitionToView("baseChainSelection","chainSelection"):i==="quoteSelection"&&l.getState().transitionToView("quoteChainSelection","chainSelection")},[]),ee={backgroundColor:q==="default"?"var(--widget-primary)":"transparent",color:q==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:q!=="default"?"1px solid var(--widget-primary)":"none",borderRadius:"var(--widget-radius)"};return t("div",{className:"flex flex-row w-full",children:[t("div",{ref:Z,className:"flex flex-col flex-1 min-w-0",style:{borderRight:"1px solid var(--widget-border)"},children:[Y&&A&&s&&o&&a&&n?e("div",{className:"flex-1 min-h-0 overflow-hidden",children:e(de,{orderHash:A,base:s,quote:o,baseAmount:a,quoteAmount:n,status:_})}):t(P,{children:[t("div",{className:`relative ${N?"px-4 pt-3 pb-1":"px-4 pt-4 pb-2"}`,style:{borderBottom:"1px solid var(--widget-border)"},children:[E?N?t("div",{className:`flex items-center gap-2 ${y==="right"?"flex-row-reverse":"flex-row"}`,children:[e(h,{toggle:M,side:"base",asset:s,isPlacingOrder:r||O}),e("div",{className:"flex-1 min-w-0",children:e(b,{side:"base",asset:s??null,otherAsset:o??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})})]}):t("div",{className:`flex flex-col ${y==="right"?"items-end":"items-start"}`,children:[e(h,{toggle:M,side:"base",asset:s,isPlacingOrder:r||O}),e(b,{side:"base",asset:s??null,otherAsset:o??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}):t(P,{children:[e(h,{toggle:M,side:"base",asset:s,isPlacingOrder:r||O}),e(b,{side:"base",asset:s??null,otherAsset:o??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}),t("div",{className:"mb-1 flex w-full flex-row items-center justify-between",children:[e("p",{className:"mono text-sm",style:{color:"var(--widget-muted-foreground)"},children:We}),x&&X!==null&&X>0&&e("button",{type:"button",onClick:Ie,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"})]})]}),!we&&e("div",{className:"flex justify-center -my-4 relative z-10",children:t("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 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("span",{className:"text-2xs",children:"\u2191"}),e("span",{className:"text-2xs",children:"\u2193"})]})}),t("div",{className:`relative ${N?"px-4 pt-4 pb-1":"px-4 pt-6 pb-2"}`,children:[E?N?t("div",{className:`flex items-center gap-2 ${y==="right"?"flex-row-reverse":"flex-row"}`,children:[e(h,{toggle:$,side:"quote",asset:o,isPlacingOrder:r||T}),e("div",{className:"flex-1 min-w-0",children:e(b,{side:"quote",asset:o??null,otherAsset:s??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})})]}):t("div",{className:`flex flex-col ${y==="right"?"items-end":"items-start"}`,children:[e(h,{toggle:$,side:"quote",asset:o,isPlacingOrder:r||T}),e(b,{side:"quote",asset:o??null,otherAsset:s??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}):t(P,{children:[e(h,{toggle:$,side:"quote",asset:o,isPlacingOrder:r||T}),e(b,{side:"quote",asset:o??null,otherAsset:s??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}),t("div",{className:"flex w-full flex-row items-center justify-between",children:[e("p",{className:"mono text-sm",style:{color:"var(--widget-muted-foreground)"},children:Be}),$e&&e("button",{type:"button",onClick:Me,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:I?"1px solid var(--widget-border)":"none",maxHeight:I?"60px":"0px",opacity:I?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:e(re,{})}),e("div",{className:`relative ${Y?"px-0":"px-4"} py-4`,children:x&&s&&o&&a&&a>0?e(le,{base:s,baseAmount:a,quote:o,quoteAmount:n??0,userAddress:x,isWrappingPair:u,isUnwrappingPair:p,isBaseGasToken:Se,isQuoteGasToken:ye,reviewActionProps:Te,reviewState:k,setReviewState:Pe,trackedOrderHash:A,setTrackedOrderHash:J,onSwapComplete:fe,onSwapInitiated:xe,onOrderSubmitted:qe,onStaleQuoteRestart:Re,txStatus:_}):!x&&ve?e("button",{onClick:()=>ke(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:ee,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:ee,children:x?"Enter Amount":"Connect Wallet"})})]}),e("div",{className:`flex flex-col transition-all duration-300 ${B?"flex-1 min-w-0":"w-48 shrink-0"}`,style:{backgroundColor:"var(--widget-background)",...B?{height:`${He}px`}:{}},children:B?e("div",{className:"flex flex-col overflow-hidden p-2",style:{height:"100%"},children:v==="baseChainSelection"||v==="quoteChainSelection"?e(ue,{toggle:H??ge,side:Q,onChainSelect:Ee}):e(ce,{toggle:H??ge,side:Q,otherAsset:Ve,onMoreChainsClick:De,selectedChainFilter:Ae})}):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"}),Qe&&s&&o?t(P,{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(U,{asset:o,size:"3xs",noChain:!0}),t("span",{className:"font-mono 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:["= ",K.toFixed(6)]})}),t("div",{className:"flex items-center gap-1 pl-4",children:[e(U,{asset:s,size:"3xs",noChain:!0}),e("span",{className:"font-mono 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-mono text-xs",children:["$",s.price?(s.price*K*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-mono",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-mono",children:"Cross-chain"})]})]})]}):Ue?t("div",{className:"flex flex-col gap-1",children:[e(se,{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((i,m)=>e("div",{className:"h-3 rounded animate-pulse",style:{backgroundColor:"var(--widget-muted)",width:m%2===0?"80%":"60%",opacity:.5}},m)),e("span",{className:"text-2xs mt-1",style:{color:"var(--widget-muted-foreground)",opacity:.5},children:"Enter an amount"})]})]})})]})},gt=_e;export{gt as default};
2
+ "use client";import{e as ae,g as ne,h as b,i as h,j as re,v as le,w as de}from"./chunk-XYF2YBR3.js";import{a as ce}from"./chunk-4LJJMEOG.js";import{a as ue}from"./chunk-FDQKBTWP.js";import"./chunk-OPN7WCJR.js";import{c as l,f as ie}from"./chunk-726CI6GC.js";import{P as U,X as se,b as te}from"./chunk-EW2OR6CJ.js";import{a as oe}from"./chunk-46H44R7V.js";import"./chunk-73CB2I7U.js";import{useCallback as f,useEffect as pe,useMemo as Ge,useRef as me,useState as V}from"react";import{useShallow as Le}from"zustand/react/shallow";import{Fragment as P,jsx as e,jsxs as t}from"react/jsx-runtime";var ge=()=>{},_e=({onSwapComplete:fe,onSwapInitiated:xe,onBackToSwap:H,onMoreChainsClick:Je})=>{let{web3ConnectionType:Ke,hasConnectHandler:ve,lockBase:O,lockQuote:T,disableInverting:we,swapButtonVariant:q,tokenDisplay:j,tokenBadgeOrientation:y,widgetType:be,assetMenuVariant:he}=te(),E=j==="pill"||j==="ghost",N=be==="compact",{baseToken:d,quoteToken:c,baseAmount:a,quoteAmount:n,isBaseGasToken:Se,isQuoteGasToken:ye,isWrappingPair:u,isUnwrappingPair:p,baseBalance:w,setBaseAmount:R,setQuoteAmount:g,swapTokens:D,clearForm:z}=ie(),{handleInputChange:F,ensureForParams:G,clear:C,refresh:L,liquidityError:Ne,routingError:Ce}=ae(),{address:x}=oe(),{openConnectModal:ke}=ne(),{isRecipientInputOpen:I,txStatus:_,view:v,selectedChainFilterChainId:Ae}=l(Le(i=>({isRecipientInputOpen:i.isRecipientInputOpen,txStatus:i.txStatus,view:i.view,selectedChainFilterChainId:i.selectedChainFilterChainId??null}))),[k,Pe]=V(null),[A,J]=V(null),Oe=me(!1),r=!1,Te=Ge(()=>!d||!c||typeof a!="number"||!n||!x||parseFloat(w.formatted)<a?null:{base:d,quote:c,baseAmount:a,quoteAmount:n,userAddress:x},[d,c,a,n,x,w.formatted]),qe=f(i=>{J(i),l.getState().startTracking(i)},[]),Re=f(()=>{Oe.current=!0,L()},[L]);pe(()=>{if(k===null&&!(!d||!c)){if(!a||a<=0){F({amount:null,inputToken:d,outputToken:c,setOutputAmount:g});return}if(u||p){g(a);return}F({amount:a,inputToken:d,outputToken:c,setOutputAmount:g})}},[k,a,d,c,u,p,F,g]);let K=a&&n&&parseFloat(n.toString())?parseFloat(a.toString())/parseFloat(n.toString()):0,M=f(()=>{l.getState().setView("baseSelection")},[]),$=f(()=>{l.getState().setView("quoteSelection")},[]),Fe=f(()=>{D(),g(null)},[D,g]),Ie=f(()=>{if(!w.formatted||!d||!c)return;let i=parseFloat(w.formatted);if(!i||i<=0)return;let m=i*.9999999999;u||p?(R(m),g(m),C()):(R(m),g(null),G({inputToken:d,outputToken:c,inputAmount:m.toString(),setOutputAmount:S=>g(S)}))},[w.formatted,d,c,u,p,R,g,C,G]),Me=f(()=>{C(),z()},[C,z]),X=w.formatted?parseFloat(w.formatted):null,$e=!!(a||n),s=d,o=c,We=s?.price&&a?`$${(s.price*a).toFixed(2)}`:"$0.00",Be=o?.price&&n?`$${(o.price*n).toFixed(2)}`:"$0.00",Qe=!!(s&&o&&a&&n),Ue=Ne||Ce,Y=k==="trackingTx"&&!!A&&!!s&&!!o&&!!a&&!!n,W=he==="split",B=W&&(v==="baseSelection"||v==="quoteSelection"||v==="baseChainSelection"||v==="quoteChainSelection"),Q=v==="baseSelection"||v==="baseChainSelection"?"base":"quote",Ve=Q==="base"?o:s,Z=me(null),[He,je]=V(380);pe(()=>{if(!W)return;let i=Z.current;if(!i)return;let m=new ResizeObserver(S=>{for(let ze of S)je(ze.contentRect.height)});return m.observe(i),()=>m.disconnect()},[W]);let Ee=f(i=>{let S=l.getState().view==="baseChainSelection"?"base":"quote";l.getState().setChainFilter({chainId:i,side:S}),l.getState().pushRecentChain(i),l.getState().transitionToView(S==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),De=f(()=>{let i=l.getState().view;i==="baseSelection"?l.getState().transitionToView("baseChainSelection","chainSelection"):i==="quoteSelection"&&l.getState().transitionToView("quoteChainSelection","chainSelection")},[]),ee={backgroundColor:q==="default"?"var(--widget-primary)":"transparent",color:q==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:q!=="default"?"1px solid var(--widget-primary)":"none",borderRadius:"var(--widget-radius)"};return t("div",{className:"flex flex-row w-full",children:[t("div",{ref:Z,className:"flex flex-col flex-1 min-w-0",style:{borderRight:"1px solid var(--widget-border)"},children:[Y&&A&&s&&o&&a&&n?e("div",{className:"flex-1 min-h-0 overflow-hidden",children:e(de,{orderHash:A,base:s,quote:o,baseAmount:a,quoteAmount:n,status:_})}):t(P,{children:[t("div",{className:`relative ${N?"px-4 pt-3 pb-1":"px-4 pt-4 pb-2"}`,style:{borderBottom:"1px solid var(--widget-border)"},children:[E?N?t("div",{className:`flex items-center gap-2 ${y==="right"?"flex-row-reverse":"flex-row"}`,children:[e(h,{toggle:M,side:"base",asset:s,isPlacingOrder:r||O}),e("div",{className:"flex-1 min-w-0",children:e(b,{side:"base",asset:s??null,otherAsset:o??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})})]}):t("div",{className:`flex flex-col ${y==="right"?"items-end":"items-start"}`,children:[e(h,{toggle:M,side:"base",asset:s,isPlacingOrder:r||O}),e(b,{side:"base",asset:s??null,otherAsset:o??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}):t(P,{children:[e(h,{toggle:M,side:"base",asset:s,isPlacingOrder:r||O}),e(b,{side:"base",asset:s??null,otherAsset:o??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}),t("div",{className:"mb-1 flex w-full flex-row items-center justify-between",children:[e("p",{className:"mono text-sm",style:{color:"var(--widget-muted-foreground)"},children:We}),x&&X!==null&&X>0&&e("button",{type:"button",onClick:Ie,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"})]})]}),!we&&e("div",{className:"flex justify-center -my-4 relative z-10",children:t("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 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("span",{className:"text-2xs",children:"\u2191"}),e("span",{className:"text-2xs",children:"\u2193"})]})}),t("div",{className:`relative ${N?"px-4 pt-4 pb-1":"px-4 pt-6 pb-2"}`,children:[E?N?t("div",{className:`flex items-center gap-2 ${y==="right"?"flex-row-reverse":"flex-row"}`,children:[e(h,{toggle:$,side:"quote",asset:o,isPlacingOrder:r||T}),e("div",{className:"flex-1 min-w-0",children:e(b,{side:"quote",asset:o??null,otherAsset:s??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})})]}):t("div",{className:`flex flex-col ${y==="right"?"items-end":"items-start"}`,children:[e(h,{toggle:$,side:"quote",asset:o,isPlacingOrder:r||T}),e(b,{side:"quote",asset:o??null,otherAsset:s??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}):t(P,{children:[e(h,{toggle:$,side:"quote",asset:o,isPlacingOrder:r||T}),e(b,{side:"quote",asset:o??null,otherAsset:s??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}),t("div",{className:"flex w-full flex-row items-center justify-between",children:[e("p",{className:"mono text-sm",style:{color:"var(--widget-muted-foreground)"},children:Be}),$e&&e("button",{type:"button",onClick:Me,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:I?"1px solid var(--widget-border)":"none",maxHeight:I?"60px":"0px",opacity:I?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:e(re,{})}),e("div",{className:`relative ${Y?"px-0":"px-4"} py-4`,children:x&&s&&o&&a&&a>0?e(le,{base:s,baseAmount:a,quote:o,quoteAmount:n??0,userAddress:x,isWrappingPair:u,isUnwrappingPair:p,isBaseGasToken:Se,isQuoteGasToken:ye,reviewActionProps:Te,reviewState:k,setReviewState:Pe,trackedOrderHash:A,setTrackedOrderHash:J,onSwapComplete:fe,onSwapInitiated:xe,onOrderSubmitted:qe,onStaleQuoteRestart:Re,txStatus:_}):!x&&ve?e("button",{onClick:()=>ke(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:ee,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:ee,children:x?"Enter Amount":"Connect Wallet"})})]}),e("div",{className:`flex flex-col transition-all duration-300 ${B?"flex-1 min-w-0":"w-48 shrink-0"}`,style:{backgroundColor:"var(--widget-background)",...B?{height:`${He}px`}:{}},children:B?e("div",{className:"flex flex-col overflow-hidden p-2",style:{height:"100%"},children:v==="baseChainSelection"||v==="quoteChainSelection"?e(ue,{toggle:H??ge,side:Q,onChainSelect:Ee}):e(ce,{toggle:H??ge,side:Q,otherAsset:Ve,onMoreChainsClick:De,selectedChainFilter:Ae})}):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"}),Qe&&s&&o?t(P,{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(U,{asset:o,size:"3xs",noChain:!0}),t("span",{className:"font-mono 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:["= ",K.toFixed(6)]})}),t("div",{className:"flex items-center gap-1 pl-4",children:[e(U,{asset:s,size:"3xs",noChain:!0}),e("span",{className:"font-mono 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-mono text-xs",children:["$",s.price?(s.price*K*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-mono",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-mono",children:"Cross-chain"})]})]})]}):Ue?t("div",{className:"flex flex-col gap-1",children:[e(se,{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((i,m)=>e("div",{className:"h-3 rounded animate-pulse",style:{backgroundColor:"var(--widget-muted)",width:m%2===0?"80%":"60%",opacity:.5}},m)),e("span",{className:"text-2xs mt-1",style:{color:"var(--widget-muted-foreground)",opacity:.5},children:"Enter an amount"})]})]})})]})},gt=_e;export{gt 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 _chunkNQ4QSGGFcjs = require('./chunk-NQ4QSGGF.cjs');var _chunkE44WNKS4cjs = require('./chunk-E44WNKS4.cjs');var _chunkC3X6NJIBcjs = require('./chunk-C3X6NJIB.cjs');require('./chunk-KH57FLST.cjs');var _chunk537OMWA3cjs = require('./chunk-537OMWA3.cjs');var _chunkBX3KCZRTcjs = require('./chunk-BX3KCZRT.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 ge=()=>{},_e=({onSwapComplete:fe,onSwapInitiated:xe,onBackToSwap:H,onMoreChainsClick:Je})=>{let{web3ConnectionType:Ke,hasConnectHandler:ve,lockBase:O,lockQuote:T,disableInverting:we,swapButtonVariant:q,tokenDisplay:j,tokenBadgeOrientation:y,widgetType:be,assetMenuVariant:he}=_chunkBX3KCZRTcjs.b.call(void 0, ),E=j==="pill"||j==="ghost",N=be==="compact",{baseToken:d,quoteToken:c,baseAmount:a,quoteAmount:n,isBaseGasToken:Se,isQuoteGasToken:ye,isWrappingPair:u,isUnwrappingPair:p,baseBalance:w,setBaseAmount:R,setQuoteAmount:g,swapTokens:D,clearForm:z}=_chunk537OMWA3cjs.f.call(void 0, ),{handleInputChange:F,ensureForParams:G,clear:C,refresh:L,liquidityError:Ne,routingError:Ce}=_chunkNQ4QSGGFcjs.e.call(void 0, ),{address:x}=_chunk34N36GUDcjs.a.call(void 0, ),{openConnectModal:ke}=_chunkNQ4QSGGFcjs.g.call(void 0, ),{isRecipientInputOpen:I,txStatus:_,view:v,selectedChainFilterChainId:Ae}=_chunk537OMWA3cjs.c.call(void 0, _shallow.useShallow.call(void 0, i=>({isRecipientInputOpen:i.isRecipientInputOpen,txStatus:i.txStatus,view:i.view,selectedChainFilterChainId:_nullishCoalesce(i.selectedChainFilterChainId, () => (null))}))),[k,Pe]=_react.useState.call(void 0, null),[A,J]=_react.useState.call(void 0, null),Oe=_react.useRef.call(void 0, !1),r=!1,Te=_react.useMemo.call(void 0, ()=>!d||!c||typeof a!="number"||!n||!x||parseFloat(w.formatted)<a?null:{base:d,quote:c,baseAmount:a,quoteAmount:n,userAddress:x},[d,c,a,n,x,w.formatted]),qe=_react.useCallback.call(void 0, i=>{J(i),_chunk537OMWA3cjs.c.getState().startTracking(i)},[]),Re=_react.useCallback.call(void 0, ()=>{Oe.current=!0,L()},[L]);_react.useEffect.call(void 0, ()=>{if(k===null&&!(!d||!c)){if(!a||a<=0){F({amount:null,inputToken:d,outputToken:c,setOutputAmount:g});return}if(u||p){g(a);return}F({amount:a,inputToken:d,outputToken:c,setOutputAmount:g})}},[k,a,d,c,u,p,F,g]);let K=a&&n&&parseFloat(n.toString())?parseFloat(a.toString())/parseFloat(n.toString()):0,M=_react.useCallback.call(void 0, ()=>{_chunk537OMWA3cjs.c.getState().setView("baseSelection")},[]),$=_react.useCallback.call(void 0, ()=>{_chunk537OMWA3cjs.c.getState().setView("quoteSelection")},[]),Fe=_react.useCallback.call(void 0, ()=>{D(),g(null)},[D,g]),Ie=_react.useCallback.call(void 0, ()=>{if(!w.formatted||!d||!c)return;let i=parseFloat(w.formatted);if(!i||i<=0)return;let m=i*.9999999999;u||p?(R(m),g(m),C()):(R(m),g(null),G({inputToken:d,outputToken:c,inputAmount:m.toString(),setOutputAmount:S=>g(S)}))},[w.formatted,d,c,u,p,R,g,C,G]),Me=_react.useCallback.call(void 0, ()=>{C(),z()},[C,z]),X=w.formatted?parseFloat(w.formatted):null,$e=!!(a||n),s=d,o=c,We=_optionalChain([s, 'optionalAccess', _2 => _2.price])&&a?`$${(s.price*a).toFixed(2)}`:"$0.00",Be=_optionalChain([o, 'optionalAccess', _3 => _3.price])&&n?`$${(o.price*n).toFixed(2)}`:"$0.00",Qe=!!(s&&o&&a&&n),Ue=Ne||Ce,Y=k==="trackingTx"&&!!A&&!!s&&!!o&&!!a&&!!n,W=he==="split",B=W&&(v==="baseSelection"||v==="quoteSelection"||v==="baseChainSelection"||v==="quoteChainSelection"),Q=v==="baseSelection"||v==="baseChainSelection"?"base":"quote",Ve=Q==="base"?o:s,Z=_react.useRef.call(void 0, null),[He,je]=_react.useState.call(void 0, 380);_react.useEffect.call(void 0, ()=>{if(!W)return;let i=Z.current;if(!i)return;let m=new ResizeObserver(S=>{for(let ze of S)je(ze.contentRect.height)});return m.observe(i),()=>m.disconnect()},[W]);let Ee=_react.useCallback.call(void 0, i=>{let S=_chunk537OMWA3cjs.c.getState().view==="baseChainSelection"?"base":"quote";_chunk537OMWA3cjs.c.getState().setChainFilter({chainId:i,side:S}),_chunk537OMWA3cjs.c.getState().pushRecentChain(i),_chunk537OMWA3cjs.c.getState().transitionToView(S==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),De=_react.useCallback.call(void 0, ()=>{let i=_chunk537OMWA3cjs.c.getState().view;i==="baseSelection"?_chunk537OMWA3cjs.c.getState().transitionToView("baseChainSelection","chainSelection"):i==="quoteSelection"&&_chunk537OMWA3cjs.c.getState().transitionToView("quoteChainSelection","chainSelection")},[]),ee={backgroundColor:q==="default"?"var(--widget-primary)":"transparent",color:q==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:q!=="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:Z,className:"flex flex-col flex-1 min-w-0",style:{borderRight:"1px solid var(--widget-border)"},children:[Y&&A&&s&&o&&a&&n?_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-h-0 overflow-hidden",children:_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.w,{orderHash:A,base:s,quote:o,baseAmount:a,quoteAmount:n,status:_})}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{className:`relative ${N?"px-4 pt-3 pb-1":"px-4 pt-4 pb-2"}`,style:{borderBottom:"1px solid var(--widget-border)"},children:[E?N?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${y==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.i,{toggle:M,side:"base",asset:s,isPlacingOrder:r||O}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.h,{side:"base",asset:_nullishCoalesce(s, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${y==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.i,{toggle:M,side:"base",asset:s,isPlacingOrder:r||O}),_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.h,{side:"base",asset:_nullishCoalesce(s, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.i,{toggle:M,side:"base",asset:s,isPlacingOrder:r||O}),_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.h,{side:"base",asset:_nullishCoalesce(s, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}),_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:"mono text-sm",style:{color:"var(--widget-muted-foreground)"},children:We}),x&&X!==null&&X>0&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Ie,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"})]})]}),!we&&_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center -my-4 relative z-10",children:_jsxruntime.jsxs.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 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, "span",{className:"text-2xs",children:"\u2191"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",children:"\u2193"})]})}),_jsxruntime.jsxs.call(void 0, "div",{className:`relative ${N?"px-4 pt-4 pb-1":"px-4 pt-6 pb-2"}`,children:[E?N?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${y==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.i,{toggle:$,side:"quote",asset:o,isPlacingOrder:r||T}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(s, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${y==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.i,{toggle:$,side:"quote",asset:o,isPlacingOrder:r||T}),_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(s, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.i,{toggle:$,side:"quote",asset:o,isPlacingOrder:r||T}),_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(s, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex w-full flex-row items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"mono text-sm",style:{color:"var(--widget-muted-foreground)"},children:Be}),$e&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Me,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:I?"1px solid var(--widget-border)":"none",maxHeight:I?"60px":"0px",opacity:I?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.j,{})}),_jsxruntime.jsx.call(void 0, "div",{className:`relative ${Y?"px-0":"px-4"} py-4`,children:x&&s&&o&&a&&a>0?_jsxruntime.jsx.call(void 0, _chunkNQ4QSGGFcjs.v,{base:s,baseAmount:a,quote:o,quoteAmount:_nullishCoalesce(n, () => (0)),userAddress:x,isWrappingPair:u,isUnwrappingPair:p,isBaseGasToken:Se,isQuoteGasToken:ye,reviewActionProps:Te,reviewState:k,setReviewState:Pe,trackedOrderHash:A,setTrackedOrderHash:J,onSwapComplete:fe,onSwapInitiated:xe,onOrderSubmitted:qe,onStaleQuoteRestart:Re,txStatus:_}):!x&&ve?_jsxruntime.jsx.call(void 0, "button",{onClick:()=>ke(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:ee,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:ee,children:x?"Enter Amount":"Connect Wallet"})})]}),_jsxruntime.jsx.call(void 0, "div",{className:`flex flex-col transition-all duration-300 ${B?"flex-1 min-w-0":"w-48 shrink-0"}`,style:{backgroundColor:"var(--widget-background)",...B?{height:`${He}px`}:{}},children:B?_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col overflow-hidden p-2",style:{height:"100%"},children:v==="baseChainSelection"||v==="quoteChainSelection"?_jsxruntime.jsx.call(void 0, _chunkC3X6NJIBcjs.a,{toggle:_nullishCoalesce(H, () => (ge)),side:Q,onChainSelect:Ee}):_jsxruntime.jsx.call(void 0, _chunkE44WNKS4cjs.a,{toggle:_nullishCoalesce(H, () => (ge)),side:Q,otherAsset:Ve,onMoreChainsClick:De,selectedChainFilter:Ae})}):_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"}),Qe&&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, _chunkBX3KCZRTcjs.P,{asset:o,size:"3xs",noChain:!0}),_jsxruntime.jsxs.call(void 0, "span",{className:"font-mono 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:["= ",K.toFixed(6)]})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-1 pl-4",children:[_jsxruntime.jsx.call(void 0, _chunkBX3KCZRTcjs.P,{asset:s,size:"3xs",noChain:!0}),_jsxruntime.jsx.call(void 0, "span",{className:"font-mono 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-mono text-xs",children:["$",s.price?(s.price*K*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-mono",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-mono",children:"Cross-chain"})]})]})]}):Ue?_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkBX3KCZRTcjs.X,{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((i,m)=>_jsxruntime.jsx.call(void 0, "div",{className:"h-3 rounded animate-pulse",style:{backgroundColor:"var(--widget-muted)",width:m%2===0?"80%":"60%",opacity:.5}},m)),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs mt-1",style:{color:"var(--widget-muted-foreground)",opacity:.5},children:"Enter an amount"})]})]})})]})},gt= exports.default =_e;exports.default = gt;
2
+ "use client";var _chunkMCT3UZTPcjs = require('./chunk-MCT3UZTP.cjs');var _chunkHTWUZKYOcjs = require('./chunk-HTWUZKYO.cjs');var _chunkXZRXVBSBcjs = require('./chunk-XZRXVBSB.cjs');require('./chunk-KH57FLST.cjs');var _chunkUZWGYG2Scjs = require('./chunk-UZWGYG2S.cjs');var _chunkLXEKOQAGcjs = require('./chunk-LXEKOQAG.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 ge=()=>{},_e=({onSwapComplete:fe,onSwapInitiated:xe,onBackToSwap:H,onMoreChainsClick:Je})=>{let{web3ConnectionType:Ke,hasConnectHandler:ve,lockBase:O,lockQuote:T,disableInverting:we,swapButtonVariant:q,tokenDisplay:j,tokenBadgeOrientation:y,widgetType:be,assetMenuVariant:he}=_chunkLXEKOQAGcjs.b.call(void 0, ),E=j==="pill"||j==="ghost",N=be==="compact",{baseToken:d,quoteToken:c,baseAmount:a,quoteAmount:n,isBaseGasToken:Se,isQuoteGasToken:ye,isWrappingPair:u,isUnwrappingPair:p,baseBalance:w,setBaseAmount:R,setQuoteAmount:g,swapTokens:D,clearForm:z}=_chunkUZWGYG2Scjs.f.call(void 0, ),{handleInputChange:F,ensureForParams:G,clear:C,refresh:L,liquidityError:Ne,routingError:Ce}=_chunkMCT3UZTPcjs.e.call(void 0, ),{address:x}=_chunk34N36GUDcjs.a.call(void 0, ),{openConnectModal:ke}=_chunkMCT3UZTPcjs.g.call(void 0, ),{isRecipientInputOpen:I,txStatus:_,view:v,selectedChainFilterChainId:Ae}=_chunkUZWGYG2Scjs.c.call(void 0, _shallow.useShallow.call(void 0, i=>({isRecipientInputOpen:i.isRecipientInputOpen,txStatus:i.txStatus,view:i.view,selectedChainFilterChainId:_nullishCoalesce(i.selectedChainFilterChainId, () => (null))}))),[k,Pe]=_react.useState.call(void 0, null),[A,J]=_react.useState.call(void 0, null),Oe=_react.useRef.call(void 0, !1),r=!1,Te=_react.useMemo.call(void 0, ()=>!d||!c||typeof a!="number"||!n||!x||parseFloat(w.formatted)<a?null:{base:d,quote:c,baseAmount:a,quoteAmount:n,userAddress:x},[d,c,a,n,x,w.formatted]),qe=_react.useCallback.call(void 0, i=>{J(i),_chunkUZWGYG2Scjs.c.getState().startTracking(i)},[]),Re=_react.useCallback.call(void 0, ()=>{Oe.current=!0,L()},[L]);_react.useEffect.call(void 0, ()=>{if(k===null&&!(!d||!c)){if(!a||a<=0){F({amount:null,inputToken:d,outputToken:c,setOutputAmount:g});return}if(u||p){g(a);return}F({amount:a,inputToken:d,outputToken:c,setOutputAmount:g})}},[k,a,d,c,u,p,F,g]);let K=a&&n&&parseFloat(n.toString())?parseFloat(a.toString())/parseFloat(n.toString()):0,M=_react.useCallback.call(void 0, ()=>{_chunkUZWGYG2Scjs.c.getState().setView("baseSelection")},[]),$=_react.useCallback.call(void 0, ()=>{_chunkUZWGYG2Scjs.c.getState().setView("quoteSelection")},[]),Fe=_react.useCallback.call(void 0, ()=>{D(),g(null)},[D,g]),Ie=_react.useCallback.call(void 0, ()=>{if(!w.formatted||!d||!c)return;let i=parseFloat(w.formatted);if(!i||i<=0)return;let m=i*.9999999999;u||p?(R(m),g(m),C()):(R(m),g(null),G({inputToken:d,outputToken:c,inputAmount:m.toString(),setOutputAmount:S=>g(S)}))},[w.formatted,d,c,u,p,R,g,C,G]),Me=_react.useCallback.call(void 0, ()=>{C(),z()},[C,z]),X=w.formatted?parseFloat(w.formatted):null,$e=!!(a||n),s=d,o=c,We=_optionalChain([s, 'optionalAccess', _2 => _2.price])&&a?`$${(s.price*a).toFixed(2)}`:"$0.00",Be=_optionalChain([o, 'optionalAccess', _3 => _3.price])&&n?`$${(o.price*n).toFixed(2)}`:"$0.00",Qe=!!(s&&o&&a&&n),Ue=Ne||Ce,Y=k==="trackingTx"&&!!A&&!!s&&!!o&&!!a&&!!n,W=he==="split",B=W&&(v==="baseSelection"||v==="quoteSelection"||v==="baseChainSelection"||v==="quoteChainSelection"),Q=v==="baseSelection"||v==="baseChainSelection"?"base":"quote",Ve=Q==="base"?o:s,Z=_react.useRef.call(void 0, null),[He,je]=_react.useState.call(void 0, 380);_react.useEffect.call(void 0, ()=>{if(!W)return;let i=Z.current;if(!i)return;let m=new ResizeObserver(S=>{for(let ze of S)je(ze.contentRect.height)});return m.observe(i),()=>m.disconnect()},[W]);let Ee=_react.useCallback.call(void 0, i=>{let S=_chunkUZWGYG2Scjs.c.getState().view==="baseChainSelection"?"base":"quote";_chunkUZWGYG2Scjs.c.getState().setChainFilter({chainId:i,side:S}),_chunkUZWGYG2Scjs.c.getState().pushRecentChain(i),_chunkUZWGYG2Scjs.c.getState().transitionToView(S==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),De=_react.useCallback.call(void 0, ()=>{let i=_chunkUZWGYG2Scjs.c.getState().view;i==="baseSelection"?_chunkUZWGYG2Scjs.c.getState().transitionToView("baseChainSelection","chainSelection"):i==="quoteSelection"&&_chunkUZWGYG2Scjs.c.getState().transitionToView("quoteChainSelection","chainSelection")},[]),ee={backgroundColor:q==="default"?"var(--widget-primary)":"transparent",color:q==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:q!=="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:Z,className:"flex flex-col flex-1 min-w-0",style:{borderRight:"1px solid var(--widget-border)"},children:[Y&&A&&s&&o&&a&&n?_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-h-0 overflow-hidden",children:_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.w,{orderHash:A,base:s,quote:o,baseAmount:a,quoteAmount:n,status:_})}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{className:`relative ${N?"px-4 pt-3 pb-1":"px-4 pt-4 pb-2"}`,style:{borderBottom:"1px solid var(--widget-border)"},children:[E?N?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${y==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.i,{toggle:M,side:"base",asset:s,isPlacingOrder:r||O}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.h,{side:"base",asset:_nullishCoalesce(s, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${y==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.i,{toggle:M,side:"base",asset:s,isPlacingOrder:r||O}),_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.h,{side:"base",asset:_nullishCoalesce(s, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.i,{toggle:M,side:"base",asset:s,isPlacingOrder:r||O}),_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.h,{side:"base",asset:_nullishCoalesce(s, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}),_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:"mono text-sm",style:{color:"var(--widget-muted-foreground)"},children:We}),x&&X!==null&&X>0&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Ie,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"})]})]}),!we&&_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center -my-4 relative z-10",children:_jsxruntime.jsxs.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 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, "span",{className:"text-2xs",children:"\u2191"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",children:"\u2193"})]})}),_jsxruntime.jsxs.call(void 0, "div",{className:`relative ${N?"px-4 pt-4 pb-1":"px-4 pt-6 pb-2"}`,children:[E?N?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${y==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.i,{toggle:$,side:"quote",asset:o,isPlacingOrder:r||T}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(s, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${y==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.i,{toggle:$,side:"quote",asset:o,isPlacingOrder:r||T}),_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(s, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.i,{toggle:$,side:"quote",asset:o,isPlacingOrder:r||T}),_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(s, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex w-full flex-row items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"mono text-sm",style:{color:"var(--widget-muted-foreground)"},children:Be}),$e&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Me,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:I?"1px solid var(--widget-border)":"none",maxHeight:I?"60px":"0px",opacity:I?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.j,{})}),_jsxruntime.jsx.call(void 0, "div",{className:`relative ${Y?"px-0":"px-4"} py-4`,children:x&&s&&o&&a&&a>0?_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.v,{base:s,baseAmount:a,quote:o,quoteAmount:_nullishCoalesce(n, () => (0)),userAddress:x,isWrappingPair:u,isUnwrappingPair:p,isBaseGasToken:Se,isQuoteGasToken:ye,reviewActionProps:Te,reviewState:k,setReviewState:Pe,trackedOrderHash:A,setTrackedOrderHash:J,onSwapComplete:fe,onSwapInitiated:xe,onOrderSubmitted:qe,onStaleQuoteRestart:Re,txStatus:_}):!x&&ve?_jsxruntime.jsx.call(void 0, "button",{onClick:()=>ke(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:ee,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:ee,children:x?"Enter Amount":"Connect Wallet"})})]}),_jsxruntime.jsx.call(void 0, "div",{className:`flex flex-col transition-all duration-300 ${B?"flex-1 min-w-0":"w-48 shrink-0"}`,style:{backgroundColor:"var(--widget-background)",...B?{height:`${He}px`}:{}},children:B?_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col overflow-hidden p-2",style:{height:"100%"},children:v==="baseChainSelection"||v==="quoteChainSelection"?_jsxruntime.jsx.call(void 0, _chunkXZRXVBSBcjs.a,{toggle:_nullishCoalesce(H, () => (ge)),side:Q,onChainSelect:Ee}):_jsxruntime.jsx.call(void 0, _chunkHTWUZKYOcjs.a,{toggle:_nullishCoalesce(H, () => (ge)),side:Q,otherAsset:Ve,onMoreChainsClick:De,selectedChainFilter:Ae})}):_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"}),Qe&&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, _chunkLXEKOQAGcjs.P,{asset:o,size:"3xs",noChain:!0}),_jsxruntime.jsxs.call(void 0, "span",{className:"font-mono 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:["= ",K.toFixed(6)]})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-1 pl-4",children:[_jsxruntime.jsx.call(void 0, _chunkLXEKOQAGcjs.P,{asset:s,size:"3xs",noChain:!0}),_jsxruntime.jsx.call(void 0, "span",{className:"font-mono 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-mono text-xs",children:["$",s.price?(s.price*K*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-mono",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-mono",children:"Cross-chain"})]})]})]}):Ue?_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkLXEKOQAGcjs.X,{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((i,m)=>_jsxruntime.jsx.call(void 0, "div",{className:"h-3 rounded animate-pulse",style:{backgroundColor:"var(--widget-muted)",width:m%2===0?"80%":"60%",opacity:.5}},m)),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs mt-1",style:{color:"var(--widget-muted-foreground)",opacity:.5},children:"Enter an amount"})]})]})})]})},gt= exports.default =_e;exports.default = gt;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use client";import{a as ve}from"./chunk-OPN7WCJR.js";import{c as E,f as se}from"./chunk-JSWDMAZQ.js";import{F as Z,H as Q,I as X,L as J,O as Y,P as M,R as ee,S as te,_ as re,b as G,e as V,h as _,k as R,q,r as K}from"./chunk-CHDFHEPH.js";import{a as B}from"./chunk-46H44R7V.js";import{b as ge}from"./chunk-73CB2I7U.js";import{useCallback as Me,useState as He}from"react";import{useDisconnect as Be}from"wagmi";import{useCallback as ye,useEffect as we,useMemo as D,useRef as he}from"react";function oe(e){let{address:s,isConnected:n}=B(),{chainDataMap:c}=X(),m=re(),{getToken:v,tokenRegistry:f}=Z(),{supportedInputTokens:p,supportedOutputTokens:w}=G(),l=D(()=>{if(!p.length&&!w.length)return[];let t=new Set,o=[];for(let x of[...p,...w]){let S=`${x.chainId}-${x.address.toLowerCase()}`;t.has(S)||(t.add(S),o.push(x))}return o},[p,w]),{balances:u,isLoading:d,isError:i,refetch:h}=J(s,m,{enabled:n&&e&&!!s,refetchOnWindowFocus:!1},l.length>0?l:void 0),L=D(()=>l.length?new Set(l.map(t=>`${t.chainId}-${t.address.toLowerCase()}`)):null,[l]),r=D(()=>!u||u.length===0?{}:u.filter(o=>!o.assetInfo||!o.balance||o.balance==="0"?!1:L?L.has(`${o.chainId}-${o.address.toLowerCase()}`):R(o.assetInfo)||f.length===0?!0:f.some(x=>x.address.toLowerCase()===o.address.toLowerCase()&&x.chainId===o.chainId)).reduce((o,x)=>{let S=String(x.chainId);return o[S]||(o[S]=[]),o[S].push({token:x.address,amount:x.balance,decimals:x.decimals,assetInfo:x.assetInfo}),o},{}),[u,f,L]),k=D(()=>!u||u.length===0?0:u.reduce((t,o)=>!o.assetInfo||o.decimals===void 0?t:t+parseFloat(o.balance)/10**o.decimals*(o.assetInfo.price||0),0),[u]),T=D(()=>m.length===0?{}:m.reduce((t,o)=>{let x=c[o],S=V(o);return t[o.toString()]={chainId:o,name:S?.displayName||x?.chainKey||`Chain ${o}`},t},{}),[m,c]),W=D(()=>f.map(t=>({address:t.address,chainId:t.chainId})),[f]),N=he(null);we(()=>()=>{N.current&&clearTimeout(N.current)},[]);let A=ye(()=>{N.current&&clearTimeout(N.current),N.current=setTimeout(()=>h(),2e3)},[h]);return{address:s,isConnected:n,groupedAssets:r,totalBalance:k,balancesLoading:d,balancesError:i,chains:T,getToken:v,useTokenWithLazyLoad:Q,tokenRegistry:W,refetchBalances:A}}var ae=ge(ve(),1);import{jsx as I,jsxs as $}from"react/jsx-runtime";var ne=({address:e,totalBalance:s,isLoading:n=!1})=>{let c=m=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(m);return I("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:[I("img",{className:"w-full h-full object-cover opacity-60",src:(0,ae.makeGradient)(e),alt:"address gradient"}),I("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:[I("p",{className:"text-2xs uppercase mono",style:{color:"var(--widget-muted-foreground)",opacity:.7},children:"Token Balance:"}),n?I(te,{className:"h-8 w-28 bg-white/10 rounded mt-1"}):I("p",{className:"text-2xl font-bold mt-0.5",style:{color:"var(--widget-foreground)"},children:c(s)})]}),I("div",{className:"flex items-center",children:I(ee,{text:e,type:"address",children:I("p",{className:"mono text-2xs",style:{color:"var(--widget-foreground)",opacity:.7},children:e})})})]})]})})};import{useCallback as j,useMemo as le,useState as ke}from"react";import{useState as xe}from"react";import{jsx as H,jsxs as U}from"react/jsx-runtime";var ie=({asset:e,balanceAmount:s,balanceDecimals:n,price:c,onSelect:m,getToken:v,useTokenWithLazyLoad:f})=>{let[p,w]=xe(!1),l=n!==void 0?parseFloat(s)/10**n:0,d=f?.(e.chainId,e.address)?.token,i=c??null;return R(e)&&i==null&&(d?.price!=null?i=d.price:v&&(i=v(e.chainId,e.address)?.price??null)),H("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:p?"var(--widget-secondary)":"transparent"},onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),onClick:()=>m?.(e),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),m?.(e))},children:U("div",{className:"flex h-full w-full flex-row items-center justify-between",children:[U("div",{className:"flex h-full flex-row items-center gap-2",children:[H(M,{asset:e,size:"sm"}),U("div",{className:"flex flex-col items-start",children:[H("p",{className:"text-sm font-medium uppercase",style:{color:"var(--widget-foreground)"},children:e.symbol}),l>0&&H("p",{className:"mono text-xs",style:{color:"var(--widget-muted-foreground)"},children:l.toFixed(4)})]})]}),H("p",{className:"text-sm font-medium",style:{color:"var(--widget-foreground)"},children:i!=null?`$${(i*l).toFixed(2)}`:"\u2014"})]})})};import{jsx as C,jsxs as z}from"react/jsx-runtime";var be=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}),Ne=_(),de=({groupedAssets:e,chains:s,tokenRegistry:n=[],getToken:c,useTokenWithLazyLoad:m,onAssetSelect:v})=>{let[f,p]=ke(new Set),w=j(r=>s?.[r]?.name||Ne[r]||`Chain ${r}`,[s]),l=le(()=>{let r=new Set;for(let k of n)r.add(`${k.chainId}-${k.address.toLowerCase()}`);return r},[n]),u=j(r=>r.decimals===void 0||!r.assetInfo?.price?0:parseFloat(r.amount)/10**r.decimals*r.assetInfo.price,[]),{filteredGroupedAssets:d,chainTotals:i}=le(()=>{let r=Object.entries(e).map(([W,N])=>{let A=N.filter(t=>t.assetInfo?R(t.assetInfo)?!0:l.size>0?l.has(`${t.assetInfo.chainId}-${t.assetInfo.address?.toLowerCase()??""}`):!0:!1);return[W,A]}).filter(([,W])=>W.length>0),k={};for(let[W,N]of r)k[W]=N.reduce((A,t)=>A+u(t),0);return{filteredGroupedAssets:[...r].sort((W,N)=>(k[N[0]]??0)-(k[W[0]]??0)),chainTotals:k}},[e,l,u]),h=j(r=>{p(k=>{let T=new Set(k);return T.has(r)?T.delete(r):T.add(r),T})},[]),L=r=>be.format(r);return d.length===0?C("div",{className:"flex items-center justify-center p-6",children:C("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"No token balances found"})}):C("div",{className:"pb-2 pt-1",children:d.map(([r,k])=>{let T=parseInt(r),W=w(T),N=i[r]||0,A=f.has(r);return z("div",{className:"mx-2 mb-2",style:{border:"1px var(--widget-border-style) var(--widget-border)",borderRadius:"var(--widget-radius)",overflow:"hidden"},children:[z("button",{type:"button",onClick:()=>h(r),className:"flex w-full flex-row items-center justify-between p-2 cursor-pointer transition-colors hover:bg-(--widget-secondary)",style:{backgroundColor:"transparent"},children:[z("div",{className:"inline-flex flex-row items-center gap-2",children:[C(Y,{chain:T,size:"sm"}),C("p",{className:"text-sm font-medium capitalize",style:{color:"var(--widget-foreground)"},children:W})]}),z("div",{className:"flex items-center gap-2",children:[C("p",{className:"text-sm font-semibold",style:{color:"var(--widget-foreground)"},children:L(N)}),C("span",{className:`transition-transform duration-200 ${A?"rotate-180":""}`,style:{color:"var(--widget-muted-foreground)"},children:C("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:C("path",{d:"M2.5 4.5L6 8L9.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),C("div",{className:`overflow-hidden transition-all duration-200 ease-out ${A?"max-h-[2000px] opacity-100":"max-h-0 opacity-0"}`,children:C("div",{style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:k.map(t=>t.assetInfo?C(ie,{asset:t.assetInfo,balanceAmount:t.amount,balanceDecimals:t.decimals,price:t.assetInfo?.price??null,onSelect:v,getToken:c,useTokenWithLazyLoad:m},`${t.assetInfo.chainId}-${t.token}`):null)})})]},r)})})};import{useCallback as Se,useRef as Re,useState as De}from"react";function ce(e,s){return{orders:[],isLoading:!1,error:null,hasMore:!1,loadMore:async()=>{},totalOrders:0}}import{useState as Ce}from"react";import{jsx as a,jsxs as b}from"react/jsx-runtime";var We=()=>b("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[a("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),a("path",{d:"M3 5.2L4.3 6.5L7 3.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Te=()=>b("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[a("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),a("path",{d:"M3.5 3.5L6.5 6.5M6.5 3.5L3.5 6.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),Le=()=>b("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[a("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),a("path",{d:"M5 3V5.5L6.5 6.5",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"})]}),ue=()=>b("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[a("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),a("circle",{cx:"5",cy:"5",r:"1.5",fill:"currentColor"})]}),Ie=e=>{switch((e||"").toLowerCase()){case"completed":case"settled":case"success":case"swapped":case"swap":return{icon:a(We,{}),color:"var(--widget-primary)"};case"received":return{icon:a(ue,{}),color:"var(--widget-accent)"};case"failed":case"error":case"expired":return{icon:a(Te,{}),color:"var(--widget-destructive)"};case"pending":case"created":case"placed":return{icon:a(Le,{}),color:"var(--widget-muted-foreground)"};default:return{icon:a(ue,{}),color:"var(--widget-muted-foreground)"}}},Ae=e=>{switch((e||"").toLowerCase()){case"completed":case"settled":case"success":case"swapped":case"swap":return"color-mix(in srgb, var(--widget-primary) 5%, transparent)";case"failed":case"error":case"expired":return"color-mix(in srgb, var(--widget-destructive) 5%, transparent)";case"pending":case"created":case"placed":return"color-mix(in srgb, var(--widget-accent) 5%, transparent)";default:return"var(--widget-secondary)"}},P=(e,s)=>{try{let n=parseFloat(e||"0");if(isNaN(n)||n===0)return"0";let c=s?.decimals??18;return q(n/10**c)}catch{return"0"}},me=({order:e,baseToken:s,quoteToken:n})=>{let[c,m]=Ce(!1),v=e?.status||e?.eventType||"unknown",{icon:f,color:p}=Ie(v),l=(i=>{if(!i)return{date:"",time:""};let h=new Date(typeof i=="number"?i:Number(i)||i);return{date:h.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),time:h.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",timeZone:"UTC",hour12:!1})+" UTC"}})(e?.timestamp||e?.createdAt||""),u=s?{asset:s,symbol:s.symbol,amount:P(e?.inputAmount,s)}:{asset:null,symbol:(e?.inputToken||"").slice(0,6)+"...",amount:P(e?.inputAmount,null)},d=n?{asset:n,symbol:n.symbol,amount:P(e?.outputAmount,n)}:{asset:null,symbol:(e?.outputToken||"").slice(0,6)+"...",amount:P(e?.outputAmount,null)};return b("a",{href:e?.explorerUrl||"#",target:"_blank",rel:"noopener noreferrer",className:"group flex flex-col cursor-pointer transition-all duration-200 ease-in-out no-underline",style:{border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:c?Ae(v):"transparent",marginBottom:"0.5rem",padding:"0.25rem"},onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),children:[b("div",{className:"flex flex-row items-center justify-between space-x-1",children:[b("div",{className:"flex flex-row items-center space-x-1",children:[a("div",{className:"-translate-y-px",style:{color:p},children:f}),a("p",{className:"text-2xs mono uppercase",style:{color:p},children:v})]}),b("div",{className:"flex flex-row items-center space-x-2",children:[b("span",{className:"text-2xs mono",style:{color:c?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:["\xAC ",K(e?.quoteId||e?.orderHash||"")]}),a("svg",{className:"w-2.5 -translate-y-px opacity-70 group-hover:rotate-[-45deg] group-hover:opacity-100 duration-200",style:{color:"var(--widget-foreground)"},viewBox:"0 0 684 684",fill:"none",children:a("path",{d:"M0.666687 384.667L519.92 384.667L281.627 622.96L342 683.333L683.333 342L342 0.666687L281.627 61.04L519.92 299.333L0.666687 299.333V384.667Z",fill:"currentColor"})})]})]}),b("div",{className:"flex flex-row items-center justify-between pr-2",style:{backgroundColor:c?"transparent":"var(--widget-secondary)"},children:[a("div",{className:"flex flex-col w-full h-full p-2",children:a("div",{className:"flex h-8 w-full items-center justify-between px-2",children:b("div",{className:"flex items-center space-x-1",children:[a(M,{asset:u.asset,size:"xs",className:"h-3 w-3"}),b("div",{className:"flex flex-col",children:[a("span",{className:"text-sm h-4",style:{color:"var(--widget-muted-foreground)"},children:u.amount}),a("span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:u.symbol})]}),a("span",{className:"px-1",style:{color:"var(--widget-muted-foreground)"},children:"\u2192"}),a(M,{asset:d.asset,size:"xs",className:"h-3 w-3"}),b("div",{className:"flex flex-col",children:[a("span",{className:"text-sm h-4",style:{color:"var(--widget-muted-foreground)"},children:d.amount}),a("span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:d.symbol})]})]})})}),b("div",{className:"flex flex-col items-end text-right shrink-0",children:[a("span",{className:"text-2xs mono whitespace-nowrap",style:{color:"var(--widget-muted-foreground)"},children:l.date}),l.time&&a("span",{className:"text-2xs mono whitespace-nowrap",style:{color:"var(--widget-muted-foreground)",opacity:.6},children:l.time})]})]})]})};import{Fragment as Fe,jsx as y,jsxs as O}from"react/jsx-runtime";var fe=()=>O("div",{className:"mt-2 flex flex-col",style:{height:"4rem",border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:"var(--widget-secondary)"},children:[O("div",{className:"flex items-center space-x-2 p-2",children:[y("div",{className:"h-4 w-4 rounded",style:{backgroundColor:"var(--widget-muted)"}}),y("div",{className:"h-3 w-24 rounded",style:{backgroundColor:"var(--widget-muted)"}})]}),O("div",{className:"flex h-8 w-full items-center justify-between px-4",children:[y("div",{className:"flex items-center space-x-1",children:[4,16,10,4,16,10].map((e,s)=>y("div",{className:"h-3 rounded",style:{width:`${e*4}px`,backgroundColor:"var(--widget-muted)"}},s))}),y("div",{className:"h-3 w-10 rounded",style:{backgroundColor:"var(--widget-muted)"}})]})]}),pe=({isActive:e})=>{let{address:s}=B(),{orders:n,isLoading:c,error:m,hasMore:v,loadMore:f}=ce(s,e),[p,w]=De(!1),l=Re(null),u=Se(async d=>{let i=d.currentTarget;if(i.scrollTop+i.clientHeight>=i.scrollHeight-100&&!c&&!p&&v){w(!0);try{await f()}finally{w(!1)}}},[c,p,v,f]);return s?m?y("div",{className:"flex items-center justify-center p-4",children:y("p",{className:"text-sm",style:{color:"var(--widget-destructive)"},children:"Error loading activity"})}):y("div",{ref:l,className:"flex flex-col flex-1 min-h-0 overflow-y-auto p-2",onScroll:u,style:{backgroundColor:"transparent"},children:c?Array.from({length:5}).map((d,i)=>y(fe,{},i)):n.length===0?y("div",{className:"flex flex-col items-center justify-center h-full p-6",children:y("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"No Activity"})}):O(Fe,{children:[n.map(d=>y(me,{order:d,baseToken:d.enrichedTokens?.base??null,quoteToken:d.enrichedTokens?.quote??null},d.orderHash)),p&&y(fe,{})]})}):y("div",{className:"flex items-center justify-center p-4",children:y("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Connect your wallet to view activity"})})};import{Fragment as $e,jsx as g,jsxs as F}from"react/jsx-runtime";var Ee=()=>F("div",{className:"flex flex-col w-full h-full overflow-hidden",children:[g("div",{className:"p-2 w-full flex justify-center",children:g("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)"}})}),g("div",{className:"px-2 flex flex-col gap-1.5 mt-1",children:[80,60,72,55,65].map((e,s)=>F("div",{className:"flex items-center justify-between py-1.5",children:[F("div",{className:"flex items-center gap-2",children:[g("div",{className:"h-6 w-6 rounded-full animate-pulse shrink-0",style:{backgroundColor:"var(--widget-secondary)"}}),g("div",{className:"h-3.5 animate-pulse",style:{width:`${e}px`,backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}})]}),g("div",{className:"h-3.5 w-14 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}})]},s))}),g("div",{className:"mt-auto shrink-0 p-2",style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:g("div",{className:"w-full animate-pulse",style:{height:"34px",backgroundColor:"var(--widget-secondary)",opacity:.35,borderRadius:"var(--widget-radius)"}})})]}),It=()=>{let e=E(L=>L.walletTab),[s,n]=He(!1),{disconnect:c}=Be(),{setQuoteToken:m}=se(),v=Me(async L=>{await m(L),E.getState().setView("swap")},[m]),{address:f,groupedAssets:p,totalBalance:w,balancesLoading:l,chains:u,getToken:d,useTokenWithLazyLoad:i,tokenRegistry:h}=oe(!0);return f?l&&e==="wallet"?g(Ee,{}):F("div",{className:"flex flex-col w-full h-full overflow-hidden",children:[F("div",{className:"flex-1 overflow-y-auto",style:{minHeight:0},children:[e==="wallet"&&F($e,{children:[g(ne,{address:f,totalBalance:w,isLoading:l}),g(de,{groupedAssets:p,chains:u,tokenRegistry:h,getToken:d,useTokenWithLazyLoad:i,onAssetSelect:v})]}),e==="activity"&&g(pe,{isActive:e==="activity"})]}),g("div",{className:"shrink-0 p-2",style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:g("button",{type:"button",onClick:()=>{c(),E.getState().setView("swap")},onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),className:"w-full py-2 text-xs mono uppercase cursor-pointer transition-colors",style:{backgroundColor:s?"var(--widget-destructive)":"transparent",color:s?"var(--widget-destructive-foreground)":"var(--widget-destructive)",border:"1px var(--widget-border-style) var(--widget-destructive)",borderRadius:"var(--widget-radius)"},children:"Sign Out"})})]}):g("div",{className:"flex flex-col items-center justify-center h-full p-4",children:g("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Connect your wallet to view your portfolio"})})};export{It as WidgetWalletPanel};
2
+ "use client";import{a as ve}from"./chunk-OPN7WCJR.js";import{c as E,f as se}from"./chunk-726CI6GC.js";import{F as Z,H as Q,I as X,L as J,O as Y,P as M,R as ee,S as te,_ as re,b as G,e as V,h as _,k as R,q,r as K}from"./chunk-EW2OR6CJ.js";import{a as B}from"./chunk-46H44R7V.js";import{b as ge}from"./chunk-73CB2I7U.js";import{useCallback as Me,useState as He}from"react";import{useDisconnect as Be}from"wagmi";import{useCallback as ye,useEffect as we,useMemo as D,useRef as he}from"react";function oe(e){let{address:s,isConnected:n}=B(),{chainDataMap:c}=X(),m=re(),{getToken:v,tokenRegistry:f}=Z(),{supportedInputTokens:p,supportedOutputTokens:w}=G(),l=D(()=>{if(!p.length&&!w.length)return[];let t=new Set,o=[];for(let x of[...p,...w]){let S=`${x.chainId}-${x.address.toLowerCase()}`;t.has(S)||(t.add(S),o.push(x))}return o},[p,w]),{balances:u,isLoading:d,isError:i,refetch:h}=J(s,m,{enabled:n&&e&&!!s,refetchOnWindowFocus:!1},l.length>0?l:void 0),L=D(()=>l.length?new Set(l.map(t=>`${t.chainId}-${t.address.toLowerCase()}`)):null,[l]),r=D(()=>!u||u.length===0?{}:u.filter(o=>!o.assetInfo||!o.balance||o.balance==="0"?!1:L?L.has(`${o.chainId}-${o.address.toLowerCase()}`):R(o.assetInfo)||f.length===0?!0:f.some(x=>x.address.toLowerCase()===o.address.toLowerCase()&&x.chainId===o.chainId)).reduce((o,x)=>{let S=String(x.chainId);return o[S]||(o[S]=[]),o[S].push({token:x.address,amount:x.balance,decimals:x.decimals,assetInfo:x.assetInfo}),o},{}),[u,f,L]),k=D(()=>!u||u.length===0?0:u.reduce((t,o)=>!o.assetInfo||o.decimals===void 0?t:t+parseFloat(o.balance)/10**o.decimals*(o.assetInfo.price||0),0),[u]),T=D(()=>m.length===0?{}:m.reduce((t,o)=>{let x=c[o],S=V(o);return t[o.toString()]={chainId:o,name:S?.displayName||x?.chainKey||`Chain ${o}`},t},{}),[m,c]),W=D(()=>f.map(t=>({address:t.address,chainId:t.chainId})),[f]),N=he(null);we(()=>()=>{N.current&&clearTimeout(N.current)},[]);let A=ye(()=>{N.current&&clearTimeout(N.current),N.current=setTimeout(()=>h(),2e3)},[h]);return{address:s,isConnected:n,groupedAssets:r,totalBalance:k,balancesLoading:d,balancesError:i,chains:T,getToken:v,useTokenWithLazyLoad:Q,tokenRegistry:W,refetchBalances:A}}var ae=ge(ve(),1);import{jsx as I,jsxs as $}from"react/jsx-runtime";var ne=({address:e,totalBalance:s,isLoading:n=!1})=>{let c=m=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(m);return I("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:[I("img",{className:"w-full h-full object-cover opacity-60",src:(0,ae.makeGradient)(e),alt:"address gradient"}),I("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:[I("p",{className:"text-2xs uppercase mono",style:{color:"var(--widget-muted-foreground)",opacity:.7},children:"Token Balance:"}),n?I(te,{className:"h-8 w-28 bg-white/10 rounded mt-1"}):I("p",{className:"text-2xl font-bold mt-0.5",style:{color:"var(--widget-foreground)"},children:c(s)})]}),I("div",{className:"flex items-center",children:I(ee,{text:e,type:"address",children:I("p",{className:"mono text-2xs",style:{color:"var(--widget-foreground)",opacity:.7},children:e})})})]})]})})};import{useCallback as j,useMemo as le,useState as ke}from"react";import{useState as xe}from"react";import{jsx as H,jsxs as U}from"react/jsx-runtime";var ie=({asset:e,balanceAmount:s,balanceDecimals:n,price:c,onSelect:m,getToken:v,useTokenWithLazyLoad:f})=>{let[p,w]=xe(!1),l=n!==void 0?parseFloat(s)/10**n:0,d=f?.(e.chainId,e.address)?.token,i=c??null;return R(e)&&i==null&&(d?.price!=null?i=d.price:v&&(i=v(e.chainId,e.address)?.price??null)),H("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:p?"var(--widget-secondary)":"transparent"},onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),onClick:()=>m?.(e),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),m?.(e))},children:U("div",{className:"flex h-full w-full flex-row items-center justify-between",children:[U("div",{className:"flex h-full flex-row items-center gap-2",children:[H(M,{asset:e,size:"sm"}),U("div",{className:"flex flex-col items-start",children:[H("p",{className:"text-sm font-medium uppercase",style:{color:"var(--widget-foreground)"},children:e.symbol}),l>0&&H("p",{className:"mono text-xs",style:{color:"var(--widget-muted-foreground)"},children:l.toFixed(4)})]})]}),H("p",{className:"text-sm font-medium",style:{color:"var(--widget-foreground)"},children:i!=null?`$${(i*l).toFixed(2)}`:"\u2014"})]})})};import{jsx as C,jsxs as z}from"react/jsx-runtime";var be=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}),Ne=_(),de=({groupedAssets:e,chains:s,tokenRegistry:n=[],getToken:c,useTokenWithLazyLoad:m,onAssetSelect:v})=>{let[f,p]=ke(new Set),w=j(r=>s?.[r]?.name||Ne[r]||`Chain ${r}`,[s]),l=le(()=>{let r=new Set;for(let k of n)r.add(`${k.chainId}-${k.address.toLowerCase()}`);return r},[n]),u=j(r=>r.decimals===void 0||!r.assetInfo?.price?0:parseFloat(r.amount)/10**r.decimals*r.assetInfo.price,[]),{filteredGroupedAssets:d,chainTotals:i}=le(()=>{let r=Object.entries(e).map(([W,N])=>{let A=N.filter(t=>t.assetInfo?R(t.assetInfo)?!0:l.size>0?l.has(`${t.assetInfo.chainId}-${t.assetInfo.address?.toLowerCase()??""}`):!0:!1);return[W,A]}).filter(([,W])=>W.length>0),k={};for(let[W,N]of r)k[W]=N.reduce((A,t)=>A+u(t),0);return{filteredGroupedAssets:[...r].sort((W,N)=>(k[N[0]]??0)-(k[W[0]]??0)),chainTotals:k}},[e,l,u]),h=j(r=>{p(k=>{let T=new Set(k);return T.has(r)?T.delete(r):T.add(r),T})},[]),L=r=>be.format(r);return d.length===0?C("div",{className:"flex items-center justify-center p-6",children:C("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"No token balances found"})}):C("div",{className:"pb-2 pt-1",children:d.map(([r,k])=>{let T=parseInt(r),W=w(T),N=i[r]||0,A=f.has(r);return z("div",{className:"mx-2 mb-2",style:{border:"1px var(--widget-border-style) var(--widget-border)",borderRadius:"var(--widget-radius)",overflow:"hidden"},children:[z("button",{type:"button",onClick:()=>h(r),className:"flex w-full flex-row items-center justify-between p-2 cursor-pointer transition-colors hover:bg-(--widget-secondary)",style:{backgroundColor:"transparent"},children:[z("div",{className:"inline-flex flex-row items-center gap-2",children:[C(Y,{chain:T,size:"sm"}),C("p",{className:"text-sm font-medium capitalize",style:{color:"var(--widget-foreground)"},children:W})]}),z("div",{className:"flex items-center gap-2",children:[C("p",{className:"text-sm font-semibold",style:{color:"var(--widget-foreground)"},children:L(N)}),C("span",{className:`transition-transform duration-200 ${A?"rotate-180":""}`,style:{color:"var(--widget-muted-foreground)"},children:C("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:C("path",{d:"M2.5 4.5L6 8L9.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),C("div",{className:`overflow-hidden transition-all duration-200 ease-out ${A?"max-h-[2000px] opacity-100":"max-h-0 opacity-0"}`,children:C("div",{style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:k.map(t=>t.assetInfo?C(ie,{asset:t.assetInfo,balanceAmount:t.amount,balanceDecimals:t.decimals,price:t.assetInfo?.price??null,onSelect:v,getToken:c,useTokenWithLazyLoad:m},`${t.assetInfo.chainId}-${t.token}`):null)})})]},r)})})};import{useCallback as Se,useRef as Re,useState as De}from"react";function ce(e,s){return{orders:[],isLoading:!1,error:null,hasMore:!1,loadMore:async()=>{},totalOrders:0}}import{useState as Ce}from"react";import{jsx as a,jsxs as b}from"react/jsx-runtime";var We=()=>b("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[a("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),a("path",{d:"M3 5.2L4.3 6.5L7 3.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Te=()=>b("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[a("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),a("path",{d:"M3.5 3.5L6.5 6.5M6.5 3.5L3.5 6.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),Le=()=>b("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[a("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),a("path",{d:"M5 3V5.5L6.5 6.5",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"})]}),ue=()=>b("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[a("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),a("circle",{cx:"5",cy:"5",r:"1.5",fill:"currentColor"})]}),Ie=e=>{switch((e||"").toLowerCase()){case"completed":case"settled":case"success":case"swapped":case"swap":return{icon:a(We,{}),color:"var(--widget-primary)"};case"received":return{icon:a(ue,{}),color:"var(--widget-accent)"};case"failed":case"error":case"expired":return{icon:a(Te,{}),color:"var(--widget-destructive)"};case"pending":case"created":case"placed":return{icon:a(Le,{}),color:"var(--widget-muted-foreground)"};default:return{icon:a(ue,{}),color:"var(--widget-muted-foreground)"}}},Ae=e=>{switch((e||"").toLowerCase()){case"completed":case"settled":case"success":case"swapped":case"swap":return"color-mix(in srgb, var(--widget-primary) 5%, transparent)";case"failed":case"error":case"expired":return"color-mix(in srgb, var(--widget-destructive) 5%, transparent)";case"pending":case"created":case"placed":return"color-mix(in srgb, var(--widget-accent) 5%, transparent)";default:return"var(--widget-secondary)"}},P=(e,s)=>{try{let n=parseFloat(e||"0");if(isNaN(n)||n===0)return"0";let c=s?.decimals??18;return q(n/10**c)}catch{return"0"}},me=({order:e,baseToken:s,quoteToken:n})=>{let[c,m]=Ce(!1),v=e?.status||e?.eventType||"unknown",{icon:f,color:p}=Ie(v),l=(i=>{if(!i)return{date:"",time:""};let h=new Date(typeof i=="number"?i:Number(i)||i);return{date:h.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),time:h.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",timeZone:"UTC",hour12:!1})+" UTC"}})(e?.timestamp||e?.createdAt||""),u=s?{asset:s,symbol:s.symbol,amount:P(e?.inputAmount,s)}:{asset:null,symbol:(e?.inputToken||"").slice(0,6)+"...",amount:P(e?.inputAmount,null)},d=n?{asset:n,symbol:n.symbol,amount:P(e?.outputAmount,n)}:{asset:null,symbol:(e?.outputToken||"").slice(0,6)+"...",amount:P(e?.outputAmount,null)};return b("a",{href:e?.explorerUrl||"#",target:"_blank",rel:"noopener noreferrer",className:"group flex flex-col cursor-pointer transition-all duration-200 ease-in-out no-underline",style:{border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:c?Ae(v):"transparent",marginBottom:"0.5rem",padding:"0.25rem"},onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),children:[b("div",{className:"flex flex-row items-center justify-between space-x-1",children:[b("div",{className:"flex flex-row items-center space-x-1",children:[a("div",{className:"-translate-y-px",style:{color:p},children:f}),a("p",{className:"text-2xs mono uppercase",style:{color:p},children:v})]}),b("div",{className:"flex flex-row items-center space-x-2",children:[b("span",{className:"text-2xs mono",style:{color:c?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:["\xAC ",K(e?.quoteId||e?.orderHash||"")]}),a("svg",{className:"w-2.5 -translate-y-px opacity-70 group-hover:rotate-[-45deg] group-hover:opacity-100 duration-200",style:{color:"var(--widget-foreground)"},viewBox:"0 0 684 684",fill:"none",children:a("path",{d:"M0.666687 384.667L519.92 384.667L281.627 622.96L342 683.333L683.333 342L342 0.666687L281.627 61.04L519.92 299.333L0.666687 299.333V384.667Z",fill:"currentColor"})})]})]}),b("div",{className:"flex flex-row items-center justify-between pr-2",style:{backgroundColor:c?"transparent":"var(--widget-secondary)"},children:[a("div",{className:"flex flex-col w-full h-full p-2",children:a("div",{className:"flex h-8 w-full items-center justify-between px-2",children:b("div",{className:"flex items-center space-x-1",children:[a(M,{asset:u.asset,size:"xs",className:"h-3 w-3"}),b("div",{className:"flex flex-col",children:[a("span",{className:"text-sm h-4",style:{color:"var(--widget-muted-foreground)"},children:u.amount}),a("span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:u.symbol})]}),a("span",{className:"px-1",style:{color:"var(--widget-muted-foreground)"},children:"\u2192"}),a(M,{asset:d.asset,size:"xs",className:"h-3 w-3"}),b("div",{className:"flex flex-col",children:[a("span",{className:"text-sm h-4",style:{color:"var(--widget-muted-foreground)"},children:d.amount}),a("span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:d.symbol})]})]})})}),b("div",{className:"flex flex-col items-end text-right shrink-0",children:[a("span",{className:"text-2xs mono whitespace-nowrap",style:{color:"var(--widget-muted-foreground)"},children:l.date}),l.time&&a("span",{className:"text-2xs mono whitespace-nowrap",style:{color:"var(--widget-muted-foreground)",opacity:.6},children:l.time})]})]})]})};import{Fragment as Fe,jsx as y,jsxs as O}from"react/jsx-runtime";var fe=()=>O("div",{className:"mt-2 flex flex-col",style:{height:"4rem",border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:"var(--widget-secondary)"},children:[O("div",{className:"flex items-center space-x-2 p-2",children:[y("div",{className:"h-4 w-4 rounded",style:{backgroundColor:"var(--widget-muted)"}}),y("div",{className:"h-3 w-24 rounded",style:{backgroundColor:"var(--widget-muted)"}})]}),O("div",{className:"flex h-8 w-full items-center justify-between px-4",children:[y("div",{className:"flex items-center space-x-1",children:[4,16,10,4,16,10].map((e,s)=>y("div",{className:"h-3 rounded",style:{width:`${e*4}px`,backgroundColor:"var(--widget-muted)"}},s))}),y("div",{className:"h-3 w-10 rounded",style:{backgroundColor:"var(--widget-muted)"}})]})]}),pe=({isActive:e})=>{let{address:s}=B(),{orders:n,isLoading:c,error:m,hasMore:v,loadMore:f}=ce(s,e),[p,w]=De(!1),l=Re(null),u=Se(async d=>{let i=d.currentTarget;if(i.scrollTop+i.clientHeight>=i.scrollHeight-100&&!c&&!p&&v){w(!0);try{await f()}finally{w(!1)}}},[c,p,v,f]);return s?m?y("div",{className:"flex items-center justify-center p-4",children:y("p",{className:"text-sm",style:{color:"var(--widget-destructive)"},children:"Error loading activity"})}):y("div",{ref:l,className:"flex flex-col flex-1 min-h-0 overflow-y-auto p-2",onScroll:u,style:{backgroundColor:"transparent"},children:c?Array.from({length:5}).map((d,i)=>y(fe,{},i)):n.length===0?y("div",{className:"flex flex-col items-center justify-center h-full p-6",children:y("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"No Activity"})}):O(Fe,{children:[n.map(d=>y(me,{order:d,baseToken:d.enrichedTokens?.base??null,quoteToken:d.enrichedTokens?.quote??null},d.orderHash)),p&&y(fe,{})]})}):y("div",{className:"flex items-center justify-center p-4",children:y("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Connect your wallet to view activity"})})};import{Fragment as $e,jsx as g,jsxs as F}from"react/jsx-runtime";var Ee=()=>F("div",{className:"flex flex-col w-full h-full overflow-hidden",children:[g("div",{className:"p-2 w-full flex justify-center",children:g("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)"}})}),g("div",{className:"px-2 flex flex-col gap-1.5 mt-1",children:[80,60,72,55,65].map((e,s)=>F("div",{className:"flex items-center justify-between py-1.5",children:[F("div",{className:"flex items-center gap-2",children:[g("div",{className:"h-6 w-6 rounded-full animate-pulse shrink-0",style:{backgroundColor:"var(--widget-secondary)"}}),g("div",{className:"h-3.5 animate-pulse",style:{width:`${e}px`,backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}})]}),g("div",{className:"h-3.5 w-14 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}})]},s))}),g("div",{className:"mt-auto shrink-0 p-2",style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:g("div",{className:"w-full animate-pulse",style:{height:"34px",backgroundColor:"var(--widget-secondary)",opacity:.35,borderRadius:"var(--widget-radius)"}})})]}),It=()=>{let e=E(L=>L.walletTab),[s,n]=He(!1),{disconnect:c}=Be(),{setQuoteToken:m}=se(),v=Me(async L=>{await m(L),E.getState().setView("swap")},[m]),{address:f,groupedAssets:p,totalBalance:w,balancesLoading:l,chains:u,getToken:d,useTokenWithLazyLoad:i,tokenRegistry:h}=oe(!0);return f?l&&e==="wallet"?g(Ee,{}):F("div",{className:"flex flex-col w-full h-full overflow-hidden",children:[F("div",{className:"flex-1 overflow-y-auto",style:{minHeight:0},children:[e==="wallet"&&F($e,{children:[g(ne,{address:f,totalBalance:w,isLoading:l}),g(de,{groupedAssets:p,chains:u,tokenRegistry:h,getToken:d,useTokenWithLazyLoad:i,onAssetSelect:v})]}),e==="activity"&&g(pe,{isActive:e==="activity"})]}),g("div",{className:"shrink-0 p-2",style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:g("button",{type:"button",onClick:()=>{c(),E.getState().setView("swap")},onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),className:"w-full py-2 text-xs mono uppercase cursor-pointer transition-colors",style:{backgroundColor:s?"var(--widget-destructive)":"transparent",color:s?"var(--widget-destructive-foreground)":"var(--widget-destructive)",border:"1px var(--widget-border-style) var(--widget-destructive)",borderRadius:"var(--widget-radius)"},children:"Sign Out"})})]}):g("div",{className:"flex flex-col items-center justify-center h-full p-4",children:g("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Connect your wallet to view your portfolio"})})};export{It 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 _chunk537OMWA3cjs = require('./chunk-537OMWA3.cjs');var _chunkBX3KCZRTcjs = require('./chunk-BX3KCZRT.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');var _chunkT3I3AJXVcjs = require('./chunk-T3I3AJXV.cjs');var _react = require('react');var _wagmi = require('wagmi');function oe(e){let{address:s,isConnected:n}=_chunk34N36GUDcjs.a.call(void 0, ),{chainDataMap:c}=_chunkBX3KCZRTcjs.I.call(void 0, ),m=_chunkBX3KCZRTcjs._.call(void 0, ),{getToken:v,tokenRegistry:f}=_chunkBX3KCZRTcjs.F.call(void 0, ),{supportedInputTokens:p,supportedOutputTokens:w}=_chunkBX3KCZRTcjs.b.call(void 0, ),l=_react.useMemo.call(void 0, ()=>{if(!p.length&&!w.length)return[];let t=new Set,o=[];for(let x of[...p,...w]){let S=`${x.chainId}-${x.address.toLowerCase()}`;t.has(S)||(t.add(S),o.push(x))}return o},[p,w]),{balances:u,isLoading:d,isError:i,refetch:h}=_chunkBX3KCZRTcjs.L.call(void 0, s,m,{enabled:n&&e&&!!s,refetchOnWindowFocus:!1},l.length>0?l:void 0),L=_react.useMemo.call(void 0, ()=>l.length?new Set(l.map(t=>`${t.chainId}-${t.address.toLowerCase()}`)):null,[l]),r=_react.useMemo.call(void 0, ()=>!u||u.length===0?{}:u.filter(o=>!o.assetInfo||!o.balance||o.balance==="0"?!1:L?L.has(`${o.chainId}-${o.address.toLowerCase()}`):_chunkBX3KCZRTcjs.k.call(void 0, o.assetInfo)||f.length===0?!0:f.some(x=>x.address.toLowerCase()===o.address.toLowerCase()&&x.chainId===o.chainId)).reduce((o,x)=>{let S=String(x.chainId);return o[S]||(o[S]=[]),o[S].push({token:x.address,amount:x.balance,decimals:x.decimals,assetInfo:x.assetInfo}),o},{}),[u,f,L]),k=_react.useMemo.call(void 0, ()=>!u||u.length===0?0:u.reduce((t,o)=>!o.assetInfo||o.decimals===void 0?t:t+parseFloat(o.balance)/10**o.decimals*(o.assetInfo.price||0),0),[u]),T=_react.useMemo.call(void 0, ()=>m.length===0?{}:m.reduce((t,o)=>{let x=c[o],S=_chunkBX3KCZRTcjs.e.call(void 0, o);return t[o.toString()]={chainId:o,name:_optionalChain([S, 'optionalAccess', _2 => _2.displayName])||_optionalChain([x, 'optionalAccess', _3 => _3.chainKey])||`Chain ${o}`},t},{}),[m,c]),W=_react.useMemo.call(void 0, ()=>f.map(t=>({address:t.address,chainId:t.chainId})),[f]),N=_react.useRef.call(void 0, null);_react.useEffect.call(void 0, ()=>()=>{N.current&&clearTimeout(N.current)},[]);let A=_react.useCallback.call(void 0, ()=>{N.current&&clearTimeout(N.current),N.current=setTimeout(()=>h(),2e3)},[h]);return{address:s,isConnected:n,groupedAssets:r,totalBalance:k,balancesLoading:d,balancesError:i,chains:T,getToken:v,useTokenWithLazyLoad:_chunkBX3KCZRTcjs.H,tokenRegistry:W,refetchBalances:A}}var ae=_chunkT3I3AJXVcjs.b.call(void 0, _chunkKH57FLSTcjs.a.call(void 0, ),1);var _jsxruntime = require('react/jsx-runtime');var ne=({address:e,totalBalance:s,isLoading:n=!1})=>{let c=m=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(m);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,ae.makeGradient)(e),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 mono",style:{color:"var(--widget-muted-foreground)",opacity:.7},children:"Token Balance:"}),n?_jsxruntime.jsx.call(void 0, _chunkBX3KCZRTcjs.S,{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:c(s)})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center",children:_jsxruntime.jsx.call(void 0, _chunkBX3KCZRTcjs.R,{text:e,type:"address",children:_jsxruntime.jsx.call(void 0, "p",{className:"mono text-2xs",style:{color:"var(--widget-foreground)",opacity:.7},children:e})})})]})]})})};var ie=({asset:e,balanceAmount:s,balanceDecimals:n,price:c,onSelect:m,getToken:v,useTokenWithLazyLoad:f})=>{let[p,w]=_react.useState.call(void 0, !1),l=n!==void 0?parseFloat(s)/10**n:0,d=_optionalChain([f, 'optionalCall', _4 => _4(e.chainId,e.address), 'optionalAccess', _5 => _5.token]),i=_nullishCoalesce(c, () => (null));return _chunkBX3KCZRTcjs.k.call(void 0, e)&&i==null&&(_optionalChain([d, 'optionalAccess', _6 => _6.price])!=null?i=d.price:v&&(i=_nullishCoalesce(_optionalChain([v, 'call', _7 => _7(e.chainId,e.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:p?"var(--widget-secondary)":"transparent"},onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),onClick:()=>_optionalChain([m, 'optionalCall', _9 => _9(e)]),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),_optionalChain([m, 'optionalCall', _10 => _10(e)]))},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, _chunkBX3KCZRTcjs.P,{asset:e,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:e.symbol}),l>0&&_jsxruntime.jsx.call(void 0, "p",{className:"mono text-xs",style:{color:"var(--widget-muted-foreground)"},children:l.toFixed(4)})]})]}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-medium",style:{color:"var(--widget-foreground)"},children:i!=null?`$${(i*l).toFixed(2)}`:"\u2014"})]})})};var be=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}),Ne=_chunkBX3KCZRTcjs.h.call(void 0, ),de=({groupedAssets:e,chains:s,tokenRegistry:n=[],getToken:c,useTokenWithLazyLoad:m,onAssetSelect:v})=>{let[f,p]=_react.useState.call(void 0, new Set),w=_react.useCallback.call(void 0, r=>_optionalChain([s, 'optionalAccess', _11 => _11[r], 'optionalAccess', _12 => _12.name])||Ne[r]||`Chain ${r}`,[s]),l=_react.useMemo.call(void 0, ()=>{let r=new Set;for(let k of n)r.add(`${k.chainId}-${k.address.toLowerCase()}`);return r},[n]),u=_react.useCallback.call(void 0, r=>r.decimals===void 0||!_optionalChain([r, 'access', _13 => _13.assetInfo, 'optionalAccess', _14 => _14.price])?0:parseFloat(r.amount)/10**r.decimals*r.assetInfo.price,[]),{filteredGroupedAssets:d,chainTotals:i}=_react.useMemo.call(void 0, ()=>{let r=Object.entries(e).map(([W,N])=>{let A=N.filter(t=>t.assetInfo?_chunkBX3KCZRTcjs.k.call(void 0, t.assetInfo)?!0:l.size>0?l.has(`${t.assetInfo.chainId}-${_nullishCoalesce(_optionalChain([t, 'access', _15 => _15.assetInfo, 'access', _16 => _16.address, 'optionalAccess', _17 => _17.toLowerCase, 'call', _18 => _18()]), () => (""))}`):!0:!1);return[W,A]}).filter(([,W])=>W.length>0),k={};for(let[W,N]of r)k[W]=N.reduce((A,t)=>A+u(t),0);return{filteredGroupedAssets:[...r].sort((W,N)=>(_nullishCoalesce(k[N[0]], () => (0)))-(_nullishCoalesce(k[W[0]], () => (0)))),chainTotals:k}},[e,l,u]),h=_react.useCallback.call(void 0, r=>{p(k=>{let T=new Set(k);return T.has(r)?T.delete(r):T.add(r),T})},[]),L=r=>be.format(r);return d.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:d.map(([r,k])=>{let T=parseInt(r),W=w(T),N=i[r]||0,A=f.has(r);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(r),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, _chunkBX3KCZRTcjs.O,{chain:T,size:"sm"}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-medium capitalize",style:{color:"var(--widget-foreground)"},children:W})]}),_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:L(N)}),_jsxruntime.jsx.call(void 0, "span",{className:`transition-transform duration-200 ${A?"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 ${A?"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:k.map(t=>t.assetInfo?_jsxruntime.jsx.call(void 0, ie,{asset:t.assetInfo,balanceAmount:t.amount,balanceDecimals:t.decimals,price:_nullishCoalesce(_optionalChain([t, 'access', _19 => _19.assetInfo, 'optionalAccess', _20 => _20.price]), () => (null)),onSelect:v,getToken:c,useTokenWithLazyLoad:m},`${t.assetInfo.chainId}-${t.token}`):null)})})]},r)})})};function ce(e,s){return{orders:[],isLoading:!1,error:null,hasMore:!1,loadMore:async()=>{},totalOrders:0}}var We=()=>_jsxruntime.jsxs.call(void 0, "svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),_jsxruntime.jsx.call(void 0, "path",{d:"M3 5.2L4.3 6.5L7 3.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Te=()=>_jsxruntime.jsxs.call(void 0, "svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),_jsxruntime.jsx.call(void 0, "path",{d:"M3.5 3.5L6.5 6.5M6.5 3.5L3.5 6.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),Le=()=>_jsxruntime.jsxs.call(void 0, "svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),_jsxruntime.jsx.call(void 0, "path",{d:"M5 3V5.5L6.5 6.5",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"})]}),ue=()=>_jsxruntime.jsxs.call(void 0, "svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"5",cy:"5",r:"1.5",fill:"currentColor"})]}),Ie=e=>{switch((e||"").toLowerCase()){case"completed":case"settled":case"success":case"swapped":case"swap":return{icon:_jsxruntime.jsx.call(void 0, We,{}),color:"var(--widget-primary)"};case"received":return{icon:_jsxruntime.jsx.call(void 0, ue,{}),color:"var(--widget-accent)"};case"failed":case"error":case"expired":return{icon:_jsxruntime.jsx.call(void 0, Te,{}),color:"var(--widget-destructive)"};case"pending":case"created":case"placed":return{icon:_jsxruntime.jsx.call(void 0, Le,{}),color:"var(--widget-muted-foreground)"};default:return{icon:_jsxruntime.jsx.call(void 0, ue,{}),color:"var(--widget-muted-foreground)"}}},Ae=e=>{switch((e||"").toLowerCase()){case"completed":case"settled":case"success":case"swapped":case"swap":return"color-mix(in srgb, var(--widget-primary) 5%, transparent)";case"failed":case"error":case"expired":return"color-mix(in srgb, var(--widget-destructive) 5%, transparent)";case"pending":case"created":case"placed":return"color-mix(in srgb, var(--widget-accent) 5%, transparent)";default:return"var(--widget-secondary)"}},P=(e,s)=>{try{let n=parseFloat(e||"0");if(isNaN(n)||n===0)return"0";let c=_nullishCoalesce(_optionalChain([s, 'optionalAccess', _21 => _21.decimals]), () => (18));return _chunkBX3KCZRTcjs.q.call(void 0, n/10**c)}catch (e2){return"0"}},me=({order:e,baseToken:s,quoteToken:n})=>{let[c,m]=_react.useState.call(void 0, !1),v=_optionalChain([e, 'optionalAccess', _22 => _22.status])||_optionalChain([e, 'optionalAccess', _23 => _23.eventType])||"unknown",{icon:f,color:p}=Ie(v),l=(i=>{if(!i)return{date:"",time:""};let h=new Date(typeof i=="number"?i:Number(i)||i);return{date:h.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),time:h.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",timeZone:"UTC",hour12:!1})+" UTC"}})(_optionalChain([e, 'optionalAccess', _24 => _24.timestamp])||_optionalChain([e, 'optionalAccess', _25 => _25.createdAt])||""),u=s?{asset:s,symbol:s.symbol,amount:P(_optionalChain([e, 'optionalAccess', _26 => _26.inputAmount]),s)}:{asset:null,symbol:(_optionalChain([e, 'optionalAccess', _27 => _27.inputToken])||"").slice(0,6)+"...",amount:P(_optionalChain([e, 'optionalAccess', _28 => _28.inputAmount]),null)},d=n?{asset:n,symbol:n.symbol,amount:P(_optionalChain([e, 'optionalAccess', _29 => _29.outputAmount]),n)}:{asset:null,symbol:(_optionalChain([e, 'optionalAccess', _30 => _30.outputToken])||"").slice(0,6)+"...",amount:P(_optionalChain([e, 'optionalAccess', _31 => _31.outputAmount]),null)};return _jsxruntime.jsxs.call(void 0, "a",{href:_optionalChain([e, 'optionalAccess', _32 => _32.explorerUrl])||"#",target:"_blank",rel:"noopener noreferrer",className:"group flex flex-col cursor-pointer transition-all duration-200 ease-in-out no-underline",style:{border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:c?Ae(v):"transparent",marginBottom:"0.5rem",padding:"0.25rem"},onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center justify-between space-x-1",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center space-x-1",children:[_jsxruntime.jsx.call(void 0, "div",{className:"-translate-y-px",style:{color:p},children:f}),_jsxruntime.jsx.call(void 0, "p",{className:"text-2xs mono uppercase",style:{color:p},children:v})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center space-x-2",children:[_jsxruntime.jsxs.call(void 0, "span",{className:"text-2xs mono",style:{color:c?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:["\xAC ",_chunkBX3KCZRTcjs.r.call(void 0, _optionalChain([e, 'optionalAccess', _33 => _33.quoteId])||_optionalChain([e, 'optionalAccess', _34 => _34.orderHash])||"")]}),_jsxruntime.jsx.call(void 0, "svg",{className:"w-2.5 -translate-y-px opacity-70 group-hover:rotate-[-45deg] group-hover:opacity-100 duration-200",style:{color:"var(--widget-foreground)"},viewBox:"0 0 684 684",fill:"none",children:_jsxruntime.jsx.call(void 0, "path",{d:"M0.666687 384.667L519.92 384.667L281.627 622.96L342 683.333L683.333 342L342 0.666687L281.627 61.04L519.92 299.333L0.666687 299.333V384.667Z",fill:"currentColor"})})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center justify-between pr-2",style:{backgroundColor:c?"transparent":"var(--widget-secondary)"},children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col w-full h-full p-2",children:_jsxruntime.jsx.call(void 0, "div",{className:"flex h-8 w-full items-center justify-between px-2",children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-1",children:[_jsxruntime.jsx.call(void 0, _chunkBX3KCZRTcjs.P,{asset:u.asset,size:"xs",className:"h-3 w-3"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-sm h-4",style:{color:"var(--widget-muted-foreground)"},children:u.amount}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:u.symbol})]}),_jsxruntime.jsx.call(void 0, "span",{className:"px-1",style:{color:"var(--widget-muted-foreground)"},children:"\u2192"}),_jsxruntime.jsx.call(void 0, _chunkBX3KCZRTcjs.P,{asset:d.asset,size:"xs",className:"h-3 w-3"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-sm h-4",style:{color:"var(--widget-muted-foreground)"},children:d.amount}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:d.symbol})]})]})})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-end text-right shrink-0",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs mono whitespace-nowrap",style:{color:"var(--widget-muted-foreground)"},children:l.date}),l.time&&_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs mono whitespace-nowrap",style:{color:"var(--widget-muted-foreground)",opacity:.6},children:l.time})]})]})]})};var fe=()=>_jsxruntime.jsxs.call(void 0, "div",{className:"mt-2 flex flex-col",style:{height:"4rem",border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:"var(--widget-secondary)"},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-2 p-2",children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-4 w-4 rounded",style:{backgroundColor:"var(--widget-muted)"}}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3 w-24 rounded",style:{backgroundColor:"var(--widget-muted)"}})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-8 w-full items-center justify-between px-4",children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center space-x-1",children:[4,16,10,4,16,10].map((e,s)=>_jsxruntime.jsx.call(void 0, "div",{className:"h-3 rounded",style:{width:`${e*4}px`,backgroundColor:"var(--widget-muted)"}},s))}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3 w-10 rounded",style:{backgroundColor:"var(--widget-muted)"}})]})]}),pe=({isActive:e})=>{let{address:s}=_chunk34N36GUDcjs.a.call(void 0, ),{orders:n,isLoading:c,error:m,hasMore:v,loadMore:f}=ce(s,e),[p,w]=_react.useState.call(void 0, !1),l=_react.useRef.call(void 0, null),u=_react.useCallback.call(void 0, async d=>{let i=d.currentTarget;if(i.scrollTop+i.clientHeight>=i.scrollHeight-100&&!c&&!p&&v){w(!0);try{await f()}finally{w(!1)}}},[c,p,v,f]);return s?m?_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center p-4",children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",style:{color:"var(--widget-destructive)"},children:"Error loading activity"})}):_jsxruntime.jsx.call(void 0, "div",{ref:l,className:"flex flex-col flex-1 min-h-0 overflow-y-auto p-2",onScroll:u,style:{backgroundColor:"transparent"},children:c?Array.from({length:5}).map((d,i)=>_jsxruntime.jsx.call(void 0, fe,{},i)):n.length===0?_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col items-center justify-center h-full p-6",children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"No Activity"})}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[n.map(d=>_jsxruntime.jsx.call(void 0, me,{order:d,baseToken:_nullishCoalesce(_optionalChain([d, 'access', _35 => _35.enrichedTokens, 'optionalAccess', _36 => _36.base]), () => (null)),quoteToken:_nullishCoalesce(_optionalChain([d, 'access', _37 => _37.enrichedTokens, 'optionalAccess', _38 => _38.quote]), () => (null))},d.orderHash)),p&&_jsxruntime.jsx.call(void 0, fe,{})]})}):_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center p-4",children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Connect your wallet to view activity"})})};var Ee=()=>_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((e,s)=>_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:`${e}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"}})]},s))}),_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)"}})})]}),It= exports.WidgetWalletPanel =()=>{let e=_chunk537OMWA3cjs.c.call(void 0, L=>L.walletTab),[s,n]=_react.useState.call(void 0, !1),{disconnect:c}=_wagmi.useDisconnect.call(void 0, ),{setQuoteToken:m}=_chunk537OMWA3cjs.f.call(void 0, ),v=_react.useCallback.call(void 0, async L=>{await m(L),_chunk537OMWA3cjs.c.getState().setView("swap")},[m]),{address:f,groupedAssets:p,totalBalance:w,balancesLoading:l,chains:u,getToken:d,useTokenWithLazyLoad:i,tokenRegistry:h}=oe(!0);return f?l&&e==="wallet"?_jsxruntime.jsx.call(void 0, Ee,{}):_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:[e==="wallet"&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, ne,{address:f,totalBalance:w,isLoading:l}),_jsxruntime.jsx.call(void 0, de,{groupedAssets:p,chains:u,tokenRegistry:h,getToken:d,useTokenWithLazyLoad:i,onAssetSelect:v})]}),e==="activity"&&_jsxruntime.jsx.call(void 0, pe,{isActive:e==="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:()=>{c(),_chunk537OMWA3cjs.c.getState().setView("swap")},onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),className:"w-full py-2 text-xs mono uppercase cursor-pointer transition-colors",style:{backgroundColor:s?"var(--widget-destructive)":"transparent",color:s?"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 = It;
2
+ "use client";var _chunkKH57FLSTcjs = require('./chunk-KH57FLST.cjs');var _chunkUZWGYG2Scjs = require('./chunk-UZWGYG2S.cjs');var _chunkLXEKOQAGcjs = require('./chunk-LXEKOQAG.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');var _chunkT3I3AJXVcjs = require('./chunk-T3I3AJXV.cjs');var _react = require('react');var _wagmi = require('wagmi');function oe(e){let{address:s,isConnected:n}=_chunk34N36GUDcjs.a.call(void 0, ),{chainDataMap:c}=_chunkLXEKOQAGcjs.I.call(void 0, ),m=_chunkLXEKOQAGcjs._.call(void 0, ),{getToken:v,tokenRegistry:f}=_chunkLXEKOQAGcjs.F.call(void 0, ),{supportedInputTokens:p,supportedOutputTokens:w}=_chunkLXEKOQAGcjs.b.call(void 0, ),l=_react.useMemo.call(void 0, ()=>{if(!p.length&&!w.length)return[];let t=new Set,o=[];for(let x of[...p,...w]){let S=`${x.chainId}-${x.address.toLowerCase()}`;t.has(S)||(t.add(S),o.push(x))}return o},[p,w]),{balances:u,isLoading:d,isError:i,refetch:h}=_chunkLXEKOQAGcjs.L.call(void 0, s,m,{enabled:n&&e&&!!s,refetchOnWindowFocus:!1},l.length>0?l:void 0),L=_react.useMemo.call(void 0, ()=>l.length?new Set(l.map(t=>`${t.chainId}-${t.address.toLowerCase()}`)):null,[l]),r=_react.useMemo.call(void 0, ()=>!u||u.length===0?{}:u.filter(o=>!o.assetInfo||!o.balance||o.balance==="0"?!1:L?L.has(`${o.chainId}-${o.address.toLowerCase()}`):_chunkLXEKOQAGcjs.k.call(void 0, o.assetInfo)||f.length===0?!0:f.some(x=>x.address.toLowerCase()===o.address.toLowerCase()&&x.chainId===o.chainId)).reduce((o,x)=>{let S=String(x.chainId);return o[S]||(o[S]=[]),o[S].push({token:x.address,amount:x.balance,decimals:x.decimals,assetInfo:x.assetInfo}),o},{}),[u,f,L]),k=_react.useMemo.call(void 0, ()=>!u||u.length===0?0:u.reduce((t,o)=>!o.assetInfo||o.decimals===void 0?t:t+parseFloat(o.balance)/10**o.decimals*(o.assetInfo.price||0),0),[u]),T=_react.useMemo.call(void 0, ()=>m.length===0?{}:m.reduce((t,o)=>{let x=c[o],S=_chunkLXEKOQAGcjs.e.call(void 0, o);return t[o.toString()]={chainId:o,name:_optionalChain([S, 'optionalAccess', _2 => _2.displayName])||_optionalChain([x, 'optionalAccess', _3 => _3.chainKey])||`Chain ${o}`},t},{}),[m,c]),W=_react.useMemo.call(void 0, ()=>f.map(t=>({address:t.address,chainId:t.chainId})),[f]),N=_react.useRef.call(void 0, null);_react.useEffect.call(void 0, ()=>()=>{N.current&&clearTimeout(N.current)},[]);let A=_react.useCallback.call(void 0, ()=>{N.current&&clearTimeout(N.current),N.current=setTimeout(()=>h(),2e3)},[h]);return{address:s,isConnected:n,groupedAssets:r,totalBalance:k,balancesLoading:d,balancesError:i,chains:T,getToken:v,useTokenWithLazyLoad:_chunkLXEKOQAGcjs.H,tokenRegistry:W,refetchBalances:A}}var ae=_chunkT3I3AJXVcjs.b.call(void 0, _chunkKH57FLSTcjs.a.call(void 0, ),1);var _jsxruntime = require('react/jsx-runtime');var ne=({address:e,totalBalance:s,isLoading:n=!1})=>{let c=m=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(m);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,ae.makeGradient)(e),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 mono",style:{color:"var(--widget-muted-foreground)",opacity:.7},children:"Token Balance:"}),n?_jsxruntime.jsx.call(void 0, _chunkLXEKOQAGcjs.S,{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:c(s)})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center",children:_jsxruntime.jsx.call(void 0, _chunkLXEKOQAGcjs.R,{text:e,type:"address",children:_jsxruntime.jsx.call(void 0, "p",{className:"mono text-2xs",style:{color:"var(--widget-foreground)",opacity:.7},children:e})})})]})]})})};var ie=({asset:e,balanceAmount:s,balanceDecimals:n,price:c,onSelect:m,getToken:v,useTokenWithLazyLoad:f})=>{let[p,w]=_react.useState.call(void 0, !1),l=n!==void 0?parseFloat(s)/10**n:0,d=_optionalChain([f, 'optionalCall', _4 => _4(e.chainId,e.address), 'optionalAccess', _5 => _5.token]),i=_nullishCoalesce(c, () => (null));return _chunkLXEKOQAGcjs.k.call(void 0, e)&&i==null&&(_optionalChain([d, 'optionalAccess', _6 => _6.price])!=null?i=d.price:v&&(i=_nullishCoalesce(_optionalChain([v, 'call', _7 => _7(e.chainId,e.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:p?"var(--widget-secondary)":"transparent"},onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),onClick:()=>_optionalChain([m, 'optionalCall', _9 => _9(e)]),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),_optionalChain([m, 'optionalCall', _10 => _10(e)]))},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, _chunkLXEKOQAGcjs.P,{asset:e,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:e.symbol}),l>0&&_jsxruntime.jsx.call(void 0, "p",{className:"mono text-xs",style:{color:"var(--widget-muted-foreground)"},children:l.toFixed(4)})]})]}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-medium",style:{color:"var(--widget-foreground)"},children:i!=null?`$${(i*l).toFixed(2)}`:"\u2014"})]})})};var be=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}),Ne=_chunkLXEKOQAGcjs.h.call(void 0, ),de=({groupedAssets:e,chains:s,tokenRegistry:n=[],getToken:c,useTokenWithLazyLoad:m,onAssetSelect:v})=>{let[f,p]=_react.useState.call(void 0, new Set),w=_react.useCallback.call(void 0, r=>_optionalChain([s, 'optionalAccess', _11 => _11[r], 'optionalAccess', _12 => _12.name])||Ne[r]||`Chain ${r}`,[s]),l=_react.useMemo.call(void 0, ()=>{let r=new Set;for(let k of n)r.add(`${k.chainId}-${k.address.toLowerCase()}`);return r},[n]),u=_react.useCallback.call(void 0, r=>r.decimals===void 0||!_optionalChain([r, 'access', _13 => _13.assetInfo, 'optionalAccess', _14 => _14.price])?0:parseFloat(r.amount)/10**r.decimals*r.assetInfo.price,[]),{filteredGroupedAssets:d,chainTotals:i}=_react.useMemo.call(void 0, ()=>{let r=Object.entries(e).map(([W,N])=>{let A=N.filter(t=>t.assetInfo?_chunkLXEKOQAGcjs.k.call(void 0, t.assetInfo)?!0:l.size>0?l.has(`${t.assetInfo.chainId}-${_nullishCoalesce(_optionalChain([t, 'access', _15 => _15.assetInfo, 'access', _16 => _16.address, 'optionalAccess', _17 => _17.toLowerCase, 'call', _18 => _18()]), () => (""))}`):!0:!1);return[W,A]}).filter(([,W])=>W.length>0),k={};for(let[W,N]of r)k[W]=N.reduce((A,t)=>A+u(t),0);return{filteredGroupedAssets:[...r].sort((W,N)=>(_nullishCoalesce(k[N[0]], () => (0)))-(_nullishCoalesce(k[W[0]], () => (0)))),chainTotals:k}},[e,l,u]),h=_react.useCallback.call(void 0, r=>{p(k=>{let T=new Set(k);return T.has(r)?T.delete(r):T.add(r),T})},[]),L=r=>be.format(r);return d.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:d.map(([r,k])=>{let T=parseInt(r),W=w(T),N=i[r]||0,A=f.has(r);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(r),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, _chunkLXEKOQAGcjs.O,{chain:T,size:"sm"}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-medium capitalize",style:{color:"var(--widget-foreground)"},children:W})]}),_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:L(N)}),_jsxruntime.jsx.call(void 0, "span",{className:`transition-transform duration-200 ${A?"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 ${A?"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:k.map(t=>t.assetInfo?_jsxruntime.jsx.call(void 0, ie,{asset:t.assetInfo,balanceAmount:t.amount,balanceDecimals:t.decimals,price:_nullishCoalesce(_optionalChain([t, 'access', _19 => _19.assetInfo, 'optionalAccess', _20 => _20.price]), () => (null)),onSelect:v,getToken:c,useTokenWithLazyLoad:m},`${t.assetInfo.chainId}-${t.token}`):null)})})]},r)})})};function ce(e,s){return{orders:[],isLoading:!1,error:null,hasMore:!1,loadMore:async()=>{},totalOrders:0}}var We=()=>_jsxruntime.jsxs.call(void 0, "svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),_jsxruntime.jsx.call(void 0, "path",{d:"M3 5.2L4.3 6.5L7 3.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Te=()=>_jsxruntime.jsxs.call(void 0, "svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),_jsxruntime.jsx.call(void 0, "path",{d:"M3.5 3.5L6.5 6.5M6.5 3.5L3.5 6.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),Le=()=>_jsxruntime.jsxs.call(void 0, "svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),_jsxruntime.jsx.call(void 0, "path",{d:"M5 3V5.5L6.5 6.5",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"})]}),ue=()=>_jsxruntime.jsxs.call(void 0, "svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"5",cy:"5",r:"1.5",fill:"currentColor"})]}),Ie=e=>{switch((e||"").toLowerCase()){case"completed":case"settled":case"success":case"swapped":case"swap":return{icon:_jsxruntime.jsx.call(void 0, We,{}),color:"var(--widget-primary)"};case"received":return{icon:_jsxruntime.jsx.call(void 0, ue,{}),color:"var(--widget-accent)"};case"failed":case"error":case"expired":return{icon:_jsxruntime.jsx.call(void 0, Te,{}),color:"var(--widget-destructive)"};case"pending":case"created":case"placed":return{icon:_jsxruntime.jsx.call(void 0, Le,{}),color:"var(--widget-muted-foreground)"};default:return{icon:_jsxruntime.jsx.call(void 0, ue,{}),color:"var(--widget-muted-foreground)"}}},Ae=e=>{switch((e||"").toLowerCase()){case"completed":case"settled":case"success":case"swapped":case"swap":return"color-mix(in srgb, var(--widget-primary) 5%, transparent)";case"failed":case"error":case"expired":return"color-mix(in srgb, var(--widget-destructive) 5%, transparent)";case"pending":case"created":case"placed":return"color-mix(in srgb, var(--widget-accent) 5%, transparent)";default:return"var(--widget-secondary)"}},P=(e,s)=>{try{let n=parseFloat(e||"0");if(isNaN(n)||n===0)return"0";let c=_nullishCoalesce(_optionalChain([s, 'optionalAccess', _21 => _21.decimals]), () => (18));return _chunkLXEKOQAGcjs.q.call(void 0, n/10**c)}catch (e2){return"0"}},me=({order:e,baseToken:s,quoteToken:n})=>{let[c,m]=_react.useState.call(void 0, !1),v=_optionalChain([e, 'optionalAccess', _22 => _22.status])||_optionalChain([e, 'optionalAccess', _23 => _23.eventType])||"unknown",{icon:f,color:p}=Ie(v),l=(i=>{if(!i)return{date:"",time:""};let h=new Date(typeof i=="number"?i:Number(i)||i);return{date:h.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),time:h.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",timeZone:"UTC",hour12:!1})+" UTC"}})(_optionalChain([e, 'optionalAccess', _24 => _24.timestamp])||_optionalChain([e, 'optionalAccess', _25 => _25.createdAt])||""),u=s?{asset:s,symbol:s.symbol,amount:P(_optionalChain([e, 'optionalAccess', _26 => _26.inputAmount]),s)}:{asset:null,symbol:(_optionalChain([e, 'optionalAccess', _27 => _27.inputToken])||"").slice(0,6)+"...",amount:P(_optionalChain([e, 'optionalAccess', _28 => _28.inputAmount]),null)},d=n?{asset:n,symbol:n.symbol,amount:P(_optionalChain([e, 'optionalAccess', _29 => _29.outputAmount]),n)}:{asset:null,symbol:(_optionalChain([e, 'optionalAccess', _30 => _30.outputToken])||"").slice(0,6)+"...",amount:P(_optionalChain([e, 'optionalAccess', _31 => _31.outputAmount]),null)};return _jsxruntime.jsxs.call(void 0, "a",{href:_optionalChain([e, 'optionalAccess', _32 => _32.explorerUrl])||"#",target:"_blank",rel:"noopener noreferrer",className:"group flex flex-col cursor-pointer transition-all duration-200 ease-in-out no-underline",style:{border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:c?Ae(v):"transparent",marginBottom:"0.5rem",padding:"0.25rem"},onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center justify-between space-x-1",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center space-x-1",children:[_jsxruntime.jsx.call(void 0, "div",{className:"-translate-y-px",style:{color:p},children:f}),_jsxruntime.jsx.call(void 0, "p",{className:"text-2xs mono uppercase",style:{color:p},children:v})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center space-x-2",children:[_jsxruntime.jsxs.call(void 0, "span",{className:"text-2xs mono",style:{color:c?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:["\xAC ",_chunkLXEKOQAGcjs.r.call(void 0, _optionalChain([e, 'optionalAccess', _33 => _33.quoteId])||_optionalChain([e, 'optionalAccess', _34 => _34.orderHash])||"")]}),_jsxruntime.jsx.call(void 0, "svg",{className:"w-2.5 -translate-y-px opacity-70 group-hover:rotate-[-45deg] group-hover:opacity-100 duration-200",style:{color:"var(--widget-foreground)"},viewBox:"0 0 684 684",fill:"none",children:_jsxruntime.jsx.call(void 0, "path",{d:"M0.666687 384.667L519.92 384.667L281.627 622.96L342 683.333L683.333 342L342 0.666687L281.627 61.04L519.92 299.333L0.666687 299.333V384.667Z",fill:"currentColor"})})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center justify-between pr-2",style:{backgroundColor:c?"transparent":"var(--widget-secondary)"},children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col w-full h-full p-2",children:_jsxruntime.jsx.call(void 0, "div",{className:"flex h-8 w-full items-center justify-between px-2",children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-1",children:[_jsxruntime.jsx.call(void 0, _chunkLXEKOQAGcjs.P,{asset:u.asset,size:"xs",className:"h-3 w-3"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-sm h-4",style:{color:"var(--widget-muted-foreground)"},children:u.amount}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:u.symbol})]}),_jsxruntime.jsx.call(void 0, "span",{className:"px-1",style:{color:"var(--widget-muted-foreground)"},children:"\u2192"}),_jsxruntime.jsx.call(void 0, _chunkLXEKOQAGcjs.P,{asset:d.asset,size:"xs",className:"h-3 w-3"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-sm h-4",style:{color:"var(--widget-muted-foreground)"},children:d.amount}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:d.symbol})]})]})})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-end text-right shrink-0",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs mono whitespace-nowrap",style:{color:"var(--widget-muted-foreground)"},children:l.date}),l.time&&_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs mono whitespace-nowrap",style:{color:"var(--widget-muted-foreground)",opacity:.6},children:l.time})]})]})]})};var fe=()=>_jsxruntime.jsxs.call(void 0, "div",{className:"mt-2 flex flex-col",style:{height:"4rem",border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:"var(--widget-secondary)"},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-2 p-2",children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-4 w-4 rounded",style:{backgroundColor:"var(--widget-muted)"}}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3 w-24 rounded",style:{backgroundColor:"var(--widget-muted)"}})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-8 w-full items-center justify-between px-4",children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center space-x-1",children:[4,16,10,4,16,10].map((e,s)=>_jsxruntime.jsx.call(void 0, "div",{className:"h-3 rounded",style:{width:`${e*4}px`,backgroundColor:"var(--widget-muted)"}},s))}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3 w-10 rounded",style:{backgroundColor:"var(--widget-muted)"}})]})]}),pe=({isActive:e})=>{let{address:s}=_chunk34N36GUDcjs.a.call(void 0, ),{orders:n,isLoading:c,error:m,hasMore:v,loadMore:f}=ce(s,e),[p,w]=_react.useState.call(void 0, !1),l=_react.useRef.call(void 0, null),u=_react.useCallback.call(void 0, async d=>{let i=d.currentTarget;if(i.scrollTop+i.clientHeight>=i.scrollHeight-100&&!c&&!p&&v){w(!0);try{await f()}finally{w(!1)}}},[c,p,v,f]);return s?m?_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center p-4",children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",style:{color:"var(--widget-destructive)"},children:"Error loading activity"})}):_jsxruntime.jsx.call(void 0, "div",{ref:l,className:"flex flex-col flex-1 min-h-0 overflow-y-auto p-2",onScroll:u,style:{backgroundColor:"transparent"},children:c?Array.from({length:5}).map((d,i)=>_jsxruntime.jsx.call(void 0, fe,{},i)):n.length===0?_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col items-center justify-center h-full p-6",children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"No Activity"})}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[n.map(d=>_jsxruntime.jsx.call(void 0, me,{order:d,baseToken:_nullishCoalesce(_optionalChain([d, 'access', _35 => _35.enrichedTokens, 'optionalAccess', _36 => _36.base]), () => (null)),quoteToken:_nullishCoalesce(_optionalChain([d, 'access', _37 => _37.enrichedTokens, 'optionalAccess', _38 => _38.quote]), () => (null))},d.orderHash)),p&&_jsxruntime.jsx.call(void 0, fe,{})]})}):_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center p-4",children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Connect your wallet to view activity"})})};var Ee=()=>_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((e,s)=>_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:`${e}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"}})]},s))}),_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)"}})})]}),It= exports.WidgetWalletPanel =()=>{let e=_chunkUZWGYG2Scjs.c.call(void 0, L=>L.walletTab),[s,n]=_react.useState.call(void 0, !1),{disconnect:c}=_wagmi.useDisconnect.call(void 0, ),{setQuoteToken:m}=_chunkUZWGYG2Scjs.f.call(void 0, ),v=_react.useCallback.call(void 0, async L=>{await m(L),_chunkUZWGYG2Scjs.c.getState().setView("swap")},[m]),{address:f,groupedAssets:p,totalBalance:w,balancesLoading:l,chains:u,getToken:d,useTokenWithLazyLoad:i,tokenRegistry:h}=oe(!0);return f?l&&e==="wallet"?_jsxruntime.jsx.call(void 0, Ee,{}):_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:[e==="wallet"&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, ne,{address:f,totalBalance:w,isLoading:l}),_jsxruntime.jsx.call(void 0, de,{groupedAssets:p,chains:u,tokenRegistry:h,getToken:d,useTokenWithLazyLoad:i,onAssetSelect:v})]}),e==="activity"&&_jsxruntime.jsx.call(void 0, pe,{isActive:e==="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:()=>{c(),_chunkUZWGYG2Scjs.c.getState().setView("swap")},onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),className:"w-full py-2 text-xs mono uppercase cursor-pointer transition-colors",style:{backgroundColor:s?"var(--widget-destructive)":"transparent",color:s?"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 = It;