import{ao as c,aI as _}from"./app-k0jcl5PQ.js";const g={HIGH:.75,MODERATE:.5},O={HIGH:.7,MODERATE:.7},d="_circleContainer_w7ejz_1",f="_backgroundCircle_w7ejz_17",x="_circleSuccess_w7ejz_20",m="_circleWarning_w7ejz_23",b="_circleDanger_w7ejz_26",j="_lgCircleContainer_w7ejz_29",h="_xsCircleContainer_w7ejz_40",T="_pendingCircle_w7ejz_48",E="_centredPercentageText_w7ejz_58",t={circleContainer:d,backgroundCircle:f,circleSuccess:x,circleWarning:m,circleDanger:b,lgCircleContainer:j,xsCircleContainer:h,pendingCircle:T,centredPercentageText:E},o=2,D=5.8,S=.2,y=.36;var i=(e=>(e.Small="small",e.Large="large",e.ExtraSmall="extraSmall",e))(i||{});const z={extraSmall:{size:o},small:{size:o},large:{size:D}};function u(e){const n=z[e].size,r=e==="large"?y:S;return`${n/2-r*2}rem`}function I(e,n=g){return e>=n.HIGH?t.circleSuccess:e>=n.MODERATE?t.circleWarning:t.circleDanger}function R(e,n=g){return e>=n.HIGH?"text-success":e>=n.MODERATE?"text-warning":"text-danger"}function w(e,n){let r=`d-inline-block ${t.circleContainer}`;return e==="large"&&(r+=` ${t.lgCircleContainer}`),e==="extraSmall"&&(r+=` ${t.xsCircleContainer}`),s(n)&&(r+=` ${t.pendingCircle}`),r}function H(e){if(!s(e))return+e.toFixed(2)}function N(e){return s(e)?"--%":`${Math.round(e*100)}%`}function s(e){return typeof e!="number"}function L(e){const n=_.useCallback(r=>{if(!r)return;const l=r.r.baseVal.value,a=2*Math.PI*l,C=a-e.percentage*a;r.style.strokeDasharray=`${a} ${a}`,r.style.strokeDashoffset=C.toString()},[e.percentage]);return c.jsxs("svg",{children:[c.jsx("circle",{r:u(e.size),className:t.backgroundCircle}),!s(e.percentage)&&c.jsx("circle",{ref:n,r:u(e.size),className:I(e.percentage,e.scoreThresholds)})]})}var k=(e=>(e.CircleOnly="circle_only",e.LabelOnly="label_only",e.LabelBefore="label_before",e.LabelInside="label_inside",e))(k||{});W.defaultProps={layout:"circle_only"};function W(e){const n=H(e.percentage),r=e.size||(e.layout==="label_inside"?i.Large:i.Small),l=e.customLabel||N(n);return e.layout==="label_only"?c.jsx("span",{className:R(n),children:l}):c.jsxs("div",{className:`d-flex align-items-center justify-content-between ${e.className??""}`,children:[e.layout==="label_before"&&c.jsx("span",{className:"me-2",children:l}),c.jsxs("div",{className:w(r,n),children:[c.jsx(L,{percentage:n,size:r,scoreThresholds:e.scoreThresholds}),e.layout==="label_inside"&&c.jsx("span",{className:t.centredPercentageText,children:l})]})]})}export{W as P,O as S,k as a,i as b,H as c,N as g};
//# sourceMappingURL=CssKhUy4.chunk.js.map
