1try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3ac0a576-333a-4668-878e-9e3a8b573786",e._sentryDebugIdIdentifier="sentry-dbid-3ac0a576-333a-4668-878e-9e3a8b573786")}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9352],{49563:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var s=r(350979);r(25963);var n=r(257057);let o=e=>(0,s.jsx)(n.A,{viewBox:"0 0 24 24",...e,children:(0,s.jsx)("path",{d:"M11 5V16.17L6.11997 11.29C5.72997 10.9 5.08997 10.9 4.69997 11.29C4.30997 11.68 4.30997 12.31 4.69997 12.7L11.29 19.29C11.68 19.68 12.31 19.68 12.7 19.29L19.29 12.7C19.68 12.31 19.68 11.68 19.29 11.29C18.9 10.9 18.27 10.9 17.88 11.29L13 16.17V5C13 4.45 12.55 4 12 4C11.45 4 11 4.45 11 5Z"})})},50390:(e,t,r)=>{"use strict";r.d(t,{V:()=>x,s:()=>p});var s=r(350979),n=r(694723),o=r(891610);let{ClosedTag:i,CommunityTag:l,CoreTag:a,SoonTag:c,VoteNowTag:d}=n.X.YD,p=e=>{let{proposalState:t,...r}=e;return t===o._s.ACTIVE?(0,s.jsx)(d,{...r}):t===o._s.PENDING?(0,s.jsx)(c,{...r}):(0,s.jsx)(i,{...r})},x=e=>{let{isCoreProposal:t,...r}=e;return t?(0,s.jsx)(a,{...r}):(0,s.jsx)(l,{...r})}},114041:(e,t,r)=>{"use strict";r.d(t,{Fr:()=>s,Lx:()=>o,gN:()=>n,nr:()=>i,zm:()=>l});var s=function(e){return e.COMMUNITY="Community",e.CORE="Core",e.BINANCE="Binance",e.AUTO="Auto",e}({}),n=function(e){return e.PENDING="pending",e.OPEN="open",e.CLOSE="close",e.CLAIMABLE="claimable",e}({});let o={Idle:"idle",Fetching:"pending",Fetched:"success",Failed:"error"},i=e=>!!(null==e?void 0:e.maximumAmountIn)&&!(null==e?void 0:e.route);var l=function(e){return e.LOWER="LOWER",e.UPPER="UPPER",e}({})},253110:(e,t,r)=>{"use strict";r.d(t,{A:()=>d});var s=r(432222),n=r(680797),o=r(913688);let i={SM:"sm",MD:"md"},l=e=>{let{scale:t}=e;switch(t){case i.SM:return"24px";case i.MD:default:return"32px"}},a=e=>{let{scale:t}=e;switch(t){case i.SM:return"12px";case i.MD:default:return"20px"}},c=n.I4.input.attrs({type:"radio"}).withConfig({shouldForwardProp:s.Ay}).withConfig({componentId:"sc-9e7c89ab-0"})(["appearance:none;overflow:hidden;cursor:pointer;position:relative;display:inline-block;height:",";width:",";vertical-align:middle;transition:background-color 0.2s ease-in-out;border:",";border-radius:50%;background-color:",";box-shadow:",';&:after{border-radius:50%;content:"";height:',";left:6px;position:absolute;top:6px;width:",";}&:hover:not(:disabled):not(:checked){box-shadow:",";}&:focus{outline:none;box-shadow:",";}&:checked{border:0;background-color:",";&:after{background-color:",";}}&:disabled{border:0;cursor:default;opacity:0.6;}",""],l,l,e=>{let{theme:t}=e;return t.isDark?`solid 1px ${t.colors.disabled}`:"0"},e=>{let{theme:t}=e;return t.colors.cardBorder},e=>{let{theme:t}=e;return t.shadows.inset},a,a,e=>{let{theme:t}=e;return t.shadows.focus},e=>{let{theme:t}=e;return t.shadows.focus},e=>{let{theme:t}=e;return t.colors.success},e=>{let{theme:t}=e;return t.radio.handleBackground},o.xe);c.defaultProps={scale:i.MD,m:0};let d=c},265449:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var s=r(350979);r(25963);var n=r(257057);let o=e=>(0,s.jsx)(n.A,{viewBox:"0 0 24 24",...e,children:(0,s.jsx)("path",{d:"M17.65 6.35C16.02 4.72 13.71 3.78 11.17 4.04C7.50002 4.41 4.48002 7.39 4.07002 11.06C3.52002 15.91 7.27002 20 12 20C15.19 20 17.93 18.13 19.21 15.44C19.53 14.77 19.05 14 18.31 14C17.94 14 17.59 14.2 17.43 14.53C16.3 16.96 13.59 18.5 10.63 17.84C8.41002 17.35 6.62002 15.54 6.15002 13.32C5.31002 9.44 8.26002 6 12 6C13.66 6 15.14 6.69 16.22 7.78L14.71 9.29C14.08 9.92 14.52 11 15.41 11H19C19.55 11 20 10.55 20 10V6.41C20 5.52 18.92 5.07 18.29 5.7L17.65 6.35Z"})})},430586:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var s=r(350979);r(25963);var n=r(673115),o=r(32654);let i=e=>{let{children:t,showExternalIcon:r=!0,...i}=e;return(0,s.jsxs)(n.A,{external:!0,...i,children:[t,r&&(0,s.jsx)(o.A,{color:i.color?i.color:"primary",ml:"4px"})]})}},557152:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>e1});var s=r(350979),n=r(87242),o=r.n(n),i=r(769932),l=r(796898),a=r(876089),c=r(428089),d=r(557423),p=r(821410),x=r
1(501823),h=r(575058),u=r(494570),m=r(662928),g=r(73908),j=r(927122),A=r(2828),b=r(764289),v=r.n(b),f=r(326848),w=r(25963),y=r(891610),I=r(662864),C=r(17581),k=r(873983),E=r(50390),D=r(616660),S=r(807543),B=r(341936),L=r(150591),F=r(605641),$=r(399832),M=r(430586),N=r(721745),V=r(450253),_=r.n(V),O=r(733775),T=r(849842);let P=e=>{let{proposal:t}=e,{t:r}=(0,i.A)(),n=new Date(1e3*t.start),o=new Date(1e3*t.end);return(0,s.jsxs)(S.A,{mb:"16px",children:[(0,s.jsx)(B.A,{style:{background:"transparent"},children:(0,s.jsx)(h.A,{as:"h3",scale:"md",children:r("Details")})}),(0,s.jsxs)(L.A,{children:[(0,s.jsxs)(x.A,{alignItems:"center",mb:"8px",children:[(0,s.jsx)(F.A,{color:"textSubtle",mr:"auto",children:r("Creator")}),(0,s.jsx)($.A,{useBscCoinFallback:!0,href:(0,O.Bz)(t.author,"address"),ml:"8px",children:(0,N.A)(t.author)})]}),(0,s.jsxs)(x.A,{mb:"24px",children:[(0,s.jsx)(F.A,{color:"textSubtle",mr:"auto",children:r("Voting system")}),(0,s.jsx)(F.A,{ml:"8px",children:r(t.type===y.um.SINGLE_CHOICE?"Binary":"Weighted")})]}),(0,s.jsxs)(x.A,{alignItems:"center",mb:"8px",children:[(0,s.jsx)(F.A,{color:"textSubtle",mr:"auto",children:r("Identifier")}),(0,s.jsx)(M.A,{href:`${T.AS}/${t.ipfs}`,ml:"8px",children:t.ipfs.slice(0,8)})]}),(0,s.jsxs)(x.A,{alignItems:"center",mb:"24px",children:[(0,s.jsx)(F.A,{color:"textSubtle",mr:"auto",children:r("Snapshot")}),(0,s.jsx)($.A,{useBscCoinFallback:!0,href:(0,O.Bz)(t.snapshot,"block"),ml:"8px",children:t.snapshot})]}),(0,s.jsxs)(c.Ay,{children:[(0,s.jsxs)(x.A,{children:[(0,s.jsx)(F.A,{color:"textSubtle",mr:"auto",children:r("Start Date")}),(0,s.jsx)(F.A,{ml:"8px",children:_()(n).format("YYYY-MM-DD HH:mm")})]}),(0,s.jsxs)(x.A,{children:[(0,s.jsx)(F.A,{color:"textSubtle",mr:"auto",children:r("End Date")}),(0,s.jsx)(F.A,{ml:"8px",children:_()(o).format("YYYY-MM-DD HH:mm")})]})]})]})]})};var H=r(990296),G=r(114041),W=r(275577),Y=r(378385),R=r(459801);let q=e=>{let{votes:t,choices:r}=e,{t:n}=(0,i.A)(),o=(0,D.Hg)(t),l=(0,D.gB)(t);return(0,s.jsx)(s.Fragment,{children:r.map((e,t)=>{let r=o[e]||[],i=(0,D.gB)(r),a=0===l?0:i/l*100;return(0,s.jsxs)(c.Ay,{mt:t>0?"24px":"0px",children:[(0,s.jsx)(x.A,{alignItems:"center",mb:"8px",children:(0,s.jsx)(R.A,{mb:"4px",title:e,children:e})}),(0,s.jsx)(c.Ay,{mb:"4px",children:(0,s.jsx)(W.A,{primaryStep:a,scale:"sm"})}),(0,s.jsxs)(x.A,{alignItems:"center",justifyContent:"space-between",children:[(0,s.jsx)(F.A,{color:"textSubtle",children:n("%total% Votes",{total:(0,Y.ZV)(i,0,2)})}),(0,s.jsxs)(F.A,{children:[a.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}),"%"]})]})]},e)})})};var z=r(782882);let X=e=>{let{proposal:t,choices:r,votes:n,votesLoadingStatus:o}=e,{t:l}=(0,i.A)();return(0,s.jsxs)(S.A,{children:[(0,s.jsx)(B.A,{style:{background:"transparent"},children:(0,s.jsx)(h.A,{as:"h3",scale:"md",children:l("Current Results")})}),(0,s.jsxs)(L.A,{children:[o===G.Lx.Fetched&&(0,s.jsxs)(s.Fragment,{children:[t.type===y.um.SINGLE_CHOICE&&(0,s.jsx)(q,{choices:r,votes:n}),t.type===y.um.WEIGHTED&&(0,s.jsx)(z.C,{sortData:!0,choices:r,choicesVotes:r.map((e,r)=>{var s,n;return{[r+1]:null!=(n=null==t||null==(s=t.scores)?void 0:s[r])?n:0}})})]}),o===G.Lx.Fetching&&r.map((e,t)=>(0,s.jsxs)(c.Ay,{mt:t>0?"24px":"0px",children:[(0,s.jsx)(x.A,{alignItems:"center",mb:"8px",children:(0,s.jsx)(R.A,{mb:"4px",title:e,children:e})}),(0,s.jsx)(c.Ay,{mb:"4px",children:(0,s.jsx)(H.Ay,{height:"36px",mb:"4px"})})]},e))]})]})};var U=r(334404),J=r(549333),K=r(208553),Q=r(485909),Z=r(226464),ee=r(217784),et=r(91168),er=r(296123),es=r(834264),en=r.n(es),eo=r(330402),ei=r(253110),el=r(680797);let ea=el.I4.label.withConfig({componentId:"sc-a76db272-0"})(["align-items:center;border:1px solid ",";border-radius:16px;cursor:",";display:flex;margin-bottom:16px;padding:16px;"],e=>{let{theme:t,isChecked:r}=e;return t.colors[r?"success":"cardBorder"]},e=>{let{isDisabled:t}=e;return t?"not-allowed":"pointer"}),ec=el.I4.div.withConfig({componentId:"sc-a76db272-1"})(["flex:1;padding-left:16px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:0;"]),ed=e=>{let{proposal:t,vote:r,setVote:n}=e,{address:o}=(0,C.F)();return(0,s.jsx)(s.Fragment,{children:t.choices.map((e,i)=>{let l=i+1===r.value;return(0,s.jsxs)(ea,{isChecked:l,isDisabled:!o,children:[(0,s.jsx)("div",{style:{flexShrink:0},children:(0,s.jsx)(ei.A,{scale:"sm",value:e,checked:l,onChange:()=>{n({label:e,value:i+1})},disabled:!o||t.state===y._s.CLOSED})}),(0,s.jsx)(ec,{children:(0,s.jsx)(F.A,{as:"span",title:e,children:e})})]},e)})})};var ep=r(28192),ex=r(727353),eh=r(795904),eu=r(892977);let em=el.I4.label.withConfig({componentId:"sc-2afbed0-0"})(["max-width:100%;overflow:hidden;display:flex;padding:8px 16px;border-radius:16px;margin-bottom:16px;border:1px solid ",";flex-direction:column;","{flex-direction:row;align-items:center;}"],e=>{let{theme:t}=e;return t.colors.cardBorder},e=>{let{theme:t}=e;return t.mediaQueries.md}),eg=el.I4.div.withConfig({componentId:"sc-2afbed0-1"})(["overflow:hidden;text-overflow:ellipsis;display:-webkit-box;white-space:initial;-webkit-line-clamp:2;-webkit-box-orient:vertical;margin-bottom:16px;","{margin:0 auto 0 0;}"],e=>{let{theme:t}=e;return t.mediaQueries.md}),ej=(0,el.I4)(ep.A).withConfig({componentId:"sc-2afbed0-2"})(["border-radius:8px;width:26px;min-width:26px;height:26px;"]),eA=(0,el.I4)(x.A).withConfig({componentId:"sc-2afbed0-3"})(["padding:8px;max-width:140px;min-width:140px;border-radius:16px;background:",";border:1px solid ",";"],e=>{let{theme:t}=e;return t.colors.input},e=>{let{theme:t}=e;return t.colors.inputSecondary}),eb=(0,el.I4)(ex.A).withConfig({componentId:"sc-2afbed0-4"})(["border:0px;height:24px;box-shadow:none;text-align:center;&:focus{box-shadow:none !important;}"]),ev=(0,el.I4)(c.Ay).withConfig({componentId:"sc-2afbed0-5"})(["max-width:140px;min-width:140px;padding:8px;border-radius:16px;text-align:center;height:42px;line-height:24px;color:",";background:",";"],e=>{let{theme:t}=e;return t.colors.textDisabled},e=>{let{theme:t}=e;return t.colors.disabled}),ef=e=>{let{proposal:t,hasAccountVoted:r,vote:n,notEnoughVeCake:o,setVote:i}=e,l=(0,w.useMemo)(()=>Object.values(n).reduce((e,t)=>
1e+t,0),[n]),a=(0,w.useMemo)(()=>{let e={};return Object.keys(n).forEach(t=>{e[t]=0===l?"0.00%":`${(n[t]/l*100).toFixed(2)}%`}),e},[l,n]),c=(e,t)=>{i({...n,[e]:t<=0?0:t})},d=(0,w.useCallback)((e,t)=>{e.currentTarget.validity.valid&&i({...n,[t]:Number(e.target.value)})},[i,n]);return(0,s.jsx)(s.Fragment,{children:t.choices.map((e,i)=>{let l=i+1,p=n[l];return(0,s.jsxs)(em,{children:[(0,s.jsx)(eg,{children:e}),(0,s.jsxs)(x.A,{alignItems:"center",ml:["0","0","0","16px"],children:[(0,s.jsx)(F.A,{mr:["auto","auto","auto","16px"],children:a[l]}),r||t.state===y._s.CLOSED?(0,s.jsx)(ev,{children:p}):(0,s.jsxs)(eA,{children:[(0,s.jsx)(ej,{scale:"sm",variant:"subtle",disabled:0===p,onClick:()=>c(l,p-1),children:(0,s.jsx)(eh.A,{color:"currentColor",width:"14px"})}),(0,s.jsx)(eb,{pattern:"^[0-9]+$",inputMode:"numeric",value:p,disabled:o,onChange:e=>d(e,l)}),(0,s.jsx)(ej,{variant:"subtle",scale:"sm",disabled:o,onClick:()=>c(l,p+1),children:(0,s.jsx)(eu.A,{color:"currentColor",width:"14px"})})]})]})]},e)})})};var ew=r(282304),ey=r(168687),eI=r.n(ey),eC=r(495964),ek=r(919667),eE=r(238691),eD=function(e){return e.MAIN="main",e.DETAILS="details",e}({});let eS=new(eI()).Client712("https://hub.snapshot.org"),eB=e=>{let{proposal:t,onSuccess:r,proposalId:n,vote:o,block:l,voteType:a,onDismiss:d}=e,[p,x]=(0,w.useState)(eD.MAIN),[h,u]=(0,w.useState)(!1),{address:m}=(0,C.F)(),{data:g}=(0,eC.G)(),{t:j}=(0,i.A)(),{toastError:A}=(0,U.d)(),{isLoading:b,isError:v,total:f,cakeBalance:I,cakeVaultBalance:k,cakePoolBalance:E,poolsBalance:S,cakeBnbLpBalance:B,ifoPoolBalance:L,lockedCakeBalance:F,lockedEndTime:$}=(0,eo.A)(l),M=p===eD.MAIN,N=M?void 0:()=>x(eD.MAIN),V={[eD.MAIN]:j("Confirm Vote"),[eD.DETAILS]:j("Voting Power")},_=()=>{null==d||d()},O=async()=>{try{if(u(!0),!m)return;await eS.vote({getSigner:()=>({_signTypedData:(e,t,r)=>null==g?void 0:g.signTypedData({account:m,domain:e,types:t,message:r,primaryType:"Vote"})})},m,{space:T.rn,choice:a===y.um.SINGLE_CHOICE?o.value:o,reason:"",type:a,proposal:n,app:"snapshot"}),await r(),_()}catch(t){var e;A(j("Error"),null!=(e=null==t?void 0:t.message)?e:j("Error occurred, please try again")),console.error(t)}finally{u(!1)}};return(0,s.jsx)(ew.Ay,{title:V[p],onBack:N,onDismiss:d,hideCloseButton:!M,headerBorderColor:"transparent",children:(0,s.jsxs)(c.Ay,{mb:"24px",children:[p===eD.MAIN&&(l&&BigInt(l)>=D.wE?(0,s.jsx)(eE.Q,{block:l,vote:o,proposal:t,voteType:a,total:f,isPending:h,isLoading:b,isError:v,cakeBalance:I,onConfirm:O,onDismiss:_}):(0,s.jsx)(eE.A,{vote:o,voteType:a,isError:v,proposal:t,isLoading:b,isPending:h,total:f,lockedCakeBalance:Number(F),lockedEndTime:Number($),onConfirm:O,onViewDetails:()=>x(eD.DETAILS),onDismiss:_})),p===eD.DETAILS&&l&&(0,s.jsx)(ek.A,{total:f,cakeBalance:I,ifoPoolBalance:L,cakeVaultBalance:k,cakePoolBalance:E,poolsBalance:S,cakeBnbLpBalance:B,block:l,lockedCakeBalance:F,lockedEndTime:$})]})})},eL=e=>{let{proposal:t,votes:r,hasAccountVoted:n,onSuccess:o,...l}=e,[a,c]=(0,w.useState)({label:"",value:0}),{t:p}=(0,i.A)(),{toastSuccess:u}=(0,U.d)(),{address:m}=(0,C.F)(),{total:g}=(0,eo.A)(Number(t.snapshot));(0,w.useEffect)(()=>{let{type:e,choices:s}=t;if(e===y.um.WEIGHTED&&m){let e=null,t=r.find(e=>e.voter.toLowerCase()===m.toLowerCase()),n=s.map((e,r)=>{var s;return[r+1,null!=(s=null==t?void 0:t.choice[r+1])?s:0]});(e=en()(n))&&c(e)}},[m,t,r]);let j=async()=>{u(p("Vote cast!")),null==o||o()},[A]=(0,J.A)((0,s.jsx)(eB,{proposal:t,proposalId:t.id,voteType:t.type,vote:a,block:Number(t.snapshot),onSuccess:j})),b=(0,w.useMemo)(()=>t.snapshot&&BigInt(t.snapshot)>=D.wE,[t]),v=(0,w.useMemo)(()=>!!b&&(void 0===g||new et.g(g).lte(0)),[b,g]),f=(0,w.useMemo)(()=>t.type===y.um.SINGLE_CHOICE?a.value>0:Object.values(a).reduce((e,t)=>e+t,0)>0,[t,a]);return(0,s.jsxs)(S.A,{...l,children:[(0,s.jsx)(B.A,{style:{background:"transparent"},children:(0,s.jsxs)(x.A,{flexDirection:["column","column","row"],children:[(0,s.jsx)(h.A,{as:"h3",scale:"md",mr:"auto",children:p("Cast your vote")}),m&&b&&(0,s.jsxs)(x.A,{alignItems:"center",children:[(0,s.jsxs)(F.A,{color:v?"failure":"text",children:[p("Cake Balance"),":"]}),(0,s.jsx)(K.A,{bold:!0,fontSize:"20px",m:"0 4px 0 8px",lineHeight:"110%",decimals:2,color:v?"failure":"text",value:g}),(0,s.jsx)(Q.A,{width:32,height:32,style:{minWidth:"32px"},src:v?"/images/cake-staking/not-enough-veCAKE.png":"/images/cake-staking/token-vecake.png"})]})]})}),(0,s.jsxs)(L.A,{children:[t.type===y.um.SINGLE_CHOICE&&(0,s.jsx)(ed,{proposal:t,vote:a,setVote:c}),t.type===y.um.WEIGHTED&&(0,s.jsx)(ef,{proposal:t,hasAccountVoted:n,notEnoughVeCake:v,vote:a,setVote:c}),m?(0,s.jsx)(s.Fragment,{children:t.state===y._s.ACTIVE&&(0,s.jsx)(s.Fragment,{children:n?(0,s.jsx)(Z.A,{variant:"success",style:{width:"fit-content",margin:"auto"},children:(0,s.jsx)(Z.J,{children:p("You cast your vote! Please wait until the voting ends to see the end results.")})}):v?(0,s.jsx)(d.A,{m:"auto",display:"block",disabled:!0,children:p("Not enough CAKE")}):f?(0,s.jsx)(d.A,{m:"auto",display:"block",endIcon:(0,s.jsx)(ee.A,{width:14,height:14,color:"currentColor"}
1),onClick:A,children:p("Cast Vote")}):(0,s.jsx)(d.A,{m:"auto",display:"block",disabled:!0,children:p("Enter the votes to cast")})})}):(0,s.jsx)(er.A,{m:"auto",display:"block"})]})]})};var eF=r(654168),e$=r(703082),eM=r(258213),eN=r(630788),eV=r.n(eN),e_=r(579518),eO=r(694723),eT=r(672946);let eP=(0,el.I4)(x.A).attrs({alignItems:"center"}).withConfig({componentId:"sc-c8e86c10-0"})(["grid-area:address;"]),eH=(0,el.I4)(c.Ay).withConfig({componentId:"sc-c8e86c10-1"})(["grid-area:choice;overflow:hidden;"]),eG=(0,el.I4)(c.Ay).withConfig({componentId:"sc-c8e86c10-2"})(["justify-self:end;grid-area:vote;"]),eW=(0,el.I4)(eT.A).withConfig({componentId:"sc-c8e86c10-3"})(["border-bottom:1px solid ",";grid-gap:8px;grid-template-areas:'address address address' 'choice choice vote';grid-template-columns:1fr 1fr 120px;padding:8px 16px;","{grid-gap:16px;grid-template-areas:'address choice vote';padding:16px 24px;}"],e=>{let{theme:t}=e;return t.colors.cardBorder},e=>{let{theme:t}=e;return t.mediaQueries.sm}),{VotedTag:eY}=eO.X.YD,eR=e=>{var t,r,n;let{vote:o,proposal:i,isVoter:l}=e,a=!!(null==(t=o.metadata)?void 0:t.votingPower),c=a?parseFloat((null==(r=o.metadata)?void 0:r.votingPower)||"0").toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:3}):"--",d=(0,w.useMemo)(()=>{let e=Object.values(o.choice).reduce((e,t)=>e+t,0);return Object.entries(o.choice).map(t=>{let[r,s]=t,n=(s/e*100).toFixed(2);return{choiceText:o.proposal.choices[parseInt(r)-1],percentage:n}})},[o]),p=(0,w.useMemo)(()=>i.type===y.um.WEIGHTED?d.filter(e=>"0.00"!==e.percentage).map(e=>`${e.percentage}% for ${e.choiceText}`).join(", "):o.proposal.choices[o.choice-1],[d,i,o]),{targetRef:h,tooltip:u,tooltipVisible:m}=(0,e_.A)((0,s.jsx)(s.Fragment,{children:i.type===y.um.WEIGHTED?(0,s.jsx)(x.A,{flexDirection:"column",children:d.filter(e=>"0.00"!==e.percentage).map(e=>(0,s.jsx)(F.A,{fontSize:"14px",children:`${e.choiceText} - ${e.percentage}%`}))}):(0,s.jsx)(F.A,{fontSize:"14px",children:o.proposal.choices[o.choice-1]})}),{placement:"top"});return(0,s.jsxs)(eW,{children:[(0,s.jsx)(eP,{children:(0,s.jsxs)(x.A,{alignItems:"center",children:[(0,s.jsx)($.A,{useBscCoinFallback:!0,href:(0,O.Bz)(o.voter,"address"),children:(0,N.A)(o.voter)}),l&&(0,s.jsx)(eY,{mr:"4px"})]})}),(0,s.jsxs)(eH,{ref:h,children:[(0,s.jsx)(R.A,{title:p,children:p}),m&&u]}),(0,s.jsx)(eG,{children:(0,s.jsxs)(x.A,{alignItems:"center",justifyContent:"end",children:[(0,s.jsx)(F.A,{title:(null==(n=o.metadata)?void 0:n.votingPower)||"0",children:c}),a&&(0,s.jsx)(M.A,{href:`${T.AS}/${o.ipfs}`})]})})]})};var eq=r(300055),ez=r.n(eq);let eX=(0,el.I4)(x.A).withConfig({componentId:"sc-e7a4ee32-0"})(["border-bottom:1px solid ",";padding:16px 24px;"],e=>{let{theme:t}=e;return t.colors.cardBorder}),eU=(0,el.I4)(H.Ay).withConfig({componentId:"sc-e7a4ee32-1"})(["flex:1;"]),eJ=()=>(0,s.jsx)(c.Ay,{children:ez()(10).map(e=>(0,s.jsxs)(eX,{children:[(0,s.jsx)(H.Ay,{height:"21px",mr:"32px",width:"100px"}),(0,s.jsx)(eU,{height:"21px",mr:"32px",width:"100%"}),(0,s.jsx)(eU,{height:"21px",width:"100%"})]},e))}),eK=e=>{var t,r;let s=(null==e||null==(t=e.metadata)?void 0:t.votingPower)&&parseFloat(null==e||null==(r=e.metadata)?void 0:r.votingPower);return s||(s=0),s},eQ=e=>{let{votes:t,proposal:r,votesLoadingStatus:n,totalVotes:o}=e,[a,c]=(0,w.useState)(!1),{isMobile:p}=(0,l.A)(),{t:u}=(0,i.A)(),{address:m}=(0,C.F)(),g=eV()(t,[eK,"created"],["desc","desc"]),j=a?g:g.slice(0,p?10:20),A=n===G.Lx.Fetched;return(0,s.jsxs)(S.A,{children:[(0,s.jsx)(B.A,{style:{background:"transparent"},children:(0,s.jsxs)(x.A,{alignItems:"center",justifyContent:"space-between",children:[(0,s.jsx)(h.A,{as:"h3",scale:"md",children:u("Votes (%count%)",{count:o||"-"})}),!A&&(0,s.jsx)(eF.A,{spin:!0,width:"22px"})]})}),!A&&(0,s.jsx)(eJ,{}),A&&j.length>0&&(0,s.jsxs)(s.Fragment,{children:[j.map(e=>{let t=m&&e.voter.toLowerCase()===m.toLowerCase();return(0,s.jsx)(eR,{vote:e,isVoter:!!t,proposal:r},e.id)}),(0,s.jsx)(x.A,{alignItems:"center",justifyContent:"center",py:"8px",px:"24px",children:(0,s.jsx)(d.A,{width:"100%",onClick:()=>{c(!a)},variant:"text",endIcon:a?(0,s.jsx)(e$.A,{color:"primary",width:"21px"}):(0,s.jsx)(eM.A,{color:"primary",width:"21px"}),disabled:!A,children:u(a?"Hide":"See All")})})]}),A&&0===j.length&&(0,s.jsx)(x.A,{alignItems:"center",justifyContent:"center",py:"32px",children:(0,s.jsx)(h.A,{as:"h5",children:u("No votes found")})})]})},eZ=()=>{var e;let{query:t,isFallback:r}=(0,f.useRouter)(),n=t.id,{t:o}=(0,i.A)(),{address:b}=(0,C.F)(),{isDesktop:S}=(0,l.A)(),{status:B,data:L,error:F}=(0,m.I)({queryKey:["voting","proposal",n],queryFn:()=>(0,I.HF)(n),enabled:!!n,refetchOnReconnect:!1,refetchOnWindowFocus:!1,refetchOnMount:!1}),{status:$,data:M,refetch:N}=(0,m.I)({queryKey:["voting","proposal",L,"votes"],queryFn:async()=>
1{if(!L)throw Error("No proposal");return(0,I.tp)(L)},enabled:!!L,refetchOnReconnect:!1,refetchOnWindowFocus:!1,refetchOnMount:!1}),V=(0,w.useMemo)(()=>M||[],[M]),_=b&&V&&L&&L.state===y._s.ACTIVE&&V.some(e=>e.voter.toLowerCase()===b.toLowerCase()),O="pending"===$||"pending"===B;return!L&&F?(0,s.jsx)(a.A,{LinkComp:v(),children:(0,s.jsx)(A.bV,{title:"404"})}):r||!L?(0,s.jsx)(j.A,{}):(0,s.jsxs)(g.A,{py:"40px",children:[(0,s.jsx)(c.Ay,{mb:"40px",children:(0,s.jsx)(v(),{href:"/voting",passHref:!0,children:(0,s.jsx)(d.A,{variant:"text",startIcon:(0,s.jsx)(p.A,{color:"primary",width:"24px"}),px:"0",children:o("Back to Vote Overview")})})}),(0,s.jsxs)(k.A,{children:[(0,s.jsxs)(c.Ay,{children:[(0,s.jsxs)(c.Ay,{mb:"32px",children:[(0,s.jsxs)(x.A,{alignItems:"center",mb:"8px",children:[(0,s.jsx)(E.s,{proposalState:L.state}),(0,s.jsx)(E.V,{isCoreProposal:(0,D.ey)(L),ml:"8px"})]}),(0,s.jsx)(h.A,{as:"h1",scale:"xl",mb:"16px",children:L.title}),(0,s.jsx)(c.Ay,{children:(0,s.jsx)(u.A,{children:L.body})})]}),!O&&(0,s.jsx)(eL,{mb:"16px",proposal:L,votes:V,hasAccountVoted:!!_,onSuccess:N}),!S&&(0,s.jsxs)(c.Ay,{mb:"16px",children:[(0,s.jsx)(P,{proposal:L}),(0,s.jsx)(X,{proposal:L,choices:L.choices,votes:V||[],votesLoadingStatus:$})]}),(0,s.jsx)(eQ,{votes:V||[],proposal:L,totalVotes:null!=(e=null==V?void 0:V.length)?e:L.votes,votesLoadingStatus:$})]}),S&&(0,s.jsxs)(c.Ay,{position:"sticky",top:"60px",children:[(0,s.jsx)(P,{proposal:L}),(0,s.jsx)(X,{proposal:L,choices:L.choices,votes:V||[],votesLoadingStatus:$})]})]})]})},e0=()=>(0,s.jsx)(eZ,{}),e1=o()(()=>Promise.resolve(e0),{ssr:!1})},568187:(e,t,r)=>{"use strict";function s(e,t){let[r,s="0"]=e.split("."),n=r.startsWith("-");if(n&&(r=r.slice(1)),s=s.replace(/(0+)$/,""),0===t)1===Math.round(Number(`.${s}`))&&(r=`${BigInt(r)+1n}`),s="";else if(s.length>t){let[e,n,o]=[s.slice(0,t-1),s.slice(t-1,t),s.slice(t)],i=Math.round(Number(`${n}.${o}`));(s=i>9?`${BigInt(e)+BigInt(1)}0`.padStart(e.length+1,"0"):`${e}${i}`).length>t&&(s=s.slice(1),r=`${BigInt(r)+1n}`),s=s.slice(0,t)}else s=s.padEnd(t,"0");return BigInt(`${n?"-":""}${r}${s}`)}r.d(t,{X:()=>s})},662864:(e,t,r)=>{"use strict";r.d(t,{EI:()=>i,HF:()=>l,tp:()=>c});var s=r(833438),n=r(717713),o=r(891610);let i=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o._s.ACTIVE;return(await (0,n.Ay)(s.iv,(0,n.J1)` 2 query getProposals($first: Int!, $skip: Int!, $state: String!, $orderDirection: OrderDirection) { 3 proposals( 4 first: $first 5 skip: $skip 6 orderBy: "end" 7 orderDirection: $orderDirection 8 where: { space_in: "cakevote.eth", state: $state } 9 ) { 10 id 11 title 12 body 13 choices 14 start 15 end 16 snapshot 17 state 18 author 19 } 20 } 21 `,{first:e,skip:t,state:r,orderDirection:r===o._s.CLOSED?"desc":"asc"})).proposals},l=async e=>{var t;let{proposal:r}=await (0,n.Ay)(s.iv,(0,n.J1)` 22 query getProposal($id: String!) { 23 proposal(id: $id) { 24 id 25 title 26 body 27 choices 28 start 29 end 30 snapshot 31 state 32 author 33 votes 34 ipfs 35 type 36 scores 37 scores_total 38 space { 39 id 40 name 41 } 42 } 43 } 44 `,{id:e});if((null==r||null==(t=r.space)?void 0:t.id)!=="cakevote.eth")throw Error("Untrusted proposal space");return r},a=async(e,t,r)=>(await (0,n.Ay)(s.iv,(0,n.J1)` 45 query getVotes($first: Int, $skip: Int, $where: VoteWhere) { 46 votes(first: $first, skip: $skip, where: $where) { 47 id 48 voter 49 created 50 choice 51 proposal { 52 choices 53 } 54 vp 55 ipfs 56 } 57 } 58 `,{first:e,skip:t,where:r})).votes,c=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;return(await new Promise((r,s)=>{let n=[],o=async i=>{try{let s=await a(t,i,{proposal:e.id});0===s.length?r(n):(n=[...n,...s],o(i+t))}catch(e){s(e)}};o(0)})).map(e=>({...e,metadata:{votingPower:String(e.vp)||"0"}}))}},694723:(e,t,r)=>{"use strict";r.d(t,{X:()=>s});var s=r(829818)},748871:(e,t,r)=>
58{(window.__NEXT_P=window.__NEXT_P||[]).push(["/voting/proposal/[id]",function(){return r(557152)}])},876089:(e,t,r)=>{"use strict";r.d(t,{A:()=>x});var s=r(350979),n=r(680797),o=r(25963),i=r(769932),l=r(178405),a=r(575058),c=r(605641),d=r(557423);let p=n.I4.div.withConfig({componentId:"sc-7851d89b-0"})(["align-items:center;display:flex;flex-direction:column;height:calc(100vh - 64px);justify-content:center;"]),x=e=>{let{statusCode:t=404,children:r,LinkComp:n}=e,{t:x}=(0,i.A)(),h=(0,o.createElement)(n,{href:"/",passHref:!0},(0,s.jsx)(d.A,{scale:"sm",children:x("Back Home")}));return(0,s.jsxs)(s.Fragment,{children:[r,(0,s.jsxs)(p,{children:[(0,s.jsx)(l.A,{width:"64px",mb:"8px"}),(0,s.jsx)(a.A,{scale:"xxl",children:t}),(0,s.jsx)(c.A,{mb:"16px",children:x("Oops, page not found.")}),h]})]})}},927122:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var s=r(350979),n=r(680797),o=r(554945),i=r(814795);let l=(0,n.I4)(i.A).withConfig({componentId:"sc-c1354ddc-0"})(["display:flex;justify-content:center;align-items:center;"]),a=()=>(0,s.jsx)(l,{children:(0,s.jsx)(o.A,{})})}},e=>{e.O(0,[5754,6341,2167,3789,6335,9818,7037,5832,636,6593,8792],()=>e(e.s=748871)),_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.