@orbs-network/spot-react 0.0.73 → 0.0.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ccip-DcFmOBrh.js → ccip-DRnK5YPv.js} +1 -1
- package/dist/{index-B6DnOdNS.js → index-BwhhYdOZ.js} +6 -4
- package/dist/spot-react/package.json.d.ts +1 -1
- package/dist/spot-react/src/hooks/order-hooks.d.ts.map +1 -1
- package/dist/spot-react.js +1 -1
- package/dist/spot-react.umd.cjs +3 -3
- package/package.json +2 -2
package/dist/spot-react.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(R,B){typeof exports=="object"&&typeof module<"u"?B(exports,require("react/jsx-runtime"),require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom"],B):(R=typeof globalThis<"u"?globalThis:R||self,B(R.SpotReact={},R.jsxRuntime,R.React,R.ReactDOM))})(this,(function(R,B,M,As){"use strict";var NW=Object.defineProperty;var _5=R=>{throw TypeError(R)};var LW=(R,B,M)=>B in R?NW(R,B,{enumerable:!0,configurable:!0,writable:!0,value:M}):R[B]=M;var Ku=(R,B,M)=>LW(R,typeof B!="symbol"?B+"":B,M),Ch=(R,B,M)=>B.has(R)||_5("Cannot "+M);var N=(R,B,M)=>(Ch(R,B,"read from private field"),M?M.call(R):B.get(R)),le=(R,B,M)=>B.has(R)?_5("Cannot add the same private member more than once"):B instanceof WeakSet?B.add(R):B.set(R,M),J=(R,B,M,As)=>(Ch(R,B,"write to private field"),As?As.call(R,M):B.set(R,M),M),Se=(R,B,M)=>(Ch(R,B,"access private method"),M);var Yu=(R,B,M,As)=>({set _(Xu){J(R,B,Xu,M)},get _(){return N(R,B,As)}});var pn,pa,g5,fa,ys,xo,x5,wo,gs,vo,w5,ha,v5,ma,Eo,Ir,ba,Bt,vc,ya,Kr,qn,E5,sr,Oe,Ec,qt,ga,ko,$n,xs,kc,Co,To,xa,wa,ws,Ao,Ve,Ac,Th,Ah,Sh,Ph,Ih,Bh,Fh,M5,k5,Cc,fn,Kt,va,hn,Ts,C5,Gn,Yr,Tc,T5,jn,vs,ar,Vn,Wn,Zu,Uh,A5,mn,S5,ft,Es,ks,So,Po,Cs,Io,Bo,P5;function Xu(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const xt=Xu(M),Dt={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:""},Chronos:{chainName:"arb",chainId:42161,twapVersion:4,twapAddress:"0x0B94dcC0EA2d1ee33Ab064DaC252de980a941eF3",lensAddress:"0x549e1fc9a47FCc0C5C2EbdfF31254cc49fF7164e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"Chronos",partner:"Orbs:TWAP:Chronos",exchangeAddress:"0x0178e50adAF3b925F27aC518FCd952CE7F9A3B36",exchangeType:"ExchangeV2",pathfinderKey:"Chronos Stable,Chronos Volatile,Chronos V3"},BaseSwap:{chainName:"base",chainId:8453,twapVersion:4,twapAddress:"0xc918bdC47264687796Cd54FE362FaC4f8b99Eb55",lensAddress:"0x6313188c1909b161074D62E43105faC9B756A23e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"BaseSwap",partner:"Orbs:TWAP:BaseSwap",exchangeAddress:"0xAca3155c17530C4aA96746F226fcC049658490d2",exchangeType:"ExchangeV2",pathfinderKey:"BaseSwap,BaseSwapX"},Arbidex:{chainName:"arb",chainId:42161,twapVersion:4,twapAddress:"0x0B94dcC0EA2d1ee33Ab064DaC252de980a941eF3",lensAddress:"0x549e1fc9a47FCc0C5C2EbdfF31254cc49fF7164e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"Arbidex",partner:"Orbs:TWAP:Arbidex",exchangeAddress:"0x49d21052f4695d16C7cce6eF561301Aa4d840420",exchangeType:"ExchangeV2",pathfinderKey:"Arbidex Classic,Arbidex Quantum"},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"},SyncSwap:{chainName:"zkSync",chainId:324,twapVersion:4,twapAddress:"0xc32cAA0F7AD9ED88e22Fc214fc24cCb5C0595D68",lensAddress:"0x7daE5af3011c3bE9A5283F0368a3fdD757fc74F9",takers:["0xB924C20c400575D2B73Baa16CF0Fa0EAA720aFBC","0xBE452F03Be354CAC397C3F0c8397672067D44531"],bidDelaySeconds:60,minChunkSizeUsd:100,name:"SyncSwap",partner:"Orbs:TWAP:SyncSwap",exchangeAddress:"0x422623a40c42f026Ed33A9910078Aa843FD66e27",exchangeType:"ExchangeV2",pathfinderKey:"2,3"},Retro:{chainName:"poly",chainId:137,twapVersion:4,twapAddress:"0x688C027B0f7FaCeFcBa73e472900d28c12C5bDF4",lensAddress:"0xe0D4E736fc76af7C256ae7652c8c1e850bfb7849",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"Retro",partner:"Orbs:TWAP:Retro",exchangeAddress:"0xb7A3d74895bFD3Aff6780525e36D79FCf26a895F",exchangeType:"ExchangeV2",pathfinderKey:"retro,retro-v3"},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:{chainName:"sei",chainId:1329,twapVersion:4,twapAddress:"0xde737dB24548F8d41A4a3Ca2Bac8aaaDc4DBA099",lensAddress:"0xa1376f2Bb80D3cF6c2D8ebEf34b3d122e9af4020",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"DragonSwap",partner:"Orbs:TWAP:DragonSwap",exchangeAddress:"0xf2F933FafbDB97062CfA3c447ff373e76A90Efd6",exchangeType:"ExchangeV2",pathfinderKey:""},TeaFi:{chainName:"poly",chainId:137,twapVersion:4,twapAddress:"0x688C027B0f7FaCeFcBa73e472900d28c12C5bDF4",lensAddress:"0xe0D4E736fc76af7C256ae7652c8c1e850bfb7849",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"TeaFi",partner:"Orbs:TWAP:TeaFi",exchangeAddress:"0xE9D3b4Cf5B0CC392e78C1a4DD9885D449EEF9793",exchangeType:"ParaswapExchange",pathfinderKey:"AaveV2,AaveV3,AaveV3Stata,AngleStakedStableEUR,AngleStakedStableUSD,ApeSwap,AugustusRFQ,BalancerV2,ComethSwap,CurveV1,CurveV1Factory,CurveV1StableNg,CurveV2,Dfyn,DODOV2,Dystopia,Hashflow,IronV2,JarvisV6,KyberDmm,QuickSwap,QuickSwapV3,Retro,SushiSwap,SushiSwapV3,SwaapV2,Synapse,UniswapV2,UniswapV3,WaultFinance,Wmatic,WooFiV2,wUSDM"},SparkDEX:{chainName:"flare",chainId:14,twapVersion:4,twapAddress:"0x9D70B0b90915Bb8b9bdAC7e6a7e6435bBF1feC4D",lensAddress:"0xf2d96E7BE676153d202e1453804E2749923C7c5b",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"SparkDEX",partner:"Orbs:TWAP:SparkDEX",exchangeAddress:"0xe59c53C76bB7EEc01401A18fA8215B94bC65Bf56",exchangeType:"P2Exchange"},Ramses:{chainName:"arb",chainId:42161,twapVersion:4,twapAddress:"0x0B94dcC0EA2d1ee33Ab064DaC252de980a941eF3",lensAddress:"0x549e1fc9a47FCc0C5C2EbdfF31254cc49fF7164e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"Ramses",partner:"Orbs:TWAP:Ramses",exchangeAddress:"0x8FCc245209bE85C49D738D0CE5613F74E5d91E86",exchangeType:"ParaswapExchange",pathfinderKey:""},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:""},H2Finance:{chainName:"cronos-zkevm",chainId:388,twapVersion:4,twapAddress:"0xc32cAA0F7AD9ED88e22Fc214fc24cCb5C0595D68",lensAddress:"0x7daE5af3011c3bE9A5283F0368a3fdD757fc74F9",takers:["0xB924C20c400575D2B73Baa16CF0Fa0EAA720aFBC","0xBE452F03Be354CAC397C3F0c8397672067D44531"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"H2Finance",partner:"Orbs:TWAP:H2Finance",exchangeAddress:"0x2f1f10dc311722Be609e6B427bF3FBac6e44093B",exchangeType:"ExchangeV2"},Shadow:{chainName:"sonic",chainId:146,twapVersion:4,twapAddress:"0x8963992816b4EafE5a22b7DB2A99513c18be9afA",lensAddress:"0x67e631F71232D63AcA98a2D5E9B2Bce5FCc39d5D",takers:["0xDF406A27C58a8Cd6Fd43e143339bCE131216a913","0x504f6E10173249dD22491829D98862Cf81DeF79E"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"Shadow",partner:"Orbs:TWAP:Shadow",exchangeAddress:"0x69e3c891450161b7BF27f181eE85E7bAE69E5b07",exchangeType:"ExchangeV2"},Kodiak:{chainName:"berachain",chainId:80094,twapVersion:4,twapAddress:"0xD13609A8ace04D11Ea2FFE176B69dF77C6d9375E",lensAddress:"0xA0b07F9a11dFb01388149abBdbc5B4f2196600AB",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"Kodiak",partner:"Orbs:TWAP:Kodiak",exchangeAddress:"0x69B7aE1250B8d1309954CaD65b6607ae478Ec6eE",exchangeType:"ExchangeV2"},OmniBase:{chainName:"base",chainId:8453,twapVersion:4,twapAddress:"0xc918bdC47264687796Cd54FE362FaC4f8b99Eb55",lensAddress:"0x6313188c1909b161074D62E43105faC9B756A23e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"OmniBase",partner:"Orbs:TWAP:OmniBase",exchangeAddress:"0x54435FcFDF3A08150Ed799b6EF472A20a432303F",exchangeType:"ParaswapExchange"},OmniArb:{chainName:"arb",chainId:42161,twapVersion:4,twapAddress:"0x0B94dcC0EA2d1ee33Ab064DaC252de980a941eF3",lensAddress:"0x549e1fc9a47FCc0C5C2EbdfF31254cc49fF7164e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"OmniArb",partner:"Orbs:TWAP:OmniArb",exchangeAddress:"0xF0607785424d342Cceb33E708f4579CA97a3b392",exchangeType:"ParaswapExchange"},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"},NewEraBnb:{chainName:"bsc",chainId:56,twapVersion:4,twapAddress:"0xa6F7444D2b92Aa9F94a2165c77aAF2B671e63994",lensAddress:"0xEdB0c077fa87Fb21d050c619FF426798f8Fc1264",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"NewEraBnb",partner:"Orbs:TWAP:NewEraBnb",exchangeAddress:"0xA22D7Df24d9Ea4D4EF6dC96b2204bd550430eC42",exchangeType:"ExchangeV2"}},N5=[{constant:!1,inputs:[{name:"wad",type:"uint256"}],name:"withdraw",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[],name:"deposit",outputs:[],payable:!0,stateMutability:"payable",type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"dst",type:"address"},{indexed:!1,name:"wad",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"src",type:"address"},{indexed:!1,name:"wad",type:"uint256"}],name:"Withdrawal",type:"event"}],L5=[{inputs:[{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],z5=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"}]'),R5=[{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"}]}],_h=N5,H5=L5,Mh=R5,Nh=z5;var ye=(e=>(e.TWAP="TWAP",e.LIMIT="LIMIT",e.STOP_LOSS="STOP_LOSS",e.TAKE_PROFIT="TAKE_PROFIT",e))(ye||{}),ct=(e=>(e.Open="OPEN",e.Canceled="CANCELED",e.Completed="COMPLETED",e.Expired="EXPIRED",e))(ct||{}),$t=(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))($t||{}),ze=(e=>(e.LIMIT="limit",e.TWAP_LIMIT="twap-limit",e.TWAP_MARKET="twap-market",e.TAKE_PROFIT="take-profit",e.STOP_LOSS_LIMIT="stop-loss-limit",e.STOP_LOSS_MARKET="stop-loss-market",e))(ze||{}),Lh=(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))(Lh||{}),Gt=(e=>(e[e.EMPTY_LIMIT_PRICE=0]="EMPTY_LIMIT_PRICE",e[e.MAX_CHUNKS=1]="MAX_CHUNKS",e[e.MIN_CHUNKS=2]="MIN_CHUNKS",e[e.MIN_TRADE_SIZE=3]="MIN_TRADE_SIZE",e[e.MAX_FILL_DELAY=4]="MAX_FILL_DELAY",e[e.MIN_FILL_DELAY=5]="MIN_FILL_DELAY",e[e.MAX_ORDER_DURATION=6]="MAX_ORDER_DURATION",e[e.MIN_ORDER_DURATION=7]="MIN_ORDER_DURATION",e[e.MISSING_LIMIT_PRICE=8]="MISSING_LIMIT_PRICE",e[e.STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE=9]="STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE",e[e.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE=10]="TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE",e[e.TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE=11]="TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE",e[e.EMPTY_TRIGGER_PRICE=12]="EMPTY_TRIGGER_PRICE",e[e.INSUFFICIENT_BALANCE=13]="INSUFFICIENT_BALANCE",e[e.MAX_ORDER_SIZE=14]="MAX_ORDER_SIZE",e))(Gt||{});const wt="0x0000000000000000000000000000000000000000",Ft={eth:{id:1,name:"Ethereum",shortname:"eth",native:{address:wt,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:wt,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},poly:{id:137,name:"Polygon",shortname:"poly",native:{address:wt,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:wt,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:wt,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:wt,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:wt,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:wt,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.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:wt,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:wt,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:wt,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:wt,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:wt,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:wt,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:wt,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:wt,symbol:"ETH",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg"},wToken:{symbol:"WETH",address:"0x4200000000000000000000000000000000000006",decimals:18,logoUrl:"hhttps://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:wt,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:wt,symbol:"ETH",decimals:18,logoUrl:"https://katana.network/assets/katana-logo.svg"},wToken:{symbol:"WETH",address:"0x4200000000000000000000000000000000000006",decimals:18,logoUrl:"https://katana.network/assets/weth-logo.svg"},publicRpcUrl:"https://rpc.katana.network",logoUrl:"https://katana.network/assets/katana-logo.svg",explorer:"https://explorer.katana.garden",eip1559:!0},bera:{id:80094,name:"Bera",shortname:"bera",native:{address:wt,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:"wss://rpc.berachain-apis.com",logoUrl:"https://katana.network/assets/katana-logo.svg",explorer:"https://berascan.com",eip1559:!0},monad:{id:143,name:"Monad",shortname:"monad",native:{address:wt,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}};var $5=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Qu=Math.ceil,yr=Math.floor,Yt="[BigNumber Error] ",zh=Yt+"Number primitive has more than 15 significant digits: ",Fr=1e14,xe=14,Ju=9007199254740991,ed=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Kn=1e7,St=1e9;function Rh(e){var t,r,n,s=w.prototype={constructor:w,toString:null,valueOf:null},a=new w(1),o=20,i=4,c=-7,l=21,u=-1e7,d=1e7,f=!1,h=1,y=0,g={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},E="0123456789abcdefghijklmnopqrstuvwxyz",v=!0;function w(m,b){var x,S,I,F,_,k,P,O,U=this;if(!(U instanceof w))return new w(m,b);if(b==null){if(m&&m._isBigNumber===!0){U.s=m.s,!m.c||m.e>d?U.c=U.e=null:m.e<u?U.c=[U.e=0]:(U.e=m.e,U.c=m.c.slice());return}if((k=typeof m=="number")&&m*0==0){if(U.s=1/m<0?(m=-m,-1):1,m===~~m){for(F=0,_=m;_>=10;_/=10,F++);F>d?U.c=U.e=null:(U.e=F,U.c=[m]);return}O=String(m)}else{if(!$5.test(O=String(m)))return n(U,O,k);U.s=O.charCodeAt(0)==45?(O=O.slice(1),-1):1}(F=O.indexOf("."))>-1&&(O=O.replace(".","")),(_=O.search(/e/i))>0?(F<0&&(F=_),F+=+O.slice(_+1),O=O.substring(0,_)):F<0&&(F=O.length)}else{if(lt(b,2,E.length,"Base"),b==10&&v)return U=new w(m),z(U,o+U.e+1,i);if(O=String(m),k=typeof m=="number"){if(m*0!=0)return n(U,O,k,b);if(U.s=1/m<0?(O=O.slice(1),-1):1,w.DEBUG&&O.replace(/^0\.0*|\./,"").length>15)throw Error(zh+m)}else U.s=O.charCodeAt(0)===45?(O=O.slice(1),-1):1;for(x=E.slice(0,b),F=_=0,P=O.length;_<P;_++)if(x.indexOf(S=O.charAt(_))<0){if(S=="."){if(_>F){F=P;continue}}else if(!I&&(O==O.toUpperCase()&&(O=O.toLowerCase())||O==O.toLowerCase()&&(O=O.toUpperCase()))){I=!0,_=-1,F=0;continue}return n(U,String(m),k,b)}k=!1,O=r(O,b,10,U.s),(F=O.indexOf("."))>-1?O=O.replace(".",""):F=O.length}for(_=0;O.charCodeAt(_)===48;_++);for(P=O.length;O.charCodeAt(--P)===48;);if(O=O.slice(_,++P)){if(P-=_,k&&w.DEBUG&&P>15&&(m>Ju||m!==yr(m)))throw Error(zh+U.s*m);if((F=F-_-1)>d)U.c=U.e=null;else if(F<u)U.c=[U.e=0];else{if(U.e=F,U.c=[],_=(F+1)%xe,F<0&&(_+=xe),_<P){for(_&&U.c.push(+O.slice(0,_)),P-=xe;_<P;)U.c.push(+O.slice(_,_+=xe));_=xe-(O=O.slice(_)).length}else _-=P;for(;_--;O+="0");U.c.push(+O)}}else U.c=[U.e=0]}w.clone=Rh,w.ROUND_UP=0,w.ROUND_DOWN=1,w.ROUND_CEIL=2,w.ROUND_FLOOR=3,w.ROUND_HALF_UP=4,w.ROUND_HALF_DOWN=5,w.ROUND_HALF_EVEN=6,w.ROUND_HALF_CEIL=7,w.ROUND_HALF_FLOOR=8,w.EUCLID=9,w.config=w.set=function(m){var b,x;if(m!=null)if(typeof m=="object"){if(m.hasOwnProperty(b="DECIMAL_PLACES")&&(x=m[b],lt(x,0,St,b),o=x),m.hasOwnProperty(b="ROUNDING_MODE")&&(x=m[b],lt(x,0,8,b),i=x),m.hasOwnProperty(b="EXPONENTIAL_AT")&&(x=m[b],x&&x.pop?(lt(x[0],-St,0,b),lt(x[1],0,St,b),c=x[0],l=x[1]):(lt(x,-St,St,b),c=-(l=x<0?-x:x))),m.hasOwnProperty(b="RANGE"))if(x=m[b],x&&x.pop)lt(x[0],-St,-1,b),lt(x[1],1,St,b),u=x[0],d=x[1];else if(lt(x,-St,St,b),x)u=-(d=x<0?-x:x);else throw Error(Yt+b+" cannot be zero: "+x);if(m.hasOwnProperty(b="CRYPTO"))if(x=m[b],x===!!x)if(x)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))f=x;else throw f=!x,Error(Yt+"crypto unavailable");else f=x;else throw Error(Yt+b+" not true or false: "+x);if(m.hasOwnProperty(b="MODULO_MODE")&&(x=m[b],lt(x,0,9,b),h=x),m.hasOwnProperty(b="POW_PRECISION")&&(x=m[b],lt(x,0,St,b),y=x),m.hasOwnProperty(b="FORMAT"))if(x=m[b],typeof x=="object")g=x;else throw Error(Yt+b+" not an object: "+x);if(m.hasOwnProperty(b="ALPHABET"))if(x=m[b],typeof x=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(x))v=x.slice(0,10)=="0123456789",E=x;else throw Error(Yt+b+" invalid: "+x)}else throw Error(Yt+"Object expected: "+m);return{DECIMAL_PLACES:o,ROUNDING_MODE:i,EXPONENTIAL_AT:[c,l],RANGE:[u,d],CRYPTO:f,MODULO_MODE:h,POW_PRECISION:y,FORMAT:g,ALPHABET:E}},w.isBigNumber=function(m){if(!m||m._isBigNumber!==!0)return!1;if(!w.DEBUG)return!0;var b,x,S=m.c,I=m.e,F=m.s;e:if({}.toString.call(S)=="[object Array]"){if((F===1||F===-1)&&I>=-St&&I<=St&&I===yr(I)){if(S[0]===0){if(I===0&&S.length===1)return!0;break e}if(b=(I+1)%xe,b<1&&(b+=xe),String(S[0]).length==b){for(b=0;b<S.length;b++)if(x=S[b],x<0||x>=Fr||x!==yr(x))break e;if(x!==0)return!0}}}else if(S===null&&I===null&&(F===null||F===1||F===-1))return!0;throw Error(Yt+"Invalid BigNumber: "+m)},w.maximum=w.max=function(){return C(arguments,-1)},w.minimum=w.min=function(){return C(arguments,1)},w.random=(function(){var m=9007199254740992,b=Math.random()*m&2097151?function(){return yr(Math.random()*m)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(x){var S,I,F,_,k,P=0,O=[],U=new w(a);if(x==null?x=o:lt(x,0,St),_=Qu(x/xe),f)if(crypto.getRandomValues){for(S=crypto.getRandomValues(new Uint32Array(_*=2));P<_;)k=S[P]*131072+(S[P+1]>>>11),k>=9e15?(I=crypto.getRandomValues(new Uint32Array(2)),S[P]=I[0],S[P+1]=I[1]):(O.push(k%1e14),P+=2);P=_/2}else if(crypto.randomBytes){for(S=crypto.randomBytes(_*=7);P<_;)k=(S[P]&31)*281474976710656+S[P+1]*1099511627776+S[P+2]*4294967296+S[P+3]*16777216+(S[P+4]<<16)+(S[P+5]<<8)+S[P+6],k>=9e15?crypto.randomBytes(7).copy(S,P):(O.push(k%1e14),P+=7);P=_/7}else throw f=!1,Error(Yt+"crypto unavailable");if(!f)for(;P<_;)k=b(),k<9e15&&(O[P++]=k%1e14);for(_=O[--P],x%=xe,_&&x&&(k=ed[xe-x],O[P]=yr(_/k)*k);O[P]===0;O.pop(),P--);if(P<0)O=[F=0];else{for(F=-1;O[0]===0;O.splice(0,1),F-=xe);for(P=1,k=O[0];k>=10;k/=10,P++);P<xe&&(F-=xe-P)}return U.e=F,U.c=O,U}})(),w.sum=function(){for(var m=1,b=arguments,x=new w(b[0]);m<b.length;)x=x.plus(b[m++]);return x},r=(function(){var m="0123456789";function b(x,S,I,F){for(var _,k=[0],P,O=0,U=x.length;O<U;){for(P=k.length;P--;k[P]*=S);for(k[0]+=F.indexOf(x.charAt(O++)),_=0;_<k.length;_++)k[_]>I-1&&(k[_+1]==null&&(k[_+1]=0),k[_+1]+=k[_]/I|0,k[_]%=I)}return k.reverse()}return function(x,S,I,F,_){var k,P,O,U,L,H,G,Q,pe=x.indexOf("."),me=o,ie=i;for(pe>=0&&(U=y,y=0,x=x.replace(".",""),Q=new w(S),H=Q.pow(x.length-pe),y=U,Q.c=b(bn(xr(H.c),H.e,"0"),10,I,m),Q.e=Q.c.length),G=b(x,S,I,_?(k=E,m):(k=m,E)),O=U=G.length;G[--U]==0;G.pop());if(!G[0])return k.charAt(0);if(pe<0?--O:(H.c=G,H.e=O,H.s=F,H=t(H,Q,me,ie,I),G=H.c,L=H.r,O=H.e),P=O+me+1,pe=G[P],U=I/2,L=L||P<0||G[P+1]!=null,L=ie<4?(pe!=null||L)&&(ie==0||ie==(H.s<0?3:2)):pe>U||pe==U&&(ie==4||L||ie==6&&G[P-1]&1||ie==(H.s<0?8:7)),P<1||!G[0])x=L?bn(k.charAt(1),-me,k.charAt(0)):k.charAt(0);else{if(G.length=P,L)for(--I;++G[--P]>I;)G[P]=0,P||(++O,G=[1].concat(G));for(U=G.length;!G[--U];);for(pe=0,x="";pe<=U;x+=k.charAt(G[pe++]));x=bn(x,O,k.charAt(0))}return x}})(),t=(function(){function m(S,I,F){var _,k,P,O,U=0,L=S.length,H=I%Kn,G=I/Kn|0;for(S=S.slice();L--;)P=S[L]%Kn,O=S[L]/Kn|0,_=G*P+O*H,k=H*P+_%Kn*Kn+U,U=(k/F|0)+(_/Kn|0)+G*O,S[L]=k%F;return U&&(S=[U].concat(S)),S}function b(S,I,F,_){var k,P;if(F!=_)P=F>_?1:-1;else for(k=P=0;k<F;k++)if(S[k]!=I[k]){P=S[k]>I[k]?1:-1;break}return P}function x(S,I,F,_){for(var k=0;F--;)S[F]-=k,k=S[F]<I[F]?1:0,S[F]=k*_+S[F]-I[F];for(;!S[0]&&S.length>1;S.splice(0,1));}return function(S,I,F,_,k){var P,O,U,L,H,G,Q,pe,me,ie,de,Be,X,we,De,Ge,it,Ae=S.s==I.s?1:-1,ve=S.c,be=I.c;if(!ve||!ve[0]||!be||!be[0])return new w(!S.s||!I.s||(ve?be&&ve[0]==be[0]:!be)?NaN:ve&&ve[0]==0||!be?Ae*0:Ae/0);for(pe=new w(Ae),me=pe.c=[],O=S.e-I.e,Ae=F+O+1,k||(k=Fr,O=gr(S.e/xe)-gr(I.e/xe),Ae=Ae/xe|0),U=0;be[U]==(ve[U]||0);U++);if(be[U]>(ve[U]||0)&&O--,Ae<0)me.push(1),L=!0;else{for(we=ve.length,Ge=be.length,U=0,Ae+=2,H=yr(k/(be[0]+1)),H>1&&(be=m(be,H,k),ve=m(ve,H,k),Ge=be.length,we=ve.length),X=Ge,ie=ve.slice(0,Ge),de=ie.length;de<Ge;ie[de++]=0);it=be.slice(),it=[0].concat(it),De=be[0],be[1]>=k/2&&De++;do{if(H=0,P=b(be,ie,Ge,de),P<0){if(Be=ie[0],Ge!=de&&(Be=Be*k+(ie[1]||0)),H=yr(Be/De),H>1)for(H>=k&&(H=k-1),G=m(be,H,k),Q=G.length,de=ie.length;b(G,ie,Q,de)==1;)H--,x(G,Ge<Q?it:be,Q,k),Q=G.length,P=1;else H==0&&(P=H=1),G=be.slice(),Q=G.length;if(Q<de&&(G=[0].concat(G)),x(ie,G,de,k),de=ie.length,P==-1)for(;b(be,ie,Ge,de)<1;)H++,x(ie,Ge<de?it:be,de,k),de=ie.length}else P===0&&(H++,ie=[0]);me[U++]=H,ie[0]?ie[de++]=ve[X]||0:(ie=[ve[X]],de=1)}while((X++<we||ie[0]!=null)&&Ae--);L=ie[0]!=null,me[0]||me.splice(0,1)}if(k==Fr){for(U=1,Ae=me[0];Ae>=10;Ae/=10,U++);z(pe,F+(pe.e=U+O*xe-1)+1,_,L)}else pe.e=O,pe.r=+L;return pe}})();function A(m,b,x,S){var I,F,_,k,P;if(x==null?x=i:lt(x,0,8),!m.c)return m.toString();if(I=m.c[0],_=m.e,b==null)P=xr(m.c),P=S==1||S==2&&(_<=c||_>=l)?Pc(P,_):bn(P,_,"0");else if(m=z(new w(m),b,x),F=m.e,P=xr(m.c),k=P.length,S==1||S==2&&(b<=F||F<=c)){for(;k<b;P+="0",k++);P=Pc(P,F)}else if(b-=_+(S===2&&F>_),P=bn(P,F,"0"),F+1>k){if(--b>0)for(P+=".";b--;P+="0");}else if(b+=F-k,b>0)for(F+1==k&&(P+=".");b--;P+="0");return m.s<0&&I?"-"+P:P}function C(m,b){for(var x,S,I=1,F=new w(m[0]);I<m.length;I++)S=new w(m[I]),(!S.s||(x=Ss(F,S))===b||x===0&&F.s===b)&&(F=S);return F}function D(m,b,x){for(var S=1,I=b.length;!b[--I];b.pop());for(I=b[0];I>=10;I/=10,S++);return(x=S+x*xe-1)>d?m.c=m.e=null:x<u?m.c=[m.e=0]:(m.e=x,m.c=b),m}n=(function(){var m=/^(-?)0([xbo])(?=\w[\w.]*$)/i,b=/^([^.]+)\.$/,x=/^\.([^.]+)$/,S=/^-?(Infinity|NaN)$/,I=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(F,_,k,P){var O,U=k?_:_.replace(I,"");if(S.test(U))F.s=isNaN(U)?null:U<0?-1:1;else{if(!k&&(U=U.replace(m,function(L,H,G){return O=(G=G.toLowerCase())=="x"?16:G=="b"?2:8,!P||P==O?H:L}),P&&(O=P,U=U.replace(b,"$1").replace(x,"0.$1")),_!=U))return new w(U,O);if(w.DEBUG)throw Error(Yt+"Not a"+(P?" base "+P:"")+" number: "+_);F.s=null}F.c=F.e=null}})();function z(m,b,x,S){var I,F,_,k,P,O,U,L=m.c,H=ed;if(L){e:{for(I=1,k=L[0];k>=10;k/=10,I++);if(F=b-I,F<0)F+=xe,_=b,P=L[O=0],U=yr(P/H[I-_-1]%10);else if(O=Qu((F+1)/xe),O>=L.length)if(S){for(;L.length<=O;L.push(0));P=U=0,I=1,F%=xe,_=F-xe+1}else break e;else{for(P=k=L[O],I=1;k>=10;k/=10,I++);F%=xe,_=F-xe+I,U=_<0?0:yr(P/H[I-_-1]%10)}if(S=S||b<0||L[O+1]!=null||(_<0?P:P%H[I-_-1]),S=x<4?(U||S)&&(x==0||x==(m.s<0?3:2)):U>5||U==5&&(x==4||S||x==6&&(F>0?_>0?P/H[I-_]:0:L[O-1])%10&1||x==(m.s<0?8:7)),b<1||!L[0])return L.length=0,S?(b-=m.e+1,L[0]=H[(xe-b%xe)%xe],m.e=-b||0):L[0]=m.e=0,m;if(F==0?(L.length=O,k=1,O--):(L.length=O+1,k=H[xe-F],L[O]=_>0?yr(P/H[I-_]%H[_])*k:0),S)for(;;)if(O==0){for(F=1,_=L[0];_>=10;_/=10,F++);for(_=L[0]+=k,k=1;_>=10;_/=10,k++);F!=k&&(m.e++,L[0]==Fr&&(L[0]=1));break}else{if(L[O]+=k,L[O]!=Fr)break;L[O--]=0,k=1}for(F=L.length;L[--F]===0;L.pop());}m.e>d?m.c=m.e=null:m.e<u&&(m.c=[m.e=0])}return m}function T(m){var b,x=m.e;return x===null?m.toString():(b=xr(m.c),b=x<=c||x>=l?Pc(b,x):bn(b,x,"0"),m.s<0?"-"+b:b)}return s.absoluteValue=s.abs=function(){var m=new w(this);return m.s<0&&(m.s=1),m},s.comparedTo=function(m,b){return Ss(this,new w(m,b))},s.decimalPlaces=s.dp=function(m,b){var x,S,I,F=this;if(m!=null)return lt(m,0,St),b==null?b=i:lt(b,0,8),z(new w(F),m+F.e+1,b);if(!(x=F.c))return null;if(S=((I=x.length-1)-gr(this.e/xe))*xe,I=x[I])for(;I%10==0;I/=10,S--);return S<0&&(S=0),S},s.dividedBy=s.div=function(m,b){return t(this,new w(m,b),o,i)},s.dividedToIntegerBy=s.idiv=function(m,b){return t(this,new w(m,b),0,1)},s.exponentiatedBy=s.pow=function(m,b){var x,S,I,F,_,k,P,O,U,L=this;if(m=new w(m),m.c&&!m.isInteger())throw Error(Yt+"Exponent not an integer: "+T(m));if(b!=null&&(b=new w(b)),k=m.e>14,!L.c||!L.c[0]||L.c[0]==1&&!L.e&&L.c.length==1||!m.c||!m.c[0])return U=new w(Math.pow(+T(L),k?m.s*(2-Sc(m)):+T(m))),b?U.mod(b):U;if(P=m.s<0,b){if(b.c?!b.c[0]:!b.s)return new w(NaN);S=!P&&L.isInteger()&&b.isInteger(),S&&(L=L.mod(b))}else{if(m.e>9&&(L.e>0||L.e<-1||(L.e==0?L.c[0]>1||k&&L.c[1]>=24e7:L.c[0]<8e13||k&&L.c[0]<=9999975e7)))return F=L.s<0&&Sc(m)?-0:0,L.e>-1&&(F=1/F),new w(P?1/F:F);y&&(F=Qu(y/xe+2))}for(k?(x=new w(.5),P&&(m.s=1),O=Sc(m)):(I=Math.abs(+T(m)),O=I%2),U=new w(a);;){if(O){if(U=U.times(L),!U.c)break;F?U.c.length>F&&(U.c.length=F):S&&(U=U.mod(b))}if(I){if(I=yr(I/2),I===0)break;O=I%2}else if(m=m.times(x),z(m,m.e+1,1),m.e>14)O=Sc(m);else{if(I=+T(m),I===0)break;O=I%2}L=L.times(L),F?L.c&&L.c.length>F&&(L.c.length=F):S&&(L=L.mod(b))}return S?U:(P&&(U=a.div(U)),b?U.mod(b):F?z(U,y,i,_):U)},s.integerValue=function(m){var b=new w(this);return m==null?m=i:lt(m,0,8),z(b,b.e+1,m)},s.isEqualTo=s.eq=function(m,b){return Ss(this,new w(m,b))===0},s.isFinite=function(){return!!this.c},s.isGreaterThan=s.gt=function(m,b){return Ss(this,new w(m,b))>0},s.isGreaterThanOrEqualTo=s.gte=function(m,b){return(b=Ss(this,new w(m,b)))===1||b===0},s.isInteger=function(){return!!this.c&&gr(this.e/xe)>this.c.length-2},s.isLessThan=s.lt=function(m,b){return Ss(this,new w(m,b))<0},s.isLessThanOrEqualTo=s.lte=function(m,b){return(b=Ss(this,new w(m,b)))===-1||b===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(m,b){var x,S,I,F,_=this,k=_.s;if(m=new w(m,b),b=m.s,!k||!b)return new w(NaN);if(k!=b)return m.s=-b,_.plus(m);var P=_.e/xe,O=m.e/xe,U=_.c,L=m.c;if(!P||!O){if(!U||!L)return U?(m.s=-b,m):new w(L?_:NaN);if(!U[0]||!L[0])return L[0]?(m.s=-b,m):new w(U[0]?_:i==3?-0:0)}if(P=gr(P),O=gr(O),U=U.slice(),k=P-O){for((F=k<0)?(k=-k,I=U):(O=P,I=L),I.reverse(),b=k;b--;I.push(0));I.reverse()}else for(S=(F=(k=U.length)<(b=L.length))?k:b,k=b=0;b<S;b++)if(U[b]!=L[b]){F=U[b]<L[b];break}if(F&&(I=U,U=L,L=I,m.s=-m.s),b=(S=L.length)-(x=U.length),b>0)for(;b--;U[x++]=0);for(b=Fr-1;S>k;){if(U[--S]<L[S]){for(x=S;x&&!U[--x];U[x]=b);--U[x],U[S]+=Fr}U[S]-=L[S]}for(;U[0]==0;U.splice(0,1),--O);return U[0]?D(m,U,O):(m.s=i==3?-1:1,m.c=[m.e=0],m)},s.modulo=s.mod=function(m,b){var x,S,I=this;return m=new w(m,b),!I.c||!m.s||m.c&&!m.c[0]?new w(NaN):!m.c||I.c&&!I.c[0]?new w(I):(h==9?(S=m.s,m.s=1,x=t(I,m,0,3),m.s=S,x.s*=S):x=t(I,m,0,h),m=I.minus(x.times(m)),!m.c[0]&&h==1&&(m.s=I.s),m)},s.multipliedBy=s.times=function(m,b){var x,S,I,F,_,k,P,O,U,L,H,G,Q,pe,me,ie=this,de=ie.c,Be=(m=new w(m,b)).c;if(!de||!Be||!de[0]||!Be[0])return!ie.s||!m.s||de&&!de[0]&&!Be||Be&&!Be[0]&&!de?m.c=m.e=m.s=null:(m.s*=ie.s,!de||!Be?m.c=m.e=null:(m.c=[0],m.e=0)),m;for(S=gr(ie.e/xe)+gr(m.e/xe),m.s*=ie.s,P=de.length,L=Be.length,P<L&&(Q=de,de=Be,Be=Q,I=P,P=L,L=I),I=P+L,Q=[];I--;Q.push(0));for(pe=Fr,me=Kn,I=L;--I>=0;){for(x=0,H=Be[I]%me,G=Be[I]/me|0,_=P,F=I+_;F>I;)O=de[--_]%me,U=de[_]/me|0,k=G*O+U*H,O=H*O+k%me*me+Q[F]+x,x=(O/pe|0)+(k/me|0)+G*U,Q[F--]=O%pe;Q[F]=x}return x?++S:Q.splice(0,1),D(m,Q,S)},s.negated=function(){var m=new w(this);return m.s=-m.s||null,m},s.plus=function(m,b){var x,S=this,I=S.s;if(m=new w(m,b),b=m.s,!I||!b)return new w(NaN);if(I!=b)return m.s=-b,S.minus(m);var F=S.e/xe,_=m.e/xe,k=S.c,P=m.c;if(!F||!_){if(!k||!P)return new w(I/0);if(!k[0]||!P[0])return P[0]?m:new w(k[0]?S:I*0)}if(F=gr(F),_=gr(_),k=k.slice(),I=F-_){for(I>0?(_=F,x=P):(I=-I,x=k),x.reverse();I--;x.push(0));x.reverse()}for(I=k.length,b=P.length,I-b<0&&(x=P,P=k,k=x,b=I),I=0;b;)I=(k[--b]=k[b]+P[b]+I)/Fr|0,k[b]=Fr===k[b]?0:k[b]%Fr;return I&&(k=[I].concat(k),++_),D(m,k,_)},s.precision=s.sd=function(m,b){var x,S,I,F=this;if(m!=null&&m!==!!m)return lt(m,1,St),b==null?b=i:lt(b,0,8),z(new w(F),m,b);if(!(x=F.c))return null;if(I=x.length-1,S=I*xe+1,I=x[I]){for(;I%10==0;I/=10,S--);for(I=x[0];I>=10;I/=10,S++);}return m&&F.e+1>S&&(S=F.e+1),S},s.shiftedBy=function(m){return lt(m,-Ju,Ju),this.times("1e"+m)},s.squareRoot=s.sqrt=function(){var m,b,x,S,I,F=this,_=F.c,k=F.s,P=F.e,O=o+4,U=new w("0.5");if(k!==1||!_||!_[0])return new w(!k||k<0&&(!_||_[0])?NaN:_?F:1/0);if(k=Math.sqrt(+T(F)),k==0||k==1/0?(b=xr(_),(b.length+P)%2==0&&(b+="0"),k=Math.sqrt(+b),P=gr((P+1)/2)-(P<0||P%2),k==1/0?b="5e"+P:(b=k.toExponential(),b=b.slice(0,b.indexOf("e")+1)+P),x=new w(b)):x=new w(k+""),x.c[0]){for(P=x.e,k=P+O,k<3&&(k=0);;)if(I=x,x=U.times(I.plus(t(F,I,O,1))),xr(I.c).slice(0,k)===(b=xr(x.c)).slice(0,k))if(x.e<P&&--k,b=b.slice(k-3,k+1),b=="9999"||!S&&b=="4999"){if(!S&&(z(I,I.e+o+2,0),I.times(I).eq(F))){x=I;break}O+=4,k+=4,S=1}else{(!+b||!+b.slice(1)&&b.charAt(0)=="5")&&(z(x,x.e+o+2,1),m=!x.times(x).eq(F));break}}return z(x,x.e+o+1,i,m)},s.toExponential=function(m,b){return m!=null&&(lt(m,0,St),m++),A(this,m,b,1)},s.toFixed=function(m,b){return m!=null&&(lt(m,0,St),m=m+this.e+1),A(this,m,b)},s.toFormat=function(m,b,x){var S,I=this;if(x==null)m!=null&&b&&typeof b=="object"?(x=b,b=null):m&&typeof m=="object"?(x=m,m=b=null):x=g;else if(typeof x!="object")throw Error(Yt+"Argument not an object: "+x);if(S=I.toFixed(m,b),I.c){var F,_=S.split("."),k=+x.groupSize,P=+x.secondaryGroupSize,O=x.groupSeparator||"",U=_[0],L=_[1],H=I.s<0,G=H?U.slice(1):U,Q=G.length;if(P&&(F=k,k=P,P=F,Q-=F),k>0&&Q>0){for(F=Q%k||k,U=G.substr(0,F);F<Q;F+=k)U+=O+G.substr(F,k);P>0&&(U+=O+G.slice(F)),H&&(U="-"+U)}S=L?U+(x.decimalSeparator||"")+((P=+x.fractionGroupSize)?L.replace(new RegExp("\\d{"+P+"}\\B","g"),"$&"+(x.fractionGroupSeparator||"")):L):U}return(x.prefix||"")+S+(x.suffix||"")},s.toFraction=function(m){var b,x,S,I,F,_,k,P,O,U,L,H,G=this,Q=G.c;if(m!=null&&(k=new w(m),!k.isInteger()&&(k.c||k.s!==1)||k.lt(a)))throw Error(Yt+"Argument "+(k.isInteger()?"out of range: ":"not an integer: ")+T(k));if(!Q)return new w(G);for(b=new w(a),O=x=new w(a),S=P=new w(a),H=xr(Q),F=b.e=H.length-G.e-1,b.c[0]=ed[(_=F%xe)<0?xe+_:_],m=!m||k.comparedTo(b)>0?F>0?b:O:k,_=d,d=1/0,k=new w(H),P.c[0]=0;U=t(k,b,0,1),I=x.plus(U.times(S)),I.comparedTo(m)!=1;)x=S,S=I,O=P.plus(U.times(I=O)),P=I,b=k.minus(U.times(I=b)),k=I;return I=t(m.minus(x),S,0,1),P=P.plus(I.times(O)),x=x.plus(I.times(S)),P.s=O.s=G.s,F=F*2,L=t(O,S,F,i).minus(G).abs().comparedTo(t(P,x,F,i).minus(G).abs())<1?[O,S]:[P,x],d=_,L},s.toNumber=function(){return+T(this)},s.toPrecision=function(m,b){return m!=null&<(m,1,St),A(this,m,b,2)},s.toString=function(m){var b,x=this,S=x.s,I=x.e;return I===null?S?(b="Infinity",S<0&&(b="-"+b)):b="NaN":(m==null?b=I<=c||I>=l?Pc(xr(x.c),I):bn(xr(x.c),I,"0"):m===10&&v?(x=z(new w(x),o+I+1,i),b=bn(xr(x.c),x.e,"0")):(lt(m,2,E.length,"Base"),b=r(bn(xr(x.c),I,"0"),10,m,S,!0)),S<0&&x.c[0]&&(b="-"+b)),b},s.valueOf=s.toJSON=function(){return T(this)},s._isBigNumber=!0,s[Symbol.toStringTag]="BigNumber",s[Symbol.for("nodejs.util.inspect.custom")]=s.valueOf,e!=null&&w.set(e),w}function gr(e){var t=e|0;return e>0||e===t?t:t-1}function xr(e){for(var t,r,n=1,s=e.length,a=e[0]+"";n<s;){for(t=e[n++]+"",r=xe-t.length;r--;t="0"+t);a+=t}for(s=a.length;a.charCodeAt(--s)===48;);return a.slice(0,s+1||1)}function Ss(e,t){var r,n,s=e.c,a=t.c,o=e.s,i=t.s,c=e.e,l=t.e;if(!o||!i)return null;if(r=s&&!s[0],n=a&&!a[0],r||n)return r?n?0:-i:o;if(o!=i)return o;if(r=o<0,n=c==l,!s||!a)return n?0:!s^r?1:-1;if(!n)return c>l^r?1:-1;for(i=(c=s.length)<(l=a.length)?c:l,o=0;o<i;o++)if(s[o]!=a[o])return s[o]>a[o]^r?1:-1;return c==l?0:c>l^r?1:-1}function lt(e,t,r,n){if(e<t||e>r||e!==yr(e))throw Error(Yt+(n||"Argument")+(typeof e=="number"?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Sc(e){var t=e.c.length-1;return gr(e.e/xe)==t&&e.c[t]%2!=0}function Pc(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function bn(e,t,r){var n,s;if(t<0){for(s=r+".";++t;s+=r);e=s+e}else if(n=e.length,++t>n){for(s=r,t-=n;--t;s+=r);e+=s}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var j=Rh();const ka=(e,t)=>{if(!e||!t)return"";const r=j(10).pow(e||0);return j(t).times(r).idiv(r).div(r).toFixed()};j(0),j(1),j(10),j(1e18);function Ps(e,t){return e==t||e.toLowerCase()==t.toLowerCase()}const Is=e=>!!Yh.find(t=>Ps(t,e||""));function G5(e){return[$t.Years,$t.Months,$t.Weeks,$t.Days,$t.Hours,$t.Minutes].find(r=>r<=e)||$t.Minutes}const Yn=e=>e?e.value*e.unit:0,j5=e=>!e||e==="NaN"?"0":j(e).decimalPlaces(0).toFixed(),Bs=e=>Object.values(Ft).find(t=>t.id===e),V5=e=>{if(!e)return;const t=e.map(a=>_t(a)),r=Object.entries(Zh).filter(([a])=>t.includes(a)).flatMap(([,a])=>a),n=e.map(a=>a.exchangeAddress),s=new Set([...n,...r].map(a=>a.toLowerCase()));return Array.from(s)},td=(e,t)=>e.version===1?(e.fillDelay||0)*1e3+pm(t):(e.fillDelay||0)*1e3,Uo=e=>typeof window>"u"?null:new URLSearchParams(window.location.search).get(e),Hh=e=>km().filter(t=>t.name===e).map(t=>t.chainId),$h=(e,t,r)=>{if(!j(e.srcAmountFilled||0).gt(0)||!j(e.dstAmountFilled||0).gt(0))return"";const n=ka(t,e.srcAmountFilled),s=ka(r,e.dstAmountFilled);return j(s).div(n).toFixed()},Gh=(e,t,r)=>{if(e.type===ze.TWAP_MARKET)return"";const n=ka(t,e.srcAmountPerTrade),s=ka(r,e.dstMinAmountPerTrade);return j(s).div(n).toFixed()},jh=(e,t,r)=>{if(e.type===ze.TWAP_MARKET)return"";const n=ka(t,e.srcAmountPerTrade),s=ka(r,e.triggerPricePerTrade);return j(s).div(n).toFixed()},Vh="https://order-sink-dev.orbs.network",rd="https://order-sink.orbs.network";let nd;const W5=e=>{nd=e},sd=()=>{const e=Uo("env");return e==="prod"?rd:e==="dev"?Vh:nd==="prod"?rd:nd==="dev"?Vh:rd},q5=100,K5=1,Ic=300*1e3,Ca=365*24*60*60*1e3,ad=300*1e3,Wh=new Date(Ic).getMinutes(),od=e=>`https://hub.orbs.network/api/private/project_cm7nb67z86nyr01z12gs0fxpf/subgraphs/orbs-twap-${e}/prod/gn`,Ur="https://hub.orbs.network/api/apikey/subgraphs/id",qh={[Ft.eth.id]:`${Ur}/Bf7bvMYcJbDAvYWJmhMpHZ4cpFjqzkhK6GXXEpnPRq6`,[Ft.bsc.id]:`${Ur}/4NfXEi8rreQsnAr4aJ45RLCKgnjcWX46Lbt9SadiCcz6`,[Ft.poly.id]:`${Ur}/3PyRPWSvDnMowGbeBy7aNsvUkD5ZuxdXQw2RdJq4NdXi`,[Ft.arb.id]:`${Ur}/83bpQexEaqBjHaQbKoFTbtvCXuo5RudRkfLgtRUYqo2c`,[Ft.base.id]:`${Ur}/DFhaPQb3HATXkpsWNZw3gydYHehLBVEDiSk4iBdZJyps`,[Ft.sei.id]:`${Ur}/5zjzRnURzoddyFSZBw5E5NAM3oBgPq3NasTYbtMk6EL6`,[Ft.linea.id]:`${Ur}/6VsNPEYfFLPZCqdMMDadoXQjLHWJdjEwiD768GAtb7j6`,[Ft.sonic.id]:`${Ur}/DtBr6a5vsoDd2oAXdPszcn4gLgrr1XC68Q3AJQKXnNLV`,[Ft.ftm.id]:`${Ur}/DdRo1pmJkrJC9fjsjEBWnNE1uqrbh7Diz4tVKd7rfupp`,[Ft.katana.id]:`${Ur}/CGi9sDFMQcnBwF3C3NoCFqnaE34sssbgwPLTwiskSXmW`,[Ft.avax.id]:`${Ur}/FxZ1vMwE5Xy1qvKvZENUMz4vhW8Sh4vXJf9Vp7o17pTx`,[Ft.bera.id]:od("berachain"),[Ft.flare.id]:od("flare"),[Ft.cronosZkEvm.id]:od("cronos-zkevm")},Kh="0x0000000000000000000000000000000000000000",Yh=[Kh,"0x0000000000000000000000000000000000001010","0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","0x000000000000000000000000000000000000dEaD","0x000000000000000000000000000000000000800A","0x000000000000000000000000000000000000800a"],Bc="115792089237316195423570985008687907853269984665640564039457584007913129639935",_t=e=>`${e.name}_${e.chainId}`,Zh={[_t(Dt.SushiArb)]:["0x846F2B29ef314bF3D667981b4ffdADc5B858312a","0x08c41f5D1C844061f6D952E25827eeAA576c6536"],[_t(Dt.SushiBase)]:["0x846F2B29ef314bF3D667981b4ffdADc5B858312a","0x08c41f5D1C844061f6D952E25827eeAA576c6536"],[_t(Dt.SushiEth)]:["0xc55943Fa6509004B2903ED8F8ab7347BfC47D0bA","0x08c41f5D1C844061f6D952E25827eeAA576c6536"],[_t(Dt.PancakeSwap)]:["0xb2BAFe188faD927240038cC4FfF2d771d8A58905","0xE2a0c3b9aD19A18c4bBa7fffBe5bC1b0E58Db1CE"],[_t(Dt.PancakeSwapArbitrum)]:["0xE20167871dB616DdfFD0Fd870d9bC068C350DD1F","0x807488ADAD033e95C438F998277bE654152594dc"],[_t(Dt.PancakeSwapBase)]:["0x10ed1F36e4eBE76E161c9AADDa20BE841bc0082c","0x3A9df3eE209b802D0337383f5abCe3204d623588"],[_t(Dt.PancakeSwapLinea)]:["0x3A9df3eE209b802D0337383f5abCe3204d623588"],[_t(Dt.QuickSwap)]:["0x26D0ec4Be402BCE03AAa8aAf0CF67e9428ba54eF"],[_t(Dt.Thena)]:["0xc2aBC02acd77Bb2407efA22348dA9afC8B375290"],[_t(Dt.Lynex)]:["0x72e3e1fD5D2Ee2F1C2Eb695206D490a1D45C3835"],[_t(Dt.DragonSwap)]:["0x101e1B65Bb516FB5f4547C80BAe0b51f1b8D7a22"],[_t(Dt.SpookySwapSonic)]:["0xAd97B770ad64aE47fc7d64B3bD820dCDbF9ff7DA"],[_t(Dt.SpookySwap)]:["0x3924d62219483015f982b160d48c0fa5Fd436Cba"],[_t(Dt.SwapX)]:["0xE5012eBDe5e26EE3Ea41992154731a03023CF274"]},Fc={unit:$t.Minutes,value:Wh},Y5=.25,Z5="100",Xh="RePermitWitnessTransferFrom",Qh={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:"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:"stop",type:"uint256"},{name:"recipient",type:"address"}],TokenPermissions:[{name:"token",type:"address"},{name:"amount",type:"uint256"}]},id="https://www.orbs.com/dtwap-and-dlimit-faq/",X5="https://www.orbs.com/dtwap-and-dlimit-faq/#dSLTP",Q5="https://raw.githubusercontent.com/orbs-network/twap-ui/master/logo/orbslogo.svg",J5="https://www.orbs.com/assets/img/common/logo.svg",ew="https://www.orbs.com/",tw="https://www.orbs.com/dtwap-dlimit-disclaimer";var Ta=(e=>(e.FRESHNESS="freshness",e.MIN_CHUNK_SIZE_USD="minChunkSizeUsd",e.ENV="env",e.DURATION="duration",e.IGNORE_ERRORS="ignore-errors",e))(Ta||{});const Jh="-5",em="10",tm="-10",rm="5",rw="Something went wrong";function nw(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,s.get?s:{enumerable:!0,get:function(){return e[n]}})}),r}function sw(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 aw={1:{dex:{sushiswap:{type:"default:sushi",router:"0xAC4c6e212A361c968F1725b4d055b47E63F80b75",adapter:"0x3Ee50D79e6D0205f325928AAFb041b63E1767Bc5",fee:"0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc"}}},14:{dex:{spark:{type:"default:spark",adapter:"0xB18c633B6584A33E45a8840a759f56dF17117b1D",fee:"0xaeA8C3e1a129A77686E115b1a46D9aD8405F7D2b"}}},56:{dex:{thena:{type:"default:odos-v2",adapter:"0xB75218ba5A99bF57Fd02556B70F05A4A0f1Dbe67",fee:"0x15eBc8b5b3877512FFF23650188694A9a8891FAc"},pancake:{type:"p2:pancakeswap-v2",adapter:"0x654272F7e6e6E912D38650f783eFd44452fD6ee5",fee:"0x37A957f10F458e0d7fDECBE2917971b57F15c927"},newera:{type:"default:odos-v2",adapter:"0x845f459271D800f6Ab32D78400b8Aa18414E80b0",fee:"0x4E7454909eB6D539111D56b50d68897E933D2d11"}}},137:{dex:{quick:{type:"paraswap:paraswap-v5",adapter:"0x023fD6848234f2655818705237F77F02215FEfe5",fee:"0xd207DC6a6dA88f27c8DB78201F974161b1d84b1f"},teafi:{type:"paraswap:paraswap-v5",adapter:"0xe95db7a60164B112C64cE67bA8587b1d4a0E0D29",fee:"0x04Ff96e2c4D62b5771795d307AD679a25b3D2D50"}}},143:{dex:{yowie:{type:"default:openocean-v2",adapter:"0x18bc9533c3539073B9A9acF12b0AbF7cB73e0F1f",fee:"0x6AF3eE77A3A3257777F5649aFa611b4C7Fd975Ef"},pangolin:{type:"default:kyber-v2",adapter:"0xd7D9CAA2910f49F37AC3447f5cAd27153944354A",fee:"0xde92da99D188Ceb54A11ec711EF52D808A6260B5"}}},146:{dex:{spooky:{type:"default:magpie-v3",adapter:"0xdCee7FDdB932104329d528144Cd17A408722B7e2",fee:"0x840Df4684B35BC68BcdA3F6707A3c82A0D662f8b"},swapx:{type:"default:openocean-v2",adapter:"0xecc733D6F6f2DEa341832D650E30822118884FEb",fee:"0x6E03f7BC0f141894612AA017796096399623895F"},shadow:{type:"default:magpie-v3",adapter:"0x5f3E5F6ACCfc65243A01Da3E93b5A700285592C3",fee:"0xb9e3751fAF3187E1bC468E56a707a8A91754460e"}}},1329:{dex:{dragon:{type:"default:dragon",adapter:"0x02d9d5882129241b67ec21Ebc2C86e1BE9BC9890",fee:"0x0dc1E0525202b32e89bA78ed55b1e5cEdB751334"},nami:{type:"default:openocean-v2",adapter:"0x2D4A1237A98f8cb03C3C85960e859aA44036a306",fee:"0xeB58450e23632003f013568703F54446070E2E80"}}},8453:{dex:{quick:{type:"default:kyber-v2",adapter:"0xc73F03c929A123Ee2f3A98EC18BB240f03980AE5",fee:"0xd207DC6a6dA88f27c8DB78201F974161b1d84b1f"},sushiswap:{type:"default:sushi",router:"0xAC4c6e212A361c968F1725b4d055b47E63F80b75",adapter:"0x3Ee50D79e6D0205f325928AAFb041b63E1767Bc5",fee:"0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc"}}},42161:{dex:{arbidex:{type:"default:odos-v2",adapter:"0xa734b32151108139e48dCA06eE721538d90A9Ef6",fee:"0xa0c11852f8A44e32F9EC10AD25986A53842f72Ca"},ramses:{type:"paraswap:paraswap-v5",adapter:"0x023fD6848234f2655818705237F77F02215FEfe5",fee:"0xB5BaCB60ECDa0bEF809B2A26eC9B4B926835D7af"},omni:{type:"paraswap:paraswap-v5",adapter:"0xa1baE146161223cd9dCa7137F68eb385934130BE",fee:"0xba5291526c30B097E9F1Fd1Be301E2ab6E0782aa"},chronos:{type:"default:odos-v2",adapter:"0x4Ff90F32aceD08b3e3257B018EA495Fd1Bfe4455",fee:"0x5729af83240EFecAa18eafaAE82961c2DD045Dbe"},sushiswap:{type:"default:sushi",router:"0xAC4c6e212A361c968F1725b4d055b47E63F80b75",adapter:"0x3Ee50D79e6D0205f325928AAFb041b63E1767Bc5",fee:"0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc"}}},43114:{dex:{blackhole:{type:"default:kyber-v2",adapter:"0x426ec4bc0d58B80959CDE77576a1942dd40592Fa",fee:"0x7f8B62520D9B5DA0ED517cc36e8dcb2a356f1928"},pangolin:{type:"default:kyber-v2",adapter:"0xd7D9CAA2910f49F37AC3447f5cAd27153944354A",fee:"0xde92da99D188Ceb54A11ec711EF52D808A6260B5"}}},59144:{dex:{lynex:{type:"default:openocean",adapter:"0x4FF6A97A67fe395212f168f011D71fE79E4396f2",fee:"0xcb36ed1B1BfAD8F7FC9651f52d21f04A68677423"}}},80094:{dex:{kodiak:{type:"default:kodiak",adapter:"0xBbaa527Aac00b1Ee9A3909D4D8c4447630E29B1F",fee:"0xBA47Ec15aFbCF6e7e9F52900632049530bB6bAe4"}}},747474:{dex:{sushiswap:{type:"default:sushi",router:"0xAC4c6e212A361c968F1725b4d055b47E63F80b75",adapter:"0x3Ee50D79e6D0205f325928AAFb041b63E1767Bc5",fee:"0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc"}}},"*":{wm:"0x0005d5cE0dB57e5BE3b2b8b6FeB75f0ccd015000",repermit:"0x00002a9C4D9497df5Bd31768eC5d30eEf5405000",cosigner:"0x0007ec53404c423C935e830ec21903e184690000",reactor:"0x0006a959430e8fBB858D81B2D1140B0ae5c26001",executor:"0x000eBA869d76C618ddc4A6D685A0820A620Ce002",refinery:"0x000E474c0D7084EAA35A501035E73269f4b009A5",salt:{wm:"0xc9b46eae42dfeba3222a0315bf682f33cd5cc9d60c9625642e88406f8415f152",repermit:"0x4871dc9008e605821ea9677b65ea2a60ffb774afb31e0dcaea2e192880096be7",cosigner:"0x37576f2ac1d2a602f00777611edf6f0cbc27611b0980b29bc7856fa79b2b8073",reactor:"0x034169222370f2fd587ef8998082d762cceef58a272330215f5110ec0d76d400",executor:"0xea139bc421fa5e272bed3db74233b2e02077e0aacf8b855f87961e98f2fb467f",refinery:"0x9746de29f1dd31b2c8460d71e92a7aefa34911130e61f274f37776e598c48bec"}}};var cd,nm;function ow(){if(nm)return cd;nm=1;const e=aw,t=s=>sw(`./out/${s}.sol/${s}.json`).abi,r=()=>({wm:t("WM"),repermit:t("RePermit"),reactor:t("OrderReactor"),executor:t("Executor"),refinery:t("Refinery"),adapter:t("DefaultDexAdapter")});function n(s,a){if(!s||!(a!=null&&a.trim()))return;const{dex:o,...i}=e["*"]??{},c=e[s];if(!c)return;const{dex:l,...u}=c,d=l==null?void 0:l[a];if(d)return{...i,...u,...d}}return cd={config:n,abis:r,raw:e},cd}var sm=ow();const am=(e,t,r)=>{if(!e||!t||!r)return;const n=j(e).times(t),s=j(10).pow(r);return n.div(s).toFixed(0)},om=(e,t,r,n)=>{if(r||!n||!e||!t)return j(0).toString();const s=j(e).times(j(t)),a=j(10).pow(n),o=s.div(a);return j.max(1,o).integerValue(j.ROUND_FLOOR).toFixed(0)},im=(e,t,r,n)=>{if(e===ye.TWAP||e===ye.LIMIT)return"0";if(!n||!t||!r)return;const s=j(t).times(j(r)),a=j(10).pow(n),o=s.div(a);return j.max(1,o).integerValue(j.ROUND_FLOOR).toFixed(0)||"0"},cm=(e,t,r,n)=>{const s=Yn(r)*2*t,a=Uo(Ta.DURATION),o=G5(a?Number(a):s);return a?{unit:o,value:Number(j(Number(a)/o).toFixed(2))}:n||(e===ye.LIMIT?{unit:$t.Days,value:7}:e===ye.STOP_LOSS||e===ye.TAKE_PROFIT?{unit:$t.Days,value:1}:{unit:o,value:Number(j(s/o).toFixed(2))})},lm=(e,t,r)=>t!==ye.TWAP?1:r!==void 0?r:e,um=(e,t,r,n)=>{if(!t||!r||!n)return 1;const a=j(r).times(t).div(n).integerValue(j.ROUND_FLOOR).toNumber(),o=Math.floor(Ca/2/Yn(e));return Math.max(1,Math.min(a,o))},dm=(e,t)=>e+Yn(t)+6e4,pm=e=>e.bidDelaySeconds*1e3*2,fm=(e="",t=0)=>!e||!t?"0":j(e).div(t).integerValue(j.ROUND_FLOOR).toFixed(0),iw=(e,t)=>({isError:!(e.unit===Fc.unit&&e.value===Fc.value)&&Yn(e)*t>Ca,value:Math.floor(Ca/t)}),hm=(e="",t="",r)=>{if(r===ye.STOP_LOSS)return{isError:j(t||0).gte(j(e||0)),value:e}},mm=(e="",t="",r)=>{if(r===ye.TAKE_PROFIT)return{isError:j(t||0).lte(j(e||0)),value:e}},bm=(e="",t="",r=!1,n)=>{if(!r&&n===ye.STOP_LOSS)return{isError:j(t||0).gte(j(e||0)),value:e}},ym=(e="",t="",r=!1,n)=>{if(!r&&n===ye.TAKE_PROFIT)return{isError:j(t||0).gte(j(e||0)),value:e}},gm=(e,t)=>e===ye.STOP_LOSS||e===ye.TAKE_PROFIT?{isError:Yn(t)>5184e6,value:5184e6}:{isError:Yn(t)>Ca,value:Ca},xm=e=>({isError:Yn(e)<ad,value:ad}),wm=e=>({isError:Yn(e)<Ic,value:Ic}),vm=(e,t,r)=>({isError:j(t||0).multipliedBy(e||0).isLessThan(r),value:r}),Em=(e,t,r)=>({isError:r===ye.TWAP&&j(e).isGreaterThan(t),value:t}),ld=(e,t=0)=>{var o;const r=(o=Object.entries(Dt).find(([i,c])=>c.chainId===t&&i.toLowerCase().indexOf(e.toLowerCase())>=0))==null?void 0:o[1],{abi:n,...s}=sm.config(t,e);return{...s,partner:e,twapConfig:r}},km=()=>{const e=sm.raw;return Object.entries(e).filter(([t])=>t!=="*").flatMap(([t,r])=>{const n=r==null?void 0:r.dex;return!n||typeof n!="object"?[]:Object.entries(n).map(([s])=>({chainId:Number(t),name:s,config:ld(s,Number(t))}))}).sort((t,r)=>t.name.localeCompare(r.name))},Cm=e=>{const t=Uo(Ta.MIN_CHUNK_SIZE_USD);return t?parseInt(t):e},Tm=({marketPrice:e,typedInputAmount:t,srcUsd1Token:r,marketPriceLoading:n,triggerPriceError:s,limitPriceError:a,tradesError:o,fillDelayError:i,durationError:c,balanceError:l})=>{if(!Uo(Ta.IGNORE_ERRORS)&&!(j(e||0).isZero()||j(t||0).isZero()||j(r||"0").isZero()||n))return s||a||o||i||c||l},Am=({chainId:e,srcToken:t,dstToken:r,srcAmount:n,deadlineMillis:s,fillDelayMillis:a,slippage:o,account:i,srcAmountPerTrade:c,dstMinAmountPerTrade:l="0",triggerAmountPerTrade:u="0",config:d,module:f})=>{const h=Date.now().toString(),y=parseInt((a/1e3).toFixed(0)),g=j5(s/1e3),E=Uo(Ta.FRESHNESS),v=E?parseInt(E):60,w=f===ye.TAKE_PROFIT?Bc:u,A=f===ye.TAKE_PROFIT?u:l,C={permitted:{token:t,amount:n},spender:d.reactor,nonce:h,deadline:g,witness:{reactor:d.reactor,executor:d.executor,exchange:{adapter:d.adapter,ref:d.fee,share:0,data:"0x"},swapper:i,nonce:h,deadline:g,chainid:e,exclusivity:0,epoch:y,slippage:o,freshness:v,input:{token:t,amount:c,maxAmount:n},output:{token:r,limit:j(A||0).toFixed(),stop:j(w||0).toFixed(),recipient:i}}};return{domain:{name:"RePermit",version:"1",chainId:e,verifyingContract:d.repermit},order:C,types:Qh,primaryType:Xh}},cw={version:"1.9.3"},lw=`https://bi.orbs.network/putes/twap-ui-${.7}`,Sm=cw.version;let ud="unknown";function Pm(e){ud=e}function dd(){const e=Math.random().toString(36).substring(2,16),t=Math.random().toString(36).substring(2,16),r=Date.now().toString(36);return`id_${e+t+r}`}const uw=(e,t,r)=>{var n,s,a,o,i,c,l,u,d;return{spotVersion:Sm,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:((n=e.twapConfig)==null?void 0:n.chainName)||"",chainId:r||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:((i=e.twapConfig)==null?void 0:i.bidDelaySeconds)||0,minChunkSizeUsd:t,name:((c=e.twapConfig)==null?void 0:c.name)||"",exchangeAddress:((l=e.twapConfig)==null?void 0:l.exchangeAddress)||"",exchangeType:((u=e.twapConfig)==null?void 0:u.exchangeType)||"",pathfinderKey:((d=e.twapConfig)==null?void 0:d.pathfinderKey)||""}},Im=async e=>{try{await fetch(lw,{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 dw{constructor(){Ku(this,"timeout");Ku(this,"config");Ku(this,"data",{_id:dd()})}async updateAndSend(t={},r=!1,n){try{this.data={...this.data,...t},r?(await Im(this.data),n==null||n()):(clearTimeout(this.timeout),this.timeout=setTimeout(()=>{Im(this.data),n==null||n()},1e3))}catch(s){console.error("Failed to update and send BI",s)}}onCancelOrderRequest(t,r){this.updateAndSend({cancelOrderIdsV1:r===1?t:void 0,cancelOrderIdsV2:r===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 r;this.updateAndSend({action:"crash",actionError:((r=t==null?void 0:t.message)==null?void 0:r.toLowerCase())||(t==null?void 0:t.toLowerCase())})}onTxError(t){var n;const r=((n=t==null?void 0:t.message)==null?void 0:n.toLowerCase())||(t==null?void 0:t.toLowerCase());this.updateAndSend({actionError:r})}onRequestOrder({account:t,chainId:r,module:n,srcToken:s,dstToken:a,fromTokenAmount:o,srcChunkAmount:i,minDstAmountOutPerTrade:c="",triggerPricePerTrade:l="",deadline:u,fillDelay:d,slippage:f,isMarketOrder:h,chunksAmount:y}){this.updateAndSend({toTokenAddress:a.address,toTokenSymbol:a.symbol,fromTokenAddress:s.address,fromTokenSymbol:s.symbol,fromTokenAmount:o,chunksAmount:y,srcChunkAmount:i,minDstAmountOutPerTrade:c,triggerPricePerTrade:l,deadline:u,fillDelay:d,slippage:f,chainId:r,walletAddress:t,module:n,orderType:h?"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,r,n){var s;this.config=t,n!==((s=this.data)==null?void 0:s.chainId)&&(this.data={_id:dd(),action:"module-import",uiVersion:ud,...uw(t,r,n),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:dd(),action:"reset",uiVersion:ud,origin:this.data.origin,spotVersion:Sm,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 dt=new dw,pw=e=>{var o;const t=j(e.order.witness.output.limit||0).gt(1),r=e.order.witness.output.stop,n=j(r||0).eq(Bc),s=j(r||0).gt(0),a=((o=e.metadata.chunks)==null?void 0:o.length)||j(e.order.witness.input.maxAmount).div(j(e.order.witness.input.amount)).toNumber();return n?ze.TAKE_PROFIT:s?t?ze.STOP_LOSS_LIMIT:ze.STOP_LOSS_MARKET:t?a>=1&&t?ze.TWAP_LIMIT:t?ze.LIMIT:ze.TWAP_MARKET:ze.TWAP_MARKET},fw=e=>{var s;const t=((s=e.metadata.chunks)==null?void 0:s.filter(a=>a.status==="success").length)||0,r=e.metadata.expectedChunks||0,n=j(t).dividedBy(r).toNumber();return n>=.99?100:n<=0?0:Number((n*100).toFixed(2))},hw=(e,t)=>e.metadata.status==="completed"||t>=99?ct.Completed:["pending","eligible"].includes(e.metadata.status)?ct.Open:e.metadata.description.toLowerCase()==="cancelled by contract"?ct.Canceled:ct.Expired,mw=e=>{var r;return(((r=e.metadata.chunks)==null?void 0:r.filter(n=>n.status==="success"))||[]).map(n=>({inAmount:n.inAmount,outAmount:n.outAmount,timestamp:new Date(n.timestamp).getTime(),txHash:n.txHash}))},bw=(e,t)=>{var n;const r=e.length;return r>=t&&((n=e[r-1])==null?void 0:n.timestamp)||0},yw=e=>j(e.metadata.displayOnlyInputTokenPriceUSD).dividedBy(1e18).toFixed(),pd=e=>{const t=fw(e),r=j(e.order.witness.output.stop||0).eq(Bc),n=Number(e.order.witness.output.limit)===1?"":e.order.witness.output.limit,s=e.metadata.expectedChunks||1,a=mw(e);return{id:e.hash,hash:e.hash,version:2,type:pw(e),maker:e.order.witness.swapper,progress:t,srcAmountFilled:a.reduce((o,i)=>o.plus(i.inAmount),new j(0)).toFixed()||"",dstAmountFilled:a.reduce((o,i)=>o.plus(i.outAmount),new j(0)).toFixed()||"",fills:a,srcTokenAddress:e.order.witness.input.token,dstTokenAddress:e.order.witness.output.token,orderDollarValueIn:yw(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,dstMinAmountPerTrade:r?"":n,triggerPricePerTrade:r?n:j(e.order.witness.output.stop||"").toFixed(),dstMinAmountTotal:r?"":j(n).multipliedBy(s).toFixed(),srcAmountPerTrade:e.order.witness.input.amount,totalTradesAmount:s,isMarketPrice:j(n||0).lte(1),chainId:e.order.witness.chainid,filledOrderTimestamp:bw(a,s),status:hw(e,t),rawOrder:e}},gw=async({chainId:e,signal:t,account:r,exchange:n})=>{try{if(!r)return[];const s=n?`&exchange=${n}`:"";return(await(await fetch(`${sd()}/orders?swapper=${r}&chainId=${e}${s}`,{signal:t})).json()).orders.map(pd)}catch{return[]}},Bm=async(e,t)=>{try{const r={signature:t,order:e,status:"pending"};console.log("body",r),dt.onCreateOrderRequest();const s=await(await fetch(`${sd()}/orders/new`,{method:"POST",body:JSON.stringify(r)})).json();if(!s.success)throw new Error(`error:${s.message}, code:${s.code}`);const a=pd(s.signedOrder);return dt.onCreateOrderSuccess(a.id),a}catch(r){throw dt.onCreateOrderError(r),console.error(r),r}},yn=(e,t)=>e&&e.length?e.map(t||(r=>`${r}`)):void 0,xw=e=>{if(e)return qh[e]},fd=async({chainId:e,buildQuery:t,extractResults:r,signal:n,retries:s=1,limit:a=1e3,page:o})=>{const i=xw(e);if(!i)throw new Tw;const c=async d=>{let f=0;for(;f<=s;)try{const h=await fetch(i,{method:"POST",body:JSON.stringify({query:d}),signal:n,headers:{"Content-Type":"application/json"}});if(!h.ok)throw new Error(`HTTP error: ${h.status}`);const y=await h.json();if(y.errors)throw new Error(y.errors[0].message);return r(y)}catch(h){if(f===s)throw h;await new Promise(y=>setTimeout(y,500*2**f)),f++}return[]};let l=0;const u=[];if(o!==void 0){const d=t(o,a);try{return await c(d)}catch{console.warn(`Page ${o} failed, retrying one final time...`);try{return await c(d)}catch{return[]}}}for(;;){const d=t(l,a);let f;try{f=await c(d)}catch{console.warn(`Page ${l} failed, retrying one final time...`);try{f=await c(d)}catch{return u}}if(u.push(...f),f.length<a)break;l++}return u},Fm=e=>e.map(t=>({inAmount:t.srcAmountIn,outAmount:t.dstAmountOut,timestamp:t.timestamp,txHash:t.transactionHash})),Um=(e,t)=>{const r=j(e||0).gt(1);return!r&&t===1?ze.TWAP_MARKET:t>1&&r?ze.TWAP_LIMIT:r?ze.LIMIT:ze.TWAP_MARKET},ww=(e,t,r,n)=>{var f;const s=Fm(r||[]),a=new j(e.ask_srcAmount||0).div(e.ask_srcBidAmount).integerValue(j.ROUND_FLOOR).toNumber(),i=(r==null?void 0:r.length)===a?(f=r==null?void 0:r[(r==null?void 0:r.length)-1])==null?void 0:f.timestamp:void 0,c=s.reduce((h,y)=>h.plus(y.inAmount),new j(0)).toFixed(),l=s.reduce((h,y)=>h.plus(y.outAmount),new j(0)).toFixed(),u=Om(e.ask_srcAmount,c),d=Um(e.ask_dstMinAmount,a);return{version:1,id:e.Contract_id.toString(),hash:"",type:Um(e.ask_dstMinAmount,a),srcTokenAddress:e.ask_srcToken,dstTokenAddress:e.ask_dstToken,exchangeAddress:e.exchange,twapAddress:e.twapAddress,maker:e.maker,progress:u,dstAmountFilled:l,srcAmountFilled:c,orderDollarValueIn:j(e.dollarValueIn||0).toFixed(6),srcAmount:e.ask_srcAmount,dstMinAmountTotal:j(e.ask_dstMinAmount).multipliedBy(a).toString(),fills:s,fillDelay:e.ask_fillDelay,deadline:e.ask_deadline*1e3,createdAt:new Date(e.timestamp).getTime(),dstMinAmountPerTrade:j(e.ask_dstMinAmount).eq(1)?"":e.ask_dstMinAmount,triggerPricePerTrade:"",srcAmountPerTrade:e.ask_srcBidAmount,txHash:e.transactionHash,totalTradesAmount:a,isMarketPrice:[ze.TWAP_MARKET].includes(d),chainId:t,filledOrderTimestamp:i||0,status:n,rawOrder:e}},vw=e=>{var d;if(!e)return"";const t=yn(e.accounts,f=>`"${f.toLowerCase()}"`),r=yn(V5(e.configs),f=>`"${f.toLowerCase()}"`),n=yn(e.inTokenSymbols,f=>`"${f.toUpperCase()}"`),s=yn(e.outTokenSymbols,f=>`"${f.toUpperCase()}"`),a=yn(e.inTokenAddresses,f=>`"${f.toLowerCase()}"`),o=yn(e.outTokenAddresses,f=>`"${f.toLowerCase()}"`),i=yn(e.transactionHashes,f=>`"${f.toLowerCase()}"`),c=yn(e.orderIds,f=>`"${f}"`),l=r!=null&&r.length?"":yn((d=e.configs)==null?void 0:d.map(f=>f.twapAddress),f=>`"${f.toLowerCase()}"`),u=e.minDollarValueIn;return[r?`exchange_in: [${r.join(", ")}]`:"",l?`twapAddress_in: [${l.join(", ")}]`:"",t?`maker_in: [${t.join(", ")}]`:"",i?`transactionHash_in: [${i.join(", ")}]`:"",c?`Contract_id_in: [${c.join(", ")}]`:"",u?`dollarValueIn_gte: ${u}`:"",n?`srcTokenSymbol_in: [${n.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 Ew({chainId:e,signal:t,page:r,limit:n,filters:s}){const a=n||1e3,o=vw(s);return await fd({chainId:e,signal:t,limit:a,page:r,buildQuery:(c,l)=>`
|
|
1
|
+
(function(R,B){typeof exports=="object"&&typeof module<"u"?B(exports,require("react/jsx-runtime"),require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom"],B):(R=typeof globalThis<"u"?globalThis:R||self,B(R.SpotReact={},R.jsxRuntime,R.React,R.ReactDOM))})(this,(function(R,B,M,As){"use strict";var NW=Object.defineProperty;var _5=R=>{throw TypeError(R)};var LW=(R,B,M)=>B in R?NW(R,B,{enumerable:!0,configurable:!0,writable:!0,value:M}):R[B]=M;var Ku=(R,B,M)=>LW(R,typeof B!="symbol"?B+"":B,M),Ch=(R,B,M)=>B.has(R)||_5("Cannot "+M);var N=(R,B,M)=>(Ch(R,B,"read from private field"),M?M.call(R):B.get(R)),le=(R,B,M)=>B.has(R)?_5("Cannot add the same private member more than once"):B instanceof WeakSet?B.add(R):B.set(R,M),J=(R,B,M,As)=>(Ch(R,B,"write to private field"),As?As.call(R,M):B.set(R,M),M),Se=(R,B,M)=>(Ch(R,B,"access private method"),M);var Yu=(R,B,M,As)=>({set _(Xu){J(R,B,Xu,M)},get _(){return N(R,B,As)}});var pn,pa,g5,fa,ys,xo,x5,wo,gs,vo,w5,ha,v5,ma,Eo,Ir,ba,Bt,vc,ya,Kr,qn,E5,sr,Oe,Ec,qt,ga,ko,$n,xs,kc,Co,To,xa,wa,ws,Ao,Ve,Ac,Th,Ah,Sh,Ph,Ih,Bh,Fh,M5,k5,Cc,fn,Kt,va,hn,Ts,C5,Gn,Yr,Tc,T5,jn,vs,ar,Vn,Wn,Zu,Uh,A5,mn,S5,ft,Es,ks,So,Po,Cs,Io,Bo,P5;function Xu(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const xt=Xu(M),Dt={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:""},Chronos:{chainName:"arb",chainId:42161,twapVersion:4,twapAddress:"0x0B94dcC0EA2d1ee33Ab064DaC252de980a941eF3",lensAddress:"0x549e1fc9a47FCc0C5C2EbdfF31254cc49fF7164e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"Chronos",partner:"Orbs:TWAP:Chronos",exchangeAddress:"0x0178e50adAF3b925F27aC518FCd952CE7F9A3B36",exchangeType:"ExchangeV2",pathfinderKey:"Chronos Stable,Chronos Volatile,Chronos V3"},BaseSwap:{chainName:"base",chainId:8453,twapVersion:4,twapAddress:"0xc918bdC47264687796Cd54FE362FaC4f8b99Eb55",lensAddress:"0x6313188c1909b161074D62E43105faC9B756A23e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"BaseSwap",partner:"Orbs:TWAP:BaseSwap",exchangeAddress:"0xAca3155c17530C4aA96746F226fcC049658490d2",exchangeType:"ExchangeV2",pathfinderKey:"BaseSwap,BaseSwapX"},Arbidex:{chainName:"arb",chainId:42161,twapVersion:4,twapAddress:"0x0B94dcC0EA2d1ee33Ab064DaC252de980a941eF3",lensAddress:"0x549e1fc9a47FCc0C5C2EbdfF31254cc49fF7164e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"Arbidex",partner:"Orbs:TWAP:Arbidex",exchangeAddress:"0x49d21052f4695d16C7cce6eF561301Aa4d840420",exchangeType:"ExchangeV2",pathfinderKey:"Arbidex Classic,Arbidex Quantum"},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"},SyncSwap:{chainName:"zkSync",chainId:324,twapVersion:4,twapAddress:"0xc32cAA0F7AD9ED88e22Fc214fc24cCb5C0595D68",lensAddress:"0x7daE5af3011c3bE9A5283F0368a3fdD757fc74F9",takers:["0xB924C20c400575D2B73Baa16CF0Fa0EAA720aFBC","0xBE452F03Be354CAC397C3F0c8397672067D44531"],bidDelaySeconds:60,minChunkSizeUsd:100,name:"SyncSwap",partner:"Orbs:TWAP:SyncSwap",exchangeAddress:"0x422623a40c42f026Ed33A9910078Aa843FD66e27",exchangeType:"ExchangeV2",pathfinderKey:"2,3"},Retro:{chainName:"poly",chainId:137,twapVersion:4,twapAddress:"0x688C027B0f7FaCeFcBa73e472900d28c12C5bDF4",lensAddress:"0xe0D4E736fc76af7C256ae7652c8c1e850bfb7849",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"Retro",partner:"Orbs:TWAP:Retro",exchangeAddress:"0xb7A3d74895bFD3Aff6780525e36D79FCf26a895F",exchangeType:"ExchangeV2",pathfinderKey:"retro,retro-v3"},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:{chainName:"sei",chainId:1329,twapVersion:4,twapAddress:"0xde737dB24548F8d41A4a3Ca2Bac8aaaDc4DBA099",lensAddress:"0xa1376f2Bb80D3cF6c2D8ebEf34b3d122e9af4020",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"DragonSwap",partner:"Orbs:TWAP:DragonSwap",exchangeAddress:"0xf2F933FafbDB97062CfA3c447ff373e76A90Efd6",exchangeType:"ExchangeV2",pathfinderKey:""},TeaFi:{chainName:"poly",chainId:137,twapVersion:4,twapAddress:"0x688C027B0f7FaCeFcBa73e472900d28c12C5bDF4",lensAddress:"0xe0D4E736fc76af7C256ae7652c8c1e850bfb7849",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"TeaFi",partner:"Orbs:TWAP:TeaFi",exchangeAddress:"0xE9D3b4Cf5B0CC392e78C1a4DD9885D449EEF9793",exchangeType:"ParaswapExchange",pathfinderKey:"AaveV2,AaveV3,AaveV3Stata,AngleStakedStableEUR,AngleStakedStableUSD,ApeSwap,AugustusRFQ,BalancerV2,ComethSwap,CurveV1,CurveV1Factory,CurveV1StableNg,CurveV2,Dfyn,DODOV2,Dystopia,Hashflow,IronV2,JarvisV6,KyberDmm,QuickSwap,QuickSwapV3,Retro,SushiSwap,SushiSwapV3,SwaapV2,Synapse,UniswapV2,UniswapV3,WaultFinance,Wmatic,WooFiV2,wUSDM"},SparkDEX:{chainName:"flare",chainId:14,twapVersion:4,twapAddress:"0x9D70B0b90915Bb8b9bdAC7e6a7e6435bBF1feC4D",lensAddress:"0xf2d96E7BE676153d202e1453804E2749923C7c5b",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"SparkDEX",partner:"Orbs:TWAP:SparkDEX",exchangeAddress:"0xe59c53C76bB7EEc01401A18fA8215B94bC65Bf56",exchangeType:"P2Exchange"},Ramses:{chainName:"arb",chainId:42161,twapVersion:4,twapAddress:"0x0B94dcC0EA2d1ee33Ab064DaC252de980a941eF3",lensAddress:"0x549e1fc9a47FCc0C5C2EbdfF31254cc49fF7164e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"Ramses",partner:"Orbs:TWAP:Ramses",exchangeAddress:"0x8FCc245209bE85C49D738D0CE5613F74E5d91E86",exchangeType:"ParaswapExchange",pathfinderKey:""},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:""},H2Finance:{chainName:"cronos-zkevm",chainId:388,twapVersion:4,twapAddress:"0xc32cAA0F7AD9ED88e22Fc214fc24cCb5C0595D68",lensAddress:"0x7daE5af3011c3bE9A5283F0368a3fdD757fc74F9",takers:["0xB924C20c400575D2B73Baa16CF0Fa0EAA720aFBC","0xBE452F03Be354CAC397C3F0c8397672067D44531"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"H2Finance",partner:"Orbs:TWAP:H2Finance",exchangeAddress:"0x2f1f10dc311722Be609e6B427bF3FBac6e44093B",exchangeType:"ExchangeV2"},Shadow:{chainName:"sonic",chainId:146,twapVersion:4,twapAddress:"0x8963992816b4EafE5a22b7DB2A99513c18be9afA",lensAddress:"0x67e631F71232D63AcA98a2D5E9B2Bce5FCc39d5D",takers:["0xDF406A27C58a8Cd6Fd43e143339bCE131216a913","0x504f6E10173249dD22491829D98862Cf81DeF79E"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"Shadow",partner:"Orbs:TWAP:Shadow",exchangeAddress:"0x69e3c891450161b7BF27f181eE85E7bAE69E5b07",exchangeType:"ExchangeV2"},Kodiak:{chainName:"berachain",chainId:80094,twapVersion:4,twapAddress:"0xD13609A8ace04D11Ea2FFE176B69dF77C6d9375E",lensAddress:"0xA0b07F9a11dFb01388149abBdbc5B4f2196600AB",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"Kodiak",partner:"Orbs:TWAP:Kodiak",exchangeAddress:"0x69B7aE1250B8d1309954CaD65b6607ae478Ec6eE",exchangeType:"ExchangeV2"},OmniBase:{chainName:"base",chainId:8453,twapVersion:4,twapAddress:"0xc918bdC47264687796Cd54FE362FaC4f8b99Eb55",lensAddress:"0x6313188c1909b161074D62E43105faC9B756A23e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:10,name:"OmniBase",partner:"Orbs:TWAP:OmniBase",exchangeAddress:"0x54435FcFDF3A08150Ed799b6EF472A20a432303F",exchangeType:"ParaswapExchange"},OmniArb:{chainName:"arb",chainId:42161,twapVersion:4,twapAddress:"0x0B94dcC0EA2d1ee33Ab064DaC252de980a941eF3",lensAddress:"0x549e1fc9a47FCc0C5C2EbdfF31254cc49fF7164e",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"OmniArb",partner:"Orbs:TWAP:OmniArb",exchangeAddress:"0xF0607785424d342Cceb33E708f4579CA97a3b392",exchangeType:"ParaswapExchange"},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"},NewEraBnb:{chainName:"bsc",chainId:56,twapVersion:4,twapAddress:"0xa6F7444D2b92Aa9F94a2165c77aAF2B671e63994",lensAddress:"0xEdB0c077fa87Fb21d050c619FF426798f8Fc1264",takers:["0xA05405b6340A7F43dC5835351BFC4f5b1F028359","0xE3Efef1563a5960ACc731F9e4d6f4cBf5bd87dcA"],bidDelaySeconds:60,minChunkSizeUsd:50,name:"NewEraBnb",partner:"Orbs:TWAP:NewEraBnb",exchangeAddress:"0xA22D7Df24d9Ea4D4EF6dC96b2204bd550430eC42",exchangeType:"ExchangeV2"}},N5=[{constant:!1,inputs:[{name:"wad",type:"uint256"}],name:"withdraw",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[],name:"deposit",outputs:[],payable:!0,stateMutability:"payable",type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"dst",type:"address"},{indexed:!1,name:"wad",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"src",type:"address"},{indexed:!1,name:"wad",type:"uint256"}],name:"Withdrawal",type:"event"}],L5=[{inputs:[{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],z5=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"}]'),R5=[{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"}]}],_h=N5,H5=L5,Mh=R5,Nh=z5;var ye=(e=>(e.TWAP="TWAP",e.LIMIT="LIMIT",e.STOP_LOSS="STOP_LOSS",e.TAKE_PROFIT="TAKE_PROFIT",e))(ye||{}),ct=(e=>(e.Open="OPEN",e.Canceled="CANCELED",e.Completed="COMPLETED",e.Expired="EXPIRED",e))(ct||{}),$t=(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))($t||{}),ze=(e=>(e.LIMIT="limit",e.TWAP_LIMIT="twap-limit",e.TWAP_MARKET="twap-market",e.TAKE_PROFIT="take-profit",e.STOP_LOSS_LIMIT="stop-loss-limit",e.STOP_LOSS_MARKET="stop-loss-market",e))(ze||{}),Lh=(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))(Lh||{}),Gt=(e=>(e[e.EMPTY_LIMIT_PRICE=0]="EMPTY_LIMIT_PRICE",e[e.MAX_CHUNKS=1]="MAX_CHUNKS",e[e.MIN_CHUNKS=2]="MIN_CHUNKS",e[e.MIN_TRADE_SIZE=3]="MIN_TRADE_SIZE",e[e.MAX_FILL_DELAY=4]="MAX_FILL_DELAY",e[e.MIN_FILL_DELAY=5]="MIN_FILL_DELAY",e[e.MAX_ORDER_DURATION=6]="MAX_ORDER_DURATION",e[e.MIN_ORDER_DURATION=7]="MIN_ORDER_DURATION",e[e.MISSING_LIMIT_PRICE=8]="MISSING_LIMIT_PRICE",e[e.STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE=9]="STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE",e[e.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE=10]="TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE",e[e.TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE=11]="TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE",e[e.EMPTY_TRIGGER_PRICE=12]="EMPTY_TRIGGER_PRICE",e[e.INSUFFICIENT_BALANCE=13]="INSUFFICIENT_BALANCE",e[e.MAX_ORDER_SIZE=14]="MAX_ORDER_SIZE",e))(Gt||{});const wt="0x0000000000000000000000000000000000000000",Ft={eth:{id:1,name:"Ethereum",shortname:"eth",native:{address:wt,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:wt,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},poly:{id:137,name:"Polygon",shortname:"poly",native:{address:wt,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:wt,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:wt,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:wt,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:wt,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:wt,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.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:wt,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:wt,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:wt,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:wt,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:wt,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:wt,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:wt,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:wt,symbol:"ETH",decimals:18,logoUrl:"https://app.1inch.io/assets/images/network-logos/ethereum.svg"},wToken:{symbol:"WETH",address:"0x4200000000000000000000000000000000000006",decimals:18,logoUrl:"hhttps://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:wt,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:wt,symbol:"ETH",decimals:18,logoUrl:"https://katana.network/assets/katana-logo.svg"},wToken:{symbol:"WETH",address:"0x4200000000000000000000000000000000000006",decimals:18,logoUrl:"https://katana.network/assets/weth-logo.svg"},publicRpcUrl:"https://rpc.katana.network",logoUrl:"https://katana.network/assets/katana-logo.svg",explorer:"https://explorer.katana.garden",eip1559:!0},bera:{id:80094,name:"Bera",shortname:"bera",native:{address:wt,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:"wss://rpc.berachain-apis.com",logoUrl:"https://katana.network/assets/katana-logo.svg",explorer:"https://berascan.com",eip1559:!0},monad:{id:143,name:"Monad",shortname:"monad",native:{address:wt,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}};var $5=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Qu=Math.ceil,yr=Math.floor,Yt="[BigNumber Error] ",zh=Yt+"Number primitive has more than 15 significant digits: ",Fr=1e14,xe=14,Ju=9007199254740991,ed=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Kn=1e7,St=1e9;function Rh(e){var t,r,n,s=w.prototype={constructor:w,toString:null,valueOf:null},a=new w(1),o=20,i=4,c=-7,l=21,u=-1e7,d=1e7,f=!1,h=1,y=0,g={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},E="0123456789abcdefghijklmnopqrstuvwxyz",v=!0;function w(m,b){var x,S,I,F,_,k,P,O,U=this;if(!(U instanceof w))return new w(m,b);if(b==null){if(m&&m._isBigNumber===!0){U.s=m.s,!m.c||m.e>d?U.c=U.e=null:m.e<u?U.c=[U.e=0]:(U.e=m.e,U.c=m.c.slice());return}if((k=typeof m=="number")&&m*0==0){if(U.s=1/m<0?(m=-m,-1):1,m===~~m){for(F=0,_=m;_>=10;_/=10,F++);F>d?U.c=U.e=null:(U.e=F,U.c=[m]);return}O=String(m)}else{if(!$5.test(O=String(m)))return n(U,O,k);U.s=O.charCodeAt(0)==45?(O=O.slice(1),-1):1}(F=O.indexOf("."))>-1&&(O=O.replace(".","")),(_=O.search(/e/i))>0?(F<0&&(F=_),F+=+O.slice(_+1),O=O.substring(0,_)):F<0&&(F=O.length)}else{if(lt(b,2,E.length,"Base"),b==10&&v)return U=new w(m),z(U,o+U.e+1,i);if(O=String(m),k=typeof m=="number"){if(m*0!=0)return n(U,O,k,b);if(U.s=1/m<0?(O=O.slice(1),-1):1,w.DEBUG&&O.replace(/^0\.0*|\./,"").length>15)throw Error(zh+m)}else U.s=O.charCodeAt(0)===45?(O=O.slice(1),-1):1;for(x=E.slice(0,b),F=_=0,P=O.length;_<P;_++)if(x.indexOf(S=O.charAt(_))<0){if(S=="."){if(_>F){F=P;continue}}else if(!I&&(O==O.toUpperCase()&&(O=O.toLowerCase())||O==O.toLowerCase()&&(O=O.toUpperCase()))){I=!0,_=-1,F=0;continue}return n(U,String(m),k,b)}k=!1,O=r(O,b,10,U.s),(F=O.indexOf("."))>-1?O=O.replace(".",""):F=O.length}for(_=0;O.charCodeAt(_)===48;_++);for(P=O.length;O.charCodeAt(--P)===48;);if(O=O.slice(_,++P)){if(P-=_,k&&w.DEBUG&&P>15&&(m>Ju||m!==yr(m)))throw Error(zh+U.s*m);if((F=F-_-1)>d)U.c=U.e=null;else if(F<u)U.c=[U.e=0];else{if(U.e=F,U.c=[],_=(F+1)%xe,F<0&&(_+=xe),_<P){for(_&&U.c.push(+O.slice(0,_)),P-=xe;_<P;)U.c.push(+O.slice(_,_+=xe));_=xe-(O=O.slice(_)).length}else _-=P;for(;_--;O+="0");U.c.push(+O)}}else U.c=[U.e=0]}w.clone=Rh,w.ROUND_UP=0,w.ROUND_DOWN=1,w.ROUND_CEIL=2,w.ROUND_FLOOR=3,w.ROUND_HALF_UP=4,w.ROUND_HALF_DOWN=5,w.ROUND_HALF_EVEN=6,w.ROUND_HALF_CEIL=7,w.ROUND_HALF_FLOOR=8,w.EUCLID=9,w.config=w.set=function(m){var b,x;if(m!=null)if(typeof m=="object"){if(m.hasOwnProperty(b="DECIMAL_PLACES")&&(x=m[b],lt(x,0,St,b),o=x),m.hasOwnProperty(b="ROUNDING_MODE")&&(x=m[b],lt(x,0,8,b),i=x),m.hasOwnProperty(b="EXPONENTIAL_AT")&&(x=m[b],x&&x.pop?(lt(x[0],-St,0,b),lt(x[1],0,St,b),c=x[0],l=x[1]):(lt(x,-St,St,b),c=-(l=x<0?-x:x))),m.hasOwnProperty(b="RANGE"))if(x=m[b],x&&x.pop)lt(x[0],-St,-1,b),lt(x[1],1,St,b),u=x[0],d=x[1];else if(lt(x,-St,St,b),x)u=-(d=x<0?-x:x);else throw Error(Yt+b+" cannot be zero: "+x);if(m.hasOwnProperty(b="CRYPTO"))if(x=m[b],x===!!x)if(x)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))f=x;else throw f=!x,Error(Yt+"crypto unavailable");else f=x;else throw Error(Yt+b+" not true or false: "+x);if(m.hasOwnProperty(b="MODULO_MODE")&&(x=m[b],lt(x,0,9,b),h=x),m.hasOwnProperty(b="POW_PRECISION")&&(x=m[b],lt(x,0,St,b),y=x),m.hasOwnProperty(b="FORMAT"))if(x=m[b],typeof x=="object")g=x;else throw Error(Yt+b+" not an object: "+x);if(m.hasOwnProperty(b="ALPHABET"))if(x=m[b],typeof x=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(x))v=x.slice(0,10)=="0123456789",E=x;else throw Error(Yt+b+" invalid: "+x)}else throw Error(Yt+"Object expected: "+m);return{DECIMAL_PLACES:o,ROUNDING_MODE:i,EXPONENTIAL_AT:[c,l],RANGE:[u,d],CRYPTO:f,MODULO_MODE:h,POW_PRECISION:y,FORMAT:g,ALPHABET:E}},w.isBigNumber=function(m){if(!m||m._isBigNumber!==!0)return!1;if(!w.DEBUG)return!0;var b,x,S=m.c,I=m.e,F=m.s;e:if({}.toString.call(S)=="[object Array]"){if((F===1||F===-1)&&I>=-St&&I<=St&&I===yr(I)){if(S[0]===0){if(I===0&&S.length===1)return!0;break e}if(b=(I+1)%xe,b<1&&(b+=xe),String(S[0]).length==b){for(b=0;b<S.length;b++)if(x=S[b],x<0||x>=Fr||x!==yr(x))break e;if(x!==0)return!0}}}else if(S===null&&I===null&&(F===null||F===1||F===-1))return!0;throw Error(Yt+"Invalid BigNumber: "+m)},w.maximum=w.max=function(){return C(arguments,-1)},w.minimum=w.min=function(){return C(arguments,1)},w.random=(function(){var m=9007199254740992,b=Math.random()*m&2097151?function(){return yr(Math.random()*m)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(x){var S,I,F,_,k,P=0,O=[],U=new w(a);if(x==null?x=o:lt(x,0,St),_=Qu(x/xe),f)if(crypto.getRandomValues){for(S=crypto.getRandomValues(new Uint32Array(_*=2));P<_;)k=S[P]*131072+(S[P+1]>>>11),k>=9e15?(I=crypto.getRandomValues(new Uint32Array(2)),S[P]=I[0],S[P+1]=I[1]):(O.push(k%1e14),P+=2);P=_/2}else if(crypto.randomBytes){for(S=crypto.randomBytes(_*=7);P<_;)k=(S[P]&31)*281474976710656+S[P+1]*1099511627776+S[P+2]*4294967296+S[P+3]*16777216+(S[P+4]<<16)+(S[P+5]<<8)+S[P+6],k>=9e15?crypto.randomBytes(7).copy(S,P):(O.push(k%1e14),P+=7);P=_/7}else throw f=!1,Error(Yt+"crypto unavailable");if(!f)for(;P<_;)k=b(),k<9e15&&(O[P++]=k%1e14);for(_=O[--P],x%=xe,_&&x&&(k=ed[xe-x],O[P]=yr(_/k)*k);O[P]===0;O.pop(),P--);if(P<0)O=[F=0];else{for(F=-1;O[0]===0;O.splice(0,1),F-=xe);for(P=1,k=O[0];k>=10;k/=10,P++);P<xe&&(F-=xe-P)}return U.e=F,U.c=O,U}})(),w.sum=function(){for(var m=1,b=arguments,x=new w(b[0]);m<b.length;)x=x.plus(b[m++]);return x},r=(function(){var m="0123456789";function b(x,S,I,F){for(var _,k=[0],P,O=0,U=x.length;O<U;){for(P=k.length;P--;k[P]*=S);for(k[0]+=F.indexOf(x.charAt(O++)),_=0;_<k.length;_++)k[_]>I-1&&(k[_+1]==null&&(k[_+1]=0),k[_+1]+=k[_]/I|0,k[_]%=I)}return k.reverse()}return function(x,S,I,F,_){var k,P,O,U,L,H,G,Q,pe=x.indexOf("."),me=o,ie=i;for(pe>=0&&(U=y,y=0,x=x.replace(".",""),Q=new w(S),H=Q.pow(x.length-pe),y=U,Q.c=b(bn(xr(H.c),H.e,"0"),10,I,m),Q.e=Q.c.length),G=b(x,S,I,_?(k=E,m):(k=m,E)),O=U=G.length;G[--U]==0;G.pop());if(!G[0])return k.charAt(0);if(pe<0?--O:(H.c=G,H.e=O,H.s=F,H=t(H,Q,me,ie,I),G=H.c,L=H.r,O=H.e),P=O+me+1,pe=G[P],U=I/2,L=L||P<0||G[P+1]!=null,L=ie<4?(pe!=null||L)&&(ie==0||ie==(H.s<0?3:2)):pe>U||pe==U&&(ie==4||L||ie==6&&G[P-1]&1||ie==(H.s<0?8:7)),P<1||!G[0])x=L?bn(k.charAt(1),-me,k.charAt(0)):k.charAt(0);else{if(G.length=P,L)for(--I;++G[--P]>I;)G[P]=0,P||(++O,G=[1].concat(G));for(U=G.length;!G[--U];);for(pe=0,x="";pe<=U;x+=k.charAt(G[pe++]));x=bn(x,O,k.charAt(0))}return x}})(),t=(function(){function m(S,I,F){var _,k,P,O,U=0,L=S.length,H=I%Kn,G=I/Kn|0;for(S=S.slice();L--;)P=S[L]%Kn,O=S[L]/Kn|0,_=G*P+O*H,k=H*P+_%Kn*Kn+U,U=(k/F|0)+(_/Kn|0)+G*O,S[L]=k%F;return U&&(S=[U].concat(S)),S}function b(S,I,F,_){var k,P;if(F!=_)P=F>_?1:-1;else for(k=P=0;k<F;k++)if(S[k]!=I[k]){P=S[k]>I[k]?1:-1;break}return P}function x(S,I,F,_){for(var k=0;F--;)S[F]-=k,k=S[F]<I[F]?1:0,S[F]=k*_+S[F]-I[F];for(;!S[0]&&S.length>1;S.splice(0,1));}return function(S,I,F,_,k){var P,O,U,L,H,G,Q,pe,me,ie,de,Be,X,we,De,Ge,it,Ae=S.s==I.s?1:-1,ve=S.c,be=I.c;if(!ve||!ve[0]||!be||!be[0])return new w(!S.s||!I.s||(ve?be&&ve[0]==be[0]:!be)?NaN:ve&&ve[0]==0||!be?Ae*0:Ae/0);for(pe=new w(Ae),me=pe.c=[],O=S.e-I.e,Ae=F+O+1,k||(k=Fr,O=gr(S.e/xe)-gr(I.e/xe),Ae=Ae/xe|0),U=0;be[U]==(ve[U]||0);U++);if(be[U]>(ve[U]||0)&&O--,Ae<0)me.push(1),L=!0;else{for(we=ve.length,Ge=be.length,U=0,Ae+=2,H=yr(k/(be[0]+1)),H>1&&(be=m(be,H,k),ve=m(ve,H,k),Ge=be.length,we=ve.length),X=Ge,ie=ve.slice(0,Ge),de=ie.length;de<Ge;ie[de++]=0);it=be.slice(),it=[0].concat(it),De=be[0],be[1]>=k/2&&De++;do{if(H=0,P=b(be,ie,Ge,de),P<0){if(Be=ie[0],Ge!=de&&(Be=Be*k+(ie[1]||0)),H=yr(Be/De),H>1)for(H>=k&&(H=k-1),G=m(be,H,k),Q=G.length,de=ie.length;b(G,ie,Q,de)==1;)H--,x(G,Ge<Q?it:be,Q,k),Q=G.length,P=1;else H==0&&(P=H=1),G=be.slice(),Q=G.length;if(Q<de&&(G=[0].concat(G)),x(ie,G,de,k),de=ie.length,P==-1)for(;b(be,ie,Ge,de)<1;)H++,x(ie,Ge<de?it:be,de,k),de=ie.length}else P===0&&(H++,ie=[0]);me[U++]=H,ie[0]?ie[de++]=ve[X]||0:(ie=[ve[X]],de=1)}while((X++<we||ie[0]!=null)&&Ae--);L=ie[0]!=null,me[0]||me.splice(0,1)}if(k==Fr){for(U=1,Ae=me[0];Ae>=10;Ae/=10,U++);z(pe,F+(pe.e=U+O*xe-1)+1,_,L)}else pe.e=O,pe.r=+L;return pe}})();function A(m,b,x,S){var I,F,_,k,P;if(x==null?x=i:lt(x,0,8),!m.c)return m.toString();if(I=m.c[0],_=m.e,b==null)P=xr(m.c),P=S==1||S==2&&(_<=c||_>=l)?Pc(P,_):bn(P,_,"0");else if(m=z(new w(m),b,x),F=m.e,P=xr(m.c),k=P.length,S==1||S==2&&(b<=F||F<=c)){for(;k<b;P+="0",k++);P=Pc(P,F)}else if(b-=_+(S===2&&F>_),P=bn(P,F,"0"),F+1>k){if(--b>0)for(P+=".";b--;P+="0");}else if(b+=F-k,b>0)for(F+1==k&&(P+=".");b--;P+="0");return m.s<0&&I?"-"+P:P}function C(m,b){for(var x,S,I=1,F=new w(m[0]);I<m.length;I++)S=new w(m[I]),(!S.s||(x=Ss(F,S))===b||x===0&&F.s===b)&&(F=S);return F}function D(m,b,x){for(var S=1,I=b.length;!b[--I];b.pop());for(I=b[0];I>=10;I/=10,S++);return(x=S+x*xe-1)>d?m.c=m.e=null:x<u?m.c=[m.e=0]:(m.e=x,m.c=b),m}n=(function(){var m=/^(-?)0([xbo])(?=\w[\w.]*$)/i,b=/^([^.]+)\.$/,x=/^\.([^.]+)$/,S=/^-?(Infinity|NaN)$/,I=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(F,_,k,P){var O,U=k?_:_.replace(I,"");if(S.test(U))F.s=isNaN(U)?null:U<0?-1:1;else{if(!k&&(U=U.replace(m,function(L,H,G){return O=(G=G.toLowerCase())=="x"?16:G=="b"?2:8,!P||P==O?H:L}),P&&(O=P,U=U.replace(b,"$1").replace(x,"0.$1")),_!=U))return new w(U,O);if(w.DEBUG)throw Error(Yt+"Not a"+(P?" base "+P:"")+" number: "+_);F.s=null}F.c=F.e=null}})();function z(m,b,x,S){var I,F,_,k,P,O,U,L=m.c,H=ed;if(L){e:{for(I=1,k=L[0];k>=10;k/=10,I++);if(F=b-I,F<0)F+=xe,_=b,P=L[O=0],U=yr(P/H[I-_-1]%10);else if(O=Qu((F+1)/xe),O>=L.length)if(S){for(;L.length<=O;L.push(0));P=U=0,I=1,F%=xe,_=F-xe+1}else break e;else{for(P=k=L[O],I=1;k>=10;k/=10,I++);F%=xe,_=F-xe+I,U=_<0?0:yr(P/H[I-_-1]%10)}if(S=S||b<0||L[O+1]!=null||(_<0?P:P%H[I-_-1]),S=x<4?(U||S)&&(x==0||x==(m.s<0?3:2)):U>5||U==5&&(x==4||S||x==6&&(F>0?_>0?P/H[I-_]:0:L[O-1])%10&1||x==(m.s<0?8:7)),b<1||!L[0])return L.length=0,S?(b-=m.e+1,L[0]=H[(xe-b%xe)%xe],m.e=-b||0):L[0]=m.e=0,m;if(F==0?(L.length=O,k=1,O--):(L.length=O+1,k=H[xe-F],L[O]=_>0?yr(P/H[I-_]%H[_])*k:0),S)for(;;)if(O==0){for(F=1,_=L[0];_>=10;_/=10,F++);for(_=L[0]+=k,k=1;_>=10;_/=10,k++);F!=k&&(m.e++,L[0]==Fr&&(L[0]=1));break}else{if(L[O]+=k,L[O]!=Fr)break;L[O--]=0,k=1}for(F=L.length;L[--F]===0;L.pop());}m.e>d?m.c=m.e=null:m.e<u&&(m.c=[m.e=0])}return m}function T(m){var b,x=m.e;return x===null?m.toString():(b=xr(m.c),b=x<=c||x>=l?Pc(b,x):bn(b,x,"0"),m.s<0?"-"+b:b)}return s.absoluteValue=s.abs=function(){var m=new w(this);return m.s<0&&(m.s=1),m},s.comparedTo=function(m,b){return Ss(this,new w(m,b))},s.decimalPlaces=s.dp=function(m,b){var x,S,I,F=this;if(m!=null)return lt(m,0,St),b==null?b=i:lt(b,0,8),z(new w(F),m+F.e+1,b);if(!(x=F.c))return null;if(S=((I=x.length-1)-gr(this.e/xe))*xe,I=x[I])for(;I%10==0;I/=10,S--);return S<0&&(S=0),S},s.dividedBy=s.div=function(m,b){return t(this,new w(m,b),o,i)},s.dividedToIntegerBy=s.idiv=function(m,b){return t(this,new w(m,b),0,1)},s.exponentiatedBy=s.pow=function(m,b){var x,S,I,F,_,k,P,O,U,L=this;if(m=new w(m),m.c&&!m.isInteger())throw Error(Yt+"Exponent not an integer: "+T(m));if(b!=null&&(b=new w(b)),k=m.e>14,!L.c||!L.c[0]||L.c[0]==1&&!L.e&&L.c.length==1||!m.c||!m.c[0])return U=new w(Math.pow(+T(L),k?m.s*(2-Sc(m)):+T(m))),b?U.mod(b):U;if(P=m.s<0,b){if(b.c?!b.c[0]:!b.s)return new w(NaN);S=!P&&L.isInteger()&&b.isInteger(),S&&(L=L.mod(b))}else{if(m.e>9&&(L.e>0||L.e<-1||(L.e==0?L.c[0]>1||k&&L.c[1]>=24e7:L.c[0]<8e13||k&&L.c[0]<=9999975e7)))return F=L.s<0&&Sc(m)?-0:0,L.e>-1&&(F=1/F),new w(P?1/F:F);y&&(F=Qu(y/xe+2))}for(k?(x=new w(.5),P&&(m.s=1),O=Sc(m)):(I=Math.abs(+T(m)),O=I%2),U=new w(a);;){if(O){if(U=U.times(L),!U.c)break;F?U.c.length>F&&(U.c.length=F):S&&(U=U.mod(b))}if(I){if(I=yr(I/2),I===0)break;O=I%2}else if(m=m.times(x),z(m,m.e+1,1),m.e>14)O=Sc(m);else{if(I=+T(m),I===0)break;O=I%2}L=L.times(L),F?L.c&&L.c.length>F&&(L.c.length=F):S&&(L=L.mod(b))}return S?U:(P&&(U=a.div(U)),b?U.mod(b):F?z(U,y,i,_):U)},s.integerValue=function(m){var b=new w(this);return m==null?m=i:lt(m,0,8),z(b,b.e+1,m)},s.isEqualTo=s.eq=function(m,b){return Ss(this,new w(m,b))===0},s.isFinite=function(){return!!this.c},s.isGreaterThan=s.gt=function(m,b){return Ss(this,new w(m,b))>0},s.isGreaterThanOrEqualTo=s.gte=function(m,b){return(b=Ss(this,new w(m,b)))===1||b===0},s.isInteger=function(){return!!this.c&&gr(this.e/xe)>this.c.length-2},s.isLessThan=s.lt=function(m,b){return Ss(this,new w(m,b))<0},s.isLessThanOrEqualTo=s.lte=function(m,b){return(b=Ss(this,new w(m,b)))===-1||b===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(m,b){var x,S,I,F,_=this,k=_.s;if(m=new w(m,b),b=m.s,!k||!b)return new w(NaN);if(k!=b)return m.s=-b,_.plus(m);var P=_.e/xe,O=m.e/xe,U=_.c,L=m.c;if(!P||!O){if(!U||!L)return U?(m.s=-b,m):new w(L?_:NaN);if(!U[0]||!L[0])return L[0]?(m.s=-b,m):new w(U[0]?_:i==3?-0:0)}if(P=gr(P),O=gr(O),U=U.slice(),k=P-O){for((F=k<0)?(k=-k,I=U):(O=P,I=L),I.reverse(),b=k;b--;I.push(0));I.reverse()}else for(S=(F=(k=U.length)<(b=L.length))?k:b,k=b=0;b<S;b++)if(U[b]!=L[b]){F=U[b]<L[b];break}if(F&&(I=U,U=L,L=I,m.s=-m.s),b=(S=L.length)-(x=U.length),b>0)for(;b--;U[x++]=0);for(b=Fr-1;S>k;){if(U[--S]<L[S]){for(x=S;x&&!U[--x];U[x]=b);--U[x],U[S]+=Fr}U[S]-=L[S]}for(;U[0]==0;U.splice(0,1),--O);return U[0]?D(m,U,O):(m.s=i==3?-1:1,m.c=[m.e=0],m)},s.modulo=s.mod=function(m,b){var x,S,I=this;return m=new w(m,b),!I.c||!m.s||m.c&&!m.c[0]?new w(NaN):!m.c||I.c&&!I.c[0]?new w(I):(h==9?(S=m.s,m.s=1,x=t(I,m,0,3),m.s=S,x.s*=S):x=t(I,m,0,h),m=I.minus(x.times(m)),!m.c[0]&&h==1&&(m.s=I.s),m)},s.multipliedBy=s.times=function(m,b){var x,S,I,F,_,k,P,O,U,L,H,G,Q,pe,me,ie=this,de=ie.c,Be=(m=new w(m,b)).c;if(!de||!Be||!de[0]||!Be[0])return!ie.s||!m.s||de&&!de[0]&&!Be||Be&&!Be[0]&&!de?m.c=m.e=m.s=null:(m.s*=ie.s,!de||!Be?m.c=m.e=null:(m.c=[0],m.e=0)),m;for(S=gr(ie.e/xe)+gr(m.e/xe),m.s*=ie.s,P=de.length,L=Be.length,P<L&&(Q=de,de=Be,Be=Q,I=P,P=L,L=I),I=P+L,Q=[];I--;Q.push(0));for(pe=Fr,me=Kn,I=L;--I>=0;){for(x=0,H=Be[I]%me,G=Be[I]/me|0,_=P,F=I+_;F>I;)O=de[--_]%me,U=de[_]/me|0,k=G*O+U*H,O=H*O+k%me*me+Q[F]+x,x=(O/pe|0)+(k/me|0)+G*U,Q[F--]=O%pe;Q[F]=x}return x?++S:Q.splice(0,1),D(m,Q,S)},s.negated=function(){var m=new w(this);return m.s=-m.s||null,m},s.plus=function(m,b){var x,S=this,I=S.s;if(m=new w(m,b),b=m.s,!I||!b)return new w(NaN);if(I!=b)return m.s=-b,S.minus(m);var F=S.e/xe,_=m.e/xe,k=S.c,P=m.c;if(!F||!_){if(!k||!P)return new w(I/0);if(!k[0]||!P[0])return P[0]?m:new w(k[0]?S:I*0)}if(F=gr(F),_=gr(_),k=k.slice(),I=F-_){for(I>0?(_=F,x=P):(I=-I,x=k),x.reverse();I--;x.push(0));x.reverse()}for(I=k.length,b=P.length,I-b<0&&(x=P,P=k,k=x,b=I),I=0;b;)I=(k[--b]=k[b]+P[b]+I)/Fr|0,k[b]=Fr===k[b]?0:k[b]%Fr;return I&&(k=[I].concat(k),++_),D(m,k,_)},s.precision=s.sd=function(m,b){var x,S,I,F=this;if(m!=null&&m!==!!m)return lt(m,1,St),b==null?b=i:lt(b,0,8),z(new w(F),m,b);if(!(x=F.c))return null;if(I=x.length-1,S=I*xe+1,I=x[I]){for(;I%10==0;I/=10,S--);for(I=x[0];I>=10;I/=10,S++);}return m&&F.e+1>S&&(S=F.e+1),S},s.shiftedBy=function(m){return lt(m,-Ju,Ju),this.times("1e"+m)},s.squareRoot=s.sqrt=function(){var m,b,x,S,I,F=this,_=F.c,k=F.s,P=F.e,O=o+4,U=new w("0.5");if(k!==1||!_||!_[0])return new w(!k||k<0&&(!_||_[0])?NaN:_?F:1/0);if(k=Math.sqrt(+T(F)),k==0||k==1/0?(b=xr(_),(b.length+P)%2==0&&(b+="0"),k=Math.sqrt(+b),P=gr((P+1)/2)-(P<0||P%2),k==1/0?b="5e"+P:(b=k.toExponential(),b=b.slice(0,b.indexOf("e")+1)+P),x=new w(b)):x=new w(k+""),x.c[0]){for(P=x.e,k=P+O,k<3&&(k=0);;)if(I=x,x=U.times(I.plus(t(F,I,O,1))),xr(I.c).slice(0,k)===(b=xr(x.c)).slice(0,k))if(x.e<P&&--k,b=b.slice(k-3,k+1),b=="9999"||!S&&b=="4999"){if(!S&&(z(I,I.e+o+2,0),I.times(I).eq(F))){x=I;break}O+=4,k+=4,S=1}else{(!+b||!+b.slice(1)&&b.charAt(0)=="5")&&(z(x,x.e+o+2,1),m=!x.times(x).eq(F));break}}return z(x,x.e+o+1,i,m)},s.toExponential=function(m,b){return m!=null&&(lt(m,0,St),m++),A(this,m,b,1)},s.toFixed=function(m,b){return m!=null&&(lt(m,0,St),m=m+this.e+1),A(this,m,b)},s.toFormat=function(m,b,x){var S,I=this;if(x==null)m!=null&&b&&typeof b=="object"?(x=b,b=null):m&&typeof m=="object"?(x=m,m=b=null):x=g;else if(typeof x!="object")throw Error(Yt+"Argument not an object: "+x);if(S=I.toFixed(m,b),I.c){var F,_=S.split("."),k=+x.groupSize,P=+x.secondaryGroupSize,O=x.groupSeparator||"",U=_[0],L=_[1],H=I.s<0,G=H?U.slice(1):U,Q=G.length;if(P&&(F=k,k=P,P=F,Q-=F),k>0&&Q>0){for(F=Q%k||k,U=G.substr(0,F);F<Q;F+=k)U+=O+G.substr(F,k);P>0&&(U+=O+G.slice(F)),H&&(U="-"+U)}S=L?U+(x.decimalSeparator||"")+((P=+x.fractionGroupSize)?L.replace(new RegExp("\\d{"+P+"}\\B","g"),"$&"+(x.fractionGroupSeparator||"")):L):U}return(x.prefix||"")+S+(x.suffix||"")},s.toFraction=function(m){var b,x,S,I,F,_,k,P,O,U,L,H,G=this,Q=G.c;if(m!=null&&(k=new w(m),!k.isInteger()&&(k.c||k.s!==1)||k.lt(a)))throw Error(Yt+"Argument "+(k.isInteger()?"out of range: ":"not an integer: ")+T(k));if(!Q)return new w(G);for(b=new w(a),O=x=new w(a),S=P=new w(a),H=xr(Q),F=b.e=H.length-G.e-1,b.c[0]=ed[(_=F%xe)<0?xe+_:_],m=!m||k.comparedTo(b)>0?F>0?b:O:k,_=d,d=1/0,k=new w(H),P.c[0]=0;U=t(k,b,0,1),I=x.plus(U.times(S)),I.comparedTo(m)!=1;)x=S,S=I,O=P.plus(U.times(I=O)),P=I,b=k.minus(U.times(I=b)),k=I;return I=t(m.minus(x),S,0,1),P=P.plus(I.times(O)),x=x.plus(I.times(S)),P.s=O.s=G.s,F=F*2,L=t(O,S,F,i).minus(G).abs().comparedTo(t(P,x,F,i).minus(G).abs())<1?[O,S]:[P,x],d=_,L},s.toNumber=function(){return+T(this)},s.toPrecision=function(m,b){return m!=null&<(m,1,St),A(this,m,b,2)},s.toString=function(m){var b,x=this,S=x.s,I=x.e;return I===null?S?(b="Infinity",S<0&&(b="-"+b)):b="NaN":(m==null?b=I<=c||I>=l?Pc(xr(x.c),I):bn(xr(x.c),I,"0"):m===10&&v?(x=z(new w(x),o+I+1,i),b=bn(xr(x.c),x.e,"0")):(lt(m,2,E.length,"Base"),b=r(bn(xr(x.c),I,"0"),10,m,S,!0)),S<0&&x.c[0]&&(b="-"+b)),b},s.valueOf=s.toJSON=function(){return T(this)},s._isBigNumber=!0,s[Symbol.toStringTag]="BigNumber",s[Symbol.for("nodejs.util.inspect.custom")]=s.valueOf,e!=null&&w.set(e),w}function gr(e){var t=e|0;return e>0||e===t?t:t-1}function xr(e){for(var t,r,n=1,s=e.length,a=e[0]+"";n<s;){for(t=e[n++]+"",r=xe-t.length;r--;t="0"+t);a+=t}for(s=a.length;a.charCodeAt(--s)===48;);return a.slice(0,s+1||1)}function Ss(e,t){var r,n,s=e.c,a=t.c,o=e.s,i=t.s,c=e.e,l=t.e;if(!o||!i)return null;if(r=s&&!s[0],n=a&&!a[0],r||n)return r?n?0:-i:o;if(o!=i)return o;if(r=o<0,n=c==l,!s||!a)return n?0:!s^r?1:-1;if(!n)return c>l^r?1:-1;for(i=(c=s.length)<(l=a.length)?c:l,o=0;o<i;o++)if(s[o]!=a[o])return s[o]>a[o]^r?1:-1;return c==l?0:c>l^r?1:-1}function lt(e,t,r,n){if(e<t||e>r||e!==yr(e))throw Error(Yt+(n||"Argument")+(typeof e=="number"?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Sc(e){var t=e.c.length-1;return gr(e.e/xe)==t&&e.c[t]%2!=0}function Pc(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function bn(e,t,r){var n,s;if(t<0){for(s=r+".";++t;s+=r);e=s+e}else if(n=e.length,++t>n){for(s=r,t-=n;--t;s+=r);e+=s}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var j=Rh();const ka=(e,t)=>{if(!e||!t)return"";const r=j(10).pow(e||0);return j(t).times(r).idiv(r).div(r).toFixed()};j(0),j(1),j(10),j(1e18);function Ps(e,t){return e==t||e.toLowerCase()==t.toLowerCase()}const Is=e=>!!Yh.find(t=>Ps(t,e||""));function G5(e){return[$t.Years,$t.Months,$t.Weeks,$t.Days,$t.Hours,$t.Minutes].find(r=>r<=e)||$t.Minutes}const Yn=e=>e?e.value*e.unit:0,j5=e=>!e||e==="NaN"?"0":j(e).decimalPlaces(0).toFixed(),Bs=e=>Object.values(Ft).find(t=>t.id===e),V5=e=>{if(!e)return;const t=e.map(a=>_t(a)),r=Object.entries(Zh).filter(([a])=>t.includes(a)).flatMap(([,a])=>a),n=e.map(a=>a.exchangeAddress),s=new Set([...n,...r].map(a=>a.toLowerCase()));return Array.from(s)},td=(e,t)=>e.version===1?(e.fillDelay||0)*1e3+pm(t):(e.fillDelay||0)*1e3,Uo=e=>typeof window>"u"?null:new URLSearchParams(window.location.search).get(e),Hh=e=>km().filter(t=>t.name===e).map(t=>t.chainId),$h=(e,t,r)=>{if(!j(e.srcAmountFilled||0).gt(0)||!j(e.dstAmountFilled||0).gt(0))return"";const n=ka(t,e.srcAmountFilled),s=ka(r,e.dstAmountFilled);return j(s).div(n).toFixed()},Gh=(e,t,r)=>{if(e.type===ze.TWAP_MARKET)return"";const n=ka(t,e.srcAmountPerTrade),s=ka(r,e.dstMinAmountPerTrade);return j(s).div(n).toFixed()},jh=(e,t,r)=>{if(e.type===ze.TWAP_MARKET)return"";const n=ka(t,e.srcAmountPerTrade),s=ka(r,e.triggerPricePerTrade);return j(s).div(n).toFixed()},Vh="https://order-sink-dev.orbs.network",rd="https://order-sink.orbs.network";let nd;const W5=e=>{nd=e},sd=()=>{const e=Uo("env");return e==="prod"?rd:e==="dev"?Vh:nd==="prod"?rd:nd==="dev"?Vh:rd},q5=100,K5=1,Ic=300*1e3,Ca=365*24*60*60*1e3,ad=300*1e3,Wh=new Date(Ic).getMinutes(),od=e=>`https://hub.orbs.network/api/private/project_cm7nb67z86nyr01z12gs0fxpf/subgraphs/orbs-twap-${e}/prod/gn`,Ur="https://hub.orbs.network/api/apikey/subgraphs/id",qh={[Ft.eth.id]:`${Ur}/Bf7bvMYcJbDAvYWJmhMpHZ4cpFjqzkhK6GXXEpnPRq6`,[Ft.bsc.id]:`${Ur}/4NfXEi8rreQsnAr4aJ45RLCKgnjcWX46Lbt9SadiCcz6`,[Ft.poly.id]:`${Ur}/3PyRPWSvDnMowGbeBy7aNsvUkD5ZuxdXQw2RdJq4NdXi`,[Ft.arb.id]:`${Ur}/83bpQexEaqBjHaQbKoFTbtvCXuo5RudRkfLgtRUYqo2c`,[Ft.base.id]:`${Ur}/DFhaPQb3HATXkpsWNZw3gydYHehLBVEDiSk4iBdZJyps`,[Ft.sei.id]:`${Ur}/5zjzRnURzoddyFSZBw5E5NAM3oBgPq3NasTYbtMk6EL6`,[Ft.linea.id]:`${Ur}/6VsNPEYfFLPZCqdMMDadoXQjLHWJdjEwiD768GAtb7j6`,[Ft.sonic.id]:`${Ur}/DtBr6a5vsoDd2oAXdPszcn4gLgrr1XC68Q3AJQKXnNLV`,[Ft.ftm.id]:`${Ur}/DdRo1pmJkrJC9fjsjEBWnNE1uqrbh7Diz4tVKd7rfupp`,[Ft.katana.id]:`${Ur}/CGi9sDFMQcnBwF3C3NoCFqnaE34sssbgwPLTwiskSXmW`,[Ft.avax.id]:`${Ur}/FxZ1vMwE5Xy1qvKvZENUMz4vhW8Sh4vXJf9Vp7o17pTx`,[Ft.bera.id]:od("berachain"),[Ft.flare.id]:od("flare"),[Ft.cronosZkEvm.id]:od("cronos-zkevm")},Kh="0x0000000000000000000000000000000000000000",Yh=[Kh,"0x0000000000000000000000000000000000001010","0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","0x000000000000000000000000000000000000dEaD","0x000000000000000000000000000000000000800A","0x000000000000000000000000000000000000800a"],Bc="115792089237316195423570985008687907853269984665640564039457584007913129639935",_t=e=>`${e.name}_${e.chainId}`,Zh={[_t(Dt.SushiArb)]:["0x846F2B29ef314bF3D667981b4ffdADc5B858312a","0x08c41f5D1C844061f6D952E25827eeAA576c6536"],[_t(Dt.SushiBase)]:["0x846F2B29ef314bF3D667981b4ffdADc5B858312a","0x08c41f5D1C844061f6D952E25827eeAA576c6536"],[_t(Dt.SushiEth)]:["0xc55943Fa6509004B2903ED8F8ab7347BfC47D0bA","0x08c41f5D1C844061f6D952E25827eeAA576c6536"],[_t(Dt.PancakeSwap)]:["0xb2BAFe188faD927240038cC4FfF2d771d8A58905","0xE2a0c3b9aD19A18c4bBa7fffBe5bC1b0E58Db1CE"],[_t(Dt.PancakeSwapArbitrum)]:["0xE20167871dB616DdfFD0Fd870d9bC068C350DD1F","0x807488ADAD033e95C438F998277bE654152594dc"],[_t(Dt.PancakeSwapBase)]:["0x10ed1F36e4eBE76E161c9AADDa20BE841bc0082c","0x3A9df3eE209b802D0337383f5abCe3204d623588"],[_t(Dt.PancakeSwapLinea)]:["0x3A9df3eE209b802D0337383f5abCe3204d623588"],[_t(Dt.QuickSwap)]:["0x26D0ec4Be402BCE03AAa8aAf0CF67e9428ba54eF"],[_t(Dt.Thena)]:["0xc2aBC02acd77Bb2407efA22348dA9afC8B375290"],[_t(Dt.Lynex)]:["0x72e3e1fD5D2Ee2F1C2Eb695206D490a1D45C3835"],[_t(Dt.DragonSwap)]:["0x101e1B65Bb516FB5f4547C80BAe0b51f1b8D7a22"],[_t(Dt.SpookySwapSonic)]:["0xAd97B770ad64aE47fc7d64B3bD820dCDbF9ff7DA"],[_t(Dt.SpookySwap)]:["0x3924d62219483015f982b160d48c0fa5Fd436Cba"],[_t(Dt.SwapX)]:["0xE5012eBDe5e26EE3Ea41992154731a03023CF274"]},Fc={unit:$t.Minutes,value:Wh},Y5=.25,Z5="100",Xh="RePermitWitnessTransferFrom",Qh={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:"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:"stop",type:"uint256"},{name:"recipient",type:"address"}],TokenPermissions:[{name:"token",type:"address"},{name:"amount",type:"uint256"}]},id="https://www.orbs.com/dtwap-and-dlimit-faq/",X5="https://www.orbs.com/dtwap-and-dlimit-faq/#dSLTP",Q5="https://raw.githubusercontent.com/orbs-network/twap-ui/master/logo/orbslogo.svg",J5="https://www.orbs.com/assets/img/common/logo.svg",ew="https://www.orbs.com/",tw="https://www.orbs.com/dtwap-dlimit-disclaimer";var Ta=(e=>(e.FRESHNESS="freshness",e.MIN_CHUNK_SIZE_USD="minChunkSizeUsd",e.ENV="env",e.DURATION="duration",e.IGNORE_ERRORS="ignore-errors",e))(Ta||{});const Jh="-5",em="10",tm="-10",rm="5",rw="Something went wrong";function nw(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,s.get?s:{enumerable:!0,get:function(){return e[n]}})}),r}function sw(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 aw={1:{dex:{sushiswap:{type:"default:sushi",router:"0xAC4c6e212A361c968F1725b4d055b47E63F80b75",adapter:"0x3Ee50D79e6D0205f325928AAFb041b63E1767Bc5",fee:"0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc"}}},14:{dex:{spark:{type:"default:spark",adapter:"0xB18c633B6584A33E45a8840a759f56dF17117b1D",fee:"0xaeA8C3e1a129A77686E115b1a46D9aD8405F7D2b"}}},56:{dex:{thena:{type:"default:odos-v2",adapter:"0xB75218ba5A99bF57Fd02556B70F05A4A0f1Dbe67",fee:"0x15eBc8b5b3877512FFF23650188694A9a8891FAc"},pancake:{type:"p2:pancakeswap-v2",adapter:"0x654272F7e6e6E912D38650f783eFd44452fD6ee5",fee:"0x37A957f10F458e0d7fDECBE2917971b57F15c927"},newera:{type:"default:odos-v2",adapter:"0x845f459271D800f6Ab32D78400b8Aa18414E80b0",fee:"0x4E7454909eB6D539111D56b50d68897E933D2d11"}}},137:{dex:{quick:{type:"paraswap:paraswap-v5",adapter:"0x023fD6848234f2655818705237F77F02215FEfe5",fee:"0xd207DC6a6dA88f27c8DB78201F974161b1d84b1f"},teafi:{type:"paraswap:paraswap-v5",adapter:"0xe95db7a60164B112C64cE67bA8587b1d4a0E0D29",fee:"0x04Ff96e2c4D62b5771795d307AD679a25b3D2D50"}}},143:{dex:{yowie:{type:"default:openocean-v2",adapter:"0x18bc9533c3539073B9A9acF12b0AbF7cB73e0F1f",fee:"0x6AF3eE77A3A3257777F5649aFa611b4C7Fd975Ef"},pangolin:{type:"default:kyber-v2",adapter:"0xd7D9CAA2910f49F37AC3447f5cAd27153944354A",fee:"0xde92da99D188Ceb54A11ec711EF52D808A6260B5"}}},146:{dex:{spooky:{type:"default:magpie-v3",adapter:"0xdCee7FDdB932104329d528144Cd17A408722B7e2",fee:"0x840Df4684B35BC68BcdA3F6707A3c82A0D662f8b"},swapx:{type:"default:openocean-v2",adapter:"0xecc733D6F6f2DEa341832D650E30822118884FEb",fee:"0x6E03f7BC0f141894612AA017796096399623895F"},shadow:{type:"default:magpie-v3",adapter:"0x5f3E5F6ACCfc65243A01Da3E93b5A700285592C3",fee:"0xb9e3751fAF3187E1bC468E56a707a8A91754460e"}}},1329:{dex:{dragon:{type:"default:dragon",adapter:"0x02d9d5882129241b67ec21Ebc2C86e1BE9BC9890",fee:"0x0dc1E0525202b32e89bA78ed55b1e5cEdB751334"},nami:{type:"default:openocean-v2",adapter:"0x2D4A1237A98f8cb03C3C85960e859aA44036a306",fee:"0xeB58450e23632003f013568703F54446070E2E80"}}},8453:{dex:{quick:{type:"default:kyber-v2",adapter:"0xc73F03c929A123Ee2f3A98EC18BB240f03980AE5",fee:"0xd207DC6a6dA88f27c8DB78201F974161b1d84b1f"},sushiswap:{type:"default:sushi",router:"0xAC4c6e212A361c968F1725b4d055b47E63F80b75",adapter:"0x3Ee50D79e6D0205f325928AAFb041b63E1767Bc5",fee:"0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc"}}},42161:{dex:{arbidex:{type:"default:odos-v2",adapter:"0xa734b32151108139e48dCA06eE721538d90A9Ef6",fee:"0xa0c11852f8A44e32F9EC10AD25986A53842f72Ca"},ramses:{type:"paraswap:paraswap-v5",adapter:"0x023fD6848234f2655818705237F77F02215FEfe5",fee:"0xB5BaCB60ECDa0bEF809B2A26eC9B4B926835D7af"},omni:{type:"paraswap:paraswap-v5",adapter:"0xa1baE146161223cd9dCa7137F68eb385934130BE",fee:"0xba5291526c30B097E9F1Fd1Be301E2ab6E0782aa"},chronos:{type:"default:odos-v2",adapter:"0x4Ff90F32aceD08b3e3257B018EA495Fd1Bfe4455",fee:"0x5729af83240EFecAa18eafaAE82961c2DD045Dbe"},sushiswap:{type:"default:sushi",router:"0xAC4c6e212A361c968F1725b4d055b47E63F80b75",adapter:"0x3Ee50D79e6D0205f325928AAFb041b63E1767Bc5",fee:"0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc"}}},43114:{dex:{blackhole:{type:"default:kyber-v2",adapter:"0x426ec4bc0d58B80959CDE77576a1942dd40592Fa",fee:"0x7f8B62520D9B5DA0ED517cc36e8dcb2a356f1928"},pangolin:{type:"default:kyber-v2",adapter:"0xd7D9CAA2910f49F37AC3447f5cAd27153944354A",fee:"0xde92da99D188Ceb54A11ec711EF52D808A6260B5"}}},59144:{dex:{lynex:{type:"default:openocean",adapter:"0x4FF6A97A67fe395212f168f011D71fE79E4396f2",fee:"0xcb36ed1B1BfAD8F7FC9651f52d21f04A68677423"}}},80094:{dex:{kodiak:{type:"default:kodiak",adapter:"0xBbaa527Aac00b1Ee9A3909D4D8c4447630E29B1F",fee:"0xBA47Ec15aFbCF6e7e9F52900632049530bB6bAe4"}}},747474:{dex:{sushiswap:{type:"default:sushi",router:"0xAC4c6e212A361c968F1725b4d055b47E63F80b75",adapter:"0x3Ee50D79e6D0205f325928AAFb041b63E1767Bc5",fee:"0x28F6C9dBE21fFc146Af8d5D15c49Cf48F61140Dc"}}},"*":{wm:"0x0005d5cE0dB57e5BE3b2b8b6FeB75f0ccd015000",repermit:"0x00002a9C4D9497df5Bd31768eC5d30eEf5405000",cosigner:"0x0007ec53404c423C935e830ec21903e184690000",reactor:"0x0006a959430e8fBB858D81B2D1140B0ae5c26001",executor:"0x000eBA869d76C618ddc4A6D685A0820A620Ce002",refinery:"0x000E474c0D7084EAA35A501035E73269f4b009A5",salt:{wm:"0xc9b46eae42dfeba3222a0315bf682f33cd5cc9d60c9625642e88406f8415f152",repermit:"0x4871dc9008e605821ea9677b65ea2a60ffb774afb31e0dcaea2e192880096be7",cosigner:"0x37576f2ac1d2a602f00777611edf6f0cbc27611b0980b29bc7856fa79b2b8073",reactor:"0x034169222370f2fd587ef8998082d762cceef58a272330215f5110ec0d76d400",executor:"0xea139bc421fa5e272bed3db74233b2e02077e0aacf8b855f87961e98f2fb467f",refinery:"0x9746de29f1dd31b2c8460d71e92a7aefa34911130e61f274f37776e598c48bec"}}};var cd,nm;function ow(){if(nm)return cd;nm=1;const e=aw,t=s=>sw(`./out/${s}.sol/${s}.json`).abi,r=()=>({wm:t("WM"),repermit:t("RePermit"),reactor:t("OrderReactor"),executor:t("Executor"),refinery:t("Refinery"),adapter:t("DefaultDexAdapter")});function n(s,a){if(!s||!(a!=null&&a.trim()))return;const{dex:o,...i}=e["*"]??{},c=e[s];if(!c)return;const{dex:l,...u}=c,d=l==null?void 0:l[a];if(d)return{...i,...u,...d}}return cd={config:n,abis:r,raw:e},cd}var sm=ow();const am=(e,t,r)=>{if(!e||!t||!r)return;const n=j(e).times(t),s=j(10).pow(r);return n.div(s).toFixed(0)},om=(e,t,r,n)=>{if(r||!n||!e||!t)return j(0).toString();const s=j(e).times(j(t)),a=j(10).pow(n),o=s.div(a);return j.max(1,o).integerValue(j.ROUND_FLOOR).toFixed(0)},im=(e,t,r,n)=>{if(e===ye.TWAP||e===ye.LIMIT)return"0";if(!n||!t||!r)return;const s=j(t).times(j(r)),a=j(10).pow(n),o=s.div(a);return j.max(1,o).integerValue(j.ROUND_FLOOR).toFixed(0)||"0"},cm=(e,t,r,n)=>{const s=Yn(r)*2*t,a=Uo(Ta.DURATION),o=G5(a?Number(a):s);return a?{unit:o,value:Number(j(Number(a)/o).toFixed(2))}:n||(e===ye.LIMIT?{unit:$t.Days,value:7}:e===ye.STOP_LOSS||e===ye.TAKE_PROFIT?{unit:$t.Days,value:1}:{unit:o,value:Number(j(s/o).toFixed(2))})},lm=(e,t,r)=>t!==ye.TWAP?1:r!==void 0?r:e,um=(e,t,r,n)=>{if(!t||!r||!n)return 1;const a=j(r).times(t).div(n).integerValue(j.ROUND_FLOOR).toNumber(),o=Math.floor(Ca/2/Yn(e));return Math.max(1,Math.min(a,o))},dm=(e,t)=>e+Yn(t)+6e4,pm=e=>e.bidDelaySeconds*1e3*2,fm=(e="",t=0)=>!e||!t?"0":j(e).div(t).integerValue(j.ROUND_FLOOR).toFixed(0),iw=(e,t)=>({isError:!(e.unit===Fc.unit&&e.value===Fc.value)&&Yn(e)*t>Ca,value:Math.floor(Ca/t)}),hm=(e="",t="",r)=>{if(r===ye.STOP_LOSS)return{isError:j(t||0).gte(j(e||0)),value:e}},mm=(e="",t="",r)=>{if(r===ye.TAKE_PROFIT)return{isError:j(t||0).lte(j(e||0)),value:e}},bm=(e="",t="",r=!1,n)=>{if(!r&&n===ye.STOP_LOSS)return{isError:j(t||0).gte(j(e||0)),value:e}},ym=(e="",t="",r=!1,n)=>{if(!r&&n===ye.TAKE_PROFIT)return{isError:j(t||0).gte(j(e||0)),value:e}},gm=(e,t)=>e===ye.STOP_LOSS||e===ye.TAKE_PROFIT?{isError:Yn(t)>5184e6,value:5184e6}:{isError:Yn(t)>Ca,value:Ca},xm=e=>({isError:Yn(e)<ad,value:ad}),wm=e=>({isError:Yn(e)<Ic,value:Ic}),vm=(e,t,r)=>({isError:j(t||0).multipliedBy(e||0).isLessThan(r),value:r}),Em=(e,t,r)=>({isError:r===ye.TWAP&&j(e).isGreaterThan(t),value:t}),ld=(e,t=0)=>{var o;const r=(o=Object.entries(Dt).find(([i,c])=>c.chainId===t&&i.toLowerCase().indexOf(e.toLowerCase())>=0))==null?void 0:o[1],{abi:n,...s}=sm.config(t,e);return{...s,partner:e,twapConfig:r}},km=()=>{const e=sm.raw;return Object.entries(e).filter(([t])=>t!=="*").flatMap(([t,r])=>{const n=r==null?void 0:r.dex;return!n||typeof n!="object"?[]:Object.entries(n).map(([s])=>({chainId:Number(t),name:s,config:ld(s,Number(t))}))}).sort((t,r)=>t.name.localeCompare(r.name))},Cm=e=>{const t=Uo(Ta.MIN_CHUNK_SIZE_USD);return t?parseInt(t):e},Tm=({marketPrice:e,typedInputAmount:t,srcUsd1Token:r,marketPriceLoading:n,triggerPriceError:s,limitPriceError:a,tradesError:o,fillDelayError:i,durationError:c,balanceError:l})=>{if(!Uo(Ta.IGNORE_ERRORS)&&!(j(e||0).isZero()||j(t||0).isZero()||j(r||"0").isZero()||n))return s||a||o||i||c||l},Am=({chainId:e,srcToken:t,dstToken:r,srcAmount:n,deadlineMillis:s,fillDelayMillis:a,slippage:o,account:i,srcAmountPerTrade:c,dstMinAmountPerTrade:l="0",triggerAmountPerTrade:u="0",config:d,module:f})=>{const h=Date.now().toString(),y=parseInt((a/1e3).toFixed(0)),g=j5(s/1e3),E=Uo(Ta.FRESHNESS),v=E?parseInt(E):60,w=f===ye.TAKE_PROFIT?Bc:u,A=f===ye.TAKE_PROFIT?u:l,C={permitted:{token:t,amount:n},spender:d.reactor,nonce:h,deadline:g,witness:{reactor:d.reactor,executor:d.executor,exchange:{adapter:d.adapter,ref:d.fee,share:0,data:"0x"},swapper:i,nonce:h,deadline:g,chainid:e,exclusivity:0,epoch:y,slippage:o,freshness:v,input:{token:t,amount:c,maxAmount:n},output:{token:r,limit:j(A||0).toFixed(),stop:j(w||0).toFixed(),recipient:i}}};return{domain:{name:"RePermit",version:"1",chainId:e,verifyingContract:d.repermit},order:C,types:Qh,primaryType:Xh}},cw={version:"1.9.3"},lw=`https://bi.orbs.network/putes/twap-ui-${.7}`,Sm=cw.version;let ud="unknown";function Pm(e){ud=e}function dd(){const e=Math.random().toString(36).substring(2,16),t=Math.random().toString(36).substring(2,16),r=Date.now().toString(36);return`id_${e+t+r}`}const uw=(e,t,r)=>{var n,s,a,o,i,c,l,u,d;return{spotVersion:Sm,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:((n=e.twapConfig)==null?void 0:n.chainName)||"",chainId:r||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:((i=e.twapConfig)==null?void 0:i.bidDelaySeconds)||0,minChunkSizeUsd:t,name:((c=e.twapConfig)==null?void 0:c.name)||"",exchangeAddress:((l=e.twapConfig)==null?void 0:l.exchangeAddress)||"",exchangeType:((u=e.twapConfig)==null?void 0:u.exchangeType)||"",pathfinderKey:((d=e.twapConfig)==null?void 0:d.pathfinderKey)||""}},Im=async e=>{try{await fetch(lw,{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 dw{constructor(){Ku(this,"timeout");Ku(this,"config");Ku(this,"data",{_id:dd()})}async updateAndSend(t={},r=!1,n){try{this.data={...this.data,...t},r?(await Im(this.data),n==null||n()):(clearTimeout(this.timeout),this.timeout=setTimeout(()=>{Im(this.data),n==null||n()},1e3))}catch(s){console.error("Failed to update and send BI",s)}}onCancelOrderRequest(t,r){this.updateAndSend({cancelOrderIdsV1:r===1?t:void 0,cancelOrderIdsV2:r===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 r;this.updateAndSend({action:"crash",actionError:((r=t==null?void 0:t.message)==null?void 0:r.toLowerCase())||(t==null?void 0:t.toLowerCase())})}onTxError(t){var n;const r=((n=t==null?void 0:t.message)==null?void 0:n.toLowerCase())||(t==null?void 0:t.toLowerCase());this.updateAndSend({actionError:r})}onRequestOrder({account:t,chainId:r,module:n,srcToken:s,dstToken:a,fromTokenAmount:o,srcChunkAmount:i,minDstAmountOutPerTrade:c="",triggerPricePerTrade:l="",deadline:u,fillDelay:d,slippage:f,isMarketOrder:h,chunksAmount:y}){this.updateAndSend({toTokenAddress:a.address,toTokenSymbol:a.symbol,fromTokenAddress:s.address,fromTokenSymbol:s.symbol,fromTokenAmount:o,chunksAmount:y,srcChunkAmount:i,minDstAmountOutPerTrade:c,triggerPricePerTrade:l,deadline:u,fillDelay:d,slippage:f,chainId:r,walletAddress:t,module:n,orderType:h?"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,r,n){var s;this.config=t,n!==((s=this.data)==null?void 0:s.chainId)&&(this.data={_id:dd(),action:"module-import",uiVersion:ud,...uw(t,r,n),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:dd(),action:"reset",uiVersion:ud,origin:this.data.origin,spotVersion:Sm,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 dt=new dw,pw=e=>{var o;const t=j(e.order.witness.output.limit||0).gt(1),r=e.order.witness.output.stop,n=j(r||0).eq(Bc),s=j(r||0).gt(0),a=((o=e.metadata.chunks)==null?void 0:o.length)||j(e.order.witness.input.maxAmount).div(j(e.order.witness.input.amount)).toNumber();return n?ze.TAKE_PROFIT:s?t?ze.STOP_LOSS_LIMIT:ze.STOP_LOSS_MARKET:t?a>1&&t?ze.TWAP_LIMIT:t?ze.LIMIT:ze.TWAP_MARKET:ze.TWAP_MARKET},fw=e=>{var s;const t=((s=e.metadata.chunks)==null?void 0:s.filter(a=>a.status==="success").length)||0,r=e.metadata.expectedChunks||0,n=j(t).dividedBy(r).toNumber();return n>=.99?100:n<=0?0:Number((n*100).toFixed(2))},hw=(e,t)=>e.metadata.status==="completed"||t>=99?ct.Completed:["pending","eligible"].includes(e.metadata.status)?ct.Open:e.metadata.description.toLowerCase()==="cancelled by contract"?ct.Canceled:ct.Expired,mw=e=>{var r;return(((r=e.metadata.chunks)==null?void 0:r.filter(n=>n.status==="success"))||[]).map(n=>({inAmount:n.inAmount,outAmount:n.outAmount,timestamp:new Date(n.timestamp).getTime(),txHash:n.txHash}))},bw=(e,t)=>{var n;const r=e.length;return r>=t&&((n=e[r-1])==null?void 0:n.timestamp)||0},yw=e=>j(e.metadata.displayOnlyInputTokenPriceUSD).dividedBy(1e18).toFixed(),pd=e=>{const t=fw(e),r=j(e.order.witness.output.stop||0).eq(Bc),n=Number(e.order.witness.output.limit)===1?"":e.order.witness.output.limit,s=e.metadata.expectedChunks||1,a=mw(e);return{id:e.hash,hash:e.hash,version:2,type:pw(e),maker:e.order.witness.swapper,progress:t,srcAmountFilled:a.reduce((o,i)=>o.plus(i.inAmount),new j(0)).toFixed()||"",dstAmountFilled:a.reduce((o,i)=>o.plus(i.outAmount),new j(0)).toFixed()||"",fills:a,srcTokenAddress:e.order.witness.input.token,dstTokenAddress:e.order.witness.output.token,orderDollarValueIn:yw(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,dstMinAmountPerTrade:r?"":n,triggerPricePerTrade:r?n:j(e.order.witness.output.stop||"").toFixed(),dstMinAmountTotal:r?"":j(n).multipliedBy(s).toFixed(),srcAmountPerTrade:e.order.witness.input.amount,totalTradesAmount:s,isMarketPrice:j(n||0).lte(1),chainId:e.order.witness.chainid,filledOrderTimestamp:bw(a,s),status:hw(e,t),rawOrder:e}},gw=async({chainId:e,signal:t,account:r,exchange:n})=>{try{if(!r)return[];const s=n?`&exchange=${n}`:"";return(await(await fetch(`${sd()}/orders?swapper=${r}&chainId=${e}${s}`,{signal:t})).json()).orders.map(pd)}catch{return[]}},Bm=async(e,t)=>{try{const r={signature:t,order:e,status:"pending"};console.log("body",r),dt.onCreateOrderRequest();const s=await(await fetch(`${sd()}/orders/new`,{method:"POST",body:JSON.stringify(r)})).json();if(!s.success)throw new Error(`error:${s.message}, code:${s.code}`);const a=pd(s.signedOrder);return dt.onCreateOrderSuccess(a.id),a}catch(r){throw dt.onCreateOrderError(r),console.error(r),r}},yn=(e,t)=>e&&e.length?e.map(t||(r=>`${r}`)):void 0,xw=e=>{if(e)return qh[e]},fd=async({chainId:e,buildQuery:t,extractResults:r,signal:n,retries:s=1,limit:a=1e3,page:o})=>{const i=xw(e);if(!i)throw new Tw;const c=async d=>{let f=0;for(;f<=s;)try{const h=await fetch(i,{method:"POST",body:JSON.stringify({query:d}),signal:n,headers:{"Content-Type":"application/json"}});if(!h.ok)throw new Error(`HTTP error: ${h.status}`);const y=await h.json();if(y.errors)throw new Error(y.errors[0].message);return r(y)}catch(h){if(f===s)throw h;await new Promise(y=>setTimeout(y,500*2**f)),f++}return[]};let l=0;const u=[];if(o!==void 0){const d=t(o,a);try{return await c(d)}catch{console.warn(`Page ${o} failed, retrying one final time...`);try{return await c(d)}catch{return[]}}}for(;;){const d=t(l,a);let f;try{f=await c(d)}catch{console.warn(`Page ${l} failed, retrying one final time...`);try{f=await c(d)}catch{return u}}if(u.push(...f),f.length<a)break;l++}return u},Fm=e=>e.map(t=>({inAmount:t.srcAmountIn,outAmount:t.dstAmountOut,timestamp:t.timestamp,txHash:t.transactionHash})),Um=(e,t)=>{const r=j(e||0).gt(1);return!r&&t===1?ze.TWAP_MARKET:t>1&&r?ze.TWAP_LIMIT:r?ze.LIMIT:ze.TWAP_MARKET},ww=(e,t,r,n)=>{var f;const s=Fm(r||[]),a=new j(e.ask_srcAmount||0).div(e.ask_srcBidAmount).integerValue(j.ROUND_FLOOR).toNumber(),i=(r==null?void 0:r.length)===a?(f=r==null?void 0:r[(r==null?void 0:r.length)-1])==null?void 0:f.timestamp:void 0,c=s.reduce((h,y)=>h.plus(y.inAmount),new j(0)).toFixed(),l=s.reduce((h,y)=>h.plus(y.outAmount),new j(0)).toFixed(),u=Om(e.ask_srcAmount,c),d=Um(e.ask_dstMinAmount,a);return{version:1,id:e.Contract_id.toString(),hash:"",type:Um(e.ask_dstMinAmount,a),srcTokenAddress:e.ask_srcToken,dstTokenAddress:e.ask_dstToken,exchangeAddress:e.exchange,twapAddress:e.twapAddress,maker:e.maker,progress:u,dstAmountFilled:l,srcAmountFilled:c,orderDollarValueIn:j(e.dollarValueIn||0).toFixed(6),srcAmount:e.ask_srcAmount,dstMinAmountTotal:j(e.ask_dstMinAmount).multipliedBy(a).toString(),fills:s,fillDelay:e.ask_fillDelay,deadline:e.ask_deadline*1e3,createdAt:new Date(e.timestamp).getTime(),dstMinAmountPerTrade:j(e.ask_dstMinAmount).eq(1)?"":e.ask_dstMinAmount,triggerPricePerTrade:"",srcAmountPerTrade:e.ask_srcBidAmount,txHash:e.transactionHash,totalTradesAmount:a,isMarketPrice:[ze.TWAP_MARKET].includes(d),chainId:t,filledOrderTimestamp:i||0,status:n,rawOrder:e}},vw=e=>{var d;if(!e)return"";const t=yn(e.accounts,f=>`"${f.toLowerCase()}"`),r=yn(V5(e.configs),f=>`"${f.toLowerCase()}"`),n=yn(e.inTokenSymbols,f=>`"${f.toUpperCase()}"`),s=yn(e.outTokenSymbols,f=>`"${f.toUpperCase()}"`),a=yn(e.inTokenAddresses,f=>`"${f.toLowerCase()}"`),o=yn(e.outTokenAddresses,f=>`"${f.toLowerCase()}"`),i=yn(e.transactionHashes,f=>`"${f.toLowerCase()}"`),c=yn(e.orderIds,f=>`"${f}"`),l=r!=null&&r.length?"":yn((d=e.configs)==null?void 0:d.map(f=>f.twapAddress),f=>`"${f.toLowerCase()}"`),u=e.minDollarValueIn;return[r?`exchange_in: [${r.join(", ")}]`:"",l?`twapAddress_in: [${l.join(", ")}]`:"",t?`maker_in: [${t.join(", ")}]`:"",i?`transactionHash_in: [${i.join(", ")}]`:"",c?`Contract_id_in: [${c.join(", ")}]`:"",u?`dollarValueIn_gte: ${u}`:"",n?`srcTokenSymbol_in: [${n.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 Ew({chainId:e,signal:t,page:r,limit:n,filters:s}){const a=n||1e3,o=vw(s);return await fd({chainId:e,signal:t,limit:a,page:r,buildQuery:(c,l)=>`
|
|
2
2
|
{
|
|
3
3
|
orderCreateds(
|
|
4
4
|
${o?`where: { ${o} }`:""},
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
dollarValueOut
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
`,extractResults:d=>{var f;return(((f=d.data)==null?void 0:f.orderFilleds)||[]).map(h=>({...h,timestamp:new Date(h.timestamp).getTime()}))}})};class Tw extends Error{constructor(){super("No graph endpoint found"),this.name="NoGraphEndpointError"}}const Aw=async({chainId:e,signal:t,page:r,limit:n,filters:s})=>{try{const a=await Ew({chainId:e,signal:t,page:r,limit:n,filters:s}),[o,i]=await Promise.all([Cw({chainId:e,orders:a,signal:t}),kw({chainId:e,orders:a,signal:t})]);return a.map(l=>{const u=o==null?void 0:o.filter(d=>d.TWAP_id===Number(l.Contract_id)&&Ps(d.exchange,l.exchange)&&Ps(d.twapAddress,l.twapAddress));return ww(l,e,u,Sw(l,u||[],i))}).sort((l,u)=>u.createdAt-l.createdAt)}catch{return[]}},Sw=(e,t,r)=>{var i;const n=(i=r==null?void 0:r.find(c=>c.twapId===e.Contract_id.toString()&&Ps(c.twapAddress,e.twapAddress)))==null?void 0:i.status,a=Fm(t).reduce((c,l)=>c.plus(l.inAmount),new j(0)).toFixed(),o=Om(e.ask_srcAmount,a);return Pw(o,e.ask_deadline*1e3,n)},Om=(e,t)=>{if(!t||!e)return 0;const r=j(t).dividedBy(e).toNumber();return r>=.99?100:r<=0?0:Number((r*100).toFixed(2))},Pw=(e,t,r)=>e===100?ct.Completed:r==="CANCELED"?ct.Canceled:r==="COMPLETED"?ct.Completed:t>Date.now()?ct.Open:ct.Expired,Dm=async({signal:e,page:t,chainId:r,limit:n,config:s,account:a})=>(await Promise.all([s?Aw({chainId:r,signal:e,page:t,limit:n,filters:{accounts:[a],configs:s.twapConfig?[s.twapConfig]:[]}}):Promise.resolve([]),gw({chainId:r,signal:e,account:a,exchange:s==null?void 0:s.adapter})]).then(([c,l])=>[...c,...l])).sort((c,l)=>l.createdAt-c.createdAt),Iw={version:"0.0.73"};var Aa=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(){}},Bw={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Fw=(g5=class{constructor(){le(this,pn,Bw);le(this,pa,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&N(this,pa)&&e!==N(this,pn)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:N(this,pn),provider:e}),J(this,pn,e),process.env.NODE_ENV!=="production"&&J(this,pa,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&J(this,pa,!0),N(this,pn).setTimeout(e,t)}clearTimeout(e){N(this,pn).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&J(this,pa,!0),N(this,pn).setInterval(e,t)}clearInterval(e){N(this,pn).clearInterval(e)}},pn=new WeakMap,pa=new WeakMap,g5),Fs=new Fw;function Uw(e){setTimeout(e,0)}var Us=typeof window>"u"||"Deno"in globalThis;function jt(){}function Ow(e,t){return typeof e=="function"?e(t):e}function md(e){return typeof e=="number"&&e>=0&&e!==1/0}function _m(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Zn(e,t){return typeof e=="function"?e(t):e}function wr(e,t){return typeof e=="function"?e(t):e}function Mm(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:a,queryKey:o,stale:i}=e;if(o){if(n){if(t.queryHash!==bd(o,t.options))return!1}else if(!Oo(t.queryKey,o))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||s&&s!==t.state.fetchStatus||a&&!a(t))}function Nm(e,t){const{exact:r,status:n,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(Os(t.options.mutationKey)!==Os(a))return!1}else if(!Oo(t.options.mutationKey,a))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function bd(e,t){return((t==null?void 0:t.queryKeyHashFn)||Os)(e)}function Os(e){return JSON.stringify(e,(t,r)=>gd(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function Oo(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Oo(e[r],t[r])):!1}var Dw=Object.prototype.hasOwnProperty;function yd(e,t){if(e===t)return e;const r=Lm(e)&&Lm(t);if(!r&&!(gd(e)&&gd(t)))return t;const s=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,i=r?new Array(o):{};let c=0;for(let l=0;l<o;l++){const u=r?l:a[l],d=e[u],f=t[u];if(d===f){i[u]=d,(r?l<s:Dw.call(e,u))&&c++;continue}if(d===null||f===null||typeof d!="object"||typeof f!="object"){i[u]=f;continue}const h=yd(d,f);i[u]=h,h===d&&c++}return s===o&&c===s?e:i}function Uc(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Lm(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function gd(e){if(!zm(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!zm(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function zm(e){return Object.prototype.toString.call(e)==="[object Object]"}function _w(e){return new Promise(t=>{Fs.setTimeout(t,e)})}function xd(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return yd(e,t)}catch(n){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. [${r.queryHash}]: ${n}`),n}return yd(e,t)}return t}function Mw(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function Nw(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Oc=Symbol();function Rm(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Oc&&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===Oc?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Hm(e,t){return typeof e=="function"?e(...t):!!e}var Lw=(x5=class extends Aa{constructor(){super();le(this,fa);le(this,ys);le(this,xo);J(this,xo,t=>{if(!Us&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){N(this,ys)||this.setEventListener(N(this,xo))}onUnsubscribe(){var t;this.hasListeners()||((t=N(this,ys))==null||t.call(this),J(this,ys,void 0))}setEventListener(t){var r;J(this,xo,t),(r=N(this,ys))==null||r.call(this),J(this,ys,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){N(this,fa)!==t&&(J(this,fa,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof N(this,fa)=="boolean"?N(this,fa):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},fa=new WeakMap,ys=new WeakMap,xo=new WeakMap,x5),wd=new Lw;function vd(){let e,t;const r=new Promise((s,a)=>{e=s,t=a});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}var zw=Uw;function Rw(){let e=[],t=0,r=i=>{i()},n=i=>{i()},s=zw;const a=i=>{t?e.push(i):s(()=>{r(i)})},o=()=>{const i=e;e=[],i.length&&s(()=>{n(()=>{i.forEach(c=>{r(c)})})})};return{batch:i=>{let c;t++;try{c=i()}finally{t--,t||o()}return c},batchCalls:i=>(...c)=>{a(()=>{i(...c)})},schedule:a,setNotifyFunction:i=>{r=i},setBatchNotifyFunction:i=>{n=i},setScheduler:i=>{s=i}}}var kt=Rw(),Hw=(w5=class extends Aa{constructor(){super();le(this,wo,!0);le(this,gs);le(this,vo);J(this,vo,t=>{if(!Us&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){N(this,gs)||this.setEventListener(N(this,vo))}onUnsubscribe(){var t;this.hasListeners()||((t=N(this,gs))==null||t.call(this),J(this,gs,void 0))}setEventListener(t){var r;J(this,vo,t),(r=N(this,gs))==null||r.call(this),J(this,gs,t(this.setOnline.bind(this)))}setOnline(t){N(this,wo)!==t&&(J(this,wo,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return N(this,wo)}},wo=new WeakMap,gs=new WeakMap,vo=new WeakMap,w5),Dc=new Hw;function $w(e){return Math.min(1e3*2**e,3e4)}function $m(e){return(e??"online")==="online"?Dc.isOnline():!0}var Ed=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Gm(e){let t=!1,r=0,n;const s=vd(),a=()=>s.status!=="pending",o=g=>{var E;if(!a()){const v=new Ed(g);f(v),(E=e.onCancel)==null||E.call(e,v)}},i=()=>{t=!0},c=()=>{t=!1},l=()=>wd.isFocused()&&(e.networkMode==="always"||Dc.isOnline())&&e.canRun(),u=()=>$m(e.networkMode)&&e.canRun(),d=g=>{a()||(n==null||n(),s.resolve(g))},f=g=>{a()||(n==null||n(),s.reject(g))},h=()=>new Promise(g=>{var E;n=v=>{(a()||l())&&g(v)},(E=e.onPause)==null||E.call(e)}).then(()=>{var g;n=void 0,a()||(g=e.onContinue)==null||g.call(e)}),y=()=>{if(a())return;let g;const E=r===0?e.initialPromise:void 0;try{g=E??e.fn()}catch(v){g=Promise.reject(v)}Promise.resolve(g).then(d).catch(v=>{var z;if(a())return;const w=e.retry??(Us?0:3),A=e.retryDelay??$w,C=typeof A=="function"?A(r,v):A,D=w===!0||typeof w=="number"&&r<w||typeof w=="function"&&w(r,v);if(t||!D){f(v);return}r++,(z=e.onFail)==null||z.call(e,r,v),_w(C).then(()=>l()?void 0:h()).then(()=>{t?f(v):y()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:i,continueRetry:c,canStart:u,start:()=>(u()?y():h().then(y),s)}}var jm=(v5=class{constructor(){le(this,ha)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),md(this.gcTime)&&J(this,ha,Fs.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Us?1/0:300*1e3))}clearGcTimeout(){N(this,ha)&&(Fs.clearTimeout(N(this,ha)),J(this,ha,void 0))}},ha=new WeakMap,v5),Gw=(E5=class extends jm{constructor(t){super();le(this,Kr);le(this,ma);le(this,Eo);le(this,Ir);le(this,ba);le(this,Bt);le(this,vc);le(this,ya);J(this,ya,!1),J(this,vc,t.defaultOptions),this.setOptions(t.options),this.observers=[],J(this,ba,t.client),J(this,Ir,N(this,ba).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,J(this,ma,qm(this.options)),this.state=t.state??N(this,ma),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=N(this,Bt))==null?void 0:t.promise}setOptions(t){if(this.options={...N(this,vc),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=qm(this.options);r.data!==void 0&&(this.setState(Wm(r.data,r.dataUpdatedAt)),J(this,ma,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&N(this,Ir).remove(this)}setData(t,r){const n=xd(this.state.data,t,this.options);return Se(this,Kr,qn).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){Se(this,Kr,qn).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var n,s;const r=(n=N(this,Bt))==null?void 0:n.promise;return(s=N(this,Bt))==null||s.cancel(t),r?r.then(jt).catch(jt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(N(this,ma))}isActive(){return this.observers.some(t=>wr(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Oc||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Zn(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:!_m(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=N(this,Bt))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=N(this,Bt))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),N(this,Ir).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(N(this,Bt)&&(N(this,ya)?N(this,Bt).cancel({revert:!0}):N(this,Bt).cancelRetry()),this.scheduleGc()),N(this,Ir).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Se(this,Kr,qn).call(this,{type:"invalidate"})}async fetch(t,r){var c,l,u,d,f,h,y,g,E,v,w,A;if(this.state.fetchStatus!=="idle"&&((c=N(this,Bt))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(N(this,Bt))return N(this,Bt).continueRetry(),N(this,Bt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const C=this.observers.find(D=>D.options.queryFn);C&&this.setOptions(C.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 n=new AbortController,s=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(J(this,ya,!0),n.signal)})},a=()=>{const C=Rm(this.options,r),z=(()=>{const T={client:N(this,ba),queryKey:this.queryKey,meta:this.meta};return s(T),T})();return J(this,ya,!1),this.options.persister?this.options.persister(C,z,this):C(z)},i=(()=>{const C={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:N(this,ba),state:this.state,fetchFn:a};return s(C),C})();(l=this.options.behavior)==null||l.onFetch(i,this),J(this,Eo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=i.fetchOptions)==null?void 0:u.meta))&&Se(this,Kr,qn).call(this,{type:"fetch",meta:(d=i.fetchOptions)==null?void 0:d.meta}),J(this,Bt,Gm({initialPromise:r==null?void 0:r.initialPromise,fn:i.fetchFn,onCancel:C=>{C instanceof Ed&&C.revert&&this.setState({...N(this,Eo),fetchStatus:"idle"}),n.abort()},onFail:(C,D)=>{Se(this,Kr,qn).call(this,{type:"failed",failureCount:C,error:D})},onPause:()=>{Se(this,Kr,qn).call(this,{type:"pause"})},onContinue:()=>{Se(this,Kr,qn).call(this,{type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0}));try{const C=await N(this,Bt).start();if(C===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(C),(h=(f=N(this,Ir).config).onSuccess)==null||h.call(f,C,this),(g=(y=N(this,Ir).config).onSettled)==null||g.call(y,C,this.state.error,this),C}catch(C){if(C instanceof Ed){if(C.silent)return N(this,Bt).promise;if(C.revert){if(this.state.data===void 0)throw C;return this.state.data}}throw Se(this,Kr,qn).call(this,{type:"error",error:C}),(v=(E=N(this,Ir).config).onError)==null||v.call(E,C,this),(A=(w=N(this,Ir).config).onSettled)==null||A.call(w,this.state.data,C,this),C}finally{this.scheduleGc()}}},ma=new WeakMap,Eo=new WeakMap,Ir=new WeakMap,ba=new WeakMap,Bt=new WeakMap,vc=new WeakMap,ya=new WeakMap,Kr=new WeakSet,qn=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Vm(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...Wm(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return J(this,Eo,t.manual?s:void 0),s;case"error":const a=t.error;return{...n,error:a,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),kt.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),N(this,Ir).notify({query:this,type:"updated",action:t})})},E5);function Vm(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:$m(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Wm(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function qm(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var jw=(k5=class extends Aa{constructor(t,r){super();le(this,Ve);le(this,sr);le(this,Oe);le(this,Ec);le(this,qt);le(this,ga);le(this,ko);le(this,$n);le(this,xs);le(this,kc);le(this,Co);le(this,To);le(this,xa);le(this,wa);le(this,ws);le(this,Ao,new Set);this.options=r,J(this,sr,t),J(this,xs,null),J(this,$n,vd()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(N(this,Oe).addObserver(this),Km(N(this,Oe),this.options)?Se(this,Ve,Ac).call(this):this.updateResult(),Se(this,Ve,Ph).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return kd(N(this,Oe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return kd(N(this,Oe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Se(this,Ve,Ih).call(this),Se(this,Ve,Bh).call(this),N(this,Oe).removeObserver(this)}setOptions(t){const r=this.options,n=N(this,Oe);if(this.options=N(this,sr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof wr(this.options.enabled,N(this,Oe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Se(this,Ve,Fh).call(this),N(this,Oe).setOptions(this.options),r._defaulted&&!Uc(this.options,r)&&N(this,sr).getQueryCache().notify({type:"observerOptionsUpdated",query:N(this,Oe),observer:this});const s=this.hasListeners();s&&Ym(N(this,Oe),n,this.options,r)&&Se(this,Ve,Ac).call(this),this.updateResult(),s&&(N(this,Oe)!==n||wr(this.options.enabled,N(this,Oe))!==wr(r.enabled,N(this,Oe))||Zn(this.options.staleTime,N(this,Oe))!==Zn(r.staleTime,N(this,Oe)))&&Se(this,Ve,Th).call(this);const a=Se(this,Ve,Ah).call(this);s&&(N(this,Oe)!==n||wr(this.options.enabled,N(this,Oe))!==wr(r.enabled,N(this,Oe))||a!==N(this,ws))&&Se(this,Ve,Sh).call(this,a)}getOptimisticResult(t){const r=N(this,sr).getQueryCache().build(N(this,sr),t),n=this.createResult(r,t);return Ww(this,n)&&(J(this,qt,n),J(this,ko,this.options),J(this,ga,N(this,Oe).state)),n}getCurrentResult(){return N(this,qt)}trackResult(t,r){return new Proxy(t,{get:(n,s)=>(this.trackProp(s),r==null||r(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&N(this,$n).status==="pending"&&N(this,$n).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){N(this,Ao).add(t)}getCurrentQuery(){return N(this,Oe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=N(this,sr).defaultQueryOptions(t),n=N(this,sr).getQueryCache().build(N(this,sr),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return Se(this,Ve,Ac).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),N(this,qt)))}createResult(t,r){var b;const n=N(this,Oe),s=this.options,a=N(this,qt),o=N(this,ga),i=N(this,ko),l=t!==n?t.state:N(this,Ec),{state:u}=t;let d={...u},f=!1,h;if(r._optimisticResults){const x=this.hasListeners(),S=!x&&Km(t,r),I=x&&Ym(t,n,r,s);(S||I)&&(d={...d,...Vm(u.data,t.options)}),r._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:y,errorUpdatedAt:g,status:E}=d;h=d.data;let v=!1;if(r.placeholderData!==void 0&&h===void 0&&E==="pending"){let x;a!=null&&a.isPlaceholderData&&r.placeholderData===(i==null?void 0:i.placeholderData)?(x=a.data,v=!0):x=typeof r.placeholderData=="function"?r.placeholderData((b=N(this,To))==null?void 0:b.state.data,N(this,To)):r.placeholderData,x!==void 0&&(E="success",h=xd(a==null?void 0:a.data,x,r),f=!0)}if(r.select&&h!==void 0&&!v)if(a&&h===(o==null?void 0:o.data)&&r.select===N(this,kc))h=N(this,Co);else try{J(this,kc,r.select),h=r.select(h),h=xd(a==null?void 0:a.data,h,r),J(this,Co,h),J(this,xs,null)}catch(x){J(this,xs,x)}N(this,xs)&&(y=N(this,xs),h=N(this,Co),g=Date.now(),E="error");const w=d.fetchStatus==="fetching",A=E==="pending",C=E==="error",D=A&&w,z=h!==void 0,m={status:E,fetchStatus:d.fetchStatus,isPending:A,isSuccess:E==="success",isError:C,isInitialLoading:D,isLoading:D,data:h,dataUpdatedAt:d.dataUpdatedAt,error:y,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:w,isRefetching:w&&!A,isLoadingError:C&&!z,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:C&&z,isStale:Cd(t,r),refetch:this.refetch,promise:N(this,$n),isEnabled:wr(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const x=F=>{m.status==="error"?F.reject(m.error):m.data!==void 0&&F.resolve(m.data)},S=()=>{const F=J(this,$n,m.promise=vd());x(F)},I=N(this,$n);switch(I.status){case"pending":t.queryHash===n.queryHash&&x(I);break;case"fulfilled":(m.status==="error"||m.data!==I.value)&&S();break;case"rejected":(m.status!=="error"||m.error!==I.reason)&&S();break}}return m}updateResult(){const t=N(this,qt),r=this.createResult(N(this,Oe),this.options);if(J(this,ga,N(this,Oe).state),J(this,ko,this.options),N(this,ga).data!==void 0&&J(this,To,N(this,Oe)),Uc(r,t))return;J(this,qt,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!N(this,Ao).size)return!0;const o=new Set(a??N(this,Ao));return this.options.throwOnError&&o.add("error"),Object.keys(N(this,qt)).some(i=>{const c=i;return N(this,qt)[c]!==t[c]&&o.has(c)})};Se(this,Ve,M5).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Se(this,Ve,Ph).call(this)}},sr=new WeakMap,Oe=new WeakMap,Ec=new WeakMap,qt=new WeakMap,ga=new WeakMap,ko=new WeakMap,$n=new WeakMap,xs=new WeakMap,kc=new WeakMap,Co=new WeakMap,To=new WeakMap,xa=new WeakMap,wa=new WeakMap,ws=new WeakMap,Ao=new WeakMap,Ve=new WeakSet,Ac=function(t){Se(this,Ve,Fh).call(this);let r=N(this,Oe).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(jt)),r},Th=function(){Se(this,Ve,Ih).call(this);const t=Zn(this.options.staleTime,N(this,Oe));if(Us||N(this,qt).isStale||!md(t))return;const n=_m(N(this,qt).dataUpdatedAt,t)+1;J(this,xa,Fs.setTimeout(()=>{N(this,qt).isStale||this.updateResult()},n))},Ah=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(N(this,Oe)):this.options.refetchInterval)??!1},Sh=function(t){Se(this,Ve,Bh).call(this),J(this,ws,t),!(Us||wr(this.options.enabled,N(this,Oe))===!1||!md(N(this,ws))||N(this,ws)===0)&&J(this,wa,Fs.setInterval(()=>{(this.options.refetchIntervalInBackground||wd.isFocused())&&Se(this,Ve,Ac).call(this)},N(this,ws)))},Ph=function(){Se(this,Ve,Th).call(this),Se(this,Ve,Sh).call(this,Se(this,Ve,Ah).call(this))},Ih=function(){N(this,xa)&&(Fs.clearTimeout(N(this,xa)),J(this,xa,void 0))},Bh=function(){N(this,wa)&&(Fs.clearInterval(N(this,wa)),J(this,wa,void 0))},Fh=function(){const t=N(this,sr).getQueryCache().build(N(this,sr),this.options);if(t===N(this,Oe))return;const r=N(this,Oe);J(this,Oe,t),J(this,Ec,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},M5=function(t){kt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(N(this,qt))}),N(this,sr).getQueryCache().notify({query:N(this,Oe),type:"observerResultsUpdated"})})},k5);function Vw(e,t){return wr(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Km(e,t){return Vw(e,t)||e.state.data!==void 0&&kd(e,t,t.refetchOnMount)}function kd(e,t,r){if(wr(t.enabled,e)!==!1&&Zn(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Cd(e,t)}return!1}function Ym(e,t,r,n){return(e!==t||wr(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Cd(e,r)}function Cd(e,t){return wr(t.enabled,e)!==!1&&e.isStaleByTime(Zn(t.staleTime,e))}function Ww(e,t){return!Uc(e.getCurrentResult(),t)}function Zm(e){return{onFetch:(t,r)=>{var u,d,f,h,y;const n=t.options,s=(f=(d=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:f.direction,a=((h=t.state.data)==null?void 0:h.pages)||[],o=((y=t.state.data)==null?void 0:y.pageParams)||[];let i={pages:[],pageParams:[]},c=0;const l=async()=>{let g=!1;const E=A=>{Object.defineProperty(A,"signal",{enumerable:!0,get:()=>(t.signal.aborted?g=!0:t.signal.addEventListener("abort",()=>{g=!0}),t.signal)})},v=Rm(t.options,t.fetchOptions),w=async(A,C,D)=>{if(g)return Promise.reject();if(C==null&&A.pages.length)return Promise.resolve(A);const T=(()=>{const S={client:t.client,queryKey:t.queryKey,pageParam:C,direction:D?"backward":"forward",meta:t.options.meta};return E(S),S})(),m=await v(T),{maxPages:b}=t.options,x=D?Nw:Mw;return{pages:x(A.pages,m,b),pageParams:x(A.pageParams,C,b)}};if(s&&a.length){const A=s==="backward",C=A?qw:Xm,D={pages:a,pageParams:o},z=C(n,D);i=await w(D,z,A)}else{const A=e??a.length;do{const C=c===0?o[0]??n.initialPageParam:Xm(n,i);if(c>0&&C==null)break;i=await w(i,C),c++}while(c<A)}return i};t.options.persister?t.fetchFn=()=>{var g,E;return(E=(g=t.options).persister)==null?void 0:E.call(g,l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=l}}}function Xm(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function qw(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var Kw=(C5=class extends jm{constructor(t){super();le(this,hn);le(this,Cc);le(this,fn);le(this,Kt);le(this,va);J(this,Cc,t.client),this.mutationId=t.mutationId,J(this,Kt,t.mutationCache),J(this,fn,[]),this.state=t.state||Qm(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){N(this,fn).includes(t)||(N(this,fn).push(t),this.clearGcTimeout(),N(this,Kt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){J(this,fn,N(this,fn).filter(r=>r!==t)),this.scheduleGc(),N(this,Kt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){N(this,fn).length||(this.state.status==="pending"?this.scheduleGc():N(this,Kt).remove(this))}continue(){var t;return((t=N(this,va))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,c,l,u,d,f,h,y,g,E,v,w,A,C,D,z,T,m,b;const r=()=>{Se(this,hn,Ts).call(this,{type:"continue"})},n={client:N(this,Cc),meta:this.options.meta,mutationKey:this.options.mutationKey};J(this,va,Gm({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(x,S)=>{Se(this,hn,Ts).call(this,{type:"failed",failureCount:x,error:S})},onPause:()=>{Se(this,hn,Ts).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>N(this,Kt).canRun(this)}));const s=this.state.status==="pending",a=!N(this,va).canStart();try{if(s)r();else{Se(this,hn,Ts).call(this,{type:"pending",variables:t,isPaused:a}),await((i=(o=N(this,Kt).config).onMutate)==null?void 0:i.call(o,t,this,n));const S=await((l=(c=this.options).onMutate)==null?void 0:l.call(c,t,n));S!==this.state.context&&Se(this,hn,Ts).call(this,{type:"pending",context:S,variables:t,isPaused:a})}const x=await N(this,va).start();return await((d=(u=N(this,Kt).config).onSuccess)==null?void 0:d.call(u,x,t,this.state.context,this,n)),await((h=(f=this.options).onSuccess)==null?void 0:h.call(f,x,t,this.state.context,n)),await((g=(y=N(this,Kt).config).onSettled)==null?void 0:g.call(y,x,null,this.state.variables,this.state.context,this,n)),await((v=(E=this.options).onSettled)==null?void 0:v.call(E,x,null,t,this.state.context,n)),Se(this,hn,Ts).call(this,{type:"success",data:x}),x}catch(x){try{throw await((A=(w=N(this,Kt).config).onError)==null?void 0:A.call(w,x,t,this.state.context,this,n)),await((D=(C=this.options).onError)==null?void 0:D.call(C,x,t,this.state.context,n)),await((T=(z=N(this,Kt).config).onSettled)==null?void 0:T.call(z,void 0,x,this.state.variables,this.state.context,this,n)),await((b=(m=this.options).onSettled)==null?void 0:b.call(m,void 0,x,t,this.state.context,n)),x}finally{Se(this,hn,Ts).call(this,{type:"error",error:x})}}finally{N(this,Kt).runNext(this)}}},Cc=new WeakMap,fn=new WeakMap,Kt=new WeakMap,va=new WeakMap,hn=new WeakSet,Ts=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,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{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),kt.batch(()=>{N(this,fn).forEach(n=>{n.onMutationUpdate(t)}),N(this,Kt).notify({mutation:this,type:"updated",action:t})})},C5);function Qm(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Yw=(T5=class extends Aa{constructor(t={}){super();le(this,Gn);le(this,Yr);le(this,Tc);this.config=t,J(this,Gn,new Set),J(this,Yr,new Map),J(this,Tc,0)}build(t,r,n){const s=new Kw({client:t,mutationCache:this,mutationId:++Yu(this,Tc)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){N(this,Gn).add(t);const r=_c(t);if(typeof r=="string"){const n=N(this,Yr).get(r);n?n.push(t):N(this,Yr).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(N(this,Gn).delete(t)){const r=_c(t);if(typeof r=="string"){const n=N(this,Yr).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&N(this,Yr).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=_c(t);if(typeof r=="string"){const n=N(this,Yr).get(r),s=n==null?void 0:n.find(a=>a.state.status==="pending");return!s||s===t}else return!0}runNext(t){var n;const r=_c(t);if(typeof r=="string"){const s=(n=N(this,Yr).get(r))==null?void 0:n.find(a=>a!==t&&a.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){kt.batch(()=>{N(this,Gn).forEach(t=>{this.notify({type:"removed",mutation:t})}),N(this,Gn).clear(),N(this,Yr).clear()})}getAll(){return Array.from(N(this,Gn))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Nm(r,n))}findAll(t={}){return this.getAll().filter(r=>Nm(t,r))}notify(t){kt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return kt.batch(()=>Promise.all(t.map(r=>r.continue().catch(jt))))}},Gn=new WeakMap,Yr=new WeakMap,Tc=new WeakMap,T5);function _c(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Zw=(A5=class extends Aa{constructor(t,r){super();le(this,Wn);le(this,jn);le(this,vs);le(this,ar);le(this,Vn);J(this,jn,t),this.setOptions(r),this.bindMethods(),Se(this,Wn,Zu).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var n;const r=this.options;this.options=N(this,jn).defaultMutationOptions(t),Uc(this.options,r)||N(this,jn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:N(this,ar),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Os(r.mutationKey)!==Os(this.options.mutationKey)?this.reset():((n=N(this,ar))==null?void 0:n.state.status)==="pending"&&N(this,ar).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=N(this,ar))==null||t.removeObserver(this)}onMutationUpdate(t){Se(this,Wn,Zu).call(this),Se(this,Wn,Uh).call(this,t)}getCurrentResult(){return N(this,vs)}reset(){var t;(t=N(this,ar))==null||t.removeObserver(this),J(this,ar,void 0),Se(this,Wn,Zu).call(this),Se(this,Wn,Uh).call(this)}mutate(t,r){var n;return J(this,Vn,r),(n=N(this,ar))==null||n.removeObserver(this),J(this,ar,N(this,jn).getMutationCache().build(N(this,jn),this.options)),N(this,ar).addObserver(this),N(this,ar).execute(t)}},jn=new WeakMap,vs=new WeakMap,ar=new WeakMap,Vn=new WeakMap,Wn=new WeakSet,Zu=function(){var r;const t=((r=N(this,ar))==null?void 0:r.state)??Qm();J(this,vs,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},Uh=function(t){kt.batch(()=>{var r,n,s,a,o,i,c,l;if(N(this,Vn)&&this.hasListeners()){const u=N(this,vs).variables,d=N(this,vs).context,f={client:N(this,jn),meta:this.options.meta,mutationKey:this.options.mutationKey};(t==null?void 0:t.type)==="success"?((n=(r=N(this,Vn)).onSuccess)==null||n.call(r,t.data,u,d,f),(a=(s=N(this,Vn)).onSettled)==null||a.call(s,t.data,null,u,d,f)):(t==null?void 0:t.type)==="error"&&((i=(o=N(this,Vn)).onError)==null||i.call(o,t.error,u,d,f),(l=(c=N(this,Vn)).onSettled)==null||l.call(c,void 0,t.error,u,d,f))}this.listeners.forEach(u=>{u(N(this,vs))})})},A5),Xw=(S5=class extends Aa{constructor(t={}){super();le(this,mn);this.config=t,J(this,mn,new Map)}build(t,r,n){const s=r.queryKey,a=r.queryHash??bd(s,r);let o=this.get(a);return o||(o=new Gw({client:t,queryKey:s,queryHash:a,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){N(this,mn).has(t.queryHash)||(N(this,mn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=N(this,mn).get(t.queryHash);r&&(t.destroy(),r===t&&N(this,mn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){kt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return N(this,mn).get(t)}getAll(){return[...N(this,mn).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Mm(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>Mm(t,n)):r}notify(t){kt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){kt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){kt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},mn=new WeakMap,S5),Qw=(P5=class{constructor(e={}){le(this,ft);le(this,Es);le(this,ks);le(this,So);le(this,Po);le(this,Cs);le(this,Io);le(this,Bo);J(this,ft,e.queryCache||new Xw),J(this,Es,e.mutationCache||new Yw),J(this,ks,e.defaultOptions||{}),J(this,So,new Map),J(this,Po,new Map),J(this,Cs,0)}mount(){Yu(this,Cs)._++,N(this,Cs)===1&&(J(this,Io,wd.subscribe(async e=>{e&&(await this.resumePausedMutations(),N(this,ft).onFocus())})),J(this,Bo,Dc.subscribe(async e=>{e&&(await this.resumePausedMutations(),N(this,ft).onOnline())})))}unmount(){var e,t;Yu(this,Cs)._--,N(this,Cs)===0&&((e=N(this,Io))==null||e.call(this),J(this,Io,void 0),(t=N(this,Bo))==null||t.call(this),J(this,Bo,void 0))}isFetching(e){return N(this,ft).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return N(this,Es).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=N(this,ft).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=N(this,ft).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Zn(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return N(this,ft).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),s=N(this,ft).get(n.queryHash),a=s==null?void 0:s.state.data,o=Ow(t,a);if(o!==void 0)return N(this,ft).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return kt.batch(()=>N(this,ft).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=N(this,ft).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=N(this,ft);kt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=N(this,ft);return kt.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=kt.batch(()=>N(this,ft).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(jt).catch(jt)}invalidateQueries(e,t={}){return kt.batch(()=>(N(this,ft).findAll(e).forEach(r=>{r.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 r={...t,cancelRefetch:t.cancelRefetch??!0},n=kt.batch(()=>N(this,ft).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let a=s.fetch(void 0,r);return r.throwOnError||(a=a.catch(jt)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(jt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=N(this,ft).build(this,t);return r.isStaleByTime(Zn(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(jt).catch(jt)}fetchInfiniteQuery(e){return e.behavior=Zm(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(jt).catch(jt)}ensureInfiniteQueryData(e){return e.behavior=Zm(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Dc.isOnline()?N(this,Es).resumePausedMutations():Promise.resolve()}getQueryCache(){return N(this,ft)}getMutationCache(){return N(this,Es)}getDefaultOptions(){return N(this,ks)}setDefaultOptions(e){J(this,ks,e)}setQueryDefaults(e,t){N(this,So).set(Os(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...N(this,So).values()],r={};return t.forEach(n=>{Oo(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){N(this,Po).set(Os(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...N(this,Po).values()],r={};return t.forEach(n=>{Oo(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...N(this,ks).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=bd(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===Oc&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...N(this,ks).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){N(this,ft).clear(),N(this,Es).clear()}},ft=new WeakMap,Es=new WeakMap,ks=new WeakMap,So=new WeakMap,Po=new WeakMap,Cs=new WeakMap,Io=new WeakMap,Bo=new WeakMap,P5),Jm=xt.createContext(void 0),Td=e=>{const t=xt.useContext(Jm);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Jw=({client:e,children:t})=>(xt.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),B.jsx(Jm.Provider,{value:e,children:t})),e1=xt.createContext(!1),e3=()=>xt.useContext(e1);e1.Provider;function t3(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var r3=xt.createContext(t3()),n3=()=>xt.useContext(r3),s3=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},a3=e=>{xt.useEffect(()=>{e.clearReset()},[e])},o3=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||Hm(r,[e.error,n])),i3=e=>{if(e.suspense){const r=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>r(n(...s)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},c3=(e,t)=>e.isLoading&&e.isFetching&&!t,l3=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,t1=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function u3(e,t,r){var d,f,h,y,g;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 n=e3(),s=n3(),a=Td(),o=a.defaultQueryOptions(e);(f=(d=a.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||f.call(d,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=n?"isRestoring":"optimistic",i3(o),s3(o,s),a3(s);const i=!a.getQueryCache().get(o.queryHash),[c]=xt.useState(()=>new t(a,o)),l=c.getOptimisticResult(o),u=!n&&e.subscribed!==!1;if(xt.useSyncExternalStore(xt.useCallback(E=>{const v=u?c.subscribe(kt.batchCalls(E)):jt;return c.updateResult(),v},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),xt.useEffect(()=>{c.setOptions(o)},[o,c]),l3(o,l))throw t1(o,c,s);if(o3({result:l,errorResetBoundary:s,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw l.error;if((y=(h=a.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||y.call(h,o,l),o.experimental_prefetchInRender&&!Us&&c3(l,n)){const E=i?t1(o,c,s):(g=a.getQueryCache().get(o.queryHash))==null?void 0:g.promise;E==null||E.catch(jt).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?l:c.trackResult(l)}function d3(e,t){return u3(e,jw)}function Zr(e,t){const r=Td(),[n]=xt.useState(()=>new Zw(r,e));xt.useEffect(()=>{n.setOptions(e)},[n,e]);const s=xt.useSyncExternalStore(xt.useCallback(o=>n.subscribe(kt.batchCalls(o)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),a=xt.useCallback((o,i)=>{n.mutate(o,i).catch(jt)},[n]);if(s.error&&Hm(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:a,mutateAsync:s.mutate}}const p3=M.createContext(null),Ad={didCatch:!1,error:null};class f3 extends M.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Ad}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var r,n,s=arguments.length,a=new Array(s),o=0;o<s;o++)a[o]=arguments[o];(r=(n=this.props).onReset)===null||r===void 0||r.call(n,{args:a,reason:"imperative-api"}),this.setState(Ad)}}componentDidCatch(t,r){var n,s;(n=(s=this.props).onError)===null||n===void 0||n.call(s,t,r)}componentDidUpdate(t,r){const{didCatch:n}=this.state,{resetKeys:s}=this.props;if(n&&r.error!==null&&h3(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(Ad)}}render(){const{children:t,fallbackRender:r,FallbackComponent:n,fallback:s}=this.props,{didCatch:a,error:o}=this.state;let i=t;if(a){const c={error:o,resetErrorBoundary:this.resetErrorBoundary};if(typeof r=="function")i=r(c);else if(n)i=M.createElement(n,c);else if(s!==void 0)i=s;else throw o}return M.createElement(p3.Provider,{value:{didCatch:a,error:o,resetErrorBoundary:this.resetErrorBoundary}},i)}}function h3(){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((r,n)=>!Object.is(r,t[n]))}const r1=e=>{let t;const r=new Set,n=(l,u)=>{const d=typeof l=="function"?l(t):l;if(!Object.is(d,t)){const f=t;t=u??(typeof d!="object"||d===null)?d:Object.assign({},t,d),r.forEach(h=>h(t,f))}},s=()=>t,i={setState:n,getState:s,getInitialState:()=>c,subscribe:l=>(r.add(l),()=>r.delete(l))},c=t=e(n,s,i);return i},m3=(e=>e?r1(e):r1),b3=e=>e;function y3(e,t=b3){const r=M.useSyncExternalStore(e.subscribe,M.useCallback(()=>t(e.getState()),[e,t]),M.useCallback(()=>t(e.getInitialState()),[e,t]));return M.useDebugValue(r),r}const n1=e=>{const t=m3(e),r=n=>y3(t,n);return Object.assign(r,t),r},g3=(e=>e?n1(e):n1),s1={disclaimerAccepted:!0,currentTime:Date.now(),swapExecution:{}},te=g3((e,t)=>({state:s1,updateState:r=>e(n=>({state:{...n.state,...r}})),updateSwapExecution:r=>e(n=>({state:{...n.state,swapExecution:{...n.state.swapExecution,...r}}})),resetState:()=>{e({state:{...s1,currentTime:Date.now(),swapExecution:t().state.swapExecution,isMarketOrder:t().state.isMarketOrder}})}}));(function(){try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".orbs_OrbsLogo{object-fit:contain;display:inline}.orbs_PoweredBy{border-radius:8px;margin-left:auto;margin-right:auto}.orbs_PoweredBy a{display:flex;align-items:center;justify-content:center;text-decoration:none;color:inherit}.orbs_PoweredBy span{font-size:14px}.orbs_PoweredBy .orbs_OrbsLogo{margin-left:6px;margin-right:6px;width:18px;height:18px}.orbs_Text{margin:0;padding:0}.orbs_Spinner{width:var(--size, 38px);height:var(--size, 38px);border:var(--border-width, 3px) solid var(--border-color, white);border-bottom-color:var(--bottom-border-color, rgba(255, 255, 255, .2));border-radius:50%;display:inline-block;box-sizing:border-box;animation:orbs_rotation 1s linear infinite}@keyframes orbs_rotation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.orbs_TradeStepLayout{--layout-min-height: 220px;--layout-width: 100%;--layout-display: flex;--layout-direction: column;--layout-align: center;--layout-overflow: visible;display:var(--layout-display);flex-direction:var(--layout-direction);align-items:var(--layout-align);width:var(--layout-width);min-height:var(--layout-min-height);overflow:var(--layout-overflow)}.orbs_TradeStepLayoutBody{--body-gap: 20px;--body-margin-top: 30px;--body-width: 100%;--body-display: flex;--body-direction: column;--body-align: center;--body-overflow: visible;gap:var(--body-gap);align-items:var(--body-align);display:var(--body-display);flex-direction:var(--body-direction);width:var(--body-width);margin-top:var(--body-margin-top);overflow:var(--body-overflow)}.orbs_TradeStepLayoutHeader{--header-gap: 30px;--header-display: flex;--header-direction: column;--header-align: center;--header-justify: center;--header-overflow: visible;display:var(--header-display);flex-direction:var(--header-direction);align-items:var(--header-align);justify-content:var(--header-justify);gap:var(--header-gap);overflow:var(--header-overflow)}.orbs_TradeStepLayoutTitle{--title-font-size: 18px;--title-font-weight: 500;--title-line-height: normal;--title-color: inherit;--title-text-align: center;--title-margin: 0;--title-padding: 0;font-size:var(--title-font-size);font-weight:var(--title-font-weight);line-height:var(--title-line-height);color:var(--title-color);text-align:var(--title-text-align);margin:var(--title-margin);padding:var(--title-padding)}.orbs_StepIndicator{--indicator-display: flex;--indicator-align: center;--indicator-justify: flex-start;--indicator-height: 7px;--indicator-width: 120px;--indicator-border-radius: 999px;--indicator-bg-color: white;--indicator-margin-bottom: 20px;--indicator-position: relative;--indicator-overflow: hidden;--indicator-border: none;--indicator-box-shadow: none;display:var(--indicator-display);align-items:var(--indicator-align);justify-content:var(--indicator-justify);height:var(--indicator-height);width:var(--indicator-width);border-radius:var(--indicator-border-radius);overflow:var(--indicator-overflow);background-color:var(--indicator-bg-color);margin-bottom:var(--indicator-margin-bottom);position:var(--indicator-position);border:var(--indicator-border);box-shadow:var(--indicator-box-shadow)}.orbs_StepIndicatorLine{--line-height: 100%;--line-bg-color: black;--line-position: absolute;--line-top: 0;--line-left: 0;--line-right: 0;--line-bottom: 0;--line-transition: all .3s ease;--line-border-radius: inherit;--line-box-shadow: none;height:var(--line-height);background-color:var(--line-bg-color);position:var(--line-position);top:var(--line-top);left:var(--line-left);right:var(--line-right);bottom:var(--line-bottom);transition:var(--line-transition);border-radius:var(--line-border-radius);box-shadow:var(--line-box-shadow)}.orbs_TradeStepLayoutFooter{--footer-display: flex;--footer-align: center;--footer-justify: center;--footer-direction: column;--footer-margin-top: auto;--footer-padding-top: 30px;--footer-width: 100%;--footer-overflow: visible;--footer-border-top: none;display:var(--footer-display);align-items:var(--footer-align);justify-content:var(--footer-justify);flex-direction:var(--footer-direction);margin-top:var(--footer-margin-top);padding-top:var(--footer-padding-top);width:var(--footer-width);overflow:var(--footer-overflow);border-top:var(--footer-border-top)}.orbs_TradeStepLayoutFooter p{--footer-text-font-size: 15px;--footer-text-line-height: normal;--footer-text-color: inherit;--footer-text-margin: 0;--footer-text-padding: 0;font-size:var(--footer-text-font-size);line-height:var(--footer-text-line-height);color:var(--footer-text-color);margin:var(--footer-text-margin);padding:var(--footer-text-padding)}.orbs_TradeStepLayoutFooterLink{--link-color: inherit;--link-text-decoration: none;--link-font-size: 15px;--link-text-align: center;--link-margin: auto;--link-outline: none;--link-line-height: normal;--link-padding: 0;--link-transition: color .2s ease;--link-hover-color: inherit;--link-hover-text-decoration: underline;color:var(--link-color);text-decoration:var(--link-text-decoration);font-size:var(--link-font-size);text-align:var(--link-text-align);margin-left:var(--link-margin);margin-right:var(--link-margin);outline:var(--link-outline);line-height:var(--link-line-height);padding:var(--link-padding);transition:var(--link-transition)}.orbs_TradeStepLayoutFooterLink:hover{color:var(--link-hover-color);text-decoration:var(--link-hover-text-decoration)}.orbs_TradeStepLayoutSuccessIcon{--success-icon-display: flex;--success-icon-justify: center;--success-icon-align: center;--success-icon-width: 60px;--success-icon-height: 60px;--success-icon-border-radius: 50%;--success-icon-overflow: visible;--success-icon-bg-color: transparent;--success-icon-border: none;--success-icon-box-shadow: none;display:var(--success-icon-display);justify-content:var(--success-icon-justify);align-items:var(--success-icon-align);width:var(--success-icon-width);height:var(--success-icon-height);border-radius:var(--success-icon-border-radius);overflow:var(--success-icon-overflow);background-color:var(--success-icon-bg-color);border:var(--success-icon-border);box-shadow:var(--success-icon-box-shadow)}.orbs_TradeStepLayoutErrorIcon{--error-icon-width: 80px;--error-icon-height: 80px;--error-icon-display: flex;--error-icon-justify: center;--error-icon-align: center;--error-icon-overflow: visible;--error-icon-bg-color: transparent;--error-icon-border: none;--error-icon-box-shadow: none;width:var(--error-icon-width);height:var(--error-icon-height);display:var(--error-icon-display);justify-content:var(--error-icon-justify);align-items:var(--error-icon-align);overflow:var(--error-icon-overflow);background-color:var(--error-icon-bg-color);border:var(--error-icon-border);box-shadow:var(--error-icon-box-shadow)}.orbs_FailedContentMsg{font-size:22px;font-weight:500}.orbs_TradePreview{display:flex;align-items:center;justify-content:center;gap:8px;width:100%}.orbs_TradePreviewToken{display:flex;align-items:center;gap:6px;max-width:calc(50% - 30px)}.orbs_TradePreviewToken p{--token-font-size: 15px;--token-white-space: nowrap;--token-overflow: hidden;--token-text-overflow: ellipsis;--token-flex: 1;--token-margin: 0;--token-padding: 0;font-size:var(--token-font-size);white-space:var(--token-white-space);overflow:var(--token-overflow);text-overflow:var(--token-text-overflow);flex:var(--token-flex);margin:var(--token-margin)}.orbs_TradepPreviewIcon{width:22px;height:22px}.orbs_TradepPreviewLogo{width:24px;height:24px;border-radius:50%;overflow:hidden}.orbs_FlexRow{display:flex;flex-direction:row}.orbs_FlexColumn{display:flex;flex-direction:column}@keyframes orbs_skeletonAnimation{0%{opacity:.2}to{opacity:.4}}.orbs_SkeletonLoader{animation:orbs_skeletonAnimation 1s linear infinite alternate;background-color:#fff}.orbs_Main-wrapper{width:100%}.orbs_Main{width:100%;display:flex;flex-direction:column;gap:28px}.orbs_MainToken{display:flex;flex-direction:row;align-items:center;justify-content:space-between;width:100%;gap:8px}.orbs_MainTokenLeft{display:flex;flex-direction:column;align-items:flex-start;gap:8px}.orbs_MainTokenUsd{display:flex;align-items:center;gap:5px}.orbs_MainTokenUsd small{font-size:12px;opacity:.6}.orbs_MainContentLoader{width:100%;display:flex;gap:15px;align-items:center;margin-top:20px}.orbs_MainContentRectengularLoader{flex:1;height:20px;max-width:250px;border-radius:20px}.orbs_MainContentCircleLoader{width:30px;height:30px;border-radius:50%}.orbs_MainTokenLogo{--width: 40px;--height: 40px;width:var(--width);height:var(--height)}.orbs_MainTokenLogo img{width:100%;height:100%;object-fit:cover}.orbs_SwapFlow{display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%}.orbs_SwapFlow *{box-sizing:border-box}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();const Ne=e=>`orbs_${e}`;function Do({children:e,className:t=""}){return B.jsx("p",{className:`${t} ${Ne("Text")}`,children:e})}const a1=M.createContext({});function x3({children:e,...t}){return B.jsx(a1.Provider,{value:t,children:e})}const Xr=()=>M.useContext(a1);var ht=(e=>(e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILED=3]="FAILED",e))(ht||{});const w3=({className:e="",size:t=38,borderWidth:r=3,borderColor:n="white",bottomBorderColor:s="rgba(255, 255, 255, 0.2)"})=>{const a={"--size":`${t}px`,"--border-width":`${r}px`,"--border-color":n,"--bottom-border-color":s};return B.jsx("div",{className:`${Ne("Spinner")} ${e}`,style:a})};function Mc({className:e="",body:t,footerLink:r,footerText:n,title:s,children:a}){return B.jsxs("div",{className:`${Ne("TradeStepLayout")} ${e}`,children:[B.jsxs("div",{className:Ne("TradeStepLayoutHeader"),children:[B.jsx(T3,{}),s&&B.jsx(Do,{className:Ne("TradeStepLayoutTitle"),children:s})]}),t&&B.jsx("div",{className:Ne("TradeStepLayoutBody"),children:t}),B.jsx(v3,{link:r,text:n}),a]})}const v3=({link:e,text:t})=>{const{swapStatus:r}=Xr();return!e&&!t?null:B.jsxs("div",{className:Ne("TradeStepLayoutFooter"),children:[B.jsx(S3,{}),e?B.jsx(E3,{link:e,text:t}):r===ht.FAILED?void 0:B.jsx(Do,{children:t})]})},E3=({link:e,text:t})=>B.jsx("a",{target:"_blank",className:Ne("TradeStepLayoutFooterLink"),href:e,children:t});function k3(){const{components:e}=Xr();return e.SuccessIcon?e.SuccessIcon:B.jsxs("svg",{fill:"none",viewBox:"0 0 16 16",className:Ne("TradeStepLayoutSuccessIcon"),children:[B.jsx("circle",{cx:"8",cy:"8",r:"7",strokeWidth:"1.5",stroke:"#00C853"}),B.jsx("path",{strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",stroke:"#00C853",d:"M5 8l2 2 4-4"})]})}function C3(){const{components:e}=Xr();return e.FailedIcon?e.FailedIcon:B.jsxs("svg",{className:Ne("TradeStepLayoutErrorIcon"),viewBox:"0 0 16 16",fill:"none",children:[B.jsx("circle",{cx:"8",cy:"8",r:"7",strokeWidth:"1.5",stroke:"#FF3D00"}),B.jsx("path",{strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",stroke:"#FF3D00",d:"M8 4v5M8 11h.01"})]})}const T3=()=>{const{swapStatus:e}=Xr();return e===ht.SUCCESS?B.jsx(k3,{}):e===ht.FAILED?B.jsx(C3,{}):B.jsx(A3,{})},A3=()=>{const{components:e}=Xr();return e.Loader?e.Loader:B.jsx(w3,{size:60,borderWidth:5,className:Ne("TradeStepLayoutSpinner")})},S3=()=>{const{totalSteps:e,currentStepIndex:t=0,swapStatus:r}=Xr();return r!==ht.LOADING||e===1?null:B.jsx("div",{className:Ne("StepIndicator"),children:B.jsx("div",{style:{width:`${100/(e||0)}%`,left:`${t*100/(e||0)}%`},className:Ne("StepIndicatorLine")})})},P3=({error:e,footerLink:t,footerText:r})=>B.jsx(Mc,{footerLink:t,footerText:r,body:e||B.jsx("p",{className:Ne("FailedContentMsg"),children:"Something went wrong"}),className:Ne("FailedContent")});function I3(){return B.jsx("svg",{fill:"currentColor",viewBox:"0 0 16 16",className:Ne("TradepPreviewIcon"),children:B.jsx("path",{fillRule:"evenodd",d:"M4 8a.5.5 0 01.5-.5h5.793L8.146 5.354a.5.5 0 11.708-.708l3 3a.5.5 0 010 .708l-3 3a.5.5 0 01-.708-.708L10.293 8.5H4.5A.5.5 0 014 8z"})})}const o1=({inTokenOnly:e})=>{const{inToken:t,outToken:r,inAmount:n,outAmount:s,components:a}=Xr();return B.jsxs("div",{className:Ne("TradePreview"),children:[B.jsx(i1,{token:t,amount:n,Logo:a==null?void 0:a.SrcTokenLogo}),!e&&B.jsxs(B.Fragment,{children:[B.jsx(I3,{}),B.jsx(i1,{token:r,amount:s,Logo:a==null?void 0:a.DstTokenLogo})]})]})},i1=({token:e,amount:t,Logo:r})=>B.jsxs("div",{className:Ne("TradePreviewToken"),children:[r||B.jsx("img",{src:e==null?void 0:e.logoUrl,className:Ne("TradepPreviewLogo"),alt:`${e==null?void 0:e.symbol} logo`}),B.jsxs(Do,{children:[t," ",e==null?void 0:e.symbol]})]});function B3({title:e,footerLink:t,footerText:r,hideTokens:n}){return B.jsx(Mc,{title:e,className:Ne("Success"),body:!n&&B.jsx(o1,{}),footerLink:t,footerText:r})}const c1=({$gap:e=10,$alignItems:t="flex-start",children:r,className:n="",customStyles:s={}})=>{const a={gap:`${e}px`,alignItems:t,width:"100%",...s};return B.jsx("div",{className:`${Ne("FlexColumn")} ${n}`,style:a,children:r})};function l1({styles:e={},className:t=""}){return B.jsx("div",{style:e,className:`${Ne("SkeletonLoader")} ${t}`})}const F3=()=>B.jsxs("div",{className:`${Ne("MainContentLoader")}`,children:[B.jsx(l1,{className:`${Ne("MainContentCircleLoader")}`}),B.jsx(l1,{className:`${Ne("MainContentRectengularLoader")}`})]}),U3=({fromTitle:e,toTitle:t,inUsd:r,outUsd:n})=>{const{swapStatus:s,outAmount:a,inAmount:o,inToken:i,outToken:c,components:l,totalSteps:u}=Xr(),d=B.jsx(d1,{fromTitle:e,inUsd:r,inToken:i,toTitle:t,outUsd:n,outToken:c,inAmount:o,outAmount:a,SrcTokenLogo:l.SrcTokenLogo,DstTokenLogo:l.DstTokenLogo});return s?u?B.jsx(O3,{}):B.jsxs(c1,{children:[d,B.jsx(F3,{})]}):B.jsx(c1,{children:d})},u1=({amount:e,token:t,usd:r,title:n,Logo:s})=>B.jsxs("div",{className:`${Ne("MainToken")}`,children:[B.jsxs("div",{className:`${Ne("MainTokenLeft")}`,children:[B.jsx(Do,{className:`${Ne("MainTokenTitle")}`,children:n}),B.jsx(Do,{className:` ${Ne("MainTokenAmount")}`,children:`${e&&Number(e)>0?e:""} ${(t==null?void 0:t.symbol)||""}`}),r&&B.jsx("div",{className:` ${Ne("MainTokenUsd")}`,children:r})]}),s||B.jsx("div",{className:` ${Ne("MainTokenLogo")}`,children:t!=null&&t.logoUrl?B.jsx("img",{src:t==null?void 0:t.logoUrl,alt:"Token logo"}):null})]});function O3(){const{currentStep:e}=Xr();return e?B.jsx(Mc,{footerLink:e.footerLink,footerText:e.footerText,title:e.title,body:e.hideTokens?void 0:B.jsx(o1,{inTokenOnly:e==null?void 0:e.inTokenOnly})}):null}const d1=({fromTitle:e,inUsd:t,inToken:r,toTitle:n,outUsd:s,outToken:a,inAmount:o,outAmount:i,SrcTokenLogo:c,DstTokenLogo:l})=>B.jsxs("div",{className:`${Ne("Main")}`,children:[B.jsx(u1,{title:e||"Swap from",usd:t,token:r,amount:o,Logo:c}),B.jsx(u1,{title:n||"Swap to",usd:s,token:a,amount:i,Logo:l})]}),Xn=e=>B.jsx(x3,{...e,children:B.jsx(D3,{})}),D3=()=>{const{swapStatus:e,components:t,className:r}=Xr();return B.jsx("div",{className:`${Ne("SwapFlow")} ${r}`,children:e===ht.SUCCESS?t==null?void 0:t.Success:e===ht.FAILED?t==null?void 0:t.Failed:t==null?void 0:t.Main})};Xn.Success=B3,Xn.Failed=P3,Xn.Main=U3,Xn.StepLayout=Mc;var Ds=(e=>(e.WRAP="wrap",e.APPROVE="approve",e.CREATE="create",e))(Ds||{});const _3="1.2.3";let Zt=class Oh extends Error{constructor(t,r={}){var o;const n=r.cause instanceof Oh?r.cause.details:(o=r.cause)!=null&&o.message?r.cause.message:r.details,s=r.cause instanceof Oh&&r.cause.docsPath||r.docsPath,a=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: https://abitype.dev${s}`]:[],...n?[`Details: ${n}`]:[],`Version: abitype@${_3}`].join(`
|
|
64
|
+
`,extractResults:d=>{var f;return(((f=d.data)==null?void 0:f.orderFilleds)||[]).map(h=>({...h,timestamp:new Date(h.timestamp).getTime()}))}})};class Tw extends Error{constructor(){super("No graph endpoint found"),this.name="NoGraphEndpointError"}}const Aw=async({chainId:e,signal:t,page:r,limit:n,filters:s})=>{try{const a=await Ew({chainId:e,signal:t,page:r,limit:n,filters:s}),[o,i]=await Promise.all([Cw({chainId:e,orders:a,signal:t}),kw({chainId:e,orders:a,signal:t})]);return a.map(l=>{const u=o==null?void 0:o.filter(d=>d.TWAP_id===Number(l.Contract_id)&&Ps(d.exchange,l.exchange)&&Ps(d.twapAddress,l.twapAddress));return ww(l,e,u,Sw(l,u||[],i))}).sort((l,u)=>u.createdAt-l.createdAt)}catch{return[]}},Sw=(e,t,r)=>{var i;const n=(i=r==null?void 0:r.find(c=>c.twapId===e.Contract_id.toString()&&Ps(c.twapAddress,e.twapAddress)))==null?void 0:i.status,a=Fm(t).reduce((c,l)=>c.plus(l.inAmount),new j(0)).toFixed(),o=Om(e.ask_srcAmount,a);return Pw(o,e.ask_deadline*1e3,n)},Om=(e,t)=>{if(!t||!e)return 0;const r=j(t).dividedBy(e).toNumber();return r>=.99?100:r<=0?0:Number((r*100).toFixed(2))},Pw=(e,t,r)=>e===100?ct.Completed:r==="CANCELED"?ct.Canceled:r==="COMPLETED"?ct.Completed:t>Date.now()?ct.Open:ct.Expired,Dm=async({signal:e,page:t,chainId:r,limit:n,config:s,account:a})=>(await Promise.all([s?Aw({chainId:r,signal:e,page:t,limit:n,filters:{accounts:[a],configs:s.twapConfig?[s.twapConfig]:[]}}):Promise.resolve([]),gw({chainId:r,signal:e,account:a,exchange:s==null?void 0:s.adapter})]).then(([c,l])=>[...c,...l])).sort((c,l)=>l.createdAt-c.createdAt),Iw={version:"0.0.74"};var Aa=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(){}},Bw={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Fw=(g5=class{constructor(){le(this,pn,Bw);le(this,pa,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&N(this,pa)&&e!==N(this,pn)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:N(this,pn),provider:e}),J(this,pn,e),process.env.NODE_ENV!=="production"&&J(this,pa,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&J(this,pa,!0),N(this,pn).setTimeout(e,t)}clearTimeout(e){N(this,pn).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&J(this,pa,!0),N(this,pn).setInterval(e,t)}clearInterval(e){N(this,pn).clearInterval(e)}},pn=new WeakMap,pa=new WeakMap,g5),Fs=new Fw;function Uw(e){setTimeout(e,0)}var Us=typeof window>"u"||"Deno"in globalThis;function jt(){}function Ow(e,t){return typeof e=="function"?e(t):e}function md(e){return typeof e=="number"&&e>=0&&e!==1/0}function _m(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Zn(e,t){return typeof e=="function"?e(t):e}function wr(e,t){return typeof e=="function"?e(t):e}function Mm(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:a,queryKey:o,stale:i}=e;if(o){if(n){if(t.queryHash!==bd(o,t.options))return!1}else if(!Oo(t.queryKey,o))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||s&&s!==t.state.fetchStatus||a&&!a(t))}function Nm(e,t){const{exact:r,status:n,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(Os(t.options.mutationKey)!==Os(a))return!1}else if(!Oo(t.options.mutationKey,a))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function bd(e,t){return((t==null?void 0:t.queryKeyHashFn)||Os)(e)}function Os(e){return JSON.stringify(e,(t,r)=>gd(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function Oo(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Oo(e[r],t[r])):!1}var Dw=Object.prototype.hasOwnProperty;function yd(e,t){if(e===t)return e;const r=Lm(e)&&Lm(t);if(!r&&!(gd(e)&&gd(t)))return t;const s=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,i=r?new Array(o):{};let c=0;for(let l=0;l<o;l++){const u=r?l:a[l],d=e[u],f=t[u];if(d===f){i[u]=d,(r?l<s:Dw.call(e,u))&&c++;continue}if(d===null||f===null||typeof d!="object"||typeof f!="object"){i[u]=f;continue}const h=yd(d,f);i[u]=h,h===d&&c++}return s===o&&c===s?e:i}function Uc(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Lm(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function gd(e){if(!zm(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!zm(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function zm(e){return Object.prototype.toString.call(e)==="[object Object]"}function _w(e){return new Promise(t=>{Fs.setTimeout(t,e)})}function xd(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return yd(e,t)}catch(n){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. [${r.queryHash}]: ${n}`),n}return yd(e,t)}return t}function Mw(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function Nw(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Oc=Symbol();function Rm(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Oc&&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===Oc?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Hm(e,t){return typeof e=="function"?e(...t):!!e}var Lw=(x5=class extends Aa{constructor(){super();le(this,fa);le(this,ys);le(this,xo);J(this,xo,t=>{if(!Us&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){N(this,ys)||this.setEventListener(N(this,xo))}onUnsubscribe(){var t;this.hasListeners()||((t=N(this,ys))==null||t.call(this),J(this,ys,void 0))}setEventListener(t){var r;J(this,xo,t),(r=N(this,ys))==null||r.call(this),J(this,ys,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){N(this,fa)!==t&&(J(this,fa,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof N(this,fa)=="boolean"?N(this,fa):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},fa=new WeakMap,ys=new WeakMap,xo=new WeakMap,x5),wd=new Lw;function vd(){let e,t;const r=new Promise((s,a)=>{e=s,t=a});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}var zw=Uw;function Rw(){let e=[],t=0,r=i=>{i()},n=i=>{i()},s=zw;const a=i=>{t?e.push(i):s(()=>{r(i)})},o=()=>{const i=e;e=[],i.length&&s(()=>{n(()=>{i.forEach(c=>{r(c)})})})};return{batch:i=>{let c;t++;try{c=i()}finally{t--,t||o()}return c},batchCalls:i=>(...c)=>{a(()=>{i(...c)})},schedule:a,setNotifyFunction:i=>{r=i},setBatchNotifyFunction:i=>{n=i},setScheduler:i=>{s=i}}}var kt=Rw(),Hw=(w5=class extends Aa{constructor(){super();le(this,wo,!0);le(this,gs);le(this,vo);J(this,vo,t=>{if(!Us&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){N(this,gs)||this.setEventListener(N(this,vo))}onUnsubscribe(){var t;this.hasListeners()||((t=N(this,gs))==null||t.call(this),J(this,gs,void 0))}setEventListener(t){var r;J(this,vo,t),(r=N(this,gs))==null||r.call(this),J(this,gs,t(this.setOnline.bind(this)))}setOnline(t){N(this,wo)!==t&&(J(this,wo,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return N(this,wo)}},wo=new WeakMap,gs=new WeakMap,vo=new WeakMap,w5),Dc=new Hw;function $w(e){return Math.min(1e3*2**e,3e4)}function $m(e){return(e??"online")==="online"?Dc.isOnline():!0}var Ed=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Gm(e){let t=!1,r=0,n;const s=vd(),a=()=>s.status!=="pending",o=g=>{var E;if(!a()){const v=new Ed(g);f(v),(E=e.onCancel)==null||E.call(e,v)}},i=()=>{t=!0},c=()=>{t=!1},l=()=>wd.isFocused()&&(e.networkMode==="always"||Dc.isOnline())&&e.canRun(),u=()=>$m(e.networkMode)&&e.canRun(),d=g=>{a()||(n==null||n(),s.resolve(g))},f=g=>{a()||(n==null||n(),s.reject(g))},h=()=>new Promise(g=>{var E;n=v=>{(a()||l())&&g(v)},(E=e.onPause)==null||E.call(e)}).then(()=>{var g;n=void 0,a()||(g=e.onContinue)==null||g.call(e)}),y=()=>{if(a())return;let g;const E=r===0?e.initialPromise:void 0;try{g=E??e.fn()}catch(v){g=Promise.reject(v)}Promise.resolve(g).then(d).catch(v=>{var z;if(a())return;const w=e.retry??(Us?0:3),A=e.retryDelay??$w,C=typeof A=="function"?A(r,v):A,D=w===!0||typeof w=="number"&&r<w||typeof w=="function"&&w(r,v);if(t||!D){f(v);return}r++,(z=e.onFail)==null||z.call(e,r,v),_w(C).then(()=>l()?void 0:h()).then(()=>{t?f(v):y()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:i,continueRetry:c,canStart:u,start:()=>(u()?y():h().then(y),s)}}var jm=(v5=class{constructor(){le(this,ha)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),md(this.gcTime)&&J(this,ha,Fs.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Us?1/0:300*1e3))}clearGcTimeout(){N(this,ha)&&(Fs.clearTimeout(N(this,ha)),J(this,ha,void 0))}},ha=new WeakMap,v5),Gw=(E5=class extends jm{constructor(t){super();le(this,Kr);le(this,ma);le(this,Eo);le(this,Ir);le(this,ba);le(this,Bt);le(this,vc);le(this,ya);J(this,ya,!1),J(this,vc,t.defaultOptions),this.setOptions(t.options),this.observers=[],J(this,ba,t.client),J(this,Ir,N(this,ba).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,J(this,ma,qm(this.options)),this.state=t.state??N(this,ma),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=N(this,Bt))==null?void 0:t.promise}setOptions(t){if(this.options={...N(this,vc),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=qm(this.options);r.data!==void 0&&(this.setState(Wm(r.data,r.dataUpdatedAt)),J(this,ma,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&N(this,Ir).remove(this)}setData(t,r){const n=xd(this.state.data,t,this.options);return Se(this,Kr,qn).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){Se(this,Kr,qn).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var n,s;const r=(n=N(this,Bt))==null?void 0:n.promise;return(s=N(this,Bt))==null||s.cancel(t),r?r.then(jt).catch(jt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(N(this,ma))}isActive(){return this.observers.some(t=>wr(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Oc||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Zn(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:!_m(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=N(this,Bt))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=N(this,Bt))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),N(this,Ir).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(N(this,Bt)&&(N(this,ya)?N(this,Bt).cancel({revert:!0}):N(this,Bt).cancelRetry()),this.scheduleGc()),N(this,Ir).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Se(this,Kr,qn).call(this,{type:"invalidate"})}async fetch(t,r){var c,l,u,d,f,h,y,g,E,v,w,A;if(this.state.fetchStatus!=="idle"&&((c=N(this,Bt))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(N(this,Bt))return N(this,Bt).continueRetry(),N(this,Bt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const C=this.observers.find(D=>D.options.queryFn);C&&this.setOptions(C.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 n=new AbortController,s=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(J(this,ya,!0),n.signal)})},a=()=>{const C=Rm(this.options,r),z=(()=>{const T={client:N(this,ba),queryKey:this.queryKey,meta:this.meta};return s(T),T})();return J(this,ya,!1),this.options.persister?this.options.persister(C,z,this):C(z)},i=(()=>{const C={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:N(this,ba),state:this.state,fetchFn:a};return s(C),C})();(l=this.options.behavior)==null||l.onFetch(i,this),J(this,Eo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=i.fetchOptions)==null?void 0:u.meta))&&Se(this,Kr,qn).call(this,{type:"fetch",meta:(d=i.fetchOptions)==null?void 0:d.meta}),J(this,Bt,Gm({initialPromise:r==null?void 0:r.initialPromise,fn:i.fetchFn,onCancel:C=>{C instanceof Ed&&C.revert&&this.setState({...N(this,Eo),fetchStatus:"idle"}),n.abort()},onFail:(C,D)=>{Se(this,Kr,qn).call(this,{type:"failed",failureCount:C,error:D})},onPause:()=>{Se(this,Kr,qn).call(this,{type:"pause"})},onContinue:()=>{Se(this,Kr,qn).call(this,{type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0}));try{const C=await N(this,Bt).start();if(C===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(C),(h=(f=N(this,Ir).config).onSuccess)==null||h.call(f,C,this),(g=(y=N(this,Ir).config).onSettled)==null||g.call(y,C,this.state.error,this),C}catch(C){if(C instanceof Ed){if(C.silent)return N(this,Bt).promise;if(C.revert){if(this.state.data===void 0)throw C;return this.state.data}}throw Se(this,Kr,qn).call(this,{type:"error",error:C}),(v=(E=N(this,Ir).config).onError)==null||v.call(E,C,this),(A=(w=N(this,Ir).config).onSettled)==null||A.call(w,this.state.data,C,this),C}finally{this.scheduleGc()}}},ma=new WeakMap,Eo=new WeakMap,Ir=new WeakMap,ba=new WeakMap,Bt=new WeakMap,vc=new WeakMap,ya=new WeakMap,Kr=new WeakSet,qn=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Vm(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...Wm(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return J(this,Eo,t.manual?s:void 0),s;case"error":const a=t.error;return{...n,error:a,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),kt.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),N(this,Ir).notify({query:this,type:"updated",action:t})})},E5);function Vm(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:$m(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Wm(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function qm(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var jw=(k5=class extends Aa{constructor(t,r){super();le(this,Ve);le(this,sr);le(this,Oe);le(this,Ec);le(this,qt);le(this,ga);le(this,ko);le(this,$n);le(this,xs);le(this,kc);le(this,Co);le(this,To);le(this,xa);le(this,wa);le(this,ws);le(this,Ao,new Set);this.options=r,J(this,sr,t),J(this,xs,null),J(this,$n,vd()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(N(this,Oe).addObserver(this),Km(N(this,Oe),this.options)?Se(this,Ve,Ac).call(this):this.updateResult(),Se(this,Ve,Ph).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return kd(N(this,Oe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return kd(N(this,Oe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Se(this,Ve,Ih).call(this),Se(this,Ve,Bh).call(this),N(this,Oe).removeObserver(this)}setOptions(t){const r=this.options,n=N(this,Oe);if(this.options=N(this,sr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof wr(this.options.enabled,N(this,Oe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Se(this,Ve,Fh).call(this),N(this,Oe).setOptions(this.options),r._defaulted&&!Uc(this.options,r)&&N(this,sr).getQueryCache().notify({type:"observerOptionsUpdated",query:N(this,Oe),observer:this});const s=this.hasListeners();s&&Ym(N(this,Oe),n,this.options,r)&&Se(this,Ve,Ac).call(this),this.updateResult(),s&&(N(this,Oe)!==n||wr(this.options.enabled,N(this,Oe))!==wr(r.enabled,N(this,Oe))||Zn(this.options.staleTime,N(this,Oe))!==Zn(r.staleTime,N(this,Oe)))&&Se(this,Ve,Th).call(this);const a=Se(this,Ve,Ah).call(this);s&&(N(this,Oe)!==n||wr(this.options.enabled,N(this,Oe))!==wr(r.enabled,N(this,Oe))||a!==N(this,ws))&&Se(this,Ve,Sh).call(this,a)}getOptimisticResult(t){const r=N(this,sr).getQueryCache().build(N(this,sr),t),n=this.createResult(r,t);return Ww(this,n)&&(J(this,qt,n),J(this,ko,this.options),J(this,ga,N(this,Oe).state)),n}getCurrentResult(){return N(this,qt)}trackResult(t,r){return new Proxy(t,{get:(n,s)=>(this.trackProp(s),r==null||r(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&N(this,$n).status==="pending"&&N(this,$n).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){N(this,Ao).add(t)}getCurrentQuery(){return N(this,Oe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=N(this,sr).defaultQueryOptions(t),n=N(this,sr).getQueryCache().build(N(this,sr),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return Se(this,Ve,Ac).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),N(this,qt)))}createResult(t,r){var b;const n=N(this,Oe),s=this.options,a=N(this,qt),o=N(this,ga),i=N(this,ko),l=t!==n?t.state:N(this,Ec),{state:u}=t;let d={...u},f=!1,h;if(r._optimisticResults){const x=this.hasListeners(),S=!x&&Km(t,r),I=x&&Ym(t,n,r,s);(S||I)&&(d={...d,...Vm(u.data,t.options)}),r._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:y,errorUpdatedAt:g,status:E}=d;h=d.data;let v=!1;if(r.placeholderData!==void 0&&h===void 0&&E==="pending"){let x;a!=null&&a.isPlaceholderData&&r.placeholderData===(i==null?void 0:i.placeholderData)?(x=a.data,v=!0):x=typeof r.placeholderData=="function"?r.placeholderData((b=N(this,To))==null?void 0:b.state.data,N(this,To)):r.placeholderData,x!==void 0&&(E="success",h=xd(a==null?void 0:a.data,x,r),f=!0)}if(r.select&&h!==void 0&&!v)if(a&&h===(o==null?void 0:o.data)&&r.select===N(this,kc))h=N(this,Co);else try{J(this,kc,r.select),h=r.select(h),h=xd(a==null?void 0:a.data,h,r),J(this,Co,h),J(this,xs,null)}catch(x){J(this,xs,x)}N(this,xs)&&(y=N(this,xs),h=N(this,Co),g=Date.now(),E="error");const w=d.fetchStatus==="fetching",A=E==="pending",C=E==="error",D=A&&w,z=h!==void 0,m={status:E,fetchStatus:d.fetchStatus,isPending:A,isSuccess:E==="success",isError:C,isInitialLoading:D,isLoading:D,data:h,dataUpdatedAt:d.dataUpdatedAt,error:y,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:w,isRefetching:w&&!A,isLoadingError:C&&!z,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:C&&z,isStale:Cd(t,r),refetch:this.refetch,promise:N(this,$n),isEnabled:wr(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const x=F=>{m.status==="error"?F.reject(m.error):m.data!==void 0&&F.resolve(m.data)},S=()=>{const F=J(this,$n,m.promise=vd());x(F)},I=N(this,$n);switch(I.status){case"pending":t.queryHash===n.queryHash&&x(I);break;case"fulfilled":(m.status==="error"||m.data!==I.value)&&S();break;case"rejected":(m.status!=="error"||m.error!==I.reason)&&S();break}}return m}updateResult(){const t=N(this,qt),r=this.createResult(N(this,Oe),this.options);if(J(this,ga,N(this,Oe).state),J(this,ko,this.options),N(this,ga).data!==void 0&&J(this,To,N(this,Oe)),Uc(r,t))return;J(this,qt,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!N(this,Ao).size)return!0;const o=new Set(a??N(this,Ao));return this.options.throwOnError&&o.add("error"),Object.keys(N(this,qt)).some(i=>{const c=i;return N(this,qt)[c]!==t[c]&&o.has(c)})};Se(this,Ve,M5).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Se(this,Ve,Ph).call(this)}},sr=new WeakMap,Oe=new WeakMap,Ec=new WeakMap,qt=new WeakMap,ga=new WeakMap,ko=new WeakMap,$n=new WeakMap,xs=new WeakMap,kc=new WeakMap,Co=new WeakMap,To=new WeakMap,xa=new WeakMap,wa=new WeakMap,ws=new WeakMap,Ao=new WeakMap,Ve=new WeakSet,Ac=function(t){Se(this,Ve,Fh).call(this);let r=N(this,Oe).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(jt)),r},Th=function(){Se(this,Ve,Ih).call(this);const t=Zn(this.options.staleTime,N(this,Oe));if(Us||N(this,qt).isStale||!md(t))return;const n=_m(N(this,qt).dataUpdatedAt,t)+1;J(this,xa,Fs.setTimeout(()=>{N(this,qt).isStale||this.updateResult()},n))},Ah=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(N(this,Oe)):this.options.refetchInterval)??!1},Sh=function(t){Se(this,Ve,Bh).call(this),J(this,ws,t),!(Us||wr(this.options.enabled,N(this,Oe))===!1||!md(N(this,ws))||N(this,ws)===0)&&J(this,wa,Fs.setInterval(()=>{(this.options.refetchIntervalInBackground||wd.isFocused())&&Se(this,Ve,Ac).call(this)},N(this,ws)))},Ph=function(){Se(this,Ve,Th).call(this),Se(this,Ve,Sh).call(this,Se(this,Ve,Ah).call(this))},Ih=function(){N(this,xa)&&(Fs.clearTimeout(N(this,xa)),J(this,xa,void 0))},Bh=function(){N(this,wa)&&(Fs.clearInterval(N(this,wa)),J(this,wa,void 0))},Fh=function(){const t=N(this,sr).getQueryCache().build(N(this,sr),this.options);if(t===N(this,Oe))return;const r=N(this,Oe);J(this,Oe,t),J(this,Ec,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},M5=function(t){kt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(N(this,qt))}),N(this,sr).getQueryCache().notify({query:N(this,Oe),type:"observerResultsUpdated"})})},k5);function Vw(e,t){return wr(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Km(e,t){return Vw(e,t)||e.state.data!==void 0&&kd(e,t,t.refetchOnMount)}function kd(e,t,r){if(wr(t.enabled,e)!==!1&&Zn(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Cd(e,t)}return!1}function Ym(e,t,r,n){return(e!==t||wr(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Cd(e,r)}function Cd(e,t){return wr(t.enabled,e)!==!1&&e.isStaleByTime(Zn(t.staleTime,e))}function Ww(e,t){return!Uc(e.getCurrentResult(),t)}function Zm(e){return{onFetch:(t,r)=>{var u,d,f,h,y;const n=t.options,s=(f=(d=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:f.direction,a=((h=t.state.data)==null?void 0:h.pages)||[],o=((y=t.state.data)==null?void 0:y.pageParams)||[];let i={pages:[],pageParams:[]},c=0;const l=async()=>{let g=!1;const E=A=>{Object.defineProperty(A,"signal",{enumerable:!0,get:()=>(t.signal.aborted?g=!0:t.signal.addEventListener("abort",()=>{g=!0}),t.signal)})},v=Rm(t.options,t.fetchOptions),w=async(A,C,D)=>{if(g)return Promise.reject();if(C==null&&A.pages.length)return Promise.resolve(A);const T=(()=>{const S={client:t.client,queryKey:t.queryKey,pageParam:C,direction:D?"backward":"forward",meta:t.options.meta};return E(S),S})(),m=await v(T),{maxPages:b}=t.options,x=D?Nw:Mw;return{pages:x(A.pages,m,b),pageParams:x(A.pageParams,C,b)}};if(s&&a.length){const A=s==="backward",C=A?qw:Xm,D={pages:a,pageParams:o},z=C(n,D);i=await w(D,z,A)}else{const A=e??a.length;do{const C=c===0?o[0]??n.initialPageParam:Xm(n,i);if(c>0&&C==null)break;i=await w(i,C),c++}while(c<A)}return i};t.options.persister?t.fetchFn=()=>{var g,E;return(E=(g=t.options).persister)==null?void 0:E.call(g,l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=l}}}function Xm(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function qw(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var Kw=(C5=class extends jm{constructor(t){super();le(this,hn);le(this,Cc);le(this,fn);le(this,Kt);le(this,va);J(this,Cc,t.client),this.mutationId=t.mutationId,J(this,Kt,t.mutationCache),J(this,fn,[]),this.state=t.state||Qm(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){N(this,fn).includes(t)||(N(this,fn).push(t),this.clearGcTimeout(),N(this,Kt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){J(this,fn,N(this,fn).filter(r=>r!==t)),this.scheduleGc(),N(this,Kt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){N(this,fn).length||(this.state.status==="pending"?this.scheduleGc():N(this,Kt).remove(this))}continue(){var t;return((t=N(this,va))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,c,l,u,d,f,h,y,g,E,v,w,A,C,D,z,T,m,b;const r=()=>{Se(this,hn,Ts).call(this,{type:"continue"})},n={client:N(this,Cc),meta:this.options.meta,mutationKey:this.options.mutationKey};J(this,va,Gm({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(x,S)=>{Se(this,hn,Ts).call(this,{type:"failed",failureCount:x,error:S})},onPause:()=>{Se(this,hn,Ts).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>N(this,Kt).canRun(this)}));const s=this.state.status==="pending",a=!N(this,va).canStart();try{if(s)r();else{Se(this,hn,Ts).call(this,{type:"pending",variables:t,isPaused:a}),await((i=(o=N(this,Kt).config).onMutate)==null?void 0:i.call(o,t,this,n));const S=await((l=(c=this.options).onMutate)==null?void 0:l.call(c,t,n));S!==this.state.context&&Se(this,hn,Ts).call(this,{type:"pending",context:S,variables:t,isPaused:a})}const x=await N(this,va).start();return await((d=(u=N(this,Kt).config).onSuccess)==null?void 0:d.call(u,x,t,this.state.context,this,n)),await((h=(f=this.options).onSuccess)==null?void 0:h.call(f,x,t,this.state.context,n)),await((g=(y=N(this,Kt).config).onSettled)==null?void 0:g.call(y,x,null,this.state.variables,this.state.context,this,n)),await((v=(E=this.options).onSettled)==null?void 0:v.call(E,x,null,t,this.state.context,n)),Se(this,hn,Ts).call(this,{type:"success",data:x}),x}catch(x){try{throw await((A=(w=N(this,Kt).config).onError)==null?void 0:A.call(w,x,t,this.state.context,this,n)),await((D=(C=this.options).onError)==null?void 0:D.call(C,x,t,this.state.context,n)),await((T=(z=N(this,Kt).config).onSettled)==null?void 0:T.call(z,void 0,x,this.state.variables,this.state.context,this,n)),await((b=(m=this.options).onSettled)==null?void 0:b.call(m,void 0,x,t,this.state.context,n)),x}finally{Se(this,hn,Ts).call(this,{type:"error",error:x})}}finally{N(this,Kt).runNext(this)}}},Cc=new WeakMap,fn=new WeakMap,Kt=new WeakMap,va=new WeakMap,hn=new WeakSet,Ts=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,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{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),kt.batch(()=>{N(this,fn).forEach(n=>{n.onMutationUpdate(t)}),N(this,Kt).notify({mutation:this,type:"updated",action:t})})},C5);function Qm(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Yw=(T5=class extends Aa{constructor(t={}){super();le(this,Gn);le(this,Yr);le(this,Tc);this.config=t,J(this,Gn,new Set),J(this,Yr,new Map),J(this,Tc,0)}build(t,r,n){const s=new Kw({client:t,mutationCache:this,mutationId:++Yu(this,Tc)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){N(this,Gn).add(t);const r=_c(t);if(typeof r=="string"){const n=N(this,Yr).get(r);n?n.push(t):N(this,Yr).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(N(this,Gn).delete(t)){const r=_c(t);if(typeof r=="string"){const n=N(this,Yr).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&N(this,Yr).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=_c(t);if(typeof r=="string"){const n=N(this,Yr).get(r),s=n==null?void 0:n.find(a=>a.state.status==="pending");return!s||s===t}else return!0}runNext(t){var n;const r=_c(t);if(typeof r=="string"){const s=(n=N(this,Yr).get(r))==null?void 0:n.find(a=>a!==t&&a.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){kt.batch(()=>{N(this,Gn).forEach(t=>{this.notify({type:"removed",mutation:t})}),N(this,Gn).clear(),N(this,Yr).clear()})}getAll(){return Array.from(N(this,Gn))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Nm(r,n))}findAll(t={}){return this.getAll().filter(r=>Nm(t,r))}notify(t){kt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return kt.batch(()=>Promise.all(t.map(r=>r.continue().catch(jt))))}},Gn=new WeakMap,Yr=new WeakMap,Tc=new WeakMap,T5);function _c(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Zw=(A5=class extends Aa{constructor(t,r){super();le(this,Wn);le(this,jn);le(this,vs);le(this,ar);le(this,Vn);J(this,jn,t),this.setOptions(r),this.bindMethods(),Se(this,Wn,Zu).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var n;const r=this.options;this.options=N(this,jn).defaultMutationOptions(t),Uc(this.options,r)||N(this,jn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:N(this,ar),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Os(r.mutationKey)!==Os(this.options.mutationKey)?this.reset():((n=N(this,ar))==null?void 0:n.state.status)==="pending"&&N(this,ar).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=N(this,ar))==null||t.removeObserver(this)}onMutationUpdate(t){Se(this,Wn,Zu).call(this),Se(this,Wn,Uh).call(this,t)}getCurrentResult(){return N(this,vs)}reset(){var t;(t=N(this,ar))==null||t.removeObserver(this),J(this,ar,void 0),Se(this,Wn,Zu).call(this),Se(this,Wn,Uh).call(this)}mutate(t,r){var n;return J(this,Vn,r),(n=N(this,ar))==null||n.removeObserver(this),J(this,ar,N(this,jn).getMutationCache().build(N(this,jn),this.options)),N(this,ar).addObserver(this),N(this,ar).execute(t)}},jn=new WeakMap,vs=new WeakMap,ar=new WeakMap,Vn=new WeakMap,Wn=new WeakSet,Zu=function(){var r;const t=((r=N(this,ar))==null?void 0:r.state)??Qm();J(this,vs,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},Uh=function(t){kt.batch(()=>{var r,n,s,a,o,i,c,l;if(N(this,Vn)&&this.hasListeners()){const u=N(this,vs).variables,d=N(this,vs).context,f={client:N(this,jn),meta:this.options.meta,mutationKey:this.options.mutationKey};(t==null?void 0:t.type)==="success"?((n=(r=N(this,Vn)).onSuccess)==null||n.call(r,t.data,u,d,f),(a=(s=N(this,Vn)).onSettled)==null||a.call(s,t.data,null,u,d,f)):(t==null?void 0:t.type)==="error"&&((i=(o=N(this,Vn)).onError)==null||i.call(o,t.error,u,d,f),(l=(c=N(this,Vn)).onSettled)==null||l.call(c,void 0,t.error,u,d,f))}this.listeners.forEach(u=>{u(N(this,vs))})})},A5),Xw=(S5=class extends Aa{constructor(t={}){super();le(this,mn);this.config=t,J(this,mn,new Map)}build(t,r,n){const s=r.queryKey,a=r.queryHash??bd(s,r);let o=this.get(a);return o||(o=new Gw({client:t,queryKey:s,queryHash:a,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){N(this,mn).has(t.queryHash)||(N(this,mn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=N(this,mn).get(t.queryHash);r&&(t.destroy(),r===t&&N(this,mn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){kt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return N(this,mn).get(t)}getAll(){return[...N(this,mn).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Mm(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>Mm(t,n)):r}notify(t){kt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){kt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){kt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},mn=new WeakMap,S5),Qw=(P5=class{constructor(e={}){le(this,ft);le(this,Es);le(this,ks);le(this,So);le(this,Po);le(this,Cs);le(this,Io);le(this,Bo);J(this,ft,e.queryCache||new Xw),J(this,Es,e.mutationCache||new Yw),J(this,ks,e.defaultOptions||{}),J(this,So,new Map),J(this,Po,new Map),J(this,Cs,0)}mount(){Yu(this,Cs)._++,N(this,Cs)===1&&(J(this,Io,wd.subscribe(async e=>{e&&(await this.resumePausedMutations(),N(this,ft).onFocus())})),J(this,Bo,Dc.subscribe(async e=>{e&&(await this.resumePausedMutations(),N(this,ft).onOnline())})))}unmount(){var e,t;Yu(this,Cs)._--,N(this,Cs)===0&&((e=N(this,Io))==null||e.call(this),J(this,Io,void 0),(t=N(this,Bo))==null||t.call(this),J(this,Bo,void 0))}isFetching(e){return N(this,ft).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return N(this,Es).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=N(this,ft).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=N(this,ft).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Zn(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return N(this,ft).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),s=N(this,ft).get(n.queryHash),a=s==null?void 0:s.state.data,o=Ow(t,a);if(o!==void 0)return N(this,ft).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return kt.batch(()=>N(this,ft).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=N(this,ft).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=N(this,ft);kt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=N(this,ft);return kt.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=kt.batch(()=>N(this,ft).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(jt).catch(jt)}invalidateQueries(e,t={}){return kt.batch(()=>(N(this,ft).findAll(e).forEach(r=>{r.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 r={...t,cancelRefetch:t.cancelRefetch??!0},n=kt.batch(()=>N(this,ft).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let a=s.fetch(void 0,r);return r.throwOnError||(a=a.catch(jt)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(jt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=N(this,ft).build(this,t);return r.isStaleByTime(Zn(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(jt).catch(jt)}fetchInfiniteQuery(e){return e.behavior=Zm(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(jt).catch(jt)}ensureInfiniteQueryData(e){return e.behavior=Zm(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Dc.isOnline()?N(this,Es).resumePausedMutations():Promise.resolve()}getQueryCache(){return N(this,ft)}getMutationCache(){return N(this,Es)}getDefaultOptions(){return N(this,ks)}setDefaultOptions(e){J(this,ks,e)}setQueryDefaults(e,t){N(this,So).set(Os(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...N(this,So).values()],r={};return t.forEach(n=>{Oo(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){N(this,Po).set(Os(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...N(this,Po).values()],r={};return t.forEach(n=>{Oo(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...N(this,ks).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=bd(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===Oc&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...N(this,ks).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){N(this,ft).clear(),N(this,Es).clear()}},ft=new WeakMap,Es=new WeakMap,ks=new WeakMap,So=new WeakMap,Po=new WeakMap,Cs=new WeakMap,Io=new WeakMap,Bo=new WeakMap,P5),Jm=xt.createContext(void 0),Td=e=>{const t=xt.useContext(Jm);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Jw=({client:e,children:t})=>(xt.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),B.jsx(Jm.Provider,{value:e,children:t})),e1=xt.createContext(!1),e3=()=>xt.useContext(e1);e1.Provider;function t3(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var r3=xt.createContext(t3()),n3=()=>xt.useContext(r3),s3=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},a3=e=>{xt.useEffect(()=>{e.clearReset()},[e])},o3=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||Hm(r,[e.error,n])),i3=e=>{if(e.suspense){const r=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>r(n(...s)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},c3=(e,t)=>e.isLoading&&e.isFetching&&!t,l3=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,t1=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function u3(e,t,r){var d,f,h,y,g;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 n=e3(),s=n3(),a=Td(),o=a.defaultQueryOptions(e);(f=(d=a.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||f.call(d,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=n?"isRestoring":"optimistic",i3(o),s3(o,s),a3(s);const i=!a.getQueryCache().get(o.queryHash),[c]=xt.useState(()=>new t(a,o)),l=c.getOptimisticResult(o),u=!n&&e.subscribed!==!1;if(xt.useSyncExternalStore(xt.useCallback(E=>{const v=u?c.subscribe(kt.batchCalls(E)):jt;return c.updateResult(),v},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),xt.useEffect(()=>{c.setOptions(o)},[o,c]),l3(o,l))throw t1(o,c,s);if(o3({result:l,errorResetBoundary:s,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw l.error;if((y=(h=a.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||y.call(h,o,l),o.experimental_prefetchInRender&&!Us&&c3(l,n)){const E=i?t1(o,c,s):(g=a.getQueryCache().get(o.queryHash))==null?void 0:g.promise;E==null||E.catch(jt).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?l:c.trackResult(l)}function d3(e,t){return u3(e,jw)}function Zr(e,t){const r=Td(),[n]=xt.useState(()=>new Zw(r,e));xt.useEffect(()=>{n.setOptions(e)},[n,e]);const s=xt.useSyncExternalStore(xt.useCallback(o=>n.subscribe(kt.batchCalls(o)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),a=xt.useCallback((o,i)=>{n.mutate(o,i).catch(jt)},[n]);if(s.error&&Hm(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:a,mutateAsync:s.mutate}}const p3=M.createContext(null),Ad={didCatch:!1,error:null};class f3 extends M.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Ad}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var r,n,s=arguments.length,a=new Array(s),o=0;o<s;o++)a[o]=arguments[o];(r=(n=this.props).onReset)===null||r===void 0||r.call(n,{args:a,reason:"imperative-api"}),this.setState(Ad)}}componentDidCatch(t,r){var n,s;(n=(s=this.props).onError)===null||n===void 0||n.call(s,t,r)}componentDidUpdate(t,r){const{didCatch:n}=this.state,{resetKeys:s}=this.props;if(n&&r.error!==null&&h3(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(Ad)}}render(){const{children:t,fallbackRender:r,FallbackComponent:n,fallback:s}=this.props,{didCatch:a,error:o}=this.state;let i=t;if(a){const c={error:o,resetErrorBoundary:this.resetErrorBoundary};if(typeof r=="function")i=r(c);else if(n)i=M.createElement(n,c);else if(s!==void 0)i=s;else throw o}return M.createElement(p3.Provider,{value:{didCatch:a,error:o,resetErrorBoundary:this.resetErrorBoundary}},i)}}function h3(){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((r,n)=>!Object.is(r,t[n]))}const r1=e=>{let t;const r=new Set,n=(l,u)=>{const d=typeof l=="function"?l(t):l;if(!Object.is(d,t)){const f=t;t=u??(typeof d!="object"||d===null)?d:Object.assign({},t,d),r.forEach(h=>h(t,f))}},s=()=>t,i={setState:n,getState:s,getInitialState:()=>c,subscribe:l=>(r.add(l),()=>r.delete(l))},c=t=e(n,s,i);return i},m3=(e=>e?r1(e):r1),b3=e=>e;function y3(e,t=b3){const r=M.useSyncExternalStore(e.subscribe,M.useCallback(()=>t(e.getState()),[e,t]),M.useCallback(()=>t(e.getInitialState()),[e,t]));return M.useDebugValue(r),r}const n1=e=>{const t=m3(e),r=n=>y3(t,n);return Object.assign(r,t),r},g3=(e=>e?n1(e):n1),s1={disclaimerAccepted:!0,currentTime:Date.now(),swapExecution:{}},te=g3((e,t)=>({state:s1,updateState:r=>e(n=>({state:{...n.state,...r}})),updateSwapExecution:r=>e(n=>({state:{...n.state,swapExecution:{...n.state.swapExecution,...r}}})),resetState:()=>{e({state:{...s1,currentTime:Date.now(),swapExecution:t().state.swapExecution,isMarketOrder:t().state.isMarketOrder}})}}));(function(){try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".orbs_OrbsLogo{object-fit:contain;display:inline}.orbs_PoweredBy{border-radius:8px;margin-left:auto;margin-right:auto}.orbs_PoweredBy a{display:flex;align-items:center;justify-content:center;text-decoration:none;color:inherit}.orbs_PoweredBy span{font-size:14px}.orbs_PoweredBy .orbs_OrbsLogo{margin-left:6px;margin-right:6px;width:18px;height:18px}.orbs_Text{margin:0;padding:0}.orbs_Spinner{width:var(--size, 38px);height:var(--size, 38px);border:var(--border-width, 3px) solid var(--border-color, white);border-bottom-color:var(--bottom-border-color, rgba(255, 255, 255, .2));border-radius:50%;display:inline-block;box-sizing:border-box;animation:orbs_rotation 1s linear infinite}@keyframes orbs_rotation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.orbs_TradeStepLayout{--layout-min-height: 220px;--layout-width: 100%;--layout-display: flex;--layout-direction: column;--layout-align: center;--layout-overflow: visible;display:var(--layout-display);flex-direction:var(--layout-direction);align-items:var(--layout-align);width:var(--layout-width);min-height:var(--layout-min-height);overflow:var(--layout-overflow)}.orbs_TradeStepLayoutBody{--body-gap: 20px;--body-margin-top: 30px;--body-width: 100%;--body-display: flex;--body-direction: column;--body-align: center;--body-overflow: visible;gap:var(--body-gap);align-items:var(--body-align);display:var(--body-display);flex-direction:var(--body-direction);width:var(--body-width);margin-top:var(--body-margin-top);overflow:var(--body-overflow)}.orbs_TradeStepLayoutHeader{--header-gap: 30px;--header-display: flex;--header-direction: column;--header-align: center;--header-justify: center;--header-overflow: visible;display:var(--header-display);flex-direction:var(--header-direction);align-items:var(--header-align);justify-content:var(--header-justify);gap:var(--header-gap);overflow:var(--header-overflow)}.orbs_TradeStepLayoutTitle{--title-font-size: 18px;--title-font-weight: 500;--title-line-height: normal;--title-color: inherit;--title-text-align: center;--title-margin: 0;--title-padding: 0;font-size:var(--title-font-size);font-weight:var(--title-font-weight);line-height:var(--title-line-height);color:var(--title-color);text-align:var(--title-text-align);margin:var(--title-margin);padding:var(--title-padding)}.orbs_StepIndicator{--indicator-display: flex;--indicator-align: center;--indicator-justify: flex-start;--indicator-height: 7px;--indicator-width: 120px;--indicator-border-radius: 999px;--indicator-bg-color: white;--indicator-margin-bottom: 20px;--indicator-position: relative;--indicator-overflow: hidden;--indicator-border: none;--indicator-box-shadow: none;display:var(--indicator-display);align-items:var(--indicator-align);justify-content:var(--indicator-justify);height:var(--indicator-height);width:var(--indicator-width);border-radius:var(--indicator-border-radius);overflow:var(--indicator-overflow);background-color:var(--indicator-bg-color);margin-bottom:var(--indicator-margin-bottom);position:var(--indicator-position);border:var(--indicator-border);box-shadow:var(--indicator-box-shadow)}.orbs_StepIndicatorLine{--line-height: 100%;--line-bg-color: black;--line-position: absolute;--line-top: 0;--line-left: 0;--line-right: 0;--line-bottom: 0;--line-transition: all .3s ease;--line-border-radius: inherit;--line-box-shadow: none;height:var(--line-height);background-color:var(--line-bg-color);position:var(--line-position);top:var(--line-top);left:var(--line-left);right:var(--line-right);bottom:var(--line-bottom);transition:var(--line-transition);border-radius:var(--line-border-radius);box-shadow:var(--line-box-shadow)}.orbs_TradeStepLayoutFooter{--footer-display: flex;--footer-align: center;--footer-justify: center;--footer-direction: column;--footer-margin-top: auto;--footer-padding-top: 30px;--footer-width: 100%;--footer-overflow: visible;--footer-border-top: none;display:var(--footer-display);align-items:var(--footer-align);justify-content:var(--footer-justify);flex-direction:var(--footer-direction);margin-top:var(--footer-margin-top);padding-top:var(--footer-padding-top);width:var(--footer-width);overflow:var(--footer-overflow);border-top:var(--footer-border-top)}.orbs_TradeStepLayoutFooter p{--footer-text-font-size: 15px;--footer-text-line-height: normal;--footer-text-color: inherit;--footer-text-margin: 0;--footer-text-padding: 0;font-size:var(--footer-text-font-size);line-height:var(--footer-text-line-height);color:var(--footer-text-color);margin:var(--footer-text-margin);padding:var(--footer-text-padding)}.orbs_TradeStepLayoutFooterLink{--link-color: inherit;--link-text-decoration: none;--link-font-size: 15px;--link-text-align: center;--link-margin: auto;--link-outline: none;--link-line-height: normal;--link-padding: 0;--link-transition: color .2s ease;--link-hover-color: inherit;--link-hover-text-decoration: underline;color:var(--link-color);text-decoration:var(--link-text-decoration);font-size:var(--link-font-size);text-align:var(--link-text-align);margin-left:var(--link-margin);margin-right:var(--link-margin);outline:var(--link-outline);line-height:var(--link-line-height);padding:var(--link-padding);transition:var(--link-transition)}.orbs_TradeStepLayoutFooterLink:hover{color:var(--link-hover-color);text-decoration:var(--link-hover-text-decoration)}.orbs_TradeStepLayoutSuccessIcon{--success-icon-display: flex;--success-icon-justify: center;--success-icon-align: center;--success-icon-width: 60px;--success-icon-height: 60px;--success-icon-border-radius: 50%;--success-icon-overflow: visible;--success-icon-bg-color: transparent;--success-icon-border: none;--success-icon-box-shadow: none;display:var(--success-icon-display);justify-content:var(--success-icon-justify);align-items:var(--success-icon-align);width:var(--success-icon-width);height:var(--success-icon-height);border-radius:var(--success-icon-border-radius);overflow:var(--success-icon-overflow);background-color:var(--success-icon-bg-color);border:var(--success-icon-border);box-shadow:var(--success-icon-box-shadow)}.orbs_TradeStepLayoutErrorIcon{--error-icon-width: 80px;--error-icon-height: 80px;--error-icon-display: flex;--error-icon-justify: center;--error-icon-align: center;--error-icon-overflow: visible;--error-icon-bg-color: transparent;--error-icon-border: none;--error-icon-box-shadow: none;width:var(--error-icon-width);height:var(--error-icon-height);display:var(--error-icon-display);justify-content:var(--error-icon-justify);align-items:var(--error-icon-align);overflow:var(--error-icon-overflow);background-color:var(--error-icon-bg-color);border:var(--error-icon-border);box-shadow:var(--error-icon-box-shadow)}.orbs_FailedContentMsg{font-size:22px;font-weight:500}.orbs_TradePreview{display:flex;align-items:center;justify-content:center;gap:8px;width:100%}.orbs_TradePreviewToken{display:flex;align-items:center;gap:6px;max-width:calc(50% - 30px)}.orbs_TradePreviewToken p{--token-font-size: 15px;--token-white-space: nowrap;--token-overflow: hidden;--token-text-overflow: ellipsis;--token-flex: 1;--token-margin: 0;--token-padding: 0;font-size:var(--token-font-size);white-space:var(--token-white-space);overflow:var(--token-overflow);text-overflow:var(--token-text-overflow);flex:var(--token-flex);margin:var(--token-margin)}.orbs_TradepPreviewIcon{width:22px;height:22px}.orbs_TradepPreviewLogo{width:24px;height:24px;border-radius:50%;overflow:hidden}.orbs_FlexRow{display:flex;flex-direction:row}.orbs_FlexColumn{display:flex;flex-direction:column}@keyframes orbs_skeletonAnimation{0%{opacity:.2}to{opacity:.4}}.orbs_SkeletonLoader{animation:orbs_skeletonAnimation 1s linear infinite alternate;background-color:#fff}.orbs_Main-wrapper{width:100%}.orbs_Main{width:100%;display:flex;flex-direction:column;gap:28px}.orbs_MainToken{display:flex;flex-direction:row;align-items:center;justify-content:space-between;width:100%;gap:8px}.orbs_MainTokenLeft{display:flex;flex-direction:column;align-items:flex-start;gap:8px}.orbs_MainTokenUsd{display:flex;align-items:center;gap:5px}.orbs_MainTokenUsd small{font-size:12px;opacity:.6}.orbs_MainContentLoader{width:100%;display:flex;gap:15px;align-items:center;margin-top:20px}.orbs_MainContentRectengularLoader{flex:1;height:20px;max-width:250px;border-radius:20px}.orbs_MainContentCircleLoader{width:30px;height:30px;border-radius:50%}.orbs_MainTokenLogo{--width: 40px;--height: 40px;width:var(--width);height:var(--height)}.orbs_MainTokenLogo img{width:100%;height:100%;object-fit:cover}.orbs_SwapFlow{display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%}.orbs_SwapFlow *{box-sizing:border-box}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();const Ne=e=>`orbs_${e}`;function Do({children:e,className:t=""}){return B.jsx("p",{className:`${t} ${Ne("Text")}`,children:e})}const a1=M.createContext({});function x3({children:e,...t}){return B.jsx(a1.Provider,{value:t,children:e})}const Xr=()=>M.useContext(a1);var ht=(e=>(e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILED=3]="FAILED",e))(ht||{});const w3=({className:e="",size:t=38,borderWidth:r=3,borderColor:n="white",bottomBorderColor:s="rgba(255, 255, 255, 0.2)"})=>{const a={"--size":`${t}px`,"--border-width":`${r}px`,"--border-color":n,"--bottom-border-color":s};return B.jsx("div",{className:`${Ne("Spinner")} ${e}`,style:a})};function Mc({className:e="",body:t,footerLink:r,footerText:n,title:s,children:a}){return B.jsxs("div",{className:`${Ne("TradeStepLayout")} ${e}`,children:[B.jsxs("div",{className:Ne("TradeStepLayoutHeader"),children:[B.jsx(T3,{}),s&&B.jsx(Do,{className:Ne("TradeStepLayoutTitle"),children:s})]}),t&&B.jsx("div",{className:Ne("TradeStepLayoutBody"),children:t}),B.jsx(v3,{link:r,text:n}),a]})}const v3=({link:e,text:t})=>{const{swapStatus:r}=Xr();return!e&&!t?null:B.jsxs("div",{className:Ne("TradeStepLayoutFooter"),children:[B.jsx(S3,{}),e?B.jsx(E3,{link:e,text:t}):r===ht.FAILED?void 0:B.jsx(Do,{children:t})]})},E3=({link:e,text:t})=>B.jsx("a",{target:"_blank",className:Ne("TradeStepLayoutFooterLink"),href:e,children:t});function k3(){const{components:e}=Xr();return e.SuccessIcon?e.SuccessIcon:B.jsxs("svg",{fill:"none",viewBox:"0 0 16 16",className:Ne("TradeStepLayoutSuccessIcon"),children:[B.jsx("circle",{cx:"8",cy:"8",r:"7",strokeWidth:"1.5",stroke:"#00C853"}),B.jsx("path",{strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",stroke:"#00C853",d:"M5 8l2 2 4-4"})]})}function C3(){const{components:e}=Xr();return e.FailedIcon?e.FailedIcon:B.jsxs("svg",{className:Ne("TradeStepLayoutErrorIcon"),viewBox:"0 0 16 16",fill:"none",children:[B.jsx("circle",{cx:"8",cy:"8",r:"7",strokeWidth:"1.5",stroke:"#FF3D00"}),B.jsx("path",{strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",stroke:"#FF3D00",d:"M8 4v5M8 11h.01"})]})}const T3=()=>{const{swapStatus:e}=Xr();return e===ht.SUCCESS?B.jsx(k3,{}):e===ht.FAILED?B.jsx(C3,{}):B.jsx(A3,{})},A3=()=>{const{components:e}=Xr();return e.Loader?e.Loader:B.jsx(w3,{size:60,borderWidth:5,className:Ne("TradeStepLayoutSpinner")})},S3=()=>{const{totalSteps:e,currentStepIndex:t=0,swapStatus:r}=Xr();return r!==ht.LOADING||e===1?null:B.jsx("div",{className:Ne("StepIndicator"),children:B.jsx("div",{style:{width:`${100/(e||0)}%`,left:`${t*100/(e||0)}%`},className:Ne("StepIndicatorLine")})})},P3=({error:e,footerLink:t,footerText:r})=>B.jsx(Mc,{footerLink:t,footerText:r,body:e||B.jsx("p",{className:Ne("FailedContentMsg"),children:"Something went wrong"}),className:Ne("FailedContent")});function I3(){return B.jsx("svg",{fill:"currentColor",viewBox:"0 0 16 16",className:Ne("TradepPreviewIcon"),children:B.jsx("path",{fillRule:"evenodd",d:"M4 8a.5.5 0 01.5-.5h5.793L8.146 5.354a.5.5 0 11.708-.708l3 3a.5.5 0 010 .708l-3 3a.5.5 0 01-.708-.708L10.293 8.5H4.5A.5.5 0 014 8z"})})}const o1=({inTokenOnly:e})=>{const{inToken:t,outToken:r,inAmount:n,outAmount:s,components:a}=Xr();return B.jsxs("div",{className:Ne("TradePreview"),children:[B.jsx(i1,{token:t,amount:n,Logo:a==null?void 0:a.SrcTokenLogo}),!e&&B.jsxs(B.Fragment,{children:[B.jsx(I3,{}),B.jsx(i1,{token:r,amount:s,Logo:a==null?void 0:a.DstTokenLogo})]})]})},i1=({token:e,amount:t,Logo:r})=>B.jsxs("div",{className:Ne("TradePreviewToken"),children:[r||B.jsx("img",{src:e==null?void 0:e.logoUrl,className:Ne("TradepPreviewLogo"),alt:`${e==null?void 0:e.symbol} logo`}),B.jsxs(Do,{children:[t," ",e==null?void 0:e.symbol]})]});function B3({title:e,footerLink:t,footerText:r,hideTokens:n}){return B.jsx(Mc,{title:e,className:Ne("Success"),body:!n&&B.jsx(o1,{}),footerLink:t,footerText:r})}const c1=({$gap:e=10,$alignItems:t="flex-start",children:r,className:n="",customStyles:s={}})=>{const a={gap:`${e}px`,alignItems:t,width:"100%",...s};return B.jsx("div",{className:`${Ne("FlexColumn")} ${n}`,style:a,children:r})};function l1({styles:e={},className:t=""}){return B.jsx("div",{style:e,className:`${Ne("SkeletonLoader")} ${t}`})}const F3=()=>B.jsxs("div",{className:`${Ne("MainContentLoader")}`,children:[B.jsx(l1,{className:`${Ne("MainContentCircleLoader")}`}),B.jsx(l1,{className:`${Ne("MainContentRectengularLoader")}`})]}),U3=({fromTitle:e,toTitle:t,inUsd:r,outUsd:n})=>{const{swapStatus:s,outAmount:a,inAmount:o,inToken:i,outToken:c,components:l,totalSteps:u}=Xr(),d=B.jsx(d1,{fromTitle:e,inUsd:r,inToken:i,toTitle:t,outUsd:n,outToken:c,inAmount:o,outAmount:a,SrcTokenLogo:l.SrcTokenLogo,DstTokenLogo:l.DstTokenLogo});return s?u?B.jsx(O3,{}):B.jsxs(c1,{children:[d,B.jsx(F3,{})]}):B.jsx(c1,{children:d})},u1=({amount:e,token:t,usd:r,title:n,Logo:s})=>B.jsxs("div",{className:`${Ne("MainToken")}`,children:[B.jsxs("div",{className:`${Ne("MainTokenLeft")}`,children:[B.jsx(Do,{className:`${Ne("MainTokenTitle")}`,children:n}),B.jsx(Do,{className:` ${Ne("MainTokenAmount")}`,children:`${e&&Number(e)>0?e:""} ${(t==null?void 0:t.symbol)||""}`}),r&&B.jsx("div",{className:` ${Ne("MainTokenUsd")}`,children:r})]}),s||B.jsx("div",{className:` ${Ne("MainTokenLogo")}`,children:t!=null&&t.logoUrl?B.jsx("img",{src:t==null?void 0:t.logoUrl,alt:"Token logo"}):null})]});function O3(){const{currentStep:e}=Xr();return e?B.jsx(Mc,{footerLink:e.footerLink,footerText:e.footerText,title:e.title,body:e.hideTokens?void 0:B.jsx(o1,{inTokenOnly:e==null?void 0:e.inTokenOnly})}):null}const d1=({fromTitle:e,inUsd:t,inToken:r,toTitle:n,outUsd:s,outToken:a,inAmount:o,outAmount:i,SrcTokenLogo:c,DstTokenLogo:l})=>B.jsxs("div",{className:`${Ne("Main")}`,children:[B.jsx(u1,{title:e||"Swap from",usd:t,token:r,amount:o,Logo:c}),B.jsx(u1,{title:n||"Swap to",usd:s,token:a,amount:i,Logo:l})]}),Xn=e=>B.jsx(x3,{...e,children:B.jsx(D3,{})}),D3=()=>{const{swapStatus:e,components:t,className:r}=Xr();return B.jsx("div",{className:`${Ne("SwapFlow")} ${r}`,children:e===ht.SUCCESS?t==null?void 0:t.Success:e===ht.FAILED?t==null?void 0:t.Failed:t==null?void 0:t.Main})};Xn.Success=B3,Xn.Failed=P3,Xn.Main=U3,Xn.StepLayout=Mc;var Ds=(e=>(e.WRAP="wrap",e.APPROVE="approve",e.CREATE="create",e))(Ds||{});const _3="1.2.3";let Zt=class Oh extends Error{constructor(t,r={}){var o;const n=r.cause instanceof Oh?r.cause.details:(o=r.cause)!=null&&o.message?r.cause.message:r.details,s=r.cause instanceof Oh&&r.cause.docsPath||r.docsPath,a=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: https://abitype.dev${s}`]:[],...n?[`Details: ${n}`]:[],`Version: abitype@${_3}`].join(`
|
|
65
65
|
`);super(a),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=s,this.metaMessages=r.metaMessages,this.shortMessage=t}};function gn(e,t){const r=e.exec(t);return r==null?void 0:r.groups}const p1=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,f1=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,h1=/^\(.+?\).*?$/,m1=/^tuple(?<array>(\[(\d*)\])*)$/;function Sd(e){let t=e.type;if(m1.test(e.type)&&"components"in e){t="(";const r=e.components.length;for(let s=0;s<r;s++){const a=e.components[s];t+=Sd(a),s<r-1&&(t+=", ")}const n=gn(m1,e.type);return t+=`)${(n==null?void 0:n.array)||""}`,Sd({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Sa(e){let t="";const r=e.length;for(let n=0;n<r;n++){const s=e[n];t+=Sd(s),n!==r-1&&(t+=", ")}return t}function Nc(e){var t;return e.type==="function"?`function ${e.name}(${Sa(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${Sa(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Sa(e.inputs)})`:e.type==="error"?`error ${e.name}(${Sa(e.inputs)})`:e.type==="constructor"?`constructor(${Sa(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const b1=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function M3(e){return b1.test(e)}function N3(e){return gn(b1,e)}const y1=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function L3(e){return y1.test(e)}function z3(e){return gn(y1,e)}const g1=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function R3(e){return g1.test(e)}function H3(e){return gn(g1,e)}const x1=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Lc(e){return x1.test(e)}function $3(e){return gn(x1,e)}const w1=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function G3(e){return w1.test(e)}function j3(e){return gn(w1,e)}const v1=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function V3(e){return v1.test(e)}function W3(e){return gn(v1,e)}const q3=/^receive\(\) external payable$/;function K3(e){return q3.test(e)}const E1=new Set(["memory","indexed","storage","calldata"]),Y3=new Set(["indexed"]),Pd=new Set(["calldata","memory","storage"]);class Z3 extends Zt{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class X3 extends Zt{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class Q3 extends Zt{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class J3 extends Zt{constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class e8 extends Zt{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class t8 extends Zt{constructor({param:t,name:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${r}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class r8 extends Zt{constructor({param:t,type:r,modifier:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${n}" not allowed${r?` in "${r}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class n8 extends Zt{constructor({param:t,type:r,modifier:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${n}" not allowed${r?` in "${r}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${n}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class s8 extends Zt{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class Pa extends Zt{constructor({signature:t,type:r}){super(`Invalid ${r} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class a8 extends Zt{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class o8 extends Zt{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class i8 extends Zt{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class c8 extends Zt{constructor({current:t,depth:r}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${r>0?"opening":"closing"} parentheses.`],details:`Depth "${r}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function l8(e,t,r){let n="";if(r)for(const s of Object.entries(r)){if(!s)continue;let a="";for(const o of s[1])a+=`[${o.type}${o.name?`:${o.name}`:""}]`;n+=`(${s[0]}{${a}})`}return t?`${t}:${e}${n}`:`${e}${n}`}const Id=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function Bd(e,t={}){if(R3(e))return u8(e,t);if(L3(e))return d8(e,t);if(M3(e))return p8(e,t);if(G3(e))return f8(e,t);if(V3(e))return h8(e);if(K3(e))return{type:"receive",stateMutability:"payable"};throw new a8({signature:e})}function u8(e,t={}){const r=H3(e);if(!r)throw new Pa({signature:e,type:"function"});const n=or(r.parameters),s=[],a=n.length;for(let i=0;i<a;i++)s.push(xn(n[i],{modifiers:Pd,structs:t,type:"function"}));const o=[];if(r.returns){const i=or(r.returns),c=i.length;for(let l=0;l<c;l++)o.push(xn(i[l],{modifiers:Pd,structs:t,type:"function"}))}return{name:r.name,type:"function",stateMutability:r.stateMutability??"nonpayable",inputs:s,outputs:o}}function d8(e,t={}){const r=z3(e);if(!r)throw new Pa({signature:e,type:"event"});const n=or(r.parameters),s=[],a=n.length;for(let o=0;o<a;o++)s.push(xn(n[o],{modifiers:Y3,structs:t,type:"event"}));return{name:r.name,type:"event",inputs:s}}function p8(e,t={}){const r=N3(e);if(!r)throw new Pa({signature:e,type:"error"});const n=or(r.parameters),s=[],a=n.length;for(let o=0;o<a;o++)s.push(xn(n[o],{structs:t,type:"error"}));return{name:r.name,type:"error",inputs:s}}function f8(e,t={}){const r=j3(e);if(!r)throw new Pa({signature:e,type:"constructor"});const n=or(r.parameters),s=[],a=n.length;for(let o=0;o<a;o++)s.push(xn(n[o],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:r.stateMutability??"nonpayable",inputs:s}}function h8(e){const t=W3(e);if(!t)throw new Pa({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const m8=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,b8=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,y8=/^u?int$/;function xn(e,t){var d,f;const r=l8(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(Id.has(r))return Id.get(r);const n=h1.test(e),s=gn(n?b8:m8,e);if(!s)throw new e8({param:e});if(s.name&&x8(s.name))throw new t8({param:e,name:s.name});const a=s.name?{name:s.name}:{},o=s.modifier==="indexed"?{indexed:!0}:{},i=(t==null?void 0:t.structs)??{};let c,l={};if(n){c="tuple";const h=or(s.type),y=[],g=h.length;for(let E=0;E<g;E++)y.push(xn(h[E],{structs:i}));l={components:y}}else if(s.type in i)c="tuple",l={components:i[s.type]};else if(y8.test(s.type))c=`${s.type}256`;else if(s.type==="address payable")c="address";else if(c=s.type,(t==null?void 0:t.type)!=="struct"&&!k1(c))throw new Q3({type:c});if(s.modifier){if(!((f=(d=t==null?void 0:t.modifiers)==null?void 0:d.has)!=null&&f.call(d,s.modifier)))throw new r8({param:e,type:t==null?void 0:t.type,modifier:s.modifier});if(Pd.has(s.modifier)&&!w8(c,!!s.array))throw new n8({param:e,type:t==null?void 0:t.type,modifier:s.modifier})}const u={type:`${c}${s.array??""}`,...a,...o,...l};return Id.set(r,u),u}function or(e,t=[],r="",n=0){const s=e.trim().length;for(let a=0;a<s;a++){const o=e[a],i=e.slice(a+1);switch(o){case",":return n===0?or(i,[...t,r.trim()]):or(i,t,`${r}${o}`,n);case"(":return or(i,t,`${r}${o}`,n+1);case")":return or(i,t,`${r}${o}`,n-1);default:return or(i,t,`${r}${o}`,n)}}if(r==="")return t;if(n!==0)throw new c8({current:r,depth:n});return t.push(r.trim()),t}function k1(e){return e==="address"||e==="bool"||e==="function"||e==="string"||p1.test(e)||f1.test(e)}const g8=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function x8(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||p1.test(e)||f1.test(e)||g8.test(e)}function w8(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Fd(e){const t={},r=e.length;for(let o=0;o<r;o++){const i=e[o];if(!Lc(i))continue;const c=$3(i);if(!c)throw new Pa({signature:i,type:"struct"});const l=c.properties.split(";"),u=[],d=l.length;for(let f=0;f<d;f++){const y=l[f].trim();if(!y)continue;const g=xn(y,{type:"struct"});u.push(g)}if(!u.length)throw new o8({signature:i});t[c.name]=u}const n={},s=Object.entries(t),a=s.length;for(let o=0;o<a;o++){const[i,c]=s[o];n[i]=C1(c,t)}return n}const v8=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function C1(e=[],t={},r=new Set){const n=[],s=e.length;for(let a=0;a<s;a++){const o=e[a];if(h1.test(o.type))n.push(o);else{const c=gn(v8,o.type);if(!(c!=null&&c.type))throw new s8({abiParameter:o});const{array:l,type:u}=c;if(u in t){if(r.has(u))throw new i8({type:u});n.push({...o,type:`tuple${l??""}`,components:C1(t[u],t,new Set([...r,u]))})}else if(k1(u))n.push(o);else throw new X3({type:u})}}return n}function T1(e){const t=Fd(e),r=[],n=e.length;for(let s=0;s<n;s++){const a=e[s];Lc(a)||r.push(Bd(a,t))}return r}function A1(e){let t;if(typeof e=="string")t=Bd(e);else{const r=Fd(e),n=e.length;for(let s=0;s<n;s++){const a=e[s];if(!Lc(a)){t=Bd(a,r);break}}}if(!t)throw new Z3({signature:e});return t}function S1(e){const t=[];if(typeof e=="string"){const r=or(e),n=r.length;for(let s=0;s<n;s++)t.push(xn(r[s],{modifiers:E1}))}else{const r=Fd(e),n=e.length;for(let s=0;s<n;s++){const a=e[s];if(Lc(a))continue;const o=or(a),i=o.length;for(let c=0;c<i;c++)t.push(xn(o[c],{modifiers:E1,structs:r}))}}if(t.length===0)throw new J3({params:e});return t}function ne(e,t,r){const n=e[t.name];if(typeof n=="function")return n;const s=e[r];return typeof s=="function"?s:a=>t(e,a)}function Or(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new _8(e.type);return`${e.name}(${zc(e.inputs,{includeName:t})})`}function zc(e,{includeName:t=!1}={}){return e?e.map(r=>E8(r,{includeName:t})).join(t?", ":","):""}function E8(e,{includeName:t}){return e.type.startsWith("tuple")?`(${zc(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function Dr(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function ut(e){return Dr(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const P1="2.43.3";let _o={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${P1}`},$=class Dh extends Error{constructor(t,r={}){var i;const n=(()=>{var c;return r.cause instanceof Dh?r.cause.details:(c=r.cause)!=null&&c.message?r.cause.message:r.details})(),s=r.cause instanceof Dh&&r.cause.docsPath||r.docsPath,a=(i=_o.getDocsUrl)==null?void 0:i.call(_o,{...r,docsPath:s}),o=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...a?[`Docs: ${a}`]:[],...n?[`Details: ${n}`]:[],..._o.version?[`Version: ${_o.version}`]:[]].join(`
|
|
66
66
|
`);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=s,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=t,this.version=P1}walk(t){return I1(this,t)}};function I1(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?I1(e.cause,t):t?null:e}class k8 extends ${constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
|
|
67
67
|
`),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class B1 extends ${constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
|
|
@@ -123,4 +123,4 @@ ee.version="2.30.1",cz(et),ee.fn=K,ee.min=ZR,ee.max=XR,ee.now=QR,ee.utc=nn,ee.un
|
|
|
123
123
|
Prefix can't start with '-' when allowNegative is true.
|
|
124
124
|
prefix: `+s+`
|
|
125
125
|
allowNegative: `+a+`
|
|
126
|
-
`),a=!1),Object.assign(Object.assign({},e),{allowNegative:a})}function CG(e){e=kG(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,s=e.onKeyDown;s===void 0&&(s=$0);var a=e.onBlur;a===void 0&&(a=$0);var o=e.thousandSeparator,i=e.decimalScale,c=e.fixedDecimalScale,l=e.prefix;l===void 0&&(l="");var u=e.defaultValue,d=e.value,f=e.valueIsNumericString,h=e.onValueChange,y=cG(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),g=Fu(e),E=g.decimalSeparator,v=g.allowedDecimalSeparators,w=function(P){return K2(P,e)},A=function(P,O){return vG(P,O,e)},C=ho(d)?u:d,D=f??wG(C,l,t);ho(d)?ho(u)||(D=D||typeof u=="number"):D=D||typeof d=="number";var z=function(P){return $2(P)?P:(typeof P=="number"&&(P=W2(P)),D&&typeof i=="number"?q2(P,i,!!c):P)},T=yG(z(d),z(u),!!D,w,A,h),m=T[0],b=m.numAsString,x=m.formattedValue,S=T[1],I=function(P){var O=P.target,U=P.key,L=O.selectionStart,H=O.selectionEnd,G=O.value;if(G===void 0&&(G=""),(U==="Backspace"||U==="Delete")&&H<l.length){P.preventDefault();return}if(L!==H){s(P);return}U==="Backspace"&&G[0]==="-"&&L===l.length+1&&r&&ac(O,1),i&&c&&(U==="Backspace"&&G[L-1]===E?(ac(O,L-1),P.preventDefault()):U==="Delete"&&G[L]===E&&P.preventDefault()),v!=null&&v.includes(U)&&G[L]===E&&ac(O,L+1);var Q=o===!0?",":o;U==="Backspace"&&G[L-1]===Q&&ac(O,L-1),U==="Delete"&&G[L]===Q&&ac(O,L+1),s(P)},F=function(P){var O=b;if(O.match(/\d/g)||(O=""),n||(O=hG(O)),c&&i&&(O=q2(O,i,c)),O!==b){var U=K2(O,e);S({formattedValue:U,value:O,floatValue:parseFloat(O)},{event:P,source:H0.event})}a(P)},_=function(P){return P===E?!0:H2(P)},k=function(P){var O=P.currentValue,U=P.lastValue,L=P.formattedValue,H=P.currentValueIndex,G=P.formattedValueIndex,Q=O[H],pe=L[G],me=mG(U,O),ie=me.to,de=function(Be){return A(Be).indexOf(".")+l.length};return d===0&&c&&i&&O[ie.start]===E&&de(O)<H&&de(L)>G?!1:H>=ie.start&&H<ie.end&&v&&v.includes(Q)&&pe===E?!0:Q===pe};return Object.assign(Object.assign({},y),{value:x,valueIsNumericString:!1,isValidInputCharacter:_,isCharacterSame:k,onValueChange:S,format:w,removeFormatting:A,getCaretBoundary:function(P){return EG(P,e)},onKeyDown:I,onBlur:F})}const Y2=(e,t)=>M.useMemo(()=>Bl(t,e),[e,t]),Rn=(e,t)=>M.useMemo(()=>Ii(t,e),[e,t]),oc=()=>{const{chainId:e}=oe();return M.useMemo(()=>Bs(e),[e])},j0=e=>{const t=oc();return M.useMemo(()=>{if(!(!e||!t))return Bi(e,t.id)},[e,t])},aa=(e,t)=>M.useMemo(()=>!e||!t||j(e||"0").isZero()||j(t||"0").isZero()?"":j(e||"0").times(t).toFixed(),[e,t]),TG=()=>{const{srcToken:e,dstToken:t,chainId:r}=oe();return M.useMemo(()=>Nf(e,t,r),[e,t,r])},AG=()=>{const{srcToken:e,dstToken:t,chainId:r}=oe();return M.useMemo(()=>Lf(e,t,r),[e,t,r])},SG=()=>{const e=TG(),t=AG();return e||t},V0=e=>{const{overrides:t}=oe();return M.useMemo(()=>t!=null&&t.dateFormat?t.dateFormat(e||0):ee(e).format("DD/MM/YYYY HH:mm"),[e,t==null?void 0:t.dateFormat])};function PG(){const{callbacks:e}=oe();return M.useCallback(async t=>{var r;try{await navigator.clipboard.writeText(t),(r=e==null?void 0:e.onCopy)==null||r.call(e)}catch(n){console.error("Copy failed:",n)}},[e==null?void 0:e.onCopy])}const Z2=(e,t)=>M.useMemo(()=>t6(e==null?void 0:e.toString(),t),[e,t]),Ze=({value:e,decimalScale:t=3,prefix:r,suffix:n})=>{var c;const s=Z2(e,t),{overrides:a}=oe(),o=a==null?void 0:a.numberFormat,i=CG({allowLeadingZeros:!0,thousandSeparator:",",displayType:"text",value:s||"",decimalScale:18,prefix:r,suffix:n});return o?o(e||""):(c=i.value)==null?void 0:c.toString()},IG={expirationTooltip:"This is the date and time marking the end of the period which you have selected for your order to be executed.",tradeSizeTooltip:"The number of input tokens that will be removed from your balance and swapped for the output token in each individual trade.",totalTradesTooltip:"The total number of individual trades that will be scheduled as part of your order. Note that in limit orders, not all trades that are scheduled will be executed.",minDstAmountTooltip:" This is the minimum number of tokens that may be received. NOTE: This minimum only refers to executed trades. Some trades may not be executed if the limit price is higher than the available market prices and your order may only be partially filled.",limitPriceTooltip:"Trades will only execute if the available market price is better than the limit price, potentially resulting in partial fills or orders remaining unfilled upon expiration.",maxDurationTooltip:"This is the time period during which the order will be active. Please note that orders may be completed earlier than this time, partially filled, or remain unfilled based on the specified parameters.",tradeIntervalTooltip:"The estimated time that will elapse between each trade in your order. Note that as this time includes an allowance of two minutes for bidder auction and block settlement, which cannot be predicted exactly, actual time may vary.",triggerPriceTooltip:"The price at which the order will be executed. If the market price is higher than the trigger price, the order will be executed at the market price.",placeOrder:"Place order",enterAmount:"Enter an amount",emptyLimitPrice:"Limit price is required",insufficientFunds:"Insufficient Balance",tradeIntervalLabel:"Trade interval",expirationLabel:"Expiration",limitPrice:"Limit Price",finalExcecutionPrice:"Final execution price",marketPrice:"Market price",from:"From",to:"To (estimated)",Open:"Open",Completed:"Completed",Expired:"Expired",Canceled:"Canceled",cancelOrder:"Cancel Order",minReceivedPerTrade:"Min. received per trade",triggerPricePerChunk:"Trigger Price per trade",maxChunksError:"Max. trades amount is {maxChunks}",minChunksError:"Min. trades amount is {minChunks}",minTradeSizeError:"Min. trade size is ${minTradeSize}",allOrders:"All",minFillDelayError:"Min. trade interval is {fillDelay}",maxFillDelayError:"Max. trade interval is {fillDelay}",recipient:"Recipient",marketOrderWarning:"Each individual trade in this order will be filled at the current market price at the time of execution.",limitPriceMessage:"Limit orders may not execute when the token's price is equal or close to the limit price, due to gas and standard swap fees.",limit:"Limit",maxDurationError:"Max. expiry is {duration}",minDurationError:"Min. expiry is {duration}",expiry:"Expiry",individualTradeSize:"Individual trade size",numberOfTrades:"No. of trades",averageExecutionPrice:"Avg. execution price",twapMarket:"TWAP-market",twapLimit:"TWAP-limit",stopLoss:"Stop-loss",stopLossMarket:"Stop-loss market",stopLossLimit:"Stop-loss limit",takeProfit:"Take-profit",minReceived:"Min. received",noOrders:"No {status} Orders",noLiquidity:"No liquidity for this pair",excecutionSummary:"Execution summary",orderInfo:"Order info",wrapAction:"Wrap {symbol}",approveAction:"Approve {symbol}",createOrderAction:"Create {name} order",amountReceived:"Amount received",createdAt:"Created at",amountOut:"Amount out",status:"Status",progress:"Progress",minutes:"minutes",days:"days",tradeIntervalTitle:"Every",tradesAmountTitle:"Over",stopLossTooltip:"The trigger price at which your stop-loss order will be activated.",takeProfitTooltip:"The trigger price at which your take-profit order will be activated.",stopLossLabel:"Trigger Price",StopLossTriggerPriceError:"Trigger price must be less than market price",TakeProfitTriggerPriceError:"Trigger price must be greater than market price",triggerLimitPriceError:"Limit price must be less than trigger price",triggerPrice:"Trigger Price",tradePrice:"Trade Price",triggerMarketPriceDisclaimer:" In extreme market movements, slippage may occur and the executed price of the market order may be worse than the specified trigger price.",stopLossLimitPriceTooltip:"The stop loss order will execute at the specified limit price or better, once the stop price is triggered.",stopLossDurationTooltip:"This is the time period during which the order will be active. Please note that orders may be completed earlier than this time, or remain unfilled based on the specified parameters.",emptyTriggerPrice:"Trigger price is required",id:"ID",fees:"Fees {value}",version:"Version",maxOrderSizeError:"Max. trade size is {maxOrderSize} USD",viewOnExplorer:"View on explorer",proceedInWallet:"Proceed in wallet",wrapMsg:"Note: {symbol} was wrapped to {wSymbol}",createOrderActionSuccess:"{name} order placed"};function BG(e){let t=e;const r=/\{[^{}]*\}/g;for(;r.test(t);)t=t.replace(r,"");return t}const Me=()=>{const e=oe();return M.useCallback((r,n)=>{var o,i;const s=(o=e.getTranslation)==null?void 0:o.call(e,r,n);if(s&&s!==r)return s;const a=((i=e.translations)==null?void 0:i[r])||IG[r];return BG(a.replace(/{(\w+)}/g,(c,l)=>(n==null?void 0:n[l])||c))},[e.getTranslation,e.translations])},Uu=({value:e})=>{const t=Ze({value:e,decimalScale:2});return t?B.jsx("small",{className:"twap-order-details__detail-row-value-usd",children:` ($${t})`}):null},FG=({deadline:e,label:t,tooltip:r})=>{const n=V0(e);return B.jsx(Ar,{title:t,tooltip:r,children:n})},UG=({price:e,dstToken:t,label:r,tooltip:n,usd:s,srcToken:a})=>{const o=Ze({value:e});return j(e||0).isZero()?null:B.jsx(Ar,{title:r,tooltip:n,children:B.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:["1 ",a==null?void 0:a.symbol," = ",`${o||"-"} ${t==null?void 0:t.symbol}`,B.jsx(Uu,{value:s})]})})},OG=({tradeSize:e,srcToken:t,trades:r,label:n,tooltip:s})=>r===1?null:B.jsx(Ar,{title:n,tooltip:s,children:`${e||"-"} ${(t==null?void 0:t.symbol)||""}`}),DG=({dstToken:e,dstMinAmountOut:t,label:r,tooltip:n,usd:s})=>{const a=Ze({value:t});return j(t||0).isZero()?null:B.jsxs(Ar,{title:r,tooltip:n,children:[`${t?a:"-"} ${e==null?void 0:e.symbol}`,B.jsx(Uu,{value:s})]})},_G=({trades:e,label:t,tooltip:r})=>e===1?null:B.jsx(Ar,{title:t,tooltip:r,children:e}),MG=()=>{var s;const e=Me(),{account:t}=oe(),r=(s=oc())==null?void 0:s.explorer,n=Df(t);return B.jsx(Ar,{title:e("recipient")||"",children:r?B.jsx("a",{href:`${r}/address/${t}`,target:"_blank",children:n}):n})},NG=({fillDelayMillis:e,chunks:t=0,label:r,tooltip:n})=>{const s=M.useMemo(()=>e6(e),[e]);return t===1?null:B.jsx(Ar,{title:r,tooltip:n,children:s})},Ar=({title:e,tooltip:t,children:r,className:n="",onClick:s,style:a})=>{const{components:o}=oe(),i=o.Tooltip;return B.jsxs("div",{className:`${n} twap-order-details__detail-row`,onClick:s,style:a,children:[B.jsxs("div",{className:"twap-order-details__detail-row-label",children:[B.jsx("p",{className:"twap-order-details__detail-row-label-value",children:e}),t&&i&&B.jsx(i,{tooltipText:t})]}),B.jsx("div",{className:"twap-order-details__detail-row-value",children:r})]})},LG=({id:e})=>{const{components:t}=oe(),r=t==null?void 0:t.Tooltip,n=PG();return e.startsWith("0x")?B.jsx(Ar,{title:"ID",onClick:()=>n(e),style:{cursor:"pointer"},children:r&&B.jsx(r,{tooltipText:e,children:B.jsxs("div",{className:"twap-order-details__detail-row-value-id",children:[B.jsx("p",{children:Df(e)}),B.jsx(iz.AiOutlineCopy,{})]})})}):B.jsx(Ar,{title:"ID",children:e})},zG=({version:e})=>B.jsx(Ar,{title:"Version",children:e});function Ee({children:e,className:t=""}){return B.jsx("div",{className:`${t} twap-order-details`,children:e})}const RG=({children:e})=>e,HG=({fees:e,label:t,usd:r,dstTokenSymbol:n})=>{const s=Ze({value:e});return B.jsxs(Ar,{title:t,children:[`${e?s:"-"} ${n}`,B.jsx(Uu,{value:r})]})};Ee.Deadline=FG,Ee.Fees=HG,Ee.TradeSize=OG,Ee.MinDestAmount=DG,Ee.TradesAmount=_G,Ee.Recipient=MG,Ee.TradeInterval=NG,Ee.DetailRow=Ar,Ee.Price=UG,Ee.OrderID=LG,Ee.Container=RG,Ee.OrderVersion=zG,Ee.USD=Uu;const W0=()=>{const{publicClient:e}=oe();return Zr({mutationFn:async t=>{if(!e)throw new Error("publicClient is not defined");const r=10;let n=0,s=1e3;for(;n<r;)try{return await e.waitForTransactionReceipt({hash:t,confirmations:2,retryDelay:s})}catch(a){if(n++,n>=r)throw new Error(`Failed after ${r} attempts: ${a}`);await new Promise(o=>setTimeout(o,s)),s*=2}}}).mutateAsync},X2=e=>{const t=Me(),r=Ze({value:e.srcAmount}),n=Ze({value:e.limitPrice}),s=Ze({value:e.limitPriceUsd}),a=Ze({value:e.srcAmountPerTrade}),o=Ze({value:e.srcAmountPerTradeUsd,decimalScale:2}),i=Ze({value:e.minDestAmountPerTrade}),c=Ze({value:e.minDestAmountPerTradeUsd,decimalScale:2}),l=Ze({value:e.triggerPrice}),u=Ze({value:e.triggerPriceUsd,decimalScale:2}),d=Ze({value:e.srcUsd,decimalScale:2}),f=Ze({value:e.dstUsd,decimalScale:2}),h=Ze({value:e.dstAmount});return M.useMemo(()=>({srcToken:e.srcToken,dstToken:e.dstToken,srcUsd:d||"",dstUsd:f||"",limitPrice:{label:t("limitPrice"),tooltip:t("limitPriceTooltip"),value:n||"",usd:s||""},deadline:{tooltip:t("expirationTooltip"),label:t("expirationLabel"),value:e.deadline||0},srcAmount:{label:t("amountOut"),value:r||"",usd:d||""},dstAmount:{value:h||"",usd:f||""},sizePerTrade:{tooltip:t("tradeSizeTooltip"),label:t("individualTradeSize"),value:a||"",usd:o},totalTrades:{tooltip:t("totalTradesTooltip"),label:t("numberOfTrades"),value:e.totalTrades||0},minDestAmountPerTrade:{tooltip:t("minDstAmountTooltip"),label:t(e.totalTrades&&e.totalTrades>1?"minReceivedPerTrade":"minReceived"),value:i||"",usd:c},tradeInterval:{tooltip:t("tradeIntervalTooltip"),label:t("tradeIntervalLabel"),value:e.tradeInterval||0},triggerPrice:{tooltip:t("triggerPriceTooltip"),label:t("triggerPrice"),value:l||"",usd:u},recipient:{label:t("recipient"),value:e.account||""}}),[d,f,n,r,a,o,i,l,u,n,s,h,f,c])},Q2=e=>{const{orders:t}=Ou(),{useToken:r,config:n}=oe(),s=Me(),a=M.useMemo(()=>t==null?void 0:t.all.find(C=>C.id===e),[t,e])||{},o=tx(a),i=r==null?void 0:r(a==null?void 0:a.srcTokenAddress),c=r==null?void 0:r(a==null?void 0:a.dstTokenAddress),l=Rn(i==null?void 0:i.decimals,a==null?void 0:a.srcAmount),u=jG(i,c,a),d=VG(i,c,a),f=WG(i,c,a),h=Rn(i==null?void 0:i.decimals,a==null?void 0:a.srcAmountFilled),y=Rn(c==null?void 0:c.decimals,a==null?void 0:a.dstAmountFilled),g=a==null?void 0:a.progress,E=Rn(i==null?void 0:i.decimals,a==null?void 0:a.srcAmountPerTrade),v=Rn(c==null?void 0:c.decimals,a==null?void 0:a.dstMinAmountPerTrade),w=M.useMemo(()=>a?a.version===2?a.fillDelay:n.twapConfig?td(a,n.twapConfig):0:0,[a,n]),A=X2({srcToken:i,dstToken:c,account:a==null?void 0:a.maker,limitPrice:u,deadline:a==null?void 0:a.deadline,tradeInterval:w,srcAmount:l,totalTrades:a==null?void 0:a.totalTradesAmount,srcAmountPerTrade:E,minDestAmountPerTrade:v,triggerPrice:d});return M.useMemo(()=>({original:a,title:o,...A,createdAt:{label:s("createdAt"),value:a==null?void 0:a.createdAt},id:{label:s("id"),value:a==null?void 0:a.id},amountInFilled:{label:s("amountOut"),value:h},amountOutFilled:{label:s("amountReceived"),value:y,token:c},progress:{label:s("progress"),value:g},excecutionPrice:{label:s((a==null?void 0:a.totalTradesAmount)===1?"finalExcecutionPrice":"averageExecutionPrice"),value:f},version:{label:s("version"),value:a==null?void 0:a.version}}),[a,s,f,h,y,g,o,i,c,A])},J2=e=>{const t=Me();return M.useMemo(()=>{switch(e){case ze.TWAP_MARKET:return t("twapMarket");case ze.TWAP_LIMIT:return t("twapLimit");case ze.STOP_LOSS_MARKET:return t("stopLossMarket");case ze.STOP_LOSS_LIMIT:return t("stopLossLimit");case ze.TAKE_PROFIT:return t("takeProfit");default:return t("twapMarket")}},[t,e])},$G=()=>{const{module:e}=oe(),t=te(r=>r.state.isMarketOrder);return M.useMemo(()=>e===ye.TWAP?t?ze.TWAP_MARKET:ze.TWAP_LIMIT:e===ye.LIMIT?t?ze.LIMIT:ze.TWAP_LIMIT:e===ye.STOP_LOSS?t?ze.STOP_LOSS_MARKET:ze.STOP_LOSS_LIMIT:e===ye.TAKE_PROFIT?ze.TAKE_PROFIT:ze.TWAP_MARKET,[e,t])},ex=()=>{const e=$G();return J2(e)},tx=e=>J2(e==null?void 0:e.type),rx=()=>{const{account:e,config:t,chainId:r}=oe();return M.useMemo(()=>["useTwapOrderHistoryManager",e,t==null?void 0:t.adapter,r],[e,t,r])},GG=()=>{const{callbacks:e,refetchBalances:t}=oe(),r=Td(),n=rx();return M.useCallback(s=>{var c;const a=r.getQueryData(n);let o=!1;const i=[];a&&a.forEach(l=>{var d;const u=s.find(f=>f.id===l.id);!(u!=null&&u.twapAddress)&&l.twapAddress&&u&&u.progress!==l.progress&&(o=!0,i.push(u),u.status===ct.Completed&&((d=e==null?void 0:e.onOrderFilled)==null||d.call(e,u)))}),o&&((c=e==null?void 0:e.onOrdersProgressUpdate)==null||c.call(e,i),t==null||t())},[r,n,e,t])},q0=()=>{const{account:e,config:t,chainId:r}=oe(),n=rx(),s=GG();return d3({refetchInterval:QL,refetchOnWindowFocus:!0,retry:!1,staleTime:1/0,queryKey:n,queryFn:async({signal:o})=>{if(!e||!r||!t)return[];const i=await Dm({signal:o,chainId:r,config:t,account:e});return s(i),i.map(c=>t!=null&&t.twapConfig?{...c,fillDelayMillis:td(c,t.twapConfig)}:c)}})},Ou=()=>{const{data:e,isLoading:t,error:r,refetch:n,isRefetching:s}=q0(),{mutateAsync:a}=K0();return M.useMemo(()=>({orders:{all:e??[],open:Du(e??[],ct.Open),completed:Du(e??[],ct.Completed),expired:Du(e??[],ct.Expired),canceled:Du(e??[],ct.Canceled)},isLoading:t,error:r,refetch:()=>n().then(o=>o.data),cancelOrder:a,isRefetching:s}),[e,t,r,n,a,s])},nx=()=>{const e=te(r=>r.state.orderHistoryStatusFilter),{orders:t}=Ou();return M.useMemo(()=>e?t.all.filter(r=>r.status.toLowerCase()===e.toLowerCase())||[]:t.all,[e,t])},Du=(e,t)=>e.filter(r=>r.status===t).sort((r,n)=>n.createdAt-r.createdAt),jG=(e,t,r)=>M.useMemo(()=>{if(!(!e||!t||!r||r!=null&&r.isMarketPrice))return Gh(r,e==null?void 0:e.decimals,t==null?void 0:t.decimals)},[r,e,t]),VG=(e,t,r)=>M.useMemo(()=>{if(!(!e||!t||!r))return jh(r,e.decimals,t.decimals)},[r,e,t]),WG=(e,t,r)=>M.useMemo(()=>{if(!(!e||!t||!r))return $h(r,e.decimals,t.decimals)},[r,e,t]),sx=()=>{const e=te(r=>r.updateState),t=te(r=>r.state.orderIdsToCancel);return M.useCallback(r=>{t!=null&&t.includes(r)?e({orderIdsToCancel:t==null?void 0:t.filter(n=>n!==r)}):e({orderIdsToCancel:[...t||[],r]})},[e,t])},qG=()=>{var T,m;const e=Me(),{orders:t,isLoading:r,refetch:n,isRefetching:s}=Ou(),{mutateAsync:a,isPending:o}=K0(),i=nx(),c=te(b=>b.updateState),l=te(b=>b.state.orderHistoryStatusFilter),u=te(b=>b.state.cancelOrdersMode),d=te(b=>b.state.orderIdsToCancel),f=M.useCallback(b=>c({cancelOrdersMode:b,orderIdsToCancel:[]}),[c]),h=M.useCallback(()=>c({selectedOrderID:void 0}),[c]),y=M.useCallback(b=>a({orders:b}),[a]),g=M.useCallback(b=>c({orderHistoryStatusFilter:b}),[]),E=M.useMemo(()=>{const b=Object.keys(ct).map(x=>({text:x,value:x}));return[{text:e("allOrders"),value:""},...b]},[e]),v=sx(),w=te(b=>b.state.selectedOrderID),A=Q2(w),C=M.useMemo(()=>t.all.filter(b=>d==null?void 0:d.includes(b.id)),[t,d]),D=M.useCallback(()=>c({orderIdsToCancel:t.open.map(b=>b.id)}),[c,t]),z=M.useCallback(b=>a({orders:[b]}).then(x=>(x==null?void 0:x[0])||""),[a]);return{refetch:n,onHideSelectedOrder:h,onCancelOrders:y,onCancelOrder:z,onSelectStatus:g,onToggleCancelOrdersMode:f,onSelectOrder:v,isRefetching:s,orders:t,ordersToDisplay:i,isLoading:r,selectedOrder:w?A:void 0,openOrdersCount:((T=t==null?void 0:t.open)==null?void 0:T.length)||0,isCancelOrdersLoading:o,selectedStatus:l||((m=E[0])==null?void 0:m.value)||"",statuses:E,cancelOrdersMode:u,ordersToCancel:C,onSelectAllOrdersToCancel:D}},KG=()=>{const{refetch:e}=q0();return Zr({mutationFn:async t=>{var r;for(;;){const n=(r=await e())==null?void 0:r.data;if(!n)throw new Error("orders not found");if(t.every(a=>{const o=n.find(i=>i.id===a);return(o==null?void 0:o.status)===ct.Canceled}))break;await new Promise(a=>setTimeout(a,1e3))}}})},K0=()=>{const{account:e,walletClient:t,publicClient:r,config:n,callbacks:s,chainId:a}=oe(),o=W0(),i=KG().mutateAsync,c=te(d=>d.updateState),l=async d=>{dt.onCancelOrderRequest(d.map(f=>f.id.toString()),1);try{return(await Promise.all(d.map(h=>t.writeContract({account:e,address:h.twapAddress,abi:Nh,functionName:"cancel",args:[h.id],chain:t.chain}))))[0]}catch(f){throw dt.onCancelOrderError(f),f}},u=async d=>{var f;try{dt.onCancelOrderRequest(d.map(g=>g.hash),2);const h=await t.writeContract({account:e,address:n.repermit,abi:Mh,functionName:"cancel",args:[d.map(g=>g.hash)],chain:t.chain}),y=await o(h);if(!y)throw new Error("failed to get transaction receipt");if(y.status==="reverted")throw new Error("failed to cancel order");return dt.onCancelOrderSuccess(h),(f=s==null?void 0:s.onCancelOrderSuccess)==null||f.call(s,{orders:d,txHash:h,explorerUrl:Bi(h,a)}),y.transactionHash}catch(h){throw dt.onCancelOrderError(h),h}};return Zr({mutationFn:async({orders:d})=>{var f,h;if(!e||!t||!r||!n)throw new Error("missing required parameters");try{(f=s==null?void 0:s.onCancelOrderRequest)==null||f.call(s,d),c({cancelOrderStatus:ht.LOADING,cancelOrderTxHash:void 0,cancelOrderError:void 0});const y=d.filter(w=>w.version===1),g=d.filter(w=>w.version===2),[E,v]=await Promise.all([y.length?l(y):Promise.resolve(""),g.length?u(g):Promise.resolve("")]);return await i(d.map(w=>w.id)),c({cancelOrderStatus:ht.SUCCESS,orderIdsToCancel:[]}),[...E||[],v]}catch(y){console.error("cancel order error",y),(h=s==null?void 0:s.onCancelOrderFailed)==null||h.call(s,y),_f(y)?c({cancelOrderStatus:void 0}):(c({cancelOrderStatus:ht.FAILED}),dt.onCancelOrderError(y))}}})},ax=M.createContext({}),zt=()=>M.useContext(ax),YG=()=>{const e=te(c=>c.state.selectedOrderID),t=Q2(e),r=Me(),[n,s]=M.useState("panel1"),{components:a}=oe(),o=a.TokenLogo;M.useEffect(()=>{s("panel1")},[t.id.value]);const i=c=>{s(n===c?!1:c)};return t?B.jsx(ax.Provider,{value:{order:t},children:B.jsxs("div",{className:"twap-orders__selected-order",children:[B.jsx(d1,{SrcTokenLogo:o&&B.jsx(o,{token:t.srcToken}),DstTokenLogo:o&&B.jsx(o,{token:t.dstToken}),fromTitle:r("from"),inToken:t.srcToken,toTitle:r("to"),outToken:t.dstToken}),B.jsx(Ee.Container,{children:B.jsxs("div",{className:"twap-orders__selected-order-bottom",children:[B.jsxs("div",{className:"twap-orders__selected-order-accordions",children:[B.jsx(ox,{title:r("excecutionSummary"),onClick:()=>i("panel1"),expanded:n==="panel1",children:B.jsx(sj,{})}),B.jsx(ox,{title:r("orderInfo"),expanded:n==="panel2",onClick:()=>i("panel2"),children:B.jsx(ZG,{})})]}),B.jsx(oj,{})]})})]})}):null},ox=({expanded:e,onClick:t,children:r,title:n})=>B.jsxs("div",{className:"twap-orders__selected-order-accordion",children:[B.jsxs("div",{onClick:t,className:"twap-orders__selected-order-accordion-trigger",children:[B.jsx("p",{children:n}),B.jsx(az.IoIosArrowDown,{style:{transform:e?"rotate(180deg)":"rotate(0deg)"}})]}),e&&B.jsx("div",{className:"twap-orders__selected-order-accordion-details",children:r})]}),ZG=()=>B.jsxs(Ee,{children:[B.jsx(nj,{}),B.jsx(ij,{}),B.jsx(ej,{}),B.jsx(cj,{}),B.jsx(XG,{}),B.jsx(QG,{}),B.jsx(JG,{}),B.jsx(tj,{}),B.jsx(rj,{}),B.jsx(fj,{}),B.jsx(Ee.Recipient,{})]}),XG=()=>{const{order:e}=zt();return B.jsx(Ee.TradeSize,{tradeSize:e.sizePerTrade.value,srcToken:e.srcToken,label:e.sizePerTrade.label,tooltip:e.sizePerTrade.tooltip,trades:e.totalTrades.value})},QG=()=>{const{order:e}=zt();return B.jsx(Ee.TradesAmount,{trades:e.totalTrades.value,label:e.totalTrades.label,tooltip:e.totalTrades.tooltip})},JG=()=>{const{order:e}=zt();return B.jsx(Ee.MinDestAmount,{dstToken:e.dstToken,dstMinAmountOut:e.minDestAmountPerTrade.value,label:e.minDestAmountPerTrade.label,tooltip:e.minDestAmountPerTrade.tooltip})},ej=()=>{const{order:e}=zt();return B.jsx(Ee.Deadline,{deadline:e.deadline.value,label:e.deadline.label,tooltip:e.deadline.tooltip})},tj=()=>{const{order:e}=zt();return B.jsx(Ee.TradeInterval,{fillDelayMillis:e.tradeInterval.value,chunks:e.totalTrades.value,label:e.tradeInterval.label,tooltip:e.tradeInterval.tooltip})},rj=()=>{const{order:e}=zt();return B.jsx(Ee.Price,{srcToken:e.srcToken,dstToken:e.dstToken,price:e.triggerPrice.value,label:e.triggerPrice.label,tooltip:e.triggerPrice.tooltip})},nj=()=>{const{order:e}=zt();return B.jsx(Ee.OrderID,{id:e.id.value||""})},sj=()=>B.jsxs(Ee,{children:[B.jsx(dj,{}),B.jsx(lj,{}),B.jsx(aj,{}),B.jsx(pj,{}),B.jsx(hj,{})]}),aj=()=>{var r;const{order:e}=zt(),t=Ze({value:e.amountOutFilled.value,decimalScale:3});return e.amountOutFilled.value?B.jsx(Ee.DetailRow,{title:e.amountOutFilled.label,children:B.jsxs("p",{children:[t||"-"," ",(r=e.dstToken)==null?void 0:r.symbol]})}):null},oj=()=>{const{order:e}=zt(),t=Me(),{mutateAsync:r,isPending:n}=K0(),{components:s}=oe(),a=s.Button,o=M.useCallback(async()=>r({orders:[e.original]}),[r,e]);return!e||e.original.status!==ct.Open||!a?null:B.jsx(a,{loading:n,onClick:o,disabled:n,className:"twap-cancel-order",text:t("cancelOrder"),children:t("cancelOrder")})},ij=()=>{const{order:e}=zt(),t=Me(),r=V0(e.createdAt.value);return B.jsx(Ee.DetailRow,{title:t("createdAt")||"",children:B.jsx("p",{children:r})})},cj=()=>{var n;const{order:e}=zt(),t=Me(),r=Ze({value:e.srcAmount.value,decimalScale:3});return B.jsx(Ee.DetailRow,{title:t("amountOut")||"",children:B.jsxs("p",{children:[r||0," ",(n=e.srcToken)==null?void 0:n.symbol]})})},lj=()=>{var r;const{order:e}=zt(),t=Ze({value:e.amountInFilled.value,decimalScale:3});return B.jsx(Ee.DetailRow,{title:e.amountInFilled.label,children:B.jsxs("p",{children:[t||"-"," ",(r=e.srcToken)==null?void 0:r.symbol]})})},uj=()=>{const{order:e}=zt(),t=Me();return M.useMemo(()=>{switch(e.original.status){case ct.Open:return t("Open")||"";case ct.Completed:return t("Completed")||"";case ct.Expired:return t("Expired")||"";case ct.Canceled:return t("Canceled")||""}},[e.original.status,t])},dj=()=>{const e=Me(),t=uj();return B.jsx(Ee.DetailRow,{title:e("status")||"",children:B.jsx("p",{children:t})})},pj=()=>{const{order:e}=zt(),t=Ze({value:e.progress.value,decimalScale:2});return B.jsx(Ee.DetailRow,{title:e.progress.label,children:B.jsxs("p",{children:[t||0,"%"]})})},fj=()=>{const{order:e}=zt(),t=Me();return e.limitPrice.value?B.jsx(Ee.Price,{label:t("limitPrice")||"",price:e.limitPrice.value,srcToken:e.srcToken,dstToken:e.dstToken,tooltip:e.limitPrice.tooltip}):null},hj=()=>{const{order:e}=zt();return e.excecutionPrice.value?B.jsx(Ee.Price,{label:e.excecutionPrice.label,price:e.excecutionPrice.value,srcToken:e.srcToken,dstToken:e.dstToken}):null};var Y0={},ix;function mj(){if(ix)return Y0;ix=1;var e=lu.GenIcon;return Y0.HiArrowRight=function(r){return e({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z",clipRule:"evenodd"}}]})(r)},Y0}var bj=mj();const _u=0,fs=1,mo=2,cx=4;function lx(e){return()=>e}function yj(e){e()}function ux(e,t){return r=>e(t(r))}function dx(e,t){return()=>e(t)}function gj(e,t){return r=>e(t,r)}function Z0(e){return e!==void 0}function xj(...e){return()=>{e.map(yj)}}function bo(){}function Mu(e,t){return t(e),e}function wj(e,t){return t(e)}function tt(...e){return e}function je(e,t){return e(fs,t)}function Ce(e,t){e(_u,t)}function X0(e){e(mo)}function at(e){return e(cx)}function ce(e,t){return je(e,gj(t,_u))}function Vr(e,t){const r=e(fs,n=>{r(),t(n)});return r}function px(e){let t,r;return n=>s=>{t=s,r&&clearTimeout(r),r=setTimeout(()=>{n(t)},e)}}function fx(e,t){return e===t}function rt(e=fx){let t;return r=>n=>{e(t,n)||(t=n,r(n))}}function fe(e){return t=>r=>{e(r)&&t(r)}}function re(e){return t=>ux(t,e)}function cn(e){return t=>()=>{t(e)}}function W(e,...t){const r=vj(...t);return(n,s)=>{switch(n){case mo:X0(e);return;case fs:return je(e,r(s))}}}function ln(e,t){return r=>n=>{r(t=e(t,n))}}function oa(e){return t=>r=>{e>0?e--:t(r)}}function Hn(e){let t=null,r;return n=>s=>{t=s,!r&&(r=setTimeout(()=>{r=void 0,n(t)},e))}}function Te(...e){const t=new Array(e.length);let r=0,n=null;const s=Math.pow(2,e.length)-1;return e.forEach((a,o)=>{const i=Math.pow(2,o);je(a,c=>{const l=r;r=r|i,t[o]=c,l!==s&&r===s&&n&&(n(),n=null)})}),a=>o=>{const i=()=>{a([o].concat(t))};r===s?i():n=i}}function vj(...e){return t=>e.reduceRight(wj,t)}function Ej(e){let t,r;const n=()=>t==null?void 0:t();return function(s,a){switch(s){case fs:return a?r===a?void 0:(n(),r=a,t=je(e,a),t):(n(),bo);case mo:n(),r=null;return}}}function Y(e){let t=e;const r=Ue();return(n,s)=>{switch(n){case _u:t=s;break;case fs:{s(t);break}case cx:return t}return r(n,s)}}function Rt(e,t){return Mu(Y(t),r=>ce(e,r))}function Ue(){const e=[];return(t,r)=>{switch(t){case _u:e.slice().forEach(n=>{n(r)});return;case mo:e.splice(0,e.length);return;case fs:return e.push(r),()=>{const n=e.indexOf(r);n>-1&&e.splice(n,1)}}}}function mr(e){return Mu(Ue(),t=>ce(e,t))}function $e(e,t=[],{singleton:r}={singleton:!0}){return{constructor:e,dependencies:t,id:kj(),singleton:r}}const kj=()=>Symbol();function Cj(e){const t=new Map,r=({constructor:n,dependencies:s,id:a,singleton:o})=>{if(o&&t.has(a))return t.get(a);const i=n(s.map(c=>r(c)));return o&&t.set(a,i),i};return r(e)}function Et(...e){const t=Ue(),r=new Array(e.length);let n=0;const s=Math.pow(2,e.length)-1;return e.forEach((a,o)=>{const i=Math.pow(2,o);je(a,c=>{r[o]=c,n=n|i,n===s&&Ce(t,r)})}),function(a,o){switch(a){case mo:{X0(t);return}case fs:return n===s&&o(r),je(t,o)}}}function he(e,t=fx){return W(e,rt(t))}function Q0(...e){return function(t,r){switch(t){case mo:return;case fs:return xj(...e.map(n=>je(n,r)))}}}var nr=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(nr||{});const Tj={0:"debug",3:"error",1:"log",2:"warn"},Aj=()=>typeof globalThis>"u"?window:globalThis,hs=$e(()=>{const e=Y(3);return{log:Y((t,r,n=1)=>{var s;const a=(s=Aj().VIRTUOSO_LOG_LEVEL)!=null?s:at(e);n>=a&&console[Tj[n]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,r)}),logLevel:e}},[],{singleton:!0});function ia(e,t,r){return J0(e,t,r).callbackRef}function J0(e,t,r){const n=M.useRef(null);let s=o=>{};const a=M.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(o=>{const i=()=>{const c=o[0].target;c.offsetParent!==null&&e(c)};r?i():requestAnimationFrame(i)}):null,[e,r]);return s=o=>{o&&t?(a==null||a.observe(o),n.current=o):(n.current&&(a==null||a.unobserve(n.current)),n.current=null)},{callbackRef:s,ref:n}}function Sj(e,t,r,n,s,a,o,i,c){const l=M.useCallback(u=>{const d=Pj(u.children,t,i?"offsetWidth":"offsetHeight",s);let f=u.parentElement;for(;!f.dataset.virtuosoScroller;)f=f.parentElement;const h=f.lastElementChild.dataset.viewportType==="window";let y;h&&(y=f.ownerDocument.defaultView);const g=o?i?o.scrollLeft:o.scrollTop:h?i?y.scrollX||y.document.documentElement.scrollLeft:y.scrollY||y.document.documentElement.scrollTop:i?f.scrollLeft:f.scrollTop,E=o?i?o.scrollWidth:o.scrollHeight:h?i?y.document.documentElement.scrollWidth:y.document.documentElement.scrollHeight:i?f.scrollWidth:f.scrollHeight,v=o?i?o.offsetWidth:o.offsetHeight:h?i?y.innerWidth:y.innerHeight:i?f.offsetWidth:f.offsetHeight;n({scrollHeight:E,scrollTop:Math.max(g,0),viewportHeight:v}),a==null||a(i?hx("column-gap",getComputedStyle(u).columnGap,s):hx("row-gap",getComputedStyle(u).rowGap,s)),d!==null&&e(d)},[e,t,s,a,o,n,i]);return J0(l,r,c)}function Pj(e,t,r,n){const s=e.length;if(s===0)return null;const a=[];for(let o=0;o<s;o++){const i=e.item(o);if(i.dataset.index===void 0)continue;const c=parseInt(i.dataset.index),l=parseFloat(i.dataset.knownSize),u=t(i,r);if(u===0&&n("Zero-sized element, this should not happen",{child:i},nr.ERROR),u===l)continue;const d=a[a.length-1];a.length===0||d.size!==u||d.endIndex!==c-1?a.push({endIndex:c,size:u,startIndex:c}):a[a.length-1].endIndex++}return a}function hx(e,t,r){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&r(`${e} was not resolved to pixel value correctly`,t,nr.WARN),t==="normal"?0:parseInt(t??"0",10)}function mx(e,t,r){const n=M.useRef(null),s=M.useCallback(c=>{if(!(c!=null&&c.offsetParent))return;const l=c.getBoundingClientRect(),u=l.width;let d,f;if(t){const h=t.getBoundingClientRect(),y=l.top-h.top;f=h.height-Math.max(0,y),d=y+t.scrollTop}else{const h=o.current.ownerDocument.defaultView;f=h.innerHeight-Math.max(0,l.top),d=l.top+h.scrollY}n.current={offsetTop:d,visibleHeight:f,visibleWidth:u},e(n.current)},[e,t]),{callbackRef:a,ref:o}=J0(s,!0,r),i=M.useCallback(()=>{s(o.current)},[s,o]);return M.useEffect(()=>{var c;if(t){t.addEventListener("scroll",i);const l=new ResizeObserver(()=>{requestAnimationFrame(i)});return l.observe(t),()=>{t.removeEventListener("scroll",i),l.unobserve(t)}}else{const l=(c=o.current)==null?void 0:c.ownerDocument.defaultView;return l==null||l.addEventListener("scroll",i),l==null||l.addEventListener("resize",i),()=>{l==null||l.removeEventListener("scroll",i),l==null||l.removeEventListener("resize",i)}}},[i,t,o]),a}const Wt=$e(()=>{const e=Ue(),t=Ue(),r=Y(0),n=Ue(),s=Y(0),a=Ue(),o=Ue(),i=Y(0),c=Y(0),l=Y(0),u=Y(0),d=Ue(),f=Ue(),h=Y(!1),y=Y(!1),g=Y(!1);return ce(W(e,re(({scrollTop:E})=>E)),t),ce(W(e,re(({scrollHeight:E})=>E)),o),ce(t,s),{deviation:r,fixedFooterHeight:l,fixedHeaderHeight:c,footerHeight:u,headerHeight:i,horizontalDirection:y,scrollBy:f,scrollContainerState:e,scrollHeight:o,scrollingInProgress:h,scrollTo:d,scrollTop:t,skipAnimationFrameInResizeObserver:g,smoothScrollTargetReached:n,statefulScrollTop:s,viewportHeight:a}},[],{singleton:!0}),ic={lvl:0};function bx(e,t){const r=e.length;if(r===0)return[];let{index:n,value:s}=t(e[0]);const a=[];for(let o=1;o<r;o++){const{index:i,value:c}=t(e[o]);a.push({end:i-1,start:n,value:s}),n=i,s=c}return a.push({end:1/0,start:n,value:s}),a}function qe(e){return e===ic}function cc(e,t){if(!qe(e))return t===e.k?e.v:t<e.k?cc(e.l,t):cc(e.r,t)}function Wr(e,t,r="k"){if(qe(e))return[-1/0,void 0];if(Number(e[r])===t)return[e.k,e.v];if(Number(e[r])<t){const n=Wr(e.r,t,r);return n[0]===-1/0?[e.k,e.v]:n}return Wr(e.l,t,r)}function br(e,t,r){return qe(e)?xx(t,r,1):t===e.k?At(e,{k:t,v:r}):t<e.k?wx(At(e,{l:br(e.l,t,r)})):wx(At(e,{r:br(e.r,t,r)}))}function yo(){return ic}function go(e,t,r){if(qe(e))return[];const n=Wr(e,t)[0];return Ij(th(e,n,r))}function eh(e,t){if(qe(e))return ic;const{k:r,l:n,r:s}=e;if(t===r){if(qe(n))return s;if(qe(s))return n;{const[a,o]=gx(n);return Nu(At(e,{k:a,l:yx(n),v:o}))}}else return t<r?Nu(At(e,{l:eh(n,t)})):Nu(At(e,{r:eh(s,t)}))}function ca(e){return qe(e)?[]:[...ca(e.l),{k:e.k,v:e.v},...ca(e.r)]}function th(e,t,r){if(qe(e))return[];const{k:n,l:s,r:a,v:o}=e;let i=[];return n>t&&(i=i.concat(th(s,t,r))),n>=t&&n<=r&&i.push({k:n,v:o}),n<=r&&(i=i.concat(th(a,t,r))),i}function Nu(e){const{l:t,lvl:r,r:n}=e;if(n.lvl>=r-1&&t.lvl>=r-1)return e;if(r>n.lvl+1){if(rh(t))return vx(At(e,{lvl:r-1}));if(!qe(t)&&!qe(t.r))return At(t.r,{l:At(t,{r:t.r.l}),lvl:r,r:At(e,{l:t.r.r,lvl:r-1})});throw new Error("Unexpected empty nodes")}else{if(rh(e))return nh(At(e,{lvl:r-1}));if(!qe(n)&&!qe(n.l)){const s=n.l,a=rh(s)?n.lvl-1:n.lvl;return At(s,{l:At(e,{lvl:r-1,r:s.l}),lvl:s.lvl+1,r:nh(At(n,{l:s.r,lvl:a}))})}else throw new Error("Unexpected empty nodes")}}function At(e,t){return xx(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function yx(e){return qe(e.r)?e.l:Nu(At(e,{r:yx(e.r)}))}function rh(e){return qe(e)||e.lvl>e.r.lvl}function gx(e){return qe(e.r)?[e.k,e.v]:gx(e.r)}function xx(e,t,r,n=ic,s=ic){return{k:e,l:n,lvl:r,r:s,v:t}}function wx(e){return nh(vx(e))}function vx(e){const{l:t}=e;return!qe(t)&&t.lvl===e.lvl?At(t,{r:At(e,{l:t.r})}):e}function nh(e){const{lvl:t,r}=e;return!qe(r)&&!qe(r.r)&&r.lvl===t&&r.r.lvl===t?At(r,{l:At(e,{r:r.l}),lvl:t+1}):e}function Ij(e){return bx(e,({k:t,v:r})=>({index:t,value:r}))}function Ex(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function lc(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const sh=$e(()=>({recalcInProgress:Y(!1)}),[],{singleton:!0});function kx(e,t,r){return e[Lu(e,t,r)]}function Lu(e,t,r,n=0){let s=e.length-1;for(;n<=s;){const a=Math.floor((n+s)/2),o=e[a],i=r(o,t);if(i===0)return a;if(i===-1){if(s-n<2)return a-1;s=a-1}else{if(s===n)return a;n=a+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function Bj(e,t,r,n){const s=Lu(e,t,n),a=Lu(e,r,n,s);return e.slice(s,a+1)}function ms(e,t){return Math.round(e.getBoundingClientRect()[t])}function zu(e){return!qe(e.groupOffsetTree)}function ah({index:e},t){return t===e?0:t<e?-1:1}function Fj(){return{groupIndices:[],groupOffsetTree:yo(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:yo()}}function Uj(e,t){let r=qe(e)?0:1/0;for(const n of t){const{endIndex:s,size:a,startIndex:o}=n;if(r=Math.min(r,o),qe(e)){e=br(e,0,a);continue}const i=go(e,o-1,s+1);if(i.some(zj(n)))continue;let c=!1,l=!1;for(const{end:u,start:d,value:f}of i)c?(s>=d||a===f)&&(e=eh(e,d)):(l=f!==a,c=!0),u>s&&s>=d&&f!==a&&(e=br(e,s+1,f));l&&(e=br(e,o,a))}return[e,r]}function Oj(e){return typeof e.groupIndex<"u"}function Dj({offset:e},t){return t===e?0:t<e?-1:1}function uc(e,t,r){if(t.length===0)return 0;const{index:n,offset:s,size:a}=kx(t,e,ah),o=e-n,i=a*o+(o-1)*r+s;return i>0?i+r:i}function Cx(e,t){if(!zu(t))return e;let r=0;for(;t.groupIndices[r]<=e+r;)r++;return e+r}function Tx(e,t,r){if(Oj(e))return t.groupIndices[e.groupIndex]+1;{const n=e.index==="LAST"?r:e.index;let s=Cx(n,t);return s=Math.max(0,s,Math.min(r,s)),s}}function _j(e,t,r,n=0){return n>0&&(t=Math.max(t,kx(e,n,ah).offset)),bx(Bj(e,t,r,Dj),Lj)}function Mj(e,[t,r,n,s]){t.length>0&&n("received item sizes",t,nr.DEBUG);const a=e.sizeTree;let o=a,i=0;if(r.length>0&&qe(a)&&t.length===2){const f=t[0].size,h=t[1].size;o=r.reduce((y,g)=>br(br(y,g,f),g+1,h),o)}else[o,i]=Uj(o,t);if(o===a)return e;const{lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d}=oh(e.offsetTree,i,o,s);return{groupIndices:r,groupOffsetTree:r.reduce((f,h)=>br(f,h,uc(h,d,s)),yo()),lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d,sizeTree:o}}function Nj(e){return ca(e).map(({k:t,v:r},n,s)=>{const a=s[n+1];return{endIndex:a?a.k-1:1/0,size:r,startIndex:t}})}function Ax(e,t){let r=0,n=0;for(;r<e;)r+=t[n+1]-t[n]-1,n++;return n-(r===e?0:1)}function oh(e,t,r,n){let s=e,a=0,o=0,i=0,c=0;if(t!==0){c=Lu(s,t-1,ah),i=s[c].offset;const l=Wr(r,t-1);a=l[0],o=l[1],s.length&&s[c].size===Wr(r,t)[1]&&(c-=1),s=s.slice(0,c+1)}else s=[];for(const{start:l,value:u}of go(r,t,1/0)){const d=l-a,f=d*o+i+d*n;s.push({index:l,offset:f,size:u}),a=l,i=f,o=u}return{lastIndex:a,lastOffset:i,lastSize:o,offsetTree:s}}function Lj(e){return{index:e.index,value:e}}function zj(e){const{endIndex:t,size:r,startIndex:n}=e;return s=>s.start===n&&(s.end===t||s.end===1/0)&&s.value===r}const Rj={offsetHeight:"height",offsetWidth:"width"},un=$e(([{log:e},{recalcInProgress:t}])=>{const r=Ue(),n=Ue(),s=Rt(n,0),a=Ue(),o=Ue(),i=Y(0),c=Y([]),l=Y(void 0),u=Y(void 0),d=Y(void 0),f=Y(void 0),h=Y((T,m)=>ms(T,Rj[m])),y=Y(void 0),g=Y(0),E=Fj(),v=Rt(W(r,Te(c,e,g),ln(Mj,E),rt()),E),w=Rt(W(c,rt(),ln((T,m)=>({current:m,prev:T.current}),{current:[],prev:[]}),re(({prev:T})=>T)),[]);ce(W(c,fe(T=>T.length>0),Te(v,g),re(([T,m,b])=>{const x=T.reduce((S,I,F)=>br(S,I,uc(I,m.offsetTree,b)||F),yo());return{...m,groupIndices:T,groupOffsetTree:x}})),v),ce(W(n,Te(v),fe(([T,{lastIndex:m}])=>T<m),re(([T,{lastIndex:m,lastSize:b}])=>[{endIndex:m,size:b,startIndex:T}])),r),ce(l,u);const A=Rt(W(l,re(T=>T===void 0)),!0);ce(W(u,fe(T=>T!==void 0&&qe(at(v).sizeTree)),re(T=>{const m=at(d),b=at(c).length>0;return m?b?[{endIndex:0,size:m,startIndex:0},{endIndex:1,size:T,startIndex:1}]:[]:[{endIndex:0,size:T,startIndex:0}]})),r),ce(W(f,fe(T=>T!==void 0&&T.length>0&&qe(at(v).sizeTree)),re(T=>{const m=[];let b=T[0],x=0;for(let S=1;S<T.length;S++){const I=T[S];I!==b&&(m.push({endIndex:S-1,size:b,startIndex:x}),b=I,x=S)}return m.push({endIndex:T.length-1,size:b,startIndex:x}),m})),r),ce(W(c,Te(d,u),fe(([,T,m])=>T!==void 0&&m!==void 0),re(([T,m,b])=>{const x=[];for(let S=0;S<T.length;S++){const I=T[S],F=T[S+1];x.push({startIndex:I,endIndex:I,size:m}),F!==void 0&&x.push({startIndex:I+1,endIndex:F-1,size:b})}return x})),r);const C=mr(W(r,Te(v),ln(({sizes:T},[m,b])=>({changed:b!==T,sizes:b}),{changed:!1,sizes:E}),re(T=>T.changed)));je(W(i,ln((T,m)=>({diff:T.prev-m,prev:m}),{diff:0,prev:0}),re(T=>T.diff)),T=>{const{groupIndices:m}=at(v);if(T>0)Ce(t,!0),Ce(a,T+Ax(T,m));else if(T<0){const b=at(w);b.length>0&&(T-=Ax(-T,b)),Ce(o,T)}}),je(W(i,Te(e)),([T,m])=>{T<0&&m("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:i},nr.ERROR)});const D=mr(a);ce(W(a,Te(v),re(([T,m])=>{const b=m.groupIndices.length>0,x=[],S=m.lastSize;if(b){const I=cc(m.sizeTree,0);let F=0,_=0;for(;F<T;){const P=m.groupIndices[_],O=m.groupIndices.length===_+1?1/0:m.groupIndices[_+1]-P-1;x.push({endIndex:P,size:I,startIndex:P}),x.push({endIndex:P+1+O-1,size:S,startIndex:P+1}),_++,F+=O+1}const k=ca(m.sizeTree);return F!==T&&k.shift(),k.reduce((P,{k:O,v:U})=>{let L=P.ranges;return P.prevSize!==0&&(L=[...P.ranges,{endIndex:O+T-1,size:P.prevSize,startIndex:P.prevIndex}]),{prevIndex:O+T,prevSize:U,ranges:L}},{prevIndex:T,prevSize:0,ranges:x}).ranges}return ca(m.sizeTree).reduce((I,{k:F,v:_})=>({prevIndex:F+T,prevSize:_,ranges:[...I.ranges,{endIndex:F+T-1,size:I.prevSize,startIndex:I.prevIndex}]}),{prevIndex:0,prevSize:S,ranges:[]}).ranges})),r);const z=mr(W(o,Te(v,g),re(([T,{offsetTree:m},b])=>{const x=-T;return uc(x,m,b)})));return ce(W(o,Te(v,g),re(([T,m,b])=>{if(m.groupIndices.length>0){if(qe(m.sizeTree))return m;let x=yo();const S=at(w);let I=0,F=0,_=0;for(;I<-T;){_=S[F];const k=S[F+1]-_-1;F++,I+=k+1}if(x=ca(m.sizeTree).reduce((k,{k:P,v:O})=>br(k,Math.max(0,P+T),O),x),I!==-T){const k=cc(m.sizeTree,_);x=br(x,0,k);const P=Wr(m.sizeTree,-T+1)[1];x=br(x,1,P)}return{...m,sizeTree:x,...oh(m.offsetTree,0,x,b)}}else{const x=ca(m.sizeTree).reduce((S,{k:I,v:F})=>br(S,Math.max(0,I+T),F),yo());return{...m,sizeTree:x,...oh(m.offsetTree,0,x,b)}}})),v),{beforeUnshiftWith:D,data:y,defaultItemSize:u,firstItemIndex:i,fixedItemSize:l,fixedGroupSize:d,gap:g,groupIndices:c,heightEstimates:f,itemSize:h,listRefresh:C,shiftWith:o,shiftWithOffset:z,sizeRanges:r,sizes:v,statefulTotalCount:s,totalCount:n,trackItemSizes:A,unshiftWith:a}},tt(hs,sh),{singleton:!0});function Hj(e){return e.reduce((t,r)=>(t.groupIndices.push(t.totalCount),t.totalCount+=r+1,t),{groupIndices:[],totalCount:0})}const Sx=$e(([{groupIndices:e,sizes:t,totalCount:r},{headerHeight:n,scrollTop:s}])=>{const a=Ue(),o=Ue(),i=mr(W(a,re(Hj)));return ce(W(i,re(c=>c.totalCount)),r),ce(W(i,re(c=>c.groupIndices)),e),ce(W(Et(s,t,n),fe(([c,l])=>zu(l)),re(([c,l,u])=>Wr(l.groupOffsetTree,Math.max(c-u,0),"v")[0]),rt(),re(c=>[c])),o),{groupCounts:a,topItemsIndexes:o}},tt(un,Wt)),bs=$e(([{log:e}])=>{const t=Y(!1),r=mr(W(t,fe(n=>n),rt()));return je(t,n=>{n&&at(e)("props updated",{},nr.DEBUG)}),{didMount:r,propsReady:t}},tt(hs),{singleton:!0}),$j=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Px(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!$j)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const dc=$e(([{gap:e,listRefresh:t,sizes:r,totalCount:n},{fixedFooterHeight:s,fixedHeaderHeight:a,footerHeight:o,headerHeight:i,scrollingInProgress:c,scrollTo:l,smoothScrollTargetReached:u,viewportHeight:d},{log:f}])=>{const h=Ue(),y=Ue(),g=Y(0);let E=null,v=null,w=null;function A(){E&&(E(),E=null),w&&(w(),w=null),v&&(clearTimeout(v),v=null),Ce(c,!1)}return ce(W(h,Te(r,d,n,g,i,o,f),Te(e,a,s),re(([[C,D,z,T,m,b,x,S],I,F,_])=>{const k=Px(C),{align:P,behavior:O,offset:U}=k,L=T-1,H=Tx(k,D,L);let G=uc(H,D.offsetTree,I)+b;P==="end"?(G+=F+Wr(D.sizeTree,H)[1]-z+_,H===L&&(G+=x)):P==="center"?G+=(F+Wr(D.sizeTree,H)[1]-z+_)/2:G-=m,U&&(G+=U);const Q=pe=>{A(),pe?(S("retrying to scroll to",{location:C},nr.DEBUG),Ce(h,C)):(Ce(y,!0),S("list did not change, scroll successful",{},nr.DEBUG))};if(A(),O==="smooth"){let pe=!1;w=je(t,me=>{pe=pe||me}),E=Vr(u,()=>{Q(pe)})}else E=Vr(W(t,Gj(150)),Q);return v=setTimeout(()=>{A()},1200),Ce(c,!0),S("scrolling from index to",{behavior:O,index:H,top:G},nr.DEBUG),{behavior:O,top:G}})),l),{scrollTargetReached:y,scrollToIndex:h,topListHeight:g}},tt(un,Wt,hs),{singleton:!0});function Gj(e){return t=>{const r=setTimeout(()=>{t(!1)},e);return n=>{n&&(t(!0),clearTimeout(r))}}}function ih(e,t){e==0?t():requestAnimationFrame(()=>{ih(e-1,t)})}function ch(e,t){const r=t-1;return typeof e=="number"?e:e.index==="LAST"?r:e.index}const pc=$e(([{defaultItemSize:e,listRefresh:t,sizes:r},{scrollTop:n},{scrollTargetReached:s,scrollToIndex:a},{didMount:o}])=>{const i=Y(!0),c=Y(0),l=Y(!0);return ce(W(o,Te(c),fe(([u,d])=>!!d),cn(!1)),i),ce(W(o,Te(c),fe(([u,d])=>!!d),cn(!1)),l),je(W(Et(t,o),Te(i,r,e,l),fe(([[,u],d,{sizeTree:f},h,y])=>u&&(!qe(f)||Z0(h))&&!d&&!y),Te(c)),([,u])=>{Vr(s,()=>{Ce(l,!0)}),ih(4,()=>{Vr(n,()=>{Ce(i,!0)}),Ce(a,u)})}),{initialItemFinalLocationReached:l,initialTopMostItemIndex:c,scrolledToInitialItem:i}},tt(un,Wt,dc,bs),{singleton:!0});function Ix(e,t){return Math.abs(e-t)<1.01}const fc="up",hc="down",jj="none",Vj={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Wj=0,mc=$e(([{footerHeight:e,headerHeight:t,scrollBy:r,scrollContainerState:n,scrollTop:s,viewportHeight:a}])=>{const o=Y(!1),i=Y(!0),c=Ue(),l=Ue(),u=Y(4),d=Y(Wj),f=Rt(W(Q0(W(he(s),oa(1),cn(!0)),W(he(s),oa(1),cn(!1),px(100))),rt()),!1),h=Rt(W(Q0(W(r,cn(!0)),W(r,cn(!1),px(200))),rt()),!1);ce(W(Et(he(s),he(d)),re(([w,A])=>w<=A),rt()),i),ce(W(i,Hn(50)),l);const y=mr(W(Et(n,he(a),he(t),he(e),he(u)),ln((w,[{scrollHeight:A,scrollTop:C},D,z,T,m])=>{const b=C+D-A>-m,x={scrollHeight:A,scrollTop:C,viewportHeight:D};if(b){let I,F;return C>w.state.scrollTop?(I="SCROLLED_DOWN",F=w.state.scrollTop-C):(I="SIZE_DECREASED",F=w.state.scrollTop-C||w.scrollTopDelta),{atBottom:!0,atBottomBecause:I,scrollTopDelta:F,state:x}}let S;return x.scrollHeight>w.state.scrollHeight?S="SIZE_INCREASED":D<w.state.viewportHeight?S="VIEWPORT_HEIGHT_DECREASING":C<w.state.scrollTop?S="SCROLLING_UPWARDS":S="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:S,state:x}},Vj),rt((w,A)=>w&&w.atBottom===A.atBottom))),g=Rt(W(n,ln((w,{scrollHeight:A,scrollTop:C,viewportHeight:D})=>{if(Ix(w.scrollHeight,A))return{changed:!1,jump:0,scrollHeight:A,scrollTop:C};{const z=A-(C+D)<1;return w.scrollTop!==C&&z?{changed:!0,jump:w.scrollTop-C,scrollHeight:A,scrollTop:C}:{changed:!0,jump:0,scrollHeight:A,scrollTop:C}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),fe(w=>w.changed),re(w=>w.jump)),0);ce(W(y,re(w=>w.atBottom)),o),ce(W(o,Hn(50)),c);const E=Y(hc);ce(W(n,re(({scrollTop:w})=>w),rt(),ln((w,A)=>at(h)?{direction:w.direction,prevScrollTop:A}:{direction:A<w.prevScrollTop?fc:hc,prevScrollTop:A},{direction:hc,prevScrollTop:0}),re(w=>w.direction)),E),ce(W(n,Hn(50),cn(jj)),E);const v=Y(0);return ce(W(f,fe(w=>!w),cn(0)),v),ce(W(s,Hn(100),Te(f),fe(([w,A])=>!!A),ln(([w,A],[C])=>[A,C],[0,0]),re(([w,A])=>A-w)),v),{atBottomState:y,atBottomStateChange:c,atBottomThreshold:u,atTopStateChange:l,atTopThreshold:d,isAtBottom:o,isAtTop:i,isScrolling:f,lastJumpDueToItemResize:g,scrollDirection:E,scrollVelocity:v}},tt(Wt)),bc="top",yc="bottom",Bx="none";function Fx(e,t,r){return typeof e=="number"?r===fc&&t===bc||r===hc&&t===yc?e:0:r===fc?t===bc?e.main:e.reverse:t===yc?e.main:e.reverse}function Ux(e,t){var r;return typeof e=="number"?e:(r=e[t])!=null?r:0}const lh=$e(([{deviation:e,fixedHeaderHeight:t,headerHeight:r,scrollTop:n,viewportHeight:s}])=>{const a=Ue(),o=Y(0),i=Y(0),c=Y(0),l=Rt(W(Et(he(n),he(s),he(r),he(a,lc),he(c),he(o),he(t),he(e),he(i)),re(([u,d,f,[h,y],g,E,v,w,A])=>{const C=u-w,D=E+v,z=Math.max(f-C,0);let T=Bx;const m=Ux(A,bc),b=Ux(A,yc);return h-=w,h+=f+v,y+=f+v,y-=w,h>u+D-m&&(T=fc),y<u-z+d+b&&(T=hc),T!==Bx?[Math.max(C-f-Fx(g,bc,T)-m,0),C-z-v+d+Fx(g,yc,T)+b]:null}),fe(u=>u!=null),rt(lc)),[0,0]);return{increaseViewportBy:i,listBoundary:a,overscan:c,topListHeight:o,visibleRange:l}},tt(Wt),{singleton:!0});function qj(e,t,r){if(zu(t)){const n=Cx(e,t);return[{index:Wr(t.groupOffsetTree,n)[0],offset:0,size:0},{data:r==null?void 0:r[0],index:n,offset:0,size:0}]}return[{data:r==null?void 0:r[0],index:e,offset:0,size:0}]}const uh={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Ru(e,t,r,n,s,a){const{lastIndex:o,lastOffset:i,lastSize:c}=s;let l=0,u=0;if(e.length>0){l=e[0].offset;const g=e[e.length-1];u=g.offset+g.size}const d=r-o,f=i+d*c+(d-1)*n,h=l,y=f-u;return{bottom:u,firstItemIndex:a,items:Dx(e,s,a),offsetBottom:y,offsetTop:l,top:h,topItems:Dx(t,s,a),topListHeight:t.reduce((g,E)=>E.size+g,0),totalCount:r}}function Ox(e,t,r,n,s,a){let o=0;if(r.groupIndices.length>0)for(const u of r.groupIndices){if(u-o>=e)break;o++}const i=e+o,c=ch(t,i),l=Array.from({length:i}).map((u,d)=>({data:a[d+c],index:d+c,offset:0,size:0}));return Ru(l,[],i,s,r,n)}function Dx(e,t,r){if(e.length===0)return[];if(!zu(t))return e.map(l=>({...l,index:l.index+r,originalIndex:l.index}));const n=e[0].index,s=e[e.length-1].index,a=[],o=go(t.groupOffsetTree,n,s);let i,c=0;for(const l of e){(!i||i.end<l.index)&&(i=o.shift(),c=t.groupIndices.indexOf(i.start));let u;l.index===i.start?u={index:c,type:"group"}:u={groupIndex:c,index:l.index-(c+1)+r},a.push({...u,data:l.data,offset:l.offset,originalIndex:l.index,size:l.size})}return a}function _x(e,t){var r;return e===void 0?0:typeof e=="number"?e:(r=e[t])!=null?r:0}const la=$e(([{data:e,firstItemIndex:t,gap:r,sizes:n,totalCount:s},a,{listBoundary:o,topListHeight:i,visibleRange:c},{initialTopMostItemIndex:l,scrolledToInitialItem:u},{topListHeight:d},f,{didMount:h},{recalcInProgress:y}])=>{const g=Y([]),E=Y(0),v=Ue(),w=Y(0);ce(a.topItemsIndexes,g);const A=Rt(W(Et(h,y,he(c,lc),he(s),he(n),he(l),u,he(g),he(t),he(r),he(w),e),fe(([T,m,,b,,,,,,,,x])=>{const S=x&&x.length!==b;return T&&!m&&!S}),re(([,,[T,m],b,x,S,I,F,_,k,P,O])=>{var U,L,H,G;const Q=x,{offsetTree:pe,sizeTree:me}=Q,ie=at(E);if(b===0)return{...uh,totalCount:b};if(T===0&&m===0)return ie===0?{...uh,totalCount:b}:Ox(ie,S,x,_,k,O||[]);if(qe(me))return ie>0?null:Ru(qj(ch(S,b),Q,O),[],b,k,Q,_);const de=[];if(F.length>0){const Ae=F[0],ve=F[F.length-1];let be=0;for(const Xe of go(me,Ae,ve)){const Ke=Xe.value,Qe=Math.max(Xe.start,Ae),Br=Math.min(Xe.end,ve);for(let Ot=Qe;Ot<=Br;Ot++)de.push({data:O==null?void 0:O[Ot],index:Ot,offset:be,size:Ke}),be+=Ke}}if(!I)return Ru([],de,b,k,Q,_);const Be=F.length>0?F[F.length-1]+1:0,X=_j(pe,T,m,Be);if(X.length===0)return null;const we=b-1,De=Mu([],Ae=>{for(const ve of X){const be=ve.value;let Xe=be.offset,Ke=ve.start;const Qe=be.size;if(be.offset<T){Ke+=Math.floor((T-be.offset+k)/(Qe+k));const Ot=Ke-ve.start;Xe+=Ot*Qe+Ot*k}Ke<Be&&(Xe+=(Be-Ke)*Qe,Ke=Be);const Br=Math.min(ve.end,we);for(let Ot=Ke;Ot<=Br&&!(Xe>=m);Ot++)Ae.push({data:O==null?void 0:O[Ot],index:Ot,offset:Xe,size:Qe}),Xe+=Qe+k}}),Ge=_x(P,bc),it=_x(P,yc);if(De.length>0&&(Ge>0||it>0)){const Ae=De[0],ve=De[De.length-1];if(Ge>0&&Ae.index>Be){const be=Math.min(Ge,Ae.index-Be),Xe=[];let Ke=Ae.offset;for(let Qe=Ae.index-1;Qe>=Ae.index-be;Qe--){const Br=(L=(U=go(me,Qe,Qe)[0])==null?void 0:U.value)!=null?L:Ae.size;Ke-=Br+k,Xe.unshift({data:O==null?void 0:O[Qe],index:Qe,offset:Ke,size:Br})}De.unshift(...Xe)}if(it>0&&ve.index<we){const be=Math.min(it,we-ve.index);let Xe=ve.offset+ve.size+k;for(let Ke=ve.index+1;Ke<=ve.index+be;Ke++){const Qe=(G=(H=go(me,Ke,Ke)[0])==null?void 0:H.value)!=null?G:ve.size;De.push({data:O==null?void 0:O[Ke],index:Ke,offset:Xe,size:Qe}),Xe+=Qe+k}}}return Ru(De,de,b,k,Q,_)}),fe(T=>T!==null),rt()),uh);ce(W(e,fe(Z0),re(T=>T==null?void 0:T.length)),s),ce(W(A,re(T=>T.topListHeight)),d),ce(d,i),ce(W(A,re(T=>[T.top,T.bottom])),o),ce(W(A,re(T=>T.items)),v);const C=mr(W(A,fe(({items:T})=>T.length>0),Te(s,e),fe(([{items:T},m])=>T[T.length-1].originalIndex===m-1),re(([,T,m])=>[T-1,m]),rt(lc),re(([T])=>T))),D=mr(W(A,Hn(200),fe(({items:T,topItems:m})=>T.length>0&&T[0].originalIndex===m.length),re(({items:T})=>T[0].index),rt())),z=mr(W(A,fe(({items:T})=>T.length>0),re(({items:T})=>{let m=0,b=T.length-1;for(;T[m].type==="group"&&m<b;)m++;for(;T[b].type==="group"&&b>m;)b--;return{endIndex:T[b].index,startIndex:T[m].index}}),rt(Ex)));return{endReached:C,initialItemCount:E,itemsRendered:v,listState:A,minOverscanItemCount:w,rangeChanged:z,startReached:D,topItemsIndexes:g,...f}},tt(un,Sx,lh,pc,dc,mc,bs,sh),{singleton:!0}),Mx=$e(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:r,headerHeight:n},{listState:s}])=>{const a=Ue(),o=Rt(W(Et(r,e,n,t,s),re(([i,c,l,u,d])=>i+c+l+u+d.offsetBottom+d.bottom)),0);return ce(he(o),a),{totalListHeight:o,totalListHeightChanged:a}},tt(Wt,la),{singleton:!0}),Kj=$e(([{viewportHeight:e},{totalListHeight:t}])=>{const r=Y(!1),n=Rt(W(Et(r,e,t),fe(([s])=>s),re(([,s,a])=>Math.max(0,s-a)),Hn(0),rt()),0);return{alignToBottom:r,paddingTopAddition:n}},tt(Wt,Mx),{singleton:!0}),Nx=$e(()=>({context:Y(null)})),Yj=({itemBottom:e,itemTop:t,locationParams:{align:r,behavior:n,...s},viewportBottom:a,viewportTop:o})=>t<o?{...s,align:r??"start",behavior:n}:e>a?{...s,align:r??"end",behavior:n}:null,Lx=$e(([{gap:e,sizes:t,totalCount:r},{fixedFooterHeight:n,fixedHeaderHeight:s,headerHeight:a,scrollingInProgress:o,scrollTop:i,viewportHeight:c},{scrollToIndex:l}])=>{const u=Ue();return ce(W(u,Te(t,c,r,a,s,n,i),Te(e),re(([[d,f,h,y,g,E,v,w],A])=>{const{align:C,behavior:D,calculateViewLocation:z=Yj,done:T,...m}=d,b=Tx(d,f,y-1),x=uc(b,f.offsetTree,A)+g+E,S=x+Wr(f.sizeTree,b)[1],I=w+E,F=w+h-v,_=z({itemBottom:S,itemTop:x,locationParams:{align:C,behavior:D,...m},viewportBottom:F,viewportTop:I});return _?T&&Vr(W(o,fe(k=>!k),oa(at(o)?1:2)),T):T&&T(),_}),fe(d=>d!==null)),l),{scrollIntoView:u}},tt(un,Wt,dc,la,hs),{singleton:!0});function zx(e){return e?e==="smooth"?"smooth":"auto":!1}const Zj=(e,t)=>typeof e=="function"?zx(e(t)):t&&zx(e),Xj=$e(([{listRefresh:e,totalCount:t,fixedItemSize:r,data:n},{atBottomState:s,isAtBottom:a},{scrollToIndex:o},{scrolledToInitialItem:i},{didMount:c,propsReady:l},{log:u},{scrollingInProgress:d},{context:f},{scrollIntoView:h}])=>{const y=Y(!1),g=Ue();let E=null;function v(D){Ce(o,{align:"end",behavior:D,index:"LAST"})}je(W(Et(W(he(t),oa(1)),c),Te(he(y),a,i,d),re(([[D,z],T,m,b,x])=>{let S=z&&b,I="auto";return S&&(I=Zj(T,m||x),S=S&&!!I),{followOutputBehavior:I,shouldFollow:S,totalCount:D}}),fe(({shouldFollow:D})=>D)),({followOutputBehavior:D,totalCount:z})=>{E&&(E(),E=null),at(r)?requestAnimationFrame(()=>{at(u)("following output to ",{totalCount:z},nr.DEBUG),v(D)}):E=Vr(e,()=>{at(u)("following output to ",{totalCount:z},nr.DEBUG),v(D),E=null})});function w(D){const z=Vr(s,T=>{D&&!T.atBottom&&T.notAtBottomBecause==="SIZE_INCREASED"&&!E&&(at(u)("scrolling to bottom due to increased size",{},nr.DEBUG),v("auto"))});setTimeout(z,100)}je(W(Et(he(y),t,l),fe(([D,,z])=>D&&z),ln(({value:D},[,z])=>({refreshed:D===z,value:z}),{refreshed:!1,value:0}),fe(({refreshed:D})=>D),Te(y,t)),([,D])=>{at(i)&&w(D!==!1)}),je(g,()=>{w(at(y)!==!1)}),je(Et(he(y),s),([D,z])=>{D&&!z.atBottom&&z.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&v("auto")});const A=Y(null),C=Ue();return ce(Q0(W(he(n),re(D=>{var z;return(z=D==null?void 0:D.length)!=null?z:0})),W(he(t))),C),je(W(Et(W(C,oa(1)),c),Te(he(A),i,d,f),re(([[D,z],T,m,b,x])=>z&&m&&(T==null?void 0:T({context:x,totalCount:D,scrollingInProgress:b}))),fe(D=>!!D),Hn(0)),D=>{E&&(E(),E=null),at(r)?requestAnimationFrame(()=>{at(u)("scrolling into view",{}),Ce(h,D)}):E=Vr(e,()=>{at(u)("scrolling into view",{}),Ce(h,D),E=null})}),{autoscrollToBottom:g,followOutput:y,scrollIntoViewOnChange:A}},tt(un,mc,dc,pc,bs,hs,Wt,Nx,Lx)),Qj=$e(([{data:e,firstItemIndex:t,gap:r,sizes:n},{initialTopMostItemIndex:s},{initialItemCount:a,listState:o},{didMount:i}])=>(ce(W(i,Te(a),fe(([,c])=>c!==0),Te(s,n,t,r,e),re(([[,c],l,u,d,f,h=[]])=>Ox(c,l,u,d,f,h))),o),{}),tt(un,pc,la,bs),{singleton:!0}),Jj=$e(([{didMount:e},{scrollTo:t},{listState:r}])=>{const n=Y(0);return je(W(e,Te(n),fe(([,s])=>s!==0),re(([,s])=>({top:s}))),s=>{Vr(W(r,oa(1),fe(a=>a.items.length>1)),()=>{requestAnimationFrame(()=>{Ce(t,s)})})}),{initialScrollTop:n}},tt(bs,Wt,la),{singleton:!0}),Rx=$e(([{scrollVelocity:e}])=>{const t=Y(!1),r=Ue(),n=Y(!1);return ce(W(e,Te(n,t,r),fe(([s,a])=>!!a),re(([s,a,o,i])=>{const{enter:c,exit:l}=a;if(o){if(l(s,i))return!1}else if(c(s,i))return!0;return o}),rt()),t),je(W(Et(t,e,r),Te(n)),([[s,a,o],i])=>{s&&i&&i.change&&i.change(a,o)}),{isSeeking:t,scrollSeekConfiguration:n,scrollSeekRangeChanged:r,scrollVelocity:e}},tt(mc),{singleton:!0}),dh=$e(([{scrollContainerState:e,scrollTo:t}])=>{const r=Ue(),n=Ue(),s=Ue(),a=Y(!1),o=Y(void 0);return ce(W(Et(r,n),re(([{scrollHeight:i,scrollTop:c,viewportHeight:l},{offsetTop:u}])=>({scrollHeight:i,scrollTop:Math.max(0,c-u),viewportHeight:l}))),e),ce(W(t,Te(n),re(([i,{offsetTop:c}])=>({...i,top:i.top+c}))),s),{customScrollParent:o,useWindowScroll:a,windowScrollContainerState:r,windowScrollTo:s,windowViewportRect:n}},tt(Wt)),eV=$e(([{sizeRanges:e,sizes:t},{headerHeight:r,scrollTop:n},{initialTopMostItemIndex:s},{didMount:a},{useWindowScroll:o,windowScrollContainerState:i,windowViewportRect:c}])=>{const l=Ue(),u=Y(void 0),d=Y(null),f=Y(null);return ce(i,d),ce(c,f),je(W(l,Te(t,n,o,d,f,r)),([h,y,g,E,v,w,A])=>{const C=Nj(y.sizeTree);E&&v!==null&&w!==null&&(g=v.scrollTop-w.offsetTop),g-=A,h({ranges:C,scrollTop:g})}),ce(W(u,fe(Z0),re(tV)),s),ce(W(a,Te(u),fe(([,h])=>h!==void 0),rt(),re(([,h])=>h.ranges)),e),{getState:l,restoreStateFrom:u}},tt(un,Wt,pc,bs,dh));function tV(e){return{align:"start",index:0,offset:e.scrollTop}}const rV=$e(([{topItemsIndexes:e}])=>{const t=Y(0);return ce(W(t,fe(r=>r>=0),re(r=>Array.from({length:r}).map((n,s)=>s))),e),{topItemCount:t}},tt(la));function Hx(e){let t=!1,r;return()=>(t||(t=!0,r=e()),r)}const nV=Hx(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),sV=$e(([{deviation:e,scrollBy:t,scrollingInProgress:r,scrollTop:n},{isAtBottom:s,isScrolling:a,lastJumpDueToItemResize:o,scrollDirection:i},{listState:c},{beforeUnshiftWith:l,gap:u,shiftWithOffset:d,sizes:f},{log:h},{recalcInProgress:y}])=>{const g=mr(W(c,Te(o),ln(([,v,w,A],[{bottom:C,items:D,offsetBottom:z,totalCount:T},m])=>{const b=C+z;let x=0;return w===T&&v.length>0&&D.length>0&&(D[0].originalIndex===0&&v[0].originalIndex===0||(x=b-A,x!==0&&(x+=m))),[x,D,T,b]},[0,[],0,0]),fe(([v])=>v!==0),Te(n,i,r,s,h,y),fe(([,v,w,A,,,C])=>!C&&!A&&v!==0&&w===fc),re(([[v],,,,,w])=>(w("Upward scrolling compensation",{amount:v},nr.DEBUG),v))));function E(v){v>0?(Ce(t,{behavior:"auto",top:-v}),Ce(e,0)):(Ce(e,0),Ce(t,{behavior:"auto",top:-v}))}return je(W(g,Te(e,a)),([v,w,A])=>{A&&nV()?Ce(e,w-v):E(-v)}),je(W(Et(Rt(a,!1),e,y),fe(([v,w,A])=>!v&&!A&&w!==0),re(([v,w])=>w),Hn(1)),E),ce(W(d,re(v=>({top:-v}))),t),je(W(l,Te(f,u),re(([v,{groupIndices:w,lastSize:A,sizeTree:C},D])=>{function z(T){return T*(A+D)}if(w.length===0)return z(v);{let T=0;const m=cc(C,0);let b=0,x=0;for(;b<v;){b++,T+=m;let S=w.length===x+1?1/0:w[x+1]-w[x]-1;b+S>v&&(T-=m,S=v-b+1),b+=S,T+=z(S),x++}return T}})),v=>{Ce(e,v),requestAnimationFrame(()=>{Ce(t,{top:v}),requestAnimationFrame(()=>{Ce(e,0),Ce(y,!1)})})}),{deviation:e}},tt(Wt,mc,la,un,hs,sh)),aV=$e(([e,t,r,n,s,a,o,i,c,l,u])=>({...e,...t,...r,...n,...s,...a,...o,...i,...c,...l,...u}),tt(lh,Qj,bs,Rx,Mx,Jj,Kj,dh,Lx,hs,Nx)),$x=$e(([{data:e,defaultItemSize:t,firstItemIndex:r,fixedItemSize:n,fixedGroupSize:s,gap:a,groupIndices:o,heightEstimates:i,itemSize:c,sizeRanges:l,sizes:u,statefulTotalCount:d,totalCount:f,trackItemSizes:h},{initialItemFinalLocationReached:y,initialTopMostItemIndex:g,scrolledToInitialItem:E},v,w,A,C,{scrollToIndex:D},z,{topItemCount:T},{groupCounts:m},b])=>{const{listState:x,minOverscanItemCount:S,topItemsIndexes:I,rangeChanged:F,..._}=C;return ce(F,b.scrollSeekRangeChanged),ce(W(b.windowViewportRect,re(k=>k.visibleHeight)),v.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:r,fixedItemHeight:n,fixedGroupHeight:s,gap:a,groupCounts:m,heightEstimates:i,initialItemFinalLocationReached:y,initialTopMostItemIndex:g,scrolledToInitialItem:E,sizeRanges:l,topItemCount:T,topItemsIndexes:I,totalCount:f,...A,groupIndices:o,itemSize:c,listState:x,minOverscanItemCount:S,scrollToIndex:D,statefulTotalCount:d,trackItemSizes:h,rangeChanged:F,..._,...b,...v,sizes:u,...w}},tt(un,pc,Wt,eV,Xj,la,dc,sV,rV,Sx,aV));function oV(e,t){const r={},n={};let s=0;const a=e.length;for(;s<a;)n[e[s]]=1,s+=1;for(const o in t)Object.hasOwn(n,o)||(r[o]=t[o]);return r}const Hu=typeof document<"u"?M.useLayoutEffect:M.useEffect;function Gx(e,t,r){const n=Object.keys(t.required||{}),s=Object.keys(t.optional||{}),a=Object.keys(t.methods||{}),o=Object.keys(t.events||{}),i=M.createContext({});function c(E,v){E.propsReady&&Ce(E.propsReady,!1);for(const w of n){const A=E[t.required[w]];Ce(A,v[w])}for(const w of s)if(w in v){const A=E[t.optional[w]];Ce(A,v[w])}E.propsReady&&Ce(E.propsReady,!0)}function l(E){return a.reduce((v,w)=>(v[w]=A=>{const C=E[t.methods[w]];Ce(C,A)},v),{})}function u(E){return o.reduce((v,w)=>(v[w]=Ej(E[t.events[w]]),v),{})}const d=M.forwardRef((E,v)=>{const{children:w,...A}=E,[C]=M.useState(()=>Mu(Cj(e),T=>{c(T,A)})),[D]=M.useState(dx(u,C));Hu(()=>{for(const T of o)T in A&&je(D[T],A[T]);return()=>{Object.values(D).map(X0)}},[A,D,C]),Hu(()=>{c(C,A)}),M.useImperativeHandle(v,lx(l(C)));const z=r;return B.jsx(i.Provider,{value:C,children:r?B.jsx(z,{...oV([...n,...s,...o],A),children:w}):w})}),f=E=>{const v=M.useContext(i);return M.useCallback(w=>{Ce(v[E],w)},[v,E])},h=E=>{const v=M.useContext(i)[E],w=M.useCallback(A=>je(v,A),[v]);return M.useSyncExternalStore(w,()=>at(v),()=>at(v))},y=E=>{const v=M.useContext(i)[E],[w,A]=M.useState(dx(at,v));return Hu(()=>je(v,C=>{C!==w&&A(lx(C))}),[v,w]),w},g=M.version.startsWith("18")?h:y;return{Component:d,useEmitter:(E,v)=>{const w=M.useContext(i)[E];Hu(()=>je(w,v),[v,w])},useEmitterValue:g,usePublisher:f}}const jx=M.createContext(void 0),Vx=M.createContext(void 0),Wx=typeof document<"u"?M.useLayoutEffect:M.useEffect;function ph(e){return"self"in e}function iV(e){return"body"in e}function qx(e,t,r,n=bo,s,a){const o=M.useRef(null),i=M.useRef(null),c=M.useRef(null),l=M.useCallback(f=>{let h,y,g;const E=f.target;if(iV(E)||ph(E)){const w=ph(E)?E:E.defaultView;g=a?w.scrollX:w.scrollY,h=a?w.document.documentElement.scrollWidth:w.document.documentElement.scrollHeight,y=a?w.innerWidth:w.innerHeight}else g=a?E.scrollLeft:E.scrollTop,h=a?E.scrollWidth:E.scrollHeight,y=a?E.offsetWidth:E.offsetHeight;const v=()=>{e({scrollHeight:h,scrollTop:Math.max(g,0),viewportHeight:y})};f.suppressFlushSync?v():As.flushSync(v),i.current!==null&&(g===i.current||g<=0||g===h-y)&&(i.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))},[e,t,a]);M.useEffect(()=>{const f=s||o.current;return n(s||o.current),l({suppressFlushSync:!0,target:f}),f.addEventListener("scroll",l,{passive:!0}),()=>{n(null),f.removeEventListener("scroll",l)}},[o,l,r,n,s]);function u(f){const h=o.current;if(!h||(a?"offsetWidth"in h&&h.offsetWidth===0:"offsetHeight"in h&&h.offsetHeight===0))return;const y=f.behavior==="smooth";let g,E,v;ph(h)?(E=Math.max(ms(h.document.documentElement,a?"width":"height"),a?h.document.documentElement.scrollWidth:h.document.documentElement.scrollHeight),g=a?h.innerWidth:h.innerHeight,v=a?window.scrollX:window.scrollY):(E=h[a?"scrollWidth":"scrollHeight"],g=ms(h,a?"width":"height"),v=h[a?"scrollLeft":"scrollTop"]);const w=E-g;if(f.top=Math.ceil(Math.max(Math.min(w,f.top),0)),Ix(g,E)||f.top===v){e({scrollHeight:E,scrollTop:v,viewportHeight:g}),y&&t(!0);return}y?(i.current=f.top,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,i.current=null,t(!0)},1e3)):i.current=null,a&&(f={behavior:f.behavior,left:f.top}),h.scrollTo(f)}function d(f){a&&(f={behavior:f.behavior,left:f.top}),o.current.scrollBy(f)}return{scrollByCallback:d,scrollerRef:o,scrollToCallback:u}}const fh="-webkit-sticky",Kx="sticky",hh=Hx(()=>{if(typeof document>"u")return Kx;const e=document.createElement("div");return e.style.position=fh,e.style.position===fh?fh:Kx});function mh(e){return e}const cV=$e(()=>{const e=Y(i=>`Item ${i}`),t=Y(i=>`Group ${i}`),r=Y({}),n=Y(mh),s=Y("div"),a=Y(bo),o=(i,c=null)=>Rt(W(r,re(l=>l[i]),rt()),c);return{components:r,computeItemKey:n,EmptyPlaceholder:o("EmptyPlaceholder"),FooterComponent:o("Footer"),GroupComponent:o("Group","div"),groupContent:t,HeaderComponent:o("Header"),HeaderFooterTag:s,ItemComponent:o("Item","div"),itemContent:e,ListComponent:o("List","div"),ScrollerComponent:o("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:o("ScrollSeekPlaceholder"),TopItemListComponent:o("TopItemList")}}),lV=$e(([e,t])=>({...e,...t}),tt($x,cV)),uV=({height:e})=>B.jsx("div",{style:{height:e}}),dV={overflowAnchor:"none",position:hh(),zIndex:1},Yx={overflowAnchor:"none"},pV={...Yx,display:"inline-block",height:"100%"},Zx=M.memo(function({showTopList:e=!1}){const t=ge("listState"),r=Sr("sizeRanges"),n=ge("useWindowScroll"),s=ge("customScrollParent"),a=Sr("windowScrollContainerState"),o=Sr("scrollContainerState"),i=s||n?a:o,c=ge("itemContent"),l=ge("context"),u=ge("groupContent"),d=ge("trackItemSizes"),f=ge("itemSize"),h=ge("log"),y=Sr("gap"),g=ge("horizontalDirection"),{callbackRef:E}=Sj(r,f,d,e?bo:i,h,y,s,g,ge("skipAnimationFrameInResizeObserver")),[v,w]=M.useState(0);bh("deviation",_=>{v!==_&&w(_)});const A=ge("EmptyPlaceholder"),C=ge("ScrollSeekPlaceholder")||uV,D=ge("ListComponent"),z=ge("ItemComponent"),T=ge("GroupComponent"),m=ge("computeItemKey"),b=ge("isSeeking"),x=ge("groupIndices").length>0,S=ge("alignToBottom"),I=ge("initialItemFinalLocationReached"),F=e?{}:{boxSizing:"border-box",...g?{display:"inline-block",height:"100%",marginLeft:v!==0?v:S?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:v!==0?v:S?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...I?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&A?B.jsx(A,{...Ht(A,l)}):B.jsx(D,{...Ht(D,l),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:E,style:F,children:(e?t.topItems:t.items).map(_=>{const k=_.originalIndex,P=m(k+t.firstItemIndex,_.data,l);return b?M.createElement(C,{...Ht(C,l),height:_.size,index:_.index,key:P,type:_.type||"item",..._.type==="group"?{}:{groupIndex:_.groupIndex}}):_.type==="group"?M.createElement(T,{...Ht(T,l),"data-index":k,"data-item-index":_.index,"data-known-size":_.size,key:P,style:dV},u(_.index,l)):M.createElement(z,{...Ht(z,l),...bV(z,_.data),"data-index":k,"data-item-group-index":_.groupIndex,"data-item-index":_.index,"data-known-size":_.size,key:P,style:g?pV:Yx},x?c(_.index,_.groupIndex,_.data,l):c(_.index,_.data,l))})})}),fV={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},hV={outline:"none",overflowX:"auto",position:"relative"},$u=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),mV={position:hh(),top:0,width:"100%",zIndex:1};function Ht(e,t){if(typeof e!="string")return{context:t}}function bV(e,t){return{item:typeof e=="string"?void 0:t}}const yV=M.memo(function(){const e=ge("HeaderComponent"),t=Sr("headerHeight"),r=ge("HeaderFooterTag"),n=ia(M.useMemo(()=>a=>{t(ms(a,"height"))},[t]),!0,ge("skipAnimationFrameInResizeObserver")),s=ge("context");return e?B.jsx(r,{ref:n,children:B.jsx(e,{...Ht(e,s)})}):null}),gV=M.memo(function(){const e=ge("FooterComponent"),t=Sr("footerHeight"),r=ge("HeaderFooterTag"),n=ia(M.useMemo(()=>a=>{t(ms(a,"height"))},[t]),!0,ge("skipAnimationFrameInResizeObserver")),s=ge("context");return e?B.jsx(r,{ref:n,children:B.jsx(e,{...Ht(e,s)})}):null});function Xx({useEmitter:e,useEmitterValue:t,usePublisher:r}){return M.memo(function({children:n,style:s,context:a,...o}){const i=r("scrollContainerState"),c=t("ScrollerComponent"),l=r("smoothScrollTargetReached"),u=t("scrollerRef"),d=t("horizontalDirection")||!1,{scrollByCallback:f,scrollerRef:h,scrollToCallback:y}=qx(i,l,c,u,void 0,d);return e("scrollTo",y),e("scrollBy",f),B.jsx(c,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:h,style:{...d?hV:fV,...s},tabIndex:0,...o,...Ht(c,a),children:n})})}function Qx({useEmitter:e,useEmitterValue:t,usePublisher:r}){return M.memo(function({children:n,style:s,context:a,...o}){const i=r("windowScrollContainerState"),c=t("ScrollerComponent"),l=r("smoothScrollTargetReached"),u=t("totalListHeight"),d=t("deviation"),f=t("customScrollParent"),h=M.useRef(null),y=t("scrollerRef"),{scrollByCallback:g,scrollerRef:E,scrollToCallback:v}=qx(i,l,c,y,f);return Wx(()=>{var w;return E.current=f||((w=h.current)==null?void 0:w.ownerDocument.defaultView),()=>{E.current=null}},[E,f]),e("windowScrollTo",v),e("scrollBy",g),B.jsx(c,{ref:h,"data-virtuoso-scroller":!0,style:{position:"relative",...s,...u!==0?{height:u+d}:{}},...o,...Ht(c,a),children:n})})}const xV=({children:e})=>{const t=M.useContext(jx),r=Sr("viewportHeight"),n=Sr("fixedItemHeight"),s=ge("alignToBottom"),a=ge("horizontalDirection"),o=M.useMemo(()=>ux(r,c=>ms(c,a?"width":"height")),[r,a]),i=ia(o,!0,ge("skipAnimationFrameInResizeObserver"));return M.useEffect(()=>{t&&(r(t.viewportHeight),n(t.itemHeight))},[t,r,n]),B.jsx("div",{"data-viewport-type":"element",ref:i,style:$u(s),children:e})},wV=({children:e})=>{const t=M.useContext(jx),r=Sr("windowViewportRect"),n=Sr("fixedItemHeight"),s=ge("customScrollParent"),a=mx(r,s,ge("skipAnimationFrameInResizeObserver")),o=ge("alignToBottom");return M.useEffect(()=>{t&&(n(t.itemHeight),r({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,r,n]),B.jsx("div",{"data-viewport-type":"window",ref:a,style:$u(o),children:e})},vV=({children:e})=>{const t=ge("TopItemListComponent")||"div",r=ge("headerHeight"),n={...mV,marginTop:`${r}px`},s=ge("context");return B.jsx(t,{style:n,...Ht(t,s),children:e})},EV=M.memo(function(e){const t=ge("useWindowScroll"),r=ge("topItemsIndexes").length>0,n=ge("customScrollParent"),s=ge("context");return B.jsxs(n||t?TV:CV,{...e,context:s,children:[r&&B.jsx(vV,{children:B.jsx(Zx,{showTopList:!0})}),B.jsxs(n||t?wV:xV,{children:[B.jsx(yV,{}),B.jsx(Zx,{}),B.jsx(gV,{})]})]})}),{Component:kV,useEmitter:bh,useEmitterValue:ge,usePublisher:Sr}=Gx(lV,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},EV),CV=Xx({useEmitter:bh,useEmitterValue:ge,usePublisher:Sr}),TV=Qx({useEmitter:bh,useEmitterValue:ge,usePublisher:Sr}),AV=kV;tt($x,$e(()=>{const e=Y(l=>B.jsxs("td",{children:["Item $",l]})),t=Y(null),r=Y(l=>B.jsxs("td",{colSpan:1e3,children:["Group ",l]})),n=Y(null),s=Y(null),a=Y({}),o=Y(mh),i=Y(bo),c=(l,u=null)=>Rt(W(a,re(d=>d[l]),rt()),u);return{components:a,computeItemKey:o,context:t,EmptyPlaceholder:c("EmptyPlaceholder"),FillerRow:c("FillerRow"),fixedFooterContent:s,fixedHeaderContent:n,itemContent:e,groupContent:r,ScrollerComponent:c("Scroller","div"),scrollerRef:i,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder"),TableBodyComponent:c("TableBody","tbody"),TableComponent:c("Table","table"),TableFooterComponent:c("TableFoot","tfoot"),TableHeadComponent:c("TableHead","thead"),TableRowComponent:c("TableRow","tr"),GroupComponent:c("Group","tr")}})),hh();const Jx={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},SV={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:e5,floor:Gu,max:gc,min:yh,round:t5}=Math;function r5(e,t,r){return Array.from({length:t-e+1}).map((n,s)=>({data:r===null?null:r[s+e],index:s+e}))}function PV(e){return{...SV,items:e}}function ju(e,t){return e&&e.width===t.width&&e.height===t.height}function IV(e,t){return e&&e.column===t.column&&e.row===t.row}const BV=$e(([{increaseViewportBy:e,listBoundary:t,overscan:r,visibleRange:n},{footerHeight:s,headerHeight:a,scrollBy:o,scrollContainerState:i,scrollTo:c,scrollTop:l,smoothScrollTargetReached:u,viewportHeight:d},f,h,{didMount:y,propsReady:g},{customScrollParent:E,useWindowScroll:v,windowScrollContainerState:w,windowScrollTo:A,windowViewportRect:C},D])=>{const z=Y(0),T=Y(0),m=Y(Jx),b=Y({height:0,width:0}),x=Y({height:0,width:0}),S=Ue(),I=Ue(),F=Y(0),_=Y(null),k=Y({column:0,row:0}),P=Ue(),O=Ue(),U=Y(!1),L=Y(0),H=Y(!0),G=Y(!1),Q=Y(!1);je(W(y,Te(L),fe(([X,we])=>!!we)),()=>{Ce(H,!1)}),je(W(Et(y,H,x,b,L,G),fe(([X,we,De,Ge,,it])=>X&&!we&&De.height!==0&&Ge.height!==0&&!it)),([,,,,X])=>{Ce(G,!0),ih(1,()=>{Ce(S,X)}),Vr(W(l),()=>{Ce(t,[0,0]),Ce(H,!0)})}),ce(W(O,fe(X=>X!=null&&X.scrollTop>0),cn(0)),T),je(W(y,Te(O),fe(([,X])=>X!=null)),([,X])=>{X&&(Ce(b,X.viewport),Ce(x,X.item),Ce(k,X.gap),X.scrollTop>0&&(Ce(U,!0),Vr(W(l,oa(1)),we=>{Ce(U,!1)}),Ce(c,{top:X.scrollTop})))}),ce(W(b,re(({height:X})=>X)),d),ce(W(Et(he(b,ju),he(x,ju),he(k,(X,we)=>X&&X.column===we.column&&X.row===we.row),he(l)),re(([X,we,De,Ge])=>({gap:De,item:we,scrollTop:Ge,viewport:X}))),P),ce(W(Et(he(z),n,he(k,IV),he(x,ju),he(b,ju),he(_),he(T),he(U),he(H),he(L)),fe(([,,,,,,,X])=>!X),re(([X,[we,De],Ge,it,Ae,ve,be,,Xe,Ke])=>{const{column:Qe,row:Br}=Ge,{height:Ot,width:kh}=it,{width:I5}=Ae;if(be===0&&(X===0||I5===0))return Jx;if(kh===0){const D5=ch(Ke,X),MW=D5+Math.max(be-1,0);return PV(r5(D5,MW,ve))}const qu=n5(I5,kh,Qe);let Fo,Ea;Xe?we===0&&De===0&&be>0?(Fo=0,Ea=be-1):(Fo=qu*Gu((we+Br)/(Ot+Br)),Ea=qu*e5((De+Br)/(Ot+Br))-1,Ea=yh(X-1,gc(Ea,qu-1)),Fo=yh(Ea,gc(0,Fo))):(Fo=0,Ea=-1);const B5=r5(Fo,Ea,ve),{bottom:F5,top:U5}=s5(Ae,Ge,it,B5),O5=e5(X/qu),_W=O5*Ot+(O5-1)*Br-F5;return{bottom:F5,itemHeight:Ot,items:B5,itemWidth:kh,offsetBottom:_W,offsetTop:U5,top:U5}})),m),ce(W(_,fe(X=>X!==null),re(X=>X.length)),z),ce(W(Et(b,x,m,k),fe(([X,we,{items:De}])=>De.length>0&&we.height!==0&&X.height!==0),re(([X,we,{items:De},Ge])=>{const{bottom:it,top:Ae}=s5(X,Ge,we,De);return[Ae,it]}),rt(lc)),t);const pe=Y(!1);ce(W(l,Te(pe),re(([X,we])=>we||X!==0)),pe);const me=mr(W(Et(m,z),fe(([{items:X}])=>X.length>0),Te(pe),fe(([[X,we],De])=>{const Ge=X.items[X.items.length-1].index===we-1;return(De||X.bottom>0&&X.itemHeight>0&&X.offsetBottom===0&&X.items.length===we)&&Ge}),re(([[,X]])=>X-1),rt())),ie=mr(W(he(m),fe(({items:X})=>X.length>0&&X[0].index===0),cn(0),rt())),de=mr(W(he(m),Te(U),fe(([{items:X},we])=>X.length>0&&!we),re(([{items:X}])=>({endIndex:X[X.length-1].index,startIndex:X[0].index})),rt(Ex),Hn(0)));ce(de,h.scrollSeekRangeChanged),ce(W(S,Te(b,x,z,k),re(([X,we,De,Ge,it])=>{const Ae=Px(X),{align:ve,behavior:be,offset:Xe}=Ae;let Ke=Ae.index;Ke==="LAST"&&(Ke=Ge-1),Ke=gc(0,Ke,yh(Ge-1,Ke));let Qe=gh(we,it,De,Ke);return ve==="end"?Qe=t5(Qe-we.height+De.height):ve==="center"&&(Qe=t5(Qe-we.height/2+De.height/2)),Xe&&(Qe+=Xe),{behavior:be,top:Qe}})),c);const Be=Rt(W(m,re(X=>X.offsetBottom+X.bottom)),0);return ce(W(C,re(X=>({height:X.visibleHeight,width:X.visibleWidth}))),b),{customScrollParent:E,data:_,deviation:F,footerHeight:s,gap:k,headerHeight:a,increaseViewportBy:e,initialItemCount:T,itemDimensions:x,overscan:r,restoreStateFrom:O,scrollBy:o,scrollContainerState:i,scrollHeight:I,scrollTo:c,scrollToIndex:S,scrollTop:l,smoothScrollTargetReached:u,totalCount:z,useWindowScroll:v,viewportDimensions:b,windowScrollContainerState:w,windowScrollTo:A,windowViewportRect:C,...h,gridState:m,horizontalDirection:Q,initialTopMostItemIndex:L,totalListHeight:Be,...f,endReached:me,propsReady:g,rangeChanged:de,startReached:ie,stateChanged:P,stateRestoreInProgress:U,...D}},tt(lh,Wt,mc,Rx,bs,dh,hs));function n5(e,t,r){return gc(1,Gu((e+r)/(Gu(t)+r)))}function s5(e,t,r,n){const{height:s}=r;if(s===void 0||n.length===0)return{bottom:0,top:0};const a=gh(e,t,r,n[0].index);return{bottom:gh(e,t,r,n[n.length-1].index)+s,top:a}}function gh(e,t,r,n){const s=n5(e.width,r.width,t.column),a=Gu(n/s),o=a*r.height+gc(0,a-1)*t.row;return o>0?o+t.row:o}const FV=$e(()=>{const e=Y(d=>`Item ${d}`),t=Y({}),r=Y(null),n=Y("virtuoso-grid-item"),s=Y("virtuoso-grid-list"),a=Y(mh),o=Y("div"),i=Y(bo),c=(d,f=null)=>Rt(W(t,re(h=>h[d]),rt()),f),l=Y(!1),u=Y(!1);return ce(he(u),l),{components:t,computeItemKey:a,context:r,FooterComponent:c("Footer"),HeaderComponent:c("Header"),headerFooterTag:o,itemClassName:n,ItemComponent:c("Item","div"),itemContent:e,listClassName:s,ListComponent:c("List","div"),readyStateChanged:l,reportReadyState:u,ScrollerComponent:c("Scroller","div"),scrollerRef:i,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder","div")}}),UV=$e(([e,t])=>({...e,...t}),tt(BV,FV)),OV=M.memo(function(){const e=ot("gridState"),t=ot("listClassName"),r=ot("itemClassName"),n=ot("itemContent"),s=ot("computeItemKey"),a=ot("isSeeking"),o=Pr("scrollHeight"),i=ot("ItemComponent"),c=ot("ListComponent"),l=ot("ScrollSeekPlaceholder"),u=ot("context"),d=Pr("itemDimensions"),f=Pr("gap"),h=ot("log"),y=ot("stateRestoreInProgress"),g=Pr("reportReadyState"),E=ia(M.useMemo(()=>v=>{const w=v.parentElement.parentElement.scrollHeight;o(w);const A=v.firstChild;if(A){const{height:C,width:D}=A.getBoundingClientRect();d({height:C,width:D})}f({column:o5("column-gap",getComputedStyle(v).columnGap,h),row:o5("row-gap",getComputedStyle(v).rowGap,h)})},[o,d,f,h]),!0,!1);return Wx(()=>{e.itemHeight>0&&e.itemWidth>0&&g(!0)},[e]),y?null:B.jsx(c,{className:t,ref:E,...Ht(c,u),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(v=>{const w=s(v.index,v.data,u);return a?B.jsx(l,{...Ht(l,u),height:e.itemHeight,index:v.index,width:e.itemWidth},w):M.createElement(i,{...Ht(i,u),className:r,"data-index":v.index,key:w},n(v.index,v.data,u))})})}),DV=M.memo(function(){const e=ot("HeaderComponent"),t=Pr("headerHeight"),r=ot("headerFooterTag"),n=ia(M.useMemo(()=>a=>{t(ms(a,"height"))},[t]),!0,!1),s=ot("context");return e?B.jsx(r,{ref:n,children:B.jsx(e,{...Ht(e,s)})}):null}),_V=M.memo(function(){const e=ot("FooterComponent"),t=Pr("footerHeight"),r=ot("headerFooterTag"),n=ia(M.useMemo(()=>a=>{t(ms(a,"height"))},[t]),!0,!1),s=ot("context");return e?B.jsx(r,{ref:n,children:B.jsx(e,{...Ht(e,s)})}):null}),MV=({children:e})=>{const t=M.useContext(Vx),r=Pr("itemDimensions"),n=Pr("viewportDimensions"),s=ia(M.useMemo(()=>a=>{n(a.getBoundingClientRect())},[n]),!0,!1);return M.useEffect(()=>{t&&(n({height:t.viewportHeight,width:t.viewportWidth}),r({height:t.itemHeight,width:t.itemWidth}))},[t,n,r]),B.jsx("div",{ref:s,style:$u(!1),children:e})},NV=({children:e})=>{const t=M.useContext(Vx),r=Pr("windowViewportRect"),n=Pr("itemDimensions"),s=ot("customScrollParent"),a=mx(r,s,!1);return M.useEffect(()=>{t&&(n({height:t.itemHeight,width:t.itemWidth}),r({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,r,n]),B.jsx("div",{ref:a,style:$u(!1),children:e})},LV=M.memo(function({...e}){const t=ot("useWindowScroll"),r=ot("customScrollParent"),n=r||t?RV:zV,s=r||t?NV:MV,a=ot("context");return B.jsx(n,{...e,...Ht(n,a),children:B.jsxs(s,{children:[B.jsx(DV,{}),B.jsx(OV,{}),B.jsx(_V,{})]})})}),{useEmitter:a5,useEmitterValue:ot,usePublisher:Pr}=Gx(UV,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},LV),zV=Xx({useEmitter:a5,useEmitterValue:ot,usePublisher:Pr}),RV=Qx({useEmitter:a5,useEmitterValue:ot,usePublisher:Pr});function o5(e,t,r){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&r(`${e} was not resolved to pixel value correctly`,t,nr.WARN),t==="normal"?0:parseInt(t??"0",10)}var xh={},i5;function HV(){if(i5)return xh;i5=1;var e=lu.GenIcon;return xh.AiFillQuestionCircle=function(r){return e({tag:"svg",attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 708c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zm62.9-219.5a48.3 48.3 0 0 0-30.9 44.8V620c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8v-21.5c0-23.1 6.7-45.9 19.9-64.9 12.9-18.6 30.9-32.8 52.1-40.9 34-13.1 56-41.6 56-72.7 0-44.1-43.1-80-96-80s-96 35.9-96 80v7.6c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V420c0-39.3 17.2-76 48.4-103.3C430.4 290.4 470 276 512 276s81.6 14.5 111.6 40.7C654.8 344 672 380.7 672 420c0 57.8-38.1 109.8-97.1 132.5z"}}]})(r)},xh}var $V=HV();function GV({logo:e,className:t="",style:r={},alt:n="Token logo"}){const[s,a]=M.useState(!1);return M.useEffect(()=>{a(!1)},[e]),e&&!s?B.jsx("img",{alt:n,style:r,onError:()=>a(!0),className:`twap-token-logo ${t}`,src:e}):B.jsx($V.AiFillQuestionCircle,{style:{width:20,height:20},className:"twap-token-svg"})}const jV=()=>B.jsx("div",{className:"twap-orders__loader",children:B.jsx("p",{children:"Loading..."})}),VV=()=>{const{isLoading:e}=Ou(),t=nx(),r=te(a=>a.state.orderIdsToCancel),n=te(a=>a.state.cancelOrdersMode),s=sx();return B.jsx(B.Fragment,{children:e?B.jsx(jV,{}):t!=null&&t.length?B.jsx("div",{className:`twap-orders__list ${n?"twap-orders__list-select-mode":""}`,children:B.jsx(AV,{style:{height:"100%"},data:t,itemContent:(a,o)=>B.jsx(WV,{cancelOrdersMode:!!n,selected:(r==null?void 0:r.includes(o.id))||!1,selectOrder:s,order:o},a)})}):B.jsx(qV,{})})},WV=({order:e,selectOrder:t,selected:r,cancelOrdersMode:n})=>{const s=te(i=>i.updateState),a=xt.useCallback(()=>{s({selectedOrderID:e==null?void 0:e.id})},[s,e==null?void 0:e.id]),o=xt.useCallback(()=>{n?t(e==null?void 0:e.id):a()},[n,t,a,e==null?void 0:e.id]);return B.jsx("div",{className:`twap-orders__list-item twap-orders__list-item-${e.status} ${n?"twap-orders__list-item-select-mode":""} ${r?"twap-orders__list-item-selected":""}`,onClick:o,children:B.jsxs("div",{className:"twap-orders__list-item-content",children:[B.jsx(KV,{order:e}),B.jsx(YV,{value:e.progress||0}),B.jsxs("div",{className:"twap-orders__list-item-tokens",children:[B.jsx(c5,{address:e.srcTokenAddress}),B.jsx(bj.HiArrowRight,{className:"twap-orders__list-item-tokens-arrow"}),B.jsx(c5,{address:e.dstTokenAddress})]})]})})},qV=()=>{const e=te(n=>n.state.orderHistoryStatusFilter),t=Me(),r=xt.useMemo(()=>e||"",[e]);return B.jsx("div",{className:"twap-orders__list-empty",children:B.jsx("p",{children:t("noOrders",{status:r})})})},KV=({order:e})=>{const t=e&&e.status,r=tx(e),n=V0(e.createdAt);return B.jsxs("div",{className:"twap-orders__list-item-header",children:[B.jsxs("p",{className:"twap-orders__list-item-header-title",children:[r," ",B.jsx("span",{children:`(${n})`})]}),B.jsx("p",{className:"twap-orders__list-item-header-status",children:t})]})},c5=e=>{const{useToken:t,components:r}=oe(),n=t==null?void 0:t(e.address);return B.jsx("div",{className:"twap-orders__list-item-token",children:n?B.jsxs(B.Fragment,{children:[B.jsx("div",{className:"twap-orders__list-item-token-logo",children:r.TokenLogo?B.jsx(r.TokenLogo,{token:n}):B.jsx(GV,{logo:n==null?void 0:n.logoUrl})}),B.jsx("p",{className:"twap-orders__list-item-token-symbol",children:n==null?void 0:n.symbol})]}):B.jsx("div",{})})};function YV(e){return B.jsxs("div",{className:"twap-orders__list-item-progress",children:[B.jsx("div",{className:"twap-orders__list-item-progress-bar",children:B.jsx("div",{className:"twap-orders__list-item-progress-bar-filled",style:{width:`${e.value}%`}})}),B.jsx("div",{className:"twap-orders__list-item-token-progress-label",children:B.jsx("p",{children:`${Math.round(e.value)}%`})})]})}const ZV=()=>{const e=te(r=>r.state.selectedOrderID),t=e!==void 0;return B.jsx("div",{className:`twap-orders ${e!==void 0?"twap-orders__show-selected":""}`,children:t?B.jsx(YG,{}):B.jsx(VV,{})})},XV=e=>{const t=Me(),{marketPrice:r,typedInputAmount:n}=oe();return M.useMemo(()=>{const{isError:a,value:o}=wm(e);if(!(!a||j(n||"0").isZero()||!r))return{type:Gt.MIN_FILL_DELAY,value:o,message:t("minFillDelayError",{fillDelay:`${Mf(o)} ${t("minutes")}`})}},[e,t,n,r])},ua=()=>{const{callbacks:e}=oe(),t=te(a=>a.state.typedFillDelay),r=te(a=>a.updateState),n=M.useMemo(()=>t||Fc,[t]),s=XV(n);return{fillDelay:n,onChange:M.useCallback(a=>{var o;r({typedFillDelay:a}),(o=e==null?void 0:e.onFillDelayChange)==null||o.call(e,a)},[r,e]),error:s,milliseconds:n.unit*n.value}},QV=()=>{const{onChange:e,fillDelay:t,error:r}=ua(),n=Me(),s=M.useCallback(o=>e({unit:t.unit,value:Number(o)}),[e,t]),a=M.useCallback(o=>e({unit:o,value:t.value}),[e,t]);return{onInputChange:s,onUnitSelect:a,onChange:e,milliseconds:t.unit*t.value,fillDelay:t,error:r,label:n("tradeIntervalTitle"),tooltip:n("tradeIntervalTooltip")}},dn=()=>{const{srcToken:e,typedInputAmount:t}=oe(),r=Me(),s=te(a=>a.state.acceptedSrcAmount)||t;return{amountWei:Y2(e==null?void 0:e.decimals,s),amountUI:s,error:j(s||0).isZero()?r("enterAmount"):void 0}},JV=(e,t)=>{const{module:r,srcUsd1Token:n,marketPrice:s,minChunkSizeUsd:a,typedInputAmount:o}=oe(),i=Me();return M.useMemo(()=>{if(j(o||"0").isZero()||!s||j(n||"0").isZero())return;if(!e)return{type:Gt.MIN_CHUNKS,value:1,message:i("minChunksError",{minChunks:"1"})};const{isError:c}=Em(e,t,r);if(c)return{type:Gt.MAX_CHUNKS,value:t,message:i("maxChunksError",{maxChunks:`${t}`})};const{isError:l,value:u}=vm(o||"",n||"",a||0);if(l)return{type:Gt.MIN_TRADE_SIZE,value:u,message:i("minTradeSizeError",{minTradeSize:`${u}`})}},[e,t,r,o,n,a,i,s])},qr=()=>{const{srcToken:e,srcUsd1Token:t,module:r,minChunkSizeUsd:n}=oe(),s=te(g=>g.state.typedChunks),a=ua().fillDelay,o=te(g=>g.updateState),{amountWei:i,amountUI:c}=dn(),l=M.useMemo(()=>um(a,c||"",t||"",n||0),[c,t,n,a]),u=M.useMemo(()=>lm(l,r,s),[l,s,r]),d=M.useCallback(g=>o({typedChunks:g}),[o]),f=M.useMemo(()=>fm(i||"",u),[i,u]),h=Rn(e==null?void 0:e.decimals,f),y=M.useMemo(()=>t?j(h||"0").times(t||0).toString():"0",[h,t]);return{totalTrades:u,maxTrades:l,amountPerTradeUI:h,amountPerTradeWei:f,amountPerTradeUsd:y,onChange:d,error:JV(u,l)}},eW=()=>{const{srcToken:e,dstToken:t}=oe(),r=Me(),{onChange:n,totalTrades:s,amountPerTradeUsd:a,amountPerTradeUI:o,error:i,maxTrades:c,amountPerTradeWei:l}=qr(),u=Ze({value:o}),d=Ze({value:a});return{error:i,maxTrades:c,totalTrades:s,amountPerTrade:u,amountPerTradeWei:l,onChange:n,label:r("tradesAmountTitle"),tooltip:r("totalTradesTooltip"),amountPerTradeUsd:d,fromToken:e,toToken:t}},tW=e=>{const{module:t,marketPrice:r}=oe(),n=Me();return M.useMemo(()=>{const s=gm(t,e),a=xm(e);if(r){if(s.isError)return{type:Gt.MAX_ORDER_DURATION,value:s.value,message:n("maxDurationError",{duration:`${Math.floor(n6(s.value)).toFixed(0)} ${n("days")}`})};if(a.isError)return{type:Gt.MIN_ORDER_DURATION,value:a.value,message:n("minDurationError",{duration:`${Math.floor(Mf(a.value)).toFixed(0)} ${n("minutes")}`})}}},[e,n,t,r])},wh=()=>{const{module:e,callbacks:t}=oe(),r=te(c=>c.state.typedDuration),n=te(c=>c.updateState),s=qr().totalTrades,a=ua().fillDelay,o=M.useMemo(()=>cm(e,s,a,r),[s,a,r,e]),i=tW(o);return{duration:o,setDuration:M.useCallback(c=>{var l;n({typedDuration:c}),(l=t==null?void 0:t.onDurationChange)==null||l.call(t,c)},[n,t]),error:i}},rW=()=>{const{module:e}=oe(),t=Me(),{duration:r,setDuration:n,error:s}=wh(),a=M.useCallback(c=>{n({unit:r.unit,value:Number(c)})},[n,r]),o=M.useCallback(c=>{n({unit:c,value:r.value})},[n,r]),i=M.useMemo(()=>e===ye.STOP_LOSS?t("stopLossDurationTooltip"):t("maxDurationTooltip"),[t,e]);return{duration:r,onChange:n,milliseconds:r.unit*r.value,onInputChange:a,onUnitSelect:o,label:t("expiry"),tooltip:i,error:s}},nW=()=>{const e=te(a=>a.state.isMarketOrder),{module:t}=oe(),r=Me(),n=M.useMemo(()=>{if(e&&t===ye.STOP_LOSS)return{text:r("triggerMarketPriceDisclaimer"),url:id}},[e,r,t]),s=M.useMemo(()=>{if(!(t!==ye.LIMIT&&t!==ye.TWAP))return{text:r(e?"marketOrderWarning":"limitPriceMessage"),url:"https://www.orbs.com/dtwap-and-dlimit-faq/"}},[e,r,t]);return n||s},Vu=()=>{const{srcToken:e,dstToken:t,marketPriceLoading:r}=oe(),n=te(l=>l.updateState),s=te(l=>l.state.isInvertedTrade),a=te(l=>l.state.typedTriggerPrice),o=te(l=>l.state.typedLimitPrice),i=te(l=>l.state.isMarketOrder);return{onInvert:M.useCallback(()=>{a!==void 0&&n({typedTriggerPrice:j(1).div(a).toFixed()}),o!==void 0&&n({typedLimitPrice:j(1).div(o).toFixed()}),n({isInvertedTrade:!s})},[n,s,a,o,r]),isInverted:s,fromToken:s?t:e,toToken:s?e:t,isMarketPrice:i}},l5=({typedValue:e,tokenDecimals:t=18,initialPrice:r="0",percentage:n,setValue:s,setPercentage:a})=>{const{srcUsd1Token:o,dstUsd1Token:i}=oe(),{isInverted:c}=Vu(),l=M.useMemo(()=>j((()=>{if(e!==void 0){const E=c?j(e).isZero()?j(0):j(1).div(e):j(e);return Bl(E.toFixed(),t)}if(n!==void 0&&j(r||"0").gt(0)&&!j(r||"0").isNaN()){const E=j(r||"0"),v=j(n||0).div(100);return E.plus(E.multipliedBy(v)).decimalPlaces(0).toFixed()}return j(r).gt(0)?r:""})()).decimalPlaces(0).toFixed(),[e,n,t,r,c]),u=M.useCallback(g=>{s(g),a(null)},[s,a]),d=M.useCallback(g=>{s(void 0),a(g)},[s,a]),f=M.useMemo(()=>{if(!r||j(r).isZero())return"";if(n!=null)return n;if(l){const g=j(r),v=j(l).minus(g).div(g).multipliedBy(100).decimalPlaces(2).toString();return j(v||"0").isZero()?"":v}return""},[l,r,n]),h=M.useMemo(()=>{let g="";if(e!==void 0)g=e;else{const E=Ii(l,t);if(j(E||"0").isZero())return"";g=c?j(1).div(E).toFixed():E}return g},[e,t,l,c]),y=aa(c?o:i,h||"0");return{amountWei:j(l).isNaN()?"":l,amountUI:j(h).isNaN()?"":h,selectedPercentage:f,onChange:u,onPercentageChange:d,isInverted:c,usd:j(y).isNaN()?"":y,isTypedValue:e!==void 0}},sW=()=>{const{module:e}=oe();return M.useMemo(()=>e===ye.STOP_LOSS?Jh:em,[e])},vh=()=>{const{module:e}=oe(),t=te(r=>r.state.isMarketOrder);return M.useMemo(()=>e!==ye.STOP_LOSS&&e!==ye.TAKE_PROFIT||t?void 0:e===ye.STOP_LOSS?tm:rm,[e,t])},aW=(e="")=>{const{module:t,marketPrice:r,typedInputAmount:n}=oe(),s=Me();return M.useMemo(()=>{if(j(n||"0").isZero()||!r||t!==ye.STOP_LOSS&&t!==ye.TAKE_PROFIT)return;const a=hm(r||"",e||"",t);if(a!=null&&a.isError)return{type:Gt.STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE,value:a.value,message:s("StopLossTriggerPriceError")||""};const o=mm(r||"",e||"",t);if(o!=null&&o.isError)return{type:Gt.TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE,value:o.value,message:s("TakeProfitTriggerPriceError")||""};if(!e||j(e||0).isZero())return{type:Gt.EMPTY_TRIGGER_PRICE,value:e,message:s("emptyTriggerPrice")||""}},[r,e,t,s,n])},oW=e=>{const{srcToken:t,dstToken:r,module:n,dstUsd1Token:s}=oe(),a=qr().amountPerTradeWei,o=te(l=>l.state.isMarketOrder),i=M.useMemo(()=>im(n,a,e,(t==null?void 0:t.decimals)||0),[e,a,o,t==null?void 0:t.decimals,n]),c=Rn((r==null?void 0:r.decimals)||0,i);return{amountWei:i,amountUI:c,usd:aa(c,s)}},da=()=>{const{dstToken:e,marketPrice:t,module:r,callbacks:n}=oe(),s=te(y=>y.updateState),a=sW(),o=te(y=>y.state.triggerPricePercent),i=o===void 0?a:o,c=r===ye.STOP_LOSS||r===ye.TAKE_PROFIT,l=l5({typedValue:te(y=>y.state.typedTriggerPrice),percentage:i,tokenDecimals:(e==null?void 0:e.decimals)||18,initialPrice:c?t:void 0,setValue:M.useCallback(y=>{var g;s({typedTriggerPrice:y}),(g=n==null?void 0:n.onTriggerPriceChange)==null||g.call(n,y||"")},[s,n]),setPercentage:M.useCallback(y=>{var g;s({triggerPricePercent:y}),(g=n==null?void 0:n.onTriggerPricePercentChange)==null||g.call(n,y||"")},[s,n])}),u=aW(l.amountWei),{amountWei:d,amountUI:f,usd:h}=oW(l.amountWei);return M.useMemo(()=>({...l,error:u,pricePerChunkWei:d,pricePerChunkUI:f,pricePerChunkUsd:h}),[l,u,d,f,h])},iW=()=>{const{module:e,marketPrice:t,marketPriceLoading:r}=oe(),n=Me(),{amountUI:s,onChange:a,onPercentageChange:o,usd:i,selectedPercentage:c,error:l,pricePerChunkUI:u,pricePerChunkUsd:d,isTypedValue:f}=da(),h=te(D=>D.state.isMarketOrder),y=te(D=>D.updateState),{isInverted:g,onInvert:E,fromToken:v,toToken:w}=Vu(),A=M.useCallback(()=>{y({triggerPricePercent:void 0,typedTriggerPrice:void 0})},[y]),C=e!==ye.STOP_LOSS&&e!==ye.TAKE_PROFIT;return{price:s,amountPerChunk:u,amountPerChunkUsd:d,error:l,label:n("stopLossLabel"),tooltip:e===ye.STOP_LOSS?n("stopLossTooltip"):n("takeProfitTooltip"),onChange:a,onPercentageChange:o,percentage:c,isActive:!h,onReset:A,usd:i,fromToken:v,toToken:w,prefix:"",isLoading:r||!t,isInverted:g,hide:C,onInvert:E,totalTrades:qr().totalTrades,isTypedValue:f}},cW=e=>{const{module:t,marketPrice:r,typedInputAmount:n}=oe(),s=Me(),{amountWei:a}=da(),o=te(i=>i.state.isMarketOrder);return M.useMemo(()=>{if(j(n||"0").isZero()||!a||!r)return;const i=bm(a,e,o,t),c=ym(a,e,o,t);if(i!=null&&i.isError)return{type:Gt.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE,message:s("triggerLimitPriceError")||"",value:i.value};if(c!=null&&c.isError)return{type:Gt.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE,message:s("triggerLimitPriceError")||"",value:c.value};if(e&&j(e||0).isZero())return{type:Gt.MISSING_LIMIT_PRICE,message:s("emptyLimitPrice")||"",value:e||""}},[e,s,a,t,o,n,r])},xc=()=>{const{dstToken:e,marketPrice:t,callbacks:r}=oe(),n=te(l=>l.updateState),s=vh(),a=te(l=>l.state.limitPricePercent),o=a===void 0?s:a,i=l5({typedValue:te(l=>l.state.typedLimitPrice),percentage:o,tokenDecimals:(e==null?void 0:e.decimals)||18,initialPrice:t,setValue:M.useCallback(l=>{var u;n({typedLimitPrice:l}),(u=r==null?void 0:r.onLimitPriceChange)==null||u.call(r,l||"")},[n,r]),setPercentage:M.useCallback(l=>{var u;n({limitPricePercent:l}),(u=r==null?void 0:r.onLimitPricePercentChange)==null||u.call(r,l||"")},[n,r])}),c=cW(i.amountWei);return M.useMemo(()=>({...i,error:c}),[i,c])},lW=()=>{const{module:e}=oe(),t=te(i=>i.updateState),r=te(i=>i.state.isMarketOrder),n=vh(),s=te(i=>i.state.triggerPricePercent)||0,a=e===ye.LIMIT,o=M.useCallback(()=>{!r&&e===ye.STOP_LOSS&&t({limitPricePercent:n}),t({isMarketOrder:!r})},[t,s,e,r,n]);return{isLimitPrice:!r,toggleLimitPrice:o,hide:a}},u5=()=>{const{module:e,marketPrice:t}=oe(),r=xc().amountWei,n=da().amountWei,s=te(a=>a.state.isMarketOrder);return e===ye.LIMIT||!s?r||"":e===ye.STOP_LOSS||e===ye.TAKE_PROFIT?n||"":t||""},wc=()=>{const{srcToken:e,dstToken:t,dstUsd1Token:r}=oe(),n=u5(),s=dn().amountWei,a=M.useMemo(()=>am(s||"",n,(e==null?void 0:e.decimals)||0),[s,n,e==null?void 0:e.decimals]),o=Rn(t==null?void 0:t.decimals,a);return{amountWei:a,amountUI:o,usd:aa(o,r)}},Wu=()=>{const{srcToken:e,dstToken:t,dstUsd1Token:r}=oe(),n=u5(),s=qr().amountPerTradeWei,a=te(c=>c.state.isMarketOrder),o=M.useMemo(()=>om(s,n,!!a,(e==null?void 0:e.decimals)||0),[s,n,a,e==null?void 0:e.decimals]),i=Rn(t==null?void 0:t.decimals,o);return{amountWei:o,amountUI:i,usd:aa(i,r)}},uW=()=>{const{typedInputAmount:e,marketPriceLoading:t,dstToken:r}=oe(),{amountUI:n,usd:s}=wc(),o=SG()?e:n;return{value:Z2(o,7),valueWei:Y2(r==null?void 0:r.decimals,o),isLoading:t,usd:s}},dW=()=>{const{module:e,marketPriceLoading:t}=oe(),r=Me(),{amountUI:n,onChange:s,onPercentageChange:a,usd:o,selectedPercentage:i,error:c,isTypedValue:l}=xc(),{amountUI:u,usd:d}=Wu(),f=te(z=>z.updateState),h=vh(),{isLimitPrice:y,toggleLimitPrice:g}=lW(),{isInverted:E,onInvert:v,fromToken:w,toToken:A}=Vu(),C=M.useCallback(()=>{f({typedLimitPrice:void 0}),f({limitPricePercent:h})},[f,e,h]),D=M.useMemo(()=>e===ye.STOP_LOSS?r("stopLossLimitPriceTooltip"):r("limitPriceTooltip"),[r,e]);return{price:n,amountPerChunk:u,amountPerChunkUsd:d,error:c,label:r("limitPrice"),tooltip:D,onChange:s,onPercentageChange:a,onReset:C,usd:o,fromToken:w,tradesAmount:qr().totalTrades,toToken:A,percentage:i,isInverted:E,isLoading:t,isLimitPrice:y,toggleLimitPrice:g,onInvert:v,isTypedValue:l}};function d5(){const{marketPrice:e,marketPriceLoading:t,typedInputAmount:r,srcUsd1Token:n,srcBalance:s,chainId:a}=oe(),o=te(g=>g.state.swapExecution.status),i=Me(),{error:c}=da(),{error:l}=xc(),{error:u}=qr(),{error:d}=ua(),{error:f}=wh(),h=dn().amountWei,y=M.useMemo(()=>{if(s&&j(h).gt(s))return{type:Gt.INSUFFICIENT_BALANCE,message:i("insufficientFunds"),value:s||""}},[s,h,i,a]);return M.useMemo(()=>Tm({marketPrice:e,typedInputAmount:r,srcUsd1Token:n,marketPriceLoading:t,triggerPriceError:c,limitPriceError:l,tradesError:u,fillDelayError:d,durationError:f,balanceError:y}),[e,t,r,c,l,u,d,f,y,o,n])}const pW=()=>{const e=te(n=>n.state.isMarketOrder),t=te(n=>n.updateState),r=M.useCallback(()=>{t({isMarketOrder:!e})},[t,e]);return{isMarketPrice:!e,togglePrice:r}},Eh=()=>{const e=te(r=>r.state.currentTime),t=wh().duration;return M.useMemo(()=>dm(e,t),[e,t])},fW=()=>{const{srcUsd1Token:e,dstUsd1Token:t}=oe(),r=dn().amountUI,n=wc().amountUI,s=aa(r,e),a=aa(n,t);return{srcAmountUsd:s,dstAmountUsd:a}},hW=()=>{const{fees:e,dstUsd1Token:t}=oe(),{amountUI:r}=wc(),n=M.useMemo(()=>!e||!r?"":j(r).multipliedBy(e).dividedBy(100).toFixed(),[r,e]);return{amount:n,percent:e,usd:aa(n,t)}},p5=()=>{const{srcToken:e,dstToken:t,account:r,chainId:n,slippage:s,config:a,module:o}=oe(),{amountWei:i}=dn(),{amountWei:c}=xc(),{amountPerTradeWei:l,totalTrades:u}=qr(),d=Eh(),{amountWei:f}=Wu(),{pricePerChunkWei:h}=da(),{milliseconds:y}=ua();return M.useMemo(()=>{var g;return{srcToken:e,dstToken:t,limitPrice:c,deadline:d,srcAmount:i,srcAmountPerTrade:l,totalTrades:u,minDestAmountPerTrade:f,tradeInterval:y,triggerPricePerTrade:h,maker:r,rePermitData:Am({chainId:n,srcToken:Is((e==null?void 0:e.address)||"")?((g=Bs(n))==null?void 0:g.wToken.address)||"":(e==null?void 0:e.address)||"",dstToken:(t==null?void 0:t.address)||"",srcAmount:i,deadlineMillis:d,fillDelayMillis:!u||u===1?0:y,slippage:s*100,account:r,srcAmountPerTrade:l,dstMinAmountPerTrade:f,triggerAmountPerTrade:h,config:a,module:o})}},[e,t,c,d,i,l,u,f,h,r,y,s,n,a,o])},f5=()=>{const{srcToken:e,dstToken:t,account:r}=oe(),n=Me(),{amountUI:s,usd:a}=Wu(),{amountPerTradeUI:o,amountPerTradeUsd:i,totalTrades:c}=qr(),{amountUI:l,usd:u}=da(),d=Eh(),{amountUI:f,usd:h}=xc(),{amount:y,percent:g,usd:E}=hW(),{milliseconds:v}=ua(),{amountUI:w}=wc(),{srcAmountUsd:A,dstAmountUsd:C}=fW(),D=dn().amountUI,z=te(x=>x.state.isMarketOrder),T=X2({srcToken:e,dstToken:t,account:r,limitPrice:z?void 0:f,limitPriceUsd:z?void 0:h,deadline:d,tradeInterval:v,srcAmount:D,totalTrades:c,srcAmountPerTrade:o,srcAmountPerTradeUsd:i,minDestAmountPerTrade:s,minDestAmountPerTradeUsd:a,triggerPrice:l,triggerPriceUsd:u,srcUsd:A,dstUsd:C,dstAmount:w}),m=Ze({value:y}),b=Ze({value:E});return M.useMemo(()=>({...T,fees:{label:n("fees",{value:`${g}%`}),amount:m,usd:b||"",percentage:g}}),[T,m,b,g])},h5=M.createContext({}),mW=({children:e,...t})=>B.jsx(h5.Provider,{value:t,children:e}),bW=()=>M.useContext(h5),m5=()=>{var s,a;const e=Me(),{wrapTxHash:t,srcToken:r}=te(o=>o.state.swapExecution),n=(a=(s=oc())==null?void 0:s.wToken)==null?void 0:a.symbol;return t?B.jsx("p",{className:"twap-error-wrap-msg",children:e("wrapMsg",{symbol:(r==null?void 0:r.symbol)||"",wSymbol:n||""})}):null},b5=()=>{const e=Me(),t=te(n=>n.state.swapExecution.status),r=ex();return t===ht.SUCCESS?e("createOrderActionSuccess",{name:r}):e("createOrderAction",{name:r})},yW=()=>{const e=te(y=>y.state.swapExecution.srcToken),t=Me(),{step:r,wrapTxHash:n,approveTxHash:s}=te(y=>y.state.swapExecution),a=oc(),o=j0(n),i=j0(n),c=j0(s),l=te(y=>y.state.swapExecution.status),d=Is((e==null?void 0:e.address)||"")?(a==null?void 0:a.native.symbol)||"":(e==null?void 0:e.symbol)||"",f=a==null?void 0:a.wToken.symbol,h=b5();return M.useMemo(()=>r===Ds.WRAP?{title:t("wrapAction",{symbol:d}),footerLink:o,footerText:t(o?"viewOnExplorer":"proceedInWallet")}:r===Ds.APPROVE?{title:t("approveAction",{symbol:d}),footerLink:c,footerText:t(c?"viewOnExplorer":"proceedInWallet")}:{title:h,footerText:l===ht.LOADING?t("proceedInWallet"):void 0},[r,c,d,h,t,o,i,f,l])},gW=({error:e})=>B.jsxs("div",{className:"twap-error",children:[B.jsx("h2",{className:"twap-error-title",children:"Transaction failed"}),(e==null?void 0:e.code)&&B.jsxs("p",{className:"twap-error-code",children:["Error code: ",e==null?void 0:e.code]}),B.jsx(m5,{})]});function xW({error:e}){const{components:t}=oe(),r=Me(),n=te(o=>{var i;return(i=o.state.swapExecution)==null?void 0:i.wrapTxHash}),s=t.SubmitOrderErrorView,a=B.jsx(Xn.Failed,{error:B.jsx(gW,{error:e}),footerLink:id,footerText:r("viewOnExplorer")});return s?B.jsx(s,{wrapTxHash:n,error:e,children:a}):a}const wW=()=>{const{components:e}=oe(),t=te(u=>u.state.swapExecution.srcToken),r=te(u=>u.state.swapExecution.dstToken),{reviewDetails:n}=bW(),s=Me(),a=te(u=>{var d;return!!((d=u.state.swapExecution)!=null&&d.status)}),o=f5(),i=e.USD,c=e.SubmitOrderMainView,l=B.jsxs(B.Fragment,{children:[B.jsx(Xn.Main,{fromTitle:s("from"),toTitle:s("to"),inUsd:i?B.jsx(i,{value:o.srcUsd,isLoading:!1}):`$${o.srcUsd}`,outUsd:i?B.jsx(i,{value:o.dstUsd,isLoading:!1}):`$${o.dstUsd}`}),!a&&B.jsxs("div",{className:"twap-create-order-bottom",children:[B.jsx(Ee.Container,{children:B.jsxs("div",{className:"twap-create-order-details",children:[B.jsx(Ee.Deadline,{deadline:o.deadline.value,label:o.deadline.label,tooltip:o.deadline.tooltip||""}),B.jsx(Ee.Price,{srcToken:t,price:o.triggerPrice.value,dstToken:r,label:o.triggerPrice.label,tooltip:o.triggerPrice.tooltip,usd:o.triggerPrice.usd}),B.jsx(Ee.Price,{srcToken:t,price:o.limitPrice.value,dstToken:r,label:o.limitPrice.label,usd:o.limitPrice.usd,tooltip:o.limitPrice.tooltip}),B.jsx(Ee.MinDestAmount,{dstToken:r,dstMinAmountOut:o.minDestAmountPerTrade.value,label:o.minDestAmountPerTrade.label,tooltip:o.minDestAmountPerTrade.tooltip||"",usd:o.minDestAmountPerTrade.usd}),B.jsx(Ee.TradeSize,{tradeSize:o.sizePerTrade.value,trades:o.totalTrades.value,srcToken:t,label:o.sizePerTrade.label,tooltip:o.sizePerTrade.tooltip}),B.jsx(Ee.TradesAmount,{trades:o.totalTrades.value,label:o.totalTrades.label,tooltip:o.totalTrades.tooltip}),B.jsx(Ee.TradeInterval,{chunks:o.totalTrades.value,fillDelayMillis:o.tradeInterval.value,label:o.tradeInterval.label,tooltip:o.tradeInterval.tooltip}),B.jsx(Ee.Recipient,{}),o.fees.amount&&B.jsx(Ee.Fees,{fees:o.fees.amount,label:o.fees.label,usd:o.fees.usd,dstTokenSymbol:r==null?void 0:r.symbol})]})}),n]})]});return c?B.jsx(c,{children:l}):l},vW=e=>{const{status:t,stepIndex:r,totalSteps:n,parsedError:s}=te(w=>w.state.swapExecution),{components:a}=oe(),o=a.Spinner,i=a.SuccessIcon,c=a.ErrorIcon,l=a.TokenLogo,{srcToken:u,dstToken:d}=oe(),f=dn().amountUI,h=wc().amountUI,y=Ze({value:f,decimalScale:2}),g=Ze({value:h,decimalScale:2}),E=M.useMemo(()=>({symbol:u==null?void 0:u.symbol,logoUrl:u==null?void 0:u.logoUrl}),[u]),v=M.useMemo(()=>({symbol:d==null?void 0:d.symbol,logoUrl:d==null?void 0:d.logoUrl}),[d]);return B.jsx(mW,{...e,children:B.jsx(Xn,{inAmount:y,outAmount:g,swapStatus:t,totalSteps:n,currentStep:yW(),currentStepIndex:r,inToken:E,outToken:v,components:{SrcTokenLogo:l&&B.jsx(l,{token:u}),DstTokenLogo:l&&B.jsx(l,{token:d}),Failed:B.jsx(xW,{error:s}),Success:B.jsx(EW,{}),Main:B.jsx(wW,{}),Loader:o,SuccessIcon:i,FailedIcon:c}})})},EW=()=>{const e=b5(),{components:t}=oe(),r=te(a=>a.state.swapExecution.orderId),n=t.SubmitOrderSuccessView,s=B.jsxs(B.Fragment,{children:[B.jsx(Xn.Success,{title:e}),B.jsx(m5,{})]});return n?B.jsx(n,{newOrderId:r,children:s}):s},kW=()=>{const{supportedChains:e}=oe();return M.useMemo(()=>e,[e])},CW=()=>{const{config:e}=oe();return M.useMemo(()=>({spender:e.repermit}),[e])},TW=()=>{var c;const{account:e,walletClient:t,overrides:r,refetchBalances:n,callbacks:s,chainId:a}=oe(),o=(c=oc())==null?void 0:c.wToken,i=W0();return Zr({mutationFn:async({onHash:l,srcAmountWei:u})=>{var h,y;if(!e)throw new Error("missing account");if(!t)throw new Error("missing walletClient");if(!o)throw new Error("tokenAddress is not defined");let d;dt.onWrapRequest(),(h=s==null?void 0:s.onWrapRequest)==null||h.call(s),r!=null&&r.wrap?d=await r.wrap(u):d=await t.writeContract({abi:_h,functionName:"deposit",account:e,address:o.address,value:BigInt(u),chain:t.chain}),l==null||l(d);const f=await i(d);if(!f)throw new Error("failed to get transaction receipt");if(f.status==="reverted")throw new Error("failed to wrap token");return dt.onWrapSuccess(d),(y=s==null?void 0:s.onWrapSuccess)==null||y.call(s,{txHash:f.transactionHash,explorerUrl:Bi(f.transactionHash,a),amount:Ii(u,o.decimals)}),n==null||n(),f},onError:l=>{throw dt.onWrapError(l),l}})},AW=()=>{const{account:e,walletClient:t,chainId:r,callbacks:n}=oe(),s=p5().rePermitData,{refetch:a}=q0();return Zr({mutationFn:async()=>{var y,g,E,v;if(!e)throw new Error("missing account");if(!t)throw new Error("missing walletClient");if(!r)throw new Error("missing chainId");const{order:o,domain:i,types:c,primaryType:l}=s;dt.onSignOrderRequest(o),(y=n==null?void 0:n.onSignOrderRequest)==null||y.call(n),console.log({domain:i,types:c,primaryType:l,message:o,account:e}),console.log("Using domain:",i),console.log("Using types:",c),console.log("Order data to sign:",JSON.stringify(o,null,2)),console.log(`Account address: ${e}`);let u;try{u=await(t==null?void 0:t.signTypedData({domain:i,types:c,primaryType:l,message:o,account:e}))}catch(w){throw(g=n==null?void 0:n.onSignOrderError)==null||g.call(n,w),dt.onSignOrderError(w),w}dt.onSignOrderSuccess(u),(E=n==null?void 0:n.onSignOrderSuccess)==null||E.call(n,u);const d=jT(u),f={v:q(d.v||0),r:d.r,s:d.s},h=await Bm(o,f);return(v=n==null?void 0:n.onOrderCreated)==null||v.call(n,h),await a(),h}})},y5=()=>{const{account:e,publicClient:t,config:r}=oe();return Zr({mutationFn:async({tokenAddress:n,srcAmountWei:s})=>{if(!t)throw new Error("missing publicClient");if(!e)throw new Error("missing account");if(!r)throw new Error("missing config");const a=await t.readContract({address:n,abi:Cy,functionName:"allowance",args:[e,r.repermit]}).then(i=>i.toString()),o=j(a||"0").lt(j(s).toString());return{allowance:a,approvalRequired:o}}})},SW=()=>{const{account:e,walletClient:t,overrides:r,config:n,chainId:s,callbacks:a}=oe(),o=W0(),{mutateAsync:i}=y5();return Zr({onError:c=>{dt.onApproveError(c)},mutationFn:async({token:c,onHash:l,srcAmountWei:u})=>{var y,g;if(!e)throw new Error("missing account");if(!t)throw new Error("missing walletClient");if(!n)throw new Error("missing config");(y=a==null?void 0:a.onApproveRequest)==null||y.call(a),dt.onApproveRequest();let d;if(r!=null&&r.approveOrder?d=await r.approveOrder({tokenAddress:c.address,spenderAddress:n.repermit,amount:Vs}):d=await t.writeContract({abi:Cy,functionName:"approve",account:e,address:c.address,args:[n.repermit,Vs],chain:t.chain}),!d)throw new Error("failed to approve token");l(d);const f=await o(d);if(!f)throw new Error("failed to get transaction receipt");if(f.status==="reverted")throw new Error("failed to approve token");let h=!1;for(let E=0;E<3;E++){const{approvalRequired:v}=await i({tokenAddress:c.address,srcAmountWei:u});if(!v){h=!0;break}E<2&&await new Promise(w=>setTimeout(w,3e3))}if(!h)throw new Error(`Insufficient ${c.symbol} allowance to perform the swap. Please approve the token first.`);return dt.onApproveSuccess(f.transactionHash),(g=a==null?void 0:a.onApproveSuccess)==null||g.call(a,{txHash:f.transactionHash,explorerUrl:Bi(f.transactionHash,s),token:c,amount:Ii(u,c.decimals)}),f}})},PW=()=>{const{account:e,chainId:t,srcToken:r,dstToken:n,module:s,slippage:a}=oe(),o=da(),i=dn().amountWei,c=qr().amountPerTradeWei,l=Eh(),u=qr().totalTrades,d=ua().fillDelay,f=Wu().amountWei,h=te(y=>y.state.isMarketOrder);return Zr({mutationFn:async()=>{dt.onRequestOrder({account:e,chainId:t,module:s,srcToken:r,dstToken:n,fromTokenAmount:i,srcChunkAmount:c,triggerPricePerTrade:o.pricePerChunkWei,deadline:l,fillDelay:d.unit*d.value,minDstAmountOutPerTrade:f,slippage:a,isMarketOrder:h||!1,chunksAmount:u})}})};function IW(e){const t=e.message,r=t.match(/,\s*code\s*:\s*(\d+)/i);return{message:t.replace(/^error\s*:/i,"").replace(/,\s*code\s*:\s*\d+/i,"").trim()||"",code:r?Number(r[1]):0}}const BW=()=>{const{srcToken:e,dstToken:t,chainId:r,callbacks:n}=oe(),s=SW().mutateAsync,a=TW().mutateAsync,o=AW().mutateAsync,{mutateAsync:i}=y5(),c=te(d=>d.updateSwapExecution),{amountWei:l}=dn(),u=PW().mutate;return Zr({mutationFn:async()=>{var f,h;const d=Is((e==null?void 0:e.address)||" ");try{if(!e)throw new Error("missing srcToken");if(!t)throw new Error("missing dstToken");if(!r)throw new Error("missing chainId");const y=r6(e,r);c({allowanceLoading:!0,wrapTxHash:void 0,approveTxHash:void 0});const{approvalRequired:g}=await i({tokenAddress:y.address,srcAmountWei:l});let E=0,v=1;d&&v++,g&&v++,c({totalSteps:v,stepIndex:E,allowanceLoading:!1,status:ht.LOADING}),u(),d&&(c({step:Ds.WRAP}),await a({onHash:A=>c({wrapTxHash:A}),srcAmountWei:l}),E++,c({stepIndex:E})),g&&(c({step:Ds.APPROVE}),await s({token:y,onHash:A=>c({approveTxHash:A}),srcAmountWei:l}),E++,c({stepIndex:E})),c({step:Ds.CREATE});const w=await o();return c({status:ht.SUCCESS,orderId:w.id}),w}catch(y){if(_f(y))(f=n==null?void 0:n.onSubmitOrderRejected)==null||f.call(n),c({step:void 0,status:void 0,stepIndex:void 0,error:y});else{const g=IW(y);(h=n==null?void 0:n.onSubmitOrderFailed)==null||h.call(n,g),c({status:ht.FAILED,parsedError:g,error:y})}throw y}}})},FW=()=>{const{marketPrice:e,srcToken:t,dstToken:r,resetTypedInputAmount:n}=oe(),s=BW(),a=te(g=>g.updateState),{amountUI:o}=dn(),i=te(g=>g.resetState),c=te(g=>g.state.swapExecution),l=te(g=>g.updateSwapExecution),u=ex(),d=M.useCallback(()=>{(c==null?void 0:c.status)===ht.SUCCESS&&(n(),i())},[c==null?void 0:c.status,i,n]),f=M.useCallback(()=>{(c==null?void 0:c.status)!==ht.LOADING&&(a({acceptedSrcAmount:void 0,acceptedMarketPrice:void 0}),l({srcToken:t,dstToken:r,error:void 0,parsedError:void 0,status:void 0,orderId:void 0}))},[a,t,r]),h=Zr({mutationFn:async()=>(a({acceptedSrcAmount:o,acceptedMarketPrice:e}),await s.mutateAsync())}),y=M.useCallback(()=>h.mutateAsync(),[h]);return M.useMemo(()=>({reset:i,onCloseModal:d,onOpenModal:f,onSubmit:y,orderTitle:u,...c,isLoading:(c==null?void 0:c.status)===ht.LOADING,isSuccess:(c==null?void 0:c.status)===ht.SUCCESS,isFailed:(c==null?void 0:c.status)===ht.FAILED}),[i,d,y,c,u])},UW=()=>{const e=Me(),{marketPrice:t,srcToken:r,dstToken:n,marketPriceLoading:s,srcBalance:a,srcUsd1Token:o,noLiquidity:i,typedInputAmount:c}=oe(),l=s||j(o||"0").isZero()||a===void 0||j(t||"0").isZero(),u=!!(r&&n&&c&&l),d=d5(),f=M.useMemo(()=>i?e("noLiquidity"):j(c||"0").isZero()?e("enterAmount"):e("placeOrder"),[d,e,c,i]),h=!!(d||i||u||j(c||"0").isZero()||!r||!n);return M.useMemo(()=>({disabled:h,text:f,loading:u}),[h,f,u])},OW=({children:e,container:t})=>{const[r,n]=M.useState(!1),s=M.useRef(null);if(M.useLayoutEffect(()=>(n(!0),s.current=t??document.body,()=>{s.current=null}),[]),typeof document>"u"||!r)return null;const a=s.current;return a?As.createPortal(e,a):null};Pm(Iw.version);const DW={SubmitOrderPanel:vW,Orders:ZV,Portal:OW};R.CRASH_ERROR_MESSAGE=rw,R.Components=DW,R.Configs=Dt,R.DEFAULT_DURATION_OPTIONS=JL,R.DEFAULT_FILL_DELAY=Fc,R.DEFAULT_STOP_LOSS_LIMIT_PERCENTAGE=tm,R.DEFAULT_STOP_LOSS_PERCENTAGE=Jh,R.DEFAULT_TAKE_PROFIT_LIMIT_PERCENTAGE=rm,R.DEFAULT_TAKE_PROFIT_PERCENTAGE=em,R.DISCLAIMER_URL=tw,R.EIP712_TYPES=Qh,R.ERC20_ABI=H5,R.EXCLUSIVITY_OVERRIDE_BPS=Z5,R.FEES=Y5,R.IWETH_ABI=_h,R.InputErrors=Gt,R.LEGACY_EXCHANGES_MAP=Zh,R.MAX_ORDER_DURATION_MILLIS=Ca,R.MIN_CHUNKS=K5,R.MIN_FILL_DELAY_MILLIS=Ic,R.MIN_FILL_DELAY_MINUTES=Wh,R.MIN_ORDER_DURATION_MILLIS=ad,R.Module=ye,R.ORBS_LOGO=Q5,R.ORBS_LOGO_FALLBACK=J5,R.ORBS_SLTP_FAQ_URL=X5,R.ORBS_TWAP_FAQ_URL=id,R.ORBS_WEBSITE_URL=ew,R.OrderStatus=ct,R.OrderType=ze,R.PRICE_PROTECTION_SETTINGS=ez,R.Partners=Lh,R.QUERY_PARAMS=Ta,R.REPERMIT_ABI=Mh,R.REPERMIT_PRIMARY_TYPE=Xh,R.SUGGEST_CHUNK_VALUE=q5,R.SpotProvider=XL,R.Steps=Ds,R.SwapStatus=ht,R.THE_GRAPH_ORDERS_API=qh,R.TWAP_ABI=Nh,R.TimeUnit=$t,R.analytics=dt,R.buildRePermitOrderData=Am,R.buildV2Order=pd,R.copy=WT,R.ensureWrappedToken=r6,R.eqIgnoreCase=Ps,R.fillDelayText=e6,R.formatDecimals=t6,R.getAccountOrders=Dm,R.getApiEndpoint=sd,R.getChunks=lm,R.getConfig=ld,R.getDeadline=dm,R.getDestTokenAmount=am,R.getDestTokenMinAmountPerChunk=om,R.getDuration=cm,R.getErrors=Tm,R.getEstimatedDelayBetweenChunksMillis=pm,R.getExplorerUrl=Bi,R.getMaxChunksError=Em,R.getMaxFillDelayError=iw,R.getMaxOrderDurationError=gm,R.getMaxPossibleChunks=um,R.getMinChunkSizeUsd=Cm,R.getMinFillDelayError=wm,R.getMinNativeBalance=KT,R.getMinOrderDurationError=xm,R.getMinTradeSizeError=vm,R.getNetwork=Bs,R.getOrderExcecutionRate=$h,R.getOrderFillDelayMillis=td,R.getOrderLimitPriceRate=Gh,R.getOrderType=YT,R.getPartnerChains=Hh,R.getPartnerIdentifier=_t,R.getPartners=km,R.getSrcTokenChunkAmount=fm,R.getStopLossLimitPriceError=bm,R.getStopLossPriceError=hm,R.getTakeProfitLimitPriceError=ym,R.getTakeProfitPriceError=mm,R.getTriggerPricePerChunk=im,R.getTriggerPricePerTrade=jh,R.isNativeAddress=Is,R.isTxRejected=_f,R.makeElipsisAddress=Df,R.maxUint256=Bc,R.millisToDays=n6,R.millisToMinutes=Mf,R.nativeTokenAddresses=Yh,R.networks=Ft,R.parseError=qT,R.removeCommas=VT,R.setApiMode=W5,R.setUIVersion=Pm,R.shouldUnwrapOnly=Lf,R.shouldWrapOnly=Nf,R.submitOrder=Bm,R.toAmountUi=Ii,R.toAmountWei=Bl,R.useAddresses=CW,R.useDisclaimerPanel=nW,R.useDstTokenPanel=uW,R.useDurationPanel=rW,R.useFillDelayPanel=QV,R.useFormatNumber=Ze,R.useInputErrors=d5,R.useInvertTradePanel=Vu,R.useLimitPricePanel=dW,R.useOrder=p5,R.useOrderHistoryPanel=qG,R.useOrderInfo=f5,R.usePartnerChains=kW,R.useSubmitOrderButton=UW,R.useSubmitOrderPanel=FW,R.useTogglePricePanel=pW,R.useTradesPanel=eW,R.useTranslations=Me,R.useTriggerPricePanel=iW,R.zeroAddress=Kh,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
|
|
126
|
+
`),a=!1),Object.assign(Object.assign({},e),{allowNegative:a})}function CG(e){e=kG(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,s=e.onKeyDown;s===void 0&&(s=$0);var a=e.onBlur;a===void 0&&(a=$0);var o=e.thousandSeparator,i=e.decimalScale,c=e.fixedDecimalScale,l=e.prefix;l===void 0&&(l="");var u=e.defaultValue,d=e.value,f=e.valueIsNumericString,h=e.onValueChange,y=cG(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),g=Fu(e),E=g.decimalSeparator,v=g.allowedDecimalSeparators,w=function(P){return K2(P,e)},A=function(P,O){return vG(P,O,e)},C=ho(d)?u:d,D=f??wG(C,l,t);ho(d)?ho(u)||(D=D||typeof u=="number"):D=D||typeof d=="number";var z=function(P){return $2(P)?P:(typeof P=="number"&&(P=W2(P)),D&&typeof i=="number"?q2(P,i,!!c):P)},T=yG(z(d),z(u),!!D,w,A,h),m=T[0],b=m.numAsString,x=m.formattedValue,S=T[1],I=function(P){var O=P.target,U=P.key,L=O.selectionStart,H=O.selectionEnd,G=O.value;if(G===void 0&&(G=""),(U==="Backspace"||U==="Delete")&&H<l.length){P.preventDefault();return}if(L!==H){s(P);return}U==="Backspace"&&G[0]==="-"&&L===l.length+1&&r&&ac(O,1),i&&c&&(U==="Backspace"&&G[L-1]===E?(ac(O,L-1),P.preventDefault()):U==="Delete"&&G[L]===E&&P.preventDefault()),v!=null&&v.includes(U)&&G[L]===E&&ac(O,L+1);var Q=o===!0?",":o;U==="Backspace"&&G[L-1]===Q&&ac(O,L-1),U==="Delete"&&G[L]===Q&&ac(O,L+1),s(P)},F=function(P){var O=b;if(O.match(/\d/g)||(O=""),n||(O=hG(O)),c&&i&&(O=q2(O,i,c)),O!==b){var U=K2(O,e);S({formattedValue:U,value:O,floatValue:parseFloat(O)},{event:P,source:H0.event})}a(P)},_=function(P){return P===E?!0:H2(P)},k=function(P){var O=P.currentValue,U=P.lastValue,L=P.formattedValue,H=P.currentValueIndex,G=P.formattedValueIndex,Q=O[H],pe=L[G],me=mG(U,O),ie=me.to,de=function(Be){return A(Be).indexOf(".")+l.length};return d===0&&c&&i&&O[ie.start]===E&&de(O)<H&&de(L)>G?!1:H>=ie.start&&H<ie.end&&v&&v.includes(Q)&&pe===E?!0:Q===pe};return Object.assign(Object.assign({},y),{value:x,valueIsNumericString:!1,isValidInputCharacter:_,isCharacterSame:k,onValueChange:S,format:w,removeFormatting:A,getCaretBoundary:function(P){return EG(P,e)},onKeyDown:I,onBlur:F})}const Y2=(e,t)=>M.useMemo(()=>Bl(t,e),[e,t]),Rn=(e,t)=>M.useMemo(()=>Ii(t,e),[e,t]),oc=()=>{const{chainId:e}=oe();return M.useMemo(()=>Bs(e),[e])},j0=e=>{const t=oc();return M.useMemo(()=>{if(!(!e||!t))return Bi(e,t.id)},[e,t])},aa=(e,t)=>M.useMemo(()=>!e||!t||j(e||"0").isZero()||j(t||"0").isZero()?"":j(e||"0").times(t).toFixed(),[e,t]),TG=()=>{const{srcToken:e,dstToken:t,chainId:r}=oe();return M.useMemo(()=>Nf(e,t,r),[e,t,r])},AG=()=>{const{srcToken:e,dstToken:t,chainId:r}=oe();return M.useMemo(()=>Lf(e,t,r),[e,t,r])},SG=()=>{const e=TG(),t=AG();return e||t},V0=e=>{const{overrides:t}=oe();return M.useMemo(()=>t!=null&&t.dateFormat?t.dateFormat(e||0):ee(e).format("DD/MM/YYYY HH:mm"),[e,t==null?void 0:t.dateFormat])};function PG(){const{callbacks:e}=oe();return M.useCallback(async t=>{var r;try{await navigator.clipboard.writeText(t),(r=e==null?void 0:e.onCopy)==null||r.call(e)}catch(n){console.error("Copy failed:",n)}},[e==null?void 0:e.onCopy])}const Z2=(e,t)=>M.useMemo(()=>t6(e==null?void 0:e.toString(),t),[e,t]),Ze=({value:e,decimalScale:t=3,prefix:r,suffix:n})=>{var c;const s=Z2(e,t),{overrides:a}=oe(),o=a==null?void 0:a.numberFormat,i=CG({allowLeadingZeros:!0,thousandSeparator:",",displayType:"text",value:s||"",decimalScale:18,prefix:r,suffix:n});return o?o(e||""):(c=i.value)==null?void 0:c.toString()},IG={expirationTooltip:"This is the date and time marking the end of the period which you have selected for your order to be executed.",tradeSizeTooltip:"The number of input tokens that will be removed from your balance and swapped for the output token in each individual trade.",totalTradesTooltip:"The total number of individual trades that will be scheduled as part of your order. Note that in limit orders, not all trades that are scheduled will be executed.",minDstAmountTooltip:" This is the minimum number of tokens that may be received. NOTE: This minimum only refers to executed trades. Some trades may not be executed if the limit price is higher than the available market prices and your order may only be partially filled.",limitPriceTooltip:"Trades will only execute if the available market price is better than the limit price, potentially resulting in partial fills or orders remaining unfilled upon expiration.",maxDurationTooltip:"This is the time period during which the order will be active. Please note that orders may be completed earlier than this time, partially filled, or remain unfilled based on the specified parameters.",tradeIntervalTooltip:"The estimated time that will elapse between each trade in your order. Note that as this time includes an allowance of two minutes for bidder auction and block settlement, which cannot be predicted exactly, actual time may vary.",triggerPriceTooltip:"The price at which the order will be executed. If the market price is higher than the trigger price, the order will be executed at the market price.",placeOrder:"Place order",enterAmount:"Enter an amount",emptyLimitPrice:"Limit price is required",insufficientFunds:"Insufficient Balance",tradeIntervalLabel:"Trade interval",expirationLabel:"Expiration",limitPrice:"Limit Price",finalExcecutionPrice:"Final execution price",marketPrice:"Market price",from:"From",to:"To (estimated)",Open:"Open",Completed:"Completed",Expired:"Expired",Canceled:"Canceled",cancelOrder:"Cancel Order",minReceivedPerTrade:"Min. received per trade",triggerPricePerChunk:"Trigger Price per trade",maxChunksError:"Max. trades amount is {maxChunks}",minChunksError:"Min. trades amount is {minChunks}",minTradeSizeError:"Min. trade size is ${minTradeSize}",allOrders:"All",minFillDelayError:"Min. trade interval is {fillDelay}",maxFillDelayError:"Max. trade interval is {fillDelay}",recipient:"Recipient",marketOrderWarning:"Each individual trade in this order will be filled at the current market price at the time of execution.",limitPriceMessage:"Limit orders may not execute when the token's price is equal or close to the limit price, due to gas and standard swap fees.",limit:"Limit",maxDurationError:"Max. expiry is {duration}",minDurationError:"Min. expiry is {duration}",expiry:"Expiry",individualTradeSize:"Individual trade size",numberOfTrades:"No. of trades",averageExecutionPrice:"Avg. execution price",twapMarket:"TWAP-market",twapLimit:"TWAP-limit",stopLoss:"Stop-loss",stopLossMarket:"Stop-loss market",stopLossLimit:"Stop-loss limit",takeProfit:"Take-profit",minReceived:"Min. received",noOrders:"No {status} Orders",noLiquidity:"No liquidity for this pair",excecutionSummary:"Execution summary",orderInfo:"Order info",wrapAction:"Wrap {symbol}",approveAction:"Approve {symbol}",createOrderAction:"Create {name} order",amountReceived:"Amount received",createdAt:"Created at",amountOut:"Amount out",status:"Status",progress:"Progress",minutes:"minutes",days:"days",tradeIntervalTitle:"Every",tradesAmountTitle:"Over",stopLossTooltip:"The trigger price at which your stop-loss order will be activated.",takeProfitTooltip:"The trigger price at which your take-profit order will be activated.",stopLossLabel:"Trigger Price",StopLossTriggerPriceError:"Trigger price must be less than market price",TakeProfitTriggerPriceError:"Trigger price must be greater than market price",triggerLimitPriceError:"Limit price must be less than trigger price",triggerPrice:"Trigger Price",tradePrice:"Trade Price",triggerMarketPriceDisclaimer:" In extreme market movements, slippage may occur and the executed price of the market order may be worse than the specified trigger price.",stopLossLimitPriceTooltip:"The stop loss order will execute at the specified limit price or better, once the stop price is triggered.",stopLossDurationTooltip:"This is the time period during which the order will be active. Please note that orders may be completed earlier than this time, or remain unfilled based on the specified parameters.",emptyTriggerPrice:"Trigger price is required",id:"ID",fees:"Fees {value}",version:"Version",maxOrderSizeError:"Max. trade size is {maxOrderSize} USD",viewOnExplorer:"View on explorer",proceedInWallet:"Proceed in wallet",wrapMsg:"Note: {symbol} was wrapped to {wSymbol}",createOrderActionSuccess:"{name} order placed"};function BG(e){let t=e;const r=/\{[^{}]*\}/g;for(;r.test(t);)t=t.replace(r,"");return t}const Me=()=>{const e=oe();return M.useCallback((r,n)=>{var o,i;const s=(o=e.getTranslation)==null?void 0:o.call(e,r,n);if(s&&s!==r)return s;const a=((i=e.translations)==null?void 0:i[r])||IG[r];return BG(a.replace(/{(\w+)}/g,(c,l)=>(n==null?void 0:n[l])||c))},[e.getTranslation,e.translations])},Uu=({value:e})=>{const t=Ze({value:e,decimalScale:2});return t?B.jsx("small",{className:"twap-order-details__detail-row-value-usd",children:` ($${t})`}):null},FG=({deadline:e,label:t,tooltip:r})=>{const n=V0(e);return B.jsx(Ar,{title:t,tooltip:r,children:n})},UG=({price:e,dstToken:t,label:r,tooltip:n,usd:s,srcToken:a})=>{const o=Ze({value:e});return j(e||0).isZero()?null:B.jsx(Ar,{title:r,tooltip:n,children:B.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:["1 ",a==null?void 0:a.symbol," = ",`${o||"-"} ${t==null?void 0:t.symbol}`,B.jsx(Uu,{value:s})]})})},OG=({tradeSize:e,srcToken:t,trades:r,label:n,tooltip:s})=>r===1?null:B.jsx(Ar,{title:n,tooltip:s,children:`${e||"-"} ${(t==null?void 0:t.symbol)||""}`}),DG=({dstToken:e,dstMinAmountOut:t,label:r,tooltip:n,usd:s})=>{const a=Ze({value:t});return j(t||0).isZero()?null:B.jsxs(Ar,{title:r,tooltip:n,children:[`${t?a:"-"} ${e==null?void 0:e.symbol}`,B.jsx(Uu,{value:s})]})},_G=({trades:e,label:t,tooltip:r})=>e===1?null:B.jsx(Ar,{title:t,tooltip:r,children:e}),MG=()=>{var s;const e=Me(),{account:t}=oe(),r=(s=oc())==null?void 0:s.explorer,n=Df(t);return B.jsx(Ar,{title:e("recipient")||"",children:r?B.jsx("a",{href:`${r}/address/${t}`,target:"_blank",children:n}):n})},NG=({fillDelayMillis:e,chunks:t=0,label:r,tooltip:n})=>{const s=M.useMemo(()=>e6(e),[e]);return t===1?null:B.jsx(Ar,{title:r,tooltip:n,children:s})},Ar=({title:e,tooltip:t,children:r,className:n="",onClick:s,style:a})=>{const{components:o}=oe(),i=o.Tooltip;return B.jsxs("div",{className:`${n} twap-order-details__detail-row`,onClick:s,style:a,children:[B.jsxs("div",{className:"twap-order-details__detail-row-label",children:[B.jsx("p",{className:"twap-order-details__detail-row-label-value",children:e}),t&&i&&B.jsx(i,{tooltipText:t})]}),B.jsx("div",{className:"twap-order-details__detail-row-value",children:r})]})},LG=({id:e})=>{const{components:t}=oe(),r=t==null?void 0:t.Tooltip,n=PG();return e.startsWith("0x")?B.jsx(Ar,{title:"ID",onClick:()=>n(e),style:{cursor:"pointer"},children:r&&B.jsx(r,{tooltipText:e,children:B.jsxs("div",{className:"twap-order-details__detail-row-value-id",children:[B.jsx("p",{children:Df(e)}),B.jsx(iz.AiOutlineCopy,{})]})})}):B.jsx(Ar,{title:"ID",children:e})},zG=({version:e})=>B.jsx(Ar,{title:"Version",children:e});function Ee({children:e,className:t=""}){return B.jsx("div",{className:`${t} twap-order-details`,children:e})}const RG=({children:e})=>e,HG=({fees:e,label:t,usd:r,dstTokenSymbol:n})=>{const s=Ze({value:e});return B.jsxs(Ar,{title:t,children:[`${e?s:"-"} ${n}`,B.jsx(Uu,{value:r})]})};Ee.Deadline=FG,Ee.Fees=HG,Ee.TradeSize=OG,Ee.MinDestAmount=DG,Ee.TradesAmount=_G,Ee.Recipient=MG,Ee.TradeInterval=NG,Ee.DetailRow=Ar,Ee.Price=UG,Ee.OrderID=LG,Ee.Container=RG,Ee.OrderVersion=zG,Ee.USD=Uu;const W0=()=>{const{publicClient:e}=oe();return Zr({mutationFn:async t=>{if(!e)throw new Error("publicClient is not defined");const r=10;let n=0,s=1e3;for(;n<r;)try{return await e.waitForTransactionReceipt({hash:t,confirmations:2,retryDelay:s})}catch(a){if(n++,n>=r)throw new Error(`Failed after ${r} attempts: ${a}`);await new Promise(o=>setTimeout(o,s)),s*=2}}}).mutateAsync},X2=e=>{const t=Me(),r=Ze({value:e.srcAmount}),n=Ze({value:e.limitPrice}),s=Ze({value:e.limitPriceUsd}),a=Ze({value:e.srcAmountPerTrade}),o=Ze({value:e.srcAmountPerTradeUsd,decimalScale:2}),i=Ze({value:e.minDestAmountPerTrade}),c=Ze({value:e.minDestAmountPerTradeUsd,decimalScale:2}),l=Ze({value:e.triggerPrice}),u=Ze({value:e.triggerPriceUsd,decimalScale:2}),d=Ze({value:e.srcUsd,decimalScale:2}),f=Ze({value:e.dstUsd,decimalScale:2}),h=Ze({value:e.dstAmount});return M.useMemo(()=>({srcToken:e.srcToken,dstToken:e.dstToken,srcUsd:d||"",dstUsd:f||"",limitPrice:{label:t("limitPrice"),tooltip:t("limitPriceTooltip"),value:n||"",usd:s||""},deadline:{tooltip:t("expirationTooltip"),label:t("expirationLabel"),value:e.deadline||0},srcAmount:{label:t("amountOut"),value:r||"",usd:d||""},dstAmount:{value:h||"",usd:f||""},sizePerTrade:{tooltip:t("tradeSizeTooltip"),label:t("individualTradeSize"),value:a||"",usd:o},totalTrades:{tooltip:t("totalTradesTooltip"),label:t("numberOfTrades"),value:e.totalTrades||0},minDestAmountPerTrade:{tooltip:t("minDstAmountTooltip"),label:t(e.totalTrades&&e.totalTrades>1?"minReceivedPerTrade":"minReceived"),value:i||"",usd:c},tradeInterval:{tooltip:t("tradeIntervalTooltip"),label:t("tradeIntervalLabel"),value:e.tradeInterval||0},triggerPrice:{tooltip:t("triggerPriceTooltip"),label:t("triggerPrice"),value:l||"",usd:u},recipient:{label:t("recipient"),value:e.account||""}}),[d,f,n,r,a,o,i,l,u,n,s,h,f,c])},Q2=e=>{const{orders:t}=Ou(),{useToken:r,config:n}=oe(),s=Me(),a=M.useMemo(()=>t==null?void 0:t.all.find(C=>C.id===e),[t,e])||{},o=tx(a),i=r==null?void 0:r(a==null?void 0:a.srcTokenAddress),c=r==null?void 0:r(a==null?void 0:a.dstTokenAddress),l=Rn(i==null?void 0:i.decimals,a==null?void 0:a.srcAmount),u=jG(i,c,a),d=VG(i,c,a),f=WG(i,c,a),h=Rn(i==null?void 0:i.decimals,a==null?void 0:a.srcAmountFilled),y=Rn(c==null?void 0:c.decimals,a==null?void 0:a.dstAmountFilled),g=a==null?void 0:a.progress,E=Rn(i==null?void 0:i.decimals,a==null?void 0:a.srcAmountPerTrade),v=Rn(c==null?void 0:c.decimals,a==null?void 0:a.dstMinAmountPerTrade),w=M.useMemo(()=>a?a.version===2?a.fillDelay:n.twapConfig?td(a,n.twapConfig):0:0,[a,n]),A=X2({srcToken:i,dstToken:c,account:a==null?void 0:a.maker,limitPrice:u,deadline:a==null?void 0:a.deadline,tradeInterval:w,srcAmount:l,totalTrades:a==null?void 0:a.totalTradesAmount,srcAmountPerTrade:E,minDestAmountPerTrade:v,triggerPrice:d});return M.useMemo(()=>({original:a,title:o,...A,createdAt:{label:s("createdAt"),value:a==null?void 0:a.createdAt},id:{label:s("id"),value:a==null?void 0:a.id},amountInFilled:{label:s("amountOut"),value:h},amountOutFilled:{label:s("amountReceived"),value:y,token:c},progress:{label:s("progress"),value:g},excecutionPrice:{label:s((a==null?void 0:a.totalTradesAmount)===1?"finalExcecutionPrice":"averageExecutionPrice"),value:f},version:{label:s("version"),value:a==null?void 0:a.version}}),[a,s,f,h,y,g,o,i,c,A])},J2=e=>{const t=Me();return M.useMemo(()=>{switch(e){case ze.TWAP_MARKET:return t("twapMarket");case ze.LIMIT:return t("limit");case ze.TWAP_LIMIT:return t("twapLimit");case ze.STOP_LOSS_MARKET:return t("stopLossMarket");case ze.STOP_LOSS_LIMIT:return t("stopLossLimit");case ze.TAKE_PROFIT:return t("takeProfit");default:return t("twapMarket")}},[t,e])},$G=()=>{const{module:e}=oe(),t=te(r=>r.state.isMarketOrder);return M.useMemo(()=>e===ye.TWAP?t?ze.TWAP_MARKET:ze.TWAP_LIMIT:e===ye.LIMIT?ze.LIMIT:e===ye.STOP_LOSS?t?ze.STOP_LOSS_MARKET:ze.STOP_LOSS_LIMIT:e===ye.TAKE_PROFIT?ze.TAKE_PROFIT:ze.TWAP_MARKET,[e,t])},ex=()=>{const e=$G();return J2(e)},tx=e=>J2(e==null?void 0:e.type),rx=()=>{const{account:e,config:t,chainId:r}=oe();return M.useMemo(()=>["useTwapOrderHistoryManager",e,t==null?void 0:t.adapter,r],[e,t,r])},GG=()=>{const{callbacks:e,refetchBalances:t}=oe(),r=Td(),n=rx();return M.useCallback(s=>{var c;const a=r.getQueryData(n);let o=!1;const i=[];a&&a.forEach(l=>{var d;const u=s.find(f=>f.id===l.id);!(u!=null&&u.twapAddress)&&l.twapAddress&&u&&u.progress!==l.progress&&(o=!0,i.push(u),u.status===ct.Completed&&((d=e==null?void 0:e.onOrderFilled)==null||d.call(e,u)))}),o&&((c=e==null?void 0:e.onOrdersProgressUpdate)==null||c.call(e,i),t==null||t())},[r,n,e,t])},q0=()=>{const{account:e,config:t,chainId:r}=oe(),n=rx(),s=GG();return d3({refetchInterval:QL,refetchOnWindowFocus:!0,retry:!1,staleTime:1/0,queryKey:n,queryFn:async({signal:o})=>{if(!e||!r||!t)return[];const i=await Dm({signal:o,chainId:r,config:t,account:e});return s(i),i.map(c=>t!=null&&t.twapConfig?{...c,fillDelayMillis:td(c,t.twapConfig)}:c)}})},Ou=()=>{const{data:e,isLoading:t,error:r,refetch:n,isRefetching:s}=q0(),{mutateAsync:a}=K0();return M.useMemo(()=>({orders:{all:e??[],open:Du(e??[],ct.Open),completed:Du(e??[],ct.Completed),expired:Du(e??[],ct.Expired),canceled:Du(e??[],ct.Canceled)},isLoading:t,error:r,refetch:()=>n().then(o=>o.data),cancelOrder:a,isRefetching:s}),[e,t,r,n,a,s])},nx=()=>{const e=te(r=>r.state.orderHistoryStatusFilter),{orders:t}=Ou();return M.useMemo(()=>e?t.all.filter(r=>r.status.toLowerCase()===e.toLowerCase())||[]:t.all,[e,t])},Du=(e,t)=>e.filter(r=>r.status===t).sort((r,n)=>n.createdAt-r.createdAt),jG=(e,t,r)=>M.useMemo(()=>{if(!(!e||!t||!r||r!=null&&r.isMarketPrice))return Gh(r,e==null?void 0:e.decimals,t==null?void 0:t.decimals)},[r,e,t]),VG=(e,t,r)=>M.useMemo(()=>{if(!(!e||!t||!r))return jh(r,e.decimals,t.decimals)},[r,e,t]),WG=(e,t,r)=>M.useMemo(()=>{if(!(!e||!t||!r))return $h(r,e.decimals,t.decimals)},[r,e,t]),sx=()=>{const e=te(r=>r.updateState),t=te(r=>r.state.orderIdsToCancel);return M.useCallback(r=>{t!=null&&t.includes(r)?e({orderIdsToCancel:t==null?void 0:t.filter(n=>n!==r)}):e({orderIdsToCancel:[...t||[],r]})},[e,t])},qG=()=>{var T,m;const e=Me(),{orders:t,isLoading:r,refetch:n,isRefetching:s}=Ou(),{mutateAsync:a,isPending:o}=K0(),i=nx(),c=te(b=>b.updateState),l=te(b=>b.state.orderHistoryStatusFilter),u=te(b=>b.state.cancelOrdersMode),d=te(b=>b.state.orderIdsToCancel),f=M.useCallback(b=>c({cancelOrdersMode:b,orderIdsToCancel:[]}),[c]),h=M.useCallback(()=>c({selectedOrderID:void 0}),[c]),y=M.useCallback(b=>a({orders:b}),[a]),g=M.useCallback(b=>c({orderHistoryStatusFilter:b}),[]),E=M.useMemo(()=>{const b=Object.keys(ct).map(x=>({text:x,value:x}));return[{text:e("allOrders"),value:""},...b]},[e]),v=sx(),w=te(b=>b.state.selectedOrderID),A=Q2(w),C=M.useMemo(()=>t.all.filter(b=>d==null?void 0:d.includes(b.id)),[t,d]),D=M.useCallback(()=>c({orderIdsToCancel:t.open.map(b=>b.id)}),[c,t]),z=M.useCallback(b=>a({orders:[b]}).then(x=>(x==null?void 0:x[0])||""),[a]);return{refetch:n,onHideSelectedOrder:h,onCancelOrders:y,onCancelOrder:z,onSelectStatus:g,onToggleCancelOrdersMode:f,onSelectOrder:v,isRefetching:s,orders:t,ordersToDisplay:i,isLoading:r,selectedOrder:w?A:void 0,openOrdersCount:((T=t==null?void 0:t.open)==null?void 0:T.length)||0,isCancelOrdersLoading:o,selectedStatus:l||((m=E[0])==null?void 0:m.value)||"",statuses:E,cancelOrdersMode:u,ordersToCancel:C,onSelectAllOrdersToCancel:D}},KG=()=>{const{refetch:e}=q0();return Zr({mutationFn:async t=>{var r;for(;;){const n=(r=await e())==null?void 0:r.data;if(!n)throw new Error("orders not found");if(t.every(a=>{const o=n.find(i=>i.id===a);return(o==null?void 0:o.status)===ct.Canceled}))break;await new Promise(a=>setTimeout(a,1e3))}}})},K0=()=>{const{account:e,walletClient:t,publicClient:r,config:n,callbacks:s,chainId:a}=oe(),o=W0(),i=KG().mutateAsync,c=te(d=>d.updateState),l=async d=>{dt.onCancelOrderRequest(d.map(f=>f.id.toString()),1);try{return(await Promise.all(d.map(h=>t.writeContract({account:e,address:h.twapAddress,abi:Nh,functionName:"cancel",args:[h.id],chain:t.chain}))))[0]}catch(f){throw dt.onCancelOrderError(f),f}},u=async d=>{var f;try{dt.onCancelOrderRequest(d.map(g=>g.hash),2);const h=await t.writeContract({account:e,address:n.repermit,abi:Mh,functionName:"cancel",args:[d.map(g=>g.hash)],chain:t.chain}),y=await o(h);if(!y)throw new Error("failed to get transaction receipt");if(y.status==="reverted")throw new Error("failed to cancel order");return dt.onCancelOrderSuccess(h),(f=s==null?void 0:s.onCancelOrderSuccess)==null||f.call(s,{orders:d,txHash:h,explorerUrl:Bi(h,a)}),y.transactionHash}catch(h){throw dt.onCancelOrderError(h),h}};return Zr({mutationFn:async({orders:d})=>{var f,h;if(!e||!t||!r||!n)throw new Error("missing required parameters");try{(f=s==null?void 0:s.onCancelOrderRequest)==null||f.call(s,d),c({cancelOrderStatus:ht.LOADING,cancelOrderTxHash:void 0,cancelOrderError:void 0});const y=d.filter(w=>w.version===1),g=d.filter(w=>w.version===2),[E,v]=await Promise.all([y.length?l(y):Promise.resolve(""),g.length?u(g):Promise.resolve("")]);return await i(d.map(w=>w.id)),c({cancelOrderStatus:ht.SUCCESS,orderIdsToCancel:[]}),[...E||[],v]}catch(y){console.error("cancel order error",y),(h=s==null?void 0:s.onCancelOrderFailed)==null||h.call(s,y),_f(y)?c({cancelOrderStatus:void 0}):(c({cancelOrderStatus:ht.FAILED}),dt.onCancelOrderError(y))}}})},ax=M.createContext({}),zt=()=>M.useContext(ax),YG=()=>{const e=te(c=>c.state.selectedOrderID),t=Q2(e),r=Me(),[n,s]=M.useState("panel1"),{components:a}=oe(),o=a.TokenLogo;M.useEffect(()=>{s("panel1")},[t.id.value]);const i=c=>{s(n===c?!1:c)};return t?B.jsx(ax.Provider,{value:{order:t},children:B.jsxs("div",{className:"twap-orders__selected-order",children:[B.jsx(d1,{SrcTokenLogo:o&&B.jsx(o,{token:t.srcToken}),DstTokenLogo:o&&B.jsx(o,{token:t.dstToken}),fromTitle:r("from"),inToken:t.srcToken,toTitle:r("to"),outToken:t.dstToken}),B.jsx(Ee.Container,{children:B.jsxs("div",{className:"twap-orders__selected-order-bottom",children:[B.jsxs("div",{className:"twap-orders__selected-order-accordions",children:[B.jsx(ox,{title:r("excecutionSummary"),onClick:()=>i("panel1"),expanded:n==="panel1",children:B.jsx(sj,{})}),B.jsx(ox,{title:r("orderInfo"),expanded:n==="panel2",onClick:()=>i("panel2"),children:B.jsx(ZG,{})})]}),B.jsx(oj,{})]})})]})}):null},ox=({expanded:e,onClick:t,children:r,title:n})=>B.jsxs("div",{className:"twap-orders__selected-order-accordion",children:[B.jsxs("div",{onClick:t,className:"twap-orders__selected-order-accordion-trigger",children:[B.jsx("p",{children:n}),B.jsx(az.IoIosArrowDown,{style:{transform:e?"rotate(180deg)":"rotate(0deg)"}})]}),e&&B.jsx("div",{className:"twap-orders__selected-order-accordion-details",children:r})]}),ZG=()=>B.jsxs(Ee,{children:[B.jsx(nj,{}),B.jsx(ij,{}),B.jsx(ej,{}),B.jsx(cj,{}),B.jsx(XG,{}),B.jsx(QG,{}),B.jsx(JG,{}),B.jsx(tj,{}),B.jsx(rj,{}),B.jsx(fj,{}),B.jsx(Ee.Recipient,{})]}),XG=()=>{const{order:e}=zt();return B.jsx(Ee.TradeSize,{tradeSize:e.sizePerTrade.value,srcToken:e.srcToken,label:e.sizePerTrade.label,tooltip:e.sizePerTrade.tooltip,trades:e.totalTrades.value})},QG=()=>{const{order:e}=zt();return B.jsx(Ee.TradesAmount,{trades:e.totalTrades.value,label:e.totalTrades.label,tooltip:e.totalTrades.tooltip})},JG=()=>{const{order:e}=zt();return B.jsx(Ee.MinDestAmount,{dstToken:e.dstToken,dstMinAmountOut:e.minDestAmountPerTrade.value,label:e.minDestAmountPerTrade.label,tooltip:e.minDestAmountPerTrade.tooltip})},ej=()=>{const{order:e}=zt();return B.jsx(Ee.Deadline,{deadline:e.deadline.value,label:e.deadline.label,tooltip:e.deadline.tooltip})},tj=()=>{const{order:e}=zt();return B.jsx(Ee.TradeInterval,{fillDelayMillis:e.tradeInterval.value,chunks:e.totalTrades.value,label:e.tradeInterval.label,tooltip:e.tradeInterval.tooltip})},rj=()=>{const{order:e}=zt();return B.jsx(Ee.Price,{srcToken:e.srcToken,dstToken:e.dstToken,price:e.triggerPrice.value,label:e.triggerPrice.label,tooltip:e.triggerPrice.tooltip})},nj=()=>{const{order:e}=zt();return B.jsx(Ee.OrderID,{id:e.id.value||""})},sj=()=>B.jsxs(Ee,{children:[B.jsx(dj,{}),B.jsx(lj,{}),B.jsx(aj,{}),B.jsx(pj,{}),B.jsx(hj,{})]}),aj=()=>{var r;const{order:e}=zt(),t=Ze({value:e.amountOutFilled.value,decimalScale:3});return e.amountOutFilled.value?B.jsx(Ee.DetailRow,{title:e.amountOutFilled.label,children:B.jsxs("p",{children:[t||"-"," ",(r=e.dstToken)==null?void 0:r.symbol]})}):null},oj=()=>{const{order:e}=zt(),t=Me(),{mutateAsync:r,isPending:n}=K0(),{components:s}=oe(),a=s.Button,o=M.useCallback(async()=>r({orders:[e.original]}),[r,e]);return!e||e.original.status!==ct.Open||!a?null:B.jsx(a,{loading:n,onClick:o,disabled:n,className:"twap-cancel-order",text:t("cancelOrder"),children:t("cancelOrder")})},ij=()=>{const{order:e}=zt(),t=Me(),r=V0(e.createdAt.value);return B.jsx(Ee.DetailRow,{title:t("createdAt")||"",children:B.jsx("p",{children:r})})},cj=()=>{var n;const{order:e}=zt(),t=Me(),r=Ze({value:e.srcAmount.value,decimalScale:3});return B.jsx(Ee.DetailRow,{title:t("amountOut")||"",children:B.jsxs("p",{children:[r||0," ",(n=e.srcToken)==null?void 0:n.symbol]})})},lj=()=>{var r;const{order:e}=zt(),t=Ze({value:e.amountInFilled.value,decimalScale:3});return B.jsx(Ee.DetailRow,{title:e.amountInFilled.label,children:B.jsxs("p",{children:[t||"-"," ",(r=e.srcToken)==null?void 0:r.symbol]})})},uj=()=>{const{order:e}=zt(),t=Me();return M.useMemo(()=>{switch(e.original.status){case ct.Open:return t("Open")||"";case ct.Completed:return t("Completed")||"";case ct.Expired:return t("Expired")||"";case ct.Canceled:return t("Canceled")||""}},[e.original.status,t])},dj=()=>{const e=Me(),t=uj();return B.jsx(Ee.DetailRow,{title:e("status")||"",children:B.jsx("p",{children:t})})},pj=()=>{const{order:e}=zt(),t=Ze({value:e.progress.value,decimalScale:2});return B.jsx(Ee.DetailRow,{title:e.progress.label,children:B.jsxs("p",{children:[t||0,"%"]})})},fj=()=>{const{order:e}=zt(),t=Me();return e.limitPrice.value?B.jsx(Ee.Price,{label:t("limitPrice")||"",price:e.limitPrice.value,srcToken:e.srcToken,dstToken:e.dstToken,tooltip:e.limitPrice.tooltip}):null},hj=()=>{const{order:e}=zt();return e.excecutionPrice.value?B.jsx(Ee.Price,{label:e.excecutionPrice.label,price:e.excecutionPrice.value,srcToken:e.srcToken,dstToken:e.dstToken}):null};var Y0={},ix;function mj(){if(ix)return Y0;ix=1;var e=lu.GenIcon;return Y0.HiArrowRight=function(r){return e({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z",clipRule:"evenodd"}}]})(r)},Y0}var bj=mj();const _u=0,fs=1,mo=2,cx=4;function lx(e){return()=>e}function yj(e){e()}function ux(e,t){return r=>e(t(r))}function dx(e,t){return()=>e(t)}function gj(e,t){return r=>e(t,r)}function Z0(e){return e!==void 0}function xj(...e){return()=>{e.map(yj)}}function bo(){}function Mu(e,t){return t(e),e}function wj(e,t){return t(e)}function tt(...e){return e}function je(e,t){return e(fs,t)}function Ce(e,t){e(_u,t)}function X0(e){e(mo)}function at(e){return e(cx)}function ce(e,t){return je(e,gj(t,_u))}function Vr(e,t){const r=e(fs,n=>{r(),t(n)});return r}function px(e){let t,r;return n=>s=>{t=s,r&&clearTimeout(r),r=setTimeout(()=>{n(t)},e)}}function fx(e,t){return e===t}function rt(e=fx){let t;return r=>n=>{e(t,n)||(t=n,r(n))}}function fe(e){return t=>r=>{e(r)&&t(r)}}function re(e){return t=>ux(t,e)}function cn(e){return t=>()=>{t(e)}}function W(e,...t){const r=vj(...t);return(n,s)=>{switch(n){case mo:X0(e);return;case fs:return je(e,r(s))}}}function ln(e,t){return r=>n=>{r(t=e(t,n))}}function oa(e){return t=>r=>{e>0?e--:t(r)}}function Hn(e){let t=null,r;return n=>s=>{t=s,!r&&(r=setTimeout(()=>{r=void 0,n(t)},e))}}function Te(...e){const t=new Array(e.length);let r=0,n=null;const s=Math.pow(2,e.length)-1;return e.forEach((a,o)=>{const i=Math.pow(2,o);je(a,c=>{const l=r;r=r|i,t[o]=c,l!==s&&r===s&&n&&(n(),n=null)})}),a=>o=>{const i=()=>{a([o].concat(t))};r===s?i():n=i}}function vj(...e){return t=>e.reduceRight(wj,t)}function Ej(e){let t,r;const n=()=>t==null?void 0:t();return function(s,a){switch(s){case fs:return a?r===a?void 0:(n(),r=a,t=je(e,a),t):(n(),bo);case mo:n(),r=null;return}}}function Y(e){let t=e;const r=Ue();return(n,s)=>{switch(n){case _u:t=s;break;case fs:{s(t);break}case cx:return t}return r(n,s)}}function Rt(e,t){return Mu(Y(t),r=>ce(e,r))}function Ue(){const e=[];return(t,r)=>{switch(t){case _u:e.slice().forEach(n=>{n(r)});return;case mo:e.splice(0,e.length);return;case fs:return e.push(r),()=>{const n=e.indexOf(r);n>-1&&e.splice(n,1)}}}}function mr(e){return Mu(Ue(),t=>ce(e,t))}function $e(e,t=[],{singleton:r}={singleton:!0}){return{constructor:e,dependencies:t,id:kj(),singleton:r}}const kj=()=>Symbol();function Cj(e){const t=new Map,r=({constructor:n,dependencies:s,id:a,singleton:o})=>{if(o&&t.has(a))return t.get(a);const i=n(s.map(c=>r(c)));return o&&t.set(a,i),i};return r(e)}function Et(...e){const t=Ue(),r=new Array(e.length);let n=0;const s=Math.pow(2,e.length)-1;return e.forEach((a,o)=>{const i=Math.pow(2,o);je(a,c=>{r[o]=c,n=n|i,n===s&&Ce(t,r)})}),function(a,o){switch(a){case mo:{X0(t);return}case fs:return n===s&&o(r),je(t,o)}}}function he(e,t=fx){return W(e,rt(t))}function Q0(...e){return function(t,r){switch(t){case mo:return;case fs:return xj(...e.map(n=>je(n,r)))}}}var nr=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(nr||{});const Tj={0:"debug",3:"error",1:"log",2:"warn"},Aj=()=>typeof globalThis>"u"?window:globalThis,hs=$e(()=>{const e=Y(3);return{log:Y((t,r,n=1)=>{var s;const a=(s=Aj().VIRTUOSO_LOG_LEVEL)!=null?s:at(e);n>=a&&console[Tj[n]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,r)}),logLevel:e}},[],{singleton:!0});function ia(e,t,r){return J0(e,t,r).callbackRef}function J0(e,t,r){const n=M.useRef(null);let s=o=>{};const a=M.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(o=>{const i=()=>{const c=o[0].target;c.offsetParent!==null&&e(c)};r?i():requestAnimationFrame(i)}):null,[e,r]);return s=o=>{o&&t?(a==null||a.observe(o),n.current=o):(n.current&&(a==null||a.unobserve(n.current)),n.current=null)},{callbackRef:s,ref:n}}function Sj(e,t,r,n,s,a,o,i,c){const l=M.useCallback(u=>{const d=Pj(u.children,t,i?"offsetWidth":"offsetHeight",s);let f=u.parentElement;for(;!f.dataset.virtuosoScroller;)f=f.parentElement;const h=f.lastElementChild.dataset.viewportType==="window";let y;h&&(y=f.ownerDocument.defaultView);const g=o?i?o.scrollLeft:o.scrollTop:h?i?y.scrollX||y.document.documentElement.scrollLeft:y.scrollY||y.document.documentElement.scrollTop:i?f.scrollLeft:f.scrollTop,E=o?i?o.scrollWidth:o.scrollHeight:h?i?y.document.documentElement.scrollWidth:y.document.documentElement.scrollHeight:i?f.scrollWidth:f.scrollHeight,v=o?i?o.offsetWidth:o.offsetHeight:h?i?y.innerWidth:y.innerHeight:i?f.offsetWidth:f.offsetHeight;n({scrollHeight:E,scrollTop:Math.max(g,0),viewportHeight:v}),a==null||a(i?hx("column-gap",getComputedStyle(u).columnGap,s):hx("row-gap",getComputedStyle(u).rowGap,s)),d!==null&&e(d)},[e,t,s,a,o,n,i]);return J0(l,r,c)}function Pj(e,t,r,n){const s=e.length;if(s===0)return null;const a=[];for(let o=0;o<s;o++){const i=e.item(o);if(i.dataset.index===void 0)continue;const c=parseInt(i.dataset.index),l=parseFloat(i.dataset.knownSize),u=t(i,r);if(u===0&&n("Zero-sized element, this should not happen",{child:i},nr.ERROR),u===l)continue;const d=a[a.length-1];a.length===0||d.size!==u||d.endIndex!==c-1?a.push({endIndex:c,size:u,startIndex:c}):a[a.length-1].endIndex++}return a}function hx(e,t,r){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&r(`${e} was not resolved to pixel value correctly`,t,nr.WARN),t==="normal"?0:parseInt(t??"0",10)}function mx(e,t,r){const n=M.useRef(null),s=M.useCallback(c=>{if(!(c!=null&&c.offsetParent))return;const l=c.getBoundingClientRect(),u=l.width;let d,f;if(t){const h=t.getBoundingClientRect(),y=l.top-h.top;f=h.height-Math.max(0,y),d=y+t.scrollTop}else{const h=o.current.ownerDocument.defaultView;f=h.innerHeight-Math.max(0,l.top),d=l.top+h.scrollY}n.current={offsetTop:d,visibleHeight:f,visibleWidth:u},e(n.current)},[e,t]),{callbackRef:a,ref:o}=J0(s,!0,r),i=M.useCallback(()=>{s(o.current)},[s,o]);return M.useEffect(()=>{var c;if(t){t.addEventListener("scroll",i);const l=new ResizeObserver(()=>{requestAnimationFrame(i)});return l.observe(t),()=>{t.removeEventListener("scroll",i),l.unobserve(t)}}else{const l=(c=o.current)==null?void 0:c.ownerDocument.defaultView;return l==null||l.addEventListener("scroll",i),l==null||l.addEventListener("resize",i),()=>{l==null||l.removeEventListener("scroll",i),l==null||l.removeEventListener("resize",i)}}},[i,t,o]),a}const Wt=$e(()=>{const e=Ue(),t=Ue(),r=Y(0),n=Ue(),s=Y(0),a=Ue(),o=Ue(),i=Y(0),c=Y(0),l=Y(0),u=Y(0),d=Ue(),f=Ue(),h=Y(!1),y=Y(!1),g=Y(!1);return ce(W(e,re(({scrollTop:E})=>E)),t),ce(W(e,re(({scrollHeight:E})=>E)),o),ce(t,s),{deviation:r,fixedFooterHeight:l,fixedHeaderHeight:c,footerHeight:u,headerHeight:i,horizontalDirection:y,scrollBy:f,scrollContainerState:e,scrollHeight:o,scrollingInProgress:h,scrollTo:d,scrollTop:t,skipAnimationFrameInResizeObserver:g,smoothScrollTargetReached:n,statefulScrollTop:s,viewportHeight:a}},[],{singleton:!0}),ic={lvl:0};function bx(e,t){const r=e.length;if(r===0)return[];let{index:n,value:s}=t(e[0]);const a=[];for(let o=1;o<r;o++){const{index:i,value:c}=t(e[o]);a.push({end:i-1,start:n,value:s}),n=i,s=c}return a.push({end:1/0,start:n,value:s}),a}function qe(e){return e===ic}function cc(e,t){if(!qe(e))return t===e.k?e.v:t<e.k?cc(e.l,t):cc(e.r,t)}function Wr(e,t,r="k"){if(qe(e))return[-1/0,void 0];if(Number(e[r])===t)return[e.k,e.v];if(Number(e[r])<t){const n=Wr(e.r,t,r);return n[0]===-1/0?[e.k,e.v]:n}return Wr(e.l,t,r)}function br(e,t,r){return qe(e)?xx(t,r,1):t===e.k?At(e,{k:t,v:r}):t<e.k?wx(At(e,{l:br(e.l,t,r)})):wx(At(e,{r:br(e.r,t,r)}))}function yo(){return ic}function go(e,t,r){if(qe(e))return[];const n=Wr(e,t)[0];return Ij(th(e,n,r))}function eh(e,t){if(qe(e))return ic;const{k:r,l:n,r:s}=e;if(t===r){if(qe(n))return s;if(qe(s))return n;{const[a,o]=gx(n);return Nu(At(e,{k:a,l:yx(n),v:o}))}}else return t<r?Nu(At(e,{l:eh(n,t)})):Nu(At(e,{r:eh(s,t)}))}function ca(e){return qe(e)?[]:[...ca(e.l),{k:e.k,v:e.v},...ca(e.r)]}function th(e,t,r){if(qe(e))return[];const{k:n,l:s,r:a,v:o}=e;let i=[];return n>t&&(i=i.concat(th(s,t,r))),n>=t&&n<=r&&i.push({k:n,v:o}),n<=r&&(i=i.concat(th(a,t,r))),i}function Nu(e){const{l:t,lvl:r,r:n}=e;if(n.lvl>=r-1&&t.lvl>=r-1)return e;if(r>n.lvl+1){if(rh(t))return vx(At(e,{lvl:r-1}));if(!qe(t)&&!qe(t.r))return At(t.r,{l:At(t,{r:t.r.l}),lvl:r,r:At(e,{l:t.r.r,lvl:r-1})});throw new Error("Unexpected empty nodes")}else{if(rh(e))return nh(At(e,{lvl:r-1}));if(!qe(n)&&!qe(n.l)){const s=n.l,a=rh(s)?n.lvl-1:n.lvl;return At(s,{l:At(e,{lvl:r-1,r:s.l}),lvl:s.lvl+1,r:nh(At(n,{l:s.r,lvl:a}))})}else throw new Error("Unexpected empty nodes")}}function At(e,t){return xx(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function yx(e){return qe(e.r)?e.l:Nu(At(e,{r:yx(e.r)}))}function rh(e){return qe(e)||e.lvl>e.r.lvl}function gx(e){return qe(e.r)?[e.k,e.v]:gx(e.r)}function xx(e,t,r,n=ic,s=ic){return{k:e,l:n,lvl:r,r:s,v:t}}function wx(e){return nh(vx(e))}function vx(e){const{l:t}=e;return!qe(t)&&t.lvl===e.lvl?At(t,{r:At(e,{l:t.r})}):e}function nh(e){const{lvl:t,r}=e;return!qe(r)&&!qe(r.r)&&r.lvl===t&&r.r.lvl===t?At(r,{l:At(e,{r:r.l}),lvl:t+1}):e}function Ij(e){return bx(e,({k:t,v:r})=>({index:t,value:r}))}function Ex(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function lc(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const sh=$e(()=>({recalcInProgress:Y(!1)}),[],{singleton:!0});function kx(e,t,r){return e[Lu(e,t,r)]}function Lu(e,t,r,n=0){let s=e.length-1;for(;n<=s;){const a=Math.floor((n+s)/2),o=e[a],i=r(o,t);if(i===0)return a;if(i===-1){if(s-n<2)return a-1;s=a-1}else{if(s===n)return a;n=a+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function Bj(e,t,r,n){const s=Lu(e,t,n),a=Lu(e,r,n,s);return e.slice(s,a+1)}function ms(e,t){return Math.round(e.getBoundingClientRect()[t])}function zu(e){return!qe(e.groupOffsetTree)}function ah({index:e},t){return t===e?0:t<e?-1:1}function Fj(){return{groupIndices:[],groupOffsetTree:yo(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:yo()}}function Uj(e,t){let r=qe(e)?0:1/0;for(const n of t){const{endIndex:s,size:a,startIndex:o}=n;if(r=Math.min(r,o),qe(e)){e=br(e,0,a);continue}const i=go(e,o-1,s+1);if(i.some(zj(n)))continue;let c=!1,l=!1;for(const{end:u,start:d,value:f}of i)c?(s>=d||a===f)&&(e=eh(e,d)):(l=f!==a,c=!0),u>s&&s>=d&&f!==a&&(e=br(e,s+1,f));l&&(e=br(e,o,a))}return[e,r]}function Oj(e){return typeof e.groupIndex<"u"}function Dj({offset:e},t){return t===e?0:t<e?-1:1}function uc(e,t,r){if(t.length===0)return 0;const{index:n,offset:s,size:a}=kx(t,e,ah),o=e-n,i=a*o+(o-1)*r+s;return i>0?i+r:i}function Cx(e,t){if(!zu(t))return e;let r=0;for(;t.groupIndices[r]<=e+r;)r++;return e+r}function Tx(e,t,r){if(Oj(e))return t.groupIndices[e.groupIndex]+1;{const n=e.index==="LAST"?r:e.index;let s=Cx(n,t);return s=Math.max(0,s,Math.min(r,s)),s}}function _j(e,t,r,n=0){return n>0&&(t=Math.max(t,kx(e,n,ah).offset)),bx(Bj(e,t,r,Dj),Lj)}function Mj(e,[t,r,n,s]){t.length>0&&n("received item sizes",t,nr.DEBUG);const a=e.sizeTree;let o=a,i=0;if(r.length>0&&qe(a)&&t.length===2){const f=t[0].size,h=t[1].size;o=r.reduce((y,g)=>br(br(y,g,f),g+1,h),o)}else[o,i]=Uj(o,t);if(o===a)return e;const{lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d}=oh(e.offsetTree,i,o,s);return{groupIndices:r,groupOffsetTree:r.reduce((f,h)=>br(f,h,uc(h,d,s)),yo()),lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d,sizeTree:o}}function Nj(e){return ca(e).map(({k:t,v:r},n,s)=>{const a=s[n+1];return{endIndex:a?a.k-1:1/0,size:r,startIndex:t}})}function Ax(e,t){let r=0,n=0;for(;r<e;)r+=t[n+1]-t[n]-1,n++;return n-(r===e?0:1)}function oh(e,t,r,n){let s=e,a=0,o=0,i=0,c=0;if(t!==0){c=Lu(s,t-1,ah),i=s[c].offset;const l=Wr(r,t-1);a=l[0],o=l[1],s.length&&s[c].size===Wr(r,t)[1]&&(c-=1),s=s.slice(0,c+1)}else s=[];for(const{start:l,value:u}of go(r,t,1/0)){const d=l-a,f=d*o+i+d*n;s.push({index:l,offset:f,size:u}),a=l,i=f,o=u}return{lastIndex:a,lastOffset:i,lastSize:o,offsetTree:s}}function Lj(e){return{index:e.index,value:e}}function zj(e){const{endIndex:t,size:r,startIndex:n}=e;return s=>s.start===n&&(s.end===t||s.end===1/0)&&s.value===r}const Rj={offsetHeight:"height",offsetWidth:"width"},un=$e(([{log:e},{recalcInProgress:t}])=>{const r=Ue(),n=Ue(),s=Rt(n,0),a=Ue(),o=Ue(),i=Y(0),c=Y([]),l=Y(void 0),u=Y(void 0),d=Y(void 0),f=Y(void 0),h=Y((T,m)=>ms(T,Rj[m])),y=Y(void 0),g=Y(0),E=Fj(),v=Rt(W(r,Te(c,e,g),ln(Mj,E),rt()),E),w=Rt(W(c,rt(),ln((T,m)=>({current:m,prev:T.current}),{current:[],prev:[]}),re(({prev:T})=>T)),[]);ce(W(c,fe(T=>T.length>0),Te(v,g),re(([T,m,b])=>{const x=T.reduce((S,I,F)=>br(S,I,uc(I,m.offsetTree,b)||F),yo());return{...m,groupIndices:T,groupOffsetTree:x}})),v),ce(W(n,Te(v),fe(([T,{lastIndex:m}])=>T<m),re(([T,{lastIndex:m,lastSize:b}])=>[{endIndex:m,size:b,startIndex:T}])),r),ce(l,u);const A=Rt(W(l,re(T=>T===void 0)),!0);ce(W(u,fe(T=>T!==void 0&&qe(at(v).sizeTree)),re(T=>{const m=at(d),b=at(c).length>0;return m?b?[{endIndex:0,size:m,startIndex:0},{endIndex:1,size:T,startIndex:1}]:[]:[{endIndex:0,size:T,startIndex:0}]})),r),ce(W(f,fe(T=>T!==void 0&&T.length>0&&qe(at(v).sizeTree)),re(T=>{const m=[];let b=T[0],x=0;for(let S=1;S<T.length;S++){const I=T[S];I!==b&&(m.push({endIndex:S-1,size:b,startIndex:x}),b=I,x=S)}return m.push({endIndex:T.length-1,size:b,startIndex:x}),m})),r),ce(W(c,Te(d,u),fe(([,T,m])=>T!==void 0&&m!==void 0),re(([T,m,b])=>{const x=[];for(let S=0;S<T.length;S++){const I=T[S],F=T[S+1];x.push({startIndex:I,endIndex:I,size:m}),F!==void 0&&x.push({startIndex:I+1,endIndex:F-1,size:b})}return x})),r);const C=mr(W(r,Te(v),ln(({sizes:T},[m,b])=>({changed:b!==T,sizes:b}),{changed:!1,sizes:E}),re(T=>T.changed)));je(W(i,ln((T,m)=>({diff:T.prev-m,prev:m}),{diff:0,prev:0}),re(T=>T.diff)),T=>{const{groupIndices:m}=at(v);if(T>0)Ce(t,!0),Ce(a,T+Ax(T,m));else if(T<0){const b=at(w);b.length>0&&(T-=Ax(-T,b)),Ce(o,T)}}),je(W(i,Te(e)),([T,m])=>{T<0&&m("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:i},nr.ERROR)});const D=mr(a);ce(W(a,Te(v),re(([T,m])=>{const b=m.groupIndices.length>0,x=[],S=m.lastSize;if(b){const I=cc(m.sizeTree,0);let F=0,_=0;for(;F<T;){const P=m.groupIndices[_],O=m.groupIndices.length===_+1?1/0:m.groupIndices[_+1]-P-1;x.push({endIndex:P,size:I,startIndex:P}),x.push({endIndex:P+1+O-1,size:S,startIndex:P+1}),_++,F+=O+1}const k=ca(m.sizeTree);return F!==T&&k.shift(),k.reduce((P,{k:O,v:U})=>{let L=P.ranges;return P.prevSize!==0&&(L=[...P.ranges,{endIndex:O+T-1,size:P.prevSize,startIndex:P.prevIndex}]),{prevIndex:O+T,prevSize:U,ranges:L}},{prevIndex:T,prevSize:0,ranges:x}).ranges}return ca(m.sizeTree).reduce((I,{k:F,v:_})=>({prevIndex:F+T,prevSize:_,ranges:[...I.ranges,{endIndex:F+T-1,size:I.prevSize,startIndex:I.prevIndex}]}),{prevIndex:0,prevSize:S,ranges:[]}).ranges})),r);const z=mr(W(o,Te(v,g),re(([T,{offsetTree:m},b])=>{const x=-T;return uc(x,m,b)})));return ce(W(o,Te(v,g),re(([T,m,b])=>{if(m.groupIndices.length>0){if(qe(m.sizeTree))return m;let x=yo();const S=at(w);let I=0,F=0,_=0;for(;I<-T;){_=S[F];const k=S[F+1]-_-1;F++,I+=k+1}if(x=ca(m.sizeTree).reduce((k,{k:P,v:O})=>br(k,Math.max(0,P+T),O),x),I!==-T){const k=cc(m.sizeTree,_);x=br(x,0,k);const P=Wr(m.sizeTree,-T+1)[1];x=br(x,1,P)}return{...m,sizeTree:x,...oh(m.offsetTree,0,x,b)}}else{const x=ca(m.sizeTree).reduce((S,{k:I,v:F})=>br(S,Math.max(0,I+T),F),yo());return{...m,sizeTree:x,...oh(m.offsetTree,0,x,b)}}})),v),{beforeUnshiftWith:D,data:y,defaultItemSize:u,firstItemIndex:i,fixedItemSize:l,fixedGroupSize:d,gap:g,groupIndices:c,heightEstimates:f,itemSize:h,listRefresh:C,shiftWith:o,shiftWithOffset:z,sizeRanges:r,sizes:v,statefulTotalCount:s,totalCount:n,trackItemSizes:A,unshiftWith:a}},tt(hs,sh),{singleton:!0});function Hj(e){return e.reduce((t,r)=>(t.groupIndices.push(t.totalCount),t.totalCount+=r+1,t),{groupIndices:[],totalCount:0})}const Sx=$e(([{groupIndices:e,sizes:t,totalCount:r},{headerHeight:n,scrollTop:s}])=>{const a=Ue(),o=Ue(),i=mr(W(a,re(Hj)));return ce(W(i,re(c=>c.totalCount)),r),ce(W(i,re(c=>c.groupIndices)),e),ce(W(Et(s,t,n),fe(([c,l])=>zu(l)),re(([c,l,u])=>Wr(l.groupOffsetTree,Math.max(c-u,0),"v")[0]),rt(),re(c=>[c])),o),{groupCounts:a,topItemsIndexes:o}},tt(un,Wt)),bs=$e(([{log:e}])=>{const t=Y(!1),r=mr(W(t,fe(n=>n),rt()));return je(t,n=>{n&&at(e)("props updated",{},nr.DEBUG)}),{didMount:r,propsReady:t}},tt(hs),{singleton:!0}),$j=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Px(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!$j)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const dc=$e(([{gap:e,listRefresh:t,sizes:r,totalCount:n},{fixedFooterHeight:s,fixedHeaderHeight:a,footerHeight:o,headerHeight:i,scrollingInProgress:c,scrollTo:l,smoothScrollTargetReached:u,viewportHeight:d},{log:f}])=>{const h=Ue(),y=Ue(),g=Y(0);let E=null,v=null,w=null;function A(){E&&(E(),E=null),w&&(w(),w=null),v&&(clearTimeout(v),v=null),Ce(c,!1)}return ce(W(h,Te(r,d,n,g,i,o,f),Te(e,a,s),re(([[C,D,z,T,m,b,x,S],I,F,_])=>{const k=Px(C),{align:P,behavior:O,offset:U}=k,L=T-1,H=Tx(k,D,L);let G=uc(H,D.offsetTree,I)+b;P==="end"?(G+=F+Wr(D.sizeTree,H)[1]-z+_,H===L&&(G+=x)):P==="center"?G+=(F+Wr(D.sizeTree,H)[1]-z+_)/2:G-=m,U&&(G+=U);const Q=pe=>{A(),pe?(S("retrying to scroll to",{location:C},nr.DEBUG),Ce(h,C)):(Ce(y,!0),S("list did not change, scroll successful",{},nr.DEBUG))};if(A(),O==="smooth"){let pe=!1;w=je(t,me=>{pe=pe||me}),E=Vr(u,()=>{Q(pe)})}else E=Vr(W(t,Gj(150)),Q);return v=setTimeout(()=>{A()},1200),Ce(c,!0),S("scrolling from index to",{behavior:O,index:H,top:G},nr.DEBUG),{behavior:O,top:G}})),l),{scrollTargetReached:y,scrollToIndex:h,topListHeight:g}},tt(un,Wt,hs),{singleton:!0});function Gj(e){return t=>{const r=setTimeout(()=>{t(!1)},e);return n=>{n&&(t(!0),clearTimeout(r))}}}function ih(e,t){e==0?t():requestAnimationFrame(()=>{ih(e-1,t)})}function ch(e,t){const r=t-1;return typeof e=="number"?e:e.index==="LAST"?r:e.index}const pc=$e(([{defaultItemSize:e,listRefresh:t,sizes:r},{scrollTop:n},{scrollTargetReached:s,scrollToIndex:a},{didMount:o}])=>{const i=Y(!0),c=Y(0),l=Y(!0);return ce(W(o,Te(c),fe(([u,d])=>!!d),cn(!1)),i),ce(W(o,Te(c),fe(([u,d])=>!!d),cn(!1)),l),je(W(Et(t,o),Te(i,r,e,l),fe(([[,u],d,{sizeTree:f},h,y])=>u&&(!qe(f)||Z0(h))&&!d&&!y),Te(c)),([,u])=>{Vr(s,()=>{Ce(l,!0)}),ih(4,()=>{Vr(n,()=>{Ce(i,!0)}),Ce(a,u)})}),{initialItemFinalLocationReached:l,initialTopMostItemIndex:c,scrolledToInitialItem:i}},tt(un,Wt,dc,bs),{singleton:!0});function Ix(e,t){return Math.abs(e-t)<1.01}const fc="up",hc="down",jj="none",Vj={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Wj=0,mc=$e(([{footerHeight:e,headerHeight:t,scrollBy:r,scrollContainerState:n,scrollTop:s,viewportHeight:a}])=>{const o=Y(!1),i=Y(!0),c=Ue(),l=Ue(),u=Y(4),d=Y(Wj),f=Rt(W(Q0(W(he(s),oa(1),cn(!0)),W(he(s),oa(1),cn(!1),px(100))),rt()),!1),h=Rt(W(Q0(W(r,cn(!0)),W(r,cn(!1),px(200))),rt()),!1);ce(W(Et(he(s),he(d)),re(([w,A])=>w<=A),rt()),i),ce(W(i,Hn(50)),l);const y=mr(W(Et(n,he(a),he(t),he(e),he(u)),ln((w,[{scrollHeight:A,scrollTop:C},D,z,T,m])=>{const b=C+D-A>-m,x={scrollHeight:A,scrollTop:C,viewportHeight:D};if(b){let I,F;return C>w.state.scrollTop?(I="SCROLLED_DOWN",F=w.state.scrollTop-C):(I="SIZE_DECREASED",F=w.state.scrollTop-C||w.scrollTopDelta),{atBottom:!0,atBottomBecause:I,scrollTopDelta:F,state:x}}let S;return x.scrollHeight>w.state.scrollHeight?S="SIZE_INCREASED":D<w.state.viewportHeight?S="VIEWPORT_HEIGHT_DECREASING":C<w.state.scrollTop?S="SCROLLING_UPWARDS":S="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:S,state:x}},Vj),rt((w,A)=>w&&w.atBottom===A.atBottom))),g=Rt(W(n,ln((w,{scrollHeight:A,scrollTop:C,viewportHeight:D})=>{if(Ix(w.scrollHeight,A))return{changed:!1,jump:0,scrollHeight:A,scrollTop:C};{const z=A-(C+D)<1;return w.scrollTop!==C&&z?{changed:!0,jump:w.scrollTop-C,scrollHeight:A,scrollTop:C}:{changed:!0,jump:0,scrollHeight:A,scrollTop:C}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),fe(w=>w.changed),re(w=>w.jump)),0);ce(W(y,re(w=>w.atBottom)),o),ce(W(o,Hn(50)),c);const E=Y(hc);ce(W(n,re(({scrollTop:w})=>w),rt(),ln((w,A)=>at(h)?{direction:w.direction,prevScrollTop:A}:{direction:A<w.prevScrollTop?fc:hc,prevScrollTop:A},{direction:hc,prevScrollTop:0}),re(w=>w.direction)),E),ce(W(n,Hn(50),cn(jj)),E);const v=Y(0);return ce(W(f,fe(w=>!w),cn(0)),v),ce(W(s,Hn(100),Te(f),fe(([w,A])=>!!A),ln(([w,A],[C])=>[A,C],[0,0]),re(([w,A])=>A-w)),v),{atBottomState:y,atBottomStateChange:c,atBottomThreshold:u,atTopStateChange:l,atTopThreshold:d,isAtBottom:o,isAtTop:i,isScrolling:f,lastJumpDueToItemResize:g,scrollDirection:E,scrollVelocity:v}},tt(Wt)),bc="top",yc="bottom",Bx="none";function Fx(e,t,r){return typeof e=="number"?r===fc&&t===bc||r===hc&&t===yc?e:0:r===fc?t===bc?e.main:e.reverse:t===yc?e.main:e.reverse}function Ux(e,t){var r;return typeof e=="number"?e:(r=e[t])!=null?r:0}const lh=$e(([{deviation:e,fixedHeaderHeight:t,headerHeight:r,scrollTop:n,viewportHeight:s}])=>{const a=Ue(),o=Y(0),i=Y(0),c=Y(0),l=Rt(W(Et(he(n),he(s),he(r),he(a,lc),he(c),he(o),he(t),he(e),he(i)),re(([u,d,f,[h,y],g,E,v,w,A])=>{const C=u-w,D=E+v,z=Math.max(f-C,0);let T=Bx;const m=Ux(A,bc),b=Ux(A,yc);return h-=w,h+=f+v,y+=f+v,y-=w,h>u+D-m&&(T=fc),y<u-z+d+b&&(T=hc),T!==Bx?[Math.max(C-f-Fx(g,bc,T)-m,0),C-z-v+d+Fx(g,yc,T)+b]:null}),fe(u=>u!=null),rt(lc)),[0,0]);return{increaseViewportBy:i,listBoundary:a,overscan:c,topListHeight:o,visibleRange:l}},tt(Wt),{singleton:!0});function qj(e,t,r){if(zu(t)){const n=Cx(e,t);return[{index:Wr(t.groupOffsetTree,n)[0],offset:0,size:0},{data:r==null?void 0:r[0],index:n,offset:0,size:0}]}return[{data:r==null?void 0:r[0],index:e,offset:0,size:0}]}const uh={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Ru(e,t,r,n,s,a){const{lastIndex:o,lastOffset:i,lastSize:c}=s;let l=0,u=0;if(e.length>0){l=e[0].offset;const g=e[e.length-1];u=g.offset+g.size}const d=r-o,f=i+d*c+(d-1)*n,h=l,y=f-u;return{bottom:u,firstItemIndex:a,items:Dx(e,s,a),offsetBottom:y,offsetTop:l,top:h,topItems:Dx(t,s,a),topListHeight:t.reduce((g,E)=>E.size+g,0),totalCount:r}}function Ox(e,t,r,n,s,a){let o=0;if(r.groupIndices.length>0)for(const u of r.groupIndices){if(u-o>=e)break;o++}const i=e+o,c=ch(t,i),l=Array.from({length:i}).map((u,d)=>({data:a[d+c],index:d+c,offset:0,size:0}));return Ru(l,[],i,s,r,n)}function Dx(e,t,r){if(e.length===0)return[];if(!zu(t))return e.map(l=>({...l,index:l.index+r,originalIndex:l.index}));const n=e[0].index,s=e[e.length-1].index,a=[],o=go(t.groupOffsetTree,n,s);let i,c=0;for(const l of e){(!i||i.end<l.index)&&(i=o.shift(),c=t.groupIndices.indexOf(i.start));let u;l.index===i.start?u={index:c,type:"group"}:u={groupIndex:c,index:l.index-(c+1)+r},a.push({...u,data:l.data,offset:l.offset,originalIndex:l.index,size:l.size})}return a}function _x(e,t){var r;return e===void 0?0:typeof e=="number"?e:(r=e[t])!=null?r:0}const la=$e(([{data:e,firstItemIndex:t,gap:r,sizes:n,totalCount:s},a,{listBoundary:o,topListHeight:i,visibleRange:c},{initialTopMostItemIndex:l,scrolledToInitialItem:u},{topListHeight:d},f,{didMount:h},{recalcInProgress:y}])=>{const g=Y([]),E=Y(0),v=Ue(),w=Y(0);ce(a.topItemsIndexes,g);const A=Rt(W(Et(h,y,he(c,lc),he(s),he(n),he(l),u,he(g),he(t),he(r),he(w),e),fe(([T,m,,b,,,,,,,,x])=>{const S=x&&x.length!==b;return T&&!m&&!S}),re(([,,[T,m],b,x,S,I,F,_,k,P,O])=>{var U,L,H,G;const Q=x,{offsetTree:pe,sizeTree:me}=Q,ie=at(E);if(b===0)return{...uh,totalCount:b};if(T===0&&m===0)return ie===0?{...uh,totalCount:b}:Ox(ie,S,x,_,k,O||[]);if(qe(me))return ie>0?null:Ru(qj(ch(S,b),Q,O),[],b,k,Q,_);const de=[];if(F.length>0){const Ae=F[0],ve=F[F.length-1];let be=0;for(const Xe of go(me,Ae,ve)){const Ke=Xe.value,Qe=Math.max(Xe.start,Ae),Br=Math.min(Xe.end,ve);for(let Ot=Qe;Ot<=Br;Ot++)de.push({data:O==null?void 0:O[Ot],index:Ot,offset:be,size:Ke}),be+=Ke}}if(!I)return Ru([],de,b,k,Q,_);const Be=F.length>0?F[F.length-1]+1:0,X=_j(pe,T,m,Be);if(X.length===0)return null;const we=b-1,De=Mu([],Ae=>{for(const ve of X){const be=ve.value;let Xe=be.offset,Ke=ve.start;const Qe=be.size;if(be.offset<T){Ke+=Math.floor((T-be.offset+k)/(Qe+k));const Ot=Ke-ve.start;Xe+=Ot*Qe+Ot*k}Ke<Be&&(Xe+=(Be-Ke)*Qe,Ke=Be);const Br=Math.min(ve.end,we);for(let Ot=Ke;Ot<=Br&&!(Xe>=m);Ot++)Ae.push({data:O==null?void 0:O[Ot],index:Ot,offset:Xe,size:Qe}),Xe+=Qe+k}}),Ge=_x(P,bc),it=_x(P,yc);if(De.length>0&&(Ge>0||it>0)){const Ae=De[0],ve=De[De.length-1];if(Ge>0&&Ae.index>Be){const be=Math.min(Ge,Ae.index-Be),Xe=[];let Ke=Ae.offset;for(let Qe=Ae.index-1;Qe>=Ae.index-be;Qe--){const Br=(L=(U=go(me,Qe,Qe)[0])==null?void 0:U.value)!=null?L:Ae.size;Ke-=Br+k,Xe.unshift({data:O==null?void 0:O[Qe],index:Qe,offset:Ke,size:Br})}De.unshift(...Xe)}if(it>0&&ve.index<we){const be=Math.min(it,we-ve.index);let Xe=ve.offset+ve.size+k;for(let Ke=ve.index+1;Ke<=ve.index+be;Ke++){const Qe=(G=(H=go(me,Ke,Ke)[0])==null?void 0:H.value)!=null?G:ve.size;De.push({data:O==null?void 0:O[Ke],index:Ke,offset:Xe,size:Qe}),Xe+=Qe+k}}}return Ru(De,de,b,k,Q,_)}),fe(T=>T!==null),rt()),uh);ce(W(e,fe(Z0),re(T=>T==null?void 0:T.length)),s),ce(W(A,re(T=>T.topListHeight)),d),ce(d,i),ce(W(A,re(T=>[T.top,T.bottom])),o),ce(W(A,re(T=>T.items)),v);const C=mr(W(A,fe(({items:T})=>T.length>0),Te(s,e),fe(([{items:T},m])=>T[T.length-1].originalIndex===m-1),re(([,T,m])=>[T-1,m]),rt(lc),re(([T])=>T))),D=mr(W(A,Hn(200),fe(({items:T,topItems:m})=>T.length>0&&T[0].originalIndex===m.length),re(({items:T})=>T[0].index),rt())),z=mr(W(A,fe(({items:T})=>T.length>0),re(({items:T})=>{let m=0,b=T.length-1;for(;T[m].type==="group"&&m<b;)m++;for(;T[b].type==="group"&&b>m;)b--;return{endIndex:T[b].index,startIndex:T[m].index}}),rt(Ex)));return{endReached:C,initialItemCount:E,itemsRendered:v,listState:A,minOverscanItemCount:w,rangeChanged:z,startReached:D,topItemsIndexes:g,...f}},tt(un,Sx,lh,pc,dc,mc,bs,sh),{singleton:!0}),Mx=$e(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:r,headerHeight:n},{listState:s}])=>{const a=Ue(),o=Rt(W(Et(r,e,n,t,s),re(([i,c,l,u,d])=>i+c+l+u+d.offsetBottom+d.bottom)),0);return ce(he(o),a),{totalListHeight:o,totalListHeightChanged:a}},tt(Wt,la),{singleton:!0}),Kj=$e(([{viewportHeight:e},{totalListHeight:t}])=>{const r=Y(!1),n=Rt(W(Et(r,e,t),fe(([s])=>s),re(([,s,a])=>Math.max(0,s-a)),Hn(0),rt()),0);return{alignToBottom:r,paddingTopAddition:n}},tt(Wt,Mx),{singleton:!0}),Nx=$e(()=>({context:Y(null)})),Yj=({itemBottom:e,itemTop:t,locationParams:{align:r,behavior:n,...s},viewportBottom:a,viewportTop:o})=>t<o?{...s,align:r??"start",behavior:n}:e>a?{...s,align:r??"end",behavior:n}:null,Lx=$e(([{gap:e,sizes:t,totalCount:r},{fixedFooterHeight:n,fixedHeaderHeight:s,headerHeight:a,scrollingInProgress:o,scrollTop:i,viewportHeight:c},{scrollToIndex:l}])=>{const u=Ue();return ce(W(u,Te(t,c,r,a,s,n,i),Te(e),re(([[d,f,h,y,g,E,v,w],A])=>{const{align:C,behavior:D,calculateViewLocation:z=Yj,done:T,...m}=d,b=Tx(d,f,y-1),x=uc(b,f.offsetTree,A)+g+E,S=x+Wr(f.sizeTree,b)[1],I=w+E,F=w+h-v,_=z({itemBottom:S,itemTop:x,locationParams:{align:C,behavior:D,...m},viewportBottom:F,viewportTop:I});return _?T&&Vr(W(o,fe(k=>!k),oa(at(o)?1:2)),T):T&&T(),_}),fe(d=>d!==null)),l),{scrollIntoView:u}},tt(un,Wt,dc,la,hs),{singleton:!0});function zx(e){return e?e==="smooth"?"smooth":"auto":!1}const Zj=(e,t)=>typeof e=="function"?zx(e(t)):t&&zx(e),Xj=$e(([{listRefresh:e,totalCount:t,fixedItemSize:r,data:n},{atBottomState:s,isAtBottom:a},{scrollToIndex:o},{scrolledToInitialItem:i},{didMount:c,propsReady:l},{log:u},{scrollingInProgress:d},{context:f},{scrollIntoView:h}])=>{const y=Y(!1),g=Ue();let E=null;function v(D){Ce(o,{align:"end",behavior:D,index:"LAST"})}je(W(Et(W(he(t),oa(1)),c),Te(he(y),a,i,d),re(([[D,z],T,m,b,x])=>{let S=z&&b,I="auto";return S&&(I=Zj(T,m||x),S=S&&!!I),{followOutputBehavior:I,shouldFollow:S,totalCount:D}}),fe(({shouldFollow:D})=>D)),({followOutputBehavior:D,totalCount:z})=>{E&&(E(),E=null),at(r)?requestAnimationFrame(()=>{at(u)("following output to ",{totalCount:z},nr.DEBUG),v(D)}):E=Vr(e,()=>{at(u)("following output to ",{totalCount:z},nr.DEBUG),v(D),E=null})});function w(D){const z=Vr(s,T=>{D&&!T.atBottom&&T.notAtBottomBecause==="SIZE_INCREASED"&&!E&&(at(u)("scrolling to bottom due to increased size",{},nr.DEBUG),v("auto"))});setTimeout(z,100)}je(W(Et(he(y),t,l),fe(([D,,z])=>D&&z),ln(({value:D},[,z])=>({refreshed:D===z,value:z}),{refreshed:!1,value:0}),fe(({refreshed:D})=>D),Te(y,t)),([,D])=>{at(i)&&w(D!==!1)}),je(g,()=>{w(at(y)!==!1)}),je(Et(he(y),s),([D,z])=>{D&&!z.atBottom&&z.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&v("auto")});const A=Y(null),C=Ue();return ce(Q0(W(he(n),re(D=>{var z;return(z=D==null?void 0:D.length)!=null?z:0})),W(he(t))),C),je(W(Et(W(C,oa(1)),c),Te(he(A),i,d,f),re(([[D,z],T,m,b,x])=>z&&m&&(T==null?void 0:T({context:x,totalCount:D,scrollingInProgress:b}))),fe(D=>!!D),Hn(0)),D=>{E&&(E(),E=null),at(r)?requestAnimationFrame(()=>{at(u)("scrolling into view",{}),Ce(h,D)}):E=Vr(e,()=>{at(u)("scrolling into view",{}),Ce(h,D),E=null})}),{autoscrollToBottom:g,followOutput:y,scrollIntoViewOnChange:A}},tt(un,mc,dc,pc,bs,hs,Wt,Nx,Lx)),Qj=$e(([{data:e,firstItemIndex:t,gap:r,sizes:n},{initialTopMostItemIndex:s},{initialItemCount:a,listState:o},{didMount:i}])=>(ce(W(i,Te(a),fe(([,c])=>c!==0),Te(s,n,t,r,e),re(([[,c],l,u,d,f,h=[]])=>Ox(c,l,u,d,f,h))),o),{}),tt(un,pc,la,bs),{singleton:!0}),Jj=$e(([{didMount:e},{scrollTo:t},{listState:r}])=>{const n=Y(0);return je(W(e,Te(n),fe(([,s])=>s!==0),re(([,s])=>({top:s}))),s=>{Vr(W(r,oa(1),fe(a=>a.items.length>1)),()=>{requestAnimationFrame(()=>{Ce(t,s)})})}),{initialScrollTop:n}},tt(bs,Wt,la),{singleton:!0}),Rx=$e(([{scrollVelocity:e}])=>{const t=Y(!1),r=Ue(),n=Y(!1);return ce(W(e,Te(n,t,r),fe(([s,a])=>!!a),re(([s,a,o,i])=>{const{enter:c,exit:l}=a;if(o){if(l(s,i))return!1}else if(c(s,i))return!0;return o}),rt()),t),je(W(Et(t,e,r),Te(n)),([[s,a,o],i])=>{s&&i&&i.change&&i.change(a,o)}),{isSeeking:t,scrollSeekConfiguration:n,scrollSeekRangeChanged:r,scrollVelocity:e}},tt(mc),{singleton:!0}),dh=$e(([{scrollContainerState:e,scrollTo:t}])=>{const r=Ue(),n=Ue(),s=Ue(),a=Y(!1),o=Y(void 0);return ce(W(Et(r,n),re(([{scrollHeight:i,scrollTop:c,viewportHeight:l},{offsetTop:u}])=>({scrollHeight:i,scrollTop:Math.max(0,c-u),viewportHeight:l}))),e),ce(W(t,Te(n),re(([i,{offsetTop:c}])=>({...i,top:i.top+c}))),s),{customScrollParent:o,useWindowScroll:a,windowScrollContainerState:r,windowScrollTo:s,windowViewportRect:n}},tt(Wt)),eV=$e(([{sizeRanges:e,sizes:t},{headerHeight:r,scrollTop:n},{initialTopMostItemIndex:s},{didMount:a},{useWindowScroll:o,windowScrollContainerState:i,windowViewportRect:c}])=>{const l=Ue(),u=Y(void 0),d=Y(null),f=Y(null);return ce(i,d),ce(c,f),je(W(l,Te(t,n,o,d,f,r)),([h,y,g,E,v,w,A])=>{const C=Nj(y.sizeTree);E&&v!==null&&w!==null&&(g=v.scrollTop-w.offsetTop),g-=A,h({ranges:C,scrollTop:g})}),ce(W(u,fe(Z0),re(tV)),s),ce(W(a,Te(u),fe(([,h])=>h!==void 0),rt(),re(([,h])=>h.ranges)),e),{getState:l,restoreStateFrom:u}},tt(un,Wt,pc,bs,dh));function tV(e){return{align:"start",index:0,offset:e.scrollTop}}const rV=$e(([{topItemsIndexes:e}])=>{const t=Y(0);return ce(W(t,fe(r=>r>=0),re(r=>Array.from({length:r}).map((n,s)=>s))),e),{topItemCount:t}},tt(la));function Hx(e){let t=!1,r;return()=>(t||(t=!0,r=e()),r)}const nV=Hx(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),sV=$e(([{deviation:e,scrollBy:t,scrollingInProgress:r,scrollTop:n},{isAtBottom:s,isScrolling:a,lastJumpDueToItemResize:o,scrollDirection:i},{listState:c},{beforeUnshiftWith:l,gap:u,shiftWithOffset:d,sizes:f},{log:h},{recalcInProgress:y}])=>{const g=mr(W(c,Te(o),ln(([,v,w,A],[{bottom:C,items:D,offsetBottom:z,totalCount:T},m])=>{const b=C+z;let x=0;return w===T&&v.length>0&&D.length>0&&(D[0].originalIndex===0&&v[0].originalIndex===0||(x=b-A,x!==0&&(x+=m))),[x,D,T,b]},[0,[],0,0]),fe(([v])=>v!==0),Te(n,i,r,s,h,y),fe(([,v,w,A,,,C])=>!C&&!A&&v!==0&&w===fc),re(([[v],,,,,w])=>(w("Upward scrolling compensation",{amount:v},nr.DEBUG),v))));function E(v){v>0?(Ce(t,{behavior:"auto",top:-v}),Ce(e,0)):(Ce(e,0),Ce(t,{behavior:"auto",top:-v}))}return je(W(g,Te(e,a)),([v,w,A])=>{A&&nV()?Ce(e,w-v):E(-v)}),je(W(Et(Rt(a,!1),e,y),fe(([v,w,A])=>!v&&!A&&w!==0),re(([v,w])=>w),Hn(1)),E),ce(W(d,re(v=>({top:-v}))),t),je(W(l,Te(f,u),re(([v,{groupIndices:w,lastSize:A,sizeTree:C},D])=>{function z(T){return T*(A+D)}if(w.length===0)return z(v);{let T=0;const m=cc(C,0);let b=0,x=0;for(;b<v;){b++,T+=m;let S=w.length===x+1?1/0:w[x+1]-w[x]-1;b+S>v&&(T-=m,S=v-b+1),b+=S,T+=z(S),x++}return T}})),v=>{Ce(e,v),requestAnimationFrame(()=>{Ce(t,{top:v}),requestAnimationFrame(()=>{Ce(e,0),Ce(y,!1)})})}),{deviation:e}},tt(Wt,mc,la,un,hs,sh)),aV=$e(([e,t,r,n,s,a,o,i,c,l,u])=>({...e,...t,...r,...n,...s,...a,...o,...i,...c,...l,...u}),tt(lh,Qj,bs,Rx,Mx,Jj,Kj,dh,Lx,hs,Nx)),$x=$e(([{data:e,defaultItemSize:t,firstItemIndex:r,fixedItemSize:n,fixedGroupSize:s,gap:a,groupIndices:o,heightEstimates:i,itemSize:c,sizeRanges:l,sizes:u,statefulTotalCount:d,totalCount:f,trackItemSizes:h},{initialItemFinalLocationReached:y,initialTopMostItemIndex:g,scrolledToInitialItem:E},v,w,A,C,{scrollToIndex:D},z,{topItemCount:T},{groupCounts:m},b])=>{const{listState:x,minOverscanItemCount:S,topItemsIndexes:I,rangeChanged:F,..._}=C;return ce(F,b.scrollSeekRangeChanged),ce(W(b.windowViewportRect,re(k=>k.visibleHeight)),v.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:r,fixedItemHeight:n,fixedGroupHeight:s,gap:a,groupCounts:m,heightEstimates:i,initialItemFinalLocationReached:y,initialTopMostItemIndex:g,scrolledToInitialItem:E,sizeRanges:l,topItemCount:T,topItemsIndexes:I,totalCount:f,...A,groupIndices:o,itemSize:c,listState:x,minOverscanItemCount:S,scrollToIndex:D,statefulTotalCount:d,trackItemSizes:h,rangeChanged:F,..._,...b,...v,sizes:u,...w}},tt(un,pc,Wt,eV,Xj,la,dc,sV,rV,Sx,aV));function oV(e,t){const r={},n={};let s=0;const a=e.length;for(;s<a;)n[e[s]]=1,s+=1;for(const o in t)Object.hasOwn(n,o)||(r[o]=t[o]);return r}const Hu=typeof document<"u"?M.useLayoutEffect:M.useEffect;function Gx(e,t,r){const n=Object.keys(t.required||{}),s=Object.keys(t.optional||{}),a=Object.keys(t.methods||{}),o=Object.keys(t.events||{}),i=M.createContext({});function c(E,v){E.propsReady&&Ce(E.propsReady,!1);for(const w of n){const A=E[t.required[w]];Ce(A,v[w])}for(const w of s)if(w in v){const A=E[t.optional[w]];Ce(A,v[w])}E.propsReady&&Ce(E.propsReady,!0)}function l(E){return a.reduce((v,w)=>(v[w]=A=>{const C=E[t.methods[w]];Ce(C,A)},v),{})}function u(E){return o.reduce((v,w)=>(v[w]=Ej(E[t.events[w]]),v),{})}const d=M.forwardRef((E,v)=>{const{children:w,...A}=E,[C]=M.useState(()=>Mu(Cj(e),T=>{c(T,A)})),[D]=M.useState(dx(u,C));Hu(()=>{for(const T of o)T in A&&je(D[T],A[T]);return()=>{Object.values(D).map(X0)}},[A,D,C]),Hu(()=>{c(C,A)}),M.useImperativeHandle(v,lx(l(C)));const z=r;return B.jsx(i.Provider,{value:C,children:r?B.jsx(z,{...oV([...n,...s,...o],A),children:w}):w})}),f=E=>{const v=M.useContext(i);return M.useCallback(w=>{Ce(v[E],w)},[v,E])},h=E=>{const v=M.useContext(i)[E],w=M.useCallback(A=>je(v,A),[v]);return M.useSyncExternalStore(w,()=>at(v),()=>at(v))},y=E=>{const v=M.useContext(i)[E],[w,A]=M.useState(dx(at,v));return Hu(()=>je(v,C=>{C!==w&&A(lx(C))}),[v,w]),w},g=M.version.startsWith("18")?h:y;return{Component:d,useEmitter:(E,v)=>{const w=M.useContext(i)[E];Hu(()=>je(w,v),[v,w])},useEmitterValue:g,usePublisher:f}}const jx=M.createContext(void 0),Vx=M.createContext(void 0),Wx=typeof document<"u"?M.useLayoutEffect:M.useEffect;function ph(e){return"self"in e}function iV(e){return"body"in e}function qx(e,t,r,n=bo,s,a){const o=M.useRef(null),i=M.useRef(null),c=M.useRef(null),l=M.useCallback(f=>{let h,y,g;const E=f.target;if(iV(E)||ph(E)){const w=ph(E)?E:E.defaultView;g=a?w.scrollX:w.scrollY,h=a?w.document.documentElement.scrollWidth:w.document.documentElement.scrollHeight,y=a?w.innerWidth:w.innerHeight}else g=a?E.scrollLeft:E.scrollTop,h=a?E.scrollWidth:E.scrollHeight,y=a?E.offsetWidth:E.offsetHeight;const v=()=>{e({scrollHeight:h,scrollTop:Math.max(g,0),viewportHeight:y})};f.suppressFlushSync?v():As.flushSync(v),i.current!==null&&(g===i.current||g<=0||g===h-y)&&(i.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))},[e,t,a]);M.useEffect(()=>{const f=s||o.current;return n(s||o.current),l({suppressFlushSync:!0,target:f}),f.addEventListener("scroll",l,{passive:!0}),()=>{n(null),f.removeEventListener("scroll",l)}},[o,l,r,n,s]);function u(f){const h=o.current;if(!h||(a?"offsetWidth"in h&&h.offsetWidth===0:"offsetHeight"in h&&h.offsetHeight===0))return;const y=f.behavior==="smooth";let g,E,v;ph(h)?(E=Math.max(ms(h.document.documentElement,a?"width":"height"),a?h.document.documentElement.scrollWidth:h.document.documentElement.scrollHeight),g=a?h.innerWidth:h.innerHeight,v=a?window.scrollX:window.scrollY):(E=h[a?"scrollWidth":"scrollHeight"],g=ms(h,a?"width":"height"),v=h[a?"scrollLeft":"scrollTop"]);const w=E-g;if(f.top=Math.ceil(Math.max(Math.min(w,f.top),0)),Ix(g,E)||f.top===v){e({scrollHeight:E,scrollTop:v,viewportHeight:g}),y&&t(!0);return}y?(i.current=f.top,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,i.current=null,t(!0)},1e3)):i.current=null,a&&(f={behavior:f.behavior,left:f.top}),h.scrollTo(f)}function d(f){a&&(f={behavior:f.behavior,left:f.top}),o.current.scrollBy(f)}return{scrollByCallback:d,scrollerRef:o,scrollToCallback:u}}const fh="-webkit-sticky",Kx="sticky",hh=Hx(()=>{if(typeof document>"u")return Kx;const e=document.createElement("div");return e.style.position=fh,e.style.position===fh?fh:Kx});function mh(e){return e}const cV=$e(()=>{const e=Y(i=>`Item ${i}`),t=Y(i=>`Group ${i}`),r=Y({}),n=Y(mh),s=Y("div"),a=Y(bo),o=(i,c=null)=>Rt(W(r,re(l=>l[i]),rt()),c);return{components:r,computeItemKey:n,EmptyPlaceholder:o("EmptyPlaceholder"),FooterComponent:o("Footer"),GroupComponent:o("Group","div"),groupContent:t,HeaderComponent:o("Header"),HeaderFooterTag:s,ItemComponent:o("Item","div"),itemContent:e,ListComponent:o("List","div"),ScrollerComponent:o("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:o("ScrollSeekPlaceholder"),TopItemListComponent:o("TopItemList")}}),lV=$e(([e,t])=>({...e,...t}),tt($x,cV)),uV=({height:e})=>B.jsx("div",{style:{height:e}}),dV={overflowAnchor:"none",position:hh(),zIndex:1},Yx={overflowAnchor:"none"},pV={...Yx,display:"inline-block",height:"100%"},Zx=M.memo(function({showTopList:e=!1}){const t=ge("listState"),r=Sr("sizeRanges"),n=ge("useWindowScroll"),s=ge("customScrollParent"),a=Sr("windowScrollContainerState"),o=Sr("scrollContainerState"),i=s||n?a:o,c=ge("itemContent"),l=ge("context"),u=ge("groupContent"),d=ge("trackItemSizes"),f=ge("itemSize"),h=ge("log"),y=Sr("gap"),g=ge("horizontalDirection"),{callbackRef:E}=Sj(r,f,d,e?bo:i,h,y,s,g,ge("skipAnimationFrameInResizeObserver")),[v,w]=M.useState(0);bh("deviation",_=>{v!==_&&w(_)});const A=ge("EmptyPlaceholder"),C=ge("ScrollSeekPlaceholder")||uV,D=ge("ListComponent"),z=ge("ItemComponent"),T=ge("GroupComponent"),m=ge("computeItemKey"),b=ge("isSeeking"),x=ge("groupIndices").length>0,S=ge("alignToBottom"),I=ge("initialItemFinalLocationReached"),F=e?{}:{boxSizing:"border-box",...g?{display:"inline-block",height:"100%",marginLeft:v!==0?v:S?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:v!==0?v:S?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...I?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&A?B.jsx(A,{...Ht(A,l)}):B.jsx(D,{...Ht(D,l),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:E,style:F,children:(e?t.topItems:t.items).map(_=>{const k=_.originalIndex,P=m(k+t.firstItemIndex,_.data,l);return b?M.createElement(C,{...Ht(C,l),height:_.size,index:_.index,key:P,type:_.type||"item",..._.type==="group"?{}:{groupIndex:_.groupIndex}}):_.type==="group"?M.createElement(T,{...Ht(T,l),"data-index":k,"data-item-index":_.index,"data-known-size":_.size,key:P,style:dV},u(_.index,l)):M.createElement(z,{...Ht(z,l),...bV(z,_.data),"data-index":k,"data-item-group-index":_.groupIndex,"data-item-index":_.index,"data-known-size":_.size,key:P,style:g?pV:Yx},x?c(_.index,_.groupIndex,_.data,l):c(_.index,_.data,l))})})}),fV={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},hV={outline:"none",overflowX:"auto",position:"relative"},$u=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),mV={position:hh(),top:0,width:"100%",zIndex:1};function Ht(e,t){if(typeof e!="string")return{context:t}}function bV(e,t){return{item:typeof e=="string"?void 0:t}}const yV=M.memo(function(){const e=ge("HeaderComponent"),t=Sr("headerHeight"),r=ge("HeaderFooterTag"),n=ia(M.useMemo(()=>a=>{t(ms(a,"height"))},[t]),!0,ge("skipAnimationFrameInResizeObserver")),s=ge("context");return e?B.jsx(r,{ref:n,children:B.jsx(e,{...Ht(e,s)})}):null}),gV=M.memo(function(){const e=ge("FooterComponent"),t=Sr("footerHeight"),r=ge("HeaderFooterTag"),n=ia(M.useMemo(()=>a=>{t(ms(a,"height"))},[t]),!0,ge("skipAnimationFrameInResizeObserver")),s=ge("context");return e?B.jsx(r,{ref:n,children:B.jsx(e,{...Ht(e,s)})}):null});function Xx({useEmitter:e,useEmitterValue:t,usePublisher:r}){return M.memo(function({children:n,style:s,context:a,...o}){const i=r("scrollContainerState"),c=t("ScrollerComponent"),l=r("smoothScrollTargetReached"),u=t("scrollerRef"),d=t("horizontalDirection")||!1,{scrollByCallback:f,scrollerRef:h,scrollToCallback:y}=qx(i,l,c,u,void 0,d);return e("scrollTo",y),e("scrollBy",f),B.jsx(c,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:h,style:{...d?hV:fV,...s},tabIndex:0,...o,...Ht(c,a),children:n})})}function Qx({useEmitter:e,useEmitterValue:t,usePublisher:r}){return M.memo(function({children:n,style:s,context:a,...o}){const i=r("windowScrollContainerState"),c=t("ScrollerComponent"),l=r("smoothScrollTargetReached"),u=t("totalListHeight"),d=t("deviation"),f=t("customScrollParent"),h=M.useRef(null),y=t("scrollerRef"),{scrollByCallback:g,scrollerRef:E,scrollToCallback:v}=qx(i,l,c,y,f);return Wx(()=>{var w;return E.current=f||((w=h.current)==null?void 0:w.ownerDocument.defaultView),()=>{E.current=null}},[E,f]),e("windowScrollTo",v),e("scrollBy",g),B.jsx(c,{ref:h,"data-virtuoso-scroller":!0,style:{position:"relative",...s,...u!==0?{height:u+d}:{}},...o,...Ht(c,a),children:n})})}const xV=({children:e})=>{const t=M.useContext(jx),r=Sr("viewportHeight"),n=Sr("fixedItemHeight"),s=ge("alignToBottom"),a=ge("horizontalDirection"),o=M.useMemo(()=>ux(r,c=>ms(c,a?"width":"height")),[r,a]),i=ia(o,!0,ge("skipAnimationFrameInResizeObserver"));return M.useEffect(()=>{t&&(r(t.viewportHeight),n(t.itemHeight))},[t,r,n]),B.jsx("div",{"data-viewport-type":"element",ref:i,style:$u(s),children:e})},wV=({children:e})=>{const t=M.useContext(jx),r=Sr("windowViewportRect"),n=Sr("fixedItemHeight"),s=ge("customScrollParent"),a=mx(r,s,ge("skipAnimationFrameInResizeObserver")),o=ge("alignToBottom");return M.useEffect(()=>{t&&(n(t.itemHeight),r({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,r,n]),B.jsx("div",{"data-viewport-type":"window",ref:a,style:$u(o),children:e})},vV=({children:e})=>{const t=ge("TopItemListComponent")||"div",r=ge("headerHeight"),n={...mV,marginTop:`${r}px`},s=ge("context");return B.jsx(t,{style:n,...Ht(t,s),children:e})},EV=M.memo(function(e){const t=ge("useWindowScroll"),r=ge("topItemsIndexes").length>0,n=ge("customScrollParent"),s=ge("context");return B.jsxs(n||t?TV:CV,{...e,context:s,children:[r&&B.jsx(vV,{children:B.jsx(Zx,{showTopList:!0})}),B.jsxs(n||t?wV:xV,{children:[B.jsx(yV,{}),B.jsx(Zx,{}),B.jsx(gV,{})]})]})}),{Component:kV,useEmitter:bh,useEmitterValue:ge,usePublisher:Sr}=Gx(lV,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},EV),CV=Xx({useEmitter:bh,useEmitterValue:ge,usePublisher:Sr}),TV=Qx({useEmitter:bh,useEmitterValue:ge,usePublisher:Sr}),AV=kV;tt($x,$e(()=>{const e=Y(l=>B.jsxs("td",{children:["Item $",l]})),t=Y(null),r=Y(l=>B.jsxs("td",{colSpan:1e3,children:["Group ",l]})),n=Y(null),s=Y(null),a=Y({}),o=Y(mh),i=Y(bo),c=(l,u=null)=>Rt(W(a,re(d=>d[l]),rt()),u);return{components:a,computeItemKey:o,context:t,EmptyPlaceholder:c("EmptyPlaceholder"),FillerRow:c("FillerRow"),fixedFooterContent:s,fixedHeaderContent:n,itemContent:e,groupContent:r,ScrollerComponent:c("Scroller","div"),scrollerRef:i,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder"),TableBodyComponent:c("TableBody","tbody"),TableComponent:c("Table","table"),TableFooterComponent:c("TableFoot","tfoot"),TableHeadComponent:c("TableHead","thead"),TableRowComponent:c("TableRow","tr"),GroupComponent:c("Group","tr")}})),hh();const Jx={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},SV={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:e5,floor:Gu,max:gc,min:yh,round:t5}=Math;function r5(e,t,r){return Array.from({length:t-e+1}).map((n,s)=>({data:r===null?null:r[s+e],index:s+e}))}function PV(e){return{...SV,items:e}}function ju(e,t){return e&&e.width===t.width&&e.height===t.height}function IV(e,t){return e&&e.column===t.column&&e.row===t.row}const BV=$e(([{increaseViewportBy:e,listBoundary:t,overscan:r,visibleRange:n},{footerHeight:s,headerHeight:a,scrollBy:o,scrollContainerState:i,scrollTo:c,scrollTop:l,smoothScrollTargetReached:u,viewportHeight:d},f,h,{didMount:y,propsReady:g},{customScrollParent:E,useWindowScroll:v,windowScrollContainerState:w,windowScrollTo:A,windowViewportRect:C},D])=>{const z=Y(0),T=Y(0),m=Y(Jx),b=Y({height:0,width:0}),x=Y({height:0,width:0}),S=Ue(),I=Ue(),F=Y(0),_=Y(null),k=Y({column:0,row:0}),P=Ue(),O=Ue(),U=Y(!1),L=Y(0),H=Y(!0),G=Y(!1),Q=Y(!1);je(W(y,Te(L),fe(([X,we])=>!!we)),()=>{Ce(H,!1)}),je(W(Et(y,H,x,b,L,G),fe(([X,we,De,Ge,,it])=>X&&!we&&De.height!==0&&Ge.height!==0&&!it)),([,,,,X])=>{Ce(G,!0),ih(1,()=>{Ce(S,X)}),Vr(W(l),()=>{Ce(t,[0,0]),Ce(H,!0)})}),ce(W(O,fe(X=>X!=null&&X.scrollTop>0),cn(0)),T),je(W(y,Te(O),fe(([,X])=>X!=null)),([,X])=>{X&&(Ce(b,X.viewport),Ce(x,X.item),Ce(k,X.gap),X.scrollTop>0&&(Ce(U,!0),Vr(W(l,oa(1)),we=>{Ce(U,!1)}),Ce(c,{top:X.scrollTop})))}),ce(W(b,re(({height:X})=>X)),d),ce(W(Et(he(b,ju),he(x,ju),he(k,(X,we)=>X&&X.column===we.column&&X.row===we.row),he(l)),re(([X,we,De,Ge])=>({gap:De,item:we,scrollTop:Ge,viewport:X}))),P),ce(W(Et(he(z),n,he(k,IV),he(x,ju),he(b,ju),he(_),he(T),he(U),he(H),he(L)),fe(([,,,,,,,X])=>!X),re(([X,[we,De],Ge,it,Ae,ve,be,,Xe,Ke])=>{const{column:Qe,row:Br}=Ge,{height:Ot,width:kh}=it,{width:I5}=Ae;if(be===0&&(X===0||I5===0))return Jx;if(kh===0){const D5=ch(Ke,X),MW=D5+Math.max(be-1,0);return PV(r5(D5,MW,ve))}const qu=n5(I5,kh,Qe);let Fo,Ea;Xe?we===0&&De===0&&be>0?(Fo=0,Ea=be-1):(Fo=qu*Gu((we+Br)/(Ot+Br)),Ea=qu*e5((De+Br)/(Ot+Br))-1,Ea=yh(X-1,gc(Ea,qu-1)),Fo=yh(Ea,gc(0,Fo))):(Fo=0,Ea=-1);const B5=r5(Fo,Ea,ve),{bottom:F5,top:U5}=s5(Ae,Ge,it,B5),O5=e5(X/qu),_W=O5*Ot+(O5-1)*Br-F5;return{bottom:F5,itemHeight:Ot,items:B5,itemWidth:kh,offsetBottom:_W,offsetTop:U5,top:U5}})),m),ce(W(_,fe(X=>X!==null),re(X=>X.length)),z),ce(W(Et(b,x,m,k),fe(([X,we,{items:De}])=>De.length>0&&we.height!==0&&X.height!==0),re(([X,we,{items:De},Ge])=>{const{bottom:it,top:Ae}=s5(X,Ge,we,De);return[Ae,it]}),rt(lc)),t);const pe=Y(!1);ce(W(l,Te(pe),re(([X,we])=>we||X!==0)),pe);const me=mr(W(Et(m,z),fe(([{items:X}])=>X.length>0),Te(pe),fe(([[X,we],De])=>{const Ge=X.items[X.items.length-1].index===we-1;return(De||X.bottom>0&&X.itemHeight>0&&X.offsetBottom===0&&X.items.length===we)&&Ge}),re(([[,X]])=>X-1),rt())),ie=mr(W(he(m),fe(({items:X})=>X.length>0&&X[0].index===0),cn(0),rt())),de=mr(W(he(m),Te(U),fe(([{items:X},we])=>X.length>0&&!we),re(([{items:X}])=>({endIndex:X[X.length-1].index,startIndex:X[0].index})),rt(Ex),Hn(0)));ce(de,h.scrollSeekRangeChanged),ce(W(S,Te(b,x,z,k),re(([X,we,De,Ge,it])=>{const Ae=Px(X),{align:ve,behavior:be,offset:Xe}=Ae;let Ke=Ae.index;Ke==="LAST"&&(Ke=Ge-1),Ke=gc(0,Ke,yh(Ge-1,Ke));let Qe=gh(we,it,De,Ke);return ve==="end"?Qe=t5(Qe-we.height+De.height):ve==="center"&&(Qe=t5(Qe-we.height/2+De.height/2)),Xe&&(Qe+=Xe),{behavior:be,top:Qe}})),c);const Be=Rt(W(m,re(X=>X.offsetBottom+X.bottom)),0);return ce(W(C,re(X=>({height:X.visibleHeight,width:X.visibleWidth}))),b),{customScrollParent:E,data:_,deviation:F,footerHeight:s,gap:k,headerHeight:a,increaseViewportBy:e,initialItemCount:T,itemDimensions:x,overscan:r,restoreStateFrom:O,scrollBy:o,scrollContainerState:i,scrollHeight:I,scrollTo:c,scrollToIndex:S,scrollTop:l,smoothScrollTargetReached:u,totalCount:z,useWindowScroll:v,viewportDimensions:b,windowScrollContainerState:w,windowScrollTo:A,windowViewportRect:C,...h,gridState:m,horizontalDirection:Q,initialTopMostItemIndex:L,totalListHeight:Be,...f,endReached:me,propsReady:g,rangeChanged:de,startReached:ie,stateChanged:P,stateRestoreInProgress:U,...D}},tt(lh,Wt,mc,Rx,bs,dh,hs));function n5(e,t,r){return gc(1,Gu((e+r)/(Gu(t)+r)))}function s5(e,t,r,n){const{height:s}=r;if(s===void 0||n.length===0)return{bottom:0,top:0};const a=gh(e,t,r,n[0].index);return{bottom:gh(e,t,r,n[n.length-1].index)+s,top:a}}function gh(e,t,r,n){const s=n5(e.width,r.width,t.column),a=Gu(n/s),o=a*r.height+gc(0,a-1)*t.row;return o>0?o+t.row:o}const FV=$e(()=>{const e=Y(d=>`Item ${d}`),t=Y({}),r=Y(null),n=Y("virtuoso-grid-item"),s=Y("virtuoso-grid-list"),a=Y(mh),o=Y("div"),i=Y(bo),c=(d,f=null)=>Rt(W(t,re(h=>h[d]),rt()),f),l=Y(!1),u=Y(!1);return ce(he(u),l),{components:t,computeItemKey:a,context:r,FooterComponent:c("Footer"),HeaderComponent:c("Header"),headerFooterTag:o,itemClassName:n,ItemComponent:c("Item","div"),itemContent:e,listClassName:s,ListComponent:c("List","div"),readyStateChanged:l,reportReadyState:u,ScrollerComponent:c("Scroller","div"),scrollerRef:i,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder","div")}}),UV=$e(([e,t])=>({...e,...t}),tt(BV,FV)),OV=M.memo(function(){const e=ot("gridState"),t=ot("listClassName"),r=ot("itemClassName"),n=ot("itemContent"),s=ot("computeItemKey"),a=ot("isSeeking"),o=Pr("scrollHeight"),i=ot("ItemComponent"),c=ot("ListComponent"),l=ot("ScrollSeekPlaceholder"),u=ot("context"),d=Pr("itemDimensions"),f=Pr("gap"),h=ot("log"),y=ot("stateRestoreInProgress"),g=Pr("reportReadyState"),E=ia(M.useMemo(()=>v=>{const w=v.parentElement.parentElement.scrollHeight;o(w);const A=v.firstChild;if(A){const{height:C,width:D}=A.getBoundingClientRect();d({height:C,width:D})}f({column:o5("column-gap",getComputedStyle(v).columnGap,h),row:o5("row-gap",getComputedStyle(v).rowGap,h)})},[o,d,f,h]),!0,!1);return Wx(()=>{e.itemHeight>0&&e.itemWidth>0&&g(!0)},[e]),y?null:B.jsx(c,{className:t,ref:E,...Ht(c,u),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(v=>{const w=s(v.index,v.data,u);return a?B.jsx(l,{...Ht(l,u),height:e.itemHeight,index:v.index,width:e.itemWidth},w):M.createElement(i,{...Ht(i,u),className:r,"data-index":v.index,key:w},n(v.index,v.data,u))})})}),DV=M.memo(function(){const e=ot("HeaderComponent"),t=Pr("headerHeight"),r=ot("headerFooterTag"),n=ia(M.useMemo(()=>a=>{t(ms(a,"height"))},[t]),!0,!1),s=ot("context");return e?B.jsx(r,{ref:n,children:B.jsx(e,{...Ht(e,s)})}):null}),_V=M.memo(function(){const e=ot("FooterComponent"),t=Pr("footerHeight"),r=ot("headerFooterTag"),n=ia(M.useMemo(()=>a=>{t(ms(a,"height"))},[t]),!0,!1),s=ot("context");return e?B.jsx(r,{ref:n,children:B.jsx(e,{...Ht(e,s)})}):null}),MV=({children:e})=>{const t=M.useContext(Vx),r=Pr("itemDimensions"),n=Pr("viewportDimensions"),s=ia(M.useMemo(()=>a=>{n(a.getBoundingClientRect())},[n]),!0,!1);return M.useEffect(()=>{t&&(n({height:t.viewportHeight,width:t.viewportWidth}),r({height:t.itemHeight,width:t.itemWidth}))},[t,n,r]),B.jsx("div",{ref:s,style:$u(!1),children:e})},NV=({children:e})=>{const t=M.useContext(Vx),r=Pr("windowViewportRect"),n=Pr("itemDimensions"),s=ot("customScrollParent"),a=mx(r,s,!1);return M.useEffect(()=>{t&&(n({height:t.itemHeight,width:t.itemWidth}),r({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,r,n]),B.jsx("div",{ref:a,style:$u(!1),children:e})},LV=M.memo(function({...e}){const t=ot("useWindowScroll"),r=ot("customScrollParent"),n=r||t?RV:zV,s=r||t?NV:MV,a=ot("context");return B.jsx(n,{...e,...Ht(n,a),children:B.jsxs(s,{children:[B.jsx(DV,{}),B.jsx(OV,{}),B.jsx(_V,{})]})})}),{useEmitter:a5,useEmitterValue:ot,usePublisher:Pr}=Gx(UV,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},LV),zV=Xx({useEmitter:a5,useEmitterValue:ot,usePublisher:Pr}),RV=Qx({useEmitter:a5,useEmitterValue:ot,usePublisher:Pr});function o5(e,t,r){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&r(`${e} was not resolved to pixel value correctly`,t,nr.WARN),t==="normal"?0:parseInt(t??"0",10)}var xh={},i5;function HV(){if(i5)return xh;i5=1;var e=lu.GenIcon;return xh.AiFillQuestionCircle=function(r){return e({tag:"svg",attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 708c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zm62.9-219.5a48.3 48.3 0 0 0-30.9 44.8V620c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8v-21.5c0-23.1 6.7-45.9 19.9-64.9 12.9-18.6 30.9-32.8 52.1-40.9 34-13.1 56-41.6 56-72.7 0-44.1-43.1-80-96-80s-96 35.9-96 80v7.6c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V420c0-39.3 17.2-76 48.4-103.3C430.4 290.4 470 276 512 276s81.6 14.5 111.6 40.7C654.8 344 672 380.7 672 420c0 57.8-38.1 109.8-97.1 132.5z"}}]})(r)},xh}var $V=HV();function GV({logo:e,className:t="",style:r={},alt:n="Token logo"}){const[s,a]=M.useState(!1);return M.useEffect(()=>{a(!1)},[e]),e&&!s?B.jsx("img",{alt:n,style:r,onError:()=>a(!0),className:`twap-token-logo ${t}`,src:e}):B.jsx($V.AiFillQuestionCircle,{style:{width:20,height:20},className:"twap-token-svg"})}const jV=()=>B.jsx("div",{className:"twap-orders__loader",children:B.jsx("p",{children:"Loading..."})}),VV=()=>{const{isLoading:e}=Ou(),t=nx(),r=te(a=>a.state.orderIdsToCancel),n=te(a=>a.state.cancelOrdersMode),s=sx();return B.jsx(B.Fragment,{children:e?B.jsx(jV,{}):t!=null&&t.length?B.jsx("div",{className:`twap-orders__list ${n?"twap-orders__list-select-mode":""}`,children:B.jsx(AV,{style:{height:"100%"},data:t,itemContent:(a,o)=>B.jsx(WV,{cancelOrdersMode:!!n,selected:(r==null?void 0:r.includes(o.id))||!1,selectOrder:s,order:o},a)})}):B.jsx(qV,{})})},WV=({order:e,selectOrder:t,selected:r,cancelOrdersMode:n})=>{const s=te(i=>i.updateState),a=xt.useCallback(()=>{s({selectedOrderID:e==null?void 0:e.id})},[s,e==null?void 0:e.id]),o=xt.useCallback(()=>{n?t(e==null?void 0:e.id):a()},[n,t,a,e==null?void 0:e.id]);return B.jsx("div",{className:`twap-orders__list-item twap-orders__list-item-${e.status} ${n?"twap-orders__list-item-select-mode":""} ${r?"twap-orders__list-item-selected":""}`,onClick:o,children:B.jsxs("div",{className:"twap-orders__list-item-content",children:[B.jsx(KV,{order:e}),B.jsx(YV,{value:e.progress||0}),B.jsxs("div",{className:"twap-orders__list-item-tokens",children:[B.jsx(c5,{address:e.srcTokenAddress}),B.jsx(bj.HiArrowRight,{className:"twap-orders__list-item-tokens-arrow"}),B.jsx(c5,{address:e.dstTokenAddress})]})]})})},qV=()=>{const e=te(n=>n.state.orderHistoryStatusFilter),t=Me(),r=xt.useMemo(()=>e||"",[e]);return B.jsx("div",{className:"twap-orders__list-empty",children:B.jsx("p",{children:t("noOrders",{status:r})})})},KV=({order:e})=>{const t=e&&e.status,r=tx(e),n=V0(e.createdAt);return B.jsxs("div",{className:"twap-orders__list-item-header",children:[B.jsxs("p",{className:"twap-orders__list-item-header-title",children:[r," ",B.jsx("span",{children:`(${n})`})]}),B.jsx("p",{className:"twap-orders__list-item-header-status",children:t})]})},c5=e=>{const{useToken:t,components:r}=oe(),n=t==null?void 0:t(e.address);return B.jsx("div",{className:"twap-orders__list-item-token",children:n?B.jsxs(B.Fragment,{children:[B.jsx("div",{className:"twap-orders__list-item-token-logo",children:r.TokenLogo?B.jsx(r.TokenLogo,{token:n}):B.jsx(GV,{logo:n==null?void 0:n.logoUrl})}),B.jsx("p",{className:"twap-orders__list-item-token-symbol",children:n==null?void 0:n.symbol})]}):B.jsx("div",{})})};function YV(e){return B.jsxs("div",{className:"twap-orders__list-item-progress",children:[B.jsx("div",{className:"twap-orders__list-item-progress-bar",children:B.jsx("div",{className:"twap-orders__list-item-progress-bar-filled",style:{width:`${e.value}%`}})}),B.jsx("div",{className:"twap-orders__list-item-token-progress-label",children:B.jsx("p",{children:`${Math.round(e.value)}%`})})]})}const ZV=()=>{const e=te(r=>r.state.selectedOrderID),t=e!==void 0;return B.jsx("div",{className:`twap-orders ${e!==void 0?"twap-orders__show-selected":""}`,children:t?B.jsx(YG,{}):B.jsx(VV,{})})},XV=e=>{const t=Me(),{marketPrice:r,typedInputAmount:n}=oe();return M.useMemo(()=>{const{isError:a,value:o}=wm(e);if(!(!a||j(n||"0").isZero()||!r))return{type:Gt.MIN_FILL_DELAY,value:o,message:t("minFillDelayError",{fillDelay:`${Mf(o)} ${t("minutes")}`})}},[e,t,n,r])},ua=()=>{const{callbacks:e}=oe(),t=te(a=>a.state.typedFillDelay),r=te(a=>a.updateState),n=M.useMemo(()=>t||Fc,[t]),s=XV(n);return{fillDelay:n,onChange:M.useCallback(a=>{var o;r({typedFillDelay:a}),(o=e==null?void 0:e.onFillDelayChange)==null||o.call(e,a)},[r,e]),error:s,milliseconds:n.unit*n.value}},QV=()=>{const{onChange:e,fillDelay:t,error:r}=ua(),n=Me(),s=M.useCallback(o=>e({unit:t.unit,value:Number(o)}),[e,t]),a=M.useCallback(o=>e({unit:o,value:t.value}),[e,t]);return{onInputChange:s,onUnitSelect:a,onChange:e,milliseconds:t.unit*t.value,fillDelay:t,error:r,label:n("tradeIntervalTitle"),tooltip:n("tradeIntervalTooltip")}},dn=()=>{const{srcToken:e,typedInputAmount:t}=oe(),r=Me(),s=te(a=>a.state.acceptedSrcAmount)||t;return{amountWei:Y2(e==null?void 0:e.decimals,s),amountUI:s,error:j(s||0).isZero()?r("enterAmount"):void 0}},JV=(e,t)=>{const{module:r,srcUsd1Token:n,marketPrice:s,minChunkSizeUsd:a,typedInputAmount:o}=oe(),i=Me();return M.useMemo(()=>{if(j(o||"0").isZero()||!s||j(n||"0").isZero())return;if(!e)return{type:Gt.MIN_CHUNKS,value:1,message:i("minChunksError",{minChunks:"1"})};const{isError:c}=Em(e,t,r);if(c)return{type:Gt.MAX_CHUNKS,value:t,message:i("maxChunksError",{maxChunks:`${t}`})};const{isError:l,value:u}=vm(o||"",n||"",a||0);if(l)return{type:Gt.MIN_TRADE_SIZE,value:u,message:i("minTradeSizeError",{minTradeSize:`${u}`})}},[e,t,r,o,n,a,i,s])},qr=()=>{const{srcToken:e,srcUsd1Token:t,module:r,minChunkSizeUsd:n}=oe(),s=te(g=>g.state.typedChunks),a=ua().fillDelay,o=te(g=>g.updateState),{amountWei:i,amountUI:c}=dn(),l=M.useMemo(()=>um(a,c||"",t||"",n||0),[c,t,n,a]),u=M.useMemo(()=>lm(l,r,s),[l,s,r]),d=M.useCallback(g=>o({typedChunks:g}),[o]),f=M.useMemo(()=>fm(i||"",u),[i,u]),h=Rn(e==null?void 0:e.decimals,f),y=M.useMemo(()=>t?j(h||"0").times(t||0).toString():"0",[h,t]);return{totalTrades:u,maxTrades:l,amountPerTradeUI:h,amountPerTradeWei:f,amountPerTradeUsd:y,onChange:d,error:JV(u,l)}},eW=()=>{const{srcToken:e,dstToken:t}=oe(),r=Me(),{onChange:n,totalTrades:s,amountPerTradeUsd:a,amountPerTradeUI:o,error:i,maxTrades:c,amountPerTradeWei:l}=qr(),u=Ze({value:o}),d=Ze({value:a});return{error:i,maxTrades:c,totalTrades:s,amountPerTrade:u,amountPerTradeWei:l,onChange:n,label:r("tradesAmountTitle"),tooltip:r("totalTradesTooltip"),amountPerTradeUsd:d,fromToken:e,toToken:t}},tW=e=>{const{module:t,marketPrice:r}=oe(),n=Me();return M.useMemo(()=>{const s=gm(t,e),a=xm(e);if(r){if(s.isError)return{type:Gt.MAX_ORDER_DURATION,value:s.value,message:n("maxDurationError",{duration:`${Math.floor(n6(s.value)).toFixed(0)} ${n("days")}`})};if(a.isError)return{type:Gt.MIN_ORDER_DURATION,value:a.value,message:n("minDurationError",{duration:`${Math.floor(Mf(a.value)).toFixed(0)} ${n("minutes")}`})}}},[e,n,t,r])},wh=()=>{const{module:e,callbacks:t}=oe(),r=te(c=>c.state.typedDuration),n=te(c=>c.updateState),s=qr().totalTrades,a=ua().fillDelay,o=M.useMemo(()=>cm(e,s,a,r),[s,a,r,e]),i=tW(o);return{duration:o,setDuration:M.useCallback(c=>{var l;n({typedDuration:c}),(l=t==null?void 0:t.onDurationChange)==null||l.call(t,c)},[n,t]),error:i}},rW=()=>{const{module:e}=oe(),t=Me(),{duration:r,setDuration:n,error:s}=wh(),a=M.useCallback(c=>{n({unit:r.unit,value:Number(c)})},[n,r]),o=M.useCallback(c=>{n({unit:c,value:r.value})},[n,r]),i=M.useMemo(()=>e===ye.STOP_LOSS?t("stopLossDurationTooltip"):t("maxDurationTooltip"),[t,e]);return{duration:r,onChange:n,milliseconds:r.unit*r.value,onInputChange:a,onUnitSelect:o,label:t("expiry"),tooltip:i,error:s}},nW=()=>{const e=te(a=>a.state.isMarketOrder),{module:t}=oe(),r=Me(),n=M.useMemo(()=>{if(e&&t===ye.STOP_LOSS)return{text:r("triggerMarketPriceDisclaimer"),url:id}},[e,r,t]),s=M.useMemo(()=>{if(!(t!==ye.LIMIT&&t!==ye.TWAP))return{text:r(e?"marketOrderWarning":"limitPriceMessage"),url:"https://www.orbs.com/dtwap-and-dlimit-faq/"}},[e,r,t]);return n||s},Vu=()=>{const{srcToken:e,dstToken:t,marketPriceLoading:r}=oe(),n=te(l=>l.updateState),s=te(l=>l.state.isInvertedTrade),a=te(l=>l.state.typedTriggerPrice),o=te(l=>l.state.typedLimitPrice),i=te(l=>l.state.isMarketOrder);return{onInvert:M.useCallback(()=>{a!==void 0&&n({typedTriggerPrice:j(1).div(a).toFixed()}),o!==void 0&&n({typedLimitPrice:j(1).div(o).toFixed()}),n({isInvertedTrade:!s})},[n,s,a,o,r]),isInverted:s,fromToken:s?t:e,toToken:s?e:t,isMarketPrice:i}},l5=({typedValue:e,tokenDecimals:t=18,initialPrice:r="0",percentage:n,setValue:s,setPercentage:a})=>{const{srcUsd1Token:o,dstUsd1Token:i}=oe(),{isInverted:c}=Vu(),l=M.useMemo(()=>j((()=>{if(e!==void 0){const E=c?j(e).isZero()?j(0):j(1).div(e):j(e);return Bl(E.toFixed(),t)}if(n!==void 0&&j(r||"0").gt(0)&&!j(r||"0").isNaN()){const E=j(r||"0"),v=j(n||0).div(100);return E.plus(E.multipliedBy(v)).decimalPlaces(0).toFixed()}return j(r).gt(0)?r:""})()).decimalPlaces(0).toFixed(),[e,n,t,r,c]),u=M.useCallback(g=>{s(g),a(null)},[s,a]),d=M.useCallback(g=>{s(void 0),a(g)},[s,a]),f=M.useMemo(()=>{if(!r||j(r).isZero())return"";if(n!=null)return n;if(l){const g=j(r),v=j(l).minus(g).div(g).multipliedBy(100).decimalPlaces(2).toString();return j(v||"0").isZero()?"":v}return""},[l,r,n]),h=M.useMemo(()=>{let g="";if(e!==void 0)g=e;else{const E=Ii(l,t);if(j(E||"0").isZero())return"";g=c?j(1).div(E).toFixed():E}return g},[e,t,l,c]),y=aa(c?o:i,h||"0");return{amountWei:j(l).isNaN()?"":l,amountUI:j(h).isNaN()?"":h,selectedPercentage:f,onChange:u,onPercentageChange:d,isInverted:c,usd:j(y).isNaN()?"":y,isTypedValue:e!==void 0}},sW=()=>{const{module:e}=oe();return M.useMemo(()=>e===ye.STOP_LOSS?Jh:em,[e])},vh=()=>{const{module:e}=oe(),t=te(r=>r.state.isMarketOrder);return M.useMemo(()=>e!==ye.STOP_LOSS&&e!==ye.TAKE_PROFIT||t?void 0:e===ye.STOP_LOSS?tm:rm,[e,t])},aW=(e="")=>{const{module:t,marketPrice:r,typedInputAmount:n}=oe(),s=Me();return M.useMemo(()=>{if(j(n||"0").isZero()||!r||t!==ye.STOP_LOSS&&t!==ye.TAKE_PROFIT)return;const a=hm(r||"",e||"",t);if(a!=null&&a.isError)return{type:Gt.STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE,value:a.value,message:s("StopLossTriggerPriceError")||""};const o=mm(r||"",e||"",t);if(o!=null&&o.isError)return{type:Gt.TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE,value:o.value,message:s("TakeProfitTriggerPriceError")||""};if(!e||j(e||0).isZero())return{type:Gt.EMPTY_TRIGGER_PRICE,value:e,message:s("emptyTriggerPrice")||""}},[r,e,t,s,n])},oW=e=>{const{srcToken:t,dstToken:r,module:n,dstUsd1Token:s}=oe(),a=qr().amountPerTradeWei,o=te(l=>l.state.isMarketOrder),i=M.useMemo(()=>im(n,a,e,(t==null?void 0:t.decimals)||0),[e,a,o,t==null?void 0:t.decimals,n]),c=Rn((r==null?void 0:r.decimals)||0,i);return{amountWei:i,amountUI:c,usd:aa(c,s)}},da=()=>{const{dstToken:e,marketPrice:t,module:r,callbacks:n}=oe(),s=te(y=>y.updateState),a=sW(),o=te(y=>y.state.triggerPricePercent),i=o===void 0?a:o,c=r===ye.STOP_LOSS||r===ye.TAKE_PROFIT,l=l5({typedValue:te(y=>y.state.typedTriggerPrice),percentage:i,tokenDecimals:(e==null?void 0:e.decimals)||18,initialPrice:c?t:void 0,setValue:M.useCallback(y=>{var g;s({typedTriggerPrice:y}),(g=n==null?void 0:n.onTriggerPriceChange)==null||g.call(n,y||"")},[s,n]),setPercentage:M.useCallback(y=>{var g;s({triggerPricePercent:y}),(g=n==null?void 0:n.onTriggerPricePercentChange)==null||g.call(n,y||"")},[s,n])}),u=aW(l.amountWei),{amountWei:d,amountUI:f,usd:h}=oW(l.amountWei);return M.useMemo(()=>({...l,error:u,pricePerChunkWei:d,pricePerChunkUI:f,pricePerChunkUsd:h}),[l,u,d,f,h])},iW=()=>{const{module:e,marketPrice:t,marketPriceLoading:r}=oe(),n=Me(),{amountUI:s,onChange:a,onPercentageChange:o,usd:i,selectedPercentage:c,error:l,pricePerChunkUI:u,pricePerChunkUsd:d,isTypedValue:f}=da(),h=te(D=>D.state.isMarketOrder),y=te(D=>D.updateState),{isInverted:g,onInvert:E,fromToken:v,toToken:w}=Vu(),A=M.useCallback(()=>{y({triggerPricePercent:void 0,typedTriggerPrice:void 0})},[y]),C=e!==ye.STOP_LOSS&&e!==ye.TAKE_PROFIT;return{price:s,amountPerChunk:u,amountPerChunkUsd:d,error:l,label:n("stopLossLabel"),tooltip:e===ye.STOP_LOSS?n("stopLossTooltip"):n("takeProfitTooltip"),onChange:a,onPercentageChange:o,percentage:c,isActive:!h,onReset:A,usd:i,fromToken:v,toToken:w,prefix:"",isLoading:r||!t,isInverted:g,hide:C,onInvert:E,totalTrades:qr().totalTrades,isTypedValue:f}},cW=e=>{const{module:t,marketPrice:r,typedInputAmount:n}=oe(),s=Me(),{amountWei:a}=da(),o=te(i=>i.state.isMarketOrder);return M.useMemo(()=>{if(j(n||"0").isZero()||!a||!r)return;const i=bm(a,e,o,t),c=ym(a,e,o,t);if(i!=null&&i.isError)return{type:Gt.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE,message:s("triggerLimitPriceError")||"",value:i.value};if(c!=null&&c.isError)return{type:Gt.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE,message:s("triggerLimitPriceError")||"",value:c.value};if(e&&j(e||0).isZero())return{type:Gt.MISSING_LIMIT_PRICE,message:s("emptyLimitPrice")||"",value:e||""}},[e,s,a,t,o,n,r])},xc=()=>{const{dstToken:e,marketPrice:t,callbacks:r}=oe(),n=te(l=>l.updateState),s=vh(),a=te(l=>l.state.limitPricePercent),o=a===void 0?s:a,i=l5({typedValue:te(l=>l.state.typedLimitPrice),percentage:o,tokenDecimals:(e==null?void 0:e.decimals)||18,initialPrice:t,setValue:M.useCallback(l=>{var u;n({typedLimitPrice:l}),(u=r==null?void 0:r.onLimitPriceChange)==null||u.call(r,l||"")},[n,r]),setPercentage:M.useCallback(l=>{var u;n({limitPricePercent:l}),(u=r==null?void 0:r.onLimitPricePercentChange)==null||u.call(r,l||"")},[n,r])}),c=cW(i.amountWei);return M.useMemo(()=>({...i,error:c}),[i,c])},lW=()=>{const{module:e}=oe(),t=te(i=>i.updateState),r=te(i=>i.state.isMarketOrder),n=vh(),s=te(i=>i.state.triggerPricePercent)||0,a=e===ye.LIMIT,o=M.useCallback(()=>{!r&&e===ye.STOP_LOSS&&t({limitPricePercent:n}),t({isMarketOrder:!r})},[t,s,e,r,n]);return{isLimitPrice:!r,toggleLimitPrice:o,hide:a}},u5=()=>{const{module:e,marketPrice:t}=oe(),r=xc().amountWei,n=da().amountWei,s=te(a=>a.state.isMarketOrder);return e===ye.LIMIT||!s?r||"":e===ye.STOP_LOSS||e===ye.TAKE_PROFIT?n||"":t||""},wc=()=>{const{srcToken:e,dstToken:t,dstUsd1Token:r}=oe(),n=u5(),s=dn().amountWei,a=M.useMemo(()=>am(s||"",n,(e==null?void 0:e.decimals)||0),[s,n,e==null?void 0:e.decimals]),o=Rn(t==null?void 0:t.decimals,a);return{amountWei:a,amountUI:o,usd:aa(o,r)}},Wu=()=>{const{srcToken:e,dstToken:t,dstUsd1Token:r}=oe(),n=u5(),s=qr().amountPerTradeWei,a=te(c=>c.state.isMarketOrder),o=M.useMemo(()=>om(s,n,!!a,(e==null?void 0:e.decimals)||0),[s,n,a,e==null?void 0:e.decimals]),i=Rn(t==null?void 0:t.decimals,o);return{amountWei:o,amountUI:i,usd:aa(i,r)}},uW=()=>{const{typedInputAmount:e,marketPriceLoading:t,dstToken:r}=oe(),{amountUI:n,usd:s}=wc(),o=SG()?e:n;return{value:Z2(o,7),valueWei:Y2(r==null?void 0:r.decimals,o),isLoading:t,usd:s}},dW=()=>{const{module:e,marketPriceLoading:t}=oe(),r=Me(),{amountUI:n,onChange:s,onPercentageChange:a,usd:o,selectedPercentage:i,error:c,isTypedValue:l}=xc(),{amountUI:u,usd:d}=Wu(),f=te(z=>z.updateState),h=vh(),{isLimitPrice:y,toggleLimitPrice:g}=lW(),{isInverted:E,onInvert:v,fromToken:w,toToken:A}=Vu(),C=M.useCallback(()=>{f({typedLimitPrice:void 0}),f({limitPricePercent:h})},[f,e,h]),D=M.useMemo(()=>e===ye.STOP_LOSS?r("stopLossLimitPriceTooltip"):r("limitPriceTooltip"),[r,e]);return{price:n,amountPerChunk:u,amountPerChunkUsd:d,error:c,label:r("limitPrice"),tooltip:D,onChange:s,onPercentageChange:a,onReset:C,usd:o,fromToken:w,tradesAmount:qr().totalTrades,toToken:A,percentage:i,isInverted:E,isLoading:t,isLimitPrice:y,toggleLimitPrice:g,onInvert:v,isTypedValue:l}};function d5(){const{marketPrice:e,marketPriceLoading:t,typedInputAmount:r,srcUsd1Token:n,srcBalance:s,chainId:a}=oe(),o=te(g=>g.state.swapExecution.status),i=Me(),{error:c}=da(),{error:l}=xc(),{error:u}=qr(),{error:d}=ua(),{error:f}=wh(),h=dn().amountWei,y=M.useMemo(()=>{if(s&&j(h).gt(s))return{type:Gt.INSUFFICIENT_BALANCE,message:i("insufficientFunds"),value:s||""}},[s,h,i,a]);return M.useMemo(()=>Tm({marketPrice:e,typedInputAmount:r,srcUsd1Token:n,marketPriceLoading:t,triggerPriceError:c,limitPriceError:l,tradesError:u,fillDelayError:d,durationError:f,balanceError:y}),[e,t,r,c,l,u,d,f,y,o,n])}const pW=()=>{const e=te(n=>n.state.isMarketOrder),t=te(n=>n.updateState),r=M.useCallback(()=>{t({isMarketOrder:!e})},[t,e]);return{isMarketPrice:!e,togglePrice:r}},Eh=()=>{const e=te(r=>r.state.currentTime),t=wh().duration;return M.useMemo(()=>dm(e,t),[e,t])},fW=()=>{const{srcUsd1Token:e,dstUsd1Token:t}=oe(),r=dn().amountUI,n=wc().amountUI,s=aa(r,e),a=aa(n,t);return{srcAmountUsd:s,dstAmountUsd:a}},hW=()=>{const{fees:e,dstUsd1Token:t}=oe(),{amountUI:r}=wc(),n=M.useMemo(()=>!e||!r?"":j(r).multipliedBy(e).dividedBy(100).toFixed(),[r,e]);return{amount:n,percent:e,usd:aa(n,t)}},p5=()=>{const{srcToken:e,dstToken:t,account:r,chainId:n,slippage:s,config:a,module:o}=oe(),{amountWei:i}=dn(),{amountWei:c}=xc(),{amountPerTradeWei:l,totalTrades:u}=qr(),d=Eh(),{amountWei:f}=Wu(),{pricePerChunkWei:h}=da(),{milliseconds:y}=ua();return M.useMemo(()=>{var g;return{srcToken:e,dstToken:t,limitPrice:c,deadline:d,srcAmount:i,srcAmountPerTrade:l,totalTrades:u,minDestAmountPerTrade:f,tradeInterval:y,triggerPricePerTrade:h,maker:r,rePermitData:Am({chainId:n,srcToken:Is((e==null?void 0:e.address)||"")?((g=Bs(n))==null?void 0:g.wToken.address)||"":(e==null?void 0:e.address)||"",dstToken:(t==null?void 0:t.address)||"",srcAmount:i,deadlineMillis:d,fillDelayMillis:!u||u===1?0:y,slippage:s*100,account:r,srcAmountPerTrade:l,dstMinAmountPerTrade:f,triggerAmountPerTrade:h,config:a,module:o})}},[e,t,c,d,i,l,u,f,h,r,y,s,n,a,o])},f5=()=>{const{srcToken:e,dstToken:t,account:r}=oe(),n=Me(),{amountUI:s,usd:a}=Wu(),{amountPerTradeUI:o,amountPerTradeUsd:i,totalTrades:c}=qr(),{amountUI:l,usd:u}=da(),d=Eh(),{amountUI:f,usd:h}=xc(),{amount:y,percent:g,usd:E}=hW(),{milliseconds:v}=ua(),{amountUI:w}=wc(),{srcAmountUsd:A,dstAmountUsd:C}=fW(),D=dn().amountUI,z=te(x=>x.state.isMarketOrder),T=X2({srcToken:e,dstToken:t,account:r,limitPrice:z?void 0:f,limitPriceUsd:z?void 0:h,deadline:d,tradeInterval:v,srcAmount:D,totalTrades:c,srcAmountPerTrade:o,srcAmountPerTradeUsd:i,minDestAmountPerTrade:s,minDestAmountPerTradeUsd:a,triggerPrice:l,triggerPriceUsd:u,srcUsd:A,dstUsd:C,dstAmount:w}),m=Ze({value:y}),b=Ze({value:E});return M.useMemo(()=>({...T,fees:{label:n("fees",{value:`${g}%`}),amount:m,usd:b||"",percentage:g}}),[T,m,b,g])},h5=M.createContext({}),mW=({children:e,...t})=>B.jsx(h5.Provider,{value:t,children:e}),bW=()=>M.useContext(h5),m5=()=>{var s,a;const e=Me(),{wrapTxHash:t,srcToken:r}=te(o=>o.state.swapExecution),n=(a=(s=oc())==null?void 0:s.wToken)==null?void 0:a.symbol;return t?B.jsx("p",{className:"twap-error-wrap-msg",children:e("wrapMsg",{symbol:(r==null?void 0:r.symbol)||"",wSymbol:n||""})}):null},b5=()=>{const e=Me(),t=te(n=>n.state.swapExecution.status),r=ex();return t===ht.SUCCESS?e("createOrderActionSuccess",{name:r}):e("createOrderAction",{name:r})},yW=()=>{const e=te(y=>y.state.swapExecution.srcToken),t=Me(),{step:r,wrapTxHash:n,approveTxHash:s}=te(y=>y.state.swapExecution),a=oc(),o=j0(n),i=j0(n),c=j0(s),l=te(y=>y.state.swapExecution.status),d=Is((e==null?void 0:e.address)||"")?(a==null?void 0:a.native.symbol)||"":(e==null?void 0:e.symbol)||"",f=a==null?void 0:a.wToken.symbol,h=b5();return M.useMemo(()=>r===Ds.WRAP?{title:t("wrapAction",{symbol:d}),footerLink:o,footerText:t(o?"viewOnExplorer":"proceedInWallet")}:r===Ds.APPROVE?{title:t("approveAction",{symbol:d}),footerLink:c,footerText:t(c?"viewOnExplorer":"proceedInWallet")}:{title:h,footerText:l===ht.LOADING?t("proceedInWallet"):void 0},[r,c,d,h,t,o,i,f,l])},gW=({error:e})=>B.jsxs("div",{className:"twap-error",children:[B.jsx("h2",{className:"twap-error-title",children:"Transaction failed"}),(e==null?void 0:e.code)&&B.jsxs("p",{className:"twap-error-code",children:["Error code: ",e==null?void 0:e.code]}),B.jsx(m5,{})]});function xW({error:e}){const{components:t}=oe(),r=Me(),n=te(o=>{var i;return(i=o.state.swapExecution)==null?void 0:i.wrapTxHash}),s=t.SubmitOrderErrorView,a=B.jsx(Xn.Failed,{error:B.jsx(gW,{error:e}),footerLink:id,footerText:r("viewOnExplorer")});return s?B.jsx(s,{wrapTxHash:n,error:e,children:a}):a}const wW=()=>{const{components:e}=oe(),t=te(u=>u.state.swapExecution.srcToken),r=te(u=>u.state.swapExecution.dstToken),{reviewDetails:n}=bW(),s=Me(),a=te(u=>{var d;return!!((d=u.state.swapExecution)!=null&&d.status)}),o=f5(),i=e.USD,c=e.SubmitOrderMainView,l=B.jsxs(B.Fragment,{children:[B.jsx(Xn.Main,{fromTitle:s("from"),toTitle:s("to"),inUsd:i?B.jsx(i,{value:o.srcUsd,isLoading:!1}):`$${o.srcUsd}`,outUsd:i?B.jsx(i,{value:o.dstUsd,isLoading:!1}):`$${o.dstUsd}`}),!a&&B.jsxs("div",{className:"twap-create-order-bottom",children:[B.jsx(Ee.Container,{children:B.jsxs("div",{className:"twap-create-order-details",children:[B.jsx(Ee.Deadline,{deadline:o.deadline.value,label:o.deadline.label,tooltip:o.deadline.tooltip||""}),B.jsx(Ee.Price,{srcToken:t,price:o.triggerPrice.value,dstToken:r,label:o.triggerPrice.label,tooltip:o.triggerPrice.tooltip,usd:o.triggerPrice.usd}),B.jsx(Ee.Price,{srcToken:t,price:o.limitPrice.value,dstToken:r,label:o.limitPrice.label,usd:o.limitPrice.usd,tooltip:o.limitPrice.tooltip}),B.jsx(Ee.MinDestAmount,{dstToken:r,dstMinAmountOut:o.minDestAmountPerTrade.value,label:o.minDestAmountPerTrade.label,tooltip:o.minDestAmountPerTrade.tooltip||"",usd:o.minDestAmountPerTrade.usd}),B.jsx(Ee.TradeSize,{tradeSize:o.sizePerTrade.value,trades:o.totalTrades.value,srcToken:t,label:o.sizePerTrade.label,tooltip:o.sizePerTrade.tooltip}),B.jsx(Ee.TradesAmount,{trades:o.totalTrades.value,label:o.totalTrades.label,tooltip:o.totalTrades.tooltip}),B.jsx(Ee.TradeInterval,{chunks:o.totalTrades.value,fillDelayMillis:o.tradeInterval.value,label:o.tradeInterval.label,tooltip:o.tradeInterval.tooltip}),B.jsx(Ee.Recipient,{}),o.fees.amount&&B.jsx(Ee.Fees,{fees:o.fees.amount,label:o.fees.label,usd:o.fees.usd,dstTokenSymbol:r==null?void 0:r.symbol})]})}),n]})]});return c?B.jsx(c,{children:l}):l},vW=e=>{const{status:t,stepIndex:r,totalSteps:n,parsedError:s}=te(w=>w.state.swapExecution),{components:a}=oe(),o=a.Spinner,i=a.SuccessIcon,c=a.ErrorIcon,l=a.TokenLogo,{srcToken:u,dstToken:d}=oe(),f=dn().amountUI,h=wc().amountUI,y=Ze({value:f,decimalScale:2}),g=Ze({value:h,decimalScale:2}),E=M.useMemo(()=>({symbol:u==null?void 0:u.symbol,logoUrl:u==null?void 0:u.logoUrl}),[u]),v=M.useMemo(()=>({symbol:d==null?void 0:d.symbol,logoUrl:d==null?void 0:d.logoUrl}),[d]);return B.jsx(mW,{...e,children:B.jsx(Xn,{inAmount:y,outAmount:g,swapStatus:t,totalSteps:n,currentStep:yW(),currentStepIndex:r,inToken:E,outToken:v,components:{SrcTokenLogo:l&&B.jsx(l,{token:u}),DstTokenLogo:l&&B.jsx(l,{token:d}),Failed:B.jsx(xW,{error:s}),Success:B.jsx(EW,{}),Main:B.jsx(wW,{}),Loader:o,SuccessIcon:i,FailedIcon:c}})})},EW=()=>{const e=b5(),{components:t}=oe(),r=te(a=>a.state.swapExecution.orderId),n=t.SubmitOrderSuccessView,s=B.jsxs(B.Fragment,{children:[B.jsx(Xn.Success,{title:e}),B.jsx(m5,{})]});return n?B.jsx(n,{newOrderId:r,children:s}):s},kW=()=>{const{supportedChains:e}=oe();return M.useMemo(()=>e,[e])},CW=()=>{const{config:e}=oe();return M.useMemo(()=>({spender:e.repermit}),[e])},TW=()=>{var c;const{account:e,walletClient:t,overrides:r,refetchBalances:n,callbacks:s,chainId:a}=oe(),o=(c=oc())==null?void 0:c.wToken,i=W0();return Zr({mutationFn:async({onHash:l,srcAmountWei:u})=>{var h,y;if(!e)throw new Error("missing account");if(!t)throw new Error("missing walletClient");if(!o)throw new Error("tokenAddress is not defined");let d;dt.onWrapRequest(),(h=s==null?void 0:s.onWrapRequest)==null||h.call(s),r!=null&&r.wrap?d=await r.wrap(u):d=await t.writeContract({abi:_h,functionName:"deposit",account:e,address:o.address,value:BigInt(u),chain:t.chain}),l==null||l(d);const f=await i(d);if(!f)throw new Error("failed to get transaction receipt");if(f.status==="reverted")throw new Error("failed to wrap token");return dt.onWrapSuccess(d),(y=s==null?void 0:s.onWrapSuccess)==null||y.call(s,{txHash:f.transactionHash,explorerUrl:Bi(f.transactionHash,a),amount:Ii(u,o.decimals)}),n==null||n(),f},onError:l=>{throw dt.onWrapError(l),l}})},AW=()=>{const{account:e,walletClient:t,chainId:r,callbacks:n}=oe(),s=p5().rePermitData,{refetch:a}=q0();return Zr({mutationFn:async()=>{var y,g,E,v;if(!e)throw new Error("missing account");if(!t)throw new Error("missing walletClient");if(!r)throw new Error("missing chainId");const{order:o,domain:i,types:c,primaryType:l}=s;dt.onSignOrderRequest(o),(y=n==null?void 0:n.onSignOrderRequest)==null||y.call(n),console.log({domain:i,types:c,primaryType:l,message:o,account:e}),console.log("Using domain:",i),console.log("Using types:",c),console.log("Order data to sign:",JSON.stringify(o,null,2)),console.log(`Account address: ${e}`);let u;try{u=await(t==null?void 0:t.signTypedData({domain:i,types:c,primaryType:l,message:o,account:e}))}catch(w){throw(g=n==null?void 0:n.onSignOrderError)==null||g.call(n,w),dt.onSignOrderError(w),w}dt.onSignOrderSuccess(u),(E=n==null?void 0:n.onSignOrderSuccess)==null||E.call(n,u);const d=jT(u),f={v:q(d.v||0),r:d.r,s:d.s},h=await Bm(o,f);return(v=n==null?void 0:n.onOrderCreated)==null||v.call(n,h),await a(),h}})},y5=()=>{const{account:e,publicClient:t,config:r}=oe();return Zr({mutationFn:async({tokenAddress:n,srcAmountWei:s})=>{if(!t)throw new Error("missing publicClient");if(!e)throw new Error("missing account");if(!r)throw new Error("missing config");const a=await t.readContract({address:n,abi:Cy,functionName:"allowance",args:[e,r.repermit]}).then(i=>i.toString()),o=j(a||"0").lt(j(s).toString());return{allowance:a,approvalRequired:o}}})},SW=()=>{const{account:e,walletClient:t,overrides:r,config:n,chainId:s,callbacks:a}=oe(),o=W0(),{mutateAsync:i}=y5();return Zr({onError:c=>{dt.onApproveError(c)},mutationFn:async({token:c,onHash:l,srcAmountWei:u})=>{var y,g;if(!e)throw new Error("missing account");if(!t)throw new Error("missing walletClient");if(!n)throw new Error("missing config");(y=a==null?void 0:a.onApproveRequest)==null||y.call(a),dt.onApproveRequest();let d;if(r!=null&&r.approveOrder?d=await r.approveOrder({tokenAddress:c.address,spenderAddress:n.repermit,amount:Vs}):d=await t.writeContract({abi:Cy,functionName:"approve",account:e,address:c.address,args:[n.repermit,Vs],chain:t.chain}),!d)throw new Error("failed to approve token");l(d);const f=await o(d);if(!f)throw new Error("failed to get transaction receipt");if(f.status==="reverted")throw new Error("failed to approve token");let h=!1;for(let E=0;E<3;E++){const{approvalRequired:v}=await i({tokenAddress:c.address,srcAmountWei:u});if(!v){h=!0;break}E<2&&await new Promise(w=>setTimeout(w,3e3))}if(!h)throw new Error(`Insufficient ${c.symbol} allowance to perform the swap. Please approve the token first.`);return dt.onApproveSuccess(f.transactionHash),(g=a==null?void 0:a.onApproveSuccess)==null||g.call(a,{txHash:f.transactionHash,explorerUrl:Bi(f.transactionHash,s),token:c,amount:Ii(u,c.decimals)}),f}})},PW=()=>{const{account:e,chainId:t,srcToken:r,dstToken:n,module:s,slippage:a}=oe(),o=da(),i=dn().amountWei,c=qr().amountPerTradeWei,l=Eh(),u=qr().totalTrades,d=ua().fillDelay,f=Wu().amountWei,h=te(y=>y.state.isMarketOrder);return Zr({mutationFn:async()=>{dt.onRequestOrder({account:e,chainId:t,module:s,srcToken:r,dstToken:n,fromTokenAmount:i,srcChunkAmount:c,triggerPricePerTrade:o.pricePerChunkWei,deadline:l,fillDelay:d.unit*d.value,minDstAmountOutPerTrade:f,slippage:a,isMarketOrder:h||!1,chunksAmount:u})}})};function IW(e){const t=e.message,r=t.match(/,\s*code\s*:\s*(\d+)/i);return{message:t.replace(/^error\s*:/i,"").replace(/,\s*code\s*:\s*\d+/i,"").trim()||"",code:r?Number(r[1]):0}}const BW=()=>{const{srcToken:e,dstToken:t,chainId:r,callbacks:n}=oe(),s=SW().mutateAsync,a=TW().mutateAsync,o=AW().mutateAsync,{mutateAsync:i}=y5(),c=te(d=>d.updateSwapExecution),{amountWei:l}=dn(),u=PW().mutate;return Zr({mutationFn:async()=>{var f,h;const d=Is((e==null?void 0:e.address)||" ");try{if(!e)throw new Error("missing srcToken");if(!t)throw new Error("missing dstToken");if(!r)throw new Error("missing chainId");const y=r6(e,r);c({allowanceLoading:!0,wrapTxHash:void 0,approveTxHash:void 0});const{approvalRequired:g}=await i({tokenAddress:y.address,srcAmountWei:l});let E=0,v=1;d&&v++,g&&v++,c({totalSteps:v,stepIndex:E,allowanceLoading:!1,status:ht.LOADING}),u(),d&&(c({step:Ds.WRAP}),await a({onHash:A=>c({wrapTxHash:A}),srcAmountWei:l}),E++,c({stepIndex:E})),g&&(c({step:Ds.APPROVE}),await s({token:y,onHash:A=>c({approveTxHash:A}),srcAmountWei:l}),E++,c({stepIndex:E})),c({step:Ds.CREATE});const w=await o();return c({status:ht.SUCCESS,orderId:w.id}),w}catch(y){if(_f(y))(f=n==null?void 0:n.onSubmitOrderRejected)==null||f.call(n),c({step:void 0,status:void 0,stepIndex:void 0,error:y});else{const g=IW(y);(h=n==null?void 0:n.onSubmitOrderFailed)==null||h.call(n,g),c({status:ht.FAILED,parsedError:g,error:y})}throw y}}})},FW=()=>{const{marketPrice:e,srcToken:t,dstToken:r,resetTypedInputAmount:n}=oe(),s=BW(),a=te(g=>g.updateState),{amountUI:o}=dn(),i=te(g=>g.resetState),c=te(g=>g.state.swapExecution),l=te(g=>g.updateSwapExecution),u=ex(),d=M.useCallback(()=>{(c==null?void 0:c.status)===ht.SUCCESS&&(n(),i())},[c==null?void 0:c.status,i,n]),f=M.useCallback(()=>{(c==null?void 0:c.status)!==ht.LOADING&&(a({acceptedSrcAmount:void 0,acceptedMarketPrice:void 0}),l({srcToken:t,dstToken:r,error:void 0,parsedError:void 0,status:void 0,orderId:void 0}))},[a,t,r]),h=Zr({mutationFn:async()=>(a({acceptedSrcAmount:o,acceptedMarketPrice:e}),await s.mutateAsync())}),y=M.useCallback(()=>h.mutateAsync(),[h]);return M.useMemo(()=>({reset:i,onCloseModal:d,onOpenModal:f,onSubmit:y,orderTitle:u,...c,isLoading:(c==null?void 0:c.status)===ht.LOADING,isSuccess:(c==null?void 0:c.status)===ht.SUCCESS,isFailed:(c==null?void 0:c.status)===ht.FAILED}),[i,d,y,c,u])},UW=()=>{const e=Me(),{marketPrice:t,srcToken:r,dstToken:n,marketPriceLoading:s,srcBalance:a,srcUsd1Token:o,noLiquidity:i,typedInputAmount:c}=oe(),l=s||j(o||"0").isZero()||a===void 0||j(t||"0").isZero(),u=!!(r&&n&&c&&l),d=d5(),f=M.useMemo(()=>i?e("noLiquidity"):j(c||"0").isZero()?e("enterAmount"):e("placeOrder"),[d,e,c,i]),h=!!(d||i||u||j(c||"0").isZero()||!r||!n);return M.useMemo(()=>({disabled:h,text:f,loading:u}),[h,f,u])},OW=({children:e,container:t})=>{const[r,n]=M.useState(!1),s=M.useRef(null);if(M.useLayoutEffect(()=>(n(!0),s.current=t??document.body,()=>{s.current=null}),[]),typeof document>"u"||!r)return null;const a=s.current;return a?As.createPortal(e,a):null};Pm(Iw.version);const DW={SubmitOrderPanel:vW,Orders:ZV,Portal:OW};R.CRASH_ERROR_MESSAGE=rw,R.Components=DW,R.Configs=Dt,R.DEFAULT_DURATION_OPTIONS=JL,R.DEFAULT_FILL_DELAY=Fc,R.DEFAULT_STOP_LOSS_LIMIT_PERCENTAGE=tm,R.DEFAULT_STOP_LOSS_PERCENTAGE=Jh,R.DEFAULT_TAKE_PROFIT_LIMIT_PERCENTAGE=rm,R.DEFAULT_TAKE_PROFIT_PERCENTAGE=em,R.DISCLAIMER_URL=tw,R.EIP712_TYPES=Qh,R.ERC20_ABI=H5,R.EXCLUSIVITY_OVERRIDE_BPS=Z5,R.FEES=Y5,R.IWETH_ABI=_h,R.InputErrors=Gt,R.LEGACY_EXCHANGES_MAP=Zh,R.MAX_ORDER_DURATION_MILLIS=Ca,R.MIN_CHUNKS=K5,R.MIN_FILL_DELAY_MILLIS=Ic,R.MIN_FILL_DELAY_MINUTES=Wh,R.MIN_ORDER_DURATION_MILLIS=ad,R.Module=ye,R.ORBS_LOGO=Q5,R.ORBS_LOGO_FALLBACK=J5,R.ORBS_SLTP_FAQ_URL=X5,R.ORBS_TWAP_FAQ_URL=id,R.ORBS_WEBSITE_URL=ew,R.OrderStatus=ct,R.OrderType=ze,R.PRICE_PROTECTION_SETTINGS=ez,R.Partners=Lh,R.QUERY_PARAMS=Ta,R.REPERMIT_ABI=Mh,R.REPERMIT_PRIMARY_TYPE=Xh,R.SUGGEST_CHUNK_VALUE=q5,R.SpotProvider=XL,R.Steps=Ds,R.SwapStatus=ht,R.THE_GRAPH_ORDERS_API=qh,R.TWAP_ABI=Nh,R.TimeUnit=$t,R.analytics=dt,R.buildRePermitOrderData=Am,R.buildV2Order=pd,R.copy=WT,R.ensureWrappedToken=r6,R.eqIgnoreCase=Ps,R.fillDelayText=e6,R.formatDecimals=t6,R.getAccountOrders=Dm,R.getApiEndpoint=sd,R.getChunks=lm,R.getConfig=ld,R.getDeadline=dm,R.getDestTokenAmount=am,R.getDestTokenMinAmountPerChunk=om,R.getDuration=cm,R.getErrors=Tm,R.getEstimatedDelayBetweenChunksMillis=pm,R.getExplorerUrl=Bi,R.getMaxChunksError=Em,R.getMaxFillDelayError=iw,R.getMaxOrderDurationError=gm,R.getMaxPossibleChunks=um,R.getMinChunkSizeUsd=Cm,R.getMinFillDelayError=wm,R.getMinNativeBalance=KT,R.getMinOrderDurationError=xm,R.getMinTradeSizeError=vm,R.getNetwork=Bs,R.getOrderExcecutionRate=$h,R.getOrderFillDelayMillis=td,R.getOrderLimitPriceRate=Gh,R.getOrderType=YT,R.getPartnerChains=Hh,R.getPartnerIdentifier=_t,R.getPartners=km,R.getSrcTokenChunkAmount=fm,R.getStopLossLimitPriceError=bm,R.getStopLossPriceError=hm,R.getTakeProfitLimitPriceError=ym,R.getTakeProfitPriceError=mm,R.getTriggerPricePerChunk=im,R.getTriggerPricePerTrade=jh,R.isNativeAddress=Is,R.isTxRejected=_f,R.makeElipsisAddress=Df,R.maxUint256=Bc,R.millisToDays=n6,R.millisToMinutes=Mf,R.nativeTokenAddresses=Yh,R.networks=Ft,R.parseError=qT,R.removeCommas=VT,R.setApiMode=W5,R.setUIVersion=Pm,R.shouldUnwrapOnly=Lf,R.shouldWrapOnly=Nf,R.submitOrder=Bm,R.toAmountUi=Ii,R.toAmountWei=Bl,R.useAddresses=CW,R.useDisclaimerPanel=nW,R.useDstTokenPanel=uW,R.useDurationPanel=rW,R.useFillDelayPanel=QV,R.useFormatNumber=Ze,R.useInputErrors=d5,R.useInvertTradePanel=Vu,R.useLimitPricePanel=dW,R.useOrder=p5,R.useOrderHistoryPanel=qG,R.useOrderInfo=f5,R.usePartnerChains=kW,R.useSubmitOrderButton=UW,R.useSubmitOrderPanel=FW,R.useTogglePricePanel=pW,R.useTradesPanel=eW,R.useTranslations=Me,R.useTriggerPricePanel=iW,R.zeroAddress=Kh,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
|