@aori/mega-swap-widget 0.1.13 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/AssetSelectionMenu-6CVRQVYF.cjs +2 -0
  2. package/dist/AssetSelectionMenu-L4HLQ6EE.js +2 -0
  3. package/dist/ChainSelectionMenu-OEUXOW4U.cjs +2 -0
  4. package/dist/ChainSelectionMenu-ZBCBZLUJ.js +2 -0
  5. package/dist/SwapFormHorizontal-PKQLLSWV.cjs +2 -0
  6. package/dist/SwapFormHorizontal-TN7TRDH6.js +2 -0
  7. package/dist/SwapFormSplit-P3SM3A7K.cjs +2 -0
  8. package/dist/SwapFormSplit-ULDMGQV4.js +2 -0
  9. package/dist/{WidgetWalletPanel-7L7E7IA5.js → WidgetWalletPanel-5PATFPG7.js} +1 -1
  10. package/dist/{WidgetWalletPanel-B3VZ6AIJ.cjs → WidgetWalletPanel-YDJROJ5X.cjs} +1 -1
  11. package/dist/WidgetWalletTradeHistory-OMFNUGLQ.cjs +2 -0
  12. package/dist/WidgetWalletTradeHistory-TVZXVRI4.js +2 -0
  13. package/dist/{chunk-GIDTBDDC.cjs → chunk-4DL25Q57.cjs} +1 -1
  14. package/dist/{chunk-W63DXT5E.js → chunk-5ETKDN5C.js} +1 -1
  15. package/dist/chunk-62ZNAMP7.js +2 -0
  16. package/dist/{chunk-TLVNPEBL.cjs → chunk-7HIUB5W6.cjs} +1 -1
  17. package/dist/{chunk-FWH744XA.js → chunk-7ZT3SGKA.js} +1 -1
  18. package/dist/{chunk-PFQ7GSLH.js → chunk-BKAIYAE7.js} +1 -1
  19. package/dist/{chunk-MJMI6IZW.js → chunk-DNOZXHWQ.js} +1 -1
  20. package/dist/{chunk-XCPMBMS7.js → chunk-GGP6UREO.js} +1 -1
  21. package/dist/{chunk-MVF5PRDZ.js → chunk-GQ63BSRF.js} +1 -1
  22. package/dist/{chunk-R36QQMHJ.cjs → chunk-KJGKWM6Y.cjs} +1 -1
  23. package/dist/{chunk-6BEXSHIC.js → chunk-LAJ3ELJV.js} +1 -1
  24. package/dist/{chunk-4S3B2JQY.cjs → chunk-NVCIA743.cjs} +3 -3
  25. package/dist/{chunk-N2SES3FP.cjs → chunk-OOKW3V5M.cjs} +1 -1
  26. package/dist/chunk-OPACGOVQ.cjs +2 -0
  27. package/dist/{chunk-E7O7PKZA.cjs → chunk-RRDWIVV4.cjs} +1 -1
  28. package/dist/{chunk-NNNQNB5T.js → chunk-SJMURCHX.js} +5 -5
  29. package/dist/{chunk-GK3MOEYU.cjs → chunk-TN27ALOV.cjs} +1 -1
  30. package/dist/{chunk-3PGCHNG2.cjs → chunk-TTVEGOCZ.cjs} +1 -1
  31. package/dist/index.cjs +2 -2
  32. package/dist/index.d.cts +4 -0
  33. package/dist/index.d.ts +4 -0
  34. package/dist/index.js +2 -2
  35. package/package.json +1 -1
  36. package/dist/AssetSelectionMenu-F2JUPXHM.js +0 -2
  37. package/dist/AssetSelectionMenu-U7S42AGB.cjs +0 -2
  38. package/dist/ChainSelectionMenu-BGZDH2WA.js +0 -2
  39. package/dist/ChainSelectionMenu-QGLWZEIZ.cjs +0 -2
  40. package/dist/SwapFormHorizontal-MEYPUSEU.js +0 -2
  41. package/dist/SwapFormHorizontal-QI3GS2BO.cjs +0 -2
  42. package/dist/SwapFormSplit-7VZ7IIJR.js +0 -2
  43. package/dist/SwapFormSplit-LI3MH5YB.cjs +0 -2
  44. package/dist/WidgetWalletTradeHistory-AQOIIO2U.cjs +0 -2
  45. package/dist/WidgetWalletTradeHistory-ES3FEDM7.js +0 -2
  46. package/dist/chunk-GF37SKBJ.js +0 -2
  47. package/dist/chunk-HFX3K3RG.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 _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 _chunkGIDTBDDCcjs = require('./chunk-GIDTBDDC.cjs');var _chunk3PGCHNG2cjs = require('./chunk-3PGCHNG2.cjs');var _chunk4S3B2JQYcjs = require('./chunk-4S3B2JQY.cjs');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _jsxruntime = require('react/jsx-runtime');var P=({toggle:D,side:y,onChainSelect:u,onChainHover:p,containerHeight:E})=>{let[i,m]=_react.useState.call(void 0, ""),l=_chunk4S3B2JQYcjs.x.call(void 0, i,300),x=_chunk3PGCHNG2cjs.c.call(void 0, ),s=_chunk4S3B2JQYcjs.e.call(void 0, x),{effectivePrioritizedInputChains:w}=_chunkGIDTBDDCcjs.a.call(void 0, ),n=y==="base"?w:[],d=_react.useMemo.call(void 0, ()=>{if(n.length===0)return s;let e=new Set(n),r=new Map(n.map((o,c)=>[o,c])),S=s.filter(o=>e.has(o.id)).sort((o,c)=>(_nullishCoalesce(r.get(o.id), () => (0)))-(_nullishCoalesce(r.get(c.id), () => (0)))),I=s.filter(o=>!e.has(o.id));return[...S,...I]},[s,n]),f=_react2.default.useMemo(()=>{if(!l)return d;let e=l.toLowerCase();return d.filter(r=>r.displayName.toLowerCase().includes(e)||r.name.toLowerCase().includes(e)||r.id.toString().includes(e))},[d,l]),N=_react.useCallback.call(void 0, e=>u(e),[u]);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-3",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:i,onChange:e=>m(e.target.value.toLowerCase())}),i&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>m(""),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 pb-4",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:i?"Search Results":"Available Chains"}),f.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"}):f.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:()=>N(e.id),onMouseEnter:()=>_optionalChain([p, 'optionalCall', _ => _(e.displayName)]),onMouseLeave:()=>_optionalChain([p, '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, _chunk4S3B2JQYcjs.N,{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-sans",style:{color:"var(--widget-muted-foreground)"},children:["Chain ID: ",e.id]})]},e.id))]})]})},F= exports.a =P;exports.a = F;
2
+ var _chunk4DL25Q57cjs = require('./chunk-4DL25Q57.cjs');var _chunkTTVEGOCZcjs = require('./chunk-TTVEGOCZ.cjs');var _chunkNVCIA743cjs = require('./chunk-NVCIA743.cjs');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _jsxruntime = require('react/jsx-runtime');var P=({toggle:D,side:y,onChainSelect:u,onChainHover:p,containerHeight:E})=>{let[i,m]=_react.useState.call(void 0, ""),l=_chunkNVCIA743cjs.x.call(void 0, i,300),x=_chunkTTVEGOCZcjs.c.call(void 0, ),s=_chunkNVCIA743cjs.e.call(void 0, x),{effectivePrioritizedInputChains:w}=_chunk4DL25Q57cjs.a.call(void 0, ),n=y==="base"?w:[],d=_react.useMemo.call(void 0, ()=>{if(n.length===0)return s;let e=new Set(n),r=new Map(n.map((o,c)=>[o,c])),S=s.filter(o=>e.has(o.id)).sort((o,c)=>(_nullishCoalesce(r.get(o.id), () => (0)))-(_nullishCoalesce(r.get(c.id), () => (0)))),I=s.filter(o=>!e.has(o.id));return[...S,...I]},[s,n]),f=_react2.default.useMemo(()=>{if(!l)return d;let e=l.toLowerCase();return d.filter(r=>r.displayName.toLowerCase().includes(e)||r.name.toLowerCase().includes(e)||r.id.toString().includes(e))},[d,l]),N=_react.useCallback.call(void 0, e=>u(e),[u]);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-3",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:i,onChange:e=>m(e.target.value.toLowerCase())}),i&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>m(""),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 pb-4",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:i?"Search Results":"Available Chains"}),f.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"}):f.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:()=>N(e.id),onMouseEnter:()=>_optionalChain([p, 'optionalCall', _ => _(e.displayName)]),onMouseLeave:()=>_optionalChain([p, '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, _chunkNVCIA743cjs.N,{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-sans",style:{color:"var(--widget-muted-foreground)"},children:["Chain ID: ",e.id]})]},e.id))]})]})},F= exports.a =P;exports.a = F;
@@ -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 _chunkTN27ALOVcjs = require('./chunk-TN27ALOV.cjs');var _chunkTTVEGOCZcjs = require('./chunk-TTVEGOCZ.cjs');var _chunkNVCIA743cjs = require('./chunk-NVCIA743.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');var _chunkT3I3AJXVcjs = require('./chunk-T3I3AJXV.cjs');var _reactquery = require('@tanstack/react-query');var _react = require('react');function Rn(e){if(e.length===0)return 5e3;let c=Math.max(...e.map(o=>_nullishCoalesce(_optionalChain([_chunkNVCIA743cjs.c.call(void 0, o), 'optionalAccess', _2 => _2.blockTimeMs]), () => (2e3))));return Math.min(5e3,Math.max(1e3,c*2+1e3))}var Tn=()=>{let{address:e}=_chunk34N36GUDcjs.a.call(void 0, ),t=_chunkTTVEGOCZcjs.c.call(void 0, ),n=_reactquery.useQueryClient.call(void 0, ),i=_react.useRef.call(void 0, null),c=_react.useRef.call(void 0, !0),o=_react.useCallback.call(void 0, a=>{if(!e)return;let f=[...new Set(a.tokens.map(u=>u.asset.chainId))],d=Rn(f);i.current&&(clearTimeout(i.current),i.current=null),i.current=setTimeout(async()=>{if(i.current=null,!!c.current)try{let u=a.tokens.map(m=>({chainId:m.asset.chainId,tokenAddress:m.asset.address})),s=await _chunkNVCIA743cjs.I.call(void 0, e,u);if(s.balances.length===0)return;if(a.tokens.length>=2){let m=a.tokens[0].asset,p=a.tokens[1].asset,h=_chunkNVCIA743cjs.J.swap(e,m.chainId,m.address,p.chainId,p.address);n.setQueryData(h,s)}let r=_chunkNVCIA743cjs.J.bulk(e,t),S=n.getQueryData(r);if(S){let m=S.balances.map(p=>_nullishCoalesce(s.balances.find(x=>x.chainId===p.chainId&&x.token.toLowerCase()===p.token.toLowerCase()), () => (p)));for(let p of s.balances)m.some(h=>h.chainId===p.chainId&&h.token.toLowerCase()===p.token.toLowerCase())||m.push(p);for(let p of a.tokens)if(!s.balances.some(x=>x.chainId===p.asset.chainId&&x.token.toLowerCase()===p.asset.address.toLowerCase())){let x=m.findIndex(l=>l.chainId===p.asset.chainId&&l.token.toLowerCase()===p.asset.address.toLowerCase());x!==-1&&(m[x]={...m[x],balance:"0",shiftedBalance:"0"})}n.setQueryData(r,{balances:m})}}catch (e2){}},d)},[e,t,n]);return _react.useEffect.call(void 0, ()=>(c.current=!0,()=>{c.current=!1,i.current&&(clearTimeout(i.current),i.current=null)}),[]),{triggerBalanceUpdate:o}},ot=class extends EventTarget{emit(t){this.dispatchEvent(new CustomEvent("balance-update",{detail:t}))}},at=new ot,Ve= exports.b =()=>e=>at.emit(e),os= exports.c =()=>{let{triggerBalanceUpdate:e}=Tn();_react.useEffect.call(void 0, ()=>{let t=n=>{e(n.detail)};return at.addEventListener("balance-update",t),()=>at.removeEventListener("balance-update",t)},[e])};var _viem = require('viem');var _jsxruntime = require('react/jsx-runtime');var Wt=_react.createContext.call(void 0, void 0),Lt=1e4,$n=3e4,Pn=1e3,Un=2;function On(e){return _nullishCoalesce(e.find(n=>_optionalChain([n, 'access', _3 => _3.routeSteps, 'optionalAccess', _4 => _4[0], 'optionalAccess', _5 => _5.type])==="AORI_V1"), () => (e[0]))}var fs=({children:e,recipient:t})=>{let{address:n}=_chunk34N36GUDcjs.a.call(void 0, ),i=t||n,[c,o]=_react.useState.call(void 0, "idle"),[a,f]=_react.useState.call(void 0, "idle"),[d,u]=_react.useState.call(void 0, null),[s,r]=_react.useState.call(void 0, null),[S,m]=_react.useState.call(void 0, !1),[p,h]=_react.useState.call(void 0, !1),[x,l]=_react.useState.call(void 0, !1),v=_react.useRef.call(void 0, null),T=_react.useRef.call(void 0, null),g=_react.useRef.call(void 0, null),U=_react.useRef.call(void 0, null),M=_react.useRef.call(void 0, null),y=_react.useRef.call(void 0, 0),k=_react.useRef.call(void 0, 0),F=_react.useRef.call(void 0, 0),N=_react.useRef.call(void 0, !1),I=_react.useRef.call(void 0, new Map),E=_react.useCallback.call(void 0, ()=>{g.current&&clearTimeout(g.current),U.current&&clearTimeout(U.current),M.current&&clearTimeout(M.current),g.current=null,U.current=null,M.current=null},[]),$=_react.useCallback.call(void 0, ()=>{E(),v.current=null,y.current=0,o(()=>N.current?"fresh":"idle")},[E]),_=_react.useCallback.call(void 0, ()=>{$(),T.current=null,u(null),r(null),m(!1),h(!1),l(!1),I.current.clear(),o("idle"),f("idle")},[$]),X=_react.useCallback.call(void 0, C=>{if(!C)return;U.current&&clearTimeout(U.current);let w=Math.max(0,C+$n-Date.now());U.current=setTimeout(()=>{o(O=>O==="idle"?"idle":"stale")},w)},[]),Z=_react.useCallback.call(void 0, async(C,w)=>{let{inputToken:O,outputToken:P,inputAmount:G,setOutputAmount:de}=C;if(!O||!P||!G||parseFloat(G)<=0||Date.now()-(k.current||0)<Lt-10)return;let ae=++y.current;try{if(!_optionalChain([O, 'optionalAccess', _6 => _6.decimals])||!_optionalChain([P, 'optionalAccess', _7 => _7.decimals]))return;let H=_chunkNVCIA743cjs.F.call(void 0, O.chainId)||_optionalChain([_chunkNVCIA743cjs.c.call(void 0, O.chainId), 'optionalAccess', _8 => _8.key])||"",ne=_chunkNVCIA743cjs.F.call(void 0, P.chainId)||_optionalChain([_chunkNVCIA743cjs.c.call(void 0, P.chainId), 'optionalAccess', _9 => _9.key])||"";if(!H||!ne)throw new Error("Unknown chain");let pe=_viem.parseUnits.call(void 0, G.toString(),O.decimals).toString(),fe={srcChainKey:H,dstChainKey:ne,srcTokenAddress:_chunkNVCIA743cjs.v.call(void 0, O.address),dstTokenAddress:_chunkNVCIA743cjs.v.call(void 0, P.address),amount:pe,srcWalletAddress:n||"0x0000000000000000000000000000000000000000",dstWalletAddress:i||n||"0x0000000000000000000000000000000000000000",options:{amountType:"EXACT_SRC_AMOUNT",feeTolerance:{type:"PERCENT",amount:2}}};k.current=Date.now();let J=await fetch(`${_chunkNVCIA743cjs.k.call(void 0, )}/quotes`,{method:"POST",headers:_chunkNVCIA743cjs.m.call(void 0, ),body:JSON.stringify(fe),signal:AbortSignal.timeout(15e3)});if(!J.ok){let V=await _asyncOptionalChain([(await J.json().catch(()=>({}))), 'optionalAccess', async _10 => _10.message])||J.statusText;throw Object.assign(new Error(V),{status:J.status})}let me=await J.json();if(ae!==y.current||v.current!==w)return;let Pe=_nullishCoalesce(me.quotes, () => ([])),be=On(Pe);if(!be)throw Object.assign(new Error("No quotes returned"),{emptyQuotes:!0});let Te=Number(_viem.formatUnits.call(void 0, _chunkNVCIA743cjs.q.call(void 0, be.dstAmount),P.decimals));typeof de=="function"&&de(Te),be._receivedAt=Date.now(),u(be),r(null),m(!1),o("fresh"),X(be._receivedAt),w&&I.current.delete(w)}catch(H){if(ae!==y.current||v.current!==w)return;let ne=_optionalChain([H, 'optionalAccess', _11 => _11.status]),pe=H instanceof Error?H.message:"",fe=!!_optionalChain([H, 'optionalAccess', _12 => _12.emptyQuotes]);if((ne===400||fe||pe.includes("Quote request failed"))&&w){let me=(I.current.get(w)||0)+1;if(I.current.set(w,me),me>=Un){h(!0),E(),v.current=null;return}}if(pe.toLowerCase().includes("order cap exceeded")){l(!0),E(),v.current=null;return}if(pe.toLowerCase().includes("insufficient executor balance")){m(!0),E(),v.current=null;return}r(H instanceof Error?H.message:"Unknown error")}},[n,i,X,E]),L=_react.useCallback.call(void 0, (C,w)=>{E(),T.current=C,k.current=0,I.current.delete(w),m(!1),h(!1),l(!1),r(null),o("polling");let O=async()=>{v.current===w&&(await Z(C,w),v.current===w&&(g.current=setTimeout(O,Lt)))};O()},[E,Z]),A=_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){$();return}let w=T.current;if(w&&_optionalChain([w, 'access', _16 => _16.inputToken, 'optionalAccess', _17 => _17.address])===_optionalChain([C, 'access', _18 => _18.inputToken, 'optionalAccess', _19 => _19.address])&&_optionalChain([w, 'access', _20 => _20.inputToken, 'optionalAccess', _21 => _21.chainId])===_optionalChain([C, 'access', _22 => _22.inputToken, 'optionalAccess', _23 => _23.chainId])&&_optionalChain([w, 'access', _24 => _24.outputToken, 'optionalAccess', _25 => _25.address])===_optionalChain([C, 'access', _26 => _26.outputToken, 'optionalAccess', _27 => _27.address])&&_optionalChain([w, 'access', _28 => _28.outputToken, 'optionalAccess', _29 => _29.chainId])===_optionalChain([C, 'access', _30 => _30.outputToken, 'optionalAccess', _31 => _31.chainId])&&w.inputAmount===C.inputAmount&&v.current)return;let P=Date.now();if(P-F.current<100)return;F.current=P;let G=`${Date.now()}-${Math.random().toString(36).slice(2)}`;v.current=G,L(C,G)},[L,$]),W=_react.useCallback.call(void 0, ({amount:C,inputToken:w,outputToken:O,setOutputAmount:P})=>{P(null),M.current&&clearTimeout(M.current),!C||C===0?(f("idle"),$(),u(null),r(null),m(!1),h(!1),l(!1)):(f("typing"),$(),u(null),m(!1),h(!1),l(!1),r(null),M.current=setTimeout(()=>{f("settled"),w&&O&&C>0&&A({inputToken:w,outputToken:O,inputAmount:C.toString(),setOutputAmount:P})},Pn))},[$,A]),q=_react.useCallback.call(void 0, ()=>{let C=T.current;if(!C)return;u(null);let w=`${Date.now()}-${Math.random().toString(36).slice(2)}`;v.current=w,o("refreshing"),typeof C.setOutputAmount=="function"&&C.setOutputAmount(null),L(C,w)},[L]);_react.useEffect.call(void 0, ()=>{N.current=!!d},[d]),_react.useEffect.call(void 0, ()=>()=>E(),[E]);let Q=_react.useMemo.call(void 0, ()=>({status:c,inputState:a,rfqQuote:d,error:s,liquidityError:S,routingError:p,sizeCapError:x,ensureForParams:A,stop:$,refresh:q,clear:_,handleInputChange:W}),[c,a,d,s,S,p,x,A,$,q,_,W]);return _jsxruntime.jsx.call(void 0, Wt.Provider,{value:Q,children:e})},Be= exports.f =()=>{let e=_react.useContext.call(void 0, Wt);if(e===void 0)throw new Error("useRfq must be used within an RfqProvider");return e};var Wn=_react.createContext.call(void 0, {openConnectModal:()=>{}}),hs= exports.h =()=>_react.useContext.call(void 0, Wn);var Fn={1:.001,42161:5e-5,10:5e-5,8453:5e-5,56:5e-5,143:.001,988:1e-6,9745:1e-5,4326:5e-5,30:5e-6},Dn=1e-4,qn=150000n,Vn=3n,Bn=1n;async function bs(e,t,n){let i=_nullishCoalesce(Fn[e], () => (Dn));try{let c=_chunkNVCIA743cjs.H.call(void 0, e),o=await c.getGasPrice(),a=qn,f="fallback";if(t&&n){let S=_optionalChain([_chunkNVCIA743cjs.c.call(void 0, e), 'optionalAccess', _32 => _32.wrappedAsset, 'optionalAccess', _33 => _33.address]);if(S)try{a=await c.estimateGas({account:t,to:S,value:BigInt(n)}),f="simulation"}catch (e3){f="fallback (simulation failed)"}}let d=o*a*Vn/Bn,u=Number(d)/1e18,s=Math.max(u,i);return console.log("[estimateGasBuffer]",{chainId:e,gasPrice:`${Number(o)/1e9} gwei`,gasEstimate:Number(a),estimateSource:f,rawCostETH:u.toFixed(10),minBuffer:i,finalBuffer:s.toFixed(10),usedFloor:s===i}),s}catch(c){return console.warn("[estimateGasBuffer] RPC error, using minBuffer:",i,c),i}}var Qn=20,jn=({side:e,asset:t,otherAsset:n,isPlacingOrder:i,isWrappingPair:c,isUnwrappingPair:o})=>{let{baseAmount:a,quoteAmount:f,setBaseAmount:d,setQuoteAmount:u}=_chunkTN27ALOVcjs.e.call(void 0, ),{amountInputVariant:s,hideAmountInputSymbol:r,widgetType:S}=_chunkTTVEGOCZcjs.b.call(void 0, ),m=S==="compact",[p,h]=e==="base"?[d,u]:[u,d],x=!t||e==="quote"||i,l=m?32:s==="default"?64:32,[v,T]=_react.useState.call(void 0, l),[g,U]=_react.useState.call(void 0, ""),M=_react.useRef.call(void 0, null),y=_react.useRef.call(void 0, null),k=_react.useRef.call(void 0, null),F=_react.useRef.call(void 0, null),N="USD",I=e==="base"?a:f,[E,$]=_react.useState.call(void 0, !1),_=_react.useCallback.call(void 0, ()=>{if(s!=="default"){T(l);return}if(!M.current||!y.current||!k.current)return;let L=M.current.offsetWidth,A=20,W=l;for(;W>20&&(y.current.style.fontSize=`${W}px`,k.current.style.fontSize=`${W}px`,!(y.current.offsetWidth+k.current.offsetWidth+A<=L));)W-=1;T(W)},[s,l]),X=_react.useCallback.call(void 0, L=>{L.key==="."&&g.includes(".")&&L.preventDefault()},[g]),Z=_react.useCallback.call(void 0, L=>{let A=L.target.value;if(A==="."&&(A="0."),!/^\d*\.?\d*$/.test(A)||(A.match(/\./g)||[]).length>1)return;if(A.length>1&&A[0]==="0"&&A[1]!=="."&&(A=A.replace(/^0+/,"")||"0"),_optionalChain([t, 'optionalAccess', _34 => _34.decimals])!==void 0&&A.includes(".")){let[,q]=A.split(".");if(q&&q.length>t.decimals)return}if(A.length>Qn)return;U(A);let W=parseFloat(A);A!==g&&(A===""||A==="0."||A.endsWith(".")?(p(null),e==="base"&&h(null)):!Number.isNaN(W)&&W>=0&&p(W),e==="base"&&u(null),(o||c)&&u(W||0))},[g,p,e,u,_optionalChain([t, 'optionalAccess', _35 => _35.decimals]),h,o,c]);return _react.useEffect.call(void 0, ()=>{let L=q=>{if(q===null)return"";let Q=_optionalChain([t, 'optionalAccess', _36 => _36.decimals]);if(Q===void 0)return"";let C=q.toString();if(/e/i.test(C)&&(C=Number(q).toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:Q})),C.includes(".")){let[w,O]=C.split("."),P=O.slice(0,Q);return P?`${w}.${P}`:w}return C};if(I===null){g==="0."||g!==""&&g.endsWith(".")||U("");return}if(!x&&(g.endsWith(".")||g.match(/\.\d*0$/)||g==="0"||g==="0.")&&g!=="")return;let W=parseFloat(g)||0;(g===""||Math.abs(W-I)>1e-10)&&U(L(I))},[I,_optionalChain([t, 'optionalAccess', _37 => _37.decimals]),g,x]),_react.useEffect.call(void 0, ()=>{_()},[g,_]),_react.useEffect.call(void 0, ()=>{$(!0)},[]),_react.useEffect.call(void 0, ()=>{E&&_()},[E,_]),_react.useEffect.call(void 0, ()=>{y.current&&F.current&&(F.current.style.width=`${y.current.offsetWidth}px`)},[g]),_react.useEffect.call(void 0, ()=>{if(!E)return;let L=new ResizeObserver(()=>{E&&_()});return M.current&&L.observe(M.current),()=>L.disconnect()},[E,_]),_jsxruntime.jsx.call(void 0, "div",{ref:M,style:{fontSize:`${v}px`,transition:"font-size 0.05s ease-in-out"},className:`mt-2 box-border font-sans flex ${m?s==="normal"?"h-12 my-1":"h-10 my-0.5":s==="normal"?"h-12 my-1":"h-20 my-1"} w-full flex-row items-center ${x?"cursor-default":"cursor-text"}`,onClick:()=>_optionalChain([F, 'access', _38 => _38.current, 'optionalAccess', _39 => _39.focus, 'call', _40 => _40()]),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:F,type:"text",inputMode:"decimal",placeholder:"0",autoComplete:"off",id:`${e}Amount`,value:g,onWheel:L=>L.target.blur(),onKeyDown:X,onChange:Z,style:{transition:"width 0.15s ease-in-out",color:"var(--widget-foreground)",WebkitTextFillColor:"var(--widget-foreground)",opacity:1},className:"flex min-w-[45px] whitespace-nowrap bg-transparent placeholder:opacity-50 font-sans font-thin",disabled:x}),_jsxruntime.jsx.call(void 0, "span",{style:{transition:"width 0.15s ease-in-out"},ref:y,className:"pointer-events-none absolute flex whitespace-nowrap invisible",children:g||0}),!r&&s!=="normal"&&_jsxruntime.jsx.call(void 0, "span",{ref:k,className:"ml-2 font-thin uppercase",style:{color:"var(--widget-foreground)",opacity:.5,fontSize:`${v}px`},children:_optionalChain([t, 'optionalAccess', _41 => _41.symbol])?t.symbol.length>6?`${t.symbol.slice(0,6)}...`:t.symbol:N}),(r||s==="normal")&&_jsxruntime.jsx.call(void 0, "span",{ref:k,className:"hidden"})]})})},As= exports.j =jn;var Gn=({toggle:e,side:t,asset:n,isPlacingOrder:i,hideDropdown:c})=>{let{baseBalance:o,quoteBalance:a}=_chunkTN27ALOVcjs.e.call(void 0, ),{tokenDisplay:f,tokenBadgeOrientation:d,widgetType:u}=_chunkTTVEGOCZcjs.b.call(void 0, ),s=u==="compact",r=s?"h-10":"h-13",S=s?"h-10 w-10":"h-13 w-13",m=t==="base"?o.formatted?(()=>{let h=parseFloat(o.formatted);return h>=1e4?_chunkNVCIA743cjs.o.call(void 0, h):h.toFixed(4)})():void 0:a.formatted?(()=>{let h=parseFloat(a.formatted);return h>=1e4?_chunkNVCIA743cjs.o.call(void 0, h):h.toFixed(4)})():void 0,p={role:"button",tabIndex:i?-1:0,"aria-disabled":i,"aria-label":`Select ${t==="base"?"input":"output"} token${n?`: ${n.symbol}`:""}`,onClick:i?void 0:e,onKeyDown:i?void 0:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),e())}};return f==="pill"?_jsxruntime.jsx.call(void 0, "div",{...p,className:`inline-flex items-center gap-1.5 h-7 px-2.5 rounded-full cursor-pointer transition-colors ${d==="right"?"ml-auto":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)"},children:n?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.N,{chain:n.chainId,size:"xs"}),_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.O,{className:"rounded-full",asset:n,size:"xxs",noChain:!0}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-thin uppercase",children:n.symbol}),!c&&_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.U,{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"}),!c&&_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.U,{className:"w-1.5 opacity-60",style:{color:"var(--widget-secondary-foreground)"}})]})}):f==="ghost"?_jsxruntime.jsxs.call(void 0, "div",{...p,className:"inline-flex items-center gap-1.5 cursor-pointer transition-opacity hover:opacity-70 py-1",style:{color:"var(--widget-foreground)"},children:[n?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.N,{chain:n.chainId,size:"xs"}),_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.O,{className:"rounded-full",asset:n,size:"xxs",noChain:!0}),_jsxruntime.jsx.call(void 0, "span",{className:"text-sm font-thin uppercase",children:n.symbol})]}):_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Select token"}),!c&&_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.U,{className:"w-1.5 opacity-50"})]}):_jsxruntime.jsx.call(void 0, "div",{...p,className:`relative ${r} 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:n?_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:`${S} pl-px flex items-center justify-center`,children:_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.O,{className:"rounded-full",asset:n,size:"lg"})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row items-center justify-between pl-2.5 pr-7",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full flex-col justify-center gap-0.5",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-base font-thin uppercase",style:{color:"var(--widget-secondary-foreground)"},children:n.symbol}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs font-sans",style:{color:"var(--widget-muted-foreground)"},children:[_optionalChain([n, 'access', _42 => _42.address, 'optionalAccess', _43 => _43.slice, 'call', _44 => _44(0,6)]),"...",_optionalChain([n, 'access', _45 => _45.address, 'optionalAccess', _46 => _46.slice, 'call', _47 => _47(-4)])]})]}),m!==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-muted-foreground)"},children:"Balance"}),_jsxruntime.jsx.call(void 0, "span",{className:"font-sans text-xs tabular-nums",style:{color:"var(--widget-foreground)",opacity:.5},children:m})]})]}),!c&&_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.U,{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"})})})})},Ps= exports.k =Gn;var Dt=_chunkT3I3AJXVcjs.b.call(void 0, _chunkKH57FLSTcjs.a.call(void 0, ),1);var Hn=()=>{let[e,t]=_react.useState.call(void 0, null),[n,i]=_react.useState.call(void 0, ""),c=_chunkNVCIA743cjs.x.call(void 0, n,1e3),[o,a]=_react.useState.call(void 0, !1),[f,d]=_react.useState.call(void 0, "");_react.useEffect.call(void 0, ()=>{_chunkTTVEGOCZcjs.d.getState().setRecipient(e)},[e]),_react.useEffect.call(void 0, ()=>{i(e||"")},[e]);let u=r=>{let S=r.target.value;o&&(a(!1),d(""),t(null)),i(S),S===""&&t(null)};_react.useEffect.call(void 0, ()=>{c===""||!c?(a(!1),d(""),t(null)):_chunkNVCIA743cjs.w.call(void 0, c)?(a(!1),d(""),t(c)):(a(!0),d("Invalid wallet address..."),t(null),i(""))},[c]),_react.useEffect.call(void 0, ()=>{if(o){let r=setTimeout(()=>{t(null),i(""),a(!1),d("")},2e3);return()=>clearTimeout(r)}},[o]);let s=()=>{t(null),i(""),a(!1),d("")};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&&!o?_jsxruntime.jsx.call(void 0, "img",{className:"h-full w-full rounded-full object-cover",src:(0,Dt.makeGradient)(e),alt:"Recipient avatar"}):_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.T,{className:"h-5 w-5",style:{color:o?"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:o?"var(--widget-destructive)":"var(--widget-muted-foreground)"},"aria-hidden":"true",children:"To:"}),_jsxruntime.jsx.call(void 0, "input",{id:"recipient-address",className:"font-sans block h-10 w-full items-center pl-12 pt-4 pr-8 text-xs",style:{backgroundColor:o?"color-mix(in srgb, var(--widget-destructive) 10%, transparent)":"transparent",color:o?"var(--widget-destructive)":"var(--widget-foreground)",outline:"none",opacity:o?.9:1},placeholder:o?f:"Enter recipient address...",value:n,onChange:u,spellCheck:!1,"aria-invalid":o,"aria-describedby":o?"recipient-error":void 0}),o&&_jsxruntime.jsx.call(void 0, "span",{id:"recipient-error",className:"sr-only",children:f}),e&&!o&&_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:s,"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"})]})]})})},Fs= exports.l =Hn;function Vs(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 _actions = require('viem/actions');function Bt(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 Vt(e){if(_optionalChain([e, 'access', _48 => _48.chain, 'optionalAccess', _49 => _49.id]))return e.chain.id;let t=_optionalChain([e, 'access', _50 => _50.getChainId, 'optionalCall', _51 => _51()]);return t!=null?await t:null}var Xn=async(e,t)=>{try{if(await Vt(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 Vt(e)===t}catch(n){throw Bt(n)?new Error("User rejected the chain switch request"):new Error(`Please switch your wallet to the required network (Chain ID: ${t})`)}},$e=class extends Error{constructor(t){super(t||"Quote expired before submission"),this.name="QuoteStaleError"}},Qt= exports.o =async e=>{let{quote:t,signatureStep:n,userAddress:i,walletClient:c,validateBeforeSubmit:o}=e;if(!c)throw new Error("Wallet client not available");if(n.type!=="SIGNATURE"||!_optionalChain([n, 'access', _52 => _52.signature, 'optionalAccess', _53 => _53.typedData]))throw new Error("Invalid signature step");try{let a=n.signature.typedData,f={...a.message};for(let r of["inputAmount","outputAmount","startTime","endTime"])f[r]!=null&&(f[r]=BigInt(f[r]));let d=a.domain;if(d.chainId!=null){let r=Number(d.chainId);await Xn(c,r)}let u=await _actions.signTypedData.call(void 0, c,{account:i,domain:d,types:a.types,primaryType:a.primaryType,message:f});if(o){let r=o();if(!r.canSubmit)throw new $e(r.reason)}let s=await fetch(`${_chunkNVCIA743cjs.k.call(void 0, )}/submit-signature`,{method:"POST",headers:_chunkNVCIA743cjs.m.call(void 0, ),body:JSON.stringify({quoteId:t.id,signatures:[u]})});if(!s.ok){let r=await s.json().catch(()=>({}));throw new Error(_optionalChain([r, 'optionalAccess', _54 => _54.message])||`Submit failed: ${s.status}`)}return{quoteId:t.id,signature:u}}catch(a){throw a instanceof $e?a:Bt(a)?new Error("User rejected the signing request"):a instanceof Error&&a.message.includes("chain")?new Error("Chain switching failed. Please manually switch to the correct network."):a}};var jt="vt_submitted_quotes";var ut=()=>{try{let e=localStorage.getItem(jt);return e?JSON.parse(e):[]}catch (e4){return[]}},zt=e=>{try{localStorage.setItem(jt,JSON.stringify(e))}catch (e5){}},Zn= exports.p =e=>{let t=Date.now(),n=typeof e=="string"?new Date(e).getTime():e>9999999999?e:e*1e3;return t<n+3e4},Jn=e=>ut().some(t=>t.quoteId===e),dt= exports.q =(e,t)=>Jn(e)?{canSubmit:!1,reason:"Order already submitted"}:Zn(t)?{canSubmit:!0}:{canSubmit:!1,reason:"Quote has expired"},Gt= exports.r =(e,t)=>{let n=typeof t=="string"?new Date(t).getTime():t,i=ut();i.push({quoteId:e,submittedAt:Date.now(),createdAt:n}),zt(i)},Ht= exports.s =()=>{let e=ut(),t=Date.now(),n=300*1e3,i=e.filter(c=>t-c.submittedAt<n);i.length!==e.length&&zt(i)};var _core = require('@wagmi/core');var _abis = require('abitype/abis');var _wagmi = require('wagmi');function Kt(){let e=_wagmi.useConfig.call(void 0, );return _reactquery.useMutation.call(void 0, {mutationFn:async({chainId:t,accountAddress:n,amountRaw:i,writeContractAsync:c})=>{let o=_chunkNVCIA743cjs.c.call(void 0, t);if(!o)throw new Error(`No wrapping contract for chain ${t}`);let a=o.wrappedAsset.address,f=await c({abi:_abis.wethAbi,functionName:"withdraw",address:a,account:n,args:[i],chainId:t});if((await _core.waitForTransactionReceipt.call(void 0, e,{hash:f,chainId:t,confirmations:1,pollingInterval:4e3})).status!=="success")throw new Error("Unwrap transaction did not get successful receipt");return{success:!0,hash:f}}})}function Yt(){let e=_wagmi.useConfig.call(void 0, );return _reactquery.useMutation.call(void 0, {mutationFn:async({chainId:t,accountAddress:n,amountRaw:i,writeContractAsync:c})=>{let o=_chunkNVCIA743cjs.c.call(void 0, t);if(!o)throw new Error(`No wrapping contract for chain ${t}`);let a=o.wrappedAsset.address,f=await c({abi:_abis.wethAbi,functionName:"deposit",address:a,account:n,value:i,chainId:t});if((await _core.waitForTransactionReceipt.call(void 0, e,{hash:f,chainId:t,confirmations:1,pollingInterval:4e3})).status!=="success")throw new Error("Wrap transaction did not get successful receipt");return{success:!0,hash:f}}})}var pr=15e3,Ge="chain",fr=({needsChainSwitch:e,requiredChain:t,reviewState:n,goToNextStep:i,cancel:c})=>{let o=_chunkNVCIA743cjs.r.call(void 0, Ge,n),[a,f]=_react.useState.call(void 0, "pending"),d=_react.useRef.call(void 0, !1),u=_react.useRef.call(void 0, !1),s=_react.useRef.call(void 0, null),r=_wagmi.useChainId.call(void 0, ),{switchChainAsync:S}=_wagmi.useSwitchChain.call(void 0, ),{status:m,isReconnecting:p}=_wagmi.useAccount.call(void 0, ),h=_react.useCallback.call(void 0, ()=>{s.current&&(clearTimeout(s.current),s.current=null)},[]),x=_react.useCallback.call(void 0, async()=>{if(!(d.current||u.current||m!=="connected"||p)){d.current=!0,u.current=!0,f("pending"),s.current=setTimeout(()=>{d.current&&(f("error"),d.current=!1)},pr);try{await S({chainId:t.chainId}),h(),f("success"),i(Ge,n)}catch (e6){h(),f("error")}finally{d.current=!1}}},[S,m,p,t.chainId,i,n,h]);_react.useEffect.call(void 0, ()=>{d.current||u.current||n===Ge&&a==="pending"&&m==="connected"&&!p&&(e&&r!==t.chainId?x():(f("success"),i(Ge,n)))},[n,a,e,r,t.chainId,m,p,x,i]),_react.useEffect.call(void 0, ()=>()=>h(),[h]);let l=()=>{a==="error"&&(u.current=!1,f("pending"))},v=!o&&a==="error",T=!o&&(a==="pending"||a==="error"),g=v?"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-sans font-medium transition duration-150 ${v?"cursor-pointer":"cursor-not-allowed"}`,style:{backgroundColor:`color-mix(in srgb, ${g} 12%, transparent)`,border:`1px solid color-mix(in srgb, ${g} 20%, transparent)`,color:g,borderRadius:"var(--widget-radius)"},onClick:v?l: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, _chunkNVCIA743cjs.N,{chain:t.chainId,size:"xs"}),_jsxruntime.jsx.call(void 0, "p",{className:"whitespace-nowrap",children:v?"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:[!o&&a==="pending"&&_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.V,{size:"5"}),(o||a==="success")&&_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.P,{className:"h-8 w-8"}),v&&_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.S,{className:"h-[12px] w-[12px]"})]})]})}),T&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"inline-flex h-12 items-center justify-center px-8 text-sm font-sans 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:c,children:"Cancel"})]})},Jt=fr;var mr=({startTime:e,onExpired:t})=>{let[n,i]=_react.useState.call(void 0, 30),[c,o]=_react.useState.call(void 0, !1),a=_react.useRef.call(void 0, !1),f=_react.useRef.call(void 0, t);f.current=t,_react.useEffect.call(void 0, ()=>{a.current=!1},[e]),_react.useEffect.call(void 0, ()=>{let u=()=>{let r=Date.now(),m=(e>9999999999?e:e*1e3)+30*1e3,p=Math.max(0,m-r),h=Math.floor(p/1e3);if(h<=0){i(0),a.current||(a.current=!0,o(!0),f.current());return}i(h),o(!1)};if(c)return;u();let s=setInterval(u,1e3);return()=>clearInterval(s)},[e,c]);let d=u=>{let s=Math.floor(u/60),r=u%60;return`${s.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`};return c?null:_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-sans",children:d(n)})},rn=mr;function Tr(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 ye="signingOrder";async function Ar(e,t,n,i,c){let o=_optionalChain([e, 'access', _55 => _55.transaction, 'optionalAccess', _56 => _56.encoded]),a=_nullishCoalesce(_optionalChain([o, 'optionalAccess', _57 => _57.to]), () => (e.to)),f=_nullishCoalesce(_optionalChain([o, 'optionalAccess', _58 => _58.data]), () => (e.data)),d=_nullishCoalesce(_optionalChain([o, 'optionalAccess', _59 => _59.value]), () => (e.value));if(!a)throw new Error('Transaction step missing "to" address');let u=_optionalChain([o, 'optionalAccess', _60 => _60.chainId]),s=e.chainKey||c,r=u||(s?_chunkNVCIA743cjs.E.call(void 0, s):void 0);if(!r)throw new Error(`Unknown chain: ${s}`);let S=_chunkNVCIA743cjs.h.call(void 0, )[r],m=await n({account:t,chain:S,to:a,data:f||"0x",value:BigInt(d||"0")});return await _core.waitForTransactionReceipt.call(void 0, i,{hash:m,chainId:r}),m}async function kr(e,t,n,i,c){let o=_optionalChain([e, 'access', _61 => _61.transaction, 'optionalAccess', _62 => _62.encoded]),a=_nullishCoalesce(_optionalChain([o, 'optionalAccess', _63 => _63.to]), () => (e.to)),f=_nullishCoalesce(_optionalChain([o, 'optionalAccess', _64 => _64.data]), () => (e.data));if(!a||!f)return!1;let d,u;try{let{functionName:T,args:g}=_viem.decodeFunctionData.call(void 0, {abi:_viem.erc20Abi,data:f});if(T!=="approve"||!g||g.length<2)return!1;d=g[0],u=g[1]}catch (e7){return!1}let s=e.chainKey||c.srcChainKey,r=_optionalChain([o, 'optionalAccess', _65 => _65.chainId])||(s?_chunkNVCIA743cjs.E.call(void 0, s):void 0);if(!r)return!1;let m=await _chunkNVCIA743cjs.H.call(void 0, r).readContract({address:a,abi:_viem.erc20Abi,functionName:"allowance",args:[t,d]});if(m>=u)return!0;let p=_chunkNVCIA743cjs.h.call(void 0, )[r],h=await _core.getGasPrice.call(void 0, i,{chainId:r}),x={account:t,chain:p,to:a,value:0n,gas:150000n,gasPrice:h};if(m>0n){let T=_viem.encodeFunctionData.call(void 0, {abi:_viem.erc20Abi,functionName:"approve",args:[d,0n]}),g=await n({...x,data:T});await _core.waitForTransactionReceipt.call(void 0, i,{hash:g,chainId:r})}let l=_viem.encodeFunctionData.call(void 0, {abi:_viem.erc20Abi,functionName:"approve",args:[d,_viem.maxUint256]}),v=await n({...x,data:l});return await _core.waitForTransactionReceipt.call(void 0, i,{hash:v,chainId:r}),!0}var Nr=({base:e,baseAmount:t,quote:n,quoteAmount:i,userAddress:c,reviewState:o,goToNextStep:a,cancel:f,isWrappingPair:d,isUnwrappingPair:u,restartSigningFlow:s,onSwapInitiated:r,onOrderSubmitted:S,onSwapSubmitted:m,startPolling:p,trackNativeTransaction:h})=>{let x=_chunkNVCIA743cjs.r.call(void 0, ye,o),[l,v]=_react.useState.call(void 0, "idle"),T=_react.useRef.call(void 0, !1),g=_react.useRef.call(void 0, null),U=_wagmi.useConfig.call(void 0, ),{isReconnecting:M}=_wagmi.useAccount.call(void 0, ),{rfqQuote:y,stop:k,refresh:F}=Be(),{data:N}=_wagmi.useWalletClient.call(void 0, {chainId:e.chainId}),{switchChain:I}=_wagmi.useSwitchChain.call(void 0, ),{sendTransactionAsync:E}=_wagmi.useSendTransaction.call(void 0, ),$=_nullishCoalesce(_optionalChain([y, 'optionalAccess', _66 => _66._receivedAt]), () => (0)),_=_react.useCallback.call(void 0, ()=>$?Date.now()>=$+30*1e3:!1,[$]),X=_react.useCallback.call(void 0, async()=>{if(T.current||l!=="idle")return;if(!_optionalChain([y, 'optionalAccess', _67 => _67.id])||!_optionalChain([y, 'optionalAccess', _68 => _68._receivedAt])){v("error");return}if(!dt(y.id,y._receivedAt).canSubmit){v("stale");return}T.current=!0;try{if(!N)throw new Error("Wallet client not available");Ht();let w=_nullishCoalesce(y.userSteps, () => ([])),O;for(let P of w)if(P.type==="TRANSACTION"){v("submitting");let G=P.chainKey||y.srcChainKey,de=G?_chunkNVCIA743cjs.E.call(void 0, G):void 0;if(de&&_optionalChain([N, 'access', _69 => _69.chain, 'optionalAccess', _70 => _70.id])!==de&&(await I({chainId:de}),await new Promise(ae=>setTimeout(ae,800))),await kr(P,c,E,U,y))continue;O=await Ar(P,c,E,U,y.srcChainKey),h(O,P.description||`Tx on ${G}`)}else P.type==="SIGNATURE"&&(v("signing"),await Qt({quote:y,signatureStep:P,userAddress:c,walletClient:N,validateBeforeSubmit:()=>dt(y.id,y._receivedAt)}));Gt(y.id,y._receivedAt),_optionalChain([S, 'optionalCall', _71 => _71(y.id)]),p(y.id,{baseToken:e,quoteToken:n}),_optionalChain([r, 'optionalCall', _72 => _72()]),k(),v("success"),a(ye,o),_optionalChain([m, 'optionalCall', _73 => _73(y.id)])}catch(w){if(w instanceof $e){T.current=!1,s?s(!0):v("stale");return}else w instanceof Error&&Tr(w),v("error")}finally{T.current=!1}},[l,y,N,e,n,c,k,p,a,o,m,I,E,r,S,h,U,s]);_react.useEffect.call(void 0, ()=>{if(o===ye&&k(),x&&l!=="success"){v("success"),a(ye,o);return}if(l==="success"){a(ye,o);return}if(o===ye&&l==="idle"&&!_optionalChain([y, 'optionalAccess', _74 => _74.id])){v("refreshingQuote"),F();return}if(o===ye&&l==="idle"&&N&&!T.current&&!M){let C=_optionalChain([y, 'optionalAccess', _75 => _75.id])||null;C&&g.current!==C&&(g.current=C,X())}},[x,o,l,N,M,X,a,_optionalChain([y, 'optionalAccess', _76 => _76.id]),F,k]),_react.useEffect.call(void 0, ()=>{l==="refreshingQuote"&&_optionalChain([y, 'optionalAccess', _77 => _77.id])&&v("idle")},[l,_optionalChain([y, 'optionalAccess', _78 => _78.id])]),_react.useEffect.call(void 0, ()=>{o!==ye&&(g.current=null)},[o]),_react.useEffect.call(void 0, ()=>{let C=setInterval(()=>{_()&&!T.current&&l!=="submitting"&&l!=="success"&&v("stale")},1e3);return()=>clearInterval(C)},[_,l]);let Z=()=>{l==="error"&&!T.current&&(g.current=null,v("idle"))},L=_react.useCallback.call(void 0, ()=>{g.current=null,v("refreshingQuote"),F()},[F]),A=_react.useCallback.call(void 0, ()=>{s?s(!0):f()},[s,f]),W=()=>l==="error"?"Retry swap":l==="signing"?"Sign Swap Order":l==="submitting"?"Submitting...":l==="refreshingQuote"?"Refreshing Quote...":l==="stale"?"Quote Stale":"Sign & Submit",q=!x&&(l==="error"||l==="stale"),Q=q?"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-sans font-medium transition duration-150 ${q?"cursor-pointer":"cursor-not-allowed"}`,style:{backgroundColor:`color-mix(in srgb, ${Q} 12%, transparent)`,border:`1px solid color-mix(in srgb, ${Q} 20%, transparent)`,color:Q,borderRadius:"var(--widget-radius)"},onClick:!x&&l==="error"?Z:l==="stale"?A: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, _chunkNVCIA743cjs.O,{asset:e,size:"xs",noChain:!0}),_jsxruntime.jsx.call(void 0, "p",{className:"whitespace-nowrap",children:W()}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-1 border-t",style:{borderColor:"var(--widget-border)"}}),$>0&&l!=="success"&&l!=="error"&&l!=="stale"&&_jsxruntime.jsx.call(void 0, rn,{startTime:$,onExpired:()=>v("stale")}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-6 w-3 items-center justify-center rounded-full",children:[!x&&(l==="idle"||l==="signing"||l==="submitting"||l==="refreshingQuote")&&_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.V,{size:"5"}),(x||l==="success")&&_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.P,{className:"h-8 w-8"}),!x&&(l==="error"||l==="stale")&&_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.S,{className:"h-[12px] w-[12px]"})]})]})}),!x&&(l==="error"||l==="stale")&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"inline-flex h-12 items-center justify-center px-8 text-sm font-sans 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:f,children:"Cancel"})]})},an=Nr;var Er=()=>_jsxruntime.jsxs.call(void 0, "svg",{className:"w-3 h-3 shrink-0",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"})]}),$r="trackingTx",cn={pending:{icon:_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.V,{size:"5"}),buttonText:"Trade Pending",showNewSwap:!1,statusVar:"var(--widget-primary)",clickable:!1},received:{icon:_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.V,{size:"5"}),buttonText:"Trade Received",showNewSwap:!1,statusVar:"var(--widget-primary)",clickable:!1},completed:{icon:_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.P,{className:"h-5 w-5"}),buttonText:"View Transaction",showNewSwap:!1,statusVar:"var(--widget-status-completed)",clickable:!0},failed:{icon:_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.Y,{}),buttonText:"Retry Swap",showNewSwap:!0,statusVar:"var(--widget-status-failed)",clickable:!0},cancelled:{icon:_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.Y,{}),buttonText:"View Transaction",showNewSwap:!1,statusVar:"var(--widget-status-failed)",clickable:!0}},Pr=({orderHash:e,base:t,quote:n,baseAmount:i,quoteAmount:c,reviewState:o,onNewSwap:a,onRetry:f,status:d})=>{let u=_chunkNVCIA743cjs.r.call(void 0, $r,o),s=cn[d]||cn.pending,r=_chunkTTVEGOCZcjs.d.call(void 0, p=>p.explorerUrl);_react.useEffect.call(void 0, ()=>{if(d==="completed"){let p=setTimeout(a,15e3);return()=>clearTimeout(p)}},[d,a]);let S=()=>{d==="failed"?f():(d==="completed"||d==="cancelled")&&r&&window.open(r,"_blank","noopener,noreferrer")},m=s.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-sans font-medium transition duration-150 ${s.clickable?"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:s.clickable?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, "div",{className:"flex h-6 w-6 items-center justify-center rounded-full overflow-hidden shrink-0",children:s.icon}),_jsxruntime.jsx.call(void 0, "p",{className:"whitespace-nowrap",children:s.buttonText}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-1 border-t",style:{borderColor:"var(--widget-border)"}}),s.clickable&&_jsxruntime.jsx.call(void 0, "div",{className:"flex h-6 w-6 items-center justify-center",children:d==="failed"?_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.X,{}):_jsxruntime.jsx.call(void 0, Er,{})})]})})})},ln=Pr;var Lr=15e3,Xe="unwrapping",Wr=({needsToUnwrap:e,amount:t,chainId:n,token:i,reviewState:c,setReviewState:o,goToNextStep:a,cancel:f,delayedClose:d})=>{let u=_chunkNVCIA743cjs.r.call(void 0, Xe,c),[s,r]=_react.useState.call(void 0, "idle"),S=Kt(),{writeContractAsync:m}=_wagmi.useWriteContract.call(void 0, ),{address:p}=_chunk34N36GUDcjs.a.call(void 0, ),h=Ve(),x=_react.useRef.call(void 0, !1),l=_react.useRef.call(void 0, !1),v=_react.useRef.call(void 0, null),{status:T}=_wagmi.useAccount.call(void 0, ),g=_react.useCallback.call(void 0, ()=>{v.current&&(clearTimeout(v.current),v.current=null)},[]),U=_react.useCallback.call(void 0, async()=>{if(!(x.current||l.current||!p||T!=="connected")){x.current=!0,l.current=!0,r("pending"),v.current=setTimeout(()=>{x.current&&(r("error"),x.current=!1)},Lr);try{let N=_chunkNVCIA743cjs.c.call(void 0, n);if(!N)throw new Error(`No config for chain ${n}`);let I=_nullishCoalesce(N.wrappedAsset.decimals, () => (N.nativeAsset.decimals)),E=_viem.parseUnits.call(void 0, t.toString(),I);await S.mutateAsync({chainId:n,accountAddress:p,amountRaw:E,writeContractAsync:m});let $={symbol:N.nativeAsset.symbol,name:N.nativeAsset.name,address:_chunkNVCIA743cjs.a,decimals:N.nativeAsset.decimals,chainId:n},_={symbol:N.wrappedAsset.symbol,name:N.wrappedAsset.name,address:N.wrappedAsset.address,decimals:N.wrappedAsset.decimals,chainId:n};h({type:"unwrap",tokens:[{asset:$,userAddress:p},{asset:_,userAddress:p}]}),g(),r("success"),a(Xe,c),await d()}catch (e8){g(),r("error")}finally{x.current=!1}}},[p,T,n,t,S,m,h,a,c,d,g]);_react.useEffect.call(void 0, ()=>{x.current||l.current||c===Xe&&s==="idle"&&T==="connected"&&(e?U():(r("success"),a(Xe,c)))},[c,s,e,T,U,a]),_react.useEffect.call(void 0, ()=>()=>g(),[g]);let M=()=>{s==="error"&&(l.current=!1,r("idle"))},y=!u&&s==="error",k=!u&&(s==="pending"||s==="idle"||s==="error"),F=y?"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-sans font-medium transition duration-150 ${y?"cursor-pointer":"cursor-not-allowed"}`,style:{backgroundColor:`color-mix(in srgb, ${F} 12%, transparent)`,border:`1px solid color-mix(in srgb, ${F} 20%, transparent)`,color:F,borderRadius:"var(--widget-radius)"},onClick:y?M: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:y?"Retry Unwrap":i?`Unwrap ${i.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:[!u&&(s==="pending"||s==="idle")&&_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.V,{size:"5"}),(u||s==="success")&&_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.P,{className:"h-8 w-8"}),y&&_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.S,{className:"h-[12px] w-[12px]"})]})]})}),k&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"inline-flex h-12 items-center justify-center px-8 text-sm font-sans 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:f,children:"Cancel"})]})},fn=Wr;var Br=15e3,Ze="wrapping",Qr=({needsToWrap:e,amount:t,chainId:n,token:i,reviewState:c,setReviewState:o,goToNextStep:a,cancel:f,delayedClose:d,isWrappingPair:u})=>{let s=_chunkNVCIA743cjs.r.call(void 0, Ze,c),[r,S]=_react.useState.call(void 0, "idle"),m=Yt(),{writeContractAsync:p}=_wagmi.useWriteContract.call(void 0, ),{address:h}=_chunk34N36GUDcjs.a.call(void 0, ),x=Ve(),l=_react.useRef.call(void 0, !1),v=_react.useRef.call(void 0, !1),T=_react.useRef.call(void 0, null),{status:g}=_wagmi.useAccount.call(void 0, ),U=_react.useCallback.call(void 0, ()=>{T.current&&(clearTimeout(T.current),T.current=null)},[]),M=_react.useCallback.call(void 0, async()=>{if(!(l.current||v.current||!h||g!=="connected")){l.current=!0,v.current=!0,S("pending"),T.current=setTimeout(()=>{l.current&&(S("error"),l.current=!1)},Br);try{let I=_chunkNVCIA743cjs.c.call(void 0, n);if(!I)throw new Error(`No config for chain ${n}`);let E=_viem.parseUnits.call(void 0, t.toString(),I.nativeAsset.decimals);await m.mutateAsync({chainId:n,accountAddress:h,amountRaw:E,writeContractAsync:p});let $={symbol:I.nativeAsset.symbol,name:I.nativeAsset.name,address:_chunkNVCIA743cjs.a,decimals:I.nativeAsset.decimals,chainId:n},_={symbol:I.wrappedAsset.symbol,name:I.wrappedAsset.name,address:I.wrappedAsset.address,decimals:I.wrappedAsset.decimals,chainId:n};x({type:"wrap",tokens:[{asset:$,userAddress:h},{asset:_,userAddress:h}]}),U(),S("success"),a(Ze,c),u&&await d()}catch (e9){U(),S("error")}finally{l.current=!1}}},[h,g,n,t,m,p,x,a,c,d,u,U]);_react.useEffect.call(void 0, ()=>{l.current||v.current||c===Ze&&r==="idle"&&g==="connected"&&(e?M():(S("success"),a(Ze,c)))},[c,r,e,g,M,a]),_react.useEffect.call(void 0, ()=>()=>U(),[U]);let y=()=>{r==="error"&&(v.current=!1,S("idle"))},k=!s&&r==="error",F=!s&&(r==="pending"||r==="idle"||r==="error"),N=k?"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-sans font-medium transition duration-150 ${k?"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:k?y: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:k?"Retry Wrap":i?`Wrap ${i.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:[!s&&(r==="pending"||r==="idle")&&_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.V,{size:"5"}),(s||r==="success")&&_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.P,{className:"h-8 w-8"}),k&&_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.S,{className:"h-[12px] w-[12px]"})]})]})}),F&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"inline-flex h-12 items-center justify-center px-8 text-sm font-sans 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:f,children:"Cancel"})]})},wn=Qr;var Sa=({base:e,baseAmount:t,quote:n,quoteAmount:i,userAddress:c,isWrappingPair:o,isUnwrappingPair:a,isBaseGasToken:f,isQuoteGasToken:d,reviewActionProps:u,reviewState:s,setReviewState:r,trackedOrderHash:S,setTrackedOrderHash:m,txStatus:p,onSwapSubmitted:h,onSwapInitiated:x,onOrderSubmitted:l,onStaleQuoteRestart:v,setExitHandler:T,setRetryHandler:g,startPolling:U,trackNativeTransaction:M})=>{let{rfqQuote:y,status:k,liquidityError:F,routingError:N,sizeCapError:I,stop:E,clear:$}=Be(),{clearForm:_}=_chunkTN27ALOVcjs.e.call(void 0, ),X=_wagmi.useChainId.call(void 0, ),{swapButtonVariant:Z,widgetType:L}=_chunkTTVEGOCZcjs.b.call(void 0, ),A=L==="compact",[W,q]=_react.useState.call(void 0, !1),Q=_react.useRef.call(void 0, !1),C=_react.useRef.call(void 0, null),w=o,O=a,P=!o&&!a,G=X!==_optionalChain([e, 'optionalAccess', _79 => _79.chainId])&&(w||O||P),de=_chunkNVCIA743cjs.c.call(void 0, e.chainId),Je={chainId:e.chainId,name:_nullishCoalesce(_optionalChain([de, 'optionalAccess', _80 => _80.displayName]), () => (`Chain ${e.chainId}`))},ae=_react.useCallback.call(void 0, (V,Oe)=>{if(Oe!==V)return;if(V==="chain"){if(w){r("wrapping");return}if(O){r("unwrapping");return}r("signingOrder");return}if(V==="signingOrder"){r("trackingTx");return}if(V==="wrapping"){if(!o){r("signingOrder");return}r("wrapSuccess");return}if(V==="unwrapping"){r("wrapSuccess");return}let Tt=_chunkNVCIA743cjs.s.call(void 0, V);Tt&&r(Tt)},[r,o,w,O,P]),H=_react.useCallback.call(void 0, ()=>G?"chain":w?"wrapping":O?"unwrapping":P?"signingOrder":null,[G,w,O,P]),ne=_react.useCallback.call(void 0, ()=>{r(null),_()},[_,r]),pe=_react.useCallback.call(void 0, async()=>{r("wrapSuccess");for(let V=0;V<3;V++)await _chunkNVCIA743cjs.t.call(void 0, 700);ne()},[ne,r]),fe=_react.useCallback.call(void 0, async()=>{$(),r("cancelled");for(let V=0;V<3;V++)await _chunkNVCIA743cjs.t.call(void 0, 500);ne()},[$,ne,r]),J=_react.useCallback.call(void 0, ()=>{S&&(_chunkTTVEGOCZcjs.d.getState().stopTracking(),$(),r(null),m(null),_())},[S,$,r,m,_]),me=_react.useCallback.call(void 0, ()=>{r(null),m(null),Q.current=!0,_optionalChain([v, 'optionalCall', _81 => _81()])},[r,m,v]),Pe=_react.useCallback.call(void 0, ()=>{u&&r(H())},[H,u,r]),be=_react.useCallback.call(void 0, (V=!1)=>{V?(Q.current=!0,r(null),_optionalChain([v, 'optionalCall', _82 => _82()])):(r(null),C.current=setTimeout(()=>{u&&(r(H()),q(!1))},100))},[r,u,H,v]);_react.useEffect.call(void 0, ()=>{s!==null&&E()},[s,E]),_react.useEffect.call(void 0, ()=>{s!==null&&W&&q(!1)},[s,W]),_react.useEffect.call(void 0, ()=>{_optionalChain([T, 'optionalCall', _83 => _83(J)])},[T,J]),_react.useEffect.call(void 0, ()=>(_chunkTTVEGOCZcjs.d.getState().setExitHandler(J),()=>_chunkTTVEGOCZcjs.d.getState().setExitHandler(null)),[J]),_react.useEffect.call(void 0, ()=>{_optionalChain([g, 'optionalCall', _84 => _84(me)])},[g,me]),_react.useEffect.call(void 0, ()=>()=>{C.current&&clearTimeout(C.current)},[]),_react.useEffect.call(void 0, ()=>{Q.current&&k==="fresh"&&_optionalChain([y, 'optionalAccess', _85 => _85.id])&&(Q.current=!1,r("signingOrder"))},[k,_optionalChain([y, 'optionalAccess', _86 => _86.id]),r]);let Te=V=>{if(!V)return{backgroundColor:Z==="default"?"var(--widget-muted)":"transparent",color:"var(--widget-muted-foreground)",border:Z!=="default"?"1px solid var(--widget-border)":"none",borderRadius:"var(--widget-radius)"};switch(Z){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)"}}},Ue=`w-full ${A?"py-2":"py-3"} text-sm font-sans font-medium transition-colors cursor-pointer mt-1`;if(s===null&&!o&&!a){if(W)return _jsxruntime.jsx.call(void 0, "button",{className:Ue,disabled:!0,style:{...Te(!1),opacity:.6,cursor:"not-allowed"},children:"Getting fresh quote..."});let V=()=>F?"Insufficient Liquidity":N?"Route Not Available":I?"Size Cap Exceeded":!y&&k==="polling"?"Getting Quote...":y?"Swap":"Enter Amount",Oe=!!u;return _jsxruntime.jsx.call(void 0, "button",{onClick:Oe?Pe:void 0,disabled:!Oe,className:`${Ue} disabled:opacity-40 disabled:cursor-not-allowed`,style:Te(Oe),children:V()})}return s===null&&a?_jsxruntime.jsx.call(void 0, "button",{onClick:u?Pe:void 0,disabled:!u,className:`${Ue} disabled:opacity-40 disabled:cursor-not-allowed`,style:Te(!!u),children:"Unwrap"}):s===null&&o?_jsxruntime.jsx.call(void 0, "button",{onClick:u?Pe:void 0,disabled:!u,className:`${Ue} disabled:opacity-40 disabled:cursor-not-allowed`,style:Te(!!u),children:"Wrap"}):s==="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 ${A?"py-2":"py-3"} text-sm font-sans 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"})}):s==="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 ${A?"py-2":"py-3"} text-sm font-sans 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:o?"Wrapped Successfully":"Unwrapped Successfully"})}):s==="cancelled"?_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col gap-2 w-full",children:_jsxruntime.jsx.call(void 0, "button",{onClick:ne,className:`w-full ${A?"py-2":"py-3"} text-sm font-sans 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:[s==="chain"&&G&&_jsxruntime.jsx.call(void 0, Jt,{requiredChain:Je,needsChainSwitch:G&&X!==e.chainId,reviewState:s,goToNextStep:ae,cancel:fe}),s==="wrapping"&&w&&_jsxruntime.jsx.call(void 0, wn,{needsToWrap:w,amount:t,chainId:e.chainId,token:e,reviewState:s,setReviewState:r,goToNextStep:ae,cancel:fe,delayedClose:pe,isWrappingPair:o}),s==="unwrapping"&&O&&_jsxruntime.jsx.call(void 0, fn,{needsToUnwrap:O,amount:t,chainId:e.chainId,token:e,reviewState:s,setReviewState:r,goToNextStep:ae,cancel:fe,delayedClose:pe}),s==="signingOrder"&&P&&_jsxruntime.jsx.call(void 0, an,{base:e,baseAmount:t,quote:n,quoteAmount:i,userAddress:c,reviewState:s,goToNextStep:ae,cancel:fe,restartSigningFlow:be,onSwapInitiated:x,onOrderSubmitted:l,isWrappingPair:o,isUnwrappingPair:a,onSwapSubmitted:h,startPolling:U,trackNativeTransaction:M}),s==="trackingTx"&&S&&_jsxruntime.jsx.call(void 0, ln,{orderHash:S,base:e,quote:n,baseAmount:t,quoteAmount:i,reviewState:s,status:p,onNewSwap:J,onRetry:me}),s&&!["chain","wrapping","unwrapping","approval","signingOrder","trackingTx","success","wrapSuccess","cancelled"].includes(s)&&_jsxruntime.jsx.call(void 0, "button",{disabled:!0,className:`w-full ${A?"py-2":"py-3"} text-sm font-sans font-medium`,style:{backgroundColor:"var(--widget-muted)",color:"var(--widget-muted-foreground)",borderRadius:"var(--widget-radius)"},children:"Processing..."})]})};function bt(e){try{let t=new URL(e).pathname.split("/"),n=t[t.length-1];return n&&n.startsWith("0x")?n:null}catch (e10){return null}}var _shallow = require('zustand/react/shallow');var vn={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)"},Yr=({status:e})=>{let t=_nullishCoalesce(vn[e], () => (vn.pending));switch(e){case"completed":return _jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.P,{className:"h-6 w-6"});case"failed":case"cancelled":return _jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.Y,{className:"h-6 w-6"});default:return _jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.V,{size:"5",color:t})}};function Xr(e){if(e===0)return"0";let t=Math.abs(e);return t>=1e9?`${(e/1e9).toFixed(2)}B`:t>=1e6?`${(e/1e6).toFixed(2)}M`:t>=1e4?`${(e/1e3).toFixed(2)}K`:t>=1e3?e.toFixed(1):t>=100?e.toFixed(2):t>=1?e.toFixed(4):e.toFixed(6)}function yn(e){let t=e.length;return t<=4?48:t<=6?40:t<=8?34:28}var Rt=()=>_jsxruntime.jsxs.call(void 0, "svg",{className:"w-3 h-3 shrink-0",style:{color:"var(--widget-secondary-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"})]}),Zr=()=>_jsxruntime.jsxs.call(void 0, "svg",{className:"w-3 h-3 shrink-0",viewBox:"0 0 195 321",fill:"var(--widget-secondary-foreground)",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"})]}),Jr=({orderHash:e,base:t,quote:n,baseAmount:i,quoteAmount:c,status:o})=>{let[a,f]=_react.useState.call(void 0, !1),[d,u]=_react.useState.call(void 0, !0),s=_react.useRef.call(void 0, null),r=_react.useRef.call(void 0, Date.now()),[S,m]=_react.useState.call(void 0, null),p=_react.useRef.call(void 0, null),{isRecipientInputOpen:h,recipient:x,explorerUrl:l}=_chunkTTVEGOCZcjs.d.call(void 0, _shallow.useShallow.call(void 0, w=>({isRecipientInputOpen:w.isRecipientInputOpen,recipient:w.recipient,explorerUrl:w.explorerUrl})));_react.useEffect.call(void 0, ()=>{o==="received"&&(s.current=Date.now())},[o]),_react.useEffect.call(void 0, ()=>{if(o==="completed"&&!S){let w=s.current||r.current;m((Date.now()-w)/1e3)}},[o,S]),_react.useEffect.call(void 0, ()=>()=>{p.current&&clearTimeout(p.current)},[]);let v=_react.useCallback.call(void 0, ()=>{if(!_optionalChain([navigator, 'access', _87 => _87.clipboard, 'optionalAccess', _88 => _88.writeText]))return;let w=l?_nullishCoalesce(bt(l), () => (e)):e;navigator.clipboard.writeText(w).then(()=>{f(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>f(!1),2e3)}).catch(()=>{})},[e,l]),T=_chunkNVCIA743cjs.o.call(void 0, i),g=_chunkNVCIA743cjs.o.call(void 0, c),U=o==="completed"||o==="failed"||o==="cancelled",M=!U,y=i&&c?i/c:0,k=y>0&&y<1,F=k?1/y:y,N=k?t:n,I=k?n:t,E=_optionalChain([t, 'optionalAccess', _89 => _89.price])?`\u2248 $${(k?t.price:t.price*y).toFixed(2)}`:"",$=_chunkNVCIA743cjs.c.call(void 0, t.chainId),_=_chunkNVCIA743cjs.c.call(void 0, n.chainId),X=_nullishCoalesce(_optionalChain([$, 'optionalAccess', _90 => _90.displayName]), () => (`Chain ${t.chainId}`)),Z=_nullishCoalesce(_optionalChain([_, 'optionalAccess', _91 => _91.displayName]), () => (`Chain ${n.chainId}`)),L=t.chainId!==n.chainId,A=_nullishCoalesce(_optionalChain([$, 'optionalAccess', _92 => _92.estimatedTimeMs]), () => (0)),W=_nullishCoalesce(_optionalChain([_, 'optionalAccess', _93 => _93.estimatedTimeMs]), () => (0)),q=(L?A+W:A)/1e3,Q=l?_nullishCoalesce(bt(l), () => (e)):e,C=`${Q.slice(0,6)} \u2026 ${Q.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, _chunkNVCIA743cjs.O,{asset:t,size:"md",noChain:!0}),_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xl font-thin 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, _chunkNVCIA743cjs.N,{chain:t.chainId,size:"xs"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs pt-0.5",style:{color:"var(--widget-muted-foreground)"},children:X})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"text-right",children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-thin tracking-tight font-sans",style:{color:"var(--widget-foreground)",fontSize:`${yn(T)}px`,transition:"font-size 0.1s ease-out"},children:T}),t.price&&_jsxruntime.jsxs.call(void 0, "p",{className:"text-xs mt-1 font-sans",style:{color:"var(--widget-muted-foreground)"},children:["$",(t.price*i).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, Yr,{status:o})})})]}),_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, _chunkNVCIA743cjs.O,{asset:n,size:"md",noChain:!0}),_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xl font-thin uppercase",style:{color:"var(--widget-foreground)"},children:n.symbol}),_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:n.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, _chunkNVCIA743cjs.N,{chain:n.chainId,size:"xs"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs pt-0.5",style:{color:"var(--widget-muted-foreground)"},children:Z})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"text-right",children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-thin tracking-tight font-sans",style:{color:"var(--widget-foreground)",fontSize:`${yn(g)}px`,transition:"font-size 0.1s ease-out"},children:g}),n.price&&_jsxruntime.jsxs.call(void 0, "p",{className:"text-xs mt-1 font-sans",style:{color:"var(--widget-muted-foreground)"},children:["$",(n.price*c).toFixed(2)]})]})]})})]}),h&&x&&_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 font-sans",style:{color:"var(--widget-foreground)"},children:[x.slice(0,6),"...",x.slice(-4)]})]})}),_jsxruntime.jsxs.call(void 0, "div",{className:"px-4 mt-4",style:{borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)"},children:[_jsxruntime.jsx.call(void 0, "div",{className:"relative box-border flex flex-row h-8 w-full items-center cursor-pointer",role:"button",tabIndex:0,onClick:()=>u(!d),onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),u(!d))},children:_jsxruntime.jsx.call(void 0, "div",{className:"flex h-full items-center w-full overflow-hidden",style:{color:"var(--widget-muted-foreground)"},children:_jsxruntime.jsxs.call(void 0, "div",{className:"translate-y-px font-sans flex w-full flex-row items-center justify-between",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-2 whitespace-nowrap",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.O,{asset:N,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:["1 ",N.symbol]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.O,{asset:I,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:[Xr(F)," ",I.symbol]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:E})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs ml-2 transition-transform duration-200 shrink-0",style:{color:"var(--widget-muted-foreground)",transform:d?"rotate(180deg)":"rotate(0deg)",display:"inline-block"},children:"\u25BE"})]})})}),_jsxruntime.jsx.call(void 0, "div",{className:"overflow-hidden transition-all duration-200",style:{maxHeight:d?"200px":"0px",opacity:d?1:0},children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1 pb-1.5 font-sans",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"USD Value"}),_jsxruntime.jsxs.call(void 0, "span",{style:{color:"var(--widget-secondary-foreground)"},children:["$",t.price?(t.price*i).toFixed(2):"\u2014"]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-muted-foreground)"},children:"Order Type"}),_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-secondary-foreground)"},children:"RFQ (Limit)"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"Transaction"}),l?_jsxruntime.jsxs.call(void 0, "a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 transition-colors hover:opacity-80",style:{color:"var(--widget-secondary-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:a?"Copied!":C}),_jsxruntime.jsx.call(void 0, Rt,{})]}):_jsxruntime.jsxs.call(void 0, "button",{type:"button",onClick:v,className:"flex items-center gap-1 cursor-pointer transition-colors",style:{color:"var(--widget-secondary-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-secondary-foreground)"},children:a?"Copied!":C}),_jsxruntime.jsx.call(void 0, Rt,{})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:U?"Speed":"Est. Time"}),_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-secondary-foreground)"},children:S?`${S.toFixed(2)}s`:q>0?`~${q}s`:"\u2014"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"Route"}),_jsxruntime.jsxs.call(void 0, "a",{href:"https://www.aori.io",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 transition-colors hover:opacity-80",style:{color:"var(--widget-secondary-foreground)"},children:[_jsxruntime.jsx.call(void 0, Zr,{}),"Aori",_jsxruntime.jsx.call(void 0, Rt,{})]})]})]})})]})]})},Ua= exports.w =Jr;exports.a = Tn; exports.b = Ve; exports.c = os; exports.d = bt; exports.e = fs; exports.f = Be; exports.g = Wn; exports.h = hs; exports.i = bs; exports.j = As; exports.k = Ps; exports.l = Fs; exports.m = Vs; exports.n = Xn; exports.o = Qt; exports.p = Zn; exports.q = dt; exports.r = Gt; exports.s = Ht; exports.t = Kt; exports.u = Yt; exports.v = Sa; exports.w = Ua;
@@ -1,2 +1,2 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
2
- var _chunkHFX3K3RGcjs = require('./chunk-HFX3K3RG.cjs');var _chunkGK3MOEYUcjs = require('./chunk-GK3MOEYU.cjs');var _chunk3PGCHNG2cjs = require('./chunk-3PGCHNG2.cjs');var _chunk4S3B2JQYcjs = require('./chunk-4S3B2JQY.cjs');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _jsxruntime = require('react/jsx-runtime');var q=()=>_jsxruntime.jsxs.call(void 0, "svg",{className:"w-3 h-3 shrink-0",style:{color:"var(--widget-secondary-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"})]}),V=()=>_jsxruntime.jsxs.call(void 0, "svg",{className:"w-3 h-3 shrink-0",viewBox:"0 0 195 321",fill:"var(--widget-secondary-foreground)",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"})]});function j(o){if(o===0)return"0";let r=Math.abs(o);return r>=1e9?`${(o/1e9).toFixed(2)}B`:r>=1e6?`${(o/1e6).toFixed(2)}M`:r>=1e4?`${(o/1e3).toFixed(2)}K`:r>=1e3?o.toFixed(1):r>=100?o.toFixed(2):r>=1?o.toFixed(4):o.toFixed(6)}var E=_react2.default.memo(()=>{let[o,r]=_react.useState.call(void 0, !1),{liquidityError:L,routingError:S}=_chunkHFX3K3RGcjs.f.call(void 0, ),{baseAmount:n,baseToken:s,quoteAmount:i,quoteToken:a}=_chunkGK3MOEYUcjs.e.call(void 0, ),{quoteLoaderVariant:f,widgetType:T}=_chunk3PGCHNG2cjs.b.call(void 0, ),p=T==="compact",l=n&&i&&parseFloat(i.toString())?parseFloat(n.toString())/parseFloat(i.toString()):0,x=l>0&&l<1,C=x?1/l:l,v=x?s:a,w=x?a:s,y=_optionalChain([s, 'optionalAccess', _2 => _2.price])?`\u2248 $${(x?s.price:s.price*l).toFixed(2)}`:"",M=s&&a&&s.chainId!==a.chainId,h=s?_nullishCoalesce(_optionalChain([_chunk4S3B2JQYcjs.c.call(void 0, s.chainId), 'optionalAccess', _3 => _3.estimatedTimeMs]), () => (0)):0,$=a?_nullishCoalesce(_optionalChain([_chunk4S3B2JQYcjs.c.call(void 0, a.chainId), 'optionalAccess', _4 => _4.estimatedTimeMs]), () => (0)):0,N=(M?h+$:h)/1e3,b=L||S,d=s&&a&&n&&parseFloat(n.toString())&&i;return _react.useEffect.call(void 0, ()=>{f==="expanded"&&d&&r(!0)},[f,d]),f==="none"?null:f==="default"?_jsxruntime.jsx.call(void 0, "div",{className:`relative box-border flex flex-row h-8 w-full items-center${p?" justify-start overflow-x-auto":" justify-center"}`,children:_jsxruntime.jsx.call(void 0, "div",{className:`flex h-full items-center${p?" min-w-max":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&a?n&&parseFloat(n.toString())?i?_jsxruntime.jsxs.call(void 0, "div",{className:"translate-y-px font-sans flex flex-row items-center gap-2 whitespace-nowrap",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunk4S3B2JQYcjs.O,{asset:v,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:["1 ",_optionalChain([v, 'optionalAccess', _5 => _5.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunk4S3B2JQYcjs.O,{asset:w,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:[j(C)," ",_optionalChain([w, 'optionalAccess', _6 => _6.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:y})]}):b?_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),_jsxruntime.jsx.call(void 0, _chunk4S3B2JQYcjs.W,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),_jsxruntime.jsx.call(void 0, _chunk4S3B2JQYcjs.W,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):_jsxruntime.jsx.call(void 0, "div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"}):_jsxruntime.jsx.call(void 0, "div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"})})}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",children:[_jsxruntime.jsx.call(void 0, "div",{className:`relative box-border flex flex-row pt-1 h-8 w-full items-center cursor-pointer${p?" overflow-x-auto":""}`,role:"button",tabIndex:0,onClick:()=>d&&r(c=>!c),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),d&&r(I=>!I))},children:_jsxruntime.jsx.call(void 0, "div",{className:`flex h-full items-center${p?" min-w-max overflow-x-auto":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&a?n&&parseFloat(n.toString())?i?_jsxruntime.jsxs.call(void 0, "div",{className:"translate-y-px font-sans flex w-full flex-row items-center justify-between",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-2 whitespace-nowrap",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunk4S3B2JQYcjs.O,{asset:v,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:["1 ",_optionalChain([v, 'optionalAccess', _7 => _7.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunk4S3B2JQYcjs.O,{asset:w,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:[j(C)," ",_optionalChain([w, 'optionalAccess', _8 => _8.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:y})]}),_jsxruntime.jsx.call(void 0, "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"})]}):b?_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),_jsxruntime.jsx.call(void 0, _chunk4S3B2JQYcjs.W,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),_jsxruntime.jsx.call(void 0, _chunk4S3B2JQYcjs.W,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):_jsxruntime.jsx.call(void 0, "div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"}):_jsxruntime.jsx.call(void 0, "div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"})})}),_jsxruntime.jsx.call(void 0, "div",{className:"overflow-hidden transition-all duration-200",style:{maxHeight:o&&d?"120px":"0px",opacity:o&&d?1:0},children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1 pb-1.5 font-sans",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"USD Value"}),_jsxruntime.jsxs.call(void 0, "span",{style:{color:"var(--widget-secondary-foreground)"},children:["$",_optionalChain([s, 'optionalAccess', _9 => _9.price])&&i?(s.price*l*parseFloat(i.toString())).toFixed(2):"\u2014"]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"Estimated Time"}),_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-secondary-foreground)"},children:N>0?`${N.toFixed(2)}s`:"\u2014"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"Order Type"}),_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-secondary-foreground)"},children:"RFQ (Limit)"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"Route"}),_jsxruntime.jsxs.call(void 0, "a",{href:"https://www.aori.io",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 transition-colors hover:opacity-80",style:{color:"var(--widget-secondary-foreground)"},children:[_jsxruntime.jsx.call(void 0, V,{}),"Aori",_jsxruntime.jsx.call(void 0, q,{})]})]})]})})]})});E.displayName="QuoteLoader";var O=E;exports.a = O;
2
+ var _chunkOPACGOVQcjs = require('./chunk-OPACGOVQ.cjs');var _chunkTN27ALOVcjs = require('./chunk-TN27ALOV.cjs');var _chunkTTVEGOCZcjs = require('./chunk-TTVEGOCZ.cjs');var _chunkNVCIA743cjs = require('./chunk-NVCIA743.cjs');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _jsxruntime = require('react/jsx-runtime');var q=()=>_jsxruntime.jsxs.call(void 0, "svg",{className:"w-3 h-3 shrink-0",style:{color:"var(--widget-secondary-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"})]}),V=()=>_jsxruntime.jsxs.call(void 0, "svg",{className:"w-3 h-3 shrink-0",viewBox:"0 0 195 321",fill:"var(--widget-secondary-foreground)",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"})]});function j(o){if(o===0)return"0";let r=Math.abs(o);return r>=1e9?`${(o/1e9).toFixed(2)}B`:r>=1e6?`${(o/1e6).toFixed(2)}M`:r>=1e4?`${(o/1e3).toFixed(2)}K`:r>=1e3?o.toFixed(1):r>=100?o.toFixed(2):r>=1?o.toFixed(4):o.toFixed(6)}var E=_react2.default.memo(()=>{let[o,r]=_react.useState.call(void 0, !1),{liquidityError:L,routingError:S}=_chunkOPACGOVQcjs.f.call(void 0, ),{baseAmount:n,baseToken:s,quoteAmount:i,quoteToken:a}=_chunkTN27ALOVcjs.e.call(void 0, ),{quoteLoaderVariant:f,widgetType:T}=_chunkTTVEGOCZcjs.b.call(void 0, ),p=T==="compact",l=n&&i&&parseFloat(i.toString())?parseFloat(n.toString())/parseFloat(i.toString()):0,x=l>0&&l<1,C=x?1/l:l,v=x?s:a,w=x?a:s,y=_optionalChain([s, 'optionalAccess', _2 => _2.price])?`\u2248 $${(x?s.price:s.price*l).toFixed(2)}`:"",M=s&&a&&s.chainId!==a.chainId,h=s?_nullishCoalesce(_optionalChain([_chunkNVCIA743cjs.c.call(void 0, s.chainId), 'optionalAccess', _3 => _3.estimatedTimeMs]), () => (0)):0,$=a?_nullishCoalesce(_optionalChain([_chunkNVCIA743cjs.c.call(void 0, a.chainId), 'optionalAccess', _4 => _4.estimatedTimeMs]), () => (0)):0,N=(M?h+$:h)/1e3,b=L||S,d=s&&a&&n&&parseFloat(n.toString())&&i;return _react.useEffect.call(void 0, ()=>{f==="expanded"&&d&&r(!0)},[f,d]),f==="none"?null:f==="default"?_jsxruntime.jsx.call(void 0, "div",{className:`relative box-border flex flex-row h-8 w-full items-center${p?" justify-start overflow-x-auto":" justify-center"}`,children:_jsxruntime.jsx.call(void 0, "div",{className:`flex h-full items-center${p?" min-w-max":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&a?n&&parseFloat(n.toString())?i?_jsxruntime.jsxs.call(void 0, "div",{className:"translate-y-px font-sans flex flex-row items-center gap-2 whitespace-nowrap",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.O,{asset:v,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:["1 ",_optionalChain([v, 'optionalAccess', _5 => _5.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.O,{asset:w,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:[j(C)," ",_optionalChain([w, 'optionalAccess', _6 => _6.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:y})]}):b?_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.W,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.W,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):_jsxruntime.jsx.call(void 0, "div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"}):_jsxruntime.jsx.call(void 0, "div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"})})}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",children:[_jsxruntime.jsx.call(void 0, "div",{className:`relative box-border flex flex-row pt-1 h-8 w-full items-center cursor-pointer${p?" overflow-x-auto":""}`,role:"button",tabIndex:0,onClick:()=>d&&r(c=>!c),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),d&&r(I=>!I))},children:_jsxruntime.jsx.call(void 0, "div",{className:`flex h-full items-center${p?" min-w-max overflow-x-auto":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&a?n&&parseFloat(n.toString())?i?_jsxruntime.jsxs.call(void 0, "div",{className:"translate-y-px font-sans flex w-full flex-row items-center justify-between",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-2 whitespace-nowrap",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.O,{asset:v,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:["1 ",_optionalChain([v, 'optionalAccess', _7 => _7.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.O,{asset:w,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:[j(C)," ",_optionalChain([w, 'optionalAccess', _8 => _8.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:y})]}),_jsxruntime.jsx.call(void 0, "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"})]}):b?_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.W,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.W,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):_jsxruntime.jsx.call(void 0, "div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"}):_jsxruntime.jsx.call(void 0, "div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"})})}),_jsxruntime.jsx.call(void 0, "div",{className:"overflow-hidden transition-all duration-200",style:{maxHeight:o&&d?"120px":"0px",opacity:o&&d?1:0},children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1 pb-1.5 font-sans",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"USD Value"}),_jsxruntime.jsxs.call(void 0, "span",{style:{color:"var(--widget-secondary-foreground)"},children:["$",_optionalChain([s, 'optionalAccess', _9 => _9.price])&&i?(s.price*l*parseFloat(i.toString())).toFixed(2):"\u2014"]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"Estimated Time"}),_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-secondary-foreground)"},children:N>0?`${N.toFixed(2)}s`:"\u2014"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"Order Type"}),_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-secondary-foreground)"},children:"RFQ (Limit)"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"Route"}),_jsxruntime.jsxs.call(void 0, "a",{href:"https://www.aori.io",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 transition-colors hover:opacity-80",style:{color:"var(--widget-secondary-foreground)"},children:[_jsxruntime.jsx.call(void 0, V,{}),"Aori",_jsxruntime.jsx.call(void 0, q,{})]})]})]})})]})});E.displayName="QuoteLoader";var O=E;exports.a = O;