"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["node_modules_mermaid_dist_chunks_mermaid_core_pieDiagram-YF2LJOPJ_mjs"],{"./node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-YF2LJOPJ.mjs":function(ce,L,n){n.d(L,{diagram:function(){return q}});var I=n("./node_modules/mermaid/dist/chunks/mermaid.core/chunk-TMUBEWPD.mjs"),T=n("./node_modules/mermaid/dist/chunks/mermaid.core/chunk-7DKRZKHE.mjs"),R=n("./node_modules/mermaid/dist/chunks/mermaid.core/chunk-EJ4ZWXGL.mjs"),t=n("./node_modules/mermaid/dist/chunks/mermaid.core/chunk-6DBFFHIP.mjs"),j=n("./node_modules/@mermaid-js/parser/dist/mermaid-parser.core.mjs"),u=n("./node_modules/d3/src/index.js"),k=t.UI.pie,f={sections:new Map,showData:!1,config:k},p=f.sections,v=f.showData,B=structuredClone(k),F=(0,t.K2)(()=>structuredClone(B),"getConfig"),U=(0,t.K2)(()=>{p=new Map,v=f.showData,(0,t.IU)()},"clear"),G=(0,t.K2)(({label:e,value:a})=>{p.has(e)||(p.set(e,a),t.Rm.debug(`added new section: ${e}, with value: ${a}`))},"addSection"),b=(0,t.K2)(()=>p,"getSections"),J=(0,t.K2)(e=>{v=e},"setShowData"),z=(0,t.K2)(()=>v,"getShowData"),P={getConfig:F,clear:U,setDiagramTitle:t.ke,getDiagramTitle:t.ab,setAccTitle:t.SV,getAccTitle:t.iN,setAccDescription:t.EI,getAccDescription:t.m7,addSection:G,getSections:b,setShowData:J,getShowData:z},N=(0,t.K2)((e,a)=>{(0,I.S)(e,a),a.setShowData(e.showData),e.sections.map(a.addSection)},"populateDb"),Z={parse:(0,t.K2)(async e=>{const a=await(0,j.qg)("pie",e);t.Rm.debug(a),N(a,P)},"parse")},H=(0,t.K2)(e=>`
  .pieCircle{
    stroke: ${e.pieStrokeColor};
    stroke-width : ${e.pieStrokeWidth};
    opacity : ${e.pieOpacity};
  }
  .pieOuterCircle{
    stroke: ${e.pieOuterStrokeColor};
    stroke-width: ${e.pieOuterStrokeWidth};
    fill: none;
  }
  .pieTitleText {
    text-anchor: middle;
    font-size: ${e.pieTitleTextSize};
    fill: ${e.pieTitleTextColor};
    font-family: ${e.fontFamily};
  }
  .slice {
    font-family: ${e.fontFamily};
    fill: ${e.pieSectionTextColor};
    font-size:${e.pieSectionTextSize};
    // fill: white;
  }
  .legend text {
    fill: ${e.pieLegendTextColor};
    font-family: ${e.fontFamily};
    font-size: ${e.pieLegendTextSize};
  }
`,"getStyles"),V=H,X=(0,t.K2)(e=>{const a=[...e.entries()].map(s=>({label:s[0],value:s[1]})).sort((s,c)=>c.value-s.value);return(0,u.rLf)().value(s=>s.value)(a)},"createPieArcs"),Y=(0,t.K2)((e,a,ee,s)=>{t.Rm.debug(`rendering pie chart
`+e);const c=s.db,w=(0,t.D7)(),y=(0,T.$t)(c.getConfig(),w.pie),$=40,o=18,_=4,l=450,E=l,S=(0,R.D)(a),d=S.append("g");d.attr("transform","translate("+E/2+","+l/2+")");const{themeVariables:r}=w;let[A]=(0,T.I5)(r.pieOuterStrokeWidth);A??(A=2);const K=y.textPosition,h=Math.min(E,l)/2-$,te=(0,u.JLW)().innerRadius(0).outerRadius(h),ae=(0,u.JLW)().innerRadius(h*K).outerRadius(h*K);d.append("circle").attr("cx",0).attr("cy",0).attr("r",h+A/2).attr("class","pieOuterCircle");const M=c.getSections(),C=X(M),re=[r.pie1,r.pie2,r.pie3,r.pie4,r.pie5,r.pie6,r.pie7,r.pie8,r.pie9,r.pie10,r.pie11,r.pie12],m=(0,u.UMr)(re);d.selectAll("mySlices").data(C).enter().append("path").attr("d",te).attr("fill",i=>m(i.data.label)).attr("class","pieCircle");let O=0;M.forEach(i=>{O+=i}),d.selectAll("mySlices").data(C).enter().append("text").text(i=>(i.data.value/O*100).toFixed(0)+"%").attr("transform",i=>"translate("+ae.centroid(i)+")").style("text-anchor","middle").attr("class","slice"),d.append("text").text(c.getDiagramTitle()).attr("x",0).attr("y",-(l-50)/2).attr("class","pieTitleText");const x=d.selectAll(".legend").data(m.domain()).enter().append("g").attr("class","legend").attr("transform",(i,g)=>{const D=o+_,se=D*m.domain().length/2,ne=12*o,oe=g*D-se;return"translate("+ne+","+oe+")"});x.append("rect").attr("width",o).attr("height",o).style("fill",m).style("stroke",m),x.data(C).append("text").attr("x",o+_).attr("y",o-_).text(i=>{const{label:g,value:D}=i.data;return c.getShowData()?`${g} [${D}]`:g});const ie=Math.max(...x.selectAll("text").nodes().map(i=>i?.getBoundingClientRect().width??0)),W=E+$+o+_+ie;S.attr("viewBox",`0 0 ${W} ${l}`),(0,t.a$)(S,l,W,y.useMaxWidth)},"draw"),Q={draw:Y},q={parser:Z,db:P,renderer:Q,styles:V}}}]);
