import{a as E}from"./chunk-V3WVIUUL.min.js";import{a as F}from"./chunk-I6VG5SPK.min.js";import"./chunk-LK7NMYKK.min.js";import{a as I}from"./chunk-7EBV5LUJ.min.js";import"./chunk-6RTTMAJH.min.js";import"./chunk-LGVO22YL.min.js";import"./chunk-HVSI2YYT.min.js";import"./chunk-6B6J5Z6Z.min.js";import"./chunk-EU44H33B.min.js";import"./chunk-CQUFH26W.min.js";import"./chunk-LBFZT66H.min.js";import"./chunk-R5JLOOQ4.min.js";import"./chunk-PTL4EUOE.min.js";import{l as y}from"./chunk-QZZKR5JD.min.js";import"./chunk-CM5D5KZN.min.js";import{P as A,Q as L,R as T,S as O,T as S,U as k,V as R,o as b,q as M,y as C}from"./chunk-3EE2TK35.min.js";import"./chunk-E5F23VE2.min.js";import{b as o,d as w}from"./chunk-6TVUEPFY.min.js";import"./chunk-OSRY5VT3.min.js";var h={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},_={axes:[],curves:[],options:h},m=structuredClone(_),H=M.radar,j=o(()=>y({...H,...C().radar}),"getConfig"),D=o(()=>m.axes,"getAxes"),N=o(()=>m.curves,"getCurves"),U=o(()=>m.options,"getOptions"),X=o(a=>{m.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),Y=o(a=>{m.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:Z(t.entries)}))},"setCurves"),Z=o(a=>{if(a[0].axis==null)return a.map(e=>e.value);let t=D();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{let r=a.find(n=>n.axis?.$refText===e.name);if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),q=o(a=>{let t=a.reduce((e,r)=>(e[r.name]=r,e),{});m.options={showLegend:t.showLegend?.value??h.showLegend,ticks:t.ticks?.value??h.ticks,max:t.max?.value??h.max,min:t.min?.value??h.min,graticule:t.graticule?.value??h.graticule}},"setOptions"),J=o(()=>{A(),m=structuredClone(_)},"clear"),$={getAxes:D,getCurves:N,getOptions:U,setAxes:X,setCurves:Y,setOptions:q,getConfig:j,clear:J,setAccTitle:L,getAccTitle:T,setDiagramTitle:k,getDiagramTitle:R,getAccDescription:S,setAccDescription:O},K=o(a=>{E(a,$);let{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),Q={parse:o(async a=>{let t=await F("radar",a);w.debug(t),K(t)},"parse")},tt=o((a,t,e,r)=>{let n=r.db,i=n.getAxes(),l=n.getCurves(),s=n.getOptions(),c=n.getConfig(),d=n.getDiagramTitle(),p=I(t),u=et(p,c),g=s.max??Math.max(...l.map(f=>Math.max(...f.entries))),x=s.min,v=Math.min(c.width,c.height)/2;at(u,i,v,s.ticks,s.graticule),rt(u,i,v,c),G(u,i,l,x,g,s.graticule,c),V(u,l,s.showLegend,c),u.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-c.height/2-c.marginTop)},"draw"),et=o((a,t)=>{let e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,n={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return a.attr("viewbox",`0 0 ${e} ${r}`).attr("width",e).attr("height",r),a.append("g").attr("transform",`translate(${n.x}, ${n.y})`)},"drawFrame"),at=o((a,t,e,r,n)=>{if(n==="circle")for(let i=0;i{let u=2*p*Math.PI/i-Math.PI/2,g=s*Math.cos(u),x=s*Math.sin(u);return`${g},${x}`}).join(" ");a.append("polygon").attr("points",c).attr("class","radarGraticule")}}},"drawGraticule"),rt=o((a,t,e,r)=>{let n=t.length;for(let i=0;i{if(d.entries.length!==s)return;let u=d.entries.map((g,x)=>{let v=2*Math.PI*x/s-Math.PI/2,f=P(g,r,n,c),W=f*Math.cos(v),B=f*Math.sin(v);return{x:W,y:B}});i==="circle"?a.append("path").attr("d",z(u,l.curveTension)).attr("class",`radarCurve-${p}`):i==="polygon"&&a.append("polygon").attr("points",u.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${p}`)})}o(G,"drawCurves");function P(a,t,e,r){let n=Math.min(Math.max(a,t),e);return r*(n-t)/(e-t)}o(P,"relativeRadius");function z(a,t){let e=a.length,r=`M${a[0].x},${a[0].y}`;for(let n=0;n{let d=a.append("g").attr("transform",`translate(${n}, ${i+c*l})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${c}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(s.label)})}o(V,"drawLegend");var nt={draw:tt},st=o((a,t)=>{let e="";for(let r=0;r{let t=b(),e=C(),r=y(t,e.themeVariables),n=y(r.radar,a);return{themeVariables:r,radarOptions:n}},"buildRadarStyleOptions"),it=o(({radar:a}={})=>{let{themeVariables:t,radarOptions:e}=ot(a);return` .radarTitle { font-size: ${t.fontSize}; color: ${t.titleColor}; dominant-baseline: hanging; text-anchor: middle; } .radarAxisLine { stroke: ${e.axisColor}; stroke-width: ${e.axisStrokeWidth}; } .radarAxisLabel { dominant-baseline: middle; text-anchor: middle; font-size: ${e.axisLabelFontSize}px; color: ${e.axisColor}; } .radarGraticule { fill: ${e.graticuleColor}; fill-opacity: ${e.graticuleOpacity}; stroke: ${e.graticuleColor}; stroke-width: ${e.graticuleStrokeWidth}; } .radarLegendText { text-anchor: start; font-size: ${e.legendFontSize}px; dominant-baseline: hanging; } ${st(t,e)} `},"styles"),mt={parser:Q,db:$,renderer:nt,styles:it};export{mt as diagram}; //# sourceMappingURL=diagram-QEK2KX5R-LLW36CQ4.min.js.map