ml-time-graph 1.5.1 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/internals.js CHANGED
@@ -1,30 +1,30 @@
1
- var G=class{};var x=class{static interpolateDataPoint(a,e,t){return {time:a.time+Math.round(t*(e.time-a.time)),value:(a.value??0)+t*((e.value??0)-(a.value??0))}}static interpolateAggregatedPoint(a,e,t){let n=(r,o)=>r!==null&&o!==null?r+t*(o-r):null;return {time:a.time+t*(e.time-a.time),min:n(a.min,e.min),max:n(a.max,e.max),avg:n(a.avg,e.avg),count:Math.round(a.count+t*(e.count-a.count))}}static getRuns(a,e,t=0){let n=[...a].sort((s,i)=>s.time-i.time),r=[],o=[],l=null;for(let s of n){let i=e(s),m=t>0&&l&&s.time-l.time>t;(i||m)&&o.length&&(r.push(o),o=[]),i||o.push(s),l=s;}return o.length&&r.push(o),r}static splitByBoundaries(a,e,t,n){if(a.length===0)return [];if(e.length===0)return [{data:a,zoneIndex:0}];let r=[...e].sort((i,m)=>i-m),o=[],l=i=>{let m=0;for(let u=0;u<r.length&&i>=r[u];u++)m=u+1;return m},s=[a[0]];for(let i=1;i<a.length;i++){let m=a[i-1],u=a[i],c=t(m),d=t(u),p;d>c?p=r.filter(f=>f>c&&f<=d):d<c?p=r.filter(f=>f>=d&&f<c).reverse():p=[];for(let f of p){let g=(f-c)/(d-c),b=n(m,u,g);s.push(b),o.push({data:s,zoneIndex:l((c+f)/2)}),s=[b];}s.push(u);}if(s.length>0){let i=t(s[0]),m=t(s[s.length-1]);o.push({data:s,zoneIndex:l((i+m)/2)});}return o}static splitByThreshold(a,e,t,n){let r=this.splitByBoundaries(a,[e],t,n),o={above:[],below:[]};for(let l of r)l.zoneIndex===0?o.below.push(l.data):o.above.push(l.data);return o}};var ce=class{static compute(a){let e=a.map(s=>s.value).filter(s=>s!==null).sort((s,i)=>s-i);if(e.length===0)return {min:NaN,max:NaN,avg:NaN,mean:NaN,median:NaN,stdDev:NaN,count:0};let t=e.length,n=e.reduce((s,i)=>s+i,0)/t,r=t%2===1?e[Math.floor(t/2)]:(e[t/2-1]+e[t/2])/2,o=e.reduce((s,i)=>s+Math.pow(i-n,2),0)/t,l=Math.sqrt(o);return {min:e[0],max:e[t-1],avg:n,mean:n,median:r,stdDev:l,count:t}}static computeInRange(a,e,t){let n=a.filter(r=>r.time>=e&&r.time<=t);return this.compute(n)}};var de={stroke:"#4285f4",strokeWidth:2,pointSize:4,pointThreshold:100,gapThreshold:0,fill:"none",hatch:null,bandFill:"#4285f4",bandOpacity:.6,bandAvgLine:"#e53e3e",minColor:"#3b82f6",maxColor:"#ef4444",avgColor:"#64748b",areaFillAlpha:"4285f433",axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:11,axisLabelColor:"#444",axisLabelSize:12,gridStroke:"#e2e8f0",gridStrokeWidth:1,gridOpacity:1,legendStroke:"#ccc",legendText:"#333",legendFont:11,annotationColor:"#334155",annotationWidth:1.5,annotationHead:9,annotationRadius:4,annotationFontSize:11,thresholdColor:"#666",thresholdLine:"dashed",thresholdFillOpacity:.12,thresholdFontSize:10,highlightColor:"#fbbf24",highlightOpacity:.2,highlightLabelColor:"#92400e",markerColor:"#f59e0b",markerSize:5,gapFill:"#fff",gapStroke:"#ccc",gapStrokeWidth:1,gapFontColor:"#999",gapFontSize:10,gapFillOpacity:.15,tooltipBg:"#fff",tooltipBorder:"#cbd5e1",tooltipText:"#1e293b",tooltipValue:"#3b82f6",tooltipCrosshair:"#94a3b8",tooltipSnapRadius:20,statsLineColor:"#94a3b8",statsLabelColor:"#64748b",minimapStroke:"#94a3b8",minimapBg:"#f8f9fa",minimapBrush:"#3b82f644",palette:["#4285f4","#ea4335","#22c55e","#fbbc05","#9334ea","#12b5e5","#fb923c","#6366f1"]};var we={...de};function C(){return we}function Ce(a){let e=a.trim();if(e.startsWith("#"))return e.length===9?e.slice(0,7):e.length===5?e.slice(0,4):e;if(e.toLowerCase().startsWith("rgba(")){let n=e.slice(5,e.lastIndexOf(")")).split(",");if(n.length===4)return `rgb(${n[0].trim()}, ${n[1].trim()}, ${n[2].trim()})`}return e}function Te(a){let e=a.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function he(a,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",n,r=2){let o=n??Ce(t),l=Te(t)?"":' fill-opacity="0.3"';if(e==="none")return `
1
+ var z=class{};var S=class{static interpolateDataPoint(a,e,t){return {time:a.time+Math.round(t*(e.time-a.time)),value:(a.value??0)+t*((e.value??0)-(a.value??0))}}static interpolateAggregatedPoint(a,e,t){let n=(r,o)=>r!==null&&o!==null?r+t*(o-r):null;return {time:a.time+t*(e.time-a.time),min:n(a.min,e.min),max:n(a.max,e.max),avg:n(a.avg,e.avg),count:Math.round(a.count+t*(e.count-a.count))}}static getRuns(a,e,t=0){let n=[...a].sort((l,i)=>l.time-i.time),r=[],o=[],s=null;for(let l of n){let i=e(l),m=t>0&&s&&l.time-s.time>t;(i||m)&&o.length&&(r.push(o),o=[]),i||o.push(l),s=l;}return o.length&&r.push(o),r}static splitByBoundaries(a,e,t,n){if(a.length===0)return [];if(e.length===0)return [{data:a,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let r=[...e].sort((m,u)=>m-u),o=[],s=m=>m<=0?Number.NEGATIVE_INFINITY:r[m-1],l=m=>{let u=0;for(let c=0;c<r.length&&m>=r[c];c++)u=c+1;return u},i=[a[0]];for(let m=1;m<a.length;m++){let u=a[m-1],c=a[m],d=t(u),p=t(c),f;p>d?f=r.filter(b=>b>d&&b<=p):p<d?f=r.filter(b=>b>=p&&b<d).reverse():f=[];let g=d;for(let b of f){let y=(b-d)/(p-d),x=n(u,c,y);i.push(x);let C=l((g+b)/2);o.push({data:i,zoneIndex:C,zoneLow:s(C)}),i=[x],g=b;}(f.length===0||f[f.length-1]!==p)&&i.push(c);}if(i.length>1){let m=t(i[0]),u=t(i[i.length-1]),c=l((m+u)/2);o.push({data:i,zoneIndex:c,zoneLow:s(c)});}return o}static splitByThreshold(a,e,t,n){let r=this.splitByBoundaries(a,[e],t,n),o={above:[],below:[]};for(let s of r)s.zoneIndex===0?o.below.push(s.data):o.above.push(s.data);return o}};var ce=class{static compute(a){let e=a.map(l=>l.value).filter(l=>l!==null).sort((l,i)=>l-i);if(e.length===0)return {min:NaN,max:NaN,avg:NaN,mean:NaN,median:NaN,stdDev:NaN,count:0};let t=e.length,n=e.reduce((l,i)=>l+i,0)/t,r=t%2===1?e[Math.floor(t/2)]:(e[t/2-1]+e[t/2])/2,o=e.reduce((l,i)=>l+Math.pow(i-n,2),0)/t,s=Math.sqrt(o);return {min:e[0],max:e[t-1],avg:n,mean:n,median:r,stdDev:s,count:t}}static computeInRange(a,e,t){let n=a.filter(r=>r.time>=e&&r.time<=t);return this.compute(n)}};var de={stroke:"#4285f4",strokeWidth:2,pointSize:4,pointThreshold:100,gapThreshold:0,fill:"none",hatch:null,bandFill:"#4285f4",bandOpacity:.6,bandAvgLine:"#e53e3e",minColor:"#3b82f6",maxColor:"#ef4444",avgColor:"#64748b",areaFillAlpha:"4285f433",axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:11,axisLabelColor:"#444",axisLabelSize:12,gridStroke:"#e2e8f0",gridStrokeWidth:1,gridOpacity:1,legendStroke:"#ccc",legendText:"#333",legendFont:11,annotationColor:"#334155",annotationWidth:1.5,annotationHead:9,annotationRadius:4,annotationFontSize:11,thresholdColor:"#666",thresholdLine:"dashed",thresholdFillOpacity:.12,thresholdFontSize:10,highlightColor:"#fbbf24",highlightOpacity:.2,highlightLabelColor:"#92400e",markerColor:"#f59e0b",markerSize:5,gapFill:"#fff",gapStroke:"#ccc",gapStrokeWidth:1,gapFontColor:"#999",gapFontSize:10,gapFillOpacity:.15,tooltipBg:"#fff",tooltipBorder:"#cbd5e1",tooltipText:"#1e293b",tooltipValue:"#3b82f6",tooltipCrosshair:"#94a3b8",tooltipSnapRadius:20,statsLineColor:"#94a3b8",statsLabelColor:"#64748b",minimapStroke:"#94a3b8",minimapBg:"#f8f9fa",minimapBrush:"#3b82f644",palette:["#4285f4","#ea4335","#22c55e","#fbbc05","#9334ea","#12b5e5","#fb923c","#6366f1"]};var we={...de};function T(){return we}function Ce(a){let e=a.trim();if(e.startsWith("#"))return e.length===9?e.slice(0,7):e.length===5?e.slice(0,4):e;if(e.toLowerCase().startsWith("rgba(")){let n=e.slice(5,e.lastIndexOf(")")).split(",");if(n.length===4)return `rgb(${n[0].trim()}, ${n[1].trim()}, ${n[2].trim()})`}return e}function Te(a){let e=a.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function he(a,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",n,r=2){let o=n??Ce(t),s=Te(t)?"":' fill-opacity="0.3"';if(e==="none")return `
2
2
  <pattern id="${a}" width="10" height="10" patternUnits="userSpaceOnUse">
3
3
  <rect width="10" height="10" fill="${t}" />
4
4
  </pattern>
5
- `.trim();let s=12,i=12,m="rotate(0)",u="";switch(e){case "classic-diagonal":s=12,i=12,m="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${i}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />`;break;case "dense-steep":s=6,i=6,m="rotate(30)",u=`<line x1="0" y1="0" x2="0" y2="${i}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />`;break;case "crosshatch":s=14,i=14,m="rotate(45)",u=`
5
+ `.trim();let l=12,i=12,m="rotate(0)",u="";switch(e){case "classic-diagonal":l=12,i=12,m="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${i}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />`;break;case "dense-steep":l=6,i=6,m="rotate(30)",u=`<line x1="0" y1="0" x2="0" y2="${i}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />`;break;case "crosshatch":l=14,i=14,m="rotate(45)",u=`
6
6
  <line x1="0" y1="0" x2="0" y2="${i}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
7
- <line x1="0" y1="0" x2="${s}" y2="0" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
8
- `;break;case "dots":s=12,i=12,u=`<circle cx="${s/2}" cy="${i/2}" r="${r*1.2}" fill="${o}" />`;break;case "waves":s=16,i=16,u=`
9
- <path d="M 0 ${i/2} Q ${s/4} 0, ${s/2} ${i/2} T ${s} ${i/2}" fill="none" stroke="${o}" stroke-width="${r}" stroke-linecap="round" />
10
- `;break;case "dashed":s=12,i=12,m="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${i}" stroke="${o}" stroke-width="${r}" stroke-dasharray="3,3" />`;break;case "herringbone":s=16,i=16,u=`
11
- <path d="M 0 0 L ${s/2} ${i/2} L 0 ${i} M ${s} 0 L ${s/2} ${i/2} L ${s} ${i}" fill="none" stroke="${o}" stroke-width="${r}" stroke-linejoin="round" stroke-linecap="round" />
12
- `;break;case "brick":s=20,i=20,u=`
13
- <path d="M 0 ${i/2} L ${s} ${i/2} M 0 ${i} L ${s} ${i} M ${s/2} 0 L ${s/2} ${i/2} M 0 ${i/2} L 0 ${i}" fill="none" stroke="${o}" stroke-width="${r}" />
14
- `;break;case "double-stripe":s=16,i=16,m="rotate(45)",u=`
7
+ <line x1="0" y1="0" x2="${l}" y2="0" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
8
+ `;break;case "dots":l=12,i=12,u=`<circle cx="${l/2}" cy="${i/2}" r="${r*1.2}" fill="${o}" />`;break;case "waves":l=16,i=16,u=`
9
+ <path d="M 0 ${i/2} Q ${l/4} 0, ${l/2} ${i/2} T ${l} ${i/2}" fill="none" stroke="${o}" stroke-width="${r}" stroke-linecap="round" />
10
+ `;break;case "dashed":l=12,i=12,m="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${i}" stroke="${o}" stroke-width="${r}" stroke-dasharray="3,3" />`;break;case "herringbone":l=16,i=16,u=`
11
+ <path d="M 0 0 L ${l/2} ${i/2} L 0 ${i} M ${l} 0 L ${l/2} ${i/2} L ${l} ${i}" fill="none" stroke="${o}" stroke-width="${r}" stroke-linejoin="round" stroke-linecap="round" />
12
+ `;break;case "brick":l=20,i=20,u=`
13
+ <path d="M 0 ${i/2} L ${l} ${i/2} M 0 ${i} L ${l} ${i} M ${l/2} 0 L ${l/2} ${i/2} M 0 ${i/2} L 0 ${i}" fill="none" stroke="${o}" stroke-width="${r}" />
14
+ `;break;case "double-stripe":l=16,i=16,m="rotate(45)",u=`
15
15
  <line x1="0" y1="0" x2="0" y2="${i}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
16
- <line x1="${s/2}" y1="0" x2="${s/2}" y2="${i}" stroke="${o}" stroke-width="${r/2}" stroke-linecap="square" />
17
- `;break;case "honeycomb":s=18,i=32,u=`
18
- <path d="M 0 0 L ${s/2} 5 L ${s} 0 M 0 16 L ${s/2} 11 L ${s} 16 M 0 16 L 0 32 M ${s/2} 5 L ${s/2} 11 M ${s} 16 L ${s} 32 M 0 32 L ${s/2} 27 L ${s} 32 M ${s/2} 27 L ${s/2} 32" fill="none" stroke="${o}" stroke-width="${r}" stroke-linejoin="round" stroke-linecap="round" />
19
- `;break}let c=`<rect width="${s}" height="${i}" fill="${t}"${l} />`;return `
20
- <pattern id="${a}" width="${s}" height="${i}" patternTransform="${m}" patternUnits="userSpaceOnUse">
16
+ <line x1="${l/2}" y1="0" x2="${l/2}" y2="${i}" stroke="${o}" stroke-width="${r/2}" stroke-linecap="square" />
17
+ `;break;case "honeycomb":l=18,i=32,u=`
18
+ <path d="M 0 0 L ${l/2} 5 L ${l} 0 M 0 16 L ${l/2} 11 L ${l} 16 M 0 16 L 0 32 M ${l/2} 5 L ${l/2} 11 M ${l} 16 L ${l} 32 M 0 32 L ${l/2} 27 L ${l} 32 M ${l/2} 27 L ${l/2} 32" fill="none" stroke="${o}" stroke-width="${r}" stroke-linejoin="round" stroke-linecap="round" />
19
+ `;break}let c=`<rect width="${l}" height="${i}" fill="${t}"${s} />`;return `
20
+ <pattern id="${a}" width="${l}" height="${i}" patternTransform="${m}" patternUnits="userSpaceOnUse">
21
21
  ${c}
22
22
  ${u}
23
23
  </pattern>
24
- `.trim()}var h=new Proxy({},{get:(a,e)=>C()[e],has:(a,e)=>e in C(),ownKeys:()=>Reflect.ownKeys(C()),getOwnPropertyDescriptor:(a,e)=>Reflect.getOwnPropertyDescriptor(C(),e)});function H(a){return {id:a.id,line:{stroke:a.stroke??h.stroke,strokeWidth:a.strokeWidth??h.strokeWidth,smoothing:a.smoothing??false,dashed:a.dashed??false},fill:a.fill??h.areaFillAlpha,markers:{type:a.pointStyle??"none",size:a.pointSize??h.pointSize,stroke:a.stroke??h.stroke,fill:"#ffffff"},shadow:{color:a.shadowColor??"transparent",blur:a.shadowBlur??0,offsetX:a.shadowOffsetX??0,offsetY:a.shadowOffsetY??0}}}function w(a,e,t){let n=[],r=a.reduce((l,s)=>l+s.data.length,0),o=H(t);for(let l=0;l<a.length;l++){let s=a[l];s.data.length>=2?n.push({type:"path",id:t.id?`${t.id}-line-${l}`:void 0,points:s.data.map(i=>({x:e.timeScale.map(i.time),y:e.valueScale.map(i.value)})),stroke:s.color??o.line.stroke,strokeWidth:o.line.strokeWidth,smoothing:o.line.smoothing,dashed:o.line.dashed,shadowColor:o.shadow.color,shadowBlur:o.shadow.blur,shadowOffsetX:o.shadow.offsetX,shadowOffsetY:o.shadow.offsetY,fill:"none"}):s.data.length===1&&r===1&&n.push({type:"circle",cx:e.timeScale.map(s.data[0].time),cy:e.valueScale.map(s.data[0].value),r:Math.max(o.markers.size,o.line.strokeWidth),fill:s.color??o.line.stroke,shadowColor:o.shadow.color,shadowBlur:o.shadow.blur});}return n}function Le(a){let e=[];for(let t of a)e.length===0?e.push(t):e.push({x:t.x,y:e[e.length-1].y},t);return e}function z(a,e,t){let n=[],r=H(t);for(let o=0;o<a.length;o++){let l=a[o];if(l.data.length<2)continue;let s=Le(l.data.map(i=>({x:e.timeScale.map(i.time),y:e.valueScale.map(i.value)})));n.push({type:"path",id:t.id?`${t.id}-line-${o}`:void 0,points:s,stroke:l.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:false,fill:"none"});}return n}function De(a,e,t,n,r){let o=[],l=H(t);for(let s=0;s<a.length;s++){let i=a[s];if(i.data.length<2)continue;let m=i.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(n(c))})),u=i.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(r(c))})).reverse();o.push({type:"path",id:t.id?`${t.id}-fill-${s}`:void 0,points:[...m,...u],fill:i.color??l.fill,hatch:t.hatch,stroke:"none"});}return o}function V(a,e,t,n){if(a.length<2)return [];let r=x.splitByBoundaries(a,t.boundaries,t.getValue,t.interpolate),o=[];for(let l=0;l<r.length;l++){let s=r[l];if(s.data.length<2)continue;let i=t.getColor(s.zoneIndex);if(!i)continue;let m=s.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yLow(c))})),u=s.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yHigh(c))})).reverse();o.push({type:"path",id:n?.id?`${n.id}-fill-${l}`:void 0,points:[...m,...u],fill:i,hatch:t.getHatch?.(s.zoneIndex),stroke:"none"});}return o}function Me(a,e,t,n){let r=x.splitByThreshold(a,e,l=>l.value,x.interpolateDataPoint),o=[];return n.below&&o.push(...w(r.below.map(l=>({data:l})),t,n.below)),n.above&&o.push(...w(r.above.map(l=>({data:l})),t,n.above)),o}function W(a,e,t,n){let r=H(t);if(!r.markers.type||r.markers.type==="none")return [];let o=[];for(let l=0;l<a.length;l++){let s=a[l],i=e.timeScale.map(s.time),m=e.valueScale.map(s.value),u=n(s),c=t.pointStroke??u,d=t.pointFill??u,p=t.pointStrokeWidth??1.5,f=t.id?`${t.id}-marker-${l}`:void 0;Y(o,f,r.markers.type,i,m,r.markers.size,c,d,p);}return o}function Y(a,e,t,n,r,o,l,s,i){switch(t){case "circle":a.push({type:"circle",cx:n,cy:r,r:o,fill:s,stroke:l,strokeWidth:i,id:e});break;case "square":a.push({type:"rect",x:n-o,y:r-o,w:o*2,h:o*2,fill:s,stroke:l,strokeWidth:i,id:e});break;case "cross":a.push({type:"line",x1:n-o,y1:r-o,x2:n+o,y2:r+o,stroke:l,strokeWidth:i,id:e},{type:"line",x1:n-o,y1:r+o,x2:n+o,y2:r-o,stroke:l,strokeWidth:i,id:e});break;case "diamond":a.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r},{x:n,y:r+o},{x:n-o,y:r}],fill:s,stroke:l,strokeWidth:i,id:e});break;case "triangle":a.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r+o},{x:n-o,y:r+o}],fill:s,stroke:l,strokeWidth:i,id:e});break;case "star":{let m=[];for(let u=0;u<10;u++){let c=u%2===0?o:o*.5,d=Math.PI/2*3+u*Math.PI/5;m.push({x:n+c*Math.cos(d),y:r+c*Math.sin(d)});}a.push({type:"path",points:m,fill:s,stroke:l,strokeWidth:i,id:e});break}case "arrow":a.push({type:"path",points:[{x:n-o,y:r+o},{x:n,y:r-o},{x:n+o,y:r+o}],stroke:l,strokeWidth:i,fill:"none",id:e});break;case "plus":a.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:l,strokeWidth:i,id:e},{type:"line",x1:n,y1:r-o,x2:n,y2:r+o,stroke:l,strokeWidth:i,id:e});break;case "triangle-down":a.push({type:"path",points:[{x:n,y:r+o},{x:n+o,y:r-o},{x:n-o,y:r-o}],fill:s,stroke:l,strokeWidth:i,id:e});break;case "hexagon":{let m=[];for(let u=0;u<6;u++){let c=u*(Math.PI/3);m.push({x:n+o*Math.cos(c),y:r+o*Math.sin(c)});}a.push({type:"path",points:m,fill:s,stroke:l,strokeWidth:i,id:e});break}case "hourglass":a.push({type:"path",points:[{x:n-o,y:r-o},{x:n+o,y:r-o},{x:n-o,y:r+o},{x:n+o,y:r+o}],fill:s,stroke:l,strokeWidth:i,id:e});break;case "line-horizontal":a.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:l,strokeWidth:i,id:e});break;default:a.push({type:"circle",cx:n,cy:r,r:o,fill:s,stroke:l,strokeWidth:i,id:e});}}var L=12,E=8,X=20,_e=11,Z=18,U=a=>a.length*_e*.6;function $e(a,e="vertical"){if(e==="horizontal"){let n=0;for(let r of a)n+=L+E+U(r.name)+Z;return {width:Math.max(0,n-Z),height:X}}let t=0;for(let n of a)t=Math.max(t,U(n.name));return {width:L+E+t,height:a.length*X}}function Fe(a){let{items:e,x:t,y:n,orientation:r="vertical"}=a,o=[],l=t;return e.forEach((s,i)=>{let m=r==="horizontal"?l:t,u=r==="horizontal"?n:n+i*X;o.push({type:"rect",x:m,y:u,w:L,h:L,fill:s.color,stroke:h.legendStroke,strokeWidth:1},{type:"text",content:s.name,x:m+L+E,y:u+L-2,fontSize:h.legendFont,fill:h.legendText}),r==="horizontal"&&(l+=L+E+U(s.name)+Z);}),{type:"group",cssClass:"chart-legend",commands:o}}function Pe(a){let{xTicks:e,yTicks:t,xRange:n,yRange:r,stroke:o=h.gridStroke,strokeWidth:l=h.gridStrokeWidth,dashed:s=false,opacity:i=h.gridOpacity}=a,m=[];if(t)for(let u of t)m.push({type:"line",x1:n[0],y1:u,x2:n[1],y2:u,stroke:o,strokeWidth:l,dashed:s,opacity:i});if(e)for(let u of e)m.push({type:"line",x1:u,y1:r[0],x2:u,y2:r[1],stroke:o,strokeWidth:l,dashed:s,opacity:i});return m}var pe=new Map;function We(a,e){return `${a}|${JSON.stringify(e??{})}`}function A(a,e){let t=We(a,e),n=pe.get(t);return n||(n=new Intl.DateTimeFormat(a,e),pe.set(t,n)),n}var D=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[n,r]=this.#e,[o,l]=this.#t;return r===n?o:o+(t-n)/(r-n)*(l-o)}invert(e){let[t,n]=this.#e,[r,o]=this.#t;return o===r?t:t+(e-r)/(o-r)*(n-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},k=[{label:"second",ms:1e3},{label:"2_seconds",ms:2e3},{label:"5_seconds",ms:5e3},{label:"10_seconds",ms:1e4},{label:"30_seconds",ms:3e4},{label:"minute",ms:6e4},{label:"5_minutes",ms:3e5},{label:"15_minutes",ms:9e5},{label:"30_minutes",ms:18e5},{label:"hour",ms:36e5},{label:"3_hours",ms:108e5},{label:"6_hours",ms:216e5},{label:"day",ms:864e5},{label:"week",ms:6048e5},{label:"month",ms:2592e6},{label:"3_months",ms:7776e6},{label:"6_months",ms:15552e6},{label:"year",ms:31536e6},{label:"2_years",ms:63072e6},{label:"5_years",ms:15768e7}],R=class{#e;#t;constructor(e){this.#e=new D({domain:e.domain,range:e.range}),this.#t=e.locale||(typeof navigator<"u"?navigator.language:"en-US");}map(e){return this.#e.map(Number(e))}invert(e){return this.#e.invert(e)}domain(){return this.#e.domain()}range(){return this.#e.range()}get locale(){return this.#t}tickInterval(e,t=3,n=12){let[r,o]=this.#e.domain(),l=o-r;if(l<=0)return {interval:k[0].ms};let s=l/e,i=k[0].ms;for(let c of k)if(c.ms>=s){i=c.ms;break}let m=i,u=Math.round(l/m);for(;u>n&&m<k[k.length-1].ms;){let c=k.findIndex(d=>d.ms===m);m=k[Math.min(c+1,k.length-1)].ms,u=Math.round(l/m);}for(;u<t&&m>k[0].ms;){let c=k.findIndex(d=>d.ms===m);m=k[Math.max(c-1,0)].ms,u=Math.round(l/m);}return {interval:m}}ticks(e){let t=e?.minTicks??5,n=e?.maxTicks??12,{interval:r}=this.tickInterval((t+n)/2,t,n),[o,l]=this.#e.domain(),s=[],i=Math.ceil(o/r)*r;for(let m=i;m<=l;m+=r)s.push(m);return s}format(e,t){return A(this.#t,t).format(new Date(e))}},O=class{#e;#t;#n;#r;constructor(e){this.#e=[...e.domain],this.#t=[...e.range],this.#n=e.paddingInner??.1,this.#r=e.paddingOuter??.05;}get step(){let[e,t]=this.#t,n=this.#e.length;return n<=1?Math.abs(t-e):Math.abs(t-e)*(1-this.#r*2)/n+Math.abs(t-e)*this.#n*2/n}get bandwidth(){let[e,t]=this.#t,n=this.#e.length;if(n<=1)return Math.abs(t-e)*(1-this.#r*2);let r=this.#r*2*Math.abs(t-e);return (Math.abs(t-e)-r)/n*(1-this.#n)}map(e){let t=this.#e.findIndex(c=>String(c)===String(e));if(t===-1)return this.#t[0];let[n,r]=this.#t,o=this.#e.length;if(o<=1)return (n+r)/2;let l=this.#r*2*Math.abs(r-n),s=Math.abs(r-n)-l,i=r>=n?1:-1,m=s/o;return n+this.#r*Math.abs(r-n)*i+t*m}invert(e){let t=0,n=1/0;for(let r=0;r<this.#e.length;r++){let o=this.map(this.#e[r]),l=Math.abs(e-o);l<n&&(n=l,t=r);}return this.#e[t]}domain(){return this.#e.length===0?["",""]:[this.#e[0],this.#e[this.#e.length-1]]}range(){return [...this.#t]}positions(){let e=new Map;for(let t of this.#e)e.set(t,this.map(t));return e}};function Ae(a){return a==="dotted"?{dash:"dotted"}:a==="dashed"?{dash:"dashed"}:{}}function Re(a){let{thresholds:e,valueScale:t,xRange:n}=a,[r,o]=n,[l,s]=t.range(),i=Math.min(l,s),m=Math.max(l,s),u=[],c=[];for(let d of e){let p=d.color??h.thresholdColor,f=t.map(d.value);d.fill==="above"?u.push({type:"rect",x:r,y:i,w:o-r,h:Math.max(0,f-i),fill:p,hatch:d.fillHatch,opacity:d.fillOpacity??.12,id:d.id?`${d.id}-fill`:void 0}):d.fill==="below"&&u.push({type:"rect",x:r,y:f,w:o-r,h:Math.max(0,m-f),fill:p,hatch:d.fillHatch,opacity:d.fillOpacity??.12,id:d.id?`${d.id}-fill`:void 0});let g=d.line??h.thresholdLine;if(g!=="none"){let b=Ae(g),y={type:"line",x1:r,y1:f,x2:o,y2:f,stroke:p,strokeWidth:1,...b,id:d.id?`${d.id}-line`:void 0};d.shadowColor&&(y.shadowColor=d.shadowColor,y.shadowBlur=d.shadowBlur??4,y.shadowOffsetX=d.shadowOffsetX??0,y.shadowOffsetY=d.shadowOffsetY??2),u.push(y);}if(d.label!==void 0&&d.label!==null&&d.label!==false){let b=typeof d.label=="object"?d.label:void 0,y=typeof d.label=="string"?d.label:b?.text??d.name,S=b?.position??"right";c.push({...je(y,S,r,o,f,p,b),id:d.id?`${d.id}-label`:void 0});}}return {inside:u,labels:c}}function Oe(a){let e=Re(a);return [...e.inside,...e.labels]}function je(a,e,t,n,r,o,l){let s=(t+n)/2,i={type:"text",content:a,fontSize:h.thresholdFontSize,fill:o},m=l?{...l.rotate!==void 0&&{rotate:l.rotate},...l.textBaseline!==void 0&&{textBaseline:l.textBaseline}}:{};switch(e){case "left":return {...i,...m,x:t+4,y:r-4,anchor:"start"};case "above":return {...i,...m,x:s,y:r-6,anchor:"middle"};case "below":return {...i,...m,x:s,y:r+14,anchor:"middle"};case "center":return {...i,...m,x:s,y:r-4,anchor:"middle"};case "outside-left":return {...i,...m,x:t-6,y:r+3,anchor:"end",textBaseline:m.textBaseline??"middle"};case "outside-right":return {...i,...m,x:n+6,y:r+3,anchor:"start",textBaseline:m.textBaseline??"middle"};default:return {...i,...m,x:n-4,y:r-4,anchor:"end"}}}function Ie(a){let{gaps:e,timeScale:t,yRange:n,fill:r=h.gapFill,hatch:o,fillOpacity:l=h.gapFillOpacity??.15,stroke:s=h.gapStroke,strokeWidth:i=h.gapStrokeWidth,dashed:m=true,fontSize:u=h.gapFontSize,fontFill:c=h.gapFontColor,labelBaseline:d="middle",labelRotate:p}=a,[f,g]=n,b=[];for(let y of e){let S=t.map(y.startTime),F=t.map(y.endTime),T=y.fill??r,P=y.hatch??o,me=y.fillOpacity??l,ue=y.label??"",Se=y.rotate??p,N=y.labelBaseline??d;if(y.style==="dashed_border"||!y.style?b.push({type:"rect",x:S,y:f,w:F-S,h:g-f,fill:T,hatch:P,opacity:me,stroke:s,strokeWidth:i,dashed:m}):y.style==="empty"&&b.push({type:"rect",x:S,y:f,w:F-S,h:g-f,fill:T,hatch:P,opacity:me}),ue){let ke=Be(f,g,N),ve=N==="above"?"top":N==="below"?"bottom":"middle";b.push({type:"text",content:ue,x:(S+F)/2,y:ke,anchor:"middle",fontSize:u,fill:c,textBaseline:ve,rotate:Se});}}return b}function Be(a,e,t){switch(t){case "above":return a-12;case "below":return e+4;default:return (a+e)/2}}function He(a){let{markers:e,timeScale:t,valueScale:n,yRange:r=[0,300]}=a,[o,l]=r,s=[];for(let i of e){let m=t.map(i.time),u=i.color??h.markerColor,c=i.pointStyle??(i.value!==void 0?"circle":"none"),d=i.lineStyle??"full";if(i.value!==void 0){let p=n.map(i.value);if(d==="to-value"?s.push({type:"line",x1:m,y1:l,x2:m,y2:p,stroke:u,strokeWidth:1,dashed:true}):d==="to-top"?s.push({type:"line",x1:m,y1:o,x2:m,y2:p,stroke:u,strokeWidth:1,dashed:true}):d==="full"&&s.push({type:"line",x1:m,y1:o,x2:m,y2:l,stroke:u,strokeWidth:1}),c!=="none"&&Y(s,void 0,c,m,p,h.markerSize,u,u,1.5),i.label){let f=d==="to-value"?p-10:o-6;s.push({type:"text",content:i.label,x:m,y:f,anchor:"middle",fontSize:11,fill:u});}}else s.push({type:"line",x1:m,y1:o,x2:m,y2:l,stroke:u,strokeWidth:1}),i.label&&s.push({type:"text",content:i.label,x:m,y:o-6,anchor:"middle",fontSize:11,fill:u});}return s}function Ve(a){let{highlights:e,timeScale:t,yRange:n,height:r}=a,[o,l]=n,s=[];for(let i of e){let m=t.map(i.startTime),u=t.map(i.endTime);s.push({type:"rect",x:m,y:o,w:u-m,h:l-o,fill:i.color??h.highlightColor,opacity:i.opacity??h.highlightOpacity}),i.label&&s.push({type:"text",content:i.label,x:(m+u)/2,y:Ee(i.labelPosition??"top",o,l,r),anchor:"middle",fontSize:h.annotationFontSize,fill:i.color??h.highlightLabelColor,rotate:i.rotate});}return s}function Ee(a,e,t,n){switch(a){case "above":return e-5;case "below":return n!==void 0?n-5:t+14;case "center":return (e+t)/2+4;case "bottom":return t-6;default:return e+14}}function q(a){return a&&a.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}function Ne(a){let{annotations:e,timeScale:t,valueScales:n}=a,r=[],o=l=>{let s=n.get(l.axis??0)??n.values().next().value;return {x:t.map(l.time),y:s?s.map(l.value):0}};for(let l of e){let s=[],i=m=>s.push(m);switch(l.type){case "line":{let m=o(l.from),u=o(l.to);i({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:l.color??h.annotationColor,strokeWidth:l.width??h.annotationWidth,dash:l.dash});break}case "arrow":{let m=o(l.from),u=o(l.to),c=l.color??h.annotationColor,d=l.headSize??h.annotationHead;i({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:c,strokeWidth:l.width??h.annotationWidth});let p=Math.hypot(u.x-m.x,u.y-m.y)||1,f=(u.x-m.x)/p,g=(u.y-m.y)/p,b=u.x-f*d,y=u.y-g*d;i({type:"path",points:[{x:u.x,y:u.y},{x:b-g*d*.5,y:y+f*d*.5},{x:b+g*d*.5,y:y-f*d*.5}],fill:c,stroke:"none"});break}case "rect":{let m=o(l.from),u=o(l.to);i({type:"rect",x:Math.min(m.x,u.x),y:Math.min(m.y,u.y),w:Math.abs(u.x-m.x),h:Math.abs(u.y-m.y),fill:l.fill??"none",stroke:l.stroke,opacity:l.opacity});break}case "point":{let m=o(l.at),u=l.color??"#334155",c=l.radius??h.annotationRadius,d=l.shape??"circle";d==="circle"?i({type:"circle",cx:m.x,cy:m.y,r:c,fill:u}):d==="square"?i({type:"rect",x:m.x-c,y:m.y-c,w:c*2,h:c*2,fill:u}):(i({type:"line",x1:m.x-c,y1:m.y-c,x2:m.x+c,y2:m.y+c,stroke:u,strokeWidth:1.5}),i({type:"line",x1:m.x-c,y1:m.y+c,x2:m.x+c,y2:m.y-c,stroke:u,strokeWidth:1.5}));break}case "label":{let m=o(l.at);i({type:"text",content:l.text,x:m.x+(l.dx??0),y:m.y+(l.dy??0),anchor:l.anchor??"middle",fontSize:h.annotationFontSize,fill:l.color??h.annotationColor,rotate:l.rotate});break}}if(l.id&&s.length>0){let m=q(l.id);r.push({type:"group",cssClass:`annotation annotation--${m}`,commands:s});}else r.push(...s);}return r}var K=class a{_config;constructor(e){this._config=e;}compute(){let{width:e,height:t,margin:n}=this._config;return {totalWidth:e,totalHeight:t,chartWidth:e-n.left-n.right,chartHeight:t-n.top-n.bottom,chartX:n.left,chartY:n.top,margin:n}}static default(e=800,t=400){return new a({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};var J=class{#e;constructor(){this.#e=[];}add(e){this.#e.push(e);}clear(){this.#e=[];}isInside(e,t){return this.#e.length===0?true:this.#e.some(n=>e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height)}toSVGClipPath(e="clip"){if(this.#e.length===0)return "";let t=this.#e.map(n=>`<rect x="${n.x}" y="${n.y}" width="${n.width}" height="${n.height}" />`).join(`
24
+ `.trim()}var h=new Proxy({},{get:(a,e)=>T()[e],has:(a,e)=>e in T(),ownKeys:()=>Reflect.ownKeys(T()),getOwnPropertyDescriptor:(a,e)=>Reflect.getOwnPropertyDescriptor(T(),e)});function H(a){return {id:a.id,line:{stroke:a.stroke??h.stroke,strokeWidth:a.strokeWidth??h.strokeWidth,smoothing:a.smoothing??false,dashed:a.dashed??false},fill:a.fill??h.areaFillAlpha,markers:{type:a.pointStyle??"none",size:a.pointSize??h.pointSize,stroke:a.stroke??h.stroke,fill:"#ffffff"},shadow:{color:a.shadowColor??"transparent",blur:a.shadowBlur??0,offsetX:a.shadowOffsetX??0,offsetY:a.shadowOffsetY??0}}}function w(a,e,t){let n=[],r=a.reduce((s,l)=>s+l.data.length,0),o=H(t);for(let s=0;s<a.length;s++){let l=a[s];l.data.length>=2?n.push({type:"path",id:t.id?`${t.id}-line-${s}`:void 0,points:l.data.map(i=>({x:e.timeScale.map(i.time),y:e.valueScale.map(i.value)})),stroke:l.color??o.line.stroke,strokeWidth:o.line.strokeWidth,smoothing:o.line.smoothing,dashed:o.line.dashed,shadowColor:o.shadow.color,shadowBlur:o.shadow.blur,shadowOffsetX:o.shadow.offsetX,shadowOffsetY:o.shadow.offsetY,fill:"none"}):l.data.length===1&&r===1&&n.push({type:"circle",cx:e.timeScale.map(l.data[0].time),cy:e.valueScale.map(l.data[0].value),r:Math.max(o.markers.size,o.line.strokeWidth),fill:l.color??o.line.stroke,shadowColor:o.shadow.color,shadowBlur:o.shadow.blur});}return n}function Le(a){let e=[];for(let t of a)e.length===0?e.push(t):e.push({x:t.x,y:e[e.length-1].y},t);return e}function G(a,e,t){let n=[],r=H(t);for(let o=0;o<a.length;o++){let s=a[o];if(s.data.length<2)continue;let l=Le(s.data.map(i=>({x:e.timeScale.map(i.time),y:e.valueScale.map(i.value)})));n.push({type:"path",id:t.id?`${t.id}-line-${o}`:void 0,points:l,stroke:s.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:false,fill:"none"});}return n}function De(a,e,t,n,r){let o=[],s=H(t);for(let l=0;l<a.length;l++){let i=a[l];if(i.data.length<2)continue;let m=i.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(n(c))})),u=i.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(r(c))})).reverse();o.push({type:"path",id:t.id?`${t.id}-fill-${l}`:void 0,points:[...m,...u],fill:i.color??s.fill,hatch:t.hatch,stroke:"none"});}return o}function N(a,e,t,n){if(a.length<2)return [];let r=S.splitByBoundaries(a,t.boundaries,t.getValue,t.interpolate),o=[];for(let s=0;s<r.length;s++){let l=r[s];if(l.data.length<2)continue;let i=t.getColor(l.zoneIndex);if(!i)continue;let m=l.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yLow(c))})),u=l.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yHigh(c))})).reverse();o.push({type:"path",id:n?.id?`${n.id}-fill-${s}`:void 0,points:[...m,...u],fill:i,hatch:t.getHatch?.(l.zoneIndex),stroke:"none"});}return o}function Me(a,e,t,n){let r=S.splitByThreshold(a,e,s=>s.value,S.interpolateDataPoint),o=[];return n.below&&o.push(...w(r.below.map(s=>({data:s})),t,n.below)),n.above&&o.push(...w(r.above.map(s=>({data:s})),t,n.above)),o}function W(a,e,t,n){let r=H(t);if(!r.markers.type||r.markers.type==="none")return [];let o=[];for(let s=0;s<a.length;s++){let l=a[s],i=e.timeScale.map(l.time),m=e.valueScale.map(l.value),u=n(l),c=t.pointStroke??u,d=t.pointFill??u,p=t.pointStrokeWidth??1.5,f=t.id?`${t.id}-marker-${s}`:void 0;Y(o,f,r.markers.type,i,m,r.markers.size,c,d,p);}return o}function Y(a,e,t,n,r,o,s,l,i){switch(t){case "circle":a.push({type:"circle",cx:n,cy:r,r:o,fill:l,stroke:s,strokeWidth:i,id:e});break;case "square":a.push({type:"rect",x:n-o,y:r-o,w:o*2,h:o*2,fill:l,stroke:s,strokeWidth:i,id:e});break;case "cross":a.push({type:"line",x1:n-o,y1:r-o,x2:n+o,y2:r+o,stroke:s,strokeWidth:i,id:e},{type:"line",x1:n-o,y1:r+o,x2:n+o,y2:r-o,stroke:s,strokeWidth:i,id:e});break;case "diamond":a.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r},{x:n,y:r+o},{x:n-o,y:r}],fill:l,stroke:s,strokeWidth:i,id:e});break;case "triangle":a.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r+o},{x:n-o,y:r+o}],fill:l,stroke:s,strokeWidth:i,id:e});break;case "star":{let m=[];for(let u=0;u<10;u++){let c=u%2===0?o:o*.5,d=Math.PI/2*3+u*Math.PI/5;m.push({x:n+c*Math.cos(d),y:r+c*Math.sin(d)});}a.push({type:"path",points:m,fill:l,stroke:s,strokeWidth:i,id:e});break}case "arrow":a.push({type:"path",points:[{x:n-o,y:r+o},{x:n,y:r-o},{x:n+o,y:r+o}],stroke:s,strokeWidth:i,fill:"none",id:e});break;case "plus":a.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:s,strokeWidth:i,id:e},{type:"line",x1:n,y1:r-o,x2:n,y2:r+o,stroke:s,strokeWidth:i,id:e});break;case "triangle-down":a.push({type:"path",points:[{x:n,y:r+o},{x:n+o,y:r-o},{x:n-o,y:r-o}],fill:l,stroke:s,strokeWidth:i,id:e});break;case "hexagon":{let m=[];for(let u=0;u<6;u++){let c=u*(Math.PI/3);m.push({x:n+o*Math.cos(c),y:r+o*Math.sin(c)});}a.push({type:"path",points:m,fill:l,stroke:s,strokeWidth:i,id:e});break}case "hourglass":a.push({type:"path",points:[{x:n-o,y:r-o},{x:n+o,y:r-o},{x:n-o,y:r+o},{x:n+o,y:r+o}],fill:l,stroke:s,strokeWidth:i,id:e});break;case "line-horizontal":a.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:s,strokeWidth:i,id:e});break;default:a.push({type:"circle",cx:n,cy:r,r:o,fill:l,stroke:s,strokeWidth:i,id:e});}}var D=12,V=8,X=20,_e=11,Z=18,U=a=>a.length*_e*.6;function $e(a,e="vertical"){if(e==="horizontal"){let n=0;for(let r of a)n+=D+V+U(r.name)+Z;return {width:Math.max(0,n-Z),height:X}}let t=0;for(let n of a)t=Math.max(t,U(n.name));return {width:D+V+t,height:a.length*X}}function Fe(a){let{items:e,x:t,y:n,orientation:r="vertical"}=a,o=[],s=t;return e.forEach((l,i)=>{let m=r==="horizontal"?s:t,u=r==="horizontal"?n:n+i*X;o.push({type:"rect",x:m,y:u,w:D,h:D,fill:l.color,stroke:h.legendStroke,strokeWidth:1},{type:"text",content:l.name,x:m+D+V,y:u+D-2,fontSize:h.legendFont,fill:h.legendText}),r==="horizontal"&&(s+=D+V+U(l.name)+Z);}),{type:"group",cssClass:"chart-legend",commands:o}}function Pe(a){let{xTicks:e,yTicks:t,xRange:n,yRange:r,stroke:o=h.gridStroke,strokeWidth:s=h.gridStrokeWidth,dashed:l=false,opacity:i=h.gridOpacity}=a,m=[];if(t)for(let u of t)m.push({type:"line",x1:n[0],y1:u,x2:n[1],y2:u,stroke:o,strokeWidth:s,dashed:l,opacity:i});if(e)for(let u of e)m.push({type:"line",x1:u,y1:r[0],x2:u,y2:r[1],stroke:o,strokeWidth:s,dashed:l,opacity:i});return m}var pe=new Map;function We(a,e){return `${a}|${JSON.stringify(e??{})}`}function A(a,e){let t=We(a,e),n=pe.get(t);return n||(n=new Intl.DateTimeFormat(a,e),pe.set(t,n)),n}var M=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[n,r]=this.#e,[o,s]=this.#t;return r===n?o:o+(t-n)/(r-n)*(s-o)}invert(e){let[t,n]=this.#e,[r,o]=this.#t;return o===r?t:t+(e-r)/(o-r)*(n-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},k=[{label:"second",ms:1e3},{label:"2_seconds",ms:2e3},{label:"5_seconds",ms:5e3},{label:"10_seconds",ms:1e4},{label:"30_seconds",ms:3e4},{label:"minute",ms:6e4},{label:"5_minutes",ms:3e5},{label:"15_minutes",ms:9e5},{label:"30_minutes",ms:18e5},{label:"hour",ms:36e5},{label:"3_hours",ms:108e5},{label:"6_hours",ms:216e5},{label:"day",ms:864e5},{label:"week",ms:6048e5},{label:"month",ms:2592e6},{label:"3_months",ms:7776e6},{label:"6_months",ms:15552e6},{label:"year",ms:31536e6},{label:"2_years",ms:63072e6},{label:"5_years",ms:15768e7}],R=class{#e;#t;constructor(e){this.#e=new M({domain:e.domain,range:e.range}),this.#t=e.locale||(typeof navigator<"u"?navigator.language:"en-US");}map(e){return this.#e.map(Number(e))}invert(e){return this.#e.invert(e)}domain(){return this.#e.domain()}range(){return this.#e.range()}get locale(){return this.#t}tickInterval(e,t=3,n=12){let[r,o]=this.#e.domain(),s=o-r;if(s<=0)return {interval:k[0].ms};let l=s/e,i=k[0].ms;for(let c of k)if(c.ms>=l){i=c.ms;break}let m=i,u=Math.round(s/m);for(;u>n&&m<k[k.length-1].ms;){let c=k.findIndex(d=>d.ms===m);m=k[Math.min(c+1,k.length-1)].ms,u=Math.round(s/m);}for(;u<t&&m>k[0].ms;){let c=k.findIndex(d=>d.ms===m);m=k[Math.max(c-1,0)].ms,u=Math.round(s/m);}return {interval:m}}ticks(e){let t=e?.minTicks??5,n=e?.maxTicks??12,{interval:r}=this.tickInterval((t+n)/2,t,n),[o,s]=this.#e.domain(),l=[],i=Math.ceil(o/r)*r;for(let m=i;m<=s;m+=r)l.push(m);return l}format(e,t){return A(this.#t,t).format(new Date(e))}},O=class{#e;#t;#n;#r;constructor(e){this.#e=[...e.domain],this.#t=[...e.range],this.#n=e.paddingInner??.1,this.#r=e.paddingOuter??.05;}get step(){let[e,t]=this.#t,n=this.#e.length;return n<=1?Math.abs(t-e):Math.abs(t-e)*(1-this.#r*2)/n+Math.abs(t-e)*this.#n*2/n}get bandwidth(){let[e,t]=this.#t,n=this.#e.length;if(n<=1)return Math.abs(t-e)*(1-this.#r*2);let r=this.#r*2*Math.abs(t-e);return (Math.abs(t-e)-r)/n*(1-this.#n)}map(e){let t=this.#e.findIndex(c=>String(c)===String(e));if(t===-1)return this.#t[0];let[n,r]=this.#t,o=this.#e.length;if(o<=1)return (n+r)/2;let s=this.#r*2*Math.abs(r-n),l=Math.abs(r-n)-s,i=r>=n?1:-1,m=l/o;return n+this.#r*Math.abs(r-n)*i+t*m}invert(e){let t=0,n=1/0;for(let r=0;r<this.#e.length;r++){let o=this.map(this.#e[r]),s=Math.abs(e-o);s<n&&(n=s,t=r);}return this.#e[t]}domain(){return this.#e.length===0?["",""]:[this.#e[0],this.#e[this.#e.length-1]]}range(){return [...this.#t]}positions(){let e=new Map;for(let t of this.#e)e.set(t,this.map(t));return e}};function Ae(a){return a==="dotted"?{dash:"dotted"}:a==="dashed"?{dash:"dashed"}:{}}function Re(a){let{thresholds:e,valueScale:t,xRange:n}=a,[r,o]=n,[s,l]=t.range(),i=Math.min(s,l),m=Math.max(s,l),u=[],c=[];for(let d of e){let p=d.color??h.thresholdColor,f=t.map(d.value);d.fill==="above"?u.push({type:"rect",x:r,y:i,w:o-r,h:Math.max(0,f-i),fill:p,hatch:d.fillHatch,opacity:d.fillOpacity??.12,id:d.id?`${d.id}-fill`:void 0}):d.fill==="below"&&u.push({type:"rect",x:r,y:f,w:o-r,h:Math.max(0,m-f),fill:p,hatch:d.fillHatch,opacity:d.fillOpacity??.12,id:d.id?`${d.id}-fill`:void 0});let g=d.line??h.thresholdLine;if(g!=="none"){let b=Ae(g),y={type:"line",x1:r,y1:f,x2:o,y2:f,stroke:p,strokeWidth:1,...b,id:d.id?`${d.id}-line`:void 0};d.shadowColor&&(y.shadowColor=d.shadowColor,y.shadowBlur=d.shadowBlur??4,y.shadowOffsetX=d.shadowOffsetX??0,y.shadowOffsetY=d.shadowOffsetY??2),u.push(y);}if(d.label!==void 0&&d.label!==null&&d.label!==false){let b=typeof d.label=="object"?d.label:void 0,y=typeof d.label=="string"?d.label:b?.text??d.name,x=b?.position??"right";c.push({...Ie(y,x,r,o,f,p,b),id:d.id?`${d.id}-label`:void 0});}}return {inside:u,labels:c}}function Oe(a){let e=Re(a);return [...e.inside,...e.labels]}function Ie(a,e,t,n,r,o,s){let l=(t+n)/2,i={type:"text",content:a,fontSize:h.thresholdFontSize,fill:o},m=s?{...s.rotate!==void 0&&{rotate:s.rotate},...s.textBaseline!==void 0&&{textBaseline:s.textBaseline}}:{};switch(e){case "left":return {...i,...m,x:t+4,y:r-4,anchor:"start"};case "above":return {...i,...m,x:l,y:r-6,anchor:"middle"};case "below":return {...i,...m,x:l,y:r+14,anchor:"middle"};case "center":return {...i,...m,x:l,y:r-4,anchor:"middle"};case "outside-left":return {...i,...m,x:t-6,y:r+3,anchor:"end",textBaseline:m.textBaseline??"middle"};case "outside-right":return {...i,...m,x:n+6,y:r+3,anchor:"start",textBaseline:m.textBaseline??"middle"};default:return {...i,...m,x:n-4,y:r-4,anchor:"end"}}}function je(a){let{gaps:e,timeScale:t,yRange:n,fill:r=h.gapFill,hatch:o,fillOpacity:s=h.gapFillOpacity??.15,stroke:l=h.gapStroke,strokeWidth:i=h.gapStrokeWidth,dashed:m=true,fontSize:u=h.gapFontSize,fontFill:c=h.gapFontColor,labelBaseline:d="middle",labelRotate:p}=a,[f,g]=n,b=[];for(let y of e){let x=t.map(y.startTime),C=t.map(y.endTime),L=y.fill??r,P=y.hatch??o,me=y.fillOpacity??s,ue=y.label??"",Se=y.rotate??p,E=y.labelBaseline??d;if(y.style==="dashed_border"||!y.style?b.push({type:"rect",x,y:f,w:C-x,h:g-f,fill:L,hatch:P,opacity:me,stroke:l,strokeWidth:i,dashed:m}):y.style==="empty"&&b.push({type:"rect",x,y:f,w:C-x,h:g-f,fill:L,hatch:P,opacity:me}),ue){let ke=Be(f,g,E),ve=E==="above"?"top":E==="below"?"bottom":"middle";b.push({type:"text",content:ue,x:(x+C)/2,y:ke,anchor:"middle",fontSize:u,fill:c,textBaseline:ve,rotate:Se});}}return b}function Be(a,e,t){switch(t){case "above":return a-12;case "below":return e+4;default:return (a+e)/2}}function He(a){let{markers:e,timeScale:t,valueScale:n,yRange:r=[0,300]}=a,[o,s]=r,l=[];for(let i of e){let m=t.map(i.time),u=i.color??h.markerColor,c=i.pointStyle??(i.value!==void 0?"circle":"none"),d=i.lineStyle??"full";if(i.value!==void 0){let p=n.map(i.value);if(d==="to-value"?l.push({type:"line",x1:m,y1:s,x2:m,y2:p,stroke:u,strokeWidth:1,dashed:true}):d==="to-top"?l.push({type:"line",x1:m,y1:o,x2:m,y2:p,stroke:u,strokeWidth:1,dashed:true}):d==="full"&&l.push({type:"line",x1:m,y1:o,x2:m,y2:s,stroke:u,strokeWidth:1}),c!=="none"&&Y(l,void 0,c,m,p,h.markerSize,u,u,1.5),i.label){let f=d==="to-value"?p-10:o-6;l.push({type:"text",content:i.label,x:m,y:f,anchor:"middle",fontSize:11,fill:u});}}else d!=="none"&&l.push({type:"line",x1:m,y1:o,x2:m,y2:s,stroke:u,strokeWidth:1}),i.label&&l.push({type:"text",content:i.label,x:m,y:o-6,anchor:"middle",fontSize:11,fill:u});}return l}function Ne(a){let{highlights:e,timeScale:t,yRange:n,height:r}=a,[o,s]=n,l=[];for(let i of e){let m=t.map(i.startTime),u=t.map(i.endTime);l.push({type:"rect",x:m,y:o,w:u-m,h:s-o,fill:i.color??h.highlightColor,opacity:i.opacity??h.highlightOpacity}),i.label&&l.push({type:"text",content:i.label,x:(m+u)/2,y:Ve(i.labelPosition??"top",o,s,r),anchor:"middle",fontSize:h.annotationFontSize,fill:i.color??h.highlightLabelColor,rotate:i.rotate});}return l}function Ve(a,e,t,n){switch(a){case "above":return e-5;case "below":return n!==void 0?n-5:t+14;case "center":return (e+t)/2+4;case "bottom":return t-6;default:return e+14}}function q(a){return a&&a.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}function Ee(a){let{annotations:e,timeScale:t,valueScales:n}=a,r=[],o=s=>{let l=n.get(s.axis??0)??n.values().next().value;return {x:t.map(s.time),y:l?l.map(s.value):0}};for(let s of e){let l=[],i=m=>l.push(m);switch(s.type){case "line":{let m=o(s.from),u=o(s.to);i({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:s.color??h.annotationColor,strokeWidth:s.width??h.annotationWidth,dash:s.dash});break}case "arrow":{let m=o(s.from),u=o(s.to),c=s.color??h.annotationColor,d=s.headSize??h.annotationHead;i({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:c,strokeWidth:s.width??h.annotationWidth});let p=Math.hypot(u.x-m.x,u.y-m.y)||1,f=(u.x-m.x)/p,g=(u.y-m.y)/p,b=u.x-f*d,y=u.y-g*d;i({type:"path",points:[{x:u.x,y:u.y},{x:b-g*d*.5,y:y+f*d*.5},{x:b+g*d*.5,y:y-f*d*.5}],fill:c,stroke:"none"});break}case "rect":{let m=o(s.from),u=o(s.to);i({type:"rect",x:Math.min(m.x,u.x),y:Math.min(m.y,u.y),w:Math.abs(u.x-m.x),h:Math.abs(u.y-m.y),fill:s.fill??"none",stroke:s.stroke,opacity:s.opacity});break}case "point":{let m=o(s.at),u=s.color??"#334155",c=s.radius??h.annotationRadius,d=s.shape??"circle";d==="circle"?i({type:"circle",cx:m.x,cy:m.y,r:c,fill:u}):d==="square"?i({type:"rect",x:m.x-c,y:m.y-c,w:c*2,h:c*2,fill:u}):(i({type:"line",x1:m.x-c,y1:m.y-c,x2:m.x+c,y2:m.y+c,stroke:u,strokeWidth:1.5}),i({type:"line",x1:m.x-c,y1:m.y+c,x2:m.x+c,y2:m.y-c,stroke:u,strokeWidth:1.5}));break}case "label":{let m=o(s.at);i({type:"text",content:s.text,x:m.x+(s.dx??0),y:m.y+(s.dy??0),anchor:s.anchor??"middle",fontSize:h.annotationFontSize,fill:s.color??h.annotationColor,rotate:s.rotate});break}}if(s.id&&l.length>0){let m=q(s.id);r.push({type:"group",cssClass:`annotation annotation--${m}`,commands:l});}else r.push(...l);}return r}var K=class a{_config;constructor(e){this._config=e;}compute(){let{width:e,height:t,margin:n}=this._config;return {totalWidth:e,totalHeight:t,chartWidth:e-n.left-n.right,chartHeight:t-n.top-n.bottom,chartX:n.left,chartY:n.top,margin:n}}static default(e=800,t=400){return new a({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};var J=class{#e;constructor(){this.#e=[];}add(e){this.#e.push(e);}clear(){this.#e=[];}isInside(e,t){return this.#e.length===0?true:this.#e.some(n=>e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height)}toSVGClipPath(e="clip"){if(this.#e.length===0)return "";let t=this.#e.map(n=>`<rect x="${n.x}" y="${n.y}" width="${n.width}" height="${n.height}" />`).join(`
25
25
  `);return `<clipPath id="${e}">
26
26
  ${t}
27
- </clipPath>`}get regions(){return [...this.#e]}};var j={axisColor:h.axisColor,tickColor:h.tickColor,textColor:h.textColor,textSize:h.textSize},I=class{#e;#t;constructor(e){this.#e=new R({domain:e.domain,range:e.xRange,locale:e.locale}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??j).axisColor}get tickColor(){return (this.#t.colors??j).tickColor}get textColor(){return (this.#t.colors??j).textColor}get textSize(){return (this.#t.colors??j).textSize}generateTicks(){let e=this.#t.minTicks??5,t=this.#t.maxTicks??12,r=this.#e.ticks({minTicks:e,maxTicks:t}).map(o=>({time:o,x:this.#e.map(o),label:this.tickLabel(o)}));return this.antiOverlap(r)}tickLabel(e){if(this.#t.format)return this.#t.format(new Date(e));let t=this.#t.minTicks??5,n=this.#t.maxTicks??12,{interval:r}=this.#e.tickInterval((t+n)/2,t,n),o={};return r<6e4?(o.hour="2-digit",o.minute="2-digit",o.second="2-digit"):r<36e5||r<864e5?(o.hour="2-digit",o.minute="2-digit"):r<31536e6?(o.day="numeric",o.month="short",r>=2592e6&&(o.day=void 0,o.month="long")):(o.year="numeric",r<2*31536e6&&(o.month="short")),this.#e.format(e,o)}antiOverlap(e){if(e.length<=1)return e;let t=60,n=[e[0]];for(let r=1;r<e.length;r++){let o=n[n.length-1].x;Math.abs(e[r].x-o)>=t&&n.push(e[r]);}return n}render(){let e=this.generateTicks(),t=this.#t.colors??j,n=this.#t.y??0,r=[],[o,l]=this.#e.range();r.push({type:"line",x1:o,y1:n,x2:l,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let s of e)r.push({type:"line",x1:s.x,y1:n,x2:s.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),r.push({type:"text",content:s.label,x:s.x,y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return r}};var B={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function Ge(a){return Math.abs(a)>=1e6?`${(a/1e6).toFixed(1)}M`:Math.abs(a)>=1e3?`${(a/1e3).toFixed(1)}k`:Number.isInteger(a)?String(a):a.toFixed(1)}function ze(a){let e=new Array(a.length).fill(false),t=0;for(;t<a.length;){let n=t;for(;n+1<a.length&&a[n+1].label===a[t].label;)n++;for(let r=t+1;r<n;r++)e[r]=true;t=n+1;}return e}var Q=class{#e;#t;constructor(e){this.#e=new D({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??B).axisColor}get tickColor(){return (this.#t.colors??B).tickColor}get textColor(){return (this.#t.colors??B).textColor}get textSize(){return (this.#t.colors??B).textSize}generateTicks(){let e=this.#t.format??Ge,t=6,[n,r]=this.#e.domain(),o=r-n;if(o===0)return [{value:n,position:this.#e.map(n),label:e(n)}];let l=o/t,s=Math.pow(10,Math.floor(Math.log10(l))),i=l/s,m;i<=1.5?m=s:i<=3?m=2*s:i<=7?m=5*s:m=10*s;let u=[],c=Math.ceil(n/m)*m;for(let d=c;d<=r;d+=m)u.push({value:d,position:this.#e.map(d),label:e(d)});return u}render(){let e=this.generateTicks(),t=this.#t.colors??B,n=this.#t.x??0,r=this.#t.orientation??"vertical",o=this.#t.position??"left",l=this.#t.suppressLabelsNear??[],s=this.#t.suppressTolerancePx??8,i=u=>l.some(c=>Math.abs(c-u)<=s),m=[];if(r==="vertical"){let[u,c]=this.#e.range();m.push({type:"line",x1:n,y1:u,x2:n,y2:c,stroke:t.axisColor,strokeWidth:t.axisWidth});let d=ze(e);e.forEach((p,f)=>{let g=i(p.position),b=d[f]?{opacity:0}:{};o==="left"?(m.push({type:"line",x1:n-4,y1:p.position,x2:n,y2:p.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:p.label,x:n-8,y:p.position+4,anchor:"end",fontSize:11,fill:t.textColor,...b})):(m.push({type:"line",x1:n,y1:p.position,x2:n+4,y2:p.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:p.label,x:n+8,y:p.position+4,anchor:"start",fontSize:11,fill:t.textColor,...b}));});}else {let[u,c]=this.#e.range();m.push({type:"line",x1:u,y1:n,x2:c,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let d of e)m.push({type:"line",x1:d.position,y1:n,x2:d.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),m.push({type:"text",content:d.label,x:d.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}return m}};var ee=class{#e;#t;#n;constructor(e){let t=Object.keys(e.enumMap).map(Number).sort((n,r)=>n-r).map(String);this.#t=t,this.#e=new O({domain:t,range:e.range}),this.#n=e;}get scale(){return this.#e}generateTicks(){let{enumMap:e,showLabels:t=true,autoColor:n=true,gapValues:r}=this.#n,o=new Set(r??[]);return this.#t.map((l,s)=>{let i=Number(l),m=t?e[i]??String(i):String(i),u=this.#e.map(i),c=n?h.palette[s%h.palette.length]:void 0;return {value:i,label:m,y:u,color:c,isGap:o.has(i)}})}colorFor(e){let t=this.#t.indexOf(String(e));if(!(t===-1||!(this.#n.autoColor??true)))return h.palette[t%h.palette.length]}render(){let e=this.generateTicks(),t=this.#n.x??0,n=[];for(let r of e)r.isGap||n.push({type:"text",content:r.label,x:t,y:r.y+4,anchor:"end",fontSize:11,fill:r.color??h.textColor});return n}map(e){return this.#e.map(e)}isGap(e){return new Set(this.#n.gapValues??[]).has(e)}};var v=class a{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++a.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var te=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale;return this.data.filter(t=>t.value!==null).map(t=>({x:this.timeScale.map(t.time),y:e.map(t.value),time:t.time})).sort((t,n)=>t.x-n.x)}render(){let e=this.#e,t={smoothing:e.smoothing??false,stroke:e.stroke??h.stroke,strokeWidth:e.strokeWidth??h.strokeWidth,dashed:e.dashed??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??h.pointSize,shadowColor:e.shadowColor,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY},n=e.pointThreshold??h.pointThreshold,r=e.gapThreshold??h.gapThreshold,o=e.id,l=x.getRuns(this.data,c=>c.value===null,r),s=l.reduce((c,d)=>c+d.length,0);if(s===0)return [];let i={timeScale:this.timeScale,valueScale:e.valueScale},m=l.map(c=>({data:c})),u=[];if(u.push(...w(m,i,{...t,id:o?`${o}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&s<=n)for(let c of l)u.push(...W(c,i,{...t,id:o?`${o}-marker`:void 0},()=>t.stroke));return u}};var ne=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale,t=[...this.data].filter(r=>r.value!==null).sort((r,o)=>r.time-o.time),n=[];for(let r=0;r<t.length;r++){let o=this.timeScale.map(t[r].time),l=e.map(t[r].value);r===0?n.push({x:o,y:l}):n.push({x:o,y:n[n.length-1].y},{x:o,y:l});}return n}render(){let e=x.getRuns(this.data,r=>r.value===null);if(e.length===0)return [];let t={timeScale:this.timeScale,valueScale:this.#e.valueScale},n=e.map(r=>({data:r}));return z(n,t,{stroke:this.#e.stroke??h.stroke,strokeWidth:this.#e.strokeWidth??h.strokeWidth,id:this.id?`${this.id}-line`:void 0})}};var re=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}opacity(e){if(!(this.#e.countOpacity??false))return .6;let t=0;for(let n of this.data)n.count>t&&(t=n.count);return t===0?.2:.2+.8*e/t}render(){let e=this.#e,t=e.fill??h.bandFill,n=e.hatch,r=e.avgLine??false,o=e.avgLineColor??h.bandAvgLine,l=e.bandWidth??10,s=[];for(let i of this.data){if(i.min===null||i.max===null)continue;let m=this.timeScale.map(i.time),u=e.valueScale.map(i.max),c=e.valueScale.map(i.min),d=l,p=this.data.indexOf(i);if(s.push({type:"rect",x:m-d/2,y:u,w:d,h:c-u,fill:t,hatch:n,opacity:this.opacity(i.count),id:this.id?`${this.id}-slot-${p}`:void 0}),r&&i.avg!==null){let f=e.valueScale.map(i.avg);s.push({type:"line",x1:m-d/2,y1:f,x2:m+d/2,y2:f,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${p}`:void 0});}}return s}};var oe=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??h.minColor,n=e.maxColor??h.maxColor,r=e.avgColor??h.avgColor,o=e.avgDashed??true,l=e.smoothing??false,s=e.strokeWidth??h.strokeWidth,i=x.getRuns(this.data,p=>p.min===null||p.max===null||p.avg===null);if(i.length===0)return [];let m={timeScale:this.timeScale,valueScale:e.valueScale},u=[];i.forEach((p,f)=>{p.length<2||(e.fillToMax&&u.push(...V(p,m,{boundaries:[],yLow:g=>g.avg,yHigh:g=>g.max,getValue:g=>g.avg,interpolate:x.interpolateAggregatedPoint,getColor:()=>e.fillToMax,getHatch:()=>e.fillToMaxHatch},{id:this.id?`${this.id}-fillToMax-${f}`:void 0})),e.fillToMin&&u.push(...V(p,m,{boundaries:[],yLow:g=>g.avg,yHigh:g=>g.min,getValue:g=>g.avg,interpolate:x.interpolateAggregatedPoint,getColor:()=>e.fillToMin,getHatch:()=>e.fillToMinHatch},{id:this.id?`${this.id}-fillToMin-${f}`:void 0})));});let c=i.filter(p=>p.length>=2),d=p=>c.map(f=>({data:f.map(g=>({time:g.time,value:p(g)}))}));return u.push(...w(d(p=>p.max),m,{stroke:n,strokeWidth:s,smoothing:l,id:this.id?`${this.id}-max`:void 0}),...w(d(p=>p.min),m,{stroke:t,strokeWidth:s,smoothing:l,id:this.id?`${this.id}-min`:void 0}),...w(d(p=>p.avg),m,{stroke:r,strokeWidth:s,smoothing:l,dashed:o,id:this.id?`${this.id}-avg`:void 0})),u}};var ie=class extends v{#e;#t;constructor(e){super(e,e.data),this.#e=e,this.#t=[...e.zones??[]].sort((t,n)=>t.value-n.value);}#n(e){return e===0?this.#e.baseColor??h.stroke:this.#t[e-1].color}render(){let e=this.#e,t=e.baseColor??h.stroke,n={stroke:t,strokeWidth:e.strokeWidth??h.strokeWidth,smoothing:e.smoothing??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??h.pointSize},r=e.gapThreshold??h.gapThreshold,o=e.pointThreshold??h.pointThreshold,l=x.getRuns(this.data,u=>u.value===null,r),s=l.reduce((u,c)=>u+c.length,0);if(s===0)return [];let i={timeScale:this.timeScale,valueScale:e.valueScale},m=[];for(let u of l){if(u.length<2)continue;if(e.fill){let f=e.fill.value,g=x.splitByBoundaries(u,[f],y=>y.value,x.interpolateDataPoint),b=e.valueScale.map(f);for(let y=0;y<g.length;y++){let S=g[y],F=(S.data[0].value+S.data[S.data.length-1].value)/2;if(e.fill.side==="above"==F>=f){let T=S.data.map(P=>({x:this.timeScale.map(P.time),y:e.valueScale.map(P.value)}));m.push({type:"path",id:this.id?`${this.id}-fill-${y}`:void 0,points:[...T,{x:T[T.length-1].x,y:b},{x:T[0].x,y:b}],fill:e.fill.color,hatch:e.fill.hatch,stroke:"none"});}}}let c=this.#t.map(f=>f.value),p=x.splitByBoundaries(u,c,f=>f.value,x.interpolateDataPoint).map(f=>({data:f.data,color:this.#n(f.zoneIndex)}));m.push(...w(p,i,{...n,id:this.id?`${this.id}-line`:void 0})),n.pointStyle&&n.pointStyle!=="none"&&s<=o&&m.push(...W(u,i,{...n,id:this.id?`${this.id}-marker`:void 0},f=>{let g=t;for(let b of this.#t)f.value>=b.value&&(g=b.color);return g}));}return m}};var ae=class{#e;constructor(e,t,n,r){this.#e={...e,xRange:t,y:n,height:r};}render(){let{items:e,timeScale:t,background:n,hatch:r,showAxis:o,xRange:l,y:s,height:i}=this.#e,m=[];n&&m.push({type:"rect",x:l[0],y:s,w:l[1]-l[0],h:i,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let u of e){let c=t.map(u.startTime),d=t.map(u.endTime);if(!(d-c<1)&&(m.push({type:"rect",x:c,y:s,w:d-c,h:i,hatch:u.hatch??r,fill:u.fill??"#6b728044",stroke:u.stroke,strokeWidth:u.strokeWidth??0}),u.label)){let p=u.labelFontSize??10;m.push({type:"text",content:u.label,x:(c+d)/2,y:this.#t(u.labelBaseline,p),anchor:"middle",fontSize:p,fill:u.labelFill??"#333"});}}if(o){let u=new I({domain:t.domain(),xRange:l,y:s+i+4});m.push({type:"group",cssClass:"annotation-band-axis",commands:u.render()});}return m}#t(e,t){let{y:n,height:r}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+r-t*.25;default:return n+r/2+t*.35}}};var se=class{#e;constructor(e){this.#e=e;}render(){let{data:e,valueScale:t,xRange:n,showMin:r=false,showMax:o=false,showAvg:l=true,showMedian:s=false,labelPosition:i="end",lineColor:m=h.statsLineColor,labelColor:u=h.statsLabelColor}=this.#e,c=ce.compute(e),d=[{name:"min",value:c.min,enabled:r},{name:"max",value:c.max,enabled:o},{name:"avg",value:c.avg,enabled:l},{name:"median",value:c.median,enabled:s}],p=[],[f,g]=n;for(let b of d.filter(y=>y.enabled)){let y=t.map(b.value);p.push({type:"line",x1:f,y1:y,x2:g,y2:y,stroke:m,strokeWidth:1});let S=`${b.name}: ${b.value.toFixed(1)}`;(i==="start"||i==="both")&&p.push({type:"text",content:S,x:f+4,y:y-4,anchor:"start",fontSize:10,fill:u}),(i==="end"||i==="both")&&p.push({type:"text",content:S,x:g-4,y:y-4,anchor:"end",fontSize:10,fill:u}),i==="center"&&p.push({type:"text",content:S,x:(f+g)/2,y:y-4,anchor:"middle",fontSize:10,fill:u});}return p}};var M=class{#e;#t;#n;constructor(e){this.#e=e?.locale||(typeof navigator<"u"?navigator.language:"en-US"),this.#t=e?.fallbackLocales??["en-US"],this.#n=e?.autoFormat??true;}format(e,t,n){try{let r=this.#n&&n?this.#r(e,n,t):t;return A(this.#e,r).format(new Date(e))}catch{for(let r of this.#t)try{return A(r,t).format(new Date(e))}catch{}return new Date(e).toISOString()}}formatRange(e,t){let n=this.format(e),r=this.format(t);return `${n} \u2014 ${r}`}#r(e,t,n){let r=Math.abs(e-t),o=864e5,l=36e5,s=6e4,i={};return r<s?(i.second="2-digit",i.minute="2-digit",i.hour="2-digit"):r<l?(i.minute="2-digit",i.hour="2-digit"):r<o?(i.hour="2-digit",i.minute="2-digit"):r<7*o?(i.weekday="short",i.day="numeric"):r<365*o?(i.month="short",i.day="numeric"):(i.month="short",i.year="numeric"),{...n,...i}}};var _=class a{#e;#t;_compact;#n;constructor(e){this.#e=e?.unit??"",this.#t=e?.decimals??1,this._compact=e?.compact??false,this.#n=e?.custom;}format(e){if(this.#n)return this.#n(e);let t;return this._compact&&Math.abs(e)>=1e6?t=`${(e/1e6).toFixed(this.#t)}M`:this._compact&&Math.abs(e)>=1e3?t=`${(e/1e3).toFixed(this.#t)}k`:t=e.toFixed(this.#t),this.#e?`${t}${this.#e}`:t}formatRange(e,t){return `${this.format(e)} \u2014 ${this.format(t)}`}static unit(e,t=1){return new a({unit:e,decimals:t})}static temperature(e="\xB0C"){return new a({unit:e,decimals:1})}static percentage(){return new a({unit:"%",decimals:0})}};var $=class a{#e;#t;#n;constructor(e){this.#e=e?.map??{},this.#t=e?.fallback??(t=>String(t)),this.#n=e?.showValue??false;}format(e){let t=this.#e[e]??this.#t(e);return this.#n?`(${e}) ${t}`:t}has(e){return e in this.#e}labels(){return Object.values(this.#e)}values(){return Object.keys(this.#e).map(Number)}static fromLabels(e,t=false){let n={};return e.forEach((r,o)=>{n[o]=r;}),new a({map:n,showValue:t})}};var Ye={time:new M,value:new _,enum:new $};function le(a,e){let t=C();return {color:a.color??t.stroke,width:a.width??t.strokeWidth,style:a.style??"solid",smoothing:a.smoothing??false,shape:a.shape??(e.seriesType==="step"?"step":"line"),gapThreshold:a.gapThreshold??t.gapThreshold,opacity:a.opacity??1}}function fe(a){let e=a.style?.line;return e===false?[]:e===void 0?[le({},a)]:Array.isArray(e)?e.map(t=>le(t,a)):[le(e,a)]}function ge(a){let e=a.style?.markers;if(!e?.type||e.type==="none")return;let t=C(),r=(a.style?.line&&!Array.isArray(a.style.line)?a.style.line.color:void 0)??t.stroke;return {type:e.type,size:e.size??t.pointSize,stroke:e.stroke??r,fill:e.fill??"#ffffff",strokeWidth:e.strokeWidth??1,threshold:e.threshold}}function ye(a){let e=a.style?.shadow;if(!(!e?.color||e.color==="transparent"||e.color==="none"))return {color:e.color,blur:e.blur??4,offsetX:e.offsetX??0,offsetY:e.offsetY??0}}function be(a){return a.style?.gap}function xe(a){return a.style?.fill}function Xe(a){return {lines:fe(a),fill:xe(a),markers:ge(a),shadow:ye(a),gap:be(a),id:a.style?.id??a.id}}/*!
27
+ </clipPath>`}get regions(){return [...this.#e]}};var I={axisColor:h.axisColor,tickColor:h.tickColor,textColor:h.textColor,textSize:h.textSize},j=class{#e;#t;constructor(e){this.#e=new R({domain:e.domain,range:e.xRange,locale:e.locale}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??I).axisColor}get tickColor(){return (this.#t.colors??I).tickColor}get textColor(){return (this.#t.colors??I).textColor}get textSize(){return (this.#t.colors??I).textSize}generateTicks(){let e=this.#t.minTicks??5,t=this.#t.maxTicks??12,r=this.#e.ticks({minTicks:e,maxTicks:t}).map(o=>({time:o,x:this.#e.map(o),label:this.tickLabel(o)}));return this.antiOverlap(r)}tickLabel(e){if(this.#t.format)return this.#t.format(new Date(e));let t=this.#t.minTicks??5,n=this.#t.maxTicks??12,{interval:r}=this.#e.tickInterval((t+n)/2,t,n),o={};return r<6e4?(o.hour="2-digit",o.minute="2-digit",o.second="2-digit"):r<36e5||r<864e5?(o.hour="2-digit",o.minute="2-digit"):r<31536e6?(o.day="numeric",o.month="short",r>=2592e6&&(o.day=void 0,o.month="long")):(o.year="numeric",r<2*31536e6&&(o.month="short")),this.#e.format(e,o)}antiOverlap(e){if(e.length<=1)return e;let t=60,n=[e[0]];for(let r=1;r<e.length;r++){let o=n[n.length-1].x;Math.abs(e[r].x-o)>=t&&n.push(e[r]);}return n}render(){let e=this.generateTicks(),t=this.#t.colors??I,n=this.#t.y??0,r=[],[o,s]=this.#e.range();r.push({type:"line",x1:o,y1:n,x2:s,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let l of e)r.push({type:"line",x1:l.x,y1:n,x2:l.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),r.push({type:"text",content:l.label,x:l.x,y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return r}};var B={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function ze(a){return Math.abs(a)>=1e6?`${(a/1e6).toFixed(1)}M`:Math.abs(a)>=1e3?`${(a/1e3).toFixed(1)}k`:Number.isInteger(a)?String(a):a.toFixed(1)}function Ge(a){let e=new Array(a.length).fill(false),t=0;for(;t<a.length;){let n=t;for(;n+1<a.length&&a[n+1].label===a[t].label;)n++;for(let r=t+1;r<n;r++)e[r]=true;t=n+1;}return e}var Q=class{#e;#t;constructor(e){this.#e=new M({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??B).axisColor}get tickColor(){return (this.#t.colors??B).tickColor}get textColor(){return (this.#t.colors??B).textColor}get textSize(){return (this.#t.colors??B).textSize}generateTicks(){let e=this.#t.format??ze,t=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[n,r]=this.#e.domain(),o=Math.min(n,r),s=Math.max(n,r),l=s-o;if(l===0)return [{value:n,position:this.#e.map(n),label:e(n)}];let i=l/t,m=Math.pow(10,Math.floor(Math.log10(i))),u=i/m,c;if(u<=1.5?c=m:u<=3?c=2*m:u<=7?c=5*m:c=10*m,c<=0||!Number.isFinite(c))return [{value:n,position:this.#e.map(n),label:e(n)}];let d=[],p=Math.ceil(o/c)*c;for(let f=p;f<=s;f+=c)d.push({value:f,position:this.#e.map(f),label:e(f)});return d}render(){let e=this.generateTicks(),t=this.#t.colors??B,n=this.#t.x??0,r=this.#t.orientation??"vertical",o=this.#t.position??"left",s=this.#t.suppressLabelsNear??[],l=this.#t.suppressTolerancePx??8,i=u=>s.some(c=>Math.abs(c-u)<=l),m=[];if(r==="vertical"){let[u,c]=this.#e.range();m.push({type:"line",x1:n,y1:u,x2:n,y2:c,stroke:t.axisColor,strokeWidth:t.axisWidth});let d=Ge(e);e.forEach((p,f)=>{let g=i(p.position),b=d[f]?{opacity:0}:{};o==="left"?(m.push({type:"line",x1:n-4,y1:p.position,x2:n,y2:p.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:p.label,x:n-8,y:p.position+4,anchor:"end",fontSize:11,fill:t.textColor,...b})):(m.push({type:"line",x1:n,y1:p.position,x2:n+4,y2:p.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:p.label,x:n+8,y:p.position+4,anchor:"start",fontSize:11,fill:t.textColor,...b}));});}else {let[u,c]=this.#e.range();m.push({type:"line",x1:u,y1:n,x2:c,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let d of e)m.push({type:"line",x1:d.position,y1:n,x2:d.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),m.push({type:"text",content:d.label,x:d.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}return m}};var ee=class{#e;#t;#n;constructor(e){let t=Object.keys(e.enumMap).map(Number).sort((n,r)=>n-r).map(String);this.#t=t,this.#e=new O({domain:t,range:e.range}),this.#n=e;}get scale(){return this.#e}generateTicks(){let{enumMap:e,showLabels:t=true,autoColor:n=true,gapValues:r}=this.#n,o=new Set(r??[]);return this.#t.map((s,l)=>{let i=Number(s),m=t?e[i]??String(i):String(i),u=this.#e.map(i),c=n?h.palette[l%h.palette.length]:void 0;return {value:i,label:m,y:u,color:c,isGap:o.has(i)}})}colorFor(e){let t=this.#t.indexOf(String(e));if(!(t===-1||!(this.#n.autoColor??true)))return h.palette[t%h.palette.length]}render(){let e=this.generateTicks(),t=this.#n.x??0,n=[];for(let r of e)r.isGap||n.push({type:"text",content:r.label,x:t,y:r.y+4,anchor:"end",fontSize:11,fill:r.color??h.textColor});return n}map(e){return this.#e.map(e)}isGap(e){return new Set(this.#n.gapValues??[]).has(e)}};var v=class a{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++a.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var te=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale;return this.data.filter(t=>t.value!==null).map(t=>({x:this.timeScale.map(t.time),y:e.map(t.value),time:t.time})).sort((t,n)=>t.x-n.x)}render(){let e=this.#e,t={smoothing:e.smoothing??false,stroke:e.stroke??h.stroke,strokeWidth:e.strokeWidth??h.strokeWidth,dashed:e.dashed??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??h.pointSize,shadowColor:e.shadowColor,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY},n=e.pointThreshold??h.pointThreshold,r=e.gapThreshold??h.gapThreshold,o=e.id,s=S.getRuns(this.data,c=>c.value===null,r),l=s.reduce((c,d)=>c+d.length,0);if(l===0)return [];let i={timeScale:this.timeScale,valueScale:e.valueScale},m=s.map(c=>({data:c})),u=[];if(u.push(...w(m,i,{...t,id:o?`${o}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&l<=n)for(let c of s)u.push(...W(c,i,{...t,id:o?`${o}-marker`:void 0},()=>t.stroke));return u}};var ne=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale,t=[...this.data].filter(r=>r.value!==null).sort((r,o)=>r.time-o.time),n=[];for(let r=0;r<t.length;r++){let o=this.timeScale.map(t[r].time),s=e.map(t[r].value);r===0?n.push({x:o,y:s}):n.push({x:o,y:n[n.length-1].y},{x:o,y:s});}return n}render(){let e=S.getRuns(this.data,r=>r.value===null);if(e.length===0)return [];let t={timeScale:this.timeScale,valueScale:this.#e.valueScale},n=e.map(r=>({data:r}));return G(n,t,{stroke:this.#e.stroke??h.stroke,strokeWidth:this.#e.strokeWidth??h.strokeWidth,id:this.id?`${this.id}-line`:void 0})}};var re=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}opacity(e){if(!(this.#e.countOpacity??false))return .6;let t=0;for(let n of this.data)n.count>t&&(t=n.count);return t===0?.2:.2+.8*e/t}render(){let e=this.#e,t=e.fill??h.bandFill,n=e.hatch,r=e.avgLine??false,o=e.avgLineColor??h.bandAvgLine,s=e.bandWidth??10,l=[];for(let i of this.data){if(i.min===null||i.max===null)continue;let m=this.timeScale.map(i.time),u=e.valueScale.map(i.max),c=e.valueScale.map(i.min),d=s,p=this.data.indexOf(i);if(l.push({type:"rect",x:m-d/2,y:u,w:d,h:c-u,fill:t,hatch:n,opacity:this.opacity(i.count),id:this.id?`${this.id}-slot-${p}`:void 0}),r&&i.avg!==null){let f=e.valueScale.map(i.avg);l.push({type:"line",x1:m-d/2,y1:f,x2:m+d/2,y2:f,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${p}`:void 0});}}return l}};var oe=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??h.minColor,n=e.maxColor??h.maxColor,r=e.avgColor??h.avgColor,o=e.avgDashed??true,s=e.smoothing??false,l=e.strokeWidth??h.strokeWidth,i=S.getRuns(this.data,p=>p.min===null||p.max===null||p.avg===null);if(i.length===0)return [];let m={timeScale:this.timeScale,valueScale:e.valueScale},u=[];i.forEach((p,f)=>{p.length<2||(e.fillToMax&&u.push(...N(p,m,{boundaries:[],yLow:g=>g.avg,yHigh:g=>g.max,getValue:g=>g.avg,interpolate:S.interpolateAggregatedPoint,getColor:()=>e.fillToMax,getHatch:()=>e.fillToMaxHatch},{id:this.id?`${this.id}-fillToMax-${f}`:void 0})),e.fillToMin&&u.push(...N(p,m,{boundaries:[],yLow:g=>g.avg,yHigh:g=>g.min,getValue:g=>g.avg,interpolate:S.interpolateAggregatedPoint,getColor:()=>e.fillToMin,getHatch:()=>e.fillToMinHatch},{id:this.id?`${this.id}-fillToMin-${f}`:void 0})));});let c=i.filter(p=>p.length>=2),d=p=>c.map(f=>({data:f.map(g=>({time:g.time,value:p(g)}))}));return u.push(...w(d(p=>p.max),m,{stroke:n,strokeWidth:l,smoothing:s,id:this.id?`${this.id}-max`:void 0}),...w(d(p=>p.min),m,{stroke:t,strokeWidth:l,smoothing:s,id:this.id?`${this.id}-min`:void 0}),...w(d(p=>p.avg),m,{stroke:r,strokeWidth:l,smoothing:s,dashed:o,id:this.id?`${this.id}-avg`:void 0})),u}};var ie=class extends v{#e;#t;constructor(e){super(e,e.data),this.#e=e,this.#t=[...e.zones??[]].sort((t,n)=>t.value-n.value);}#n(e){return e===0?this.#e.baseColor??h.stroke:this.#t[e-1].color}render(){let e=this.#e,t=e.baseColor??h.stroke,n={stroke:t,strokeWidth:e.strokeWidth??h.strokeWidth,smoothing:e.smoothing??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??h.pointSize},r=e.gapThreshold??h.gapThreshold,o=e.pointThreshold??h.pointThreshold,s=S.getRuns(this.data,u=>u.value===null,r),l=s.reduce((u,c)=>u+c.length,0);if(l===0)return [];let i={timeScale:this.timeScale,valueScale:e.valueScale},m=[];for(let u of s){if(u.length<2)continue;if(e.fill){let f=e.fill.value,g=S.splitByBoundaries(u,[f],y=>y.value,S.interpolateDataPoint),b=e.valueScale.map(f);for(let y=0;y<g.length;y++){let x=g[y];if(x.data.length<2)continue;let C=x.zoneIndex>0;if(e.fill.side==="above"===C){let L=x.data.map(P=>({x:this.timeScale.map(P.time),y:e.valueScale.map(P.value)}));m.push({type:"path",id:this.id?`${this.id}-fill-${y}`:void 0,points:[...L,{x:L[L.length-1].x,y:b},{x:L[0].x,y:b}],fill:e.fill.color,hatch:e.fill.hatch,stroke:"none"});}}}let c=this.#t.map(f=>f.value),p=S.splitByBoundaries(u,c,f=>f.value,S.interpolateDataPoint).map(f=>({data:f.data,color:this.#n(f.zoneIndex)}));m.push(...w(p,i,{...n,id:this.id?`${this.id}-line`:void 0})),n.pointStyle&&n.pointStyle!=="none"&&l<=o&&m.push(...W(u,i,{...n,id:this.id?`${this.id}-marker`:void 0},f=>{let g=t;for(let b of this.#t)f.value>=b.value&&(g=b.color);return g}));}return m}};var Ye=1,ae=class{#e;constructor(e,t,n,r){this.#e={...e,xRange:t,y:n,height:r};}render(){let{items:e,timeScale:t,background:n,hatch:r,showAxis:o,xRange:s,y:l,height:i}=this.#e,m=[];n&&m.push({type:"rect",x:s[0],y:l,w:s[1]-s[0],h:i,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let u of e){let c=t.map(u.startTime),d=t.map(u.endTime);if(d<s[0]||c>s[1])continue;let p=Math.max(s[0],Math.min(s[1],c)),f=Math.max(s[0],Math.min(s[1],d)),g=Math.max(f-p,Ye);p+g>s[1]&&(p=Math.max(s[0],s[1]-g));let b=p+g/2;if(m.push({type:"rect",x:p,y:l,w:g,h:i,hatch:u.hatch??r,fill:u.fill??"#6b728044",stroke:u.stroke,strokeWidth:u.strokeWidth??0,title:u.title}),u.label){let y=u.labelFontSize??10;m.push({type:"text",content:u.label,x:b,y:this.#t(u.labelBaseline,y),anchor:"middle",fontSize:y,fill:u.labelFill??"#333"});}}if(o){let u=new j({domain:t.domain(),xRange:s,y:l+i+4});m.push({type:"group",cssClass:"annotation-band-axis",commands:u.render()});}return m}#t(e,t){let{y:n,height:r}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+r-t*.25;default:return n+r/2+t*.35}}};var se=class{#e;constructor(e){this.#e=e;}render(){let{data:e,valueScale:t,xRange:n,showMin:r=false,showMax:o=false,showAvg:s=true,showMedian:l=false,labelPosition:i="end",lineColor:m=h.statsLineColor,labelColor:u=h.statsLabelColor}=this.#e,c=ce.compute(e),d=[{name:"min",value:c.min,enabled:r},{name:"max",value:c.max,enabled:o},{name:"avg",value:c.avg,enabled:s},{name:"median",value:c.median,enabled:l}],p=[],[f,g]=n;for(let b of d.filter(y=>y.enabled)){let y=t.map(b.value);p.push({type:"line",x1:f,y1:y,x2:g,y2:y,stroke:m,strokeWidth:1});let x=`${b.name}: ${b.value.toFixed(1)}`;(i==="start"||i==="both")&&p.push({type:"text",content:x,x:f+4,y:y-4,anchor:"start",fontSize:10,fill:u}),(i==="end"||i==="both")&&p.push({type:"text",content:x,x:g-4,y:y-4,anchor:"end",fontSize:10,fill:u}),i==="center"&&p.push({type:"text",content:x,x:(f+g)/2,y:y-4,anchor:"middle",fontSize:10,fill:u});}return p}};var _=class{#e;#t;#n;constructor(e){this.#e=e?.locale||(typeof navigator<"u"?navigator.language:"en-US"),this.#t=e?.fallbackLocales??["en-US"],this.#n=e?.autoFormat??true;}format(e,t,n){try{let r=this.#n&&n?this.#r(e,n,t):t;return A(this.#e,r).format(new Date(e))}catch{for(let r of this.#t)try{return A(r,t).format(new Date(e))}catch{}return new Date(e).toISOString()}}formatRange(e,t){let n=this.format(e),r=this.format(t);return `${n} \u2014 ${r}`}#r(e,t,n){let r=Math.abs(e-t),o=864e5,s=36e5,l=6e4,i={};return r<l?(i.second="2-digit",i.minute="2-digit",i.hour="2-digit"):r<s?(i.minute="2-digit",i.hour="2-digit"):r<o?(i.hour="2-digit",i.minute="2-digit"):r<7*o?(i.weekday="short",i.day="numeric"):r<365*o?(i.month="short",i.day="numeric"):(i.month="short",i.year="numeric"),{...n,...i}}};var $=class a{#e;#t;_compact;#n;constructor(e){this.#e=e?.unit??"",this.#t=e?.decimals??1,this._compact=e?.compact??false,this.#n=e?.custom;}format(e){if(this.#n)return this.#n(e);let t;return this._compact&&Math.abs(e)>=1e6?t=`${(e/1e6).toFixed(this.#t)}M`:this._compact&&Math.abs(e)>=1e3?t=`${(e/1e3).toFixed(this.#t)}k`:t=e.toFixed(this.#t),this.#e?`${t}${this.#e}`:t}formatRange(e,t){return `${this.format(e)} \u2014 ${this.format(t)}`}static unit(e,t=1){return new a({unit:e,decimals:t})}static temperature(e="\xB0C"){return new a({unit:e,decimals:1})}static percentage(){return new a({unit:"%",decimals:0})}};var F=class a{#e;#t;#n;constructor(e){this.#e=e?.map??{},this.#t=e?.fallback??(t=>String(t)),this.#n=e?.showValue??false;}format(e){let t=this.#e[e]??this.#t(e);return this.#n?`(${e}) ${t}`:t}has(e){return e in this.#e}labels(){return Object.values(this.#e)}values(){return Object.keys(this.#e).map(Number)}static fromLabels(e,t=false){let n={};return e.forEach((r,o)=>{n[o]=r;}),new a({map:n,showValue:t})}};var Xe={time:new _,value:new $,enum:new F};function le(a,e){let t=T();return {color:a.color??t.stroke,width:a.width??t.strokeWidth,style:a.style??"solid",smoothing:a.smoothing??false,shape:a.shape??(e.seriesType==="step"?"step":"line"),gapThreshold:a.gapThreshold??t.gapThreshold,opacity:a.opacity??1}}function fe(a){let e=a.style?.line;return e===false?[]:e===void 0?[le({},a)]:Array.isArray(e)?e.map(t=>le(t,a)):[le(e,a)]}function ge(a){let e=a.style?.markers;if(!e?.type||e.type==="none")return;let t=T(),r=(a.style?.line&&!Array.isArray(a.style.line)?a.style.line.color:void 0)??t.stroke;return {type:e.type,size:e.size??t.pointSize,stroke:e.stroke??r,fill:e.fill??"#ffffff",strokeWidth:e.strokeWidth??1,threshold:e.threshold}}function ye(a){let e=a.style?.shadow;if(!(!e?.color||e.color==="transparent"||e.color==="none"))return {color:e.color,blur:e.blur??4,offsetX:e.offsetX??0,offsetY:e.offsetY??0}}function be(a){return a.style?.gap}function xe(a){return a.style?.fill}function Ze(a){return {lines:fe(a),fill:xe(a),markers:ge(a),shadow:ye(a),gap:be(a),id:a.style?.id??a.id}}/*!
28
28
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
29
29
  * MIT with Attribution: free use incl. commercial requires visible credit to
30
30
  * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
@@ -43,4 +43,4 @@ var G=class{};var x=class{static interpolateDataPoint(a,e,t){return {time:a.time
43
43
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
44
44
  * MIT with Attribution: free use incl. commercial must have visible credit to
45
45
  * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
46
- */export{ae as AnnotationBandSeries,O as BandScale,re as BandSeries,J as Clip,ee as EnumAxis,$ as EnumFormatter,Ye as Formatters,K as Layout,te as LineSeries,D as LinearScale,oe as MinMaxAvgSeries,G as Renderer,se as StatsOverlay,ne as StepSeries,k as TIME_INTERVALS,I as TimeAxis,M as TimeFormatter,R as TimeScale,Q as ValueAxis,_ as ValueFormatter,ie as ZonedLineSeries,he as getHatch,$e as measureLegend,Ne as renderAnnotations,De as renderArea,Ie as renderGaps,Pe as renderGrid,Ve as renderHighlights,Fe as renderLegend,w as renderLine,He as renderMarkers,W as renderSeriesMarkers,Me as renderSplitLine,z as renderStep,Oe as renderThresholds,V as renderZonedArea,xe as resolveFill,be as resolveGap,fe as resolveLines,ge as resolveMarkers,Xe as resolveSeriesStyle,ye as resolveShadow,q as slugify,h as theme};
46
+ */export{ae as AnnotationBandSeries,O as BandScale,re as BandSeries,J as Clip,ee as EnumAxis,F as EnumFormatter,Xe as Formatters,K as Layout,te as LineSeries,M as LinearScale,oe as MinMaxAvgSeries,z as Renderer,se as StatsOverlay,ne as StepSeries,k as TIME_INTERVALS,j as TimeAxis,_ as TimeFormatter,R as TimeScale,Q as ValueAxis,$ as ValueFormatter,ie as ZonedLineSeries,he as getHatch,$e as measureLegend,Ee as renderAnnotations,De as renderArea,je as renderGaps,Pe as renderGrid,Ne as renderHighlights,Fe as renderLegend,w as renderLine,He as renderMarkers,W as renderSeriesMarkers,Me as renderSplitLine,G as renderStep,Oe as renderThresholds,N as renderZonedArea,xe as resolveFill,be as resolveGap,fe as resolveLines,ge as resolveMarkers,Ze as resolveSeriesStyle,ye as resolveShadow,q as slugify,h as theme};
@@ -131,6 +131,12 @@ interface DrawRect extends DrawEffects {
131
131
  dashed?: boolean;
132
132
  /** Optional SVG `id` attribute for this element. */
133
133
  id?: string;
134
+ /**
135
+ * Hover tooltip / accessible name. Becomes a `<title>` child of the element, which
136
+ * browsers show on hover and screen readers announce. Output formats without that
137
+ * concept (PDF, raster) ignore it — a chart must not depend on it to be readable.
138
+ */
139
+ title?: string;
134
140
  }
135
141
  interface DrawCircle extends DrawEffects {
136
142
  type: "circle";
@@ -367,6 +373,8 @@ interface GapsConfig {
367
373
  */
368
374
 
369
375
  /** Line styling for a series. All fields optional; defaults come from the theme. */
376
+ /** Linienform: gerade Strecken oder Treppe. */
377
+ type LineShape = "line" | "step";
370
378
  interface LineStyle {
371
379
  /** Stroke colour. */
372
380
  color?: string;
@@ -376,8 +384,15 @@ interface LineStyle {
376
384
  style?: LineVariant;
377
385
  /** Catmull-Rom smoothing. */
378
386
  smoothing?: boolean;
379
- /** Line shape — `line` (Default) or `step` (Treppe). */
380
- shape?: "line" | "step";
387
+ /**
388
+ * Line shape — `line` (Default) or `step` (Treppe).
389
+ *
390
+ * In der Array-Form gilt die Angabe je Eintrag: Der erste kann die Treppe
391
+ * sein, der zweite die geglaettete Trendlinie durch dieselben Daten. Die
392
+ * Form des ERSTEN Eintrags ist zugleich die der Serie -- Flaeche, Zonen und
393
+ * Marker richten sich nach ihr.
394
+ */
395
+ shape?: LineShape;
381
396
  /** Max time gap (ms) between samples before the line breaks; 0 = off. */
382
397
  gapThreshold?: number;
383
398
  /** Opacity 0..1 (e.g. for overlaid lines). */
@@ -495,8 +510,6 @@ interface DataPoint {
495
510
  * Renderer consequences: no point marker, no tooltip snap, no entry in the
496
511
  * value table. Scales (Y min/max) still count the point, otherwise the line
497
512
  * geometry would be distorted. Defaults to `undefined` = real measurement.
498
- *
499
- * See API_DESIGN.md §4.1.
500
513
  */
501
514
  synthetic?: boolean;
502
515
  }
@@ -526,7 +539,7 @@ interface TimeSeries {
526
539
  sensorType?: SensorType;
527
540
  enumMap?: EnumMap;
528
541
  /**
529
- * Structured style block (preferred, see API_DESIGN.md §5).
542
+ * Structured style block (preferred, see USAGE.md, "Series").
530
543
  * The structured style block. Its sub-objects (`line`, `fill`, `markers`,
531
544
  * `shadow`, `gap`) are merged with theme defaults by the chart's resolver.
532
545
  */
@@ -534,7 +547,7 @@ interface TimeSeries {
534
547
  /**
535
548
  * Statistic overlays computed at render time from this series' data.
536
549
  * Each overlay carries its own style and appears in the legend.
537
- * See API_DESIGN.md §11.
550
+ * See USAGE.md, "Statistic overlays".
538
551
  */
539
552
  overlays?: SeriesOverlay[];
540
553
  yAxisIndex?: number;
@@ -560,7 +573,7 @@ interface AggregatedSeries {
560
573
  * for now — the new `style.fill.regions[]` form covers them and arrives in 2.9.
561
574
  */
562
575
  style?: SeriesStyle;
563
- /** Statistic overlays — see API_DESIGN.md §11. */
576
+ /** Statistic overlays — see USAGE.md, "Statistic overlays". */
564
577
  overlays?: SeriesOverlay[];
565
578
  minColor?: string;
566
579
  maxColor?: string;
@@ -755,6 +768,14 @@ interface AnnotationBandItem {
755
768
  * Label vertical position: 'top', 'middle' (default), or 'bottom' inside the band.
756
769
  */
757
770
  labelBaseline?: "top" | "middle" | "bottom";
771
+ /**
772
+ * Hover tooltip of the segment (SVG `<title>`). Use it for the detail that does not
773
+ * fit as a printed label — the full event id, exact times, a duration.
774
+ *
775
+ * INTERACTIVE ONLY: print and raster output drop it, so never put there what the
776
+ * reader must see.
777
+ */
778
+ title?: string;
758
779
  }
759
780
  /**
760
781
  * Configuration for an annotation band — a horizontal strip below the main chart
@@ -1,4 +1,4 @@
1
- import { D as DrawCommand, L as LineVariant, P as PointStyleType, a4 as DrawGroup, j as AggregatedPoint, d as TimeScale, e as LinearScale, l as DataPoint } from './scale-ByGpczxS.js';
1
+ import { D as DrawCommand, L as LineVariant, P as PointStyleType, a4 as DrawGroup, j as AggregatedPoint, d as TimeScale, e as LinearScale, l as DataPoint } from './scale-D6NtEaUB.js';
2
2
 
3
3
  /** Output format type for the renderer (SVG string, Canvas, or nothing). */
4
4
  type RenderType = "svg" | "canvas" | "none";
@@ -240,7 +240,7 @@ interface Marker {
240
240
  label?: string;
241
241
  color?: string;
242
242
  pointStyle?: PointStyleType;
243
- lineStyle?: "full" | "to-value" | "to-top";
243
+ lineStyle?: "full" | "to-value" | "to-top" | "none";
244
244
  seriesIndex?: number;
245
245
  }
246
246
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ml-time-graph",
3
- "version": "1.5.1",
3
+ "version": "1.7.0",
4
4
  "description": "TypeScript library for time-series chart rendering — DOM-free SVG output (works in the browser and on the server).",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -31,7 +31,9 @@
31
31
  "README.md",
32
32
  "README.de.md",
33
33
  "USAGE.md",
34
- "API_DESIGN.md",
34
+ "QUICKSTART_GRAPH_BUILDER.md",
35
+ "QUICKSTART_GRAPH_BUILDER.de.md",
36
+ "GRAPH_JSON_STRUCTURE.md",
35
37
  "LICENSE"
36
38
  ],
37
39
  "scripts": {