import{r as y,j as t}from"./index-BuFgUdF6.js";const m="var(--sys-cyan)",k="var(--sys-blue)",v="var(--sys-indigo)",I="var(--sparkline-critical)",g="var(--fg-muted)";function C(d,o,e,s=2){if(d.length<2)return"";const r=d.map(n=>n.count),u=Math.max(...r,1),p=Math.min(...r),l=u-p||1,j=o-s*2,a=e-s*2,i=r.map((n,c)=>({x:s+c/(r.length-1)*j,y:s+a-(n-p)/l*a}));let x=`M ${i[0].x.toFixed(1)} ${i[0].y.toFixed(1)}`;for(let n=1;n<i.length;n++){const c=i[n-1],f=i[n],$=(c.x+f.x)/2;x+=` Q ${$.toFixed(1)} ${c.y.toFixed(1)} ${f.x.toFixed(1)} ${f.y.toFixed(1)}`}return x}const L=y.memo(function({data:o,width:e=48,height:s=16,color:r,invertScale:u=!1,isLoading:p=!1,className:l=""}){const a=`sl-${y.useId().replace(/:/g,"")}`,i=y.useMemo(()=>C(o,e,s),[o,e,s]),x=!r&&o.length>=2,n=r??(x?`url(#${a})`:g),c=l.includes("w-");return p&&o.length<2?t.jsx("div",{className:`flex items-center justify-center ${l}`,style:c?{height:s}:{width:e,height:s},children:t.jsx("div",{className:"rounded animate-pulse bg-subtle-fill-hover",style:c?{width:"100%",height:s-6}:{width:e-8,height:s-6}})}):o.length<2?t.jsx("svg",{width:e,height:s,viewBox:`0 0 ${e} ${s}`,className:l,"aria-hidden":"true",children:t.jsx("line",{x1:4,y1:s/2,x2:e-4,y2:s/2,stroke:I,strokeWidth:1.5,strokeDasharray:"3,2"})}):t.jsxs("svg",{width:e,height:s,viewBox:`0 0 ${e} ${s}`,preserveAspectRatio:"none",className:l,"aria-hidden":"true",style:{maxWidth:"100%"},children:[x&&t.jsx("defs",{children:t.jsxs("linearGradient",{id:a,gradientUnits:"userSpaceOnUse",x1:0,y1:2,x2:0,y2:s-2,children:[t.jsx("stop",{offset:"0%",stopColor:u?v:m}),t.jsx("stop",{offset:"50%",stopColor:k}),t.jsx("stop",{offset:"100%",stopColor:u?m:v})]})}),t.jsx("path",{d:i,fill:"none",stroke:n,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"})]})});export{L};
