@orbs-network/spot-react 1.1.41 → 1.1.42

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 (39) hide show
  1. package/README.md +413 -257
  2. package/dist/spot-react/package.json.d.ts +1 -1
  3. package/dist/spot-react/src/hooks/order-hooks.d.ts.map +1 -1
  4. package/dist/spot-react/src/hooks/use-cancel-order.d.ts +2 -0
  5. package/dist/spot-react/src/hooks/use-cancel-order.d.ts.map +1 -1
  6. package/dist/spot-react/src/hooks/use-form-data.d.ts +10 -31
  7. package/dist/spot-react/src/hooks/use-form-data.d.ts.map +1 -1
  8. package/dist/spot-react/src/hooks/use-history-order.d.ts.map +1 -1
  9. package/dist/spot-react/src/hooks/use-repermit-data.d.ts +7 -0
  10. package/dist/spot-react/src/hooks/use-repermit-data.d.ts.map +1 -0
  11. package/dist/spot-react/src/hooks/use-repermit-order-data.d.ts +14 -31
  12. package/dist/spot-react/src/hooks/use-repermit-order-data.d.ts.map +1 -1
  13. package/dist/spot-react/src/hooks/use-submit-order-panel.d.ts +3 -1
  14. package/dist/spot-react/src/hooks/use-submit-order-panel.d.ts.map +1 -1
  15. package/dist/spot-react/src/hooks/use-submit-order.d.ts.map +1 -1
  16. package/dist/spot-react/src/index.d.ts +2 -1
  17. package/dist/spot-react/src/index.d.ts.map +1 -1
  18. package/dist/spot-react/src/spot-context.d.ts.map +1 -1
  19. package/dist/spot-react/src/types.d.ts +1 -2
  20. package/dist/spot-react/src/types.d.ts.map +1 -1
  21. package/dist/spot-react.js +2460 -2507
  22. package/dist/spot-react.umd.cjs +7 -7
  23. package/dist/spot-ui/src/lib/analytics.d.ts +7 -5
  24. package/dist/spot-ui/src/lib/analytics.d.ts.map +1 -1
  25. package/dist/spot-ui/src/lib/build-repermit-order-data.d.ts +21 -41
  26. package/dist/spot-ui/src/lib/build-repermit-order-data.d.ts.map +1 -1
  27. package/dist/spot-ui/src/lib/consts.d.ts +1 -0
  28. package/dist/spot-ui/src/lib/consts.d.ts.map +1 -1
  29. package/dist/spot-ui/src/lib/lib.d.ts +15 -2
  30. package/dist/spot-ui/src/lib/lib.d.ts.map +1 -1
  31. package/dist/spot-ui/src/lib/orders/index.d.ts +6 -3
  32. package/dist/spot-ui/src/lib/orders/index.d.ts.map +1 -1
  33. package/dist/spot-ui/src/lib/types.d.ts +16 -16
  34. package/dist/spot-ui/src/lib/types.d.ts.map +1 -1
  35. package/dist/spot-ui/src/lib/utils.d.ts +1 -1
  36. package/dist/spot-ui/src/lib/utils.d.ts.map +1 -1
  37. package/package.json +2 -2
  38. package/dist/spot-react/src/hooks/use-addresses.d.ts +0 -4
  39. package/dist/spot-react/src/hooks/use-addresses.d.ts.map +0 -1
@@ -1,7 +1,7 @@
1
- (function(I,W){typeof exports=="object"&&typeof module<"u"?W(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],W):(I=typeof globalThis<"u"?globalThis:I||self,W(I.SpotReact={},I.jsxRuntime,I.React))})(this,(function(I,W,D){"use strict";var hc=Object.defineProperty;var $s=I=>{throw TypeError(I)};var mc=(I,W,D)=>W in I?hc(I,W,{enumerable:!0,configurable:!0,writable:!0,value:D}):I[W]=D;var In=(I,W,D)=>mc(I,typeof W!="symbol"?W+"":W,D),Er=(I,W,D)=>W.has(I)||$s("Cannot "+D);var l=(I,W,D)=>(Er(I,W,"read from private field"),D?D.call(I):W.get(I)),N=(I,W,D)=>W.has(I)?$s("Cannot add the same private member more than once"):W instanceof WeakSet?W.add(I):W.set(I,D),k=(I,W,D,_t)=>(Er(I,W,"write to private field"),_t?_t.call(I,D):W.set(I,D),D),Q=(I,W,D)=>(Er(I,W,"access private method"),D);var Mn=(I,W,D,_t)=>({set _(ce){k(I,W,ce,D)},get _(){return l(I,W,_t)}});var He,Ft,_s,St,ot,Wt,Us,zt,ct,Qt,Rs,Dt,Ls,vt,$t,ke,Pt,he,sn,Ot,Le,et,Ns,Se,Z,an,xe,Bt,jt,Ge,ut,on,Vt,Gt,It,Mt,dt,Xt,ee,ln,Cr,xr,Tr,wr,Fr,Sr,Dr,js,qs,cn,We,Te,kt,ze,mt,Ks,Xe,Ne,un,Hs,Ze,lt,De,Ye,Je,kn,vr,Ws,Qe,zs,se,ft,pt,Zt,Yt,ht,Jt,en,Qs;function _t(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const ce=_t(D),$={SpookySwap:{chainName:"ftm",chainId:250,twapVersion:4,twapAddress:"0xd3B290FEB04E353d1821bc0a12397FdEa9a846C0",lensAddress:"0x0221EfDF1Fd3212AF87F23cceB7693a65fAF1d7f",takers:["0xDF406A27C58a8Cd6Fd43e143339bCE131216a913","0x504f6E10173249dD22491829D98862Cf81DeF79E"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"SpookySwap",partner:"Orbs:TWAP:SpookySwap",exchangeAddress:"0xdF7CCd5fc7077E9de5f27a7b7bfDC837c82f8496",exchangeType:"ExchangeV2",pathfinderKey:""},SpookySwapSonic:{chainName:"sonic",chainId:146,twapVersion:4,twapAddress:"0x8963992816b4EafE5a22b7DB2A99513c18be9afA",lensAddress:"0x67e631F71232D63AcA98a2D5E9B2Bce5FCc39d5D",takers:["0xDF406A27C58a8Cd6Fd43e143339bCE131216a913","0x504f6E10173249dD22491829D98862Cf81DeF79E"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"SpookySwapSonic",partner:"Orbs:TWAP:SpookySwap",exchangeAddress:"0x6699bE3aF75e5c1B807b1031dBde6dA9A67739F3",exchangeType:"ExchangeV2",pathfinderKey:""},QuickSwap:{chainName:"poly",chainId:137,twapVersion:4,twapAddress:"0x688C027B0f7FaCeFcBa73e472900d28c12C5bDF4",lensAddress:"0xe0D4E736fc76af7C256ae7652c8c1e850bfb7849",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"QuickSwap",partner:"Orbs:TWAP:QuickSwap",exchangeAddress:"0x8FCc245209bE85C49D738D0CE5613F74E5d91E86",exchangeType:"ParaswapExchange",pathfinderKey:"QuickSwap,QuickSwapV3"},QuickSwapBase:{chainName:"base",chainId:8453,twapVersion:4,twapAddress:"0xc918bdC47264687796Cd54FE362FaC4f8b99Eb55",lensAddress:"0x6313188c1909b161074D62E43105faC9B756A23e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"QuickSwap",partner:"Orbs:TWAP:QuickSwap",exchangeAddress:"0xb7a3d74895bfd3aff6780525e36d79fcf26a895f",exchangeType:"ExchangeV2",pathfinderKey:""},Thena:{chainName:"bsc",chainId:56,twapVersion:4,twapAddress:"0xa6F7444D2b92Aa9F94a2165c77aAF2B671e63994",lensAddress:"0xEdB0c077fa87Fb21d050c619FF426798f8Fc1264",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"Thena",partner:"Orbs:TWAP:Thena",exchangeAddress:"0x2B2fABDbfa4a15da0d351F947C14F4520db0bDc1",exchangeType:"ExchangeV2",pathfinderKey:"43,47"},PancakeSwap:{chainName:"bsc",chainId:56,twapVersion:4,twapAddress:"0xa6F7444D2b92Aa9F94a2165c77aAF2B671e63994",lensAddress:"0xEdB0c077fa87Fb21d050c619FF426798f8Fc1264",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"PancakeSwap",partner:"Orbs:TWAP:PancakeSwap",exchangeAddress:"0x1A2bb6B75D58b740d88413ef4840D6fa3F637940",exchangeType:"P2Exchange",pathfinderKey:""},PancakeSwapArbitrum:{chainName:"arb",chainId:42161,twapVersion:4,twapAddress:"0x0B94dcC0EA2d1ee33Ab064DaC252de980a941eF3",lensAddress:"0x549e1fc9a47FCc0C5C2EbdfF31254cc49fF7164e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"PancakeSwap",partner:"Orbs:TWAP:PancakeSwap",exchangeAddress:"0xb37cB9A058c03081Ae6EF934313588cD53d408e7",exchangeType:"P2Exchange",pathfinderKey:""},PancakeSwapBase:{chainName:"base",chainId:8453,twapVersion:4,twapAddress:"0xc918bdC47264687796Cd54FE362FaC4f8b99Eb55",lensAddress:"0x6313188c1909b161074D62E43105faC9B756A23e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"PancakeSwap",partner:"Orbs:TWAP:PancakeSwap",exchangeAddress:"0xb37cB9A058c03081Ae6EF934313588cD53d408e7",exchangeType:"P2Exchange",pathfinderKey:""},PancakeSwapLinea:{chainName:"linea",chainId:59144,twapVersion:4,twapAddress:"0x48423e62acbfEF7779b5b4a5E7d6Fbd39E623d78",lensAddress:"0xe84CaEc86eCF3f0AB4267dC6130D9a5510e73DFb",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:100,name:"PancakeSwap",partner:"Orbs:TWAP:PancakeSwap",exchangeAddress:"0xb37cB9A058c03081Ae6EF934313588cD53d408e7",exchangeType:"P2Exchange",pathfinderKey:""},Lynex:{chainName:"linea",chainId:59144,twapVersion:4,twapAddress:"0x48423e62acbfEF7779b5b4a5E7d6Fbd39E623d78",lensAddress:"0xe84CaEc86eCF3f0AB4267dC6130D9a5510e73DFb",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:100,name:"Lynex",partner:"Orbs:TWAP:Lynex",exchangeAddress:"0x04C06C96d7D19977156016DD408B5992af0570a2",exchangeType:"ExchangeV2",pathfinderKey:"19,18"},SushiArb:{chainName:"arb",chainId:42161,twapVersion:4,twapAddress:"0x0B94dcC0EA2d1ee33Ab064DaC252de980a941eF3",lensAddress:"0x549e1fc9a47FCc0C5C2EbdfF31254cc49fF7164e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"SushiArb",partner:"Orbs:TWAP:Sushi",exchangeAddress:"0x04eB53119079FA779492720D1EfeAEBF0aF2e5ad",exchangeType:"ExchangeV2",pathfinderKey:""},SushiBase:{chainName:"base",chainId:8453,twapVersion:4,twapAddress:"0xc918bdC47264687796Cd54FE362FaC4f8b99Eb55",lensAddress:"0x6313188c1909b161074D62E43105faC9B756A23e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"SushiBase",partner:"Orbs:TWAP:Sushi",exchangeAddress:"0x04eB53119079FA779492720D1EfeAEBF0aF2e5ad",exchangeType:"ExchangeV2",pathfinderKey:""},SushiEth:{chainName:"eth",chainId:1,twapVersion:4,twapAddress:"0xb1ed8BCAD1EaC8a1DF0764700472391800D12946",lensAddress:"0x0967f448c4d4dbd14c355E635AE9CbF68cc44A60",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:200,name:"SushiEth",partner:"Orbs:TWAP:Sushi",exchangeAddress:"0x04eB53119079FA779492720D1EfeAEBF0aF2e5ad",exchangeType:"ExchangeV2",pathfinderKey:""},SushiKatana:{chainName:"katana",chainId:747474,twapVersion:4,twapAddress:"0xf2d96E7BE676153d202e1453804E2749923C7c5b",lensAddress:"0x1579EED0527781B1A748043AA1f59a3858Ace4a7",takers:["0xF74437A3Fc45a518640828E5D6A3E8c9A9BbDC3a","0x07A6C715063e94c0D95e809efefFCbF4EBEdfD55"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"SushiKatana",partner:"Orbs:TWAP:Sushi",exchangeAddress:"0x92209481507e6B2d14C9b5b70Ed287024177220E",exchangeType:"ExchangeV2",pathfinderKey:""},DragonSwap:{chainId:1329,name:"DragonSwap"},SwapX:{chainName:"sonic",chainId:146,twapVersion:4,twapAddress:"0x8963992816b4EafE5a22b7DB2A99513c18be9afA",lensAddress:"0x67e631F71232D63AcA98a2D5E9B2Bce5FCc39d5D",takers:["0xDF406A27C58a8Cd6Fd43e143339bCE131216a913","0x504f6E10173249dD22491829D98862Cf81DeF79E"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"SwapX",partner:"Orbs:TWAP:SwapX",exchangeAddress:"0xDA902994b7F7a1ecDd8De02E4a17dbFF2E6F67b7",exchangeType:"ExchangeV2",pathfinderKey:""},BlackholeAvax:{chainName:"avax",chainId:43114,twapVersion:4,twapAddress:"0xf77Ad005aBF7e31f669ce89a6568B2f39Ca92cDe",lensAddress:"0x48466B82Ce1575c5c9eCa168ac1090048dD47fA3",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"BlackholeAvax",partner:"Orbs:TWAP:BlackholeAvax",exchangeAddress:"0xb7A3d74895bFD3Aff6780525e36D79FCf26a895F",exchangeType:"ExchangeV2"}},Vs=JSON.parse('[{"inputs":[{"internalType":"address","name":"_iweth","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"id","type":"uint64"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":true,"internalType":"address","name":"exchange","type":"address"},{"indexed":false,"internalType":"uint32","name":"slippagePercent","type":"uint32"},{"components":[{"internalType":"uint32","name":"time","type":"uint32"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"uint256","name":"dstAmount","type":"uint256"},{"internalType":"uint256","name":"dstFee","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"indexed":false,"internalType":"struct OrderLib.Bid","name":"bid","type":"tuple"}],"name":"OrderBid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"id","type":"uint64"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"OrderCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"id","type":"uint64"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":true,"internalType":"address","name":"exchange","type":"address"},{"indexed":false,"internalType":"address","name":"taker","type":"address"}],"name":"OrderCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"id","type":"uint64"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":true,"internalType":"address","name":"exchange","type":"address"},{"components":[{"internalType":"address","name":"exchange","type":"address"},{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"srcBidAmount","type":"uint256"},{"internalType":"uint256","name":"dstMinAmount","type":"uint256"},{"internalType":"uint32","name":"deadline","type":"uint32"},{"internalType":"uint32","name":"bidDelay","type":"uint32"},{"internalType":"uint32","name":"fillDelay","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"indexed":false,"internalType":"struct OrderLib.Ask","name":"ask","type":"tuple"}],"name":"OrderCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"id","type":"uint64"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":true,"internalType":"address","name":"exchange","type":"address"},{"indexed":false,"internalType":"address","name":"taker","type":"address"},{"indexed":false,"internalType":"uint256","name":"srcAmountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dstAmountOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dstFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"srcFilledAmount","type":"uint256"}],"name":"OrderFilled","type":"event"},{"inputs":[],"name":"MIN_BID_DELAY_SECONDS","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_OUTBID_PERCENT","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERCENT_BASE","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STALE_BID_SECONDS","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STATUS_CANCELED","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STATUS_COMPLETED","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"exchange","type":"address"},{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"srcBidAmount","type":"uint256"},{"internalType":"uint256","name":"dstMinAmount","type":"uint256"},{"internalType":"uint32","name":"deadline","type":"uint32"},{"internalType":"uint32","name":"bidDelay","type":"uint32"},{"internalType":"uint32","name":"fillDelay","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct OrderLib.Ask","name":"_ask","type":"tuple"}],"name":"ask","outputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"uint256","name":"dstFee","type":"uint256"},{"internalType":"uint32","name":"slippagePercent","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"bid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"book","outputs":[{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"uint32","name":"status","type":"uint32"},{"internalType":"uint32","name":"time","type":"uint32"},{"internalType":"uint32","name":"filledTime","type":"uint32"},{"internalType":"uint256","name":"srcFilledAmount","type":"uint256"},{"internalType":"address","name":"maker","type":"address"},{"components":[{"internalType":"address","name":"exchange","type":"address"},{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"srcBidAmount","type":"uint256"},{"internalType":"uint256","name":"dstMinAmount","type":"uint256"},{"internalType":"uint32","name":"deadline","type":"uint32"},{"internalType":"uint32","name":"bidDelay","type":"uint32"},{"internalType":"uint32","name":"fillDelay","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct OrderLib.Ask","name":"ask","type":"tuple"},{"components":[{"internalType":"uint32","name":"time","type":"uint32"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"uint256","name":"dstAmount","type":"uint256"},{"internalType":"uint256","name":"dstFee","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct OrderLib.Bid","name":"bid","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"name":"cancel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"name":"fill","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"iweth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"length","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"makerOrders","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"name":"order","outputs":[{"components":[{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"uint32","name":"status","type":"uint32"},{"internalType":"uint32","name":"time","type":"uint32"},{"internalType":"uint32","name":"filledTime","type":"uint32"},{"internalType":"uint256","name":"srcFilledAmount","type":"uint256"},{"internalType":"address","name":"maker","type":"address"},{"components":[{"internalType":"address","name":"exchange","type":"address"},{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"srcBidAmount","type":"uint256"},{"internalType":"uint256","name":"dstMinAmount","type":"uint256"},{"internalType":"uint32","name":"deadline","type":"uint32"},{"internalType":"uint32","name":"bidDelay","type":"uint32"},{"internalType":"uint32","name":"fillDelay","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct OrderLib.Ask","name":"ask","type":"tuple"},{"components":[{"internalType":"uint32","name":"time","type":"uint32"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"uint256","name":"dstAmount","type":"uint256"},{"internalType":"uint256","name":"dstFee","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct OrderLib.Bid","name":"bid","type":"tuple"}],"internalType":"struct OrderLib.Order","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"maker","type":"address"}],"name":"orderIdsByMaker","outputs":[{"internalType":"uint64[]","name":"","type":"uint64[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"name":"prune","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"status","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]'),Gs=[{type:"constructor",inputs:[],stateMutability:"nonpayable"},{type:"function",name:"DOMAIN_SEPARATOR",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"cancel",inputs:[{name:"digests",type:"bytes32[]",internalType:"bytes32[]"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"eip712Domain",inputs:[],outputs:[{name:"fields",type:"bytes1",internalType:"bytes1"},{name:"name",type:"string",internalType:"string"},{name:"version",type:"string",internalType:"string"},{name:"chainId",type:"uint256",internalType:"uint256"},{name:"verifyingContract",type:"address",internalType:"address"},{name:"salt",type:"bytes32",internalType:"bytes32"},{name:"extensions",type:"uint256[]",internalType:"uint256[]"}],stateMutability:"view"},{type:"function",name:"hashTypedData",inputs:[{name:"structHash",type:"bytes32",internalType:"bytes32"}],outputs:[{name:"digest",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"repermitWitnessTransferFrom",inputs:[{name:"permit",type:"tuple",internalType:"struct RePermitLib.RePermitTransferFrom",components:[{name:"permitted",type:"tuple",internalType:"struct RePermitLib.TokenPermissions",components:[{name:"token",type:"address",internalType:"address"},{name:"amount",type:"uint256",internalType:"uint256"}]},{name:"nonce",type:"uint256",internalType:"uint256"},{name:"deadline",type:"uint256",internalType:"uint256"}]},{name:"request",type:"tuple",internalType:"struct RePermitLib.TransferRequest",components:[{name:"to",type:"address",internalType:"address"},{name:"amount",type:"uint256",internalType:"uint256"}]},{name:"signer",type:"address",internalType:"address"},{name:"witness",type:"bytes32",internalType:"bytes32"},{name:"witnessTypeString",type:"string",internalType:"string"},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"spent",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"bytes32",internalType:"bytes32"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"event",name:"Cancel",inputs:[{name:"signer",type:"address",indexed:!0,internalType:"address"},{name:"digest",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"EIP712DomainChanged",inputs:[],anonymous:!1},{type:"event",name:"Spend",inputs:[{name:"signer",type:"address",indexed:!0,internalType:"address"},{name:"permitHash",type:"bytes32",indexed:!0,internalType:"bytes32"},{name:"token",type:"address",indexed:!0,internalType:"address"},{name:"to",type:"address",indexed:!1,internalType:"address"},{name:"amount",type:"uint256",indexed:!1,internalType:"uint256"},{name:"totalSpent",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"error",name:"Canceled",inputs:[]},{type:"error",name:"Expired",inputs:[]},{type:"error",name:"InsufficientAllowance",inputs:[]},{type:"error",name:"InvalidShortString",inputs:[]},{type:"error",name:"InvalidSignature",inputs:[]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{name:"token",type:"address",internalType:"address"}]},{type:"error",name:"StringTooLong",inputs:[{name:"str",type:"string",internalType:"string"}]}],Xs=Vs;var j=(e=>(e.TWAP="TWAP",e.LIMIT="LIMIT",e.STOP_LOSS="STOP_LOSS",e.TAKE_PROFIT="TAKE_PROFIT",e))(j||{}),ue=(e=>(e.Open="OPEN",e.Cancelled="CANCELLED",e.Completed="COMPLETED",e.Expired="EXPIRED",e))(ue||{}),Pr=(e=>(e.All="ALL",e.Open="OPEN",e.Cancelled="CANCELLED",e.Completed="COMPLETED",e.Expired="EXPIRED",e))(Pr||{}),ve=(e=>(e[e.Minutes=6e4]="Minutes",e[e.Hours=36e5]="Hours",e[e.Weeks=6048e5]="Weeks",e[e.Days=864e5]="Days",e[e.Months=2592e6]="Months",e[e.Years=31536e6]="Years",e))(ve||{}),G=(e=>(e.LIMIT="limit",e.TWAP_LIMIT="twap-limit",e.TWAP_MARKET="twap-market",e.TAKE_PROFIT_MARKET="take-profit-market",e.TAKE_PROFIT_LIMIT="take-profit-limit",e.STOP_LOSS_LIMIT="stop-loss-limit",e.STOP_LOSS_MARKET="stop-loss-market",e))(G||{}),Pe=(e=>(e.Arbidex="arbidex",e.Blackhole="blackhole",e.Chronos="chronos",e.Dragon="dragon",e.Kodiak="kodiak",e.Lynex="lynex",e.Nami="nami",e.Newera="newera",e.Omni="omni",e.Pancake="pancake",e.Quick="quick",e.Ramses="ramses",e.Shadow="shadow",e.Spark="spark",e.Spooky="spooky",e.Swapx="swapx",e.Teafi="teafi",e.Thena="thena",e.Yowie="yowie",e.Pangolin="pangolin",e.Sushiswap="sushiswap",e.Agent="agent",e.Utila="utila",e.Ring="ring",e.EfficientFrontier="ef",e.HtDigital="ht",e.Ginco="ginco",e.Katana="katana",e))(Pe||{}),me=(e=>(e.EMPTY_LIMIT_PRICE="emptyLimitPrice",e.MAX_CHUNKS="maxChunksError",e.MIN_CHUNKS="minChunksError",e.MIN_TRADE_SIZE="minTradeSizeError",e.MAX_FILL_DELAY="maxFillDelayError",e.MIN_FILL_DELAY="minFillDelayError",e.MAX_ORDER_DURATION="maxDurationError",e.MIN_ORDER_DURATION="minDurationError",e.MISSING_LIMIT_PRICE="missingLimitPrice",e.STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE="StopLossTriggerPriceError",e.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE="triggerLimitPriceError",e.TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE="TakeProfitTriggerPriceError",e.EMPTY_TRIGGER_PRICE="emptyTriggerPrice",e.INSUFFICIENT_BALANCE="insufficientFunds",e.MAX_ORDER_SIZE="maxOrderSize",e.MIN_TRADE_SIZE_ERROR="minTradeSizeError",e))(me||{});const ne="0x0000000000000000000000000000000000000000",ye={eth:{id:1,name:"Ethereum",shortname:"eth",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg"},wToken:{symbol:"WETH",address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://eth.llamarpc.com",logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg",explorer:"https://etherscan.io",eip1559:!0},bsc:{id:56,name:"BinanceSmartChain",shortname:"bsc",native:{address:ne,symbol:"BNB",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/1839.png"},wToken:{symbol:"WBNB",address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/1839.png"},publicRpcUrl:"https://bsc-dataseed.binance.org",logoUrl:"https://app.1inch.io/assets/images/network-logos/bsc_2.svg",explorer:"https://bscscan.com",eip1559:!1},unichain:{id:130,name:"Unichain",shortname:"unichain",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg"},wToken:{symbol:"WETH",address:"0x4200000000000000000000000000000000000006",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/130/0x4200000000000000000000000000000000000006_0x042e6d078c6cf9e13a618396b0aa40181bcb43921ebdb5fabc8fb1124d516156.webp"},publicRpcUrl:"https://mainnet.unichain.org",logoUrl:"https://icons.llamao.fi/icons/chains/rsz_unichain",explorer:"https://uniscan.xyz",eip1559:!0},xlayer:{id:196,name:"X Layer",shortname:"xlayer",native:{address:ne,symbol:"OKB",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/3897.png"},wToken:{symbol:"WOKB",address:"0xe538905cf8410324e03A5A23C1c177a474D59b2b",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/3897.png"},publicRpcUrl:"https://rpc.xlayer.tech",logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/3897.png",explorer:"https://www.oklink.com/xlayer",eip1559:!0},hyperevm:{id:999,name:"HyperEVM",shortname:"hyperevm",native:{address:ne,symbol:"HYPE",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/32196.png"},wToken:{symbol:"WHYPE",address:"0x5555555555555555555555555555555555555555",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/32196.png"},publicRpcUrl:"https://rpc.hyperliquid.xyz/evm",logoUrl:"https://icons.llamao.fi/icons/chains/rsz_hyperliquid",explorer:"https://hyperevmscan.io",eip1559:!0},megaeth:{id:4326,name:"MegaETH",shortname:"megaeth",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg"},wToken:{symbol:"WETH",address:"0x4200000000000000000000000000000000000006",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://mainnet.megaeth.com/rpc",logoUrl:"https://icons.llamao.fi/icons/chains/rsz_megaeth",explorer:"https://mega.etherscan.io",eip1559:!0},poly:{id:137,name:"Polygon",shortname:"poly",native:{address:ne,symbol:"POL",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/64x64/28321.png"},wToken:{symbol:"WPOL",address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270.png"},publicRpcUrl:"https://polygon-rpc.com",logoUrl:"https://app.1inch.io/assets/images/network-logos/polygon.svg",explorer:"https://polygonscan.com",eip1559:!0},arb:{id:42161,name:"Arbitrum",shortname:"arb",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg"},wToken:{symbol:"WETH",address:"0x82af49447d8a07e3bd95bd0d56f35241523fbab1",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://arb1.arbitrum.io/rpc",logoUrl:"https://app.1inch.io/assets/images/network-logos/arbitrum.svg",explorer:"https://arbiscan.io",eip1559:!0},sei:{id:1329,name:"Sei",shortname:"sei",native:{address:ne,symbol:"SEI",decimals:18,logoUrl:"https://assets.coingecko.com/coins/images/28205/standard/Sei_Logo_-_Transparent.png"},wToken:{symbol:"WSEI",address:"0xE30feDd158A2e3b13e9badaeABaFc5516e95e8C7",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://evm-rpc.sei-apis.com",logoUrl:"https://assets.coingecko.com/coins/images/28205/standard/Sei_Logo_-_Transparent.png",explorer:"https://seitrace.com",eip1559:!1},avax:{id:43114,name:"Avalanche",shortname:"avax",native:{address:ne,symbol:"AVAX",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/avalanche.svg"},wToken:{symbol:"WAVAX",address:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7.png"},publicRpcUrl:"https://api.avax.network/ext/bc/C/rpc",logoUrl:"https://app.1inch.io/assets/images/network-logos/avalanche.svg",explorer:"https://snowtrace.io",eip1559:!0},ftm:{id:250,name:"Fantom",shortname:"ftm",native:{address:ne,symbol:"FTM",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/fantom.svg"},wToken:{symbol:"WFTM",address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0x4e15361fd6b4bb609fa63c81a2be19d873717870.png"},publicRpcUrl:"https://rpc.ftm.tools",logoUrl:"https://app.1inch.io/assets/images/network-logos/fantom.svg",explorer:"https://ftmscan.com",eip1559:!0},base:{id:8453,name:"Base",shortname:"base",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/1027.png"},wToken:{symbol:"WETH",address:"0x4200000000000000000000000000000000000006",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://mainnet.base.org",logoUrl:"https://app.1inch.io/assets/images/network-logos/base.svg",explorer:"https://basescan.org",eip1559:!1},linea:{id:59144,name:"Linea",shortname:"linea",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg"},wToken:{symbol:"WETH",address:"0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://rpc.linea.build",logoUrl:"https://lineascan.build/images/logo.svg",explorer:"https://lineascan.build",eip1559:!1},zksync:{id:324,name:"zksync",shortname:"zksync",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg"},wToken:{symbol:"WETH",address:"0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://mainnet.era.zksync.io",logoUrl:"https://raw.githubusercontent.com/matter-labs/zksync/0a4ca2145a0c95b5bafa84c2f095c644907a8825/zkSyncLogo.svg",explorer:"https://explorer.zksync.io/",eip1559:!0},zkevm:{id:1101,name:"zkevm",shortname:"zkevm",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg"},wToken:{symbol:"WETH",address:"0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://zkevm-rpc.com",logoUrl:"https://user-images.githubusercontent.com/18598517/235932702-bc47eae5-d672-4dd9-9da2-8ea8f51a93f3.png",explorer:"https://zkevm.polygonscan.com/",eip1559:!0},manta:{id:169,name:"manta",shortname:"manta",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://icons.llamao.fi/icons/chains/rsz_manta.jpg"},wToken:{symbol:"WETH",address:"0x0Dc808adcE2099A9F62AA87D9670745AbA741746",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://pacific-rpc.manta.network/http",logoUrl:"https://icons.llamao.fi/icons/chains/rsz_manta.jpg",explorer:"https://manta.socialscan.io/",eip1559:!0},blast:{id:81457,name:"blast",shortname:"blast",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://icons.llamao.fi/icons/chains/rsz_blast"},wToken:{symbol:"WETH",address:"0x4300000000000000000000000000000000000004",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://rpc.ankr.com/blast",logoUrl:"https://icons.llamao.fi/icons/chains/rsz_blast",explorer:"https://blastscan.io/",eip1559:!0},sonic:{id:146,name:"sonic",shortname:"sonic",native:{address:ne,symbol:"S",decimals:18,logoUrl:"https://icons.llamao.fi/icons/chains/rsz_sonic"},wToken:{symbol:"WS",address:"0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38",decimals:18,logoUrl:"https://icons.llamao.fi/icons/chains/rsz_sonic"},publicRpcUrl:"https://rpc.soniclabs.com",logoUrl:"https://icons.llamao.fi/icons/chains/rsz_sonic",explorer:"https://www.sonicscan.org/",eip1559:!0},scroll:{id:534352,name:"scroll",shortname:"scroll",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://icons.llamao.fi/icons/chains/rsz_scroll"},wToken:{symbol:"WETH",address:"0x5300000000000000000000000000000000000004",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://scroll-rpc.publicnode.com",logoUrl:"https://icons.llamao.fi/icons/chains/rsz_scroll",explorer:"https://scrollscan.com/",eip1559:!0},zircuit:{id:48900,name:"Zircuit",shortname:"zircuit",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg"},wToken:{symbol:"WETH",address:"0x4200000000000000000000000000000000000006",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://zircuit-mainnet.drpc.org",logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg",explorer:"https://explorer.zircuit.com/",eip1559:!0},flare:{id:14,name:"flare",shortname:"flare",native:{address:ne,symbol:"FLR",decimals:18,logoUrl:"https://icons.llamao.fi/icons/chains/rsz_flare?w=48&h=48"},wToken:{symbol:"WFLR",address:"0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d",decimals:18,logoUrl:"https://res.cloudinary.com/sparkdex/image/upload/q_100/v1/website-assets/coins/wflr?_a=DATAg1AAZAA0"},publicRpcUrl:"https://flare.network",logoUrl:"https://icons.llamao.fi/icons/chains/rsz_flare?w=48&h=48",explorer:"https://flarescan.com",eip1559:!0},cronosZkEvm:{id:388,name:"Cronos zkEVM",shortname:"cronosZkEvm",native:{address:"0x000000000000000000000000000000000000800a",symbol:"zkCRO",decimals:18,logoUrl:"https://cryptologos.cc/logos/cronos-cro-logo.png"},wToken:{symbol:"wzkCRO",address:"0xC1bF55EE54E16229d9b369a5502Bfe5fC9F20b6d",decimals:18,logoUrl:"https://cryptologos.cc/logos/cronos-cro-logo.png"},publicRpcUrl:"https://rpc.zkevm.cronos.org",logoUrl:"https://cryptologos.cc/logos/cronos-cro-logo.png",explorer:"https://explorer.zkevm.cronos.org",eip1559:!0},katana:{id:747474,name:"Katana",shortname:"katana",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://katana.network/assets/katana-logo.svg"},wToken:{symbol:"WETH",address:"0xee7d8bcfb72bc1880d0cf19822eb0a2e6577ab62",decimals:18,logoUrl:"https://katana.network/assets/weth-logo.svg"},publicRpcUrl:"https://rpc.katanarpc.com",logoUrl:"https://katana.network/assets/katana-logo.svg",explorer:"https://explorer.katana.garden",eip1559:!0},bera:{id:80094,name:"Bera",shortname:"bera",native:{address:ne,symbol:"BERA",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/24647.png"},wToken:{symbol:"WBERA",address:"0x6969696969696969696969696969696969696969",decimals:18,logoUrl:"https://berascan.com/token/images/wrappedbera_ofc_64.png"},publicRpcUrl:"https://rpc.berachain.com",logoUrl:"https://berascan.com/token/images/wrappedbera_ofc_64.png",explorer:"https://berascan.com",eip1559:!0},monad:{id:143,name:"Monad",shortname:"monad",native:{address:ne,symbol:"MONAD",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/30495.png"},wToken:{symbol:"WMON",address:"0x3bd359c1119da7da1d913d1c4d2b7c461115433a",decimals:18,logoUrl:"https://assets.coingecko.com/coins/images/70784/standard/wmon.png?1766028904"},publicRpcUrl:"https://monad-mainnet.drpc.org",logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/30495.png",explorer:"https://monad.network",eip1559:!0},optimism:{id:10,name:"Optimism",shortname:"optimism",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/11840.png"},wToken:{symbol:"WETH",address:"0x4200000000000000000000000000000000000006",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/2396.png"},publicRpcUrl:"https://optimism.blockscout.com",logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/11840.png",explorer:"https://optimistic.etherscan.io",eip1559:!0},mantle:{id:5e3,name:"Mantle",shortname:"mantle",native:{address:ne,symbol:"MNT",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/27075.png"},wToken:{symbol:"WMNT",address:"0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/27614.png"},publicRpcUrl:"https://rpc.mantle.xyz",logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/27075.png",explorer:"https://mantlescan.xyz",eip1559:!0}},_n={version:"2.7.2"},Or="https://order-sink-dev.orbs.network",fn="https://order-sink.orbs.network",Br="https://order-sink-v2.orbs.network",pn=_n.version.split(".")[0],Zs=e=>{const t=Number(pn)>=2;return e?Or:t?Br:fn},Ys=e=>{const t=Number(pn)>=2;return e?[Or]:t?[Br,fn]:[fn]},Js={[Pe.Thena]:"0xB75218ba5A99bF57Fd02556B70F05A4A0f1Dbe67"},ea=({endpoint:e,exchange:t,partner:n})=>e===fn&&n&&Js[n]||t,Un=300*1e3,hn=1440*60*60*1e3,Ir=300*1e3,ta=Un/(60*1e3),Rn=e=>`https://hub.orbs.network/api/private/project_cm7nb67z86nyr01z12gs0fxpf/subgraphs/orbs-twap-${e}/prod/gn`,Ue="https://hub.orbs.network/api/apikey/subgraphs/id",na={[ye.eth.id]:`${Ue}/Bf7bvMYcJbDAvYWJmhMpHZ4cpFjqzkhK6GXXEpnPRq6`,[ye.bsc.id]:`${Ue}/4NfXEi8rreQsnAr4aJ45RLCKgnjcWX46Lbt9SadiCcz6`,[ye.poly.id]:`${Ue}/3PyRPWSvDnMowGbeBy7aNsvUkD5ZuxdXQw2RdJq4NdXi`,[ye.arb.id]:`${Ue}/83bpQexEaqBjHaQbKoFTbtvCXuo5RudRkfLgtRUYqo2c`,[ye.base.id]:`${Ue}/DFhaPQb3HATXkpsWNZw3gydYHehLBVEDiSk4iBdZJyps`,[ye.sei.id]:`${Ue}/5zjzRnURzoddyFSZBw5E5NAM3oBgPq3NasTYbtMk6EL6`,[ye.linea.id]:`${Ue}/6VsNPEYfFLPZCqdMMDadoXQjLHWJdjEwiD768GAtb7j6`,[ye.sonic.id]:`${Ue}/DtBr6a5vsoDd2oAXdPszcn4gLgrr1XC68Q3AJQKXnNLV`,[ye.ftm.id]:`${Ue}/DdRo1pmJkrJC9fjsjEBWnNE1uqrbh7Diz4tVKd7rfupp`,[ye.katana.id]:`${Ue}/CGi9sDFMQcnBwF3C3NoCFqnaE34sssbgwPLTwiskSXmW`,[ye.avax.id]:`${Ue}/FxZ1vMwE5Xy1qvKvZENUMz4vhW8Sh4vXJf9Vp7o17pTx`,[ye.bera.id]:Rn("berachain"),[ye.flare.id]:Rn("flare"),[ye.cronosZkEvm.id]:Rn("cronos-zkevm")},ra=["0x0000000000000000000000000000000000000000","0x0000000000000000000000000000000000001010","0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","0x000000000000000000000000000000000000dEaD","0x000000000000000000000000000000000000800A","0x000000000000000000000000000000000000800a"],Mr="115792089237316195423570985008687907853269984665640564039457584007913129639935",Ee=e=>`${e.name}_${e.chainId}`,sa={[Ee($.SushiArb)]:["0x846F2B29ef314bF3D667981b4ffdADc5B858312a","0x08c41f5D1C844061f6D952E25827eeAA576c6536"],[Ee($.SushiBase)]:["0x846F2B29ef314bF3D667981b4ffdADc5B858312a","0x08c41f5D1C844061f6D952E25827eeAA576c6536"],[Ee($.SushiEth)]:["0xc55943Fa6509004B2903ED8F8ab7347BfC47D0bA","0x08c41f5D1C844061f6D952E25827eeAA576c6536"],[Ee($.PancakeSwap)]:["0xb2BAFe188faD927240038cC4FfF2d771d8A58905","0xE2a0c3b9aD19A18c4bBa7fffBe5bC1b0E58Db1CE"],[Ee($.PancakeSwapArbitrum)]:["0xE20167871dB616DdfFD0Fd870d9bC068C350DD1F","0x807488ADAD033e95C438F998277bE654152594dc"],[Ee($.PancakeSwapBase)]:["0x10ed1F36e4eBE76E161c9AADDa20BE841bc0082c","0x3A9df3eE209b802D0337383f5abCe3204d623588"],[Ee($.PancakeSwapLinea)]:["0x3A9df3eE209b802D0337383f5abCe3204d623588"],[Ee($.QuickSwap)]:["0x26D0ec4Be402BCE03AAa8aAf0CF67e9428ba54eF"],[Ee($.Thena)]:["0xc2aBC02acd77Bb2407efA22348dA9afC8B375290"],[Ee($.Lynex)]:["0x72e3e1fD5D2Ee2F1C2Eb695206D490a1D45C3835"],[Ee($.DragonSwap)]:["0x101e1B65Bb516FB5f4547C80BAe0b51f1b8D7a22"],[Ee($.SpookySwapSonic)]:["0xAd97B770ad64aE47fc7d64B3bD820dCDbF9ff7DA"],[Ee($.SpookySwap)]:["0x3924d62219483015f982b160d48c0fa5Fd436Cba"],[Ee($.SwapX)]:["0xE5012eBDe5e26EE3Ea41992154731a03023CF274"]},Ln={unit:ve.Minutes,value:ta},aa="RePermitWitnessTransferFrom",ia={RePermitWitnessTransferFrom:[{name:"permitted",type:"TokenPermissions"},{name:"spender",type:"address"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"},{name:"witness",type:"Order"}],Exchange:[{name:"adapter",type:"address"},{name:"ref",type:"address"},{name:"share",type:"uint32"},{name:"data",type:"bytes"}],Input:[{name:"token",type:"address"},{name:"amount",type:"uint256"},{name:"maxAmount",type:"uint256"}],Order:[{name:"reactor",type:"address"},{name:"executor",type:"address"},{name:"exchange",type:"Exchange"},{name:"swapper",type:"address"},{name:"nonce",type:"uint256"},{name:"start",type:"uint256"},{name:"deadline",type:"uint256"},{name:"chainid",type:"uint256"},{name:"exclusivity",type:"uint32"},{name:"epoch",type:"uint32"},{name:"slippage",type:"uint32"},{name:"freshness",type:"uint32"},{name:"input",type:"Input"},{name:"output",type:"Output"}],Output:[{name:"token",type:"address"},{name:"limit",type:"uint256"},{name:"triggerLower",type:"uint256"},{name:"triggerUpper",type:"uint256"},{name:"recipient",type:"address"}],TokenPermissions:[{name:"token",type:"address"},{name:"amount",type:"uint256"}]},oa="https://www.orbs.com/dtwap-and-dlimit-faq/",ca="https://www.orbs.com/dtwap-and-dlimit-faq/#dSLTP",ua="https://raw.githubusercontent.com/orbs-network/twap-ui/master/logo/orbslogo.svg",da="https://www.orbs.com/",la="https://www.orbs.com/dtwap-dlimit-disclaimer";var tn=(e=>(e.FRESHNESS="freshness",e.MIN_CHUNK_SIZE_USD="minChunkSizeUsd",e.ENV="env",e.DURATION="duration",e.IGNORE_ERRORS="ignore-errors",e))(tn||{});const fa="-5",pa="10",ha="-10",ma="5";var ya=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Nn=Math.ceil,Oe=Math.floor,Fe="[BigNumber Error] ",kr=Fe+"Number primitive has more than 15 significant digits: ",Re=1e14,z=14,qn=9007199254740991,Kn=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],tt=1e7,fe=1e9;function _r(e){var t,n,r,s=F.prototype={constructor:F,toString:null,valueOf:null},a=new F(1),o=20,d=4,f=-7,h=21,x=-1e7,y=1e7,E=!1,v=1,P=0,B={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},M="0123456789abcdefghijklmnopqrstuvwxyz",U=!0;function F(i,c){var u,b,m,A,w,p,g,T,C=this;if(!(C instanceof F))return new F(i,c);if(c==null){if(i&&i._isBigNumber===!0){C.s=i.s,!i.c||i.e>y?C.c=C.e=null:i.e<x?C.c=[C.e=0]:(C.e=i.e,C.c=i.c.slice());return}if((p=typeof i=="number")&&i*0==0){if(C.s=1/i<0?(i=-i,-1):1,i===~~i){for(A=0,w=i;w>=10;w/=10,A++);A>y?C.c=C.e=null:(C.e=A,C.c=[i]);return}T=String(i)}else{if(!ya.test(T=String(i)))return r(C,T,p);C.s=T.charCodeAt(0)==45?(T=T.slice(1),-1):1}(A=T.indexOf("."))>-1&&(T=T.replace(".","")),(w=T.search(/e/i))>0?(A<0&&(A=w),A+=+T.slice(w+1),T=T.substring(0,w)):A<0&&(A=T.length)}else{if(re(c,2,M.length,"Base"),c==10&&U)return C=new F(i),V(C,o+C.e+1,d);if(T=String(i),p=typeof i=="number"){if(i*0!=0)return r(C,T,p,c);if(C.s=1/i<0?(T=T.slice(1),-1):1,F.DEBUG&&T.replace(/^0\.0*|\./,"").length>15)throw Error(kr+i)}else C.s=T.charCodeAt(0)===45?(T=T.slice(1),-1):1;for(u=M.slice(0,c),A=w=0,g=T.length;w<g;w++)if(u.indexOf(b=T.charAt(w))<0){if(b=="."){if(w>A){A=g;continue}}else if(!m&&(T==T.toUpperCase()&&(T=T.toLowerCase())||T==T.toLowerCase()&&(T=T.toUpperCase()))){m=!0,w=-1,A=0;continue}return r(C,String(i),p,c)}p=!1,T=n(T,c,10,C.s),(A=T.indexOf("."))>-1?T=T.replace(".",""):A=T.length}for(w=0;T.charCodeAt(w)===48;w++);for(g=T.length;T.charCodeAt(--g)===48;);if(T=T.slice(w,++g)){if(g-=w,p&&F.DEBUG&&g>15&&(i>qn||i!==Oe(i)))throw Error(kr+C.s*i);if((A=A-w-1)>y)C.c=C.e=null;else if(A<x)C.c=[C.e=0];else{if(C.e=A,C.c=[],w=(A+1)%z,A<0&&(w+=z),w<g){for(w&&C.c.push(+T.slice(0,w)),g-=z;w<g;)C.c.push(+T.slice(w,w+=z));w=z-(T=T.slice(w)).length}else w-=g;for(;w--;T+="0");C.c.push(+T)}}else C.c=[C.e=0]}F.clone=_r,F.ROUND_UP=0,F.ROUND_DOWN=1,F.ROUND_CEIL=2,F.ROUND_FLOOR=3,F.ROUND_HALF_UP=4,F.ROUND_HALF_DOWN=5,F.ROUND_HALF_EVEN=6,F.ROUND_HALF_CEIL=7,F.ROUND_HALF_FLOOR=8,F.EUCLID=9,F.config=F.set=function(i){var c,u;if(i!=null)if(typeof i=="object"){if(i.hasOwnProperty(c="DECIMAL_PLACES")&&(u=i[c],re(u,0,fe,c),o=u),i.hasOwnProperty(c="ROUNDING_MODE")&&(u=i[c],re(u,0,8,c),d=u),i.hasOwnProperty(c="EXPONENTIAL_AT")&&(u=i[c],u&&u.pop?(re(u[0],-fe,0,c),re(u[1],0,fe,c),f=u[0],h=u[1]):(re(u,-fe,fe,c),f=-(h=u<0?-u:u))),i.hasOwnProperty(c="RANGE"))if(u=i[c],u&&u.pop)re(u[0],-fe,-1,c),re(u[1],1,fe,c),x=u[0],y=u[1];else if(re(u,-fe,fe,c),u)x=-(y=u<0?-u:u);else throw Error(Fe+c+" cannot be zero: "+u);if(i.hasOwnProperty(c="CRYPTO"))if(u=i[c],u===!!u)if(u)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))E=u;else throw E=!u,Error(Fe+"crypto unavailable");else E=u;else throw Error(Fe+c+" not true or false: "+u);if(i.hasOwnProperty(c="MODULO_MODE")&&(u=i[c],re(u,0,9,c),v=u),i.hasOwnProperty(c="POW_PRECISION")&&(u=i[c],re(u,0,fe,c),P=u),i.hasOwnProperty(c="FORMAT"))if(u=i[c],typeof u=="object")B=u;else throw Error(Fe+c+" not an object: "+u);if(i.hasOwnProperty(c="ALPHABET"))if(u=i[c],typeof u=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(u))U=u.slice(0,10)=="0123456789",M=u;else throw Error(Fe+c+" invalid: "+u)}else throw Error(Fe+"Object expected: "+i);return{DECIMAL_PLACES:o,ROUNDING_MODE:d,EXPONENTIAL_AT:[f,h],RANGE:[x,y],CRYPTO:E,MODULO_MODE:v,POW_PRECISION:P,FORMAT:B,ALPHABET:M}},F.isBigNumber=function(i){if(!i||i._isBigNumber!==!0)return!1;if(!F.DEBUG)return!0;var c,u,b=i.c,m=i.e,A=i.s;e:if({}.toString.call(b)=="[object Array]"){if((A===1||A===-1)&&m>=-fe&&m<=fe&&m===Oe(m)){if(b[0]===0){if(m===0&&b.length===1)return!0;break e}if(c=(m+1)%z,c<1&&(c+=z),String(b[0]).length==c){for(c=0;c<b.length;c++)if(u=b[c],u<0||u>=Re||u!==Oe(u))break e;if(u!==0)return!0}}}else if(b===null&&m===null&&(A===null||A===1||A===-1))return!0;throw Error(Fe+"Invalid BigNumber: "+i)},F.maximum=F.max=function(){return _(arguments,-1)},F.minimum=F.min=function(){return _(arguments,1)},F.random=(function(){var i=9007199254740992,c=Math.random()*i&2097151?function(){return Oe(Math.random()*i)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(u){var b,m,A,w,p,g=0,T=[],C=new F(a);if(u==null?u=o:re(u,0,fe),w=Nn(u/z),E)if(crypto.getRandomValues){for(b=crypto.getRandomValues(new Uint32Array(w*=2));g<w;)p=b[g]*131072+(b[g+1]>>>11),p>=9e15?(m=crypto.getRandomValues(new Uint32Array(2)),b[g]=m[0],b[g+1]=m[1]):(T.push(p%1e14),g+=2);g=w/2}else if(crypto.randomBytes){for(b=crypto.randomBytes(w*=7);g<w;)p=(b[g]&31)*281474976710656+b[g+1]*1099511627776+b[g+2]*4294967296+b[g+3]*16777216+(b[g+4]<<16)+(b[g+5]<<8)+b[g+6],p>=9e15?crypto.randomBytes(7).copy(b,g):(T.push(p%1e14),g+=7);g=w/7}else throw E=!1,Error(Fe+"crypto unavailable");if(!E)for(;g<w;)p=c(),p<9e15&&(T[g++]=p%1e14);for(w=T[--g],u%=z,w&&u&&(p=Kn[z-u],T[g]=Oe(w/p)*p);T[g]===0;T.pop(),g--);if(g<0)T=[A=0];else{for(A=-1;T[0]===0;T.splice(0,1),A-=z);for(g=1,p=T[0];p>=10;p/=10,g++);g<z&&(A-=z-g)}return C.e=A,C.c=T,C}})(),F.sum=function(){for(var i=1,c=arguments,u=new F(c[0]);i<c.length;)u=u.plus(c[i++]);return u},n=(function(){var i="0123456789";function c(u,b,m,A){for(var w,p=[0],g,T=0,C=u.length;T<C;){for(g=p.length;g--;p[g]*=b);for(p[0]+=A.indexOf(u.charAt(T++)),w=0;w<p.length;w++)p[w]>m-1&&(p[w+1]==null&&(p[w+1]=0),p[w+1]+=p[w]/m|0,p[w]%=m)}return p.reverse()}return function(u,b,m,A,w){var p,g,T,C,O,R,L,X,ae=u.indexOf("."),le=o,J=d;for(ae>=0&&(C=P,P=0,u=u.replace(".",""),X=new F(b),R=X.pow(u.length-ae),P=C,X.c=c(je(Ie(R.c),R.e,"0"),10,m,i),X.e=X.c.length),L=c(u,b,m,w?(p=M,i):(p=i,M)),T=C=L.length;L[--C]==0;L.pop());if(!L[0])return p.charAt(0);if(ae<0?--T:(R.c=L,R.e=T,R.s=A,R=t(R,X,le,J,m),L=R.c,O=R.r,T=R.e),g=T+le+1,ae=L[g],C=m/2,O=O||g<0||L[g+1]!=null,O=J<4?(ae!=null||O)&&(J==0||J==(R.s<0?3:2)):ae>C||ae==C&&(J==4||O||J==6&&L[g-1]&1||J==(R.s<0?8:7)),g<1||!L[0])u=O?je(p.charAt(1),-le,p.charAt(0)):p.charAt(0);else{if(L.length=g,O)for(--m;++L[--g]>m;)L[g]=0,g||(++T,L=[1].concat(L));for(C=L.length;!L[--C];);for(ae=0,u="";ae<=C;u+=p.charAt(L[ae++]));u=je(u,T,p.charAt(0))}return u}})(),t=(function(){function i(b,m,A){var w,p,g,T,C=0,O=b.length,R=m%tt,L=m/tt|0;for(b=b.slice();O--;)g=b[O]%tt,T=b[O]/tt|0,w=L*g+T*R,p=R*g+w%tt*tt+C,C=(p/A|0)+(w/tt|0)+L*T,b[O]=p%A;return C&&(b=[C].concat(b)),b}function c(b,m,A,w){var p,g;if(A!=w)g=A>w?1:-1;else for(p=g=0;p<A;p++)if(b[p]!=m[p]){g=b[p]>m[p]?1:-1;break}return g}function u(b,m,A,w){for(var p=0;A--;)b[A]-=p,p=b[A]<m[A]?1:0,b[A]=p*w+b[A]-m[A];for(;!b[0]&&b.length>1;b.splice(0,1));}return function(b,m,A,w,p){var g,T,C,O,R,L,X,ae,le,J,te,be,Bn,gr,br,$e,dn,_e=b.s==m.s?1:-1,we=b.c,ie=m.c;if(!we||!we[0]||!ie||!ie[0])return new F(!b.s||!m.s||(we?ie&&we[0]==ie[0]:!ie)?NaN:we&&we[0]==0||!ie?_e*0:_e/0);for(ae=new F(_e),le=ae.c=[],T=b.e-m.e,_e=A+T+1,p||(p=Re,T=Be(b.e/z)-Be(m.e/z),_e=_e/z|0),C=0;ie[C]==(we[C]||0);C++);if(ie[C]>(we[C]||0)&&T--,_e<0)le.push(1),O=!0;else{for(gr=we.length,$e=ie.length,C=0,_e+=2,R=Oe(p/(ie[0]+1)),R>1&&(ie=i(ie,R,p),we=i(we,R,p),$e=ie.length,gr=we.length),Bn=$e,J=we.slice(0,$e),te=J.length;te<$e;J[te++]=0);dn=ie.slice(),dn=[0].concat(dn),br=ie[0],ie[1]>=p/2&&br++;do{if(R=0,g=c(ie,J,$e,te),g<0){if(be=J[0],$e!=te&&(be=be*p+(J[1]||0)),R=Oe(be/br),R>1)for(R>=p&&(R=p-1),L=i(ie,R,p),X=L.length,te=J.length;c(L,J,X,te)==1;)R--,u(L,$e<X?dn:ie,X,p),X=L.length,g=1;else R==0&&(g=R=1),L=ie.slice(),X=L.length;if(X<te&&(L=[0].concat(L)),u(J,L,te,p),te=J.length,g==-1)for(;c(ie,J,$e,te)<1;)R++,u(J,$e<te?dn:ie,te,p),te=J.length}else g===0&&(R++,J=[0]);le[C++]=R,J[0]?J[te++]=we[Bn]||0:(J=[we[Bn]],te=1)}while((Bn++<gr||J[0]!=null)&&_e--);O=J[0]!=null,le[0]||le.splice(0,1)}if(p==Re){for(C=1,_e=le[0];_e>=10;_e/=10,C++);V(ae,A+(ae.e=C+T*z-1)+1,w,O)}else ae.e=T,ae.r=+O;return ae}})();function H(i,c,u,b){var m,A,w,p,g;if(u==null?u=d:re(u,0,8),!i.c)return i.toString();if(m=i.c[0],w=i.e,c==null)g=Ie(i.c),g=b==1||b==2&&(w<=f||w>=h)?yn(g,w):je(g,w,"0");else if(i=V(new F(i),c,u),A=i.e,g=Ie(i.c),p=g.length,b==1||b==2&&(c<=A||A<=f)){for(;p<c;g+="0",p++);g=yn(g,A)}else if(c-=w+(b===2&&A>w),g=je(g,A,"0"),A+1>p){if(--c>0)for(g+=".";c--;g+="0");}else if(c+=A-p,c>0)for(A+1==p&&(g+=".");c--;g+="0");return i.s<0&&m?"-"+g:g}function _(i,c){for(var u,b,m=1,A=new F(i[0]);m<i.length;m++)b=new F(i[m]),(!b.s||(u=yt(A,b))===c||u===0&&A.s===c)&&(A=b);return A}function Y(i,c,u){for(var b=1,m=c.length;!c[--m];c.pop());for(m=c[0];m>=10;m/=10,b++);return(u=b+u*z-1)>y?i.c=i.e=null:u<x?i.c=[i.e=0]:(i.e=u,i.c=c),i}r=(function(){var i=/^(-?)0([xbo])(?=\w[\w.]*$)/i,c=/^([^.]+)\.$/,u=/^\.([^.]+)$/,b=/^-?(Infinity|NaN)$/,m=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(A,w,p,g){var T,C=p?w:w.replace(m,"");if(b.test(C))A.s=isNaN(C)?null:C<0?-1:1;else{if(!p&&(C=C.replace(i,function(O,R,L){return T=(L=L.toLowerCase())=="x"?16:L=="b"?2:8,!g||g==T?R:O}),g&&(T=g,C=C.replace(c,"$1").replace(u,"0.$1")),w!=C))return new F(C,T);if(F.DEBUG)throw Error(Fe+"Not a"+(g?" base "+g:"")+" number: "+w);A.s=null}A.c=A.e=null}})();function V(i,c,u,b){var m,A,w,p,g,T,C,O=i.c,R=Kn;if(O){e:{for(m=1,p=O[0];p>=10;p/=10,m++);if(A=c-m,A<0)A+=z,w=c,g=O[T=0],C=Oe(g/R[m-w-1]%10);else if(T=Nn((A+1)/z),T>=O.length)if(b){for(;O.length<=T;O.push(0));g=C=0,m=1,A%=z,w=A-z+1}else break e;else{for(g=p=O[T],m=1;p>=10;p/=10,m++);A%=z,w=A-z+m,C=w<0?0:Oe(g/R[m-w-1]%10)}if(b=b||c<0||O[T+1]!=null||(w<0?g:g%R[m-w-1]),b=u<4?(C||b)&&(u==0||u==(i.s<0?3:2)):C>5||C==5&&(u==4||b||u==6&&(A>0?w>0?g/R[m-w]:0:O[T-1])%10&1||u==(i.s<0?8:7)),c<1||!O[0])return O.length=0,b?(c-=i.e+1,O[0]=R[(z-c%z)%z],i.e=-c||0):O[0]=i.e=0,i;if(A==0?(O.length=T,p=1,T--):(O.length=T+1,p=R[z-A],O[T]=w>0?Oe(g/R[m-w]%R[w])*p:0),b)for(;;)if(T==0){for(A=1,w=O[0];w>=10;w/=10,A++);for(w=O[0]+=p,p=1;w>=10;w/=10,p++);A!=p&&(i.e++,O[0]==Re&&(O[0]=1));break}else{if(O[T]+=p,O[T]!=Re)break;O[T--]=0,p=1}for(A=O.length;O[--A]===0;O.pop());}i.e>y?i.c=i.e=null:i.e<x&&(i.c=[i.e=0])}return i}function oe(i){var c,u=i.e;return u===null?i.toString():(c=Ie(i.c),c=u<=f||u>=h?yn(c,u):je(c,u,"0"),i.s<0?"-"+c:c)}return s.absoluteValue=s.abs=function(){var i=new F(this);return i.s<0&&(i.s=1),i},s.comparedTo=function(i,c){return yt(this,new F(i,c))},s.decimalPlaces=s.dp=function(i,c){var u,b,m,A=this;if(i!=null)return re(i,0,fe),c==null?c=d:re(c,0,8),V(new F(A),i+A.e+1,c);if(!(u=A.c))return null;if(b=((m=u.length-1)-Be(this.e/z))*z,m=u[m])for(;m%10==0;m/=10,b--);return b<0&&(b=0),b},s.dividedBy=s.div=function(i,c){return t(this,new F(i,c),o,d)},s.dividedToIntegerBy=s.idiv=function(i,c){return t(this,new F(i,c),0,1)},s.exponentiatedBy=s.pow=function(i,c){var u,b,m,A,w,p,g,T,C,O=this;if(i=new F(i),i.c&&!i.isInteger())throw Error(Fe+"Exponent not an integer: "+oe(i));if(c!=null&&(c=new F(c)),p=i.e>14,!O.c||!O.c[0]||O.c[0]==1&&!O.e&&O.c.length==1||!i.c||!i.c[0])return C=new F(Math.pow(+oe(O),p?i.s*(2-mn(i)):+oe(i))),c?C.mod(c):C;if(g=i.s<0,c){if(c.c?!c.c[0]:!c.s)return new F(NaN);b=!g&&O.isInteger()&&c.isInteger(),b&&(O=O.mod(c))}else{if(i.e>9&&(O.e>0||O.e<-1||(O.e==0?O.c[0]>1||p&&O.c[1]>=24e7:O.c[0]<8e13||p&&O.c[0]<=9999975e7)))return A=O.s<0&&mn(i)?-0:0,O.e>-1&&(A=1/A),new F(g?1/A:A);P&&(A=Nn(P/z+2))}for(p?(u=new F(.5),g&&(i.s=1),T=mn(i)):(m=Math.abs(+oe(i)),T=m%2),C=new F(a);;){if(T){if(C=C.times(O),!C.c)break;A?C.c.length>A&&(C.c.length=A):b&&(C=C.mod(c))}if(m){if(m=Oe(m/2),m===0)break;T=m%2}else if(i=i.times(u),V(i,i.e+1,1),i.e>14)T=mn(i);else{if(m=+oe(i),m===0)break;T=m%2}O=O.times(O),A?O.c&&O.c.length>A&&(O.c.length=A):b&&(O=O.mod(c))}return b?C:(g&&(C=a.div(C)),c?C.mod(c):A?V(C,P,d,w):C)},s.integerValue=function(i){var c=new F(this);return i==null?i=d:re(i,0,8),V(c,c.e+1,i)},s.isEqualTo=s.eq=function(i,c){return yt(this,new F(i,c))===0},s.isFinite=function(){return!!this.c},s.isGreaterThan=s.gt=function(i,c){return yt(this,new F(i,c))>0},s.isGreaterThanOrEqualTo=s.gte=function(i,c){return(c=yt(this,new F(i,c)))===1||c===0},s.isInteger=function(){return!!this.c&&Be(this.e/z)>this.c.length-2},s.isLessThan=s.lt=function(i,c){return yt(this,new F(i,c))<0},s.isLessThanOrEqualTo=s.lte=function(i,c){return(c=yt(this,new F(i,c)))===-1||c===0},s.isNaN=function(){return!this.s},s.isNegative=function(){return this.s<0},s.isPositive=function(){return this.s>0},s.isZero=function(){return!!this.c&&this.c[0]==0},s.minus=function(i,c){var u,b,m,A,w=this,p=w.s;if(i=new F(i,c),c=i.s,!p||!c)return new F(NaN);if(p!=c)return i.s=-c,w.plus(i);var g=w.e/z,T=i.e/z,C=w.c,O=i.c;if(!g||!T){if(!C||!O)return C?(i.s=-c,i):new F(O?w:NaN);if(!C[0]||!O[0])return O[0]?(i.s=-c,i):new F(C[0]?w:d==3?-0:0)}if(g=Be(g),T=Be(T),C=C.slice(),p=g-T){for((A=p<0)?(p=-p,m=C):(T=g,m=O),m.reverse(),c=p;c--;m.push(0));m.reverse()}else for(b=(A=(p=C.length)<(c=O.length))?p:c,p=c=0;c<b;c++)if(C[c]!=O[c]){A=C[c]<O[c];break}if(A&&(m=C,C=O,O=m,i.s=-i.s),c=(b=O.length)-(u=C.length),c>0)for(;c--;C[u++]=0);for(c=Re-1;b>p;){if(C[--b]<O[b]){for(u=b;u&&!C[--u];C[u]=c);--C[u],C[b]+=Re}C[b]-=O[b]}for(;C[0]==0;C.splice(0,1),--T);return C[0]?Y(i,C,T):(i.s=d==3?-1:1,i.c=[i.e=0],i)},s.modulo=s.mod=function(i,c){var u,b,m=this;return i=new F(i,c),!m.c||!i.s||i.c&&!i.c[0]?new F(NaN):!i.c||m.c&&!m.c[0]?new F(m):(v==9?(b=i.s,i.s=1,u=t(m,i,0,3),i.s=b,u.s*=b):u=t(m,i,0,v),i=m.minus(u.times(i)),!i.c[0]&&v==1&&(i.s=m.s),i)},s.multipliedBy=s.times=function(i,c){var u,b,m,A,w,p,g,T,C,O,R,L,X,ae,le,J=this,te=J.c,be=(i=new F(i,c)).c;if(!te||!be||!te[0]||!be[0])return!J.s||!i.s||te&&!te[0]&&!be||be&&!be[0]&&!te?i.c=i.e=i.s=null:(i.s*=J.s,!te||!be?i.c=i.e=null:(i.c=[0],i.e=0)),i;for(b=Be(J.e/z)+Be(i.e/z),i.s*=J.s,g=te.length,O=be.length,g<O&&(X=te,te=be,be=X,m=g,g=O,O=m),m=g+O,X=[];m--;X.push(0));for(ae=Re,le=tt,m=O;--m>=0;){for(u=0,R=be[m]%le,L=be[m]/le|0,w=g,A=m+w;A>m;)T=te[--w]%le,C=te[w]/le|0,p=L*T+C*R,T=R*T+p%le*le+X[A]+u,u=(T/ae|0)+(p/le|0)+L*C,X[A--]=T%ae;X[A]=u}return u?++b:X.splice(0,1),Y(i,X,b)},s.negated=function(){var i=new F(this);return i.s=-i.s||null,i},s.plus=function(i,c){var u,b=this,m=b.s;if(i=new F(i,c),c=i.s,!m||!c)return new F(NaN);if(m!=c)return i.s=-c,b.minus(i);var A=b.e/z,w=i.e/z,p=b.c,g=i.c;if(!A||!w){if(!p||!g)return new F(m/0);if(!p[0]||!g[0])return g[0]?i:new F(p[0]?b:m*0)}if(A=Be(A),w=Be(w),p=p.slice(),m=A-w){for(m>0?(w=A,u=g):(m=-m,u=p),u.reverse();m--;u.push(0));u.reverse()}for(m=p.length,c=g.length,m-c<0&&(u=g,g=p,p=u,c=m),m=0;c;)m=(p[--c]=p[c]+g[c]+m)/Re|0,p[c]=Re===p[c]?0:p[c]%Re;return m&&(p=[m].concat(p),++w),Y(i,p,w)},s.precision=s.sd=function(i,c){var u,b,m,A=this;if(i!=null&&i!==!!i)return re(i,1,fe),c==null?c=d:re(c,0,8),V(new F(A),i,c);if(!(u=A.c))return null;if(m=u.length-1,b=m*z+1,m=u[m]){for(;m%10==0;m/=10,b--);for(m=u[0];m>=10;m/=10,b++);}return i&&A.e+1>b&&(b=A.e+1),b},s.shiftedBy=function(i){return re(i,-qn,qn),this.times("1e"+i)},s.squareRoot=s.sqrt=function(){var i,c,u,b,m,A=this,w=A.c,p=A.s,g=A.e,T=o+4,C=new F("0.5");if(p!==1||!w||!w[0])return new F(!p||p<0&&(!w||w[0])?NaN:w?A:1/0);if(p=Math.sqrt(+oe(A)),p==0||p==1/0?(c=Ie(w),(c.length+g)%2==0&&(c+="0"),p=Math.sqrt(+c),g=Be((g+1)/2)-(g<0||g%2),p==1/0?c="5e"+g:(c=p.toExponential(),c=c.slice(0,c.indexOf("e")+1)+g),u=new F(c)):u=new F(p+""),u.c[0]){for(g=u.e,p=g+T,p<3&&(p=0);;)if(m=u,u=C.times(m.plus(t(A,m,T,1))),Ie(m.c).slice(0,p)===(c=Ie(u.c)).slice(0,p))if(u.e<g&&--p,c=c.slice(p-3,p+1),c=="9999"||!b&&c=="4999"){if(!b&&(V(m,m.e+o+2,0),m.times(m).eq(A))){u=m;break}T+=4,p+=4,b=1}else{(!+c||!+c.slice(1)&&c.charAt(0)=="5")&&(V(u,u.e+o+2,1),i=!u.times(u).eq(A));break}}return V(u,u.e+o+1,d,i)},s.toExponential=function(i,c){return i!=null&&(re(i,0,fe),i++),H(this,i,c,1)},s.toFixed=function(i,c){return i!=null&&(re(i,0,fe),i=i+this.e+1),H(this,i,c)},s.toFormat=function(i,c,u){var b,m=this;if(u==null)i!=null&&c&&typeof c=="object"?(u=c,c=null):i&&typeof i=="object"?(u=i,i=c=null):u=B;else if(typeof u!="object")throw Error(Fe+"Argument not an object: "+u);if(b=m.toFixed(i,c),m.c){var A,w=b.split("."),p=+u.groupSize,g=+u.secondaryGroupSize,T=u.groupSeparator||"",C=w[0],O=w[1],R=m.s<0,L=R?C.slice(1):C,X=L.length;if(g&&(A=p,p=g,g=A,X-=A),p>0&&X>0){for(A=X%p||p,C=L.substr(0,A);A<X;A+=p)C+=T+L.substr(A,p);g>0&&(C+=T+L.slice(A)),R&&(C="-"+C)}b=O?C+(u.decimalSeparator||"")+((g=+u.fractionGroupSize)?O.replace(new RegExp("\\d{"+g+"}\\B","g"),"$&"+(u.fractionGroupSeparator||"")):O):C}return(u.prefix||"")+b+(u.suffix||"")},s.toFraction=function(i){var c,u,b,m,A,w,p,g,T,C,O,R,L=this,X=L.c;if(i!=null&&(p=new F(i),!p.isInteger()&&(p.c||p.s!==1)||p.lt(a)))throw Error(Fe+"Argument "+(p.isInteger()?"out of range: ":"not an integer: ")+oe(p));if(!X)return new F(L);for(c=new F(a),T=u=new F(a),b=g=new F(a),R=Ie(X),A=c.e=R.length-L.e-1,c.c[0]=Kn[(w=A%z)<0?z+w:w],i=!i||p.comparedTo(c)>0?A>0?c:T:p,w=y,y=1/0,p=new F(R),g.c[0]=0;C=t(p,c,0,1),m=u.plus(C.times(b)),m.comparedTo(i)!=1;)u=b,b=m,T=g.plus(C.times(m=T)),g=m,c=p.minus(C.times(m=c)),p=m;return m=t(i.minus(u),b,0,1),g=g.plus(m.times(T)),u=u.plus(m.times(b)),g.s=T.s=L.s,A=A*2,O=t(T,b,A,d).minus(L).abs().comparedTo(t(g,u,A,d).minus(L).abs())<1?[T,b]:[g,u],y=w,O},s.toNumber=function(){return+oe(this)},s.toPrecision=function(i,c){return i!=null&&re(i,1,fe),H(this,i,c,2)},s.toString=function(i){var c,u=this,b=u.s,m=u.e;return m===null?b?(c="Infinity",b<0&&(c="-"+c)):c="NaN":(i==null?c=m<=f||m>=h?yn(Ie(u.c),m):je(Ie(u.c),m,"0"):i===10&&U?(u=V(new F(u),o+m+1,d),c=je(Ie(u.c),u.e,"0")):(re(i,2,M.length,"Base"),c=n(je(Ie(u.c),m,"0"),10,i,b,!0)),b<0&&u.c[0]&&(c="-"+c)),c},s.valueOf=s.toJSON=function(){return oe(this)},s._isBigNumber=!0,s[Symbol.toStringTag]="BigNumber",s[Symbol.for("nodejs.util.inspect.custom")]=s.valueOf,e!=null&&F.set(e),F}function Be(e){var t=e|0;return e>0||e===t?t:t-1}function Ie(e){for(var t,n,r=1,s=e.length,a=e[0]+"";r<s;){for(t=e[r++]+"",n=z-t.length;n--;t="0"+t);a+=t}for(s=a.length;a.charCodeAt(--s)===48;);return a.slice(0,s+1||1)}function yt(e,t){var n,r,s=e.c,a=t.c,o=e.s,d=t.s,f=e.e,h=t.e;if(!o||!d)return null;if(n=s&&!s[0],r=a&&!a[0],n||r)return n?r?0:-d:o;if(o!=d)return o;if(n=o<0,r=f==h,!s||!a)return r?0:!s^n?1:-1;if(!r)return f>h^n?1:-1;for(d=(f=s.length)<(h=a.length)?f:h,o=0;o<d;o++)if(s[o]!=a[o])return s[o]>a[o]^n?1:-1;return f==h?0:f>h^n?1:-1}function re(e,t,n,r){if(e<t||e>n||e!==Oe(e))throw Error(Fe+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function mn(e){var t=e.c.length-1;return Be(e.e/z)==t&&e.c[t]%2!=0}function yn(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function je(e,t,n){var r,s;if(t<0){for(s=n+".";++t;s+=n);e=s+e}else if(r=e.length,++t>r){for(s=n,t-=r;--t;s+=n);e+=s}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var S=_r();function Aa(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}const ga={1:{adapter:{Nordstern:"0x6603629C8d4b683fdc51c7F810D1799cfEAcEAe3",Sushi:"0x11985E88847aEC23D1C3BCD77Ca0F4A704aB751c",Ring:"0x47e27973dA3e16dB13F8b713877b3A31623E0E5B",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",Magpie:"0x8622CBd71D8Aba76Ce1C2235510f2b2C6335C31E",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d",Paraswap:"0x777A3e65a5473148D5d7abdFD2BB5bFB61b6432f"},dex:{sushiswap:{type:"default",solver:"Sushi",router:"0xAC4c6e212A361c968F1725b4d055b47E63F80b75",adapter:"0x2e43A28FAf083717CcD9B246d97C61E1Bc9914Df",fee:"0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc"},ring:{type:"dynamicp2",solver:"Ring",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",adapter:"0x028fa69049aB68EC42064Eb18896D587dD41Af2a",fee:"0xA04329696aAd1417c75Cf6d91342815001999B21"}}},10:{adapter:{Nordstern:"0x1D06d98D523F8B51AD693D4A22fb97fCf0838d83",Sushi:"0x11985E88847aEC23D1C3BCD77Ca0F4A704aB751c",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",Magpie:"0x8622CBd71D8Aba76Ce1C2235510f2b2C6335C31E",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d",Paraswap:"0x777A3e65a5473148D5d7abdFD2BB5bFB61b6432f"},dex:{}},14:{adapter:{Nordstern:"0xd16A1849E86431872a87f476fa0DfB30eEb96cb3",SparkDex:"0x00c7617C471Ef69124464CEc318a3b8CC90aE9A7",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d"},dex:{spark:{type:"default",solver:"SparkDex",router:"0x0f3D8a38D4c74afBebc2c42695642f0e3acb15D3",adapter:"0x00c7617C471Ef69124464CEc318a3b8CC90aE9A7",fee:"0xaeA8C3e1a129A77686E115b1a46D9aD8405F7D2b"}}},56:{adapter:{Nordstern:"0x20253Cd6EEEB89e61ce7DDCf74a25Baba6A05BDF",Orbs:"0xaf3532dca7b4a75cD06671614C093e9e8fb5b1F2",Ring:"0x47e27973dA3e16dB13F8b713877b3A31623E0E5B",Topaz:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",Magpie:"0xBB5f16d51cF0eEfcC894268a72a9cF42d9a6F4f0",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d",Paraswap:"0x777A3e65a5473148D5d7abdFD2BB5bFB61b6432f",Sushi:"0xA985f801ea74321AdcC9Ef88B394858CbA3F71ba"},dex:{thena:{type:"universal",adapter:"0xEC85273E085eD7f7b9879c4A67a3E5D9f3AD242A",fee:"0x15eBc8b5b3877512FFF23650188694A9a8891FAc"},pancake:{type:"p2",solver:"Orbs",router:"0xd9C500DfF816a1Da21A48A732d3498Bf09dc9AEB",permit2:"0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",adapter:"0x52Ed96B1AEd25818B6A284b063b055488E012b73",fee:"0x37A957f10F458e0d7fDECBE2917971b57F15c927"},ring:{type:"dynamicp2",solver:"Ring",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",adapter:"0x028fa69049aB68EC42064Eb18896D587dD41Af2a",fee:"0xA04329696aAd1417c75Cf6d91342815001999B21"},topaz:{type:"default",solver:"Topaz",router:"0x6352a56caadC4F1E25CD6c75970Fa768A3304e64",adapter:"0x671c59dCbc8ee3a08D15e1D03a88032740869919",fee:"0xDbB17E23d12cd3C0AA856528F7177a68f98fFd5B"}}},130:{adapter:{Nordstern:"0x763Fb927d181bCE8be779794A030BCE45D4869fA",Ring:"0x47e27973dA3e16dB13F8b713877b3A31623E0E5B",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",Magpie:"0x6795A03Af6E1332BD931C0891D5C6AFF85550b54",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d",Paraswap:"0x777A3e65a5473148D5d7abdFD2BB5bFB61b6432f"},dex:{ring:{type:"dynamicp2",solver:"Ring",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",adapter:"0x028fa69049aB68EC42064Eb18896D587dD41Af2a",fee:"0xA04329696aAd1417c75Cf6d91342815001999B21"}}},137:{adapter:{Nordstern:"0xf065b4bFa073b5A0A3eb254D67cbc5118D8B0Ea7",Paraswap:"0x179C4b8e982b5F1365d36CC8d0c1CEB621B7198D",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",Magpie:"0x8622CBd71D8Aba76Ce1C2235510f2b2C6335C31E",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d",Sushi:"0xA985f801ea74321AdcC9Ef88B394858CbA3F71ba"},dex:{quick:{type:"paraswap",solver:"Paraswap",router:"0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57",adapter:"0x727e1CbA41Ff1ff11C32fa43DAb499b4317A1b65",fee:"0xd207DC6a6dA88f27c8DB78201F974161b1d84b1f"},teafi:{type:"paraswap",solver:"Paraswap",router:"0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57",adapter:"0xF710D67C783D2C14671EC1c61B0683DCb996F5c3",fee:"0x04Ff96e2c4D62b5771795d307AD679a25b3D2D50"}}},143:{adapter:{Nordstern:"0xd16A1849E86431872a87f476fa0DfB30eEb96cb3",OpenOcean:"0xc7f07C830e22FCA94bF52F38C6707F9D396c6172",Kyber:"0x6f4e5b8d7F6b037c62277992c39E7834D7C04596",Magpie:"0x6795A03Af6E1332BD931C0891D5C6AFF85550b54",Sushi:"0xA985f801ea74321AdcC9Ef88B394858CbA3F71ba"},dex:{yowie:{type:"default",solver:"OpenOcean",router:"0x6352a56caadC4F1E25CD6c75970Fa768A3304e64",adapter:"0xCA84Ab5a5A5bf2cff6AC0C835eF049365D13c6cB",fee:"0x6AF3eE77A3A3257777F5649aFa611b4C7Fd975Ef"},pangolin:{type:"default",solver:"Kyber",router:"0x6131B5fae19EA4f9D964eAc0408E4408b66337b5",adapter:"0xf42106eBf985bF49b39eba0114F57FA05e7B52eD",fee:"0xde92da99D188Ceb54A11ec711EF52D808A6260B5"}}},146:{adapter:{Nordstern:"0xEAEEdF2b8818970356212d5C2f449E2BE68D6800",OpenOcean:"0xc7f07C830e22FCA94bF52F38C6707F9D396c6172",Magpie:"0x217E9311396C8722b9eC98aFf865F067fe5E59c1",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",Sushi:"0xA985f801ea74321AdcC9Ef88B394858CbA3F71ba",Paraswap:"0x777A3e65a5473148D5d7abdFD2BB5bFB61b6432f"},dex:{spooky:{type:"default",solver:"Magpie",router:"0x20f6ee51340adeed01a59b0e65cb3703f3dc860c",adapter:"0x0F6533Fd45D13ad6AAa364023d6c05eCB2d3Ac2E",fee:"0x840Df4684B35BC68BcdA3F6707A3c82A0D662f8b"},swapx:{type:"default",solver:"OpenOcean",router:"0x6352a56caadC4F1E25CD6c75970Fa768A3304e64",adapter:"0xa7AE3ABf86C81cCEFEd6bE77045F2a32660c1B1c",fee:"0x6E03f7BC0f141894612AA017796096399623895F"},shadow:{type:"default",solver:"Magpie",router:"0x20f6ee51340adeed01a59b0e65cb3703f3dc860c",adapter:"0x39b024E187e5f35fea05953fECB9314a97de3d94",fee:"0xb9e3751fAF3187E1bC468E56a707a8A91754460e"}}},196:{adapter:{Ring:"0x47e27973dA3e16dB13F8b713877b3A31623E0E5B",Sushi:"0xA985f801ea74321AdcC9Ef88B394858CbA3F71ba"},dex:{ring:{type:"dynamicp2",solver:"Ring",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",adapter:"0x028fa69049aB68EC42064Eb18896D587dD41Af2a",fee:"0xA04329696aAd1417c75Cf6d91342815001999B21"}}},999:{adapter:{Nordstern:"0xA9c6c1F14c1d0eF2ab6ec79E5dcF0ff3a3680F05",Ring:"0x47e27973dA3e16dB13F8b713877b3A31623E0E5B",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d",Magpie:"0x6795A03Af6E1332BD931C0891D5C6AFF85550b54",Sushi:"0xA985f801ea74321AdcC9Ef88B394858CbA3F71ba"},dex:{ring:{type:"dynamicp2",solver:"Ring",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",adapter:"0x028fa69049aB68EC42064Eb18896D587dD41Af2a",fee:"0xA04329696aAd1417c75Cf6d91342815001999B21"}}},1329:{adapter:{Nordstern:"0xd16A1849E86431872a87f476fa0DfB30eEb96cb3",DragonSwap:"0x1e84A9f30607959d2d8b1a04171ef7D9522Ef502",OpenOcean:"0xc7f07C830e22FCA94bF52F38C6707F9D396c6172"},dex:{dragon:{type:"default",solver:"DragonSwap",router:"0x11DA6463D6Cb5a03411Dbf5ab6f6bc3997Ac7428",adapter:"0x1e84A9f30607959d2d8b1a04171ef7D9522Ef502",fee:"0x0dc1E0525202b32e89bA78ed55b1e5cEdB751334"},nami:{type:"default",solver:"OpenOcean",router:"0x6352a56caadC4F1E25CD6c75970Fa768A3304e64",adapter:"0xba56F9A7865d430c8293851D576b5728Ca711ff5",fee:"0xeB58450e23632003f013568703F54446070E2E80"}}},4326:{adapter:{Ring:"0x47e27973dA3e16dB13F8b713877b3A31623E0E5B",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",Magpie:"0x6795A03Af6E1332BD931C0891D5C6AFF85550b54",Sushi:"0xA985f801ea74321AdcC9Ef88B394858CbA3F71ba"},dex:{ring:{type:"dynamicp2",solver:"Ring",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",adapter:"0x028fa69049aB68EC42064Eb18896D587dD41Af2a",fee:"0xA04329696aAd1417c75Cf6d91342815001999B21"}}},8453:{adapter:{Nordstern:"0xd16A1849E86431872a87f476fa0DfB30eEb96cb3",Orbs:"0x917b492557957f5dD3e69c04c8E1Ac3d6948c022",Kyber:"0x6f4e5b8d7F6b037c62277992c39E7834D7C04596",TrebleSwap:"0x6f4938535879c668A797F2a6e9B912c54f9D43Cf",Sushi:"0x11985E88847aEC23D1C3BCD77Ca0F4A704aB751c",Ring:"0x47e27973dA3e16dB13F8b713877b3A31623E0E5B",Magpie:"0x448Ab278aE53a518b181C01AEaFD397f049060E7",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d",Paraswap:"0x777A3e65a5473148D5d7abdFD2BB5bFB61b6432f"},dex:{pancake:{type:"p2",solver:"Orbs",router:"0xFE6508f0015C778Bdcc1fB5465bA5ebE224C9912",permit2:"0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",adapter:"0xA7CcB11F1D20D1F915FC220F5Cb1646E4523bB75",fee:"0x37A957f10F458e0d7fDECBE2917971b57F15c927"},quick:{type:"default",solver:"Kyber",router:"0x6131B5fae19EA4f9D964eAc0408E4408b66337b5",adapter:"0x0438644898F69bfF1018Cb01a81877D14d3e6493",fee:"0xd207DC6a6dA88f27c8DB78201F974161b1d84b1f"},trebleswap:{type:"default",solver:"TrebleSwap",router:"0x347539D82A14C0A3a89769f1024774A545a151ac",adapter:"0x6f4938535879c668A797F2a6e9B912c54f9D43Cf",fee:"0x15fc883d7DF4e681Ddb9E43e7B1D8c61d4fC162C"},sushiswap:{type:"default",solver:"Sushi",router:"0xAC4c6e212A361c968F1725b4d055b47E63F80b75",adapter:"0x2e43A28FAf083717CcD9B246d97C61E1Bc9914Df",fee:"0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc"},ring:{type:"dynamicp2",solver:"Ring",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",adapter:"0x028fa69049aB68EC42064Eb18896D587dD41Af2a",fee:"0xA04329696aAd1417c75Cf6d91342815001999B21"}}},42161:{adapter:{Nordstern:"0x52756370A08F63ADE4900A9c3046cf93ac0397e5",Paraswap:"0x179C4b8e982b5F1365d36CC8d0c1CEB621B7198D",Orbs:"0x917b492557957f5dD3e69c04c8E1Ac3d6948c022",Sushi:"0x11985E88847aEC23D1C3BCD77Ca0F4A704aB751c",Ring:"0x47e27973dA3e16dB13F8b713877b3A31623E0E5B",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",Magpie:"0xB844Fa943230A0ff3b7a0E9483dF2689D513d77d",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d"},dex:{ramses:{type:"paraswap",solver:"Paraswap",router:"0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57",adapter:"0xf075352f43cd15bA51B0957A4465223EDf6b4Cd8",fee:"0xB5BaCB60ECDa0bEF809B2A26eC9B4B926835D7af"},omni:{type:"paraswap",solver:"Paraswap",router:"0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57",adapter:"0x41c925E8E4fC65136BDf5322824E0D8c20c4824e",fee:"0xba5291526c30B097E9F1Fd1Be301E2ab6E0782aa"},pancake:{type:"p2",solver:"Orbs",router:"0xFE6508f0015C778Bdcc1fB5465bA5ebE224C9912",permit2:"0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",adapter:"0xA7CcB11F1D20D1F915FC220F5Cb1646E4523bB75",fee:"0x37A957f10F458e0d7fDECBE2917971b57F15c927"},sushiswap:{type:"default",solver:"Sushi",router:"0xAC4c6e212A361c968F1725b4d055b47E63F80b75",adapter:"0x2e43A28FAf083717CcD9B246d97C61E1Bc9914Df",fee:"0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc"},ring:{type:"dynamicp2",solver:"Ring",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",adapter:"0x028fa69049aB68EC42064Eb18896D587dD41Af2a",fee:"0xA04329696aAd1417c75Cf6d91342815001999B21"}}},43114:{adapter:{Nordstern:"0x1D06d98D523F8B51AD693D4A22fb97fCf0838d83",Kyber:"0x6f4e5b8d7F6b037c62277992c39E7834D7C04596",Magpie:"0x0Fd65Dc22A3c3aa1501a6Bb509F66ff5C4585a5d",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d",Paraswap:"0x777A3e65a5473148D5d7abdFD2BB5bFB61b6432f",Sushi:"0xA985f801ea74321AdcC9Ef88B394858CbA3F71ba"},dex:{blackhole:{type:"default",solver:"Kyber",router:"0x6131B5fae19EA4f9D964eAc0408E4408b66337b5",adapter:"0xccdF1D6ce95FeC0F842197470CE8969A678B0A04",fee:"0x7f8B62520D9B5DA0ED517cc36e8dcb2a356f1928"},pangolin:{type:"default",solver:"Kyber",router:"0x6131B5fae19EA4f9D964eAc0408E4408b66337b5",adapter:"0xf42106eBf985bF49b39eba0114F57FA05e7B52eD",fee:"0xde92da99D188Ceb54A11ec711EF52D808A6260B5"}}},59144:{adapter:{Nordstern:"0xA9c6c1F14c1d0eF2ab6ec79E5dcF0ff3a3680F05",Orbs:"0x917b492557957f5dD3e69c04c8E1Ac3d6948c022",OpenOcean:"0xd2e68b1d1C5DBB2D6cC396c10C55017e01309C37",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",Sushi:"0xA985f801ea74321AdcC9Ef88B394858CbA3F71ba",Magpie:"0xBcFd0eE2C44136526dcA007e41e4f3DDD32A0Bd2"},dex:{pancake:{type:"p2",solver:"Orbs",router:"0xFE6508f0015C778Bdcc1fB5465bA5ebE224C9912",permit2:"0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",adapter:"0xA7CcB11F1D20D1F915FC220F5Cb1646E4523bB75",fee:"0x37A957f10F458e0d7fDECBE2917971b57F15c927"},lynex:{type:"default",solver:"OpenOcean",router:"0x6352a56caadC4F1E25CD6c75970Fa768A3304e64",adapter:"0xd8bC1FF79a642e8D7Fbd0711374F287202fBb3AA",fee:"0xcb36ed1B1BfAD8F7FC9651f52d21f04A68677423"}}},80094:{adapter:{Nordstern:"0x763Fb927d181bCE8be779794A030BCE45D4869fA",Kodiak:"0xcB16237c88A859d46Ae850B97d7D1bdECF482C06",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d",Magpie:"0xBcFd0eE2C44136526dcA007e41e4f3DDD32A0Bd2",Sushi:"0xA985f801ea74321AdcC9Ef88B394858CbA3F71ba"},dex:{kodiak:{type:"default",solver:"Kodiak",router:"0x43Dac637c4383f91B4368041E7A8687da3806Cae",adapter:"0xcB16237c88A859d46Ae850B97d7D1bdECF482C06",fee:"0xBA47Ec15aFbCF6e7e9F52900632049530bB6bAe4"}}},747474:{adapter:{Nordstern:"0xd16A1849E86431872a87f476fa0DfB30eEb96cb3",Sushi:"0x11985E88847aEC23D1C3BCD77Ca0F4A704aB751c"},dex:{katana:{type:"universal",adapter:"0xe7505d43AdF7d44AB11d7eEAF353a85F8169bE6a",fee:"0x7a76704765D366ac2A559e1A1fc1273b834B2cA8"},sushiswap:{type:"default",solver:"Sushi",router:"0xAC4c6e212A361c968F1725b4d055b47E63F80b75",adapter:"0x2e43A28FAf083717CcD9B246d97C61E1Bc9914Df",fee:"0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc"}}},"*":{wm:"0x0005d5cE0dB57e5BE3b2b8b6FeB75f0ccd015000",repermit:"0x00002a9C4D9497df5Bd31768eC5d30eEf5405000",cosigner:"0x000ECFa392ecDEfEE6e2a5C095d39B7A32f1E000",reactor:"0x000000b33fE4fB9d999Dd684F79b110731c3d000",executor:"0x000642A0966d9bd49870D9519f76b5cf823f3000",refinery:"0x000E474c0D7084EAA35A501035E73269f4b009A5",salt:{wm:"0xc9b46eae42dfeba3222a0315bf682f33cd5cc9d60c9625642e88406f8415f152",repermit:"0x4871dc9008e605821ea9677b65ea2a60ffb774afb31e0dcaea2e192880096be7",cosigner:"0x1117fe6f4e25c9380d10b2b3314a1e9b33e5f65ba0e55e0c63d0640db0dd60a2",reactor:"0xec73677f3a465a9755d4c9eab9509b59a24613fdb8b78719682930373e9876f5",executor:"0x9abc67d936f79e493f1f14050c2f6adb87ec208ff7aaae2e7ae788a7cb4796d7",refinery:"0x9746de29f1dd31b2c8460d71e92a7aefa34911130e61f274f37776e598c48bec",agentAdapter:"0xf6d54cf6a0619f1fb8e1ded91d4c23e7bb9f498c56735fb0c7669423c766219f",agentFee:"0x151234279af18acc113f70463977058efa2e598b5bfc0c106c75fd638d344c0a",utilaAdapter:"0x7671291910b559d7a05ab73ee31dd714d9c6e7b065c9496338bf427182ae5145",utilaFee:"0x46f797cddb221ecf6279b56f52e2f6360cd721ef95bd5a17dd0ffceffaaf7fd6",efAdapter:"0xa5425e0f84a7cf12c4213f57396810d808d88e43a65210786bd0d9a98a314728",efFee:"0x14387b821c54f18e2a9351887a92cc79164a5ea0b88cfc3f36741eae6d4fd815",htAdapter:"0x2ec50a8a136049da76c16f3dd12a8ed1b23f2bc91aca73c6a20cc8344e34f998",htFee:"0x2f902a86a7f6abeedc073e76cd33d4737f25189e18c8f450f16d2ffe14405242"},dex:{agent:{type:"universal",adapter:"0x0002BeFB46587d460AcEA9B2792c4A4c67B9cADa",fee:"0x0006d9557Ac9Af4f31962896299ba4FaBDaB9fEE"},utila:{type:"universal",adapter:"0x000ADa14B2ECF45Da6Cf1B33dE34e05231E9C76f",fee:"0x000FEee351263c82501a4dF5f699a8b630ac7f36"},ef:{type:"universal",adapter:"0xeF1B796D708BD776F6b377E93eAd8Ca5fA0C3117",fee:"0xeF1D677d7aE1a066beb26cC1C74E31C082B75FEf"},ht:{type:"universal",adapter:"0xA560a960C3b7784f5c335C33028D31596b91650b",fee:"0xE7a926C0cb01aCCE74e5d4FCeB7CA1699e200608"},ginco:{type:"universal",adapter:"0x96604C3E846BBa75c43B5518bd076851e5484197",fee:"0xCf2eB80A89A69aB17e295aeF033Ffe9564736155"}}}};var Hn,Ur;function ba(){if(Ur)return Hn;Ur=1;const e=ga,t=a=>Aa(`./out/${a}.sol/${a}.abi.json`),n=()=>({wm:t("WM"),repermit:t("RePermit"),reactor:t("OrderReactor"),executor:t("Executor"),refinery:t("Refinery"),settler:t("Settler"),adapter:t("DefaultDexAdapter")});function r(a){var d;if(!a)return;const o=e[a];if(o)return{...((d=e["*"])==null?void 0:d.adapter)??{},...o.adapter??{}}}function s(a,o){if(!a)return;const{dex:d,salt:f,...h}=e["*"]??{},x=e[a];if(!x)return;const{dex:y,salt:E,...v}=x,P={...h,...v},B=o==null?void 0:o.trim();if(!B)return P;const M=d==null?void 0:d[B],U=y==null?void 0:y[B];if(!(!M&&!U))return{...P,...M,...U}}return Hn={config:s,adapters:r,abis:n,raw:e},Hn}var Rr=ba();const Ut=(e,t)=>{if(e==null||!t)return"";const n=S(10).pow(e);return S(t).times(n).idiv(n).div(n).toFixed()};S(0),S(1),S(10),S(1e18);function At(e,t){return e==t||e.toLowerCase()==t.toLowerCase()}const Rt=e=>!!ra.find(t=>At(t,e||""));function Ea(e){return[ve.Years,ve.Months,ve.Weeks,ve.Days,ve.Hours,ve.Minutes].find(n=>n<=e)||ve.Minutes}const gt=e=>e?e.value*e.unit:0,Ca=e=>!e||e==="NaN"?"0":S(e).decimalPlaces(0).toFixed(),bt=e=>Object.values(ye).find(t=>t.id===e),xa=e=>{if(!e)return;const t=e.map(a=>Ee(a)),n=Object.entries(sa).filter(([a])=>t.includes(a)).flatMap(([,a])=>a),r=e.map(a=>a.exchangeAddress),s=new Set([...r,...n].map(a=>a.toLowerCase()));return Array.from(s)},Wn=(e,t)=>e.version===1?(e.fillDelay||0)*1e3+Ba(t):(e.fillDelay||0)*1e3,An=e=>typeof window>"u"?null:new URLSearchParams(window.location.search).get(e),Lr=e=>Hr().filter(t=>t.name===e).map(t=>t.chainId),zn=(e="",t="",n=18,r=18)=>{if(!S(e||0).gt(0)||!S(t||0).gt(0))return"";const s=Ut(n,e),a=Ut(r,t);return S(a).div(s).toFixed()},Nr=(e,t,n)=>{if(e.type===G.TWAP_MARKET)return"";const r=Ut(t,e.srcAmountPerTrade),s=Ut(n,e.dstMinAmountPerTrade);return S(s).div(r).toFixed()},qr=(e,t,n)=>{if(e.type===G.TWAP_MARKET)return"";const r=Ut(t,e.srcAmountPerTrade),s=Ut(n,e.triggerPricePerTrade);return S(s).div(r).toFixed()},Ta=new Set([1,56,42161,8453]),Kr=(e,t)=>e===Pe.Ring?Ta.has(t):!0,wa=(e,t,n)=>{if(!e||!t||n==null)return;const r=S(e).times(t),s=S(10).pow(n);return r.div(s).toFixed(0)},Fa=(e,t,n,r)=>{if(n||r==null||!e||!t)return S(0).toString();const s=S(e).times(S(t)),a=S(10).pow(r),o=s.div(a);return S.max(1,o).integerValue(S.ROUND_FLOOR).toFixed(0)},Sa=(e,t,n,r)=>{if(e===j.TWAP||e===j.LIMIT)return"0";if(r==null||!t||!n)return;const s=S(t).times(S(n)),a=S(10).pow(r),o=s.div(a);return S.max(1,o).integerValue(S.ROUND_FLOOR).toFixed(0)||"0"},Da=(e,t,n,r)=>{const s=gt(n)*2*t,a=An(tn.DURATION),o=Ea(a?Number(a):s);return a?{unit:o,value:Number(S(Number(a)/o).toFixed(2))}:r||(e===j.LIMIT?{unit:ve.Days,value:7}:e===j.STOP_LOSS||e===j.TAKE_PROFIT?{unit:ve.Days,value:1}:{unit:o,value:Number(S(s/o).toFixed(2))})},va=(e,t,n)=>t!==j.TWAP?1:n!==void 0?n:Math.max(1,Math.ceil(e/2)),Pa=(e,t,n)=>{if(!e||!t||!n)return 1;const s=S(t).times(e).div(n).integerValue(S.ROUND_FLOOR).toNumber();return Math.max(1,s)},Oa=(e,t)=>e+gt(t)+6e4,Ba=e=>e.bidDelaySeconds*1e3*2,Ia=(e="",t=0)=>!e||!t?"0":S(e).div(t).integerValue(S.ROUND_FLOOR).toFixed(0),Ma=(e,t)=>({isError:!(e.unit===Ln.unit&&e.value===Ln.value)&&gt(e)*t>hn,value:Math.floor(hn/t)}),ka=(e="",t="",n)=>{if(n===j.STOP_LOSS)return{isError:S(t||0).gte(S(e||0)),value:e}},_a=(e="",t="",n)=>{if(n===j.TAKE_PROFIT)return{isError:S(t||0).lte(S(e||0)),value:e}},Ua=(e="",t="",n=!1,r)=>{if(!n&&r===j.STOP_LOSS)return{isError:S(t||0).gte(S(e||0)),value:e}},Ra=(e="",t="",n=!1,r)=>{if(!n&&r===j.TAKE_PROFIT)return{isError:S(t||0).gte(S(e||0)),value:e}},La=(e,t)=>e===j.STOP_LOSS||e===j.TAKE_PROFIT?{isError:gt(t)>5184e6,value:5184e6}:{isError:gt(t)>hn,value:hn},Na=e=>({isError:gt(e)<Ir,value:Ir}),qa=e=>({isError:gt(e)<Un,value:Un}),Ka=(e,t,n)=>({isError:S(t||0).multipliedBy(e||0).isLessThan(n),value:n}),Ha=(e,t,n)=>({isError:n===j.TWAP&&S(e).isGreaterThan(t),value:t}),Wa=(e,t)=>{if(e===Pe.Pancake)switch(t){case 56:return $.PancakeSwap;case 42161:return $.PancakeSwapArbitrum;case 8453:return $.PancakeSwapBase;case 59144:return $.PancakeSwapLinea;default:return $.PancakeSwap}if(e===Pe.Sushiswap)switch(t){case 1:return $.SushiEth;case 42161:return $.SushiArb;case 8453:return $.SushiBase;case 747474:return $.SushiKatana;default:return $.SushiEth}if(e===Pe.Quick)switch(t){case 137:return $.QuickSwap;case 8453:return $.QuickSwapBase;default:return $.QuickSwap}if(e===Pe.Thena)switch(t){case 56:return $.Thena;default:return $.Thena}if(e===Pe.Spooky)switch(t){case 250:return $.SpookySwap;case 146:return $.SpookySwapSonic;default:return $.SpookySwap}if(e===Pe.Lynex)switch(t){case 59144:return $.Lynex;default:return $.Lynex}if(e===Pe.Swapx)switch(t){case 146:return $.SwapX;default:return $.SwapX}if(e===Pe.Blackhole)switch(t){case 43114:return $.BlackholeAvax;default:return $.BlackholeAvax}},Qn=(e,t=0)=>{if(!Kr(e,t))throw new Error(`Partner "${e}" is not supported on chain ${t}`);const{abi:n,...r}=Rr.config(t,e);if(!r.reactor)throw new Error(`Missing config for partner "${e}" on chain ${t}: reactor address not found`);return{...r,partner:e,twapConfig:Wa(e,t)}},Hr=()=>{var n;const e=Rr.raw,t=((n=e["*"])==null?void 0:n.dex)??{};return Object.entries(e).filter(([r])=>r!=="*").flatMap(([r,s])=>{const a=Number(r),o={...t,...(s==null?void 0:s.dex)??{}};return!o||typeof o!="object"?[]:Object.entries(o).flatMap(([d])=>{const f=d;return Kr(f,a)?[{chainId:a,name:d,config:Qn(f,a)}]:[]})}).sort((r,s)=>r.name.localeCompare(s.name))},Wr=e=>{const t=An(tn.MIN_CHUNK_SIZE_USD);return t?parseInt(t):e},za=({marketPrice:e,typedInputAmount:t,srcUsd1Token:n,marketPriceLoading:r,triggerPriceError:s,limitPriceError:a,tradesError:o,fillDelayError:d,durationError:f,balanceError:h,minTradeSizeError:x})=>{if(!An(tn.IGNORE_ERRORS)&&!(S(e||0).isZero()||S(t||0).isZero()||S(n||"0").isZero()||r))return x||s||a||o||d||f||h},Qa=(e,t)=>{const n=Date.now().toString(),r=parseInt((e/1e3).toFixed(0)),s=Ca(t/1e3),a=An(tn.FRESHNESS),o=a?parseInt(a):60;return{nonce:n,epoch:r,deadline:s,freshness:o}},zr=({chainId:e,srcToken:t,dstToken:n,srcAmount:r,deadlineMillis:s,fillDelayMillis:a,slippage:o,account:d,srcAmountPerTrade:f,dstMinAmountPerTrade:h="0",triggerAmountPerTrade:x="0",config:y,module:E})=>{const{nonce:v,epoch:P,deadline:B,freshness:M}=Qa(a,s),U=Math.floor(Date.now()/1e3).toString(),F=h,H=E===j.STOP_LOSS?x:"0",_=E===j.TAKE_PROFIT?x:"0",Y={permitted:{token:t,amount:r},spender:y.reactor,nonce:v,deadline:B,witness:{reactor:y.reactor,executor:y.executor,exchange:{adapter:y.adapter,ref:y.fee,share:0,data:"0x"},swapper:d,nonce:v,start:U,deadline:B,chainid:e,exclusivity:0,epoch:P,slippage:o,freshness:M,input:{token:t,amount:f,maxAmount:r},output:{token:n,limit:S(F||0).toFixed(),triggerLower:S(H||0).toFixed(),triggerUpper:S(_||0).toFixed(),recipient:d}}};return{domain:{name:"RePermit",version:"1",chainId:e,verifyingContract:y.repermit},order:Y,types:ia,primaryType:aa}},$a=`https://bi.orbs.network/putes/twap-ui-${.7}`;let $n="unknown";function ja(e){$n=e}function jn(){const e=Math.random().toString(36).substring(2,16),t=Math.random().toString(36).substring(2,16),n=Date.now().toString(36);return`id_${e+t+n}`}const Va=(e,t,n)=>{var r,s,a,o,d,f,h,x,y;return{spotVersion:_n.version,partner:e.partner,adapter:e.adapter,cosigner:e.cosigner,executor:e.executor,fee:e.fee,reactor:e.reactor,refinery:e.refinery,repermit:e.repermit,router:e.router,type:e.type,wm:e.wm,chainName:((r=e.twapConfig)==null?void 0:r.chainName)||"",chainId:n||0,twapVersion:((s=e.twapConfig)==null?void 0:s.twapVersion)||0,twapAddress:((a=e.twapConfig)==null?void 0:a.twapAddress)||"",lensAddress:((o=e.twapConfig)==null?void 0:o.lensAddress)||"",bidDelaySeconds:((d=e.twapConfig)==null?void 0:d.bidDelaySeconds)||0,minChunkSizeUsd:t,name:((f=e.twapConfig)==null?void 0:f.name)||"",exchangeAddress:((h=e.twapConfig)==null?void 0:h.exchangeAddress)||"",exchangeType:((x=e.twapConfig)==null?void 0:x.exchangeType)||"",pathfinderKey:((y=e.twapConfig)==null?void 0:y.pathfinderKey)||""}},Qr=async e=>{try{await fetch($a,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)}).then()}catch(t){console.error("Failed to send BI",t)}};class Ga{constructor(){In(this,"timeout");In(this,"config");In(this,"data",{_id:jn()})}async updateAndSend(t={},n=!1,r){try{this.data={...this.data,...t},n?(await Qr(this.data),r==null||r()):(clearTimeout(this.timeout),this.timeout=setTimeout(()=>{Qr(this.data),r==null||r()},1e3))}catch(s){console.error("Failed to update and send BI",s)}}onCancelOrderRequest(t,n){this.updateAndSend({cancelOrderIdsV1:n===1?t:void 0,cancelOrderIdsV2:n===2?t:void 0,action:"cancel order",cancelOrderSuccess:!1,cancelOrderTxHash:void 0,actionError:void 0})}onCancelOrderSuccess(t){this.updateAndSend({cancelOrderTxHash:t,cancelOrderSuccess:!0})}onCancelOrderError(t){this.onTxError(t)}onWrapSuccess(t){this.updateAndSend({wrapTxHash:t})}onWrapRequest(){this.updateAndSend({action:"wrap"})}onWrapError(t){this.onTxError(t)}onApproveRequest(){this.updateAndSend({action:"approve"})}onApproveSuccess(t){this.updateAndSend({approvalTxHash:t})}onApproveError(t){this.onTxError(t)}onCrash(t){var n;this.updateAndSend({action:"crash",actionError:((n=t==null?void 0:t.message)==null?void 0:n.toLowerCase())||(t==null?void 0:t.toLowerCase())})}onTxError(t){var r;const n=((r=t==null?void 0:t.message)==null?void 0:r.toLowerCase())||(t==null?void 0:t.toLowerCase());this.updateAndSend({actionError:n})}onRequestOrder({account:t,chainId:n,module:r,srcToken:s,dstToken:a,fromTokenAmount:o,srcChunkAmount:d,minDstAmountOutPerTrade:f="",triggerPricePerTrade:h="",deadline:x,fillDelay:y,slippage:E,isMarketOrder:v,chunksAmount:P}){this.updateAndSend({toTokenAddress:a.address,toTokenSymbol:a.symbol,fromTokenAddress:s.address,fromTokenSymbol:s.symbol,fromTokenAmount:o,chunksAmount:P,srcChunkAmount:d,minDstAmountOutPerTrade:f,triggerPricePerTrade:h,deadline:x,fillDelay:y,slippage:E,chainId:n,walletAddress:t,module:r,orderType:v?"market":"limit",actionError:void 0})}onSignOrderRequest(t){this.updateAndSend({action:"sign order",order:t})}onSignOrderError(t){this.onTxError(t)}onSignOrderSuccess(t){this.updateAndSend({action:"sign order",signature:t})}init(t,n,r,s){var a,o;this.config=t,(r!==((a=this.data)==null?void 0:a.chainId)||s!==((o=this.data)==null?void 0:o.appId))&&(this.data={_id:jn(),action:"module-import",uiVersion:$n,appId:s,...Va(t,n,r),origin:window.location.origin},this.updateAndSend(this.data))}onCreateOrderError(t){this.onTxError(t)}onCreateOrderRequest(){this.updateAndSend({action:"create order"})}async onCreateOrderSuccess(t){this.updateAndSend({orderHash:t,orderSuccess:!0},void 0,()=>{this.data={_id:jn(),action:"reset",uiVersion:$n,appId:this.data.appId,origin:this.data.origin,spotVersion:_n.version,partner:this.data.partner,adapter:this.data.adapter,cosigner:this.data.cosigner,executor:this.data.executor,fee:this.data.fee,reactor:this.data.reactor,refinery:this.data.refinery,repermit:this.data.repermit,router:this.data.router,type:this.data.type,wm:this.data.wm,chainName:this.data.chainName||"",chainId:this.data.chainId||0,twapVersion:this.data.twapVersion||0,twapAddress:this.data.twapAddress||"",lensAddress:this.data.lensAddress||"",bidDelaySeconds:this.data.bidDelaySeconds||0,minChunkSizeUsd:this.data.minChunkSizeUsd||0,name:this.data.name||"",exchangeAddress:this.data.exchangeAddress||"",exchangeType:this.data.exchangeType||"",pathfinderKey:this.data.pathfinderKey||""}})}onLoad(){this.updateAndSend({action:"module-import",origin:window.location.origin})}}const pe=new Ga,Xa=e=>{var x;const t=S(e.order.witness.output.limit||0).gt(1),{stop:n,triggerLower:r,triggerUpper:s}=e.order.witness.output,a=S(n||0).eq(Mr),o=a||S(s||0).gt(0),d=!a&&S(n||0).gt(0)||S(r||0).gt(0),f=S(e.order.witness.input.amount),h=((x=e.metadata.chunks)==null?void 0:x.length)||(f.gt(0)?S(e.order.witness.input.maxAmount).div(f).toNumber():e.metadata.expectedChunks||1);return o?t?G.TAKE_PROFIT_LIMIT:G.TAKE_PROFIT_MARKET:d?t?G.STOP_LOSS_LIMIT:G.STOP_LOSS_MARKET:t?h>1&&t?G.TWAP_LIMIT:t?G.LIMIT:G.TWAP_MARKET:G.TWAP_MARKET},Za=e=>{var s;const t=((s=e.metadata.chunks)==null?void 0:s.filter(a=>a.status==="success").length)||0,n=e.metadata.expectedChunks||0;if(!n)return 0;const r=S(t).dividedBy(n).toNumber();return r>=.99?100:r<=0?0:Number((r*100).toFixed(2))},Ya=(e,t)=>{var n;return e.metadata.status==="completed"||t>=99?ue.Completed:["pending","eligible"].includes(e.metadata.status)?ue.Open:((n=e.metadata.description)==null?void 0:n.toLowerCase())==="cancelled by contract"?ue.Cancelled:ue.Expired},Ja=e=>{var n;return(((n=e.metadata.chunks)==null?void 0:n.filter(r=>r.status==="success"))||[]).map(r=>({inAmount:r.inAmount,outAmount:r.outAmount,timestamp:new Date(r.timestamp).getTime(),txHash:r.txHash}))},ei=(e,t)=>{var r;const n=e.length;return n>=t&&((r=e[n-1])==null?void 0:r.timestamp)||0},ti=e=>S(e.metadata.displayOnlyInputTokenPriceUSD).dividedBy(1e18).toFixed(),Vn=e=>Number(e.order.witness.output.limit)===1?"":e.order.witness.output.limit,ni=e=>{const{triggerLower:t="0",triggerUpper:n="0"}=e.order.witness.output,r=Vn(e),s=e.metadata.expectedChunks||1,a=S(n||0).gt(0);return{dstMinAmountPerTrade:r,triggerPricePerTrade:a?n:t,dstMinAmountTotal:r?S(r).multipliedBy(s).toFixed():""}},ri=e=>{const t=Vn(e),n=S(e.order.witness.output.stop||0).eq(Mr),r=e.metadata.expectedChunks||1;return{dstMinAmountPerTrade:n?"":t,triggerPricePerTrade:n?t:S(e.order.witness.output.stop||0).toFixed(),dstMinAmountTotal:n||!t?"":S(t).multipliedBy(r).toFixed()}},si=e=>Number(pn)>=2?ni(e):ri(e),$r=e=>{const t=Za(e),n=Vn(e),r=e.metadata.expectedChunks||1,s=Ja(e),a=Xa(e);return{id:e.hash,hash:e.hash,version:2,type:a,maker:e.order.witness.swapper,progress:t,srcAmountFilled:s.reduce((o,d)=>o.plus(d.inAmount),new S(0)).toFixed()||"",dstAmountFilled:s.reduce((o,d)=>o.plus(d.outAmount),new S(0)).toFixed()||"",fills:s,srcTokenAddress:e.order.witness.input.token,dstTokenAddress:e.order.witness.output.token,orderDollarValueIn:ti(e),fillDelay:e.order.witness.epoch*1e3,deadline:Number(e.order.deadline)*1e3,createdAt:new Date(e.timestamp).getTime(),srcAmount:e.order.witness.input.maxAmount,srcAmountPerTrade:e.order.witness.input.amount,totalTradesAmount:r,isMarketPrice:S(n||0).lte(1),chainId:e.order.witness.chainid,filledOrderTimestamp:ei(s,r),status:Ya(e,t),repermitDigest:e.metadata.repermitDigest,isTriggerPrice:a===G.TAKE_PROFIT_MARKET||a===G.TAKE_PROFIT_LIMIT||a===G.STOP_LOSS_LIMIT||a===G.STOP_LOSS_MARKET,rawOrder:e,...si(e)}},ai=async({chainId:e,signal:t,account:n,exchange:r,partner:s,isDev:a=!1})=>{try{if(!n)return[];const o=Ys(a),d=new Map;return(await Promise.all(o.map(async h=>{try{const x=ea({endpoint:h,exchange:r,partner:s}),y=x?`&exchange=${x}`:"",v=await(await fetch(`${h}/orders?swapper=${n}&chainId=${e}${y}`,{signal:t})).json();if(!v||!Array.isArray(v.orders))return[];const P=[];for(const B of v.orders)try{P.push($r(B))}catch{continue}return P}catch{return[]}}))).flat().forEach(h=>{d.has(h.id)||d.set(h.id,h)}),Array.from(d.values())}catch{return[]}},jr=async(e,t,n=!1)=>{try{const r={signature:t,order:e,status:"pending"};pe.onCreateOrderRequest();const s=await fetch(`${Zs(n)}/orders/new`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)}),a=await s.json().catch(()=>({}));if(!s.ok||!(a!=null&&a.success)){const d=(a==null?void 0:a.message)??s.statusText??"Request failed",f=(a==null?void 0:a.code)??s.status;throw new Error(`error:${d}, code:${f}`)}if(!a.signedOrder||typeof a.signedOrder!="object")throw new Error("Invalid API response: missing signedOrder");const o=$r(a.signedOrder);return pe.onCreateOrderSuccess(o.id),o}catch(r){throw pe.onCreateOrderError(r),console.error(r),r}},Ve=(e,t)=>e&&e.length?e.map(t||(n=>`${n}`)):void 0,ii=e=>{if(e)return na[e]},Gn=async({chainId:e,buildQuery:t,extractResults:n,signal:r,retries:s=1,limit:a=1e3,page:o})=>{const d=ii(e);if(!d)throw new fi;const f=async y=>{let E=0;for(;E<=s;)try{const v=await fetch(d,{method:"POST",body:JSON.stringify({query:y}),signal:r,headers:{"Content-Type":"application/json"}});if(!v.ok)throw new Error(`HTTP error: ${v.status}`);const P=await v.json();if(P.errors)throw new Error(P.errors[0].message);return n(P)}catch(v){if(E===s)throw v;await new Promise(P=>setTimeout(P,500*2**E)),E++}return[]};let h=0;const x=[];if(o!==void 0){const y=t(o,a);try{return await f(y)}catch{console.warn(`Page ${o} failed, retrying one final time...`);try{return await f(y)}catch{return[]}}}for(;;){const y=t(h,a);let E;try{E=await f(y)}catch{console.warn(`Page ${h} failed, retrying one final time...`);try{E=await f(y)}catch{return x}}if(x.push(...E),E.length<a)break;h++}return x},Vr=e=>e.map(t=>({inAmount:t.srcAmountIn,outAmount:t.dstAmountOut,timestamp:t.timestamp,txHash:t.transactionHash})),Gr=(e,t)=>{const n=S(e||0).gt(1);return!n&&t===1?G.TWAP_MARKET:t>1&&n?G.TWAP_LIMIT:n?G.LIMIT:G.TWAP_MARKET},oi=(e,t,n,r)=>{var v;const s=Vr(n||[]),a=new S(e.ask_srcBidAmount||0),o=a.gt(0)?new S(e.ask_srcAmount||0).div(a).integerValue(S.ROUND_FLOOR).toNumber():1,f=(n==null?void 0:n.length)===o?(v=n==null?void 0:n[(n==null?void 0:n.length)-1])==null?void 0:v.timestamp:void 0,h=s.reduce((P,B)=>P.plus(B.inAmount),new S(0)).toFixed(),x=s.reduce((P,B)=>P.plus(B.outAmount),new S(0)).toFixed(),y=Xr(e.ask_srcAmount,h),E=Gr(e.ask_dstMinAmount,o);return{repermitDigest:"",version:1,isTriggerPrice:!1,id:e.Contract_id.toString(),hash:"",type:Gr(e.ask_dstMinAmount,o),srcTokenAddress:e.ask_srcToken,dstTokenAddress:e.ask_dstToken,exchangeAddress:e.exchange,twapAddress:e.twapAddress,maker:e.maker,progress:y,dstAmountFilled:x,srcAmountFilled:h,orderDollarValueIn:S(e.dollarValueIn||0).toFixed(6),srcAmount:e.ask_srcAmount,dstMinAmountTotal:S(e.ask_dstMinAmount).multipliedBy(o).toString(),fills:s,fillDelay:e.ask_fillDelay,deadline:e.ask_deadline*1e3,createdAt:new Date(e.timestamp).getTime(),dstMinAmountPerTrade:S(e.ask_dstMinAmount).eq(1)?"":e.ask_dstMinAmount,triggerPricePerTrade:"",srcAmountPerTrade:e.ask_srcBidAmount,txHash:e.transactionHash,totalTradesAmount:o,isMarketPrice:[G.TWAP_MARKET].includes(E),chainId:t,filledOrderTimestamp:f||0,status:r,rawOrder:e}},ci=e=>{var y;if(!e)return"";const t=Ve(e.accounts,E=>`"${E.toLowerCase()}"`),n=Ve(xa(e.configs),E=>`"${E.toLowerCase()}"`),r=Ve(e.inTokenSymbols,E=>`"${E.toUpperCase()}"`),s=Ve(e.outTokenSymbols,E=>`"${E.toUpperCase()}"`),a=Ve(e.inTokenAddresses,E=>`"${E.toLowerCase()}"`),o=Ve(e.outTokenAddresses,E=>`"${E.toLowerCase()}"`),d=Ve(e.transactionHashes,E=>`"${E.toLowerCase()}"`),f=Ve(e.orderIds,E=>`"${E}"`),h=n!=null&&n.length?"":Ve((y=e.configs)==null?void 0:y.map(E=>E.twapAddress),E=>`"${E.toLowerCase()}"`),x=e.minDollarValueIn;return[n?`exchange_in: [${n.join(", ")}]`:"",h?`twapAddress_in: [${h.join(", ")}]`:"",t?`maker_in: [${t.join(", ")}]`:"",d?`transactionHash_in: [${d.join(", ")}]`:"",f?`Contract_id_in: [${f.join(", ")}]`:"",x?`dollarValueIn_gte: ${x}`:"",r?`srcTokenSymbol_in: [${r.join(", ")}]`:"",s?`dstTokenSymbol_in: [${s.join(", ")}]`:"",a?`srcTokenAddress_in: [${a.join(", ")}]`:"",o?`dstTokenAddress_in: [${o.join(", ")}]`:"",e!=null&&e.startDate?`blockTimestamp_gte: ${e.startDate}`:"",e!=null&&e.endDate?`blockTimestamp_lte: ${e.endDate}`:"",(e==null?void 0:e.orderType)==="limit"?"ask_dstMinAmount_gt: 1":"",(e==null?void 0:e.orderType)==="market"?"ask_dstMinAmount_lte: 1":""].filter(Boolean).join(", ")};async function ui({chainId:e,signal:t,page:n,limit:r,filters:s}){const a=r||1e3,o=ci(s);return await Gn({chainId:e,signal:t,limit:a,page:n,buildQuery:(f,h)=>`
1
+ (function(M,$){typeof exports=="object"&&typeof module<"u"?$(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],$):(M=typeof globalThis<"u"?globalThis:M||self,$(M.SpotReact={},M.jsxRuntime,M.React))})(this,(function(M,$,S){"use strict";var mc=Object.defineProperty;var Gs=M=>{throw TypeError(M)};var yc=(M,$,S)=>$ in M?mc(M,$,{enumerable:!0,configurable:!0,writable:!0,value:S}):M[$]=S;var nn=(M,$,S)=>yc(M,typeof $!="symbol"?$+"":$,S),wr=(M,$,S)=>$.has(M)||Gs("Cannot "+S);var l=(M,$,S)=>(wr(M,$,"read from private field"),S?S.call(M):$.get(M)),N=(M,$,S)=>$.has(M)?Gs("Cannot add the same private member more than once"):$ instanceof WeakSet?$.add(M):$.set(M,S),U=(M,$,S,Ut)=>(wr(M,$,"write to private field"),Ut?Ut.call(M,S):$.set(M,S),S),j=(M,$,S)=>(wr(M,$,"access private method"),S);var Rn=(M,$,S,Ut)=>({set _(ce){U(M,$,ce,S)},get _(){return l(M,$,Ut)}});var $e,St,Rs,Dt,ct,Wt,Ns,zt,ut,Qt,Ks,vt,qs,Pt,jt,ke,Ot,pe,on,Bt,Ne,tt,Hs,Se,Y,cn,Ce,It,Vt,Xe,dt,un,Gt,Xt,Mt,kt,lt,Zt,ee,hn,Fr,Sr,Dr,vr,Pr,Or,Br,Xs,$s,dn,We,Te,_t,ze,yt,Ws,Ze,Ke,ln,zs,Ye,ft,De,Je,et,Nn,Ir,Qs,Qe,js,ae,ht,pt,Yt,Jt,mt,en,tn,Vs;function Ut(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const ce=Ut(S),V={SpookySwap:{chainName:"ftm",chainId:250,twapVersion:4,twapAddress:"0xd3B290FEB04E353d1821bc0a12397FdEa9a846C0",lensAddress:"0x0221EfDF1Fd3212AF87F23cceB7693a65fAF1d7f",takers:["0xDF406A27C58a8Cd6Fd43e143339bCE131216a913","0x504f6E10173249dD22491829D98862Cf81DeF79E"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"SpookySwap",partner:"Orbs:TWAP:SpookySwap",exchangeAddress:"0xdF7CCd5fc7077E9de5f27a7b7bfDC837c82f8496",exchangeType:"ExchangeV2",pathfinderKey:""},SpookySwapSonic:{chainName:"sonic",chainId:146,twapVersion:4,twapAddress:"0x8963992816b4EafE5a22b7DB2A99513c18be9afA",lensAddress:"0x67e631F71232D63AcA98a2D5E9B2Bce5FCc39d5D",takers:["0xDF406A27C58a8Cd6Fd43e143339bCE131216a913","0x504f6E10173249dD22491829D98862Cf81DeF79E"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"SpookySwapSonic",partner:"Orbs:TWAP:SpookySwap",exchangeAddress:"0x6699bE3aF75e5c1B807b1031dBde6dA9A67739F3",exchangeType:"ExchangeV2",pathfinderKey:""},QuickSwap:{chainName:"poly",chainId:137,twapVersion:4,twapAddress:"0x688C027B0f7FaCeFcBa73e472900d28c12C5bDF4",lensAddress:"0xe0D4E736fc76af7C256ae7652c8c1e850bfb7849",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"QuickSwap",partner:"Orbs:TWAP:QuickSwap",exchangeAddress:"0x8FCc245209bE85C49D738D0CE5613F74E5d91E86",exchangeType:"ParaswapExchange",pathfinderKey:"QuickSwap,QuickSwapV3"},QuickSwapBase:{chainName:"base",chainId:8453,twapVersion:4,twapAddress:"0xc918bdC47264687796Cd54FE362FaC4f8b99Eb55",lensAddress:"0x6313188c1909b161074D62E43105faC9B756A23e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"QuickSwap",partner:"Orbs:TWAP:QuickSwap",exchangeAddress:"0xb7a3d74895bfd3aff6780525e36d79fcf26a895f",exchangeType:"ExchangeV2",pathfinderKey:""},Thena:{chainName:"bsc",chainId:56,twapVersion:4,twapAddress:"0xa6F7444D2b92Aa9F94a2165c77aAF2B671e63994",lensAddress:"0xEdB0c077fa87Fb21d050c619FF426798f8Fc1264",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"Thena",partner:"Orbs:TWAP:Thena",exchangeAddress:"0x2B2fABDbfa4a15da0d351F947C14F4520db0bDc1",exchangeType:"ExchangeV2",pathfinderKey:"43,47"},PancakeSwap:{chainName:"bsc",chainId:56,twapVersion:4,twapAddress:"0xa6F7444D2b92Aa9F94a2165c77aAF2B671e63994",lensAddress:"0xEdB0c077fa87Fb21d050c619FF426798f8Fc1264",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"PancakeSwap",partner:"Orbs:TWAP:PancakeSwap",exchangeAddress:"0x1A2bb6B75D58b740d88413ef4840D6fa3F637940",exchangeType:"P2Exchange",pathfinderKey:""},PancakeSwapArbitrum:{chainName:"arb",chainId:42161,twapVersion:4,twapAddress:"0x0B94dcC0EA2d1ee33Ab064DaC252de980a941eF3",lensAddress:"0x549e1fc9a47FCc0C5C2EbdfF31254cc49fF7164e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"PancakeSwap",partner:"Orbs:TWAP:PancakeSwap",exchangeAddress:"0xb37cB9A058c03081Ae6EF934313588cD53d408e7",exchangeType:"P2Exchange",pathfinderKey:""},PancakeSwapBase:{chainName:"base",chainId:8453,twapVersion:4,twapAddress:"0xc918bdC47264687796Cd54FE362FaC4f8b99Eb55",lensAddress:"0x6313188c1909b161074D62E43105faC9B756A23e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"PancakeSwap",partner:"Orbs:TWAP:PancakeSwap",exchangeAddress:"0xb37cB9A058c03081Ae6EF934313588cD53d408e7",exchangeType:"P2Exchange",pathfinderKey:""},PancakeSwapLinea:{chainName:"linea",chainId:59144,twapVersion:4,twapAddress:"0x48423e62acbfEF7779b5b4a5E7d6Fbd39E623d78",lensAddress:"0xe84CaEc86eCF3f0AB4267dC6130D9a5510e73DFb",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:100,name:"PancakeSwap",partner:"Orbs:TWAP:PancakeSwap",exchangeAddress:"0xb37cB9A058c03081Ae6EF934313588cD53d408e7",exchangeType:"P2Exchange",pathfinderKey:""},Lynex:{chainName:"linea",chainId:59144,twapVersion:4,twapAddress:"0x48423e62acbfEF7779b5b4a5E7d6Fbd39E623d78",lensAddress:"0xe84CaEc86eCF3f0AB4267dC6130D9a5510e73DFb",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:100,name:"Lynex",partner:"Orbs:TWAP:Lynex",exchangeAddress:"0x04C06C96d7D19977156016DD408B5992af0570a2",exchangeType:"ExchangeV2",pathfinderKey:"19,18"},SushiArb:{chainName:"arb",chainId:42161,twapVersion:4,twapAddress:"0x0B94dcC0EA2d1ee33Ab064DaC252de980a941eF3",lensAddress:"0x549e1fc9a47FCc0C5C2EbdfF31254cc49fF7164e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"SushiArb",partner:"Orbs:TWAP:Sushi",exchangeAddress:"0x04eB53119079FA779492720D1EfeAEBF0aF2e5ad",exchangeType:"ExchangeV2",pathfinderKey:""},SushiBase:{chainName:"base",chainId:8453,twapVersion:4,twapAddress:"0xc918bdC47264687796Cd54FE362FaC4f8b99Eb55",lensAddress:"0x6313188c1909b161074D62E43105faC9B756A23e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"SushiBase",partner:"Orbs:TWAP:Sushi",exchangeAddress:"0x04eB53119079FA779492720D1EfeAEBF0aF2e5ad",exchangeType:"ExchangeV2",pathfinderKey:""},SushiEth:{chainName:"eth",chainId:1,twapVersion:4,twapAddress:"0xb1ed8BCAD1EaC8a1DF0764700472391800D12946",lensAddress:"0x0967f448c4d4dbd14c355E635AE9CbF68cc44A60",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:200,name:"SushiEth",partner:"Orbs:TWAP:Sushi",exchangeAddress:"0x04eB53119079FA779492720D1EfeAEBF0aF2e5ad",exchangeType:"ExchangeV2",pathfinderKey:""},SushiKatana:{chainName:"katana",chainId:747474,twapVersion:4,twapAddress:"0xf2d96E7BE676153d202e1453804E2749923C7c5b",lensAddress:"0x1579EED0527781B1A748043AA1f59a3858Ace4a7",takers:["0xF74437A3Fc45a518640828E5D6A3E8c9A9BbDC3a","0x07A6C715063e94c0D95e809efefFCbF4EBEdfD55"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"SushiKatana",partner:"Orbs:TWAP:Sushi",exchangeAddress:"0x92209481507e6B2d14C9b5b70Ed287024177220E",exchangeType:"ExchangeV2",pathfinderKey:""},DragonSwap:{chainId:1329,name:"DragonSwap"},SwapX:{chainName:"sonic",chainId:146,twapVersion:4,twapAddress:"0x8963992816b4EafE5a22b7DB2A99513c18be9afA",lensAddress:"0x67e631F71232D63AcA98a2D5E9B2Bce5FCc39d5D",takers:["0xDF406A27C58a8Cd6Fd43e143339bCE131216a913","0x504f6E10173249dD22491829D98862Cf81DeF79E"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"SwapX",partner:"Orbs:TWAP:SwapX",exchangeAddress:"0xDA902994b7F7a1ecDd8De02E4a17dbFF2E6F67b7",exchangeType:"ExchangeV2",pathfinderKey:""},BlackholeAvax:{chainName:"avax",chainId:43114,twapVersion:4,twapAddress:"0xf77Ad005aBF7e31f669ce89a6568B2f39Ca92cDe",lensAddress:"0x48466B82Ce1575c5c9eCa168ac1090048dD47fA3",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"BlackholeAvax",partner:"Orbs:TWAP:BlackholeAvax",exchangeAddress:"0xb7A3d74895bFD3Aff6780525e36D79FCf26a895F",exchangeType:"ExchangeV2"}},Zs=JSON.parse('[{"inputs":[{"internalType":"address","name":"_iweth","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"id","type":"uint64"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":true,"internalType":"address","name":"exchange","type":"address"},{"indexed":false,"internalType":"uint32","name":"slippagePercent","type":"uint32"},{"components":[{"internalType":"uint32","name":"time","type":"uint32"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"uint256","name":"dstAmount","type":"uint256"},{"internalType":"uint256","name":"dstFee","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"indexed":false,"internalType":"struct OrderLib.Bid","name":"bid","type":"tuple"}],"name":"OrderBid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"id","type":"uint64"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"OrderCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"id","type":"uint64"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":true,"internalType":"address","name":"exchange","type":"address"},{"indexed":false,"internalType":"address","name":"taker","type":"address"}],"name":"OrderCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"id","type":"uint64"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":true,"internalType":"address","name":"exchange","type":"address"},{"components":[{"internalType":"address","name":"exchange","type":"address"},{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"srcBidAmount","type":"uint256"},{"internalType":"uint256","name":"dstMinAmount","type":"uint256"},{"internalType":"uint32","name":"deadline","type":"uint32"},{"internalType":"uint32","name":"bidDelay","type":"uint32"},{"internalType":"uint32","name":"fillDelay","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"indexed":false,"internalType":"struct OrderLib.Ask","name":"ask","type":"tuple"}],"name":"OrderCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"id","type":"uint64"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":true,"internalType":"address","name":"exchange","type":"address"},{"indexed":false,"internalType":"address","name":"taker","type":"address"},{"indexed":false,"internalType":"uint256","name":"srcAmountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dstAmountOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dstFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"srcFilledAmount","type":"uint256"}],"name":"OrderFilled","type":"event"},{"inputs":[],"name":"MIN_BID_DELAY_SECONDS","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_OUTBID_PERCENT","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERCENT_BASE","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STALE_BID_SECONDS","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STATUS_CANCELED","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STATUS_COMPLETED","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"exchange","type":"address"},{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"srcBidAmount","type":"uint256"},{"internalType":"uint256","name":"dstMinAmount","type":"uint256"},{"internalType":"uint32","name":"deadline","type":"uint32"},{"internalType":"uint32","name":"bidDelay","type":"uint32"},{"internalType":"uint32","name":"fillDelay","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct OrderLib.Ask","name":"_ask","type":"tuple"}],"name":"ask","outputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"uint256","name":"dstFee","type":"uint256"},{"internalType":"uint32","name":"slippagePercent","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"bid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"book","outputs":[{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"uint32","name":"status","type":"uint32"},{"internalType":"uint32","name":"time","type":"uint32"},{"internalType":"uint32","name":"filledTime","type":"uint32"},{"internalType":"uint256","name":"srcFilledAmount","type":"uint256"},{"internalType":"address","name":"maker","type":"address"},{"components":[{"internalType":"address","name":"exchange","type":"address"},{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"srcBidAmount","type":"uint256"},{"internalType":"uint256","name":"dstMinAmount","type":"uint256"},{"internalType":"uint32","name":"deadline","type":"uint32"},{"internalType":"uint32","name":"bidDelay","type":"uint32"},{"internalType":"uint32","name":"fillDelay","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct OrderLib.Ask","name":"ask","type":"tuple"},{"components":[{"internalType":"uint32","name":"time","type":"uint32"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"uint256","name":"dstAmount","type":"uint256"},{"internalType":"uint256","name":"dstFee","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct OrderLib.Bid","name":"bid","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"name":"cancel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"name":"fill","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"iweth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"length","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"makerOrders","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"name":"order","outputs":[{"components":[{"internalType":"uint64","name":"id","type":"uint64"},{"internalType":"uint32","name":"status","type":"uint32"},{"internalType":"uint32","name":"time","type":"uint32"},{"internalType":"uint32","name":"filledTime","type":"uint32"},{"internalType":"uint256","name":"srcFilledAmount","type":"uint256"},{"internalType":"address","name":"maker","type":"address"},{"components":[{"internalType":"address","name":"exchange","type":"address"},{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"srcBidAmount","type":"uint256"},{"internalType":"uint256","name":"dstMinAmount","type":"uint256"},{"internalType":"uint32","name":"deadline","type":"uint32"},{"internalType":"uint32","name":"bidDelay","type":"uint32"},{"internalType":"uint32","name":"fillDelay","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct OrderLib.Ask","name":"ask","type":"tuple"},{"components":[{"internalType":"uint32","name":"time","type":"uint32"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"uint256","name":"dstAmount","type":"uint256"},{"internalType":"uint256","name":"dstFee","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct OrderLib.Bid","name":"bid","type":"tuple"}],"internalType":"struct OrderLib.Order","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"maker","type":"address"}],"name":"orderIdsByMaker","outputs":[{"internalType":"uint64[]","name":"","type":"uint64[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"name":"prune","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"status","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]'),Ys=[{type:"constructor",inputs:[],stateMutability:"nonpayable"},{type:"function",name:"DOMAIN_SEPARATOR",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"cancel",inputs:[{name:"digests",type:"bytes32[]",internalType:"bytes32[]"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"eip712Domain",inputs:[],outputs:[{name:"fields",type:"bytes1",internalType:"bytes1"},{name:"name",type:"string",internalType:"string"},{name:"version",type:"string",internalType:"string"},{name:"chainId",type:"uint256",internalType:"uint256"},{name:"verifyingContract",type:"address",internalType:"address"},{name:"salt",type:"bytes32",internalType:"bytes32"},{name:"extensions",type:"uint256[]",internalType:"uint256[]"}],stateMutability:"view"},{type:"function",name:"hashTypedData",inputs:[{name:"structHash",type:"bytes32",internalType:"bytes32"}],outputs:[{name:"digest",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"repermitWitnessTransferFrom",inputs:[{name:"permit",type:"tuple",internalType:"struct RePermitLib.RePermitTransferFrom",components:[{name:"permitted",type:"tuple",internalType:"struct RePermitLib.TokenPermissions",components:[{name:"token",type:"address",internalType:"address"},{name:"amount",type:"uint256",internalType:"uint256"}]},{name:"nonce",type:"uint256",internalType:"uint256"},{name:"deadline",type:"uint256",internalType:"uint256"}]},{name:"request",type:"tuple",internalType:"struct RePermitLib.TransferRequest",components:[{name:"to",type:"address",internalType:"address"},{name:"amount",type:"uint256",internalType:"uint256"}]},{name:"signer",type:"address",internalType:"address"},{name:"witness",type:"bytes32",internalType:"bytes32"},{name:"witnessTypeString",type:"string",internalType:"string"},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"spent",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"bytes32",internalType:"bytes32"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"event",name:"Cancel",inputs:[{name:"signer",type:"address",indexed:!0,internalType:"address"},{name:"digest",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"EIP712DomainChanged",inputs:[],anonymous:!1},{type:"event",name:"Spend",inputs:[{name:"signer",type:"address",indexed:!0,internalType:"address"},{name:"permitHash",type:"bytes32",indexed:!0,internalType:"bytes32"},{name:"token",type:"address",indexed:!0,internalType:"address"},{name:"to",type:"address",indexed:!1,internalType:"address"},{name:"amount",type:"uint256",indexed:!1,internalType:"uint256"},{name:"totalSpent",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"error",name:"Canceled",inputs:[]},{type:"error",name:"Expired",inputs:[]},{type:"error",name:"InsufficientAllowance",inputs:[]},{type:"error",name:"InvalidShortString",inputs:[]},{type:"error",name:"InvalidSignature",inputs:[]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{name:"token",type:"address",internalType:"address"}]},{type:"error",name:"StringTooLong",inputs:[{name:"str",type:"string",internalType:"string"}]}],Js=Zs;var G=(e=>(e.TWAP="TWAP",e.LIMIT="LIMIT",e.STOP_LOSS="STOP_LOSS",e.TAKE_PROFIT="TAKE_PROFIT",e))(G||{}),ue=(e=>(e.Open="OPEN",e.Cancelled="CANCELLED",e.Completed="COMPLETED",e.Expired="EXPIRED",e))(ue||{}),Mr=(e=>(e.All="ALL",e.Open="OPEN",e.Cancelled="CANCELLED",e.Completed="COMPLETED",e.Expired="EXPIRED",e))(Mr||{}),ve=(e=>(e[e.Minutes=6e4]="Minutes",e[e.Hours=36e5]="Hours",e[e.Weeks=6048e5]="Weeks",e[e.Days=864e5]="Days",e[e.Months=2592e6]="Months",e[e.Years=31536e6]="Years",e))(ve||{}),X=(e=>(e.LIMIT="limit",e.TWAP_LIMIT="twap-limit",e.TWAP_MARKET="twap-market",e.TAKE_PROFIT_MARKET="take-profit-market",e.TAKE_PROFIT_LIMIT="take-profit-limit",e.STOP_LOSS_LIMIT="stop-loss-limit",e.STOP_LOSS_MARKET="stop-loss-market",e))(X||{}),Pe=(e=>(e.Arbidex="arbidex",e.Blackhole="blackhole",e.Chronos="chronos",e.Dragon="dragon",e.Kodiak="kodiak",e.Lynex="lynex",e.Nami="nami",e.Newera="newera",e.Omni="omni",e.Pancake="pancake",e.Quick="quick",e.Ramses="ramses",e.Shadow="shadow",e.Spark="spark",e.Spooky="spooky",e.Swapx="swapx",e.Teafi="teafi",e.Thena="thena",e.Yowie="yowie",e.Pangolin="pangolin",e.Sushiswap="sushiswap",e.Agent="agent",e.Utila="utila",e.Ring="ring",e.EfficientFrontier="ef",e.HtDigital="ht",e.Ginco="ginco",e.Katana="katana",e))(Pe||{}),me=(e=>(e.EMPTY_LIMIT_PRICE="emptyLimitPrice",e.MAX_CHUNKS="maxChunksError",e.MIN_CHUNKS="minChunksError",e.MIN_TRADE_SIZE="minTradeSizeError",e.MAX_FILL_DELAY="maxFillDelayError",e.MIN_FILL_DELAY="minFillDelayError",e.MAX_ORDER_DURATION="maxDurationError",e.MIN_ORDER_DURATION="minDurationError",e.MISSING_LIMIT_PRICE="missingLimitPrice",e.STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE="StopLossTriggerPriceError",e.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE="triggerLimitPriceError",e.TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE="TakeProfitTriggerPriceError",e.EMPTY_TRIGGER_PRICE="emptyTriggerPrice",e.INSUFFICIENT_BALANCE="insufficientFunds",e.MAX_ORDER_SIZE="maxOrderSize",e.MIN_TRADE_SIZE_ERROR="minTradeSizeError",e))(me||{});const ne="0x0000000000000000000000000000000000000000",ye={eth:{id:1,name:"Ethereum",shortname:"eth",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg"},wToken:{symbol:"WETH",address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://eth.llamarpc.com",logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg",explorer:"https://etherscan.io",eip1559:!0},bsc:{id:56,name:"BinanceSmartChain",shortname:"bsc",native:{address:ne,symbol:"BNB",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/1839.png"},wToken:{symbol:"WBNB",address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/1839.png"},publicRpcUrl:"https://bsc-dataseed.binance.org",logoUrl:"https://app.1inch.io/assets/images/network-logos/bsc_2.svg",explorer:"https://bscscan.com",eip1559:!1},unichain:{id:130,name:"Unichain",shortname:"unichain",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg"},wToken:{symbol:"WETH",address:"0x4200000000000000000000000000000000000006",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/130/0x4200000000000000000000000000000000000006_0x042e6d078c6cf9e13a618396b0aa40181bcb43921ebdb5fabc8fb1124d516156.webp"},publicRpcUrl:"https://mainnet.unichain.org",logoUrl:"https://icons.llamao.fi/icons/chains/rsz_unichain",explorer:"https://uniscan.xyz",eip1559:!0},xlayer:{id:196,name:"X Layer",shortname:"xlayer",native:{address:ne,symbol:"OKB",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/3897.png"},wToken:{symbol:"WOKB",address:"0xe538905cf8410324e03A5A23C1c177a474D59b2b",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/3897.png"},publicRpcUrl:"https://rpc.xlayer.tech",logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/3897.png",explorer:"https://www.oklink.com/xlayer",eip1559:!0},hyperevm:{id:999,name:"HyperEVM",shortname:"hyperevm",native:{address:ne,symbol:"HYPE",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/32196.png"},wToken:{symbol:"WHYPE",address:"0x5555555555555555555555555555555555555555",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/32196.png"},publicRpcUrl:"https://rpc.hyperliquid.xyz/evm",logoUrl:"https://icons.llamao.fi/icons/chains/rsz_hyperliquid",explorer:"https://hyperevmscan.io",eip1559:!0},megaeth:{id:4326,name:"MegaETH",shortname:"megaeth",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg"},wToken:{symbol:"WETH",address:"0x4200000000000000000000000000000000000006",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://mainnet.megaeth.com/rpc",logoUrl:"https://icons.llamao.fi/icons/chains/rsz_megaeth",explorer:"https://mega.etherscan.io",eip1559:!0},poly:{id:137,name:"Polygon",shortname:"poly",native:{address:ne,symbol:"POL",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/64x64/28321.png"},wToken:{symbol:"WPOL",address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270.png"},publicRpcUrl:"https://polygon-rpc.com",logoUrl:"https://app.1inch.io/assets/images/network-logos/polygon.svg",explorer:"https://polygonscan.com",eip1559:!0},arb:{id:42161,name:"Arbitrum",shortname:"arb",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg"},wToken:{symbol:"WETH",address:"0x82af49447d8a07e3bd95bd0d56f35241523fbab1",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://arb1.arbitrum.io/rpc",logoUrl:"https://app.1inch.io/assets/images/network-logos/arbitrum.svg",explorer:"https://arbiscan.io",eip1559:!0},sei:{id:1329,name:"Sei",shortname:"sei",native:{address:ne,symbol:"SEI",decimals:18,logoUrl:"https://assets.coingecko.com/coins/images/28205/standard/Sei_Logo_-_Transparent.png"},wToken:{symbol:"WSEI",address:"0xE30feDd158A2e3b13e9badaeABaFc5516e95e8C7",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://evm-rpc.sei-apis.com",logoUrl:"https://assets.coingecko.com/coins/images/28205/standard/Sei_Logo_-_Transparent.png",explorer:"https://seitrace.com",eip1559:!1},avax:{id:43114,name:"Avalanche",shortname:"avax",native:{address:ne,symbol:"AVAX",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/avalanche.svg"},wToken:{symbol:"WAVAX",address:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7.png"},publicRpcUrl:"https://api.avax.network/ext/bc/C/rpc",logoUrl:"https://app.1inch.io/assets/images/network-logos/avalanche.svg",explorer:"https://snowtrace.io",eip1559:!0},ftm:{id:250,name:"Fantom",shortname:"ftm",native:{address:ne,symbol:"FTM",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/fantom.svg"},wToken:{symbol:"WFTM",address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0x4e15361fd6b4bb609fa63c81a2be19d873717870.png"},publicRpcUrl:"https://rpc.ftm.tools",logoUrl:"https://app.1inch.io/assets/images/network-logos/fantom.svg",explorer:"https://ftmscan.com",eip1559:!0},base:{id:8453,name:"Base",shortname:"base",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/1027.png"},wToken:{symbol:"WETH",address:"0x4200000000000000000000000000000000000006",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://mainnet.base.org",logoUrl:"https://app.1inch.io/assets/images/network-logos/base.svg",explorer:"https://basescan.org",eip1559:!1},linea:{id:59144,name:"Linea",shortname:"linea",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg"},wToken:{symbol:"WETH",address:"0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://rpc.linea.build",logoUrl:"https://lineascan.build/images/logo.svg",explorer:"https://lineascan.build",eip1559:!1},zksync:{id:324,name:"zksync",shortname:"zksync",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg"},wToken:{symbol:"WETH",address:"0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://mainnet.era.zksync.io",logoUrl:"https://raw.githubusercontent.com/matter-labs/zksync/0a4ca2145a0c95b5bafa84c2f095c644907a8825/zkSyncLogo.svg",explorer:"https://explorer.zksync.io/",eip1559:!0},zkevm:{id:1101,name:"zkevm",shortname:"zkevm",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg"},wToken:{symbol:"WETH",address:"0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://zkevm-rpc.com",logoUrl:"https://user-images.githubusercontent.com/18598517/235932702-bc47eae5-d672-4dd9-9da2-8ea8f51a93f3.png",explorer:"https://zkevm.polygonscan.com/",eip1559:!0},manta:{id:169,name:"manta",shortname:"manta",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://icons.llamao.fi/icons/chains/rsz_manta.jpg"},wToken:{symbol:"WETH",address:"0x0Dc808adcE2099A9F62AA87D9670745AbA741746",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://pacific-rpc.manta.network/http",logoUrl:"https://icons.llamao.fi/icons/chains/rsz_manta.jpg",explorer:"https://manta.socialscan.io/",eip1559:!0},blast:{id:81457,name:"blast",shortname:"blast",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://icons.llamao.fi/icons/chains/rsz_blast"},wToken:{symbol:"WETH",address:"0x4300000000000000000000000000000000000004",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://rpc.ankr.com/blast",logoUrl:"https://icons.llamao.fi/icons/chains/rsz_blast",explorer:"https://blastscan.io/",eip1559:!0},sonic:{id:146,name:"sonic",shortname:"sonic",native:{address:ne,symbol:"S",decimals:18,logoUrl:"https://icons.llamao.fi/icons/chains/rsz_sonic"},wToken:{symbol:"WS",address:"0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38",decimals:18,logoUrl:"https://icons.llamao.fi/icons/chains/rsz_sonic"},publicRpcUrl:"https://rpc.soniclabs.com",logoUrl:"https://icons.llamao.fi/icons/chains/rsz_sonic",explorer:"https://www.sonicscan.org/",eip1559:!0},scroll:{id:534352,name:"scroll",shortname:"scroll",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://icons.llamao.fi/icons/chains/rsz_scroll"},wToken:{symbol:"WETH",address:"0x5300000000000000000000000000000000000004",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://scroll-rpc.publicnode.com",logoUrl:"https://icons.llamao.fi/icons/chains/rsz_scroll",explorer:"https://scrollscan.com/",eip1559:!0},zircuit:{id:48900,name:"Zircuit",shortname:"zircuit",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg"},wToken:{symbol:"WETH",address:"0x4200000000000000000000000000000000000006",decimals:18,logoUrl:"https://tokens-data.1inch.io/images/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"},publicRpcUrl:"https://zircuit-mainnet.drpc.org",logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg",explorer:"https://explorer.zircuit.com/",eip1559:!0},flare:{id:14,name:"flare",shortname:"flare",native:{address:ne,symbol:"FLR",decimals:18,logoUrl:"https://icons.llamao.fi/icons/chains/rsz_flare?w=48&h=48"},wToken:{symbol:"WFLR",address:"0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d",decimals:18,logoUrl:"https://res.cloudinary.com/sparkdex/image/upload/q_100/v1/website-assets/coins/wflr?_a=DATAg1AAZAA0"},publicRpcUrl:"https://flare.network",logoUrl:"https://icons.llamao.fi/icons/chains/rsz_flare?w=48&h=48",explorer:"https://flarescan.com",eip1559:!0},cronosZkEvm:{id:388,name:"Cronos zkEVM",shortname:"cronosZkEvm",native:{address:"0x000000000000000000000000000000000000800a",symbol:"zkCRO",decimals:18,logoUrl:"https://cryptologos.cc/logos/cronos-cro-logo.png"},wToken:{symbol:"wzkCRO",address:"0xC1bF55EE54E16229d9b369a5502Bfe5fC9F20b6d",decimals:18,logoUrl:"https://cryptologos.cc/logos/cronos-cro-logo.png"},publicRpcUrl:"https://rpc.zkevm.cronos.org",logoUrl:"https://cryptologos.cc/logos/cronos-cro-logo.png",explorer:"https://explorer.zkevm.cronos.org",eip1559:!0},katana:{id:747474,name:"Katana",shortname:"katana",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://katana.network/assets/katana-logo.svg"},wToken:{symbol:"WETH",address:"0xee7d8bcfb72bc1880d0cf19822eb0a2e6577ab62",decimals:18,logoUrl:"https://katana.network/assets/weth-logo.svg"},publicRpcUrl:"https://rpc.katanarpc.com",logoUrl:"https://katana.network/assets/katana-logo.svg",explorer:"https://explorer.katana.garden",eip1559:!0},bera:{id:80094,name:"Bera",shortname:"bera",native:{address:ne,symbol:"BERA",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/24647.png"},wToken:{symbol:"WBERA",address:"0x6969696969696969696969696969696969696969",decimals:18,logoUrl:"https://berascan.com/token/images/wrappedbera_ofc_64.png"},publicRpcUrl:"https://rpc.berachain.com",logoUrl:"https://berascan.com/token/images/wrappedbera_ofc_64.png",explorer:"https://berascan.com",eip1559:!0},monad:{id:143,name:"Monad",shortname:"monad",native:{address:ne,symbol:"MONAD",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/30495.png"},wToken:{symbol:"WMON",address:"0x3bd359c1119da7da1d913d1c4d2b7c461115433a",decimals:18,logoUrl:"https://assets.coingecko.com/coins/images/70784/standard/wmon.png?1766028904"},publicRpcUrl:"https://monad-mainnet.drpc.org",logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/30495.png",explorer:"https://monad.network",eip1559:!0},optimism:{id:10,name:"Optimism",shortname:"optimism",native:{address:ne,symbol:"ETH",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/11840.png"},wToken:{symbol:"WETH",address:"0x4200000000000000000000000000000000000006",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/2396.png"},publicRpcUrl:"https://optimism.blockscout.com",logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/11840.png",explorer:"https://optimistic.etherscan.io",eip1559:!0},mantle:{id:5e3,name:"Mantle",shortname:"mantle",native:{address:ne,symbol:"MNT",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/27075.png"},wToken:{symbol:"WMNT",address:"0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8",decimals:18,logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/27614.png"},publicRpcUrl:"https://rpc.mantle.xyz",logoUrl:"https://s2.coinmarketcap.com/static/img/coins/128x128/27075.png",explorer:"https://mantlescan.xyz",eip1559:!0}},pn={version:"2.7.2"},Kn="https://order-sink-dev.orbs.network",mn="https://order-sink.orbs.network",qn="https://order-sink-v2.orbs.network",yn=pn.version.split(".")[0],ea=e=>{const t=Number(yn)>=2;return e?Kn:t?qn:mn},ta=(e=!1)=>`${e?Kn:qn}/config`,na=e=>{const t=Number(yn)>=2;return e?[Kn]:t?[qn,mn]:[mn]},ra={[Pe.Thena]:"0xB75218ba5A99bF57Fd02556B70F05A4A0f1Dbe67"},sa=({endpoint:e,exchange:t,partner:n})=>e===mn&&n&&ra[n]||t,Hn=300*1e3,An=1440*60*60*1e3,kr=300*1e3,aa=Hn/(60*1e3),$n=e=>`https://hub.orbs.network/api/private/project_cm7nb67z86nyr01z12gs0fxpf/subgraphs/orbs-twap-${e}/prod/gn`,Ue="https://hub.orbs.network/api/apikey/subgraphs/id",ia={[ye.eth.id]:`${Ue}/Bf7bvMYcJbDAvYWJmhMpHZ4cpFjqzkhK6GXXEpnPRq6`,[ye.bsc.id]:`${Ue}/4NfXEi8rreQsnAr4aJ45RLCKgnjcWX46Lbt9SadiCcz6`,[ye.poly.id]:`${Ue}/3PyRPWSvDnMowGbeBy7aNsvUkD5ZuxdXQw2RdJq4NdXi`,[ye.arb.id]:`${Ue}/83bpQexEaqBjHaQbKoFTbtvCXuo5RudRkfLgtRUYqo2c`,[ye.base.id]:`${Ue}/DFhaPQb3HATXkpsWNZw3gydYHehLBVEDiSk4iBdZJyps`,[ye.sei.id]:`${Ue}/5zjzRnURzoddyFSZBw5E5NAM3oBgPq3NasTYbtMk6EL6`,[ye.linea.id]:`${Ue}/6VsNPEYfFLPZCqdMMDadoXQjLHWJdjEwiD768GAtb7j6`,[ye.sonic.id]:`${Ue}/DtBr6a5vsoDd2oAXdPszcn4gLgrr1XC68Q3AJQKXnNLV`,[ye.ftm.id]:`${Ue}/DdRo1pmJkrJC9fjsjEBWnNE1uqrbh7Diz4tVKd7rfupp`,[ye.katana.id]:`${Ue}/CGi9sDFMQcnBwF3C3NoCFqnaE34sssbgwPLTwiskSXmW`,[ye.avax.id]:`${Ue}/FxZ1vMwE5Xy1qvKvZENUMz4vhW8Sh4vXJf9Vp7o17pTx`,[ye.bera.id]:$n("berachain"),[ye.flare.id]:$n("flare"),[ye.cronosZkEvm.id]:$n("cronos-zkevm")},oa=["0x0000000000000000000000000000000000000000","0x0000000000000000000000000000000000001010","0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","0x000000000000000000000000000000000000dEaD","0x000000000000000000000000000000000000800A","0x000000000000000000000000000000000000800a"],_r="115792089237316195423570985008687907853269984665640564039457584007913129639935",Ee=e=>`${e.name}_${e.chainId}`,ca={[Ee(V.SushiArb)]:["0x846F2B29ef314bF3D667981b4ffdADc5B858312a","0x08c41f5D1C844061f6D952E25827eeAA576c6536"],[Ee(V.SushiBase)]:["0x846F2B29ef314bF3D667981b4ffdADc5B858312a","0x08c41f5D1C844061f6D952E25827eeAA576c6536"],[Ee(V.SushiEth)]:["0xc55943Fa6509004B2903ED8F8ab7347BfC47D0bA","0x08c41f5D1C844061f6D952E25827eeAA576c6536"],[Ee(V.PancakeSwap)]:["0xb2BAFe188faD927240038cC4FfF2d771d8A58905","0xE2a0c3b9aD19A18c4bBa7fffBe5bC1b0E58Db1CE"],[Ee(V.PancakeSwapArbitrum)]:["0xE20167871dB616DdfFD0Fd870d9bC068C350DD1F","0x807488ADAD033e95C438F998277bE654152594dc"],[Ee(V.PancakeSwapBase)]:["0x10ed1F36e4eBE76E161c9AADDa20BE841bc0082c","0x3A9df3eE209b802D0337383f5abCe3204d623588"],[Ee(V.PancakeSwapLinea)]:["0x3A9df3eE209b802D0337383f5abCe3204d623588"],[Ee(V.QuickSwap)]:["0x26D0ec4Be402BCE03AAa8aAf0CF67e9428ba54eF"],[Ee(V.Thena)]:["0xc2aBC02acd77Bb2407efA22348dA9afC8B375290"],[Ee(V.Lynex)]:["0x72e3e1fD5D2Ee2F1C2Eb695206D490a1D45C3835"],[Ee(V.DragonSwap)]:["0x101e1B65Bb516FB5f4547C80BAe0b51f1b8D7a22"],[Ee(V.SpookySwapSonic)]:["0xAd97B770ad64aE47fc7d64B3bD820dCDbF9ff7DA"],[Ee(V.SpookySwap)]:["0x3924d62219483015f982b160d48c0fa5Fd436Cba"],[Ee(V.SwapX)]:["0xE5012eBDe5e26EE3Ea41992154731a03023CF274"]},Wn={unit:ve.Minutes,value:aa},ua="https://www.orbs.com/dtwap-and-dlimit-faq/",da="https://www.orbs.com/dtwap-and-dlimit-faq/#dSLTP",la="https://raw.githubusercontent.com/orbs-network/twap-ui/master/logo/orbslogo.svg",fa="https://www.orbs.com/",ha="https://www.orbs.com/dtwap-dlimit-disclaimer";var rn=(e=>(e.FRESHNESS="freshness",e.MIN_CHUNK_SIZE_USD="minChunkSizeUsd",e.ENV="env",e.DURATION="duration",e.IGNORE_ERRORS="ignore-errors",e))(rn||{});const pa="-5",ma="10",ya="-10",Aa="5";var ga=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,zn=Math.ceil,Oe=Math.floor,Fe="[BigNumber Error] ",Ur=Fe+"Number primitive has more than 15 significant digits: ",Le=1e14,W=14,Qn=9007199254740991,jn=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],nt=1e7,he=1e9;function Lr(e){var t,n,r,s=F.prototype={constructor:F,toString:null,valueOf:null},a=new F(1),i=20,u=4,f=-7,h=21,T=-1e7,b=1e7,x=!1,v=1,O=0,I={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},B="0123456789abcdefghijklmnopqrstuvwxyz",_=!0;function F(o,c){var d,g,m,y,w,p,A,C,E=this;if(!(E instanceof F))return new F(o,c);if(c==null){if(o&&o._isBigNumber===!0){E.s=o.s,!o.c||o.e>b?E.c=E.e=null:o.e<T?E.c=[E.e=0]:(E.e=o.e,E.c=o.c.slice());return}if((p=typeof o=="number")&&o*0==0){if(E.s=1/o<0?(o=-o,-1):1,o===~~o){for(y=0,w=o;w>=10;w/=10,y++);y>b?E.c=E.e=null:(E.e=y,E.c=[o]);return}C=String(o)}else{if(!ga.test(C=String(o)))return r(E,C,p);E.s=C.charCodeAt(0)==45?(C=C.slice(1),-1):1}(y=C.indexOf("."))>-1&&(C=C.replace(".","")),(w=C.search(/e/i))>0?(y<0&&(y=w),y+=+C.slice(w+1),C=C.substring(0,w)):y<0&&(y=C.length)}else{if(se(c,2,B.length,"Base"),c==10&&_)return E=new F(o),z(E,i+E.e+1,u);if(C=String(o),p=typeof o=="number"){if(o*0!=0)return r(E,C,p,c);if(E.s=1/o<0?(C=C.slice(1),-1):1,F.DEBUG&&C.replace(/^0\.0*|\./,"").length>15)throw Error(Ur+o)}else E.s=C.charCodeAt(0)===45?(C=C.slice(1),-1):1;for(d=B.slice(0,c),y=w=0,A=C.length;w<A;w++)if(d.indexOf(g=C.charAt(w))<0){if(g=="."){if(w>y){y=A;continue}}else if(!m&&(C==C.toUpperCase()&&(C=C.toLowerCase())||C==C.toLowerCase()&&(C=C.toUpperCase()))){m=!0,w=-1,y=0;continue}return r(E,String(o),p,c)}p=!1,C=n(C,c,10,E.s),(y=C.indexOf("."))>-1?C=C.replace(".",""):y=C.length}for(w=0;C.charCodeAt(w)===48;w++);for(A=C.length;C.charCodeAt(--A)===48;);if(C=C.slice(w,++A)){if(A-=w,p&&F.DEBUG&&A>15&&(o>Qn||o!==Oe(o)))throw Error(Ur+E.s*o);if((y=y-w-1)>b)E.c=E.e=null;else if(y<T)E.c=[E.e=0];else{if(E.e=y,E.c=[],w=(y+1)%W,y<0&&(w+=W),w<A){for(w&&E.c.push(+C.slice(0,w)),A-=W;w<A;)E.c.push(+C.slice(w,w+=W));w=W-(C=C.slice(w)).length}else w-=A;for(;w--;C+="0");E.c.push(+C)}}else E.c=[E.e=0]}F.clone=Lr,F.ROUND_UP=0,F.ROUND_DOWN=1,F.ROUND_CEIL=2,F.ROUND_FLOOR=3,F.ROUND_HALF_UP=4,F.ROUND_HALF_DOWN=5,F.ROUND_HALF_EVEN=6,F.ROUND_HALF_CEIL=7,F.ROUND_HALF_FLOOR=8,F.EUCLID=9,F.config=F.set=function(o){var c,d;if(o!=null)if(typeof o=="object"){if(o.hasOwnProperty(c="DECIMAL_PLACES")&&(d=o[c],se(d,0,he,c),i=d),o.hasOwnProperty(c="ROUNDING_MODE")&&(d=o[c],se(d,0,8,c),u=d),o.hasOwnProperty(c="EXPONENTIAL_AT")&&(d=o[c],d&&d.pop?(se(d[0],-he,0,c),se(d[1],0,he,c),f=d[0],h=d[1]):(se(d,-he,he,c),f=-(h=d<0?-d:d))),o.hasOwnProperty(c="RANGE"))if(d=o[c],d&&d.pop)se(d[0],-he,-1,c),se(d[1],1,he,c),T=d[0],b=d[1];else if(se(d,-he,he,c),d)T=-(b=d<0?-d:d);else throw Error(Fe+c+" cannot be zero: "+d);if(o.hasOwnProperty(c="CRYPTO"))if(d=o[c],d===!!d)if(d)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))x=d;else throw x=!d,Error(Fe+"crypto unavailable");else x=d;else throw Error(Fe+c+" not true or false: "+d);if(o.hasOwnProperty(c="MODULO_MODE")&&(d=o[c],se(d,0,9,c),v=d),o.hasOwnProperty(c="POW_PRECISION")&&(d=o[c],se(d,0,he,c),O=d),o.hasOwnProperty(c="FORMAT"))if(d=o[c],typeof d=="object")I=d;else throw Error(Fe+c+" not an object: "+d);if(o.hasOwnProperty(c="ALPHABET"))if(d=o[c],typeof d=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(d))_=d.slice(0,10)=="0123456789",B=d;else throw Error(Fe+c+" invalid: "+d)}else throw Error(Fe+"Object expected: "+o);return{DECIMAL_PLACES:i,ROUNDING_MODE:u,EXPONENTIAL_AT:[f,h],RANGE:[T,b],CRYPTO:x,MODULO_MODE:v,POW_PRECISION:O,FORMAT:I,ALPHABET:B}},F.isBigNumber=function(o){if(!o||o._isBigNumber!==!0)return!1;if(!F.DEBUG)return!0;var c,d,g=o.c,m=o.e,y=o.s;e:if({}.toString.call(g)=="[object Array]"){if((y===1||y===-1)&&m>=-he&&m<=he&&m===Oe(m)){if(g[0]===0){if(m===0&&g.length===1)return!0;break e}if(c=(m+1)%W,c<1&&(c+=W),String(g[0]).length==c){for(c=0;c<g.length;c++)if(d=g[c],d<0||d>=Le||d!==Oe(d))break e;if(d!==0)return!0}}}else if(g===null&&m===null&&(y===null||y===1||y===-1))return!0;throw Error(Fe+"Invalid BigNumber: "+o)},F.maximum=F.max=function(){return k(arguments,-1)},F.minimum=F.min=function(){return k(arguments,1)},F.random=(function(){var o=9007199254740992,c=Math.random()*o&2097151?function(){return Oe(Math.random()*o)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(d){var g,m,y,w,p,A=0,C=[],E=new F(a);if(d==null?d=i:se(d,0,he),w=zn(d/W),x)if(crypto.getRandomValues){for(g=crypto.getRandomValues(new Uint32Array(w*=2));A<w;)p=g[A]*131072+(g[A+1]>>>11),p>=9e15?(m=crypto.getRandomValues(new Uint32Array(2)),g[A]=m[0],g[A+1]=m[1]):(C.push(p%1e14),A+=2);A=w/2}else if(crypto.randomBytes){for(g=crypto.randomBytes(w*=7);A<w;)p=(g[A]&31)*281474976710656+g[A+1]*1099511627776+g[A+2]*4294967296+g[A+3]*16777216+(g[A+4]<<16)+(g[A+5]<<8)+g[A+6],p>=9e15?crypto.randomBytes(7).copy(g,A):(C.push(p%1e14),A+=7);A=w/7}else throw x=!1,Error(Fe+"crypto unavailable");if(!x)for(;A<w;)p=c(),p<9e15&&(C[A++]=p%1e14);for(w=C[--A],d%=W,w&&d&&(p=jn[W-d],C[A]=Oe(w/p)*p);C[A]===0;C.pop(),A--);if(A<0)C=[y=0];else{for(y=-1;C[0]===0;C.splice(0,1),y-=W);for(A=1,p=C[0];p>=10;p/=10,A++);A<W&&(y-=W-A)}return E.e=y,E.c=C,E}})(),F.sum=function(){for(var o=1,c=arguments,d=new F(c[0]);o<c.length;)d=d.plus(c[o++]);return d},n=(function(){var o="0123456789";function c(d,g,m,y){for(var w,p=[0],A,C=0,E=d.length;C<E;){for(A=p.length;A--;p[A]*=g);for(p[0]+=y.indexOf(d.charAt(C++)),w=0;w<p.length;w++)p[w]>m-1&&(p[w+1]==null&&(p[w+1]=0),p[w+1]+=p[w]/m|0,p[w]%=m)}return p.reverse()}return function(d,g,m,y,w){var p,A,C,E,P,L,R,Z,ie=d.indexOf("."),fe=i,J=u;for(ie>=0&&(E=O,O=0,d=d.replace(".",""),Z=new F(g),L=Z.pow(d.length-ie),O=E,Z.c=c(Ve(Ie(L.c),L.e,"0"),10,m,o),Z.e=Z.c.length),R=c(d,g,m,w?(p=B,o):(p=o,B)),C=E=R.length;R[--E]==0;R.pop());if(!R[0])return p.charAt(0);if(ie<0?--C:(L.c=R,L.e=C,L.s=y,L=t(L,Z,fe,J,m),R=L.c,P=L.r,C=L.e),A=C+fe+1,ie=R[A],E=m/2,P=P||A<0||R[A+1]!=null,P=J<4?(ie!=null||P)&&(J==0||J==(L.s<0?3:2)):ie>E||ie==E&&(J==4||P||J==6&&R[A-1]&1||J==(L.s<0?8:7)),A<1||!R[0])d=P?Ve(p.charAt(1),-fe,p.charAt(0)):p.charAt(0);else{if(R.length=A,P)for(--m;++R[--A]>m;)R[A]=0,A||(++C,R=[1].concat(R));for(E=R.length;!R[--E];);for(ie=0,d="";ie<=E;d+=p.charAt(R[ie++]));d=Ve(d,C,p.charAt(0))}return d}})(),t=(function(){function o(g,m,y){var w,p,A,C,E=0,P=g.length,L=m%nt,R=m/nt|0;for(g=g.slice();P--;)A=g[P]%nt,C=g[P]/nt|0,w=R*A+C*L,p=L*A+w%nt*nt+E,E=(p/y|0)+(w/nt|0)+R*C,g[P]=p%y;return E&&(g=[E].concat(g)),g}function c(g,m,y,w){var p,A;if(y!=w)A=y>w?1:-1;else for(p=A=0;p<y;p++)if(g[p]!=m[p]){A=g[p]>m[p]?1:-1;break}return A}function d(g,m,y,w){for(var p=0;y--;)g[y]-=p,p=g[y]<m[y]?1:0,g[y]=p*w+g[y]-m[y];for(;!g[0]&&g.length>1;g.splice(0,1));}return function(g,m,y,w,p){var A,C,E,P,L,R,Z,ie,fe,J,te,be,Ln,Cr,Tr,je,fn,_e=g.s==m.s?1:-1,we=g.c,oe=m.c;if(!we||!we[0]||!oe||!oe[0])return new F(!g.s||!m.s||(we?oe&&we[0]==oe[0]:!oe)?NaN:we&&we[0]==0||!oe?_e*0:_e/0);for(ie=new F(_e),fe=ie.c=[],C=g.e-m.e,_e=y+C+1,p||(p=Le,C=Be(g.e/W)-Be(m.e/W),_e=_e/W|0),E=0;oe[E]==(we[E]||0);E++);if(oe[E]>(we[E]||0)&&C--,_e<0)fe.push(1),P=!0;else{for(Cr=we.length,je=oe.length,E=0,_e+=2,L=Oe(p/(oe[0]+1)),L>1&&(oe=o(oe,L,p),we=o(we,L,p),je=oe.length,Cr=we.length),Ln=je,J=we.slice(0,je),te=J.length;te<je;J[te++]=0);fn=oe.slice(),fn=[0].concat(fn),Tr=oe[0],oe[1]>=p/2&&Tr++;do{if(L=0,A=c(oe,J,je,te),A<0){if(be=J[0],je!=te&&(be=be*p+(J[1]||0)),L=Oe(be/Tr),L>1)for(L>=p&&(L=p-1),R=o(oe,L,p),Z=R.length,te=J.length;c(R,J,Z,te)==1;)L--,d(R,je<Z?fn:oe,Z,p),Z=R.length,A=1;else L==0&&(A=L=1),R=oe.slice(),Z=R.length;if(Z<te&&(R=[0].concat(R)),d(J,R,te,p),te=J.length,A==-1)for(;c(oe,J,je,te)<1;)L++,d(J,je<te?fn:oe,te,p),te=J.length}else A===0&&(L++,J=[0]);fe[E++]=L,J[0]?J[te++]=we[Ln]||0:(J=[we[Ln]],te=1)}while((Ln++<Cr||J[0]!=null)&&_e--);P=J[0]!=null,fe[0]||fe.splice(0,1)}if(p==Le){for(E=1,_e=fe[0];_e>=10;_e/=10,E++);z(ie,y+(ie.e=E+C*W-1)+1,w,P)}else ie.e=C,ie.r=+P;return ie}})();function q(o,c,d,g){var m,y,w,p,A;if(d==null?d=u:se(d,0,8),!o.c)return o.toString();if(m=o.c[0],w=o.e,c==null)A=Ie(o.c),A=g==1||g==2&&(w<=f||w>=h)?bn(A,w):Ve(A,w,"0");else if(o=z(new F(o),c,d),y=o.e,A=Ie(o.c),p=A.length,g==1||g==2&&(c<=y||y<=f)){for(;p<c;A+="0",p++);A=bn(A,y)}else if(c-=w+(g===2&&y>w),A=Ve(A,y,"0"),y+1>p){if(--c>0)for(A+=".";c--;A+="0");}else if(c+=y-p,c>0)for(y+1==p&&(A+=".");c--;A+="0");return o.s<0&&m?"-"+A:A}function k(o,c){for(var d,g,m=1,y=new F(o[0]);m<o.length;m++)g=new F(o[m]),(!g.s||(d=At(y,g))===c||d===0&&y.s===c)&&(y=g);return y}function Q(o,c,d){for(var g=1,m=c.length;!c[--m];c.pop());for(m=c[0];m>=10;m/=10,g++);return(d=g+d*W-1)>b?o.c=o.e=null:d<T?o.c=[o.e=0]:(o.e=d,o.c=c),o}r=(function(){var o=/^(-?)0([xbo])(?=\w[\w.]*$)/i,c=/^([^.]+)\.$/,d=/^\.([^.]+)$/,g=/^-?(Infinity|NaN)$/,m=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(y,w,p,A){var C,E=p?w:w.replace(m,"");if(g.test(E))y.s=isNaN(E)?null:E<0?-1:1;else{if(!p&&(E=E.replace(o,function(P,L,R){return C=(R=R.toLowerCase())=="x"?16:R=="b"?2:8,!A||A==C?L:P}),A&&(C=A,E=E.replace(c,"$1").replace(d,"0.$1")),w!=E))return new F(E,C);if(F.DEBUG)throw Error(Fe+"Not a"+(A?" base "+A:"")+" number: "+w);y.s=null}y.c=y.e=null}})();function z(o,c,d,g){var m,y,w,p,A,C,E,P=o.c,L=jn;if(P){e:{for(m=1,p=P[0];p>=10;p/=10,m++);if(y=c-m,y<0)y+=W,w=c,A=P[C=0],E=Oe(A/L[m-w-1]%10);else if(C=zn((y+1)/W),C>=P.length)if(g){for(;P.length<=C;P.push(0));A=E=0,m=1,y%=W,w=y-W+1}else break e;else{for(A=p=P[C],m=1;p>=10;p/=10,m++);y%=W,w=y-W+m,E=w<0?0:Oe(A/L[m-w-1]%10)}if(g=g||c<0||P[C+1]!=null||(w<0?A:A%L[m-w-1]),g=d<4?(E||g)&&(d==0||d==(o.s<0?3:2)):E>5||E==5&&(d==4||g||d==6&&(y>0?w>0?A/L[m-w]:0:P[C-1])%10&1||d==(o.s<0?8:7)),c<1||!P[0])return P.length=0,g?(c-=o.e+1,P[0]=L[(W-c%W)%W],o.e=-c||0):P[0]=o.e=0,o;if(y==0?(P.length=C,p=1,C--):(P.length=C+1,p=L[W-y],P[C]=w>0?Oe(A/L[m-w]%L[w])*p:0),g)for(;;)if(C==0){for(y=1,w=P[0];w>=10;w/=10,y++);for(w=P[0]+=p,p=1;w>=10;w/=10,p++);y!=p&&(o.e++,P[0]==Le&&(P[0]=1));break}else{if(P[C]+=p,P[C]!=Le)break;P[C--]=0,p=1}for(y=P.length;P[--y]===0;P.pop());}o.e>b?o.c=o.e=null:o.e<T&&(o.c=[o.e=0])}return o}function re(o){var c,d=o.e;return d===null?o.toString():(c=Ie(o.c),c=d<=f||d>=h?bn(c,d):Ve(c,d,"0"),o.s<0?"-"+c:c)}return s.absoluteValue=s.abs=function(){var o=new F(this);return o.s<0&&(o.s=1),o},s.comparedTo=function(o,c){return At(this,new F(o,c))},s.decimalPlaces=s.dp=function(o,c){var d,g,m,y=this;if(o!=null)return se(o,0,he),c==null?c=u:se(c,0,8),z(new F(y),o+y.e+1,c);if(!(d=y.c))return null;if(g=((m=d.length-1)-Be(this.e/W))*W,m=d[m])for(;m%10==0;m/=10,g--);return g<0&&(g=0),g},s.dividedBy=s.div=function(o,c){return t(this,new F(o,c),i,u)},s.dividedToIntegerBy=s.idiv=function(o,c){return t(this,new F(o,c),0,1)},s.exponentiatedBy=s.pow=function(o,c){var d,g,m,y,w,p,A,C,E,P=this;if(o=new F(o),o.c&&!o.isInteger())throw Error(Fe+"Exponent not an integer: "+re(o));if(c!=null&&(c=new F(c)),p=o.e>14,!P.c||!P.c[0]||P.c[0]==1&&!P.e&&P.c.length==1||!o.c||!o.c[0])return E=new F(Math.pow(+re(P),p?o.s*(2-gn(o)):+re(o))),c?E.mod(c):E;if(A=o.s<0,c){if(c.c?!c.c[0]:!c.s)return new F(NaN);g=!A&&P.isInteger()&&c.isInteger(),g&&(P=P.mod(c))}else{if(o.e>9&&(P.e>0||P.e<-1||(P.e==0?P.c[0]>1||p&&P.c[1]>=24e7:P.c[0]<8e13||p&&P.c[0]<=9999975e7)))return y=P.s<0&&gn(o)?-0:0,P.e>-1&&(y=1/y),new F(A?1/y:y);O&&(y=zn(O/W+2))}for(p?(d=new F(.5),A&&(o.s=1),C=gn(o)):(m=Math.abs(+re(o)),C=m%2),E=new F(a);;){if(C){if(E=E.times(P),!E.c)break;y?E.c.length>y&&(E.c.length=y):g&&(E=E.mod(c))}if(m){if(m=Oe(m/2),m===0)break;C=m%2}else if(o=o.times(d),z(o,o.e+1,1),o.e>14)C=gn(o);else{if(m=+re(o),m===0)break;C=m%2}P=P.times(P),y?P.c&&P.c.length>y&&(P.c.length=y):g&&(P=P.mod(c))}return g?E:(A&&(E=a.div(E)),c?E.mod(c):y?z(E,O,u,w):E)},s.integerValue=function(o){var c=new F(this);return o==null?o=u:se(o,0,8),z(c,c.e+1,o)},s.isEqualTo=s.eq=function(o,c){return At(this,new F(o,c))===0},s.isFinite=function(){return!!this.c},s.isGreaterThan=s.gt=function(o,c){return At(this,new F(o,c))>0},s.isGreaterThanOrEqualTo=s.gte=function(o,c){return(c=At(this,new F(o,c)))===1||c===0},s.isInteger=function(){return!!this.c&&Be(this.e/W)>this.c.length-2},s.isLessThan=s.lt=function(o,c){return At(this,new F(o,c))<0},s.isLessThanOrEqualTo=s.lte=function(o,c){return(c=At(this,new F(o,c)))===-1||c===0},s.isNaN=function(){return!this.s},s.isNegative=function(){return this.s<0},s.isPositive=function(){return this.s>0},s.isZero=function(){return!!this.c&&this.c[0]==0},s.minus=function(o,c){var d,g,m,y,w=this,p=w.s;if(o=new F(o,c),c=o.s,!p||!c)return new F(NaN);if(p!=c)return o.s=-c,w.plus(o);var A=w.e/W,C=o.e/W,E=w.c,P=o.c;if(!A||!C){if(!E||!P)return E?(o.s=-c,o):new F(P?w:NaN);if(!E[0]||!P[0])return P[0]?(o.s=-c,o):new F(E[0]?w:u==3?-0:0)}if(A=Be(A),C=Be(C),E=E.slice(),p=A-C){for((y=p<0)?(p=-p,m=E):(C=A,m=P),m.reverse(),c=p;c--;m.push(0));m.reverse()}else for(g=(y=(p=E.length)<(c=P.length))?p:c,p=c=0;c<g;c++)if(E[c]!=P[c]){y=E[c]<P[c];break}if(y&&(m=E,E=P,P=m,o.s=-o.s),c=(g=P.length)-(d=E.length),c>0)for(;c--;E[d++]=0);for(c=Le-1;g>p;){if(E[--g]<P[g]){for(d=g;d&&!E[--d];E[d]=c);--E[d],E[g]+=Le}E[g]-=P[g]}for(;E[0]==0;E.splice(0,1),--C);return E[0]?Q(o,E,C):(o.s=u==3?-1:1,o.c=[o.e=0],o)},s.modulo=s.mod=function(o,c){var d,g,m=this;return o=new F(o,c),!m.c||!o.s||o.c&&!o.c[0]?new F(NaN):!o.c||m.c&&!m.c[0]?new F(m):(v==9?(g=o.s,o.s=1,d=t(m,o,0,3),o.s=g,d.s*=g):d=t(m,o,0,v),o=m.minus(d.times(o)),!o.c[0]&&v==1&&(o.s=m.s),o)},s.multipliedBy=s.times=function(o,c){var d,g,m,y,w,p,A,C,E,P,L,R,Z,ie,fe,J=this,te=J.c,be=(o=new F(o,c)).c;if(!te||!be||!te[0]||!be[0])return!J.s||!o.s||te&&!te[0]&&!be||be&&!be[0]&&!te?o.c=o.e=o.s=null:(o.s*=J.s,!te||!be?o.c=o.e=null:(o.c=[0],o.e=0)),o;for(g=Be(J.e/W)+Be(o.e/W),o.s*=J.s,A=te.length,P=be.length,A<P&&(Z=te,te=be,be=Z,m=A,A=P,P=m),m=A+P,Z=[];m--;Z.push(0));for(ie=Le,fe=nt,m=P;--m>=0;){for(d=0,L=be[m]%fe,R=be[m]/fe|0,w=A,y=m+w;y>m;)C=te[--w]%fe,E=te[w]/fe|0,p=R*C+E*L,C=L*C+p%fe*fe+Z[y]+d,d=(C/ie|0)+(p/fe|0)+R*E,Z[y--]=C%ie;Z[y]=d}return d?++g:Z.splice(0,1),Q(o,Z,g)},s.negated=function(){var o=new F(this);return o.s=-o.s||null,o},s.plus=function(o,c){var d,g=this,m=g.s;if(o=new F(o,c),c=o.s,!m||!c)return new F(NaN);if(m!=c)return o.s=-c,g.minus(o);var y=g.e/W,w=o.e/W,p=g.c,A=o.c;if(!y||!w){if(!p||!A)return new F(m/0);if(!p[0]||!A[0])return A[0]?o:new F(p[0]?g:m*0)}if(y=Be(y),w=Be(w),p=p.slice(),m=y-w){for(m>0?(w=y,d=A):(m=-m,d=p),d.reverse();m--;d.push(0));d.reverse()}for(m=p.length,c=A.length,m-c<0&&(d=A,A=p,p=d,c=m),m=0;c;)m=(p[--c]=p[c]+A[c]+m)/Le|0,p[c]=Le===p[c]?0:p[c]%Le;return m&&(p=[m].concat(p),++w),Q(o,p,w)},s.precision=s.sd=function(o,c){var d,g,m,y=this;if(o!=null&&o!==!!o)return se(o,1,he),c==null?c=u:se(c,0,8),z(new F(y),o,c);if(!(d=y.c))return null;if(m=d.length-1,g=m*W+1,m=d[m]){for(;m%10==0;m/=10,g--);for(m=d[0];m>=10;m/=10,g++);}return o&&y.e+1>g&&(g=y.e+1),g},s.shiftedBy=function(o){return se(o,-Qn,Qn),this.times("1e"+o)},s.squareRoot=s.sqrt=function(){var o,c,d,g,m,y=this,w=y.c,p=y.s,A=y.e,C=i+4,E=new F("0.5");if(p!==1||!w||!w[0])return new F(!p||p<0&&(!w||w[0])?NaN:w?y:1/0);if(p=Math.sqrt(+re(y)),p==0||p==1/0?(c=Ie(w),(c.length+A)%2==0&&(c+="0"),p=Math.sqrt(+c),A=Be((A+1)/2)-(A<0||A%2),p==1/0?c="5e"+A:(c=p.toExponential(),c=c.slice(0,c.indexOf("e")+1)+A),d=new F(c)):d=new F(p+""),d.c[0]){for(A=d.e,p=A+C,p<3&&(p=0);;)if(m=d,d=E.times(m.plus(t(y,m,C,1))),Ie(m.c).slice(0,p)===(c=Ie(d.c)).slice(0,p))if(d.e<A&&--p,c=c.slice(p-3,p+1),c=="9999"||!g&&c=="4999"){if(!g&&(z(m,m.e+i+2,0),m.times(m).eq(y))){d=m;break}C+=4,p+=4,g=1}else{(!+c||!+c.slice(1)&&c.charAt(0)=="5")&&(z(d,d.e+i+2,1),o=!d.times(d).eq(y));break}}return z(d,d.e+i+1,u,o)},s.toExponential=function(o,c){return o!=null&&(se(o,0,he),o++),q(this,o,c,1)},s.toFixed=function(o,c){return o!=null&&(se(o,0,he),o=o+this.e+1),q(this,o,c)},s.toFormat=function(o,c,d){var g,m=this;if(d==null)o!=null&&c&&typeof c=="object"?(d=c,c=null):o&&typeof o=="object"?(d=o,o=c=null):d=I;else if(typeof d!="object")throw Error(Fe+"Argument not an object: "+d);if(g=m.toFixed(o,c),m.c){var y,w=g.split("."),p=+d.groupSize,A=+d.secondaryGroupSize,C=d.groupSeparator||"",E=w[0],P=w[1],L=m.s<0,R=L?E.slice(1):E,Z=R.length;if(A&&(y=p,p=A,A=y,Z-=y),p>0&&Z>0){for(y=Z%p||p,E=R.substr(0,y);y<Z;y+=p)E+=C+R.substr(y,p);A>0&&(E+=C+R.slice(y)),L&&(E="-"+E)}g=P?E+(d.decimalSeparator||"")+((A=+d.fractionGroupSize)?P.replace(new RegExp("\\d{"+A+"}\\B","g"),"$&"+(d.fractionGroupSeparator||"")):P):E}return(d.prefix||"")+g+(d.suffix||"")},s.toFraction=function(o){var c,d,g,m,y,w,p,A,C,E,P,L,R=this,Z=R.c;if(o!=null&&(p=new F(o),!p.isInteger()&&(p.c||p.s!==1)||p.lt(a)))throw Error(Fe+"Argument "+(p.isInteger()?"out of range: ":"not an integer: ")+re(p));if(!Z)return new F(R);for(c=new F(a),C=d=new F(a),g=A=new F(a),L=Ie(Z),y=c.e=L.length-R.e-1,c.c[0]=jn[(w=y%W)<0?W+w:w],o=!o||p.comparedTo(c)>0?y>0?c:C:p,w=b,b=1/0,p=new F(L),A.c[0]=0;E=t(p,c,0,1),m=d.plus(E.times(g)),m.comparedTo(o)!=1;)d=g,g=m,C=A.plus(E.times(m=C)),A=m,c=p.minus(E.times(m=c)),p=m;return m=t(o.minus(d),g,0,1),A=A.plus(m.times(C)),d=d.plus(m.times(g)),A.s=C.s=R.s,y=y*2,P=t(C,g,y,u).minus(R).abs().comparedTo(t(A,d,y,u).minus(R).abs())<1?[C,g]:[A,d],b=w,P},s.toNumber=function(){return+re(this)},s.toPrecision=function(o,c){return o!=null&&se(o,1,he),q(this,o,c,2)},s.toString=function(o){var c,d=this,g=d.s,m=d.e;return m===null?g?(c="Infinity",g<0&&(c="-"+c)):c="NaN":(o==null?c=m<=f||m>=h?bn(Ie(d.c),m):Ve(Ie(d.c),m,"0"):o===10&&_?(d=z(new F(d),i+m+1,u),c=Ve(Ie(d.c),d.e,"0")):(se(o,2,B.length,"Base"),c=n(Ve(Ie(d.c),m,"0"),10,o,g,!0)),g<0&&d.c[0]&&(c="-"+c)),c},s.valueOf=s.toJSON=function(){return re(this)},s._isBigNumber=!0,s[Symbol.toStringTag]="BigNumber",s[Symbol.for("nodejs.util.inspect.custom")]=s.valueOf,e!=null&&F.set(e),F}function Be(e){var t=e|0;return e>0||e===t?t:t-1}function Ie(e){for(var t,n,r=1,s=e.length,a=e[0]+"";r<s;){for(t=e[r++]+"",n=W-t.length;n--;t="0"+t);a+=t}for(s=a.length;a.charCodeAt(--s)===48;);return a.slice(0,s+1||1)}function At(e,t){var n,r,s=e.c,a=t.c,i=e.s,u=t.s,f=e.e,h=t.e;if(!i||!u)return null;if(n=s&&!s[0],r=a&&!a[0],n||r)return n?r?0:-u:i;if(i!=u)return i;if(n=i<0,r=f==h,!s||!a)return r?0:!s^n?1:-1;if(!r)return f>h^n?1:-1;for(u=(f=s.length)<(h=a.length)?f:h,i=0;i<u;i++)if(s[i]!=a[i])return s[i]>a[i]^n?1:-1;return f==h?0:f>h^n?1:-1}function se(e,t,n,r){if(e<t||e>n||e!==Oe(e))throw Error(Fe+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function gn(e){var t=e.c.length-1;return Be(e.e/W)==t&&e.c[t]%2!=0}function bn(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function Ve(e,t,n){var r,s;if(t<0){for(s=n+".";++t;s+=n);e=s+e}else if(r=e.length,++t>r){for(s=n,t-=r;--t;s+=n);e+=s}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var D=Lr();function ba(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}const Ea={1:{adapter:{Nordstern:"0x6603629C8d4b683fdc51c7F810D1799cfEAcEAe3",Sushi:"0x11985E88847aEC23D1C3BCD77Ca0F4A704aB751c",Ring:"0x47e27973dA3e16dB13F8b713877b3A31623E0E5B",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",Magpie:"0x8622CBd71D8Aba76Ce1C2235510f2b2C6335C31E",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d",Paraswap:"0x777A3e65a5473148D5d7abdFD2BB5bFB61b6432f"},dex:{sushiswap:{type:"default",solver:"Sushi",router:"0xAC4c6e212A361c968F1725b4d055b47E63F80b75",adapter:"0x2e43A28FAf083717CcD9B246d97C61E1Bc9914Df",fee:"0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc"},ring:{type:"dynamicp2",solver:"Ring",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",adapter:"0x028fa69049aB68EC42064Eb18896D587dD41Af2a",fee:"0xA04329696aAd1417c75Cf6d91342815001999B21"}}},10:{adapter:{Nordstern:"0x1D06d98D523F8B51AD693D4A22fb97fCf0838d83",Sushi:"0x11985E88847aEC23D1C3BCD77Ca0F4A704aB751c",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",Magpie:"0x8622CBd71D8Aba76Ce1C2235510f2b2C6335C31E",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d",Paraswap:"0x777A3e65a5473148D5d7abdFD2BB5bFB61b6432f"},dex:{}},14:{adapter:{Nordstern:"0xd16A1849E86431872a87f476fa0DfB30eEb96cb3",SparkDex:"0x00c7617C471Ef69124464CEc318a3b8CC90aE9A7",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d"},dex:{spark:{type:"default",solver:"SparkDex",router:"0x0f3D8a38D4c74afBebc2c42695642f0e3acb15D3",adapter:"0x00c7617C471Ef69124464CEc318a3b8CC90aE9A7",fee:"0xaeA8C3e1a129A77686E115b1a46D9aD8405F7D2b"}}},56:{adapter:{Nordstern:"0x20253Cd6EEEB89e61ce7DDCf74a25Baba6A05BDF",Orbs:"0xaf3532dca7b4a75cD06671614C093e9e8fb5b1F2",Ring:"0x47e27973dA3e16dB13F8b713877b3A31623E0E5B",Topaz:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",Magpie:"0xBB5f16d51cF0eEfcC894268a72a9cF42d9a6F4f0",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d",Paraswap:"0x777A3e65a5473148D5d7abdFD2BB5bFB61b6432f",Sushi:"0xA985f801ea74321AdcC9Ef88B394858CbA3F71ba"},dex:{thena:{type:"universal",adapter:"0xEC85273E085eD7f7b9879c4A67a3E5D9f3AD242A",fee:"0x15eBc8b5b3877512FFF23650188694A9a8891FAc"},pancake:{type:"p2",solver:"Orbs",router:"0xd9C500DfF816a1Da21A48A732d3498Bf09dc9AEB",permit2:"0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",adapter:"0x52Ed96B1AEd25818B6A284b063b055488E012b73",fee:"0x37A957f10F458e0d7fDECBE2917971b57F15c927"},ring:{type:"dynamicp2",solver:"Ring",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",adapter:"0x028fa69049aB68EC42064Eb18896D587dD41Af2a",fee:"0xA04329696aAd1417c75Cf6d91342815001999B21"},topaz:{type:"default",solver:"Topaz",router:"0x6352a56caadC4F1E25CD6c75970Fa768A3304e64",adapter:"0x671c59dCbc8ee3a08D15e1D03a88032740869919",fee:"0xDbB17E23d12cd3C0AA856528F7177a68f98fFd5B"}}},130:{adapter:{Nordstern:"0x763Fb927d181bCE8be779794A030BCE45D4869fA",Ring:"0x47e27973dA3e16dB13F8b713877b3A31623E0E5B",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",Magpie:"0x6795A03Af6E1332BD931C0891D5C6AFF85550b54",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d",Paraswap:"0x777A3e65a5473148D5d7abdFD2BB5bFB61b6432f"},dex:{ring:{type:"dynamicp2",solver:"Ring",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",adapter:"0x028fa69049aB68EC42064Eb18896D587dD41Af2a",fee:"0xA04329696aAd1417c75Cf6d91342815001999B21"}}},137:{adapter:{Nordstern:"0xf065b4bFa073b5A0A3eb254D67cbc5118D8B0Ea7",Paraswap:"0x179C4b8e982b5F1365d36CC8d0c1CEB621B7198D",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",Magpie:"0x8622CBd71D8Aba76Ce1C2235510f2b2C6335C31E",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d",Sushi:"0xA985f801ea74321AdcC9Ef88B394858CbA3F71ba"},dex:{quick:{type:"paraswap",solver:"Paraswap",router:"0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57",adapter:"0x727e1CbA41Ff1ff11C32fa43DAb499b4317A1b65",fee:"0xd207DC6a6dA88f27c8DB78201F974161b1d84b1f"},teafi:{type:"paraswap",solver:"Paraswap",router:"0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57",adapter:"0xF710D67C783D2C14671EC1c61B0683DCb996F5c3",fee:"0x04Ff96e2c4D62b5771795d307AD679a25b3D2D50"}}},143:{adapter:{Nordstern:"0xd16A1849E86431872a87f476fa0DfB30eEb96cb3",OpenOcean:"0xc7f07C830e22FCA94bF52F38C6707F9D396c6172",Kyber:"0x6f4e5b8d7F6b037c62277992c39E7834D7C04596",Magpie:"0x6795A03Af6E1332BD931C0891D5C6AFF85550b54",Sushi:"0xA985f801ea74321AdcC9Ef88B394858CbA3F71ba"},dex:{yowie:{type:"default",solver:"OpenOcean",router:"0x6352a56caadC4F1E25CD6c75970Fa768A3304e64",adapter:"0xCA84Ab5a5A5bf2cff6AC0C835eF049365D13c6cB",fee:"0x6AF3eE77A3A3257777F5649aFa611b4C7Fd975Ef"},pangolin:{type:"default",solver:"Kyber",router:"0x6131B5fae19EA4f9D964eAc0408E4408b66337b5",adapter:"0xf42106eBf985bF49b39eba0114F57FA05e7B52eD",fee:"0xde92da99D188Ceb54A11ec711EF52D808A6260B5"}}},146:{adapter:{Nordstern:"0xEAEEdF2b8818970356212d5C2f449E2BE68D6800",OpenOcean:"0xc7f07C830e22FCA94bF52F38C6707F9D396c6172",Magpie:"0x217E9311396C8722b9eC98aFf865F067fe5E59c1",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",Sushi:"0xA985f801ea74321AdcC9Ef88B394858CbA3F71ba",Paraswap:"0x777A3e65a5473148D5d7abdFD2BB5bFB61b6432f"},dex:{spooky:{type:"default",solver:"Magpie",router:"0x20f6ee51340adeed01a59b0e65cb3703f3dc860c",adapter:"0x0F6533Fd45D13ad6AAa364023d6c05eCB2d3Ac2E",fee:"0x840Df4684B35BC68BcdA3F6707A3c82A0D662f8b"},swapx:{type:"default",solver:"OpenOcean",router:"0x6352a56caadC4F1E25CD6c75970Fa768A3304e64",adapter:"0xa7AE3ABf86C81cCEFEd6bE77045F2a32660c1B1c",fee:"0x6E03f7BC0f141894612AA017796096399623895F"},shadow:{type:"default",solver:"Magpie",router:"0x20f6ee51340adeed01a59b0e65cb3703f3dc860c",adapter:"0x39b024E187e5f35fea05953fECB9314a97de3d94",fee:"0xb9e3751fAF3187E1bC468E56a707a8A91754460e"}}},196:{adapter:{Ring:"0x47e27973dA3e16dB13F8b713877b3A31623E0E5B",Sushi:"0xA985f801ea74321AdcC9Ef88B394858CbA3F71ba"},dex:{ring:{type:"dynamicp2",solver:"Ring",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",adapter:"0x028fa69049aB68EC42064Eb18896D587dD41Af2a",fee:"0xA04329696aAd1417c75Cf6d91342815001999B21"}}},999:{adapter:{Nordstern:"0xA9c6c1F14c1d0eF2ab6ec79E5dcF0ff3a3680F05",Ring:"0x47e27973dA3e16dB13F8b713877b3A31623E0E5B",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d",Magpie:"0x6795A03Af6E1332BD931C0891D5C6AFF85550b54",Sushi:"0xA985f801ea74321AdcC9Ef88B394858CbA3F71ba"},dex:{ring:{type:"dynamicp2",solver:"Ring",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",adapter:"0x028fa69049aB68EC42064Eb18896D587dD41Af2a",fee:"0xA04329696aAd1417c75Cf6d91342815001999B21"}}},1329:{adapter:{Nordstern:"0xd16A1849E86431872a87f476fa0DfB30eEb96cb3",DragonSwap:"0x1e84A9f30607959d2d8b1a04171ef7D9522Ef502",OpenOcean:"0xc7f07C830e22FCA94bF52F38C6707F9D396c6172"},dex:{dragon:{type:"default",solver:"DragonSwap",router:"0x11DA6463D6Cb5a03411Dbf5ab6f6bc3997Ac7428",adapter:"0x1e84A9f30607959d2d8b1a04171ef7D9522Ef502",fee:"0x0dc1E0525202b32e89bA78ed55b1e5cEdB751334"},nami:{type:"default",solver:"OpenOcean",router:"0x6352a56caadC4F1E25CD6c75970Fa768A3304e64",adapter:"0xba56F9A7865d430c8293851D576b5728Ca711ff5",fee:"0xeB58450e23632003f013568703F54446070E2E80"}}},4326:{adapter:{Ring:"0x47e27973dA3e16dB13F8b713877b3A31623E0E5B",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",Magpie:"0x6795A03Af6E1332BD931C0891D5C6AFF85550b54",Sushi:"0xA985f801ea74321AdcC9Ef88B394858CbA3F71ba"},dex:{ring:{type:"dynamicp2",solver:"Ring",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",adapter:"0x028fa69049aB68EC42064Eb18896D587dD41Af2a",fee:"0xA04329696aAd1417c75Cf6d91342815001999B21"}}},8453:{adapter:{Nordstern:"0xd16A1849E86431872a87f476fa0DfB30eEb96cb3",Orbs:"0x917b492557957f5dD3e69c04c8E1Ac3d6948c022",Kyber:"0x6f4e5b8d7F6b037c62277992c39E7834D7C04596",TrebleSwap:"0x6f4938535879c668A797F2a6e9B912c54f9D43Cf",Sushi:"0x11985E88847aEC23D1C3BCD77Ca0F4A704aB751c",Ring:"0x47e27973dA3e16dB13F8b713877b3A31623E0E5B",Magpie:"0x448Ab278aE53a518b181C01AEaFD397f049060E7",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d",Paraswap:"0x777A3e65a5473148D5d7abdFD2BB5bFB61b6432f"},dex:{pancake:{type:"p2",solver:"Orbs",router:"0xFE6508f0015C778Bdcc1fB5465bA5ebE224C9912",permit2:"0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",adapter:"0xA7CcB11F1D20D1F915FC220F5Cb1646E4523bB75",fee:"0x37A957f10F458e0d7fDECBE2917971b57F15c927"},quick:{type:"default",solver:"Kyber",router:"0x6131B5fae19EA4f9D964eAc0408E4408b66337b5",adapter:"0x0438644898F69bfF1018Cb01a81877D14d3e6493",fee:"0xd207DC6a6dA88f27c8DB78201F974161b1d84b1f"},trebleswap:{type:"default",solver:"TrebleSwap",router:"0x347539D82A14C0A3a89769f1024774A545a151ac",adapter:"0x6f4938535879c668A797F2a6e9B912c54f9D43Cf",fee:"0x15fc883d7DF4e681Ddb9E43e7B1D8c61d4fC162C"},sushiswap:{type:"default",solver:"Sushi",router:"0xAC4c6e212A361c968F1725b4d055b47E63F80b75",adapter:"0x2e43A28FAf083717CcD9B246d97C61E1Bc9914Df",fee:"0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc"},ring:{type:"dynamicp2",solver:"Ring",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",adapter:"0x028fa69049aB68EC42064Eb18896D587dD41Af2a",fee:"0xA04329696aAd1417c75Cf6d91342815001999B21"}}},42161:{adapter:{Nordstern:"0x52756370A08F63ADE4900A9c3046cf93ac0397e5",Paraswap:"0x179C4b8e982b5F1365d36CC8d0c1CEB621B7198D",Orbs:"0x917b492557957f5dD3e69c04c8E1Ac3d6948c022",Sushi:"0x11985E88847aEC23D1C3BCD77Ca0F4A704aB751c",Ring:"0x47e27973dA3e16dB13F8b713877b3A31623E0E5B",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",Magpie:"0xB844Fa943230A0ff3b7a0E9483dF2689D513d77d",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d"},dex:{ramses:{type:"paraswap",solver:"Paraswap",router:"0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57",adapter:"0xf075352f43cd15bA51B0957A4465223EDf6b4Cd8",fee:"0xB5BaCB60ECDa0bEF809B2A26eC9B4B926835D7af"},omni:{type:"paraswap",solver:"Paraswap",router:"0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57",adapter:"0x41c925E8E4fC65136BDf5322824E0D8c20c4824e",fee:"0xba5291526c30B097E9F1Fd1Be301E2ab6E0782aa"},pancake:{type:"p2",solver:"Orbs",router:"0xFE6508f0015C778Bdcc1fB5465bA5ebE224C9912",permit2:"0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",adapter:"0xA7CcB11F1D20D1F915FC220F5Cb1646E4523bB75",fee:"0x37A957f10F458e0d7fDECBE2917971b57F15c927"},sushiswap:{type:"default",solver:"Sushi",router:"0xAC4c6e212A361c968F1725b4d055b47E63F80b75",adapter:"0x2e43A28FAf083717CcD9B246d97C61E1Bc9914Df",fee:"0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc"},ring:{type:"dynamicp2",solver:"Ring",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",adapter:"0x028fa69049aB68EC42064Eb18896D587dD41Af2a",fee:"0xA04329696aAd1417c75Cf6d91342815001999B21"}}},43114:{adapter:{Nordstern:"0x1D06d98D523F8B51AD693D4A22fb97fCf0838d83",Kyber:"0x6f4e5b8d7F6b037c62277992c39E7834D7C04596",Magpie:"0x0Fd65Dc22A3c3aa1501a6Bb509F66ff5C4585a5d",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d",Paraswap:"0x777A3e65a5473148D5d7abdFD2BB5bFB61b6432f",Sushi:"0xA985f801ea74321AdcC9Ef88B394858CbA3F71ba"},dex:{blackhole:{type:"default",solver:"Kyber",router:"0x6131B5fae19EA4f9D964eAc0408E4408b66337b5",adapter:"0xccdF1D6ce95FeC0F842197470CE8969A678B0A04",fee:"0x7f8B62520D9B5DA0ED517cc36e8dcb2a356f1928"},pangolin:{type:"default",solver:"Kyber",router:"0x6131B5fae19EA4f9D964eAc0408E4408b66337b5",adapter:"0xf42106eBf985bF49b39eba0114F57FA05e7B52eD",fee:"0xde92da99D188Ceb54A11ec711EF52D808A6260B5"}}},59144:{adapter:{Nordstern:"0xA9c6c1F14c1d0eF2ab6ec79E5dcF0ff3a3680F05",Orbs:"0x917b492557957f5dD3e69c04c8E1Ac3d6948c022",OpenOcean:"0xd2e68b1d1C5DBB2D6cC396c10C55017e01309C37",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",Sushi:"0xA985f801ea74321AdcC9Ef88B394858CbA3F71ba",Magpie:"0xBcFd0eE2C44136526dcA007e41e4f3DDD32A0Bd2"},dex:{pancake:{type:"p2",solver:"Orbs",router:"0xFE6508f0015C778Bdcc1fB5465bA5ebE224C9912",permit2:"0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768",adapter:"0xA7CcB11F1D20D1F915FC220F5Cb1646E4523bB75",fee:"0x37A957f10F458e0d7fDECBE2917971b57F15c927"},lynex:{type:"default",solver:"OpenOcean",router:"0x6352a56caadC4F1E25CD6c75970Fa768A3304e64",adapter:"0xd8bC1FF79a642e8D7Fbd0711374F287202fBb3AA",fee:"0xcb36ed1B1BfAD8F7FC9651f52d21f04A68677423"}}},80094:{adapter:{Nordstern:"0x763Fb927d181bCE8be779794A030BCE45D4869fA",Kodiak:"0xcB16237c88A859d46Ae850B97d7D1bdECF482C06",Kyber:"0x6bbE14b2205a87FA0EAdE5f0795C7bb16B5347EA",OpenOcean:"0x2Be5260d030ff9A6040bA4292326B796ff1a055d",Magpie:"0xBcFd0eE2C44136526dcA007e41e4f3DDD32A0Bd2",Sushi:"0xA985f801ea74321AdcC9Ef88B394858CbA3F71ba"},dex:{kodiak:{type:"default",solver:"Kodiak",router:"0x43Dac637c4383f91B4368041E7A8687da3806Cae",adapter:"0xcB16237c88A859d46Ae850B97d7D1bdECF482C06",fee:"0xBA47Ec15aFbCF6e7e9F52900632049530bB6bAe4"}}},747474:{adapter:{Nordstern:"0xd16A1849E86431872a87f476fa0DfB30eEb96cb3",Sushi:"0x11985E88847aEC23D1C3BCD77Ca0F4A704aB751c"},dex:{katana:{type:"universal",adapter:"0xe7505d43AdF7d44AB11d7eEAF353a85F8169bE6a",fee:"0x7a76704765D366ac2A559e1A1fc1273b834B2cA8"},sushiswap:{type:"default",solver:"Sushi",router:"0xAC4c6e212A361c968F1725b4d055b47E63F80b75",adapter:"0x2e43A28FAf083717CcD9B246d97C61E1Bc9914Df",fee:"0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc"}}},"*":{wm:"0x0005d5cE0dB57e5BE3b2b8b6FeB75f0ccd015000",repermit:"0x00002a9C4D9497df5Bd31768eC5d30eEf5405000",cosigner:"0x000ECFa392ecDEfEE6e2a5C095d39B7A32f1E000",reactor:"0x000000b33fE4fB9d999Dd684F79b110731c3d000",executor:"0x000642A0966d9bd49870D9519f76b5cf823f3000",refinery:"0x000E474c0D7084EAA35A501035E73269f4b009A5",salt:{wm:"0xc9b46eae42dfeba3222a0315bf682f33cd5cc9d60c9625642e88406f8415f152",repermit:"0x4871dc9008e605821ea9677b65ea2a60ffb774afb31e0dcaea2e192880096be7",cosigner:"0x1117fe6f4e25c9380d10b2b3314a1e9b33e5f65ba0e55e0c63d0640db0dd60a2",reactor:"0xec73677f3a465a9755d4c9eab9509b59a24613fdb8b78719682930373e9876f5",executor:"0x9abc67d936f79e493f1f14050c2f6adb87ec208ff7aaae2e7ae788a7cb4796d7",refinery:"0x9746de29f1dd31b2c8460d71e92a7aefa34911130e61f274f37776e598c48bec",agentAdapter:"0xf6d54cf6a0619f1fb8e1ded91d4c23e7bb9f498c56735fb0c7669423c766219f",agentFee:"0x151234279af18acc113f70463977058efa2e598b5bfc0c106c75fd638d344c0a",utilaAdapter:"0x7671291910b559d7a05ab73ee31dd714d9c6e7b065c9496338bf427182ae5145",utilaFee:"0x46f797cddb221ecf6279b56f52e2f6360cd721ef95bd5a17dd0ffceffaaf7fd6",efAdapter:"0xa5425e0f84a7cf12c4213f57396810d808d88e43a65210786bd0d9a98a314728",efFee:"0x14387b821c54f18e2a9351887a92cc79164a5ea0b88cfc3f36741eae6d4fd815",htAdapter:"0x2ec50a8a136049da76c16f3dd12a8ed1b23f2bc91aca73c6a20cc8344e34f998",htFee:"0x2f902a86a7f6abeedc073e76cd33d4737f25189e18c8f450f16d2ffe14405242"},dex:{agent:{type:"universal",adapter:"0x0002BeFB46587d460AcEA9B2792c4A4c67B9cADa",fee:"0x0006d9557Ac9Af4f31962896299ba4FaBDaB9fEE"},utila:{type:"universal",adapter:"0x000ADa14B2ECF45Da6Cf1B33dE34e05231E9C76f",fee:"0x000FEee351263c82501a4dF5f699a8b630ac7f36"},ef:{type:"universal",adapter:"0xeF1B796D708BD776F6b377E93eAd8Ca5fA0C3117",fee:"0xeF1D677d7aE1a066beb26cC1C74E31C082B75FEf"},ht:{type:"universal",adapter:"0xA560a960C3b7784f5c335C33028D31596b91650b",fee:"0xE7a926C0cb01aCCE74e5d4FCeB7CA1699e200608"},ginco:{type:"universal",adapter:"0x96604C3E846BBa75c43B5518bd076851e5484197",fee:"0xCf2eB80A89A69aB17e295aeF033Ffe9564736155"}}}};var Vn,Rr;function xa(){if(Rr)return Vn;Rr=1;const e=Ea,t=a=>ba(`./out/${a}.sol/${a}.abi.json`),n=()=>({wm:t("WM"),repermit:t("RePermit"),reactor:t("OrderReactor"),executor:t("Executor"),refinery:t("Refinery"),settler:t("Settler"),adapter:t("DefaultDexAdapter")});function r(a){var u;if(!a)return;const i=e[a];if(i)return{...((u=e["*"])==null?void 0:u.adapter)??{},...i.adapter??{}}}function s(a,i){if(!a)return;const{dex:u,salt:f,...h}=e["*"]??{},T=e[a];if(!T)return;const{dex:b,salt:x,...v}=T,O={...h,...v},I=i==null?void 0:i.trim();if(!I)return O;const B=u==null?void 0:u[I],_=b==null?void 0:b[I];if(!(!B&&!_))return{...O,...B,..._}}return Vn={config:s,adapters:r,abis:n,raw:e},Vn}var Nr=xa();const Lt=(e,t)=>{if(e==null||!t)return"";const n=D(10).pow(e);return D(t).times(n).idiv(n).div(n).toFixed()};D(0),D(1),D(10),D(1e18);function gt(e,t){return e==t||e.toLowerCase()==t.toLowerCase()}const Rt=e=>!!oa.find(t=>gt(t,e||""));function Ca(e){return[ve.Years,ve.Months,ve.Weeks,ve.Days,ve.Hours,ve.Minutes].find(n=>n<=e)||ve.Minutes}const bt=e=>e?e.value*e.unit:0,Ta=e=>!e||e==="NaN"?"0":D(e).decimalPlaces(0).toFixed(),Et=e=>Object.values(ye).find(t=>t.id===e),wa=e=>{if(!e)return;const t=e.map(a=>Ee(a)),n=Object.entries(ca).filter(([a])=>t.includes(a)).flatMap(([,a])=>a),r=e.map(a=>a.exchangeAddress),s=new Set([...r,...n].map(a=>a.toLowerCase()));return Array.from(s)},Kr=(e,t)=>e.version===1?(e.fillDelay||0)*1e3+(t?ka(t):0):(e.fillDelay||0)*1e3,En=e=>typeof window>"u"?null:new URLSearchParams(window.location.search).get(e),Gn=e=>$r().filter(t=>t.name===e).map(t=>t.chainId),Xn=(e="",t="",n=18,r=18)=>{if(!D(e||0).gt(0)||!D(t||0).gt(0))return"";const s=Lt(n,e),a=Lt(r,t);return D(a).div(s).toFixed()},qr=(e,t,n)=>{if(e.type===X.TWAP_MARKET)return"";const r=Lt(t,e.srcAmountPerTrade),s=Lt(n,e.dstMinAmountPerTrade);return D(s).div(r).toFixed()},Hr=(e,t,n)=>{if(e.type===X.TWAP_MARKET)return"";const r=Lt(t,e.srcAmountPerTrade),s=Lt(n,e.triggerPricePerTrade);return D(s).div(r).toFixed()},Fa=new Set([1,56,42161,8453]),Sa=(e,t)=>e===Pe.Ring?Fa.has(t):!0,Da=(e,t,n)=>{if(!e||!t||n==null)return;const r=D(e).times(t),s=D(10).pow(n);return r.div(s).toFixed(0)},va=(e,t,n,r)=>{if(n||r==null||!e||!t)return D(0).toString();const s=D(e).times(D(t)),a=D(10).pow(r),i=s.div(a);return D.max(1,i).integerValue(D.ROUND_FLOOR).toFixed(0)},Pa=(e,t,n,r)=>{if(e===G.TWAP||e===G.LIMIT)return"0";if(r==null||!t||!n)return;const s=D(t).times(D(n)),a=D(10).pow(r),i=s.div(a);return D.max(1,i).integerValue(D.ROUND_FLOOR).toFixed(0)||"0"},Oa=(e,t,n,r)=>{const s=bt(n)*2*t,a=En(rn.DURATION),i=Ca(a?Number(a):s);return a?{unit:i,value:Number(D(Number(a)/i).toFixed(2))}:r||(e===G.LIMIT?{unit:ve.Days,value:7}:e===G.STOP_LOSS||e===G.TAKE_PROFIT?{unit:ve.Days,value:1}:{unit:i,value:Number(D(s/i).toFixed(2))})},Ba=(e,t,n)=>t!==G.TWAP?1:n!==void 0?n:Math.max(1,Math.ceil(e/2)),Ia=(e,t,n)=>{if(!e||!t||!n)return 1;const s=D(t).times(e).div(n).integerValue(D.ROUND_FLOOR).toNumber();return Math.max(1,s)},Ma=(e,t)=>e+bt(t)+6e4,ka=e=>e.bidDelaySeconds*1e3*2,_a=(e="",t=0)=>!e||!t?"0":D(e).div(t).integerValue(D.ROUND_FLOOR).toFixed(0),Ua=(e,t)=>({isError:!(e.unit===Wn.unit&&e.value===Wn.value)&&bt(e)*t>An,value:Math.floor(An/t)}),La=(e="",t="",n)=>{if(n===G.STOP_LOSS)return{isError:D(t||0).gte(D(e||0)),value:e}},Ra=(e="",t="",n)=>{if(n===G.TAKE_PROFIT)return{isError:D(t||0).lte(D(e||0)),value:e}},Na=(e="",t="",n=!1,r)=>{if(!n&&r===G.STOP_LOSS)return{isError:D(t||0).gte(D(e||0)),value:e}},Ka=(e="",t="",n=!1,r)=>{if(!n&&r===G.TAKE_PROFIT)return{isError:D(t||0).gte(D(e||0)),value:e}},qa=(e,t)=>e===G.STOP_LOSS||e===G.TAKE_PROFIT?{isError:bt(t)>5184e6,value:5184e6}:{isError:bt(t)>An,value:An},Ha=e=>({isError:bt(e)<kr,value:kr}),$a=e=>({isError:bt(e)<Hn,value:Hn}),Wa=(e,t,n)=>({isError:D(t||0).multipliedBy(e||0).isLessThan(n),value:n}),za=(e,t,n)=>({isError:n===G.TWAP&&D(e).isGreaterThan(t),value:t}),Zn=(e,t)=>{if(e===Pe.Pancake)switch(t){case 56:return V.PancakeSwap;case 42161:return V.PancakeSwapArbitrum;case 8453:return V.PancakeSwapBase;case 59144:return V.PancakeSwapLinea;default:return V.PancakeSwap}if(e===Pe.Sushiswap)switch(t){case 1:return V.SushiEth;case 42161:return V.SushiArb;case 8453:return V.SushiBase;case 747474:return V.SushiKatana;default:return V.SushiEth}if(e===Pe.Quick)switch(t){case 137:return V.QuickSwap;case 8453:return V.QuickSwapBase;default:return V.QuickSwap}if(e===Pe.Thena)switch(t){case 56:return V.Thena;default:return V.Thena}if(e===Pe.Spooky)switch(t){case 250:return V.SpookySwap;case 146:return V.SpookySwapSonic;default:return V.SpookySwap}if(e===Pe.Lynex)switch(t){case 59144:return V.Lynex;default:return V.Lynex}if(e===Pe.Swapx)switch(t){case 146:return V.SwapX;default:return V.SwapX}if(e===Pe.Blackhole)switch(t){case 43114:return V.BlackholeAvax;default:return V.BlackholeAvax}},$r=()=>{var n;const e=Nr.raw,t=((n=e["*"])==null?void 0:n.dex)??{};return Object.entries(e).filter(([r])=>r!=="*").flatMap(([r,s])=>{const a=Number(r),i={...t,...(s==null?void 0:s.dex)??{}};return!i||typeof i!="object"?[]:Object.entries(i).flatMap(([u])=>Sa(u,a)?[{chainId:a,name:u}]:[])}).sort((r,s)=>r.name.localeCompare(s.name))},Wr=e=>{const t=En(rn.MIN_CHUNK_SIZE_USD);return t?parseInt(t):e},Qa=({marketPrice:e,typedInputAmount:t,srcUsd1Token:n,marketPriceLoading:r,triggerPriceError:s,limitPriceError:a,tradesError:i,fillDelayError:u,durationError:f,balanceError:h,minTradeSizeError:T})=>{if(!En(rn.IGNORE_ERRORS)&&!(D(e||0).isZero()||D(t||0).isZero()||D(n||"0").isZero()||r))return T||s||a||i||u||f||h},zr=async(e,t,n=!1)=>{const r=new URLSearchParams({partner:e,chain:t.toString()}),s=await fetch(`${ta(n)}?${r}`);if(!s.ok){const a=await s.text();throw new Error(`Failed to fetch RePermit data for partner "${e}" on chain ${t}: ${s.status}${a?` ${a}`:""}`)}return s.json()},Qr=({chainId:e,srcTokenAddress:t,dstTokenAddress:n,totalSrcAmount:r,currentTimeMillis:s,deadlineMillis:a,fillDelayMillis:i,totalTrades:u,slippageBps:f,swapperAddress:h,srcAmountPerTrade:T,minDstAmountPerTrade:b="0",triggerAmountPerTrade:x="0",permitData:v,module:O})=>{var d;const I=s.toString(),B=!u||u===1?0:parseInt((i/1e3).toFixed(0)),_=Ta(a/1e3),F=En(rn.FRESHNESS),q=F?parseInt(F):60,k=Math.floor(s/1e3).toString(),Q=Rt(t)?((d=Et(e))==null?void 0:d.wToken.address)||"":t,z=D(b||0).toFixed(),re=D(O===G.STOP_LOSS&&x||0).toFixed(),o=D(O===G.TAKE_PROFIT&&x||0).toFixed(),c={...v.order,permitted:{...v.order.permitted,token:Q,amount:r},nonce:I,deadline:_,witness:{...v.order.witness,swapper:h,nonce:I,start:k,deadline:_,epoch:B,slippage:f,freshness:q,input:{...v.order.witness.input,token:Q,amount:T,maxAmount:r},output:{...v.order.witness.output,token:n,limit:z,triggerLower:re,triggerUpper:o,recipient:h}}};return{...v,order:c}},ja=`https://bi.orbs.network/putes/twap-ui-${.7}`;let xn="unknown";function Va(e){xn=e}function Cn(){const e=Math.random().toString(36).substring(2,16),t=Math.random().toString(36).substring(2,16),n=Date.now().toString(36);return`id_${e+t+n}`}const Ga=(e,t,n)=>({spotVersion:pn.version,partner:e,chainId:n||0,minChunkSizeUsd:t}),Xa=(e,t,n,r)=>{const{witness:s}=e.order,a=Nr.config(e.domain.chainId,t);return{spotVersion:pn.version,partner:t,cosigner:a==null?void 0:a.cosigner,fee:a==null?void 0:a.fee,refinery:a==null?void 0:a.refinery,router:a==null?void 0:a.router,type:a==null?void 0:a.type,wm:a==null?void 0:a.wm,adapter:s.exchange.adapter,executor:s.executor,reactor:s.reactor,repermit:e.domain.verifyingContract,chainId:e.domain.chainId,chainName:(n==null?void 0:n.chainName)||"",twapVersion:(n==null?void 0:n.twapVersion)||0,twapAddress:(n==null?void 0:n.twapAddress)||"",lensAddress:(n==null?void 0:n.lensAddress)||"",bidDelaySeconds:(n==null?void 0:n.bidDelaySeconds)||0,minChunkSizeUsd:r||0,name:(n==null?void 0:n.name)||"",exchangeAddress:(n==null?void 0:n.exchangeAddress)||"",exchangeType:(n==null?void 0:n.exchangeType)||"",pathfinderKey:(n==null?void 0:n.pathfinderKey)||""}},Tn=async e=>{try{await fetch(ja,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)}).then()}catch(t){console.error("Failed to send BI",t)}};class Za{constructor(){nn(this,"timeout");nn(this,"configDetails",{});nn(this,"configUpdateKey","");nn(this,"moduleImportKey","");nn(this,"data",{_id:Cn()})}async updateAndSend(t={},n=!1,r){try{this.data={...this.data,...t},n?(await Tn(this.data),r==null||r()):(clearTimeout(this.timeout),this.timeout=setTimeout(()=>{Tn(this.data),r==null||r()},1e3))}catch(s){console.error("Failed to update and send BI",s)}}onCancelOrderRequest(t,n){this.updateAndSend({cancelOrderIdsV1:n===1?t:void 0,cancelOrderIdsV2:n===2?t:void 0,action:"cancel order",cancelOrderSuccess:!1,cancelOrderTxHash:void 0,actionError:void 0})}onCancelOrderSuccess(t){this.updateAndSend({cancelOrderTxHash:t,cancelOrderSuccess:!0})}onCancelOrderError(t){this.onTxError(t)}onWrapSuccess(t){this.updateAndSend({wrapTxHash:t})}onWrapRequest(){this.updateAndSend({action:"wrap"})}onWrapError(t){this.onTxError(t)}onApproveRequest(){this.updateAndSend({action:"approve"})}onApproveSuccess(t){this.updateAndSend({approvalTxHash:t})}onApproveError(t){this.onTxError(t)}onCrash(t){var n;this.updateAndSend({action:"crash",actionError:((n=t==null?void 0:t.message)==null?void 0:n.toLowerCase())||(t==null?void 0:t.toLowerCase())})}onTxError(t){var r;const n=((r=t==null?void 0:t.message)==null?void 0:r.toLowerCase())||(t==null?void 0:t.toLowerCase());this.updateAndSend({actionError:n})}onRequestOrder({account:t,chainId:n,module:r,srcToken:s,dstToken:a,fromTokenAmount:i,srcChunkAmount:u,minDstAmountOutPerTrade:f="",triggerPricePerTrade:h="",deadline:T,fillDelay:b,slippage:x,isMarketOrder:v,chunksAmount:O}){this.updateAndSend({toTokenAddress:a.address,toTokenSymbol:a.symbol,fromTokenAddress:s.address,fromTokenSymbol:s.symbol,fromTokenAmount:i,chunksAmount:O,srcChunkAmount:u,minDstAmountOutPerTrade:f,triggerPricePerTrade:h,deadline:T,fillDelay:b,slippage:x,chainId:n,walletAddress:t,module:r,orderType:v?"market":"limit",actionError:void 0})}onSignOrderRequest(t){this.updateAndSend({action:"sign order",order:t})}onSignOrderError(t){this.onTxError(t)}onSignOrderSuccess(t){this.updateAndSend({action:"sign order",signature:t})}init(t,n,r,s){const a=`${t}:${r||0}:${s||""}`;if(a!==this.moduleImportKey){this.moduleImportKey=a;const i={_id:Cn(),action:"module-import",uiVersion:xn,appId:s,...Ga(t,n,r),origin:window.location.origin};this.configDetails.partner===t&&this.configDetails.chainId===(r||0)||(this.configDetails={}),this.data={...i,...this.configDetails},Tn(i)}}onFetchedConfig(t,n,r,s,a=!1){const i=Xa(t,n,r,s),u=`${n}:${i.chainId}:${a}:${i.repermit}:${i.adapter}:${i.executor}:${i.reactor}`;u!==this.configUpdateKey&&(this.configUpdateKey=u,this.configDetails=i,this.data={...this.data,...i},Tn({_id:Cn(),action:"config-update",uiVersion:xn,appId:this.data.appId,origin:typeof window>"u"?void 0:window.location.origin,...i}))}onCreateOrderError(t){this.onTxError(t)}onCreateOrderRequest(){this.updateAndSend({action:"create order"})}async onCreateOrderSuccess(t){this.updateAndSend({orderHash:t,orderSuccess:!0},void 0,()=>{this.data={_id:Cn(),action:"reset",uiVersion:xn,appId:this.data.appId,origin:this.data.origin,spotVersion:pn.version,partner:this.data.partner,adapter:this.data.adapter,cosigner:this.data.cosigner,executor:this.data.executor,fee:this.data.fee,reactor:this.data.reactor,refinery:this.data.refinery,repermit:this.data.repermit,router:this.data.router,type:this.data.type,wm:this.data.wm,chainName:this.data.chainName||"",chainId:this.data.chainId||0,twapVersion:this.data.twapVersion||0,twapAddress:this.data.twapAddress||"",lensAddress:this.data.lensAddress||"",bidDelaySeconds:this.data.bidDelaySeconds||0,minChunkSizeUsd:this.data.minChunkSizeUsd||0,name:this.data.name||"",exchangeAddress:this.data.exchangeAddress||"",exchangeType:this.data.exchangeType||"",pathfinderKey:this.data.pathfinderKey||""}})}}const de=new Za,Ya=e=>{var T;const t=D(e.order.witness.output.limit||0).gt(1),{stop:n,triggerLower:r,triggerUpper:s}=e.order.witness.output,a=D(n||0).eq(_r),i=a||D(s||0).gt(0),u=!a&&D(n||0).gt(0)||D(r||0).gt(0),f=D(e.order.witness.input.amount),h=((T=e.metadata.chunks)==null?void 0:T.length)||(f.gt(0)?D(e.order.witness.input.maxAmount).div(f).toNumber():e.metadata.expectedChunks||1);return i?t?X.TAKE_PROFIT_LIMIT:X.TAKE_PROFIT_MARKET:u?t?X.STOP_LOSS_LIMIT:X.STOP_LOSS_MARKET:t?h>1&&t?X.TWAP_LIMIT:t?X.LIMIT:X.TWAP_MARKET:X.TWAP_MARKET},Ja=e=>{var s;const t=((s=e.metadata.chunks)==null?void 0:s.filter(a=>a.status==="success").length)||0,n=e.metadata.expectedChunks||0;if(!n)return 0;const r=D(t).dividedBy(n).toNumber();return r>=.99?100:r<=0?0:Number((r*100).toFixed(2))},ei=(e,t)=>{var n;return e.metadata.status==="completed"||t>=99?ue.Completed:["pending","eligible"].includes(e.metadata.status)?ue.Open:((n=e.metadata.description)==null?void 0:n.toLowerCase())==="cancelled by contract"?ue.Cancelled:ue.Expired},ti=e=>{var n;return(((n=e.metadata.chunks)==null?void 0:n.filter(r=>r.status==="success"))||[]).map(r=>({inAmount:r.inAmount,outAmount:r.outAmount,timestamp:new Date(r.timestamp).getTime(),txHash:r.txHash}))},ni=(e,t)=>{var r;const n=e.length;return n>=t&&((r=e[n-1])==null?void 0:r.timestamp)||0},ri=e=>D(e.metadata.displayOnlyInputTokenPriceUSD).dividedBy(1e18).toFixed(),Yn=e=>Number(e.order.witness.output.limit)===1?"":e.order.witness.output.limit,si=e=>{const{triggerLower:t="0",triggerUpper:n="0"}=e.order.witness.output,r=Yn(e),s=e.metadata.expectedChunks||1,a=D(n||0).gt(0);return{dstMinAmountPerTrade:r,triggerPricePerTrade:a?n:t,dstMinAmountTotal:r?D(r).multipliedBy(s).toFixed():""}},ai=e=>{const t=Yn(e),n=D(e.order.witness.output.stop||0).eq(_r),r=e.metadata.expectedChunks||1;return{dstMinAmountPerTrade:n?"":t,triggerPricePerTrade:n?t:D(e.order.witness.output.stop||0).toFixed(),dstMinAmountTotal:n||!t?"":D(t).multipliedBy(r).toFixed()}},ii=e=>Number(yn)>=2?si(e):ai(e),jr=e=>{const t=Ja(e),n=Yn(e),r=e.metadata.expectedChunks||1,s=ti(e),a=Ya(e);return{id:e.hash,hash:e.hash,version:2,type:a,maker:e.order.witness.swapper,progress:t,srcAmountFilled:s.reduce((i,u)=>i.plus(u.inAmount),new D(0)).toFixed()||"",dstAmountFilled:s.reduce((i,u)=>i.plus(u.outAmount),new D(0)).toFixed()||"",fills:s,srcTokenAddress:e.order.witness.input.token,dstTokenAddress:e.order.witness.output.token,orderDollarValueIn:ri(e),fillDelay:e.order.witness.epoch*1e3,deadline:Number(e.order.deadline)*1e3,createdAt:new Date(e.timestamp).getTime(),srcAmount:e.order.witness.input.maxAmount,srcAmountPerTrade:e.order.witness.input.amount,totalTradesAmount:r,isMarketPrice:D(n||0).lte(1),chainId:e.order.witness.chainid,filledOrderTimestamp:ni(s,r),status:ei(e,t),repermitDigest:e.metadata.repermitDigest,isTriggerPrice:a===X.TAKE_PROFIT_MARKET||a===X.TAKE_PROFIT_LIMIT||a===X.STOP_LOSS_LIMIT||a===X.STOP_LOSS_MARKET,rawOrder:e,...ii(e)}},oi=async({chainId:e,signal:t,account:n,exchange:r,partner:s,isDev:a=!1})=>{try{if(!n)return[];const i=na(a),u=new Map;return(await Promise.all(i.map(async h=>{try{const T=sa({endpoint:h,exchange:r,partner:s}),b=T?`&exchange=${T}`:"",v=await(await fetch(`${h}/orders?swapper=${n}&chainId=${e}${b}`,{signal:t})).json();if(!v||!Array.isArray(v.orders))return[];const O=[];for(const I of v.orders)try{O.push(jr(I))}catch{continue}return O}catch{return[]}}))).flat().forEach(h=>{u.has(h.id)||u.set(h.id,h)}),Array.from(u.values())}catch{return[]}},Vr=async(e,t,n=!1)=>{try{const r={signature:t,order:e,status:"pending"};de.onCreateOrderRequest();const s=await fetch(`${ea(n)}/orders/new`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)}),a=await s.json().catch(()=>({}));if(!s.ok||!(a!=null&&a.success)){const u=(a==null?void 0:a.message)??s.statusText??"Request failed",f=(a==null?void 0:a.code)??s.status;throw new Error(`error:${u}, code:${f}`)}if(!a.signedOrder||typeof a.signedOrder!="object")throw new Error("Invalid API response: missing signedOrder");const i=jr(a.signedOrder);return de.onCreateOrderSuccess(i.id),i}catch(r){throw de.onCreateOrderError(r),console.error(r),r}},Ge=(e,t)=>e&&e.length?e.map(t||(n=>`${n}`)):void 0,ci=e=>{if(e)return ia[e]},Jn=async({chainId:e,buildQuery:t,extractResults:n,signal:r,retries:s=1,limit:a=1e3,page:i})=>{const u=ci(e);if(!u)throw new pi;const f=async b=>{let x=0;for(;x<=s;)try{const v=await fetch(u,{method:"POST",body:JSON.stringify({query:b}),signal:r,headers:{"Content-Type":"application/json"}});if(!v.ok)throw new Error(`HTTP error: ${v.status}`);const O=await v.json();if(O.errors)throw new Error(O.errors[0].message);return n(O)}catch(v){if(x===s)throw v;await new Promise(O=>setTimeout(O,500*2**x)),x++}return[]};let h=0;const T=[];if(i!==void 0){const b=t(i,a);try{return await f(b)}catch{console.warn(`Page ${i} failed, retrying one final time...`);try{return await f(b)}catch{return[]}}}for(;;){const b=t(h,a);let x;try{x=await f(b)}catch{console.warn(`Page ${h} failed, retrying one final time...`);try{x=await f(b)}catch{return T}}if(T.push(...x),x.length<a)break;h++}return T},Gr=e=>e.map(t=>({inAmount:t.srcAmountIn,outAmount:t.dstAmountOut,timestamp:t.timestamp,txHash:t.transactionHash})),Xr=(e,t)=>{const n=D(e||0).gt(1);return!n&&t===1?X.TWAP_MARKET:t>1&&n?X.TWAP_LIMIT:n?X.LIMIT:X.TWAP_MARKET},ui=(e,t,n,r)=>{var v;const s=Gr(n||[]),a=new D(e.ask_srcBidAmount||0),i=a.gt(0)?new D(e.ask_srcAmount||0).div(a).integerValue(D.ROUND_FLOOR).toNumber():1,f=(n==null?void 0:n.length)===i?(v=n==null?void 0:n[(n==null?void 0:n.length)-1])==null?void 0:v.timestamp:void 0,h=s.reduce((O,I)=>O.plus(I.inAmount),new D(0)).toFixed(),T=s.reduce((O,I)=>O.plus(I.outAmount),new D(0)).toFixed(),b=Zr(e.ask_srcAmount,h),x=Xr(e.ask_dstMinAmount,i);return{repermitDigest:"",version:1,isTriggerPrice:!1,id:e.Contract_id.toString(),hash:"",type:Xr(e.ask_dstMinAmount,i),srcTokenAddress:e.ask_srcToken,dstTokenAddress:e.ask_dstToken,exchangeAddress:e.exchange,twapAddress:e.twapAddress,maker:e.maker,progress:b,dstAmountFilled:T,srcAmountFilled:h,orderDollarValueIn:D(e.dollarValueIn||0).toFixed(6),srcAmount:e.ask_srcAmount,dstMinAmountTotal:D(e.ask_dstMinAmount).multipliedBy(i).toString(),fills:s,fillDelay:e.ask_fillDelay,deadline:e.ask_deadline*1e3,createdAt:new Date(e.timestamp).getTime(),dstMinAmountPerTrade:D(e.ask_dstMinAmount).eq(1)?"":e.ask_dstMinAmount,triggerPricePerTrade:"",srcAmountPerTrade:e.ask_srcBidAmount,txHash:e.transactionHash,totalTradesAmount:i,isMarketPrice:[X.TWAP_MARKET].includes(x),chainId:t,filledOrderTimestamp:f||0,status:r,rawOrder:e}},di=e=>{var b;if(!e)return"";const t=Ge(e.accounts,x=>`"${x.toLowerCase()}"`),n=Ge(wa(e.configs),x=>`"${x.toLowerCase()}"`),r=Ge(e.inTokenSymbols,x=>`"${x.toUpperCase()}"`),s=Ge(e.outTokenSymbols,x=>`"${x.toUpperCase()}"`),a=Ge(e.inTokenAddresses,x=>`"${x.toLowerCase()}"`),i=Ge(e.outTokenAddresses,x=>`"${x.toLowerCase()}"`),u=Ge(e.transactionHashes,x=>`"${x.toLowerCase()}"`),f=Ge(e.orderIds,x=>`"${x}"`),h=n!=null&&n.length?"":Ge((b=e.configs)==null?void 0:b.map(x=>x.twapAddress),x=>`"${x.toLowerCase()}"`),T=e.minDollarValueIn;return[n?`exchange_in: [${n.join(", ")}]`:"",h?`twapAddress_in: [${h.join(", ")}]`:"",t?`maker_in: [${t.join(", ")}]`:"",u?`transactionHash_in: [${u.join(", ")}]`:"",f?`Contract_id_in: [${f.join(", ")}]`:"",T?`dollarValueIn_gte: ${T}`:"",r?`srcTokenSymbol_in: [${r.join(", ")}]`:"",s?`dstTokenSymbol_in: [${s.join(", ")}]`:"",a?`srcTokenAddress_in: [${a.join(", ")}]`:"",i?`dstTokenAddress_in: [${i.join(", ")}]`:"",e!=null&&e.startDate?`blockTimestamp_gte: ${e.startDate}`:"",e!=null&&e.endDate?`blockTimestamp_lte: ${e.endDate}`:"",(e==null?void 0:e.orderType)==="limit"?"ask_dstMinAmount_gt: 1":"",(e==null?void 0:e.orderType)==="market"?"ask_dstMinAmount_lte: 1":""].filter(Boolean).join(", ")};async function li({chainId:e,signal:t,page:n,limit:r,filters:s}){const a=r||1e3,i=di(s);return await Jn({chainId:e,signal:t,limit:a,page:n,buildQuery:(f,h)=>`
2
2
  {
3
3
  orderCreateds(
4
- ${o?`where: { ${o} }`:""},
4
+ ${i?`where: { ${i} }`:""},
5
5
  first: ${h},
6
6
  skip: ${f*h},
7
7
  orderBy: timestamp,
@@ -32,11 +32,11 @@
32
32
  transactionHash
33
33
  }
34
34
  }
35
- `,extractResults:f=>{var h;return((h=f.data)==null?void 0:h.orderCreateds)||[]}})}const di=async({chainId:e,orders:t,signal:n})=>{if(t.length===0)return[];const r=Xn(t.map(d=>d.Contract_id.toString()));if(!r.length)return[];const a=`where: { twapId_in: [${r.map(d=>`"${d}"`).join(", ")}]}`;return await Gn({chainId:e,signal:n,limit:1e3,buildQuery:(d,f)=>`
35
+ `,extractResults:f=>{var h;return((h=f.data)==null?void 0:h.orderCreateds)||[]}})}const fi=async({chainId:e,orders:t,signal:n})=>{if(t.length===0)return[];const r=er(t.map(u=>u.Contract_id.toString()));if(!r.length)return[];const a=`where: { twapId_in: [${r.map(u=>`"${u}"`).join(", ")}]}`;return await Jn({chainId:e,signal:n,limit:1e3,buildQuery:(u,f)=>`
36
36
  {
37
37
  statusNews(
38
38
  first: ${f},
39
- skip: ${d*f},
39
+ skip: ${u*f},
40
40
  ${a}
41
41
  ) {
42
42
  twapId
@@ -44,9 +44,9 @@
44
44
  status
45
45
  }
46
46
  }
47
- `,extractResults:d=>{var f;return((f=d.data)==null?void 0:f.statusNews)||[]}})};function Xn(e){return Array.from(new Set(e))}const li=async({chainId:e,orders:t,signal:n})=>{const r=Xn(t.map(y=>y.Contract_id)),s=Xn(t.map(y=>y.twapAddress)).filter(Boolean);if(r.length===0)return[];const a=r.join(", "),o=s.map(y=>`"${y}"`).join(", "),d=s.length?`twapAddress_in: [${o}]`:"",h=`where: { ${[`TWAP_id_in: [${a}]`,d].filter(Boolean).join(", ")} }`;return await Gn({chainId:e,signal:n,limit:1e3,buildQuery:(y,E)=>`
47
+ `,extractResults:u=>{var f;return((f=u.data)==null?void 0:f.statusNews)||[]}})};function er(e){return Array.from(new Set(e))}const hi=async({chainId:e,orders:t,signal:n})=>{const r=er(t.map(b=>b.Contract_id)),s=er(t.map(b=>b.twapAddress)).filter(Boolean);if(r.length===0)return[];const a=r.join(", "),i=s.map(b=>`"${b}"`).join(", "),u=s.length?`twapAddress_in: [${i}]`:"",h=`where: { ${[`TWAP_id_in: [${a}]`,u].filter(Boolean).join(", ")} }`;return await Jn({chainId:e,signal:n,limit:1e3,buildQuery:(b,x)=>`
48
48
  {
49
- orderFilleds(first: ${E}, orderBy: timestamp, skip: ${y*E}, ${h}) {
49
+ orderFilleds(first: ${x}, orderBy: timestamp, skip: ${b*x}, ${h}) {
50
50
  id
51
51
  dstAmountOut
52
52
  dstFee
@@ -61,4 +61,4 @@
61
61
  dollarValueOut
62
62
  }
63
63
  }
64
- `,extractResults:y=>{var E;return(((E=y.data)==null?void 0:E.orderFilleds)||[]).map(v=>({...v,timestamp:new Date(v.timestamp).getTime()}))}})};class fi extends Error{constructor(){super("No graph endpoint found"),this.name="NoGraphEndpointError"}}const pi=async({chainId:e,signal:t,page:n,limit:r,filters:s})=>{try{const a=await ui({chainId:e,signal:t,page:n,limit:r,filters:s}),[o,d]=await Promise.all([li({chainId:e,orders:a,signal:t}),di({chainId:e,orders:a,signal:t})]),f=a.map(x=>{const y=o==null?void 0:o.filter(E=>E.TWAP_id===Number(x.Contract_id)&&At(E.exchange,x.exchange)&&At(E.twapAddress,x.twapAddress));return oi(x,e,y,hi(x,y||[],d))}).sort((x,y)=>y.createdAt-x.createdAt),h=new Set;return f.filter(x=>h.has(x.id)?!1:(h.add(x.id),!0))}catch{return[]}},hi=(e,t,n)=>{var d;const r=(d=n==null?void 0:n.find(f=>f.twapId===e.Contract_id.toString()&&At(f.twapAddress,e.twapAddress)))==null?void 0:d.status,a=Vr(t).reduce((f,h)=>f.plus(h.inAmount),new S(0)).toFixed(),o=Xr(e.ask_srcAmount,a);return mi(o,e.ask_deadline*1e3,r)},Xr=(e,t)=>{if(!t||!e)return 0;const n=S(t).dividedBy(e).toNumber();return n>=.99?100:n<=0?0:Number((n*100).toFixed(2))},mi=(e,t,n)=>e===100?ue.Completed:n==="CANCELLED"?ue.Cancelled:n==="COMPLETED"?ue.Completed:t>Date.now()?ue.Open:ue.Expired,yi=async({signal:e,page:t,chainId:n,limit:r,config:s,account:a,isDev:o=!1,includeV1GraphOrders:d=!0})=>(await Promise.all([!s||!d?Promise.resolve([]):pi({chainId:n,signal:e,page:t,limit:r,filters:{accounts:[a],configs:s.twapConfig?[s.twapConfig]:[]}}),ai({chainId:n,signal:e,account:a,exchange:s==null?void 0:s.adapter,partner:s==null?void 0:s.partner,isDev:o})]).then(([x,y])=>[...x,...y])).sort((x,y)=>y.createdAt-x.createdAt),Ai={version:"1.1.41"},Zr=e=>{let t;const n=new Set,r=(h,x)=>{const y=typeof h=="function"?h(t):h;if(!Object.is(y,t)){const E=t;t=x??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(v=>v(t,E))}},s=()=>t,d={setState:r,getState:s,getInitialState:()=>f,subscribe:h=>(n.add(h),()=>n.delete(h))},f=t=e(r,s,d);return d},gi=(e=>e?Zr(e):Zr),bi=e=>e;function Ei(e,t=bi){const n=D.useSyncExternalStore(e.subscribe,D.useCallback(()=>t(e.getState()),[e,t]),D.useCallback(()=>t(e.getInitialState()),[e,t]));return D.useDebugValue(n),n}const Yr=e=>{const t=gi(e),n=r=>Ei(t,r);return Object.assign(n,t),n},Ci=(e=>e?Yr(e):Yr),gn={},Jr={currentTime:Date.now(),cancelOrders:{},swapExecutions:[gn],swapExecutionIndex:0},K=Ci((e,t)=>({state:Jr,updateState:n=>e(r=>({state:{...r.state,...n}})),updateSwapExecutionAtIndex:(n,r)=>e(s=>{const a=[...s.state.swapExecutions];return a[n]={...a[n]??gn,...r},{state:{...s.state,swapExecutions:a}}}),resetSwapExecutionAtIndex:()=>e(n=>{const r=[...n.state.swapExecutions];return r[n.state.swapExecutionIndex]=gn,{state:{...n.state,swapExecutions:r}}}),resetState:()=>{const n=t().state;e({state:{...Jr,currentTime:Date.now(),isMarketOrder:n.isMarketOrder,swapExecutions:[...n.swapExecutions,gn],swapExecutionIndex:n.swapExecutionIndex+1}})}}));var Ae=(e=>(e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILED=3]="FAILED",e))(Ae||{}),nn=(e=>(e.TRIGGER_MARKET_PRICE="triggerMarketPriceDisclaimer",e.MARKET_PRICE="marketOrderDisclaimer",e.LIMIT_PRICE="limitOrderDisclaimer",e))(nn||{}),nt=(e=>(e.WRAP="wrap",e.APPROVE="approve",e.CREATE="create",e))(nt||{});const rt=(e,t)=>t==null||!e||S(e).isNaN()?"":S(e).multipliedBy(S(10).pow(t)).toFixed(0),ge=(e,t)=>{try{return t==null||!e||S(e).isNaN()?"":S(e).dividedBy(S(10).pow(t)).toFixed()}catch(n){return console.error(n),""}},xi=e=>{const t="An error occurred.";if(!e||!e.message)return t;try{return e.message.toLowerCase().includes("rejected")?"Transaction Rejected":t}catch{return t}},Zn=e=>{var t,n,r,s;if(e!=null&&e.message)return((n=(t=e.message)==null?void 0:t.toLowerCase())==null?void 0:n.includes("rejected"))||((s=(r=e.message)==null?void 0:r.toLowerCase())==null?void 0:s.includes("denied"))},es=(e,t)=>{const n=bt(t);return n&&Rt(e.address)?n.wToken:e};function Yn(e){return e?e/864e5:0}function bn(e){return e?e/6e4:0}const Ti=(e,t)=>e?G.TWAP_MARKET:t===1?G.LIMIT:G.TWAP_LIMIT,Jn=(e,t,n)=>{const r=bt(n);return Rt((e==null?void 0:e.address)||"")&&At((t==null?void 0:t.address)||"",(r==null?void 0:r.wToken.address)||"")},er=(e,t,n)=>{const r=bt(n);return At((e==null?void 0:e.address)||"",(r==null?void 0:r.wToken.address)||"")&&Rt((t==null?void 0:t.address)||"")},Lt=(e,t)=>{if(!t)return"";const n=bt(t);return n!=null&&n.explorer?`${n.explorer}/tx/${e}`:""},tr=(e,t)=>D.useMemo(()=>rt(t,e),[e,t]),Et=(e,t)=>D.useMemo(()=>ge(t,e),[e,t]),En=()=>{const{chainId:e}=q();return D.useMemo(()=>bt(e),[e])},wi=e=>{const t=En();return D.useMemo(()=>{if(!(!e||!t))return Lt(e,t.id)},[e,t])},qe=(e,t)=>D.useMemo(()=>!e||!t||S(e||"0").isZero()||S(t||"0").isZero()?"":S(e||"0").times(t).toFixed(),[e,t]),Fi=()=>{const{srcToken:e,dstToken:t,chainId:n}=q();return D.useMemo(()=>Jn(e,t,n),[e,t,n])},Si=()=>{const{srcToken:e,dstToken:t,chainId:n}=q();return D.useMemo(()=>er(e,t,n),[e,t,n])},Di=()=>{const e=Fi(),t=Si();return e||t},vi={},Nt=()=>{const e=K(a=>a.state.swapExecutionIndex),t=K(a=>a.state.swapExecutions[a.state.swapExecutionIndex]??vi),n=K(a=>a.updateSwapExecutionAtIndex),r=K(a=>a.resetSwapExecutionAtIndex),s=D.useCallback(a=>n(e,a),[n,e]);return D.useMemo(()=>({...t,update:s,resetSwap:r}),[t,s,r])},st=()=>{const{srcToken:e,typedInputAmount:t}=q(),n=Nt(),r=tr(e==null?void 0:e.decimals,t),s=n.status===Ae.LOADING&&n.acceptedSrcAmount?n.acceptedSrcAmount:void 0,a=s??r,o=s?ge(s,e==null?void 0:e.decimals):t;return{amount:a,amountUI:o,error:S(a||0).isZero()?"enterAmount":void 0}},Pi=(e,t)=>{const{module:n,srcUsd1Token:r,marketPrice:s,minChunkSizeUsd:a,typedInputAmount:o}=q();return D.useMemo(()=>{if(S(o||"0").isZero()||!s||S(r||"0").isZero())return;if(!e)return{type:me.MIN_CHUNKS,value:1,args:{minChunks:"1"}};const{isError:d}=Ha(e,t,n);if(d)return{type:me.MAX_CHUNKS,value:t,args:{maxChunks:`${t}`}};const{isError:f,value:h}=Ka(o||"",r||"",a||0);if(f)return{type:me.MIN_TRADE_SIZE,value:h,args:{minTradeSize:`${h}`}}},[e,t,n,o,r,a,s])},Ke=()=>{const{srcToken:e,srcUsd1Token:t,module:n,minChunkSizeUsd:r}=q(),s=K(P=>P.state.typedChunks),a=K(P=>P.updateState),{amount:o,amountUI:d}=st(),f=D.useMemo(()=>Pa(d||"",t||"",r||0),[d,t,r]),h=D.useMemo(()=>va(f,n,s),[f,s,n]),x=D.useCallback(P=>a({typedChunks:P}),[a]),y=D.useMemo(()=>Ia(o||"",h),[o,h]),E=Et(e==null?void 0:e.decimals,y),v=D.useMemo(()=>t?S(E||"0").times(t||0).toString():"0",[E,t]);return{totalTrades:h,maxTrades:f,amountPerTradeUI:E,amountPerTrade:y,amountPerTradeUsd:v,onChange:x,error:Pi(h,f)}},Oi=()=>{const{srcToken:e,dstToken:t}=q(),{onChange:n,totalTrades:r,amountPerTradeUsd:s,amountPerTradeUI:a,error:o,maxTrades:d,amountPerTrade:f}=Ke();return{error:o,maxTrades:d,totalTrades:r,amountPerTradeUI:a,amountPerTrade:f,onChange:n,amountPerTradeUsd:s,fromToken:e,toToken:t}},ts=e=>{const t=Yn(e);if(t>=1)return`${t.toFixed(t%1?1:0)} ${t===1?"day":"days"}`;const n=bn(e)/60;if(n>=1)return`${n.toFixed(n%1?1:0)} ${n===1?"hour":"hours"}`;const r=bn(e);return`${r.toFixed(r%1?1:0)} ${r===1?"minute":"minutes"}`},Bi=e=>{const{totalTrades:t}=Ke(),{marketPrice:n,typedInputAmount:r}=q(),s=D.useMemo(()=>{const{isError:o,value:d}=qa(e);if(!(!o||S(r||"0").isZero()||!n))return{type:me.MIN_FILL_DELAY,value:d,args:{fillDelay:ts(d)}}},[e,r,n]),a=D.useMemo(()=>{const{isError:o,value:d}=Ma(e,t);if(!(!o||S(r||"0").isZero()||!n))return{type:me.MAX_FILL_DELAY,value:d,args:{fillDelay:ts(d)}}},[e,r,n,t]);return s||a},qt=()=>{const{callbacks:e}=q(),t=K(a=>a.state.typedFillDelay),n=K(a=>a.updateState),r=D.useMemo(()=>t||Ln,[t]),s=Bi(r);return{fillDelay:r,onChange:D.useCallback(a=>{var o;n({typedFillDelay:a}),(o=e==null?void 0:e.onFillDelayChange)==null||o.call(e,a)},[n,e]),error:s,milliseconds:r.unit*r.value}},Ii=()=>{const{onChange:e,fillDelay:t,error:n}=qt(),r=D.useCallback(a=>e({unit:t.unit,value:Number(a)}),[e,t]),s=D.useCallback(a=>e({unit:a,value:t.value}),[e,t]);return{onInputChange:r,onUnitSelect:s,onChange:e,milliseconds:t.unit*t.value,fillDelay:t,error:n}},Mi=e=>{const{module:t,marketPrice:n}=q();return D.useMemo(()=>{const r=La(t,e),s=Na(e);if(n){if(r.isError)return{type:me.MAX_ORDER_DURATION,value:r.value,args:{duration:`${Math.floor(Yn(r.value)).toFixed(0)} days`}};if(s.isError)return{type:me.MIN_ORDER_DURATION,value:s.value,args:{duration:`${Math.floor(bn(s.value)).toFixed(0)} minutes`}}}},[e,t,n])},nr=()=>{const{module:e,callbacks:t}=q(),n=K(f=>f.state.typedDuration),r=K(f=>f.updateState),s=Ke().totalTrades,a=qt().fillDelay,o=D.useMemo(()=>Da(e,s,a,n),[s,a,n,e]),d=Mi(o);return{duration:o,setDuration:D.useCallback(f=>{var h;r({typedDuration:f}),(h=t==null?void 0:t.onDurationChange)==null||h.call(t,f)},[r,t]),error:d}},ki=()=>{const{duration:e,setDuration:t,error:n}=nr(),r=D.useCallback(a=>{t({unit:e.unit,value:Number(a)})},[t,e]),s=D.useCallback(a=>{t({unit:a,value:e.value})},[t,e]);return{duration:e,onChange:t,milliseconds:e.unit*e.value,onInputChange:r,onUnitSelect:s,error:n}},_i=()=>{const{module:e}=q();return D.useMemo(()=>e===j.STOP_LOSS?fa:pa,[e])},rr=()=>{const{module:e}=q(),t=K(n=>n.state.isMarketOrder);return D.useMemo(()=>e!==j.STOP_LOSS&&e!==j.TAKE_PROFIT||t?void 0:e===j.STOP_LOSS?ha:ma,[e,t])},ns=e=>{if(e===void 0||e==="")return e;const t=S(e);return t.isNaN()||t.isZero()?"0":S(1).div(t).toFixed()},Cn=()=>{const{srcToken:e,dstToken:t}=q(),n=K(f=>f.updateState),r=K(f=>f.state.isInvertedTrade),s=K(f=>f.state.typedTriggerPrice),a=K(f=>f.state.typedLimitPrice),o=K(f=>f.state.isMarketOrder);return{onInvert:D.useCallback(()=>{n({isInvertedTrade:!r,...s!==void 0?{typedTriggerPrice:ns(s)}:{},...a!==void 0?{typedLimitPrice:ns(a)}:{}})},[n,r,s,a]),isInverted:r,fromToken:r?t:e,toToken:r?e:t,isMarketPrice:o}},xn=e=>e?S(e).isNaN()?"":e:"",rs=({amount:e,typedValue:t,amountDecimals:n=18,invertedAmountDecimals:r=18,amountUsd:s,invertedAmountUsd:a,isInverted:o})=>{const d=D.useMemo(()=>{if(t!==void 0)return xn(t);const x=ge(e,n);return!x||S(x||"0").isZero()?"":o?S(1).div(x).toFixed():x},[e,n,o,t]),f=D.useMemo(()=>d?xn(o?rt(d,r):e):"",[e,d,r,o]),h=qe(d||"0",o?a:s);return{amount:f,amountUI:d,usd:xn(h)}},ss=({typedValue:e,tokenDecimals:t=18,initialPrice:n="0",percentage:r,setValue:s,setPercentage:a})=>{const{isInverted:o}=Cn(),d=D.useMemo(()=>S((()=>{if(e!==void 0){const E=o?S(e).isZero()?S(0):S(1).div(e):S(e);return rt(E.toFixed(),t)}if(r!==void 0&&S(n||"0").gt(0)&&!S(n||"0").isNaN()){const E=S(n||"0"),v=S(r||0).div(100);return E.plus(E.multipliedBy(v)).decimalPlaces(0).toFixed()}return S(n).gt(0)?n:""})()).decimalPlaces(0).toFixed(),[e,r,t,n,o]),f=D.useCallback(y=>{s(y),a(null)},[s,a]),h=D.useCallback(y=>{s(void 0),a(y)},[s,a]),x=D.useMemo(()=>{if(!n||S(n).isZero())return"";if(r!=null)return r;if(d){const y=S(n),v=S(d).minus(y).div(y).multipliedBy(100).decimalPlaces(2).toString();return S(v||"0").isZero()?"":v}return""},[d,n,r]);return{amount:S(d).isNaN()?"":d,typedValue:e,selectedPercentage:x,onChange:f,onPercentageChange:h,isTypedValue:e!==void 0}},Ui=(e="")=>{const{module:t,marketPrice:n,typedInputAmount:r}=q();return D.useMemo(()=>{if(S(r||"0").isZero()||!n||t!==j.STOP_LOSS&&t!==j.TAKE_PROFIT)return;const s=ka(n||"",e||"",t);if(s!=null&&s.isError)return{type:me.STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE,value:s.value};const a=_a(n||"",e||"",t);if(a!=null&&a.isError)return{type:me.TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE,value:a.value};if(!e||S(e||0).isZero())return{type:me.EMPTY_TRIGGER_PRICE,value:e}},[n,e,t,r])},Ri=e=>{const{srcToken:t,dstToken:n,module:r,dstUsd1Token:s}=q(),a=Ke().amountPerTrade,o=K(h=>h.state.isMarketOrder),d=D.useMemo(()=>Sa(r,a,e,(t==null?void 0:t.decimals)||0),[e,a,o,t==null?void 0:t.decimals,r]),f=Et((n==null?void 0:n.decimals)||0,d);return{amount:d,amountUI:f,usd:qe(f,s)}},Ct=()=>{const{dstToken:e,dstUsd1Token:t,marketPrice:n,module:r,callbacks:s}=q(),a=K(U=>U.updateState),o=_i(),d=K(U=>U.state.triggerPricePercent),f=d===void 0?o:d,h=r===j.STOP_LOSS||r===j.TAKE_PROFIT,x=ss({typedValue:K(U=>U.state.typedTriggerPrice),percentage:f,tokenDecimals:(e==null?void 0:e.decimals)||18,initialPrice:h?n:void 0,setValue:D.useCallback(U=>{var F;a({typedTriggerPrice:U}),(F=s==null?void 0:s.onTriggerPriceChange)==null||F.call(s,U||"")},[a,s]),setPercentage:D.useCallback(U=>{var F;a({triggerPricePercent:U}),(F=s==null?void 0:s.onTriggerPricePercentChange)==null||F.call(s,U||"")},[a,s])}),y=Ui(x.amount),E=Et((e==null?void 0:e.decimals)||18,x.amount),v=qe(E,t),{amount:P,amountUI:B,usd:M}=Ri(x.amount);return D.useMemo(()=>({...x,amountUI:S(E).isNaN()?"":E,usd:S(v).isNaN()?"":v,error:y,pricePerChunk:P,pricePerChunkUI:B,pricePerChunkUsd:M}),[x,E,v,y,P,B,M])},Li=e=>{const{module:t,marketPrice:n,typedInputAmount:r}=q(),{amount:s}=Ct(),a=K(o=>o.state.isMarketOrder);return D.useMemo(()=>{if(S(r||"0").isZero()||!s||!n)return;const o=Ua(s,e,a,t),d=Ra(s,e,a,t);if(o!=null&&o.isError)return{type:me.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE,value:o.value};if(d!=null&&d.isError)return{type:me.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE,value:d.value};if(e&&S(e||0).isZero())return{type:me.MISSING_LIMIT_PRICE,value:e||""}},[e,s,t,a,r,n])},Tn=()=>{const{dstToken:e,dstUsd1Token:t,marketPrice:n,callbacks:r}=q(),s=K(E=>E.updateState),a=rr(),o=K(E=>E.state.limitPricePercent),d=o===void 0?a:o,f=ss({typedValue:K(E=>E.state.typedLimitPrice),percentage:d,tokenDecimals:(e==null?void 0:e.decimals)||18,initialPrice:n,setValue:D.useCallback(E=>{var v;s({typedLimitPrice:E}),(v=r==null?void 0:r.onLimitPriceChange)==null||v.call(r,E||"")},[s,r]),setPercentage:D.useCallback(E=>{var v;s({limitPricePercent:E}),(v=r==null?void 0:r.onLimitPricePercentChange)==null||v.call(r,E||"")},[s,r])}),h=Li(f.amount),x=Et((e==null?void 0:e.decimals)||18,f.amount),y=qe(x,t);return D.useMemo(()=>({...f,amountUI:S(x).isNaN()?"":x,usd:S(y).isNaN()?"":y,error:h}),[f,x,y,h])},Ni=()=>{const{module:e}=q(),t=K(d=>d.updateState),n=K(d=>d.state.isMarketOrder),r=rr(),s=K(d=>d.state.triggerPricePercent)||0,a=e===j.LIMIT,o=D.useCallback(()=>{!n&&e===j.STOP_LOSS&&t({limitPricePercent:r}),t({isMarketOrder:!n})},[t,s,e,n,r]);return{isLimitPrice:!n,toggleLimitPrice:o,hide:a}},qi=()=>{const{module:e,marketPriceLoading:t,srcToken:n,dstToken:r,srcUsd1Token:s,dstUsd1Token:a}=q(),{amount:o,typedValue:d,onChange:f,onPercentageChange:h,selectedPercentage:x,error:y,isTypedValue:E}=Tn(),v=K(V=>V.updateState),P=rr(),{isLimitPrice:B,toggleLimitPrice:M}=Ni(),{fromToken:U,toToken:F,isInverted:H}=Cn(),_=rs({amount:o,typedValue:d,amountDecimals:(r==null?void 0:r.decimals)||18,invertedAmountDecimals:(n==null?void 0:n.decimals)||18,amountUsd:a,invertedAmountUsd:s,isInverted:H}),Y=D.useCallback(()=>{v({typedLimitPrice:void 0}),v({limitPricePercent:P})},[v,e,P]);return{price:_.amount,priceUI:_.amountUI,error:y,onInputChange:f,onPercentageChange:h,onReset:Y,usd:_.usd,srcToken:n,dstToken:r,invertedSrcToken:U,invertedDstToken:F,percentage:x,isLoading:t,isLimitPrice:B,toggleLimitPrice:M,isTypedValue:E}},Ki=()=>{const{marketPrice:e,marketPriceLoading:t,srcToken:n,dstToken:r,srcUsd1Token:s,dstUsd1Token:a}=q(),{amount:o,typedValue:d,onChange:f,onPercentageChange:h,selectedPercentage:x,error:y,pricePerChunk:E,pricePerChunkUI:v,pricePerChunkUsd:P,isTypedValue:B}=Ct(),M=K(V=>V.updateState),{fromToken:U,toToken:F,isInverted:H}=Cn(),_=rs({amount:o,typedValue:d,amountDecimals:(r==null?void 0:r.decimals)||18,invertedAmountDecimals:(n==null?void 0:n.decimals)||18,amountUsd:a,invertedAmountUsd:s,isInverted:H}),Y=D.useCallback(()=>{M({triggerPricePercent:void 0,typedTriggerPrice:void 0})},[M]);return{price:_.amount,priceUI:_.amountUI,amountPerChunk:E,amountPerChunkUI:v,amountPerChunkUsd:P,error:y,onInputChange:f,onPercentageChange:h,percentage:x,onReset:Y,usd:_.usd,srcToken:n,dstToken:r,invertedSrcToken:U,invertedDstToken:F,isLoading:t||!e,isTypedValue:B}},as=()=>{const{module:e,marketPrice:t}=q(),n=Tn().amount,r=Ct().amount,s=K(a=>a.state.isMarketOrder);return e===j.LIMIT||!s?n||"":e===j.STOP_LOSS||e===j.TAKE_PROFIT?r||"":t||""},wn=()=>{const{srcToken:e,dstToken:t,dstUsd1Token:n}=q(),r=as(),s=st().amount,a=D.useMemo(()=>wa(s||"",r,(e==null?void 0:e.decimals)||0),[s,r,e==null?void 0:e.decimals]),o=Et(t==null?void 0:t.decimals,a);return{amount:a,amountUI:o,usd:qe(o,n)}},sr=()=>{const{srcToken:e,dstToken:t,dstUsd1Token:n}=q(),r=as(),s=Ke().amountPerTrade,a=K(f=>f.state.isMarketOrder),o=D.useMemo(()=>Fa(s,r,!!a,(e==null?void 0:e.decimals)||0),[s,r,a,e==null?void 0:e.decimals]),d=Et(t==null?void 0:t.decimals,o);return{amount:o,amountUI:d,usd:qe(d,n)}},Hi=()=>{const{typedInputAmount:e,marketPriceLoading:t,dstToken:n}=q(),{amountUI:r,usd:s}=wn(),o=Di()?e:r,d=tr(n==null?void 0:n.decimals,o);return{value:o,valueWei:d,isLoading:t,usd:s}},Wi=()=>{const e=K(s=>s.state.isMarketOrder),{module:t}=q(),n=D.useMemo(()=>{if(e&&t===j.STOP_LOSS)return nn.TRIGGER_MARKET_PRICE},[e,t]),r=D.useMemo(()=>{if(!(t!==j.LIMIT&&t!==j.TWAP))return e?nn.MARKET_PRICE:nn.LIMIT_PRICE},[e,t]);return n||r},zi=()=>{const{minChunkSizeUsd:e,typedInputAmount:t,srcUsd1Token:n}=q(),r=qe(t,n);return D.useMemo(()=>{if(!(!S(t||0).gt(0)||!r))return S(e).gt(S(r))?{type:me.MIN_TRADE_SIZE_ERROR,value:e,args:{minTradeSize:`${e}`}}:void 0},[e,t,r])};function is(){const{marketPrice:e,marketPriceLoading:t,typedInputAmount:n,srcUsd1Token:r,srcBalance:s,chainId:a}=q(),{error:o}=Ct(),{error:d}=Tn(),{error:f}=Ke(),{error:h}=qt(),{error:x}=nr(),y=zi(),E=st().amount,v=D.useMemo(()=>{if(s&&S(E).gt(s))return{type:me.INSUFFICIENT_BALANCE,value:s||""}},[s,E,a]);return D.useMemo(()=>za({marketPrice:e,typedInputAmount:n,srcUsd1Token:r,marketPriceLoading:t,triggerPriceError:o,limitPriceError:d,tradesError:f,fillDelayError:h,durationError:x,balanceError:v,minTradeSizeError:y}),[e,t,n,o,d,f,h,x,v,r,y])}var Kt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Qi={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},$i=(_s=class{constructor(){N(this,He,Qi);N(this,Ft,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&l(this,Ft)&&e!==l(this,He)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:l(this,He),provider:e}),k(this,He,e),process.env.NODE_ENV!=="production"&&k(this,Ft,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&k(this,Ft,!0),l(this,He).setTimeout(e,t)}clearTimeout(e){l(this,He).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&k(this,Ft,!0),l(this,He).setInterval(e,t)}clearInterval(e){l(this,He).clearInterval(e)}},He=new WeakMap,Ft=new WeakMap,_s),xt=new $i;function ji(e){setTimeout(e,0)}var Tt=typeof window>"u"||"Deno"in globalThis;function Ce(){}function Vi(e,t){return typeof e=="function"?e(t):e}function ar(e){return typeof e=="number"&&e>=0&&e!==1/0}function os(e,t){return Math.max(e+(t||0)-Date.now(),0)}function at(e,t){return typeof e=="function"?e(t):e}function Me(e,t){return typeof e=="function"?e(t):e}function cs(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:a,queryKey:o,stale:d}=e;if(o){if(r){if(t.queryHash!==ir(o,t.options))return!1}else if(!rn(t.queryKey,o))return!1}if(n!=="all"){const f=t.isActive();if(n==="active"&&!f||n==="inactive"&&f)return!1}return!(typeof d=="boolean"&&t.isStale()!==d||s&&s!==t.state.fetchStatus||a&&!a(t))}function us(e,t){const{exact:n,status:r,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(wt(t.options.mutationKey)!==wt(a))return!1}else if(!rn(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function ir(e,t){return((t==null?void 0:t.queryKeyHashFn)||wt)(e)}function wt(e){return JSON.stringify(e,(t,n)=>cr(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function rn(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>rn(e[n],t[n])):!1}var Gi=Object.prototype.hasOwnProperty;function or(e,t){if(e===t)return e;const n=ds(e)&&ds(t);if(!n&&!(cr(e)&&cr(t)))return t;const s=(n?e:Object.keys(e)).length,a=n?t:Object.keys(t),o=a.length,d=n?new Array(o):{};let f=0;for(let h=0;h<o;h++){const x=n?h:a[h],y=e[x],E=t[x];if(y===E){d[x]=y,(n?h<s:Gi.call(e,x))&&f++;continue}if(y===null||E===null||typeof y!="object"||typeof E!="object"){d[x]=E;continue}const v=or(y,E);d[x]=v,v===y&&f++}return s===o&&f===s?e:d}function Fn(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function ds(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function cr(e){if(!ls(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!ls(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function ls(e){return Object.prototype.toString.call(e)==="[object Object]"}function Xi(e){return new Promise(t=>{xt.setTimeout(t,e)})}function ur(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return or(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return or(e,t)}return t}function Zi(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Yi(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Sn=Symbol();function fs(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Sn&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Sn?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ps(e,t){return typeof e=="function"?e(...t):!!e}var Ji=(Us=class extends Kt{constructor(){super();N(this,St);N(this,ot);N(this,Wt);k(this,Wt,t=>{if(!Tt&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){l(this,ot)||this.setEventListener(l(this,Wt))}onUnsubscribe(){var t;this.hasListeners()||((t=l(this,ot))==null||t.call(this),k(this,ot,void 0))}setEventListener(t){var n;k(this,Wt,t),(n=l(this,ot))==null||n.call(this),k(this,ot,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){l(this,St)!==t&&(k(this,St,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof l(this,St)=="boolean"?l(this,St):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},St=new WeakMap,ot=new WeakMap,Wt=new WeakMap,Us),dr=new Ji;function lr(){let e,t;const n=new Promise((s,a)=>{e=s,t=a});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var eo=ji;function to(){let e=[],t=0,n=d=>{d()},r=d=>{d()},s=eo;const a=d=>{t?e.push(d):s(()=>{n(d)})},o=()=>{const d=e;e=[],d.length&&s(()=>{r(()=>{d.forEach(f=>{n(f)})})})};return{batch:d=>{let f;t++;try{f=d()}finally{t--,t||o()}return f},batchCalls:d=>(...f)=>{a(()=>{d(...f)})},schedule:a,setNotifyFunction:d=>{n=d},setBatchNotifyFunction:d=>{r=d},setScheduler:d=>{s=d}}}var de=to(),no=(Rs=class extends Kt{constructor(){super();N(this,zt,!0);N(this,ct);N(this,Qt);k(this,Qt,t=>{if(!Tt&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){l(this,ct)||this.setEventListener(l(this,Qt))}onUnsubscribe(){var t;this.hasListeners()||((t=l(this,ct))==null||t.call(this),k(this,ct,void 0))}setEventListener(t){var n;k(this,Qt,t),(n=l(this,ct))==null||n.call(this),k(this,ct,t(this.setOnline.bind(this)))}setOnline(t){l(this,zt)!==t&&(k(this,zt,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return l(this,zt)}},zt=new WeakMap,ct=new WeakMap,Qt=new WeakMap,Rs),Dn=new no;function ro(e){return Math.min(1e3*2**e,3e4)}function hs(e){return(e??"online")==="online"?Dn.isOnline():!0}var fr=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function ms(e){let t=!1,n=0,r;const s=lr(),a=()=>s.status!=="pending",o=B=>{var M;if(!a()){const U=new fr(B);E(U),(M=e.onCancel)==null||M.call(e,U)}},d=()=>{t=!0},f=()=>{t=!1},h=()=>dr.isFocused()&&(e.networkMode==="always"||Dn.isOnline())&&e.canRun(),x=()=>hs(e.networkMode)&&e.canRun(),y=B=>{a()||(r==null||r(),s.resolve(B))},E=B=>{a()||(r==null||r(),s.reject(B))},v=()=>new Promise(B=>{var M;r=U=>{(a()||h())&&B(U)},(M=e.onPause)==null||M.call(e)}).then(()=>{var B;r=void 0,a()||(B=e.onContinue)==null||B.call(e)}),P=()=>{if(a())return;let B;const M=n===0?e.initialPromise:void 0;try{B=M??e.fn()}catch(U){B=Promise.reject(U)}Promise.resolve(B).then(y).catch(U=>{var V;if(a())return;const F=e.retry??(Tt?0:3),H=e.retryDelay??ro,_=typeof H=="function"?H(n,U):H,Y=F===!0||typeof F=="number"&&n<F||typeof F=="function"&&F(n,U);if(t||!Y){E(U);return}n++,(V=e.onFail)==null||V.call(e,n,U),Xi(_).then(()=>h()?void 0:v()).then(()=>{t?E(U):P()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:d,continueRetry:f,canStart:x,start:()=>(x()?P():v().then(P),s)}}var ys=(Ls=class{constructor(){N(this,Dt)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ar(this.gcTime)&&k(this,Dt,xt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Tt?1/0:300*1e3))}clearGcTimeout(){l(this,Dt)&&(xt.clearTimeout(l(this,Dt)),k(this,Dt,void 0))}},Dt=new WeakMap,Ls),so=(Ns=class extends ys{constructor(t){super();N(this,Le);N(this,vt);N(this,$t);N(this,ke);N(this,Pt);N(this,he);N(this,sn);N(this,Ot);k(this,Ot,!1),k(this,sn,t.defaultOptions),this.setOptions(t.options),this.observers=[],k(this,Pt,t.client),k(this,ke,l(this,Pt).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,k(this,vt,bs(this.options)),this.state=t.state??l(this,vt),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=l(this,he))==null?void 0:t.promise}setOptions(t){if(this.options={...l(this,sn),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=bs(this.options);n.data!==void 0&&(this.setState(gs(n.data,n.dataUpdatedAt)),k(this,vt,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&l(this,ke).remove(this)}setData(t,n){const r=ur(this.state.data,t,this.options);return Q(this,Le,et).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Q(this,Le,et).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=l(this,he))==null?void 0:r.promise;return(s=l(this,he))==null||s.cancel(t),n?n.then(Ce).catch(Ce):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(l(this,vt))}isActive(){return this.observers.some(t=>Me(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Sn||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>at(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!os(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=l(this,he))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=l(this,he))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),l(this,ke).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(l(this,he)&&(l(this,Ot)?l(this,he).cancel({revert:!0}):l(this,he).cancelRetry()),this.scheduleGc()),l(this,ke).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Q(this,Le,et).call(this,{type:"invalidate"})}async fetch(t,n){var f,h,x,y,E,v,P,B,M,U,F,H;if(this.state.fetchStatus!=="idle"&&((f=l(this,he))==null?void 0:f.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(l(this,he))return l(this,he).continueRetry(),l(this,he).promise}if(t&&this.setOptions(t),!this.options.queryFn){const _=this.observers.find(Y=>Y.options.queryFn);_&&this.setOptions(_.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,s=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(k(this,Ot,!0),r.signal)})},a=()=>{const _=fs(this.options,n),V=(()=>{const oe={client:l(this,Pt),queryKey:this.queryKey,meta:this.meta};return s(oe),oe})();return k(this,Ot,!1),this.options.persister?this.options.persister(_,V,this):_(V)},d=(()=>{const _={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:l(this,Pt),state:this.state,fetchFn:a};return s(_),_})();(h=this.options.behavior)==null||h.onFetch(d,this),k(this,$t,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((x=d.fetchOptions)==null?void 0:x.meta))&&Q(this,Le,et).call(this,{type:"fetch",meta:(y=d.fetchOptions)==null?void 0:y.meta}),k(this,he,ms({initialPromise:n==null?void 0:n.initialPromise,fn:d.fetchFn,onCancel:_=>{_ instanceof fr&&_.revert&&this.setState({...l(this,$t),fetchStatus:"idle"}),r.abort()},onFail:(_,Y)=>{Q(this,Le,et).call(this,{type:"failed",failureCount:_,error:Y})},onPause:()=>{Q(this,Le,et).call(this,{type:"pause"})},onContinue:()=>{Q(this,Le,et).call(this,{type:"continue"})},retry:d.options.retry,retryDelay:d.options.retryDelay,networkMode:d.options.networkMode,canRun:()=>!0}));try{const _=await l(this,he).start();if(_===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(_),(v=(E=l(this,ke).config).onSuccess)==null||v.call(E,_,this),(B=(P=l(this,ke).config).onSettled)==null||B.call(P,_,this.state.error,this),_}catch(_){if(_ instanceof fr){if(_.silent)return l(this,he).promise;if(_.revert){if(this.state.data===void 0)throw _;return this.state.data}}throw Q(this,Le,et).call(this,{type:"error",error:_}),(U=(M=l(this,ke).config).onError)==null||U.call(M,_,this),(H=(F=l(this,ke).config).onSettled)==null||H.call(F,this.state.data,_,this),_}finally{this.scheduleGc()}}},vt=new WeakMap,$t=new WeakMap,ke=new WeakMap,Pt=new WeakMap,he=new WeakMap,sn=new WeakMap,Ot=new WeakMap,Le=new WeakSet,et=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...As(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...gs(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return k(this,$t,t.manual?s:void 0),s;case"error":const a=t.error;return{...r,error:a,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),de.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),l(this,ke).notify({query:this,type:"updated",action:t})})},Ns);function As(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:hs(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function gs(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function bs(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var ao=(qs=class extends Kt{constructor(t,n){super();N(this,ee);N(this,Se);N(this,Z);N(this,an);N(this,xe);N(this,Bt);N(this,jt);N(this,Ge);N(this,ut);N(this,on);N(this,Vt);N(this,Gt);N(this,It);N(this,Mt);N(this,dt);N(this,Xt,new Set);this.options=n,k(this,Se,t),k(this,ut,null),k(this,Ge,lr()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(l(this,Z).addObserver(this),Es(l(this,Z),this.options)?Q(this,ee,ln).call(this):this.updateResult(),Q(this,ee,wr).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return pr(l(this,Z),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return pr(l(this,Z),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Q(this,ee,Fr).call(this),Q(this,ee,Sr).call(this),l(this,Z).removeObserver(this)}setOptions(t){const n=this.options,r=l(this,Z);if(this.options=l(this,Se).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Me(this.options.enabled,l(this,Z))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Q(this,ee,Dr).call(this),l(this,Z).setOptions(this.options),n._defaulted&&!Fn(this.options,n)&&l(this,Se).getQueryCache().notify({type:"observerOptionsUpdated",query:l(this,Z),observer:this});const s=this.hasListeners();s&&Cs(l(this,Z),r,this.options,n)&&Q(this,ee,ln).call(this),this.updateResult(),s&&(l(this,Z)!==r||Me(this.options.enabled,l(this,Z))!==Me(n.enabled,l(this,Z))||at(this.options.staleTime,l(this,Z))!==at(n.staleTime,l(this,Z)))&&Q(this,ee,Cr).call(this);const a=Q(this,ee,xr).call(this);s&&(l(this,Z)!==r||Me(this.options.enabled,l(this,Z))!==Me(n.enabled,l(this,Z))||a!==l(this,dt))&&Q(this,ee,Tr).call(this,a)}getOptimisticResult(t){const n=l(this,Se).getQueryCache().build(l(this,Se),t),r=this.createResult(n,t);return oo(this,r)&&(k(this,xe,r),k(this,jt,this.options),k(this,Bt,l(this,Z).state)),r}getCurrentResult(){return l(this,xe)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&l(this,Ge).status==="pending"&&l(this,Ge).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){l(this,Xt).add(t)}getCurrentQuery(){return l(this,Z)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=l(this,Se).defaultQueryOptions(t),r=l(this,Se).getQueryCache().build(l(this,Se),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Q(this,ee,ln).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),l(this,xe)))}createResult(t,n){var c;const r=l(this,Z),s=this.options,a=l(this,xe),o=l(this,Bt),d=l(this,jt),h=t!==r?t.state:l(this,an),{state:x}=t;let y={...x},E=!1,v;if(n._optimisticResults){const u=this.hasListeners(),b=!u&&Es(t,n),m=u&&Cs(t,r,n,s);(b||m)&&(y={...y,...As(x.data,t.options)}),n._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:P,errorUpdatedAt:B,status:M}=y;v=y.data;let U=!1;if(n.placeholderData!==void 0&&v===void 0&&M==="pending"){let u;a!=null&&a.isPlaceholderData&&n.placeholderData===(d==null?void 0:d.placeholderData)?(u=a.data,U=!0):u=typeof n.placeholderData=="function"?n.placeholderData((c=l(this,Gt))==null?void 0:c.state.data,l(this,Gt)):n.placeholderData,u!==void 0&&(M="success",v=ur(a==null?void 0:a.data,u,n),E=!0)}if(n.select&&v!==void 0&&!U)if(a&&v===(o==null?void 0:o.data)&&n.select===l(this,on))v=l(this,Vt);else try{k(this,on,n.select),v=n.select(v),v=ur(a==null?void 0:a.data,v,n),k(this,Vt,v),k(this,ut,null)}catch(u){k(this,ut,u)}l(this,ut)&&(P=l(this,ut),v=l(this,Vt),B=Date.now(),M="error");const F=y.fetchStatus==="fetching",H=M==="pending",_=M==="error",Y=H&&F,V=v!==void 0,i={status:M,fetchStatus:y.fetchStatus,isPending:H,isSuccess:M==="success",isError:_,isInitialLoading:Y,isLoading:Y,data:v,dataUpdatedAt:y.dataUpdatedAt,error:P,errorUpdatedAt:B,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:y.dataUpdateCount>0||y.errorUpdateCount>0,isFetchedAfterMount:y.dataUpdateCount>h.dataUpdateCount||y.errorUpdateCount>h.errorUpdateCount,isFetching:F,isRefetching:F&&!H,isLoadingError:_&&!V,isPaused:y.fetchStatus==="paused",isPlaceholderData:E,isRefetchError:_&&V,isStale:hr(t,n),refetch:this.refetch,promise:l(this,Ge),isEnabled:Me(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const u=A=>{i.status==="error"?A.reject(i.error):i.data!==void 0&&A.resolve(i.data)},b=()=>{const A=k(this,Ge,i.promise=lr());u(A)},m=l(this,Ge);switch(m.status){case"pending":t.queryHash===r.queryHash&&u(m);break;case"fulfilled":(i.status==="error"||i.data!==m.value)&&b();break;case"rejected":(i.status!=="error"||i.error!==m.reason)&&b();break}}return i}updateResult(){const t=l(this,xe),n=this.createResult(l(this,Z),this.options);if(k(this,Bt,l(this,Z).state),k(this,jt,this.options),l(this,Bt).data!==void 0&&k(this,Gt,l(this,Z)),Fn(n,t))return;k(this,xe,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!l(this,Xt).size)return!0;const o=new Set(a??l(this,Xt));return this.options.throwOnError&&o.add("error"),Object.keys(l(this,xe)).some(d=>{const f=d;return l(this,xe)[f]!==t[f]&&o.has(f)})};Q(this,ee,js).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Q(this,ee,wr).call(this)}},Se=new WeakMap,Z=new WeakMap,an=new WeakMap,xe=new WeakMap,Bt=new WeakMap,jt=new WeakMap,Ge=new WeakMap,ut=new WeakMap,on=new WeakMap,Vt=new WeakMap,Gt=new WeakMap,It=new WeakMap,Mt=new WeakMap,dt=new WeakMap,Xt=new WeakMap,ee=new WeakSet,ln=function(t){Q(this,ee,Dr).call(this);let n=l(this,Z).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ce)),n},Cr=function(){Q(this,ee,Fr).call(this);const t=at(this.options.staleTime,l(this,Z));if(Tt||l(this,xe).isStale||!ar(t))return;const r=os(l(this,xe).dataUpdatedAt,t)+1;k(this,It,xt.setTimeout(()=>{l(this,xe).isStale||this.updateResult()},r))},xr=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(l(this,Z)):this.options.refetchInterval)??!1},Tr=function(t){Q(this,ee,Sr).call(this),k(this,dt,t),!(Tt||Me(this.options.enabled,l(this,Z))===!1||!ar(l(this,dt))||l(this,dt)===0)&&k(this,Mt,xt.setInterval(()=>{(this.options.refetchIntervalInBackground||dr.isFocused())&&Q(this,ee,ln).call(this)},l(this,dt)))},wr=function(){Q(this,ee,Cr).call(this),Q(this,ee,Tr).call(this,Q(this,ee,xr).call(this))},Fr=function(){l(this,It)&&(xt.clearTimeout(l(this,It)),k(this,It,void 0))},Sr=function(){l(this,Mt)&&(xt.clearInterval(l(this,Mt)),k(this,Mt,void 0))},Dr=function(){const t=l(this,Se).getQueryCache().build(l(this,Se),this.options);if(t===l(this,Z))return;const n=l(this,Z);k(this,Z,t),k(this,an,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},js=function(t){de.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(l(this,xe))}),l(this,Se).getQueryCache().notify({query:l(this,Z),type:"observerResultsUpdated"})})},qs);function io(e,t){return Me(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Es(e,t){return io(e,t)||e.state.data!==void 0&&pr(e,t,t.refetchOnMount)}function pr(e,t,n){if(Me(t.enabled,e)!==!1&&at(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&hr(e,t)}return!1}function Cs(e,t,n,r){return(e!==t||Me(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&hr(e,n)}function hr(e,t){return Me(t.enabled,e)!==!1&&e.isStaleByTime(at(t.staleTime,e))}function oo(e,t){return!Fn(e.getCurrentResult(),t)}function xs(e){return{onFetch:(t,n)=>{var x,y,E,v,P;const r=t.options,s=(E=(y=(x=t.fetchOptions)==null?void 0:x.meta)==null?void 0:y.fetchMore)==null?void 0:E.direction,a=((v=t.state.data)==null?void 0:v.pages)||[],o=((P=t.state.data)==null?void 0:P.pageParams)||[];let d={pages:[],pageParams:[]},f=0;const h=async()=>{let B=!1;const M=H=>{Object.defineProperty(H,"signal",{enumerable:!0,get:()=>(t.signal.aborted?B=!0:t.signal.addEventListener("abort",()=>{B=!0}),t.signal)})},U=fs(t.options,t.fetchOptions),F=async(H,_,Y)=>{if(B)return Promise.reject();if(_==null&&H.pages.length)return Promise.resolve(H);const oe=(()=>{const b={client:t.client,queryKey:t.queryKey,pageParam:_,direction:Y?"backward":"forward",meta:t.options.meta};return M(b),b})(),i=await U(oe),{maxPages:c}=t.options,u=Y?Yi:Zi;return{pages:u(H.pages,i,c),pageParams:u(H.pageParams,_,c)}};if(s&&a.length){const H=s==="backward",_=H?co:Ts,Y={pages:a,pageParams:o},V=_(r,Y);d=await F(Y,V,H)}else{const H=e??a.length;do{const _=f===0?o[0]??r.initialPageParam:Ts(r,d);if(f>0&&_==null)break;d=await F(d,_),f++}while(f<H)}return d};t.options.persister?t.fetchFn=()=>{var B,M;return(M=(B=t.options).persister)==null?void 0:M.call(B,h,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=h}}}function Ts(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function co(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var uo=(Ks=class extends ys{constructor(t){super();N(this,ze);N(this,cn);N(this,We);N(this,Te);N(this,kt);k(this,cn,t.client),this.mutationId=t.mutationId,k(this,Te,t.mutationCache),k(this,We,[]),this.state=t.state||ws(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){l(this,We).includes(t)||(l(this,We).push(t),this.clearGcTimeout(),l(this,Te).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){k(this,We,l(this,We).filter(n=>n!==t)),this.scheduleGc(),l(this,Te).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){l(this,We).length||(this.state.status==="pending"?this.scheduleGc():l(this,Te).remove(this))}continue(){var t;return((t=l(this,kt))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,d,f,h,x,y,E,v,P,B,M,U,F,H,_,Y,V,oe,i,c;const n=()=>{Q(this,ze,mt).call(this,{type:"continue"})},r={client:l(this,cn),meta:this.options.meta,mutationKey:this.options.mutationKey};k(this,kt,ms({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(u,b)=>{Q(this,ze,mt).call(this,{type:"failed",failureCount:u,error:b})},onPause:()=>{Q(this,ze,mt).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>l(this,Te).canRun(this)}));const s=this.state.status==="pending",a=!l(this,kt).canStart();try{if(s)n();else{Q(this,ze,mt).call(this,{type:"pending",variables:t,isPaused:a}),await((d=(o=l(this,Te).config).onMutate)==null?void 0:d.call(o,t,this,r));const b=await((h=(f=this.options).onMutate)==null?void 0:h.call(f,t,r));b!==this.state.context&&Q(this,ze,mt).call(this,{type:"pending",context:b,variables:t,isPaused:a})}const u=await l(this,kt).start();return await((y=(x=l(this,Te).config).onSuccess)==null?void 0:y.call(x,u,t,this.state.context,this,r)),await((v=(E=this.options).onSuccess)==null?void 0:v.call(E,u,t,this.state.context,r)),await((B=(P=l(this,Te).config).onSettled)==null?void 0:B.call(P,u,null,this.state.variables,this.state.context,this,r)),await((U=(M=this.options).onSettled)==null?void 0:U.call(M,u,null,t,this.state.context,r)),Q(this,ze,mt).call(this,{type:"success",data:u}),u}catch(u){try{throw await((H=(F=l(this,Te).config).onError)==null?void 0:H.call(F,u,t,this.state.context,this,r)),await((Y=(_=this.options).onError)==null?void 0:Y.call(_,u,t,this.state.context,r)),await((oe=(V=l(this,Te).config).onSettled)==null?void 0:oe.call(V,void 0,u,this.state.variables,this.state.context,this,r)),await((c=(i=this.options).onSettled)==null?void 0:c.call(i,void 0,u,t,this.state.context,r)),u}finally{Q(this,ze,mt).call(this,{type:"error",error:u})}}finally{l(this,Te).runNext(this)}}},cn=new WeakMap,We=new WeakMap,Te=new WeakMap,kt=new WeakMap,ze=new WeakSet,mt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),de.batch(()=>{l(this,We).forEach(r=>{r.onMutationUpdate(t)}),l(this,Te).notify({mutation:this,type:"updated",action:t})})},Ks);function ws(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var lo=(Hs=class extends Kt{constructor(t={}){super();N(this,Xe);N(this,Ne);N(this,un);this.config=t,k(this,Xe,new Set),k(this,Ne,new Map),k(this,un,0)}build(t,n,r){const s=new uo({client:t,mutationCache:this,mutationId:++Mn(this,un)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){l(this,Xe).add(t);const n=vn(t);if(typeof n=="string"){const r=l(this,Ne).get(n);r?r.push(t):l(this,Ne).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(l(this,Xe).delete(t)){const n=vn(t);if(typeof n=="string"){const r=l(this,Ne).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&l(this,Ne).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=vn(t);if(typeof n=="string"){const r=l(this,Ne).get(n),s=r==null?void 0:r.find(a=>a.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=vn(t);if(typeof n=="string"){const s=(r=l(this,Ne).get(n))==null?void 0:r.find(a=>a!==t&&a.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){de.batch(()=>{l(this,Xe).forEach(t=>{this.notify({type:"removed",mutation:t})}),l(this,Xe).clear(),l(this,Ne).clear()})}getAll(){return Array.from(l(this,Xe))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>us(n,r))}findAll(t={}){return this.getAll().filter(n=>us(t,n))}notify(t){de.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return de.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ce))))}},Xe=new WeakMap,Ne=new WeakMap,un=new WeakMap,Hs);function vn(e){var t;return(t=e.options.scope)==null?void 0:t.id}var fo=(Ws=class extends Kt{constructor(t,n){super();N(this,Je);N(this,Ze);N(this,lt);N(this,De);N(this,Ye);k(this,Ze,t),this.setOptions(n),this.bindMethods(),Q(this,Je,kn).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var r;const n=this.options;this.options=l(this,Ze).defaultMutationOptions(t),Fn(this.options,n)||l(this,Ze).getMutationCache().notify({type:"observerOptionsUpdated",mutation:l(this,De),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&wt(n.mutationKey)!==wt(this.options.mutationKey)?this.reset():((r=l(this,De))==null?void 0:r.state.status)==="pending"&&l(this,De).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=l(this,De))==null||t.removeObserver(this)}onMutationUpdate(t){Q(this,Je,kn).call(this),Q(this,Je,vr).call(this,t)}getCurrentResult(){return l(this,lt)}reset(){var t;(t=l(this,De))==null||t.removeObserver(this),k(this,De,void 0),Q(this,Je,kn).call(this),Q(this,Je,vr).call(this)}mutate(t,n){var r;return k(this,Ye,n),(r=l(this,De))==null||r.removeObserver(this),k(this,De,l(this,Ze).getMutationCache().build(l(this,Ze),this.options)),l(this,De).addObserver(this),l(this,De).execute(t)}},Ze=new WeakMap,lt=new WeakMap,De=new WeakMap,Ye=new WeakMap,Je=new WeakSet,kn=function(){var n;const t=((n=l(this,De))==null?void 0:n.state)??ws();k(this,lt,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},vr=function(t){de.batch(()=>{var n,r,s,a,o,d,f,h;if(l(this,Ye)&&this.hasListeners()){const x=l(this,lt).variables,y=l(this,lt).context,E={client:l(this,Ze),meta:this.options.meta,mutationKey:this.options.mutationKey};(t==null?void 0:t.type)==="success"?((r=(n=l(this,Ye)).onSuccess)==null||r.call(n,t.data,x,y,E),(a=(s=l(this,Ye)).onSettled)==null||a.call(s,t.data,null,x,y,E)):(t==null?void 0:t.type)==="error"&&((d=(o=l(this,Ye)).onError)==null||d.call(o,t.error,x,y,E),(h=(f=l(this,Ye)).onSettled)==null||h.call(f,void 0,t.error,x,y,E))}this.listeners.forEach(x=>{x(l(this,lt))})})},Ws),po=(zs=class extends Kt{constructor(t={}){super();N(this,Qe);this.config=t,k(this,Qe,new Map)}build(t,n,r){const s=n.queryKey,a=n.queryHash??ir(s,n);let o=this.get(a);return o||(o=new so({client:t,queryKey:s,queryHash:a,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){l(this,Qe).has(t.queryHash)||(l(this,Qe).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=l(this,Qe).get(t.queryHash);n&&(t.destroy(),n===t&&l(this,Qe).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){de.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return l(this,Qe).get(t)}getAll(){return[...l(this,Qe).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>cs(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>cs(t,r)):n}notify(t){de.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){de.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){de.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Qe=new WeakMap,zs),ho=(Qs=class{constructor(e={}){N(this,se);N(this,ft);N(this,pt);N(this,Zt);N(this,Yt);N(this,ht);N(this,Jt);N(this,en);k(this,se,e.queryCache||new po),k(this,ft,e.mutationCache||new lo),k(this,pt,e.defaultOptions||{}),k(this,Zt,new Map),k(this,Yt,new Map),k(this,ht,0)}mount(){Mn(this,ht)._++,l(this,ht)===1&&(k(this,Jt,dr.subscribe(async e=>{e&&(await this.resumePausedMutations(),l(this,se).onFocus())})),k(this,en,Dn.subscribe(async e=>{e&&(await this.resumePausedMutations(),l(this,se).onOnline())})))}unmount(){var e,t;Mn(this,ht)._--,l(this,ht)===0&&((e=l(this,Jt))==null||e.call(this),k(this,Jt,void 0),(t=l(this,en))==null||t.call(this),k(this,en,void 0))}isFetching(e){return l(this,se).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return l(this,ft).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=l(this,se).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=l(this,se).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(at(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return l(this,se).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=l(this,se).get(r.queryHash),a=s==null?void 0:s.state.data,o=Vi(t,a);if(o!==void 0)return l(this,se).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return de.batch(()=>l(this,se).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=l(this,se).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=l(this,se);de.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=l(this,se);return de.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=de.batch(()=>l(this,se).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Ce).catch(Ce)}invalidateQueries(e,t={}){return de.batch(()=>(l(this,se).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=de.batch(()=>l(this,se).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let a=s.fetch(void 0,n);return n.throwOnError||(a=a.catch(Ce)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(Ce)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=l(this,se).build(this,t);return n.isStaleByTime(at(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ce).catch(Ce)}fetchInfiniteQuery(e){return e.behavior=xs(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ce).catch(Ce)}ensureInfiniteQueryData(e){return e.behavior=xs(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Dn.isOnline()?l(this,ft).resumePausedMutations():Promise.resolve()}getQueryCache(){return l(this,se)}getMutationCache(){return l(this,ft)}getDefaultOptions(){return l(this,pt)}setDefaultOptions(e){k(this,pt,e)}setQueryDefaults(e,t){l(this,Zt).set(wt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...l(this,Zt).values()],n={};return t.forEach(r=>{rn(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){l(this,Yt).set(wt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...l(this,Yt).values()],n={};return t.forEach(r=>{rn(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...l(this,pt).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ir(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Sn&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...l(this,pt).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){l(this,se).clear(),l(this,ft).clear()}},se=new WeakMap,ft=new WeakMap,pt=new WeakMap,Zt=new WeakMap,Yt=new WeakMap,ht=new WeakMap,Jt=new WeakMap,en=new WeakMap,Qs),Fs=ce.createContext(void 0),Ht=e=>{const t=ce.useContext(Fs);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},mo=({client:e,children:t})=>(ce.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),W.jsx(Fs.Provider,{value:e,children:t})),Ss=ce.createContext(!1),yo=()=>ce.useContext(Ss);Ss.Provider;function Ao(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var go=ce.createContext(Ao()),bo=()=>ce.useContext(go),Eo=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Co=e=>{ce.useEffect(()=>{e.clearReset()},[e])},xo=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||ps(n,[e.error,r])),To=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},wo=(e,t)=>e.isLoading&&e.isFetching&&!t,Fo=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ds=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function So(e,t,n){var y,E,v,P,B;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=yo(),s=bo(),a=Ht(),o=a.defaultQueryOptions(e);(E=(y=a.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||E.call(y,o),process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),o._optimisticResults=r?"isRestoring":"optimistic",To(o),Eo(o,s),Co(s);const d=!a.getQueryCache().get(o.queryHash),[f]=ce.useState(()=>new t(a,o)),h=f.getOptimisticResult(o),x=!r&&e.subscribed!==!1;if(ce.useSyncExternalStore(ce.useCallback(M=>{const U=x?f.subscribe(de.batchCalls(M)):Ce;return f.updateResult(),U},[f,x]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),ce.useEffect(()=>{f.setOptions(o)},[o,f]),Fo(o,h))throw Ds(o,f,s);if(xo({result:h,errorResetBoundary:s,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw h.error;if((P=(v=a.getDefaultOptions().queries)==null?void 0:v._experimental_afterQuery)==null||P.call(v,o,h),o.experimental_prefetchInRender&&!Tt&&wo(h,r)){const M=d?Ds(o,f,s):(B=a.getQueryCache().get(o.queryHash))==null?void 0:B.promise;M==null||M.catch(Ce).finally(()=>{f.updateResult()})}return o.notifyOnChangeProps?h:f.trackResult(h)}function Do(e,t){return So(e,ao)}function it(e,t){const n=Ht(),[r]=ce.useState(()=>new fo(n,e));ce.useEffect(()=>{r.setOptions(e)},[r,e]);const s=ce.useSyncExternalStore(ce.useCallback(o=>r.subscribe(de.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=ce.useCallback((o,d)=>{r.mutate(o,d).catch(Ce)},[r]);if(s.error&&ps(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:a,mutateAsync:s.mutate}}const vo=2e4,Po=()=>{const{module:e}=q(),t=K(n=>n.state.isMarketOrder);return D.useMemo(()=>e===j.TWAP?t?G.TWAP_MARKET:G.TWAP_LIMIT:e===j.LIMIT?G.LIMIT:e===j.STOP_LOSS?t?G.STOP_LOSS_MARKET:G.STOP_LOSS_LIMIT:e===j.TAKE_PROFIT?t?G.TAKE_PROFIT_MARKET:G.TAKE_PROFIT_LIMIT:G.TWAP_MARKET,[e,t])},Pn=()=>{const{account:e,config:t,chainId:n,isDev:r,supportLegacyOrders:s}=q();return D.useMemo(()=>["useTwapOrderHistoryManager",e,t==null?void 0:t.adapter,t==null?void 0:t.partner,n,r,s],[e,t,n,r,s])},Oo=()=>{const e=Ht(),{account:t}=q(),n=Pn();return D.useCallback(r=>{e.setQueryData(n,s=>s?s!=null&&s.some(a=>a.id===r.id)?s:[r,...s]:[r])},[e,n,t])},Bo=()=>{const e=Ht(),t=Pn();return D.useCallback((n,r)=>{e.setQueryData(t,s=>s==null?void 0:s.map(a=>a.id===n?{...a,status:r}:a))},[e,t])},Io=()=>{const{callbacks:e}=q(),t=Ht(),n=Pn();return D.useCallback(r=>{var d;const s=t.getQueryData(n);let a=!1;const o=[];s&&s.filter(f=>f.version===2).forEach(f=>{var x;const h=r.find(y=>y.id===f.id);h&&h.progress!==f.progress&&(a=!0,o.push(h),h.status===ue.Completed&&((x=e==null?void 0:e.onOrderFilled)==null||x.call(e,h)))}),a&&((d=e==null?void 0:e.onOrdersProgressUpdate)==null||d.call(e,o))},[t,n,e])},Mo=(e,t)=>{const n=new Set(e.map(s=>s.id)),r=(t==null?void 0:t.filter(s=>s.version===1&&!n.has(s.id)))??[];return[...e,...r].sort((s,a)=>a.createdAt-s.createdAt)},mr=()=>{const{account:e,config:t,chainId:n,isDev:r,supportLegacyOrders:s}=q(),a=Ht(),o=Pn(),d=Io();return Do({refetchInterval:vo,refetchOnWindowFocus:!0,retry:!1,gcTime:1/0,staleTime:1/0,queryKey:o,queryFn:async({signal:h})=>{if(!e||!n||!t)return[];const x=a.getQueryData(o),y=s&&!x,E=await yi({signal:h,chainId:n,config:t,account:e,isDev:r,includeV1GraphOrders:y});d(E);const v=E.map(P=>t!=null&&t.twapConfig?{...P,fillDelayMillis:Wn(P,t.twapConfig)}:P);return!s||y?v:Mo(v,x)}})},ko=(e,t,n)=>D.useMemo(()=>{if(!(!e||!t||!n||n!=null&&n.isMarketPrice))return Nr(n,e==null?void 0:e.decimals,t==null?void 0:t.decimals)},[n,e,t]),_o=(e,t,n)=>D.useMemo(()=>{if(!(!e||!t||!n))return qr(n,e.decimals,t.decimals)},[n,e,t]),Uo=(e,t,n)=>D.useMemo(()=>{if(!(!e||!t||!n))return zn(n.srcAmountFilled,n.dstAmountFilled,e.decimals,t.decimals)},[n,e,t]),On=(e,t)=>[...e.filter(r=>r.status===t)].sort((r,s)=>s.createdAt-r.createdAt),Ro=()=>{const{data:e,isLoading:t,refetch:n,isRefetching:r}=mr(),s=D.useCallback(()=>n().then(a=>a.data),[n]);return D.useMemo(()=>({orders:{all:e??[],open:On(e??[],ue.Open),completed:On(e??[],ue.Completed),cancelled:On(e??[],ue.Cancelled),expired:On(e??[],ue.Expired)},isLoading:t,isRefetching:r,refetchOrders:s}),[e,t,r,s])},yr=()=>{const e=K(n=>n.state.currentTime),t=nr().duration;return D.useMemo(()=>Oa(e,t),[e,t])},vs=()=>{const{srcToken:e,dstToken:t,account:n,chainId:r,slippage:s,config:a,module:o,fees:d}=q(),{amount:f}=st(),{amountPerTrade:h,totalTrades:x}=Ke(),y=yr(),{amount:E}=sr(),{pricePerChunk:v}=Ct(),{milliseconds:P}=qt();return D.useMemo(()=>{var B;return zr({chainId:r,srcToken:Rt((e==null?void 0:e.address)||"")?((B=bt(r))==null?void 0:B.wToken.address)||"":(e==null?void 0:e.address)||"",dstToken:(t==null?void 0:t.address)||"",srcAmount:f,deadlineMillis:y,fillDelayMillis:!x||x===1?0:P,slippage:s*100,account:n,srcAmountPerTrade:h,dstMinAmountPerTrade:E,triggerAmountPerTrade:v,config:a,module:o})},[e,t,n,r,s,a,o,f,h,x,P,E,v,d])};function Lo(e){const t=e.slice(2);if(t.length===128){const a=`0x${t.slice(0,64)}`,o=parseInt(t.charAt(64),16),d=(o>>3)+27,f=`0x${(o&7).toString(16)}${t.slice(65,128)}`;return{r:a,s:f,v:d}}const n=`0x${t.slice(0,64)}`,r=`0x${t.slice(64,128)}`,s=parseInt(t.slice(128,130),16);return{r:n,s:r,v:s}}const No=()=>{var a;const{account:e,walletInteractions:t,callbacks:n,chainId:r}=q(),s=(a=En())==null?void 0:a.wToken;return it({mutationFn:async({onHash:o,srcAmountWei:d})=>{var h,x;if(!e)throw new Error("missing account");if(!t)throw new Error("missing walletInteractions");if(!s)throw new Error("tokenAddress is not defined");pe.onWrapRequest();const f=await t.wrapNativeToken(d);return(h=n==null?void 0:n.onWrapRequest)==null||h.call(n),o==null||o(f),pe.onWrapSuccess(f),(x=n==null?void 0:n.onWrapSuccess)==null||x.call(n,{txHash:f,explorerUrl:Lt(f,r),amount:ge(d,s.decimals)}),f},onError:o=>{throw pe.onWrapError(o),o}})},Ps=()=>{const{account:e,walletInteractions:t,chainId:n,callbacks:r,isDev:s}=q(),a=vs(),{refetch:o}=mr(),d=Oo();return it({mutationFn:async()=>{var M,U,F,H;if(!e)throw new Error("missing account");if(!t)throw new Error("missing walletInteractions");if(!n)throw new Error("missing chainId");const{order:f,domain:h,types:x,primaryType:y}=a;pe.onSignOrderRequest(f);let E;try{E=await t.signOrder({domain:h,types:x,primaryType:y,message:f,account:e})}catch(_){throw(M=r==null?void 0:r.onSignOrderError)==null||M.call(r,_),pe.onSignOrderError(_),_}pe.onSignOrderSuccess(E),(U=r==null?void 0:r.onSignOrderSuccess)==null||U.call(r,E);const v=Lo(E),P={v:`0x${v.v.toString(16)}`,r:v.r,s:v.s};(F=r==null?void 0:r.onSignOrderRequest)==null||F.call(r);const B=await jr(f,P,s);return(H=r==null?void 0:r.onOrderCreated)==null||H.call(r,B),d(B),o(),B}})},Os=()=>{const{account:e,walletInteractions:t,config:n}=q();return it({mutationFn:async({tokenAddress:r,srcAmountWei:s})=>{if(!t)throw new Error("missing walletInteractions");if(!e)throw new Error("missing account");if(!n)throw new Error("missing config");const a=await t.getAllowance({tokenAddress:r,spenderAddress:n.repermit}),o=S(a||"0").lt(S(s).toString());return{allowance:a,approvalRequired:o}}})},qo=()=>{const{account:e,walletInteractions:t,config:n,chainId:r,callbacks:s}=q(),{mutateAsync:a}=Os();return it({onError:o=>{pe.onApproveError(o)},mutationFn:async({token:o,onHash:d,srcAmountWei:f})=>{var y,E;if(!e)throw new Error("missing account");if(!t)throw new Error("missing walletInteractions");if(!n)throw new Error("missing config");pe.onApproveRequest();const h=await t.approveToken({tokenAddress:o.address,amount:f,spenderAddress:n.repermit});if(!h)throw new Error("failed to approve token");(y=s==null?void 0:s.onApproveRequest)==null||y.call(s),d(h);let x=!1;for(let v=0;v<3;v++){const{approvalRequired:P}=await a({tokenAddress:o.address,srcAmountWei:f});if(!P){x=!0;break}v<2&&await new Promise(B=>setTimeout(B,3e3))}if(!x)throw new Error(`Insufficient ${o.symbol} allowance to perform the swap. Please approve the token first.`);return pe.onApproveSuccess(h),(E=s==null?void 0:s.onApproveSuccess)==null||E.call(s,{txHash:h,explorerUrl:Lt(h,r),token:o,amount:ge(f,o.decimals)}),h}})},Ko=()=>{const{account:e,chainId:t,srcToken:n,dstToken:r,module:s,slippage:a}=q(),o=Ct(),d=st().amount,f=Ke().amountPerTrade,h=yr(),x=Ke().totalTrades,y=qt().fillDelay,E=sr().amount,v=K(P=>P.state.isMarketOrder);return it({mutationFn:async()=>{pe.onRequestOrder({account:e,chainId:t,module:s,srcToken:n,dstToken:r,fromTokenAmount:d,srcChunkAmount:f,triggerPricePerTrade:o.pricePerChunk,deadline:h,fillDelay:y.unit*y.value,minDstAmountOutPerTrade:E,slippage:a,isMarketOrder:v||!1,chunksAmount:x})}})};function Ho(e){const t=e.message,n=t.match(/,\s*code\s*:\s*(\d+)/i);return{message:t.replace(/^error\s*:/i,"").replace(/,\s*code\s*:\s*\d+/i,"").trim()||"",code:n?Number(n[1]):0}}const Bs=()=>{const{srcToken:e,dstToken:t,chainId:n,callbacks:r,marketPrice:s}=q(),a=qo().mutateAsync,o=No().mutateAsync,d=Ps().mutateAsync,{mutateAsync:f}=Os(),{update:h}=Nt(),{amount:x}=st(),y=Ko().mutate;return it({mutationFn:async()=>{var P,B;const E=K.getState().state.swapExecutions[K.getState().state.swapExecutionIndex];if((E==null?void 0:E.status)===Ae.LOADING||E!=null&&E.allowanceLoading)return;const v=Rt((e==null?void 0:e.address)||" ");try{if(!e)throw new Error("missing srcToken");if(!t)throw new Error("missing dstToken");if(!n)throw new Error("missing chainId");const M=es(e,n);h({allowanceLoading:!0,wrapTxHash:void 0,approveTxHash:void 0,acceptedMarketPrice:s,acceptedSrcAmount:x,srcToken:e,dstToken:t,pendingSteps:[]});const{approvalRequired:U}=await f({tokenAddress:M.address,srcAmountWei:x});let F=0,H=1;v&&H++,U&&H++,h({totalSteps:H,stepIndex:F,allowanceLoading:!1,hasApproval:!U,status:Ae.LOADING}),y();let _=[];v&&_.push(nt.WRAP),U&&_.push(nt.APPROVE),_.push(nt.CREATE),h({pendingSteps:_}),v&&(h({step:nt.WRAP}),await o({onHash:V=>h({wrapTxHash:V}),srcAmountWei:x}),F++,h({stepIndex:F})),U&&(h({step:nt.APPROVE}),await a({token:M,onHash:V=>h({approveTxHash:V}),srcAmountWei:x}),F++,h({stepIndex:F})),h({step:nt.CREATE});const Y=await d();return h({status:Ae.SUCCESS,orderId:Y.id}),Y}catch(M){if(Zn(M))(P=r==null?void 0:r.onSubmitOrderRejected)==null||P.call(r),h({step:void 0,status:void 0,stepIndex:void 0,allowanceLoading:!1,error:M});else{const U=Ho(M);(B=r==null?void 0:r.onSubmitOrderFailed)==null||B.call(r,U),h({status:Ae.FAILED,allowanceLoading:!1,parsedError:U,error:M})}throw M}}})},Wo=()=>{const e=Nt(),{srcToken:t,dstToken:n}=q(),r=Bs(),s=K(h=>h.resetState),a=D.useCallback(()=>r.mutateAsync(),[r]),{update:o,resetSwap:d,...f}=e;return D.useMemo(()=>({status:f.status,parsedError:f.parsedError,error:f.error,step:f.step,stepIndex:f.stepIndex,approveTxHash:f.approveTxHash,wrapTxHash:f.wrapTxHash,totalSteps:f.totalSteps,pendingSteps:f.pendingSteps,srcToken:t,dstToken:n,onSubmit:a,resetState:s,resetCurrentSwap:d,isLoading:(e==null?void 0:e.status)===Ae.LOADING,isSuccess:(e==null?void 0:e.status)===Ae.SUCCESS,isFailed:(e==null?void 0:e.status)===Ae.FAILED,confirmButtonLoading:f.allowanceLoading}),[a,f,s,d,t,n])},zo=()=>{const{marketPrice:e,srcToken:t,dstToken:n,marketPriceLoading:r,srcBalance:s,srcUsd1Token:a,noLiquidity:o,typedInputAmount:d}=q(),f=r||S(a||"0").isZero()||s===void 0||S(e||"0").isZero(),h=!!(t&&n&&d&&f),y=!!(is()||o||h||S(d||"0").isZero()||!t||!n);return D.useMemo(()=>({disabled:y,loading:h}),[y,h])},Qo=()=>{const{srcUsd1Token:e,dstUsd1Token:t}=q(),n=st().amountUI,r=wn().amountUI,s=qe(n,e),a=qe(r,t);return{srcAmountUsd:s,dstAmountUsd:a}},$o=()=>{const{fees:e,dstToken:t,dstUsd1Token:n}=q(),{amountUI:r}=wn(),s=D.useMemo(()=>!e||!r?"":S(r).multipliedBy(e).dividedBy(100).toFixed(),[r,e]),a=tr((t==null?void 0:t.decimals)||0,s);return{amountUI:s,amount:a,percent:e,usd:qe(s,n)}},jo=e=>{const t=D.useMemo(()=>!e.minDestAmountPerTrade||!e.totalTrades?"":S(e.minDestAmountPerTrade).multipliedBy(e.totalTrades).decimalPlaces(0).toFixed(),[e.minDestAmountPerTrade,e.totalTrades]),n=D.useMemo(()=>!e.minDestAmountPerTradeUI||!e.totalTrades?"":S(e.minDestAmountPerTradeUI).multipliedBy(e.totalTrades).toFixed(),[e.minDestAmountPerTradeUI,e.totalTrades]),r=D.useMemo(()=>!e.minDestAmountPerTradeUsd||!e.totalTrades?"":S(e.minDestAmountPerTradeUsd).multipliedBy(e.totalTrades).decimalPlaces(2).toFixed(),[e.minDestAmountPerTradeUsd,e.totalTrades]);return D.useMemo(()=>({srcToken:e.srcToken,dstToken:e.dstToken,orderType:e.orderType,createdAt:e.createdAt||0,deadline:e.deadline||0,totalTrades:e.totalTrades||0,tradeInterval:e.tradeInterval||0,recipient:e.account||"",srcAmount:e.srcAmount||"",srcAmountUI:e.srcAmountUI||"",srcAmountUsd:e.srcAmountUsd||"",dstAmount:e.dstAmount||"",dstAmountUI:e.dstAmountUI||"",dstAmountUsd:e.dstAmountUsd||"",limitPrice:e.limitPrice||"",limitPriceUI:e.limitPriceUI||"",limitPriceUsd:e.limitPriceUsd||"",sizePerTrade:e.srcAmountPerTrade||"",sizePerTradeUI:e.srcAmountPerTradeUI||"",sizePerTradeUsd:e.srcAmountPerTradeUsd,minDestAmountPerTrade:e.minDestAmountPerTrade||"",minDestAmountPerTradeUI:e.minDestAmountPerTradeUI||"",minDestAmountPerTradeUsd:e.minDestAmountPerTradeUsd,dstMinAmount:t,dstMinAmountUI:n,dstMinAmountUsd:r,triggerPrice:e.triggerPrice||"",triggerPriceUI:e.triggerPriceUI||"",triggerPriceUsd:e.triggerPriceUsd}),[e.srcToken,e.dstToken,e.orderType,e.createdAt,e.deadline,e.totalTrades,e.tradeInterval,e.account,e.srcAmount,e.srcAmountUI,e.srcAmountUsd,e.dstAmount,e.dstAmountUI,e.dstAmountUsd,e.limitPrice,e.limitPriceUI,e.limitPriceUsd,e.srcAmountPerTrade,e.srcAmountPerTradeUI,e.srcAmountPerTradeUsd,e.minDestAmountPerTrade,e.minDestAmountPerTradeUI,e.minDestAmountPerTradeUsd,t,n,r,e.triggerPrice,e.triggerPriceUI,e.triggerPriceUsd])},Vo=()=>{const{config:e}=q();return D.useMemo(()=>({spender:e.repermit}),[e])},Go=()=>{const{srcToken:e,dstToken:t,account:n,marketPrice:r}=q(),{spender:s}=Vo(),{amount:a}=st(),{amount:o,amountUI:d,usd:f}=Tn(),{amountPerTrade:h,amountPerTradeUI:x,amountPerTradeUsd:y,totalTrades:E}=Ke(),v=yr(),{amount:P,amountUI:B,usd:M}=sr(),{amountUI:U,amount:F,usd:H}=Ct(),{milliseconds:_}=qt(),{amount:Y,amountUI:V}=wn(),{srcAmountUsd:oe,dstAmountUsd:i}=Qo(),{amount:c,amountUI:u,percent:b,usd:m}=$o(),A=vs(),w=K(X=>X.state.isMarketOrder),p=K(X=>X.state.currentTime),g=Nt(),T=Po(),C=g.acceptedSrcAmount||a,O=ge(r,(t==null?void 0:t.decimals)||0),R=D.useMemo(()=>T===G.TAKE_PROFIT_MARKET||T===G.TAKE_PROFIT_LIMIT||T===G.STOP_LOSS_LIMIT||T===G.STOP_LOSS_MARKET,[T]),L=jo({srcToken:e,dstToken:t,account:n,orderType:T,createdAt:p,deadline:v,totalTrades:E,tradeInterval:_,srcAmount:C,srcAmountUI:ge(C,(e==null?void 0:e.decimals)||0),srcAmountUsd:oe,dstAmount:Y,dstAmountUI:V,dstAmountUsd:i,limitPrice:w?void 0:o,limitPriceUI:w?void 0:d,limitPriceUsd:w?void 0:f,srcAmountPerTrade:h,srcAmountPerTradeUI:x,srcAmountPerTradeUsd:y,minDestAmountPerTrade:P,minDestAmountPerTradeUI:B,minDestAmountPerTradeUsd:M,triggerPrice:F,triggerPriceUI:U,triggerPriceUsd:H});return D.useMemo(()=>({...L,feesAmountUI:u,feesAmount:c,feesUsd:m||"",feesPercentage:b,rePermitData:A,isTriggerPrice:R,isMarketOrder:w,marketPrice:r,marketPriceUi:O,spender:s}),[L,u,c,m,b,A,R,w,r,O,s])},Xo=()=>{const{supportedChains:e}=q();return D.useMemo(()=>e,[e])},Zo=60,Is=()=>{const{refetch:e}=mr();return it({mutationFn:async t=>{var n;for(let r=0;r<Zo;r++){const s=(n=await e())==null?void 0:n.data;if(!s)throw new Error("orders not found");const a=s.find(o=>o.id===t);if((a==null?void 0:a.status)===ue.Cancelled)return;await new Promise(o=>setTimeout(o,1e3))}throw new Error("Timed out waiting for order cancellation to be confirmed")}})},Yo=()=>{const e=K(n=>n.updateState);return{cancelOrders:K(n=>n.state.cancelOrders),setCancelOrder:(n,r)=>{const s=K.getState().state.cancelOrders;e({cancelOrders:{...s,[n]:r}})},clearCancelOrder:n=>{const r=K.getState().state.cancelOrders,{[n]:s,...a}=r;e({cancelOrders:a})}}},Jo=e=>{const{account:t,walletInteractions:n,config:r,callbacks:s,chainId:a}=q(),o=Is().mutateAsync,d=Bo(),{cancelOrders:f,setCancelOrder:h,clearCancelOrder:x}=Yo(),{mutateAsync:y}=it({mutationFn:async()=>{var B,M,U;if(!t||!n||!r)throw new Error("missing required parameters");if(!e)throw new Error("order is required");const P=e.id;try{(B=s==null?void 0:s.onCancelOrderRequest)==null||B.call(s,e),h(P,{status:Ae.LOADING}),pe.onCancelOrderRequest([e.version===1?e.id.toString():e.hash],e.version);const F=await n.cancelOrder({order:e,contractAddress:e.version===1?e.twapAddress:r.repermit,args:e.version===1?[e.id]:[[e.repermitDigest]],abi:e.version===1?Xs:Gs});if(!F)throw new Error("failed to cancel order");if(pe.onCancelOrderSuccess(F),d(e.id,ue.Cancelled),e.version!==1)try{await o(e.id)}catch(H){console.warn("cancel status sync lagging",H)}return(M=s==null?void 0:s.onCancelOrderSuccess)==null||M.call(s,{order:e.version===1?{...e,status:ue.Cancelled}:e,txHash:F,explorerUrl:Lt(F,a)}),h(P,{status:Ae.SUCCESS,txHash:F}),F}catch(F){console.error("cancel order error",F),(U=s==null?void 0:s.onCancelOrderFailed)==null||U.call(s,F),Zn(F)?x(P):(h(P,{status:Ae.FAILED,error:F.message}),pe.onCancelOrderError(F))}}}),E=D.useMemo(()=>{const P=f[(e==null?void 0:e.id)||""];return{isLoading:(P==null?void 0:P.status)===Ae.LOADING,isSuccess:(P==null?void 0:P.status)===Ae.SUCCESS,isError:(P==null?void 0:P.status)===Ae.FAILED,error:P==null?void 0:P.error,txHash:P==null?void 0:P.txHash}},[f,e==null?void 0:e.id]),v=D.useCallback(async()=>y(),[y]);return D.useMemo(()=>({cancelOrder:v,...E}),[v,E])},Ms=D.createContext(null),ec=({children:e})=>{const t=Oi(),n=ki(),r=Ii(),s=qi(),a=Ki(),o=Cn(),d=Hi(),f=Wi(),h=is(),x=zo(),y=Go(),E=Ro(),v=Wo(),P=Xo(),B=Is(),{module:M}=q(),U=D.useMemo(()=>({tradesAmountPanel:t,durationPanel:n,fillDelayPanel:r,limitPricePanel:s,triggerPricePanel:a,pricePanel:o,dstTokenPanel:d,disclaimerPanel:f,inputError:h,submitOrderButton:x,derivedFormData:y,orderHistoryPanel:E,orderExecutionPanel:v,supportedChains:P,refetchUntilStatusSynced:B,module:M}),[t,n,r,s,a,o,d,f,h,x,y,E,v,P,B,M]);return W.jsx(Ms.Provider,{value:U,children:e})},tc=()=>{const e=D.useContext(Ms);if(e===null)throw new Error("useSpot must be used within SpotProvider");return e},nc=D.createContext(null),Ar={didCatch:!1,error:null};class rc extends D.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Ar}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,s=arguments.length,a=new Array(s),o=0;o<s;o++)a[o]=arguments[o];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:a,reason:"imperative-api"}),this.setState(Ar)}}componentDidCatch(t,n){var r,s;(r=(s=this.props).onError)===null||r===void 0||r.call(s,t,n)}componentDidUpdate(t,n){const{didCatch:r}=this.state,{resetKeys:s}=this.props;if(r&&n.error!==null&&sc(t.resetKeys,s)){var a,o;(a=(o=this.props).onReset)===null||a===void 0||a.call(o,{next:s,prev:t.resetKeys,reason:"keys"}),this.setState(Ar)}}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:s}=this.props,{didCatch:a,error:o}=this.state;let d=t;if(a){const f={error:o,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")d=n(f);else if(r)d=D.createElement(r,f);else if(s!==void 0)d=s;else throw o}return D.createElement(nc.Provider,{value:{didCatch:a,error:o,resetErrorBoundary:this.resetErrorBoundary}},d)}}function sc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}const ac=()=>W.jsx("div",{className:"twap-error-fallback",children:W.jsx("p",{style:{fontSize:20,fontWeight:600,textAlign:"center",width:"100%",marginTop:40},children:"Something went wrong"})});function ic({children:e}){return W.jsx(rc,{FallbackComponent:ac,onError:t=>pe.onCrash(t),children:W.jsx(W.Fragment,{children:e})})}const ks=D.createContext(null),oc=new ho({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),cc=e=>{var E,v,P;const t=K(B=>B.updateState),n=K(B=>B.state.isMarketOrder);D.useEffect(()=>{const B=setInterval(()=>{t({currentTime:Date.now()})},6e4);return()=>clearInterval(B)},[t]);const r=(E=e.overrides)==null?void 0:E.state,{isMarketOrder:s,chunks:a,fillDelay:o,duration:d,limitPrice:f,triggerPrice:h,triggerPricePercent:x,limitPricePercent:y}=r??{};return D.useEffect(()=>{s!==void 0&&t({isMarketOrder:s}),t({typedChunks:a,typedFillDelay:o,typedDuration:d,typedLimitPrice:f,typedTriggerPrice:h,triggerPricePercent:x,limitPricePercent:y})},[t,s,a,o,d,f,h,x,y]),D.useEffect(()=>{var B,M,U,F;t({typedLimitPrice:(M=(B=e.overrides)==null?void 0:B.state)==null?void 0:M.limitPrice,typedTriggerPrice:(F=(U=e.overrides)==null?void 0:U.state)==null?void 0:F.triggerPrice,triggerPricePercent:void 0,limitPricePercent:void 0})},[(v=e.srcToken)==null?void 0:v.address,(P=e.dstToken)==null?void 0:P.address]),D.useEffect(()=>{e.module===j.LIMIT&&t({isMarketOrder:!1})},[e.module]),D.useEffect(()=>{n&&t({isInvertedTrade:!1})},[n]),D.useEffect(()=>{t({typedChunks:void 0})},[e.typedInputAmount]),null},uc=({marketReferencePrice:e,srcToken:t,dstToken:n,chainId:r,typedInputAmount:s})=>D.useMemo(()=>{if(Jn(t,n,r)||er(t,n,r))return{isLoading:!1,noLiquidity:!1,value:rt(s||"0",t==null?void 0:t.decimals)};if(S(e.value||0).isZero()||S(s||0).isZero())return e;const a=S(e.value||0).dividedBy(s||0).toFixed();return{...e,value:a}},[e,s,t,n,r]),dc=e=>{const t=Nt(),n=D.useMemo(()=>Lr(e.partner),[e.partner]),r=D.useMemo(()=>{const f=n[0];return e.chainId&&n.includes(e.chainId)?e.chainId:f},[e.chainId,n]),s=D.useMemo(()=>Qn(e.partner,r),[e.partner,r]),a=uc(e),o=D.useMemo(()=>Wr(e.minChunkSizeUsd),[e.minChunkSizeUsd]);D.useEffect(()=>{pe.init(s,o,r,e.appId)},[s,r,o,e.appId]);const d=D.useMemo(()=>({typedInputAmount:e.typedInputAmount,minChunkSizeUsd:o,account:e.account,walletInteractions:e.walletInteractions,marketPrice:t.acceptedMarketPrice||a.value,marketPriceLoading:!t.acceptedMarketPrice&&a.isLoading,noLiquidity:!t.acceptedMarketPrice&&a.noLiquidity,config:s,slippage:e.priceProtection,supportedChains:n,chainId:r,partner:e.partner,module:e.module,fees:e.fees||0,overrides:e.overrides,callbacks:e.callbacks,srcUsd1Token:e.srcUsd1Token,dstUsd1Token:e.dstUsd1Token,srcBalance:e.srcBalance,dstBalance:e.dstBalance,srcToken:t.srcToken||e.srcToken,dstToken:t.dstToken||e.dstToken,isDev:e.isDev,supportLegacyOrders:e.supportLegacyOrders??!1}),[e.typedInputAmount,o,e.account,e.walletInteractions,t.acceptedMarketPrice,t.srcToken,t.dstToken,a.value,a.isLoading,a.noLiquidity,s,e.priceProtection,n,r,e.partner,e.module,e.fees,e.overrides,e.callbacks,e.srcUsd1Token,e.dstUsd1Token,e.srcBalance,e.dstBalance,e.srcToken,e.dstToken,e.isDev,e.supportLegacyOrders]);return W.jsxs(ks.Provider,{value:d,children:[W.jsx(cc,{...e}),W.jsx(ec,{children:W.jsx(ic,{children:e.children})})]})},lc=e=>W.jsx(mo,{client:oc,children:W.jsx(dc,{...e})}),q=()=>{const e=D.useContext(ks);if(e===null)throw new Error("useSpotContext must be used within SpotProvider");return e},fc=(e,t,n)=>{const r=En();return D.useMemo(()=>e==null?void 0:e.map(s=>({rawFill:s,srcToken:t,dstToken:n,srcAmount:ge(s.inAmount,t==null?void 0:t.decimals),dstAmount:ge(s.outAmount,n==null?void 0:n.decimals),timestamp:s.timestamp,txHash:s.txHash,explorerUrl:Lt(s.txHash,r==null?void 0:r.id),executionRate:zn(s.inAmount,s.outAmount,t==null?void 0:t.decimals,n==null?void 0:n.decimals)})).filter(s=>s.srcToken!==void 0&&s.dstToken!==void 0),[e,t,n,r])},pc=(e,t,n)=>{const{config:r}=q(),s=ko(t,n,e),a=_o(t,n,e),o=Uo(t,n,e),d=D.useMemo(()=>e?e.version===2?e.fillDelay:r.twapConfig?Wn(e,r.twapConfig):0:0,[e,r]),f=fc(e==null?void 0:e.fills,t,n)??[];return D.useMemo(()=>{if(e!=null&&e.id)return{original:e,fills:f,srcToken:t,dstToken:n,orderType:e.type,createdAt:e.createdAt,deadline:e.deadline||0,totalTrades:e.totalTradesAmount||0,tradeInterval:d,recipient:e.maker||"",srcAmount:e.srcAmount||"",srcAmountUI:ge(e.srcAmount,t==null?void 0:t.decimals),limitPrice:rt(s,n==null?void 0:n.decimals),limitPriceUI:s||"",sizePerTrade:e.srcAmountPerTrade||"",sizePerTradeUI:ge(e.srcAmountPerTrade,t==null?void 0:t.decimals),minDestAmountPerTrade:e.dstMinAmountPerTrade||"",minDestAmountPerTradeUI:ge(e.dstMinAmountPerTrade,n==null?void 0:n.decimals),dstMinAmount:e.dstMinAmountTotal,dstMinAmountUI:ge(e.dstMinAmountTotal,n==null?void 0:n.decimals),triggerPrice:rt(a,n==null?void 0:n.decimals),triggerPriceUI:a||"",id:e.id,amountInFilled:e.srcAmountFilled,amountInFilledUI:ge(e.srcAmountFilled,t==null?void 0:t.decimals),amountOutFilled:e.dstAmountFilled,amountOutFilledUI:ge(e.dstAmountFilled,n==null?void 0:n.decimals),progress:e.progress,executionPrice:rt(o,n==null?void 0:n.decimals),executionPriceUI:o,version:e.version}},[e,f,t,n,d,s,a,o])};ja(Ai.version),I.DISCLAIMER_URL=la,I.Disclaimer=nn,I.InputErrors=me,I.Module=j,I.ORBS_LOGO=ua,I.ORBS_SLTP_FAQ_URL=ca,I.ORBS_TWAP_FAQ_URL=oa,I.ORBS_WEBSITE_URL=da,I.OrderFilter=Pr,I.OrderStatus=ue,I.OrderType=G,I.Partners=Pe,I.SPOT_VERSION=pn,I.SpotProvider=lc,I.Steps=nt,I.SwapStatus=Ae,I.TimeUnit=ve,I.buildRePermitOrderData=zr,I.ensureWrappedToken=es,I.eqIgnoreCase=At,I.getConfig=Qn,I.getExplorerUrl=Lt,I.getMinChunkSizeUsd=Wr,I.getNetwork=bt,I.getOrderExecutionRate=zn,I.getOrderFillDelayMillis=Wn,I.getOrderLimitPriceRate=Nr,I.getOrderType=Ti,I.getPartnerChains=Lr,I.getPartners=Hr,I.getTriggerPriceRate=qr,I.isNativeAddress=Rt,I.isTxRejected=Zn,I.millisToDays=Yn,I.millisToMinutes=bn,I.networks=ye,I.parseError=xi,I.shouldUnwrapOnly=er,I.shouldWrapOnly=Jn,I.submitOrder=jr,I.toAmountUi=ge,I.toAmountWei=rt,I.useAmountUi=Et,I.useCancelOrder=Jo,I.useDerivedHistoryOrder=pc,I.useExplorerLink=wi,I.useNetwork=En,I.useSignOrder=Ps,I.useSpot=tc,I.useSubmitOrder=Bs,I.useSwapExecution=Nt,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"})}));
64
+ `,extractResults:b=>{var x;return(((x=b.data)==null?void 0:x.orderFilleds)||[]).map(v=>({...v,timestamp:new Date(v.timestamp).getTime()}))}})};class pi extends Error{constructor(){super("No graph endpoint found"),this.name="NoGraphEndpointError"}}const mi=async({chainId:e,signal:t,page:n,limit:r,filters:s})=>{try{const a=await li({chainId:e,signal:t,page:n,limit:r,filters:s}),[i,u]=await Promise.all([hi({chainId:e,orders:a,signal:t}),fi({chainId:e,orders:a,signal:t})]),f=a.map(T=>{const b=i==null?void 0:i.filter(x=>x.TWAP_id===Number(T.Contract_id)&&gt(x.exchange,T.exchange)&&gt(x.twapAddress,T.twapAddress));return ui(T,e,b,yi(T,b||[],u))}).sort((T,b)=>b.createdAt-T.createdAt),h=new Set;return f.filter(T=>h.has(T.id)?!1:(h.add(T.id),!0))}catch{return[]}},yi=(e,t,n)=>{var u;const r=(u=n==null?void 0:n.find(f=>f.twapId===e.Contract_id.toString()&&gt(f.twapAddress,e.twapAddress)))==null?void 0:u.status,a=Gr(t).reduce((f,h)=>f.plus(h.inAmount),new D(0)).toFixed(),i=Zr(e.ask_srcAmount,a);return Ai(i,e.ask_deadline*1e3,r)},Zr=(e,t)=>{if(!t||!e)return 0;const n=D(t).dividedBy(e).toNumber();return n>=.99?100:n<=0?0:Number((n*100).toFixed(2))},Ai=(e,t,n)=>e===100?ue.Completed:n==="CANCELLED"?ue.Cancelled:n==="COMPLETED"?ue.Completed:t>Date.now()?ue.Open:ue.Expired,gi=async({signal:e,page:t,chainId:n,limit:r,exchange:s,partner:a,twapConfig:i,account:u,isDev:f=!1,includeV1GraphOrders:h=!0,includeV2Orders:T=!0})=>(await Promise.all([!i||!h?Promise.resolve([]):mi({chainId:n,signal:e,page:t,limit:r,filters:{accounts:[u],configs:[i]}}),T?oi({chainId:n,signal:e,account:u,exchange:s,partner:a,isDev:f}):Promise.resolve([])]).then(([v,O])=>[...v,...O])).sort((v,O)=>O.createdAt-v.createdAt),bi={version:"1.1.42"},Yr=e=>{let t;const n=new Set,r=(h,T)=>{const b=typeof h=="function"?h(t):h;if(!Object.is(b,t)){const x=t;t=T??(typeof b!="object"||b===null)?b:Object.assign({},t,b),n.forEach(v=>v(t,x))}},s=()=>t,u={setState:r,getState:s,getInitialState:()=>f,subscribe:h=>(n.add(h),()=>n.delete(h))},f=t=e(r,s,u);return u},Ei=(e=>e?Yr(e):Yr),xi=e=>e;function Ci(e,t=xi){const n=S.useSyncExternalStore(e.subscribe,S.useCallback(()=>t(e.getState()),[e,t]),S.useCallback(()=>t(e.getInitialState()),[e,t]));return S.useDebugValue(n),n}const Jr=e=>{const t=Ei(e),n=r=>Ci(t,r);return Object.assign(n,t),n},Ti=(e=>e?Jr(e):Jr),wn={},es={currentTime:Date.now(),cancelOrders:{},swapExecutions:[wn],swapExecutionIndex:0},H=Ti((e,t)=>({state:es,updateState:n=>e(r=>({state:{...r.state,...n}})),updateSwapExecutionAtIndex:(n,r)=>e(s=>{const a=[...s.state.swapExecutions];return a[n]={...a[n]??wn,...r},{state:{...s.state,swapExecutions:a}}}),resetSwapExecutionAtIndex:()=>e(n=>{const r=[...n.state.swapExecutions];return r[n.state.swapExecutionIndex]=wn,{state:{...n.state,swapExecutions:r}}}),resetState:()=>{const n=t().state;e({state:{...es,currentTime:Date.now(),isMarketOrder:n.isMarketOrder,swapExecutions:[...n.swapExecutions,wn],swapExecutionIndex:n.swapExecutionIndex+1}})}}));var Ae=(e=>(e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILED=3]="FAILED",e))(Ae||{}),sn=(e=>(e.TRIGGER_MARKET_PRICE="triggerMarketPriceDisclaimer",e.MARKET_PRICE="marketOrderDisclaimer",e.LIMIT_PRICE="limitOrderDisclaimer",e))(sn||{}),rt=(e=>(e.WRAP="wrap",e.APPROVE="approve",e.CREATE="create",e))(rt||{});const st=(e,t)=>t==null||!e||D(e).isNaN()?"":D(e).multipliedBy(D(10).pow(t)).toFixed(0),ge=(e,t)=>{try{return t==null||!e||D(e).isNaN()?"":D(e).dividedBy(D(10).pow(t)).toFixed()}catch(n){return console.error(n),""}},wi=e=>{const t="An error occurred.";if(!e||!e.message)return t;try{return e.message.toLowerCase().includes("rejected")?"Transaction Rejected":t}catch{return t}},tr=e=>{var t,n,r,s;if(e!=null&&e.message)return((n=(t=e.message)==null?void 0:t.toLowerCase())==null?void 0:n.includes("rejected"))||((s=(r=e.message)==null?void 0:r.toLowerCase())==null?void 0:s.includes("denied"))},ts=(e,t)=>{const n=Et(t);return n&&Rt(e.address)?n.wToken:e};function nr(e){return e?e/864e5:0}function Fn(e){return e?e/6e4:0}const Fi=(e,t)=>e?X.TWAP_MARKET:t===1?X.LIMIT:X.TWAP_LIMIT,rr=(e,t,n)=>{const r=Et(n);return Rt((e==null?void 0:e.address)||"")&&gt((t==null?void 0:t.address)||"",(r==null?void 0:r.wToken.address)||"")},sr=(e,t,n)=>{const r=Et(n);return gt((e==null?void 0:e.address)||"",(r==null?void 0:r.wToken.address)||"")&&Rt((t==null?void 0:t.address)||"")},Nt=(e,t)=>{if(!t)return"";const n=Et(t);return n!=null&&n.explorer?`${n.explorer}/tx/${e}`:""},ar=(e,t)=>S.useMemo(()=>st(t,e),[e,t]),xt=(e,t)=>S.useMemo(()=>ge(t,e),[e,t]),Sn=()=>{const{chainId:e}=K();return S.useMemo(()=>Et(e),[e])},Si=e=>{const t=Sn();return S.useMemo(()=>{if(!(!e||!t))return Nt(e,t.id)},[e,t])},qe=(e,t)=>S.useMemo(()=>!e||!t||D(e||"0").isZero()||D(t||"0").isZero()?"":D(e||"0").times(t).toFixed(),[e,t]),Di=()=>{const{srcToken:e,dstToken:t,chainId:n}=K();return S.useMemo(()=>rr(e,t,n),[e,t,n])},vi=()=>{const{srcToken:e,dstToken:t,chainId:n}=K();return S.useMemo(()=>sr(e,t,n),[e,t,n])},Pi=()=>{const e=Di(),t=vi();return e||t},Oi={},Kt=()=>{const e=H(a=>a.state.swapExecutionIndex),t=H(a=>a.state.swapExecutions[a.state.swapExecutionIndex]??Oi),n=H(a=>a.updateSwapExecutionAtIndex),r=H(a=>a.resetSwapExecutionAtIndex),s=S.useCallback(a=>n(e,a),[n,e]);return S.useMemo(()=>({...t,update:s,resetSwap:r}),[t,s,r])},at=()=>{const{srcToken:e,typedInputAmount:t}=K(),n=Kt(),r=ar(e==null?void 0:e.decimals,t),s=n.status===Ae.LOADING&&n.acceptedSrcAmount?n.acceptedSrcAmount:void 0,a=s??r,i=s?ge(s,e==null?void 0:e.decimals):t;return{amount:a,amountUI:i,error:D(a||0).isZero()?"enterAmount":void 0}},Bi=(e,t)=>{const{module:n,srcUsd1Token:r,marketPrice:s,minChunkSizeUsd:a,typedInputAmount:i}=K();return S.useMemo(()=>{if(D(i||"0").isZero()||!s||D(r||"0").isZero())return;if(!e)return{type:me.MIN_CHUNKS,value:1,args:{minChunks:"1"}};const{isError:u}=za(e,t,n);if(u)return{type:me.MAX_CHUNKS,value:t,args:{maxChunks:`${t}`}};const{isError:f,value:h}=Wa(i||"",r||"",a||0);if(f)return{type:me.MIN_TRADE_SIZE,value:h,args:{minTradeSize:`${h}`}}},[e,t,n,i,r,a,s])},He=()=>{const{srcToken:e,srcUsd1Token:t,module:n,minChunkSizeUsd:r}=K(),s=H(O=>O.state.typedChunks),a=H(O=>O.updateState),{amount:i,amountUI:u}=at(),f=S.useMemo(()=>Ia(u||"",t||"",r||0),[u,t,r]),h=S.useMemo(()=>Ba(f,n,s),[f,s,n]),T=S.useCallback(O=>a({typedChunks:O}),[a]),b=S.useMemo(()=>_a(i||"",h),[i,h]),x=xt(e==null?void 0:e.decimals,b),v=S.useMemo(()=>t?D(x||"0").times(t||0).toString():"0",[x,t]);return{totalTrades:h,maxTrades:f,amountPerTradeUI:x,amountPerTrade:b,amountPerTradeUsd:v,onChange:T,error:Bi(h,f)}},Ii=()=>{const{srcToken:e,dstToken:t}=K(),{onChange:n,totalTrades:r,amountPerTradeUsd:s,amountPerTradeUI:a,error:i,maxTrades:u,amountPerTrade:f}=He();return{error:i,maxTrades:u,totalTrades:r,amountPerTradeUI:a,amountPerTrade:f,onChange:n,amountPerTradeUsd:s,fromToken:e,toToken:t}},ns=e=>{const t=nr(e);if(t>=1)return`${t.toFixed(t%1?1:0)} ${t===1?"day":"days"}`;const n=Fn(e)/60;if(n>=1)return`${n.toFixed(n%1?1:0)} ${n===1?"hour":"hours"}`;const r=Fn(e);return`${r.toFixed(r%1?1:0)} ${r===1?"minute":"minutes"}`},Mi=e=>{const{totalTrades:t}=He(),{marketPrice:n,typedInputAmount:r}=K(),s=S.useMemo(()=>{const{isError:i,value:u}=$a(e);if(!(!i||D(r||"0").isZero()||!n))return{type:me.MIN_FILL_DELAY,value:u,args:{fillDelay:ns(u)}}},[e,r,n]),a=S.useMemo(()=>{const{isError:i,value:u}=Ua(e,t);if(!(!i||D(r||"0").isZero()||!n))return{type:me.MAX_FILL_DELAY,value:u,args:{fillDelay:ns(u)}}},[e,r,n,t]);return s||a},qt=()=>{const{callbacks:e}=K(),t=H(a=>a.state.typedFillDelay),n=H(a=>a.updateState),r=S.useMemo(()=>t||Wn,[t]),s=Mi(r);return{fillDelay:r,onChange:S.useCallback(a=>{var i;n({typedFillDelay:a}),(i=e==null?void 0:e.onFillDelayChange)==null||i.call(e,a)},[n,e]),error:s,milliseconds:r.unit*r.value}},ki=()=>{const{onChange:e,fillDelay:t,error:n}=qt(),r=S.useCallback(a=>e({unit:t.unit,value:Number(a)}),[e,t]),s=S.useCallback(a=>e({unit:a,value:t.value}),[e,t]);return{onInputChange:r,onUnitSelect:s,onChange:e,milliseconds:t.unit*t.value,fillDelay:t,error:n}},_i=e=>{const{module:t,marketPrice:n}=K();return S.useMemo(()=>{const r=qa(t,e),s=Ha(e);if(n){if(r.isError)return{type:me.MAX_ORDER_DURATION,value:r.value,args:{duration:`${Math.floor(nr(r.value)).toFixed(0)} days`}};if(s.isError)return{type:me.MIN_ORDER_DURATION,value:s.value,args:{duration:`${Math.floor(Fn(s.value)).toFixed(0)} minutes`}}}},[e,t,n])},ir=()=>{const{module:e,callbacks:t}=K(),n=H(f=>f.state.typedDuration),r=H(f=>f.updateState),s=He().totalTrades,a=qt().fillDelay,i=S.useMemo(()=>Oa(e,s,a,n),[s,a,n,e]),u=_i(i);return{duration:i,setDuration:S.useCallback(f=>{var h;r({typedDuration:f}),(h=t==null?void 0:t.onDurationChange)==null||h.call(t,f)},[r,t]),error:u}},Ui=()=>{const{duration:e,setDuration:t,error:n}=ir(),r=S.useCallback(a=>{t({unit:e.unit,value:Number(a)})},[t,e]),s=S.useCallback(a=>{t({unit:a,value:e.value})},[t,e]);return{duration:e,onChange:t,milliseconds:e.unit*e.value,onInputChange:r,onUnitSelect:s,error:n}},Li=()=>{const{module:e}=K();return S.useMemo(()=>e===G.STOP_LOSS?pa:ma,[e])},or=()=>{const{module:e}=K(),t=H(n=>n.state.isMarketOrder);return S.useMemo(()=>e!==G.STOP_LOSS&&e!==G.TAKE_PROFIT||t?void 0:e===G.STOP_LOSS?ya:Aa,[e,t])},rs=e=>{if(e===void 0||e==="")return e;const t=D(e);return t.isNaN()||t.isZero()?"0":D(1).div(t).toFixed()},Dn=()=>{const{srcToken:e,dstToken:t}=K(),n=H(f=>f.updateState),r=H(f=>f.state.isInvertedTrade),s=H(f=>f.state.typedTriggerPrice),a=H(f=>f.state.typedLimitPrice),i=H(f=>f.state.isMarketOrder);return{onInvert:S.useCallback(()=>{n({isInvertedTrade:!r,...s!==void 0?{typedTriggerPrice:rs(s)}:{},...a!==void 0?{typedLimitPrice:rs(a)}:{}})},[n,r,s,a]),isInverted:r,fromToken:r?t:e,toToken:r?e:t,isMarketPrice:i}},vn=e=>e?D(e).isNaN()?"":e:"",ss=({amount:e,typedValue:t,amountDecimals:n=18,invertedAmountDecimals:r=18,amountUsd:s,invertedAmountUsd:a,isInverted:i})=>{const u=S.useMemo(()=>{if(t!==void 0)return vn(t);const T=ge(e,n);return!T||D(T||"0").isZero()?"":i?D(1).div(T).toFixed():T},[e,n,i,t]),f=S.useMemo(()=>u?vn(i?st(u,r):e):"",[e,u,r,i]),h=qe(u||"0",i?a:s);return{amount:f,amountUI:u,usd:vn(h)}},as=({typedValue:e,tokenDecimals:t=18,initialPrice:n="0",percentage:r,setValue:s,setPercentage:a})=>{const{isInverted:i}=Dn(),u=S.useMemo(()=>D((()=>{if(e!==void 0){const x=i?D(e).isZero()?D(0):D(1).div(e):D(e);return st(x.toFixed(),t)}if(r!==void 0&&D(n||"0").gt(0)&&!D(n||"0").isNaN()){const x=D(n||"0"),v=D(r||0).div(100);return x.plus(x.multipliedBy(v)).decimalPlaces(0).toFixed()}return D(n).gt(0)?n:""})()).decimalPlaces(0).toFixed(),[e,r,t,n,i]),f=S.useCallback(b=>{s(b),a(null)},[s,a]),h=S.useCallback(b=>{s(void 0),a(b)},[s,a]),T=S.useMemo(()=>{if(!n||D(n).isZero())return"";if(r!=null)return r;if(u){const b=D(n),v=D(u).minus(b).div(b).multipliedBy(100).decimalPlaces(2).toString();return D(v||"0").isZero()?"":v}return""},[u,n,r]);return{amount:D(u).isNaN()?"":u,typedValue:e,selectedPercentage:T,onChange:f,onPercentageChange:h,isTypedValue:e!==void 0}},Ri=(e="")=>{const{module:t,marketPrice:n,typedInputAmount:r}=K();return S.useMemo(()=>{if(D(r||"0").isZero()||!n||t!==G.STOP_LOSS&&t!==G.TAKE_PROFIT)return;const s=La(n||"",e||"",t);if(s!=null&&s.isError)return{type:me.STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE,value:s.value};const a=Ra(n||"",e||"",t);if(a!=null&&a.isError)return{type:me.TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE,value:a.value};if(!e||D(e||0).isZero())return{type:me.EMPTY_TRIGGER_PRICE,value:e}},[n,e,t,r])},Ni=e=>{const{srcToken:t,dstToken:n,module:r,dstUsd1Token:s}=K(),a=He().amountPerTrade,i=H(h=>h.state.isMarketOrder),u=S.useMemo(()=>Pa(r,a,e,(t==null?void 0:t.decimals)||0),[e,a,i,t==null?void 0:t.decimals,r]),f=xt((n==null?void 0:n.decimals)||0,u);return{amount:u,amountUI:f,usd:qe(f,s)}},Ct=()=>{const{dstToken:e,dstUsd1Token:t,marketPrice:n,module:r,callbacks:s}=K(),a=H(_=>_.updateState),i=Li(),u=H(_=>_.state.triggerPricePercent),f=u===void 0?i:u,h=r===G.STOP_LOSS||r===G.TAKE_PROFIT,T=as({typedValue:H(_=>_.state.typedTriggerPrice),percentage:f,tokenDecimals:(e==null?void 0:e.decimals)||18,initialPrice:h?n:void 0,setValue:S.useCallback(_=>{var F;a({typedTriggerPrice:_}),(F=s==null?void 0:s.onTriggerPriceChange)==null||F.call(s,_||"")},[a,s]),setPercentage:S.useCallback(_=>{var F;a({triggerPricePercent:_}),(F=s==null?void 0:s.onTriggerPricePercentChange)==null||F.call(s,_||"")},[a,s])}),b=Ri(T.amount),x=xt((e==null?void 0:e.decimals)||18,T.amount),v=qe(x,t),{amount:O,amountUI:I,usd:B}=Ni(T.amount);return S.useMemo(()=>({...T,amountUI:D(x).isNaN()?"":x,usd:D(v).isNaN()?"":v,error:b,pricePerChunk:O,pricePerChunkUI:I,pricePerChunkUsd:B}),[T,x,v,b,O,I,B])},Ki=e=>{const{module:t,marketPrice:n,typedInputAmount:r}=K(),{amount:s}=Ct(),a=H(i=>i.state.isMarketOrder);return S.useMemo(()=>{if(D(r||"0").isZero()||!s||!n)return;const i=Na(s,e,a,t),u=Ka(s,e,a,t);if(i!=null&&i.isError)return{type:me.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE,value:i.value};if(u!=null&&u.isError)return{type:me.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE,value:u.value};if(e&&D(e||0).isZero())return{type:me.MISSING_LIMIT_PRICE,value:e||""}},[e,s,t,a,r,n])},Pn=()=>{const{dstToken:e,dstUsd1Token:t,marketPrice:n,callbacks:r}=K(),s=H(x=>x.updateState),a=or(),i=H(x=>x.state.limitPricePercent),u=i===void 0?a:i,f=as({typedValue:H(x=>x.state.typedLimitPrice),percentage:u,tokenDecimals:(e==null?void 0:e.decimals)||18,initialPrice:n,setValue:S.useCallback(x=>{var v;s({typedLimitPrice:x}),(v=r==null?void 0:r.onLimitPriceChange)==null||v.call(r,x||"")},[s,r]),setPercentage:S.useCallback(x=>{var v;s({limitPricePercent:x}),(v=r==null?void 0:r.onLimitPricePercentChange)==null||v.call(r,x||"")},[s,r])}),h=Ki(f.amount),T=xt((e==null?void 0:e.decimals)||18,f.amount),b=qe(T,t);return S.useMemo(()=>({...f,amountUI:D(T).isNaN()?"":T,usd:D(b).isNaN()?"":b,error:h}),[f,T,b,h])},qi=()=>{const{module:e}=K(),t=H(u=>u.updateState),n=H(u=>u.state.isMarketOrder),r=or(),s=H(u=>u.state.triggerPricePercent)||0,a=e===G.LIMIT,i=S.useCallback(()=>{!n&&e===G.STOP_LOSS&&t({limitPricePercent:r}),t({isMarketOrder:!n})},[t,s,e,n,r]);return{isLimitPrice:!n,toggleLimitPrice:i,hide:a}},Hi=()=>{const{module:e,marketPriceLoading:t,srcToken:n,dstToken:r,srcUsd1Token:s,dstUsd1Token:a}=K(),{amount:i,typedValue:u,onChange:f,onPercentageChange:h,selectedPercentage:T,error:b,isTypedValue:x}=Pn(),v=H(z=>z.updateState),O=or(),{isLimitPrice:I,toggleLimitPrice:B}=qi(),{fromToken:_,toToken:F,isInverted:q}=Dn(),k=ss({amount:i,typedValue:u,amountDecimals:(r==null?void 0:r.decimals)||18,invertedAmountDecimals:(n==null?void 0:n.decimals)||18,amountUsd:a,invertedAmountUsd:s,isInverted:q}),Q=S.useCallback(()=>{v({typedLimitPrice:void 0}),v({limitPricePercent:O})},[v,e,O]);return{price:k.amount,priceUI:k.amountUI,error:b,onInputChange:f,onPercentageChange:h,onReset:Q,usd:k.usd,srcToken:n,dstToken:r,invertedSrcToken:_,invertedDstToken:F,percentage:T,isLoading:t,isLimitPrice:I,toggleLimitPrice:B,isTypedValue:x}},$i=()=>{const{marketPrice:e,marketPriceLoading:t,srcToken:n,dstToken:r,srcUsd1Token:s,dstUsd1Token:a}=K(),{amount:i,typedValue:u,onChange:f,onPercentageChange:h,selectedPercentage:T,error:b,pricePerChunk:x,pricePerChunkUI:v,pricePerChunkUsd:O,isTypedValue:I}=Ct(),B=H(z=>z.updateState),{fromToken:_,toToken:F,isInverted:q}=Dn(),k=ss({amount:i,typedValue:u,amountDecimals:(r==null?void 0:r.decimals)||18,invertedAmountDecimals:(n==null?void 0:n.decimals)||18,amountUsd:a,invertedAmountUsd:s,isInverted:q}),Q=S.useCallback(()=>{B({triggerPricePercent:void 0,typedTriggerPrice:void 0})},[B]);return{price:k.amount,priceUI:k.amountUI,amountPerChunk:x,amountPerChunkUI:v,amountPerChunkUsd:O,error:b,onInputChange:f,onPercentageChange:h,percentage:T,onReset:Q,usd:k.usd,srcToken:n,dstToken:r,invertedSrcToken:_,invertedDstToken:F,isLoading:t||!e,isTypedValue:I}},is=()=>{const{module:e,marketPrice:t}=K(),n=Pn().amount,r=Ct().amount,s=H(a=>a.state.isMarketOrder);return e===G.LIMIT||!s?n||"":e===G.STOP_LOSS||e===G.TAKE_PROFIT?r||"":t||""},On=()=>{const{srcToken:e,dstToken:t,dstUsd1Token:n}=K(),r=is(),s=at().amount,a=S.useMemo(()=>Da(s||"",r,(e==null?void 0:e.decimals)||0),[s,r,e==null?void 0:e.decimals]),i=xt(t==null?void 0:t.decimals,a);return{amount:a,amountUI:i,usd:qe(i,n)}},cr=()=>{const{srcToken:e,dstToken:t,dstUsd1Token:n}=K(),r=is(),s=He().amountPerTrade,a=H(f=>f.state.isMarketOrder),i=S.useMemo(()=>va(s,r,!!a,(e==null?void 0:e.decimals)||0),[s,r,a,e==null?void 0:e.decimals]),u=xt(t==null?void 0:t.decimals,i);return{amount:i,amountUI:u,usd:qe(u,n)}},Wi=()=>{const{typedInputAmount:e,marketPriceLoading:t,dstToken:n}=K(),{amountUI:r,usd:s}=On(),i=Pi()?e:r,u=ar(n==null?void 0:n.decimals,i);return{value:i,valueWei:u,isLoading:t,usd:s}},zi=()=>{const e=H(s=>s.state.isMarketOrder),{module:t}=K(),n=S.useMemo(()=>{if(e&&t===G.STOP_LOSS)return sn.TRIGGER_MARKET_PRICE},[e,t]),r=S.useMemo(()=>{if(!(t!==G.LIMIT&&t!==G.TWAP))return e?sn.MARKET_PRICE:sn.LIMIT_PRICE},[e,t]);return n||r},Qi=()=>{const{minChunkSizeUsd:e,typedInputAmount:t,srcUsd1Token:n}=K(),r=qe(t,n);return S.useMemo(()=>{if(!(!D(t||0).gt(0)||!r))return D(e).gt(D(r))?{type:me.MIN_TRADE_SIZE_ERROR,value:e,args:{minTradeSize:`${e}`}}:void 0},[e,t,r])};function os(){const{marketPrice:e,marketPriceLoading:t,typedInputAmount:n,srcUsd1Token:r,srcBalance:s,chainId:a}=K(),{error:i}=Ct(),{error:u}=Pn(),{error:f}=He(),{error:h}=qt(),{error:T}=ir(),b=Qi(),x=at().amount,v=S.useMemo(()=>{if(s&&D(x).gt(s))return{type:me.INSUFFICIENT_BALANCE,value:s||""}},[s,x,a]);return S.useMemo(()=>Qa({marketPrice:e,typedInputAmount:n,srcUsd1Token:r,marketPriceLoading:t,triggerPriceError:i,limitPriceError:u,tradesError:f,fillDelayError:h,durationError:T,balanceError:v,minTradeSizeError:b}),[e,t,n,i,u,f,h,T,v,r,b])}var Ht=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ji={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Vi=(Rs=class{constructor(){N(this,$e,ji);N(this,St,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&l(this,St)&&e!==l(this,$e)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:l(this,$e),provider:e}),U(this,$e,e),process.env.NODE_ENV!=="production"&&U(this,St,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&U(this,St,!0),l(this,$e).setTimeout(e,t)}clearTimeout(e){l(this,$e).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&U(this,St,!0),l(this,$e).setInterval(e,t)}clearInterval(e){l(this,$e).clearInterval(e)}},$e=new WeakMap,St=new WeakMap,Rs),Tt=new Vi;function Gi(e){setTimeout(e,0)}var wt=typeof window>"u"||"Deno"in globalThis;function xe(){}function Xi(e,t){return typeof e=="function"?e(t):e}function ur(e){return typeof e=="number"&&e>=0&&e!==1/0}function cs(e,t){return Math.max(e+(t||0)-Date.now(),0)}function it(e,t){return typeof e=="function"?e(t):e}function Me(e,t){return typeof e=="function"?e(t):e}function us(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:a,queryKey:i,stale:u}=e;if(i){if(r){if(t.queryHash!==dr(i,t.options))return!1}else if(!an(t.queryKey,i))return!1}if(n!=="all"){const f=t.isActive();if(n==="active"&&!f||n==="inactive"&&f)return!1}return!(typeof u=="boolean"&&t.isStale()!==u||s&&s!==t.state.fetchStatus||a&&!a(t))}function ds(e,t){const{exact:n,status:r,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Ft(t.options.mutationKey)!==Ft(a))return!1}else if(!an(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function dr(e,t){return((t==null?void 0:t.queryKeyHashFn)||Ft)(e)}function Ft(e){return JSON.stringify(e,(t,n)=>fr(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function an(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>an(e[n],t[n])):!1}var Zi=Object.prototype.hasOwnProperty;function lr(e,t){if(e===t)return e;const n=ls(e)&&ls(t);if(!n&&!(fr(e)&&fr(t)))return t;const s=(n?e:Object.keys(e)).length,a=n?t:Object.keys(t),i=a.length,u=n?new Array(i):{};let f=0;for(let h=0;h<i;h++){const T=n?h:a[h],b=e[T],x=t[T];if(b===x){u[T]=b,(n?h<s:Zi.call(e,T))&&f++;continue}if(b===null||x===null||typeof b!="object"||typeof x!="object"){u[T]=x;continue}const v=lr(b,x);u[T]=v,v===b&&f++}return s===i&&f===s?e:u}function Bn(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function ls(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function fr(e){if(!fs(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!fs(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function fs(e){return Object.prototype.toString.call(e)==="[object Object]"}function Yi(e){return new Promise(t=>{Tt.setTimeout(t,e)})}function hr(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return lr(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return lr(e,t)}return t}function Ji(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function eo(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var In=Symbol();function hs(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===In&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===In?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ps(e,t){return typeof e=="function"?e(...t):!!e}var to=(Ns=class extends Ht{constructor(){super();N(this,Dt);N(this,ct);N(this,Wt);U(this,Wt,t=>{if(!wt&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){l(this,ct)||this.setEventListener(l(this,Wt))}onUnsubscribe(){var t;this.hasListeners()||((t=l(this,ct))==null||t.call(this),U(this,ct,void 0))}setEventListener(t){var n;U(this,Wt,t),(n=l(this,ct))==null||n.call(this),U(this,ct,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){l(this,Dt)!==t&&(U(this,Dt,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof l(this,Dt)=="boolean"?l(this,Dt):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Dt=new WeakMap,ct=new WeakMap,Wt=new WeakMap,Ns),pr=new to;function mr(){let e,t;const n=new Promise((s,a)=>{e=s,t=a});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var no=Gi;function ro(){let e=[],t=0,n=u=>{u()},r=u=>{u()},s=no;const a=u=>{t?e.push(u):s(()=>{n(u)})},i=()=>{const u=e;e=[],u.length&&s(()=>{r(()=>{u.forEach(f=>{n(f)})})})};return{batch:u=>{let f;t++;try{f=u()}finally{t--,t||i()}return f},batchCalls:u=>(...f)=>{a(()=>{u(...f)})},schedule:a,setNotifyFunction:u=>{n=u},setBatchNotifyFunction:u=>{r=u},setScheduler:u=>{s=u}}}var le=ro(),so=(Ks=class extends Ht{constructor(){super();N(this,zt,!0);N(this,ut);N(this,Qt);U(this,Qt,t=>{if(!wt&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){l(this,ut)||this.setEventListener(l(this,Qt))}onUnsubscribe(){var t;this.hasListeners()||((t=l(this,ut))==null||t.call(this),U(this,ut,void 0))}setEventListener(t){var n;U(this,Qt,t),(n=l(this,ut))==null||n.call(this),U(this,ut,t(this.setOnline.bind(this)))}setOnline(t){l(this,zt)!==t&&(U(this,zt,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return l(this,zt)}},zt=new WeakMap,ut=new WeakMap,Qt=new WeakMap,Ks),Mn=new so;function ao(e){return Math.min(1e3*2**e,3e4)}function ms(e){return(e??"online")==="online"?Mn.isOnline():!0}var yr=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function ys(e){let t=!1,n=0,r;const s=mr(),a=()=>s.status!=="pending",i=I=>{var B;if(!a()){const _=new yr(I);x(_),(B=e.onCancel)==null||B.call(e,_)}},u=()=>{t=!0},f=()=>{t=!1},h=()=>pr.isFocused()&&(e.networkMode==="always"||Mn.isOnline())&&e.canRun(),T=()=>ms(e.networkMode)&&e.canRun(),b=I=>{a()||(r==null||r(),s.resolve(I))},x=I=>{a()||(r==null||r(),s.reject(I))},v=()=>new Promise(I=>{var B;r=_=>{(a()||h())&&I(_)},(B=e.onPause)==null||B.call(e)}).then(()=>{var I;r=void 0,a()||(I=e.onContinue)==null||I.call(e)}),O=()=>{if(a())return;let I;const B=n===0?e.initialPromise:void 0;try{I=B??e.fn()}catch(_){I=Promise.reject(_)}Promise.resolve(I).then(b).catch(_=>{var z;if(a())return;const F=e.retry??(wt?0:3),q=e.retryDelay??ao,k=typeof q=="function"?q(n,_):q,Q=F===!0||typeof F=="number"&&n<F||typeof F=="function"&&F(n,_);if(t||!Q){x(_);return}n++,(z=e.onFail)==null||z.call(e,n,_),Yi(k).then(()=>h()?void 0:v()).then(()=>{t?x(_):O()})})};return{promise:s,status:()=>s.status,cancel:i,continue:()=>(r==null||r(),s),cancelRetry:u,continueRetry:f,canStart:T,start:()=>(T()?O():v().then(O),s)}}var As=(qs=class{constructor(){N(this,vt)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ur(this.gcTime)&&U(this,vt,Tt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(wt?1/0:300*1e3))}clearGcTimeout(){l(this,vt)&&(Tt.clearTimeout(l(this,vt)),U(this,vt,void 0))}},vt=new WeakMap,qs),io=(Hs=class extends As{constructor(t){super();N(this,Ne);N(this,Pt);N(this,jt);N(this,ke);N(this,Ot);N(this,pe);N(this,on);N(this,Bt);U(this,Bt,!1),U(this,on,t.defaultOptions),this.setOptions(t.options),this.observers=[],U(this,Ot,t.client),U(this,ke,l(this,Ot).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,U(this,Pt,Es(this.options)),this.state=t.state??l(this,Pt),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=l(this,pe))==null?void 0:t.promise}setOptions(t){if(this.options={...l(this,on),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Es(this.options);n.data!==void 0&&(this.setState(bs(n.data,n.dataUpdatedAt)),U(this,Pt,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&l(this,ke).remove(this)}setData(t,n){const r=hr(this.state.data,t,this.options);return j(this,Ne,tt).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){j(this,Ne,tt).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=l(this,pe))==null?void 0:r.promise;return(s=l(this,pe))==null||s.cancel(t),n?n.then(xe).catch(xe):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(l(this,Pt))}isActive(){return this.observers.some(t=>Me(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===In||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>it(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!cs(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=l(this,pe))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=l(this,pe))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),l(this,ke).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(l(this,pe)&&(l(this,Bt)?l(this,pe).cancel({revert:!0}):l(this,pe).cancelRetry()),this.scheduleGc()),l(this,ke).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||j(this,Ne,tt).call(this,{type:"invalidate"})}async fetch(t,n){var f,h,T,b,x,v,O,I,B,_,F,q;if(this.state.fetchStatus!=="idle"&&((f=l(this,pe))==null?void 0:f.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(l(this,pe))return l(this,pe).continueRetry(),l(this,pe).promise}if(t&&this.setOptions(t),!this.options.queryFn){const k=this.observers.find(Q=>Q.options.queryFn);k&&this.setOptions(k.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,s=k=>{Object.defineProperty(k,"signal",{enumerable:!0,get:()=>(U(this,Bt,!0),r.signal)})},a=()=>{const k=hs(this.options,n),z=(()=>{const re={client:l(this,Ot),queryKey:this.queryKey,meta:this.meta};return s(re),re})();return U(this,Bt,!1),this.options.persister?this.options.persister(k,z,this):k(z)},u=(()=>{const k={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:l(this,Ot),state:this.state,fetchFn:a};return s(k),k})();(h=this.options.behavior)==null||h.onFetch(u,this),U(this,jt,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((T=u.fetchOptions)==null?void 0:T.meta))&&j(this,Ne,tt).call(this,{type:"fetch",meta:(b=u.fetchOptions)==null?void 0:b.meta}),U(this,pe,ys({initialPromise:n==null?void 0:n.initialPromise,fn:u.fetchFn,onCancel:k=>{k instanceof yr&&k.revert&&this.setState({...l(this,jt),fetchStatus:"idle"}),r.abort()},onFail:(k,Q)=>{j(this,Ne,tt).call(this,{type:"failed",failureCount:k,error:Q})},onPause:()=>{j(this,Ne,tt).call(this,{type:"pause"})},onContinue:()=>{j(this,Ne,tt).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0}));try{const k=await l(this,pe).start();if(k===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(k),(v=(x=l(this,ke).config).onSuccess)==null||v.call(x,k,this),(I=(O=l(this,ke).config).onSettled)==null||I.call(O,k,this.state.error,this),k}catch(k){if(k instanceof yr){if(k.silent)return l(this,pe).promise;if(k.revert){if(this.state.data===void 0)throw k;return this.state.data}}throw j(this,Ne,tt).call(this,{type:"error",error:k}),(_=(B=l(this,ke).config).onError)==null||_.call(B,k,this),(q=(F=l(this,ke).config).onSettled)==null||q.call(F,this.state.data,k,this),k}finally{this.scheduleGc()}}},Pt=new WeakMap,jt=new WeakMap,ke=new WeakMap,Ot=new WeakMap,pe=new WeakMap,on=new WeakMap,Bt=new WeakMap,Ne=new WeakSet,tt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...gs(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...bs(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return U(this,jt,t.manual?s:void 0),s;case"error":const a=t.error;return{...r,error:a,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),le.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),l(this,ke).notify({query:this,type:"updated",action:t})})},Hs);function gs(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ms(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function bs(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Es(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var oo=($s=class extends Ht{constructor(t,n){super();N(this,ee);N(this,Se);N(this,Y);N(this,cn);N(this,Ce);N(this,It);N(this,Vt);N(this,Xe);N(this,dt);N(this,un);N(this,Gt);N(this,Xt);N(this,Mt);N(this,kt);N(this,lt);N(this,Zt,new Set);this.options=n,U(this,Se,t),U(this,dt,null),U(this,Xe,mr()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(l(this,Y).addObserver(this),xs(l(this,Y),this.options)?j(this,ee,hn).call(this):this.updateResult(),j(this,ee,vr).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ar(l(this,Y),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ar(l(this,Y),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,j(this,ee,Pr).call(this),j(this,ee,Or).call(this),l(this,Y).removeObserver(this)}setOptions(t){const n=this.options,r=l(this,Y);if(this.options=l(this,Se).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Me(this.options.enabled,l(this,Y))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");j(this,ee,Br).call(this),l(this,Y).setOptions(this.options),n._defaulted&&!Bn(this.options,n)&&l(this,Se).getQueryCache().notify({type:"observerOptionsUpdated",query:l(this,Y),observer:this});const s=this.hasListeners();s&&Cs(l(this,Y),r,this.options,n)&&j(this,ee,hn).call(this),this.updateResult(),s&&(l(this,Y)!==r||Me(this.options.enabled,l(this,Y))!==Me(n.enabled,l(this,Y))||it(this.options.staleTime,l(this,Y))!==it(n.staleTime,l(this,Y)))&&j(this,ee,Fr).call(this);const a=j(this,ee,Sr).call(this);s&&(l(this,Y)!==r||Me(this.options.enabled,l(this,Y))!==Me(n.enabled,l(this,Y))||a!==l(this,lt))&&j(this,ee,Dr).call(this,a)}getOptimisticResult(t){const n=l(this,Se).getQueryCache().build(l(this,Se),t),r=this.createResult(n,t);return uo(this,r)&&(U(this,Ce,r),U(this,Vt,this.options),U(this,It,l(this,Y).state)),r}getCurrentResult(){return l(this,Ce)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&l(this,Xe).status==="pending"&&l(this,Xe).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){l(this,Zt).add(t)}getCurrentQuery(){return l(this,Y)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=l(this,Se).defaultQueryOptions(t),r=l(this,Se).getQueryCache().build(l(this,Se),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return j(this,ee,hn).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),l(this,Ce)))}createResult(t,n){var c;const r=l(this,Y),s=this.options,a=l(this,Ce),i=l(this,It),u=l(this,Vt),h=t!==r?t.state:l(this,cn),{state:T}=t;let b={...T},x=!1,v;if(n._optimisticResults){const d=this.hasListeners(),g=!d&&xs(t,n),m=d&&Cs(t,r,n,s);(g||m)&&(b={...b,...gs(T.data,t.options)}),n._optimisticResults==="isRestoring"&&(b.fetchStatus="idle")}let{error:O,errorUpdatedAt:I,status:B}=b;v=b.data;let _=!1;if(n.placeholderData!==void 0&&v===void 0&&B==="pending"){let d;a!=null&&a.isPlaceholderData&&n.placeholderData===(u==null?void 0:u.placeholderData)?(d=a.data,_=!0):d=typeof n.placeholderData=="function"?n.placeholderData((c=l(this,Xt))==null?void 0:c.state.data,l(this,Xt)):n.placeholderData,d!==void 0&&(B="success",v=hr(a==null?void 0:a.data,d,n),x=!0)}if(n.select&&v!==void 0&&!_)if(a&&v===(i==null?void 0:i.data)&&n.select===l(this,un))v=l(this,Gt);else try{U(this,un,n.select),v=n.select(v),v=hr(a==null?void 0:a.data,v,n),U(this,Gt,v),U(this,dt,null)}catch(d){U(this,dt,d)}l(this,dt)&&(O=l(this,dt),v=l(this,Gt),I=Date.now(),B="error");const F=b.fetchStatus==="fetching",q=B==="pending",k=B==="error",Q=q&&F,z=v!==void 0,o={status:B,fetchStatus:b.fetchStatus,isPending:q,isSuccess:B==="success",isError:k,isInitialLoading:Q,isLoading:Q,data:v,dataUpdatedAt:b.dataUpdatedAt,error:O,errorUpdatedAt:I,failureCount:b.fetchFailureCount,failureReason:b.fetchFailureReason,errorUpdateCount:b.errorUpdateCount,isFetched:b.dataUpdateCount>0||b.errorUpdateCount>0,isFetchedAfterMount:b.dataUpdateCount>h.dataUpdateCount||b.errorUpdateCount>h.errorUpdateCount,isFetching:F,isRefetching:F&&!q,isLoadingError:k&&!z,isPaused:b.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:k&&z,isStale:gr(t,n),refetch:this.refetch,promise:l(this,Xe),isEnabled:Me(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const d=y=>{o.status==="error"?y.reject(o.error):o.data!==void 0&&y.resolve(o.data)},g=()=>{const y=U(this,Xe,o.promise=mr());d(y)},m=l(this,Xe);switch(m.status){case"pending":t.queryHash===r.queryHash&&d(m);break;case"fulfilled":(o.status==="error"||o.data!==m.value)&&g();break;case"rejected":(o.status!=="error"||o.error!==m.reason)&&g();break}}return o}updateResult(){const t=l(this,Ce),n=this.createResult(l(this,Y),this.options);if(U(this,It,l(this,Y).state),U(this,Vt,this.options),l(this,It).data!==void 0&&U(this,Xt,l(this,Y)),Bn(n,t))return;U(this,Ce,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!l(this,Zt).size)return!0;const i=new Set(a??l(this,Zt));return this.options.throwOnError&&i.add("error"),Object.keys(l(this,Ce)).some(u=>{const f=u;return l(this,Ce)[f]!==t[f]&&i.has(f)})};j(this,ee,Xs).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&j(this,ee,vr).call(this)}},Se=new WeakMap,Y=new WeakMap,cn=new WeakMap,Ce=new WeakMap,It=new WeakMap,Vt=new WeakMap,Xe=new WeakMap,dt=new WeakMap,un=new WeakMap,Gt=new WeakMap,Xt=new WeakMap,Mt=new WeakMap,kt=new WeakMap,lt=new WeakMap,Zt=new WeakMap,ee=new WeakSet,hn=function(t){j(this,ee,Br).call(this);let n=l(this,Y).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(xe)),n},Fr=function(){j(this,ee,Pr).call(this);const t=it(this.options.staleTime,l(this,Y));if(wt||l(this,Ce).isStale||!ur(t))return;const r=cs(l(this,Ce).dataUpdatedAt,t)+1;U(this,Mt,Tt.setTimeout(()=>{l(this,Ce).isStale||this.updateResult()},r))},Sr=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(l(this,Y)):this.options.refetchInterval)??!1},Dr=function(t){j(this,ee,Or).call(this),U(this,lt,t),!(wt||Me(this.options.enabled,l(this,Y))===!1||!ur(l(this,lt))||l(this,lt)===0)&&U(this,kt,Tt.setInterval(()=>{(this.options.refetchIntervalInBackground||pr.isFocused())&&j(this,ee,hn).call(this)},l(this,lt)))},vr=function(){j(this,ee,Fr).call(this),j(this,ee,Dr).call(this,j(this,ee,Sr).call(this))},Pr=function(){l(this,Mt)&&(Tt.clearTimeout(l(this,Mt)),U(this,Mt,void 0))},Or=function(){l(this,kt)&&(Tt.clearInterval(l(this,kt)),U(this,kt,void 0))},Br=function(){const t=l(this,Se).getQueryCache().build(l(this,Se),this.options);if(t===l(this,Y))return;const n=l(this,Y);U(this,Y,t),U(this,cn,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Xs=function(t){le.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(l(this,Ce))}),l(this,Se).getQueryCache().notify({query:l(this,Y),type:"observerResultsUpdated"})})},$s);function co(e,t){return Me(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function xs(e,t){return co(e,t)||e.state.data!==void 0&&Ar(e,t,t.refetchOnMount)}function Ar(e,t,n){if(Me(t.enabled,e)!==!1&&it(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&gr(e,t)}return!1}function Cs(e,t,n,r){return(e!==t||Me(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&gr(e,n)}function gr(e,t){return Me(t.enabled,e)!==!1&&e.isStaleByTime(it(t.staleTime,e))}function uo(e,t){return!Bn(e.getCurrentResult(),t)}function Ts(e){return{onFetch:(t,n)=>{var T,b,x,v,O;const r=t.options,s=(x=(b=(T=t.fetchOptions)==null?void 0:T.meta)==null?void 0:b.fetchMore)==null?void 0:x.direction,a=((v=t.state.data)==null?void 0:v.pages)||[],i=((O=t.state.data)==null?void 0:O.pageParams)||[];let u={pages:[],pageParams:[]},f=0;const h=async()=>{let I=!1;const B=q=>{Object.defineProperty(q,"signal",{enumerable:!0,get:()=>(t.signal.aborted?I=!0:t.signal.addEventListener("abort",()=>{I=!0}),t.signal)})},_=hs(t.options,t.fetchOptions),F=async(q,k,Q)=>{if(I)return Promise.reject();if(k==null&&q.pages.length)return Promise.resolve(q);const re=(()=>{const g={client:t.client,queryKey:t.queryKey,pageParam:k,direction:Q?"backward":"forward",meta:t.options.meta};return B(g),g})(),o=await _(re),{maxPages:c}=t.options,d=Q?eo:Ji;return{pages:d(q.pages,o,c),pageParams:d(q.pageParams,k,c)}};if(s&&a.length){const q=s==="backward",k=q?lo:ws,Q={pages:a,pageParams:i},z=k(r,Q);u=await F(Q,z,q)}else{const q=e??a.length;do{const k=f===0?i[0]??r.initialPageParam:ws(r,u);if(f>0&&k==null)break;u=await F(u,k),f++}while(f<q)}return u};t.options.persister?t.fetchFn=()=>{var I,B;return(B=(I=t.options).persister)==null?void 0:B.call(I,h,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=h}}}function ws(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function lo(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var fo=(Ws=class extends As{constructor(t){super();N(this,ze);N(this,dn);N(this,We);N(this,Te);N(this,_t);U(this,dn,t.client),this.mutationId=t.mutationId,U(this,Te,t.mutationCache),U(this,We,[]),this.state=t.state||Fs(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){l(this,We).includes(t)||(l(this,We).push(t),this.clearGcTimeout(),l(this,Te).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){U(this,We,l(this,We).filter(n=>n!==t)),this.scheduleGc(),l(this,Te).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){l(this,We).length||(this.state.status==="pending"?this.scheduleGc():l(this,Te).remove(this))}continue(){var t;return((t=l(this,_t))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,u,f,h,T,b,x,v,O,I,B,_,F,q,k,Q,z,re,o,c;const n=()=>{j(this,ze,yt).call(this,{type:"continue"})},r={client:l(this,dn),meta:this.options.meta,mutationKey:this.options.mutationKey};U(this,_t,ys({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(d,g)=>{j(this,ze,yt).call(this,{type:"failed",failureCount:d,error:g})},onPause:()=>{j(this,ze,yt).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>l(this,Te).canRun(this)}));const s=this.state.status==="pending",a=!l(this,_t).canStart();try{if(s)n();else{j(this,ze,yt).call(this,{type:"pending",variables:t,isPaused:a}),await((u=(i=l(this,Te).config).onMutate)==null?void 0:u.call(i,t,this,r));const g=await((h=(f=this.options).onMutate)==null?void 0:h.call(f,t,r));g!==this.state.context&&j(this,ze,yt).call(this,{type:"pending",context:g,variables:t,isPaused:a})}const d=await l(this,_t).start();return await((b=(T=l(this,Te).config).onSuccess)==null?void 0:b.call(T,d,t,this.state.context,this,r)),await((v=(x=this.options).onSuccess)==null?void 0:v.call(x,d,t,this.state.context,r)),await((I=(O=l(this,Te).config).onSettled)==null?void 0:I.call(O,d,null,this.state.variables,this.state.context,this,r)),await((_=(B=this.options).onSettled)==null?void 0:_.call(B,d,null,t,this.state.context,r)),j(this,ze,yt).call(this,{type:"success",data:d}),d}catch(d){try{throw await((q=(F=l(this,Te).config).onError)==null?void 0:q.call(F,d,t,this.state.context,this,r)),await((Q=(k=this.options).onError)==null?void 0:Q.call(k,d,t,this.state.context,r)),await((re=(z=l(this,Te).config).onSettled)==null?void 0:re.call(z,void 0,d,this.state.variables,this.state.context,this,r)),await((c=(o=this.options).onSettled)==null?void 0:c.call(o,void 0,d,t,this.state.context,r)),d}finally{j(this,ze,yt).call(this,{type:"error",error:d})}}finally{l(this,Te).runNext(this)}}},dn=new WeakMap,We=new WeakMap,Te=new WeakMap,_t=new WeakMap,ze=new WeakSet,yt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),le.batch(()=>{l(this,We).forEach(r=>{r.onMutationUpdate(t)}),l(this,Te).notify({mutation:this,type:"updated",action:t})})},Ws);function Fs(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ho=(zs=class extends Ht{constructor(t={}){super();N(this,Ze);N(this,Ke);N(this,ln);this.config=t,U(this,Ze,new Set),U(this,Ke,new Map),U(this,ln,0)}build(t,n,r){const s=new fo({client:t,mutationCache:this,mutationId:++Rn(this,ln)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){l(this,Ze).add(t);const n=kn(t);if(typeof n=="string"){const r=l(this,Ke).get(n);r?r.push(t):l(this,Ke).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(l(this,Ze).delete(t)){const n=kn(t);if(typeof n=="string"){const r=l(this,Ke).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&l(this,Ke).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=kn(t);if(typeof n=="string"){const r=l(this,Ke).get(n),s=r==null?void 0:r.find(a=>a.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=kn(t);if(typeof n=="string"){const s=(r=l(this,Ke).get(n))==null?void 0:r.find(a=>a!==t&&a.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){le.batch(()=>{l(this,Ze).forEach(t=>{this.notify({type:"removed",mutation:t})}),l(this,Ze).clear(),l(this,Ke).clear()})}getAll(){return Array.from(l(this,Ze))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>ds(n,r))}findAll(t={}){return this.getAll().filter(n=>ds(t,n))}notify(t){le.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return le.batch(()=>Promise.all(t.map(n=>n.continue().catch(xe))))}},Ze=new WeakMap,Ke=new WeakMap,ln=new WeakMap,zs);function kn(e){var t;return(t=e.options.scope)==null?void 0:t.id}var po=(Qs=class extends Ht{constructor(t,n){super();N(this,et);N(this,Ye);N(this,ft);N(this,De);N(this,Je);U(this,Ye,t),this.setOptions(n),this.bindMethods(),j(this,et,Nn).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var r;const n=this.options;this.options=l(this,Ye).defaultMutationOptions(t),Bn(this.options,n)||l(this,Ye).getMutationCache().notify({type:"observerOptionsUpdated",mutation:l(this,De),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&Ft(n.mutationKey)!==Ft(this.options.mutationKey)?this.reset():((r=l(this,De))==null?void 0:r.state.status)==="pending"&&l(this,De).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=l(this,De))==null||t.removeObserver(this)}onMutationUpdate(t){j(this,et,Nn).call(this),j(this,et,Ir).call(this,t)}getCurrentResult(){return l(this,ft)}reset(){var t;(t=l(this,De))==null||t.removeObserver(this),U(this,De,void 0),j(this,et,Nn).call(this),j(this,et,Ir).call(this)}mutate(t,n){var r;return U(this,Je,n),(r=l(this,De))==null||r.removeObserver(this),U(this,De,l(this,Ye).getMutationCache().build(l(this,Ye),this.options)),l(this,De).addObserver(this),l(this,De).execute(t)}},Ye=new WeakMap,ft=new WeakMap,De=new WeakMap,Je=new WeakMap,et=new WeakSet,Nn=function(){var n;const t=((n=l(this,De))==null?void 0:n.state)??Fs();U(this,ft,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},Ir=function(t){le.batch(()=>{var n,r,s,a,i,u,f,h;if(l(this,Je)&&this.hasListeners()){const T=l(this,ft).variables,b=l(this,ft).context,x={client:l(this,Ye),meta:this.options.meta,mutationKey:this.options.mutationKey};(t==null?void 0:t.type)==="success"?((r=(n=l(this,Je)).onSuccess)==null||r.call(n,t.data,T,b,x),(a=(s=l(this,Je)).onSettled)==null||a.call(s,t.data,null,T,b,x)):(t==null?void 0:t.type)==="error"&&((u=(i=l(this,Je)).onError)==null||u.call(i,t.error,T,b,x),(h=(f=l(this,Je)).onSettled)==null||h.call(f,void 0,t.error,T,b,x))}this.listeners.forEach(T=>{T(l(this,ft))})})},Qs),mo=(js=class extends Ht{constructor(t={}){super();N(this,Qe);this.config=t,U(this,Qe,new Map)}build(t,n,r){const s=n.queryKey,a=n.queryHash??dr(s,n);let i=this.get(a);return i||(i=new io({client:t,queryKey:s,queryHash:a,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(i)),i}add(t){l(this,Qe).has(t.queryHash)||(l(this,Qe).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=l(this,Qe).get(t.queryHash);n&&(t.destroy(),n===t&&l(this,Qe).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){le.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return l(this,Qe).get(t)}getAll(){return[...l(this,Qe).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>us(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>us(t,r)):n}notify(t){le.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){le.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){le.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Qe=new WeakMap,js),yo=(Vs=class{constructor(e={}){N(this,ae);N(this,ht);N(this,pt);N(this,Yt);N(this,Jt);N(this,mt);N(this,en);N(this,tn);U(this,ae,e.queryCache||new mo),U(this,ht,e.mutationCache||new ho),U(this,pt,e.defaultOptions||{}),U(this,Yt,new Map),U(this,Jt,new Map),U(this,mt,0)}mount(){Rn(this,mt)._++,l(this,mt)===1&&(U(this,en,pr.subscribe(async e=>{e&&(await this.resumePausedMutations(),l(this,ae).onFocus())})),U(this,tn,Mn.subscribe(async e=>{e&&(await this.resumePausedMutations(),l(this,ae).onOnline())})))}unmount(){var e,t;Rn(this,mt)._--,l(this,mt)===0&&((e=l(this,en))==null||e.call(this),U(this,en,void 0),(t=l(this,tn))==null||t.call(this),U(this,tn,void 0))}isFetching(e){return l(this,ae).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return l(this,ht).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=l(this,ae).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=l(this,ae).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(it(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return l(this,ae).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=l(this,ae).get(r.queryHash),a=s==null?void 0:s.state.data,i=Xi(t,a);if(i!==void 0)return l(this,ae).build(this,r).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return le.batch(()=>l(this,ae).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=l(this,ae).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=l(this,ae);le.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=l(this,ae);return le.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=le.batch(()=>l(this,ae).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(xe).catch(xe)}invalidateQueries(e,t={}){return le.batch(()=>(l(this,ae).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=le.batch(()=>l(this,ae).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let a=s.fetch(void 0,n);return n.throwOnError||(a=a.catch(xe)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(xe)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=l(this,ae).build(this,t);return n.isStaleByTime(it(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(xe).catch(xe)}fetchInfiniteQuery(e){return e.behavior=Ts(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(xe).catch(xe)}ensureInfiniteQueryData(e){return e.behavior=Ts(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Mn.isOnline()?l(this,ht).resumePausedMutations():Promise.resolve()}getQueryCache(){return l(this,ae)}getMutationCache(){return l(this,ht)}getDefaultOptions(){return l(this,pt)}setDefaultOptions(e){U(this,pt,e)}setQueryDefaults(e,t){l(this,Yt).set(Ft(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...l(this,Yt).values()],n={};return t.forEach(r=>{an(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){l(this,Jt).set(Ft(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...l(this,Jt).values()],n={};return t.forEach(r=>{an(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...l(this,pt).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=dr(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===In&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...l(this,pt).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){l(this,ae).clear(),l(this,ht).clear()}},ae=new WeakMap,ht=new WeakMap,pt=new WeakMap,Yt=new WeakMap,Jt=new WeakMap,mt=new WeakMap,en=new WeakMap,tn=new WeakMap,Vs),Ss=ce.createContext(void 0),$t=e=>{const t=ce.useContext(Ss);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Ao=({client:e,children:t})=>(ce.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),$.jsx(Ss.Provider,{value:e,children:t})),Ds=ce.createContext(!1),go=()=>ce.useContext(Ds);Ds.Provider;function bo(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Eo=ce.createContext(bo()),xo=()=>ce.useContext(Eo),Co=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},To=e=>{ce.useEffect(()=>{e.clearReset()},[e])},wo=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||ps(n,[e.error,r])),Fo=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},So=(e,t)=>e.isLoading&&e.isFetching&&!t,Do=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,vs=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function vo(e,t,n){var b,x,v,O,I;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=go(),s=xo(),a=$t(),i=a.defaultQueryOptions(e);(x=(b=a.getDefaultOptions().queries)==null?void 0:b._experimental_beforeQuery)==null||x.call(b,i),process.env.NODE_ENV!=="production"&&(i.queryFn||console.error(`[${i.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),i._optimisticResults=r?"isRestoring":"optimistic",Fo(i),Co(i,s),To(s);const u=!a.getQueryCache().get(i.queryHash),[f]=ce.useState(()=>new t(a,i)),h=f.getOptimisticResult(i),T=!r&&e.subscribed!==!1;if(ce.useSyncExternalStore(ce.useCallback(B=>{const _=T?f.subscribe(le.batchCalls(B)):xe;return f.updateResult(),_},[f,T]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),ce.useEffect(()=>{f.setOptions(i)},[i,f]),Do(i,h))throw vs(i,f,s);if(wo({result:h,errorResetBoundary:s,throwOnError:i.throwOnError,query:a.getQueryCache().get(i.queryHash),suspense:i.suspense}))throw h.error;if((O=(v=a.getDefaultOptions().queries)==null?void 0:v._experimental_afterQuery)==null||O.call(v,i,h),i.experimental_prefetchInRender&&!wt&&So(h,r)){const B=u?vs(i,f,s):(I=a.getQueryCache().get(i.queryHash))==null?void 0:I.promise;B==null||B.catch(xe).finally(()=>{f.updateResult()})}return i.notifyOnChangeProps?h:f.trackResult(h)}function Ps(e,t){return vo(e,oo)}function ot(e,t){const n=$t(),[r]=ce.useState(()=>new po(n,e));ce.useEffect(()=>{r.setOptions(e)},[r,e]);const s=ce.useSyncExternalStore(ce.useCallback(i=>r.subscribe(le.batchCalls(i)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=ce.useCallback((i,u)=>{r.mutate(i,u).catch(xe)},[r]);if(s.error&&ps(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:a,mutateAsync:s.mutate}}const Po=2e4,Re=()=>{const{partner:e,chainId:t,isDev:n=!1,minChunkSizeUsd:r}=K(),{data:s,error:a,isFetching:i,isLoading:u,refetch:f}=Ps({queryKey:["repermit-data",e,t,n],queryFn:()=>{if(!Gn(e).includes(t))throw new Error(`Partner "${e}" is not supported on chain ${t}`);return zr(e,t,n)},staleTime:1/0,gcTime:1/0,retry:2}),h=u||i;return S.useEffect(()=>{s&&de.onFetchedConfig(s,e,Zn(e,t),r,n)},[t,s,n,r,e]),S.useMemo(()=>({data:s,error:a,isLoading:h,refetch:f}),[s,a,h,f])},Oo=()=>{const{module:e}=K(),t=H(n=>n.state.isMarketOrder);return S.useMemo(()=>e===G.TWAP?t?X.TWAP_MARKET:X.TWAP_LIMIT:e===G.LIMIT?X.LIMIT:e===G.STOP_LOSS?t?X.STOP_LOSS_MARKET:X.STOP_LOSS_LIMIT:e===G.TAKE_PROFIT?t?X.TAKE_PROFIT_MARKET:X.TAKE_PROFIT_LIMIT:X.TWAP_MARKET,[e,t])},Os=(e,t,n,r,s,a)=>["useTwapOrderHistoryManager",e,t,n,r,s,a],_n=()=>{const{account:e,partner:t,chainId:n,isDev:r,supportLegacyOrders:s}=K(),{data:a}=Re(),i=a==null?void 0:a.order.witness.exchange.adapter;return S.useMemo(()=>Os(e,i,t,n,r,s),[e,i,t,n,r,s])},Bo=()=>{const{account:e,partner:t,chainId:n,isDev:r,supportLegacyOrders:s}=K();return S.useMemo(()=>Os(e,void 0,t,n,r,s),[e,t,n,r,s])},Io=()=>{const e=$t(),{account:t}=K(),n=_n();return S.useCallback(r=>{e.setQueryData(n,s=>s?s!=null&&s.some(a=>a.id===r.id)?s:[r,...s]:[r])},[e,n,t])},Mo=()=>{const e=$t(),t=_n();return S.useCallback((n,r)=>{e.setQueryData(t,s=>s==null?void 0:s.map(a=>a.id===n?{...a,status:r}:a))},[e,t])},ko=()=>{const{callbacks:e}=K(),t=$t(),n=_n();return S.useCallback(r=>{var u;const s=t.getQueryData(n);let a=!1;const i=[];s&&s.filter(f=>f.version===2).forEach(f=>{var T;const h=r.find(b=>b.id===f.id);h&&h.progress!==f.progress&&(a=!0,i.push(h),h.status===ue.Completed&&((T=e==null?void 0:e.onOrderFilled)==null||T.call(e,h)))}),a&&((u=e==null?void 0:e.onOrdersProgressUpdate)==null||u.call(e,i))},[t,n,e])},_o=(e,t)=>{const n=new Set(e.map(s=>s.id)),r=(t==null?void 0:t.filter(s=>s.version===1&&!n.has(s.id)))??[];return[...e,...r].sort((s,a)=>a.createdAt-s.createdAt)},br=()=>{const{account:e,partner:t,chainId:n,isDev:r,supportLegacyOrders:s}=K(),{data:a}=Re(),i=$t(),u=S.useMemo(()=>s?Zn(t,n):void 0,[n,t,s]),f=_n(),h=Bo(),T=ko();return Ps({refetchInterval:Po,refetchOnWindowFocus:!0,retry:!1,gcTime:1/0,staleTime:1/0,queryKey:f,enabled:!!(e&&n),queryFn:async({signal:x})=>{if(!e||!n)return[];const v=i.getQueryData(f)??i.getQueryData(h),O=s&&!v,I=await gi({signal:x,chainId:n,exchange:a==null?void 0:a.order.witness.exchange.adapter,partner:t,twapConfig:u,account:e,isDev:r,includeV1GraphOrders:O,includeV2Orders:!!a});return T(I),!s||O?I:_o(I,v)}})},Uo=(e,t,n)=>S.useMemo(()=>{if(!(!e||!t||!n||n!=null&&n.isMarketPrice))return qr(n,e==null?void 0:e.decimals,t==null?void 0:t.decimals)},[n,e,t]),Lo=(e,t,n)=>S.useMemo(()=>{if(!(!e||!t||!n))return Hr(n,e.decimals,t.decimals)},[n,e,t]),Ro=(e,t,n)=>S.useMemo(()=>{if(!(!e||!t||!n))return Xn(n.srcAmountFilled,n.dstAmountFilled,e.decimals,t.decimals)},[n,e,t]),Un=(e,t)=>[...e.filter(r=>r.status===t)].sort((r,s)=>s.createdAt-r.createdAt),No=()=>{const{data:e,isLoading:t,refetch:n,isRefetching:r}=br(),s=S.useCallback(()=>n().then(a=>a.data),[n]);return S.useMemo(()=>({orders:{all:e??[],open:Un(e??[],ue.Open),completed:Un(e??[],ue.Completed),cancelled:Un(e??[],ue.Cancelled),expired:Un(e??[],ue.Expired)},isLoading:t,isRefetching:r,refetchOrders:s}),[e,t,r,s])},Er=()=>{const e=H(n=>n.state.currentTime),t=ir().duration;return S.useMemo(()=>Ma(e,t),[e,t])},Bs=()=>{const{srcToken:e,dstToken:t,account:n,chainId:r,slippage:s,module:a}=K(),i=H(F=>F.state.currentTime),{amount:u}=at(),{amountPerTrade:f,totalTrades:h}=He(),T=Er(),{amount:b}=cr(),{pricePerChunk:x}=Ct(),{milliseconds:v}=qt(),{data:O,error:I,isLoading:B}=Re(),_=S.useMemo(()=>{if(O)return Qr({chainId:r,srcTokenAddress:(e==null?void 0:e.address)||"",dstTokenAddress:(t==null?void 0:t.address)||"",totalSrcAmount:u,currentTimeMillis:i,deadlineMillis:T,fillDelayMillis:v,totalTrades:h,slippageBps:s*100,swapperAddress:n,srcAmountPerTrade:f,minDstAmountPerTrade:b,triggerAmountPerTrade:x,permitData:O,module:a})},[O,e,t,n,r,i,s,a,u,f,h,T,v,b,x]);return S.useMemo(()=>({data:_,error:I,isLoading:B}),[_,I,B])};function Ko(e){const t=e.slice(2);if(t.length===128){const a=`0x${t.slice(0,64)}`,i=parseInt(t.charAt(64),16),u=(i>>3)+27,f=`0x${(i&7).toString(16)}${t.slice(65,128)}`;return{r:a,s:f,v:u}}const n=`0x${t.slice(0,64)}`,r=`0x${t.slice(64,128)}`,s=parseInt(t.slice(128,130),16);return{r:n,s:r,v:s}}const qo=()=>{var a;const{account:e,walletInteractions:t,callbacks:n,chainId:r}=K(),s=(a=Sn())==null?void 0:a.wToken;return ot({mutationFn:async({onHash:i,srcAmountWei:u})=>{var h,T;if(!e)throw new Error("missing account");if(!t)throw new Error("missing walletInteractions");if(!s)throw new Error("tokenAddress is not defined");de.onWrapRequest();const f=await t.wrapNativeToken(u);return(h=n==null?void 0:n.onWrapRequest)==null||h.call(n),i==null||i(f),de.onWrapSuccess(f),(T=n==null?void 0:n.onWrapSuccess)==null||T.call(n,{txHash:f,explorerUrl:Nt(f,r),amount:ge(u,s.decimals)}),f},onError:i=>{throw de.onWrapError(i),i}})},Is=()=>{const{account:e,walletInteractions:t,chainId:n,callbacks:r,isDev:s}=K(),{data:a,error:i,isLoading:u}=Bs(),{refetch:f}=br(),h=Io();return ot({mutationFn:async()=>{var F,q,k,Q;if(!e)throw new Error("missing account");if(!t)throw new Error("missing walletInteractions");if(!n)throw new Error("missing chainId");if(i)throw i;if(u||!a)throw new Error("RePermit data is unavailable");const{order:T,domain:b,types:x,primaryType:v}=a;de.onSignOrderRequest(T);let O;try{O=await t.signOrder({domain:b,types:x,primaryType:v,message:T,account:e})}catch(z){throw(F=r==null?void 0:r.onSignOrderError)==null||F.call(r,z),de.onSignOrderError(z),z}de.onSignOrderSuccess(O),(q=r==null?void 0:r.onSignOrderSuccess)==null||q.call(r,O);const I=Ko(O),B={v:`0x${I.v.toString(16)}`,r:I.r,s:I.s};(k=r==null?void 0:r.onSignOrderRequest)==null||k.call(r);const _=await Vr(T,B,s);return(Q=r==null?void 0:r.onOrderCreated)==null||Q.call(r,_),h(_),f(),_}})},Ms=()=>{const{account:e,walletInteractions:t}=K(),{data:n}=Re();return ot({mutationFn:async({tokenAddress:r,srcAmountWei:s})=>{if(!t)throw new Error("missing walletInteractions");if(!e)throw new Error("missing account");if(!n)throw new Error("RePermit data is unavailable");const a=await t.getAllowance({tokenAddress:r,spenderAddress:n.domain.verifyingContract}),i=D(a||"0").lt(D(s).toString());return{allowance:a,approvalRequired:i}}})},Ho=()=>{const{account:e,walletInteractions:t,chainId:n,callbacks:r}=K(),{data:s}=Re(),{mutateAsync:a}=Ms();return ot({onError:i=>{de.onApproveError(i)},mutationFn:async({token:i,onHash:u,srcAmountWei:f})=>{var b,x;if(!e)throw new Error("missing account");if(!t)throw new Error("missing walletInteractions");if(!s)throw new Error("RePermit data is unavailable");de.onApproveRequest();const h=await t.approveToken({tokenAddress:i.address,amount:f,spenderAddress:s.domain.verifyingContract});if(!h)throw new Error("failed to approve token");(b=r==null?void 0:r.onApproveRequest)==null||b.call(r),u(h);let T=!1;for(let v=0;v<3;v++){const{approvalRequired:O}=await a({tokenAddress:i.address,srcAmountWei:f});if(!O){T=!0;break}v<2&&await new Promise(I=>setTimeout(I,3e3))}if(!T)throw new Error(`Insufficient ${i.symbol} allowance to perform the swap. Please approve the token first.`);return de.onApproveSuccess(h),(x=r==null?void 0:r.onApproveSuccess)==null||x.call(r,{txHash:h,explorerUrl:Nt(h,n),token:i,amount:ge(f,i.decimals)}),h}})},$o=()=>{const{account:e,chainId:t,srcToken:n,dstToken:r,module:s,slippage:a}=K(),i=Ct(),u=at().amount,f=He().amountPerTrade,h=Er(),T=He().totalTrades,b=qt().fillDelay,x=cr().amount,v=H(O=>O.state.isMarketOrder);return ot({mutationFn:async()=>{de.onRequestOrder({account:e,chainId:t,module:s,srcToken:n,dstToken:r,fromTokenAmount:u,srcChunkAmount:f,triggerPricePerTrade:i.pricePerChunk,deadline:h,fillDelay:b.unit*b.value,minDstAmountOutPerTrade:x,slippage:a,isMarketOrder:v||!1,chunksAmount:T})}})};function Wo(e){const t=e.message,n=t.match(/,\s*code\s*:\s*(\d+)/i);return{message:t.replace(/^error\s*:/i,"").replace(/,\s*code\s*:\s*\d+/i,"").trim()||"",code:n?Number(n[1]):0}}const ks=()=>{const{srcToken:e,dstToken:t,chainId:n,callbacks:r,marketPrice:s}=K(),a=Ho().mutateAsync,i=qo().mutateAsync,u=Is().mutateAsync,{mutateAsync:f}=Ms(),{update:h}=Kt(),{amount:T}=at(),b=$o().mutate,{isLoading:x}=Re();return ot({mutationFn:async()=>{var I,B;const v=H.getState().state.swapExecutions[H.getState().state.swapExecutionIndex];if(x||(v==null?void 0:v.status)===Ae.LOADING||v!=null&&v.allowanceLoading)return;const O=Rt((e==null?void 0:e.address)||" ");try{if(!e)throw new Error("missing srcToken");if(!t)throw new Error("missing dstToken");if(!n)throw new Error("missing chainId");const _=ts(e,n);h({allowanceLoading:!0,wrapTxHash:void 0,approveTxHash:void 0,acceptedMarketPrice:s,acceptedSrcAmount:T,srcToken:e,dstToken:t,pendingSteps:[]});const{approvalRequired:F}=await f({tokenAddress:_.address,srcAmountWei:T});let q=0,k=1;O&&k++,F&&k++,h({totalSteps:k,stepIndex:q,allowanceLoading:!1,hasApproval:!F,status:Ae.LOADING}),b();let Q=[];O&&Q.push(rt.WRAP),F&&Q.push(rt.APPROVE),Q.push(rt.CREATE),h({pendingSteps:Q}),O&&(h({step:rt.WRAP}),await i({onHash:re=>h({wrapTxHash:re}),srcAmountWei:T}),q++,h({stepIndex:q})),F&&(h({step:rt.APPROVE}),await a({token:_,onHash:re=>h({approveTxHash:re}),srcAmountWei:T}),q++,h({stepIndex:q})),h({step:rt.CREATE});const z=await u();return h({status:Ae.SUCCESS,orderId:z.id}),z}catch(_){if(tr(_))(I=r==null?void 0:r.onSubmitOrderRejected)==null||I.call(r),h({step:void 0,status:void 0,stepIndex:void 0,allowanceLoading:!1,error:_});else{const F=Wo(_);(B=r==null?void 0:r.onSubmitOrderFailed)==null||B.call(r,F),h({status:Ae.FAILED,allowanceLoading:!1,parsedError:F,error:_})}throw _}}})},zo=()=>{const e=Kt(),{srcToken:t,dstToken:n}=K(),{isLoading:r}=Re(),s=ks(),a=H(T=>T.resetState),i=S.useCallback(()=>s.mutateAsync(),[s]),{update:u,resetSwap:f,...h}=e;return S.useMemo(()=>({status:h.status,parsedError:h.parsedError,error:h.error,step:h.step,stepIndex:h.stepIndex,approveTxHash:h.approveTxHash,wrapTxHash:h.wrapTxHash,totalSteps:h.totalSteps,pendingSteps:h.pendingSteps,srcToken:t,dstToken:n,onSubmit:i,resetState:a,resetCurrentSwap:f,isLoading:(e==null?void 0:e.status)===Ae.LOADING,isSuccess:(e==null?void 0:e.status)===Ae.SUCCESS,isFailed:(e==null?void 0:e.status)===Ae.FAILED,confirmButtonLoading:h.allowanceLoading||r}),[i,h,a,f,t,n,r])},Qo=()=>{const{marketPrice:e,srcToken:t,dstToken:n,marketPriceLoading:r,srcBalance:s,srcUsd1Token:a,noLiquidity:i,typedInputAmount:u}=K(),{error:f,isLoading:h,refetch:T}=Re(),b=r||D(a||"0").isZero()||s===void 0||D(e||"0").isZero(),x=h||!!(t&&n&&u&&b),O=!!(os()||f||i||x||D(u||"0").isZero()||!t||!n);return S.useMemo(()=>({disabled:O,error:f,loading:x,retry:T}),[O,x,f,T])},jo=()=>{const{srcUsd1Token:e,dstUsd1Token:t}=K(),n=at().amountUI,r=On().amountUI,s=qe(n,e),a=qe(r,t);return{srcAmountUsd:s,dstAmountUsd:a}},Vo=()=>{const{fees:e,dstToken:t,dstUsd1Token:n}=K(),{amountUI:r}=On(),s=S.useMemo(()=>!e||!r?"":D(r).multipliedBy(e).dividedBy(100).toFixed(),[r,e]),a=ar((t==null?void 0:t.decimals)||0,s);return{amountUI:s,amount:a,percent:e,usd:qe(s,n)}},Go=e=>{const t=S.useMemo(()=>!e.minDestAmountPerTrade||!e.totalTrades?"":D(e.minDestAmountPerTrade).multipliedBy(e.totalTrades).decimalPlaces(0).toFixed(),[e.minDestAmountPerTrade,e.totalTrades]),n=S.useMemo(()=>!e.minDestAmountPerTradeUI||!e.totalTrades?"":D(e.minDestAmountPerTradeUI).multipliedBy(e.totalTrades).toFixed(),[e.minDestAmountPerTradeUI,e.totalTrades]),r=S.useMemo(()=>!e.minDestAmountPerTradeUsd||!e.totalTrades?"":D(e.minDestAmountPerTradeUsd).multipliedBy(e.totalTrades).decimalPlaces(2).toFixed(),[e.minDestAmountPerTradeUsd,e.totalTrades]);return S.useMemo(()=>({srcToken:e.srcToken,dstToken:e.dstToken,orderType:e.orderType,createdAt:e.createdAt||0,deadline:e.deadline||0,totalTrades:e.totalTrades||0,tradeInterval:e.tradeInterval||0,recipient:e.account||"",srcAmount:e.srcAmount||"",srcAmountUI:e.srcAmountUI||"",srcAmountUsd:e.srcAmountUsd||"",dstAmount:e.dstAmount||"",dstAmountUI:e.dstAmountUI||"",dstAmountUsd:e.dstAmountUsd||"",limitPrice:e.limitPrice||"",limitPriceUI:e.limitPriceUI||"",limitPriceUsd:e.limitPriceUsd||"",sizePerTrade:e.srcAmountPerTrade||"",sizePerTradeUI:e.srcAmountPerTradeUI||"",sizePerTradeUsd:e.srcAmountPerTradeUsd,minDestAmountPerTrade:e.minDestAmountPerTrade||"",minDestAmountPerTradeUI:e.minDestAmountPerTradeUI||"",minDestAmountPerTradeUsd:e.minDestAmountPerTradeUsd,dstMinAmount:t,dstMinAmountUI:n,dstMinAmountUsd:r,triggerPrice:e.triggerPrice||"",triggerPriceUI:e.triggerPriceUI||"",triggerPriceUsd:e.triggerPriceUsd}),[e.srcToken,e.dstToken,e.orderType,e.createdAt,e.deadline,e.totalTrades,e.tradeInterval,e.account,e.srcAmount,e.srcAmountUI,e.srcAmountUsd,e.dstAmount,e.dstAmountUI,e.dstAmountUsd,e.limitPrice,e.limitPriceUI,e.limitPriceUsd,e.srcAmountPerTrade,e.srcAmountPerTradeUI,e.srcAmountPerTradeUsd,e.minDestAmountPerTrade,e.minDestAmountPerTradeUI,e.minDestAmountPerTradeUsd,t,n,r,e.triggerPrice,e.triggerPriceUI,e.triggerPriceUsd])},Xo=()=>{const{srcToken:e,dstToken:t,account:n,marketPrice:r}=K(),{amount:s}=at(),{amount:a,amountUI:i,usd:u}=Pn(),{amountPerTrade:f,amountPerTradeUI:h,amountPerTradeUsd:T,totalTrades:b}=He(),x=Er(),{amount:v,amountUI:O,usd:I}=cr(),{amountUI:B,amount:_,usd:F}=Ct(),{milliseconds:q}=qt(),{amount:k,amountUI:Q}=On(),{srcAmountUsd:z,dstAmountUsd:re}=jo(),{amount:o,amountUI:c,percent:d,usd:g}=Vo(),{data:m}=Bs(),{data:y}=Re(),w=H(Z=>Z.state.isMarketOrder),p=H(Z=>Z.state.currentTime),A=Kt(),C=Oo(),E=A.acceptedSrcAmount||s,P=ge(r,(t==null?void 0:t.decimals)||0),L=S.useMemo(()=>C===X.TAKE_PROFIT_MARKET||C===X.TAKE_PROFIT_LIMIT||C===X.STOP_LOSS_LIMIT||C===X.STOP_LOSS_MARKET,[C]),R=Go({srcToken:e,dstToken:t,account:n,orderType:C,createdAt:p,deadline:x,totalTrades:b,tradeInterval:q,srcAmount:E,srcAmountUI:ge(E,(e==null?void 0:e.decimals)||0),srcAmountUsd:z,dstAmount:k,dstAmountUI:Q,dstAmountUsd:re,limitPrice:w?void 0:a,limitPriceUI:w?void 0:i,limitPriceUsd:w?void 0:u,srcAmountPerTrade:f,srcAmountPerTradeUI:h,srcAmountPerTradeUsd:T,minDestAmountPerTrade:v,minDestAmountPerTradeUI:O,minDestAmountPerTradeUsd:I,triggerPrice:_,triggerPriceUI:B,triggerPriceUsd:F});return S.useMemo(()=>({...R,feesAmountUI:c,feesAmount:o,feesUsd:g||"",feesPercentage:d,rePermitData:m,isTriggerPrice:L,isMarketOrder:w,marketPrice:r,marketPriceUi:P,spender:(y==null?void 0:y.domain.verifyingContract)||""}),[R,c,o,g,d,m,L,w,r,P,y])},Zo=()=>{const{supportedChains:e}=K();return S.useMemo(()=>e,[e])},Yo=60,_s=()=>{const{refetch:e}=br();return ot({mutationFn:async t=>{var n;for(let r=0;r<Yo;r++){const s=(n=await e())==null?void 0:n.data;if(!s)throw new Error("orders not found");const a=s.find(i=>i.id===t);if((a==null?void 0:a.status)===ue.Cancelled)return;await new Promise(i=>setTimeout(i,1e3))}throw new Error("Timed out waiting for order cancellation to be confirmed")}})},Jo=()=>{const e=H(n=>n.updateState);return{cancelOrders:H(n=>n.state.cancelOrders),setCancelOrder:(n,r)=>{const s=H.getState().state.cancelOrders;e({cancelOrders:{...s,[n]:r}})},clearCancelOrder:n=>{const r=H.getState().state.cancelOrders,{[n]:s,...a}=r;e({cancelOrders:a})}}},ec=e=>{const{account:t,walletInteractions:n,callbacks:r,chainId:s}=K(),{data:a,error:i,isLoading:u}=Re(),f=_s().mutateAsync,h=Mo(),{cancelOrders:T,setCancelOrder:b,clearCancelOrder:x}=Jo(),{mutateAsync:v}=ot({mutationFn:async()=>{var _,F,q;if(!t||!n)throw new Error("missing required parameters");if(!e)throw new Error("order is required");if(e.version!==1&&!a)throw new Error("RePermit data is unavailable");const B=e.id;try{(_=r==null?void 0:r.onCancelOrderRequest)==null||_.call(r,e),b(B,{status:Ae.LOADING}),de.onCancelOrderRequest([e.version===1?e.id.toString():e.hash],e.version);const k=await n.cancelOrder({order:e,contractAddress:e.version===1?e.twapAddress:a.domain.verifyingContract,args:e.version===1?[e.id]:[[e.repermitDigest]],abi:e.version===1?Js:Ys});if(!k)throw new Error("failed to cancel order");if(de.onCancelOrderSuccess(k),h(e.id,ue.Cancelled),e.version!==1)try{await f(e.id)}catch(Q){console.warn("cancel status sync lagging",Q)}return(F=r==null?void 0:r.onCancelOrderSuccess)==null||F.call(r,{order:e.version===1?{...e,status:ue.Cancelled}:e,txHash:k,explorerUrl:Nt(k,s)}),b(B,{status:Ae.SUCCESS,txHash:k}),k}catch(k){console.error("cancel order error",k),(q=r==null?void 0:r.onCancelOrderFailed)==null||q.call(r,k),tr(k)?x(B):(b(B,{status:Ae.FAILED,error:k.message}),de.onCancelOrderError(k))}}}),O=S.useMemo(()=>{const B=T[(e==null?void 0:e.id)||""],_=!!(e&&e.version!==1);return{isLoading:(B==null?void 0:B.status)===Ae.LOADING,disabled:_&&(u||!!i||!a),isSuccess:(B==null?void 0:B.status)===Ae.SUCCESS,isError:(B==null?void 0:B.status)===Ae.FAILED,error:B==null?void 0:B.error,txHash:B==null?void 0:B.txHash}},[T,e,a,i,u]),I=S.useCallback(async()=>v(),[v]);return S.useMemo(()=>({cancelOrder:I,...O}),[I,O])},Us=S.createContext(null),tc=({children:e})=>{const t=Ii(),n=Ui(),r=ki(),s=Hi(),a=$i(),i=Dn(),u=Wi(),f=zi(),h=os(),T=Qo(),b=Xo(),x=No(),v=zo(),O=Zo(),I=_s(),{module:B}=K(),_=S.useMemo(()=>({tradesAmountPanel:t,durationPanel:n,fillDelayPanel:r,limitPricePanel:s,triggerPricePanel:a,pricePanel:i,dstTokenPanel:u,disclaimerPanel:f,inputError:h,submitOrderButton:T,derivedFormData:b,orderHistoryPanel:x,orderExecutionPanel:v,supportedChains:O,refetchUntilStatusSynced:I,module:B}),[t,n,r,s,a,i,u,f,h,T,b,x,v,O,I,B]);return $.jsx(Us.Provider,{value:_,children:e})},nc=()=>{const e=S.useContext(Us);if(e===null)throw new Error("useSpot must be used within SpotProvider");return e},rc=S.createContext(null),xr={didCatch:!1,error:null};class sc extends S.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=xr}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:a,reason:"imperative-api"}),this.setState(xr)}}componentDidCatch(t,n){var r,s;(r=(s=this.props).onError)===null||r===void 0||r.call(s,t,n)}componentDidUpdate(t,n){const{didCatch:r}=this.state,{resetKeys:s}=this.props;if(r&&n.error!==null&&ac(t.resetKeys,s)){var a,i;(a=(i=this.props).onReset)===null||a===void 0||a.call(i,{next:s,prev:t.resetKeys,reason:"keys"}),this.setState(xr)}}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:s}=this.props,{didCatch:a,error:i}=this.state;let u=t;if(a){const f={error:i,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")u=n(f);else if(r)u=S.createElement(r,f);else if(s!==void 0)u=s;else throw i}return S.createElement(rc.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},u)}}function ac(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}const ic=()=>$.jsx("div",{className:"twap-error-fallback",children:$.jsx("p",{style:{fontSize:20,fontWeight:600,textAlign:"center",width:"100%",marginTop:40},children:"Something went wrong"})});function oc({children:e}){return $.jsx(sc,{FallbackComponent:ic,onError:t=>de.onCrash(t),children:$.jsx($.Fragment,{children:e})})}const Ls=S.createContext(null),cc=new yo({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),uc=e=>{var x,v,O;const t=H(I=>I.updateState),n=H(I=>I.state.isMarketOrder);S.useEffect(()=>{const I=setInterval(()=>{t({currentTime:Date.now()})},6e4);return()=>clearInterval(I)},[t]);const r=(x=e.overrides)==null?void 0:x.state,{isMarketOrder:s,chunks:a,fillDelay:i,duration:u,limitPrice:f,triggerPrice:h,triggerPricePercent:T,limitPricePercent:b}=r??{};return S.useEffect(()=>{s!==void 0&&t({isMarketOrder:s}),t({typedChunks:a,typedFillDelay:i,typedDuration:u,typedLimitPrice:f,typedTriggerPrice:h,triggerPricePercent:T,limitPricePercent:b})},[t,s,a,i,u,f,h,T,b]),S.useEffect(()=>{var I,B,_,F;t({typedLimitPrice:(B=(I=e.overrides)==null?void 0:I.state)==null?void 0:B.limitPrice,typedTriggerPrice:(F=(_=e.overrides)==null?void 0:_.state)==null?void 0:F.triggerPrice,triggerPricePercent:void 0,limitPricePercent:void 0})},[(v=e.srcToken)==null?void 0:v.address,(O=e.dstToken)==null?void 0:O.address]),S.useEffect(()=>{e.module===G.LIMIT&&t({isMarketOrder:!1})},[e.module]),S.useEffect(()=>{n&&t({isInvertedTrade:!1})},[n]),S.useEffect(()=>{t({typedChunks:void 0})},[e.typedInputAmount]),null},dc=({marketReferencePrice:e,srcToken:t,dstToken:n,chainId:r,typedInputAmount:s})=>S.useMemo(()=>{if(rr(t,n,r)||sr(t,n,r))return{isLoading:!1,noLiquidity:!1,value:st(s||"0",t==null?void 0:t.decimals)};if(D(e.value||0).isZero()||D(s||0).isZero())return e;const a=D(e.value||0).dividedBy(s||0).toFixed();return{...e,value:a}},[e,s,t,n,r]),lc=e=>{const t=Kt(),n=S.useMemo(()=>Gn(e.partner),[e.partner]),r=S.useMemo(()=>{const u=n[0];return e.chainId&&n.includes(e.chainId)?e.chainId:u},[e.chainId,n]),s=dc(e),a=S.useMemo(()=>Wr(e.minChunkSizeUsd),[e.minChunkSizeUsd]);S.useEffect(()=>{de.init(e.partner,a,r,e.appId)},[e.partner,r,a,e.appId]);const i=S.useMemo(()=>({typedInputAmount:e.typedInputAmount,minChunkSizeUsd:a,account:e.account,walletInteractions:e.walletInteractions,marketPrice:t.acceptedMarketPrice||s.value,marketPriceLoading:!t.acceptedMarketPrice&&s.isLoading,noLiquidity:!t.acceptedMarketPrice&&s.noLiquidity,slippage:e.priceProtection,supportedChains:n,chainId:r,partner:e.partner,module:e.module,fees:e.fees||0,overrides:e.overrides,callbacks:e.callbacks,srcUsd1Token:e.srcUsd1Token,dstUsd1Token:e.dstUsd1Token,srcBalance:e.srcBalance,dstBalance:e.dstBalance,srcToken:t.srcToken||e.srcToken,dstToken:t.dstToken||e.dstToken,isDev:e.isDev,supportLegacyOrders:e.supportLegacyOrders??!1}),[e.typedInputAmount,a,e.account,e.walletInteractions,t.acceptedMarketPrice,t.srcToken,t.dstToken,s.value,s.isLoading,s.noLiquidity,e.priceProtection,n,r,e.partner,e.module,e.fees,e.overrides,e.callbacks,e.srcUsd1Token,e.dstUsd1Token,e.srcBalance,e.dstBalance,e.srcToken,e.dstToken,e.isDev,e.supportLegacyOrders]);return $.jsxs(Ls.Provider,{value:i,children:[$.jsx(uc,{...e}),$.jsx(tc,{children:$.jsx(oc,{children:e.children})})]})},fc=e=>$.jsx(Ao,{client:cc,children:$.jsx(lc,{...e})}),K=()=>{const e=S.useContext(Ls);if(e===null)throw new Error("useSpotContext must be used within SpotProvider");return e},hc=(e,t,n)=>{const r=Sn();return S.useMemo(()=>e==null?void 0:e.map(s=>({rawFill:s,srcToken:t,dstToken:n,srcAmount:ge(s.inAmount,t==null?void 0:t.decimals),dstAmount:ge(s.outAmount,n==null?void 0:n.decimals),timestamp:s.timestamp,txHash:s.txHash,explorerUrl:Nt(s.txHash,r==null?void 0:r.id),executionRate:Xn(s.inAmount,s.outAmount,t==null?void 0:t.decimals,n==null?void 0:n.decimals)})).filter(s=>s.srcToken!==void 0&&s.dstToken!==void 0),[e,t,n,r])},pc=(e,t,n)=>{const{chainId:r,partner:s}=K(),a=Uo(t,n,e),i=Lo(t,n,e),u=Ro(t,n,e),f=S.useMemo(()=>e?e.version===2?e.fillDelay:Kr(e,Zn(s,r)):0,[e,s,r]),h=hc(e==null?void 0:e.fills,t,n)??[];return S.useMemo(()=>{if(e!=null&&e.id)return{original:e,fills:h,srcToken:t,dstToken:n,orderType:e.type,createdAt:e.createdAt,deadline:e.deadline||0,totalTrades:e.totalTradesAmount||0,tradeInterval:f,recipient:e.maker||"",srcAmount:e.srcAmount||"",srcAmountUI:ge(e.srcAmount,t==null?void 0:t.decimals),limitPrice:st(a,n==null?void 0:n.decimals),limitPriceUI:a||"",sizePerTrade:e.srcAmountPerTrade||"",sizePerTradeUI:ge(e.srcAmountPerTrade,t==null?void 0:t.decimals),minDestAmountPerTrade:e.dstMinAmountPerTrade||"",minDestAmountPerTradeUI:ge(e.dstMinAmountPerTrade,n==null?void 0:n.decimals),dstMinAmount:e.dstMinAmountTotal,dstMinAmountUI:ge(e.dstMinAmountTotal,n==null?void 0:n.decimals),triggerPrice:st(i,n==null?void 0:n.decimals),triggerPriceUI:i||"",id:e.id,amountInFilled:e.srcAmountFilled,amountInFilledUI:ge(e.srcAmountFilled,t==null?void 0:t.decimals),amountOutFilled:e.dstAmountFilled,amountOutFilledUI:ge(e.dstAmountFilled,n==null?void 0:n.decimals),progress:e.progress,executionPrice:st(u,n==null?void 0:n.decimals),executionPriceUI:u,version:e.version}},[e,h,t,n,f,a,i,u])};Va(bi.version),M.DISCLAIMER_URL=ha,M.Disclaimer=sn,M.InputErrors=me,M.Module=G,M.ORBS_LOGO=la,M.ORBS_SLTP_FAQ_URL=da,M.ORBS_TWAP_FAQ_URL=ua,M.ORBS_WEBSITE_URL=fa,M.OrderFilter=Mr,M.OrderStatus=ue,M.OrderType=X,M.Partners=Pe,M.SPOT_VERSION=yn,M.SpotProvider=fc,M.Steps=rt,M.SwapStatus=Ae,M.TimeUnit=ve,M.buildRePermitOrderData=Qr,M.ensureWrappedToken=ts,M.eqIgnoreCase=gt,M.fetchRePermitData=zr,M.getExplorerUrl=Nt,M.getMinChunkSizeUsd=Wr,M.getNetwork=Et,M.getOrderExecutionRate=Xn,M.getOrderFillDelayMillis=Kr,M.getOrderLimitPriceRate=qr,M.getOrderType=Fi,M.getPartnerChains=Gn,M.getPartners=$r,M.getTriggerPriceRate=Hr,M.isNativeAddress=Rt,M.isTxRejected=tr,M.millisToDays=nr,M.millisToMinutes=Fn,M.networks=ye,M.parseError=wi,M.shouldUnwrapOnly=sr,M.shouldWrapOnly=rr,M.submitOrder=Vr,M.toAmountUi=ge,M.toAmountWei=st,M.useAmountUi=xt,M.useCancelOrder=ec,M.useDerivedHistoryOrder=pc,M.useExplorerLink=Si,M.useNetwork=Sn,M.useRePermitData=Re,M.useSignOrder=Is,M.useSpot=nc,M.useSubmitOrder=ks,M.useSwapExecution=Kt,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})}));