import{r as e,j as t}from"./vendor-react-Co0R0q1H.js";const r="var(--sparkline-critical)",n="var(--sparkline-poor)",i="var(--sparkline-fair)",s="var(--sparkline-good)",o="var(--sparkline-excellent)",a=e.memo(function({data:a,width:l=48,height:h=16,color:c,isLoading:d=!1,className:u=""}){const x=e.useMemo(()=>function(e,t,r,n=2){if(e.length<2)return"";const i=e.map(e=>e.count),s=Math.max(...i,1),o=Math.min(...i),a=s-o||1,l=t-2*n,h=r-2*n,c=i.map((e,t)=>({x:n+t/(i.length-1)*l,y:n+h-(e-o)/a*h}));let d=`M ${c[0].x.toFixed(1)} ${c[0].y.toFixed(1)}`;for(let u=1;u<c.length;u++){const e=c[u-1],t=c[u];d+=` Q ${((e.x+t.x)/2).toFixed(1)} ${e.y.toFixed(1)} ${t.x.toFixed(1)} ${t.y.toFixed(1)}`}return d}(a,l,h),[a,l,h]),g=e.useMemo(()=>c??(a.length>0?function(e){if(0===e.length)return r;const t=e.slice(-4),a=t.reduce((e,t)=>e+t.count,0),l=a/t.length,h=e.reduce((e,t)=>e+t.count,0)/e.length;if(0===a)return r;if(h>0){const e=l/h;return e>=1.2?o:e>=.8?s:e>=.4?i:e>=.1?n:r}return a>=10?o:a>=5?s:a>=2?i:a>=1?n:r}(a):"var(--fg-muted)"),[c,a]);return d&&a.length<2?t.jsx("div",{className:`flex items-center justify-center ${u}`,style:{width:l,height:h},children:t.jsx("div",{className:"rounded animate-pulse bg-subtle-fill-hover",style:{width:l-8,height:h-6}})}):a.length<2?t.jsx("svg",{width:l,height:h,viewBox:`0 0 ${l} ${h}`,className:u,"aria-hidden":"true",children:t.jsx("line",{x1:4,y1:h/2,x2:l-4,y2:h/2,stroke:r,strokeWidth:1.5,strokeDasharray:"3,2"})}):t.jsx("svg",{width:l,height:h,viewBox:`0 0 ${l} ${h}`,preserveAspectRatio:"none",className:u,"aria-hidden":"true",style:{maxWidth:"100%"},children:t.jsx("path",{d:x,fill:"none",stroke:g,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"})})});export{a as L};
