ml-time-graph 1.12.1 → 1.13.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/CHANGELOG.md +52 -0
- package/SKILLS.md +5 -0
- package/USAGE.md +11 -4
- package/dist/analyze/index.d.ts +23 -1
- package/dist/analyze/index.js +2 -2
- package/dist/index.d.ts +15 -25
- package/dist/index.js +39 -36
- package/dist/interaction/index.d.ts +1 -1
- package/dist/internals.d.ts +5 -62
- package/dist/internals.js +21 -21
- package/dist/{marker_renderer-D5TfGx8R.d.ts → marker_renderer-C5rNViFi.d.ts} +57 -54
- package/dist/{scale-BStQU_t-.d.ts → scale-CDPJGYpZ.d.ts} +21 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,46 +1,49 @@
|
|
|
1
|
-
var
|
|
2
|
-
<pattern id="${
|
|
1
|
+
function U(n){return n===true?{major:{}}:n===false?{major:false}:n}var se=class n{_config;constructor(e){this._config=e;}compute(){let{width:e,height:t,margin:r}=this._config;return {totalWidth:e,totalHeight:t,chartWidth:e-r.left-r.right,chartHeight:t-r.top-r.bottom,chartX:r.left,chartY:r.top,margin:r}}static default(e=800,t=400){return new n({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};function z(n){return n&&n.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}var Zt=(()=>{let n=new Array(256);for(let e=0;e<256;e++){let t=e;for(let r=0;r<8;r++)t=t&1?3988292384^t>>>1:t>>>1;n[e]=t>>>0;}return n})();function Fe(n){let e=new TextEncoder().encode(n),t=4294967295;for(let r of e)t=Zt[(t^r)&255]^t>>>8;return (t^4294967295)>>>0}function H(n,e){return e||"s-"+Fe(n??"").toString(16).padStart(8,"0")}var Ze=new Map;function Kt(n,e){return `${n}|${JSON.stringify(e??{})}`}function Ke(n,e){let t=Kt(n,e),r=Ze.get(t);return r||(r=new Intl.DateTimeFormat(n,e),Ze.set(t,r)),r}var Z=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[r,i]=this.#e,[o,s]=this.#t;return i===r?o:o+(t-r)/(i-r)*(s-o)}invert(e){let[t,r]=this.#e,[i,o]=this.#t;return o===i?t:t+(e-i)/(o-i)*(r-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},W=[{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}],J=class{#e;#t;#n;constructor(e){this.#e=new Z({domain:e.domain,range:e.range}),this.#t=e.locale||(typeof navigator<"u"?navigator.language:"en-US"),this.#n=e.timeZone;}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 timeZone(){return this.#n}get locale(){return this.#t}tickInterval(e,t=3,r=12){let[i,o]=this.#e.domain(),s=o-i;if(s<=0)return {interval:W[0].ms};let a=s/e,m=W[0].ms;for(let u of W)if(u.ms>=a){m=u.ms;break}let l=m,h=Math.round(s/l);for(;h>r&&l<W[W.length-1].ms;){let u=W.findIndex(c=>c.ms===l);l=W[Math.min(u+1,W.length-1)].ms,h=Math.round(s/l);}for(;h<t&&l>W[0].ms;){let u=W.findIndex(c=>c.ms===l);l=W[Math.max(u-1,0)].ms,h=Math.round(s/l);}return {interval:l}}ticks(e){let t=e?.minTicks??5,r=e?.maxTicks??12,{interval:i}=this.tickInterval((t+r)/2,t,r),[o,s]=this.#e.domain(),a=[],m=Math.ceil(o/i)*i;for(let l=m;l<=s;l+=i)a.push(l);return a}format(e,t){let r=this.#n?{...t,timeZone:this.#n}:t;return Ke(this.#t,r).format(new Date(e))}};var Ie={fontFamily:"Liberation Sans, Arial, Helvetica, sans-serif",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,markerFontSize:11,statFontSize:10,tooltipTimeFontSize:10,tooltipValueFontSize: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 ue={...Ie};function qt(n){ue={...ue,...n};}function Q(){return ue}function Jt(){ue={...Ie};}function Qt(n){let e=n.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 r=e.slice(5,e.lastIndexOf(")")).split(",");if(r.length===4)return `rgb(${r[0].trim()}, ${r[1].trim()}, ${r[2].trim()})`}return e}function en(n){let e=n.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function ce(n,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",r,i=2){let o=Qt(t),s=en(t)?"":' fill-opacity="0.3"';if(e==="none")return `
|
|
2
|
+
<pattern id="${n}" width="10" height="10" patternUnits="userSpaceOnUse">
|
|
3
3
|
<rect width="10" height="10" fill="${t}" />
|
|
4
4
|
</pattern>
|
|
5
|
-
`.trim();let a=12,
|
|
6
|
-
<line x1="0" y1="0" x2="0" y2="${
|
|
7
|
-
<line x1="0" y1="0" x2="${a}" y2="0" stroke="${o}" stroke-width="${
|
|
8
|
-
`;break;case "dots":
|
|
9
|
-
<path d="M 0 ${
|
|
10
|
-
`;break;case "dashed":
|
|
11
|
-
<path d="M 0 0 L ${a/2} ${
|
|
12
|
-
`;break;case "brick":a=20,
|
|
13
|
-
<path d="M 0 ${
|
|
14
|
-
`;break;case "double-stripe":a=16,
|
|
15
|
-
<line x1="0" y1="0" x2="0" y2="${
|
|
16
|
-
<line x1="${a/2}" y1="0" x2="${a/2}" y2="${
|
|
17
|
-
`;break;case "honeycomb":a=18,
|
|
18
|
-
<path d="M 0 0 L ${a/2} 5 L ${a} 0 M 0 16 L ${a/2} 11 L ${a} 16 M 0 16 L 0 32 M ${a/2} 5 L ${a/2} 11 M ${a} 16 L ${a} 32 M 0 32 L ${a/2} 27 L ${a} 32 M ${a/2} 27 L ${a/2} 32" fill="none" stroke="${o}" stroke-width="${
|
|
19
|
-
`;break}let u=`<rect width="${a}" height="${
|
|
20
|
-
<pattern id="${
|
|
5
|
+
`.trim();let a=12,m=12,l="rotate(0)",h="";switch(e){case "classic-diagonal":l="rotate(45)",h=`<line x1="0" y1="0" x2="0" y2="${m}" stroke="${o}" stroke-width="${i}" stroke-linecap="square" />`;break;case "dense-steep":a=6,m=6,l="rotate(30)",h=`<line x1="0" y1="0" x2="0" y2="${m}" stroke="${o}" stroke-width="${i}" stroke-linecap="square" />`;break;case "crosshatch":a=14,m=14,l="rotate(45)",h=`
|
|
6
|
+
<line x1="0" y1="0" x2="0" y2="${m}" stroke="${o}" stroke-width="${i}" stroke-linecap="square" />
|
|
7
|
+
<line x1="0" y1="0" x2="${a}" y2="0" stroke="${o}" stroke-width="${i}" stroke-linecap="square" />
|
|
8
|
+
`;break;case "dots":h=`<circle cx="${a/2}" cy="${m/2}" r="${i*1.2}" fill="${o}" />`;break;case "waves":a=16,m=16,h=`
|
|
9
|
+
<path d="M 0 ${m/2} Q ${a/4} 0, ${a/2} ${m/2} T ${a} ${m/2}" fill="none" stroke="${o}" stroke-width="${i}" stroke-linecap="round" />
|
|
10
|
+
`;break;case "dashed":l="rotate(45)",h=`<line x1="0" y1="0" x2="0" y2="${m}" stroke="${o}" stroke-width="${i}" stroke-dasharray="3,3" />`;break;case "herringbone":a=16,m=16,h=`
|
|
11
|
+
<path d="M 0 0 L ${a/2} ${m/2} L 0 ${m} M ${a} 0 L ${a/2} ${m/2} L ${a} ${m}" fill="none" stroke="${o}" stroke-width="${i}" stroke-linejoin="round" stroke-linecap="round" />
|
|
12
|
+
`;break;case "brick":a=20,m=20,h=`
|
|
13
|
+
<path d="M 0 ${m/2} L ${a} ${m/2} M 0 ${m} L ${a} ${m} M ${a/2} 0 L ${a/2} ${m/2} M 0 ${m/2} L 0 ${m}" fill="none" stroke="${o}" stroke-width="${i}" />
|
|
14
|
+
`;break;case "double-stripe":a=16,m=16,l="rotate(45)",h=`
|
|
15
|
+
<line x1="0" y1="0" x2="0" y2="${m}" stroke="${o}" stroke-width="${i}" stroke-linecap="square" />
|
|
16
|
+
<line x1="${a/2}" y1="0" x2="${a/2}" y2="${m}" stroke="${o}" stroke-width="${i/2}" stroke-linecap="square" />
|
|
17
|
+
`;break;case "honeycomb":a=18,m=32,h=`
|
|
18
|
+
<path d="M 0 0 L ${a/2} 5 L ${a} 0 M 0 16 L ${a/2} 11 L ${a} 16 M 0 16 L 0 32 M ${a/2} 5 L ${a/2} 11 M ${a} 16 L ${a} 32 M 0 32 L ${a/2} 27 L ${a} 32 M ${a/2} 27 L ${a/2} 32" fill="none" stroke="${o}" stroke-width="${i}" stroke-linejoin="round" stroke-linecap="round" />
|
|
19
|
+
`;break}let u=`<rect width="${a}" height="${m}" fill="${t}"${s} />`;return `
|
|
20
|
+
<pattern id="${n}" width="${a}" height="${m}" patternTransform="${l}" patternUnits="userSpaceOnUse">
|
|
21
21
|
${u}
|
|
22
|
-
${
|
|
22
|
+
${h}
|
|
23
23
|
</pattern>
|
|
24
|
-
`.trim()}function tt(i,e=2,t=false){return i==="dashed"||!i&&t?{strokeDasharray:"4,4"}:i==="dotted"?{strokeDasharray:"2,4"}:!i||i==="solid"?null:St(i,e)}function St(i,e=2){let t=e;switch(i){case "dotted":return {strokeDasharray:`0, ${t*2}`,strokeLinecap:"round"};case "sparse-dots":return {strokeDasharray:`0, ${t*4}`,strokeLinecap:"round"};case "dashed":return {strokeDasharray:`${t*3}, ${t*2}`,strokeLinecap:"butt"};case "long-dash":return {strokeDasharray:`${t*6}, ${t*3}`,strokeLinecap:"butt"};case "dense-dash":return {strokeDasharray:`${t*1.5}, ${t*1.5}`,strokeLinecap:"butt"};case "dash-dot":return {strokeDasharray:`${t*4}, ${t*2}, 0, ${t*2}`,strokeLinecap:"round"};case "dash-dot-dot":return {strokeDasharray:`${t*5}, ${t*2}, 0, ${t*2}, 0, ${t*2}`,strokeLinecap:"round"};case "loose-dash":return {strokeDasharray:`${t*3}, ${t*4}`,strokeLinecap:"butt"};default:return {strokeDasharray:"none",strokeLinecap:"butt"}}}var y=new Proxy({},{get:(i,e)=>ce()[e],has:(i,e)=>e in ce(),ownKeys:()=>Reflect.ownKeys(ce()),getOwnPropertyDescriptor:(i,e)=>Reflect.getOwnPropertyDescriptor(ce(),e)});function Me(i,e){if(e<=0||i.length<2)return [];let t=[];for(let n=0;n<i.length-1;n++){let r=i[n],o=i[n+1];for(let s=1;s<=e;s++)t.push(r+(o-r)*s/(e+1));}return t}var be={axisColor:y.axisColor,tickColor:y.tickColor,textColor:y.textColor,textSize:y.textSize},de=class{#e;#t;constructor(e){this.#e=new ue({domain:e.domain,range:e.xRange,locale:e.locale,timeZone:e.timeZone}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??be).axisColor}get tickColor(){return (this.#t.colors??be).tickColor}get textColor(){return (this.#t.colors??be).textColor}get textSize(){return (this.#t.colors??be).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??be,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 a of this.generateMinorTicks())r.push({type:"line",x1:a,y1:n,x2:a,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});for(let a of e)r.push({type:"line",x1:a.x,y1:n,x2:a.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),r.push({type:"text",content:a.label,x:this.#n(a.x,a.label,t.textSize),y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return r}generateMinorTicks(){return Me(this.generateTicks().map(e=>e.x),this.#t.minorTicks??0)}#n(e,t,n){let r=this.#t.gesamtbreite,o=this.#t.metrics;if(r===void 0||o===void 0)return e;let s=o(t,n)/2;return Math.max(s+2,Math.min(r-s-2,e))}};var pe={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function _t(i){return Math.abs(i)>=1e6?`${(i/1e6).toFixed(1)}M`:Math.abs(i)>=1e3?`${(i/1e3).toFixed(1)}k`:Number.isInteger(i)?String(i):i.toFixed(1)}function ln(i){let e=new Array(i.length).fill(false),t=0;for(;t<i.length;){let n=t;for(;n+1<i.length&&i[n+1].label===i[t].label;)n++;for(let r=t+1;r<n;r++)e[r]=true;t=n+1;}return e}var Le=class{#e;#t;constructor(e){this.#e=new ae({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??pe).axisColor}get tickColor(){return (this.#t.colors??pe).tickColor}get textColor(){return (this.#t.colors??pe).textColor}get textSize(){return (this.#t.colors??pe).textSize}generateTicks(){let e=this.#t.tickValues;if(e&&e.length>0){let f=this.#t.format??_t;return e.map(p=>({value:p,position:this.#e.map(p),label:f(p)}))}let t=this.#t.format??_t,n=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[r,o]=this.#e.domain(),s=Math.min(r,o),a=Math.max(r,o),l=a-s;if(l===0)return [{value:r,position:this.#e.map(r),label:t(r)}];let h=l/n,m=Math.pow(10,Math.floor(Math.log10(h))),u=h/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:r,position:this.#e.map(r),label:t(r)}];let g=[],d=Math.ceil(s/c)*c;for(let f=d;f<=a;f+=c)g.push({value:f,position:this.#e.map(f),label:t(f)});return g}generateMinorTicks(){return Me(this.generateTicks().map(e=>e.position),this.#t.minorTicks??0)}render(){let e=this.generateTicks(),t=this.#t.colors??pe,n=this.#t.x??0,r=this.#t.orientation??"vertical",o=this.#t.position??"left",s=this.#t.suppressLabelsNear??[],a=this.#t.suppressTolerancePx??8,l=u=>s.some(c=>Math.abs(c-u)<=a),h=[];if(r==="vertical"){let[u,c]=this.#e.range();h.push({type:"line",x1:n,y1:u,x2:n,y2:c,stroke:t.axisColor,strokeWidth:t.axisWidth});let g=ln(e);e.forEach((d,f)=>{let p=l(d.position),S=g[f]?{opacity:0}:{};o==="left"?(h.push({type:"line",x1:n-4,y1:d.position,x2:n,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),p||h.push({type:"text",content:d.label,x:this.#n(n-8,d.label,"end"),y:d.position+4,anchor:"end",fontSize:t.textSize,fill:t.textColor,...S})):(h.push({type:"line",x1:n,y1:d.position,x2:n+4,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),p||h.push({type:"text",content:d.label,x:this.#n(n+8,d.label,"start"),y:d.position+4,anchor:"start",fontSize:t.textSize,fill:t.textColor,...S}));});}else {let[u,c]=this.#e.range();h.push({type:"line",x1:u,y1:n,x2:c,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let g of e)h.push({type:"line",x1:g.position,y1:n,x2:g.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),h.push({type:"text",content:g.label,x:g.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}let m=(this.#t.orientation??"vertical")==="vertical";for(let u of this.generateMinorTicks())h.push(m?{type:"line",x1:o==="right"?n:n-2,y1:u,x2:o==="right"?n+2:n,y2:u,stroke:t.tickColor,strokeWidth:t.axisWidth}:{type:"line",x1:u,y1:n,x2:u,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});return h}#n(e,t,n){let r=this.#t.gesamtbreite,o=this.#t.metrics;if(r===void 0||o===void 0)return e;let s=o(t,(this.#t.colors??pe).textSize);return n==="end"?Math.max(s+2,Math.min(r-2,e)):Math.min(r-s-2,Math.max(2,e))}};var z=class{static interpolateDataPoint(i,e,t){return {time:i.time+Math.round(t*(e.time-i.time)),value:(i.value??0)+t*((e.value??0)-(i.value??0)),synthetic:true}}static interpolateAggregatedPoint(i,e,t){let n=(r,o)=>r!==null&&o!==null?r+t*(o-r):null;return {time:i.time+t*(e.time-i.time),min:n(i.min,e.min),max:n(i.max,e.max),avg:n(i.avg,e.avg),count:Math.round(i.count+t*(e.count-i.count))}}static getRuns(i,e,t=0){let n=[...i].sort((a,l)=>a.time-l.time),r=[],o=[],s=null;for(let a of n){let l=e(a),h=t>0&&s&&a.time-s.time>t;(l||h)&&o.length&&(r.push(o),o=[]),l||o.push(a),s=a;}return o.length&&r.push(o),r}static splitByBoundaries(i,e,t,n){if(i.length===0)return [];if(e.length===0)return [{data:i,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let r=[...e].sort((h,m)=>h-m),o=[],s=h=>h<=0?Number.NEGATIVE_INFINITY:r[h-1],a=h=>{let m=0;for(let u=0;u<r.length&&h>=r[u];u++)m=u+1;return m},l=[i[0]];for(let h=1;h<i.length;h++){let m=i[h-1],u=i[h],c=t(m),g=t(u),d;g>c?d=r.filter(p=>p>c&&p<=g):g<c?d=r.filter(p=>p>=g&&p<c).reverse():d=[];let f=c;for(let p of d){let S=(p-c)/(g-c),w=n(m,u,S);l.push(w);let v=a((f+p)/2);o.push({data:l,zoneIndex:v,zoneLow:s(v)}),l=[w],f=p;}(d.length===0||d[d.length-1]!==g)&&l.push(u);}if(l.length>1||i.length===1){let h=t(l[0]),m=t(l[l.length-1]),u=a((h+m)/2);o.push({data:l,zoneIndex:u,zoneLow:s(u)});}return o}static splitByThreshold(i,e,t,n){let r=this.splitByBoundaries(i,[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}};function kt(i,e=6e4){if(i.length<2)return [];let t=[...i].sort((r,o)=>r.time-o.time),n=[];for(let r=1;r<t.length;r++)t[r].time-t[r-1].time>e&&n.push({startTime:t[r-1].time,endTime:t[r].time});return n}function hn(i,e=83144){let t=e/8.314,n=0,r=0;for(let s of i)s!==null&&(n+=Math.exp(-t/(s+273.15)),r++);if(r===0)return null;let o=n/r;return t/-Math.log(o)-273.15}function wt(i,e,t=83144){let n=new Array(i.length),r=0;for(let o=0;o<i.length;o++){let s=i[o].time,a=s-e;for(;r<o&&i[r].time<a;)r++;let l=i.slice(r,o+1).map(m=>m.value),h=hn(l,t);n[o]={time:s,value:h,synthetic:true};}return n}function mn(i){let e=0,t=0;for(let o of i)o!==null&&(e+=o,t++);if(t===0)return null;let n=e/t,r=0;for(let o of i){if(o===null)continue;let s=o-n;r+=s*s;}return Math.sqrt(r/t)}function un(i){let e=0,t=0;for(let o of i)o!==null&&(e+=o,t++);if(t<2)return null;let n=e/t,r=0;for(let o of i){if(o===null)continue;let s=o-n;r+=s*s;}return Math.sqrt(r/(t-1))}function vt(i,e,t=false){let n=new Array(i.length),r=0,o=t?un:mn;for(let s=0;s<i.length;s++){let a=i[s].time,l=a-e;for(;r<s&&i[r].time<l;)r++;let h=i.slice(r,s+1).map(u=>u.value),m=o(h);n[s]={time:a,value:m,synthetic:true};}return n}function nt(i,e){let t=new Array(i.length),n=0;for(let r=0;r<i.length;r++){let o=i[r].time,s=o-e;for(;n<r&&i[n].time<s;)n++;let a=0,l=0;for(let h=n;h<=r;h++){let m=i[h].value;m!==null&&(a+=m,l++);}t[r]={time:o,value:l===0?null:a/l,synthetic:true};}return t}function Tt(i,e){let t=new Array(i.length),n=null,r=0;for(let o=0;o<i.length;o++){let s=i[o].time,a=i[o].value;if(a===null){t[o]={time:s,value:n,synthetic:true};continue}if(n===null||e<=0)n=a;else {let l=1-Math.exp(-(s-r)/e);n=a*l+n*(1-l);}r=s,t[o]={time:s,value:n,synthetic:true};}return t}function fe(i){let e=[];for(let t of i)e.length>0&&e.push({...t,value:e[e.length-1].value}),e.push(t);return e}var Ae=class{};function Ct(i,e,t,n){let r=De(t);if(!r.markers.type||r.markers.type==="none")return [];let o=[];for(let s=0;s<i.length;s++){let a=i[s],l=e.timeScale.map(a.time),h=e.valueScale.map(a.value),m=n(a),u=t.pointStroke??m,c=t.pointFill??m,g=t.pointStrokeWidth??1.5,d=t.id?`${t.id}-marker-${s}`:void 0;$e(o,d,r.markers.type,l,h,r.markers.size,u,c,g);}return o}function $e(i,e,t,n,r,o,s,a,l){let h=m=>e===void 0?void 0:`${e}-${m}`;switch(t){case "circle":i.push({type:"circle",cx:n,cy:r,r:o,fill:a,stroke:s,strokeWidth:l,id:e});break;case "square":i.push({type:"rect",x:n-o,y:r-o,w:o*2,h:o*2,fill:a,stroke:s,strokeWidth:l,id:e});break;case "cross":i.push({type:"line",x1:n-o,y1:r-o,x2:n+o,y2:r+o,stroke:s,strokeWidth:l,id:e},{type:"line",x1:n-o,y1:r+o,x2:n+o,y2:r-o,stroke:s,strokeWidth:l,id:h(2)});break;case "diamond":i.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r},{x:n,y:r+o},{x:n-o,y:r}],closed:true,fill:a,stroke:s,strokeWidth:l,id:e});break;case "triangle":i.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r+o},{x:n-o,y:r+o}],closed:true,fill:a,stroke:s,strokeWidth:l,id:e});break;case "star":{let m=[];for(let u=0;u<10;u++){let c=u%2===0?o:o*.5,g=Math.PI/2*3+u*Math.PI/5;m.push({x:n+c*Math.cos(g),y:r+c*Math.sin(g)});}i.push({type:"path",points:m,closed:true,fill:a,stroke:s,strokeWidth:l,id:e});break}case "arrow":i.push({type:"path",points:[{x:n-o,y:r+o},{x:n,y:r-o},{x:n+o,y:r+o}],stroke:s,strokeWidth:l,fill:"none",id:e});break;case "plus":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:s,strokeWidth:l,id:e},{type:"line",x1:n,y1:r-o,x2:n,y2:r+o,stroke:s,strokeWidth:l,id:h(2)});break;case "triangle-down":i.push({type:"path",points:[{x:n,y:r+o},{x:n+o,y:r-o},{x:n-o,y:r-o}],closed:true,fill:a,stroke:s,strokeWidth:l,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)});}i.push({type:"path",points:m,closed:true,fill:a,stroke:s,strokeWidth:l,id:e});break}case "hourglass":i.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}],closed:true,fill:a,stroke:s,strokeWidth:l,id:e});break;case "line-horizontal":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:s,strokeWidth:l,id:e});break;default:i.push({type:"circle",cx:n,cy:r,r:o,fill:a,stroke:s,strokeWidth:l,id:e});}}var cn=[[32,126,"278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584"],[160,255,"278,333,556,556,556,556,260,556,333,737,370,556,584,333,737,552,400,549,333,333,333,576,537,333,333,333,365,556,834,834,834,611,667,667,667,667,667,667,1000,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,500,556,556,556,556,278,278,278,278,556,556,556,556,556,556,556,549,611,556,556,556,556,500,556,500"]],it=.6,dn=(()=>{let i=new Map;for(let[e,,t]of cn){let n=t.split(",");for(let r=0;r<n.length;r++)i.set(e+r,Number(n[r])/1e3);}return i})();function Mt(i){return dn.get(i)??it}var te=(i,e)=>{let t=0;for(let n of i)t+=Mt(n.codePointAt(0)??0);return t*e},pn=(i,e)=>[...i].length*e*it;function Lt(i,e,t){let n=0;for(let r of i)n=Math.max(n,t(r,e));return n}var Pe=class i{#e=[];get commands(){return [...this.#e]}get length(){return this.#e.length}line(e){return this.#e.push({type:"line",...e}),this}path(e){return this.#e.push({type:"path",...e}),this}rect(e){return this.#e.push({type:"rect",...e}),this}circle(e){return this.#e.push({type:"circle",...e}),this}text(e){return this.#e.push({type:"text",...e}),this}gap(e){return this.#e.push({type:"gap",...e}),this}push(...e){return this.#e.push(...e),this}group(e,t){let n=new i;return t(n),n.length===0?this:(this.#e.push({type:"group",...e,commands:n.commands}),this)}toGroup(e={}){return {type:"group",...e,commands:this.commands}}};var fn="#ffffff",gn="#cccccc",yn=6,bn=.85,ne=12,Fe=8,xe=20,xn=11,je=18,rt=(i,e)=>e(i,xn);function At(i,e,t){let n=a=>ne+Fe+rt(a.name,e);if(t===void 0){let a=i.reduce((l,h)=>l+n(h)+je,0)-je;return [{items:i,breite:Math.max(0,a)}]}let r=[],o=[],s=0;for(let a of i){let l=n(a),h=o.length===0?l:s+je+l;o.length>0&&h>t?(r.push({items:o,breite:s}),o=[a],s=l):(o=[...o,a],s=h);}return o.length>0&&r.push({items:o,breite:s}),r}function ot(i,e="vertical",t=te,n){if(e==="horizontal"){let o=At(i,t,n);return {width:o.reduce((s,a)=>Math.max(s,a.breite),0),height:o.length*xe}}let r=0;for(let o of i)r=Math.max(r,rt(o.name,t));return {width:ne+Fe+r,height:i.length*xe}}function $t(i){let{items:e,x:t,y:n,orientation:r="vertical",metrics:o=te,maxBreite:s,box:a,itemClass:l}=i,h=new Pe;if(a&&e.length>0){let c=ot(e,r,o,s),d=((r==="horizontal"?c.height/xe:e.length)-1)*xe+ne,f=a.padding??yn,p=a.stroke??gn;h.rect({x:t-f,y:n-f,w:c.width+2*f,h:d+2*f,fill:a.fill??fn,...p==="none"?{}:{stroke:p,strokeWidth:a.strokeWidth??1},opacity:a.opacity??bn});}let m=r==="horizontal"?At(e,o,s):e.map(c=>({items:[c],breite:0})),u=new Map;return m.forEach((c,g)=>{let d=t;for(let f of c.items)u.set(f,{x:d,y:n+g*xe}),d+=ne+Fe+rt(f.name,o)+je;}),e.forEach(c=>{let g=u.get(c)??{x:t,y:n},d=g.x,f=g.y,p=["legend-item"];c.id&&p.push(`legend-item--${c.id}`),l&&p.push(l),h.group({cssClass:p.join(" "),...c.id?{id:`legend-${c.id}`}:{}},S=>{S.rect({x:d,y:f,w:ne,h:ne,fill:c.color,stroke:y.legendStroke,strokeWidth:1}).text({content:c.name,x:d+ne+Fe,y:f+ne-2,fontSize:y.legendFont,fill:y.legendText});});}),h.toGroup({cssClass:"chart-legend"})}function st(i){let{xTicks:e,yTicks:t,xRange:n,yRange:r,stroke:o=y.gridStroke,strokeWidth:s=y.gridStrokeWidth,dashed:a=false,opacity:l=y.gridOpacity}=i,h=[];if(t)for(let m of t)h.push({type:"line",x1:n[0],y1:m,x2:n[1],y2:m,stroke:o,strokeWidth:s,dashed:a,opacity:l});if(e)for(let m of e)h.push({type:"line",x1:m,y1:r[0],x2:m,y2:r[1],stroke:o,strokeWidth:s,dashed:a,opacity:l});return h}function Sn(i){return i==="dotted"?{dash:"dotted"}:i==="dashed"?{dash:"dashed"}:{}}function Dt(i){let{thresholds:e,valueScale:t,xRange:n}=i,[r,o]=n,[s,a]=t.range(),l=Math.min(s,a),h=Math.max(s,a),m=[],u=[];for(let c of e){let g=c.color??y.thresholdColor,d=t.map(c.value);c.fill==="above"?m.push({type:"rect",x:r,y:l,w:o-r,h:Math.max(0,d-l),fill:g,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0}):c.fill==="below"&&m.push({type:"rect",x:r,y:d,w:o-r,h:Math.max(0,h-d),fill:g,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0});let f=c.line??y.thresholdLine;if(f!=="none"){let v=Sn(f),k={type:"line",x1:r,y1:d,x2:o,y2:d,stroke:g,strokeWidth:1,...v,id:c.id?`${c.id}-line`:void 0};c.shadowColor&&(k.shadowColor=c.shadowColor,k.shadowBlur=c.shadowBlur??4,k.shadowOffsetX=c.shadowOffsetX??0,k.shadowOffsetY=c.shadowOffsetY??2),m.push(k);}let[p,S]=t.domain();if(c.value>=Math.min(p,S)&&c.value<=Math.max(p,S)&&c.label!==void 0&&c.label!==null&&c.label!==false){let v=typeof c.label=="object"?c.label:void 0,k=typeof c.label=="string"?c.label:v?.text??c.name,A=v?.position??"right",j=kn(k,A,r,o,d,g,v);u.push({...j,y:_n(j.y,Math.min(s,a),Math.max(s,a),y.thresholdFontSize),id:c.id?`${c.id}-label`:void 0});}}return {inside:m,labels:u}}function _n(i,e,t,n){return Math.max(e+n,Math.min(t-n/2,i))}function kn(i,e,t,n,r,o,s){let a=(t+n)/2,l={type:"text",content:i,fontSize:y.thresholdFontSize,fill:o},h=s?{...s.rotate!==void 0&&{rotate:s.rotate},...s.textBaseline!==void 0&&{textBaseline:s.textBaseline}}:{};switch(e){case "left":return {...l,...h,x:t+4,y:r-4,anchor:"start"};case "above":return {...l,...h,x:a,y:r-6,anchor:"middle"};case "below":return {...l,...h,x:a,y:r+14,anchor:"middle"};case "center":return {...l,...h,x:a,y:r-4,anchor:"middle"};case "outside-left":return {...l,...h,x:t-6,y:r+3,anchor:"end",textBaseline:h.textBaseline??"middle"};case "outside-right":return {...l,...h,x:n+6,y:r+3,anchor:"start",textBaseline:h.textBaseline??"middle"};default:return {...l,...h,x:n-4,y:r-4,anchor:"end"}}}function Pt(i,e,t,n){switch(i){case "above":return e-5;case "below":return n!==void 0?n-5:t+14;case "center":case "middle":return (e+t)/2+4;case "bottom":return t-6;default:return e+14}}function Be(i){let{ranges:e,timeScale:t,yRange:n,height:r,metrics:o=te}=i,[s,a]=n,l=[],[h,m]=t.range(),u=Math.min(h,m),c=Math.max(h,m),g=d=>Math.max(u,Math.min(c,d));for(let d of e){let f=g(t.map(d.startTime)),p=g(t.map(d.endTime));if(d.fill!==void 0&&l.push({type:"rect",x:f,y:s,w:p-f,h:a-s,fill:d.fill,hatch:d.hatch,opacity:d.opacity}),d.edges)for(let S of [f,p])l.push({type:"line",x1:S,y1:s,x2:S,y2:a,stroke:d.edges.stroke,strokeWidth:d.edges.strokeWidth,dash:"dashed"});if(d.label){let S=d.labelPosition??"middle",w=d.rotate;if(w==="auto"){let v=S!=="above"&&S!=="below",k=o(d.label,d.fontSize??11);w=v&&k>Math.abs(p-f)-4?-90:void 0;}l.push({type:"text",content:d.label,x:(f+p)/2,y:Pt(S,s,a,r),anchor:"middle",fontSize:d.fontSize,fill:d.labelColor,rotate:w});}}return l}function at(i){let{gaps:e,timeScale:t,yRange:n,height:r,fill:o=y.gapFill,hatch:s,fillOpacity:a=y.gapFillOpacity??.15,stroke:l=y.gapStroke,strokeWidth:h=y.gapStrokeWidth,dashed:m=true,fontSize:u=y.gapFontSize,fontFill:c=y.gapFontColor,labelBaseline:g="middle",labelRotate:d,metrics:f,band:p}=i,S=()=>{if(!p)return [];let w=p.height??6,[v,k]=n,A=Math.max(v,k);return e.map(j=>{let $=t.map(j.startTime),H=t.map(j.endTime);return {type:"rect",x:Math.min($,H),y:A-w+(p.offset??0),w:Math.abs(H-$),h:w,fill:p.fill??l,opacity:p.opacity??.75}})};return Be({timeScale:t,yRange:n,height:r,metrics:f,ranges:e.map(w=>{let v=w.style??"dashed_border",k=v==="filled"||v==="dashed_border",A=v==="dashed_border"&&m!==false;return {startTime:w.startTime,endTime:w.endTime,...k&&{fill:w.fill??o,hatch:w.hatch??s,opacity:w.fillOpacity??a},...A&&{edges:{stroke:l,strokeWidth:h}},label:w.label,labelPosition:w.labelBaseline??g,labelColor:c,fontSize:u,rotate:w.rotate??d}})}).concat(S())}function jt(i){let{markers:e,timeScale:t,valueScale:n,yRange:r=[0,300]}=i,[o,s]=r,a=[];for(let l of e){let h=t.map(l.time),m=l.color??y.markerColor,u=l.pointStyle??(l.value!==void 0?"circle":"none"),c=l.lineStyle??"full";if(l.value!==void 0){let g=n.map(l.value);if(c==="to-value"?a.push({type:"line",x1:h,y1:s,x2:h,y2:g,stroke:m,strokeWidth:1,dashed:true}):c==="to-top"?a.push({type:"line",x1:h,y1:o,x2:h,y2:g,stroke:m,strokeWidth:1,dashed:true}):c==="full"&&a.push({type:"line",x1:h,y1:o,x2:h,y2:s,stroke:m,strokeWidth:1}),u!=="none"&&$e(a,void 0,u,h,g,y.markerSize,m,m,1.5),l.label){let d=c==="to-value"?g-10:o-6;a.push({type:"text",content:l.label,x:h,y:d,anchor:"middle",fontSize:y.markerFontSize,fill:m});}}else c!=="none"&&a.push({type:"line",x1:h,y1:o,x2:h,y2:s,stroke:m,strokeWidth:1}),l.label&&a.push({type:"text",content:l.label,x:h,y:o-6,anchor:"middle",fontSize:y.markerFontSize,fill:m});}return a}function Ft(i){let{highlights:e,timeScale:t,yRange:n,height:r}=i;return Be({metrics:i.metrics,timeScale:t,yRange:n,height:r,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??y.highlightColor,opacity:o.opacity??y.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??y.highlightLabelColor,fontSize:y.annotationFontSize,rotate:o.rotate}))})}function Bt(i){let{annotations:e,timeScale:t,valueScales:n}=i,r=[],o=s=>{let a=n.get(s.axis??0)??n.values().next().value;return {x:t.map(s.time),y:a?a.map(s.value):0}};for(let s of e){let a=[],l=h=>a.push(h);switch(s.type){case "line":{let h=o(s.from),m=o(s.to);l({type:"line",x1:h.x,y1:h.y,x2:m.x,y2:m.y,stroke:s.color??y.annotationColor,strokeWidth:s.width??y.annotationWidth,dash:s.dash});break}case "arrow":{let h=o(s.from),m=o(s.to),u=s.color??y.annotationColor,c=s.headSize??y.annotationHead;l({type:"line",x1:h.x,y1:h.y,x2:m.x,y2:m.y,stroke:u,strokeWidth:s.width??y.annotationWidth});let g=Math.hypot(m.x-h.x,m.y-h.y)||1,d=(m.x-h.x)/g,f=(m.y-h.y)/g,p=m.x-d*c,S=m.y-f*c;l({type:"path",points:[{x:m.x,y:m.y},{x:p-f*c*.5,y:S+d*c*.5},{x:p+f*c*.5,y:S-d*c*.5}],fill:u,stroke:"none"});break}case "rect":{let h=o(s.from),m=o(s.to);l({type:"rect",x:Math.min(h.x,m.x),y:Math.min(h.y,m.y),w:Math.abs(m.x-h.x),h:Math.abs(m.y-h.y),fill:s.fill??"none",hatch:s.hatch,stroke:s.stroke,opacity:s.opacity});break}case "point":{let h=o(s.at),m=s.color??"#334155",u=s.radius??y.annotationRadius,c=s.shape??"circle";c==="circle"?l({type:"circle",cx:h.x,cy:h.y,r:u,fill:m}):c==="square"?l({type:"rect",x:h.x-u,y:h.y-u,w:u*2,h:u*2,fill:m}):(l({type:"line",x1:h.x-u,y1:h.y-u,x2:h.x+u,y2:h.y+u,stroke:m,strokeWidth:1.5}),l({type:"line",x1:h.x-u,y1:h.y+u,x2:h.x+u,y2:h.y-u,stroke:m,strokeWidth:1.5}));break}case "label":{let h=o(s.at);l({type:"text",content:s.text,x:h.x+(s.dx??0),y:h.y+(s.dy??0),anchor:s.anchor??wn(h.x+(s.dx??0),s.text,i),fontSize:y.annotationFontSize,fill:s.color??y.annotationColor,rotate:s.rotate});break}}if(s.id&&a.length>0){let h=oe(s.id);r.push({type:"group",cssClass:`annotation annotation--${h}`,commands:a});}else r.push(...a);}return r}function wn(i,e,t){let{metrics:n,timeScale:r}=t;if(!n)return "middle";let[o,s]=r.range(),a=n(e,y.annotationFontSize)/2;return i-a<o?"start":i+a>s?"end":"middle"}var ge=class i{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++i.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var Re=class extends ge{#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??y.bandFill,n=e.hatch,r=e.avgLine??false,o=e.avgLineColor??y.bandAvgLine,s=e.bandWidth??10,a=[];for(let l of this.data){if(l.min===null||l.max===null)continue;let h=this.timeScale.map(l.time),m=e.valueScale.map(l.max),u=e.valueScale.map(l.min),c=s,g=this.data.indexOf(l);if(a.push({type:"rect",x:h-c/2,y:m,w:c,h:u-m,fill:t,hatch:n,opacity:this.opacity(l.count),id:this.id?`${this.id}-slot-${g}`:void 0}),r&&l.avg!==null){let d=e.valueScale.map(l.avg);a.push({type:"line",x1:h-c/2,y1:d,x2:h+c/2,y2:d,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${g}`:void 0});}}return a}};var vn=1,Oe=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:a,height:l}=this.#e,h=[];n&&h.push({type:"rect",x:s[0],y:a,w:s[1]-s[0],h:l,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let m of e){let u=t.map(m.startTime),c=t.map(m.endTime);if(c<s[0]||u>s[1])continue;let g=Math.max(s[0],Math.min(s[1],u)),d=Math.max(s[0],Math.min(s[1],c)),f=Math.max(d-g,vn);g+f>s[1]&&(g=Math.max(s[0],s[1]-f));let p=g+f/2;if(h.push({type:"rect",x:g,y:a,w:f,h:l,hatch:m.hatch??r,fill:m.fill??"#6b728044",stroke:m.stroke,strokeWidth:m.strokeWidth??0,title:m.title}),m.label){let S=m.labelFontSize??10;h.push({type:"text",content:m.label,x:p,y:this.#t(m.labelBaseline,S),anchor:"middle",fontSize:S,fill:m.labelFill??"#333"});}}if(o){let m=new de({domain:t.domain(),xRange:s,y:a+l+4});h.push({type:"group",cssClass:"annotation-band-axis",commands:m.render()});}return h}#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}}};function De(i){return {id:i.id,line:{stroke:i.stroke??y.stroke,strokeWidth:i.strokeWidth??y.strokeWidth,smoothing:i.smoothing??false,smoothingType:i.smoothingType,dashed:i.dashed??false},fill:i.fill??y.areaFillAlpha,markers:{type:i.pointStyle??"none",size:i.pointSize??y.pointSize,stroke:i.stroke??y.stroke,fill:"#ffffff"},shadow:{color:i.shadowColor??"transparent",blur:i.shadowBlur??0,offsetX:i.shadowOffsetX??0,offsetY:i.shadowOffsetY??0}}}function Ie(i,e,t){let n=[],r=De(t);for(let o=0;o<i.length;o++){let s=i[o];s.data.length>=2?n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${o}`:void 0,points:s.data.map(a=>({x:e.timeScale.map(a.time),y:e.valueScale.map(a.value)})),stroke:s.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:r.line.smoothing,dashed:r.line.dashed,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur,shadowOffsetX:r.shadow.offsetX,shadowOffsetY:r.shadow.offsetY,fill:"none"}):s.data.length===1&&n.push({type:"circle",id:t.id?`${t.id}-dot-${o}`:void 0,cx:e.timeScale.map(s.data[0].time),cy:e.valueScale.map(s.data[0].value),r:Math.max(r.markers.size,r.line.strokeWidth),fill:s.color??r.line.stroke,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur});}return n}function lt(i,e,t,n){if(i.length<2)return [];let r=z.splitByBoundaries(i,t.boundaries,t.getValue,t.interpolate),o=[];for(let s=0;s<r.length;s++){let a=r[s];if(a.data.length<2)continue;let l=t.getColor(a.zoneIndex);if(!l)continue;let h=a.data.map(u=>({x:e.timeScale.map(u.time),y:e.valueScale.map(t.yLow(u))})),m=a.data.map(u=>({x:e.timeScale.map(u.time),y:e.valueScale.map(t.yHigh(u))})).reverse();o.push({type:"path",cssClass:"series-fill",id:n?.id?`${n.id}-fill-${s}`:void 0,points:[...h,...m],fill:l,hatch:t.getHatch?.(a.zoneIndex),stroke:"none"});}return o}var We=class extends ge{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??y.minColor,n=e.maxColor??y.maxColor,r=e.avgColor??y.avgColor,o=e.avgDashed??true,s=e.smoothing??false,a=e.smoothingType,l=e.strokeWidth??y.strokeWidth,h=z.getRuns(this.data,d=>d.min===null||d.max===null||d.avg===null);if(h.length===0)return [];let m={timeScale:this.timeScale,valueScale:e.valueScale},u=[];h.forEach((d,f)=>{d.length<2||(e.fillToMax&&u.push(...lt(d,m,{boundaries:[],yLow:p=>p.avg,yHigh:p=>p.max,getValue:p=>p.avg,interpolate:z.interpolateAggregatedPoint,getColor:()=>e.fillToMax,getHatch:()=>e.fillToMaxHatch},{id:this.id?`${this.id}-fillToMax-${f}`:void 0})),e.fillToMin&&u.push(...lt(d,m,{boundaries:[],yLow:p=>p.avg,yHigh:p=>p.min,getValue:p=>p.avg,interpolate:z.interpolateAggregatedPoint,getColor:()=>e.fillToMin,getHatch:()=>e.fillToMinHatch},{id:this.id?`${this.id}-fillToMin-${f}`:void 0})));});let c=h.filter(d=>d.length>=2),g=d=>c.map(f=>({data:f.map(p=>({time:p.time,value:d(p)}))}));return u.push(...Ie(g(d=>d.max),m,{stroke:n,strokeWidth:l,smoothing:s,smoothingType:a,id:this.id?`${this.id}-max`:void 0}),...Ie(g(d=>d.min),m,{stroke:t,strokeWidth:l,smoothing:s,id:this.id?`${this.id}-min`:void 0}),...Ie(g(d=>d.avg),m,{stroke:r,strokeWidth:l,smoothing:s,dashed:o,id:this.id?`${this.id}-avg`:void 0})),u}};function ht(i){return i!==void 0&&typeof i=="object"&&"series"in i?i.series:null}function Rt(i){let e=[...i].sort((n,r)=>n.time-r.time),t=0;return n=>{for(;t>0&&e[t].time>n;)t--;for(;t<e.length-1&&e[t+1].time<=n;)t++;let r=e[t];if(!r||n<r.time)return null;if(r.time===n)return r.value??null;let o=e[t+1];if(!o||n>o.time||r.value===null||o.value===null)return null;let s=o.time-r.time;return s===0?r.value:r.value+(o.value-r.value)*(n-r.time)/s}}function Ot(i,e,t){let n=i??e;if(n==="series")return null;if(n==="chartTop")return t.chartTop;if(n==="chartBottom")return t.chartBottom;if(typeof n=="object"&&"threshold"in n){let r=t.thresholds.get(n.threshold);if(!r)throw new Error(`fillSpec region references unknown threshold '${n.threshold}'`);return t.valueScale.map(r.value)}return typeof n=="object"&&"value"in n?t.valueScale.map(n.value):null}function Tn(i){return typeof i=="string"?{color:i}:{color:i.color,hatch:i.hatch}}function It(i,e,t){let n=Ot(i.from,"chartBottom",e),r=Ot(i.to,"series",e),{color:o,hatch:s}=Tn(i.fill),a={type:"path",fill:o,hatch:s,stroke:"none",cssClass:"series-fill"},l=p=>e.idPrefix?{id:`${e.idPrefix}-fill-r${t}-${p}`}:{},h=ht(i.from),m=ht(i.to);if(h!==null||m!==null){if(!e.fremdeSerie)throw new Error(`fillSpec region references series '${h??m}', but no series lookup was provided`);let p=(v,k,A)=>{let j=v??k,$=ht(j);if($!==null){let _=e.fremdeSerie($);if(!_)throw new Error(`fillSpec region references unknown series '${$}'`);let D=_.shape==="step"?fe(_.data):_.data;return {bei:Rt(D),zeiten:D.map(F=>F.time)}}if(j==="series")return {bei:Rt(A),zeiten:A.map(_=>_.time)};let H=mt(j,e),V=e.valueScale.domain(),G=H??(j==="chartBottom"?V[0]:V[1]);return {bei:()=>G,zeiten:[]}},S=e.shape==="step",w=[];for(let v of e.runs){if(v.length<2)continue;let k=S?fe(v):v,A=p(i.from,"chartBottom",k),j=p(i.to,"series",k),$=k[0].time,H=k[k.length-1].time,V=[...new Set([...A.zeiten,...j.zeiten,...k.map(F=>F.time)])].filter(F=>F>=$&&F<=H).sort((F,R)=>F-R),G=[],_=[],D=()=>{if(G.length>=2){let F=[..._].reverse();w.push({...a,...l(w.length),smoothing:S?false:e.smoothing,smoothingType:e.smoothingType,smoothCount:G.length,points:[...G,...F]});}G=[],_=[];};for(let F of V){let R=A.bei(F),B=j.bei(F);if(R===null||B===null){D();continue}let O=e.timeScale.map(F);G.push({x:O,y:e.valueScale.map(B)}),_.push({x:O,y:e.valueScale.map(R)});}D();}return w}if(n!==null&&r!==null){let p=e.timeScale.range(),S=p[0],w=p[1],v=Math.min(n,r),k=Math.max(n,r);return [{...a,...l(0),points:[{x:S,y:v},{x:w,y:v},{x:w,y:k},{x:S,y:k}]}]}let u=n??r,c=[],g=Cn(i,e);if(g===null){let p=e.valueScale.domain();g=(n??r)===e.chartBottom?p[0]:p[1];}let d=mt(i.outer,e),f=e.shape==="step";for(let p of e.runs){if(p.length<2)continue;let S=f?fe(p):p,w=z.splitByThreshold(S,g,k=>k.value??g,z.interpolateDataPoint),v=i.side==="above"?w.above:i.side==="below"?w.below:[...w.above,...w.below];if(d!==null&&i.side){let k=d,A=i.side==="above"?j=>Math.min(j,k):j=>Math.max(j,k);v=v.map(j=>j.map($=>({...$,value:A($.value??k)})));}for(let k of v){if(k.length<2)continue;let A=k.map($=>({x:e.timeScale.map($.time),y:e.valueScale.map($.value)})),j=[];for(let $ of [...A].reverse()){let H=j[j.length-1];f&&H&&H.x===$.x||j.push({x:$.x,y:u});}c.push({...a,...l(c.length),smoothing:f?false:e.smoothing,smoothingType:e.smoothingType,smoothCount:A.length,points:[...A,...j]});}}return c}function Cn(i,e){let t=i.from==="series"?i.to:i.from;return mt(t,e)}function mt(i,e){return i===void 0||i==="series"||i==="chartTop"||i==="chartBottom"?null:typeof i=="object"&&"threshold"in i?e.thresholds.get(i.threshold)?.value??null:typeof i=="object"&&"value"in i?i.value:null}function Wt(i,e){if(typeof i=="string"||!("regions"in i))return It({fill:i},e,0);let t=[];return i.regions.forEach((n,r)=>{t.push(...It(n,e,r));}),t}function Et(i){let e=i.style?.line,t=e&&!Array.isArray(e)?e:void 0;return {color:t?.color??y.stroke,width:t?.width??y.strokeWidth,dash:t?.style,smoothing:t?.smoothing??false,smoothingType:t?.smoothingType}}function Ht(i,e,t,n,r){let o=i.filter(h=>h.value!==null);if(o.length<2)return [];let s=o.map(h=>({x:e.timeScale.map(h.time),y:e.valueScale.map(h.value)})),a=Et(t);return [{type:"path",cssClass:"series-line",id:e.idPrefix?`${e.idPrefix}-overlay-${r}-${n}`:`overlay-${r}-${n}`,points:s,stroke:a.color,strokeWidth:a.width,smoothing:a.smoothing,smoothingType:a.smoothingType,dash:a.dash,fill:"none"}]}function Gt(i,e,t=0){switch(i.kind){case "movingAverage":{let n=i.type==="exponential"?Tt(e.data,i.window):nt(e.data,i.window);return Ht(n,e,i,"movingAvg",t)}case "movingMkt":{let n=wt(e.data,i.window,i.activationEnergy);return Ht(n,e,i,"movingMkt",t)}case "limits":{let n=[],r=e.timeScale.range(),o=r[0],s=r[1],a=Et(i),l=a.color,h=a.width,m=a.dash??"dashed",u=e.idPrefix?`${e.idPrefix}-overlay-${t}-`:`overlay-${t}-`;return i.high!==void 0&&n.push({type:"line",id:`${u}limit-high`,x1:o,y1:e.valueScale.map(i.high),x2:s,y2:e.valueScale.map(i.high),stroke:l,strokeWidth:h,dash:m}),i.low!==void 0&&n.push({type:"line",id:`${u}limit-low`,x1:o,y1:e.valueScale.map(i.low),x2:s,y2:e.valueScale.map(i.low),stroke:l,strokeWidth:h,dash:m}),n}case "stdDevBand":{let n=i.multiplier??1,r=nt(e.data,i.window),o=vt(e.data,i.window),s=[],a=[];for(let p=0;p<r.length;p++){let S=r[p].value,w=o[p].value;if(S===null||w===null)continue;let v=e.timeScale.map(r[p].time);s.push({x:v,y:e.valueScale.map(S+n*w)}),a.push({x:v,y:e.valueScale.map(S-n*w)});}if(s.length<2)return [];let l=e.idPrefix?`${e.idPrefix}-overlay-${t}-`:`overlay-${t}-`,h=[],u=(typeof i.style?.fill=="string"||i.style?.fill&&!("regions"in i.style.fill)?i.style.fill:void 0)??"#94a3b833",{color:c,hatch:g}=Mn(u);h.push({type:"path",cssClass:"series-fill",id:`${l}stdDevBand`,points:[...s,...[...a].reverse()],fill:c,hatch:g,stroke:"none"});let d=i.style?.line,f=d&&!Array.isArray(d)?d:void 0;if(f){let p=r.filter(S=>S.value!==null).map(S=>({x:e.timeScale.map(S.time),y:e.valueScale.map(S.value)}));p.length>=2&&h.push({type:"path",cssClass:"series-line",id:`${l}stdDevBand-mean`,points:p,stroke:f.color??y.stroke,strokeWidth:f.width??1.5,smoothing:f.smoothing,smoothingType:f.smoothingType,dash:f.style,fill:"none"});}return h}}}function Mn(i){return typeof i=="string"?{color:i}:{color:i.color,hatch:i.hatch}}function Ln(i){if(!i)return {gaps:[],autoDetect:false,minGapMs:6e4};if(Array.isArray(i))return {gaps:i,autoDetect:false,minGapMs:6e4};let e=i.regions??[],t=i.style;return {gaps:e.map(r=>{let o={...t,...r.style},s=o.fill,a,l;return typeof s=="string"?a=s:s&&(a=s.color,l=s.hatch),{startTime:r.startTime,endTime:r.endTime,label:r.label,fill:a,hatch:l,fillOpacity:o.opacity,labelBaseline:o.label?.baseline,rotate:o.label?.rotate,style:o.display==="bridge_line"?void 0:o.display}}),autoDetect:i.autoDetect??false,minGapMs:i.minGapMs??6e4,band:t?.band}}function An(i,e,t,n){if(n===void 0)return [i,e];let r=typeof n=="number"?n:n.top??0,o=typeof n=="number"?n:n.bottom??0;if(r<=0&&o<=0)return [i,e];let s=t-r-o,a=e-i;if(s<=0||a<=0)return [i,e];let l=a/s;return [i-o*l,e+r*l]}function Se(i){return "showAs"in i&&!!i.showAs}function Vt(i,e){if(e)for(let t of i)t.type==="text"?t.fontFamily||(t.fontFamily=e):t.type==="group"&&Array.isArray(t.commands)&&Vt(t.commands,e);}function $n(i,e,t){let r=new Array(i.length),o=e.map(s=>({position:s.position,von:s.von,bis:s.bis}));for(let s of ["left","right"]){let a=s==="left",l=i.map((h,m)=>({t:h,i:m})).filter(h=>h.t.position===s).sort((h,m)=>a?m.t.achseX-h.t.achseX:h.t.achseX-m.t.achseX);for(let{t:h,i:m}of l){let u=h.schrift/2,c=o.filter(f=>f.position===s),g=h.kante,d=a?g-1-u:g+1+u;for(let f=0;f<=c.length;f++){let p=d-u-1,S=d+u+1,w=c.find(v=>p<v.bis&&v.von<S);if(!w)break;g=a?w.von:w.bis,d=a?g-1-u:g+1+u;}if(a?d-u<2:d+u>t-2){let f=o.filter(p=>p.position===s&&p.titel);d=a?u+2:t-u-2;for(let p=0;p<=f.length;p++){let S=d-u-1,w=d+u+1,v=f.find(k=>S<k.bis&&k.von<w);if(!v)break;d=a?v.bis+1+u:v.von-1-u;}}o.push({position:s,von:d-u-1,bis:d+u+1,titel:true}),r[m]=d;}}return {xs:r,belegt:o}}function Nt(i,e){return i!==void 0?i:e!==void 0&&e!==false?1:0}var le=class{_layout;_renderer;_locale;_timeZone;_fontFamily;_legend;_textMetrics;_clipSeries;_markers;_thresholds;_highlights;_gaps;_gapsBand;_gapsAutoDetect;_gapsMinGapMs;_annotations;_annotationBands;_disabledAnnotations=new Set;_annotationSeq=0;_axes;_series;readonly_annotationBandHeight=0;_timeScale;_valueScales=new Map;constructor(e={}){this._layout=new ye({width:e.width??800,height:e.height??400,margin:e.margin??{top:20,right:20,bottom:40,left:60}}).compute(),this._renderer=e.renderer,this._locale=e.locale,this._timeZone=e.timeZone,this._fontFamily=e.fontFamily,this._legend=e.legend,this._textMetrics=e.textMetrics??te,this._clipSeries=e.clipSeries??true,this._markers=e.markers??[],this._thresholds=e.thresholds??[],this._highlights=e.highlights??[];let t=Ln(e.gaps);this._gaps=t.gaps,this._gapsAutoDetect=t.autoDetect,this._gapsMinGapMs=t.minGapMs,this._gapsBand=t.band,this._annotations=e.annotations??[],this._annotationBands=e.annotationBands??[],this._axes=e.axes,this._series=[],e.series&&this.setData(e.series);}getWidth(){return this._layout.totalWidth}getHeight(){return this._layout.totalHeight+this._annotationBandTotalHeight()}get series(){return this._series}_annotationBandTotalHeight(){let e=0;for(let t of this._annotationBands){let n=t.height??12,r=t.spacing??0;(t.showAxis??false)&&(e+=26+r),e+=n+r;}return e}setData(e){this._series=e.filter(t=>Array.isArray(t.data));}addAnnotation(e){let t=e.id??`anno-${++this._annotationSeq}`;return this._annotations.push({...e,id:t}),t}removeAnnotation(e){let t=this._annotations.length;return this._annotations=this._annotations.filter(n=>n.id!==e),this._disabledAnnotations.delete(e),this._annotations.length<t}setAnnotations(e){this._annotations=[...e],this._disabledAnnotations.clear();}clearAnnotations(){this._annotations=[],this._disabledAnnotations.clear();}getAnnotations(){return this._annotations}disableAnnotation(e){this._disabledAnnotations.add(e);}enableAnnotation(e){this._disabledAnnotations.delete(e);}_axisIndexOf(e){return e.yAxisIndex??0}_timesOf(e){return e.data.map(t=>t.time)}_valuesOf(e){if(Se(e)){let t=[];for(let n of e.data)n.min!==null&&t.push(n.min),n.max!==null&&t.push(n.max);return t}return e.data.map(t=>t.value).filter(t=>t!==null)}renderCommands(){if(this._series.length===0)return [];let e=this._legendItems(),t=(this._legend?.show??false)&&e.length>0,n=this._legend?.position??"inside-right",r=this._legend?.orientation??(n==="above"||n==="below"?"horizontal":"vertical"),o=n==="above"||n==="below"?this._layout.totalWidth-16:void 0,s=t?ot(e,r,this._textMetrics,o):{width:0,height:0},a=t&&this._legend?.box?this._legend.box.padding??6:0,l=this._layout;if(t&&(n==="outside-right"||n==="outside-left"||n==="above"||n==="below")){let b={...this._layout.margin};n==="outside-right"?b.right+=s.width+2*a+16:n==="outside-left"?b.left+=s.width+2*a+16:n==="above"?b.top+=s.height+2*a+10:b.bottom+=s.height+2*a+10,l=new ye({width:this._layout.totalWidth,height:this._layout.totalHeight,margin:b}).compute();}let{chartX:h,chartY:m,chartWidth:u,chartHeight:c}=l,g=[h,h+u],d=[m,m+c],f=[];for(let b of this._series)b.data.sort((T,L)=>T.time-L.time);let p=new Map,S=1/0,w=-1/0,v=false;for(let b of this._series){let T=this._axisIndexOf(b),L=p.get(T);L?L.push(b):p.set(T,[b]);for(let P of this._timesOf(b))P<S&&(S=P),P>w&&(w=P),v=true;}if(!v)return [];let k=this._axes?.x?.domain,A=k&&k!=="auto"?k:[S,w];this._timeScale=new ue({domain:A,range:g,locale:this._locale,timeZone:this._timeZone});let j=b=>({axisColor:b?.color??y.axisColor,tickColor:b?.color??y.tickColor,textColor:y.textColor,textSize:y.textSize,axisWidth:b?.width??1}),$=new de({domain:A,xRange:g,y:m+c,locale:this._locale,timeZone:this._timeZone,format:this._axes?.x?.format,maxTicks:this._axes?.x?.ticks?.major,minorTicks:Nt(this._axes?.x?.ticks?.minor,this._axes?.x?.grid?.minor),colors:j(this._axes?.x?.axis),gesamtbreite:l.totalWidth,metrics:this._textMetrics});this._valueScales.clear();let H=Array.from(p.keys()).sort((b,T)=>b-T),V,G=[],_=[],D=(this._axes?.y?.length??0)>0,F=0,R=0;for(let b of H){let T=p.get(b),L=1/0,P=-1/0,W=false;for(let E of T)for(let ve of this._valuesOf(E))ve<L&&(L=ve),ve>P&&(P=ve),W=true;if(!W)continue;L===P&&(L-=1,P+=1);let I=b===0?this._axes?.left:b===1?this._axes?.right:void 0,X=this._axes?.y&&this._axes.y.length>b?this._axes.y[b]:void 0,N=X&&I?{...I,...X}:X??I,we=N?.domain,Q=we&&we!=="auto"?we:An(L,P,c,N?.padding),Y=this._zustaendeVon(T);if(Y){let E=Y.length>1?(Y[Y.length-1]-Y[0])/(Y.length-1):1;Q[0]=Y[0]-E/2,Q[1]=Y[Y.length-1]+E/2;}let ft=new ae({domain:Q,range:[m+c,m]});this._valueScales.set(b,ft);let re=N?.position??(b===0?"left":"right"),en=re==="right"?"outside-right":"outside-left",gt=this._thresholds.filter(E=>(E.axisIndex??0)===b&&typeof E.label=="object"&&E.label!==null&&E.label.position===en&&E.value>=Math.min(Q[0],Q[1])&&E.value<=Math.max(Q[0],Q[1])).map(E=>ft.map(E.value)),ee;if(re==="right"){let E=N?.offset??R*50;ee=h+u+E,R++;}else {let E=N?.offset??F*50;ee=h-E,F++;}let Ke=new Le({domain:Q,range:[m+c,m],x:ee,position:re,format:N?.format??(Y?this._zustandName(T):void 0),tickValues:Y,ticks:N?.ticks?.major,minorTicks:Nt(N?.ticks?.minor,N?.grid?.minor),colors:j(N?.axis),suppressLabelsNear:gt.length?gt:void 0,gesamtbreite:l.totalWidth,metrics:this._textMetrics}),yt=8+Lt(Ke.generateTicks().map(E=>E.label),11,this._textMetrics),Je=re==="right"?ee+yt:ee-yt;_.push({position:re,von:Math.min(ee,Je),bis:Math.max(ee,Je)}),D&&N?.label&&G.push({text:N.label,achseX:ee,kante:Je,position:re,style:N.labels}),b===0&&(V=Ke),f.push({type:"group",cssClass:`value-axis ${re}`,commands:Ke.render()});}let B=this._valueScales.get(0)??this._valueScales.get(H[0]);f.push({type:"group",cssClass:"time-axis",commands:$.render()});let O=null,M=this._axes?.x?.grid?.major,C=this._axes?.left?.grid?.major;if(M!==void 0||C!==void 0){let b=M!==false,T=C!==false&&!!V,L=b?$.generateTicks().map(W=>W.x):void 0,P=T?V.generateTicks().map(W=>W.position):void 0;if(L||P){let W=(M&&typeof M=="object"?M:void 0)??(C&&typeof C=="object"?C:void 0),I=this._axes?.x?.grid?.minor,X=this._axes?.left?.grid?.minor,N=(I&&typeof I=="object"?I:void 0)??(X&&typeof X=="object"?X:void 0);O={type:"group",cssClass:"chart-grid",commands:[...I!==void 0||X!==void 0?st({xTicks:I!==false&&b?$.generateMinorTicks():void 0,yTicks:X!==false&&T?V.generateMinorTicks():void 0,xRange:g,yRange:d,stroke:N?.color,opacity:N?.opacity??(y.gridOpacity??1)*.5,dashed:N?.style==="dashed"}):[],...st({xTicks:L,yTicks:P,xRange:g,yRange:d,stroke:W?.color,opacity:W?.opacity,dashed:W?.style==="dashed"})]};}}let q=(typeof this._axes?.x?.grid=="object"?this._axes.x.grid.layer:void 0)??(typeof this._axes?.left?.grid=="object"?this._axes.left.grid.layer:void 0)??"front";if(O&&q==="back"&&(f.push(O),O=null),this._highlights.length>0&&f.push({type:"group",cssClass:"highlights",commands:Ft({metrics:this._textMetrics,highlights:this._highlights,timeScale:this._timeScale,yRange:d,height:l.totalHeight})}),this._thresholds.length>0&&B){let b=[],T=[];for(let L of this._thresholds){let P=L.id??oe(L.name),W=this._valueScales.get(L.axisIndex??0)??B,I=Dt({thresholds:[L],valueScale:W,xRange:g});I.inside.length&&b.push({type:"group",cssClass:`threshold threshold--${P}`,id:`threshold-${P}`,commands:I.inside}),I.labels.length&&T.push({type:"group",cssClass:`threshold-label threshold-label--${P}`,commands:I.labels});}b.length&&f.push({type:"group",cssClass:"thresholds",commands:b,clipRect:{x:h,y:m,w:u,h:c}}),T.length&&f.push({type:"group",cssClass:"threshold-labels",commands:T});}let Z=this._gaps;if(this._gapsAutoDetect){let b=[];for(let T of this._series){if(Se(T))continue;let L=T.data.filter(P=>P.value!==null);b.push(...kt(L,this._gapsMinGapMs));}b.length>0&&(Z=[...this._gaps,...b]);}Z.length>0&&f.push({type:"group",cssClass:"gaps",commands:at({gaps:Z,timeScale:this._timeScale,yRange:d,height:l.totalHeight,metrics:this._textMetrics,band:this._gapsBand})});let K=new Map(this._thresholds.map(b=>[b.id??b.name,b]));for(let[b,T]of this._series.entries()){if(T.data.length===0)continue;let L=this._valueScales.get(this._axisIndexOf(T));if(!L)continue;let P=oe(T.id??T.name);f.push({type:"group",cssClass:`series series--${P}`,id:`series-${P}`,commands:this._renderSeries(T,L,K,b),...this._clipSeries?{clipRect:{x:h,y:m,w:u,h:c}}:{}});}O&&f.push(O);let J=this._markers.map(b=>({...b}));for(let b of J)if(b.value===void 0&&(b.lineStyle==="to-value"||b.lineStyle==="to-top")){let T=this._series[b.seriesIndex??0];T&&!Se(T)&&T.data.length>=2&&(b.value=this._interpolateValue(b.time,T.data));}if(J.length>0&&B){let b=[];for(let T of J){let L=B,P=this._series[T.seriesIndex??0];P&&(L=this._valueScales.get(this._axisIndexOf(P))??B),b.push(...jt({markers:[T],timeScale:this._timeScale,valueScale:L,yRange:d}));}f.push({type:"group",cssClass:"markers",commands:b});}let he=this._annotations.filter(b=>!b.id||!this._disabledAnnotations.has(b.id));if(he.length>0&&f.push({type:"group",cssClass:"annotations",commands:Bt({annotations:he,timeScale:this._timeScale,valueScales:this._valueScales,metrics:this._textMetrics})}),this._annotationBands.length>0){let b=m+c+this._layout.margin.bottom,T=0;this._annotationBands.forEach(L=>{let P=L.height??12,W=L.spacing??0,I=b+T;(L.showAxis??false)&&(T+=26+W),T+=P+W,f.push({type:"group",cssClass:"annotation-band",commands:new Oe({name:L.name,showAxis:L.showAxis??false,items:L.items,timeScale:this._timeScale,background:L.background,hatch:L.hatch},[h,h+u],I,P).render()});});}let{xs:ke,belegt:me}=$n(G.map(b=>({achseX:b.achseX,kante:b.kante,position:b.position,schrift:b.style?.fontSize??y.axisLabelSize})),_,l.totalWidth);if(t&&n!=="separate"){let b,T;if(n==="inside-right")b=h+u-s.width-8-a,T=m+8+a;else if(n==="inside-left")b=h+8+a,T=m+8+a;else if(n==="outside-right"){let L=me.filter(P=>P.position==="right").reduce((P,W)=>Math.max(P,W.bis),h+u);b=Math.min(Math.max(h+u+16,L+12),l.totalWidth-s.width-2),T=m;}else n==="above"||n==="below"?(b=Math.max(8,Math.min(l.totalWidth-s.width-8,h+(u-s.width)/2)),T=n==="above"?Math.max(4,m-s.height-10):l.totalHeight-s.height-4):(b=8,T=m);f.push($t({items:e,x:b,y:T,orientation:r,metrics:this._textMetrics,maxBreite:o,box:this._legend?.box,itemClass:this._legend?.itemClass}));}let Ue=D?void 0:this._axes?.left?.label,qe=D?void 0:this._axes?.right?.label,Ze=this._axes?.x?.label;if(Ue||qe||Ze||G.length){let b=[],T=m+c/2,L=this._axes?.left?.labels,P=this._axes?.right?.labels,W=this._axes?.x?.labels;Ue&&b.push({type:"text",content:Ue,x:14,y:T,anchor:"middle",fontSize:L?.fontSize??y.axisLabelSize,fill:L?.color??y.axisLabelColor,rotate:-90}),qe&&b.push({type:"text",content:qe,x:l.totalWidth-14,y:T,anchor:"middle",fontSize:P?.fontSize??y.axisLabelSize,fill:P?.color??y.axisLabelColor,rotate:90}),G.forEach((I,X)=>{b.push({type:"text",content:I.text,x:ke[X],y:T,anchor:"middle",fontSize:I.style?.fontSize??y.axisLabelSize,fill:I.style?.color??y.axisLabelColor,rotate:I.position==="right"?90:-90});}),Ze&&b.push({type:"text",content:Ze,x:h+u/2,y:l.totalHeight-6,anchor:"middle",fontSize:W?.fontSize??y.axisLabelSize,fill:W?.color??y.axisLabelColor}),b.length&&f.push({type:"group",cssClass:"axis-labels",commands:b});}return Vt(f,this._fontFamily??y.fontFamily),f}_renderSeries(e,t,n,r=0){let o=this._timeScale,s={timeScale:o,valueScale:t};if(Se(e)){let _=e.style?.line&&!Array.isArray(e.style.line)?e.style.line:void 0,D=typeof e.style?.fill=="string"?e.style.fill:void 0;return e.showAs==="minmaxavg"?new We({data:e.data,timeScale:o,valueScale:t,minColor:e.minColor,maxColor:e.maxColor,avgColor:e.avgColor,avgDashed:e.avgDashed,fillToMax:e.fillToMax,fillToMaxHatch:e.fillToMaxHatch,fillToMin:e.fillToMin,fillToMinHatch:e.fillToMinHatch,smoothing:_?.smoothing,smoothingType:_?.smoothingType,strokeWidth:_?.width,id:se(e.name,e.id)}).render():new Re({data:e.data,timeScale:o,valueScale:t,fill:D??_?.color,avgLine:e.avgLine,countOpacity:e.countOpacity,id:se(e.name,e.id)}).render()}let a=e,l=e.style?.line&&!Array.isArray(e.style.line)?e.style.line:void 0,h=this._gapsAutoDetect?this._gapsMinGapMs:void 0,m=l?.gapThreshold??h??y.gapThreshold,u=z.getRuns(e.data,_=>_.value===null,m),c=u.reduce((_,D)=>_+D.length,0);if(c===0)return [];let g=[],d=e.style?.markers,f=e.style?.shadow,p={stroke:l?.color??this._palettenFarbe(r),strokeWidth:l?.width??y.strokeWidth,smoothing:l?.smoothing,smoothingType:l?.smoothingType,dashed:l?.style==="dashed",pointStyle:d?.type,pointSize:d?.size,pointStroke:d?.stroke,pointFill:d?.fill,pointStrokeWidth:d?.strokeWidth,shadowColor:f?.color,shadowBlur:f?.blur,shadowOffsetX:f?.offsetX,shadowOffsetY:f?.offsetY,id:se(e.name,e.id)},S=e.style?.line,v=((Array.isArray(S)?S[0]:l)?.shape??a.seriesType)==="step",k=e.style?.fill;if(k!==void 0){let _=t.range(),D=Math.min(_[0],_[1]),F=Math.max(_[0],_[1]);g.push(...Wt(k,{runs:u,timeScale:o,valueScale:t,thresholds:n,chartTop:D,chartBottom:F,smoothing:l?.smoothing,smoothingType:l?.smoothingType,shape:v?"step":"line",fremdeSerie:R=>{let B=this._series.find(K=>(K.id??K.name)===R||K.name===R);if(!B||!("data"in B))return;let O=B.data;if(O.length===0||!("value"in O[0]))return;let M=B.style?.line,C=Array.isArray(M)?M[0]:M,Z=(typeof C=="object"&&C!==null?C.shape:void 0)==="step"||B.seriesType==="step";return {data:O,shape:Z?"step":"line"}},idPrefix:se(e.name,e.id)}));}let A=a.colorByThresholds??[],j=A.map(_=>n.get(_)).filter(_=>!!_).map(_=>_.value).sort((_,D)=>_-D),$=(_,D,F)=>{let R=F??p.stroke,B=Number.NEGATIVE_INFINITY;for(let O of D){let M=n.get(O);!M||_<M.value||M.value<B||(B=M.value,R=M.color??R);}return R},H=new Map;for(let _ of u){let R=function(M){return z.splitByBoundaries(M==="step"?fe(_):_,j,C=>C.value,z.interpolateDataPoint)};if(_.length<1)continue;let D=se(a.name,a.id),F=new Map,B=M=>{let C=F.get(M);return C||(C=R(M),F.set(M,C)),C},O=(M,C,q)=>{let Z=B(M);for(let K=0;K<Z.length;K++){let J=Z[K],he=H.get(q)??0;if(H.set(q,he+1),J.data.length<1)continue;let ke=J.zoneLow;if(J.data.length===1){let me=$(ke,A,C.color);g.push({type:"circle",id:D?`${D}-dot-${he}${q}`:void 0,cx:o.map(J.data[0].time),cy:t.map(J.data[0].value),r:Math.max(p.pointSize??y.pointSize,C.width??p.strokeWidth??y.strokeWidth),fill:me,shadowColor:p.shadowColor,shadowBlur:p.shadowBlur});continue}g.push({type:"path",cssClass:"series-line",id:D?`${D}-line-${he}${q}`:void 0,points:J.data.map(me=>({x:o.map(me.time),y:t.map(me.value)})),stroke:$(ke,A,C.color),strokeWidth:C.width??p.strokeWidth,smoothing:M==="step"?false:C.smoothing??p.smoothing,smoothingType:C.smoothingType??p.smoothingType,dash:C.style,opacity:C.opacity,fill:"none",shadowColor:p.shadowColor,shadowBlur:p.shadowBlur,shadowOffsetX:p.shadowOffsetX,shadowOffsetY:p.shadowOffsetY});}};S===false||(Array.isArray(S)?S.forEach((M,C)=>{O(M.shape??(a.seriesType==="step"?"step":"line"),M,`-${C}`);}):O(v?"step":"line",S??{},"")),p.pointStyle&&p.pointStyle!=="none"&&c<=(d?.threshold??y.pointThreshold)&&g.push(...Ct(_,s,p,M=>$(M.value,A)));}let V=e.overlays;if(V&&V.length>0){let _=t.range(),D={data:e.data,timeScale:o,valueScale:t,chartTop:Math.min(_[0],_[1]),chartBottom:Math.max(_[0],_[1]),idPrefix:se(e.name,e.id)};V.forEach((F,R)=>{g.push(...Gt(F,D,R));});}if(e.style?.gap&&u.length>1){let _=e.style.gap,D=_.bridge,F=[];for(let R=1;R<u.length;R++){let B=u[R-1][u[R-1].length-1],O=u[R][0];if(_.display==="bridge_line"){if(B.value===null||O.value===null)continue;g.push({type:"line",x1:o.map(B.time),y1:t.map(B.value),x2:o.map(O.time),y2:t.map(O.value),stroke:D?.color??(typeof e.style?.line=="object"&&!Array.isArray(e.style.line)?e.style.line.color:void 0)??y.stroke,strokeWidth:D?.width??1.5,dash:D?.style??"dotted"});}else F.push({startTime:B.time,endTime:O.time});}if(F.length>0){let R=_.display&&_.display!=="bridge_line"?_.display:"dashed_border",B=_.fill,O=typeof B=="string"?B:B?.color,M=t.range();g.push(...at({gaps:F.map(C=>({...C,style:R})),timeScale:o,yRange:[Math.min(M[0],M[1]),Math.max(M[0],M[1])],fill:O,hatch:typeof B=="object"?B.hatch:void 0,fillOpacity:_.opacity??.15,labelBaseline:_.label?.baseline,labelRotate:_.label?.rotate,metrics:this._textMetrics,band:_.band}));}}return g}_interpolateValue(e,t){for(let n=1;n<t.length;n++){let r=t[n-1],o=t[n];if(!(r.value===null||o.value===null)&&e>=r.time&&e<=o.time){if(o.time===r.time)return r.value;let s=(e-r.time)/(o.time-r.time);return r.value+s*(o.value-r.value)}}}legendItems(){return this._legendItems()}_palettenFarbe(e){let t=y.palette;return t.length>0?t[e%t.length]:y.stroke}_zustaendeVon(e){let t=new Set;for(let n of e){let r=n.enumMap;if(r)for(let o of Object.keys(r))t.add(Number(o));}return t.size>0?[...t].sort((n,r)=>n-r):void 0}_zustandName(e){let t={};for(let n of e){let r=n.enumMap;if(r)for(let[o,s]of Object.entries(r))Number(o)in t||(t[Number(o)]=s);}return n=>t[n]??String(n)}_legendItems(){return this._series.map((e,t)=>{let n=e.style?.line&&!Array.isArray(e.style.line)?e.style.line:void 0,r=e.style?.markers,o=r?.type&&r.type!=="none"&&(r.threshold===void 0||(e.data?.length??0)<=r.threshold),s=Se(e)?e.avgColor??y.avgColor:this._palettenFarbe(t);return {name:e.name,color:n?.color??s,line:n?.style,marker:o?r.type:void 0,id:oe(e.id??e.name)}})}get renderer(){return this._renderer}get layout(){return this._layout}get timeScale(){return this._timeScale}get valueScales(){return this._valueScales}invertTime(e){return this._timeScale?this._timeScale.invert(e):0}invertValue(e,t=0){let n=this._valueScales.get(t);return n?n.invert(e):0}project(e,t,n=0){let r=this._timeScale?this._timeScale.map(e):0,o=this._valueScales.get(n);return {x:r,y:o?o.map(t):0}}};function zt(i){let e=[];for(let t=0;t<i.length-1;t++){let n=i[t+1].x-i[t].x;e.push(n===0?0:(i[t+1].y-i[t].y)/n);}return e}function Dn(i){let e=zt(i),t=i.length,n=[...e];for(let r=1;r<t-1;r++)n[r]=e[r-1]*e[r]<=0?0:(e[r-1]+e[r])/2;n[t-1]=e[t-2];for(let r=0;r<t-1;r++){if(e[r]===0){n[r]=0,n[r+1]=0;continue}let o=n[r]/e[r],s=n[r+1]/e[r],a=o*o+s*s;if(a>9){let l=3/Math.sqrt(a);n[r]=l*o*e[r],n[r+1]=l*s*e[r];}}return n}function Pn(i){let e=zt(i),t=i.length;if(e.length<2)return i.map(()=>e[0]??0);let n=e[0],r=e[1],o=e[e.length-1],s=e[e.length-2],a=2*n-r,l=2*o-s,h=[2*a-n,a,...e,l,2*l-o],m=[];for(let u=0;u<t;u++){let c=Math.abs(h[u+3]-h[u+2]),g=Math.abs(h[u+1]-h[u]);m.push(c+g===0?(h[u+1]+h[u+2])/2:(c*h[u+1]+g*h[u+2])/(c+g));}return m}function jn(i,e){let t=[];for(let n=0;n<i.length-1;n++){let r=i[n],o=i[n+1],s=(o.x-r.x)/3;t.push({p0:r,c1:{x:r.x+s,y:r.y+e[n]*s},c2:{x:o.x-s,y:o.y-e[n+1]*s},p1:o});}return t}function Xt(i,e){if(i.length<2)return [];let t=e==="akima"?Pn(i):Dn(i);return jn(i,t)}var ut="1.12.1";var Fn=` <!-- MLTimeGraph ${ut} -->`,Yt=1e3;function x(i){return String(Math.round(i*Yt)/Yt)}function ct(i){return Qe(i).toString(16).padStart(8,"0")}function Bn(i){switch(i){case "top":return "text-top";case "bottom":return "text-bottom";default:return "middle"}}var ie=class extends Ae{#e="100%";#t="100%";#n;#i=new Map;#r=new Map;#o=new Map;constructor(e){super(),e?.width!==void 0&&(this.#e=e.width),e?.height!==void 0&&(this.#t=e.height),e?.background!==void 0&&(this.#n=e.background);}setBackgroundColor(e){this.#n=e;}render(e){this.#i.clear(),this.#r.clear(),this.#o.clear();let t=e.map(h=>this._toSVG(h));this.#n&&t.unshift(`<rect width="100%" height="100%" fill="${this._esc(this.#n)}" />`);let n=t.join(`
|
|
25
|
-
|
|
24
|
+
`.trim()}function Ge(n,e=2,t=false){return n==="dashed"||!n&&t?{strokeDasharray:"4,4"}:n==="dotted"?{strokeDasharray:"2,4"}:!n||n==="solid"?null:qe(n,e)}function qe(n,e=2){let t=e;switch(n){case "dotted":return {strokeDasharray:`0, ${t*2}`,strokeLinecap:"round"};case "sparse-dots":return {strokeDasharray:`0, ${t*4}`,strokeLinecap:"round"};case "dashed":return {strokeDasharray:`${t*3}, ${t*2}`,strokeLinecap:"butt"};case "long-dash":return {strokeDasharray:`${t*6}, ${t*3}`,strokeLinecap:"butt"};case "dense-dash":return {strokeDasharray:`${t*1.5}, ${t*1.5}`,strokeLinecap:"butt"};case "dash-dot":return {strokeDasharray:`${t*4}, ${t*2}, 0, ${t*2}`,strokeLinecap:"round"};case "dash-dot-dot":return {strokeDasharray:`${t*5}, ${t*2}, 0, ${t*2}, 0, ${t*2}`,strokeLinecap:"round"};case "loose-dash":return {strokeDasharray:`${t*3}, ${t*4}`,strokeLinecap:"butt"};default:return {strokeDasharray:"none",strokeLinecap:"butt"}}}var b=new Proxy({},{get:(n,e)=>Q()[e],has:(n,e)=>e in Q(),ownKeys:()=>Reflect.ownKeys(Q()),getOwnPropertyDescriptor:(n,e)=>Reflect.getOwnPropertyDescriptor(Q(),e)});function de(n,e){if(e<=0||n.length<2)return [];let t=[];for(let r=0;r<n.length-1;r++){let i=n[r],o=n[r+1];for(let s=1;s<=e;s++)t.push(i+(o-i)*s/(e+1));}return t}var ae={axisColor:b.axisColor,tickColor:b.tickColor,textColor:b.textColor,textSize:b.textSize},ee=class{#e;#t;constructor(e){this.#e=new J({domain:e.domain,range:e.xRange,locale:e.locale,timeZone:e.timeZone}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??ae).axisColor}get tickColor(){return (this.#t.colors??ae).tickColor}get textColor(){return (this.#t.colors??ae).textColor}get textSize(){return (this.#t.colors??ae).textSize}generateTicks(){let e=this.#t.minTicks??5,t=this.#t.maxTicks??12,i=this.#e.ticks({minTicks:e,maxTicks:t}).map(o=>({time:o,x:this.#e.map(o),label:this.tickLabel(o)}));return this.antiOverlap(i)}tickLabel(e){if(this.#t.format)return this.#t.format(new Date(e));let t=this.#t.minTicks??5,r=this.#t.maxTicks??12,{interval:i}=this.#e.tickInterval((t+r)/2,t,r),o={};return i<6e4?(o.hour="2-digit",o.minute="2-digit",o.second="2-digit"):i<36e5||i<864e5?(o.hour="2-digit",o.minute="2-digit"):i<31536e6?(o.day="numeric",o.month="short",i>=2592e6&&(o.day=void 0,o.month="long")):(o.year="numeric",i<2*31536e6&&(o.month="short")),this.#e.format(e,o)}antiOverlap(e){if(e.length<=1)return e;let t=60,r=[e[0]];for(let i=1;i<e.length;i++){let o=r[r.length-1].x;Math.abs(e[i].x-o)>=t&&r.push(e[i]);}return r}render(){let e=this.generateTicks(),t=this.#t.colors??ae,r=this.#t.y??0,i=[],[o,s]=this.#e.range();i.push({type:"line",x1:o,y1:r,x2:s,y2:r,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let a of this.generateMinorTicks())i.push({type:"line",x1:a,y1:r,x2:a,y2:r+3,stroke:t.tickColor,strokeWidth:t.axisWidth});for(let a of e)i.push({type:"line",x1:a.x,y1:r,x2:a.x,y2:r+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),i.push({type:"text",content:a.label,x:this.#n(a.x,a.label,t.textSize),y:r+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return i}generateMinorTicks(){return de(this.generateTicks().map(e=>e.x),this.#t.minorTicks??0)}#n(e,t,r){let i=this.#t.gesamtbreite,o=this.#t.metrics;if(i===void 0||o===void 0)return e;let s=o(t,r)/2;return Math.max(s+2,Math.min(i-s-2,e))}};function te(n){return "showAs"in n&&!!n.showAs}function Je(n){if(te(n)){let e=[];for(let t of n.data)t.min!==null&&e.push(t.min),t.max!==null&&e.push(t.max);return e}return n.data.map(e=>e.value).filter(e=>e!==null)}function pe(n){return {axisColor:n?.color??b.axisColor,tickColor:n?.color??b.tickColor,textColor:b.textColor,textSize:b.textSize,axisWidth:n?.width??1}}function Qe(n,e,t,r){if(r===void 0)return [n,e];let i=typeof r=="number"?r:r.top??0,o=typeof r=="number"?r:r.bottom??0;if(i<=0&&o<=0)return [n,e];let s=t-i-o,a=e-n;if(s<=0||a<=0)return [n,e];let m=a/s;return [n-o*m,e+i*m]}function fe(n,e){return n!==void 0?n:e!==void 0&&e!==false?1:0}var tn=[[32,126,"278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584"],[160,255,"278,333,556,556,556,556,260,556,333,737,370,556,584,333,737,552,400,549,333,333,333,576,537,333,333,333,365,556,834,834,834,611,667,667,667,667,667,667,1000,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,500,556,556,556,556,278,278,278,278,556,556,556,556,556,556,556,549,611,556,556,556,556,500,556,500"]],Oe=.6,nn=(()=>{let n=new Map;for(let[e,,t]of tn){let r=t.split(",");for(let i=0;i<r.length;i++)n.set(e+i,Number(r[i])/1e3);}return n})();function et(n){return nn.get(n)??Oe}var V=(n,e)=>{let t=0;for(let r of n)t+=et(r.codePointAt(0)??0);return t*e},rn=(n,e)=>[...n].length*e*Oe;function tt(n,e,t){let r=0;for(let i of n)r=Math.max(r,t(i,e));return r}var ne={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function nt(n){return Math.abs(n)>=1e6?`${(n/1e6).toFixed(1)}M`:Math.abs(n)>=1e3?`${(n/1e3).toFixed(1)}k`:Number.isInteger(n)?String(n):n.toFixed(1)}function on(n){let e=new Array(n.length).fill(false),t=0;for(;t<n.length;){let r=t;for(;r+1<n.length&&n[r+1].label===n[t].label;)r++;for(let i=t+1;i<r;i++)e[i]=true;t=r+1;}return e}var ge=class{#e;#t;constructor(e){this.#e=new Z({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??ne).axisColor}get tickColor(){return (this.#t.colors??ne).tickColor}get textColor(){return (this.#t.colors??ne).textColor}get textSize(){return (this.#t.colors??ne).textSize}generateTicks(){let e=this.#t.tickValues;if(e&&e.length>0){let f=this.#t.format??nt;return e.map(g=>({value:g,position:this.#e.map(g),label:f(g)}))}let t=this.#t.format??nt,r=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[i,o]=this.#e.domain(),s=Math.min(i,o),a=Math.max(i,o),m=a-s;if(m===0)return [{value:i,position:this.#e.map(i),label:t(i)}];let l=m/r,h=Math.pow(10,Math.floor(Math.log10(l))),u=l/h,c;if(u<=1.5?c=h:u<=3?c=2*h:u<=7?c=5*h:c=10*h,c<=0||!Number.isFinite(c))return [{value:i,position:this.#e.map(i),label:t(i)}];let p=[],d=Math.ceil(s/c)*c;for(let f=d;f<=a;f+=c)p.push({value:f,position:this.#e.map(f),label:t(f)});return p}generateMinorTicks(){return de(this.generateTicks().map(e=>e.position),this.#t.minorTicks??0)}render(){let e=this.generateTicks(),t=this.#t.colors??ne,r=this.#t.x??0,i=this.#t.orientation??"vertical",o=this.#t.position??"left",s=this.#t.suppressLabelsNear??[],a=this.#t.suppressTolerancePx??8,m=u=>s.some(c=>Math.abs(c-u)<=a),l=[];if(i==="vertical"){let[u,c]=this.#e.range();l.push({type:"line",x1:r,y1:u,x2:r,y2:c,stroke:t.axisColor,strokeWidth:t.axisWidth});let p=on(e);e.forEach((d,f)=>{let g=m(d.position),y=p[f]?{opacity:0}:{};o==="left"?(l.push({type:"line",x1:r-4,y1:d.position,x2:r,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||l.push({type:"text",content:d.label,x:this.#n(r-8,d.label,"end"),y:d.position+4,anchor:"end",fontSize:t.textSize,fill:t.textColor,...y})):(l.push({type:"line",x1:r,y1:d.position,x2:r+4,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||l.push({type:"text",content:d.label,x:this.#n(r+8,d.label,"start"),y:d.position+4,anchor:"start",fontSize:t.textSize,fill:t.textColor,...y}));});}else {let[u,c]=this.#e.range();l.push({type:"line",x1:u,y1:r,x2:c,y2:r,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let p of e)l.push({type:"line",x1:p.position,y1:r,x2:p.position,y2:r+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),l.push({type:"text",content:p.label,x:p.position,y:r+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}let h=(this.#t.orientation??"vertical")==="vertical";for(let u of this.generateMinorTicks())l.push(h?{type:"line",x1:o==="right"?r:r-2,y1:u,x2:o==="right"?r+2:r,y2:u,stroke:t.tickColor,strokeWidth:t.axisWidth}:{type:"line",x1:u,y1:r,x2:u,y2:r+3,stroke:t.tickColor,strokeWidth:t.axisWidth});return l}#n(e,t,r){let i=this.#t.gesamtbreite,o=this.#t.metrics;if(i===void 0||o===void 0)return e;let s=o(t,(this.#t.colors??ne).textSize);return r==="end"?Math.max(s+2,Math.min(i-2,e)):Math.min(i-s-2,Math.max(2,e))}};function rt(n){let e=new Set,t={};for(let r of n){let i=r.enumMap;if(i)for(let[o,s]of Object.entries(i)){let a=Number(o);e.add(a),a in t||(t[a]=s);}}return {werte:e.size>0?[...e].sort((r,i)=>r-i):void 0,name:r=>t[r]??String(r)}}function it(n){let{axes:e,indices:t,seriesByIndex:r,layout:i,thresholds:o,metrics:s}=n,{chartX:a,chartY:m,chartWidth:l,chartHeight:h}=i,u=[],c=new Map,p,d=[],f=[],g=(e?.y?.length??0)>0,y=0,x=0;for(let S of t){let k=r.get(S),_=1/0,$=-1/0,A=false;for(let j of k)for(let he of Je(j))he<_&&(_=he),he>$&&($=he),A=true;if(!A)continue;_===$&&(_-=1,$+=1);let C=S===0?e?.left:S===1?e?.right:void 0,B=e?.y&&e.y.length>S?e.y[S]:void 0,M=B&&C?{...C,...B}:B??C,F=M?.domain,D=F&&F!=="auto"?F:Qe(_,$,h,M?.padding),{werte:P,name:E}=rt(k);if(P){let j=P.length>1?(P[P.length-1]-P[0])/(P.length-1):1;D[0]=P[0]-j/2,D[1]=P[P.length-1]+j/2;}let G=new Z({domain:D,range:[m+h,m]});c.set(S,G);let O=M?.position??(S===0?"left":"right"),T=O==="right"?"outside-right":"outside-left",v=o.filter(j=>(j.axisIndex??0)===S&&typeof j.label=="object"&&j.label!==null&&j.label.position===T&&j.value>=Math.min(D[0],D[1])&&j.value<=Math.max(D[0],D[1])).map(j=>G.map(j.value)),L;if(O==="right"){let j=M?.offset??x*50;L=a+l+j,x++;}else {let j=M?.offset??y*50;L=a-j,y++;}let R=new ge({domain:D,range:[m+h,m],x:L,position:O,format:M?.format??(P?E:void 0),tickValues:P,ticks:M?.ticks?.major,minorTicks:fe(M?.ticks?.minor,U(M?.grid)?.minor),colors:pe(M?.axis),suppressLabelsNear:v.length?v:void 0,gesamtbreite:i.totalWidth,metrics:s}),q=8+tt(R.generateTicks().map(j=>j.label),11,s),oe=O==="right"?L+q:L-q;f.push({position:O,von:Math.min(L,oe),bis:Math.max(L,oe)}),g&&M?.label&&d.push({text:M.label,achseX:L,kante:oe,position:O,style:M.labels}),S===0&&(p=R),u.push({type:"group",cssClass:`value-axis ${O}`,sharedStyles:true,commands:R.render()});}return {commands:u,titel:d,baender:f,neueForm:g,primary:p,scales:c}}var I=class{static interpolateDataPoint(n,e,t){return {time:n.time+Math.round(t*(e.time-n.time)),value:(n.value??0)+t*((e.value??0)-(n.value??0)),synthetic:true}}static interpolateAggregatedPoint(n,e,t){let r=(i,o)=>i!==null&&o!==null?i+t*(o-i):null;return {time:n.time+t*(e.time-n.time),min:r(n.min,e.min),max:r(n.max,e.max),avg:r(n.avg,e.avg),count:Math.round(n.count+t*(e.count-n.count))}}static getRuns(n,e,t=0){let r=[...n].sort((a,m)=>a.time-m.time),i=[],o=[],s=null;for(let a of r){let m=e(a),l=t>0&&s&&a.time-s.time>t;(m||l)&&o.length&&(i.push(o),o=[]),m||o.push(a),s=a;}return o.length&&i.push(o),i}static splitByBoundaries(n,e,t,r){if(n.length===0)return [];if(e.length===0)return [{data:n,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let i=[...e].sort((l,h)=>l-h),o=[],s=l=>l<=0?Number.NEGATIVE_INFINITY:i[l-1],a=l=>{let h=0;for(let u=0;u<i.length&&l>=i[u];u++)h=u+1;return h},m=[n[0]];for(let l=1;l<n.length;l++){let h=n[l-1],u=n[l],c=t(h),p=t(u),d;p>c?d=i.filter(g=>g>c&&g<=p):p<c?d=i.filter(g=>g>=p&&g<c).reverse():d=[];let f=c;for(let g of d){let y=(g-c)/(p-c),x=r(h,u,y);m.push(x);let S=a((f+g)/2);o.push({data:m,zoneIndex:S,zoneLow:s(S)}),m=[x],f=g;}(d.length===0||d[d.length-1]!==p)&&m.push(u);}if(m.length>1||n.length===1){let l=t(m[0]),h=t(m[m.length-1]),u=a((l+h)/2);o.push({data:m,zoneIndex:u,zoneLow:s(u)});}return o}static splitByThreshold(n,e,t,r){let i=this.splitByBoundaries(n,[e],t,r),o={above:[],below:[]};for(let s of i)s.zoneIndex===0?o.below.push(s.data):o.above.push(s.data);return o}};function ot(n,e=6e4){if(n.length<2)return [];let t=[...n].sort((i,o)=>i.time-o.time),r=[];for(let i=1;i<t.length;i++)t[i].time-t[i-1].time>e&&r.push({startTime:t[i-1].time,endTime:t[i].time});return r}function sn(n,e=83144){let t=e/8.314,r=0,i=0;for(let s of n)s!==null&&(r+=Math.exp(-t/(s+273.15)),i++);if(i===0)return null;let o=r/i;return t/-Math.log(o)-273.15}function st(n,e,t=83144){let r=new Array(n.length),i=0;for(let o=0;o<n.length;o++){let s=n[o].time,a=s-e;for(;i<o&&n[i].time<a;)i++;let m=n.slice(i,o+1).map(h=>h.value),l=sn(m,t);r[o]={time:s,value:l,synthetic:true};}return r}function an(n){let e=0,t=0;for(let o of n)o!==null&&(e+=o,t++);if(t===0)return null;let r=e/t,i=0;for(let o of n){if(o===null)continue;let s=o-r;i+=s*s;}return Math.sqrt(i/t)}function ln(n){let e=0,t=0;for(let o of n)o!==null&&(e+=o,t++);if(t<2)return null;let r=e/t,i=0;for(let o of n){if(o===null)continue;let s=o-r;i+=s*s;}return Math.sqrt(i/(t-1))}function at(n,e,t=false){let r=new Array(n.length),i=0,o=t?ln:an;for(let s=0;s<n.length;s++){let a=n[s].time,m=a-e;for(;i<s&&n[i].time<m;)i++;let l=n.slice(i,s+1).map(u=>u.value),h=o(l);r[s]={time:a,value:h,synthetic:true};}return r}function We(n,e){let t=new Array(n.length),r=0;for(let i=0;i<n.length;i++){let o=n[i].time,s=o-e;for(;r<i&&n[r].time<s;)r++;let a=0,m=0;for(let l=r;l<=i;l++){let h=n[l].value;h!==null&&(a+=h,m++);}t[i]={time:o,value:m===0?null:a/m,synthetic:true};}return t}function lt(n,e){let t=new Array(n.length),r=null,i=0;for(let o=0;o<n.length;o++){let s=n[o].time,a=n[o].value;if(a===null){t[o]={time:s,value:r,synthetic:true};continue}if(r===null||e<=0)r=a;else {let m=1-Math.exp(-(s-i)/e);r=a*m+r*(1-m);}i=s,t[o]={time:s,value:r,synthetic:true};}return t}function N(n){let e=[];for(let t of n)e.length>0&&e.push({...t,value:e[e.length-1].value}),e.push(t);return e}var ye=class{};function mt(n,e,t,r){let i=xe(t);if(!i.markers.type||i.markers.type==="none")return [];let o=[];for(let s=0;s<n.length;s++){let a=n[s],m=e.timeScale.map(a.time),l=e.valueScale.map(a.value),h=r(a),u=t.pointStroke??h,c=t.pointFill??h,p=t.pointStrokeWidth??1.5,d=t.id?`${t.id}-marker-${s}`:void 0;be(o,d,i.markers.type,m,l,i.markers.size,u,c,p);}return o.length===0?[]:[{type:"group",cssClass:"series-markers",sharedStyles:true,commands:o}]}function be(n,e,t,r,i,o,s,a,m){let l=h=>e===void 0?void 0:`${e}-${h}`;switch(t){case "circle":n.push({type:"circle",cx:r,cy:i,r:o,fill:a,stroke:s,strokeWidth:m,id:e});break;case "square":n.push({type:"rect",x:r-o,y:i-o,w:o*2,h:o*2,fill:a,stroke:s,strokeWidth:m,id:e});break;case "cross":n.push({type:"line",x1:r-o,y1:i-o,x2:r+o,y2:i+o,stroke:s,strokeWidth:m,id:e},{type:"line",x1:r-o,y1:i+o,x2:r+o,y2:i-o,stroke:s,strokeWidth:m,id:l(2)});break;case "diamond":n.push({type:"path",points:[{x:r,y:i-o},{x:r+o,y:i},{x:r,y:i+o},{x:r-o,y:i}],closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break;case "triangle":n.push({type:"path",points:[{x:r,y:i-o},{x:r+o,y:i+o},{x:r-o,y:i+o}],closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break;case "star":{let h=[];for(let u=0;u<10;u++){let c=u%2===0?o:o*.5,p=Math.PI/2*3+u*Math.PI/5;h.push({x:r+c*Math.cos(p),y:i+c*Math.sin(p)});}n.push({type:"path",points:h,closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break}case "arrow":n.push({type:"path",points:[{x:r-o,y:i+o},{x:r,y:i-o},{x:r+o,y:i+o}],stroke:s,strokeWidth:m,fill:"none",id:e});break;case "plus":n.push({type:"line",x1:r-o,y1:i,x2:r+o,y2:i,stroke:s,strokeWidth:m,id:e},{type:"line",x1:r,y1:i-o,x2:r,y2:i+o,stroke:s,strokeWidth:m,id:l(2)});break;case "triangle-down":n.push({type:"path",points:[{x:r,y:i+o},{x:r+o,y:i-o},{x:r-o,y:i-o}],closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break;case "hexagon":{let h=[];for(let u=0;u<6;u++){let c=u*(Math.PI/3);h.push({x:r+o*Math.cos(c),y:i+o*Math.sin(c)});}n.push({type:"path",points:h,closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break}case "hourglass":n.push({type:"path",points:[{x:r-o,y:i-o},{x:r+o,y:i-o},{x:r-o,y:i+o},{x:r+o,y:i+o}],closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break;case "line-horizontal":n.push({type:"line",x1:r-o,y1:i,x2:r+o,y2:i,stroke:s,strokeWidth:m,id:e});break;default:n.push({type:"circle",cx:r,cy:i,r:o,fill:a,stroke:s,strokeWidth:m,id:e});}}var Se=class n{#e=[];get commands(){return [...this.#e]}get length(){return this.#e.length}line(e){return this.#e.push({type:"line",...e}),this}path(e){return this.#e.push({type:"path",...e}),this}rect(e){return this.#e.push({type:"rect",...e}),this}circle(e){return this.#e.push({type:"circle",...e}),this}text(e){return this.#e.push({type:"text",...e}),this}gap(e){return this.#e.push({type:"gap",...e}),this}push(...e){return this.#e.push(...e),this}group(e,t){let r=new n;return t(r),r.length===0?this:(this.#e.push({type:"group",...e,commands:r.commands}),this)}toGroup(e={}){return {type:"group",...e,commands:this.commands}}};var mn="#ffffff",hn="#cccccc",un=6,cn=.85,X=12,ke=8,le=20,dn=11,we=18,Ee=(n,e)=>e(n,dn);function ht(n,e,t){let r=a=>X+ke+Ee(a.name,e);if(t===void 0){let a=n.reduce((m,l)=>m+r(l)+we,0)-we;return [{items:n,breite:Math.max(0,a)}]}let i=[],o=[],s=0;for(let a of n){let m=r(a),l=o.length===0?m:s+we+m;o.length>0&&l>t?(i.push({items:o,breite:s}),o=[a],s=m):(o=[...o,a],s=l);}return o.length>0&&i.push({items:o,breite:s}),i}function ut(n,e="vertical",t=V,r){if(e==="horizontal"){let o=ht(n,t,r);return {width:o.reduce((s,a)=>Math.max(s,a.breite),0),height:o.length*le}}let i=0;for(let o of n)i=Math.max(i,Ee(o.name,t));return {width:X+ke+i,height:n.length*le}}function pn(n){let{items:e,x:t,y:r,orientation:i="vertical",metrics:o=V,maxBreite:s,box:a,itemClass:m}=n,l=new Se;if(a&&e.length>0){let c=ut(e,i,o,s),d=((i==="horizontal"?c.height/le:e.length)-1)*le+X,f=a.padding??un,g=a.stroke??hn;l.rect({x:t-f,y:r-f,w:c.width+2*f,h:d+2*f,fill:a.fill??mn,...g==="none"?{}:{stroke:g,strokeWidth:a.strokeWidth??1},opacity:a.opacity??cn});}let h=i==="horizontal"?ht(e,o,s):e.map(c=>({items:[c],breite:0})),u=new Map;return h.forEach((c,p)=>{let d=t;for(let f of c.items)u.set(f,{x:d,y:r+p*le}),d+=X+ke+Ee(f.name,o)+we;}),e.forEach(c=>{let p=u.get(c)??{x:t,y:r},d=p.x,f=p.y,g=["legend-item"];c.id&&g.push(`legend-item--${c.id}`),m&&g.push(m),l.group({cssClass:g.join(" "),...c.id?{id:`legend-${c.id}`}:{}},y=>{y.rect({x:d,y:f,w:X,h:X,fill:c.color,stroke:b.legendStroke,strokeWidth:1}).text({content:c.name,x:d+X+ke,y:f+X-2,fontSize:b.legendFont,fill:b.legendText});});}),l.toGroup({cssClass:"chart-legend"})}function ct(n){let{legend:e,items:t,gesamtbreite:r,metrics:i}=n,o=(e?.show??false)&&t.length>0,s=e?.position??"inside-right",a=e?.orientation??(s==="above"||s==="below"?"horizontal":"vertical"),m=s==="above"||s==="below"?r-16:void 0;return {items:t,show:o,position:s,orientation:a,maxBreite:m,size:o?ut(t,a,i,m):{width:0,height:0},boxRand:o&&e?.box?e.box.padding??6:0,box:e?.box,itemClass:e?.itemClass}}function dt(n,e){let t=n.position==="outside-right"||n.position==="outside-left"||n.position==="above"||n.position==="below";if(!n.show||!t)return null;let r={...e},i=2*n.boxRand;return n.position==="outside-right"?r.right+=n.size.width+i+16:n.position==="outside-left"?r.left+=n.size.width+i+16:n.position==="above"?r.top+=n.size.height+i+10:r.bottom+=n.size.height+i+10,r}function pt(n){let{legende:e,layout:t,randBelegt:r,metrics:i}=n;if(!e.show||e.position==="separate")return [];let{chartX:o,chartY:s,chartWidth:a}=t,m,l;if(e.position==="inside-right")m=o+a-e.size.width-8-e.boxRand,l=s+8+e.boxRand;else if(e.position==="inside-left")m=o+8+e.boxRand,l=s+8+e.boxRand;else if(e.position==="outside-right"){let h=r.filter(u=>u.position==="right").reduce((u,c)=>Math.max(u,c.bis),o+a);m=Math.min(Math.max(o+a+16,h+12),t.totalWidth-e.size.width-2),l=s;}else e.position==="above"||e.position==="below"?(m=Math.max(8,Math.min(t.totalWidth-e.size.width-8,o+(a-e.size.width)/2)),l=e.position==="above"?Math.max(4,s-e.size.height-10):t.totalHeight-e.size.height-4):(m=8,l=s);return [pn({items:e.items,x:m,y:l,orientation:e.orientation,metrics:i,maxBreite:e.maxBreite,box:e.box,itemClass:e.itemClass})]}function ft(n){let{xTicks:e,yTicks:t,xRange:r,yRange:i,stroke:o=b.gridStroke,strokeWidth:s=b.gridStrokeWidth,dashed:a=false,opacity:m=b.gridOpacity}=n,l=[];if(t)for(let h of t)l.push({type:"line",x1:r[0],y1:h,x2:r[1],y2:h,stroke:o,strokeWidth:s,dashed:a,opacity:m});if(e)for(let h of e)l.push({type:"line",x1:h,y1:i[0],x2:h,y2:i[1],stroke:o,strokeWidth:s,dashed:a,opacity:m});return l}function gt(n){let{axes:e,timeAxis:t,primaryValueAxis:r,xRange:i,yRange:o}=n,s=U(e?.x?.grid),a=U(e?.left?.grid),m=s?.layer??a?.layer??"front",l=s?.major,h=a?.major,u=_=>_!==void 0&&_!==false;if(!u(l)&&!u(h))return {group:null,layer:m};let c=l!==false,p=h!==false&&!!r,d=c?t.generateTicks().map(_=>_.x):void 0,f=p?r.generateTicks().map(_=>_.position):void 0;if(!d&&!f)return {group:null,layer:m};let g=(l&&typeof l=="object"?l:void 0)??(h&&typeof h=="object"?h:void 0),y=s?.minor,x=a?.minor,S=(y&&typeof y=="object"?y:void 0)??(x&&typeof x=="object"?x:void 0);return {group:{type:"group",cssClass:"chart-grid",sharedStyles:true,commands:[...y!==void 0||x!==void 0?ft({xTicks:y!==false&&c?t.generateMinorTicks():void 0,yTicks:x!==false&&p?r.generateMinorTicks():void 0,xRange:i,yRange:o,stroke:S?.color,opacity:S?.opacity??(b.gridOpacity??1)*.5,dashed:S?.style==="dashed"}):[],...ft({xTicks:d,yTicks:f,xRange:i,yRange:o,stroke:g?.color,opacity:g?.opacity,dashed:g?.style==="dashed"})]},layer:m}}function fn(n){return n==="dotted"?{dash:"dotted"}:n==="dashed"?{dash:"dashed"}:{}}function gn(n){let{thresholds:e,valueScale:t,xRange:r}=n,[i,o]=r,[s,a]=t.range(),m=Math.min(s,a),l=Math.max(s,a),h=[],u=[];for(let c of e){let p=c.color??b.thresholdColor,d=t.map(c.value);c.fill==="above"?h.push({type:"rect",x:i,y:m,w:o-i,h:Math.max(0,d-m),fill:p,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0}):c.fill==="below"&&h.push({type:"rect",x:i,y:d,w:o-i,h:Math.max(0,l-d),fill:p,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0});let f=c.line??b.thresholdLine;if(f!=="none"){let S=fn(f),k={type:"line",x1:i,y1:d,x2:o,y2:d,stroke:p,strokeWidth:1,...S,id:c.id?`${c.id}-line`:void 0};c.shadowColor&&(k.shadowColor=c.shadowColor,k.shadowBlur=c.shadowBlur??4,k.shadowOffsetX=c.shadowOffsetX??0,k.shadowOffsetY=c.shadowOffsetY??2),h.push(k);}let[g,y]=t.domain();if(c.value>=Math.min(g,y)&&c.value<=Math.max(g,y)&&c.label!==void 0&&c.label!==null&&c.label!==false){let S=typeof c.label=="object"?c.label:void 0,k=typeof c.label=="string"?c.label:S?.text??c.name,_=S?.position??"right",$=bn(k,_,i,o,d,p,S);u.push({...$,y:yn($.y,Math.min(s,a),Math.max(s,a),b.thresholdFontSize),id:c.id?`${c.id}-label`:void 0});}}return {inside:h,labels:u}}function yn(n,e,t,r){return Math.max(e+r,Math.min(t-r/2,n))}function bn(n,e,t,r,i,o,s){let a=(t+r)/2,m={type:"text",content:n,fontSize:b.thresholdFontSize,fill:o},l=s?{...s.rotate!==void 0&&{rotate:s.rotate},...s.textBaseline!==void 0&&{textBaseline:s.textBaseline}}:{};switch(e){case "left":return {...m,...l,x:t+4,y:i-4,anchor:"start"};case "above":return {...m,...l,x:a,y:i-6,anchor:"middle"};case "below":return {...m,...l,x:a,y:i+14,anchor:"middle"};case "center":return {...m,...l,x:a,y:i-4,anchor:"middle"};case "outside-left":return {...m,...l,x:t-6,y:i+3,anchor:"end",textBaseline:l.textBaseline??"middle"};case "outside-right":return {...m,...l,x:r+6,y:i+3,anchor:"start",textBaseline:l.textBaseline??"middle"};default:return {...m,...l,x:r-4,y:i-4,anchor:"end"}}}function yt(n){let{thresholds:e,valueScales:t,primaryScale:r,xRange:i,layout:o}=n,{chartX:s,chartY:a,chartWidth:m,chartHeight:l}=o,h=[];if(e.length===0)return h;let u=[],c=[];for(let p of e){let d=p.id??z(p.name),f=t.get(p.axisIndex??0)??r,g=gn({thresholds:[p],valueScale:f,xRange:i});g.inside.length&&u.push({type:"group",cssClass:`threshold threshold--${d}`,id:`threshold-${d}`,commands:g.inside}),g.labels.length&&c.push({type:"group",cssClass:`threshold-label threshold-label--${d}`,commands:g.labels});}return u.length&&h.push({type:"group",cssClass:"thresholds",commands:u,clipRect:{x:s,y:a,w:m,h:l}}),c.length&&h.push({type:"group",cssClass:"threshold-labels",commands:c}),h}function bt(n,e,t,r){switch(n){case "above":return e-5;case "below":return r!==void 0?r-5:t+14;case "center":case "middle":return (e+t)/2+4;case "bottom":return t-6;default:return e+14}}function Te(n){let{ranges:e,timeScale:t,yRange:r,height:i,metrics:o=V}=n,[s,a]=r,m=[],[l,h]=t.range(),u=Math.min(l,h),c=Math.max(l,h),p=d=>Math.max(u,Math.min(c,d));for(let d of e){let f=p(t.map(d.startTime)),g=p(t.map(d.endTime));if(d.fill!==void 0&&m.push({type:"rect",x:f,y:s,w:g-f,h:a-s,fill:d.fill,hatch:d.hatch,opacity:d.opacity}),d.edges)for(let y of [f,g])m.push({type:"line",x1:y,y1:s,x2:y,y2:a,stroke:d.edges.stroke,strokeWidth:d.edges.strokeWidth,dash:"dashed"});if(d.label){let y=d.labelPosition??"middle",x=d.rotate;if(x==="auto"){let S=y!=="above"&&y!=="below",k=o(d.label,d.fontSize??11);x=S&&k>Math.abs(g-f)-4?-90:void 0;}m.push({type:"text",content:d.label,x:(f+g)/2,y:bt(y,s,a,i),anchor:"middle",fontSize:d.fontSize,fill:d.labelColor,rotate:x});}}return m}function He(n){let{gaps:e,timeScale:t,yRange:r,height:i,fill:o=b.gapFill,hatch:s,fillOpacity:a=b.gapFillOpacity??.15,stroke:m=b.gapStroke,strokeWidth:l=b.gapStrokeWidth,dashed:h=true,fontSize:u=b.gapFontSize,fontFill:c=b.gapFontColor,labelBaseline:p="middle",labelRotate:d,metrics:f,band:g}=n,y=()=>{if(!g)return [];let x=g.height??6,[S,k]=r,_=Math.max(S,k);return e.map($=>{let A=t.map($.startTime),C=t.map($.endTime);return {type:"rect",x:Math.min(A,C),y:_-x+(g.offset??0),w:Math.abs(C-A),h:x,fill:g.fill??m,opacity:g.opacity??.75}})};return Te({timeScale:t,yRange:r,height:i,metrics:f,ranges:e.map(x=>{let S=x.style??"dashed_border",k=S==="filled"||S==="dashed_border",_=S==="dashed_border"&&h!==false;return {startTime:x.startTime,endTime:x.endTime,...k&&{fill:x.fill??o,hatch:x.hatch??s,opacity:x.fillOpacity??a},..._&&{edges:{stroke:m,strokeWidth:l}},label:x.label,labelPosition:x.labelBaseline??p,labelColor:c,fontSize:u,rotate:x.rotate??d}})}).concat(y())}function xt(n){let{gap:e,runs:t,timeScale:r,valueScale:i,metrics:o,lineColor:s}=n,a=[],m=e.bridge,l=[];for(let h=1;h<t.length;h++){let u=t[h-1][t[h-1].length-1],c=t[h][0];if(e.display==="bridge_line"){if(u.value===null||c.value===null)continue;a.push({type:"line",x1:r.map(u.time),y1:i.map(u.value),x2:r.map(c.time),y2:i.map(c.value),stroke:m?.color??s??b.stroke,strokeWidth:m?.width??1.5,dash:m?.style??"dotted"});}else l.push({startTime:u.time,endTime:c.time});}if(l.length>0){let h=e.display&&e.display!=="bridge_line"?e.display:"dashed_border",u=e.fill,c=typeof u=="string"?u:u?.color,p=i.range();a.push(...He({gaps:l.map(d=>({...d,style:h})),timeScale:r,yRange:[Math.min(p[0],p[1]),Math.max(p[0],p[1])],fill:c,hatch:typeof u=="object"?u.hatch:void 0,fillOpacity:e.opacity??.15,labelBaseline:e.label?.baseline,labelRotate:e.label?.rotate,metrics:o,band:e.band}));}return a}function St(n){let{markers:e,timeScale:t,valueScale:r,yRange:i=[0,300]}=n,[o,s]=i,a=[];for(let m of e){let l=t.map(m.time),h=m.color??b.markerColor,u=m.pointStyle??(m.value!==void 0?"circle":"none"),c=m.lineStyle??"full";if(m.value!==void 0){let p=r.map(m.value);if(c==="to-value"?a.push({type:"line",x1:l,y1:s,x2:l,y2:p,stroke:h,strokeWidth:1,dashed:true}):c==="to-top"?a.push({type:"line",x1:l,y1:o,x2:l,y2:p,stroke:h,strokeWidth:1,dashed:true}):c==="full"&&a.push({type:"line",x1:l,y1:o,x2:l,y2:s,stroke:h,strokeWidth:1}),u!=="none"&&be(a,void 0,u,l,p,b.markerSize,h,h,1.5),m.label){let d=c==="to-value"?p-10:o-6;a.push({type:"text",content:m.label,x:l,y:d,anchor:"middle",fontSize:b.markerFontSize,fill:h});}}else c!=="none"&&a.push({type:"line",x1:l,y1:o,x2:l,y2:s,stroke:h,strokeWidth:1}),m.label&&a.push({type:"text",content:m.label,x:l,y:o-6,anchor:"middle",fontSize:b.markerFontSize,fill:h});}return a}function wt(n){let{highlights:e,timeScale:t,yRange:r,height:i}=n;return Te({metrics:n.metrics,timeScale:t,yRange:r,height:i,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??b.highlightColor,opacity:o.opacity??b.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??b.highlightLabelColor,fontSize:b.annotationFontSize,rotate:o.rotate}))})}function kt(n){let{annotations:e,timeScale:t,valueScales:r}=n,i=[],o=s=>{let a=r.get(s.axis??0)??r.values().next().value;return {x:t.map(s.time),y:a?a.map(s.value):0}};for(let s of e){let a=[],m=l=>a.push(l);switch(s.type){case "line":{let l=o(s.from),h=o(s.to);m({type:"line",x1:l.x,y1:l.y,x2:h.x,y2:h.y,stroke:s.color??b.annotationColor,strokeWidth:s.width??b.annotationWidth,dash:s.dash});break}case "arrow":{let l=o(s.from),h=o(s.to),u=s.color??b.annotationColor,c=s.headSize??b.annotationHead;m({type:"line",x1:l.x,y1:l.y,x2:h.x,y2:h.y,stroke:u,strokeWidth:s.width??b.annotationWidth});let p=Math.hypot(h.x-l.x,h.y-l.y)||1,d=(h.x-l.x)/p,f=(h.y-l.y)/p,g=h.x-d*c,y=h.y-f*c;m({type:"path",points:[{x:h.x,y:h.y},{x:g-f*c*.5,y:y+d*c*.5},{x:g+f*c*.5,y:y-d*c*.5}],fill:u,stroke:"none"});break}case "rect":{let l=o(s.from),h=o(s.to);m({type:"rect",x:Math.min(l.x,h.x),y:Math.min(l.y,h.y),w:Math.abs(h.x-l.x),h:Math.abs(h.y-l.y),fill:s.fill??"none",hatch:s.hatch,stroke:s.stroke,opacity:s.opacity});break}case "point":{let l=o(s.at),h=s.color??"#334155",u=s.radius??b.annotationRadius,c=s.shape??"circle";c==="circle"?m({type:"circle",cx:l.x,cy:l.y,r:u,fill:h}):c==="square"?m({type:"rect",x:l.x-u,y:l.y-u,w:u*2,h:u*2,fill:h}):(m({type:"line",x1:l.x-u,y1:l.y-u,x2:l.x+u,y2:l.y+u,stroke:h,strokeWidth:1.5}),m({type:"line",x1:l.x-u,y1:l.y+u,x2:l.x+u,y2:l.y-u,stroke:h,strokeWidth:1.5}));break}case "label":{let l=o(s.at);m({type:"text",content:s.text,x:l.x+(s.dx??0),y:l.y+(s.dy??0),anchor:s.anchor??xn(l.x+(s.dx??0),s.text,n),fontSize:b.annotationFontSize,fill:s.color??b.annotationColor,rotate:s.rotate});break}}if(s.id&&a.length>0){let l=z(s.id);i.push({type:"group",cssClass:`annotation annotation--${l}`,commands:a});}else i.push(...a);}return i}function xn(n,e,t){let{metrics:r,timeScale:i}=t;if(!r)return "middle";let[o,s]=i.range(),a=r(e,b.annotationFontSize)/2;return n-a<o?"start":n+a>s?"end":"middle"}var re=class n{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++n.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var ve=class extends re{#e;constructor(e){super(e,e.data),this.#e=e;}opacity(e){if(!(this.#e.countOpacity??false))return .6;let t=0;for(let r of this.data)r.count>t&&(t=r.count);return t===0?.2:.2+.8*e/t}render(){let e=this.#e,t=e.fill??b.bandFill,r=e.hatch,i=e.avgLine??false,o=e.avgLineColor??b.bandAvgLine,s=e.bandWidth??10,a=[];for(let m of this.data){if(m.min===null||m.max===null)continue;let l=this.timeScale.map(m.time),h=e.valueScale.map(m.max),u=e.valueScale.map(m.min),c=s,p=this.data.indexOf(m);if(a.push({type:"rect",x:l-c/2,y:h,w:c,h:u-h,fill:t,hatch:r,opacity:this.opacity(m.count),id:this.id?`${this.id}-slot-${p}`:void 0}),i&&m.avg!==null){let d=e.valueScale.map(m.avg);a.push({type:"line",x1:l-c/2,y1:d,x2:l+c/2,y2:d,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${p}`:void 0});}}return a}};var Sn=1,_e=class{#e;constructor(e,t,r,i){this.#e={...e,xRange:t,y:r,height:i};}render(){let{items:e,timeScale:t,background:r,hatch:i,showAxis:o,xRange:s,y:a,height:m}=this.#e,l=[];r&&l.push({type:"rect",x:s[0],y:a,w:s[1]-s[0],h:m,fill:r,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let h of e){let u=t.map(h.startTime),c=t.map(h.endTime);if(c<s[0]||u>s[1])continue;let p=Math.max(s[0],Math.min(s[1],u)),d=Math.max(s[0],Math.min(s[1],c)),f=Math.max(d-p,Sn);p+f>s[1]&&(p=Math.max(s[0],s[1]-f));let g=p+f/2;if(l.push({type:"rect",x:p,y:a,w:f,h:m,hatch:h.hatch??i,fill:h.fill??"#6b728044",stroke:h.stroke,strokeWidth:h.strokeWidth??0,title:h.title}),h.label){let y=h.labelFontSize??10;l.push({type:"text",content:h.label,x:g,y:this.#t(h.labelBaseline,y),anchor:"middle",fontSize:y,fill:h.labelFill??"#333"});}}if(o){let h=new ee({domain:t.domain(),xRange:s,y:a+m+4});l.push({type:"group",cssClass:"annotation-band-axis",commands:h.render()});}return l}#t(e,t){let{y:r,height:i}=this.#e;switch(e){case "top":return r+t*.9;case "bottom":return r+i-t*.25;default:return r+i/2+t*.35}}};function xe(n){return {id:n.id,line:{stroke:n.stroke??b.stroke,strokeWidth:n.strokeWidth??b.strokeWidth,smoothing:n.smoothing??false,smoothingType:n.smoothingType,dashed:n.dashed??false},fill:n.fill??b.areaFillAlpha,markers:{type:n.pointStyle??"none",size:n.pointSize??b.pointSize,stroke:n.stroke??b.stroke,fill:"#ffffff"},shadow:{color:n.shadowColor??"transparent",blur:n.shadowBlur??0,offsetX:n.shadowOffsetX??0,offsetY:n.shadowOffsetY??0}}}function Tt(n,e,t){let r=[],i=xe(t);for(let o=0;o<n.length;o++){let s=n[o];s.data.length>=2?r.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${o}`:void 0,points:s.data.map(a=>({x:e.timeScale.map(a.time),y:e.valueScale.map(a.value)})),stroke:s.color??i.line.stroke,strokeWidth:i.line.strokeWidth,smoothing:i.line.smoothing,smoothingType:i.line.smoothingType,dashed:i.line.dashed,shadowColor:i.shadow.color,shadowBlur:i.shadow.blur,shadowOffsetX:i.shadow.offsetX,shadowOffsetY:i.shadow.offsetY,fill:"none"}):s.data.length===1&&r.push({type:"circle",id:t.id?`${t.id}-dot-${o}`:void 0,cx:e.timeScale.map(s.data[0].time),cy:e.valueScale.map(s.data[0].value),r:Math.max(i.markers.size,i.line.strokeWidth),fill:s.color??i.line.stroke,shadowColor:i.shadow.color,shadowBlur:i.shadow.blur});}return r}function vt(n,e,t,r){if(n.length<2)return [];let i=I.splitByBoundaries(n,t.boundaries,t.getValue,t.interpolate),o=[];for(let s=0;s<i.length;s++){let a=i[s];if(a.data.length<2)continue;let m=t.getColor(a.zoneIndex);if(!m)continue;let l=a.data.map(u=>({x:e.timeScale.map(u.time),y:e.valueScale.map(t.yLow(u))})),h=a.data.map(u=>({x:e.timeScale.map(u.time),y:e.valueScale.map(t.yHigh(u))})).reverse();o.push({type:"path",cssClass:"series-fill",id:r?.id?`${r.id}-fill-${s}`:void 0,points:[...l,...h],fill:m,hatch:t.getHatch?.(a.zoneIndex),stroke:"none",...r?.smoothing?{smoothing:true,smoothingType:r.smoothingType,smoothCount:a.data.length,smoothTail:a.data.length}:{}});}return o}function _t(n,e,t,r,i,o,s){return vt(n,e,{boundaries:[],yLow:a=>a.avg,yHigh:t,getValue:a=>a.avg,interpolate:I.interpolateAggregatedPoint,getColor:()=>r,getHatch:()=>i},{id:o,...s})}var Ce=class extends re{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??b.minColor,r=e.maxColor??b.maxColor,i=e.avgColor??b.avgColor,o=e.avgDashed??true,s=e.smoothing??false,a=e.smoothingType,m=e.strokeWidth??b.strokeWidth,l=I.getRuns(this.data,d=>d.min===null||d.max===null||d.avg===null);if(l.length===0)return [];let h={timeScale:this.timeScale,valueScale:e.valueScale},u=[];l.forEach((d,f)=>{if(d.length<2)return;let g=y=>this.id?`${this.id}-${y}-${f}`:void 0;if(e.fillToMax){let y=_t(d,h,x=>x.max,e.fillToMax,e.fillToMaxHatch,g("fillToMax"),{smoothing:s,smoothingType:a});u.push(...y);}if(e.fillToMin){let y=_t(d,h,x=>x.min,e.fillToMin,e.fillToMinHatch,g("fillToMin"),{smoothing:s,smoothingType:a});u.push(...y);}});let c=l.filter(d=>d.length>=2),p=(d,f,g,y=false)=>Tt(c.map(x=>({data:x.map(S=>({time:S.time,value:d(S)}))})),h,{stroke:f,strokeWidth:m,smoothing:s,smoothingType:a,dashed:y,id:this.id?`${this.id}-${g}`:void 0});return u.push(...p(d=>d.max,r,"max"),...p(d=>d.min,t,"min"),...p(d=>d.avg,i,"avg",o)),u}};function Ct(n,e,t){let r=n.style?.line&&!Array.isArray(n.style.line)?n.style.line:void 0,i=typeof n.style?.fill=="string"?n.style.fill:void 0;return n.showAs==="minmaxavg"?new Ce({data:n.data,timeScale:e,valueScale:t,minColor:n.minColor,maxColor:n.maxColor,avgColor:n.avgColor,avgDashed:n.avgDashed,fillToMax:n.fillToMax,fillToMaxHatch:n.fillToMaxHatch,fillToMin:n.fillToMin,fillToMinHatch:n.fillToMinHatch,smoothing:r?.smoothing,smoothingType:r?.smoothingType,strokeWidth:r?.width,id:H(n.name,n.id)}).render():new ve({data:n.data,timeScale:e,valueScale:t,fill:i??r?.color,avgLine:n.avgLine,countOpacity:n.countOpacity,id:H(n.name,n.id)}).render()}function At(n,e,t){let r=n??[];return {grenzen:r.map(o=>e.get(o)).filter(o=>!!o).map(o=>o.value).sort((o,s)=>o-s),farbe(o,s){let a=s??t,m=Number.NEGATIVE_INFINITY;for(let l of r){let h=e.get(l);!h||o<h.value||h.value<m||(m=h.value,a=h.color??a);}return a}}}function Lt(n){let{series:e,ctx:t,runs:r,totalPoints:i,style:o,styleLine:s,styleMarkers:a,stepShape:m,thresholds:l}=n,{timeScale:h,valueScale:u}=t,c=[],p=At(e.colorByThresholds,l,o.stroke),d=p.grenzen,f=new Map;for(let y of r){let k=function(A){return I.splitByBoundaries(A==="step"?N(y):y,d,C=>C.value,I.interpolateDataPoint)};if(y.length<1)continue;let x=H(e.name,e.id),S=new Map,_=A=>{let C=S.get(A);return C||(C=k(A),S.set(A,C)),C},$=(A,C,B)=>{let M=_(A);for(let F of M){let D=F,P=f.get(B)??0;if(f.set(B,P+1),D.data.length<1)continue;let E=D.zoneLow;if(D.data.length===1){let G=p.farbe(E,C.color);c.push({type:"circle",id:x?`${x}-dot-${P}${B}`:void 0,cx:h.map(D.data[0].time),cy:u.map(D.data[0].value),r:Math.max(o.pointSize??b.pointSize,C.width??o.strokeWidth??b.strokeWidth),fill:G,shadowColor:o.shadowColor,shadowBlur:o.shadowBlur});continue}c.push({type:"path",cssClass:"series-line",id:x?`${x}-line-${P}${B}`:void 0,points:D.data.map(G=>({x:h.map(G.time),y:u.map(G.value)})),stroke:p.farbe(E,C.color),strokeWidth:C.width??o.strokeWidth,smoothing:A==="step"?false:C.smoothing??o.smoothing,smoothingType:C.smoothingType??o.smoothingType,dash:C.style,opacity:C.opacity,fill:"none",shadowColor:o.shadowColor,shadowBlur:o.shadowBlur,shadowOffsetX:o.shadowOffsetX,shadowOffsetY:o.shadowOffsetY});}};s===false||(Array.isArray(s)?s.forEach((A,C)=>{$(A.shape??(e.seriesType==="step"?"step":"line"),A,`-${C}`);}):$(m?"step":"line",s??{},"")),o.pointStyle&&o.pointStyle!=="none"&&i<=(a?.threshold??b.pointThreshold)&&c.push(...mt(y,t,o,A=>p.farbe(A.value)));}return c}function Mt(n,e,t){let i=new Array(n.length),o=e.map(s=>({position:s.position,von:s.von,bis:s.bis}));for(let s of ["left","right"]){let a=s==="left",m=n.map((l,h)=>({t:l,i:h})).filter(l=>l.t.position===s).sort((l,h)=>a?h.t.achseX-l.t.achseX:l.t.achseX-h.t.achseX);for(let{t:l,i:h}of m){let u=l.schrift/2,c=o.filter(f=>f.position===s),p=l.kante,d=a?p-1-u:p+1+u;for(let f=0;f<=c.length;f++){let g=d-u-1,y=d+u+1,x=c.find(S=>g<S.bis&&S.von<y);if(!x)break;p=a?x.von:x.bis,d=a?p-1-u:p+1+u;}if(a?d-u<2:d+u>t-2){let f=o.filter(g=>g.position===s&&g.titel);d=a?u+2:t-u-2;for(let g=0;g<=f.length;g++){let y=d-u-1,x=d+u+1,S=f.find(k=>y<k.bis&&k.von<x);if(!S)break;d=a?S.bis+1+u:S.von-1-u;}}o.push({position:s,von:d-u-1,bis:d+u+1,titel:true}),i[h]=d;}}return {xs:i,belegt:o}}function Dt(n){let{axes:e,neueForm:t,achsenTitel:r,titelSpuren:i,layout:o}=n,{chartX:s,chartY:a,chartWidth:m,chartHeight:l}=o,h=t?void 0:e?.left?.label,u=t?void 0:e?.right?.label,c=e?.x?.label;if(!h&&!u&&!c&&r.length===0)return [];let p=[],d=a+l/2,f=e?.left?.labels,g=e?.right?.labels,y=e?.x?.labels;return h&&p.push({type:"text",content:h,x:14,y:d,anchor:"middle",fontSize:f?.fontSize??b.axisLabelSize,fill:f?.color??b.axisLabelColor,rotate:-90}),u&&p.push({type:"text",content:u,x:o.totalWidth-14,y:d,anchor:"middle",fontSize:g?.fontSize??b.axisLabelSize,fill:g?.color??b.axisLabelColor,rotate:90}),r.forEach((x,S)=>{p.push({type:"text",content:x.text,x:i[S],y:d,anchor:"middle",fontSize:x.style?.fontSize??b.axisLabelSize,fill:x.style?.color??b.axisLabelColor,rotate:x.position==="right"?90:-90});}),c&&p.push({type:"text",content:c,x:s+m/2,y:o.totalHeight-6,anchor:"middle",fontSize:y?.fontSize??b.axisLabelSize,fill:y?.color??b.axisLabelColor}),p.length===0?[]:[{type:"group",cssClass:"axis-labels",commands:p}]}function ie(n){return n!==void 0&&typeof n=="object"&&"series"in n?n.series:null}function $t(n){let e=[...n].sort((r,i)=>r.time-i.time),t=0;return r=>{for(;t>0&&e[t].time>r;)t--;for(;t<e.length-1&&e[t+1].time<=r;)t++;let i=e[t];if(!i||r<i.time)return null;if(i.time===r)return i.value??null;let o=e[t+1];if(!o||r>o.time||i.value===null||o.value===null)return null;let s=o.time-i.time;return s===0?i.value:i.value+(o.value-i.value)*(r-i.time)/s}}function Pt(n,e,t){let r=n??e;if(r==="series")return null;if(r==="chartTop")return t.chartTop;if(r==="chartBottom")return t.chartBottom;if(typeof r=="object"&&"threshold"in r){let i=t.thresholds.get(r.threshold);if(!i)throw new Error(`fillSpec region references unknown threshold '${r.threshold}'`);return t.valueScale.map(i.value)}return typeof r=="object"&&"value"in r?t.valueScale.map(r.value):null}function wn(n){return typeof n=="string"?{color:n}:{color:n.color,hatch:n.hatch}}function Rt(n,e,t){let r=Pt(n.from,"chartBottom",e),i=Pt(n.to,"series",e),{color:o,hatch:s}=wn(n.fill),l={attrs:{type:"path",fill:o,hatch:s,stroke:"none",cssClass:"series-fill"},teilId:h=>e.idPrefix?{id:`${e.idPrefix}-fill-r${t}-${h}`}:{}};return ie(n.from)!==null||ie(n.to)!==null?Tn(n,e,l):r!==null&&i!==null?vn(r,i,e,l):_n(n,e,r,i,l)}function kn(n,e,t){let r=e.shape==="step",i=(u,c)=>{let p=u??c,d=ie(p);if(d!==null){let y=e.fremdeSerie(d);if(!y)return null;let x=y.shape==="step";return {art:"fremd",laeufe:I.getRuns(y.data,k=>k.value===null,y.gapThreshold).map(k=>x?N(k):k),glatt:!x&&!!y.smoothing,verfahren:y.smoothingType}}if(p==="series")return {art:"eigene",glatt:!r&&!!e.smoothing,verfahren:e.smoothingType};let f=Ae(p,e),g=e.valueScale.domain();return {art:"fest",wert:f??(p==="chartBottom"?g[0]:g[1]),glatt:false}},o=i(n.from,"chartBottom"),s=i(n.to,"series");if(!o||!s||!o.glatt&&!s.glatt)return null;let a=u=>({x:e.timeScale.map(u.time),y:e.valueScale.map(u.value)}),m=(u,c)=>u.art==="eigene"?[c]:u.art==="fremd"?u.laeufe.filter(p=>p.length>=2):[null],l=(u,c,p,d)=>c?c.map(a):[p,d].map(f=>({x:e.timeScale.map(f),y:e.valueScale.map(u.wert)})),h=[];for(let u of e.runs){if(u.length<2)continue;let c=r?N(u):u;for(let p of m(o,c))for(let d of m(s,c)){let f=Math.max(c[0].time,p?.[0].time??-1/0,d?.[0].time??-1/0),g=Math.min(c.at(-1).time,p?.at(-1).time??1/0,d?.at(-1).time??1/0);if(!(g>f))continue;let y={k:o,pts:l(o,p,f,g)},x={k:s,pts:l(s,d,f,g)};y.k.glatt||([y,x]=[x,y]);let S=_=>(_.art==="fest"?void 0:_.verfahren)??"catmull-rom",k=e.timeScale.map(f);h.push({type:"group",clipRect:{x:k,y:e.chartTop,w:e.timeScale.map(g)-k,h:e.chartBottom-e.chartTop},commands:[{...t.attrs,...t.teilId(h.length),points:[...y.pts,...[...x.pts].reverse()],smoothing:true,smoothingType:S(y.k),smoothCount:y.pts.length,...x.k.glatt?{smoothTail:x.pts.length,smoothTailType:S(x.k)}:{}}]});}}return h}function Tn(n,e,t){if(!e.fremdeSerie){let a=ie(n.from)??ie(n.to);throw new Error(`fillSpec region references series '${a}', but no series lookup was provided`)}let r=kn(n,e,t);if(r)return r;let i=(a,m,l)=>{let h=a??m,u=ie(h);if(u!==null){let f=e.fremdeSerie(u);if(!f)throw new Error(`fillSpec region references unknown series '${u}'`);let g=f.shape==="step"?N(f.data):f.data;return {bei:$t(g),zeiten:g.map(y=>y.time)}}if(h==="series")return {bei:$t(l),zeiten:l.map(f=>f.time)};let c=Ae(h,e),p=e.valueScale.domain(),d=c??(h==="chartBottom"?p[0]:p[1]);return {bei:()=>d,zeiten:[]}},o=e.shape==="step",s=[];for(let a of e.runs){if(a.length<2)continue;let m=o?N(a):a,l=i(n.from,"chartBottom",m),h=i(n.to,"series",m),u=m[0].time,c=m[m.length-1].time,p=[...new Set([...l.zeiten,...h.zeiten,...m.map(y=>y.time)])].filter(y=>y>=u&&y<=c).sort((y,x)=>y-x),d=[],f=[],g=()=>{if(d.length>=2){let y=[...f].reverse();s.push({...t.attrs,...t.teilId(s.length),smoothing:o?false:e.smoothing,smoothingType:e.smoothingType,smoothCount:d.length,points:[...d,...y]});}d=[],f=[];};for(let y of p){let x=l.bei(y),S=h.bei(y);if(x===null||S===null){g();continue}let k=e.timeScale.map(y);d.push({x:k,y:e.valueScale.map(S)}),f.push({x:k,y:e.valueScale.map(x)});}g();}return s}function vn(n,e,t,r){let i=t.timeScale.range(),o=i[0],s=i[1],a=Math.min(n,e),m=Math.max(n,e);return [{...r.attrs,...r.teilId(0),points:[{x:o,y:a},{x:s,y:a},{x:s,y:m},{x:o,y:m}]}]}function _n(n,e,t,r,i){let o=t??r,s=[],a=Cn(n,e);if(a===null){let h=e.valueScale.domain();a=(t??r)===e.chartBottom?h[0]:h[1];}let m=Ae(n.outer,e),l=e.shape==="step";for(let h of e.runs){if(h.length<2)continue;let u=l?N(h):h,c=I.splitByThreshold(u,a,d=>d.value??a,I.interpolateDataPoint),p=n.side==="above"?c.above:n.side==="below"?c.below:[...c.above,...c.below];if(m!==null&&n.side){let d=m,f=n.side==="above"?g=>Math.min(g,d):g=>Math.max(g,d);p=p.map(g=>g.map(y=>({...y,value:f(y.value??d)})));}for(let d of p){if(d.length<2)continue;let f=d.map(y=>({x:e.timeScale.map(y.time),y:e.valueScale.map(y.value)})),g=[];for(let y of [...f].reverse()){let x=g[g.length-1];l&&x&&x.x===y.x||g.push({x:y.x,y:o});}s.push({...i.attrs,...i.teilId(s.length),smoothing:l?false:e.smoothing,smoothingType:e.smoothingType,smoothCount:f.length,points:[...f,...g]});}}return s}function Cn(n,e){let t=n.from==="series"?n.to:n.from;return Ae(t,e)}function Ae(n,e){return n===void 0||n==="series"||n==="chartTop"||n==="chartBottom"?null:typeof n=="object"&&"threshold"in n?e.thresholds.get(n.threshold)?.value??null:typeof n=="object"&&"value"in n?n.value:null}function jt(n,e){if(typeof n=="string"||!("regions"in n))return Rt({fill:n},e,0);let t=[];return n.regions.forEach((r,i)=>{t.push(...Rt(r,e,i));}),t}function Ft(n){let e=n.style?.line,t=e&&!Array.isArray(e)?e:void 0;return {color:t?.color??b.stroke,width:t?.width??b.strokeWidth,dash:t?.style,smoothing:t?.smoothing??false,smoothingType:t?.smoothingType}}function Bt(n,e,t,r,i){let o=n.filter(l=>l.value!==null);if(o.length<2)return [];let s=o.map(l=>({x:e.timeScale.map(l.time),y:e.valueScale.map(l.value)})),a=Ft(t);return [{type:"path",cssClass:"series-line",id:e.idPrefix?`${e.idPrefix}-overlay-${i}-${r}`:`overlay-${i}-${r}`,points:s,stroke:a.color,strokeWidth:a.width,smoothing:a.smoothing,smoothingType:a.smoothingType,dash:a.dash,fill:"none"}]}function It(n,e,t=0){switch(n.kind){case "movingAverage":{let r=n.type==="exponential"?lt(e.data,n.window):We(e.data,n.window);return Bt(r,e,n,"movingAvg",t)}case "movingMkt":{let r=st(e.data,n.window,n.activationEnergy);return Bt(r,e,n,"movingMkt",t)}case "limits":{let r=[],i=e.timeScale.range(),o=i[0],s=i[1],a=Ft(n),m=a.color,l=a.width,h=a.dash??"dashed",u=e.idPrefix?`${e.idPrefix}-overlay-${t}-`:`overlay-${t}-`;return n.high!==void 0&&r.push({type:"line",id:`${u}limit-high`,x1:o,y1:e.valueScale.map(n.high),x2:s,y2:e.valueScale.map(n.high),stroke:m,strokeWidth:l,dash:h}),n.low!==void 0&&r.push({type:"line",id:`${u}limit-low`,x1:o,y1:e.valueScale.map(n.low),x2:s,y2:e.valueScale.map(n.low),stroke:m,strokeWidth:l,dash:h}),r}case "stdDevBand":{let r=n.multiplier??1,i=We(e.data,n.window),o=at(e.data,n.window),s=[],a=[];for(let g=0;g<i.length;g++){let y=i[g].value,x=o[g].value;if(y===null||x===null)continue;let S=e.timeScale.map(i[g].time);s.push({x:S,y:e.valueScale.map(y+r*x)}),a.push({x:S,y:e.valueScale.map(y-r*x)});}if(s.length<2)return [];let m=e.idPrefix?`${e.idPrefix}-overlay-${t}-`:`overlay-${t}-`,l=[],u=(typeof n.style?.fill=="string"||n.style?.fill&&!("regions"in n.style.fill)?n.style.fill:void 0)??"#94a3b833",{color:c,hatch:p}=An(u);l.push({type:"path",cssClass:"series-fill",id:`${m}stdDevBand`,points:[...s,...[...a].reverse()],fill:c,hatch:p,stroke:"none"});let d=n.style?.line,f=d&&!Array.isArray(d)?d:void 0;if(f){let g=i.filter(y=>y.value!==null).map(y=>({x:e.timeScale.map(y.time),y:e.valueScale.map(y.value)}));g.length>=2&&l.push({type:"path",cssClass:"series-line",id:`${m}stdDevBand-mean`,points:g,stroke:f.color??b.stroke,strokeWidth:f.width??1.5,smoothing:f.smoothing,smoothingType:f.smoothingType,dash:f.style,fill:"none"});}return l}}}function An(n){return typeof n=="string"?{color:n}:{color:n.color,hatch:n.hatch}}function Ln(n){if(!n)return {gaps:[],autoDetect:false,minGapMs:6e4};if(Array.isArray(n))return {gaps:n,autoDetect:false,minGapMs:6e4};let e=n.regions??[],t=n.style;return {gaps:e.map(i=>{let o={...t,...i.style},s=o.fill,a,m;return typeof s=="string"?a=s:s&&(a=s.color,m=s.hatch),{startTime:i.startTime,endTime:i.endTime,label:i.label,fill:a,hatch:m,fillOpacity:o.opacity,labelBaseline:o.label?.baseline,rotate:o.label?.rotate,style:o.display==="bridge_line"?void 0:o.display}}),autoDetect:n.autoDetect??false,minGapMs:n.minGapMs??6e4,band:t?.band}}function Gt(n,e){if(e)for(let t of n)t.type==="text"?t.fontFamily||(t.fontFamily=e):t.type==="group"&&Array.isArray(t.commands)&&Gt(t.commands,e);}var K=class{_layout;_renderer;_locale;_timeZone;_fontFamily;_legend;_textMetrics;_clipSeries;_markers;_thresholds;_highlights;_gaps;_gapsBand;_gapsAutoDetect;_gapsMinGapMs;_annotations;_annotationBands;_disabledAnnotations=new Set;_annotationSeq=0;_axes;_series;readonly_annotationBandHeight=0;_timeScale;_valueScales=new Map;constructor(e={}){this._layout=new se({width:e.width??800,height:e.height??400,margin:e.margin??{top:20,right:20,bottom:40,left:60}}).compute(),this._renderer=e.renderer,this._locale=e.locale,this._timeZone=e.timeZone,this._fontFamily=e.fontFamily,this._legend=e.legend,this._textMetrics=e.textMetrics??V,this._clipSeries=e.clipSeries??true,this._markers=e.markers??[],this._thresholds=e.thresholds??[],this._highlights=e.highlights??[];let t=Ln(e.gaps);this._gaps=t.gaps,this._gapsAutoDetect=t.autoDetect,this._gapsMinGapMs=t.minGapMs,this._gapsBand=t.band,this._annotations=e.annotations??[],this._annotationBands=e.annotationBands??[],this._axes=e.axes,this._series=[],e.series&&this.setData(e.series);}getWidth(){return this._layout.totalWidth}getHeight(){return this._layout.totalHeight+this._annotationBandTotalHeight()}get series(){return this._series}_annotationBandTotalHeight(){let e=0;for(let t of this._annotationBands){let r=t.height??12,i=t.spacing??0;(t.showAxis??false)&&(e+=26+i),e+=r+i;}return e}setData(e){this._series=e.filter(t=>Array.isArray(t.data));}addAnnotation(e){let t=e.id??`anno-${++this._annotationSeq}`;return this._annotations.push({...e,id:t}),t}removeAnnotation(e){let t=this._annotations.length;return this._annotations=this._annotations.filter(r=>r.id!==e),this._disabledAnnotations.delete(e),this._annotations.length<t}setAnnotations(e){this._annotations=[...e],this._disabledAnnotations.clear();}clearAnnotations(){this._annotations=[],this._disabledAnnotations.clear();}getAnnotations(){return this._annotations}disableAnnotation(e){this._disabledAnnotations.add(e);}enableAnnotation(e){this._disabledAnnotations.delete(e);}_axisIndexOf(e){return e.yAxisIndex??0}_timesOf(e){return e.data.map(t=>t.time)}renderCommands(){if(this._series.length===0)return [];let e=ct({legend:this._legend,items:this._legendItems(),gesamtbreite:this._layout.totalWidth,metrics:this._textMetrics}),t=this._layout,r=dt(e,this._layout.margin);r&&(t=new se({width:this._layout.totalWidth,height:this._layout.totalHeight,margin:r}).compute());let{chartX:i,chartY:o,chartWidth:s,chartHeight:a}=t,m=[i,i+s],l=[o,o+a],h=[];for(let T of this._series)T.data.sort((v,L)=>v.time-L.time);let u=new Map,c=1/0,p=-1/0,d=false;for(let T of this._series){let v=this._axisIndexOf(T),L=u.get(v);L?L.push(T):u.set(v,[T]);for(let R of this._timesOf(T))R<c&&(c=R),R>p&&(p=R),d=true;}if(!d)return [];let f=this._axes?.x?.domain,g=f&&f!=="auto"?f:[c,p];this._timeScale=new J({domain:g,range:m,locale:this._locale,timeZone:this._timeZone});let y=new ee({domain:g,xRange:m,y:o+a,locale:this._locale,timeZone:this._timeZone,format:this._axes?.x?.format,maxTicks:this._axes?.x?.ticks?.major,minorTicks:fe(this._axes?.x?.ticks?.minor,U(this._axes?.x?.grid)?.minor),colors:pe(this._axes?.x?.axis),gesamtbreite:t.totalWidth,metrics:this._textMetrics});this._valueScales.clear();let x=Array.from(u.keys()).sort((T,v)=>T-v),S=it({axes:this._axes,indices:x,seriesByIndex:u,layout:t,thresholds:this._thresholds,metrics:this._textMetrics});h.push(...S.commands);let{titel:k,baender:_,neueForm:$}=S,A=S.primary;for(let[T,v]of S.scales)this._valueScales.set(T,v);let C=this._valueScales.get(0)??this._valueScales.get(x[0]);h.push({type:"group",cssClass:"time-axis",sharedStyles:true,commands:y.render()});let B=gt({axes:this._axes,timeAxis:y,primaryValueAxis:A,xRange:m,yRange:l}),M=B.group;M&&B.layer==="back"&&(h.push(M),M=null),this._highlights.length>0&&h.push({type:"group",cssClass:"highlights",commands:wt({metrics:this._textMetrics,highlights:this._highlights,timeScale:this._timeScale,yRange:l,height:t.totalHeight})}),C&&h.push(...yt({thresholds:this._thresholds,valueScales:this._valueScales,primaryScale:C,xRange:m,layout:t}));let F=this._gaps;if(this._gapsAutoDetect){let T=[];for(let v of this._series){if(te(v))continue;let L=v.data.filter(R=>R.value!==null);T.push(...ot(L,this._gapsMinGapMs));}T.length>0&&(F=[...this._gaps,...T]);}F.length>0&&h.push({type:"group",cssClass:"gaps",commands:He({gaps:F,timeScale:this._timeScale,yRange:l,height:t.totalHeight,metrics:this._textMetrics,band:this._gapsBand})});let D=new Map(this._thresholds.map(T=>[T.id??T.name,T]));for(let[T,v]of this._series.entries()){if(v.data.length===0)continue;let L=this._valueScales.get(this._axisIndexOf(v));if(!L)continue;let R=z(v.id??v.name);h.push({type:"group",cssClass:`series series--${R}`,id:`series-${R}`,commands:this._renderSeries(v,L,D,T),...this._clipSeries?{clipRect:{x:i,y:o,w:s,h:a}}:{}});}M&&h.push(M);let P=this._markers.map(T=>({...T}));for(let T of P)if(T.value===void 0&&(T.lineStyle==="to-value"||T.lineStyle==="to-top")){let v=this._series[T.seriesIndex??0];v&&!te(v)&&v.data.length>=2&&(T.value=this._interpolateValue(T.time,v.data));}if(P.length>0&&C){let T=[];for(let v of P){let L=C,R=this._series[v.seriesIndex??0];R&&(L=this._valueScales.get(this._axisIndexOf(R))??C),T.push(...St({markers:[v],timeScale:this._timeScale,valueScale:L,yRange:l}));}h.push({type:"group",cssClass:"markers",commands:T});}let E=this._annotations.filter(T=>!T.id||!this._disabledAnnotations.has(T.id));if(E.length>0&&h.push({type:"group",cssClass:"annotations",commands:kt({annotations:E,timeScale:this._timeScale,valueScales:this._valueScales,metrics:this._textMetrics})}),this._annotationBands.length>0){let T=o+a+this._layout.margin.bottom,v=0;this._annotationBands.forEach(L=>{let R=L.height??12,q=L.spacing??0,oe=T+v;(L.showAxis??false)&&(v+=26+q),v+=R+q,h.push({type:"group",cssClass:"annotation-band",commands:new _e({name:L.name,showAxis:L.showAxis??false,items:L.items,timeScale:this._timeScale,background:L.background,hatch:L.hatch},[i,i+s],oe,R).render()});});}let{xs:G,belegt:O}=Mt(k.map(T=>({achseX:T.achseX,kante:T.kante,position:T.position,schrift:T.style?.fontSize??b.axisLabelSize})),_,t.totalWidth);return h.push(...pt({legende:e,layout:t,randBelegt:O,metrics:this._textMetrics})),h.push(...Dt({axes:this._axes,neueForm:$,achsenTitel:k,titelSpuren:G,layout:t})),Gt(h,this._fontFamily??b.fontFamily),h}_linienGrundlage(e){let t=e.style?.line,r=t&&!Array.isArray(t)?t:void 0,i=this._gapsAutoDetect?this._gapsMinGapMs:void 0,o=Array.isArray(t)?t[0]:r,s=(o?.shape??e.seriesType)==="step",a=o||void 0,m=a?.gapThreshold??i??b.gapThreshold;return {styleLine:t,lineDefaults:r,gapThreshold:m,grundLinie:a,stepShape:s}}_renderSeries(e,t,r,i=0){let o=this._timeScale,s={timeScale:o,valueScale:t};if(te(e))return Ct(e,o,t);let{lineDefaults:a,gapThreshold:m}=this._linienGrundlage(e),l=I.getRuns(e.data,k=>k.value===null,m),h=l.reduce((k,_)=>k+_.length,0);if(h===0)return [];let u=[],c=e.style?.markers,p=e.style?.shadow,d={stroke:a?.color??this._palettenFarbe(i),strokeWidth:a?.width??b.strokeWidth,smoothing:a?.smoothing,smoothingType:a?.smoothingType,dashed:a?.style==="dashed",pointStyle:c?.type,pointSize:c?.size,pointStroke:c?.stroke,pointFill:c?.fill,pointStrokeWidth:c?.strokeWidth,shadowColor:p?.color,shadowBlur:p?.blur,shadowOffsetX:p?.offsetX,shadowOffsetY:p?.offsetY,id:H(e.name,e.id)},{styleLine:f,grundLinie:g,stepShape:y}=this._linienGrundlage(e),x=e.style?.fill;if(x!==void 0){let k=t.range(),_=Math.min(k[0],k[1]),$=Math.max(k[0],k[1]);u.push(...jt(x,{runs:l,timeScale:o,valueScale:t,thresholds:r,chartTop:_,chartBottom:$,smoothing:g?.smoothing,smoothingType:g?.smoothingType,shape:y?"step":"line",fremdeSerie:A=>{let C=this._series.find(D=>(D.id??D.name)===A||D.name===A);if(!C||!("data"in C))return;let B=C.data;if(B.length===0||!("value"in B[0]))return;let M=this._linienGrundlage(C),F=M.grundLinie;return {data:B,shape:M.stepShape?"step":"line",smoothing:F?.smoothing,smoothingType:F?.smoothingType,gapThreshold:M.gapThreshold}},idPrefix:H(e.name,e.id)}));}u.push(...Lt({series:e,ctx:s,runs:l,totalPoints:h,style:d,styleLine:f,styleMarkers:c,stepShape:y,thresholds:r}));let S=e.overlays;if(S&&S.length>0){let k=t.range(),_={data:e.data,timeScale:o,valueScale:t,chartTop:Math.min(k[0],k[1]),chartBottom:Math.max(k[0],k[1]),idPrefix:H(e.name,e.id)};S.forEach(($,A)=>{u.push(...It($,_,A));});}return e.style?.gap&&l.length>1&&u.push(...xt({gap:e.style.gap,runs:l,timeScale:o,valueScale:t,metrics:this._textMetrics,lineColor:a?.color})),u}_interpolateValue(e,t){for(let r=1;r<t.length;r++){let i=t[r-1],o=t[r];if(!(i.value===null||o.value===null)&&e>=i.time&&e<=o.time){if(o.time===i.time)return i.value;let s=(e-i.time)/(o.time-i.time);return i.value+s*(o.value-i.value)}}}legendItems(){return this._legendItems()}_palettenFarbe(e){let t=b.palette;return t.length>0?t[e%t.length]:b.stroke}_legendItems(){return this._series.map((e,t)=>{let r=e.style?.line,i=Array.isArray(r)?r:r?[r]:[],o=e.style?.markers,s=o?.type&&o.type!=="none"&&(o.threshold===void 0||(e.data?.length??0)<=o.threshold),a=te(e)?e.avgColor??b.avgColor:this._palettenFarbe(t);return {name:e.name,color:i[0]?.color??a,line:i.length===1?i[0].style:void 0,marker:s?o.type:void 0,id:z(e.id??e.name)}})}get renderer(){return this._renderer}get layout(){return this._layout}get timeScale(){return this._timeScale}get valueScales(){return this._valueScales}invertTime(e){return this._timeScale?this._timeScale.invert(e):0}invertValue(e,t=0){let r=this._valueScales.get(t);return r?r.invert(e):0}project(e,t,r=0){let i=this._timeScale?this._timeScale.map(e):0,o=this._valueScales.get(r);return {x:i,y:o?o.map(t):0}}};function Ot(n){let e=[];for(let t=0;t<n.length-1;t++){let r=n[t+1].x-n[t].x;e.push(r===0?0:(n[t+1].y-n[t].y)/r);}return e}function Mn(n){let e=Ot(n),t=n.length,r=[...e];for(let i=1;i<t-1;i++)r[i]=e[i-1]*e[i]<=0?0:(e[i-1]+e[i])/2;r[t-1]=e[t-2];for(let i=0;i<t-1;i++){if(e[i]===0){r[i]=0,r[i+1]=0;continue}let o=r[i]/e[i],s=r[i+1]/e[i],a=o*o+s*s;if(a>9){let m=3/Math.sqrt(a);r[i]=m*o*e[i],r[i+1]=m*s*e[i];}}return r}function Dn(n){let e=Ot(n),t=n.length;if(e.length<2)return n.map(()=>e[0]??0);let r=e[0],i=e[1],o=e[e.length-1],s=e[e.length-2],a=2*r-i,m=2*o-s,l=[2*a-r,a,...e,m,2*m-o],h=[];for(let u=0;u<t;u++){let c=Math.abs(l[u+3]-l[u+2]),p=Math.abs(l[u+1]-l[u]);h.push(c+p===0?(l[u+1]+l[u+2])/2:(c*l[u+1]+p*l[u+2])/(c+p));}return h}function $n(n,e){let t=[];for(let r=0;r<n.length-1;r++){let i=n[r],o=n[r+1],s=(o.x-i.x)/3;t.push({p0:i,c1:{x:i.x+s,y:i.y+e[r]*s},c2:{x:o.x-s,y:o.y-e[r+1]*s},p1:o});}return t}function Pn(n,e){if(n.length<2)return [];let t=e==="akima"?Dn(n):Mn(n);return $n(n,t)}function Rn(n){let e=[];for(let t=0;t<n.length-1;t++){let r=n[t-1]??n[t],i=n[t],o=n[t+1],s=n[t+2]??o,a=Math.min(i.x,o.x),m=Math.max(i.x,o.x),l=h=>h<a?a:h>m?m:h;e.push({p0:i,c1:{x:l(i.x+(o.x-r.x)/6),y:i.y+(o.y-r.y)/6},c2:{x:l(o.x-(s.x-i.x)/6),y:o.y-(s.y-i.y)/6},p1:o});}return e}function ze(n,e){return e&&e!=="catmull-rom"?Pn(n,e):Rn(n)}var Ve=["fill","stroke","stroke-width","stroke-dasharray","stroke-linecap","fill-opacity","stroke-opacity"],jn={line:["stroke","stroke-width","stroke-dasharray","stroke-linecap","stroke-opacity"],text:["text-anchor","font-size","font-family","fill","fill-opacity"],circle:Ve,rect:Ve,path:Ve},Bn={line:"stroke-opacity",text:"fill-opacity"},Fn=/ ([a-z-]+)="([^"]*)"/g;function In(n){let e=/^<(line|text|circle|rect|path) /.exec(n)?.[1];if(!e||n.includes(`
|
|
25
|
+
`))return null;let t=e==="text"?n.indexOf(">")+1:n.length,r=n.slice(0,t),i=/ opacity="([^"]*)"/.exec(r),o=Bn[e];i&&i[1]==="1"?r=r.replace(i[0],""):i&&o&&!r.includes(` ${o}="`)&&(r=r.replace(i[0],` ${o}="${i[1]}"`));let s=new Map;for(let[,a,m]of r.matchAll(Fn))s.set(a,m);return {art:e,kopf:r,rest:n.slice(t),attrs:s}}function Wt(n){let e=[];for(let r of jn[n[0].art]){if(!n.every(a=>a.attrs.has(r)))continue;let i=new Map;for(let a of n){let m=a.attrs.get(r);i.set(m,(i.get(m)??0)+1);}let o="",s=0;for(let[a,m]of i)m>s&&([o,s]=[a,m]);e.push([r,o]);}let t=n.map(r=>{let i=r.kopf;for(let[o,s]of e)i=i.replace(` ${o}="${s}"`,"");return i+r.rest});return {attrs:e.map(([r,i])=>` ${r}="${i}"`).join(""),kinder:t}}function Et(n,e=" "){let t=[];for(let o of n){let s=In(o);if(!s)return null;t.push(s);}if(t.length===0)return null;let r=new Set(t.map(o=>o.art));if(r.size===1){let o=Wt(t);return {attrs:o.attrs,inhalt:o.kinder.map(s=>e+s).join(`
|
|
26
|
+
`)}}if(r.size!==2||!r.has("line")||!r.has("text"))return null;let i=[];for(let o of ["line","text"]){let s=t.filter(m=>m.art===o);if(s.length===1){i.push(e+s[0].kopf+s[0].rest);continue}let a=Wt(s);i.push(`${e}<g${a.attrs}>`);for(let m of a.kinder)i.push(e+e+m);i.push(`${e}</g>`);}return {attrs:"",inhalt:i.join(`
|
|
27
|
+
`)}}var Ne="1.13.0";var Gn=` <!-- MLTimeGraph ${Ne} -->`,Ht=1e3;function w(n){return String(Math.round(n*Ht)/Ht)}function Xe(n){return Fe(n).toString(16).padStart(8,"0")}function On(n){switch(n){case "top":return "text-top";case "bottom":return "text-bottom";default:return "middle"}}var Y=class extends ye{#e="100%";#t="100%";#n;#r=new Map;#i=new Map;#o=new Map;constructor(e){super(),e?.width!==void 0&&(this.#e=e.width),e?.height!==void 0&&(this.#t=e.height),e?.background!==void 0&&(this.#n=e.background);}setBackgroundColor(e){this.#n=e;}render(e){this.#r.clear(),this.#i.clear(),this.#o.clear();let t=e.map(l=>this._toSVG(l));this.#n&&t.unshift(`<rect width="100%" height="100%" fill="${this._esc(this.#n)}" />`);let r=t.join(`
|
|
28
|
+
`),i="",o=[];for(let[,l]of this.#r)o.push(l);for(let[,l]of this.#i)o.push(l);for(let[,l]of this.#o)o.push(l);o.length>0&&(i=` <defs>
|
|
26
29
|
${o.join(`
|
|
27
30
|
`)}
|
|
28
31
|
</defs>
|
|
29
|
-
`);let s=typeof this.#e=="number"?`${this.#e}`:this.#e,a=typeof this.#t=="number"?`${this.#t}`:this.#t,
|
|
30
|
-
${
|
|
31
|
-
${
|
|
32
|
-
</svg>`}}_toSVG(e){switch(e.type){case "path":return this._path(e);case "line":return this._line(e);case "rect":return this._rect(e);case "circle":return this._circle(e);case "text":return this.#
|
|
33
|
-
<feDropShadow dx="${
|
|
34
|
-
</filter>`;return this.#
|
|
35
|
-
<rect x="${
|
|
36
|
-
</clipPath>`);}#
|
|
37
|
-
<rect x="${
|
|
38
|
-
<text x="${
|
|
39
|
-
</g>`:`<rect x="${
|
|
32
|
+
`);let s=typeof this.#e=="number"?`${this.#e}`:this.#e,a=typeof this.#t=="number"?`${this.#t}`:this.#t,m=typeof this.#e=="number"&&typeof this.#t=="number"?` viewBox="0 0 ${this.#e} ${this.#t}"`:"";return {type:"svg",content:`<svg xmlns="http://www.w3.org/2000/svg" width="${s}" height="${a}"${m}>
|
|
33
|
+
${Gn}
|
|
34
|
+
${i} ${r}
|
|
35
|
+
</svg>`}}_toSVG(e){switch(e.type){case "path":return this._path(e);case "line":return this._line(e);case "rect":return this._rect(e);case "circle":return this._circle(e);case "text":return this.#h(e);case "gap":return this._gap(e);case "group":return this._group(e)}}#l(e,t){if(e.length===0)return "";if(!t.smoothing||e.length<3)return e.map((l,h)=>`${h===0?"M":"L"}${w(l.x)},${w(l.y)}`).join(" ");let r=t.smoothCount!=null&&t.smoothCount<e.length?Math.max(t.smoothCount,2):e.length,i=t.smoothTail??0,o=i>=3&&e.length-i>=r?e.length-i:e.length,s=l=>l.map(h=>` C${w(h.c1.x)},${w(h.c1.y)} ${w(h.c2.x)},${w(h.c2.y)} ${w(h.p1.x)},${w(h.p1.y)}`).join(""),a=`M${w(e[0].x)},${w(e[0].y)}`;a+=s(ze(e.slice(0,r),t.smoothingType));let m=o<e.length?o:e.length-1;for(let l=r;l<=m;l++)a+=` L${w(e[l].x)},${w(e[l].y)}`;if(o<e.length){let l=e.slice(o).reverse(),h=ze(l,t.smoothTailType??t.smoothingType).reverse().map(u=>({p0:u.p1,c1:u.c2,c2:u.c1,p1:u.p0}));a+=s(h);}return a}_hatchPattern(e,t){let r=`hatch-${e}-${Xe(t??"")}`;if(this.#o.has(r))return r;let i=ce(r,e,t??"rgba(200,220,255,0.3)");return this.#o.set(r,i),r}_path(e){let t=this.#l(e.points,e)+(e.closed?" Z":""),r=[];if(e.hatch){let s=this._hatchPattern(e.hatch,e.fill);r.push(`fill="url(#${s})"`);}else r.push(`fill="${e.fill?this._esc(e.fill):"none"}"`);e.stroke&&r.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&r.push(`stroke-width="${w(e.strokeWidth)}"`);let i=this.#a(e.dash,e.dashed,e.strokeWidth);i&&(r.push(`stroke-dasharray="${i.strokeDasharray}"`),i.strokeLinecap&&r.push(`stroke-linecap="${i.strokeLinecap}"`)),e.opacity!==void 0&&r.push(`opacity="${w(e.opacity)}"`),e.cssClass&&r.push(`class="${this._esc(e.cssClass)}"`),e.id&&r.push(`id="${this._esc(e.id)}"`);let o=this.#s(e);return o&&r.push(`filter="url(#${o})"`),`<path d="${t}" ${r.join(" ")} />`}_line(e){let t=[];e.stroke&&t.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&t.push(`stroke-width="${w(e.strokeWidth)}"`);let r=this.#a(e.dash,e.dashed,e.strokeWidth);r&&(t.push(`stroke-dasharray="${r.strokeDasharray}"`),r.strokeLinecap&&t.push(`stroke-linecap="${r.strokeLinecap}"`)),e.opacity!==void 0&&t.push(`opacity="${w(e.opacity)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`);let i=this.#s(e);return i&&t.push(`filter="url(#${i})"`),`<line x1="${w(e.x1)}" y1="${w(e.y1)}" x2="${w(e.x2)}" y2="${w(e.y2)}" ${t.join(" ")} />`}_rect(e){let t=[];if(e.hatch){let i=this._hatchPattern(e.hatch,e.fill);t.push(`fill="url(#${i})"`);}else e.fill!==void 0&&t.push(`fill="${this._esc(e.fill)}"`);e.stroke&&t.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&t.push(`stroke-width="${w(e.strokeWidth)}"`),e.opacity!==void 0&&t.push(`opacity="${w(e.opacity)}"`),e.dashed&&t.push('stroke-dasharray="4,4"'),e.id&&t.push(`id="${this._esc(e.id)}"`);let r=this.#s(e);return r&&t.push(`filter="url(#${r})"`),e.title?`<rect x="${w(e.x)}" y="${w(e.y)}" width="${w(e.w)}" height="${w(e.h)}" ${t.join(" ")}><title>${this._esc(e.title)}</title></rect>`:`<rect x="${w(e.x)}" y="${w(e.y)}" width="${w(e.w)}" height="${w(e.h)}" ${t.join(" ")} />`}_circle(e){let t=[];if(e.hatch){let i=this._hatchPattern(e.hatch,e.fill);t.push(`fill="url(#${i})"`);}else e.fill&&t.push(`fill="${this._esc(e.fill)}"`);e.stroke&&t.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&t.push(`stroke-width="${w(e.strokeWidth)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`);let r=this.#s(e);return r&&t.push(`filter="url(#${r})"`),`<circle cx="${w(e.cx)}" cy="${w(e.cy)}" r="${w(e.r)}" ${t.join(" ")} />`}#a(e,t,r){return Ge(e,r??2,t)}#s(e){if(!e.shadowColor)return null;let t=e.shadowBlur??0,r=e.shadowOffsetX??0,i=e.shadowOffsetY??0;if(!t&&!r&&!i)return null;let o=`shadow-${Xe(`${e.shadowColor}|${w(t)}|${w(r)}|${w(i)}`)}`;if(this.#r.has(o))return o;let s=`<filter id="${o}" x="-50%" y="-50%" width="200%" height="200%">
|
|
36
|
+
<feDropShadow dx="${w(r)}" dy="${w(i)}" stdDeviation="${w(t/2)}" flood-color="${this._esc(e.shadowColor)}" />
|
|
37
|
+
</filter>`;return this.#r.set(o,s),o}#m(e,t,r,i,o){this.#i.has(e)||this.#i.set(e,`<clipPath id="${e}">
|
|
38
|
+
<rect x="${w(t)}" y="${w(r)}" width="${w(i)}" height="${w(o)}" />
|
|
39
|
+
</clipPath>`);}#h(e){let t=[];return e.anchor&&t.push(`text-anchor="${e.anchor}"`),e.fontSize&&t.push(`font-size="${w(e.fontSize)}"`),e.fontFamily&&t.push(`font-family="${this._esc(e.fontFamily)}"`),e.fill&&t.push(`fill="${this._esc(e.fill)}"`),e.opacity!=null&&t.push(`opacity="${w(e.opacity)}"`),e.rotate&&t.push(`transform="rotate(${w(e.rotate)} ${w(e.x)} ${w(e.y)})"`),e.textBaseline&&t.push(`dominant-baseline="${On(e.textBaseline)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`),`<text x="${w(e.x)}" y="${w(e.y)}" ${t.join(" ")}>${this._esc(e.content)}</text>`}_gap(e){if(e.style==="empty")return "";let t=[`stroke="${this._esc("#999")}"`,'stroke-dasharray="4,4"','fill="none"'];return e.style==="label"&&e.label?`<g class="gap">
|
|
40
|
+
<rect x="${w(e.x1)}" y="${w(e.y1)}" width="${w(e.x2-e.x1)}" height="${w(e.y2-e.y1)}" ${t.join(" ")} />
|
|
41
|
+
<text x="${w(e.x1)}" y="${w(e.y1-4)}" fill="#999" font-size="10">${this._esc(e.label)}</text>
|
|
42
|
+
</g>`:`<rect x="${w(e.x1)}" y="${w(e.y1)}" width="${w(e.x2-e.x1)}" height="${w(e.y2-e.y1)}" ${t.join(" ")} />`}_group(e){let t=null;if(e.clipRect){let{x:h,y:u,w:c,h:p}=e.clipRect;t=`clip-plot-${Xe(`${w(h)},${w(u)},${w(c)},${w(p)}`)}`,this.#m(t,h,u,c,p);}let r=e.commands.map(h=>this._toSVG(h)),i=e.sharedStyles?Et(r):null,o=i?.inhalt??r.map(h=>` ${h.replaceAll(/\n {3}/g,`
|
|
40
43
|
`)}`).join(`
|
|
41
|
-
`),
|
|
42
|
-
${
|
|
43
|
-
</g>`}_esc(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}};function Rn(i){return typeof requestAnimationFrame=="function"?requestAnimationFrame(i):setTimeout(()=>i(0),16)}function On(i){typeof cancelAnimationFrame=="function"?cancelAnimationFrame(i):clearTimeout(i);}function Ut(){let i=0,e=false;return {schedule:t=>{e||(e=true,i=Rn(()=>{e=false,t();}));},cancel:()=>{e&&(e=false,On(i));}}}var qt="http://www.w3.org/2000/svg";function In(i){let e=i.style?.line;return e&&!Array.isArray(e)&&e.color?e.color:y.stroke}function Zt(i){return i.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function Wn(i){if(i.length===0)return "";let e=new Date(i[0].time).toLocaleString(),t=i.map(n=>`<div><span class="mlc-tooltip__name">${Zt(n.series.name)}:</span> ${n.value.toFixed(2)}</div>`);return `<div class="mlc-tooltip__time">${Zt(e)}</div>${t.join("")}`}function Hn(i,e){if(i.length===0)return;let t=0,n=i.length-1;for(;t<n;){let s=t+n>>1;i[s].time<e?t=s+1:n=s;}let r=i[Math.max(0,t-1)],o=i[t];return Math.abs(r.time-e)<=Math.abs(o.time-e)?r:o}function En(i){return "value"in i?i.value:i.avg}function _e(i,e,t={}){let n=i.querySelector("svg");if(!n)throw new Error("attachTooltip: target has no <svg> child (did you mount the chart first?)");let r=t.format??Wn,o=t.snapRadius??1/0,s=t.className??"mlc-tooltip",a=t.showPicks??true,l=t.pickRadius??5,h=t.picksClassName??"mlc-tooltip-picks",m=document.createElement("div");m.className=s,m.style.position="absolute",m.style.pointerEvents="none",m.style.display="none",getComputedStyle(i).position==="static"&&(i.style.position="relative"),i.appendChild(m);let u=null;a&&(u=document.createElementNS(qt,"g"),u.setAttribute("class",h),u.setAttribute("pointer-events","none"),n.appendChild(u));let c=()=>{u&&u.replaceChildren();},g=e.series.map((k,A)=>({data:k.data.map($=>({time:$.time,value:En($)})).filter($=>$.value!==null).sort(($,H)=>$.time-H.time),series:k,index:A})),d=Ut(),f=null,p=k=>{let A=n.getBoundingClientRect(),j=e.getWidth?.()??A.width,$=(k.clientX-A.left)*j/Math.max(1,A.width);e.getHeight?.()??A.height;let V=e.invertTime($);if(!Number.isFinite(V)){m.style.display="none";return}let G=[];for(let M of g){let C=Hn(M.data,V);if(!C)continue;let q=e.project(C.time,C.value,M.series.yAxisIndex??0).x,Z=e.project(C.time,C.value,M.series.yAxisIndex??0).y;Math.abs(q-$)>o||G.push({seriesIndex:M.index,series:M.series,time:C.time,value:C.value,x:q,y:Z});}if(G.length===0){m.style.display="none",c();return}m.innerHTML=r(G);let _=i.getBoundingClientRect(),D=12,F=(k.clientX-A.left)/Math.max(1,A.width),R=(k.clientY-A.top)/Math.max(1,A.height),B=F<.5?`${D}px`:`calc(-100% - ${D}px)`,O=R<.5?`${D}px`:`calc(-100% - ${D}px)`;if(m.style.left=`${k.clientX-_.left}px`,m.style.top=`${k.clientY-_.top}px`,m.style.transform=`translate(${B}, ${O})`,m.style.display="",u){u.replaceChildren();for(let M of G){let C=document.createElementNS(qt,"circle");C.setAttribute("cx",String(M.x)),C.setAttribute("cy",String(M.y)),C.setAttribute("r",String(l)),C.setAttribute("fill","#ffffff"),C.setAttribute("stroke",In(M.series)),C.setAttribute("stroke-width","2"),C.setAttribute("class",`${h}__dot`),u.appendChild(C);}}},S=k=>{f=k,d.schedule(()=>{f&&p(f);});},w=()=>{f=null,d.cancel(),m.style.display="none",c();};n.addEventListener("mousemove",S),n.addEventListener("mouseleave",w);let v=false;return ()=>{v||(v=true,f=null,d.cancel(),n.removeEventListener("mousemove",S),n.removeEventListener("mouseleave",w),m.remove(),u&&u.remove());}}function Gn(i,e={}){let t=typeof i=="string"?document.querySelector(i):i;if(!t)throw new Error(`mount: target ${typeof i=="string"?`'${i}'`:""} not found`);let{tooltip:n,...r}=e,o=r.width??t.clientWidth??800,s=r.height??350,a=new le({...r,width:o,height:s}),{content:l}=new ie().render(a.renderCommands());t.innerHTML=l;let h=t.querySelector("svg");return h&&(h.setAttribute("viewBox",`0 0 ${o} ${a.getHeight()}`),h.setAttribute("width","100%"),h.setAttribute("height",String(a.getHeight()))),n?.show&&_e(t,a,n),a}var He=class{_opts;_series=[];_thresholds=[];_annotations=[];_highlights=[];_markers=[];_bands=[];_tooltip;constructor(e,t){this._opts={},e!==void 0&&(this._opts.width=e),t!==void 0&&(this._opts.height=t);}setWidth(e){return this._opts.width=e,this}setHeight(e){return this._opts.height=e,this}setSize(e,t){return this._opts.width=e,this._opts.height=t,this}setMargin(e,t,n,r){return typeof e=="object"?this._opts.margin=e:this._opts.margin={top:e,right:t??0,bottom:n??0,left:r??0},this}setLocale(e){return this._opts.locale=e,this}setAxes(e){return this._opts.axes=e,this}setXAxis(e){return this._opts.axes={...this._opts.axes,x:{...this._opts.axes?.x,...e}},this}setLeftAxis(e){return this._opts.axes={...this._opts.axes,left:{...this._opts.axes?.left,...e}},this}setRightAxis(e){return this._opts.axes={...this._opts.axes,right:{...this._opts.axes?.right,...e}},this}setYAxis(e,t){this._opts.axes??={},this._opts.axes.y??=[];let n=[...this._opts.axes.y];for(;n.length<=e;)n.push({});return n[e]={...n[e],...t},this._opts.axes.y=n,this}setLegend(e,t,n){return typeof e=="object"?this._opts.legend=e:this._opts.legend={show:e,position:t,orientation:n},this}setGaps(e){return this._opts.gaps=e,this}setTooltip(e){return this._tooltip={show:true,...e},this}addSeries(e){return this._series.push(e),this}addSeriesAll(e){return this._series.push(...e),this}addThreshold(e){return this._thresholds.push(e),this}addThresholds(e){return this._thresholds.push(...e),this}addAnnotation(e){return this._annotations.push(e),this}addAnnotations(e){return this._annotations.push(...e),this}addHighlight(e){return this._highlights.push(e),this}addMarker(e){return this._markers.push(e),this}addAnnotationBand(e){return this._bands.push(e),this}clear(e){return (!e||e==="series")&&(this._series=[]),(!e||e==="thresholds")&&(this._thresholds=[]),(!e||e==="annotations")&&(this._annotations=[]),(!e||e==="highlights")&&(this._highlights=[]),(!e||e==="markers")&&(this._markers=[]),(!e||e==="bands")&&(this._bands=[]),this}toOptions(){return {...this._opts,series:this._series.length?this._series:this._opts.series,thresholds:this._thresholds.length?this._thresholds:this._opts.thresholds,annotations:this._annotations.length?this._annotations:this._opts.annotations,highlights:this._highlights.length?this._highlights:this._opts.highlights,markers:this._markers.length?this._markers:this._opts.markers,annotationBands:this._bands.length?this._bands:this._opts.annotationBands}}build(){return new le(this.toOptions())}getSvg(){let e=this.build(),{content:t}=new ie().render(e.renderCommands());return t}mount(e){let t=typeof e=="string"?document.querySelector(e):e;if(!t){let s=typeof e=="string"?`'${e}'`:"";throw new Error(`GraphBuilder.mount: target ${s} not found`)}this._opts.width||(this._opts.width=t.clientWidth||800);let n=this.build(),{content:r}=new ie().render(n.renderCommands());t.innerHTML=r;let o=t.querySelector("svg");if(o){let s=this._opts.width??800;o.setAttribute("viewBox",`0 0 ${s} ${n.getHeight()}`),o.setAttribute("width","100%"),o.setAttribute("height",String(n.getHeight()));}return this._tooltip?.show&&_e(t,n,this._tooltip),n}};var Ee=class{_series;constructor(e){this._series={name:e,data:[]};}addPoint(e,t){return this._series.data.push({time:e,value:t}),this}setData(e){return this._series.data=[...e],this}addPoints(e){return this._series.data.push(...e),this}addFloats(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)this._series.data.push({time:e[r],value:t[r]});return this}addNullPoint(e){return this._series.data.push({time:e,value:null}),this}setYAxisIndex(e){return this._series.yAxisIndex=e,this}setColor(e){return this._series.style??={},!this._series.style.line||typeof this._series.style.line=="boolean"?this._series.style.line={color:e}:Array.isArray(this._series.style.line)?this._series.style.line.length===0?this._series.style.line=[{color:e}]:this._series.style.line[0].color=e:this._series.style.line.color=e,this}setStyle(e){return this._series.style=e,this}setLineStyle(e,t,n){return this._series.style??={},this._series.style.line={color:e,width:t,style:n},this}setSmoothing(e,t){return this._series.style??={},!this._series.style.line||typeof this._series.style.line=="boolean"?this._series.style.line={smoothing:e,smoothingType:t}:Array.isArray(this._series.style.line)?this._series.style.line.length===0?this._series.style.line=[{smoothing:e,smoothingType:t}]:(this._series.style.line[0].smoothing=e,this._series.style.line[0].smoothingType=t):(this._series.style.line.smoothing=e,this._series.style.line.smoothingType=t),this}setFill(e){return this._series.style??={},this._series.style.fill=e,this}setID(e){return this._series.id=e,this}setColorByThresholds(e){return this._series.colorByThresholds=e,this}build(){return this._series}};var Ge=class{_threshold;constructor(e,t){this._threshold={name:e,value:t};}setColor(e){return this._threshold.color=e,this}setLine(e){return this._threshold.line=e,this}setFill(e,t){return this._threshold.fill=e,this._threshold.fillOpacity=t,this}setFillHatch(e){return this._threshold.fillHatch=e,this}setLabel(e,t){return this._threshold.label={text:e,position:t},this}setID(e){return this._threshold.id=e,this}build(){return this._threshold}};var Ne=class{_marker;constructor(e){this._marker={time:e};}setValue(e){return this._marker.value=e,this}setLabel(e){return this._marker.label=e,this}setColor(e){return this._marker.color=e,this}setPointStyle(e){return this._marker.pointStyle=e,this}setLineStyle(e){return e==="none"?delete this._marker.lineStyle:this._marker.lineStyle=e,this}setSeriesIndex(e){return this._marker.seriesIndex=e,this}build(){return this._marker}};var Ve=class{_highlight;constructor(e,t){this._highlight={startTime:e,endTime:t};}setLabel(e){return this._highlight.label=e,this}setColor(e){return this._highlight.color=e,this}setOpacity(e){return this._highlight.opacity=e,this}setLabelPosition(e){return this._highlight.labelPosition=e,this}setRotate(e){return this._highlight.rotate=e,this}build(){return this._highlight}};var ze=class{_ann;constructor(e){this._ann={type:e};}setID(e){return this._ann.id=e,this}setTitle(e){return this._ann.title=e,this}setFrom(e,t,n){return this._ann.from={time:e,value:t,axis:n},this}setTo(e,t,n){return this._ann.to={time:e,value:t,axis:n},this}setAt(e,t,n){return this._ann.at={time:e,value:t,axis:n},this}setColor(e){return this._ann.color=e,this}setWidth(e){return this._ann.width=e,this}setDash(e){return this._ann.dash=e,this}setHeadSize(e){return this._ann.headSize=e,this}setFill(e){return this._ann.fill=e,this}setHatch(e){return this._ann.hatch=e,this}setStroke(e){return this._ann.stroke=e,this}setOpacity(e){return this._ann.opacity=e,this}setRadius(e){return this._ann.radius=e,this}setShape(e){return this._ann.shape=e,this}setText(e){return this._ann.text=e,this}setAnchor(e){return this._ann.anchor=e,this}setDx(e){return this._ann.dx=e,this}setDy(e){return this._ann.dy=e,this}setRotate(e){return this._ann.rotate=e,this}build(){return this._ann}};var Xe=class{_band;constructor(e){this._band={name:e,items:[]};}setHeight(e){return this._band.height=e,this}setSpacing(e){return this._band.spacing=e,this}setHatch(e){return this._band.hatch=e,this}setShowAxis(e){return this._band.showAxis=e,this}setShowInLegend(e){return this._band.showInLegend=e,this}setBackground(e){return this._band.background=e,this}addItem(e){return this._band.items.push(e),this}build(){return this._band}},Ye=class{_item;constructor(e,t){this._item={startTime:e,endTime:t};}setFill(e){return this._item.fill=e,this}setHatch(e){return this._item.hatch=e,this}setStroke(e){return this._item.stroke=e,this}setStrokeWidth(e){return this._item.strokeWidth=e,this}setLabel(e,t,n,r){return this._item.label=e,t!==void 0&&(this._item.labelFontSize=t),n!==void 0&&(this._item.labelFill=n),r!==void 0&&(this._item.labelBaseline=r),this}build(){return this._item}};function Nn(i){let{thresholds:e,colors:t,hatches:n}=i;if(t.length!==e.length+1)throw new Error(`fillBetweenThresholds: expected ${e.length+1} colors for ${e.length} thresholds, got ${t.length}`);if(n!==void 0&&n.length!==t.length)throw new Error(`fillBetweenThresholds: hatches length (${n.length}) must equal colors length (${t.length})`);return {regions:t.map((o,s)=>{let a=n?.[s],l=a?{color:o,hatch:a}:o;return s===0?{to:{threshold:e[0]},fill:l}:s===t.length-1?{from:{threshold:e[e.length-1]},fill:l}:{from:{threshold:e[s-1]},to:{threshold:e[s]},fill:l}})}}function dt(i){if(!i||typeof i!="object")throw new Error("DataPoint: object expected");let{time:e,value:t,annotation:n}=i;if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`DataPoint: invalid time=${e}`);if(t!==null&&(typeof t!="number"||Number.isNaN(t)))throw t===void 0?new Error("DataPoint: missing value"):typeof t=="object"&&"value"in t?new Error("DataPoint: nested value object"):new Error(`DataPoint: invalid value=${t}`);return {time:e,value:t,annotation:n&&typeof n=="string"?n:void 0}}function Vn(i){if(Array.isArray(i))return i.map(dt);if(i&&typeof i=="object"){let e=i,t=e.name,n=e.data,r=e.sensorType,o=e.enumMap,s=e.color,a=e.lineWidth,l=e.smoothing,h=e.seriesType;if(!t?.length)throw new Error("Series: name required");if(!Array.isArray(n))throw new Error("Series: data must be an array");let m=s!==void 0||a!==void 0||l!==void 0?{color:s,width:a,smoothing:l}:void 0;return {name:t,data:n.map(dt),sensorType:r??"numeric",enumMap:o,seriesType:h,...m&&{style:{line:m}}}}throw new Error("parseSeries: object or DataPoint[] expected")}function zn(i){if(!i||typeof i!="object")throw new Error("parseAggregated: object expected");let e=i,t=e.name,n=e.data,r=e.showAs,o=e.avgLine,s=e.countOpacity,a=e.color;if(!t?.length)throw new Error("AggregatedSeries: name required");if(!Array.isArray(n))throw new Error("AggregatedSeries: data must be an array");return {name:t,data:Xn(n),showAs:r,avgLine:o,countOpacity:s,...a!==void 0&&{style:{line:{color:a},fill:a}}}}function Xn(i){let e=t=>typeof t=="number"?t:null;return i.map(t=>{let n=t;return {time:n.time??0,min:e(n.min),max:e(n.max),avg:e(n.avg),count:typeof n.count=="number"?n.count:0}})}function pt(i,e,t){return typeof e=="function"?e(i):i[e??t]}function Yn(i,e,t){if(i instanceof Date){let n=i.getTime();if(Number.isNaN(n))throw new TypeError(`toDataPoints: invalid Date at row ${t}`);return n}if(typeof i=="string"){let n=Date.parse(i);if(Number.isNaN(n))throw new TypeError(`toDataPoints: unparsable time string at row ${t}: ${i}`);return n}if(typeof i=="number"&&Number.isFinite(i))return e==="s"||e==="auto"&&Math.abs(i)>=1e8&&Math.abs(i)<1e11?i*1e3:i;throw new TypeError(`toDataPoints: missing or invalid time at row ${t}: ${String(i)}`)}function Un(i,e){if(i==null)return null;if(typeof i=="number")return Number.isNaN(i)?null:i;if(typeof i=="string"){let t=i.trim();if(t==="")return null;let n=Number(t);if(Number.isNaN(n))throw new TypeError(`toDataPoints: value is not a number at row ${e}: ${i}`);return n}throw new TypeError(`toDataPoints: invalid value at row ${e}: ${String(i)}`)}function Kt(i,e={}){let t=e.timeUnit??"ms",n=[];for(let r=0;r<i.length;r++){let o=i[r];if(o==null)throw new TypeError(`toDataPoints: empty row at ${r}`);let s=Array.isArray(o),a=s&&e.time===void 0?o[0]:pt(o,e.time,"time"),l=s&&e.value===void 0?o[1]:pt(o,e.value,"value"),h={time:Yn(a,t,r),value:Un(l,r)};if(e.annotation!==void 0){let m=pt(o,e.annotation,"annotation");typeof m=="string"&&m!==""&&(h.annotation=m);}n.push(h);}return (e.sort??true)&&n.sort((r,o)=>r.time-o.time),n}function qn(i,e,t={}){return {name:i,data:Kt(e,t)}}function Jt(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Qt(i,e){if(!Jt(i)||!Jt(e))return e;let t={...i};for(let[n,r]of Object.entries(e))t[n]=Qt(t[n],r);return t}function Zn(...i){let e;for(let t of i)t!==void 0&&(e=Qt(e,t));return e??{}}/*!
|
|
44
|
+
`),s=e.cssClass?` class="${this._esc(e.cssClass)}"`:"",a=e.id?` id="${this._esc(e.id)}"`:"",m=e.plotClipId||t,l=m?` clip-path="url(#${this._esc(m)})"`:"";return `<g${s}${a}${l}${i?.attrs??""}>
|
|
45
|
+
${o}
|
|
46
|
+
</g>`}_esc(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}};function Wn(n){return typeof requestAnimationFrame=="function"?requestAnimationFrame(n):setTimeout(()=>n(0),16)}function En(n){typeof cancelAnimationFrame=="function"?cancelAnimationFrame(n):clearTimeout(n);}function zt(){let n=0,e=false;return {schedule:t=>{e||(e=true,n=Wn(()=>{e=false,t();}));},cancel:()=>{e&&(e=false,En(n));}}}var Vt="http://www.w3.org/2000/svg";function Hn(n){let e=n.style?.line;return e&&!Array.isArray(e)&&e.color?e.color:b.stroke}function Nt(n){return n.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function zn(n){if(n.length===0)return "";let e=new Date(n[0].time).toLocaleString(),t=n.map(r=>`<div><span class="mlc-tooltip__name">${Nt(r.series.name)}:</span> ${r.value.toFixed(2)}</div>`);return `<div class="mlc-tooltip__time">${Nt(e)}</div>${t.join("")}`}function Vn(n,e){if(n.length===0)return;let t=0,r=n.length-1;for(;t<r;){let s=t+r>>1;n[s].time<e?t=s+1:r=s;}let i=n[Math.max(0,t-1)],o=n[t];return Math.abs(i.time-e)<=Math.abs(o.time-e)?i:o}function Nn(n){return "value"in n?n.value:n.avg}function me(n,e,t={}){let r=n.querySelector("svg");if(!r)throw new Error("attachTooltip: target has no <svg> child (did you mount the chart first?)");let i=t.format??zn,o=t.snapRadius??1/0,s=t.className??"mlc-tooltip",a=t.showPicks??true,m=t.pickRadius??5,l=t.picksClassName??"mlc-tooltip-picks",h=document.createElement("div");h.className=s,h.style.position="absolute",h.style.pointerEvents="none",h.style.display="none",getComputedStyle(n).position==="static"&&(n.style.position="relative"),n.appendChild(h);let u=null;a&&(u=document.createElementNS(Vt,"g"),u.setAttribute("class",l),u.setAttribute("pointer-events","none"),r.appendChild(u));let c=()=>{u&&u.replaceChildren();},p=e.series.map((k,_)=>({data:k.data.map(A=>({time:A.time,value:Nn(A)})).filter(A=>A.value!==null).sort((A,C)=>A.time-C.time),series:k,index:_})),d=zt(),f=null,g=k=>{let _=r.getBoundingClientRect(),$=e.getWidth?.()??_.width,A=(k.clientX-_.left)*$/Math.max(1,_.width);e.getHeight?.()??_.height;let B=e.invertTime(A);if(!Number.isFinite(B)){h.style.display="none";return}let M=[];for(let T of p){let v=Vn(T.data,B);if(!v)continue;let L=e.project(v.time,v.value,T.series.yAxisIndex??0).x,R=e.project(v.time,v.value,T.series.yAxisIndex??0).y;Math.abs(L-A)>o||M.push({seriesIndex:T.index,series:T.series,time:v.time,value:v.value,x:L,y:R});}if(M.length===0){h.style.display="none",c();return}h.innerHTML=i(M);let F=n.getBoundingClientRect(),D=12,P=(k.clientX-_.left)/Math.max(1,_.width),E=(k.clientY-_.top)/Math.max(1,_.height),G=P<.5?`${D}px`:`calc(-100% - ${D}px)`,O=E<.5?`${D}px`:`calc(-100% - ${D}px)`;if(h.style.left=`${k.clientX-F.left}px`,h.style.top=`${k.clientY-F.top}px`,h.style.transform=`translate(${G}, ${O})`,h.style.display="",u){u.replaceChildren();for(let T of M){let v=document.createElementNS(Vt,"circle");v.setAttribute("cx",String(T.x)),v.setAttribute("cy",String(T.y)),v.setAttribute("r",String(m)),v.setAttribute("fill","#ffffff"),v.setAttribute("stroke",Hn(T.series)),v.setAttribute("stroke-width","2"),v.setAttribute("class",`${l}__dot`),u.appendChild(v);}}},y=k=>{f=k,d.schedule(()=>{f&&g(f);});},x=()=>{f=null,d.cancel(),h.style.display="none",c();};r.addEventListener("mousemove",y),r.addEventListener("mouseleave",x);let S=false;return ()=>{S||(S=true,f=null,d.cancel(),r.removeEventListener("mousemove",y),r.removeEventListener("mouseleave",x),h.remove(),u&&u.remove());}}function Xn(n,e={}){let t=typeof n=="string"?document.querySelector(n):n;if(!t)throw new Error(`mount: target ${typeof n=="string"?`'${n}'`:""} not found`);let{tooltip:r,...i}=e,o=i.width??t.clientWidth??800,s=i.height??350,a=new K({...i,width:o,height:s}),{content:m}=new Y().render(a.renderCommands());t.innerHTML=m;let l=t.querySelector("svg");return l&&(l.setAttribute("viewBox",`0 0 ${o} ${a.getHeight()}`),l.setAttribute("width","100%"),l.setAttribute("height",String(a.getHeight()))),r?.show&&me(t,a,r),a}var Le=class{_opts;_series=[];_thresholds=[];_annotations=[];_highlights=[];_markers=[];_bands=[];_tooltip;constructor(e,t){this._opts={},e!==void 0&&(this._opts.width=e),t!==void 0&&(this._opts.height=t);}setWidth(e){return this._opts.width=e,this}setHeight(e){return this._opts.height=e,this}setSize(e,t){return this._opts.width=e,this._opts.height=t,this}setMargin(e,t,r,i){return typeof e=="object"?this._opts.margin=e:this._opts.margin={top:e,right:t??0,bottom:r??0,left:i??0},this}setLocale(e){return this._opts.locale=e,this}setAxes(e){return this._opts.axes=e,this}setXAxis(e){return this._opts.axes={...this._opts.axes,x:{...this._opts.axes?.x,...e}},this}setLeftAxis(e){return this._opts.axes={...this._opts.axes,left:{...this._opts.axes?.left,...e}},this}setRightAxis(e){return this._opts.axes={...this._opts.axes,right:{...this._opts.axes?.right,...e}},this}setYAxis(e,t){this._opts.axes??={},this._opts.axes.y??=[];let r=[...this._opts.axes.y];for(;r.length<=e;)r.push({});return r[e]={...r[e],...t},this._opts.axes.y=r,this}setLegend(e,t,r){return typeof e=="object"?this._opts.legend=e:this._opts.legend={show:e,position:t,orientation:r},this}setGaps(e){return this._opts.gaps=e,this}setTooltip(e){return this._tooltip={show:true,...e},this}addSeries(e){return this._series.push(e),this}addSeriesAll(e){return this._series.push(...e),this}addThreshold(e){return this._thresholds.push(e),this}addThresholds(e){return this._thresholds.push(...e),this}addAnnotation(e){return this._annotations.push(e),this}addAnnotations(e){return this._annotations.push(...e),this}addHighlight(e){return this._highlights.push(e),this}addMarker(e){return this._markers.push(e),this}addAnnotationBand(e){return this._bands.push(e),this}clear(e){return (!e||e==="series")&&(this._series=[]),(!e||e==="thresholds")&&(this._thresholds=[]),(!e||e==="annotations")&&(this._annotations=[]),(!e||e==="highlights")&&(this._highlights=[]),(!e||e==="markers")&&(this._markers=[]),(!e||e==="bands")&&(this._bands=[]),this}toOptions(){return {...this._opts,series:this._series.length?this._series:this._opts.series,thresholds:this._thresholds.length?this._thresholds:this._opts.thresholds,annotations:this._annotations.length?this._annotations:this._opts.annotations,highlights:this._highlights.length?this._highlights:this._opts.highlights,markers:this._markers.length?this._markers:this._opts.markers,annotationBands:this._bands.length?this._bands:this._opts.annotationBands}}build(){return new K(this.toOptions())}getSvg(){let e=this.build(),{content:t}=new Y().render(e.renderCommands());return t}mount(e){let t=typeof e=="string"?document.querySelector(e):e;if(!t){let s=typeof e=="string"?`'${e}'`:"";throw new Error(`GraphBuilder.mount: target ${s} not found`)}this._opts.width||(this._opts.width=t.clientWidth||800);let r=this.build(),{content:i}=new Y().render(r.renderCommands());t.innerHTML=i;let o=t.querySelector("svg");if(o){let s=this._opts.width??800;o.setAttribute("viewBox",`0 0 ${s} ${r.getHeight()}`),o.setAttribute("width","100%"),o.setAttribute("height",String(r.getHeight()));}return this._tooltip?.show&&me(t,r,this._tooltip),r}};var Me=class{_series;constructor(e){this._series={name:e,data:[]};}addPoint(e,t){return this._series.data.push({time:e,value:t}),this}setData(e){return this._series.data=[...e],this}addPoints(e){return this._series.data.push(...e),this}addFloats(e,t){let r=Math.min(e.length,t.length);for(let i=0;i<r;i++)this._series.data.push({time:e[i],value:t[i]});return this}addNullPoint(e){return this._series.data.push({time:e,value:null}),this}setYAxisIndex(e){return this._series.yAxisIndex=e,this}setColor(e){return this._series.style??={},!this._series.style.line||typeof this._series.style.line=="boolean"?this._series.style.line={color:e}:Array.isArray(this._series.style.line)?this._series.style.line.length===0?this._series.style.line=[{color:e}]:this._series.style.line[0].color=e:this._series.style.line.color=e,this}setStyle(e){return this._series.style=e,this}setLineStyle(e,t,r){return this._series.style??={},this._series.style.line={color:e,width:t,style:r},this}setSmoothing(e,t){return this._series.style??={},!this._series.style.line||typeof this._series.style.line=="boolean"?this._series.style.line={smoothing:e,smoothingType:t}:Array.isArray(this._series.style.line)?this._series.style.line.length===0?this._series.style.line=[{smoothing:e,smoothingType:t}]:(this._series.style.line[0].smoothing=e,this._series.style.line[0].smoothingType=t):(this._series.style.line.smoothing=e,this._series.style.line.smoothingType=t),this}setFill(e){return this._series.style??={},this._series.style.fill=e,this}setID(e){return this._series.id=e,this}setColorByThresholds(e){return this._series.colorByThresholds=e,this}build(){return this._series}};var De=class{_threshold;constructor(e,t){this._threshold={name:e,value:t};}setColor(e){return this._threshold.color=e,this}setLine(e){return this._threshold.line=e,this}setFill(e,t){return this._threshold.fill=e,this._threshold.fillOpacity=t,this}setFillHatch(e){return this._threshold.fillHatch=e,this}setLabel(e,t){return this._threshold.label={text:e,position:t},this}setID(e){return this._threshold.id=e,this}build(){return this._threshold}};var $e=class{_marker;constructor(e){this._marker={time:e};}setValue(e){return this._marker.value=e,this}setLabel(e){return this._marker.label=e,this}setColor(e){return this._marker.color=e,this}setPointStyle(e){return this._marker.pointStyle=e,this}setLineStyle(e){return e==="none"?delete this._marker.lineStyle:this._marker.lineStyle=e,this}setSeriesIndex(e){return this._marker.seriesIndex=e,this}build(){return this._marker}};var Pe=class{_highlight;constructor(e,t){this._highlight={startTime:e,endTime:t};}setLabel(e){return this._highlight.label=e,this}setColor(e){return this._highlight.color=e,this}setOpacity(e){return this._highlight.opacity=e,this}setLabelPosition(e){return this._highlight.labelPosition=e,this}setRotate(e){return this._highlight.rotate=e,this}build(){return this._highlight}};var Re=class{_ann;constructor(e){this._ann={type:e};}setID(e){return this._ann.id=e,this}setTitle(e){return this._ann.title=e,this}setFrom(e,t,r){return this._ann.from={time:e,value:t,axis:r},this}setTo(e,t,r){return this._ann.to={time:e,value:t,axis:r},this}setAt(e,t,r){return this._ann.at={time:e,value:t,axis:r},this}setColor(e){return this._ann.color=e,this}setWidth(e){return this._ann.width=e,this}setDash(e){return this._ann.dash=e,this}setHeadSize(e){return this._ann.headSize=e,this}setFill(e){return this._ann.fill=e,this}setHatch(e){return this._ann.hatch=e,this}setStroke(e){return this._ann.stroke=e,this}setOpacity(e){return this._ann.opacity=e,this}setRadius(e){return this._ann.radius=e,this}setShape(e){return this._ann.shape=e,this}setText(e){return this._ann.text=e,this}setAnchor(e){return this._ann.anchor=e,this}setDx(e){return this._ann.dx=e,this}setDy(e){return this._ann.dy=e,this}setRotate(e){return this._ann.rotate=e,this}build(){return this._ann}};var je=class{_band;constructor(e){this._band={name:e,items:[]};}setHeight(e){return this._band.height=e,this}setSpacing(e){return this._band.spacing=e,this}setHatch(e){return this._band.hatch=e,this}setShowAxis(e){return this._band.showAxis=e,this}setShowInLegend(e){return this._band.showInLegend=e,this}setBackground(e){return this._band.background=e,this}addItem(e){return this._band.items.push(e),this}build(){return this._band}},Be=class{_item;constructor(e,t){this._item={startTime:e,endTime:t};}setFill(e){return this._item.fill=e,this}setHatch(e){return this._item.hatch=e,this}setStroke(e){return this._item.stroke=e,this}setStrokeWidth(e){return this._item.strokeWidth=e,this}setLabel(e,t,r,i){return this._item.label=e,t!==void 0&&(this._item.labelFontSize=t),r!==void 0&&(this._item.labelFill=r),i!==void 0&&(this._item.labelBaseline=i),this}build(){return this._item}};function Yn(n){let{thresholds:e,colors:t,hatches:r}=n;if(t.length!==e.length+1)throw new Error(`fillBetweenThresholds: expected ${e.length+1} colors for ${e.length} thresholds, got ${t.length}`);if(r!==void 0&&r.length!==t.length)throw new Error(`fillBetweenThresholds: hatches length (${r.length}) must equal colors length (${t.length})`);return {regions:t.map((o,s)=>{let a=r?.[s],m=a?{color:o,hatch:a}:o;return s===0?{to:{threshold:e[0]},fill:m}:s===t.length-1?{from:{threshold:e[e.length-1]},fill:m}:{from:{threshold:e[s-1]},to:{threshold:e[s]},fill:m}})}}function Ye(n){if(!n||typeof n!="object")throw new Error("DataPoint: object expected");let{time:e,value:t,annotation:r}=n;if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`DataPoint: invalid time=${e}`);if(t!==null&&(typeof t!="number"||Number.isNaN(t)))throw t===void 0?new Error("DataPoint: missing value"):typeof t=="object"&&"value"in t?new Error("DataPoint: nested value object"):new Error(`DataPoint: invalid value=${t}`);return {time:e,value:t,annotation:r&&typeof r=="string"?r:void 0}}function Un(n){if(Array.isArray(n))return n.map(Ye);if(n&&typeof n=="object"){let e=n,t=e.name,r=e.data,i=e.sensorType,o=e.enumMap,s=e.color,a=e.lineWidth,m=e.smoothing,l=e.seriesType;if(!t?.length)throw new Error("Series: name required");if(!Array.isArray(r))throw new Error("Series: data must be an array");let h=s!==void 0||a!==void 0||m!==void 0?{color:s,width:a,smoothing:m}:void 0;return {name:t,data:r.map(Ye),sensorType:i??"numeric",enumMap:o,seriesType:l,...h&&{style:{line:h}}}}throw new Error("parseSeries: object or DataPoint[] expected")}function Zn(n){if(!n||typeof n!="object")throw new Error("parseAggregated: object expected");let e=n,t=e.name,r=e.data,i=e.showAs,o=e.avgLine,s=e.countOpacity,a=e.color;if(!t?.length)throw new Error("AggregatedSeries: name required");if(!Array.isArray(r))throw new Error("AggregatedSeries: data must be an array");return {name:t,data:Kn(r),showAs:i,avgLine:o,countOpacity:s,...a!==void 0&&{style:{line:{color:a},fill:a}}}}function Kn(n){let e=t=>typeof t=="number"?t:null;return n.map(t=>{let r=t;return {time:r.time??0,min:e(r.min),max:e(r.max),avg:e(r.avg),count:typeof r.count=="number"?r.count:0}})}function Ue(n,e,t){return typeof e=="function"?e(n):n[e??t]}function qn(n,e,t){if(n instanceof Date){let r=n.getTime();if(Number.isNaN(r))throw new TypeError(`toDataPoints: invalid Date at row ${t}`);return r}if(typeof n=="string"){let r=Date.parse(n);if(Number.isNaN(r))throw new TypeError(`toDataPoints: unparsable time string at row ${t}: ${n}`);return r}if(typeof n=="number"&&Number.isFinite(n))return e==="s"||e==="auto"&&Math.abs(n)>=1e8&&Math.abs(n)<1e11?n*1e3:n;throw new TypeError(`toDataPoints: missing or invalid time at row ${t}: ${String(n)}`)}function Jn(n,e){if(n==null)return null;if(typeof n=="number")return Number.isNaN(n)?null:n;if(typeof n=="string"){let t=n.trim();if(t==="")return null;let r=Number(t);if(Number.isNaN(r))throw new TypeError(`toDataPoints: value is not a number at row ${e}: ${n}`);return r}throw new TypeError(`toDataPoints: invalid value at row ${e}: ${String(n)}`)}function Xt(n,e={}){let t=e.timeUnit??"ms",r=[];for(let i=0;i<n.length;i++){let o=n[i];if(o==null)throw new TypeError(`toDataPoints: empty row at ${i}`);let s=Array.isArray(o),a=s&&e.time===void 0?o[0]:Ue(o,e.time,"time"),m=s&&e.value===void 0?o[1]:Ue(o,e.value,"value"),l={time:qn(a,t,i),value:Jn(m,i)};if(e.annotation!==void 0){let h=Ue(o,e.annotation,"annotation");typeof h=="string"&&h!==""&&(l.annotation=h);}r.push(l);}return (e.sort??true)&&r.sort((i,o)=>i.time-o.time),r}function Qn(n,e,t={}){return {name:n,data:Xt(e,t)}}function Yt(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function Ut(n,e){if(!Yt(n)||!Yt(e))return e;let t={...n};for(let[r,i]of Object.entries(e))t[r]=Ut(t[r],i);return t}function er(...n){let e;for(let t of n)t!==void 0&&(e=Ut(e,t));return e??{}}/*!
|
|
44
47
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
45
48
|
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
46
49
|
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
@@ -59,4 +62,4 @@ ${n}
|
|
|
59
62
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
60
63
|
* MIT with Attribution: free use incl. commercial must have visible credit to
|
|
61
64
|
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
62
|
-
*/export{
|
|
65
|
+
*/export{je as AnnotationBandBuilder,Be as AnnotationBandItemBuilder,Re as AnnotationBuilder,Le as GraphBuilder,Pe as HighlightBuilder,K as MLTimeGraph,$e as MarkerBuilder,Y as SVGRenderer,De as ThresholdBuilder,Me as TimeSeriesBuilder,Ne as VERSION,me as attachTooltip,be as drawMarker,rn as estimateMetrics,Yn as fillBetweenThresholds,Q as getDefaultTheme,qe as getLineStyle,V as liberationMetrics,er as mergeOptions,Xn as mount,Zn as parseAggregated,Ye as parseDataPoint,Un as parseSeries,Jt as resetDefaultTheme,Ge as resolveDash,qt as setDefaultTheme,z as slugify,Xt as toDataPoints,Qn as toSeries};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DataPoint, a as DrawCommand, T as TimeScale, L as LinearScale } from '../scale-
|
|
1
|
+
import { D as DataPoint, a as DrawCommand, T as TimeScale, L as LinearScale } from '../scale-CDPJGYpZ.js';
|
|
2
2
|
|
|
3
3
|
/*!
|
|
4
4
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|