ml-time-graph 1.23.0 → 1.24.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 CHANGED
@@ -19,6 +19,13 @@ release notes, and every change is in `git log` in full.
19
19
 
20
20
  ---
21
21
 
22
+ ## [1.24.0] - 2026-11-06
23
+
24
+ ### Added
25
+ - **`legend.colors` on a series** (TS and Go) — the legend swatch shows several colours side by side,
26
+ e.g. the zones of a `colorByThresholds` line, instead of only its base colour. `legendItems()`
27
+ returns them as `colors`.
28
+
22
29
  ## [1.23.0] - 2026-11-02
23
30
 
24
31
  ### Added
@@ -154,6 +154,7 @@ A series is either a `TimeSeries` (individual samples) or an `AggregatedSeries`
154
154
  | `yAxisIndex` | `number` | Which Y scale to draw on (`0` = left, `1` = right) |
155
155
  | `seriesType` | `'line' \| 'area' \| 'step'` | Render mode (default `'line'`) |
156
156
  | `colorByThresholds` | `string[]` | Colors applied segment-wise depending on which thresholds the values cross |
157
+ | `legend` | `{ colors?: string[] }` | Legend swatch in several colours side by side — e.g. the zone colours of a `colorByThresholds` line, which otherwise shows only its base colour. Also on aggregated series. Unreleased. |
157
158
 
158
159
  ### DataPoint
159
160
 
package/README.de.md CHANGED
@@ -16,6 +16,9 @@ Browser und im Backend.
16
16
  > sechzehn Seiten, jede Karte mit Code- und Werte-Reiter, nichts zu installieren. Dieselben Seiten
17
17
  > stecken im [Handbuch](https://mlcgo.eu/books/mlctimegraph/).
18
18
 
19
+ > ✏️ **[Selbst bearbeiten: Playground](https://play.mlcgo.eu/ml-time-graph)** — Beispiele im Browser
20
+ > ändern, mit Autovervollständigung und Typprüfung, und das Ergebnis als Link teilen.
21
+
19
22
  > 🤖 **Sie arbeiten mit einem KI-Assistenten?** Das Paket bringt einen Agent-Skill mit,
20
23
  > **[skills/ml-time-graph/SKILL.md](https://gitlab.com/mlc0911/mlctimegraph/-/blob/main/packages/ml-time-graph/skills/ml-time-graph/SKILL.md)** — nach `npm install` liegt er unter
21
24
  > `node_modules/ml-time-graph/skills/ml-time-graph/`. Kopieren Sie den Ordner in das
package/README.md CHANGED
@@ -16,6 +16,9 @@ backend.
16
16
  > pages, every card with a Code and a Values tab, nothing to install. The same pages are embedded
17
17
  > in the [handbook](https://mlcgo.eu/books/mlctimegraph/).
18
18
 
19
+ > ✏️ **[Edit and run it: playground](https://play.mlcgo.eu/ml-time-graph)** — change an example in
20
+ > the browser, with autocompletion and type checks, and share the result as a link.
21
+
19
22
  > 🤖 **Working with an AI coding assistant?** The package ships an agent skill,
20
23
  > **[skills/ml-time-graph/SKILL.md](https://gitlab.com/mlc0911/mlctimegraph/-/blob/main/packages/ml-time-graph/skills/ml-time-graph/SKILL.md)** — after `npm install` it sits at
21
24
  > `node_modules/ml-time-graph/skills/ml-time-graph/`. Copy that folder into your agent's skills
package/USAGE.md CHANGED
@@ -257,6 +257,10 @@ new MLTimeGraph({
257
257
  leaving it out.
258
258
  - `colorByThresholds: string[]` colours the line by zone — base colour below the
259
259
  lowest threshold, then each threshold's colour for values above it.
260
+ - The legend shows such a series in its base colour only — the colour of the *lowest*
261
+ zone. Give it `legend: { colors: ['#2563eb', '#16a34a', '#dc2626'] }` and the swatch
262
+ shows all of them side by side, left to right. A legend you draw yourself gets them
263
+ from `legendItems()` as `colors`; `color` stays the base colour.
260
264
 
261
265
  ### Data outside the axis range
262
266
 
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { M as MLTimeGraphOptions, L as LegendItem, b as Margin, Y as YAxisConfig, A as AxesConfig, X as XAxisConfig, c as LegendOptions, d as LegendPosition, e as LegendOrientation, f as Marker, g as RenderOutput } from './marker_renderer-Be-IsY5V.js';
1
+ import { M as MLTimeGraphOptions, L as LegendItem, b as Margin, Y as YAxisConfig, A as AxesConfig, X as XAxisConfig, c as LegendOptions, d as LegendPosition, e as LegendOrientation, f as Marker, g as RenderOutput } from './marker_renderer-Dph9cKDY.js';
2
2
  import { Renderer, LayoutResult } from './internals.js';
3
- export { h as AxisLabelsStyle, i as AxisStyle, G as GridLineStyle, j as GridStyle, T as TextMetrics, k as Theme, l as TickConfig, m as TickFormat, n as drawMarker, o as estimateMetrics, p as getDefaultTheme, q as liberationMetrics, r as resetDefaultTheme, s as setDefaultTheme, t as slugify } from './marker_renderer-Be-IsY5V.js';
4
- import { e as AnySeries, i as Annotation, a as DrawCommand, g as Gap, h as GapsConfig, f as Threshold, H as Highlight, j as AnnotationBandConfig, l as SeriesStyle, c as LineVariant, S as SmoothingType, F as FillSpec, m as TimeSeries, b as LineDashStyle, n as ThresholdFill, k as HatchVariant, o as ThresholdLabelPosition, P as PointStyleType, M as MarkerLineStyle, R as RangeLabelPosition, p as AnnotationPointShape, q as LabelAnchor, r as AnnotationBandItem, s as TextBaseline, t as AggregatedPoint, u as AggregatedSeries, D as DataPoint } from './types-fDUNEN4P.js';
3
+ export { h as AxisLabelsStyle, i as AxisStyle, G as GridLineStyle, j as GridStyle, T as TextMetrics, k as Theme, l as TickConfig, m as TickFormat, n as drawMarker, o as estimateMetrics, p as getDefaultTheme, q as liberationMetrics, r as resetDefaultTheme, s as setDefaultTheme, t as slugify } from './marker_renderer-Dph9cKDY.js';
4
+ import { e as AnySeries, i as Annotation, a as DrawCommand, g as Gap, h as GapsConfig, f as Threshold, H as Highlight, j as AnnotationBandConfig, l as SeriesStyle, c as LineVariant, S as SmoothingType, F as FillSpec, m as TimeSeries, b as LineDashStyle, n as ThresholdFill, k as HatchVariant, o as ThresholdLabelPosition, P as PointStyleType, M as MarkerLineStyle, R as RangeLabelPosition, p as AnnotationPointShape, q as LabelAnchor, r as AnnotationBandItem, s as TextBaseline, t as AggregatedPoint, u as AggregatedSeries, D as DataPoint } from './types-B9bbJxmn.js';
5
5
  import { TimeScale, LinearScale } from './internals.js';
6
- export { v as AggregatedShowAs, w as AggregationConfig, x as AggregationMode, y as AnnotationBandLabels, z as AnnotationKind, B as AxisOrientation, A as AxisPosition, C as DataPointRef, E as EnumMap, I as FillBound, J as FillRegion, K as FillSide, N as FillStyle, O as FillWhere, Q as GapBand, U as GapConfig, V as GapLabel, W as GapRegion, X as GapStyle, Y as GapsAtEnd, G as GridLayer, Z as LineShape, _ as LineStyle, $ as MarkerStyle, a0 as MovingAverageType, a1 as SVGLineStyle, a2 as SensorType, a3 as SeriesGapStyle, a4 as SeriesGaps, a5 as SeriesOverlay, a6 as SeriesOverlayKind, a7 as SeriesType, a8 as ShadowStyle, a9 as SolidDashStyle, aa as ThresholdLabelConfig, ab as getLineStyle, ac as resolveDash } from './types-fDUNEN4P.js';
6
+ export { v as AggregatedShowAs, w as AggregationConfig, x as AggregationMode, y as AnnotationBandLabels, z as AnnotationKind, B as AxisOrientation, A as AxisPosition, C as DataPointRef, E as EnumMap, I as FillBound, J as FillRegion, K as FillSide, N as FillStyle, O as FillWhere, Q as GapBand, U as GapConfig, V as GapLabel, W as GapRegion, X as GapStyle, Y as GapsAtEnd, G as GridLayer, Z as LineShape, _ as LineStyle, $ as MarkerStyle, a0 as MovingAverageType, a1 as SVGLineStyle, a2 as SensorType, a3 as SeriesGapStyle, a4 as SeriesGaps, a5 as SeriesLegend, a6 as SeriesOverlay, a7 as SeriesOverlayKind, a8 as SeriesType, a9 as ShadowStyle, aa as SolidDashStyle, ab as ThresholdLabelConfig, ac as getLineStyle, ad as resolveDash } from './types-B9bbJxmn.js';
7
7
 
8
8
  /*!
9
9
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
@@ -1175,7 +1175,7 @@ declare function mergeOptions(...layers: (OptionsLayer | undefined)[]): MLTimeGr
1175
1175
  * Monate spaeter eine Datei aus einem Stapel von Berichten in der Hand haelt,
1176
1176
  * kann sonst nicht feststellen, welcher Stand sie gezeichnet hat.
1177
1177
  */
1178
- declare const VERSION = "1.23.0";
1178
+ declare const VERSION = "1.24.0";
1179
1179
 
1180
1180
  export { AggregatedPoint, AggregatedSeries, Annotation, AnnotationBandBuilder, AnnotationBandConfig, AnnotationBandItem, AnnotationBandItemBuilder, AnnotationBuilder, AnnotationPointShape, AnySeries, AxesConfig, DataPoint, DrawCommand, FillSpec, Gap, GapsConfig, GraphBuilder, HatchVariant, Highlight, HighlightBuilder, LabelAnchor, LegendItem, LegendOptions, LegendOrientation, LegendPosition, LineDashStyle, LineVariant, MLTimeGraph, MLTimeGraphOptions, Margin, Marker, MarkerBuilder, MarkerLineStyle, PointStyleType, RangeLabelPosition, RenderOutput, SVGRenderer, SeriesStyle, SmoothingType, TextBaseline, Threshold, ThresholdBuilder, ThresholdFill, ThresholdLabelPosition, TimeSeries, TimeSeriesBuilder, VERSION, XAxisConfig, YAxisConfig, attachTooltip, autoMargin, axisGroups, fillBetweenThresholds, mergeOptions, mount, parseAggregated, parseDataPoint, parseSeries, toDataPoints, toSeries, zeigerImSvg };
1181
1181
  export type { AutoMarginOptions, AxisGroupInput, AxisGroups, FieldAccessor, FillBetweenThresholdsInput, LimitStatsPoint, MktPoint, OptionsLayer, PointAt, PointsAtOptions, StatsAggregatedPoint, StdDevPoint, TimeInput, ToDataPointsSpec, TooltipOptions, TooltipSample };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- function Z(t){return t===true?{major:{}}:t===false?{major:false}:t}function Ve(t){return "avg"in t}function ht(t){return Ve(t)?t.min===null||t.max===null||t.avg===null:t.value===null}function ct(t){return !Ve(t)&&!!t.synthetic}function dt(t,e,n,r,i,o){if(Ve(t)){let a=r.map(t.min),m=r.map(t.max),l=Math.min(a,m),u=Math.max(a,m),h=i<l?l-i:i>u?i-u:0;return {time:t.time,min:t.min,max:t.max,avg:t.avg,count:t.count,...o?{held:o}:{},x:e,y:r.map(t.avg),distance:Math.hypot(n,h),dx:n}}let s=r.map(t.value);return {time:t.time,value:t.value,...o?{held:o}:{},x:e,y:s,distance:Math.hypot(n,s-i),dx:n}}function Xn(t,e){return t.dx<e.dx-1e-6?true:t.dx>e.dx+1e-6?false:t.distance<e.distance-1e-6}function Zn(t,e,n,r,i,o,s){let a=null;for(let m of t){if(ht(m)||ct(m))continue;let l=e.map(m.time);if(l<r.x||l>r.x+r.width)continue;let u=Math.abs(l-i);if(u>s)continue;let h=dt(m,l,u,n,o,false);(!a||Xn(h,a))&&(a=h);}return a}function Un(t,e,n){let r=-1;for(let i=0;i<t.length&&e.map(t[i].time)<=n+1e-6;i++)r=i;for(;r>=0;r--){if(ht(t[r]))return -1;if(!ct(t[r]))return r}return -1}function qn(t,e,n,r,i,o){let s=Un(t,n,r);if(s<0)return null;let a=t[s],m=t[s+1];if(e.gapThreshold>0&&m&&m.time-a.time>e.gapThreshold)return null;let l=n.invert(r);if(o!==void 0&&l-a.time>o)return null;let u=n.map(a.time),h=u<r-1e-6;return dt(a,h?r:u,h?0:Math.abs(u-r),e.skala,i,h)}function Jn(t){return t.punkte.map(e=>t.kind==="stdDevBand"?{time:e.time,min:e.low,max:e.high,avg:e.value,count:0}:{time:e.time,value:e.value})}function Qn(t,e,n){let r={overlayOf:n,overlayIndex:e.index,overlayKind:e.kind};if(e.kind!=="stdDevBand")return {...t,...r};let{min:i,max:o,avg:s,count:a,...m}=t;return {...m,value:s,low:i,high:o,...r}}function pt(t,e,n,r,i,o,s){if(i<r.x||i>r.x+r.width||o<r.y||o>r.y+r.height)return [];let a=new Set(s.hidden??[]),m=[];return t.forEach((l,u)=>{let h=l.id??l.name;if(a.has(h))return;let c=n(l,u);if(!c)return;let p=s.modes?.[h]??s.mode??(c.stufe?"hold":"nearest"),d=(y,b)=>p==="hold"?qn(y,b,e,i,o,s.maxAgeMs):Zn(y,e,b.skala,r,i,o,s.radius),g=(y,b,S)=>{let{dx:w,...T}=y,_=T.value??T.avg;return {seriesId:h,name:l.name,axisIndex:c.achse,...T,color:b,...S?{line:S}:{},...c.format&&_!==void 0?{label:c.format(_)}:{}}},f=d(l.data,c);if(f&&m.push(g(f,c.farbe,c.linie)),!!s.overlays)for(let y of c.overlays??[]){let b=d(Jn(y),{...c,gapThreshold:0});b&&m.push(Qn(g(b,y.farbe,y.linie),y,h));}}),m}var ee=class t{_config;constructor(e){this._config=e;}compute(){let{width:e,height:n,margin:r}=this._config;return {totalWidth:e,totalHeight:n,chartWidth:e-r.left-r.right,chartHeight:n-r.top-r.bottom,chartX:r.left,chartY:r.top,margin:r}}static default(e=800,n=400){return new t({width:e,height:n,margin:{top:20,right:20,bottom:40,left:60}})}};var er=[[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"]],Ne=.6,tr=(()=>{let t=new Map;for(let[e,,n]of er){let r=n.split(",");for(let i=0;i<r.length;i++)t.set(e+i,Number(r[i])/1e3);}return t})();function ft(t){return tr.get(t)??Ne}var O=(t,e)=>{let n=0;for(let r of t)n+=ft(r.codePointAt(0)??0);return n*e},nr=(t,e)=>[...t].length*e*Ne;function gt(t,e,n){let r=0;for(let i of t)r=Math.max(r,n(i,e));return r}var ir=.2,ae=4,te=1e-6,or=6,sr=.4;function ar(t){return t?.map(e=>{let n=e.data;if(n.length<=4)return e;let r=(l,u)=>"avg"in l?u?l.max:l.min:l.value,i=new Set,o=0,s=0,a=-1,m=-1;n.forEach((l,u)=>{l.time<n[o].time&&(o=u),l.time>n[s].time&&(s=u);let h=r(l,false),c=r(l,true);h!==null&&(a<0||h<r(n[a],false))&&(a=u),c!==null&&(m<0||c>r(n[m],true))&&(m=u);});for(let l of [o,s,a,m])l>=0&&i.add(l);return {...e,data:n.filter((l,u)=>i.has(u))}})}function lr(t,e){if(!t.content)return null;let n=t.fontSize??11,r=e(t.content,n),i=t.anchor==="middle"?-r/2:t.anchor==="end"?-r:0,[o,s]=t.textBaseline==="middle"?[-n/2,n/2]:t.textBaseline==="top"?[0,n]:t.textBaseline==="bottom"?[-n,0]:[-0.8*n,ir*n],a=[[i,o],[i+r,o],[i,s],[i+r,s]],m=(t.rotate??0)*Math.PI/180,l=Math.cos(m),u=Math.sin(m),h=a.map(([p,d])=>t.x+p*l-d*u),c=a.map(([p,d])=>t.y+p*u+d*l);return {x0:Math.min(...h),y0:Math.min(...c),x1:Math.max(...h),y1:Math.max(...c)}}function le(t,e){return {x0:Math.min(...t),y0:Math.min(...e),x1:Math.max(...t),y1:Math.max(...e)}}function yt(t,e,n=[]){for(let r of t)switch(r.type){case "group":{let i=r.cssClass??"";if(r.clipRect||r.plotClipId||i.startsWith("chart-legend")||i.startsWith("annotation-band"))break;yt(r.commands,e,n);break}case "text":{let i=lr(r,e);i&&n.push(i);break}case "line":n.push(le([r.x1,r.x2],[r.y1,r.y2]));break;case "rect":n.push(le([r.x,r.x+r.w],[r.y,r.y+r.h]));break;case "circle":n.push(le([r.cx-r.r,r.cx+r.r],[r.cy-r.r,r.cy+r.r]));break;case "path":r.points.length>0&&n.push(le(r.points.map(i=>i.x),r.points.map(i=>i.y)));break;case "gap":n.push(le([r.x1,r.x2],[r.y1,r.y2]));break}return n}function Ke(t,e={}){return mr(t,e)}function mr(t,e,n){let r=e.padding||4,i=Math.max(e.minimum||8,ae),o=t.textMetrics??O,s=ar(t.series),a=h=>{let c=new V({...t,series:s,margin:h}),p=c.renderCommands();return {kaesten:yt(p,o),plot:c.plotRect,breite:c.layout.totalWidth,hoehe:c.layout.totalHeight}},m=typeof t.margin=="object"?t.margin:void 0,l={top:Math.max(i,m?.top??20),right:Math.max(i,m?.right??20),bottom:Math.max(i,m?.bottom??40),left:Math.max(i,m?.left??60)},u;for(let h=0;h<or;h++){let c=a(l),p=a({...l,left:l.left+ae,right:l.right-ae}),d=a({...l,top:l.top+ae,bottom:l.bottom-ae}),g=p.kaesten.length===c.kaesten.length&&d.kaesten.length===c.kaesten.length,f=v=>g&&Math.abs(p.kaesten[v].x0-c.kaesten[v].x0)<te,y=v=>g&&Math.abs(d.kaesten[v].y0-c.kaesten[v].y0)<te,{plot:b}=c,S=b.x+b.width,w=b.y+b.height,T={left:0,right:0,top:0,bottom:0},_={left:0,right:0,top:0,bottom:0};c.kaesten.forEach((v,C)=>{f(C)?(v.x0<b.x-te&&(_.left=Math.max(_.left,v.x1)),v.x1>S+te&&(_.right=Math.max(_.right,c.breite-v.x0))):(T.left=Math.max(T.left,b.x-v.x0),T.right=Math.max(T.right,v.x1-S)),y(C)?(v.y0<b.y-te&&(_.top=Math.max(_.top,v.y1)),v.y1>w+te&&(_.bottom=Math.max(_.bottom,c.hoehe-v.y0))):(T.top=Math.max(T.top,b.y-v.y0),T.bottom=Math.max(T.bottom,v.y1-w));});let P=v=>_[v]>0?_[v]+r+T[v]:T[v]>0?T[v]+r:0,L={top:0,right:0,bottom:0,left:0};for(let v of ["top","right","bottom","left"]){let C=v==="top"||v==="bottom"?c.hoehe:c.breite,$=Math.max(i,Math.floor(C*sr));L[v]=Math.min(Math.max(i,Math.ceil(P(v)-1e-9)),$);}if(L.top===l.top&&L.right===l.right&&L.bottom===l.bottom&&L.left===l.left)return L;if(u&&L.top===u.top&&L.right===u.right&&L.bottom===u.bottom&&L.left===u.left)return {top:Math.max(L.top,l.top),right:Math.max(L.right,l.right),bottom:Math.max(L.bottom,l.bottom),left:Math.max(L.left,l.left)};u=l,l=L;}return l}function Ye(t,e){if(e)for(let n of t)n.type==="text"?n.fontFamily||(n.fontFamily=e):n.type==="group"&&Array.isArray(n.commands)&&Ye(n.commands,e);}function Xe(t,e){if(e)for(let n of t)"id"in n&&n.id&&(n.id=`${e}-${n.id}`),n.type==="group"&&Array.isArray(n.commands)&&Xe(n.commands,e);}function Ze(t,e){let n={...e,...t.style},r=n.fill,i,o;return typeof r=="string"?i=r:r&&(i=r.color,o=r.hatch),{startTime:t.startTime,endTime:t.endTime,label:t.label,fill:i,hatch:o,fillOpacity:n.opacity,labelBaseline:n.label?.baseline,rotate:n.label?.rotate,style:n.display==="bridge_line"?void 0:n.display}}function bt(t){if(!t)return {gaps:[],autoDetect:false,minGapMs:6e4};if(Array.isArray(t))return {gaps:t,autoDetect:false,minGapMs:6e4};let e=t.style;return {gaps:(t.regions??[]).map(r=>Ze(r,e)),autoDetect:t.autoDetect??false,minGapMs:t.minGapMs??6e4,band:e?.band,atEnd:t.atEnd}}function N(t){return t&&t.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}var xt=new Map;function ur(t,e){return `${t}|${JSON.stringify(e??{})}`}function St(t,e){let n=ur(t,e),r=xt.get(n);return r||(r=new Intl.DateTimeFormat(t,e),xt.set(n,r)),r}function wt(){return typeof navigator<"u"?navigator.language:void 0}var U=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let n=Number(e),[r,i]=this.#e,[o,s]=this.#t;return i===r?o:o+(n-r)/(i-r)*(s-o)}invert(e){let[n,r]=this.#e,[i,o]=this.#t;return o===i?n:n+(e-i)/(o-i)*(r-n)}domain(){return [...this.#e]}range(){return [...this.#t]}},z=[{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}],ne=class{#e;#t;#n;constructor(e){this.#e=new U({domain:e.domain,range:e.range}),this.#t=e.locale||(wt()??"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,n=3,r=12){let[i,o]=this.#e.domain(),s=o-i;if(s<=0)return {interval:z[0].ms};let a=s/e,m=z[0].ms;for(let h of z)if(h.ms>=a){m=h.ms;break}let l=m,u=Math.round(s/l);for(;u>r&&l<z[z.length-1].ms;){let h=z.findIndex(c=>c.ms===l);l=z[Math.min(h+1,z.length-1)].ms,u=Math.round(s/l);}for(;u<n&&l>z[0].ms;){let h=z.findIndex(c=>c.ms===l);l=z[Math.max(h-1,0)].ms,u=Math.round(s/l);}return {interval:l}}ticks(e){let n=e?.minTicks??5,r=e?.maxTicks??12,{interval:i}=this.tickInterval((n+r)/2,n,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,n){let r=this.#n?{...n,timeZone:this.#n}:n;return St(this.#t,r).format(new Date(e))}};var Ue={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 re={...Ue};function hr(t){re={...re,...t};}var fe=null;function me(){return fe??re}function ue(t,e){if(!t)return e();let n=fe;fe={...re,...t};try{return e()}finally{fe=n;}}function cr(){return re}function dr(){re={...Ue};}function pr(t){let e=t.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 fr(t){let e=t.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function ge(t,e="classic-diagonal",n="rgba(200, 220, 255, 0.3)",r,i=2){let o=pr(n),s=fr(n)?"":' fill-opacity="0.3"';if(e==="none")return `
1
+ function Z(t){return t===true?{major:{}}:t===false?{major:false}:t}function Ve(t){return "avg"in t}function ht(t){return Ve(t)?t.min===null||t.max===null||t.avg===null:t.value===null}function ct(t){return !Ve(t)&&!!t.synthetic}function dt(t,e,n,r,i,o){if(Ve(t)){let a=r.map(t.min),m=r.map(t.max),l=Math.min(a,m),u=Math.max(a,m),h=i<l?l-i:i>u?i-u:0;return {time:t.time,min:t.min,max:t.max,avg:t.avg,count:t.count,...o?{held:o}:{},x:e,y:r.map(t.avg),distance:Math.hypot(n,h),dx:n}}let s=r.map(t.value);return {time:t.time,value:t.value,...o?{held:o}:{},x:e,y:s,distance:Math.hypot(n,s-i),dx:n}}function Xn(t,e){return t.dx<e.dx-1e-6?true:t.dx>e.dx+1e-6?false:t.distance<e.distance-1e-6}function Zn(t,e,n,r,i,o,s){let a=null;for(let m of t){if(ht(m)||ct(m))continue;let l=e.map(m.time);if(l<r.x||l>r.x+r.width)continue;let u=Math.abs(l-i);if(u>s)continue;let h=dt(m,l,u,n,o,false);(!a||Xn(h,a))&&(a=h);}return a}function Un(t,e,n){let r=-1;for(let i=0;i<t.length&&e.map(t[i].time)<=n+1e-6;i++)r=i;for(;r>=0;r--){if(ht(t[r]))return -1;if(!ct(t[r]))return r}return -1}function qn(t,e,n,r,i,o){let s=Un(t,n,r);if(s<0)return null;let a=t[s],m=t[s+1];if(e.gapThreshold>0&&m&&m.time-a.time>e.gapThreshold)return null;let l=n.invert(r);if(o!==void 0&&l-a.time>o)return null;let u=n.map(a.time),h=u<r-1e-6;return dt(a,h?r:u,h?0:Math.abs(u-r),e.skala,i,h)}function Jn(t){return t.punkte.map(e=>t.kind==="stdDevBand"?{time:e.time,min:e.low,max:e.high,avg:e.value,count:0}:{time:e.time,value:e.value})}function Qn(t,e,n){let r={overlayOf:n,overlayIndex:e.index,overlayKind:e.kind};if(e.kind!=="stdDevBand")return {...t,...r};let{min:i,max:o,avg:s,count:a,...m}=t;return {...m,value:s,low:i,high:o,...r}}function pt(t,e,n,r,i,o,s){if(i<r.x||i>r.x+r.width||o<r.y||o>r.y+r.height)return [];let a=new Set(s.hidden??[]),m=[];return t.forEach((l,u)=>{let h=l.id??l.name;if(a.has(h))return;let c=n(l,u);if(!c)return;let p=s.modes?.[h]??s.mode??(c.stufe?"hold":"nearest"),d=(y,b)=>p==="hold"?qn(y,b,e,i,o,s.maxAgeMs):Zn(y,e,b.skala,r,i,o,s.radius),g=(y,b,S)=>{let{dx:w,...k}=y,_=k.value??k.avg;return {seriesId:h,name:l.name,axisIndex:c.achse,...k,color:b,...S?{line:S}:{},...c.format&&_!==void 0?{label:c.format(_)}:{}}},f=d(l.data,c);if(f&&m.push(g(f,c.farbe,c.linie)),!!s.overlays)for(let y of c.overlays??[]){let b=d(Jn(y),{...c,gapThreshold:0});b&&m.push(Qn(g(b,y.farbe,y.linie),y,h));}}),m}var ee=class t{_config;constructor(e){this._config=e;}compute(){let{width:e,height:n,margin:r}=this._config;return {totalWidth:e,totalHeight:n,chartWidth:e-r.left-r.right,chartHeight:n-r.top-r.bottom,chartX:r.left,chartY:r.top,margin:r}}static default(e=800,n=400){return new t({width:e,height:n,margin:{top:20,right:20,bottom:40,left:60}})}};var er=[[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"]],Ne=.6,tr=(()=>{let t=new Map;for(let[e,,n]of er){let r=n.split(",");for(let i=0;i<r.length;i++)t.set(e+i,Number(r[i])/1e3);}return t})();function ft(t){return tr.get(t)??Ne}var O=(t,e)=>{let n=0;for(let r of t)n+=ft(r.codePointAt(0)??0);return n*e},nr=(t,e)=>[...t].length*e*Ne;function gt(t,e,n){let r=0;for(let i of t)r=Math.max(r,n(i,e));return r}var ir=.2,ae=4,te=1e-6,or=6,sr=.4;function ar(t){return t?.map(e=>{let n=e.data;if(n.length<=4)return e;let r=(l,u)=>"avg"in l?u?l.max:l.min:l.value,i=new Set,o=0,s=0,a=-1,m=-1;n.forEach((l,u)=>{l.time<n[o].time&&(o=u),l.time>n[s].time&&(s=u);let h=r(l,false),c=r(l,true);h!==null&&(a<0||h<r(n[a],false))&&(a=u),c!==null&&(m<0||c>r(n[m],true))&&(m=u);});for(let l of [o,s,a,m])l>=0&&i.add(l);return {...e,data:n.filter((l,u)=>i.has(u))}})}function lr(t,e){if(!t.content)return null;let n=t.fontSize??11,r=e(t.content,n),i=t.anchor==="middle"?-r/2:t.anchor==="end"?-r:0,[o,s]=t.textBaseline==="middle"?[-n/2,n/2]:t.textBaseline==="top"?[0,n]:t.textBaseline==="bottom"?[-n,0]:[-0.8*n,ir*n],a=[[i,o],[i+r,o],[i,s],[i+r,s]],m=(t.rotate??0)*Math.PI/180,l=Math.cos(m),u=Math.sin(m),h=a.map(([p,d])=>t.x+p*l-d*u),c=a.map(([p,d])=>t.y+p*u+d*l);return {x0:Math.min(...h),y0:Math.min(...c),x1:Math.max(...h),y1:Math.max(...c)}}function le(t,e){return {x0:Math.min(...t),y0:Math.min(...e),x1:Math.max(...t),y1:Math.max(...e)}}function yt(t,e,n=[]){for(let r of t)switch(r.type){case "group":{let i=r.cssClass??"";if(r.clipRect||r.plotClipId||i.startsWith("chart-legend")||i.startsWith("annotation-band"))break;yt(r.commands,e,n);break}case "text":{let i=lr(r,e);i&&n.push(i);break}case "line":n.push(le([r.x1,r.x2],[r.y1,r.y2]));break;case "rect":n.push(le([r.x,r.x+r.w],[r.y,r.y+r.h]));break;case "circle":n.push(le([r.cx-r.r,r.cx+r.r],[r.cy-r.r,r.cy+r.r]));break;case "path":r.points.length>0&&n.push(le(r.points.map(i=>i.x),r.points.map(i=>i.y)));break;case "gap":n.push(le([r.x1,r.x2],[r.y1,r.y2]));break}return n}function Ke(t,e={}){return mr(t,e)}function mr(t,e,n){let r=e.padding||4,i=Math.max(e.minimum||8,ae),o=t.textMetrics??O,s=ar(t.series),a=h=>{let c=new V({...t,series:s,margin:h}),p=c.renderCommands();return {kaesten:yt(p,o),plot:c.plotRect,breite:c.layout.totalWidth,hoehe:c.layout.totalHeight}},m=typeof t.margin=="object"?t.margin:void 0,l={top:Math.max(i,m?.top??20),right:Math.max(i,m?.right??20),bottom:Math.max(i,m?.bottom??40),left:Math.max(i,m?.left??60)},u;for(let h=0;h<or;h++){let c=a(l),p=a({...l,left:l.left+ae,right:l.right-ae}),d=a({...l,top:l.top+ae,bottom:l.bottom-ae}),g=p.kaesten.length===c.kaesten.length&&d.kaesten.length===c.kaesten.length,f=v=>g&&Math.abs(p.kaesten[v].x0-c.kaesten[v].x0)<te,y=v=>g&&Math.abs(d.kaesten[v].y0-c.kaesten[v].y0)<te,{plot:b}=c,S=b.x+b.width,w=b.y+b.height,k={left:0,right:0,top:0,bottom:0},_={left:0,right:0,top:0,bottom:0};c.kaesten.forEach((v,C)=>{f(C)?(v.x0<b.x-te&&(_.left=Math.max(_.left,v.x1)),v.x1>S+te&&(_.right=Math.max(_.right,c.breite-v.x0))):(k.left=Math.max(k.left,b.x-v.x0),k.right=Math.max(k.right,v.x1-S)),y(C)?(v.y0<b.y-te&&(_.top=Math.max(_.top,v.y1)),v.y1>w+te&&(_.bottom=Math.max(_.bottom,c.hoehe-v.y0))):(k.top=Math.max(k.top,b.y-v.y0),k.bottom=Math.max(k.bottom,v.y1-w));});let P=v=>_[v]>0?_[v]+r+k[v]:k[v]>0?k[v]+r:0,L={top:0,right:0,bottom:0,left:0};for(let v of ["top","right","bottom","left"]){let C=v==="top"||v==="bottom"?c.hoehe:c.breite,$=Math.max(i,Math.floor(C*sr));L[v]=Math.min(Math.max(i,Math.ceil(P(v)-1e-9)),$);}if(L.top===l.top&&L.right===l.right&&L.bottom===l.bottom&&L.left===l.left)return L;if(u&&L.top===u.top&&L.right===u.right&&L.bottom===u.bottom&&L.left===u.left)return {top:Math.max(L.top,l.top),right:Math.max(L.right,l.right),bottom:Math.max(L.bottom,l.bottom),left:Math.max(L.left,l.left)};u=l,l=L;}return l}function Ye(t,e){if(e)for(let n of t)n.type==="text"?n.fontFamily||(n.fontFamily=e):n.type==="group"&&Array.isArray(n.commands)&&Ye(n.commands,e);}function Xe(t,e){if(e)for(let n of t)"id"in n&&n.id&&(n.id=`${e}-${n.id}`),n.type==="group"&&Array.isArray(n.commands)&&Xe(n.commands,e);}function Ze(t,e){let n={...e,...t.style},r=n.fill,i,o;return typeof r=="string"?i=r:r&&(i=r.color,o=r.hatch),{startTime:t.startTime,endTime:t.endTime,label:t.label,fill:i,hatch:o,fillOpacity:n.opacity,labelBaseline:n.label?.baseline,rotate:n.label?.rotate,style:n.display==="bridge_line"?void 0:n.display}}function bt(t){if(!t)return {gaps:[],autoDetect:false,minGapMs:6e4};if(Array.isArray(t))return {gaps:t,autoDetect:false,minGapMs:6e4};let e=t.style;return {gaps:(t.regions??[]).map(r=>Ze(r,e)),autoDetect:t.autoDetect??false,minGapMs:t.minGapMs??6e4,band:e?.band,atEnd:t.atEnd}}function N(t){return t&&t.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}var xt=new Map;function ur(t,e){return `${t}|${JSON.stringify(e??{})}`}function St(t,e){let n=ur(t,e),r=xt.get(n);return r||(r=new Intl.DateTimeFormat(t,e),xt.set(n,r)),r}function wt(){return typeof navigator<"u"?navigator.language:void 0}var U=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let n=Number(e),[r,i]=this.#e,[o,s]=this.#t;return i===r?o:o+(n-r)/(i-r)*(s-o)}invert(e){let[n,r]=this.#e,[i,o]=this.#t;return o===i?n:n+(e-i)/(o-i)*(r-n)}domain(){return [...this.#e]}range(){return [...this.#t]}},H=[{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}],ne=class{#e;#t;#n;constructor(e){this.#e=new U({domain:e.domain,range:e.range}),this.#t=e.locale||(wt()??"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,n=3,r=12){let[i,o]=this.#e.domain(),s=o-i;if(s<=0)return {interval:H[0].ms};let a=s/e,m=H[0].ms;for(let h of H)if(h.ms>=a){m=h.ms;break}let l=m,u=Math.round(s/l);for(;u>r&&l<H[H.length-1].ms;){let h=H.findIndex(c=>c.ms===l);l=H[Math.min(h+1,H.length-1)].ms,u=Math.round(s/l);}for(;u<n&&l>H[0].ms;){let h=H.findIndex(c=>c.ms===l);l=H[Math.max(h-1,0)].ms,u=Math.round(s/l);}return {interval:l}}ticks(e){let n=e?.minTicks??5,r=e?.maxTicks??12,{interval:i}=this.tickInterval((n+r)/2,n,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,n){let r=this.#n?{...n,timeZone:this.#n}:n;return St(this.#t,r).format(new Date(e))}};var Ue={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 re={...Ue};function hr(t){re={...re,...t};}var fe=null;function me(){return fe??re}function ue(t,e){if(!t)return e();let n=fe;fe={...re,...t};try{return e()}finally{fe=n;}}function cr(){return re}function dr(){re={...Ue};}function pr(t){let e=t.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 fr(t){let e=t.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function ge(t,e="classic-diagonal",n="rgba(200, 220, 255, 0.3)",r,i=2){let o=pr(n),s=fr(n)?"":' fill-opacity="0.3"';if(e==="none")return `
2
2
  <pattern id="${t}" width="10" height="10" patternUnits="userSpaceOnUse">
3
3
  <rect width="10" height="10" fill="${n}" />
4
4
  </pattern>
@@ -21,29 +21,29 @@ function Z(t){return t===true?{major:{}}:t===false?{major:false}:t}function Ve(t
21
21
  ${h}
22
22
  ${u}
23
23
  </pattern>
24
- `.trim()}function qe(t,e=2,n=false){if(t==="dashed"||!t&&n)return {strokeDasharray:"4,4"};if(t==="dotted")return {strokeDasharray:"2,4"};if(!t||t==="solid")return null;let r=vt(t,e);return r.strokeDasharray==="none"?null:r}function vt(t,e=2){let n=e;switch(t){case "dotted":return {strokeDasharray:`0, ${n*2}`,strokeLinecap:"round"};case "sparse-dots":return {strokeDasharray:`0, ${n*4}`,strokeLinecap:"round"};case "dashed":return {strokeDasharray:`${n*3}, ${n*2}`,strokeLinecap:"butt"};case "long-dash":return {strokeDasharray:`${n*6}, ${n*3}`,strokeLinecap:"butt"};case "dense-dash":return {strokeDasharray:`${n*1.5}, ${n*1.5}`,strokeLinecap:"butt"};case "dash-dot":return {strokeDasharray:`${n*4}, ${n*2}, 0, ${n*2}`,strokeLinecap:"round"};case "dash-dot-dot":return {strokeDasharray:`${n*5}, ${n*2}, 0, ${n*2}, 0, ${n*2}`,strokeLinecap:"round"};case "loose-dash":return {strokeDasharray:`${n*3}, ${n*4}`,strokeLinecap:"butt"};default:return {strokeDasharray:"none",strokeLinecap:"butt"}}}var x=new Proxy({},{get:(t,e)=>me()[e],has:(t,e)=>e in me(),ownKeys:()=>Reflect.ownKeys(me()),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(me(),e)});function ye(t,e){if(e<=0||t.length<2)return [];let n=[];for(let r=0;r<t.length-1;r++){let i=t[r],o=t[r+1];for(let s=1;s<=e;s++)n.push(i+(o-i)*s/(e+1));}return n}var he={axisColor:x.axisColor,tickColor:x.tickColor,textColor:x.textColor,textSize:x.textSize},ie=class{#e;#t;constructor(e){this.#e=new ne({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??he).axisColor}get tickColor(){return (this.#t.colors??he).tickColor}get textColor(){return (this.#t.colors??he).textColor}get textSize(){return (this.#t.colors??he).textSize}generateTicks(){let e=this.#t.minTicks??5,n=this.#t.maxTicks??12,i=this.#e.ticks({minTicks:e,maxTicks:n}).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 n=this.#t.minTicks??5,r=this.#t.maxTicks??12,{interval:i}=this.#e.tickInterval((n+r)/2,n,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 n=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)>=n&&r.push(e[i]);}return r}render(){let e=this.generateTicks(),n=this.#t.colors??he,r=this.#t.y??0,i=[],[o,s]=this.#e.range();i.push({type:"line",x1:o,y1:r,x2:s,y2:r,stroke:n.axisColor,strokeWidth:n.axisWidth});for(let a of this.generateMinorTicks())i.push({type:"line",x1:a,y1:r,x2:a,y2:r+3,stroke:n.tickColor,strokeWidth:n.axisWidth});for(let a of e)i.push({type:"line",x1:a.x,y1:r,x2:a.x,y2:r+6,stroke:n.tickColor,strokeWidth:n.axisWidth}),i.push({type:"text",content:a.label,x:this.#n(a.x,a.label,n.textSize),y:r+n.textSize+6,anchor:"middle",fontSize:n.textSize,fill:n.textColor});return i}generateMinorTicks(){return ye(this.generateTicks().map(e=>e.x),this.#t.minorTicks??0)}#n(e,n,r){let i=this.#t.gesamtbreite,o=this.#t.metrics;if(i===void 0||o===void 0)return e;let s=o(n,r)/2;return Math.max(s+2,Math.min(i-s-2,e))}};function W(t){return "showAs"in t&&!!t.showAs}function Tt(t){if(W(t)){let e=[];for(let n of t.data)n.min!==null&&e.push(n.min),n.max!==null&&e.push(n.max);return e}return t.data.map(e=>e.value).filter(e=>e!==null)}function be(t,e){return {axisColor:t?.color??x.axisColor,tickColor:t?.color??x.tickColor,textColor:e?.color??x.textColor,textSize:e?.fontSize??x.textSize,axisWidth:t?.width??1}}function kt(t,e,n,r){if(r===void 0)return [t,e];let i=typeof r=="number"?r:r.top??0,o=typeof r=="number"?r:r.bottom??0;if(i<=0&&o<=0)return [t,e];let s=n-i-o,a=e-t;if(s<=0||a<=0)return [t,e];let m=a/s;return [t-o*m,e+i*m]}function xe(t,e){return t!==void 0?t:e!==void 0&&e!==false?1:0}var oe={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function Je(t,e){let n=r=>e===void 0||e>=r;return Math.abs(t)>=1e6&&n(1e5)?`${(t/1e6).toFixed(1)}M`:Math.abs(t)>=1e3&&n(100)?`${(t/1e3).toFixed(1)}k`:Number.isInteger(t)?String(t):t.toFixed(1)}function gr(t){let e=new Array(t.length).fill(false),n=0;for(;n<t.length;){let r=n;for(;r+1<t.length&&t[r+1].label===t[n].label;)r++;for(let i=n+1;i<r;i++)e[i]=true;n=r+1;}return e}var Se=class{#e;#t;constructor(e){this.#e=new U({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??oe).axisColor}get tickColor(){return (this.#t.colors??oe).tickColor}get textColor(){return (this.#t.colors??oe).textColor}get textSize(){return (this.#t.colors??oe).textSize}generateTicks(){let e=this.#t.tickValues;if(e&&e.length>0){let g=this.#t.format??Je;return e.map(f=>({value:f,position:this.#e.map(f),label:g(f)}))}let n=this.#t.format??Je,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:n(i)}];let l=m/r,u=Math.pow(10,Math.floor(Math.log10(l))),h=l/u,c;if(h<=1.5?c=u:h<=3?c=2*u:h<=7?c=5*u:c=10*u,c<=0||!Number.isFinite(c))return [{value:i,position:this.#e.map(i),label:n(i)}];this.#t.format||(n=g=>Je(g,c));let p=[],d=Math.ceil(s/c)*c;for(let g=d;g<=a;g+=c)p.push({value:g,position:this.#e.map(g),label:n(g)});return p}generateMinorTicks(){return ye(this.generateTicks().map(e=>e.position),this.#t.minorTicks??0)}render(){let e=this.generateTicks(),n=this.#t.colors??oe,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=h=>s.some(c=>Math.abs(c-h)<=a),l=[];if(i==="vertical"){let[h,c]=this.#e.range();l.push({type:"line",x1:r,y1:h,x2:r,y2:c,stroke:n.axisColor,strokeWidth:n.axisWidth});let p=gr(e);e.forEach((d,g)=>{let f=m(d.position),y=p[g]?{opacity:0}:{};o==="left"?(l.push({type:"line",x1:r-4,y1:d.position,x2:r,y2:d.position,stroke:n.tickColor,strokeWidth:n.axisWidth}),f||l.push({type:"text",content:d.label,x:this.#n(r-8,d.label,"end"),y:d.position+4,anchor:"end",fontSize:n.textSize,fill:n.textColor,...y})):(l.push({type:"line",x1:r,y1:d.position,x2:r+4,y2:d.position,stroke:n.tickColor,strokeWidth:n.axisWidth}),f||l.push({type:"text",content:d.label,x:this.#n(r+8,d.label,"start"),y:d.position+4,anchor:"start",fontSize:n.textSize,fill:n.textColor,...y}));});}else {let[h,c]=this.#e.range();l.push({type:"line",x1:h,y1:r,x2:c,y2:r,stroke:n.axisColor,strokeWidth:n.axisWidth});for(let p of e)l.push({type:"line",x1:p.position,y1:r,x2:p.position,y2:r+6,stroke:n.tickColor,strokeWidth:n.axisWidth}),l.push({type:"text",content:p.label,x:p.position,y:r+18,anchor:"middle",fontSize:n.textSize,fill:n.textColor});}let u=(this.#t.orientation??"vertical")==="vertical";for(let h of this.generateMinorTicks())l.push(u?{type:"line",x1:o==="right"?r:r-2,y1:h,x2:o==="right"?r+2:r,y2:h,stroke:n.tickColor,strokeWidth:n.axisWidth}:{type:"line",x1:h,y1:r,x2:h,y2:r+3,stroke:n.tickColor,strokeWidth:n.axisWidth});return l}#n(e,n,r){let i=this.#t.gesamtbreite,o=this.#t.metrics;if(i===void 0||o===void 0)return e;let s=o(n,(this.#t.colors??oe).textSize);return r==="end"?Math.max(s+2,Math.min(i-2,e)):Math.min(i-s-2,Math.max(2,e))}};function _t(t){let e=new Set,n={};for(let r of t){let i=r.enumMap;if(i)for(let[o,s]of Object.entries(i)){let a=Number(o);e.add(a),a in n||(n[a]=s);}}return {werte:e.size>0?[...e].sort((r,i)=>r-i):void 0,name:r=>n[r]??String(r)}}var yr=new Set("de fr es it nl pt pl cs sk sl hr sr bs hu ro bg ru uk be da nb nn no sv fi et lv lt el tr id vi ca eu gl is kk az ka hy mk sq".split(" "));function br(t){let e=(t??"").toLowerCase().split(/[-_]/)[0];return yr.has(e)?",":"."}function At(t,e){let n=Math.max(0,Math.min(6,Math.trunc(t.decimals??1))),r=br(e),i=t.unit?` ${t.unit}`:"";return o=>{let s=o.toFixed(n);return /^-0(\.0+)?$/.test(s)&&(s=s.slice(1)),r!=="."&&(s=s.replace(".",r)),s+i}}function Mt(t){let{axes:e,indices:n,seriesByIndex:r,layout:i,thresholds:o,metrics:s,locale:a}=t,{chartX:m,chartY:l,chartWidth:u,chartHeight:h}=i,c=[],p=new Map,d,g=[],f=[],y=(e?.y?.length??0)>0,b=0,S=0;for(let w of n){let T=r.get(w),_=1/0,P=-1/0,L=false;for(let R of T)for(let pe of Tt(R))pe<_&&(_=pe),pe>P&&(P=pe),L=true;if(!L)continue;if(we(e,w)?.includeThresholds)for(let R of o)(R.axisIndex??0)!==w||R.line==="none"||(_=Math.min(_,R.value),P=Math.max(P,R.value));_===P&&(_-=1,P+=1);let v=we(e,w),C=v?.domain,$=C&&C!=="auto"?C:kt(_,P,h,v?.padding),{werte:B,name:F}=_t(T);if(B&&!(C&&C!=="auto")){let R=B.length>1?(B[B.length-1]-B[0])/(B.length-1):1;$[0]=B[0]-R/2,$[1]=B[B.length-1]+R/2;}let j=new U({domain:$,range:[l+h,l]});p.set(w,j);let E=v?.position??(w===0?"left":"right"),Y=E==="right"?"outside-right":"outside-left",A=o.filter(R=>(R.axisIndex??0)===w&&typeof R.label=="object"&&R.label!==null&&R.label.position===Y&&R.value>=Math.min($[0],$[1])&&R.value<=Math.max($[0],$[1])).map(R=>j.map(R.value)),M;if(E==="right"){let R=v?.offset??S*50;M=m+u+R,S++;}else {let R=v?.offset??b*50;M=m-R,b++;}let D=new Se({domain:$,range:[l+h,l],x:M,position:E,format:v?.format??(B?F:v?.tickFormat?At(v.tickFormat,a):void 0),tickValues:B,ticks:v?.ticks?.major,minorTicks:xe(v?.ticks?.minor,Z(v?.grid)?.minor),colors:be(v?.axis,v?.labels),suppressLabelsNear:A.length?A:void 0,gesamtbreite:i.totalWidth,metrics:s}),G=8+gt(D.generateTicks().map(R=>R.label),11,s),Q=E==="right"?M+G:M-G;f.push({position:E,von:Math.min(M,Q),bis:Math.max(M,Q),achse:w}),y&&v?.label&&g.push({text:v.label,achseX:M,kante:Q,position:E,style:v.labels,fest:v.labelOffset}),w===0&&(d=D),c.push({type:"group",cssClass:`value-axis ${E}`,sharedStyles:true,commands:D.render()});}return {commands:c,titel:g,baender:f,neueForm:y,primary:d,scales:p}}function we(t,e){let n=e===0?t?.left:e===1?t?.right:void 0,r=t?.y&&t.y.length>e?t.y[e]:void 0;return r&&n?{...n,...r}:r??n}var Ct=6;function xr(t){let e=typeof t.label=="object"&&t.label!==null?t.label.position:void 0;return e==="outside-right"?"right":e==="outside-left"?"left":null}function Sr(t,e,n,r,i){let o=r.filter(a=>a.position===e&&a.achse!==void 0&&a.achse!==n),s=false;if(e==="right"){for(let a of [...o].sort((m,l)=>m.von-l.von))t.x<a.bis&&t.x+i>a.von&&(t.x=a.bis+Ct,s=true);return {band:{position:e,von:t.x,bis:t.x+i,achse:n},verschoben:s}}for(let a of [...o].sort((m,l)=>l.bis-m.bis))t.x-i<a.bis&&t.x>a.von&&(t.x=a.von-Ct,s=true);return {band:{position:e,von:t.x-i,bis:t.x,achse:n},verschoben:s}}function wr(t){return t==="dotted"?{dash:"dotted"}:t==="dashed"?{dash:"dashed"}:{}}function vr(t){let{thresholds:e,valueScale:n,xRange:r}=t,[i,o]=r,[s,a]=n.range(),m=Math.min(s,a),l=Math.max(s,a),u=[],h=[];for(let c of e){let p=c.color??x.thresholdColor,d=n.map(c.value);c.fill==="above"?u.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"&&u.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 g=c.line??x.thresholdLine;if(g!=="none"){let S=wr(g),w={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&&(w.shadowColor=c.shadowColor,w.shadowBlur=c.shadowBlur??4,w.shadowOffsetX=c.shadowOffsetX??0,w.shadowOffsetY=c.shadowOffsetY??2),u.push(w);}let[f,y]=n.domain();if(c.value>=Math.min(f,y)&&c.value<=Math.max(f,y)&&c.label!==void 0&&c.label!==null&&c.label!==false){let S=typeof c.label=="object"?c.label:void 0,w=typeof c.label=="string"?c.label:S?.text??c.name,T=S?.position??"right",_=kr(w,T,i,o,d,p,S);h.push({..._,y:Tr(_.y,Math.min(s,a),Math.max(s,a),x.thresholdFontSize),id:c.id?`${c.id}-label`:void 0});}}return {inside:u,labels:h}}function Tr(t,e,n,r){return Math.max(e+r,Math.min(n-r/2,t))}function kr(t,e,n,r,i,o,s){let a=(n+r)/2,m={type:"text",content:t,fontSize:x.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:n+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:n-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 Lt(t){let{thresholds:e,valueScales:n,primaryScale:r,xRange:i,layout:o}=t,s=t.metrics??O,{chartX:a,chartY:m,chartWidth:l,chartHeight:u}=o,h=[];if(e.length===0)return h;let c=[],p=[];for(let d of e){let g=d.id??N(d.name),f=n.get(d.axisIndex??0),y=f??r,b=f?d.axisIndex??0:0,S=vr({thresholds:[d],valueScale:y,xRange:i}),w=xr(d);if(w&&t.baender)for(let T of S.labels){if(T.type!=="text")continue;let{band:_}=Sr(T,w,b,t.baender,s(T.content,x.thresholdFontSize));t.belegt?.push(_);}S.inside.length&&c.push({type:"group",cssClass:`threshold threshold--${g}`,id:`threshold-${g}`,commands:S.inside}),S.labels.length&&p.push({type:"group",cssClass:`threshold-label threshold-label--${g}`,commands:S.labels});}return c.length&&h.push({type:"group",cssClass:"thresholds",commands:c,clipRect:{x:a,y:m,w:l,h:u}}),p.length&&h.push({type:"group",cssClass:"threshold-labels",commands:p}),h}function Dt(t,e,n,r){switch(t){case "above":return e-5;case "below":return r!==void 0?r-5:n+14;case "center":case "middle":return (e+n)/2+4;case "bottom":return n-6;default:return e+14}}function ve(t){let{ranges:e,timeScale:n,yRange:r,height:i,metrics:o=O}=t,[s,a]=r,m=[],[l,u]=n.range(),h=Math.min(l,u),c=Math.max(l,u),p=d=>Math.max(h,Math.min(c,d));for(let d of e){let g=p(n.map(d.startTime)),f=p(n.map(d.endTime));if(d.fill!==void 0&&m.push({type:"rect",x:g,y:s,w:f-g,h:a-s,fill:d.fill,hatch:d.hatch,opacity:d.opacity}),d.edges)for(let y of [g,f])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",b=d.rotate,S=true;if(b==="auto"){let w=y!=="above"&&y!=="below",T=o(d.label,d.fontSize??11);b=w&&T>Math.abs(f-g)-4?-90:void 0,S=b===void 0||T<=Math.abs(a-s)-4;}S&&m.push({type:"text",content:d.label,x:(g+f)/2,y:Dt(y,s,a,i),anchor:"middle",fontSize:d.fontSize,fill:d.labelColor,rotate:b});}}return m}function Qe(t){let{gaps:e,timeScale:n,yRange:r,height:i,fill:o=x.gapFill,hatch:s,fillOpacity:a=x.gapFillOpacity??.15,stroke:m=x.gapStroke,strokeWidth:l=x.gapStrokeWidth,dashed:u=true,fontSize:h=x.gapFontSize,fontFill:c=x.gapFontColor,labelBaseline:p="middle",labelRotate:d,metrics:g,band:f}=t,y=()=>{if(!f)return [];let b=f.height??6,[S,w]=r,T=Math.max(S,w);return e.map(_=>{let P=n.map(_.startTime),L=n.map(_.endTime);return {type:"rect",x:Math.min(P,L),y:T-b+(f.offset??0),w:Math.abs(L-P),h:b,fill:f.fill??m,opacity:f.opacity??.75}})};return ve({timeScale:n,yRange:r,height:i,metrics:g,ranges:e.map(b=>{let S=b.style??"dashed_border",w=S==="filled"||S==="dashed_border",T=S==="dashed_border"&&u!==false;return {startTime:b.startTime,endTime:b.endTime,...w&&{fill:b.fill??o,hatch:b.hatch??s,opacity:b.fillOpacity??a},...T&&{edges:{stroke:m,strokeWidth:l}},label:b.label,labelPosition:b.labelBaseline??p,labelColor:c,fontSize:h,rotate:b.rotate??d}})}).concat(y())}function $t(t){let{gap:e,runs:n,timeScale:r,valueScale:i,metrics:o,lineColor:s}=t,a=[],m=e.bridge,l=[];for(let u=1;u<n.length;u++){let h=n[u-1][n[u-1].length-1],c=n[u][0];if(e.display==="bridge_line"){if(h.value===null||c.value===null)continue;a.push({type:"line",x1:r.map(h.time),y1:i.map(h.value),x2:r.map(c.time),y2:i.map(c.value),stroke:m?.color??s??x.stroke,strokeWidth:m?.width??1.5,dash:m?.style??"dotted"});}else l.push({startTime:h.time,endTime:c.time});}if(l.length>0){let u=e.display&&e.display!=="bridge_line"?e.display:"dashed_border",h=e.fill,c=typeof h=="string"?h:h?.color,p=i.range();a.push(...Qe({gaps:l.map(d=>({...d,style:u})),timeScale:r,yRange:[Math.min(p[0],p[1]),Math.max(p[0],p[1])],fill:c,hatch:typeof h=="object"?h.hatch:void 0,fillOpacity:e.opacity??.15,labelBaseline:e.label?.baseline,labelRotate:e.label?.rotate,metrics:o,band:e.band}));}return a}var Pt={display:"dashed_border",fill:{color:"#94a3b8",hatch:"classic-diagonal"},opacity:.5,label:{rotate:"auto"}},Rt=6e4,_r=60*Rt,Ar=24*_r;function Mr(t){let e=Math.floor(t/Rt);if(e<60)return `${e} min`;if(t<Ar){let i=Math.floor(e/60),o=e%60;return o===0?`${i} h`:`${i} h ${o} min`}let n=Math.floor(e/1440),r=Math.floor(e%1440/60);return r===0?`${n} d`:`${n} d ${r} h`}function Cr(t,e,n){let r=t.format(e,{hour:"2-digit",minute:"2-digit"}),i=o=>t.format(o,{year:"numeric",month:"2-digit",day:"2-digit"});return i(e)===i(n)?r:`${t.format(e,{day:"numeric",month:"short"})} ${r}`}function Lr(t,e,n){let r=null;for(let i of t)i.value===null||i.time<e||i.time>n||(r===null||i.time>r)&&(r=i.time);return r}function Bt(t){let{atEnd:e,series:n,timeScale:r}=t,[i,o]=r.domain(),s=e.now??o,a=new Set;for(let l of n){if(!("data"in l)||l.data.length===0||!("value"in l.data[0]))continue;let u="gaps"in l?l.gaps?.atEnd:void 0;if(u===false||"holdToEnd"in l&&l.holdToEnd)continue;let h=u?.afterMs??e.afterMs,c=Lr(l.data,i,s);c!==null&&s-c>h&&a.add(c);}let m={...Pt,...e.style,label:{...Pt.label,...e.style?.label}};return [...a].sort((l,u)=>l-u).map(l=>{let u=s-l,h=e.label,c=typeof h=="function"?h(l,u):h?.replaceAll("{since}",Cr(r,l,s)).replaceAll("{duration}",Mr(u));return {startTime:l,endTime:s,label:c,style:m}})}var jt=1,Et="#6b728044";function Gt(t){return t.items.find(e=>e.fill)?.fill??t.background??Et}var Ft=4;function Dr(t,e="last"){let n=[...t].sort((o,s)=>o.time-s.time||o.index-s.index),r=[],i=o=>r.every(s=>o.right+Ft<=s.left||s.right+Ft<=o.left);n.length>0&&r.push(e==="first"?n[0]:n[n.length-1]);for(let o of n)o!==r[0]&&i(o)&&r.push(o);return new Set(r.map(o=>o.index))}function $r(t){let e=typeof t=="object"&&t!==null?t.mode:t,n=typeof t=="object"&&t!==null&&t.keep==="first"?"first":"last";return {fit:e==="fit",keep:n}}var Te=class{#e;constructor(e,n,r,i){this.#e={...e,xRange:n,y:r,height:i};}render(){let{items:e,timeScale:n,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});let u=this.#n();if(e.forEach((h,c)=>{let p=this.#t(h);if(!p)return;let{startX:d,w:g}=p,f=d+g/2;if(l.push({type:"rect",x:d,y:a,w:g,h:m,hatch:h.hatch??i,fill:h.fill??Et,stroke:h.stroke,strokeWidth:h.strokeWidth??0,title:h.title}),h.label&&(!u||u.has(c))){let y=h.labelFontSize??10;l.push({type:"text",content:h.label,x:f,y:this.#r(h.labelBaseline,y),anchor:"middle",fontSize:y,fill:h.labelFill??"#333"});}}),o){let h=new ie({domain:n.domain(),xRange:s,y:a+m+4});l.push({type:"group",cssClass:"annotation-band-axis",commands:h.render()});}return l}#t(e){let{timeScale:n,xRange:r,minItemWidth:i=0}=this.#e,o=n.map(e.startTime),s=n.map(e.endTime);if(s<r[0]||o>r[1])return null;let a=Math.max(r[0],Math.min(r[1],o)),m=Math.max(r[0],Math.min(r[1],s)),l=Math.max(m-a,jt);return i>jt&&m-a<i&&(a=(a+m)/2-i/2,l=i),a=Math.max(r[0],a),a+l>r[1]&&(a=Math.max(r[0],r[1]-l)),{startX:a,w:l}}#n(){let{fit:e,keep:n}=$r(this.#e.labels);if(!e)return null;let r=this.#e.metrics??O,i=[];return this.#e.items.forEach((o,s)=>{let a=o.label?this.#t(o):null;if(!a||!o.label)return;let m=a.startX+a.w/2,l=r(o.label,o.labelFontSize??10)/2;i.push({index:s,time:o.startTime,left:m-l,right:m+l});}),Dr(i,n)}#r(e,n){let{y:r,height:i}=this.#e;switch(e){case "top":return r+n*.9;case "bottom":return r+i-n*.25;default:return r+i/2+n*.35}}};function It(t){let{highlights:e,timeScale:n,yRange:r,height:i}=t;return ve({metrics:t.metrics,timeScale:n,yRange:r,height:i,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??x.highlightColor,opacity:o.opacity??x.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??x.highlightLabelColor,fontSize:x.annotationFontSize,rotate:o.rotate}))})}var Ot=t=>t==="chartTop"||t==="chartBottom"||typeof t=="object"&&("threshold"in t||"value"in t);function Wt(t,e){let n=new Set(e.map(o=>o.id??o.name)),r=o=>t.some(s=>(s.id??s.name)===o||s.name===o),i=[];return t.forEach((o,s)=>{let a="colorByThresholds"in o?o.colorByThresholds:void 0;for(let u of a??[])n.has(u)||i.push(`series ${s} colorByThresholds names unknown threshold "${u}"`);let m=o.style?.fill;(m&&typeof m=="object"&&"regions"in m?m.regions??[]:[]).forEach((u,h)=>{let c=`series ${s} fill region ${h}`;for(let f of [u.from,u.to,u.outer])f&&typeof f=="object"&&"threshold"in f&&!n.has(f.threshold)&&i.push(`${c} references unknown threshold "${f.threshold}"`),f&&typeof f=="object"&&"series"in f&&!r(f.series)&&i.push(`${c} references unknown series "${f.series}"`);let p=u.from??"chartBottom",d=u.to??"series",g=p==="series"&&Ot(d)||d==="series"&&Ot(p);u.side&&!g&&i.push(`${c} sets side, which only applies between the line and a fixed bound`),u.outer&&!u.side&&i.push(`${c} sets outer without side -- outer has no effect`);});}),i}function zt(t){return [...jr(t.series.map(e=>e.id??e.name)),...Pr(t.series,t.linienGrundlage),...Rr(t.gaps.map(e=>e.style)),...Br(t.series.map(e=>!W(e)&&!!e.style?.gap?.label)),...Fr(t.series.map(e=>"sensorType"in e?e.sensorType:void 0)),...Wt(t.series,t.thresholds)]}function Pr(t,e){let n=[],r=i=>t.find(o=>(o.id??o.name)===i||o.name===i);return t.forEach((i,o)=>{if(W(i))return;let s=i.style?.fill,a=s&&typeof s=="object"&&"regions"in s?s.regions:[],m=new Set;for(let l of a)if(l.where)for(let u of [l.from??"chartBottom",l.to??"series"]){let h=u==="series"?i:typeof u=="object"&&"series"in u?r(u.series):void 0;if(!h||W(h))continue;let{grundLinie:c,stepShape:p}=e(h),d=c?.smoothingType??"catmull-rom";p||!c?.smoothing||d==="monotone"||m.has(h.name)||(m.add(h.name),n.push(`series ${o}: fill where decides on the readings, but "${h.name}" is smoothed with ${d}, which can overshoot them -- the area may miss the line at its edges; smoothingType 'monotone' does not overshoot`));}}),n}function Rr(t){let e=t.flatMap((n,r)=>n==="label"?[String(r)]:[]);return e.length?[`gap ${e.join(", ")} uses style "label" -- removed, drawn like "empty"; use style "empty" with a label`]:[]}function Br(t){let e=t.flatMap((n,r)=>n?[String(r)]:[]);return e.length?[`series ${e.join(", ")} set style.gap.label -- deprecated, removed before 2.0; set the label style on gaps.style.label`]:[]}function jr(t){let e=new Map;return t.forEach((n,r)=>{e.set(n,[...e.get(n)??[],r]);}),[...e].filter(([,n])=>n.length>1).map(([n,r])=>`series ${r.join(", ")} share the id "${n}" -- hidden and pointsAt cannot tell them apart; give each a unique id`)}function Fr(t){let e=t.flatMap((n,r)=>n&&n!=="numeric"?[String(r)]:[]);return e.length?[`series ${e.join(", ")} set sensorType -- deprecated, removed before 2.0; it has no effect on the chart, use enumMap for state series`]:[]}var ke=class{};var I=class{static interpolateDataPoint(t,e,n){return {time:t.time+Math.round(n*(e.time-t.time)),value:(t.value??0)+n*((e.value??0)-(t.value??0)),synthetic:true}}static interpolateAggregatedPoint(t,e,n){let r=(i,o)=>i!==null&&o!==null?i+n*(o-i):null;return {time:t.time+n*(e.time-t.time),min:r(t.min,e.min),max:r(t.max,e.max),avg:r(t.avg,e.avg),count:Math.round(t.count+n*(e.count-t.count))}}static getRuns(t,e,n=0){let r=[...t].sort((a,m)=>a.time-m.time),i=[],o=[],s=null;for(let a of r){let m=e(a),l=n>0&&s&&a.time-s.time>n;(m||l)&&o.length&&(i.push(o),o=[]),m||o.push(a),s=a;}return o.length&&i.push(o),i}static splitByBoundaries(t,e,n,r){if(t.length===0)return [];if(e.length===0)return [{data:t,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let i=[...e].sort((l,u)=>l-u),o=[],s=l=>l<=0?Number.NEGATIVE_INFINITY:i[l-1],a=l=>{let u=0;for(let h=0;h<i.length&&l>=i[h];h++)u=h+1;return u},m=[t[0]];for(let l=1;l<t.length;l++){let u=t[l-1],h=t[l],c=n(u),p=n(h),d;p>c?d=i.filter(f=>f>c&&f<=p):p<c?d=i.filter(f=>f>=p&&f<c).reverse():d=[];let g=c;for(let f of d){let y=(f-c)/(p-c),b=r(u,h,y);m.push(b);let S=a((g+f)/2);o.push({data:m,zoneIndex:S,zoneLow:s(S)}),m=[b],g=f;}(d.length===0||d[d.length-1]!==p)&&m.push(h);}if(m.length>1||t.length===1){let l=n(m[0]),u=n(m[m.length-1]),h=a((l+u)/2);o.push({data:m,zoneIndex:h,zoneLow:s(h)});}return o}static splitByThreshold(t,e,n,r){let i=this.splitByBoundaries(t,[e],n,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 Vt(t,e=6e4){if(t.length<2)return [];let n=[...t].sort((i,o)=>i.time-o.time),r=[];for(let i=1;i<n.length;i++)n[i].time-n[i-1].time>e&&r.push({startTime:n[i-1].time,endTime:n[i].time});return r}function Nt(t,e,n){let r=new Array(t.length),i=0;for(let o=0;o<t.length;o++){let s=t[o].time,a=s-e;for(;i<o&&t[i].time<a;)i++;let m=t.slice(i,o+1).map(l=>l.value);r[o]={time:s,value:n(m),synthetic:true};}return r}var Er=8.314,Ht=273.15,Kt=83144;function Gr(t,e=Kt){let n=e/Er,r=0,i=0;for(let s of t)s!==null&&(r+=Math.exp(-n/(s+Ht)),i++);if(i===0)return null;let o=r/i;return n/-Math.log(o)-Ht}function Yt(t,e,n=Kt){return Nt(t,e,r=>Gr(r,n))}function Ir(t){let e=0,n=0;for(let o of t)o!==null&&(e+=o,n++);if(n===0)return null;let r=e/n,i=0;for(let o of t){if(o===null)continue;let s=o-r;i+=s*s;}return Math.sqrt(i/n)}function Or(t){let e=0,n=0;for(let o of t)o!==null&&(e+=o,n++);if(n<2)return null;let r=e/n,i=0;for(let o of t){if(o===null)continue;let s=o-r;i+=s*s;}return Math.sqrt(i/(n-1))}function Xt(t,e,n=false){return Nt(t,e,n?Or:Ir)}function et(t,e){let n=new Array(t.length),r=0;for(let i=0;i<t.length;i++){let o=t[i].time,s=o-e;for(;r<i&&t[r].time<s;)r++;let a=0,m=0;for(let l=r;l<=i;l++){let u=t[l].value;u!==null&&(a+=u,m++);}n[i]={time:o,value:m===0?null:a/m,synthetic:true};}return n}function Zt(t,e){let n=new Array(t.length),r=null,i=0;for(let o=0;o<t.length;o++){let s=t[o].time,a=t[o].value;if(a===null){n[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,n[o]={time:s,value:r,synthetic:true};}return n}function X(t){let e=[];for(let n of t)e.length>0&&e.push({...n,value:e[e.length-1].value}),e.push(n);return e}function Ut(t,e,n){let r=[],i=_e(n);for(let o=0;o<t.length;o++){let s=t[o];s.data.length>=2?r.push({type:"path",cssClass:"series-line",id:n.id?`${n.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:n.id?`${n.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 qt(t,e,n,r){if(t.length<2)return [];let i=I.splitByBoundaries(t,n.boundaries,n.getValue,n.interpolate),o=[];for(let s=0;s<i.length;s++){let a=i[s];if(a.data.length<2)continue;let m=n.getColor(a.zoneIndex);if(!m)continue;let l=a.data.map(h=>({x:e.timeScale.map(h.time),y:e.valueScale.map(n.yLow(h))})),u=a.data.map(h=>({x:e.timeScale.map(h.time),y:e.valueScale.map(n.yHigh(h))})).reverse();o.push({type:"path",cssClass:"series-fill",id:r?.id?`${r.id}-fill-${s}`:void 0,points:[...l,...u],fill:m,hatch:n.getHatch?.(a.zoneIndex),stroke:"none",...r?.smoothing?{smoothing:true,smoothingType:r.smoothingType,smoothCount:a.data.length,smoothTail:a.data.length}:{}});}return o}var Ae=class t{#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,n){let r=new t;return n(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 Wr="#ffffff",zr="#cccccc",Hr=6,Vr=.85,H=12,Ce=8,ce=20,Nr=11,Me=18,tt=(t,e)=>e(t,Nr);function Jt(t,e,n){let r=a=>H+Ce+tt(a.name,e);if(n===void 0){let a=t.reduce((m,l)=>m+r(l)+Me,0)-Me;return [{items:t,breite:Math.max(0,a)}]}let i=[],o=[],s=0;for(let a of t){let m=r(a),l=o.length===0?m:s+Me+m;o.length>0&&l>n?(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 Qt(t,e="vertical",n=O,r){if(e==="horizontal"){let o=Jt(t,n,r);return {width:o.reduce((s,a)=>Math.max(s,a.breite),0),height:o.length*ce}}let i=0;for(let o of t)i=Math.max(i,tt(o.name,n));return {width:H+Ce+i,height:t.length*ce}}function Kr(t){let{items:e,x:n,y:r,orientation:i="vertical",metrics:o=O,maxBreite:s,box:a,itemClass:m}=t,l=new Ae;if(a&&e.length>0){let p=Qt(e,i,o,s),g=((i==="horizontal"?p.height/ce:e.length)-1)*ce+H,f=a.padding??Hr,y=a.stroke??zr;l.rect({x:n-f,y:r-f,w:p.width+2*f,h:g+2*f,fill:a.fill??Wr,...y==="none"?{}:{stroke:y,strokeWidth:a.strokeWidth??1},opacity:a.opacity??Vr});}let u=i==="horizontal"?Jt(e,o,s):e.map(p=>({items:[p],breite:0})),h=new Map;u.forEach((p,d)=>{let g=n;for(let f of p.items)h.set(f,{x:g,y:r+d*ce}),g+=H+Ce+tt(f.name,o)+Me;});let c=e.some(p=>p.line!==void 0&&p.line!=="solid"&&p.line!=="none");return e.forEach(p=>{let d=h.get(p)??{x:n,y:r},g=d.x,f=d.y,y=["legend-item"];p.id&&y.push(`legend-item--${p.id}`),m&&y.push(m),l.group({cssClass:y.join(" "),...p.id?{id:`legend-${p.id}`}:{}},b=>{c?b.line({x1:g,y1:f+H/2,x2:g+H,y2:f+H/2,stroke:p.color,strokeWidth:Yr(p.width),...p.line&&p.line!=="solid"?{dash:p.line}:{}}):b.rect({x:g,y:f,w:H,h:H,fill:p.color,stroke:x.legendStroke,strokeWidth:1}),b.text({content:p.name,x:g+H+Ce,y:f+H-2,fontSize:x.legendFont,fill:x.legendText});});}),l.toGroup({cssClass:"chart-legend"})}function en(t){let{legend:e,items:n,gesamtbreite:r,metrics:i}=t,o=(e?.show??false)&&n.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:n,show:o,position:s,orientation:a,maxBreite:m,size:o?Qt(n,a,i,m):{width:0,height:0},boxRand:o&&e?.box?e.box.padding??6:0,box:e?.box,itemClass:e?.itemClass}}function tn(t,e){let n=t.position==="outside-right"||t.position==="outside-left"||t.position==="above"||t.position==="below";if(!t.show||!n)return null;let r={...e},i=2*t.boxRand;return t.position==="outside-right"?r.right+=t.size.width+i+16:t.position==="outside-left"?r.left+=t.size.width+i+16:t.position==="above"?r.top+=t.size.height+i+10:r.bottom+=t.size.height+i+10,r}function nn(t){let{legende:e,layout:n,randBelegt:r,metrics:i}=t;if(!e.show||e.position==="separate")return [];let{chartX:o,chartY:s,chartWidth:a}=n,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 u=r.filter(h=>h.position==="right").reduce((h,c)=>Math.max(h,c.bis),o+a);m=Math.min(Math.max(o+a+16,u+12),n.totalWidth-e.size.width-2),l=s;}else e.position==="above"||e.position==="below"?(m=Math.max(8,Math.min(n.totalWidth-e.size.width-8,o+(a-e.size.width)/2)),l=e.position==="above"?Math.max(4,s-e.size.height-10):n.totalHeight-e.size.height-4):(m=8,l=s);return [Kr({items:e.items,x:m,y:l,orientation:e.orientation,metrics:i,maxBreite:e.maxBreite,box:e.box,itemClass:e.itemClass})]}function Yr(t){return Math.min(Math.max(t??2,1.5),3)}function rn(t){let{xTicks:e,yTicks:n,xRange:r,yRange:i,stroke:o=x.gridStroke,strokeWidth:s=x.gridStrokeWidth,dashed:a=false,opacity:m=x.gridOpacity}=t,l=[];if(n)for(let u of n)l.push({type:"line",x1:r[0],y1:u,x2:r[1],y2:u,stroke:o,strokeWidth:s,dashed:a,opacity:m});if(e)for(let u of e)l.push({type:"line",x1:u,y1:i[0],x2:u,y2:i[1],stroke:o,strokeWidth:s,dashed:a,opacity:m});return l}function on(t){let{axes:e,timeAxis:n,primaryValueAxis:r,xRange:i,yRange:o}=t,s=Z(e?.x?.grid),a=Z(e?.left?.grid),m=s?.layer??a?.layer??"front",l=s?.major,u=a?.major,h=T=>T!==void 0&&T!==false;if(!h(l)&&!h(u))return {group:null,layer:m};let c=l!==false,p=u!==false&&!!r,d=c?n.generateTicks().map(T=>T.x):void 0,g=p?r.generateTicks().map(T=>T.position):void 0;if(!d&&!g)return {group:null,layer:m};let f=(l&&typeof l=="object"?l:void 0)??(u&&typeof u=="object"?u:void 0),y=s?.minor,b=a?.minor,S=(y&&typeof y=="object"?y:void 0)??(b&&typeof b=="object"?b:void 0);return {group:{type:"group",cssClass:"chart-grid",sharedStyles:true,commands:[...y!==void 0||b!==void 0?rn({xTicks:y!==false&&c?n.generateMinorTicks():void 0,yTicks:b!==false&&p?r.generateMinorTicks():void 0,xRange:i,yRange:o,stroke:S?.color,opacity:S?.opacity??(x.gridOpacity??1)*.5,dashed:S?.style==="dashed"}):[],...rn({xTicks:d,yTicks:g,xRange:i,yRange:o,stroke:f?.color,opacity:f?.opacity,dashed:f?.style==="dashed"})]},layer:m}}function sn(t){let e=[],n=r=>{r.type==="group"?r.commands.forEach(n):r.type==="line"&&r.y1===r.y2&&r.x1!==r.x2&&e.push(r.y1);};return t.forEach(n),e}function an(t,e){if(e.length===0||t.type!=="group")return t;let n=r=>r.type==="line"&&r.y1===r.y2&&r.x1!==r.x2&&e.some(i=>Math.abs(i-r.y1)<.5);return {...t,commands:t.commands.filter(r=>!n(r))}}function nt(t,e,n){let r=(o,[s,a])=>o>=Math.min(s,a)&&o<=Math.max(s,a);if(!r(t.time,e.domain()))return false;if(t.value===void 0||!n)return true;let i=n.get(t.axis??0)??n.values().next().value;return !i||r(t.value,i.domain())}function ln(t){let{annotations:e,timeScale:n,valueScales:r,plot:i}=t,o=[],s=m=>!i||nt(m,n,r),a=m=>{let l=r.get(m.axis??0)??r.values().next().value;return {x:n.map(m.time),y:l?l.map(m.value):0}};for(let m of e){let l=[],u=p=>l.push(p);if((m.type==="point"||m.type==="label")&&!s(m.at))continue;let h=i!==void 0&&(m.type==="line"||m.type==="arrow"||m.type==="rect")&&!(s(m.from)&&s(m.to)),c=h?{clipRect:i}:{};switch(m.type){case "line":{let p=a(m.from),d=a(m.to);u({type:"line",x1:p.x,y1:p.y,x2:d.x,y2:d.y,stroke:m.color??x.annotationColor,strokeWidth:m.width??x.annotationWidth,dash:m.dash});break}case "arrow":{let p=a(m.from),d=a(m.to),g=m.color??x.annotationColor,f=m.headSize??x.annotationHead;u({type:"line",x1:p.x,y1:p.y,x2:d.x,y2:d.y,stroke:g,strokeWidth:m.width??x.annotationWidth});let y=Math.hypot(d.x-p.x,d.y-p.y)||1,b=(d.x-p.x)/y,S=(d.y-p.y)/y,w=d.x-b*f,T=d.y-S*f;u({type:"path",points:[{x:d.x,y:d.y},{x:w-S*f*.5,y:T+b*f*.5},{x:w+S*f*.5,y:T-b*f*.5}],fill:g,stroke:"none"});break}case "rect":{let p=a(m.from),d=a(m.to);u({type:"rect",x:Math.min(p.x,d.x),y:Math.min(p.y,d.y),w:Math.abs(d.x-p.x),h:Math.abs(d.y-p.y),fill:m.fill??"none",hatch:m.hatch,stroke:m.stroke,opacity:m.opacity});break}case "point":{let p=a(m.at),d=m.color??"#334155",g=m.radius??x.annotationRadius,f=m.shape??"circle";f==="circle"?u({type:"circle",cx:p.x,cy:p.y,r:g,fill:d}):f==="square"?u({type:"rect",x:p.x-g,y:p.y-g,w:g*2,h:g*2,fill:d}):(u({type:"line",x1:p.x-g,y1:p.y-g,x2:p.x+g,y2:p.y+g,stroke:d,strokeWidth:1.5}),u({type:"line",x1:p.x-g,y1:p.y+g,x2:p.x+g,y2:p.y-g,stroke:d,strokeWidth:1.5}));break}case "label":{let p=a(m.at);u({type:"text",content:m.text,x:p.x+(m.dx??0),y:p.y+(m.dy??0),anchor:m.anchor??Xr(p.x+(m.dx??0),m.text,t),fontSize:x.annotationFontSize,fill:m.color??x.annotationColor,rotate:m.rotate});break}}if(m.id&&l.length>0){let p=N(m.id);o.push({type:"group",cssClass:`annotation annotation--${p}`,...c,commands:l});}else h&&l.length>0?o.push({type:"group",cssClass:"annotation",...c,commands:l}):o.push(...l);}return o}function Xr(t,e,n){let{metrics:r,timeScale:i}=n;if(!r)return "middle";let[o,s]=i.range(),a=r(e,x.annotationFontSize)/2;return t-a<o?"start":t+a>s?"end":"middle"}var se=class t{#e;#t;static uidcnt=0;#n;constructor(e,n=[]){this.#e=e.id??"series-"+ ++t.uidcnt,this.#t=e.timeScale,this.#n=n;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var Le=class extends se{#e;constructor(e){super(e,e.data),this.#e=e;}opacity(e){if(!(this.#e.countOpacity??false))return .6;let n=0;for(let r of this.data)r.count>n&&(n=r.count);return n===0?.2:.2+.8*e/n}render(){let e=this.#e,n=e.fill??x.bandFill,r=e.hatch,i=e.avgLine??false,o=e.avgLineColor??x.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),u=e.valueScale.map(m.max),h=e.valueScale.map(m.min),c=s,p=this.data.indexOf(m);if(a.push({type:"rect",x:l-c/2,y:u,w:c,h:h-u,fill:n,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}};function mn(t,e,n,r,i,o,s){return qt(t,e,{boundaries:[],yLow:a=>a.avg,yHigh:n,getValue:a=>a.avg,interpolate:I.interpolateAggregatedPoint,getColor:()=>r,getHatch:()=>i},{id:o,...s})}var De=class extends se{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,n=e.minColor??x.minColor,r=e.maxColor??x.maxColor,i=e.avgColor??x.avgColor,o=e.avgDashed??true,s=e.smoothing??false,a=e.smoothingType,m=e.strokeWidth??x.strokeWidth,l=I.getRuns(this.data,d=>d.min===null||d.max===null||d.avg===null);if(l.length===0)return [];let u={timeScale:this.timeScale,valueScale:e.valueScale},h=[];l.forEach((d,g)=>{if(d.length<2)return;let f=y=>this.id?`${this.id}-${y}-${g}`:void 0;if(e.fillToMax){let y=mn(d,u,b=>b.max,e.fillToMax,e.fillToMaxHatch,f("fillToMax"),{smoothing:s,smoothingType:a});h.push(...y);}if(e.fillToMin){let y=mn(d,u,b=>b.min,e.fillToMin,e.fillToMinHatch,f("fillToMin"),{smoothing:s,smoothingType:a});h.push(...y);}});let c=l.filter(d=>d.length>=2),p=(d,g,f,y=false)=>Ut(c.map(b=>({data:b.map(S=>({time:S.time,value:d(S)}))})),u,{stroke:g,strokeWidth:m,smoothing:s,smoothingType:a,dashed:y,id:this.id?`${this.id}-${f}`:void 0});return h.push(...p(d=>d.max,r,"max"),...p(d=>d.min,n,"min"),...p(d=>d.avg,i,"avg",o)),h}};function _e(t){return {id:t.id,line:{stroke:t.stroke??x.stroke,strokeWidth:t.strokeWidth??x.strokeWidth,smoothing:t.smoothing??false,smoothingType:t.smoothingType,dashed:t.dashed??false},fill:t.fill??x.areaFillAlpha,markers:{type:t.pointStyle??"none",size:t.pointSize??x.pointSize,stroke:t.stroke??x.stroke,fill:"#ffffff"},shadow:{color:t.shadowColor??"transparent",blur:t.shadowBlur??0,offsetX:t.shadowOffsetX??0,offsetY:t.shadowOffsetY??0}}}function un(t,e,n,r){let i=_e(n);if(!i.markers.type||i.markers.type==="none")return [];let o=[];for(let s=0;s<t.length;s++){let a=t[s],m=e.timeScale.map(a.time),l=e.valueScale.map(a.value),u=r(a),h=n.pointStroke??u,c=n.pointFill??u,p=n.pointStrokeWidth??1.5,d=n.id?`${n.id}-marker-${s}`:void 0;$e(o,d,i.markers.type,m,l,i.markers.size,h,c,p);}return o.length===0?[]:[{type:"group",cssClass:"series-markers",sharedStyles:true,commands:o}]}function $e(t,e,n,r,i,o,s,a,m){let l=u=>e===void 0?void 0:`${e}-${u}`;switch(n){case "circle":t.push({type:"circle",cx:r,cy:i,r:o,fill:a,stroke:s,strokeWidth:m,id:e});break;case "square":t.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":t.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":t.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":t.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 u=[];for(let h=0;h<10;h++){let c=h%2===0?o:o*.5,p=Math.PI/2*3+h*Math.PI/5;u.push({x:r+c*Math.cos(p),y:i+c*Math.sin(p)});}t.push({type:"path",points:u,closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break}case "arrow":t.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":t.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":t.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 u=[];for(let h=0;h<6;h++){let c=h*(Math.PI/3);u.push({x:r+o*Math.cos(c),y:i+o*Math.sin(c)});}t.push({type:"path",points:u,closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break}case "hourglass":t.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":t.push({type:"line",x1:r-o,y1:i,x2:r+o,y2:i,stroke:s,strokeWidth:m,id:e});break;default:t.push({type:"circle",cx:r,cy:i,r:o,fill:a,stroke:s,strokeWidth:m,id:e});}}function hn(t){let{markers:e,timeScale:n,valueScale:r,yRange:i=[0,300]}=t,[o,s]=i,a=[];for(let m of e){let l=n.map(m.time),u=m.color??x.markerColor,h=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:u,strokeWidth:1,dashed:true}):c==="to-top"?a.push({type:"line",x1:l,y1:o,x2:l,y2:p,stroke:u,strokeWidth:1,dashed:true}):c==="full"&&a.push({type:"line",x1:l,y1:o,x2:l,y2:s,stroke:u,strokeWidth:1}),h!=="none"&&$e(a,void 0,h,l,p,x.markerSize,u,u,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:x.markerFontSize,fill:u});}}else c!=="none"&&a.push({type:"line",x1:l,y1:o,x2:l,y2:s,stroke:u,strokeWidth:1}),m.label&&a.push({type:"text",content:m.label,x:l,y:o-6,anchor:"middle",fontSize:x.markerFontSize,fill:u});}return a}function cn(t){let e=[],n=t.markers.filter(i=>nt({time:i.time},t.timeScale)).map(i=>({...i}));for(let i of n)if(i.value===void 0&&(i.lineStyle==="to-value"||i.lineStyle==="to-top")){let o=t.series[i.seriesIndex??0];o&&!W(o)&&o.data.length>=2&&(i.value=Zr(i.time,o.data));}if(n.length>0&&t.primaryScale){let i=[];for(let o of n){let s=t.primaryScale,a=t.series[o.seriesIndex??0];a&&(s=t.valueScales.get(t.achseVon(a))??t.primaryScale),i.push(...hn({markers:[o],timeScale:t.timeScale,valueScale:s,yRange:t.yRange}));}e.push({type:"group",cssClass:"markers",commands:i});}let r=t.annotations;return r.length>0&&e.push({type:"group",cssClass:"annotations",commands:ln({annotations:r,timeScale:t.timeScale,valueScales:t.valueScales,metrics:t.metrics,plot:t.plot})}),e}function Zr(t,e){for(let n=1;n<e.length;n++){let r=e[n-1],i=e[n];if(!(r.value===null||i.value===null)&&t>=r.time&&t<=i.time){if(i.time===r.time)return r.value;let o=(t-r.time)/(i.time-r.time);return r.value+o*(i.value-r.value)}}}var Ur=(()=>{let t=new Array(256);for(let e=0;e<256;e++){let n=e;for(let r=0;r<8;r++)n=n&1?3988292384^n>>>1:n>>>1;t[e]=n>>>0;}return t})();function rt(t){let e=new TextEncoder().encode(t),n=4294967295;for(let r of e)n=Ur[(n^r)&255]^n>>>8;return (n^4294967295)>>>0}function K(t,e){return e||"s-"+rt(t??"").toString(16).padStart(8,"0")}function dn(t,e,n){let r=t.style?.line&&!Array.isArray(t.style.line)?t.style.line:void 0,i=typeof t.style?.fill=="string"?t.style.fill:void 0;return t.showAs==="minmaxavg"?new De({data:t.data,timeScale:e,valueScale:n,minColor:t.minColor,maxColor:t.maxColor,avgColor:t.avgColor,avgDashed:t.avgDashed,fillToMax:t.fillToMax,fillToMaxHatch:t.fillToMaxHatch,fillToMin:t.fillToMin,fillToMinHatch:t.fillToMinHatch,smoothing:r?.smoothing,smoothingType:r?.smoothingType,strokeWidth:r?.width,id:K(t.name,t.id)}).render():new Le({data:t.data,timeScale:e,valueScale:n,fill:i??r?.color,avgLine:t.avgLine,countOpacity:t.countOpacity,id:K(t.name,t.id)}).render()}function pn(t,e,n){let r=t??[];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??n,m=Number.NEGATIVE_INFINITY;for(let l of r){let u=e.get(l);!u||o<u.value||u.value<m||(m=u.value,a=u.color??a);}return a}}}function fn(t,e,n){if(!t.holdToEnd)return;let r=t.data.at(-1);if(!r||r.value===null)return;let i=n??e.domain()[1],o=typeof t.holdToEnd=="object"?t.holdToEnd.maxAgeMs:void 0;return o!==void 0&&(i=Math.min(i,r.time+o)),i>r.time?i:void 0}function Pe(t,e){if(e===void 0||t.length===0)return t;let n=t[t.length-1],r=n[n.length-1];return [...t.slice(0,-1),[...n,{time:e,value:r.value}]]}function gn(t){let{series:e,ctx:n,runs:r,haltBis:i,totalPoints:o,style:s,styleLine:a,styleMarkers:m,stepShape:l,thresholds:u}=t,{timeScale:h,valueScale:c}=n,p=[],d=pn(e.colorByThresholds,u,s.stroke),g=d.grenzen,f=new Map,y=[];for(let S of r){let _=function(v){let C=S===r[r.length-1]?Pe([S],i)[0]:S;return I.splitByBoundaries(v==="step"?X(C):C,g,$=>$.value,I.interpolateDataPoint)};if(S.length<1)continue;let w=K(e.name,e.id),T=new Map,P=v=>{let C=T.get(v);return C||(C=_(v),T.set(v,C)),C},L=(v,C,$)=>{if(C.width===0||C.style==="none")return;let B=P(v);for(let F of B){let j=F,E=f.get($)??0;if(f.set($,E+1),j.data.length<1)continue;let Y=j.zoneLow;if(j.data.length===1){let A=d.farbe(Y,C.color);p.push({type:"circle",id:w?`${w}-dot-${E}${$}`:void 0,cx:h.map(j.data[0].time),cy:c.map(j.data[0].value),r:Math.max(s.pointSize??x.pointSize,C.width??s.strokeWidth??x.strokeWidth),fill:A,shadowColor:s.shadowColor,shadowBlur:s.shadowBlur});continue}p.push({type:"path",cssClass:"series-line",id:w?`${w}-line-${E}${$}`:void 0,points:j.data.map(A=>({x:h.map(A.time),y:c.map(A.value)})),stroke:d.farbe(Y,C.color),strokeWidth:C.width??s.strokeWidth,smoothing:v==="step"?false:C.smoothing??s.smoothing,smoothingType:C.smoothingType??s.smoothingType,dash:C.style,opacity:C.opacity,fill:"none",shadowColor:s.shadowColor,shadowBlur:s.shadowBlur,shadowOffsetX:s.shadowOffsetX,shadowOffsetY:s.shadowOffsetY});}};a===false||(Array.isArray(a)?a.forEach((v,C)=>{L(v.shape??(e.seriesType==="step"?"step":"line"),v,`-${C}`);}):L(l?"step":"line",a??{},"")),y.push(...S);}return s.pointStyle&&s.pointStyle!=="none"&&o<=(m?.threshold??x.pointThreshold)&&p.push(...un(y,n,s,S=>d.farbe(S.value))),p}function bn(t,e){for(let n of t){if(n.length===0||e<n[0].time||e>n[n.length-1].time)continue;let r=0;for(;r<n.length-1&&n[r+1].time<=e;)r++;return {lauf:n,i:r}}return null}function Re(t,e,n){if(t.art==="fest")return t.wert;let r=bn(t.laeufe,e);if(!r)return null;let{lauf:i,i:o}=r,s=i[o];if(t.stufe)return n&&s.time===e&&o>0?i[o-1].value:s.value;if(s.time===e||o===i.length-1)return s.value;let a=i[o+1];return s.value+(a.value-s.value)*(e-s.time)/(a.time-s.time)}function yn(t,e,n){if(t.art==="fest")return true;let r=bn(t.laeufe,e);return r?n===void 0||e-r.lauf[r.i].time<=n:false}function xn(t,e,n){let r=n.exceeds,i=n.side??"both",o=new Set;for(let l of [t,e])if(l.art==="laeufe")for(let u of l.laeufe)for(let h of u)o.add(h.time),n.maxAgeMs!==void 0&&o.add(h.time+n.maxAgeMs);let s=[...o].sort((l,u)=>l-u),a=[];for(let l=0;l+1<s.length;l++){let[u,h]=[s[l],s[l+1]],c=(u+h)/2;if(!yn(t,c,n.maxAgeMs)||!yn(e,c,n.maxAgeMs))continue;let p=Re(e,u,false)-Re(t,u,false),d=Re(e,h,true)-Re(t,h,true),g=(f,y)=>{if(f<=0&&y<=0)return null;if(f>0&&y>0)return [u,h];let b=u+(0-f)/(y-f)*(h-u);return f>0?[u,b]:[b,h]};if(i!=="below"){let f=g(p-r,d-r);f&&f[1]>f[0]&&a.push(f);}if(i!=="above"){let f=g(-p-r,-d-r);f&&f[1]>f[0]&&a.push(f);}}a.sort((l,u)=>l[0]-u[0]);let m=[];for(let l of a){let u=m[m.length-1];u&&l[0]<=u[1]?u[1]=Math.max(u[1],l[1]):m.push([l[0],l[1]]);}return m}function Sn(t,e,n,r,i,o){let s=0,a=m=>m.type==="group"?{...m,commands:m.commands.map(a)}:"id"in m&&m.id!==void 0?{...m,...o(s++)}:m;return e.map(([m,l])=>{let u=n.map(m);return {type:"group",clipRect:{x:u,y:r,w:n.map(l)-u,h:i-r},commands:t.map(a)}})}function q(t){return t!==void 0&&typeof t=="object"&&"series"in t?t.series:null}function wn(t){let e=[...t].sort((r,i)=>r.time-i.time),n=0;return r=>{for(;n>0&&e[n].time>r;)n--;for(;n<e.length-1&&e[n+1].time<=r;)n++;let i=e[n];if(!i||r<i.time)return null;if(i.time===r)return i.value??null;let o=e[n+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 vn(t){let e=[...t].sort((r,i)=>r.time-i.time),n=new Map;for(let r=1;r<e.length;r++){let[i,o]=[e[r-1],e[r]];i.time===o.time&&i.value!==null&&!n.has(i.time)&&n.set(i.time,i.value);}return n}function Tn(t,e,n){let r=t??e;if(r==="series")return null;if(r==="chartTop")return n.chartTop;if(r==="chartBottom")return n.chartBottom;if(typeof r=="object"&&"threshold"in r){let i=n.thresholds.get(r.threshold);if(!i)throw new Error(`fillSpec region references unknown threshold '${r.threshold}'`);return n.valueScale.map(i.value)}return typeof r=="object"&&"value"in r?n.valueScale.map(r.value):null}function qr(t){return typeof t=="string"?{color:t}:{color:t.color,hatch:t.hatch}}function kn(t,e){let n=q(t);if(n!==null){let i=e.fremdeSerie?.(n);return i?{art:"laeufe",laeufe:I.getRuns(i.data,o=>o.value===null,i.gapThreshold),stufe:i.shape==="step"}:null}if(t==="series")return {art:"laeufe",laeufe:e.runs,stufe:e.shape==="step"};let r=e.valueScale.domain();return {art:"fest",wert:de(t,e)??(t==="chartBottom"?r[0]:r[1])}}function _n(t,e,n){let r=Jr(t,e,n);if(!t.where||r.length===0)return r;let i=kn(t.from??"chartBottom",e),o=kn(t.to??"series",e);return !i||!o?r:Sn(r,xn(i,o,t.where),e.timeScale,e.chartTop,e.chartBottom,s=>e.idPrefix?{id:`${e.idPrefix}-fill-r${n}-${s}`}:{})}function Jr(t,e,n){let r=Tn(t.from,"chartBottom",e),i=Tn(t.to,"series",e),{color:o,hatch:s}=qr(t.fill),l={attrs:{type:"path",fill:o,hatch:s,stroke:"none",cssClass:"series-fill"},teilId:u=>e.idPrefix?{id:`${e.idPrefix}-fill-r${n}-${u}`}:{}};return q(t.from)!==null||q(t.to)!==null?ei(t,e,l):r!==null&&i!==null?ti(r,i,e,l):ni(t,e,r,i,l)}function Qr(t,e,n){let r=e.shape==="step",i=(c,p)=>{let d=c??p,g=q(d);if(g!==null){let b=e.fremdeSerie(g);if(!b)return null;let S=b.shape==="step",w=I.getRuns(b.data,T=>T.value===null,b.gapThreshold).map(T=>S?X(T):T);return {art:"fremd",skala:b.valueScale??e.valueScale,laeufe:w,glatt:!S&&!!b.smoothing,verfahren:b.smoothingType}}if(d==="series")return {art:"eigene",glatt:!r&&!!e.smoothing,verfahren:e.smoothingType};let f=de(d,e),y=e.valueScale.domain();return {art:"fest",wert:f??(d==="chartBottom"?y[0]:y[1]),glatt:false}},o=i(t.from,"chartBottom"),s=i(t.to,"series");if(!o||!s||!o.glatt&&!s.glatt)return null;let a=c=>c.art==="fremd"?c.skala:e.valueScale,m=c=>p=>({x:e.timeScale.map(p.time),y:c.map(p.value)}),l=(c,p)=>c.art==="eigene"?[p]:c.art==="fremd"?c.laeufe.filter(d=>d.length>=2):[null],u=(c,p,d,g)=>p?p.map(m(a(c))):[d,g].map(f=>({x:e.timeScale.map(f),y:e.valueScale.map(c.wert)})),h=[];for(let c of e.runs){if(c.length<2)continue;let p=r?X(c):c;for(let d of l(o,p))for(let g of l(s,p)){let f=Math.max(p[0].time,d?.[0].time??-1/0,g?.[0].time??-1/0),y=Math.min(p.at(-1).time,d?.at(-1)?.time??1/0,g?.at(-1)?.time??1/0);if(!(y>f))continue;let b={k:o,pts:u(o,d,f,y)},S={k:s,pts:u(s,g,f,y)};b.k.glatt||([b,S]=[S,b]);let w=_=>(_.art==="fest"?void 0:_.verfahren)??"catmull-rom",T=e.timeScale.map(f);h.push({type:"group",clipRect:{x:T,y:e.chartTop,w:e.timeScale.map(y)-T,h:e.chartBottom-e.chartTop},commands:[{...n.attrs,...n.teilId(h.length),points:[...b.pts,...[...S.pts].reverse()],smoothing:true,smoothingType:w(b.k),smoothCount:b.pts.length,...S.k.glatt?{smoothTail:S.pts.length,smoothTailType:w(S.k)}:{}}]});}}return h}function ei(t,e,n){if(!e.fremdeSerie){let a=q(t.from)??q(t.to);throw new Error(`fillSpec region references series '${a}', but no series lookup was provided`)}let r=Qr(t,e,n);if(r)return r;let i=(a,m,l)=>{let u=a??m,h=q(u);if(h!==null){let g=e.fremdeSerie(h);if(!g)throw new Error(`fillSpec region references unknown series '${h}'`);let f=g.shape==="step"?X(g.data):g.data;return {bei:wn(f),davor:vn(f),zeiten:f.map(y=>y.time),skala:g.valueScale??e.valueScale}}if(u==="series")return {bei:wn(l),davor:vn(l),zeiten:l.map(g=>g.time),skala:e.valueScale};let c=de(u,e),p=e.valueScale.domain(),d=c??(u==="chartBottom"?p[0]:p[1]);return {bei:()=>d,zeiten:[],skala:e.valueScale}},o=e.shape==="step",s=[];for(let a of e.runs){if(a.length<2)continue;let m=o?X(a):a,l=i(t.from,"chartBottom",m),u=i(t.to,"series",m),h=m[0].time,c=m[m.length-1].time,p=[...new Set([...l.zeiten,...u.zeiten,...m.map(y=>y.time)])].filter(y=>y>=h&&y<=c).sort((y,b)=>y-b),d=[],g=[],f=()=>{if(d.length>=2){let y=[...g].reverse();s.push({...n.attrs,...n.teilId(s.length),smoothing:o?false:e.smoothing,smoothingType:e.smoothingType,smoothCount:d.length,points:[...d,...y]});}d=[],g=[];};for(let y of p){let b=l.bei(y),S=u.bei(y);if(b===null||S===null){f();continue}let w=e.timeScale.map(y),T=l.davor?.get(y)??b,_=u.davor?.get(y)??S;(T!==b||_!==S)&&(d.push({x:w,y:u.skala.map(_)}),g.push({x:w,y:l.skala.map(T)})),d.push({x:w,y:u.skala.map(S)}),g.push({x:w,y:l.skala.map(b)});}f();}return s}function ti(t,e,n,r){let i=n.timeScale.range(),o=i[0],s=i[1],a=Math.min(t,e),m=Math.max(t,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 ni(t,e,n,r,i){let o=n??r,s=[],a=ri(t,e);if(a===null){let u=e.valueScale.domain();a=(n??r)===e.chartBottom?u[0]:u[1];}let m=de(t.outer,e),l=e.shape==="step";for(let u of e.runs){if(u.length<2)continue;let h=l?X(u):u,c=I.splitByThreshold(h,a,d=>d.value??a,I.interpolateDataPoint),p=t.side==="above"?c.above:t.side==="below"?c.below:[...c.above,...c.below];if(m!==null&&t.side){let d=m,g=t.side==="above"?f=>Math.min(f,d):f=>Math.max(f,d);p=p.map(f=>f.map(y=>({...y,value:g(y.value??d)})));}for(let d of p){if(d.length<2)continue;let g=d.map(y=>({x:e.timeScale.map(y.time),y:e.valueScale.map(y.value)})),f=[];for(let y of [...g].reverse()){let b=f[f.length-1];l&&b&&b.x===y.x||f.push({x:y.x,y:o});}s.push({...i.attrs,...i.teilId(s.length),smoothing:l?false:e.smoothing,smoothingType:e.smoothingType,smoothCount:g.length,points:[...g,...f]});}}return s}function ri(t,e){let n=t.from==="series"?t.to:t.from;return de(n,e)}function de(t,e){return t===void 0||t==="series"||t==="chartTop"||t==="chartBottom"?null:typeof t=="object"&&"threshold"in t?e.thresholds.get(t.threshold)?.value??null:typeof t=="object"&&"value"in t?t.value:null}function An(t,e){if(typeof t=="string"||!("regions"in t))return _n({fill:t},e,0);let n=[];return t.regions.forEach((r,i)=>{n.push(..._n(r,e,i));}),n}function Cn(t){let e=t.style?.line,n=e&&!Array.isArray(e)?e:void 0;return {color:n?.color??x.stroke,width:n?.width??x.strokeWidth,dash:n?.style,smoothing:n?.smoothing??false,smoothingType:n?.smoothingType}}function Mn(t,e,n,r,i){let o=t.filter(l=>l.value!==null);if(o.length<2)return [];let s=Cn(n);e.merke?.({index:i,kind:n.kind,punkte:o.map(l=>({time:l.time,value:l.value})),farbe:s.color,...s.dash?{linie:s.dash}:{}});let a=o.map(l=>({x:e.timeScale.map(l.time),y:e.valueScale.map(l.value)}));return [{type:"path",cssClass:"series-line",id:e.idPrefix?`${e.idPrefix}-overlay-${i}-${r}`:`overlay-${i}-${r}`,points:a,stroke:s.color,strokeWidth:s.width,smoothing:s.smoothing,smoothingType:s.smoothingType,dash:s.dash,fill:"none"}]}function Ln(t,e,n=0){switch(t.kind){case "movingAverage":{let r=t.type==="exponential"?Zt(e.data,t.window):et(e.data,t.window);return Mn(r,e,t,"movingAvg",n)}case "movingMkt":{let r=Yt(e.data,t.window,t.activationEnergy);return Mn(r,e,t,"movingMkt",n)}case "limits":{let r=[],i=e.timeScale.range(),o=i[0],s=i[1],a=Cn(t),m=a.color,l=a.width,u=a.dash??"dashed",h=e.idPrefix?`${e.idPrefix}-overlay-${n}-`:`overlay-${n}-`;return t.high!==void 0&&r.push({type:"line",id:`${h}limit-high`,x1:o,y1:e.valueScale.map(t.high),x2:s,y2:e.valueScale.map(t.high),stroke:m,strokeWidth:l,dash:u}),t.low!==void 0&&r.push({type:"line",id:`${h}limit-low`,x1:o,y1:e.valueScale.map(t.low),x2:s,y2:e.valueScale.map(t.low),stroke:m,strokeWidth:l,dash:u}),r}case "stdDevBand":{let r=t.multiplier??1,i=et(e.data,t.window),o=Xt(e.data,t.window),s=[],a=[],m=[];for(let y=0;y<i.length;y++){let b=i[y].value,S=o[y].value;if(b===null||S===null)continue;let w=e.timeScale.map(i[y].time);s.push({x:w,y:e.valueScale.map(b+r*S)}),a.push({x:w,y:e.valueScale.map(b-r*S)}),m.push({time:i[y].time,value:b,low:b-r*S,high:b+r*S});}if(s.length<2)return [];let l=e.idPrefix?`${e.idPrefix}-overlay-${n}-`:`overlay-${n}-`,u=[],c=(typeof t.style?.fill=="string"||t.style?.fill&&!("regions"in t.style.fill)?t.style.fill:void 0)??"#94a3b833",{color:p,hatch:d}=ii(c);u.push({type:"path",cssClass:"series-fill",id:`${l}stdDevBand`,points:[...s,...[...a].reverse()],fill:p,hatch:d,stroke:"none"});let g=t.style?.line,f=g&&!Array.isArray(g)?g:void 0;if(e.merke?.({index:n,kind:"stdDevBand",punkte:m,farbe:f?f.color??x.stroke:p,...f?.style?{linie:f.style}:{}}),f){let y=i.filter(b=>b.value!==null).map(b=>({x:e.timeScale.map(b.time),y:e.valueScale.map(b.value)}));y.length>=2&&u.push({type:"path",cssClass:"series-line",id:`${l}stdDevBand-mean`,points:y,stroke:f.color??x.stroke,strokeWidth:f.width??1.5,smoothing:f.smoothing,smoothingType:f.smoothingType,dash:f.style,fill:"none"});}return u}}}function ii(t){return typeof t=="string"?{color:t}:{color:t.color,hatch:t.hatch}}function Dn(t,e){let n=t.style?.line,r=n&&!Array.isArray(n)?n:void 0,i=Array.isArray(n)?n[0]:r,o=(i?.shape??t.seriesType)==="step",s=i||void 0,a=s?.gapThreshold??e??x.gapThreshold;return {styleLine:n,lineDefaults:r,gapThreshold:a,grundLinie:s,stepShape:o}}function $n(t,e,n,r,i=0){let o=t.timeScale,s={timeScale:o,valueScale:n};if(W(e))return dn(e,o,n);let{lineDefaults:a,gapThreshold:m}=t.linienGrundlage(e),l=I.getRuns(e.data,_=>_.value===null,m),u=l.reduce((_,P)=>_+P.length,0);if(u===0)return [];let h=[],c=e.style?.markers,p=e.style?.shadow,d={stroke:a?.color??t.palettenFarbe(i),strokeWidth:a?.width??x.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:K(e.name,e.id)},{styleLine:g,grundLinie:f,stepShape:y}=t.linienGrundlage(e),b=fn(e,o,t.jetzt),S=Pe(l,b),w=e.style?.fill;if(w!==void 0){let _=n.range(),P=Math.min(_[0],_[1]),L=Math.max(_[0],_[1]);h.push(...An(w,{runs:S,timeScale:o,valueScale:n,thresholds:r,chartTop:P,chartBottom:L,smoothing:f?.smoothing,smoothingType:f?.smoothingType,shape:y?"step":"line",fremdeSerie:v=>{let C=t.alleReihen.find(j=>(j.id??j.name)===v||j.name===v);if(!C||!("data"in C))return;let $=C.data;if($.length===0||!("value"in $[0]))return;let B=t.linienGrundlage(C),F=B.grundLinie;return {data:$,shape:B.stepShape?"step":"line",smoothing:F?.smoothing,smoothingType:F?.smoothingType,gapThreshold:B.gapThreshold,valueScale:t.valueScales.get(t.achseVon(C))}},idPrefix:K(e.name,e.id)}));}h.push(...gn({series:e,ctx:s,runs:l,haltBis:b,totalPoints:u,style:d,styleLine:g,styleMarkers:c,stepShape:y,thresholds:r}));let T=e.overlays;if(T&&T.length>0){let _=n.range(),P={data:e.data,timeScale:o,valueScale:n,chartTop:Math.min(_[0],_[1]),chartBottom:Math.max(_[0],_[1]),idPrefix:K(e.name,e.id),merke:L=>{t.merkeOverlay(i,L);}};T.forEach((L,v)=>{h.push(...Ln(L,P,v));});}return e.style?.gap&&l.length>1&&h.push(...$t({gap:e.style.gap,runs:l,timeScale:o,valueScale:n,metrics:t.textMetrics,lineColor:a?.color})),h}function Pn(t,e,n){if(!e)return t;let r=`${e}-`,i=s=>s.split(/\s+/).filter(Boolean).map(a=>n.has(a)?a:r+a).join(" "),o=s=>{let a={...s};return a.cssClass&&(a.cssClass=i(a.cssClass)),a.type==="group"&&(a.commands=a.commands.map(o)),a};return t.map(o)}function Rn(t,e,n){let i=new Array(t.length),o=e.map(s=>({position:s.position,von:s.von,bis:s.bis}));t.forEach((s,a)=>{if(s.fest===void 0)return;let m=s.position==="left"?s.achseX-s.fest:s.achseX+s.fest,l=s.schrift/2;o.push({position:s.position,von:m-l-1,bis:m+l+1,titel:true}),i[a]=m;});for(let s of ["left","right"]){let a=s==="left",m=t.map((l,u)=>({t:l,i:u})).filter(l=>l.t.position===s&&l.t.fest===void 0).sort((l,u)=>a?u.t.achseX-l.t.achseX:l.t.achseX-u.t.achseX);for(let{t:l,i:u}of m){let h=l.schrift/2,c=o.filter(g=>g.position===s),p=l.kante,d=a?p-1-h:p+1+h;for(let g=0;g<=c.length;g++){let f=d-h-1,y=d+h+1,b=c.find(S=>f<S.bis&&S.von<y);if(!b)break;p=a?b.von:b.bis,d=a?p-1-h:p+1+h;}if(a?d-h<2:d+h>n-2){let g=o.filter(f=>f.position===s&&f.titel);d=a?h+2:n-h-2;for(let f=0;f<=g.length;f++){let y=d-h-1,b=d+h+1,S=g.find(w=>y<w.bis&&w.von<b);if(!S)break;d=a?S.bis+1+h:S.von-1-h;}}o.push({position:s,von:d-h-1,bis:d+h+1,titel:true}),i[u]=d;}}return {xs:i,belegt:o}}function Bn(t){let{axes:e,neueForm:n,achsenTitel:r,titelSpuren:i,layout:o}=t,{chartX:s,chartY:a,chartWidth:m,chartHeight:l}=o,u=n?void 0:e?.left?.label,h=n?void 0:e?.right?.label,c=e?.x?.label;if(!u&&!h&&!c&&r.length===0)return [];let p=[],d=a+l/2,g=e?.left?.labels,f=e?.right?.labels,y=e?.x?.labels,b=e?.left?.labelOffset,S=e?.right?.labelOffset;return u&&p.push({type:"text",content:u,x:b===void 0?14:s-(e?.left?.offset??0)-b,y:d,anchor:"middle",fontSize:g?.fontSize??x.axisLabelSize,fill:g?.color??x.axisLabelColor,rotate:-90}),h&&p.push({type:"text",content:h,x:S===void 0?o.totalWidth-14:s+m+(e?.right?.offset??0)+S,y:d,anchor:"middle",fontSize:f?.fontSize??x.axisLabelSize,fill:f?.color??x.axisLabelColor,rotate:90}),r.forEach((w,T)=>{p.push({type:"text",content:w.text,x:i[T],y:d,anchor:"middle",fontSize:w.style?.fontSize??x.axisLabelSize,fill:w.style?.color??x.axisLabelColor,rotate:w.position==="right"?90:-90});}),c&&p.push({type:"text",content:c,x:s+m/2,y:o.totalHeight-6-(t.untenBelegt??0),anchor:"middle",fontSize:y?.fontSize??x.axisLabelSize,fill:y?.color??x.axisLabelColor}),p.length===0?[]:[{type:"group",cssClass:"axis-labels",commands:p}]}var oi={top:20,right:20,bottom:40,left:60},V=class{_layout;_idPraefix;_klassenPraefix;_renderer;_locale;_timeZone;_fontFamily;_legend;_textMetrics;_theme;_overlayWerte=new Map;_clipSeries;_markers;_thresholds;_highlights;_gaps;_gapsBand;_gapsAutoDetect;_gapsMinGapMs;_gapsAtEnd;_annotations;_annotationBands;_disabledAnnotations=new Set;_annotationSeq=0;_axes;_series;_timeScale;_optionen;_randAuto;_valueScales=new Map;constructor(e={}){this._optionen=e,this._randAuto=e.margin==="auto",this._layout=new ee({width:e.width??800,height:e.height??400,margin:typeof e.margin=="object"?e.margin:oi}).compute(),this._renderer=e.renderer,this._locale=e.locale,this._timeZone=e.timeZone,this._fontFamily=e.fontFamily,this._idPraefix=e.idPrefix,this._klassenPraefix=e.classPrefix,this._legend=e.legend,this._textMetrics=e.textMetrics??O,this._theme=e.theme,this._clipSeries=e.clipSeries??true,this._markers=e.markers??[],this._thresholds=e.thresholds??[],this._highlights=e.highlights??[];let n=bt(e.gaps);this._gaps=n.gaps,this._gapsAutoDetect=n.autoDetect,this._gapsMinGapMs=n.minGapMs,this._gapsBand=n.band,this._gapsAtEnd=n.atEnd,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 n of this._annotationBands){let r=n.height??12,i=n.spacing??0;(n.showAxis??false)&&(e+=26+i),e+=r+i;}return e}setData(e){this._series=e.filter(n=>Array.isArray(n.data));}addAnnotation(e){let n=e.id??`anno-${++this._annotationSeq}`;return this._annotations.push({...e,id:n}),n}removeAnnotation(e){let n=this._annotations.length;return this._annotations=this._annotations.filter(r=>r.id!==e),this._disabledAnnotations.delete(e),this._annotations.length<n}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(n=>n.time)}_layoutMitLegende(){let e=en({legend:this._legend,items:this._legendeneintraege(),gesamtbreite:this._layout.totalWidth,metrics:this._textMetrics}),n=this._layout,r=tn(e,this._layout.margin);return r&&(n=new ee({width:this._layout.totalWidth,height:this._layout.totalHeight,margin:r}).compute()),{layout:n,legende:e}}renderCommands(){this._randAuto&&this._randMessen();let e=this._klassenPraefix,n=new Set((this._legend?.itemClass??"").split(/\s+/).filter(Boolean));return ue(this._theme,()=>Pn(this._zeichne(),e,n))}_randMessen(){let e=Ke({...this._optionen,margin:void 0,series:this._series,annotations:this._annotations.filter(n=>!this._disabledAnnotations.has(n.id??""))});this._layout=new ee({width:this._layout.totalWidth,height:this._layout.totalHeight,margin:e}).compute();}_zeichne(){if(this._overlayWerte.clear(),this._series.length===0)return [];let{layout:e,legende:n}=this._layoutMitLegende(),{chartX:r,chartY:i,chartWidth:o,chartHeight:s}=e,a=[r,r+o],m=[i,i+s],l=[];for(let A of this._series)A.data.sort((M,D)=>M.time-D.time);let u=new Map,h=1/0,c=-1/0,p=false;for(let A of this._series){let M=this._axisIndexOf(A),D=u.get(M);D?D.push(A):u.set(M,[A]);for(let G of this._timesOf(A))G<h&&(h=G),G>c&&(c=G),p=true;}if(!p)return [];let d=this._axes?.x?.domain,g=d&&d!=="auto"?d:[h,c];this._timeScale=new ne({domain:g,range:a,locale:this._locale,timeZone:this._timeZone});let f=new ie({domain:g,xRange:a,y:i+s,locale:this._locale,timeZone:this._timeZone,format:this._axes?.x?.format,maxTicks:this._axes?.x?.ticks?.major,minorTicks:xe(this._axes?.x?.ticks?.minor,Z(this._axes?.x?.grid)?.minor),colors:be(this._axes?.x?.axis,this._axes?.x?.labels),gesamtbreite:e.totalWidth,metrics:this._textMetrics});this._valueScales.clear();let y=Array.from(u.keys()).sort((A,M)=>A-M),b=Mt({axes:this._axes,indices:y,seriesByIndex:u,layout:e,thresholds:this._thresholds,metrics:this._textMetrics,locale:this._locale});l.push(...b.commands);let{titel:S,baender:w,neueForm:T}=b,_=b.primary;for(let[A,M]of b.scales)this._valueScales.set(A,M);let P=this._valueScales.get(0)??this._valueScales.get(y[0]);l.push({type:"group",cssClass:"time-axis",sharedStyles:true,commands:f.render()});let L=on({axes:this._axes,timeAxis:f,primaryValueAxis:_,xRange:a,yRange:m}),v=L.group;v&&L.layer==="back"&&(l.push(v),v=null),this._highlights.length>0&&l.push({type:"group",cssClass:"highlights",commands:It({metrics:this._textMetrics,highlights:this._highlights,timeScale:this._timeScale,yRange:m,height:e.totalHeight})});let C=[],$=P?Lt({thresholds:this._thresholds,valueScales:this._valueScales,primaryScale:P,xRange:a,layout:e,baender:b.baender,belegt:C,metrics:this._textMetrics}):[];l.push(...$);let B=this._gapsAtEnd?Bt({atEnd:this._gapsAtEnd,series:this._series,timeScale:this._timeScale}).map(A=>Ze(A,void 0)):[],F=[...this._gaps,...B];if(this._gapsAutoDetect){let A=[];for(let M of this._series){if(W(M))continue;let D=M.data.filter(G=>G.value!==null);A.push(...Vt(D,this._gapsMinGapMs));}A.length>0&&(F=[...F,...A]);}F.length>0&&l.push({type:"group",cssClass:"gaps",commands:Qe({gaps:F,timeScale:this._timeScale,yRange:m,height:e.totalHeight,metrics:this._textMetrics,band:this._gapsBand})});let j=new Map(this._thresholds.map(A=>[A.id??A.name,A]));for(let[A,M]of this._series.entries()){if(M.data.length===0)continue;let D=this._valueScales.get(this._axisIndexOf(M));if(!D)continue;let G=N(M.id??M.name);l.push({type:"group",cssClass:`series series--${G}`,id:`series-${G}`,commands:$n(this._reihenKontext(),M,D,j,A),...this._clipSeries?{clipRect:{x:r,y:i,w:o,h:s}}:{}});}if(v&&l.push(an(v,sn($))),l.push(...cn({markers:this._markers,annotations:this._annotations.filter(A=>!A.id||!this._disabledAnnotations.has(A.id)),series:this._series,timeScale:this._timeScale,valueScales:this._valueScales,achseVon:A=>this._axisIndexOf(A),primaryScale:P,yRange:m,metrics:this._textMetrics,plot:{x:r,y:i,w:o,h:s}})),this._annotationBands.length>0){let A=i+s+this._layout.margin.bottom,M=0;this._annotationBands.forEach(D=>{let G=D.height??12,Q=D.spacing??0,R=A+M;(D.showAxis??false)&&(M+=26+Q),M+=G+Q,l.push({type:"group",cssClass:"annotation-band",commands:new Te({name:D.name,showAxis:D.showAxis??false,items:D.items,timeScale:this._timeScale,background:D.background,hatch:D.hatch,labels:D.labels,minItemWidth:D.minItemWidth,metrics:this._textMetrics},[r,r+o],R,G).render()});});}let{xs:E,belegt:Y}=Rn(S.map(A=>({achseX:A.achseX,kante:A.kante,position:A.position,schrift:A.style?.fontSize??x.axisLabelSize,fest:A.fest})),[...w,...C],e.totalWidth);return l.push(...nn({legende:n,layout:e,randBelegt:Y,metrics:this._textMetrics})),l.push(...Bn({axes:this._axes,neueForm:T,achsenTitel:S,titelSpuren:E,layout:e,untenBelegt:e.margin.bottom-this._layout.margin.bottom})),Ye(l,this._fontFamily??x.fontFamily),Xe(l,this._idPraefix),l}_linienGrundlage(e){return Dn(e,this._gapsAutoDetect?this._gapsMinGapMs:void 0)}_reihenKontext(){return {timeScale:this._timeScale,alleReihen:this._series,valueScales:this._valueScales,achseVon:e=>this._axisIndexOf(e),linienGrundlage:e=>this._linienGrundlage(e),palettenFarbe:e=>this._palettenFarbe(e),jetzt:this._gapsAtEnd?.now,textMetrics:this._textMetrics,merkeOverlay:(e,n)=>{let r=this._overlayWerte.get(e)??[];r.push(n),this._overlayWerte.set(e,r);}}}legendItems(){return ue(this._theme,()=>this._legendeneintraege())}_legendeneintraege(){return [...this._legendItems(),...this._bandLegendItems()]}_bandLegendItems(){return this._annotationBands.filter(e=>e.showInLegend===true&&e.name).map(e=>({name:e.name,color:Gt(e),id:`band-${N(e.name)}`}))}_palettenFarbe(e){let n=x.palette;return n.length>0?n[e%n.length]:x.stroke}_legendItems(){return this._series.map((e,n)=>{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=W(e)?e.avgColor??x.avgColor:this._palettenFarbe(n);return {name:e.name,color:i[0]?.color??a,line:i.length===1?i[0].style:void 0,width:i.length<=1?i[0]?.width??x.strokeWidth:void 0,marker:s?o.type:void 0,id:N(e.id??e.name),seriesId:e.id??e.name}})}get renderer(){return this._renderer}get layout(){return ue(this._theme,()=>this._layoutMitLegende().layout)}get plotRect(){let{chartX:e,chartY:n,chartWidth:r,chartHeight:i}=this.layout;return {x:e,y:n,width:r,height:i}}get timeScale(){return this._timeScale}get valueScales(){return this._valueScales}warnings(){return zt({series:this._series,gaps:this._gaps,thresholds:this._thresholds,linienGrundlage:e=>this._linienGrundlage(e)})}pointsAt(e,n,r={}){return ue(this._theme,()=>this._punkteAm(e,n,r))}_punkteAm(e,n,r={}){if(!this._timeScale)return [];let i=this._legendItems();return pt(this._series,this._timeScale,(o,s)=>{let a=this._axisIndexOf(o),m=this._valueScales.get(a);if(!m)return;let l=W(o)?void 0:this._linienGrundlage(o);return {skala:m,achse:a,stufe:l?.stepShape??false,gapThreshold:l?.gapThreshold??0,farbe:i[s].color,linie:i[s].line,format:si(o)??we(this._axes,a)?.format,overlays:this._overlayWerte.get(s)}},this.plotRect,e,n,{...r,radius:r.radius??x.tooltipSnapRadius})}invertTime(e){return this._timeScale?this._timeScale.invert(e):0}invertValue(e,n=0){let r=this._valueScales.get(n);return r?r.invert(e):0}project(e,n,r=0){let i=this._timeScale?this._timeScale.map(e):0,o=this._valueScales.get(r);return {x:i,y:o?o.map(n):0}}};function si(t){let e=t.enumMap;return e?n=>e[n]??String(n):void 0}function ai(t){if(t.min!==void 0&&t.max!==void 0)return {unit:t.unit,min:t.min,max:t.max};let e=1/0,n=-1/0;for(let r of t.data??[])r.value===null||r.value===void 0||(r.value<e&&(e=r.value),r.value>n&&(n=r.value));return {unit:t.unit,min:e,max:n}}var jn=t=>Math.abs(t.max-t.min);function li(t,e){return t.max>=e.min&&e.max>=t.min?0:t.max<e.min?e.min-t.max:t.min-e.max}function mi(t,e){if(t.unit!==e.unit)return false;let n=Math.max(Math.abs(t.min),Math.abs(t.max),Math.abs(e.min),Math.abs(e.max)),r=Math.max(jn(t),jn(e),n*.05);return li(t,e)<=r}function ui(t){let e=[],n=t.map(i=>{let o=ai(i);if(!Number.isFinite(o.min)||!Number.isFinite(o.max)){let a=e.findIndex(m=>m.unit===o.unit);return a>=0?a:(e.push({unit:o.unit,min:0,max:0}),e.length-1)}let s=e.findIndex(a=>mi(a,o));return s>=0?(e[s]={unit:e[s].unit,min:Math.min(e[s].min,o.min),max:Math.max(e[s].max,o.max)},s):(e.push({...o}),e.length-1)}),r=e.map((i,o)=>({position:o===0?"left":"right",...i.unit?{label:i.unit}:{}}));return {indices:n,axes:r}}function Fn(t){let e=[];for(let n=0;n<t.length-1;n++){let r=t[n+1].x-t[n].x;e.push(r===0?0:(t[n+1].y-t[n].y)/r);}return e}function hi(t){let e=Fn(t),n=t.length,r=[...e];for(let i=1;i<n-1;i++)r[i]=e[i-1]*e[i]<=0?0:(e[i-1]+e[i])/2;r[n-1]=e[n-2];for(let i=0;i<n-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 ci(t){let e=Fn(t),n=t.length;if(e.length<2)return t.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],u=[];for(let h=0;h<n;h++){let c=Math.abs(l[h+3]-l[h+2]),p=Math.abs(l[h+1]-l[h]);u.push(c+p===0?(l[h+1]+l[h+2])/2:(c*l[h+1]+p*l[h+2])/(c+p));}return u}function di(t,e){let n=[];for(let r=0;r<t.length-1;r++){let i=t[r],o=t[r+1],s=(o.x-i.x)/3;n.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 n}function pi(t,e){if(t.length<2)return [];let n=e==="akima"?ci(t):hi(t);return di(t,n)}function fi(t){let e=[];for(let n=0;n<t.length-1;n++){let r=t[n-1]??t[n],i=t[n],o=t[n+1],s=t[n+2]??o,a=Math.min(i.x,o.x),m=Math.max(i.x,o.x),l=u=>Math.max(a,Math.min(u,m));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 it(t,e){return e&&e!=="catmull-rom"?pi(t,e):fi(t)}var ot=["fill","stroke","stroke-width","stroke-dasharray","stroke-linecap","fill-opacity","stroke-opacity"],gi={line:["stroke","stroke-width","stroke-dasharray","stroke-linecap","stroke-opacity"],text:["text-anchor","font-size","font-family","fill","fill-opacity"],circle:ot,rect:ot,path:ot},yi={line:"stroke-opacity",text:"fill-opacity"},bi=/ ([a-z-]+)="([^"]*)"/g;function xi(t){let e=/^<(line|text|circle|rect|path) /.exec(t)?.[1];if(!e||t.includes(`
25
- `))return null;let n=e==="text"?t.indexOf(">")+1:t.length,r=t.slice(0,n),i=/ opacity="([^"]*)"/.exec(r),o=yi[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(bi))s.set(a,m);return {art:e,kopf:r,rest:t.slice(n),attrs:s}}function En(t){let e=[];for(let r of gi[t[0].art]){if(!t.every(a=>a.attrs.has(r)))continue;let i=new Map;for(let a of t){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 n=t.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:n}}function Gn(t,e=" "){let n=[];for(let o of t){let s=xi(o);if(!s)return null;n.push(s);}if(n.length===0)return null;let r=new Set(n.map(o=>o.art));if(r.size===1){let o=En(n);return {attrs:o.attrs,inhalt:o.kinder.map(s=>e+s).join(`
24
+ `.trim()}function qe(t,e=2,n=false){if(t==="dashed"||!t&&n)return {strokeDasharray:"4,4"};if(t==="dotted")return {strokeDasharray:"2,4"};if(!t||t==="solid")return null;let r=vt(t,e);return r.strokeDasharray==="none"?null:r}function vt(t,e=2){let n=e;switch(t){case "dotted":return {strokeDasharray:`0, ${n*2}`,strokeLinecap:"round"};case "sparse-dots":return {strokeDasharray:`0, ${n*4}`,strokeLinecap:"round"};case "dashed":return {strokeDasharray:`${n*3}, ${n*2}`,strokeLinecap:"butt"};case "long-dash":return {strokeDasharray:`${n*6}, ${n*3}`,strokeLinecap:"butt"};case "dense-dash":return {strokeDasharray:`${n*1.5}, ${n*1.5}`,strokeLinecap:"butt"};case "dash-dot":return {strokeDasharray:`${n*4}, ${n*2}, 0, ${n*2}`,strokeLinecap:"round"};case "dash-dot-dot":return {strokeDasharray:`${n*5}, ${n*2}, 0, ${n*2}, 0, ${n*2}`,strokeLinecap:"round"};case "loose-dash":return {strokeDasharray:`${n*3}, ${n*4}`,strokeLinecap:"butt"};default:return {strokeDasharray:"none",strokeLinecap:"butt"}}}var x=new Proxy({},{get:(t,e)=>me()[e],has:(t,e)=>e in me(),ownKeys:()=>Reflect.ownKeys(me()),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(me(),e)});function ye(t,e){if(e<=0||t.length<2)return [];let n=[];for(let r=0;r<t.length-1;r++){let i=t[r],o=t[r+1];for(let s=1;s<=e;s++)n.push(i+(o-i)*s/(e+1));}return n}var he={axisColor:x.axisColor,tickColor:x.tickColor,textColor:x.textColor,textSize:x.textSize},ie=class{#e;#t;constructor(e){this.#e=new ne({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??he).axisColor}get tickColor(){return (this.#t.colors??he).tickColor}get textColor(){return (this.#t.colors??he).textColor}get textSize(){return (this.#t.colors??he).textSize}generateTicks(){let e=this.#t.minTicks??5,n=this.#t.maxTicks??12,i=this.#e.ticks({minTicks:e,maxTicks:n}).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 n=this.#t.minTicks??5,r=this.#t.maxTicks??12,{interval:i}=this.#e.tickInterval((n+r)/2,n,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 n=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)>=n&&r.push(e[i]);}return r}render(){let e=this.generateTicks(),n=this.#t.colors??he,r=this.#t.y??0,i=[],[o,s]=this.#e.range();i.push({type:"line",x1:o,y1:r,x2:s,y2:r,stroke:n.axisColor,strokeWidth:n.axisWidth});for(let a of this.generateMinorTicks())i.push({type:"line",x1:a,y1:r,x2:a,y2:r+3,stroke:n.tickColor,strokeWidth:n.axisWidth});for(let a of e)i.push({type:"line",x1:a.x,y1:r,x2:a.x,y2:r+6,stroke:n.tickColor,strokeWidth:n.axisWidth}),i.push({type:"text",content:a.label,x:this.#n(a.x,a.label,n.textSize),y:r+n.textSize+6,anchor:"middle",fontSize:n.textSize,fill:n.textColor});return i}generateMinorTicks(){return ye(this.generateTicks().map(e=>e.x),this.#t.minorTicks??0)}#n(e,n,r){let i=this.#t.gesamtbreite,o=this.#t.metrics;if(i===void 0||o===void 0)return e;let s=o(n,r)/2;return Math.max(s+2,Math.min(i-s-2,e))}};function z(t){return "showAs"in t&&!!t.showAs}function kt(t){if(z(t)){let e=[];for(let n of t.data)n.min!==null&&e.push(n.min),n.max!==null&&e.push(n.max);return e}return t.data.map(e=>e.value).filter(e=>e!==null)}function be(t,e){return {axisColor:t?.color??x.axisColor,tickColor:t?.color??x.tickColor,textColor:e?.color??x.textColor,textSize:e?.fontSize??x.textSize,axisWidth:t?.width??1}}function Tt(t,e,n,r){if(r===void 0)return [t,e];let i=typeof r=="number"?r:r.top??0,o=typeof r=="number"?r:r.bottom??0;if(i<=0&&o<=0)return [t,e];let s=n-i-o,a=e-t;if(s<=0||a<=0)return [t,e];let m=a/s;return [t-o*m,e+i*m]}function xe(t,e){return t!==void 0?t:e!==void 0&&e!==false?1:0}var oe={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function Je(t,e){let n=r=>e===void 0||e>=r;return Math.abs(t)>=1e6&&n(1e5)?`${(t/1e6).toFixed(1)}M`:Math.abs(t)>=1e3&&n(100)?`${(t/1e3).toFixed(1)}k`:Number.isInteger(t)?String(t):t.toFixed(1)}function gr(t){let e=new Array(t.length).fill(false),n=0;for(;n<t.length;){let r=n;for(;r+1<t.length&&t[r+1].label===t[n].label;)r++;for(let i=n+1;i<r;i++)e[i]=true;n=r+1;}return e}var Se=class{#e;#t;constructor(e){this.#e=new U({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??oe).axisColor}get tickColor(){return (this.#t.colors??oe).tickColor}get textColor(){return (this.#t.colors??oe).textColor}get textSize(){return (this.#t.colors??oe).textSize}generateTicks(){let e=this.#t.tickValues;if(e&&e.length>0){let g=this.#t.format??Je;return e.map(f=>({value:f,position:this.#e.map(f),label:g(f)}))}let n=this.#t.format??Je,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:n(i)}];let l=m/r,u=Math.pow(10,Math.floor(Math.log10(l))),h=l/u,c;if(h<=1.5?c=u:h<=3?c=2*u:h<=7?c=5*u:c=10*u,c<=0||!Number.isFinite(c))return [{value:i,position:this.#e.map(i),label:n(i)}];this.#t.format||(n=g=>Je(g,c));let p=[],d=Math.ceil(s/c)*c;for(let g=d;g<=a;g+=c)p.push({value:g,position:this.#e.map(g),label:n(g)});return p}generateMinorTicks(){return ye(this.generateTicks().map(e=>e.position),this.#t.minorTicks??0)}render(){let e=this.generateTicks(),n=this.#t.colors??oe,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=h=>s.some(c=>Math.abs(c-h)<=a),l=[];if(i==="vertical"){let[h,c]=this.#e.range();l.push({type:"line",x1:r,y1:h,x2:r,y2:c,stroke:n.axisColor,strokeWidth:n.axisWidth});let p=gr(e);e.forEach((d,g)=>{let f=m(d.position),y=p[g]?{opacity:0}:{};o==="left"?(l.push({type:"line",x1:r-4,y1:d.position,x2:r,y2:d.position,stroke:n.tickColor,strokeWidth:n.axisWidth}),f||l.push({type:"text",content:d.label,x:this.#n(r-8,d.label,"end"),y:d.position+4,anchor:"end",fontSize:n.textSize,fill:n.textColor,...y})):(l.push({type:"line",x1:r,y1:d.position,x2:r+4,y2:d.position,stroke:n.tickColor,strokeWidth:n.axisWidth}),f||l.push({type:"text",content:d.label,x:this.#n(r+8,d.label,"start"),y:d.position+4,anchor:"start",fontSize:n.textSize,fill:n.textColor,...y}));});}else {let[h,c]=this.#e.range();l.push({type:"line",x1:h,y1:r,x2:c,y2:r,stroke:n.axisColor,strokeWidth:n.axisWidth});for(let p of e)l.push({type:"line",x1:p.position,y1:r,x2:p.position,y2:r+6,stroke:n.tickColor,strokeWidth:n.axisWidth}),l.push({type:"text",content:p.label,x:p.position,y:r+18,anchor:"middle",fontSize:n.textSize,fill:n.textColor});}let u=(this.#t.orientation??"vertical")==="vertical";for(let h of this.generateMinorTicks())l.push(u?{type:"line",x1:o==="right"?r:r-2,y1:h,x2:o==="right"?r+2:r,y2:h,stroke:n.tickColor,strokeWidth:n.axisWidth}:{type:"line",x1:h,y1:r,x2:h,y2:r+3,stroke:n.tickColor,strokeWidth:n.axisWidth});return l}#n(e,n,r){let i=this.#t.gesamtbreite,o=this.#t.metrics;if(i===void 0||o===void 0)return e;let s=o(n,(this.#t.colors??oe).textSize);return r==="end"?Math.max(s+2,Math.min(i-2,e)):Math.min(i-s-2,Math.max(2,e))}};function _t(t){let e=new Set,n={};for(let r of t){let i=r.enumMap;if(i)for(let[o,s]of Object.entries(i)){let a=Number(o);e.add(a),a in n||(n[a]=s);}}return {werte:e.size>0?[...e].sort((r,i)=>r-i):void 0,name:r=>n[r]??String(r)}}var yr=new Set("de fr es it nl pt pl cs sk sl hr sr bs hu ro bg ru uk be da nb nn no sv fi et lv lt el tr id vi ca eu gl is kk az ka hy mk sq".split(" "));function br(t){let e=(t??"").toLowerCase().split(/[-_]/)[0];return yr.has(e)?",":"."}function At(t,e){let n=Math.max(0,Math.min(6,Math.trunc(t.decimals??1))),r=br(e),i=t.unit?` ${t.unit}`:"";return o=>{let s=o.toFixed(n);return /^-0(\.0+)?$/.test(s)&&(s=s.slice(1)),r!=="."&&(s=s.replace(".",r)),s+i}}function Mt(t){let{axes:e,indices:n,seriesByIndex:r,layout:i,thresholds:o,metrics:s,locale:a}=t,{chartX:m,chartY:l,chartWidth:u,chartHeight:h}=i,c=[],p=new Map,d,g=[],f=[],y=(e?.y?.length??0)>0,b=0,S=0;for(let w of n){let k=r.get(w),_=1/0,P=-1/0,L=false;for(let R of k)for(let pe of kt(R))pe<_&&(_=pe),pe>P&&(P=pe),L=true;if(!L)continue;if(we(e,w)?.includeThresholds)for(let R of o)(R.axisIndex??0)!==w||R.line==="none"||(_=Math.min(_,R.value),P=Math.max(P,R.value));_===P&&(_-=1,P+=1);let v=we(e,w),C=v?.domain,$=C&&C!=="auto"?C:Tt(_,P,h,v?.padding),{werte:B,name:F}=_t(k);if(B&&!(C&&C!=="auto")){let R=B.length>1?(B[B.length-1]-B[0])/(B.length-1):1;$[0]=B[0]-R/2,$[1]=B[B.length-1]+R/2;}let j=new U({domain:$,range:[l+h,l]});p.set(w,j);let E=v?.position??(w===0?"left":"right"),Y=E==="right"?"outside-right":"outside-left",A=o.filter(R=>(R.axisIndex??0)===w&&typeof R.label=="object"&&R.label!==null&&R.label.position===Y&&R.value>=Math.min($[0],$[1])&&R.value<=Math.max($[0],$[1])).map(R=>j.map(R.value)),M;if(E==="right"){let R=v?.offset??S*50;M=m+u+R,S++;}else {let R=v?.offset??b*50;M=m-R,b++;}let D=new Se({domain:$,range:[l+h,l],x:M,position:E,format:v?.format??(B?F:v?.tickFormat?At(v.tickFormat,a):void 0),tickValues:B,ticks:v?.ticks?.major,minorTicks:xe(v?.ticks?.minor,Z(v?.grid)?.minor),colors:be(v?.axis,v?.labels),suppressLabelsNear:A.length?A:void 0,gesamtbreite:i.totalWidth,metrics:s}),G=8+gt(D.generateTicks().map(R=>R.label),11,s),Q=E==="right"?M+G:M-G;f.push({position:E,von:Math.min(M,Q),bis:Math.max(M,Q),achse:w}),y&&v?.label&&g.push({text:v.label,achseX:M,kante:Q,position:E,style:v.labels,fest:v.labelOffset}),w===0&&(d=D),c.push({type:"group",cssClass:`value-axis ${E}`,sharedStyles:true,commands:D.render()});}return {commands:c,titel:g,baender:f,neueForm:y,primary:d,scales:p}}function we(t,e){let n=e===0?t?.left:e===1?t?.right:void 0,r=t?.y&&t.y.length>e?t.y[e]:void 0;return r&&n?{...n,...r}:r??n}var Ct=6;function xr(t){let e=typeof t.label=="object"&&t.label!==null?t.label.position:void 0;return e==="outside-right"?"right":e==="outside-left"?"left":null}function Sr(t,e,n,r,i){let o=r.filter(a=>a.position===e&&a.achse!==void 0&&a.achse!==n),s=false;if(e==="right"){for(let a of [...o].sort((m,l)=>m.von-l.von))t.x<a.bis&&t.x+i>a.von&&(t.x=a.bis+Ct,s=true);return {band:{position:e,von:t.x,bis:t.x+i,achse:n},verschoben:s}}for(let a of [...o].sort((m,l)=>l.bis-m.bis))t.x-i<a.bis&&t.x>a.von&&(t.x=a.von-Ct,s=true);return {band:{position:e,von:t.x-i,bis:t.x,achse:n},verschoben:s}}function wr(t){return t==="dotted"?{dash:"dotted"}:t==="dashed"?{dash:"dashed"}:{}}function vr(t){let{thresholds:e,valueScale:n,xRange:r}=t,[i,o]=r,[s,a]=n.range(),m=Math.min(s,a),l=Math.max(s,a),u=[],h=[];for(let c of e){let p=c.color??x.thresholdColor,d=n.map(c.value);c.fill==="above"?u.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"&&u.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 g=c.line??x.thresholdLine;if(g!=="none"){let S=wr(g),w={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&&(w.shadowColor=c.shadowColor,w.shadowBlur=c.shadowBlur??4,w.shadowOffsetX=c.shadowOffsetX??0,w.shadowOffsetY=c.shadowOffsetY??2),u.push(w);}let[f,y]=n.domain();if(c.value>=Math.min(f,y)&&c.value<=Math.max(f,y)&&c.label!==void 0&&c.label!==null&&c.label!==false){let S=typeof c.label=="object"?c.label:void 0,w=typeof c.label=="string"?c.label:S?.text??c.name,k=S?.position??"right",_=Tr(w,k,i,o,d,p,S);h.push({..._,y:kr(_.y,Math.min(s,a),Math.max(s,a),x.thresholdFontSize),id:c.id?`${c.id}-label`:void 0});}}return {inside:u,labels:h}}function kr(t,e,n,r){return Math.max(e+r,Math.min(n-r/2,t))}function Tr(t,e,n,r,i,o,s){let a=(n+r)/2,m={type:"text",content:t,fontSize:x.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:n+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:n-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 Lt(t){let{thresholds:e,valueScales:n,primaryScale:r,xRange:i,layout:o}=t,s=t.metrics??O,{chartX:a,chartY:m,chartWidth:l,chartHeight:u}=o,h=[];if(e.length===0)return h;let c=[],p=[];for(let d of e){let g=d.id??N(d.name),f=n.get(d.axisIndex??0),y=f??r,b=f?d.axisIndex??0:0,S=vr({thresholds:[d],valueScale:y,xRange:i}),w=xr(d);if(w&&t.baender)for(let k of S.labels){if(k.type!=="text")continue;let{band:_}=Sr(k,w,b,t.baender,s(k.content,x.thresholdFontSize));t.belegt?.push(_);}S.inside.length&&c.push({type:"group",cssClass:`threshold threshold--${g}`,id:`threshold-${g}`,commands:S.inside}),S.labels.length&&p.push({type:"group",cssClass:`threshold-label threshold-label--${g}`,commands:S.labels});}return c.length&&h.push({type:"group",cssClass:"thresholds",commands:c,clipRect:{x:a,y:m,w:l,h:u}}),p.length&&h.push({type:"group",cssClass:"threshold-labels",commands:p}),h}function Dt(t,e,n,r){switch(t){case "above":return e-5;case "below":return r!==void 0?r-5:n+14;case "center":case "middle":return (e+n)/2+4;case "bottom":return n-6;default:return e+14}}function ve(t){let{ranges:e,timeScale:n,yRange:r,height:i,metrics:o=O}=t,[s,a]=r,m=[],[l,u]=n.range(),h=Math.min(l,u),c=Math.max(l,u),p=d=>Math.max(h,Math.min(c,d));for(let d of e){let g=p(n.map(d.startTime)),f=p(n.map(d.endTime));if(d.fill!==void 0&&m.push({type:"rect",x:g,y:s,w:f-g,h:a-s,fill:d.fill,hatch:d.hatch,opacity:d.opacity}),d.edges)for(let y of [g,f])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",b=d.rotate,S=true;if(b==="auto"){let w=y!=="above"&&y!=="below",k=o(d.label,d.fontSize??11);b=w&&k>Math.abs(f-g)-4?-90:void 0,S=b===void 0||k<=Math.abs(a-s)-4;}S&&m.push({type:"text",content:d.label,x:(g+f)/2,y:Dt(y,s,a,i),anchor:"middle",fontSize:d.fontSize,fill:d.labelColor,rotate:b});}}return m}function Qe(t){let{gaps:e,timeScale:n,yRange:r,height:i,fill:o=x.gapFill,hatch:s,fillOpacity:a=x.gapFillOpacity??.15,stroke:m=x.gapStroke,strokeWidth:l=x.gapStrokeWidth,dashed:u=true,fontSize:h=x.gapFontSize,fontFill:c=x.gapFontColor,labelBaseline:p="middle",labelRotate:d,metrics:g,band:f}=t,y=()=>{if(!f)return [];let b=f.height??6,[S,w]=r,k=Math.max(S,w);return e.map(_=>{let P=n.map(_.startTime),L=n.map(_.endTime);return {type:"rect",x:Math.min(P,L),y:k-b+(f.offset??0),w:Math.abs(L-P),h:b,fill:f.fill??m,opacity:f.opacity??.75}})};return ve({timeScale:n,yRange:r,height:i,metrics:g,ranges:e.map(b=>{let S=b.style??"dashed_border",w=S==="filled"||S==="dashed_border",k=S==="dashed_border"&&u!==false;return {startTime:b.startTime,endTime:b.endTime,...w&&{fill:b.fill??o,hatch:b.hatch??s,opacity:b.fillOpacity??a},...k&&{edges:{stroke:m,strokeWidth:l}},label:b.label,labelPosition:b.labelBaseline??p,labelColor:c,fontSize:h,rotate:b.rotate??d}})}).concat(y())}function $t(t){let{gap:e,runs:n,timeScale:r,valueScale:i,metrics:o,lineColor:s}=t,a=[],m=e.bridge,l=[];for(let u=1;u<n.length;u++){let h=n[u-1][n[u-1].length-1],c=n[u][0];if(e.display==="bridge_line"){if(h.value===null||c.value===null)continue;a.push({type:"line",x1:r.map(h.time),y1:i.map(h.value),x2:r.map(c.time),y2:i.map(c.value),stroke:m?.color??s??x.stroke,strokeWidth:m?.width??1.5,dash:m?.style??"dotted"});}else l.push({startTime:h.time,endTime:c.time});}if(l.length>0){let u=e.display&&e.display!=="bridge_line"?e.display:"dashed_border",h=e.fill,c=typeof h=="string"?h:h?.color,p=i.range();a.push(...Qe({gaps:l.map(d=>({...d,style:u})),timeScale:r,yRange:[Math.min(p[0],p[1]),Math.max(p[0],p[1])],fill:c,hatch:typeof h=="object"?h.hatch:void 0,fillOpacity:e.opacity??.15,labelBaseline:e.label?.baseline,labelRotate:e.label?.rotate,metrics:o,band:e.band}));}return a}var Pt={display:"dashed_border",fill:{color:"#94a3b8",hatch:"classic-diagonal"},opacity:.5,label:{rotate:"auto"}},Rt=6e4,_r=60*Rt,Ar=24*_r;function Mr(t){let e=Math.floor(t/Rt);if(e<60)return `${e} min`;if(t<Ar){let i=Math.floor(e/60),o=e%60;return o===0?`${i} h`:`${i} h ${o} min`}let n=Math.floor(e/1440),r=Math.floor(e%1440/60);return r===0?`${n} d`:`${n} d ${r} h`}function Cr(t,e,n){let r=t.format(e,{hour:"2-digit",minute:"2-digit"}),i=o=>t.format(o,{year:"numeric",month:"2-digit",day:"2-digit"});return i(e)===i(n)?r:`${t.format(e,{day:"numeric",month:"short"})} ${r}`}function Lr(t,e,n){let r=null;for(let i of t)i.value===null||i.time<e||i.time>n||(r===null||i.time>r)&&(r=i.time);return r}function Bt(t){let{atEnd:e,series:n,timeScale:r}=t,[i,o]=r.domain(),s=e.now??o,a=new Set;for(let l of n){if(!("data"in l)||l.data.length===0||!("value"in l.data[0]))continue;let u="gaps"in l?l.gaps?.atEnd:void 0;if(u===false||"holdToEnd"in l&&l.holdToEnd)continue;let h=u?.afterMs??e.afterMs,c=Lr(l.data,i,s);c!==null&&s-c>h&&a.add(c);}let m={...Pt,...e.style,label:{...Pt.label,...e.style?.label}};return [...a].sort((l,u)=>l-u).map(l=>{let u=s-l,h=e.label,c=typeof h=="function"?h(l,u):h?.replaceAll("{since}",Cr(r,l,s)).replaceAll("{duration}",Mr(u));return {startTime:l,endTime:s,label:c,style:m}})}var jt=1,Et="#6b728044";function Gt(t){return t.items.find(e=>e.fill)?.fill??t.background??Et}var Ft=4;function Dr(t,e="last"){let n=[...t].sort((o,s)=>o.time-s.time||o.index-s.index),r=[],i=o=>r.every(s=>o.right+Ft<=s.left||s.right+Ft<=o.left);n.length>0&&r.push(e==="first"?n[0]:n[n.length-1]);for(let o of n)o!==r[0]&&i(o)&&r.push(o);return new Set(r.map(o=>o.index))}function $r(t){let e=typeof t=="object"&&t!==null?t.mode:t,n=typeof t=="object"&&t!==null&&t.keep==="first"?"first":"last";return {fit:e==="fit",keep:n}}var ke=class{#e;constructor(e,n,r,i){this.#e={...e,xRange:n,y:r,height:i};}render(){let{items:e,timeScale:n,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});let u=this.#n();if(e.forEach((h,c)=>{let p=this.#t(h);if(!p)return;let{startX:d,w:g}=p,f=d+g/2;if(l.push({type:"rect",x:d,y:a,w:g,h:m,hatch:h.hatch??i,fill:h.fill??Et,stroke:h.stroke,strokeWidth:h.strokeWidth??0,title:h.title}),h.label&&(!u||u.has(c))){let y=h.labelFontSize??10;l.push({type:"text",content:h.label,x:f,y:this.#r(h.labelBaseline,y),anchor:"middle",fontSize:y,fill:h.labelFill??"#333"});}}),o){let h=new ie({domain:n.domain(),xRange:s,y:a+m+4});l.push({type:"group",cssClass:"annotation-band-axis",commands:h.render()});}return l}#t(e){let{timeScale:n,xRange:r,minItemWidth:i=0}=this.#e,o=n.map(e.startTime),s=n.map(e.endTime);if(s<r[0]||o>r[1])return null;let a=Math.max(r[0],Math.min(r[1],o)),m=Math.max(r[0],Math.min(r[1],s)),l=Math.max(m-a,jt);return i>jt&&m-a<i&&(a=(a+m)/2-i/2,l=i),a=Math.max(r[0],a),a+l>r[1]&&(a=Math.max(r[0],r[1]-l)),{startX:a,w:l}}#n(){let{fit:e,keep:n}=$r(this.#e.labels);if(!e)return null;let r=this.#e.metrics??O,i=[];return this.#e.items.forEach((o,s)=>{let a=o.label?this.#t(o):null;if(!a||!o.label)return;let m=a.startX+a.w/2,l=r(o.label,o.labelFontSize??10)/2;i.push({index:s,time:o.startTime,left:m-l,right:m+l});}),Dr(i,n)}#r(e,n){let{y:r,height:i}=this.#e;switch(e){case "top":return r+n*.9;case "bottom":return r+i-n*.25;default:return r+i/2+n*.35}}};function It(t){let{highlights:e,timeScale:n,yRange:r,height:i}=t;return ve({metrics:t.metrics,timeScale:n,yRange:r,height:i,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??x.highlightColor,opacity:o.opacity??x.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??x.highlightLabelColor,fontSize:x.annotationFontSize,rotate:o.rotate}))})}var Ot=t=>t==="chartTop"||t==="chartBottom"||typeof t=="object"&&("threshold"in t||"value"in t);function Wt(t,e){let n=new Set(e.map(o=>o.id??o.name)),r=o=>t.some(s=>(s.id??s.name)===o||s.name===o),i=[];return t.forEach((o,s)=>{let a="colorByThresholds"in o?o.colorByThresholds:void 0;for(let u of a??[])n.has(u)||i.push(`series ${s} colorByThresholds names unknown threshold "${u}"`);let m=o.style?.fill;(m&&typeof m=="object"&&"regions"in m?m.regions??[]:[]).forEach((u,h)=>{let c=`series ${s} fill region ${h}`;for(let f of [u.from,u.to,u.outer])f&&typeof f=="object"&&"threshold"in f&&!n.has(f.threshold)&&i.push(`${c} references unknown threshold "${f.threshold}"`),f&&typeof f=="object"&&"series"in f&&!r(f.series)&&i.push(`${c} references unknown series "${f.series}"`);let p=u.from??"chartBottom",d=u.to??"series",g=p==="series"&&Ot(d)||d==="series"&&Ot(p);u.side&&!g&&i.push(`${c} sets side, which only applies between the line and a fixed bound`),u.outer&&!u.side&&i.push(`${c} sets outer without side -- outer has no effect`);});}),i}function zt(t){return [...jr(t.series.map(e=>e.id??e.name)),...Pr(t.series,t.linienGrundlage),...Rr(t.gaps.map(e=>e.style)),...Br(t.series.map(e=>!z(e)&&!!e.style?.gap?.label)),...Fr(t.series.map(e=>"sensorType"in e?e.sensorType:void 0)),...Wt(t.series,t.thresholds)]}function Pr(t,e){let n=[],r=i=>t.find(o=>(o.id??o.name)===i||o.name===i);return t.forEach((i,o)=>{if(z(i))return;let s=i.style?.fill,a=s&&typeof s=="object"&&"regions"in s?s.regions:[],m=new Set;for(let l of a)if(l.where)for(let u of [l.from??"chartBottom",l.to??"series"]){let h=u==="series"?i:typeof u=="object"&&"series"in u?r(u.series):void 0;if(!h||z(h))continue;let{grundLinie:c,stepShape:p}=e(h),d=c?.smoothingType??"catmull-rom";p||!c?.smoothing||d==="monotone"||m.has(h.name)||(m.add(h.name),n.push(`series ${o}: fill where decides on the readings, but "${h.name}" is smoothed with ${d}, which can overshoot them -- the area may miss the line at its edges; smoothingType 'monotone' does not overshoot`));}}),n}function Rr(t){let e=t.flatMap((n,r)=>n==="label"?[String(r)]:[]);return e.length?[`gap ${e.join(", ")} uses style "label" -- removed, drawn like "empty"; use style "empty" with a label`]:[]}function Br(t){let e=t.flatMap((n,r)=>n?[String(r)]:[]);return e.length?[`series ${e.join(", ")} set style.gap.label -- deprecated, removed before 2.0; set the label style on gaps.style.label`]:[]}function jr(t){let e=new Map;return t.forEach((n,r)=>{e.set(n,[...e.get(n)??[],r]);}),[...e].filter(([,n])=>n.length>1).map(([n,r])=>`series ${r.join(", ")} share the id "${n}" -- hidden and pointsAt cannot tell them apart; give each a unique id`)}function Fr(t){let e=t.flatMap((n,r)=>n&&n!=="numeric"?[String(r)]:[]);return e.length?[`series ${e.join(", ")} set sensorType -- deprecated, removed before 2.0; it has no effect on the chart, use enumMap for state series`]:[]}var Te=class{};var I=class{static interpolateDataPoint(t,e,n){return {time:t.time+Math.round(n*(e.time-t.time)),value:(t.value??0)+n*((e.value??0)-(t.value??0)),synthetic:true}}static interpolateAggregatedPoint(t,e,n){let r=(i,o)=>i!==null&&o!==null?i+n*(o-i):null;return {time:t.time+n*(e.time-t.time),min:r(t.min,e.min),max:r(t.max,e.max),avg:r(t.avg,e.avg),count:Math.round(t.count+n*(e.count-t.count))}}static getRuns(t,e,n=0){let r=[...t].sort((a,m)=>a.time-m.time),i=[],o=[],s=null;for(let a of r){let m=e(a),l=n>0&&s&&a.time-s.time>n;(m||l)&&o.length&&(i.push(o),o=[]),m||o.push(a),s=a;}return o.length&&i.push(o),i}static splitByBoundaries(t,e,n,r){if(t.length===0)return [];if(e.length===0)return [{data:t,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let i=[...e].sort((l,u)=>l-u),o=[],s=l=>l<=0?Number.NEGATIVE_INFINITY:i[l-1],a=l=>{let u=0;for(let h=0;h<i.length&&l>=i[h];h++)u=h+1;return u},m=[t[0]];for(let l=1;l<t.length;l++){let u=t[l-1],h=t[l],c=n(u),p=n(h),d;p>c?d=i.filter(f=>f>c&&f<=p):p<c?d=i.filter(f=>f>=p&&f<c).reverse():d=[];let g=c;for(let f of d){let y=(f-c)/(p-c),b=r(u,h,y);m.push(b);let S=a((g+f)/2);o.push({data:m,zoneIndex:S,zoneLow:s(S)}),m=[b],g=f;}(d.length===0||d[d.length-1]!==p)&&m.push(h);}if(m.length>1||t.length===1){let l=n(m[0]),u=n(m[m.length-1]),h=a((l+u)/2);o.push({data:m,zoneIndex:h,zoneLow:s(h)});}return o}static splitByThreshold(t,e,n,r){let i=this.splitByBoundaries(t,[e],n,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 Vt(t,e=6e4){if(t.length<2)return [];let n=[...t].sort((i,o)=>i.time-o.time),r=[];for(let i=1;i<n.length;i++)n[i].time-n[i-1].time>e&&r.push({startTime:n[i-1].time,endTime:n[i].time});return r}function Nt(t,e,n){let r=new Array(t.length),i=0;for(let o=0;o<t.length;o++){let s=t[o].time,a=s-e;for(;i<o&&t[i].time<a;)i++;let m=t.slice(i,o+1).map(l=>l.value);r[o]={time:s,value:n(m),synthetic:true};}return r}var Er=8.314,Ht=273.15,Kt=83144;function Gr(t,e=Kt){let n=e/Er,r=0,i=0;for(let s of t)s!==null&&(r+=Math.exp(-n/(s+Ht)),i++);if(i===0)return null;let o=r/i;return n/-Math.log(o)-Ht}function Yt(t,e,n=Kt){return Nt(t,e,r=>Gr(r,n))}function Ir(t){let e=0,n=0;for(let o of t)o!==null&&(e+=o,n++);if(n===0)return null;let r=e/n,i=0;for(let o of t){if(o===null)continue;let s=o-r;i+=s*s;}return Math.sqrt(i/n)}function Or(t){let e=0,n=0;for(let o of t)o!==null&&(e+=o,n++);if(n<2)return null;let r=e/n,i=0;for(let o of t){if(o===null)continue;let s=o-r;i+=s*s;}return Math.sqrt(i/(n-1))}function Xt(t,e,n=false){return Nt(t,e,n?Or:Ir)}function et(t,e){let n=new Array(t.length),r=0;for(let i=0;i<t.length;i++){let o=t[i].time,s=o-e;for(;r<i&&t[r].time<s;)r++;let a=0,m=0;for(let l=r;l<=i;l++){let u=t[l].value;u!==null&&(a+=u,m++);}n[i]={time:o,value:m===0?null:a/m,synthetic:true};}return n}function Zt(t,e){let n=new Array(t.length),r=null,i=0;for(let o=0;o<t.length;o++){let s=t[o].time,a=t[o].value;if(a===null){n[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,n[o]={time:s,value:r,synthetic:true};}return n}function X(t){let e=[];for(let n of t)e.length>0&&e.push({...n,value:e[e.length-1].value}),e.push(n);return e}function Ut(t,e,n){let r=[],i=_e(n);for(let o=0;o<t.length;o++){let s=t[o];s.data.length>=2?r.push({type:"path",cssClass:"series-line",id:n.id?`${n.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:n.id?`${n.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 qt(t,e,n,r){if(t.length<2)return [];let i=I.splitByBoundaries(t,n.boundaries,n.getValue,n.interpolate),o=[];for(let s=0;s<i.length;s++){let a=i[s];if(a.data.length<2)continue;let m=n.getColor(a.zoneIndex);if(!m)continue;let l=a.data.map(h=>({x:e.timeScale.map(h.time),y:e.valueScale.map(n.yLow(h))})),u=a.data.map(h=>({x:e.timeScale.map(h.time),y:e.valueScale.map(n.yHigh(h))})).reverse();o.push({type:"path",cssClass:"series-fill",id:r?.id?`${r.id}-fill-${s}`:void 0,points:[...l,...u],fill:m,hatch:n.getHatch?.(a.zoneIndex),stroke:"none",...r?.smoothing?{smoothing:true,smoothingType:r.smoothingType,smoothCount:a.data.length,smoothTail:a.data.length}:{}});}return o}var Ae=class t{#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,n){let r=new t;return n(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 Wr="#ffffff",zr="#cccccc",Hr=6,Vr=.85,W=12,Ce=8,ce=20,Nr=11,Me=18,tt=(t,e)=>e(t,Nr);function Jt(t,e,n){let r=a=>W+Ce+tt(a.name,e);if(n===void 0){let a=t.reduce((m,l)=>m+r(l)+Me,0)-Me;return [{items:t,breite:Math.max(0,a)}]}let i=[],o=[],s=0;for(let a of t){let m=r(a),l=o.length===0?m:s+Me+m;o.length>0&&l>n?(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 Qt(t,e="vertical",n=O,r){if(e==="horizontal"){let o=Jt(t,n,r);return {width:o.reduce((s,a)=>Math.max(s,a.breite),0),height:o.length*ce}}let i=0;for(let o of t)i=Math.max(i,tt(o.name,n));return {width:W+Ce+i,height:t.length*ce}}function Kr(t){let{items:e,x:n,y:r,orientation:i="vertical",metrics:o=O,maxBreite:s,box:a,itemClass:m}=t,l=new Ae;if(a&&e.length>0){let p=Qt(e,i,o,s),g=((i==="horizontal"?p.height/ce:e.length)-1)*ce+W,f=a.padding??Hr,y=a.stroke??zr;l.rect({x:n-f,y:r-f,w:p.width+2*f,h:g+2*f,fill:a.fill??Wr,...y==="none"?{}:{stroke:y,strokeWidth:a.strokeWidth??1},opacity:a.opacity??Vr});}let u=i==="horizontal"?Jt(e,o,s):e.map(p=>({items:[p],breite:0})),h=new Map;u.forEach((p,d)=>{let g=n;for(let f of p.items)h.set(f,{x:g,y:r+d*ce}),g+=W+Ce+tt(f.name,o)+Me;});let c=e.some(p=>p.line!==void 0&&p.line!=="solid"&&p.line!=="none");return e.forEach(p=>{let d=h.get(p)??{x:n,y:r},g=d.x,f=d.y,y=["legend-item"];p.id&&y.push(`legend-item--${p.id}`),m&&y.push(m),l.group({cssClass:y.join(" "),...p.id?{id:`legend-${p.id}`}:{}},b=>{Xr(b,p,g,f,c),b.text({content:p.name,x:g+W+Ce,y:f+W-2,fontSize:x.legendFont,fill:x.legendText});});}),l.toGroup({cssClass:"chart-legend"})}function en(t){let{legend:e,items:n,gesamtbreite:r,metrics:i}=t,o=(e?.show??false)&&n.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:n,show:o,position:s,orientation:a,maxBreite:m,size:o?Qt(n,a,i,m):{width:0,height:0},boxRand:o&&e?.box?e.box.padding??6:0,box:e?.box,itemClass:e?.itemClass}}function tn(t,e){let n=t.position==="outside-right"||t.position==="outside-left"||t.position==="above"||t.position==="below";if(!t.show||!n)return null;let r={...e},i=2*t.boxRand;return t.position==="outside-right"?r.right+=t.size.width+i+16:t.position==="outside-left"?r.left+=t.size.width+i+16:t.position==="above"?r.top+=t.size.height+i+10:r.bottom+=t.size.height+i+10,r}function nn(t){let{legende:e,layout:n,randBelegt:r,metrics:i}=t;if(!e.show||e.position==="separate")return [];let{chartX:o,chartY:s,chartWidth:a}=n,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 u=r.filter(h=>h.position==="right").reduce((h,c)=>Math.max(h,c.bis),o+a);m=Math.min(Math.max(o+a+16,u+12),n.totalWidth-e.size.width-2),l=s;}else e.position==="above"||e.position==="below"?(m=Math.max(8,Math.min(n.totalWidth-e.size.width-8,o+(a-e.size.width)/2)),l=e.position==="above"?Math.max(4,s-e.size.height-10):n.totalHeight-e.size.height-4):(m=8,l=s);return [Kr({items:e.items,x:m,y:l,orientation:e.orientation,metrics:i,maxBreite:e.maxBreite,box:e.box,itemClass:e.itemClass})]}function Yr(t){return Math.min(Math.max(t??2,1.5),3)}function Xr(t,e,n,r,i){let o=e.colors&&e.colors.length>=2?e.colors:[e.color],s=W/o.length;if(i){o.forEach((a,m)=>{let l=n+m*s;t.line({x1:l,y1:r+W/2,x2:l+s,y2:r+W/2,stroke:a,strokeWidth:Yr(e.width),...e.line&&e.line!=="solid"?{dash:e.line}:{}});});return}if(o.length===1){t.rect({x:n,y:r,w:W,h:W,fill:o[0],stroke:x.legendStroke,strokeWidth:1});return}o.forEach((a,m)=>{t.rect({x:n+m*s,y:r,w:s,h:W,fill:a});}),t.rect({x:n,y:r,w:W,h:W,fill:"none",stroke:x.legendStroke,strokeWidth:1});}function rn(t){let{xTicks:e,yTicks:n,xRange:r,yRange:i,stroke:o=x.gridStroke,strokeWidth:s=x.gridStrokeWidth,dashed:a=false,opacity:m=x.gridOpacity}=t,l=[];if(n)for(let u of n)l.push({type:"line",x1:r[0],y1:u,x2:r[1],y2:u,stroke:o,strokeWidth:s,dashed:a,opacity:m});if(e)for(let u of e)l.push({type:"line",x1:u,y1:i[0],x2:u,y2:i[1],stroke:o,strokeWidth:s,dashed:a,opacity:m});return l}function on(t){let{axes:e,timeAxis:n,primaryValueAxis:r,xRange:i,yRange:o}=t,s=Z(e?.x?.grid),a=Z(e?.left?.grid),m=s?.layer??a?.layer??"front",l=s?.major,u=a?.major,h=k=>k!==void 0&&k!==false;if(!h(l)&&!h(u))return {group:null,layer:m};let c=l!==false,p=u!==false&&!!r,d=c?n.generateTicks().map(k=>k.x):void 0,g=p?r.generateTicks().map(k=>k.position):void 0;if(!d&&!g)return {group:null,layer:m};let f=(l&&typeof l=="object"?l:void 0)??(u&&typeof u=="object"?u:void 0),y=s?.minor,b=a?.minor,S=(y&&typeof y=="object"?y:void 0)??(b&&typeof b=="object"?b:void 0);return {group:{type:"group",cssClass:"chart-grid",sharedStyles:true,commands:[...y!==void 0||b!==void 0?rn({xTicks:y!==false&&c?n.generateMinorTicks():void 0,yTicks:b!==false&&p?r.generateMinorTicks():void 0,xRange:i,yRange:o,stroke:S?.color,opacity:S?.opacity??(x.gridOpacity??1)*.5,dashed:S?.style==="dashed"}):[],...rn({xTicks:d,yTicks:g,xRange:i,yRange:o,stroke:f?.color,opacity:f?.opacity,dashed:f?.style==="dashed"})]},layer:m}}function sn(t){let e=[],n=r=>{r.type==="group"?r.commands.forEach(n):r.type==="line"&&r.y1===r.y2&&r.x1!==r.x2&&e.push(r.y1);};return t.forEach(n),e}function an(t,e){if(e.length===0||t.type!=="group")return t;let n=r=>r.type==="line"&&r.y1===r.y2&&r.x1!==r.x2&&e.some(i=>Math.abs(i-r.y1)<.5);return {...t,commands:t.commands.filter(r=>!n(r))}}function nt(t,e,n){let r=(o,[s,a])=>o>=Math.min(s,a)&&o<=Math.max(s,a);if(!r(t.time,e.domain()))return false;if(t.value===void 0||!n)return true;let i=n.get(t.axis??0)??n.values().next().value;return !i||r(t.value,i.domain())}function ln(t){let{annotations:e,timeScale:n,valueScales:r,plot:i}=t,o=[],s=m=>!i||nt(m,n,r),a=m=>{let l=r.get(m.axis??0)??r.values().next().value;return {x:n.map(m.time),y:l?l.map(m.value):0}};for(let m of e){let l=[],u=p=>l.push(p);if((m.type==="point"||m.type==="label")&&!s(m.at))continue;let h=i!==void 0&&(m.type==="line"||m.type==="arrow"||m.type==="rect")&&!(s(m.from)&&s(m.to)),c=h?{clipRect:i}:{};switch(m.type){case "line":{let p=a(m.from),d=a(m.to);u({type:"line",x1:p.x,y1:p.y,x2:d.x,y2:d.y,stroke:m.color??x.annotationColor,strokeWidth:m.width??x.annotationWidth,dash:m.dash});break}case "arrow":{let p=a(m.from),d=a(m.to),g=m.color??x.annotationColor,f=m.headSize??x.annotationHead;u({type:"line",x1:p.x,y1:p.y,x2:d.x,y2:d.y,stroke:g,strokeWidth:m.width??x.annotationWidth});let y=Math.hypot(d.x-p.x,d.y-p.y)||1,b=(d.x-p.x)/y,S=(d.y-p.y)/y,w=d.x-b*f,k=d.y-S*f;u({type:"path",points:[{x:d.x,y:d.y},{x:w-S*f*.5,y:k+b*f*.5},{x:w+S*f*.5,y:k-b*f*.5}],fill:g,stroke:"none"});break}case "rect":{let p=a(m.from),d=a(m.to);u({type:"rect",x:Math.min(p.x,d.x),y:Math.min(p.y,d.y),w:Math.abs(d.x-p.x),h:Math.abs(d.y-p.y),fill:m.fill??"none",hatch:m.hatch,stroke:m.stroke,opacity:m.opacity});break}case "point":{let p=a(m.at),d=m.color??"#334155",g=m.radius??x.annotationRadius,f=m.shape??"circle";f==="circle"?u({type:"circle",cx:p.x,cy:p.y,r:g,fill:d}):f==="square"?u({type:"rect",x:p.x-g,y:p.y-g,w:g*2,h:g*2,fill:d}):(u({type:"line",x1:p.x-g,y1:p.y-g,x2:p.x+g,y2:p.y+g,stroke:d,strokeWidth:1.5}),u({type:"line",x1:p.x-g,y1:p.y+g,x2:p.x+g,y2:p.y-g,stroke:d,strokeWidth:1.5}));break}case "label":{let p=a(m.at);u({type:"text",content:m.text,x:p.x+(m.dx??0),y:p.y+(m.dy??0),anchor:m.anchor??Zr(p.x+(m.dx??0),m.text,t),fontSize:x.annotationFontSize,fill:m.color??x.annotationColor,rotate:m.rotate});break}}if(m.id&&l.length>0){let p=N(m.id);o.push({type:"group",cssClass:`annotation annotation--${p}`,...c,commands:l});}else h&&l.length>0?o.push({type:"group",cssClass:"annotation",...c,commands:l}):o.push(...l);}return o}function Zr(t,e,n){let{metrics:r,timeScale:i}=n;if(!r)return "middle";let[o,s]=i.range(),a=r(e,x.annotationFontSize)/2;return t-a<o?"start":t+a>s?"end":"middle"}var se=class t{#e;#t;static uidcnt=0;#n;constructor(e,n=[]){this.#e=e.id??"series-"+ ++t.uidcnt,this.#t=e.timeScale,this.#n=n;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var Le=class extends se{#e;constructor(e){super(e,e.data),this.#e=e;}opacity(e){if(!(this.#e.countOpacity??false))return .6;let n=0;for(let r of this.data)r.count>n&&(n=r.count);return n===0?.2:.2+.8*e/n}render(){let e=this.#e,n=e.fill??x.bandFill,r=e.hatch,i=e.avgLine??false,o=e.avgLineColor??x.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),u=e.valueScale.map(m.max),h=e.valueScale.map(m.min),c=s,p=this.data.indexOf(m);if(a.push({type:"rect",x:l-c/2,y:u,w:c,h:h-u,fill:n,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}};function mn(t,e,n,r,i,o,s){return qt(t,e,{boundaries:[],yLow:a=>a.avg,yHigh:n,getValue:a=>a.avg,interpolate:I.interpolateAggregatedPoint,getColor:()=>r,getHatch:()=>i},{id:o,...s})}var De=class extends se{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,n=e.minColor??x.minColor,r=e.maxColor??x.maxColor,i=e.avgColor??x.avgColor,o=e.avgDashed??true,s=e.smoothing??false,a=e.smoothingType,m=e.strokeWidth??x.strokeWidth,l=I.getRuns(this.data,d=>d.min===null||d.max===null||d.avg===null);if(l.length===0)return [];let u={timeScale:this.timeScale,valueScale:e.valueScale},h=[];l.forEach((d,g)=>{if(d.length<2)return;let f=y=>this.id?`${this.id}-${y}-${g}`:void 0;if(e.fillToMax){let y=mn(d,u,b=>b.max,e.fillToMax,e.fillToMaxHatch,f("fillToMax"),{smoothing:s,smoothingType:a});h.push(...y);}if(e.fillToMin){let y=mn(d,u,b=>b.min,e.fillToMin,e.fillToMinHatch,f("fillToMin"),{smoothing:s,smoothingType:a});h.push(...y);}});let c=l.filter(d=>d.length>=2),p=(d,g,f,y=false)=>Ut(c.map(b=>({data:b.map(S=>({time:S.time,value:d(S)}))})),u,{stroke:g,strokeWidth:m,smoothing:s,smoothingType:a,dashed:y,id:this.id?`${this.id}-${f}`:void 0});return h.push(...p(d=>d.max,r,"max"),...p(d=>d.min,n,"min"),...p(d=>d.avg,i,"avg",o)),h}};function _e(t){return {id:t.id,line:{stroke:t.stroke??x.stroke,strokeWidth:t.strokeWidth??x.strokeWidth,smoothing:t.smoothing??false,smoothingType:t.smoothingType,dashed:t.dashed??false},fill:t.fill??x.areaFillAlpha,markers:{type:t.pointStyle??"none",size:t.pointSize??x.pointSize,stroke:t.stroke??x.stroke,fill:"#ffffff"},shadow:{color:t.shadowColor??"transparent",blur:t.shadowBlur??0,offsetX:t.shadowOffsetX??0,offsetY:t.shadowOffsetY??0}}}function un(t,e,n,r){let i=_e(n);if(!i.markers.type||i.markers.type==="none")return [];let o=[];for(let s=0;s<t.length;s++){let a=t[s],m=e.timeScale.map(a.time),l=e.valueScale.map(a.value),u=r(a),h=n.pointStroke??u,c=n.pointFill??u,p=n.pointStrokeWidth??1.5,d=n.id?`${n.id}-marker-${s}`:void 0;$e(o,d,i.markers.type,m,l,i.markers.size,h,c,p);}return o.length===0?[]:[{type:"group",cssClass:"series-markers",sharedStyles:true,commands:o}]}function $e(t,e,n,r,i,o,s,a,m){let l=u=>e===void 0?void 0:`${e}-${u}`;switch(n){case "circle":t.push({type:"circle",cx:r,cy:i,r:o,fill:a,stroke:s,strokeWidth:m,id:e});break;case "square":t.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":t.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":t.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":t.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 u=[];for(let h=0;h<10;h++){let c=h%2===0?o:o*.5,p=Math.PI/2*3+h*Math.PI/5;u.push({x:r+c*Math.cos(p),y:i+c*Math.sin(p)});}t.push({type:"path",points:u,closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break}case "arrow":t.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":t.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":t.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 u=[];for(let h=0;h<6;h++){let c=h*(Math.PI/3);u.push({x:r+o*Math.cos(c),y:i+o*Math.sin(c)});}t.push({type:"path",points:u,closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break}case "hourglass":t.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":t.push({type:"line",x1:r-o,y1:i,x2:r+o,y2:i,stroke:s,strokeWidth:m,id:e});break;default:t.push({type:"circle",cx:r,cy:i,r:o,fill:a,stroke:s,strokeWidth:m,id:e});}}function hn(t){let{markers:e,timeScale:n,valueScale:r,yRange:i=[0,300]}=t,[o,s]=i,a=[];for(let m of e){let l=n.map(m.time),u=m.color??x.markerColor,h=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:u,strokeWidth:1,dashed:true}):c==="to-top"?a.push({type:"line",x1:l,y1:o,x2:l,y2:p,stroke:u,strokeWidth:1,dashed:true}):c==="full"&&a.push({type:"line",x1:l,y1:o,x2:l,y2:s,stroke:u,strokeWidth:1}),h!=="none"&&$e(a,void 0,h,l,p,x.markerSize,u,u,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:x.markerFontSize,fill:u});}}else c!=="none"&&a.push({type:"line",x1:l,y1:o,x2:l,y2:s,stroke:u,strokeWidth:1}),m.label&&a.push({type:"text",content:m.label,x:l,y:o-6,anchor:"middle",fontSize:x.markerFontSize,fill:u});}return a}function cn(t){let e=[],n=t.markers.filter(i=>nt({time:i.time},t.timeScale)).map(i=>({...i}));for(let i of n)if(i.value===void 0&&(i.lineStyle==="to-value"||i.lineStyle==="to-top")){let o=t.series[i.seriesIndex??0];o&&!z(o)&&o.data.length>=2&&(i.value=Ur(i.time,o.data));}if(n.length>0&&t.primaryScale){let i=[];for(let o of n){let s=t.primaryScale,a=t.series[o.seriesIndex??0];a&&(s=t.valueScales.get(t.achseVon(a))??t.primaryScale),i.push(...hn({markers:[o],timeScale:t.timeScale,valueScale:s,yRange:t.yRange}));}e.push({type:"group",cssClass:"markers",commands:i});}let r=t.annotations;return r.length>0&&e.push({type:"group",cssClass:"annotations",commands:ln({annotations:r,timeScale:t.timeScale,valueScales:t.valueScales,metrics:t.metrics,plot:t.plot})}),e}function Ur(t,e){for(let n=1;n<e.length;n++){let r=e[n-1],i=e[n];if(!(r.value===null||i.value===null)&&t>=r.time&&t<=i.time){if(i.time===r.time)return r.value;let o=(t-r.time)/(i.time-r.time);return r.value+o*(i.value-r.value)}}}var qr=(()=>{let t=new Array(256);for(let e=0;e<256;e++){let n=e;for(let r=0;r<8;r++)n=n&1?3988292384^n>>>1:n>>>1;t[e]=n>>>0;}return t})();function rt(t){let e=new TextEncoder().encode(t),n=4294967295;for(let r of e)n=qr[(n^r)&255]^n>>>8;return (n^4294967295)>>>0}function K(t,e){return e||"s-"+rt(t??"").toString(16).padStart(8,"0")}function dn(t,e,n){let r=t.style?.line&&!Array.isArray(t.style.line)?t.style.line:void 0,i=typeof t.style?.fill=="string"?t.style.fill:void 0;return t.showAs==="minmaxavg"?new De({data:t.data,timeScale:e,valueScale:n,minColor:t.minColor,maxColor:t.maxColor,avgColor:t.avgColor,avgDashed:t.avgDashed,fillToMax:t.fillToMax,fillToMaxHatch:t.fillToMaxHatch,fillToMin:t.fillToMin,fillToMinHatch:t.fillToMinHatch,smoothing:r?.smoothing,smoothingType:r?.smoothingType,strokeWidth:r?.width,id:K(t.name,t.id)}).render():new Le({data:t.data,timeScale:e,valueScale:n,fill:i??r?.color,avgLine:t.avgLine,countOpacity:t.countOpacity,id:K(t.name,t.id)}).render()}function pn(t,e,n){let r=t??[];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??n,m=Number.NEGATIVE_INFINITY;for(let l of r){let u=e.get(l);!u||o<u.value||u.value<m||(m=u.value,a=u.color??a);}return a}}}function fn(t,e,n){if(!t.holdToEnd)return;let r=t.data.at(-1);if(!r||r.value===null)return;let i=n??e.domain()[1],o=typeof t.holdToEnd=="object"?t.holdToEnd.maxAgeMs:void 0;return o!==void 0&&(i=Math.min(i,r.time+o)),i>r.time?i:void 0}function Pe(t,e){if(e===void 0||t.length===0)return t;let n=t[t.length-1],r=n[n.length-1];return [...t.slice(0,-1),[...n,{time:e,value:r.value}]]}function gn(t){let{series:e,ctx:n,runs:r,haltBis:i,totalPoints:o,style:s,styleLine:a,styleMarkers:m,stepShape:l,thresholds:u}=t,{timeScale:h,valueScale:c}=n,p=[],d=pn(e.colorByThresholds,u,s.stroke),g=d.grenzen,f=new Map,y=[];for(let S of r){let _=function(v){let C=S===r[r.length-1]?Pe([S],i)[0]:S;return I.splitByBoundaries(v==="step"?X(C):C,g,$=>$.value,I.interpolateDataPoint)};if(S.length<1)continue;let w=K(e.name,e.id),k=new Map,P=v=>{let C=k.get(v);return C||(C=_(v),k.set(v,C)),C},L=(v,C,$)=>{if(C.width===0||C.style==="none")return;let B=P(v);for(let F of B){let j=F,E=f.get($)??0;if(f.set($,E+1),j.data.length<1)continue;let Y=j.zoneLow;if(j.data.length===1){let A=d.farbe(Y,C.color);p.push({type:"circle",id:w?`${w}-dot-${E}${$}`:void 0,cx:h.map(j.data[0].time),cy:c.map(j.data[0].value),r:Math.max(s.pointSize??x.pointSize,C.width??s.strokeWidth??x.strokeWidth),fill:A,shadowColor:s.shadowColor,shadowBlur:s.shadowBlur});continue}p.push({type:"path",cssClass:"series-line",id:w?`${w}-line-${E}${$}`:void 0,points:j.data.map(A=>({x:h.map(A.time),y:c.map(A.value)})),stroke:d.farbe(Y,C.color),strokeWidth:C.width??s.strokeWidth,smoothing:v==="step"?false:C.smoothing??s.smoothing,smoothingType:C.smoothingType??s.smoothingType,dash:C.style,opacity:C.opacity,fill:"none",shadowColor:s.shadowColor,shadowBlur:s.shadowBlur,shadowOffsetX:s.shadowOffsetX,shadowOffsetY:s.shadowOffsetY});}};a===false||(Array.isArray(a)?a.forEach((v,C)=>{L(v.shape??(e.seriesType==="step"?"step":"line"),v,`-${C}`);}):L(l?"step":"line",a??{},"")),y.push(...S);}return s.pointStyle&&s.pointStyle!=="none"&&o<=(m?.threshold??x.pointThreshold)&&p.push(...un(y,n,s,S=>d.farbe(S.value))),p}function bn(t,e){for(let n of t){if(n.length===0||e<n[0].time||e>n[n.length-1].time)continue;let r=0;for(;r<n.length-1&&n[r+1].time<=e;)r++;return {lauf:n,i:r}}return null}function Re(t,e,n){if(t.art==="fest")return t.wert;let r=bn(t.laeufe,e);if(!r)return null;let{lauf:i,i:o}=r,s=i[o];if(t.stufe)return n&&s.time===e&&o>0?i[o-1].value:s.value;if(s.time===e||o===i.length-1)return s.value;let a=i[o+1];return s.value+(a.value-s.value)*(e-s.time)/(a.time-s.time)}function yn(t,e,n){if(t.art==="fest")return true;let r=bn(t.laeufe,e);return r?n===void 0||e-r.lauf[r.i].time<=n:false}function xn(t,e,n){let r=n.exceeds,i=n.side??"both",o=new Set;for(let l of [t,e])if(l.art==="laeufe")for(let u of l.laeufe)for(let h of u)o.add(h.time),n.maxAgeMs!==void 0&&o.add(h.time+n.maxAgeMs);let s=[...o].sort((l,u)=>l-u),a=[];for(let l=0;l+1<s.length;l++){let[u,h]=[s[l],s[l+1]],c=(u+h)/2;if(!yn(t,c,n.maxAgeMs)||!yn(e,c,n.maxAgeMs))continue;let p=Re(e,u,false)-Re(t,u,false),d=Re(e,h,true)-Re(t,h,true),g=(f,y)=>{if(f<=0&&y<=0)return null;if(f>0&&y>0)return [u,h];let b=u+(0-f)/(y-f)*(h-u);return f>0?[u,b]:[b,h]};if(i!=="below"){let f=g(p-r,d-r);f&&f[1]>f[0]&&a.push(f);}if(i!=="above"){let f=g(-p-r,-d-r);f&&f[1]>f[0]&&a.push(f);}}a.sort((l,u)=>l[0]-u[0]);let m=[];for(let l of a){let u=m[m.length-1];u&&l[0]<=u[1]?u[1]=Math.max(u[1],l[1]):m.push([l[0],l[1]]);}return m}function Sn(t,e,n,r,i,o){let s=0,a=m=>m.type==="group"?{...m,commands:m.commands.map(a)}:"id"in m&&m.id!==void 0?{...m,...o(s++)}:m;return e.map(([m,l])=>{let u=n.map(m);return {type:"group",clipRect:{x:u,y:r,w:n.map(l)-u,h:i-r},commands:t.map(a)}})}function q(t){return t!==void 0&&typeof t=="object"&&"series"in t?t.series:null}function wn(t){let e=[...t].sort((r,i)=>r.time-i.time),n=0;return r=>{for(;n>0&&e[n].time>r;)n--;for(;n<e.length-1&&e[n+1].time<=r;)n++;let i=e[n];if(!i||r<i.time)return null;if(i.time===r)return i.value??null;let o=e[n+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 vn(t){let e=[...t].sort((r,i)=>r.time-i.time),n=new Map;for(let r=1;r<e.length;r++){let[i,o]=[e[r-1],e[r]];i.time===o.time&&i.value!==null&&!n.has(i.time)&&n.set(i.time,i.value);}return n}function kn(t,e,n){let r=t??e;if(r==="series")return null;if(r==="chartTop")return n.chartTop;if(r==="chartBottom")return n.chartBottom;if(typeof r=="object"&&"threshold"in r){let i=n.thresholds.get(r.threshold);if(!i)throw new Error(`fillSpec region references unknown threshold '${r.threshold}'`);return n.valueScale.map(i.value)}return typeof r=="object"&&"value"in r?n.valueScale.map(r.value):null}function Jr(t){return typeof t=="string"?{color:t}:{color:t.color,hatch:t.hatch}}function Tn(t,e){let n=q(t);if(n!==null){let i=e.fremdeSerie?.(n);return i?{art:"laeufe",laeufe:I.getRuns(i.data,o=>o.value===null,i.gapThreshold),stufe:i.shape==="step"}:null}if(t==="series")return {art:"laeufe",laeufe:e.runs,stufe:e.shape==="step"};let r=e.valueScale.domain();return {art:"fest",wert:de(t,e)??(t==="chartBottom"?r[0]:r[1])}}function _n(t,e,n){let r=Qr(t,e,n);if(!t.where||r.length===0)return r;let i=Tn(t.from??"chartBottom",e),o=Tn(t.to??"series",e);return !i||!o?r:Sn(r,xn(i,o,t.where),e.timeScale,e.chartTop,e.chartBottom,s=>e.idPrefix?{id:`${e.idPrefix}-fill-r${n}-${s}`}:{})}function Qr(t,e,n){let r=kn(t.from,"chartBottom",e),i=kn(t.to,"series",e),{color:o,hatch:s}=Jr(t.fill),l={attrs:{type:"path",fill:o,hatch:s,stroke:"none",cssClass:"series-fill"},teilId:u=>e.idPrefix?{id:`${e.idPrefix}-fill-r${n}-${u}`}:{}};return q(t.from)!==null||q(t.to)!==null?ti(t,e,l):r!==null&&i!==null?ni(r,i,e,l):ri(t,e,r,i,l)}function ei(t,e,n){let r=e.shape==="step",i=(c,p)=>{let d=c??p,g=q(d);if(g!==null){let b=e.fremdeSerie(g);if(!b)return null;let S=b.shape==="step",w=I.getRuns(b.data,k=>k.value===null,b.gapThreshold).map(k=>S?X(k):k);return {art:"fremd",skala:b.valueScale??e.valueScale,laeufe:w,glatt:!S&&!!b.smoothing,verfahren:b.smoothingType}}if(d==="series")return {art:"eigene",glatt:!r&&!!e.smoothing,verfahren:e.smoothingType};let f=de(d,e),y=e.valueScale.domain();return {art:"fest",wert:f??(d==="chartBottom"?y[0]:y[1]),glatt:false}},o=i(t.from,"chartBottom"),s=i(t.to,"series");if(!o||!s||!o.glatt&&!s.glatt)return null;let a=c=>c.art==="fremd"?c.skala:e.valueScale,m=c=>p=>({x:e.timeScale.map(p.time),y:c.map(p.value)}),l=(c,p)=>c.art==="eigene"?[p]:c.art==="fremd"?c.laeufe.filter(d=>d.length>=2):[null],u=(c,p,d,g)=>p?p.map(m(a(c))):[d,g].map(f=>({x:e.timeScale.map(f),y:e.valueScale.map(c.wert)})),h=[];for(let c of e.runs){if(c.length<2)continue;let p=r?X(c):c;for(let d of l(o,p))for(let g of l(s,p)){let f=Math.max(p[0].time,d?.[0].time??-1/0,g?.[0].time??-1/0),y=Math.min(p.at(-1).time,d?.at(-1)?.time??1/0,g?.at(-1)?.time??1/0);if(!(y>f))continue;let b={k:o,pts:u(o,d,f,y)},S={k:s,pts:u(s,g,f,y)};b.k.glatt||([b,S]=[S,b]);let w=_=>(_.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(y)-k,h:e.chartBottom-e.chartTop},commands:[{...n.attrs,...n.teilId(h.length),points:[...b.pts,...[...S.pts].reverse()],smoothing:true,smoothingType:w(b.k),smoothCount:b.pts.length,...S.k.glatt?{smoothTail:S.pts.length,smoothTailType:w(S.k)}:{}}]});}}return h}function ti(t,e,n){if(!e.fremdeSerie){let a=q(t.from)??q(t.to);throw new Error(`fillSpec region references series '${a}', but no series lookup was provided`)}let r=ei(t,e,n);if(r)return r;let i=(a,m,l)=>{let u=a??m,h=q(u);if(h!==null){let g=e.fremdeSerie(h);if(!g)throw new Error(`fillSpec region references unknown series '${h}'`);let f=g.shape==="step"?X(g.data):g.data;return {bei:wn(f),davor:vn(f),zeiten:f.map(y=>y.time),skala:g.valueScale??e.valueScale}}if(u==="series")return {bei:wn(l),davor:vn(l),zeiten:l.map(g=>g.time),skala:e.valueScale};let c=de(u,e),p=e.valueScale.domain(),d=c??(u==="chartBottom"?p[0]:p[1]);return {bei:()=>d,zeiten:[],skala:e.valueScale}},o=e.shape==="step",s=[];for(let a of e.runs){if(a.length<2)continue;let m=o?X(a):a,l=i(t.from,"chartBottom",m),u=i(t.to,"series",m),h=m[0].time,c=m[m.length-1].time,p=[...new Set([...l.zeiten,...u.zeiten,...m.map(y=>y.time)])].filter(y=>y>=h&&y<=c).sort((y,b)=>y-b),d=[],g=[],f=()=>{if(d.length>=2){let y=[...g].reverse();s.push({...n.attrs,...n.teilId(s.length),smoothing:o?false:e.smoothing,smoothingType:e.smoothingType,smoothCount:d.length,points:[...d,...y]});}d=[],g=[];};for(let y of p){let b=l.bei(y),S=u.bei(y);if(b===null||S===null){f();continue}let w=e.timeScale.map(y),k=l.davor?.get(y)??b,_=u.davor?.get(y)??S;(k!==b||_!==S)&&(d.push({x:w,y:u.skala.map(_)}),g.push({x:w,y:l.skala.map(k)})),d.push({x:w,y:u.skala.map(S)}),g.push({x:w,y:l.skala.map(b)});}f();}return s}function ni(t,e,n,r){let i=n.timeScale.range(),o=i[0],s=i[1],a=Math.min(t,e),m=Math.max(t,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 ri(t,e,n,r,i){let o=n??r,s=[],a=ii(t,e);if(a===null){let u=e.valueScale.domain();a=(n??r)===e.chartBottom?u[0]:u[1];}let m=de(t.outer,e),l=e.shape==="step";for(let u of e.runs){if(u.length<2)continue;let h=l?X(u):u,c=I.splitByThreshold(h,a,d=>d.value??a,I.interpolateDataPoint),p=t.side==="above"?c.above:t.side==="below"?c.below:[...c.above,...c.below];if(m!==null&&t.side){let d=m,g=t.side==="above"?f=>Math.min(f,d):f=>Math.max(f,d);p=p.map(f=>f.map(y=>({...y,value:g(y.value??d)})));}for(let d of p){if(d.length<2)continue;let g=d.map(y=>({x:e.timeScale.map(y.time),y:e.valueScale.map(y.value)})),f=[];for(let y of [...g].reverse()){let b=f[f.length-1];l&&b&&b.x===y.x||f.push({x:y.x,y:o});}s.push({...i.attrs,...i.teilId(s.length),smoothing:l?false:e.smoothing,smoothingType:e.smoothingType,smoothCount:g.length,points:[...g,...f]});}}return s}function ii(t,e){let n=t.from==="series"?t.to:t.from;return de(n,e)}function de(t,e){return t===void 0||t==="series"||t==="chartTop"||t==="chartBottom"?null:typeof t=="object"&&"threshold"in t?e.thresholds.get(t.threshold)?.value??null:typeof t=="object"&&"value"in t?t.value:null}function An(t,e){if(typeof t=="string"||!("regions"in t))return _n({fill:t},e,0);let n=[];return t.regions.forEach((r,i)=>{n.push(..._n(r,e,i));}),n}function Cn(t){let e=t.style?.line,n=e&&!Array.isArray(e)?e:void 0;return {color:n?.color??x.stroke,width:n?.width??x.strokeWidth,dash:n?.style,smoothing:n?.smoothing??false,smoothingType:n?.smoothingType}}function Mn(t,e,n,r,i){let o=t.filter(l=>l.value!==null);if(o.length<2)return [];let s=Cn(n);e.merke?.({index:i,kind:n.kind,punkte:o.map(l=>({time:l.time,value:l.value})),farbe:s.color,...s.dash?{linie:s.dash}:{}});let a=o.map(l=>({x:e.timeScale.map(l.time),y:e.valueScale.map(l.value)}));return [{type:"path",cssClass:"series-line",id:e.idPrefix?`${e.idPrefix}-overlay-${i}-${r}`:`overlay-${i}-${r}`,points:a,stroke:s.color,strokeWidth:s.width,smoothing:s.smoothing,smoothingType:s.smoothingType,dash:s.dash,fill:"none"}]}function Ln(t,e,n=0){switch(t.kind){case "movingAverage":{let r=t.type==="exponential"?Zt(e.data,t.window):et(e.data,t.window);return Mn(r,e,t,"movingAvg",n)}case "movingMkt":{let r=Yt(e.data,t.window,t.activationEnergy);return Mn(r,e,t,"movingMkt",n)}case "limits":{let r=[],i=e.timeScale.range(),o=i[0],s=i[1],a=Cn(t),m=a.color,l=a.width,u=a.dash??"dashed",h=e.idPrefix?`${e.idPrefix}-overlay-${n}-`:`overlay-${n}-`;return t.high!==void 0&&r.push({type:"line",id:`${h}limit-high`,x1:o,y1:e.valueScale.map(t.high),x2:s,y2:e.valueScale.map(t.high),stroke:m,strokeWidth:l,dash:u}),t.low!==void 0&&r.push({type:"line",id:`${h}limit-low`,x1:o,y1:e.valueScale.map(t.low),x2:s,y2:e.valueScale.map(t.low),stroke:m,strokeWidth:l,dash:u}),r}case "stdDevBand":{let r=t.multiplier??1,i=et(e.data,t.window),o=Xt(e.data,t.window),s=[],a=[],m=[];for(let y=0;y<i.length;y++){let b=i[y].value,S=o[y].value;if(b===null||S===null)continue;let w=e.timeScale.map(i[y].time);s.push({x:w,y:e.valueScale.map(b+r*S)}),a.push({x:w,y:e.valueScale.map(b-r*S)}),m.push({time:i[y].time,value:b,low:b-r*S,high:b+r*S});}if(s.length<2)return [];let l=e.idPrefix?`${e.idPrefix}-overlay-${n}-`:`overlay-${n}-`,u=[],c=(typeof t.style?.fill=="string"||t.style?.fill&&!("regions"in t.style.fill)?t.style.fill:void 0)??"#94a3b833",{color:p,hatch:d}=oi(c);u.push({type:"path",cssClass:"series-fill",id:`${l}stdDevBand`,points:[...s,...[...a].reverse()],fill:p,hatch:d,stroke:"none"});let g=t.style?.line,f=g&&!Array.isArray(g)?g:void 0;if(e.merke?.({index:n,kind:"stdDevBand",punkte:m,farbe:f?f.color??x.stroke:p,...f?.style?{linie:f.style}:{}}),f){let y=i.filter(b=>b.value!==null).map(b=>({x:e.timeScale.map(b.time),y:e.valueScale.map(b.value)}));y.length>=2&&u.push({type:"path",cssClass:"series-line",id:`${l}stdDevBand-mean`,points:y,stroke:f.color??x.stroke,strokeWidth:f.width??1.5,smoothing:f.smoothing,smoothingType:f.smoothingType,dash:f.style,fill:"none"});}return u}}}function oi(t){return typeof t=="string"?{color:t}:{color:t.color,hatch:t.hatch}}function Dn(t,e){let n=t.style?.line,r=n&&!Array.isArray(n)?n:void 0,i=Array.isArray(n)?n[0]:r,o=(i?.shape??t.seriesType)==="step",s=i||void 0,a=s?.gapThreshold??e??x.gapThreshold;return {styleLine:n,lineDefaults:r,gapThreshold:a,grundLinie:s,stepShape:o}}function $n(t,e,n,r,i=0){let o=t.timeScale,s={timeScale:o,valueScale:n};if(z(e))return dn(e,o,n);let{lineDefaults:a,gapThreshold:m}=t.linienGrundlage(e),l=I.getRuns(e.data,_=>_.value===null,m),u=l.reduce((_,P)=>_+P.length,0);if(u===0)return [];let h=[],c=e.style?.markers,p=e.style?.shadow,d={stroke:a?.color??t.palettenFarbe(i),strokeWidth:a?.width??x.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:K(e.name,e.id)},{styleLine:g,grundLinie:f,stepShape:y}=t.linienGrundlage(e),b=fn(e,o,t.jetzt),S=Pe(l,b),w=e.style?.fill;if(w!==void 0){let _=n.range(),P=Math.min(_[0],_[1]),L=Math.max(_[0],_[1]);h.push(...An(w,{runs:S,timeScale:o,valueScale:n,thresholds:r,chartTop:P,chartBottom:L,smoothing:f?.smoothing,smoothingType:f?.smoothingType,shape:y?"step":"line",fremdeSerie:v=>{let C=t.alleReihen.find(j=>(j.id??j.name)===v||j.name===v);if(!C||!("data"in C))return;let $=C.data;if($.length===0||!("value"in $[0]))return;let B=t.linienGrundlage(C),F=B.grundLinie;return {data:$,shape:B.stepShape?"step":"line",smoothing:F?.smoothing,smoothingType:F?.smoothingType,gapThreshold:B.gapThreshold,valueScale:t.valueScales.get(t.achseVon(C))}},idPrefix:K(e.name,e.id)}));}h.push(...gn({series:e,ctx:s,runs:l,haltBis:b,totalPoints:u,style:d,styleLine:g,styleMarkers:c,stepShape:y,thresholds:r}));let k=e.overlays;if(k&&k.length>0){let _=n.range(),P={data:e.data,timeScale:o,valueScale:n,chartTop:Math.min(_[0],_[1]),chartBottom:Math.max(_[0],_[1]),idPrefix:K(e.name,e.id),merke:L=>{t.merkeOverlay(i,L);}};k.forEach((L,v)=>{h.push(...Ln(L,P,v));});}return e.style?.gap&&l.length>1&&h.push(...$t({gap:e.style.gap,runs:l,timeScale:o,valueScale:n,metrics:t.textMetrics,lineColor:a?.color})),h}function Pn(t,e,n){if(!e)return t;let r=`${e}-`,i=s=>s.split(/\s+/).filter(Boolean).map(a=>n.has(a)?a:r+a).join(" "),o=s=>{let a={...s};return a.cssClass&&(a.cssClass=i(a.cssClass)),a.type==="group"&&(a.commands=a.commands.map(o)),a};return t.map(o)}function Rn(t,e,n){let i=new Array(t.length),o=e.map(s=>({position:s.position,von:s.von,bis:s.bis}));t.forEach((s,a)=>{if(s.fest===void 0)return;let m=s.position==="left"?s.achseX-s.fest:s.achseX+s.fest,l=s.schrift/2;o.push({position:s.position,von:m-l-1,bis:m+l+1,titel:true}),i[a]=m;});for(let s of ["left","right"]){let a=s==="left",m=t.map((l,u)=>({t:l,i:u})).filter(l=>l.t.position===s&&l.t.fest===void 0).sort((l,u)=>a?u.t.achseX-l.t.achseX:l.t.achseX-u.t.achseX);for(let{t:l,i:u}of m){let h=l.schrift/2,c=o.filter(g=>g.position===s),p=l.kante,d=a?p-1-h:p+1+h;for(let g=0;g<=c.length;g++){let f=d-h-1,y=d+h+1,b=c.find(S=>f<S.bis&&S.von<y);if(!b)break;p=a?b.von:b.bis,d=a?p-1-h:p+1+h;}if(a?d-h<2:d+h>n-2){let g=o.filter(f=>f.position===s&&f.titel);d=a?h+2:n-h-2;for(let f=0;f<=g.length;f++){let y=d-h-1,b=d+h+1,S=g.find(w=>y<w.bis&&w.von<b);if(!S)break;d=a?S.bis+1+h:S.von-1-h;}}o.push({position:s,von:d-h-1,bis:d+h+1,titel:true}),i[u]=d;}}return {xs:i,belegt:o}}function Bn(t){let{axes:e,neueForm:n,achsenTitel:r,titelSpuren:i,layout:o}=t,{chartX:s,chartY:a,chartWidth:m,chartHeight:l}=o,u=n?void 0:e?.left?.label,h=n?void 0:e?.right?.label,c=e?.x?.label;if(!u&&!h&&!c&&r.length===0)return [];let p=[],d=a+l/2,g=e?.left?.labels,f=e?.right?.labels,y=e?.x?.labels,b=e?.left?.labelOffset,S=e?.right?.labelOffset;return u&&p.push({type:"text",content:u,x:b===void 0?14:s-(e?.left?.offset??0)-b,y:d,anchor:"middle",fontSize:g?.fontSize??x.axisLabelSize,fill:g?.color??x.axisLabelColor,rotate:-90}),h&&p.push({type:"text",content:h,x:S===void 0?o.totalWidth-14:s+m+(e?.right?.offset??0)+S,y:d,anchor:"middle",fontSize:f?.fontSize??x.axisLabelSize,fill:f?.color??x.axisLabelColor,rotate:90}),r.forEach((w,k)=>{p.push({type:"text",content:w.text,x:i[k],y:d,anchor:"middle",fontSize:w.style?.fontSize??x.axisLabelSize,fill:w.style?.color??x.axisLabelColor,rotate:w.position==="right"?90:-90});}),c&&p.push({type:"text",content:c,x:s+m/2,y:o.totalHeight-6-(t.untenBelegt??0),anchor:"middle",fontSize:y?.fontSize??x.axisLabelSize,fill:y?.color??x.axisLabelColor}),p.length===0?[]:[{type:"group",cssClass:"axis-labels",commands:p}]}var si={top:20,right:20,bottom:40,left:60},V=class{_layout;_idPraefix;_klassenPraefix;_renderer;_locale;_timeZone;_fontFamily;_legend;_textMetrics;_theme;_overlayWerte=new Map;_clipSeries;_markers;_thresholds;_highlights;_gaps;_gapsBand;_gapsAutoDetect;_gapsMinGapMs;_gapsAtEnd;_annotations;_annotationBands;_disabledAnnotations=new Set;_annotationSeq=0;_axes;_series;_timeScale;_optionen;_randAuto;_valueScales=new Map;constructor(e={}){this._optionen=e,this._randAuto=e.margin==="auto",this._layout=new ee({width:e.width??800,height:e.height??400,margin:typeof e.margin=="object"?e.margin:si}).compute(),this._renderer=e.renderer,this._locale=e.locale,this._timeZone=e.timeZone,this._fontFamily=e.fontFamily,this._idPraefix=e.idPrefix,this._klassenPraefix=e.classPrefix,this._legend=e.legend,this._textMetrics=e.textMetrics??O,this._theme=e.theme,this._clipSeries=e.clipSeries??true,this._markers=e.markers??[],this._thresholds=e.thresholds??[],this._highlights=e.highlights??[];let n=bt(e.gaps);this._gaps=n.gaps,this._gapsAutoDetect=n.autoDetect,this._gapsMinGapMs=n.minGapMs,this._gapsBand=n.band,this._gapsAtEnd=n.atEnd,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 n of this._annotationBands){let r=n.height??12,i=n.spacing??0;(n.showAxis??false)&&(e+=26+i),e+=r+i;}return e}setData(e){this._series=e.filter(n=>Array.isArray(n.data));}addAnnotation(e){let n=e.id??`anno-${++this._annotationSeq}`;return this._annotations.push({...e,id:n}),n}removeAnnotation(e){let n=this._annotations.length;return this._annotations=this._annotations.filter(r=>r.id!==e),this._disabledAnnotations.delete(e),this._annotations.length<n}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(n=>n.time)}_layoutMitLegende(){let e=en({legend:this._legend,items:this._legendeneintraege(),gesamtbreite:this._layout.totalWidth,metrics:this._textMetrics}),n=this._layout,r=tn(e,this._layout.margin);return r&&(n=new ee({width:this._layout.totalWidth,height:this._layout.totalHeight,margin:r}).compute()),{layout:n,legende:e}}renderCommands(){this._randAuto&&this._randMessen();let e=this._klassenPraefix,n=new Set((this._legend?.itemClass??"").split(/\s+/).filter(Boolean));return ue(this._theme,()=>Pn(this._zeichne(),e,n))}_randMessen(){let e=Ke({...this._optionen,margin:void 0,series:this._series,annotations:this._annotations.filter(n=>!this._disabledAnnotations.has(n.id??""))});this._layout=new ee({width:this._layout.totalWidth,height:this._layout.totalHeight,margin:e}).compute();}_zeichne(){if(this._overlayWerte.clear(),this._series.length===0)return [];let{layout:e,legende:n}=this._layoutMitLegende(),{chartX:r,chartY:i,chartWidth:o,chartHeight:s}=e,a=[r,r+o],m=[i,i+s],l=[];for(let A of this._series)A.data.sort((M,D)=>M.time-D.time);let u=new Map,h=1/0,c=-1/0,p=false;for(let A of this._series){let M=this._axisIndexOf(A),D=u.get(M);D?D.push(A):u.set(M,[A]);for(let G of this._timesOf(A))G<h&&(h=G),G>c&&(c=G),p=true;}if(!p)return [];let d=this._axes?.x?.domain,g=d&&d!=="auto"?d:[h,c];this._timeScale=new ne({domain:g,range:a,locale:this._locale,timeZone:this._timeZone});let f=new ie({domain:g,xRange:a,y:i+s,locale:this._locale,timeZone:this._timeZone,format:this._axes?.x?.format,maxTicks:this._axes?.x?.ticks?.major,minorTicks:xe(this._axes?.x?.ticks?.minor,Z(this._axes?.x?.grid)?.minor),colors:be(this._axes?.x?.axis,this._axes?.x?.labels),gesamtbreite:e.totalWidth,metrics:this._textMetrics});this._valueScales.clear();let y=Array.from(u.keys()).sort((A,M)=>A-M),b=Mt({axes:this._axes,indices:y,seriesByIndex:u,layout:e,thresholds:this._thresholds,metrics:this._textMetrics,locale:this._locale});l.push(...b.commands);let{titel:S,baender:w,neueForm:k}=b,_=b.primary;for(let[A,M]of b.scales)this._valueScales.set(A,M);let P=this._valueScales.get(0)??this._valueScales.get(y[0]);l.push({type:"group",cssClass:"time-axis",sharedStyles:true,commands:f.render()});let L=on({axes:this._axes,timeAxis:f,primaryValueAxis:_,xRange:a,yRange:m}),v=L.group;v&&L.layer==="back"&&(l.push(v),v=null),this._highlights.length>0&&l.push({type:"group",cssClass:"highlights",commands:It({metrics:this._textMetrics,highlights:this._highlights,timeScale:this._timeScale,yRange:m,height:e.totalHeight})});let C=[],$=P?Lt({thresholds:this._thresholds,valueScales:this._valueScales,primaryScale:P,xRange:a,layout:e,baender:b.baender,belegt:C,metrics:this._textMetrics}):[];l.push(...$);let B=this._gapsAtEnd?Bt({atEnd:this._gapsAtEnd,series:this._series,timeScale:this._timeScale}).map(A=>Ze(A,void 0)):[],F=[...this._gaps,...B];if(this._gapsAutoDetect){let A=[];for(let M of this._series){if(z(M))continue;let D=M.data.filter(G=>G.value!==null);A.push(...Vt(D,this._gapsMinGapMs));}A.length>0&&(F=[...F,...A]);}F.length>0&&l.push({type:"group",cssClass:"gaps",commands:Qe({gaps:F,timeScale:this._timeScale,yRange:m,height:e.totalHeight,metrics:this._textMetrics,band:this._gapsBand})});let j=new Map(this._thresholds.map(A=>[A.id??A.name,A]));for(let[A,M]of this._series.entries()){if(M.data.length===0)continue;let D=this._valueScales.get(this._axisIndexOf(M));if(!D)continue;let G=N(M.id??M.name);l.push({type:"group",cssClass:`series series--${G}`,id:`series-${G}`,commands:$n(this._reihenKontext(),M,D,j,A),...this._clipSeries?{clipRect:{x:r,y:i,w:o,h:s}}:{}});}if(v&&l.push(an(v,sn($))),l.push(...cn({markers:this._markers,annotations:this._annotations.filter(A=>!A.id||!this._disabledAnnotations.has(A.id)),series:this._series,timeScale:this._timeScale,valueScales:this._valueScales,achseVon:A=>this._axisIndexOf(A),primaryScale:P,yRange:m,metrics:this._textMetrics,plot:{x:r,y:i,w:o,h:s}})),this._annotationBands.length>0){let A=i+s+this._layout.margin.bottom,M=0;this._annotationBands.forEach(D=>{let G=D.height??12,Q=D.spacing??0,R=A+M;(D.showAxis??false)&&(M+=26+Q),M+=G+Q,l.push({type:"group",cssClass:"annotation-band",commands:new ke({name:D.name,showAxis:D.showAxis??false,items:D.items,timeScale:this._timeScale,background:D.background,hatch:D.hatch,labels:D.labels,minItemWidth:D.minItemWidth,metrics:this._textMetrics},[r,r+o],R,G).render()});});}let{xs:E,belegt:Y}=Rn(S.map(A=>({achseX:A.achseX,kante:A.kante,position:A.position,schrift:A.style?.fontSize??x.axisLabelSize,fest:A.fest})),[...w,...C],e.totalWidth);return l.push(...nn({legende:n,layout:e,randBelegt:Y,metrics:this._textMetrics})),l.push(...Bn({axes:this._axes,neueForm:k,achsenTitel:S,titelSpuren:E,layout:e,untenBelegt:e.margin.bottom-this._layout.margin.bottom})),Ye(l,this._fontFamily??x.fontFamily),Xe(l,this._idPraefix),l}_linienGrundlage(e){return Dn(e,this._gapsAutoDetect?this._gapsMinGapMs:void 0)}_reihenKontext(){return {timeScale:this._timeScale,alleReihen:this._series,valueScales:this._valueScales,achseVon:e=>this._axisIndexOf(e),linienGrundlage:e=>this._linienGrundlage(e),palettenFarbe:e=>this._palettenFarbe(e),jetzt:this._gapsAtEnd?.now,textMetrics:this._textMetrics,merkeOverlay:(e,n)=>{let r=this._overlayWerte.get(e)??[];r.push(n),this._overlayWerte.set(e,r);}}}legendItems(){return ue(this._theme,()=>this._legendeneintraege())}_legendeneintraege(){return [...this._legendItems(),...this._bandLegendItems()]}_bandLegendItems(){return this._annotationBands.filter(e=>e.showInLegend===true&&e.name).map(e=>({name:e.name,color:Gt(e),id:`band-${N(e.name)}`}))}_palettenFarbe(e){let n=x.palette;return n.length>0?n[e%n.length]:x.stroke}_legendItems(){return this._series.map((e,n)=>{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=z(e)?e.avgColor??x.avgColor:this._palettenFarbe(n);return {name:e.name,color:i[0]?.color??a,line:i.length===1?i[0].style:void 0,width:i.length<=1?i[0]?.width??x.strokeWidth:void 0,marker:s?o.type:void 0,colors:e.legend?.colors,id:N(e.id??e.name),seriesId:e.id??e.name}})}get renderer(){return this._renderer}get layout(){return ue(this._theme,()=>this._layoutMitLegende().layout)}get plotRect(){let{chartX:e,chartY:n,chartWidth:r,chartHeight:i}=this.layout;return {x:e,y:n,width:r,height:i}}get timeScale(){return this._timeScale}get valueScales(){return this._valueScales}warnings(){return zt({series:this._series,gaps:this._gaps,thresholds:this._thresholds,linienGrundlage:e=>this._linienGrundlage(e)})}pointsAt(e,n,r={}){return ue(this._theme,()=>this._punkteAm(e,n,r))}_punkteAm(e,n,r={}){if(!this._timeScale)return [];let i=this._legendItems();return pt(this._series,this._timeScale,(o,s)=>{let a=this._axisIndexOf(o),m=this._valueScales.get(a);if(!m)return;let l=z(o)?void 0:this._linienGrundlage(o);return {skala:m,achse:a,stufe:l?.stepShape??false,gapThreshold:l?.gapThreshold??0,farbe:i[s].color,linie:i[s].line,format:ai(o)??we(this._axes,a)?.format,overlays:this._overlayWerte.get(s)}},this.plotRect,e,n,{...r,radius:r.radius??x.tooltipSnapRadius})}invertTime(e){return this._timeScale?this._timeScale.invert(e):0}invertValue(e,n=0){let r=this._valueScales.get(n);return r?r.invert(e):0}project(e,n,r=0){let i=this._timeScale?this._timeScale.map(e):0,o=this._valueScales.get(r);return {x:i,y:o?o.map(n):0}}};function ai(t){let e=t.enumMap;return e?n=>e[n]??String(n):void 0}function li(t){if(t.min!==void 0&&t.max!==void 0)return {unit:t.unit,min:t.min,max:t.max};let e=1/0,n=-1/0;for(let r of t.data??[])r.value===null||r.value===void 0||(r.value<e&&(e=r.value),r.value>n&&(n=r.value));return {unit:t.unit,min:e,max:n}}var jn=t=>Math.abs(t.max-t.min);function mi(t,e){return t.max>=e.min&&e.max>=t.min?0:t.max<e.min?e.min-t.max:t.min-e.max}function ui(t,e){if(t.unit!==e.unit)return false;let n=Math.max(Math.abs(t.min),Math.abs(t.max),Math.abs(e.min),Math.abs(e.max)),r=Math.max(jn(t),jn(e),n*.05);return mi(t,e)<=r}function hi(t){let e=[],n=t.map(i=>{let o=li(i);if(!Number.isFinite(o.min)||!Number.isFinite(o.max)){let a=e.findIndex(m=>m.unit===o.unit);return a>=0?a:(e.push({unit:o.unit,min:0,max:0}),e.length-1)}let s=e.findIndex(a=>ui(a,o));return s>=0?(e[s]={unit:e[s].unit,min:Math.min(e[s].min,o.min),max:Math.max(e[s].max,o.max)},s):(e.push({...o}),e.length-1)}),r=e.map((i,o)=>({position:o===0?"left":"right",...i.unit?{label:i.unit}:{}}));return {indices:n,axes:r}}function Fn(t){let e=[];for(let n=0;n<t.length-1;n++){let r=t[n+1].x-t[n].x;e.push(r===0?0:(t[n+1].y-t[n].y)/r);}return e}function ci(t){let e=Fn(t),n=t.length,r=[...e];for(let i=1;i<n-1;i++)r[i]=e[i-1]*e[i]<=0?0:(e[i-1]+e[i])/2;r[n-1]=e[n-2];for(let i=0;i<n-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 di(t){let e=Fn(t),n=t.length;if(e.length<2)return t.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],u=[];for(let h=0;h<n;h++){let c=Math.abs(l[h+3]-l[h+2]),p=Math.abs(l[h+1]-l[h]);u.push(c+p===0?(l[h+1]+l[h+2])/2:(c*l[h+1]+p*l[h+2])/(c+p));}return u}function pi(t,e){let n=[];for(let r=0;r<t.length-1;r++){let i=t[r],o=t[r+1],s=(o.x-i.x)/3;n.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 n}function fi(t,e){if(t.length<2)return [];let n=e==="akima"?di(t):ci(t);return pi(t,n)}function gi(t){let e=[];for(let n=0;n<t.length-1;n++){let r=t[n-1]??t[n],i=t[n],o=t[n+1],s=t[n+2]??o,a=Math.min(i.x,o.x),m=Math.max(i.x,o.x),l=u=>Math.max(a,Math.min(u,m));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 it(t,e){return e&&e!=="catmull-rom"?fi(t,e):gi(t)}var ot=["fill","stroke","stroke-width","stroke-dasharray","stroke-linecap","fill-opacity","stroke-opacity"],yi={line:["stroke","stroke-width","stroke-dasharray","stroke-linecap","stroke-opacity"],text:["text-anchor","font-size","font-family","fill","fill-opacity"],circle:ot,rect:ot,path:ot},bi={line:"stroke-opacity",text:"fill-opacity"},xi=/ ([a-z-]+)="([^"]*)"/g;function Si(t){let e=/^<(line|text|circle|rect|path) /.exec(t)?.[1];if(!e||t.includes(`
25
+ `))return null;let n=e==="text"?t.indexOf(">")+1:t.length,r=t.slice(0,n),i=/ opacity="([^"]*)"/.exec(r),o=bi[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(xi))s.set(a,m);return {art:e,kopf:r,rest:t.slice(n),attrs:s}}function En(t){let e=[];for(let r of yi[t[0].art]){if(!t.every(a=>a.attrs.has(r)))continue;let i=new Map;for(let a of t){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 n=t.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:n}}function Gn(t,e=" "){let n=[];for(let o of t){let s=Si(o);if(!s)return null;n.push(s);}if(n.length===0)return null;let r=new Set(n.map(o=>o.art));if(r.size===1){let o=En(n);return {attrs:o.attrs,inhalt:o.kinder.map(s=>e+s).join(`
26
26
  `)}}if(r.size!==2||!r.has("line")||!r.has("text"))return null;let i=[];for(let o of ["line","text"]){let s=n.filter(m=>m.art===o);if(s.length===1){i.push(e+s[0].kopf+s[0].rest);continue}let a=En(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 st="1.23.0";var Si=` <!-- MLTimeGraph ${st} -->`,In=1e3;function k(t){return String(Math.round(t*In)/In)}function at(t){return rt(t).toString(16).padStart(8,"0")}function wi(t){switch(t){case "top":return "text-top";case "bottom":return "text-bottom";default:return "middle"}}var J=class extends ke{#e="100%";#t="100%";#n;#r="";#m="";#i=new Map;#o=new Map;#s=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),e?.idPrefix&&(this.#r=`${e.idPrefix}-`),e?.classPrefix&&(this.#m=`${e.classPrefix}-`);}setBackgroundColor(e){this.#n=e;}render(e){this.#i.clear(),this.#o.clear(),this.#s.clear();let n=e.map(l=>this._toSVG(l));this.#n&&n.unshift(`<rect width="100%" height="100%" fill="${this._esc(this.#n)}" />`);let r=n.join(`
27
+ `)}}var st="1.24.0";var wi=` <!-- MLTimeGraph ${st} -->`,In=1e3;function T(t){return String(Math.round(t*In)/In)}function at(t){return rt(t).toString(16).padStart(8,"0")}function vi(t){switch(t){case "top":return "text-top";case "bottom":return "text-bottom";default:return "middle"}}var J=class extends Te{#e="100%";#t="100%";#n;#r="";#m="";#i=new Map;#o=new Map;#s=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),e?.idPrefix&&(this.#r=`${e.idPrefix}-`),e?.classPrefix&&(this.#m=`${e.classPrefix}-`);}setBackgroundColor(e){this.#n=e;}render(e){this.#i.clear(),this.#o.clear(),this.#s.clear();let n=e.map(l=>this._toSVG(l));this.#n&&n.unshift(`<rect width="100%" height="100%" fill="${this._esc(this.#n)}" />`);let r=n.join(`
28
28
  `),i="",o=[];for(let[,l]of this.#i)o.push(l);for(let[,l]of this.#o)o.push(l);for(let[,l]of this.#s)o.push(l);o.length>0&&(i=` <defs>
29
29
  ${o.join(`
30
30
  `)}
31
31
  </defs>
32
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
- ${Si}
33
+ ${wi}
34
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.#f(e);case "gap":return this._gap(e);case "group":return this._group(e)}}#h(e,n){if(e.length===0)return "";if(!n.smoothing||e.length<3)return e.map((l,u)=>`${u===0?"M":"L"}${k(l.x)},${k(l.y)}`).join(" ");let r=n.smoothCount!=null&&n.smoothCount<e.length?Math.max(n.smoothCount,2):e.length,i=n.smoothTail??0,o=i>=3&&e.length-i>=r?e.length-i:e.length,s=l=>l.map(u=>` C${k(u.c1.x)},${k(u.c1.y)} ${k(u.c2.x)},${k(u.c2.y)} ${k(u.p1.x)},${k(u.p1.y)}`).join(""),a=`M${k(e[0].x)},${k(e[0].y)}`;a+=s(it(e.slice(0,r),n.smoothingType));let m=o<e.length?o:e.length-1;for(let l=r;l<=m;l++)a+=` L${k(e[l].x)},${k(e[l].y)}`;if(o<e.length){let l=e.slice(o).reverse(),u=it(l,n.smoothTailType??n.smoothingType).reverse().map(h=>({p0:h.p1,c1:h.c2,c2:h.c1,p1:h.p0}));a+=s(u);}return a}_hatchPattern(e,n){let r=`${this.#r}hatch-${e}-${at(n??"")}`;if(this.#s.has(r))return r;let i=ge(r,e,n??"rgba(200,220,255,0.3)");return this.#s.set(r,i),r}#l(e,n){n.stroke&&e.push(`stroke="${this._esc(n.stroke)}"`),n.strokeWidth&&e.push(`stroke-width="${k(n.strokeWidth)}"`);}#u(e,n){this.#l(e,n);let r=this.#c(n.dash,n.dashed,n.strokeWidth);r&&(e.push(`stroke-dasharray="${r.strokeDasharray}"`),r.strokeLinecap&&e.push(`stroke-linecap="${r.strokeLinecap}"`)),n.opacity!==void 0&&e.push(`opacity="${k(n.opacity)}"`);}#a(e,n){n.id&&e.push(`id="${this._esc(n.id)}"`);let r=this.#d(n);r&&e.push(`filter="url(#${r})"`);}_path(e){let n=this.#h(e.points,e)+(e.closed?" Z":""),r=[];if(e.hatch){let i=this._hatchPattern(e.hatch,e.fill);r.push(`fill="url(#${i})"`);}else r.push(`fill="${e.fill?this._esc(e.fill):"none"}"`);return this.#u(r,e),e.cssClass&&r.push(`class="${this._esc(e.cssClass)}"`),this.#a(r,e),`<path d="${n}" ${r.join(" ")} />`}_line(e){let n=[];return this.#u(n,e),this.#a(n,e),`<line x1="${k(e.x1)}" y1="${k(e.y1)}" x2="${k(e.x2)}" y2="${k(e.y2)}" ${n.join(" ")} />`}_rect(e){let n=[];if(e.hatch){let r=this._hatchPattern(e.hatch,e.fill);n.push(`fill="url(#${r})"`);}else e.fill!==void 0&&n.push(`fill="${this._esc(e.fill)}"`);return this.#l(n,e),e.opacity!==void 0&&n.push(`opacity="${k(e.opacity)}"`),e.dashed&&n.push('stroke-dasharray="4,4"'),this.#a(n,e),e.title?`<rect x="${k(e.x)}" y="${k(e.y)}" width="${k(e.w)}" height="${k(e.h)}" ${n.join(" ")}><title>${this._esc(e.title)}</title></rect>`:`<rect x="${k(e.x)}" y="${k(e.y)}" width="${k(e.w)}" height="${k(e.h)}" ${n.join(" ")} />`}_circle(e){let n=[];if(e.hatch){let r=this._hatchPattern(e.hatch,e.fill);n.push(`fill="url(#${r})"`);}else e.fill&&n.push(`fill="${this._esc(e.fill)}"`);return this.#l(n,e),this.#a(n,e),`<circle cx="${k(e.cx)}" cy="${k(e.cy)}" r="${k(e.r)}" ${n.join(" ")} />`}#c(e,n,r){return qe(e,r??2,n)}#d(e){if(!e.shadowColor)return null;let n=e.shadowBlur??0,r=e.shadowOffsetX??0,i=e.shadowOffsetY??0;if(!n&&!r&&!i)return null;let o=`${this.#r}shadow-${at(`${e.shadowColor}|${k(n)}|${k(r)}|${k(i)}`)}`;if(this.#i.has(o))return o;let s=`<filter id="${o}" x="-50%" y="-50%" width="200%" height="200%">
36
- <feDropShadow dx="${k(r)}" dy="${k(i)}" stdDeviation="${k(n/2)}" flood-color="${this._esc(e.shadowColor)}" />
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.#f(e);case "gap":return this._gap(e);case "group":return this._group(e)}}#h(e,n){if(e.length===0)return "";if(!n.smoothing||e.length<3)return e.map((l,u)=>`${u===0?"M":"L"}${T(l.x)},${T(l.y)}`).join(" ");let r=n.smoothCount!=null&&n.smoothCount<e.length?Math.max(n.smoothCount,2):e.length,i=n.smoothTail??0,o=i>=3&&e.length-i>=r?e.length-i:e.length,s=l=>l.map(u=>` C${T(u.c1.x)},${T(u.c1.y)} ${T(u.c2.x)},${T(u.c2.y)} ${T(u.p1.x)},${T(u.p1.y)}`).join(""),a=`M${T(e[0].x)},${T(e[0].y)}`;a+=s(it(e.slice(0,r),n.smoothingType));let m=o<e.length?o:e.length-1;for(let l=r;l<=m;l++)a+=` L${T(e[l].x)},${T(e[l].y)}`;if(o<e.length){let l=e.slice(o).reverse(),u=it(l,n.smoothTailType??n.smoothingType).reverse().map(h=>({p0:h.p1,c1:h.c2,c2:h.c1,p1:h.p0}));a+=s(u);}return a}_hatchPattern(e,n){let r=`${this.#r}hatch-${e}-${at(n??"")}`;if(this.#s.has(r))return r;let i=ge(r,e,n??"rgba(200,220,255,0.3)");return this.#s.set(r,i),r}#l(e,n){n.stroke&&e.push(`stroke="${this._esc(n.stroke)}"`),n.strokeWidth&&e.push(`stroke-width="${T(n.strokeWidth)}"`);}#u(e,n){this.#l(e,n);let r=this.#c(n.dash,n.dashed,n.strokeWidth);r&&(e.push(`stroke-dasharray="${r.strokeDasharray}"`),r.strokeLinecap&&e.push(`stroke-linecap="${r.strokeLinecap}"`)),n.opacity!==void 0&&e.push(`opacity="${T(n.opacity)}"`);}#a(e,n){n.id&&e.push(`id="${this._esc(n.id)}"`);let r=this.#d(n);r&&e.push(`filter="url(#${r})"`);}_path(e){let n=this.#h(e.points,e)+(e.closed?" Z":""),r=[];if(e.hatch){let i=this._hatchPattern(e.hatch,e.fill);r.push(`fill="url(#${i})"`);}else r.push(`fill="${e.fill?this._esc(e.fill):"none"}"`);return this.#u(r,e),e.cssClass&&r.push(`class="${this._esc(e.cssClass)}"`),this.#a(r,e),`<path d="${n}" ${r.join(" ")} />`}_line(e){let n=[];return this.#u(n,e),this.#a(n,e),`<line x1="${T(e.x1)}" y1="${T(e.y1)}" x2="${T(e.x2)}" y2="${T(e.y2)}" ${n.join(" ")} />`}_rect(e){let n=[];if(e.hatch){let r=this._hatchPattern(e.hatch,e.fill);n.push(`fill="url(#${r})"`);}else e.fill!==void 0&&n.push(`fill="${this._esc(e.fill)}"`);return this.#l(n,e),e.opacity!==void 0&&n.push(`opacity="${T(e.opacity)}"`),e.dashed&&n.push('stroke-dasharray="4,4"'),this.#a(n,e),e.title?`<rect x="${T(e.x)}" y="${T(e.y)}" width="${T(e.w)}" height="${T(e.h)}" ${n.join(" ")}><title>${this._esc(e.title)}</title></rect>`:`<rect x="${T(e.x)}" y="${T(e.y)}" width="${T(e.w)}" height="${T(e.h)}" ${n.join(" ")} />`}_circle(e){let n=[];if(e.hatch){let r=this._hatchPattern(e.hatch,e.fill);n.push(`fill="url(#${r})"`);}else e.fill&&n.push(`fill="${this._esc(e.fill)}"`);return this.#l(n,e),this.#a(n,e),`<circle cx="${T(e.cx)}" cy="${T(e.cy)}" r="${T(e.r)}" ${n.join(" ")} />`}#c(e,n,r){return qe(e,r??2,n)}#d(e){if(!e.shadowColor)return null;let n=e.shadowBlur??0,r=e.shadowOffsetX??0,i=e.shadowOffsetY??0;if(!n&&!r&&!i)return null;let o=`${this.#r}shadow-${at(`${e.shadowColor}|${T(n)}|${T(r)}|${T(i)}`)}`;if(this.#i.has(o))return o;let s=`<filter id="${o}" x="-50%" y="-50%" width="200%" height="200%">
36
+ <feDropShadow dx="${T(r)}" dy="${T(i)}" stdDeviation="${T(n/2)}" flood-color="${this._esc(e.shadowColor)}" />
37
37
  </filter>`;return this.#i.set(o,s),o}#p(e,n,r,i,o){this.#o.has(e)||this.#o.set(e,`<clipPath id="${e}">
38
- <rect x="${k(n)}" y="${k(r)}" width="${k(i)}" height="${k(o)}" />
39
- </clipPath>`);}#f(e){let n=[];return e.anchor&&n.push(`text-anchor="${e.anchor}"`),e.fontSize&&n.push(`font-size="${k(e.fontSize)}"`),e.fontFamily&&n.push(`font-family="${this._esc(e.fontFamily)}"`),e.fill&&n.push(`fill="${this._esc(e.fill)}"`),e.opacity!=null&&n.push(`opacity="${k(e.opacity)}"`),e.rotate&&n.push(`transform="rotate(${k(e.rotate)} ${k(e.x)} ${k(e.y)})"`),e.textBaseline&&n.push(`dominant-baseline="${wi(e.textBaseline)}"`),e.id&&n.push(`id="${this._esc(e.id)}"`),`<text x="${k(e.x)}" y="${k(e.y)}" ${n.join(" ")}>${this._esc(e.content)}</text>`}_gap(e){if(e.style==="empty")return "";let n=[`stroke="${this._esc("#999")}"`,'stroke-dasharray="4,4"','fill="none"'];return e.label?`<g class="${this.#m}gap">
40
- <rect x="${k(e.x1)}" y="${k(e.y1)}" width="${k(e.x2-e.x1)}" height="${k(e.y2-e.y1)}" ${n.join(" ")} />
41
- <text x="${k(e.x1)}" y="${k(e.y1-4)}" fill="#999" font-size="10">${this._esc(e.label)}</text>
42
- </g>`:`<rect x="${k(e.x1)}" y="${k(e.y1)}" width="${k(e.x2-e.x1)}" height="${k(e.y2-e.y1)}" ${n.join(" ")} />`}_group(e){let n=null;if(e.clipRect){let{x:u,y:h,w:c,h:p}=e.clipRect;n=`${this.#r}clip-plot-${at(`${k(u)},${k(h)},${k(c)},${k(p)}`)}`,this.#p(n,u,h,c,p);}let r=e.commands.map(u=>this._toSVG(u)),i=e.sharedStyles?Gn(r):null,o=i?.inhalt??r.map(u=>` ${u.replaceAll(/\n {3}/g,`
38
+ <rect x="${T(n)}" y="${T(r)}" width="${T(i)}" height="${T(o)}" />
39
+ </clipPath>`);}#f(e){let n=[];return e.anchor&&n.push(`text-anchor="${e.anchor}"`),e.fontSize&&n.push(`font-size="${T(e.fontSize)}"`),e.fontFamily&&n.push(`font-family="${this._esc(e.fontFamily)}"`),e.fill&&n.push(`fill="${this._esc(e.fill)}"`),e.opacity!=null&&n.push(`opacity="${T(e.opacity)}"`),e.rotate&&n.push(`transform="rotate(${T(e.rotate)} ${T(e.x)} ${T(e.y)})"`),e.textBaseline&&n.push(`dominant-baseline="${vi(e.textBaseline)}"`),e.id&&n.push(`id="${this._esc(e.id)}"`),`<text x="${T(e.x)}" y="${T(e.y)}" ${n.join(" ")}>${this._esc(e.content)}</text>`}_gap(e){if(e.style==="empty")return "";let n=[`stroke="${this._esc("#999")}"`,'stroke-dasharray="4,4"','fill="none"'];return e.label?`<g class="${this.#m}gap">
40
+ <rect x="${T(e.x1)}" y="${T(e.y1)}" width="${T(e.x2-e.x1)}" height="${T(e.y2-e.y1)}" ${n.join(" ")} />
41
+ <text x="${T(e.x1)}" y="${T(e.y1-4)}" fill="#999" font-size="10">${this._esc(e.label)}</text>
42
+ </g>`:`<rect x="${T(e.x1)}" y="${T(e.y1)}" width="${T(e.x2-e.x1)}" height="${T(e.y2-e.y1)}" ${n.join(" ")} />`}_group(e){let n=null;if(e.clipRect){let{x:u,y:h,w:c,h:p}=e.clipRect;n=`${this.#r}clip-plot-${at(`${T(u)},${T(h)},${T(c)},${T(p)}`)}`,this.#p(n,u,h,c,p);}let r=e.commands.map(u=>this._toSVG(u)),i=e.sharedStyles?Gn(r):null,o=i?.inhalt??r.map(u=>` ${u.replaceAll(/\n {3}/g,`
43
43
  `)}`).join(`
44
44
  `),s=e.cssClass?` class="${this._esc(e.cssClass)}"`:"",a=e.id?` id="${this._esc(e.id)}"`:"",m=e.plotClipId||n,l=m?` clip-path="url(#${this._esc(m)})"`:"";return `<g${s}${a}${l}${i?.attrs??""}>
45
45
  ${o}
46
- </g>`}_esc(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}};function vi(t){return typeof requestAnimationFrame=="function"?requestAnimationFrame(t):setTimeout(()=>t(0),16)}function Ti(t){typeof cancelAnimationFrame=="function"?cancelAnimationFrame(t):clearTimeout(t);}function On(){let t=0,e=false;return {schedule:n=>{e||(e=true,t=vi(()=>{e=false,n();}));},cancel:()=>{e&&(e=false,Ti(t));}}}function lt(t,e,n){let r=t.getScreenCTM?.();if(r){let s=r.inverse();return {x:s.a*e+s.c*n+s.e,y:s.b*e+s.d*n+s.f}}let i=t.getBoundingClientRect(),o=t.viewBox?.baseVal;return o&&o.width>0&&o.height>0&&i.width>0&&i.height>0?{x:o.x+(e-i.left)*o.width/i.width,y:o.y+(n-i.top)*o.height/i.height}:{x:e-i.left,y:n-i.top}}var Wn="http://www.w3.org/2000/svg";function Be(t){return t.replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}function ki(t,e){if(t.length===0)return "";let n=t.map(i=>{let o=Be(i.point.overlayKind?`${i.series.name} (${i.point.overlayKind})`:i.series.name),s=Be(i.label??i.value.toFixed(2)),a=i.held?` (${Be(new Date(i.time).toLocaleTimeString())})`:"";return `<div><span class="mlc-tooltip__name">${o}:</span> ${s}${a}</div>`});return `<div class="mlc-tooltip__time">${Be(new Date(e.time).toLocaleString())}</div>${n.join("")}`}function je(t,e,n={}){let r=t.querySelector("svg");if(!r)throw new Error("attachTooltip: target has no <svg> child (did you mount the chart first?)");let i=n.format??ki,o=n.snapRadius??1/0,s=n.className??"mlc-tooltip",a=n.showPicks??true,m=n.pickRadius??5,l=n.picksClassName??"mlc-tooltip-picks",u=document.createElement("div");u.className=s,u.style.position="absolute",u.style.pointerEvents="none",u.style.display="none",getComputedStyle(t).position==="static"&&(t.style.position="relative"),t.appendChild(u);let h=null;a&&(h=document.createElementNS(Wn,"g"),h.setAttribute("class",l),h.setAttribute("pointer-events","none"),r.appendChild(h));let c=()=>{h&&h.replaceChildren();},p=new Map;e.series.forEach((w,T)=>{let _=w.id??w.name;p.has(_)||p.set(_,T);});let d=On(),g=null,f=w=>{let T=r.getBoundingClientRect(),_=lt(r,w.clientX,w.clientY),P=_.x,L=e.invertTime(P);if(!Number.isFinite(L)){u.style.display="none";return}let v=e.plotRect,C=Math.min(v.y+v.height,Math.max(v.y,_.y)),$=e.pointsAt(P,C,{...n.points,radius:o}).map(M=>{let D=p.get(M.seriesId)??0;return {seriesIndex:D,series:e.series[D],time:M.time,value:M.value??M.avg??0,x:M.x,y:M.y,...M.held?{held:true}:{},...M.label!==void 0?{label:M.label}:{},point:M}});if($.length===0){u.style.display="none",c();return}u.innerHTML=i($,{time:L});let B=t.getBoundingClientRect(),F=12,j=(w.clientX-T.left)/Math.max(1,T.width),E=(w.clientY-T.top)/Math.max(1,T.height),Y=j<.5?`${F}px`:`calc(-100% - ${F}px)`,A=E<.5?`${F}px`:`calc(-100% - ${F}px)`;if(u.style.left=`${w.clientX-B.left}px`,u.style.top=`${w.clientY-B.top}px`,u.style.transform=`translate(${Y}, ${A})`,u.style.display="",h){h.replaceChildren();for(let M of $){let D=document.createElementNS(Wn,"circle");D.setAttribute("cx",String(M.x)),D.setAttribute("cy",String(M.y)),D.setAttribute("r",String(m)),D.setAttribute("fill","#ffffff"),D.setAttribute("stroke",M.point.color),D.setAttribute("stroke-width","2"),D.setAttribute("class",`${l}__dot`),h.appendChild(D);}}},y=w=>{g=w,d.schedule(()=>{g&&f(g);});},b=()=>{g=null,d.cancel(),u.style.display="none",c();};r.addEventListener("mousemove",y),r.addEventListener("mouseleave",b);let S=false;return ()=>{S||(S=true,g=null,d.cancel(),r.removeEventListener("mousemove",y),r.removeEventListener("mouseleave",b),u.remove(),h&&h.remove());}}function _i(t,e={}){let n=Hn(t,"mount"),{tooltip:r,...i}=e,o=i.width??n.clientWidth??800,s=i.height??350,a=new V({...i,width:o,height:s});return Vn(n,a,o),r?.show&&je(n,a,r),a}function zn(t,e,n){let r=Hn(t,"GraphBuilder.mount"),{chart:i,width:o}=e(r.clientWidth||800);return Vn(r,i,o),n?.show&&je(r,i,n),i}function Hn(t,e){let n=typeof t=="string"?document.querySelector(t):t;if(!n)throw new Error(`${e}: target ${typeof t=="string"?`'${t}'`:""} not found`);return n}function Vn(t,e,n){let{content:r}=new J().render(e.renderCommands());t.innerHTML=r;let i=t.querySelector("svg");i&&(i.setAttribute("viewBox",`0 0 ${n} ${e.getHeight()}`),i.setAttribute("width","100%"),i.setAttribute("height",String(e.getHeight())));}var Fe=class{_opts;_series=[];_thresholds=[];_annotations=[];_highlights=[];_markers=[];_bands=[];_tooltip;constructor(e,n){this._opts={},e!==void 0&&(this._opts.width=e),n!==void 0&&(this._opts.height=n);}setWidth(e){return this._opts.width=e,this}setHeight(e){return this._opts.height=e,this}setSize(e,n){return this._opts.width=e,this._opts.height=n,this}setMargin(e,n,r,i){return typeof e=="object"?this._opts.margin=e:this._opts.margin={top:e,right:n??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,n){this._opts.axes??={},this._opts.axes.y??=[];let r=[...this._opts.axes.y];for(;r.length<=e;)r.push({});return r[e]={...r[e],...n},this._opts.axes.y=r,this}setLegend(e,n,r){return typeof e=="object"?this._opts.legend=e:this._opts.legend={show:e,position:n,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 V(this.toOptions())}getSvg(){let e=this.build(),{content:n}=new J().render(e.renderCommands());return n}mount(e){return zn(e,n=>(this._opts.width||(this._opts.width=n),{chart:this.build(),width:this._opts.width??800}),this._tooltip)}};var Ee=class{_series;constructor(e){this._series={name:e,data:[]};}addPoint(e,n){return this._series.data.push({time:e,value:n}),this}setData(e){return this._series.data=[...e],this}addPoints(e){return this._series.data.push(...e),this}addFloats(e,n){let r=Math.min(e.length,n.length);for(let i=0;i<r;i++)this._series.data.push({time:e[i],value:n[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,n,r){return this._series.style??={},this._series.style.line={color:e,width:n,style:r},this}setSmoothing(e,n){return this._series.style??={},!this._series.style.line||typeof this._series.style.line=="boolean"?this._series.style.line={smoothing:e,smoothingType:n}:Array.isArray(this._series.style.line)?this._series.style.line.length===0?this._series.style.line=[{smoothing:e,smoothingType:n}]:(this._series.style.line[0].smoothing=e,this._series.style.line[0].smoothingType=n):(this._series.style.line.smoothing=e,this._series.style.line.smoothingType=n),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,n){this._threshold={name:e,value:n};}setColor(e){return this._threshold.color=e,this}setLine(e){return this._threshold.line=e,this}setFill(e,n){return this._threshold.fill=e,this._threshold.fillOpacity=n,this}setFillHatch(e){return this._threshold.fillHatch=e,this}setLabel(e,n){return this._threshold.label={text:e,position:n},this}setID(e){return this._threshold.id=e,this}build(){return this._threshold}};var Ie=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 Oe=class{_highlight;constructor(e,n){this._highlight={startTime:e,endTime:n};}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 We=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,n,r){return this._ann.from={time:e,value:n,axis:r},this}setTo(e,n,r){return this._ann.to={time:e,value:n,axis:r},this}setAt(e,n,r){return this._ann.at={time:e,value:n,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 ze=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}setMinItemWidth(e){return this._band.minItemWidth=e,this}setLabels(e,n){return this._band.labels=n?{mode:e,keep:n}:e,this}setBackground(e){return this._band.background=e,this}addItem(e){return this._band.items.push(e),this}build(){return this._band}},He=class{_item;constructor(e,n){this._item={startTime:e,endTime:n};}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,n,r,i){return this._item.label=e,n!==void 0&&(this._item.labelFontSize=n),r!==void 0&&(this._item.labelFill=r),i!==void 0&&(this._item.labelBaseline=i),this}build(){return this._item}};function Ai(t){let{thresholds:e,colors:n,hatches:r}=t;if(n.length!==e.length+1)throw new Error(`fillBetweenThresholds: expected ${e.length+1} colors for ${e.length} thresholds, got ${n.length}`);if(r!==void 0&&r.length!==n.length)throw new Error(`fillBetweenThresholds: hatches length (${r.length}) must equal colors length (${n.length})`);return {regions:n.map((o,s)=>{let a=r?.[s],m=a?{color:o,hatch:a}:o;return s===0?{to:{threshold:e[0]},fill:m}:s===n.length-1?{from:{threshold:e[e.length-1]},fill:m}:{from:{threshold:e[s-1]},to:{threshold:e[s]},fill:m}})}}function mt(t){if(!t||typeof t!="object")throw new Error("DataPoint: object expected");let{time:e,value:n,annotation:r}=t;if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`DataPoint: invalid time=${e}`);if(n!==null&&(typeof n!="number"||Number.isNaN(n)))throw n===void 0?new Error("DataPoint: missing value"):typeof n=="object"&&"value"in n?new Error("DataPoint: nested value object"):new Error(`DataPoint: invalid value=${n}`);return {time:e,value:n,annotation:r&&typeof r=="string"?r:void 0}}function Mi(t){if(Array.isArray(t))return t.map(mt);if(t&&typeof t=="object"){let e=t,n=e.name,r=e.data,i=e.sensorType,o=e.enumMap,s=e.color,a=e.lineWidth,m=e.smoothing,l=e.seriesType;if(!n?.length)throw new Error("Series: name required");if(!Array.isArray(r))throw new Error("Series: data must be an array");let u=s!==void 0||a!==void 0||m!==void 0?{color:s,width:a,smoothing:m}:void 0;return {name:n,data:r.map(mt),sensorType:i??"numeric",enumMap:o,seriesType:l,...u&&{style:{line:u}}}}throw new Error("parseSeries: object or DataPoint[] expected")}function Ci(t){if(!t||typeof t!="object")throw new Error("parseAggregated: object expected");let e=t,n=e.name,r=e.data,i=e.showAs,o=e.avgLine,s=e.countOpacity,a=e.color;if(!n?.length)throw new Error("AggregatedSeries: name required");if(!Array.isArray(r))throw new Error("AggregatedSeries: data must be an array");return {name:n,data:Li(r),showAs:i,avgLine:o,countOpacity:s,...a!==void 0&&{style:{line:{color:a},fill:a}}}}function Li(t){let e=n=>typeof n=="number"?n:null;return t.map(n=>{let r=n;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 ut(t,e,n){return typeof e=="function"?e(t):t[e??n]}function Di(t,e,n){if(t instanceof Date){let r=t.getTime();if(Number.isNaN(r))throw new TypeError(`toDataPoints: invalid Date at row ${n}`);return r}if(typeof t=="string"){let r=Date.parse(t);if(Number.isNaN(r))throw new TypeError(`toDataPoints: unparsable time string at row ${n}: ${t}`);return r}if(typeof t=="number"&&Number.isFinite(t))return e==="s"||e==="auto"&&Math.abs(t)>=1e8&&Math.abs(t)<1e11?t*1e3:t;throw new TypeError(`toDataPoints: missing or invalid time at row ${n}: ${String(t)}`)}function $i(t,e){if(t==null)return null;if(typeof t=="number")return Number.isNaN(t)?null:t;if(typeof t=="string"){let n=t.trim();if(n==="")return null;let r=Number(n);if(Number.isNaN(r))throw new TypeError(`toDataPoints: value is not a number at row ${e}: ${t}`);return r}throw new TypeError(`toDataPoints: invalid value at row ${e}: ${String(t)}`)}function Nn(t,e={}){let n=e.timeUnit??"ms",r=[];for(let i=0;i<t.length;i++){let o=t[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]:ut(o,e.time,"time"),m=s&&e.value===void 0?o[1]:ut(o,e.value,"value"),l={time:Di(a,n,i),value:$i(m,i)};if(e.annotation!==void 0){let u=ut(o,e.annotation,"annotation");typeof u=="string"&&u!==""&&(l.annotation=u);}r.push(l);}return (e.sort??true)&&r.sort((i,o)=>i.time-o.time),r}function Pi(t,e,n={}){return {name:t,data:Nn(e,n)}}function Kn(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Yn(t,e){if(!Kn(t)||!Kn(e))return e;let n={...t};for(let[r,i]of Object.entries(e))n[r]=Yn(n[r],i);return n}function Ri(...t){let e;for(let n of t)n!==void 0&&(e=Yn(e,n));return e??{}}/*!
46
+ </g>`}_esc(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}};function ki(t){return typeof requestAnimationFrame=="function"?requestAnimationFrame(t):setTimeout(()=>t(0),16)}function Ti(t){typeof cancelAnimationFrame=="function"?cancelAnimationFrame(t):clearTimeout(t);}function On(){let t=0,e=false;return {schedule:n=>{e||(e=true,t=ki(()=>{e=false,n();}));},cancel:()=>{e&&(e=false,Ti(t));}}}function lt(t,e,n){let r=t.getScreenCTM?.();if(r){let s=r.inverse();return {x:s.a*e+s.c*n+s.e,y:s.b*e+s.d*n+s.f}}let i=t.getBoundingClientRect(),o=t.viewBox?.baseVal;return o&&o.width>0&&o.height>0&&i.width>0&&i.height>0?{x:o.x+(e-i.left)*o.width/i.width,y:o.y+(n-i.top)*o.height/i.height}:{x:e-i.left,y:n-i.top}}var Wn="http://www.w3.org/2000/svg";function Be(t){return t.replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}function _i(t,e){if(t.length===0)return "";let n=t.map(i=>{let o=Be(i.point.overlayKind?`${i.series.name} (${i.point.overlayKind})`:i.series.name),s=Be(i.label??i.value.toFixed(2)),a=i.held?` (${Be(new Date(i.time).toLocaleTimeString())})`:"";return `<div><span class="mlc-tooltip__name">${o}:</span> ${s}${a}</div>`});return `<div class="mlc-tooltip__time">${Be(new Date(e.time).toLocaleString())}</div>${n.join("")}`}function je(t,e,n={}){let r=t.querySelector("svg");if(!r)throw new Error("attachTooltip: target has no <svg> child (did you mount the chart first?)");let i=n.format??_i,o=n.snapRadius??1/0,s=n.className??"mlc-tooltip",a=n.showPicks??true,m=n.pickRadius??5,l=n.picksClassName??"mlc-tooltip-picks",u=document.createElement("div");u.className=s,u.style.position="absolute",u.style.pointerEvents="none",u.style.display="none",getComputedStyle(t).position==="static"&&(t.style.position="relative"),t.appendChild(u);let h=null;a&&(h=document.createElementNS(Wn,"g"),h.setAttribute("class",l),h.setAttribute("pointer-events","none"),r.appendChild(h));let c=()=>{h&&h.replaceChildren();},p=new Map;e.series.forEach((w,k)=>{let _=w.id??w.name;p.has(_)||p.set(_,k);});let d=On(),g=null,f=w=>{let k=r.getBoundingClientRect(),_=lt(r,w.clientX,w.clientY),P=_.x,L=e.invertTime(P);if(!Number.isFinite(L)){u.style.display="none";return}let v=e.plotRect,C=Math.min(v.y+v.height,Math.max(v.y,_.y)),$=e.pointsAt(P,C,{...n.points,radius:o}).map(M=>{let D=p.get(M.seriesId)??0;return {seriesIndex:D,series:e.series[D],time:M.time,value:M.value??M.avg??0,x:M.x,y:M.y,...M.held?{held:true}:{},...M.label!==void 0?{label:M.label}:{},point:M}});if($.length===0){u.style.display="none",c();return}u.innerHTML=i($,{time:L});let B=t.getBoundingClientRect(),F=12,j=(w.clientX-k.left)/Math.max(1,k.width),E=(w.clientY-k.top)/Math.max(1,k.height),Y=j<.5?`${F}px`:`calc(-100% - ${F}px)`,A=E<.5?`${F}px`:`calc(-100% - ${F}px)`;if(u.style.left=`${w.clientX-B.left}px`,u.style.top=`${w.clientY-B.top}px`,u.style.transform=`translate(${Y}, ${A})`,u.style.display="",h){h.replaceChildren();for(let M of $){let D=document.createElementNS(Wn,"circle");D.setAttribute("cx",String(M.x)),D.setAttribute("cy",String(M.y)),D.setAttribute("r",String(m)),D.setAttribute("fill","#ffffff"),D.setAttribute("stroke",M.point.color),D.setAttribute("stroke-width","2"),D.setAttribute("class",`${l}__dot`),h.appendChild(D);}}},y=w=>{g=w,d.schedule(()=>{g&&f(g);});},b=()=>{g=null,d.cancel(),u.style.display="none",c();};r.addEventListener("mousemove",y),r.addEventListener("mouseleave",b);let S=false;return ()=>{S||(S=true,g=null,d.cancel(),r.removeEventListener("mousemove",y),r.removeEventListener("mouseleave",b),u.remove(),h&&h.remove());}}function Ai(t,e={}){let n=Hn(t,"mount"),{tooltip:r,...i}=e,o=i.width??n.clientWidth??800,s=i.height??350,a=new V({...i,width:o,height:s});return Vn(n,a,o),r?.show&&je(n,a,r),a}function zn(t,e,n){let r=Hn(t,"GraphBuilder.mount"),{chart:i,width:o}=e(r.clientWidth||800);return Vn(r,i,o),n?.show&&je(r,i,n),i}function Hn(t,e){let n=typeof t=="string"?document.querySelector(t):t;if(!n)throw new Error(`${e}: target ${typeof t=="string"?`'${t}'`:""} not found`);return n}function Vn(t,e,n){let{content:r}=new J().render(e.renderCommands());t.innerHTML=r;let i=t.querySelector("svg");i&&(i.setAttribute("viewBox",`0 0 ${n} ${e.getHeight()}`),i.setAttribute("width","100%"),i.setAttribute("height",String(e.getHeight())));}var Fe=class{_opts;_series=[];_thresholds=[];_annotations=[];_highlights=[];_markers=[];_bands=[];_tooltip;constructor(e,n){this._opts={},e!==void 0&&(this._opts.width=e),n!==void 0&&(this._opts.height=n);}setWidth(e){return this._opts.width=e,this}setHeight(e){return this._opts.height=e,this}setSize(e,n){return this._opts.width=e,this._opts.height=n,this}setMargin(e,n,r,i){return typeof e=="object"?this._opts.margin=e:this._opts.margin={top:e,right:n??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,n){this._opts.axes??={},this._opts.axes.y??=[];let r=[...this._opts.axes.y];for(;r.length<=e;)r.push({});return r[e]={...r[e],...n},this._opts.axes.y=r,this}setLegend(e,n,r){return typeof e=="object"?this._opts.legend=e:this._opts.legend={show:e,position:n,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 V(this.toOptions())}getSvg(){let e=this.build(),{content:n}=new J().render(e.renderCommands());return n}mount(e){return zn(e,n=>(this._opts.width||(this._opts.width=n),{chart:this.build(),width:this._opts.width??800}),this._tooltip)}};var Ee=class{_series;constructor(e){this._series={name:e,data:[]};}addPoint(e,n){return this._series.data.push({time:e,value:n}),this}setData(e){return this._series.data=[...e],this}addPoints(e){return this._series.data.push(...e),this}addFloats(e,n){let r=Math.min(e.length,n.length);for(let i=0;i<r;i++)this._series.data.push({time:e[i],value:n[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,n,r){return this._series.style??={},this._series.style.line={color:e,width:n,style:r},this}setSmoothing(e,n){return this._series.style??={},!this._series.style.line||typeof this._series.style.line=="boolean"?this._series.style.line={smoothing:e,smoothingType:n}:Array.isArray(this._series.style.line)?this._series.style.line.length===0?this._series.style.line=[{smoothing:e,smoothingType:n}]:(this._series.style.line[0].smoothing=e,this._series.style.line[0].smoothingType=n):(this._series.style.line.smoothing=e,this._series.style.line.smoothingType=n),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,n){this._threshold={name:e,value:n};}setColor(e){return this._threshold.color=e,this}setLine(e){return this._threshold.line=e,this}setFill(e,n){return this._threshold.fill=e,this._threshold.fillOpacity=n,this}setFillHatch(e){return this._threshold.fillHatch=e,this}setLabel(e,n){return this._threshold.label={text:e,position:n},this}setID(e){return this._threshold.id=e,this}build(){return this._threshold}};var Ie=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 Oe=class{_highlight;constructor(e,n){this._highlight={startTime:e,endTime:n};}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 We=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,n,r){return this._ann.from={time:e,value:n,axis:r},this}setTo(e,n,r){return this._ann.to={time:e,value:n,axis:r},this}setAt(e,n,r){return this._ann.at={time:e,value:n,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 ze=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}setMinItemWidth(e){return this._band.minItemWidth=e,this}setLabels(e,n){return this._band.labels=n?{mode:e,keep:n}:e,this}setBackground(e){return this._band.background=e,this}addItem(e){return this._band.items.push(e),this}build(){return this._band}},He=class{_item;constructor(e,n){this._item={startTime:e,endTime:n};}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,n,r,i){return this._item.label=e,n!==void 0&&(this._item.labelFontSize=n),r!==void 0&&(this._item.labelFill=r),i!==void 0&&(this._item.labelBaseline=i),this}build(){return this._item}};function Mi(t){let{thresholds:e,colors:n,hatches:r}=t;if(n.length!==e.length+1)throw new Error(`fillBetweenThresholds: expected ${e.length+1} colors for ${e.length} thresholds, got ${n.length}`);if(r!==void 0&&r.length!==n.length)throw new Error(`fillBetweenThresholds: hatches length (${r.length}) must equal colors length (${n.length})`);return {regions:n.map((o,s)=>{let a=r?.[s],m=a?{color:o,hatch:a}:o;return s===0?{to:{threshold:e[0]},fill:m}:s===n.length-1?{from:{threshold:e[e.length-1]},fill:m}:{from:{threshold:e[s-1]},to:{threshold:e[s]},fill:m}})}}function mt(t){if(!t||typeof t!="object")throw new Error("DataPoint: object expected");let{time:e,value:n,annotation:r}=t;if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`DataPoint: invalid time=${e}`);if(n!==null&&(typeof n!="number"||Number.isNaN(n)))throw n===void 0?new Error("DataPoint: missing value"):typeof n=="object"&&"value"in n?new Error("DataPoint: nested value object"):new Error(`DataPoint: invalid value=${n}`);return {time:e,value:n,annotation:r&&typeof r=="string"?r:void 0}}function Ci(t){if(Array.isArray(t))return t.map(mt);if(t&&typeof t=="object"){let e=t,n=e.name,r=e.data,i=e.sensorType,o=e.enumMap,s=e.color,a=e.lineWidth,m=e.smoothing,l=e.seriesType;if(!n?.length)throw new Error("Series: name required");if(!Array.isArray(r))throw new Error("Series: data must be an array");let u=s!==void 0||a!==void 0||m!==void 0?{color:s,width:a,smoothing:m}:void 0;return {name:n,data:r.map(mt),sensorType:i??"numeric",enumMap:o,seriesType:l,...u&&{style:{line:u}}}}throw new Error("parseSeries: object or DataPoint[] expected")}function Li(t){if(!t||typeof t!="object")throw new Error("parseAggregated: object expected");let e=t,n=e.name,r=e.data,i=e.showAs,o=e.avgLine,s=e.countOpacity,a=e.color;if(!n?.length)throw new Error("AggregatedSeries: name required");if(!Array.isArray(r))throw new Error("AggregatedSeries: data must be an array");return {name:n,data:Di(r),showAs:i,avgLine:o,countOpacity:s,...a!==void 0&&{style:{line:{color:a},fill:a}}}}function Di(t){let e=n=>typeof n=="number"?n:null;return t.map(n=>{let r=n;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 ut(t,e,n){return typeof e=="function"?e(t):t[e??n]}function $i(t,e,n){if(t instanceof Date){let r=t.getTime();if(Number.isNaN(r))throw new TypeError(`toDataPoints: invalid Date at row ${n}`);return r}if(typeof t=="string"){let r=Date.parse(t);if(Number.isNaN(r))throw new TypeError(`toDataPoints: unparsable time string at row ${n}: ${t}`);return r}if(typeof t=="number"&&Number.isFinite(t))return e==="s"||e==="auto"&&Math.abs(t)>=1e8&&Math.abs(t)<1e11?t*1e3:t;throw new TypeError(`toDataPoints: missing or invalid time at row ${n}: ${String(t)}`)}function Pi(t,e){if(t==null)return null;if(typeof t=="number")return Number.isNaN(t)?null:t;if(typeof t=="string"){let n=t.trim();if(n==="")return null;let r=Number(n);if(Number.isNaN(r))throw new TypeError(`toDataPoints: value is not a number at row ${e}: ${t}`);return r}throw new TypeError(`toDataPoints: invalid value at row ${e}: ${String(t)}`)}function Nn(t,e={}){let n=e.timeUnit??"ms",r=[];for(let i=0;i<t.length;i++){let o=t[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]:ut(o,e.time,"time"),m=s&&e.value===void 0?o[1]:ut(o,e.value,"value"),l={time:$i(a,n,i),value:Pi(m,i)};if(e.annotation!==void 0){let u=ut(o,e.annotation,"annotation");typeof u=="string"&&u!==""&&(l.annotation=u);}r.push(l);}return (e.sort??true)&&r.sort((i,o)=>i.time-o.time),r}function Ri(t,e,n={}){return {name:t,data:Nn(e,n)}}function Kn(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Yn(t,e){if(!Kn(t)||!Kn(e))return e;let n={...t};for(let[r,i]of Object.entries(e))n[r]=Yn(n[r],i);return n}function Bi(...t){let e;for(let n of t)n!==void 0&&(e=Yn(e,n));return e??{}}/*!
47
47
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
48
48
  * MIT with Attribution: free use incl. commercial requires visible credit to
49
49
  * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
@@ -62,4 +62,4 @@ ${o}
62
62
  * ml-time-analyze — Copyright (c) 2026 Michael Lechner
63
63
  * MIT with Attribution: free use incl. commercial requires visible credit to
64
64
  * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
65
- */export{ze as AnnotationBandBuilder,He as AnnotationBandItemBuilder,We as AnnotationBuilder,Fe as GraphBuilder,Oe as HighlightBuilder,V as MLTimeGraph,Ie as MarkerBuilder,J as SVGRenderer,Ge as ThresholdBuilder,Ee as TimeSeriesBuilder,st as VERSION,je as attachTooltip,Ke as autoMargin,ui as axisGroups,$e as drawMarker,nr as estimateMetrics,Ai as fillBetweenThresholds,cr as getDefaultTheme,vt as getLineStyle,O as liberationMetrics,Ri as mergeOptions,_i as mount,Ci as parseAggregated,mt as parseDataPoint,Mi as parseSeries,dr as resetDefaultTheme,qe as resolveDash,hr as setDefaultTheme,N as slugify,Nn as toDataPoints,Pi as toSeries,lt as zeigerImSvg};
65
+ */export{ze as AnnotationBandBuilder,He as AnnotationBandItemBuilder,We as AnnotationBuilder,Fe as GraphBuilder,Oe as HighlightBuilder,V as MLTimeGraph,Ie as MarkerBuilder,J as SVGRenderer,Ge as ThresholdBuilder,Ee as TimeSeriesBuilder,st as VERSION,je as attachTooltip,Ke as autoMargin,hi as axisGroups,$e as drawMarker,nr as estimateMetrics,Mi as fillBetweenThresholds,cr as getDefaultTheme,vt as getLineStyle,O as liberationMetrics,Bi as mergeOptions,Ai as mount,Li as parseAggregated,mt as parseDataPoint,Ci as parseSeries,dr as resetDefaultTheme,qe as resolveDash,hr as setDefaultTheme,N as slugify,Nn as toDataPoints,Ri as toSeries,lt as zeigerImSvg};
@@ -1,9 +1,9 @@
1
- import { u as RenderingContext, F as FlatSeriesStyle } from './marker_renderer-Be-IsY5V.js';
1
+ import { u as RenderingContext, F as FlatSeriesStyle } from './marker_renderer-Dph9cKDY.js';
2
2
  import { Theme, TextMetrics, Marker } from './index.js';
3
- export { v as Layout, w as LayoutConfig, a as LayoutResult, x as LegendConfig, L as LegendItem, e as LegendOrientation, R as Renderer, y as measureLegend, z as renderLegend, B as renderSeriesMarkers, t as slugify } from './marker_renderer-Be-IsY5V.js';
4
- import { a as DrawCommand, L as LinearScale, T as TimeScale, ad as LineParams, ae as PathParams, af as RectParams, ag as CircleParams, ah as TextParams, ai as GapParams, d as DrawGroup, B as AxisOrientation, A as AxisPosition, aj as Point, ak as BandScale } from './types-fDUNEN4P.js';
3
+ export { v as Layout, w as LayoutConfig, a as LayoutResult, x as LegendConfig, L as LegendItem, e as LegendOrientation, R as Renderer, y as measureLegend, z as renderLegend, B as renderSeriesMarkers, t as slugify } from './marker_renderer-Dph9cKDY.js';
4
+ import { a as DrawCommand, L as LinearScale, T as TimeScale, ae as LineParams, af as PathParams, ag as RectParams, ah as CircleParams, ai as TextParams, aj as GapParams, d as DrawGroup, B as AxisOrientation, A as AxisPosition, ak as Point, al as BandScale } from './types-B9bbJxmn.js';
5
5
  import { DataPoint, AggregatedPoint, HatchVariant, Threshold, Gap, RangeLabelPosition, GapBand, Highlight, Annotation, MovingAverageType, EnumMap, SmoothingType, PointStyleType, AnnotationBandItem, AnnotationBandLabels, LineVariant, LineShape, FillSpec, GapStyle, TimeSeries } from './index.js';
6
- export { al as BandScaleConfig, am as Dashstyle_t, an as DomainScaleConfig, ao as DrawCircle, ap as DrawGap, aq as DrawGapType_t, ar as DrawLine, as as DrawPath, at as DrawRect, au as DrawText, q as LabelAnchor, av as LinearScaleConfig, aw as Scale, ax as ScaleConfig, ay as TIME_INTERVALS, az as TimeScaleConfig, aA as getHatch } from './types-fDUNEN4P.js';
6
+ export { am as BandScaleConfig, an as Dashstyle_t, ao as DomainScaleConfig, ap as DrawCircle, aq as DrawGap, ar as DrawGapType_t, as as DrawLine, at as DrawPath, au as DrawRect, av as DrawText, q as LabelAnchor, aw as LinearScaleConfig, ax as Scale, ay as ScaleConfig, az as TIME_INTERVALS, aA as TimeScaleConfig, aB as getHatch } from './types-B9bbJxmn.js';
7
7
  import { DataPoint as DataPoint$1 } from './analyze/index.js';
8
8
 
9
9
  /*!
package/dist/internals.js CHANGED
@@ -1,30 +1,30 @@
1
- var Z=class{};var T=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((s,a)=>s.time-a.time),r=[],o=[],l=null;for(let s of n){let a=e(s),m=t>0&&l&&s.time-l.time>t;(a||m)&&o.length&&(r.push(o),o=[]),a||o.push(s),l=s;}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((m,h)=>m-h),o=[],l=m=>m<=0?Number.NEGATIVE_INFINITY:r[m-1],s=m=>{let h=0;for(let d=0;d<r.length&&m>=r[d];d++)h=d+1;return h},a=[i[0]];for(let m=1;m<i.length;m++){let h=i[m-1],d=i[m],p=t(h),u=t(d),c;u>p?c=r.filter(g=>g>p&&g<=u):u<p?c=r.filter(g=>g>=u&&g<p).reverse():c=[];let b=p;for(let g of c){let y=(g-p)/(u-p),x=n(h,d,y);a.push(x);let S=s((b+g)/2);o.push({data:a,zoneIndex:S,zoneLow:l(S)}),a=[x],b=g;}(c.length===0||c[c.length-1]!==u)&&a.push(d);}if(a.length>1||i.length===1){let m=t(a[0]),h=t(a[a.length-1]),d=s((m+h)/2);o.push({data:a,zoneIndex:d,zoneLow:l(d)});}return o}static splitByThreshold(i,e,t,n){let r=this.splitByBoundaries(i,[e],t,n),o={above:[],below:[]};for(let l of r)l.zoneIndex===0?o.below.push(l.data):o.above.push(l.data);return o}};var ye=class{static compute(i){let e=i.map(s=>s.value).filter(s=>s!==null).sort((s,a)=>s-a);if(e.length===0)return {min:NaN,max:NaN,avg:NaN,mean:NaN,median:NaN,stdDev:NaN,count:0};let t=e.length,n=e.reduce((s,a)=>s+a,0)/t,r=t%2===1?e[Math.floor(t/2)]:(e[t/2-1]+e[t/2])/2,o=e.reduce((s,a)=>s+Math.pow(a-n,2),0)/t,l=Math.sqrt(o);return {min:e[0],max:e[t-1],avg:n,mean:n,median:r,stdDev:l,count:t}}static computeInRange(i,e,t){let n=i.filter(r=>r.time>=e&&r.time<=t);return this.compute(n)}};function K(i){let e=[];for(let t of i)e.length===0?e.push(t):e.push({x:t.x,y:e[e.length-1].y},t);return e}function We(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}function A(i){return {id:i.id,line:{stroke:i.stroke??f.stroke,strokeWidth:i.strokeWidth??f.strokeWidth,smoothing:i.smoothing??false,smoothingType:i.smoothingType,dashed:i.dashed??false},fill:i.fill??f.areaFillAlpha,markers:{type:i.pointStyle??"none",size:i.pointSize??f.pointSize,stroke:i.stroke??f.stroke,fill:"#ffffff"},shadow:{color:i.shadowColor??"transparent",blur:i.shadowBlur??0,offsetX:i.shadowOffsetX??0,offsetY:i.shadowOffsetY??0}}}function je(i,e,t,n){let r=T.splitByThreshold(i,e,l=>l.value,T.interpolateDataPoint),o=[];return n.below&&o.push(...L(r.below.map(l=>({data:l})),t,n.below)),n.above&&o.push(...L(r.above.map(l=>({data:l})),t,n.above)),o}function L(i,e,t){let n=[],r=A(t);for(let o=0;o<i.length;o++){let l=i[o];l.data.length>=2?n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${o}`:void 0,points:l.data.map(s=>({x:e.timeScale.map(s.time),y:e.valueScale.map(s.value)})),stroke:l.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:r.line.smoothing,smoothingType:r.line.smoothingType,dashed:r.line.dashed,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur,shadowOffsetX:r.shadow.offsetX,shadowOffsetY:r.shadow.offsetY,fill:"none"}):l.data.length===1&&n.push({type:"circle",id:t.id?`${t.id}-dot-${o}`:void 0,cx:e.timeScale.map(l.data[0].time),cy:e.valueScale.map(l.data[0].value),r:Math.max(r.markers.size,r.line.strokeWidth),fill:l.color??r.line.stroke,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur});}return n}function q(i,e,t){let n=[],r=A(t);for(let o=0;o<i.length;o++){let l=i[o];if(l.data.length<2)continue;let s=K(l.data.map(a=>({x:e.timeScale.map(a.time),y:e.valueScale.map(a.value)})));n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${o}`:void 0,points:s,stroke:l.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:false,fill:"none"});}return n}function Be(i,e,t,n,r){let o=[],l=A(t);for(let s=0;s<i.length;s++){let a=i[s];if(a.data.length<2)continue;let m=a.data.map(d=>({x:e.timeScale.map(d.time),y:e.valueScale.map(n(d))})),h=a.data.map(d=>({x:e.timeScale.map(d.time),y:e.valueScale.map(r(d))})).reverse();o.push({type:"path",cssClass:"series-fill",id:t.id?`${t.id}-fill-${s}`:void 0,points:[...m,...h],fill:a.color??l.fill,hatch:t.hatch,stroke:"none"});}return o}function J(i,e,t,n){if(i.length<2)return [];let r=T.splitByBoundaries(i,t.boundaries,t.getValue,t.interpolate),o=[];for(let l=0;l<r.length;l++){let s=r[l];if(s.data.length<2)continue;let a=t.getColor(s.zoneIndex);if(!a)continue;let m=s.data.map(d=>({x:e.timeScale.map(d.time),y:e.valueScale.map(t.yLow(d))})),h=s.data.map(d=>({x:e.timeScale.map(d.time),y:e.valueScale.map(t.yHigh(d))})).reverse();o.push({type:"path",cssClass:"series-fill",id:n?.id?`${n.id}-fill-${l}`:void 0,points:[...m,...h],fill:a,hatch:t.getHatch?.(s.zoneIndex),stroke:"none",...n?.smoothing?{smoothing:true,smoothingType:n.smoothingType,smoothCount:s.data.length,smoothTail:s.data.length}:{}});}return o}function Q(i,e,t,n){let r=A(t);if(!r.markers.type||r.markers.type==="none")return [];let o=[];for(let l=0;l<i.length;l++){let s=i[l],a=e.timeScale.map(s.time),m=e.valueScale.map(s.value),h=n(s),d=t.pointStroke??h,p=t.pointFill??h,u=t.pointStrokeWidth??1.5,c=t.id?`${t.id}-marker-${l}`:void 0;ee(o,c,r.markers.type,a,m,r.markers.size,d,p,u);}return o.length===0?[]:[{type:"group",cssClass:"series-markers",sharedStyles:true,commands:o}]}function ee(i,e,t,n,r,o,l,s,a){let m=h=>e===void 0?void 0:`${e}-${h}`;switch(t){case "circle":i.push({type:"circle",cx:n,cy:r,r:o,fill:s,stroke:l,strokeWidth:a,id:e});break;case "square":i.push({type:"rect",x:n-o,y:r-o,w:o*2,h:o*2,fill:s,stroke:l,strokeWidth:a,id:e});break;case "cross":i.push({type:"line",x1:n-o,y1:r-o,x2:n+o,y2:r+o,stroke:l,strokeWidth:a,id:e},{type:"line",x1:n-o,y1:r+o,x2:n+o,y2:r-o,stroke:l,strokeWidth:a,id:m(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:s,stroke:l,strokeWidth:a,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:s,stroke:l,strokeWidth:a,id:e});break;case "star":{let h=[];for(let d=0;d<10;d++){let p=d%2===0?o:o*.5,u=Math.PI/2*3+d*Math.PI/5;h.push({x:n+p*Math.cos(u),y:r+p*Math.sin(u)});}i.push({type:"path",points:h,closed:true,fill:s,stroke:l,strokeWidth:a,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:l,strokeWidth:a,fill:"none",id:e});break;case "plus":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:l,strokeWidth:a,id:e},{type:"line",x1:n,y1:r-o,x2:n,y2:r+o,stroke:l,strokeWidth:a,id:m(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:s,stroke:l,strokeWidth:a,id:e});break;case "hexagon":{let h=[];for(let d=0;d<6;d++){let p=d*(Math.PI/3);h.push({x:n+o*Math.cos(p),y:r+o*Math.sin(p)});}i.push({type:"path",points:h,closed:true,fill:s,stroke:l,strokeWidth:a,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:s,stroke:l,strokeWidth:a,id:e});break;case "line-horizontal":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:l,strokeWidth:a,id:e});break;default:i.push({type:"circle",cx:n,cy:r,r:o,fill:s,stroke:l,strokeWidth:a,id:e});}}var Ie=[[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"]],xe=.6,Oe=(()=>{let i=new Map;for(let[e,,t]of Ie){let n=t.split(",");for(let r=0;r<n.length;r++)i.set(e+r,Number(n[r])/1e3);}return i})();function Se(i){return Oe.get(i)??xe}var _=(i,e)=>{let t=0;for(let n of i)t+=Se(n.codePointAt(0)??0);return t*e};var ke={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 Ee={...ke};function D(){return Ee}function Ge(i){let e=i.trim();if(e.startsWith("#"))return e.length===9?e.slice(0,7):e.length===5?e.slice(0,4):e;if(e.toLowerCase().startsWith("rgba(")){let n=e.slice(5,e.lastIndexOf(")")).split(",");if(n.length===4)return `rgb(${n[0].trim()}, ${n[1].trim()}, ${n[2].trim()})`}return e}function He(i){let e=i.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function Te(i,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",n,r=2){let o=n??Ge(t),l=He(t)?"":' fill-opacity="0.3"';if(e==="none")return `
1
+ var Z=class{};var w=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((s,a)=>s.time-a.time),r=[],o=[],l=null;for(let s of n){let a=e(s),m=t>0&&l&&s.time-l.time>t;(a||m)&&o.length&&(r.push(o),o=[]),a||o.push(s),l=s;}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((m,d)=>m-d),o=[],l=m=>m<=0?Number.NEGATIVE_INFINITY:r[m-1],s=m=>{let d=0;for(let c=0;c<r.length&&m>=r[c];c++)d=c+1;return d},a=[i[0]];for(let m=1;m<i.length;m++){let d=i[m-1],c=i[m],p=t(d),h=t(c),u;h>p?u=r.filter(g=>g>p&&g<=h):h<p?u=r.filter(g=>g>=h&&g<p).reverse():u=[];let b=p;for(let g of u){let y=(g-p)/(h-p),x=n(d,c,y);a.push(x);let S=s((b+g)/2);o.push({data:a,zoneIndex:S,zoneLow:l(S)}),a=[x],b=g;}(u.length===0||u[u.length-1]!==h)&&a.push(c);}if(a.length>1||i.length===1){let m=t(a[0]),d=t(a[a.length-1]),c=s((m+d)/2);o.push({data:a,zoneIndex:c,zoneLow:l(c)});}return o}static splitByThreshold(i,e,t,n){let r=this.splitByBoundaries(i,[e],t,n),o={above:[],below:[]};for(let l of r)l.zoneIndex===0?o.below.push(l.data):o.above.push(l.data);return o}};var ye=class{static compute(i){let e=i.map(s=>s.value).filter(s=>s!==null).sort((s,a)=>s-a);if(e.length===0)return {min:NaN,max:NaN,avg:NaN,mean:NaN,median:NaN,stdDev:NaN,count:0};let t=e.length,n=e.reduce((s,a)=>s+a,0)/t,r=t%2===1?e[Math.floor(t/2)]:(e[t/2-1]+e[t/2])/2,o=e.reduce((s,a)=>s+Math.pow(a-n,2),0)/t,l=Math.sqrt(o);return {min:e[0],max:e[t-1],avg:n,mean:n,median:r,stdDev:l,count:t}}static computeInRange(i,e,t){let n=i.filter(r=>r.time>=e&&r.time<=t);return this.compute(n)}};function K(i){let e=[];for(let t of i)e.length===0?e.push(t):e.push({x:t.x,y:e[e.length-1].y},t);return e}function We(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}function A(i){return {id:i.id,line:{stroke:i.stroke??f.stroke,strokeWidth:i.strokeWidth??f.strokeWidth,smoothing:i.smoothing??false,smoothingType:i.smoothingType,dashed:i.dashed??false},fill:i.fill??f.areaFillAlpha,markers:{type:i.pointStyle??"none",size:i.pointSize??f.pointSize,stroke:i.stroke??f.stroke,fill:"#ffffff"},shadow:{color:i.shadowColor??"transparent",blur:i.shadowBlur??0,offsetX:i.shadowOffsetX??0,offsetY:i.shadowOffsetY??0}}}function je(i,e,t,n){let r=w.splitByThreshold(i,e,l=>l.value,w.interpolateDataPoint),o=[];return n.below&&o.push(...L(r.below.map(l=>({data:l})),t,n.below)),n.above&&o.push(...L(r.above.map(l=>({data:l})),t,n.above)),o}function L(i,e,t){let n=[],r=A(t);for(let o=0;o<i.length;o++){let l=i[o];l.data.length>=2?n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${o}`:void 0,points:l.data.map(s=>({x:e.timeScale.map(s.time),y:e.valueScale.map(s.value)})),stroke:l.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:r.line.smoothing,smoothingType:r.line.smoothingType,dashed:r.line.dashed,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur,shadowOffsetX:r.shadow.offsetX,shadowOffsetY:r.shadow.offsetY,fill:"none"}):l.data.length===1&&n.push({type:"circle",id:t.id?`${t.id}-dot-${o}`:void 0,cx:e.timeScale.map(l.data[0].time),cy:e.valueScale.map(l.data[0].value),r:Math.max(r.markers.size,r.line.strokeWidth),fill:l.color??r.line.stroke,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur});}return n}function q(i,e,t){let n=[],r=A(t);for(let o=0;o<i.length;o++){let l=i[o];if(l.data.length<2)continue;let s=K(l.data.map(a=>({x:e.timeScale.map(a.time),y:e.valueScale.map(a.value)})));n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${o}`:void 0,points:s,stroke:l.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:false,fill:"none"});}return n}function Be(i,e,t,n,r){let o=[],l=A(t);for(let s=0;s<i.length;s++){let a=i[s];if(a.data.length<2)continue;let m=a.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(n(c))})),d=a.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(r(c))})).reverse();o.push({type:"path",cssClass:"series-fill",id:t.id?`${t.id}-fill-${s}`:void 0,points:[...m,...d],fill:a.color??l.fill,hatch:t.hatch,stroke:"none"});}return o}function J(i,e,t,n){if(i.length<2)return [];let r=w.splitByBoundaries(i,t.boundaries,t.getValue,t.interpolate),o=[];for(let l=0;l<r.length;l++){let s=r[l];if(s.data.length<2)continue;let a=t.getColor(s.zoneIndex);if(!a)continue;let m=s.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yLow(c))})),d=s.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yHigh(c))})).reverse();o.push({type:"path",cssClass:"series-fill",id:n?.id?`${n.id}-fill-${l}`:void 0,points:[...m,...d],fill:a,hatch:t.getHatch?.(s.zoneIndex),stroke:"none",...n?.smoothing?{smoothing:true,smoothingType:n.smoothingType,smoothCount:s.data.length,smoothTail:s.data.length}:{}});}return o}function Q(i,e,t,n){let r=A(t);if(!r.markers.type||r.markers.type==="none")return [];let o=[];for(let l=0;l<i.length;l++){let s=i[l],a=e.timeScale.map(s.time),m=e.valueScale.map(s.value),d=n(s),c=t.pointStroke??d,p=t.pointFill??d,h=t.pointStrokeWidth??1.5,u=t.id?`${t.id}-marker-${l}`:void 0;ee(o,u,r.markers.type,a,m,r.markers.size,c,p,h);}return o.length===0?[]:[{type:"group",cssClass:"series-markers",sharedStyles:true,commands:o}]}function ee(i,e,t,n,r,o,l,s,a){let m=d=>e===void 0?void 0:`${e}-${d}`;switch(t){case "circle":i.push({type:"circle",cx:n,cy:r,r:o,fill:s,stroke:l,strokeWidth:a,id:e});break;case "square":i.push({type:"rect",x:n-o,y:r-o,w:o*2,h:o*2,fill:s,stroke:l,strokeWidth:a,id:e});break;case "cross":i.push({type:"line",x1:n-o,y1:r-o,x2:n+o,y2:r+o,stroke:l,strokeWidth:a,id:e},{type:"line",x1:n-o,y1:r+o,x2:n+o,y2:r-o,stroke:l,strokeWidth:a,id:m(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:s,stroke:l,strokeWidth:a,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:s,stroke:l,strokeWidth:a,id:e});break;case "star":{let d=[];for(let c=0;c<10;c++){let p=c%2===0?o:o*.5,h=Math.PI/2*3+c*Math.PI/5;d.push({x:n+p*Math.cos(h),y:r+p*Math.sin(h)});}i.push({type:"path",points:d,closed:true,fill:s,stroke:l,strokeWidth:a,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:l,strokeWidth:a,fill:"none",id:e});break;case "plus":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:l,strokeWidth:a,id:e},{type:"line",x1:n,y1:r-o,x2:n,y2:r+o,stroke:l,strokeWidth:a,id:m(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:s,stroke:l,strokeWidth:a,id:e});break;case "hexagon":{let d=[];for(let c=0;c<6;c++){let p=c*(Math.PI/3);d.push({x:n+o*Math.cos(p),y:r+o*Math.sin(p)});}i.push({type:"path",points:d,closed:true,fill:s,stroke:l,strokeWidth:a,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:s,stroke:l,strokeWidth:a,id:e});break;case "line-horizontal":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:l,strokeWidth:a,id:e});break;default:i.push({type:"circle",cx:n,cy:r,r:o,fill:s,stroke:l,strokeWidth:a,id:e});}}var Ie=[[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"]],xe=.6,Oe=(()=>{let i=new Map;for(let[e,,t]of Ie){let n=t.split(",");for(let r=0;r<n.length;r++)i.set(e+r,Number(n[r])/1e3);}return i})();function Se(i){return Oe.get(i)??xe}var _=(i,e)=>{let t=0;for(let n of i)t+=Se(n.codePointAt(0)??0);return t*e};var ke={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 Ee={...ke};function D(){return Ee}function Ge(i){let e=i.trim();if(e.startsWith("#"))return e.length===9?e.slice(0,7):e.length===5?e.slice(0,4):e;if(e.toLowerCase().startsWith("rgba(")){let n=e.slice(5,e.lastIndexOf(")")).split(",");if(n.length===4)return `rgb(${n[0].trim()}, ${n[1].trim()}, ${n[2].trim()})`}return e}function He(i){let e=i.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function Te(i,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",n,r=2){let o=n??Ge(t),l=He(t)?"":' fill-opacity="0.3"';if(e==="none")return `
2
2
  <pattern id="${i}" width="10" height="10" patternUnits="userSpaceOnUse">
3
3
  <rect width="10" height="10" fill="${t}" />
4
4
  </pattern>
5
- `.trim();let s=12,a=12,m="rotate(0)",h="";switch(e){case "classic-diagonal":m="rotate(45)",h=`<line x1="0" y1="0" x2="0" y2="${a}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />`;break;case "dense-steep":s=6,a=6,m="rotate(30)",h=`<line x1="0" y1="0" x2="0" y2="${a}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />`;break;case "crosshatch":s=14,a=14,m="rotate(45)",h=`
5
+ `.trim();let s=12,a=12,m="rotate(0)",d="";switch(e){case "classic-diagonal":m="rotate(45)",d=`<line x1="0" y1="0" x2="0" y2="${a}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />`;break;case "dense-steep":s=6,a=6,m="rotate(30)",d=`<line x1="0" y1="0" x2="0" y2="${a}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />`;break;case "crosshatch":s=14,a=14,m="rotate(45)",d=`
6
6
  <line x1="0" y1="0" x2="0" y2="${a}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
7
7
  <line x1="0" y1="0" x2="${s}" y2="0" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
8
- `;break;case "dots":h=`<circle cx="${s/2}" cy="${a/2}" r="${r*1.2}" fill="${o}" />`;break;case "waves":s=16,a=16,h=`
8
+ `;break;case "dots":d=`<circle cx="${s/2}" cy="${a/2}" r="${r*1.2}" fill="${o}" />`;break;case "waves":s=16,a=16,d=`
9
9
  <path d="M 0 ${a/2} Q ${s/4} 0, ${s/2} ${a/2} T ${s} ${a/2}" fill="none" stroke="${o}" stroke-width="${r}" stroke-linecap="round" />
10
- `;break;case "dashed":m="rotate(45)",h=`<line x1="0" y1="0" x2="0" y2="${a}" stroke="${o}" stroke-width="${r}" stroke-dasharray="3,3" />`;break;case "herringbone":s=16,a=16,h=`
10
+ `;break;case "dashed":m="rotate(45)",d=`<line x1="0" y1="0" x2="0" y2="${a}" stroke="${o}" stroke-width="${r}" stroke-dasharray="3,3" />`;break;case "herringbone":s=16,a=16,d=`
11
11
  <path d="M 0 0 L ${s/2} ${a/2} L 0 ${a} M ${s} 0 L ${s/2} ${a/2} L ${s} ${a}" fill="none" stroke="${o}" stroke-width="${r}" stroke-linejoin="round" stroke-linecap="round" />
12
- `;break;case "brick":s=20,a=20,h=`
12
+ `;break;case "brick":s=20,a=20,d=`
13
13
  <path d="M 0 ${a/2} L ${s} ${a/2} M 0 ${a} L ${s} ${a} M ${s/2} 0 L ${s/2} ${a/2} M 0 ${a/2} L 0 ${a}" fill="none" stroke="${o}" stroke-width="${r}" />
14
- `;break;case "double-stripe":s=16,a=16,m="rotate(45)",h=`
14
+ `;break;case "double-stripe":s=16,a=16,m="rotate(45)",d=`
15
15
  <line x1="0" y1="0" x2="0" y2="${a}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
16
16
  <line x1="${s/2}" y1="0" x2="${s/2}" y2="${a}" stroke="${o}" stroke-width="${r/2}" stroke-linecap="square" />
17
- `;break;case "honeycomb":s=18,a=32,h=`
17
+ `;break;case "honeycomb":s=18,a=32,d=`
18
18
  <path d="M 0 0 L ${s/2} 5 L ${s} 0 M 0 16 L ${s/2} 11 L ${s} 16 M 0 16 L 0 32 M ${s/2} 5 L ${s/2} 11 M ${s} 16 L ${s} 32 M 0 32 L ${s/2} 27 L ${s} 32 M ${s/2} 27 L ${s/2} 32" fill="none" stroke="${o}" stroke-width="${r}" stroke-linejoin="round" stroke-linecap="round" />
19
- `;break}let d=`<rect width="${s}" height="${a}" fill="${t}"${l} />`;return `
19
+ `;break}let c=`<rect width="${s}" height="${a}" fill="${t}"${l} />`;return `
20
20
  <pattern id="${i}" width="${s}" height="${a}" patternTransform="${m}" patternUnits="userSpaceOnUse">
21
+ ${c}
21
22
  ${d}
22
- ${h}
23
23
  </pattern>
24
- `.trim()}var f=new Proxy({},{get:(i,e)=>D()[e],has:(i,e)=>e in D(),ownKeys:()=>Reflect.ownKeys(D()),getOwnPropertyDescriptor:(i,e)=>Reflect.getOwnPropertyDescriptor(D(),e)});var B=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 Ve="#ffffff",Ne="#cccccc",Xe=6,Ye=.85,C=12,N=8,I=20,Ue=11,V=18,te=(i,e)=>e(i,Ue);function we(i,e,t){let n=s=>C+N+te(s.name,e);if(t===void 0){let s=i.reduce((a,m)=>a+n(m)+V,0)-V;return [{items:i,breite:Math.max(0,s)}]}let r=[],o=[],l=0;for(let s of i){let a=n(s),m=o.length===0?a:l+V+a;o.length>0&&m>t?(r.push({items:o,breite:l}),o=[s],l=a):(o=[...o,s],l=m);}return o.length>0&&r.push({items:o,breite:l}),r}function ve(i,e="vertical",t=_,n){if(e==="horizontal"){let o=we(i,t,n);return {width:o.reduce((l,s)=>Math.max(l,s.breite),0),height:o.length*I}}let r=0;for(let o of i)r=Math.max(r,te(o.name,t));return {width:C+N+r,height:i.length*I}}function Ze(i){let{items:e,x:t,y:n,orientation:r="vertical",metrics:o=_,maxBreite:l,box:s,itemClass:a}=i,m=new B;if(s&&e.length>0){let u=ve(e,r,o,l),b=((r==="horizontal"?u.height/I:e.length)-1)*I+C,g=s.padding??Xe,y=s.stroke??Ne;m.rect({x:t-g,y:n-g,w:u.width+2*g,h:b+2*g,fill:s.fill??Ve,...y==="none"?{}:{stroke:y,strokeWidth:s.strokeWidth??1},opacity:s.opacity??Ye});}let h=r==="horizontal"?we(e,o,l):e.map(u=>({items:[u],breite:0})),d=new Map;h.forEach((u,c)=>{let b=t;for(let g of u.items)d.set(g,{x:b,y:n+c*I}),b+=C+N+te(g.name,o)+V;});let p=e.some(u=>u.line!==void 0&&u.line!=="solid"&&u.line!=="none");return e.forEach(u=>{let c=d.get(u)??{x:t,y:n},b=c.x,g=c.y,y=["legend-item"];u.id&&y.push(`legend-item--${u.id}`),a&&y.push(a),m.group({cssClass:y.join(" "),...u.id?{id:`legend-${u.id}`}:{}},x=>{p?x.line({x1:b,y1:g+C/2,x2:b+C,y2:g+C/2,stroke:u.color,strokeWidth:Ke(u.width),...u.line&&u.line!=="solid"?{dash:u.line}:{}}):x.rect({x:b,y:g,w:C,h:C,fill:u.color,stroke:f.legendStroke,strokeWidth:1}),x.text({content:u.name,x:b+C+N,y:g+C-2,fontSize:f.legendFont,fill:f.legendText});});}),m.toGroup({cssClass:"chart-legend"})}function Ke(i){return Math.min(Math.max(i??2,1.5),3)}function qe(i){let{xTicks:e,yTicks:t,xRange:n,yRange:r,stroke:o=f.gridStroke,strokeWidth:l=f.gridStrokeWidth,dashed:s=false,opacity:a=f.gridOpacity}=i,m=[];if(t)for(let h of t)m.push({type:"line",x1:n[0],y1:h,x2:n[1],y2:h,stroke:o,strokeWidth:l,dashed:s,opacity:a});if(e)for(let h of e)m.push({type:"line",x1:h,y1:r[0],x2:h,y2:r[1],stroke:o,strokeWidth:l,dashed:s,opacity:a});return m}var Ce=new Map;function Je(i,e){return `${i}|${JSON.stringify(e??{})}`}function O(i,e){let t=Je(i,e),n=Ce.get(t);return n||(n=new Intl.DateTimeFormat(i,e),Ce.set(t,n)),n}function X(){return typeof navigator<"u"?navigator.language:void 0}var R=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[n,r]=this.#e,[o,l]=this.#t;return r===n?o:o+(t-n)/(r-n)*(l-o)}invert(e){let[t,n]=this.#e,[r,o]=this.#t;return o===r?t:t+(e-r)/(o-r)*(n-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},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}],E=class{#e;#t;#n;constructor(e){this.#e=new R({domain:e.domain,range:e.range}),this.#t=e.locale||(X()??"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,n=12){let[r,o]=this.#e.domain(),l=o-r;if(l<=0)return {interval:w[0].ms};let s=l/e,a=w[0].ms;for(let d of w)if(d.ms>=s){a=d.ms;break}let m=a,h=Math.round(l/m);for(;h>n&&m<w[w.length-1].ms;){let d=w.findIndex(p=>p.ms===m);m=w[Math.min(d+1,w.length-1)].ms,h=Math.round(l/m);}for(;h<t&&m>w[0].ms;){let d=w.findIndex(p=>p.ms===m);m=w[Math.max(d-1,0)].ms,h=Math.round(l/m);}return {interval:m}}ticks(e){let t=e?.minTicks??5,n=e?.maxTicks??12,{interval:r}=this.tickInterval((t+n)/2,t,n),[o,l]=this.#e.domain(),s=[],a=Math.ceil(o/r)*r;for(let m=a;m<=l;m+=r)s.push(m);return s}format(e,t){let n=this.#n?{...t,timeZone:this.#n}:t;return O(this.#t,n).format(new Date(e))}},z=class{#e;#t;#n;#r;constructor(e){this.#e=[...e.domain],this.#t=[...e.range],this.#n=e.paddingInner??.1,this.#r=e.paddingOuter??.05;}get step(){let[e,t]=this.#t,n=this.#e.length;return n<=1?Math.abs(t-e):Math.abs(t-e)*(1-this.#r*2)/n+Math.abs(t-e)*this.#n*2/n}get bandwidth(){let[e,t]=this.#t,n=this.#e.length;if(n<=1)return Math.abs(t-e)*(1-this.#r*2);let r=this.#r*2*Math.abs(t-e);return (Math.abs(t-e)-r)/n*(1-this.#n)}map(e){let t=this.#e.findIndex(d=>String(d)===String(e));if(t===-1)return this.#t[0];let[n,r]=this.#t,o=this.#e.length;if(o<=1)return (n+r)/2;let l=this.#r*2*Math.abs(r-n),s=Math.abs(r-n)-l,a=r>=n?1:-1,m=s/o;return n+this.#r*Math.abs(r-n)*a+t*m}invert(e){let t=0,n=1/0;for(let r=0;r<this.#e.length;r++){let o=this.map(this.#e[r]),l=Math.abs(e-o);l<n&&(n=l,t=r);}return this.#e[t]}domain(){return this.#e.length===0?["",""]:[this.#e[0],this.#e[this.#e.length-1]]}range(){return [...this.#t]}positions(){let e=new Map;for(let t of this.#e)e.set(t,this.map(t));return e}};function ne(i){return i&&i.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}function Qe(i){return i==="dotted"?{dash:"dotted"}:i==="dashed"?{dash:"dashed"}:{}}function et(i){let{thresholds:e,valueScale:t,xRange:n}=i,[r,o]=n,[l,s]=t.range(),a=Math.min(l,s),m=Math.max(l,s),h=[],d=[];for(let p of e){let u=p.color??f.thresholdColor,c=t.map(p.value);p.fill==="above"?h.push({type:"rect",x:r,y:a,w:o-r,h:Math.max(0,c-a),fill:u,hatch:p.fillHatch,opacity:p.fillOpacity??.12,id:p.id?`${p.id}-fill`:void 0}):p.fill==="below"&&h.push({type:"rect",x:r,y:c,w:o-r,h:Math.max(0,m-c),fill:u,hatch:p.fillHatch,opacity:p.fillOpacity??.12,id:p.id?`${p.id}-fill`:void 0});let b=p.line??f.thresholdLine;if(b!=="none"){let S=Qe(b),k={type:"line",x1:r,y1:c,x2:o,y2:c,stroke:u,strokeWidth:1,...S,id:p.id?`${p.id}-line`:void 0};p.shadowColor&&(k.shadowColor=p.shadowColor,k.shadowBlur=p.shadowBlur??4,k.shadowOffsetX=p.shadowOffsetX??0,k.shadowOffsetY=p.shadowOffsetY??2),h.push(k);}let[g,y]=t.domain();if(p.value>=Math.min(g,y)&&p.value<=Math.max(g,y)&&p.label!==void 0&&p.label!==null&&p.label!==false){let S=typeof p.label=="object"?p.label:void 0,k=typeof p.label=="string"?p.label:S?.text??p.name,v=S?.position??"right",j=rt(k,v,r,o,c,u,S);d.push({...j,y:nt(j.y,Math.min(l,s),Math.max(l,s),f.thresholdFontSize),id:p.id?`${p.id}-label`:void 0});}}return {inside:h,labels:d}}function tt(i){let e=et(i);return [...e.inside,...e.labels]}function nt(i,e,t,n){return Math.max(e+n,Math.min(t-n/2,i))}function rt(i,e,t,n,r,o,l){let s=(t+n)/2,a={type:"text",content:i,fontSize:f.thresholdFontSize,fill:o},m=l?{...l.rotate!==void 0&&{rotate:l.rotate},...l.textBaseline!==void 0&&{textBaseline:l.textBaseline}}:{};switch(e){case "left":return {...a,...m,x:t+4,y:r-4,anchor:"start"};case "above":return {...a,...m,x:s,y:r-6,anchor:"middle"};case "below":return {...a,...m,x:s,y:r+14,anchor:"middle"};case "center":return {...a,...m,x:s,y:r-4,anchor:"middle"};case "outside-left":return {...a,...m,x:t-6,y:r+3,anchor:"end",textBaseline:m.textBaseline??"middle"};case "outside-right":return {...a,...m,x:n+6,y:r+3,anchor:"start",textBaseline:m.textBaseline??"middle"};default:return {...a,...m,x:n-4,y:r-4,anchor:"end"}}}function Me(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 Y(i){let{ranges:e,timeScale:t,yRange:n,height:r,metrics:o=_}=i,[l,s]=n,a=[],[m,h]=t.range(),d=Math.min(m,h),p=Math.max(m,h),u=c=>Math.max(d,Math.min(p,c));for(let c of e){let b=u(t.map(c.startTime)),g=u(t.map(c.endTime));if(c.fill!==void 0&&a.push({type:"rect",x:b,y:l,w:g-b,h:s-l,fill:c.fill,hatch:c.hatch,opacity:c.opacity}),c.edges)for(let y of [b,g])a.push({type:"line",x1:y,y1:l,x2:y,y2:s,stroke:c.edges.stroke,strokeWidth:c.edges.strokeWidth,dash:"dashed"});if(c.label){let y=c.labelPosition??"middle",x=c.rotate,S=true;if(x==="auto"){let k=y!=="above"&&y!=="below",v=o(c.label,c.fontSize??11);x=k&&v>Math.abs(g-b)-4?-90:void 0,S=x===void 0||v<=Math.abs(s-l)-4;}S&&a.push({type:"text",content:c.label,x:(b+g)/2,y:Me(y,l,s,r),anchor:"middle",fontSize:c.fontSize,fill:c.labelColor,rotate:x});}}return a}function ot(i){let{gaps:e,timeScale:t,yRange:n,height:r,fill:o=f.gapFill,hatch:l,fillOpacity:s=f.gapFillOpacity??.15,stroke:a=f.gapStroke,strokeWidth:m=f.gapStrokeWidth,dashed:h=true,fontSize:d=f.gapFontSize,fontFill:p=f.gapFontColor,labelBaseline:u="middle",labelRotate:c,metrics:b,band:g}=i,y=()=>{if(!g)return [];let x=g.height??6,[S,k]=n,v=Math.max(S,k);return e.map(j=>{let ge=t.map(j.startTime),be=t.map(j.endTime);return {type:"rect",x:Math.min(ge,be),y:v-x+(g.offset??0),w:Math.abs(be-ge),h:x,fill:g.fill??a,opacity:g.opacity??.75}})};return Y({timeScale:t,yRange:n,height:r,metrics:b,ranges:e.map(x=>{let S=x.style??"dashed_border",k=S==="filled"||S==="dashed_border",v=S==="dashed_border"&&h!==false;return {startTime:x.startTime,endTime:x.endTime,...k&&{fill:x.fill??o,hatch:x.hatch??l,opacity:x.fillOpacity??s},...v&&{edges:{stroke:a,strokeWidth:m}},label:x.label,labelPosition:x.labelBaseline??u,labelColor:p,fontSize:d,rotate:x.rotate??c}})}).concat(y())}function it(i){let{markers:e,timeScale:t,valueScale:n,yRange:r=[0,300]}=i,[o,l]=r,s=[];for(let a of e){let m=t.map(a.time),h=a.color??f.markerColor,d=a.pointStyle??(a.value!==void 0?"circle":"none"),p=a.lineStyle??"full";if(a.value!==void 0){let u=n.map(a.value);if(p==="to-value"?s.push({type:"line",x1:m,y1:l,x2:m,y2:u,stroke:h,strokeWidth:1,dashed:true}):p==="to-top"?s.push({type:"line",x1:m,y1:o,x2:m,y2:u,stroke:h,strokeWidth:1,dashed:true}):p==="full"&&s.push({type:"line",x1:m,y1:o,x2:m,y2:l,stroke:h,strokeWidth:1}),d!=="none"&&ee(s,void 0,d,m,u,f.markerSize,h,h,1.5),a.label){let c=p==="to-value"?u-10:o-6;s.push({type:"text",content:a.label,x:m,y:c,anchor:"middle",fontSize:f.markerFontSize,fill:h});}}else p!=="none"&&s.push({type:"line",x1:m,y1:o,x2:m,y2:l,stroke:h,strokeWidth:1}),a.label&&s.push({type:"text",content:a.label,x:m,y:o-6,anchor:"middle",fontSize:f.markerFontSize,fill:h});}return s}function at(i){let{highlights:e,timeScale:t,yRange:n,height:r}=i;return Y({metrics:i.metrics,timeScale:t,yRange:n,height:r,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??f.highlightColor,opacity:o.opacity??f.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??f.highlightLabelColor,fontSize:f.annotationFontSize,rotate:o.rotate}))})}function st(i,e,t){let n=(o,[l,s])=>o>=Math.min(l,s)&&o<=Math.max(l,s);if(!n(i.time,e.domain()))return false;if(i.value===void 0||!t)return true;let r=t.get(i.axis??0)??t.values().next().value;return !r||n(i.value,r.domain())}function lt(i){let{annotations:e,timeScale:t,valueScales:n,plot:r}=i,o=[],l=a=>!r||st(a,t,n),s=a=>{let m=n.get(a.axis??0)??n.values().next().value;return {x:t.map(a.time),y:m?m.map(a.value):0}};for(let a of e){let m=[],h=u=>m.push(u);if((a.type==="point"||a.type==="label")&&!l(a.at))continue;let d=r!==void 0&&(a.type==="line"||a.type==="arrow"||a.type==="rect")&&!(l(a.from)&&l(a.to)),p=d?{clipRect:r}:{};switch(a.type){case "line":{let u=s(a.from),c=s(a.to);h({type:"line",x1:u.x,y1:u.y,x2:c.x,y2:c.y,stroke:a.color??f.annotationColor,strokeWidth:a.width??f.annotationWidth,dash:a.dash});break}case "arrow":{let u=s(a.from),c=s(a.to),b=a.color??f.annotationColor,g=a.headSize??f.annotationHead;h({type:"line",x1:u.x,y1:u.y,x2:c.x,y2:c.y,stroke:b,strokeWidth:a.width??f.annotationWidth});let y=Math.hypot(c.x-u.x,c.y-u.y)||1,x=(c.x-u.x)/y,S=(c.y-u.y)/y,k=c.x-x*g,v=c.y-S*g;h({type:"path",points:[{x:c.x,y:c.y},{x:k-S*g*.5,y:v+x*g*.5},{x:k+S*g*.5,y:v-x*g*.5}],fill:b,stroke:"none"});break}case "rect":{let u=s(a.from),c=s(a.to);h({type:"rect",x:Math.min(u.x,c.x),y:Math.min(u.y,c.y),w:Math.abs(c.x-u.x),h:Math.abs(c.y-u.y),fill:a.fill??"none",hatch:a.hatch,stroke:a.stroke,opacity:a.opacity});break}case "point":{let u=s(a.at),c=a.color??"#334155",b=a.radius??f.annotationRadius,g=a.shape??"circle";g==="circle"?h({type:"circle",cx:u.x,cy:u.y,r:b,fill:c}):g==="square"?h({type:"rect",x:u.x-b,y:u.y-b,w:b*2,h:b*2,fill:c}):(h({type:"line",x1:u.x-b,y1:u.y-b,x2:u.x+b,y2:u.y+b,stroke:c,strokeWidth:1.5}),h({type:"line",x1:u.x-b,y1:u.y+b,x2:u.x+b,y2:u.y-b,stroke:c,strokeWidth:1.5}));break}case "label":{let u=s(a.at);h({type:"text",content:a.text,x:u.x+(a.dx??0),y:u.y+(a.dy??0),anchor:a.anchor??mt(u.x+(a.dx??0),a.text,i),fontSize:f.annotationFontSize,fill:a.color??f.annotationColor,rotate:a.rotate});break}}if(a.id&&m.length>0){let u=ne(a.id);o.push({type:"group",cssClass:`annotation annotation--${u}`,...p,commands:m});}else d&&m.length>0?o.push({type:"group",cssClass:"annotation",...p,commands:m}):o.push(...m);}return o}function mt(i,e,t){let{metrics:n,timeScale:r}=t;if(!n)return "middle";let[o,l]=r.range(),s=n(e,f.annotationFontSize)/2;return i-s<o?"start":i+s>l?"end":"middle"}var re=class i{_config;constructor(e){this._config=e;}compute(){let{width:e,height:t,margin:n}=this._config;return {totalWidth:e,totalHeight:t,chartWidth:e-n.left-n.right,chartHeight:t-n.top-n.bottom,chartX:n.left,chartY:n.top,margin:n}}static default(e=800,t=400){return new i({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};var oe=class{#e;constructor(){this.#e=[];}add(e){this.#e.push(e);}clear(){this.#e=[];}isInside(e,t){return this.#e.length===0?true:this.#e.some(n=>e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height)}toSVGClipPath(e="clip"){if(this.#e.length===0)return "";let t=this.#e.map(n=>`<rect x="${n.x}" y="${n.y}" width="${n.width}" height="${n.height}" />`).join(`
24
+ `.trim()}var f=new Proxy({},{get:(i,e)=>D()[e],has:(i,e)=>e in D(),ownKeys:()=>Reflect.ownKeys(D()),getOwnPropertyDescriptor:(i,e)=>Reflect.getOwnPropertyDescriptor(D(),e)});var B=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 Ve="#ffffff",Ne="#cccccc",Xe=6,Ye=.85,T=12,N=8,I=20,Ue=11,V=18,te=(i,e)=>e(i,Ue);function we(i,e,t){let n=s=>T+N+te(s.name,e);if(t===void 0){let s=i.reduce((a,m)=>a+n(m)+V,0)-V;return [{items:i,breite:Math.max(0,s)}]}let r=[],o=[],l=0;for(let s of i){let a=n(s),m=o.length===0?a:l+V+a;o.length>0&&m>t?(r.push({items:o,breite:l}),o=[s],l=a):(o=[...o,s],l=m);}return o.length>0&&r.push({items:o,breite:l}),r}function ve(i,e="vertical",t=_,n){if(e==="horizontal"){let o=we(i,t,n);return {width:o.reduce((l,s)=>Math.max(l,s.breite),0),height:o.length*I}}let r=0;for(let o of i)r=Math.max(r,te(o.name,t));return {width:T+N+r,height:i.length*I}}function Ze(i){let{items:e,x:t,y:n,orientation:r="vertical",metrics:o=_,maxBreite:l,box:s,itemClass:a}=i,m=new B;if(s&&e.length>0){let h=ve(e,r,o,l),b=((r==="horizontal"?h.height/I:e.length)-1)*I+T,g=s.padding??Xe,y=s.stroke??Ne;m.rect({x:t-g,y:n-g,w:h.width+2*g,h:b+2*g,fill:s.fill??Ve,...y==="none"?{}:{stroke:y,strokeWidth:s.strokeWidth??1},opacity:s.opacity??Ye});}let d=r==="horizontal"?we(e,o,l):e.map(h=>({items:[h],breite:0})),c=new Map;d.forEach((h,u)=>{let b=t;for(let g of h.items)c.set(g,{x:b,y:n+u*I}),b+=T+N+te(g.name,o)+V;});let p=e.some(h=>h.line!==void 0&&h.line!=="solid"&&h.line!=="none");return e.forEach(h=>{let u=c.get(h)??{x:t,y:n},b=u.x,g=u.y,y=["legend-item"];h.id&&y.push(`legend-item--${h.id}`),a&&y.push(a),m.group({cssClass:y.join(" "),...h.id?{id:`legend-${h.id}`}:{}},x=>{qe(x,h,b,g,p),x.text({content:h.name,x:b+T+N,y:g+T-2,fontSize:f.legendFont,fill:f.legendText});});}),m.toGroup({cssClass:"chart-legend"})}function Ke(i){return Math.min(Math.max(i??2,1.5),3)}function qe(i,e,t,n,r){let o=e.colors&&e.colors.length>=2?e.colors:[e.color],l=T/o.length;if(r){o.forEach((s,a)=>{let m=t+a*l;i.line({x1:m,y1:n+T/2,x2:m+l,y2:n+T/2,stroke:s,strokeWidth:Ke(e.width),...e.line&&e.line!=="solid"?{dash:e.line}:{}});});return}if(o.length===1){i.rect({x:t,y:n,w:T,h:T,fill:o[0],stroke:f.legendStroke,strokeWidth:1});return}o.forEach((s,a)=>{i.rect({x:t+a*l,y:n,w:l,h:T,fill:s});}),i.rect({x:t,y:n,w:T,h:T,fill:"none",stroke:f.legendStroke,strokeWidth:1});}function Je(i){let{xTicks:e,yTicks:t,xRange:n,yRange:r,stroke:o=f.gridStroke,strokeWidth:l=f.gridStrokeWidth,dashed:s=false,opacity:a=f.gridOpacity}=i,m=[];if(t)for(let d of t)m.push({type:"line",x1:n[0],y1:d,x2:n[1],y2:d,stroke:o,strokeWidth:l,dashed:s,opacity:a});if(e)for(let d of e)m.push({type:"line",x1:d,y1:r[0],x2:d,y2:r[1],stroke:o,strokeWidth:l,dashed:s,opacity:a});return m}var Ce=new Map;function Qe(i,e){return `${i}|${JSON.stringify(e??{})}`}function O(i,e){let t=Qe(i,e),n=Ce.get(t);return n||(n=new Intl.DateTimeFormat(i,e),Ce.set(t,n)),n}function X(){return typeof navigator<"u"?navigator.language:void 0}var R=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[n,r]=this.#e,[o,l]=this.#t;return r===n?o:o+(t-n)/(r-n)*(l-o)}invert(e){let[t,n]=this.#e,[r,o]=this.#t;return o===r?t:t+(e-r)/(o-r)*(n-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},v=[{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}],E=class{#e;#t;#n;constructor(e){this.#e=new R({domain:e.domain,range:e.range}),this.#t=e.locale||(X()??"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,n=12){let[r,o]=this.#e.domain(),l=o-r;if(l<=0)return {interval:v[0].ms};let s=l/e,a=v[0].ms;for(let c of v)if(c.ms>=s){a=c.ms;break}let m=a,d=Math.round(l/m);for(;d>n&&m<v[v.length-1].ms;){let c=v.findIndex(p=>p.ms===m);m=v[Math.min(c+1,v.length-1)].ms,d=Math.round(l/m);}for(;d<t&&m>v[0].ms;){let c=v.findIndex(p=>p.ms===m);m=v[Math.max(c-1,0)].ms,d=Math.round(l/m);}return {interval:m}}ticks(e){let t=e?.minTicks??5,n=e?.maxTicks??12,{interval:r}=this.tickInterval((t+n)/2,t,n),[o,l]=this.#e.domain(),s=[],a=Math.ceil(o/r)*r;for(let m=a;m<=l;m+=r)s.push(m);return s}format(e,t){let n=this.#n?{...t,timeZone:this.#n}:t;return O(this.#t,n).format(new Date(e))}},z=class{#e;#t;#n;#r;constructor(e){this.#e=[...e.domain],this.#t=[...e.range],this.#n=e.paddingInner??.1,this.#r=e.paddingOuter??.05;}get step(){let[e,t]=this.#t,n=this.#e.length;return n<=1?Math.abs(t-e):Math.abs(t-e)*(1-this.#r*2)/n+Math.abs(t-e)*this.#n*2/n}get bandwidth(){let[e,t]=this.#t,n=this.#e.length;if(n<=1)return Math.abs(t-e)*(1-this.#r*2);let r=this.#r*2*Math.abs(t-e);return (Math.abs(t-e)-r)/n*(1-this.#n)}map(e){let t=this.#e.findIndex(c=>String(c)===String(e));if(t===-1)return this.#t[0];let[n,r]=this.#t,o=this.#e.length;if(o<=1)return (n+r)/2;let l=this.#r*2*Math.abs(r-n),s=Math.abs(r-n)-l,a=r>=n?1:-1,m=s/o;return n+this.#r*Math.abs(r-n)*a+t*m}invert(e){let t=0,n=1/0;for(let r=0;r<this.#e.length;r++){let o=this.map(this.#e[r]),l=Math.abs(e-o);l<n&&(n=l,t=r);}return this.#e[t]}domain(){return this.#e.length===0?["",""]:[this.#e[0],this.#e[this.#e.length-1]]}range(){return [...this.#t]}positions(){let e=new Map;for(let t of this.#e)e.set(t,this.map(t));return e}};function ne(i){return i&&i.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}function et(i){return i==="dotted"?{dash:"dotted"}:i==="dashed"?{dash:"dashed"}:{}}function tt(i){let{thresholds:e,valueScale:t,xRange:n}=i,[r,o]=n,[l,s]=t.range(),a=Math.min(l,s),m=Math.max(l,s),d=[],c=[];for(let p of e){let h=p.color??f.thresholdColor,u=t.map(p.value);p.fill==="above"?d.push({type:"rect",x:r,y:a,w:o-r,h:Math.max(0,u-a),fill:h,hatch:p.fillHatch,opacity:p.fillOpacity??.12,id:p.id?`${p.id}-fill`:void 0}):p.fill==="below"&&d.push({type:"rect",x:r,y:u,w:o-r,h:Math.max(0,m-u),fill:h,hatch:p.fillHatch,opacity:p.fillOpacity??.12,id:p.id?`${p.id}-fill`:void 0});let b=p.line??f.thresholdLine;if(b!=="none"){let S=et(b),k={type:"line",x1:r,y1:u,x2:o,y2:u,stroke:h,strokeWidth:1,...S,id:p.id?`${p.id}-line`:void 0};p.shadowColor&&(k.shadowColor=p.shadowColor,k.shadowBlur=p.shadowBlur??4,k.shadowOffsetX=p.shadowOffsetX??0,k.shadowOffsetY=p.shadowOffsetY??2),d.push(k);}let[g,y]=t.domain();if(p.value>=Math.min(g,y)&&p.value<=Math.max(g,y)&&p.label!==void 0&&p.label!==null&&p.label!==false){let S=typeof p.label=="object"?p.label:void 0,k=typeof p.label=="string"?p.label:S?.text??p.name,C=S?.position??"right",j=ot(k,C,r,o,u,h,S);c.push({...j,y:rt(j.y,Math.min(l,s),Math.max(l,s),f.thresholdFontSize),id:p.id?`${p.id}-label`:void 0});}}return {inside:d,labels:c}}function nt(i){let e=tt(i);return [...e.inside,...e.labels]}function rt(i,e,t,n){return Math.max(e+n,Math.min(t-n/2,i))}function ot(i,e,t,n,r,o,l){let s=(t+n)/2,a={type:"text",content:i,fontSize:f.thresholdFontSize,fill:o},m=l?{...l.rotate!==void 0&&{rotate:l.rotate},...l.textBaseline!==void 0&&{textBaseline:l.textBaseline}}:{};switch(e){case "left":return {...a,...m,x:t+4,y:r-4,anchor:"start"};case "above":return {...a,...m,x:s,y:r-6,anchor:"middle"};case "below":return {...a,...m,x:s,y:r+14,anchor:"middle"};case "center":return {...a,...m,x:s,y:r-4,anchor:"middle"};case "outside-left":return {...a,...m,x:t-6,y:r+3,anchor:"end",textBaseline:m.textBaseline??"middle"};case "outside-right":return {...a,...m,x:n+6,y:r+3,anchor:"start",textBaseline:m.textBaseline??"middle"};default:return {...a,...m,x:n-4,y:r-4,anchor:"end"}}}function Me(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 Y(i){let{ranges:e,timeScale:t,yRange:n,height:r,metrics:o=_}=i,[l,s]=n,a=[],[m,d]=t.range(),c=Math.min(m,d),p=Math.max(m,d),h=u=>Math.max(c,Math.min(p,u));for(let u of e){let b=h(t.map(u.startTime)),g=h(t.map(u.endTime));if(u.fill!==void 0&&a.push({type:"rect",x:b,y:l,w:g-b,h:s-l,fill:u.fill,hatch:u.hatch,opacity:u.opacity}),u.edges)for(let y of [b,g])a.push({type:"line",x1:y,y1:l,x2:y,y2:s,stroke:u.edges.stroke,strokeWidth:u.edges.strokeWidth,dash:"dashed"});if(u.label){let y=u.labelPosition??"middle",x=u.rotate,S=true;if(x==="auto"){let k=y!=="above"&&y!=="below",C=o(u.label,u.fontSize??11);x=k&&C>Math.abs(g-b)-4?-90:void 0,S=x===void 0||C<=Math.abs(s-l)-4;}S&&a.push({type:"text",content:u.label,x:(b+g)/2,y:Me(y,l,s,r),anchor:"middle",fontSize:u.fontSize,fill:u.labelColor,rotate:x});}}return a}function it(i){let{gaps:e,timeScale:t,yRange:n,height:r,fill:o=f.gapFill,hatch:l,fillOpacity:s=f.gapFillOpacity??.15,stroke:a=f.gapStroke,strokeWidth:m=f.gapStrokeWidth,dashed:d=true,fontSize:c=f.gapFontSize,fontFill:p=f.gapFontColor,labelBaseline:h="middle",labelRotate:u,metrics:b,band:g}=i,y=()=>{if(!g)return [];let x=g.height??6,[S,k]=n,C=Math.max(S,k);return e.map(j=>{let ge=t.map(j.startTime),be=t.map(j.endTime);return {type:"rect",x:Math.min(ge,be),y:C-x+(g.offset??0),w:Math.abs(be-ge),h:x,fill:g.fill??a,opacity:g.opacity??.75}})};return Y({timeScale:t,yRange:n,height:r,metrics:b,ranges:e.map(x=>{let S=x.style??"dashed_border",k=S==="filled"||S==="dashed_border",C=S==="dashed_border"&&d!==false;return {startTime:x.startTime,endTime:x.endTime,...k&&{fill:x.fill??o,hatch:x.hatch??l,opacity:x.fillOpacity??s},...C&&{edges:{stroke:a,strokeWidth:m}},label:x.label,labelPosition:x.labelBaseline??h,labelColor:p,fontSize:c,rotate:x.rotate??u}})}).concat(y())}function at(i){let{markers:e,timeScale:t,valueScale:n,yRange:r=[0,300]}=i,[o,l]=r,s=[];for(let a of e){let m=t.map(a.time),d=a.color??f.markerColor,c=a.pointStyle??(a.value!==void 0?"circle":"none"),p=a.lineStyle??"full";if(a.value!==void 0){let h=n.map(a.value);if(p==="to-value"?s.push({type:"line",x1:m,y1:l,x2:m,y2:h,stroke:d,strokeWidth:1,dashed:true}):p==="to-top"?s.push({type:"line",x1:m,y1:o,x2:m,y2:h,stroke:d,strokeWidth:1,dashed:true}):p==="full"&&s.push({type:"line",x1:m,y1:o,x2:m,y2:l,stroke:d,strokeWidth:1}),c!=="none"&&ee(s,void 0,c,m,h,f.markerSize,d,d,1.5),a.label){let u=p==="to-value"?h-10:o-6;s.push({type:"text",content:a.label,x:m,y:u,anchor:"middle",fontSize:f.markerFontSize,fill:d});}}else p!=="none"&&s.push({type:"line",x1:m,y1:o,x2:m,y2:l,stroke:d,strokeWidth:1}),a.label&&s.push({type:"text",content:a.label,x:m,y:o-6,anchor:"middle",fontSize:f.markerFontSize,fill:d});}return s}function st(i){let{highlights:e,timeScale:t,yRange:n,height:r}=i;return Y({metrics:i.metrics,timeScale:t,yRange:n,height:r,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??f.highlightColor,opacity:o.opacity??f.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??f.highlightLabelColor,fontSize:f.annotationFontSize,rotate:o.rotate}))})}function lt(i,e,t){let n=(o,[l,s])=>o>=Math.min(l,s)&&o<=Math.max(l,s);if(!n(i.time,e.domain()))return false;if(i.value===void 0||!t)return true;let r=t.get(i.axis??0)??t.values().next().value;return !r||n(i.value,r.domain())}function mt(i){let{annotations:e,timeScale:t,valueScales:n,plot:r}=i,o=[],l=a=>!r||lt(a,t,n),s=a=>{let m=n.get(a.axis??0)??n.values().next().value;return {x:t.map(a.time),y:m?m.map(a.value):0}};for(let a of e){let m=[],d=h=>m.push(h);if((a.type==="point"||a.type==="label")&&!l(a.at))continue;let c=r!==void 0&&(a.type==="line"||a.type==="arrow"||a.type==="rect")&&!(l(a.from)&&l(a.to)),p=c?{clipRect:r}:{};switch(a.type){case "line":{let h=s(a.from),u=s(a.to);d({type:"line",x1:h.x,y1:h.y,x2:u.x,y2:u.y,stroke:a.color??f.annotationColor,strokeWidth:a.width??f.annotationWidth,dash:a.dash});break}case "arrow":{let h=s(a.from),u=s(a.to),b=a.color??f.annotationColor,g=a.headSize??f.annotationHead;d({type:"line",x1:h.x,y1:h.y,x2:u.x,y2:u.y,stroke:b,strokeWidth:a.width??f.annotationWidth});let y=Math.hypot(u.x-h.x,u.y-h.y)||1,x=(u.x-h.x)/y,S=(u.y-h.y)/y,k=u.x-x*g,C=u.y-S*g;d({type:"path",points:[{x:u.x,y:u.y},{x:k-S*g*.5,y:C+x*g*.5},{x:k+S*g*.5,y:C-x*g*.5}],fill:b,stroke:"none"});break}case "rect":{let h=s(a.from),u=s(a.to);d({type:"rect",x:Math.min(h.x,u.x),y:Math.min(h.y,u.y),w:Math.abs(u.x-h.x),h:Math.abs(u.y-h.y),fill:a.fill??"none",hatch:a.hatch,stroke:a.stroke,opacity:a.opacity});break}case "point":{let h=s(a.at),u=a.color??"#334155",b=a.radius??f.annotationRadius,g=a.shape??"circle";g==="circle"?d({type:"circle",cx:h.x,cy:h.y,r:b,fill:u}):g==="square"?d({type:"rect",x:h.x-b,y:h.y-b,w:b*2,h:b*2,fill:u}):(d({type:"line",x1:h.x-b,y1:h.y-b,x2:h.x+b,y2:h.y+b,stroke:u,strokeWidth:1.5}),d({type:"line",x1:h.x-b,y1:h.y+b,x2:h.x+b,y2:h.y-b,stroke:u,strokeWidth:1.5}));break}case "label":{let h=s(a.at);d({type:"text",content:a.text,x:h.x+(a.dx??0),y:h.y+(a.dy??0),anchor:a.anchor??ut(h.x+(a.dx??0),a.text,i),fontSize:f.annotationFontSize,fill:a.color??f.annotationColor,rotate:a.rotate});break}}if(a.id&&m.length>0){let h=ne(a.id);o.push({type:"group",cssClass:`annotation annotation--${h}`,...p,commands:m});}else c&&m.length>0?o.push({type:"group",cssClass:"annotation",...p,commands:m}):o.push(...m);}return o}function ut(i,e,t){let{metrics:n,timeScale:r}=t;if(!n)return "middle";let[o,l]=r.range(),s=n(e,f.annotationFontSize)/2;return i-s<o?"start":i+s>l?"end":"middle"}var re=class i{_config;constructor(e){this._config=e;}compute(){let{width:e,height:t,margin:n}=this._config;return {totalWidth:e,totalHeight:t,chartWidth:e-n.left-n.right,chartHeight:t-n.top-n.bottom,chartX:n.left,chartY:n.top,margin:n}}static default(e=800,t=400){return new i({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};var oe=class{#e;constructor(){this.#e=[];}add(e){this.#e.push(e);}clear(){this.#e=[];}isInside(e,t){return this.#e.length===0?true:this.#e.some(n=>e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height)}toSVGClipPath(e="clip"){if(this.#e.length===0)return "";let t=this.#e.map(n=>`<rect x="${n.x}" y="${n.y}" width="${n.width}" height="${n.height}" />`).join(`
25
25
  `);return `<clipPath id="${e}">
26
26
  ${t}
27
- </clipPath>`}get regions(){return [...this.#e]}};function U(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 l=1;l<=e;l++)t.push(r+(o-r)*l/(e+1));}return t}var G={axisColor:f.axisColor,tickColor:f.tickColor,textColor:f.textColor,textSize:f.textSize},H=class{#e;#t;constructor(e){this.#e=new E({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??G).axisColor}get tickColor(){return (this.#t.colors??G).tickColor}get textColor(){return (this.#t.colors??G).textColor}get textSize(){return (this.#t.colors??G).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??G,n=this.#t.y??0,r=[],[o,l]=this.#e.range();r.push({type:"line",x1:o,y1:n,x2:l,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let s of this.generateMinorTicks())r.push({type:"line",x1:s,y1:n,x2:s,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});for(let s of e)r.push({type:"line",x1:s.x,y1:n,x2:s.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),r.push({type:"text",content:s.label,x:this.#n(s.x,s.label,t.textSize),y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return r}generateMinorTicks(){return U(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 l=o(t,n)/2;return Math.max(l+2,Math.min(r-l-2,e))}};var P={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function ie(i,e){let t=n=>e===void 0||e>=n;return Math.abs(i)>=1e6&&t(1e5)?`${(i/1e6).toFixed(1)}M`:Math.abs(i)>=1e3&&t(100)?`${(i/1e3).toFixed(1)}k`:Number.isInteger(i)?String(i):i.toFixed(1)}function ut(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 ae=class{#e;#t;constructor(e){this.#e=new R({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??P).axisColor}get tickColor(){return (this.#t.colors??P).tickColor}get textColor(){return (this.#t.colors??P).textColor}get textSize(){return (this.#t.colors??P).textSize}generateTicks(){let e=this.#t.tickValues;if(e&&e.length>0){let b=this.#t.format??ie;return e.map(g=>({value:g,position:this.#e.map(g),label:b(g)}))}let t=this.#t.format??ie,n=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[r,o]=this.#e.domain(),l=Math.min(r,o),s=Math.max(r,o),a=s-l;if(a===0)return [{value:r,position:this.#e.map(r),label:t(r)}];let m=a/n,h=Math.pow(10,Math.floor(Math.log10(m))),d=m/h,p;if(d<=1.5?p=h:d<=3?p=2*h:d<=7?p=5*h:p=10*h,p<=0||!Number.isFinite(p))return [{value:r,position:this.#e.map(r),label:t(r)}];this.#t.format||(t=b=>ie(b,p));let u=[],c=Math.ceil(l/p)*p;for(let b=c;b<=s;b+=p)u.push({value:b,position:this.#e.map(b),label:t(b)});return u}generateMinorTicks(){return U(this.generateTicks().map(e=>e.position),this.#t.minorTicks??0)}render(){let e=this.generateTicks(),t=this.#t.colors??P,n=this.#t.x??0,r=this.#t.orientation??"vertical",o=this.#t.position??"left",l=this.#t.suppressLabelsNear??[],s=this.#t.suppressTolerancePx??8,a=d=>l.some(p=>Math.abs(p-d)<=s),m=[];if(r==="vertical"){let[d,p]=this.#e.range();m.push({type:"line",x1:n,y1:d,x2:n,y2:p,stroke:t.axisColor,strokeWidth:t.axisWidth});let u=ut(e);e.forEach((c,b)=>{let g=a(c.position),y=u[b]?{opacity:0}:{};o==="left"?(m.push({type:"line",x1:n-4,y1:c.position,x2:n,y2:c.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:c.label,x:this.#n(n-8,c.label,"end"),y:c.position+4,anchor:"end",fontSize:t.textSize,fill:t.textColor,...y})):(m.push({type:"line",x1:n,y1:c.position,x2:n+4,y2:c.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:c.label,x:this.#n(n+8,c.label,"start"),y:c.position+4,anchor:"start",fontSize:t.textSize,fill:t.textColor,...y}));});}else {let[d,p]=this.#e.range();m.push({type:"line",x1:d,y1:n,x2:p,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let u of e)m.push({type:"line",x1:u.position,y1:n,x2:u.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),m.push({type:"text",content:u.label,x:u.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}let h=(this.#t.orientation??"vertical")==="vertical";for(let d of this.generateMinorTicks())m.push(h?{type:"line",x1:o==="right"?n:n-2,y1:d,x2:o==="right"?n+2:n,y2:d,stroke:t.tickColor,strokeWidth:t.axisWidth}:{type:"line",x1:d,y1:n,x2:d,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});return m}#n(e,t,n){let r=this.#t.gesamtbreite,o=this.#t.metrics;if(r===void 0||o===void 0)return e;let l=o(t,(this.#t.colors??P).textSize);return n==="end"?Math.max(l+2,Math.min(r-2,e)):Math.min(r-l-2,Math.max(2,e))}};var se=class i{#e;#t;#n;#r;#a;#o;#i;constructor(e){this.#e=[...e.data].sort((t,n)=>t.time-n.time),this.#t=e.windowSize,this.#n=e.type??"simple",this.#r=e.timeScale,this.#a=e.valueScale,this.#o=e.stroke??"#e53e3e",this.#i=e.strokeWidth??2;}static simple(e,t){let n=[...e].filter(o=>o.value!==null).sort((o,l)=>o.time-l.time),r=[];for(let o=0;o<n.length;o++){let l=Math.max(0,o-t+1),s=n.slice(l,o+1),a=s.reduce((m,h)=>m+h.value,0)/s.length;r.push({time:n[o].time,value:a});}return r}static exponential(e,t){let n=[...e].filter(s=>s.value!==null).sort((s,a)=>s.time-a.time);if(n.length===0)return [];let r=2/(t+1),o=[],l=n[0].value;o.push({time:n[0].time,value:l});for(let s=1;s<n.length;s++)l=n[s].value*r+l*(1-r),o.push({time:n[s].time,value:l});return o}points(){return (this.#n==="exponential"?i.exponential(this.#e,this.#t):i.simple(this.#e,this.#t)).map(t=>({x:this.#r.map(t.time),y:this.#a.map(t.value)}))}render(){let e=this.points();return e.length<2?e.map(t=>({type:"circle",cx:t.x,cy:t.y,r:this.#i,fill:this.#o})):[{type:"path",points:e,smoothing:true,stroke:this.#o,strokeWidth:this.#i}]}};var le=class{#e;#t;#n;constructor(e){let t=Object.keys(e.enumMap).map(Number).sort((n,r)=>n-r).map(String);this.#t=t,this.#e=new z({domain:t,range:e.range}),this.#n=e;}get scale(){return this.#e}generateTicks(){let{enumMap:e,showLabels:t=true,autoColor:n=true,gapValues:r}=this.#n,o=new Set(r??[]);return this.#t.map((l,s)=>{let a=Number(l),m=t?e[a]??String(a):String(a),h=this.#e.map(a),d=n?f.palette[s%f.palette.length]:void 0;return {value:a,label:m,y:h,color:d,isGap:o.has(a)}})}colorFor(e){let t=this.#t.indexOf(String(e));if(!(t===-1||!(this.#n.autoColor??true)))return f.palette[t%f.palette.length]}render(){let e=this.generateTicks(),t=this.#n.x??0,n=[];for(let r of e)r.isGap||n.push({type:"text",content:r.label,x:t,y:r.y+4,anchor:"end",fontSize:f.textSize,fill:r.color??f.textColor});return n}map(e){return this.#e.map(e)}isGap(e){return new Set(this.#n.gapValues??[]).has(e)}};var M=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 me=class extends M{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale;return this.data.filter(t=>t.value!==null).map(t=>({x:this.timeScale.map(t.time),y:e.map(t.value),time:t.time})).sort((t,n)=>t.x-n.x)}render(){let e=this.#e,t={smoothing:e.smoothing??false,smoothingType:e.smoothingType,stroke:e.stroke??f.stroke,strokeWidth:e.strokeWidth??f.strokeWidth,dashed:e.dashed??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??f.pointSize,shadowColor:e.shadowColor,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY},n=e.pointThreshold??f.pointThreshold,r=e.gapThreshold??f.gapThreshold,o=e.id,l=T.getRuns(this.data,d=>d.value===null,r),s=l.reduce((d,p)=>d+p.length,0);if(s===0)return [];let a={timeScale:this.timeScale,valueScale:e.valueScale},m=l.map(d=>({data:d})),h=[];return h.push(...L(m,a,{...t,id:o?`${o}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&s<=n&&h.push(...Q(l.flat(),a,{...t,id:o?`${o}-marker`:void 0},()=>t.stroke)),h}};var ue=class extends M{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale,t=[...this.data].filter(r=>r.value!==null).sort((r,o)=>r.time-o.time),n=[];for(let r=0;r<t.length;r++){let o=this.timeScale.map(t[r].time),l=e.map(t[r].value);r===0?n.push({x:o,y:l}):n.push({x:o,y:n[n.length-1].y},{x:o,y:l});}return n}render(){let e=T.getRuns(this.data,r=>r.value===null);if(e.length===0)return [];let t={timeScale:this.timeScale,valueScale:this.#e.valueScale},n=e.map(r=>({data:r}));return q(n,t,{stroke:this.#e.stroke??f.stroke,strokeWidth:this.#e.strokeWidth??f.strokeWidth,id:this.id?`${this.id}-line`:void 0})}};var ce=class extends M{#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??f.bandFill,n=e.hatch,r=e.avgLine??false,o=e.avgLineColor??f.bandAvgLine,l=e.bandWidth??10,s=[];for(let a of this.data){if(a.min===null||a.max===null)continue;let m=this.timeScale.map(a.time),h=e.valueScale.map(a.max),d=e.valueScale.map(a.min),p=l,u=this.data.indexOf(a);if(s.push({type:"rect",x:m-p/2,y:h,w:p,h:d-h,fill:t,hatch:n,opacity:this.opacity(a.count),id:this.id?`${this.id}-slot-${u}`:void 0}),r&&a.avg!==null){let c=e.valueScale.map(a.avg);s.push({type:"line",x1:m-p/2,y1:c,x2:m+p/2,y2:c,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${u}`:void 0});}}return s}};function Le(i,e,t,n,r,o,l){return J(i,e,{boundaries:[],yLow:s=>s.avg,yHigh:t,getValue:s=>s.avg,interpolate:T.interpolateAggregatedPoint,getColor:()=>n,getHatch:()=>r},{id:o,...l})}var de=class extends M{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??f.minColor,n=e.maxColor??f.maxColor,r=e.avgColor??f.avgColor,o=e.avgDashed??true,l=e.smoothing??false,s=e.smoothingType,a=e.strokeWidth??f.strokeWidth,m=T.getRuns(this.data,c=>c.min===null||c.max===null||c.avg===null);if(m.length===0)return [];let h={timeScale:this.timeScale,valueScale:e.valueScale},d=[];m.forEach((c,b)=>{if(c.length<2)return;let g=y=>this.id?`${this.id}-${y}-${b}`:void 0;if(e.fillToMax){let y=Le(c,h,x=>x.max,e.fillToMax,e.fillToMaxHatch,g("fillToMax"),{smoothing:l,smoothingType:s});d.push(...y);}if(e.fillToMin){let y=Le(c,h,x=>x.min,e.fillToMin,e.fillToMinHatch,g("fillToMin"),{smoothing:l,smoothingType:s});d.push(...y);}});let p=m.filter(c=>c.length>=2),u=(c,b,g,y=false)=>L(p.map(x=>({data:x.map(S=>({time:S.time,value:c(S)}))})),h,{stroke:b,strokeWidth:a,smoothing:l,smoothingType:s,dashed:y,id:this.id?`${this.id}-${g}`:void 0});return d.push(...u(c=>c.max,n,"max"),...u(c=>c.min,t,"min"),...u(c=>c.avg,r,"avg",o)),d}};var De=1,ct="#6b728044";var _e=4;function dt(i,e="last"){let t=[...i].sort((o,l)=>o.time-l.time||o.index-l.index),n=[],r=o=>n.every(l=>o.right+_e<=l.left||l.right+_e<=o.left);t.length>0&&n.push(e==="first"?t[0]:t[t.length-1]);for(let o of t)o!==n[0]&&r(o)&&n.push(o);return new Set(n.map(o=>o.index))}function ht(i){let e=typeof i=="object"&&i!==null?i.mode:i,t=typeof i=="object"&&i!==null&&i.keep==="first"?"first":"last";return {fit:e==="fit",keep:t}}var he=class{#e;constructor(e,t,n,r){this.#e={...e,xRange:t,y:n,height:r};}render(){let{items:e,timeScale:t,background:n,hatch:r,showAxis:o,xRange:l,y:s,height:a}=this.#e,m=[];n&&m.push({type:"rect",x:l[0],y:s,w:l[1]-l[0],h:a,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});let h=this.#n();if(e.forEach((d,p)=>{let u=this.#t(d);if(!u)return;let{startX:c,w:b}=u,g=c+b/2;if(m.push({type:"rect",x:c,y:s,w:b,h:a,hatch:d.hatch??r,fill:d.fill??ct,stroke:d.stroke,strokeWidth:d.strokeWidth??0,title:d.title}),d.label&&(!h||h.has(p))){let y=d.labelFontSize??10;m.push({type:"text",content:d.label,x:g,y:this.#r(d.labelBaseline,y),anchor:"middle",fontSize:y,fill:d.labelFill??"#333"});}}),o){let d=new H({domain:t.domain(),xRange:l,y:s+a+4});m.push({type:"group",cssClass:"annotation-band-axis",commands:d.render()});}return m}#t(e){let{timeScale:t,xRange:n,minItemWidth:r=0}=this.#e,o=t.map(e.startTime),l=t.map(e.endTime);if(l<n[0]||o>n[1])return null;let s=Math.max(n[0],Math.min(n[1],o)),a=Math.max(n[0],Math.min(n[1],l)),m=Math.max(a-s,De);return r>De&&a-s<r&&(s=(s+a)/2-r/2,m=r),s=Math.max(n[0],s),s+m>n[1]&&(s=Math.max(n[0],n[1]-m)),{startX:s,w:m}}#n(){let{fit:e,keep:t}=ht(this.#e.labels);if(!e)return null;let n=this.#e.metrics??_,r=[];return this.#e.items.forEach((o,l)=>{let s=o.label?this.#t(o):null;if(!s||!o.label)return;let a=s.startX+s.w/2,m=n(o.label,o.labelFontSize??10)/2;r.push({index:l,time:o.startTime,left:a-m,right:a+m});}),dt(r,t)}#r(e,t){let{y:n,height:r}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+r-t*.25;default:return n+r/2+t*.35}}};var pe=class{#e;constructor(e){this.#e=e;}render(){let{data:e,valueScale:t,xRange:n,showMin:r=false,showMax:o=false,showAvg:l=true,showMedian:s=false,labelPosition:a="end",lineColor:m=f.statsLineColor,labelColor:h=f.statsLabelColor}=this.#e,d=ye.compute(e),p=[{name:"min",value:d.min,enabled:r},{name:"max",value:d.max,enabled:o},{name:"avg",value:d.avg,enabled:l},{name:"median",value:d.median,enabled:s}],u=[],[c,b]=n;for(let g of p.filter(y=>y.enabled)){let y=t.map(g.value);u.push({type:"line",x1:c,y1:y,x2:b,y2:y,stroke:m,strokeWidth:1});let x=`${g.name}: ${g.value.toFixed(1)}`;(a==="start"||a==="both")&&u.push({type:"text",content:x,x:c+4,y:y-4,anchor:"start",fontSize:f.statFontSize,fill:h}),(a==="end"||a==="both")&&u.push({type:"text",content:x,x:b-4,y:y-4,anchor:"end",fontSize:f.statFontSize,fill:h}),a==="center"&&u.push({type:"text",content:x,x:(c+b)/2,y:y-4,anchor:"middle",fontSize:f.statFontSize,fill:h});}return u}};var $=class{#e;#t;#n;constructor(e){this.#e=e?.locale||(X()??"en-US"),this.#t=e?.fallbackLocales??["en-US"],this.#n=e?.autoFormat??true;}format(e,t,n){try{let r=this.#n&&n?this.#r(e,n,t):t;return O(this.#e,r).format(new Date(e))}catch{for(let r of this.#t)try{return O(r,t).format(new Date(e))}catch{}return new Date(e).toISOString()}}formatRange(e,t){let n=this.format(e),r=this.format(t);return `${n} \u2014 ${r}`}#r(e,t,n){let r=Math.abs(e-t),o=864e5,l=36e5,s=6e4,a={};return r<s?(a.second="2-digit",a.minute="2-digit",a.hour="2-digit"):r<l?(a.minute="2-digit",a.hour="2-digit"):r<o?(a.hour="2-digit",a.minute="2-digit"):r<7*o?(a.weekday="short",a.day="numeric"):r<365*o?(a.month="short",a.day="numeric"):(a.month="short",a.year="numeric"),{...n,...a}}};var F=class i{#e;#t;_compact;#n;constructor(e){this.#e=e?.unit??"",this.#t=e?.decimals??1,this._compact=e?.compact??false,this.#n=e?.custom;}format(e){if(this.#n)return this.#n(e);let t;return this._compact&&Math.abs(e)>=1e6?t=`${(e/1e6).toFixed(this.#t)}M`:this._compact&&Math.abs(e)>=1e3?t=`${(e/1e3).toFixed(this.#t)}k`:t=e.toFixed(this.#t),this.#e?`${t}${this.#e}`:t}formatRange(e,t){return `${this.format(e)} \u2014 ${this.format(t)}`}static unit(e,t=1){return new i({unit:e,decimals:t})}static temperature(e="\xB0C"){return new i({unit:e,decimals:1})}static percentage(){return new i({unit:"%",decimals:0})}};var W=class i{#e;#t;#n;constructor(e){this.#e=e?.map??{},this.#t=e?.fallback??(t=>String(t)),this.#n=e?.showValue??false;}format(e){let t=this.#e[e]??this.#t(e);return this.#n?`(${e}) ${t}`:t}has(e){return e in this.#e}labels(){return Object.values(this.#e)}values(){return Object.keys(this.#e).map(Number)}static fromLabels(e,t=false){let n={};return e.forEach((r,o)=>{n[o]=r;}),new i({map:n,showValue:t})}};var pt={time:new $,value:new F,enum:new W};function fe(i,e){let t=D();return {color:i.color??t.stroke,width:i.width??t.strokeWidth,style:i.style??"solid",smoothing:i.smoothing??false,smoothingType:i.smoothingType,shape:i.shape??(e.seriesType==="step"?"step":"line"),gapThreshold:i.gapThreshold??t.gapThreshold,opacity:i.opacity??1}}function Ae(i){let e=i.style?.line;return e===false?[]:e===void 0?[fe({},i)]:Array.isArray(e)?e.map(t=>fe(t,i)):[fe(e,i)]}function Re(i){let e=i.style?.markers;if(!e?.type||e.type==="none")return;let t=D(),r=(i.style?.line&&!Array.isArray(i.style.line)?i.style.line.color:void 0)??t.stroke;return {type:e.type,size:e.size??t.pointSize,stroke:e.stroke??r,fill:e.fill??"#ffffff",strokeWidth:e.strokeWidth??1,threshold:e.threshold}}function Pe(i){let e=i.style?.shadow;if(!(!e?.color||e.color==="transparent"||e.color==="none"))return {color:e.color,blur:e.blur??4,offsetX:e.offsetX??0,offsetY:e.offsetY??0}}function $e(i){return i.style?.gap}function Fe(i){return i.style?.fill}function ft(i){return {lines:Ae(i),fill:Fe(i),markers:Re(i),shadow:Pe(i),gap:$e(i),id:i.style?.id??i.id}}/*!
27
+ </clipPath>`}get regions(){return [...this.#e]}};function U(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 l=1;l<=e;l++)t.push(r+(o-r)*l/(e+1));}return t}var G={axisColor:f.axisColor,tickColor:f.tickColor,textColor:f.textColor,textSize:f.textSize},H=class{#e;#t;constructor(e){this.#e=new E({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??G).axisColor}get tickColor(){return (this.#t.colors??G).tickColor}get textColor(){return (this.#t.colors??G).textColor}get textSize(){return (this.#t.colors??G).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??G,n=this.#t.y??0,r=[],[o,l]=this.#e.range();r.push({type:"line",x1:o,y1:n,x2:l,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let s of this.generateMinorTicks())r.push({type:"line",x1:s,y1:n,x2:s,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});for(let s of e)r.push({type:"line",x1:s.x,y1:n,x2:s.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),r.push({type:"text",content:s.label,x:this.#n(s.x,s.label,t.textSize),y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return r}generateMinorTicks(){return U(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 l=o(t,n)/2;return Math.max(l+2,Math.min(r-l-2,e))}};var P={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function ie(i,e){let t=n=>e===void 0||e>=n;return Math.abs(i)>=1e6&&t(1e5)?`${(i/1e6).toFixed(1)}M`:Math.abs(i)>=1e3&&t(100)?`${(i/1e3).toFixed(1)}k`:Number.isInteger(i)?String(i):i.toFixed(1)}function ct(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 ae=class{#e;#t;constructor(e){this.#e=new R({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??P).axisColor}get tickColor(){return (this.#t.colors??P).tickColor}get textColor(){return (this.#t.colors??P).textColor}get textSize(){return (this.#t.colors??P).textSize}generateTicks(){let e=this.#t.tickValues;if(e&&e.length>0){let b=this.#t.format??ie;return e.map(g=>({value:g,position:this.#e.map(g),label:b(g)}))}let t=this.#t.format??ie,n=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[r,o]=this.#e.domain(),l=Math.min(r,o),s=Math.max(r,o),a=s-l;if(a===0)return [{value:r,position:this.#e.map(r),label:t(r)}];let m=a/n,d=Math.pow(10,Math.floor(Math.log10(m))),c=m/d,p;if(c<=1.5?p=d:c<=3?p=2*d:c<=7?p=5*d:p=10*d,p<=0||!Number.isFinite(p))return [{value:r,position:this.#e.map(r),label:t(r)}];this.#t.format||(t=b=>ie(b,p));let h=[],u=Math.ceil(l/p)*p;for(let b=u;b<=s;b+=p)h.push({value:b,position:this.#e.map(b),label:t(b)});return h}generateMinorTicks(){return U(this.generateTicks().map(e=>e.position),this.#t.minorTicks??0)}render(){let e=this.generateTicks(),t=this.#t.colors??P,n=this.#t.x??0,r=this.#t.orientation??"vertical",o=this.#t.position??"left",l=this.#t.suppressLabelsNear??[],s=this.#t.suppressTolerancePx??8,a=c=>l.some(p=>Math.abs(p-c)<=s),m=[];if(r==="vertical"){let[c,p]=this.#e.range();m.push({type:"line",x1:n,y1:c,x2:n,y2:p,stroke:t.axisColor,strokeWidth:t.axisWidth});let h=ct(e);e.forEach((u,b)=>{let g=a(u.position),y=h[b]?{opacity:0}:{};o==="left"?(m.push({type:"line",x1:n-4,y1:u.position,x2:n,y2:u.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:u.label,x:this.#n(n-8,u.label,"end"),y:u.position+4,anchor:"end",fontSize:t.textSize,fill:t.textColor,...y})):(m.push({type:"line",x1:n,y1:u.position,x2:n+4,y2:u.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:u.label,x:this.#n(n+8,u.label,"start"),y:u.position+4,anchor:"start",fontSize:t.textSize,fill:t.textColor,...y}));});}else {let[c,p]=this.#e.range();m.push({type:"line",x1:c,y1:n,x2:p,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let h of e)m.push({type:"line",x1:h.position,y1:n,x2:h.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),m.push({type:"text",content:h.label,x:h.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}let d=(this.#t.orientation??"vertical")==="vertical";for(let c of this.generateMinorTicks())m.push(d?{type:"line",x1:o==="right"?n:n-2,y1:c,x2:o==="right"?n+2:n,y2:c,stroke:t.tickColor,strokeWidth:t.axisWidth}:{type:"line",x1:c,y1:n,x2:c,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});return m}#n(e,t,n){let r=this.#t.gesamtbreite,o=this.#t.metrics;if(r===void 0||o===void 0)return e;let l=o(t,(this.#t.colors??P).textSize);return n==="end"?Math.max(l+2,Math.min(r-2,e)):Math.min(r-l-2,Math.max(2,e))}};var se=class i{#e;#t;#n;#r;#a;#o;#i;constructor(e){this.#e=[...e.data].sort((t,n)=>t.time-n.time),this.#t=e.windowSize,this.#n=e.type??"simple",this.#r=e.timeScale,this.#a=e.valueScale,this.#o=e.stroke??"#e53e3e",this.#i=e.strokeWidth??2;}static simple(e,t){let n=[...e].filter(o=>o.value!==null).sort((o,l)=>o.time-l.time),r=[];for(let o=0;o<n.length;o++){let l=Math.max(0,o-t+1),s=n.slice(l,o+1),a=s.reduce((m,d)=>m+d.value,0)/s.length;r.push({time:n[o].time,value:a});}return r}static exponential(e,t){let n=[...e].filter(s=>s.value!==null).sort((s,a)=>s.time-a.time);if(n.length===0)return [];let r=2/(t+1),o=[],l=n[0].value;o.push({time:n[0].time,value:l});for(let s=1;s<n.length;s++)l=n[s].value*r+l*(1-r),o.push({time:n[s].time,value:l});return o}points(){return (this.#n==="exponential"?i.exponential(this.#e,this.#t):i.simple(this.#e,this.#t)).map(t=>({x:this.#r.map(t.time),y:this.#a.map(t.value)}))}render(){let e=this.points();return e.length<2?e.map(t=>({type:"circle",cx:t.x,cy:t.y,r:this.#i,fill:this.#o})):[{type:"path",points:e,smoothing:true,stroke:this.#o,strokeWidth:this.#i}]}};var le=class{#e;#t;#n;constructor(e){let t=Object.keys(e.enumMap).map(Number).sort((n,r)=>n-r).map(String);this.#t=t,this.#e=new z({domain:t,range:e.range}),this.#n=e;}get scale(){return this.#e}generateTicks(){let{enumMap:e,showLabels:t=true,autoColor:n=true,gapValues:r}=this.#n,o=new Set(r??[]);return this.#t.map((l,s)=>{let a=Number(l),m=t?e[a]??String(a):String(a),d=this.#e.map(a),c=n?f.palette[s%f.palette.length]:void 0;return {value:a,label:m,y:d,color:c,isGap:o.has(a)}})}colorFor(e){let t=this.#t.indexOf(String(e));if(!(t===-1||!(this.#n.autoColor??true)))return f.palette[t%f.palette.length]}render(){let e=this.generateTicks(),t=this.#n.x??0,n=[];for(let r of e)r.isGap||n.push({type:"text",content:r.label,x:t,y:r.y+4,anchor:"end",fontSize:f.textSize,fill:r.color??f.textColor});return n}map(e){return this.#e.map(e)}isGap(e){return new Set(this.#n.gapValues??[]).has(e)}};var M=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 me=class extends M{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale;return this.data.filter(t=>t.value!==null).map(t=>({x:this.timeScale.map(t.time),y:e.map(t.value),time:t.time})).sort((t,n)=>t.x-n.x)}render(){let e=this.#e,t={smoothing:e.smoothing??false,smoothingType:e.smoothingType,stroke:e.stroke??f.stroke,strokeWidth:e.strokeWidth??f.strokeWidth,dashed:e.dashed??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??f.pointSize,shadowColor:e.shadowColor,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY},n=e.pointThreshold??f.pointThreshold,r=e.gapThreshold??f.gapThreshold,o=e.id,l=w.getRuns(this.data,c=>c.value===null,r),s=l.reduce((c,p)=>c+p.length,0);if(s===0)return [];let a={timeScale:this.timeScale,valueScale:e.valueScale},m=l.map(c=>({data:c})),d=[];return d.push(...L(m,a,{...t,id:o?`${o}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&s<=n&&d.push(...Q(l.flat(),a,{...t,id:o?`${o}-marker`:void 0},()=>t.stroke)),d}};var ue=class extends M{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale,t=[...this.data].filter(r=>r.value!==null).sort((r,o)=>r.time-o.time),n=[];for(let r=0;r<t.length;r++){let o=this.timeScale.map(t[r].time),l=e.map(t[r].value);r===0?n.push({x:o,y:l}):n.push({x:o,y:n[n.length-1].y},{x:o,y:l});}return n}render(){let e=w.getRuns(this.data,r=>r.value===null);if(e.length===0)return [];let t={timeScale:this.timeScale,valueScale:this.#e.valueScale},n=e.map(r=>({data:r}));return q(n,t,{stroke:this.#e.stroke??f.stroke,strokeWidth:this.#e.strokeWidth??f.strokeWidth,id:this.id?`${this.id}-line`:void 0})}};var ce=class extends M{#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??f.bandFill,n=e.hatch,r=e.avgLine??false,o=e.avgLineColor??f.bandAvgLine,l=e.bandWidth??10,s=[];for(let a of this.data){if(a.min===null||a.max===null)continue;let m=this.timeScale.map(a.time),d=e.valueScale.map(a.max),c=e.valueScale.map(a.min),p=l,h=this.data.indexOf(a);if(s.push({type:"rect",x:m-p/2,y:d,w:p,h:c-d,fill:t,hatch:n,opacity:this.opacity(a.count),id:this.id?`${this.id}-slot-${h}`:void 0}),r&&a.avg!==null){let u=e.valueScale.map(a.avg);s.push({type:"line",x1:m-p/2,y1:u,x2:m+p/2,y2:u,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${h}`:void 0});}}return s}};function Le(i,e,t,n,r,o,l){return J(i,e,{boundaries:[],yLow:s=>s.avg,yHigh:t,getValue:s=>s.avg,interpolate:w.interpolateAggregatedPoint,getColor:()=>n,getHatch:()=>r},{id:o,...l})}var de=class extends M{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??f.minColor,n=e.maxColor??f.maxColor,r=e.avgColor??f.avgColor,o=e.avgDashed??true,l=e.smoothing??false,s=e.smoothingType,a=e.strokeWidth??f.strokeWidth,m=w.getRuns(this.data,u=>u.min===null||u.max===null||u.avg===null);if(m.length===0)return [];let d={timeScale:this.timeScale,valueScale:e.valueScale},c=[];m.forEach((u,b)=>{if(u.length<2)return;let g=y=>this.id?`${this.id}-${y}-${b}`:void 0;if(e.fillToMax){let y=Le(u,d,x=>x.max,e.fillToMax,e.fillToMaxHatch,g("fillToMax"),{smoothing:l,smoothingType:s});c.push(...y);}if(e.fillToMin){let y=Le(u,d,x=>x.min,e.fillToMin,e.fillToMinHatch,g("fillToMin"),{smoothing:l,smoothingType:s});c.push(...y);}});let p=m.filter(u=>u.length>=2),h=(u,b,g,y=false)=>L(p.map(x=>({data:x.map(S=>({time:S.time,value:u(S)}))})),d,{stroke:b,strokeWidth:a,smoothing:l,smoothingType:s,dashed:y,id:this.id?`${this.id}-${g}`:void 0});return c.push(...h(u=>u.max,n,"max"),...h(u=>u.min,t,"min"),...h(u=>u.avg,r,"avg",o)),c}};var De=1,dt="#6b728044";var _e=4;function ht(i,e="last"){let t=[...i].sort((o,l)=>o.time-l.time||o.index-l.index),n=[],r=o=>n.every(l=>o.right+_e<=l.left||l.right+_e<=o.left);t.length>0&&n.push(e==="first"?t[0]:t[t.length-1]);for(let o of t)o!==n[0]&&r(o)&&n.push(o);return new Set(n.map(o=>o.index))}function pt(i){let e=typeof i=="object"&&i!==null?i.mode:i,t=typeof i=="object"&&i!==null&&i.keep==="first"?"first":"last";return {fit:e==="fit",keep:t}}var he=class{#e;constructor(e,t,n,r){this.#e={...e,xRange:t,y:n,height:r};}render(){let{items:e,timeScale:t,background:n,hatch:r,showAxis:o,xRange:l,y:s,height:a}=this.#e,m=[];n&&m.push({type:"rect",x:l[0],y:s,w:l[1]-l[0],h:a,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});let d=this.#n();if(e.forEach((c,p)=>{let h=this.#t(c);if(!h)return;let{startX:u,w:b}=h,g=u+b/2;if(m.push({type:"rect",x:u,y:s,w:b,h:a,hatch:c.hatch??r,fill:c.fill??dt,stroke:c.stroke,strokeWidth:c.strokeWidth??0,title:c.title}),c.label&&(!d||d.has(p))){let y=c.labelFontSize??10;m.push({type:"text",content:c.label,x:g,y:this.#r(c.labelBaseline,y),anchor:"middle",fontSize:y,fill:c.labelFill??"#333"});}}),o){let c=new H({domain:t.domain(),xRange:l,y:s+a+4});m.push({type:"group",cssClass:"annotation-band-axis",commands:c.render()});}return m}#t(e){let{timeScale:t,xRange:n,minItemWidth:r=0}=this.#e,o=t.map(e.startTime),l=t.map(e.endTime);if(l<n[0]||o>n[1])return null;let s=Math.max(n[0],Math.min(n[1],o)),a=Math.max(n[0],Math.min(n[1],l)),m=Math.max(a-s,De);return r>De&&a-s<r&&(s=(s+a)/2-r/2,m=r),s=Math.max(n[0],s),s+m>n[1]&&(s=Math.max(n[0],n[1]-m)),{startX:s,w:m}}#n(){let{fit:e,keep:t}=pt(this.#e.labels);if(!e)return null;let n=this.#e.metrics??_,r=[];return this.#e.items.forEach((o,l)=>{let s=o.label?this.#t(o):null;if(!s||!o.label)return;let a=s.startX+s.w/2,m=n(o.label,o.labelFontSize??10)/2;r.push({index:l,time:o.startTime,left:a-m,right:a+m});}),ht(r,t)}#r(e,t){let{y:n,height:r}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+r-t*.25;default:return n+r/2+t*.35}}};var pe=class{#e;constructor(e){this.#e=e;}render(){let{data:e,valueScale:t,xRange:n,showMin:r=false,showMax:o=false,showAvg:l=true,showMedian:s=false,labelPosition:a="end",lineColor:m=f.statsLineColor,labelColor:d=f.statsLabelColor}=this.#e,c=ye.compute(e),p=[{name:"min",value:c.min,enabled:r},{name:"max",value:c.max,enabled:o},{name:"avg",value:c.avg,enabled:l},{name:"median",value:c.median,enabled:s}],h=[],[u,b]=n;for(let g of p.filter(y=>y.enabled)){let y=t.map(g.value);h.push({type:"line",x1:u,y1:y,x2:b,y2:y,stroke:m,strokeWidth:1});let x=`${g.name}: ${g.value.toFixed(1)}`;(a==="start"||a==="both")&&h.push({type:"text",content:x,x:u+4,y:y-4,anchor:"start",fontSize:f.statFontSize,fill:d}),(a==="end"||a==="both")&&h.push({type:"text",content:x,x:b-4,y:y-4,anchor:"end",fontSize:f.statFontSize,fill:d}),a==="center"&&h.push({type:"text",content:x,x:(u+b)/2,y:y-4,anchor:"middle",fontSize:f.statFontSize,fill:d});}return h}};var $=class{#e;#t;#n;constructor(e){this.#e=e?.locale||(X()??"en-US"),this.#t=e?.fallbackLocales??["en-US"],this.#n=e?.autoFormat??true;}format(e,t,n){try{let r=this.#n&&n?this.#r(e,n,t):t;return O(this.#e,r).format(new Date(e))}catch{for(let r of this.#t)try{return O(r,t).format(new Date(e))}catch{}return new Date(e).toISOString()}}formatRange(e,t){let n=this.format(e),r=this.format(t);return `${n} \u2014 ${r}`}#r(e,t,n){let r=Math.abs(e-t),o=864e5,l=36e5,s=6e4,a={};return r<s?(a.second="2-digit",a.minute="2-digit",a.hour="2-digit"):r<l?(a.minute="2-digit",a.hour="2-digit"):r<o?(a.hour="2-digit",a.minute="2-digit"):r<7*o?(a.weekday="short",a.day="numeric"):r<365*o?(a.month="short",a.day="numeric"):(a.month="short",a.year="numeric"),{...n,...a}}};var F=class i{#e;#t;_compact;#n;constructor(e){this.#e=e?.unit??"",this.#t=e?.decimals??1,this._compact=e?.compact??false,this.#n=e?.custom;}format(e){if(this.#n)return this.#n(e);let t;return this._compact&&Math.abs(e)>=1e6?t=`${(e/1e6).toFixed(this.#t)}M`:this._compact&&Math.abs(e)>=1e3?t=`${(e/1e3).toFixed(this.#t)}k`:t=e.toFixed(this.#t),this.#e?`${t}${this.#e}`:t}formatRange(e,t){return `${this.format(e)} \u2014 ${this.format(t)}`}static unit(e,t=1){return new i({unit:e,decimals:t})}static temperature(e="\xB0C"){return new i({unit:e,decimals:1})}static percentage(){return new i({unit:"%",decimals:0})}};var W=class i{#e;#t;#n;constructor(e){this.#e=e?.map??{},this.#t=e?.fallback??(t=>String(t)),this.#n=e?.showValue??false;}format(e){let t=this.#e[e]??this.#t(e);return this.#n?`(${e}) ${t}`:t}has(e){return e in this.#e}labels(){return Object.values(this.#e)}values(){return Object.keys(this.#e).map(Number)}static fromLabels(e,t=false){let n={};return e.forEach((r,o)=>{n[o]=r;}),new i({map:n,showValue:t})}};var ft={time:new $,value:new F,enum:new W};function fe(i,e){let t=D();return {color:i.color??t.stroke,width:i.width??t.strokeWidth,style:i.style??"solid",smoothing:i.smoothing??false,smoothingType:i.smoothingType,shape:i.shape??(e.seriesType==="step"?"step":"line"),gapThreshold:i.gapThreshold??t.gapThreshold,opacity:i.opacity??1}}function Ae(i){let e=i.style?.line;return e===false?[]:e===void 0?[fe({},i)]:Array.isArray(e)?e.map(t=>fe(t,i)):[fe(e,i)]}function Re(i){let e=i.style?.markers;if(!e?.type||e.type==="none")return;let t=D(),r=(i.style?.line&&!Array.isArray(i.style.line)?i.style.line.color:void 0)??t.stroke;return {type:e.type,size:e.size??t.pointSize,stroke:e.stroke??r,fill:e.fill??"#ffffff",strokeWidth:e.strokeWidth??1,threshold:e.threshold}}function Pe(i){let e=i.style?.shadow;if(!(!e?.color||e.color==="transparent"||e.color==="none"))return {color:e.color,blur:e.blur??4,offsetX:e.offsetX??0,offsetY:e.offsetY??0}}function $e(i){return i.style?.gap}function Fe(i){return i.style?.fill}function gt(i){return {lines:Ae(i),fill:Fe(i),markers:Re(i),shadow:Pe(i),gap:$e(i),id:i.style?.id??i.id}}/*!
28
28
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
29
29
  * MIT with Attribution: free use incl. commercial requires visible credit to
30
30
  * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
@@ -43,4 +43,4 @@ var Z=class{};var T=class{static interpolateDataPoint(i,e,t){return {time:i.time
43
43
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
44
44
  * MIT with Attribution: free use incl. commercial must have visible credit to
45
45
  * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
46
- */export{he as AnnotationBandSeries,z as BandScale,ce as BandSeries,oe as Clip,B as CommandBuilder,le as EnumAxis,W as EnumFormatter,pt as Formatters,re as Layout,me as LineSeries,R as LinearScale,de as MinMaxAvgSeries,se as MovingAvg,Z as Renderer,pe as StatsOverlay,ue as StepSeries,w as TIME_INTERVALS,H as TimeAxis,$ as TimeFormatter,E as TimeScale,ae as ValueAxis,F as ValueFormatter,Te as getHatch,ve as measureLegend,lt as renderAnnotations,Be as renderArea,ot as renderGaps,qe as renderGrid,at as renderHighlights,Ze as renderLegend,L as renderLine,it as renderMarkers,Q as renderSeriesMarkers,je as renderSplitLine,q as renderStep,tt as renderThresholds,J as renderZonedArea,Fe as resolveFill,$e as resolveGap,Ae as resolveLines,Re as resolveMarkers,ft as resolveSeriesStyle,Pe as resolveShadow,ne as slugify,f as theme,We as toStepData,K as toStepPoints};
46
+ */export{he as AnnotationBandSeries,z as BandScale,ce as BandSeries,oe as Clip,B as CommandBuilder,le as EnumAxis,W as EnumFormatter,ft as Formatters,re as Layout,me as LineSeries,R as LinearScale,de as MinMaxAvgSeries,se as MovingAvg,Z as Renderer,pe as StatsOverlay,ue as StepSeries,v as TIME_INTERVALS,H as TimeAxis,$ as TimeFormatter,E as TimeScale,ae as ValueAxis,F as ValueFormatter,Te as getHatch,ve as measureLegend,mt as renderAnnotations,Be as renderArea,it as renderGaps,Je as renderGrid,st as renderHighlights,Ze as renderLegend,L as renderLine,at as renderMarkers,Q as renderSeriesMarkers,je as renderSplitLine,q as renderStep,nt as renderThresholds,J as renderZonedArea,Fe as resolveFill,$e as resolveGap,Ae as resolveLines,Re as resolveMarkers,gt as resolveSeriesStyle,Pe as resolveShadow,ne as slugify,f as theme,We as toStepData,K as toStepPoints};
@@ -1,4 +1,4 @@
1
- import { a as DrawCommand, b as LineDashStyle, c as LineVariant, P as PointStyleType, d as DrawGroup, M as MarkerLineStyle, G as GridLayer, A as AxisPosition, e as AnySeries, f as Threshold, H as Highlight, g as Gap, h as GapsConfig, i as Annotation, j as AnnotationBandConfig, S as SmoothingType, k as HatchVariant, T as TimeScale, L as LinearScale, D as DataPoint } from './types-fDUNEN4P.js';
1
+ import { a as DrawCommand, b as LineDashStyle, c as LineVariant, P as PointStyleType, d as DrawGroup, M as MarkerLineStyle, G as GridLayer, A as AxisPosition, e as AnySeries, f as Threshold, H as Highlight, g as Gap, h as GapsConfig, i as Annotation, j as AnnotationBandConfig, S as SmoothingType, k as HatchVariant, T as TimeScale, L as LinearScale, D as DataPoint } from './types-B9bbJxmn.js';
2
2
 
3
3
  /** Output format type for the renderer (SVG string, Canvas, or nothing). */
4
4
  type RenderType = "svg" | "canvas" | "none";
@@ -356,6 +356,14 @@ interface LegendItem {
356
356
  * Draw it with `drawMarker()`.
357
357
  */
358
358
  marker?: Exclude<PointStyleType, "none">;
359
+ /**
360
+ * The section colours when the swatch is multi-coloured
361
+ * (`series.legend.colors`) -- for a series coloured by thresholds, whose base
362
+ * colour alone would name only its lowest zone. Draw them as stripes side by
363
+ * side. {@link color} stays the base colour, so a legend of your own that
364
+ * reads only `color` does not change.
365
+ */
366
+ colors?: string[];
359
367
  }
360
368
  /** Layout direction for legend items. */
361
369
  type LegendOrientation = "vertical" | "horizontal";
@@ -929,6 +929,23 @@ type SensorType = "numeric" | "enum";
929
929
  interface EnumMap {
930
930
  [key: number]: string;
931
931
  }
932
+ /**
933
+ * How the legend shows a series (I-TGRAF-20261106-02).
934
+ *
935
+ * Anlass (mlcsensormonitor): Eine Reihe mit `colorByThresholds` -- unten blau,
936
+ * im Bereich gruen, oben rot -- bekam in der Legende nur ihre Grundfarbe, und
937
+ * das ist die des UNTERSTEN Bereichs. Neben einer gruenen Kurve stand ein
938
+ * blaues Kaestchen. Gegenstueck: SeriesLegend in
939
+ * go-time-graph/pkg/models/series_legend.go.
940
+ */
941
+ interface SeriesLegend {
942
+ /**
943
+ * Draw the legend swatch in several sections side by side, left to right in
944
+ * this order -- e.g. the zone colours of a series coloured by thresholds.
945
+ * Without it (or with a single colour) the swatch stays one colour.
946
+ */
947
+ colors?: string[];
948
+ }
932
949
  /** Raw series (numeric or enum) */
933
950
  interface TimeSeries {
934
951
  name: string;
@@ -962,6 +979,8 @@ interface TimeSeries {
962
979
  colorByThresholds?: string[];
963
980
  /** Optional SVG id prefix for series elements. */
964
981
  id?: string;
982
+ /** How the legend shows this series -- see {@link SeriesLegend}. */
983
+ legend?: SeriesLegend;
965
984
  /** Luecken je Reihe -- etwa `atEnd: false` fuer einen Melder, der absichtlich schweigt. */
966
985
  gaps?: SeriesGaps;
967
986
  /**
@@ -1012,6 +1031,8 @@ interface AggregatedSeries {
1012
1031
  fillToMinHatch?: HatchVariant;
1013
1032
  /** Optional SVG id prefix for series elements. */
1014
1033
  id?: string;
1034
+ /** How the legend shows this series -- see {@link SeriesLegend}. */
1035
+ legend?: SeriesLegend;
1015
1036
  }
1016
1037
  /** Series type: raw, enum, or aggregated */
1017
1038
  type AnySeries = TimeSeries | AggregatedSeries;
@@ -1272,5 +1293,5 @@ interface AnnotationBandConfig {
1272
1293
  labels?: AnnotationBandLabels;
1273
1294
  }
1274
1295
 
1275
- export { LinearScale as L, TimeScale as T, getHatch as aA, getLineStyle as ab, resolveDash as ac, BandScale as ak, TIME_INTERVALS as ay };
1276
- export type { MarkerStyle as $, AxisPosition as A, AxisOrientation as B, DataPointRef as C, DataPoint as D, EnumMap as E, FillSpec as F, GridLayer as G, Highlight as H, FillBound as I, FillRegion as J, FillSide as K, MarkerLineStyle as M, FillStyle as N, FillWhere as O, PointStyleType as P, GapBand as Q, RangeLabelPosition as R, SmoothingType as S, GapConfig as U, GapLabel as V, GapRegion as W, GapStyle as X, GapsAtEnd as Y, LineShape as Z, LineStyle as _, DrawCommand as a, MovingAverageType as a0, SVGLineStyle as a1, SensorType as a2, SeriesGapStyle as a3, SeriesGaps as a4, SeriesOverlay as a5, SeriesOverlayKind as a6, SeriesType as a7, ShadowStyle as a8, SolidDashStyle as a9, ThresholdLabelConfig as aa, LineParams as ad, PathParams as ae, RectParams as af, CircleParams as ag, TextParams as ah, GapParams as ai, Point as aj, BandScaleConfig as al, Dashstyle_t as am, DomainScaleConfig as an, DrawCircle as ao, DrawGap as ap, DrawGapType_t$1 as aq, DrawLine as ar, DrawPath as as, DrawRect as at, DrawText as au, LinearScaleConfig as av, Scale as aw, ScaleConfig as ax, TimeScaleConfig as az, LineDashStyle as b, LineVariant as c, DrawGroup as d, AnySeries as e, Threshold as f, Gap as g, GapsConfig as h, Annotation as i, AnnotationBandConfig as j, HatchVariant as k, SeriesStyle as l, TimeSeries as m, ThresholdFill as n, ThresholdLabelPosition as o, AnnotationPointShape as p, LabelAnchor as q, AnnotationBandItem as r, TextBaseline as s, AggregatedPoint as t, AggregatedSeries as u, AggregatedShowAs as v, AggregationConfig as w, AggregationMode as x, AnnotationBandLabels as y, AnnotationKind as z };
1296
+ export { LinearScale as L, TimeScale as T, getHatch as aB, getLineStyle as ac, resolveDash as ad, BandScale as al, TIME_INTERVALS as az };
1297
+ export type { MarkerStyle as $, AxisPosition as A, AxisOrientation as B, DataPointRef as C, DataPoint as D, EnumMap as E, FillSpec as F, GridLayer as G, Highlight as H, FillBound as I, FillRegion as J, FillSide as K, MarkerLineStyle as M, FillStyle as N, FillWhere as O, PointStyleType as P, GapBand as Q, RangeLabelPosition as R, SmoothingType as S, GapConfig as U, GapLabel as V, GapRegion as W, GapStyle as X, GapsAtEnd as Y, LineShape as Z, LineStyle as _, DrawCommand as a, MovingAverageType as a0, SVGLineStyle as a1, SensorType as a2, SeriesGapStyle as a3, SeriesGaps as a4, SeriesLegend as a5, SeriesOverlay as a6, SeriesOverlayKind as a7, SeriesType as a8, ShadowStyle as a9, TimeScaleConfig as aA, SolidDashStyle as aa, ThresholdLabelConfig as ab, LineParams as ae, PathParams as af, RectParams as ag, CircleParams as ah, TextParams as ai, GapParams as aj, Point as ak, BandScaleConfig as am, Dashstyle_t as an, DomainScaleConfig as ao, DrawCircle as ap, DrawGap as aq, DrawGapType_t$1 as ar, DrawLine as as, DrawPath as at, DrawRect as au, DrawText as av, LinearScaleConfig as aw, Scale as ax, ScaleConfig as ay, LineDashStyle as b, LineVariant as c, DrawGroup as d, AnySeries as e, Threshold as f, Gap as g, GapsConfig as h, Annotation as i, AnnotationBandConfig as j, HatchVariant as k, SeriesStyle as l, TimeSeries as m, ThresholdFill as n, ThresholdLabelPosition as o, AnnotationPointShape as p, LabelAnchor as q, AnnotationBandItem as r, TextBaseline as s, AggregatedPoint as t, AggregatedSeries as u, AggregatedShowAs as v, AggregationConfig as w, AggregationMode as x, AnnotationBandLabels as y, AnnotationKind as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ml-time-graph",
3
- "version": "1.23.0",
3
+ "version": "1.24.0",
4
4
  "description": "TypeScript library for time-series charts with rich contextual annotation — telemetry, sensors, metrics, logs, finance. DOM-free SVG output, identical in the browser and on the server.",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -15,6 +15,9 @@ mount('#chart', {
15
15
  });
16
16
  ```
17
17
 
18
+ Trap: the legend swatch of such a series shows only the base colour — the lowest zone.
19
+ Add `legend: { colors: [base, warnColor, critColor] }` to show all zones in the swatch.
20
+
18
21
  ## Filled Areas Between Curve and Threshold
19
22
  Use `style.fill.regions` with bounds (`from`, `to`, `side`, optional `hatch`):
20
23
  ```ts