@aori/mega-swap-widget 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/dist/AssetSelectionMenu-I53WKAWO.js +2 -0
- package/dist/AssetSelectionMenu-QVUV6BOC.cjs +2 -0
- package/dist/ChainSelectionMenu-O252URI3.cjs +2 -0
- package/dist/ChainSelectionMenu-TXGK72FH.js +2 -0
- package/dist/SwapFormHorizontal-72VZEZWP.js +2 -0
- package/dist/SwapFormHorizontal-MMVDC6GD.cjs +2 -0
- package/dist/SwapFormSplit-PQCNN45E.js +2 -0
- package/dist/SwapFormSplit-WBFUNXIC.cjs +2 -0
- package/dist/{WidgetWalletPanel-5H3BVAXR.cjs → WidgetWalletPanel-7TQ7PGCA.cjs} +1 -1
- package/dist/{WidgetWalletPanel-43R52FTI.js → WidgetWalletPanel-XOJZYWFF.js} +1 -1
- package/dist/WidgetWalletTradeHistory-5BGYCWLA.cjs +2 -0
- package/dist/WidgetWalletTradeHistory-5VQE4WGY.js +2 -0
- package/dist/chunk-3DUTGO4Q.js +2 -0
- package/dist/chunk-4AIDDZRO.js +2 -0
- package/dist/chunk-6EIIWGVO.cjs +2 -0
- package/dist/{chunk-PCI6C7N4.js → chunk-AV6C4H6H.js} +1 -1
- package/dist/chunk-BF4UK5A7.js +2 -0
- package/dist/chunk-CGCLB56N.cjs +2 -0
- package/dist/chunk-H3GNDVMT.cjs +2 -0
- package/dist/{chunk-35CBCDGI.js → chunk-IF7S6ZES.js} +5 -5
- package/dist/chunk-IZ7YHC7X.js +2 -0
- package/dist/{chunk-6KEQ2NDQ.cjs → chunk-JCH7AXAB.cjs} +1 -1
- package/dist/chunk-PD3AGQJP.cjs +2 -0
- package/dist/chunk-RF7FQVFX.js +2 -0
- package/dist/{chunk-OIE7DWV7.js → chunk-TUAHO7RQ.js} +1 -1
- package/dist/{chunk-6CVCMRAL.cjs → chunk-TZYKUGNP.cjs} +4 -4
- package/dist/{chunk-3FVOOU2E.cjs → chunk-URXRRWEJ.cjs} +1 -1
- package/dist/chunk-VGYWFUHR.cjs +2 -0
- package/dist/chunk-WUSQH743.cjs +2 -0
- package/dist/chunk-WV4DWRNY.js +2 -0
- package/dist/index.cjs +2 -2
- package/dist/index.css +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/AssetSelectionMenu-QAYGXIZN.cjs +0 -2
- package/dist/AssetSelectionMenu-XUE3KY7F.js +0 -2
- package/dist/ChainSelectionMenu-73IHIGGD.cjs +0 -2
- package/dist/ChainSelectionMenu-IFRFS3IB.js +0 -2
- package/dist/SwapFormHorizontal-MGK4QJBZ.js +0 -2
- package/dist/SwapFormHorizontal-PNSM7UFE.cjs +0 -2
- package/dist/SwapFormSplit-GLQEEJSQ.js +0 -2
- package/dist/SwapFormSplit-MT5WGEMG.cjs +0 -2
- package/dist/WidgetWalletTradeHistory-CW34HAHS.cjs +0 -2
- package/dist/WidgetWalletTradeHistory-QXIWCKMB.js +0 -2
- package/dist/chunk-2QYGEJLV.js +0 -2
- package/dist/chunk-6JPANU3S.js +0 -2
- package/dist/chunk-7MGPLHPI.cjs +0 -2
- package/dist/chunk-A3P6SA6P.cjs +0 -2
- package/dist/chunk-IRK2XRZH.js +0 -2
- package/dist/chunk-MNP2YHUY.js +0 -2
- package/dist/chunk-S2KAWPNR.js +0 -2
- package/dist/chunk-X7THKL37.cjs +0 -2
- package/dist/chunk-XLIAXB6G.cjs +0 -2
- package/dist/chunk-YQLGWDSC.cjs +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
|
|
2
|
-
var
|
|
2
|
+
var _chunkJCH7AXABcjs = require('./chunk-JCH7AXAB.cjs');var _chunkTZYKUGNPcjs = require('./chunk-TZYKUGNP.cjs');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _jsxruntime = require('react/jsx-runtime');var y=({toggle:x,side:w,onChainSelect:i,onChainHover:l,containerHeight:N})=>{let[a,d]=_react.useState.call(void 0, ""),r=_chunkTZYKUGNPcjs.x.call(void 0, a,300),v=_chunkJCH7AXABcjs.c.call(void 0, ),s=_chunkTZYKUGNPcjs.e.call(void 0, v),u=_react2.default.useMemo(()=>{if(!r)return s;let e=r.toLowerCase();return s.filter(n=>n.displayName.toLowerCase().includes(e)||n.name.toLowerCase().includes(e)||n.id.toString().includes(e))},[s,r]),f=_react.useCallback.call(void 0, e=>i(e),[i]);return _jsxruntime.jsxs.call(void 0, "div",{className:"w-full h-full flex flex-col",children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex-shrink-0",children:_jsxruntime.jsxs.call(void 0, "div",{className:"relative mt-1",children:[_jsxruntime.jsx.call(void 0, "input",{className:"w-full h-10 px-4 text-sm",style:{backgroundColor:"var(--widget-card)",color:"var(--widget-card-foreground)",border:"1px solid var(--widget-border)"},placeholder:"Search chains by name or chain ID...",autoComplete:"off",value:a,onChange:e=>d(e.target.value.toLowerCase())}),a&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>d(""),className:"absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer rounded-full px-2 py-1 text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)"},children:"clear"})]})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex-1 min-h-0 overflow-auto mt-2",style:{backgroundColor:"var(--widget-background)"},children:[_jsxruntime.jsx.call(void 0, "p",{className:"my-2 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:a?"Search Results":"Available Chains"}),u.length===0?_jsxruntime.jsx.call(void 0, "div",{className:"px-4 py-3 text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Chain Not Found"}):u.map(e=>_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"w-full flex items-center justify-between p-3 cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>f(e.id),onMouseEnter:()=>_optionalChain([l, 'optionalCall', _ => _(e.displayName)]),onMouseLeave:()=>_optionalChain([l, 'optionalCall', _2 => _2(null)]),children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex-shrink-0",children:_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.M,{chain:e.id,size:"md"})}),_jsxruntime.jsx.call(void 0, "span",{className:"text-base font-medium truncate",style:{color:"var(--widget-foreground)"},children:e.displayName})]}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs font-mono",style:{color:"var(--widget-muted-foreground)"},children:["Chain ID: ",e.id]})]},e.id))]})]})},M= exports.a =y;exports.a = M;
|
|
@@ -0,0 +1,2 @@
|
|
|
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; } async function _asyncOptionalChain(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 = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
|
|
2
|
+
var _chunkKH57FLSTcjs = require('./chunk-KH57FLST.cjs');var _chunkPD3AGQJPcjs = require('./chunk-PD3AGQJP.cjs');var _chunkJCH7AXABcjs = require('./chunk-JCH7AXAB.cjs');var _chunkTZYKUGNPcjs = require('./chunk-TZYKUGNP.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');var _chunkT3I3AJXVcjs = require('./chunk-T3I3AJXV.cjs');var _reactquery = require('@tanstack/react-query');var _react = require('react');function Ar(e){if(e.length===0)return 5e3;let l=Math.max(...e.map(s=>_nullishCoalesce(_optionalChain([_chunkTZYKUGNPcjs.c.call(void 0, s), 'optionalAccess', _2 => _2.blockTimeMs]), () => (2e3))));return Math.min(5e3,Math.max(1e3,l*2+1e3))}var kr=()=>{let{address:e}=_chunk34N36GUDcjs.a.call(void 0, ),t=_chunkJCH7AXABcjs.c.call(void 0, ),r=_reactquery.useQueryClient.call(void 0, ),c=_react.useRef.call(void 0, null),l=_react.useRef.call(void 0, !0),s=_react.useCallback.call(void 0, a=>{if(!e)return;let y=[...new Set(a.tokens.map(d=>d.asset.chainId))],g=Ar(y);c.current&&(clearTimeout(c.current),c.current=null),c.current=setTimeout(async()=>{if(c.current=null,!!l.current)try{let d=a.tokens.map(w=>({chainId:w.asset.chainId,tokenAddress:w.asset.address})),o=await _chunkTZYKUGNPcjs.H.call(void 0, e,d);if(o.balances.length===0)return;if(a.tokens.length>=2){let w=a.tokens[0].asset,u=a.tokens[1].asset,h=_chunkTZYKUGNPcjs.I.swap(e,w.chainId,w.address,u.chainId,u.address);r.setQueryData(h,o)}let n=_chunkTZYKUGNPcjs.I.bulk(e,t),v=r.getQueryData(n);if(v){let w=v.balances.map(u=>_nullishCoalesce(o.balances.find(f=>f.chainId===u.chainId&&f.token.toLowerCase()===u.token.toLowerCase()), () => (u)));for(let u of o.balances)w.some(h=>h.chainId===u.chainId&&h.token.toLowerCase()===u.token.toLowerCase())||w.push(u);for(let u of a.tokens)if(!o.balances.some(f=>f.chainId===u.asset.chainId&&f.token.toLowerCase()===u.asset.address.toLowerCase())){let f=w.findIndex(i=>i.chainId===u.asset.chainId&&i.token.toLowerCase()===u.asset.address.toLowerCase());f!==-1&&(w[f]={...w[f],balance:"0",shiftedBalance:"0"})}r.setQueryData(n,{balances:w})}}catch (e2){}},g)},[e,t,r]);return _react.useEffect.call(void 0, ()=>(l.current=!0,()=>{l.current=!1,c.current&&(clearTimeout(c.current),c.current=null)}),[]),{triggerBalanceUpdate:s}},ot=class extends EventTarget{emit(t){this.dispatchEvent(new CustomEvent("balance-update",{detail:t}))}},at=new ot,Oe= exports.b =()=>e=>at.emit(e),as= exports.c =()=>{let{triggerBalanceUpdate:e}=kr();_react.useEffect.call(void 0, ()=>{let t=r=>{e(r.detail)};return at.addEventListener("balance-update",t),()=>at.removeEventListener("balance-update",t)},[e])};var _viem = require('viem');var _jsxruntime = require('react/jsx-runtime');var Mt=_react.createContext.call(void 0, void 0),Ut=1e4,$r=3e4,Ur=1e3,Mr=2;function Lr(e){return _nullishCoalesce(e.find(r=>_optionalChain([r, 'access', _3 => _3.routeSteps, 'optionalAccess', _4 => _4[0], 'optionalAccess', _5 => _5.type])==="AORI_V1"), () => (e[0]))}var fs=({children:e,recipient:t})=>{let{address:r}=_chunk34N36GUDcjs.a.call(void 0, ),c=t||r,[l,s]=_react.useState.call(void 0, "idle"),[a,y]=_react.useState.call(void 0, "idle"),[g,d]=_react.useState.call(void 0, null),[o,n]=_react.useState.call(void 0, null),[v,w]=_react.useState.call(void 0, !1),[u,h]=_react.useState.call(void 0, !1),[f,i]=_react.useState.call(void 0, !1),p=_react.useRef.call(void 0, null),x=_react.useRef.call(void 0, null),m=_react.useRef.call(void 0, null),k=_react.useRef.call(void 0, null),P=_react.useRef.call(void 0, null),S=_react.useRef.call(void 0, 0),U=_react.useRef.call(void 0, 0),L=_react.useRef.call(void 0, 0),N=_react.useRef.call(void 0, !1),E=_react.useRef.call(void 0, new Map),A=_react.useCallback.call(void 0, ()=>{m.current&&clearTimeout(m.current),k.current&&clearTimeout(k.current),P.current&&clearTimeout(P.current),m.current=null,k.current=null,P.current=null},[]),M=_react.useCallback.call(void 0, ()=>{A(),p.current=null,S.current=0,s(()=>N.current?"fresh":"idle")},[A]),V=_react.useCallback.call(void 0, ()=>{M(),x.current=null,d(null),n(null),w(!1),h(!1),i(!1),E.current.clear(),s("idle"),y("idle")},[M]),ce=_react.useCallback.call(void 0, C=>{if(!C)return;k.current&&clearTimeout(k.current);let T=Math.max(0,C+$r-Date.now());k.current=setTimeout(()=>{s($=>$==="idle"?"idle":"stale")},T)},[]),K=_react.useCallback.call(void 0, async(C,T)=>{let{inputToken:$,outputToken:O,inputAmount:q,setOutputAmount:Z}=C;if(!$||!O||!q||parseFloat(q)<=0||Date.now()-(U.current||0)<Ut-10)return;let _e=++S.current;try{if(!_optionalChain([$, 'optionalAccess', _6 => _6.decimals])||!_optionalChain([O, 'optionalAccess', _7 => _7.decimals]))return;let j=_chunkTZYKUGNPcjs.F.call(void 0, $.chainId)||_optionalChain([_chunkTZYKUGNPcjs.c.call(void 0, $.chainId), 'optionalAccess', _8 => _8.key])||"",le=_chunkTZYKUGNPcjs.F.call(void 0, O.chainId)||_optionalChain([_chunkTZYKUGNPcjs.c.call(void 0, O.chainId), 'optionalAccess', _9 => _9.key])||"";if(!j||!le)throw new Error("Unknown chain");let ee=_viem.parseUnits.call(void 0, q.toString(),$.decimals).toString(),Te={srcChainKey:j,dstChainKey:le,srcTokenAddress:_chunkTZYKUGNPcjs.v.call(void 0, $.address),dstTokenAddress:_chunkTZYKUGNPcjs.v.call(void 0, O.address),amount:ee,srcWalletAddress:r||"0x0000000000000000000000000000000000000000",dstWalletAddress:c||r||"0x0000000000000000000000000000000000000000",options:{amountType:"EXACT_SRC_AMOUNT",feeTolerance:{type:"PERCENT",amount:2}}};U.current=Date.now();let te=await fetch(`${_chunkTZYKUGNPcjs.k.call(void 0, )}/quotes`,{method:"POST",headers:_chunkTZYKUGNPcjs.m.call(void 0, ),body:JSON.stringify(Te),signal:AbortSignal.timeout(15e3)});if(!te.ok){let Re=await _asyncOptionalChain([(await te.json().catch(()=>({}))), 'optionalAccess', async _10 => _10.message])||te.statusText;throw Object.assign(new Error(Re),{status:te.status})}let ne=await te.json();if(_e!==S.current||p.current!==T)return;let Ue=_nullishCoalesce(ne.quotes, () => ([])),ue=Lr(Ue);if(!ue)throw Object.assign(new Error("No quotes returned"),{emptyQuotes:!0});let Ze=Number(_viem.formatUnits.call(void 0, _chunkTZYKUGNPcjs.q.call(void 0, ue.dstAmount),O.decimals));typeof Z=="function"&&Z(Ze),ue._receivedAt=Date.now(),d(ue),n(null),w(!1),s("fresh"),ce(ue._receivedAt),T&&E.current.delete(T)}catch(j){if(_e!==S.current||p.current!==T)return;let le=_optionalChain([j, 'optionalAccess', _11 => _11.status]),ee=j instanceof Error?j.message:"",Te=!!_optionalChain([j, 'optionalAccess', _12 => _12.emptyQuotes]);if((le===400||Te||ee.includes("Quote request failed"))&&T){let ne=(E.current.get(T)||0)+1;if(E.current.set(T,ne),ne>=Mr){h(!0),A(),p.current=null;return}}if(ee.toLowerCase().includes("order cap exceeded")){i(!0),A(),p.current=null;return}if(ee.toLowerCase().includes("insufficient executor balance")){w(!0),A(),p.current=null;return}n(j instanceof Error?j.message:"Unknown error")}},[r,c,ce,A]),D=_react.useCallback.call(void 0, (C,T)=>{A(),x.current=C,U.current=0,E.current.delete(T),w(!1),h(!1),i(!1),n(null),s("polling");let $=async()=>{p.current===T&&(await K(C,T),p.current===T&&(m.current=setTimeout($,Ut)))};$()},[A,K]),I=_react.useCallback.call(void 0, C=>{if(!_optionalChain([C, 'optionalAccess', _13 => _13.inputToken])||!_optionalChain([C, 'optionalAccess', _14 => _14.outputToken])||!_optionalChain([C, 'optionalAccess', _15 => _15.inputAmount])||parseFloat(C.inputAmount)<=0){M();return}let T=x.current;if(T&&_optionalChain([T, 'access', _16 => _16.inputToken, 'optionalAccess', _17 => _17.address])===_optionalChain([C, 'access', _18 => _18.inputToken, 'optionalAccess', _19 => _19.address])&&_optionalChain([T, 'access', _20 => _20.inputToken, 'optionalAccess', _21 => _21.chainId])===_optionalChain([C, 'access', _22 => _22.inputToken, 'optionalAccess', _23 => _23.chainId])&&_optionalChain([T, 'access', _24 => _24.outputToken, 'optionalAccess', _25 => _25.address])===_optionalChain([C, 'access', _26 => _26.outputToken, 'optionalAccess', _27 => _27.address])&&_optionalChain([T, 'access', _28 => _28.outputToken, 'optionalAccess', _29 => _29.chainId])===_optionalChain([C, 'access', _30 => _30.outputToken, 'optionalAccess', _31 => _31.chainId])&&T.inputAmount===C.inputAmount&&p.current)return;let O=Date.now();if(O-L.current<100)return;L.current=O;let q=`${Date.now()}-${Math.random().toString(36).slice(2)}`;p.current=q,D(C,q)},[D,M]),F=_react.useCallback.call(void 0, ({amount:C,inputToken:T,outputToken:$,setOutputAmount:O})=>{O(null),P.current&&clearTimeout(P.current),!C||C===0?(y("idle"),M(),d(null),n(null),w(!1),h(!1),i(!1)):(y("typing"),M(),d(null),w(!1),h(!1),i(!1),n(null),P.current=setTimeout(()=>{y("settled"),T&&$&&C>0&&I({inputToken:T,outputToken:$,inputAmount:C.toString(),setOutputAmount:O})},Ur))},[M,I]),B=_react.useCallback.call(void 0, ()=>{let C=x.current;if(!C)return;d(null);let T=`${Date.now()}-${Math.random().toString(36).slice(2)}`;p.current=T,s("refreshing"),typeof C.setOutputAmount=="function"&&C.setOutputAmount(null),D(C,T)},[D]);_react.useEffect.call(void 0, ()=>{N.current=!!g},[g]),_react.useEffect.call(void 0, ()=>()=>A(),[A]);let X=_react.useMemo.call(void 0, ()=>({status:l,inputState:a,rfqQuote:g,error:o,liquidityError:v,routingError:u,sizeCapError:f,ensureForParams:I,stop:M,refresh:B,clear:V,handleInputChange:F}),[l,a,g,o,v,u,f,I,M,B,V,F]);return _jsxruntime.jsx.call(void 0, Mt.Provider,{value:X,children:e})},Be= exports.e =()=>{let e=_react.useContext.call(void 0, Mt);if(e===void 0)throw new Error("useRfq must be used within an RfqProvider");return e};var _r=_react.createContext.call(void 0, {openConnectModal:()=>{}}),ys= exports.g =()=>_react.useContext.call(void 0, _r);var Fr=20,Br=({side:e,asset:t,otherAsset:r,isPlacingOrder:c,isWrappingPair:l,isUnwrappingPair:s})=>{let{baseAmount:a,quoteAmount:y,setBaseAmount:g,setQuoteAmount:d}=_chunkPD3AGQJPcjs.f.call(void 0, ),{amountInputVariant:o,hideAmountInputSymbol:n,widgetType:v}=_chunkJCH7AXABcjs.b.call(void 0, ),w=v==="compact",[u,h]=e==="base"?[g,d]:[d,g],f=!t||e==="quote"||c,i=w?32:o==="default"?64:32,[p,x]=_react.useState.call(void 0, i),[m,k]=_react.useState.call(void 0, ""),P=_react.useRef.call(void 0, null),S=_react.useRef.call(void 0, null),U=_react.useRef.call(void 0, null),L=_react.useRef.call(void 0, null),N="USD",E=e==="base"?a:y,[A,M]=_react.useState.call(void 0, !1),V=_react.useCallback.call(void 0, ()=>{if(o!=="default"){x(i);return}if(!P.current||!S.current||!U.current)return;let D=P.current.offsetWidth,I=20,F=i;for(;F>20&&(S.current.style.fontSize=`${F}px`,U.current.style.fontSize=`${F}px`,!(S.current.offsetWidth+U.current.offsetWidth+I<=D));)F-=1;x(F)},[o,i]),ce=_react.useCallback.call(void 0, D=>{D.key==="."&&m.includes(".")&&D.preventDefault()},[m]),K=_react.useCallback.call(void 0, D=>{let I=D.target.value;if(I==="."&&(I="0."),!/^\d*\.?\d*$/.test(I)||(I.match(/\./g)||[]).length>1)return;if(I.length>1&&I[0]==="0"&&I[1]!=="."&&(I=I.replace(/^0+/,"")||"0"),_optionalChain([t, 'optionalAccess', _32 => _32.decimals])!==void 0&&I.includes(".")){let[,B]=I.split(".");if(B&&B.length>t.decimals)return}if(I.length>Fr)return;k(I);let F=parseFloat(I);I!==m&&(I===""||I==="0."||I.endsWith(".")?(u(null),e==="base"&&h(null)):!Number.isNaN(F)&&F>=0&&u(F),e==="base"&&d(null),(s||l)&&d(F||0))},[m,u,e,d,_optionalChain([t, 'optionalAccess', _33 => _33.decimals]),h,s,l]);return _react.useEffect.call(void 0, ()=>{let D=B=>{if(B===null)return"";let X=_optionalChain([t, 'optionalAccess', _34 => _34.decimals]);if(X===void 0)return"";let C=B.toString();if(/e/i.test(C)&&(C=Number(B).toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:X})),C.includes(".")){let[T,$]=C.split("."),O=$.slice(0,X);return O?`${T}.${O}`:T}return C};if(E===null){m==="0."||m!==""&&m.endsWith(".")||k("");return}if(!f&&(m.endsWith(".")||m.match(/\.\d*0$/)||m==="0"||m==="0.")&&m!=="")return;let F=parseFloat(m)||0;(m===""||Math.abs(F-E)>1e-10)&&k(D(E))},[E,_optionalChain([t, 'optionalAccess', _35 => _35.decimals]),m,f]),_react.useEffect.call(void 0, ()=>{V()},[m,V]),_react.useEffect.call(void 0, ()=>{M(!0)},[]),_react.useEffect.call(void 0, ()=>{A&&V()},[A,V]),_react.useEffect.call(void 0, ()=>{S.current&&L.current&&(L.current.style.width=`${S.current.offsetWidth}px`)},[m]),_react.useEffect.call(void 0, ()=>{if(!A)return;let D=new ResizeObserver(()=>{A&&V()});return P.current&&D.observe(P.current),()=>D.disconnect()},[A,V]),_jsxruntime.jsx.call(void 0, "div",{ref:P,style:{fontSize:`${p}px`,transition:"font-size 0.05s ease-in-out"},className:`mt-2 box-border flex ${w?o==="normal"?"h-12 my-1":"h-10 my-0.5":o==="normal"?"h-12 my-1":"h-20 my-1"} w-full flex-row items-center ${f?"cursor-default":"cursor-text"}`,onClick:()=>_optionalChain([L, 'access', _36 => _36.current, 'optionalAccess', _37 => _37.focus, 'call', _38 => _38()]),children:_jsxruntime.jsxs.call(void 0, "div",{className:"relative flex w-full items-center",children:[_jsxruntime.jsx.call(void 0, "label",{htmlFor:`${e}Amount`,className:"sr-only",children:e==="base"?"Input token amount":"Output token amount"}),_jsxruntime.jsx.call(void 0, "input",{ref:L,type:"text",inputMode:"decimal",placeholder:"0",autoComplete:"off",id:`${e}Amount`,value:m,onWheel:D=>D.target.blur(),onKeyDown:ce,onChange:K,style:{transition:"width 0.15s ease-in-out",color:"var(--widget-foreground)",WebkitTextFillColor:"var(--widget-foreground)",opacity:f?.4:1},className:"flex min-w-[45px] whitespace-nowrap bg-transparent placeholder:opacity-50",disabled:f}),_jsxruntime.jsx.call(void 0, "span",{style:{transition:"width 0.15s ease-in-out"},ref:S,className:"pointer-events-none absolute flex whitespace-nowrap invisible",children:m||0}),!n&&o!=="normal"&&_jsxruntime.jsx.call(void 0, "span",{ref:U,className:"ml-2 font-light uppercase",style:{color:"var(--widget-foreground)",opacity:.5,fontSize:`${p}px`},children:_optionalChain([t, 'optionalAccess', _39 => _39.symbol])?t.symbol.length>6?`${t.symbol.slice(0,6)}...`:t.symbol:N}),(n||o==="normal")&&_jsxruntime.jsx.call(void 0, "span",{ref:U,className:"hidden"})]})})},Ts= exports.h =Br;var qr=({toggle:e,side:t,asset:r,isPlacingOrder:c,hideDropdown:l})=>{let{baseBalance:s,quoteBalance:a}=_chunkPD3AGQJPcjs.f.call(void 0, ),{tokenDisplay:y,tokenBadgeOrientation:g,widgetType:d}=_chunkJCH7AXABcjs.b.call(void 0, ),o=d==="compact",n=o?"h-10":"h-12",v=o?"h-10 w-10":"h-12 w-12",w=t==="base"?s.formatted?(()=>{let h=parseFloat(s.formatted);return h>=1e8?_chunkTZYKUGNPcjs.o.call(void 0, h):h.toFixed(3)})():void 0:a.formatted?(()=>{let h=parseFloat(a.formatted);return h>=1e8?_chunkTZYKUGNPcjs.o.call(void 0, h):h.toFixed(3)})():void 0,u={role:"button",tabIndex:c?-1:0,"aria-disabled":c,"aria-label":`Select ${t==="base"?"input":"output"} token${r?`: ${r.symbol}`:""}`,onClick:c?void 0:e,onKeyDown:c?void 0:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),e())}};return y==="pill"?_jsxruntime.jsx.call(void 0, "div",{...u,className:`inline-flex items-center gap-1.5 h-7 px-2.5 rounded-full cursor-pointer transition-colors ${g==="right"?"ml-auto":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)"},children:r?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.M,{chain:r.chainId,size:"xs"}),_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.N,{className:"rounded-full",asset:r,size:"xxs",noChain:!0}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-medium uppercase",children:r.symbol}),!l&&_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.T,{className:"w-1.5 opacity-60",style:{color:"var(--widget-secondary-foreground)"}})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-xs opacity-70",children:"Select"}),!l&&_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.T,{className:"w-1.5 opacity-60",style:{color:"var(--widget-secondary-foreground)"}})]})}):y==="ghost"?_jsxruntime.jsxs.call(void 0, "div",{...u,className:"inline-flex items-center gap-1.5 cursor-pointer transition-opacity hover:opacity-70 py-1",style:{color:"var(--widget-foreground)"},children:[r?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.M,{chain:r.chainId,size:"xs"}),_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.N,{className:"rounded-full",asset:r,size:"xxs",noChain:!0}),_jsxruntime.jsx.call(void 0, "span",{className:"text-sm font-medium uppercase",children:r.symbol})]}):_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Select token"}),!l&&_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.T,{className:"w-1.5 opacity-50"})]}):_jsxruntime.jsx.call(void 0, "div",{...u,className:`relative ${n} w-full cursor-pointer text-xl duration-100 ease-linear`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-secondary)",borderTopLeftRadius:"9999px",borderBottomLeftRadius:"9999px",borderTopRightRadius:"var(--widget-radius)",borderBottomRightRadius:"var(--widget-radius)"},children:_jsxruntime.jsx.call(void 0, "div",{className:"relative flex h-full w-full flex-row items-center",children:r?_jsxruntime.jsxs.call(void 0, "div",{className:"relative flex h-full w-full flex-row items-center",children:[_jsxruntime.jsx.call(void 0, "div",{className:`${v} pl-px flex items-center justify-center`,children:_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.N,{className:"rounded-full",asset:r,size:"md"})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row items-center justify-between pl-1.5 pr-7",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full flex-col justify-center",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-medium uppercase",style:{color:"var(--widget-secondary-foreground)"},children:r.symbol}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-2xs font-mono",style:{color:"var(--widget-secondary-foreground)",opacity:.6},children:[_optionalChain([r, 'access', _40 => _40.address, 'optionalAccess', _41 => _41.slice, 'call', _42 => _42(0,6)]),"...",_optionalChain([r, 'access', _43 => _43.address, 'optionalAccess', _44 => _44.slice, 'call', _45 => _45(-4)])]})]}),w!==void 0&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col text-right",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-2xs",style:{color:"var(--widget-secondary-foreground)",opacity:.5},children:"Balance"}),_jsxruntime.jsx.call(void 0, "span",{className:"font-mono text-xs tabular-nums",style:{color:"var(--widget-secondary-foreground)"},children:w})]})]}),!l&&_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.T,{className:"absolute right-3 top-1/2 w-1.5 translate-y-[-50%]",style:{color:"var(--widget-secondary-foreground)",opacity:.6}})]}):_jsxruntime.jsx.call(void 0, "div",{className:"flex h-full w-full items-center justify-center",children:_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",style:{color:"var(--widget-secondary-foreground)",opacity:.7},children:"Select token"})})})})},Is= exports.i =qr;var Wt=_chunkT3I3AJXVcjs.b.call(void 0, _chunkKH57FLSTcjs.a.call(void 0, ),1);var Qr=()=>{let[e,t]=_react.useState.call(void 0, null),[r,c]=_react.useState.call(void 0, ""),l=_chunkTZYKUGNPcjs.x.call(void 0, r,1e3),[s,a]=_react.useState.call(void 0, !1),[y,g]=_react.useState.call(void 0, "");_react.useEffect.call(void 0, ()=>{_chunkPD3AGQJPcjs.c.getState().setRecipient(e)},[e]),_react.useEffect.call(void 0, ()=>{c(e||"")},[e]);let d=n=>{let v=n.target.value;s&&(a(!1),g(""),t(null)),c(v),v===""&&t(null)};_react.useEffect.call(void 0, ()=>{l===""||!l?(a(!1),g(""),t(null)):_chunkTZYKUGNPcjs.w.call(void 0, l)?(a(!1),g(""),t(l)):(a(!0),g("Invalid wallet address..."),t(null),c(""))},[l]),_react.useEffect.call(void 0, ()=>{if(s){let n=setTimeout(()=>{t(null),c(""),a(!1),g("")},2e3);return()=>clearTimeout(n)}},[s]);let o=()=>{t(null),c(""),a(!1),g("")};return _jsxruntime.jsx.call(void 0, "div",{className:"w-full",children:_jsxruntime.jsxs.call(void 0, "div",{className:"relative flex flex-row items-center",children:[_jsxruntime.jsx.call(void 0, "input",{type:"password",style:{display:"none"},"aria-hidden":"true",tabIndex:-1}),_jsxruntime.jsx.call(void 0, "label",{htmlFor:"recipient-address",className:"sr-only",children:"Recipient wallet address"}),_jsxruntime.jsx.call(void 0, "div",{className:"absolute left-3 flex h-6 w-6 items-end justify-center overflow-hidden rounded-full",style:{backgroundColor:"var(--widget-secondary)"},children:e&&!s?_jsxruntime.jsx.call(void 0, "img",{className:"h-full w-full rounded-full object-cover",src:(0,Wt.makeGradient)(e),alt:"Recipient avatar"}):_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.S,{className:"h-5 w-5",style:{color:s?"var(--widget-destructive)":"var(--widget-muted-foreground)"}})}),_jsxruntime.jsx.call(void 0, "div",{className:"absolute left-12 top-1.5 -translate-y-1 text-xs font-medium opacity-60",style:{color:s?"var(--widget-destructive)":"var(--widget-muted-foreground)"},"aria-hidden":"true",children:"To:"}),_jsxruntime.jsx.call(void 0, "input",{id:"recipient-address",className:"mono block h-10 w-full items-center pl-12 pt-4 pr-8 text-xs",style:{backgroundColor:s?"color-mix(in srgb, var(--widget-destructive) 10%, transparent)":"transparent",color:s?"var(--widget-destructive)":"var(--widget-foreground)",outline:"none",opacity:s?.9:1},placeholder:s?y:"Enter recipient address...",value:r,onChange:d,spellCheck:!1,"aria-invalid":s,"aria-describedby":s?"recipient-error":void 0}),s&&_jsxruntime.jsx.call(void 0, "span",{id:"recipient-error",className:"sr-only",children:y}),e&&!s&&_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer flex items-center justify-center h-4 w-4 rounded-full transition-colors hover:[color:var(--widget-destructive)]",style:{color:"var(--widget-muted-foreground)"},onClick:o,"aria-label":"Clear recipient",children:[_jsxruntime.jsx.call(void 0, "svg",{className:"h-2.5 w-2.5",viewBox:"0 -0.5 21 21",fill:"none",children:_jsxruntime.jsx.call(void 0, "g",{fill:"currentColor",fillRule:"evenodd",children:_jsxruntime.jsx.call(void 0, "polygon",{points:"375.0183 90 384 98.554 382.48065 100 373.5 91.446 364.5183 100 363 98.554 371.98065 90 363 81.446 364.5183 80 373.5 88.554 382.48065 80 384 81.446",transform:"translate(-363 -80)"})})}),_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Clear recipient"})]})]})})},Ws= exports.j =Qr;function _s(e){return _jsxruntime.jsxs.call(void 0, "svg",{width:"485",height:"484",viewBox:"0 0 485 484",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[_jsxruntime.jsx.call(void 0, "path",{d:"M265.974 52.8127C270.567 50.9299 273.227 53.6338 275.917 56.1595C301.879 80.5364 327.828 104.927 353.786 129.308C380.101 154.024 406.44 178.715 432.721 203.467C436.002 206.557 440.744 209.272 438.226 215.021C435.865 220.415 430.758 219.123 426.424 219.124C305.965 219.169 185.506 219.163 65.0464 219.166C53.0995 219.166 49.0676 215.225 49.0125 203.316C48.9563 191.154 48.9813 178.991 48.9973 166.829C49.0119 155.717 53.3581 151.358 64.4131 151.358C127.892 151.357 191.37 151.364 254.849 151.368C262.591 151.368 262.645 151.344 262.588 143.559C262.388 116.237 262.191 88.914 261.918 61.5922C261.883 58.0834 262.161 54.9042 265.974 52.8127Z",fill:"currentColor"}),_jsxruntime.jsx.call(void 0, "path",{d:"M80.5649 300.432C71.3447 291.747 62.4175 283.264 53.4064 274.87C50.4552 272.122 47.8959 269.327 49.7894 264.946C51.6154 260.72 55.4624 260.923 59.1682 260.923C164.476 260.927 269.785 260.932 375.093 260.935C391.422 260.935 407.752 260.9 424.081 260.933C434.679 260.955 438.994 265.286 439.015 275.854C439.04 288.517 439.048 301.181 439.013 313.845C438.985 324.225 434.466 328.73 424.01 328.732C360.359 328.741 296.707 328.729 233.056 328.714C225.392 328.713 225.368 328.686 225.426 336.583C225.628 363.741 225.815 390.9 226.101 418.057C226.142 421.935 225.905 425.512 221.852 427.329C217.686 429.197 214.934 426.578 212.212 424.02C172.068 386.302 131.922 348.587 91.7738 310.874C88.1374 307.459 84.4753 304.07 80.5649 300.432Z",fill:"currentColor"})]})}var Hr=["SUCCEEDED","FAILED","COMPLETED","CANCELLED"];async function Vt(e,t,r={}){let{onStatusChange:c,onComplete:l,onError:s,interval:a=4e3,timeout:y=3e5,txHash:g,signal:d}=r,o=null,n=Date.now(),v=0,w=8,u=null,h=g?`?txHash=${g}`:"";return new Promise((f,i)=>{let p=async()=>{try{if(_optionalChain([d, 'optionalAccess', _46 => _46.aborted])){u&&clearTimeout(u),i(new DOMException("Polling aborted","AbortError"));return}if(Date.now()-n>y){u&&clearTimeout(u);let P=new Error("Order status polling timed out");_optionalChain([s, 'optionalCall', _47 => _47(P)]),i(P);return}let x=await fetch(`${t}/status/${e}${h}`,{headers:_chunkTZYKUGNPcjs.m.call(void 0, ),signal:d});if(x.status===404){u=setTimeout(p,a);return}if(!x.ok)throw new Error(`Failed to fetch order status: ${await x.text()}`);let m=await x.json();if(!m||typeof m!="object"||!m.status)throw new Error(`Invalid status response format: ${JSON.stringify(m)}`);v=0;let k=m.status.toUpperCase();if(k!==o&&(o=k,_optionalChain([c, 'optionalCall', _48 => _48(m)])),Hr.includes(k)){u&&clearTimeout(u),_optionalChain([l, 'optionalCall', _49 => _49(m)]),f(m);return}u=setTimeout(p,a)}catch(x){if(x instanceof Error&&x.name==="AbortError"){u&&clearTimeout(u),i(x);return}if(++v>=w){u&&clearTimeout(u);let m=x instanceof Error?x:new Error(String(x));_optionalChain([s, 'optionalCall', _50 => _50(m)]),i(m);return}u=setTimeout(p,a)}};p()})}function _t(e){let t=e.toUpperCase();return t==="SUCCEEDED"||t==="COMPLETED"?"completed":t==="FAILED"?"failed":t==="CANCELLED"?"cancelled":t==="PROCESSING"?"received":"pending"}var Ft=e=>{let t=_react.useRef.call(void 0, new Map),r=_react.useRef.call(void 0, new Map),c=_react.useRef.call(void 0, new Map),l=_react.useRef.call(void 0, 0),s=_react.useCallback.call(void 0, ()=>++l.current,[]),{address:a}=_chunk34N36GUDcjs.a.call(void 0, ),y=Oe(),g=_react.useCallback.call(void 0, (n,v)=>{if(t.current.get(n))return;v&&r.current.set(n,v),t.current.set(n,!0);let w=l.current,u=new AbortController;c.current.set(n,u);let h=_optionalChain([v, 'optionalAccess', _51 => _51.baseToken, 'optionalAccess', _52 => _52.chainId])===1;Vt(n,_chunkTZYKUGNPcjs.k.call(void 0, ),{interval:h?1e3:500,timeout:3e5,signal:u.signal,onStatusChange:f=>{if(!_optionalChain([f, 'optionalAccess', _53 => _53.status]))return;let i=_t(f.status);if(_optionalChain([e, 'optionalCall', _54 => _54(n,i,f.explorerUrl)]),i==="completed"&&a){let p=r.current.get(n);if(p&&(p.baseToken||p.quoteToken)){let x=[];p.baseToken&&x.push({asset:p.baseToken,userAddress:a}),p.quoteToken&&x.push({asset:p.quoteToken,userAddress:a}),y({type:"swap",tokens:x})}}["completed","failed","cancelled"].includes(i)&&(t.current.delete(n),r.current.delete(n)),w!==l.current&&(t.current.delete(n),r.current.delete(n))},onComplete:f=>{_optionalChain([f, 'optionalAccess', _55 => _55.status])&&_optionalChain([e, 'optionalCall', _56 => _56(n,_t(f.status),f.explorerUrl)]),t.current.delete(n),r.current.delete(n)},onError:()=>{t.current.delete(n),r.current.delete(n)}}).catch(f=>{f instanceof Error&&f.name==="AbortError"||(t.current.delete(n),r.current.delete(n),c.current.delete(n))})},[a,y,e]),d=_react.useCallback.call(void 0, n=>{let v=c.current.get(n);v&&(v.abort(),c.current.delete(n)),s(),t.current.delete(n),r.current.delete(n)},[s]),o=_react.useCallback.call(void 0, ()=>{for(let n of c.current.values())n.abort();c.current.clear(),s(),t.current.clear(),r.current.clear()},[s]);return _react.useEffect.call(void 0, ()=>()=>o(),[o]),{startPolling:g,stopPolling:d,stopAllPolling:o,isPolling:n=>t.current.has(n)}};var Yr=_react.createContext.call(void 0, {registerTransaction:()=>{},enabled:!1}),Bt= exports.n =()=>_react.useContext.call(void 0, Yr);var _actions = require('viem/actions');function qt(e){return e instanceof Error?e.name==="UserRejectedRequestError"||e.message.includes("User rejected")||e.message.includes("rejected")||e.message.includes("denied")||e.message.includes("cancelled")||e.message.includes("canceled"):!1}async function zt(e){if(_optionalChain([e, 'access', _57 => _57.chain, 'optionalAccess', _58 => _58.id]))return e.chain.id;let t=_optionalChain([e, 'access', _59 => _59.getChainId, 'optionalCall', _60 => _60()]);return t!=null?await t:null}var Zr=async(e,t)=>{try{if(await zt(e)===t)return!0;if(e.request)await e.request({method:"wallet_switchEthereumChain",params:[{chainId:`0x${t.toString(16)}`}]});else if(e.switchChain)await e.switchChain({id:t});else if(e.send)await e.send("wallet_switchEthereumChain",[{chainId:`0x${t.toString(16)}`}]);else throw new Error("Wallet doesn't support chain switching");return await zt(e)===t}catch(r){throw qt(r)?new Error("User rejected the chain switch request"):new Error(`Please switch your wallet to the required network (Chain ID: ${t})`)}},Qt= exports.p =async e=>{let{quote:t,signatureStep:r,userAddress:c,walletClient:l}=e;if(!l)throw new Error("Wallet client not available");if(r.type!=="SIGNATURE"||!_optionalChain([r, 'access', _61 => _61.signature, 'optionalAccess', _62 => _62.typedData]))throw new Error("Invalid signature step");try{let s=r.signature.typedData,a={...s.message};for(let o of["inputAmount","outputAmount","startTime","endTime"])a[o]!=null&&(a[o]=BigInt(a[o]));let y=s.domain;if(y.chainId!=null){let o=Number(y.chainId);await Zr(l,o)}let g=await _actions.signTypedData.call(void 0, l,{account:c,domain:y,types:s.types,primaryType:s.primaryType,message:a}),d=await fetch(`${_chunkTZYKUGNPcjs.k.call(void 0, )}/submit-signature`,{method:"POST",headers:_chunkTZYKUGNPcjs.m.call(void 0, ),body:JSON.stringify({quoteId:t.id,signatures:[g]})});if(!d.ok){let o=await d.json().catch(()=>({}));throw new Error(_optionalChain([o, 'optionalAccess', _63 => _63.message])||`Submit failed: ${d.status}`)}return{quoteId:t.id,signature:g}}catch(s){throw qt(s)?new Error("User rejected the signing request"):s instanceof Error&&s.message.includes("chain")?new Error("Chain switching failed. Please manually switch to the correct network."):s}};var jt="vt_submitted_quotes";var ut=()=>{try{let e=localStorage.getItem(jt);return e?JSON.parse(e):[]}catch (e3){return[]}},Ht=e=>{try{localStorage.setItem(jt,JSON.stringify(e))}catch (e4){}},en= exports.q =e=>{let t=Date.now(),r=typeof e=="string"?new Date(e).getTime():e>9999999999?e:e*1e3;return t<r+3e4},tn=e=>ut().some(t=>t.quoteId===e),Gt= exports.r =(e,t)=>tn(e)?{canSubmit:!1,reason:"Order already submitted"}:en(t)?{canSubmit:!0}:{canSubmit:!1,reason:"Quote has expired"},Kt= exports.s =(e,t)=>{let r=typeof t=="string"?new Date(t).getTime():t,c=ut();c.push({quoteId:e,submittedAt:Date.now(),createdAt:r}),Ht(c)},Xt= exports.t =()=>{let e=ut(),t=Date.now(),r=300*1e3,c=e.filter(l=>t-l.submittedAt<r);c.length!==e.length&&Ht(c)};var _core = require('@wagmi/core');var _abis = require('abitype/abis');var _wagmi = require('wagmi');function Yt(){let e=_wagmi.useConfig.call(void 0, );return _reactquery.useMutation.call(void 0, {mutationFn:async({chainId:t,accountAddress:r,amountRaw:c,writeContractAsync:l})=>{let s=_chunkTZYKUGNPcjs.c.call(void 0, t);if(!s)throw new Error(`No wrapping contract for chain ${t}`);let a=s.wrappedAsset.address,y=await l({abi:_abis.wethAbi,functionName:"withdraw",address:a,account:r,args:[c],chainId:t});if((await _core.waitForTransactionReceipt.call(void 0, e,{hash:y,chainId:t,confirmations:1,pollingInterval:4e3})).status!=="success")throw new Error("Unwrap transaction did not get successful receipt");return{success:!0,hash:y}}})}function Jt(){let e=_wagmi.useConfig.call(void 0, );return _reactquery.useMutation.call(void 0, {mutationFn:async({chainId:t,accountAddress:r,amountRaw:c,writeContractAsync:l})=>{let s=_chunkTZYKUGNPcjs.c.call(void 0, t);if(!s)throw new Error(`No wrapping contract for chain ${t}`);let a=s.wrappedAsset.address,y=await l({abi:_abis.wethAbi,functionName:"deposit",address:a,account:r,value:c,chainId:t});if((await _core.waitForTransactionReceipt.call(void 0, e,{hash:y,chainId:t,confirmations:1,pollingInterval:4e3})).status!=="success")throw new Error("Wrap transaction did not get successful receipt");return{success:!0,hash:y}}})}function er(){let{registerTransaction:e,enabled:t}=Bt(),r=_react.useRef.call(void 0, new Set),c=_react.useCallback.call(void 0, (s,a)=>{!t||r.current.has(s)||(r.current.add(s),e(s,a))},[t,e]),l=_react.useCallback.call(void 0, (s,a)=>{!t||r.current.has(s)||(r.current.add(s),e(s,a))},[t,e]);return{trackOrderTransaction:c,trackNativeTransaction:l,txTrackingEnabled:t}}var wn=15e3,Ge="chain",hn=({needsChainSwitch:e,requiredChain:t,reviewState:r,goToNextStep:c,cancel:l})=>{let s=_chunkTZYKUGNPcjs.r.call(void 0, Ge,r),[a,y]=_react.useState.call(void 0, "pending"),g=_react.useRef.call(void 0, !1),d=_react.useRef.call(void 0, !1),o=_react.useRef.call(void 0, null),n=_wagmi.useChainId.call(void 0, ),{switchChainAsync:v}=_wagmi.useSwitchChain.call(void 0, ),{status:w,isReconnecting:u}=_wagmi.useAccount.call(void 0, ),h=_react.useCallback.call(void 0, ()=>{o.current&&(clearTimeout(o.current),o.current=null)},[]),f=_react.useCallback.call(void 0, async()=>{if(!(g.current||d.current||w!=="connected"||u)){g.current=!0,d.current=!0,y("pending"),o.current=setTimeout(()=>{g.current&&(y("error"),g.current=!1)},wn);try{await v({chainId:t.chainId}),h(),y("success"),c(Ge,r)}catch (e5){h(),y("error")}finally{g.current=!1}}},[v,w,u,t.chainId,c,r,h]);_react.useEffect.call(void 0, ()=>{g.current||d.current||r===Ge&&a==="pending"&&w==="connected"&&!u&&(e&&n!==t.chainId?f():(y("success"),c(Ge,r)))},[r,a,e,n,t.chainId,w,u,f,c]),_react.useEffect.call(void 0, ()=>()=>h(),[h]);let i=()=>{a==="error"&&(d.current=!1,y("pending"))},p=!s&&a==="error",x=!s&&(a==="pending"||a==="error"),m=p?"var(--widget-status-failed)":"var(--widget-primary)";return _jsxruntime.jsxs.call(void 0, "div",{className:"flex w-full flex-row justify-between space-x-3",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:`inline-flex h-12 w-full items-center justify-center text-sm font-medium transition duration-150 ${p?"cursor-pointer":"cursor-not-allowed"}`,style:{backgroundColor:`color-mix(in srgb, ${m} 12%, transparent)`,border:`1px solid color-mix(in srgb, ${m} 20%, transparent)`,color:m,borderRadius:"var(--widget-radius)"},onClick:p?i:void 0,children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-10 w-full flex-row items-center space-x-3 px-4",children:[_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.M,{chain:t.chainId,size:"xs"}),_jsxruntime.jsx.call(void 0, "p",{className:"whitespace-nowrap",children:p?"Retry Switch":`Switch to ${t.name}`}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-1 border-t",style:{borderColor:"var(--widget-border)"}}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-6 w-3 items-center justify-center rounded-full",children:[!s&&a==="pending"&&_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.U,{size:"5"}),(s||a==="success")&&_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.O,{className:"h-8 w-8"}),p&&_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.R,{className:"h-[12px] w-[12px]"})]})]})}),x&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"inline-flex h-12 items-center justify-center px-8 text-sm font-medium transition duration-150 cursor-pointer",style:{backgroundColor:"color-mix(in srgb, var(--widget-status-failed) 12%, transparent)",border:"1px solid color-mix(in srgb, var(--widget-status-failed) 20%, transparent)",color:"var(--widget-status-failed)",borderRadius:"var(--widget-radius)"},onClick:l,children:"Cancel"})]})},nr=hn;var yn=({startTime:e,onExpired:t})=>{let[r,c]=_react.useState.call(void 0, 30),[l,s]=_react.useState.call(void 0, !1),a=_react.useRef.call(void 0, !1),y=_react.useRef.call(void 0, t);y.current=t,_react.useEffect.call(void 0, ()=>{a.current=!1},[e]),_react.useEffect.call(void 0, ()=>{let d=()=>{let n=Date.now(),w=(e>9999999999?e:e*1e3)+30*1e3,u=Math.max(0,w-n),h=Math.floor(u/1e3);if(h<=0){c(0),a.current||(a.current=!0,s(!0),y.current());return}c(h),s(!1)};if(l)return;d();let o=setInterval(d,1e3);return()=>clearInterval(o)},[e,l]);let g=d=>{let o=Math.floor(d/60),n=d%60;return`${o.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`};return l?null:_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-mono",children:g(r)})},ir=yn;function kn(e){return e.name==="UserRejectedRequestError"||e.message.includes("User rejected")||e.message.includes("rejected")||e.message.includes("denied")||e.message.includes("cancelled")||e.message.includes("canceled")}var ve="signingOrder";async function Nn(e,t,r,c,l){let s=_optionalChain([e, 'access', _64 => _64.transaction, 'optionalAccess', _65 => _65.encoded]),a=_nullishCoalesce(_optionalChain([s, 'optionalAccess', _66 => _66.to]), () => (e.to)),y=_nullishCoalesce(_optionalChain([s, 'optionalAccess', _67 => _67.data]), () => (e.data)),g=_nullishCoalesce(_optionalChain([s, 'optionalAccess', _68 => _68.value]), () => (e.value));if(!a)throw new Error('Transaction step missing "to" address');let d=_optionalChain([s, 'optionalAccess', _69 => _69.chainId]),o=e.chainKey||l,n=d||(o?_chunkTZYKUGNPcjs.E.call(void 0, o):void 0);if(!n)throw new Error(`Unknown chain: ${o}`);let v=_chunkTZYKUGNPcjs.h.call(void 0, )[n],w=await r({account:t,chain:v,to:a,data:y||"0x",value:BigInt(g||"0")});return await _core.waitForTransactionReceipt.call(void 0, c,{hash:w,chainId:n}),w}var En=({base:e,baseAmount:t,quote:r,quoteAmount:c,userAddress:l,reviewState:s,goToNextStep:a,cancel:y,isWrappingPair:g,isUnwrappingPair:d,restartSigningFlow:o,onSwapInitiated:n,onOrderSubmitted:v,onSwapComplete:w,startPolling:u,trackNativeTransaction:h})=>{let f=_chunkTZYKUGNPcjs.r.call(void 0, ve,s),[i,p]=_react.useState.call(void 0, "idle"),x=_react.useRef.call(void 0, !1),m=_react.useRef.call(void 0, null),k=_wagmi.useConfig.call(void 0, ),{isReconnecting:P}=_wagmi.useAccount.call(void 0, ),{rfqQuote:S,stop:U,refresh:L}=Be(),{data:N}=_wagmi.useWalletClient.call(void 0, {chainId:e.chainId}),{switchChain:E}=_wagmi.useSwitchChain.call(void 0, ),{sendTransactionAsync:A}=_wagmi.useSendTransaction.call(void 0, ),M=_nullishCoalesce(_optionalChain([S, 'optionalAccess', _70 => _70._receivedAt]), () => (0)),V=_react.useCallback.call(void 0, ()=>M?Date.now()>=M+30*1e3:!1,[M]),ce=_react.useCallback.call(void 0, async()=>{if(x.current||!["idle","error"].includes(i))return;if(!_optionalChain([S, 'optionalAccess', _71 => _71.id])||!_optionalChain([S, 'optionalAccess', _72 => _72._receivedAt])){p("error");return}if(!Gt(S.id,S._receivedAt).canSubmit){p("stale");return}x.current=!0;try{if(!N)throw new Error("Wallet client not available");Xt();let T=_nullishCoalesce(S.userSteps, () => ([])),$;for(let O of T)if(O.type==="TRANSACTION"){p("submitting");let q=O.chainKey||S.srcChainKey,Z=q?_chunkTZYKUGNPcjs.E.call(void 0, q):void 0;Z&&_optionalChain([N, 'access', _73 => _73.chain, 'optionalAccess', _74 => _74.id])!==Z&&(await E({chainId:Z}),await new Promise(Ve=>setTimeout(Ve,800))),$=await Nn(O,l,A,k,S.srcChainKey),h($,O.description||`Tx on ${q}`)}else O.type==="SIGNATURE"&&(p("signing"),await Qt({quote:S,signatureStep:O,userAddress:l,walletClient:N}));Kt(S.id,S._receivedAt),_optionalChain([v, 'optionalCall', _75 => _75(S.id)]),u(S.id,{baseToken:e,quoteToken:r}),_optionalChain([n, 'optionalCall', _76 => _76()]),U(),p("success"),a(ve,s),_optionalChain([w, 'optionalCall', _77 => _77(S.id)])}catch(T){T instanceof Error&&kn(T)?(m.current=null,p("idle")):p("error")}finally{x.current=!1}},[i,S,N,e,r,l,U,u,a,s,w,E,A,n,v,h,k]);_react.useEffect.call(void 0, ()=>{if(s===ve&&U(),f&&i!=="success"){p("success"),a(ve,s);return}if(i==="success"){a(ve,s);return}if(s===ve&&i==="idle"&&!_optionalChain([S, 'optionalAccess', _78 => _78.id])){p("refreshingQuote"),L();return}if(s===ve&&i==="idle"&&N&&!x.current&&!P){let C=_optionalChain([S, 'optionalAccess', _79 => _79.id])||null;C&&m.current!==C&&(m.current=C,ce())}},[f,s,i,N,P,ce,a,_optionalChain([S, 'optionalAccess', _80 => _80.id]),L,U]),_react.useEffect.call(void 0, ()=>{i==="refreshingQuote"&&_optionalChain([S, 'optionalAccess', _81 => _81.id])&&p("idle")},[i,_optionalChain([S, 'optionalAccess', _82 => _82.id])]),_react.useEffect.call(void 0, ()=>{s!==ve&&(m.current=null)},[s]),_react.useEffect.call(void 0, ()=>{let C=setInterval(()=>{V()&&!x.current&&i!=="submitting"&&i!=="success"&&p("stale")},1e3);return()=>clearInterval(C)},[V,i]);let K=()=>{i==="error"&&!x.current&&(m.current=null,p("idle"))},D=_react.useCallback.call(void 0, ()=>{m.current=null,p("refreshingQuote"),L()},[L]),I=_react.useCallback.call(void 0, ()=>{o?o(!0):y()},[o,y]),F=()=>i==="error"?"Retry swap":i==="signing"?"Sign Swap Order":i==="submitting"?"Submitting...":i==="refreshingQuote"?"Refreshing Quote...":i==="stale"?"Quote Stale":"Sign & Submit",B=!f&&(i==="error"||i==="stale"),X=B?"var(--widget-status-failed)":"var(--widget-primary)";return _jsxruntime.jsxs.call(void 0, "div",{className:"flex w-full flex-row justify-between space-x-3",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:`inline-flex h-12 w-full items-center justify-center text-sm font-medium transition duration-150 ${B?"cursor-pointer":"cursor-not-allowed"}`,style:{backgroundColor:`color-mix(in srgb, ${X} 12%, transparent)`,border:`1px solid color-mix(in srgb, ${X} 20%, transparent)`,color:X,borderRadius:"var(--widget-radius)"},onClick:!f&&i==="error"?K:i==="stale"?I:void 0,children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-10 w-full flex-row items-center space-x-3 px-4",children:[_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.N,{asset:e,size:"xs",noChain:!0}),_jsxruntime.jsx.call(void 0, "p",{className:"whitespace-nowrap",children:F()}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-1 border-t",style:{borderColor:"var(--widget-border)"}}),M>0&&i!=="success"&&i!=="error"&&i!=="stale"&&_jsxruntime.jsx.call(void 0, ir,{startTime:M,onExpired:()=>p("stale")}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-6 w-3 items-center justify-center rounded-full",children:[!f&&(i==="idle"||i==="signing"||i==="submitting"||i==="refreshingQuote")&&_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.U,{size:"5"}),(f||i==="success")&&_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.O,{className:"h-8 w-8"}),!f&&(i==="error"||i==="stale")&&_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.R,{className:"h-[12px] w-[12px]"})]})]})}),!f&&i==="error"&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"inline-flex h-12 items-center justify-center px-8 text-sm font-medium transition duration-150 cursor-pointer",style:{backgroundColor:"color-mix(in srgb, var(--widget-status-failed) 12%, transparent)",border:"1px solid color-mix(in srgb, var(--widget-status-failed) 20%, transparent)",color:"var(--widget-status-failed)",borderRadius:"var(--widget-radius)"},onClick:y,children:"Cancel"})]})},lr=En;var On="trackingTx",ur={pending:{icon:_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.U,{size:"5"}),buttonText:"Trade Pending",showNewSwap:!1,statusVar:"var(--widget-primary)",clickable:!1},received:{icon:_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.U,{size:"5"}),buttonText:"Trade Received",showNewSwap:!1,statusVar:"var(--widget-primary)",clickable:!1},completed:{icon:_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.O,{}),buttonText:"Continue Swapping",showNewSwap:!0,statusVar:"var(--widget-status-completed)",clickable:!0},failed:{icon:_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.X,{}),buttonText:"Retry Swap",showNewSwap:!0,statusVar:"var(--widget-status-failed)",clickable:!0},cancelled:{icon:_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.X,{}),buttonText:"Continue Swapping",showNewSwap:!0,statusVar:"var(--widget-status-failed)",clickable:!0}},Pn=({orderHash:e,base:t,quote:r,baseAmount:c,quoteAmount:l,reviewState:s,onNewSwap:a,onRetry:y,status:g})=>{let d=_chunkTZYKUGNPcjs.r.call(void 0, On,s),o=ur[g]||ur.pending;_react.useEffect.call(void 0, ()=>{if(g==="completed"){let w=setTimeout(a,5e3);return()=>clearTimeout(w)}},[g,a]);let n=()=>{g==="failed"?y():o.showNewSwap&&a()},v=o.statusVar;return _jsxruntime.jsx.call(void 0, "div",{className:"flex flex-row justify-between space-x-3 w-full px-4",children:_jsxruntime.jsx.call(void 0, "button",{type:"button",className:`inline-flex h-12 w-full items-center justify-center text-sm font-medium transition duration-150 ${o.clickable?"cursor-pointer":"cursor-not-allowed"}`,style:{backgroundColor:`color-mix(in srgb, ${v} 12%, transparent)`,border:`1px solid color-mix(in srgb, ${v} 20%, transparent)`,color:v,borderRadius:"var(--widget-radius)"},onClick:o.showNewSwap?n:void 0,children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-10 w-full flex-row items-center space-x-3 px-4",children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex h-6 w-6 items-center justify-center rounded-full",children:o.icon}),_jsxruntime.jsx.call(void 0, "p",{className:"whitespace-nowrap",children:o.buttonText}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-1 border-t",style:{borderColor:"var(--widget-border)"}}),o.showNewSwap&&_jsxruntime.jsx.call(void 0, "div",{className:"flex h-6 w-6 items-center justify-center",children:_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.W,{})})]})})})},dr=Pn;var Dn=15e3,Ye="unwrapping",Vn=({needsToUnwrap:e,amount:t,chainId:r,token:c,reviewState:l,setReviewState:s,goToNextStep:a,cancel:y,delayedClose:g})=>{let d=_chunkTZYKUGNPcjs.r.call(void 0, Ye,l),[o,n]=_react.useState.call(void 0, "idle"),v=Yt(),{writeContractAsync:w}=_wagmi.useWriteContract.call(void 0, ),{address:u}=_chunk34N36GUDcjs.a.call(void 0, ),h=Oe(),f=_react.useRef.call(void 0, !1),i=_react.useRef.call(void 0, !1),p=_react.useRef.call(void 0, null),{status:x}=_wagmi.useAccount.call(void 0, ),m=_react.useCallback.call(void 0, ()=>{p.current&&(clearTimeout(p.current),p.current=null)},[]),k=_react.useCallback.call(void 0, async()=>{if(!(f.current||i.current||!u||x!=="connected")){f.current=!0,i.current=!0,n("pending"),p.current=setTimeout(()=>{f.current&&(n("error"),f.current=!1)},Dn);try{let N=_chunkTZYKUGNPcjs.c.call(void 0, r);if(!N)throw new Error(`No config for chain ${r}`);let E=_nullishCoalesce(N.wrappedAsset.decimals, () => (N.nativeAsset.decimals)),A=_viem.parseUnits.call(void 0, t.toString(),E);await v.mutateAsync({chainId:r,accountAddress:u,amountRaw:A,writeContractAsync:w});let M={symbol:N.nativeAsset.symbol,name:N.nativeAsset.name,address:_chunkTZYKUGNPcjs.a,decimals:N.nativeAsset.decimals,chainId:r},V={symbol:N.wrappedAsset.symbol,name:N.wrappedAsset.name,address:N.wrappedAsset.address,decimals:N.wrappedAsset.decimals,chainId:r};h({type:"unwrap",tokens:[{asset:M,userAddress:u},{asset:V,userAddress:u}]}),m(),n("success"),a(Ye,l),await g()}catch (e6){m(),n("error")}finally{f.current=!1}}},[u,x,r,t,v,w,h,a,l,g,m]);_react.useEffect.call(void 0, ()=>{f.current||i.current||l===Ye&&o==="idle"&&x==="connected"&&(e?k():(n("success"),a(Ye,l)))},[l,o,e,x,k,a]),_react.useEffect.call(void 0, ()=>()=>m(),[m]);let P=()=>{o==="error"&&(i.current=!1,n("idle"))},S=!d&&o==="error",U=!d&&(o==="pending"||o==="idle"||o==="error"),L=S?"var(--widget-status-failed)":"var(--widget-primary)";return _jsxruntime.jsxs.call(void 0, "div",{className:"flex w-full flex-row justify-between space-x-3",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:`inline-flex h-12 w-full items-center justify-center text-sm font-medium transition duration-150 ${S?"cursor-pointer":"cursor-not-allowed"}`,style:{backgroundColor:`color-mix(in srgb, ${L} 12%, transparent)`,border:`1px solid color-mix(in srgb, ${L} 20%, transparent)`,color:L,borderRadius:"var(--widget-radius)"},onClick:S?P:void 0,children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-10 w-full flex-row items-center space-x-3 px-4",children:[_jsxruntime.jsx.call(void 0, "p",{className:"whitespace-nowrap",children:S?"Retry Unwrap":c?`Unwrap ${c.symbol}`:"Unwrap Native Token"}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-1 border-t",style:{borderColor:"var(--widget-border)"}}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-6 w-3 items-center justify-center rounded-full",children:[!d&&(o==="pending"||o==="idle")&&_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.U,{size:"5"}),(d||o==="success")&&_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.O,{className:"h-8 w-8"}),S&&_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.R,{className:"h-[12px] w-[12px]"})]})]})}),U&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"inline-flex h-12 items-center justify-center px-8 text-sm font-medium transition duration-150 cursor-pointer",style:{backgroundColor:"color-mix(in srgb, var(--widget-status-failed) 12%, transparent)",border:"1px solid color-mix(in srgb, var(--widget-status-failed) 20%, transparent)",color:"var(--widget-status-failed)",borderRadius:"var(--widget-radius)"},onClick:y,children:"Cancel"})]})},fr=Vn;var qn=15e3,Je="wrapping",Qn=({needsToWrap:e,amount:t,chainId:r,token:c,reviewState:l,setReviewState:s,goToNextStep:a,cancel:y,delayedClose:g,isWrappingPair:d})=>{let o=_chunkTZYKUGNPcjs.r.call(void 0, Je,l),[n,v]=_react.useState.call(void 0, "idle"),w=Jt(),{writeContractAsync:u}=_wagmi.useWriteContract.call(void 0, ),{address:h}=_chunk34N36GUDcjs.a.call(void 0, ),f=Oe(),i=_react.useRef.call(void 0, !1),p=_react.useRef.call(void 0, !1),x=_react.useRef.call(void 0, null),{status:m}=_wagmi.useAccount.call(void 0, ),k=_react.useCallback.call(void 0, ()=>{x.current&&(clearTimeout(x.current),x.current=null)},[]),P=_react.useCallback.call(void 0, async()=>{if(!(i.current||p.current||!h||m!=="connected")){i.current=!0,p.current=!0,v("pending"),x.current=setTimeout(()=>{i.current&&(v("error"),i.current=!1)},qn);try{let E=_chunkTZYKUGNPcjs.c.call(void 0, r);if(!E)throw new Error(`No config for chain ${r}`);let A=_viem.parseUnits.call(void 0, t.toString(),E.nativeAsset.decimals);await w.mutateAsync({chainId:r,accountAddress:h,amountRaw:A,writeContractAsync:u});let M={symbol:E.nativeAsset.symbol,name:E.nativeAsset.name,address:_chunkTZYKUGNPcjs.a,decimals:E.nativeAsset.decimals,chainId:r},V={symbol:E.wrappedAsset.symbol,name:E.wrappedAsset.name,address:E.wrappedAsset.address,decimals:E.wrappedAsset.decimals,chainId:r};f({type:"wrap",tokens:[{asset:M,userAddress:h},{asset:V,userAddress:h}]}),k(),v("success"),a(Je,l),d&&await g()}catch (e7){k(),v("error")}finally{i.current=!1}}},[h,m,r,t,w,u,f,a,l,g,d,k]);_react.useEffect.call(void 0, ()=>{i.current||p.current||l===Je&&n==="idle"&&m==="connected"&&(e?P():(v("success"),a(Je,l)))},[l,n,e,m,P,a]),_react.useEffect.call(void 0, ()=>()=>k(),[k]);let S=()=>{n==="error"&&(p.current=!1,v("idle"))},U=!o&&n==="error",L=!o&&(n==="pending"||n==="idle"||n==="error"),N=U?"var(--widget-status-failed)":"var(--widget-primary)";return _jsxruntime.jsxs.call(void 0, "div",{className:"flex w-full flex-row justify-between space-x-3",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:`inline-flex h-12 w-full items-center justify-center text-sm font-medium transition duration-150 ${U?"cursor-pointer":"cursor-not-allowed"}`,style:{backgroundColor:`color-mix(in srgb, ${N} 12%, transparent)`,border:`1px solid color-mix(in srgb, ${N} 20%, transparent)`,color:N,borderRadius:"var(--widget-radius)"},onClick:U?S:void 0,children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-10 w-full flex-row items-center space-x-3 px-4",children:[_jsxruntime.jsx.call(void 0, "p",{className:"whitespace-nowrap",children:U?"Retry Wrap":c?`Wrap ${c.symbol}`:"Wrap Native Token"}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-1 border-t",style:{borderColor:"var(--widget-border)"}}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-6 w-3 items-center justify-center rounded-full",children:[!o&&(n==="pending"||n==="idle")&&_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.U,{size:"5"}),(o||n==="success")&&_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.O,{className:"h-8 w-8"}),U&&_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.R,{className:"h-[12px] w-[12px]"})]})]})}),L&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"inline-flex h-12 items-center justify-center px-8 text-sm font-medium transition duration-150 cursor-pointer",style:{backgroundColor:"color-mix(in srgb, var(--widget-status-failed) 12%, transparent)",border:"1px solid color-mix(in srgb, var(--widget-status-failed) 20%, transparent)",color:"var(--widget-status-failed)",borderRadius:"var(--widget-radius)"},onClick:y,children:"Cancel"})]})},hr=Qn;var Oa=({base:e,baseAmount:t,quote:r,quoteAmount:c,userAddress:l,isWrappingPair:s,isUnwrappingPair:a,isBaseGasToken:y,isQuoteGasToken:g,reviewActionProps:d,reviewState:o,setReviewState:n,trackedOrderHash:v,setTrackedOrderHash:w,txStatus:u,onSwapComplete:h,onSwapInitiated:f,onOrderSubmitted:i,onStaleQuoteRestart:p,setExitHandler:x,setRetryHandler:m})=>{let{rfqQuote:k,status:P,liquidityError:S,routingError:U,sizeCapError:L,stop:N,clear:E}=Be(),{clearForm:A}=_chunkPD3AGQJPcjs.f.call(void 0, ),M=_wagmi.useChainId.call(void 0, ),{swapButtonVariant:V,widgetType:ce}=_chunkJCH7AXABcjs.b.call(void 0, ),K=ce==="compact",{trackOrderTransaction:D,trackNativeTransaction:I}=er(),{startPolling:F}=Ft((_,ge,Le)=>{_chunkPD3AGQJPcjs.c.getState().setTxStatus(ge),Le&&_chunkPD3AGQJPcjs.c.getState().setExplorerUrl(Le),ge==="completed"&&D(_,`Swap ${e.symbol} \u2192 ${r.symbol}`)}),[B,X]=_react.useState.call(void 0, !1),C=_react.useRef.call(void 0, !1),T=_react.useRef.call(void 0, null),$=s,O=a,q=!s&&!a,Z=M!==_optionalChain([e, 'optionalAccess', _83 => _83.chainId])&&($||O||q),Ve=_chunkTZYKUGNPcjs.c.call(void 0, e.chainId),_e={chainId:e.chainId,name:_nullishCoalesce(_optionalChain([Ve, 'optionalAccess', _84 => _84.displayName]), () => (`Chain ${e.chainId}`))},j=_react.useCallback.call(void 0, (_,ge)=>{if(ge!==_)return;if(_==="chain"){if($){n("wrapping");return}if(O){n("unwrapping");return}n("signingOrder");return}if(_==="signingOrder"){n("trackingTx");return}if(_==="wrapping"){if(!s){n("signingOrder");return}n("wrapSuccess");return}if(_==="unwrapping"){n("wrapSuccess");return}let Le=_chunkTZYKUGNPcjs.s.call(void 0, _);Le&&n(Le)},[n,s,$,O,q]),le=_react.useCallback.call(void 0, ()=>Z?"chain":$?"wrapping":O?"unwrapping":q?"signingOrder":null,[Z,$,O,q]),ee=_react.useCallback.call(void 0, ()=>{n(null),A()},[A,n]),Te=_react.useCallback.call(void 0, async()=>{n("wrapSuccess");for(let _=0;_<3;_++)await _chunkTZYKUGNPcjs.t.call(void 0, 700);ee()},[ee,n]),te=_react.useCallback.call(void 0, async()=>{E(),n("cancelled");for(let _=0;_<3;_++)await _chunkTZYKUGNPcjs.t.call(void 0, 500);ee()},[E,ee,n]),ne=_react.useCallback.call(void 0, ()=>{v&&(_chunkPD3AGQJPcjs.c.getState().stopTracking(),n(null),w(null),A())},[v,n,w,A]),Ue=_react.useCallback.call(void 0, ()=>{n(null),w(null),C.current=!0,_optionalChain([p, 'optionalCall', _85 => _85()])},[n,w,p]),ue=_react.useCallback.call(void 0, ()=>{d&&n(le())},[le,d,n]),Ze=_react.useCallback.call(void 0, (_=!1)=>{_?(C.current=!0,n(null),_optionalChain([p, 'optionalCall', _86 => _86()])):(n(null),T.current=setTimeout(()=>{d&&(n(le()),X(!1))},100))},[n,d,le,p]);_react.useEffect.call(void 0, ()=>{o!==null&&N()},[o,N]),_react.useEffect.call(void 0, ()=>{o!==null&&B&&X(!1)},[o,B]),_react.useEffect.call(void 0, ()=>{_optionalChain([x, 'optionalCall', _87 => _87(ne)])},[x,ne]),_react.useEffect.call(void 0, ()=>(_chunkPD3AGQJPcjs.c.getState().setExitHandler(ne),()=>_chunkPD3AGQJPcjs.c.getState().setExitHandler(null)),[ne]),_react.useEffect.call(void 0, ()=>{_optionalChain([m, 'optionalCall', _88 => _88(Ue)])},[m,Ue]),_react.useEffect.call(void 0, ()=>()=>{T.current&&clearTimeout(T.current)},[]),_react.useEffect.call(void 0, ()=>{C.current&&P==="fresh"&&_optionalChain([k, 'optionalAccess', _89 => _89.id])&&(C.current=!1,n("signingOrder"))},[P,_optionalChain([k, 'optionalAccess', _90 => _90.id]),n]);let Me=_=>{if(!_)return{backgroundColor:V==="default"?"var(--widget-muted)":"transparent",color:"var(--widget-muted-foreground)",border:V!=="default"?"1px solid var(--widget-border)":"none",borderRadius:"var(--widget-radius)"};switch(V){case"outline":return{backgroundColor:"transparent",color:"var(--widget-primary)",border:"1px solid var(--widget-primary)",borderRadius:"var(--widget-radius)"};case"ghost":return{backgroundColor:"transparent",color:"var(--widget-primary)",border:"none",borderRadius:"var(--widget-radius)"};default:return{backgroundColor:"var(--widget-primary)",color:"var(--widget-primary-foreground)",borderRadius:"var(--widget-radius)"}}},Re=`w-full ${K?"py-2":"py-3"} text-sm font-medium transition-colors cursor-pointer mt-1`;if(o===null&&!s&&!a){if(B)return _jsxruntime.jsx.call(void 0, "button",{className:Re,disabled:!0,style:{...Me(!1),opacity:.6,cursor:"not-allowed"},children:"Getting fresh quote..."});let _=()=>S?"Insufficient Liquidity":U?"Route Not Available":L?"Size Cap Exceeded":!k&&P==="polling"?"Getting Quote...":k?"Swap":"Enter Amount",ge=!!d;return _jsxruntime.jsx.call(void 0, "button",{onClick:ge?ue:void 0,disabled:!ge,className:`${Re} disabled:opacity-40 disabled:cursor-not-allowed`,style:Me(ge),children:_()})}return o===null&&a?_jsxruntime.jsx.call(void 0, "button",{onClick:d?ue:void 0,disabled:!d,className:`${Re} disabled:opacity-40 disabled:cursor-not-allowed`,style:Me(!!d),children:"Unwrap"}):o===null&&s?_jsxruntime.jsx.call(void 0, "button",{onClick:d?ue:void 0,disabled:!d,className:`${Re} disabled:opacity-40 disabled:cursor-not-allowed`,style:Me(!!d),children:"Wrap"}):o==="success"?_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col gap-2 w-full",children:_jsxruntime.jsx.call(void 0, "button",{className:`w-full ${K?"py-2":"py-3"} text-sm font-medium cursor-default`,style:{backgroundColor:"color-mix(in srgb, var(--widget-status-completed) 15%, transparent)",color:"var(--widget-status-completed)",border:"1px solid color-mix(in srgb, var(--widget-status-completed) 20%, transparent)",borderRadius:"var(--widget-radius)"},children:"Order Placed"})}):o==="wrapSuccess"?_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col gap-2 w-full",children:_jsxruntime.jsx.call(void 0, "button",{className:`w-full ${K?"py-2":"py-3"} text-sm font-medium cursor-default`,style:{backgroundColor:"color-mix(in srgb, var(--widget-status-completed) 15%, transparent)",color:"var(--widget-status-completed)",border:"1px solid color-mix(in srgb, var(--widget-status-completed) 20%, transparent)",borderRadius:"var(--widget-radius)"},children:s?"Wrapped Successfully":"Unwrapped Successfully"})}):o==="cancelled"?_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col gap-2 w-full",children:_jsxruntime.jsx.call(void 0, "button",{onClick:ee,className:`w-full ${K?"py-2":"py-3"} text-sm font-medium cursor-pointer`,style:{backgroundColor:"color-mix(in srgb, var(--widget-status-failed) 15%, transparent)",color:"var(--widget-status-failed)",border:"1px solid color-mix(in srgb, var(--widget-status-failed) 20%, transparent)",borderRadius:"var(--widget-radius)"},children:"Order Cancelled"})}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex w-full",children:[o==="chain"&&Z&&_jsxruntime.jsx.call(void 0, nr,{requiredChain:_e,needsChainSwitch:Z&&M!==e.chainId,reviewState:o,goToNextStep:j,cancel:te}),o==="wrapping"&&$&&_jsxruntime.jsx.call(void 0, hr,{needsToWrap:$,amount:t,chainId:e.chainId,token:e,reviewState:o,setReviewState:n,goToNextStep:j,cancel:te,delayedClose:Te,isWrappingPair:s}),o==="unwrapping"&&O&&_jsxruntime.jsx.call(void 0, fr,{needsToUnwrap:O,amount:t,chainId:e.chainId,token:e,reviewState:o,setReviewState:n,goToNextStep:j,cancel:te,delayedClose:Te}),o==="signingOrder"&&q&&_jsxruntime.jsx.call(void 0, lr,{base:e,baseAmount:t,quote:r,quoteAmount:c,userAddress:l,reviewState:o,goToNextStep:j,cancel:te,restartSigningFlow:Ze,onSwapInitiated:f,onOrderSubmitted:i,isWrappingPair:s,isUnwrappingPair:a,onSwapComplete:h,startPolling:F,trackNativeTransaction:I}),o==="trackingTx"&&v&&_jsxruntime.jsx.call(void 0, dr,{orderHash:v,base:e,quote:r,baseAmount:t,quoteAmount:c,reviewState:o,status:u,onNewSwap:ne,onRetry:Ue}),o&&!["chain","wrapping","unwrapping","approval","signingOrder","trackingTx","success","wrapSuccess","cancelled"].includes(o)&&_jsxruntime.jsx.call(void 0, "button",{disabled:!0,className:`w-full ${K?"py-2":"py-3"} text-sm font-medium`,style:{backgroundColor:"var(--widget-muted)",color:"var(--widget-muted-foreground)",borderRadius:"var(--widget-radius)"},children:"Processing..."})]})};var _shallow = require('zustand/react/shallow');var vr={pending:"var(--widget-status-pending)",received:"var(--widget-status-received)",completed:"var(--widget-status-completed)",failed:"var(--widget-status-failed)",cancelled:"var(--widget-status-failed)"},Yn=({status:e})=>{let t=_nullishCoalesce(vr[e], () => (vr.pending));switch(e){case"completed":return _jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.O,{className:"h-6 w-6"});case"failed":case"cancelled":return _jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.X,{className:"h-6 w-6"});default:return _jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.U,{size:"5",color:t})}};function Jn(e){if(e===0)return"0";let t=Math.abs(e);return t>=1e4?e.toFixed(0):t>=1e3?e.toFixed(1):t>=100?e.toFixed(2):t>=1?e.toFixed(4):t>=.01?e.toFixed(6):e.toExponential(3)}function br(e){try{let t=new URL(e).pathname.split("/"),r=t[t.length-1];return r&&r.startsWith("0x")?r:null}catch (e8){return null}}function xr(e){let t=e.length;return t<=4?36:t<=6?32:t<=8?28:24}var xt=()=>_jsxruntime.jsxs.call(void 0, "svg",{className:"w-3 h-3 shrink-0",style:{color:"var(--widget-muted-foreground)"},viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[_jsxruntime.jsx.call(void 0, "path",{d:"M18 13V19C18 20.1046 17.1046 21 16 21H5C3.89543 21 3 20.1046 3 19V8C3 6.89543 3.89543 6 5 6H11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),_jsxruntime.jsx.call(void 0, "path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),_jsxruntime.jsx.call(void 0, "path",{d:"M10 14L21 3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Zn=()=>_jsxruntime.jsxs.call(void 0, "svg",{className:"w-3 h-3 shrink-0",viewBox:"0 0 195 321",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[_jsxruntime.jsx.call(void 0, "path",{fillRule:"evenodd",d:"M195,189C195,207.02,195,225.04,194.7,243.21C193.68,244.78,192.9,246.17,192.25,247.63C189.71,253.38,187.74,259.46,184.6,264.86C169.44,290.97,147.86,309.46,118.54,318.86C116.44,319.55,114.72,320.27,113,321C97.65,321,82.29,321,66.36,320.66C64.21,319.86,62.64,319.4,60.77,318.73C34.51,310.12,15.56,293.82,4.22,268.85C3.68,267.66,2.1,266.94,1,266C1,242.31,1,218.62,1.29,194.79C2.84,192.16,4.11,189.7,5.34,187.22C18.42,160.94,39.89,144.07,66.64,133.63C76.92,129.62,87.87,127.33,98.67,124.2C97.79,123.24,96.8,121.93,95.59,120.86C85.84,112.3,75.95,103.89,66.3,95.21C55.93,85.86,45.02,76.96,35.71,66.63C21.14,50.5,20.04,23.08,45.41,9.57C50.08,7.08,55.12,5.26,59.93,3.03C60.76,2.64,61.32,1.69,62,1C86.69,1,111.38,1,136.23,1.32C138.04,2.32,139.67,3.01,141.32,3.67C147.64,6.19,154.12,8.39,160.26,11.32C166.83,14.45,172.19,19.18,175.44,25.95C179.39,34.19,178.09,43.36,172.05,49.56C165.75,56.03,157.21,57.8,148.78,52.89C142.4,49.17,136.86,43.96,131.1,39.23C122.63,32.28,115.05,23.88,105.74,18.38C87.78,7.76,68.84,9.07,51.16,19.53C38.68,26.91,36.37,41.4,45.53,52.71C50.38,58.69,56.45,64,62.83,68.36C87.15,84.99,111.86,101.05,136.34,117.44C162.56,135,183.88,156.57,193.26,187.79C193.42,188.32,194.4,188.6,195,189ZM77.06,146.49C61.39,155.71,51.27,169.26,45.93,186.5C39.48,207.32,39.44,228.5,42.93,249.76C45.84,267.48,53.16,282.95,66.59,295.39C83.82,311.34,108.85,312.86,127.37,298.41C138.98,289.35,146.05,277.03,149.48,263.04C161.53,213.92,148.4,171.97,112.16,137.05C111.13,136.06,108.71,135.6,107.31,136.05C97.38,139.22,87.54,142.7,77.06,146.49Z"}),_jsxruntime.jsx.call(void 0, "path",{d:"M118.83,199C121.61,197.69,122.77,198.41,122.77,201.27C122.71,217.43,122.78,233.58,122.65,249.73C122.65,250.83,121.43,251.92,120.77,253.01C119.97,252.05,118.63,251.17,118.45,250.1C116.32,237.7,113.36,235.12,100.61,235.02C98.12,235,95.62,234.98,93.12,235.01C81.26,235.16,77.72,238.3,75.94,249.84C75.74,251.15,74.39,252.28,73.57,253.49C73.11,253.23,72.64,252.98,72.17,252.73C72.17,234.81,72.17,216.88,72.17,198.96C72.49,198.62,72.81,198.28,73.13,197.93C74.09,198.95,75.72,199.85,75.92,201C78.13,213.8,80.95,216.26,94.05,216.3C97.38,216.31,100.72,216.44,104.04,216.27C113.28,215.79,117.15,212.05,118.22,202.81C118.35,201.65,118.47,200.49,118.83,199Z"})]}),es=({orderHash:e,base:t,quote:r,baseAmount:c,quoteAmount:l,status:s})=>{let[a,y]=_react.useState.call(void 0, !1),[g,d]=_react.useState.call(void 0, !0),o=_react.useRef.call(void 0, null),n=_react.useRef.call(void 0, Date.now()),[v,w]=_react.useState.call(void 0, null),u=_react.useRef.call(void 0, null),{isRecipientInputOpen:h,recipient:f,explorerUrl:i}=_chunkPD3AGQJPcjs.c.call(void 0, _shallow.useShallow.call(void 0, A=>({isRecipientInputOpen:A.isRecipientInputOpen,recipient:A.recipient,explorerUrl:A.explorerUrl})));_react.useEffect.call(void 0, ()=>{s==="received"&&(o.current=Date.now())},[s]),_react.useEffect.call(void 0, ()=>{if(s==="completed"&&!v){let A=o.current||n.current;w((Date.now()-A)/1e3)}},[s,v]),_react.useEffect.call(void 0, ()=>()=>{u.current&&clearTimeout(u.current)},[]);let p=_react.useCallback.call(void 0, ()=>{if(!_optionalChain([navigator, 'access', _91 => _91.clipboard, 'optionalAccess', _92 => _92.writeText]))return;let A=i?_nullishCoalesce(br(i), () => (e)):e;navigator.clipboard.writeText(A).then(()=>{y(!0),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>y(!1),2e3)}).catch(()=>{})},[e,i]),x=_chunkTZYKUGNPcjs.o.call(void 0, c),m=_chunkTZYKUGNPcjs.o.call(void 0, l),k=s==="completed"||s==="failed"||s==="cancelled",P=!k,S=c&&l?c/l:0,U=_nullishCoalesce(_optionalChain([_chunkTZYKUGNPcjs.c.call(void 0, t.chainId), 'optionalAccess', _93 => _93.displayName]), () => (`Chain ${t.chainId}`)),L=_nullishCoalesce(_optionalChain([_chunkTZYKUGNPcjs.c.call(void 0, r.chainId), 'optionalAccess', _94 => _94.displayName]), () => (`Chain ${r.chainId}`)),N=i?_nullishCoalesce(br(i), () => (e)):e,E=`${N.slice(0,6)} \u2026 ${N.slice(-4)}`;return _jsxruntime.jsxs.call(void 0, "div",{className:"relative w-full flex flex-col",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"mx-4 mt-2",style:{backgroundColor:"var(--widget-secondary)"},children:[_jsxruntime.jsx.call(void 0, "div",{className:"p-5",children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between",children:[_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3 mb-3",children:[_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.N,{asset:t,size:"lg",noChain:!0}),_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-lg font-medium uppercase",style:{color:"var(--widget-foreground)"},children:t.symbol}),_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:t.name})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"inline-flex items-center gap-1.5 rounded-full px-2.5 py-1",style:{backgroundColor:"color-mix(in srgb, var(--widget-muted-foreground) 20%, transparent)",border:"1px solid color-mix(in srgb, var(--widget-muted-foreground) 30%, transparent)"},children:[_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.M,{chain:t.chainId,size:"xs"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs pt-0.5",style:{color:"var(--widget-secondary-foreground)",opacity:.5},children:U})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"text-right",children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-light tracking-tight mono",style:{color:"var(--widget-foreground)",fontSize:`${xr(x)}px`,transition:"font-size 0.1s ease-out"},children:x}),t.price&&_jsxruntime.jsxs.call(void 0, "p",{className:"text-xs mt-1 mono",style:{color:"var(--widget-muted-foreground)"},children:["$",(t.price*c).toFixed(2)]})]})]})}),_jsxruntime.jsxs.call(void 0, "div",{className:"relative",children:[_jsxruntime.jsx.call(void 0, "div",{style:{borderTop:"1px solid var(--widget-border)"}}),_jsxruntime.jsx.call(void 0, "div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:_jsxruntime.jsx.call(void 0, "div",{className:"w-10 h-10 rounded-full flex items-center justify-center",style:{backgroundColor:"var(--widget-secondary)",border:"1px solid var(--widget-border)"},children:_jsxruntime.jsx.call(void 0, Yn,{status:s})})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"p-5",children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between",children:[_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3 mb-3",children:[_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.N,{asset:r,size:"lg",noChain:!0}),_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-lg font-medium uppercase",style:{color:"var(--widget-foreground)"},children:r.symbol}),_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:r.name})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"inline-flex items-center gap-1.5 rounded-full px-2.5 py-1",style:{backgroundColor:"color-mix(in srgb, var(--widget-muted-foreground) 20%, transparent)",border:"1px solid color-mix(in srgb, var(--widget-muted-foreground) 30%, transparent)"},children:[_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.M,{chain:r.chainId,size:"xs"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs pt-0.5",style:{color:"var(--widget-secondary-foreground)",opacity:.5},children:L})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"text-right",children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-light tracking-tight mono",style:{color:"var(--widget-foreground)",fontSize:`${xr(m)}px`,transition:"font-size 0.1s ease-out"},children:m}),r.price&&_jsxruntime.jsxs.call(void 0, "p",{className:"text-xs mt-1 mono",style:{color:"var(--widget-muted-foreground)"},children:["$",(r.price*l).toFixed(2)]})]})]})})]}),h&&f&&_jsxruntime.jsx.call(void 0, "div",{className:"mx-4 mt-2 px-5 pb-2",children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-2 p-2 rounded-full",style:{backgroundColor:"var(--widget-secondary)"},children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex h-5 w-5 items-center justify-center overflow-hidden rounded-full",style:{backgroundColor:"var(--widget-muted)"},children:_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",children:"\u{1F464}"})}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"To:"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs mono",style:{color:"var(--widget-foreground)"},children:[f.slice(0,6),"...",f.slice(-4)]})]})}),_jsxruntime.jsx.call(void 0, "div",{className:"px-4 pt-4",children:_jsxruntime.jsxs.call(void 0, "div",{style:{borderTop:"1px solid var(--widget-border)"},className:"pt-3",children:[_jsxruntime.jsxs.call(void 0, "button",{type:"button",onClick:()=>d(!g),className:"w-full flex items-center justify-between font-mono text-xs py-1 cursor-pointer transition-colors",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.N,{asset:r,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"uppercase",style:{color:"var(--widget-foreground)"},children:["1 ",r.symbol]}),_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-muted-foreground)"},children:"="}),_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.N,{asset:t,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"uppercase",style:{color:"var(--widget-foreground)"},children:[Jn(S)," ",t.symbol]}),t.price&&_jsxruntime.jsxs.call(void 0, "span",{style:{color:"var(--widget-muted-foreground)"},children:["\u2248 $",(t.price*S).toFixed(2)]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"ml-2 transition-transform duration-200",style:{color:"var(--widget-muted-foreground)",transform:g?"rotate(0deg)":"rotate(180deg)",display:"inline-block"},children:"\u25BE"})]}),_jsxruntime.jsx.call(void 0, "div",{className:"overflow-hidden transition-all duration-200",style:{maxHeight:g?"200px":"0px",opacity:g?1:0},children:_jsxruntime.jsxs.call(void 0, "div",{className:"space-y-1 pt-2 mt-1 font-mono",style:{borderTop:"1px solid var(--widget-border)"},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between text-2xs",children:[_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-muted-foreground)"},children:"USD Value"}),_jsxruntime.jsxs.call(void 0, "span",{style:{color:"var(--widget-secondary-foreground)",opacity:.5},children:["$",t.price?(t.price*c).toFixed(2):"\u2014"]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between text-2xs",children:[_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-muted-foreground)"},children:"Order Type"}),_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-secondary-foreground)",opacity:.5},children:"RFQ (Exact Fill)"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between text-2xs",children:[_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-muted-foreground)"},children:"Transaction"}),i?_jsxruntime.jsxs.call(void 0, "a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 transition-colors hover:opacity-80",style:{color:"var(--widget-secondary-foreground)",opacity:.5},children:[_jsxruntime.jsx.call(void 0, "span",{children:a?"Copied!":E}),_jsxruntime.jsx.call(void 0, xt,{})]}):_jsxruntime.jsxs.call(void 0, "button",{type:"button",onClick:p,className:"flex items-center gap-1 cursor-pointer transition-colors",style:{color:"var(--widget-secondary-foreground)",opacity:.5},children:[_jsxruntime.jsx.call(void 0, "span",{children:a?"Copied!":E}),_jsxruntime.jsx.call(void 0, xt,{})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between text-2xs",children:[_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-muted-foreground)"},children:k?"Speed":"Est. Time"}),_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-secondary-foreground)",opacity:.5},children:v?`${v.toFixed(2)}s`:"\u2014"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between text-2xs",children:[_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-muted-foreground)"},children:"Route"}),_jsxruntime.jsxs.call(void 0, "a",{href:"https://www.aori.io/scan",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 transition-colors hover:opacity-80",style:{color:"var(--widget-secondary-foreground)",opacity:.5},children:[_jsxruntime.jsx.call(void 0, Zn,{}),"Aori",_jsxruntime.jsx.call(void 0, xt,{})]})]})]})}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-2",style:{borderBottom:"1px solid var(--widget-border)"}})]})})]})},Va= exports.x =es;exports.a = kr; exports.b = Oe; exports.c = as; exports.d = fs; exports.e = Be; exports.f = _r; exports.g = ys; exports.h = Ts; exports.i = Is; exports.j = Ws; exports.k = _s; exports.l = Vt; exports.m = Ft; exports.n = Bt; exports.o = Zr; exports.p = Qt; exports.q = en; exports.r = Gt; exports.s = Kt; exports.t = Xt; exports.u = Yt; exports.v = Jt; exports.w = Oa; exports.x = Va;
|
|
@@ -0,0 +1,2 @@
|
|
|
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
|
+
var _chunkTZYKUGNPcjs = require('./chunk-TZYKUGNP.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');var _react = require('react');var O="https://api.aori.io",b=50,G=100,D="0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",U="megaeth";function K(e,s){let o=_chunkTZYKUGNPcjs.E.call(void 0, e.inputChain),r=_chunkTZYKUGNPcjs.E.call(void 0, e.outputChain),u=o?_nullishCoalesce(s(o,e.inputToken), () => (null)):null,c=r?_nullishCoalesce(s(r,e.outputToken), () => (null)):null;return{orderHash:e.orderHash,quoteId:e.orderHash,status:e.status.toLowerCase(),eventType:e.status.toLowerCase(),inputToken:e.inputToken,inputAmount:e.inputAmount,inputChain:e.inputChain,outputToken:e.outputToken,outputAmount:e.outputAmount,outputChain:e.outputChain,timestamp:e.timestamp,createdAt:e.startTime,srcTx:e.srcTx,dstTx:e.dstTx,explorerUrl:`https://aoriscan.io/order/${e.orderHash}`,enrichedTokens:{base:u,quote:c}}}function P(e,s){let{getToken:o}=_chunkTZYKUGNPcjs.B.call(void 0, ),[r,u]=_react.useState.call(void 0, []),[c,f]=_react.useState.call(void 0, !1),[p,h]=_react.useState.call(void 0, null),[d,m]=_react.useState.call(void 0, b),n=_react.useRef.call(void 0, null),i=_react.useCallback.call(void 0, async()=>{if(!e)return;_optionalChain([n, 'access', _2 => _2.current, 'optionalAccess', _3 => _3.abort, 'call', _4 => _4()]);let g=new AbortController;n.current=g,f(!0),h(null);try{let y={offerer:e,limit:String(G),page:"0"},[L,I]=await Promise.all([fetch(`${O}/data/query?${new URLSearchParams({...y,inputChain:U,inputToken:D})}`,{signal:g.signal}),fetch(`${O}/data/query?${new URLSearchParams({...y,outputChain:U,outputToken:D})}`,{signal:g.signal})]),_=_optionalChain([L, 'optionalAccess', _5 => _5.ok])?await L.json():null,$=_optionalChain([I, 'optionalAccess', _6 => _6.ok])?await I.json():null,H=new Set,C=[];for(let x of[..._nullishCoalesce(_optionalChain([_, 'optionalAccess', _7 => _7.orders]), () => ([])),..._nullishCoalesce(_optionalChain([$, 'optionalAccess', _8 => _8.orders]), () => ([]))])H.has(x.orderHash)||(H.add(x.orderHash),C.push(x));C.sort((x,V)=>V.timestamp-x.timestamp),u(C),m(b)}catch(y){if(_optionalChain([y, 'optionalAccess', _9 => _9.name])==="AbortError")return;h(_nullishCoalesce(_optionalChain([y, 'optionalAccess', _10 => _10.message]), () => ("Failed to load order history")))}finally{g.signal.aborted||f(!1)}},[e]);_react.useEffect.call(void 0, ()=>{if(!s||!e){u([]),m(b);return}return i(),()=>_optionalChain([n, 'access', _11 => _11.current, 'optionalAccess', _12 => _12.abort, 'call', _13 => _13()])},[s,e,i]);let v=d<r.length,q=_react.useCallback.call(void 0, async()=>{v&&m(g=>Math.min(g+b,r.length))},[v,r.length]);return{orders:_react.useMemo.call(void 0, ()=>r.slice(0,d).map(g=>K(g,o)),[r,d,o]),isLoading:c,error:p,hasMore:v,loadMore:q,totalOrders:r.length}}var _jsxruntime = require('react/jsx-runtime');var J=()=>_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"})]}),Y=()=>_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"})]}),ee=()=>_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"})]}),F=()=>_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"})]}),te=e=>{switch((e||"").toLowerCase()){case"completed":case"settled":case"success":case"swapped":case"swap":return{icon:_jsxruntime.jsx.call(void 0, J,{}),color:"var(--widget-primary)"};case"received":return{icon:_jsxruntime.jsx.call(void 0, F,{}),color:"var(--widget-accent)"};case"failed":case"error":case"expired":return{icon:_jsxruntime.jsx.call(void 0, Y,{}),color:"var(--widget-destructive)"};case"pending":case"created":case"placed":return{icon:_jsxruntime.jsx.call(void 0, ee,{}),color:"var(--widget-muted-foreground)"};default:return{icon:_jsxruntime.jsx.call(void 0, F,{}),color:"var(--widget-muted-foreground)"}}},re=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)"}},k=(e,s)=>{try{let o=parseFloat(e||"0");if(isNaN(o)||o===0)return"0";let r=_nullishCoalesce(_optionalChain([s, 'optionalAccess', _14 => _14.decimals]), () => (18));return _chunkTZYKUGNPcjs.o.call(void 0, o/10**r)}catch (e2){return"0"}},B=({order:e,baseToken:s,quoteToken:o})=>{let[r,u]=_react.useState.call(void 0, !1),c=_optionalChain([e, 'optionalAccess', _15 => _15.status])||_optionalChain([e, 'optionalAccess', _16 => _16.eventType])||"unknown",{icon:f,color:p}=te(c),d=(i=>{if(!i)return{date:"",time:""};let v=new Date(typeof i=="number"?i:Number(i)||i);return{date:v.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),time:v.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",timeZone:"UTC",hour12:!1})+" UTC"}})(_optionalChain([e, 'optionalAccess', _17 => _17.timestamp])||_optionalChain([e, 'optionalAccess', _18 => _18.createdAt])||""),m=s?{asset:s,symbol:s.symbol,amount:k(_optionalChain([e, 'optionalAccess', _19 => _19.inputAmount]),s)}:{asset:null,symbol:(_optionalChain([e, 'optionalAccess', _20 => _20.inputToken])||"").slice(0,6)+"...",amount:k(_optionalChain([e, 'optionalAccess', _21 => _21.inputAmount]),null)},n=o?{asset:o,symbol:o.symbol,amount:k(_optionalChain([e, 'optionalAccess', _22 => _22.outputAmount]),o)}:{asset:null,symbol:(_optionalChain([e, 'optionalAccess', _23 => _23.outputToken])||"").slice(0,6)+"...",amount:k(_optionalChain([e, 'optionalAccess', _24 => _24.outputAmount]),null)};return _jsxruntime.jsxs.call(void 0, "a",{href:_optionalChain([e, 'optionalAccess', _25 => _25.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:r?re(c):"transparent",marginBottom:"0.5rem",padding:"0.25rem"},onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!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:c})]}),_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:r?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:["\xAC ",_chunkTZYKUGNPcjs.p.call(void 0, _optionalChain([e, 'optionalAccess', _26 => _26.quoteId])||_optionalChain([e, 'optionalAccess', _27 => _27.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:r?"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, _chunkTZYKUGNPcjs.N,{asset:m.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:m.amount}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:m.symbol})]}),_jsxruntime.jsx.call(void 0, "span",{className:"px-1",style:{color:"var(--widget-muted-foreground)"},children:"\u2192"}),_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.N,{asset:n.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:n.amount}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:n.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:d.date}),d.time&&_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs mono whitespace-nowrap",style:{color:"var(--widget-muted-foreground)",opacity:.6},children:d.time})]})]})]})};var j=()=>_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)"}})]})]}),be= exports.a =({isActive:e})=>{let{address:s}=_chunk34N36GUDcjs.a.call(void 0, ),{orders:o,isLoading:r,error:u,hasMore:c,loadMore:f}=P(s,e),[p,h]=_react.useState.call(void 0, !1),d=_react.useRef.call(void 0, null),m=_react.useCallback.call(void 0, async n=>{let i=n.currentTarget;if(i.scrollTop+i.clientHeight>=i.scrollHeight-100&&!r&&!p&&c){h(!0);try{await f()}finally{h(!1)}}},[r,p,c,f]);return s?u?_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:d,className:"flex flex-col flex-1 min-h-0 overflow-y-auto p-2",onScroll:m,style:{backgroundColor:"transparent"},children:r?Array.from({length:5}).map((n,i)=>_jsxruntime.jsx.call(void 0, j,{},i)):o.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:[o.map(n=>_jsxruntime.jsx.call(void 0, B,{order:n,baseToken:_nullishCoalesce(_optionalChain([n, 'access', _28 => _28.enrichedTokens, 'optionalAccess', _29 => _29.base]), () => (null)),quoteToken:_nullishCoalesce(_optionalChain([n, 'access', _30 => _30.enrichedTokens, 'optionalAccess', _31 => _31.quote]), () => (null))},n.orderHash)),p&&_jsxruntime.jsx.call(void 0, j,{})]})}):_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"})})};exports.a = be;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{e as g}from"./chunk-3DUTGO4Q.js";import{f as C}from"./chunk-BF4UK5A7.js";import{b as w}from"./chunk-TUAHO7RQ.js";import{N as p,V as u}from"./chunk-IF7S6ZES.js";import F,{useEffect as j,useState as E}from"react";import{jsx as e,jsxs as t}from"react/jsx-runtime";var S=()=>t("svg",{className:"w-3 h-3 shrink-0",style:{color:"var(--widget-muted-foreground)"},viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{d:"M18 13V19C18 20.1046 17.1046 21 16 21H5C3.89543 21 3 20.1046 3 19V8C3 6.89543 3.89543 6 5 6H11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M10 14L21 3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),L=()=>t("svg",{className:"w-3 h-3 shrink-0",viewBox:"0 0 195 321",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{fillRule:"evenodd",d:"M195,189C195,207.02,195,225.04,194.7,243.21C193.68,244.78,192.9,246.17,192.25,247.63C189.71,253.38,187.74,259.46,184.6,264.86C169.44,290.97,147.86,309.46,118.54,318.86C116.44,319.55,114.72,320.27,113,321C97.65,321,82.29,321,66.36,320.66C64.21,319.86,62.64,319.4,60.77,318.73C34.51,310.12,15.56,293.82,4.22,268.85C3.68,267.66,2.1,266.94,1,266C1,242.31,1,218.62,1.29,194.79C2.84,192.16,4.11,189.7,5.34,187.22C18.42,160.94,39.89,144.07,66.64,133.63C76.92,129.62,87.87,127.33,98.67,124.2C97.79,123.24,96.8,121.93,95.59,120.86C85.84,112.3,75.95,103.89,66.3,95.21C55.93,85.86,45.02,76.96,35.71,66.63C21.14,50.5,20.04,23.08,45.41,9.57C50.08,7.08,55.12,5.26,59.93,3.03C60.76,2.64,61.32,1.69,62,1C86.69,1,111.38,1,136.23,1.32C138.04,2.32,139.67,3.01,141.32,3.67C147.64,6.19,154.12,8.39,160.26,11.32C166.83,14.45,172.19,19.18,175.44,25.95C179.39,34.19,178.09,43.36,172.05,49.56C165.75,56.03,157.21,57.8,148.78,52.89C142.4,49.17,136.86,43.96,131.1,39.23C122.63,32.28,115.05,23.88,105.74,18.38C87.78,7.76,68.84,9.07,51.16,19.53C38.68,26.91,36.37,41.4,45.53,52.71C50.38,58.69,56.45,64,62.83,68.36C87.15,84.99,111.86,101.05,136.34,117.44C162.56,135,183.88,156.57,193.26,187.79C193.42,188.32,194.4,188.6,195,189ZM77.06,146.49C61.39,155.71,51.27,169.26,45.93,186.5C39.48,207.32,39.44,228.5,42.93,249.76C45.84,267.48,53.16,282.95,66.59,295.39C83.82,311.34,108.85,312.86,127.37,298.41C138.98,289.35,146.05,277.03,149.48,263.04C161.53,213.92,148.4,171.97,112.16,137.05C111.13,136.06,108.71,135.6,107.31,136.05C97.38,139.22,87.54,142.7,77.06,146.49Z"}),e("path",{d:"M118.83,199C121.61,197.69,122.77,198.41,122.77,201.27C122.71,217.43,122.78,233.58,122.65,249.73C122.65,250.83,121.43,251.92,120.77,253.01C119.97,252.05,118.63,251.17,118.45,250.1C116.32,237.7,113.36,235.12,100.61,235.02C98.12,235,95.62,234.98,93.12,235.01C81.26,235.16,77.72,238.3,75.94,249.84C75.74,251.15,74.39,252.28,73.57,253.49C73.11,253.23,72.64,252.98,72.17,252.73C72.17,234.81,72.17,216.88,72.17,198.96C72.49,198.62,72.81,198.28,73.13,197.93C74.09,198.95,75.72,199.85,75.92,201C78.13,213.8,80.95,216.26,94.05,216.3C97.38,216.31,100.72,216.44,104.04,216.27C113.28,215.79,117.15,212.05,118.22,202.81C118.35,201.65,118.47,200.49,118.83,199Z"})]});function x(o){if(o===0)return"0";let r=Math.abs(o);return r>=1e4?o.toFixed(0):r>=1e3?o.toFixed(1):r>=100?o.toFixed(2):r>=1?o.toFixed(4):r>=.01?o.toFixed(6):o.toExponential(3)}var y=F.memo(()=>{let[o,r]=E(!1),{liquidityError:N,routingError:h}=g(),{baseAmount:a,baseToken:s,quoteAmount:l,quoteToken:i}=C(),{quoteLoaderVariant:f,widgetType:b}=w(),m=b==="compact",n=a&&l&&parseFloat(l.toString())?parseFloat(a.toString())/parseFloat(l.toString()):0,v=N||h,c=s&&i&&a&&parseFloat(a.toString())&&l;return j(()=>{f==="expanded"&&c&&r(!0)},[f,c]),f==="none"?null:f==="default"?e("div",{className:`relative box-border flex flex-row pt-1 h-8 w-full items-center${m?" justify-start overflow-x-auto":" justify-center"}`,children:e("div",{className:`flex h-full items-center${m?" min-w-max":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&i?a&&parseFloat(a.toString())?l?t("div",{className:"translate-y-px font-mono flex flex-row items-center gap-2 whitespace-nowrap",children:[t("div",{className:"flex flex-row items-center gap-1",children:[e(p,{asset:i,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",children:["1 ",i?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),t("div",{className:"flex flex-row items-center gap-1",children:[e(p,{asset:s,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",children:[x(n)," ",s?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:s?.price?`\u2248 $${(s.price*n).toFixed(2)}`:""})]}):v?t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),e(u,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),e(u,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"})})}):t("div",{className:"flex flex-col w-full",children:[e("div",{className:`relative box-border flex flex-row pt-1 h-8 w-full items-center cursor-pointer${m?" overflow-x-auto":""}`,role:"button",tabIndex:0,onClick:()=>c&&r(d=>!d),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),c&&r(k=>!k))},children:e("div",{className:`flex h-full items-center${m?" min-w-max overflow-x-auto":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&i?a&&parseFloat(a.toString())?l?t("div",{className:"translate-y-px font-mono flex w-full flex-row items-center justify-between",children:[t("div",{className:"flex flex-row items-center gap-2 whitespace-nowrap",children:[t("div",{className:"flex flex-row items-center gap-1",children:[e(p,{asset:i,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",children:["1 ",i?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),t("div",{className:"flex flex-row items-center gap-1",children:[e(p,{asset:s,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",children:[x(n)," ",s?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:s?.price?`\u2248 $${(s.price*n).toFixed(2)}`:""})]}),e("span",{className:"text-xs ml-2 transition-transform duration-200 shrink-0",style:{color:"var(--widget-muted-foreground)",transform:o?"rotate(180deg)":"rotate(0deg)",display:"inline-block"},children:"\u25BE"})]}):v?t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),e(u,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),e(u,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"})})}),e("div",{className:"overflow-hidden transition-all duration-200",style:{maxHeight:o&&c?"100px":"0px",opacity:o&&c?1:0},children:t("div",{className:"flex flex-col gap-0.5 pb-1 font-mono",children:[t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"USD Value"}),t("span",{children:["$",s?.price&&l?(s.price*n*parseFloat(l.toString())).toFixed(2):"\u2014"]})]}),t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Rate"}),e("span",{className:"uppercase",children:n>0?`${x(n)} ${s?.symbol??""}`:"\u2014"})]}),t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Order Type"}),e("span",{children:"RFQ (Exact Fill)"})]}),t("div",{className:"flex justify-between items-center text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Route"}),t("a",{href:"https://www.aori.io/scan",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 transition-colors hover:opacity-80",style:{color:"var(--widget-secondary-foreground)",opacity:.5},children:[e(L,{}),"Aori",e(S,{})]})]})]})})]})});y.displayName="QuoteLoader";var q=y;export{q as a};
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;"use client";
|
|
2
|
-
var _chunkXLIAXB6Gcjs = require('./chunk-XLIAXB6G.cjs');var _chunk7MGPLHPIcjs = require('./chunk-7MGPLHPI.cjs');require('./chunk-KH57FLST.cjs');var _chunkX7THKL37cjs = require('./chunk-X7THKL37.cjs');var _chunk6KEQ2NDQcjs = require('./chunk-6KEQ2NDQ.cjs');var _chunk6CVCMRALcjs = require('./chunk-6CVCMRAL.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');require('./chunk-T3I3AJXV.cjs');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _shallow = require('zustand/react/shallow');var _jsxruntime = require('react/jsx-runtime');var qt=({onSwapComplete:e,onSwapInitiated:i})=>{let{web3ConnectionType:g,hasConnectHandler:a,lockBase:s,lockQuote:h,disableInverting:k,tokenDisplay:W,tokenBadgeOrientation:R,widgetType:w}=_chunk6KEQ2NDQcjs.b.call(void 0, ),S=W==="pill"||W==="ghost",C=w==="compact",O=C?"px-4 pt-3 pb-1":"px-4 pt-4 pb-2",z=C?"px-4 pt-4 pb-1":"px-4 pt-6 pb-2",{baseToken:r,quoteToken:t,baseAmount:d,quoteAmount:T,isBaseGasToken:ee,isQuoteGasToken:K,isWrappingPair:u,isUnwrappingPair:p,baseBalance:f,quoteBalance:Y,setBaseAmount:N,setQuoteAmount:v,swapTokens:V,clearForm:M}=_chunkX7THKL37cjs.f.call(void 0, ),{rfqQuote:L,status:G,handleInputChange:q,ensureForParams:y,stop:E,clear:U,refresh:A}=_chunk7MGPLHPIcjs.e.call(void 0, ),{address:x}=_chunk34N36GUDcjs.a.call(void 0, ),{openConnectModal:Z}=_chunk7MGPLHPIcjs.g.call(void 0, ),{isRecipientInputOpen:B,txStatus:$}=_chunkX7THKL37cjs.c.call(void 0, _shallow.useShallow.call(void 0, o=>({isRecipientInputOpen:o.isRecipientInputOpen,txStatus:o.txStatus}))),[j,te]=_react.useState.call(void 0, null),[D,ie]=_react.useState.call(void 0, null),re=_react.useRef.call(void 0, !1),b=!1,J=_react.useMemo.call(void 0, ()=>!r||!t||typeof d!="number"||!T||!x||parseFloat(f.formatted)<d?null:{base:r,quote:t,baseAmount:d,quoteAmount:T,userAddress:x},[r,t,d,T,x,f.formatted]),he=_react.useCallback.call(void 0, o=>{ie(o),_chunkX7THKL37cjs.c.getState().startTracking(o)},[]),be=_react.useCallback.call(void 0, ()=>{re.current=!0,A()},[A]);_react.useEffect.call(void 0, ()=>{if(j===null&&!(!r||!t)){if(!d||d<=0){q({amount:null,inputToken:r,outputToken:t,setOutputAmount:v});return}if(u||p){v(d);return}q({amount:d,inputToken:r,outputToken:t,setOutputAmount:v})}},[j,d,r,t,u,p,q,v]);let ce=_react.useCallback.call(void 0, ()=>{_chunkX7THKL37cjs.c.getState().setView("baseSelection")},[]),ye=_react.useCallback.call(void 0, ()=>{_chunkX7THKL37cjs.c.getState().setView("quoteSelection")},[]),xe=_react.useCallback.call(void 0, ()=>{V(),v(null)},[V,v]),ae=_react.useCallback.call(void 0, ()=>{if(!f.formatted||!r||!t)return;let o=parseFloat(f.formatted);if(!o||o<=0)return;let F=o*.9999999999;u||p?(N(F),v(F),U()):(N(F),v(null),y({inputToken:r,outputToken:t,inputAmount:F.toString(),setOutputAmount:oe=>v(oe)}))},[f.formatted,r,t,u,p,N,v,U,y]),Ne=_react.useCallback.call(void 0, ()=>{U(),M()},[U,M]),pe=f.formatted?parseFloat(f.formatted):null,ke=!!(d||T),Se=_optionalChain([r, 'optionalAccess', _2 => _2.price])&&d?`$${(r.price*d).toFixed(2)}`:"$0.00",Ae=_optionalChain([t, 'optionalAccess', _3 => _3.price])&&T?`$${(t.price*T).toFixed(2)}`:"$0.00",Ce=j==="trackingTx"&&!!D&&!!r&&!!t&&!!d&&!!T;return _jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",children:[Ce&&D&&r&&t&&d&&T?_jsxruntime.jsx.call(void 0, "div",{className:"overflow-hidden",children:_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.w,{orderHash:D,base:r,quote:t,baseAmount:d,quoteAmount:T,status:$})}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{className:`relative ${O}`,style:{borderBottom:"1px solid var(--widget-border)"},children:[S?C?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 mb-2 ${R==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.i,{toggle:ce,side:"base",asset:r,isPlacingOrder:b||s}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.h,{side:"base",asset:_nullishCoalesce(r, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:b,isWrappingPair:u,isUnwrappingPair:p})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${R==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.i,{toggle:ce,side:"base",asset:r,isPlacingOrder:b||s}),_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.h,{side:"base",asset:_nullishCoalesce(r, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:b,isWrappingPair:u,isUnwrappingPair:p})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.i,{toggle:ce,side:"base",asset:r,isPlacingOrder:b||s}),_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.h,{side:"base",asset:_nullishCoalesce(r, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:b,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:Se}),x&&pe!==null&&pe>0&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:ae,disabled:b,className:"absolute bottom-3 right-4 flex items-center px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed transition-colors bg-(--widget-primary) text-(--widget-primary-foreground) hover:bg-(--widget-foreground) hover:text-(--widget-card)",style:{borderRadius:"var(--widget-radius)"},children:"Max"})]})]}),!k&&_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:xe,"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:"\u2191"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",children:"\u2193"})]})}),_jsxruntime.jsxs.call(void 0, "div",{className:`relative ${z}`,children:[S?C?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${R==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.i,{toggle:ye,side:"quote",asset:t,isPlacingOrder:b||h}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.h,{side:"quote",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(r, () => (null)),isPlacingOrder:b,isWrappingPair:u,isUnwrappingPair:p})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${R==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.i,{toggle:ye,side:"quote",asset:t,isPlacingOrder:b||h}),_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.h,{side:"quote",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(r, () => (null)),isPlacingOrder:b,isWrappingPair:u,isUnwrappingPair:p})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.i,{toggle:ye,side:"quote",asset:t,isPlacingOrder:b||h}),_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.h,{side:"quote",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(r, () => (null)),isPlacingOrder:b,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:Ae}),ke&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Ne,disabled:b,className:"absolute bottom-2 right-4 flex items-center px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed transition-colors text-(--widget-muted-foreground) hover:bg-(--widget-secondary)",style:{borderRadius:"var(--widget-radius)"},children:"Clear"})]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-row items-center w-full overflow-hidden",style:{borderTop:B?"1px solid var(--widget-border)":"none",maxHeight:B?"60px":"0px",opacity:B?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.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, _chunkXLIAXB6Gcjs.a,{})})]}),_jsxruntime.jsx.call(void 0, "div",{className:`relative ${Ce?"px-0":"px-4"} ${C?"py-2":"py-4"}`,children:x&&r&&t&&d&&d>0?_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.v,{base:r,baseAmount:d,quote:t,quoteAmount:_nullishCoalesce(T, () => (0)),userAddress:x,isWrappingPair:u,isUnwrappingPair:p,isBaseGasToken:ee,isQuoteGasToken:K,reviewActionProps:J,reviewState:j,setReviewState:te,trackedOrderHash:D,setTrackedOrderHash:ie,onSwapComplete:e,onSwapInitiated:i,onOrderSubmitted:he,onStaleQuoteRestart:be,txStatus:$}):!x&&a?_jsxruntime.jsx.call(void 0, "button",{onClick:()=>Z(),className:`w-full ${C?"py-2":"py-3"} text-sm font-medium cursor-pointer transition-opacity hover:opacity-80`,style:{backgroundColor:"var(--widget-primary)",color:"var(--widget-primary-foreground)",borderRadius:"var(--widget-radius)"},children:"Connect Wallet"}):_jsxruntime.jsx.call(void 0, "button",{disabled:!0,className:`w-full ${C?"py-2":"py-3"} text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed`,style:{backgroundColor:"var(--widget-primary)",color:"var(--widget-primary-foreground)",borderRadius:"var(--widget-radius)"},children:x?"Enter Amount":"Connect Wallet"})})]})},rt=qt;var at=()=>_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"relative px-4 pt-4 pb-2",style:{borderBottom:"1px solid var(--widget-border)"},children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-12 w-full animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-2 h-20 w-2/3 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-1 mb-1 flex w-full items-center justify-between",children:_jsxruntime.jsx.call(void 0, "div",{className:"h-4 w-12 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.4,borderRadius:"0.25rem"}})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center -my-4 relative z-10",children:_jsxruntime.jsx.call(void 0, "div",{className:"h-8 w-8",style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)",borderRadius:"9999px"}})}),_jsxruntime.jsxs.call(void 0, "div",{className:"relative px-4 pt-6 pb-2",children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-12 w-full animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-2 h-20 w-2/3 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-1 mb-1 flex w-full items-center justify-between",children:_jsxruntime.jsx.call(void 0, "div",{className:"h-4 w-12 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.4,borderRadius:"0.25rem"}})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"px-4",style:{height:"28px",borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)"}}),_jsxruntime.jsx.call(void 0, "div",{className:"relative px-4 py-4",children:_jsxruntime.jsx.call(void 0, "div",{className:"w-full animate-pulse",style:{height:"44px",backgroundColor:"var(--widget-secondary)",borderRadius:"var(--widget-radius)",opacity:.6}})})]});var Ht=({targetText:e,isError:i})=>{let{displayText:g,suffix:a,characterColors:s}=_chunk6CVCMRALcjs.y.call(void 0, e,i);return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[g.split("").map((h,k)=>_jsxruntime.jsx.call(void 0, "span",{style:s[k]?{color:"var(--widget-destructive)"}:void 0,children:h},k)),_jsxruntime.jsx.call(void 0, "span",{style:{color:i?"var(--widget-destructive)":"var(--widget-muted-foreground)",opacity:i?.5:1},children:a})]})},Vt=({headerText:e,onBackClick:i,isSameChain:g,isWrappingPair:a,isUnwrappingPair:s,hasLowLiquidity:h,hasInsufficientLiquidity:k,hasRoutingError:W,hasSizeCapError:R})=>{let w=_chunkX7THKL37cjs.c.call(void 0, y=>y.view),{isRecipientInputOpen:S,hasAllowanceError:C,hoveredChainName:O,isTrackingTx:z,txStatus:r,walletTab:t}=_chunkX7THKL37cjs.c.call(void 0, _shallow.useShallow.call(void 0, y=>({isRecipientInputOpen:y.isRecipientInputOpen,hasAllowanceError:y.hasAllowanceError,hoveredChainName:y.hoveredChainName,isTrackingTx:y.isTrackingTx,txStatus:y.txStatus,walletTab:y.walletTab}))),{swapHeaderVariant:d,walletButtonEnabled:T}=_chunk6KEQ2NDQcjs.b.call(void 0, ),{isConnected:ee}=_chunk34N36GUDcjs.a.call(void 0, ),[K,u]=_react.useState.call(void 0, !1);_react.useEffect.call(void 0, ()=>u(!0),[]);let[p,f]=_react.useState.call(void 0, !1),Y=`${w}-${p}-${S}-${O||"none"}`,v=(()=>{if(z&&r)switch(r){case"pending":return"Trade Pending";case"received":return"Trade Received";case"completed":return"Trade Filled";case"failed":return"Trade Failed";case"cancelled":return"Trade Cancelled";default:return"Processing Trade"}if(O&&(w==="baseSelection"||w==="quoteSelection"||w==="baseChainSelection"||w==="quoteChainSelection"))return O;if(w==="swap"&&p)return S?"Remove Custom Recipient":"Add Custom Recipient";switch(w){case"wallet":return"Wallet";case"activity":return"Activity";case"baseSelection":return"Select Source Token";case"quoteSelection":return"Select Destination Token";case"baseChainSelection":return"Select Source Chain";case"quoteChainSelection":return"Select Destination Chain";default:if(w==="swap"){if(C&&!a&&!s)return"Allowance check failed";if(R&&!a&&!s)return"Size limit exceeded";if(k&&!a&&!s)return"Insufficient Liquidity";if(W&&!a&&!s)return"Route Not Found";if(h&&!a&&!s)return"High Price Impact"}return g&&!a&&!s?"Swap":a?"Wrap":s?"Unwrap":e}})(),V=!z&&w==="swap"&&!p&&(C&&!a&&!s||R&&!a&&!s||k&&!a&&!s||W&&!a&&!s||h&&!a&&!s),M={pending:"var(--widget-status-pending)",received:"var(--widget-status-received)",completed:"var(--widget-status-completed)",failed:"var(--widget-status-failed)",cancelled:"var(--widget-status-failed)"},L=()=>!z||!r?null:_nullishCoalesce(M[r], () => (null)),G=()=>z?null:w==="swap"?_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-2",children:[T&&K&&ee&&_jsxruntime.jsx.call(void 0, "button",{onClick:()=>_chunkX7THKL37cjs.c.getState().setView("activity"),"aria-label":"Open activity",className:"size-4 -translate-y-0.5 flex cursor-pointer items-center justify-center rounded-full transition-colors text-(--widget-muted-foreground) opacity-60 hover:text-(--widget-foreground) hover:opacity-100",children:_jsxruntime.jsxs.call(void 0, "svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[_jsxruntime.jsx.call(void 0, "rect",{x:"2",y:"5",width:"20",height:"15",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),_jsxruntime.jsx.call(void 0, "path",{d:"M16 12C16 11.4477 16.4477 11 17 11H21V13H17C16.4477 13 16 12.5523 16 12Z",fill:"currentColor"}),_jsxruntime.jsx.call(void 0, "path",{d:"M2 9H22",stroke:"currentColor",strokeWidth:"1.5"})]})}),_jsxruntime.jsx.call(void 0, "button",{onClick:()=>_chunkX7THKL37cjs.c.getState().toggleRecipientInput(),onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),"aria-label":S?"Remove custom recipient":"Add custom recipient",className:`size-4 -translate-y-0.5 flex cursor-pointer items-center justify-center rounded-full transition-colors hover:text-(--widget-foreground) hover:opacity-100 ${S?"text-(--widget-destructive) opacity-80":"text-(--widget-muted-foreground) opacity-60"}`,children:_jsxruntime.jsxs.call(void 0, "svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[_jsxruntime.jsx.call(void 0, "path",{d:"M2 7.75C1.58579 7.75 1.25 8.08579 1.25 8.5C1.25 8.91421 1.58579 9.25 2 9.25V7.75ZM2 8.5V9.25H13.5V8.5V7.75H2V8.5Z",fill:"currentColor"}),_jsxruntime.jsx.call(void 0, "path",{d:"M6 16.5H8",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"butt",strokeLinejoin:"miter"}),_jsxruntime.jsx.call(void 0, "path",{d:"M10.5 16.5H14.5",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"butt",strokeLinejoin:"miter"}),_jsxruntime.jsx.call(void 0, "path",{d:"M22 12.03V16.11C22 20.5 22 20.5 17.56 20.5H6.44C2 20.5 2 20.5 2 16.11V7.89C2 3.5 2 3.5 6.44 3.5H13.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"miter"}),_jsxruntime.jsxs.call(void 0, "g",{style:{transform:`rotate(${S?"45deg":"0deg"})`,transformOrigin:"18.75px 6.75px",transition:"transform 150ms ease-out"},children:[_jsxruntime.jsx.call(void 0, "path",{d:"M15 6.75H22.5",stroke:"currentColor",strokeWidth:"1.5"}),_jsxruntime.jsx.call(void 0, "path",{d:"M18.75 10.5V3",stroke:"currentColor",strokeWidth:"1.5"})]})]})})]}):_jsxruntime.jsxs.call(void 0, "button",{onClick:()=>i?i():_chunkX7THKL37cjs.c.getState().setView("swap"),className:"flex cursor-pointer items-center justify-center whitespace-nowrap h-6 transition-colors text-(--widget-muted-foreground) opacity-70 hover:text-(--widget-foreground) hover:opacity-100",children:[_jsxruntime.jsx.call(void 0, "span",{className:"pr-1",children:"\u2190"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",children:"Back"})]}),q=L();return d==="none"?null:_jsxruntime.jsxs.call(void 0, "div",{className:"w-full pt-3 px-2 mono text-base flex flex-row justify-between h-6 shrink-0",children:[w==="wallet"?_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-1 mono uppercase -translate-y-0.5 text-xs",children:[_jsxruntime.jsxs.call(void 0, "button",{type:"button",onClick:()=>_chunkX7THKL37cjs.c.getState().setWalletTab("wallet"),className:"cursor-pointer transition-colors",style:{color:t==="wallet"?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-muted-foreground)"},children:">> "}),_jsxruntime.jsx.call(void 0, "span",{children:"Wallet"})]}),_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-foreground)",opacity:.4},children:">>"}),_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>_chunkX7THKL37cjs.c.getState().setWalletTab("activity"),className:"cursor-pointer transition-colors",style:{color:t==="activity"?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:"Activity"})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"mono uppercase -translate-y-0.5 text-xs flex items-center",children:[_jsxruntime.jsx.call(void 0, "span",{className:"mr-1.5",style:{color:"var(--widget-muted-foreground)",opacity:.4},children:">> "}),_jsxruntime.jsx.call(void 0, "span",{className:"relative",style:{color:q||"var(--widget-foreground)"},children:_jsxruntime.jsx.call(void 0, Ht,{targetText:v,isError:_nullishCoalesce(V, () => (!1))})},Y)]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-row items-center",children:G()})]})},Be=Vt;var st=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./AssetSelectionMenu-QAYGXIZN.cjs")))),dt=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./ChainSelectionMenu-73IHIGGD.cjs")))),$t=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./SwapFormHorizontal-PNSM7UFE.cjs")))),jt=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./SwapFormSplit-MT5WGEMG.cjs")))),Dt=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./WidgetWalletPanel-5H3BVAXR.cjs"))).then(e=>({default:e.WidgetWalletPanel}))),Qt=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./WalletPlaceholderPanel-TTONBBI4.cjs"))).then(e=>({default:e.WalletPlaceholderPanel}))),_t=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./WidgetWalletTradeHistory-CW34HAHS.cjs"))).then(e=>({default:e.WidgetWalletTradeHistory}))),Kt=({onSwapComplete:e,cardStyles:i,cardWidth:g})=>{let{baseToken:a,quoteToken:s,baseAmount:h,quoteAmount:k,isWrappingPair:W,isUnwrappingPair:R,isRegistryLoading:w}=_chunkX7THKL37cjs.f.call(void 0, ),{liquidityError:S,routingError:C,sizeCapError:O,stop:z,clear:r}=_chunk7MGPLHPIcjs.e.call(void 0, ),t=_chunkX7THKL37cjs.c.call(void 0, o=>o.view),{isTransitioning:d,isRecipientInputOpen:T,recipient:ee,selectedChainFilterChainId:K}=_chunkX7THKL37cjs.c.call(void 0, _shallow.useShallow.call(void 0, o=>({isTransitioning:o.isTransitioning,isRecipientInputOpen:o.isRecipientInputOpen,recipient:o.recipient,selectedChainFilterChainId:_nullishCoalesce(_optionalChain([o, 'access', _4 => _4.selectedChainFilter, 'optionalAccess', _5 => _5.chainId]), () => (null))}))),u=_react.useRef.call(void 0, null),p=_react.useRef.call(void 0, null),[f,Y]=_react.useState.call(void 0, null);_chunk7MGPLHPIcjs.c.call(void 0, ),_react.useEffect.call(void 0, ()=>()=>{u.current&&clearTimeout(u.current),p.current&&clearTimeout(p.current)},[]),_react.useEffect.call(void 0, ()=>{_chunkX7THKL37cjs.c.getState().resetUI()},[]),_react.useEffect.call(void 0, ()=>{if(d)return u.current=setTimeout(()=>{_chunkX7THKL37cjs.c.getState().setIsTransitioning(!1),u.current=null},20),()=>{u.current&&(clearTimeout(u.current),u.current=null)}},[d]);let N=_react.useCallback.call(void 0, (o,F="navigation")=>{p.current&&(clearTimeout(p.current),p.current=null,Y(null)),_chunkX7THKL37cjs.c.getState().view!=="swap"&&o!=="swap"?(_chunkX7THKL37cjs.c.getState().setView(o),_chunkX7THKL37cjs.c.getState().setIsTransitioning(!1)):_chunkX7THKL37cjs.c.getState().transitionToView(o,F)},[]),v=_react.useCallback.call(void 0, ()=>{u.current&&(clearTimeout(u.current),u.current=null),p.current&&(clearTimeout(p.current),p.current=null);let o=_chunkX7THKL37cjs.c.getState().view;Y(o),_chunkX7THKL37cjs.c.getState().setChainFilter(null),_chunkX7THKL37cjs.c.getState().setView("swap"),_chunkX7THKL37cjs.c.getState().setIsTransitioning(!1),_chunkX7THKL37cjs.c.getState().resetAssetSelection(),p.current=setTimeout(()=>{Y(null),p.current=null},200)},[]),V=_react.useCallback.call(void 0, o=>{let oe=t==="baseChainSelection"?"base":"quote";_chunkX7THKL37cjs.c.getState().setChainFilter({chainId:o,side:oe}),_chunkX7THKL37cjs.c.getState().pushRecentChain(o),N(oe==="base"?"baseSelection":"quoteSelection","chainSelection")},[t,N]),M=_react.useCallback.call(void 0, ()=>{let o=_chunkX7THKL37cjs.c.getState().view;o==="baseSelection"?N("baseChainSelection","chainSelection"):o==="quoteSelection"&&N("quoteChainSelection","chainSelection")},[N]),L=_react.useCallback.call(void 0, ()=>{z(),r()},[z,r]),G=a&&s?a.chainId===s.chainId:!0,q=()=>{switch(t){case"wallet":return"Wallet";case"baseSelection":return"Select Input Token";case"quoteSelection":return"Select Output Token";case"baseChainSelection":case"quoteChainSelection":return"Select Chain";default:return"Swap"}},{assetMenuVariant:y,widgetType:E,customWalletUI:U}=_chunk6KEQ2NDQcjs.b.call(void 0, ),A=t==="baseSelection"||t==="quoteSelection",x=t==="baseChainSelection"||t==="quoteChainSelection",Z=y==="split"&&(E==="default"||E==="compact"),B=y==="split"&&(E==="horizontal"||E==="split"),$=y==="default",j=t==="swap"||A||x||t==="wallet"||t==="activity",te=f==="baseSelection"||f==="quoteSelection",D=f==="baseChainSelection"||f==="quoteChainSelection",ie=A||te,re=x||D,b=A&&!d,J=x&&!d,he=A?t:f,be=he==="baseSelection"?"base":"quote",ce=he==="baseSelection"?s:a,xe=(x?t:f)==="baseChainSelection"?"base":"quote",ae=o=>({backgroundColor:"var(--widget-background)",opacity:o?1:0,transform:o?"translateY(0)":"translateY(6px)",transition:"opacity 200ms ease-in-out, transform 200ms ease-in-out"}),Ne=$&&(A||x||t==="wallet"||t==="activity"||f!=null),pe=w?_jsxruntime.jsx.call(void 0, at,{}):E==="horizontal"?_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, $t,{onSwapComplete:e,onSwapInitiated:L,onBackToSwap:B?v:void 0,onMoreChainsClick:B?M:void 0})}):E==="split"?_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, jt,{onSwapComplete:e,onSwapInitiated:L,onBackToSwap:B?v:void 0,onMoreChainsClick:B?M:void 0})}):_jsxruntime.jsx.call(void 0, rt,{onSwapComplete:e,onSwapInitiated:L}),ke=_nullishCoalesce(i, () => ({})),Se=_react.useRef.call(void 0, null),[Ae,Ce]=_react.useState.call(void 0, 420);return _react.useEffect.call(void 0, ()=>{if(!Z)return;let o=Se.current;if(!o)return;let F=new ResizeObserver(oe=>{for(let ft of oe)Ce(ft.contentRect.height)});return F.observe(o),()=>F.disconnect()},[Z]),Z?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{ref:Se,className:"flex flex-col w-full overflow-hidden transition-colors duration-300",style:{flex:"1 1 0",minWidth:0,...ke},children:[_jsxruntime.jsx.call(void 0, Be,{headerText:"Swap",onBackClick:v,isSameChain:G,isWrappingPair:W,isUnwrappingPair:R,hasLowLiquidity:S,hasInsufficientLiquidity:S,hasRoutingError:C,hasSizeCapError:O}),_jsxruntime.jsx.call(void 0, "div",{className:"overflow-hidden",children:pe})]}),(ie||re)&&_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col overflow-hidden shrink-0",style:{width:g,height:`${Ae}px`,...ke,...ae((A||x)&&!d)},children:A||te?_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, st,{toggle:v,side:be,otherAsset:ce,onMoreChainsClick:M,selectedChainFilter:K})}):_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, dt,{toggle:v,side:xe,onChainSelect:V})})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",style:{overflow:"hidden",position:"relative"},children:[_jsxruntime.jsx.call(void 0, Be,{headerText:q(),onBackClick:v,isSameChain:G,isWrappingPair:W,isUnwrappingPair:R,hasLowLiquidity:S,hasInsufficientLiquidity:S,hasRoutingError:C,hasSizeCapError:O}),_jsxruntime.jsxs.call(void 0, "div",{className:"relative overflow-hidden",children:[j&&_jsxruntime.jsx.call(void 0, "div",{className:"overflow-hidden",style:Ne?{pointerEvents:"none"}:void 0,children:pe}),(t==="wallet"||f==="wallet")&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute inset-0 overflow-hidden",style:ae(t==="wallet"&&!d),children:_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:U==="none"?_jsxruntime.jsx.call(void 0, Qt,{}):_jsxruntime.jsx.call(void 0, Dt,{})})}),(t==="activity"||f==="activity")&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute inset-0 overflow-y-auto",style:ae(t==="activity"&&!d),children:_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, _t,{isActive:t==="activity"})})}),$&&ie&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute inset-0 overflow-hidden",style:ae(b),children:_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, st,{toggle:v,side:be,otherAsset:ce,onMoreChainsClick:M,selectedChainFilter:K})})}),$&&re&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute inset-0 overflow-hidden",style:ae(J),children:_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, dt,{toggle:v,side:xe,onChainSelect:V})})})]})]})},lt=({onSwapComplete:e,defaultBaseToken:i,defaultQuoteToken:g,onBaseTokenChange:a,onQuoteTokenChange:s,cardStyles:h,cardWidth:k})=>{let{address:W}=_chunk34N36GUDcjs.a.call(void 0, ),R=_chunkX7THKL37cjs.c.call(void 0, w=>w.recipient);return _jsxruntime.jsx.call(void 0, _chunkX7THKL37cjs.e,{defaultBaseToken:i,defaultQuoteToken:g,onBaseTokenChange:a,onQuoteTokenChange:s,children:_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.d,{recipient:R,children:_jsxruntime.jsx.call(void 0, Kt,{onSwapComplete:e,cardStyles:h,cardWidth:k})})})};var Ee={background:"#ffffff",foreground:"#0a0a0a",card:"#ffffff","card-foreground":"#0a0a0a",popover:"#ffffff","popover-foreground":"#0a0a0a",primary:"#171717","primary-foreground":"#fafafa",secondary:"#f5f5f5","secondary-foreground":"#171717",muted:"#f5f5f5","muted-foreground":"#737373",accent:"#f5f5f5","accent-foreground":"#171717",destructive:"#e7000b","destructive-foreground":"#ffffff",border:"#e5e5e5",input:"#e5e5e5",ring:"#a1a1a1",radius:"0.625rem","border-style":"dotted","status-pending":"#a1a1aa","status-received":"#f59e0b","status-completed":"#10b981","status-failed":"#ef4444"},ve= exports.defaultDarkTheme ={background:"#0a0a0a",foreground:"#fafafa",card:"#171717","card-foreground":"#fafafa",popover:"#262626","popover-foreground":"#fafafa",primary:"#e5e5e5","primary-foreground":"#171717",secondary:"#262626","secondary-foreground":"#fafafa",muted:"#262626","muted-foreground":"#a1a1a1",accent:"#404040","accent-foreground":"#fafafa",destructive:"#ff6467","destructive-foreground":"#fafafa",border:"#282828",input:"#343434",ring:"#737373",radius:"0.625rem","border-style":"dotted","status-pending":"#a1a1aa","status-received":"#fbbf24","status-completed":"#2dd4bf","status-failed":"#fb7185"};function Fe(e){let i={"--widget-background":e.background,"--widget-foreground":e.foreground,"--widget-card":e.card,"--widget-card-foreground":e["card-foreground"],"--widget-popover":e.popover,"--widget-popover-foreground":e["popover-foreground"],"--widget-primary":e.primary,"--widget-primary-foreground":e["primary-foreground"],"--widget-secondary":e.secondary,"--widget-secondary-foreground":e["secondary-foreground"],"--widget-muted":e.muted,"--widget-muted-foreground":e["muted-foreground"],"--widget-accent":e.accent,"--widget-accent-foreground":e["accent-foreground"],"--widget-destructive":e.destructive,"--widget-destructive-foreground":e["destructive-foreground"],"--widget-border":e.border,"--widget-input":e.input,"--widget-ring":e.ring,"--widget-radius":e.radius,"--widget-border-style":e["border-style"]||"dotted"};return i["--widget-font-sans"]=e["font-sans"]||"inherit",i["--widget-font-mono"]=e["font-mono"]||"inherit",i["--widget-shadow-color"]=e["shadow-color"]||"oklch(0 0 0)",i["--widget-shadow-opacity"]=e["shadow-opacity"]||"0.1",i["--widget-shadow-blur"]=e["shadow-blur"]||"3px",i["--widget-shadow-spread"]=e["shadow-spread"]||"0px",i["--widget-shadow-offset-x"]=e["shadow-offset-x"]||"0",i["--widget-shadow-offset-y"]=e["shadow-offset-y"]||"1px",i["--widget-letter-spacing"]=e["letter-spacing"]||"normal",i["--widget-status-pending"]=e["status-pending"]||"#a1a1aa",i["--widget-status-received"]=e["status-received"]||"#fbbf24",i["--widget-status-completed"]=e["status-completed"]||"#2dd4bf",i["--widget-status-failed"]=e["status-failed"]||"#fb7185",i}var ct=_react.createContext.call(void 0, ve);function He({theme:e,children:i}){return _jsxruntime.jsx.call(void 0, ct.Provider,{value:e,children:i})}function Jt(){return _react.useContext.call(void 0, ct)}var ti=[],ii=[],ri=[],pt=[],ai=`
|
|
2
|
+
var _chunkCGCLB56Ncjs = require('./chunk-CGCLB56N.cjs');var _chunkVGYWFUHRcjs = require('./chunk-VGYWFUHR.cjs');var _chunkH3GNDVMTcjs = require('./chunk-H3GNDVMT.cjs');require('./chunk-KH57FLST.cjs');var _chunkPD3AGQJPcjs = require('./chunk-PD3AGQJP.cjs');var _chunkJCH7AXABcjs = require('./chunk-JCH7AXAB.cjs');var _chunkTZYKUGNPcjs = require('./chunk-TZYKUGNP.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');require('./chunk-T3I3AJXV.cjs');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _shallow = require('zustand/react/shallow');var _jsxruntime = require('react/jsx-runtime');var Ht=({onSwapComplete:e,onSwapInitiated:t})=>{let{web3ConnectionType:g,hasConnectHandler:r,lockBase:s,lockQuote:v,disableInverting:k,tokenDisplay:N,tokenBadgeOrientation:W,widgetType:p}=_chunkJCH7AXABcjs.b.call(void 0, ),{effectiveInputTokens:R,effectiveOutputTokens:H}=_chunkH3GNDVMTcjs.a.call(void 0, ),S=R.length===1,C=H.length===1,I=N==="pill"||N==="ghost",a=p==="compact",A=a?"px-4 pt-3 pb-1":"px-4 pt-4 pb-2",X=a?"px-4 pt-4 pb-1":"px-4 pt-6 pb-2",{baseToken:d,quoteToken:o,baseAmount:n,quoteAmount:w,isBaseGasToken:b,isQuoteGasToken:D,isWrappingPair:h,isUnwrappingPair:m,baseBalance:P,quoteBalance:j,setBaseAmount:B,setQuoteAmount:y,swapTokens:Q,clearForm:x}=_chunkPD3AGQJPcjs.f.call(void 0, ),{rfqQuote:U,status:we,handleInputChange:z,ensureForParams:E,stop:ee,clear:q,refresh:_}=_chunkVGYWFUHRcjs.e.call(void 0, ),{address:O}=_chunk34N36GUDcjs.a.call(void 0, ),{openConnectModal:te}=_chunkVGYWFUHRcjs.g.call(void 0, ),{isRecipientInputOpen:J,txStatus:ie}=_chunkPD3AGQJPcjs.c.call(void 0, _shallow.useShallow.call(void 0, K=>({isRecipientInputOpen:K.isRecipientInputOpen,txStatus:K.txStatus}))),[$,ce]=_react.useState.call(void 0, null),[L,ue]=_react.useState.call(void 0, null),xe=_react.useRef.call(void 0, !1),T=!1,$e=_react.useMemo.call(void 0, ()=>!d||!o||typeof n!="number"||!w||!O||parseFloat(P.formatted)<n?null:{base:d,quote:o,baseAmount:n,quoteAmount:w,userAddress:O},[d,o,n,w,O,P.formatted]),ke=_react.useCallback.call(void 0, K=>{ue(K),_chunkPD3AGQJPcjs.c.getState().startTracking(K)},[]),re=_react.useCallback.call(void 0, ()=>{xe.current=!0,_()},[_]);_react.useEffect.call(void 0, ()=>{if($===null&&!(!d||!o)){if(!n||n<=0){z({amount:null,inputToken:d,outputToken:o,setOutputAmount:y});return}if(h||m){y(n);return}z({amount:n,inputToken:d,outputToken:o,setOutputAmount:y})}},[$,n,d,o,h,m,z,y]);let fe=_react.useCallback.call(void 0, ()=>{_chunkPD3AGQJPcjs.c.getState().setView("baseSelection")},[]),ge=_react.useCallback.call(void 0, ()=>{_chunkPD3AGQJPcjs.c.getState().setView("quoteSelection")},[]),Se=_react.useCallback.call(void 0, ()=>{Q(),y(null)},[Q,y]),Ce=_react.useCallback.call(void 0, ()=>{if(!P.formatted||!d||!o)return;let K=parseFloat(P.formatted);if(!K||K<=0)return;let Re=K*.9999999999;h||m?(B(Re),y(Re),q()):(B(Re),y(null),E({inputToken:d,outputToken:o,inputAmount:Re.toString(),setOutputAmount:yt=>y(yt)}))},[P.formatted,d,o,h,m,B,y,q,E]),ze=_react.useCallback.call(void 0, ()=>{q(),x()},[q,x]),Te=P.formatted?parseFloat(P.formatted):null,u=!!(n||w),ae=_optionalChain([d, 'optionalAccess', _2 => _2.price])&&n?`$${(d.price*n).toFixed(2)}`:"$0.00",oe=_optionalChain([o, 'optionalAccess', _3 => _3.price])&&w?`$${(o.price*w).toFixed(2)}`:"$0.00",We=$==="trackingTx"&&!!L&&!!d&&!!o&&!!n&&!!w;return _jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",children:[We&&L&&d&&o&&n&&w?_jsxruntime.jsx.call(void 0, "div",{className:"overflow-hidden",children:_jsxruntime.jsx.call(void 0, _chunkVGYWFUHRcjs.x,{orderHash:L,base:d,quote:o,baseAmount:n,quoteAmount:w,status:ie})}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{className:`relative ${A}`,style:{borderBottom:"1px solid var(--widget-border)"},children:[I?a?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 mb-2 ${W==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkVGYWFUHRcjs.i,{toggle:fe,side:"base",asset:d,isPlacingOrder:T||s||S,hideDropdown:S}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkVGYWFUHRcjs.h,{side:"base",asset:_nullishCoalesce(d, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:T,isWrappingPair:h,isUnwrappingPair:m})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${W==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkVGYWFUHRcjs.i,{toggle:fe,side:"base",asset:d,isPlacingOrder:T||s||S,hideDropdown:S}),_jsxruntime.jsx.call(void 0, _chunkVGYWFUHRcjs.h,{side:"base",asset:_nullishCoalesce(d, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:T,isWrappingPair:h,isUnwrappingPair:m})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkVGYWFUHRcjs.i,{toggle:fe,side:"base",asset:d,isPlacingOrder:T||s||S,hideDropdown:S}),_jsxruntime.jsx.call(void 0, _chunkVGYWFUHRcjs.h,{side:"base",asset:_nullishCoalesce(d, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:T,isWrappingPair:h,isUnwrappingPair:m})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"mb-1 flex w-full flex-row items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"mono text-sm",style:{color:"var(--widget-muted-foreground)"},children:ae}),O&&Te!==null&&Te>0&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Ce,disabled:T,className:"absolute bottom-3 right-4 flex items-center px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed transition-colors bg-(--widget-primary) text-(--widget-primary-foreground) hover:bg-(--widget-foreground) hover:text-(--widget-card)",style:{borderRadius:"var(--widget-radius)"},children:"Max"})]})]}),!k&&_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center -my-4 relative z-10",children:_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Se,"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, _chunkVGYWFUHRcjs.k,{className:"w-3.5 h-3.5"})})}),_jsxruntime.jsxs.call(void 0, "div",{className:`relative ${X}`,children:[I?a?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${W==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkVGYWFUHRcjs.i,{toggle:ge,side:"quote",asset:o,isPlacingOrder:T||v||C,hideDropdown:C}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkVGYWFUHRcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(d, () => (null)),isPlacingOrder:T,isWrappingPair:h,isUnwrappingPair:m})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${W==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkVGYWFUHRcjs.i,{toggle:ge,side:"quote",asset:o,isPlacingOrder:T||v||C,hideDropdown:C}),_jsxruntime.jsx.call(void 0, _chunkVGYWFUHRcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(d, () => (null)),isPlacingOrder:T,isWrappingPair:h,isUnwrappingPair:m})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkVGYWFUHRcjs.i,{toggle:ge,side:"quote",asset:o,isPlacingOrder:T||v||C,hideDropdown:C}),_jsxruntime.jsx.call(void 0, _chunkVGYWFUHRcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(d, () => (null)),isPlacingOrder:T,isWrappingPair:h,isUnwrappingPair:m})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex w-full flex-row items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"mono text-sm",style:{color:"var(--widget-muted-foreground)"},children:oe}),u&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:ze,disabled:T,className:"absolute bottom-2 right-4 flex items-center px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed transition-colors text-(--widget-muted-foreground) hover:bg-(--widget-secondary)",style:{borderRadius:"var(--widget-radius)"},children:"Clear"})]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-row items-center w-full overflow-hidden",style:{borderTop:J?"1px solid var(--widget-border)":"none",maxHeight:J?"60px":"0px",opacity:J?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:_jsxruntime.jsx.call(void 0, _chunkVGYWFUHRcjs.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, _chunkCGCLB56Ncjs.a,{})})]}),_jsxruntime.jsx.call(void 0, "div",{className:`relative ${We?"px-0 pb-4":"px-4"} ${a?"py-2":"py-4"}`,children:O&&d&&o&&n&&n>0?_jsxruntime.jsx.call(void 0, _chunkVGYWFUHRcjs.w,{base:d,baseAmount:n,quote:o,quoteAmount:_nullishCoalesce(w, () => (0)),userAddress:O,isWrappingPair:h,isUnwrappingPair:m,isBaseGasToken:b,isQuoteGasToken:D,reviewActionProps:$e,reviewState:$,setReviewState:ce,trackedOrderHash:L,setTrackedOrderHash:ue,onSwapComplete:e,onSwapInitiated:t,onOrderSubmitted:ke,onStaleQuoteRestart:re,txStatus:ie}):!O&&r?_jsxruntime.jsx.call(void 0, "button",{onClick:()=>te(),className:`w-full ${a?"py-2":"py-3"} text-sm font-medium cursor-pointer transition-opacity hover:opacity-80`,style:{backgroundColor:"var(--widget-primary)",color:"var(--widget-primary-foreground)",borderRadius:"var(--widget-radius)"},children:"Connect Wallet"}):_jsxruntime.jsx.call(void 0, "button",{disabled:!0,className:`w-full ${a?"py-2":"py-3"} text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed`,style:{backgroundColor:"var(--widget-primary)",color:"var(--widget-primary-foreground)",borderRadius:"var(--widget-radius)"},children:O?"Enter Amount":"Connect Wallet"})})]})},dt=Ht;var lt=()=>_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"relative px-4 pt-4 pb-2",style:{borderBottom:"1px solid var(--widget-border)"},children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-12 w-full animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-2 h-20 w-2/3 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-1 mb-1 flex w-full items-center justify-between",children:_jsxruntime.jsx.call(void 0, "div",{className:"h-4 w-12 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.4,borderRadius:"0.25rem"}})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center -my-4 relative z-10",children:_jsxruntime.jsx.call(void 0, "div",{className:"h-8 w-8",style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)",borderRadius:"9999px"}})}),_jsxruntime.jsxs.call(void 0, "div",{className:"relative px-4 pt-6 pb-2",children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-12 w-full animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-2 h-20 w-2/3 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-1 mb-1 flex w-full items-center justify-between",children:_jsxruntime.jsx.call(void 0, "div",{className:"h-4 w-12 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.4,borderRadius:"0.25rem"}})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"px-4",style:{height:"28px",borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)"}}),_jsxruntime.jsx.call(void 0, "div",{className:"relative px-4 py-4",children:_jsxruntime.jsx.call(void 0, "div",{className:"w-full animate-pulse",style:{height:"44px",backgroundColor:"var(--widget-secondary)",borderRadius:"var(--widget-radius)",opacity:.6}})})]});var $t=({targetText:e,isError:t})=>{let{displayText:g,suffix:r,characterColors:s}=_chunkTZYKUGNPcjs.y.call(void 0, e,t);return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[g.split("").map((v,k)=>_jsxruntime.jsx.call(void 0, "span",{style:s[k]?{color:"var(--widget-destructive)"}:void 0,children:v},k)),_jsxruntime.jsx.call(void 0, "span",{style:{color:t?"var(--widget-destructive)":"var(--widget-muted-foreground)",opacity:t?.5:1},children:r})]})},Dt=({headerText:e,onBackClick:t,isSameChain:g,isWrappingPair:r,isUnwrappingPair:s,hasLowLiquidity:v,hasInsufficientLiquidity:k,hasRoutingError:N,hasSizeCapError:W})=>{let p=_chunkPD3AGQJPcjs.c.call(void 0, x=>x.view),{isRecipientInputOpen:R,hasAllowanceError:H,hoveredChainName:S,isTrackingTx:C,txStatus:I,walletTab:a}=_chunkPD3AGQJPcjs.c.call(void 0, _shallow.useShallow.call(void 0, x=>({isRecipientInputOpen:x.isRecipientInputOpen,hasAllowanceError:x.hasAllowanceError,hoveredChainName:x.hoveredChainName,isTrackingTx:x.isTrackingTx,txStatus:x.txStatus,walletTab:x.walletTab}))),{swapHeaderVariant:A,walletButtonEnabled:X}=_chunkJCH7AXABcjs.b.call(void 0, ),{isConnected:d}=_chunk34N36GUDcjs.a.call(void 0, ),[o,n]=_react.useState.call(void 0, !1);_react.useEffect.call(void 0, ()=>n(!0),[]);let[w,b]=_react.useState.call(void 0, !1),D=`${p}-${w}-${R}-${S||"none"}`,m=(()=>{if(C&&I)switch(I){case"pending":return"Trade Pending";case"received":return"Trade Received";case"completed":return"Trade Filled";case"failed":return"Trade Failed";case"cancelled":return"Trade Cancelled";default:return"Processing Trade"}if(S&&(p==="baseSelection"||p==="quoteSelection"||p==="baseChainSelection"||p==="quoteChainSelection"))return S;if(p==="swap"&&w)return R?"Remove Custom Recipient":"Add Custom Recipient";switch(p){case"wallet":return"Wallet";case"activity":return"Activity";case"baseSelection":return"Select Source Token";case"quoteSelection":return"Select Destination Token";case"baseChainSelection":return"Select Source Chain";case"quoteChainSelection":return"Select Destination Chain";default:if(p==="swap"){if(H&&!r&&!s)return"Allowance check failed";if(W&&!r&&!s)return"Size limit exceeded";if(k&&!r&&!s)return"Insufficient Liquidity";if(N&&!r&&!s)return"Route Not Found";if(v&&!r&&!s)return"High Price Impact"}return g&&!r&&!s?"Swap":r?"Wrap":s?"Unwrap":e}})(),P=!C&&p==="swap"&&!w&&(H&&!r&&!s||W&&!r&&!s||k&&!r&&!s||N&&!r&&!s||v&&!r&&!s),j={pending:"var(--widget-primary)",received:"var(--widget-primary)",completed:"var(--widget-status-completed)",failed:"var(--widget-status-failed)",cancelled:"var(--widget-status-failed)"},B=()=>!C||!I?null:_nullishCoalesce(j[I], () => (null)),y=()=>C?_jsxruntime.jsx.call(void 0, "button",{onClick:()=>_optionalChain([_chunkPD3AGQJPcjs.c, 'access', _4 => _4.getState, 'call', _5 => _5(), 'access', _6 => _6.exitHandler, 'optionalCall', _7 => _7()]),"aria-label":"Close trade status",className:"size-4 -translate-y-0.5 flex cursor-pointer items-center justify-center transition-colors text-(--widget-muted-foreground) opacity-60 hover:text-(--widget-foreground) hover:opacity-100",children:_jsxruntime.jsxs.call(void 0, "svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[_jsxruntime.jsx.call(void 0, "path",{d:"M18 6L6 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),_jsxruntime.jsx.call(void 0, "path",{d:"M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}):p==="swap"?_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-2",children:[X&&o&&d&&_jsxruntime.jsx.call(void 0, "button",{onClick:()=>_chunkPD3AGQJPcjs.c.getState().setView("activity"),"aria-label":"Open activity",className:"size-4 -translate-y-0.5 flex cursor-pointer items-center justify-center rounded-full transition-colors text-(--widget-muted-foreground) opacity-60 hover:text-(--widget-foreground) hover:opacity-100",children:_jsxruntime.jsxs.call(void 0, "svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[_jsxruntime.jsx.call(void 0, "path",{d:"M12 8V12L14.5 14.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),_jsxruntime.jsx.call(void 0, "path",{d:"M3.05 11A9 9 0 1 1 3.05 13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),_jsxruntime.jsx.call(void 0, "path",{d:"M1 7.5L3.05 11L6.5 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),_jsxruntime.jsx.call(void 0, "button",{onClick:()=>_chunkPD3AGQJPcjs.c.getState().toggleRecipientInput(),onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1),"aria-label":R?"Remove custom recipient":"Add custom recipient",className:`size-4 -translate-y-0.5 flex cursor-pointer items-center justify-center rounded-full transition-colors hover:text-(--widget-foreground) hover:opacity-100 ${R?"text-(--widget-destructive) opacity-80":"text-(--widget-muted-foreground) opacity-60"}`,children:_jsxruntime.jsxs.call(void 0, "svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[_jsxruntime.jsx.call(void 0, "path",{d:"M2 7.75C1.58579 7.75 1.25 8.08579 1.25 8.5C1.25 8.91421 1.58579 9.25 2 9.25V7.75ZM2 8.5V9.25H13.5V8.5V7.75H2V8.5Z",fill:"currentColor"}),_jsxruntime.jsx.call(void 0, "path",{d:"M6 16.5H8",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"butt",strokeLinejoin:"miter"}),_jsxruntime.jsx.call(void 0, "path",{d:"M10.5 16.5H14.5",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"butt",strokeLinejoin:"miter"}),_jsxruntime.jsx.call(void 0, "path",{d:"M22 12.03V16.11C22 20.5 22 20.5 17.56 20.5H6.44C2 20.5 2 20.5 2 16.11V7.89C2 3.5 2 3.5 6.44 3.5H13.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"miter"}),_jsxruntime.jsxs.call(void 0, "g",{style:{transform:`rotate(${R?"45deg":"0deg"})`,transformOrigin:"18.75px 6.75px",transition:"transform 150ms ease-out"},children:[_jsxruntime.jsx.call(void 0, "path",{d:"M15 6.75H22.5",stroke:"currentColor",strokeWidth:"1.5"}),_jsxruntime.jsx.call(void 0, "path",{d:"M18.75 10.5V3",stroke:"currentColor",strokeWidth:"1.5"})]})]})})]}):_jsxruntime.jsxs.call(void 0, "button",{onClick:()=>t?t():_chunkPD3AGQJPcjs.c.getState().setView("swap"),className:"flex cursor-pointer items-center justify-center whitespace-nowrap h-6 transition-colors text-(--widget-muted-foreground) opacity-70 hover:text-(--widget-foreground) hover:opacity-100",children:[_jsxruntime.jsx.call(void 0, "span",{className:"pr-1",children:"\u2190"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",children:"Back"})]}),Q=B();return A==="none"?null:_jsxruntime.jsxs.call(void 0, "div",{className:"w-full pt-3 px-2 mono text-base flex flex-row justify-between h-6 shrink-0",children:[p==="wallet"?_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-1 mono uppercase -translate-y-0.5 text-xs",children:[_jsxruntime.jsxs.call(void 0, "button",{type:"button",onClick:()=>_chunkPD3AGQJPcjs.c.getState().setWalletTab("wallet"),className:"cursor-pointer transition-colors",style:{color:a==="wallet"?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-muted-foreground)"},children:">> "}),_jsxruntime.jsx.call(void 0, "span",{children:"Wallet"})]}),_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-foreground)",opacity:.4},children:">>"}),_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>_chunkPD3AGQJPcjs.c.getState().setWalletTab("activity"),className:"cursor-pointer transition-colors",style:{color:a==="activity"?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:"Activity"})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"mono uppercase -translate-y-0.5 text-xs flex items-center",children:[_jsxruntime.jsx.call(void 0, "span",{className:"mr-1.5",style:{color:"var(--widget-muted-foreground)",opacity:.4},children:">> "}),_jsxruntime.jsx.call(void 0, "span",{className:"relative",style:{color:Q||"var(--widget-foreground)"},children:_jsxruntime.jsx.call(void 0, $t,{targetText:m,isError:_nullishCoalesce(P, () => (!1))})},D)]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-row items-center",children:y()})]})},qe=Dt;var pt=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./AssetSelectionMenu-QVUV6BOC.cjs")))),wt=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./ChainSelectionMenu-O252URI3.cjs")))),Kt=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./SwapFormHorizontal-MMVDC6GD.cjs")))),Yt=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./SwapFormSplit-WBFUNXIC.cjs")))),Gt=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./WidgetWalletPanel-7TQ7PGCA.cjs"))).then(e=>({default:e.WidgetWalletPanel}))),Jt=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./WalletPlaceholderPanel-TTONBBI4.cjs"))).then(e=>({default:e.WalletPlaceholderPanel}))),Zt=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./WidgetWalletTradeHistory-5BGYCWLA.cjs"))).then(e=>({default:e.WidgetWalletTradeHistory}))),Xt=({onSwapComplete:e,cardStyles:t,cardWidth:g})=>{let{baseToken:r,quoteToken:s,baseAmount:v,quoteAmount:k,isWrappingPair:N,isUnwrappingPair:W,isRegistryLoading:p}=_chunkPD3AGQJPcjs.f.call(void 0, ),{liquidityError:R,routingError:H,sizeCapError:S,stop:C,clear:I}=_chunkVGYWFUHRcjs.e.call(void 0, ),a=_chunkPD3AGQJPcjs.c.call(void 0, u=>u.view),{isTransitioning:A,isRecipientInputOpen:X,recipient:d,selectedChainFilterChainId:o}=_chunkPD3AGQJPcjs.c.call(void 0, _shallow.useShallow.call(void 0, u=>({isTransitioning:u.isTransitioning,isRecipientInputOpen:u.isRecipientInputOpen,recipient:u.recipient,selectedChainFilterChainId:_nullishCoalesce(_optionalChain([u, 'access', _8 => _8.selectedChainFilter, 'optionalAccess', _9 => _9.chainId]), () => (null))}))),n=_react.useRef.call(void 0, null),w=_react.useRef.call(void 0, null),[b,D]=_react.useState.call(void 0, null);_chunkVGYWFUHRcjs.c.call(void 0, ),_react.useEffect.call(void 0, ()=>()=>{n.current&&clearTimeout(n.current),w.current&&clearTimeout(w.current)},[]),_react.useEffect.call(void 0, ()=>{_chunkPD3AGQJPcjs.c.getState().resetUI()},[]),_react.useEffect.call(void 0, ()=>{if(A)return n.current=setTimeout(()=>{_chunkPD3AGQJPcjs.c.getState().setIsTransitioning(!1),n.current=null},20),()=>{n.current&&(clearTimeout(n.current),n.current=null)}},[A]);let h=_react.useCallback.call(void 0, (u,ae="navigation")=>{w.current&&(clearTimeout(w.current),w.current=null,D(null)),_chunkPD3AGQJPcjs.c.getState().view!=="swap"&&u!=="swap"?(_chunkPD3AGQJPcjs.c.getState().setView(u),_chunkPD3AGQJPcjs.c.getState().setIsTransitioning(!1)):_chunkPD3AGQJPcjs.c.getState().transitionToView(u,ae)},[]),m=_react.useCallback.call(void 0, ()=>{n.current&&(clearTimeout(n.current),n.current=null),w.current&&(clearTimeout(w.current),w.current=null);let u=_chunkPD3AGQJPcjs.c.getState().view;D(u),_chunkPD3AGQJPcjs.c.getState().setChainFilter(null),_chunkPD3AGQJPcjs.c.getState().setView("swap"),_chunkPD3AGQJPcjs.c.getState().setIsTransitioning(!1),_chunkPD3AGQJPcjs.c.getState().resetAssetSelection(),w.current=setTimeout(()=>{D(null),w.current=null},200)},[]),P=_react.useCallback.call(void 0, u=>{let oe=a==="baseChainSelection"?"base":"quote";_chunkPD3AGQJPcjs.c.getState().setChainFilter({chainId:u,side:oe}),_chunkPD3AGQJPcjs.c.getState().pushRecentChain(u),h(oe==="base"?"baseSelection":"quoteSelection","chainSelection")},[a,h]),j=_react.useCallback.call(void 0, ()=>{let u=_chunkPD3AGQJPcjs.c.getState().view;u==="baseSelection"?h("baseChainSelection","chainSelection"):u==="quoteSelection"&&h("quoteChainSelection","chainSelection")},[h]),B=_react.useCallback.call(void 0, ()=>{C(),I()},[C,I]),y=r&&s?r.chainId===s.chainId:!0,Q=()=>{switch(a){case"wallet":return"Wallet";case"baseSelection":return"Select Input Token";case"quoteSelection":return"Select Output Token";case"baseChainSelection":case"quoteChainSelection":return"Select Chain";default:return"Swap"}},{assetMenuVariant:x,widgetType:U,customWalletUI:we}=_chunkJCH7AXABcjs.b.call(void 0, ),z=a==="baseSelection"||a==="quoteSelection",E=a==="baseChainSelection"||a==="quoteChainSelection",ee=x==="split"&&(U==="default"||U==="compact"),q=x==="split"&&(U==="horizontal"||U==="split"),_=x==="default",O=a==="swap"||z||E||a==="wallet"||a==="activity",te=b==="baseSelection"||b==="quoteSelection",J=b==="baseChainSelection"||b==="quoteChainSelection",ie=z||te,$=E||J,ce=z&&!A,L=E&&!A,ue=z?a:b,xe=ue==="baseSelection"?"base":"quote",T=ue==="baseSelection"?s:r,ke=(E?a:b)==="baseChainSelection"?"base":"quote",re=u=>({backgroundColor:"var(--widget-background)",opacity:u?1:0,transform:u?"translateY(0)":"translateY(6px)",transition:"opacity 200ms ease-in-out, transform 200ms ease-in-out"}),fe=_&&(z||E||a==="wallet"||a==="activity"||b!=null),ge=p?_jsxruntime.jsx.call(void 0, lt,{}):U==="horizontal"?_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, Kt,{onSwapComplete:e,onSwapInitiated:B,onBackToSwap:q?m:void 0,onMoreChainsClick:q?j:void 0})}):U==="split"?_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, Yt,{onSwapComplete:e,onSwapInitiated:B,onBackToSwap:q?m:void 0,onMoreChainsClick:q?j:void 0})}):_jsxruntime.jsx.call(void 0, dt,{onSwapComplete:e,onSwapInitiated:B}),Se=_nullishCoalesce(t, () => ({})),Ce=_react.useRef.call(void 0, null),[ze,Te]=_react.useState.call(void 0, 420);return _react.useEffect.call(void 0, ()=>{if(!ee)return;let u=Ce.current;if(!u)return;let ae=new ResizeObserver(oe=>{for(let We of oe)Te(We.contentRect.height)});return ae.observe(u),()=>ae.disconnect()},[ee]),ee?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{ref:Ce,className:"flex flex-col w-full overflow-hidden transition-colors duration-300",style:{flex:"1 1 0",minWidth:0,...Se},children:[_jsxruntime.jsx.call(void 0, qe,{headerText:"Swap",onBackClick:m,isSameChain:y,isWrappingPair:N,isUnwrappingPair:W,hasLowLiquidity:R,hasInsufficientLiquidity:R,hasRoutingError:H,hasSizeCapError:S}),_jsxruntime.jsx.call(void 0, "div",{className:"overflow-hidden",children:ge})]}),(ie||$)&&_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col overflow-hidden shrink-0",style:{width:g,height:`${ze}px`,...Se,...re((z||E)&&!A)},children:z||te?_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, pt,{toggle:m,side:xe,otherAsset:T,onMoreChainsClick:j,selectedChainFilter:o})}):_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, wt,{toggle:m,side:ke,onChainSelect:P})})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",style:{overflow:"hidden",position:"relative"},children:[_jsxruntime.jsx.call(void 0, qe,{headerText:Q(),onBackClick:m,isSameChain:y,isWrappingPair:N,isUnwrappingPair:W,hasLowLiquidity:R,hasInsufficientLiquidity:R,hasRoutingError:H,hasSizeCapError:S}),_jsxruntime.jsxs.call(void 0, "div",{className:"relative overflow-hidden",children:[O&&_jsxruntime.jsx.call(void 0, "div",{className:"overflow-hidden",style:fe?{pointerEvents:"none"}:void 0,children:ge}),(a==="wallet"||b==="wallet")&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute inset-0 overflow-hidden z-20",style:re(a==="wallet"&&!A),children:_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:we==="none"?_jsxruntime.jsx.call(void 0, Jt,{}):_jsxruntime.jsx.call(void 0, Gt,{})})}),(a==="activity"||b==="activity")&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute inset-0 overflow-y-auto z-20",style:re(a==="activity"&&!A),children:_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, Zt,{isActive:a==="activity"})})}),_&&ie&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute inset-0 overflow-hidden z-20",style:re(ce),children:_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, pt,{toggle:m,side:xe,otherAsset:T,onMoreChainsClick:j,selectedChainFilter:o})})}),_&&$&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute inset-0 overflow-hidden z-20",style:re(L),children:_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, wt,{toggle:m,side:ke,onChainSelect:P})})})]})]})},ut=({onSwapComplete:e,defaultBaseToken:t,defaultQuoteToken:g,onBaseTokenChange:r,onQuoteTokenChange:s,cardStyles:v,cardWidth:k})=>{let{address:N}=_chunk34N36GUDcjs.a.call(void 0, ),W=_chunkPD3AGQJPcjs.c.call(void 0, p=>p.recipient);return _jsxruntime.jsx.call(void 0, _chunkPD3AGQJPcjs.e,{defaultBaseToken:t,defaultQuoteToken:g,onBaseTokenChange:r,onQuoteTokenChange:s,children:_jsxruntime.jsx.call(void 0, _chunkVGYWFUHRcjs.d,{recipient:W,children:_jsxruntime.jsx.call(void 0, Xt,{onSwapComplete:e,cardStyles:v,cardWidth:k})})})};var Le={background:"#ffffff",foreground:"#0a0a0a",card:"#ffffff","card-foreground":"#0a0a0a",popover:"#ffffff","popover-foreground":"#0a0a0a",primary:"#171717","primary-foreground":"#fafafa",secondary:"#f5f5f5","secondary-foreground":"#171717",muted:"#f5f5f5","muted-foreground":"#737373",accent:"#f5f5f5","accent-foreground":"#171717",destructive:"#e7000b","destructive-foreground":"#ffffff",border:"#e5e5e5",input:"#e5e5e5",ring:"#a1a1a1",radius:"0.625rem","border-style":"dotted","status-pending":"#a1a1aa","status-received":"#f59e0b","status-completed":"#10b981","status-failed":"#ef4444"},ye= exports.defaultDarkTheme ={background:"#0a0a0a",foreground:"#fafafa",card:"#171717","card-foreground":"#fafafa",popover:"#262626","popover-foreground":"#fafafa",primary:"#e5e5e5","primary-foreground":"#171717",secondary:"#262626","secondary-foreground":"#fafafa",muted:"#262626","muted-foreground":"#a1a1a1",accent:"#404040","accent-foreground":"#fafafa",destructive:"#ff6467","destructive-foreground":"#fafafa",border:"#282828",input:"#343434",ring:"#737373",radius:"0.625rem","border-style":"dotted","status-pending":"#a1a1aa","status-received":"#fbbf24","status-completed":"#2dd4bf","status-failed":"#fb7185"};function Ve(e){let t={"--widget-background":e.background,"--widget-foreground":e.foreground,"--widget-card":e.card,"--widget-card-foreground":e["card-foreground"],"--widget-popover":e.popover,"--widget-popover-foreground":e["popover-foreground"],"--widget-primary":e.primary,"--widget-primary-foreground":e["primary-foreground"],"--widget-secondary":e.secondary,"--widget-secondary-foreground":e["secondary-foreground"],"--widget-muted":e.muted,"--widget-muted-foreground":e["muted-foreground"],"--widget-accent":e.accent,"--widget-accent-foreground":e["accent-foreground"],"--widget-destructive":e.destructive,"--widget-destructive-foreground":e["destructive-foreground"],"--widget-border":e.border,"--widget-input":e.input,"--widget-ring":e.ring,"--widget-radius":e.radius,"--widget-border-style":e["border-style"]||"dotted"};return t["--widget-font-sans"]=e["font-sans"]||"inherit",t["--widget-font-mono"]=e["font-mono"]||"inherit",t["--widget-shadow-color"]=e["shadow-color"]||"oklch(0 0 0)",t["--widget-shadow-opacity"]=e["shadow-opacity"]||"0.1",t["--widget-shadow-blur"]=e["shadow-blur"]||"3px",t["--widget-shadow-spread"]=e["shadow-spread"]||"0px",t["--widget-shadow-offset-x"]=e["shadow-offset-x"]||"0",t["--widget-shadow-offset-y"]=e["shadow-offset-y"]||"1px",t["--widget-letter-spacing"]=e["letter-spacing"]||"normal",t["--widget-status-pending"]=e["status-pending"]||"#a1a1aa",t["--widget-status-received"]=e["status-received"]||"#fbbf24",t["--widget-status-completed"]=e["status-completed"]||"#2dd4bf",t["--widget-status-failed"]=e["status-failed"]||"#fb7185",t}var ft=_react.createContext.call(void 0, ye);function He({theme:e,children:t}){return _jsxruntime.jsx.call(void 0, ft.Provider,{value:e,children:t})}function ri(){return _react.useContext.call(void 0, ft)}var ni=[],si=[],di=[],vt=[],li=`
|
|
3
3
|
.aori-widget .text-2xs { font-size: 0.75rem; }
|
|
4
4
|
.aori-widget .text-3xs { font-size: 0.68rem; }
|
|
5
5
|
.aori-widget ::-webkit-scrollbar { width: 0px; height: 0px; display: none; }
|
|
@@ -7,4 +7,4 @@ var _chunkXLIAXB6Gcjs = require('./chunk-XLIAXB6G.cjs');var _chunk7MGPLHPIcjs =
|
|
|
7
7
|
.aori-widget input:focus, .aori-widget input:focus-visible,
|
|
8
8
|
.aori-widget button:focus, .aori-widget button:focus-visible,
|
|
9
9
|
.aori-widget select:focus, .aori-widget select:focus-visible { outline: none; }
|
|
10
|
-
`,Ve= (_class =class extends _react2.default.Component{constructor(...args) { super(...args); _class.prototype.__init.call(this); }__init() {this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?_jsxruntime.jsxs.call(void 0, "div",{style:{padding:"1.5rem",textAlign:"center",color:"var(--widget-foreground, #888)",fontFamily:"system-ui, sans-serif"},children:[_jsxruntime.jsx.call(void 0, "p",{style:{margin:"0 0 0.75rem",fontSize:"0.875rem"},children:"Something went wrong."}),_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>this.setState({hasError:!1}),style:{padding:"0.375rem 1rem",fontSize:"0.8125rem",cursor:"pointer",border:"1px solid currentColor",borderRadius:"0.25rem",background:"transparent",color:"inherit"},children:"Retry"})]}):this.props.children}}, _class);function oi(e){let i=e.theme.mode==="light"?Ee:ve,g=e.theme.mode==="light"?e.theme.light:e.theme.dark;return g?{...i,...g}:i}function ni({config:e,className:i,onSwapComplete:g,onBaseTokenChange:a,onQuoteTokenChange:s,onRequestConnect:h,onRequestAccount:k,customWalletUI:W="builtin"}){_chunk6CVCMRALcjs.l.call(void 0, e.apiKey),_chunk6CVCMRALcjs.n.call(void 0, e.rpcOverrides),_chunk6CVCMRALcjs.j.call(void 0, e.vtApiBaseUrl);let R=oi(e),w=_nullishCoalesce(_optionalChain([e, 'access', _6 => _6.appearance, 'optionalAccess', _7 => _7.widgetType]), () => ("default")),S=_nullishCoalesce(_optionalChain([e, 'access', _8 => _8.appearance, 'optionalAccess', _9 => _9.tokenDisplay]), () => ("default")),C=_nullishCoalesce(_optionalChain([e, 'access', _10 => _10.appearance, 'optionalAccess', _11 => _11.tokenBadgeOrientation]), () => ("left")),O=_nullishCoalesce(_optionalChain([e, 'access', _12 => _12.appearance, 'optionalAccess', _13 => _13.assetMenuVariant]), () => ("default")),z=_nullishCoalesce(_optionalChain([e, 'access', _14 => _14.appearance, 'optionalAccess', _15 => _15.amountInputVariant]), () => ("default")),r=_nullishCoalesce(_optionalChain([e, 'access', _16 => _16.appearance, 'optionalAccess', _17 => _17.hideAmountInputSymbol]), () => (!1)),t=_nullishCoalesce(_optionalChain([e, 'access', _18 => _18.appearance, 'optionalAccess', _19 => _19.swapButtonVariant]), () => ("default")),d=_nullishCoalesce(_optionalChain([e, 'access', _20 => _20.appearance, 'optionalAccess', _21 => _21.swapHeaderVariant]), () => ("default")),T=_nullishCoalesce(_optionalChain([e, 'access', _22 => _22.appearance, 'optionalAccess', _23 => _23.quoteLoaderVariant]), () => ("default")),ee=_nullishCoalesce(_optionalChain([e, 'access', _24 => _24.appearance, 'optionalAccess', _25 => _25.walletButtonEnabled]), () => (!0)),K=_nullishCoalesce(_optionalChain([e, 'access', _26 => _26.appearance, 'optionalAccess', _27 => _27.fillContainer]), () => (!1)),u=_nullishCoalesce(_optionalChain([e, 'access', _28 => _28.appearance, 'optionalAccess', _29 => _29.hideBorder]), () => (!1)),p=Fe(R),f=O==="split"&&(w==="default"||w==="compact"),Y=_chunkX7THKL37cjs.c.call(void 0, J=>J.view==="baseSelection"||J.view==="quoteSelection"||J.view==="baseChainSelection"||J.view==="quoteChainSelection"),N=w==="compact"?"22rem":"24rem",V=f?{maxWidth:Y?w==="compact"?"46rem":"49rem":N,transition:"max-width 0.3s ease",height:"auto",overflow:"visible",display:"flex",gap:"1rem",alignItems:"stretch",backgroundColor:"transparent",border:"none",borderRadius:0,boxShadow:"none",padding:0}:{width:"100%",...K?{}:{maxWidth:w==="split"||w==="horizontal"?"48rem":w==="compact"?"22rem":"24rem"},height:"auto",overflow:"hidden"},M={boxSizing:"border-box",backgroundColor:"var(--widget-background)",color:"var(--widget-foreground)",borderRadius:"var(--widget-radius)",...u?{border:"none"}:{borderWidth:"1px",borderStyle:"var(--widget-border-style)",borderColor:"var(--widget-border)"},boxShadow:"var(--widget-shadow-offset-x) var(--widget-shadow-offset-y) var(--widget-shadow-blur) var(--widget-shadow-spread) color-mix(in srgb, var(--widget-shadow-color) calc(var(--widget-shadow-opacity) * 100%), transparent)",padding:"0.25rem 0.5rem",paddingTop:"0.25rem"},L=_nullishCoalesce(_optionalChain([e, 'access', _30 => _30.tokens, 'optionalAccess', _31 => _31.enabledChains]), () => (ti)),G=_nullishCoalesce(_optionalChain([e, 'access', _32 => _32.tokens, 'optionalAccess', _33 => _33.supportedInputTokens]), () => (ii)),q=_nullishCoalesce(_optionalChain([e, 'access', _34 => _34.tokens, 'optionalAccess', _35 => _35.supportedOutputTokens]), () => (ri)),y=_nullishCoalesce(_optionalChain([e, 'access', _36 => _36.tokens, 'optionalAccess', _37 => _37.supportedInputChains]), () => (pt)),E=_nullishCoalesce(_optionalChain([e, 'access', _38 => _38.tokens, 'optionalAccess', _39 => _39.supportedOutputChains]), () => (pt)),U=_nullishCoalesce(_optionalChain([e, 'access', _40 => _40.tokens, 'optionalAccess', _41 => _41.inputSelectionSearch]), () => (!0)),A=_nullishCoalesce(_optionalChain([e, 'access', _42 => _42.tokens, 'optionalAccess', _43 => _43.outputSelectionSearch]), () => (!0)),x=_nullishCoalesce(_optionalChain([e, 'access', _44 => _44.tokens, 'optionalAccess', _45 => _45.showInputSelectionTokenBalances]), () => (!0)),Z=_nullishCoalesce(_optionalChain([e, 'access', _46 => _46.tokens, 'optionalAccess', _47 => _47.showOutputSelectionTokenBalances]), () => (!0)),B=_nullishCoalesce(_optionalChain([e, 'access', _48 => _48.tokens, 'optionalAccess', _49 => _49.lockBase]), () => (!1)),$=_nullishCoalesce(_optionalChain([e, 'access', _50 => _50.tokens, 'optionalAccess', _51 => _51.lockQuote]), () => (!1)),j=_nullishCoalesce(_optionalChain([e, 'access', _52 => _52.tokens, 'optionalAccess', _53 => _53.disableInverting]), () => (!1)),te=_nullishCoalesce(_optionalChain([e, 'access', _54 => _54.settings, 'optionalAccess', _55 => _55.defaultSlippage]), () => (.01)),D=!!h,ie=_react.useMemo.call(void 0, ()=>({apiKey:e.apiKey,web3ConnectionType:"custom",enabledChains:L,supportedInputTokens:G,supportedOutputTokens:q,supportedInputChains:y,supportedOutputChains:E,inputSelectionSearch:U,outputSelectionSearch:A,showInputSelectionTokenBalances:x,showOutputSelectionTokenBalances:Z,lockBase:B,lockQuote:$,disableInverting:j,defaultSlippage:te,widgetType:w,tokenDisplay:S,tokenBadgeOrientation:C,assetMenuVariant:O,amountInputVariant:z,hideAmountInputSymbol:r,swapButtonVariant:t,swapHeaderVariant:d,quoteLoaderVariant:T,walletButtonEnabled:ee,hasConnectHandler:D,customWalletUI:W}),[e.apiKey,L,G,q,y,E,U,A,x,Z,B,$,j,te,w,S,C,O,z,r,t,d,T,ee,D,W]),re=_react.useMemo.call(void 0, ()=>h?{openConnectModal:h,openAccountModal:k}:null,[h,k]),b=_jsxruntime.jsx.call(void 0, _chunk6CVCMRALcjs.L,{children:_jsxruntime.jsx.call(void 0, _chunk6KEQ2NDQcjs.a.Provider,{value:ie,children:_jsxruntime.jsx.call(void 0, He,{theme:R,children:_jsxruntime.jsxs.call(void 0, "div",{className:`aori-widget${i?` ${i}`:""}`,style:{...p,"--font-sans":"var(--widget-font-sans)","--font-mono":"var(--widget-font-mono)",fontFamily:"var(--widget-font-sans)",letterSpacing:"var(--widget-letter-spacing)",width:"100%",...V,position:"relative",...f?{}:M},children:[_jsxruntime.jsx.call(void 0, "style",{dangerouslySetInnerHTML:{__html:ai}}),_jsxruntime.jsx.call(void 0, Ve,{children:_jsxruntime.jsx.call(void 0, lt,{onSwapComplete:g,defaultBaseToken:_optionalChain([e, 'access', _56 => _56.tokens, 'optionalAccess', _57 => _57.defaultBase]),defaultQuoteToken:_optionalChain([e, 'access', _58 => _58.tokens, 'optionalAccess', _59 => _59.defaultQuote]),onBaseTokenChange:a,onQuoteTokenChange:s,cardStyles:f?M:void 0,cardWidth:f?N:void 0})})]})})})});return re?_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.f.Provider,{value:re,children:b}):b}function si(){let{openConnectModal:e}=_chunk7MGPLHPIcjs.g.call(void 0, ),{isConnected:i,address:g}=_chunk34N36GUDcjs.a.call(void 0, ),a=i&&g?`${g.slice(0,6)}...${g.slice(-4)}`:"Connect";return _jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>e(),className:"h-8 cursor-pointer px-3 text-xs font-bold uppercase tracking-wide transition-colors duration-150 border border-border rounded-sm bg-card text-foreground hover:bg-secondary hover:border-foreground/20",children:a})}var _wagmi = require('wagmi');function ci(e){let i=Object.entries(_chunk6CVCMRALcjs.b);return Object.fromEntries(i.map(([g,a])=>{let s=_optionalChain([e, 'optionalAccess', _60 => _60[Number(g)]]),h=s?Array.isArray(s)?s:[s]:[],k=h.length>0?[...h,...a.rpcUrls]:a.rpcUrls;return[g,k.length>1?_wagmi.fallback.call(void 0, k.map(W=>_wagmi.http.call(void 0, W,{batch:{batchSize:50,wait:50}}))):_wagmi.http.call(void 0, k[0],{batch:{batchSize:50,wait:50}})]}))}var gi=_chunk6CVCMRALcjs.d.call(void 0, ).map(e=>e.wagmiChain);var pi=e=>{let{tokenRegistry:i,isLoadingRegistry:g,error:a}=_chunk6CVCMRALcjs.D.call(void 0, );return{tokens:_react.useMemo.call(void 0, ()=>i.filter(h=>h.chainId===e),[i,e]),isLoading:g,error:a}},wi= exports.useIsTokenSupported =(e,i)=>{let{tokenRegistry:g}=_chunk6CVCMRALcjs.D.call(void 0, );return _react.useMemo.call(void 0, ()=>!e||!g.length?!1:g.some(a=>a.address.toLowerCase()===e.toLowerCase()&&a.chainId===i),[g,e,i])},ui= exports.useTokenByAddress =(e,i)=>{let{getToken:g}=_chunk6CVCMRALcjs.D.call(void 0, );return _react.useMemo.call(void 0, ()=>{if(!(!e||!i))return g(i,e)},[g,e,i])},Nr=_chunk6CVCMRALcjs.g.call(void 0, );exports.ChainSwitch = _chunk7MGPLHPIcjs.n; exports.ConnectButton = si; exports.RfqProvider = _chunk7MGPLHPIcjs.d; exports.SignSwap = _chunk7MGPLHPIcjs.o; exports.SwapFormProvider = _chunkX7THKL37cjs.e; exports.SwapWidget = ni; exports.WidgetThemeProvider = He; exports.buildTransports = ci; exports.canSubmitOrder = _chunk7MGPLHPIcjs.q; exports.cleanupOldSubmissions = _chunk7MGPLHPIcjs.s; exports.defaultDarkTheme = ve; exports.defaultLightTheme = Ee; exports.isQuoteFresh = _chunk7MGPLHPIcjs.p; exports.markOrderAsSubmitted = _chunk7MGPLHPIcjs.r; exports.pollOrderStatus = _chunk7MGPLHPIcjs.k; exports.themeToCSS = Fe; exports.useBalanceEventListener = _chunk7MGPLHPIcjs.a; exports.useBalanceEventSubscription = _chunk7MGPLHPIcjs.c; exports.useEmitBalanceEvent = _chunk7MGPLHPIcjs.b; exports.useIsTokenSupported = wi; exports.useOrderStatusPolling = _chunk7MGPLHPIcjs.l; exports.useRfq = _chunk7MGPLHPIcjs.e; exports.useSwapForm = _chunkX7THKL37cjs.d; exports.useSwapFormContext = _chunkX7THKL37cjs.f; exports.useTokenByAddress = ui; exports.useTokenSelection = _chunkX7THKL37cjs.b; exports.useTokenSelectionStore = _chunkX7THKL37cjs.a; exports.useTokensForChain = pi; exports.useTransactionRegistry = _chunk7MGPLHPIcjs.m; exports.useUnwrapToken = _chunk7MGPLHPIcjs.t; exports.useWalletModal = _chunk7MGPLHPIcjs.g; exports.useWalletState = _chunk34N36GUDcjs.a; exports.useWidgetSwapUIStore = _chunkX7THKL37cjs.c; exports.useWidgetTheme = Jt; exports.useWrapToken = _chunk7MGPLHPIcjs.u; exports.wagmiChains = gi;
|
|
10
|
+
`,je= (_class =class extends _react2.default.Component{constructor(...args) { super(...args); _class.prototype.__init.call(this); }__init() {this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?_jsxruntime.jsxs.call(void 0, "div",{style:{padding:"1.5rem",textAlign:"center",color:"var(--widget-foreground, #888)",fontFamily:"system-ui, sans-serif"},children:[_jsxruntime.jsx.call(void 0, "p",{style:{margin:"0 0 0.75rem",fontSize:"0.875rem"},children:"Something went wrong."}),_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>this.setState({hasError:!1}),style:{padding:"0.375rem 1rem",fontSize:"0.8125rem",cursor:"pointer",border:"1px solid currentColor",borderRadius:"0.25rem",background:"transparent",color:"inherit"},children:"Retry"})]}):this.props.children}}, _class);function ci(e){let t=e.theme.mode==="light"?Le:ye,g=e.theme.mode==="light"?e.theme.light:e.theme.dark;return g?{...t,...g}:t}function gi({config:e,className:t,onSwapComplete:g,onBaseTokenChange:r,onQuoteTokenChange:s,onRequestConnect:v,onRequestAccount:k,customWalletUI:N="builtin"}){_chunkTZYKUGNPcjs.l.call(void 0, e.apiKey),_chunkTZYKUGNPcjs.n.call(void 0, e.rpcOverrides),_chunkTZYKUGNPcjs.j.call(void 0, e.vtApiBaseUrl);let W=ci(e),p=_nullishCoalesce(_optionalChain([e, 'access', _10 => _10.appearance, 'optionalAccess', _11 => _11.widgetType]), () => ("default")),R=_nullishCoalesce(_optionalChain([e, 'access', _12 => _12.appearance, 'optionalAccess', _13 => _13.tokenDisplay]), () => ("default")),H=_nullishCoalesce(_optionalChain([e, 'access', _14 => _14.appearance, 'optionalAccess', _15 => _15.tokenBadgeOrientation]), () => ("left")),S=_nullishCoalesce(_optionalChain([e, 'access', _16 => _16.appearance, 'optionalAccess', _17 => _17.assetMenuVariant]), () => ("default")),C=_nullishCoalesce(_optionalChain([e, 'access', _18 => _18.appearance, 'optionalAccess', _19 => _19.amountInputVariant]), () => ("default")),I=_nullishCoalesce(_optionalChain([e, 'access', _20 => _20.appearance, 'optionalAccess', _21 => _21.hideAmountInputSymbol]), () => (!1)),a=_nullishCoalesce(_optionalChain([e, 'access', _22 => _22.appearance, 'optionalAccess', _23 => _23.swapButtonVariant]), () => ("default")),A=_nullishCoalesce(_optionalChain([e, 'access', _24 => _24.appearance, 'optionalAccess', _25 => _25.swapHeaderVariant]), () => ("default")),X=_nullishCoalesce(_optionalChain([e, 'access', _26 => _26.appearance, 'optionalAccess', _27 => _27.quoteLoaderVariant]), () => ("default")),d=_nullishCoalesce(_optionalChain([e, 'access', _28 => _28.appearance, 'optionalAccess', _29 => _29.walletButtonEnabled]), () => (!0)),o=_nullishCoalesce(_optionalChain([e, 'access', _30 => _30.appearance, 'optionalAccess', _31 => _31.fillContainer]), () => (!1)),n=_nullishCoalesce(_optionalChain([e, 'access', _32 => _32.appearance, 'optionalAccess', _33 => _33.hideBorder]), () => (!1)),w=Ve(W),b=S==="split"&&(p==="default"||p==="compact"),D=_chunkPD3AGQJPcjs.c.call(void 0, L=>L.view==="baseSelection"||L.view==="quoteSelection"||L.view==="baseChainSelection"||L.view==="quoteChainSelection"),h=p==="compact"?"22rem":"24rem",P=b?{maxWidth:D?p==="compact"?"46rem":"49rem":h,transition:"max-width 0.3s ease",height:"auto",overflow:"visible",display:"flex",gap:"1rem",alignItems:"stretch",backgroundColor:"transparent",border:"none",borderRadius:0,boxShadow:"none",padding:0}:{width:"100%",...o?{}:{maxWidth:p==="split"||p==="horizontal"?"48rem":p==="compact"?"22rem":"24rem"},height:"auto",overflow:"hidden"},j={boxSizing:"border-box",backgroundColor:"var(--widget-background)",color:"var(--widget-foreground)",borderRadius:"var(--widget-radius)",...n?{border:"none"}:{borderWidth:"1px",borderStyle:"var(--widget-border-style)",borderColor:"var(--widget-border)"},boxShadow:"var(--widget-shadow-offset-x) var(--widget-shadow-offset-y) var(--widget-shadow-blur) var(--widget-shadow-spread) color-mix(in srgb, var(--widget-shadow-color) calc(var(--widget-shadow-opacity) * 100%), transparent)",padding:"0.25rem 0.5rem",paddingTop:"0.25rem"},B=_nullishCoalesce(_optionalChain([e, 'access', _34 => _34.tokens, 'optionalAccess', _35 => _35.enabledChains]), () => (ni)),y=_nullishCoalesce(_optionalChain([e, 'access', _36 => _36.tokens, 'optionalAccess', _37 => _37.supportedInputTokens]), () => (si)),Q=_nullishCoalesce(_optionalChain([e, 'access', _38 => _38.tokens, 'optionalAccess', _39 => _39.supportedOutputTokens]), () => (di)),x=_nullishCoalesce(_optionalChain([e, 'access', _40 => _40.tokens, 'optionalAccess', _41 => _41.supportedInputChains]), () => (vt)),U=_nullishCoalesce(_optionalChain([e, 'access', _42 => _42.tokens, 'optionalAccess', _43 => _43.supportedOutputChains]), () => (vt)),we=_nullishCoalesce(_optionalChain([e, 'access', _44 => _44.tokens, 'optionalAccess', _45 => _45.inputSelectionSearch]), () => (!0)),z=_nullishCoalesce(_optionalChain([e, 'access', _46 => _46.tokens, 'optionalAccess', _47 => _47.outputSelectionSearch]), () => (!0)),E=_nullishCoalesce(_optionalChain([e, 'access', _48 => _48.tokens, 'optionalAccess', _49 => _49.showInputSelectionTokenBalances]), () => (!0)),ee=_nullishCoalesce(_optionalChain([e, 'access', _50 => _50.tokens, 'optionalAccess', _51 => _51.showOutputSelectionTokenBalances]), () => (!0)),q=_nullishCoalesce(_optionalChain([e, 'access', _52 => _52.tokens, 'optionalAccess', _53 => _53.lockBase]), () => (!1)),_=_nullishCoalesce(_optionalChain([e, 'access', _54 => _54.tokens, 'optionalAccess', _55 => _55.lockQuote]), () => (!1)),O=_nullishCoalesce(_optionalChain([e, 'access', _56 => _56.tokens, 'optionalAccess', _57 => _57.disableInverting]), () => (!1)),te=_nullishCoalesce(_optionalChain([e, 'access', _58 => _58.settings, 'optionalAccess', _59 => _59.defaultSlippage]), () => (.01)),J=!!v,ie=_react.useMemo.call(void 0, ()=>({apiKey:e.apiKey,web3ConnectionType:"custom",enabledChains:B,supportedInputTokens:y,supportedOutputTokens:Q,supportedInputChains:x,supportedOutputChains:U,inputSelectionSearch:we,outputSelectionSearch:z,showInputSelectionTokenBalances:E,showOutputSelectionTokenBalances:ee,lockBase:q,lockQuote:_,disableInverting:O,defaultSlippage:te,widgetType:p,tokenDisplay:R,tokenBadgeOrientation:H,assetMenuVariant:S,amountInputVariant:C,hideAmountInputSymbol:I,swapButtonVariant:a,swapHeaderVariant:A,quoteLoaderVariant:X,walletButtonEnabled:d,hasConnectHandler:J,customWalletUI:N}),[e.apiKey,B,y,Q,x,U,we,z,E,ee,q,_,O,te,p,R,H,S,C,I,a,A,X,d,J,N]),$=_react.useMemo.call(void 0, ()=>v?{openConnectModal:v,openAccountModal:k}:null,[v,k]),ce=_jsxruntime.jsx.call(void 0, _chunkTZYKUGNPcjs.L,{children:_jsxruntime.jsx.call(void 0, _chunkJCH7AXABcjs.a.Provider,{value:ie,children:_jsxruntime.jsx.call(void 0, He,{theme:W,children:_jsxruntime.jsxs.call(void 0, "div",{className:`aori-widget${t?` ${t}`:""}`,style:{...w,"--font-sans":"var(--widget-font-sans)","--font-mono":"var(--widget-font-mono)",fontFamily:"var(--widget-font-sans)",letterSpacing:"var(--widget-letter-spacing)",width:"100%",...P,position:"relative",...b?{}:j},children:[_jsxruntime.jsx.call(void 0, "style",{dangerouslySetInnerHTML:{__html:li}}),_jsxruntime.jsx.call(void 0, je,{children:_jsxruntime.jsx.call(void 0, ut,{onSwapComplete:g,defaultBaseToken:_optionalChain([e, 'access', _60 => _60.tokens, 'optionalAccess', _61 => _61.defaultBase]),defaultQuoteToken:_optionalChain([e, 'access', _62 => _62.tokens, 'optionalAccess', _63 => _63.defaultQuote]),onBaseTokenChange:r,onQuoteTokenChange:s,cardStyles:b?j:void 0,cardWidth:b?h:void 0})})]})})})});return $?_jsxruntime.jsx.call(void 0, _chunkVGYWFUHRcjs.f.Provider,{value:$,children:ce}):ce}function pi(){let{openConnectModal:e}=_chunkVGYWFUHRcjs.g.call(void 0, ),{isConnected:t,address:g}=_chunk34N36GUDcjs.a.call(void 0, ),r=t&&g?`${g.slice(0,6)}...${g.slice(-4)}`:"Connect";return _jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>e(),className:"h-8 cursor-pointer px-3 text-xs font-bold uppercase tracking-wide transition-colors duration-150 border border-border rounded-sm bg-card text-foreground hover:bg-secondary hover:border-foreground/20",children:r})}var _wagmi = require('wagmi');function fi(e){let t=Object.entries(_chunkTZYKUGNPcjs.b);return Object.fromEntries(t.map(([g,r])=>{let s=_optionalChain([e, 'optionalAccess', _64 => _64[Number(g)]]),v=s?Array.isArray(s)?s:[s]:[],k=v.length>0?[...v,...r.rpcUrls]:r.rpcUrls;return[g,k.length>1?_wagmi.fallback.call(void 0, k.map(N=>_wagmi.http.call(void 0, N,{batch:{batchSize:50,wait:50}}))):_wagmi.http.call(void 0, k[0],{batch:{batchSize:50,wait:50}})]}))}var mi=_chunkTZYKUGNPcjs.d.call(void 0, ).map(e=>e.wagmiChain);var vi=e=>{let{tokenRegistry:t,isLoadingRegistry:g,error:r}=_chunkTZYKUGNPcjs.B.call(void 0, );return{tokens:_react.useMemo.call(void 0, ()=>t.filter(v=>v.chainId===e),[t,e]),isLoading:g,error:r}},hi= exports.useIsTokenSupported =(e,t)=>{let{tokenRegistry:g}=_chunkTZYKUGNPcjs.B.call(void 0, );return _react.useMemo.call(void 0, ()=>!e||!g.length?!1:g.some(r=>r.address.toLowerCase()===e.toLowerCase()&&r.chainId===t),[g,e,t])},bi= exports.useTokenByAddress =(e,t)=>{let{getToken:g}=_chunkTZYKUGNPcjs.B.call(void 0, );return _react.useMemo.call(void 0, ()=>{if(!(!e||!t))return g(t,e)},[g,e,t])},Br=_chunkTZYKUGNPcjs.g.call(void 0, );exports.ChainSwitch = _chunkVGYWFUHRcjs.o; exports.ConnectButton = pi; exports.RfqProvider = _chunkVGYWFUHRcjs.d; exports.SignSwap = _chunkVGYWFUHRcjs.p; exports.SwapFormProvider = _chunkPD3AGQJPcjs.e; exports.SwapWidget = gi; exports.WidgetThemeProvider = He; exports.buildTransports = fi; exports.canSubmitOrder = _chunkVGYWFUHRcjs.r; exports.cleanupOldSubmissions = _chunkVGYWFUHRcjs.t; exports.defaultDarkTheme = ye; exports.defaultLightTheme = Le; exports.isQuoteFresh = _chunkVGYWFUHRcjs.q; exports.markOrderAsSubmitted = _chunkVGYWFUHRcjs.s; exports.pollOrderStatus = _chunkVGYWFUHRcjs.l; exports.themeToCSS = Ve; exports.useBalanceEventListener = _chunkVGYWFUHRcjs.a; exports.useBalanceEventSubscription = _chunkVGYWFUHRcjs.c; exports.useEmitBalanceEvent = _chunkVGYWFUHRcjs.b; exports.useIsTokenSupported = hi; exports.useOrderStatusPolling = _chunkVGYWFUHRcjs.m; exports.useRfq = _chunkVGYWFUHRcjs.e; exports.useSwapForm = _chunkPD3AGQJPcjs.d; exports.useSwapFormContext = _chunkPD3AGQJPcjs.f; exports.useTokenByAddress = bi; exports.useTokenSelection = _chunkPD3AGQJPcjs.b; exports.useTokenSelectionStore = _chunkPD3AGQJPcjs.a; exports.useTokensForChain = vi; exports.useTransactionRegistry = _chunkVGYWFUHRcjs.n; exports.useUnwrapToken = _chunkVGYWFUHRcjs.u; exports.useWalletModal = _chunkVGYWFUHRcjs.g; exports.useWalletState = _chunk34N36GUDcjs.a; exports.useWidgetSwapUIStore = _chunkPD3AGQJPcjs.c; exports.useWidgetTheme = ri; exports.useWrapToken = _chunkVGYWFUHRcjs.v; exports.wagmiChains = mi;
|