PageSourceSearch

https://elections.gov.lb/assets/DonutChart-CjaJjtWw.js

js elections.gov.lb collected 2026-09-24 22:13:04 UTC 3,739 bytes, 3 lines download raw bytes

1import{aZ as v,b3 as V,r as x,aV as n,B as b,aY as k}from"./vendor-Ctk823yW.js";import{B as A,P,u as S}from"./mui-charts-Cx7AYoKg.js";import{u as C}from"./tanstack-query-AVs-T-zH.js";import{c as m}from"./index-DtSZN4vW.js";const M=t=>{const{data:e,isLoading:o}=t,a=v(),s=V(a.breakpoints.down("lg")),{votersCount:u,votedVotersCount:c,percentages:d,centers:i}=x.useMemo(()=>{const r=[],p=[],h=[],g=[];return e.map(l=>{r.push(l.votersCount),p.push(l.votedVotersCount),g.push(l.centerName);const y=l.votedVotersCount/l.votersCount*100,f=Math.round(y*100)/100;h.push(f)}),{votersCount:r,votedVotersCount:p,percentages:h,centers:g}},[e]);return n.jsx(b,{sx:{minWidth:"100%",height:"20.75rem",overflowX:s?"scroll":"hidden",WebkitOverflowScrolling:"touch","&::-webkit-scrollbar":{display:"block",height:"0.375rem"},"&::-webkit-scrollbar-track":{backgroundColor:"rgba(0,0,0,0.05)"},"&::-webkit-scrollbar-thumb":{borderRadius:"10px",backgroundColor:a.palette.primary.main,border:"1px solid transparent",backgroundClip:"content-box"}},children:n.jsx(A,{loading:o,series:[{data:u,id:"votersId",yAxisId:"leftAxisId",color:"#003B73",label:"عدد الناخبين"},{data:c,id:"votedVotersId",yAxisId:"leftAxisId",color:"#AE0000",label:"عدد المقترعين"},{data:d,id:"percentageId",yAxisId:"rightAxisId",color:"#eaeaea",label:"نسبة الاقتراع",valueFormatter:r=>`${r.toFixed(2)}%`}],xAxis:[{data:i.map(r=>r.split(" ").slice(1).join(`
2`)),tickLabelStyle:{fontSize:"0.5rem",whiteSpace:"pre-line"}}],yAxis:[{id:"leftAxisId",width:100},{id:"rightAxisId",position:"right",data:d,width:100,valueFormatter:r=>`${r.toFixed(2)}%`}],sx:{width:s?"60rem":"100%"}})})},w={GetLookupsByParentCode:"/Lookup/parents/codeV2/"},B=()=>({fetchLookupsByParentCode:async(e,o)=>(await m.get(`${w.GetLookupsByParentCode}${o}`,{params:{languageId:e}})).data.body}),q=(t,e)=>{const{fetchLookupsByParentCode:o}=B();return C({queryKey:["lookups",{languageId:t,parentCode:e}],queryFn:()=>o(t,e)})},L={GetPublicStats:"/Statistics/public/"},R=()=>({fetchStatistics:async(e,o)=>(await m.get(`${L.GetPublicStats}${e}`,{params:{languageId:o}})).data.body}),z=(t,e)=>{const{fetchStatistics:o}=R();return C({queryKey:["statistics",{yearId:t,languageId:e}],queryFn:()=>o(t,e),enabled:!!t})},j=k("text")(({theme:t})=>({fill:t.palette.text.primary,textAnchor:"middle",dominantBaseline:"central",fontSize:"1.5rem"})),F=({children:t})=>{const{width:e,height:o,left:a,top:s}=S();return n.jsx(j,{x:a+e/2,y:s+o/2,children:t})},D=t=>{const{data:e,isLoading:o}=t,a={totalVotersCount:0,totalVotedVotersCount:0},s=e.reduce((i,r)=>(i.totalVotersCount+=r.votersCount,i.totalVotedVotersCount+=r.votedVotersCount,i),a),c=`${s.totalVotersCount>0?(s.totalVotedVotersCount/s.totalVotersCount*100).toFixed(2):"0.00"}%`,d=x.useMemo(()=>[{innerRadius:45,outerRadius:115,paddingAngle:2,highlightScope:{fade:"global",highlight:"item"},faded:{innerRadius:45,additionalRadius:0},data:[{label:"عدد الناخبين",value:s.totalVotersCount,color:"#003B73"}]},{innerRadius:55,outerRadius:105,paddingAngle:2,highlightScope:{fade:"global",highlight:"item"},faded:{innerRadius:60,additionalRadius:0},data:[{label:"عدد المقترعين",value:s.totalVotedVotersCount,color:"#AE0000"},{label:"",value:s.totalVotersCount-s.totalVotedVotersCount,color:"transparent"}]}],[s]);return n.jsx(b,{sx:{width:"100%",height:"18.75rem","& .MuiPieArc-root":{'&[fill="transparent"], &[fill="none"]':{pointerEvents:"none"}}},children:n.jsx(P,{slotProps:{legend:{direction:"horizontal",position:{vertical:"bottom",horizontal:"center"}},pieArc:{cornerRadius:10,strokeWidth:0}},loading:o,series:d,children:n.jsx(F,{children:c})})})};export{M as B,D,z as a,q as u};
3//# sourceMappingURL=DonutChart-CjaJjtWw.js.map

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.