PageSourceSearch

https://www.civfund.app/_next/static/chunks/104-1fd660d0571cac0c.js

js civfund.app collected 2026-10-09 21:30:42 UTC 117,193 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[104],{85526:function(e,t,n){"use strict";n.d(t,{$H:function(){return subscribeToPoolData},mP:function(){return initSocket}});var a=n(34337);let i=null,s=null,l=null,o=null,r=null,d=[],u={VPS:0,APY:0,NAV:0,netNAV:0,timestamp:Date.now()},notify=()=>{let e={strategy:l||u,fullHistory:s||[],cachedAt:o,epochStrategyApi:r||null};d.forEach(t=>t(e))},initSocket=()=>(i||((i=(0,a.io)("https://api.civfund.com/",{transports:["websocket"],reconnection:!0})).on("poolDataFromSocket",e=>{try{var t;let n=null==e?void 0:e.flat(2),a=null==n?void 0:n.find(e=>null==e?void 0:e.fullHistory);s=null!==(t=null==a?void 0:a.fullHistory)&&void 0!==t?t:null,i.emit("message","strategies"),fetchEpochStrategyApi().then(()=>notify())}catch(e){s=null}}),i.on("strategies",e=>{try{let t=e.find(e=>{let[t]=e;return 1===t});if(t){let e=t[1];l={VPS:e.VPS||0,APY:e.APY||0,NAV:e.NAV||0,netNAV:e.netNAV||0,timestamp:e.timestamp||Date.now()},o=Date.now(),notify()}}catch(e){l=u}})),i),subscribeToPoolData=e=>(d.push(e),(l||s)&&notify(),()=>{d=d.filter(t=>t!==e)});async function fetchEpochStrategyApi(){try{let e=await fetch("https://api.civfund.com/apidata",{cache:"no-store"});if(!e.ok)throw Error("HTTP error: ".concat(e.status));return r=await e.json()}catch(e){return r=null,null}}},51688:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return page}});var a=n(57437),i=n(2265),s=n(84484),l=n(87415);n(83343);var alertMessage=e=>{let{message:t}=e,{setMessage:n}=(0,s.Z)(),[o,r]=(0,i.useState)(!1);(0,i.useEffect)(()=>{r(window.innerWidth<640)},[]);let emit=e=>{l.Am.dismiss(),setTimeout(()=>{(0,l.Am)(e),n(null)},400)};return(0,i.useEffect)(()=>{t&&emit(t)},[t]),(0,a.jsx)(l.Ix,{position:o?"top-center":"bottom-right",autoClose:5e3,hideProgressBar:!0,newestOnTop:!!o,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!1,pauseOnHover:!0,theme:"dark",toastClassName:"!bg-[#172029BF] !backdrop-blur-sm sm:!rounded-12 max-sm:!rounded-b-12 border border-solid border-gray md:text-sm max-sm:text-xs"})},o=n(27483),r=n.n(o),d=n(67432),u=n.n(d),p=n(9442),c=n(60500);n(68143),c.kL.register(c.u,c.De,c.Dx,c.ZL,c.uw,c.f$,c.od);var m=n(86618),y=n(29738),x=n.n(y),h=n(16691),f=n.n(h),b=n(65059),v=n(76703),w=n.n(v),g=n(83984),T=n(79037),j=n(18559),_=n(47973);let N={1:{3:"0x73A83269b9bbAFC427E76Be0A2C1a1db2a26f4C2",4:"0x73A83269b9bbAFC427E76Be0A2C1a1db2a26f4C2"},5:{3:"0x794913c43e05dA70954BfDD29398CE24f20B8535",4:"0x794913c43e05dA70954BfDD29398CE24f20B8535"},11155111:{3:"0x7caDfF06639e190C320213EC1f36a798FF035aEF",4:"0x7caDfF06639e190C320213EC1f36a798FF035aEF"}},A={1:{0:"0xdAC17F958D2ee523a2206206994597C13D831ec7"},5:{3:"0x4d527d0b4E5Fc7cb057EbdE78f1c69FFC337125B",4:"0x4d527d0b4E5Fc7cb057EbdE78f1c69FFC337125B"},11155111:{3:"0x72797874B8CD274e52b352d418966c25585D24Eb",4:"0x72797874B8CD274e52b352d418966c25585D24Eb"},42161:{0:"0x8e98923773b0E4F64A6F78BBEaac6642E8e98FA7",1:"0x8e98923773b0E4F64A6F78BBEaac6642E8e98FA7"}},D={1:["0x09d0b8e15Cd5e89fB3BD79BD75cB475332750D4e"],5:["0x4cD6A7596febDa71dD772A17921a7f791EBe0C6B"],11155111:["0x451D7B420EcB7E835D87081ce8824c0f95Ec5fcE"],42161:{0:"0x72a9a6f0b9482b0e1bb4612075ca8Cd7d5f48879",1:"0x72a9a6f0b9482b0e1bb4612075ca8Cd7d5f48879"}},E={1:["0xB817afCE9Edf6832974E3b4479E838F2d344fFF8"],5:["0x80Ce46fEf6811B23C0379c015221E1001F4cB439"],11155111:["0x89DeDB0F927A4eC8bd2BCf4E89DFaF42aFB45f09"]},R={1:{0:"0x3AbBd448c7006ac93F3206905979B64760C5Fd83"},5:{3:"0x6723729Fa9c2A1a3E417b69D5B0B001DA62d6a63",4:"0x6723729Fa9c2A1a3E417b69D5B0B001DA62d6a63"},11155111:{3:"0xFC26fbBbA66A462cD1B2e713C47626d4622Ef1bd",4:"0xFC26fbBbA66A462cD1B2e713C47626d4622Ef1bd"},42161:{0:"0x72788981e812558C75f36d2D59B43b6ee160B71d",1:"0x72788981e812558C75f36d2D59B43b6ee160B71d"}},S=[{inputs:[],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:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",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"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"_blacklistWalletAccount",type:"address"}
1],name:"blacklistWalletChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"_botTaxRate",type:"uint256"}],name:"botTaxChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"_botWalletAccount",type:"address"}],name:"botWalletChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"_newBurnAddress",type:"address"}],name:"burnAddressChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"_sizeFreeAccount",type:"address"}],name:"sizeFreeChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"_taxRate",type:"uint256"}],name:"taxChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"_taxFreeAccount",type:"address"}],name:"taxFreeChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"_sender",type:"address"},{indexed:!1,internalType:"address",name:"_recipient",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"_burnAmount",type:"uint256"}],name:"transferWithTax",type:"event"},{stateMutability:"payable",type:"fallback"},{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:[{internalType:"address",name:"",type:"address"}],name:"blacklistWallet",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"botTaxRate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"botWallet",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"burnWallet",outputs:[{internalType:"address",name:"",type:"address"}],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:[{internalType:"uint256",name:"count",type:"uint256"}],name:"mintToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_account",type:"address"}],name:"setBlacklistWallet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_botTaxRate",type:"uint256"}],name:"setBotRate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_account",type:"address"}],name:"setBotWallet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_burnAddress",type:"address"}],name:"setBurnAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_account",type:"address"}],name:"setSizeFree",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_account",type:"address"}],name:"setTaxFree",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_taxRate",type:"uint256"}],name:"setTaxRate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"sizeFree",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"taxFree",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"taxRate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"_tokenContract",type:"address"}],name:"withdrawERC20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdrawETH",outputs:[],stateMutability:"payable",type:"function"},{stateMutability:"payable",type:"receive"}],V=[{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"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,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"}],k=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_upgradedAddress",type:"address"}],name:"deprecate",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",type:"uint256"}],name:"approve",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"deprecated",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_evilUser",type:"address"}],name:"addBlackList",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transferFrom",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"upgradedAddress",outputs:[{name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"",type:"address"}],name:"balances",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"maximumFee",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"_totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[],name:"unpause",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_maker",type:"address"}],name:"getBlackListStatus",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"",type:"address"},{name:"",type:"address"}],name:"allowed",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"paused",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"who",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[],name:"pause",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"getOwner",outputs:[{name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"owner",outputs:[{name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"newBasisPoints",type:"uint256"},{name:"newMaxFee",type:"uint256"}],name:"setParams",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"amount",type:"uint256"}],name:"issue",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"amount",type:"uint256"}],name:"redeem",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",type:"address"}],name:"allowance",outputs:[{name:"remaining",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"basisPointsRate",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"",type:"address"}],name:"isBlackListed",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_clearedUser",type:"address"}],name:"removeBlackList",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"MAX_UINT",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"_blackListedUser",type:"address"}],name:"destroyBlackFunds",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{inputs:[{name:"_initialSupply",type:"uint256"},{name:"_name",type:"string"},{name:"_symbol",type:"string"},{name:"_decimals",type:"uint256"}],payable:!1,stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,name:"amount",type:"uint256"}],name:"Issue",type:"event"},{anonymous:!1,inputs:[{indexed:!1,name:"amount",type:"uint256"}],name:"Redeem",type:"event"},{anonymous:!1,inputs:[{indexed:!1,name:"newAddress",type:"address"}],name:"Deprecate",type:"event"},{anonymous:!1,inputs:[{indexed:!1,name:"feeBasisPoints",type:"uint256"},{indexed:!1,name:"maxFee",type:"uint256"}],name:"Params",type:"event"},{anonymous:!1,inputs:[{indexed:!1,name:"_blackListedUser",type:"address"},{indexed:!1,name:"_balance",type:"uint256"}],name:"DestroyedBlackFunds",type:"event"},{anonymous:!1,inputs:[{indexed:!1,name:"_user",type:"address"}],name:"AddedBlackList",type:"event"},{anonymous:!1,inputs:[{indexed:!1,name:"_user",type:"address"}],name:"RemovedBlackList",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[],name:"Pause",type:"event"},{anonymous:!1,inputs:[],name:"Unpause",type:"event"}],M=[{inputs:[{internalType:"address",name:"_civVaultAddress",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"NULL_ADDRESS",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"PERIOD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"UNISWAP_FACTORY",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"WETH_ADDRESS",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"uint256",name:"_epochDuration",type:"uint256"}],name:"addTimeOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"address",name:"_token0",type:"address"},{internalType:"address",name:"_token1",type:"address"}],name:"addUniPair",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"civVault",outputs:[{internalType:"contract ICivVault",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"address",name:"_user",type:"address"}],name:"getAllowedDeposit",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"address",name:"_user",type:"address"}],name:"getClaimableGuaranteeToken",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"}],name:"getCurrentPeriod",outputs:[{internalType:"uint256",name:"currentPeriodStartTime",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"uint
1256",name:"_amount",type:"uint256"}],name:"getDepositGuarantee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"}],name:"getGuaranteeTokenInfo",outputs:[{internalType:"string",name:"symbol",type:"string"},{internalType:"uint256",name:"decimals",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"uint256",name:"_newVPS",type:"uint256"},{internalType:"uint256",name:"_epochId",type:"uint256"}],name:"getNetValues",outputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"uint256",name:"_amountIn",type:"uint256"}],name:"getPrice",outputs:[{internalType:"uint256",name:"amountOut",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"uint256",name:"_amountIn",type:"uint256"}],name:"getReversePrice",outputs:[{internalType:"uint256",name:"amountOut",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"address",name:"_user",type:"address"}],name:"getUnclaimedTokens",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"address",name:"_user",type:"address"}],name:"getUserBalances",outputs:[{internalType:"uint256",name:"guaranteeBalance",type:"uint256"},{internalType:"uint256",name:"representTokenBalance",type:"uint256"},{internalType:"uint256",name:"assetTokenBalance",type:"uint256"},{internalType:"address",name:"guaranteeAddress",type:"address"},{internalType:"address",name:"representTokenAddress",type:"address"},{internalType:"address",name:"assetTokenAddress",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"}],name:"pairInfo",outputs:[{internalType:"contract IUniswapV2Pair",name:"pair",type:"address"},{internalType:"uint256",name:"price0CumulativeLast",type:"uint256"},{internalType:"uint256",name:"price1CumulativeLast",type:"uint256"},{components:[{internalType:"uint224",name:"_x",type:"uint224"}],internalType:"struct FixedPoint.uq112x112",name:"price0Average",type:"tuple"},{components:[{internalType:"uint224",name:"_x",type:"uint224"}],internalType:"struct FixedPoint.uq112x112",name:"price1Average",type:"tuple"},{internalType:"uint32",name:"blockTimestampLast",type:"uint32"},{internalType:"address",name:"token0",type:"address"},{internalType:"address",name:"token1",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"uint256",name:"_newEpochDuration",type:"uint256"}],name:"setEpochDuration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"timeOracle",outputs:[{internalType:"contract TimeOracle",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"uint256",name:"_index",type:"uint256"}],name:"update",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"}],name:"updateAll",outputs:[],stateMutability:"nonpayable",type:"function"}],C=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"uint256",name:"fee",type:"uint256"},{indexed:!1,internalType:"uint256",name:"maxDeposit",type:"uint256"},{indexed:!1,internalType:"uint256",name:"minDeposit",type:"uint256"},{indexed:!1,internalType:"bool",name:"paused",type:"bool"},{indexed:!1,internalType:"address[]",name:"withdrawAddress",type:"address[]"},{indexed:!1,internalType:"address",name:"assetToken",type:"address"},{indexed:!1,internalType:"address",name:"guaranteeToken",type:"address"},{indexed:!1,internalType:"uint256",name:"lockPeriod",type:"uint256"},{indexed:!1,internalType:"uint256",name:"feeDuration",type:"uint256"}],name:"AddStrategy",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"CancelDeposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"CancelWithdraw",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"address",name:"user",type:"address"}
1,{indexed:!1,internalType:"uint256",name:"guaranteeAmount",type:"uint256"}],name:"ClaimGuarantee",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"uint256",name:"epoch",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetAmount",type:"uint256"}],name:"ClaimWithdrawedToken",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"address",name:"receiver",type:"address"},{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"InitializeStrategy",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"address",name:"treasuryAddress",type:"address"},{indexed:!1,internalType:"uint256",name:"feeAmount",type:"uint256"}],name:"SendFeeWithOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"oldDuration",type:"uint256"},{indexed:!1,internalType:"uint256",name:"newDuration",type:"uint256"}],name:"SetEpochDuration",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"oldFee",type:"uint256"},{indexed:!1,internalType:"uint256",name:"newFee",type:"uint256"},{indexed:!1,internalType:"uint256",name:"oldDuration",type:"uint256"},{indexed:!1,internalType:"uint256",name:"newDuration",type:"uint256"}],name:"SetFee",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"gasBuffer",type:"uint256"},{indexed:!1,internalType:"uint256",name:"newGasBuffer",type:"uint256"}],name:"SetGasBuffer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"oldFee",type:"uint256"},{indexed:!1,internalType:"uint256",name:"newFee",type:"uint256"}],name:"SetGuaranteeFee",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"oldLocktime",type:"uint256"},{indexed:!1,internalType:"uint256",name:"newLockTime",type:"uint256"}],name:"SetGuaranteeLockTime",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"address",name:"oldAddress",type:"address"},{indexed:!1,internalType:"address",name:"newAddress",type:"address"}],name:"SetInvestAddress",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"oldMaxAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"newMaxAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"oldMinAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"newMinAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"oldMaxUsers",type:"uint256"},{indexed:!1,internalType:"uint256",name:"newMaxUsers",type:"uint256"}],name:"SetLimits",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bool",name:"paused",type:"bool"}],name:"SetPaused",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"address[]",name:"oldAddress",type:"address[]"},{indexed:!1,internalType:"address[]",name:"newAddress",type:"address[]"}],name:"SetWithdrawAddress",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"index",type:"uint256"}],name:"Update",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"lastEpoch",type:"uint256"},{indexed:!1,internalType:"uint256",name:"VPS",type:"uint256"}],name:"UpdateVPS",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Withdraw",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"uint256",name:"assetAmount",type:"uint256"}],name:"WithdrawedToken",type:"event"},{inputs:[{components:[{internalType:"contract IERC20",name:"_assetToken",type:"address"},{internalType:"contract IERC20",name:"_guaranteeToken",type:"address"},{internalType:"uint256",name:"_maxDeposit",type:"uint256"},{internalType:"uint256",name:"_maxUsers",type:"uint256"},{internalType:"uint256",name:"_minAmount",type:"uint256"},{internalType:"uint256",name:"_fee",type:"uint256"},{internalType:"uint256",name:"_guaranteeFee",type:"uint256"},{internalType:"uint256",name:"_epochDuration",type:"uint256"},{internalType:"uint256",name:"_lockPeriod",type:"uint256"},{internalType:"uint256",name:"_feeDuration",type:"uint256"},{internalType:"address",name:"_investAddress",type:"address"},{internalType:"address[]",name:"_withdrawAddresses",type:"address[]"},{internalType:"bool",name:"_paused",type:"bool"}
1],internalType:"struct AddStrategyParam",name:"addStrategyParam",type:"tuple"}],name:"addStrategy",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"}],name:"cancelDeposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"}],name:"cancelWithdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"}],name:"claimGuaranteeToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"}],name:"claimWithdrawedTokens",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"}],name:"continueDistributingShares",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"uint256",name:"_amount",type:"uint256"}],name:"deposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"feeBase",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"fundShareFactory",outputs:[{internalType:"contract CIVFundShareFactory",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"gasBuffer",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"}],name:"getCurrentEpoch",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"uint256",name:"_epoch",type:"uint256"}],name:"getDepositors",outputs:[{internalType:"address[]",name:"users",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"uint256",name:"_index",type:"uint256"}],name:"getEpochInfo",outputs:[{components:[{internalType:"uint256",name:"totDepositors",type:"uint256"},{internalType:"uint256",name:"totDepositedAssets",type:"uint256"},{internalType:"uint256",name:"totWithdrawnShares",type:"uint256"},{internalType:"uint256",name:"VPS",type:"uint256"},{internalType:"uint256",name:"newShares",type:"uint256"},{internalType:"uint256",name:"currentWithdrawAssets",type:"uint256"},{internalType:"uint256",name:"epochStartTime",type:"uint256"},{internalType:"uint256",name:"lastDepositorProcessed",type:"uint256"},{internalType:"uint256",name:"duration",type:"uint256"}],internalType:"struct EpochInfo",name:"epoch",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"address",name:"_user",type:"address"},{internalType:"uint256",name:"_index",type:"uint256"}],name:"getGuaranteeInfo",outputs:[{components:[{internalType:"uint256",name:"lockStartTime",type:"uint256"},{internalType:"uint256",name:"lockAmount",type:"uint256"}],internalType:"struct GuaranteeInfo",name:"userGuarantee",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"}],name:"getStrategyInfo",outputs:[{components:[{internalType:"contract IERC20",name:"assetToken",type:"address"},{internalType:"contract IERC20",name:"guaranteeToken",type:"address"},{internalType:"contract ICivFundRT",name:"fundRepresentToken",type:"address"},{internalType:"uint256",name:"fee",type:"uint256"},{internalType:"uint256",name:"guaranteeFee",type:"uint256"},{internalType:"uint256",name:"maxDeposit",type:"uint256"},{internalType:"uint256",name:"maxUsers",type:"uint256"},{internalType:"uint256",name:"minDeposit",type:"uint256"},{internalType:"uint256",name:"epochDuration",type:"uint256"},{internalType:"uint256",name:"lockPeriod",type:"uint256"},{internalType:"uint256",name:"feeDuration",type:"uint256"},{internalType:"uint256",name:"lastFeeDistribution",type:"uint256"},{internalType:"uint256",name:"lastProcessedEpoch",type:"uint256"},{internalType:"uint256",name:"watermark",type:"uint256"},{internalType:"uint256",name:"pendingFees",type:"uint256"},{internalType:"address[]",name:"withdrawAddress",type:"address[]"},{internalType:"address",name:"investAddress",type:"address"},{internalType:"bool",name:"initialized",type:"bool"},{internalType:"bool",name:"paused",type:"bool"}],internalType:"struct StrategyInfo",name:"strategy",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"address",name:"_user",type:"address"}],name:"getUserInfo",outputs:[{components:[{internalType:"uint256",name:"lastEpoch",type:"uint256"},{internalType:"uint256",name:"startingIndexGuarantee",type:"uint256"},{internalType:"uint256",name:"numberOfLocks",type:"uint256"}],internalType:"struct UserInfo",name:"user",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"address",name:"_user",type:"address"},{internalType:"uint256",name:"_index",type:"uint256"}],name:"getUserInfoEpoch",outputs:[{components:[{internalType:"uint256",name:"depositInfo",type:"uint256"},{internalType:"uint256",name:"withdrawInfo",type:"uint256"},{internalType:"uint256",name:"depositIndex",type:"uint256"},{internalType:"uint256",name:"epochGuaranteeIndex",type:"uint256"},{internalType:"bool",name:"hasDeposited",type:"bool"}],internalType:"struct UserInfoEpoch",name:"userEpochStruct",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"}],name:"initializeStrategy",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"}],name:"processDeposits",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"uint256",name:"_newVPS",type:"uint256"}],name:"rebalancing",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"}],name:"sendPendingFees",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"uint256",name:"_newDuration",type:"uint256"}],name:"setEpochDuration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"uint256",name:"_newMaxDeposit",type:"uint256"},{internalType:"uint256",name:"_newMinDeposit",type:"uint256"},{internalType:"uint256",name:"_newMaxUsers",type:"uint256"}],name:"setEpochLimits",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"uint256",name:"_newFee",type:"uint256"},{internalType:"uint256",name:"_newDuration",type:"uint256"}],name:"setFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_gasBuffer",type:"uint256"}],name:"setGasBuffer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"address",name:"_newAddress",type:"address"}],name:"setInvestAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"bool",name:"_paused",type:"bool"}],name:"setPaused",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"uint256",name:"_lockTime",type:"uint256"},{internalType:"uint256",name:"_newFee",type:"uint256"}],name:"setStrategyGuarantee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"address[]",name:"_newAddress",type:"address[]"}],name:"setWithdrawAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"strategiesCounter",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"vaultGetter",outputs:[{internalType:"contract ICivVaultGetter",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_id",type:"uint256"},{internalType:"uint256",name:"_amount",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"_tokenContract",type:"address"}],name:"withdrawERC20",outputs:[],stateMutability:"nonpayable",type:"function"}];var contractReads_useGuaranteeFee=(e,t,n,a)=>{let[l,o]=(0,i.useState)(0),{setGuaranteeFee:r,tokenPrices:d}=(0,s.Z)(),getGuaranteeFee=()=>{if(n&&(null==d?void 0:d.STONEprice)){let t=(null==e?void 0:e.id)!=1?Number(n)/100:.01*Number(n)/d.STONEprice;o(t),r(t)}};return(0,i.useEffect)(()=>{getGuaranteeFee()},[n,null==d?void 0:d.STONEprice]),l},F=n(45233),B=n(83447),I=n(41935),loadBalances=e=>{let{address:t,chain:n}=(0,T.useAccount)(),{tokenDecimal:a}=(0,s.Z)(),l={address:R[null==n?void 0:n.id]?R[null==n?void 0:n.id][e]:null,abi:V},o={address:A[null==n?void 0:n.id]?A[null==n?void 0:n.id][e]:null,abi:V},{data:r}=(0,F.useReadContract)({...o,functionName:"balanceOf",args:[t]}),{data:d}=(0,F.useReadContract)({...l,functionName:"balanceOf",args:[t]}),u=[{...l,functionName:"allowance",args:[t,D[null==n?void 0:n.id]?D[null==n?void 0:n.id][0]:null]},{...o,functionName:"allowance",args:[t,D[null==n?void 0:n.id]?D[null==n?void 0:n.id][0]:null]}
1].filter(Boolean),{data:p,isRefetching:c,isLoading:m,isSuccess:y,refetch:x,isFetched:h}=(0,B.useReadContracts)({contracts:u}),f=(0,i.useMemo)(()=>{if(!p)return{guaranteeBalance:"0",tokenBalance:"0",XCIVBalance:"0",guaranteeAllowance:"0",civAssetAllowance:"0",xCivAllowance:"0"};let e={guaranteeBalance:"0",tokenBalance:r?I.bM(r,6):"0",XCIVBalance:d?I.bM(d,18):"0",guaranteeAllowance:"0",civAssetAllowance:p&&"success"===p[1].status?I.bM(p[1].result,r&&6):"0",xCivAllowance:p&&"success"===p[0].status?I.bM(p[0].result,d&&18):"0"};return e},[p,r,d,c,m,y]);return{memoizedBalances:f,refetch:x,isFetched:h}},P=n(61396),W=n.n(P),U=n(70432),L=n(52466),spinner=()=>(0,a.jsxs)("svg",{"aria-hidden":"true",className:"inline w-8 h-6 animate-spin",viewBox:"0 0 50 50",fill:"none",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"25",cy:"25",r:"20",stroke:"#ffffff",strokeWidth:"5"}),(0,a.jsx)("circle",{className:"opacity-100",cx:"25",cy:"25",r:"20",stroke:"#ffffff",strokeWidth:"5",strokeLinecap:"round",strokeDasharray:"80",strokeDashoffset:"60"})]}),viewTX=e=>{let{txHash:t,message:n,type:i}=e,{address:s,chain:l}=(0,T.useAccount)(),o={1:{"User rejected the request":"Request rejected","ERR_V.24":"Epoch Has Expired","ERR_V.19":"No funds available to withdraw","ERR_V.36":"Nothing to claim","ERR_V.37":"Wait for rebalancing to complete","ERR_V.21":"Insufficient User balance","ERR_V.1":"Strategy does not exist","ERR_V.2":"Deposit paused","ERR_V.3":"Treasury Address Length must be 2","ERR_V.4":"Burn failed","ERR_V.5":"Guarantee Token address cannot be null address","ERR_V.6":"First Treasury address cannot be null address","ERR_V.7":"Second Treasury address cannot be null address","ERR_V.8":"Minting failed","ERR_V.9":"Strategy already initialized","ERR_V.10":"No epochs exist","ERR_V.11":"Wait for the previous epoch to settle before requesting withdraw","ERR_V.12":"Insufficient contract balance","ERR_V.13":"Not enough amount to withdraw","ERR_V.14":"Strategy address cannot be null address","ERR_V.15":"Enable withdraw for the previous epoch","ERR_V.16":"Distribute all shares for the previous epoch","ERR_V.17":"Epoch does not exist","ERR_V.18":"Epoch not yet expired","ERR_V.20":"Amount can't be 0","ERR_V.22":"No more users are allowed","ERR_V.23":"Deposit amount exceeds epoch limit","ERR_V.25":"Current balance not enough","ERR_V.26":"Not enough total withdrawals","ERR_V.27":"VPS not yet updated","ERR_V.28":"Already started distribution","ERR_V.29":"Not yet distributed","ERR_V.30":"Already distributed","ERR_V.31":"Fee duration not yet passed","ERR_V.32":"Vault balance is not enough to pay fees","ERR_V.33":"Transfer Failed","ERR_V.34":"Withdraw Token cannot be deposit token","ERR_V.35":"No pending Fees to distribute"},11155111:{"User rejected the request":"Request rejected","ERR_V.24":"Epoch Has Expired","ERR_V.19":"No funds available to withdraw","ERR_V.36":"Nothing to claim","ERR_V.37":"Wait for rebalancing to complete","ERR_V.21":"Insufficient User balance","ERR_V.1":"Strategy does not exist","ERR_V.2":"Deposit paused","ERR_V.3":"Treasury Address Length must be 2","ERR_V.4":"Burn failed","ERR_V.5":"Guarantee Token address cannot be null address","ERR_V.6":"First Treasury address cannot be null address","ERR_V.7":"Second Treasury address cannot be null address","ERR_V.8":"Minting failed","ERR_V.9":"Strategy already initialized","ERR_V.10":"No epochs exist","ERR_V.11":"Wait for the previous epoch to settle before requesting withdraw","ERR_V.12":"Insufficient contract balance","ERR_V.13":"Not enough amount to withdraw","ERR_V.14":"Strategy address cannot be null address","ERR_V.15":"Enable withdraw for the previous epoch","ERR_V.16":"Distribute all shares for the previous epoch","ERR_V.17":"Epoch does not exist","ERR_V.18":"Epoch not yet expired","ERR_V.20":"Amount can't be 0","ERR_V.22":"No more users are allowed","ERR_V.23":"Deposit amount exceeds epoch limit","ERR_V.25":"Current balance not enough","ERR_V.26":"Not enough total withdrawals","ERR_V.27":"VPS not yet updated","ERR_V.28":"Already started distribution","ERR_V.29":"Not yet distributed","ERR_V.30":"Already distributed","ERR_V.31":"Fee duration not yet passed","ERR_V.32":"
1Vault balance is not enough to pay fees","ERR_V.33":"Transfer Failed","ERR_V.34":"Withdraw Token cannot be deposit token","ERR_V.35":"No pending Fees to distribute"},42161:{"ERR_V.1":"Strategy does not exist","ERR_V.2":"Deposit paused","ERR_V.3":"Treasury Address Length must be 2","ERR_V.4":"Burn failed","ERR_V.5":"Wait for rebalancing to complete","ERR_V.6":"First Treasury address cannot be null address","ERR_V.7":"Second Treasury address cannot be null address","ERR_V.8":"Minting failed","ERR_V.9":"Strategy already initialized","ERR_V.10":"No epochs exist","ERR_V.11":"Nothing to claim","ERR_V.12":"Insufficient contract balance","ERR_V.13":"Not enough amount to withdraw","ERR_V.14":"Strategy address cannot be null address","ERR_V.15":"No pending Fees to distribute","ERR_V.16":"Distribute all shares for previous epoch","ERR_V.17":"Epoch does not exist","ERR_V.18":"Epoch not yet expired","ERR_V.19":"Vault balance is not enough to pay fees","ERR_V.20":"Amount can't be 0","ERR_V.21":"Insufficient User balance","ERR_V.22":"No more users are allowed","ERR_V.23":"Deposit amount exceeds epoch limit","ERR_V.24":"Epoch expired","ERR_V.25":"Current balance not enough","ERR_V.26":"Not enough total withdrawals","ERR_V.27":"VPS not yet updated","ERR_V.28":"Already started distribution","ERR_V.29":"Not yet distributed","ERR_V.30":"Already distributed","ERR_V.31":"Fee duration not yet passed","ERR_V.32":"Withdraw Token cannot be deposit token","ERR_V.33":"Arrays must have same lenght!","ERR_V.34":"Entry fee too high!","ERR_V.35":"Not enough shares to distribute"}};return(0,a.jsxs)(a.Fragment,{children:["success"===i&&(0,a.jsxs)("div",{className:"flex gap-x-4",children:[(0,a.jsx)("div",{className:"p-2 bg-cartoonGreen rounded-12 flex items-center",children:(0,a.jsx)(U.Z,{width:25})}),(0,a.jsxs)("div",{className:"",children:[(0,a.jsx)("h1",{children:n}),42161==l.id?(0,a.jsx)(W(),{className:"underline",href:"https://arbiscan.io/tx/".concat(t),target:"_blank",children:"View Transaction"}):(0,a.jsx)(W(),{className:"underline",href:"https://".concat((null==l?void 0:l.id)==5?"goerli.":"","etherscan.io/tx/").concat(t),target:"_blank",children:"View Transaction"})]})]}),"error"===i&&(0,a.jsxs)("div",{className:"flex items-center gap-x-4",children:[(0,a.jsx)("div",{className:"p-2 bg-cartoonRed rounded-12 flex items-center",children:(0,a.jsx)(L.Z,{width:25})}),(0,a.jsx)("div",{className:"",children:(0,a.jsx)("h1",{className:"",children:n?(e=>{if(e.includes("0xdAC17F958D2ee523a2206206994597C13D831ec7"))return"Authorization failed! In order to authorize USDT spending on CivFund, you need to first revoke the current authorization and then authorize a new USDT amount. This process requires two transactions to be signed";if(e.includes("HTTP request failed"))return"Network Connection Error. Check Your Internet";if(e.includes("ERC20: insufficient allowance"))return"Authorize More USDT. Click 'Authorize' button ";if(e.includes("User rejected the request"))return"Request rejected";let t=e.match(/ERR_V\.\d+/),n=t?t[0]:null;return n&&o[l.id][n]||e})(n):"Transaction was denied by EVM. Double check inputs and try again."})})]}),"loading"===i&&(0,a.jsxs)("div",{className:"flex items-center gap-x-4",children:[(0,a.jsxs)("div",{className:"p-2 rounded-12 flex items-center",children:[" ",(0,a.jsx)(spinner,{})]}),(0,a.jsx)("div",{className:"",children:(0,a.jsx)("h1",{children:n||"Transaction sent to wallet..."})})]})]})},H=n(21758),O=n(77778);let trimStringNumberToDecimals=(e,t)=>{let n=e.indexOf(".");return -1===n||e.length<=n+t?e:e.substring(0,n+t+1)},minNumber=(e,t)=>{let n=Number(e),a=Number(t);return n<a?n:a};var z=n(94660);let G=(0,z.Ue)(e=>({poolApiData:{},investableUsdt:0,setPoolApiData:t=>e(e=>({poolApiData:"function"==typeof t?t(e.poolApiData):t})),setInvestableUsdt:t=>e({investableUsdt:t})}));var X=n(79009),modal=e=>{var t,n,l,o;let{type:r,onClose:d,availableBalance:u,inputAmount:p,setInputAmount:c,poolId:m,handleDeposit:y,setWeb3LoadingStates:h,fetchData:v,web3LoadingStates:N,handleApprove:A,guaranteeAllowance:E,poolDataFromSocket:R}=e,{address:S,chain:V}=(0,T.useAccount)(),{setGuaranteeFee:k,tokenPrices:M,setMessage:C,transactionsStatus:F,setTransactionsStatus:B}=(0,s.Z)(),{investableUsdt:I}=G(),P=[25,50,75,100];contractReads_useGuaranteeFee(V,m,null==p?void 0:p.depositAmount);
1let[W,U]=(0,i.useState)(!0),{memoizedBalances:L,refetch:z,isFetched:Z}=loadBalances(m),{guaranteeBalance:q}=L,[Y,$]=(0,i.useState)(0),[J,K]=(0,i.useState)(0),[Q,ee]=(0,i.useState)(!1),[et,en]=(0,i.useState)(void 0),[ea,ei]=(0,i.useState)({"5%":!1,"10%":!1,"30%":!1}),es={"5%":.05,"10%":.1,"30%":.3};V&&D[null==V?void 0:V.id]&&D[null==V?void 0:V.id][0];let calculatePercentage=(e,t)=>{if("withdraw"===t){let t=new O.Z(u.XCIVshares),n=new O.Z(e),a=n.dividedBy(100).times(t),i=trimStringNumberToDecimals(a.toString(),7);c(e=>({...e,withdrawAmount:i}))}else if("deposit"===t){let t=e/100*I;c(e=>({...e,depositAmount:t.toFixed(2)}))}},hasEnoughBalanceFn=()=>{let e="withdraw"===r?p.withdrawAmount:p.depositAmount,t="withdraw"===r?u.XCIVshares:I;Number(e)>Number(t)?U(!1):U(!0)},handleCustomAmount=e=>{c(t=>({...t,[e.target.name]:e.target.value}))},handleClose=()=>{c({withdrawAmount:"",depositAmount:""}),null==d||d()},handlePercentageButtons=()=>P.map((e,t)=>(0,a.jsx)("button",{className:"secondary_button !text-[9px] p-1 mr-2",onClick:()=>calculatePercentage(e,r),children:e<100?e.toString()+"%":"Max"},"percentages--".concat(t))),calculateSlippageAmount=(e,t)=>{let n=(null==V?void 0:V.id)!=1?Number(t)/100:.01*Number(t)/M.STONEprice;return n+n*e},autoFilledSlippage=()=>{let setSlippage=e=>{let t=calculateSlippageAmount(es[e],p.depositAmount);Number(E)>=t.toFixed(6)&&0>=!Number(p.depositAmount)?ei(t=>({...t,[e]:!0})):ei(t=>({...t,[e]:!1}))};setSlippage("5%"),setSlippage("10%"),setSlippage("30%")};parseFloat(J.toFixed(6));let{data:el,writeContractAsync:eo}=(0,j.useWriteContract)(),{isLoading:er,isSuccess:ed,TxData:eu}=(0,_.useWaitForTransactionReceipt)({hash:el});return(0,i.useEffect)(()=>{hasEnoughBalanceFn()},[p]),(0,i.useEffect)(()=>{ei({"5%":!1,"10%":!1,"30%":!1})},[p.depositAmount]),(0,i.useEffect)(()=>{!1===et&&ee(!1)},[et]),(0,i.useEffect)(()=>{ed&&(C((0,a.jsx)(viewTX,{chain:V.id,txHash:null==eu?void 0:eu.transactionHash,type:"success",message:"Guarantee Approved successful"})),h(e=>({...e,guaranteeApproveState:!1}))),ee(null)},[ed,er]),(0,i.useEffect)(()=>{B({guaranteeAproveSuccess:ed})},[ed]),(0,i.useEffect)(()=>{autoFilledSlippage()},[p.depositAmount,E,ed]),(0,i.useEffect)(()=>{$(Math.min(Number(u.guarantee),Number(E)))},[E,u.guarantee]),(0,i.useEffect)(()=>{null!==r&&(0,X.d)()},[r]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(x(),{id:"171387a2e81a0e5a",children:"input.jsx-171387a2e81a0e5a::-webkit-outer-spin-button,input.jsx-171387a2e81a0e5a::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number].jsx-171387a2e81a0e5a{-moz-appearance:textfield}"}),(0,a.jsx)("div",{className:"jsx-171387a2e81a0e5a "+"fixed modal-container z-[999] w-full md:p-4 top-0 left-0 h-full flex items-center max-sm:items-end justify-center ".concat(w().modal),children:(0,a.jsx)("div",{className:"jsx-171387a2e81a0e5a  w-full mx-auto flex items-center justify-center ",children:(0,a.jsxs)("div",{className:"jsx-171387a2e81a0e5a relative w-[480px] max-sm:w-full pb-5  rounded-12 text-[white] bg-poolDarkBlue",children:["withdraw"===r&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"jsx-171387a2e81a0e5a header flex items-center justify-between bg-poolDarkBlue py-3 px-5 text-white rounded-12",children:[(0,a.jsxs)("div",{className:"jsx-171387a2e81a0e5a flex items-center",children:[(0,a.jsx)("div",{className:"jsx-171387a2e81a0e5a p-2 rounded-full mr-2 bg-darkBackground",children:(0,a.jsx)(f(),{src:"/assets/pngs/withdraw.png",width:24,height:24,alt:"withdraw",className:""})}),(0,a.jsxs)("h1",{className:"jsx-171387a2e81a0e5a font-semibold text-xl capitalize",children:[r," USDT"]})]}),(0,a.jsx)("div",{onClick:handleClose,className:"jsx-171387a2e81a0e5a close cursor-pointer",children:(0,a.jsx)(f(),{src:b.x8,width:40,height:40,alt:"stack",className:""})})]}),(0,a.jsxs)("div",{className:"jsx-171387a2e81a0e5a px-5 mt-8",children:[(0,a.jsxs)("div",{className:"jsx-171387a2e81a0e5a amount",children:[(0,a.jsxs)("p",{className:"jsx-171387a2e81a0e5a text-lg text-white mb-3",children:["Shares: ",(0,a.jsx)("br",{className:"jsx-171387a2e81a0e5a"})," ",(0,a.jsxs)("span",{className:"jsx-171387a2e81a0e5a text-xl max-sm:text-lg font-extralight text-white",children:[(0,g.R)(u.XCIVshares,4)," "]}),(0,a.jsxs)("span",{className:"jsx-171387a2e81a0e5a max-sm:text-sm",children:["(",((null==u?void 0:u.XCIVshares)*(null==R?void 0:null===(n=R.fullHistory)||void 0===n?void 0:null===(t=n[(null==R?void 0:R.fullHistory.length)-1])||void 0===t?void 0:t[1])||0).toFixed(2)," USDT)"]})," "]}),(0,a.jsxs)("div",{className:"jsx-171387a2e81a0e5a "+"input h-[115px] bg-darkBackgroun
1d rounded-12 flex flex-col justify-start ".concat(W?"bg-darkBackground":"bg-cartoonRed"),children:[(0,a.jsxs)("div",{className:"jsx-171387a2e81a0e5a mt-2 flex items-center justify-between",children:[(0,a.jsx)("h1",{className:"jsx-171387a2e81a0e5a ml-4",children:"Amount"}),(0,a.jsx)("div",{className:"jsx-171387a2e81a0e5a",children:handlePercentageButtons()})]}),(0,a.jsx)("input",{type:"number",id:"success",placeholder:(0,g.R)(0,2),name:"withdrawAmount",onChange:handleCustomAmount,value:p.withdrawAmount,className:"jsx-171387a2e81a0e5a bg-transparent outline-none rounded-12 block w-full mt-1 mb-2 text-3xl ml-4 font-semibold"}),(0,a.jsxs)("div",{className:"jsx-171387a2e81a0e5a flex ml-4 w-40 pr-3 text-right text-xs",children:[(0,a.jsx)("span",{className:"jsx-171387a2e81a0e5a",children:"".concat((p.withdrawAmount*(null==R?void 0:null===(o=R.fullHistory)||void 0===o?void 0:null===(l=o[R.fullHistory.length-1])||void 0===l?void 0:l[1])).toFixed(2))}),(0,a.jsx)("span",{className:"jsx-171387a2e81a0e5a ml-1",children:"USDT"})]})]})]}),(0,a.jsx)("div",{className:"jsx-171387a2e81a0e5a flex justify-between mt-5",children:(0,a.jsx)("button",{disabled:!W||0>=Number(p.withdrawAmount),onClick:()=>{A(),d()},className:"jsx-171387a2e81a0e5a "+"capitalize w-full py-3 rounded-12 px-16 max-sm:px-10 ".concat(W&&Number(p.withdrawAmount)>0?"primary_button":"grey_button text-[gray]"),children:W?(0,a.jsx)("span",{className:"jsx-171387a2e81a0e5a",children:"Withdraw"}):(0,a.jsx)("span",{className:"jsx-171387a2e81a0e5a text-cartoonRed",children:"Not enough shares"})})})]})]}),"deposit"===r&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"jsx-171387a2e81a0e5a header flex items-center justify-between bg-poolDarkBlue py-3 px-5 text-white rounded-12",children:[(0,a.jsxs)("div",{className:"jsx-171387a2e81a0e5a flex items-center",children:[(0,a.jsx)("div",{className:"jsx-171387a2e81a0e5a p-2 rounded-full mr-2 bg-darkBackground",children:(0,a.jsx)(f(),{src:"/assets/pngs/deposit.png",width:24,height:24,alt:"deposit",className:""})}),(0,a.jsxs)("h1",{className:"jsx-171387a2e81a0e5a font-semibold text-[18px] capitalize",children:[r," USDT"]})]}),(0,a.jsx)("div",{onClick:handleClose,className:"jsx-171387a2e81a0e5a close cursor-pointer",children:(0,a.jsx)(f(),{src:b.x8,width:40,height:40,alt:"stack",className:""})})]}),(0,a.jsxs)("div",{className:"jsx-171387a2e81a0e5a px-5 mt-4",children:[(0,a.jsxs)("div",{className:"jsx-171387a2e81a0e5a amount",children:[(0,a.jsxs)("p",{className:"jsx-171387a2e81a0e5a text-lg mb-3",children:["Authorized: ",(0,a.jsx)("br",{className:"jsx-171387a2e81a0e5a"})," ",(0,a.jsxs)("span",{className:"jsx-171387a2e81a0e5a text-xl max-sm:text-lg font-extralight text-white",children:[(0,g.R)(I,2)," USDT"]})]}),(0,a.jsxs)("div",{className:"jsx-171387a2e81a0e5a "+"input h-[115px] bg-darkBackground rounded-12 flex flex-col justify-start ".concat(W?"bg-darkBackground":"bg-cartoonRed"),children:[(0,a.jsxs)("div",{className:"jsx-171387a2e81a0e5a mt-2 flex items-center justify-between",children:[(0,a.jsx)("h1",{className:"jsx-171387a2e81a0e5a px-4",children:"Amount"}),(0,a.jsx)("div",{className:"jsx-171387a2e81a0e5a",children:handlePercentageButtons()})]}),(0,a.jsx)("input",{type:"number",id:"success",placeholder:(0,g.R)(0,2),name:"depositAmount",value:p.depositAmount,onChange:handleCustomAmount,className:"jsx-171387a2e81a0e5a bg-transparent outline-none rounded-12 block w-full mt-1 mb-2 text-3xl ml-4 font-semibold"}),(0,a.jsx)("div",{className:"jsx-171387a2e81a0e5a ml-4 text-xs",children:(0,a.jsx)("p",{className:"jsx-171387a2e81a0e5a text-xs",children:"fee: 1%"})})]})]}),(0,a.jsx)("div",{className:"jsx-171387a2e81a0e5a flex justify-between mt-5",children:(0,a.jsx)("button",{disabled:!W||0>=Number(p.depositAmount),onClick:()=>{y(),d()},className:"jsx-171387a2e81a0e5a "+"capitalize w-full py-3 rounded-12 px-16 max-sm:px-10 ".concat(W&&Number(p.depositAmount)>0?"primary_button":"grey_button text-[gray]"),children:W?(0,a.jsx)("span",{className:"jsx-171387a2e81a0e5a",children:"Deposit"}):(0,a.jsx)("span",{className:"jsx-171387a2e81a0e5a text-cartoonRed",children:"Not enough USDT. Authorize more"})})})]})]})]})})}),(0,a.jsxs)("div",{className:"jsx-171387a2e81a0e5a text-[13px] ",children:[(0,a.jsx)(H.u,{anchorSelect:"#fiveslippage",content:"Wallet has approved and holds at least 5% more ONE than the minimum required for this transaction.",className:" text-center text-[10px] z-[9999] max-w-[200px]"}),(0,a.jsx)(H.u,{anchorSelect:"#tenslippage",content:"Wallet has approved and holds at least 10% more ONE than the minimum required for this transaction.",className:" text-center text-[10px] z-[9999] max-w-[200px]"}),(0,a.jsx)(H.u,{anchorSelect:"#thirtyslippage",content:"Wallet has approved and holds at least 30% more ONE than the minimum required for this transaction.",className:" text-center text-[10px] z-[9999] max-w-[200px]"}),(0,a.jsx)(H.u,{anchorSelect:"#mainslippage",content:"Refers to the max amount of 0NE you've allowed to be used as guarantee. Smartcontract will always take the minimum required amount of 0NE needed regardless of slippage.",className:" text-[10px] z-[9999] max-w-[300px]"})]})]})},tokenDecimals=e=>{let{address:t,chain:n}=(0,T.useAccount)();return A[null==n?void 0:n.id]&&A[null==n?void 0:n.id][e],{INVEST_DECIMAL:6,GUARANTEE_DECIMAL:18,XCIV_DECI
1MAL:18}},contractReads_useUserVaultData=e=>{let{address:t,chain:n}=(0,T.useAccount)(),{INVEST_DECIMAL:a}=tokenDecimals(e),s=D[null==n?void 0:n.id]?D[null==n?void 0:n.id][0]:null,l=E[null==n?void 0:n.id]?E[null==n?void 0:n.id][0]:null,{data:o,refetch:r}=(0,F.useReadContract)({address:s,abi:C,functionName:"getCurrentEpoch",args:[e],query:{enabled:!!s}}),d=null!=o,{data:u,refetch:p}=(0,B.useReadContracts)({contracts:[{address:l,abi:M,functionName:"getUnclaimedTokens",args:[e,t]},{address:s,abi:C,functionName:"getUserInfoEpoch",args:[e,t,d?o:0n]}],query:{enabled:!!t&&!!s&&!!l&&d}}),c=(0,i.useMemo)(()=>{var e,t;let n=(null==u?void 0:null===(e=u[0])||void 0===e?void 0:e.status)==="success"?u[0].result:0n,i=(null==u?void 0:null===(t=u[1])||void 0===t?void 0:t.status)==="success"?u[1].result:null;return{claimableWithdraw:Number(I.bM(null!=n?n:0n,a)),depositAmounts:i?Number(i.depositInfo):0,withdrawAmounts:i?i.withdrawInfo:0n}},[u,a]);return{userVaultData:c,refetch:()=>{r(),p()}}},utils_useTransaction=(e,t,n,l,o,r,d)=>{let{setMessage:u,guaranteeFee:p,transactionsStatus:c,setTransactionsStatus:m}=(0,s.Z)(),y=e&&""!=e?e.charAt(0).toUpperCase()+e.slice(1):null,x="withdraw"===e?t&&R[null==t?void 0:t.id]?R[null==t?void 0:t.id][n]:null:t&&N[null==t?void 0:t.id]?N[null==t?void 0:t.id][0]:null,h=t&&D[null==t?void 0:t.id]?D[null==t?void 0:t.id][0]:null,f="withdraw"===e&&null!==l.withdrawAmount&&""!==l.withdrawAmount?I.vz(l.withdrawAmount,18):"0";parseFloat(p.toFixed(6));let[b,v]=(0,i.useState)(0);(0,i.useEffect)(()=>{v("deposit"===e&&Number(l.depositAmount)>0?I.vz(trimStringNumberToDecimals(l.depositAmount,6),6):null)});let{data:w,writeContractAsync:g}=(0,j.useWriteContract)({address:x,abi:S,functionName:"approve",args:[h,"withdraw"===e?f:b]}),{isLoading:T,isSuccess:A}=(0,_.useWaitForTransactionReceipt)({hash:w}),E="withdraw"===e?"withdraw":"deposit",{writeContractAsync:V,data:k}=(0,j.useWriteContract)(),{isSuccess:M,data:F}=(0,_.useWaitForTransactionReceipt)({hash:k}),handleApprove=async()=>{u((0,a.jsx)(viewTX,{type:"loading"})),"withdraw"===e&&r(e=>({...e,bookUSDTWithdrawal:!0}));try{parseFloat(o.xCivAllowance)>=parseFloat(l.withdrawAmount)?await (null==V?void 0:V({address:t&&D[null==t?void 0:t.id]?D[null==t?void 0:t.id][0]:null,abi:C,functionName:E,args:[n,"withdraw"===e?f:b],enabled:A})):await g({address:x,abi:S,functionName:"approve",args:[h,"withdraw"===e?f:b]})}catch(e){console.error("Error approving:",e),u((0,a.jsx)(viewTX,{type:"error",message:e.message})),r(e=>({...e,bookUSDTWithdrawal:!1}))}},handleDeposit=async()=>{u((0,a.jsx)(viewTX,{type:"loading",message:"Transaction Approved. ".concat(y,"ing....")})),"deposit"===e&&r(e=>({...e,BookUSDTDeposit:!0})),"withdraw"===e&&r(e=>({...e,bookUSDTWithdrawal:!0}));try{await (null==V?void 0:V({address:t&&D[null==t?void 0:t.id]?D[null==t?void 0:t.id][0]:null,abi:C,functionName:E,args:[n,"withdraw"===e?f:b],enabled:A}))}catch(e){console.error("Error depositing:",e),r(e=>({...e,bookUSDTWithdrawal:!1,BookUSDTDeposit:!1})),u((0,a.jsx)(viewTX,{type:"error",message:e.message}))}};return(0,i.useEffect)(()=>{A&&handleDeposit()},[A,T]),(0,i.useEffect)(()=>{M&&(u((0,a.jsx)(viewTX,{chain:t.id,txHash:null==F?void 0:F.transactionHash,type:"success",message:"".concat(y," successful")})),"deposit"===e&&r(e=>({...e,BookUSDTDeposit:!1})),"withdraw"===e&&r(e=>({...e,bookUSDTWithdrawal:!1})))},[M]),(0,i.useEffect)(()=>{m({["".concat(e)]:M})},[M]),{handleApprove,handleDeposit,isLoading:T,depositAmount:b}},Z=n(21497),q=n(65251),Y=n(68246),pool_USDTManagement=e=>{var t,n,l,o;let{apiData:r,availableBalance:d,poolId:p,fetchData:c,setModalType:m,web3LoadingStates:y,setWeb3LoadingStates:x,allowDeposit:h,poolDataFromSocket:b}=e,{setTransactionType:v,setMessage:w,tokenDecimals:N,setTransactionsStatus:E,transactionsStatus:R,currentWalletAddress:S}=(0,s.Z)(),{address:V,chain:M}=(0,T.useAccount)(),{open:F,close:B}=(0,Y.k_)(),{data:P,writeContractAsync:W}=(0,j.useWriteContract)(),{data:U,writeContractAsync:L}=(0,j.useWriteContract)(),{data:O,writeContractAsync:z}=(0,j.useWriteContract)(),{data:X,writeContractAsync:$}=(0,j.useWriteContract)(),{signMessageAsync:J}=(0,Z.useSignMessage)(),{isSuccess:K}=(0,_.useWaitForTransactionReceipt)({hash:P}),{data:Q,isSuccess:ee}=(0,_.useWaitForTransactionReceipt)({hash:U}),{data:et,isSuccess:en}=(0,_.useWaitForTransactionReceipt)({hash:O}),{data:ea,isSuccess:ei}=(0,_.useWaitForTransactionReceipt)({hash:X}),{data:es,writeContractAsync:el}=(0,j.useWriteContract)(),{data:eo,writeContractAsync:er}=(0,j.useWriteContract)(),{data:ed,isSuccess:eu}=(0,_.useWaitForTransactionReceipt)({hash:es}),{data:ep,isSuccess:ec}=(0,_.useWaitForTransactionReceipt)({hash:eo}),{refetch:em}=loadBalances(p);(0,i.useEffect)(()=>{(en||ei||eu)&&em()},[en,ei,eu,em]);let handleClaim=async e=>{if("assets"===e){v("claim asset"),w((0,a.jsx)(viewTX,{type:"loading",message:"Claiming USDT..."})),x(e=>({...e,claimAsset:!0}));try{await (null==el?void 0:el({address:M&&D[null==M?void 0:M.id]?D[null==M?void 0:M.id][0]:null,abi:C,functionName:"
1claimWithdrawedTokens",args:[p],enabled:!1}))}catch(e){console.error("Error claiming assets:",e),w((0,a.jsx)(viewTX,{type:"error",message:e.message}))}finally{x(e=>({...e,claimAsset:!1}))}}else if("guarantee"===e){v("claim guarantee"),w((0,a.jsx)(viewTX,{type:"loading",message:"Claim Guarantee (0NE) sent to web3..."})),x(e=>({...e,claimableGuarantee:!0}));try{await (null==er?void 0:er({address:M&&D[null==M?void 0:M.id]?D[null==M?void 0:M.id][0]:null,abi:C,functionName:"claimGuaranteeToken",args:[p]}))}catch(e){console.error("Error claiming guarantee:",e),w((0,a.jsx)(viewTX,{type:"error",message:e.message}))}finally{x(e=>({...e,claimableGuarantee:!1}))}}};(0,i.useEffect)(()=>{eu&&(x(e=>({...e,claimAsset:!1})),w((0,a.jsx)(viewTX,{message:"USDT Claimed",txHash:null==ed?void 0:ed.transactionHash,type:"success"}))),ec&&(x(e=>({...e,claimableGuarantee:!1})),w((0,a.jsx)(viewTX,{message:"Claimed guarantee (0NE) successfully",txHash:null==ep?void 0:ep.transactionHash,type:"success"})))},[eu,ec]),(0,i.useEffect)(()=>{E({claimAssetsIsSucess:eu,claimGuaranteeIsSuccess:ec})},[ec,eu]);let{investableUsdt:ey}=G(),openModal=e=>{v(e),m(e)},handleApprove=async()=>{E({editUSDTAllowance:!1}),0>=!Number(d.civAssetAllowance)&&await J({message:"In order to authorize USDT spending on CivFund, you need to first revoke the current authorization and then authorize a new USDT amount. This process requires two transactions to be signed"}),v("Edit Allowance"),w((0,a.jsx)(viewTX,{type:"loading"})),x(e=>({...e,editUsdtAllowance:!0}));try{0>=Number(d.civAssetAllowance)?await performEdit():await (null==W?void 0:W({address:M&&A[null==M?void 0:M.id]?A[null==M?void 0:M.id][p]:null,abi:k,functionName:"approve",args:[M&&D[null==M?void 0:M.id]?D[null==M?void 0:M.id][0]:null,I.fi("0")]}))}catch(e){console.log("Error approving:",e.message),w((0,a.jsx)(viewTX,{type:"error",message:e.message})),x(e=>({...e,editUsdtAllowance:!1}))}},performEdit=async()=>{x(e=>({...e,editUsdtAllowance:!0})),w((0,a.jsx)(viewTX,{type:"loading",message:0>=Number(d.civAssetAllowance)?"Authorizing USDT spending on CivFund...":"Transaction 1/2 successful..."}));try{await (null==L?void 0:L({address:M&&A[null==M?void 0:M.id]?A[null==M?void 0:M.id][p]:null,abi:k,functionName:"approve",args:[M&&D[null==M?void 0:M.id]?D[null==M?void 0:M.id][0]:null,d.usdt&&(null==N?void 0:N.INVEST_DECIMAL)>0?I.vz(d.usdt,null==N?void 0:N.INVEST_DECIMAL):"0"]}))}catch(e){console.log("Error editing:",e.message),w((0,a.jsx)(viewTX,{type:"error",message:e.message})),x(e=>({...e,editUsdtAllowance:!1}))}},handleCancel=async e=>{if("deposit"===e){v("cancelDeposit"),w((0,a.jsx)(viewTX,{type:"loading",message:"Canceling Deposit..."})),x(e=>({...e,cancelDeposit:!0}));try{await (null==z?void 0:z({address:M&&D[null==M?void 0:M.id]?D[null==M?void 0:M.id][0]:null,abi:C,functionName:"cancelDeposit",args:[p]}))}catch(e){console.error("Error canceling deposit:",e),w((0,a.jsx)(viewTX,{type:"error",message:e.message})),x(e=>({...e,cancelDeposit:!1}))}}else if("withdraw"===e){v("withdrawDeposit"),w((0,a.jsx)(viewTX,{type:"loading",message:"Canceling Withdraw..."})),x(e=>({...e,cancelWithdrawal:!0}));try{await (null==$?void 0:$({address:M&&D[null==M?void 0:M.id]?D[null==M?void 0:M.id][0]:null,abi:C,functionName:"cancelWithdraw",args:[p]}))}catch(e){w((0,a.jsx)(viewTX,{type:"error",message:e.message})),x(e=>({...e,cancelWithdrawal:!1}))}}},ex=parseInt(r.epochStartTime),eh=ex+parseInt(r.epochDuration),calculatePercentage=()=>{let e=Math.floor(Date.now()/1e3);return Math.min(100,Math.max(0,(e-ex)/(eh-ex)*100))},[ef,eb]=(0,i.useState)(0);(0,i.useEffect)(()=>{let e=setInterval(()=>{eb(calculatePercentage)},1e3);return()=>clearInterval(e)},[()=>{let e=new Date(1e3*ex),t=e.toLocaleDateString(),n=e.toLocaleTimeString();return[n,t]},()=>{let e=new Date(1e3*eh),t=e.toLocaleDateString(),n=e.toLocaleTimeString();return[n,t]}]),(0,i.useEffect)(()=>{K&&(x(e=>({...e,editUsdtAllowance:!1})),performEdit())},[K]),(0,i.useEffect)(()=>{ee&&(E({editUSDTAllowance:!0}),x(e=>({...e,editUsdtAllowance:!1})),w((0,a.jsx)(viewTX,{message:"Success",txHash:null==Q?void 0:Q.transactionHash,type:"success"})))},[ee]),(0,i.useEffect)(()=>{en&&(x(e=>({...e,cancelDeposit:!1})),w((0,a.jsx)(viewTX,{message:"Deposit cancelled successfully",txHash:null==et?void 0:et.transactionHash,type:"success"}))),ei&&(x(e=>({...e,cancelWithdrawal:!1})),w((0,a.jsx)(viewTX,{message:"Withdrawal cancelled successfully",txHash:null==ea?void 0:ea.transactionHash,type:"success"})))},[en,ei]),(0,i.useEffect)(()=>{E({isSuccessDataEdit:ee,cancelDepositIsSuccess:en,cancelWithdrawIsSuccess:ei})},[ee,en,ei]);let ev=(0,i.useRef)(null),ew=ev.current?ev.current.scrollHeight:0,eg=d.XCIVshares&&(null==b?void 0:b.fullHistory)?d.XCIVshares*(null==b?void 0:null===(t=b.fullHistory[b.fullHistory.length-1])||void 0===t?void 0:t[1]):0,eT=(0,g.r)(eg,2),ej=minNumber(d.usdt,d.civAssetAllowance)>0;
1return(0,a.jsx)("div",{className:"bg-poolDarkBlue shadow rounded-12 md:px-5 py-3 mt-5 max-sm:px-3 h-full",children:(0,a.jsxs)("div",{className:u().pool_detail__epoch__inprogress,children:[S?(0,a.jsx)(q.E.div,{initial:{height:0},animate:{height:ew},transition:{duration:.5,ease:"easeInOut"},style:{overflow:"hidden"},children:(0,a.jsxs)("div",{ref:ev,className:"bg-[#172029] rounded-12 sm:mx-4 md:mx-0 py-6 max-sm:py-2",children:[(0,a.jsxs)("div",{className:"".concat(u().pool_detail_performance__assets," flex justify-between"),children:[(0,a.jsxs)("div",{className:u().pool_detail_performance__assets_asset,children:[(0,a.jsx)("h1",{children:"Balance"}),(0,a.jsx)("div",{className:"",children:(0,a.jsxs)("h2",{children:[d.usdt?(0,g.R)(d.usdt,2):"0.00"," USDT"]})})]}),(0,a.jsxs)("div",{className:"".concat(u().pool_detail_performance__assets_asset," relative top-[25px]"),children:[(0,a.jsx)("h1",{className:"!text-xl !font-extrabold",children:"Allocated"}),(0,a.jsxs)("h2",{id:"".concat(eg<1e3?"":"allocated_info"),className:"!text-cartoonYellow !text-2xl !font-black w-100 overflow-visible",children:["$",eT]})]}),(0,a.jsxs)("div",{className:u().pool_detail_performance__assets_asset,children:[(0,a.jsx)("h1",{children:"Shares"}),(0,a.jsxs)("h2",{children:[d.XCIVshares?(0,g.R)(d.XCIVshares,2):"0.00"," CIVS0"]})]})]}),(0,a.jsxs)("div",{className:"".concat(u().pool_detail_performance__assets," flex justify-between grid !grid-cols-2 mt-4 max-sm:mt-6"),children:[(0,a.jsxs)("div",{className:u().pool_detail_performance__assets_asset,children:[(0,a.jsx)("h1",{children:"Authorized"}),(0,a.jsxs)("h2",{children:[d.civAssetAllowance?(0,g.R)(ey,2):"0.00"," USDT"]})]}),(0,a.jsxs)("div",{className:u().pool_detail_performance__assets_asset,children:[(0,a.jsx)("h1",{children:"Claimable"}),(0,a.jsxs)("h2",{children:[d.investDecimals>0&&(null==r?void 0:r.claimableWithdraw)!=null?(0,g.R)(Number(r.claimableWithdraw),2):"0.00"," USDT"]})]})]})]})}):(0,a.jsxs)("div",{className:"text-center font-bold flex flex-col items-center mx-auto mt-8 mb-7 text-white ",children:[(0,a.jsx)("h1",{className:"text-3xl",children:"Wallet Not Connected"}),(0,a.jsx)("p",{className:"text-sm mb-3",children:"Connect your wallet to yield USDT"}),(0,a.jsxs)("div",{className:"connect bg-cartoonYellow hover:bg-cartoonYellowHover px-3 py-3 rounded-12 flex items-center gap-2 cursor-pointer max-sm:text-sm max-sm:px-3 max-sm:py-3 transition duration-200 ease-in-out",onClick:()=>F(),children:[(0,a.jsx)(f(),{src:"/assets/pngs/chains/ethereum-eth-logo-white.png",width:20,height:20,alt:"lighting"}),(0,a.jsx)("h2",{className:"!font-normal",children:"connected"===S?"".concat(S.substring(4,-1),"...").concat(S.substring(S.length-6)):"Connect wallet"})]})]}),(0,a.jsxs)("div",{className:u().button_container+" flex",children:[" ",(0,a.jsxs)("div",{className:u().action_column,children:[(0,a.jsx)("button",{id:"edit-usdt-allowance",className:"".concat(r.epochHasExpired||y.editUsdtAllowance||!S?"grey_button text-white cursor-not-allowed max-sm:w-full":"primary_button max-sm:w-full"),onClick:()=>handleApprove(),disabled:y.editUsdtAllowance||!S,children:y.editUsdtAllowance?(0,a.jsx)(spinner,{}):(0,a.jsx)("div",{className:"flex items-center justify-center ml-1",children:(0,a.jsx)(f(),{className:"",src:"/assets/pngs/authorize.png",width:32,height:32,alt:"lighting"})})}),(0,a.jsx)("div",{className:u().pool_detail_performance__assets_asset,children:(0,a.jsx)("h1",{className:"".concat(r.epochHasExpired||y.editUsdtAllowance||!S?"gray_text":""),children:"Authorize"})})]}),(0,a.jsxs)("div",{className:u().action_column,children:[(0,a.jsx)("button",{id:"book-usdt-deposit",className:"".concat(r.epochHasExpired||y.BookUSDTDeposit||!h||!ej?"grey_button text-white cursor-not-allowed":"primary_button"),onClick:()=>openModal("deposit"),disabled:!!r.epochHasExpired||y.BookUSDTDeposit||!h||!ej,children:y.BookUSDTDeposit?(0,a.jsx)(spinner,{}):(0,a.jsx)("div",{className:"flex items-center justify-center",children:(0,a.jsx)(f(),{className:"",src:"/assets/pngs/deposit.png",width:32,height:32,alt:"lighting"})})}),(0,a.jsx)("div",{className:u().pool_detail_performance__assets_asset,children:(0,a.jsx)("h1",{className:"".concat(r.epochHasExpired||y.BookUSDTDeposit||!h||!ej?"gray_text":""),children:"Deposit"})})]}),(0,a.jsx)("div",{className:"mr-5 ml-5 flex items-center relative",children:(0,a.jsx)("svg",{width:"1",height:"42",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)("line",{x1:"1",y1:"0",x2:"1",y2:"42",stroke:"#A2A8BA",strokeWidth:"1"})})}),(0,a.jsxs)("div",{className:u().action_column,children:[(0,a.jsx)("button",{id:"book-usdt-withdrawal",className:"".concat(r.epochHasExpired||y.bookUSDTWithdrawal||1e-6>=Number(d.XCIVshares)?"grey_button text-white cursor-not-allowed":"primary_button"),onClick:()=>openModal("withdraw"),disabled:!!(r.epochHasExpired||1e-6>=Number(d.XCIVshares))||y.bookUSDTWithdrawal,children:y.bookUSDTWithdrawal?(0,a.jsx)(spinner,{}):(0,a.jsx)("div",{className:"flex items-center justify-center",children:(0,a.jsx)(f(),{src:"/assets/pngs/withdraw.png",width:32,height:32,alt:"withdraw"})})}),(0,a.jsx)("div",{className:u().pool_detail_performance__assets_asset,children:(0,a.jsx)("h1",{className:"".concat(r.epochHasExpired||y.bookUSDTWithdrawal||1e-6>=Number(d.XCIVshares)?"gray_text":""),children:"Withdraw"})})]}),(0,a.jsxs)("div",{className:u().action_column,children:[(0,a.jsx)("button",{id:"claim-usdt",className:"".concat(r.claimableWithdraw>0&&!y.claimAsset?"primary_button max-sm:w-full":"grey_button text-white cursor-not-allowed max-sm:w-full"),onClick:()=>handleClaim("assets"),disabled:r.claimableWithdraw<=0||y.claimAsset,children:y.claimAsset?(0,a.jsx)(spinner,{}):(0,a.jsx)("div",{className:"flex items-center justify-center",children:(0,a.jsx)(f(),{className:"",src:"/assets/pngs/claim.png",width:32,height:32,alt:"lighting"})})}),(0,a.jsx)("div",{className:u().pool_detail_performance__assets_asset,children:(0,a.jsx)("h1",{className:"".concat(r.claimableWithdraw>0&&!y.claimAsset?"":"gray_text"),children:"Claim"})})]})]}),(0,a.jsxs)("div",{className:u().button_container+" flex",children:[" ",(0,a.jsx)("div",{className:"".concat(u().action_column),children:(0,a.jsxs)("div",{className:u().pool_detail_performance__assets_asset,children:[(0,a.jsx)("h2",{className:"".concat(r.depositAmounts<=0||r.epochHasExpired||y.cancelDeposit?"opacity-50":""),children:"Pending Deposit"}),(0,a.jsxs)("h1",{className:"".concat((null==r?void 0:r.depositAmounts)<=0||(null==r?void 0:r.epochHasExpired)||y.cancelDeposit?"opacity-50":""),children:[(null==N?void 0:N.INVEST_DECIMAL)>0&&(null==r?void 0:r.depositAmounts)!=null?(0,g.R)(I.bM(BigInt(Math.round(Number(r.depositAmounts))),N.INVEST_DECIMAL),2):"0.00"," ","USDT"]}),(0,a.jsx)("button",{id:"cancel-deposit",className:"".concat(u().cancel_action," ").concat(r.depositAmounts<=0||r.epochHasExpired||y.cancelDeposit?"opacity-50 cursor-not-allowed":""),onClick:()=>handleCancel("deposit"),disabled:r.depositAmounts<=0||r.epochHasExpired||y.cancelDeposit,children:y.cancelDeposit?(0,a.jsx)(spinner,{}):"Cancel"})]})}),(0,a.jsxs)("div",{className:u().action_column,children:[(0,a.jsxs)("div",{className:u().pool_detail_performance__assets_asset,children:[(0,a.jsx)("h2",{className:"".concat(r.withdrawAmounts<=0||r.epochHasExpired||y.cancelWithdrawal?"opacity-50":""),children:"Pending Withdraw"}),(0,a.jsxs)("h1",{className:"".concat((null==r?void 0:r.withdrawAmounts)<=0||(null==r?void 0:r.epochHasExpired)||y.cancelWithdrawal?"opacity-50":""),children:[(null==r?void 0:r.withdrawAmounts)!=null?(0,g.R)(I.dF(r.withdrawAmounts),2):"0.00"," ","CIVS0",(0,a.jsxs)("small",{className:"text-dimGray",children:["\xa0($",(null==r?void 0:r.withdrawAmounts)!=null&&(null==b?void 0:null===(n=b.fullHistory)||void 0===n?void 0:n.length)?(0,g.R)((Number(I.dF(r.withdrawAmounts))*Number(null!==(o=null==b?void 0:null===(l=b.fullHistory[(null==b?void 0:b.fullHistory.length)-1])||void 0===l?void 0:l[1])&&void 0!==o?o:0)).toString(),2):"0.00",")"]})]})]}),(0,a.jsx)("button",{id:"cancel-withdrawal",className:"".concat(u().cancel_action," ").concat(r.withdrawAmounts<=0||r.epochHasExpired||y.cancelWithdrawal?"opacity-50 cursor-not-allowed":""),onClick:()=>handleCancel("withdraw"),disabled:r.withdrawAmounts<=0||r.epochHasExpired||y.cancelWithdrawal,children:y.cancelWithdrawal?(0,a.jsx)(spinner,{}):"Cancel"})]})]}),(0,a.jsx)("div",{className:"text-[13px]",children:(0,a.jsx)(H.u,{anchorSelect:"#allocated_info",content:"$".concat(eg.toFixed(2).toString()),className:"max-w-[200px] text-center text-[10px] ".concat(u().tooltip_box)})})]})})},$=n(72207),epochManagement=e=>{let{apiData:t,poolDataFromSocket:n}=e,s=parseInt(t.epochStartTime),epochStartTime=()=>{let e=new Date(1e3*s),t=e.toLocaleDateString(),n=e.toLocaleTimeString();return[n,t]},l=s+parseInt(null==t?void 0:t.epochDuration),epochEndTime=()=>{let e=new Date(1e3*l),t=e.toLocaleDateString(),n=e.toLocaleTimeString();return[n,t]},calculatePercentage=()=>{let e=Math.floor(Date.now()/1e3);return Math.min(100,Math.max(0,(e-s)/(l-s)*100))},[o,r]=(0,i.useState)(0);(0,i.useEffect)(()=>{let e=setInterval(()=>{r(calculatePercentage)},1e3);return()=>clearInterval(e)},[epochStartTime,epochEndTime]);let epochGainPercentage=()=>{let e;let t=new Date(1e3*s),i=new Date(1e3*l),o=n?n.fullHistory:[],r=new Date().getTime()<=i.getTime()?o.filter(e=>e[0]>=t.getTime()):o.filter(e=>e[0]>=t.getTime()&&e[0]<=i.getTime());return(e=r.length>=2?(0,$.T)(r[r.length-1][1],r[0][1]):null)>=0?(0,a.jsxs)("p",{className:"!text-cartoonGreen !font-extrabold !text-xs",children:["\xa0+",e,"%"]}):(0,a.jsxs)("p",{className:"!text-cartoonRed !font-extrabold !text-xs",children:["\xa0",e,"%"]})};return(()=>{let e=new Date(1e3*s),n=new Date(1e3*l),i=new Date;return i>e&&i<n&&0!==n?(0,a.jsx)("div",{className:u().pool_detail__epoch,children:(0,a.jsxs)("div",{className:"flex items-start justify-between relative",children:[(0,a.jsxs)("div",{className:"epoch_starts max-sm:mt-7 mt-8 mb-3",children:[(0,a.jsx)("h2",{className:"max-sm:leading-5 relative -top-[55px] max-sm:-top-[45px]",children:"start"}),(0,a.jsxs)("h1",{className:"text-l max-sm:leading-5",children:[epochStartTime()[1]," "]}),(0,a.jsx)("p",{className:"text-[12px] text-[#A2A8BA] ",children:epochStartTime()[0]})]}),(0,a.jsx)("div",{className:"indicator mt-5",children:(0,a.jsxs)("div",{className:"absolute left-0 w-full",children:[(0,a.jsxs)("div",{className:"flex items-center ",children:[(0,a.jsx)("div",{className:"dot w-[6px] h-[6px] bg-[#ffffff] rounded-full"}),(0,a.jsx)("div",{className:"".concat(u().line," lineone w-full")}),(0,a.jsx)("div",{className:"dot w-[6px] h-[6px] bg-[#ffffff] rounded-full"})]}),(0,a.jsx)("div",{className:" w-full h-20 relative ",children:(0,a.jsx)(q.E.div,{initial:{left:"0%"},animate:{left:o>20?"calc(".concat(o,"% - ").concat(window.innerWidth<768?"88px":"140px",")"):"".concat(o/100*100,"%")},transition:{duration:1},className:"absolute -top-[28px] max-sm:-top-[23px]",children:(0,a.jsx)("div",{className:u().pool_detail__epoch__banner,children:(0,a.jsxs)("h1",{className:"text-center",children:["Epoch ",t.curDepositEpoch," ",epochGainPercentage()]})})})})]})}),(0,a.jsxs)("div",{className:"epoch_starts max-sm:mt-7 mt-8 text-right",children:[(0,a.jsx)("h2",{className:"max-sm:leading-5 relative -top-[55px] max-sm:-top-[45px]",children:"rebalancing"}),(0,a.jsx)("h1",{className:"text-l max-sm:leading-5",children:epochEndTime()[1]}),(0,a.jsxs)("p",{className:"text-[12px] text-[#A2A8BA]",children:[epochEndTime()[
10]," "]})]})]})}):n<=0&&e<=0?(0,a.jsx)("div",{className:u().pool_detail__epoch,children:(0,a.jsxs)("div",{className:"flex items-start justify-between relative",children:[(0,a.jsxs)("div",{className:"epoch_starts max-sm:mt-7 mt-8 mb-3",children:[(0,a.jsx)("h2",{className:"max-sm:leading-5 relative -top-[55px] max-sm:-top-[40px]",children:"loading..."}),(0,a.jsx)("h1",{className:"text-l max-sm:leading-5",children:"loading... "}),(0,a.jsx)("p",{className:"text-[12px] text-[#A2A8BA] ",children:"loading..."})]}),(0,a.jsx)("div",{className:"indicator mt-5",children:(0,a.jsxs)("div",{className:"absolute left-0 w-full",children:[(0,a.jsxs)("div",{className:"flex items-center ",children:[(0,a.jsx)("div",{className:"dot w-[6px] h-[6px] bg-[#ffffff] rounded-full"}),(0,a.jsx)("div",{className:"".concat(u().line," lineone w-full")}),(0,a.jsx)("div",{className:"dot w-[6px] h-[6px] bg-[#ffffff] rounded-full"})]}),(0,a.jsx)("div",{className:" w-full h-20 relative ",children:(0,a.jsx)(q.E.div,{initial:{left:"0"},animate:{left:["0","calc(100% - ".concat(window.innerWidth<768?"88px":"140px",")"),"0"]},transition:{duration:3.5,ease:"easeInOut",repeat:1/0,repeatType:"reverse"},className:"absolute -top-[28px] max-sm:-top-[23px]",children:(0,a.jsx)("div",{className:u().pool_detail__epoch__banner,children:(0,a.jsx)("h1",{className:"text-center",children:"loading"})})})})]})}),(0,a.jsxs)("div",{className:"epoch_starts max-sm:mt-7 mt-8 text-right",children:[(0,a.jsx)("h2",{className:"max-sm:leading-5 relative -top-[55px] max-sm:-top-[40px]",children:"loading..."}),(0,a.jsx)("h1",{className:"text-l max-sm:leading-5",children:"loading..."}),(0,a.jsx)("p",{className:"text-[12px] text-[#A2A8BA]",children:"loading... "})]})]})}):(0,a.jsx)("div",{className:u().pool_detail__epoch,children:(0,a.jsxs)("div",{className:"flex items-start justify-between relative",children:[(0,a.jsxs)("div",{className:"epoch_starts max-sm:mt-7 mt-8 mb-3",children:[(0,a.jsx)("h2",{className:"max-sm:leading-5 relative -top-[55px] max-sm:-top-[40px]",children:"rebalancing..."}),(0,a.jsx)("h1",{className:"text-l max-sm:leading-5",children:"rebalancing... "}),(0,a.jsx)("p",{className:"text-[12px] text-[#A2A8BA] ",children:"rebalancing..."})]}),(0,a.jsx)("div",{className:"indicator mt-5",children:(0,a.jsxs)("div",{className:"absolute left-0 w-full",children:[(0,a.jsxs)("div",{className:"flex items-center ",children:[(0,a.jsx)("div",{className:"dot w-[6px] h-[6px] bg-[#ffffff] rounded-full"}),(0,a.jsx)("div",{className:"".concat(u().line," lineone w-full")}),(0,a.jsx)("div",{className:"dot w-[6px] h-[6px] bg-[#ffffff] rounded-full"})]}),(0,a.jsx)("div",{className:" w-full h-20 relative ",children:(0,a.jsx)(q.E.div,{initial:{left:"0"},animate:{left:["0","calc(100% - ".concat(window.innerWidth<768?"88px":"140px",")"),"0"]},transition:{duration:3.5,ease:"easeInOut",repeat:1/0,repeatType:"reverse"},className:"absolute -top-[28px] max-sm:-top-[23px]",children:(0,a.jsx)("div",{className:u().pool_detail__epoch__banner,children:(0,a.jsx)("h1",{className:"text-center",children:"rebalancing"})})})})]})}),(0,a.jsxs)("div",{className:"epoch_starts max-sm:mt-7 mt-8 text-right",children:[(0,a.jsx)("h2",{className:"max-sm:leading-5 relative -top-[55px] max-sm:-top-[40px]",children:"rebalancing..."}),(0,a.jsx)("h1",{className:"text-l max-sm:leading-5",children:"rebalancing..."}),(0,a.jsx)("p",{className:"text-[12px] text-[#A2A8BA]",children:"rebalancing... "})]})]})})})()},J=n(70507),K=n(28811),Q=n.n(K);let ee=Q()(()=>Promise.all([n.e(282),n.e(805)]).then(n.bind(n,62883)),{loadableGenerated:{webpack:()=>[62883]},ssr:!1});var poolDetail=e=>{let{poolDataFromSocket:t,data:n,poolId:l,fetchData:o,allowDeposit:r}=e,{transactionType:d,currentWalletAddress:p,tokenDecimals:c}=(0,s.Z)(),{setInvestableUsdt:y}=G(),{address:x,chain:h}=(0,T.useAccount)(),[b,v]=(0,i.useState)(null),[w,g]=(0,i.useState)({withdrawAmount:"",depositAmount:""}),[j,_]=(0,i.useState)({usdt:"0",investDecimals:"0",XCIVshares:"0",guarantee:"0",guaranteeAllowance:"0",civAssetAllowance:"0",xCivAllowance:"0"}),[N,A]=(0,i.useState)({cancelWithdrawal:!1,cancelDeposit:!1,editUsdtAllowance:!1,claimAsset:!1,claimableGuarantee:!1,bookUSDTWithdrawal:!1,BookUSDTDeposit:!1,guaranteeApproveState:!1}),[D,E]=(0,i.useState)({epochStartTime:0,curDepositEpoch:0,epochDuration:0,depositedVault:0,claimableGuaranteeAmou
1nt:0,claimableWithdraw:0,depositAmounts:0,withdrawAmounts:0,epochHasExpired:!1}),{memoizedBalances:R,refetch:S}=loadBalances(l),{userVaultData:V,refetch:k}=contractReads_useUserVaultData(l),{handleApprove:M,handleDeposit:C,depositAmount:F}=utils_useTransaction(d,h,l,w,j,A,o);(0,i.useEffect)(()=>{if(null==n?void 0:n.epoch){var e,t;let a=!1,i=Math.floor(Date.now()/1e3);a=i>Number(null===(e=n.epoch)||void 0===e?void 0:e.epochStartTime)+Number(null===(t=n.epoch)||void 0===t?void 0:t.epochDuration),E(e=>{var t,i,s,l;return{...e,epochStartTime:null===(t=n.epoch)||void 0===t?void 0:t.epochStartTime,epochDuration:null===(i=n.epoch)||void 0===i?void 0:i.epochDuration,curDepositEpoch:null===(s=n.epoch)||void 0===s?void 0:s.curDepositEpoch,depositedVault:null===(l=n.epoch)||void 0===l?void 0:l.depositedVault,epochHasExpired:a}})}},[n]),(0,i.useEffect)(()=>{E(e=>({...e,claimableWithdraw:V.claimableWithdraw,depositAmounts:V.depositAmounts,withdrawAmounts:V.withdrawAmounts}))},[V]);let[B,I]=(0,i.useState)(!1);(0,i.useEffect)(()=>{R&&c&&(_({usdt:null==R?void 0:R.tokenBalance,investDecimals:null==c?void 0:c.INVEST_DECIMAL,XCIVshares:null==R?void 0:R.XCIVBalance,guarantee:null==R?void 0:R.guaranteeBalance,guaranteeAllowance:null==R?void 0:R.guaranteeAllowance,civAssetAllowance:null==R?void 0:R.civAssetAllowance,xCivAllowance:null==R?void 0:R.xCivAllowance}),y(minNumber(null==R?void 0:R.tokenBalance,null==R?void 0:R.civAssetAllowance)))},[R,h,p,B,null==R?void 0:R.civAssetAllowance]);let P=(0,i.useRef)([]);return(0,i.useEffect)(()=>{null===b&&(null==t?void 0:t.fullHistory)&&(P.current=t.fullHistory)},[t]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"pool-details-container",children:[(0,a.jsx)("div",{className:"items-center mb-4",children:(0,a.jsx)(epochManagement,{apiData:D,poolDataFromSocket:t})}),(0,a.jsxs)("div",{className:"".concat(u().pool_detail_performance),children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("div",{className:"flex items-center h-[50px] sm:mb-2 max-sm:mb-1 max-sm:mt-2",children:(0,a.jsx)("h1",{className:"text-white text-3xl !font-semibold",children:"Fund Performance"})}),(0,a.jsx)("div",{className:"<!--max-sm:bg-poolDarkBlue--> bg-transparent sm:h-[450px] max-sm:w-full rounded-12 sm:py-5 max-sm:pt-5 text-white",children:(0,a.jsx)("div",{className:"total_aval_claim",children:(0,a.jsx)("div",{className:"",children:(0,a.jsx)(m.Z,{data:null===b?(null==t?void 0:t.fullHistory)||[]:P.current||[],poolDataFromSocket:t,apiData:D,modalType:b,availableBalance:j})})})})]}),(0,a.jsxs)("div",{className:"flex flex-col ",children:[(0,a.jsxs)("div",{className:"flex items-center h-[50px] sm:mb-2 max-sm:mb-0 max-sm:mt-2",children:[(0,a.jsx)(f(),{src:"/assets/tokens/tether_logo_white.png",width:50,height:50,alt:"token-img"}),(0,a.jsx)("h1",{className:"text-white text-3xl !font-semibold ml-2",children:"USDT Management"})]}),(0,a.jsx)(pool_USDTManagement,{apiData:D,availableBalance:j,poolId:l,fetchData:o,setModalType:v,web3LoadingStates:N,setWeb3LoadingStates:A,allowDeposit:r,currentWalletAddress:p,poolDataFromSocket:t,data:t?t.fullHistory:[]})]})]}),(0,a.jsx)(J.Z,{}),(0,a.jsx)(ee,{apiData:D,poolDataFromSocket:t})]}),b&&(0,a.jsx)(modal,{type:b,onClose:()=>{v(null),(0,X.p)()},poolId:l,availableBalance:j,inputAmount:w,setInputAmount:g,handleApprove:M,decimals:null==c?void 0:c.INVEST_DECIMAL,handleDeposit:C,depositAmount:F,setWeb3LoadingStates:A,fetchData:o,web3LoadingStates:N,guaranteeAllowance:j.guaranteeAllowance,setSlippageApprove:I,poolDataFromSocket:t}),(0,a.jsxs)("div",{className:"max-sm:hidden text-[13px]",children:[(0,a.jsx)(H.u,{anchorSelect:"#edit-usdt-allowance",content:"Change the amount of authorized USDT that can interact with CivFund",className:"max-w-[200px] text-center text-[10px] ".concat(u().tooltip_box)}),(0,a.jsx)(H.u,{anchorSelect:"#claim-usdt",content:"Claim previously withdrawn USDT. Withdrawn funds can be claimed after the next rebalancing is completed",className:"max-w-[200px] text-center text-[10px] ".concat(u().tooltip_box)}),(0,a.jsx)(H.u,{anchorSelect:"#book-usdt-withdrawal",content:"Request for withdrawal of funds from the strategy that will occur during the next rebalancing",className:"max-w-[200px] text-center text-[10px] ".concat(u().tooltip_box)}),(0,a.jsx)(H.u,{anchorSelect:"#book-usdt-deposit",content:"Request for deposit of funds in the strategy that will occur during the next rebalancing",className:"max-w-[200px] text-center text-[10px] ".concat(u().tooltip_box)}),(0,a.jsx)(H.u,{anchorSelect:"#cancel-withdrawal",content:"Use this action if you want to cancel the request to withdraw funds from the strategy that will occur during the next rebalancing.",className:"max-w-[200px] text-center text-[10px] ".concat(u().tooltip_box)}),(0,a.jsx)(H.u,{anchorSelect:"#cancel-deposit",content:"Use this action if you want to cancel the request to deposit funds into the strategy that will occur during the next rebalancing.",className:"max-w-[200px] text-center text-[10px] ".concat(u().tooltip_box)}),(0,a.jsx)(H.u,{anchorSelect:"#min",content:"Change the",className:" text-center text-[10px]"})]})]})};let useProcessedData=(e,t,n)=>{let[a,s]=(0,i.useState)({depositedPool:0,depositedVault:0});(0,i.useEffect)(()=>
1{if(e){var n,a;t(!1),s({depositedPool:(null===(n=e.data)||void 0===n?void 0:n.depositedPool)||0,depositedVault:I.bM((null===(a=e.data)||void 0===a?void 0:a.depositedVault)||0,6)})}else t(!0)},[e]);let l=(0,i.useMemo)(()=>({isLoading:n,apiData:a}),[n,a]);return l};var poolHead=e=>{let{togglePool:t,setTogglePool:n,poolData:l,poolDataFromSocket:o,data:r,poolLoading:d}=e,{setMessage:p}=(0,s.Z)(),[c,m]=(0,i.useState)(!0),{chain:y}=(0,T.useAccount)(),[x,h]=(0,i.useState)({tvl:0,apy:0,roi:0}),{apiData:f}=useProcessedData(r,m,c);(0,i.useEffect)(()=>{if(o){var e,t,n;h({tvl:null==o?void 0:null===(e=o.strategy)||void 0===e?void 0:e.NAV,apy:null==o?void 0:null===(t=o.strategy)||void 0===t?void 0:t.APY,roi:null==o?void 0:null===(n=o.strategy)||void 0===n?void 0:n.ROI})}},[o]);let[b,v]=(0,i.useState)(null);return(0,i.useEffect)(()=>{y&&(null==y?void 0:y.id)!==1&&(null==y?void 0:y.id)!==5&&(null==y?void 0:y.id)!==11155111&&(null==y?void 0:y.id)!==42161?n(!1):m(!1)},[y]),(0,a.jsxs)("div",{className:"",children:[(0,a.jsx)("div",{className:u().header,children:(0,a.jsx)("div",{className:"pool_head_info flex items-center text-[white] w-full justify-center md:ml-1 py-1 max-sm:px-3",children:(0,a.jsxs)("div",{className:"flex items-center font-light justify-center w-full",children:[(0,a.jsx)("div",{className:"annual_percentage_yield max-sm:hidden md:mr-2 max-sm:mr-2 flex-shrink-0",children:(0,a.jsxs)("h1",{children:[(0,g.R)(x.apy,2),"% APY ",(0,a.jsx)("span",{id:"apy_info",className:"text-sm",children:"ⓘ"})]})}),(0,a.jsx)("div",{className:"annual_percentage_yield md:mr-1 max-sm:mr-1 sm:hidden flex-shrink-0",children:(0,a.jsxs)("h1",{children:[(0,g.R)(x.apy,2),"% APY "]})}),(0,a.jsx)("div",{className:"mr-5 ml-5 flex-shrink-0",children:(0,a.jsx)("svg",{width:"1",height:"32",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)("line",{x1:"1",y1:"0",x2:"1",y2:"32",stroke:"#A2A8BA",strokeWidth:"1"})})}),(0,a.jsx)("div",{className:"deployed_assets max-sm:hidden md:mr-2 max-sm:-ml-12 flex-shrink-0",children:(0,a.jsxs)("h1",{className:"",children:["$",x.tvl?(0,g.R)(x.tvl,2):(0,g.R)(0,2)," TVL ",(0,a.jsx)("span",{id:"tvl_info",className:"text-sm",children:"ⓘ"})]})}),(0,a.jsx)("div",{className:"deployed_assets sm:hidden flex-shrink-0",children:(0,a.jsxs)("h1",{children:["$",x.tvl?(0,g.R)(x.tvl,2):(0,g.R)(0,2)," TVL"]})}),(0,a.jsx)("div",{className:"hidden mr-5 ml-5 flex-shrink-0",children:(0,a.jsx)("svg",{width:"1",height:"32",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)("line",{x1:"1",y1:"0",x2:"1",y2:"32",stroke:"#A2A8BA",strokeWidth:"1"})})}),(0,a.jsx)("div",{className:"hidden to_be_deployed max-sm:hidden md:mr-2 max-sm:-ml-12 flex-shrink-0",children:(0,a.jsxs)("h1",{className:"",children:["$",(0,g.R)(I.bM(f.depositedVault&&f.depositedVault.toString().replace(".","")||"0",6),2)," VFD ",(0,a.jsx)("span",{id:"deposited_info",className:"text-sm",children:"ⓘ"})]})}),(0,a.jsx)("div",{className:"hidden to_be_deployed sm:hidden flex-shrink-0",children:(0,a.jsxs)("h1",{className:"",children:["$",(0,g.R)(I.bM(f.depositedVault&&f.depositedVault.toString().replace(".","")||"0",6),2)," VFD"]})})]})})}),(0,a.jsxs)("div",{className:"text-[13px]",children:[(0,a.jsx)(H.u,{anchorSelect:"#apy_info",content:"The APY represents the Annual Percentage Yield, an estimate of annualized returns, calculated based on current performance",className:"max-w-[200px] text-center text-[10px] ".concat(u().tooltip_box)}),(0,a.jsx)(H.u,{anchorSelect:"#tvl_info",content:"The TVL represents the Total Value Locked that is deployed after the rebalancing process at the beginning of each epoch",className:"max-w-[200px] text-center text-[10px] ".concat(u().tooltip_box)}),(0,a.jsx)(H.u,{anchorSelect:"#deposited_info",content:"The VFD represents the Vault Fund Deposit, funds stored in the vault, awaiting rebalancing at the end of an epoch before deployment",className:"max-w-[200px] text-center text-[10px] ".concat(u().tooltip_box)})]})]})},et=n(62167),en=n(54829);async function DataServices(e,t,n){let a="https://api.civfund.com/dapp/getVaultInfo/".concat(t,"/").concat(n,"/?chainId=").concat(e);
1try{let e={isLoading:!0,data:null,error:null},t=await en.Z.get(a);return e.isLoading=!1,e.data=t.data,{data:e,isLoading:e.isLoading}}catch(e){return console.error(e),{isLoading:!1,data:null,error:e}}}var ea=n(85526),investComponents_pool=e=>{let{togglePool:t,setTogglePool:n,poolData:l}=e,{setSocketData:o,setTotalNAV:r,setHighestNetAPY:d,transactionsStatus:u,setTokenDecimal:p,chain:c,currentWalletAddress:m}=(0,s.Z)(),{poolApiData:y}=G(),{INVEST_DECIMAL:x,GUARANTEE_DECIMAL:h,XCIV_DECIMAL:f}=tokenDecimals(l.poolId),[b,v]=(0,i.useState)([]),[w,g]=(0,i.useState)(!1),{refetch:T}=loadBalances(l.poolId),{refetch:j}=contractReads_useUserVaultData(l.poolId),[_,N]=(0,i.useState)(null),A=m||"0x0000000000000000000000000000000000000000",fetchData=async()=>{try{let{data:e,isLoading:t}=await DataServices(c?c.id:1,l.poolId,A);g(t),N({...e})}catch(e){console.error("Error fetching data:",e)}};return(0,i.useLayoutEffect)(()=>{p({INVEST_DECIMAL:x,GUARANTEE_DECIMAL:h,XCIV_DECIMAL:f})},[]),(0,i.useEffect)(()=>{m&&Object.values(u).some(e=>!0===e)&&(T(),j())},[u,c,A]),(0,i.useEffect)(()=>{(0,ea.mP)();let e=(0,ea.$H)(e=>{v(e)});return()=>e()},[m,c]),(0,a.jsxs)("div",{children:[(0,a.jsx)(poolHead,{togglePool:t,setTogglePool:n,apiData:_,poolData:l,poolDataFromSocket:b||[],data:y[l.poolId],poolLoading:w}),t&&(0,a.jsx)(et.M,{children:(0,a.jsx)(q.E.div,{className:"",initial:"closed",animate:t?"open":"closed",exit:"closed",variants:{open:{y:0,opacity:1},closed:{y:-50,opacity:0}},children:(0,a.jsx)(poolDetail,{poolDataFromSocket:b,data:b.epochStrategyApi,poolId:l.poolId,fetchData:fetchData,allowDeposit:l.allowDeposit})})})]})};let ei={1:[{id:0,usdtStrategies:"CivFund",tokenLogo:{src:"/_next/static/media/civ.d16c51f3.svg",height:532,width:563,blurWidth:0,blurHeight:0},poolId:0,oneLogo:!0,allowDeposit:!0}],11155111:[{id:3,usdtStrategies:"pilot",tokenLogo:b.eJ,poolId:3,oneLogo:!0,allowDeposit:!1},{id:2,usdtStrategies:"genesis",tokenLogo:b.eJ,poolId:4,oneLogo:!0,allowDeposit:!0}],42161:[{id:0,usdtStrategies:"pilot",tokenLogo:b.eJ,poolId:0,oneLogo:!0,allowDeposit:!0},{id:1,usdtStrategies:"genesis",tokenLogo:b.eJ,poolId:1,oneLogo:!0,allowDeposit:!0}]};var page=()=>{let{currentWalletAddress:e,setCurrentWalletAddress:t,setChain:n,transactionsStatus:l}=(0,s.Z)(),{setPoolApiData:o,poolApiData:d}=G(),{address:u,chain:c,isConnected:m,isDisconnected:y}=(0,T.useAccount)(),{open:x,close:h}=(0,Y.k_)(),{message:f}=(0,s.Z)(),[b,v]=(0,i.useState)(ei[c?c.id:1].map(()=>!1)),[w,g]=(0,i.useState)(!0),toggleStrategy=(e,t)=>{let n=[...b];n[t]=e,v(n)},j=u||"0x0000000000000000000000000000000000000000",fetchData=async e=>{try{let{data:t,isLoading:n}=await DataServices(c?c.id:1,e,j);return{data:t,isLoading:n}}catch(e){console.error("Error fetching data:",e)}},fetchAllData=async()=>{for(let e of ei[c?c.id:1]){let t=e.poolId,{data:n,isLoading:a}=await fetchData(t);o(e=>({...e,[t]:{...e[t],...n}})),v(ei[c?c.id:1].map(()=>!0)),g(!1)}};return(0,i.useEffect)(()=>{fetchAllData()},[ei,c,j,m,y]),(0,i.useEffect)(()=>{Object.values(l).some(e=>!0===e)&&fetchAllData()},[l]),(0,i.useEffect)(()=>{c&&u&&(n(c),t(u))},[c,u]),b.every(e=>!e),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-center text-white",children:(0,a.jsx)("h1",{className:"font-extrabold text-4xl -mt-8 max-sm:-mt-2 sm:-mt-4",children:"CivFund"})}),(0,a.jsx)(p.Z,{spinnerClass:{marginTop:"200px"},loaderClass:w?"":"!hidden"}),(0,a.jsx)("div",{className:r().home,children:(0,a.jsx)("div",{className:"bg-poolMobile max-sm:p-2 ".concat(w?"!hidden":""),children:ei[c?c.id:1].map((e,t)=>(0,a.jsx)("div",{className:"".concat(0!=t&&"border-t border-dashed border-[#305A70]"),children:(0,a.jsx)(investComponents_pool,{togglePool:b[t],setTogglePool:e=>{toggleStrategy(e,t)},poolData:e,poolIndex:e.id})},"strategy---".concat(t)))})}),(0,a.jsx)(alertMessage,{message:f})]})}},65059:function(e,t,n){"use strict";n.d(t,{a2:function(){return l},x8:function(){return a},Sv:function(){return s},eJ:function(){return i}});var a={src:"/_next/static/media/close.c108ca2b.svg",height:44,width:44,blurWidth:0,blurHeight:0},i={src:"/_next/static/media/uniswap.25e4c1ac.svg",height:194,width:168,blurWidth:0,blurHeight:0},s={src:"/_next/static/media/eth.e535c1bd.svg",height:22,width:22,blurWidth:0,blurHeight:0},l={src:"/_next/static/media/arbitrum.db93275c.svg",height:2500,width:2500,blurWidth:0,blurHeight:0}},86618:function(e,t,n){"use strict";let a;n.d(t,{y:function(){return a}});var i=n(57437),s=n(2265),l=n(45253),o=n(75588),r=n(16573),d=n(24235),u=n(5864),p=n(81159),c=n(39434),m=n(21758),y=n(83984),x=n(72207),h=n(79009),f=n(9442);n(68143),n(14158);var b=n(39646),v=n.n(b),w=n(67432),g=n.n(w),T=n(16691),j=n.n(T);let _=s.memo(e=>{let{data:t,poolDataFromSocket:b,apiData:w,modalType:T,availableBalance:_}
1=e,[N,A]=(0,s.useState)([]),[D,E]=(0,s.useState)("1d"),[R,S]=(0,s.useState)("chart"),[V,k]=(0,s.useState)(!0),[M,C]=(0,s.useState)([]),[F,B]=(0,s.useState)(null),I=(0,s.useRef)(null),P=(0,s.useRef)(null),W=(0,s.useRef)(null),U=(0,s.useRef)(null);function useIsMobile(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:640,[t,n]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let checkMobile=()=>n(window.innerWidth<e);return checkMobile(),window.addEventListener("resize",checkMobile),()=>window.removeEventListener("resize",checkMobile)},[e]),t}let L=useIsMobile(),downloadCSV=e=>{let t=e.map(e=>[e.date,e.value,e.vpsToVpsVar,e.gain]),n="data:text/csv;charset=utf-8,";n+="Date;VPS;VPS Variation (%);Growth (%)\n",t.forEach(e=>{n+=e.join(";")+"\n"});let a=encodeURI(n),i=document.createElement("a"),s="CivFund-".concat(getLabelByValue(D).replace(/\s+/g,"-"),"-Performances.csv");i.setAttribute("href",a),i.setAttribute("download",s),document.body.appendChild(i),i.click(),document.body.removeChild(i)},filterData=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a={epch:1344,prev_epch:1344,"1d":48,"7d":84,"30d":180,"3m":270,"6m":360,"1y":365,all:1e3,...n},i=[],s=[[new Date("1900-01-01T00:00:00Z").getTime(),new Date("2021-01-01T00:00:00Z").getTime()],[new Date("2025-02-01T07:00:00Z").getTime(),new Date("2025-02-01T15:00:00Z").getTime()],[new Date("2025-09-17T09:00:00Z").getTime(),new Date("2025-09-18T09:00:00Z").getTime()],[new Date("2025-10-09T00:00:00Z").getTime(),new Date("2025-10-12T23:59:59Z").getTime()],[new Date("2025-10-15T08:00:00Z").getTime(),new Date("2025-10-15T23:00:00Z").getTime()],[new Date("2025-10-21T15:00:00Z").getTime(),new Date("2025-10-21T19:00:00Z").getTime()],[new Date("2025-10-27T11:00:00Z").getTime(),new Date("2025-10-27T12:00:00Z").getTime()]],excludeBlockedDates=e=>e.filter(e=>{let[t]=e;if(i.includes(t))return!1;for(let[e,n]of s)if(t>=e&&t<=n)return!1;return!0}),l=parseInt((null==w?void 0:w.epochStartTime)||0),o=new Date(1e3*l),r=new Date(1e3*(l+24192e5)),d=new Date(1e3*l-24192e5),checkPoints=e=>e.filter(e=>null!=e[1]),downsample=(e,t)=>{if(!Array.isArray(e=checkPoints(excludeBlockedDates(e)))||0===e.length||t<=0)return e||[];if("data"===R||e.length<=t)return e;let n=Math.min(e.length,t),a=(e.length-1)/(n-1),i=[e[0]];for(let t=1;t<n-1;t++){let n=Math.round(t*a);n<e.length&&i.push(e[n])}let s=e[e.length-1];return JSON.stringify(i[i.length-1])!==JSON.stringify(s)&&i.push(s),i};switch(e){case"1d":{let e=Date.now()-864e5,n=t.filter(t=>t[0]>=e);return downsample(n,a["1d"])}case"7d":{let e=Date.now()-6048e5,n=t.filter(t=>t[0]>=e);return downsample(n,a["7d"])}case"30d":{let e=Date.now()-2592e6,n=t.filter(t=>t[0]>=e);return downsample(n,a["30d"])}case"3m":{let e=Date.now()-7776e6,n=t.filter(t=>t[0]>=e);return downsample(n,a["3m"])}case"6m":{let e=Date.now()-15552e6,n=t.filter(t=>t[0]>=e);return downsample(n,a["6m"])}case"1y":{let e=Date.now()-31536e6,n=t.filter(t=>t[0]>=e);return downsample(n,a["1y"])}case"epch":{let e=Date.now()<=r.getTime()?t.filter(e=>e[0]>=o.getTime()):t.filter(e=>e[0]>=o.getTime()&&e[0]<=r.getTime());return downsample(e,a.epch)}case"prev_epch":{let e=t.filter(e=>e[0]>=d.getTime()&&e[0]<=o.getTime());return downsample(e,a.prev_epch)}default:return downsample(t,a.all)}},formatTimestamp=(e,t)=>{let n=new Date(e),a="".concat(n.toLocaleString("en-US",{month:"short"})," ").concat(n.getDate());return"1d"===t?"".concat(n.toLocaleTimeString("en-US",{hour:"numeric",minute:"numeric"})):"all"===t||"1y"===t?"".concat(n.toLocaleString("en-US",{month:"short"})," ").concat(n.getFullYear()):a},updateChart=()=>{let e=filterData(D),t=e.map(e=>({timestamp:e[0],name:formatTimestamp(e[0],D),VPS:e[1]}));A(t),k(!1)};(0,s.useEffect)(()=>{if(k(!0),"chart"===R)updateChart();else if("data"===R){let e=filterData(D),t=new Worker(n.tu(new URL(n.p+n.u(278),n.b)),{type:void 0});return t.postMessage({filteredData:e}),t.onmessage=e=>{C(e.data),k(!1)},()=>t.terminate()}},[t,D,R]);let getLabelByValue=e=>{let t=H.find(t=>t.value===e);return t?t.label:null},H=[{value:"1d",label:"1d"},{value:"7d",label:"7d"},{value:"30d",label:"1m"},{value:"3m",label:"3m"},{value:"1y",label:"1y"},{value:"prev_epch",label:"Prev. Epoch"},{value:"epch",label:"Epoch ".concat((null==w?void 0:w.curDepositEpoch)||"Current")},{value:"all",label:"All"}],O=[{value:"chart",label:"Chart"},{value:"data",label:"Data"}],getFilteredVariation=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:D,n=filterData(t);
1if(n.length>0){let t=n[0][1],a=n[n.length-1][1];return null!==e?(0,x.T)(e,t):(0,x.T)(a,t)}};a=()=>{let e=[];for(let a=0;a<H.length;a++){var t=getFilteredVariation(null,H[a].value),n=t>=0?"+":"";e.push("".concat(H[a].label,": ").concat(n).concat(t,"%"))}return e};let VpsValue=()=>{var e,t;return null!==I.current?I.current:(null==b?void 0:null===(t=b.fullHistory)||void 0===t?void 0:null===(e=t[b.fullHistory.length-1])||void 0===e?void 0:e[1])||0},chartPercentage=()=>{let e=getFilteredVariation(I.current);return e>=0?(0,i.jsxs)("h3",{ref:U,className:"!text-[16px] !max-sm:text-[11px] rounded-12 px-2 py-1 !text-cartoonGreen ml-1 !font-extrabold",children:["+",e,"%"]}):(0,i.jsxs)("h3",{ref:U,className:"!text-[16px] !max-sm:text-[11px] rounded-12 px-2 py-1 !text-cartoonRed ml-1 !font-extrabold",children:[e,"%"]})},smallVpsValue=e=>(0,i.jsx)("p",{ref:P,className:"".concat(1===z?"invisible":"visible"," ").concat(e," "),children:"VPS: "+VpsValue().toFixed(4).toLocaleString()}),renderDataTable=()=>V?(0,i.jsx)(f.Z,{spinnerClass:{marginTop:"80px"}}):(0,i.jsxs)("div",{className:"relative",children:[(0,i.jsx)("div",{className:"overflow-auto max-h-[300px]",children:(0,i.jsxs)("table",{className:"min-w-full mx-auto table-fixed",children:[(0,i.jsx)("thead",{children:(0,i.jsx)("tr",{className:"bg-darkBackground text-gray-500 text-xl",children:["Date","VPS","VPS Variation","Growth"].map((e,t)=>(0,i.jsx)("th",{className:"sticky top-0 bg-darkBackground font-light w-1/4 py-3",children:e},t))})}),(0,i.jsx)("tbody",{children:M.map((e,t)=>{let{date:n,value:a,vpsToVpsVar:s,gain:l}=e;return(0,i.jsxs)("tr",{className:"text-center border-b border-gray-600",children:[(0,i.jsx)("td",{className:"text-gray-500 p-2",children:n}),(0,i.jsx)("td",{className:"font-semibold p-2",children:a.toFixed(4)}),(0,i.jsxs)("td",{className:"p-2 ".concat(s<0?"text-cartoonRed":"text-cartoonGreen"),children:[s.toFixed(2),"%"]}),(0,i.jsxs)("td",{className:"p-2 ".concat(l<0?"text-cartoonRed":"text-cartoonGreen"),children:[l.toFixed(2),"%"]})]},t)})})]})}),(0,i.jsx)("button",{id:"csv-button",onClick:()=>downloadCSV(M),className:"absolute bottom-2 right-4 secondary_button !text-xs px-2 py-1",children:(0,i.jsx)(j(),{className:"",src:"/assets/pngs/download.png",width:18,height:18,alt:"lighting"})})]});var z=_.XCIVshares>0?_.XCIVshares:1;let G=(0,y.r)(z,4),updatePerfUI=(e,t,n)=>{if(!W.current||!U.current||!P)return;z=_.XCIVshares>0?_.XCIVshares:1,W.current.innerHTML=1===z?e.toFixed(4):"$".concat(e.toFixed(2)),U.current.innerHTML="".concat(t>0?"+":"").concat(t.toFixed(2),"%"),P.current.innerHTML="VPS: "+n.toFixed(4).toLocaleString();let a=U.current.classList;a.remove("!text-cartoonGreen","!text-cartoonRed"),t>0?a.add("!text-cartoonGreen"):t<0&&a.add("!text-cartoonRed")},handleMoveTooltip=e=>{if(null==N[null==e?void 0:e.activeIndex])return;let t=N[null==e?void 0:e.activeIndex].VPS,n=1===z?t:G*t;I.current=t;let a=getFilteredVariation(t);updatePerfUI(n,a,t)},handleHideTooltip=()=>{I.current=null;let e=z*VpsValue(),t=getFilteredVariation(null);updatePerfUI(e,t,VpsValue())},CustomTooltipDesktop=e=>{let{active:t,payload:n}=e;if(!t||!n||!n.length)return null;let a=n[0].payload,s=new Date(a.timestamp).toLocaleString("en-US",{month:"long",day:"numeric",year:"numeric",hour:"numeric",minute:"numeric",hour12:!0}),l=(0,x.T)(a.VPS,N[0].VPS);return(0,i.jsxs)("div",{style:{backgroundColor:"rgba(40, 29, 9, 0.7)",backdropFilter:"blur(8px)",borderRadius:"8px",border:"solid 1px",borderColor:"#D0972F",color:"#fff",fontSize:"14px",padding:"10px"},children:[(0,i.jsx)("p",{children:s}),(0,i.jsxs)("p",{style:{fontWeight:"bold"},children:["VPS: ",a.VPS.toFixed(4),"\xa0\xa0",(0,i.jsxs)("span",{style:{color:l>=0?"#68D02F":"#D02F68"},children:[l>=0?"+".concat(l.toFixed(2)):l.toFixed(2),"%"]})]})]})},X=(0,s.useRef)(null),Z=(0,s.useMemo)(()=>{if(null!==T)return X.current;if(0===N.length)return null;let e=N.length>0?1.0007*Math.max(...N.map(e=>e.VPS)):1,t=N.length>0?.9993*Math.min(...N.map(e=>e.VPS)):0,n=(0,i.jsx)(l.h,{width:"100%",height:360,children:(0,i.jsxs)(o.T,{data:N,margin:{top:0,right:20,left:20,bottom:60},onMouseMove:handleMoveTooltip,onMouseLeave:handleHideTooltip,children:[(0,i.jsx)(r.q,{stroke:"rgba(196, 196, 196, 0.06)",vertical:!1,horizontal:!0}
1),(0,i.jsx)(d.K,{axisLine:!1,tickLine:!1,dataKey:"name",tick:{fill:"#A2A8BA",fontSize:10,fontFamily:"BR Firma",fontWeight:"bold"},tickMargin:10,interval:"preserveStartEnd",tickCount:7}),(0,i.jsx)(u.Q,{axisLine:!1,tickLine:!1,domain:[t,e],tickFormatter:e=>e.toFixed(4),tick:{fill:"#A2A8BA",fontSize:10,fontFamily:"BR Firma",fontWeight:"bold"},tickMargin:10,tickCount:7}),(0,i.jsx)(p.u,{content:(0,i.jsx)(CustomTooltipDesktop,{})}),(0,i.jsx)(c.uN,{type:"monotone",dataKey:"VPS",stroke:"#ffffff",fillOpacity:.5,fill:"url(#gradient)",strokeWidth:2}),(0,i.jsx)("defs",{children:(0,i.jsxs)("linearGradient",{id:"gradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,i.jsx)("stop",{offset:"0%",stopColor:"#ffffff",stopOpacity:.5}),(0,i.jsx)("stop",{offset:"100%",stopColor:"#ffffff",stopOpacity:0})]})})]})});return X.current=n,n},[N]);function DesktopChart(){var e,t;return null==b||null===(t=b.fullHistory)||void 0===t||null===(e=t[b.fullHistory.length-1])||void 0===e||e[1],(0,i.jsxs)("div",{className:v().chart,children:[(0,i.jsxs)("div",{className:"total_aval_claim",children:[(0,i.jsx)("p",{className:"text-xl font-black ml-6 max-sm:ml-4",children:1===z?"Value Per Share (VPS)":"Allocated Value"}),(0,i.jsxs)("div",{className:"flex items-center ml-4 sm:ml-6",children:[(0,i.jsx)("h1",{ref:W,className:"text-xl font-extrabold",children:1===z?VpsValue().toFixed(4):"$".concat((G*VpsValue()).toFixed(2))}),chartPercentage()]}),smallVpsValue("text-xs font-black ml-6 max-sm:ml-4")]}),(0,i.jsxs)("div",{className:"flex justify-end items-center mb-5 mr-4",children:[(0,i.jsxs)("div",{className:"flex text-right mb-3 mr-4",children:[O.map((e,t)=>(0,i.jsx)("button",{className:"".concat(v().btn," ").concat(R===e.value&&v().active),onClick:()=>S(e.value),children:e.label},"ViewMode---button--".concat(t))),(0,i.jsx)("div",{className:"border-l border-gray-300 h-8 mx-2"})]}),(0,i.jsx)("div",{className:"text-right mb-3 mr-4",children:H.map((e,t)=>(0,i.jsx)("button",{className:"".concat(v().btn," ").concat(D===e.value&&v().active),onClick:()=>E(e.value),children:e.label},"Filter---button--".concat(t)))})]}),"chart"===R?(0,i.jsx)("div",{className:"flex flex-col items-center relative max-h-[400px] w-full",children:N.length>0&&Z}):(0,i.jsx)("div",{className:"overflow-auto max-h-[300px] w-full",children:renderDataTable()}),(0,i.jsx)("div",{className:"text-[13px]",children:(0,i.jsx)(m.u,{anchorSelect:"#csv-button",content:"Export records in CSV format",className:"max-w-[200px] text-center text-[10px] ".concat(g().tooltip_box)})})]})}let CustomTooltipMobile=e=>{let{active:t,payload:n}=e;if(!t||!n||!n.length)return null;let a=n[0].payload,s=new Date(a.timestamp).toLocaleString("en-US",{month:"long",day:"numeric",year:"numeric",hour:"numeric",minute:"numeric",hour12:!0}),l=(0,x.T)(a.VPS,N[0].VPS);return(0,i.jsxs)("div",{style:{backgroundColor:"rgba(40, 29, 9, 0.7)",backdropFilter:"blur(8px)",borderRadius:"8px",border:"solid 1px",borderColor:"#D0972F",color:"#fff",fontSize:"8px",padding:"8px"},children:[(0,i.jsx)("p",{children:s}),(0,i.jsxs)("p",{style:{fontWeight:"bold"},children:["VPS: ",a.VPS.toFixed(4),"\xa0\xa0",(0,i.jsxs)("span",{style:{color:l>=0?"#68D02F":"#D02F68"},children:[l>=0?"+".concat(l.toFixed(2)):l.toFixed(2),"%"]})]})]})};function MobileChart(){var e,t;null==b||null===(t=b.fullHistory)||void 0===t||null===(e=t[b.fullHistory.length-1])||void 0===e||e[1];let n=N.length>0?1.0007*Math.max(...N.map(e=>e.VPS)):1,a=N.length>0?.9993*Math.min(...N.map(e=>e.VPS)):0;return(0,i.jsxs)("div",{className:v().chart,children:[(0,i.jsxs)("div",{className:"total_aval_claim",children:[(0,i.jsx)("p",{className:"text-l font-black ml-1",children:1===z?"Value Per Share (VPS)":"Allocated Value"}),(0,i.jsxs)("div",{className:"flex items-center ml-1",children:[(0,i.jsx)("h1",{ref:W,className:"text-3xl font-extrabold",children:1===z?VpsValue().toFixed(4):"$".concat((G*VpsValue()).toFixed(2))}),chartPercentage()]}),smallVpsValue("text-[10px] font-black ml-1 mb-2")]}),"chart"===R?(0,i.jsx)("div",{className:"flex flex-col items-center relative mt-1 max-h-[400px] w-full",children:N.length>0&&(0,i.jsx)(l.h,{width:"100%",height:300,children:(0,i.jsxs)(o.T,{data:N,margin:{top:10,right:0,left:-8,bottom:15},onTouchMove:e=>{if((null==e?void 0:e.activeIndex)!=null&&N[e.activeIndex]){(0,h.d)(),handleMoveTooltip(e);let t=document.querySelector(".recharts-tooltip-cursor"),n=document.querySelector(".recharts-active-dot"),a=document.querySelector(".recharts-tooltip-wrapper");t&&n&&a&&(t.style.display="unset",n.style.display="unset",a.style.display="unset")}else console.log("No valid activeIndex or chartData point")},onTouchEnd:()=>{(0,h.p)(),handleHideTooltip();let e=document.querySelector(".recharts-tooltip-cursor"),t=document.querySelector(".recharts-active-dot"),n=document.querySelector(".recharts-tooltip-wrapper");e&&t&&n&&(e.style.display="none",t.style.display="none",n.style.display="none")},children:[(0,i.jsx)(r.q,{stroke:"rgba(196, 196, 196, 0.06)",vertical:!1,horizontal:!0}
1),(0,i.jsx)(d.K,{axisLine:!1,tickLine:!1,dataKey:"name",tickFormatter:e=>e,tick:{fill:"#A2A8BA",fontSize:10,fontFamily:"BR Firma",fontWeight:"bold"},tickMargin:10,interval:"preserveStartEnd",tickCount:7}),(0,i.jsx)(u.Q,{axisLine:!1,tickLine:!1,domain:[a,n],tickFormatter:e=>e.toFixed(4),tick:{fill:"#A2A8BA",fontSize:10,fontFamily:"BR Firma",fontWeight:"bold"},tickMargin:10,tickCount:7}),(0,i.jsx)(p.u,{content:(0,i.jsx)(CustomTooltipMobile,{}),position:{y:20}}),(0,i.jsx)(c.uN,{type:"monotone",dataKey:"VPS",stroke:"#ffffff",fillOpacity:.5,fill:"url(#gradient)",strokeWidth:2}),(0,i.jsx)("defs",{children:(0,i.jsxs)("linearGradient",{id:"gradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,i.jsx)("stop",{offset:"0%",stopColor:"#ffffff",stopOpacity:.5}),(0,i.jsx)("stop",{offset:"100%",stopColor:"#ffffff",stopOpacity:0})]})})]})})}):(0,i.jsx)("div",{className:"overflow-auto max-h-[300px] w-full",children:renderDataTable()}),(0,i.jsx)("div",{className:"sm:hidden text-right mb-1",children:H.map((e,t)=>(0,i.jsx)("button",{className:"".concat(v().btn," ").concat(D===e.value&&v().active),onClick:()=>E(e.value),children:e.label},"Filter---button--".concat(t)))})]})}return L?(0,i.jsx)(MobileChart,{}):(0,i.jsx)(DesktopChart,{})});t.Z=_},9442:function(e,t,n){"use strict";var a=n(57437);n(2265);var i=n(30367),s=n.n(i);t.Z=e=>{let{loaderClass:t="",spinnerClass:n={}}=e;return(0,a.jsx)("div",{className:"".concat(s().page_loader," ").concat(t),children:(0,a.jsx)("div",{className:s().page_loader_spinner,style:n})})}},72207:function(e,t,n){"use strict";n.d(t,{T:function(){return calculatePercentageVariation}});let calculatePercentageVariation=(e,t)=>0===t?0:Math.ceil(100*((e-t)/t*100))/100},83984:function(e,t,n){"use strict";n.d(t,{R:function(){return formatFigures},r:function(){return floatFigure}});let formatFigures=(e,t)=>Math.abs(e)>=1e18?(e/1e18).toFixed(t)+"Qn":Math.abs(e)>=1e15?(e/1e15).toFixed(t)+"Q":Math.abs(e)>=1e12?(e/1e12).toFixed(t)+"T":Math.abs(e)>=1e9?(e/1e9).toFixed(t)+"B":Math.abs(e)>=1e6?(e/1e6).toFixed(t)+"M":Math.abs(e)>=1e3?(e/1e3).toFixed(t)+"K":Number(e).toFixed(t),floatFigure=(e,t)=>Number(e).toFixed(t)},84484:function(e,t,n){"use strict";var a=n(94660);let i=(0,a.Ue)(e=>({message:null,currentWalletAddress:null,chain:null,transactionType:"",guaranteeFee:0,socketData:{},depositWithdrawTxState:!1,tokenPrices:{},totalNAV:0,highestNetAPY:0,transactionsStatus:{},tokenDecimals:{},arbNetwork:!1,setArbNetwork:t=>e(()=>({arbNetwork:t})),setChain:t=>e(()=>({chain:t})),setMessage:t=>e(()=>({message:t})),setCurrentWalletAddress:t=>e(()=>({currentWalletAddress:t})),setTransactionType:t=>e(()=>({transactionType:t})),setGuaranteeFee:t=>e(()=>({guaranteeFee:t})),setSocketData:t=>e(()=>({socketData:t})),setWeb3TXState:t=>e(()=>({depositWithdrawTxState:t})),setTokenPrices:t=>e(()=>({tokenPrices:t})),setTotalNAV:t=>e(()=>({totalNAV:t})),setHighestNetAPY:t=>e(()=>({highestNetAPY:t})),setTransactionsStatus:t=>e(()=>({transactionsStatus:t})),setTokenDecimal:t=>e(()=>({tokenDecimals:t}))}));t.Z=i},27483:function(e){e.exports={home:"styles_home__aM3oR"}},39646:function(e){e.exports={chart:"style_chart__VBuQP",btn:"style_btn__r9rbT",active:"style_active__b5uNI"}},76703:function(e){e.exports={modal:"styles_modal__l58p_"}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.