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