@aori/mega-swap-widget 0.1.7 → 0.1.8

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 (43) hide show
  1. package/dist/AssetSelectionMenu-CYWW5K6R.js +2 -0
  2. package/dist/AssetSelectionMenu-TPSIEBBB.cjs +2 -0
  3. package/dist/ChainSelectionMenu-HFJGI6E5.js +2 -0
  4. package/dist/ChainSelectionMenu-UNMEPKRI.cjs +2 -0
  5. package/dist/{SwapFormHorizontal-DXO6F5JC.js → SwapFormHorizontal-LARQUSNO.js} +1 -1
  6. package/dist/{SwapFormHorizontal-2JDBQ4PM.cjs → SwapFormHorizontal-YL3X2UA7.cjs} +1 -1
  7. package/dist/{SwapFormSplit-C5Z6MUBP.cjs → SwapFormSplit-JT3OYCFP.cjs} +1 -1
  8. package/dist/{SwapFormSplit-FORONC7U.js → SwapFormSplit-USJFORFM.js} +1 -1
  9. package/dist/{WidgetWalletPanel-H2MQ4HNZ.cjs → WidgetWalletPanel-HH26O3HT.cjs} +1 -1
  10. package/dist/WidgetWalletPanel-VUT4LF65.js +2 -0
  11. package/dist/WidgetWalletTradeHistory-NL23HIOJ.cjs +2 -0
  12. package/dist/WidgetWalletTradeHistory-VAH2FU7S.js +2 -0
  13. package/dist/{chunk-XEB3SYOB.js → chunk-7PT7UNJY.js} +1 -1
  14. package/dist/{chunk-JC6VVDA3.cjs → chunk-CNE67IQ3.cjs} +1 -1
  15. package/dist/chunk-CT7CRJLC.js +2 -0
  16. package/dist/{chunk-TXQ6Q4S3.cjs → chunk-D7GULMHE.cjs} +1 -1
  17. package/dist/chunk-DLA3C645.cjs +2 -0
  18. package/dist/{chunk-4SV4EZY2.cjs → chunk-EKSQTNKS.cjs} +1 -1
  19. package/dist/{chunk-74M7ZIF5.js → chunk-GPT4NHM5.js} +1 -1
  20. package/dist/{chunk-IKVRF6NO.js → chunk-IKTTT66M.js} +1 -1
  21. package/dist/{chunk-T2K2NOGZ.cjs → chunk-K3RTTHBS.cjs} +3 -3
  22. package/dist/{chunk-N7IYXS4X.cjs → chunk-KI6AVCXD.cjs} +1 -1
  23. package/dist/{chunk-3AQO6NMO.js → chunk-LSB5IXLW.js} +1 -1
  24. package/dist/{chunk-T2JA5EHN.cjs → chunk-PSCWQFVY.cjs} +1 -1
  25. package/dist/{chunk-DUMYILH6.js → chunk-QAOZRRSH.js} +3 -3
  26. package/dist/{chunk-EDQ3SNQJ.cjs → chunk-TWVI6PZS.cjs} +1 -1
  27. package/dist/{chunk-BJXIGJVO.js → chunk-UHG7ZIWD.js} +1 -1
  28. package/dist/{chunk-565H4OUG.js → chunk-UR3Q7FG5.js} +1 -1
  29. package/dist/{chunk-I7TSQM4Y.cjs → chunk-WZCWYOCN.cjs} +1 -1
  30. package/dist/{chunk-2UW2RRTC.js → chunk-YO5D6L5W.js} +1 -1
  31. package/dist/index.cjs +2 -2
  32. package/dist/index.css +1 -1
  33. package/dist/index.js +2 -2
  34. package/package.json +1 -1
  35. package/dist/AssetSelectionMenu-2ILVPQBL.js +0 -2
  36. package/dist/AssetSelectionMenu-VK275DDY.cjs +0 -2
  37. package/dist/ChainSelectionMenu-2B6QTSXZ.cjs +0 -2
  38. package/dist/ChainSelectionMenu-UYQJ6BP3.js +0 -2
  39. package/dist/WidgetWalletPanel-5EAZBMPR.js +0 -2
  40. package/dist/WidgetWalletTradeHistory-M4RTYZPY.js +0 -2
  41. package/dist/WidgetWalletTradeHistory-VUR6C4BW.cjs +0 -2
  42. package/dist/chunk-GIWNS54F.cjs +0 -2
  43. package/dist/chunk-K5X3YHME.js +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 _chunkGIWNS54Fcjs = require('./chunk-GIWNS54F.cjs');var _chunkT2JA5EHNcjs = require('./chunk-T2JA5EHN.cjs');var _chunkTXQ6Q4S3cjs = require('./chunk-TXQ6Q4S3.cjs');var _chunkT2K2NOGZcjs = require('./chunk-T2K2NOGZ.cjs');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _jsxruntime = require('react/jsx-runtime');var I=()=>_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"})]}),Q=()=>_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 N(o){if(o===0)return"0";let a=Math.abs(o);return a>=1e4?o.toFixed(0):a>=1e3?o.toFixed(1):a>=100?o.toFixed(2):a>=1?o.toFixed(4):a>=.01?o.toFixed(6):o.toExponential(3)}var b=_react2.default.memo(()=>{let[o,a]=_react.useState.call(void 0, !1),{liquidityError:k,routingError:F}=_chunkGIWNS54Fcjs.e.call(void 0, ),{baseAmount:n,baseToken:s,quoteAmount:i,quoteToken:r}=_chunkT2JA5EHNcjs.e.call(void 0, ),{quoteLoaderVariant:f,widgetType:E}=_chunkTXQ6Q4S3cjs.b.call(void 0, ),p=E==="compact",d=n&&i&&parseFloat(i.toString())?parseFloat(n.toString())/parseFloat(i.toString()):0,j=s&&r&&s.chainId!==r.chainId,v=s?_nullishCoalesce(_optionalChain([_chunkT2K2NOGZcjs.c.call(void 0, s.chainId), 'optionalAccess', _ => _.estimatedTimeMs]), () => (0)):0,S=r?_nullishCoalesce(_optionalChain([_chunkT2K2NOGZcjs.c.call(void 0, r.chainId), 'optionalAccess', _2 => _2.estimatedTimeMs]), () => (0)):0,w=(j?v+S:v)/1e3,g=k||F,l=s&&r&&n&&parseFloat(n.toString())&&i;return _react.useEffect.call(void 0, ()=>{f==="expanded"&&l&&a(!0)},[f,l]),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&&r?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, _chunkT2K2NOGZcjs.N,{asset:r,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([r, 'optionalAccess', _3 => _3.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, _chunkT2K2NOGZcjs.N,{asset:s,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:[N(d)," ",_optionalChain([s, 'optionalAccess', _4 => _4.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:_optionalChain([s, 'optionalAccess', _5 => _5.price])?`\u2248 $${(s.price*d).toFixed(2)}`:""})]}):g?_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, _chunkT2K2NOGZcjs.V,{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, _chunkT2K2NOGZcjs.V,{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:()=>l&&a(c=>!c),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),l&&a(L=>!L))},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&&r?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, _chunkT2K2NOGZcjs.N,{asset:r,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([r, 'optionalAccess', _6 => _6.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, _chunkT2K2NOGZcjs.N,{asset:s,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:[N(d)," ",_optionalChain([s, 'optionalAccess', _7 => _7.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:_optionalChain([s, 'optionalAccess', _8 => _8.price])?`\u2248 $${(s.price*d).toFixed(2)}`:""})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs ml-2 transition-transform duration-200 shrink-0",style:{color:"var(--widget-muted-foreground)",transform:o?"rotate(180deg)":"rotate(0deg)",display:"inline-block"},children:"\u25BE"})]}):g?_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, _chunkT2K2NOGZcjs.V,{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, _chunkT2K2NOGZcjs.V,{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&&l?"120px":"0px",opacity:o&&l?1:0},children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1 pb-1 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*d*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:w>0?`${w.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, Q,{}),"Aori",_jsxruntime.jsx.call(void 0, I,{})]})]})]})})]})});b.displayName="QuoteLoader";var D=b;exports.a = D;
2
+ var _chunkDLA3C645cjs = require('./chunk-DLA3C645.cjs');var _chunkPSCWQFVYcjs = require('./chunk-PSCWQFVY.cjs');var _chunkD7GULMHEcjs = require('./chunk-D7GULMHE.cjs');var _chunkK3RTTHBScjs = require('./chunk-K3RTTHBS.cjs');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _jsxruntime = require('react/jsx-runtime');var I=()=>_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"})]}),Q=()=>_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 N(o){if(o===0)return"0";let a=Math.abs(o);return a>=1e4?o.toFixed(0):a>=1e3?o.toFixed(1):a>=100?o.toFixed(2):a>=1?o.toFixed(4):a>=.01?o.toFixed(6):o.toExponential(3)}var b=_react2.default.memo(()=>{let[o,a]=_react.useState.call(void 0, !1),{liquidityError:k,routingError:F}=_chunkDLA3C645cjs.e.call(void 0, ),{baseAmount:n,baseToken:s,quoteAmount:i,quoteToken:r}=_chunkPSCWQFVYcjs.e.call(void 0, ),{quoteLoaderVariant:f,widgetType:E}=_chunkD7GULMHEcjs.b.call(void 0, ),p=E==="compact",d=n&&i&&parseFloat(i.toString())?parseFloat(n.toString())/parseFloat(i.toString()):0,j=s&&r&&s.chainId!==r.chainId,v=s?_nullishCoalesce(_optionalChain([_chunkK3RTTHBScjs.c.call(void 0, s.chainId), 'optionalAccess', _ => _.estimatedTimeMs]), () => (0)):0,S=r?_nullishCoalesce(_optionalChain([_chunkK3RTTHBScjs.c.call(void 0, r.chainId), 'optionalAccess', _2 => _2.estimatedTimeMs]), () => (0)):0,w=(j?v+S:v)/1e3,g=k||F,l=s&&r&&n&&parseFloat(n.toString())&&i;return _react.useEffect.call(void 0, ()=>{f==="expanded"&&l&&a(!0)},[f,l]),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&&r?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, _chunkK3RTTHBScjs.O,{asset:r,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([r, 'optionalAccess', _3 => _3.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, _chunkK3RTTHBScjs.O,{asset:s,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:[N(d)," ",_optionalChain([s, 'optionalAccess', _4 => _4.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:_optionalChain([s, 'optionalAccess', _5 => _5.price])?`\u2248 $${(s.price*d).toFixed(2)}`:""})]}):g?_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, _chunkK3RTTHBScjs.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, _chunkK3RTTHBScjs.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:()=>l&&a(c=>!c),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),l&&a(L=>!L))},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&&r?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, _chunkK3RTTHBScjs.O,{asset:r,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([r, 'optionalAccess', _6 => _6.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, _chunkK3RTTHBScjs.O,{asset:s,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:[N(d)," ",_optionalChain([s, 'optionalAccess', _7 => _7.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:_optionalChain([s, 'optionalAccess', _8 => _8.price])?`\u2248 $${(s.price*d).toFixed(2)}`:""})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs ml-2 transition-transform duration-200 shrink-0",style:{color:"var(--widget-muted-foreground)",transform:o?"rotate(180deg)":"rotate(0deg)",display:"inline-block"},children:"\u25BE"})]}):g?_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, _chunkK3RTTHBScjs.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, _chunkK3RTTHBScjs.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&&l?"120px":"0px",opacity:o&&l?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*d*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:w>0?`${w.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, Q,{}),"Aori",_jsxruntime.jsx.call(void 0, I,{})]})]})]})})]})});b.displayName="QuoteLoader";var D=b;exports.a = D;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{B as E,E as N,N as A,o as R,p as W}from"./chunk-DUMYILH6.js";import{a as S}from"./chunk-46H44R7V.js";import{useCallback as se,useRef as oe,useState as ne}from"react";import{useCallback as M,useEffect as Q,useMemo as Z,useRef as z,useState as w}from"react";var O="https://api.aori.io",b=50,G=100,D="0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",U="megaeth";function K(e,s){let o=N(e.inputChain),r=N(e.outputChain),u=o?s(o,e.inputToken)??null:null,c=r?s(r,e.outputToken)??null:null;return{orderHash:e.orderHash,quoteId:e.orderHash,status:e.status.toLowerCase(),eventType:e.status.toLowerCase(),inputToken:e.inputToken,inputAmount:e.inputAmount,inputChain:e.inputChain,outputToken:e.outputToken,outputAmount:e.outputAmount,outputChain:e.outputChain,timestamp:e.timestamp,createdAt:e.startTime,srcTx:e.srcTx,dstTx:e.dstTx,explorerUrl:`https://aoriscan.io/order/${e.orderHash}`,enrichedTokens:{base:u,quote:c}}}function P(e,s){let{getToken:o}=E(),[r,u]=w([]),[c,f]=w(!1),[p,h]=w(null),[d,m]=w(b),n=z(null),i=M(async()=>{if(!e)return;n.current?.abort();let g=new AbortController;n.current=g,f(!0),h(null);try{let y={offerer:e,limit:String(G),page:"0"},[L,I]=await Promise.all([fetch(`${O}/data/query?${new URLSearchParams({...y,inputChain:U,inputToken:D})}`,{signal:g.signal}),fetch(`${O}/data/query?${new URLSearchParams({...y,outputChain:U,outputToken:D})}`,{signal:g.signal})]),_=L?.ok?await L.json():null,$=I?.ok?await I.json():null,H=new Set,C=[];for(let x of[..._?.orders??[],...$?.orders??[]])H.has(x.orderHash)||(H.add(x.orderHash),C.push(x));C.sort((x,V)=>V.timestamp-x.timestamp),u(C),m(b)}catch(y){if(y?.name==="AbortError")return;h(y?.message??"Failed to load order history")}finally{g.signal.aborted||f(!1)}},[e]);Q(()=>{if(!s||!e){u([]),m(b);return}return i(),()=>n.current?.abort()},[s,e,i]);let v=d<r.length,q=M(async()=>{v&&m(g=>Math.min(g+b,r.length))},[v,r.length]);return{orders:Z(()=>r.slice(0,d).map(g=>K(g,o)),[r,d,o]),isLoading:c,error:p,hasMore:v,loadMore:q,totalOrders:r.length}}import{useState as X}from"react";import{jsx as t,jsxs as l}from"react/jsx-runtime";var J=()=>l("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[t("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),t("path",{d:"M3 5.2L4.3 6.5L7 3.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Y=()=>l("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[t("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),t("path",{d:"M3.5 3.5L6.5 6.5M6.5 3.5L3.5 6.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),ee=()=>l("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[t("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),t("path",{d:"M5 3V5.5L6.5 6.5",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"})]}),F=()=>l("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[t("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),t("circle",{cx:"5",cy:"5",r:"1.5",fill:"currentColor"})]}),te=e=>{switch((e||"").toLowerCase()){case"completed":case"settled":case"success":case"swapped":case"swap":return{icon:t(J,{}),color:"var(--widget-primary)"};case"received":return{icon:t(F,{}),color:"var(--widget-accent)"};case"failed":case"error":case"expired":return{icon:t(Y,{}),color:"var(--widget-destructive)"};case"pending":case"created":case"placed":return{icon:t(ee,{}),color:"var(--widget-muted-foreground)"};default:return{icon:t(F,{}),color:"var(--widget-muted-foreground)"}}},re=e=>{switch((e||"").toLowerCase()){case"completed":case"settled":case"success":case"swapped":case"swap":return"color-mix(in srgb, var(--widget-primary) 5%, transparent)";case"failed":case"error":case"expired":return"color-mix(in srgb, var(--widget-destructive) 5%, transparent)";case"pending":case"created":case"placed":return"color-mix(in srgb, var(--widget-accent) 5%, transparent)";default:return"var(--widget-secondary)"}},k=(e,s)=>{try{let o=parseFloat(e||"0");if(isNaN(o)||o===0)return"0";let r=s?.decimals??18;return R(o/10**r)}catch{return"0"}},B=({order:e,baseToken:s,quoteToken:o})=>{let[r,u]=X(!1),c=e?.status||e?.eventType||"unknown",{icon:f,color:p}=te(c),d=(i=>{if(!i)return{date:"",time:""};let v=new Date(typeof i=="number"?i:Number(i)||i);return{date:v.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),time:v.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",timeZone:"UTC",hour12:!1})+" UTC"}})(e?.timestamp||e?.createdAt||""),m=s?{asset:s,symbol:s.symbol,amount:k(e?.inputAmount,s)}:{asset:null,symbol:(e?.inputToken||"").slice(0,6)+"...",amount:k(e?.inputAmount,null)},n=o?{asset:o,symbol:o.symbol,amount:k(e?.outputAmount,o)}:{asset:null,symbol:(e?.outputToken||"").slice(0,6)+"...",amount:k(e?.outputAmount,null)};return l("a",{href:e?.explorerUrl||"#",target:"_blank",rel:"noopener noreferrer",className:"group flex flex-col cursor-pointer transition-all duration-200 ease-in-out no-underline",style:{border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:r?re(c):"transparent",marginBottom:"0.5rem",padding:"0.25rem"},onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),children:[l("div",{className:"flex flex-row items-center justify-between space-x-1",children:[l("div",{className:"flex flex-row items-center space-x-1",children:[t("div",{className:"-translate-y-px",style:{color:p},children:f}),t("p",{className:"text-2xs font-sans uppercase",style:{color:p},children:c})]}),l("div",{className:"flex flex-row items-center space-x-2",children:[l("span",{className:"text-2xs font-sans",style:{color:r?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:["\xAC ",W(e?.quoteId||e?.orderHash||"")]}),t("svg",{className:"w-2.5 -translate-y-px opacity-70 group-hover:rotate-[-45deg] group-hover:opacity-100 duration-200",style:{color:"var(--widget-foreground)"},viewBox:"0 0 684 684",fill:"none",children:t("path",{d:"M0.666687 384.667L519.92 384.667L281.627 622.96L342 683.333L683.333 342L342 0.666687L281.627 61.04L519.92 299.333L0.666687 299.333V384.667Z",fill:"currentColor"})})]})]}),l("div",{className:"flex flex-row items-center justify-between pr-2",style:{backgroundColor:r?"transparent":"var(--widget-secondary)"},children:[t("div",{className:"flex flex-col w-full h-full p-2",children:t("div",{className:"flex h-8 w-full items-center justify-between px-2",children:l("div",{className:"flex items-center space-x-1",children:[t(A,{asset:m.asset,size:"xs",className:"h-3 w-3"}),l("div",{className:"flex flex-col",children:[t("span",{className:"text-sm h-4",style:{color:"var(--widget-muted-foreground)"},children:m.amount}),t("span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:m.symbol})]}),t("span",{className:"px-1",style:{color:"var(--widget-muted-foreground)"},children:"\u2192"}),t(A,{asset:n.asset,size:"xs",className:"h-3 w-3"}),l("div",{className:"flex flex-col",children:[t("span",{className:"text-sm h-4",style:{color:"var(--widget-muted-foreground)"},children:n.amount}),t("span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:n.symbol})]})]})})}),l("div",{className:"flex flex-col items-end text-right shrink-0",children:[t("span",{className:"text-2xs font-sans whitespace-nowrap",style:{color:"var(--widget-muted-foreground)"},children:d.date}),d.time&&t("span",{className:"text-2xs font-sans whitespace-nowrap",style:{color:"var(--widget-muted-foreground)",opacity:.6},children:d.time})]})]})]})};import{Fragment as ae,jsx as a,jsxs as T}from"react/jsx-runtime";var j=()=>T("div",{className:"mt-2 flex flex-col",style:{height:"4rem",border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:"var(--widget-secondary)"},children:[T("div",{className:"flex items-center space-x-2 p-2",children:[a("div",{className:"h-4 w-4 rounded",style:{backgroundColor:"var(--widget-muted)"}}),a("div",{className:"h-3 w-24 rounded",style:{backgroundColor:"var(--widget-muted)"}})]}),T("div",{className:"flex h-8 w-full items-center justify-between px-4",children:[a("div",{className:"flex items-center space-x-1",children:[4,16,10,4,16,10].map((e,s)=>a("div",{className:"h-3 rounded",style:{width:`${e*4}px`,backgroundColor:"var(--widget-muted)"}},s))}),a("div",{className:"h-3 w-10 rounded",style:{backgroundColor:"var(--widget-muted)"}})]})]}),be=({isActive:e})=>{let{address:s}=S(),{orders:o,isLoading:r,error:u,hasMore:c,loadMore:f}=P(s,e),[p,h]=ne(!1),d=oe(null),m=se(async n=>{let i=n.currentTarget;if(i.scrollTop+i.clientHeight>=i.scrollHeight-100&&!r&&!p&&c){h(!0);try{await f()}finally{h(!1)}}},[r,p,c,f]);return s?u?a("div",{className:"flex items-center justify-center p-4",children:a("p",{className:"text-sm",style:{color:"var(--widget-destructive)"},children:"Error loading activity"})}):a("div",{ref:d,className:"flex flex-col flex-1 min-h-0 overflow-y-auto p-2",onScroll:m,style:{backgroundColor:"transparent"},children:r?Array.from({length:5}).map((n,i)=>a(j,{},i)):o.length===0?a("div",{className:"flex flex-col items-center justify-center h-full p-6",children:a("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"No Activity"})}):T(ae,{children:[o.map(n=>a(B,{order:n,baseToken:n.enrichedTokens?.base??null,quoteToken:n.enrichedTokens?.quote??null},n.orderHash)),p&&a(j,{})]})}):a("div",{className:"flex items-center justify-center p-4",children:a("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Connect your wallet to view activity"})})};export{be as a};
2
+ import{B as E,E as N,O as A,o as R,p as W}from"./chunk-QAOZRRSH.js";import{a as S}from"./chunk-46H44R7V.js";import{useCallback as se,useRef as oe,useState as ne}from"react";import{useCallback as M,useEffect as Q,useMemo as Z,useRef as z,useState as w}from"react";var O="https://api.aori.io",b=50,G=100,D="0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",U="megaeth";function K(e,s){let o=N(e.inputChain),r=N(e.outputChain),u=o?s(o,e.inputToken)??null:null,c=r?s(r,e.outputToken)??null:null;return{orderHash:e.orderHash,quoteId:e.orderHash,status:e.status.toLowerCase(),eventType:e.status.toLowerCase(),inputToken:e.inputToken,inputAmount:e.inputAmount,inputChain:e.inputChain,outputToken:e.outputToken,outputAmount:e.outputAmount,outputChain:e.outputChain,timestamp:e.timestamp,createdAt:e.startTime,srcTx:e.srcTx,dstTx:e.dstTx,explorerUrl:`https://aoriscan.io/order/${e.orderHash}`,enrichedTokens:{base:u,quote:c}}}function P(e,s){let{getToken:o}=E(),[r,u]=w([]),[c,f]=w(!1),[p,h]=w(null),[d,m]=w(b),n=z(null),i=M(async()=>{if(!e)return;n.current?.abort();let g=new AbortController;n.current=g,f(!0),h(null);try{let y={offerer:e,limit:String(G),page:"0"},[L,I]=await Promise.all([fetch(`${O}/data/query?${new URLSearchParams({...y,inputChain:U,inputToken:D})}`,{signal:g.signal}),fetch(`${O}/data/query?${new URLSearchParams({...y,outputChain:U,outputToken:D})}`,{signal:g.signal})]),_=L?.ok?await L.json():null,$=I?.ok?await I.json():null,H=new Set,C=[];for(let x of[..._?.orders??[],...$?.orders??[]])H.has(x.orderHash)||(H.add(x.orderHash),C.push(x));C.sort((x,V)=>V.timestamp-x.timestamp),u(C),m(b)}catch(y){if(y?.name==="AbortError")return;h(y?.message??"Failed to load order history")}finally{g.signal.aborted||f(!1)}},[e]);Q(()=>{if(!s||!e){u([]),m(b);return}return i(),()=>n.current?.abort()},[s,e,i]);let v=d<r.length,q=M(async()=>{v&&m(g=>Math.min(g+b,r.length))},[v,r.length]);return{orders:Z(()=>r.slice(0,d).map(g=>K(g,o)),[r,d,o]),isLoading:c,error:p,hasMore:v,loadMore:q,totalOrders:r.length}}import{useState as X}from"react";import{jsx as t,jsxs as l}from"react/jsx-runtime";var J=()=>l("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[t("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),t("path",{d:"M3 5.2L4.3 6.5L7 3.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Y=()=>l("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[t("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),t("path",{d:"M3.5 3.5L6.5 6.5M6.5 3.5L3.5 6.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),ee=()=>l("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[t("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),t("path",{d:"M5 3V5.5L6.5 6.5",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"})]}),F=()=>l("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[t("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),t("circle",{cx:"5",cy:"5",r:"1.5",fill:"currentColor"})]}),te=e=>{switch((e||"").toLowerCase()){case"completed":case"settled":case"success":case"swapped":case"swap":return{icon:t(J,{}),color:"var(--widget-primary)"};case"received":return{icon:t(F,{}),color:"var(--widget-accent)"};case"failed":case"error":case"expired":return{icon:t(Y,{}),color:"var(--widget-destructive)"};case"pending":case"created":case"placed":return{icon:t(ee,{}),color:"var(--widget-muted-foreground)"};default:return{icon:t(F,{}),color:"var(--widget-muted-foreground)"}}},re=e=>{switch((e||"").toLowerCase()){case"completed":case"settled":case"success":case"swapped":case"swap":return"color-mix(in srgb, var(--widget-primary) 5%, transparent)";case"failed":case"error":case"expired":return"color-mix(in srgb, var(--widget-destructive) 5%, transparent)";case"pending":case"created":case"placed":return"color-mix(in srgb, var(--widget-accent) 5%, transparent)";default:return"var(--widget-secondary)"}},k=(e,s)=>{try{let o=parseFloat(e||"0");if(isNaN(o)||o===0)return"0";let r=s?.decimals??18;return R(o/10**r)}catch{return"0"}},B=({order:e,baseToken:s,quoteToken:o})=>{let[r,u]=X(!1),c=e?.status||e?.eventType||"unknown",{icon:f,color:p}=te(c),d=(i=>{if(!i)return{date:"",time:""};let v=new Date(typeof i=="number"?i:Number(i)||i);return{date:v.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),time:v.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",timeZone:"UTC",hour12:!1})+" UTC"}})(e?.timestamp||e?.createdAt||""),m=s?{asset:s,symbol:s.symbol,amount:k(e?.inputAmount,s)}:{asset:null,symbol:(e?.inputToken||"").slice(0,6)+"...",amount:k(e?.inputAmount,null)},n=o?{asset:o,symbol:o.symbol,amount:k(e?.outputAmount,o)}:{asset:null,symbol:(e?.outputToken||"").slice(0,6)+"...",amount:k(e?.outputAmount,null)};return l("a",{href:e?.explorerUrl||"#",target:"_blank",rel:"noopener noreferrer",className:"group flex flex-col cursor-pointer transition-all duration-200 ease-in-out no-underline",style:{border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:r?re(c):"transparent",marginBottom:"0.5rem",padding:"0.25rem"},onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),children:[l("div",{className:"flex flex-row items-center justify-between space-x-1",children:[l("div",{className:"flex flex-row items-center space-x-1",children:[t("div",{className:"-translate-y-px",style:{color:p},children:f}),t("p",{className:"text-2xs font-sans uppercase",style:{color:p},children:c})]}),l("div",{className:"flex flex-row items-center space-x-2",children:[l("span",{className:"text-2xs font-sans",style:{color:r?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:["\xAC ",W(e?.quoteId||e?.orderHash||"")]}),t("svg",{className:"w-2.5 -translate-y-px opacity-70 group-hover:rotate-[-45deg] group-hover:opacity-100 duration-200",style:{color:"var(--widget-foreground)"},viewBox:"0 0 684 684",fill:"none",children:t("path",{d:"M0.666687 384.667L519.92 384.667L281.627 622.96L342 683.333L683.333 342L342 0.666687L281.627 61.04L519.92 299.333L0.666687 299.333V384.667Z",fill:"currentColor"})})]})]}),l("div",{className:"flex flex-row items-center justify-between pr-2",style:{backgroundColor:r?"transparent":"var(--widget-secondary)"},children:[t("div",{className:"flex flex-col w-full h-full p-2",children:t("div",{className:"flex h-8 w-full items-center justify-between px-2",children:l("div",{className:"flex items-center space-x-1",children:[t(A,{asset:m.asset,size:"xs",className:"h-3 w-3"}),l("div",{className:"flex flex-col",children:[t("span",{className:"text-sm h-4",style:{color:"var(--widget-muted-foreground)"},children:m.amount}),t("span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:m.symbol})]}),t("span",{className:"px-1",style:{color:"var(--widget-muted-foreground)"},children:"\u2192"}),t(A,{asset:n.asset,size:"xs",className:"h-3 w-3"}),l("div",{className:"flex flex-col",children:[t("span",{className:"text-sm h-4",style:{color:"var(--widget-muted-foreground)"},children:n.amount}),t("span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:n.symbol})]})]})})}),l("div",{className:"flex flex-col items-end text-right shrink-0",children:[t("span",{className:"text-2xs font-sans whitespace-nowrap",style:{color:"var(--widget-muted-foreground)"},children:d.date}),d.time&&t("span",{className:"text-2xs font-sans whitespace-nowrap",style:{color:"var(--widget-muted-foreground)",opacity:.6},children:d.time})]})]})]})};import{Fragment as ae,jsx as a,jsxs as T}from"react/jsx-runtime";var j=()=>T("div",{className:"mt-2 flex flex-col",style:{height:"4rem",border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:"var(--widget-secondary)"},children:[T("div",{className:"flex items-center space-x-2 p-2",children:[a("div",{className:"h-4 w-4 rounded",style:{backgroundColor:"var(--widget-muted)"}}),a("div",{className:"h-3 w-24 rounded",style:{backgroundColor:"var(--widget-muted)"}})]}),T("div",{className:"flex h-8 w-full items-center justify-between px-4",children:[a("div",{className:"flex items-center space-x-1",children:[4,16,10,4,16,10].map((e,s)=>a("div",{className:"h-3 rounded",style:{width:`${e*4}px`,backgroundColor:"var(--widget-muted)"}},s))}),a("div",{className:"h-3 w-10 rounded",style:{backgroundColor:"var(--widget-muted)"}})]})]}),be=({isActive:e})=>{let{address:s}=S(),{orders:o,isLoading:r,error:u,hasMore:c,loadMore:f}=P(s,e),[p,h]=ne(!1),d=oe(null),m=se(async n=>{let i=n.currentTarget;if(i.scrollTop+i.clientHeight>=i.scrollHeight-100&&!r&&!p&&c){h(!0);try{await f()}finally{h(!1)}}},[r,p,c,f]);return s?u?a("div",{className:"flex items-center justify-center p-4",children:a("p",{className:"text-sm",style:{color:"var(--widget-destructive)"},children:"Error loading activity"})}):a("div",{ref:d,className:"flex flex-col flex-1 min-h-0 overflow-y-auto p-2",onScroll:m,style:{backgroundColor:"transparent"},children:r?Array.from({length:5}).map((n,i)=>a(j,{},i)):o.length===0?a("div",{className:"flex flex-col items-center justify-center h-full p-6",children:a("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"No Activity"})}):T(ae,{children:[o.map(n=>a(B,{order:n,baseToken:n.enrichedTokens?.base??null,quoteToken:n.enrichedTokens?.quote??null},n.orderHash)),p&&a(j,{})]})}):a("div",{className:"flex items-center justify-center p-4",children:a("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Connect your wallet to view activity"})})};export{be as a};
@@ -1,2 +1,2 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
2
- var _chunkTXQ6Q4S3cjs = require('./chunk-TXQ6Q4S3.cjs');var _chunkT2K2NOGZcjs = require('./chunk-T2K2NOGZ.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');var _zustand = require('zustand');var _react = require('react');var F=_zustand.create.call(void 0, )(c=>({baseToken:null,quoteToken:null,setBaseTokenDirect:i=>c({baseToken:i}),setQuoteTokenDirect:i=>c({quoteToken:i}),swapTokensDirect:()=>c(i=>({baseToken:i.quoteToken,quoteToken:i.baseToken}))}));function G(c){let{data:i,isLoading:m}=_chunkT2K2NOGZcjs.z.call(void 0, ),o=F(),f=_react.useRef.call(void 0, !1),e=_nullishCoalesce(_optionalChain([c, 'optionalAccess', _2 => _2.defaultBaseToken]), () => (null)),r=_nullishCoalesce(_optionalChain([c, 'optionalAccess', _3 => _3.defaultQuoteToken]), () => (null));_react.useEffect.call(void 0, ()=>{if(!i||i.length===0||f.current)return;f.current=!0;let u=T=>_nullishCoalesce(i.find(p=>p.chainId===T.chainId&&p.address.toLowerCase()===T.address.toLowerCase()), () => (null)),a=e?u(e):null,l=r?u(r):null;a&&l&&a.chainId===l.chainId&&a.address.toLowerCase()===l.address.toLowerCase()?(o.setBaseTokenDirect(a),o.setQuoteTokenDirect(null)):(o.setBaseTokenDirect(a),o.setQuoteTokenDirect(l))},[i,e,r,o]);let A=_react.useCallback.call(void 0, u=>{if(!u){o.setBaseTokenDirect(null);return}let a=F.getState();a.quoteToken&&u.chainId===a.quoteToken.chainId&&u.address.toLowerCase()===a.quoteToken.address.toLowerCase()?o.swapTokensDirect():o.setBaseTokenDirect(u)},[o]),S=_react.useCallback.call(void 0, u=>{if(!u){o.setQuoteTokenDirect(null);return}let a=F.getState();a.baseToken&&u.chainId===a.baseToken.chainId&&u.address.toLowerCase()===a.baseToken.address.toLowerCase()?o.swapTokensDirect():o.setQuoteTokenDirect(u)},[o]),h=_react.useCallback.call(void 0, ()=>{o.swapTokensDirect()},[o]);return{baseToken:o.baseToken,quoteToken:o.quoteToken,setBaseToken:A,setQuoteToken:S,swapTokens:h,isLoading:m}}var _viem = require('viem');var _shallow = require('zustand/react/shallow');var M=(c,i,m,o)=>{let{address:f}=_chunk34N36GUDcjs.a.call(void 0, ),{baseToken:e,quoteToken:r,setBaseToken:A,setQuoteToken:S,swapTokens:h,isLoading:u}=G({defaultBaseToken:c,defaultQuoteToken:i}),{baseAmount:a,quoteAmount:l,setBaseAmount:T,setQuoteAmount:p,clearAmounts:v}=_chunkTXQ6Q4S3cjs.d.call(void 0, _shallow.useShallow.call(void 0, t=>({baseAmount:t.baseAmount,quoteAmount:t.quoteAmount,setBaseAmount:t.setBaseAmount,setQuoteAmount:t.setQuoteAmount,clearAmounts:t.clearAmounts}))),{data:y}=_chunkT2K2NOGZcjs.A.call(void 0, _optionalChain([e, 'optionalAccess', _4 => _4.address]),_optionalChain([e, 'optionalAccess', _5 => _5.chainId])),{data:P}=_chunkT2K2NOGZcjs.A.call(void 0, _optionalChain([r, 'optionalAccess', _6 => _6.address]),_optionalChain([r, 'optionalAccess', _7 => _7.chainId])),n=_react.useMemo.call(void 0, ()=>{if(!e)return null;let t=_nullishCoalesce(_optionalChain([y, 'optionalAccess', _8 => _8.price]), () => (e.price));return t===e.price?e:{...e,price:t}},[e,_optionalChain([y, 'optionalAccess', _9 => _9.price])]),s=_react.useMemo.call(void 0, ()=>{if(!r)return null;let t=_nullishCoalesce(_optionalChain([P, 'optionalAccess', _10 => _10.price]), () => (r.price));return t===r.price?r:{...r,price:t}},[r,_optionalChain([P, 'optionalAccess', _11 => _11.price])]),{baseBalance:B,quoteBalance:b,isLoading:R}=_chunkT2K2NOGZcjs.K.call(void 0, f,n,s),g=_react.useMemo.call(void 0, ()=>!B||B.raw==="0"?null:B,[B]),I=_react.useMemo.call(void 0, ()=>!b||b.raw==="0"?null:b,[b]),q=_react.useMemo.call(void 0, ()=>{if(!_optionalChain([n, 'optionalAccess', _12 => _12.chainId]))return!1;let t=_chunkT2K2NOGZcjs.c.call(void 0, n.chainId);return n.address.toLowerCase()===_optionalChain([t, 'optionalAccess', _13 => _13.gasToken, 'access', _14 => _14.address, 'optionalAccess', _15 => _15.toLowerCase, 'call', _16 => _16()])},[n]),L=_react.useMemo.call(void 0, ()=>{if(!_optionalChain([s, 'optionalAccess', _17 => _17.chainId]))return!1;let t=_chunkT2K2NOGZcjs.c.call(void 0, s.chainId);return s.address.toLowerCase()===_optionalChain([t, 'optionalAccess', _18 => _18.gasToken, 'access', _19 => _19.address, 'optionalAccess', _20 => _20.toLowerCase, 'call', _21 => _21()])},[s]),O=_react.useMemo.call(void 0, ()=>{if(!q||!_optionalChain([n, 'optionalAccess', _22 => _22.chainId])||!s||n.chainId!==s.chainId||n.chainId===988)return!1;let t=_chunkT2K2NOGZcjs.c.call(void 0, n.chainId);return s.address.toLowerCase()===_optionalChain([t, 'optionalAccess', _23 => _23.wrappedAsset, 'access', _24 => _24.address, 'optionalAccess', _25 => _25.toLowerCase, 'call', _26 => _26()])},[q,n,s]),z=_react.useMemo.call(void 0, ()=>{if(!_optionalChain([n, 'optionalAccess', _27 => _27.chainId])||!s||!L||n.chainId!==s.chainId||n.chainId===988)return!1;let t=_chunkT2K2NOGZcjs.c.call(void 0, n.chainId);return n.address.toLowerCase()===_optionalChain([t, 'optionalAccess', _28 => _28.wrappedAsset, 'access', _29 => _29.address, 'optionalAccess', _30 => _30.toLowerCase, 'call', _31 => _31()])},[n,s,L]),H=_react.useMemo.call(void 0, ()=>({raw:_nullishCoalesce(_optionalChain([g, 'optionalAccess', _32 => _32.raw]), () => ("0")),formatted:_nullishCoalesce(_optionalChain([g, 'optionalAccess', _33 => _33.formatted]), () => ("0"))}),[g]),J=_react.useMemo.call(void 0, ()=>({raw:_nullishCoalesce(_optionalChain([I, 'optionalAccess', _34 => _34.raw]), () => ("0")),formatted:_nullishCoalesce(_optionalChain([I, 'optionalAccess', _35 => _35.formatted]), () => ("0"))}),[I]),K=_react.useMemo.call(void 0, ()=>!n||typeof a!="number"||n.decimals===void 0||n.decimals===null?null:_viem.parseUnits.call(void 0, a.toFixed(n.decimals),n.decimals).toString(),[n,a]),V=_react.useMemo.call(void 0, ()=>!s||typeof l!="number"||s.decimals===void 0||s.decimals===null?null:_viem.parseUnits.call(void 0, l.toFixed(s.decimals),s.decimals).toString(),[s,l]),X=_react.useCallback.call(void 0, async t=>{A(t),p(null),_optionalChain([m, 'optionalCall', _36 => _36(t)])},[A,p,m]),Y=_react.useCallback.call(void 0, async t=>{S(t),_optionalChain([o, 'optionalCall', _37 => _37(t)])},[S,o]),Z=_react.useCallback.call(void 0, t=>T(t),[T]),_=_react.useCallback.call(void 0, t=>p(t),[p]),$=_react.useCallback.call(void 0, ()=>{h(),_chunkTXQ6Q4S3cjs.d.getState().toggleInverted(),r&&_optionalChain([m, 'optionalCall', _38 => _38(r)]),e&&_optionalChain([o, 'optionalCall', _39 => _39(e)])},[h,e,r,m,o]),j=_react.useCallback.call(void 0, ()=>v(),[v]);return{baseToken:n,baseAmount:a,quoteToken:s,quoteAmount:l,isBaseGasToken:q,isQuoteGasToken:L,isWrappingPair:O,isUnwrappingPair:z,baseBalance:H,quoteBalance:J,baseAmountRaw:K,quoteAmountRaw:V,isBaseBalanceLoading:R,isQuoteBalanceLoading:R,isRegistryLoading:u,setBaseToken:X,setQuoteToken:Y,setBaseAmount:Z,setQuoteAmount:_,swapTokens:$,clearForm:j}};var _jsxruntime = require('react/jsx-runtime');var N=_react.createContext.call(void 0, null),Ie= exports.d =({children:c,defaultBaseToken:i,defaultQuoteToken:m,onBaseTokenChange:o,onQuoteTokenChange:f})=>{let e=M(i,m,o,f),r=_react.useMemo.call(void 0, ()=>e,[e.baseToken,e.quoteToken,e.baseAmount,e.quoteAmount,e.isBaseGasToken,e.isQuoteGasToken,e.isWrappingPair,e.isUnwrappingPair,e.baseBalance,e.quoteBalance,e.baseAmountRaw,e.quoteAmountRaw,e.isBaseBalanceLoading,e.isQuoteBalanceLoading,e.setBaseToken,e.setQuoteToken,e.setBaseAmount,e.setQuoteAmount,e.swapTokens,e.clearForm,e.isRegistryLoading]);return _jsxruntime.jsx.call(void 0, N.Provider,{value:r,children:c})},qe= exports.e =()=>{let c=_react.useContext.call(void 0, N);if(!c)throw new Error("useSwapFormContext must be used within SwapFormProvider");return c};exports.a = F; exports.b = G; exports.c = M; exports.d = Ie; exports.e = qe;
2
+ var _chunkD7GULMHEcjs = require('./chunk-D7GULMHE.cjs');var _chunkK3RTTHBScjs = require('./chunk-K3RTTHBS.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');var _zustand = require('zustand');var _react = require('react');var F=_zustand.create.call(void 0, )(c=>({baseToken:null,quoteToken:null,setBaseTokenDirect:i=>c({baseToken:i}),setQuoteTokenDirect:i=>c({quoteToken:i}),swapTokensDirect:()=>c(i=>({baseToken:i.quoteToken,quoteToken:i.baseToken}))}));function G(c){let{data:i,isLoading:m}=_chunkK3RTTHBScjs.z.call(void 0, ),o=F(),f=_react.useRef.call(void 0, !1),e=_nullishCoalesce(_optionalChain([c, 'optionalAccess', _2 => _2.defaultBaseToken]), () => (null)),r=_nullishCoalesce(_optionalChain([c, 'optionalAccess', _3 => _3.defaultQuoteToken]), () => (null));_react.useEffect.call(void 0, ()=>{if(!i||i.length===0||f.current)return;f.current=!0;let u=T=>_nullishCoalesce(i.find(p=>p.chainId===T.chainId&&p.address.toLowerCase()===T.address.toLowerCase()), () => (null)),a=e?u(e):null,l=r?u(r):null;a&&l&&a.chainId===l.chainId&&a.address.toLowerCase()===l.address.toLowerCase()?(o.setBaseTokenDirect(a),o.setQuoteTokenDirect(null)):(o.setBaseTokenDirect(a),o.setQuoteTokenDirect(l))},[i,e,r,o]);let A=_react.useCallback.call(void 0, u=>{if(!u){o.setBaseTokenDirect(null);return}let a=F.getState();a.quoteToken&&u.chainId===a.quoteToken.chainId&&u.address.toLowerCase()===a.quoteToken.address.toLowerCase()?o.swapTokensDirect():o.setBaseTokenDirect(u)},[o]),S=_react.useCallback.call(void 0, u=>{if(!u){o.setQuoteTokenDirect(null);return}let a=F.getState();a.baseToken&&u.chainId===a.baseToken.chainId&&u.address.toLowerCase()===a.baseToken.address.toLowerCase()?o.swapTokensDirect():o.setQuoteTokenDirect(u)},[o]),h=_react.useCallback.call(void 0, ()=>{o.swapTokensDirect()},[o]);return{baseToken:o.baseToken,quoteToken:o.quoteToken,setBaseToken:A,setQuoteToken:S,swapTokens:h,isLoading:m}}var _viem = require('viem');var _shallow = require('zustand/react/shallow');var M=(c,i,m,o)=>{let{address:f}=_chunk34N36GUDcjs.a.call(void 0, ),{baseToken:e,quoteToken:r,setBaseToken:A,setQuoteToken:S,swapTokens:h,isLoading:u}=G({defaultBaseToken:c,defaultQuoteToken:i}),{baseAmount:a,quoteAmount:l,setBaseAmount:T,setQuoteAmount:p,clearAmounts:v}=_chunkD7GULMHEcjs.d.call(void 0, _shallow.useShallow.call(void 0, t=>({baseAmount:t.baseAmount,quoteAmount:t.quoteAmount,setBaseAmount:t.setBaseAmount,setQuoteAmount:t.setQuoteAmount,clearAmounts:t.clearAmounts}))),{data:y}=_chunkK3RTTHBScjs.A.call(void 0, _optionalChain([e, 'optionalAccess', _4 => _4.address]),_optionalChain([e, 'optionalAccess', _5 => _5.chainId])),{data:P}=_chunkK3RTTHBScjs.A.call(void 0, _optionalChain([r, 'optionalAccess', _6 => _6.address]),_optionalChain([r, 'optionalAccess', _7 => _7.chainId])),n=_react.useMemo.call(void 0, ()=>{if(!e)return null;let t=_nullishCoalesce(_optionalChain([y, 'optionalAccess', _8 => _8.price]), () => (e.price));return t===e.price?e:{...e,price:t}},[e,_optionalChain([y, 'optionalAccess', _9 => _9.price])]),s=_react.useMemo.call(void 0, ()=>{if(!r)return null;let t=_nullishCoalesce(_optionalChain([P, 'optionalAccess', _10 => _10.price]), () => (r.price));return t===r.price?r:{...r,price:t}},[r,_optionalChain([P, 'optionalAccess', _11 => _11.price])]),{baseBalance:B,quoteBalance:b,isLoading:R}=_chunkK3RTTHBScjs.L.call(void 0, f,n,s),g=_react.useMemo.call(void 0, ()=>!B||B.raw==="0"?null:B,[B]),I=_react.useMemo.call(void 0, ()=>!b||b.raw==="0"?null:b,[b]),q=_react.useMemo.call(void 0, ()=>{if(!_optionalChain([n, 'optionalAccess', _12 => _12.chainId]))return!1;let t=_chunkK3RTTHBScjs.c.call(void 0, n.chainId);return n.address.toLowerCase()===_optionalChain([t, 'optionalAccess', _13 => _13.gasToken, 'access', _14 => _14.address, 'optionalAccess', _15 => _15.toLowerCase, 'call', _16 => _16()])},[n]),L=_react.useMemo.call(void 0, ()=>{if(!_optionalChain([s, 'optionalAccess', _17 => _17.chainId]))return!1;let t=_chunkK3RTTHBScjs.c.call(void 0, s.chainId);return s.address.toLowerCase()===_optionalChain([t, 'optionalAccess', _18 => _18.gasToken, 'access', _19 => _19.address, 'optionalAccess', _20 => _20.toLowerCase, 'call', _21 => _21()])},[s]),O=_react.useMemo.call(void 0, ()=>{if(!q||!_optionalChain([n, 'optionalAccess', _22 => _22.chainId])||!s||n.chainId!==s.chainId||n.chainId===988)return!1;let t=_chunkK3RTTHBScjs.c.call(void 0, n.chainId);return s.address.toLowerCase()===_optionalChain([t, 'optionalAccess', _23 => _23.wrappedAsset, 'access', _24 => _24.address, 'optionalAccess', _25 => _25.toLowerCase, 'call', _26 => _26()])},[q,n,s]),z=_react.useMemo.call(void 0, ()=>{if(!_optionalChain([n, 'optionalAccess', _27 => _27.chainId])||!s||!L||n.chainId!==s.chainId||n.chainId===988)return!1;let t=_chunkK3RTTHBScjs.c.call(void 0, n.chainId);return n.address.toLowerCase()===_optionalChain([t, 'optionalAccess', _28 => _28.wrappedAsset, 'access', _29 => _29.address, 'optionalAccess', _30 => _30.toLowerCase, 'call', _31 => _31()])},[n,s,L]),H=_react.useMemo.call(void 0, ()=>({raw:_nullishCoalesce(_optionalChain([g, 'optionalAccess', _32 => _32.raw]), () => ("0")),formatted:_nullishCoalesce(_optionalChain([g, 'optionalAccess', _33 => _33.formatted]), () => ("0"))}),[g]),J=_react.useMemo.call(void 0, ()=>({raw:_nullishCoalesce(_optionalChain([I, 'optionalAccess', _34 => _34.raw]), () => ("0")),formatted:_nullishCoalesce(_optionalChain([I, 'optionalAccess', _35 => _35.formatted]), () => ("0"))}),[I]),K=_react.useMemo.call(void 0, ()=>!n||typeof a!="number"||n.decimals===void 0||n.decimals===null?null:_viem.parseUnits.call(void 0, a.toFixed(n.decimals),n.decimals).toString(),[n,a]),V=_react.useMemo.call(void 0, ()=>!s||typeof l!="number"||s.decimals===void 0||s.decimals===null?null:_viem.parseUnits.call(void 0, l.toFixed(s.decimals),s.decimals).toString(),[s,l]),X=_react.useCallback.call(void 0, async t=>{A(t),p(null),_optionalChain([m, 'optionalCall', _36 => _36(t)])},[A,p,m]),Y=_react.useCallback.call(void 0, async t=>{S(t),_optionalChain([o, 'optionalCall', _37 => _37(t)])},[S,o]),Z=_react.useCallback.call(void 0, t=>T(t),[T]),_=_react.useCallback.call(void 0, t=>p(t),[p]),$=_react.useCallback.call(void 0, ()=>{h(),_chunkD7GULMHEcjs.d.getState().toggleInverted(),r&&_optionalChain([m, 'optionalCall', _38 => _38(r)]),e&&_optionalChain([o, 'optionalCall', _39 => _39(e)])},[h,e,r,m,o]),j=_react.useCallback.call(void 0, ()=>v(),[v]);return{baseToken:n,baseAmount:a,quoteToken:s,quoteAmount:l,isBaseGasToken:q,isQuoteGasToken:L,isWrappingPair:O,isUnwrappingPair:z,baseBalance:H,quoteBalance:J,baseAmountRaw:K,quoteAmountRaw:V,isBaseBalanceLoading:R,isQuoteBalanceLoading:R,isRegistryLoading:u,setBaseToken:X,setQuoteToken:Y,setBaseAmount:Z,setQuoteAmount:_,swapTokens:$,clearForm:j}};var _jsxruntime = require('react/jsx-runtime');var N=_react.createContext.call(void 0, null),Ie= exports.d =({children:c,defaultBaseToken:i,defaultQuoteToken:m,onBaseTokenChange:o,onQuoteTokenChange:f})=>{let e=M(i,m,o,f),r=_react.useMemo.call(void 0, ()=>e,[e.baseToken,e.quoteToken,e.baseAmount,e.quoteAmount,e.isBaseGasToken,e.isQuoteGasToken,e.isWrappingPair,e.isUnwrappingPair,e.baseBalance,e.quoteBalance,e.baseAmountRaw,e.quoteAmountRaw,e.isBaseBalanceLoading,e.isQuoteBalanceLoading,e.setBaseToken,e.setQuoteToken,e.setBaseAmount,e.setQuoteAmount,e.swapTokens,e.clearForm,e.isRegistryLoading]);return _jsxruntime.jsx.call(void 0, N.Provider,{value:r,children:c})},qe= exports.e =()=>{let c=_react.useContext.call(void 0, N);if(!c)throw new Error("useSwapFormContext must be used within SwapFormProvider");return c};exports.a = F; exports.b = G; exports.c = M; exports.d = Ie; exports.e = qe;