1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7862],{17585:(e,a,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/dxsale/manage/presale",function(){return t(66238)}])},66238:(e,a,t)=>{"use strict";t.r(a),t.d(a,{__N_SSP:()=>y,default:()=>g});var i=t(11271),l=t(13463),s=t(56051),n=t(81897),o=t(22283),r=t(19043),d=t(98224),c=t(18316),f=t(60135),u=t(61086),m=t(3052),p=t(21491),x=t(31796),k=t(4304),h=t(22859),A=t(63106),S=t(72776),j=t(90368),y=!0;function g(e){let{query:a,locale:t}=e,[y,g]=(0,l.useState)(!0),[w,C]=(0,l.useState)(),[D,T]=(0,l.useState)(0),[_,P]=(0,l.useState)(0),[v,L]=(0,l.useState)(0),[E,R]=(0,l.useState)({isDxMinted:!1,isDeposited:!1,isSoftCapReached:!1,isFinalizeValid:!1,presaleFinalizeTime:0,presaleLockerAddress:"",isPrivateLocked:!1,privateLockEndTime:0,storedLPAddress:"",affiliatePer:0,affiliate:!1,totalAffiliateAmount:0,totalAffiliateCount:0}),[F,b]=(0,l.useState)({tokenDecimals:"",tokenName:"",tokenSymbol:"",tokenTotalSupply:""}),[z,N]=(0,l.useState)({factory:"",link:"",logo:"",name:"",router:""}),{address:q,chain:O}=(0,c.F)(),I=a.saleId?Number(a.saleId):0,V=(0,k.useRouter)();(0,l.useEffect)(()=>{if(w&&"IDO"!==w.type){let e=(0,h.as)(w.type),a=V.pathname.replace("presale",e);V.replace({pathname:a,query:V.query},void 0,{shallow:!0})}},[w]);let W=async()=>{try{if(O&&q){let e=await (0,u.m)(q,I,O.id),a=await (0,p.Y)(e.tokenOfSale,O.id),t=await (0,S.k)(null==e?void 0:e.presaleAddress,null==O?void 0:O.id),i=await (0,x.w)(e.presaleAddress,e.tokenOfSale,O.id),l=await (0,x.w)(e.ownerOfSale,e.tokenOfSale,O.id),s=await (0,j.k)(O.id,t.ROUTER_ADDRESS);C({...e,hasClosed:t.hasClosed,finalizeValid:t.finalizeValid,salePresaleRate:t.buyRate.toString(),affiliateBool:t.affiliate,affiliatePercentage:t.affiliatePer/10,totalAffiliateCount:t.totalAffiliateCount,totalAffiliateAmount:t.totalAffiliateAmount}),b(a),R(e=>({...e,isSoftCapReached:t.goalReached,isFinalizeValid:t.finalizeValid,saleHasClosed:t.hasClosed,presaleFinalizeTime:t.finalizedTime,presaleLockerAddress:t.lockerAddress,storedLPAddress:t.storedLPAddress})),N(s),L(l);let n=0;t.affiliate&&t.totalTokenRequired&&t.affiliatePer&&(n=t.affiliatePer/1e3*(1.001*t.totalTokenRequired));let o=1.001*t.totalTokenRequired+n-i;T(o),P(i)}}catch(e){d.v.error("Error fetching presale data:",e)}},B=()=>{W()};(0,l.useEffect)(()=>{O&&q&&W()},[O,q,I]);let M=[{title:"Sale Information",content:(0,i.jsxs)(i.Fragment,{children:[D>0&&w&&!(null==w?void 0:w.isFinalized)&&(0,i.jsx)(m.ct,{saleData:w,requiredSaleTokens:D,tokenData:F,ownerTokenAmount:v,onDepositSuccess:W}),(0,i.jsxs)(n.Ay,{item:!0,container:!0,spacing:2,children:[(0,i.jsx)(n.Ay,{item:!0,xs:12,sm:6,md:6,lg:4,children:w&&""!==F.tokenDecimals&&z?(0,i.jsx)(m.yk,{saleData:w,tokenInfo:F,dexData:z}):(0,i.jsx)(f.DL,{})}),(0,i.jsx)(n.Ay,{item:!0,xs:12,sm:6,md:6,lg:4,children:w?(0,i.jsx)(m.xJ,{saleData:w}):(0,i.jsx)(m.g1,{})}),(0,i.jsx)(n.Ay,{item:!0,xs:12,sm:6,md:6,lg:4,children:w?(0,i.jsx)(m.DB,{isKyc:w.isKYC,saleType:"presale"}):(0,i.jsx)(m.ME,{})})]}),w&&(0,i.jsx)(m.AD,{saleData:w,tokensDeposited:_,requiredSaleTokens:D,onTransactionSuccess:B,tokenInfo:F}),(null==O?void 0:O.id)&&E.presaleLockerAddress&&E.isFinalizeValid&&(0,i.jsx)(o.A,{display:"flex",justifyContent:"center",marginTop:"1rem",children:(0,i.jsx)(A.N_,{href:{pathname:"/dxlock/view/liquidity-locker",query:{address:E.presaleLockerAddress,chain:null==O?void 0:O.id}},children:(0,i.jsx)(r.A,{clickable:!0,variant:"outlined",label:"View LP Locker"})})})]}),fullWidth:!0},{title:"Sale Settings",content:(0,i.jsx)(i.Fragment,{children:w?(0,i.jsx)(m.$I,{saleData:w,onAffiliateChanges:B}):(0,i.jsx)(s.kt,{})}),fullWidth:!0},{title:"Project Information",content:(0,i.jsx)(i.Fragment,{children:w?(0,i.jsx)(m.Ce,{saleData:w}):(0,i.jsx)(s.kt,{})}),fullWidth:!0}];return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.vJ,{textAlign:"center",variant:"h2",marginBottom:"2rem",beforeColored:"Manage",colored:" Presale"}),(0,i.jsx)(n.Ay,{container:!0,spacing:2,children:M.map((e,a)=>(0,i.jsx)(n.Ay,{item:!0,xs:12,sm:12,md:12,lg:e.fullWidth?12:6,children:(0,i.jsx)(s.lw,{iterationStep:a+1,handleState:y,contentCollapseChildren:e.content,topTitle:e.title,isShowStatus:!1})},a))}),(0,i.jsx)(s.L3,{isExpanded:y,initialLabel:"Open All",expandedLabel:"Close All",onClick:()=>{g(e=>!e)},className:"m-0"})]})}},90368:(e,a,t)=>{"use strict";t.d(a,{k:()=>l});var i=t(6561);let l=async(e,a)=>(0,i.l)(e).dex.filter(e=>e.router===a)[0]}},e=>{e.O(0,[3038,9476,5716,2405,90,135,6403,4263,636,6593,8792],()=>e(e.s=17585)),_N_E=e.O()}]);
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.